diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/asyn.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/asyn.h new file mode 100644 index 0000000000000000000000000000000000000000..7e207c4f564fe5ba3c5c70cf863ae03449d9d5de --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/asyn.h @@ -0,0 +1,184 @@ +#ifndef HEADER_CURL_ASYN_H +#define HEADER_CURL_ASYN_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include "curl_addrinfo.h" + +struct addrinfo; +struct hostent; +struct Curl_easy; +struct connectdata; +struct Curl_dns_entry; + +/* + * This header defines all functions in the internal asynch resolver interface. + * All asynch resolvers need to provide these functions. + * asyn-ares.c and asyn-thread.c are the current implementations of asynch + * resolver backends. + */ + +/* + * Curl_resolver_global_init() + * + * Called from curl_global_init() to initialize global resolver environment. + * Returning anything else than CURLE_OK fails curl_global_init(). + */ +int Curl_resolver_global_init(void); + +/* + * Curl_resolver_global_cleanup() + * Called from curl_global_cleanup() to destroy global resolver environment. + */ +void Curl_resolver_global_cleanup(void); + +/* + * Curl_resolver_init() + * Called from curl_easy_init() -> Curl_open() to initialize resolver + * URL-state specific environment ('resolver' member of the UrlState + * structure). Should fill the passed pointer by the initialized handler. + * Returning anything else than CURLE_OK fails curl_easy_init() with the + * correspondent code. + */ +CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver); + +/* + * Curl_resolver_cleanup() + * Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver + * URL-state specific environment ('resolver' member of the UrlState + * structure). Should destroy the handler and free all resources connected to + * it. + */ +void Curl_resolver_cleanup(void *resolver); + +/* + * Curl_resolver_duphandle() + * Called from curl_easy_duphandle() to duplicate resolver URL-state specific + * environment ('resolver' member of the UrlState structure). Should + * duplicate the 'from' handle and pass the resulting handle to the 'to' + * pointer. Returning anything else than CURLE_OK causes failed + * curl_easy_duphandle() call. + */ +CURLcode Curl_resolver_duphandle(struct Curl_easy *easy, void **to, + void *from); + +/* + * Curl_resolver_cancel(). + * + * It is called from inside other functions to cancel currently performing + * resolver request. Should also free any temporary resources allocated to + * perform a request. This never waits for resolver threads to complete. + * + * It is safe to call this when conn is in any state. + */ +void Curl_resolver_cancel(struct Curl_easy *data); + +/* + * Curl_resolver_kill(). + * + * This acts like Curl_resolver_cancel() except it will block until any threads + * associated with the resolver are complete. This never blocks for resolvers + * that do not use threads. This is intended to be the "last chance" function + * that cleans up an in-progress resolver completely (before its owner is about + * to die). + * + * It is safe to call this when conn is in any state. + */ +void Curl_resolver_kill(struct Curl_easy *data); + +/* Curl_resolver_getsock() + * + * This function is called from the multi_getsock() function. 'sock' is a + * pointer to an array to hold the file descriptors, with 'numsock' being the + * size of that array (in number of entries). This function is supposed to + * return bitmask indicating what file descriptors (referring to array indexes + * in the 'sock' array) to wait for, read/write. + */ +int Curl_resolver_getsock(struct Curl_easy *data, curl_socket_t *sock); + +/* + * Curl_resolver_is_resolved() + * + * Called repeatedly to check if a previous name resolve request has + * completed. It should also make sure to time-out if the operation seems to + * take too long. + * + * Returns normal CURLcode errors. + */ +CURLcode Curl_resolver_is_resolved(struct Curl_easy *data, + struct Curl_dns_entry **dns); + +/* + * Curl_resolver_wait_resolv() + * + * Waits for a resolve to finish. This function should be avoided since using + * this risk getting the multi interface to "hang". + * + * If 'entry' is non-NULL, make it point to the resolved dns entry + * + * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, + * CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors. + */ +CURLcode Curl_resolver_wait_resolv(struct Curl_easy *data, + struct Curl_dns_entry **dnsentry); + +/* + * Curl_resolver_getaddrinfo() - when using this resolver + * + * Returns name information about the given hostname and port number. If + * successful, the 'hostent' is returned and the fourth argument will point to + * memory we need to free after use. That memory *MUST* be freed with + * Curl_freeaddrinfo(), nothing else. + * + * Each resolver backend must of course make sure to return data in the + * correct format to comply with this. + */ +struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data, + const char *hostname, + int port, + int *waitp); + +#ifndef CURLRES_ASYNCH +/* convert these functions if an asynch resolver isn't used */ +#define Curl_resolver_cancel(x) Curl_nop_stmt +#define Curl_resolver_kill(x) Curl_nop_stmt +#define Curl_resolver_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST +#define Curl_resolver_wait_resolv(x,y) CURLE_COULDNT_RESOLVE_HOST +#define Curl_resolver_duphandle(x,y,z) CURLE_OK +#define Curl_resolver_init(x,y) CURLE_OK +#define Curl_resolver_global_init() CURLE_OK +#define Curl_resolver_global_cleanup() Curl_nop_stmt +#define Curl_resolver_cleanup(x) Curl_nop_stmt +#endif + +#ifdef CURLRES_ASYNCH +#define Curl_resolver_asynch() 1 +#else +#define Curl_resolver_asynch() 0 +#endif + + +/********** end of generic resolver interface functions *****************/ +#endif /* HEADER_CURL_ASYN_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/bufq.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/bufq.h new file mode 100644 index 0000000000000000000000000000000000000000..089d61bfe4241342fc4fb2e751b4a77f7d6d4b94 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/bufq.h @@ -0,0 +1,265 @@ +#ifndef HEADER_CURL_BUFQ_H +#define HEADER_CURL_BUFQ_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#include + +/** + * A chunk of bytes for reading and writing. + * The size is fixed a creation with read and write offset + * for where unread content is. + */ +struct buf_chunk { + struct buf_chunk *next; /* to keep it in a list */ + size_t dlen; /* the amount of allocated x.data[] */ + size_t r_offset; /* first unread bytes */ + size_t w_offset; /* one after last written byte */ + union { + unsigned char data[1]; /* the buffer for `dlen` bytes */ + void *dummy; /* alignment */ + } x; +}; + +/** + * A pool for providing/keeping a number of chunks of the same size + * + * The same pool can be shared by many `bufq` instances. However, a pool + * is not thread safe. All bufqs using it are supposed to operate in the + * same thread. + */ +struct bufc_pool { + struct buf_chunk *spare; /* list of available spare chunks */ + size_t chunk_size; /* the size of chunks in this pool */ + size_t spare_count; /* current number of spare chunks in list */ + size_t spare_max; /* max number of spares to keep */ +}; + +void Curl_bufcp_init(struct bufc_pool *pool, + size_t chunk_size, size_t spare_max); + +void Curl_bufcp_free(struct bufc_pool *pool); + +/** + * A queue of byte chunks for reading and writing. + * Reading is done from `head`, writing is done to `tail`. + * + * `bufq`s can be empty or full or neither. Its `len` is the number + * of bytes that can be read. For an empty bufq, `len` will be 0. + * + * By default, a bufq can hold up to `max_chunks * chunk_size` number + * of bytes. When `max_chunks` are used (in the `head` list) and the + * `tail` chunk is full, the bufq will report that it is full. + * + * On a full bufq, `len` may be less than the maximum number of bytes, + * e.g. when the head chunk is partially read. `len` may also become + * larger than the max when option `BUFQ_OPT_SOFT_LIMIT` is used. + * + * By default, writing to a full bufq will return (-1, CURLE_AGAIN). Same + * as reading from an empty bufq. + * With `BUFQ_OPT_SOFT_LIMIT` set, a bufq will allow writing becond this + * limit and use more than `max_chunks`. However it will report that it + * is full nevertheless. This is provided for situation where writes + * preferably never fail (except for memory exhaustion). + * + * By default and without a pool, a bufq will keep chunks that read + * read empty in its `spare` list. Option `BUFQ_OPT_NO_SPARES` will + * disable that and free chunks once they become empty. + * + * When providing a pool to a bufq, all chunk creation and spare handling + * will be delegated to that pool. + */ +struct bufq { + struct buf_chunk *head; /* chunk with bytes to read from */ + struct buf_chunk *tail; /* chunk to write to */ + struct buf_chunk *spare; /* list of free chunks, unless `pool` */ + struct bufc_pool *pool; /* optional pool for free chunks */ + size_t chunk_count; /* current number of chunks in `head+spare` */ + size_t max_chunks; /* max `head` chunks to use */ + size_t chunk_size; /* size of chunks to manage */ + int opts; /* options for handling queue, see below */ +}; + +/** + * Default behaviour: chunk limit is "hard", meaning attempts to write + * more bytes than can be hold in `max_chunks` is refused and will return + * -1, CURLE_AGAIN. */ +#define BUFQ_OPT_NONE (0) +/** + * Make `max_chunks` a "soft" limit. A bufq will report that it is "full" + * when `max_chunks` are used, but allows writing beyond this limit. + */ +#define BUFQ_OPT_SOFT_LIMIT (1 << 0) +/** + * Do not keep spare chunks. + */ +#define BUFQ_OPT_NO_SPARES (1 << 1) + +/** + * Initialize a buffer queue that can hold up to `max_chunks` buffers + * each of size `chunk_size`. The bufq will not allow writing of + * more bytes than can be held in `max_chunks`. + */ +void Curl_bufq_init(struct bufq *q, size_t chunk_size, size_t max_chunks); + +/** + * Initialize a buffer queue that can hold up to `max_chunks` buffers + * each of size `chunk_size` with the given options. See `BUFQ_OPT_*`. + */ +void Curl_bufq_init2(struct bufq *q, size_t chunk_size, + size_t max_chunks, int opts); + +void Curl_bufq_initp(struct bufq *q, struct bufc_pool *pool, + size_t max_chunks, int opts); + +/** + * Reset the buffer queue to be empty. Will keep any allocated buffer + * chunks around. + */ +void Curl_bufq_reset(struct bufq *q); + +/** + * Free all resources held by the buffer queue. + */ +void Curl_bufq_free(struct bufq *q); + +/** + * Return the total amount of data in the queue. + */ +size_t Curl_bufq_len(const struct bufq *q); + +/** + * Return the total amount of free space in the queue. + * The returned length is the number of bytes that can + * be expected to be written successfully to the bufq, + * providing no memory allocations fail. + */ +size_t Curl_bufq_space(const struct bufq *q); + +/** + * Returns TRUE iff there is no data in the buffer queue. + */ +bool Curl_bufq_is_empty(const struct bufq *q); + +/** + * Returns TRUE iff there is no space left in the buffer queue. + */ +bool Curl_bufq_is_full(const struct bufq *q); + +/** + * Write buf to the end of the buffer queue. The buf is copied + * and the amount of copied bytes is returned. + * A return code of -1 indicates an error, setting `err` to the + * cause. An err of CURLE_AGAIN is returned if the buffer queue is full. + */ +ssize_t Curl_bufq_write(struct bufq *q, + const unsigned char *buf, size_t len, + CURLcode *err); + +/** + * Read buf from the start of the buffer queue. The buf is copied + * and the amount of copied bytes is returned. + * A return code of -1 indicates an error, setting `err` to the + * cause. An err of CURLE_AGAIN is returned if the buffer queue is empty. + */ +ssize_t Curl_bufq_read(struct bufq *q, unsigned char *buf, size_t len, + CURLcode *err); + +/** + * Peek at the head chunk in the buffer queue. Returns a pointer to + * the chunk buf (at the current offset) and its length. Does not + * modify the buffer queue. + * Returns TRUE iff bytes are available. Sets `pbuf` to NULL and `plen` + * to 0 when no bytes are available. + * Repeated calls return the same information until the buffer queue + * is modified, see `Curl_bufq_skip()`` + */ +bool Curl_bufq_peek(struct bufq *q, + const unsigned char **pbuf, size_t *plen); + +bool Curl_bufq_peek_at(struct bufq *q, size_t offset, + const unsigned char **pbuf, size_t *plen); + +/** + * Tell the buffer queue to discard `amount` buf bytes at the head + * of the queue. Skipping more buf than is currently buffered will + * just empty the queue. + */ +void Curl_bufq_skip(struct bufq *q, size_t amount); + +typedef ssize_t Curl_bufq_writer(void *writer_ctx, + const unsigned char *buf, size_t len, + CURLcode *err); +/** + * Passes the chunks in the buffer queue to the writer and returns + * the amount of buf written. A writer may return -1 and CURLE_AGAIN + * to indicate blocking at which point the queue will stop and return + * the amount of buf passed so far. + * -1 is returned on any other errors reported by the writer. + * Note that in case of a -1 chunks may have been written and + * the buffer queue will have different length than before. + */ +ssize_t Curl_bufq_pass(struct bufq *q, Curl_bufq_writer *writer, + void *writer_ctx, CURLcode *err); + +typedef ssize_t Curl_bufq_reader(void *reader_ctx, + unsigned char *buf, size_t len, + CURLcode *err); + +/** + * Read date and append it to the end of the buffer queue until the + * reader returns blocking or the queue is full. A reader returns + * -1 and CURLE_AGAIN to indicate blocking. + * Returns the total amount of buf read (may be 0) or -1 on other + * reader errors. + * Note that in case of a -1 chunks may have been read and + * the buffer queue will have different length than before. + */ +ssize_t Curl_bufq_slurp(struct bufq *q, Curl_bufq_reader *reader, + void *reader_ctx, CURLcode *err); + +/** + * Read *once* up to `max_len` bytes and append it to the buffer. + * if `max_len` is 0, no limit is imposed besides the chunk space. + * Returns the total amount of buf read (may be 0) or -1 on other + * reader errors. + */ +ssize_t Curl_bufq_sipn(struct bufq *q, size_t max_len, + Curl_bufq_reader *reader, void *reader_ctx, + CURLcode *err); + +/** + * Write buf to the end of the buffer queue. + * Will write bufq content or passed `buf` directly using the `writer` + * callback when it sees fit. 'buf' might get passed directly + * on or is placed into the buffer, depending on `len` and current + * amount buffered, chunk size, etc. + */ +ssize_t Curl_bufq_write_pass(struct bufq *q, + const unsigned char *buf, size_t len, + Curl_bufq_writer *writer, void *writer_ctx, + CURLcode *err); + +#endif /* HEADER_CURL_BUFQ_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/bufref.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/bufref.h new file mode 100644 index 0000000000000000000000000000000000000000..dd424f18f5568680e2af9caac39a340244a4febe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/bufref.h @@ -0,0 +1,48 @@ +#ifndef HEADER_CURL_BUFREF_H +#define HEADER_CURL_BUFREF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* + * Generic buffer reference. + */ +struct bufref { + void (*dtor)(void *); /* Associated destructor. */ + const unsigned char *ptr; /* Referenced data buffer. */ + size_t len; /* The data size in bytes. */ +#ifdef DEBUGBUILD + int signature; /* Detect API use mistakes. */ +#endif +}; + + +void Curl_bufref_init(struct bufref *br); +void Curl_bufref_set(struct bufref *br, const void *ptr, size_t len, + void (*dtor)(void *)); +const unsigned char *Curl_bufref_ptr(const struct bufref *br); +size_t Curl_bufref_len(const struct bufref *br); +CURLcode Curl_bufref_memdup(struct bufref *br, const void *ptr, size_t len); +void Curl_bufref_free(struct bufref *br); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/c-hyper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/c-hyper.h new file mode 100644 index 0000000000000000000000000000000000000000..0c7de90b70b721be379a14b94853ba853355aba3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/c-hyper.h @@ -0,0 +1,59 @@ +#ifndef HEADER_CURL_HYPER_H +#define HEADER_CURL_HYPER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && defined(USE_HYPER) + +#include + +/* per-transfer data for the Hyper backend */ +struct hyptransfer { + hyper_waker *write_waker; + hyper_waker *read_waker; + const hyper_executor *exec; + hyper_waker *exp100_waker; + hyper_waker *send_body_waker; +}; + +size_t Curl_hyper_recv(void *userp, hyper_context *ctx, + uint8_t *buf, size_t buflen); +size_t Curl_hyper_send(void *userp, hyper_context *ctx, + const uint8_t *buf, size_t buflen); +CURLcode Curl_hyper_stream(struct Curl_easy *data, + struct connectdata *conn, + int *didwhat, + bool *done, + int select_res); + +CURLcode Curl_hyper_header(struct Curl_easy *data, hyper_headers *headers, + const char *line); +void Curl_hyper_done(struct Curl_easy *); + +#else +#define Curl_hyper_done(x) + +#endif /* !defined(CURL_DISABLE_HTTP) && defined(USE_HYPER) */ +#endif /* HEADER_CURL_HYPER_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-h1-proxy.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-h1-proxy.h new file mode 100644 index 0000000000000000000000000000000000000000..ac5bed0b2bc7ad4bce92730148afcdd0b362b584 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-h1-proxy.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_H1_PROXY_H +#define HEADER_CURL_H1_PROXY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP) + +CURLcode Curl_cf_h1_proxy_insert_after(struct Curl_cfilter *cf, + struct Curl_easy *data); + +extern struct Curl_cftype Curl_cft_h1_proxy; + + +#endif /* !CURL_DISABLE_PROXY && !CURL_DISABLE_HTTP */ + +#endif /* HEADER_CURL_H1_PROXY_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-h2-proxy.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-h2-proxy.h new file mode 100644 index 0000000000000000000000000000000000000000..c01bf62133b6a7c7191d590af508a7abf09d12af --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-h2-proxy.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_H2_PROXY_H +#define HEADER_CURL_H2_PROXY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(USE_NGHTTP2) && !defined(CURL_DISABLE_PROXY) + +CURLcode Curl_cf_h2_proxy_insert_after(struct Curl_cfilter *cf, + struct Curl_easy *data); + +extern struct Curl_cftype Curl_cft_h2_proxy; + + +#endif /* defined(USE_NGHTTP2) && !defined(CURL_DISABLE_PROXY) */ + +#endif /* HEADER_CURL_H2_PROXY_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-haproxy.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-haproxy.h new file mode 100644 index 0000000000000000000000000000000000000000..d02c323e7b7082604a8e87997babaa6f8c97db4b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-haproxy.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_CF_HAPROXY_H +#define HEADER_CURL_CF_HAPROXY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include "urldata.h" + +#if !defined(CURL_DISABLE_PROXY) + +CURLcode Curl_cf_haproxy_insert_after(struct Curl_cfilter *cf_at, + struct Curl_easy *data); + +extern struct Curl_cftype Curl_cft_haproxy; + +#endif /* !CURL_DISABLE_PROXY */ + +#endif /* HEADER_CURL_CF_HAPROXY_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-https-connect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-https-connect.h new file mode 100644 index 0000000000000000000000000000000000000000..6a39527317c1a29f0297955030e13ff920329b41 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-https-connect.h @@ -0,0 +1,58 @@ +#ifndef HEADER_CURL_CF_HTTP_H +#define HEADER_CURL_CF_HTTP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER) + +struct Curl_cfilter; +struct Curl_easy; +struct connectdata; +struct Curl_cftype; +struct Curl_dns_entry; + +extern struct Curl_cftype Curl_cft_http_connect; + +CURLcode Curl_cf_http_connect_add(struct Curl_easy *data, + struct connectdata *conn, + int sockindex, + const struct Curl_dns_entry *remotehost, + bool try_h3, bool try_h21); + +CURLcode +Curl_cf_http_connect_insert_after(struct Curl_cfilter *cf_at, + struct Curl_easy *data, + const struct Curl_dns_entry *remotehost, + bool try_h3, bool try_h21); + + +CURLcode Curl_cf_https_setup(struct Curl_easy *data, + struct connectdata *conn, + int sockindex, + const struct Curl_dns_entry *remotehost); + + +#endif /* !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER) */ +#endif /* HEADER_CURL_CF_HTTP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-socket.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-socket.h new file mode 100644 index 0000000000000000000000000000000000000000..1d40df737fcef6a87e8063409014764b711f332a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cf-socket.h @@ -0,0 +1,191 @@ +#ifndef HEADER_CURL_CF_SOCKET_H +#define HEADER_CURL_CF_SOCKET_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */ +#include "sockaddr.h" + +struct Curl_addrinfo; +struct Curl_cfilter; +struct Curl_easy; +struct connectdata; +struct Curl_sockaddr_ex; + +#ifndef SIZEOF_CURL_SOCKET_T +/* configure and cmake check and set the define */ +# ifdef _WIN64 +# define SIZEOF_CURL_SOCKET_T 8 +# else +/* default guess */ +# define SIZEOF_CURL_SOCKET_T 4 +# endif +#endif + +#if SIZEOF_CURL_SOCKET_T < 8 +# define CURL_FORMAT_SOCKET_T "d" +#else +# define CURL_FORMAT_SOCKET_T "qd" +#endif + + +/* + * The Curl_sockaddr_ex structure is basically libcurl's external API + * curl_sockaddr structure with enough space available to directly hold any + * protocol-specific address structures. The variable declared here will be + * used to pass / receive data to/from the fopensocket callback if this has + * been set, before that, it is initialized from parameters. + */ +struct Curl_sockaddr_ex { + int family; + int socktype; + int protocol; + unsigned int addrlen; + union { + struct sockaddr addr; + struct Curl_sockaddr_storage buff; + } _sa_ex_u; +}; +#define sa_addr _sa_ex_u.addr + + +/* + * Create a socket based on info from 'conn' and 'ai'. + * + * Fill in 'addr' and 'sockfd' accordingly if OK is returned. If the open + * socket callback is set, used that! + * + */ +CURLcode Curl_socket_open(struct Curl_easy *data, + const struct Curl_addrinfo *ai, + struct Curl_sockaddr_ex *addr, + int transport, + curl_socket_t *sockfd); + +int Curl_socket_close(struct Curl_easy *data, struct connectdata *conn, + curl_socket_t sock); + +#ifdef USE_WINSOCK +/* When you run a program that uses the Windows Sockets API, you may + experience slow performance when you copy data to a TCP server. + + https://support.microsoft.com/kb/823764 + + Work-around: Make the Socket Send Buffer Size Larger Than the Program Send + Buffer Size + +*/ +void Curl_sndbufset(curl_socket_t sockfd); +#else +#define Curl_sndbufset(y) Curl_nop_stmt +#endif + +/** + * Assign the address `ai` to the Curl_sockaddr_ex `dest` and + * set the transport used. + */ +void Curl_sock_assign_addr(struct Curl_sockaddr_ex *dest, + const struct Curl_addrinfo *ai, + int transport); + +/** + * Creates a cfilter that opens a TCP socket to the given address + * when calling its `connect` implementation. + * The filter will not touch any connection/data flags and can be + * used in happy eyeballing. Once selected for use, its `_active()` + * method needs to be called. + */ +CURLcode Curl_cf_tcp_create(struct Curl_cfilter **pcf, + struct Curl_easy *data, + struct connectdata *conn, + const struct Curl_addrinfo *ai, + int transport); + +/** + * Creates a cfilter that opens a UDP socket to the given address + * when calling its `connect` implementation. + * The filter will not touch any connection/data flags and can be + * used in happy eyeballing. Once selected for use, its `_active()` + * method needs to be called. + */ +CURLcode Curl_cf_udp_create(struct Curl_cfilter **pcf, + struct Curl_easy *data, + struct connectdata *conn, + const struct Curl_addrinfo *ai, + int transport); + +/** + * Creates a cfilter that opens a UNIX socket to the given address + * when calling its `connect` implementation. + * The filter will not touch any connection/data flags and can be + * used in happy eyeballing. Once selected for use, its `_active()` + * method needs to be called. + */ +CURLcode Curl_cf_unix_create(struct Curl_cfilter **pcf, + struct Curl_easy *data, + struct connectdata *conn, + const struct Curl_addrinfo *ai, + int transport); + +/** + * Creates a cfilter that keeps a listening socket. + */ +CURLcode Curl_conn_tcp_listen_set(struct Curl_easy *data, + struct connectdata *conn, + int sockindex, + curl_socket_t *s); + +/** + * Replace the listen socket with the accept()ed one. + */ +CURLcode Curl_conn_tcp_accepted_set(struct Curl_easy *data, + struct connectdata *conn, + int sockindex, + curl_socket_t *s); + +/** + * Peek at the socket and remote ip/port the socket filter is using. + * The filter owns all returned values. + * @param psock pointer to hold socket descriptor or NULL + * @param paddr pointer to hold addr reference or NULL + * @param pr_ip_str pointer to hold remote addr as string or NULL + * @param pr_port pointer to hold remote port number or NULL + * @param pl_ip_str pointer to hold local addr as string or NULL + * @param pl_port pointer to hold local port number or NULL + * Returns error if the filter is of invalid type. + */ +CURLcode Curl_cf_socket_peek(struct Curl_cfilter *cf, + struct Curl_easy *data, + curl_socket_t *psock, + const struct Curl_sockaddr_ex **paddr, + const char **pr_ip_str, int *pr_port, + const char **pl_ip_str, int *pl_port); + +extern struct Curl_cftype Curl_cft_tcp; +extern struct Curl_cftype Curl_cft_udp; +extern struct Curl_cftype Curl_cft_unix; +extern struct Curl_cftype Curl_cft_tcp_accept; + +#endif /* HEADER_CURL_CF_SOCKET_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cfilters.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cfilters.h new file mode 100644 index 0000000000000000000000000000000000000000..2c65264d98376af29b478621bea2a0f2629d0079 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cfilters.h @@ -0,0 +1,539 @@ +#ifndef HEADER_CURL_CFILTERS_H +#define HEADER_CURL_CFILTERS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + + +struct Curl_cfilter; +struct Curl_easy; +struct Curl_dns_entry; +struct connectdata; + +/* Callback to destroy resources held by this filter instance. + * Implementations MUST NOT chain calls to cf->next. + */ +typedef void Curl_cft_destroy_this(struct Curl_cfilter *cf, + struct Curl_easy *data); + +typedef void Curl_cft_close(struct Curl_cfilter *cf, + struct Curl_easy *data); + +typedef CURLcode Curl_cft_connect(struct Curl_cfilter *cf, + struct Curl_easy *data, + bool blocking, bool *done); + +/* Return the hostname and port the connection goes to. + * This may change with the connection state of filters when tunneling + * is involved. + * @param cf the filter to ask + * @param data the easy handle currently active + * @param phost on return, points to the relevant, real hostname. + * this is owned by the connection. + * @param pdisplay_host on return, points to the printable hostname. + * this is owned by the connection. + * @param pport on return, contains the port number + */ +typedef void Curl_cft_get_host(struct Curl_cfilter *cf, + struct Curl_easy *data, + const char **phost, + const char **pdisplay_host, + int *pport); + +/* Filters may return sockets and fdset flags they are waiting for. + * The passes array has room for up to MAX_SOCKSPEREASYHANDLE sockets. + * @return read/write fdset for index in socks + * or GETSOCK_BLANK when nothing to wait on + */ +typedef int Curl_cft_get_select_socks(struct Curl_cfilter *cf, + struct Curl_easy *data, + curl_socket_t *socks); + +typedef bool Curl_cft_data_pending(struct Curl_cfilter *cf, + const struct Curl_easy *data); + +typedef ssize_t Curl_cft_send(struct Curl_cfilter *cf, + struct Curl_easy *data, /* transfer */ + const void *buf, /* data to write */ + size_t len, /* amount to write */ + CURLcode *err); /* error to return */ + +typedef ssize_t Curl_cft_recv(struct Curl_cfilter *cf, + struct Curl_easy *data, /* transfer */ + char *buf, /* store data here */ + size_t len, /* amount to read */ + CURLcode *err); /* error to return */ + +typedef bool Curl_cft_conn_is_alive(struct Curl_cfilter *cf, + struct Curl_easy *data, + bool *input_pending); + +typedef CURLcode Curl_cft_conn_keep_alive(struct Curl_cfilter *cf, + struct Curl_easy *data); + +/** + * Events/controls for connection filters, their arguments and + * return code handling. Filter callbacks are invoked "top down". + * Return code handling: + * "first fail" meaning that the first filter returning != CURLE_OK, will + * abort further event distribution and determine the result. + * "ignored" meaning return values are ignored and the event is distributed + * to all filters in the chain. Overall result is always CURLE_OK. + */ +/* data event arg1 arg2 return */ +#define CF_CTRL_DATA_ATTACH 1 /* 0 NULL ignored */ +#define CF_CTRL_DATA_DETACH 2 /* 0 NULL ignored */ +#define CF_CTRL_DATA_SETUP 4 /* 0 NULL first fail */ +#define CF_CTRL_DATA_IDLE 5 /* 0 NULL first fail */ +#define CF_CTRL_DATA_PAUSE 6 /* on/off NULL first fail */ +#define CF_CTRL_DATA_DONE 7 /* premature NULL ignored */ +#define CF_CTRL_DATA_DONE_SEND 8 /* 0 NULL ignored */ +/* update conn info at connection and data */ +#define CF_CTRL_CONN_INFO_UPDATE (256+0) /* 0 NULL ignored */ + +/** + * Handle event/control for the filter. + * Implementations MUST NOT chain calls to cf->next. + */ +typedef CURLcode Curl_cft_cntrl(struct Curl_cfilter *cf, + struct Curl_easy *data, + int event, int arg1, void *arg2); + + +/** + * Queries to ask via a `Curl_cft_query *query` method on a cfilter chain. + * - MAX_CONCURRENT: the maximum number of parallel transfers the filter + * chain expects to handle at the same time. + * default: 1 if no filter overrides. + * - CONNECT_REPLY_MS: milliseconds until the first indication of a server + * response was received on a connect. For TCP, this + * reflects the time until the socket connected. On UDP + * this gives the time the first bytes from the server + * were received. + * -1 if not determined yet. + * - CF_QUERY_SOCKET: the socket used by the filter chain + */ +/* query res1 res2 */ +#define CF_QUERY_MAX_CONCURRENT 1 /* number - */ +#define CF_QUERY_CONNECT_REPLY_MS 2 /* number - */ +#define CF_QUERY_SOCKET 3 /* - curl_socket_t */ +#define CF_QUERY_TIMER_CONNECT 4 /* - struct curltime */ +#define CF_QUERY_TIMER_APPCONNECT 5 /* - struct curltime */ + +/** + * Query the cfilter for properties. Filters ignorant of a query will + * pass it "down" the filter chain. + */ +typedef CURLcode Curl_cft_query(struct Curl_cfilter *cf, + struct Curl_easy *data, + int query, int *pres1, void *pres2); + +/** + * Type flags for connection filters. A filter can have none, one or + * many of those. Use to evaluate state/capabilities of a filter chain. + * + * CF_TYPE_IP_CONNECT: provides an IP connection or sth equivalent, like + * a CONNECT tunnel, a UNIX domain socket, a QUIC + * connection, etc. + * CF_TYPE_SSL: provide SSL/TLS + * CF_TYPE_MULTIPLEX: provides multiplexing of easy handles + */ +#define CF_TYPE_IP_CONNECT (1 << 0) +#define CF_TYPE_SSL (1 << 1) +#define CF_TYPE_MULTIPLEX (1 << 2) + +/* A connection filter type, e.g. specific implementation. */ +struct Curl_cftype { + const char *name; /* name of the filter type */ + int flags; /* flags of filter type */ + int log_level; /* log level for such filters */ + Curl_cft_destroy_this *destroy; /* destroy resources of this cf */ + Curl_cft_connect *do_connect; /* establish connection */ + Curl_cft_close *do_close; /* close conn */ + Curl_cft_get_host *get_host; /* host filter talks to */ + Curl_cft_get_select_socks *get_select_socks;/* sockets to select on */ + Curl_cft_data_pending *has_data_pending;/* conn has data pending */ + Curl_cft_send *do_send; /* send data */ + Curl_cft_recv *do_recv; /* receive data */ + Curl_cft_cntrl *cntrl; /* events/control */ + Curl_cft_conn_is_alive *is_alive; /* FALSE if conn is dead, Jim! */ + Curl_cft_conn_keep_alive *keep_alive; /* try to keep it alive */ + Curl_cft_query *query; /* query filter chain */ +}; + +/* A connection filter instance, e.g. registered at a connection */ +struct Curl_cfilter { + const struct Curl_cftype *cft; /* the type providing implementation */ + struct Curl_cfilter *next; /* next filter in chain */ + void *ctx; /* filter type specific settings */ + struct connectdata *conn; /* the connection this filter belongs to */ + int sockindex; /* the index the filter is installed at */ + BIT(connected); /* != 0 iff this filter is connected */ +}; + +/* Default implementations for the type functions, implementing nop. */ +void Curl_cf_def_destroy_this(struct Curl_cfilter *cf, + struct Curl_easy *data); + +/* Default implementations for the type functions, implementing pass-through + * the filter chain. */ +void Curl_cf_def_get_host(struct Curl_cfilter *cf, struct Curl_easy *data, + const char **phost, const char **pdisplay_host, + int *pport); +int Curl_cf_def_get_select_socks(struct Curl_cfilter *cf, + struct Curl_easy *data, + curl_socket_t *socks); +bool Curl_cf_def_data_pending(struct Curl_cfilter *cf, + const struct Curl_easy *data); +ssize_t Curl_cf_def_send(struct Curl_cfilter *cf, struct Curl_easy *data, + const void *buf, size_t len, CURLcode *err); +ssize_t Curl_cf_def_recv(struct Curl_cfilter *cf, struct Curl_easy *data, + char *buf, size_t len, CURLcode *err); +CURLcode Curl_cf_def_cntrl(struct Curl_cfilter *cf, + struct Curl_easy *data, + int event, int arg1, void *arg2); +bool Curl_cf_def_conn_is_alive(struct Curl_cfilter *cf, + struct Curl_easy *data, + bool *input_pending); +CURLcode Curl_cf_def_conn_keep_alive(struct Curl_cfilter *cf, + struct Curl_easy *data); +CURLcode Curl_cf_def_query(struct Curl_cfilter *cf, + struct Curl_easy *data, + int query, int *pres1, void *pres2); + +/** + * Create a new filter instance, unattached to the filter chain. + * Use Curl_conn_cf_add() to add it to the chain. + * @param pcf on success holds the created instance + * @param cft the filter type + * @param ctx the type specific context to use + */ +CURLcode Curl_cf_create(struct Curl_cfilter **pcf, + const struct Curl_cftype *cft, + void *ctx); + +/** + * Add a filter instance to the `sockindex` filter chain at connection + * `conn`. The filter must not already be attached. It is inserted at + * the start of the chain (top). + */ +void Curl_conn_cf_add(struct Curl_easy *data, + struct connectdata *conn, + int sockindex, + struct Curl_cfilter *cf); + +/** + * Insert a filter (chain) after `cf_at`. + * `cf_new` must not already be attached. + */ +void Curl_conn_cf_insert_after(struct Curl_cfilter *cf_at, + struct Curl_cfilter *cf_new); + +/** + * Discard, e.g. remove and destroy `discard` iff + * it still is in the filter chain below `cf`. If `discard` + * is no longer found beneath `cf` return FALSE. + * if `destroy_always` is TRUE, will call `discard`s destroy + * function and free it even if not found in the subchain. + */ +bool Curl_conn_cf_discard_sub(struct Curl_cfilter *cf, + struct Curl_cfilter *discard, + struct Curl_easy *data, + bool destroy_always); + +/** + * Discard all cfilters starting with `*pcf` and clearing it afterwards. + */ +void Curl_conn_cf_discard_chain(struct Curl_cfilter **pcf, + struct Curl_easy *data); + +/** + * Remove and destroy all filters at chain `sockindex` on connection `conn`. + */ +void Curl_conn_cf_discard_all(struct Curl_easy *data, + struct connectdata *conn, + int sockindex); + + +CURLcode Curl_conn_cf_connect(struct Curl_cfilter *cf, + struct Curl_easy *data, + bool blocking, bool *done); +void Curl_conn_cf_close(struct Curl_cfilter *cf, struct Curl_easy *data); +int Curl_conn_cf_get_select_socks(struct Curl_cfilter *cf, + struct Curl_easy *data, + curl_socket_t *socks); +ssize_t Curl_conn_cf_send(struct Curl_cfilter *cf, struct Curl_easy *data, + const void *buf, size_t len, CURLcode *err); +ssize_t Curl_conn_cf_recv(struct Curl_cfilter *cf, struct Curl_easy *data, + char *buf, size_t len, CURLcode *err); +CURLcode Curl_conn_cf_cntrl(struct Curl_cfilter *cf, + struct Curl_easy *data, + bool ignore_result, + int event, int arg1, void *arg2); + +/** + * Determine if the connection filter chain is using SSL to the remote host + * (or will be once connected). + */ +bool Curl_conn_cf_is_ssl(struct Curl_cfilter *cf); + +/** + * Get the socket used by the filter chain starting at `cf`. + * Returns CURL_SOCKET_BAD if not available. + */ +curl_socket_t Curl_conn_cf_get_socket(struct Curl_cfilter *cf, + struct Curl_easy *data); + + +#define CURL_CF_SSL_DEFAULT -1 +#define CURL_CF_SSL_DISABLE 0 +#define CURL_CF_SSL_ENABLE 1 + +/** + * Bring the filter chain at `sockindex` for connection `data->conn` into + * connected state. Which will set `*done` to TRUE. + * This can be called on an already connected chain with no side effects. + * When not `blocking`, calls may return without error and `*done != TRUE`, + * while the individual filters negotiated the connection. + */ +CURLcode Curl_conn_connect(struct Curl_easy *data, int sockindex, + bool blocking, bool *done); + +/** + * Check if the filter chain at `sockindex` for connection `conn` is + * completely connected. + */ +bool Curl_conn_is_connected(struct connectdata *conn, int sockindex); + +/** + * Determine if we have reached the remote host on IP level, e.g. + * have a TCP connection. This turns TRUE before a possible SSL + * handshake has been started/done. + */ +bool Curl_conn_is_ip_connected(struct Curl_easy *data, int sockindex); + +/** + * Determine if the connection is using SSL to the remote host + * (or will be once connected). This will return FALSE, if SSL + * is only used in proxying and not for the tunnel itself. + */ +bool Curl_conn_is_ssl(struct connectdata *conn, int sockindex); + +/** + * Connection provides multiplexing of easy handles at `socketindex`. + */ +bool Curl_conn_is_multiplex(struct connectdata *conn, int sockindex); + +/** + * Close the filter chain at `sockindex` for connection `data->conn`. + * Filters remain in place and may be connected again afterwards. + */ +void Curl_conn_close(struct Curl_easy *data, int sockindex); + +/** + * Return if data is pending in some connection filter at chain + * `sockindex` for connection `data->conn`. + */ +bool Curl_conn_data_pending(struct Curl_easy *data, + int sockindex); + +/** + * Return the socket used on data's connection for the index. + * Returns CURL_SOCKET_BAD if not available. + */ +curl_socket_t Curl_conn_get_socket(struct Curl_easy *data, int sockindex); + +/** + * Get any select fd flags and the socket filters at chain `sockindex` + * at connection `conn` might be waiting for. + */ +int Curl_conn_get_select_socks(struct Curl_easy *data, int sockindex, + curl_socket_t *socks); + +/** + * Receive data through the filter chain at `sockindex` for connection + * `data->conn`. Copy at most `len` bytes into `buf`. Return the + * actuel number of bytes copied or a negative value on error. + * The error code is placed into `*code`. + */ +ssize_t Curl_conn_recv(struct Curl_easy *data, int sockindex, char *buf, + size_t len, CURLcode *code); + +/** + * Send `len` bytes of data from `buf` through the filter chain `sockindex` + * at connection `data->conn`. Return the actual number of bytes written + * or a negative value on error. + * The error code is placed into `*code`. + */ +ssize_t Curl_conn_send(struct Curl_easy *data, int sockindex, + const void *buf, size_t len, CURLcode *code); + +/** + * The easy handle `data` is being attached to `conn`. This does + * not mean that data will actually do a transfer. Attachment is + * also used for temporary actions on the connection. + */ +void Curl_conn_ev_data_attach(struct connectdata *conn, + struct Curl_easy *data); + +/** + * The easy handle `data` is being detached (no longer served) + * by connection `conn`. All filters are informed to release any resources + * related to `data`. + * Note: there may be several `data` attached to a connection at the same + * time. + */ +void Curl_conn_ev_data_detach(struct connectdata *conn, + struct Curl_easy *data); + +/** + * Notify connection filters that they need to setup data for + * a transfer. + */ +CURLcode Curl_conn_ev_data_setup(struct Curl_easy *data); + +/** + * Notify connection filters that now would be a good time to + * perform any idle, e.g. time related, actions. + */ +CURLcode Curl_conn_ev_data_idle(struct Curl_easy *data); + +/** + * Notify connection filters that the transfer represented by `data` + * is donw with sending data (e.g. has uploaded everything). + */ +void Curl_conn_ev_data_done_send(struct Curl_easy *data); + +/** + * Notify connection filters that the transfer represented by `data` + * is finished - eventually premature, e.g. before being complete. + */ +void Curl_conn_ev_data_done(struct Curl_easy *data, bool premature); + +/** + * Notify connection filters that the transfer of data is paused/unpaused. + */ +CURLcode Curl_conn_ev_data_pause(struct Curl_easy *data, bool do_pause); + +/** + * Inform connection filters to update their info in `conn`. + */ +void Curl_conn_ev_update_info(struct Curl_easy *data, + struct connectdata *conn); + +/** + * Check if FIRSTSOCKET's cfilter chain deems connection alive. + */ +bool Curl_conn_is_alive(struct Curl_easy *data, struct connectdata *conn, + bool *input_pending); + +/** + * Try to upkeep the connection filters at sockindex. + */ +CURLcode Curl_conn_keep_alive(struct Curl_easy *data, + struct connectdata *conn, + int sockindex); + +void Curl_cf_def_close(struct Curl_cfilter *cf, struct Curl_easy *data); +void Curl_conn_get_host(struct Curl_easy *data, int sockindex, + const char **phost, const char **pdisplay_host, + int *pport); + +/** + * Get the maximum number of parallel transfers the connection + * expects to be able to handle at `sockindex`. + */ +size_t Curl_conn_get_max_concurrent(struct Curl_easy *data, + struct connectdata *conn, + int sockindex); + + +/** + * Types and macros used to keep the current easy handle in filter calls, + * allowing for nested invocations. See #10336. + * + * `cf_call_data` is intended to be a member of the cfilter's `ctx` type. + * A filter defines the macro `CF_CTX_CALL_DATA` to give access to that. + * + * With all values 0, the default, this indicates that there is no cfilter + * call with `data` ongoing. + * Macro `CF_DATA_SAVE` preserves the current `cf_call_data` in a local + * variable and sets the `data` given, incrementing the `depth` counter. + * + * Macro `CF_DATA_RESTORE` restores the old values from the local variable, + * while checking that `depth` values are as expected (debug build), catching + * cases where a "lower" RESTORE was not called. + * + * Finally, macro `CF_DATA_CURRENT` gives the easy handle of the current + * invocation. + */ +struct cf_call_data { + struct Curl_easy *data; +#ifdef DEBUGBUILD + int depth; +#endif +}; + +/** + * define to access the `struct cf_call_data for a cfilter. Normally + * a member in the cfilter's `ctx`. + * + * #define CF_CTX_CALL_DATA(cf) -> struct cf_call_data instance +*/ + +#ifdef DEBUGBUILD + +#define CF_DATA_SAVE(save, cf, data) \ + do { \ + (save) = CF_CTX_CALL_DATA(cf); \ + DEBUGASSERT((save).data == NULL || (save).depth > 0); \ + CF_CTX_CALL_DATA(cf).depth++; \ + CF_CTX_CALL_DATA(cf).data = (struct Curl_easy *)data; \ + } while(0) + +#define CF_DATA_RESTORE(cf, save) \ + do { \ + DEBUGASSERT(CF_CTX_CALL_DATA(cf).depth == (save).depth + 1); \ + DEBUGASSERT((save).data == NULL || (save).depth > 0); \ + CF_CTX_CALL_DATA(cf) = (save); \ + } while(0) + +#else /* DEBUGBUILD */ + +#define CF_DATA_SAVE(save, cf, data) \ + do { \ + (save) = CF_CTX_CALL_DATA(cf); \ + CF_CTX_CALL_DATA(cf).data = (struct Curl_easy *)data; \ + } while(0) + +#define CF_DATA_RESTORE(cf, save) \ + do { \ + CF_CTX_CALL_DATA(cf) = (save); \ + } while(0) + +#endif /* !DEBUGBUILD */ + +#define CF_DATA_CURRENT(cf) \ + ((cf)? (CF_CTX_CALL_DATA(cf).data) : NULL) + +#endif /* HEADER_CURL_CFILTERS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-amigaos.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-amigaos.h new file mode 100644 index 0000000000000000000000000000000000000000..8f4d3e6c31ae649999df292acf8aefc35c540318 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-amigaos.h @@ -0,0 +1,130 @@ +#ifndef HEADER_CURL_CONFIG_AMIGAOS_H +#define HEADER_CURL_CONFIG_AMIGAOS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* ================================================================ */ +/* Hand crafted config file for AmigaOS */ +/* ================================================================ */ + +#ifdef __AMIGA__ /* Any AmigaOS flavour */ + +#define HAVE_ARPA_INET_H 1 +#define HAVE_CLOSESOCKET_CAMEL 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_IOCTLSOCKET_CAMEL 1 +#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1 +#define HAVE_LONGLONG 1 +#define HAVE_NETDB_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_PWD_H 1 +#define HAVE_SELECT 1 +#define HAVE_SIGNAL 1 +#define HAVE_SOCKET 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRDUP 1 +#define HAVE_STRICMP 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRUCT_TIMEVAL 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_SOCKIO_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UTIME 1 +#define HAVE_UTIME_H 1 +#define HAVE_WRITABLE_ARGV 1 +#define HAVE_SYS_IOCTL_H 1 + +#define NEED_MALLOC_H 1 + +#define SIZEOF_INT 4 +#define SIZEOF_SIZE_T 4 + +#ifndef SIZEOF_CURL_OFF_T +#define SIZEOF_CURL_OFF_T 8 +#endif + +#define USE_MANUAL 1 +#define CURL_DISABLE_LDAP 1 + +#ifndef OS +#define OS "AmigaOS" +#endif + +#define PACKAGE "curl" +#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/" +#define PACKAGE_NAME "curl" +#define PACKAGE_STRING "curl -" +#define PACKAGE_TARNAME "curl" +#define PACKAGE_VERSION "-" + +#if defined(USE_AMISSL) +#define CURL_CA_PATH "AmiSSL:Certs" +#elif defined(__MORPHOS__) +#define CURL_CA_BUNDLE "MOSSYS:Data/SSL/curl-ca-bundle.crt" +#else +#define CURL_CA_BUNDLE "s:curl-ca-bundle.crt" +#endif + +#define STDC_HEADERS 1 + +#define in_addr_t int + +#ifndef F_OK +# define F_OK 0 +#endif + +#ifndef O_RDONLY +# define O_RDONLY 0x0000 +#endif + +#ifndef LONG_MAX +# define LONG_MAX 0x7fffffffL +#endif + +#ifndef LONG_MIN +# define LONG_MIN (-0x7fffffffL-1) +#endif + +#define HAVE_RECV 1 +#define RECV_TYPE_ARG1 long +#define RECV_TYPE_ARG2 char * +#define RECV_TYPE_ARG3 long +#define RECV_TYPE_ARG4 long +#define RECV_TYPE_RETV long + +#define HAVE_SEND 1 +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 char * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV int + +#endif /* __AMIGA__ */ +#endif /* HEADER_CURL_CONFIG_AMIGAOS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-dos.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-dos.h new file mode 100644 index 0000000000000000000000000000000000000000..550c410a12968d8d713e1e14c8cd1b23f1007250 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-dos.h @@ -0,0 +1,139 @@ +#ifndef HEADER_CURL_CONFIG_DOS_H +#define HEADER_CURL_CONFIG_DOS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + + +/* ================================================================ */ +/* lib/config-dos.h - Hand crafted config file for DOS */ +/* ================================================================ */ + +#ifndef OS +#if defined(DJGPP) + #define OS "MSDOS/djgpp" +#elif defined(__HIGHC__) + #define OS "MSDOS/HighC" +#else + #define OS "MSDOS/?" +#endif +#endif + +#define PACKAGE "curl" + +#define USE_MANUAL 1 + +#define HAVE_ARPA_INET_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_FREEADDRINFO 1 +#define HAVE_GETADDRINFO 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_IO_H 1 +#define HAVE_IOCTL_FIONBIO 1 +#define HAVE_IOCTLSOCKET 1 +#define HAVE_IOCTLSOCKET_FIONBIO 1 +#define HAVE_LOCALE_H 1 +#define HAVE_LONGLONG 1 +#define HAVE_NETDB_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_NETINET_TCP_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_RECV 1 +#define HAVE_SELECT 1 +#define HAVE_SEND 1 +#define HAVE_SETLOCALE 1 +#define HAVE_SETMODE 1 +#define HAVE_SIGNAL 1 +#define HAVE_SOCKET 1 +#define HAVE_STRDUP 1 +#define HAVE_STRICMP 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRUCT_TIMEVAL 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 + +#define NEED_MALLOC_H 1 + +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_SIZE_T 4 +#define SIZEOF_CURL_OFF_T 8 +#define STDC_HEADERS 1 + +/* Qualifiers for send() and recv() */ + +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 void * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV int + +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void * +#define RECV_TYPE_ARG3 int +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV int + +#define BSD + +/* CURLDEBUG definition enables memory tracking */ +/* #define CURLDEBUG */ + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +#define in_addr_t u_long + +#if defined(__HIGHC__) || \ + (defined(__GNUC__) && (__GNUC__ < 4)) + #define ssize_t int +#endif + +/* Target HAVE_x section */ + +#if defined(DJGPP) + #define HAVE_BASENAME 1 + #define HAVE_STRCASECMP 1 + #define HAVE_SIGACTION 1 + #define HAVE_SIGSETJMP 1 + #define HAVE_SYS_TIME_H 1 + #define HAVE_TERMIOS_H 1 + #define HAVE_VARIADIC_MACROS_GCC 1 + +#elif defined(__HIGHC__) + #define HAVE_SYS_TIME_H 1 + #define strerror(e) strerror_s_((e)) +#endif + +#ifdef MSDOS /* Watt-32 */ + #define HAVE_CLOSE_S 1 +#endif + +#undef word +#undef byte + +#endif /* HEADER_CURL_CONFIG_DOS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-mac.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-mac.h new file mode 100644 index 0000000000000000000000000000000000000000..c29888f8f7eea2a497713289a49fdadb8d83ed0c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-mac.h @@ -0,0 +1,103 @@ +#ifndef HEADER_CURL_CONFIG_MAC_H +#define HEADER_CURL_CONFIG_MAC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* =================================================================== */ +/* Hand crafted config file for Mac OS 9 */ +/* =================================================================== */ +/* On Mac OS X you must run configure to generate curl_config.h file */ +/* =================================================================== */ + +#ifndef OS +#define OS "mac" +#endif + +#include +#if TYPE_LONGLONG +#define HAVE_LONGLONG 1 +#endif + +/* Define if you want the built-in manual */ +#define USE_MANUAL 1 + +#define HAVE_NETINET_IN_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_NETDB_H 1 +#define HAVE_ARPA_INET_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_FCNTL_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_UTIME_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_UTIME_H 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_ALARM 1 +#define HAVE_FTRUNCATE 1 +#define HAVE_UTIME 1 +#define HAVE_SELECT 1 +#define HAVE_SOCKET 1 +#define HAVE_STRUCT_TIMEVAL 1 + +#define HAVE_SIGACTION 1 + +#ifdef MACOS_SSL_SUPPORT +# define USE_OPENSSL 1 +#endif + +#define CURL_DISABLE_LDAP 1 + +#define HAVE_IOCTL_FIONBIO 1 + +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_SIZE_T 4 +#ifdef HAVE_LONGLONG +#define SIZEOF_CURL_OFF_T 8 +#else +#define SIZEOF_CURL_OFF_T 4 +#endif + +#define HAVE_RECV 1 +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void * +#define RECV_TYPE_ARG3 size_t +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV ssize_t + +#define HAVE_SEND 1 +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 void * +#define SEND_TYPE_ARG3 size_t +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV ssize_t + +#define HAVE_EXTRA_STRICMP_H 1 +#define HAVE_EXTRA_STRDUP_H 1 + +#endif /* HEADER_CURL_CONFIG_MAC_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-os400.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-os400.h new file mode 100644 index 0000000000000000000000000000000000000000..e9a62886306be7dc28bba6e8381dbfd01d46f31c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-os400.h @@ -0,0 +1,346 @@ +#ifndef HEADER_CURL_CONFIG_OS400_H +#define HEADER_CURL_CONFIG_OS400_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* ================================================================ */ +/* Hand crafted config file for OS/400 */ +/* ================================================================ */ + +#pragma enum(int) + +#undef PACKAGE + +/* Version number of this archive. */ +#undef VERSION + +/* Define cpu-machine-OS */ +#ifndef OS +#define OS "OS/400" +#endif + +/* OS400 supports a 3-argument ASCII version of gethostbyaddr_r(), but its + * prototype is incompatible with the "standard" one (1st argument is not + * const). However, getaddrinfo() is supported (ASCII version defined as + * a local wrapper in setup-os400.h) in a threadsafe way: we can then + * configure getaddrinfo() as such and get rid of gethostbyname_r() without + * loss of threadsafeness. */ +#undef HAVE_GETHOSTBYNAME_R +#undef HAVE_GETHOSTBYNAME_R_3 +#undef HAVE_GETHOSTBYNAME_R_5 +#undef HAVE_GETHOSTBYNAME_R_6 +#define HAVE_GETADDRINFO +#define HAVE_GETADDRINFO_THREADSAFE + +/* Define if you need the _REENTRANT define for some functions */ +#undef NEED_REENTRANT + +/* Define if you want to enable IPv6 support */ +#define ENABLE_IPV6 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define this to 'int' if ssize_t is not an available typedefed type */ +#undef ssize_t + +/* Define this as a suitable file to read random data from */ +#undef RANDOM_FILE + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define if you have the header file. */ +#define HAVE_ARPA_INET_H + +/* Define if you have the `closesocket' function. */ +#undef HAVE_CLOSESOCKET + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H + +/* Define if you have the `geteuid' function. */ +#define HAVE_GETEUID + +/* Define if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME + +/* Define if you have the `getpass_r' function. */ +#undef HAVE_GETPASS_R + +/* Define to 1 if you have the getpeername function. */ +#define HAVE_GETPEERNAME 1 + +/* Define if you have the `getpwuid' function. */ +#define HAVE_GETPWUID + +/* Define to 1 if you have the getsockname function. */ +#define HAVE_GETSOCKNAME 1 + +/* Define if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY + +/* Define if you have the `timeval' struct. */ +#define HAVE_STRUCT_TIMEVAL + +/* Define if you have the header file. */ +#define HAVE_INTTYPES_H + +/* Define if you have the header file. */ +#undef HAVE_IO_H + +/* Define if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have GSS API. */ +#define HAVE_GSSAPI + +/* Define if you have the GNU gssapi libraries */ +#undef HAVE_GSSGNU + +/* Define if you have the Heimdal gssapi libraries */ +#define HAVE_GSSHEIMDAL + +/* Define if you have the MIT gssapi libraries */ +#undef HAVE_GSSMIT + +/* Define if you need the malloc.h header file even with stdlib.h */ +/* #define NEED_MALLOC_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_NETDB_H + +/* Define if you have the header file. */ +#define HAVE_NETINET_IN_H + +/* Define if you have the header file. */ +#define HAVE_NET_IF_H + +/* Define if you have the header file. */ +#define HAVE_PWD_H + +/* Define if you have the `select' function. */ +#define HAVE_SELECT + +/* Define if you have the `sigaction' function. */ +#define HAVE_SIGACTION + +/* Define if you have the `signal' function. */ +#undef HAVE_SIGNAL + +/* Define if you have the `socket' function. */ +#define HAVE_SOCKET + +/* Define if you have the header file. */ +#undef HAVE_STDINT_H + + +/* The following define is needed on OS400 to enable strcmpi(), stricmp() and + strdup(). */ +#define __cplusplus__strings__ + +/* Define if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the `strcmpi' function. */ +#define HAVE_STRCMPI + +/* Define if you have the `stricmp' function. */ +#define HAVE_STRICMP + +/* Define if you have the `strdup' function. */ +#define HAVE_STRDUP + +/* Define if you have the header file. */ +#define HAVE_STRINGS_H + +/* Define if you have the header file. */ +#undef HAVE_STROPTS_H + +/* Define if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R + +/* Define if you have the `strtoll' function. */ +#undef HAVE_STRTOLL /* Allows ASCII compile on V5R1. */ + +/* Define if you have the header file. */ +#define HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_SOCKET_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define if you have the header file. */ +#define HAVE_SYS_STAT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TIME_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H + +/* Define if you have the header file. */ +#define HAVE_SYS_UN_H + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* Define if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of `curl_off_t', as computed by sizeof. */ +#define SIZEOF_CURL_OFF_T 8 + +/* Define this if you have struct sockaddr_storage */ +#define HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS + +/* Define to enable HTTP3 support (experimental, requires NGTCP2, QUICHE or + MSH3) */ +#undef ENABLE_QUIC + +/* Version number of package */ +#undef VERSION + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#define _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* type to use in place of in_addr_t if not defined */ +#define in_addr_t unsigned long + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO + +/* Define if you have a working ioctl SIOCGIFADDR function. */ +#define HAVE_IOCTL_SIOCGIFADDR + +/* To disable LDAP */ +#undef CURL_DISABLE_LDAP + +/* Definition to make a library symbol externally visible. */ +#define CURL_EXTERN_SYMBOL + +/* Define if you have the ldap_url_parse procedure. */ +/* #define HAVE_LDAP_URL_PARSE */ /* Disabled because of an IBM bug. */ + +/* Define if you have the recv function. */ +#define HAVE_RECV + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* Define to use the OS/400 crypto library. */ +#define USE_OS400CRYPTO + +/* Define to use Unix sockets. */ +#define USE_UNIX_SOCKETS + +/* Use the system keyring as the default CA bundle. */ +#define CURL_CA_BUNDLE "/QIBM/UserData/ICSS/Cert/Server/DEFAULT.KDB" + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* The following must be defined BEFORE system header files inclusion. */ + +#define __ptr128 /* No teraspace. */ +#define qadrt_use_fputc_inline /* Generate fputc() wrapper inline. */ +#define qadrt_use_fread_inline /* Generate fread() wrapper inline. */ +#define qadrt_use_fwrite_inline /* Generate fwrite() wrapper inline. */ + +#endif /* HEADER_CURL_CONFIG_OS400_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-plan9.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-plan9.h new file mode 100644 index 0000000000000000000000000000000000000000..fa4be8e6d2138b0f8454b4765733ae64919955af --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-plan9.h @@ -0,0 +1,149 @@ +#ifndef HEADER_CURL_CONFIG_PLAN9_H +#define HEADER_CURL_CONFIG_PLAN9_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#define BUILDING_LIBCURL 1 +#define CURL_CA_BUNDLE "/sys/lib/tls/ca.pem" +#define CURL_CA_PATH "/sys/lib/tls" +#define CURL_STATICLIB 1 +#define ENABLE_IPV6 1 +#define CURL_DISABLE_LDAP 1 + +#define NEED_REENTRANT 1 +#ifndef OS +#define OS "plan9" +#endif +#define PACKAGE "curl" +#define PACKAGE_NAME "curl" +#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/" +#define PACKAGE_STRING "curl -" +#define PACKAGE_TARNAME "curl" +#define PACKAGE_VERSION "-" +#define RANDOM_FILE "/dev/random" +#define VERSION "0.0.0" /* TODO */ + +#define STDC_HEADERS 1 + +#ifdef _BITS64 +#error not implement +#else +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_OFF_T 8 +#define SIZEOF_CURL_OFF_T 4 /* curl_off_t = timediff_t = int */ +#define SIZEOF_SIZE_T 4 +#define SIZEOF_TIME_T 4 +#endif + +#define HAVE_RECV 1 +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void * +#define RECV_TYPE_ARG3 int +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV int + +#define HAVE_SELECT 1 + +#define HAVE_SEND 1 +#define SEND_TYPE_ARG1 int +#define SEND_TYPE_ARG2 void * +#define SEND_QUAL_ARG2 +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV int + +#define HAVE_ALARM 1 +#define HAVE_ARPA_INET_H 1 +#define HAVE_BASENAME 1 +#define HAVE_BOOL_T 1 +#define HAVE_FCNTL 1 +#define HAVE_FCNTL_H 1 +#define HAVE_FREEADDRINFO 1 +#define HAVE_FTRUNCATE 1 +#define HAVE_GETADDRINFO 1 +#define HAVE_GETEUID 1 +#define HAVE_GETHOSTNAME 1 +#define HAVE_GETPPID 1 +#define HAVE_GETPWUID 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_GMTIME_R 1 +#define HAVE_INET_NTOP 1 +#define HAVE_INET_PTON 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIBGEN_H 1 +#define HAVE_LIBZ 1 +#define HAVE_LOCALE_H 1 +#define HAVE_LONGLONG 1 +#define HAVE_NETDB_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_NETINET_TCP_H 1 +#define HAVE_PWD_H 1 +#define HAVE_SYS_SELECT_H 1 + +#define USE_OPENSSL 1 + +#define HAVE_PIPE 1 +#define HAVE_POLL_FINE 1 +#define HAVE_POLL_H 1 +#define HAVE_PTHREAD_H 1 +#define HAVE_SETLOCALE 1 + +#define HAVE_SIGACTION 1 +#define HAVE_SIGNAL 1 +#define HAVE_SIGSETJMP 1 +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 +#define HAVE_SOCKET 1 +#define HAVE_SSL_GET_SHUTDOWN 1 +#define HAVE_STDBOOL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRDUP 1 +#define HAVE_STRTOK_R 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRUCT_TIMEVAL 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_RESOURCE_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_UN_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UTIME 1 +#define HAVE_UTIME_H 1 + +#define HAVE_POSIX_STRERROR_R 1 +#define HAVE_STRERROR_R 1 +#define USE_MANUAL 1 + +#define __attribute__(x) + +#ifndef __cplusplus +#undef inline +#endif + +#endif /* HEADER_CURL_CONFIG_PLAN9_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-riscos.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-riscos.h new file mode 100644 index 0000000000000000000000000000000000000000..52c279f5bf322b03fecad33efe43be65a161fc44 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-riscos.h @@ -0,0 +1,286 @@ +#ifndef HEADER_CURL_CONFIG_RISCOS_H +#define HEADER_CURL_CONFIG_RISCOS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* ================================================================ */ +/* Hand crafted config file for RISC OS */ +/* ================================================================ */ + +/* Name of this package! */ +#undef PACKAGE + +/* Version number of this archive. */ +#undef VERSION + +/* Define cpu-machine-OS */ +#ifndef OS +#define OS "ARM-RISC OS" +#endif + +/* Define if you want the built-in manual */ +#define USE_MANUAL + +/* Define if you have the gethostbyname_r() function with 3 arguments */ +#undef HAVE_GETHOSTBYNAME_R_3 + +/* Define if you have the gethostbyname_r() function with 5 arguments */ +#undef HAVE_GETHOSTBYNAME_R_5 + +/* Define if you have the gethostbyname_r() function with 6 arguments */ +#undef HAVE_GETHOSTBYNAME_R_6 + +/* Define if you need the _REENTRANT define for some functions */ +#undef NEED_REENTRANT + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define this to 'int' if ssize_t is not an available typedefed type */ +#undef ssize_t + +/* Define this as a suitable file to read random data from */ +#undef RANDOM_FILE + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define if you have the alarm function. */ +#define HAVE_ALARM + +/* Define if you have the header file. */ +#define HAVE_ARPA_INET_H + +/* Define if you have the `closesocket' function. */ +#undef HAVE_CLOSESOCKET + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H + +/* Define if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE + +/* Define if getaddrinfo exists and works */ +#define HAVE_GETADDRINFO + +/* Define if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define if you have the `gethostbyname_r' function. */ +#undef HAVE_GETHOSTBYNAME_R + +/* Define if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME + +/* Define if you have the `getpass_r' function. */ +#undef HAVE_GETPASS_R + +/* Define if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + +/* Define if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY + +/* Define if you have the `timeval' struct. */ +#define HAVE_STRUCT_TIMEVAL + +/* Define if you have the header file. */ +#define HAVE_INTTYPES_H + +/* Define if you have the header file. */ +#undef HAVE_IO_H + +/* Define if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you need the malloc.h header file even with stdlib.h */ +/* #define NEED_MALLOC_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_NETDB_H + +/* Define if you have the header file. */ +#define HAVE_NETINET_IN_H + +/* Define if you have the header file. */ +#define HAVE_NET_IF_H + +/* Define if you have the header file. */ +#undef HAVE_PWD_H + +/* Define if you have the `select' function. */ +#define HAVE_SELECT + +/* Define if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + +/* Define if you have the `signal' function. */ +#define HAVE_SIGNAL + +/* Define if you have the `socket' function. */ +#define HAVE_SOCKET + +/* Define if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the `strcmpi' function. */ +#undef HAVE_STRCMPI + +/* Define if you have the `strdup' function. */ +#define HAVE_STRDUP + +/* Define if you have the `stricmp' function. */ +#define HAVE_STRICMP + +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the `strtok_r' function. */ +#undef HAVE_STRTOK_R + +/* Define if you have the `strtoll' function. */ +#undef HAVE_STRTOLL + +/* Define if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_SOCKET_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TIME_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H + +/* Define if you have the header file. */ +#define HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV ssize_t + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 void * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV ssize_t + +#endif /* HEADER_CURL_CONFIG_RISCOS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-win32.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-win32.h new file mode 100644 index 0000000000000000000000000000000000000000..e55ef2fd20beb5c88e7e80d5ac0dacb39c382b5b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-win32.h @@ -0,0 +1,642 @@ +#ifndef HEADER_CURL_CONFIG_WIN32_H +#define HEADER_CURL_CONFIG_WIN32_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* ================================================================ */ +/* Hand crafted config file for Windows */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* HEADER FILES */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the header file. */ +/* #define HAVE_ARPA_INET_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__) +#define HAVE_INTTYPES_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(__MINGW32__) || \ + (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0582)) || defined(__POCC__) +#define HAVE_STDINT_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_IO_H 1 + +/* Define if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define if you need header even with header file. */ +#if !defined(__SALFORDC__) && !defined(__POCC__) +#define NEED_MALLOC_H 1 +#endif + +/* Define if you have the header file. */ +/* #define HAVE_NETDB_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_NETINET_IN_H 1 */ + +/* Define to 1 if you have the header file. */ +#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__) +#define HAVE_STDBOOL_H 1 +#endif + +/* Define if you have the header file. */ +/* #define HAVE_SYS_PARAM_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SELECT_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SOCKET_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SOCKIO_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_SYS_TIME_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define if you have the header file. */ +#ifndef __BORLANDC__ +#define HAVE_SYS_UTIME_H 1 +#endif + +/* Define if you have the header file. */ +/* #define HAVE_TERMIO_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_TERMIOS_H 1 */ + +/* Define if you have the header file. */ +#if defined(__MINGW32__) || defined(__LCC__) || defined(__POCC__) +#define HAVE_UNISTD_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_WINSOCK2_H 1 +#endif + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_WS2TCPIP_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#if defined(__MINGW32__) +#define HAVE_LIBGEN_H 1 +#endif + +/* ---------------------------------------------------------------- */ +/* OTHER HEADER INFO */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if bool is an available type. */ +#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__) +#define HAVE_BOOL_T 1 +#endif + +/* ---------------------------------------------------------------- */ +/* FUNCTIONS */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the closesocket function. */ +#define HAVE_CLOSESOCKET 1 + +/* Define if you have the ftruncate function. */ +#if defined(__MINGW32__) +#define HAVE_FTRUNCATE 1 +#endif + +/* Define to 1 if you have the `getpeername' function. */ +#define HAVE_GETPEERNAME 1 + +/* Define to 1 if you have the getsockname function. */ +#define HAVE_GETSOCKNAME 1 + +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the gettimeofday function. */ +/* #define HAVE_GETTIMEOFDAY 1 */ + +/* Define if you have the ioctlsocket function. */ +#define HAVE_IOCTLSOCKET 1 + +/* Define if you have a working ioctlsocket FIONBIO function. */ +#define HAVE_IOCTLSOCKET_FIONBIO 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the setlocale function. */ +#define HAVE_SETLOCALE 1 + +/* Define if you have the setmode function. */ +#define HAVE_SETMODE 1 + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the strcasecmp function. */ +#if defined(__MINGW32__) +#define HAVE_STRCASECMP 1 +#endif + +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define if you have the stricmp function. */ +#define HAVE_STRICMP 1 + +/* Define if you have the strtoll function. */ +#if defined(__MINGW32__) || defined(__POCC__) || \ + (defined(_MSC_VER) && (_MSC_VER >= 1800)) +#define HAVE_STRTOLL 1 +#endif + +/* Define if you have the utime function. */ +#ifndef __BORLANDC__ +#define HAVE_UTIME 1 +#endif + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 SOCKET + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* Define to 1 if you have the snprintf function. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1900) +#define HAVE_SNPRINTF 1 +#endif + +#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600 /* Vista */ +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +#define HAVE_INET_NTOP 1 +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +#define HAVE_INET_PTON 1 +#endif + +/* Define to 1 if you have the `basename' function. */ +#if defined(__MINGW32__) +#define HAVE_BASENAME 1 +#endif + +/* Define to 1 if you have the strtok_r function. */ +#if defined(__MINGW32__) +#define HAVE_STRTOK_R 1 +#endif + +/* Define to 1 if you have the signal function. */ +#define HAVE_SIGNAL 1 + +/* ---------------------------------------------------------------- */ +/* TYPEDEF REPLACEMENTS */ +/* ---------------------------------------------------------------- */ + +/* Define if in_addr_t is not an available 'typedefed' type. */ +#define in_addr_t unsigned long + +/* Define if ssize_t is not an available 'typedefed' type. */ +#ifndef _SSIZE_T_DEFINED +# if defined(__POCC__) || defined(__MINGW32__) +# elif defined(_WIN64) +# define _SSIZE_T_DEFINED +# define ssize_t __int64 +# else +# define _SSIZE_T_DEFINED +# define ssize_t int +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* TYPE SIZES */ +/* ---------------------------------------------------------------- */ + +/* Define to the size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* Define to the size of `long long', as computed by sizeof. */ +/* #define SIZEOF_LONG_LONG 8 */ + +/* Define to the size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* Define to the size of `size_t', as computed by sizeof. */ +#if defined(_WIN64) +# define SIZEOF_SIZE_T 8 +#else +# define SIZEOF_SIZE_T 4 +#endif + +/* Define to the size of `curl_off_t', as computed by sizeof. */ +#define SIZEOF_CURL_OFF_T 8 + +/* ---------------------------------------------------------------- */ +/* BSD-style lwIP TCP/IP stack SPECIFIC */ +/* ---------------------------------------------------------------- */ + +/* Define to use BSD-style lwIP TCP/IP stack. */ +/* #define USE_LWIPSOCK 1 */ + +#ifdef USE_LWIPSOCK +# undef USE_WINSOCK +# undef HAVE_WINSOCK2_H +# undef HAVE_WS2TCPIP_H +# undef HAVE_GETHOSTNAME +# undef LWIP_POSIX_SOCKETS_IO_NAMES +# undef RECV_TYPE_ARG1 +# undef RECV_TYPE_ARG3 +# undef SEND_TYPE_ARG1 +# undef SEND_TYPE_ARG3 +# define HAVE_FREEADDRINFO +# define HAVE_GETADDRINFO +# define HAVE_GETHOSTBYNAME_R +# define HAVE_GETHOSTBYNAME_R_6 +# define LWIP_POSIX_SOCKETS_IO_NAMES 0 +# define RECV_TYPE_ARG1 int +# define RECV_TYPE_ARG3 size_t +# define SEND_TYPE_ARG1 int +# define SEND_TYPE_ARG3 size_t +#endif + +/* ---------------------------------------------------------------- */ +/* Watt-32 tcp/ip SPECIFIC */ +/* ---------------------------------------------------------------- */ + +#ifdef USE_WATT32 + #include + #undef byte + #undef word + #undef USE_WINSOCK + #undef HAVE_WINSOCK2_H + #undef HAVE_WS2TCPIP_H + #define HAVE_GETADDRINFO + #define HAVE_SYS_IOCTL_H + #define HAVE_SYS_SOCKET_H + #define HAVE_NETINET_IN_H + #define HAVE_NETDB_H + #define HAVE_ARPA_INET_H + #define HAVE_FREEADDRINFO + #define SOCKET int +#endif + + +/* ---------------------------------------------------------------- */ +/* COMPILER SPECIFIC */ +/* ---------------------------------------------------------------- */ + +/* Define to nothing if compiler does not support 'const' qualifier. */ +/* #define const */ + +/* Define to nothing if compiler does not support 'volatile' qualifier. */ +/* #define volatile */ + +/* Windows should not have HAVE_GMTIME_R defined */ +/* #undef HAVE_GMTIME_R */ + +/* Define if the compiler supports C99 variadic macro style. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define HAVE_VARIADIC_MACROS_C99 1 +#endif + +/* Define if the compiler supports the 'long long' data type. */ +#if defined(__MINGW32__) || \ + (defined(_MSC_VER) && (_MSC_VER >= 1310)) || \ + (defined(__BORLANDC__) && (__BORLANDC__ >= 0x561)) +#define HAVE_LONGLONG 1 +#endif + +/* Define to avoid VS2005 complaining about portable C functions. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define _CRT_SECURE_NO_DEPRECATE 1 +#define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif + +/* mingw-w64 and visual studio >= 2005 (MSVCR80) + all default to 64-bit time_t unless _USE_32BIT_TIME_T is defined */ +#if (defined(_MSC_VER) && (_MSC_VER >= 1400)) || defined(__MINGW32__) +# ifndef _USE_32BIT_TIME_T +# define SIZEOF_TIME_T 8 +# else +# define SIZEOF_TIME_T 4 +# endif +#endif + +/* Define some minimum and default build targets for Visual Studio */ +#if defined(_MSC_VER) + /* Officially, Microsoft's Windows SDK versions 6.X does not support Windows + 2000 as a supported build target. VS2008 default installations provides + an embedded Windows SDK v6.0A along with the claim that Windows 2000 is a + valid build target for VS2008. Popular belief is that binaries built with + VS2008 using Windows SDK versions v6.X and Windows 2000 as a build target + are functional. */ +# define VS2008_MIN_TARGET 0x0500 + + /* The minimum build target for VS2012 is Vista unless Update 1 is installed + and the v110_xp toolset is chosen. */ +# if defined(_USING_V110_SDK71_) +# define VS2012_MIN_TARGET 0x0501 +# else +# define VS2012_MIN_TARGET 0x0600 +# endif + + /* VS2008 default build target is Windows Vista. We override default target + to be Windows XP. */ +# define VS2008_DEF_TARGET 0x0501 + + /* VS2012 default build target is Windows Vista unless Update 1 is installed + and the v110_xp toolset is chosen. */ +# if defined(_USING_V110_SDK71_) +# define VS2012_DEF_TARGET 0x0501 +# else +# define VS2012_DEF_TARGET 0x0600 +# endif +#endif + +/* VS2008 default target settings and minimum build target check. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_MSC_VER <= 1600) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT VS2008_DEF_TARGET +# endif +# ifndef WINVER +# define WINVER VS2008_DEF_TARGET +# endif +# if (_WIN32_WINNT < VS2008_MIN_TARGET) || (WINVER < VS2008_MIN_TARGET) +# error VS2008 does not support Windows build targets prior to Windows 2000 +# endif +#endif + +/* VS2012 default target settings and minimum build target check. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1700) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT VS2012_DEF_TARGET +# endif +# ifndef WINVER +# define WINVER VS2012_DEF_TARGET +# endif +# if (_WIN32_WINNT < VS2012_MIN_TARGET) || (WINVER < VS2012_MIN_TARGET) +# if defined(_USING_V110_SDK71_) +# error VS2012 does not support Windows build targets prior to Windows XP +# else +# error VS2012 does not support Windows build targets prior to Windows \ +Vista +# endif +# endif +#endif + +/* When no build target is specified Pelles C 5.00 and later default build + target is Windows Vista. We override default target to be Windows 2000. */ +#if defined(__POCC__) && (__POCC__ >= 500) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0500 +# endif +# ifndef WINVER +# define WINVER 0x0500 +# endif +#endif + +/* Availability of freeaddrinfo, getaddrinfo, and if_nametoindex + functions is quite convoluted, compiler dependent and even build target + dependent. */ +#if defined(HAVE_WS2TCPIP_H) +# if defined(__POCC__) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# elif defined(_MSC_VER) && (_MSC_VER >= 1200) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# endif +#endif + +#if defined(__POCC__) +# ifndef _MSC_VER +# error Microsoft extensions /Ze compiler option is required +# endif +# ifndef __POCC__OLDNAMES +# error Compatibility names /Go compiler option is required +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* STRUCT RELATED */ +/* ---------------------------------------------------------------- */ + +/* Define if you have struct sockaddr_storage. */ +#if !defined(__SALFORDC__) && !defined(__BORLANDC__) +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +#endif + +/* Define if you have struct timeval. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member. */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* ---------------------------------------------------------------- */ +/* LARGE FILE SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(_MSC_VER) && !defined(_WIN32_WCE) +# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) +# define USE_WIN32_LARGE_FILES +# else +# define USE_WIN32_SMALL_FILES +# endif +#endif + +#if defined(__MINGW32__) && !defined(USE_WIN32_LARGE_FILES) +# define USE_WIN32_LARGE_FILES +#endif + +#if defined(__POCC__) +# undef USE_WIN32_LARGE_FILES +#endif + +#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES) +# define USE_WIN32_SMALL_FILES +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#if defined(USE_WIN32_LARGE_FILES) && defined(__MINGW32__) +# ifndef _FILE_OFFSET_BITS +# define _FILE_OFFSET_BITS 64 +# endif +#endif + +#ifdef USE_WIN32_LARGE_FILES +#define HAVE__FSEEKI64 +#endif + +/* Define to the size of `off_t', as computed by sizeof. */ +#if defined(__MINGW32__) && \ + defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) +# define SIZEOF_OFF_T 8 +#else +# define SIZEOF_OFF_T 4 +#endif + +/* ---------------------------------------------------------------- */ +/* DNS RESOLVER SPECIALTY */ +/* ---------------------------------------------------------------- */ + +/* + * Undefine both USE_ARES and USE_THREADS_WIN32 for synchronous DNS. + */ + +/* Define to enable c-ares asynchronous DNS lookups. */ +/* #define USE_ARES 1 */ + +/* Default define to enable threaded asynchronous DNS lookups. */ +#if !defined(USE_SYNC_DNS) && !defined(USE_ARES) && \ + !defined(USE_THREADS_WIN32) +# define USE_THREADS_WIN32 1 +#endif + +#if defined(USE_ARES) && defined(USE_THREADS_WIN32) +# error "Only one DNS lookup specialty may be defined at most" +#endif + +/* ---------------------------------------------------------------- */ +/* LDAP SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(CURL_HAS_NOVELL_LDAPSDK) +#undef USE_WIN32_LDAP +#define HAVE_LDAP_SSL_H 1 +#define HAVE_LDAP_URL_PARSE 1 +#elif defined(CURL_HAS_OPENLDAP_LDAPSDK) +#undef USE_WIN32_LDAP +#define HAVE_LDAP_URL_PARSE 1 +#else +#undef HAVE_LDAP_URL_PARSE +#define HAVE_LDAP_SSL 1 +#define USE_WIN32_LDAP 1 +#endif + +#if defined(__POCC__) && defined(USE_WIN32_LDAP) +# define CURL_DISABLE_LDAP 1 +#endif + +/* Define to use the Windows crypto library. */ +#if !defined(CURL_WINDOWS_APP) +#define USE_WIN32_CRYPTO +#endif + +/* Define to use Unix sockets. */ +#define USE_UNIX_SOCKETS + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* Define cpu-machine-OS */ +#ifndef OS +#if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */ +#define OS "i386-pc-win32" +#elif defined(_M_X64) || defined(__x86_64__) /* x86_64 (MSVC >=2005 or gcc) */ +#define OS "x86_64-pc-win32" +#elif defined(_M_IA64) || defined(__ia64__) /* Itanium */ +#define OS "ia64-pc-win32" +#elif defined(_M_ARM_NT) || defined(__arm__) /* ARMv7-Thumb2 (Windows RT) */ +#define OS "thumbv7a-pc-win32" +#elif defined(_M_ARM64) || defined(__aarch64__) /* ARM64 (Windows 10) */ +#define OS "aarch64-pc-win32" +#else +#define OS "unknown-pc-win32" +#endif +#endif + +/* Name of package */ +#define PACKAGE "curl" + +/* If you want to build curl with the built-in manual */ +#define USE_MANUAL 1 + +#if defined(__POCC__) || defined(USE_IPV6) +# define ENABLE_IPV6 1 +#endif + +#endif /* HEADER_CURL_CONFIG_WIN32_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-win32ce.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-win32ce.h new file mode 100644 index 0000000000000000000000000000000000000000..cc3833d017912083eb0db0e5ac04d8629692d297 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/config-win32ce.h @@ -0,0 +1,313 @@ +#ifndef HEADER_CURL_CONFIG_WIN32CE_H +#define HEADER_CURL_CONFIG_WIN32CE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* ================================================================ */ +/* lib/config-win32ce.h - Hand crafted config file for windows ce */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* HEADER FILES */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the header file. */ +/* #define HAVE_ARPA_INET_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_IO_H 1 + +/* Define if you need the malloc.h header file even with stdlib.h */ +#define NEED_MALLOC_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_NETDB_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_NETINET_IN_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_PARAM_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SELECT_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SOCKET_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SOCKIO_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define if you have the header file */ +/* #define HAVE_SYS_TIME_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_TYPES_H 1 */ + +/* Define if you have the header file */ +#define HAVE_SYS_UTIME_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_TERMIO_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_TERMIOS_H 1 */ + +/* Define if you have the header file. */ +#if defined(__MINGW32__) || defined(__LCC__) +#define HAVE_UNISTD_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define if you have the header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define if you have the header file. */ +#define HAVE_WS2TCPIP_H 1 + +/* ---------------------------------------------------------------- */ +/* OTHER HEADER INFO */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* ---------------------------------------------------------------- */ +/* FUNCTIONS */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the closesocket function. */ +#define HAVE_CLOSESOCKET 1 + +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the gettimeofday function. */ +/* #define HAVE_GETTIMEOFDAY 1 */ + +/* Define if you have the ioctlsocket function. */ +#define HAVE_IOCTLSOCKET 1 + +/* Define if you have a working ioctlsocket FIONBIO function. */ +#define HAVE_IOCTLSOCKET_FIONBIO 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the strcasecmp function. */ +/* #define HAVE_STRCASECMP 1 */ + +/* Define if you have the strdup function. */ +/* #define HAVE_STRDUP 1 */ + +/* Define if you have the stricmp function. */ +/* #define HAVE_STRICMP 1 */ + +/* Define if you have the strtoll function. */ +#if defined(__MINGW32__) +#define HAVE_STRTOLL 1 +#endif + +/* Define if you have the utime function */ +#define HAVE_UTIME 1 + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 SOCKET + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* ---------------------------------------------------------------- */ +/* TYPEDEF REPLACEMENTS */ +/* ---------------------------------------------------------------- */ + +/* Define this if in_addr_t is not an available 'typedefed' type */ +#define in_addr_t unsigned long + +/* Define ssize_t if it is not an available 'typedefed' type */ +#if defined(__POCC__) +#elif defined(_WIN64) +#define ssize_t __int64 +#else +#define ssize_t int +#endif + +/* ---------------------------------------------------------------- */ +/* TYPE SIZES */ +/* ---------------------------------------------------------------- */ + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long long', as computed by sizeof. */ +/* #define SIZEOF_LONG_LONG 8 */ + +/* Define to the size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `size_t', as computed by sizeof. */ +#if defined(_WIN64) +# define SIZEOF_SIZE_T 8 +#else +# define SIZEOF_SIZE_T 4 +#endif + +/* ---------------------------------------------------------------- */ +/* STRUCT RELATED */ +/* ---------------------------------------------------------------- */ + +/* Define this if you have struct sockaddr_storage */ +/* #define HAVE_STRUCT_SOCKADDR_STORAGE 1 */ + +/* Define this if you have struct timeval */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define this if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* ---------------------------------------------------------------- */ +/* COMPILER SPECIFIC */ +/* ---------------------------------------------------------------- */ + +/* Undef keyword 'const' if it does not work. */ +/* #undef const */ + +/* Define to avoid VS2005 complaining about portable C functions */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define _CRT_SECURE_NO_DEPRECATE 1 +#define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif + +/* VS2005 and later default size for time_t is 64-bit, unless */ +/* _USE_32BIT_TIME_T has been defined to get a 32-bit time_t. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# ifndef _USE_32BIT_TIME_T +# define SIZEOF_TIME_T 8 +# else +# define SIZEOF_TIME_T 4 +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* LARGE FILE SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(_MSC_VER) && !defined(_WIN32_WCE) +# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) +# define USE_WIN32_LARGE_FILES +# else +# define USE_WIN32_SMALL_FILES +# endif +#endif + +#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES) +# define USE_WIN32_SMALL_FILES +#endif + +/* ---------------------------------------------------------------- */ +/* LDAP SUPPORT */ +/* ---------------------------------------------------------------- */ + +#define USE_WIN32_LDAP 1 +#undef HAVE_LDAP_URL_PARSE + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* Define cpu-machine-OS */ +#ifndef OS +#define OS "i386-pc-win32ce" +#endif + +/* Name of package */ +#define PACKAGE "curl" + +/* ---------------------------------------------------------------- */ +/* WinCE */ +/* ---------------------------------------------------------------- */ + +#ifndef UNICODE +# define UNICODE +#endif + +#ifndef _UNICODE +# define _UNICODE +#endif + +#define CURL_DISABLE_FILE 1 +#define CURL_DISABLE_TELNET 1 +#define CURL_DISABLE_LDAP 1 + +#define ENOSPC 1 +#define ENOMEM 2 +#define EAGAIN 3 + +extern int stat(const char *path, struct stat *buffer); + +#endif /* HEADER_CURL_CONFIG_WIN32CE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/conncache.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/conncache.h new file mode 100644 index 0000000000000000000000000000000000000000..c60f8449eeb5eeb9fc9d3fe09b51be1f22ad7335 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/conncache.h @@ -0,0 +1,122 @@ +#ifndef HEADER_CURL_CONNCACHE_H +#define HEADER_CURL_CONNCACHE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * Copyright (C) Linus Nielsen Feltzing, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* + * All accesses to struct fields and changing of data in the connection cache + * and connectbundles must be done with the conncache LOCKED. The cache might + * be shared. + */ + +#include +#include "timeval.h" + +struct connectdata; + +struct conncache { + struct Curl_hash hash; + size_t num_conn; + curl_off_t next_connection_id; + curl_off_t next_easy_id; + struct curltime last_cleanup; + /* handle used for closing cached connections */ + struct Curl_easy *closure_handle; +}; + +#define BUNDLE_NO_MULTIUSE -1 +#define BUNDLE_UNKNOWN 0 /* initial value */ +#define BUNDLE_MULTIPLEX 2 + +#ifdef CURLDEBUG +/* the debug versions of these macros make extra certain that the lock is + never doubly locked or unlocked */ +#define CONNCACHE_LOCK(x) \ + do { \ + if((x)->share) { \ + Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, \ + CURL_LOCK_ACCESS_SINGLE); \ + DEBUGASSERT(!(x)->state.conncache_lock); \ + (x)->state.conncache_lock = TRUE; \ + } \ + } while(0) + +#define CONNCACHE_UNLOCK(x) \ + do { \ + if((x)->share) { \ + DEBUGASSERT((x)->state.conncache_lock); \ + (x)->state.conncache_lock = FALSE; \ + Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT); \ + } \ + } while(0) +#else +#define CONNCACHE_LOCK(x) if((x)->share) \ + Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, CURL_LOCK_ACCESS_SINGLE) +#define CONNCACHE_UNLOCK(x) if((x)->share) \ + Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT) +#endif + +struct connectbundle { + int multiuse; /* supports multi-use */ + size_t num_connections; /* Number of connections in the bundle */ + struct Curl_llist conn_list; /* The connectdata members of the bundle */ +}; + +/* returns 1 on error, 0 is fine */ +int Curl_conncache_init(struct conncache *, int size); +void Curl_conncache_destroy(struct conncache *connc); + +/* return the correct bundle, to a host or a proxy */ +struct connectbundle *Curl_conncache_find_bundle(struct Curl_easy *data, + struct connectdata *conn, + struct conncache *connc); +/* returns number of connections currently held in the connection cache */ +size_t Curl_conncache_size(struct Curl_easy *data); + +bool Curl_conncache_return_conn(struct Curl_easy *data, + struct connectdata *conn); +CURLcode Curl_conncache_add_conn(struct Curl_easy *data) WARN_UNUSED_RESULT; +void Curl_conncache_remove_conn(struct Curl_easy *data, + struct connectdata *conn, + bool lock); +bool Curl_conncache_foreach(struct Curl_easy *data, + struct conncache *connc, + void *param, + int (*func)(struct Curl_easy *data, + struct connectdata *conn, + void *param)); + +struct connectdata * +Curl_conncache_find_first_connection(struct conncache *connc); + +struct connectdata * +Curl_conncache_extract_bundle(struct Curl_easy *data, + struct connectbundle *bundle); +struct connectdata * +Curl_conncache_extract_oldest(struct Curl_easy *data); +void Curl_conncache_close_all_connections(struct conncache *connc); +void Curl_conncache_print(struct conncache *connc); + +#endif /* HEADER_CURL_CONNCACHE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/connect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/connect.h new file mode 100644 index 0000000000000000000000000000000000000000..58264bdba48d069078b3e83a9682e5f748e327a3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/connect.h @@ -0,0 +1,132 @@ +#ifndef HEADER_CURL_CONNECT_H +#define HEADER_CURL_CONNECT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */ +#include "sockaddr.h" +#include "timeval.h" + +struct Curl_dns_entry; + +/* generic function that returns how much time there's left to run, according + to the timeouts set */ +timediff_t Curl_timeleft(struct Curl_easy *data, + struct curltime *nowp, + bool duringconnect); + +#define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */ + +/* + * Used to extract socket and connectdata struct for the most recent + * transfer on the given Curl_easy. + * + * The returned socket will be CURL_SOCKET_BAD in case of failure! + */ +curl_socket_t Curl_getconnectinfo(struct Curl_easy *data, + struct connectdata **connp); + +bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, + char *addr, int *port); + +void Curl_persistconninfo(struct Curl_easy *data, struct connectdata *conn, + char *local_ip, int local_port); + +/* + * Curl_conncontrol() marks the end of a connection/stream. The 'closeit' + * argument specifies if it is the end of a connection or a stream. + * + * For stream-based protocols (such as HTTP/2), a stream close will not cause + * a connection close. Other protocols will close the connection for both + * cases. + * + * It sets the bit.close bit to TRUE (with an explanation for debug builds), + * when the connection will close. + */ + +#define CONNCTRL_KEEP 0 /* undo a marked closure */ +#define CONNCTRL_CONNECTION 1 +#define CONNCTRL_STREAM 2 + +void Curl_conncontrol(struct connectdata *conn, + int closeit +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + , const char *reason +#endif + ); + +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) +#define streamclose(x,y) Curl_conncontrol(x, CONNCTRL_STREAM, y) +#define connclose(x,y) Curl_conncontrol(x, CONNCTRL_CONNECTION, y) +#define connkeep(x,y) Curl_conncontrol(x, CONNCTRL_KEEP, y) +#else /* if !DEBUGBUILD || CURL_DISABLE_VERBOSE_STRINGS */ +#define streamclose(x,y) Curl_conncontrol(x, CONNCTRL_STREAM) +#define connclose(x,y) Curl_conncontrol(x, CONNCTRL_CONNECTION) +#define connkeep(x,y) Curl_conncontrol(x, CONNCTRL_KEEP) +#endif + +/** + * Create a cfilter for making an "ip" connection to the + * given address, using parameters from `conn`. The "ip" connection + * can be a TCP socket, a UDP socket or even a QUIC connection. + * + * It MUST use only the supplied `ai` for its connection attempt. + * + * Such a filter may be used in "happy eyeball" scenarios, and its + * `connect` implementation needs to support non-blocking. Once connected, + * it MAY be installed in the connection filter chain to serve transfers. + */ +typedef CURLcode cf_ip_connect_create(struct Curl_cfilter **pcf, + struct Curl_easy *data, + struct connectdata *conn, + const struct Curl_addrinfo *ai, + int transport); + +CURLcode Curl_cf_setup_insert_after(struct Curl_cfilter *cf_at, + struct Curl_easy *data, + const struct Curl_dns_entry *remotehost, + int transport, + int ssl_mode); + +/** + * Setup the cfilters at `sockindex` in connection `conn`. + * If no filter chain is installed yet, inspects the configuration + * in `data` and `conn? to install a suitable filter chain. + */ +CURLcode Curl_conn_setup(struct Curl_easy *data, + struct connectdata *conn, + int sockindex, + const struct Curl_dns_entry *remotehost, + int ssl_mode); + +extern struct Curl_cftype Curl_cft_happy_eyeballs; +extern struct Curl_cftype Curl_cft_setup; + +#ifdef DEBUGBUILD +void Curl_debug_set_transport_provider(int transport, + cf_ip_connect_create *cf_create); +#endif + +#endif /* HEADER_CURL_CONNECT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/content_encoding.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/content_encoding.h new file mode 100644 index 0000000000000000000000000000000000000000..ef7930cb32cdd5d6854fa679411e028c36fe342a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/content_encoding.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_CONTENT_ENCODING_H +#define HEADER_CURL_CONTENT_ENCODING_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +struct contenc_writer; + +char *Curl_all_content_encodings(void); + +CURLcode Curl_build_unencoding_stack(struct Curl_easy *data, + const char *enclist, int is_transfer); +CURLcode Curl_unencode_write(struct Curl_easy *data, + struct contenc_writer *writer, + const char *buf, size_t nbytes); +void Curl_unencode_cleanup(struct Curl_easy *data); + +#endif /* HEADER_CURL_CONTENT_ENCODING_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cookie.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cookie.h new file mode 100644 index 0000000000000000000000000000000000000000..012dd892c9e74c0be23a50e0f520ffc613a57104 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/cookie.h @@ -0,0 +1,138 @@ +#ifndef HEADER_CURL_COOKIE_H +#define HEADER_CURL_COOKIE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#include + +struct Cookie { + struct Cookie *next; /* next in the chain */ + char *name; /* = value */ + char *value; /* name = */ + char *path; /* path = which is in Set-Cookie: */ + char *spath; /* sanitized cookie path */ + char *domain; /* domain = */ + curl_off_t expires; /* expires = */ + bool tailmatch; /* whether we do tail-matching of the domain name */ + bool secure; /* whether the 'secure' keyword was used */ + bool livecookie; /* updated from a server, not a stored file */ + bool httponly; /* true if the httponly directive is present */ + int creationtime; /* time when the cookie was written */ + unsigned char prefix; /* bitmap fields indicating which prefix are set */ +}; + +/* + * Available cookie prefixes, as defined in + * draft-ietf-httpbis-rfc6265bis-02 + */ +#define COOKIE_PREFIX__SECURE (1<<0) +#define COOKIE_PREFIX__HOST (1<<1) + +#define COOKIE_HASH_SIZE 63 + +struct CookieInfo { + /* linked list of cookies we know of */ + struct Cookie *cookies[COOKIE_HASH_SIZE]; + curl_off_t next_expiration; /* the next time at which expiration happens */ + int numcookies; /* number of cookies in the "jar" */ + int lastct; /* last creation-time used in the jar */ + bool running; /* state info, for cookie adding information */ + bool newsession; /* new session, discard session cookies on load */ +}; + +/* The maximum sizes we accept for cookies. RFC 6265 section 6.1 says + "general-use user agents SHOULD provide each of the following minimum + capabilities": + + - At least 4096 bytes per cookie (as measured by the sum of the length of + the cookie's name, value, and attributes). + In the 6265bis draft document section 5.4 it is phrased even stronger: "If + the sum of the lengths of the name string and the value string is more than + 4096 octets, abort these steps and ignore the set-cookie-string entirely." +*/ + +/** Limits for INCOMING cookies **/ + +/* The longest we allow a line to be when reading a cookie from a HTTP header + or from a cookie jar */ +#define MAX_COOKIE_LINE 5000 + +/* Maximum length of an incoming cookie name or content we deal with. Longer + cookies are ignored. */ +#define MAX_NAME 4096 + +/* Maximum number of Set-Cookie: lines accepted in a single response. If more + such header lines are received, they are ignored. This value must be less + than 256 since an unsigned char is used to count. */ +#define MAX_SET_COOKIE_AMOUNT 50 + +/** Limits for OUTGOING cookies **/ + +/* Maximum size for an outgoing cookie line libcurl will use in an http + request. This is the default maximum length used in some versions of Apache + httpd. */ +#define MAX_COOKIE_HEADER_LEN 8190 + +/* Maximum number of cookies libcurl will send in a single request, even if + there might be more cookies that match. One reason to cap the number is to + keep the maximum HTTP request within the maximum allowed size. */ +#define MAX_COOKIE_SEND_AMOUNT 150 + +struct Curl_easy; +/* + * Add a cookie to the internal list of cookies. The domain and path arguments + * are only used if the header boolean is TRUE. + */ + +struct Cookie *Curl_cookie_add(struct Curl_easy *data, + struct CookieInfo *c, bool header, + bool noexpiry, const char *lineptr, + const char *domain, const char *path, + bool secure); + +struct Cookie *Curl_cookie_getlist(struct Curl_easy *data, + struct CookieInfo *c, const char *host, + const char *path, bool secure); +void Curl_cookie_freelist(struct Cookie *cookies); +void Curl_cookie_clearall(struct CookieInfo *cookies); +void Curl_cookie_clearsess(struct CookieInfo *cookies); + +#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES) +#define Curl_cookie_list(x) NULL +#define Curl_cookie_loadfiles(x) Curl_nop_stmt +#define Curl_cookie_init(x,y,z,w) NULL +#define Curl_cookie_cleanup(x) Curl_nop_stmt +#define Curl_flush_cookies(x,y) Curl_nop_stmt +#else +void Curl_flush_cookies(struct Curl_easy *data, bool cleanup); +void Curl_cookie_cleanup(struct CookieInfo *c); +struct CookieInfo *Curl_cookie_init(struct Curl_easy *data, + const char *file, struct CookieInfo *inc, + bool newsession); +struct curl_slist *Curl_cookie_list(struct Curl_easy *data); +void Curl_cookie_loadfiles(struct Curl_easy *data); +#endif + +#endif /* HEADER_CURL_COOKIE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_addrinfo.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_addrinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..c757c49c5cbb5d4c6499f2a52b7c0979fcfa4d9f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_addrinfo.h @@ -0,0 +1,108 @@ +#ifndef HEADER_CURL_ADDRINFO_H +#define HEADER_CURL_ADDRINFO_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef __VMS +# include +# include +# include +#endif + +/* + * Curl_addrinfo is our internal struct definition that we use to allow + * consistent internal handling of this data. We use this even when the + * system provides an addrinfo structure definition. And we use this for + * all sorts of IPv4 and IPV6 builds. + */ + +struct Curl_addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + curl_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ + char *ai_canonname; + struct sockaddr *ai_addr; + struct Curl_addrinfo *ai_next; +}; + +void +Curl_freeaddrinfo(struct Curl_addrinfo *cahead); + +#ifdef HAVE_GETADDRINFO +int +Curl_getaddrinfo_ex(const char *nodename, + const char *servname, + const struct addrinfo *hints, + struct Curl_addrinfo **result); +#endif + +struct Curl_addrinfo * +Curl_he2ai(const struct hostent *he, int port); + +struct Curl_addrinfo * +Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port); + +struct Curl_addrinfo *Curl_str2addr(char *dotted, int port); + +#ifdef USE_UNIX_SOCKETS +struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath, + bool abstract); +#endif + +#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) && \ + defined(HAVE_FREEADDRINFO) +void +curl_dbg_freeaddrinfo(struct addrinfo *freethis, int line, const char *source); +#endif + +#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) +int +curl_dbg_getaddrinfo(const char *hostname, const char *service, + const struct addrinfo *hints, struct addrinfo **result, + int line, const char *source); +#endif + +#ifdef HAVE_GETADDRINFO +#ifdef USE_RESOLVE_ON_IPS +void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port); +#else +#define Curl_addrinfo_set_port(x,y) +#endif +#endif + +#endif /* HEADER_CURL_ADDRINFO_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_base64.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_base64.h new file mode 100644 index 0000000000000000000000000000000000000000..7f7cd1d98a8474a4764c699becf4d6f651b14909 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_base64.h @@ -0,0 +1,41 @@ +#ifndef HEADER_CURL_BASE64_H +#define HEADER_CURL_BASE64_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#ifndef BUILDING_LIBCURL +/* this renames functions so that the tool code can use the same code + without getting symbol collisions */ +#define Curl_base64_encode(a,b,c,d) curlx_base64_encode(a,b,c,d) +#define Curl_base64url_encode(a,b,c,d) curlx_base64url_encode(a,b,c,d) +#define Curl_base64_decode(a,b,c) curlx_base64_decode(a,b,c) +#endif + +CURLcode Curl_base64_encode(const char *inputbuff, size_t insize, + char **outptr, size_t *outlen); +CURLcode Curl_base64url_encode(const char *inputbuff, size_t insize, + char **outptr, size_t *outlen); +CURLcode Curl_base64_decode(const char *src, + unsigned char **outptr, size_t *outlen); +#endif /* HEADER_CURL_BASE64_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ctype.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ctype.h new file mode 100644 index 0000000000000000000000000000000000000000..7f0d0cc2916d08e63a9373708fdacc1c4ed7f490 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ctype.h @@ -0,0 +1,51 @@ +#ifndef HEADER_CURL_CTYPE_H +#define HEADER_CURL_CTYPE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#define ISLOWHEXALHA(x) (((x) >= 'a') && ((x) <= 'f')) +#define ISUPHEXALHA(x) (((x) >= 'A') && ((x) <= 'F')) + +#define ISLOWCNTRL(x) ((unsigned char)(x) <= 0x1f) +#define IS7F(x) ((x) == 0x7f) + +#define ISLOWPRINT(x) (((x) >= 9) && ((x) <= 0x0d)) + +#define ISPRINT(x) (ISLOWPRINT(x) || (((x) >= ' ') && ((x) <= 0x7e))) +#define ISGRAPH(x) (ISLOWPRINT(x) || (((x) > ' ') && ((x) <= 0x7e))) +#define ISCNTRL(x) (ISLOWCNTRL(x) || IS7F(x)) +#define ISALPHA(x) (ISLOWER(x) || ISUPPER(x)) +#define ISXDIGIT(x) (ISDIGIT(x) || ISLOWHEXALHA(x) || ISUPHEXALHA(x)) +#define ISALNUM(x) (ISDIGIT(x) || ISLOWER(x) || ISUPPER(x)) +#define ISUPPER(x) (((x) >= 'A') && ((x) <= 'Z')) +#define ISLOWER(x) (((x) >= 'a') && ((x) <= 'z')) +#define ISDIGIT(x) (((x) >= '0') && ((x) <= '9')) +#define ISBLANK(x) (((x) == ' ') || ((x) == '\t')) +#define ISSPACE(x) (ISBLANK(x) || (((x) >= 0xa) && ((x) <= 0x0d))) +#define ISURLPUNTCS(x) (((x) == '-') || ((x) == '.') || ((x) == '_') || \ + ((x) == '~')) +#define ISUNRESERVED(x) (ISALNUM(x) || ISURLPUNTCS(x)) + + +#endif /* HEADER_CURL_CTYPE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_des.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_des.h new file mode 100644 index 0000000000000000000000000000000000000000..66525ab43637e9b039ff3d1c29639f9a6f267f19 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_des.h @@ -0,0 +1,40 @@ +#ifndef HEADER_CURL_DES_H +#define HEADER_CURL_DES_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Steve Holme, . + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \ + (defined(USE_GNUTLS) || \ + defined(USE_SECTRANSP) || \ + defined(USE_OS400CRYPTO) || \ + defined(USE_WIN32_CRYPTO)) + +/* Applies odd parity to the given byte array */ +void Curl_des_set_odd_parity(unsigned char *bytes, size_t length); + +#endif + +#endif /* HEADER_CURL_DES_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_endian.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_endian.h new file mode 100644 index 0000000000000000000000000000000000000000..fa283214b11345c02cd665ce955893febfbc4da1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_endian.h @@ -0,0 +1,36 @@ +#ifndef HEADER_CURL_ENDIAN_H +#define HEADER_CURL_ENDIAN_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* Converts a 16-bit integer from little endian */ +unsigned short Curl_read16_le(const unsigned char *buf); + +/* Converts a 32-bit integer from little endian */ +unsigned int Curl_read32_le(const unsigned char *buf); + +/* Converts a 16-bit integer from big endian */ +unsigned short Curl_read16_be(const unsigned char *buf); + +#endif /* HEADER_CURL_ENDIAN_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_fnmatch.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_fnmatch.h new file mode 100644 index 0000000000000000000000000000000000000000..595646ff0d267c80acf0b1538aba6d8d4426e1b0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_fnmatch.h @@ -0,0 +1,46 @@ +#ifndef HEADER_CURL_FNMATCH_H +#define HEADER_CURL_FNMATCH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#define CURL_FNMATCH_MATCH 0 +#define CURL_FNMATCH_NOMATCH 1 +#define CURL_FNMATCH_FAIL 2 + +/* default pattern matching function + * ================================= + * Implemented with recursive backtracking, if you want to use Curl_fnmatch, + * please note that there is not implemented UTF/UNICODE support. + * + * Implemented features: + * '?' notation, does not match UTF characters + * '*' can also work with UTF string + * [a-zA-Z0-9] enumeration support + * + * keywords: alnum, digit, xdigit, alpha, print, blank, lower, graph, space + * and upper (use as "[[:alnum:]]") + */ +int Curl_fnmatch(void *ptr, const char *pattern, const char *string); + +#endif /* HEADER_CURL_FNMATCH_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_get_line.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_get_line.h new file mode 100644 index 0000000000000000000000000000000000000000..0ff32c5c2cb498fccc583df6d23f92dbe5335998 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_get_line.h @@ -0,0 +1,31 @@ +#ifndef HEADER_CURL_GET_LINE_H +#define HEADER_CURL_GET_LINE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* get_line() makes sure to only return complete whole lines that fit in 'len' + * bytes and end with a newline. */ +char *Curl_get_line(char *buf, int len, FILE *input); + +#endif /* HEADER_CURL_GET_LINE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_gethostname.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_gethostname.h new file mode 100644 index 0000000000000000000000000000000000000000..9281d9c242205510aa423324a0ebc0e1489d06c7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_gethostname.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_GETHOSTNAME_H +#define HEADER_CURL_GETHOSTNAME_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* Hostname buffer size */ +#define HOSTNAME_MAX 1024 + +/* This returns the local machine's un-qualified hostname */ +int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen); + +#endif /* HEADER_CURL_GETHOSTNAME_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_gssapi.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_gssapi.h new file mode 100644 index 0000000000000000000000000000000000000000..7b9a534ea202767dba83a255fed055d3efec9ec0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_gssapi.h @@ -0,0 +1,63 @@ +#ifndef HEADER_CURL_GSSAPI_H +#define HEADER_CURL_GSSAPI_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include "urldata.h" + +#ifdef HAVE_GSSAPI +extern gss_OID_desc Curl_spnego_mech_oid; +extern gss_OID_desc Curl_krb5_mech_oid; + +/* Common method for using GSS-API */ +OM_uint32 Curl_gss_init_sec_context( + struct Curl_easy *data, + OM_uint32 *minor_status, + gss_ctx_id_t *context, + gss_name_t target_name, + gss_OID mech_type, + gss_channel_bindings_t input_chan_bindings, + gss_buffer_t input_token, + gss_buffer_t output_token, + const bool mutual_auth, + OM_uint32 *ret_flags); + +/* Helper to log a GSS-API error status */ +void Curl_gss_log_error(struct Curl_easy *data, const char *prefix, + OM_uint32 major, OM_uint32 minor); + +/* Provide some definitions missing in old headers */ +#ifdef HAVE_OLD_GSSMIT +#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name +#define NCOMPAT 1 +#endif + +/* Define our privacy and integrity protection values */ +#define GSSAUTH_P_NONE 1 +#define GSSAUTH_P_INTEGRITY 2 +#define GSSAUTH_P_PRIVACY 4 + +#endif /* HAVE_GSSAPI */ +#endif /* HEADER_CURL_GSSAPI_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_hmac.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_hmac.h new file mode 100644 index 0000000000000000000000000000000000000000..2ea03dd2685e261082700b8996e20de4d2e8dc85 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_hmac.h @@ -0,0 +1,77 @@ +#ifndef HEADER_CURL_HMAC_H +#define HEADER_CURL_HMAC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) \ + || !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) + +#include + +#define HMAC_MD5_LENGTH 16 + +typedef CURLcode (* HMAC_hinit_func)(void *context); +typedef void (* HMAC_hupdate_func)(void *context, + const unsigned char *data, + unsigned int len); +typedef void (* HMAC_hfinal_func)(unsigned char *result, void *context); + + +/* Per-hash function HMAC parameters. */ +struct HMAC_params { + HMAC_hinit_func + hmac_hinit; /* Initialize context procedure. */ + HMAC_hupdate_func hmac_hupdate; /* Update context with data. */ + HMAC_hfinal_func hmac_hfinal; /* Get final result procedure. */ + unsigned int hmac_ctxtsize; /* Context structure size. */ + unsigned int hmac_maxkeylen; /* Maximum key length (bytes). */ + unsigned int hmac_resultlen; /* Result length (bytes). */ +}; + + +/* HMAC computation context. */ +struct HMAC_context { + const struct HMAC_params *hmac_hash; /* Hash function definition. */ + void *hmac_hashctxt1; /* Hash function context 1. */ + void *hmac_hashctxt2; /* Hash function context 2. */ +}; + + +/* Prototypes. */ +struct HMAC_context *Curl_HMAC_init(const struct HMAC_params *hashparams, + const unsigned char *key, + unsigned int keylen); +int Curl_HMAC_update(struct HMAC_context *context, + const unsigned char *data, + unsigned int len); +int Curl_HMAC_final(struct HMAC_context *context, unsigned char *result); + +CURLcode Curl_hmacit(const struct HMAC_params *hashparams, + const unsigned char *key, const size_t keylen, + const unsigned char *data, const size_t datalen, + unsigned char *output); + +#endif + +#endif /* HEADER_CURL_HMAC_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_krb5.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_krb5.h new file mode 100644 index 0000000000000000000000000000000000000000..ccf6b96a875edd87cee71dfba0bb0a70313a109c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_krb5.h @@ -0,0 +1,52 @@ +#ifndef HEADER_CURL_KRB5_H +#define HEADER_CURL_KRB5_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +struct Curl_sec_client_mech { + const char *name; + size_t size; + int (*init)(void *); + int (*auth)(void *, struct Curl_easy *data, struct connectdata *); + void (*end)(void *); + int (*check_prot)(void *, int); + int (*encode)(void *, const void *, int, int, void **); + int (*decode)(void *, void *, int, int, struct connectdata *); +}; + +#define AUTH_OK 0 +#define AUTH_CONTINUE 1 +#define AUTH_ERROR 2 + +#ifdef HAVE_GSSAPI +int Curl_sec_read_msg(struct Curl_easy *data, struct connectdata *conn, char *, + enum protection_level); +void Curl_sec_end(struct connectdata *); +CURLcode Curl_sec_login(struct Curl_easy *, struct connectdata *); +int Curl_sec_request_prot(struct connectdata *conn, const char *level); +#else +#define Curl_sec_end(x) +#endif + +#endif /* HEADER_CURL_KRB5_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ldap.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ldap.h new file mode 100644 index 0000000000000000000000000000000000000000..8a1d807ed92b0c8fcfd6db62e9c5380a4c7ba13b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ldap.h @@ -0,0 +1,36 @@ +#ifndef HEADER_CURL_LDAP_H +#define HEADER_CURL_LDAP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#ifndef CURL_DISABLE_LDAP +extern const struct Curl_handler Curl_handler_ldap; + +#if !defined(CURL_DISABLE_LDAPS) && \ + ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \ + (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL))) +extern const struct Curl_handler Curl_handler_ldaps; +#endif + +#endif +#endif /* HEADER_CURL_LDAP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_md4.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_md4.h new file mode 100644 index 0000000000000000000000000000000000000000..4706e49578bb431593027ad76ab8836b2cdc3a20 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_md4.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_MD4_H +#define HEADER_CURL_MD4_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include + +#if defined(USE_CURL_NTLM_CORE) + +#define MD4_DIGEST_LENGTH 16 + +CURLcode Curl_md4it(unsigned char *output, const unsigned char *input, + const size_t len); + +#endif /* defined(USE_CURL_NTLM_CORE) */ + +#endif /* HEADER_CURL_MD4_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_md5.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_md5.h new file mode 100644 index 0000000000000000000000000000000000000000..61671c306a643f0aa5eaa4aa3537a0761d462b7f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_md5.h @@ -0,0 +1,67 @@ +#ifndef HEADER_CURL_MD5_H +#define HEADER_CURL_MD5_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) \ + || !defined(CURL_DISABLE_DIGEST_AUTH) + +#include "curl_hmac.h" + +#define MD5_DIGEST_LEN 16 + +typedef CURLcode (* Curl_MD5_init_func)(void *context); +typedef void (* Curl_MD5_update_func)(void *context, + const unsigned char *data, + unsigned int len); +typedef void (* Curl_MD5_final_func)(unsigned char *result, void *context); + +struct MD5_params { + Curl_MD5_init_func md5_init_func; /* Initialize context procedure */ + Curl_MD5_update_func md5_update_func; /* Update context with data */ + Curl_MD5_final_func md5_final_func; /* Get final result procedure */ + unsigned int md5_ctxtsize; /* Context structure size */ + unsigned int md5_resultlen; /* Result length (bytes) */ +}; + +struct MD5_context { + const struct MD5_params *md5_hash; /* Hash function definition */ + void *md5_hashctx; /* Hash function context */ +}; + +extern const struct MD5_params Curl_DIGEST_MD5[1]; +extern const struct HMAC_params Curl_HMAC_MD5[1]; + +CURLcode Curl_md5it(unsigned char *output, const unsigned char *input, + const size_t len); + +struct MD5_context *Curl_MD5_init(const struct MD5_params *md5params); +CURLcode Curl_MD5_update(struct MD5_context *context, + const unsigned char *data, + unsigned int len); +CURLcode Curl_MD5_final(struct MD5_context *context, unsigned char *result); + +#endif + +#endif /* HEADER_CURL_MD5_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_memory.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_memory.h new file mode 100644 index 0000000000000000000000000000000000000000..b8c46d79395f50fc1251b3e35b714493c6388650 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_memory.h @@ -0,0 +1,178 @@ +#ifndef HEADER_CURL_MEMORY_H +#define HEADER_CURL_MEMORY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* + * Nasty internal details ahead... + * + * File curl_memory.h must be included by _all_ *.c source files + * that use memory related functions strdup, malloc, calloc, realloc + * or free, and given source file is used to build libcurl library. + * It should be included immediately before memdebug.h as the last files + * included to avoid undesired interaction with other memory function + * headers in dependent libraries. + * + * There is nearly no exception to above rule. All libcurl source + * files in 'lib' subdirectory as well as those living deep inside + * 'packages' subdirectories and linked together in order to build + * libcurl library shall follow it. + * + * File lib/strdup.c is an exception, given that it provides a strdup + * clone implementation while using malloc. Extra care needed inside + * this one. + * + * The need for curl_memory.h inclusion is due to libcurl's feature + * of allowing library user to provide memory replacement functions, + * memory callbacks, at runtime with curl_global_init_mem() + * + * Any *.c source file used to build libcurl library that does not + * include curl_memory.h and uses any memory function of the five + * mentioned above will compile without any indication, but it will + * trigger weird memory related issues at runtime. + * + */ + +#ifdef HEADER_CURL_MEMDEBUG_H +/* cleanup after memdebug.h */ + +#ifdef MEMDEBUG_NODEFINES +#ifdef CURLDEBUG + +#undef strdup +#undef malloc +#undef calloc +#undef realloc +#undef free +#undef send +#undef recv + +#ifdef WIN32 +# ifdef UNICODE +# undef wcsdup +# undef _wcsdup +# undef _tcsdup +# else +# undef _tcsdup +# endif +#endif + +#undef socket +#undef accept +#ifdef HAVE_SOCKETPAIR +#undef socketpair +#endif + +#ifdef HAVE_GETADDRINFO +#if defined(getaddrinfo) && defined(__osf__) +#undef ogetaddrinfo +#else +#undef getaddrinfo +#endif +#endif /* HAVE_GETADDRINFO */ + +#ifdef HAVE_FREEADDRINFO +#undef freeaddrinfo +#endif /* HAVE_FREEADDRINFO */ + +/* sclose is probably already defined, redefine it! */ +#undef sclose +#undef fopen +#undef fdopen +#undef fclose + +#endif /* MEMDEBUG_NODEFINES */ +#endif /* CURLDEBUG */ + +#undef HEADER_CURL_MEMDEBUG_H +#endif /* HEADER_CURL_MEMDEBUG_H */ + +/* +** Following section applies even when CURLDEBUG is not defined. +*/ + +#undef fake_sclose + +#ifndef CURL_DID_MEMORY_FUNC_TYPEDEFS /* only if not already done */ +/* + * The following memory function replacement typedef's are COPIED from + * curl/curl.h and MUST match the originals. We copy them to avoid having to + * include curl/curl.h here. We avoid that include since it includes stdio.h + * and other headers that may get messed up with defines done here. + */ +typedef void *(*curl_malloc_callback)(size_t size); +typedef void (*curl_free_callback)(void *ptr); +typedef void *(*curl_realloc_callback)(void *ptr, size_t size); +typedef char *(*curl_strdup_callback)(const char *str); +typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size); +#define CURL_DID_MEMORY_FUNC_TYPEDEFS +#endif + +extern curl_malloc_callback Curl_cmalloc; +extern curl_free_callback Curl_cfree; +extern curl_realloc_callback Curl_crealloc; +extern curl_strdup_callback Curl_cstrdup; +extern curl_calloc_callback Curl_ccalloc; +#if defined(WIN32) && defined(UNICODE) +extern curl_wcsdup_callback Curl_cwcsdup; +#endif + +#ifndef CURLDEBUG + +/* + * libcurl's 'memory tracking' system defines strdup, malloc, calloc, + * realloc and free, along with others, in memdebug.h in a different + * way although still using memory callbacks forward declared above. + * When using the 'memory tracking' system (CURLDEBUG defined) we do + * not define here the five memory functions given that definitions + * from memdebug.h are the ones that shall be used. + */ + +#undef strdup +#define strdup(ptr) Curl_cstrdup(ptr) +#undef malloc +#define malloc(size) Curl_cmalloc(size) +#undef calloc +#define calloc(nbelem,size) Curl_ccalloc(nbelem, size) +#undef realloc +#define realloc(ptr,size) Curl_crealloc(ptr, size) +#undef free +#define free(ptr) Curl_cfree(ptr) + +#ifdef WIN32 +# ifdef UNICODE +# undef wcsdup +# define wcsdup(ptr) Curl_cwcsdup(ptr) +# undef _wcsdup +# define _wcsdup(ptr) Curl_cwcsdup(ptr) +# undef _tcsdup +# define _tcsdup(ptr) Curl_cwcsdup(ptr) +# else +# undef _tcsdup +# define _tcsdup(ptr) Curl_cstrdup(ptr) +# endif +#endif + +#endif /* CURLDEBUG */ +#endif /* HEADER_CURL_MEMORY_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_memrchr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_memrchr.h new file mode 100644 index 0000000000000000000000000000000000000000..45bb38c68e54f6aa0939429ab993afa01b80b6b7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_memrchr.h @@ -0,0 +1,44 @@ +#ifndef HEADER_CURL_MEMRCHR_H +#define HEADER_CURL_MEMRCHR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef HAVE_MEMRCHR + +#include +#ifdef HAVE_STRINGS_H +# include +#endif + +#else /* HAVE_MEMRCHR */ + +void *Curl_memrchr(const void *s, int c, size_t n); + +#define memrchr(x,y,z) Curl_memrchr((x),(y),(z)) + +#endif /* HAVE_MEMRCHR */ + +#endif /* HEADER_CURL_MEMRCHR_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_multibyte.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_multibyte.h new file mode 100644 index 0000000000000000000000000000000000000000..ddac1f638218543fcee1c5258898fe281a9e30ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_multibyte.h @@ -0,0 +1,91 @@ +#ifndef HEADER_CURL_MULTIBYTE_H +#define HEADER_CURL_MULTIBYTE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#if defined(WIN32) + + /* + * MultiByte conversions using Windows kernel32 library. + */ + +wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8); +char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w); +#endif /* WIN32 */ + +/* + * Macros curlx_convert_UTF8_to_tchar(), curlx_convert_tchar_to_UTF8() + * and curlx_unicodefree() main purpose is to minimize the number of + * preprocessor conditional directives needed by code using these + * to differentiate UNICODE from non-UNICODE builds. + * + * In the case of a non-UNICODE build the tchar strings are char strings that + * are duplicated via strdup and remain in whatever the passed in encoding is, + * which is assumed to be UTF-8 but may be other encoding. Therefore the + * significance of the conversion functions is primarily for UNICODE builds. + * + * Allocated memory should be free'd with curlx_unicodefree(). + * + * Note: Because these are curlx functions their memory usage is not tracked + * by the curl memory tracker memdebug. You'll notice that curlx function-like + * macros call free and strdup in parentheses, eg (strdup)(ptr), and that's to + * ensure that the curl memdebug override macros do not replace them. + */ + +#if defined(UNICODE) && defined(WIN32) + +#define curlx_convert_UTF8_to_tchar(ptr) curlx_convert_UTF8_to_wchar((ptr)) +#define curlx_convert_tchar_to_UTF8(ptr) curlx_convert_wchar_to_UTF8((ptr)) + +typedef union { + unsigned short *tchar_ptr; + const unsigned short *const_tchar_ptr; + unsigned short *tbyte_ptr; + const unsigned short *const_tbyte_ptr; +} xcharp_u; + +#else + +#define curlx_convert_UTF8_to_tchar(ptr) (strdup)(ptr) +#define curlx_convert_tchar_to_UTF8(ptr) (strdup)(ptr) + +typedef union { + char *tchar_ptr; + const char *const_tchar_ptr; + unsigned char *tbyte_ptr; + const unsigned char *const_tbyte_ptr; +} xcharp_u; + +#endif /* UNICODE && WIN32 */ + +#define curlx_unicodefree(ptr) \ + do { \ + if(ptr) { \ + (free)(ptr); \ + (ptr) = NULL; \ + } \ + } while(0) + +#endif /* HEADER_CURL_MULTIBYTE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ntlm_core.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ntlm_core.h new file mode 100644 index 0000000000000000000000000000000000000000..0c62ee052aba22e4586d58f06edd1a2c80f39491 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ntlm_core.h @@ -0,0 +1,79 @@ +#ifndef HEADER_CURL_NTLM_CORE_H +#define HEADER_CURL_NTLM_CORE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(USE_CURL_NTLM_CORE) + +#if defined(USE_OPENSSL) +# include +#elif defined(USE_WOLFSSL) +# include +# include +#endif + +/* Helpers to generate function byte arguments in little endian order */ +#define SHORTPAIR(x) ((int)((x) & 0xff)), ((int)(((x) >> 8) & 0xff)) +#define LONGQUARTET(x) ((int)((x) & 0xff)), ((int)(((x) >> 8) & 0xff)), \ + ((int)(((x) >> 16) & 0xff)), ((int)(((x) >> 24) & 0xff)) + +void Curl_ntlm_core_lm_resp(const unsigned char *keys, + const unsigned char *plaintext, + unsigned char *results); + +CURLcode Curl_ntlm_core_mk_lm_hash(const char *password, + unsigned char *lmbuffer /* 21 bytes */); + +CURLcode Curl_ntlm_core_mk_nt_hash(const char *password, + unsigned char *ntbuffer /* 21 bytes */); + +#if !defined(USE_WINDOWS_SSPI) + +CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen, + const unsigned char *data, unsigned int datalen, + unsigned char *output); + +CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen, + const char *domain, size_t domlen, + unsigned char *ntlmhash, + unsigned char *ntlmv2hash); + +CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, + unsigned char *challenge_client, + struct ntlmdata *ntlm, + unsigned char **ntresp, + unsigned int *ntresp_len); + +CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash, + unsigned char *challenge_client, + unsigned char *challenge_server, + unsigned char *lmresp); + +#endif /* !USE_WINDOWS_SSPI */ + +#endif /* USE_CURL_NTLM_CORE */ + +#endif /* HEADER_CURL_NTLM_CORE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ntlm_wb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ntlm_wb.h new file mode 100644 index 0000000000000000000000000000000000000000..37704c0fe0bf9d26e39745b1364ec55773d59f56 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_ntlm_wb.h @@ -0,0 +1,45 @@ +#ifndef HEADER_CURL_NTLM_WB_H +#define HEADER_CURL_NTLM_WB_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) && \ + defined(NTLM_WB_ENABLED) + +/* this is for ntlm header input */ +CURLcode Curl_input_ntlm_wb(struct Curl_easy *data, + struct connectdata *conn, bool proxy, + const char *header); + +/* this is for creating ntlm header output */ +CURLcode Curl_output_ntlm_wb(struct Curl_easy *data, struct connectdata *conn, + bool proxy); + +void Curl_http_auth_cleanup_ntlm_wb(struct connectdata *conn); + +#endif /* !CURL_DISABLE_HTTP && USE_NTLM && NTLM_WB_ENABLED */ + +#endif /* HEADER_CURL_NTLM_WB_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_path.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_path.h new file mode 100644 index 0000000000000000000000000000000000000000..9ed09dea835da169a70f0a4b8ed1a9125b5806cf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_path.h @@ -0,0 +1,49 @@ +#ifndef HEADER_CURL_PATH_H +#define HEADER_CURL_PATH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include +#include "urldata.h" + +#ifdef WIN32 +# undef PATH_MAX +# define PATH_MAX MAX_PATH +# ifndef R_OK +# define R_OK 4 +# endif +#endif + +#ifndef PATH_MAX +#define PATH_MAX 1024 /* just an extra precaution since there are systems that + have their definition hidden well */ +#endif + +CURLcode Curl_getworkingpath(struct Curl_easy *data, + char *homedir, + char **path); + +CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir); +#endif /* HEADER_CURL_PATH_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_printf.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_printf.h new file mode 100644 index 0000000000000000000000000000000000000000..46ef344f76eb5e7cf2e043cfeca7287f8b326449 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_printf.h @@ -0,0 +1,51 @@ +#ifndef HEADER_CURL_PRINTF_H +#define HEADER_CURL_PRINTF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* + * This header should be included by ALL code in libcurl that uses any + * *rintf() functions. + */ + +#include + +# undef printf +# undef fprintf +# undef msnprintf +# undef vprintf +# undef vfprintf +# undef vsnprintf +# undef mvsnprintf +# undef aprintf +# undef vaprintf +# define printf curl_mprintf +# define fprintf curl_mfprintf +# define msnprintf curl_msnprintf +# define vprintf curl_mvprintf +# define vfprintf curl_mvfprintf +# define mvsnprintf curl_mvsnprintf +# define aprintf curl_maprintf +# define vaprintf curl_mvaprintf +#endif /* HEADER_CURL_PRINTF_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_range.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_range.h new file mode 100644 index 0000000000000000000000000000000000000000..77679e2b944882353a9297012f955c2a5159ad21 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_range.h @@ -0,0 +1,31 @@ +#ifndef HEADER_CURL_RANGE_H +#define HEADER_CURL_RANGE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include "urldata.h" + +CURLcode Curl_range(struct Curl_easy *data); +#endif /* HEADER_CURL_RANGE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_rtmp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_rtmp.h new file mode 100644 index 0000000000000000000000000000000000000000..9b93ee060b75a9e1df0a0eac0b09a19784c41b89 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_rtmp.h @@ -0,0 +1,35 @@ +#ifndef HEADER_CURL_RTMP_H +#define HEADER_CURL_RTMP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Howard Chu, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#ifdef USE_LIBRTMP +extern const struct Curl_handler Curl_handler_rtmp; +extern const struct Curl_handler Curl_handler_rtmpt; +extern const struct Curl_handler Curl_handler_rtmpe; +extern const struct Curl_handler Curl_handler_rtmpte; +extern const struct Curl_handler Curl_handler_rtmps; +extern const struct Curl_handler Curl_handler_rtmpts; +#endif + +#endif /* HEADER_CURL_RTMP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_sasl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_sasl.h new file mode 100644 index 0000000000000000000000000000000000000000..e94e6431a2425b4bba0e536703cda5eca099979c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_sasl.h @@ -0,0 +1,165 @@ +#ifndef HEADER_CURL_SASL_H +#define HEADER_CURL_SASL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include + +#include "bufref.h" + +struct Curl_easy; +struct connectdata; + +/* Authentication mechanism flags */ +#define SASL_MECH_LOGIN (1 << 0) +#define SASL_MECH_PLAIN (1 << 1) +#define SASL_MECH_CRAM_MD5 (1 << 2) +#define SASL_MECH_DIGEST_MD5 (1 << 3) +#define SASL_MECH_GSSAPI (1 << 4) +#define SASL_MECH_EXTERNAL (1 << 5) +#define SASL_MECH_NTLM (1 << 6) +#define SASL_MECH_XOAUTH2 (1 << 7) +#define SASL_MECH_OAUTHBEARER (1 << 8) +#define SASL_MECH_SCRAM_SHA_1 (1 << 9) +#define SASL_MECH_SCRAM_SHA_256 (1 << 10) + +/* Authentication mechanism values */ +#define SASL_AUTH_NONE 0 +#define SASL_AUTH_ANY 0xffff +#define SASL_AUTH_DEFAULT (SASL_AUTH_ANY & ~SASL_MECH_EXTERNAL) + +/* Authentication mechanism strings */ +#define SASL_MECH_STRING_LOGIN "LOGIN" +#define SASL_MECH_STRING_PLAIN "PLAIN" +#define SASL_MECH_STRING_CRAM_MD5 "CRAM-MD5" +#define SASL_MECH_STRING_DIGEST_MD5 "DIGEST-MD5" +#define SASL_MECH_STRING_GSSAPI "GSSAPI" +#define SASL_MECH_STRING_EXTERNAL "EXTERNAL" +#define SASL_MECH_STRING_NTLM "NTLM" +#define SASL_MECH_STRING_XOAUTH2 "XOAUTH2" +#define SASL_MECH_STRING_OAUTHBEARER "OAUTHBEARER" +#define SASL_MECH_STRING_SCRAM_SHA_1 "SCRAM-SHA-1" +#define SASL_MECH_STRING_SCRAM_SHA_256 "SCRAM-SHA-256" + +/* SASL flags */ +#define SASL_FLAG_BASE64 0x0001 /* Messages are base64-encoded */ + +/* SASL machine states */ +typedef enum { + SASL_STOP, + SASL_PLAIN, + SASL_LOGIN, + SASL_LOGIN_PASSWD, + SASL_EXTERNAL, + SASL_CRAMMD5, + SASL_DIGESTMD5, + SASL_DIGESTMD5_RESP, + SASL_NTLM, + SASL_NTLM_TYPE2MSG, + SASL_GSSAPI, + SASL_GSSAPI_TOKEN, + SASL_GSSAPI_NO_DATA, + SASL_OAUTH2, + SASL_OAUTH2_RESP, + SASL_GSASL, + SASL_CANCEL, + SASL_FINAL +} saslstate; + +/* Progress indicator */ +typedef enum { + SASL_IDLE, + SASL_INPROGRESS, + SASL_DONE +} saslprogress; + +/* Protocol dependent SASL parameters */ +struct SASLproto { + const char *service; /* The service name */ + CURLcode (*sendauth)(struct Curl_easy *data, const char *mech, + const struct bufref *ir); + /* Send authentication command */ + CURLcode (*contauth)(struct Curl_easy *data, const char *mech, + const struct bufref *contauth); + /* Send authentication continuation */ + CURLcode (*cancelauth)(struct Curl_easy *data, const char *mech); + /* Cancel authentication. */ + CURLcode (*getmessage)(struct Curl_easy *data, struct bufref *out); + /* Get SASL response message */ + size_t maxirlen; /* Maximum initial response + mechanism length, + or zero if no max. This is normally the max + command length - other characters count. + This has to be zero for non-base64 protocols. */ + int contcode; /* Code to receive when continuation is expected */ + int finalcode; /* Code to receive upon authentication success */ + unsigned short defmechs; /* Mechanisms enabled by default */ + unsigned short flags; /* Configuration flags. */ +}; + +/* Per-connection parameters */ +struct SASL { + const struct SASLproto *params; /* Protocol dependent parameters */ + saslstate state; /* Current machine state */ + const char *curmech; /* Current mechanism id. */ + unsigned short authmechs; /* Accepted authentication mechanisms */ + unsigned short prefmech; /* Preferred authentication mechanism */ + unsigned short authused; /* Auth mechanism used for the connection */ + BIT(resetprefs); /* For URL auth option parsing. */ + BIT(mutual_auth); /* Mutual authentication enabled (GSSAPI only) */ + BIT(force_ir); /* Protocol always supports initial response */ +}; + +/* This is used to test whether the line starts with the given mechanism */ +#define sasl_mech_equal(line, wordlen, mech) \ + (wordlen == (sizeof(mech) - 1) / sizeof(char) && \ + !memcmp(line, mech, wordlen)) + +/* This is used to cleanup any libraries or curl modules used by the sasl + functions */ +void Curl_sasl_cleanup(struct connectdata *conn, unsigned short authused); + +/* Convert a mechanism name to a token */ +unsigned short Curl_sasl_decode_mech(const char *ptr, + size_t maxlen, size_t *len); + +/* Parse the URL login options */ +CURLcode Curl_sasl_parse_url_auth_option(struct SASL *sasl, + const char *value, size_t len); + +/* Initializes an SASL structure */ +void Curl_sasl_init(struct SASL *sasl, struct Curl_easy *data, + const struct SASLproto *params); + +/* Check if we have enough auth data and capabilities to authenticate */ +bool Curl_sasl_can_authenticate(struct SASL *sasl, struct Curl_easy *data); + +/* Calculate the required login details for SASL authentication */ +CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data, + bool force_ir, saslprogress *progress); + +/* Continue an SASL authentication */ +CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data, + int code, saslprogress *progress); + +#endif /* HEADER_CURL_SASL_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_setup.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_setup.h new file mode 100644 index 0000000000000000000000000000000000000000..ba14972e238e61267ae50b2c60a97fb50064532e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_setup.h @@ -0,0 +1,847 @@ +#ifndef HEADER_CURL_SETUP_H +#define HEADER_CURL_SETUP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#if defined(BUILDING_LIBCURL) && !defined(CURL_NO_OLDIES) +#define CURL_NO_OLDIES +#endif + +/* + * Disable Visual Studio warnings: + * 4127 "conditional expression is constant" + */ +#ifdef _MSC_VER +#pragma warning(disable:4127) +#endif + +/* + * Define WIN32 when build target is Win32 API + */ + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +#define WIN32 +#endif + +#ifdef WIN32 +/* + * Don't include unneeded stuff in Windows headers to avoid compiler + * warnings and macro clashes. + * Make sure to define this macro before including any Windows headers. + */ +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# ifndef NOGDI +# define NOGDI +# endif +/* Detect Windows App environment which has a restricted access + * to the Win32 APIs. */ +# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \ + defined(WINAPI_FAMILY) +# include +# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \ + !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# define CURL_WINDOWS_APP +# endif +# endif +#endif + +/* + * Include configuration script results or hand-crafted + * configuration file for platforms which lack config tool. + */ + +#ifdef HAVE_CONFIG_H + +#include "curl_config.h" + +#else /* HAVE_CONFIG_H */ + +#ifdef _WIN32_WCE +# include "config-win32ce.h" +#else +# ifdef WIN32 +# include "config-win32.h" +# endif +#endif + +#ifdef macintosh +# include "config-mac.h" +#endif + +#ifdef __riscos__ +# include "config-riscos.h" +#endif + +#ifdef __AMIGA__ +# include "config-amigaos.h" +#endif + +#ifdef __OS400__ +# include "config-os400.h" +#endif + +#ifdef __PLAN9__ +# include "config-plan9.h" +#endif + +#ifdef MSDOS +# include "config-dos.h" +#endif + +#endif /* HAVE_CONFIG_H */ + +/* ================================================================ */ +/* Definition of preprocessor macros/symbols which modify compiler */ +/* behavior or generated code characteristics must be done here, */ +/* as appropriate, before any system header file is included. It is */ +/* also possible to have them defined in the config file included */ +/* before this point. As a result of all this we frown inclusion of */ +/* system header files in our config files, avoid this at any cost. */ +/* ================================================================ */ + +/* + * AIX 4.3 and newer needs _THREAD_SAFE defined to build + * proper reentrant code. Others may also need it. + */ + +#ifdef NEED_THREAD_SAFE +# ifndef _THREAD_SAFE +# define _THREAD_SAFE +# endif +#endif + +/* + * Tru64 needs _REENTRANT set for a few function prototypes and + * things to appear in the system header files. Unixware needs it + * to build proper reentrant code. Others may also need it. + */ + +#ifdef NEED_REENTRANT +# ifndef _REENTRANT +# define _REENTRANT +# endif +#endif + +/* Solaris needs this to get a POSIX-conformant getpwuid_r */ +#if defined(sun) || defined(__sun) +# ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +# endif +#endif + +/* ================================================================ */ +/* If you need to include a system header file for your platform, */ +/* please, do it beyond the point further indicated in this file. */ +/* ================================================================ */ + +/* + * Disable other protocols when http is the only one desired. + */ + +#ifdef HTTP_ONLY +# ifndef CURL_DISABLE_DICT +# define CURL_DISABLE_DICT +# endif +# ifndef CURL_DISABLE_FILE +# define CURL_DISABLE_FILE +# endif +# ifndef CURL_DISABLE_FTP +# define CURL_DISABLE_FTP +# endif +# ifndef CURL_DISABLE_GOPHER +# define CURL_DISABLE_GOPHER +# endif +# ifndef CURL_DISABLE_IMAP +# define CURL_DISABLE_IMAP +# endif +# ifndef CURL_DISABLE_LDAP +# define CURL_DISABLE_LDAP +# endif +# ifndef CURL_DISABLE_LDAPS +# define CURL_DISABLE_LDAPS +# endif +# ifndef CURL_DISABLE_MQTT +# define CURL_DISABLE_MQTT +# endif +# ifndef CURL_DISABLE_POP3 +# define CURL_DISABLE_POP3 +# endif +# ifndef CURL_DISABLE_RTSP +# define CURL_DISABLE_RTSP +# endif +# ifndef CURL_DISABLE_SMB +# define CURL_DISABLE_SMB +# endif +# ifndef CURL_DISABLE_SMTP +# define CURL_DISABLE_SMTP +# endif +# ifndef CURL_DISABLE_TELNET +# define CURL_DISABLE_TELNET +# endif +# ifndef CURL_DISABLE_TFTP +# define CURL_DISABLE_TFTP +# endif +#endif + +/* + * When http is disabled rtsp is not supported. + */ + +#if defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_RTSP) +# define CURL_DISABLE_RTSP +#endif + +/* ================================================================ */ +/* No system header file shall be included in this file before this */ +/* point. */ +/* ================================================================ */ + +/* + * OS/400 setup file includes some system headers. + */ + +#ifdef __OS400__ +# include "setup-os400.h" +#endif + +/* + * VMS setup file includes some system headers. + */ + +#ifdef __VMS +# include "setup-vms.h" +#endif + +/* + * Windows setup file includes some system headers. + */ + +#ifdef HAVE_WINDOWS_H +# include "setup-win32.h" +#endif + +#include + +/* + * Use getaddrinfo to resolve the IPv4 address literal. If the current network + * interface doesn't support IPv4, but supports IPv6, NAT64, and DNS64, + * performing this task will result in a synthesized IPv6 address. + */ +#if defined(__APPLE__) && !defined(USE_ARES) +#include +#define USE_RESOLVE_ON_IPS 1 +# if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && \ + defined(ENABLE_IPV6) +# define CURL_MACOS_CALL_COPYPROXIES 1 +# endif +#endif + +#ifdef USE_LWIPSOCK +# include +# include +# include +#endif + +#ifdef HAVE_EXTRA_STRICMP_H +# include +#endif + +#ifdef HAVE_EXTRA_STRDUP_H +# include +#endif + +#ifdef __AMIGA__ +# ifdef __amigaos4__ +# define __USE_INLINE__ + /* use our own resolver which uses runtime feature detection */ +# define CURLRES_AMIGA + /* getaddrinfo() currently crashes bsdsocket.library, so disable */ +# undef HAVE_GETADDRINFO +# if !(defined(__NEWLIB__) || \ + (defined(__CLIB2__) && defined(__THREAD_SAFE))) + /* disable threaded resolver with clib2 - requires newlib or clib-ts */ +# undef USE_THREADS_POSIX +# endif +# endif +# include +# include +# include +# include +# include +# if defined(HAVE_PROTO_BSDSOCKET_H) && \ + (!defined(__amigaos4__) || defined(USE_AMISSL)) + /* use bsdsocket.library directly, instead of libc networking functions */ +# define _SYS_MBUF_H /* m_len define clashes with curl */ +# include +# ifdef __amigaos4__ + int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *errorfds, struct timeval *timeout); +# define select(a,b,c,d,e) Curl_amiga_select(a,b,c,d,e) +# else +# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) +# endif + /* must not use libc's fcntl() on bsdsocket.library sockfds! */ +# undef HAVE_FCNTL +# undef HAVE_FCNTL_O_NONBLOCK +# else + /* use libc networking and hence close() and fnctl() */ +# undef HAVE_CLOSESOCKET_CAMEL +# undef HAVE_IOCTLSOCKET_CAMEL +# endif +/* + * In clib2 arpa/inet.h warns that some prototypes may clash + * with bsdsocket.library. This avoids the definition of those. + */ +# define __NO_NET_API +#endif + +#include +#include + +#ifdef __TANDEM /* for ns*-tandem-nsk systems */ +# if ! defined __LP64 +# include /* FLOSS is only used for 32-bit builds. */ +# endif +#endif + +#ifndef STDC_HEADERS /* no standard C headers! */ +#include +#endif + +#ifdef __POCC__ +# include +# include +# define sys_nerr EILSEQ +#endif + +/* + * Salford-C kludge section (mostly borrowed from wxWidgets). + */ +#ifdef __SALFORDC__ + #pragma suppress 353 /* Possible nested comments */ + #pragma suppress 593 /* Define not used */ + #pragma suppress 61 /* enum has no name */ + #pragma suppress 106 /* unnamed, unused parameter */ + #include +#endif + +/* + * Large file (>2Gb) support using WIN32 functions. + */ + +#ifdef USE_WIN32_LARGE_FILES +# include +# include +# include +# undef lseek +# define lseek(fdes,offset,whence) _lseeki64(fdes, offset, whence) +# undef fstat +# define fstat(fdes,stp) _fstati64(fdes, stp) +# undef stat +# define stat(fname,stp) curlx_win32_stat(fname, stp) +# define struct_stat struct _stati64 +# define LSEEK_ERROR (__int64)-1 +# define open curlx_win32_open +# define fopen(fname,mode) curlx_win32_fopen(fname, mode) +# define access(fname,mode) curlx_win32_access(fname, mode) + int curlx_win32_open(const char *filename, int oflag, ...); + int curlx_win32_stat(const char *path, struct_stat *buffer); + FILE *curlx_win32_fopen(const char *filename, const char *mode); + int curlx_win32_access(const char *path, int mode); +#endif + +/* + * Small file (<2Gb) support using WIN32 functions. + */ + +#ifdef USE_WIN32_SMALL_FILES +# include +# include +# include +# ifndef _WIN32_WCE +# undef lseek +# define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence) +# define fstat(fdes,stp) _fstat(fdes, stp) +# define stat(fname,stp) curlx_win32_stat(fname, stp) +# define struct_stat struct _stat +# define open curlx_win32_open +# define fopen(fname,mode) curlx_win32_fopen(fname, mode) +# define access(fname,mode) curlx_win32_access(fname, mode) + int curlx_win32_stat(const char *path, struct_stat *buffer); + int curlx_win32_open(const char *filename, int oflag, ...); + FILE *curlx_win32_fopen(const char *filename, const char *mode); + int curlx_win32_access(const char *path, int mode); +# endif +# define LSEEK_ERROR (long)-1 +#endif + +#ifndef struct_stat +# define struct_stat struct stat +#endif + +#ifndef LSEEK_ERROR +# define LSEEK_ERROR (off_t)-1 +#endif + +#ifndef SIZEOF_TIME_T +/* assume default size of time_t to be 32 bit */ +#define SIZEOF_TIME_T 4 +#endif + +/* + * Default sizeof(off_t) in case it hasn't been defined in config file. + */ + +#ifndef SIZEOF_OFF_T +# if defined(__VMS) && !defined(__VAX) +# if defined(_LARGEFILE) +# define SIZEOF_OFF_T 8 +# endif +# elif defined(__OS400__) && defined(__ILEC400__) +# if defined(_LARGE_FILES) +# define SIZEOF_OFF_T 8 +# endif +# elif defined(__MVS__) && defined(__IBMC__) +# if defined(_LP64) || defined(_LARGE_FILES) +# define SIZEOF_OFF_T 8 +# endif +# elif defined(__370__) && defined(__IBMC__) +# if defined(_LP64) || defined(_LARGE_FILES) +# define SIZEOF_OFF_T 8 +# endif +# endif +# ifndef SIZEOF_OFF_T +# define SIZEOF_OFF_T 4 +# endif +#endif + +#if (SIZEOF_CURL_OFF_T < 8) +#error "too small curl_off_t" +#else + /* assume SIZEOF_CURL_OFF_T == 8 */ +# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) +#endif +#define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1)) + +#if (SIZEOF_TIME_T == 4) +# ifdef HAVE_TIME_T_UNSIGNED +# define TIME_T_MAX UINT_MAX +# define TIME_T_MIN 0 +# else +# define TIME_T_MAX INT_MAX +# define TIME_T_MIN INT_MIN +# endif +#else +# ifdef HAVE_TIME_T_UNSIGNED +# define TIME_T_MAX 0xFFFFFFFFFFFFFFFF +# define TIME_T_MIN 0 +# else +# define TIME_T_MAX 0x7FFFFFFFFFFFFFFF +# define TIME_T_MIN (-TIME_T_MAX - 1) +# endif +#endif + +#ifndef SIZE_T_MAX +/* some limits.h headers have this defined, some don't */ +#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4) +#define SIZE_T_MAX 18446744073709551615U +#else +#define SIZE_T_MAX 4294967295U +#endif +#endif + +#ifndef SSIZE_T_MAX +/* some limits.h headers have this defined, some don't */ +#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4) +#define SSIZE_T_MAX 9223372036854775807 +#else +#define SSIZE_T_MAX 2147483647 +#endif +#endif + +/* + * Arg 2 type for gethostname in case it hasn't been defined in config file. + */ + +#ifndef GETHOSTNAME_TYPE_ARG2 +# ifdef USE_WINSOCK +# define GETHOSTNAME_TYPE_ARG2 int +# else +# define GETHOSTNAME_TYPE_ARG2 size_t +# endif +#endif + +/* Below we define some functions. They should + + 4. set the SIGALRM signal timeout + 5. set dir/file naming defines + */ + +#ifdef WIN32 + +# define DIR_CHAR "\\" + +#else /* WIN32 */ + +# ifdef MSDOS /* Watt-32 */ + +# include +# define select(n,r,w,x,t) select_s(n,r,w,x,t) +# define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z)) +# include +# ifdef word +# undef word +# endif +# ifdef byte +# undef byte +# endif + +# endif /* MSDOS */ + +# ifdef __minix + /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */ + extern char *strtok_r(char *s, const char *delim, char **last); + extern struct tm *gmtime_r(const time_t * const timep, struct tm *tmp); +# endif + +# define DIR_CHAR "/" + +# ifndef fileno /* sunos 4 have this as a macro! */ + int fileno(FILE *stream); +# endif + +#endif /* WIN32 */ + +/* + * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN + * defined in ws2tcpip.h as well as to provide IPv6 support. + * Does not apply if lwIP is used. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) && !defined(USE_LWIPSOCK) +# if !defined(HAVE_WS2TCPIP_H) || \ + ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN)) +# undef HAVE_GETADDRINFO_THREADSAFE +# undef HAVE_FREEADDRINFO +# undef HAVE_GETADDRINFO +# undef ENABLE_IPV6 +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* resolver specialty compile-time defines */ +/* CURLRES_* defines to use in the host*.c sources */ +/* ---------------------------------------------------------------- */ + +/* + * lcc-win32 doesn't have _beginthreadex(), lacks threads support. + */ + +#if defined(__LCC__) && defined(WIN32) +# undef USE_THREADS_POSIX +# undef USE_THREADS_WIN32 +#endif + +/* + * MSVC threads support requires a multi-threaded runtime library. + * _beginthreadex() is not available in single-threaded ones. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) && !defined(_MT) +# undef USE_THREADS_POSIX +# undef USE_THREADS_WIN32 +#endif + +/* + * Mutually exclusive CURLRES_* definitions. + */ + +#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO) +# define CURLRES_IPV6 +#else +# define CURLRES_IPV4 +#endif + +#ifdef USE_ARES +# define CURLRES_ASYNCH +# define CURLRES_ARES +/* now undef the stock libc functions just to avoid them being used */ +# undef HAVE_GETADDRINFO +# undef HAVE_FREEADDRINFO +#elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) +# define CURLRES_ASYNCH +# define CURLRES_THREADED +#else +# define CURLRES_SYNCH +#endif + +/* ---------------------------------------------------------------- */ + +/* + * msvc 6.0 does not have struct sockaddr_storage and + * does not define IPPROTO_ESP in winsock2.h. But both + * are available if PSDK is properly installed. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) +# if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP)) +# undef HAVE_STRUCT_SOCKADDR_STORAGE +# endif +#endif + +/* + * Intentionally fail to build when using msvc 6.0 without PSDK installed. + * The brave of heart can circumvent this, defining ALLOW_MSVC6_WITHOUT_PSDK + * in lib/config-win32.h although absolutely discouraged and unsupported. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) +# if !defined(HAVE_WINDOWS_H) || ((_MSC_VER < 1300) && !defined(_FILETIME_)) +# if !defined(ALLOW_MSVC6_WITHOUT_PSDK) +# error MSVC 6.0 requires "February 2003 Platform SDK" a.k.a. \ + "Windows Server 2003 PSDK" +# else +# define CURL_DISABLE_LDAP 1 +# endif +# endif +#endif + +#if defined(HAVE_LIBIDN2) && defined(HAVE_IDN2_H) && !defined(USE_WIN32_IDN) +/* The lib and header are present */ +#define USE_LIBIDN2 +#endif + +#if defined(USE_LIBIDN2) && defined(USE_WIN32_IDN) +#error "Both libidn2 and WinIDN are enabled, choose one." +#endif + +#define LIBIDN_REQUIRED_VERSION "0.4.1" + +#if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \ + defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \ + defined(USE_BEARSSL) || defined(USE_RUSTLS) +#define USE_SSL /* SSL support has been enabled */ +#endif + +/* Single point where USE_SPNEGO definition might be defined */ +#if !defined(CURL_DISABLE_NEGOTIATE_AUTH) && \ + (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) +#define USE_SPNEGO +#endif + +/* Single point where USE_KERBEROS5 definition might be defined */ +#if !defined(CURL_DISABLE_KERBEROS_AUTH) && \ + (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) +#define USE_KERBEROS5 +#endif + +/* Single point where USE_NTLM definition might be defined */ +#if !defined(CURL_DISABLE_NTLM) +# if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \ + defined(USE_GNUTLS) || defined(USE_SECTRANSP) || \ + defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \ + (defined(USE_WOLFSSL) && defined(HAVE_WOLFSSL_DES_ECB_ENCRYPT)) +# define USE_CURL_NTLM_CORE +# endif +# if defined(USE_CURL_NTLM_CORE) || defined(USE_WINDOWS_SSPI) +# define USE_NTLM +# endif +#endif + +#ifdef CURL_WANTS_CA_BUNDLE_ENV +#error "No longer supported. Set CURLOPT_CAINFO at runtime instead." +#endif + +#if defined(USE_LIBSSH2) || defined(USE_LIBSSH) || defined(USE_WOLFSSH) +#define USE_SSH +#endif + +/* + * Provide a mechanism to silence picky compilers, such as gcc 4.6+. + * Parameters should of course normally not be unused, but for example when + * we have multiple implementations of the same interface it may happen. + */ + +#if defined(__GNUC__) && ((__GNUC__ >= 3) || \ + ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7))) +# define UNUSED_PARAM __attribute__((__unused__)) +# define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +#else +# define UNUSED_PARAM /* NOTHING */ +# define WARN_UNUSED_RESULT +#endif + +/* + * Include macros and defines that should only be processed once. + */ + +#ifndef HEADER_CURL_SETUP_ONCE_H +#include "curl_setup_once.h" +#endif + +/* + * Definition of our NOP statement Object-like macro + */ + +#ifndef Curl_nop_stmt +# define Curl_nop_stmt do { } while(0) +#endif + +/* + * Ensure that Winsock and lwIP TCP/IP stacks are not mixed. + */ + +#if defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H) +# if defined(SOCKET) || \ + defined(USE_WINSOCK) || \ + defined(HAVE_WINSOCK2_H) || \ + defined(HAVE_WS2TCPIP_H) +# error "WinSock and lwIP TCP/IP stack definitions shall not coexist!" +# endif +#endif + +/* + * shutdown() flags for systems that don't define them + */ + +#ifndef SHUT_RD +#define SHUT_RD 0x00 +#endif + +#ifndef SHUT_WR +#define SHUT_WR 0x01 +#endif + +#ifndef SHUT_RDWR +#define SHUT_RDWR 0x02 +#endif + +/* Define S_ISREG if not defined by system headers, e.g. MSVC */ +#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif + +/* Define S_ISDIR if not defined by system headers, e.g. MSVC */ +#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif + +/* In Windows the default file mode is text but an application can override it. +Therefore we specify it explicitly. https://github.com/curl/curl/pull/258 +*/ +#if defined(WIN32) || defined(MSDOS) +#define FOPEN_READTEXT "rt" +#define FOPEN_WRITETEXT "wt" +#define FOPEN_APPENDTEXT "at" +#elif defined(__CYGWIN__) +/* Cygwin has specific behavior we need to address when WIN32 is not defined. +https://cygwin.com/cygwin-ug-net/using-textbinary.html +For write we want our output to have line endings of LF and be compatible with +other Cygwin utilities. For read we want to handle input that may have line +endings either CRLF or LF so 't' is appropriate. +*/ +#define FOPEN_READTEXT "rt" +#define FOPEN_WRITETEXT "w" +#define FOPEN_APPENDTEXT "a" +#else +#define FOPEN_READTEXT "r" +#define FOPEN_WRITETEXT "w" +#define FOPEN_APPENDTEXT "a" +#endif + +/* for systems that don't detect this in configure */ +#ifndef CURL_SA_FAMILY_T +# if defined(HAVE_SA_FAMILY_T) +# define CURL_SA_FAMILY_T sa_family_t +# elif defined(HAVE_ADDRESS_FAMILY) +# define CURL_SA_FAMILY_T ADDRESS_FAMILY +# else +/* use a sensible default */ +# define CURL_SA_FAMILY_T unsigned short +# endif +#endif + +/* Some convenience macros to get the larger/smaller value out of two given. + We prefix with CURL to prevent name collisions. */ +#define CURLMAX(x,y) ((x)>(y)?(x):(y)) +#define CURLMIN(x,y) ((x)<(y)?(x):(y)) + +/* A convenience macro to provide both the string literal and the length of + the string literal in one go, useful for functions that take "string,len" + as their argument */ +#define STRCONST(x) x,sizeof(x)-1 + +/* Some versions of the Android SDK is missing the declaration */ +#if defined(HAVE_GETPWUID_R) && defined(HAVE_DECL_GETPWUID_R_MISSING) +struct passwd; +int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, + size_t buflen, struct passwd **result); +#endif + +#ifdef DEBUGBUILD +#define UNITTEST +#else +#define UNITTEST static +#endif + +#if defined(USE_NGHTTP2) || defined(USE_HYPER) +#define USE_HTTP2 +#endif + +#if (defined(USE_NGTCP2) && defined(USE_NGHTTP3)) || \ + defined(USE_QUICHE) || defined(USE_MSH3) +#define ENABLE_QUIC +#define USE_HTTP3 +#endif + +/* Certain Windows implementations are not aligned with what curl expects, + so always use the local one on this platform. E.g. the mingw-w64 + implementation can return wrong results for non-ASCII inputs. */ +#if defined(HAVE_BASENAME) && defined(WIN32) +#undef HAVE_BASENAME +#endif + +#if defined(USE_UNIX_SOCKETS) && defined(WIN32) +# if !defined(UNIX_PATH_MAX) + /* Replicating logic present in afunix.h + (distributed with newer Windows 10 SDK versions only) */ +# define UNIX_PATH_MAX 108 + /* !checksrc! disable TYPEDEFSTRUCT 1 */ + typedef struct sockaddr_un { + ADDRESS_FAMILY sun_family; + char sun_path[UNIX_PATH_MAX]; + } SOCKADDR_UN, *PSOCKADDR_UN; +# define WIN32_SOCKADDR_UN +# endif +#endif + +/* OpenSSLv3 marks DES, MD5 and ENGINE functions deprecated but we have no + replacements (yet) so tell the compiler to not warn for them. */ +#ifdef USE_OPENSSL +#define OPENSSL_SUPPRESS_DEPRECATED +#endif + +#endif /* HEADER_CURL_SETUP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_setup_once.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_setup_once.h new file mode 100644 index 0000000000000000000000000000000000000000..c1ed059070996cc27ba296803a87044b7786dd3e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_setup_once.h @@ -0,0 +1,422 @@ +#ifndef HEADER_CURL_SETUP_ONCE_H +#define HEADER_CURL_SETUP_ONCE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + + +/* + * Inclusion of common header files. + */ + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef NEED_MALLOC_H +#include +#endif + +#ifdef NEED_MEMORY_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#ifdef WIN32 +#include +#include +#endif + +#if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T) +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef USE_WOLFSSL +# if defined(HAVE_STDINT_H) +# include +# elif defined(HAVE_INTTYPES_H) +# include +# endif +#endif + +#ifdef USE_SCHANNEL +/* Must set this before is included directly or indirectly by + another Windows header. */ +# define SCHANNEL_USE_BLACKLISTS 1 +#endif + +#ifdef __hpux +# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL) +# ifdef _APP32_64BIT_OFF_T +# define OLD_APP32_64BIT_OFF_T _APP32_64BIT_OFF_T +# undef _APP32_64BIT_OFF_T +# else +# undef OLD_APP32_64BIT_OFF_T +# endif +# endif +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#include "functypes.h" + +#ifdef __hpux +# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL) +# ifdef OLD_APP32_64BIT_OFF_T +# define _APP32_64BIT_OFF_T OLD_APP32_64BIT_OFF_T +# undef OLD_APP32_64BIT_OFF_T +# endif +# endif +#endif + +/* + * Definition of timeval struct for platforms that don't have it. + */ + +#ifndef HAVE_STRUCT_TIMEVAL +struct timeval { + long tv_sec; + long tv_usec; +}; +#endif + + +/* + * If we have the MSG_NOSIGNAL define, make sure we use + * it as the fourth argument of function send() + */ + +#ifdef HAVE_MSG_NOSIGNAL +#define SEND_4TH_ARG MSG_NOSIGNAL +#else +#define SEND_4TH_ARG 0 +#endif + + +#if defined(__minix) +/* Minix doesn't support recv on TCP sockets */ +#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \ + (RECV_TYPE_ARG2)(y), \ + (RECV_TYPE_ARG3)(z)) + +#elif defined(HAVE_RECV) +/* + * The definitions for the return type and arguments types + * of functions recv() and send() belong and come from the + * configuration file. Do not define them in any other place. + * + * HAVE_RECV is defined if you have a function named recv() + * which is used to read incoming data from sockets. If your + * function has another name then don't define HAVE_RECV. + * + * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2, + * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also + * be defined. + * + * HAVE_SEND is defined if you have a function named send() + * which is used to write outgoing data on a connected socket. + * If yours has another name then don't define HAVE_SEND. + * + * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2, + * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and + * SEND_TYPE_RETV must also be defined. + */ + +#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \ + (RECV_TYPE_ARG2)(y), \ + (RECV_TYPE_ARG3)(z), \ + (RECV_TYPE_ARG4)(0)) +#else /* HAVE_RECV */ +#ifndef sread + /* */ + Error Missing_definition_of_macro_sread + /* */ +#endif +#endif /* HAVE_RECV */ + + +#if defined(__minix) +/* Minix doesn't support send on TCP sockets */ +#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \ + (SEND_TYPE_ARG2)(y), \ + (SEND_TYPE_ARG3)(z)) + +#elif defined(HAVE_SEND) +#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \ + (SEND_QUAL_ARG2 SEND_TYPE_ARG2)(y), \ + (SEND_TYPE_ARG3)(z), \ + (SEND_TYPE_ARG4)(SEND_4TH_ARG)) +#else /* HAVE_SEND */ +#ifndef swrite + /* */ + Error Missing_definition_of_macro_swrite + /* */ +#endif +#endif /* HAVE_SEND */ + + +/* + * Function-like macro definition used to close a socket. + */ + +#if defined(HAVE_CLOSESOCKET) +# define sclose(x) closesocket((x)) +#elif defined(HAVE_CLOSESOCKET_CAMEL) +# define sclose(x) CloseSocket((x)) +#elif defined(HAVE_CLOSE_S) +# define sclose(x) close_s((x)) +#elif defined(USE_LWIPSOCK) +# define sclose(x) lwip_close((x)) +#else +# define sclose(x) close((x)) +#endif + +/* + * Stack-independent version of fcntl() on sockets: + */ +#if defined(USE_LWIPSOCK) +# define sfcntl lwip_fcntl +#else +# define sfcntl fcntl +#endif + +/* + * 'bool' stuff compatible with HP-UX headers. + */ + +#if defined(__hpux) && !defined(HAVE_BOOL_T) + typedef int bool; +# define false 0 +# define true 1 +# define HAVE_BOOL_T +#endif + + +/* + * 'bool' exists on platforms with , i.e. C99 platforms. + * On non-C99 platforms there's no bool, so define an enum for that. + * On C99 platforms 'false' and 'true' also exist. Enum uses a + * global namespace though, so use bool_false and bool_true. + */ + +#ifndef HAVE_BOOL_T + typedef enum { + bool_false = 0, + bool_true = 1 + } bool; + +/* + * Use a define to let 'true' and 'false' use those enums. There + * are currently no use of true and false in libcurl proper, but + * there are some in the examples. This will cater for any later + * code happening to use true and false. + */ +# define false bool_false +# define true bool_true +# define HAVE_BOOL_T +#endif + +/* the type we use for storing a single boolean bit */ +#ifdef _MSC_VER +typedef bool bit; +#define BIT(x) bool x +#else +typedef unsigned int bit; +#define BIT(x) bit x:1 +#endif + +/* + * Redefine TRUE and FALSE too, to catch current use. With this + * change, 'bool found = 1' will give a warning on MIPSPro, but + * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro, + * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too. + */ + +#ifndef TRUE +#define TRUE true +#endif +#ifndef FALSE +#define FALSE false +#endif + +#include "curl_ctype.h" + + +/* + * Macro used to include code only in debug builds. + */ + +#ifdef DEBUGBUILD +#define DEBUGF(x) x +#else +#define DEBUGF(x) do { } while(0) +#endif + + +/* + * Macro used to include assertion code only in debug builds. + */ + +#undef DEBUGASSERT +#if defined(DEBUGBUILD) +#define DEBUGASSERT(x) assert(x) +#else +#define DEBUGASSERT(x) do { } while(0) +#endif + + +/* + * Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno + * (or equivalent) on this platform to hide platform details to code using it. + */ + +#ifdef USE_WINSOCK +#define SOCKERRNO ((int)WSAGetLastError()) +#define SET_SOCKERRNO(x) (WSASetLastError((int)(x))) +#else +#define SOCKERRNO (errno) +#define SET_SOCKERRNO(x) (errno = (x)) +#endif + + +/* + * Portable error number symbolic names defined to Winsock error codes. + */ + +#ifdef USE_WINSOCK +#undef EBADF /* override definition in errno.h */ +#define EBADF WSAEBADF +#undef EINTR /* override definition in errno.h */ +#define EINTR WSAEINTR +#undef EINVAL /* override definition in errno.h */ +#define EINVAL WSAEINVAL +#undef EWOULDBLOCK /* override definition in errno.h */ +#define EWOULDBLOCK WSAEWOULDBLOCK +#undef EINPROGRESS /* override definition in errno.h */ +#define EINPROGRESS WSAEINPROGRESS +#undef EALREADY /* override definition in errno.h */ +#define EALREADY WSAEALREADY +#undef ENOTSOCK /* override definition in errno.h */ +#define ENOTSOCK WSAENOTSOCK +#undef EDESTADDRREQ /* override definition in errno.h */ +#define EDESTADDRREQ WSAEDESTADDRREQ +#undef EMSGSIZE /* override definition in errno.h */ +#define EMSGSIZE WSAEMSGSIZE +#undef EPROTOTYPE /* override definition in errno.h */ +#define EPROTOTYPE WSAEPROTOTYPE +#undef ENOPROTOOPT /* override definition in errno.h */ +#define ENOPROTOOPT WSAENOPROTOOPT +#undef EPROTONOSUPPORT /* override definition in errno.h */ +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +#undef EOPNOTSUPP /* override definition in errno.h */ +#define EOPNOTSUPP WSAEOPNOTSUPP +#define EPFNOSUPPORT WSAEPFNOSUPPORT +#undef EAFNOSUPPORT /* override definition in errno.h */ +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#undef EADDRINUSE /* override definition in errno.h */ +#define EADDRINUSE WSAEADDRINUSE +#undef EADDRNOTAVAIL /* override definition in errno.h */ +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#undef ENETDOWN /* override definition in errno.h */ +#define ENETDOWN WSAENETDOWN +#undef ENETUNREACH /* override definition in errno.h */ +#define ENETUNREACH WSAENETUNREACH +#undef ENETRESET /* override definition in errno.h */ +#define ENETRESET WSAENETRESET +#undef ECONNABORTED /* override definition in errno.h */ +#define ECONNABORTED WSAECONNABORTED +#undef ECONNRESET /* override definition in errno.h */ +#define ECONNRESET WSAECONNRESET +#undef ENOBUFS /* override definition in errno.h */ +#define ENOBUFS WSAENOBUFS +#undef EISCONN /* override definition in errno.h */ +#define EISCONN WSAEISCONN +#undef ENOTCONN /* override definition in errno.h */ +#define ENOTCONN WSAENOTCONN +#define ESHUTDOWN WSAESHUTDOWN +#define ETOOMANYREFS WSAETOOMANYREFS +#undef ETIMEDOUT /* override definition in errno.h */ +#define ETIMEDOUT WSAETIMEDOUT +#undef ECONNREFUSED /* override definition in errno.h */ +#define ECONNREFUSED WSAECONNREFUSED +#undef ELOOP /* override definition in errno.h */ +#define ELOOP WSAELOOP +#ifndef ENAMETOOLONG /* possible previous definition in errno.h */ +#define ENAMETOOLONG WSAENAMETOOLONG +#endif +#define EHOSTDOWN WSAEHOSTDOWN +#undef EHOSTUNREACH /* override definition in errno.h */ +#define EHOSTUNREACH WSAEHOSTUNREACH +#ifndef ENOTEMPTY /* possible previous definition in errno.h */ +#define ENOTEMPTY WSAENOTEMPTY +#endif +#define EPROCLIM WSAEPROCLIM +#define EUSERS WSAEUSERS +#define EDQUOT WSAEDQUOT +#define ESTALE WSAESTALE +#define EREMOTE WSAEREMOTE +#endif + +/* + * Macro argv_item_t hides platform details to code using it. + */ + +#ifdef __VMS +#define argv_item_t __char_ptr32 +#elif defined(_UNICODE) +#define argv_item_t wchar_t * +#else +#define argv_item_t char * +#endif + + +/* + * We use this ZERO_NULL to avoid picky compiler warnings, + * when assigning a NULL pointer to a function pointer var. + */ + +#define ZERO_NULL 0 + + +#endif /* HEADER_CURL_SETUP_ONCE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_sha256.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_sha256.h new file mode 100644 index 0000000000000000000000000000000000000000..d99f958f90d079b4eafbf8b221c81396b1b016e7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_sha256.h @@ -0,0 +1,50 @@ +#ifndef HEADER_CURL_SHA256_H +#define HEADER_CURL_SHA256_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Florin Petriuc, + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#if !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) \ + || defined(USE_LIBSSH2) + +#include +#include "curl_hmac.h" + +extern const struct HMAC_params Curl_HMAC_SHA256[1]; + +#ifdef USE_WOLFSSL +/* SHA256_DIGEST_LENGTH is an enum value in wolfSSL. Need to import it from + * sha.h */ +#include +#include +#else +#define SHA256_DIGEST_LENGTH 32 +#endif + +CURLcode Curl_sha256it(unsigned char *outbuffer, const unsigned char *input, + const size_t len); + +#endif + +#endif /* HEADER_CURL_SHA256_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_sspi.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_sspi.h new file mode 100644 index 0000000000000000000000000000000000000000..5af7c2483a3d7b385ab151d612fb80308ce7e52a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_sspi.h @@ -0,0 +1,107 @@ +#ifndef HEADER_CURL_SSPI_H +#define HEADER_CURL_SSPI_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_WINDOWS_SSPI + +#include + +/* + * When including the following three headers, it is mandatory to define either + * SECURITY_WIN32 or SECURITY_KERNEL, indicating who is compiling the code. + */ + +#undef SECURITY_WIN32 +#undef SECURITY_KERNEL +#define SECURITY_WIN32 1 +#include +#include +#include + +CURLcode Curl_sspi_global_init(void); +void Curl_sspi_global_cleanup(void); + +/* This is used to populate the domain in a SSPI identity structure */ +CURLcode Curl_override_sspi_http_realm(const char *chlg, + SEC_WINNT_AUTH_IDENTITY *identity); + +/* This is used to generate an SSPI identity structure */ +CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp, + SEC_WINNT_AUTH_IDENTITY *identity); + +/* This is used to free an SSPI identity structure */ +void Curl_sspi_free_identity(SEC_WINNT_AUTH_IDENTITY *identity); + +/* Forward-declaration of global variables defined in curl_sspi.c */ +extern HMODULE s_hSecDll; +extern PSecurityFunctionTable s_pSecFn; + +/* Provide some definitions missing in old headers */ +#define SP_NAME_DIGEST "WDigest" +#define SP_NAME_NTLM "NTLM" +#define SP_NAME_NEGOTIATE "Negotiate" +#define SP_NAME_KERBEROS "Kerberos" + +#ifndef ISC_REQ_USE_HTTP_STYLE +#define ISC_REQ_USE_HTTP_STYLE 0x01000000 +#endif + +#ifndef SEC_E_INVALID_PARAMETER +# define SEC_E_INVALID_PARAMETER ((HRESULT)0x8009035DL) +#endif +#ifndef SEC_E_DELEGATION_POLICY +# define SEC_E_DELEGATION_POLICY ((HRESULT)0x8009035EL) +#endif +#ifndef SEC_E_POLICY_NLTM_ONLY +# define SEC_E_POLICY_NLTM_ONLY ((HRESULT)0x8009035FL) +#endif + +#ifndef SEC_I_SIGNATURE_NEEDED +# define SEC_I_SIGNATURE_NEEDED ((HRESULT)0x0009035CL) +#endif + +#ifndef CRYPT_E_REVOKED +# define CRYPT_E_REVOKED ((HRESULT)0x80092010L) +#endif + +#ifdef UNICODE +# define SECFLAG_WINNT_AUTH_IDENTITY \ + (unsigned long)SEC_WINNT_AUTH_IDENTITY_UNICODE +#else +# define SECFLAG_WINNT_AUTH_IDENTITY \ + (unsigned long)SEC_WINNT_AUTH_IDENTITY_ANSI +#endif + +/* + * Definitions required from ntsecapi.h are directly provided below this point + * to avoid including ntsecapi.h due to a conflict with OpenSSL's safestack.h + */ +#define KERB_WRAP_NO_ENCRYPT 0x80000001 + +#endif /* USE_WINDOWS_SSPI */ + +#endif /* HEADER_CURL_SSPI_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_threads.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_threads.h new file mode 100644 index 0000000000000000000000000000000000000000..27a478d4c702cb772139134e535869e5c6d51b2b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_threads.h @@ -0,0 +1,65 @@ +#ifndef HEADER_CURL_THREADS_H +#define HEADER_CURL_THREADS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#if defined(USE_THREADS_POSIX) +# define CURL_STDCALL +# define curl_mutex_t pthread_mutex_t +# define curl_thread_t pthread_t * +# define curl_thread_t_null (pthread_t *)0 +# define Curl_mutex_init(m) pthread_mutex_init(m, NULL) +# define Curl_mutex_acquire(m) pthread_mutex_lock(m) +# define Curl_mutex_release(m) pthread_mutex_unlock(m) +# define Curl_mutex_destroy(m) pthread_mutex_destroy(m) +#elif defined(USE_THREADS_WIN32) +# define CURL_STDCALL __stdcall +# define curl_mutex_t CRITICAL_SECTION +# define curl_thread_t HANDLE +# define curl_thread_t_null (HANDLE)0 +# if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \ + (_WIN32_WINNT < _WIN32_WINNT_VISTA) +# define Curl_mutex_init(m) InitializeCriticalSection(m) +# else +# define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1) +# endif +# define Curl_mutex_acquire(m) EnterCriticalSection(m) +# define Curl_mutex_release(m) LeaveCriticalSection(m) +# define Curl_mutex_destroy(m) DeleteCriticalSection(m) +#endif + +#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) + +/* !checksrc! disable SPACEBEFOREPAREN 1 */ +curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *), + void *arg); + +void Curl_thread_destroy(curl_thread_t hnd); + +int Curl_thread_join(curl_thread_t *hnd); + +#endif /* USE_THREADS_POSIX || USE_THREADS_WIN32 */ + +#endif /* HEADER_CURL_THREADS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_trc.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_trc.h new file mode 100644 index 0000000000000000000000000000000000000000..84b5471d859500fa4543e0073ad0e6b5cfdba399 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curl_trc.h @@ -0,0 +1,150 @@ +#ifndef HEADER_CURL_TRC_H +#define HEADER_CURL_TRC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +struct Curl_easy; +struct Curl_cfilter; + +/** + * Init logging, return != 0 on failure. + */ +CURLcode Curl_trc_init(void); + +/** + * Configure tracing. May be called several times during global + * initialization. Later calls may not take effect. + * + * Configuration format supported: + * - comma-separated list of component names to enable logging on. + * E.g. 'http/2,ssl'. Unknown names are ignored. Names are compared + * case-insensitive. + * - component 'all' applies to all known log components + * - prefixing a component with '+' or '-' will en-/disable logging for + * that component + * Example: 'all,-ssl' would enable logging for all components but the + * SSL filters. + * + * @param config configuration string + */ +CURLcode Curl_trc_opt(const char *config); + +/* the function used to output verbose information */ +void Curl_debug(struct Curl_easy *data, curl_infotype type, + char *ptr, size_t size); + +/** + * Output an informational message when transfer's verbose logging is enabled. + */ +void Curl_infof(struct Curl_easy *data, +#if defined(__GNUC__) && !defined(printf) && \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__MINGW32__) + const char *fmt, ...) + __attribute__((format(printf, 2, 3))); +#else + const char *fmt, ...); +#endif + +/** + * Output a failure message on registered callbacks for transfer. + */ +void Curl_failf(struct Curl_easy *data, +#if defined(__GNUC__) && !defined(printf) && \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__MINGW32__) + const char *fmt, ...) + __attribute__((format(printf, 2, 3))); +#else + const char *fmt, ...); +#endif + +#define failf Curl_failf + +/** + * Output an informational message when both transfer's verbose logging + * and connection filters verbose logging are enabled. + */ +void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf, +#if defined(__GNUC__) && !defined(printf) && \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__MINGW32__) + const char *fmt, ...) + __attribute__((format(printf, 3, 4))); +#else + const char *fmt, ...); +#endif + +#define CURL_LOG_LVL_NONE 0 +#define CURL_LOG_LVL_INFO 1 + + +#if !defined(CURL_DISABLE_VERBOSE_STRINGS) +/* informational messages enabled */ + +#define Curl_trc_is_verbose(data) ((data) && (data)->set.verbose) +#define Curl_trc_cf_is_verbose(cf, data) \ + ((data) && (data)->set.verbose && \ + (cf) && (cf)->cft->log_level >= CURL_LOG_LVL_INFO) + +/* explainer: we have some mix configuration and werror settings + * that define HAVE_VARIADIC_MACROS_C99 even though C89 is enforced + * on gnuc and some other compiler. Need to treat carefully. + */ +#if defined(HAVE_VARIADIC_MACROS_C99) && \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) + +#define infof(data, ...) \ + do { if(Curl_trc_is_verbose(data)) \ + Curl_infof(data, __VA_ARGS__); } while(0) +#define CURL_TRC_CF(data, cf, ...) \ + do { if(Curl_trc_cf_is_verbose(cf, data)) \ + Curl_trc_cf_infof(data, cf, __VA_ARGS__); } while(0) + +#else /* no variadic macro args */ +#define infof Curl_infof +#define CURL_TRC_CF Curl_trc_cf_infof +#endif /* variadic macro args */ + +#else /* !CURL_DISABLE_VERBOSE_STRINGS */ +/* All informational messages are not compiled in for size savings */ + +#define Curl_trc_is_verbose(d) ((void)(d), FALSE) +#define Curl_trc_cf_is_verbose(x,y) ((void)(x), (void)(y), FALSE) + +#if defined(HAVE_VARIADIC_MACROS_C99) +#define infof(...) Curl_nop_stmt +#define CURL_TRC_CF(...) Curl_nop_stmt +#define Curl_trc_cf_infof(...) Curl_nop_stmt +#elif defined(HAVE_VARIADIC_MACROS_GCC) +#define infof(x...) Curl_nop_stmt +#define CURL_TRC_CF(x...) Curl_nop_stmt +#define Curl_trc_cf_infof(x...) Curl_nop_stmt +#else +#error "missing VARIADIC macro define, fix and rebuild!" +#endif + +#endif /* CURL_DISABLE_VERBOSE_STRINGS */ + +#endif /* HEADER_CURL_TRC_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curlx.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curlx.h new file mode 100644 index 0000000000000000000000000000000000000000..7a753d682476592187e518d530b0b8d07137f5b6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/curlx.h @@ -0,0 +1,118 @@ +#ifndef HEADER_CURL_CURLX_H +#define HEADER_CURL_CURLX_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* + * Defines protos and includes all header files that provide the curlx_* + * functions. The curlx_* functions are not part of the libcurl API, but are + * stand-alone functions whose sources can be built and linked by apps if need + * be. + */ + +#include +/* this is still a public header file that provides the curl_mprintf() + functions while they still are offered publicly. They will be made library- + private one day */ + +#include "strcase.h" +/* "strcase.h" provides the strcasecompare protos */ + +#include "strtoofft.h" +/* "strtoofft.h" provides this function: curlx_strtoofft(), returns a + curl_off_t number from a given string. +*/ + +#include "nonblock.h" +/* "nonblock.h" provides curlx_nonblock() */ + +#include "warnless.h" +/* "warnless.h" provides functions: + + curlx_ultous() + curlx_ultouc() + curlx_uztosi() +*/ + +#include "curl_multibyte.h" +/* "curl_multibyte.h" provides these functions and macros: + + curlx_convert_UTF8_to_wchar() + curlx_convert_wchar_to_UTF8() + curlx_convert_UTF8_to_tchar() + curlx_convert_tchar_to_UTF8() + curlx_unicodefree() +*/ + +#include "version_win32.h" +/* "version_win32.h" provides curlx_verify_windows_version() */ + +/* Now setup curlx_ * names for the functions that are to become curlx_ and + be removed from a future libcurl official API: + curlx_getenv + curlx_mprintf (and its variations) + curlx_strcasecompare + curlx_strncasecompare + +*/ + +#define curlx_getenv curl_getenv +#define curlx_mvsnprintf curl_mvsnprintf +#define curlx_msnprintf curl_msnprintf +#define curlx_maprintf curl_maprintf +#define curlx_mvaprintf curl_mvaprintf +#define curlx_msprintf curl_msprintf +#define curlx_mprintf curl_mprintf +#define curlx_mfprintf curl_mfprintf +#define curlx_mvsprintf curl_mvsprintf +#define curlx_mvprintf curl_mvprintf +#define curlx_mvfprintf curl_mvfprintf + +#ifdef ENABLE_CURLX_PRINTF +/* If this define is set, we define all "standard" printf() functions to use + the curlx_* version instead. It makes the source code transparent and + easier to understand/patch. Undefine them first. */ +# undef printf +# undef fprintf +# undef sprintf +# undef msnprintf +# undef vprintf +# undef vfprintf +# undef vsprintf +# undef mvsnprintf +# undef aprintf +# undef vaprintf + +# define printf curlx_mprintf +# define fprintf curlx_mfprintf +# define sprintf curlx_msprintf +# define msnprintf curlx_msnprintf +# define vprintf curlx_mvprintf +# define vfprintf curlx_mvfprintf +# define mvsnprintf curlx_mvsnprintf +# define aprintf curlx_maprintf +# define vaprintf curlx_mvaprintf +#endif /* ENABLE_CURLX_PRINTF */ + +#endif /* HEADER_CURL_CURLX_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/dict.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/dict.h new file mode 100644 index 0000000000000000000000000000000000000000..ba9a92719ba87a99904bed485a5c14e8c81468c1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/dict.h @@ -0,0 +1,31 @@ +#ifndef HEADER_CURL_DICT_H +#define HEADER_CURL_DICT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#ifndef CURL_DISABLE_DICT +extern const struct Curl_handler Curl_handler_dict; +#endif + +#endif /* HEADER_CURL_DICT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/doh.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/doh.h new file mode 100644 index 0000000000000000000000000000000000000000..7d7b694f33add7e2daac8577b0c2a1553e042f89 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/doh.h @@ -0,0 +1,128 @@ +#ifndef HEADER_CURL_DOH_H +#define HEADER_CURL_DOH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "urldata.h" +#include "curl_addrinfo.h" + +#ifndef CURL_DISABLE_DOH + +typedef enum { + DOH_OK, + DOH_DNS_BAD_LABEL, /* 1 */ + DOH_DNS_OUT_OF_RANGE, /* 2 */ + DOH_DNS_LABEL_LOOP, /* 3 */ + DOH_TOO_SMALL_BUFFER, /* 4 */ + DOH_OUT_OF_MEM, /* 5 */ + DOH_DNS_RDATA_LEN, /* 6 */ + DOH_DNS_MALFORMAT, /* 7 */ + DOH_DNS_BAD_RCODE, /* 8 - no such name */ + DOH_DNS_UNEXPECTED_TYPE, /* 9 */ + DOH_DNS_UNEXPECTED_CLASS, /* 10 */ + DOH_NO_CONTENT, /* 11 */ + DOH_DNS_BAD_ID, /* 12 */ + DOH_DNS_NAME_TOO_LONG /* 13 */ +} DOHcode; + +typedef enum { + DNS_TYPE_A = 1, + DNS_TYPE_NS = 2, + DNS_TYPE_CNAME = 5, + DNS_TYPE_AAAA = 28, + DNS_TYPE_DNAME = 39 /* RFC6672 */ +} DNStype; + +/* one of these for each DoH request */ +struct dnsprobe { + CURL *easy; + DNStype dnstype; + unsigned char dohbuffer[512]; + size_t dohlen; + struct dynbuf serverdoh; +}; + +struct dohdata { + struct curl_slist *headers; + struct dnsprobe probe[DOH_PROBE_SLOTS]; + unsigned int pending; /* still outstanding requests */ + int port; + const char *host; +}; + +/* + * Curl_doh() resolve a name using DoH (DNS-over-HTTPS). It resolves a name + * and returns a 'Curl_addrinfo *' with the address information. + */ + +struct Curl_addrinfo *Curl_doh(struct Curl_easy *data, + const char *hostname, + int port, + int *waitp); + +CURLcode Curl_doh_is_resolved(struct Curl_easy *data, + struct Curl_dns_entry **dns); + +int Curl_doh_getsock(struct connectdata *conn, curl_socket_t *socks); + +#define DOH_MAX_ADDR 24 +#define DOH_MAX_CNAME 4 + +struct dohaddr { + int type; + union { + unsigned char v4[4]; /* network byte order */ + unsigned char v6[16]; + } ip; +}; + +struct dohentry { + struct dynbuf cname[DOH_MAX_CNAME]; + struct dohaddr addr[DOH_MAX_ADDR]; + int numaddr; + unsigned int ttl; + int numcname; +}; + + +#ifdef DEBUGBUILD +DOHcode doh_encode(const char *host, + DNStype dnstype, + unsigned char *dnsp, /* buffer */ + size_t len, /* buffer size */ + size_t *olen); /* output length */ +DOHcode doh_decode(const unsigned char *doh, + size_t dohlen, + DNStype dnstype, + struct dohentry *d); +void de_init(struct dohentry *d); +void de_cleanup(struct dohentry *d); +#endif + +#else /* if DoH is disabled */ +#define Curl_doh(a,b,c,d) NULL +#define Curl_doh_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST +#endif + +#endif /* HEADER_CURL_DOH_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/dynbuf.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/dynbuf.h new file mode 100644 index 0000000000000000000000000000000000000000..31a9130197913c4f4c1aa6410b26d27adc43b8ae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/dynbuf.h @@ -0,0 +1,93 @@ +#ifndef HEADER_CURL_DYNBUF_H +#define HEADER_CURL_DYNBUF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include + +#ifndef BUILDING_LIBCURL +/* this renames the functions so that the tool code can use the same code + without getting symbol collisions */ +#define Curl_dyn_init(a,b) curlx_dyn_init(a,b) +#define Curl_dyn_add(a,b) curlx_dyn_add(a,b) +#define Curl_dyn_addn(a,b,c) curlx_dyn_addn(a,b,c) +#define Curl_dyn_addf curlx_dyn_addf +#define Curl_dyn_vaddf curlx_dyn_vaddf +#define Curl_dyn_free(a) curlx_dyn_free(a) +#define Curl_dyn_ptr(a) curlx_dyn_ptr(a) +#define Curl_dyn_uptr(a) curlx_dyn_uptr(a) +#define Curl_dyn_len(a) curlx_dyn_len(a) +#define Curl_dyn_reset(a) curlx_dyn_reset(a) +#define Curl_dyn_tail(a,b) curlx_dyn_tail(a,b) +#define Curl_dyn_setlen(a,b) curlx_dyn_setlen(a,b) +#define curlx_dynbuf dynbuf /* for the struct name */ +#endif + +struct dynbuf { + char *bufr; /* point to a null-terminated allocated buffer */ + size_t leng; /* number of bytes *EXCLUDING* the null-terminator */ + size_t allc; /* size of the current allocation */ + size_t toobig; /* size limit for the buffer */ +#ifdef DEBUGBUILD + int init; /* detect API usage mistakes */ +#endif +}; + +void Curl_dyn_init(struct dynbuf *s, size_t toobig); +void Curl_dyn_free(struct dynbuf *s); +CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len) + WARN_UNUSED_RESULT; +CURLcode Curl_dyn_add(struct dynbuf *s, const char *str) + WARN_UNUSED_RESULT; +CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...) + WARN_UNUSED_RESULT; +CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap) + WARN_UNUSED_RESULT; +void Curl_dyn_reset(struct dynbuf *s); +CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail); +CURLcode Curl_dyn_setlen(struct dynbuf *s, size_t set); +char *Curl_dyn_ptr(const struct dynbuf *s); +unsigned char *Curl_dyn_uptr(const struct dynbuf *s); +size_t Curl_dyn_len(const struct dynbuf *s); + +/* returns 0 on success, -1 on error */ +/* The implementation of this function exists in mprintf.c */ +int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save); + +/* Dynamic buffer max sizes */ +#define DYN_DOH_RESPONSE 3000 +#define DYN_DOH_CNAME 256 +#define DYN_PAUSE_BUFFER (64 * 1024 * 1024) +#define DYN_HAXPROXY 2048 +#define DYN_HTTP_REQUEST (1024*1024) +#define DYN_APRINTF 8000000 +#define DYN_RTSP_REQ_HEADER (64*1024) +#define DYN_TRAILERS (64*1024) +#define DYN_PROXY_CONNECT_HEADERS 16384 +#define DYN_QLOG_NAME 1024 +#define DYN_H1_TRAILER 4096 +#define DYN_PINGPPONG_CMD (64*1024) +#define DYN_IMAP_CMD (64*1024) +#define DYN_MQTT_RECV (64*1024) +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/dynhds.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/dynhds.h new file mode 100644 index 0000000000000000000000000000000000000000..8a053480e995fb3810b6fb3982053da01b5b27b7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/dynhds.h @@ -0,0 +1,174 @@ +#ifndef HEADER_CURL_DYNHDS_H +#define HEADER_CURL_DYNHDS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#include +#include "dynbuf.h" + +struct dynbuf; + +/** + * A single header entry. + * `name` and `value` are non-NULL and always NUL terminated. + */ +struct dynhds_entry { + char *name; + char *value; + size_t namelen; + size_t valuelen; +}; + +struct dynhds { + struct dynhds_entry **hds; + size_t hds_len; /* number of entries in hds */ + size_t hds_allc; /* size of hds allocation */ + size_t max_entries; /* size limit number of entries */ + size_t strs_len; /* length of all strings */ + size_t max_strs_size; /* max length of all strings */ + int opts; +}; + +#define DYNHDS_OPT_NONE (0) +#define DYNHDS_OPT_LOWERCASE (1 << 0) + +/** + * Init for use on first time or after a reset. + * Allow `max_entries` headers to be added, 0 for unlimited. + * Allow size of all name and values added to not exceed `max_strs_size`` + */ +void Curl_dynhds_init(struct dynhds *dynhds, size_t max_entries, + size_t max_strs_size); +/** + * Frees all data held in `dynhds`, but not the struct itself. + */ +void Curl_dynhds_free(struct dynhds *dynhds); + +/** + * Reset `dyndns` to the initial init state. May keep allocations + * around. + */ +void Curl_dynhds_reset(struct dynhds *dynhds); + +/** + * Return the number of header entries. + */ +size_t Curl_dynhds_count(struct dynhds *dynhds); + +/** + * Set the options to use, replacing any existing ones. + * This will not have an effect on already existing headers. + */ +void Curl_dynhds_set_opts(struct dynhds *dynhds, int opts); + +/** + * Return the n-th header entry or NULL if it does not exist. + */ +struct dynhds_entry *Curl_dynhds_getn(struct dynhds *dynhds, size_t n); + +/** + * Return the 1st header entry of the name or NULL if none exists. + */ +struct dynhds_entry *Curl_dynhds_get(struct dynhds *dynhds, + const char *name, size_t namelen); +struct dynhds_entry *Curl_dynhds_cget(struct dynhds *dynhds, const char *name); + +/** + * Return TRUE iff one or more headers with the given name exist. + */ +bool Curl_dynhds_contains(struct dynhds *dynhds, + const char *name, size_t namelen); +bool Curl_dynhds_ccontains(struct dynhds *dynhds, const char *name); + +/** + * Return how often the given name appears in `dynhds`. + * Names are case-insensitive. + */ +size_t Curl_dynhds_count_name(struct dynhds *dynhds, + const char *name, size_t namelen); + +/** + * Return how often the given 0-terminated name appears in `dynhds`. + * Names are case-insensitive. + */ +size_t Curl_dynhds_ccount_name(struct dynhds *dynhds, const char *name); + +/** + * Add a header, name + value, to `dynhds` at the end. Does *not* + * check for duplicate names. + */ +CURLcode Curl_dynhds_add(struct dynhds *dynhds, + const char *name, size_t namelen, + const char *value, size_t valuelen); + +/** + * Add a header, c-string name + value, to `dynhds` at the end. + */ +CURLcode Curl_dynhds_cadd(struct dynhds *dynhds, + const char *name, const char *value); + +/** + * Remove all entries with the given name. + * Returns number of entries removed. + */ +size_t Curl_dynhds_remove(struct dynhds *dynhds, + const char *name, size_t namelen); +size_t Curl_dynhds_cremove(struct dynhds *dynhds, const char *name); + + +/** + * Set the give header name and value, replacing any entries with + * the same name. The header is added at the end of all (remaining) + * entries. + */ +CURLcode Curl_dynhds_set(struct dynhds *dynhds, + const char *name, size_t namelen, + const char *value, size_t valuelen); + +CURLcode Curl_dynhds_cset(struct dynhds *dynhds, + const char *name, const char *value); + +/** + * Add a single header from a HTTP/1.1 formatted line at the end. Line + * may contain a delimiting \r\n or just \n. Any characters after + * that will be ignored. + */ +CURLcode Curl_dynhds_h1_cadd_line(struct dynhds *dynhds, const char *line); + +/** + * Add a single header from a HTTP/1.1 formatted line at the end. Line + * may contain a delimiting \r\n or just \n. Any characters after + * that will be ignored. + */ +CURLcode Curl_dynhds_h1_add_line(struct dynhds *dynhds, + const char *line, size_t line_len); + +/** + * Add the headers to the given `dynbuf` in HTTP/1.1 format with + * cr+lf line endings. Will NOT output a last empty line. + */ +CURLcode Curl_dynhds_h1_dprint(struct dynhds *dynhds, struct dynbuf *dbuf); + +#endif /* HEADER_CURL_DYNHDS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/easy_lock.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/easy_lock.h new file mode 100644 index 0000000000000000000000000000000000000000..d3fffd0d2a2bfb22f303131cdb4f460067e0379d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/easy_lock.h @@ -0,0 +1,102 @@ +#ifndef HEADER_CURL_EASY_LOCK_H +#define HEADER_CURL_EASY_LOCK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#define GLOBAL_INIT_IS_THREADSAFE + +#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600 + +#ifdef __MINGW32__ +#ifndef SRWLOCK_INIT +#define SRWLOCK_INIT NULL +#endif +#endif /* __MINGW32__ */ + +#define curl_simple_lock SRWLOCK +#define CURL_SIMPLE_LOCK_INIT SRWLOCK_INIT + +#define curl_simple_lock_lock(m) AcquireSRWLockExclusive(m) +#define curl_simple_lock_unlock(m) ReleaseSRWLockExclusive(m) + +#elif defined(HAVE_ATOMIC) && defined(HAVE_STDATOMIC_H) +#include +#if defined(HAVE_SCHED_YIELD) +#include +#endif + +#define curl_simple_lock atomic_int +#define CURL_SIMPLE_LOCK_INIT 0 + +/* a clang-thing */ +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + +#ifndef __INTEL_COMPILER +/* The Intel compiler tries to look like GCC *and* clang *and* lies in its + __has_builtin() function, so override it. */ + +/* if GCC on i386/x86_64 or if the built-in is present */ +#if ( (defined(__GNUC__) && !defined(__clang__)) && \ + (defined(__i386__) || defined(__x86_64__))) || \ + __has_builtin(__builtin_ia32_pause) +#define HAVE_BUILTIN_IA32_PAUSE +#endif + +#endif + +static inline void curl_simple_lock_lock(curl_simple_lock *lock) +{ + for(;;) { + if(!atomic_exchange_explicit(lock, true, memory_order_acquire)) + break; + /* Reduce cache coherency traffic */ + while(atomic_load_explicit(lock, memory_order_relaxed)) { + /* Reduce load (not mandatory) */ +#ifdef HAVE_BUILTIN_IA32_PAUSE + __builtin_ia32_pause(); +#elif defined(__aarch64__) + __asm__ volatile("yield" ::: "memory"); +#elif defined(HAVE_SCHED_YIELD) + sched_yield(); +#endif + } + } +} + +static inline void curl_simple_lock_unlock(curl_simple_lock *lock) +{ + atomic_store_explicit(lock, false, memory_order_release); +} + +#else + +#undef GLOBAL_INIT_IS_THREADSAFE + +#endif + +#endif /* HEADER_CURL_EASY_LOCK_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/easyif.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/easyif.h new file mode 100644 index 0000000000000000000000000000000000000000..64489529660cbe2c57915996360da044851a1412 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/easyif.h @@ -0,0 +1,41 @@ +#ifndef HEADER_CURL_EASYIF_H +#define HEADER_CURL_EASYIF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* + * Prototypes for library-wide functions provided by easy.c + */ +CURLcode Curl_senddata(struct Curl_easy *data, const void *buffer, + size_t buflen, ssize_t *n); + +#ifdef USE_WEBSOCKETS +CURLcode Curl_connect_only_attach(struct Curl_easy *data); +#endif + +#ifdef CURLDEBUG +CURL_EXTERN CURLcode curl_easy_perform_ev(struct Curl_easy *easy); +#endif + +#endif /* HEADER_CURL_EASYIF_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/easyoptions.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/easyoptions.h new file mode 100644 index 0000000000000000000000000000000000000000..24b4cd93ed9b4d1b7365397a6e4be7e1fb830bab --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/easyoptions.h @@ -0,0 +1,37 @@ +#ifndef HEADER_CURL_EASYOPTIONS_H +#define HEADER_CURL_EASYOPTIONS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* should probably go into the public header */ + +#include + +/* generated table with all easy options */ +extern struct curl_easyoption Curl_easyopts[]; + +#ifdef DEBUGBUILD +int Curl_easyopts_check(void); +#endif +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/escape.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/escape.h new file mode 100644 index 0000000000000000000000000000000000000000..690e4178795a93940138bf02d09ba71de05ff049 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/escape.h @@ -0,0 +1,44 @@ +#ifndef HEADER_CURL_ESCAPE_H +#define HEADER_CURL_ESCAPE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +/* Escape and unescape URL encoding in strings. The functions return a new + * allocated string or NULL if an error occurred. */ + +#include "curl_ctype.h" + +enum urlreject { + REJECT_NADA = 2, + REJECT_CTRL, + REJECT_ZERO +}; + +CURLcode Curl_urldecode(const char *string, size_t length, + char **ostring, size_t *olen, + enum urlreject ctrl); + +void Curl_hexencode(const unsigned char *src, size_t len, /* input length */ + unsigned char *out, size_t olen); /* output buffer size */ + +#endif /* HEADER_CURL_ESCAPE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/file.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/file.h new file mode 100644 index 0000000000000000000000000000000000000000..456552559202fbe6c76d8c0a484c8b954637beb2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/file.h @@ -0,0 +1,42 @@ +#ifndef HEADER_CURL_FILE_H +#define HEADER_CURL_FILE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + + +/**************************************************************************** + * FILE unique setup + ***************************************************************************/ +struct FILEPROTO { + char *path; /* the path we operate on */ + char *freepath; /* pointer to the allocated block we must free, this might + differ from the 'path' pointer */ + int fd; /* open file descriptor to read from! */ +}; + +#ifndef CURL_DISABLE_FILE +extern const struct Curl_handler Curl_handler_file; +#endif + +#endif /* HEADER_CURL_FILE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/fileinfo.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/fileinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..ce009da06dfbe0bf8d628ed0b4befa4a395aa0fa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/fileinfo.h @@ -0,0 +1,40 @@ +#ifndef HEADER_CURL_FILEINFO_H +#define HEADER_CURL_FILEINFO_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include +#include "llist.h" +#include "dynbuf.h" + +struct fileinfo { + struct curl_fileinfo info; + struct Curl_llist_element list; + struct dynbuf buf; +}; + +struct fileinfo *Curl_fileinfo_alloc(void); +void Curl_fileinfo_cleanup(struct fileinfo *finfo); + +#endif /* HEADER_CURL_FILEINFO_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/fopen.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/fopen.h new file mode 100644 index 0000000000000000000000000000000000000000..e3a919d073678a8a5f652f1a2409f75af34a8a28 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/fopen.h @@ -0,0 +1,30 @@ +#ifndef HEADER_CURL_FOPEN_H +#define HEADER_CURL_FOPEN_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +CURLcode Curl_fopen(struct Curl_easy *data, const char *filename, + FILE **fh, char **tempname); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/formdata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/formdata.h new file mode 100644 index 0000000000000000000000000000000000000000..af466249fdb62d4015872c13351de4d41ff66635 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/formdata.h @@ -0,0 +1,59 @@ +#ifndef HEADER_CURL_FORMDATA_H +#define HEADER_CURL_FORMDATA_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifndef CURL_DISABLE_FORM_API + +/* used by FormAdd for temporary storage */ +struct FormInfo { + char *name; + size_t namelength; + char *value; + curl_off_t contentslength; + char *contenttype; + long flags; + char *buffer; /* pointer to existing buffer used for file upload */ + size_t bufferlength; + char *showfilename; /* The file name to show. If not set, the actual + file name will be used */ + char *userp; /* pointer for the read callback */ + struct curl_slist *contentheader; + struct FormInfo *more; + bool name_alloc; + bool value_alloc; + bool contenttype_alloc; + bool showfilename_alloc; +}; + +CURLcode Curl_getformdata(struct Curl_easy *data, + curl_mimepart *, + struct curl_httppost *post, + curl_read_callback fread_func); +#endif /* CURL_DISABLE_FORM_API */ + + +#endif /* HEADER_CURL_FORMDATA_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/ftp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/ftp.h new file mode 100644 index 0000000000000000000000000000000000000000..977fc883b17460fc84c456e6d2ef7d750ab5e9de --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/ftp.h @@ -0,0 +1,167 @@ +#ifndef HEADER_CURL_FTP_H +#define HEADER_CURL_FTP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#include "pingpong.h" + +#ifndef CURL_DISABLE_FTP +extern const struct Curl_handler Curl_handler_ftp; + +#ifdef USE_SSL +extern const struct Curl_handler Curl_handler_ftps; +#endif + +CURLcode Curl_GetFTPResponse(struct Curl_easy *data, ssize_t *nread, + int *ftpcode); +#endif /* CURL_DISABLE_FTP */ + +/**************************************************************************** + * FTP unique setup + ***************************************************************************/ +enum { + FTP_STOP, /* do nothing state, stops the state machine */ + FTP_WAIT220, /* waiting for the initial 220 response immediately after + a connect */ + FTP_AUTH, + FTP_USER, + FTP_PASS, + FTP_ACCT, + FTP_PBSZ, + FTP_PROT, + FTP_CCC, + FTP_PWD, + FTP_SYST, + FTP_NAMEFMT, + FTP_QUOTE, /* waiting for a response to a command sent in a quote list */ + FTP_RETR_PREQUOTE, + FTP_STOR_PREQUOTE, + FTP_POSTQUOTE, + FTP_CWD, /* change dir */ + FTP_MKD, /* if the dir didn't exist */ + FTP_MDTM, /* to figure out the datestamp */ + FTP_TYPE, /* to set type when doing a head-like request */ + FTP_LIST_TYPE, /* set type when about to do a dir list */ + FTP_RETR_TYPE, /* set type when about to RETR a file */ + FTP_STOR_TYPE, /* set type when about to STOR a file */ + FTP_SIZE, /* get the remote file's size for head-like request */ + FTP_RETR_SIZE, /* get the remote file's size for RETR */ + FTP_STOR_SIZE, /* get the size for STOR */ + FTP_REST, /* when used to check if the server supports it in head-like */ + FTP_RETR_REST, /* when asking for "resume" in for RETR */ + FTP_PORT, /* generic state for PORT, LPRT and EPRT, check count1 */ + FTP_PRET, /* generic state for PRET RETR, PRET STOR and PRET LIST/NLST */ + FTP_PASV, /* generic state for PASV and EPSV, check count1 */ + FTP_LIST, /* generic state for LIST, NLST or a custom list command */ + FTP_RETR, + FTP_STOR, /* generic state for STOR and APPE */ + FTP_QUIT, + FTP_LAST /* never used */ +}; +typedef unsigned char ftpstate; /* use the enum values */ + +struct ftp_parselist_data; /* defined later in ftplistparser.c */ + +struct ftp_wc { + struct ftp_parselist_data *parser; + + struct { + curl_write_callback write_function; + FILE *file_descriptor; + } backup; +}; + +typedef enum { + FTPFILE_MULTICWD = 1, /* as defined by RFC1738 */ + FTPFILE_NOCWD = 2, /* use SIZE / RETR / STOR on the full path */ + FTPFILE_SINGLECWD = 3 /* make one CWD, then SIZE / RETR / STOR on the + file */ +} curl_ftpfile; + +/* This FTP struct is used in the Curl_easy. All FTP data that is + connection-oriented must be in FTP_conn to properly deal with the fact that + perhaps the Curl_easy is changed between the times the connection is + used. */ +struct FTP { + char *path; /* points to the urlpieces struct field */ + char *pathalloc; /* if non-NULL a pointer to an allocated path */ + + /* transfer a file/body or not, done as a typedefed enum just to make + debuggers display the full symbol and not just the numerical value */ + curl_pp_transfer transfer; + curl_off_t downloadsize; +}; + + +/* ftp_conn is used for struct connection-oriented data in the connectdata + struct */ +struct ftp_conn { + struct pingpong pp; + char *account; + char *alternative_to_user; + char *entrypath; /* the PWD reply when we logged on */ + char *file; /* url-decoded file name (or path) */ + char **dirs; /* realloc()ed array for path components */ + char *newhost; + char *prevpath; /* url-decoded conn->path from the previous transfer */ + char transfertype; /* set by ftp_transfertype for use by Curl_client_write()a + and others (A/I or zero) */ + curl_off_t retr_size_saved; /* Size of retrieved file saved */ + char *server_os; /* The target server operating system. */ + curl_off_t known_filesize; /* file size is different from -1, if wildcard + LIST parsing was done and wc_statemach set + it */ + int dirdepth; /* number of entries used in the 'dirs' array */ + int cwdcount; /* number of CWD commands issued */ + int count1; /* general purpose counter for the state machine */ + int count2; /* general purpose counter for the state machine */ + int count3; /* general purpose counter for the state machine */ + /* newhost is the (allocated) IP addr or host name to connect the data + connection to */ + unsigned short newport; + ftpstate state; /* always use ftp.c:state() to change state! */ + ftpstate state_saved; /* transfer type saved to be reloaded after data + connection is established */ + unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or + IMAP or POP3 or others! (type: curl_usessl)*/ + unsigned char ccc; /* ccc level for this connection */ + BIT(ftp_trying_alternative); + BIT(dont_check); /* Set to TRUE to prevent the final (post-transfer) + file size and 226/250 status check. It should still + read the line, just ignore the result. */ + BIT(ctl_valid); /* Tells Curl_ftp_quit() whether or not to do anything. If + the connection has timed out or been closed, this + should be FALSE when it gets to Curl_ftp_quit() */ + BIT(cwddone); /* if it has been determined that the proper CWD combo + already has been done */ + BIT(cwdfail); /* set TRUE if a CWD command fails, as then we must prevent + caching the current directory */ + BIT(wait_data_conn); /* this is set TRUE if data connection is waited */ +}; + +#define DEFAULT_ACCEPT_TIMEOUT 60000 /* milliseconds == one minute */ + +#endif /* HEADER_CURL_FTP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/ftplistparser.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/ftplistparser.h new file mode 100644 index 0000000000000000000000000000000000000000..5ba1f6a97d18f52c842d1299635008965fc6754b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/ftplistparser.h @@ -0,0 +1,77 @@ +#ifndef HEADER_CURL_FTPLISTPARSER_H +#define HEADER_CURL_FTPLISTPARSER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifndef CURL_DISABLE_FTP + +/* WRITEFUNCTION callback for parsing LIST responses */ +size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, + void *connptr); + +struct ftp_parselist_data; /* defined inside ftplibparser.c */ + +CURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data); + +struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void); + +void Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data); + +/* list of wildcard process states */ +typedef enum { + CURLWC_CLEAR = 0, + CURLWC_INIT = 1, + CURLWC_MATCHING, /* library is trying to get list of addresses for + downloading */ + CURLWC_DOWNLOADING, + CURLWC_CLEAN, /* deallocate resources and reset settings */ + CURLWC_SKIP, /* skip over concrete file */ + CURLWC_ERROR, /* error cases */ + CURLWC_DONE /* if is wildcard->state == CURLWC_DONE wildcard loop + will end */ +} wildcard_states; + +typedef void (*wildcard_dtor)(void *ptr); + +/* struct keeping information about wildcard download process */ +struct WildcardData { + char *path; /* path to the directory, where we trying wildcard-match */ + char *pattern; /* wildcard pattern */ + struct Curl_llist filelist; /* llist with struct Curl_fileinfo */ + struct ftp_wc *ftpwc; /* pointer to FTP wildcard data */ + wildcard_dtor dtor; + unsigned char state; /* wildcard_states */ +}; + +CURLcode Curl_wildcard_init(struct WildcardData *wc); +void Curl_wildcard_dtor(struct WildcardData **wcp); + +struct Curl_easy; + +#else +/* FTP is disabled */ +#define Curl_wildcard_dtor(x) +#endif /* CURL_DISABLE_FTP */ +#endif /* HEADER_CURL_FTPLISTPARSER_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/functypes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/functypes.h new file mode 100644 index 0000000000000000000000000000000000000000..075c02e54f64f78fb9024dde3f44e7f91917174f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/functypes.h @@ -0,0 +1,115 @@ +#ifndef HEADER_CURL_FUNCTYPES_H +#define HEADER_CURL_FUNCTYPES_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +/* defaults: + + ssize_t recv(int, void *, size_t, int); + ssize_t send(int, const void *, size_t, int); + + If other argument or return types are needed: + + 1. For systems that run configure or cmake, the alternatives are provided + here. + 2. For systems with config-*.h files, define them there. +*/ + +#ifdef WIN32 +/* int recv(SOCKET, char *, int, int) */ +#define RECV_TYPE_ARG1 SOCKET +#define RECV_TYPE_ARG2 char * +#define RECV_TYPE_ARG3 int +#define RECV_TYPE_RETV int + +/* int send(SOCKET, const char *, int, int); */ +#define SEND_TYPE_ARG1 SOCKET +#define SEND_TYPE_ARG2 char * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_RETV int + +#elif defined(__AMIGA__) /* Any AmigaOS flavour */ + +/* long recv(long, char *, long, long); */ +#define RECV_TYPE_ARG1 long +#define RECV_TYPE_ARG2 char * +#define RECV_TYPE_ARG3 long +#define RECV_TYPE_ARG4 long +#define RECV_TYPE_RETV long + +/* int send(int, const char *, int, int); */ +#define SEND_TYPE_ARG1 int +#define SEND_TYPE_ARG2 char * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_RETV int +#endif + + +#ifndef RECV_TYPE_ARG1 +#define RECV_TYPE_ARG1 int +#endif + +#ifndef RECV_TYPE_ARG2 +#define RECV_TYPE_ARG2 void * +#endif + +#ifndef RECV_TYPE_ARG3 +#define RECV_TYPE_ARG3 size_t +#endif + +#ifndef RECV_TYPE_ARG4 +#define RECV_TYPE_ARG4 int +#endif + +#ifndef RECV_TYPE_RETV +#define RECV_TYPE_RETV ssize_t +#endif + +#ifndef SEND_QUAL_ARG2 +#define SEND_QUAL_ARG2 const +#endif + +#ifndef SEND_TYPE_ARG1 +#define SEND_TYPE_ARG1 int +#endif + +#ifndef SEND_TYPE_ARG2 +#define SEND_TYPE_ARG2 void * +#endif + +#ifndef SEND_TYPE_ARG3 +#define SEND_TYPE_ARG3 size_t +#endif + +#ifndef SEND_TYPE_ARG4 +#define SEND_TYPE_ARG4 int +#endif + +#ifndef SEND_TYPE_RETV +#define SEND_TYPE_RETV ssize_t +#endif + +#endif /* HEADER_CURL_FUNCTYPES_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/getinfo.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/getinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..56bb440b43b2febfe89e1fbf1fb79efa9addb83b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/getinfo.h @@ -0,0 +1,29 @@ +#ifndef HEADER_CURL_GETINFO_H +#define HEADER_CURL_GETINFO_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...); +CURLcode Curl_initinfo(struct Curl_easy *data); + +#endif /* HEADER_CURL_GETINFO_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/gopher.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/gopher.h new file mode 100644 index 0000000000000000000000000000000000000000..9e3365b71c25781c0839842d79b24c78e97cfe9e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/gopher.h @@ -0,0 +1,34 @@ +#ifndef HEADER_CURL_GOPHER_H +#define HEADER_CURL_GOPHER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#ifndef CURL_DISABLE_GOPHER +extern const struct Curl_handler Curl_handler_gopher; +#ifdef USE_SSL +extern const struct Curl_handler Curl_handler_gophers; +#endif +#endif + +#endif /* HEADER_CURL_GOPHER_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/hash.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/hash.h new file mode 100644 index 0000000000000000000000000000000000000000..9cfffc25b08a8fb7a0f63315bcd7f2503be17d25 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/hash.h @@ -0,0 +1,102 @@ +#ifndef HEADER_CURL_HASH_H +#define HEADER_CURL_HASH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#include + +#include "llist.h" + +/* Hash function prototype */ +typedef size_t (*hash_function) (void *key, + size_t key_length, + size_t slots_num); + +/* + Comparator function prototype. Compares two keys. +*/ +typedef size_t (*comp_function) (void *key1, + size_t key1_len, + void *key2, + size_t key2_len); + +typedef void (*Curl_hash_dtor)(void *); + +struct Curl_hash { + struct Curl_llist *table; + + /* Hash function to be used for this hash table */ + hash_function hash_func; + + /* Comparator function to compare keys */ + comp_function comp_func; + Curl_hash_dtor dtor; + int slots; + size_t size; +}; + +struct Curl_hash_element { + struct Curl_llist_element list; + void *ptr; + size_t key_len; + char key[1]; /* allocated memory following the struct */ +}; + +struct Curl_hash_iterator { + struct Curl_hash *hash; + int slot_index; + struct Curl_llist_element *current_element; +}; + +void Curl_hash_init(struct Curl_hash *h, + int slots, + hash_function hfunc, + comp_function comparator, + Curl_hash_dtor dtor); + +void *Curl_hash_add(struct Curl_hash *h, void *key, size_t key_len, void *p); +int Curl_hash_delete(struct Curl_hash *h, void *key, size_t key_len); +void *Curl_hash_pick(struct Curl_hash *, void *key, size_t key_len); +void Curl_hash_apply(struct Curl_hash *h, void *user, + void (*cb)(void *user, void *ptr)); +#define Curl_hash_count(h) ((h)->size) +void Curl_hash_destroy(struct Curl_hash *h); +void Curl_hash_clean(struct Curl_hash *h); +void Curl_hash_clean_with_criterium(struct Curl_hash *h, void *user, + int (*comp)(void *, void *)); +size_t Curl_hash_str(void *key, size_t key_length, size_t slots_num); +size_t Curl_str_key_compare(void *k1, size_t key1_len, void *k2, + size_t key2_len); +void Curl_hash_start_iterate(struct Curl_hash *hash, + struct Curl_hash_iterator *iter); +struct Curl_hash_element * +Curl_hash_next_element(struct Curl_hash_iterator *iter); + +void Curl_hash_print(struct Curl_hash *h, + void (*func)(void *)); + + +#endif /* HEADER_CURL_HASH_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/headers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/headers.h new file mode 100644 index 0000000000000000000000000000000000000000..a5229ea22f0a512f0b9dc2b78fa7ece56dc3a4f5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/headers.h @@ -0,0 +1,55 @@ +#ifndef HEADER_CURL_HEADER_H +#define HEADER_CURL_HEADER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_HEADERS_API) + +struct Curl_header_store { + struct Curl_llist_element node; + char *name; /* points into 'buffer' */ + char *value; /* points into 'buffer */ + int request; /* 0 is the first request, then 1.. 2.. */ + unsigned char type; /* CURLH_* defines */ + char buffer[1]; /* this is the raw header blob */ +}; + +/* + * Curl_headers_push() gets passed a full header to store. + */ +CURLcode Curl_headers_push(struct Curl_easy *data, const char *header, + unsigned char type); + +/* + * Curl_headers_cleanup(). Free all stored headers and associated memory. + */ +CURLcode Curl_headers_cleanup(struct Curl_easy *data); + +#else +#define Curl_headers_push(x,y,z) CURLE_OK +#define Curl_headers_cleanup(x) Curl_nop_stmt +#endif + +#endif /* HEADER_CURL_HEADER_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/hostip.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/hostip.h new file mode 100644 index 0000000000000000000000000000000000000000..b68f539b2df94e6f2b4c490242e096da53a238e9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/hostip.h @@ -0,0 +1,225 @@ +#ifndef HEADER_CURL_HOSTIP_H +#define HEADER_CURL_HOSTIP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include "hash.h" +#include "curl_addrinfo.h" +#include "timeval.h" /* for timediff_t */ +#include "asyn.h" + +#include + +/* Allocate enough memory to hold the full name information structs and + * everything. OSF1 is known to require at least 8872 bytes. The buffer + * required for storing all possible aliases and IP numbers is according to + * Stevens' Unix Network Programming 2nd edition, p. 304: 8192 bytes! + */ +#define CURL_HOSTENT_SIZE 9000 + +#define CURL_TIMEOUT_RESOLVE 300 /* when using asynch methods, we allow this + many seconds for a name resolve */ + +#define CURL_ASYNC_SUCCESS CURLE_OK + +struct addrinfo; +struct hostent; +struct Curl_easy; +struct connectdata; + +/* + * Curl_global_host_cache_init() initializes and sets up a global DNS cache. + * Global DNS cache is general badness. Do not use. This will be removed in + * a future version. Use the share interface instead! + * + * Returns a struct Curl_hash pointer on success, NULL on failure. + */ +struct Curl_hash *Curl_global_host_cache_init(void); + +struct Curl_dns_entry { + struct Curl_addrinfo *addr; + /* timestamp == 0 -- permanent CURLOPT_RESOLVE entry (doesn't time out) */ + time_t timestamp; + /* use-counter, use Curl_resolv_unlock to release reference */ + long inuse; +}; + +bool Curl_host_is_ipnum(const char *hostname); + +/* + * Curl_resolv() returns an entry with the info for the specified host + * and port. + * + * The returned data *MUST* be "unlocked" with Curl_resolv_unlock() after + * use, or we'll leak memory! + */ +/* return codes */ +enum resolve_t { + CURLRESOLV_TIMEDOUT = -2, + CURLRESOLV_ERROR = -1, + CURLRESOLV_RESOLVED = 0, + CURLRESOLV_PENDING = 1 +}; +enum resolve_t Curl_resolv(struct Curl_easy *data, + const char *hostname, + int port, + bool allowDOH, + struct Curl_dns_entry **dnsentry); +enum resolve_t Curl_resolv_timeout(struct Curl_easy *data, + const char *hostname, int port, + struct Curl_dns_entry **dnsentry, + timediff_t timeoutms); + +#ifdef ENABLE_IPV6 +/* + * Curl_ipv6works() returns TRUE if IPv6 seems to work. + */ +bool Curl_ipv6works(struct Curl_easy *data); +#else +#define Curl_ipv6works(x) FALSE +#endif + +/* + * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've + * been set and returns TRUE if they are OK. + */ +bool Curl_ipvalid(struct Curl_easy *data, struct connectdata *conn); + + +/* + * Curl_getaddrinfo() is the generic low-level name resolve API within this + * source file. There are several versions of this function - for different + * name resolve layers (selected at build-time). They all take this same set + * of arguments + */ +struct Curl_addrinfo *Curl_getaddrinfo(struct Curl_easy *data, + const char *hostname, + int port, + int *waitp); + + +/* unlock a previously resolved dns entry */ +void Curl_resolv_unlock(struct Curl_easy *data, + struct Curl_dns_entry *dns); + +/* init a new dns cache */ +void Curl_init_dnscache(struct Curl_hash *hash, int hashsize); + +/* prune old entries from the DNS cache */ +void Curl_hostcache_prune(struct Curl_easy *data); + +/* IPv4 threadsafe resolve function used for synch and asynch builds */ +struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, int port); + +CURLcode Curl_once_resolved(struct Curl_easy *data, bool *protocol_connect); + +/* + * Curl_addrinfo_callback() is used when we build with any asynch specialty. + * Handles end of async request processing. Inserts ai into hostcache when + * status is CURL_ASYNC_SUCCESS. Twiddles fields in conn to indicate async + * request completed whether successful or failed. + */ +CURLcode Curl_addrinfo_callback(struct Curl_easy *data, + int status, + struct Curl_addrinfo *ai); + +/* + * Curl_printable_address() returns a printable version of the 1st address + * given in the 'ip' argument. The result will be stored in the buf that is + * bufsize bytes big. + */ +void Curl_printable_address(const struct Curl_addrinfo *ip, + char *buf, size_t bufsize); + +/* + * Curl_fetch_addr() fetches a 'Curl_dns_entry' already in the DNS cache. + * + * Returns the Curl_dns_entry entry pointer or NULL if not in the cache. + * + * The returned data *MUST* be "unlocked" with Curl_resolv_unlock() after + * use, or we'll leak memory! + */ +struct Curl_dns_entry * +Curl_fetch_addr(struct Curl_easy *data, + const char *hostname, + int port); + +/* + * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache. + * + * Returns the Curl_dns_entry entry pointer or NULL if the storage failed. + */ +struct Curl_dns_entry * +Curl_cache_addr(struct Curl_easy *data, struct Curl_addrinfo *addr, + const char *hostname, size_t hostlen, int port); + +#ifndef INADDR_NONE +#define CURL_INADDR_NONE (in_addr_t) ~0 +#else +#define CURL_INADDR_NONE INADDR_NONE +#endif + +/* + * Function provided by the resolver backend to set DNS servers to use. + */ +CURLcode Curl_set_dns_servers(struct Curl_easy *data, char *servers); + +/* + * Function provided by the resolver backend to set + * outgoing interface to use for DNS requests + */ +CURLcode Curl_set_dns_interface(struct Curl_easy *data, + const char *interf); + +/* + * Function provided by the resolver backend to set + * local IPv4 address to use as source address for DNS requests + */ +CURLcode Curl_set_dns_local_ip4(struct Curl_easy *data, + const char *local_ip4); + +/* + * Function provided by the resolver backend to set + * local IPv6 address to use as source address for DNS requests + */ +CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data, + const char *local_ip6); + +/* + * Clean off entries from the cache + */ +void Curl_hostcache_clean(struct Curl_easy *data, struct Curl_hash *hash); + +/* + * Populate the cache with specified entries from CURLOPT_RESOLVE. + */ +CURLcode Curl_loadhostpairs(struct Curl_easy *data); +CURLcode Curl_resolv_check(struct Curl_easy *data, + struct Curl_dns_entry **dns); +int Curl_resolv_getsock(struct Curl_easy *data, + curl_socket_t *socks); + +CURLcode Curl_resolver_error(struct Curl_easy *data); +#endif /* HEADER_CURL_HOSTIP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/hsts.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/hsts.h new file mode 100644 index 0000000000000000000000000000000000000000..d3431a5d7a3a3efd01e3b917f5d955557eba2388 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/hsts.h @@ -0,0 +1,69 @@ +#ifndef HEADER_CURL_HSTS_H +#define HEADER_CURL_HSTS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_HSTS) +#include +#include "llist.h" + +#ifdef DEBUGBUILD +extern time_t deltatime; +#endif + +struct stsentry { + struct Curl_llist_element node; + const char *host; + bool includeSubDomains; + curl_off_t expires; /* the timestamp of this entry's expiry */ +}; + +/* The HSTS cache. Needs to be able to tailmatch host names. */ +struct hsts { + struct Curl_llist list; + char *filename; + unsigned int flags; +}; + +struct hsts *Curl_hsts_init(void); +void Curl_hsts_cleanup(struct hsts **hp); +CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname, + const char *sts); +struct stsentry *Curl_hsts(struct hsts *h, const char *hostname, + bool subdomain); +CURLcode Curl_hsts_save(struct Curl_easy *data, struct hsts *h, + const char *file); +CURLcode Curl_hsts_loadfile(struct Curl_easy *data, + struct hsts *h, const char *file); +CURLcode Curl_hsts_loadcb(struct Curl_easy *data, + struct hsts *h); +void Curl_hsts_loadfiles(struct Curl_easy *data); +#else +#define Curl_hsts_cleanup(x) +#define Curl_hsts_loadcb(x,y) CURLE_OK +#define Curl_hsts_save(x,y,z) +#define Curl_hsts_loadfiles(x) +#endif /* CURL_DISABLE_HTTP || CURL_DISABLE_HSTS */ +#endif /* HEADER_CURL_HSTS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http.h new file mode 100644 index 0000000000000000000000000000000000000000..9ee3c6537cedf5a511f24afc0a55e35570dccbd7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http.h @@ -0,0 +1,333 @@ +#ifndef HEADER_CURL_HTTP_H +#define HEADER_CURL_HTTP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#if defined(USE_MSH3) && !defined(_WIN32) +#include +#endif + +#include "bufq.h" +#include "dynhds.h" +#include "ws.h" + +typedef enum { + HTTPREQ_GET, + HTTPREQ_POST, + HTTPREQ_POST_FORM, /* we make a difference internally */ + HTTPREQ_POST_MIME, /* we make a difference internally */ + HTTPREQ_PUT, + HTTPREQ_HEAD +} Curl_HttpReq; + +#ifndef CURL_DISABLE_HTTP + +#if defined(ENABLE_QUIC) +#include +#endif + +extern const struct Curl_handler Curl_handler_http; + +#ifdef USE_SSL +extern const struct Curl_handler Curl_handler_https; +#endif + +#ifdef USE_WEBSOCKETS +extern const struct Curl_handler Curl_handler_ws; + +#ifdef USE_SSL +extern const struct Curl_handler Curl_handler_wss; +#endif +#endif /* websockets */ + +struct dynhds; + +CURLcode Curl_bump_headersize(struct Curl_easy *data, + size_t delta, + bool connect_only); + +/* Header specific functions */ +bool Curl_compareheader(const char *headerline, /* line to check */ + const char *header, /* header keyword _with_ colon */ + const size_t hlen, /* len of the keyword in bytes */ + const char *content, /* content string to find */ + const size_t clen); /* len of the content in bytes */ + +char *Curl_copy_header_value(const char *header); + +char *Curl_checkProxyheaders(struct Curl_easy *data, + const struct connectdata *conn, + const char *thisheader, + const size_t thislen); +struct HTTP; /* see below */ +CURLcode Curl_buffer_send(struct dynbuf *in, + struct Curl_easy *data, + struct HTTP *http, + curl_off_t *bytes_written, + curl_off_t included_body_bytes, + int socketindex); + +CURLcode Curl_add_timecondition(struct Curl_easy *data, +#ifndef USE_HYPER + struct dynbuf *req +#else + void *headers +#endif + ); +CURLcode Curl_add_custom_headers(struct Curl_easy *data, + bool is_connect, +#ifndef USE_HYPER + struct dynbuf *req +#else + void *headers +#endif + ); +CURLcode Curl_dynhds_add_custom(struct Curl_easy *data, + bool is_connect, + struct dynhds *hds); + +CURLcode Curl_http_compile_trailers(struct curl_slist *trailers, + struct dynbuf *buf, + struct Curl_easy *handle); + +void Curl_http_method(struct Curl_easy *data, struct connectdata *conn, + const char **method, Curl_HttpReq *); +CURLcode Curl_http_useragent(struct Curl_easy *data); +CURLcode Curl_http_host(struct Curl_easy *data, struct connectdata *conn); +CURLcode Curl_http_target(struct Curl_easy *data, struct connectdata *conn, + struct dynbuf *req); +CURLcode Curl_http_statusline(struct Curl_easy *data, + struct connectdata *conn); +CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn, + char *headp); +CURLcode Curl_transferencode(struct Curl_easy *data); +CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn, + Curl_HttpReq httpreq, + const char **teep); +CURLcode Curl_http_bodysend(struct Curl_easy *data, struct connectdata *conn, + struct dynbuf *r, Curl_HttpReq httpreq); +bool Curl_use_http_1_1plus(const struct Curl_easy *data, + const struct connectdata *conn); +#ifndef CURL_DISABLE_COOKIES +CURLcode Curl_http_cookies(struct Curl_easy *data, + struct connectdata *conn, + struct dynbuf *r); +#else +#define Curl_http_cookies(a,b,c) CURLE_OK +#endif +CURLcode Curl_http_resume(struct Curl_easy *data, + struct connectdata *conn, + Curl_HttpReq httpreq); +CURLcode Curl_http_range(struct Curl_easy *data, + Curl_HttpReq httpreq); +CURLcode Curl_http_firstwrite(struct Curl_easy *data, + struct connectdata *conn, + bool *done); + +/* protocol-specific functions set up to be called by the main engine */ +CURLcode Curl_http(struct Curl_easy *data, bool *done); +CURLcode Curl_http_done(struct Curl_easy *data, CURLcode, bool premature); +CURLcode Curl_http_connect(struct Curl_easy *data, bool *done); + +/* These functions are in http.c */ +CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy, + const char *auth); +CURLcode Curl_http_auth_act(struct Curl_easy *data); + +/* If only the PICKNONE bit is set, there has been a round-trip and we + selected to use no auth at all. Ie, we actively select no auth, as opposed + to not having one selected. The other CURLAUTH_* defines are present in the + public curl/curl.h header. */ +#define CURLAUTH_PICKNONE (1<<30) /* don't use auth */ + +/* MAX_INITIAL_POST_SIZE indicates the number of bytes that will make the POST + data get included in the initial data chunk sent to the server. If the + data is larger than this, it will automatically get split up in multiple + system calls. + + This value used to be fairly big (100K), but we must take into account that + if the server rejects the POST due for authentication reasons, this data + will always be unconditionally sent and thus it may not be larger than can + always be afforded to send twice. + + It must not be greater than 64K to work on VMS. +*/ +#ifndef MAX_INITIAL_POST_SIZE +#define MAX_INITIAL_POST_SIZE (64*1024) +#endif + +/* EXPECT_100_THRESHOLD is the request body size limit for when libcurl will + * automatically add an "Expect: 100-continue" header in HTTP requests. When + * the size is unknown, it will always add it. + * + */ +#ifndef EXPECT_100_THRESHOLD +#define EXPECT_100_THRESHOLD (1024*1024) +#endif + +/* MAX_HTTP_RESP_HEADER_SIZE is the maximum size of all response headers + combined that libcurl allows for a single HTTP response, any HTTP + version. This count includes CONNECT response headers. */ +#define MAX_HTTP_RESP_HEADER_SIZE (300*1024) + +#endif /* CURL_DISABLE_HTTP */ + +/**************************************************************************** + * HTTP unique setup + ***************************************************************************/ +struct HTTP { + curl_off_t postsize; /* off_t to handle large file sizes */ + const char *postdata; + struct back { + curl_read_callback fread_func; /* backup storage for fread pointer */ + void *fread_in; /* backup storage for fread_in pointer */ + const char *postdata; + curl_off_t postsize; + struct Curl_easy *data; + } backup; + + enum { + HTTPSEND_NADA, /* init */ + HTTPSEND_REQUEST, /* sending a request */ + HTTPSEND_BODY /* sending body */ + } sending; + +#ifndef CURL_DISABLE_HTTP + void *h2_ctx; /* HTTP/2 implementation context */ + void *h3_ctx; /* HTTP/3 implementation context */ + struct dynbuf send_buffer; /* used if the request couldn't be sent in one + chunk, points to an allocated send_buffer + struct */ +#endif +}; + +CURLcode Curl_http_size(struct Curl_easy *data); + +CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, + struct connectdata *conn, + ssize_t *nread, + bool *stop_reading); + +/** + * Curl_http_output_auth() setups the authentication headers for the + * host/proxy and the correct authentication + * method. data->state.authdone is set to TRUE when authentication is + * done. + * + * @param data all information about the current transfer + * @param conn all information about the current connection + * @param request pointer to the request keyword + * @param httpreq is the request type + * @param path pointer to the requested path + * @param proxytunnel boolean if this is the request setting up a "proxy + * tunnel" + * + * @returns CURLcode + */ +CURLcode +Curl_http_output_auth(struct Curl_easy *data, + struct connectdata *conn, + const char *request, + Curl_HttpReq httpreq, + const char *path, + bool proxytunnel); /* TRUE if this is the request setting + up the proxy tunnel */ + +/* Decode HTTP status code string. */ +CURLcode Curl_http_decode_status(int *pstatus, const char *s, size_t len); + + +/** + * All about a core HTTP request, excluding body and trailers + */ +struct httpreq { + char method[12]; + char *scheme; + char *authority; + char *path; + struct dynhds headers; + struct dynhds trailers; +}; + +/** + * Create a HTTP request struct. + */ +CURLcode Curl_http_req_make(struct httpreq **preq, + const char *method, size_t m_len, + const char *scheme, size_t s_len, + const char *authority, size_t a_len, + const char *path, size_t p_len); + +CURLcode Curl_http_req_make2(struct httpreq **preq, + const char *method, size_t m_len, + CURLU *url, const char *scheme_default); + +void Curl_http_req_free(struct httpreq *req); + +#define HTTP_PSEUDO_METHOD ":method" +#define HTTP_PSEUDO_SCHEME ":scheme" +#define HTTP_PSEUDO_AUTHORITY ":authority" +#define HTTP_PSEUDO_PATH ":path" +#define HTTP_PSEUDO_STATUS ":status" + +/** + * Create the list of HTTP/2 headers which represent the request, + * using HTTP/2 pseudo headers preceding the `req->headers`. + * + * Applies the following transformations: + * - if `authority` is set, any "Host" header is removed. + * - if `authority` is unset and a "Host" header is present, use + * that as `authority` and remove "Host" + * - removes and Connection header fields as defined in rfc9113 ch. 8.2.2 + * - lower-cases the header field names + * + * @param h2_headers will contain the HTTP/2 headers on success + * @param req the request to transform + * @param data the handle to lookup defaults like ' :scheme' from + */ +CURLcode Curl_http_req_to_h2(struct dynhds *h2_headers, + struct httpreq *req, struct Curl_easy *data); + +/** + * All about a core HTTP response, excluding body and trailers + */ +struct http_resp { + int status; + char *description; + struct dynhds headers; + struct dynhds trailers; + struct http_resp *prev; +}; + +/** + * Create a HTTP response struct. + */ +CURLcode Curl_http_resp_make(struct http_resp **presp, + int status, + const char *description); + +void Curl_http_resp_free(struct http_resp *resp); + +#endif /* HEADER_CURL_HTTP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http1.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http1.h new file mode 100644 index 0000000000000000000000000000000000000000..2de302f1f6c871453043e3b7c40beeb7b36acad9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http1.h @@ -0,0 +1,63 @@ +#ifndef HEADER_CURL_HTTP1_H +#define HEADER_CURL_HTTP1_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifndef CURL_DISABLE_HTTP +#include "bufq.h" +#include "http.h" + +#define H1_PARSE_OPT_NONE (0) +#define H1_PARSE_OPT_STRICT (1 << 0) + +#define H1_PARSE_DEFAULT_MAX_LINE_LEN DYN_HTTP_REQUEST + +struct h1_req_parser { + struct httpreq *req; + struct dynbuf scratch; + size_t scratch_skip; + const char *line; + size_t max_line_len; + size_t line_len; + bool done; +}; + +void Curl_h1_req_parse_init(struct h1_req_parser *parser, size_t max_line_len); +void Curl_h1_req_parse_free(struct h1_req_parser *parser); + +ssize_t Curl_h1_req_parse_read(struct h1_req_parser *parser, + const char *buf, size_t buflen, + const char *scheme_default, int options, + CURLcode *err); + +CURLcode Curl_h1_req_dprint(const struct httpreq *req, + struct dynbuf *dbuf); + +CURLcode Curl_h1_req_write_head(struct httpreq *req, int http_minor, + struct dynbuf *dbuf); + +#endif /* !CURL_DISABLE_HTTP */ +#endif /* HEADER_CURL_HTTP1_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http2.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http2.h new file mode 100644 index 0000000000000000000000000000000000000000..80e183480a70dc1a2880247f5d6f29be67d92b89 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http2.h @@ -0,0 +1,77 @@ +#ifndef HEADER_CURL_HTTP2_H +#define HEADER_CURL_HTTP2_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_NGHTTP2 +#include "http.h" + +/* value for MAX_CONCURRENT_STREAMS we use until we get an updated setting + from the peer */ +#define DEFAULT_MAX_CONCURRENT_STREAMS 100 + +/* + * Store nghttp2 version info in this buffer. + */ +void Curl_http2_ver(char *p, size_t len); + +CURLcode Curl_http2_request_upgrade(struct dynbuf *req, + struct Curl_easy *data); + +/* returns true if the HTTP/2 stream error was HTTP_1_1_REQUIRED */ +bool Curl_h2_http_1_1_error(struct Curl_easy *data); + +bool Curl_conn_is_http2(const struct Curl_easy *data, + const struct connectdata *conn, + int sockindex); +bool Curl_http2_may_switch(struct Curl_easy *data, + struct connectdata *conn, + int sockindex); + +CURLcode Curl_http2_switch(struct Curl_easy *data, + struct connectdata *conn, int sockindex); + +CURLcode Curl_http2_switch_at(struct Curl_cfilter *cf, struct Curl_easy *data); + +CURLcode Curl_http2_upgrade(struct Curl_easy *data, + struct connectdata *conn, int sockindex, + const char *ptr, size_t nread); + +extern struct Curl_cftype Curl_cft_nghttp2; + +#else /* USE_NGHTTP2 */ + +#define Curl_cf_is_http2(a,b) FALSE +#define Curl_conn_is_http2(a,b,c) FALSE +#define Curl_http2_may_switch(a,b,c) FALSE + +#define Curl_http2_request_upgrade(x,y) CURLE_UNSUPPORTED_PROTOCOL +#define Curl_http2_switch(a,b,c) CURLE_UNSUPPORTED_PROTOCOL +#define Curl_http2_upgrade(a,b,c,d,e) CURLE_UNSUPPORTED_PROTOCOL +#define Curl_h2_http_1_1_error(x) 0 +#endif + +#endif /* HEADER_CURL_HTTP2_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_aws_sigv4.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_aws_sigv4.h new file mode 100644 index 0000000000000000000000000000000000000000..57cc5706eba3d94336ecb2952193c94f0f17169e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_aws_sigv4.h @@ -0,0 +1,31 @@ +#ifndef HEADER_CURL_HTTP_AWS_SIGV4_H +#define HEADER_CURL_HTTP_AWS_SIGV4_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +/* this is for creating aws_sigv4 header output */ +CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy); + +#endif /* HEADER_CURL_HTTP_AWS_SIGV4_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_chunks.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_chunks.h new file mode 100644 index 0000000000000000000000000000000000000000..ed50713162cba78374f45874f77a58219db6f020 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_chunks.h @@ -0,0 +1,100 @@ +#ifndef HEADER_CURL_HTTP_CHUNKS_H +#define HEADER_CURL_HTTP_CHUNKS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +struct connectdata; + +/* + * The longest possible hexadecimal number we support in a chunked transfer. + * Neither RFC2616 nor the later HTTP specs define a maximum chunk size. + * For 64 bit curl_off_t we support 16 digits. For 32 bit, 8 digits. + */ +#define CHUNK_MAXNUM_LEN (SIZEOF_CURL_OFF_T * 2) + +typedef enum { + /* await and buffer all hexadecimal digits until we get one that isn't a + hexadecimal digit. When done, we go CHUNK_LF */ + CHUNK_HEX, + + /* wait for LF, ignore all else */ + CHUNK_LF, + + /* We eat the amount of data specified. When done, we move on to the + POST_CR state. */ + CHUNK_DATA, + + /* POSTLF should get a CR and then a LF and nothing else, then move back to + HEX as the CRLF combination marks the end of a chunk. A missing CR is no + big deal. */ + CHUNK_POSTLF, + + /* Used to mark that we're out of the game. NOTE: that there's a 'datasize' + field in the struct that will tell how many bytes that were not passed to + the client in the end of the last buffer! */ + CHUNK_STOP, + + /* At this point optional trailer headers can be found, unless the next line + is CRLF */ + CHUNK_TRAILER, + + /* A trailer CR has been found - next state is CHUNK_TRAILER_POSTCR. + Next char must be a LF */ + CHUNK_TRAILER_CR, + + /* A trailer LF must be found now, otherwise CHUNKE_BAD_CHUNK will be + signalled If this is an empty trailer CHUNKE_STOP will be signalled. + Otherwise the trailer will be broadcasted via Curl_client_write() and the + next state will be CHUNK_TRAILER */ + CHUNK_TRAILER_POSTCR +} ChunkyState; + +typedef enum { + CHUNKE_STOP = -1, + CHUNKE_OK = 0, + CHUNKE_TOO_LONG_HEX = 1, + CHUNKE_ILLEGAL_HEX, + CHUNKE_BAD_CHUNK, + CHUNKE_BAD_ENCODING, + CHUNKE_OUT_OF_MEMORY, + CHUNKE_PASSTHRU_ERROR, /* Curl_httpchunk_read() returns a CURLcode to use */ + CHUNKE_LAST +} CHUNKcode; + +const char *Curl_chunked_strerror(CHUNKcode code); + +struct Curl_chunker { + curl_off_t datasize; + ChunkyState state; + unsigned char hexindex; + char hexbuffer[ CHUNK_MAXNUM_LEN + 1]; /* +1 for null-terminator */ +}; + +/* The following functions are defined in http_chunks.c */ +void Curl_httpchunk_init(struct Curl_easy *data); +CHUNKcode Curl_httpchunk_read(struct Curl_easy *data, char *datap, + ssize_t length, ssize_t *wrote, + CURLcode *passthru); + +#endif /* HEADER_CURL_HTTP_CHUNKS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_digest.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_digest.h new file mode 100644 index 0000000000000000000000000000000000000000..5f797310fd9c507627429bebf5f4a1a596190de8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_digest.h @@ -0,0 +1,44 @@ +#ifndef HEADER_CURL_HTTP_DIGEST_H +#define HEADER_CURL_HTTP_DIGEST_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_DIGEST_AUTH) + +/* this is for digest header input */ +CURLcode Curl_input_digest(struct Curl_easy *data, + bool proxy, const char *header); + +/* this is for creating digest header output */ +CURLcode Curl_output_digest(struct Curl_easy *data, + bool proxy, + const unsigned char *request, + const unsigned char *uripath); + +void Curl_http_auth_cleanup_digest(struct Curl_easy *data); + +#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_DIGEST_AUTH */ + +#endif /* HEADER_CURL_HTTP_DIGEST_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_negotiate.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_negotiate.h new file mode 100644 index 0000000000000000000000000000000000000000..76d8356132d8b7c1364bb2c6b3e4c343bfaf076c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_negotiate.h @@ -0,0 +1,43 @@ +#ifndef HEADER_CURL_HTTP_NEGOTIATE_H +#define HEADER_CURL_HTTP_NEGOTIATE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#if !defined(CURL_DISABLE_HTTP) && defined(USE_SPNEGO) + +/* this is for Negotiate header input */ +CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn, + bool proxy, const char *header); + +/* this is for creating Negotiate header output */ +CURLcode Curl_output_negotiate(struct Curl_easy *data, + struct connectdata *conn, bool proxy); + +void Curl_http_auth_cleanup_negotiate(struct connectdata *conn); + +#else /* !CURL_DISABLE_HTTP && USE_SPNEGO */ +#define Curl_http_auth_cleanup_negotiate(x) +#endif + +#endif /* HEADER_CURL_HTTP_NEGOTIATE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_ntlm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_ntlm.h new file mode 100644 index 0000000000000000000000000000000000000000..f37572baecbac10a3a5c7e44451a003f416e47c3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_ntlm.h @@ -0,0 +1,44 @@ +#ifndef HEADER_CURL_HTTP_NTLM_H +#define HEADER_CURL_HTTP_NTLM_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) + +/* this is for ntlm header input */ +CURLcode Curl_input_ntlm(struct Curl_easy *data, bool proxy, + const char *header); + +/* this is for creating ntlm header output */ +CURLcode Curl_output_ntlm(struct Curl_easy *data, bool proxy); + +void Curl_http_auth_cleanup_ntlm(struct connectdata *conn); + +#else /* !CURL_DISABLE_HTTP && USE_NTLM */ +#define Curl_http_auth_cleanup_ntlm(x) +#endif + +#endif /* HEADER_CURL_HTTP_NTLM_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_proxy.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_proxy.h new file mode 100644 index 0000000000000000000000000000000000000000..2b5f7ae706412d3b2e11654f02ec33173f53d264 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/http_proxy.h @@ -0,0 +1,61 @@ +#ifndef HEADER_CURL_HTTP_PROXY_H +#define HEADER_CURL_HTTP_PROXY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP) + +#include "urldata.h" + +CURLcode Curl_http_proxy_get_destination(struct Curl_cfilter *cf, + const char **phostname, + int *pport, bool *pipv6_ip); + +CURLcode Curl_http_proxy_create_CONNECT(struct httpreq **preq, + struct Curl_cfilter *cf, + struct Curl_easy *data, + int http_version_major); + +/* Default proxy timeout in milliseconds */ +#define PROXY_TIMEOUT (3600*1000) + +void Curl_cf_http_proxy_get_host(struct Curl_cfilter *cf, + struct Curl_easy *data, + const char **phost, + const char **pdisplay_host, + int *pport); + +CURLcode Curl_cf_http_proxy_insert_after(struct Curl_cfilter *cf_at, + struct Curl_easy *data); + +extern struct Curl_cftype Curl_cft_http_proxy; + +#endif /* !CURL_DISABLE_PROXY && !CURL_DISABLE_HTTP */ + +#define IS_HTTPS_PROXY(t) (((t) == CURLPROXY_HTTPS) || \ + ((t) == CURLPROXY_HTTPS2)) + +#endif /* HEADER_CURL_HTTP_PROXY_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/idn.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/idn.h new file mode 100644 index 0000000000000000000000000000000000000000..74bbcaf4980d041a861a838c8ee1a62e36fe0521 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/idn.h @@ -0,0 +1,44 @@ +#ifndef HEADER_CURL_IDN_H +#define HEADER_CURL_IDN_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +bool Curl_is_ASCII_name(const char *hostname); +CURLcode Curl_idnconvert_hostname(struct hostname *host); +#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) +#define USE_IDN +void Curl_free_idnconverted_hostname(struct hostname *host); +CURLcode Curl_idn_decode(const char *input, char **output); +CURLcode Curl_idn_encode(const char *input, char **output); +#ifdef USE_LIBIDN2 +#define Curl_idn_free(x) idn2_free(x) +#else +#define Curl_idn_free(x) free(x) +#endif + +#else +#define Curl_free_idnconverted_hostname(x) +#define Curl_idn_decode(x) NULL +#endif +#endif /* HEADER_CURL_IDN_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/if2ip.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/if2ip.h new file mode 100644 index 0000000000000000000000000000000000000000..1f973505c08df772518fb8664b3d93ca2d830061 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/if2ip.h @@ -0,0 +1,92 @@ +#ifndef HEADER_CURL_IF2IP_H +#define HEADER_CURL_IF2IP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +/* IPv6 address scopes. */ +#define IPV6_SCOPE_GLOBAL 0 /* Global scope. */ +#define IPV6_SCOPE_LINKLOCAL 1 /* Link-local scope. */ +#define IPV6_SCOPE_SITELOCAL 2 /* Site-local scope (deprecated). */ +#define IPV6_SCOPE_UNIQUELOCAL 3 /* Unique local */ +#define IPV6_SCOPE_NODELOCAL 4 /* Loopback. */ + +#ifdef ENABLE_IPV6 +unsigned int Curl_ipv6_scope(const struct sockaddr *sa); +#else +#define Curl_ipv6_scope(x) 0 +#endif + +typedef enum { + IF2IP_NOT_FOUND = 0, /* Interface not found */ + IF2IP_AF_NOT_SUPPORTED = 1, /* Int. exists but has no address for this af */ + IF2IP_FOUND = 2 /* The address has been stored in "buf" */ +} if2ip_result_t; + +if2ip_result_t Curl_if2ip(int af, +#ifdef ENABLE_IPV6 + unsigned int remote_scope, + unsigned int local_scope_id, +#endif + const char *interf, + char *buf, int buf_size); + +#ifdef __INTERIX + +/* Nedelcho Stanev's work-around for SFU 3.0 */ +struct ifreq { +#define IFNAMSIZ 16 +#define IFHWADDRLEN 6 + union { + char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + } ifr_ifrn; + + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short ifru_flags; + int ifru_metric; + int ifru_mtu; + } ifr_ifru; +}; + +/* This define was added by Daniel to avoid an extra #ifdef INTERIX in the + C code. */ + +#define ifr_name ifr_ifrn.ifrn_name /* interface name */ +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ + +#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */ + +#endif /* __INTERIX */ + +#endif /* HEADER_CURL_IF2IP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/imap.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/imap.h new file mode 100644 index 0000000000000000000000000000000000000000..784ee97e550618f8ee5bc16a689fae12211d2f60 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/imap.h @@ -0,0 +1,101 @@ +#ifndef HEADER_CURL_IMAP_H +#define HEADER_CURL_IMAP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "pingpong.h" +#include "curl_sasl.h" + +/**************************************************************************** + * IMAP unique setup + ***************************************************************************/ +typedef enum { + IMAP_STOP, /* do nothing state, stops the state machine */ + IMAP_SERVERGREET, /* waiting for the initial greeting immediately after + a connect */ + IMAP_CAPABILITY, + IMAP_STARTTLS, + IMAP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS + (multi mode only) */ + IMAP_AUTHENTICATE, + IMAP_LOGIN, + IMAP_LIST, + IMAP_SELECT, + IMAP_FETCH, + IMAP_FETCH_FINAL, + IMAP_APPEND, + IMAP_APPEND_FINAL, + IMAP_SEARCH, + IMAP_LOGOUT, + IMAP_LAST /* never used */ +} imapstate; + +/* This IMAP struct is used in the Curl_easy. All IMAP data that is + connection-oriented must be in imap_conn to properly deal with the fact that + perhaps the Curl_easy is changed between the times the connection is + used. */ +struct IMAP { + curl_pp_transfer transfer; + char *mailbox; /* Mailbox to select */ + char *uidvalidity; /* UIDVALIDITY to check in select */ + char *uid; /* Message UID to fetch */ + char *mindex; /* Index in mail box of mail to fetch */ + char *section; /* Message SECTION to fetch */ + char *partial; /* Message PARTIAL to fetch */ + char *query; /* Query to search for */ + char *custom; /* Custom request */ + char *custom_params; /* Parameters for the custom request */ +}; + +/* imap_conn is used for struct connection-oriented data in the connectdata + struct */ +struct imap_conn { + struct pingpong pp; + struct SASL sasl; /* SASL-related parameters */ + struct dynbuf dyn; /* for the IMAP commands */ + char *mailbox; /* The last selected mailbox */ + char *mailbox_uidvalidity; /* UIDVALIDITY parsed from select response */ + imapstate state; /* Always use imap.c:state() to change state! */ + char resptag[5]; /* Response tag to wait for */ + unsigned char preftype; /* Preferred authentication type */ + unsigned char cmdid; /* Last used command ID */ + BIT(ssldone); /* Is connect() over SSL done? */ + BIT(preauth); /* Is this connection PREAUTH? */ + BIT(tls_supported); /* StartTLS capability supported by server */ + BIT(login_disabled); /* LOGIN command disabled by server */ + BIT(ir_supported); /* Initial response supported by server */ +}; + +extern const struct Curl_handler Curl_handler_imap; +extern const struct Curl_handler Curl_handler_imaps; + +/* Authentication type flags */ +#define IMAP_TYPE_CLEARTEXT (1 << 0) +#define IMAP_TYPE_SASL (1 << 1) + +/* Authentication type values */ +#define IMAP_TYPE_NONE 0 +#define IMAP_TYPE_ANY (IMAP_TYPE_CLEARTEXT|IMAP_TYPE_SASL) + +#endif /* HEADER_CURL_IMAP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/inet_ntop.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/inet_ntop.h new file mode 100644 index 0000000000000000000000000000000000000000..7c3ead43418f8ab26687142d66cd6253a2f5ad53 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/inet_ntop.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_INET_NTOP_H +#define HEADER_CURL_INET_NTOP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size); + +#ifdef HAVE_INET_NTOP +#ifdef HAVE_ARPA_INET_H +#include +#endif +#define Curl_inet_ntop(af,addr,buf,size) \ + inet_ntop(af, addr, buf, (curl_socklen_t)size) +#endif + +#endif /* HEADER_CURL_INET_NTOP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/inet_pton.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/inet_pton.h new file mode 100644 index 0000000000000000000000000000000000000000..82fde7e2eb59b3979f3b15259bd488a062c17cca --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/inet_pton.h @@ -0,0 +1,41 @@ +#ifndef HEADER_CURL_INET_PTON_H +#define HEADER_CURL_INET_PTON_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +int Curl_inet_pton(int, const char *, void *); + +#ifdef HAVE_INET_PTON +#ifdef HAVE_ARPA_INET_H +#include +#elif defined(HAVE_WS2TCPIP_H) +/* inet_pton() exists in Vista or later */ +#include +#endif +#define Curl_inet_pton(x,y,z) inet_pton(x,y,z) +#endif + +#endif /* HEADER_CURL_INET_PTON_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/llist.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/llist.h new file mode 100644 index 0000000000000000000000000000000000000000..320580e33cce225de8838d34718363fd5b51d30c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/llist.h @@ -0,0 +1,52 @@ +#ifndef HEADER_CURL_LLIST_H +#define HEADER_CURL_LLIST_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include + +typedef void (*Curl_llist_dtor)(void *, void *); + +struct Curl_llist_element { + void *ptr; + struct Curl_llist_element *prev; + struct Curl_llist_element *next; +}; + +struct Curl_llist { + struct Curl_llist_element *head; + struct Curl_llist_element *tail; + Curl_llist_dtor dtor; + size_t size; +}; + +void Curl_llist_init(struct Curl_llist *, Curl_llist_dtor); +void Curl_llist_insert_next(struct Curl_llist *, struct Curl_llist_element *, + const void *, struct Curl_llist_element *node); +void Curl_llist_remove(struct Curl_llist *, struct Curl_llist_element *, + void *); +size_t Curl_llist_count(struct Curl_llist *); +void Curl_llist_destroy(struct Curl_llist *, void *); +#endif /* HEADER_CURL_LLIST_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/macos.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/macos.h new file mode 100644 index 0000000000000000000000000000000000000000..637860e80fc1ba31d50d09b4a378452ef711d7ed --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/macos.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_MACOS_H +#define HEADER_CURL_MACOS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef CURL_MACOS_CALL_COPYPROXIES + +CURLcode Curl_macos_init(void); + +#else + +#define Curl_macos_init() CURLE_OK + +#endif + +#endif /* HEADER_CURL_MACOS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/memdebug.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/memdebug.h new file mode 100644 index 0000000000000000000000000000000000000000..c9eb5dc37c0e77955ce86661ae61ce0e8d395899 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/memdebug.h @@ -0,0 +1,202 @@ +#ifndef HEADER_CURL_MEMDEBUG_H +#define HEADER_CURL_MEMDEBUG_H +#ifdef CURLDEBUG +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* + * CAUTION: this header is designed to work when included by the app-side + * as well as the library. Do not mix with library internals! + */ + +#include +#include "functypes.h" + +#if defined(__GNUC__) && __GNUC__ >= 3 +# define ALLOC_FUNC __attribute__((malloc)) +# define ALLOC_SIZE(s) __attribute__((alloc_size(s))) +# define ALLOC_SIZE2(n, s) __attribute__((alloc_size(n, s))) +#elif defined(_MSC_VER) +# define ALLOC_FUNC __declspec(restrict) +# define ALLOC_SIZE(s) +# define ALLOC_SIZE2(n, s) +#else +# define ALLOC_FUNC +# define ALLOC_SIZE(s) +# define ALLOC_SIZE2(n, s) +#endif + +#define CURL_MT_LOGFNAME_BUFSIZE 512 + +extern FILE *curl_dbg_logfile; + +/* memory functions */ +CURL_EXTERN ALLOC_FUNC ALLOC_SIZE(1) void *curl_dbg_malloc(size_t size, + int line, + const char *source); +CURL_EXTERN ALLOC_FUNC ALLOC_SIZE2(1, 2) void *curl_dbg_calloc(size_t elements, + size_t size, int line, const char *source); +CURL_EXTERN ALLOC_SIZE(2) void *curl_dbg_realloc(void *ptr, + size_t size, + int line, + const char *source); +CURL_EXTERN void curl_dbg_free(void *ptr, int line, const char *source); +CURL_EXTERN ALLOC_FUNC char *curl_dbg_strdup(const char *str, int line, + const char *src); +#if defined(WIN32) && defined(UNICODE) +CURL_EXTERN ALLOC_FUNC wchar_t *curl_dbg_wcsdup(const wchar_t *str, + int line, + const char *source); +#endif + +CURL_EXTERN void curl_dbg_memdebug(const char *logname); +CURL_EXTERN void curl_dbg_memlimit(long limit); +CURL_EXTERN void curl_dbg_log(const char *format, ...); + +/* file descriptor manipulators */ +CURL_EXTERN curl_socket_t curl_dbg_socket(int domain, int type, int protocol, + int line, const char *source); +CURL_EXTERN void curl_dbg_mark_sclose(curl_socket_t sockfd, + int line, const char *source); +CURL_EXTERN int curl_dbg_sclose(curl_socket_t sockfd, + int line, const char *source); +CURL_EXTERN curl_socket_t curl_dbg_accept(curl_socket_t s, void *a, void *alen, + int line, const char *source); +#ifdef HAVE_SOCKETPAIR +CURL_EXTERN int curl_dbg_socketpair(int domain, int type, int protocol, + curl_socket_t socket_vector[2], + int line, const char *source); +#endif + +/* send/receive sockets */ +CURL_EXTERN SEND_TYPE_RETV curl_dbg_send(SEND_TYPE_ARG1 sockfd, + SEND_QUAL_ARG2 SEND_TYPE_ARG2 buf, + SEND_TYPE_ARG3 len, + SEND_TYPE_ARG4 flags, int line, + const char *source); +CURL_EXTERN RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd, + RECV_TYPE_ARG2 buf, + RECV_TYPE_ARG3 len, + RECV_TYPE_ARG4 flags, int line, + const char *source); + +/* FILE functions */ +CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fopen(const char *file, const char *mode, + int line, const char *source); +CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode, + int line, const char *source); + +CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source); + +#ifndef MEMDEBUG_NODEFINES + +/* Set this symbol on the command-line, recompile all lib-sources */ +#undef strdup +#define strdup(ptr) curl_dbg_strdup(ptr, __LINE__, __FILE__) +#define malloc(size) curl_dbg_malloc(size, __LINE__, __FILE__) +#define calloc(nbelem,size) curl_dbg_calloc(nbelem, size, __LINE__, __FILE__) +#define realloc(ptr,size) curl_dbg_realloc(ptr, size, __LINE__, __FILE__) +#define free(ptr) curl_dbg_free(ptr, __LINE__, __FILE__) +#define send(a,b,c,d) curl_dbg_send(a,b,c,d, __LINE__, __FILE__) +#define recv(a,b,c,d) curl_dbg_recv(a,b,c,d, __LINE__, __FILE__) + +#ifdef WIN32 +# ifdef UNICODE +# undef wcsdup +# define wcsdup(ptr) curl_dbg_wcsdup(ptr, __LINE__, __FILE__) +# undef _wcsdup +# define _wcsdup(ptr) curl_dbg_wcsdup(ptr, __LINE__, __FILE__) +# undef _tcsdup +# define _tcsdup(ptr) curl_dbg_wcsdup(ptr, __LINE__, __FILE__) +# else +# undef _tcsdup +# define _tcsdup(ptr) curl_dbg_strdup(ptr, __LINE__, __FILE__) +# endif +#endif + +#undef socket +#define socket(domain,type,protocol)\ + curl_dbg_socket(domain, type, protocol, __LINE__, __FILE__) +#undef accept /* for those with accept as a macro */ +#define accept(sock,addr,len)\ + curl_dbg_accept(sock, addr, len, __LINE__, __FILE__) +#ifdef HAVE_SOCKETPAIR +#define socketpair(domain,type,protocol,socket_vector)\ + curl_dbg_socketpair(domain, type, protocol, socket_vector, __LINE__, __FILE__) +#endif + +#ifdef HAVE_GETADDRINFO +#if defined(getaddrinfo) && defined(__osf__) +/* OSF/1 and Tru64 have getaddrinfo as a define already, so we cannot define + our macro as for other platforms. Instead, we redefine the new name they + define getaddrinfo to become! */ +#define ogetaddrinfo(host,serv,hint,res) \ + curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__) +#else +#undef getaddrinfo +#define getaddrinfo(host,serv,hint,res) \ + curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__) +#endif +#endif /* HAVE_GETADDRINFO */ + +#ifdef HAVE_FREEADDRINFO +#undef freeaddrinfo +#define freeaddrinfo(data) \ + curl_dbg_freeaddrinfo(data, __LINE__, __FILE__) +#endif /* HAVE_FREEADDRINFO */ + +/* sclose is probably already defined, redefine it! */ +#undef sclose +#define sclose(sockfd) curl_dbg_sclose(sockfd,__LINE__,__FILE__) + +#define fake_sclose(sockfd) curl_dbg_mark_sclose(sockfd,__LINE__,__FILE__) + +#undef fopen +#define fopen(file,mode) curl_dbg_fopen(file,mode,__LINE__,__FILE__) +#undef fdopen +#define fdopen(file,mode) curl_dbg_fdopen(file,mode,__LINE__,__FILE__) +#define fclose(file) curl_dbg_fclose(file,__LINE__,__FILE__) + +#endif /* MEMDEBUG_NODEFINES */ + +#endif /* CURLDEBUG */ + +/* +** Following section applies even when CURLDEBUG is not defined. +*/ + +#ifndef fake_sclose +#define fake_sclose(x) Curl_nop_stmt +#endif + +/* + * Curl_safefree defined as a macro to allow MemoryTracking feature + * to log free() calls at same location where Curl_safefree is used. + * This macro also assigns NULL to given pointer when free'd. + */ + +#define Curl_safefree(ptr) \ + do { free((ptr)); (ptr) = NULL;} while(0) + +#endif /* HEADER_CURL_MEMDEBUG_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/mime.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/mime.h new file mode 100644 index 0000000000000000000000000000000000000000..0a05c2a5aa8ffa2ff595b760d317634350c8268c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/mime.h @@ -0,0 +1,174 @@ +#ifndef HEADER_CURL_MIME_H +#define HEADER_CURL_MIME_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#define MIME_BOUNDARY_DASHES 24 /* leading boundary dashes */ +#define MIME_RAND_BOUNDARY_CHARS 22 /* Nb. of random boundary chars. */ +#define MAX_ENCODED_LINE_LENGTH 76 /* Maximum encoded line length. */ +#define ENCODING_BUFFER_SIZE 256 /* Encoding temp buffers size. */ + +/* Part flags. */ +#define MIME_USERHEADERS_OWNER (1 << 0) +#define MIME_BODY_ONLY (1 << 1) +#define MIME_FAST_READ (1 << 2) + +#define FILE_CONTENTTYPE_DEFAULT "application/octet-stream" +#define MULTIPART_CONTENTTYPE_DEFAULT "multipart/mixed" +#define DISPOSITION_DEFAULT "attachment" + +/* Part source kinds. */ +enum mimekind { + MIMEKIND_NONE = 0, /* Part not set. */ + MIMEKIND_DATA, /* Allocated mime data. */ + MIMEKIND_FILE, /* Data from file. */ + MIMEKIND_CALLBACK, /* Data from `read' callback. */ + MIMEKIND_MULTIPART, /* Data is a mime subpart. */ + MIMEKIND_LAST +}; + +/* Readback state tokens. */ +enum mimestate { + MIMESTATE_BEGIN, /* Readback has not yet started. */ + MIMESTATE_CURLHEADERS, /* In curl-generated headers. */ + MIMESTATE_USERHEADERS, /* In caller's supplied headers. */ + MIMESTATE_EOH, /* End of headers. */ + MIMESTATE_BODY, /* Placeholder. */ + MIMESTATE_BOUNDARY1, /* In boundary prefix. */ + MIMESTATE_BOUNDARY2, /* In boundary. */ + MIMESTATE_CONTENT, /* In content. */ + MIMESTATE_END, /* End of part reached. */ + MIMESTATE_LAST +}; + +/* Mime headers strategies. */ +enum mimestrategy { + MIMESTRATEGY_MAIL, /* Mime mail. */ + MIMESTRATEGY_FORM, /* HTTP post form. */ + MIMESTRATEGY_LAST +}; + +/* Content transfer encoder. */ +struct mime_encoder { + const char * name; /* Encoding name. */ + size_t (*encodefunc)(char *buffer, size_t size, bool ateof, + curl_mimepart *part); /* Encoded read. */ + curl_off_t (*sizefunc)(curl_mimepart *part); /* Encoded size. */ +}; + +/* Content transfer encoder state. */ +struct mime_encoder_state { + size_t pos; /* Position on output line. */ + size_t bufbeg; /* Next data index in input buffer. */ + size_t bufend; /* First unused byte index in input buffer. */ + char buf[ENCODING_BUFFER_SIZE]; /* Input buffer. */ +}; + +/* Mime readback state. */ +struct mime_state { + enum mimestate state; /* Current state token. */ + void *ptr; /* State-dependent pointer. */ + curl_off_t offset; /* State-dependent offset. */ +}; + +/* Boundary string length. */ +#define MIME_BOUNDARY_LEN (MIME_BOUNDARY_DASHES + MIME_RAND_BOUNDARY_CHARS) + +/* A mime multipart. */ +struct curl_mime { + curl_mimepart *parent; /* Parent part. */ + curl_mimepart *firstpart; /* First part. */ + curl_mimepart *lastpart; /* Last part. */ + char boundary[MIME_BOUNDARY_LEN + 1]; /* The part boundary. */ + struct mime_state state; /* Current readback state. */ +}; + +/* A mime part. */ +struct curl_mimepart { + curl_mime *parent; /* Parent mime structure. */ + curl_mimepart *nextpart; /* Forward linked list. */ + enum mimekind kind; /* The part kind. */ + unsigned int flags; /* Flags. */ + char *data; /* Memory data or file name. */ + curl_read_callback readfunc; /* Read function. */ + curl_seek_callback seekfunc; /* Seek function. */ + curl_free_callback freefunc; /* Argument free function. */ + void *arg; /* Argument to callback functions. */ + FILE *fp; /* File pointer. */ + struct curl_slist *curlheaders; /* Part headers. */ + struct curl_slist *userheaders; /* Part headers. */ + char *mimetype; /* Part mime type. */ + char *filename; /* Remote file name. */ + char *name; /* Data name. */ + curl_off_t datasize; /* Expected data size. */ + struct mime_state state; /* Current readback state. */ + const struct mime_encoder *encoder; /* Content data encoder. */ + struct mime_encoder_state encstate; /* Data encoder state. */ + size_t lastreadstatus; /* Last read callback returned status. */ +}; + +CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...); + +#if !defined(CURL_DISABLE_MIME) && (!defined(CURL_DISABLE_HTTP) || \ + !defined(CURL_DISABLE_SMTP) || \ + !defined(CURL_DISABLE_IMAP)) + +/* Prototypes. */ +void Curl_mime_initpart(struct curl_mimepart *part); +void Curl_mime_cleanpart(struct curl_mimepart *part); +CURLcode Curl_mime_duppart(struct Curl_easy *data, + struct curl_mimepart *dst, + const curl_mimepart *src); +CURLcode Curl_mime_set_subparts(struct curl_mimepart *part, + struct curl_mime *subparts, + int take_ownership); +CURLcode Curl_mime_prepare_headers(struct Curl_easy *data, + struct curl_mimepart *part, + const char *contenttype, + const char *disposition, + enum mimestrategy strategy); +curl_off_t Curl_mime_size(struct curl_mimepart *part); +size_t Curl_mime_read(char *buffer, size_t size, size_t nitems, + void *instream); +CURLcode Curl_mime_rewind(struct curl_mimepart *part); +const char *Curl_mime_contenttype(const char *filename); +void Curl_mime_unpause(struct curl_mimepart *part); + +#else +/* if disabled */ +#define Curl_mime_initpart(x) +#define Curl_mime_cleanpart(x) +#define Curl_mime_duppart(x,y,z) CURLE_OK /* Nothing to duplicate. Succeed */ +#define Curl_mime_set_subparts(a,b,c) CURLE_NOT_BUILT_IN +#define Curl_mime_prepare_headers(a,b,c,d,e) CURLE_NOT_BUILT_IN +#define Curl_mime_size(x) (curl_off_t) -1 +#define Curl_mime_read NULL +#define Curl_mime_rewind(x) ((void)x, CURLE_NOT_BUILT_IN) +#define Curl_mime_unpause(x) +#endif + + +#endif /* HEADER_CURL_MIME_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/mqtt.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/mqtt.h new file mode 100644 index 0000000000000000000000000000000000000000..84f177022ebd3e538fa5bed1c0b445dc847cd797 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/mqtt.h @@ -0,0 +1,62 @@ +#ifndef HEADER_CURL_MQTT_H +#define HEADER_CURL_MQTT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Björn Stenberg, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#ifndef CURL_DISABLE_MQTT +extern const struct Curl_handler Curl_handler_mqtt; +#endif + +enum mqttstate { + MQTT_FIRST, /* 0 */ + MQTT_REMAINING_LENGTH, /* 1 */ + MQTT_CONNACK, /* 2 */ + MQTT_SUBACK, /* 3 */ + MQTT_SUBACK_COMING, /* 4 - the SUBACK remainder */ + MQTT_PUBWAIT, /* 5 - wait for publish */ + MQTT_PUB_REMAIN, /* 6 - wait for the remainder of the publish */ + + MQTT_NOSTATE /* 7 - never used an actual state */ +}; + +struct mqtt_conn { + enum mqttstate state; + enum mqttstate nextstate; /* switch to this after remaining length is + done */ + unsigned int packetid; +}; + +/* protocol-specific transfer-related data */ +struct MQTT { + char *sendleftovers; + size_t nsend; /* size of sendleftovers */ + + /* when receiving */ + size_t npacket; /* byte counter */ + unsigned char firstbyte; + size_t remaining_length; + struct dynbuf recvbuf; +}; + +#endif /* HEADER_CURL_MQTT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/multihandle.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/multihandle.h new file mode 100644 index 0000000000000000000000000000000000000000..5b16bb605fefb8aed7f5e04bc284e210c5417ebc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/multihandle.h @@ -0,0 +1,180 @@ +#ifndef HEADER_CURL_MULTIHANDLE_H +#define HEADER_CURL_MULTIHANDLE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "llist.h" +#include "hash.h" +#include "conncache.h" +#include "psl.h" +#include "socketpair.h" + +struct connectdata; + +struct Curl_message { + struct Curl_llist_element list; + /* the 'CURLMsg' is the part that is visible to the external user */ + struct CURLMsg extmsg; +}; + +/* NOTE: if you add a state here, add the name to the statename[] array as + well! +*/ +typedef enum { + MSTATE_INIT, /* 0 - start in this state */ + MSTATE_PENDING, /* 1 - no connections, waiting for one */ + MSTATE_CONNECT, /* 2 - resolve/connect has been sent off */ + MSTATE_RESOLVING, /* 3 - awaiting the resolve to finalize */ + MSTATE_CONNECTING, /* 4 - awaiting the TCP connect to finalize */ + MSTATE_TUNNELING, /* 5 - awaiting HTTPS proxy SSL initialization to + complete and/or proxy CONNECT to finalize */ + MSTATE_PROTOCONNECT, /* 6 - initiate protocol connect procedure */ + MSTATE_PROTOCONNECTING, /* 7 - completing the protocol-specific connect + phase */ + MSTATE_DO, /* 8 - start send off the request (part 1) */ + MSTATE_DOING, /* 9 - sending off the request (part 1) */ + MSTATE_DOING_MORE, /* 10 - send off the request (part 2) */ + MSTATE_DID, /* 11 - done sending off request */ + MSTATE_PERFORMING, /* 12 - transfer data */ + MSTATE_RATELIMITING, /* 13 - wait because limit-rate exceeded */ + MSTATE_DONE, /* 14 - post data transfer operation */ + MSTATE_COMPLETED, /* 15 - operation complete */ + MSTATE_MSGSENT, /* 16 - the operation complete message is sent */ + MSTATE_LAST /* 17 - not a true state, never use this */ +} CURLMstate; + +/* we support N sockets per easy handle. Set the corresponding bit to what + action we should wait for */ +#define MAX_SOCKSPEREASYHANDLE 5 +#define GETSOCK_READABLE (0x00ff) +#define GETSOCK_WRITABLE (0xff00) + +#define CURLPIPE_ANY (CURLPIPE_MULTIPLEX) + +#if !defined(CURL_DISABLE_SOCKETPAIR) +#define ENABLE_WAKEUP +#endif + +/* value for MAXIMUM CONCURRENT STREAMS upper limit */ +#define INITIAL_MAX_CONCURRENT_STREAMS ((1U << 31) - 1) + +/* Curl_multi SSL backend-specific data; declared differently by each SSL + backend */ +struct multi_ssl_backend_data; + +/* This is the struct known as CURLM on the outside */ +struct Curl_multi { + /* First a simple identifier to easier detect if a user mix up + this multi handle with an easy handle. Set this to CURL_MULTI_HANDLE. */ + unsigned int magic; + + /* We have a doubly-linked list with easy handles */ + struct Curl_easy *easyp; + struct Curl_easy *easylp; /* last node */ + + int num_easy; /* amount of entries in the linked list above. */ + int num_alive; /* amount of easy handles that are added but have not yet + reached COMPLETE state */ + + struct Curl_llist msglist; /* a list of messages from completed transfers */ + + struct Curl_llist pending; /* Curl_easys that are in the + MSTATE_PENDING state */ + struct Curl_llist msgsent; /* Curl_easys that are in the + MSTATE_MSGSENT state */ + + /* callback function and user data pointer for the *socket() API */ + curl_socket_callback socket_cb; + void *socket_userp; + + /* callback function and user data pointer for server push */ + curl_push_callback push_cb; + void *push_userp; + + /* Hostname cache */ + struct Curl_hash hostcache; + +#ifdef USE_LIBPSL + /* PSL cache. */ + struct PslCache psl; +#endif + + /* timetree points to the splay-tree of time nodes to figure out expire + times of all currently set timers */ + struct Curl_tree *timetree; + +#if defined(USE_SSL) + struct multi_ssl_backend_data *ssl_backend_data; +#endif + + /* 'sockhash' is the lookup hash for socket descriptor => easy handles (note + the pluralis form, there can be more than one easy handle waiting on the + same actual socket) */ + struct Curl_hash sockhash; + + /* Shared connection cache (bundles)*/ + struct conncache conn_cache; + + long maxconnects; /* if >0, a fixed limit of the maximum number of entries + we're allowed to grow the connection cache to */ + + long max_host_connections; /* if >0, a fixed limit of the maximum number + of connections per host */ + + long max_total_connections; /* if >0, a fixed limit of the maximum number + of connections in total */ + + /* timer callback and user data pointer for the *socket() API */ + curl_multi_timer_callback timer_cb; + void *timer_userp; + struct curltime timer_lastcall; /* the fixed time for the timeout for the + previous callback */ + unsigned int max_concurrent_streams; + +#ifdef USE_WINSOCK + WSAEVENT wsa_event; /* winsock event used for waits */ +#else +#ifdef ENABLE_WAKEUP + curl_socket_t wakeup_pair[2]; /* socketpair() used for wakeup + 0 is used for read, 1 is used for write */ +#endif +#endif +#define IPV6_UNKNOWN 0 +#define IPV6_DEAD 1 +#define IPV6_WORKS 2 + unsigned char ipv6_up; /* IPV6_* defined */ + BIT(multiplexing); /* multiplexing wanted */ + BIT(recheckstate); /* see Curl_multi_connchanged */ + BIT(in_callback); /* true while executing a callback */ +#ifdef USE_OPENSSL + BIT(ssl_seeded); +#endif + BIT(dead); /* a callback returned error, everything needs to crash and + burn */ +#ifdef DEBUGBUILD + BIT(warned); /* true after user warned of DEBUGBUILD */ +#endif +}; + +#endif /* HEADER_CURL_MULTIHANDLE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/multiif.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/multiif.h new file mode 100644 index 0000000000000000000000000000000000000000..7a344fa9fd275781ad3a64cc1791e0acd686f13b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/multiif.h @@ -0,0 +1,97 @@ +#ifndef HEADER_CURL_MULTIIF_H +#define HEADER_CURL_MULTIIF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* + * Prototypes for library-wide functions provided by multi.c + */ + +CURLcode Curl_updatesocket(struct Curl_easy *data); +void Curl_expire(struct Curl_easy *data, timediff_t milli, expire_id); +void Curl_expire_clear(struct Curl_easy *data); +void Curl_expire_done(struct Curl_easy *data, expire_id id); +CURLMcode Curl_update_timer(struct Curl_multi *multi) WARN_UNUSED_RESULT; +void Curl_attach_connection(struct Curl_easy *data, + struct connectdata *conn); +void Curl_detach_connection(struct Curl_easy *data); +bool Curl_multiplex_wanted(const struct Curl_multi *multi); +void Curl_set_in_callback(struct Curl_easy *data, bool value); +bool Curl_is_in_callback(struct Curl_easy *easy); +CURLcode Curl_preconnect(struct Curl_easy *data); + +void Curl_multi_connchanged(struct Curl_multi *multi); + +/* Internal version of curl_multi_init() accepts size parameters for the + socket, connection and dns hashes */ +struct Curl_multi *Curl_multi_handle(int hashsize, int chashsize, + int dnssize); + +/* the write bits start at bit 16 for the *getsock() bitmap */ +#define GETSOCK_WRITEBITSTART 16 + +#define GETSOCK_BLANK 0 /* no bits set */ + +/* set the bit for the given sock number to make the bitmap for writable */ +#define GETSOCK_WRITESOCK(x) (1 << (GETSOCK_WRITEBITSTART + (x))) + +/* set the bit for the given sock number to make the bitmap for readable */ +#define GETSOCK_READSOCK(x) (1 << (x)) + +/* mask for checking if read and/or write is set for index x */ +#define GETSOCK_MASK_RW(x) (GETSOCK_READSOCK(x)|GETSOCK_WRITESOCK(x)) + +/* Return the value of the CURLMOPT_MAX_HOST_CONNECTIONS option */ +size_t Curl_multi_max_host_connections(struct Curl_multi *multi); + +/* Return the value of the CURLMOPT_MAX_TOTAL_CONNECTIONS option */ +size_t Curl_multi_max_total_connections(struct Curl_multi *multi); + +void Curl_multiuse_state(struct Curl_easy *data, + int bundlestate); /* use BUNDLE_* defines */ + +/* + * Curl_multi_closed() + * + * Used by the connect code to tell the multi_socket code that one of the + * sockets we were using is about to be closed. This function will then + * remove it from the sockethash for this handle to make the multi_socket API + * behave properly, especially for the case when libcurl will create another + * socket again and it gets the same file descriptor number. + */ + +void Curl_multi_closed(struct Curl_easy *data, curl_socket_t s); + +/* + * Add a handle and move it into PERFORM state at once. For pushed streams. + */ +CURLMcode Curl_multi_add_perform(struct Curl_multi *multi, + struct Curl_easy *data, + struct connectdata *conn); + + +/* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option */ +unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi); + +#endif /* HEADER_CURL_MULTIIF_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/netrc.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/netrc.h new file mode 100644 index 0000000000000000000000000000000000000000..9f2815f3bb9930d283e6b15e98440eddc98c2628 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/netrc.h @@ -0,0 +1,43 @@ +#ifndef HEADER_CURL_NETRC_H +#define HEADER_CURL_NETRC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#ifndef CURL_DISABLE_NETRC + +/* returns -1 on failure, 0 if the host is found, 1 is the host isn't found */ +int Curl_parsenetrc(const char *host, char **loginp, + char **passwordp, char *filename); + /* Assume: (*passwordp)[0]=0, host[0] != 0. + * If (*loginp)[0] = 0, search for login and password within a machine + * section in the netrc. + * If (*loginp)[0] != 0, search for password within machine and login. + */ +#else +/* disabled */ +#define Curl_parsenetrc(a,b,c,d,e,f) 1 +#endif + +#endif /* HEADER_CURL_NETRC_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/nonblock.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/nonblock.h new file mode 100644 index 0000000000000000000000000000000000000000..4a1a6151f248a617897a5782505fa976e01baa96 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/nonblock.h @@ -0,0 +1,32 @@ +#ifndef HEADER_CURL_NONBLOCK_H +#define HEADER_CURL_NONBLOCK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include /* for curl_socket_t */ + +int curlx_nonblock(curl_socket_t sockfd, /* operate on this */ + int nonblock /* TRUE or FALSE */); + +#endif /* HEADER_CURL_NONBLOCK_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/noproxy.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/noproxy.h new file mode 100644 index 0000000000000000000000000000000000000000..a3a6807722d22dfdd760912f8b9433ce61462380 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/noproxy.h @@ -0,0 +1,45 @@ +#ifndef HEADER_CURL_NOPROXY_H +#define HEADER_CURL_NOPROXY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifndef CURL_DISABLE_PROXY + +#ifdef DEBUGBUILD + +UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */ + const char *network, /* 1.2.3.4 address */ + unsigned int bits); +UNITTEST bool Curl_cidr6_match(const char *ipv6, + const char *network, + unsigned int bits); +#endif + +bool Curl_check_noproxy(const char *name, const char *no_proxy, + bool *spacesep); + +#endif + +#endif /* HEADER_CURL_NOPROXY_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/parsedate.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/parsedate.h new file mode 100644 index 0000000000000000000000000000000000000000..84c37f1675cffe190f4956c5b4591eda794cb6e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/parsedate.h @@ -0,0 +1,38 @@ +#ifndef HEADER_CURL_PARSEDATE_H +#define HEADER_CURL_PARSEDATE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +extern const char * const Curl_wkday[7]; +extern const char * const Curl_month[12]; + +CURLcode Curl_gmtime(time_t intime, struct tm *store); + +/* Curl_getdate_capped() differs from curl_getdate() in that this will return + TIME_T_MAX in case the parsed time value was too big, instead of an + error. */ + +time_t Curl_getdate_capped(const char *p); + +#endif /* HEADER_CURL_PARSEDATE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/pingpong.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/pingpong.h new file mode 100644 index 0000000000000000000000000000000000000000..80d3f7718c7e22bfd91619204be6ff1335029863 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/pingpong.h @@ -0,0 +1,164 @@ +#ifndef HEADER_CURL_PINGPONG_H +#define HEADER_CURL_PINGPONG_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_IMAP) || !defined(CURL_DISABLE_FTP) || \ + !defined(CURL_DISABLE_POP3) || !defined(CURL_DISABLE_SMTP) +#define USE_PINGPONG +#endif + +/* forward-declaration, this is defined in urldata.h */ +struct connectdata; + +typedef enum { + PPTRANSFER_BODY, /* yes do transfer a body */ + PPTRANSFER_INFO, /* do still go through to get info/headers */ + PPTRANSFER_NONE /* don't get anything and don't get info */ +} curl_pp_transfer; + +/* + * 'pingpong' is the generic struct used for protocols doing server<->client + * conversations in a back-and-forth style such as FTP, IMAP, POP3, SMTP etc. + * + * It holds response cache and non-blocking sending data. + */ +struct pingpong { + char *cache; /* data cache between getresponse()-calls */ + size_t cache_size; /* size of cache in bytes */ + size_t nread_resp; /* number of bytes currently read of a server response */ + char *linestart_resp; /* line start pointer for the server response + reader function */ + bool pending_resp; /* set TRUE when a server response is pending or in + progress, and is cleared once the last response is + read */ + char *sendthis; /* allocated pointer to a buffer that is to be sent to the + server */ + size_t sendleft; /* number of bytes left to send from the sendthis buffer */ + size_t sendsize; /* total size of the sendthis buffer */ + struct curltime response; /* set to Curl_now() when a command has been sent + off, used to time-out response reading */ + timediff_t response_time; /* When no timeout is given, this is the amount of + milliseconds we await for a server response. */ + struct dynbuf sendbuf; + + /* Function pointers the protocols MUST implement and provide for the + pingpong layer to function */ + + CURLcode (*statemachine)(struct Curl_easy *data, struct connectdata *conn); + bool (*endofresp)(struct Curl_easy *data, struct connectdata *conn, + char *ptr, size_t len, int *code); +}; + +#define PINGPONG_SETUP(pp,s,e) \ + do { \ + pp->response_time = RESP_TIMEOUT; \ + pp->statemachine = s; \ + pp->endofresp = e; \ + } while(0) + +/* + * Curl_pp_statemach() + * + * called repeatedly until done. Set 'wait' to make it wait a while on the + * socket if there's no traffic. + */ +CURLcode Curl_pp_statemach(struct Curl_easy *data, struct pingpong *pp, + bool block, bool disconnecting); + +/* initialize stuff to prepare for reading a fresh new response */ +void Curl_pp_init(struct Curl_easy *data, struct pingpong *pp); + +/* setup for the transfer */ +void Curl_pp_setup(struct pingpong *pp); + +/* Returns timeout in ms. 0 or negative number means the timeout has already + triggered */ +timediff_t Curl_pp_state_timeout(struct Curl_easy *data, + struct pingpong *pp, bool disconnecting); + + +/*********************************************************************** + * + * Curl_pp_sendf() + * + * Send the formatted string as a command to a pingpong server. Note that + * the string should not have any CRLF appended, as this function will + * append the necessary things itself. + * + * made to never block + */ +CURLcode Curl_pp_sendf(struct Curl_easy *data, + struct pingpong *pp, + const char *fmt, ...); + +/*********************************************************************** + * + * Curl_pp_vsendf() + * + * Send the formatted string as a command to a pingpong server. Note that + * the string should not have any CRLF appended, as this function will + * append the necessary things itself. + * + * made to never block + */ +CURLcode Curl_pp_vsendf(struct Curl_easy *data, + struct pingpong *pp, + const char *fmt, + va_list args); + +/* + * Curl_pp_readresp() + * + * Reads a piece of a server response. + */ +CURLcode Curl_pp_readresp(struct Curl_easy *data, + curl_socket_t sockfd, + struct pingpong *pp, + int *code, /* return the server code if done */ + size_t *size); /* size of the response */ + + +CURLcode Curl_pp_flushsend(struct Curl_easy *data, + struct pingpong *pp); + +/* call this when a pingpong connection is disconnected */ +CURLcode Curl_pp_disconnect(struct pingpong *pp); + +int Curl_pp_getsock(struct Curl_easy *data, struct pingpong *pp, + curl_socket_t *socks); + + +/*********************************************************************** + * + * Curl_pp_moredata() + * + * Returns whether there are still more data in the cache and so a call + * to Curl_pp_readresp() will not block. + */ +bool Curl_pp_moredata(struct pingpong *pp); + +#endif /* HEADER_CURL_PINGPONG_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/pop3.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/pop3.h new file mode 100644 index 0000000000000000000000000000000000000000..83f0f831e6c1fa4979b05204c5074a2efada9f4c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/pop3.h @@ -0,0 +1,97 @@ +#ifndef HEADER_CURL_POP3_H +#define HEADER_CURL_POP3_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "pingpong.h" +#include "curl_sasl.h" + +/**************************************************************************** + * POP3 unique setup + ***************************************************************************/ +typedef enum { + POP3_STOP, /* do nothing state, stops the state machine */ + POP3_SERVERGREET, /* waiting for the initial greeting immediately after + a connect */ + POP3_CAPA, + POP3_STARTTLS, + POP3_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS + (multi mode only) */ + POP3_AUTH, + POP3_APOP, + POP3_USER, + POP3_PASS, + POP3_COMMAND, + POP3_QUIT, + POP3_LAST /* never used */ +} pop3state; + +/* This POP3 struct is used in the Curl_easy. All POP3 data that is + connection-oriented must be in pop3_conn to properly deal with the fact that + perhaps the Curl_easy is changed between the times the connection is + used. */ +struct POP3 { + curl_pp_transfer transfer; + char *id; /* Message ID */ + char *custom; /* Custom Request */ +}; + +/* pop3_conn is used for struct connection-oriented data in the connectdata + struct */ +struct pop3_conn { + struct pingpong pp; + pop3state state; /* Always use pop3.c:state() to change state! */ + size_t eob; /* Number of bytes of the EOB (End Of Body) that + have been received so far */ + size_t strip; /* Number of bytes from the start to ignore as + non-body */ + struct SASL sasl; /* SASL-related storage */ + char *apoptimestamp; /* APOP timestamp from the server greeting */ + unsigned char authtypes; /* Accepted authentication types */ + unsigned char preftype; /* Preferred authentication type */ + BIT(ssldone); /* Is connect() over SSL done? */ + BIT(tls_supported); /* StartTLS capability supported by server */ +}; + +extern const struct Curl_handler Curl_handler_pop3; +extern const struct Curl_handler Curl_handler_pop3s; + +/* Authentication type flags */ +#define POP3_TYPE_CLEARTEXT (1 << 0) +#define POP3_TYPE_APOP (1 << 1) +#define POP3_TYPE_SASL (1 << 2) + +/* Authentication type values */ +#define POP3_TYPE_NONE 0 +#define POP3_TYPE_ANY (POP3_TYPE_CLEARTEXT|POP3_TYPE_APOP|POP3_TYPE_SASL) + +/* This is the 5-bytes End-Of-Body marker for POP3 */ +#define POP3_EOB "\x0d\x0a\x2e\x0d\x0a" +#define POP3_EOB_LEN 5 + +/* This function scans the body after the end-of-body and writes everything + * until the end is found */ +CURLcode Curl_pop3_write(struct Curl_easy *data, char *str, size_t nread); + +#endif /* HEADER_CURL_POP3_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/progress.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/progress.h new file mode 100644 index 0000000000000000000000000000000000000000..fc39e34d200c944af3af7622518914e6f81d92a3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/progress.h @@ -0,0 +1,76 @@ +#ifndef HEADER_CURL_PROGRESS_H +#define HEADER_CURL_PROGRESS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "timeval.h" + + +typedef enum { + TIMER_NONE, + TIMER_STARTOP, + TIMER_STARTSINGLE, + TIMER_NAMELOOKUP, + TIMER_CONNECT, + TIMER_APPCONNECT, + TIMER_PRETRANSFER, + TIMER_STARTTRANSFER, + TIMER_POSTRANSFER, + TIMER_STARTACCEPT, + TIMER_REDIRECT, + TIMER_LAST /* must be last */ +} timerid; + +int Curl_pgrsDone(struct Curl_easy *data); +void Curl_pgrsStartNow(struct Curl_easy *data); +void Curl_pgrsSetDownloadSize(struct Curl_easy *data, curl_off_t size); +void Curl_pgrsSetUploadSize(struct Curl_easy *data, curl_off_t size); + +/* It is fine to not check the return code if 'size' is set to 0 */ +CURLcode Curl_pgrsSetDownloadCounter(struct Curl_easy *data, curl_off_t size); + +void Curl_pgrsSetUploadCounter(struct Curl_easy *data, curl_off_t size); +void Curl_ratelimit(struct Curl_easy *data, struct curltime now); +int Curl_pgrsUpdate(struct Curl_easy *data); +void Curl_pgrsResetTransferSizes(struct Curl_easy *data); +struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer); +timediff_t Curl_pgrsLimitWaitTime(curl_off_t cursize, + curl_off_t startsize, + curl_off_t limit, + struct curltime start, + struct curltime now); +/** + * Update progress timer with the elapsed time from its start to `timestamp`. + * This allows updating timers later and is used by happy eyeballing, where + * we only want to record the winner's times. + */ +void Curl_pgrsTimeWas(struct Curl_easy *data, timerid timer, + struct curltime timestamp); + +#define PGRS_HIDE (1<<4) +#define PGRS_UL_SIZE_KNOWN (1<<5) +#define PGRS_DL_SIZE_KNOWN (1<<6) +#define PGRS_HEADERS_OUT (1<<7) /* set when the headers have been written */ + +#endif /* HEADER_CURL_PROGRESS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/psl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/psl.h new file mode 100644 index 0000000000000000000000000000000000000000..23cfa921c4bcf280e39966d210d3e0ba2b6322c9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/psl.h @@ -0,0 +1,49 @@ +#ifndef HEADER_PSL_H +#define HEADER_PSL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#ifdef USE_LIBPSL +#include + +#define PSL_TTL (72 * 3600) /* PSL time to live before a refresh. */ + +struct PslCache { + const psl_ctx_t *psl; /* The PSL. */ + time_t expires; /* Time this PSL life expires. */ + bool dynamic; /* PSL should be released when no longer needed. */ +}; + +const psl_ctx_t *Curl_psl_use(struct Curl_easy *easy); +void Curl_psl_release(struct Curl_easy *easy); +void Curl_psl_destroy(struct PslCache *pslcache); + +#else + +#define Curl_psl_use(easy) NULL +#define Curl_psl_release(easy) +#define Curl_psl_destroy(pslcache) + +#endif /* USE_LIBPSL */ +#endif /* HEADER_PSL_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/rand.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/rand.h new file mode 100644 index 0000000000000000000000000000000000000000..1d009f52c0bcb025408a1c321e2c3724b4aa89af --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/rand.h @@ -0,0 +1,50 @@ +#ifndef HEADER_CURL_RAND_H +#define HEADER_CURL_RAND_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +CURLcode Curl_rand(struct Curl_easy *data, unsigned char *rnd, size_t num); + +/* + * Curl_rand_hex() fills the 'rnd' buffer with a given 'num' size with random + * hexadecimal digits PLUS a null-terminating byte. It must be an odd number + * size. + */ +CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned char *rnd, + size_t num); + +/* + * Curl_rand_alnum() fills the 'rnd' buffer with a given 'num' size with random + * alphanumerical chars PLUS a null-terminating byte. + */ +CURLcode Curl_rand_alnum(struct Curl_easy *data, unsigned char *rnd, + size_t num); + +#ifdef WIN32 +/* Random generator shared between the Schannel vtls and Curl_rand*() + functions */ +CURLcode Curl_win32_random(unsigned char *entropy, size_t length); +#endif + +#endif /* HEADER_CURL_RAND_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/rename.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/rename.h new file mode 100644 index 0000000000000000000000000000000000000000..04440820c542ba834868fcab3f4ab70d5a61f3b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/rename.h @@ -0,0 +1,29 @@ +#ifndef HEADER_CURL_RENAME_H +#define HEADER_CURL_RENAME_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +int Curl_rename(const char *oldpath, const char *newpath); + +#endif /* HEADER_CURL_RENAME_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/rtsp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/rtsp.h new file mode 100644 index 0000000000000000000000000000000000000000..111bac2a61242d8329d95c241f6a38b16aa4502a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/rtsp.h @@ -0,0 +1,71 @@ +#ifndef HEADER_CURL_RTSP_H +#define HEADER_CURL_RTSP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#ifdef USE_HYPER +#define CURL_DISABLE_RTSP 1 +#endif + +#ifndef CURL_DISABLE_RTSP + +extern const struct Curl_handler Curl_handler_rtsp; + +CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, char *header); + +#else +/* disabled */ +#define Curl_rtsp_parseheader(x,y) CURLE_NOT_BUILT_IN + +#endif /* CURL_DISABLE_RTSP */ + +/* + * RTSP Connection data + * + * Currently, only used for tracking incomplete RTP data reads + */ +struct rtsp_conn { + struct dynbuf buf; + int rtp_channel; +}; + +/**************************************************************************** + * RTSP unique setup + ***************************************************************************/ +struct RTSP { + /* + * http_wrapper MUST be the first element of this structure for the wrap + * logic to work. In this way, we get a cheap polymorphism because + * &(data->state.proto.rtsp) == &(data->state.proto.http) per the C spec + * + * HTTP functions can safely treat this as an HTTP struct, but RTSP aware + * functions can also index into the later elements. + */ + struct HTTP http_wrapper; /* wrap HTTP to do the heavy lifting */ + + long CSeq_sent; /* CSeq of this request */ + long CSeq_recv; /* CSeq received */ +}; + + +#endif /* HEADER_CURL_RTSP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/select.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/select.h new file mode 100644 index 0000000000000000000000000000000000000000..5b1ca23eb1b2507b92eb13303c42a76870494886 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/select.h @@ -0,0 +1,114 @@ +#ifndef HEADER_CURL_SELECT_H +#define HEADER_CURL_SELECT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef HAVE_POLL_H +#include +#elif defined(HAVE_SYS_POLL_H) +#include +#endif + +/* + * Definition of pollfd struct and constants for platforms lacking them. + */ + +#if !defined(HAVE_SYS_POLL_H) && \ + !defined(HAVE_POLL_H) && \ + !defined(POLLIN) + +#define POLLIN 0x01 +#define POLLPRI 0x02 +#define POLLOUT 0x04 +#define POLLERR 0x08 +#define POLLHUP 0x10 +#define POLLNVAL 0x20 + +struct pollfd +{ + curl_socket_t fd; + short events; + short revents; +}; + +#endif + +#ifndef POLLRDNORM +#define POLLRDNORM POLLIN +#endif + +#ifndef POLLWRNORM +#define POLLWRNORM POLLOUT +#endif + +#ifndef POLLRDBAND +#define POLLRDBAND POLLPRI +#endif + +/* there are three CSELECT defines that are defined in the public header that + are exposed to users, but this *IN2 bit is only ever used internally and + therefore defined here */ +#define CURL_CSELECT_IN2 (CURL_CSELECT_ERR << 1) + +int Curl_socket_check(curl_socket_t readfd, curl_socket_t readfd2, + curl_socket_t writefd, + timediff_t timeout_ms); +#define SOCKET_READABLE(x,z) \ + Curl_socket_check(x, CURL_SOCKET_BAD, CURL_SOCKET_BAD, z) +#define SOCKET_WRITABLE(x,z) \ + Curl_socket_check(CURL_SOCKET_BAD, CURL_SOCKET_BAD, x, z) + +int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms); +int Curl_wait_ms(timediff_t timeout_ms); + +/* + With Winsock the valid range is [0..INVALID_SOCKET-1] according to + https://docs.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2 +*/ +#ifdef USE_WINSOCK +#define VALID_SOCK(s) ((s) < INVALID_SOCKET) +#define FDSET_SOCK(x) 1 +#define VERIFY_SOCK(x) do { \ + if(!VALID_SOCK(x)) { \ + SET_SOCKERRNO(WSAEINVAL); \ + return -1; \ + } \ +} while(0) +#else +#define VALID_SOCK(s) ((s) >= 0) + +/* If the socket is small enough to get set or read from an fdset */ +#define FDSET_SOCK(s) ((s) < FD_SETSIZE) + +#define VERIFY_SOCK(x) do { \ + if(!VALID_SOCK(x) || !FDSET_SOCK(x)) { \ + SET_SOCKERRNO(EINVAL); \ + return -1; \ + } \ + } while(0) +#endif + +#endif /* HEADER_CURL_SELECT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/sendf.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/sendf.h new file mode 100644 index 0000000000000000000000000000000000000000..9ee00bb0df2abb7c764c433a5d96588e03ed7b8a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/sendf.h @@ -0,0 +1,110 @@ +#ifndef HEADER_CURL_SENDF_H +#define HEADER_CURL_SENDF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#include "curl_trc.h" + +/** + * Type of data that is being written to the client (application) + * - data written can be either BODY or META data + * - META data is either INFO or HEADER + * - INFO is meta information, e.g. not BODY, that cannot be interpreted + * as headers of a response. Example FTP/IMAP pingpong answers. + * - HEADER can have additional bits set (more than one) + * - STATUS special "header", e.g. response status line in HTTP + * - CONNECT header was received during proxying the connection + * - 1XX header is part of an intermediate response, e.g. HTTP 1xx code + * - TRAILER header is trailing response data, e.g. HTTP trailers + * BODY, INFO and HEADER should not be mixed, as this would lead to + * confusion on how to interpret/format/convert the data. + */ +#define CLIENTWRITE_BODY (1<<0) /* non-meta information, BODY */ +#define CLIENTWRITE_INFO (1<<1) /* meta information, not a HEADER */ +#define CLIENTWRITE_HEADER (1<<2) /* meta information, HEADER */ +#define CLIENTWRITE_STATUS (1<<3) /* a special status HEADER */ +#define CLIENTWRITE_CONNECT (1<<4) /* a CONNECT related HEADER */ +#define CLIENTWRITE_1XX (1<<5) /* a 1xx response related HEADER */ +#define CLIENTWRITE_TRAILER (1<<6) /* a trailer HEADER */ + +CURLcode Curl_client_write(struct Curl_easy *data, int type, char *ptr, + size_t len) WARN_UNUSED_RESULT; + +CURLcode Curl_client_unpause(struct Curl_easy *data); +void Curl_client_cleanup(struct Curl_easy *data); + +struct contenc_writer { + const struct content_encoding *handler; /* Encoding handler. */ + struct contenc_writer *downstream; /* Downstream writer. */ + unsigned int order; /* Ordering within writer stack. */ +}; + +/* Content encoding writer. */ +struct content_encoding { + const char *name; /* Encoding name. */ + const char *alias; /* Encoding name alias. */ + CURLcode (*init_writer)(struct Curl_easy *data, + struct contenc_writer *writer); + CURLcode (*unencode_write)(struct Curl_easy *data, + struct contenc_writer *writer, + const char *buf, size_t nbytes); + void (*close_writer)(struct Curl_easy *data, + struct contenc_writer *writer); + size_t writersize; +}; + + +CURLcode Curl_client_create_writer(struct contenc_writer **pwriter, + struct Curl_easy *data, + const struct content_encoding *ce_handler, + int order); + +void Curl_client_free_writer(struct Curl_easy *data, + struct contenc_writer *writer); + +CURLcode Curl_client_add_writer(struct Curl_easy *data, + struct contenc_writer *writer); + + +/* internal read-function, does plain socket, SSL and krb4 */ +CURLcode Curl_read(struct Curl_easy *data, curl_socket_t sockfd, + char *buf, size_t buffersize, + ssize_t *n); + +/* internal write-function, does plain socket, SSL, SCP, SFTP and krb4 */ +CURLcode Curl_write(struct Curl_easy *data, + curl_socket_t sockfd, + const void *mem, size_t len, + ssize_t *written); + +/* internal write-function, using sockindex for connection destination */ +CURLcode Curl_nwrite(struct Curl_easy *data, + int sockindex, + const void *buf, + size_t blen, + ssize_t *pnwritten); + +#endif /* HEADER_CURL_SENDF_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/setopt.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/setopt.h new file mode 100644 index 0000000000000000000000000000000000000000..3c14a05e3749d07a50d3efb927bfe0c57503e114 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/setopt.h @@ -0,0 +1,32 @@ +#ifndef HEADER_CURL_SETOPT_H +#define HEADER_CURL_SETOPT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +CURLcode Curl_setstropt(char **charp, const char *s); +CURLcode Curl_setblobopt(struct curl_blob **blobp, + const struct curl_blob *blob); +CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list arg); + +#endif /* HEADER_CURL_SETOPT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/setup-os400.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/setup-os400.h new file mode 100644 index 0000000000000000000000000000000000000000..53e91777eca69babb1f6e48ec8ce03b833d4b3f5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/setup-os400.h @@ -0,0 +1,144 @@ +#ifndef HEADER_CURL_SETUP_OS400_H +#define HEADER_CURL_SETUP_OS400_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + + +/* OS/400 netdb.h does not define NI_MAXHOST. */ +#define NI_MAXHOST 1025 + +/* OS/400 netdb.h does not define NI_MAXSERV. */ +#define NI_MAXSERV 32 + +/* No OS/400 header file defines u_int32_t. */ +typedef unsigned long u_int32_t; + +/* OS/400 has no idea of a tty! */ +#define isatty(fd) 0 + + +/* System API wrapper prototypes & definitions to support ASCII parameters. */ + +#include +#include +#include +#include +#include + +extern int Curl_getaddrinfo_a(const char *nodename, + const char *servname, + const struct addrinfo *hints, + struct addrinfo **res); +#define getaddrinfo Curl_getaddrinfo_a + +/* Note socklen_t must be used as this is declared before curl_socklen_t */ +extern int Curl_getnameinfo_a(const struct sockaddr *sa, + socklen_t salen, + char *nodename, socklen_t nodenamelen, + char *servname, socklen_t servnamelen, + int flags); +#define getnameinfo Curl_getnameinfo_a + +/* GSSAPI wrappers. */ + +extern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status, + gss_buffer_t in_name, + gss_OID in_name_type, + gss_name_t * out_name); +#define gss_import_name Curl_gss_import_name_a + + +extern OM_uint32 Curl_gss_display_status_a(OM_uint32 * minor_status, + OM_uint32 status_value, + int status_type, gss_OID mech_type, + gss_msg_ctx_t * message_context, + gss_buffer_t status_string); +#define gss_display_status Curl_gss_display_status_a + + +extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status, + gss_cred_id_t cred_handle, + gss_ctx_id_t * context_handle, + gss_name_t target_name, + gss_OID mech_type, + gss_flags_t req_flags, + OM_uint32 time_req, + gss_channel_bindings_t + input_chan_bindings, + gss_buffer_t input_token, + gss_OID * actual_mech_type, + gss_buffer_t output_token, + gss_flags_t * ret_flags, + OM_uint32 * time_rec); +#define gss_init_sec_context Curl_gss_init_sec_context_a + + +extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 * minor_status, + gss_ctx_id_t * context_handle, + gss_buffer_t output_token); +#define gss_delete_sec_context Curl_gss_delete_sec_context_a + + +/* LDAP wrappers. */ + +#define BerValue struct berval + +#define ldap_url_parse ldap_url_parse_utf8 +#define ldap_init Curl_ldap_init_a +#define ldap_simple_bind_s Curl_ldap_simple_bind_s_a +#define ldap_search_s Curl_ldap_search_s_a +#define ldap_get_values_len Curl_ldap_get_values_len_a +#define ldap_err2string Curl_ldap_err2string_a +#define ldap_get_dn Curl_ldap_get_dn_a +#define ldap_first_attribute Curl_ldap_first_attribute_a +#define ldap_next_attribute Curl_ldap_next_attribute_a + +/* Some socket functions must be wrapped to process textual addresses + like AF_UNIX. */ + +extern int Curl_os400_connect(int sd, struct sockaddr *destaddr, int addrlen); +extern int Curl_os400_bind(int sd, struct sockaddr *localaddr, int addrlen); +extern int Curl_os400_sendto(int sd, char *buffer, int buflen, int flags, + const struct sockaddr *dstaddr, int addrlen); +extern int Curl_os400_recvfrom(int sd, char *buffer, int buflen, int flags, + struct sockaddr *fromaddr, int *addrlen); +extern int Curl_os400_getpeername(int sd, struct sockaddr *addr, int *addrlen); +extern int Curl_os400_getsockname(int sd, struct sockaddr *addr, int *addrlen); + +#define connect Curl_os400_connect +#define bind Curl_os400_bind +#define sendto Curl_os400_sendto +#define recvfrom Curl_os400_recvfrom +#define getpeername Curl_os400_getpeername +#define getsockname Curl_os400_getsockname + +#ifdef HAVE_LIBZ +#define zlibVersion Curl_os400_zlibVersion +#define inflateInit_ Curl_os400_inflateInit_ +#define inflateInit2_ Curl_os400_inflateInit2_ +#define inflate Curl_os400_inflate +#define inflateEnd Curl_os400_inflateEnd +#endif + +#endif /* HEADER_CURL_SETUP_OS400_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/setup-vms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/setup-vms.h new file mode 100644 index 0000000000000000000000000000000000000000..645cc1a9cda7fb80347e80a7b158ca2e4400a274 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/setup-vms.h @@ -0,0 +1,444 @@ +#ifndef HEADER_CURL_SETUP_VMS_H +#define HEADER_CURL_SETUP_VMS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* */ +/* JEM, 12/30/12, VMS now generates config.h, so only define wrappers for */ +/* getenv(), getpwuid() and provide is_vms_shell() */ +/* Also need upper case symbols for system services, and */ +/* OpenSSL, and some Kerberos image */ + +#ifdef __DECC +#pragma message save +#pragma message disable dollarid +#endif + +/* Hide the stuff we are overriding */ +#define getenv decc_getenv +#ifdef __DECC +# if __INITIAL_POINTER_SIZE != 64 +# define getpwuid decc_getpwuid +# endif +#endif +#include +char *decc$getenv(const char *__name); +#include + +#include +#include + +#undef getenv +#undef getpwuid +#define getenv vms_getenv +#define getpwuid vms_getpwuid + +/* VAX needs these in upper case when compiling exact case */ +#define sys$assign SYS$ASSIGN +#define sys$dassgn SYS$DASSGN +#define sys$qiow SYS$QIOW + +#ifdef __DECC +# if __INITIAL_POINTER_SIZE +# pragma __pointer_size __save +# endif +#endif + +#if __USE_LONG_GID_T +# define decc_getpwuid DECC$__LONG_GID_GETPWUID +#else +# if __INITIAL_POINTER_SIZE +# define decc_getpwuid decc$__32_getpwuid +# else +# define decc_getpwuid decc$getpwuid +# endif +#endif + + struct passwd *decc_getpwuid(uid_t uid); + +#ifdef __DECC +# if __INITIAL_POINTER_SIZE == 32 +/* Translate the path, but only if the path is a VMS file specification */ +/* The translation is usually only needed for older versions of VMS */ +static char *vms_translate_path(const char *path) +{ + char *unix_path; + char *test_str; + + /* See if the result is in VMS format, if not, we are done */ + /* Assume that this is a PATH, not just some data */ + test_str = strpbrk(path, ":[<^"); + if(!test_str) { + return (char *)path; + } + + unix_path = decc$translate_vms(path); + + if((int)unix_path <= 0) { + /* We can not translate it, so return the original string */ + return (char *)path; + } +} +# else + /* VMS translate path is actually not needed on the current 64 bit */ + /* VMS platforms, so instead of figuring out the pointer settings */ + /* Change it to a noop */ +# define vms_translate_path(__path) __path +# endif +#endif + +#ifdef __DECC +# if __INITIAL_POINTER_SIZE +# pragma __pointer_size __restore +# endif +#endif + +static char *vms_getenv(const char *envvar) +{ + char *result; + char *vms_path; + + /* first use the DECC getenv() function */ + result = decc$getenv(envvar); + if(!result) { + return result; + } + + vms_path = result; + result = vms_translate_path(vms_path); + + /* note that if you backport this to use VAX C RTL, that the VAX C RTL */ + /* may do a malloc(2048) for each call to getenv(), so you will need */ + /* to add a free(vms_path) */ + /* Do not do a free() for DEC C RTL builds, which should be used for */ + /* VMS 5.5-2 and later, even if using GCC */ + + return result; +} + + +static struct passwd vms_passwd_cache; + +static struct passwd *vms_getpwuid(uid_t uid) +{ + struct passwd *my_passwd; + +/* Hack needed to support 64 bit builds, decc_getpwnam is 32 bit only */ +#ifdef __DECC +# if __INITIAL_POINTER_SIZE + __char_ptr32 unix_path; +# else + char *unix_path; +# endif +#else + char *unix_path; +#endif + + my_passwd = decc_getpwuid(uid); + if(!my_passwd) { + return my_passwd; + } + + unix_path = vms_translate_path(my_passwd->pw_dir); + + if((long)unix_path <= 0) { + /* We can not translate it, so return the original string */ + return my_passwd; + } + + /* If no changes needed just return it */ + if(unix_path == my_passwd->pw_dir) { + return my_passwd; + } + + /* Need to copy the structure returned */ + /* Since curl is only using pw_dir, no need to fix up */ + /* the pw_shell when running under Bash */ + vms_passwd_cache.pw_name = my_passwd->pw_name; + vms_passwd_cache.pw_uid = my_passwd->pw_uid; + vms_passwd_cache.pw_gid = my_passwd->pw_uid; + vms_passwd_cache.pw_dir = unix_path; + vms_passwd_cache.pw_shell = my_passwd->pw_shell; + + return &vms_passwd_cache; +} + +#ifdef __DECC +#pragma message restore +#endif + +/* Bug - VMS OpenSSL and Kerberos universal symbols are in uppercase only */ +/* VMS libraries should have universal symbols in exact and uppercase */ + +#define ASN1_INTEGER_get ASN1_INTEGER_GET +#define ASN1_STRING_data ASN1_STRING_DATA +#define ASN1_STRING_length ASN1_STRING_LENGTH +#define ASN1_STRING_print ASN1_STRING_PRINT +#define ASN1_STRING_to_UTF8 ASN1_STRING_TO_UTF8 +#define ASN1_STRING_type ASN1_STRING_TYPE +#define BIO_ctrl BIO_CTRL +#define BIO_free BIO_FREE +#define BIO_new BIO_NEW +#define BIO_s_mem BIO_S_MEM +#define BN_bn2bin BN_BN2BIN +#define BN_num_bits BN_NUM_BITS +#define CRYPTO_cleanup_all_ex_data CRYPTO_CLEANUP_ALL_EX_DATA +#define CRYPTO_free CRYPTO_FREE +#define CRYPTO_malloc CRYPTO_MALLOC +#define CONF_modules_load_file CONF_MODULES_LOAD_FILE +#ifdef __VAX +# ifdef VMS_OLD_SSL + /* Ancient OpenSSL on VAX/VMS missing this constant */ +# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 +# undef CONF_modules_load_file + static int CONF_modules_load_file(const char *filename, + const char *appname, + unsigned long flags) { + return 1; + } +# endif +#endif +#define DES_ecb_encrypt DES_ECB_ENCRYPT +#define DES_set_key DES_SET_KEY +#define DES_set_odd_parity DES_SET_ODD_PARITY +#define ENGINE_ctrl ENGINE_CTRL +#define ENGINE_ctrl_cmd ENGINE_CTRL_CMD +#define ENGINE_finish ENGINE_FINISH +#define ENGINE_free ENGINE_FREE +#define ENGINE_get_first ENGINE_GET_FIRST +#define ENGINE_get_id ENGINE_GET_ID +#define ENGINE_get_next ENGINE_GET_NEXT +#define ENGINE_init ENGINE_INIT +#define ENGINE_load_builtin_engines ENGINE_LOAD_BUILTIN_ENGINES +#define ENGINE_load_private_key ENGINE_LOAD_PRIVATE_KEY +#define ENGINE_set_default ENGINE_SET_DEFAULT +#define ERR_clear_error ERR_CLEAR_ERROR +#define ERR_error_string ERR_ERROR_STRING +#define ERR_error_string_n ERR_ERROR_STRING_N +#define ERR_free_strings ERR_FREE_STRINGS +#define ERR_get_error ERR_GET_ERROR +#define ERR_peek_error ERR_PEEK_ERROR +#define ERR_remove_state ERR_REMOVE_STATE +#define EVP_PKEY_copy_parameters EVP_PKEY_COPY_PARAMETERS +#define EVP_PKEY_free EVP_PKEY_FREE +#define EVP_cleanup EVP_CLEANUP +#define GENERAL_NAMES_free GENERAL_NAMES_FREE +#define i2d_X509_PUBKEY I2D_X509_PUBKEY +#define MD4_Final MD4_FINAL +#define MD4_Init MD4_INIT +#define MD4_Update MD4_UPDATE +#define MD5_Final MD5_FINAL +#define MD5_Init MD5_INIT +#define MD5_Update MD5_UPDATE +#define OPENSSL_add_all_algo_noconf OPENSSL_ADD_ALL_ALGO_NOCONF +#ifndef __VAX +#define OPENSSL_load_builtin_modules OPENSSL_LOAD_BUILTIN_MODULES +#endif +#define PEM_read_X509 PEM_READ_X509 +#define PEM_write_bio_X509 PEM_WRITE_BIO_X509 +#define PKCS12_PBE_add PKCS12_PBE_ADD +#define PKCS12_free PKCS12_FREE +#define PKCS12_parse PKCS12_PARSE +#define RAND_add RAND_ADD +#define RAND_bytes RAND_BYTES +#define RAND_file_name RAND_FILE_NAME +#define RAND_load_file RAND_LOAD_FILE +#define RAND_status RAND_STATUS +#define SSL_CIPHER_get_name SSL_CIPHER_GET_NAME +#define SSL_CTX_add_client_CA SSL_CTX_ADD_CLIENT_CA +#define SSL_CTX_callback_ctrl SSL_CTX_CALLBACK_CTRL +#define SSL_CTX_check_private_key SSL_CTX_CHECK_PRIVATE_KEY +#define SSL_CTX_ctrl SSL_CTX_CTRL +#define SSL_CTX_free SSL_CTX_FREE +#define SSL_CTX_get_cert_store SSL_CTX_GET_CERT_STORE +#define SSL_CTX_load_verify_locations SSL_CTX_LOAD_VERIFY_LOCATIONS +#define SSL_CTX_new SSL_CTX_NEW +#define SSL_CTX_set_cipher_list SSL_CTX_SET_CIPHER_LIST +#define SSL_CTX_set_def_passwd_cb_ud SSL_CTX_SET_DEF_PASSWD_CB_UD +#define SSL_CTX_set_default_passwd_cb SSL_CTX_SET_DEFAULT_PASSWD_CB +#define SSL_CTX_set_msg_callback SSL_CTX_SET_MSG_CALLBACK +#define SSL_CTX_set_verify SSL_CTX_SET_VERIFY +#define SSL_CTX_use_PrivateKey SSL_CTX_USE_PRIVATEKEY +#define SSL_CTX_use_PrivateKey_file SSL_CTX_USE_PRIVATEKEY_FILE +#define SSL_CTX_use_cert_chain_file SSL_CTX_USE_CERT_CHAIN_FILE +#define SSL_CTX_use_certificate SSL_CTX_USE_CERTIFICATE +#define SSL_CTX_use_certificate_file SSL_CTX_USE_CERTIFICATE_FILE +#define SSL_SESSION_free SSL_SESSION_FREE +#define SSL_connect SSL_CONNECT +#define SSL_free SSL_FREE +#define SSL_get1_session SSL_GET1_SESSION +#define SSL_get_certificate SSL_GET_CERTIFICATE +#define SSL_get_current_cipher SSL_GET_CURRENT_CIPHER +#define SSL_get_error SSL_GET_ERROR +#define SSL_get_peer_cert_chain SSL_GET_PEER_CERT_CHAIN +#define SSL_get_peer_certificate SSL_GET_PEER_CERTIFICATE +#define SSL_get_privatekey SSL_GET_PRIVATEKEY +#define SSL_get_session SSL_GET_SESSION +#define SSL_get_shutdown SSL_GET_SHUTDOWN +#define SSL_get_verify_result SSL_GET_VERIFY_RESULT +#define SSL_library_init SSL_LIBRARY_INIT +#define SSL_load_error_strings SSL_LOAD_ERROR_STRINGS +#define SSL_new SSL_NEW +#define SSL_peek SSL_PEEK +#define SSL_pending SSL_PENDING +#define SSL_read SSL_READ +#define SSL_set_connect_state SSL_SET_CONNECT_STATE +#define SSL_set_fd SSL_SET_FD +#define SSL_set_session SSL_SET_SESSION +#define SSL_shutdown SSL_SHUTDOWN +#define SSL_version SSL_VERSION +#define SSL_write SSL_WRITE +#define SSLeay SSLEAY +#define SSLv23_client_method SSLV23_CLIENT_METHOD +#define SSLv3_client_method SSLV3_CLIENT_METHOD +#define TLSv1_client_method TLSV1_CLIENT_METHOD +#define UI_create_method UI_CREATE_METHOD +#define UI_destroy_method UI_DESTROY_METHOD +#define UI_get0_user_data UI_GET0_USER_DATA +#define UI_get_input_flags UI_GET_INPUT_FLAGS +#define UI_get_string_type UI_GET_STRING_TYPE +#define UI_create_method UI_CREATE_METHOD +#define UI_destroy_method UI_DESTROY_METHOD +#define UI_method_get_closer UI_METHOD_GET_CLOSER +#define UI_method_get_opener UI_METHOD_GET_OPENER +#define UI_method_get_reader UI_METHOD_GET_READER +#define UI_method_get_writer UI_METHOD_GET_WRITER +#define UI_method_set_closer UI_METHOD_SET_CLOSER +#define UI_method_set_opener UI_METHOD_SET_OPENER +#define UI_method_set_reader UI_METHOD_SET_READER +#define UI_method_set_writer UI_METHOD_SET_WRITER +#define UI_OpenSSL UI_OPENSSL +#define UI_set_result UI_SET_RESULT +#define X509V3_EXT_print X509V3_EXT_PRINT +#define X509_EXTENSION_get_critical X509_EXTENSION_GET_CRITICAL +#define X509_EXTENSION_get_data X509_EXTENSION_GET_DATA +#define X509_EXTENSION_get_object X509_EXTENSION_GET_OBJECT +#define X509_LOOKUP_file X509_LOOKUP_FILE +#define X509_NAME_ENTRY_get_data X509_NAME_ENTRY_GET_DATA +#define X509_NAME_get_entry X509_NAME_GET_ENTRY +#define X509_NAME_get_index_by_NID X509_NAME_GET_INDEX_BY_NID +#define X509_NAME_print_ex X509_NAME_PRINT_EX +#define X509_STORE_CTX_get_current_cert X509_STORE_CTX_GET_CURRENT_CERT +#define X509_STORE_add_lookup X509_STORE_ADD_LOOKUP +#define X509_STORE_set_flags X509_STORE_SET_FLAGS +#define X509_check_issued X509_CHECK_ISSUED +#define X509_free X509_FREE +#define X509_get_ext_d2i X509_GET_EXT_D2I +#define X509_get_issuer_name X509_GET_ISSUER_NAME +#define X509_get_pubkey X509_GET_PUBKEY +#define X509_get_serialNumber X509_GET_SERIALNUMBER +#define X509_get_subject_name X509_GET_SUBJECT_NAME +#define X509_load_crl_file X509_LOAD_CRL_FILE +#define X509_verify_cert_error_string X509_VERIFY_CERT_ERROR_STRING +#define d2i_PKCS12_fp D2I_PKCS12_FP +#define i2t_ASN1_OBJECT I2T_ASN1_OBJECT +#define sk_num SK_NUM +#define sk_pop SK_POP +#define sk_pop_free SK_POP_FREE +#define sk_value SK_VALUE +#ifdef __VAX +#define OPENSSL_NO_SHA256 +#endif +#define SHA256_Final SHA256_FINAL +#define SHA256_Init SHA256_INIT +#define SHA256_Update SHA256_UPDATE + +#define USE_UPPERCASE_GSSAPI 1 +#define gss_seal GSS_SEAL +#define gss_unseal GSS_UNSEAL + +#define USE_UPPERCASE_KRBAPI 1 + +/* AI_NUMERICHOST needed for IP V6 support in Curl */ +#ifdef HAVE_NETDB_H +#include +#ifndef AI_NUMERICHOST +#ifdef ENABLE_IPV6 +#undef ENABLE_IPV6 +#endif +#endif +#endif + +/* VAX symbols are always in uppercase */ +#ifdef __VAX +#define inflate INFLATE +#define inflateEnd INFLATEEND +#define inflateInit2_ INFLATEINIT2_ +#define inflateInit_ INFLATEINIT_ +#define zlibVersion ZLIBVERSION +#endif + +/* Older VAX OpenSSL port defines these as Macros */ +/* Need to include the headers first and then redefine */ +/* that way a newer port will also work if some one has one */ +#ifdef __VAX + +# if (OPENSSL_VERSION_NUMBER < 0x00907001L) +# define des_set_odd_parity DES_SET_ODD_PARITY +# define des_set_key DES_SET_KEY +# define des_ecb_encrypt DES_ECB_ENCRYPT + +# endif +# include +# ifndef OpenSSL_add_all_algorithms +# define OpenSSL_add_all_algorithms OPENSSL_ADD_ALL_ALGORITHMS + void OPENSSL_ADD_ALL_ALGORITHMS(void); +# endif + + /* Curl defines these to lower case and VAX needs them in upper case */ + /* So we need static routines */ +# if (OPENSSL_VERSION_NUMBER < 0x00907001L) + +# undef des_set_odd_parity +# undef DES_set_odd_parity +# undef des_set_key +# undef DES_set_key +# undef des_ecb_encrypt +# undef DES_ecb_encrypt + + static void des_set_odd_parity(des_cblock *key) { + DES_SET_ODD_PARITY(key); + } + + static int des_set_key(const_des_cblock *key, + des_key_schedule schedule) { + return DES_SET_KEY(key, schedule); + } + + static void des_ecb_encrypt(const_des_cblock *input, + des_cblock *output, + des_key_schedule ks, int enc) { + DES_ECB_ENCRYPT(input, output, ks, enc); + } +#endif +/* Need this to stop a macro redefinition error */ +#if OPENSSL_VERSION_NUMBER < 0x00907000L +# ifdef X509_STORE_set_flags +# undef X509_STORE_set_flags +# define X509_STORE_set_flags(x,y) Curl_nop_stmt +# endif +#endif +#endif + +#endif /* HEADER_CURL_SETUP_VMS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/share.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/share.h new file mode 100644 index 0000000000000000000000000000000000000000..7f55aac853d5bd4199fa4a012c65499ca8153577 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/share.h @@ -0,0 +1,76 @@ +#ifndef HEADER_CURL_SHARE_H +#define HEADER_CURL_SHARE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include +#include "cookie.h" +#include "psl.h" +#include "urldata.h" +#include "conncache.h" + +/* SalfordC says "A structure member may not be volatile". Hence: + */ +#ifdef __SALFORDC__ +#define CURL_VOLATILE +#else +#define CURL_VOLATILE volatile +#endif + +#define CURL_GOOD_SHARE 0x7e117a1e +#define GOOD_SHARE_HANDLE(x) ((x) && (x)->magic == CURL_GOOD_SHARE) + +/* this struct is libcurl-private, don't export details */ +struct Curl_share { + unsigned int magic; /* CURL_GOOD_SHARE */ + unsigned int specifier; + CURL_VOLATILE unsigned int dirty; + + curl_lock_function lockfunc; + curl_unlock_function unlockfunc; + void *clientdata; + struct conncache conn_cache; + struct Curl_hash hostcache; +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + struct CookieInfo *cookies; +#endif +#ifdef USE_LIBPSL + struct PslCache psl; +#endif +#ifndef CURL_DISABLE_HSTS + struct hsts *hsts; +#endif +#ifdef USE_SSL + struct Curl_ssl_session *sslsession; + size_t max_ssl_sessions; + long sessionage; +#endif +}; + +CURLSHcode Curl_share_lock(struct Curl_easy *, curl_lock_data, + curl_lock_access); +CURLSHcode Curl_share_unlock(struct Curl_easy *, curl_lock_data); + +#endif /* HEADER_CURL_SHARE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/sigpipe.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/sigpipe.h new file mode 100644 index 0000000000000000000000000000000000000000..9b29403c28f67cb2e1769fa30f1b88129a11ba98 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/sigpipe.h @@ -0,0 +1,80 @@ +#ifndef HEADER_CURL_SIGPIPE_H +#define HEADER_CURL_SIGPIPE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#if defined(HAVE_SIGACTION) && \ + (defined(USE_OPENSSL) || defined(USE_MBEDTLS) || defined(USE_WOLFSSL)) +#include + +struct sigpipe_ignore { + struct sigaction old_pipe_act; + bool no_signal; +}; + +#define SIGPIPE_VARIABLE(x) struct sigpipe_ignore x + +/* + * sigpipe_ignore() makes sure we ignore SIGPIPE while running libcurl + * internals, and then sigpipe_restore() will restore the situation when we + * return from libcurl again. + */ +static void sigpipe_ignore(struct Curl_easy *data, + struct sigpipe_ignore *ig) +{ + /* get a local copy of no_signal because the Curl_easy might not be + around when we restore */ + ig->no_signal = data->set.no_signal; + if(!data->set.no_signal) { + struct sigaction action; + /* first, extract the existing situation */ + sigaction(SIGPIPE, NULL, &ig->old_pipe_act); + action = ig->old_pipe_act; + /* ignore this signal */ + action.sa_handler = SIG_IGN; + sigaction(SIGPIPE, &action, NULL); + } +} + +/* + * sigpipe_restore() puts back the outside world's opinion of signal handler + * and SIGPIPE handling. It MUST only be called after a corresponding + * sigpipe_ignore() was used. + */ +static void sigpipe_restore(struct sigpipe_ignore *ig) +{ + if(!ig->no_signal) + /* restore the outside state */ + sigaction(SIGPIPE, &ig->old_pipe_act, NULL); +} + +#else +/* for systems without sigaction */ +#define sigpipe_ignore(x,y) Curl_nop_stmt +#define sigpipe_restore(x) Curl_nop_stmt +#define SIGPIPE_VARIABLE(x) +#endif + +#endif /* HEADER_CURL_SIGPIPE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/slist.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/slist.h new file mode 100644 index 0000000000000000000000000000000000000000..9561fd022686024191b4e61a418353120c14a635 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/slist.h @@ -0,0 +1,41 @@ +#ifndef HEADER_CURL_SLIST_H +#define HEADER_CURL_SLIST_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* + * Curl_slist_duplicate() duplicates a linked list. It always returns the + * address of the first record of the cloned list or NULL in case of an + * error (or if the input list was NULL). + */ +struct curl_slist *Curl_slist_duplicate(struct curl_slist *inlist); + +/* + * Curl_slist_append_nodup() takes ownership of the given string and appends + * it to the list. + */ +struct curl_slist *Curl_slist_append_nodup(struct curl_slist *list, + char *data); + +#endif /* HEADER_CURL_SLIST_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/smb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/smb.h new file mode 100644 index 0000000000000000000000000000000000000000..437f4a58a85d7dcb14e68665e0bd56a6e24e6d8a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/smb.h @@ -0,0 +1,60 @@ +#ifndef HEADER_CURL_SMB_H +#define HEADER_CURL_SMB_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Bill Nagel , Exacq Technologies + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +enum smb_conn_state { + SMB_NOT_CONNECTED = 0, + SMB_CONNECTING, + SMB_NEGOTIATE, + SMB_SETUP, + SMB_CONNECTED +}; + +struct smb_conn { + enum smb_conn_state state; + char *user; + char *domain; + char *share; + unsigned char challenge[8]; + unsigned int session_key; + unsigned short uid; + char *recv_buf; + size_t upload_size; + size_t send_size; + size_t sent; + size_t got; +}; + +#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \ + (SIZEOF_CURL_OFF_T > 4) + +extern const struct Curl_handler Curl_handler_smb; +extern const struct Curl_handler Curl_handler_smbs; + +#endif /* CURL_DISABLE_SMB && USE_CURL_NTLM_CORE && + SIZEOF_CURL_OFF_T > 4 */ + +#endif /* HEADER_CURL_SMB_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/smtp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/smtp.h new file mode 100644 index 0000000000000000000000000000000000000000..7a04c215499f982f9a7d1e7c8fc02d7539fa5005 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/smtp.h @@ -0,0 +1,100 @@ +#ifndef HEADER_CURL_SMTP_H +#define HEADER_CURL_SMTP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "pingpong.h" +#include "curl_sasl.h" + +/**************************************************************************** + * SMTP unique setup + ***************************************************************************/ +typedef enum { + SMTP_STOP, /* do nothing state, stops the state machine */ + SMTP_SERVERGREET, /* waiting for the initial greeting immediately after + a connect */ + SMTP_EHLO, + SMTP_HELO, + SMTP_STARTTLS, + SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS + (multi mode only) */ + SMTP_AUTH, + SMTP_COMMAND, /* VRFY, EXPN, NOOP, RSET and HELP */ + SMTP_MAIL, /* MAIL FROM */ + SMTP_RCPT, /* RCPT TO */ + SMTP_DATA, + SMTP_POSTDATA, + SMTP_QUIT, + SMTP_LAST /* never used */ +} smtpstate; + +/* This SMTP struct is used in the Curl_easy. All SMTP data that is + connection-oriented must be in smtp_conn to properly deal with the fact that + perhaps the Curl_easy is changed between the times the connection is + used. */ +struct SMTP { + curl_pp_transfer transfer; + char *custom; /* Custom Request */ + struct curl_slist *rcpt; /* Recipient list */ + int rcpt_last_error; /* The last error received for RCPT TO command */ + size_t eob; /* Number of bytes of the EOB (End Of Body) that + have been received so far */ + BIT(rcpt_had_ok); /* Whether any of RCPT TO commands (depends on + total number of recipients) succeeded so far */ + BIT(trailing_crlf); /* Specifies if the trailing CRLF is present */ +}; + +/* smtp_conn is used for struct connection-oriented data in the connectdata + struct */ +struct smtp_conn { + struct pingpong pp; + struct SASL sasl; /* SASL-related storage */ + smtpstate state; /* Always use smtp.c:state() to change state! */ + char *domain; /* Client address/name to send in the EHLO */ + BIT(ssldone); /* Is connect() over SSL done? */ + BIT(tls_supported); /* StartTLS capability supported by server */ + BIT(size_supported); /* If server supports SIZE extension according to + RFC 1870 */ + BIT(utf8_supported); /* If server supports SMTPUTF8 extension according + to RFC 6531 */ + BIT(auth_supported); /* AUTH capability supported by server */ +}; + +extern const struct Curl_handler Curl_handler_smtp; +extern const struct Curl_handler Curl_handler_smtps; + +/* this is the 5-bytes End-Of-Body marker for SMTP */ +#define SMTP_EOB "\x0d\x0a\x2e\x0d\x0a" +#define SMTP_EOB_LEN 5 +#define SMTP_EOB_FIND_LEN 3 + +/* if found in data, replace it with this string instead */ +#define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e" +#define SMTP_EOB_REPL_LEN 4 + +CURLcode Curl_smtp_escape_eob(struct Curl_easy *data, + const ssize_t nread, + const ssize_t offset); + +#endif /* HEADER_CURL_SMTP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/sockaddr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/sockaddr.h new file mode 100644 index 0000000000000000000000000000000000000000..5a6bb207dc59838033e73336c20b830f4e6d2fea --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/sockaddr.h @@ -0,0 +1,44 @@ +#ifndef HEADER_CURL_SOCKADDR_H +#define HEADER_CURL_SOCKADDR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +struct Curl_sockaddr_storage { + union { + struct sockaddr sa; + struct sockaddr_in sa_in; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 sa_in6; +#endif +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + struct sockaddr_storage sa_stor; +#else + char cbuf[256]; /* this should be big enough to fit a lot */ +#endif + } buffer; +}; + +#endif /* HEADER_CURL_SOCKADDR_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/socketpair.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/socketpair.h new file mode 100644 index 0000000000000000000000000000000000000000..306ab5dc4c439aab70ca52fe517727102afccbd1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/socketpair.h @@ -0,0 +1,37 @@ +#ifndef HEADER_CURL_SOCKETPAIR_H +#define HEADER_CURL_SOCKETPAIR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#ifndef HAVE_SOCKETPAIR +#include + +int Curl_socketpair(int domain, int type, int protocol, + curl_socket_t socks[2]); +#else +#define Curl_socketpair(a,b,c,d) socketpair(a,b,c,d) +#endif + +#endif /* HEADER_CURL_SOCKETPAIR_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/socks.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/socks.h new file mode 100644 index 0000000000000000000000000000000000000000..a3adcc6e91cd91a8b1eea9e7d38b5ddb80235939 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/socks.h @@ -0,0 +1,61 @@ +#ifndef HEADER_CURL_SOCKS_H +#define HEADER_CURL_SOCKS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef CURL_DISABLE_PROXY +#define Curl_SOCKS4(a,b,c,d,e) CURLE_NOT_BUILT_IN +#define Curl_SOCKS5(a,b,c,d,e,f) CURLE_NOT_BUILT_IN +#define Curl_SOCKS_getsock(x,y,z) 0 +#else +/* + * Helper read-from-socket functions. Does the same as Curl_read() but it + * blocks until all bytes amount of buffersize will be read. No more, no less. + * + * This is STUPID BLOCKING behavior + */ +int Curl_blockread_all(struct Curl_cfilter *cf, + struct Curl_easy *data, + char *buf, + ssize_t buffersize, + ssize_t *n); + +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) +/* + * This function handles the SOCKS5 GSS-API negotiation and initialization + */ +CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, + struct Curl_easy *data); +#endif + +CURLcode Curl_cf_socks_proxy_insert_after(struct Curl_cfilter *cf_at, + struct Curl_easy *data); + +extern struct Curl_cftype Curl_cft_socks_proxy; + +#endif /* CURL_DISABLE_PROXY */ + +#endif /* HEADER_CURL_SOCKS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/speedcheck.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/speedcheck.h new file mode 100644 index 0000000000000000000000000000000000000000..bff2f32b774023b549d5158d85578cf280c2e9a3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/speedcheck.h @@ -0,0 +1,35 @@ +#ifndef HEADER_CURL_SPEEDCHECK_H +#define HEADER_CURL_SPEEDCHECK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#include "timeval.h" + +void Curl_speedinit(struct Curl_easy *data); +CURLcode Curl_speedcheck(struct Curl_easy *data, + struct curltime now); + +#endif /* HEADER_CURL_SPEEDCHECK_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/splay.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/splay.h new file mode 100644 index 0000000000000000000000000000000000000000..dd1d07ac2e0ed22dd573f295d70cd268a3ccf03a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/splay.h @@ -0,0 +1,58 @@ +#ifndef HEADER_CURL_SPLAY_H +#define HEADER_CURL_SPLAY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" +#include "timeval.h" + +struct Curl_tree { + struct Curl_tree *smaller; /* smaller node */ + struct Curl_tree *larger; /* larger node */ + struct Curl_tree *samen; /* points to the next node with identical key */ + struct Curl_tree *samep; /* points to the prev node with identical key */ + struct curltime key; /* this node's "sort" key */ + void *payload; /* data the splay code doesn't care about */ +}; + +struct Curl_tree *Curl_splay(struct curltime i, + struct Curl_tree *t); + +struct Curl_tree *Curl_splayinsert(struct curltime key, + struct Curl_tree *t, + struct Curl_tree *newnode); + +struct Curl_tree *Curl_splaygetbest(struct curltime key, + struct Curl_tree *t, + struct Curl_tree **removed); + +int Curl_splayremove(struct Curl_tree *t, + struct Curl_tree *removenode, + struct Curl_tree **newroot); + +#define Curl_splaycomparekeys(i,j) ( ((i.tv_sec) < (j.tv_sec)) ? -1 : \ + ( ((i.tv_sec) > (j.tv_sec)) ? 1 : \ + ( ((i.tv_usec) < (j.tv_usec)) ? -1 : \ + ( ((i.tv_usec) > (j.tv_usec)) ? 1 : 0)))) + +#endif /* HEADER_CURL_SPLAY_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strcase.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strcase.h new file mode 100644 index 0000000000000000000000000000000000000000..8c50bbcba646e057af1036dd91d5fdf24cd3a0f5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strcase.h @@ -0,0 +1,54 @@ +#ifndef HEADER_CURL_STRCASE_H +#define HEADER_CURL_STRCASE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include + +/* + * Only "raw" case insensitive strings. This is meant to be locale independent + * and only compare strings we know are safe for this. + * + * The function is capable of comparing a-z case insensitively. + * + * Result is 1 if text matches and 0 if not. + */ + +#define strcasecompare(a,b) curl_strequal(a,b) +#define strncasecompare(a,b,c) curl_strnequal(a,b,c) + +char Curl_raw_toupper(char in); +char Curl_raw_tolower(char in); + +/* checkprefix() is a shorter version of the above, used when the first + argument is the string literal */ +#define checkprefix(a,b) curl_strnequal(b, STRCONST(a)) + +void Curl_strntoupper(char *dest, const char *src, size_t n); +void Curl_strntolower(char *dest, const char *src, size_t n); + +bool Curl_safecmp(char *a, char *b); +int Curl_timestrcmp(const char *first, const char *second); + +#endif /* HEADER_CURL_STRCASE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strdup.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strdup.h new file mode 100644 index 0000000000000000000000000000000000000000..c3430b54d564f85d201239f43da8be250fba24be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strdup.h @@ -0,0 +1,37 @@ +#ifndef HEADER_CURL_STRDUP_H +#define HEADER_CURL_STRDUP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifndef HAVE_STRDUP +char *Curl_strdup(const char *str); +#endif +#ifdef WIN32 +wchar_t* Curl_wcsdup(const wchar_t* src); +#endif +void *Curl_memdup(const void *src, size_t buffer_length); +void *Curl_saferealloc(void *ptr, size_t size); + +#endif /* HEADER_CURL_STRDUP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strerror.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strerror.h new file mode 100644 index 0000000000000000000000000000000000000000..399712f8ebb22e99d75d3d9f4c73258014fe87b6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strerror.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_STRERROR_H +#define HEADER_CURL_STRERROR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "urldata.h" + +#define STRERROR_LEN 256 /* a suitable length */ + +const char *Curl_strerror(int err, char *buf, size_t buflen); +#if defined(WIN32) || defined(_WIN32_WCE) +const char *Curl_winapi_strerror(DWORD err, char *buf, size_t buflen); +#endif +#ifdef USE_WINDOWS_SSPI +const char *Curl_sspi_strerror(int err, char *buf, size_t buflen); +#endif + +#endif /* HEADER_CURL_STRERROR_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strtok.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strtok.h new file mode 100644 index 0000000000000000000000000000000000000000..321cba2326200392c637763c23052636ce53406f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strtok.h @@ -0,0 +1,36 @@ +#ifndef HEADER_CURL_STRTOK_H +#define HEADER_CURL_STRTOK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" +#include + +#ifndef HAVE_STRTOK_R +char *Curl_strtok_r(char *s, const char *delim, char **last); +#define strtok_r Curl_strtok_r +#else +#include +#endif + +#endif /* HEADER_CURL_STRTOK_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strtoofft.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strtoofft.h new file mode 100644 index 0000000000000000000000000000000000000000..34d293ba3823b3572a0e91ff37c2b6b481a1aa64 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/strtoofft.h @@ -0,0 +1,54 @@ +#ifndef HEADER_CURL_STRTOOFFT_H +#define HEADER_CURL_STRTOOFFT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +/* + * Determine which string to integral data type conversion function we use + * to implement string conversion to our curl_off_t integral data type. + * + * Notice that curl_off_t might be 64 or 32 bit wide, and that it might use + * an underlying data type which might be 'long', 'int64_t', 'long long' or + * '__int64' and more remotely other data types. + * + * On systems where the size of curl_off_t is greater than the size of 'long' + * the conversion function to use is strtoll() if it is available, otherwise, + * we emulate its functionality with our own clone. + * + * On systems where the size of curl_off_t is smaller or equal than the size + * of 'long' the conversion function to use is strtol(). + */ + +typedef enum { + CURL_OFFT_OK, /* parsed fine */ + CURL_OFFT_FLOW, /* over or underflow */ + CURL_OFFT_INVAL /* nothing was parsed */ +} CURLofft; + +CURLofft curlx_strtoofft(const char *str, char **endp, int base, + curl_off_t *num); + +#endif /* HEADER_CURL_STRTOOFFT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/system_win32.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/system_win32.h new file mode 100644 index 0000000000000000000000000000000000000000..6482643fab9e5c8b9bd7388a4841f49d7528f0b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/system_win32.h @@ -0,0 +1,49 @@ +#ifndef HEADER_CURL_SYSTEM_WIN32_H +#define HEADER_CURL_SYSTEM_WIN32_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Steve Holme, . + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(WIN32) + +extern LARGE_INTEGER Curl_freq; +extern bool Curl_isVistaOrGreater; + +CURLcode Curl_win32_init(long flags); +void Curl_win32_cleanup(long init_flags); + +/* We use our own typedef here since some headers might lack this */ +typedef unsigned int(WINAPI *IF_NAMETOINDEX_FN)(const char *); + +/* This is used instead of if_nametoindex if available on Windows */ +extern IF_NAMETOINDEX_FN Curl_if_nametoindex; + +/* This is used to dynamically load DLLs */ +HMODULE Curl_load_library(LPCTSTR filename); +#else /* WIN32 */ +#define Curl_win32_init(x) CURLE_OK +#endif /* !WIN32 */ + +#endif /* HEADER_CURL_SYSTEM_WIN32_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/telnet.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/telnet.h new file mode 100644 index 0000000000000000000000000000000000000000..30782d8375761a016e40ca21a257e93858c7e274 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/telnet.h @@ -0,0 +1,30 @@ +#ifndef HEADER_CURL_TELNET_H +#define HEADER_CURL_TELNET_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#ifndef CURL_DISABLE_TELNET +extern const struct Curl_handler Curl_handler_telnet; +#endif + +#endif /* HEADER_CURL_TELNET_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/tftp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/tftp.h new file mode 100644 index 0000000000000000000000000000000000000000..5d2d5da6151b9de03e07b6591e483b0b5dd3b27a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/tftp.h @@ -0,0 +1,30 @@ +#ifndef HEADER_CURL_TFTP_H +#define HEADER_CURL_TFTP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#ifndef CURL_DISABLE_TFTP +extern const struct Curl_handler Curl_handler_tftp; +#endif + +#endif /* HEADER_CURL_TFTP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/timediff.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/timediff.h new file mode 100644 index 0000000000000000000000000000000000000000..fb318d4f2b0a12510743b16b016a2b74d07331be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/timediff.h @@ -0,0 +1,52 @@ +#ifndef HEADER_CURL_TIMEDIFF_H +#define HEADER_CURL_TIMEDIFF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +/* Use a larger type even for 32 bit time_t systems so that we can keep + microsecond accuracy in it */ +typedef curl_off_t timediff_t; +#define CURL_FORMAT_TIMEDIFF_T CURL_FORMAT_CURL_OFF_T + +#define TIMEDIFF_T_MAX CURL_OFF_T_MAX +#define TIMEDIFF_T_MIN CURL_OFF_T_MIN + +/* + * Converts number of milliseconds into a timeval structure. + * + * Return values: + * NULL IF tv is NULL or ms < 0 (eg. no timeout -> blocking select) + * tv with 0 in both fields IF ms == 0 (eg. 0ms timeout -> polling select) + * tv with converted fields IF ms > 0 (eg. >0ms timeout -> waiting select) + */ +struct timeval *curlx_mstotv(struct timeval *tv, timediff_t ms); + +/* + * Converts a timeval structure into number of milliseconds. + */ +timediff_t curlx_tvtoms(struct timeval *tv); + +#endif /* HEADER_CURL_TIMEDIFF_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/timeval.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/timeval.h new file mode 100644 index 0000000000000000000000000000000000000000..33dfb5b10dd26b94c8348f03a170423bf5f0da4a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/timeval.h @@ -0,0 +1,62 @@ +#ifndef HEADER_CURL_TIMEVAL_H +#define HEADER_CURL_TIMEVAL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#include "timediff.h" + +struct curltime { + time_t tv_sec; /* seconds */ + int tv_usec; /* microseconds */ +}; + +struct curltime Curl_now(void); + +/* + * Make sure that the first argument (newer) is the more recent time and older + * is the older time, as otherwise you get a weird negative time-diff back... + * + * Returns: the time difference in number of milliseconds. + */ +timediff_t Curl_timediff(struct curltime newer, struct curltime older); + +/* + * Make sure that the first argument (newer) is the more recent time and older + * is the older time, as otherwise you get a weird negative time-diff back... + * + * Returns: the time difference in number of milliseconds, rounded up. + */ +timediff_t Curl_timediff_ceil(struct curltime newer, struct curltime older); + +/* + * Make sure that the first argument (newer) is the more recent time and older + * is the older time, as otherwise you get a weird negative time-diff back... + * + * Returns: the time difference in number of microseconds. + */ +timediff_t Curl_timediff_us(struct curltime newer, struct curltime older); + +#endif /* HEADER_CURL_TIMEVAL_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/transfer.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/transfer.h new file mode 100644 index 0000000000000000000000000000000000000000..536ac249b7c298df82134fce9422e21e8ad42601 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/transfer.h @@ -0,0 +1,73 @@ +#ifndef HEADER_CURL_TRANSFER_H +#define HEADER_CURL_TRANSFER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#define Curl_headersep(x) ((((x)==':') || ((x)==';'))) +char *Curl_checkheaders(const struct Curl_easy *data, + const char *thisheader, + const size_t thislen); + +void Curl_init_CONNECT(struct Curl_easy *data); + +CURLcode Curl_pretransfer(struct Curl_easy *data); +CURLcode Curl_posttransfer(struct Curl_easy *data); + +typedef enum { + FOLLOW_NONE, /* not used within the function, just a placeholder to + allow initing to this */ + FOLLOW_FAKE, /* only records stuff, not actually following */ + FOLLOW_RETRY, /* set if this is a request retry as opposed to a real + redirect following */ + FOLLOW_REDIR /* a full true redirect */ +} followtype; + +CURLcode Curl_follow(struct Curl_easy *data, char *newurl, + followtype type); +CURLcode Curl_readwrite(struct connectdata *conn, + struct Curl_easy *data, bool *done, + bool *comeback); +int Curl_single_getsock(struct Curl_easy *data, + struct connectdata *conn, curl_socket_t *socks); +CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes, + size_t *nreadp); +CURLcode Curl_retry_request(struct Curl_easy *data, char **url); +bool Curl_meets_timecondition(struct Curl_easy *data, time_t timeofdoc); +CURLcode Curl_get_upload_buffer(struct Curl_easy *data); + +CURLcode Curl_done_sending(struct Curl_easy *data, + struct SingleRequest *k); + +/* This sets up a forthcoming transfer */ +void +Curl_setup_transfer (struct Curl_easy *data, + int sockindex, /* socket index to read from or -1 */ + curl_off_t size, /* -1 if unknown at this point */ + bool getheader, /* TRUE if header parsing is wanted */ + int writesockindex /* socket index to write to. May be + the same we read from. -1 + disables */ + ); + +#endif /* HEADER_CURL_TRANSFER_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/url.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/url.h new file mode 100644 index 0000000000000000000000000000000000000000..f6a5b257371c67607b6887207e1933f8a17733c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/url.h @@ -0,0 +1,76 @@ +#ifndef HEADER_CURL_URL_H +#define HEADER_CURL_URL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +/* + * Prototypes for library-wide functions provided by url.c + */ + +CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn); +CURLcode Curl_open(struct Curl_easy **curl); +CURLcode Curl_init_userdefined(struct Curl_easy *data); + +void Curl_freeset(struct Curl_easy *data); +CURLcode Curl_uc_to_curlcode(CURLUcode uc); +CURLcode Curl_close(struct Curl_easy **datap); /* opposite of curl_open() */ +CURLcode Curl_connect(struct Curl_easy *, bool *async, bool *protocol_connect); +void Curl_disconnect(struct Curl_easy *data, + struct connectdata *, bool dead_connection); +CURLcode Curl_setup_conn(struct Curl_easy *data, + bool *protocol_done); +void Curl_free_request_state(struct Curl_easy *data); +CURLcode Curl_parse_login_details(const char *login, const size_t len, + char **userptr, char **passwdptr, + char **optionsptr); + +const struct Curl_handler *Curl_builtin_scheme(const char *scheme, + size_t schemelen); + +#define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */ +#define CURL_DEFAULT_HTTPS_PROXY_PORT 443 /* default https proxy port unless + specified */ + +#ifdef CURL_DISABLE_VERBOSE_STRINGS +#define Curl_verboseconnect(x,y) Curl_nop_stmt +#else +void Curl_verboseconnect(struct Curl_easy *data, struct connectdata *conn); +#endif + +#if defined(USE_HTTP2) || defined(USE_HTTP3) +void Curl_data_priority_clear_state(struct Curl_easy *data); +#else +#define Curl_data_priority_clear_state(x) +#endif /* !(defined(USE_HTTP2) || defined(USE_HTTP3)) */ + +#ifdef USE_NGHTTP2 +CURLcode Curl_data_priority_add_child(struct Curl_easy *parent, + struct Curl_easy *child, + bool exclusive); +#else +#define Curl_data_priority_add_child(x, y, z) CURLE_NOT_BUILT_IN +#endif + +#endif /* HEADER_CURL_URL_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/urlapi-int.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/urlapi-int.h new file mode 100644 index 0000000000000000000000000000000000000000..d6e240aa3698b48c8e31e4d62659dff811763109 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/urlapi-int.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_URLAPI_INT_H +#define HEADER_CURL_URLAPI_INT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +size_t Curl_is_absolute_url(const char *url, char *buf, size_t buflen, + bool guess_scheme); + +CURLUcode Curl_url_set_authority(CURLU *u, const char *authority, + unsigned int flags); + +#ifdef DEBUGBUILD +CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host, + bool has_scheme); +#endif + +#endif /* HEADER_CURL_URLAPI_INT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/urldata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/urldata.h new file mode 100644 index 0000000000000000000000000000000000000000..dff26e6b4bd1a28602479a2ad72905be5a4c9a52 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/urldata.h @@ -0,0 +1,2024 @@ +#ifndef HEADER_CURL_URLDATA_H +#define HEADER_CURL_URLDATA_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +/* This file is for lib internal stuff */ + +#include "curl_setup.h" + +#define PORT_FTP 21 +#define PORT_FTPS 990 +#define PORT_TELNET 23 +#define PORT_HTTP 80 +#define PORT_HTTPS 443 +#define PORT_DICT 2628 +#define PORT_LDAP 389 +#define PORT_LDAPS 636 +#define PORT_TFTP 69 +#define PORT_SSH 22 +#define PORT_IMAP 143 +#define PORT_IMAPS 993 +#define PORT_POP3 110 +#define PORT_POP3S 995 +#define PORT_SMB 445 +#define PORT_SMBS 445 +#define PORT_SMTP 25 +#define PORT_SMTPS 465 /* sometimes called SSMTP */ +#define PORT_RTSP 554 +#define PORT_RTMP 1935 +#define PORT_RTMPT PORT_HTTP +#define PORT_RTMPS PORT_HTTPS +#define PORT_GOPHER 70 +#define PORT_MQTT 1883 + +#ifdef USE_WEBSOCKETS +/* CURLPROTO_GOPHERS (29) is the highest publicly used protocol bit number, + * the rest are internal information. If we use higher bits we only do this on + * platforms that have a >= 64 bit type and then we use such a type for the + * protocol fields in the protocol handler. + */ +#define CURLPROTO_WS (1<<30) +#define CURLPROTO_WSS ((curl_prot_t)1<<31) +#else +#define CURLPROTO_WS 0 +#define CURLPROTO_WSS 0 +#endif + +/* This should be undefined once we need bit 32 or higher */ +#define PROTO_TYPE_SMALL + +#ifndef PROTO_TYPE_SMALL +typedef curl_off_t curl_prot_t; +#else +typedef unsigned int curl_prot_t; +#endif + +/* This mask is for all the old protocols that are provided and defined in the + public header and shall exclude protocols added since which are not exposed + in the API */ +#define CURLPROTO_MASK (0x3ffffff) + +#define DICT_MATCH "/MATCH:" +#define DICT_MATCH2 "/M:" +#define DICT_MATCH3 "/FIND:" +#define DICT_DEFINE "/DEFINE:" +#define DICT_DEFINE2 "/D:" +#define DICT_DEFINE3 "/LOOKUP:" + +#define CURL_DEFAULT_USER "anonymous" +#define CURL_DEFAULT_PASSWORD "ftp@example.com" + +/* Convenience defines for checking protocols or their SSL based version. Each + protocol handler should only ever have a single CURLPROTO_ in its protocol + field. */ +#define PROTO_FAMILY_HTTP (CURLPROTO_HTTP|CURLPROTO_HTTPS|CURLPROTO_WS| \ + CURLPROTO_WSS) +#define PROTO_FAMILY_FTP (CURLPROTO_FTP|CURLPROTO_FTPS) +#define PROTO_FAMILY_POP3 (CURLPROTO_POP3|CURLPROTO_POP3S) +#define PROTO_FAMILY_SMB (CURLPROTO_SMB|CURLPROTO_SMBS) +#define PROTO_FAMILY_SMTP (CURLPROTO_SMTP|CURLPROTO_SMTPS) +#define PROTO_FAMILY_SSH (CURLPROTO_SCP|CURLPROTO_SFTP) + +#if !defined(CURL_DISABLE_FTP) || defined(USE_SSH) || \ + !defined(CURL_DISABLE_POP3) +/* these protocols support CURLOPT_DIRLISTONLY */ +#define CURL_LIST_ONLY_PROTOCOL 1 +#endif + +#define DEFAULT_CONNCACHE_SIZE 5 + +/* length of longest IPv6 address string including the trailing null */ +#define MAX_IPADR_LEN sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + +/* Default FTP/IMAP etc response timeout in milliseconds */ +#define RESP_TIMEOUT (120*1000) + +/* Max string input length is a precaution against abuse and to detect junk + input easier and better. */ +#define CURL_MAX_INPUT_LENGTH 8000000 + + +#include "cookie.h" +#include "psl.h" +#include "formdata.h" + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETINET_IN6_H +#include +#endif + +#include "timeval.h" + +#include + +#include "http_chunks.h" /* for the structs and enum stuff */ +#include "hostip.h" +#include "hash.h" +#include "splay.h" +#include "dynbuf.h" +#include "dynhds.h" + +/* return the count of bytes sent, or -1 on error */ +typedef ssize_t (Curl_send)(struct Curl_easy *data, /* transfer */ + int sockindex, /* socketindex */ + const void *buf, /* data to write */ + size_t len, /* max amount to write */ + CURLcode *err); /* error to return */ + +/* return the count of bytes read, or -1 on error */ +typedef ssize_t (Curl_recv)(struct Curl_easy *data, /* transfer */ + int sockindex, /* socketindex */ + char *buf, /* store data here */ + size_t len, /* max amount to read */ + CURLcode *err); /* error to return */ + +#ifdef USE_HYPER +typedef CURLcode (*Curl_datastream)(struct Curl_easy *data, + struct connectdata *conn, + int *didwhat, + bool *done, + int select_res); +#endif + +#include "mime.h" +#include "imap.h" +#include "pop3.h" +#include "smtp.h" +#include "ftp.h" +#include "file.h" +#include "vssh/ssh.h" +#include "http.h" +#include "rtsp.h" +#include "smb.h" +#include "mqtt.h" +#include "ftplistparser.h" +#include "multihandle.h" +#include "c-hyper.h" +#include "cf-socket.h" + +#ifdef HAVE_GSSAPI +# ifdef HAVE_GSSGNU +# include +# elif defined HAVE_GSSAPI_GSSAPI_H +# include +# else +# include +# endif +# ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H +# include +# endif +#endif + +#ifdef USE_LIBSSH2 +#include +#include +#endif /* USE_LIBSSH2 */ + +#define READBUFFER_SIZE CURL_MAX_WRITE_SIZE +#define READBUFFER_MAX CURL_MAX_READ_SIZE +#define READBUFFER_MIN 1024 + +/* The default upload buffer size, should not be smaller than + CURL_MAX_WRITE_SIZE, as it needs to hold a full buffer as could be sent in + a write callback. + + The size was 16KB for many years but was bumped to 64KB because it makes + libcurl able to do significantly faster uploads in some circumstances. Even + larger buffers can help further, but this is deemed a fair memory/speed + compromise. */ +#define UPLOADBUFFER_DEFAULT 65536 +#define UPLOADBUFFER_MAX (2*1024*1024) +#define UPLOADBUFFER_MIN CURL_MAX_WRITE_SIZE + +#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU +#ifdef DEBUGBUILD +/* On a debug build, we want to fail hard on easy handles that + * are not NULL, but no longer have the MAGIC touch. This gives + * us early warning on things only discovered by valgrind otherwise. */ +#define GOOD_EASY_HANDLE(x) \ + (((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER))? TRUE: \ + (DEBUGASSERT(!(x)), FALSE)) +#else +#define GOOD_EASY_HANDLE(x) \ + ((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER)) +#endif + +#ifdef HAVE_GSSAPI +/* Types needed for krb5-ftp connections */ +struct krb5buffer { + void *data; + size_t size; + size_t index; + BIT(eof_flag); +}; + +enum protection_level { + PROT_NONE, /* first in list */ + PROT_CLEAR, + PROT_SAFE, + PROT_CONFIDENTIAL, + PROT_PRIVATE, + PROT_CMD, + PROT_LAST /* last in list */ +}; +#endif + +/* enum for the nonblocking SSL connection state machine */ +typedef enum { + ssl_connect_1, + ssl_connect_2, + ssl_connect_2_reading, + ssl_connect_2_writing, + ssl_connect_3, + ssl_connect_done +} ssl_connect_state; + +typedef enum { + ssl_connection_none, + ssl_connection_negotiating, + ssl_connection_complete +} ssl_connection_state; + +/* SSL backend-specific data; declared differently by each SSL backend */ +struct ssl_backend_data; + +struct ssl_primary_config { + char *CApath; /* certificate dir (doesn't work on windows) */ + char *CAfile; /* certificate to verify peer against */ + char *issuercert; /* optional issuer certificate filename */ + char *clientcert; + char *cipher_list; /* list of ciphers to use */ + char *cipher_list13; /* list of TLS 1.3 cipher suites to use */ + char *pinned_key; + char *CRLfile; /* CRL to check certificate revocation */ + struct curl_blob *cert_blob; + struct curl_blob *ca_info_blob; + struct curl_blob *issuercert_blob; +#ifdef USE_TLS_SRP + char *username; /* TLS username (for, e.g., SRP) */ + char *password; /* TLS password (for, e.g., SRP) */ +#endif + char *curves; /* list of curves to use */ + unsigned char ssl_options; /* the CURLOPT_SSL_OPTIONS bitmask */ + unsigned int version_max; /* max supported version the client wants to use */ + unsigned char version; /* what version the client wants to use */ + BIT(verifypeer); /* set TRUE if this is desired */ + BIT(verifyhost); /* set TRUE if CN/SAN must match hostname */ + BIT(verifystatus); /* set TRUE if certificate status must be checked */ + BIT(sessionid); /* cache session IDs or not */ +}; + +struct ssl_config_data { + struct ssl_primary_config primary; + long certverifyresult; /* result from the certificate verification */ + curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */ + void *fsslctxp; /* parameter for call back */ + char *cert_type; /* format for certificate (default: PEM)*/ + char *key; /* private key file name */ + struct curl_blob *key_blob; + char *key_type; /* format for private key (default: PEM) */ + char *key_passwd; /* plain text private key password */ + BIT(certinfo); /* gather lots of certificate info */ + BIT(falsestart); + BIT(enable_beast); /* allow this flaw for interoperability's sake */ + BIT(no_revoke); /* disable SSL certificate revocation checks */ + BIT(no_partialchain); /* don't accept partial certificate chains */ + BIT(revoke_best_effort); /* ignore SSL revocation offline/missing revocation + list errors */ + BIT(native_ca_store); /* use the native ca store of operating system */ + BIT(auto_client_cert); /* automatically locate and use a client + certificate for authentication (Schannel) */ +}; + +struct ssl_general_config { + size_t max_ssl_sessions; /* SSL session id cache size */ + int ca_cache_timeout; /* Certificate store cache timeout (seconds) */ +}; + +/* information stored about one single SSL session */ +struct Curl_ssl_session { + char *name; /* host name for which this ID was used */ + char *conn_to_host; /* host name for the connection (may be NULL) */ + const char *scheme; /* protocol scheme used */ + void *sessionid; /* as returned from the SSL layer */ + size_t idsize; /* if known, otherwise 0 */ + long age; /* just a number, the higher the more recent */ + int remote_port; /* remote port */ + int conn_to_port; /* remote port for the connection (may be -1) */ + struct ssl_primary_config ssl_config; /* setup for this session */ +}; + +#ifdef USE_WINDOWS_SSPI +#include "curl_sspi.h" +#endif + +#ifndef CURL_DISABLE_DIGEST_AUTH +/* Struct used for Digest challenge-response authentication */ +struct digestdata { +#if defined(USE_WINDOWS_SSPI) + BYTE *input_token; + size_t input_token_len; + CtxtHandle *http_context; + /* copy of user/passwd used to make the identity for http_context. + either may be NULL. */ + char *user; + char *passwd; +#else + char *nonce; + char *cnonce; + char *realm; + char *opaque; + char *qop; + char *algorithm; + int nc; /* nonce count */ + unsigned char algo; + BIT(stale); /* set true for re-negotiation */ + BIT(userhash); +#endif +}; +#endif + +typedef enum { + NTLMSTATE_NONE, + NTLMSTATE_TYPE1, + NTLMSTATE_TYPE2, + NTLMSTATE_TYPE3, + NTLMSTATE_LAST +} curlntlm; + +typedef enum { + GSS_AUTHNONE, + GSS_AUTHRECV, + GSS_AUTHSENT, + GSS_AUTHDONE, + GSS_AUTHSUCC +} curlnegotiate; + +/* Struct used for GSSAPI (Kerberos V5) authentication */ +#if defined(USE_KERBEROS5) +struct kerberos5data { +#if defined(USE_WINDOWS_SSPI) + CredHandle *credentials; + CtxtHandle *context; + TCHAR *spn; + SEC_WINNT_AUTH_IDENTITY identity; + SEC_WINNT_AUTH_IDENTITY *p_identity; + size_t token_max; + BYTE *output_token; +#else + gss_ctx_id_t context; + gss_name_t spn; +#endif +}; +#endif + +/* Struct used for SCRAM-SHA-1 authentication */ +#ifdef USE_GSASL +#include +struct gsasldata { + Gsasl *ctx; + Gsasl_session *client; +}; +#endif + +/* Struct used for NTLM challenge-response authentication */ +#if defined(USE_NTLM) +struct ntlmdata { +#ifdef USE_WINDOWS_SSPI +/* The sslContext is used for the Schannel bindings. The + * api is available on the Windows 7 SDK and later. + */ +#ifdef SECPKG_ATTR_ENDPOINT_BINDINGS + CtxtHandle *sslContext; +#endif + CredHandle *credentials; + CtxtHandle *context; + SEC_WINNT_AUTH_IDENTITY identity; + SEC_WINNT_AUTH_IDENTITY *p_identity; + size_t token_max; + BYTE *output_token; + BYTE *input_token; + size_t input_token_len; + TCHAR *spn; +#else + unsigned int flags; + unsigned char nonce[8]; + unsigned int target_info_len; + void *target_info; /* TargetInfo received in the ntlm type-2 message */ + +#if defined(NTLM_WB_ENABLED) + /* used for communication with Samba's winbind daemon helper ntlm_auth */ + curl_socket_t ntlm_auth_hlpr_socket; + pid_t ntlm_auth_hlpr_pid; + char *challenge; /* The received base64 encoded ntlm type-2 message */ + char *response; /* The generated base64 ntlm type-1/type-3 message */ +#endif +#endif +}; +#endif + +/* Struct used for Negotiate (SPNEGO) authentication */ +#ifdef USE_SPNEGO +struct negotiatedata { +#ifdef HAVE_GSSAPI + OM_uint32 status; + gss_ctx_id_t context; + gss_name_t spn; + gss_buffer_desc output_token; +#else +#ifdef USE_WINDOWS_SSPI +#ifdef SECPKG_ATTR_ENDPOINT_BINDINGS + CtxtHandle *sslContext; +#endif + DWORD status; + CredHandle *credentials; + CtxtHandle *context; + SEC_WINNT_AUTH_IDENTITY identity; + SEC_WINNT_AUTH_IDENTITY *p_identity; + TCHAR *spn; + size_t token_max; + BYTE *output_token; + size_t output_token_length; +#endif +#endif + BIT(noauthpersist); + BIT(havenoauthpersist); + BIT(havenegdata); + BIT(havemultiplerequests); +}; +#endif + +#ifdef CURL_DISABLE_PROXY +#define CONN_IS_PROXIED(x) 0 +#else +#define CONN_IS_PROXIED(x) x->bits.proxy +#endif + +/* + * Boolean values that concerns this connection. + */ +struct ConnectBits { +#ifndef CURL_DISABLE_PROXY + BIT(httpproxy); /* if set, this transfer is done through an HTTP proxy */ + BIT(socksproxy); /* if set, this transfer is done through a socks proxy */ + BIT(proxy_user_passwd); /* user+password for the proxy? */ + BIT(tunnel_proxy); /* if CONNECT is used to "tunnel" through the proxy. + This is implicit when SSL-protocols are used through + proxies, but can also be enabled explicitly by + apps */ + BIT(proxy_connect_closed); /* TRUE if a proxy disconnected the connection + in a CONNECT request with auth, so that + libcurl should reconnect and continue. */ + BIT(proxy); /* if set, this transfer is done through a proxy - any type */ +#endif + /* always modify bits.close with the connclose() and connkeep() macros! */ + BIT(close); /* if set, we close the connection after this request */ + BIT(reuse); /* if set, this is a reused connection */ + BIT(altused); /* this is an alt-svc "redirect" */ + BIT(conn_to_host); /* if set, this connection has a "connect to host" + that overrides the host in the URL */ + BIT(conn_to_port); /* if set, this connection has a "connect to port" + that overrides the port in the URL (remote port) */ + BIT(ipv6_ip); /* we communicate with a remote site specified with pure IPv6 + IP address */ + BIT(ipv6); /* we communicate with a site using an IPv6 address */ + BIT(do_more); /* this is set TRUE if the ->curl_do_more() function is + supposed to be called, after ->curl_do() */ + BIT(protoconnstart);/* the protocol layer has STARTED its operation after + the TCP layer connect */ + BIT(retry); /* this connection is about to get closed and then + re-attempted at another connection. */ + BIT(authneg); /* TRUE when the auth phase has started, which means + that we are creating a request with an auth header, + but it is not the final request in the auth + negotiation. */ +#ifndef CURL_DISABLE_FTP + BIT(ftp_use_epsv); /* As set with CURLOPT_FTP_USE_EPSV, but if we find out + EPSV doesn't work we disable it for the forthcoming + requests */ + BIT(ftp_use_eprt); /* As set with CURLOPT_FTP_USE_EPRT, but if we find out + EPRT doesn't work we disable it for the forthcoming + requests */ + BIT(ftp_use_data_ssl); /* Enabled SSL for the data connection */ + BIT(ftp_use_control_ssl); /* Enabled SSL for the control connection */ +#endif +#ifndef CURL_DISABLE_NETRC + BIT(netrc); /* name+password provided by netrc */ +#endif + BIT(bound); /* set true if bind() has already been done on this socket/ + connection */ + BIT(multiplex); /* connection is multiplexed */ + BIT(tcp_fastopen); /* use TCP Fast Open */ + BIT(tls_enable_alpn); /* TLS ALPN extension? */ +#ifndef CURL_DISABLE_DOH + BIT(doh); +#endif +#ifdef USE_UNIX_SOCKETS + BIT(abstract_unix_socket); +#endif + BIT(tls_upgraded); + BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with + accept() */ + BIT(parallel_connect); /* set TRUE when a parallel connect attempt has + started (happy eyeballs) */ +}; + +struct hostname { + char *rawalloc; /* allocated "raw" version of the name */ + char *encalloc; /* allocated IDN-encoded version of the name */ + char *name; /* name to use internally, might be encoded, might be raw */ + const char *dispname; /* name to display, as 'name' might be encoded */ +}; + +/* + * Flags on the keepon member of the Curl_transfer_keeper + */ + +#define KEEP_NONE 0 +#define KEEP_RECV (1<<0) /* there is or may be data to read */ +#define KEEP_SEND (1<<1) /* there is or may be data to write */ +#define KEEP_RECV_HOLD (1<<2) /* when set, no reading should be done but there + might still be data to read */ +#define KEEP_SEND_HOLD (1<<3) /* when set, no writing should be done but there + might still be data to write */ +#define KEEP_RECV_PAUSE (1<<4) /* reading is paused */ +#define KEEP_SEND_PAUSE (1<<5) /* writing is paused */ + +#define KEEP_RECVBITS (KEEP_RECV | KEEP_RECV_HOLD | KEEP_RECV_PAUSE) +#define KEEP_SENDBITS (KEEP_SEND | KEEP_SEND_HOLD | KEEP_SEND_PAUSE) + +#if defined(CURLRES_ASYNCH) || !defined(CURL_DISABLE_DOH) +#define USE_CURL_ASYNC +struct Curl_async { + char *hostname; + struct Curl_dns_entry *dns; + struct thread_data *tdata; + void *resolver; /* resolver state, if it is used in the URL state - + ares_channel e.g. */ + int port; + int status; /* if done is TRUE, this is the status from the callback */ + BIT(done); /* set TRUE when the lookup is complete */ +}; + +#endif + +#define FIRSTSOCKET 0 +#define SECONDARYSOCKET 1 + +enum expect100 { + EXP100_SEND_DATA, /* enough waiting, just send the body now */ + EXP100_AWAITING_CONTINUE, /* waiting for the 100 Continue header */ + EXP100_SENDING_REQUEST, /* still sending the request but will wait for + the 100 header once done with the request */ + EXP100_FAILED /* used on 417 Expectation Failed */ +}; + +enum upgrade101 { + UPGR101_INIT, /* default state */ + UPGR101_WS, /* upgrade to WebSockets requested */ + UPGR101_H2, /* upgrade to HTTP/2 requested */ + UPGR101_RECEIVED, /* 101 response received */ + UPGR101_WORKING /* talking upgraded protocol */ +}; + +enum doh_slots { + /* Explicit values for first two symbols so as to match hard-coded + * constants in existing code + */ + DOH_PROBE_SLOT_IPADDR_V4 = 0, /* make 'V4' stand out for readability */ + DOH_PROBE_SLOT_IPADDR_V6 = 1, /* 'V6' likewise */ + + /* Space here for (possibly build-specific) additional slot definitions */ + + /* for example */ + /* #ifdef WANT_DOH_FOOBAR_TXT */ + /* DOH_PROBE_SLOT_FOOBAR_TXT, */ + /* #endif */ + + /* AFTER all slot definitions, establish how many we have */ + DOH_PROBE_SLOTS +}; + +/* + * Request specific data in the easy handle (Curl_easy). Previously, + * these members were on the connectdata struct but since a conn struct may + * now be shared between different Curl_easys, we store connection-specific + * data here. This struct only keeps stuff that's interesting for *this* + * request, as it will be cleared between multiple ones + */ +struct SingleRequest { + curl_off_t size; /* -1 if unknown at this point */ + curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch, + -1 means unlimited */ + curl_off_t bytecount; /* total number of bytes read */ + curl_off_t writebytecount; /* number of bytes written */ + + curl_off_t pendingheader; /* this many bytes left to send is actually + header and not body */ + struct curltime start; /* transfer started at this time */ + unsigned int headerbytecount; /* received server headers (not CONNECT + headers) */ + unsigned int allheadercount; /* all received headers (server + CONNECT) */ + unsigned int deductheadercount; /* this amount of bytes doesn't count when + we check if anything has been transferred + at the end of a connection. We use this + counter to make only a 100 reply (without + a following second response code) result + in a CURLE_GOT_NOTHING error code */ + enum { + HEADER_NORMAL, /* no bad header at all */ + HEADER_PARTHEADER, /* part of the chunk is a bad header, the rest + is normal data */ + HEADER_ALLBAD /* all was believed to be header */ + } badheader; /* the header was deemed bad and will be + written as body */ + int headerline; /* counts header lines to better track the + first one */ + char *str; /* within buf */ + curl_off_t offset; /* possible resume offset read from the + Content-Range: header */ + int httpcode; /* error code from the 'HTTP/1.? XXX' or + 'RTSP/1.? XXX' line */ + int keepon; + struct curltime start100; /* time stamp to wait for the 100 code from */ + enum expect100 exp100; /* expect 100 continue state */ + enum upgrade101 upgr101; /* 101 upgrade state */ + + /* Content unencoding stack. See sec 3.5, RFC2616. */ + struct contenc_writer *writer_stack; + time_t timeofdoc; + long bodywrites; + char *location; /* This points to an allocated version of the Location: + header data */ + char *newurl; /* Set to the new URL to use when a redirect or a retry is + wanted */ + + /* 'upload_present' is used to keep a byte counter of how much data there is + still left in the buffer, aimed for upload. */ + ssize_t upload_present; + + /* 'upload_fromhere' is used as a read-pointer when we uploaded parts of a + buffer, so the next read should read from where this pointer points to, + and the 'upload_present' contains the number of bytes available at this + position */ + char *upload_fromhere; + + /* Allocated protocol-specific data. Each protocol handler makes sure this + points to data it needs. */ + union { + struct FILEPROTO *file; + struct FTP *ftp; + struct HTTP *http; + struct IMAP *imap; + struct ldapreqinfo *ldap; + struct MQTT *mqtt; + struct POP3 *pop3; + struct RTSP *rtsp; + struct smb_request *smb; + struct SMTP *smtp; + struct SSHPROTO *ssh; + struct TELNET *telnet; + } p; +#ifndef CURL_DISABLE_DOH + struct dohdata *doh; /* DoH specific data for this request */ +#endif +#if defined(WIN32) && defined(USE_WINSOCK) + struct curltime last_sndbuf_update; /* last time readwrite_upload called + win_update_buffer_size */ +#endif +#ifndef CURL_DISABLE_COOKIES + unsigned char setcookies; +#endif + unsigned char writer_stack_depth; /* Unencoding stack depth. */ + BIT(header); /* incoming data has HTTP header */ + BIT(content_range); /* set TRUE if Content-Range: was found */ + BIT(upload_done); /* set to TRUE when doing chunked transfer-encoding + upload and we're uploading the last chunk */ + BIT(ignorebody); /* we read a response-body but we ignore it! */ + BIT(http_bodyless); /* HTTP response status code is between 100 and 199, + 204 or 304 */ + BIT(chunk); /* if set, this is a chunked transfer-encoding */ + BIT(ignore_cl); /* ignore content-length */ + BIT(upload_chunky); /* set TRUE if we are doing chunked transfer-encoding + on upload */ + BIT(getheader); /* TRUE if header parsing is wanted */ + BIT(forbidchunk); /* used only to explicitly forbid chunk-upload for + specific upload buffers. See readmoredata() in http.c + for details. */ + BIT(no_body); /* the response has no body */ +}; + +/* + * Specific protocol handler. + */ + +struct Curl_handler { + const char *scheme; /* URL scheme name. */ + + /* Complement to setup_connection_internals(). This is done before the + transfer "owns" the connection. */ + CURLcode (*setup_connection)(struct Curl_easy *data, + struct connectdata *conn); + + /* These two functions MUST be set to be protocol dependent */ + CURLcode (*do_it)(struct Curl_easy *data, bool *done); + CURLcode (*done)(struct Curl_easy *, CURLcode, bool); + + /* If the curl_do() function is better made in two halves, this + * curl_do_more() function will be called afterwards, if set. For example + * for doing the FTP stuff after the PASV/PORT command. + */ + CURLcode (*do_more)(struct Curl_easy *, int *); + + /* This function *MAY* be set to a protocol-dependent function that is run + * after the connect() and everything is done, as a step in the connection. + * The 'done' pointer points to a bool that should be set to TRUE if the + * function completes before return. If it doesn't complete, the caller + * should call the ->connecting() function until it is. + */ + CURLcode (*connect_it)(struct Curl_easy *data, bool *done); + + /* See above. */ + CURLcode (*connecting)(struct Curl_easy *data, bool *done); + CURLcode (*doing)(struct Curl_easy *data, bool *done); + + /* Called from the multi interface during the PROTOCONNECT phase, and it + should then return a proper fd set */ + int (*proto_getsock)(struct Curl_easy *data, + struct connectdata *conn, curl_socket_t *socks); + + /* Called from the multi interface during the DOING phase, and it should + then return a proper fd set */ + int (*doing_getsock)(struct Curl_easy *data, + struct connectdata *conn, curl_socket_t *socks); + + /* Called from the multi interface during the DO_MORE phase, and it should + then return a proper fd set */ + int (*domore_getsock)(struct Curl_easy *data, + struct connectdata *conn, curl_socket_t *socks); + + /* Called from the multi interface during the DO_DONE, PERFORM and + WAITPERFORM phases, and it should then return a proper fd set. Not setting + this will make libcurl use the generic default one. */ + int (*perform_getsock)(struct Curl_easy *data, + struct connectdata *conn, curl_socket_t *socks); + + /* This function *MAY* be set to a protocol-dependent function that is run + * by the curl_disconnect(), as a step in the disconnection. If the handler + * is called because the connection has been considered dead, + * dead_connection is set to TRUE. The connection is (again) associated with + * the transfer here. + */ + CURLcode (*disconnect)(struct Curl_easy *, struct connectdata *, + bool dead_connection); + + /* If used, this function gets called from transfer.c:readwrite_data() to + allow the protocol to do extra reads/writes */ + CURLcode (*readwrite)(struct Curl_easy *data, struct connectdata *conn, + ssize_t *nread, bool *readmore); + + /* This function can perform various checks on the connection. See + CONNCHECK_* for more information about the checks that can be performed, + and CONNRESULT_* for the results that can be returned. */ + unsigned int (*connection_check)(struct Curl_easy *data, + struct connectdata *conn, + unsigned int checks_to_perform); + + /* attach() attaches this transfer to this connection */ + void (*attach)(struct Curl_easy *data, struct connectdata *conn); + + int defport; /* Default port. */ + curl_prot_t protocol; /* See CURLPROTO_* - this needs to be the single + specific protocol bit */ + curl_prot_t family; /* single bit for protocol family; basically the + non-TLS name of the protocol this is */ + unsigned int flags; /* Extra particular characteristics, see PROTOPT_* */ + +}; + +#define PROTOPT_NONE 0 /* nothing extra */ +#define PROTOPT_SSL (1<<0) /* uses SSL */ +#define PROTOPT_DUAL (1<<1) /* this protocol uses two connections */ +#define PROTOPT_CLOSEACTION (1<<2) /* need action before socket close */ +/* some protocols will have to call the underlying functions without regard to + what exact state the socket signals. IE even if the socket says "readable", + the send function might need to be called while uploading, or vice versa. +*/ +#define PROTOPT_DIRLOCK (1<<3) +#define PROTOPT_NONETWORK (1<<4) /* protocol doesn't use the network! */ +#define PROTOPT_NEEDSPWD (1<<5) /* needs a password, and if none is set it + gets a default */ +#define PROTOPT_NOURLQUERY (1<<6) /* protocol can't handle + url query strings (?foo=bar) ! */ +#define PROTOPT_CREDSPERREQUEST (1<<7) /* requires login credentials per + request instead of per connection */ +#define PROTOPT_ALPN (1<<8) /* set ALPN for this */ +/* (1<<9) was PROTOPT_STREAM, now free */ +#define PROTOPT_URLOPTIONS (1<<10) /* allow options part in the userinfo field + of the URL */ +#define PROTOPT_PROXY_AS_HTTP (1<<11) /* allow this non-HTTP scheme over a + HTTP proxy as HTTP proxies may know + this protocol and act as a gateway */ +#define PROTOPT_WILDCARD (1<<12) /* protocol supports wildcard matching */ +#define PROTOPT_USERPWDCTRL (1<<13) /* Allow "control bytes" (< 32 ascii) in + user name and password */ +#define PROTOPT_NOTCPPROXY (1<<14) /* this protocol can't proxy over TCP */ + +#define CONNCHECK_NONE 0 /* No checks */ +#define CONNCHECK_ISDEAD (1<<0) /* Check if the connection is dead. */ +#define CONNCHECK_KEEPALIVE (1<<1) /* Perform any keepalive function. */ + +#define CONNRESULT_NONE 0 /* No extra information. */ +#define CONNRESULT_DEAD (1<<0) /* The connection is dead. */ + +struct proxy_info { + struct hostname host; + int port; + unsigned char proxytype; /* curl_proxytype: what kind of proxy that is in + use */ + char *user; /* proxy user name string, allocated */ + char *passwd; /* proxy password string, allocated */ +}; + +struct ldapconninfo; + +#define TRNSPRT_TCP 3 +#define TRNSPRT_UDP 4 +#define TRNSPRT_QUIC 5 +#define TRNSPRT_UNIX 6 + +/* + * The connectdata struct contains all fields and variables that should be + * unique for an entire connection. + */ +struct connectdata { + struct Curl_llist_element bundle_node; /* conncache */ + + /* chunk is for HTTP chunked encoding, but is in the general connectdata + struct only because we can do just about any protocol through an HTTP + proxy and an HTTP proxy may in fact respond using chunked encoding */ + struct Curl_chunker chunk; + + curl_closesocket_callback fclosesocket; /* function closing the socket(s) */ + void *closesocket_client; + + /* This is used by the connection cache logic. If this returns TRUE, this + handle is still used by one or more easy handles and can only used by any + other easy handle without careful consideration (== only for + multiplexing) and it cannot be used by another multi handle! */ +#define CONN_INUSE(c) ((c)->easyq.size) + + /**** Fields set when inited and not modified again */ + curl_off_t connection_id; /* Contains a unique number to make it easier to + track the connections in the log output */ + + /* 'dns_entry' is the particular host we use. This points to an entry in the + DNS cache and it will not get pruned while locked. It gets unlocked in + multi_done(). This entry will be NULL if the connection is reused as then + there is no name resolve done. */ + struct Curl_dns_entry *dns_entry; + + /* 'remote_addr' is the particular IP we connected to. it is owned, set + * and NULLed by the connected socket filter (if there is one). */ + const struct Curl_sockaddr_ex *remote_addr; + + struct hostname host; + char *hostname_resolve; /* host name to resolve to address, allocated */ + char *secondaryhostname; /* secondary socket host name (ftp) */ + struct hostname conn_to_host; /* the host to connect to. valid only if + bits.conn_to_host is set */ +#ifndef CURL_DISABLE_PROXY + struct proxy_info socks_proxy; + struct proxy_info http_proxy; +#endif + /* 'primary_ip' and 'primary_port' get filled with peer's numerical + ip address and port number whenever an outgoing connection is + *attempted* from the primary socket to a remote address. When more + than one address is tried for a connection these will hold data + for the last attempt. When the connection is actually established + these are updated with data which comes directly from the socket. */ + + char primary_ip[MAX_IPADR_LEN]; + char *user; /* user name string, allocated */ + char *passwd; /* password string, allocated */ + char *options; /* options string, allocated */ + char *sasl_authzid; /* authorization identity string, allocated */ + char *oauth_bearer; /* OAUTH2 bearer, allocated */ + struct curltime now; /* "current" time */ + struct curltime created; /* creation time */ + struct curltime lastused; /* when returned to the connection cache */ + curl_socket_t sock[2]; /* two sockets, the second is used for the data + transfer when doing FTP */ + Curl_recv *recv[2]; + Curl_send *send[2]; + struct Curl_cfilter *cfilter[2]; /* connection filters */ + + struct ssl_primary_config ssl_config; +#ifndef CURL_DISABLE_PROXY + struct ssl_primary_config proxy_ssl_config; +#endif + struct ConnectBits bits; /* various state-flags for this connection */ + + const struct Curl_handler *handler; /* Connection's protocol handler */ + const struct Curl_handler *given; /* The protocol first given */ + + /* Protocols can use a custom keepalive mechanism to keep connections alive. + This allows those protocols to track the last time the keepalive mechanism + was used on this connection. */ + struct curltime keepalive; + + /**** curl_get() phase fields */ + + curl_socket_t sockfd; /* socket to read from or CURL_SOCKET_BAD */ + curl_socket_t writesockfd; /* socket to write to, it may very + well be the same we read from. + CURL_SOCKET_BAD disables */ + +#ifdef HAVE_GSSAPI + BIT(sec_complete); /* if Kerberos is enabled for this connection */ + unsigned char command_prot; /* enum protection_level */ + unsigned char data_prot; /* enum protection_level */ + unsigned char request_data_prot; /* enum protection_level */ + size_t buffer_size; + struct krb5buffer in_buffer; + void *app_data; + const struct Curl_sec_client_mech *mech; + struct sockaddr_in local_addr; +#endif + +#if defined(USE_KERBEROS5) /* Consider moving some of the above GSS-API */ + struct kerberos5data krb5; /* variables into the structure definition, */ +#endif /* however, some of them are ftp specific. */ + + struct Curl_llist easyq; /* List of easy handles using this connection */ + curl_seek_callback seek_func; /* function that seeks the input */ + void *seek_client; /* pointer to pass to the seek() above */ + + /*************** Request - specific items ************/ +#if defined(USE_WINDOWS_SSPI) && defined(SECPKG_ATTR_ENDPOINT_BINDINGS) + CtxtHandle *sslContext; +#endif + +#ifdef USE_GSASL + struct gsasldata gsasl; +#endif + +#if defined(USE_NTLM) + curlntlm http_ntlm_state; + curlntlm proxy_ntlm_state; + + struct ntlmdata ntlm; /* NTLM differs from other authentication schemes + because it authenticates connections, not + single requests! */ + struct ntlmdata proxyntlm; /* NTLM data for proxy */ +#endif + +#ifdef USE_SPNEGO + curlnegotiate http_negotiate_state; + curlnegotiate proxy_negotiate_state; + + struct negotiatedata negotiate; /* state data for host Negotiate auth */ + struct negotiatedata proxyneg; /* state data for proxy Negotiate auth */ +#endif + +#ifndef CURL_DISABLE_HTTP + /* for chunked-encoded trailer */ + struct dynbuf trailer; +#endif + + union { +#ifndef CURL_DISABLE_FTP + struct ftp_conn ftpc; +#endif +#ifdef USE_SSH + struct ssh_conn sshc; +#endif +#ifndef CURL_DISABLE_TFTP + struct tftp_state_data *tftpc; +#endif +#ifndef CURL_DISABLE_IMAP + struct imap_conn imapc; +#endif +#ifndef CURL_DISABLE_POP3 + struct pop3_conn pop3c; +#endif +#ifndef CURL_DISABLE_SMTP + struct smtp_conn smtpc; +#endif +#ifndef CURL_DISABLE_RTSP + struct rtsp_conn rtspc; +#endif +#ifndef CURL_DISABLE_SMB + struct smb_conn smbc; +#endif +#ifdef USE_LIBRTMP + void *rtmp; +#endif +#ifdef USE_OPENLDAP + struct ldapconninfo *ldapc; +#endif +#ifndef CURL_DISABLE_MQTT + struct mqtt_conn mqtt; +#endif +#ifdef USE_WEBSOCKETS + struct websocket *ws; +#endif + unsigned int unused:1; /* avoids empty union */ + } proto; + + struct connectbundle *bundle; /* The bundle we are member of */ +#ifdef USE_UNIX_SOCKETS + char *unix_domain_socket; +#endif +#ifdef USE_HYPER + /* if set, an alternative data transfer function */ + Curl_datastream datastream; +#endif + /* When this connection is created, store the conditions for the local end + bind. This is stored before the actual bind and before any connection is + made and will serve the purpose of being used for comparison reasons so + that subsequent bound-requested connections aren't accidentally reusing + wrong connections. */ + char *localdev; + unsigned short localportrange; + int waitfor; /* current READ/WRITE bits to wait for */ +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + int socks5_gssapi_enctype; +#endif + /* The field below gets set in connect.c:connecthost() */ + int port; /* which port to use locally - to connect to */ + int remote_port; /* the remote port, not the proxy port! */ + int conn_to_port; /* the remote port to connect to. valid only if + bits.conn_to_port is set */ +#ifdef ENABLE_IPV6 + unsigned int scope_id; /* Scope id for IPv6 */ +#endif + unsigned short localport; + unsigned short secondary_port; /* secondary socket remote port to connect to + (ftp) */ + unsigned char cselect_bits; /* bitmask of socket events */ + unsigned char alpn; /* APLN TLS negotiated protocol, a CURL_HTTP_VERSION* + value */ +#ifndef CURL_DISABLE_PROXY + unsigned char proxy_alpn; /* APLN of proxy tunnel, CURL_HTTP_VERSION* */ +#endif + unsigned char transport; /* one of the TRNSPRT_* defines */ + unsigned char ip_version; /* copied from the Curl_easy at creation time */ + unsigned char httpversion; /* the HTTP version*10 reported by the server */ + unsigned char connect_only; + unsigned char gssapi_delegation; /* inherited from set.gssapi_delegation */ +}; + +#ifndef CURL_DISABLE_PROXY +#define CURL_CONN_HOST_DISPNAME(c) \ + ((c)->bits.socksproxy ? (c)->socks_proxy.host.dispname : \ + (c)->bits.httpproxy ? (c)->http_proxy.host.dispname : \ + (c)->bits.conn_to_host ? (c)->conn_to_host.dispname : \ + (c)->host.dispname) +#else +#define CURL_CONN_HOST_DISPNAME(c) \ + (c)->bits.conn_to_host ? (c)->conn_to_host.dispname : \ + (c)->host.dispname +#endif + +/* The end of connectdata. */ + +/* + * Struct to keep statistical and informational data. + * All variables in this struct must be initialized/reset in Curl_initinfo(). + */ +struct PureInfo { + int httpcode; /* Recent HTTP, FTP, RTSP or SMTP response code */ + int httpproxycode; /* response code from proxy when received separate */ + int httpversion; /* the http version number X.Y = X*10+Y */ + time_t filetime; /* If requested, this is might get set. Set to -1 if the + time was unretrievable. */ + curl_off_t request_size; /* the amount of bytes sent in the request(s) */ + unsigned long proxyauthavail; /* what proxy auth types were announced */ + unsigned long httpauthavail; /* what host auth types were announced */ + long numconnects; /* how many new connection did libcurl created */ + char *contenttype; /* the content type of the object */ + char *wouldredirect; /* URL this would've been redirected to if asked to */ + curl_off_t retry_after; /* info from Retry-After: header */ + unsigned int header_size; /* size of read header(s) in bytes */ + + /* PureInfo members 'conn_primary_ip', 'conn_primary_port', 'conn_local_ip' + and, 'conn_local_port' are copied over from the connectdata struct in + order to allow curl_easy_getinfo() to return this information even when + the session handle is no longer associated with a connection, and also + allow curl_easy_reset() to clear this information from the session handle + without disturbing information which is still alive, and that might be + reused, in the connection cache. */ + + char conn_primary_ip[MAX_IPADR_LEN]; + int conn_primary_port; /* this is the destination port to the connection, + which might have been a proxy */ + int conn_remote_port; /* this is the "remote port", which is the port + number of the used URL, independent of proxy or + not */ + char conn_local_ip[MAX_IPADR_LEN]; + int conn_local_port; + const char *conn_scheme; + unsigned int conn_protocol; + struct curl_certinfo certs; /* info about the certs. Asked for with + CURLOPT_CERTINFO / CURLINFO_CERTINFO */ + CURLproxycode pxcode; + BIT(timecond); /* set to TRUE if the time condition didn't match, which + thus made the document NOT get fetched */ +}; + + +struct Progress { + time_t lastshow; /* time() of the last displayed progress meter or NULL to + force redraw at next call */ + curl_off_t size_dl; /* total expected size */ + curl_off_t size_ul; /* total expected size */ + curl_off_t downloaded; /* transferred so far */ + curl_off_t uploaded; /* transferred so far */ + + curl_off_t current_speed; /* uses the currently fastest transfer */ + + int width; /* screen width at download start */ + int flags; /* see progress.h */ + + timediff_t timespent; + + curl_off_t dlspeed; + curl_off_t ulspeed; + + timediff_t t_nslookup; + timediff_t t_connect; + timediff_t t_appconnect; + timediff_t t_pretransfer; + timediff_t t_starttransfer; + timediff_t t_redirect; + + struct curltime start; + struct curltime t_startsingle; + struct curltime t_startop; + struct curltime t_acceptdata; + + + /* upload speed limit */ + struct curltime ul_limit_start; + curl_off_t ul_limit_size; + /* download speed limit */ + struct curltime dl_limit_start; + curl_off_t dl_limit_size; + +#define CURR_TIME (5 + 1) /* 6 entries for 5 seconds */ + + curl_off_t speeder[ CURR_TIME ]; + struct curltime speeder_time[ CURR_TIME ]; + int speeder_c; + BIT(callback); /* set when progress callback is used */ + BIT(is_t_startransfer_set); +}; + +typedef enum { + RTSPREQ_NONE, /* first in list */ + RTSPREQ_OPTIONS, + RTSPREQ_DESCRIBE, + RTSPREQ_ANNOUNCE, + RTSPREQ_SETUP, + RTSPREQ_PLAY, + RTSPREQ_PAUSE, + RTSPREQ_TEARDOWN, + RTSPREQ_GET_PARAMETER, + RTSPREQ_SET_PARAMETER, + RTSPREQ_RECORD, + RTSPREQ_RECEIVE, + RTSPREQ_LAST /* last in list */ +} Curl_RtspReq; + +struct auth { + unsigned long want; /* Bitmask set to the authentication methods wanted by + app (with CURLOPT_HTTPAUTH or CURLOPT_PROXYAUTH). */ + unsigned long picked; + unsigned long avail; /* Bitmask for what the server reports to support for + this resource */ + BIT(done); /* TRUE when the auth phase is done and ready to do the + actual request */ + BIT(multipass); /* TRUE if this is not yet authenticated but within the + auth multipass negotiation */ + BIT(iestyle); /* TRUE if digest should be done IE-style or FALSE if it + should be RFC compliant */ +}; + +#ifdef USE_NGHTTP2 +struct Curl_data_prio_node { + struct Curl_data_prio_node *next; + struct Curl_easy *data; +}; +#endif + +/** + * Priority information for an easy handle in relation to others + * on the same connection. + * TODO: we need to adapt it to the new priority scheme as defined in RFC 9218 + */ +struct Curl_data_priority { +#ifdef USE_NGHTTP2 + /* tree like dependencies only implemented in nghttp2 */ + struct Curl_easy *parent; + struct Curl_data_prio_node *children; +#endif + int weight; +#ifdef USE_NGHTTP2 + BIT(exclusive); +#endif +}; + +/* + * This struct is for holding data that was attempted to get sent to the user's + * callback but is held due to pausing. One instance per type (BOTH, HEADER, + * BODY). + */ +struct tempbuf { + struct dynbuf b; + int type; /* type of the 'tempwrite' buffer as a bitmask that is used with + Curl_client_write() */ + BIT(paused_body); /* if PAUSE happened before/during BODY write */ +}; + +/* Timers */ +typedef enum { + EXPIRE_100_TIMEOUT, + EXPIRE_ASYNC_NAME, + EXPIRE_CONNECTTIMEOUT, + EXPIRE_DNS_PER_NAME, /* family1 */ + EXPIRE_DNS_PER_NAME2, /* family2 */ + EXPIRE_HAPPY_EYEBALLS_DNS, /* See asyn-ares.c */ + EXPIRE_HAPPY_EYEBALLS, + EXPIRE_MULTI_PENDING, + EXPIRE_RUN_NOW, + EXPIRE_SPEEDCHECK, + EXPIRE_TIMEOUT, + EXPIRE_TOOFAST, + EXPIRE_QUIC, + EXPIRE_FTP_ACCEPT, + EXPIRE_ALPN_EYEBALLS, + EXPIRE_LAST /* not an actual timer, used as a marker only */ +} expire_id; + + +typedef enum { + TRAILERS_NONE, + TRAILERS_INITIALIZED, + TRAILERS_SENDING, + TRAILERS_DONE +} trailers_state; + + +/* + * One instance for each timeout an easy handle can set. + */ +struct time_node { + struct Curl_llist_element list; + struct curltime time; + expire_id eid; +}; + +/* individual pieces of the URL */ +struct urlpieces { + char *scheme; + char *hostname; + char *port; + char *user; + char *password; + char *options; + char *path; + char *query; +}; + +struct UrlState { + /* Points to the connection cache */ + struct conncache *conn_cache; + /* buffers to store authentication data in, as parsed from input options */ + struct curltime keeps_speed; /* for the progress meter really */ + + curl_off_t lastconnect_id; /* The last connection, -1 if undefined */ + curl_off_t recent_conn_id; /* The most recent connection used, might no + * longer exist */ + struct dynbuf headerb; /* buffer to store headers in */ + + char *buffer; /* download buffer */ + char *ulbuf; /* allocated upload buffer or NULL */ + curl_off_t current_speed; /* the ProgressShow() function sets this, + bytes / second */ + + /* host name, port number and protocol of the first (not followed) request. + if set, this should be the host name that we will sent authorization to, + no else. Used to make Location: following not keep sending user+password. + This is strdup()ed data. */ + char *first_host; + int first_remote_port; + curl_prot_t first_remote_protocol; + + int retrycount; /* number of retries on a new connection */ + struct Curl_ssl_session *session; /* array of 'max_ssl_sessions' size */ + long sessionage; /* number of the most recent session */ + struct tempbuf tempwrite[3]; /* BOTH, HEADER, BODY */ + unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */ + int os_errno; /* filled in with errno whenever an error occurs */ + char *scratch; /* huge buffer[set.buffer_size*2] for upload CRLF replacing */ + long followlocation; /* redirect counter */ + int requests; /* request counter: redirects + authentication retakes */ +#ifdef HAVE_SIGNAL + /* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */ + void (*prev_signal)(int sig); +#endif +#ifndef CURL_DISABLE_DIGEST_AUTH + struct digestdata digest; /* state data for host Digest auth */ + struct digestdata proxydigest; /* state data for proxy Digest auth */ +#endif + struct auth authhost; /* auth details for host */ + struct auth authproxy; /* auth details for proxy */ +#ifdef USE_CURL_ASYNC + struct Curl_async async; /* asynchronous name resolver data */ +#endif + +#if defined(USE_OPENSSL) + /* void instead of ENGINE to avoid bleeding OpenSSL into this header */ + void *engine; +#endif /* USE_OPENSSL */ + struct curltime expiretime; /* set this with Curl_expire() only */ + struct Curl_tree timenode; /* for the splay stuff */ + struct Curl_llist timeoutlist; /* list of pending timeouts */ + struct time_node expires[EXPIRE_LAST]; /* nodes for each expire type */ + + /* a place to store the most recently set (S)FTP entrypath */ + char *most_recent_ftp_entrypath; +#if !defined(WIN32) && !defined(MSDOS) && !defined(__EMX__) +/* do FTP line-end conversions on most platforms */ +#define CURL_DO_LINEEND_CONV + /* for FTP downloads: track CRLF sequences that span blocks */ + BIT(prev_block_had_trailing_cr); + /* for FTP downloads: how many CRLFs did we converted to LFs? */ + curl_off_t crlf_conversions; +#endif + char *range; /* range, if used. See README for detailed specification on + this syntax. */ + curl_off_t resume_from; /* continue [ftp] transfer from here */ + +#ifndef CURL_DISABLE_RTSP + /* This RTSP state information survives requests and connections */ + long rtsp_next_client_CSeq; /* the session's next client CSeq */ + long rtsp_next_server_CSeq; /* the session's next server CSeq */ + long rtsp_CSeq_recv; /* most recent CSeq received */ + + unsigned char rtp_channel_mask[32]; /* for the correctness checking of the + interleaved data */ +#endif + + curl_off_t infilesize; /* size of file to upload, -1 means unknown. + Copied from set.filesize at start of operation */ +#if defined(USE_HTTP2) || defined(USE_HTTP3) + struct Curl_data_priority priority; /* shallow copy of data->set */ +#endif + + curl_read_callback fread_func; /* read callback/function */ + void *in; /* CURLOPT_READDATA */ + CURLU *uh; /* URL handle for the current parsed URL */ + struct urlpieces up; + char *url; /* work URL, copied from UserDefined */ + char *referer; /* referer string */ + struct curl_slist *resolve; /* set to point to the set.resolve list when + this should be dealt with in pretransfer */ +#ifndef CURL_DISABLE_HTTP + curl_mimepart *mimepost; + curl_mimepart *formp; /* storage for old API form-posting, alloced on + demand */ + size_t trailers_bytes_sent; + struct dynbuf trailers_buf; /* a buffer containing the compiled trailing + headers */ + struct Curl_llist httphdrs; /* received headers */ + struct curl_header headerout[2]; /* for external purposes */ + struct Curl_header_store *prevhead; /* the latest added header */ + trailers_state trailers_state; /* whether we are sending trailers + and what stage are we at */ +#endif +#ifdef USE_HYPER + bool hconnect; /* set if a CONNECT request */ + CURLcode hresult; /* used to pass return codes back from hyper callbacks */ +#endif + + /* Dynamically allocated strings, MUST be freed before this struct is + killed. */ + struct dynamically_allocated_data { + char *proxyuserpwd; + char *uagent; + char *accept_encoding; + char *userpwd; + char *rangeline; + char *ref; + char *host; + char *cookiehost; + char *rtsp_transport; + char *te; /* TE: request header */ + + /* transfer credentials */ + char *user; + char *passwd; + char *proxyuser; + char *proxypasswd; + } aptr; + + unsigned char httpwant; /* when non-zero, a specific HTTP version requested + to be used in the library's request(s) */ + unsigned char httpversion; /* the lowest HTTP version*10 reported by any + server involved in this request */ + unsigned char httpreq; /* Curl_HttpReq; what kind of HTTP request (if any) + is this */ + unsigned char dselect_bits; /* != 0 -> bitmask of socket events for this + transfer overriding anything the socket may + report */ +#ifdef CURLDEBUG + BIT(conncache_lock); +#endif + /* when curl_easy_perform() is called, the multi handle is "owned" by + the easy handle so curl_easy_cleanup() on such an easy handle will + also close the multi handle! */ + BIT(multi_owned_by_easy); + + BIT(this_is_a_follow); /* this is a followed Location: request */ + BIT(refused_stream); /* this was refused, try again */ + BIT(errorbuf); /* Set to TRUE if the error buffer is already filled in. + This must be set to FALSE every time _easy_perform() is + called. */ + BIT(allow_port); /* Is set.use_port allowed to take effect or not. This + is always set TRUE when curl_easy_perform() is called. */ + BIT(authproblem); /* TRUE if there's some problem authenticating */ + /* set after initial USER failure, to prevent an authentication loop */ + BIT(wildcardmatch); /* enable wildcard matching */ + BIT(expect100header); /* TRUE if we added Expect: 100-continue */ + BIT(disableexpect); /* TRUE if Expect: is disabled due to a previous + 417 response */ + BIT(use_range); + BIT(rangestringalloc); /* the range string is malloc()'ed */ + BIT(done); /* set to FALSE when Curl_init_do() is called and set to TRUE + when multi_done() is called, to prevent multi_done() to get + invoked twice when the multi interface is used. */ + BIT(previouslypending); /* this transfer WAS in the multi->pending queue */ +#ifndef CURL_DISABLE_COOKIES + BIT(cookie_engine); +#endif + BIT(prefer_ascii); /* ASCII rather than binary */ +#ifdef CURL_LIST_ONLY_PROTOCOL + BIT(list_only); /* list directory contents */ +#endif + BIT(url_alloc); /* URL string is malloc()'ed */ + BIT(referer_alloc); /* referer string is malloc()ed */ + BIT(wildcard_resolve); /* Set to true if any resolve change is a wildcard */ + BIT(rewindbeforesend);/* TRUE when the sending couldn't be stopped even + though it will be discarded. We must call the data + rewind callback before trying to send again. */ + BIT(upload); /* upload request */ +}; + +/* + * This 'UserDefined' struct must only contain data that is set once to go + * for many (perhaps) independent connections. Values that are generated or + * calculated internally for the "session handle" MUST be defined within the + * 'struct UrlState' instead. The only exceptions MUST note the changes in + * the 'DynamicStatic' struct. + * Character pointer fields point to dynamic storage, unless otherwise stated. + */ + +struct Curl_multi; /* declared in multihandle.c */ + +/* + * This enumeration MUST not use conditional directives (#ifdefs), new + * null terminated strings MUST be added to the enumeration immediately + * before STRING_LASTZEROTERMINATED, binary fields immediately before + * STRING_LAST. When doing so, ensure that the packages/OS400/chkstring.c + * test is updated and applicable changes for EBCDIC to ASCII conversion + * are catered for in curl_easy_setopt_ccsid() + */ +enum dupstring { + STRING_CERT, /* client certificate file name */ + STRING_CERT_PROXY, /* client certificate file name */ + STRING_CERT_TYPE, /* format for certificate (default: PEM)*/ + STRING_CERT_TYPE_PROXY, /* format for certificate (default: PEM)*/ + STRING_COOKIE, /* HTTP cookie string to send */ + STRING_COOKIEJAR, /* dump all cookies to this file */ + STRING_CUSTOMREQUEST, /* HTTP/FTP/RTSP request/method to use */ + STRING_DEFAULT_PROTOCOL, /* Protocol to use when the URL doesn't specify */ + STRING_DEVICE, /* local network interface/address to use */ + STRING_ENCODING, /* Accept-Encoding string */ + STRING_FTP_ACCOUNT, /* ftp account data */ + STRING_FTP_ALTERNATIVE_TO_USER, /* command to send if USER/PASS fails */ + STRING_FTPPORT, /* port to send with the FTP PORT command */ + STRING_KEY, /* private key file name */ + STRING_KEY_PROXY, /* private key file name */ + STRING_KEY_PASSWD, /* plain text private key password */ + STRING_KEY_PASSWD_PROXY, /* plain text private key password */ + STRING_KEY_TYPE, /* format for private key (default: PEM) */ + STRING_KEY_TYPE_PROXY, /* format for private key (default: PEM) */ + STRING_KRB_LEVEL, /* krb security level */ + STRING_NETRC_FILE, /* if not NULL, use this instead of trying to find + $HOME/.netrc */ + STRING_PROXY, /* proxy to use */ + STRING_PRE_PROXY, /* pre socks proxy to use */ + STRING_SET_RANGE, /* range, if used */ + STRING_SET_REFERER, /* custom string for the HTTP referer field */ + STRING_SET_URL, /* what original URL to work on */ + STRING_SSL_CAPATH, /* CA directory name (doesn't work on windows) */ + STRING_SSL_CAPATH_PROXY, /* CA directory name (doesn't work on windows) */ + STRING_SSL_CAFILE, /* certificate file to verify peer against */ + STRING_SSL_CAFILE_PROXY, /* certificate file to verify peer against */ + STRING_SSL_PINNEDPUBLICKEY, /* public key file to verify peer against */ + STRING_SSL_PINNEDPUBLICKEY_PROXY, /* public key file to verify proxy */ + STRING_SSL_CIPHER_LIST, /* list of ciphers to use */ + STRING_SSL_CIPHER_LIST_PROXY, /* list of ciphers to use */ + STRING_SSL_CIPHER13_LIST, /* list of TLS 1.3 ciphers to use */ + STRING_SSL_CIPHER13_LIST_PROXY, /* list of TLS 1.3 ciphers to use */ + STRING_USERAGENT, /* User-Agent string */ + STRING_SSL_CRLFILE, /* crl file to check certificate */ + STRING_SSL_CRLFILE_PROXY, /* crl file to check certificate */ + STRING_SSL_ISSUERCERT, /* issuer cert file to check certificate */ + STRING_SSL_ISSUERCERT_PROXY, /* issuer cert file to check certificate */ + STRING_SSL_ENGINE, /* name of ssl engine */ + STRING_USERNAME, /* , if used */ + STRING_PASSWORD, /* , if used */ + STRING_OPTIONS, /* , if used */ + STRING_PROXYUSERNAME, /* Proxy , if used */ + STRING_PROXYPASSWORD, /* Proxy , if used */ + STRING_NOPROXY, /* List of hosts which should not use the proxy, if + used */ + STRING_RTSP_SESSION_ID, /* Session ID to use */ + STRING_RTSP_STREAM_URI, /* Stream URI for this request */ + STRING_RTSP_TRANSPORT, /* Transport for this session */ + STRING_SSH_PRIVATE_KEY, /* path to the private key file for auth */ + STRING_SSH_PUBLIC_KEY, /* path to the public key file for auth */ + STRING_SSH_HOST_PUBLIC_KEY_MD5, /* md5 of host public key in ascii hex */ + STRING_SSH_HOST_PUBLIC_KEY_SHA256, /* sha256 of host public key in base64 */ + STRING_SSH_KNOWNHOSTS, /* file name of knownhosts file */ + STRING_PROXY_SERVICE_NAME, /* Proxy service name */ + STRING_SERVICE_NAME, /* Service name */ + STRING_MAIL_FROM, + STRING_MAIL_AUTH, + STRING_TLSAUTH_USERNAME, /* TLS auth */ + STRING_TLSAUTH_USERNAME_PROXY, /* TLS auth */ + STRING_TLSAUTH_PASSWORD, /* TLS auth */ + STRING_TLSAUTH_PASSWORD_PROXY, /* TLS auth */ + STRING_BEARER, /* , if used */ + STRING_UNIX_SOCKET_PATH, /* path to Unix socket, if used */ + STRING_TARGET, /* CURLOPT_REQUEST_TARGET */ + STRING_DOH, /* CURLOPT_DOH_URL */ + STRING_ALTSVC, /* CURLOPT_ALTSVC */ + STRING_HSTS, /* CURLOPT_HSTS */ + STRING_SASL_AUTHZID, /* CURLOPT_SASL_AUTHZID */ + STRING_DNS_SERVERS, + STRING_DNS_INTERFACE, + STRING_DNS_LOCAL_IP4, + STRING_DNS_LOCAL_IP6, + STRING_SSL_EC_CURVES, + STRING_AWS_SIGV4, /* Parameters for V4 signature */ + STRING_HAPROXY_CLIENT_IP, /* CURLOPT_HAPROXY_CLIENT_IP */ + + /* -- end of null-terminated strings -- */ + + STRING_LASTZEROTERMINATED, + + /* -- below this are pointers to binary data that cannot be strdup'ed. --- */ + + STRING_COPYPOSTFIELDS, /* if POST, set the fields' values here */ + + STRING_LAST /* not used, just an end-of-list marker */ +}; + +enum dupblob { + BLOB_CERT, + BLOB_CERT_PROXY, + BLOB_KEY, + BLOB_KEY_PROXY, + BLOB_SSL_ISSUERCERT, + BLOB_SSL_ISSUERCERT_PROXY, + BLOB_CAINFO, + BLOB_CAINFO_PROXY, + BLOB_LAST +}; + +/* callback that gets called when this easy handle is completed within a multi + handle. Only used for internally created transfers, like for example + DoH. */ +typedef int (*multidone_func)(struct Curl_easy *easy, CURLcode result); + +struct UserDefined { + FILE *err; /* the stderr user data goes here */ + void *debugdata; /* the data that will be passed to fdebug */ + char *errorbuffer; /* (Static) store failure messages in here */ + void *out; /* CURLOPT_WRITEDATA */ + void *in_set; /* CURLOPT_READDATA */ + void *writeheader; /* write the header to this if non-NULL */ + unsigned short use_port; /* which port to use (when not using default) */ + unsigned long httpauth; /* kind of HTTP authentication to use (bitmask) */ + unsigned long proxyauth; /* kind of proxy authentication to use (bitmask) */ + long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1 + for infinity */ + + void *postfields; /* if POST, set the fields' values here */ + curl_seek_callback seek_func; /* function that seeks the input */ + curl_off_t postfieldsize; /* if POST, this might have a size to use instead + of strlen(), and then the data *may* be binary + (contain zero bytes) */ +#ifndef CURL_DISABLE_BINDLOCAL + unsigned short localport; /* local port number to bind to */ + unsigned short localportrange; /* number of additional port numbers to test + in case the 'localport' one can't be + bind()ed */ +#endif + curl_write_callback fwrite_func; /* function that stores the output */ + curl_write_callback fwrite_header; /* function that stores headers */ + curl_write_callback fwrite_rtp; /* function that stores interleaved RTP */ + curl_read_callback fread_func_set; /* function that reads the input */ + curl_progress_callback fprogress; /* OLD and deprecated progress callback */ + curl_xferinfo_callback fxferinfo; /* progress callback */ + curl_debug_callback fdebug; /* function that write informational data */ + curl_ioctl_callback ioctl_func; /* function for I/O control */ + curl_sockopt_callback fsockopt; /* function for setting socket options */ + void *sockopt_client; /* pointer to pass to the socket options callback */ + curl_opensocket_callback fopensocket; /* function for checking/translating + the address and opening the + socket */ + void *opensocket_client; + curl_closesocket_callback fclosesocket; /* function for closing the + socket */ + void *closesocket_client; + curl_prereq_callback fprereq; /* pre-initial request callback */ + void *prereq_userp; /* pre-initial request user data */ + + void *seek_client; /* pointer to pass to the seek callback */ +#ifndef CURL_DISABLE_COOKIES + struct curl_slist *cookielist; /* list of cookie files set by + curl_easy_setopt(COOKIEFILE) calls */ +#endif +#ifndef CURL_DISABLE_HSTS + struct curl_slist *hstslist; /* list of HSTS files set by + curl_easy_setopt(HSTS) calls */ + curl_hstsread_callback hsts_read; + void *hsts_read_userp; + curl_hstswrite_callback hsts_write; + void *hsts_write_userp; +#endif + void *progress_client; /* pointer to pass to the progress callback */ + void *ioctl_client; /* pointer to pass to the ioctl callback */ + unsigned int timeout; /* ms, 0 means no timeout */ + unsigned int connecttimeout; /* ms, 0 means no timeout */ + unsigned int happy_eyeballs_timeout; /* ms, 0 is a valid value */ + unsigned int server_response_timeout; /* ms, 0 means no timeout */ + long maxage_conn; /* in seconds, max idle time to allow a connection that + is to be reused */ + long maxlifetime_conn; /* in seconds, max time since creation to allow a + connection that is to be reused */ +#ifndef CURL_DISABLE_TFTP + long tftp_blksize; /* in bytes, 0 means use default */ +#endif + curl_off_t filesize; /* size of file to upload, -1 means unknown */ + long low_speed_limit; /* bytes/second */ + long low_speed_time; /* number of seconds */ + curl_off_t max_send_speed; /* high speed limit in bytes/second for upload */ + curl_off_t max_recv_speed; /* high speed limit in bytes/second for + download */ + curl_off_t set_resume_from; /* continue [ftp] transfer from here */ + struct curl_slist *headers; /* linked list of extra headers */ + struct curl_httppost *httppost; /* linked list of old POST data */ + curl_mimepart mimepost; /* MIME/POST data. */ +#ifndef CURL_DISABLE_TELNET + struct curl_slist *telnet_options; /* linked list of telnet options */ +#endif + struct curl_slist *resolve; /* list of names to add/remove from + DNS cache */ + struct curl_slist *connect_to; /* list of host:port mappings to override + the hostname and port to connect to */ + time_t timevalue; /* what time to compare with */ + unsigned char timecondition; /* kind of time comparison: curl_TimeCond */ + unsigned char method; /* what kind of HTTP request: Curl_HttpReq */ + unsigned char httpwant; /* when non-zero, a specific HTTP version requested + to be used in the library's request(s) */ + struct ssl_config_data ssl; /* user defined SSL stuff */ +#ifndef CURL_DISABLE_PROXY + struct ssl_config_data proxy_ssl; /* user defined SSL stuff for proxy */ + struct curl_slist *proxyheaders; /* linked list of extra CONNECT headers */ + unsigned short proxyport; /* If non-zero, use this port number by + default. If the proxy string features a + ":[port]" that one will override this. */ + unsigned char proxytype; /* what kind of proxy: curl_proxytype */ + unsigned char socks5auth;/* kind of SOCKS5 authentication to use (bitmask) */ +#endif + struct ssl_general_config general_ssl; /* general user defined SSL stuff */ + int dns_cache_timeout; /* DNS cache timeout (seconds) */ + unsigned int buffer_size; /* size of receive buffer to use */ + unsigned int upload_buffer_size; /* size of upload buffer to use, + keep it >= CURL_MAX_WRITE_SIZE */ + void *private_data; /* application-private data */ +#ifndef CURL_DISABLE_HTTP + struct curl_slist *http200aliases; /* linked list of aliases for http200 */ +#endif + unsigned char ipver; /* the CURL_IPRESOLVE_* defines in the public header + file 0 - whatever, 1 - v2, 2 - v6 */ + curl_off_t max_filesize; /* Maximum file size to download */ +#ifndef CURL_DISABLE_FTP + unsigned char ftp_filemethod; /* how to get to a file: curl_ftpfile */ + unsigned char ftpsslauth; /* what AUTH XXX to try: curl_ftpauth */ + unsigned char ftp_ccc; /* FTP CCC options: curl_ftpccc */ + unsigned int accepttimeout; /* in milliseconds, 0 means no timeout */ +#endif +#if !defined(CURL_DISABLE_FTP) || defined(USE_SSH) + struct curl_slist *quote; /* after connection is established */ + struct curl_slist *postquote; /* after the transfer */ + struct curl_slist *prequote; /* before the transfer, after type */ + /* Despite the name, ftp_create_missing_dirs is for FTP(S) and SFTP + 1 - create directories that don't exist + 2 - the same but also allow MKD to fail once + */ + unsigned char ftp_create_missing_dirs; +#endif +#ifdef USE_LIBSSH2 + curl_sshhostkeycallback ssh_hostkeyfunc; /* hostkey check callback */ + void *ssh_hostkeyfunc_userp; /* custom pointer to callback */ +#endif +#ifdef USE_SSH + curl_sshkeycallback ssh_keyfunc; /* key matching callback */ + void *ssh_keyfunc_userp; /* custom pointer to callback */ + int ssh_auth_types; /* allowed SSH auth types */ + unsigned int new_directory_perms; /* when creating remote dirs */ +#endif +#ifndef CURL_DISABLE_NETRC + unsigned char use_netrc; /* enum CURL_NETRC_OPTION values */ +#endif + unsigned int new_file_perms; /* when creating remote files */ + char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */ + struct curl_blob *blobs[BLOB_LAST]; +#ifdef ENABLE_IPV6 + unsigned int scope_id; /* Scope id for IPv6 */ +#endif + curl_prot_t allowed_protocols; + curl_prot_t redir_protocols; +#ifndef CURL_DISABLE_MIME + unsigned int mime_options; /* Mime option flags. */ +#endif +#ifndef CURL_DISABLE_RTSP + void *rtp_out; /* write RTP to this if non-NULL */ + /* Common RTSP header options */ + Curl_RtspReq rtspreq; /* RTSP request type */ +#endif +#ifndef CURL_DISABLE_FTP + curl_chunk_bgn_callback chunk_bgn; /* called before part of transfer + starts */ + curl_chunk_end_callback chunk_end; /* called after part transferring + stopped */ + curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds + to pattern (e.g. if WILDCARDMATCH is on) */ + void *fnmatch_data; + void *wildcardptr; +#endif + /* GSS-API credential delegation, see the documentation of + CURLOPT_GSSAPI_DELEGATION */ + unsigned char gssapi_delegation; + + int tcp_keepidle; /* seconds in idle before sending keepalive probe */ + int tcp_keepintvl; /* seconds between TCP keepalive probes */ + + size_t maxconnects; /* Max idle connections in the connection cache */ + + long expect_100_timeout; /* in milliseconds */ +#if defined(USE_HTTP2) || defined(USE_HTTP3) + struct Curl_data_priority priority; +#endif + curl_resolver_start_callback resolver_start; /* optional callback called + before resolver start */ + void *resolver_start_client; /* pointer to pass to resolver start callback */ + long upkeep_interval_ms; /* Time between calls for connection upkeep. */ + multidone_func fmultidone; +#ifndef CURL_DISABLE_DOH + struct Curl_easy *dohfor; /* this is a DoH request for that transfer */ +#endif + CURLU *uh; /* URL handle for the current parsed URL */ +#ifndef CURL_DISABLE_HTTP + void *trailer_data; /* pointer to pass to trailer data callback */ + curl_trailer_callback trailer_callback; /* trailing data callback */ +#endif + char keep_post; /* keep POSTs as POSTs after a 30x request; each + bit represents a request, from 301 to 303 */ +#ifndef CURL_DISABLE_SMTP + struct curl_slist *mail_rcpt; /* linked list of mail recipients */ + BIT(mail_rcpt_allowfails); /* allow RCPT TO command to fail for some + recipients */ +#endif + unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or + IMAP or POP3 or others! (type: curl_usessl)*/ + unsigned char connect_only; /* make connection/request, then let + application use the socket */ + BIT(is_fread_set); /* has read callback been set to non-NULL? */ +#ifndef CURL_DISABLE_TFTP + BIT(tftp_no_options); /* do not send TFTP options requests */ +#endif + BIT(sep_headers); /* handle host and proxy headers separately */ +#ifndef CURL_DISABLE_COOKIES + BIT(cookiesession); /* new cookie session? */ +#endif + BIT(crlf); /* convert crlf on ftp upload(?) */ + BIT(ssh_compression); /* enable SSH compression */ + +/* Here follows boolean settings that define how to behave during + this session. They are STATIC, set by libcurl users or at least initially + and they don't change during operations. */ + BIT(quick_exit); /* set 1L when it is okay to leak things (like + threads), as we're about to exit() anyway and + don't want lengthy cleanups to delay termination, + e.g. after a DNS timeout */ + BIT(get_filetime); /* get the time and get of the remote file */ + BIT(tunnel_thru_httpproxy); /* use CONNECT through an HTTP proxy */ + BIT(prefer_ascii); /* ASCII rather than binary */ + BIT(remote_append); /* append, not overwrite, on upload */ +#ifdef CURL_LIST_ONLY_PROTOCOL + BIT(list_only); /* list directory */ +#endif +#ifndef CURL_DISABLE_FTP + BIT(ftp_use_port); /* use the FTP PORT command */ + BIT(ftp_use_epsv); /* if EPSV is to be attempted or not */ + BIT(ftp_use_eprt); /* if EPRT is to be attempted or not */ + BIT(ftp_use_pret); /* if PRET is to be used before PASV or not */ + BIT(ftp_skip_ip); /* skip the IP address the FTP server passes on to + us */ + BIT(wildcard_enabled); /* enable wildcard matching */ +#endif + BIT(hide_progress); /* don't use the progress meter */ + BIT(http_fail_on_error); /* fail on HTTP error codes >= 400 */ + BIT(http_keep_sending_on_error); /* for HTTP status codes >= 300 */ + BIT(http_follow_location); /* follow HTTP redirects */ + BIT(http_transfer_encoding); /* request compressed HTTP transfer-encoding */ + BIT(allow_auth_to_other_hosts); + BIT(include_header); /* include received protocol headers in data output */ + BIT(http_set_referer); /* is a custom referer used */ + BIT(http_auto_referer); /* set "correct" referer when following + location: */ + BIT(opt_no_body); /* as set with CURLOPT_NOBODY */ + BIT(verbose); /* output verbosity */ + BIT(krb); /* Kerberos connection requested */ + BIT(reuse_forbid); /* forbidden to be reused, close after use */ + BIT(reuse_fresh); /* do not reuse an existing connection */ + BIT(no_signal); /* do not use any signal/alarm handler */ + BIT(tcp_nodelay); /* whether to enable TCP_NODELAY or not */ + BIT(ignorecl); /* ignore content length */ + BIT(http_te_skip); /* pass the raw body data to the user, even when + transfer-encoded (chunked, compressed) */ + BIT(http_ce_skip); /* pass the raw body data to the user, even when + content-encoded (chunked, compressed) */ + BIT(proxy_transfer_mode); /* set transfer mode (;type=) when doing + FTP via an HTTP proxy */ +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + BIT(socks5_gssapi_nec); /* Flag to support NEC SOCKS5 server */ +#endif + BIT(sasl_ir); /* Enable/disable SASL initial response */ + BIT(tcp_keepalive); /* use TCP keepalives */ + BIT(tcp_fastopen); /* use TCP Fast Open */ + BIT(ssl_enable_alpn);/* TLS ALPN extension? */ + BIT(path_as_is); /* allow dotdots? */ + BIT(pipewait); /* wait for multiplex status before starting a new + connection */ + BIT(suppress_connect_headers); /* suppress proxy CONNECT response headers + from user callbacks */ + BIT(dns_shuffle_addresses); /* whether to shuffle addresses before use */ + BIT(haproxyprotocol); /* whether to send HAProxy PROXY protocol v1 + header */ + BIT(abstract_unix_socket); + BIT(disallow_username_in_url); /* disallow username in url */ +#ifndef CURL_DISABLE_DOH + BIT(doh); /* DNS-over-HTTPS enabled */ + BIT(doh_verifypeer); /* DoH certificate peer verification */ + BIT(doh_verifyhost); /* DoH certificate hostname verification */ + BIT(doh_verifystatus); /* DoH certificate status verification */ +#endif + BIT(http09_allowed); /* allow HTTP/0.9 responses */ +#ifdef USE_WEBSOCKETS + BIT(ws_raw_mode); +#endif +}; + +struct Names { + struct Curl_hash *hostcache; + enum { + HCACHE_NONE, /* not pointing to anything */ + HCACHE_MULTI, /* points to a shared one in the multi handle */ + HCACHE_SHARED /* points to a shared one in a shared object */ + } hostcachetype; +}; + +/* + * The 'connectdata' struct MUST have all the connection oriented stuff as we + * may have several simultaneous connections and connection structs in memory. + * + * The 'struct UserDefined' must only contain data that is set once to go for + * many (perhaps) independent connections. Values that are generated or + * calculated internally for the "session handle" must be defined within the + * 'struct UrlState' instead. + */ + +struct Curl_easy { + /* First a simple identifier to easier detect if a user mix up this easy + handle with a multi handle. Set this to CURLEASY_MAGIC_NUMBER */ + unsigned int magic; + /* once an easy handle is tied to a connection cache + a non-negative number to distinguish this transfer from + other using the same cache. For easier tracking + in log output. + This may wrap around after LONG_MAX to 0 again, so it + has no uniqueness guarantee for very large processings. */ + curl_off_t id; + + /* first, two fields for the linked list of these */ + struct Curl_easy *next; + struct Curl_easy *prev; + + struct connectdata *conn; + struct Curl_llist_element connect_queue; /* for the pending and msgsent + lists */ + struct Curl_llist_element conn_queue; /* list per connectdata */ + + CURLMstate mstate; /* the handle's state */ + CURLcode result; /* previous result */ + + struct Curl_message msg; /* A single posted message. */ + + /* Array with the plain socket numbers this handle takes care of, in no + particular order. Note that all sockets are added to the sockhash, where + the state etc are also kept. This array is mostly used to detect when a + socket is to be removed from the hash. See singlesocket(). */ + curl_socket_t sockets[MAX_SOCKSPEREASYHANDLE]; + unsigned char actions[MAX_SOCKSPEREASYHANDLE]; /* action for each socket in + sockets[] */ + int numsocks; + + struct Names dns; + struct Curl_multi *multi; /* if non-NULL, points to the multi handle + struct to which this "belongs" when used by + the multi interface */ + struct Curl_multi *multi_easy; /* if non-NULL, points to the multi handle + struct to which this "belongs" when used + by the easy interface */ + struct Curl_share *share; /* Share, handles global variable mutexing */ +#ifdef USE_LIBPSL + struct PslCache *psl; /* The associated PSL cache. */ +#endif + struct SingleRequest req; /* Request-specific data */ + struct UserDefined set; /* values set by the libcurl user */ +#ifndef CURL_DISABLE_COOKIES + struct CookieInfo *cookies; /* the cookies, read from files and servers. + NOTE that the 'cookie' field in the + UserDefined struct defines if the "engine" + is to be used or not. */ +#endif +#ifndef CURL_DISABLE_HSTS + struct hsts *hsts; +#endif +#ifndef CURL_DISABLE_ALTSVC + struct altsvcinfo *asi; /* the alt-svc cache */ +#endif + struct Progress progress; /* for all the progress meter data */ + struct UrlState state; /* struct for fields used for state info and + other dynamic purposes */ +#ifndef CURL_DISABLE_FTP + struct WildcardData *wildcard; /* wildcard download state info */ +#endif + struct PureInfo info; /* stats, reports and info data */ + struct curl_tlssessioninfo tsi; /* Information about the TLS session, only + valid after a client has asked for it */ +#ifdef USE_HYPER + struct hyptransfer hyp; +#endif + + /* internal: true if this easy handle was created for internal use and the + user does not have ownership of the handle. */ + bool internal; +}; + +#define LIBCURL_NAME "libcurl" + +#endif /* HEADER_CURL_URLDATA_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vauth/digest.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vauth/digest.h new file mode 100644 index 0000000000000000000000000000000000000000..99ce1f9138920ae30007411928a57e8536315eac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vauth/digest.h @@ -0,0 +1,40 @@ +#ifndef HEADER_CURL_DIGEST_H +#define HEADER_CURL_DIGEST_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include + +#ifndef CURL_DISABLE_DIGEST_AUTH + +#define DIGEST_MAX_VALUE_LENGTH 256 +#define DIGEST_MAX_CONTENT_LENGTH 1024 + +/* This is used to extract the realm from a challenge message */ +bool Curl_auth_digest_get_pair(const char *str, char *value, char *content, + const char **endptr); + +#endif + +#endif /* HEADER_CURL_DIGEST_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vauth/ntlm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vauth/ntlm.h new file mode 100644 index 0000000000000000000000000000000000000000..31ce921cd1284f674198a7b3d0c7f263a1e7752b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vauth/ntlm.h @@ -0,0 +1,143 @@ +#ifndef HEADER_VAUTH_NTLM_H +#define HEADER_VAUTH_NTLM_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_NTLM + +/* NTLM buffer fixed size, large enough for long user + host + domain */ +#define NTLM_BUFSIZE 1024 + +/* Stuff only required for curl_ntlm_msgs.c */ +#ifdef BUILDING_CURL_NTLM_MSGS_C + +/* Flag bits definitions based on + https://davenport.sourceforge.net/ntlm.html */ + +#define NTLMFLAG_NEGOTIATE_UNICODE (1<<0) +/* Indicates that Unicode strings are supported for use in security buffer + data. */ + +#define NTLMFLAG_NEGOTIATE_OEM (1<<1) +/* Indicates that OEM strings are supported for use in security buffer data. */ + +#define NTLMFLAG_REQUEST_TARGET (1<<2) +/* Requests that the server's authentication realm be included in the Type 2 + message. */ + +/* unknown (1<<3) */ +#define NTLMFLAG_NEGOTIATE_SIGN (1<<4) +/* Specifies that authenticated communication between the client and server + should carry a digital signature (message integrity). */ + +#define NTLMFLAG_NEGOTIATE_SEAL (1<<5) +/* Specifies that authenticated communication between the client and server + should be encrypted (message confidentiality). */ + +#define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE (1<<6) +/* Indicates that datagram authentication is being used. */ + +#define NTLMFLAG_NEGOTIATE_LM_KEY (1<<7) +/* Indicates that the LAN Manager session key should be used for signing and + sealing authenticated communications. */ + +#define NTLMFLAG_NEGOTIATE_NTLM_KEY (1<<9) +/* Indicates that NTLM authentication is being used. */ + +/* unknown (1<<10) */ + +#define NTLMFLAG_NEGOTIATE_ANONYMOUS (1<<11) +/* Sent by the client in the Type 3 message to indicate that an anonymous + context has been established. This also affects the response fields. */ + +#define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED (1<<12) +/* Sent by the client in the Type 1 message to indicate that a desired + authentication realm is included in the message. */ + +#define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED (1<<13) +/* Sent by the client in the Type 1 message to indicate that the client + workstation's name is included in the message. */ + +#define NTLMFLAG_NEGOTIATE_LOCAL_CALL (1<<14) +/* Sent by the server to indicate that the server and client are on the same + machine. Implies that the client may use a pre-established local security + context rather than responding to the challenge. */ + +#define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN (1<<15) +/* Indicates that authenticated communication between the client and server + should be signed with a "dummy" signature. */ + +#define NTLMFLAG_TARGET_TYPE_DOMAIN (1<<16) +/* Sent by the server in the Type 2 message to indicate that the target + authentication realm is a domain. */ + +#define NTLMFLAG_TARGET_TYPE_SERVER (1<<17) +/* Sent by the server in the Type 2 message to indicate that the target + authentication realm is a server. */ + +#define NTLMFLAG_TARGET_TYPE_SHARE (1<<18) +/* Sent by the server in the Type 2 message to indicate that the target + authentication realm is a share. Presumably, this is for share-level + authentication. Usage is unclear. */ + +#define NTLMFLAG_NEGOTIATE_NTLM2_KEY (1<<19) +/* Indicates that the NTLM2 signing and sealing scheme should be used for + protecting authenticated communications. */ + +#define NTLMFLAG_REQUEST_INIT_RESPONSE (1<<20) +/* unknown purpose */ + +#define NTLMFLAG_REQUEST_ACCEPT_RESPONSE (1<<21) +/* unknown purpose */ + +#define NTLMFLAG_REQUEST_NONNT_SESSION_KEY (1<<22) +/* unknown purpose */ + +#define NTLMFLAG_NEGOTIATE_TARGET_INFO (1<<23) +/* Sent by the server in the Type 2 message to indicate that it is including a + Target Information block in the message. */ + +/* unknown (1<24) */ +/* unknown (1<25) */ +/* unknown (1<26) */ +/* unknown (1<27) */ +/* unknown (1<28) */ + +#define NTLMFLAG_NEGOTIATE_128 (1<<29) +/* Indicates that 128-bit encryption is supported. */ + +#define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE (1<<30) +/* Indicates that the client will provide an encrypted master key in + the "Session Key" field of the Type 3 message. */ + +#define NTLMFLAG_NEGOTIATE_56 (1<<31) +/* Indicates that 56-bit encryption is supported. */ + +#endif /* BUILDING_CURL_NTLM_MSGS_C */ + +#endif /* USE_NTLM */ + +#endif /* HEADER_VAUTH_NTLM_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vauth/vauth.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vauth/vauth.h new file mode 100644 index 0000000000000000000000000000000000000000..9da05408922a40513d23b62f4d8d308238a7e4d1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vauth/vauth.h @@ -0,0 +1,238 @@ +#ifndef HEADER_CURL_VAUTH_H +#define HEADER_CURL_VAUTH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Steve Holme, . + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include + +#include "bufref.h" + +struct Curl_easy; + +#if !defined(CURL_DISABLE_DIGEST_AUTH) +struct digestdata; +#endif + +#if defined(USE_NTLM) +struct ntlmdata; +#endif + +#if defined(USE_KERBEROS5) +struct kerberos5data; +#endif + +#if (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) && defined(USE_SPNEGO) +struct negotiatedata; +#endif + +#if defined(USE_GSASL) +struct gsasldata; +#endif + +#if defined(USE_WINDOWS_SSPI) +#define GSS_ERROR(status) ((status) & 0x80000000) +#endif + +/* + * Curl_auth_allowed_to_host() tells if authentication, cookies or other + * "sensitive data" can (still) be sent to this host. + */ +bool Curl_auth_allowed_to_host(struct Curl_easy *data); + +/* This is used to build a SPN string */ +#if !defined(USE_WINDOWS_SSPI) +char *Curl_auth_build_spn(const char *service, const char *host, + const char *realm); +#else +TCHAR *Curl_auth_build_spn(const char *service, const char *host, + const char *realm); +#endif + +/* This is used to test if the user contains a Windows domain name */ +bool Curl_auth_user_contains_domain(const char *user); + +/* This is used to generate a PLAIN cleartext message */ +CURLcode Curl_auth_create_plain_message(const char *authzid, + const char *authcid, + const char *passwd, + struct bufref *out); + +/* This is used to generate a LOGIN cleartext message */ +CURLcode Curl_auth_create_login_message(const char *value, + struct bufref *out); + +/* This is used to generate an EXTERNAL cleartext message */ +CURLcode Curl_auth_create_external_message(const char *user, + struct bufref *out); + +#ifndef CURL_DISABLE_DIGEST_AUTH +/* This is used to generate a CRAM-MD5 response message */ +CURLcode Curl_auth_create_cram_md5_message(const struct bufref *chlg, + const char *userp, + const char *passwdp, + struct bufref *out); + +/* This is used to evaluate if DIGEST is supported */ +bool Curl_auth_is_digest_supported(void); + +/* This is used to generate a base64 encoded DIGEST-MD5 response message */ +CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data, + const struct bufref *chlg, + const char *userp, + const char *passwdp, + const char *service, + struct bufref *out); + +/* This is used to decode an HTTP DIGEST challenge message */ +CURLcode Curl_auth_decode_digest_http_message(const char *chlg, + struct digestdata *digest); + +/* This is used to generate an HTTP DIGEST response message */ +CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, + const char *userp, + const char *passwdp, + const unsigned char *request, + const unsigned char *uri, + struct digestdata *digest, + char **outptr, size_t *outlen); + +/* This is used to clean up the digest specific data */ +void Curl_auth_digest_cleanup(struct digestdata *digest); +#endif /* !CURL_DISABLE_DIGEST_AUTH */ + +#ifdef USE_GSASL +/* This is used to evaluate if MECH is supported by gsasl */ +bool Curl_auth_gsasl_is_supported(struct Curl_easy *data, + const char *mech, + struct gsasldata *gsasl); +/* This is used to start a gsasl method */ +CURLcode Curl_auth_gsasl_start(struct Curl_easy *data, + const char *userp, + const char *passwdp, + struct gsasldata *gsasl); + +/* This is used to process and generate a new SASL token */ +CURLcode Curl_auth_gsasl_token(struct Curl_easy *data, + const struct bufref *chlg, + struct gsasldata *gsasl, + struct bufref *out); + +/* This is used to clean up the gsasl specific data */ +void Curl_auth_gsasl_cleanup(struct gsasldata *digest); +#endif + +#if defined(USE_NTLM) +/* This is used to evaluate if NTLM is supported */ +bool Curl_auth_is_ntlm_supported(void); + +/* This is used to generate a base64 encoded NTLM type-1 message */ +CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data, + const char *userp, + const char *passwdp, + const char *service, + const char *host, + struct ntlmdata *ntlm, + struct bufref *out); + +/* This is used to decode a base64 encoded NTLM type-2 message */ +CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data, + const struct bufref *type2, + struct ntlmdata *ntlm); + +/* This is used to generate a base64 encoded NTLM type-3 message */ +CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data, + const char *userp, + const char *passwdp, + struct ntlmdata *ntlm, + struct bufref *out); + +/* This is used to clean up the NTLM specific data */ +void Curl_auth_cleanup_ntlm(struct ntlmdata *ntlm); +#endif /* USE_NTLM */ + +/* This is used to generate a base64 encoded OAuth 2.0 message */ +CURLcode Curl_auth_create_oauth_bearer_message(const char *user, + const char *host, + const long port, + const char *bearer, + struct bufref *out); + +/* This is used to generate a base64 encoded XOAuth 2.0 message */ +CURLcode Curl_auth_create_xoauth_bearer_message(const char *user, + const char *bearer, + struct bufref *out); + +#if defined(USE_KERBEROS5) +/* This is used to evaluate if GSSAPI (Kerberos V5) is supported */ +bool Curl_auth_is_gssapi_supported(void); + +/* This is used to generate a base64 encoded GSSAPI (Kerberos V5) user token + message */ +CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data, + const char *userp, + const char *passwdp, + const char *service, + const char *host, + const bool mutual, + const struct bufref *chlg, + struct kerberos5data *krb5, + struct bufref *out); + +/* This is used to generate a base64 encoded GSSAPI (Kerberos V5) security + token message */ +CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data, + const char *authzid, + const struct bufref *chlg, + struct kerberos5data *krb5, + struct bufref *out); + +/* This is used to clean up the GSSAPI specific data */ +void Curl_auth_cleanup_gssapi(struct kerberos5data *krb5); +#endif /* USE_KERBEROS5 */ + +#if defined(USE_SPNEGO) +/* This is used to evaluate if SPNEGO (Negotiate) is supported */ +bool Curl_auth_is_spnego_supported(void); + +/* This is used to decode a base64 encoded SPNEGO (Negotiate) challenge + message */ +CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data, + const char *user, + const char *password, + const char *service, + const char *host, + const char *chlg64, + struct negotiatedata *nego); + +/* This is used to generate a base64 encoded SPNEGO (Negotiate) response + message */ +CURLcode Curl_auth_create_spnego_message(struct negotiatedata *nego, + char **outptr, size_t *outlen); + +/* This is used to clean up the SPNEGO specific data */ +void Curl_auth_cleanup_spnego(struct negotiatedata *nego); + +#endif /* USE_SPNEGO */ + +#endif /* HEADER_CURL_VAUTH_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/version_win32.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/version_win32.h new file mode 100644 index 0000000000000000000000000000000000000000..3899174a311f7927becac10de7b4b102fb69b6ca --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/version_win32.h @@ -0,0 +1,56 @@ +#ifndef HEADER_CURL_VERSION_WIN32_H +#define HEADER_CURL_VERSION_WIN32_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Steve Holme, . + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(WIN32) + +/* Version condition */ +typedef enum { + VERSION_LESS_THAN, + VERSION_LESS_THAN_EQUAL, + VERSION_EQUAL, + VERSION_GREATER_THAN_EQUAL, + VERSION_GREATER_THAN +} VersionCondition; + +/* Platform identifier */ +typedef enum { + PLATFORM_DONT_CARE, + PLATFORM_WINDOWS, + PLATFORM_WINNT +} PlatformIdentifier; + +/* This is used to verify if we are running on a specific windows version */ +bool curlx_verify_windows_version(const unsigned int majorVersion, + const unsigned int minorVersion, + const unsigned int buildVersion, + const PlatformIdentifier platform, + const VersionCondition condition); + +#endif /* WIN32 */ + +#endif /* HEADER_CURL_VERSION_WIN32_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/curl_msh3.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/curl_msh3.h new file mode 100644 index 0000000000000000000000000000000000000000..33931f59bbcfd2a85b76e2ba7b6911a3ae6f30da --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/curl_msh3.h @@ -0,0 +1,46 @@ +#ifndef HEADER_CURL_VQUIC_CURL_MSH3_H +#define HEADER_CURL_VQUIC_CURL_MSH3_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_MSH3 + +#include + +void Curl_msh3_ver(char *p, size_t len); + +CURLcode Curl_cf_msh3_create(struct Curl_cfilter **pcf, + struct Curl_easy *data, + struct connectdata *conn, + const struct Curl_addrinfo *ai); + +bool Curl_conn_is_msh3(const struct Curl_easy *data, + const struct connectdata *conn, + int sockindex); + +#endif /* USE_MSQUIC */ + +#endif /* HEADER_CURL_VQUIC_CURL_MSH3_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/curl_ngtcp2.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/curl_ngtcp2.h new file mode 100644 index 0000000000000000000000000000000000000000..db3e611bd0c84e273271238702b99e3077d13a17 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/curl_ngtcp2.h @@ -0,0 +1,61 @@ +#ifndef HEADER_CURL_VQUIC_CURL_NGTCP2_H +#define HEADER_CURL_VQUIC_CURL_NGTCP2_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(USE_NGTCP2) && defined(USE_NGHTTP3) + +#ifdef HAVE_NETINET_UDP_H +#include +#endif + +#include +#include +#ifdef USE_OPENSSL +#include +#elif defined(USE_WOLFSSL) +#include +#include +#include +#endif + +struct Curl_cfilter; + +#include "urldata.h" + +void Curl_ngtcp2_ver(char *p, size_t len); + +CURLcode Curl_cf_ngtcp2_create(struct Curl_cfilter **pcf, + struct Curl_easy *data, + struct connectdata *conn, + const struct Curl_addrinfo *ai); + +bool Curl_conn_is_ngtcp2(const struct Curl_easy *data, + const struct connectdata *conn, + int sockindex); +#endif + +#endif /* HEADER_CURL_VQUIC_CURL_NGTCP2_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/curl_quiche.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/curl_quiche.h new file mode 100644 index 0000000000000000000000000000000000000000..bce781c1bccc0f1e019524305e50317f0528d1d4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/curl_quiche.h @@ -0,0 +1,50 @@ +#ifndef HEADER_CURL_VQUIC_CURL_QUICHE_H +#define HEADER_CURL_VQUIC_CURL_QUICHE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_QUICHE + +#include +#include + +struct Curl_cfilter; +struct Curl_easy; + +void Curl_quiche_ver(char *p, size_t len); + +CURLcode Curl_cf_quiche_create(struct Curl_cfilter **pcf, + struct Curl_easy *data, + struct connectdata *conn, + const struct Curl_addrinfo *ai); + +bool Curl_conn_is_quiche(const struct Curl_easy *data, + const struct connectdata *conn, + int sockindex); + +#endif + +#endif /* HEADER_CURL_VQUIC_CURL_QUICHE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/vquic.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/vquic.h new file mode 100644 index 0000000000000000000000000000000000000000..dc73957aaf64b17c00f14ddb3d4e98c627ef1ece --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/vquic.h @@ -0,0 +1,64 @@ +#ifndef HEADER_CURL_VQUIC_QUIC_H +#define HEADER_CURL_VQUIC_QUIC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef ENABLE_QUIC +struct Curl_cfilter; +struct Curl_easy; +struct connectdata; +struct Curl_addrinfo; + +void Curl_quic_ver(char *p, size_t len); + +CURLcode Curl_qlogdir(struct Curl_easy *data, + unsigned char *scid, + size_t scidlen, + int *qlogfdp); + + +CURLcode Curl_cf_quic_create(struct Curl_cfilter **pcf, + struct Curl_easy *data, + struct connectdata *conn, + const struct Curl_addrinfo *ai, + int transport); + +bool Curl_conn_is_http3(const struct Curl_easy *data, + const struct connectdata *conn, + int sockindex); + +extern struct Curl_cftype Curl_cft_http3; + +#else /* ENABLE_QUIC */ + +#define Curl_conn_is_http3(a,b,c) FALSE + +#endif /* !ENABLE_QUIC */ + +CURLcode Curl_conn_may_http3(struct Curl_easy *data, + const struct connectdata *conn); + +#endif /* HEADER_CURL_VQUIC_QUIC_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/vquic_int.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/vquic_int.h new file mode 100644 index 0000000000000000000000000000000000000000..dbcd009d72121d211582e9b183f7f89c266dc735 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vquic/vquic_int.h @@ -0,0 +1,85 @@ +#ifndef HEADER_CURL_VQUIC_QUIC_INT_H +#define HEADER_CURL_VQUIC_QUIC_INT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include "bufq.h" + +#ifdef ENABLE_QUIC + +#define MAX_PKT_BURST 10 +#define MAX_UDP_PAYLOAD_SIZE 1452 + +struct cf_quic_ctx { + curl_socket_t sockfd; /* connected UDP socket */ + struct sockaddr_storage local_addr; /* address socket is bound to */ + socklen_t local_addrlen; /* length of local address */ + + struct bufq sendbuf; /* buffer for sending one or more packets */ + size_t gsolen; /* length of individual packets in send buf */ + size_t split_len; /* if != 0, buffer length after which GSO differs */ + size_t split_gsolen; /* length of individual packets after split_len */ +#ifdef DEBUGBUILD + int wblock_percent; /* percent of writes doing EAGAIN */ +#endif + bool no_gso; /* do not use gso on sending */ +}; + +CURLcode vquic_ctx_init(struct cf_quic_ctx *qctx); +void vquic_ctx_free(struct cf_quic_ctx *qctx); + +void vquic_push_blocked_pkt(struct Curl_cfilter *cf, + struct cf_quic_ctx *qctx, + const uint8_t *pkt, size_t pktlen, size_t gsolen); + +CURLcode vquic_send_blocked_pkts(struct Curl_cfilter *cf, + struct Curl_easy *data, + struct cf_quic_ctx *qctx); + +CURLcode vquic_send(struct Curl_cfilter *cf, struct Curl_easy *data, + struct cf_quic_ctx *qctx, size_t gsolen); + +CURLcode vquic_send_tail_split(struct Curl_cfilter *cf, struct Curl_easy *data, + struct cf_quic_ctx *qctx, size_t gsolen, + size_t tail_len, size_t tail_gsolen); + +CURLcode vquic_flush(struct Curl_cfilter *cf, struct Curl_easy *data, + struct cf_quic_ctx *qctx); + + +typedef CURLcode vquic_recv_pkt_cb(const unsigned char *pkt, size_t pktlen, + struct sockaddr_storage *remote_addr, + socklen_t remote_addrlen, int ecn, + void *userp); + +CURLcode vquic_recv_packets(struct Curl_cfilter *cf, + struct Curl_easy *data, + struct cf_quic_ctx *qctx, + size_t max_pkts, + vquic_recv_pkt_cb *recv_cb, void *userp); + +#endif /* !ENABLE_QUIC */ + +#endif /* HEADER_CURL_VQUIC_QUIC_INT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vssh/ssh.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vssh/ssh.h new file mode 100644 index 0000000000000000000000000000000000000000..1e1b1379c276599570829ed9fbb02ac443569cf5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vssh/ssh.h @@ -0,0 +1,272 @@ +#ifndef HEADER_CURL_SSH_H +#define HEADER_CURL_SSH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(USE_LIBSSH2) +#include +#include +#elif defined(USE_LIBSSH) +#include +#include +#elif defined(USE_WOLFSSH) +#include +#include +#endif + +/**************************************************************************** + * SSH unique setup + ***************************************************************************/ +typedef enum { + SSH_NO_STATE = -1, /* Used for "nextState" so say there is none */ + SSH_STOP = 0, /* do nothing state, stops the state machine */ + + SSH_INIT, /* First state in SSH-CONNECT */ + SSH_S_STARTUP, /* Session startup */ + SSH_HOSTKEY, /* verify hostkey */ + SSH_AUTHLIST, + SSH_AUTH_PKEY_INIT, + SSH_AUTH_PKEY, + SSH_AUTH_PASS_INIT, + SSH_AUTH_PASS, + SSH_AUTH_AGENT_INIT, /* initialize then wait for connection to agent */ + SSH_AUTH_AGENT_LIST, /* ask for list then wait for entire list to come */ + SSH_AUTH_AGENT, /* attempt one key at a time */ + SSH_AUTH_HOST_INIT, + SSH_AUTH_HOST, + SSH_AUTH_KEY_INIT, + SSH_AUTH_KEY, + SSH_AUTH_GSSAPI, + SSH_AUTH_DONE, + SSH_SFTP_INIT, + SSH_SFTP_REALPATH, /* Last state in SSH-CONNECT */ + + SSH_SFTP_QUOTE_INIT, /* First state in SFTP-DO */ + SSH_SFTP_POSTQUOTE_INIT, /* (Possibly) First state in SFTP-DONE */ + SSH_SFTP_QUOTE, + SSH_SFTP_NEXT_QUOTE, + SSH_SFTP_QUOTE_STAT, + SSH_SFTP_QUOTE_SETSTAT, + SSH_SFTP_QUOTE_SYMLINK, + SSH_SFTP_QUOTE_MKDIR, + SSH_SFTP_QUOTE_RENAME, + SSH_SFTP_QUOTE_RMDIR, + SSH_SFTP_QUOTE_UNLINK, + SSH_SFTP_QUOTE_STATVFS, + SSH_SFTP_GETINFO, + SSH_SFTP_FILETIME, + SSH_SFTP_TRANS_INIT, + SSH_SFTP_UPLOAD_INIT, + SSH_SFTP_CREATE_DIRS_INIT, + SSH_SFTP_CREATE_DIRS, + SSH_SFTP_CREATE_DIRS_MKDIR, + SSH_SFTP_READDIR_INIT, + SSH_SFTP_READDIR, + SSH_SFTP_READDIR_LINK, + SSH_SFTP_READDIR_BOTTOM, + SSH_SFTP_READDIR_DONE, + SSH_SFTP_DOWNLOAD_INIT, + SSH_SFTP_DOWNLOAD_STAT, /* Last state in SFTP-DO */ + SSH_SFTP_CLOSE, /* Last state in SFTP-DONE */ + SSH_SFTP_SHUTDOWN, /* First state in SFTP-DISCONNECT */ + SSH_SCP_TRANS_INIT, /* First state in SCP-DO */ + SSH_SCP_UPLOAD_INIT, + SSH_SCP_DOWNLOAD_INIT, + SSH_SCP_DOWNLOAD, + SSH_SCP_DONE, + SSH_SCP_SEND_EOF, + SSH_SCP_WAIT_EOF, + SSH_SCP_WAIT_CLOSE, + SSH_SCP_CHANNEL_FREE, /* Last state in SCP-DONE */ + SSH_SESSION_DISCONNECT, /* First state in SCP-DISCONNECT */ + SSH_SESSION_FREE, /* Last state in SCP/SFTP-DISCONNECT */ + SSH_QUIT, + SSH_LAST /* never used */ +} sshstate; + +/* this struct is used in the HandleData struct which is part of the + Curl_easy, which means this is used on a per-easy handle basis. + Everything that is strictly related to a connection is banned from this + struct. */ +struct SSHPROTO { + char *path; /* the path we operate on */ +#ifdef USE_LIBSSH2 + struct dynbuf readdir_link; + struct dynbuf readdir; + char *readdir_filename; + char *readdir_longentry; + + LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */ + + /* Here's a set of struct members used by the SFTP_READDIR state */ + LIBSSH2_SFTP_ATTRIBUTES readdir_attrs; +#endif +}; + +/* ssh_conn is used for struct connection-oriented data in the connectdata + struct */ +struct ssh_conn { + const char *authlist; /* List of auth. methods, managed by libssh2 */ + + /* common */ + const char *passphrase; /* pass-phrase to use */ + char *rsa_pub; /* strdup'ed public key file */ + char *rsa; /* strdup'ed private key file */ + bool authed; /* the connection has been authenticated fine */ + bool acceptfail; /* used by the SFTP_QUOTE (continue if + quote command fails) */ + sshstate state; /* always use ssh.c:state() to change state! */ + sshstate nextstate; /* the state to goto after stopping */ + CURLcode actualcode; /* the actual error code */ + struct curl_slist *quote_item; /* for the quote option */ + char *quote_path1; /* two generic pointers for the QUOTE stuff */ + char *quote_path2; + + char *homedir; /* when doing SFTP we figure out home dir in the + connect phase */ + /* end of READDIR stuff */ + + int secondCreateDirs; /* counter use by the code to see if the + second attempt has been made to change + to/create a directory */ + int orig_waitfor; /* default READ/WRITE bits wait for */ + char *slash_pos; /* used by the SFTP_CREATE_DIRS state */ + +#if defined(USE_LIBSSH) + char *readdir_linkPath; + size_t readdir_len; + struct dynbuf readdir_buf; +/* our variables */ + unsigned kbd_state; /* 0 or 1 */ + ssh_key privkey; + ssh_key pubkey; + int auth_methods; + ssh_session ssh_session; + ssh_scp scp_session; + sftp_session sftp_session; + sftp_file sftp_file; + sftp_dir sftp_dir; + + unsigned sftp_recv_state; /* 0 or 1 */ + int sftp_file_index; /* for async read */ + sftp_attributes readdir_attrs; /* used by the SFTP readdir actions */ + sftp_attributes readdir_link_attrs; /* used by the SFTP readdir actions */ + sftp_attributes quote_attrs; /* used by the SFTP_QUOTE state */ + + const char *readdir_filename; /* points within readdir_attrs */ + const char *readdir_longentry; + char *readdir_tmp; +#elif defined(USE_LIBSSH2) + LIBSSH2_SESSION *ssh_session; /* Secure Shell session */ + LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */ + LIBSSH2_SFTP *sftp_session; /* SFTP handle */ + LIBSSH2_SFTP_HANDLE *sftp_handle; + +#ifndef CURL_DISABLE_PROXY + /* for HTTPS proxy storage */ + Curl_recv *tls_recv; + Curl_send *tls_send; +#endif + +#ifdef HAVE_LIBSSH2_AGENT_API + LIBSSH2_AGENT *ssh_agent; /* proxy to ssh-agent/pageant */ + struct libssh2_agent_publickey *sshagent_identity, + *sshagent_prev_identity; +#endif + + /* note that HAVE_LIBSSH2_KNOWNHOST_API is a define set in the libssh2.h + header */ +#ifdef HAVE_LIBSSH2_KNOWNHOST_API + LIBSSH2_KNOWNHOSTS *kh; +#endif +#elif defined(USE_WOLFSSH) + WOLFSSH *ssh_session; + WOLFSSH_CTX *ctx; + word32 handleSz; + byte handle[WOLFSSH_MAX_HANDLE]; + curl_off_t offset; +#endif /* USE_LIBSSH */ +}; + +#if defined(USE_LIBSSH2) + +/* Feature detection based on version numbers to better work with + non-configure platforms */ + +#if !defined(LIBSSH2_VERSION_NUM) || (LIBSSH2_VERSION_NUM < 0x001000) +# error "SCP/SFTP protocols require libssh2 0.16 or later" +#endif + +#if LIBSSH2_VERSION_NUM >= 0x010000 +#define HAVE_LIBSSH2_SFTP_SEEK64 1 +#endif + +#if LIBSSH2_VERSION_NUM >= 0x010100 +#define HAVE_LIBSSH2_VERSION 1 +#endif + +#if LIBSSH2_VERSION_NUM >= 0x010205 +#define HAVE_LIBSSH2_INIT 1 +#define HAVE_LIBSSH2_EXIT 1 +#endif + +#if LIBSSH2_VERSION_NUM >= 0x010206 +#define HAVE_LIBSSH2_KNOWNHOST_CHECKP 1 +#define HAVE_LIBSSH2_SCP_SEND64 1 +#endif + +#if LIBSSH2_VERSION_NUM >= 0x010208 +#define HAVE_LIBSSH2_SESSION_HANDSHAKE 1 +#endif + +#ifdef HAVE_LIBSSH2_VERSION +/* get it run-time if possible */ +#define CURL_LIBSSH2_VERSION libssh2_version(0) +#else +/* use build-time if run-time not possible */ +#define CURL_LIBSSH2_VERSION LIBSSH2_VERSION +#endif + +#endif /* USE_LIBSSH2 */ + +#ifdef USE_SSH + +extern const struct Curl_handler Curl_handler_scp; +extern const struct Curl_handler Curl_handler_sftp; + +/* generic SSH backend functions */ +CURLcode Curl_ssh_init(void); +void Curl_ssh_cleanup(void); +void Curl_ssh_version(char *buffer, size_t buflen); +void Curl_ssh_attach(struct Curl_easy *data, + struct connectdata *conn); +#else +/* for non-SSH builds */ +#define Curl_ssh_cleanup() +#define Curl_ssh_attach(x,y) +#endif + +#endif /* HEADER_CURL_SSH_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/bearssl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/bearssl.h new file mode 100644 index 0000000000000000000000000000000000000000..b3651b092c135aaf09c8ac72a755c1996b583eb7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/bearssl.h @@ -0,0 +1,34 @@ +#ifndef HEADER_CURL_BEARSSL_H +#define HEADER_CURL_BEARSSL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Michael Forney, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_BEARSSL + +extern const struct Curl_ssl Curl_ssl_bearssl; + +#endif /* USE_BEARSSL */ +#endif /* HEADER_CURL_BEARSSL_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/gtls.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/gtls.h new file mode 100644 index 0000000000000000000000000000000000000000..ac141e1c61bb576a754d62d66e385899efbbf9af --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/gtls.h @@ -0,0 +1,75 @@ +#ifndef HEADER_CURL_GTLS_H +#define HEADER_CURL_GTLS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" +#include + +#ifdef USE_GNUTLS + +#include + +#ifdef HAVE_GNUTLS_SRP +/* the function exists */ +#ifdef USE_TLS_SRP +/* the functionality is not disabled */ +#define USE_GNUTLS_SRP +#endif +#endif + +struct Curl_easy; +struct Curl_cfilter; +struct ssl_primary_config; +struct ssl_config_data; + +struct gtls_instance { + gnutls_session_t session; + gnutls_certificate_credentials_t cred; +#ifdef USE_GNUTLS_SRP + gnutls_srp_client_credentials_t srp_client_cred; +#endif +}; + +CURLcode +gtls_client_init(struct Curl_easy *data, + struct ssl_primary_config *config, + struct ssl_config_data *ssl_config, + const char *hostname, + struct gtls_instance *gtls, + long *pverifyresult); + +CURLcode +Curl_gtls_verifyserver(struct Curl_easy *data, + gnutls_session_t session, + struct ssl_primary_config *config, + struct ssl_config_data *ssl_config, + const char *hostname, + const char *dispname, + const char *pinned_key); + +extern const struct Curl_ssl Curl_ssl_gnutls; + +#endif /* USE_GNUTLS */ +#endif /* HEADER_CURL_GTLS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/hostcheck.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/hostcheck.h new file mode 100644 index 0000000000000000000000000000000000000000..22a1ac2e563298a199e5a4a72c32e9364e98c593 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/hostcheck.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_HOSTCHECK_H +#define HEADER_CURL_HOSTCHECK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include + +/* returns TRUE if there's a match */ +bool Curl_cert_hostcheck(const char *match_pattern, size_t matchlen, + const char *hostname, size_t hostlen); + +#endif /* HEADER_CURL_HOSTCHECK_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/keylog.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/keylog.h new file mode 100644 index 0000000000000000000000000000000000000000..eff5bf38f3518a15d00839cb06ca9d3957440954 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/keylog.h @@ -0,0 +1,58 @@ +#ifndef HEADER_CURL_KEYLOG_H +#define HEADER_CURL_KEYLOG_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +/* + * Opens the TLS key log file if requested by the user. The SSLKEYLOGFILE + * environment variable specifies the output file. + */ +void Curl_tls_keylog_open(void); + +/* + * Closes the TLS key log file if not already. + */ +void Curl_tls_keylog_close(void); + +/* + * Returns true if the user successfully enabled the TLS key log file. + */ +bool Curl_tls_keylog_enabled(void); + +/* + * Appends a key log file entry. + * Returns true iff the key log file is open and a valid entry was provided. + */ +bool Curl_tls_keylog_write(const char *label, + const unsigned char client_random[32], + const unsigned char *secret, size_t secretlen); + +/* + * Appends a line to the key log file, ensure it is terminated by a LF. + * Returns true iff the key log file is open and a valid line was provided. + */ +bool Curl_tls_keylog_write_line(const char *line); + +#endif /* HEADER_CURL_KEYLOG_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/mbedtls.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/mbedtls.h new file mode 100644 index 0000000000000000000000000000000000000000..d8a0a06eb6aac22289e2b91fcad3a7164b77f9ae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/mbedtls.h @@ -0,0 +1,34 @@ +#ifndef HEADER_CURL_MBEDTLS_H +#define HEADER_CURL_MBEDTLS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * Copyright (C) Hoi-Ho Chan, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifdef USE_MBEDTLS + +extern const struct Curl_ssl Curl_ssl_mbedtls; + +#endif /* USE_MBEDTLS */ +#endif /* HEADER_CURL_MBEDTLS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/mbedtls_threadlock.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/mbedtls_threadlock.h new file mode 100644 index 0000000000000000000000000000000000000000..2b0bd41c8b99799911e43d84a5a4ea840dd745c8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/mbedtls_threadlock.h @@ -0,0 +1,50 @@ +#ifndef HEADER_CURL_MBEDTLS_THREADLOCK_H +#define HEADER_CURL_MBEDTLS_THREADLOCK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * Copyright (C) Hoi-Ho Chan, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifdef USE_MBEDTLS + +#if (defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)) || \ + defined(USE_THREADS_WIN32) + +int Curl_mbedtlsthreadlock_thread_setup(void); +int Curl_mbedtlsthreadlock_thread_cleanup(void); +int Curl_mbedtlsthreadlock_lock_function(int n); +int Curl_mbedtlsthreadlock_unlock_function(int n); + +#else + +#define Curl_mbedtlsthreadlock_thread_setup() 1 +#define Curl_mbedtlsthreadlock_thread_cleanup() 1 +#define Curl_mbedtlsthreadlock_lock_function(x) 1 +#define Curl_mbedtlsthreadlock_unlock_function(x) 1 + +#endif /* USE_THREADS_POSIX || USE_THREADS_WIN32 */ + +#endif /* USE_MBEDTLS */ + +#endif /* HEADER_CURL_MBEDTLS_THREADLOCK_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/openssl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/openssl.h new file mode 100644 index 0000000000000000000000000000000000000000..950faab889209d43d982565bbd570856de97b7a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/openssl.h @@ -0,0 +1,69 @@ +#ifndef HEADER_CURL_SSLUSE_H +#define HEADER_CURL_SSLUSE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_OPENSSL +/* + * This header should only be needed to get included by vtls.c, openssl.c + * and ngtcp2.c + */ +#include + +#include "urldata.h" + +/* + * In an effort to avoid using 'X509 *' here, we instead use the struct + * x509_st version of the type so that we can forward-declare it here without + * having to include . Including that header causes name + * conflicts when libcurl is built with both Schannel and OpenSSL support. + */ +struct x509_st; +CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn, + struct x509_st *server_cert); +extern const struct Curl_ssl Curl_ssl_openssl; + +struct ssl_ctx_st; +CURLcode Curl_ossl_set_client_cert(struct Curl_easy *data, + struct ssl_ctx_st *ctx, char *cert_file, + const struct curl_blob *cert_blob, + const char *cert_type, char *key_file, + const struct curl_blob *key_blob, + const char *key_type, char *key_passwd); + +CURLcode Curl_ossl_certchain(struct Curl_easy *data, SSL *ssl); + +/** + * Setup the OpenSSL X509_STORE in `ssl_ctx` for the cfilter `cf` and + * easy handle `data`. Will allow reuse of a shared cache if suitable + * and configured. + */ +CURLcode Curl_ssl_setup_x509_store(struct Curl_cfilter *cf, + struct Curl_easy *data, + SSL_CTX *ssl_ctx); + +#endif /* USE_OPENSSL */ +#endif /* HEADER_CURL_SSLUSE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/rustls.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/rustls.h new file mode 100644 index 0000000000000000000000000000000000000000..bfbe23de3e6b2ad60ccc8283c25a7785b12aae6d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/rustls.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Jacob Hoffman-Andrews, + * + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#ifndef HEADER_CURL_RUSTLS_H +#define HEADER_CURL_RUSTLS_H + +#include "curl_setup.h" + +#ifdef USE_RUSTLS + +extern const struct Curl_ssl Curl_ssl_rustls; + +#endif /* USE_RUSTLS */ +#endif /* HEADER_CURL_RUSTLS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/schannel.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/schannel.h new file mode 100644 index 0000000000000000000000000000000000000000..b26334bcf877a0318fb5f3291b84ee60c678d28d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/schannel.h @@ -0,0 +1,86 @@ +#ifndef HEADER_CURL_SCHANNEL_H +#define HEADER_CURL_SCHANNEL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Marc Hoersken, , et al. + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifdef USE_SCHANNEL + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4201) +#endif +#include +#ifdef _MSC_VER +#pragma warning(pop) +#endif +/* Wincrypt must be included before anything that could include OpenSSL. */ +#if defined(USE_WIN32_CRYPTO) +#include +/* Undefine wincrypt conflicting symbols for BoringSSL. */ +#undef X509_NAME +#undef X509_EXTENSIONS +#undef PKCS7_ISSUER_AND_SERIAL +#undef PKCS7_SIGNER_INFO +#undef OCSP_REQUEST +#undef OCSP_RESPONSE +#endif + +#include +#include +#include "curl_sspi.h" + +#include "cfilters.h" +#include "urldata.h" + +/* has been included via the above . + * Or in case of ldap.c, it was included via . + * And since has this: + * #define X509_NAME ((LPCSTR) 7) + * + * And in BoringSSL's there is: + * typedef struct X509_name_st X509_NAME; + * etc. + * + * this will cause all kinds of C-preprocessing paste errors in + * BoringSSL's : So just undefine those defines here + * (and only here). + */ +#if defined(OPENSSL_IS_BORINGSSL) +# undef X509_NAME +# undef X509_CERT_PAIR +# undef X509_EXTENSIONS +#endif + +extern const struct Curl_ssl Curl_ssl_schannel; + +CURLcode Curl_verify_host(struct Curl_cfilter *cf, + struct Curl_easy *data); + +CURLcode Curl_verify_certificate(struct Curl_cfilter *cf, + struct Curl_easy *data); + +#endif /* USE_SCHANNEL */ +#endif /* HEADER_CURL_SCHANNEL_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/schannel_int.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/schannel_int.h new file mode 100644 index 0000000000000000000000000000000000000000..a128e04f6c3a737c73fe04ec69a9ed3860bd9a27 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/schannel_int.h @@ -0,0 +1,153 @@ +#ifndef HEADER_CURL_SCHANNEL_INT_H +#define HEADER_CURL_SCHANNEL_INT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Marc Hoersken, , et al. + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifdef USE_SCHANNEL + +#if defined(__MINGW32__) || defined(CERT_CHAIN_REVOCATION_CHECK_CHAIN) +#define HAS_MANUAL_VERIFY_API +#endif + +#if defined(CryptStringToBinary) && defined(CRYPT_STRING_HEX) \ + && !defined(DISABLE_SCHANNEL_CLIENT_CERT) +#define HAS_CLIENT_CERT_PATH +#endif + +#ifndef CRYPT_DECODE_NOCOPY_FLAG +#define CRYPT_DECODE_NOCOPY_FLAG 0x1 +#endif + +#ifndef CRYPT_DECODE_ALLOC_FLAG +#define CRYPT_DECODE_ALLOC_FLAG 0x8000 +#endif + +#ifndef CERT_ALT_NAME_DNS_NAME +#define CERT_ALT_NAME_DNS_NAME 3 +#endif + +#ifndef CERT_ALT_NAME_IP_ADDRESS +#define CERT_ALT_NAME_IP_ADDRESS 8 +#endif + + +#ifndef SCH_CREDENTIALS_VERSION + +#define SCH_CREDENTIALS_VERSION 0x00000005 + +typedef enum _eTlsAlgorithmUsage +{ + TlsParametersCngAlgUsageKeyExchange, + TlsParametersCngAlgUsageSignature, + TlsParametersCngAlgUsageCipher, + TlsParametersCngAlgUsageDigest, + TlsParametersCngAlgUsageCertSig +} eTlsAlgorithmUsage; + +typedef struct _CRYPTO_SETTINGS +{ + eTlsAlgorithmUsage eAlgorithmUsage; + UNICODE_STRING strCngAlgId; + DWORD cChainingModes; + PUNICODE_STRING rgstrChainingModes; + DWORD dwMinBitLength; + DWORD dwMaxBitLength; +} CRYPTO_SETTINGS, * PCRYPTO_SETTINGS; + +typedef struct _TLS_PARAMETERS +{ + DWORD cAlpnIds; + PUNICODE_STRING rgstrAlpnIds; + DWORD grbitDisabledProtocols; + DWORD cDisabledCrypto; + PCRYPTO_SETTINGS pDisabledCrypto; + DWORD dwFlags; +} TLS_PARAMETERS, * PTLS_PARAMETERS; + +typedef struct _SCH_CREDENTIALS +{ + DWORD dwVersion; + DWORD dwCredFormat; + DWORD cCreds; + PCCERT_CONTEXT* paCred; + HCERTSTORE hRootStore; + + DWORD cMappers; + struct _HMAPPER **aphMappers; + + DWORD dwSessionLifespan; + DWORD dwFlags; + DWORD cTlsParameters; + PTLS_PARAMETERS pTlsParameters; +} SCH_CREDENTIALS, * PSCH_CREDENTIALS; + +#define SCH_CRED_MAX_SUPPORTED_PARAMETERS 16 +#define SCH_CRED_MAX_SUPPORTED_ALPN_IDS 16 +#define SCH_CRED_MAX_SUPPORTED_CRYPTO_SETTINGS 16 +#define SCH_CRED_MAX_SUPPORTED_CHAINING_MODES 16 + +#endif /* SCH_CREDENTIALS_VERSION */ + +struct Curl_schannel_cred { + CredHandle cred_handle; + TimeStamp time_stamp; + TCHAR *sni_hostname; +#ifdef HAS_CLIENT_CERT_PATH + HCERTSTORE client_cert_store; +#endif + int refcount; +}; + +struct Curl_schannel_ctxt { + CtxtHandle ctxt_handle; + TimeStamp time_stamp; +}; + +struct schannel_ssl_backend_data { + struct Curl_schannel_cred *cred; + struct Curl_schannel_ctxt *ctxt; + SecPkgContext_StreamSizes stream_sizes; + size_t encdata_length, decdata_length; + size_t encdata_offset, decdata_offset; + unsigned char *encdata_buffer, *decdata_buffer; + /* encdata_is_incomplete: if encdata contains only a partial record that + can't be decrypted without another recv() (that is, status is + SEC_E_INCOMPLETE_MESSAGE) then set this true. after an recv() adds + more bytes into encdata then set this back to false. */ + bool encdata_is_incomplete; + unsigned long req_flags, ret_flags; + CURLcode recv_unrecoverable_err; /* schannel_recv had an unrecoverable err */ + bool recv_sspi_close_notify; /* true if connection closed by close_notify */ + bool recv_connection_closed; /* true if connection closed, regardless how */ + bool recv_renegotiating; /* true if recv is doing renegotiation */ + bool use_alpn; /* true if ALPN is used for this connection */ +#ifdef HAS_MANUAL_VERIFY_API + bool use_manual_cred_validation; /* true if manual cred validation is used */ +#endif +}; + +#endif /* USE_SCHANNEL */ +#endif /* HEADER_CURL_SCHANNEL_INT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/sectransp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/sectransp.h new file mode 100644 index 0000000000000000000000000000000000000000..0f1085ad91b29f10f88103f53f4ace455d4a2672 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/sectransp.h @@ -0,0 +1,34 @@ +#ifndef HEADER_CURL_SECTRANSP_H +#define HEADER_CURL_SECTRANSP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Nick Zitzmann, . + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifdef USE_SECTRANSP + +extern const struct Curl_ssl Curl_ssl_sectransp; + +#endif /* USE_SECTRANSP */ +#endif /* HEADER_CURL_SECTRANSP_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/vtls.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/vtls.h new file mode 100644 index 0000000000000000000000000000000000000000..8ad1cf6def9e3016a34dc8ae6d6c1a6df634b940 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/vtls.h @@ -0,0 +1,216 @@ +#ifndef HEADER_CURL_VTLS_H +#define HEADER_CURL_VTLS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +struct connectdata; +struct ssl_config_data; +struct ssl_primary_config; +struct Curl_ssl_session; + +#define SSLSUPP_CA_PATH (1<<0) /* supports CAPATH */ +#define SSLSUPP_CERTINFO (1<<1) /* supports CURLOPT_CERTINFO */ +#define SSLSUPP_PINNEDPUBKEY (1<<2) /* supports CURLOPT_PINNEDPUBLICKEY */ +#define SSLSUPP_SSL_CTX (1<<3) /* supports CURLOPT_SSL_CTX */ +#define SSLSUPP_HTTPS_PROXY (1<<4) /* supports access via HTTPS proxies */ +#define SSLSUPP_TLS13_CIPHERSUITES (1<<5) /* supports TLS 1.3 ciphersuites */ +#define SSLSUPP_CAINFO_BLOB (1<<6) + +#define ALPN_ACCEPTED "ALPN: server accepted " + +#define VTLS_INFOF_NO_ALPN \ + "ALPN: server did not agree on a protocol. Uses default." +#define VTLS_INFOF_ALPN_OFFER_1STR \ + "ALPN: curl offers %s" +#define VTLS_INFOF_ALPN_ACCEPTED_1STR \ + ALPN_ACCEPTED "%s" +#define VTLS_INFOF_ALPN_ACCEPTED_LEN_1STR \ + ALPN_ACCEPTED "%.*s" + +/* Curl_multi SSL backend-specific data; declared differently by each SSL + backend */ +struct multi_ssl_backend_data; +struct Curl_cfilter; + +CURLsslset Curl_init_sslset_nolock(curl_sslbackend id, const char *name, + const curl_ssl_backend ***avail); + +#ifndef MAX_PINNED_PUBKEY_SIZE +#define MAX_PINNED_PUBKEY_SIZE 1048576 /* 1MB */ +#endif + +#ifndef CURL_SHA256_DIGEST_LENGTH +#define CURL_SHA256_DIGEST_LENGTH 32 /* fixed size */ +#endif + +char *Curl_ssl_snihost(struct Curl_easy *data, const char *host, size_t *olen); +bool Curl_ssl_config_matches(struct ssl_primary_config *data, + struct ssl_primary_config *needle); +bool Curl_clone_primary_ssl_config(struct ssl_primary_config *source, + struct ssl_primary_config *dest); +void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc); + +curl_sslbackend Curl_ssl_backend(void); + +#ifdef USE_SSL +int Curl_ssl_init(void); +void Curl_ssl_cleanup(void); +/* tell the SSL stuff to close down all open information regarding + connections (and thus session ID caching etc) */ +void Curl_ssl_close_all(struct Curl_easy *data); +CURLcode Curl_ssl_set_engine(struct Curl_easy *data, const char *engine); +/* Sets engine as default for all SSL operations */ +CURLcode Curl_ssl_set_engine_default(struct Curl_easy *data); +struct curl_slist *Curl_ssl_engines_list(struct Curl_easy *data); + +/* init the SSL session ID cache */ +CURLcode Curl_ssl_initsessions(struct Curl_easy *, size_t); +void Curl_ssl_version(char *buffer, size_t size); + +/* Certificate information list handling. */ + +void Curl_ssl_free_certinfo(struct Curl_easy *data); +CURLcode Curl_ssl_init_certinfo(struct Curl_easy *data, int num); +CURLcode Curl_ssl_push_certinfo_len(struct Curl_easy *data, int certnum, + const char *label, const char *value, + size_t valuelen); +CURLcode Curl_ssl_push_certinfo(struct Curl_easy *data, int certnum, + const char *label, const char *value); + +/* Functions to be used by SSL library adaptation functions */ + +/* Lock session cache mutex. + * Call this before calling other Curl_ssl_*session* functions + * Caller should unlock this mutex as soon as possible, as it may block + * other SSL connection from making progress. + * The purpose of explicitly locking SSL session cache data is to allow + * individual SSL engines to manage session lifetime in their specific way. + */ +void Curl_ssl_sessionid_lock(struct Curl_easy *data); + +/* Unlock session cache mutex */ +void Curl_ssl_sessionid_unlock(struct Curl_easy *data); + +/* Kill a single session ID entry in the cache + * Sessionid mutex must be locked (see Curl_ssl_sessionid_lock). + * This will call engine-specific curlssl_session_free function, which must + * take sessionid object ownership from sessionid cache + * (e.g. decrement refcount). + */ +void Curl_ssl_kill_session(struct Curl_ssl_session *session); +/* delete a session from the cache + * Sessionid mutex must be locked (see Curl_ssl_sessionid_lock). + * This will call engine-specific curlssl_session_free function, which must + * take sessionid object ownership from sessionid cache + * (e.g. decrement refcount). + */ +void Curl_ssl_delsessionid(struct Curl_easy *data, void *ssl_sessionid); + +/* get N random bytes into the buffer */ +CURLcode Curl_ssl_random(struct Curl_easy *data, unsigned char *buffer, + size_t length); +/* Check pinned public key. */ +CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data, + const char *pinnedpubkey, + const unsigned char *pubkey, size_t pubkeylen); + +bool Curl_ssl_cert_status_request(void); + +bool Curl_ssl_false_start(struct Curl_easy *data); + +void Curl_free_multi_ssl_backend_data(struct multi_ssl_backend_data *mbackend); + +#define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */ + +CURLcode Curl_ssl_cfilter_add(struct Curl_easy *data, + struct connectdata *conn, + int sockindex); + +CURLcode Curl_cf_ssl_insert_after(struct Curl_cfilter *cf_at, + struct Curl_easy *data); + +CURLcode Curl_ssl_cfilter_remove(struct Curl_easy *data, + int sockindex); + +#ifndef CURL_DISABLE_PROXY +CURLcode Curl_cf_ssl_proxy_insert_after(struct Curl_cfilter *cf_at, + struct Curl_easy *data); +#endif /* !CURL_DISABLE_PROXY */ + +/** + * Get the SSL configuration that is used on the connection. + * This returns NULL if no SSL is configured. + * Otherwise it returns the config of the first (highest) one that is + * either connected, in handshake or about to start + * (e.g. all filters below it are connected). If SSL filters are present, + * but neither can start operating, return the config of the lowest one + * that will first come into effect when connecting. + */ +struct ssl_config_data *Curl_ssl_get_config(struct Curl_easy *data, + int sockindex); + +/** + * True iff the underlying SSL implementation supports the option. + * Option is one of the defined SSLSUPP_* values. + * `data` maybe NULL for the features of the default implementation. + */ +bool Curl_ssl_supports(struct Curl_easy *data, int ssl_option); + +/** + * Get the internal ssl instance (like OpenSSL's SSL*) from the filter + * chain at `sockindex` of type specified by `info`. + * For `n` == 0, the first active (top down) instance is returned. + * 1 gives the second active, etc. + * NULL is returned when no active SSL filter is present. + */ +void *Curl_ssl_get_internals(struct Curl_easy *data, int sockindex, + CURLINFO info, int n); + +extern struct Curl_cftype Curl_cft_ssl; +extern struct Curl_cftype Curl_cft_ssl_proxy; + +#else /* if not USE_SSL */ + +/* When SSL support is not present, just define away these function calls */ +#define Curl_ssl_init() 1 +#define Curl_ssl_cleanup() Curl_nop_stmt +#define Curl_ssl_close_all(x) Curl_nop_stmt +#define Curl_ssl_set_engine(x,y) CURLE_NOT_BUILT_IN +#define Curl_ssl_set_engine_default(x) CURLE_NOT_BUILT_IN +#define Curl_ssl_engines_list(x) NULL +#define Curl_ssl_initsessions(x,y) CURLE_OK +#define Curl_ssl_free_certinfo(x) Curl_nop_stmt +#define Curl_ssl_kill_session(x) Curl_nop_stmt +#define Curl_ssl_random(x,y,z) ((void)x, CURLE_NOT_BUILT_IN) +#define Curl_ssl_cert_status_request() FALSE +#define Curl_ssl_false_start(a) FALSE +#define Curl_ssl_get_internals(a,b,c,d) NULL +#define Curl_ssl_supports(a,b) FALSE +#define Curl_ssl_cfilter_add(a,b,c) CURLE_NOT_BUILT_IN +#define Curl_ssl_get_config(a,b) NULL +#define Curl_ssl_cfilter_remove(a,b) CURLE_OK +#endif + +#endif /* HEADER_CURL_VTLS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/vtls_int.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/vtls_int.h new file mode 100644 index 0000000000000000000000000000000000000000..a6e4544a87e7edbbd16408f96f7a0d32e9a4caf1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/vtls_int.h @@ -0,0 +1,229 @@ +#ifndef HEADER_CURL_VTLS_INT_H +#define HEADER_CURL_VTLS_INT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" +#include "cfilters.h" +#include "urldata.h" + +#ifdef USE_SSL + +/* see https://www.iana.org/assignments/tls-extensiontype-values/ */ +#define ALPN_HTTP_1_1_LENGTH 8 +#define ALPN_HTTP_1_1 "http/1.1" +#define ALPN_HTTP_1_0_LENGTH 8 +#define ALPN_HTTP_1_0 "http/1.0" +#define ALPN_H2_LENGTH 2 +#define ALPN_H2 "h2" +#define ALPN_H3_LENGTH 2 +#define ALPN_H3 "h3" + +/* conservative sizes on the ALPN entries and count we are handling, + * we can increase these if we ever feel the need or have to accommodate + * ALPN strings from the "outside". */ +#define ALPN_NAME_MAX 10 +#define ALPN_ENTRIES_MAX 3 +#define ALPN_PROTO_BUF_MAX (ALPN_ENTRIES_MAX * (ALPN_NAME_MAX + 1)) + +struct alpn_spec { + const char entries[ALPN_ENTRIES_MAX][ALPN_NAME_MAX]; + size_t count; /* number of entries */ +}; + +struct alpn_proto_buf { + unsigned char data[ALPN_PROTO_BUF_MAX]; + int len; +}; + +CURLcode Curl_alpn_to_proto_buf(struct alpn_proto_buf *buf, + const struct alpn_spec *spec); +CURLcode Curl_alpn_to_proto_str(struct alpn_proto_buf *buf, + const struct alpn_spec *spec); + +CURLcode Curl_alpn_set_negotiated(struct Curl_cfilter *cf, + struct Curl_easy *data, + const unsigned char *proto, + size_t proto_len); + +/* Information in each SSL cfilter context: cf->ctx */ +struct ssl_connect_data { + ssl_connection_state state; + ssl_connect_state connecting_state; + char *hostname; /* hostname for verification */ + char *dispname; /* display version of hostname */ + const struct alpn_spec *alpn; /* ALPN to use or NULL for none */ + void *backend; /* vtls backend specific props */ + struct cf_call_data call_data; /* data handle used in current call */ + struct curltime handshake_done; /* time when handshake finished */ + int port; /* remote port at origin */ + BIT(use_alpn); /* if ALPN shall be used in handshake */ +}; + + +#undef CF_CTX_CALL_DATA +#define CF_CTX_CALL_DATA(cf) \ + ((struct ssl_connect_data *)(cf)->ctx)->call_data + + +/* Definitions for SSL Implementations */ + +struct Curl_ssl { + /* + * This *must* be the first entry to allow returning the list of available + * backends in curl_global_sslset(). + */ + curl_ssl_backend info; + unsigned int supports; /* bitfield, see above */ + size_t sizeof_ssl_backend_data; + + int (*init)(void); + void (*cleanup)(void); + + size_t (*version)(char *buffer, size_t size); + int (*check_cxn)(struct Curl_cfilter *cf, struct Curl_easy *data); + int (*shut_down)(struct Curl_cfilter *cf, + struct Curl_easy *data); + bool (*data_pending)(struct Curl_cfilter *cf, + const struct Curl_easy *data); + + /* return 0 if a find random is filled in */ + CURLcode (*random)(struct Curl_easy *data, unsigned char *entropy, + size_t length); + bool (*cert_status_request)(void); + + CURLcode (*connect_blocking)(struct Curl_cfilter *cf, + struct Curl_easy *data); + CURLcode (*connect_nonblocking)(struct Curl_cfilter *cf, + struct Curl_easy *data, + bool *done); + + /* If the SSL backend wants to read or write on this connection during a + handshake, set socks[0] to the connection's FIRSTSOCKET, and return + a bitmap indicating read or write with GETSOCK_WRITESOCK(0) or + GETSOCK_READSOCK(0). Otherwise return GETSOCK_BLANK. + Mandatory. */ + int (*get_select_socks)(struct Curl_cfilter *cf, struct Curl_easy *data, + curl_socket_t *socks); + + void *(*get_internals)(struct ssl_connect_data *connssl, CURLINFO info); + void (*close)(struct Curl_cfilter *cf, struct Curl_easy *data); + void (*close_all)(struct Curl_easy *data); + void (*session_free)(void *ptr); + + CURLcode (*set_engine)(struct Curl_easy *data, const char *engine); + CURLcode (*set_engine_default)(struct Curl_easy *data); + struct curl_slist *(*engines_list)(struct Curl_easy *data); + + bool (*false_start)(void); + CURLcode (*sha256sum)(const unsigned char *input, size_t inputlen, + unsigned char *sha256sum, size_t sha256sumlen); + + bool (*attach_data)(struct Curl_cfilter *cf, struct Curl_easy *data); + void (*detach_data)(struct Curl_cfilter *cf, struct Curl_easy *data); + + void (*free_multi_ssl_backend_data)(struct multi_ssl_backend_data *mbackend); + + ssize_t (*recv_plain)(struct Curl_cfilter *cf, struct Curl_easy *data, + char *buf, size_t len, CURLcode *code); + ssize_t (*send_plain)(struct Curl_cfilter *cf, struct Curl_easy *data, + const void *mem, size_t len, CURLcode *code); + +}; + +extern const struct Curl_ssl *Curl_ssl; + + +int Curl_none_init(void); +void Curl_none_cleanup(void); +int Curl_none_shutdown(struct Curl_cfilter *cf, struct Curl_easy *data); +int Curl_none_check_cxn(struct Curl_cfilter *cf, struct Curl_easy *data); +CURLcode Curl_none_random(struct Curl_easy *data, unsigned char *entropy, + size_t length); +void Curl_none_close_all(struct Curl_easy *data); +void Curl_none_session_free(void *ptr); +bool Curl_none_data_pending(struct Curl_cfilter *cf, + const struct Curl_easy *data); +bool Curl_none_cert_status_request(void); +CURLcode Curl_none_set_engine(struct Curl_easy *data, const char *engine); +CURLcode Curl_none_set_engine_default(struct Curl_easy *data); +struct curl_slist *Curl_none_engines_list(struct Curl_easy *data); +bool Curl_none_false_start(void); +int Curl_ssl_get_select_socks(struct Curl_cfilter *cf, struct Curl_easy *data, + curl_socket_t *socks); + +/** + * Get the ssl_config_data in `data` that is relevant for cfilter `cf`. + */ +struct ssl_config_data *Curl_ssl_cf_get_config(struct Curl_cfilter *cf, + struct Curl_easy *data); + +/** + * Get the primary config relevant for the filter from its connection. + */ +struct ssl_primary_config * + Curl_ssl_cf_get_primary_config(struct Curl_cfilter *cf); + +/** + * Get the first SSL filter in the chain starting with `cf`, or NULL. + */ +struct Curl_cfilter *Curl_ssl_cf_get_ssl(struct Curl_cfilter *cf); + +/** + * Get the SSL filter below the given one or NULL if there is none. + */ +bool Curl_ssl_cf_is_proxy(struct Curl_cfilter *cf); + +/* extract a session ID + * Sessionid mutex must be locked (see Curl_ssl_sessionid_lock). + * Caller must make sure that the ownership of returned sessionid object + * is properly taken (e.g. its refcount is incremented + * under sessionid mutex). + */ +bool Curl_ssl_getsessionid(struct Curl_cfilter *cf, + struct Curl_easy *data, + void **ssl_sessionid, + size_t *idsize); /* set 0 if unknown */ +/* add a new session ID + * Sessionid mutex must be locked (see Curl_ssl_sessionid_lock). + * Caller must ensure that it has properly shared ownership of this sessionid + * object with cache (e.g. incrementing refcount on success) + */ +CURLcode Curl_ssl_addsessionid(struct Curl_cfilter *cf, + struct Curl_easy *data, + void *ssl_sessionid, + size_t idsize, + bool *added); + +#include "openssl.h" /* OpenSSL versions */ +#include "gtls.h" /* GnuTLS versions */ +#include "wolfssl.h" /* wolfSSL versions */ +#include "schannel.h" /* Schannel SSPI version */ +#include "sectransp.h" /* SecureTransport (Darwin) version */ +#include "mbedtls.h" /* mbedTLS versions */ +#include "bearssl.h" /* BearSSL versions */ +#include "rustls.h" /* rustls versions */ + +#endif /* USE_SSL */ + +#endif /* HEADER_CURL_VTLS_INT_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/wolfssl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/wolfssl.h new file mode 100644 index 0000000000000000000000000000000000000000..a5ed8480996d4784eb55d7e573a39ce74238eba0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/wolfssl.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_WOLFSSL_H +#define HEADER_CURL_WOLFSSL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifdef USE_WOLFSSL + +extern const struct Curl_ssl Curl_ssl_wolfssl; + +#endif /* USE_WOLFSSL */ +#endif /* HEADER_CURL_WOLFSSL_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/x509asn1.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/x509asn1.h new file mode 100644 index 0000000000000000000000000000000000000000..23a67b828a6ed94cf0efec9c7e02f2f02c84c82e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/vtls/x509asn1.h @@ -0,0 +1,80 @@ +#ifndef HEADER_CURL_X509ASN1_H +#define HEADER_CURL_X509ASN1_H + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(USE_GNUTLS) || defined(USE_WOLFSSL) || \ + defined(USE_SCHANNEL) || defined(USE_SECTRANSP) + +#include "cfilters.h" +#include "urldata.h" + +/* + * Types. + */ + +/* ASN.1 parsed element. */ +struct Curl_asn1Element { + const char *header; /* Pointer to header byte. */ + const char *beg; /* Pointer to element data. */ + const char *end; /* Pointer to 1st byte after element. */ + unsigned char class; /* ASN.1 element class. */ + unsigned char tag; /* ASN.1 element tag. */ + bool constructed; /* Element is constructed. */ +}; + +/* X509 certificate: RFC 5280. */ +struct Curl_X509certificate { + struct Curl_asn1Element certificate; + struct Curl_asn1Element version; + struct Curl_asn1Element serialNumber; + struct Curl_asn1Element signatureAlgorithm; + struct Curl_asn1Element signature; + struct Curl_asn1Element issuer; + struct Curl_asn1Element notBefore; + struct Curl_asn1Element notAfter; + struct Curl_asn1Element subject; + struct Curl_asn1Element subjectPublicKeyInfo; + struct Curl_asn1Element subjectPublicKeyAlgorithm; + struct Curl_asn1Element subjectPublicKey; + struct Curl_asn1Element issuerUniqueID; + struct Curl_asn1Element subjectUniqueID; + struct Curl_asn1Element extensions; +}; + +/* + * Prototypes. + */ + +int Curl_parseX509(struct Curl_X509certificate *cert, + const char *beg, const char *end); +CURLcode Curl_extract_certinfo(struct Curl_easy *data, int certnum, + const char *beg, const char *end); +CURLcode Curl_verifyhost(struct Curl_cfilter *cf, struct Curl_easy *data, + const char *beg, const char *end); +#endif /* USE_GNUTLS or USE_WOLFSSL or USE_SCHANNEL or USE_SECTRANSP */ +#endif /* HEADER_CURL_X509ASN1_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/warnless.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/warnless.h new file mode 100644 index 0000000000000000000000000000000000000000..2a5301628f3537504591266d52814e951cafcd72 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/warnless.h @@ -0,0 +1,99 @@ +#ifndef HEADER_CURL_WARNLESS_H +#define HEADER_CURL_WARNLESS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_WINSOCK +#include /* for curl_socket_t */ +#endif + +#define CURLX_FUNCTION_CAST(target_type, func) \ + (target_type)(void (*) (void))(func) + +unsigned short curlx_ultous(unsigned long ulnum); + +unsigned char curlx_ultouc(unsigned long ulnum); + +int curlx_uztosi(size_t uznum); + +curl_off_t curlx_uztoso(size_t uznum); + +unsigned long curlx_uztoul(size_t uznum); + +unsigned int curlx_uztoui(size_t uznum); + +int curlx_sltosi(long slnum); + +unsigned int curlx_sltoui(long slnum); + +unsigned short curlx_sltous(long slnum); + +ssize_t curlx_uztosz(size_t uznum); + +size_t curlx_sotouz(curl_off_t sonum); + +int curlx_sztosi(ssize_t sznum); + +unsigned short curlx_uitous(unsigned int uinum); + +size_t curlx_sitouz(int sinum); + +#ifdef USE_WINSOCK + +int curlx_sktosi(curl_socket_t s); + +curl_socket_t curlx_sitosk(int i); + +#endif /* USE_WINSOCK */ + +#if defined(WIN32) + +ssize_t curlx_read(int fd, void *buf, size_t count); + +ssize_t curlx_write(int fd, const void *buf, size_t count); + +#undef read +#define read(fd, buf, count) curlx_read(fd, buf, count) +#undef write +#define write(fd, buf, count) curlx_write(fd, buf, count) + +#endif /* WIN32 */ + +#if defined(__INTEL_COMPILER) && defined(__unix__) + +int curlx_FD_ISSET(int fd, fd_set *fdset); + +void curlx_FD_SET(int fd, fd_set *fdset); + +void curlx_FD_ZERO(fd_set *fdset); + +unsigned short curlx_htons(unsigned short usnum); + +unsigned short curlx_ntohs(unsigned short usnum); + +#endif /* __INTEL_COMPILER && __unix__ */ + +#endif /* HEADER_CURL_WARNLESS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/ws.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/ws.h new file mode 100644 index 0000000000000000000000000000000000000000..0308a42545b60f46b64d8770936908329f6350bf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/curl/lib/ws.h @@ -0,0 +1,89 @@ +#ifndef HEADER_CURL_WS_H +#define HEADER_CURL_WS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * SPDX-License-Identifier: curl + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifdef USE_WEBSOCKETS + +#ifdef USE_HYPER +#define REQTYPE void +#else +#define REQTYPE struct dynbuf +#endif + +/* a client-side WS frame decoder, parsing frame headers and + * payload, keeping track of current position and stats */ +enum ws_dec_state { + WS_DEC_INIT, + WS_DEC_HEAD, + WS_DEC_PAYLOAD +}; + +struct ws_decoder { + int frame_age; /* zero */ + int frame_flags; /* See the CURLWS_* defines */ + curl_off_t payload_offset; /* the offset parsing is at */ + curl_off_t payload_len; + unsigned char head[10]; + int head_len, head_total; + enum ws_dec_state state; +}; + +/* a client-side WS frame encoder, generating frame headers and + * converting payloads, tracking remaining data in current frame */ +struct ws_encoder { + curl_off_t payload_len; /* payload length of current frame */ + curl_off_t payload_remain; /* remaining payload of current */ + unsigned int xori; /* xor index */ + unsigned char mask[4]; /* 32 bit mask for this connection */ + unsigned char firstbyte; /* first byte of frame we encode */ + bool contfragment; /* set TRUE if the previous fragment sent was not final */ +}; + +/* A websocket connection with en- and decoder that treat frames + * and keep track of boundaries. */ +struct websocket { + struct Curl_easy *data; /* used for write callback handling */ + struct ws_decoder dec; /* decode of we frames */ + struct ws_encoder enc; /* decode of we frames */ + struct bufq recvbuf; /* raw data from the server */ + struct bufq sendbuf; /* raw data to be sent to the server */ + struct curl_ws_frame frame; /* the current WS FRAME received */ +}; + +CURLcode Curl_ws_request(struct Curl_easy *data, REQTYPE *req); +CURLcode Curl_ws_accept(struct Curl_easy *data, const char *mem, size_t len); +size_t Curl_ws_writecb(char *buffer, size_t size, size_t nitems, void *userp); +void Curl_ws_done(struct Curl_easy *data); +CURLcode Curl_ws_disconnect(struct Curl_easy *data, + struct connectdata *conn, + bool dead_connection); +#else +#define Curl_ws_request(x,y) CURLE_OK +#define Curl_ws_done(x) Curl_nop_stmt +#define Curl_ws_free(x) Curl_nop_stmt +#endif + +#endif /* HEADER_CURL_WS_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/dlpack/include/dlpack/dlpack.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/dlpack/include/dlpack/dlpack.h new file mode 100644 index 0000000000000000000000000000000000000000..519b4e4c98983c3bce52c94abb157209a0d25070 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/dlpack/include/dlpack/dlpack.h @@ -0,0 +1,229 @@ +/*! + * Copyright (c) 2017 by Contributors + * \file dlpack.h + * \brief The common header of DLPack. + */ +#ifndef DLPACK_DLPACK_H_ +#define DLPACK_DLPACK_H_ + +/** + * \brief Compatibility with C++ + */ +#ifdef __cplusplus +#define DLPACK_EXTERN_C extern "C" +#else +#define DLPACK_EXTERN_C +#endif + +/*! \brief The current version of dlpack */ +#define DLPACK_VERSION 60 + +/*! \brief The current ABI version of dlpack */ +#define DLPACK_ABI_VERSION 1 + +/*! \brief DLPACK_DLL prefix for windows */ +#ifdef _WIN32 +#ifdef DLPACK_EXPORTS +#define DLPACK_DLL __declspec(dllexport) +#else +#define DLPACK_DLL __declspec(dllimport) +#endif +#else +#define DLPACK_DLL +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +/*! + * \brief The device type in DLDevice. + */ +#ifdef __cplusplus +typedef enum : int32_t { +#else +typedef enum { +#endif + /*! \brief CPU device */ + kDLCPU = 1, + /*! \brief CUDA GPU device */ + kDLCUDA = 2, + /*! + * \brief Pinned CUDA CPU memory by cudaMallocHost + */ + kDLCUDAHost = 3, + /*! \brief OpenCL devices. */ + kDLOpenCL = 4, + /*! \brief Vulkan buffer for next generation graphics. */ + kDLVulkan = 7, + /*! \brief Metal for Apple GPU. */ + kDLMetal = 8, + /*! \brief Verilog simulator buffer */ + kDLVPI = 9, + /*! \brief ROCm GPUs for AMD GPUs */ + kDLROCM = 10, + /*! + * \brief Pinned ROCm CPU memory allocated by hipMallocHost + */ + kDLROCMHost = 11, + /*! + * \brief Reserved extension device type, + * used for quickly test extension device + * The semantics can differ depending on the implementation. + */ + kDLExtDev = 12, + /*! + * \brief CUDA managed/unified memory allocated by cudaMallocManaged + */ + kDLCUDAManaged = 13, + /*! + * \brief Unified shared memory allocated on a oneAPI non-partititioned + * device. Call to oneAPI runtime is required to determine the device + * type, the USM allocation type and the sycl context it is bound to. + * + */ + kDLOneAPI = 14, + /*! \brief GPU support for next generation WebGPU standard. */ + kDLWebGPU = 15, + /*! \brief Qualcomm Hexagon DSP */ + kDLHexagon = 16, +} DLDeviceType; + +/*! + * \brief A Device for Tensor and operator. + */ +typedef struct { + /*! \brief The device type used in the device. */ + DLDeviceType device_type; + /*! + * \brief The device index. + * For vanilla CPU memory, pinned memory, or managed memory, this is set to 0. + */ + int32_t device_id; +} DLDevice; + +/*! + * \brief The type code options DLDataType. + */ +typedef enum { + /*! \brief signed integer */ + kDLInt = 0U, + /*! \brief unsigned integer */ + kDLUInt = 1U, + /*! \brief IEEE floating point */ + kDLFloat = 2U, + /*! + * \brief Opaque handle type, reserved for testing purposes. + * Frameworks need to agree on the handle data type for the exchange to be well-defined. + */ + kDLOpaqueHandle = 3U, + /*! \brief bfloat16 */ + kDLBfloat = 4U, + /*! + * \brief complex number + * (C/C++/Python layout: compact struct per complex number) + */ + kDLComplex = 5U, +} DLDataTypeCode; + +/*! + * \brief The data type the tensor can hold. The data type is assumed to follow the + * native endian-ness. An explicit error message should be raised when attempting to + * export an array with non-native endianness + * + * Examples + * - float: type_code = 2, bits = 32, lanes=1 + * - float4(vectorized 4 float): type_code = 2, bits = 32, lanes=4 + * - int8: type_code = 0, bits = 8, lanes=1 + * - std::complex: type_code = 5, bits = 64, lanes = 1 + */ +typedef struct { + /*! + * \brief Type code of base types. + * We keep it uint8_t instead of DLDataTypeCode for minimal memory + * footprint, but the value should be one of DLDataTypeCode enum values. + * */ + uint8_t code; + /*! + * \brief Number of bits, common choices are 8, 16, 32. + */ + uint8_t bits; + /*! \brief Number of lanes in the type, used for vector types. */ + uint16_t lanes; +} DLDataType; + +/*! + * \brief Plain C Tensor object, does not manage memory. + */ +typedef struct { + /*! + * \brief The data pointer points to the allocated data. This will be CUDA + * device pointer or cl_mem handle in OpenCL. It may be opaque on some device + * types. This pointer is always aligned to 256 bytes as in CUDA. The + * `byte_offset` field should be used to point to the beginning of the data. + * + * Note that as of Nov 2021, multiply libraries (CuPy, PyTorch, TensorFlow, + * TVM, perhaps others) do not adhere to this 256 byte aligment requirement + * on CPU/CUDA/ROCm, and always use `byte_offset=0`. This must be fixed + * (after which this note will be updated); at the moment it is recommended + * to not rely on the data pointer being correctly aligned. + * + * For given DLTensor, the size of memory required to store the contents of + * data is calculated as follows: + * + * \code{.c} + * static inline size_t GetDataSize(const DLTensor* t) { + * size_t size = 1; + * for (tvm_index_t i = 0; i < t->ndim; ++i) { + * size *= t->shape[i]; + * } + * size *= (t->dtype.bits * t->dtype.lanes + 7) / 8; + * return size; + * } + * \endcode + */ + void* data; + /*! \brief The device of the tensor */ + DLDevice device; + /*! \brief Number of dimensions */ + int32_t ndim; + /*! \brief The data type of the pointer*/ + DLDataType dtype; + /*! \brief The shape of the tensor */ + int64_t* shape; + /*! + * \brief strides of the tensor (in number of elements, not bytes) + * can be NULL, indicating tensor is compact and row-majored. + */ + int64_t* strides; + /*! \brief The offset in bytes to the beginning pointer to data */ + uint64_t byte_offset; +} DLTensor; + +/*! + * \brief C Tensor object, manage memory of DLTensor. This data structure is + * intended to facilitate the borrowing of DLTensor by another framework. It is + * not meant to transfer the tensor. When the borrowing framework doesn't need + * the tensor, it should call the deleter to notify the host that the resource + * is no longer needed. + */ +typedef struct DLManagedTensor { + /*! \brief DLTensor which is being memory managed */ + DLTensor dl_tensor; + /*! \brief the context of the original host framework of DLManagedTensor in + * which DLManagedTensor is used in the framework. It can also be NULL. + */ + void * manager_ctx; + /*! \brief Destructor signature void (*)(void*) - this should be called + * to destruct manager_ctx which holds the DLManagedTensor. It can be NULL + * if there is no way for the caller to provide a reasonable destructor. + * The destructors deletes the argument self as well. + */ + void (*deleter)(struct DLManagedTensor * self); +} DLManagedTensor; +#ifdef __cplusplus +} // DLPACK_EXTERN_C +#endif +#endif // DLPACK_DLPACK_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/bignum-dtoa.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/bignum-dtoa.h new file mode 100644 index 0000000000000000000000000000000000000000..34b961992d672c1713bc19dde430939d28dffb53 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/bignum-dtoa.h @@ -0,0 +1,84 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_BIGNUM_DTOA_H_ +#define DOUBLE_CONVERSION_BIGNUM_DTOA_H_ + +#include "utils.h" + +namespace double_conversion { + +enum BignumDtoaMode { + // Return the shortest correct representation. + // For example the output of 0.299999999999999988897 is (the less accurate but + // correct) 0.3. + BIGNUM_DTOA_SHORTEST, + // Same as BIGNUM_DTOA_SHORTEST but for single-precision floats. + BIGNUM_DTOA_SHORTEST_SINGLE, + // Return a fixed number of digits after the decimal point. + // For instance fixed(0.1, 4) becomes 0.1000 + // If the input number is big, the output will be big. + BIGNUM_DTOA_FIXED, + // Return a fixed number of digits, no matter what the exponent is. + BIGNUM_DTOA_PRECISION +}; + +// Converts the given double 'v' to ascii. +// The result should be interpreted as buffer * 10^(point-length). +// The buffer will be null-terminated. +// +// The input v must be > 0 and different from NaN, and Infinity. +// +// The output depends on the given mode: +// - SHORTEST: produce the least amount of digits for which the internal +// identity requirement is still satisfied. If the digits are printed +// (together with the correct exponent) then reading this number will give +// 'v' again. The buffer will choose the representation that is closest to +// 'v'. If there are two at the same distance, than the number is round up. +// In this mode the 'requested_digits' parameter is ignored. +// - FIXED: produces digits necessary to print a given number with +// 'requested_digits' digits after the decimal point. The produced digits +// might be too short in which case the caller has to fill the gaps with '0's. +// Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2. +// Halfway cases are rounded up. The call toFixed(0.15, 2) thus returns +// buffer="2", point=0. +// Note: the length of the returned buffer has no meaning wrt the significance +// of its digits. That is, just because it contains '0's does not mean that +// any other digit would not satisfy the internal identity requirement. +// - PRECISION: produces 'requested_digits' where the first digit is not '0'. +// Even though the length of produced digits usually equals +// 'requested_digits', the function is allowed to return fewer digits, in +// which case the caller has to fill the missing digits with '0's. +// Halfway cases are again rounded up. +// 'BignumDtoa' expects the given buffer to be big enough to hold all digits +// and a terminating null-character. +void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits, + Vector buffer, int* length, int* point); + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_BIGNUM_DTOA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/bignum.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/bignum.h new file mode 100644 index 0000000000000000000000000000000000000000..14d1ca86fc7fdefbcd394585026165225de71a14 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/bignum.h @@ -0,0 +1,152 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_BIGNUM_H_ +#define DOUBLE_CONVERSION_BIGNUM_H_ + +#include "utils.h" + +namespace double_conversion { + +class Bignum { + public: + // 3584 = 128 * 28. We can represent 2^3584 > 10^1000 accurately. + // This bignum can encode much bigger numbers, since it contains an + // exponent. + static const int kMaxSignificantBits = 3584; + + Bignum() : used_bigits_(0), exponent_(0) {} + + void AssignUInt16(const uint16_t value); + void AssignUInt64(uint64_t value); + void AssignBignum(const Bignum& other); + + void AssignDecimalString(const Vector value); + void AssignHexString(const Vector value); + + void AssignPowerUInt16(uint16_t base, const int exponent); + + void AddUInt64(const uint64_t operand); + void AddBignum(const Bignum& other); + // Precondition: this >= other. + void SubtractBignum(const Bignum& other); + + void Square(); + void ShiftLeft(const int shift_amount); + void MultiplyByUInt32(const uint32_t factor); + void MultiplyByUInt64(const uint64_t factor); + void MultiplyByPowerOfTen(const int exponent); + void Times10() { return MultiplyByUInt32(10); } + // Pseudocode: + // int result = this / other; + // this = this % other; + // In the worst case this function is in O(this/other). + uint16_t DivideModuloIntBignum(const Bignum& other); + + bool ToHexString(char* buffer, const int buffer_size) const; + + // Returns + // -1 if a < b, + // 0 if a == b, and + // +1 if a > b. + static int Compare(const Bignum& a, const Bignum& b); + static bool Equal(const Bignum& a, const Bignum& b) { + return Compare(a, b) == 0; + } + static bool LessEqual(const Bignum& a, const Bignum& b) { + return Compare(a, b) <= 0; + } + static bool Less(const Bignum& a, const Bignum& b) { + return Compare(a, b) < 0; + } + // Returns Compare(a + b, c); + static int PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c); + // Returns a + b == c + static bool PlusEqual(const Bignum& a, const Bignum& b, const Bignum& c) { + return PlusCompare(a, b, c) == 0; + } + // Returns a + b <= c + static bool PlusLessEqual(const Bignum& a, const Bignum& b, const Bignum& c) { + return PlusCompare(a, b, c) <= 0; + } + // Returns a + b < c + static bool PlusLess(const Bignum& a, const Bignum& b, const Bignum& c) { + return PlusCompare(a, b, c) < 0; + } + private: + typedef uint32_t Chunk; + typedef uint64_t DoubleChunk; + + static const int kChunkSize = sizeof(Chunk) * 8; + static const int kDoubleChunkSize = sizeof(DoubleChunk) * 8; + // With bigit size of 28 we loose some bits, but a double still fits easily + // into two chunks, and more importantly we can use the Comba multiplication. + static const int kBigitSize = 28; + static const Chunk kBigitMask = (1 << kBigitSize) - 1; + // Every instance allocates kBigitLength chunks on the stack. Bignums cannot + // grow. There are no checks if the stack-allocated space is sufficient. + static const int kBigitCapacity = kMaxSignificantBits / kBigitSize; + + static void EnsureCapacity(const int size) { + if (size > kBigitCapacity) { + DOUBLE_CONVERSION_UNREACHABLE(); + } + } + void Align(const Bignum& other); + void Clamp(); + bool IsClamped() const { + return used_bigits_ == 0 || RawBigit(used_bigits_ - 1) != 0; + } + void Zero() { + used_bigits_ = 0; + exponent_ = 0; + } + // Requires this to have enough capacity (no tests done). + // Updates used_bigits_ if necessary. + // shift_amount must be < kBigitSize. + void BigitsShiftLeft(const int shift_amount); + // BigitLength includes the "hidden" bigits encoded in the exponent. + int BigitLength() const { return used_bigits_ + exponent_; } + Chunk& RawBigit(const int index); + const Chunk& RawBigit(const int index) const; + Chunk BigitOrZero(const int index) const; + void SubtractTimes(const Bignum& other, const int factor); + + // The Bignum's value is value(bigits_buffer_) * 2^(exponent_ * kBigitSize), + // where the value of the buffer consists of the lower kBigitSize bits of + // the first used_bigits_ Chunks in bigits_buffer_, first chunk has lowest + // significant bits. + int16_t used_bigits_; + int16_t exponent_; + Chunk bigits_buffer_[kBigitCapacity]; + + DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(Bignum); +}; + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_BIGNUM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/cached-powers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/cached-powers.h new file mode 100644 index 0000000000000000000000000000000000000000..f38c26d201fad654612c81bca05f71feafc16111 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/cached-powers.h @@ -0,0 +1,64 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_CACHED_POWERS_H_ +#define DOUBLE_CONVERSION_CACHED_POWERS_H_ + +#include "diy-fp.h" + +namespace double_conversion { + +namespace PowersOfTenCache { + + // Not all powers of ten are cached. The decimal exponent of two neighboring + // cached numbers will differ by kDecimalExponentDistance. + static const int kDecimalExponentDistance = 8; + + static const int kMinDecimalExponent = -348; + static const int kMaxDecimalExponent = 340; + + // Returns a cached power-of-ten with a binary exponent in the range + // [min_exponent; max_exponent] (boundaries included). + void GetCachedPowerForBinaryExponentRange(int min_exponent, + int max_exponent, + DiyFp* power, + int* decimal_exponent); + + // Returns a cached power of ten x ~= 10^k such that + // k <= decimal_exponent < k + kCachedPowersDecimalDistance. + // The given decimal_exponent must satisfy + // kMinDecimalExponent <= requested_exponent, and + // requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance. + void GetCachedPowerForDecimalExponent(int requested_exponent, + DiyFp* power, + int* found_exponent); + +} // namespace PowersOfTenCache + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_CACHED_POWERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/diy-fp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/diy-fp.h new file mode 100644 index 0000000000000000000000000000000000000000..a2200c4ded0cddd173eab631223b58bfa0447a0e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/diy-fp.h @@ -0,0 +1,137 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_DIY_FP_H_ +#define DOUBLE_CONVERSION_DIY_FP_H_ + +#include "utils.h" + +namespace double_conversion { + +// This "Do It Yourself Floating Point" class implements a floating-point number +// with a uint64 significand and an int exponent. Normalized DiyFp numbers will +// have the most significant bit of the significand set. +// Multiplication and Subtraction do not normalize their results. +// DiyFp store only non-negative numbers and are not designed to contain special +// doubles (NaN and Infinity). +class DiyFp { + public: + static const int kSignificandSize = 64; + + DiyFp() : f_(0), e_(0) {} + DiyFp(const uint64_t significand, const int32_t exponent) : f_(significand), e_(exponent) {} + + // this -= other. + // The exponents of both numbers must be the same and the significand of this + // must be greater or equal than the significand of other. + // The result will not be normalized. + void Subtract(const DiyFp& other) { + DOUBLE_CONVERSION_ASSERT(e_ == other.e_); + DOUBLE_CONVERSION_ASSERT(f_ >= other.f_); + f_ -= other.f_; + } + + // Returns a - b. + // The exponents of both numbers must be the same and a must be greater + // or equal than b. The result will not be normalized. + static DiyFp Minus(const DiyFp& a, const DiyFp& b) { + DiyFp result = a; + result.Subtract(b); + return result; + } + + // this *= other. + void Multiply(const DiyFp& other) { + // Simply "emulates" a 128 bit multiplication. + // However: the resulting number only contains 64 bits. The least + // significant 64 bits are only used for rounding the most significant 64 + // bits. + const uint64_t kM32 = 0xFFFFFFFFU; + const uint64_t a = f_ >> 32; + const uint64_t b = f_ & kM32; + const uint64_t c = other.f_ >> 32; + const uint64_t d = other.f_ & kM32; + const uint64_t ac = a * c; + const uint64_t bc = b * c; + const uint64_t ad = a * d; + const uint64_t bd = b * d; + // By adding 1U << 31 to tmp we round the final result. + // Halfway cases will be rounded up. + const uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32) + (1U << 31); + e_ += other.e_ + 64; + f_ = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32); + } + + // returns a * b; + static DiyFp Times(const DiyFp& a, const DiyFp& b) { + DiyFp result = a; + result.Multiply(b); + return result; + } + + void Normalize() { + DOUBLE_CONVERSION_ASSERT(f_ != 0); + uint64_t significand = f_; + int32_t exponent = e_; + + // This method is mainly called for normalizing boundaries. In general, + // boundaries need to be shifted by 10 bits, and we optimize for this case. + const uint64_t k10MSBits = DOUBLE_CONVERSION_UINT64_2PART_C(0xFFC00000, 00000000); + while ((significand & k10MSBits) == 0) { + significand <<= 10; + exponent -= 10; + } + while ((significand & kUint64MSB) == 0) { + significand <<= 1; + exponent--; + } + f_ = significand; + e_ = exponent; + } + + static DiyFp Normalize(const DiyFp& a) { + DiyFp result = a; + result.Normalize(); + return result; + } + + uint64_t f() const { return f_; } + int32_t e() const { return e_; } + + void set_f(uint64_t new_value) { f_ = new_value; } + void set_e(int32_t new_value) { e_ = new_value; } + + private: + static const uint64_t kUint64MSB = DOUBLE_CONVERSION_UINT64_2PART_C(0x80000000, 00000000); + + uint64_t f_; + int32_t e_; +}; + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_DIY_FP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/double-conversion.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/double-conversion.h new file mode 100644 index 0000000000000000000000000000000000000000..6e8884d84ca56dbfd05964e463dd7999364b3b35 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/double-conversion.h @@ -0,0 +1,34 @@ +// Copyright 2012 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ +#define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ + +#include "string-to-double.h" +#include "double-to-string.h" + +#endif // DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/double-to-string.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/double-to-string.h new file mode 100644 index 0000000000000000000000000000000000000000..04a4ac384002b7a2f58ad59c6dee064ad153c0b3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/double-to-string.h @@ -0,0 +1,445 @@ +// Copyright 2012 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ +#define DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ + +#include "utils.h" + +namespace double_conversion { + +class DoubleToStringConverter { + public: + // When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint + // or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the + // function returns false. + static const int kMaxFixedDigitsBeforePoint = 60; + static const int kMaxFixedDigitsAfterPoint = 100; + + // When calling ToExponential with a requested_digits + // parameter > kMaxExponentialDigits then the function returns false. + static const int kMaxExponentialDigits = 120; + + // When calling ToPrecision with a requested_digits + // parameter < kMinPrecisionDigits or requested_digits > kMaxPrecisionDigits + // then the function returns false. + static const int kMinPrecisionDigits = 1; + static const int kMaxPrecisionDigits = 120; + + // The maximal number of digits that are needed to emit a double in base 10. + // A higher precision can be achieved by using more digits, but the shortest + // accurate representation of any double will never use more digits than + // kBase10MaximalLength. + // Note that DoubleToAscii null-terminates its input. So the given buffer + // should be at least kBase10MaximalLength + 1 characters long. + static const int kBase10MaximalLength = 17; + + // The maximal number of digits that are needed to emit a single in base 10. + // A higher precision can be achieved by using more digits, but the shortest + // accurate representation of any single will never use more digits than + // kBase10MaximalLengthSingle. + static const int kBase10MaximalLengthSingle = 9; + + // The length of the longest string that 'ToShortest' can produce when the + // converter is instantiated with EcmaScript defaults (see + // 'EcmaScriptConverter') + // This value does not include the trailing '\0' character. + // This amount of characters is needed for negative values that hit the + // 'decimal_in_shortest_low' limit. For example: "-0.0000033333333333333333" + static const int kMaxCharsEcmaScriptShortest = 25; + + enum Flags { + NO_FLAGS = 0, + EMIT_POSITIVE_EXPONENT_SIGN = 1, + EMIT_TRAILING_DECIMAL_POINT = 2, + EMIT_TRAILING_ZERO_AFTER_POINT = 4, + UNIQUE_ZERO = 8, + NO_TRAILING_ZERO = 16 + }; + + // Flags should be a bit-or combination of the possible Flags-enum. + // - NO_FLAGS: no special flags. + // - EMIT_POSITIVE_EXPONENT_SIGN: when the number is converted into exponent + // form, emits a '+' for positive exponents. Example: 1.2e+2. + // - EMIT_TRAILING_DECIMAL_POINT: when the input number is an integer and is + // converted into decimal format then a trailing decimal point is appended. + // Example: 2345.0 is converted to "2345.". + // - EMIT_TRAILING_ZERO_AFTER_POINT: in addition to a trailing decimal point + // emits a trailing '0'-character. This flag requires the + // EMIT_TRAILING_DECIMAL_POINT flag. + // Example: 2345.0 is converted to "2345.0". + // - UNIQUE_ZERO: "-0.0" is converted to "0.0". + // - NO_TRAILING_ZERO: Trailing zeros are removed from the fractional portion + // of the result in precision mode. Matches printf's %g. + // When EMIT_TRAILING_ZERO_AFTER_POINT is also given, one trailing zero is + // preserved. + // + // Infinity symbol and nan_symbol provide the string representation for these + // special values. If the string is NULL and the special value is encountered + // then the conversion functions return false. + // + // The exponent_character is used in exponential representations. It is + // usually 'e' or 'E'. + // + // When converting to the shortest representation the converter will + // represent input numbers in decimal format if they are in the interval + // [10^decimal_in_shortest_low; 10^decimal_in_shortest_high[ + // (lower boundary included, greater boundary excluded). + // Example: with decimal_in_shortest_low = -6 and + // decimal_in_shortest_high = 21: + // ToShortest(0.000001) -> "0.000001" + // ToShortest(0.0000001) -> "1e-7" + // ToShortest(111111111111111111111.0) -> "111111111111111110000" + // ToShortest(100000000000000000000.0) -> "100000000000000000000" + // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21" + // + // When converting to precision mode the converter may add + // max_leading_padding_zeroes before returning the number in exponential + // format. + // Example with max_leading_padding_zeroes_in_precision_mode = 6. + // ToPrecision(0.0000012345, 2) -> "0.0000012" + // ToPrecision(0.00000012345, 2) -> "1.2e-7" + // Similarly the converter may add up to + // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid + // returning an exponential representation. A zero added by the + // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit. + // Examples for max_trailing_padding_zeroes_in_precision_mode = 1: + // ToPrecision(230.0, 2) -> "230" + // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT. + // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT. + // + // The min_exponent_width is used for exponential representations. + // The converter adds leading '0's to the exponent until the exponent + // is at least min_exponent_width digits long. + // The min_exponent_width is clamped to 5. + // As such, the exponent may never have more than 5 digits in total. + DoubleToStringConverter(int flags, + const char* infinity_symbol, + const char* nan_symbol, + char exponent_character, + int decimal_in_shortest_low, + int decimal_in_shortest_high, + int max_leading_padding_zeroes_in_precision_mode, + int max_trailing_padding_zeroes_in_precision_mode, + int min_exponent_width = 0) + : flags_(flags), + infinity_symbol_(infinity_symbol), + nan_symbol_(nan_symbol), + exponent_character_(exponent_character), + decimal_in_shortest_low_(decimal_in_shortest_low), + decimal_in_shortest_high_(decimal_in_shortest_high), + max_leading_padding_zeroes_in_precision_mode_( + max_leading_padding_zeroes_in_precision_mode), + max_trailing_padding_zeroes_in_precision_mode_( + max_trailing_padding_zeroes_in_precision_mode), + min_exponent_width_(min_exponent_width) { + // When 'trailing zero after the point' is set, then 'trailing point' + // must be set too. + DOUBLE_CONVERSION_ASSERT(((flags & EMIT_TRAILING_DECIMAL_POINT) != 0) || + !((flags & EMIT_TRAILING_ZERO_AFTER_POINT) != 0)); + } + + // Returns a converter following the EcmaScript specification. + // + // Flags: UNIQUE_ZERO and EMIT_POSITIVE_EXPONENT_SIGN. + // Special values: "Infinity" and "NaN". + // Lower case 'e' for exponential values. + // decimal_in_shortest_low: -6 + // decimal_in_shortest_high: 21 + // max_leading_padding_zeroes_in_precision_mode: 6 + // max_trailing_padding_zeroes_in_precision_mode: 0 + static const DoubleToStringConverter& EcmaScriptConverter(); + + // Computes the shortest string of digits that correctly represent the input + // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high + // (see constructor) it then either returns a decimal representation, or an + // exponential representation. + // Example with decimal_in_shortest_low = -6, + // decimal_in_shortest_high = 21, + // EMIT_POSITIVE_EXPONENT_SIGN activated, and + // EMIT_TRAILING_DECIMAL_POINT deactivated: + // ToShortest(0.000001) -> "0.000001" + // ToShortest(0.0000001) -> "1e-7" + // ToShortest(111111111111111111111.0) -> "111111111111111110000" + // ToShortest(100000000000000000000.0) -> "100000000000000000000" + // ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21" + // + // Note: the conversion may round the output if the returned string + // is accurate enough to uniquely identify the input-number. + // For example the most precise representation of the double 9e59 equals + // "899999999999999918767229449717619953810131273674690656206848", but + // the converter will return the shorter (but still correct) "9e59". + // + // Returns true if the conversion succeeds. The conversion always succeeds + // except when the input value is special and no infinity_symbol or + // nan_symbol has been given to the constructor. + // + // The length of the longest result is the maximum of the length of the + // following string representations (each with possible examples): + // - NaN and negative infinity: "NaN", "-Infinity", "-inf". + // - -10^(decimal_in_shortest_high - 1): + // "-100000000000000000000", "-1000000000000000.0" + // - the longest string in range [0; -10^decimal_in_shortest_low]. Generally, + // this string is 3 + kBase10MaximalLength - decimal_in_shortest_low. + // (Sign, '0', decimal point, padding zeroes for decimal_in_shortest_low, + // and the significant digits). + // "-0.0000033333333333333333", "-0.0012345678901234567" + // - the longest exponential representation. (A negative number with + // kBase10MaximalLength significant digits). + // "-1.7976931348623157e+308", "-1.7976931348623157E308" + // In addition, the buffer must be able to hold the trailing '\0' character. + bool ToShortest(double value, StringBuilder* result_builder) const { + return ToShortestIeeeNumber(value, result_builder, SHORTEST); + } + + // Same as ToShortest, but for single-precision floats. + bool ToShortestSingle(float value, StringBuilder* result_builder) const { + return ToShortestIeeeNumber(value, result_builder, SHORTEST_SINGLE); + } + + + // Computes a decimal representation with a fixed number of digits after the + // decimal point. The last emitted digit is rounded. + // + // Examples: + // ToFixed(3.12, 1) -> "3.1" + // ToFixed(3.1415, 3) -> "3.142" + // ToFixed(1234.56789, 4) -> "1234.5679" + // ToFixed(1.23, 5) -> "1.23000" + // ToFixed(0.1, 4) -> "0.1000" + // ToFixed(1e30, 2) -> "1000000000000000019884624838656.00" + // ToFixed(0.1, 30) -> "0.100000000000000005551115123126" + // ToFixed(0.1, 17) -> "0.10000000000000001" + // + // If requested_digits equals 0, then the tail of the result depends on + // the EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT. + // Examples, for requested_digits == 0, + // let EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT be + // - false and false: then 123.45 -> 123 + // 0.678 -> 1 + // - true and false: then 123.45 -> 123. + // 0.678 -> 1. + // - true and true: then 123.45 -> 123.0 + // 0.678 -> 1.0 + // + // Returns true if the conversion succeeds. The conversion always succeeds + // except for the following cases: + // - the input value is special and no infinity_symbol or nan_symbol has + // been provided to the constructor, + // - 'value' > 10^kMaxFixedDigitsBeforePoint, or + // - 'requested_digits' > kMaxFixedDigitsAfterPoint. + // The last two conditions imply that the result for non-special values never + // contains more than + // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters + // (one additional character for the sign, and one for the decimal point). + // In addition, the buffer must be able to hold the trailing '\0' character. + bool ToFixed(double value, + int requested_digits, + StringBuilder* result_builder) const; + + // Computes a representation in exponential format with requested_digits + // after the decimal point. The last emitted digit is rounded. + // If requested_digits equals -1, then the shortest exponential representation + // is computed. + // + // Examples with EMIT_POSITIVE_EXPONENT_SIGN deactivated, and + // exponent_character set to 'e'. + // ToExponential(3.12, 1) -> "3.1e0" + // ToExponential(5.0, 3) -> "5.000e0" + // ToExponential(0.001, 2) -> "1.00e-3" + // ToExponential(3.1415, -1) -> "3.1415e0" + // ToExponential(3.1415, 4) -> "3.1415e0" + // ToExponential(3.1415, 3) -> "3.142e0" + // ToExponential(123456789000000, 3) -> "1.235e14" + // ToExponential(1000000000000000019884624838656.0, -1) -> "1e30" + // ToExponential(1000000000000000019884624838656.0, 32) -> + // "1.00000000000000001988462483865600e30" + // ToExponential(1234, 0) -> "1e3" + // + // Returns true if the conversion succeeds. The conversion always succeeds + // except for the following cases: + // - the input value is special and no infinity_symbol or nan_symbol has + // been provided to the constructor, + // - 'requested_digits' > kMaxExponentialDigits. + // + // The last condition implies that the result never contains more than + // kMaxExponentialDigits + 8 characters (the sign, the digit before the + // decimal point, the decimal point, the exponent character, the + // exponent's sign, and at most 3 exponent digits). + // In addition, the buffer must be able to hold the trailing '\0' character. + bool ToExponential(double value, + int requested_digits, + StringBuilder* result_builder) const; + + + // Computes 'precision' leading digits of the given 'value' and returns them + // either in exponential or decimal format, depending on + // max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the + // constructor). + // The last computed digit is rounded. + // + // Example with max_leading_padding_zeroes_in_precision_mode = 6. + // ToPrecision(0.0000012345, 2) -> "0.0000012" + // ToPrecision(0.00000012345, 2) -> "1.2e-7" + // Similarly the converter may add up to + // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid + // returning an exponential representation. A zero added by the + // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit. + // Examples for max_trailing_padding_zeroes_in_precision_mode = 1: + // ToPrecision(230.0, 2) -> "230" + // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT. + // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT. + // Examples for max_trailing_padding_zeroes_in_precision_mode = 3, and no + // EMIT_TRAILING_ZERO_AFTER_POINT: + // ToPrecision(123450.0, 6) -> "123450" + // ToPrecision(123450.0, 5) -> "123450" + // ToPrecision(123450.0, 4) -> "123500" + // ToPrecision(123450.0, 3) -> "123000" + // ToPrecision(123450.0, 2) -> "1.2e5" + // + // Returns true if the conversion succeeds. The conversion always succeeds + // except for the following cases: + // - the input value is special and no infinity_symbol or nan_symbol has + // been provided to the constructor, + // - precision < kMinPericisionDigits + // - precision > kMaxPrecisionDigits + // + // The last condition implies that the result never contains more than + // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the + // exponent character, the exponent's sign, and at most 3 exponent digits). + // In addition, the buffer must be able to hold the trailing '\0' character. + bool ToPrecision(double value, + int precision, + StringBuilder* result_builder) const; + + enum DtoaMode { + // Produce the shortest correct representation. + // For example the output of 0.299999999999999988897 is (the less accurate + // but correct) 0.3. + SHORTEST, + // Same as SHORTEST, but for single-precision floats. + SHORTEST_SINGLE, + // Produce a fixed number of digits after the decimal point. + // For instance fixed(0.1, 4) becomes 0.1000 + // If the input number is big, the output will be big. + FIXED, + // Fixed number of digits (independent of the decimal point). + PRECISION + }; + + // Converts the given double 'v' to digit characters. 'v' must not be NaN, + // +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also + // applies to 'v' after it has been casted to a single-precision float. That + // is, in this mode static_cast(v) must not be NaN, +Infinity or + // -Infinity. + // + // The result should be interpreted as buffer * 10^(point-length). + // + // The digits are written to the buffer in the platform's charset, which is + // often UTF-8 (with ASCII-range digits) but may be another charset, such + // as EBCDIC. + // + // The output depends on the given mode: + // - SHORTEST: produce the least amount of digits for which the internal + // identity requirement is still satisfied. If the digits are printed + // (together with the correct exponent) then reading this number will give + // 'v' again. The buffer will choose the representation that is closest to + // 'v'. If there are two at the same distance, than the one farther away + // from 0 is chosen (halfway cases - ending with 5 - are rounded up). + // In this mode the 'requested_digits' parameter is ignored. + // - SHORTEST_SINGLE: same as SHORTEST but with single-precision. + // - FIXED: produces digits necessary to print a given number with + // 'requested_digits' digits after the decimal point. The produced digits + // might be too short in which case the caller has to fill the remainder + // with '0's. + // Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2. + // Halfway cases are rounded towards +/-Infinity (away from 0). The call + // toFixed(0.15, 2) thus returns buffer="2", point=0. + // The returned buffer may contain digits that would be truncated from the + // shortest representation of the input. + // - PRECISION: produces 'requested_digits' where the first digit is not '0'. + // Even though the length of produced digits usually equals + // 'requested_digits', the function is allowed to return fewer digits, in + // which case the caller has to fill the missing digits with '0's. + // Halfway cases are again rounded away from 0. + // DoubleToAscii expects the given buffer to be big enough to hold all + // digits and a terminating null-character. In SHORTEST-mode it expects a + // buffer of at least kBase10MaximalLength + 1. In all other modes the + // requested_digits parameter and the padding-zeroes limit the size of the + // output. Don't forget the decimal point, the exponent character and the + // terminating null-character when computing the maximal output size. + // The given length is only used in debug mode to ensure the buffer is big + // enough. + static void DoubleToAscii(double v, + DtoaMode mode, + int requested_digits, + char* buffer, + int buffer_length, + bool* sign, + int* length, + int* point); + + private: + // Implementation for ToShortest and ToShortestSingle. + bool ToShortestIeeeNumber(double value, + StringBuilder* result_builder, + DtoaMode mode) const; + + // If the value is a special value (NaN or Infinity) constructs the + // corresponding string using the configured infinity/nan-symbol. + // If either of them is NULL or the value is not special then the + // function returns false. + bool HandleSpecialValues(double value, StringBuilder* result_builder) const; + // Constructs an exponential representation (i.e. 1.234e56). + // The given exponent assumes a decimal point after the first decimal digit. + void CreateExponentialRepresentation(const char* decimal_digits, + int length, + int exponent, + StringBuilder* result_builder) const; + // Creates a decimal representation (i.e 1234.5678). + void CreateDecimalRepresentation(const char* decimal_digits, + int length, + int decimal_point, + int digits_after_point, + StringBuilder* result_builder) const; + + const int flags_; + const char* const infinity_symbol_; + const char* const nan_symbol_; + const char exponent_character_; + const int decimal_in_shortest_low_; + const int decimal_in_shortest_high_; + const int max_leading_padding_zeroes_in_precision_mode_; + const int max_trailing_padding_zeroes_in_precision_mode_; + const int min_exponent_width_; + + DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter); +}; + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/fast-dtoa.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/fast-dtoa.h new file mode 100644 index 0000000000000000000000000000000000000000..5f1e8eee5e56e7c496c84dc0a5bf9dad0b97fc9f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/fast-dtoa.h @@ -0,0 +1,88 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_FAST_DTOA_H_ +#define DOUBLE_CONVERSION_FAST_DTOA_H_ + +#include "utils.h" + +namespace double_conversion { + +enum FastDtoaMode { + // Computes the shortest representation of the given input. The returned + // result will be the most accurate number of this length. Longer + // representations might be more accurate. + FAST_DTOA_SHORTEST, + // Same as FAST_DTOA_SHORTEST but for single-precision floats. + FAST_DTOA_SHORTEST_SINGLE, + // Computes a representation where the precision (number of digits) is + // given as input. The precision is independent of the decimal point. + FAST_DTOA_PRECISION +}; + +// FastDtoa will produce at most kFastDtoaMaximalLength digits. This does not +// include the terminating '\0' character. +static const int kFastDtoaMaximalLength = 17; +// Same for single-precision numbers. +static const int kFastDtoaMaximalSingleLength = 9; + +// Provides a decimal representation of v. +// The result should be interpreted as buffer * 10^(point - length). +// +// Precondition: +// * v must be a strictly positive finite double. +// +// Returns true if it succeeds, otherwise the result can not be trusted. +// There will be *length digits inside the buffer followed by a null terminator. +// If the function returns true and mode equals +// - FAST_DTOA_SHORTEST, then +// the parameter requested_digits is ignored. +// The result satisfies +// v == (double) (buffer * 10^(point - length)). +// The digits in the buffer are the shortest representation possible. E.g. +// if 0.099999999999 and 0.1 represent the same double then "1" is returned +// with point = 0. +// The last digit will be closest to the actual v. That is, even if several +// digits might correctly yield 'v' when read again, the buffer will contain +// the one closest to v. +// - FAST_DTOA_PRECISION, then +// the buffer contains requested_digits digits. +// the difference v - (buffer * 10^(point-length)) is closest to zero for +// all possible representations of requested_digits digits. +// If there are two values that are equally close, then FastDtoa returns +// false. +// For both modes the buffer must be large enough to hold the result. +bool FastDtoa(double d, + FastDtoaMode mode, + int requested_digits, + Vector buffer, + int* length, + int* decimal_point); + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_FAST_DTOA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/fixed-dtoa.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/fixed-dtoa.h new file mode 100644 index 0000000000000000000000000000000000000000..3bdd08e21f59d5fece37eb14a6f510f464c3f2ba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/fixed-dtoa.h @@ -0,0 +1,56 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_FIXED_DTOA_H_ +#define DOUBLE_CONVERSION_FIXED_DTOA_H_ + +#include "utils.h" + +namespace double_conversion { + +// Produces digits necessary to print a given number with +// 'fractional_count' digits after the decimal point. +// The buffer must be big enough to hold the result plus one terminating null +// character. +// +// The produced digits might be too short in which case the caller has to fill +// the gaps with '0's. +// Example: FastFixedDtoa(0.001, 5, ...) is allowed to return buffer = "1", and +// decimal_point = -2. +// Halfway cases are rounded towards +/-Infinity (away from 0). The call +// FastFixedDtoa(0.15, 2, ...) thus returns buffer = "2", decimal_point = 0. +// The returned buffer may contain digits that would be truncated from the +// shortest representation of the input. +// +// This method only works for some parameters. If it can't handle the input it +// returns false. The output is null-terminated when the function succeeds. +bool FastFixedDtoa(double v, int fractional_count, + Vector buffer, int* length, int* decimal_point); + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_FIXED_DTOA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/ieee.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/ieee.h new file mode 100644 index 0000000000000000000000000000000000000000..9203f4d558e0cea52007cc5809a715042451e8f9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/ieee.h @@ -0,0 +1,447 @@ +// Copyright 2012 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_DOUBLE_H_ +#define DOUBLE_CONVERSION_DOUBLE_H_ + +#include "diy-fp.h" + +namespace double_conversion { + +// We assume that doubles and uint64_t have the same endianness. +static uint64_t double_to_uint64(double d) { return BitCast(d); } +static double uint64_to_double(uint64_t d64) { return BitCast(d64); } +static uint32_t float_to_uint32(float f) { return BitCast(f); } +static float uint32_to_float(uint32_t d32) { return BitCast(d32); } + +// Helper functions for doubles. +class Double { + public: + static const uint64_t kSignMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x80000000, 00000000); + static const uint64_t kExponentMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF00000, 00000000); + static const uint64_t kSignificandMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x000FFFFF, FFFFFFFF); + static const uint64_t kHiddenBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00100000, 00000000); + static const uint64_t kQuietNanBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00080000, 00000000); + static const int kPhysicalSignificandSize = 52; // Excludes the hidden bit. + static const int kSignificandSize = 53; + static const int kExponentBias = 0x3FF + kPhysicalSignificandSize; + static const int kMaxExponent = 0x7FF - kExponentBias; + + Double() : d64_(0) {} + explicit Double(double d) : d64_(double_to_uint64(d)) {} + explicit Double(uint64_t d64) : d64_(d64) {} + explicit Double(DiyFp diy_fp) + : d64_(DiyFpToUint64(diy_fp)) {} + + // The value encoded by this Double must be greater or equal to +0.0. + // It must not be special (infinity, or NaN). + DiyFp AsDiyFp() const { + DOUBLE_CONVERSION_ASSERT(Sign() > 0); + DOUBLE_CONVERSION_ASSERT(!IsSpecial()); + return DiyFp(Significand(), Exponent()); + } + + // The value encoded by this Double must be strictly greater than 0. + DiyFp AsNormalizedDiyFp() const { + DOUBLE_CONVERSION_ASSERT(value() > 0.0); + uint64_t f = Significand(); + int e = Exponent(); + + // The current double could be a denormal. + while ((f & kHiddenBit) == 0) { + f <<= 1; + e--; + } + // Do the final shifts in one go. + f <<= DiyFp::kSignificandSize - kSignificandSize; + e -= DiyFp::kSignificandSize - kSignificandSize; + return DiyFp(f, e); + } + + // Returns the double's bit as uint64. + uint64_t AsUint64() const { + return d64_; + } + + // Returns the next greater double. Returns +infinity on input +infinity. + double NextDouble() const { + if (d64_ == kInfinity) return Double(kInfinity).value(); + if (Sign() < 0 && Significand() == 0) { + // -0.0 + return 0.0; + } + if (Sign() < 0) { + return Double(d64_ - 1).value(); + } else { + return Double(d64_ + 1).value(); + } + } + + double PreviousDouble() const { + if (d64_ == (kInfinity | kSignMask)) return -Infinity(); + if (Sign() < 0) { + return Double(d64_ + 1).value(); + } else { + if (Significand() == 0) return -0.0; + return Double(d64_ - 1).value(); + } + } + + int Exponent() const { + if (IsDenormal()) return kDenormalExponent; + + uint64_t d64 = AsUint64(); + int biased_e = + static_cast((d64 & kExponentMask) >> kPhysicalSignificandSize); + return biased_e - kExponentBias; + } + + uint64_t Significand() const { + uint64_t d64 = AsUint64(); + uint64_t significand = d64 & kSignificandMask; + if (!IsDenormal()) { + return significand + kHiddenBit; + } else { + return significand; + } + } + + // Returns true if the double is a denormal. + bool IsDenormal() const { + uint64_t d64 = AsUint64(); + return (d64 & kExponentMask) == 0; + } + + // We consider denormals not to be special. + // Hence only Infinity and NaN are special. + bool IsSpecial() const { + uint64_t d64 = AsUint64(); + return (d64 & kExponentMask) == kExponentMask; + } + + bool IsNan() const { + uint64_t d64 = AsUint64(); + return ((d64 & kExponentMask) == kExponentMask) && + ((d64 & kSignificandMask) != 0); + } + + bool IsQuietNan() const { +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + return IsNan() && ((AsUint64() & kQuietNanBit) == 0); +#else + return IsNan() && ((AsUint64() & kQuietNanBit) != 0); +#endif + } + + bool IsSignalingNan() const { +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + return IsNan() && ((AsUint64() & kQuietNanBit) != 0); +#else + return IsNan() && ((AsUint64() & kQuietNanBit) == 0); +#endif + } + + + bool IsInfinite() const { + uint64_t d64 = AsUint64(); + return ((d64 & kExponentMask) == kExponentMask) && + ((d64 & kSignificandMask) == 0); + } + + int Sign() const { + uint64_t d64 = AsUint64(); + return (d64 & kSignMask) == 0? 1: -1; + } + + // Precondition: the value encoded by this Double must be greater or equal + // than +0.0. + DiyFp UpperBoundary() const { + DOUBLE_CONVERSION_ASSERT(Sign() > 0); + return DiyFp(Significand() * 2 + 1, Exponent() - 1); + } + + // Computes the two boundaries of this. + // The bigger boundary (m_plus) is normalized. The lower boundary has the same + // exponent as m_plus. + // Precondition: the value encoded by this Double must be greater than 0. + void NormalizedBoundaries(DiyFp* out_m_minus, DiyFp* out_m_plus) const { + DOUBLE_CONVERSION_ASSERT(value() > 0.0); + DiyFp v = this->AsDiyFp(); + DiyFp m_plus = DiyFp::Normalize(DiyFp((v.f() << 1) + 1, v.e() - 1)); + DiyFp m_minus; + if (LowerBoundaryIsCloser()) { + m_minus = DiyFp((v.f() << 2) - 1, v.e() - 2); + } else { + m_minus = DiyFp((v.f() << 1) - 1, v.e() - 1); + } + m_minus.set_f(m_minus.f() << (m_minus.e() - m_plus.e())); + m_minus.set_e(m_plus.e()); + *out_m_plus = m_plus; + *out_m_minus = m_minus; + } + + bool LowerBoundaryIsCloser() const { + // The boundary is closer if the significand is of the form f == 2^p-1 then + // the lower boundary is closer. + // Think of v = 1000e10 and v- = 9999e9. + // Then the boundary (== (v - v-)/2) is not just at a distance of 1e9 but + // at a distance of 1e8. + // The only exception is for the smallest normal: the largest denormal is + // at the same distance as its successor. + // Note: denormals have the same exponent as the smallest normals. + bool physical_significand_is_zero = ((AsUint64() & kSignificandMask) == 0); + return physical_significand_is_zero && (Exponent() != kDenormalExponent); + } + + double value() const { return uint64_to_double(d64_); } + + // Returns the significand size for a given order of magnitude. + // If v = f*2^e with 2^p-1 <= f <= 2^p then p+e is v's order of magnitude. + // This function returns the number of significant binary digits v will have + // once it's encoded into a double. In almost all cases this is equal to + // kSignificandSize. The only exceptions are denormals. They start with + // leading zeroes and their effective significand-size is hence smaller. + static int SignificandSizeForOrderOfMagnitude(int order) { + if (order >= (kDenormalExponent + kSignificandSize)) { + return kSignificandSize; + } + if (order <= kDenormalExponent) return 0; + return order - kDenormalExponent; + } + + static double Infinity() { + return Double(kInfinity).value(); + } + + static double NaN() { + return Double(kNaN).value(); + } + + private: + static const int kDenormalExponent = -kExponentBias + 1; + static const uint64_t kInfinity = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF00000, 00000000); +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + static const uint64_t kNaN = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF7FFFF, FFFFFFFF); +#else + static const uint64_t kNaN = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF80000, 00000000); +#endif + + + const uint64_t d64_; + + static uint64_t DiyFpToUint64(DiyFp diy_fp) { + uint64_t significand = diy_fp.f(); + int exponent = diy_fp.e(); + while (significand > kHiddenBit + kSignificandMask) { + significand >>= 1; + exponent++; + } + if (exponent >= kMaxExponent) { + return kInfinity; + } + if (exponent < kDenormalExponent) { + return 0; + } + while (exponent > kDenormalExponent && (significand & kHiddenBit) == 0) { + significand <<= 1; + exponent--; + } + uint64_t biased_exponent; + if (exponent == kDenormalExponent && (significand & kHiddenBit) == 0) { + biased_exponent = 0; + } else { + biased_exponent = static_cast(exponent + kExponentBias); + } + return (significand & kSignificandMask) | + (biased_exponent << kPhysicalSignificandSize); + } + + DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(Double); +}; + +class Single { + public: + static const uint32_t kSignMask = 0x80000000; + static const uint32_t kExponentMask = 0x7F800000; + static const uint32_t kSignificandMask = 0x007FFFFF; + static const uint32_t kHiddenBit = 0x00800000; + static const uint32_t kQuietNanBit = 0x00400000; + static const int kPhysicalSignificandSize = 23; // Excludes the hidden bit. + static const int kSignificandSize = 24; + + Single() : d32_(0) {} + explicit Single(float f) : d32_(float_to_uint32(f)) {} + explicit Single(uint32_t d32) : d32_(d32) {} + + // The value encoded by this Single must be greater or equal to +0.0. + // It must not be special (infinity, or NaN). + DiyFp AsDiyFp() const { + DOUBLE_CONVERSION_ASSERT(Sign() > 0); + DOUBLE_CONVERSION_ASSERT(!IsSpecial()); + return DiyFp(Significand(), Exponent()); + } + + // Returns the single's bit as uint64. + uint32_t AsUint32() const { + return d32_; + } + + int Exponent() const { + if (IsDenormal()) return kDenormalExponent; + + uint32_t d32 = AsUint32(); + int biased_e = + static_cast((d32 & kExponentMask) >> kPhysicalSignificandSize); + return biased_e - kExponentBias; + } + + uint32_t Significand() const { + uint32_t d32 = AsUint32(); + uint32_t significand = d32 & kSignificandMask; + if (!IsDenormal()) { + return significand + kHiddenBit; + } else { + return significand; + } + } + + // Returns true if the single is a denormal. + bool IsDenormal() const { + uint32_t d32 = AsUint32(); + return (d32 & kExponentMask) == 0; + } + + // We consider denormals not to be special. + // Hence only Infinity and NaN are special. + bool IsSpecial() const { + uint32_t d32 = AsUint32(); + return (d32 & kExponentMask) == kExponentMask; + } + + bool IsNan() const { + uint32_t d32 = AsUint32(); + return ((d32 & kExponentMask) == kExponentMask) && + ((d32 & kSignificandMask) != 0); + } + + bool IsQuietNan() const { +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + return IsNan() && ((AsUint32() & kQuietNanBit) == 0); +#else + return IsNan() && ((AsUint32() & kQuietNanBit) != 0); +#endif + } + + bool IsSignalingNan() const { +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + return IsNan() && ((AsUint32() & kQuietNanBit) != 0); +#else + return IsNan() && ((AsUint32() & kQuietNanBit) == 0); +#endif + } + + + bool IsInfinite() const { + uint32_t d32 = AsUint32(); + return ((d32 & kExponentMask) == kExponentMask) && + ((d32 & kSignificandMask) == 0); + } + + int Sign() const { + uint32_t d32 = AsUint32(); + return (d32 & kSignMask) == 0? 1: -1; + } + + // Computes the two boundaries of this. + // The bigger boundary (m_plus) is normalized. The lower boundary has the same + // exponent as m_plus. + // Precondition: the value encoded by this Single must be greater than 0. + void NormalizedBoundaries(DiyFp* out_m_minus, DiyFp* out_m_plus) const { + DOUBLE_CONVERSION_ASSERT(value() > 0.0); + DiyFp v = this->AsDiyFp(); + DiyFp m_plus = DiyFp::Normalize(DiyFp((v.f() << 1) + 1, v.e() - 1)); + DiyFp m_minus; + if (LowerBoundaryIsCloser()) { + m_minus = DiyFp((v.f() << 2) - 1, v.e() - 2); + } else { + m_minus = DiyFp((v.f() << 1) - 1, v.e() - 1); + } + m_minus.set_f(m_minus.f() << (m_minus.e() - m_plus.e())); + m_minus.set_e(m_plus.e()); + *out_m_plus = m_plus; + *out_m_minus = m_minus; + } + + // Precondition: the value encoded by this Single must be greater or equal + // than +0.0. + DiyFp UpperBoundary() const { + DOUBLE_CONVERSION_ASSERT(Sign() > 0); + return DiyFp(Significand() * 2 + 1, Exponent() - 1); + } + + bool LowerBoundaryIsCloser() const { + // The boundary is closer if the significand is of the form f == 2^p-1 then + // the lower boundary is closer. + // Think of v = 1000e10 and v- = 9999e9. + // Then the boundary (== (v - v-)/2) is not just at a distance of 1e9 but + // at a distance of 1e8. + // The only exception is for the smallest normal: the largest denormal is + // at the same distance as its successor. + // Note: denormals have the same exponent as the smallest normals. + bool physical_significand_is_zero = ((AsUint32() & kSignificandMask) == 0); + return physical_significand_is_zero && (Exponent() != kDenormalExponent); + } + + float value() const { return uint32_to_float(d32_); } + + static float Infinity() { + return Single(kInfinity).value(); + } + + static float NaN() { + return Single(kNaN).value(); + } + + private: + static const int kExponentBias = 0x7F + kPhysicalSignificandSize; + static const int kDenormalExponent = -kExponentBias + 1; + static const int kMaxExponent = 0xFF - kExponentBias; + static const uint32_t kInfinity = 0x7F800000; +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + static const uint32_t kNaN = 0x7FBFFFFF; +#else + static const uint32_t kNaN = 0x7FC00000; +#endif + + const uint32_t d32_; + + DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(Single); +}; + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_DOUBLE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/string-to-double.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/string-to-double.h new file mode 100644 index 0000000000000000000000000000000000000000..fdf302d4c38cec67f3bc9830231e58052ed7300d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/string-to-double.h @@ -0,0 +1,238 @@ +// Copyright 2012 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_ +#define DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_ + +#include "utils.h" + +namespace double_conversion { + +class StringToDoubleConverter { + public: + // Enumeration for allowing octals and ignoring junk when converting + // strings to numbers. + enum Flags { + NO_FLAGS = 0, + ALLOW_HEX = 1, + ALLOW_OCTALS = 2, + ALLOW_TRAILING_JUNK = 4, + ALLOW_LEADING_SPACES = 8, + ALLOW_TRAILING_SPACES = 16, + ALLOW_SPACES_AFTER_SIGN = 32, + ALLOW_CASE_INSENSITIVITY = 64, + ALLOW_CASE_INSENSIBILITY = 64, // Deprecated + ALLOW_HEX_FLOATS = 128, + }; + + static const uc16 kNoSeparator = '\0'; + + // Flags should be a bit-or combination of the possible Flags-enum. + // - NO_FLAGS: no special flags. + // - ALLOW_HEX: recognizes the prefix "0x". Hex numbers may only be integers. + // Ex: StringToDouble("0x1234") -> 4660.0 + // In StringToDouble("0x1234.56") the characters ".56" are trailing + // junk. The result of the call is hence dependent on + // the ALLOW_TRAILING_JUNK flag and/or the junk value. + // With this flag "0x" is a junk-string. Even with ALLOW_TRAILING_JUNK, + // the string will not be parsed as "0" followed by junk. + // + // - ALLOW_OCTALS: recognizes the prefix "0" for octals: + // If a sequence of octal digits starts with '0', then the number is + // read as octal integer. Octal numbers may only be integers. + // Ex: StringToDouble("01234") -> 668.0 + // StringToDouble("012349") -> 12349.0 // Not a sequence of octal + // // digits. + // In StringToDouble("01234.56") the characters ".56" are trailing + // junk. The result of the call is hence dependent on + // the ALLOW_TRAILING_JUNK flag and/or the junk value. + // In StringToDouble("01234e56") the characters "e56" are trailing + // junk, too. + // - ALLOW_TRAILING_JUNK: ignore trailing characters that are not part of + // a double literal. + // - ALLOW_LEADING_SPACES: skip over leading whitespace, including spaces, + // new-lines, and tabs. + // - ALLOW_TRAILING_SPACES: ignore trailing whitespace. + // - ALLOW_SPACES_AFTER_SIGN: ignore whitespace after the sign. + // Ex: StringToDouble("- 123.2") -> -123.2. + // StringToDouble("+ 123.2") -> 123.2 + // - ALLOW_CASE_INSENSITIVITY: ignore case of characters for special values: + // infinity and nan. + // - ALLOW_HEX_FLOATS: allows hexadecimal float literals. + // This *must* start with "0x" and separate the exponent with "p". + // Examples: 0x1.2p3 == 9.0 + // 0x10.1p0 == 16.0625 + // ALLOW_HEX and ALLOW_HEX_FLOATS are indented. + // + // empty_string_value is returned when an empty string is given as input. + // If ALLOW_LEADING_SPACES or ALLOW_TRAILING_SPACES are set, then a string + // containing only spaces is converted to the 'empty_string_value', too. + // + // junk_string_value is returned when + // a) ALLOW_TRAILING_JUNK is not set, and a junk character (a character not + // part of a double-literal) is found. + // b) ALLOW_TRAILING_JUNK is set, but the string does not start with a + // double literal. + // + // infinity_symbol and nan_symbol are strings that are used to detect + // inputs that represent infinity and NaN. They can be null, in which case + // they are ignored. + // The conversion routine first reads any possible signs. Then it compares the + // following character of the input-string with the first character of + // the infinity, and nan-symbol. If either matches, the function assumes, that + // a match has been found, and expects the following input characters to match + // the remaining characters of the special-value symbol. + // This means that the following restrictions apply to special-value symbols: + // - they must not start with signs ('+', or '-'), + // - they must not have the same first character. + // - they must not start with digits. + // + // If the separator character is not kNoSeparator, then that specific + // character is ignored when in between two valid digits of the significant. + // It is not allowed to appear in the exponent. + // It is not allowed to lead or trail the number. + // It is not allowed to appear twice next to each other. + // + // Examples: + // flags = ALLOW_HEX | ALLOW_TRAILING_JUNK, + // empty_string_value = 0.0, + // junk_string_value = NaN, + // infinity_symbol = "infinity", + // nan_symbol = "nan": + // StringToDouble("0x1234") -> 4660.0. + // StringToDouble("0x1234K") -> 4660.0. + // StringToDouble("") -> 0.0 // empty_string_value. + // StringToDouble(" ") -> NaN // junk_string_value. + // StringToDouble(" 1") -> NaN // junk_string_value. + // StringToDouble("0x") -> NaN // junk_string_value. + // StringToDouble("-123.45") -> -123.45. + // StringToDouble("--123.45") -> NaN // junk_string_value. + // StringToDouble("123e45") -> 123e45. + // StringToDouble("123E45") -> 123e45. + // StringToDouble("123e+45") -> 123e45. + // StringToDouble("123E-45") -> 123e-45. + // StringToDouble("123e") -> 123.0 // trailing junk ignored. + // StringToDouble("123e-") -> 123.0 // trailing junk ignored. + // StringToDouble("+NaN") -> NaN // NaN string literal. + // StringToDouble("-infinity") -> -inf. // infinity literal. + // StringToDouble("Infinity") -> NaN // junk_string_value. + // + // flags = ALLOW_OCTAL | ALLOW_LEADING_SPACES, + // empty_string_value = 0.0, + // junk_string_value = NaN, + // infinity_symbol = NULL, + // nan_symbol = NULL: + // StringToDouble("0x1234") -> NaN // junk_string_value. + // StringToDouble("01234") -> 668.0. + // StringToDouble("") -> 0.0 // empty_string_value. + // StringToDouble(" ") -> 0.0 // empty_string_value. + // StringToDouble(" 1") -> 1.0 + // StringToDouble("0x") -> NaN // junk_string_value. + // StringToDouble("0123e45") -> NaN // junk_string_value. + // StringToDouble("01239E45") -> 1239e45. + // StringToDouble("-infinity") -> NaN // junk_string_value. + // StringToDouble("NaN") -> NaN // junk_string_value. + // + // flags = NO_FLAGS, + // separator = ' ': + // StringToDouble("1 2 3 4") -> 1234.0 + // StringToDouble("1 2") -> NaN // junk_string_value + // StringToDouble("1 000 000.0") -> 1000000.0 + // StringToDouble("1.000 000") -> 1.0 + // StringToDouble("1.0e1 000") -> NaN // junk_string_value + StringToDoubleConverter(int flags, + double empty_string_value, + double junk_string_value, + const char* infinity_symbol, + const char* nan_symbol, + uc16 separator = kNoSeparator) + : flags_(flags), + empty_string_value_(empty_string_value), + junk_string_value_(junk_string_value), + infinity_symbol_(infinity_symbol), + nan_symbol_(nan_symbol), + separator_(separator) { + } + + // Performs the conversion. + // The output parameter 'processed_characters_count' is set to the number + // of characters that have been processed to read the number. + // Spaces than are processed with ALLOW_{LEADING|TRAILING}_SPACES are included + // in the 'processed_characters_count'. Trailing junk is never included. + double StringToDouble(const char* buffer, + int length, + int* processed_characters_count) const; + + // Same as StringToDouble above but for 16 bit characters. + double StringToDouble(const uc16* buffer, + int length, + int* processed_characters_count) const; + + // Same as StringToDouble but reads a float. + // Note that this is not equivalent to static_cast(StringToDouble(...)) + // due to potential double-rounding. + float StringToFloat(const char* buffer, + int length, + int* processed_characters_count) const; + + // Same as StringToFloat above but for 16 bit characters. + float StringToFloat(const uc16* buffer, + int length, + int* processed_characters_count) const; + + // Same as StringToDouble for T = double, and StringToFloat for T = float. + template + T StringTo(const char* buffer, + int length, + int* processed_characters_count) const; + + // Same as StringTo above but for 16 bit characters. + template + T StringTo(const uc16* buffer, + int length, + int* processed_characters_count) const; + + private: + const int flags_; + const double empty_string_value_; + const double junk_string_value_; + const char* const infinity_symbol_; + const char* const nan_symbol_; + const uc16 separator_; + + template + double StringToIeee(Iterator start_pointer, + int length, + bool read_as_double, + int* processed_characters_count) const; + + DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter); +}; + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_STRING_TO_DOUBLE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/strtod.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/strtod.h new file mode 100644 index 0000000000000000000000000000000000000000..77221fb9d5388f4fc869cdc40b345165c2a86872 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/strtod.h @@ -0,0 +1,64 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_STRTOD_H_ +#define DOUBLE_CONVERSION_STRTOD_H_ + +#include "utils.h" + +namespace double_conversion { + +// The buffer must only contain digits in the range [0-9]. It must not +// contain a dot or a sign. It must not start with '0', and must not be empty. +double Strtod(Vector buffer, int exponent); + +// The buffer must only contain digits in the range [0-9]. It must not +// contain a dot or a sign. It must not start with '0', and must not be empty. +float Strtof(Vector buffer, int exponent); + +// Same as Strtod, but assumes that 'trimmed' is already trimmed, as if run +// through TrimAndCut. That is, 'trimmed' must have no leading or trailing +// zeros, must not be a lone zero, and must not have 'too many' digits. +double StrtodTrimmed(Vector trimmed, int exponent); + +// Same as Strtof, but assumes that 'trimmed' is already trimmed, as if run +// through TrimAndCut. That is, 'trimmed' must have no leading or trailing +// zeros, must not be a lone zero, and must not have 'too many' digits. +float StrtofTrimmed(Vector trimmed, int exponent); + +inline Vector TrimTrailingZeros(Vector buffer) { + for (int i = buffer.length() - 1; i >= 0; --i) { + if (buffer[i] != '0') { + return buffer.SubVector(0, i + 1); + } + } + return Vector(buffer.start(), 0); +} + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_STRTOD_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..41078b6c2c4a2d78fa1e185def6ef539ad5be1fa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/double_conversion/double-conversion/utils.h @@ -0,0 +1,411 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef DOUBLE_CONVERSION_UTILS_H_ +#define DOUBLE_CONVERSION_UTILS_H_ + +// Use DOUBLE_CONVERSION_NON_PREFIXED_MACROS to get unprefixed macros as was +// the case in double-conversion releases prior to 3.1.6 + +#include +#include + +#include +#ifndef DOUBLE_CONVERSION_ASSERT +#define DOUBLE_CONVERSION_ASSERT(condition) \ + assert(condition) +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(ASSERT) +#define ASSERT DOUBLE_CONVERSION_ASSERT +#endif + +#ifndef DOUBLE_CONVERSION_UNIMPLEMENTED +#define DOUBLE_CONVERSION_UNIMPLEMENTED() (abort()) +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(UNIMPLEMENTED) +#define UNIMPLEMENTED DOUBLE_CONVERSION_UNIMPLEMENTED +#endif + +#ifndef DOUBLE_CONVERSION_NO_RETURN +#ifdef _MSC_VER +#define DOUBLE_CONVERSION_NO_RETURN __declspec(noreturn) +#else +#define DOUBLE_CONVERSION_NO_RETURN __attribute__((noreturn)) +#endif +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(NO_RETURN) +#define NO_RETURN DOUBLE_CONVERSION_NO_RETURN +#endif + +#ifndef DOUBLE_CONVERSION_UNREACHABLE +#ifdef _MSC_VER +void DOUBLE_CONVERSION_NO_RETURN abort_noreturn(); +inline void abort_noreturn() { abort(); } +#define DOUBLE_CONVERSION_UNREACHABLE() (abort_noreturn()) +#else +#define DOUBLE_CONVERSION_UNREACHABLE() (abort()) +#endif +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(UNREACHABLE) +#define UNREACHABLE DOUBLE_CONVERSION_UNREACHABLE +#endif + +// Not all compilers support __has_attribute and combining a check for both +// ifdef and __has_attribute on the same preprocessor line isn't portable. +#ifdef __has_attribute +# define DOUBLE_CONVERSION_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define DOUBLE_CONVERSION_HAS_ATTRIBUTE(x) 0 +#endif + +#ifndef DOUBLE_CONVERSION_UNUSED +#if DOUBLE_CONVERSION_HAS_ATTRIBUTE(unused) +#define DOUBLE_CONVERSION_UNUSED __attribute__((unused)) +#else +#define DOUBLE_CONVERSION_UNUSED +#endif +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(UNUSED) +#define UNUSED DOUBLE_CONVERSION_UNUSED +#endif + +#if DOUBLE_CONVERSION_HAS_ATTRIBUTE(uninitialized) +#define DOUBLE_CONVERSION_STACK_UNINITIALIZED __attribute__((uninitialized)) +#else +#define DOUBLE_CONVERSION_STACK_UNINITIALIZED +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(STACK_UNINITIALIZED) +#define STACK_UNINITIALIZED DOUBLE_CONVERSION_STACK_UNINITIALIZED +#endif + +// Double operations detection based on target architecture. +// Linux uses a 80bit wide floating point stack on x86. This induces double +// rounding, which in turn leads to wrong results. +// An easy way to test if the floating-point operations are correct is to +// evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then +// the result is equal to 89255e-22. +// The best way to test this, is to create a division-function and to compare +// the output of the division with the expected result. (Inlining must be +// disabled.) +// On Linux,x86 89255e-22 != Div_double(89255.0/1e22) +// +// For example: +/* +// -- in div.c +double Div_double(double x, double y) { return x / y; } + +// -- in main.c +double Div_double(double x, double y); // Forward declaration. + +int main(int argc, char** argv) { + return Div_double(89255.0, 1e22) == 89255e-22; +} +*/ +// Run as follows ./main || echo "correct" +// +// If it prints "correct" then the architecture should be here, in the "correct" section. +#if defined(_M_X64) || defined(__x86_64__) || \ + defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \ + defined(__hppa__) || defined(__ia64__) || \ + defined(__mips__) || \ + defined(__loongarch__) || \ + defined(__nios2__) || defined(__ghs) || \ + defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \ + defined(_POWER) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \ + defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ + defined(__SH4__) || defined(__alpha__) || \ + defined(_MIPS_ARCH_MIPS32R2) || defined(__ARMEB__) ||\ + defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \ + defined(__riscv) || defined(__e2k__) || \ + defined(__or1k__) || defined(__arc__) || defined(__ARC64__) || \ + defined(__microblaze__) || defined(__XTENSA__) || \ + defined(__EMSCRIPTEN__) || defined(__wasm32__) +#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 +#elif defined(__mc68000__) || \ + defined(__pnacl__) || defined(__native_client__) +#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS +#elif defined(_M_IX86) || defined(__i386__) || defined(__i386) +#if defined(_WIN32) +// Windows uses a 64bit wide floating point stack. +#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 +#else +#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS +#endif // _WIN32 +#else +#error Target architecture was not detected as supported by Double-Conversion. +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(CORRECT_DOUBLE_OPERATIONS) +#define CORRECT_DOUBLE_OPERATIONS DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS +#endif + +#if defined(_WIN32) && !defined(__MINGW32__) + +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; // NOLINT +typedef unsigned short uint16_t; // NOLINT +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +// intptr_t and friends are defined in crtdefs.h through stdio.h. + +#else + +#include + +#endif + +typedef uint16_t uc16; + +// The following macro works on both 32 and 64-bit platforms. +// Usage: instead of writing 0x1234567890123456 +// write DOUBLE_CONVERSION_UINT64_2PART_C(0x12345678,90123456); +#define DOUBLE_CONVERSION_UINT64_2PART_C(a, b) (((static_cast(a) << 32) + 0x##b##u)) +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(UINT64_2PART_C) +#define UINT64_2PART_C DOUBLE_CONVERSION_UINT64_2PART_C +#endif + +// The expression DOUBLE_CONVERSION_ARRAY_SIZE(a) is a compile-time constant of type +// size_t which represents the number of elements of the given +// array. You should only use DOUBLE_CONVERSION_ARRAY_SIZE on statically allocated +// arrays. +#ifndef DOUBLE_CONVERSION_ARRAY_SIZE +#define DOUBLE_CONVERSION_ARRAY_SIZE(a) \ + ((sizeof(a) / sizeof(*(a))) / \ + static_cast(!(sizeof(a) % sizeof(*(a))))) +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(ARRAY_SIZE) +#define ARRAY_SIZE DOUBLE_CONVERSION_ARRAY_SIZE +#endif + +// A macro to disallow the evil copy constructor and operator= functions +// This should be used in the private: declarations for a class +#ifndef DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN +#define DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&); \ + void operator=(const TypeName&) +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(DC_DISALLOW_COPY_AND_ASSIGN) +#define DC_DISALLOW_COPY_AND_ASSIGN DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN +#endif + +// A macro to disallow all the implicit constructors, namely the +// default constructor, copy constructor and operator= functions. +// +// This should be used in the private: declarations for a class +// that wants to prevent anyone from instantiating it. This is +// especially useful for classes containing only static methods. +#ifndef DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS +#define DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ + TypeName(); \ + DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(TypeName) +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(DC_DISALLOW_IMPLICIT_CONSTRUCTORS) +#define DC_DISALLOW_IMPLICIT_CONSTRUCTORS DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS +#endif + +namespace double_conversion { + +inline int StrLength(const char* string) { + size_t length = strlen(string); + DOUBLE_CONVERSION_ASSERT(length == static_cast(static_cast(length))); + return static_cast(length); +} + +// This is a simplified version of V8's Vector class. +template +class Vector { + public: + Vector() : start_(NULL), length_(0) {} + Vector(T* data, int len) : start_(data), length_(len) { + DOUBLE_CONVERSION_ASSERT(len == 0 || (len > 0 && data != NULL)); + } + + // Returns a vector using the same backing storage as this one, + // spanning from and including 'from', to but not including 'to'. + Vector SubVector(int from, int to) { + DOUBLE_CONVERSION_ASSERT(to <= length_); + DOUBLE_CONVERSION_ASSERT(from < to); + DOUBLE_CONVERSION_ASSERT(0 <= from); + return Vector(start() + from, to - from); + } + + // Returns the length of the vector. + int length() const { return length_; } + + // Returns whether or not the vector is empty. + bool is_empty() const { return length_ == 0; } + + // Returns the pointer to the start of the data in the vector. + T* start() const { return start_; } + + // Access individual vector elements - checks bounds in debug mode. + T& operator[](int index) const { + DOUBLE_CONVERSION_ASSERT(0 <= index && index < length_); + return start_[index]; + } + + T& first() { return start_[0]; } + + T& last() { return start_[length_ - 1]; } + + void pop_back() { + DOUBLE_CONVERSION_ASSERT(!is_empty()); + --length_; + } + + private: + T* start_; + int length_; +}; + + +// Helper class for building result strings in a character buffer. The +// purpose of the class is to use safe operations that checks the +// buffer bounds on all operations in debug mode. +class StringBuilder { + public: + StringBuilder(char* buffer, int buffer_size) + : buffer_(buffer, buffer_size), position_(0) { } + + ~StringBuilder() { if (!is_finalized()) Finalize(); } + + int size() const { return buffer_.length(); } + + // Get the current position in the builder. + int position() const { + DOUBLE_CONVERSION_ASSERT(!is_finalized()); + return position_; + } + + // Reset the position. + void Reset() { position_ = 0; } + + // Add a single character to the builder. It is not allowed to add + // 0-characters; use the Finalize() method to terminate the string + // instead. + void AddCharacter(char c) { + DOUBLE_CONVERSION_ASSERT(c != '\0'); + DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ < buffer_.length()); + buffer_[position_++] = c; + } + + // Add an entire string to the builder. Uses strlen() internally to + // compute the length of the input string. + void AddString(const char* s) { + AddSubstring(s, StrLength(s)); + } + + // Add the first 'n' characters of the given string 's' to the + // builder. The input string must have enough characters. + void AddSubstring(const char* s, int n) { + DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ + n < buffer_.length()); + DOUBLE_CONVERSION_ASSERT(static_cast(n) <= strlen(s)); + memmove(&buffer_[position_], s, n); + position_ += n; + } + + + // Add character padding to the builder. If count is non-positive, + // nothing is added to the builder. + void AddPadding(char c, int count) { + for (int i = 0; i < count; i++) { + AddCharacter(c); + } + } + + // Finalize the string by 0-terminating it and returning the buffer. + char* Finalize() { + DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ < buffer_.length()); + buffer_[position_] = '\0'; + // Make sure nobody managed to add a 0-character to the + // buffer while building the string. + DOUBLE_CONVERSION_ASSERT(strlen(buffer_.start()) == static_cast(position_)); + position_ = -1; + DOUBLE_CONVERSION_ASSERT(is_finalized()); + return buffer_.start(); + } + + private: + Vector buffer_; + int position_; + + bool is_finalized() const { return position_ < 0; } + + DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); +}; + +// The type-based aliasing rule allows the compiler to assume that pointers of +// different types (for some definition of different) never alias each other. +// Thus the following code does not work: +// +// float f = foo(); +// int fbits = *(int*)(&f); +// +// The compiler 'knows' that the int pointer can't refer to f since the types +// don't match, so the compiler may cache f in a register, leaving random data +// in fbits. Using C++ style casts makes no difference, however a pointer to +// char data is assumed to alias any other pointer. This is the 'memcpy +// exception'. +// +// Bit_cast uses the memcpy exception to move the bits from a variable of one +// type of a variable of another type. Of course the end result is likely to +// be implementation dependent. Most compilers (gcc-4.2 and MSVC 2005) +// will completely optimize BitCast away. +// +// There is an additional use for BitCast. +// Recent gccs will warn when they see casts that may result in breakage due to +// the type-based aliasing rule. If you have checked that there is no breakage +// you can use BitCast to cast one pointer type to another. This confuses gcc +// enough that it can no longer see that you have cast one pointer type to +// another thus avoiding the warning. +template +Dest BitCast(const Source& source) { + // Compile time assertion: sizeof(Dest) == sizeof(Source) + // A compile error here means your Dest and Source have different sizes. +#if __cplusplus >= 201103L + static_assert(sizeof(Dest) == sizeof(Source), + "source and destination size mismatch"); +#else + DOUBLE_CONVERSION_UNUSED + typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1]; +#endif + + Dest dest; + memmove(&dest, &source, sizeof(dest)); + return dest; +} + +template +Dest BitCast(Source* source) { + return BitCast(reinterpret_cast(source)); +} + +} // namespace double_conversion + +#endif // DOUBLE_CONVERSION_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/LICENSE b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..b53114e98715c5d3deb00ff8f4cdb5a512c71afb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/LICENSE @@ -0,0 +1,278 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/google/threading.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/google/threading.h new file mode 100644 index 0000000000000000000000000000000000000000..b9953a1256f679cc430019087373fb539e9e63a5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/google/threading.h @@ -0,0 +1,60 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef THIRD_PARTY_DUCC_GOOGLE_THREADING_H_ +#define THIRD_PARTY_DUCC_GOOGLE_THREADING_H_ + +#include "ducc/src/ducc0/infra/threading.h" +#include "third_party/eigen3/unsupported/Eigen/CXX11/ThreadPool" + +namespace ducc0 { +namespace google { + +using std::size_t; + +// Pseudo thread-pool for single-threaded execution. +class NoThreadPool : public ducc0::detail_threading::thread_pool { + public: + size_t nthreads() const override { return 1; } + size_t adjust_nthreads(size_t nthreads_in) const override { return 1; }; + void submit(std::function work) override { work(); } +}; + +// Thread-pool wrapper around Eigen's ThreadPool. +class EigenThreadPool : public ducc0::detail_threading::thread_pool { + public: + EigenThreadPool(Eigen::ThreadPoolInterface& pool) : pool_{&pool} {} + size_t nthreads() const override { return pool_->NumThreads(); } + size_t adjust_nthreads(size_t nthreads_in) const override { + // If called by a thread in the pool, return 1 + if (pool_->CurrentThreadId() >= 0) { + return 1; + } else if (nthreads_in == 0) { + return pool_->NumThreads(); + } + return std::min(nthreads_in, pool_->NumThreads()); + }; + void submit(std::function work) override { + pool_->Schedule(std::move(work)); + } + + private: + Eigen::ThreadPoolInterface* pool_; +}; + +} // namespace google +} // namespace ducc0 + +#endif // THIRD_PARTY_DUCC_GOOGLE_THREADING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fft.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fft.h new file mode 100644 index 0000000000000000000000000000000000000000..9271cde2c2eef056de3639d640dbc0b757a8c609 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fft.h @@ -0,0 +1,982 @@ +/* +This file is part of the ducc FFT library + +Copyright (C) 2010-2023 Max-Planck-Society +Copyright (C) 2019 Peter Bell + +Authors: Martin Reinecke, Peter Bell +*/ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_FFT_H +#define DUCC0_FFT_H + +#include +#include +#include +#include +#include +#include "ducc0/infra/error_handling.h" +#include "ducc0/infra/aligned_array.h" +#include "ducc0/infra/mav.h" +#include "ducc0/math/cmplx.h" +#include "ducc0/math/unity_roots.h" + +namespace ducc0 { + +namespace detail_fft { + +using namespace std; + +template using Troots = shared_ptr>>; +template inline auto tidx() { return type_index(typeid(T)); } + +template inline void PM(T &a, T &b, T c, T d) + { a=c+d; b=c-d; } +template inline void PMINPLACE(T &a, T &b) + { T t = a; a+=b; b=t-b; } +template inline void MPINPLACE(T &a, T &b) + { T t = a; a-=b; b=t+b; } +template void special_mul (const Cmplx &v1, const Cmplx &v2, Cmplx &res) + { + res = fwd ? Cmplx(v1.r*v2.r+v1.i*v2.i, v1.i*v2.r-v1.r*v2.i) + : Cmplx(v1.r*v2.r-v1.i*v2.i, v1.r*v2.i+v1.i*v2.r); + } + +struct util1d // hack to avoid duplicate symbols + { + /* returns the smallest composite of 2, 3, 5, 7 and 11 which is >= n */ + DUCC0_NOINLINE static size_t good_size_cmplx(size_t n) + { + if (n<=12) return n; + + size_t bestfac=2*n; + for (size_t f11=1; f11n) + { + if (x>=1; + } + else + return n; + } + } + return bestfac; + } + + /* returns the smallest composite of 2, 3, 5 which is >= n */ + DUCC0_NOINLINE static size_t good_size_real(size_t n) + { + if (n<=6) return n; + + size_t bestfac=2*n; + for (size_t f5=1; f5n) + { + if (x>=1; + } + else + return n; + } + } + return bestfac; + } + + DUCC0_NOINLINE static vector prime_factors(size_t N) + { + MR_assert(N>0, "need a positive number"); + vector factors; + while ((N&1)==0) + { N>>=1; factors.push_back(2); } + for (size_t divisor=3; divisor*divisor<=N; divisor+=2) + while ((N%divisor)==0) + { + factors.push_back(divisor); + N/=divisor; + } + if (N>1) factors.push_back(N); + return factors; + } + }; + +// T: "type", f/c: "float/complex", s/v: "scalar/vector" +template class cfftpass + { + public: + virtual ~cfftpass(){} + using Tcs = Cmplx; + + // number of Tcd values required as scratch space during "exec" + // will be provided in "buf" + virtual size_t bufsize() const = 0; + virtual bool needs_copy() const = 0; + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, + bool fwd, size_t nthreads=1) const = 0; + + static vector factorize(size_t N) + { + MR_assert(N>0, "need a positive number"); + vector factors; + factors.reserve(15); + while ((N&7)==0) + { factors.push_back(8); N>>=3; } + while ((N&3)==0) + { factors.push_back(4); N>>=2; } + if ((N&1)==0) + { + N>>=1; + // factor 2 should be at the front of the factor list + factors.push_back(2); + swap(factors[0], factors.back()); + } + for (size_t divisor=3; divisor*divisor<=N; divisor+=2) + while ((N%divisor)==0) + { + factors.push_back(divisor); + N/=divisor; + } + if (N>1) factors.push_back(N); + return factors; + } + + static shared_ptr make_pass(size_t l1, size_t ido, size_t ip, + const Troots &roots, bool vectorize=false); + static shared_ptr make_pass(size_t ip, bool vectorize=false) + { + return make_pass(1,1,ip,make_shared>>(ip), + vectorize); + } + }; + +template class rfftpass + { + public: + virtual ~rfftpass(){} + + // number of Tfd values required as scratch space during "exec" + // will be provided in "buf" + virtual size_t bufsize() const = 0; + virtual bool needs_copy() const = 0; + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, + bool fwd, size_t nthreads=1) const = 0; + + static vector factorize(size_t N) + { + MR_assert(N>0, "need a positive number"); + vector factors; + while ((N&3)==0) + { factors.push_back(4); N>>=2; } + if ((N&1)==0) + { + N>>=1; + // factor 2 should be at the front of the factor list + factors.push_back(2); + swap(factors[0], factors.back()); + } + for (size_t divisor=3; divisor*divisor<=N; divisor+=2) + while ((N%divisor)==0) + { + factors.push_back(divisor); + N/=divisor; + } + if (N>1) factors.push_back(N); + return factors; + } + + static shared_ptr make_pass(size_t l1, size_t ido, size_t ip, + const Troots &roots, bool vectorize=false); + static shared_ptr make_pass(size_t ip, bool vectorize=false) + { + return make_pass(1,1,ip,make_shared>>(ip), + vectorize); + } + }; + +template using Tcpass = shared_ptr>; +template using Trpass = shared_ptr>; + +template class pocketfft_c + { + private: + size_t N; + size_t critbuf; + Tcpass plan; + + public: + pocketfft_c(size_t n, bool vectorize=false) + : N(n), critbuf(((N&1023)==0) ? 16 : 0), + plan(cfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N*plan->needs_copy()+2*critbuf+plan->bufsize(); } + template DUCC0_NOINLINE Cmplx *exec(Cmplx *in, Cmplx *buf, + Tfs fct, bool fwd, size_t nthreads=1) const + { + static const auto tic = tidx *>(); + auto res = static_cast *>(plan->exec(tic, + in, buf+critbuf+plan->bufsize(), buf+critbuf, fwd, nthreads)); + if (fct!=Tfs(1)) + for (size_t i=0; i DUCC0_NOINLINE void exec_copyback(Cmplx *in, Cmplx *buf, + Tfs fct, bool fwd, size_t nthreads=1) const + { + static const auto tic = tidx *>(); + auto res = static_cast *>(plan->exec(tic, + in, buf, buf+N*plan->needs_copy(), fwd, nthreads)); + if (res==in) + { + if (fct!=Tfs(1)) + for (size_t i=0; i DUCC0_NOINLINE void exec(Cmplx *in, Tfs fct, bool fwd, size_t nthreads=1) const + { + aligned_array> buf(N*plan->needs_copy()+plan->bufsize()); + exec_copyback(in, buf.data(), fct, fwd, nthreads); + } + }; + +template class pocketfft_r + { + private: + size_t N; + Trpass plan; + + public: + pocketfft_r(size_t n, bool vectorize=false) + : N(n), plan(rfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N*plan->needs_copy()+plan->bufsize(); } + template DUCC0_NOINLINE Tfd *exec(Tfd *in, Tfd *buf, Tfs fct, + bool fwd, size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = static_cast(plan->exec(tifd, in, buf, + buf+N*plan->needs_copy(), fwd, nthreads)); + if (fct!=Tfs(1)) + for (size_t i=0; i DUCC0_NOINLINE void exec_copyback(Tfd *in, Tfd *buf, + Tfs fct, bool fwd, size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = static_cast(plan->exec(tifd, in, buf, + buf+N*plan->needs_copy(), fwd, nthreads)); + if (res==in) + { + if (fct!=Tfs(1)) + for (size_t i=0; i DUCC0_NOINLINE void exec(Tfd *in, Tfs fct, bool fwd, + size_t nthreads=1) const + { + aligned_array buf(N*plan->needs_copy()+plan->bufsize()); + exec_copyback(in, buf.data(), fct, fwd, nthreads); + } + }; + +template class pocketfft_hartley + { + private: + size_t N; + Trpass plan; + + public: + pocketfft_hartley(size_t n, bool vectorize=false) + : N(n), plan(rfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N+plan->bufsize(); } + template DUCC0_NOINLINE Tfd *exec(Tfd *in, Tfd *buf, Tfs fct, + size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = static_cast(plan->exec(tifd, + in, buf, buf+N, true, nthreads)); + auto res2 = (res==buf) ? in : buf; + res2[0] = fct*res[0]; + size_t i=1, i1=1, i2=N-1; + for (i=1; i DUCC0_NOINLINE void exec_copyback(Tfd *in, Tfd *buf, + Tfs fct, size_t nthreads=1) const + { + auto res = exec(in, buf, fct, nthreads); + if (res!=in) + copy_n(res, N, in); + } + template DUCC0_NOINLINE void exec(Tfd *in, Tfs fct, + size_t nthreads=1) const + { + aligned_array buf(N+plan->bufsize()); + exec_copyback(in, buf.data(), fct, nthreads); + } + }; + +template class pocketfft_fht + { + private: + size_t N; + Trpass plan; + + public: + pocketfft_fht(size_t n, bool vectorize=false) + : N(n), plan(rfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N+plan->bufsize(); } + template DUCC0_NOINLINE Tfd *exec(Tfd *in, Tfd *buf, Tfs fct, + size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = static_cast(plan->exec(tifd, + in, buf, buf+N, true, nthreads)); + auto res2 = (res==buf) ? in : buf; + res2[0] = fct*res[0]; + size_t i=1, i1=1, i2=N-1; + for (i=1; i DUCC0_NOINLINE void exec_copyback(Tfd *in, Tfd *buf, + Tfs fct, size_t nthreads=1) const + { + auto res = exec(in, buf, fct, nthreads); + if (res!=in) + copy_n(res, N, in); + } + template DUCC0_NOINLINE void exec(Tfd *in, Tfs fct, + size_t nthreads=1) const + { + aligned_array buf(N+plan->bufsize()); + exec_copyback(in, buf.data(), fct, nthreads); + } + }; + +// R2R transforms using FFTW's halfcomplex format +template class pocketfft_fftw + { + private: + size_t N; + Trpass plan; + + public: + pocketfft_fftw(size_t n, bool vectorize=false) + : N(n), plan(rfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N+plan->bufsize(); } + template DUCC0_NOINLINE Tfd *exec(Tfd *in, Tfd *buf, Tfs fct, + bool fwd, size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = in; + auto res2 = buf; + if (!fwd) // go to FFTPACK halfcomplex order + { + res2[0] = fct*res[0]; + size_t i=1, i1=1, i2=N-1; + for (i=1; i(plan->exec(tifd, + res, res2, buf+N, fwd, nthreads)); + if (!fwd) return res; + + // go to FFTW halfcomplex order + res2 = (res==buf) ? in : buf; + res2[0] = fct*res[0]; + size_t i=1, i1=1, i2=N-1; + for (i=1; i DUCC0_NOINLINE void exec_copyback(Tfd *in, Tfd *buf, + Tfs fct, bool fwd, size_t nthreads=1) const + { + auto res = exec(in, buf, fct, fwd, nthreads); + if (res!=in) + copy_n(res, N, in); + } + template DUCC0_NOINLINE void exec(Tfd *in, Tfs fct, bool fwd, + size_t nthreads=1) const + { + aligned_array buf(N+plan->bufsize()); + exec_copyback(in, buf.data(), fct, fwd, nthreads); + } + }; + +// +// sine/cosine transforms +// + +template class T_dct1 + { + private: + pocketfft_r fftplan; + + public: + DUCC0_NOINLINE T_dct1(size_t length, bool /*vectorize*/=false) + : fftplan(2*(length-1)) {} + + template DUCC0_NOINLINE T *exec(T c[], T buf[], T0 fct, bool ortho, + int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L); + size_t N=fftplan.length(), n=N/2+1; + if (ortho) + { c[0]*=sqrt2; c[n-1]*=sqrt2; } + auto tmp=&buf[0]; + tmp[0] = c[0]; + for (size_t i=1; i DUCC0_NOINLINE void exec_copyback(T c[], T buf[], T0 fct, bool ortho, + int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + exec(c, buf, fct, ortho, 1, true, nthreads); + } + template DUCC0_NOINLINE void exec(T c[], T0 fct, bool ortho, + int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + aligned_array buf(bufsize()); + exec_copyback(c, buf.data(), fct, ortho, 1, true, nthreads); + } + + size_t length() const { return fftplan.length()/2+1; } + size_t bufsize() const { return fftplan.length()+fftplan.bufsize(); } + }; + +template class T_dst1 + { + private: + pocketfft_r fftplan; + + public: + DUCC0_NOINLINE T_dst1(size_t length, bool /*vectorize*/=false) + : fftplan(2*(length+1)) {} + + template DUCC0_NOINLINE T *exec(T c[], T buf[], T0 fct, + bool /*ortho*/, int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + size_t N=fftplan.length(), n=N/2-1; + auto tmp = &buf[0]; + tmp[0] = tmp[n+1] = c[0]*0; + for (size_t i=0; i DUCC0_NOINLINE void exec_copyback(T c[], T buf[], T0 fct, + bool /*ortho*/, int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + exec(c, buf, fct, true, 1, false, nthreads); + } + template DUCC0_NOINLINE void exec(T c[], T0 fct, + bool /*ortho*/, int /*type*/, bool /*cosine*/, size_t nthreads) const + { + aligned_array buf(bufsize()); + exec_copyback(c, buf.data(), fct, true, 1, false, nthreads); + } + + size_t length() const { return fftplan.length()/2-1; } + size_t bufsize() const { return fftplan.length()+fftplan.bufsize(); } + }; + +template class T_dcst23 + { + private: + pocketfft_r fftplan; + std::vector twiddle; + + public: + DUCC0_NOINLINE T_dcst23(size_t length, bool /*vectorize*/=false) + : fftplan(length), twiddle(length) + { + UnityRoots> tw(4*length); + for (size_t i=0; i DUCC0_NOINLINE T *exec(T c[], T buf[], T0 fct, bool ortho, + int type, bool cosine, size_t nthreads=1) const + { + constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L); + size_t N=length(); + size_t NS2 = (N+1)/2; + if (type==2) + { + c[0] *= 2; + if ((N&1)==0) c[N-1]*=2; + if (cosine) + for (size_t k=1; k DUCC0_NOINLINE void exec_copyback(T c[], T buf[], T0 fct, + bool ortho, int type, bool cosine, size_t nthreads=1) const + { + exec(c, buf, fct, ortho, type, cosine, nthreads); + } + template DUCC0_NOINLINE void exec(T c[], T0 fct, bool ortho, + int type, bool cosine, size_t nthreads=1) const + { + aligned_array buf(bufsize()); + exec(c, &buf[0], fct, ortho, type, cosine, nthreads); + } + + size_t length() const { return fftplan.length(); } + size_t bufsize() const { return fftplan.bufsize(); } + }; + +template class T_dcst4 + { + private: + size_t N; + std::unique_ptr> fft; + std::unique_ptr> rfft; + aligned_array> C2; + size_t bufsz; + + public: + DUCC0_NOINLINE T_dcst4(size_t length, bool /*vectorize*/=false) + : N(length), + fft((N&1) ? nullptr : make_unique>(N/2)), + rfft((N&1)? make_unique>(N) : nullptr), + C2((N&1) ? 0 : N/2), + bufsz((N&1) ? (N+rfft->bufsize()) : (N+2*fft->bufsize())) + { + if ((N&1)==0) + { + UnityRoots> tw(16*N); + for (size_t i=0; i DUCC0_NOINLINE T *exec(T c[], T buf[], T0 fct, + bool /*ortho*/, int /*type*/, bool cosine, size_t nthreads) const + { + size_t n2 = N/2; + if (!cosine) + for (size_t k=0, kc=N-1; kexec(y, y+N, fct, true, nthreads); + { + auto SGN = [](size_t i) + { + constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L); + return (i&2) ? -sqrt2 : sqrt2; + }; + c[n2] = res[0]*SGN(n2+1); + size_t i=0, i1=1, k=1; + for (; k *>(buf); + for(size_t i=0; iexec(y2, y2+N/2, fct, true, nthreads); + for(size_t i=0, ic=n2-1; i DUCC0_NOINLINE void exec_copyback(T c[], T buf[], T0 fct, + bool /*ortho*/, int /*type*/, bool cosine, size_t nthreads=1) const + { + exec(c, buf, fct, true, 4, cosine, nthreads); + } + template DUCC0_NOINLINE void exec(T c[], T0 fct, + bool /*ortho*/, int /*type*/, bool cosine, size_t nthreads=1) const + { + aligned_array buf(bufsize()); + exec(c, &buf[0], fct, true, 4, cosine, nthreads); + } + + size_t length() const { return N; } + size_t bufsize() const { return bufsz; } + }; + +using shape_t=fmav_info::shape_t; +using stride_t=fmav_info::stride_t; + +constexpr bool FORWARD = true, + BACKWARD = false; + +/// Complex-to-complex Fast Fourier Transform +/** This executes a Fast Fourier Transform on \a in and stores the result in + * \a out. + * + * \a in and \a out must have identical shapes; they may point to the same + * memory; in this case their strides must also be identical. + * + * \a axes specifies the axes over which the transform is carried out. + * + * If \a forward is true, a minus sign will be used in the exponent. + * + * No normalization factors will be applied by default; if multiplication by + * a constant is desired, it can be supplied in \a fct. + * + * If the underlying array has more than one dimension, the computation will + * be distributed over \a nthreads threads. + */ +template DUCC0_NOINLINE void c2c(const cfmav> &in, + vfmav> &out, const shape_t &axes, bool forward, + T fct, size_t nthreads=1); + +/// Fast Discrete Cosine Transform +/** This executes a DCT on \a in and stores the result in \a out. + * + * \a in and \a out must have identical shapes; they may point to the same + * memory; in this case their strides must also be identical. + * + * \a axes specifies the axes over which the transform is carried out. + * + * If \a forward is true, a DCT is computed, otherwise an inverse DCT. + * + * \a type specifies the desired type (1-4) of the transform. + * + * No normalization factors will be applied by default; if multiplication by + * a constant is desired, it can be supplied in \a fct. + * + * If \a ortho is true, the first and last array entries are corrected (if + * necessary) to allow an orthonormalized transform. + * + * If the underlying array has more than one dimension, the computation will + * be distributed over \a nthreads threads. + */ +template DUCC0_NOINLINE void dct(const cfmav &in, vfmav &out, + const shape_t &axes, int type, T fct, bool ortho, size_t nthreads=1); + +/// Fast Discrete Sine Transform +/** This executes a DST on \a in and stores the result in \a out. + * + * \a in and \a out must have identical shapes; they may point to the same + * memory; in this case their strides must also be identical. + * + * \a axes specifies the axes over which the transform is carried out. + * + * If \a forward is true, a DST is computed, otherwise an inverse DST. + * + * \a type specifies the desired type (1-4) of the transform. + * + * No normalization factors will be applied by default; if multiplication by + * a constant is desired, it can be supplied in \a fct. + * + * If \a ortho is true, the first and last array entries are corrected (if + * necessary) to allow an orthonormalized transform. + * + * If the underlying array has more than one dimension, the computation will + * be distributed over \a nthreads threads. + */ +template DUCC0_NOINLINE void dst(const cfmav &in, vfmav &out, + const shape_t &axes, int type, T fct, bool ortho, size_t nthreads=1); + +template DUCC0_NOINLINE void r2c(const cfmav &in, + vfmav> &out, size_t axis, bool forward, T fct, + size_t nthreads=1); + +template DUCC0_NOINLINE void r2c(const cfmav &in, + vfmav> &out, const shape_t &axes, + bool forward, T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void c2r(const cfmav> &in, + vfmav &out, size_t axis, bool forward, T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void c2r(const cfmav> &in, + vfmav &out, const shape_t &axes, bool forward, T fct, + size_t nthreads=1); + +template DUCC0_NOINLINE void c2r_mut(vfmav> &in, + vfmav &out, const shape_t &axes, bool forward, T fct, + size_t nthreads=1); + +template DUCC0_NOINLINE void r2r_fftpack(const cfmav &in, + vfmav &out, const shape_t &axes, bool real2hermitian, bool forward, + T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void r2r_fftw(const cfmav &in, + vfmav &out, const shape_t &axes, bool forward, + T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void r2r_separable_hartley(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void r2r_separable_fht(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads=1); + +template void r2r_genuine_hartley(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads=1); + +template void r2r_genuine_fht(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads=1); + +/// Convolution and zero-padding/truncation along one axis +/** This performs a circular convolution with the kernel \a kernel on axis + * \a axis of \a in, applies the necessary zero-padding/truncation on this + * axis to give it the length \a out.shape(axis),and returns the result + * in \a out. + * + * The main purpose of this routine is efficiency: the combination of the above + * operations can be carried out more quickly than running the individual + * operations in succession. + * + * \a in and \a out must have identical shapes, with the possible exception + * of the axis \a axis; they may point to the same memory; in this case all + * of their strides must be identical. + * + * \a axis specifies the axis over which the operation is carried out. + * + * \a kernel must have the same length as \a in.shape(axis); it must be + * provided in the same domain as \a in (i.e. not pre-transformed). + * + * If \a in has more than one dimension, the computation will + * be distributed over \a nthreads threads. + */ +template DUCC0_NOINLINE void convolve_axis(const cfmav &in, + vfmav &out, size_t axis, const cmav &kernel, size_t nthreads=1); + +template DUCC0_NOINLINE void convolve_axis(const cfmav> &in, + vfmav> &out, size_t axis, const cmav,1> &kernel, + size_t nthreads=1); +} + +using detail_fft::pocketfft_c; +using detail_fft::pocketfft_r; +using detail_fft::pocketfft_hartley; +using detail_fft::pocketfft_fht; +using detail_fft::pocketfft_fftw; + +using detail_fft::FORWARD; +using detail_fft::BACKWARD; +using detail_fft::c2c; +using detail_fft::c2r; +using detail_fft::c2r_mut; +using detail_fft::r2c; +using detail_fft::r2r_fftpack; +using detail_fft::r2r_fftw; +using detail_fft::r2r_separable_hartley; +using detail_fft::r2r_genuine_hartley; +using detail_fft::r2r_separable_fht; +using detail_fft::r2r_genuine_fht; +using detail_fft::dct; +using detail_fft::dst; +using detail_fft::convolve_axis; + +inline size_t good_size_complex(size_t n) + { return detail_fft::util1d::good_size_cmplx(n); } +inline size_t good_size_real(size_t n) + { return detail_fft::util1d::good_size_real(n); } + +} + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fft1d_impl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fft1d_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..f2bf69361a1540942f0a11fc1528a191d8d7ba9d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fft1d_impl.h @@ -0,0 +1,2990 @@ +/* +This file is part of the ducc FFT library + +Copyright (C) 2010-2023 Max-Planck-Society +Copyright (C) 2019 Peter Bell + +For the odd-sized DCT-IV transforms: + Copyright (C) 2003, 2007-14 Matteo Frigo + Copyright (C) 2003, 2007-14 Massachusetts Institute of Technology + +Authors: Martin Reinecke, Peter Bell +*/ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_FFT1D_IMPL_H +#define DUCC0_FFT1D_IMPL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ducc0/infra/useful_macros.h" +#include "ducc0/math/cmplx.h" +#include "ducc0/infra/error_handling.h" +#include "ducc0/infra/aligned_array.h" +#include "ducc0/infra/simd.h" +#include "ducc0/infra/threading.h" +#include "ducc0/math/unity_roots.h" +#include "ducc0/fft/fft.h" + +namespace ducc0 { + +namespace detail_fft { + +using namespace std; + +// the next line is necessary to address some sloppy name choices in hipSYCL +using std::min, std::max; + +template constexpr inline size_t fft1d_simdlen + = min(8, native_simd::size()); +template<> constexpr inline size_t fft1d_simdlen + = min(4, native_simd::size()); +template<> constexpr inline size_t fft1d_simdlen + = min(8, native_simd::size()); +template using fft1d_simd = typename simd_select>::type; +template constexpr inline bool fft1d_simd_exists = (fft1d_simdlen > 1); + +// Always use std:: for functions +template T cos(T) = delete; +template T sin(T) = delete; +template T sqrt(T) = delete; + +template void ROTX90(Cmplx &a) + { auto tmp_= fwd ? -a.r : a.r; a.r = fwd ? a.i : -a.i; a.i=tmp_; } + +#define POCKETFFT_EXEC_DISPATCH \ + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, \ + bool fwd, size_t nthreads=1) const \ + { \ + static const auto tics = tidx(); \ + if (ti==tics) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + if constexpr (fft1d_simdlen > 1) \ + if constexpr (simd_exists>) \ + { \ + using Tfv = typename simd_select>::type; \ + using Tcv = Cmplx; \ + static const auto ticv = tidx(); \ + if (ti==ticv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 2) \ + if constexpr (simd_exists/2>) \ + { \ + using Tfv = typename simd_select/2>::type; \ + using Tcv = Cmplx; \ + static const auto ticv = tidx(); \ + if (ti==ticv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 4) \ + if constexpr (simd_exists/4>) \ + { \ + using Tfv = typename simd_select/4>::type; \ + using Tcv = Cmplx; \ + static const auto ticv = tidx(); \ + if (ti==ticv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 8) \ + if constexpr (simd_exists/8>) \ + { \ + using Tfv = typename simd_select/8>::type; \ + using Tcv = Cmplx; \ + static const auto ticv = tidx(); \ + if (ti==ticv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + MR_fail("impossible vector length requested"); \ + } + +template class cfftp1: public cfftpass + { + public: + cfftp1() {} + virtual size_t bufsize() const { return 0; } + virtual bool needs_copy() const { return false; } + + virtual void *exec(const type_index & /*ti*/, void * in, void * /*copy*/, + void * /*buf*/, bool /*fwd*/, size_t /*nthreads*/) const + { return in; } + }; + +template class cfftp2: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=2; + aligned_array wa; + + auto WA(size_t i) const + { return wa[i-1]; } + + template Tcd *exec_ (const Tcd * DUCC0_RESTRICT cc, + Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, size_t /*nthreads*/) const + { + if (ido==1) + { + auto CH = [ch,this](size_t b, size_t c) -> Tcd& + { return ch[b+l1*c]; }; + auto CC = [cc](size_t b, size_t c) -> const Tcd& + { return cc[b+ip*c]; }; + for (size_t k=0; k Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + for (size_t k=0; k(CC(i,0,k)-CC(i,1,k),WA(i),CH(i,k,1)); + } + } + return ch; + } + } + + public: + cfftp2(size_t l1_, size_t ido_, const Troots &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp3: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=3; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + constexpr Tfs tw1r=-0.5, + tw1i= (fwd ? -1: 1) * Tfs(0.8660254037844386467637231707529362L); + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +#define POCKETFFT_PREP3(idx) \ + Tcd t0 = CC(idx,0,k), t1, t2; \ + PM (t1,t2,CC(idx,1,k),CC(idx,2,k)); \ + CH(idx,k,0)=t0+t1; +#define POCKETFFT_PARTSTEP3a(u1,u2,twr,twi) \ + { \ + Tcd ca=t0+t1*twr; \ + Tcd cb{-t2.i*twi, t2.r*twi}; \ + PM(CH(0,k,u1),CH(0,k,u2),ca,cb) ;\ + } +#define POCKETFFT_PARTSTEP3b(u1,u2,twr,twi) \ + { \ + Tcd ca=t0+t1*twr; \ + Tcd cb{-t2.i*twi, t2.r*twi}; \ + special_mul(ca+cb,WA(u1-1,i),CH(i,k,u1)); \ + special_mul(ca-cb,WA(u2-1,i),CH(i,k,u2)); \ + } + + if (ido==1) + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp4: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=4; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + if (ido==1) + { + auto CH = [ch,this](size_t b, size_t c) -> Tcd& + { return ch[b+l1*c]; }; + auto CC = [cc](size_t b, size_t c) -> const Tcd& + { return cc[b+ip*c]; }; + for (size_t k=0; k(t4); + PM(CH(k,0),CH(k,2),t2,t3); + PM(CH(k,1),CH(k,3),t1,t4); + } + } + else + { + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + for (size_t k=0; k(t4); + PM(CH(0,k,0),CH(0,k,2),t2,t3); + PM(CH(0,k,1),CH(0,k,3),t1,t4); + } + for (size_t i=1; i(t4); + CH(i,k,0) = t2+t3; + special_mul(t1+t4,WA(0,i),CH(i,k,1)); + special_mul(t2-t3,WA(1,i),CH(i,k,2)); + special_mul(t1-t4,WA(2,i),CH(i,k,3)); + } + } + } + return ch; + } + + public: + cfftp4(size_t l1_, size_t ido_, const Troots &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp5: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=5; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + constexpr Tfs tw1r= Tfs(0.3090169943749474241022934171828191L), + tw1i= (fwd ? -1: 1) * Tfs(0.9510565162951535721164393333793821L), + tw2r= Tfs(-0.8090169943749474241022934171828191L), + tw2i= (fwd ? -1: 1) * Tfs(0.5877852522924731291687059546390728L); + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +#define POCKETFFT_PREP5(idx) \ + Tcd t0 = CC(idx,0,k), t1, t2, t3, t4; \ + PM (t1,t4,CC(idx,1,k),CC(idx,4,k)); \ + PM (t2,t3,CC(idx,2,k),CC(idx,3,k)); \ + CH(idx,k,0).r=t0.r+t1.r+t2.r; \ + CH(idx,k,0).i=t0.i+t1.i+t2.i; + +#define POCKETFFT_PARTSTEP5a(u1,u2,twar,twbr,twai,twbi) \ + { \ + Tcd ca,cb; \ + ca.r=t0.r+twar*t1.r+twbr*t2.r; \ + ca.i=t0.i+twar*t1.i+twbr*t2.i; \ + cb.i=twai*t4.r twbi*t3.r; \ + cb.r=-(twai*t4.i twbi*t3.i); \ + PM(CH(0,k,u1),CH(0,k,u2),ca,cb); \ + } + +#define POCKETFFT_PARTSTEP5b(u1,u2,twar,twbr,twai,twbi) \ + { \ + Tcd ca,cb,da,db; \ + ca.r=t0.r+twar*t1.r+twbr*t2.r; \ + ca.i=t0.i+twar*t1.i+twbr*t2.i; \ + cb.i=twai*t4.r twbi*t3.r; \ + cb.r=-(twai*t4.i twbi*t3.i); \ + special_mul(ca+cb,WA(u1-1,i),CH(i,k,u1)); \ + special_mul(ca-cb,WA(u2-1,i),CH(i,k,u2)); \ + } + + if (ido==1) + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp7: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=7; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + constexpr Tfs tw1r= Tfs(0.6234898018587335305250048840042398L), + tw1i= (fwd ? -1 : 1) * Tfs(0.7818314824680298087084445266740578L), + tw2r= Tfs(-0.2225209339563144042889025644967948L), + tw2i= (fwd ? -1 : 1) * Tfs(0.9749279121818236070181316829939312L), + tw3r= Tfs(-0.9009688679024191262361023195074451L), + tw3i= (fwd ? -1 : 1) * Tfs(0.433883739117558120475768332848359L); + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +#define POCKETFFT_PREP7(idx) \ + Tcd t1 = CC(idx,0,k), t2, t3, t4, t5, t6, t7; \ + PM (t2,t7,CC(idx,1,k),CC(idx,6,k)); \ + PM (t3,t6,CC(idx,2,k),CC(idx,5,k)); \ + PM (t4,t5,CC(idx,3,k),CC(idx,4,k)); \ + CH(idx,k,0).r=t1.r+t2.r+t3.r+t4.r; \ + CH(idx,k,0).i=t1.i+t2.i+t3.i+t4.i; + +#define POCKETFFT_PARTSTEP7a0(u1,u2,x1,x2,x3,y1,y2,y3,out1,out2) \ + { \ + Tcd ca,cb; \ + ca.r=t1.r+x1*t2.r+x2*t3.r+x3*t4.r; \ + ca.i=t1.i+x1*t2.i+x2*t3.i+x3*t4.i; \ + cb.i=y1*t7.r y2*t6.r y3*t5.r; \ + cb.r=-(y1*t7.i y2*t6.i y3*t5.i); \ + PM(out1,out2,ca,cb); \ + } +#define POCKETFFT_PARTSTEP7a(u1,u2,x1,x2,x3,y1,y2,y3) \ + POCKETFFT_PARTSTEP7a0(u1,u2,x1,x2,x3,y1,y2,y3,CH(0,k,u1),CH(0,k,u2)) +#define POCKETFFT_PARTSTEP7(u1,u2,x1,x2,x3,y1,y2,y3) \ + { \ + Tcd da,db; \ + POCKETFFT_PARTSTEP7a0(u1,u2,x1,x2,x3,y1,y2,y3,da,db) \ + special_mul(da,WA(u1-1,i),CH(i,k,u1)); \ + special_mul(db,WA(u2-1,i),CH(i,k,u2)); \ + } + + if (ido==1) + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp8: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=8; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template void ROTX45(T &a) const + { + constexpr Tfs hsqt2=Tfs(0.707106781186547524400844362104849L); + if constexpr (fwd) + { auto tmp_=a.r; a.r=hsqt2*(a.r+a.i); a.i=hsqt2*(a.i-tmp_); } + else + { auto tmp_=a.r; a.r=hsqt2*(a.r-a.i); a.i=hsqt2*(a.i+tmp_); } + } + template void ROTX135(T &a) const + { + constexpr Tfs hsqt2=Tfs(0.707106781186547524400844362104849L); + if constexpr (fwd) + { auto tmp_=a.r; a.r=hsqt2*(a.i-a.r); a.i=hsqt2*(-tmp_-a.i); } + else + { auto tmp_=a.r; a.r=hsqt2*(-a.r-a.i); a.i=hsqt2*(tmp_-a.i); } + } + + template Tcd *exec_ + (Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, size_t /*nthreads*/) const + { + if (l1==1) + { + auto CC = [cc,this](size_t a, size_t b) -> Tcd& + { return cc[a+ido*b]; }; + { + Tcd a0, a1, a2, a3, a4, a5, a6, a7; + PM(a1,a5,CC(0,1),CC(0,5)); + PM(a3,a7,CC(0,3),CC(0,7)); + PMINPLACE(a1,a3); + ROTX90(a3); + + ROTX90(a7); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + + PM(a0,a4,CC(0,0),CC(0,4)); + PM(a2,a6,CC(0,2),CC(0,6)); + PM(CC(0,0),CC(0,4),a0+a2,a1); + PM(CC(0,2),CC(0,6),a0-a2,a3); + ROTX90(a6); + PM(CC(0,1),CC(0,5),a4+a6,a5); + PM(CC(0,3),CC(0,7),a4-a6,a7); + } + for (size_t i=1; i(a7); + PMINPLACE(a1,a3); + ROTX90(a3); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + PM(a0,a4,CC(i,0),CC(i,4)); + PM(a2,a6,CC(i,2),CC(i,6)); + PMINPLACE(a0,a2); + CC(i,0) = a0+a1; + special_mul(a0-a1,WA(3,i),CC(i,4)); + special_mul(a2+a3,WA(1,i),CC(i,2)); + special_mul(a2-a3,WA(5,i),CC(i,6)); + ROTX90(a6); + PMINPLACE(a4,a6); + special_mul(a4+a5,WA(0,i),CC(i,1)); + special_mul(a4-a5,WA(4,i),CC(i,5)); + special_mul(a6+a7,WA(2,i),CC(i,3)); + special_mul(a6-a7,WA(6,i),CC(i,7)); + } + return cc; + } + if (ido==1) + { + auto CH = [ch,this](size_t b, size_t c) -> Tcd& + { return ch[b+l1*c]; }; + auto CC = [cc](size_t b, size_t c) -> const Tcd& + { return cc[b+ip*c]; }; + for (size_t k=0; k(a3); + + ROTX90(a7); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + + PM(a0,a4,CC(0,k),CC(4,k)); + PM(a2,a6,CC(2,k),CC(6,k)); + PM(CH(k,0),CH(k,4),a0+a2,a1); + PM(CH(k,2),CH(k,6),a0-a2,a3); + ROTX90(a6); + PM(CH(k,1),CH(k,5),a4+a6,a5); + PM(CH(k,3),CH(k,7),a4-a6,a7); + } + } + else + { + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + for (size_t k=0; k(a3); + + ROTX90(a7); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + + PM(a0,a4,CC(0,0,k),CC(0,4,k)); + PM(a2,a6,CC(0,2,k),CC(0,6,k)); + PM(CH(0,k,0),CH(0,k,4),a0+a2,a1); + PM(CH(0,k,2),CH(0,k,6),a0-a2,a3); + ROTX90(a6); + PM(CH(0,k,1),CH(0,k,5),a4+a6,a5); + PM(CH(0,k,3),CH(0,k,7),a4-a6,a7); + } + for (size_t i=1; i(a7); + PMINPLACE(a1,a3); + ROTX90(a3); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + PM(a0,a4,CC(i,0,k),CC(i,4,k)); + PM(a2,a6,CC(i,2,k),CC(i,6,k)); + PMINPLACE(a0,a2); + CH(i,k,0) = a0+a1; + special_mul(a0-a1,WA(3,i),CH(i,k,4)); + special_mul(a2+a3,WA(1,i),CH(i,k,2)); + special_mul(a2-a3,WA(5,i),CH(i,k,6)); + ROTX90(a6); + PMINPLACE(a4,a6); + special_mul(a4+a5,WA(0,i),CH(i,k,1)); + special_mul(a4-a5,WA(4,i),CH(i,k,5)); + special_mul(a6+a7,WA(2,i),CH(i,k,3)); + special_mul(a6-a7,WA(6,i),CH(i,k,7)); + } + } + } + return ch; + } + + public: + cfftp8(size_t l1_, size_t ido_, const Troots &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i1; } + + POCKETFFT_EXEC_DISPATCH + }; + +template class cfftp11: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=11; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template [[gnu::hot]] Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + constexpr Tfs tw1r= Tfs(0.8412535328311811688618116489193677L), + tw1i= (fwd ? -1 : 1) * Tfs(0.5406408174555975821076359543186917L), + tw2r= Tfs(0.4154150130018864255292741492296232L), + tw2i= (fwd ? -1 : 1) * Tfs(0.9096319953545183714117153830790285L), + tw3r= Tfs(-0.1423148382732851404437926686163697L), + tw3i= (fwd ? -1 : 1) * Tfs(0.9898214418809327323760920377767188L), + tw4r= Tfs(-0.6548607339452850640569250724662936L), + tw4i= (fwd ? -1 : 1) * Tfs(0.7557495743542582837740358439723444L), + tw5r= Tfs(-0.9594929736144973898903680570663277L), + tw5i= (fwd ? -1 : 1) * Tfs(0.2817325568414296977114179153466169L); + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +#define POCKETFFT_PREP11(idx) \ + Tcd t1 = CC(idx,0,k), t2, t3, t4, t5, t6, t7, t8, t9, t10, t11; \ + PM (t2,t11,CC(idx,1,k),CC(idx,10,k)); \ + PM (t3,t10,CC(idx,2,k),CC(idx, 9,k)); \ + PM (t4,t9 ,CC(idx,3,k),CC(idx, 8,k)); \ + PM (t5,t8 ,CC(idx,4,k),CC(idx, 7,k)); \ + PM (t6,t7 ,CC(idx,5,k),CC(idx, 6,k)); \ + CH(idx,k,0).r=t1.r+t2.r+t3.r+t4.r+t5.r+t6.r; \ + CH(idx,k,0).i=t1.i+t2.i+t3.i+t4.i+t5.i+t6.i; + +#define POCKETFFT_PARTSTEP11a0(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5,out1,out2) \ + { \ + Tcd ca = t1 + t2*x1 + t3*x2 + t4*x3 + t5*x4 +t6*x5, \ + cb; \ + cb.i=y1*t11.r y2*t10.r y3*t9.r y4*t8.r y5*t7.r; \ + cb.r=-(y1*t11.i y2*t10.i y3*t9.i y4*t8.i y5*t7.i ); \ + PM(out1,out2,ca,cb); \ + } +#define POCKETFFT_PARTSTEP11a(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5) \ + POCKETFFT_PARTSTEP11a0(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5,CH(0,k,u1),CH(0,k,u2)) +#define POCKETFFT_PARTSTEP11(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5) \ + { \ + Tcd da,db; \ + POCKETFFT_PARTSTEP11a0(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5,da,db) \ + special_mul(da,WA(u1-1,i),CH(i,k,u1)); \ + special_mul(db,WA(u2-1,i),CH(i,k,u2)); \ + } + + if (ido==1) + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftpg: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + size_t ip; + aligned_array wa; + aligned_array csarr; + + auto WA(size_t x, size_t i) const + { return wa[i-1+x*(ido-1)]; } + + template Tcd *exec_ + (Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, size_t /*nthreads*/) const + { + size_t ipph = (ip+1)/2; + size_t idl1 = ido*l1; + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + auto CX = [cc,this](size_t a, size_t b, size_t c) -> Tcd& + { return cc[a+ido*(b+l1*c)]; }; + auto CX2 = [cc, idl1](size_t a, size_t b) -> Tcd& + { return cc[a+idl1*b]; }; + auto CH2 = [ch, idl1](size_t a, size_t b) -> const Tcd& + { return ch[a+idl1*b]; }; + + for (size_t k=0; kip) iwal-=ip; + Tcs xwal=fwd ? csarr[iwal].conj() : csarr[iwal]; + iwal+=l; if (iwal>ip) iwal-=ip; + Tcs xwal2=fwd ? csarr[iwal].conj() : csarr[iwal]; + for (size_t ik=0; ikip) iwal-=ip; + Tcs xwal=fwd ? csarr[iwal].conj() : csarr[iwal]; + for (size_t ik=0; ik(x1,wa[idij],CX(i,k,j)); + idij=(jc-1)*(ido-1)+i-1; + special_mul(x2,wa[idij],CX(i,k,jc)); + } + } + } + return cc; + } + + public: + cfftpg(size_t l1_, size_t ido_, size_t ip_, const Troots &roots) + : l1(l1_), ido(ido_), ip(ip_), wa((ip-1)*(ido-1)), csarr(ip) + { + MR_assert((ip&1)&&(ip>=5), "need an odd number >=5"); + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class cfftpblue: public cfftpass + { + private: + using typename cfftpass::Tcs; + + const size_t l1, ido, ip; + const size_t ip2; + const Tcpass subplan; + aligned_array wa, bk, bkf; + size_t bufsz; + bool need_cpy; + + auto WA(size_t x, size_t i) const + { return wa[i-1+x*(ido-1)]; } + + template Tcd *exec_ + (Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, + Tcd * DUCC0_RESTRICT buf, size_t nthreads) const + { + static const auto ti=tidx(); + Tcd *akf = &buf[0]; + Tcd *akf2 = subplan->needs_copy() ? (&buf[ip2]) : akf; + Tcd *subbuf = akf2+ip2; + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +//FIXME: parallelize here? + for (size_t k=0; k(CC(i,m,k),bk[m],akf[m]); + auto zero = akf[0]*Tfs(0); + for (size_t m=ip; m(subplan->exec(ti,akf,akf2, + subbuf, true, nthreads)); + + /* do the convolution */ + res[0] = res[0].template special_mul(bkf[0]); + for (size_t m=1; m<(ip2+1)/2; ++m) + { + res[m] = res[m].template special_mul(bkf[m]); + res[ip2-m] = res[ip2-m].template special_mul(bkf[m]); + } + if ((ip2&1)==0) + res[ip2/2] = res[ip2/2].template special_mul(bkf[ip2/2]); + + /* inverse FFT */ + res = static_cast(subplan->exec(ti, res, + (res==akf) ? akf2 : akf, subbuf, false, nthreads)); + + /* multiply by b_k and write to output buffer */ + if (l1>1) + { + if (i==0) + for (size_t m=0; m(bk[m]); + else + { + CH(i,k,0) = res[0].template special_mul(bk[0]); + for (size_t m=1; m(bk[m]*WA(m-1,i)); + } + } + else + { + if (i==0) + for (size_t m=0; m(bk[m]); + else + { + CC(i,0,0) = res[0].template special_mul(bk[0]); + for (size_t m=1; m(bk[m]*WA(m-1,i)); + } + } + } + + return (l1>1) ? ch : cc; + } + + public: + cfftpblue(size_t l1_, size_t ido_, size_t ip_, const Troots &roots, + bool vectorize=false) + : l1(l1_), ido(ido_), ip(ip_), ip2(util1d::good_size_cmplx(ip*2-1)), + subplan(cfftpass::make_pass(ip2, vectorize)), wa((ip-1)*(ido-1)), + bk(ip), bkf(ip2/2+1) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; jsize()/(2*ip))*2*ip==roots->size()) ? + roots : make_shared>(2*ip); + size_t rfct2 = roots2->size()/(2*ip); + for (size_t m=1; m=2*ip) coeff-=2*ip; + bk[m] = (*roots2)[coeff*rfct2]; + } + + /* initialize the zero-padded, Fourier transformed b_k. Add normalisation. */ + aligned_array tbkf(ip2), tbkf2(ip2); + Tfs xn2 = Tfs(1)/Tfs(ip2); + tbkf[0] = bk[0]*xn2; + for (size_t m=1; m buf(subplan->bufsize()); + static const auto tics=tidx(); + auto res = static_cast(subplan->exec(tics, tbkf.data(), + tbkf2.data(), buf.data(), true)); + for (size_t i=0; i1; + bufsz = ip2*(1+subplan->needs_copy()) + subplan->bufsize(); + } + + virtual size_t bufsize() const { return bufsz; } + virtual bool needs_copy() const { return need_cpy; } + + POCKETFFT_EXEC_DISPATCH + }; + +template class cfft_multipass: public cfftpass + { + private: + using typename cfftpass::Tcs; + static constexpr size_t bunchsize=8; + + const size_t l1, ido; + size_t ip; + vector> passes; + size_t bufsz; + bool need_cpy; + size_t rfct; + Troots myroots; + +// FIXME split into sub-functions. This is too long! + template Cmplx *exec_(Cmplx *cc, Cmplx *ch, + Cmplx *buf, size_t nthreads) const + { + using Tc = Cmplx; + if ((l1==1) && (ido==1)) // no chance at vectorizing + { + static const auto tic=tidx(); + Tc *p1=cc, *p2=ch; + for(const auto &pass: passes) + { + auto res = static_cast(pass->exec(tic, p1, p2, buf, + fwd, nthreads)); + if (res==p2) swap (p1,p2); + } + return p1; + } + else + { + if constexpr(is_same::value && fft1d_simd_exists) // we can vectorize! + { + using Tfv = fft1d_simd; + using Tcv = Cmplx; + constexpr size_t vlen = Tfv::size(); + size_t nvtrans = (l1*ido + vlen-1)/vlen; + // NOTE: removed "static" here, because it leads to trouble with gcc 7 + // static const type_index ticv = tidx(); + const type_index ticv = tidx(); + + if (ido==1) + { + auto CH = [ch,this](size_t b, size_t c) -> Tc& + { return ch[b+l1*c]; }; + auto CC = [cc,this](size_t b, size_t c) -> Tc& + { return cc[b+ip*c]; }; + + execStatic(nvtrans, nthreads, 0, [&](auto &sched) + { + aligned_array tbuf(2*ip+32+bufsize()); + auto cc2 = &tbuf[0]; + auto ch2 = &tbuf[ip+16]; + auto buf2 = &tbuf[2*ip+32]; + + while (auto rng=sched.getNext()) + for(auto itrans=rng.lo; itrans(pass->exec(ticv, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + + for (size_t m=0; m Tc& + { return cc[a+ido*b]; }; + + execStatic(nvtrans, nthreads, 0, [&](auto &sched) + { + aligned_array tbuf(2*ip+32+bufsize()); + auto cc2 = &tbuf[0]; + auto ch2 = &tbuf[ip+16]; + auto buf2 = &tbuf[2*ip+32]; + + while (auto rng=sched.getNext()) + for(auto itrans=rng.lo; itrans(pass->exec(ticv, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + + for (size_t m=0; m= ido) break; + if (i==0) + CC(0,m) = { p1[m].r[n], p1[m].i[n] }; + else + { + if (m==0) + CC(i,0) = { p1[0].r[n], p1[0].i[n] } ; + else + CC(i,m) = Tcs(p1[m].r[n],p1[m].i[n]).template special_mul((*myroots)[rfct*m*i]); + } + } + } + }); + return cc; + } + +MR_fail("must not get here"); +#if 0 +//FIXME this code path is currently unused + aligned_array tbuf(2*ip+bufsize()); + auto cc2 = &tbuf[0]; + auto ch2 = &tbuf[ip]; + auto buf2 = &tbuf[2*ip]; + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tc& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> Tc& + { return cc[a+ido*(b+ip*c)]; }; + +//FIXME parallelize? + for (size_t itrans=0; itrans ix, kx; + size_t ixcur = (itrans*vlen)%ido; + size_t kxcur = (itrans*vlen)/ido; + for (size_t n=0; n(pass->exec(ticv, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + + for (size_t m=0; m= l1*ido) break; + if (i==0) + CH(0,k,m) = { p1[m].r[n], p1[m].i[n] }; + else + { + if (m==0) + CH(i,k,0) = { p1[0].r[n], p1[0].i[n] } ; + else + CH(i,k,m) = Tcs(p1[m].r[n],p1[m].i[n]).template special_mul((*myroots)[rfct*l1*m*i]); + } + } + } + return ch; +#endif + } + else + { + static const auto tic = tidx *>(); + if (ido==1) + { +// parallelize here! + for (size_t n=0; n *p1=&cc[n*ip], *p2=ch; + Cmplx *res = nullptr; + for(const auto &pass: passes) + { + res = static_cast *>(pass->exec(tic, + p1, p2, buf, fwd)); + if (res==p2) swap (p1,p2); + } + if (res != &cc[n*ip]) + copy(res, res+ip, cc+n*ip); + } + // transpose + size_t nbunch = (l1*ido + bunchsize-1)/bunchsize; +// parallelize here! + for (size_t ibunch=0; ibunch Tc& + { return cc[a+ido*b]; }; + +// parallelize here! + for (size_t ibunch=0; ibunch *p1=&cc2[n*ip], *p2=ch2; + Cmplx *res = nullptr; + for(const auto &pass: passes) + { + res = static_cast *>(pass->exec(tic, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + if (res==&cc2[n*ip]) // no copying necessary + { + if (i!=0) + { + for (size_t m=1; m((*myroots)[rfct*m*i]); + } + } + else + { + if (i==0) + for (size_t m=0; m((*myroots)[rfct*m*i]); + } + } + } + for (size_t m=0; m Tc& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> Tc& + { return cc[a+ido*(b+ip*c)]; }; + +// parallelize here! + for (size_t ibunch=0; ibunch ix, kx; + size_t ixcur = (ibunch*bunchsize)%ido; + size_t kxcur = (ibunch*bunchsize)/ido; + for (size_t n=0; n *p1=&cc2[n*ip], *p2=ch2; + Cmplx *res = nullptr; + for(const auto &pass: passes) + { + res = static_cast *>(pass->exec(tic, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + if (res==&cc2[n*ip]) // no copying necessary + { + if (i!=0) + { + for (size_t m=1; m((*myroots)[rfct*l1*m*i]); + } + } + else + { + if (i==0) + for (size_t m=0; m((*myroots)[rfct*l1*m*i]); + } + } + } + for (size_t m=0; m &roots, bool /*vectorize*/=false) + : l1(l1_), ido(ido_), ip(ip_), bufsz(0), need_cpy(false), + myroots(roots) + { + size_t N=ip*l1*ido; + rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + + // FIXME TBD +// do we need the vectorize flag at all? + size_t lim = 10000; //vectorize ? 10000 : 10000; + if (ip<=lim) + { + auto factors = cfftpass::factorize(ip); + size_t l1l=1; + for (auto fct: factors) + { + passes.push_back(cfftpass::make_pass(l1l, ip/(fct*l1l), fct, roots, false)); + l1l*=fct; + } + } + else + { + vector packets(2,1); + auto factors = util1d::prime_factors(ip); + sort(factors.begin(), factors.end(), std::greater()); + for (auto fct: factors) + (packets[0]>packets[1]) ? packets[1]*=fct : packets[0]*=fct; + size_t l1l=1; + for (auto pkt: packets) + { + passes.push_back(cfftpass::make_pass(l1l, ip/(pkt*l1l), pkt, roots, false)); + l1l*=pkt; + } + } + for (const auto &pass: passes) + { + bufsz = max(bufsz, pass->bufsize()); + need_cpy |= pass->needs_copy(); + } + if ((l1!=1)||(ido!=1)) + { + need_cpy=true; + bufsz += (bunchsize+1)*ip; + } + } + + virtual size_t bufsize() const { return bufsz; } + virtual bool needs_copy() const { return need_cpy; } + + POCKETFFT_EXEC_DISPATCH + }; + +#undef POCKETFFT_EXEC_DISPATCH + +template class cfftp_vecpass: public cfftpass + { + private: + static_assert(simd_exists, "bad vlen"); + using typename cfftpass::Tcs; + using Tfv=typename simd_select::type; + using Tcv=Cmplx; + + size_t ip; + Tcpass spass; + Tcpass vpass; + size_t bufsz; + + template Tcs *exec_ (Tcs *cc, + Tcs * /*ch*/, Tcs *sbuf, size_t nthreads) const + { + char *xbuf = reinterpret_cast(sbuf); + size_t misalign = reinterpret_cast(xbuf)&(sizeof(Tfv)-1); + if (misalign != 0) + xbuf += sizeof(Tfv)-misalign; + Tcv *buf = reinterpret_cast(xbuf); + auto * cc2 = buf; + auto * ch2 = buf+ip/vlen+7; + auto * buf2 = buf+2*ip/vlen+7+7; + static const auto tics = tidx(); +// run scalar pass + auto res = static_cast(spass->exec(tics, cc, + reinterpret_cast(ch2), reinterpret_cast(buf2), + fwd, nthreads)); +// arrange input in SIMD-friendly way, must be done out-of-place + for (size_t i=0; i(); + auto res2 = static_cast(vpass->exec(ticv, + cc2, ch2, buf2, fwd, nthreads)); +// de-SIMDify, can be done pseudo-inplace + for (size_t i=0; i &roots) + : ip(ip_), spass(cfftpass::make_pass(1, ip/vlen, vlen, roots)), + vpass(cfftpass::make_pass(1, 1, ip/vlen, roots)), bufsz(0) + { + MR_assert((ip/vlen)*vlen==ip, "cannot vectorize this size"); + bufsz = 2*(ip/vlen)+7+7; + bufsz += max(vpass->bufsize(),(spass->bufsize()+vlen-1)/vlen); // buffers for subpasses + bufsz *= vlen; // since we specify in terms of Tcs + bufsz += vlen; // wiggle room for alignment shifts + } + virtual size_t bufsize() const { return bufsz; } + virtual bool needs_copy() const { return false; } + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, + bool fwd, size_t nthreads=1) const + { + static const auto tics = tidx(); + MR_assert(ti==tics, "bad input type"); + auto in1 = static_cast(in); + auto copy1 = static_cast(copy); + auto buf1 = static_cast(buf); + return fwd ? exec_(in1, copy1, buf1, nthreads) + : exec_(in1, copy1, buf1, nthreads); + } + }; + +template Tcpass cfftpass::make_pass(size_t l1, + size_t ido, size_t ip, const Troots &roots, bool vectorize) + { + MR_assert(ip>=1, "no zero-sized FFTs"); + // do we have an 1D vectorizable FFT? + if (vectorize && (ip>300)&& (ip<=100000) && (l1==1) && (ido==1)) + { +// constexpr auto vlen = native_simd::size(); +// if constexpr(vlen>=4) + constexpr auto vlen = 4; + if constexpr(simd_exists) + if ((ip&(vlen-1))==0) + return make_shared>(ip, roots); + } + + if (ip==1) return make_shared>(); + auto factors=cfftpass::factorize(ip); + if (factors.size()==1) + { + switch(ip) + { + case 2: + return make_shared>(l1, ido, roots); + case 3: + return make_shared>(l1, ido, roots); + case 4: + return make_shared>(l1, ido, roots); + case 5: + return make_shared>(l1, ido, roots); + case 7: + return make_shared>(l1, ido, roots); + case 8: + return make_shared>(l1, ido, roots); + case 11: + return make_shared>(l1, ido, roots); + default: + if (ip<110) + return make_shared>(l1, ido, ip, roots); + else + return make_shared>(l1, ido, ip, roots, vectorize); + } + } + else // more than one factor, need a multipass + return make_shared>(l1, ido, ip, roots, vectorize); + } + +#define POCKETFFT_EXEC_DISPATCH \ + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, \ + bool fwd, size_t nthreads) const \ + { \ + static const auto tifs=tidx(); \ + if (ti==tifs) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + if constexpr (fft1d_simdlen > 1) \ + if constexpr (simd_exists>) \ + { \ + using Tfv = typename simd_select>::type; \ + static const auto tifv=tidx(); \ + if (ti==tifv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 2) \ + if constexpr (simd_exists/2>) \ + { \ + using Tfv = typename simd_select/2>::type; \ + static const auto tifv=tidx(); \ + if (ti==tifv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 4) \ + if constexpr (simd_exists/4>) \ + { \ + using Tfv = typename simd_select/4>::type; \ + static const auto tifv=tidx(); \ + if (ti==tifv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 8) \ + if constexpr (simd_exists/8>) \ + { \ + using Tfv = typename simd_select/8>::type; \ + static const auto tifv=tidx(); \ + if (ti==tifv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + MR_fail("impossible vector length requested"); \ + } + +/* (a+ib) = conj(c+id) * (e+if) */ +template inline void MULPM + (T1 &a, T1 &b, T2 c, T2 d, T3 e, T3 f) + { a=c*e+d*f; b=c*f-d*e; } + +template class rfftp1: public rfftpass + { + public: + rfftp1() {} + virtual size_t bufsize() const { return 0; } + virtual bool needs_copy() const { return false; } + + virtual void *exec(const type_index & /*ti*/, void * in, void * /*copy*/, + void * /*buf*/, bool /*fwd*/, size_t /*nthreads*/) const + { return in; } + }; + +template class rfftp2: public rfftpass + { + private: + size_t l1, ido; + static constexpr size_t ip=2; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + if constexpr(fwd) + { + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + for (size_t k=0; k const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftp3: public rfftpass + { + private: + size_t l1, ido; + static constexpr size_t ip=3; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + constexpr Tfs taur=Tfs(-0.5), + taui=Tfs(0.8660254037844386467637231707529362L); + if constexpr(fwd) + { + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + for (size_t k=0; k const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + MR_assert(ido&1, "ido must be odd"); + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftp4: public rfftpass + { + private: + size_t l1, ido; + static constexpr size_t ip=4; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + if constexpr(fwd) + { + constexpr Tfs hsqt2=Tfs(0.707106781186547524400844362104849L); + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + + for (size_t k=0; k const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftp5: public rfftpass + { + private: + size_t l1, ido; + static constexpr size_t ip=5; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + constexpr Tfs tr11= Tfs(0.3090169943749474241022934171828191L), + ti11= Tfs(0.9510565162951535721164393333793821L), + tr12= Tfs(-0.8090169943749474241022934171828191L), + ti12= Tfs(0.5877852522924731291687059546390728L); + + if constexpr(fwd) + { + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + + for (size_t k=0; k const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + MR_assert(ido&1, "ido must be odd"); + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftpg: public rfftpass + { + private: + size_t l1, ido; + size_t ip; + aligned_array wa, csarr; + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + if constexpr(fwd) + { + size_t ipph=(ip+1)/2; + size_t idl1 = ido*l1; + + auto CC = [cc,this](size_t a, size_t b, size_t c) -> Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> const Tfd& + { return ch[a+ido*(b+l1*c)]; }; + auto C1 = [cc,this] (size_t a, size_t b, size_t c) -> Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto C2 = [cc,idl1] (size_t a, size_t b) -> Tfd& + { return cc[a+idl1*b]; }; + auto CH2 = [ch,idl1] (size_t a, size_t b) -> Tfd& + { return ch[a+idl1*b]; }; + + if (ido>1) + { + for (size_t j=1, jc=ip-1; j=ip) iang-=ip; + Tfs ar1=csarr[2*iang], ai1=csarr[2*iang+1]; + iang+=l; if (iang>=ip) iang-=ip; + Tfs ar2=csarr[2*iang], ai2=csarr[2*iang+1]; + iang+=l; if (iang>=ip) iang-=ip; + Tfs ar3=csarr[2*iang], ai3=csarr[2*iang+1]; + iang+=l; if (iang>=ip) iang-=ip; + Tfs ar4=csarr[2*iang], ai4=csarr[2*iang+1]; + for (size_t ik=0; ik=ip) iang-=ip; + Tfs ar1=csarr[2*iang], ai1=csarr[2*iang+1]; + iang+=l; if (iang>=ip) iang-=ip; + Tfs ar2=csarr[2*iang], ai2=csarr[2*iang+1]; + for (size_t ik=0; ik=ip) iang-=ip; + Tfs ar=csarr[2*iang], ai=csarr[2*iang+1]; + for (size_t ik=0; ik const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + auto C1 = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto C2 = [cc,idl1](size_t a, size_t b) -> Tfd& + { return cc[a+idl1*b]; }; + auto CH2 = [ch,idl1](size_t a, size_t b) -> Tfd& + { return ch[a+idl1*b]; }; + + for (size_t k=0; kip) iang-=ip; + Tfs ar1=csarr[2*iang], ai1=csarr[2*iang+1]; + iang+=l; if(iang>ip) iang-=ip; + Tfs ar2=csarr[2*iang], ai2=csarr[2*iang+1]; + iang+=l; if(iang>ip) iang-=ip; + Tfs ar3=csarr[2*iang], ai3=csarr[2*iang+1]; + iang+=l; if(iang>ip) iang-=ip; + Tfs ar4=csarr[2*iang], ai4=csarr[2*iang+1]; + for (size_t ik=0; ikip) iang-=ip; + Tfs ar1=csarr[2*iang], ai1=csarr[2*iang+1]; + iang+=l; if(iang>ip) iang-=ip; + Tfs ar2=csarr[2*iang], ai2=csarr[2*iang+1]; + for (size_t ik=0; ikip) iang-=ip; + Tfs war=csarr[2*iang], wai=csarr[2*iang+1]; + for (size_t ik=0; ik &roots) + : l1(l1_), ido(ido_), ip(ip_), wa((ip-1)*(ido-1)), csarr(2*ip) + { + MR_assert(ido&1, "ido must be odd"); + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftpblue: public rfftpass + { + private: + const size_t l1, ido, ip; + aligned_array wa; + const Tcpass cplan; + size_t bufsz; + bool need_cpy; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ + (Tfd * DUCC0_RESTRICT cc, Tfd * DUCC0_RESTRICT ch, + Tfd * DUCC0_RESTRICT buf_, size_t nthreads) const + { + using Tcd = Cmplx; + auto buf = reinterpret_cast(buf_); + Tcd *cc2 = &buf[0]; + Tcd *ch2 = &buf[ip]; + Tcd *subbuf = &buf[2*ip]; + static const auto ticd = tidx(); + + if constexpr(fwd) + { + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + + for (size_t k=0; k(cplan->exec(ticd, cc2, ch2, + subbuf, fwd, nthreads)); + // copy out + CH(0,0,k) = res[0].r; + for (size_t m=1; m<=ip/2; ++m) + { + CH(ido-1,2*m-1,k)=res[m].r; + CH(0,2*m,k)=res[m].i; + } + } + if (ido==1) return ch; + size_t ipph = (ip+1)/2; + for (size_t k=0; k(cplan->exec(ticd, cc2, ch2, + subbuf, fwd, nthreads)); + CH(i-1,0,k) = res[0].r; + CH(i,0,k) = res[0].i; + for (size_t m=1; m Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k(cplan->exec(ticd, cc2, ch2, + subbuf, fwd, nthreads)); + for (size_t m=0; m(cplan->exec(ticd, cc2, ch2, + subbuf, fwd, nthreads)); + CH(i-1,k,0) = res[0].r; + CH(i,k,0) = res[0].i; + for (size_t m=1; m &roots, bool vectorize=false) + : l1(l1_), ido(ido_), ip(ip_), wa((ip-1)*(ido-1)), + cplan(cfftpass::make_pass(1,1,ip,roots,vectorize)) + { + MR_assert(ip&1, "Bluestein length must be odd"); + MR_assert(ido&1, "ido must be odd"); + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; jbufsize(); } + virtual bool needs_copy() const { return true; } + + POCKETFFT_EXEC_DISPATCH + }; + +template class rfft_multipass: public rfftpass + { + private: + const size_t l1, ido; + size_t ip; + vector> passes; + size_t bufsz; + bool need_cpy; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[(i-1)*(ip-1)+x]; } + + template Tfd *exec_(Tfd *cc, Tfd *ch, Tfd *buf, + size_t nthreads) const + { + static const auto tifd = tidx(); + if ((l1==1) && (ido==1)) + { + Tfd *p1=cc, *p2=ch; + if constexpr (fwd) + for (auto it=passes.rbegin(); it!=passes.rend(); ++it) + { + auto res = static_cast((*it)->exec(tifd, + p1, p2, buf, fwd, nthreads)); + if (res==p2) swap(p1,p2); + } + else + for (const auto &pass: passes) + { + auto res = static_cast(pass->exec(tifd, + p1, p2, buf, fwd, nthreads)); + if (res==p2) swap(p1,p2); + } + return p1; + } + else + MR_fail("not yet supported"); + } + + public: + rfft_multipass(size_t l1_, size_t ido_, size_t ip_, + const Troots &roots, bool /*vectorize*/=false) + : l1(l1_), ido(ido_), ip(ip_), bufsz(0), need_cpy(false), + wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j::factorize(ip); + + size_t l1l=1; + for (auto fct: factors) + { + passes.push_back(rfftpass::make_pass(l1l, ip/(fct*l1l), fct, roots)); + l1l*=fct; + } + for (const auto &pass: passes) + { + bufsz = max(bufsz, pass->bufsize()); + need_cpy |= pass->needs_copy(); + } + if ((l1!=1)||(ido!=1)) + { + need_cpy=true; + bufsz += 2*ip; + } + } + + virtual size_t bufsize() const { return bufsz; } + virtual bool needs_copy() const { return need_cpy; } + + POCKETFFT_EXEC_DISPATCH + }; + +template class rfftp_complexify: public rfftpass + { + private: + size_t N; + Troots roots; + size_t rfct; + Tcpass pass; + size_t l1, ido; + static constexpr size_t ip=2; + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * buf, size_t nthreads) const + { + using Tcd = Cmplx; + auto ccc = reinterpret_cast(cc); + auto cch = reinterpret_cast(ch); + auto cbuf = reinterpret_cast(buf); + static const auto ticd = tidx(); + if constexpr(fwd) + { + auto res = static_cast(pass->exec(ticd, + ccc, cch, cbuf, true, nthreads)); + auto rres = (res==ccc) ? ch : cc; + rres[0] = res[0].r+res[0].i; +//FIXME: parallelize? + for (size_t i=1, xi=N/2-1; i<=xi; ++i, --xi) + { + auto xe = res[i]+res[xi].conj(); + auto xo = Tcd(res[i].i+res[xi].i, res[xi].r-res[i].r) + * (*roots)[rfct*i].conj(); + rres[2*i-1] = Tfs(0.5)*(xe.r+xo.r); + rres[2*i] = Tfs(0.5)*(xe.i+xo.i); + rres[2*xi-1] = Tfs(0.5)*(xe.r-xo.r); + rres[2*xi] = Tfs(0.5)*(xo.i-xe.i); + } + rres[N-1] = res[0].r-res[0].i; + return rres; + } + else + { + cch[0] = Tcd(cc[0]+cc[N-1], cc[0]-cc[N-1]); +//FIXME: parallelize? + for (size_t i=1, xi=N/2-1; i<=xi; ++i, --xi) + { + Tcd t1 (cc[2*i-1], cc[2*i]); + Tcd t2 (cc[2*xi-1], -cc[2*xi]); + auto xe = t1+t2; + auto xo = (t1-t2)*(*roots)[rfct*i]; + cch[i] = (xe + Tcd(-xo.i, xo.r)); + cch[xi] = (xe.conj() + Tcd(xo.i, xo.r)); + } + auto res = static_cast(pass->exec(ticd, + cch, ccc, cbuf, false, nthreads)); + return (res==ccc) ? cc : ch; + } + } + + public: + rfftp_complexify(size_t N_, const Troots &roots_, bool vectorize=false) + : N(N_), roots(roots_), pass(cfftpass::make_pass(N/2, vectorize)) + { + rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + MR_assert((N&1)==0, "N must be even"); + } + + virtual size_t bufsize() const { return 2*pass->bufsize(); } + virtual bool needs_copy() const { return true; } + + POCKETFFT_EXEC_DISPATCH + }; +#undef POCKETFFT_EXEC_DISPATCH + +template Trpass rfftpass::make_pass(size_t l1, + size_t ido, size_t ip, const Troots &roots, bool vectorize) + { + MR_assert(ip>=1, "no zero-sized FFTs"); + if (ip==1) return make_shared>(); + if ((ip>1000) && ((ip&1)==0)) // use complex transform + { + bool doit = vectorize&&((ip&7)==0); // vecpass might be beneficial + doit |= ip>10000; // complex multipass might be beneficial + if (!doit) + { + auto factors = rfftpass::factorize(ip); + for (auto factor: factors) + // complex Bluestein or larger prime factor functions might be beneficial + if (factor>5) { doit=true; break; } + } + if (doit) + return make_shared>(ip, roots, vectorize); + } + auto factors=rfftpass::factorize(ip); + if (factors.size()==1) + { + switch(ip) + { + case 2: + return make_shared>(l1, ido, roots); + case 3: + return make_shared>(l1, ido, roots); + case 4: + return make_shared>(l1, ido, roots); + case 5: + return make_shared>(l1, ido, roots); + default: + if (ip<135) + return make_shared>(l1, ido, ip, roots); + else + return make_shared>(l1, ido, ip, roots, vectorize); + } + } + else // more than one factor, need a multipass + return make_shared>(l1, ido, ip, roots, vectorize); + } + +}} + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fftnd_impl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fftnd_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..424567b0d3d5ea4d04bd7aa0b390aaa74f225f83 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/fft/fftnd_impl.h @@ -0,0 +1,1828 @@ +/* +This file is part of the ducc FFT library. + +Copyright (C) 2010-2023 Max-Planck-Society +Copyright (C) 2019 Peter Bell + +Authors: Martin Reinecke, Peter Bell +*/ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_FFTND_IMPL_H +#define DUCC0_FFTND_IMPL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ducc0/infra/useful_macros.h" +#include "ducc0/infra/error_handling.h" +#include "ducc0/infra/threading.h" +#include "ducc0/infra/misc_utils.h" +#include "ducc0/infra/simd.h" +#include "ducc0/infra/mav.h" +#include "ducc0/infra/aligned_array.h" +#include "ducc0/math/cmplx.h" +#include "ducc0/math/unity_roots.h" +#include "ducc0/fft/fft1d_impl.h" + +/** \file fft.h + * Implementation of multi-dimensional Fast Fourier and related transforms + * \copyright Copyright (C) 2010-2021 Max-Planck-Society + * \copyright Copyright (C) 2019 Peter Bell + * \copyright + * \copyright For the odd-sized DCT-IV transforms: + * \copyright Copyright (C) 2003, 2007-14 Matteo Frigo + * \copyright Copyright (C) 2003, 2007-14 Massachusetts Institute of Technology + * + * \authors Martin Reinecke, Peter Bell + */ + +namespace ducc0 { + +namespace detail_fft { + +// the next line is necessary to address some sloppy name choices in hipSYCL +using std::min, std::max; + +template constexpr inline size_t fft_simdlen + = min(8, native_simd::size()); +template<> constexpr inline size_t fft_simdlen + = min(4, native_simd::size()); +template<> constexpr inline size_t fft_simdlen + = min(8, native_simd::size()); +template using fft_simd = typename simd_select>::type; +template constexpr inline bool fft_simd_exists = (fft_simdlen > 1); + +struct util // hack to avoid duplicate symbols + { + static void sanity_check_axes(size_t ndim, const shape_t &axes) + { + if (ndim==1) + { + if ((axes.size()!=1) || (axes[0]!=0)) + throw std::invalid_argument("bad axes"); + return; + } + shape_t tmp(ndim,0); + if (axes.empty()) throw std::invalid_argument("no axes specified"); + for (auto ax : axes) + { + if (ax>=ndim) throw std::invalid_argument("bad axis number"); + if (++tmp[ax]>1) throw std::invalid_argument("axis specified repeatedly"); + } + } + + DUCC0_NOINLINE static void sanity_check_onetype(const fmav_info &a1, + const fmav_info &a2, bool inplace, const shape_t &axes) + { + sanity_check_axes(a1.ndim(), axes); + MR_assert(a1.conformable(a2), "array sizes are not conformable"); + if (inplace) MR_assert(a1.stride()==a2.stride(), "stride mismatch"); + } + DUCC0_NOINLINE static void sanity_check_cr(const fmav_info &ac, + const fmav_info &ar, const shape_t &axes) + { + sanity_check_axes(ac.ndim(), axes); + MR_assert(ac.ndim()==ar.ndim(), "dimension mismatch"); + for (size_t i=0; i=ac.ndim()) throw std::invalid_argument("bad axis number"); + MR_assert(ac.ndim()==ar.ndim(), "dimension mismatch"); + for (size_t i=0; i std::shared_ptr get_plan(size_t length, bool vectorize=false) + { +#ifdef DUCC0_NO_FFT_CACHE + return std::make_shared(length, vectorize); +#else + constexpr size_t nmax=10; + struct entry { size_t n; bool vectorize; std::shared_ptr ptr; }; + static std::array cache{{{0,0,nullptr}}}; + static std::array last_access{{0}}; + static size_t access_counter = 0; + static Mutex mut; + + auto find_in_cache = [&]() -> std::shared_ptr + { + for (size_t i=0; i(length, vectorize); + { + LockGuard lock(mut); + + auto p = find_in_cache(); + if (p) return p; + + size_t lru = 0; + for (size_t i=1; i class multi_iter + { + private: + shape_t shp, pos; + stride_t str_i, str_o; + size_t cshp_i, cshp_o, rem; + ptrdiff_t cstr_i, cstr_o, sstr_i, sstr_o, p_ii, p_i[N], p_oi, p_o[N]; + bool uni_i, uni_o; + + void advance_i() + { + for (size_t i=0; i=1, "not enough dimensions"); + // Sort the extraneous dimensions in order of ascending output stride; + // this should improve overall cache re-use and avoid clashes between + // threads as much as possible. + shape_t idx(iarr.ndim()); + std::iota(idx.begin(), idx.end(), 0); + sort(idx.begin(), idx.end(), + [&oarr](size_t i1, size_t i2) {return oarr.stride(i1) < oarr.stride(i2);}); + for (auto i: idx) + if (i!=idim) + { + pos.push_back(0); + MR_assert(iarr.shape(i)==oarr.shape(i), "shape mismatch"); + shp.push_back(iarr.shape(i)); + str_i.push_back(iarr.stride(i)); + str_o.push_back(oarr.stride(i)); + } + MR_assert(idim0) + { + sstr_i = str_i[0]; + sstr_o = str_o[0]; + } + + if (nshares==1) return; + if (nshares==0) throw std::runtime_error("can't run with zero threads"); + if (myshare>=nshares) throw std::runtime_error("impossible share requested"); + auto [lo, hi] = calcShare(nshares, myshare, rem); + size_t todo = hi-lo; + + size_t chunk = rem; + for (size_t i2=0, i=pos.size()-1; i2(stride_in() *tsz)&4095)==0) + || ((abs(stride_out()*tsz)&4095)==0); + } + bool critical_stride_other(size_t tsz) const + { + if (unistride_i()==0) return false; // it's just one transform + return ((abs(unistride_i()*tsz)&4095)==0) + || ((abs(unistride_o()*tsz)&4095)==0); + } + }; + +template class TmpStorage + { + private: + aligned_array d; + size_t dofs, dstride; + + public: + TmpStorage(size_t n_trafo, size_t bufsize_data, size_t bufsize_trafo, + size_t n_simultaneous, bool inplace) + { + if (inplace) + { + d.resize(bufsize_trafo); + return; + } + constexpr auto vlen = fft_simdlen; + // FIXME: when switching to C++20, use bit_floor(othersize) + size_t buffct = std::min(vlen, n_trafo); + size_t datafct = std::min(vlen, n_trafo); + if (n_trafo>=n_simultaneous*vlen) datafct = n_simultaneous*vlen; + dstride = bufsize_data; + dofs = bufsize_trafo; + // critical stride avoidance + if ((dstride&256)==0) dstride+=16; + if ((dofs&256)==0) dofs += 16; + d.resize(buffct*dofs + datafct*dstride); + } + + template T2 *transformBuf() + { return reinterpret_cast(d.data()); } + template T2 *dataBuf() + { return reinterpret_cast(d.data()) + dofs; } + size_t data_stride() const + { return dstride; } + }; + +template class TmpStorage2 + { + private: + TmpStorage &stg; + + public: + using datatype = T2; + TmpStorage2(TmpStorage &stg_): stg(stg_) {} + + T2 *transformBuf() { return stg.template transformBuf(); } + T2 *dataBuf() { return stg.template dataBuf(); } + size_t data_stride() const { return stg.data_stride(); } + }; + +template DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav> &src, Cmplx *DUCC0_RESTRICT dst) + { + constexpr auto vlen=Tsimd::size(); + const Cmplx * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i tmp; + for (size_t j=0; j DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav &src, Tsimd *DUCC0_RESTRICT dst) + { + constexpr auto vlen=Tsimd::size(); + const typename Tsimd::value_type * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav &src, T *DUCC0_RESTRICT dst) + { + const T * DUCC0_RESTRICT ptr = src.data(); + if (dst == &src.raw(it.iofs(0))) return; // in-place + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const Cmplx *DUCC0_RESTRICT src, vfmav> &dst) + { + constexpr auto vlen=Tsimd::size(); + Cmplx * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i tmp(src[i]); + for (size_t j=0; j DUCC0_NOINLINE void copy_output(const Titer &it, + const Tsimd *DUCC0_RESTRICT src, vfmav &dst) + { + constexpr auto vlen=Tsimd::size(); + typename Tsimd::value_type * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const T *DUCC0_RESTRICT src, vfmav &dst) + { + T * DUCC0_RESTRICT ptr=dst.data(); + if (src == &dst.raw(it.oofs(0))) return; // in-place + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav> &src, Cmplx * DUCC0_RESTRICT dst, size_t nvec, size_t vstr) + { + constexpr auto vlen=Tsimd::size(); + const Cmplx * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav> &src, Cmplx * DUCC0_RESTRICT dst, size_t nvec, size_t vstr) + { + const Cmplx * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav &src, Tsimd * DUCC0_RESTRICT dst, size_t nvec, size_t vstr) + { + constexpr auto vlen=Tsimd::size(); + const typename Tsimd::value_type * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav &src, T * DUCC0_RESTRICT dst, size_t nvec, size_t vstr) + { + const T * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const Cmplx * DUCC0_RESTRICT src, vfmav> &dst, size_t nvec, size_t vstr) + { + constexpr auto vlen=Tsimd::size(); + Cmplx * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i tmp(src[j0*vstr+i]); + for (size_t j1=0; j1 DUCC0_NOINLINE void copy_output(const Titer &it, + const Cmplx * DUCC0_RESTRICT src, vfmav> &dst, size_t nvec, size_t vstr) + { + Cmplx * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const Tsimd * DUCC0_RESTRICT src, vfmav &dst, size_t nvec, size_t vstr) + { + constexpr auto vlen=Tsimd::size(); + typename Tsimd::value_type * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const T * DUCC0_RESTRICT src, vfmav &dst, size_t nvec, size_t vstr) + { + T * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i struct add_vec + { using type = typename simd_select::type; }; +template struct add_vec, vlen> + { using type = Cmplx::type>; }; +template using add_vec_t = typename add_vec::type; + +template +DUCC0_NOINLINE void general_nd(const cfmav &in, vfmav &out, + const shape_t &axes, T0 fct, size_t nthreads, const Exec &exec, + const bool /*allow_inplace*/=true) + { + if ((in.ndim()==1)&&(in.stride(0)==1)&&(out.stride(0)==1)) + { + auto plan = get_plan(in.shape(0), true); + exec.exec_simple(in.data(), out.data(), *plan, fct, nthreads); + return; + } + std::shared_ptr plan, vplan; + size_t nth1d = (in.ndim()==1) ? nthreads : 1; + + for (size_t iax=0; iaxlength())) + { + plan = get_plan(len, in.ndim()==1); + vplan = ((in.ndim()==1)||(len<300)||((len&3)!=0)) ? + plan : get_plan(len, true); + } + + execParallel(util::thread_count(nthreads, in, axes[iax], fft_simdlen), + [&](Scheduler &sched) + { + constexpr auto vlen = fft_simdlen; + constexpr size_t nmax = 16; + const auto &tin(iax==0? in : out); + multi_iter it(tin, out, axes[iax], sched.num_threads(), sched.thread_num()); + + // n_simul: vector size + // n_bunch: total size of bunch (multiple of n_simul) + size_t n_simul=1, n_bunch=1; + bool critstride = (((in.stride(axes[iax])*sizeof(T))&4095)==0) + || (((out.stride(axes[iax])*sizeof(T))&4095)==0); + bool nostride = (in.stride(axes[iax])==1) && (out.stride(axes[iax])==1); + + constexpr size_t l2cache=262144*2; + constexpr size_t cacheline=64; + + // working set size + auto wss = [&](size_t vl) { return sizeof(T)*(2*len*vl + plan->bufsize()); }; + // is the FFT small enough to fit into L2 vectorized? + if (wss(1)>l2cache) // "long" FFT, don't execute more than one at the same time + { + n_simul=1; + if (critstride) // make bunch large to reduce overall copy cost + { + n_bunch=n_simul; + while ((n_bunch storage(in.size()/len, len, max(plan->bufsize(),vplan->bufsize()), (n_bunch+vlen-1)/vlen, inplace); + + // first, do all possible steps of size n_bunch, then n_simul + if (n_bunch>1) + { +#ifndef DUCC0_NO_SIMD + if constexpr (vlen>1) + { + constexpr size_t lvlen = vlen; + if (n_simul>=lvlen) + { + if ((n_bunch>n_simul) && (it.remaining()>=n_bunch)) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=n_bunch) + { + it.advance(n_bunch); + exec.exec_n(it, tin, out, storage2, *plan, fct, n_bunch/lvlen, nth1d); + } + } + } + if (n_simul==lvlen) + { + if (it.remaining()>=lvlen) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=lvlen) + { + it.advance(lvlen); + exec(it, tin, out, storage2, *plan, fct, nth1d); + } + } + } + } + if constexpr ((vlen>2) && (simd_exists)) + { + constexpr size_t lvlen = vlen/2; + if (n_simul>=lvlen) + { + if ((n_bunch>n_simul) && (it.remaining()>=n_bunch)) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=n_bunch) + { + it.advance(n_bunch); + exec.exec_n(it, tin, out, storage2, *plan, fct, n_bunch/lvlen, nth1d); + } + } + } + if (n_simul==lvlen) + { + if (it.remaining()>=lvlen) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=lvlen) + { + it.advance(lvlen); + exec(it, tin, out, storage2, *plan, fct, nth1d); + } + } + } + } + if constexpr ((vlen>4) && (simd_exists)) + { + constexpr size_t lvlen = vlen/4; + if (n_simul>=lvlen) + { + if ((n_bunch>n_simul) && (it.remaining()>=n_bunch)) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=n_bunch) + { + it.advance(n_bunch); + exec.exec_n(it, tin, out, storage2, *plan, fct, n_bunch/lvlen, nth1d); + } + } + } + if (n_simul==lvlen) + { + if (it.remaining()>=lvlen) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=lvlen) + { + it.advance(lvlen); + exec(it, tin, out, storage2, *plan, fct, nth1d); + } + } + } + } +#endif + { + TmpStorage2 storage2(storage); + while ((n_bunch>n_simul) && (it.remaining()>=n_bunch)) + { + it.advance(n_bunch); + exec.exec_n(it, tin, out, storage2, *vplan, fct, n_bunch, nth1d); + } + } + } + { + TmpStorage2 storage2(storage); + while (it.remaining()>0) + { + it.advance(1); + exec(it, tin, out, storage2, *vplan, fct, nth1d, inplace); + } + } + }); // end of parallel region + fct = T0(1); // factor has been applied, use 1 for remaining axes + } + } + +struct ExecC2C + { + bool forward; + + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav> &in, + vfmav> &out, Tstorage &storage, const pocketfft_c &plan, T0 fct, + size_t nthreads, bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same, T>::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, forward, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, forward, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav> &in, + vfmav> &out, Tstorage &storage, const pocketfft_c &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const Cmplx *in, Cmplx *out, const pocketfft_c &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, forward, nthreads); + } + }; + +struct ExecHartley + { + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav &in, vfmav &out, + Tstorage &storage, const pocketfft_hartley &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const pocketfft_hartley &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const pocketfft_hartley &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, nthreads); + } + }; + +struct ExecFHT + { + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav &in, vfmav &out, + Tstorage &storage, const pocketfft_fht &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const pocketfft_fht &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const pocketfft_fht &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, nthreads); + } + }; + +struct ExecFFTW + { + bool forward; + + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav &in, vfmav &out, + Tstorage &storage, const pocketfft_fftw &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, forward, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, forward, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const pocketfft_fftw &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const pocketfft_fftw &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, forward, nthreads); + } + }; + +struct ExecDcst + { + bool ortho; + int type; + bool cosine; + + template + DUCC0_NOINLINE void operator() (const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const Tplan &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, ortho, type, cosine, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, ortho, type, cosine, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const Tplan &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const Tplan &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, ortho, type, cosine, nthreads); + } + }; + +template DUCC0_NOINLINE void general_r2c( + const cfmav &in, vfmav> &out, size_t axis, bool forward, T fct, + size_t nthreads) + { + size_t nth1d = (in.ndim()==1) ? nthreads : 1; + auto plan = std::make_unique>(in.shape(axis)); + size_t len=in.shape(axis); + execParallel( + util::thread_count(nthreads, in, axis, fft_simdlen), + [&](Scheduler &sched) { + constexpr auto vlen = fft_simdlen; + TmpStorage storage(in.size()/len, len, plan->bufsize(), 1, false); + multi_iter it(in, out, axis, sched.num_threads(), sched.thread_num()); +#ifndef DUCC0_NO_SIMD + if constexpr (vlen>1) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + while (it.remaining()>=vlen) + { + it.advance(vlen); + copy_input(it, in, dbuf); + auto res = plan->exec(dbuf, tbuf, fct, true, nth1d); + auto vout = out.data(); + for (size_t j=0; j2) + if constexpr (simd_exists) + if (it.remaining()>=vlen/2) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + it.advance(vlen/2); + copy_input(it, in, dbuf); + auto res = plan->exec(dbuf, tbuf, fct, true, nth1d); + auto vout = out.data(); + for (size_t j=0; j4) + if constexpr( simd_exists) + if (it.remaining()>=vlen/4) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + it.advance(vlen/4); + copy_input(it, in, dbuf); + auto res = plan->exec(dbuf, tbuf, fct, true, nth1d); + auto vout = out.data(); + for (size_t j=0; j storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + while (it.remaining()>0) + { + it.advance(1); + copy_input(it, in, dbuf); + auto res = plan->exec(dbuf, tbuf, fct, true, nth1d); + auto vout = out.data(); + vout[it.oofs(0)].Set(res[0]); + size_t i=1, ii=1; + if (forward) + for (; i DUCC0_NOINLINE void general_c2r( + const cfmav> &in, vfmav &out, size_t axis, bool forward, T fct, + size_t nthreads) + { + size_t nth1d = (in.ndim()==1) ? nthreads : 1; + auto plan = std::make_unique>(out.shape(axis)); + size_t len=out.shape(axis); + execParallel( + util::thread_count(nthreads, in, axis, fft_simdlen), + [&](Scheduler &sched) { + constexpr auto vlen = fft_simdlen; + TmpStorage storage(out.size()/len, len, plan->bufsize(), 1, false); + multi_iter it(in, out, axis, sched.num_threads(), sched.thread_num()); +#ifndef DUCC0_NO_SIMD + if constexpr (vlen>1) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + while (it.remaining()>=vlen) + { + it.advance(vlen); + for (size_t j=0; jexec(dbuf, tbuf, fct, false, nth1d); + copy_output(it, res, out); + } + } + if constexpr (vlen>2) + if constexpr (simd_exists) + if (it.remaining()>=vlen/2) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + it.advance(vlen/2); + for (size_t j=0; jexec(dbuf, tbuf, fct, false, nth1d); + copy_output(it, res, out); + } + if constexpr (vlen>4) + if constexpr(simd_exists) + if (it.remaining()>=vlen/4) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + it.advance(vlen/4); + for (size_t j=0; jexec(dbuf, tbuf, fct, false, nth1d); + copy_output(it, res, out); + } +#endif + { + TmpStorage2 storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + while (it.remaining()>0) + { + it.advance(1); + dbuf[0]=in.raw(it.iofs(0)).r; + { + size_t i=1, ii=1; + if (forward) + for (; iexec(dbuf, tbuf, fct, false, nth1d); + copy_output(it, res, out); + } + } + }); // end of parallel region + } + +struct ExecR2R + { + bool r2c, forward; + + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav &in, vfmav &out, Tstorage &storage, + const pocketfft_r &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + T *buf1=storage.transformBuf(), *buf2=out.data()+it.oofs(0); + if (in.data()!=buf2) + copy_input(it, in, buf2); + if ((!r2c) && forward) + for (size_t i=2; i DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const pocketfft_r &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + if ((!r2c) && forward) + for (size_t k=0; k DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const pocketfft_r &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + if ((!r2c) && forward) + for (size_t i=2; i DUCC0_NOINLINE void c2c(const cfmav> &in, + vfmav> &out, const shape_t &axes, bool forward, + T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + const auto &in2(reinterpret_cast >&>(in)); + auto &out2(reinterpret_cast >&>(out)); + if ((axes.size()>1) && (in.data()!=out.data())) // optimize axis order + { + if ((in.stride(axes[0])!=1)&&(out.stride(axes[0])==1)) + { + shape_t axes2(axes); + swap(axes2[0],axes2.back()); + general_nd>(in2, out2, axes2, fct, nthreads, ExecC2C{forward}); + return; + } + for (size_t i=1; i>(in2, out2, axes2, fct, nthreads, ExecC2C{forward}); + return; + } + } + general_nd>(in2, out2, axes, fct, nthreads, ExecC2C{forward}); + } + +template DUCC0_NOINLINE void dct(const cfmav &in, vfmav &out, + const shape_t &axes, int type, T fct, bool ortho, size_t nthreads) + { + if ((type<1) || (type>4)) throw std::invalid_argument("invalid DCT type"); + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + const ExecDcst exec{ortho, type, true}; + if (type==1) + general_nd>(in, out, axes, fct, nthreads, exec); + else if (type==4) + general_nd>(in, out, axes, fct, nthreads, exec); + else + general_nd>(in, out, axes, fct, nthreads, exec); + } + +template DUCC0_NOINLINE void dst(const cfmav &in, vfmav &out, + const shape_t &axes, int type, T fct, bool ortho, size_t nthreads) + { + if ((type<1) || (type>4)) throw std::invalid_argument("invalid DST type"); + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + const ExecDcst exec{ortho, type, false}; + if (type==1) + general_nd>(in, out, axes, fct, nthreads, exec); + else if (type==4) + general_nd>(in, out, axes, fct, nthreads, exec); + else + general_nd>(in, out, axes, fct, nthreads, exec); + } + +template DUCC0_NOINLINE void r2c(const cfmav &in, + vfmav> &out, size_t axis, bool forward, T fct, + size_t nthreads) + { + util::sanity_check_cr(out, in, axis); + if (in.size()==0) return; + auto &out2(reinterpret_cast>&>(out)); + general_r2c(in, out2, axis, forward, fct, nthreads); + } + +template DUCC0_NOINLINE void r2c(const cfmav &in, + vfmav> &out, const shape_t &axes, + bool forward, T fct, size_t nthreads) + { + util::sanity_check_cr(out, in, axes); + if (in.size()==0) return; + r2c(in, out, axes.back(), forward, fct, nthreads); + if (axes.size()==1) return; + + auto newaxes = shape_t{axes.begin(), --axes.end()}; + c2c(out, out, newaxes, forward, T(1), nthreads); + } + +template DUCC0_NOINLINE void c2r(const cfmav> &in, + vfmav &out, size_t axis, bool forward, T fct, size_t nthreads) + { + util::sanity_check_cr(in, out, axis); + if (in.size()==0) return; + const auto &in2(reinterpret_cast>&>(in)); + general_c2r(in2, out, axis, forward, fct, nthreads); + } + +template DUCC0_NOINLINE void c2r(const cfmav> &in, + vfmav &out, const shape_t &axes, bool forward, T fct, + size_t nthreads) + { + if (axes.size()==1) + return c2r(in, out, axes[0], forward, fct, nthreads); + util::sanity_check_cr(in, out, axes); + if (in.size()==0) return; + auto atmp(vfmav>::build_noncritical(in.shape(), UNINITIALIZED)); + auto newaxes = shape_t{axes.begin(), --axes.end()}; + c2c(in, atmp, newaxes, forward, T(1), nthreads); + c2r(atmp, out, axes.back(), forward, fct, nthreads); + } + +template DUCC0_NOINLINE void c2r_mut(vfmav> &in, + vfmav &out, const shape_t &axes, bool forward, T fct, + size_t nthreads) + { + if (axes.size()==1) + return c2r(in, out, axes[0], forward, fct, nthreads); + util::sanity_check_cr(in, out, axes); + if (in.size()==0) return; + auto newaxes = shape_t{axes.begin(), --axes.end()}; + c2c(in, in, newaxes, forward, T(1), nthreads); + c2r(in, out, axes.back(), forward, fct, nthreads); + } + +template DUCC0_NOINLINE void r2r_fftpack(const cfmav &in, + vfmav &out, const shape_t &axes, bool real2hermitian, bool forward, + T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + general_nd>(in, out, axes, fct, nthreads, + ExecR2R{real2hermitian, forward}); + } + +template DUCC0_NOINLINE void r2r_fftw(const cfmav &in, + vfmav &out, const shape_t &axes, bool forward, + T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + general_nd>(in, out, axes, fct, nthreads, + ExecFFTW{forward}); + } + +template DUCC0_NOINLINE void r2r_separable_hartley(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + general_nd>(in, out, axes, fct, nthreads, + ExecHartley{}, false); + } + +template DUCC0_NOINLINE void r2r_separable_fht(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + general_nd>(in, out, axes, fct, nthreads, + ExecFHT{}, false); + } + +template void hermiteHelper(size_t idim, ptrdiff_t iin, + ptrdiff_t iout0, ptrdiff_t iout1, const cfmav &c, + vfmav &r, const shape_t &axes, Func func, size_t nthreads) + { + auto cstr=c.stride(idim), str=r.stride(idim); + auto len=r.shape(idim); + + if (idim+1==c.ndim()) // last dimension, not much gain in parallelizing + { + if (idim==axes.back()) // halfcomplex axis + for (size_t i=0,ic=0; i void oscarize(vfmav &data, size_t ax0, size_t ax1, + size_t nthreads) + { + auto nu=data.shape(ax0), nv=data.shape(ax1); + if ((nu<3)||(nv<3)) return; + vector slc(data.ndim()); + slc[ax0] = slice(1,(nu+1)/2); + slc[ax1] = slice(1,(nv+1)/2); + auto all = subarray(data, slc); + slc[ax0] = slice(nu-1,nu/2,-1); + auto ahl = subarray(data, slc); + slc[ax1] = slice(nv-1,nv/2,-1); + auto ahh = subarray(data, slc); + slc[ax0] = slice(1,(nu+1)/2); + auto alh = subarray(data, slc); + mav_apply([](T &ll, T &hl, T &hh, T &lh) + { + T tll=ll, thl=hl, tlh=lh, thh=hh; + T v = T(0.5)*(tll+tlh+thl+thh); + ll = v-thh; + hl = v-tlh; + lh = v-thl; + hh = v-tll; + }, nthreads, all, ahl, ahh, alh); + } + +template void r2r_genuine_hartley(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads) + { + if (axes.size()==1) + return r2r_separable_hartley(in, out, axes, fct, nthreads); + if (axes.size()==2) + { + r2r_separable_hartley(in, out, axes, fct, nthreads); + oscarize(out, axes[0], axes[1], nthreads); + return; + } + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + shape_t tshp(in.shape()); + tshp[axes.back()] = tshp[axes.back()]/2+1; + auto atmp(vfmav>::build_noncritical(tshp, UNINITIALIZED)); + r2c(in, atmp, axes, true, fct, nthreads); + hermiteHelper(0, 0, 0, 0, atmp, out, axes, [](const std::complex &c, T &r0, T &r1) + { + r0 = c.real()+c.imag(); + r1 = c.real()-c.imag(); + }, nthreads); + } + +template void r2r_genuine_fht(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads) + { + if (axes.size()==1) + return r2r_separable_fht(in, out, axes, fct, nthreads); + if (axes.size()==2) + { + r2r_separable_fht(in, out, axes, fct, nthreads); + oscarize(out, axes[0], axes[1], nthreads); + return; + } + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + shape_t tshp(in.shape()); + tshp[axes.back()] = tshp[axes.back()]/2+1; + auto atmp(vfmav>::build_noncritical(tshp, UNINITIALIZED)); + r2c(in, atmp, axes, true, fct, nthreads); + hermiteHelper(0, 0, 0, 0, atmp, out, axes, [](const std::complex &c, T &r0, T &r1) + { + r0 = c.real()-c.imag(); + r1 = c.real()+c.imag(); + }, nthreads); + } + +template +DUCC0_NOINLINE void general_convolve_axis(const cfmav &in, vfmav &out, + const size_t axis, const cmav &kernel, size_t nthreads, + const Exec &exec) + { + std::unique_ptr plan1, plan2; + + size_t l_in=in.shape(axis), l_out=out.shape(axis); + MR_assert(kernel.size()==l_in, "bad kernel size"); + plan1 = std::make_unique(l_in); + plan2 = std::make_unique(l_out); + size_t bufsz = max(plan1->bufsize(), plan2->bufsize()); + + vmav fkernel({kernel.shape(0)}, UNINITIALIZED); + for (size_t i=0; iexec(fkernel.data(), T0(1)/T0(l_in), true, nthreads); + + execParallel( + util::thread_count(nthreads, in, axis, fft_simdlen), + [&](Scheduler &sched) { + constexpr auto vlen = fft_simdlen; + TmpStorage storage(in.size()/l_in, l_in+l_out, bufsz, 1, false); + multi_iter it(in, out, axis, sched.num_threads(), sched.thread_num()); +#ifndef DUCC0_NO_SIMD + if constexpr (vlen>1) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=vlen) + { + it.advance(vlen); + exec(it, in, out, storage2, *plan1, *plan2, fkernel); + } + } + if constexpr (vlen>2) + if constexpr (simd_exists) + if (it.remaining()>=vlen/2) + { + TmpStorage2,T,T0> storage2(storage); + it.advance(vlen/2); + exec(it, in, out, storage2, *plan1, *plan2, fkernel); + } + if constexpr (vlen>4) + if constexpr (simd_exists) + if (it.remaining()>=vlen/4) + { + TmpStorage2,T,T0> storage2(storage); + it.advance(vlen/4); + exec(it, in, out, storage2, *plan1, *plan2, fkernel); + } +#endif + { + TmpStorage2 storage2(storage); + while (it.remaining()>0) + { + it.advance(1); + exec(it, in, out, storage2, *plan1, *plan2, fkernel); + } + } + }); // end of parallel region + } + +struct ExecConv1R + { + template void operator() ( + const Titer &it, const cfmav &in, vfmav &out, + Tstorage &storage, const pocketfft_r &plan1, const pocketfft_r &plan2, + const cmav &fkernel) const + { + using T = typename Tstorage::datatype; + size_t l_in = plan1.length(), + l_out = plan2.length(), + l_min = std::min(l_in, l_out); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + plan1.exec_copyback(buf2, buf1, T0(1), true); + auto res = buf2; + { + res[0] *= fkernel(0); + size_t i; + for (i=1; 2*i t1(res[2*i-1], res[2*i]); + Cmplx t2(fkernel(2*i-1), fkernel(2*i)); + auto t3 = t1*t2; + res[2*i-1] = t3.r; + res[2*i] = t3.i; + } + if (2*i==l_min) + { + if (l_min t1(res[2*i-1], res[2*i]); + Cmplx t2(fkernel(2*i-1), fkernel(2*i)); + res[2*i-1] = (t1*t2).r*T0(2); + } + else + res[2*i-1] *= fkernel(2*i-1); + } + } + for (size_t i=l_in; i void operator() ( + const Titer &it, const cfmav> &in, vfmav> &out, + Tstorage &storage, const pocketfft_c &plan1, const pocketfft_c &plan2, + const cmav,1> &fkernel) const + { + using T = typename Tstorage::datatype; + size_t l_in = plan1.length(), + l_out = plan2.length(), + l_min = std::min(l_in, l_out); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan1.exec(buf2, buf1, T0(1), true); + auto res2 = buf2+l_in; + { + res2[0] = res[0]*fkernel(0); + size_t i; + for (i=1; 2*i DUCC0_NOINLINE void convolve_axis(const cfmav &in, + vfmav &out, size_t axis, const cmav &kernel, size_t nthreads) + { + MR_assert(axis, T>(in, out, axis, kernel, nthreads, + ExecConv1R()); + } +template DUCC0_NOINLINE void convolve_axis(const cfmav> &in, + vfmav> &out, size_t axis, const cmav,1> &kernel, + size_t nthreads) + { + MR_assert(axis>&>(in)); + auto &out2(reinterpret_cast>&>(out)); + const auto &kernel2(reinterpret_cast,1>&>(kernel)); + general_convolve_axis, T>(in2, out2, axis, kernel2, nthreads, + ExecConv1C()); + } + +} // namespace detail_fft + +} // namespace ducc0 + +#endif // POCKETFFT_HDRONLY_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/infra/mav.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/infra/mav.h new file mode 100644 index 0000000000000000000000000000000000000000..820de6de1d18431a2da86eccab59c23c637b6097 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/infra/mav.h @@ -0,0 +1,1358 @@ +/*! \file ducc0/infra/mav.h + * Classes for dealing with multidimensional arrays + * + * \copyright Copyright (C) 2019-2023 Max-Planck-Society + * \author Martin Reinecke + * */ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_MAV_H +#define DUCC0_MAV_H + +#include +#include +#include +#include +#include +#include +#include +#include "ducc0/infra/error_handling.h" +#include "ducc0/infra/aligned_array.h" +#include "ducc0/infra/misc_utils.h" +#include "ducc0/infra/threading.h" + +namespace ducc0 { + +namespace detail_mav { + +using namespace std; + +// the next line is necessary to address some sloppy name choices in hipSYCL +using std::min, std::max; + +struct uninitialized_dummy {}; +constexpr uninitialized_dummy UNINITIALIZED; + +template class cmembuf + { + protected: + shared_ptr> ptr; + shared_ptr> rawptr; + const T *d; + + cmembuf(const T *d_, const cmembuf &other) + : ptr(other.ptr), rawptr(other.rawptr), d(d_) {} + + // externally owned data pointer + cmembuf(const T *d_) + : d(d_) {} + // share another memory buffer, but read-only + cmembuf(const cmembuf &other) + : ptr(other.ptr), rawptr(other.rawptr), d(other.d) {} + cmembuf(size_t sz) + : ptr(make_shared>(sz)), d(ptr->data()) {} +#if 1 + cmembuf(size_t sz, uninitialized_dummy) + : rawptr(make_shared>(sz)), d(rawptr->data()) {} +# else // "poison" the array with a fixed value; use for debugging + cmembuf(size_t sz, uninitialized_dummy) + : rawptr(make_shared>(sz)), d(rawptr->data()) + { for (size_t i=0; i const T &raw(I i) const + { return d[i]; } + // read access to data area + const T *data() const + { return d; } + }; + +constexpr size_t MAXIDX=~(size_t(0)); + +struct slice + { + size_t beg, end; + ptrdiff_t step; + slice() : beg(0), end(MAXIDX), step(1) {} + slice(size_t idx) : beg(idx), end(idx), step(1) {} + slice(size_t beg_, size_t end_, ptrdiff_t step_=1) + : beg(beg_), end(end_), step(step_) + { +// FIXME: add sanity checks here + } + + size_t size(size_t shp) const + { + if (beg==end) return 0; + if (step>0) return (min(shp,end)-beg+step-1)/step; + // negative step + if (end==MAXIDX) + return (beg-step)/(-step); + return (beg-end-step-1)/(-step); + } + }; + +/// Helper class containing shape and stride information of an `fmav` object +class fmav_info + { + public: + /// vector of nonnegative integers for storing the array shape + using shape_t = vector; + /// vector of integers for storing the array strides + using stride_t = vector; + + protected: + shape_t shp; + stride_t str; + size_t sz; + + static stride_t shape2stride(const shape_t &shp) + { + auto ndim = shp.size(); + // MR using the static_cast just to avoid a GCC warning. +// stride_t res(ndim); + stride_t res(static_cast(ndim)); + if (ndim==0) return res; + res[ndim-1]=1; + for (size_t i=2; i<=ndim; ++i) + res[ndim-i] = res[ndim-i+1]*ptrdiff_t(shp[ndim-i+1]); + return res; + } + template ptrdiff_t getIdx(size_t dim, size_t n, Ns... ns) const + { return str[dim]*ptrdiff_t(n) + getIdx(dim+1, ns...); } + ptrdiff_t getIdx(size_t dim, size_t n) const + { return str[dim]*ptrdiff_t(n); } + ptrdiff_t getIdx(size_t /*dim*/) const + { return 0; } + + public: + /// Constructs a 1D object with all extents and strides set to zero. + fmav_info() : shp(1,0), str(1,0), sz(0) {} + /// Constructs an object with the given shape and stride. + fmav_info(const shape_t &shape_, const stride_t &stride_) + : shp(shape_), str(stride_), + sz(accumulate(shp.begin(),shp.end(),size_t(1),multiplies<>())) + { + MR_assert(shp.size()==str.size(), "dimensions mismatch"); + } + /// Constructs an object with the given shape and computes the strides + /// automatically, assuming a C-contiguous memory layout. + fmav_info(const shape_t &shape_) + : fmav_info(shape_, shape2stride(shape_)) {} + void assign(const fmav_info &other) + { + shp = other.shp; + str = other.str; + sz = other.sz; + } + /// Returns the dimensionality of the object. + size_t ndim() const { return shp.size(); } + /// Returns the total number of entries in the object. + size_t size() const { return sz; } + /// Returns the shape of the object. + const shape_t &shape() const { return shp; } + /// Returns the length along dimension \a i. + size_t shape(size_t i) const { return shp[i]; } + /// Returns the strides of the object. + const stride_t &stride() const { return str; } + /// Returns the stride along dimension \a i. + const ptrdiff_t &stride(size_t i) const { return str[i]; } + /// Returns true iff the last dimension has stride 1. + /** Typically used for optimization purposes. */ + bool last_contiguous() const + { return ((ndim()==0) || (str.back()==1)); } + /** Returns true iff the object is C-contiguous, i.e. if the stride of the + * last dimension is 1, the stride for the next-to-last dimension is the + * shape of the last dimension etc. */ + bool contiguous() const + { + auto ndim = shp.size(); + ptrdiff_t stride=1; + for (size_t i=0; ishape and \a other.shape match. + bool conformable(const fmav_info &other) const + { return shp==other.shp; } + /// Returns the one-dimensional index of an entry from the given + /// multi-dimensional index tuple, taking strides into account. + template ptrdiff_t idx(Ns... ns) const + { + MR_assert(ndim()==sizeof...(ns), "incorrect number of indices"); + return getIdx(0, ns...); + } + ptrdiff_t idx(const shape_t &ns) const + { + MR_assert(ndim()==ns.size(), "incorrect number of indices"); + size_t res = 0; + for (size_t i=0; i ptrdiff_t idxval(RAiter beg, RAiter end) const + { + MR_assert(ndim()==size_t(end-beg), "incorrect number of indices"); + size_t res = 0; + for (size_t i=0; i=shp.size(), "cannot reduce dimensionality"); + stride_t newstr(shp2.size(), 0); + for (size_t i=0; i=ndim(), + "new shape smaller than original one"); + MR_assert(axpos.size()==ndim(), "bad axpos size"); + stride_t new_stride(new_shape.size(), 0); + vector used(new_shape.size(),0); + for (size_t i=0; i &slices) const + { + auto ndim = shp.size(); + shape_t nshp(ndim); + stride_t nstr(ndim); + MR_assert(slices.size()==ndim, "incorrect number of slices"); + size_t n0=0; + for (auto x:slices) if (x.beg==x.end) ++n0; + ptrdiff_t nofs=0; + nshp.resize(ndim-n0); + nstr.resize(ndim-n0); + for (size_t i=0, i2=0; i class mav_info + { + public: + /// Fixed-size array of nonnegative integers for storing the array shape + using shape_t = array; + /// Fixed-size array of integers for storing the array strides + using stride_t = array; + + protected: + shape_t shp; + stride_t str; + size_t sz; + + static stride_t shape2stride(const shape_t &shp) + { + stride_t res; + if (ndim==0) return res; + res[ndim-1]=1; + for (size_t i=2; i<=ndim; ++i) + res[ndim-i] = res[ndim-i+1]*ptrdiff_t(shp[ndim-i+1]); + return res; + } + template ptrdiff_t getIdx(size_t dim, size_t n, Ns... ns) const + { return str[dim]*n + getIdx(dim+1, ns...); } + ptrdiff_t getIdx(size_t dim, size_t n) const + { return str[dim]*n; } + ptrdiff_t getIdx(size_t /*dim*/) const + { return 0; } + + public: + /// Constructs an object with all extents and strides set to zero. + mav_info() : sz(0) + { + for (size_t i=0; i())) {} + /// Constructs an object with the given shape and computes the strides + /// automatically, assuming a C-contiguous memory layout. + mav_info(const shape_t &shape_) + : mav_info(shape_, shape2stride(shape_)) {} + mav_info(const fmav_info &inp) + { + MR_assert(inp.ndim()==ndim, "dimensionality mismatch"); + sz=1; + for (size_t i=0; ishape and \a other.shape match. + bool conformable(const mav_info &other) const + { return shp==other.shp; } + /// Returns true iff this->shape and \a other match. + bool conformable(const shape_t &other) const + { return shp==other; } + /// Returns the one-dimensional index of an entry from the given + /// multi-dimensional index tuple, taking strides into account. + template ptrdiff_t idx(Ns... ns) const + { + static_assert(ndim==sizeof...(ns), "incorrect number of indices"); + return getIdx(0, ns...); + } + mav_info transpose() const + { + shape_t shp2; + stride_t str2; + for (size_t i=0; i prepend_1() const + { + typename mav_info::shape_t newshp; + typename mav_info::stride_t newstr; + newshp[0] = 1; + newstr[0] = 0; + for (size_t i=0; i(newshp, newstr); + } + + protected: + template auto subdata(const vector &slices) const + { + MR_assert(slices.size()==ndim, "bad number of slices"); + array nshp; + array nstr; + + // unnecessary, but gcc warns otherwise + for (size_t i=0; i(nshp, nstr), nofs); + } + }; + +template class cfmav: public fmav_info, public cmembuf + { + protected: + using tbuf = cmembuf; + using tinfo = fmav_info; + using fmav_info::idx; + + public: + using typename tinfo::shape_t; + using typename tinfo::stride_t; + using tbuf::raw, tbuf::data; + + + protected: + cfmav(const shape_t &shp_) + : tinfo(shp_), tbuf(size()) {} + cfmav(const shape_t &shp_, uninitialized_dummy) + : tinfo(shp_), tbuf(size(), UNINITIALIZED) {} + cfmav(const shape_t &shp_, const stride_t &str_, uninitialized_dummy) + : tinfo(shp_, str_), tbuf(size(), UNINITIALIZED) + { + ptrdiff_t ofs=0; + for (size_t i=0; i const T &operator()(Ns... ns) const + { return raw(idx(ns...)); } + const T &operator()(const shape_t &ns) const + { return raw(idx(ns)); } + template const T& val(RAiter beg, RAiter end) const + { return raw(idxval(beg, end)); } + + cfmav subarray(const vector &slices) const + { + auto [ninfo, nofs] = subdata(slices); + return cfmav(ninfo, tbuf::d+nofs, *this); + } + cfmav extend_and_broadcast(const shape_t &new_shape, const shape_t &axpos) const + { + return cfmav(fmav_info::extend_and_broadcast(new_shape, axpos), *this); + } + cfmav extend_and_broadcast(const shape_t &new_shape, size_t firstaxis) const + { + return cfmav(fmav_info::extend_and_broadcast(new_shape, firstaxis), *this); + } + cfmav transpose() const + { + return cfmav(static_cast(this)->transpose(), *static_cast(this)); + } + }; + +template cfmav subarray + (const cfmav &arr, const vector &slices) + { return arr.subarray(slices); } + +template class vfmav: public cfmav + { + protected: + using tbuf = cmembuf; + using tinfo = fmav_info; + using tinfo::shp, tinfo::str; + using fmav_info::idx; + + public: + using typename tinfo::shape_t; + using typename tinfo::stride_t; + using tinfo::size, tinfo::shape, tinfo::stride; + + protected: + vfmav(const fmav_info &info, tbuf &buf) + : cfmav(info, buf) {} + vfmav(const fmav_info &info, T *d_, tbuf &buf) + : cfmav(info, d_, buf) {} + + public: + using tbuf::raw, tbuf::data, tinfo::ndim; + vfmav() {} + vfmav(T *d_, const fmav_info &info) + : cfmav(d_, info) {} + vfmav(T *d_, const shape_t &shp_, const stride_t &str_) + : cfmav(d_, shp_, str_) {} + vfmav(T *d_, const shape_t &shp_) + : cfmav(d_, shp_) {} + vfmav(const shape_t &shp_) + : cfmav(shp_) {} + vfmav(const shape_t &shp_, uninitialized_dummy) + : cfmav(shp_, UNINITIALIZED) {} + vfmav(const shape_t &shp_, const stride_t &str_, uninitialized_dummy) + : cfmav(shp_, str_, UNINITIALIZED) + { + ptrdiff_t ofs=0; + for (size_t i=0; i(buf, shp_, str_) {} + + using cfmav::data; + T *data() + { return const_cast(tbuf::d); } + using cfmav::raw; + template T &raw(I i) + { return data()[i]; } + + // no-op. Needed for template tricks. + using cfmav::to_fmav; + vfmav to_fmav() { return *this; } + + void assign(const vfmav &other) + { + fmav_info::assign(other); + cmembuf::assign(other); + } + + using cfmav::operator(); + template T &operator()(Ns... ns) + { return raw(idx(ns...)); } + T &operator()(const shape_t &ns) + { return raw(idx(ns)); } + using cfmav::val; + template T& val(RAiter beg, RAiter end) + { return raw(idxval(beg, end)); } + + vfmav subarray(const vector &slices) + { + auto [ninfo, nofs] = tinfo::subdata(slices); + return vfmav(ninfo, data()+nofs, *this); + } + /** Returns a writable fmav with the specified shape. + * The strides are chosen in such a way that critical strides (multiples + * of 4096 bytes) along any dimension are avoided, by enlarging the + * allocated memory slightly if necessary. + * The array data is default-initialized. */ + static vfmav build_noncritical(const shape_t &shape) + { + auto ndim = shape.size(); + auto shape2 = noncritical_shape(shape, sizeof(T)); + vfmav tmp(shape2); + vector slc(ndim); + for (size_t i=0; i slc(ndim); + for (size_t i=0; i(this)->transpose(), *static_cast(this)); + } + }; + +template vfmav subarray + (vfmav &arr, const vector &slices) + { return arr.subarray(slices); } + +template class cmav: public mav_info, public cmembuf + { + protected: + template friend class cmav; + template friend class vmav; + + using tinfo = mav_info; + using tbuf = cmembuf; + using tinfo::shp, tinfo::str; + + public: + using typename tinfo::shape_t; + using typename tinfo::stride_t; + using tbuf::raw, tbuf::data; + using tinfo::contiguous, tinfo::size, tinfo::idx, tinfo::conformable; + + protected: + cmav() {} + cmav(const shape_t &shp_, uninitialized_dummy) + : tinfo(shp_), tbuf(size(), UNINITIALIZED) {} + cmav(const shape_t &shp_) + : tinfo(shp_), tbuf(size()) {} + cmav(const tbuf &buf, const shape_t &shp_, const stride_t &str_) + : tinfo(shp_, str_), tbuf(buf) {} + cmav(const tinfo &info, const T *d_, const tbuf &buf) + : tinfo(info), tbuf(d_, buf) {} + cmav(const tinfo &info, const tbuf &buf) + : tinfo(info), tbuf(buf) {} + + public: + cmav(const T *d_, const shape_t &shp_, const stride_t &str_) + : tinfo(shp_, str_), tbuf(d_) {} + cmav(const T *d_, const shape_t &shp_) + : tinfo(shp_), tbuf(d_) {} + cmav(const cfmav &inp) + : tinfo(inp), tbuf(inp) {} + void assign(const cmav &other) + { + mav_info::assign(other); + cmembuf::assign(other); + } + operator cfmav() const + { + return cfmav(*this, {shp.begin(), shp.end()}, {str.begin(), str.end()}); + } + // Needed for template tricks. + cfmav to_fmav() const { return operator cfmav(); } + + template const T &operator()(Ns... ns) const + { return raw(idx(ns...)); } + template cmav subarray(const vector &slices) const + { + auto [ninfo, nofs] = tinfo::template subdata (slices); + return cmav (ninfo, tbuf::d+nofs, *this); + } + + static cmav build_uniform(const shape_t &shape, const T &value) + { + // Don't do this at home! + shape_t tshp; + tshp.fill(1); + cmav tmp(tshp); + const_cast(tmp.raw(0)) = value; + stride_t nstr; + nstr.fill(0); + return cmav(tmp, shape, nstr); + } + cmav transpose() const + { + return cmav(static_cast(this)->transpose(), *static_cast(this)); + } + cmav prepend_1() const + { + return cmav(static_cast(this)->prepend_1(), *static_cast(this)); + } + template cmav reinterpret + (const typename cmav::shape_t &newshp, + const typename cmav::stride_t &newstr) const + { + return cmav(*static_cast(this), newshp, newstr); + } + }; +template cmav subarray + (const cmav &arr, const vector &slices) + { return arr.template subarray(slices); } + +template class vmav: public cmav + { + protected: + template friend class vmav; + + using parent = cmav; + using tinfo = mav_info; + using tbuf = cmembuf; + using tinfo::shp, tinfo::str; + + public: + using typename tinfo::shape_t; + using typename tinfo::stride_t; + using tbuf::raw, tbuf::data; + using tinfo::contiguous, tinfo::size, tinfo::idx, tinfo::conformable; + + protected: + vmav(const tinfo &info, T *d_, tbuf &buf) + : parent(info, d_, buf) {} + vmav(const tinfo &info, tbuf &buf) + : parent(info, buf) {} + vmav(const tbuf &buf, const shape_t &shp_, const stride_t &str_) + : parent(buf, shp_, str_){} + + public: + vmav() {} + vmav(T *d_, const shape_t &shp_, const stride_t &str_) + : parent(d_, shp_, str_) {} + vmav(T *d_, const shape_t &shp_) + : parent(d_, shp_) {} + vmav(const shape_t &shp_) + : parent(shp_) {} + vmav(const shape_t &shp_, uninitialized_dummy) + : parent(shp_, UNINITIALIZED) {} + vmav(vfmav &inp) + : parent(inp) {} + + void assign(vmav &other) + { parent::assign(other); } + void dealloc() + { + vmav empty; + assign(empty); + } + operator vfmav() + { + return vfmav(*this, {shp.begin(), shp.end()}, {str.begin(), str.end()}); + } + // Needed for template tricks. + using cmav::to_fmav; + vfmav to_fmav() { return operator vfmav(); } + + using parent::operator(); + template T &operator()(Ns... ns) + { return const_cast(parent::operator()(ns...)); } + + template vmav subarray(const vector &slices) + { + auto [ninfo, nofs] = tinfo::template subdata (slices); + return vmav (ninfo, data()+nofs, *this); + } + + using parent::data; + T *data() + { return const_cast(tbuf::d); } + // read access to element #i + using parent::raw; + template T &raw(I i) + { return data()[i]; } + + static vmav build_empty() + { + shape_t nshp; + nshp.fill(0); + return vmav(static_cast(nullptr), nshp); + } + + static vmav build_noncritical(const shape_t &shape) + { + auto shape2 = noncritical_shape(shape, sizeof(T)); + vmav tmp(shape2); + vector slc(ndim); + for (size_t i=0; i(slc); + } + static vmav build_noncritical(const shape_t &shape, uninitialized_dummy) + { + if (ndim<=1) return vmav(shape, UNINITIALIZED); + auto shape2 = noncritical_shape(shape, sizeof(T)); + vmav tmp(shape2, UNINITIALIZED); + vector slc(ndim); + for (size_t i=0; i(slc); + } + vmav transpose() + { + return vmav(static_cast(this)->transpose(), *static_cast(this)); + } + vmav prepend_1() + { + return vmav(static_cast(this)->prepend_1(), *static_cast(this)); + } + template vmav reinterpret + (const typename vmav::shape_t &newshp, + const typename vmav::stride_t &newstr) + { + return vmav(*static_cast(this), newshp, newstr); + } + }; + +template vmav subarray + (vmav &arr, const vector &slices) + { return arr.template subarray(slices); } + +// various operations involving fmav objects of the same shape -- experimental + +DUCC0_NOINLINE tuple, size_t, size_t> + multiprep(const vector &info, const vector &tsizes); +DUCC0_NOINLINE tuple> + multiprep(const vector &info); + +template constexpr inline size_t tuplelike_size() + { return tuple_size_v>; } + +template +inline void call_with_tuple_impl(Func &&func, const Ttuple& tuple, + index_sequence) + { func(std::forward::type>(get(tuple))...); } +template inline void call_with_tuple + (Func &&func, Ttuple &&tuple) + { + call_with_tuple_impl(std::forward(func), tuple, + make_index_sequence()>()); + } +template +inline void call_with_tuple2_impl(Func &&func, const Ttuple& tuple, + index_sequence) + { func(get(tuple)...); } +template inline void call_with_tuple2 + (Func &&func, Ttuple &&tuple) + { + call_with_tuple2_impl(std::forward(func), tuple, + make_index_sequence()>()); + } + +template +inline auto tuple_transform_impl(tuple const& inputs, Func &&func, + index_sequence) + { return tuple...>{func(get(inputs))...}; } +template +inline auto tuple_transform(tuple const& inputs, Func &&func) + { + return tuple_transform_impl(inputs, std::forward(func), + make_index_sequence{}); + } +template +inline void tuple_for_each_impl(tuple &tpl, Func &&func, + index_sequence) + { (func(get(tpl)), ...); } +template +inline void tuple_for_each(tuple &tpl, Func &&func) + { + tuple_for_each_impl(tpl, std::forward(func), make_index_sequence{}); + } +template +inline void tuple_for_each_impl(const tuple &tpl, Func &&func, + index_sequence) + { (func(get(tpl)), ...); } +template +inline void tuple_for_each(const tuple &tpl, Func &&func) + { + tuple_for_each_impl(tpl, std::forward(func), make_index_sequence{}); + } + +template +inline auto tuple_transform_idx_impl(const tuple &inputs, + Func &&func, index_sequence) + { + return tuple...> + {func(get(inputs), Is)...}; + } + +template +inline auto tuple_transform_idx(const tuple &inputs, Func &&func) + { + return tuple_transform_idx_impl(inputs, std::forward(func), + make_index_sequence{}); + } +template +inline void tuple_for_each_idx_impl(tuple &tpl, Func &&func, + index_sequence) + { (func(get(tpl), Is), ...); } +template +inline void tuple_for_each_idx(tuple &tpl, Func &&func) + { + tuple_for_each_idx_impl(tpl, std::forward(func), make_index_sequence{}); + } + +template inline auto to_ref (const Ttuple &tuple) + { + return tuple_transform(tuple,[](auto &&ptr) -> typename std::add_lvalue_reference_t{ return *ptr; }); + } + +template inline Ttuple update_pointers (const Ttuple &ptrs, + const vector> &str, size_t idim, size_t i) + { + return tuple_transform_idx(ptrs, [i,idim,&str](auto &&ptr, size_t idx) + { return ptr + i*str[idx][idim]; }); + } + +template inline Ttuple update_pointers_contiguous (const Ttuple &ptrs, + size_t i) + { + return tuple_transform(ptrs, [i](auto &&ptr) { return ptr+i; }); + } +template inline void advance_contiguous (Ttuple &ptrs) + { tuple_for_each(ptrs, [](auto &&ptr) { ++ptr; }); } +template inline void advance (Ttuple &ptrs, + const vector> &str, size_t idim) + { + tuple_for_each_idx(ptrs, [idim,&str](auto &&ptr, size_t idx) + { ptr += str[idx][idim]; }); + } +template inline void advance_by_n (Ttuple &ptrs, + const vector> &str, size_t idim, size_t n) + { + tuple_for_each_idx(ptrs, [idim,n,&str](auto &&ptr, size_t idx) + { ptr += n*str[idx][idim]; }); + } + +template + DUCC0_NOINLINE void applyHelper_block(size_t idim, const vector &shp, + const vector> &str, size_t bsi, size_t bsj, + const Ttuple &ptrs, Func &&func) + { + auto leni=shp[idim], lenj=shp[idim+1]; + size_t nbi = (leni+bsi-1)/bsi; + size_t nbj = (lenj+bsj-1)/bsj; + for (size_t bi=0; bi + DUCC0_NOINLINE void applyHelper(size_t idim, const vector &shp, + const vector> &str, size_t block0, size_t block1, + const Ttuple &ptrs, Func &&func, bool last_contiguous) + { + auto len = shp[idim]; + if ((idim+2==shp.size()) && (block0!=0)) // we should do blocking + applyHelper_block(idim, shp, str, block0, block1, ptrs, func); + else if (idim+1 + inline void applyHelper(const vector &shp, + const vector> &str, size_t block0, size_t block1, + const Ttuple &ptrs, Func &&func, size_t nthreads, bool last_contiguous) + { + if (shp.size()==0) + call_with_tuple(std::forward(func), to_ref(ptrs)); + else if (nthreads==1) + applyHelper(0, shp, str, block0, block1, ptrs, std::forward(func), last_contiguous); + else + execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) + { + auto locptrs = update_pointers(ptrs, str, 0, lo); + auto locshp(shp); + locshp[0] = hi-lo; + applyHelper(0, locshp, str, block0, block1, locptrs, func, last_contiguous); + }); + } + +template + void mav_apply(Func &&func, int nthreads, Targs... args) + { + vector infos; + (infos.push_back(args), ...); + vector tsizes; + (tsizes.push_back(sizeof(args.data()[0])), ...); + auto [shp, str, block0, block1] = multiprep(infos, tsizes); + bool last_contiguous = true; + if (shp.size()>0) + for (const auto &s:str) + last_contiguous &= (s.back()==1); + + auto ptrs = tuple_transform(forward_as_tuple(args...), + [](auto &&arg){return arg.data();}); + applyHelper(shp, str, block0, block1, ptrs, std::forward(func), nthreads, last_contiguous); + } + +DUCC0_NOINLINE tuple> + multiprep_noopt(const vector &info); + +template +inline void call_with_tuple_arg_impl(Func &&func, Arg &&arg, const Ttuple& tuple, + index_sequence) + { func(std::forward::type>(get(tuple))..., arg); } +template inline void call_with_tuple_arg + (Func &&func, Arg &&arg, Ttuple &&tuple) + { + call_with_tuple_arg_impl(std::forward(func), arg, tuple, + make_index_sequence()>()); + } +template + DUCC0_NOINLINE void applyHelper_with_index(size_t idim, const vector &shp, + const vector> &str, const Ttuple &ptrs, Func &&func, + vector &index) + { + auto len = shp[idim]; + if (idim+1 &>(index), to_ref(locptrs)); + index[idim] = idxbak; + } + } +template + inline void applyHelper_with_index(const vector &shp, + const vector> &str, const Ttuple &ptrs, Func &&func, + size_t nthreads, vector &index) + { + if (shp.size()==0) + call_with_tuple_arg(std::forward(func), const_cast &>(index), to_ref(ptrs)); + else if (nthreads==1) + applyHelper_with_index(0, shp, str, ptrs, std::forward(func), index); + else + execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) + { + auto locptrs = update_pointers(ptrs, str, 0, lo); + auto locshp(shp); + locshp[0] = hi-lo; + auto locidx(index); + locidx[0]=lo; + applyHelper_with_index(0, locshp, str, locptrs, func, locidx); + }); + } +template + void mav_apply_with_index(Func &&func, int nthreads, Targs... args) + { + vector infos; + (infos.push_back(args), ...); + auto [shp, str] = multiprep_noopt(infos); + vector index(shp.size(), 0); + + auto ptrs = tuple_transform(forward_as_tuple(args...), + [](auto &&arg){return arg.data();}); + applyHelper_with_index(shp, str, ptrs, std::forward(func), nthreads, index); + } + + +template class mavref + { + private: + const mav_info &info; + T *d; + + public: + using shape_t = typename mav_info::shape_t; + using stride_t = typename mav_info::stride_t; + mavref(const mav_info &info_, T *d_) : info(info_), d(d_) {} + template T &operator()(Ns... ns) const + { return d[info.idx(ns...)]; } + /// Returns the total number of entries in the object. + size_t size() const { return info.size(); } + /// Returns the shape of the object. + const shape_t &shape() const { return info.shape(); } + /// Returns the length along dimension \a i. + size_t shape(size_t i) const { return info.shape(i); } + /// Returns the strides of the object. + const stride_t &stride() const { return info.stride(); } + /// Returns the stride along dimension \a i. + const ptrdiff_t &stride(size_t i) const { return info.stride(i); } + /// Returns true iff the last dimension has stride 1. + /** Typically used for optimization purposes. */ + bool last_contiguous() const + { return info.last_contiguous(); } + /** Returns true iff the object is C-contiguous, i.e. if the stride of the + * last dimension is 1, the stride for the next-to-last dimension is the + * shape of the last dimension etc. */ + bool contiguous() const + { return info.contiguous(); } + /// Returns true iff this->shape and \a other.shape match. + bool conformable(const mavref &other) const + { return shape()==other.shape(); } + }; + +template + mavref make_mavref(const mav_info &info_, T *d_) + { return mavref(info_, d_); } + +template +inline auto tuple_transform2_impl(const tuple &i1, const tuple &i2, + Func &&func, index_sequence) + { return tuple...>{func(get(i1),get(i2))...}; } +template +inline auto tuple_transform2(const tuple &i1, const tuple &i2, + Func &&func) + { + return tuple_transform2_impl(i1, i2, std::forward(func), + make_index_sequence{}); + } +template + auto make_mavrefs(const Tptrs &ptrs, const Tinfos &infos) + { + return tuple_transform2(ptrs, infos, [](auto &&ptr, auto &&info) + { return make_mavref(info, ptr); }); + } + +template auto make_infos(const fmav_info &info) + { + if constexpr(ndim>0) + MR_assert(ndim<=info.ndim(), "bad dimensionality"); + auto iterdim = info.ndim()-ndim; + fmav_info fout({info.shape().begin(),info.shape().begin()+iterdim}, + {info.stride().begin(),info.stride().begin()+iterdim}); + + typename mav_info::shape_t shp; + typename mav_info::stride_t str; + if constexpr (ndim>0) // just to silence compiler warnings + for (size_t i=0; i iout(shp, str); + return make_tuple(fout, iout); + } + +template + DUCC0_NOINLINE void flexible_mav_applyHelper(size_t idim, const vector &shp, + const vector> &str, const Tptrs &ptrs, + const Tinfos &infos, Func &&func) + { + auto len = shp[idim]; + auto locptrs(ptrs); + if (idim+1 + DUCC0_NOINLINE void flexible_mav_applyHelper(const vector &shp, + const vector> &str, const Tptrs &ptrs, + const Tinfos &infos, Func &&func, size_t nthreads) + { + if (shp.size()==0) + call_with_tuple2(func, make_mavrefs(ptrs, infos)); + else if (nthreads==1) + flexible_mav_applyHelper(0, shp, str, ptrs, infos, std::forward(func)); + else + execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) + { + auto locptrs = update_pointers(ptrs, str, 0, lo); + auto locshp(shp); + locshp[0] = hi-lo; + flexible_mav_applyHelper(0, locshp, str, locptrs, infos, func); + }); + } + +template struct Xdim { static constexpr size_t dim=ndim; }; + +template + void xflexible_mav_apply(const Ttuple &tuple, const Tdim &dim, Func &&func, size_t nthreads) + { + auto fullinfos = tuple_transform2(tuple, dim, [](const auto &arg, const auto &dim) + { return make_infos::dim>(fmav_info(arg)); }); + vector iter_infos; + tuple_for_each(fullinfos,[&iter_infos](const auto &entry){iter_infos.push_back(get<0>(entry));}); + auto [shp, str] = multiprep(iter_infos); + + auto infos2 = tuple_transform(fullinfos, [](const auto &arg) + { return get<1>(arg); }); + auto ptrs = tuple_transform(tuple, [](auto &&arg){return arg.data();}); + flexible_mav_applyHelper(shp, str, ptrs, infos2, std::forward(func), nthreads); + } + +template + void flexible_mav_apply(Func &&func, size_t nthreads, T0 &&m0) + { + xflexible_mav_apply(forward_as_tuple(m0), + forward_as_tuple(Xdim()), + std::forward(func), nthreads); + } + +template + void flexible_mav_apply(Func &&func, size_t nthreads, T0 &&m0, T1 &&m1) + { + xflexible_mav_apply(forward_as_tuple(m0, m1), + forward_as_tuple(Xdim(), Xdim()), + std::forward(func), nthreads); + } + +template + void flexible_mav_apply(Func &&func, size_t nthreads, T0 &&m0, T1 &&m1, T2 &&m2) + { + xflexible_mav_apply(forward_as_tuple(m0, m1, m2), + forward_as_tuple(Xdim(), Xdim(), Xdim()), + std::forward(func), nthreads); + } + +} + +using detail_mav::UNINITIALIZED; +using detail_mav::fmav_info; +using detail_mav::mav_info; +using detail_mav::slice; +using detail_mav::MAXIDX; +using detail_mav::cfmav; +using detail_mav::vfmav; +using detail_mav::cmav; +using detail_mav::vmav; +using detail_mav::subarray; +using detail_mav::mav_apply; +using detail_mav::mav_apply_with_index; +using detail_mav::flexible_mav_apply; +} + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/infra/threading.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/infra/threading.h new file mode 100644 index 0000000000000000000000000000000000000000..eca79d8f338c3b968a8c7e085869accd9dc7fa45 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/_virtual_includes/fft/ducc/src/ducc0/infra/threading.h @@ -0,0 +1,328 @@ +/** \file ducc0/infra/threading.h + * Mulithreading support, similar to functionality provided by OpenMP + * + * \copyright Copyright (C) 2019-2023 Peter Bell, Max-Planck-Society + * \authors Peter Bell, Martin Reinecke + */ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_THREADING_H +#define DUCC0_THREADING_H + +// Low level threading support can be influenced by the following macros: +// - DUCC0_NO_LOWLEVEL_THREADING: if defined, multithreading is disabled +// and all parallel regions will be executed sequentially +// on the invoking thread. +// - DUCC0_CUSTOM_LOWLEVEL_THREADING: if defined, external definitions of +// Mutex, UniqueLock, LockGuard, CondVar, set_active_pool(), +// and get active_pool() must be supplied in "ducc0_custom_lowlevel_threading.h" +// and the code will use those. +// Both macros must not be defined at the same time. +// If neither macro is defined, standard ducc0 multihreading will be active. + +#if (defined(DUCC0_NO_LOWLEVEL_THREADING) && defined(DUCC0_CUSTOM_LOWLEVEL_THREADING)) +static_assert(false, "DUCC0_NO_LOWLEVEL_THREADING and DUCC0_CUSTOMLOWLEVEL_THREADING must not be both defined"); +#endif + +#if defined(DUCC0_STDCXX_LOWLEVEL_THREADING) +static_assert(false, "DUCC0_STDCXX_LOWLEVEL_THREADING must not be defined externally"); +#endif + +#if ((!defined(DUCC0_NO_LOWLEVEL_THREADING)) && (!defined(DUCC0_CUSTOM_LOWLEVEL_THREADING))) +#define DUCC0_STDCXX_LOWLEVEL_THREADING +#endif + +#include +#include +#include + +// threading-specific headers +#ifdef DUCC0_STDCXX_LOWLEVEL_THREADING +#include +#include +#endif + +#ifdef DUCC0_NO_LOWLEVEL_THREADING +// no headers needed +#endif + +namespace ducc0 { +namespace detail_threading { + +using std::size_t; + +/// Abstract base class for minimalistic thread pool functionality +class thread_pool + { + public: + virtual ~thread_pool() {} + /// Returns the total number of threads managed by the pool + virtual size_t nthreads() const = 0; + /** "Normalizes" a requested number of threads. A useful convention could be + return (nthreads_in==0) ? nthreads() : min(nthreads(), nthreads_in); */ + virtual size_t adjust_nthreads(size_t nthreads_in) const = 0; + virtual void submit(std::function work) = 0; + }; + +}} + +#ifdef DUCC0_CUSTOM_LOWLEVEL_THREADING +#include "ducc0_custom_lowlevel_threading.h" +#endif + +namespace ducc0 { + +namespace detail_threading { + +thread_pool *set_active_pool(thread_pool *new_pool); +thread_pool *get_active_pool(); + +// define threading related types dependent on the underlying implementation +#ifdef DUCC0_STDCXX_LOWLEVEL_THREADING +using Mutex = std::mutex; +using UniqueLock = std::unique_lock; +using LockGuard = std::lock_guard; +using CondVar = std::condition_variable; +#endif + +#ifdef DUCC0_NO_LOWLEVEL_THREADING +struct Mutex + { + void lock(){} + void unlock(){} + }; +struct LockGuard + { + LockGuard(const Mutex &){} + }; +struct UniqueLock + { + UniqueLock(const Mutex &){} + void lock() {} + void unlock() {} + }; +struct CondVar + { + template + void wait(UniqueLock &, Predicate) {} + void notify_one() noexcept {} + void notify_all() noexcept {} + }; +#endif + +using std::size_t; + +class ScopedUseThreadPool + { + private: + thread_pool *old_pool_; + public: + ScopedUseThreadPool(thread_pool &pool) + { old_pool_ = set_active_pool(&pool); } + ~ScopedUseThreadPool() + { set_active_pool(old_pool_); } + }; + +/// Index range describing a chunk of work inside a parallelized loop +struct Range + { + size_t lo, //< first index of the chunk + hi; //< one-past-last index of the chunk + Range() : lo(0), hi(0) {} + Range(size_t lo_, size_t hi_) : lo(lo_), hi(hi_) {} + /// Returns true iff the chunk is not empty + operator bool() const { return hi>lo; } + }; + +/// Class supplied to parallel regions, which allows them to determine their +/// work chunks. +class Scheduler + { + public: + virtual ~Scheduler() {} + /// Returns the number of threads working in this parallel region + virtual size_t num_threads() const = 0; + /// Returns the number of this thread, from the range 0 to num_threads()-1. + virtual size_t thread_num() const = 0; + /// Returns information about the next chunk of work. + /// If this chunk is empty, the work on this thread is done. + virtual Range getNext() = 0; + }; + +/** Returns the maximum number of threads that are supported by currently + active thread pool. */ +size_t max_threads(); +size_t adjust_nthreads(size_t nthreads); + +/// Execute \a func over \a nwork work items, on a single thread. +void execSingle(size_t nwork, + std::function func); +/// Execute \a func over \a nwork work items, on \a nthreads threads. +/** Chunks will have the size \a chunksize, except for the last one which + * may be smaller. + * + * Chunks are statically assigned to threads at startup. */ +void execStatic(size_t nwork, size_t nthreads, size_t chunksize, + std::function func); +/// Execute \a func over \a nwork work items, on \a nthreads threads. +/** Chunks will have the size \a chunksize, except for the last one which + * may be smaller. + * + * Chunks are assigned dynamically to threads;whenever a thread is finished + * with its current chunk, it will obtain the next one from the list of + * remaining chunks. */ +void execDynamic(size_t nwork, size_t nthreads, size_t chunksize, + std::function func); +void execGuided(size_t nwork, size_t nthreads, size_t chunksize_min, + double fact_max, std::function func); +/// Execute \a func on \a nthreads threads. +/** Work subdivision must be organized within \a func. */ +void execParallel(size_t nthreads, std::function func); +/// Execute \a func on \a nthreads threads, passing only the thread number. +/** Work subdivision must be organized within \a func. */ +void execParallel(size_t nthreads, std::function func); +/// Execute \a func on work items [\a lo; \a hi[ over \a nthreads threads. +/** Work items are subdivided fairly among threads. */ +void execParallel(size_t work_lo, size_t work_hi, size_t nthreads, + std::function func); +/// Execute \a func on work items [0; \a nwork[ over \a nthreads threads. +/** Work items are subdivided fairly among threads. */ +inline void execParallel(size_t nwork, size_t nthreads, + std::function func) + { execParallel(0, nwork, nthreads, func); } +/// Execute \a func on work items [\a lo; \a hi[ over \a nthreads threads. +/** The first argument to \a func is the thread number. + * + * Work items are subdivided fairly among threads. */ +void execParallel(size_t work_lo, size_t work_hi, size_t nthreads, + std::function func); +/// Execute \a func on work items [0; \a nwork[ over \a nthreads threads. +/** The first argument to \a func is the thread number. + * + * Work items are subdivided fairly among threads. */ +inline void execParallel(size_t nwork, size_t nthreads, + std::function func) + { execParallel(0, nwork, nthreads, func); } + +template class Worklist + { + private: + Mutex mtx; + CondVar cv; + size_t nworking{0}; + std::vector items; + + public: + Worklist(const std::vector &items_) + : items(items_) {} + + std::optional get_item() + { + UniqueLock lck(mtx); + if ((--nworking==0) && items.empty()) cv.notify_all(); + cv.wait(lck,[&](){return (!items.empty()) || (nworking==0);}); + if (!items.empty()) + { + auto res = items.back(); + items.pop_back(); + ++nworking; + return res; + } + else + return {}; + } + void startup() + { + LockGuard lck(mtx); + ++nworking; + } + void put_item(const T &item) + { + LockGuard lck(mtx); + items.push_back(item); + cv.notify_one(); + } + }; + +/// Execute \a func on work items in \a items over \a nthreads threads. +/** While processing a work item, \a func may submit further items to the list + * of work items. For this purpose, \a func must take a const T & + * (the work item to be processed) as well as a function which also takes + * a const T & (the insert function). Work items will be assigned whenever a + * thread becomes available. */ +template auto execWorklist + (size_t nthreads, const std::vector &items, Func &&func) + { + Worklist wl(items); + execParallel(nthreads, [&wl, &func](auto &) { + wl.startup(); + while(auto wrk=wl.get_item()) + func(wrk.value(), [&wl](const T &item){wl.put_item(item);}); + }); + } + +} // end of namespace detail_threading + +using detail_threading::Mutex; +using detail_threading::LockGuard; +using detail_threading::UniqueLock; +using detail_threading::CondVar; +using detail_threading::thread_pool; +using detail_threading::ScopedUseThreadPool; +using detail_threading::max_threads; +using detail_threading::adjust_nthreads; +using detail_threading::Scheduler; +using detail_threading::execSingle; +using detail_threading::execStatic; +using detail_threading::execDynamic; +using detail_threading::execGuided; +using detail_threading::execParallel; +using detail_threading::execWorklist; + +} // end of namespace ducc0 + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/google/ducc0_custom_lowlevel_threading.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/google/ducc0_custom_lowlevel_threading.h new file mode 100644 index 0000000000000000000000000000000000000000..6ac63a9080ccfff39e7793faa0272a2450e77c48 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/google/ducc0_custom_lowlevel_threading.h @@ -0,0 +1,35 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef THIRD_PARTY_DUCC_GOOGLE_DUCC0_CUSTOM_LOWLEVEL_THREADING_H_ +#define THIRD_PARTY_DUCC_GOOGLE_DUCC0_CUSTOM_LOWLEVEL_THREADING_H_ + +#include "tsl/platform/mutex.h" + +namespace ducc0 { +namespace detail_threading { + +using Mutex = tsl::mutex; +using UniqueLock = tsl::mutex_lock; +using LockGuard = tsl::mutex_lock; +using CondVar = tsl::condition_variable; + +// Missing variable used by DUCC threading.cc. +static thread_local bool in_parallel_region = false; + +} // namespace detail_threading +} // namespace ducc0 + +#endif // THIRD_PARTY_DUCC_GOOGLE_DUCC0_CUSTOM_LOWLEVEL_THREADING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/google/threading.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/google/threading.h new file mode 100644 index 0000000000000000000000000000000000000000..b9953a1256f679cc430019087373fb539e9e63a5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/google/threading.h @@ -0,0 +1,60 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef THIRD_PARTY_DUCC_GOOGLE_THREADING_H_ +#define THIRD_PARTY_DUCC_GOOGLE_THREADING_H_ + +#include "ducc/src/ducc0/infra/threading.h" +#include "third_party/eigen3/unsupported/Eigen/CXX11/ThreadPool" + +namespace ducc0 { +namespace google { + +using std::size_t; + +// Pseudo thread-pool for single-threaded execution. +class NoThreadPool : public ducc0::detail_threading::thread_pool { + public: + size_t nthreads() const override { return 1; } + size_t adjust_nthreads(size_t nthreads_in) const override { return 1; }; + void submit(std::function work) override { work(); } +}; + +// Thread-pool wrapper around Eigen's ThreadPool. +class EigenThreadPool : public ducc0::detail_threading::thread_pool { + public: + EigenThreadPool(Eigen::ThreadPoolInterface& pool) : pool_{&pool} {} + size_t nthreads() const override { return pool_->NumThreads(); } + size_t adjust_nthreads(size_t nthreads_in) const override { + // If called by a thread in the pool, return 1 + if (pool_->CurrentThreadId() >= 0) { + return 1; + } else if (nthreads_in == 0) { + return pool_->NumThreads(); + } + return std::min(nthreads_in, pool_->NumThreads()); + }; + void submit(std::function work) override { + pool_->Schedule(std::move(work)); + } + + private: + Eigen::ThreadPoolInterface* pool_; +}; + +} // namespace google +} // namespace ducc0 + +#endif // THIRD_PARTY_DUCC_GOOGLE_THREADING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/fft/fft.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/fft/fft.h new file mode 100644 index 0000000000000000000000000000000000000000..9271cde2c2eef056de3639d640dbc0b757a8c609 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/fft/fft.h @@ -0,0 +1,982 @@ +/* +This file is part of the ducc FFT library + +Copyright (C) 2010-2023 Max-Planck-Society +Copyright (C) 2019 Peter Bell + +Authors: Martin Reinecke, Peter Bell +*/ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_FFT_H +#define DUCC0_FFT_H + +#include +#include +#include +#include +#include +#include "ducc0/infra/error_handling.h" +#include "ducc0/infra/aligned_array.h" +#include "ducc0/infra/mav.h" +#include "ducc0/math/cmplx.h" +#include "ducc0/math/unity_roots.h" + +namespace ducc0 { + +namespace detail_fft { + +using namespace std; + +template using Troots = shared_ptr>>; +template inline auto tidx() { return type_index(typeid(T)); } + +template inline void PM(T &a, T &b, T c, T d) + { a=c+d; b=c-d; } +template inline void PMINPLACE(T &a, T &b) + { T t = a; a+=b; b=t-b; } +template inline void MPINPLACE(T &a, T &b) + { T t = a; a-=b; b=t+b; } +template void special_mul (const Cmplx &v1, const Cmplx &v2, Cmplx &res) + { + res = fwd ? Cmplx(v1.r*v2.r+v1.i*v2.i, v1.i*v2.r-v1.r*v2.i) + : Cmplx(v1.r*v2.r-v1.i*v2.i, v1.r*v2.i+v1.i*v2.r); + } + +struct util1d // hack to avoid duplicate symbols + { + /* returns the smallest composite of 2, 3, 5, 7 and 11 which is >= n */ + DUCC0_NOINLINE static size_t good_size_cmplx(size_t n) + { + if (n<=12) return n; + + size_t bestfac=2*n; + for (size_t f11=1; f11n) + { + if (x>=1; + } + else + return n; + } + } + return bestfac; + } + + /* returns the smallest composite of 2, 3, 5 which is >= n */ + DUCC0_NOINLINE static size_t good_size_real(size_t n) + { + if (n<=6) return n; + + size_t bestfac=2*n; + for (size_t f5=1; f5n) + { + if (x>=1; + } + else + return n; + } + } + return bestfac; + } + + DUCC0_NOINLINE static vector prime_factors(size_t N) + { + MR_assert(N>0, "need a positive number"); + vector factors; + while ((N&1)==0) + { N>>=1; factors.push_back(2); } + for (size_t divisor=3; divisor*divisor<=N; divisor+=2) + while ((N%divisor)==0) + { + factors.push_back(divisor); + N/=divisor; + } + if (N>1) factors.push_back(N); + return factors; + } + }; + +// T: "type", f/c: "float/complex", s/v: "scalar/vector" +template class cfftpass + { + public: + virtual ~cfftpass(){} + using Tcs = Cmplx; + + // number of Tcd values required as scratch space during "exec" + // will be provided in "buf" + virtual size_t bufsize() const = 0; + virtual bool needs_copy() const = 0; + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, + bool fwd, size_t nthreads=1) const = 0; + + static vector factorize(size_t N) + { + MR_assert(N>0, "need a positive number"); + vector factors; + factors.reserve(15); + while ((N&7)==0) + { factors.push_back(8); N>>=3; } + while ((N&3)==0) + { factors.push_back(4); N>>=2; } + if ((N&1)==0) + { + N>>=1; + // factor 2 should be at the front of the factor list + factors.push_back(2); + swap(factors[0], factors.back()); + } + for (size_t divisor=3; divisor*divisor<=N; divisor+=2) + while ((N%divisor)==0) + { + factors.push_back(divisor); + N/=divisor; + } + if (N>1) factors.push_back(N); + return factors; + } + + static shared_ptr make_pass(size_t l1, size_t ido, size_t ip, + const Troots &roots, bool vectorize=false); + static shared_ptr make_pass(size_t ip, bool vectorize=false) + { + return make_pass(1,1,ip,make_shared>>(ip), + vectorize); + } + }; + +template class rfftpass + { + public: + virtual ~rfftpass(){} + + // number of Tfd values required as scratch space during "exec" + // will be provided in "buf" + virtual size_t bufsize() const = 0; + virtual bool needs_copy() const = 0; + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, + bool fwd, size_t nthreads=1) const = 0; + + static vector factorize(size_t N) + { + MR_assert(N>0, "need a positive number"); + vector factors; + while ((N&3)==0) + { factors.push_back(4); N>>=2; } + if ((N&1)==0) + { + N>>=1; + // factor 2 should be at the front of the factor list + factors.push_back(2); + swap(factors[0], factors.back()); + } + for (size_t divisor=3; divisor*divisor<=N; divisor+=2) + while ((N%divisor)==0) + { + factors.push_back(divisor); + N/=divisor; + } + if (N>1) factors.push_back(N); + return factors; + } + + static shared_ptr make_pass(size_t l1, size_t ido, size_t ip, + const Troots &roots, bool vectorize=false); + static shared_ptr make_pass(size_t ip, bool vectorize=false) + { + return make_pass(1,1,ip,make_shared>>(ip), + vectorize); + } + }; + +template using Tcpass = shared_ptr>; +template using Trpass = shared_ptr>; + +template class pocketfft_c + { + private: + size_t N; + size_t critbuf; + Tcpass plan; + + public: + pocketfft_c(size_t n, bool vectorize=false) + : N(n), critbuf(((N&1023)==0) ? 16 : 0), + plan(cfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N*plan->needs_copy()+2*critbuf+plan->bufsize(); } + template DUCC0_NOINLINE Cmplx *exec(Cmplx *in, Cmplx *buf, + Tfs fct, bool fwd, size_t nthreads=1) const + { + static const auto tic = tidx *>(); + auto res = static_cast *>(plan->exec(tic, + in, buf+critbuf+plan->bufsize(), buf+critbuf, fwd, nthreads)); + if (fct!=Tfs(1)) + for (size_t i=0; i DUCC0_NOINLINE void exec_copyback(Cmplx *in, Cmplx *buf, + Tfs fct, bool fwd, size_t nthreads=1) const + { + static const auto tic = tidx *>(); + auto res = static_cast *>(plan->exec(tic, + in, buf, buf+N*plan->needs_copy(), fwd, nthreads)); + if (res==in) + { + if (fct!=Tfs(1)) + for (size_t i=0; i DUCC0_NOINLINE void exec(Cmplx *in, Tfs fct, bool fwd, size_t nthreads=1) const + { + aligned_array> buf(N*plan->needs_copy()+plan->bufsize()); + exec_copyback(in, buf.data(), fct, fwd, nthreads); + } + }; + +template class pocketfft_r + { + private: + size_t N; + Trpass plan; + + public: + pocketfft_r(size_t n, bool vectorize=false) + : N(n), plan(rfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N*plan->needs_copy()+plan->bufsize(); } + template DUCC0_NOINLINE Tfd *exec(Tfd *in, Tfd *buf, Tfs fct, + bool fwd, size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = static_cast(plan->exec(tifd, in, buf, + buf+N*plan->needs_copy(), fwd, nthreads)); + if (fct!=Tfs(1)) + for (size_t i=0; i DUCC0_NOINLINE void exec_copyback(Tfd *in, Tfd *buf, + Tfs fct, bool fwd, size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = static_cast(plan->exec(tifd, in, buf, + buf+N*plan->needs_copy(), fwd, nthreads)); + if (res==in) + { + if (fct!=Tfs(1)) + for (size_t i=0; i DUCC0_NOINLINE void exec(Tfd *in, Tfs fct, bool fwd, + size_t nthreads=1) const + { + aligned_array buf(N*plan->needs_copy()+plan->bufsize()); + exec_copyback(in, buf.data(), fct, fwd, nthreads); + } + }; + +template class pocketfft_hartley + { + private: + size_t N; + Trpass plan; + + public: + pocketfft_hartley(size_t n, bool vectorize=false) + : N(n), plan(rfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N+plan->bufsize(); } + template DUCC0_NOINLINE Tfd *exec(Tfd *in, Tfd *buf, Tfs fct, + size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = static_cast(plan->exec(tifd, + in, buf, buf+N, true, nthreads)); + auto res2 = (res==buf) ? in : buf; + res2[0] = fct*res[0]; + size_t i=1, i1=1, i2=N-1; + for (i=1; i DUCC0_NOINLINE void exec_copyback(Tfd *in, Tfd *buf, + Tfs fct, size_t nthreads=1) const + { + auto res = exec(in, buf, fct, nthreads); + if (res!=in) + copy_n(res, N, in); + } + template DUCC0_NOINLINE void exec(Tfd *in, Tfs fct, + size_t nthreads=1) const + { + aligned_array buf(N+plan->bufsize()); + exec_copyback(in, buf.data(), fct, nthreads); + } + }; + +template class pocketfft_fht + { + private: + size_t N; + Trpass plan; + + public: + pocketfft_fht(size_t n, bool vectorize=false) + : N(n), plan(rfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N+plan->bufsize(); } + template DUCC0_NOINLINE Tfd *exec(Tfd *in, Tfd *buf, Tfs fct, + size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = static_cast(plan->exec(tifd, + in, buf, buf+N, true, nthreads)); + auto res2 = (res==buf) ? in : buf; + res2[0] = fct*res[0]; + size_t i=1, i1=1, i2=N-1; + for (i=1; i DUCC0_NOINLINE void exec_copyback(Tfd *in, Tfd *buf, + Tfs fct, size_t nthreads=1) const + { + auto res = exec(in, buf, fct, nthreads); + if (res!=in) + copy_n(res, N, in); + } + template DUCC0_NOINLINE void exec(Tfd *in, Tfs fct, + size_t nthreads=1) const + { + aligned_array buf(N+plan->bufsize()); + exec_copyback(in, buf.data(), fct, nthreads); + } + }; + +// R2R transforms using FFTW's halfcomplex format +template class pocketfft_fftw + { + private: + size_t N; + Trpass plan; + + public: + pocketfft_fftw(size_t n, bool vectorize=false) + : N(n), plan(rfftpass::make_pass(n,vectorize)) {} + size_t length() const { return N; } + size_t bufsize() const { return N+plan->bufsize(); } + template DUCC0_NOINLINE Tfd *exec(Tfd *in, Tfd *buf, Tfs fct, + bool fwd, size_t nthreads=1) const + { + static const auto tifd = tidx(); + auto res = in; + auto res2 = buf; + if (!fwd) // go to FFTPACK halfcomplex order + { + res2[0] = fct*res[0]; + size_t i=1, i1=1, i2=N-1; + for (i=1; i(plan->exec(tifd, + res, res2, buf+N, fwd, nthreads)); + if (!fwd) return res; + + // go to FFTW halfcomplex order + res2 = (res==buf) ? in : buf; + res2[0] = fct*res[0]; + size_t i=1, i1=1, i2=N-1; + for (i=1; i DUCC0_NOINLINE void exec_copyback(Tfd *in, Tfd *buf, + Tfs fct, bool fwd, size_t nthreads=1) const + { + auto res = exec(in, buf, fct, fwd, nthreads); + if (res!=in) + copy_n(res, N, in); + } + template DUCC0_NOINLINE void exec(Tfd *in, Tfs fct, bool fwd, + size_t nthreads=1) const + { + aligned_array buf(N+plan->bufsize()); + exec_copyback(in, buf.data(), fct, fwd, nthreads); + } + }; + +// +// sine/cosine transforms +// + +template class T_dct1 + { + private: + pocketfft_r fftplan; + + public: + DUCC0_NOINLINE T_dct1(size_t length, bool /*vectorize*/=false) + : fftplan(2*(length-1)) {} + + template DUCC0_NOINLINE T *exec(T c[], T buf[], T0 fct, bool ortho, + int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L); + size_t N=fftplan.length(), n=N/2+1; + if (ortho) + { c[0]*=sqrt2; c[n-1]*=sqrt2; } + auto tmp=&buf[0]; + tmp[0] = c[0]; + for (size_t i=1; i DUCC0_NOINLINE void exec_copyback(T c[], T buf[], T0 fct, bool ortho, + int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + exec(c, buf, fct, ortho, 1, true, nthreads); + } + template DUCC0_NOINLINE void exec(T c[], T0 fct, bool ortho, + int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + aligned_array buf(bufsize()); + exec_copyback(c, buf.data(), fct, ortho, 1, true, nthreads); + } + + size_t length() const { return fftplan.length()/2+1; } + size_t bufsize() const { return fftplan.length()+fftplan.bufsize(); } + }; + +template class T_dst1 + { + private: + pocketfft_r fftplan; + + public: + DUCC0_NOINLINE T_dst1(size_t length, bool /*vectorize*/=false) + : fftplan(2*(length+1)) {} + + template DUCC0_NOINLINE T *exec(T c[], T buf[], T0 fct, + bool /*ortho*/, int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + size_t N=fftplan.length(), n=N/2-1; + auto tmp = &buf[0]; + tmp[0] = tmp[n+1] = c[0]*0; + for (size_t i=0; i DUCC0_NOINLINE void exec_copyback(T c[], T buf[], T0 fct, + bool /*ortho*/, int /*type*/, bool /*cosine*/, size_t nthreads=1) const + { + exec(c, buf, fct, true, 1, false, nthreads); + } + template DUCC0_NOINLINE void exec(T c[], T0 fct, + bool /*ortho*/, int /*type*/, bool /*cosine*/, size_t nthreads) const + { + aligned_array buf(bufsize()); + exec_copyback(c, buf.data(), fct, true, 1, false, nthreads); + } + + size_t length() const { return fftplan.length()/2-1; } + size_t bufsize() const { return fftplan.length()+fftplan.bufsize(); } + }; + +template class T_dcst23 + { + private: + pocketfft_r fftplan; + std::vector twiddle; + + public: + DUCC0_NOINLINE T_dcst23(size_t length, bool /*vectorize*/=false) + : fftplan(length), twiddle(length) + { + UnityRoots> tw(4*length); + for (size_t i=0; i DUCC0_NOINLINE T *exec(T c[], T buf[], T0 fct, bool ortho, + int type, bool cosine, size_t nthreads=1) const + { + constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L); + size_t N=length(); + size_t NS2 = (N+1)/2; + if (type==2) + { + c[0] *= 2; + if ((N&1)==0) c[N-1]*=2; + if (cosine) + for (size_t k=1; k DUCC0_NOINLINE void exec_copyback(T c[], T buf[], T0 fct, + bool ortho, int type, bool cosine, size_t nthreads=1) const + { + exec(c, buf, fct, ortho, type, cosine, nthreads); + } + template DUCC0_NOINLINE void exec(T c[], T0 fct, bool ortho, + int type, bool cosine, size_t nthreads=1) const + { + aligned_array buf(bufsize()); + exec(c, &buf[0], fct, ortho, type, cosine, nthreads); + } + + size_t length() const { return fftplan.length(); } + size_t bufsize() const { return fftplan.bufsize(); } + }; + +template class T_dcst4 + { + private: + size_t N; + std::unique_ptr> fft; + std::unique_ptr> rfft; + aligned_array> C2; + size_t bufsz; + + public: + DUCC0_NOINLINE T_dcst4(size_t length, bool /*vectorize*/=false) + : N(length), + fft((N&1) ? nullptr : make_unique>(N/2)), + rfft((N&1)? make_unique>(N) : nullptr), + C2((N&1) ? 0 : N/2), + bufsz((N&1) ? (N+rfft->bufsize()) : (N+2*fft->bufsize())) + { + if ((N&1)==0) + { + UnityRoots> tw(16*N); + for (size_t i=0; i DUCC0_NOINLINE T *exec(T c[], T buf[], T0 fct, + bool /*ortho*/, int /*type*/, bool cosine, size_t nthreads) const + { + size_t n2 = N/2; + if (!cosine) + for (size_t k=0, kc=N-1; kexec(y, y+N, fct, true, nthreads); + { + auto SGN = [](size_t i) + { + constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L); + return (i&2) ? -sqrt2 : sqrt2; + }; + c[n2] = res[0]*SGN(n2+1); + size_t i=0, i1=1, k=1; + for (; k *>(buf); + for(size_t i=0; iexec(y2, y2+N/2, fct, true, nthreads); + for(size_t i=0, ic=n2-1; i DUCC0_NOINLINE void exec_copyback(T c[], T buf[], T0 fct, + bool /*ortho*/, int /*type*/, bool cosine, size_t nthreads=1) const + { + exec(c, buf, fct, true, 4, cosine, nthreads); + } + template DUCC0_NOINLINE void exec(T c[], T0 fct, + bool /*ortho*/, int /*type*/, bool cosine, size_t nthreads=1) const + { + aligned_array buf(bufsize()); + exec(c, &buf[0], fct, true, 4, cosine, nthreads); + } + + size_t length() const { return N; } + size_t bufsize() const { return bufsz; } + }; + +using shape_t=fmav_info::shape_t; +using stride_t=fmav_info::stride_t; + +constexpr bool FORWARD = true, + BACKWARD = false; + +/// Complex-to-complex Fast Fourier Transform +/** This executes a Fast Fourier Transform on \a in and stores the result in + * \a out. + * + * \a in and \a out must have identical shapes; they may point to the same + * memory; in this case their strides must also be identical. + * + * \a axes specifies the axes over which the transform is carried out. + * + * If \a forward is true, a minus sign will be used in the exponent. + * + * No normalization factors will be applied by default; if multiplication by + * a constant is desired, it can be supplied in \a fct. + * + * If the underlying array has more than one dimension, the computation will + * be distributed over \a nthreads threads. + */ +template DUCC0_NOINLINE void c2c(const cfmav> &in, + vfmav> &out, const shape_t &axes, bool forward, + T fct, size_t nthreads=1); + +/// Fast Discrete Cosine Transform +/** This executes a DCT on \a in and stores the result in \a out. + * + * \a in and \a out must have identical shapes; they may point to the same + * memory; in this case their strides must also be identical. + * + * \a axes specifies the axes over which the transform is carried out. + * + * If \a forward is true, a DCT is computed, otherwise an inverse DCT. + * + * \a type specifies the desired type (1-4) of the transform. + * + * No normalization factors will be applied by default; if multiplication by + * a constant is desired, it can be supplied in \a fct. + * + * If \a ortho is true, the first and last array entries are corrected (if + * necessary) to allow an orthonormalized transform. + * + * If the underlying array has more than one dimension, the computation will + * be distributed over \a nthreads threads. + */ +template DUCC0_NOINLINE void dct(const cfmav &in, vfmav &out, + const shape_t &axes, int type, T fct, bool ortho, size_t nthreads=1); + +/// Fast Discrete Sine Transform +/** This executes a DST on \a in and stores the result in \a out. + * + * \a in and \a out must have identical shapes; they may point to the same + * memory; in this case their strides must also be identical. + * + * \a axes specifies the axes over which the transform is carried out. + * + * If \a forward is true, a DST is computed, otherwise an inverse DST. + * + * \a type specifies the desired type (1-4) of the transform. + * + * No normalization factors will be applied by default; if multiplication by + * a constant is desired, it can be supplied in \a fct. + * + * If \a ortho is true, the first and last array entries are corrected (if + * necessary) to allow an orthonormalized transform. + * + * If the underlying array has more than one dimension, the computation will + * be distributed over \a nthreads threads. + */ +template DUCC0_NOINLINE void dst(const cfmav &in, vfmav &out, + const shape_t &axes, int type, T fct, bool ortho, size_t nthreads=1); + +template DUCC0_NOINLINE void r2c(const cfmav &in, + vfmav> &out, size_t axis, bool forward, T fct, + size_t nthreads=1); + +template DUCC0_NOINLINE void r2c(const cfmav &in, + vfmav> &out, const shape_t &axes, + bool forward, T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void c2r(const cfmav> &in, + vfmav &out, size_t axis, bool forward, T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void c2r(const cfmav> &in, + vfmav &out, const shape_t &axes, bool forward, T fct, + size_t nthreads=1); + +template DUCC0_NOINLINE void c2r_mut(vfmav> &in, + vfmav &out, const shape_t &axes, bool forward, T fct, + size_t nthreads=1); + +template DUCC0_NOINLINE void r2r_fftpack(const cfmav &in, + vfmav &out, const shape_t &axes, bool real2hermitian, bool forward, + T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void r2r_fftw(const cfmav &in, + vfmav &out, const shape_t &axes, bool forward, + T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void r2r_separable_hartley(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads=1); + +template DUCC0_NOINLINE void r2r_separable_fht(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads=1); + +template void r2r_genuine_hartley(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads=1); + +template void r2r_genuine_fht(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads=1); + +/// Convolution and zero-padding/truncation along one axis +/** This performs a circular convolution with the kernel \a kernel on axis + * \a axis of \a in, applies the necessary zero-padding/truncation on this + * axis to give it the length \a out.shape(axis),and returns the result + * in \a out. + * + * The main purpose of this routine is efficiency: the combination of the above + * operations can be carried out more quickly than running the individual + * operations in succession. + * + * \a in and \a out must have identical shapes, with the possible exception + * of the axis \a axis; they may point to the same memory; in this case all + * of their strides must be identical. + * + * \a axis specifies the axis over which the operation is carried out. + * + * \a kernel must have the same length as \a in.shape(axis); it must be + * provided in the same domain as \a in (i.e. not pre-transformed). + * + * If \a in has more than one dimension, the computation will + * be distributed over \a nthreads threads. + */ +template DUCC0_NOINLINE void convolve_axis(const cfmav &in, + vfmav &out, size_t axis, const cmav &kernel, size_t nthreads=1); + +template DUCC0_NOINLINE void convolve_axis(const cfmav> &in, + vfmav> &out, size_t axis, const cmav,1> &kernel, + size_t nthreads=1); +} + +using detail_fft::pocketfft_c; +using detail_fft::pocketfft_r; +using detail_fft::pocketfft_hartley; +using detail_fft::pocketfft_fht; +using detail_fft::pocketfft_fftw; + +using detail_fft::FORWARD; +using detail_fft::BACKWARD; +using detail_fft::c2c; +using detail_fft::c2r; +using detail_fft::c2r_mut; +using detail_fft::r2c; +using detail_fft::r2r_fftpack; +using detail_fft::r2r_fftw; +using detail_fft::r2r_separable_hartley; +using detail_fft::r2r_genuine_hartley; +using detail_fft::r2r_separable_fht; +using detail_fft::r2r_genuine_fht; +using detail_fft::dct; +using detail_fft::dst; +using detail_fft::convolve_axis; + +inline size_t good_size_complex(size_t n) + { return detail_fft::util1d::good_size_cmplx(n); } +inline size_t good_size_real(size_t n) + { return detail_fft::util1d::good_size_real(n); } + +} + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/fft/fft1d_impl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/fft/fft1d_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..f2bf69361a1540942f0a11fc1528a191d8d7ba9d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/fft/fft1d_impl.h @@ -0,0 +1,2990 @@ +/* +This file is part of the ducc FFT library + +Copyright (C) 2010-2023 Max-Planck-Society +Copyright (C) 2019 Peter Bell + +For the odd-sized DCT-IV transforms: + Copyright (C) 2003, 2007-14 Matteo Frigo + Copyright (C) 2003, 2007-14 Massachusetts Institute of Technology + +Authors: Martin Reinecke, Peter Bell +*/ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_FFT1D_IMPL_H +#define DUCC0_FFT1D_IMPL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ducc0/infra/useful_macros.h" +#include "ducc0/math/cmplx.h" +#include "ducc0/infra/error_handling.h" +#include "ducc0/infra/aligned_array.h" +#include "ducc0/infra/simd.h" +#include "ducc0/infra/threading.h" +#include "ducc0/math/unity_roots.h" +#include "ducc0/fft/fft.h" + +namespace ducc0 { + +namespace detail_fft { + +using namespace std; + +// the next line is necessary to address some sloppy name choices in hipSYCL +using std::min, std::max; + +template constexpr inline size_t fft1d_simdlen + = min(8, native_simd::size()); +template<> constexpr inline size_t fft1d_simdlen + = min(4, native_simd::size()); +template<> constexpr inline size_t fft1d_simdlen + = min(8, native_simd::size()); +template using fft1d_simd = typename simd_select>::type; +template constexpr inline bool fft1d_simd_exists = (fft1d_simdlen > 1); + +// Always use std:: for functions +template T cos(T) = delete; +template T sin(T) = delete; +template T sqrt(T) = delete; + +template void ROTX90(Cmplx &a) + { auto tmp_= fwd ? -a.r : a.r; a.r = fwd ? a.i : -a.i; a.i=tmp_; } + +#define POCKETFFT_EXEC_DISPATCH \ + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, \ + bool fwd, size_t nthreads=1) const \ + { \ + static const auto tics = tidx(); \ + if (ti==tics) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + if constexpr (fft1d_simdlen > 1) \ + if constexpr (simd_exists>) \ + { \ + using Tfv = typename simd_select>::type; \ + using Tcv = Cmplx; \ + static const auto ticv = tidx(); \ + if (ti==ticv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 2) \ + if constexpr (simd_exists/2>) \ + { \ + using Tfv = typename simd_select/2>::type; \ + using Tcv = Cmplx; \ + static const auto ticv = tidx(); \ + if (ti==ticv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 4) \ + if constexpr (simd_exists/4>) \ + { \ + using Tfv = typename simd_select/4>::type; \ + using Tcv = Cmplx; \ + static const auto ticv = tidx(); \ + if (ti==ticv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 8) \ + if constexpr (simd_exists/8>) \ + { \ + using Tfv = typename simd_select/8>::type; \ + using Tcv = Cmplx; \ + static const auto ticv = tidx(); \ + if (ti==ticv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + MR_fail("impossible vector length requested"); \ + } + +template class cfftp1: public cfftpass + { + public: + cfftp1() {} + virtual size_t bufsize() const { return 0; } + virtual bool needs_copy() const { return false; } + + virtual void *exec(const type_index & /*ti*/, void * in, void * /*copy*/, + void * /*buf*/, bool /*fwd*/, size_t /*nthreads*/) const + { return in; } + }; + +template class cfftp2: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=2; + aligned_array wa; + + auto WA(size_t i) const + { return wa[i-1]; } + + template Tcd *exec_ (const Tcd * DUCC0_RESTRICT cc, + Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, size_t /*nthreads*/) const + { + if (ido==1) + { + auto CH = [ch,this](size_t b, size_t c) -> Tcd& + { return ch[b+l1*c]; }; + auto CC = [cc](size_t b, size_t c) -> const Tcd& + { return cc[b+ip*c]; }; + for (size_t k=0; k Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + for (size_t k=0; k(CC(i,0,k)-CC(i,1,k),WA(i),CH(i,k,1)); + } + } + return ch; + } + } + + public: + cfftp2(size_t l1_, size_t ido_, const Troots &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp3: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=3; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + constexpr Tfs tw1r=-0.5, + tw1i= (fwd ? -1: 1) * Tfs(0.8660254037844386467637231707529362L); + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +#define POCKETFFT_PREP3(idx) \ + Tcd t0 = CC(idx,0,k), t1, t2; \ + PM (t1,t2,CC(idx,1,k),CC(idx,2,k)); \ + CH(idx,k,0)=t0+t1; +#define POCKETFFT_PARTSTEP3a(u1,u2,twr,twi) \ + { \ + Tcd ca=t0+t1*twr; \ + Tcd cb{-t2.i*twi, t2.r*twi}; \ + PM(CH(0,k,u1),CH(0,k,u2),ca,cb) ;\ + } +#define POCKETFFT_PARTSTEP3b(u1,u2,twr,twi) \ + { \ + Tcd ca=t0+t1*twr; \ + Tcd cb{-t2.i*twi, t2.r*twi}; \ + special_mul(ca+cb,WA(u1-1,i),CH(i,k,u1)); \ + special_mul(ca-cb,WA(u2-1,i),CH(i,k,u2)); \ + } + + if (ido==1) + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp4: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=4; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + if (ido==1) + { + auto CH = [ch,this](size_t b, size_t c) -> Tcd& + { return ch[b+l1*c]; }; + auto CC = [cc](size_t b, size_t c) -> const Tcd& + { return cc[b+ip*c]; }; + for (size_t k=0; k(t4); + PM(CH(k,0),CH(k,2),t2,t3); + PM(CH(k,1),CH(k,3),t1,t4); + } + } + else + { + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + for (size_t k=0; k(t4); + PM(CH(0,k,0),CH(0,k,2),t2,t3); + PM(CH(0,k,1),CH(0,k,3),t1,t4); + } + for (size_t i=1; i(t4); + CH(i,k,0) = t2+t3; + special_mul(t1+t4,WA(0,i),CH(i,k,1)); + special_mul(t2-t3,WA(1,i),CH(i,k,2)); + special_mul(t1-t4,WA(2,i),CH(i,k,3)); + } + } + } + return ch; + } + + public: + cfftp4(size_t l1_, size_t ido_, const Troots &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp5: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=5; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + constexpr Tfs tw1r= Tfs(0.3090169943749474241022934171828191L), + tw1i= (fwd ? -1: 1) * Tfs(0.9510565162951535721164393333793821L), + tw2r= Tfs(-0.8090169943749474241022934171828191L), + tw2i= (fwd ? -1: 1) * Tfs(0.5877852522924731291687059546390728L); + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +#define POCKETFFT_PREP5(idx) \ + Tcd t0 = CC(idx,0,k), t1, t2, t3, t4; \ + PM (t1,t4,CC(idx,1,k),CC(idx,4,k)); \ + PM (t2,t3,CC(idx,2,k),CC(idx,3,k)); \ + CH(idx,k,0).r=t0.r+t1.r+t2.r; \ + CH(idx,k,0).i=t0.i+t1.i+t2.i; + +#define POCKETFFT_PARTSTEP5a(u1,u2,twar,twbr,twai,twbi) \ + { \ + Tcd ca,cb; \ + ca.r=t0.r+twar*t1.r+twbr*t2.r; \ + ca.i=t0.i+twar*t1.i+twbr*t2.i; \ + cb.i=twai*t4.r twbi*t3.r; \ + cb.r=-(twai*t4.i twbi*t3.i); \ + PM(CH(0,k,u1),CH(0,k,u2),ca,cb); \ + } + +#define POCKETFFT_PARTSTEP5b(u1,u2,twar,twbr,twai,twbi) \ + { \ + Tcd ca,cb,da,db; \ + ca.r=t0.r+twar*t1.r+twbr*t2.r; \ + ca.i=t0.i+twar*t1.i+twbr*t2.i; \ + cb.i=twai*t4.r twbi*t3.r; \ + cb.r=-(twai*t4.i twbi*t3.i); \ + special_mul(ca+cb,WA(u1-1,i),CH(i,k,u1)); \ + special_mul(ca-cb,WA(u2-1,i),CH(i,k,u2)); \ + } + + if (ido==1) + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp7: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=7; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + constexpr Tfs tw1r= Tfs(0.6234898018587335305250048840042398L), + tw1i= (fwd ? -1 : 1) * Tfs(0.7818314824680298087084445266740578L), + tw2r= Tfs(-0.2225209339563144042889025644967948L), + tw2i= (fwd ? -1 : 1) * Tfs(0.9749279121818236070181316829939312L), + tw3r= Tfs(-0.9009688679024191262361023195074451L), + tw3i= (fwd ? -1 : 1) * Tfs(0.433883739117558120475768332848359L); + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +#define POCKETFFT_PREP7(idx) \ + Tcd t1 = CC(idx,0,k), t2, t3, t4, t5, t6, t7; \ + PM (t2,t7,CC(idx,1,k),CC(idx,6,k)); \ + PM (t3,t6,CC(idx,2,k),CC(idx,5,k)); \ + PM (t4,t5,CC(idx,3,k),CC(idx,4,k)); \ + CH(idx,k,0).r=t1.r+t2.r+t3.r+t4.r; \ + CH(idx,k,0).i=t1.i+t2.i+t3.i+t4.i; + +#define POCKETFFT_PARTSTEP7a0(u1,u2,x1,x2,x3,y1,y2,y3,out1,out2) \ + { \ + Tcd ca,cb; \ + ca.r=t1.r+x1*t2.r+x2*t3.r+x3*t4.r; \ + ca.i=t1.i+x1*t2.i+x2*t3.i+x3*t4.i; \ + cb.i=y1*t7.r y2*t6.r y3*t5.r; \ + cb.r=-(y1*t7.i y2*t6.i y3*t5.i); \ + PM(out1,out2,ca,cb); \ + } +#define POCKETFFT_PARTSTEP7a(u1,u2,x1,x2,x3,y1,y2,y3) \ + POCKETFFT_PARTSTEP7a0(u1,u2,x1,x2,x3,y1,y2,y3,CH(0,k,u1),CH(0,k,u2)) +#define POCKETFFT_PARTSTEP7(u1,u2,x1,x2,x3,y1,y2,y3) \ + { \ + Tcd da,db; \ + POCKETFFT_PARTSTEP7a0(u1,u2,x1,x2,x3,y1,y2,y3,da,db) \ + special_mul(da,WA(u1-1,i),CH(i,k,u1)); \ + special_mul(db,WA(u2-1,i),CH(i,k,u2)); \ + } + + if (ido==1) + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftp8: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=8; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template void ROTX45(T &a) const + { + constexpr Tfs hsqt2=Tfs(0.707106781186547524400844362104849L); + if constexpr (fwd) + { auto tmp_=a.r; a.r=hsqt2*(a.r+a.i); a.i=hsqt2*(a.i-tmp_); } + else + { auto tmp_=a.r; a.r=hsqt2*(a.r-a.i); a.i=hsqt2*(a.i+tmp_); } + } + template void ROTX135(T &a) const + { + constexpr Tfs hsqt2=Tfs(0.707106781186547524400844362104849L); + if constexpr (fwd) + { auto tmp_=a.r; a.r=hsqt2*(a.i-a.r); a.i=hsqt2*(-tmp_-a.i); } + else + { auto tmp_=a.r; a.r=hsqt2*(-a.r-a.i); a.i=hsqt2*(tmp_-a.i); } + } + + template Tcd *exec_ + (Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, size_t /*nthreads*/) const + { + if (l1==1) + { + auto CC = [cc,this](size_t a, size_t b) -> Tcd& + { return cc[a+ido*b]; }; + { + Tcd a0, a1, a2, a3, a4, a5, a6, a7; + PM(a1,a5,CC(0,1),CC(0,5)); + PM(a3,a7,CC(0,3),CC(0,7)); + PMINPLACE(a1,a3); + ROTX90(a3); + + ROTX90(a7); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + + PM(a0,a4,CC(0,0),CC(0,4)); + PM(a2,a6,CC(0,2),CC(0,6)); + PM(CC(0,0),CC(0,4),a0+a2,a1); + PM(CC(0,2),CC(0,6),a0-a2,a3); + ROTX90(a6); + PM(CC(0,1),CC(0,5),a4+a6,a5); + PM(CC(0,3),CC(0,7),a4-a6,a7); + } + for (size_t i=1; i(a7); + PMINPLACE(a1,a3); + ROTX90(a3); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + PM(a0,a4,CC(i,0),CC(i,4)); + PM(a2,a6,CC(i,2),CC(i,6)); + PMINPLACE(a0,a2); + CC(i,0) = a0+a1; + special_mul(a0-a1,WA(3,i),CC(i,4)); + special_mul(a2+a3,WA(1,i),CC(i,2)); + special_mul(a2-a3,WA(5,i),CC(i,6)); + ROTX90(a6); + PMINPLACE(a4,a6); + special_mul(a4+a5,WA(0,i),CC(i,1)); + special_mul(a4-a5,WA(4,i),CC(i,5)); + special_mul(a6+a7,WA(2,i),CC(i,3)); + special_mul(a6-a7,WA(6,i),CC(i,7)); + } + return cc; + } + if (ido==1) + { + auto CH = [ch,this](size_t b, size_t c) -> Tcd& + { return ch[b+l1*c]; }; + auto CC = [cc](size_t b, size_t c) -> const Tcd& + { return cc[b+ip*c]; }; + for (size_t k=0; k(a3); + + ROTX90(a7); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + + PM(a0,a4,CC(0,k),CC(4,k)); + PM(a2,a6,CC(2,k),CC(6,k)); + PM(CH(k,0),CH(k,4),a0+a2,a1); + PM(CH(k,2),CH(k,6),a0-a2,a3); + ROTX90(a6); + PM(CH(k,1),CH(k,5),a4+a6,a5); + PM(CH(k,3),CH(k,7),a4-a6,a7); + } + } + else + { + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + for (size_t k=0; k(a3); + + ROTX90(a7); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + + PM(a0,a4,CC(0,0,k),CC(0,4,k)); + PM(a2,a6,CC(0,2,k),CC(0,6,k)); + PM(CH(0,k,0),CH(0,k,4),a0+a2,a1); + PM(CH(0,k,2),CH(0,k,6),a0-a2,a3); + ROTX90(a6); + PM(CH(0,k,1),CH(0,k,5),a4+a6,a5); + PM(CH(0,k,3),CH(0,k,7),a4-a6,a7); + } + for (size_t i=1; i(a7); + PMINPLACE(a1,a3); + ROTX90(a3); + PMINPLACE(a5,a7); + ROTX45(a5); + ROTX135(a7); + PM(a0,a4,CC(i,0,k),CC(i,4,k)); + PM(a2,a6,CC(i,2,k),CC(i,6,k)); + PMINPLACE(a0,a2); + CH(i,k,0) = a0+a1; + special_mul(a0-a1,WA(3,i),CH(i,k,4)); + special_mul(a2+a3,WA(1,i),CH(i,k,2)); + special_mul(a2-a3,WA(5,i),CH(i,k,6)); + ROTX90(a6); + PMINPLACE(a4,a6); + special_mul(a4+a5,WA(0,i),CH(i,k,1)); + special_mul(a4-a5,WA(4,i),CH(i,k,5)); + special_mul(a6+a7,WA(2,i),CH(i,k,3)); + special_mul(a6-a7,WA(6,i),CH(i,k,7)); + } + } + } + return ch; + } + + public: + cfftp8(size_t l1_, size_t ido_, const Troots &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i1; } + + POCKETFFT_EXEC_DISPATCH + }; + +template class cfftp11: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + static constexpr size_t ip=11; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[x+(i-1)*(ip-1)]; } + + template [[gnu::hot]] Tcd *exec_ + (const Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, + size_t /*nthreads*/) const + { + constexpr Tfs tw1r= Tfs(0.8412535328311811688618116489193677L), + tw1i= (fwd ? -1 : 1) * Tfs(0.5406408174555975821076359543186917L), + tw2r= Tfs(0.4154150130018864255292741492296232L), + tw2i= (fwd ? -1 : 1) * Tfs(0.9096319953545183714117153830790285L), + tw3r= Tfs(-0.1423148382732851404437926686163697L), + tw3i= (fwd ? -1 : 1) * Tfs(0.9898214418809327323760920377767188L), + tw4r= Tfs(-0.6548607339452850640569250724662936L), + tw4i= (fwd ? -1 : 1) * Tfs(0.7557495743542582837740358439723444L), + tw5r= Tfs(-0.9594929736144973898903680570663277L), + tw5i= (fwd ? -1 : 1) * Tfs(0.2817325568414296977114179153466169L); + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +#define POCKETFFT_PREP11(idx) \ + Tcd t1 = CC(idx,0,k), t2, t3, t4, t5, t6, t7, t8, t9, t10, t11; \ + PM (t2,t11,CC(idx,1,k),CC(idx,10,k)); \ + PM (t3,t10,CC(idx,2,k),CC(idx, 9,k)); \ + PM (t4,t9 ,CC(idx,3,k),CC(idx, 8,k)); \ + PM (t5,t8 ,CC(idx,4,k),CC(idx, 7,k)); \ + PM (t6,t7 ,CC(idx,5,k),CC(idx, 6,k)); \ + CH(idx,k,0).r=t1.r+t2.r+t3.r+t4.r+t5.r+t6.r; \ + CH(idx,k,0).i=t1.i+t2.i+t3.i+t4.i+t5.i+t6.i; + +#define POCKETFFT_PARTSTEP11a0(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5,out1,out2) \ + { \ + Tcd ca = t1 + t2*x1 + t3*x2 + t4*x3 + t5*x4 +t6*x5, \ + cb; \ + cb.i=y1*t11.r y2*t10.r y3*t9.r y4*t8.r y5*t7.r; \ + cb.r=-(y1*t11.i y2*t10.i y3*t9.i y4*t8.i y5*t7.i ); \ + PM(out1,out2,ca,cb); \ + } +#define POCKETFFT_PARTSTEP11a(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5) \ + POCKETFFT_PARTSTEP11a0(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5,CH(0,k,u1),CH(0,k,u2)) +#define POCKETFFT_PARTSTEP11(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5) \ + { \ + Tcd da,db; \ + POCKETFFT_PARTSTEP11a0(u1,u2,x1,x2,x3,x4,x5,y1,y2,y3,y4,y5,da,db) \ + special_mul(da,WA(u1-1,i),CH(i,k,u1)); \ + special_mul(db,WA(u2-1,i),CH(i,k,u2)); \ + } + + if (ido==1) + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t i=1; i class cfftpg: public cfftpass + { + private: + using typename cfftpass::Tcs; + + size_t l1, ido; + size_t ip; + aligned_array wa; + aligned_array csarr; + + auto WA(size_t x, size_t i) const + { return wa[i-1+x*(ido-1)]; } + + template Tcd *exec_ + (Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, Tcd * /*buf*/, size_t /*nthreads*/) const + { + size_t ipph = (ip+1)/2; + size_t idl1 = ido*l1; + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tcd& + { return cc[a+ido*(b+ip*c)]; }; + auto CX = [cc,this](size_t a, size_t b, size_t c) -> Tcd& + { return cc[a+ido*(b+l1*c)]; }; + auto CX2 = [cc, idl1](size_t a, size_t b) -> Tcd& + { return cc[a+idl1*b]; }; + auto CH2 = [ch, idl1](size_t a, size_t b) -> const Tcd& + { return ch[a+idl1*b]; }; + + for (size_t k=0; kip) iwal-=ip; + Tcs xwal=fwd ? csarr[iwal].conj() : csarr[iwal]; + iwal+=l; if (iwal>ip) iwal-=ip; + Tcs xwal2=fwd ? csarr[iwal].conj() : csarr[iwal]; + for (size_t ik=0; ikip) iwal-=ip; + Tcs xwal=fwd ? csarr[iwal].conj() : csarr[iwal]; + for (size_t ik=0; ik(x1,wa[idij],CX(i,k,j)); + idij=(jc-1)*(ido-1)+i-1; + special_mul(x2,wa[idij],CX(i,k,jc)); + } + } + } + return cc; + } + + public: + cfftpg(size_t l1_, size_t ido_, size_t ip_, const Troots &roots) + : l1(l1_), ido(ido_), ip(ip_), wa((ip-1)*(ido-1)), csarr(ip) + { + MR_assert((ip&1)&&(ip>=5), "need an odd number >=5"); + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class cfftpblue: public cfftpass + { + private: + using typename cfftpass::Tcs; + + const size_t l1, ido, ip; + const size_t ip2; + const Tcpass subplan; + aligned_array wa, bk, bkf; + size_t bufsz; + bool need_cpy; + + auto WA(size_t x, size_t i) const + { return wa[i-1+x*(ido-1)]; } + + template Tcd *exec_ + (Tcd * DUCC0_RESTRICT cc, Tcd * DUCC0_RESTRICT ch, + Tcd * DUCC0_RESTRICT buf, size_t nthreads) const + { + static const auto ti=tidx(); + Tcd *akf = &buf[0]; + Tcd *akf2 = subplan->needs_copy() ? (&buf[ip2]) : akf; + Tcd *subbuf = akf2+ip2; + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tcd& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> Tcd& + { return cc[a+ido*(b+ip*c)]; }; + +//FIXME: parallelize here? + for (size_t k=0; k(CC(i,m,k),bk[m],akf[m]); + auto zero = akf[0]*Tfs(0); + for (size_t m=ip; m(subplan->exec(ti,akf,akf2, + subbuf, true, nthreads)); + + /* do the convolution */ + res[0] = res[0].template special_mul(bkf[0]); + for (size_t m=1; m<(ip2+1)/2; ++m) + { + res[m] = res[m].template special_mul(bkf[m]); + res[ip2-m] = res[ip2-m].template special_mul(bkf[m]); + } + if ((ip2&1)==0) + res[ip2/2] = res[ip2/2].template special_mul(bkf[ip2/2]); + + /* inverse FFT */ + res = static_cast(subplan->exec(ti, res, + (res==akf) ? akf2 : akf, subbuf, false, nthreads)); + + /* multiply by b_k and write to output buffer */ + if (l1>1) + { + if (i==0) + for (size_t m=0; m(bk[m]); + else + { + CH(i,k,0) = res[0].template special_mul(bk[0]); + for (size_t m=1; m(bk[m]*WA(m-1,i)); + } + } + else + { + if (i==0) + for (size_t m=0; m(bk[m]); + else + { + CC(i,0,0) = res[0].template special_mul(bk[0]); + for (size_t m=1; m(bk[m]*WA(m-1,i)); + } + } + } + + return (l1>1) ? ch : cc; + } + + public: + cfftpblue(size_t l1_, size_t ido_, size_t ip_, const Troots &roots, + bool vectorize=false) + : l1(l1_), ido(ido_), ip(ip_), ip2(util1d::good_size_cmplx(ip*2-1)), + subplan(cfftpass::make_pass(ip2, vectorize)), wa((ip-1)*(ido-1)), + bk(ip), bkf(ip2/2+1) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; jsize()/(2*ip))*2*ip==roots->size()) ? + roots : make_shared>(2*ip); + size_t rfct2 = roots2->size()/(2*ip); + for (size_t m=1; m=2*ip) coeff-=2*ip; + bk[m] = (*roots2)[coeff*rfct2]; + } + + /* initialize the zero-padded, Fourier transformed b_k. Add normalisation. */ + aligned_array tbkf(ip2), tbkf2(ip2); + Tfs xn2 = Tfs(1)/Tfs(ip2); + tbkf[0] = bk[0]*xn2; + for (size_t m=1; m buf(subplan->bufsize()); + static const auto tics=tidx(); + auto res = static_cast(subplan->exec(tics, tbkf.data(), + tbkf2.data(), buf.data(), true)); + for (size_t i=0; i1; + bufsz = ip2*(1+subplan->needs_copy()) + subplan->bufsize(); + } + + virtual size_t bufsize() const { return bufsz; } + virtual bool needs_copy() const { return need_cpy; } + + POCKETFFT_EXEC_DISPATCH + }; + +template class cfft_multipass: public cfftpass + { + private: + using typename cfftpass::Tcs; + static constexpr size_t bunchsize=8; + + const size_t l1, ido; + size_t ip; + vector> passes; + size_t bufsz; + bool need_cpy; + size_t rfct; + Troots myroots; + +// FIXME split into sub-functions. This is too long! + template Cmplx *exec_(Cmplx *cc, Cmplx *ch, + Cmplx *buf, size_t nthreads) const + { + using Tc = Cmplx; + if ((l1==1) && (ido==1)) // no chance at vectorizing + { + static const auto tic=tidx(); + Tc *p1=cc, *p2=ch; + for(const auto &pass: passes) + { + auto res = static_cast(pass->exec(tic, p1, p2, buf, + fwd, nthreads)); + if (res==p2) swap (p1,p2); + } + return p1; + } + else + { + if constexpr(is_same::value && fft1d_simd_exists) // we can vectorize! + { + using Tfv = fft1d_simd; + using Tcv = Cmplx; + constexpr size_t vlen = Tfv::size(); + size_t nvtrans = (l1*ido + vlen-1)/vlen; + // NOTE: removed "static" here, because it leads to trouble with gcc 7 + // static const type_index ticv = tidx(); + const type_index ticv = tidx(); + + if (ido==1) + { + auto CH = [ch,this](size_t b, size_t c) -> Tc& + { return ch[b+l1*c]; }; + auto CC = [cc,this](size_t b, size_t c) -> Tc& + { return cc[b+ip*c]; }; + + execStatic(nvtrans, nthreads, 0, [&](auto &sched) + { + aligned_array tbuf(2*ip+32+bufsize()); + auto cc2 = &tbuf[0]; + auto ch2 = &tbuf[ip+16]; + auto buf2 = &tbuf[2*ip+32]; + + while (auto rng=sched.getNext()) + for(auto itrans=rng.lo; itrans(pass->exec(ticv, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + + for (size_t m=0; m Tc& + { return cc[a+ido*b]; }; + + execStatic(nvtrans, nthreads, 0, [&](auto &sched) + { + aligned_array tbuf(2*ip+32+bufsize()); + auto cc2 = &tbuf[0]; + auto ch2 = &tbuf[ip+16]; + auto buf2 = &tbuf[2*ip+32]; + + while (auto rng=sched.getNext()) + for(auto itrans=rng.lo; itrans(pass->exec(ticv, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + + for (size_t m=0; m= ido) break; + if (i==0) + CC(0,m) = { p1[m].r[n], p1[m].i[n] }; + else + { + if (m==0) + CC(i,0) = { p1[0].r[n], p1[0].i[n] } ; + else + CC(i,m) = Tcs(p1[m].r[n],p1[m].i[n]).template special_mul((*myroots)[rfct*m*i]); + } + } + } + }); + return cc; + } + +MR_fail("must not get here"); +#if 0 +//FIXME this code path is currently unused + aligned_array tbuf(2*ip+bufsize()); + auto cc2 = &tbuf[0]; + auto ch2 = &tbuf[ip]; + auto buf2 = &tbuf[2*ip]; + + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tc& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> Tc& + { return cc[a+ido*(b+ip*c)]; }; + +//FIXME parallelize? + for (size_t itrans=0; itrans ix, kx; + size_t ixcur = (itrans*vlen)%ido; + size_t kxcur = (itrans*vlen)/ido; + for (size_t n=0; n(pass->exec(ticv, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + + for (size_t m=0; m= l1*ido) break; + if (i==0) + CH(0,k,m) = { p1[m].r[n], p1[m].i[n] }; + else + { + if (m==0) + CH(i,k,0) = { p1[0].r[n], p1[0].i[n] } ; + else + CH(i,k,m) = Tcs(p1[m].r[n],p1[m].i[n]).template special_mul((*myroots)[rfct*l1*m*i]); + } + } + } + return ch; +#endif + } + else + { + static const auto tic = tidx *>(); + if (ido==1) + { +// parallelize here! + for (size_t n=0; n *p1=&cc[n*ip], *p2=ch; + Cmplx *res = nullptr; + for(const auto &pass: passes) + { + res = static_cast *>(pass->exec(tic, + p1, p2, buf, fwd)); + if (res==p2) swap (p1,p2); + } + if (res != &cc[n*ip]) + copy(res, res+ip, cc+n*ip); + } + // transpose + size_t nbunch = (l1*ido + bunchsize-1)/bunchsize; +// parallelize here! + for (size_t ibunch=0; ibunch Tc& + { return cc[a+ido*b]; }; + +// parallelize here! + for (size_t ibunch=0; ibunch *p1=&cc2[n*ip], *p2=ch2; + Cmplx *res = nullptr; + for(const auto &pass: passes) + { + res = static_cast *>(pass->exec(tic, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + if (res==&cc2[n*ip]) // no copying necessary + { + if (i!=0) + { + for (size_t m=1; m((*myroots)[rfct*m*i]); + } + } + else + { + if (i==0) + for (size_t m=0; m((*myroots)[rfct*m*i]); + } + } + } + for (size_t m=0; m Tc& + { return ch[a+ido*(b+l1*c)]; }; + auto CC = [cc,this](size_t a, size_t b, size_t c) -> Tc& + { return cc[a+ido*(b+ip*c)]; }; + +// parallelize here! + for (size_t ibunch=0; ibunch ix, kx; + size_t ixcur = (ibunch*bunchsize)%ido; + size_t kxcur = (ibunch*bunchsize)/ido; + for (size_t n=0; n *p1=&cc2[n*ip], *p2=ch2; + Cmplx *res = nullptr; + for(const auto &pass: passes) + { + res = static_cast *>(pass->exec(tic, + p1, p2, buf2, fwd)); + if (res==p2) swap (p1,p2); + } + if (res==&cc2[n*ip]) // no copying necessary + { + if (i!=0) + { + for (size_t m=1; m((*myroots)[rfct*l1*m*i]); + } + } + else + { + if (i==0) + for (size_t m=0; m((*myroots)[rfct*l1*m*i]); + } + } + } + for (size_t m=0; m &roots, bool /*vectorize*/=false) + : l1(l1_), ido(ido_), ip(ip_), bufsz(0), need_cpy(false), + myroots(roots) + { + size_t N=ip*l1*ido; + rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + + // FIXME TBD +// do we need the vectorize flag at all? + size_t lim = 10000; //vectorize ? 10000 : 10000; + if (ip<=lim) + { + auto factors = cfftpass::factorize(ip); + size_t l1l=1; + for (auto fct: factors) + { + passes.push_back(cfftpass::make_pass(l1l, ip/(fct*l1l), fct, roots, false)); + l1l*=fct; + } + } + else + { + vector packets(2,1); + auto factors = util1d::prime_factors(ip); + sort(factors.begin(), factors.end(), std::greater()); + for (auto fct: factors) + (packets[0]>packets[1]) ? packets[1]*=fct : packets[0]*=fct; + size_t l1l=1; + for (auto pkt: packets) + { + passes.push_back(cfftpass::make_pass(l1l, ip/(pkt*l1l), pkt, roots, false)); + l1l*=pkt; + } + } + for (const auto &pass: passes) + { + bufsz = max(bufsz, pass->bufsize()); + need_cpy |= pass->needs_copy(); + } + if ((l1!=1)||(ido!=1)) + { + need_cpy=true; + bufsz += (bunchsize+1)*ip; + } + } + + virtual size_t bufsize() const { return bufsz; } + virtual bool needs_copy() const { return need_cpy; } + + POCKETFFT_EXEC_DISPATCH + }; + +#undef POCKETFFT_EXEC_DISPATCH + +template class cfftp_vecpass: public cfftpass + { + private: + static_assert(simd_exists, "bad vlen"); + using typename cfftpass::Tcs; + using Tfv=typename simd_select::type; + using Tcv=Cmplx; + + size_t ip; + Tcpass spass; + Tcpass vpass; + size_t bufsz; + + template Tcs *exec_ (Tcs *cc, + Tcs * /*ch*/, Tcs *sbuf, size_t nthreads) const + { + char *xbuf = reinterpret_cast(sbuf); + size_t misalign = reinterpret_cast(xbuf)&(sizeof(Tfv)-1); + if (misalign != 0) + xbuf += sizeof(Tfv)-misalign; + Tcv *buf = reinterpret_cast(xbuf); + auto * cc2 = buf; + auto * ch2 = buf+ip/vlen+7; + auto * buf2 = buf+2*ip/vlen+7+7; + static const auto tics = tidx(); +// run scalar pass + auto res = static_cast(spass->exec(tics, cc, + reinterpret_cast(ch2), reinterpret_cast(buf2), + fwd, nthreads)); +// arrange input in SIMD-friendly way, must be done out-of-place + for (size_t i=0; i(); + auto res2 = static_cast(vpass->exec(ticv, + cc2, ch2, buf2, fwd, nthreads)); +// de-SIMDify, can be done pseudo-inplace + for (size_t i=0; i &roots) + : ip(ip_), spass(cfftpass::make_pass(1, ip/vlen, vlen, roots)), + vpass(cfftpass::make_pass(1, 1, ip/vlen, roots)), bufsz(0) + { + MR_assert((ip/vlen)*vlen==ip, "cannot vectorize this size"); + bufsz = 2*(ip/vlen)+7+7; + bufsz += max(vpass->bufsize(),(spass->bufsize()+vlen-1)/vlen); // buffers for subpasses + bufsz *= vlen; // since we specify in terms of Tcs + bufsz += vlen; // wiggle room for alignment shifts + } + virtual size_t bufsize() const { return bufsz; } + virtual bool needs_copy() const { return false; } + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, + bool fwd, size_t nthreads=1) const + { + static const auto tics = tidx(); + MR_assert(ti==tics, "bad input type"); + auto in1 = static_cast(in); + auto copy1 = static_cast(copy); + auto buf1 = static_cast(buf); + return fwd ? exec_(in1, copy1, buf1, nthreads) + : exec_(in1, copy1, buf1, nthreads); + } + }; + +template Tcpass cfftpass::make_pass(size_t l1, + size_t ido, size_t ip, const Troots &roots, bool vectorize) + { + MR_assert(ip>=1, "no zero-sized FFTs"); + // do we have an 1D vectorizable FFT? + if (vectorize && (ip>300)&& (ip<=100000) && (l1==1) && (ido==1)) + { +// constexpr auto vlen = native_simd::size(); +// if constexpr(vlen>=4) + constexpr auto vlen = 4; + if constexpr(simd_exists) + if ((ip&(vlen-1))==0) + return make_shared>(ip, roots); + } + + if (ip==1) return make_shared>(); + auto factors=cfftpass::factorize(ip); + if (factors.size()==1) + { + switch(ip) + { + case 2: + return make_shared>(l1, ido, roots); + case 3: + return make_shared>(l1, ido, roots); + case 4: + return make_shared>(l1, ido, roots); + case 5: + return make_shared>(l1, ido, roots); + case 7: + return make_shared>(l1, ido, roots); + case 8: + return make_shared>(l1, ido, roots); + case 11: + return make_shared>(l1, ido, roots); + default: + if (ip<110) + return make_shared>(l1, ido, ip, roots); + else + return make_shared>(l1, ido, ip, roots, vectorize); + } + } + else // more than one factor, need a multipass + return make_shared>(l1, ido, ip, roots, vectorize); + } + +#define POCKETFFT_EXEC_DISPATCH \ + virtual void *exec(const type_index &ti, void *in, void *copy, void *buf, \ + bool fwd, size_t nthreads) const \ + { \ + static const auto tifs=tidx(); \ + if (ti==tifs) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + if constexpr (fft1d_simdlen > 1) \ + if constexpr (simd_exists>) \ + { \ + using Tfv = typename simd_select>::type; \ + static const auto tifv=tidx(); \ + if (ti==tifv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 2) \ + if constexpr (simd_exists/2>) \ + { \ + using Tfv = typename simd_select/2>::type; \ + static const auto tifv=tidx(); \ + if (ti==tifv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 4) \ + if constexpr (simd_exists/4>) \ + { \ + using Tfv = typename simd_select/4>::type; \ + static const auto tifv=tidx(); \ + if (ti==tifv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + if constexpr (fft1d_simdlen > 8) \ + if constexpr (simd_exists/8>) \ + { \ + using Tfv = typename simd_select/8>::type; \ + static const auto tifv=tidx(); \ + if (ti==tifv) \ + { \ + auto in1 = static_cast(in); \ + auto copy1 = static_cast(copy); \ + auto buf1 = static_cast(buf); \ + return fwd ? exec_(in1, copy1, buf1, nthreads) \ + : exec_(in1, copy1, buf1, nthreads); \ + } \ + } \ + MR_fail("impossible vector length requested"); \ + } + +/* (a+ib) = conj(c+id) * (e+if) */ +template inline void MULPM + (T1 &a, T1 &b, T2 c, T2 d, T3 e, T3 f) + { a=c*e+d*f; b=c*f-d*e; } + +template class rfftp1: public rfftpass + { + public: + rfftp1() {} + virtual size_t bufsize() const { return 0; } + virtual bool needs_copy() const { return false; } + + virtual void *exec(const type_index & /*ti*/, void * in, void * /*copy*/, + void * /*buf*/, bool /*fwd*/, size_t /*nthreads*/) const + { return in; } + }; + +template class rfftp2: public rfftpass + { + private: + size_t l1, ido; + static constexpr size_t ip=2; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + if constexpr(fwd) + { + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + for (size_t k=0; k const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftp3: public rfftpass + { + private: + size_t l1, ido; + static constexpr size_t ip=3; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + constexpr Tfs taur=Tfs(-0.5), + taui=Tfs(0.8660254037844386467637231707529362L); + if constexpr(fwd) + { + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + for (size_t k=0; k const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + MR_assert(ido&1, "ido must be odd"); + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftp4: public rfftpass + { + private: + size_t l1, ido; + static constexpr size_t ip=4; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + if constexpr(fwd) + { + constexpr Tfs hsqt2=Tfs(0.707106781186547524400844362104849L); + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + + for (size_t k=0; k const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftp5: public rfftpass + { + private: + size_t l1, ido; + static constexpr size_t ip=5; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + constexpr Tfs tr11= Tfs(0.3090169943749474241022934171828191L), + ti11= Tfs(0.9510565162951535721164393333793821L), + tr12= Tfs(-0.8090169943749474241022934171828191L), + ti12= Tfs(0.5877852522924731291687059546390728L); + + if constexpr(fwd) + { + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + + for (size_t k=0; k const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k &roots) + : l1(l1_), ido(ido_), wa((ip-1)*(ido-1)) + { + MR_assert(ido&1, "ido must be odd"); + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftpg: public rfftpass + { + private: + size_t l1, ido; + size_t ip; + aligned_array wa, csarr; + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * /*buf*/, size_t /*nthreads*/) const + { + if constexpr(fwd) + { + size_t ipph=(ip+1)/2; + size_t idl1 = ido*l1; + + auto CC = [cc,this](size_t a, size_t b, size_t c) -> Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> const Tfd& + { return ch[a+ido*(b+l1*c)]; }; + auto C1 = [cc,this] (size_t a, size_t b, size_t c) -> Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto C2 = [cc,idl1] (size_t a, size_t b) -> Tfd& + { return cc[a+idl1*b]; }; + auto CH2 = [ch,idl1] (size_t a, size_t b) -> Tfd& + { return ch[a+idl1*b]; }; + + if (ido>1) + { + for (size_t j=1, jc=ip-1; j=ip) iang-=ip; + Tfs ar1=csarr[2*iang], ai1=csarr[2*iang+1]; + iang+=l; if (iang>=ip) iang-=ip; + Tfs ar2=csarr[2*iang], ai2=csarr[2*iang+1]; + iang+=l; if (iang>=ip) iang-=ip; + Tfs ar3=csarr[2*iang], ai3=csarr[2*iang+1]; + iang+=l; if (iang>=ip) iang-=ip; + Tfs ar4=csarr[2*iang], ai4=csarr[2*iang+1]; + for (size_t ik=0; ik=ip) iang-=ip; + Tfs ar1=csarr[2*iang], ai1=csarr[2*iang+1]; + iang+=l; if (iang>=ip) iang-=ip; + Tfs ar2=csarr[2*iang], ai2=csarr[2*iang+1]; + for (size_t ik=0; ik=ip) iang-=ip; + Tfs ar=csarr[2*iang], ai=csarr[2*iang+1]; + for (size_t ik=0; ik const Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + auto C1 = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto C2 = [cc,idl1](size_t a, size_t b) -> Tfd& + { return cc[a+idl1*b]; }; + auto CH2 = [ch,idl1](size_t a, size_t b) -> Tfd& + { return ch[a+idl1*b]; }; + + for (size_t k=0; kip) iang-=ip; + Tfs ar1=csarr[2*iang], ai1=csarr[2*iang+1]; + iang+=l; if(iang>ip) iang-=ip; + Tfs ar2=csarr[2*iang], ai2=csarr[2*iang+1]; + iang+=l; if(iang>ip) iang-=ip; + Tfs ar3=csarr[2*iang], ai3=csarr[2*iang+1]; + iang+=l; if(iang>ip) iang-=ip; + Tfs ar4=csarr[2*iang], ai4=csarr[2*iang+1]; + for (size_t ik=0; ikip) iang-=ip; + Tfs ar1=csarr[2*iang], ai1=csarr[2*iang+1]; + iang+=l; if(iang>ip) iang-=ip; + Tfs ar2=csarr[2*iang], ai2=csarr[2*iang+1]; + for (size_t ik=0; ikip) iang-=ip; + Tfs war=csarr[2*iang], wai=csarr[2*iang+1]; + for (size_t ik=0; ik &roots) + : l1(l1_), ido(ido_), ip(ip_), wa((ip-1)*(ido-1)), csarr(2*ip) + { + MR_assert(ido&1, "ido must be odd"); + size_t N=ip*l1*ido; + size_t rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j class rfftpblue: public rfftpass + { + private: + const size_t l1, ido, ip; + aligned_array wa; + const Tcpass cplan; + size_t bufsz; + bool need_cpy; + + auto WA(size_t x, size_t i) const + { return wa[i+x*(ido-1)]; } + + template Tfd *exec_ + (Tfd * DUCC0_RESTRICT cc, Tfd * DUCC0_RESTRICT ch, + Tfd * DUCC0_RESTRICT buf_, size_t nthreads) const + { + using Tcd = Cmplx; + auto buf = reinterpret_cast(buf_); + Tcd *cc2 = &buf[0]; + Tcd *ch2 = &buf[ip]; + Tcd *subbuf = &buf[2*ip]; + static const auto ticd = tidx(); + + if constexpr(fwd) + { + auto CC = [cc,this](size_t a, size_t b, size_t c) -> const Tfd& + { return cc[a+ido*(b+l1*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+ip*c)]; }; + + for (size_t k=0; k(cplan->exec(ticd, cc2, ch2, + subbuf, fwd, nthreads)); + // copy out + CH(0,0,k) = res[0].r; + for (size_t m=1; m<=ip/2; ++m) + { + CH(ido-1,2*m-1,k)=res[m].r; + CH(0,2*m,k)=res[m].i; + } + } + if (ido==1) return ch; + size_t ipph = (ip+1)/2; + for (size_t k=0; k(cplan->exec(ticd, cc2, ch2, + subbuf, fwd, nthreads)); + CH(i-1,0,k) = res[0].r; + CH(i,0,k) = res[0].i; + for (size_t m=1; m Tfd& + { return cc[a+ido*(b+ip*c)]; }; + auto CH = [ch,this](size_t a, size_t b, size_t c) -> Tfd& + { return ch[a+ido*(b+l1*c)]; }; + + for (size_t k=0; k(cplan->exec(ticd, cc2, ch2, + subbuf, fwd, nthreads)); + for (size_t m=0; m(cplan->exec(ticd, cc2, ch2, + subbuf, fwd, nthreads)); + CH(i-1,k,0) = res[0].r; + CH(i,k,0) = res[0].i; + for (size_t m=1; m &roots, bool vectorize=false) + : l1(l1_), ido(ido_), ip(ip_), wa((ip-1)*(ido-1)), + cplan(cfftpass::make_pass(1,1,ip,roots,vectorize)) + { + MR_assert(ip&1, "Bluestein length must be odd"); + MR_assert(ido&1, "ido must be odd"); + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; jbufsize(); } + virtual bool needs_copy() const { return true; } + + POCKETFFT_EXEC_DISPATCH + }; + +template class rfft_multipass: public rfftpass + { + private: + const size_t l1, ido; + size_t ip; + vector> passes; + size_t bufsz; + bool need_cpy; + aligned_array wa; + + auto WA(size_t x, size_t i) const + { return wa[(i-1)*(ip-1)+x]; } + + template Tfd *exec_(Tfd *cc, Tfd *ch, Tfd *buf, + size_t nthreads) const + { + static const auto tifd = tidx(); + if ((l1==1) && (ido==1)) + { + Tfd *p1=cc, *p2=ch; + if constexpr (fwd) + for (auto it=passes.rbegin(); it!=passes.rend(); ++it) + { + auto res = static_cast((*it)->exec(tifd, + p1, p2, buf, fwd, nthreads)); + if (res==p2) swap(p1,p2); + } + else + for (const auto &pass: passes) + { + auto res = static_cast(pass->exec(tifd, + p1, p2, buf, fwd, nthreads)); + if (res==p2) swap(p1,p2); + } + return p1; + } + else + MR_fail("not yet supported"); + } + + public: + rfft_multipass(size_t l1_, size_t ido_, size_t ip_, + const Troots &roots, bool /*vectorize*/=false) + : l1(l1_), ido(ido_), ip(ip_), bufsz(0), need_cpy(false), + wa((ip-1)*(ido-1)) + { + size_t N=ip*l1*ido; + auto rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + for (size_t j=1; j::factorize(ip); + + size_t l1l=1; + for (auto fct: factors) + { + passes.push_back(rfftpass::make_pass(l1l, ip/(fct*l1l), fct, roots)); + l1l*=fct; + } + for (const auto &pass: passes) + { + bufsz = max(bufsz, pass->bufsize()); + need_cpy |= pass->needs_copy(); + } + if ((l1!=1)||(ido!=1)) + { + need_cpy=true; + bufsz += 2*ip; + } + } + + virtual size_t bufsize() const { return bufsz; } + virtual bool needs_copy() const { return need_cpy; } + + POCKETFFT_EXEC_DISPATCH + }; + +template class rfftp_complexify: public rfftpass + { + private: + size_t N; + Troots roots; + size_t rfct; + Tcpass pass; + size_t l1, ido; + static constexpr size_t ip=2; + + template Tfd *exec_ (Tfd * DUCC0_RESTRICT cc, + Tfd * DUCC0_RESTRICT ch, Tfd * buf, size_t nthreads) const + { + using Tcd = Cmplx; + auto ccc = reinterpret_cast(cc); + auto cch = reinterpret_cast(ch); + auto cbuf = reinterpret_cast(buf); + static const auto ticd = tidx(); + if constexpr(fwd) + { + auto res = static_cast(pass->exec(ticd, + ccc, cch, cbuf, true, nthreads)); + auto rres = (res==ccc) ? ch : cc; + rres[0] = res[0].r+res[0].i; +//FIXME: parallelize? + for (size_t i=1, xi=N/2-1; i<=xi; ++i, --xi) + { + auto xe = res[i]+res[xi].conj(); + auto xo = Tcd(res[i].i+res[xi].i, res[xi].r-res[i].r) + * (*roots)[rfct*i].conj(); + rres[2*i-1] = Tfs(0.5)*(xe.r+xo.r); + rres[2*i] = Tfs(0.5)*(xe.i+xo.i); + rres[2*xi-1] = Tfs(0.5)*(xe.r-xo.r); + rres[2*xi] = Tfs(0.5)*(xo.i-xe.i); + } + rres[N-1] = res[0].r-res[0].i; + return rres; + } + else + { + cch[0] = Tcd(cc[0]+cc[N-1], cc[0]-cc[N-1]); +//FIXME: parallelize? + for (size_t i=1, xi=N/2-1; i<=xi; ++i, --xi) + { + Tcd t1 (cc[2*i-1], cc[2*i]); + Tcd t2 (cc[2*xi-1], -cc[2*xi]); + auto xe = t1+t2; + auto xo = (t1-t2)*(*roots)[rfct*i]; + cch[i] = (xe + Tcd(-xo.i, xo.r)); + cch[xi] = (xe.conj() + Tcd(xo.i, xo.r)); + } + auto res = static_cast(pass->exec(ticd, + cch, ccc, cbuf, false, nthreads)); + return (res==ccc) ? cc : ch; + } + } + + public: + rfftp_complexify(size_t N_, const Troots &roots_, bool vectorize=false) + : N(N_), roots(roots_), pass(cfftpass::make_pass(N/2, vectorize)) + { + rfct = roots->size()/N; + MR_assert(roots->size()==N*rfct, "mismatch"); + MR_assert((N&1)==0, "N must be even"); + } + + virtual size_t bufsize() const { return 2*pass->bufsize(); } + virtual bool needs_copy() const { return true; } + + POCKETFFT_EXEC_DISPATCH + }; +#undef POCKETFFT_EXEC_DISPATCH + +template Trpass rfftpass::make_pass(size_t l1, + size_t ido, size_t ip, const Troots &roots, bool vectorize) + { + MR_assert(ip>=1, "no zero-sized FFTs"); + if (ip==1) return make_shared>(); + if ((ip>1000) && ((ip&1)==0)) // use complex transform + { + bool doit = vectorize&&((ip&7)==0); // vecpass might be beneficial + doit |= ip>10000; // complex multipass might be beneficial + if (!doit) + { + auto factors = rfftpass::factorize(ip); + for (auto factor: factors) + // complex Bluestein or larger prime factor functions might be beneficial + if (factor>5) { doit=true; break; } + } + if (doit) + return make_shared>(ip, roots, vectorize); + } + auto factors=rfftpass::factorize(ip); + if (factors.size()==1) + { + switch(ip) + { + case 2: + return make_shared>(l1, ido, roots); + case 3: + return make_shared>(l1, ido, roots); + case 4: + return make_shared>(l1, ido, roots); + case 5: + return make_shared>(l1, ido, roots); + default: + if (ip<135) + return make_shared>(l1, ido, ip, roots); + else + return make_shared>(l1, ido, ip, roots, vectorize); + } + } + else // more than one factor, need a multipass + return make_shared>(l1, ido, ip, roots, vectorize); + } + +}} + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/fft/fftnd_impl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/fft/fftnd_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..424567b0d3d5ea4d04bd7aa0b390aaa74f225f83 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/fft/fftnd_impl.h @@ -0,0 +1,1828 @@ +/* +This file is part of the ducc FFT library. + +Copyright (C) 2010-2023 Max-Planck-Society +Copyright (C) 2019 Peter Bell + +Authors: Martin Reinecke, Peter Bell +*/ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_FFTND_IMPL_H +#define DUCC0_FFTND_IMPL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ducc0/infra/useful_macros.h" +#include "ducc0/infra/error_handling.h" +#include "ducc0/infra/threading.h" +#include "ducc0/infra/misc_utils.h" +#include "ducc0/infra/simd.h" +#include "ducc0/infra/mav.h" +#include "ducc0/infra/aligned_array.h" +#include "ducc0/math/cmplx.h" +#include "ducc0/math/unity_roots.h" +#include "ducc0/fft/fft1d_impl.h" + +/** \file fft.h + * Implementation of multi-dimensional Fast Fourier and related transforms + * \copyright Copyright (C) 2010-2021 Max-Planck-Society + * \copyright Copyright (C) 2019 Peter Bell + * \copyright + * \copyright For the odd-sized DCT-IV transforms: + * \copyright Copyright (C) 2003, 2007-14 Matteo Frigo + * \copyright Copyright (C) 2003, 2007-14 Massachusetts Institute of Technology + * + * \authors Martin Reinecke, Peter Bell + */ + +namespace ducc0 { + +namespace detail_fft { + +// the next line is necessary to address some sloppy name choices in hipSYCL +using std::min, std::max; + +template constexpr inline size_t fft_simdlen + = min(8, native_simd::size()); +template<> constexpr inline size_t fft_simdlen + = min(4, native_simd::size()); +template<> constexpr inline size_t fft_simdlen + = min(8, native_simd::size()); +template using fft_simd = typename simd_select>::type; +template constexpr inline bool fft_simd_exists = (fft_simdlen > 1); + +struct util // hack to avoid duplicate symbols + { + static void sanity_check_axes(size_t ndim, const shape_t &axes) + { + if (ndim==1) + { + if ((axes.size()!=1) || (axes[0]!=0)) + throw std::invalid_argument("bad axes"); + return; + } + shape_t tmp(ndim,0); + if (axes.empty()) throw std::invalid_argument("no axes specified"); + for (auto ax : axes) + { + if (ax>=ndim) throw std::invalid_argument("bad axis number"); + if (++tmp[ax]>1) throw std::invalid_argument("axis specified repeatedly"); + } + } + + DUCC0_NOINLINE static void sanity_check_onetype(const fmav_info &a1, + const fmav_info &a2, bool inplace, const shape_t &axes) + { + sanity_check_axes(a1.ndim(), axes); + MR_assert(a1.conformable(a2), "array sizes are not conformable"); + if (inplace) MR_assert(a1.stride()==a2.stride(), "stride mismatch"); + } + DUCC0_NOINLINE static void sanity_check_cr(const fmav_info &ac, + const fmav_info &ar, const shape_t &axes) + { + sanity_check_axes(ac.ndim(), axes); + MR_assert(ac.ndim()==ar.ndim(), "dimension mismatch"); + for (size_t i=0; i=ac.ndim()) throw std::invalid_argument("bad axis number"); + MR_assert(ac.ndim()==ar.ndim(), "dimension mismatch"); + for (size_t i=0; i std::shared_ptr get_plan(size_t length, bool vectorize=false) + { +#ifdef DUCC0_NO_FFT_CACHE + return std::make_shared(length, vectorize); +#else + constexpr size_t nmax=10; + struct entry { size_t n; bool vectorize; std::shared_ptr ptr; }; + static std::array cache{{{0,0,nullptr}}}; + static std::array last_access{{0}}; + static size_t access_counter = 0; + static Mutex mut; + + auto find_in_cache = [&]() -> std::shared_ptr + { + for (size_t i=0; i(length, vectorize); + { + LockGuard lock(mut); + + auto p = find_in_cache(); + if (p) return p; + + size_t lru = 0; + for (size_t i=1; i class multi_iter + { + private: + shape_t shp, pos; + stride_t str_i, str_o; + size_t cshp_i, cshp_o, rem; + ptrdiff_t cstr_i, cstr_o, sstr_i, sstr_o, p_ii, p_i[N], p_oi, p_o[N]; + bool uni_i, uni_o; + + void advance_i() + { + for (size_t i=0; i=1, "not enough dimensions"); + // Sort the extraneous dimensions in order of ascending output stride; + // this should improve overall cache re-use and avoid clashes between + // threads as much as possible. + shape_t idx(iarr.ndim()); + std::iota(idx.begin(), idx.end(), 0); + sort(idx.begin(), idx.end(), + [&oarr](size_t i1, size_t i2) {return oarr.stride(i1) < oarr.stride(i2);}); + for (auto i: idx) + if (i!=idim) + { + pos.push_back(0); + MR_assert(iarr.shape(i)==oarr.shape(i), "shape mismatch"); + shp.push_back(iarr.shape(i)); + str_i.push_back(iarr.stride(i)); + str_o.push_back(oarr.stride(i)); + } + MR_assert(idim0) + { + sstr_i = str_i[0]; + sstr_o = str_o[0]; + } + + if (nshares==1) return; + if (nshares==0) throw std::runtime_error("can't run with zero threads"); + if (myshare>=nshares) throw std::runtime_error("impossible share requested"); + auto [lo, hi] = calcShare(nshares, myshare, rem); + size_t todo = hi-lo; + + size_t chunk = rem; + for (size_t i2=0, i=pos.size()-1; i2(stride_in() *tsz)&4095)==0) + || ((abs(stride_out()*tsz)&4095)==0); + } + bool critical_stride_other(size_t tsz) const + { + if (unistride_i()==0) return false; // it's just one transform + return ((abs(unistride_i()*tsz)&4095)==0) + || ((abs(unistride_o()*tsz)&4095)==0); + } + }; + +template class TmpStorage + { + private: + aligned_array d; + size_t dofs, dstride; + + public: + TmpStorage(size_t n_trafo, size_t bufsize_data, size_t bufsize_trafo, + size_t n_simultaneous, bool inplace) + { + if (inplace) + { + d.resize(bufsize_trafo); + return; + } + constexpr auto vlen = fft_simdlen; + // FIXME: when switching to C++20, use bit_floor(othersize) + size_t buffct = std::min(vlen, n_trafo); + size_t datafct = std::min(vlen, n_trafo); + if (n_trafo>=n_simultaneous*vlen) datafct = n_simultaneous*vlen; + dstride = bufsize_data; + dofs = bufsize_trafo; + // critical stride avoidance + if ((dstride&256)==0) dstride+=16; + if ((dofs&256)==0) dofs += 16; + d.resize(buffct*dofs + datafct*dstride); + } + + template T2 *transformBuf() + { return reinterpret_cast(d.data()); } + template T2 *dataBuf() + { return reinterpret_cast(d.data()) + dofs; } + size_t data_stride() const + { return dstride; } + }; + +template class TmpStorage2 + { + private: + TmpStorage &stg; + + public: + using datatype = T2; + TmpStorage2(TmpStorage &stg_): stg(stg_) {} + + T2 *transformBuf() { return stg.template transformBuf(); } + T2 *dataBuf() { return stg.template dataBuf(); } + size_t data_stride() const { return stg.data_stride(); } + }; + +template DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav> &src, Cmplx *DUCC0_RESTRICT dst) + { + constexpr auto vlen=Tsimd::size(); + const Cmplx * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i tmp; + for (size_t j=0; j DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav &src, Tsimd *DUCC0_RESTRICT dst) + { + constexpr auto vlen=Tsimd::size(); + const typename Tsimd::value_type * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav &src, T *DUCC0_RESTRICT dst) + { + const T * DUCC0_RESTRICT ptr = src.data(); + if (dst == &src.raw(it.iofs(0))) return; // in-place + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const Cmplx *DUCC0_RESTRICT src, vfmav> &dst) + { + constexpr auto vlen=Tsimd::size(); + Cmplx * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i tmp(src[i]); + for (size_t j=0; j DUCC0_NOINLINE void copy_output(const Titer &it, + const Tsimd *DUCC0_RESTRICT src, vfmav &dst) + { + constexpr auto vlen=Tsimd::size(); + typename Tsimd::value_type * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const T *DUCC0_RESTRICT src, vfmav &dst) + { + T * DUCC0_RESTRICT ptr=dst.data(); + if (src == &dst.raw(it.oofs(0))) return; // in-place + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav> &src, Cmplx * DUCC0_RESTRICT dst, size_t nvec, size_t vstr) + { + constexpr auto vlen=Tsimd::size(); + const Cmplx * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav> &src, Cmplx * DUCC0_RESTRICT dst, size_t nvec, size_t vstr) + { + const Cmplx * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav &src, Tsimd * DUCC0_RESTRICT dst, size_t nvec, size_t vstr) + { + constexpr auto vlen=Tsimd::size(); + const typename Tsimd::value_type * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_input(const Titer &it, + const cfmav &src, T * DUCC0_RESTRICT dst, size_t nvec, size_t vstr) + { + const T * DUCC0_RESTRICT ptr = src.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const Cmplx * DUCC0_RESTRICT src, vfmav> &dst, size_t nvec, size_t vstr) + { + constexpr auto vlen=Tsimd::size(); + Cmplx * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i tmp(src[j0*vstr+i]); + for (size_t j1=0; j1 DUCC0_NOINLINE void copy_output(const Titer &it, + const Cmplx * DUCC0_RESTRICT src, vfmav> &dst, size_t nvec, size_t vstr) + { + Cmplx * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const Tsimd * DUCC0_RESTRICT src, vfmav &dst, size_t nvec, size_t vstr) + { + constexpr auto vlen=Tsimd::size(); + typename Tsimd::value_type * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i DUCC0_NOINLINE void copy_output(const Titer &it, + const T * DUCC0_RESTRICT src, vfmav &dst, size_t nvec, size_t vstr) + { + T * DUCC0_RESTRICT ptr = dst.data(); + for (size_t i=0; i struct add_vec + { using type = typename simd_select::type; }; +template struct add_vec, vlen> + { using type = Cmplx::type>; }; +template using add_vec_t = typename add_vec::type; + +template +DUCC0_NOINLINE void general_nd(const cfmav &in, vfmav &out, + const shape_t &axes, T0 fct, size_t nthreads, const Exec &exec, + const bool /*allow_inplace*/=true) + { + if ((in.ndim()==1)&&(in.stride(0)==1)&&(out.stride(0)==1)) + { + auto plan = get_plan(in.shape(0), true); + exec.exec_simple(in.data(), out.data(), *plan, fct, nthreads); + return; + } + std::shared_ptr plan, vplan; + size_t nth1d = (in.ndim()==1) ? nthreads : 1; + + for (size_t iax=0; iaxlength())) + { + plan = get_plan(len, in.ndim()==1); + vplan = ((in.ndim()==1)||(len<300)||((len&3)!=0)) ? + plan : get_plan(len, true); + } + + execParallel(util::thread_count(nthreads, in, axes[iax], fft_simdlen), + [&](Scheduler &sched) + { + constexpr auto vlen = fft_simdlen; + constexpr size_t nmax = 16; + const auto &tin(iax==0? in : out); + multi_iter it(tin, out, axes[iax], sched.num_threads(), sched.thread_num()); + + // n_simul: vector size + // n_bunch: total size of bunch (multiple of n_simul) + size_t n_simul=1, n_bunch=1; + bool critstride = (((in.stride(axes[iax])*sizeof(T))&4095)==0) + || (((out.stride(axes[iax])*sizeof(T))&4095)==0); + bool nostride = (in.stride(axes[iax])==1) && (out.stride(axes[iax])==1); + + constexpr size_t l2cache=262144*2; + constexpr size_t cacheline=64; + + // working set size + auto wss = [&](size_t vl) { return sizeof(T)*(2*len*vl + plan->bufsize()); }; + // is the FFT small enough to fit into L2 vectorized? + if (wss(1)>l2cache) // "long" FFT, don't execute more than one at the same time + { + n_simul=1; + if (critstride) // make bunch large to reduce overall copy cost + { + n_bunch=n_simul; + while ((n_bunch storage(in.size()/len, len, max(plan->bufsize(),vplan->bufsize()), (n_bunch+vlen-1)/vlen, inplace); + + // first, do all possible steps of size n_bunch, then n_simul + if (n_bunch>1) + { +#ifndef DUCC0_NO_SIMD + if constexpr (vlen>1) + { + constexpr size_t lvlen = vlen; + if (n_simul>=lvlen) + { + if ((n_bunch>n_simul) && (it.remaining()>=n_bunch)) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=n_bunch) + { + it.advance(n_bunch); + exec.exec_n(it, tin, out, storage2, *plan, fct, n_bunch/lvlen, nth1d); + } + } + } + if (n_simul==lvlen) + { + if (it.remaining()>=lvlen) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=lvlen) + { + it.advance(lvlen); + exec(it, tin, out, storage2, *plan, fct, nth1d); + } + } + } + } + if constexpr ((vlen>2) && (simd_exists)) + { + constexpr size_t lvlen = vlen/2; + if (n_simul>=lvlen) + { + if ((n_bunch>n_simul) && (it.remaining()>=n_bunch)) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=n_bunch) + { + it.advance(n_bunch); + exec.exec_n(it, tin, out, storage2, *plan, fct, n_bunch/lvlen, nth1d); + } + } + } + if (n_simul==lvlen) + { + if (it.remaining()>=lvlen) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=lvlen) + { + it.advance(lvlen); + exec(it, tin, out, storage2, *plan, fct, nth1d); + } + } + } + } + if constexpr ((vlen>4) && (simd_exists)) + { + constexpr size_t lvlen = vlen/4; + if (n_simul>=lvlen) + { + if ((n_bunch>n_simul) && (it.remaining()>=n_bunch)) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=n_bunch) + { + it.advance(n_bunch); + exec.exec_n(it, tin, out, storage2, *plan, fct, n_bunch/lvlen, nth1d); + } + } + } + if (n_simul==lvlen) + { + if (it.remaining()>=lvlen) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=lvlen) + { + it.advance(lvlen); + exec(it, tin, out, storage2, *plan, fct, nth1d); + } + } + } + } +#endif + { + TmpStorage2 storage2(storage); + while ((n_bunch>n_simul) && (it.remaining()>=n_bunch)) + { + it.advance(n_bunch); + exec.exec_n(it, tin, out, storage2, *vplan, fct, n_bunch, nth1d); + } + } + } + { + TmpStorage2 storage2(storage); + while (it.remaining()>0) + { + it.advance(1); + exec(it, tin, out, storage2, *vplan, fct, nth1d, inplace); + } + } + }); // end of parallel region + fct = T0(1); // factor has been applied, use 1 for remaining axes + } + } + +struct ExecC2C + { + bool forward; + + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav> &in, + vfmav> &out, Tstorage &storage, const pocketfft_c &plan, T0 fct, + size_t nthreads, bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same, T>::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, forward, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, forward, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav> &in, + vfmav> &out, Tstorage &storage, const pocketfft_c &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const Cmplx *in, Cmplx *out, const pocketfft_c &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, forward, nthreads); + } + }; + +struct ExecHartley + { + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav &in, vfmav &out, + Tstorage &storage, const pocketfft_hartley &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const pocketfft_hartley &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const pocketfft_hartley &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, nthreads); + } + }; + +struct ExecFHT + { + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav &in, vfmav &out, + Tstorage &storage, const pocketfft_fht &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const pocketfft_fht &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const pocketfft_fht &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, nthreads); + } + }; + +struct ExecFFTW + { + bool forward; + + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav &in, vfmav &out, + Tstorage &storage, const pocketfft_fftw &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, forward, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, forward, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const pocketfft_fftw &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const pocketfft_fftw &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, forward, nthreads); + } + }; + +struct ExecDcst + { + bool ortho; + int type; + bool cosine; + + template + DUCC0_NOINLINE void operator() (const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const Tplan &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + if (in.data()!=out.data()) + copy_input(it, in, out.data()+it.oofs(0)); + plan.exec_copyback(out.data()+it.oofs(0), storage.transformBuf(), fct, ortho, type, cosine, nthreads); + return; + } + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan.exec(buf2, buf1, fct, ortho, type, cosine, nthreads); + copy_output(it, res, out); + } + template DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const Tplan &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + for (size_t i=0; i DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const Tplan &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + plan.exec(out, fct, ortho, type, cosine, nthreads); + } + }; + +template DUCC0_NOINLINE void general_r2c( + const cfmav &in, vfmav> &out, size_t axis, bool forward, T fct, + size_t nthreads) + { + size_t nth1d = (in.ndim()==1) ? nthreads : 1; + auto plan = std::make_unique>(in.shape(axis)); + size_t len=in.shape(axis); + execParallel( + util::thread_count(nthreads, in, axis, fft_simdlen), + [&](Scheduler &sched) { + constexpr auto vlen = fft_simdlen; + TmpStorage storage(in.size()/len, len, plan->bufsize(), 1, false); + multi_iter it(in, out, axis, sched.num_threads(), sched.thread_num()); +#ifndef DUCC0_NO_SIMD + if constexpr (vlen>1) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + while (it.remaining()>=vlen) + { + it.advance(vlen); + copy_input(it, in, dbuf); + auto res = plan->exec(dbuf, tbuf, fct, true, nth1d); + auto vout = out.data(); + for (size_t j=0; j2) + if constexpr (simd_exists) + if (it.remaining()>=vlen/2) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + it.advance(vlen/2); + copy_input(it, in, dbuf); + auto res = plan->exec(dbuf, tbuf, fct, true, nth1d); + auto vout = out.data(); + for (size_t j=0; j4) + if constexpr( simd_exists) + if (it.remaining()>=vlen/4) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + it.advance(vlen/4); + copy_input(it, in, dbuf); + auto res = plan->exec(dbuf, tbuf, fct, true, nth1d); + auto vout = out.data(); + for (size_t j=0; j storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + while (it.remaining()>0) + { + it.advance(1); + copy_input(it, in, dbuf); + auto res = plan->exec(dbuf, tbuf, fct, true, nth1d); + auto vout = out.data(); + vout[it.oofs(0)].Set(res[0]); + size_t i=1, ii=1; + if (forward) + for (; i DUCC0_NOINLINE void general_c2r( + const cfmav> &in, vfmav &out, size_t axis, bool forward, T fct, + size_t nthreads) + { + size_t nth1d = (in.ndim()==1) ? nthreads : 1; + auto plan = std::make_unique>(out.shape(axis)); + size_t len=out.shape(axis); + execParallel( + util::thread_count(nthreads, in, axis, fft_simdlen), + [&](Scheduler &sched) { + constexpr auto vlen = fft_simdlen; + TmpStorage storage(out.size()/len, len, plan->bufsize(), 1, false); + multi_iter it(in, out, axis, sched.num_threads(), sched.thread_num()); +#ifndef DUCC0_NO_SIMD + if constexpr (vlen>1) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + while (it.remaining()>=vlen) + { + it.advance(vlen); + for (size_t j=0; jexec(dbuf, tbuf, fct, false, nth1d); + copy_output(it, res, out); + } + } + if constexpr (vlen>2) + if constexpr (simd_exists) + if (it.remaining()>=vlen/2) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + it.advance(vlen/2); + for (size_t j=0; jexec(dbuf, tbuf, fct, false, nth1d); + copy_output(it, res, out); + } + if constexpr (vlen>4) + if constexpr(simd_exists) + if (it.remaining()>=vlen/4) + { + TmpStorage2,T,T> storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + it.advance(vlen/4); + for (size_t j=0; jexec(dbuf, tbuf, fct, false, nth1d); + copy_output(it, res, out); + } +#endif + { + TmpStorage2 storage2(storage); + auto dbuf = storage2.dataBuf(); + auto tbuf = storage2.transformBuf(); + while (it.remaining()>0) + { + it.advance(1); + dbuf[0]=in.raw(it.iofs(0)).r; + { + size_t i=1, ii=1; + if (forward) + for (; iexec(dbuf, tbuf, fct, false, nth1d); + copy_output(it, res, out); + } + } + }); // end of parallel region + } + +struct ExecR2R + { + bool r2c, forward; + + template DUCC0_NOINLINE void operator() ( + const Titer &it, const cfmav &in, vfmav &out, Tstorage &storage, + const pocketfft_r &plan, T0 fct, size_t nthreads, + bool inplace=false) const + { + using T = typename Tstorage::datatype; + if constexpr(is_same::value) + if (inplace) + { + T *buf1=storage.transformBuf(), *buf2=out.data()+it.oofs(0); + if (in.data()!=buf2) + copy_input(it, in, buf2); + if ((!r2c) && forward) + for (size_t i=2; i DUCC0_NOINLINE void exec_n ( + const Titer &it, const cfmav &in, + vfmav &out, Tstorage &storage, const pocketfft_r &plan, T0 fct, size_t nvec, + size_t nthreads) const + { + using T = typename Tstorage::datatype; + size_t dstr = storage.data_stride(); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2, nvec, dstr); + if ((!r2c) && forward) + for (size_t k=0; k DUCC0_NOINLINE void exec_simple ( + const T0 *in, T0 *out, const pocketfft_r &plan, T0 fct, + size_t nthreads) const + { + if (in!=out) copy_n(in, plan.length(), out); + if ((!r2c) && forward) + for (size_t i=2; i DUCC0_NOINLINE void c2c(const cfmav> &in, + vfmav> &out, const shape_t &axes, bool forward, + T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + const auto &in2(reinterpret_cast >&>(in)); + auto &out2(reinterpret_cast >&>(out)); + if ((axes.size()>1) && (in.data()!=out.data())) // optimize axis order + { + if ((in.stride(axes[0])!=1)&&(out.stride(axes[0])==1)) + { + shape_t axes2(axes); + swap(axes2[0],axes2.back()); + general_nd>(in2, out2, axes2, fct, nthreads, ExecC2C{forward}); + return; + } + for (size_t i=1; i>(in2, out2, axes2, fct, nthreads, ExecC2C{forward}); + return; + } + } + general_nd>(in2, out2, axes, fct, nthreads, ExecC2C{forward}); + } + +template DUCC0_NOINLINE void dct(const cfmav &in, vfmav &out, + const shape_t &axes, int type, T fct, bool ortho, size_t nthreads) + { + if ((type<1) || (type>4)) throw std::invalid_argument("invalid DCT type"); + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + const ExecDcst exec{ortho, type, true}; + if (type==1) + general_nd>(in, out, axes, fct, nthreads, exec); + else if (type==4) + general_nd>(in, out, axes, fct, nthreads, exec); + else + general_nd>(in, out, axes, fct, nthreads, exec); + } + +template DUCC0_NOINLINE void dst(const cfmav &in, vfmav &out, + const shape_t &axes, int type, T fct, bool ortho, size_t nthreads) + { + if ((type<1) || (type>4)) throw std::invalid_argument("invalid DST type"); + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + const ExecDcst exec{ortho, type, false}; + if (type==1) + general_nd>(in, out, axes, fct, nthreads, exec); + else if (type==4) + general_nd>(in, out, axes, fct, nthreads, exec); + else + general_nd>(in, out, axes, fct, nthreads, exec); + } + +template DUCC0_NOINLINE void r2c(const cfmav &in, + vfmav> &out, size_t axis, bool forward, T fct, + size_t nthreads) + { + util::sanity_check_cr(out, in, axis); + if (in.size()==0) return; + auto &out2(reinterpret_cast>&>(out)); + general_r2c(in, out2, axis, forward, fct, nthreads); + } + +template DUCC0_NOINLINE void r2c(const cfmav &in, + vfmav> &out, const shape_t &axes, + bool forward, T fct, size_t nthreads) + { + util::sanity_check_cr(out, in, axes); + if (in.size()==0) return; + r2c(in, out, axes.back(), forward, fct, nthreads); + if (axes.size()==1) return; + + auto newaxes = shape_t{axes.begin(), --axes.end()}; + c2c(out, out, newaxes, forward, T(1), nthreads); + } + +template DUCC0_NOINLINE void c2r(const cfmav> &in, + vfmav &out, size_t axis, bool forward, T fct, size_t nthreads) + { + util::sanity_check_cr(in, out, axis); + if (in.size()==0) return; + const auto &in2(reinterpret_cast>&>(in)); + general_c2r(in2, out, axis, forward, fct, nthreads); + } + +template DUCC0_NOINLINE void c2r(const cfmav> &in, + vfmav &out, const shape_t &axes, bool forward, T fct, + size_t nthreads) + { + if (axes.size()==1) + return c2r(in, out, axes[0], forward, fct, nthreads); + util::sanity_check_cr(in, out, axes); + if (in.size()==0) return; + auto atmp(vfmav>::build_noncritical(in.shape(), UNINITIALIZED)); + auto newaxes = shape_t{axes.begin(), --axes.end()}; + c2c(in, atmp, newaxes, forward, T(1), nthreads); + c2r(atmp, out, axes.back(), forward, fct, nthreads); + } + +template DUCC0_NOINLINE void c2r_mut(vfmav> &in, + vfmav &out, const shape_t &axes, bool forward, T fct, + size_t nthreads) + { + if (axes.size()==1) + return c2r(in, out, axes[0], forward, fct, nthreads); + util::sanity_check_cr(in, out, axes); + if (in.size()==0) return; + auto newaxes = shape_t{axes.begin(), --axes.end()}; + c2c(in, in, newaxes, forward, T(1), nthreads); + c2r(in, out, axes.back(), forward, fct, nthreads); + } + +template DUCC0_NOINLINE void r2r_fftpack(const cfmav &in, + vfmav &out, const shape_t &axes, bool real2hermitian, bool forward, + T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + general_nd>(in, out, axes, fct, nthreads, + ExecR2R{real2hermitian, forward}); + } + +template DUCC0_NOINLINE void r2r_fftw(const cfmav &in, + vfmav &out, const shape_t &axes, bool forward, + T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + general_nd>(in, out, axes, fct, nthreads, + ExecFFTW{forward}); + } + +template DUCC0_NOINLINE void r2r_separable_hartley(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + general_nd>(in, out, axes, fct, nthreads, + ExecHartley{}, false); + } + +template DUCC0_NOINLINE void r2r_separable_fht(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads) + { + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + general_nd>(in, out, axes, fct, nthreads, + ExecFHT{}, false); + } + +template void hermiteHelper(size_t idim, ptrdiff_t iin, + ptrdiff_t iout0, ptrdiff_t iout1, const cfmav &c, + vfmav &r, const shape_t &axes, Func func, size_t nthreads) + { + auto cstr=c.stride(idim), str=r.stride(idim); + auto len=r.shape(idim); + + if (idim+1==c.ndim()) // last dimension, not much gain in parallelizing + { + if (idim==axes.back()) // halfcomplex axis + for (size_t i=0,ic=0; i void oscarize(vfmav &data, size_t ax0, size_t ax1, + size_t nthreads) + { + auto nu=data.shape(ax0), nv=data.shape(ax1); + if ((nu<3)||(nv<3)) return; + vector slc(data.ndim()); + slc[ax0] = slice(1,(nu+1)/2); + slc[ax1] = slice(1,(nv+1)/2); + auto all = subarray(data, slc); + slc[ax0] = slice(nu-1,nu/2,-1); + auto ahl = subarray(data, slc); + slc[ax1] = slice(nv-1,nv/2,-1); + auto ahh = subarray(data, slc); + slc[ax0] = slice(1,(nu+1)/2); + auto alh = subarray(data, slc); + mav_apply([](T &ll, T &hl, T &hh, T &lh) + { + T tll=ll, thl=hl, tlh=lh, thh=hh; + T v = T(0.5)*(tll+tlh+thl+thh); + ll = v-thh; + hl = v-tlh; + lh = v-thl; + hh = v-tll; + }, nthreads, all, ahl, ahh, alh); + } + +template void r2r_genuine_hartley(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads) + { + if (axes.size()==1) + return r2r_separable_hartley(in, out, axes, fct, nthreads); + if (axes.size()==2) + { + r2r_separable_hartley(in, out, axes, fct, nthreads); + oscarize(out, axes[0], axes[1], nthreads); + return; + } + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + shape_t tshp(in.shape()); + tshp[axes.back()] = tshp[axes.back()]/2+1; + auto atmp(vfmav>::build_noncritical(tshp, UNINITIALIZED)); + r2c(in, atmp, axes, true, fct, nthreads); + hermiteHelper(0, 0, 0, 0, atmp, out, axes, [](const std::complex &c, T &r0, T &r1) + { + r0 = c.real()+c.imag(); + r1 = c.real()-c.imag(); + }, nthreads); + } + +template void r2r_genuine_fht(const cfmav &in, + vfmav &out, const shape_t &axes, T fct, size_t nthreads) + { + if (axes.size()==1) + return r2r_separable_fht(in, out, axes, fct, nthreads); + if (axes.size()==2) + { + r2r_separable_fht(in, out, axes, fct, nthreads); + oscarize(out, axes[0], axes[1], nthreads); + return; + } + util::sanity_check_onetype(in, out, in.data()==out.data(), axes); + if (in.size()==0) return; + shape_t tshp(in.shape()); + tshp[axes.back()] = tshp[axes.back()]/2+1; + auto atmp(vfmav>::build_noncritical(tshp, UNINITIALIZED)); + r2c(in, atmp, axes, true, fct, nthreads); + hermiteHelper(0, 0, 0, 0, atmp, out, axes, [](const std::complex &c, T &r0, T &r1) + { + r0 = c.real()-c.imag(); + r1 = c.real()+c.imag(); + }, nthreads); + } + +template +DUCC0_NOINLINE void general_convolve_axis(const cfmav &in, vfmav &out, + const size_t axis, const cmav &kernel, size_t nthreads, + const Exec &exec) + { + std::unique_ptr plan1, plan2; + + size_t l_in=in.shape(axis), l_out=out.shape(axis); + MR_assert(kernel.size()==l_in, "bad kernel size"); + plan1 = std::make_unique(l_in); + plan2 = std::make_unique(l_out); + size_t bufsz = max(plan1->bufsize(), plan2->bufsize()); + + vmav fkernel({kernel.shape(0)}, UNINITIALIZED); + for (size_t i=0; iexec(fkernel.data(), T0(1)/T0(l_in), true, nthreads); + + execParallel( + util::thread_count(nthreads, in, axis, fft_simdlen), + [&](Scheduler &sched) { + constexpr auto vlen = fft_simdlen; + TmpStorage storage(in.size()/l_in, l_in+l_out, bufsz, 1, false); + multi_iter it(in, out, axis, sched.num_threads(), sched.thread_num()); +#ifndef DUCC0_NO_SIMD + if constexpr (vlen>1) + { + TmpStorage2,T,T0> storage2(storage); + while (it.remaining()>=vlen) + { + it.advance(vlen); + exec(it, in, out, storage2, *plan1, *plan2, fkernel); + } + } + if constexpr (vlen>2) + if constexpr (simd_exists) + if (it.remaining()>=vlen/2) + { + TmpStorage2,T,T0> storage2(storage); + it.advance(vlen/2); + exec(it, in, out, storage2, *plan1, *plan2, fkernel); + } + if constexpr (vlen>4) + if constexpr (simd_exists) + if (it.remaining()>=vlen/4) + { + TmpStorage2,T,T0> storage2(storage); + it.advance(vlen/4); + exec(it, in, out, storage2, *plan1, *plan2, fkernel); + } +#endif + { + TmpStorage2 storage2(storage); + while (it.remaining()>0) + { + it.advance(1); + exec(it, in, out, storage2, *plan1, *plan2, fkernel); + } + } + }); // end of parallel region + } + +struct ExecConv1R + { + template void operator() ( + const Titer &it, const cfmav &in, vfmav &out, + Tstorage &storage, const pocketfft_r &plan1, const pocketfft_r &plan2, + const cmav &fkernel) const + { + using T = typename Tstorage::datatype; + size_t l_in = plan1.length(), + l_out = plan2.length(), + l_min = std::min(l_in, l_out); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + plan1.exec_copyback(buf2, buf1, T0(1), true); + auto res = buf2; + { + res[0] *= fkernel(0); + size_t i; + for (i=1; 2*i t1(res[2*i-1], res[2*i]); + Cmplx t2(fkernel(2*i-1), fkernel(2*i)); + auto t3 = t1*t2; + res[2*i-1] = t3.r; + res[2*i] = t3.i; + } + if (2*i==l_min) + { + if (l_min t1(res[2*i-1], res[2*i]); + Cmplx t2(fkernel(2*i-1), fkernel(2*i)); + res[2*i-1] = (t1*t2).r*T0(2); + } + else + res[2*i-1] *= fkernel(2*i-1); + } + } + for (size_t i=l_in; i void operator() ( + const Titer &it, const cfmav> &in, vfmav> &out, + Tstorage &storage, const pocketfft_c &plan1, const pocketfft_c &plan2, + const cmav,1> &fkernel) const + { + using T = typename Tstorage::datatype; + size_t l_in = plan1.length(), + l_out = plan2.length(), + l_min = std::min(l_in, l_out); + T *buf1=storage.transformBuf(), *buf2=storage.dataBuf(); + copy_input(it, in, buf2); + auto res = plan1.exec(buf2, buf1, T0(1), true); + auto res2 = buf2+l_in; + { + res2[0] = res[0]*fkernel(0); + size_t i; + for (i=1; 2*i DUCC0_NOINLINE void convolve_axis(const cfmav &in, + vfmav &out, size_t axis, const cmav &kernel, size_t nthreads) + { + MR_assert(axis, T>(in, out, axis, kernel, nthreads, + ExecConv1R()); + } +template DUCC0_NOINLINE void convolve_axis(const cfmav> &in, + vfmav> &out, size_t axis, const cmav,1> &kernel, + size_t nthreads) + { + MR_assert(axis>&>(in)); + auto &out2(reinterpret_cast>&>(out)); + const auto &kernel2(reinterpret_cast,1>&>(kernel)); + general_convolve_axis, T>(in2, out2, axis, kernel2, nthreads, + ExecConv1C()); + } + +} // namespace detail_fft + +} // namespace ducc0 + +#endif // POCKETFFT_HDRONLY_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/aligned_array.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/aligned_array.h new file mode 100644 index 0000000000000000000000000000000000000000..f2fc9835e2bc42ed693ec84e1fd475af122555f4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/aligned_array.h @@ -0,0 +1,175 @@ +/** \file ducc0/infra/aligned_array.h + * + * \copyright Copyright (C) 2019-2022 Max-Planck-Society + * \author Martin Reinecke + */ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_ALIGNED_ARRAY_H +#define DUCC0_ALIGNED_ARRAY_H + +#include +#include + +namespace ducc0 { + +namespace detail_aligned_array { + +using namespace std; + +// std::aligned_alloc is a bit cursed ... it doesn't exist on MacOS < 10.15 +// and in musl. Let's unconditionally work around it for now. +//#if ((__cplusplus >= 201703L) && (!defined(__APPLE__))) +#define DUCC0_WORKAROUND_ALIGNED_ALLOC +//#endif + +/// Bare bones array class. +/** Mostly useful for uninitialized temporary buffers. + * \note Since this class operates on raw memory, it should only be used with + * POD types, and even then only with caution! */ +template class array_base + { + private: + T *p; + size_t sz; + + static T *ralloc(size_t num) + { + if constexpr(alignment<=alignof(max_align_t)) + { + void *res = malloc(num*sizeof(T)); + if (!res) throw bad_alloc(); + return reinterpret_cast(res); + } + else + { + if (num==0) return nullptr; +#if (!defined(DUCC0_WORKAROUND_ALIGNED_ALLOC)) + // aligned_alloc requires the allocated size to be a multiple of the + // requested alignment, so increase size if necessary + void *res = aligned_alloc(alignment,((num*sizeof(T)+alignment-1)/alignment)*alignment); + if (!res) throw bad_alloc(); +#else // portable emulation + void *ptr = malloc(num*sizeof(T)+alignment); + if (!ptr) throw bad_alloc(); + void *res = reinterpret_cast((reinterpret_cast(ptr) & ~(size_t(alignment-1))) + alignment); + (reinterpret_cast(res))[-1] = ptr; +#endif + return reinterpret_cast(res); + } + } + static void dealloc(T *ptr) + { + if constexpr(alignment<=alignof(max_align_t)) + free(ptr); + else +#if (!defined(DUCC0_WORKAROUND_ALIGNED_ALLOC)) + free(ptr); +#else + if (ptr) free((reinterpret_cast(ptr))[-1]); +#endif + } + +#undef DUCC0_WORKAROUND_ALIGNED_ALLOC + + public: + /// Creates a zero-sized array with no associated memory. + array_base() : p(nullptr), sz(0) {} + /// Creates an array with \a n entries. + /** \note Memory is not initialized! */ + array_base(size_t n) : p(ralloc(n)), sz(n) {} + array_base(const array_base &) = delete; + array_base(array_base &&other) + : p(other.p), sz(other.sz) + { other.p=nullptr; other.sz=0; } + ~array_base() { dealloc(p); } + + array_base &operator=(const array_base &) = delete; + array_base &operator=(array_base &&other) + { + swap(p, other.p); + swap(sz, other.sz); + return *this; + } + + /// If \a n is different from the current size, resizes the array to hold + /// \a n elements. + /** \note No data content is copied, the new array is uninitialized! */ + void resize(size_t n) + { + if (n==sz) return; + dealloc(p); + p = ralloc(n); + sz = n; + } + + /// Returns a writeable reference to the element at index \a idx. + T &operator[](size_t idx) { return p[idx]; } + /// Returns a read-only reference to the element at index \a idx. + const T &operator[](size_t idx) const { return p[idx]; } + + /// Returns a writeable pointer to the array data. + T *data() { return p; } + /// Returns a read-only pointer to the array data. + const T *data() const { return p; } + + /// Returns the size of the array. + size_t size() const { return sz; } + }; + +template using quick_array = array_base; +template using aligned_array = array_base; + +} + +using detail_aligned_array::aligned_array; +using detail_aligned_array::quick_array; + +} + +#endif + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/error_handling.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/error_handling.h new file mode 100644 index 0000000000000000000000000000000000000000..bfd4ea17a2655a7ef68e28864e0103eed09a18ff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/error_handling.h @@ -0,0 +1,120 @@ +/** \file ducc0/infra/error_handling.h + * + * \copyright Copyright (C) 2019-2021 Max-Planck-Society + * \author Martin Reinecke + */ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_ERROR_HANDLING_H +#define DUCC0_ERROR_HANDLING_H + +#include +#include +#include "ducc0/infra/useful_macros.h" + +namespace ducc0 { + +namespace detail_error_handling { + +#if defined (__GNUC__) +#define DUCC0_ERROR_HANDLING_LOC_ ::ducc0::detail_error_handling::CodeLocation(__FILE__, __LINE__, __PRETTY_FUNCTION__) +#else +#define DUCC0_ERROR_HANDLING_LOC_ ::ducc0::detail_error_handling::CodeLocation(__FILE__, __LINE__) +#endif + +// to be replaced with std::source_location once generally available +class CodeLocation + { + private: + const char *file, *func; + int line; + + public: + CodeLocation(const char *file_, int line_, const char *func_=nullptr) + : file(file_), func(func_), line(line_) {} + + inline ::std::ostream &print(::std::ostream &os) const + { + os << "\n" << file << ": " << line; + if (func) os << " (" << func << ")"; + os << ":\n"; + return os; + } + }; + +inline ::std::ostream &operator<<(::std::ostream &os, const CodeLocation &loc) + { return loc.print(os); } + +template +void streamDump__(::std::ostream &os, Args&&... args) + { (os << ... << args); } +template +[[noreturn]] DUCC0_NOINLINE void fail__(Args&&... args) + { + ::std::ostringstream msg; \ + ::ducc0::detail_error_handling::streamDump__(msg, std::forward(args)...); \ + throw ::std::runtime_error(msg.str()); \ + } + +/// Throws a std::runtime_error containing the code location and the +/// passed arguments. +#define MR_fail(...) \ + do { \ + ::ducc0::detail_error_handling::fail__(DUCC0_ERROR_HANDLING_LOC_, "\n", ##__VA_ARGS__, "\n"); \ + } while(0) + +/// If \a cond is false, throws a std::runtime_error containing the code +/// location and the passed arguments. +#define MR_assert(cond,...) \ + do { \ + if (cond); \ + else { MR_fail("Assertion failure\n", ##__VA_ARGS__); } \ + } while(0) + +}} + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/mav.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/mav.h new file mode 100644 index 0000000000000000000000000000000000000000..820de6de1d18431a2da86eccab59c23c637b6097 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/mav.h @@ -0,0 +1,1358 @@ +/*! \file ducc0/infra/mav.h + * Classes for dealing with multidimensional arrays + * + * \copyright Copyright (C) 2019-2023 Max-Planck-Society + * \author Martin Reinecke + * */ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_MAV_H +#define DUCC0_MAV_H + +#include +#include +#include +#include +#include +#include +#include +#include "ducc0/infra/error_handling.h" +#include "ducc0/infra/aligned_array.h" +#include "ducc0/infra/misc_utils.h" +#include "ducc0/infra/threading.h" + +namespace ducc0 { + +namespace detail_mav { + +using namespace std; + +// the next line is necessary to address some sloppy name choices in hipSYCL +using std::min, std::max; + +struct uninitialized_dummy {}; +constexpr uninitialized_dummy UNINITIALIZED; + +template class cmembuf + { + protected: + shared_ptr> ptr; + shared_ptr> rawptr; + const T *d; + + cmembuf(const T *d_, const cmembuf &other) + : ptr(other.ptr), rawptr(other.rawptr), d(d_) {} + + // externally owned data pointer + cmembuf(const T *d_) + : d(d_) {} + // share another memory buffer, but read-only + cmembuf(const cmembuf &other) + : ptr(other.ptr), rawptr(other.rawptr), d(other.d) {} + cmembuf(size_t sz) + : ptr(make_shared>(sz)), d(ptr->data()) {} +#if 1 + cmembuf(size_t sz, uninitialized_dummy) + : rawptr(make_shared>(sz)), d(rawptr->data()) {} +# else // "poison" the array with a fixed value; use for debugging + cmembuf(size_t sz, uninitialized_dummy) + : rawptr(make_shared>(sz)), d(rawptr->data()) + { for (size_t i=0; i const T &raw(I i) const + { return d[i]; } + // read access to data area + const T *data() const + { return d; } + }; + +constexpr size_t MAXIDX=~(size_t(0)); + +struct slice + { + size_t beg, end; + ptrdiff_t step; + slice() : beg(0), end(MAXIDX), step(1) {} + slice(size_t idx) : beg(idx), end(idx), step(1) {} + slice(size_t beg_, size_t end_, ptrdiff_t step_=1) + : beg(beg_), end(end_), step(step_) + { +// FIXME: add sanity checks here + } + + size_t size(size_t shp) const + { + if (beg==end) return 0; + if (step>0) return (min(shp,end)-beg+step-1)/step; + // negative step + if (end==MAXIDX) + return (beg-step)/(-step); + return (beg-end-step-1)/(-step); + } + }; + +/// Helper class containing shape and stride information of an `fmav` object +class fmav_info + { + public: + /// vector of nonnegative integers for storing the array shape + using shape_t = vector; + /// vector of integers for storing the array strides + using stride_t = vector; + + protected: + shape_t shp; + stride_t str; + size_t sz; + + static stride_t shape2stride(const shape_t &shp) + { + auto ndim = shp.size(); + // MR using the static_cast just to avoid a GCC warning. +// stride_t res(ndim); + stride_t res(static_cast(ndim)); + if (ndim==0) return res; + res[ndim-1]=1; + for (size_t i=2; i<=ndim; ++i) + res[ndim-i] = res[ndim-i+1]*ptrdiff_t(shp[ndim-i+1]); + return res; + } + template ptrdiff_t getIdx(size_t dim, size_t n, Ns... ns) const + { return str[dim]*ptrdiff_t(n) + getIdx(dim+1, ns...); } + ptrdiff_t getIdx(size_t dim, size_t n) const + { return str[dim]*ptrdiff_t(n); } + ptrdiff_t getIdx(size_t /*dim*/) const + { return 0; } + + public: + /// Constructs a 1D object with all extents and strides set to zero. + fmav_info() : shp(1,0), str(1,0), sz(0) {} + /// Constructs an object with the given shape and stride. + fmav_info(const shape_t &shape_, const stride_t &stride_) + : shp(shape_), str(stride_), + sz(accumulate(shp.begin(),shp.end(),size_t(1),multiplies<>())) + { + MR_assert(shp.size()==str.size(), "dimensions mismatch"); + } + /// Constructs an object with the given shape and computes the strides + /// automatically, assuming a C-contiguous memory layout. + fmav_info(const shape_t &shape_) + : fmav_info(shape_, shape2stride(shape_)) {} + void assign(const fmav_info &other) + { + shp = other.shp; + str = other.str; + sz = other.sz; + } + /// Returns the dimensionality of the object. + size_t ndim() const { return shp.size(); } + /// Returns the total number of entries in the object. + size_t size() const { return sz; } + /// Returns the shape of the object. + const shape_t &shape() const { return shp; } + /// Returns the length along dimension \a i. + size_t shape(size_t i) const { return shp[i]; } + /// Returns the strides of the object. + const stride_t &stride() const { return str; } + /// Returns the stride along dimension \a i. + const ptrdiff_t &stride(size_t i) const { return str[i]; } + /// Returns true iff the last dimension has stride 1. + /** Typically used for optimization purposes. */ + bool last_contiguous() const + { return ((ndim()==0) || (str.back()==1)); } + /** Returns true iff the object is C-contiguous, i.e. if the stride of the + * last dimension is 1, the stride for the next-to-last dimension is the + * shape of the last dimension etc. */ + bool contiguous() const + { + auto ndim = shp.size(); + ptrdiff_t stride=1; + for (size_t i=0; ishape and \a other.shape match. + bool conformable(const fmav_info &other) const + { return shp==other.shp; } + /// Returns the one-dimensional index of an entry from the given + /// multi-dimensional index tuple, taking strides into account. + template ptrdiff_t idx(Ns... ns) const + { + MR_assert(ndim()==sizeof...(ns), "incorrect number of indices"); + return getIdx(0, ns...); + } + ptrdiff_t idx(const shape_t &ns) const + { + MR_assert(ndim()==ns.size(), "incorrect number of indices"); + size_t res = 0; + for (size_t i=0; i ptrdiff_t idxval(RAiter beg, RAiter end) const + { + MR_assert(ndim()==size_t(end-beg), "incorrect number of indices"); + size_t res = 0; + for (size_t i=0; i=shp.size(), "cannot reduce dimensionality"); + stride_t newstr(shp2.size(), 0); + for (size_t i=0; i=ndim(), + "new shape smaller than original one"); + MR_assert(axpos.size()==ndim(), "bad axpos size"); + stride_t new_stride(new_shape.size(), 0); + vector used(new_shape.size(),0); + for (size_t i=0; i &slices) const + { + auto ndim = shp.size(); + shape_t nshp(ndim); + stride_t nstr(ndim); + MR_assert(slices.size()==ndim, "incorrect number of slices"); + size_t n0=0; + for (auto x:slices) if (x.beg==x.end) ++n0; + ptrdiff_t nofs=0; + nshp.resize(ndim-n0); + nstr.resize(ndim-n0); + for (size_t i=0, i2=0; i class mav_info + { + public: + /// Fixed-size array of nonnegative integers for storing the array shape + using shape_t = array; + /// Fixed-size array of integers for storing the array strides + using stride_t = array; + + protected: + shape_t shp; + stride_t str; + size_t sz; + + static stride_t shape2stride(const shape_t &shp) + { + stride_t res; + if (ndim==0) return res; + res[ndim-1]=1; + for (size_t i=2; i<=ndim; ++i) + res[ndim-i] = res[ndim-i+1]*ptrdiff_t(shp[ndim-i+1]); + return res; + } + template ptrdiff_t getIdx(size_t dim, size_t n, Ns... ns) const + { return str[dim]*n + getIdx(dim+1, ns...); } + ptrdiff_t getIdx(size_t dim, size_t n) const + { return str[dim]*n; } + ptrdiff_t getIdx(size_t /*dim*/) const + { return 0; } + + public: + /// Constructs an object with all extents and strides set to zero. + mav_info() : sz(0) + { + for (size_t i=0; i())) {} + /// Constructs an object with the given shape and computes the strides + /// automatically, assuming a C-contiguous memory layout. + mav_info(const shape_t &shape_) + : mav_info(shape_, shape2stride(shape_)) {} + mav_info(const fmav_info &inp) + { + MR_assert(inp.ndim()==ndim, "dimensionality mismatch"); + sz=1; + for (size_t i=0; ishape and \a other.shape match. + bool conformable(const mav_info &other) const + { return shp==other.shp; } + /// Returns true iff this->shape and \a other match. + bool conformable(const shape_t &other) const + { return shp==other; } + /// Returns the one-dimensional index of an entry from the given + /// multi-dimensional index tuple, taking strides into account. + template ptrdiff_t idx(Ns... ns) const + { + static_assert(ndim==sizeof...(ns), "incorrect number of indices"); + return getIdx(0, ns...); + } + mav_info transpose() const + { + shape_t shp2; + stride_t str2; + for (size_t i=0; i prepend_1() const + { + typename mav_info::shape_t newshp; + typename mav_info::stride_t newstr; + newshp[0] = 1; + newstr[0] = 0; + for (size_t i=0; i(newshp, newstr); + } + + protected: + template auto subdata(const vector &slices) const + { + MR_assert(slices.size()==ndim, "bad number of slices"); + array nshp; + array nstr; + + // unnecessary, but gcc warns otherwise + for (size_t i=0; i(nshp, nstr), nofs); + } + }; + +template class cfmav: public fmav_info, public cmembuf + { + protected: + using tbuf = cmembuf; + using tinfo = fmav_info; + using fmav_info::idx; + + public: + using typename tinfo::shape_t; + using typename tinfo::stride_t; + using tbuf::raw, tbuf::data; + + + protected: + cfmav(const shape_t &shp_) + : tinfo(shp_), tbuf(size()) {} + cfmav(const shape_t &shp_, uninitialized_dummy) + : tinfo(shp_), tbuf(size(), UNINITIALIZED) {} + cfmav(const shape_t &shp_, const stride_t &str_, uninitialized_dummy) + : tinfo(shp_, str_), tbuf(size(), UNINITIALIZED) + { + ptrdiff_t ofs=0; + for (size_t i=0; i const T &operator()(Ns... ns) const + { return raw(idx(ns...)); } + const T &operator()(const shape_t &ns) const + { return raw(idx(ns)); } + template const T& val(RAiter beg, RAiter end) const + { return raw(idxval(beg, end)); } + + cfmav subarray(const vector &slices) const + { + auto [ninfo, nofs] = subdata(slices); + return cfmav(ninfo, tbuf::d+nofs, *this); + } + cfmav extend_and_broadcast(const shape_t &new_shape, const shape_t &axpos) const + { + return cfmav(fmav_info::extend_and_broadcast(new_shape, axpos), *this); + } + cfmav extend_and_broadcast(const shape_t &new_shape, size_t firstaxis) const + { + return cfmav(fmav_info::extend_and_broadcast(new_shape, firstaxis), *this); + } + cfmav transpose() const + { + return cfmav(static_cast(this)->transpose(), *static_cast(this)); + } + }; + +template cfmav subarray + (const cfmav &arr, const vector &slices) + { return arr.subarray(slices); } + +template class vfmav: public cfmav + { + protected: + using tbuf = cmembuf; + using tinfo = fmav_info; + using tinfo::shp, tinfo::str; + using fmav_info::idx; + + public: + using typename tinfo::shape_t; + using typename tinfo::stride_t; + using tinfo::size, tinfo::shape, tinfo::stride; + + protected: + vfmav(const fmav_info &info, tbuf &buf) + : cfmav(info, buf) {} + vfmav(const fmav_info &info, T *d_, tbuf &buf) + : cfmav(info, d_, buf) {} + + public: + using tbuf::raw, tbuf::data, tinfo::ndim; + vfmav() {} + vfmav(T *d_, const fmav_info &info) + : cfmav(d_, info) {} + vfmav(T *d_, const shape_t &shp_, const stride_t &str_) + : cfmav(d_, shp_, str_) {} + vfmav(T *d_, const shape_t &shp_) + : cfmav(d_, shp_) {} + vfmav(const shape_t &shp_) + : cfmav(shp_) {} + vfmav(const shape_t &shp_, uninitialized_dummy) + : cfmav(shp_, UNINITIALIZED) {} + vfmav(const shape_t &shp_, const stride_t &str_, uninitialized_dummy) + : cfmav(shp_, str_, UNINITIALIZED) + { + ptrdiff_t ofs=0; + for (size_t i=0; i(buf, shp_, str_) {} + + using cfmav::data; + T *data() + { return const_cast(tbuf::d); } + using cfmav::raw; + template T &raw(I i) + { return data()[i]; } + + // no-op. Needed for template tricks. + using cfmav::to_fmav; + vfmav to_fmav() { return *this; } + + void assign(const vfmav &other) + { + fmav_info::assign(other); + cmembuf::assign(other); + } + + using cfmav::operator(); + template T &operator()(Ns... ns) + { return raw(idx(ns...)); } + T &operator()(const shape_t &ns) + { return raw(idx(ns)); } + using cfmav::val; + template T& val(RAiter beg, RAiter end) + { return raw(idxval(beg, end)); } + + vfmav subarray(const vector &slices) + { + auto [ninfo, nofs] = tinfo::subdata(slices); + return vfmav(ninfo, data()+nofs, *this); + } + /** Returns a writable fmav with the specified shape. + * The strides are chosen in such a way that critical strides (multiples + * of 4096 bytes) along any dimension are avoided, by enlarging the + * allocated memory slightly if necessary. + * The array data is default-initialized. */ + static vfmav build_noncritical(const shape_t &shape) + { + auto ndim = shape.size(); + auto shape2 = noncritical_shape(shape, sizeof(T)); + vfmav tmp(shape2); + vector slc(ndim); + for (size_t i=0; i slc(ndim); + for (size_t i=0; i(this)->transpose(), *static_cast(this)); + } + }; + +template vfmav subarray + (vfmav &arr, const vector &slices) + { return arr.subarray(slices); } + +template class cmav: public mav_info, public cmembuf + { + protected: + template friend class cmav; + template friend class vmav; + + using tinfo = mav_info; + using tbuf = cmembuf; + using tinfo::shp, tinfo::str; + + public: + using typename tinfo::shape_t; + using typename tinfo::stride_t; + using tbuf::raw, tbuf::data; + using tinfo::contiguous, tinfo::size, tinfo::idx, tinfo::conformable; + + protected: + cmav() {} + cmav(const shape_t &shp_, uninitialized_dummy) + : tinfo(shp_), tbuf(size(), UNINITIALIZED) {} + cmav(const shape_t &shp_) + : tinfo(shp_), tbuf(size()) {} + cmav(const tbuf &buf, const shape_t &shp_, const stride_t &str_) + : tinfo(shp_, str_), tbuf(buf) {} + cmav(const tinfo &info, const T *d_, const tbuf &buf) + : tinfo(info), tbuf(d_, buf) {} + cmav(const tinfo &info, const tbuf &buf) + : tinfo(info), tbuf(buf) {} + + public: + cmav(const T *d_, const shape_t &shp_, const stride_t &str_) + : tinfo(shp_, str_), tbuf(d_) {} + cmav(const T *d_, const shape_t &shp_) + : tinfo(shp_), tbuf(d_) {} + cmav(const cfmav &inp) + : tinfo(inp), tbuf(inp) {} + void assign(const cmav &other) + { + mav_info::assign(other); + cmembuf::assign(other); + } + operator cfmav() const + { + return cfmav(*this, {shp.begin(), shp.end()}, {str.begin(), str.end()}); + } + // Needed for template tricks. + cfmav to_fmav() const { return operator cfmav(); } + + template const T &operator()(Ns... ns) const + { return raw(idx(ns...)); } + template cmav subarray(const vector &slices) const + { + auto [ninfo, nofs] = tinfo::template subdata (slices); + return cmav (ninfo, tbuf::d+nofs, *this); + } + + static cmav build_uniform(const shape_t &shape, const T &value) + { + // Don't do this at home! + shape_t tshp; + tshp.fill(1); + cmav tmp(tshp); + const_cast(tmp.raw(0)) = value; + stride_t nstr; + nstr.fill(0); + return cmav(tmp, shape, nstr); + } + cmav transpose() const + { + return cmav(static_cast(this)->transpose(), *static_cast(this)); + } + cmav prepend_1() const + { + return cmav(static_cast(this)->prepend_1(), *static_cast(this)); + } + template cmav reinterpret + (const typename cmav::shape_t &newshp, + const typename cmav::stride_t &newstr) const + { + return cmav(*static_cast(this), newshp, newstr); + } + }; +template cmav subarray + (const cmav &arr, const vector &slices) + { return arr.template subarray(slices); } + +template class vmav: public cmav + { + protected: + template friend class vmav; + + using parent = cmav; + using tinfo = mav_info; + using tbuf = cmembuf; + using tinfo::shp, tinfo::str; + + public: + using typename tinfo::shape_t; + using typename tinfo::stride_t; + using tbuf::raw, tbuf::data; + using tinfo::contiguous, tinfo::size, tinfo::idx, tinfo::conformable; + + protected: + vmav(const tinfo &info, T *d_, tbuf &buf) + : parent(info, d_, buf) {} + vmav(const tinfo &info, tbuf &buf) + : parent(info, buf) {} + vmav(const tbuf &buf, const shape_t &shp_, const stride_t &str_) + : parent(buf, shp_, str_){} + + public: + vmav() {} + vmav(T *d_, const shape_t &shp_, const stride_t &str_) + : parent(d_, shp_, str_) {} + vmav(T *d_, const shape_t &shp_) + : parent(d_, shp_) {} + vmav(const shape_t &shp_) + : parent(shp_) {} + vmav(const shape_t &shp_, uninitialized_dummy) + : parent(shp_, UNINITIALIZED) {} + vmav(vfmav &inp) + : parent(inp) {} + + void assign(vmav &other) + { parent::assign(other); } + void dealloc() + { + vmav empty; + assign(empty); + } + operator vfmav() + { + return vfmav(*this, {shp.begin(), shp.end()}, {str.begin(), str.end()}); + } + // Needed for template tricks. + using cmav::to_fmav; + vfmav to_fmav() { return operator vfmav(); } + + using parent::operator(); + template T &operator()(Ns... ns) + { return const_cast(parent::operator()(ns...)); } + + template vmav subarray(const vector &slices) + { + auto [ninfo, nofs] = tinfo::template subdata (slices); + return vmav (ninfo, data()+nofs, *this); + } + + using parent::data; + T *data() + { return const_cast(tbuf::d); } + // read access to element #i + using parent::raw; + template T &raw(I i) + { return data()[i]; } + + static vmav build_empty() + { + shape_t nshp; + nshp.fill(0); + return vmav(static_cast(nullptr), nshp); + } + + static vmav build_noncritical(const shape_t &shape) + { + auto shape2 = noncritical_shape(shape, sizeof(T)); + vmav tmp(shape2); + vector slc(ndim); + for (size_t i=0; i(slc); + } + static vmav build_noncritical(const shape_t &shape, uninitialized_dummy) + { + if (ndim<=1) return vmav(shape, UNINITIALIZED); + auto shape2 = noncritical_shape(shape, sizeof(T)); + vmav tmp(shape2, UNINITIALIZED); + vector slc(ndim); + for (size_t i=0; i(slc); + } + vmav transpose() + { + return vmav(static_cast(this)->transpose(), *static_cast(this)); + } + vmav prepend_1() + { + return vmav(static_cast(this)->prepend_1(), *static_cast(this)); + } + template vmav reinterpret + (const typename vmav::shape_t &newshp, + const typename vmav::stride_t &newstr) + { + return vmav(*static_cast(this), newshp, newstr); + } + }; + +template vmav subarray + (vmav &arr, const vector &slices) + { return arr.template subarray(slices); } + +// various operations involving fmav objects of the same shape -- experimental + +DUCC0_NOINLINE tuple, size_t, size_t> + multiprep(const vector &info, const vector &tsizes); +DUCC0_NOINLINE tuple> + multiprep(const vector &info); + +template constexpr inline size_t tuplelike_size() + { return tuple_size_v>; } + +template +inline void call_with_tuple_impl(Func &&func, const Ttuple& tuple, + index_sequence) + { func(std::forward::type>(get(tuple))...); } +template inline void call_with_tuple + (Func &&func, Ttuple &&tuple) + { + call_with_tuple_impl(std::forward(func), tuple, + make_index_sequence()>()); + } +template +inline void call_with_tuple2_impl(Func &&func, const Ttuple& tuple, + index_sequence) + { func(get(tuple)...); } +template inline void call_with_tuple2 + (Func &&func, Ttuple &&tuple) + { + call_with_tuple2_impl(std::forward(func), tuple, + make_index_sequence()>()); + } + +template +inline auto tuple_transform_impl(tuple const& inputs, Func &&func, + index_sequence) + { return tuple...>{func(get(inputs))...}; } +template +inline auto tuple_transform(tuple const& inputs, Func &&func) + { + return tuple_transform_impl(inputs, std::forward(func), + make_index_sequence{}); + } +template +inline void tuple_for_each_impl(tuple &tpl, Func &&func, + index_sequence) + { (func(get(tpl)), ...); } +template +inline void tuple_for_each(tuple &tpl, Func &&func) + { + tuple_for_each_impl(tpl, std::forward(func), make_index_sequence{}); + } +template +inline void tuple_for_each_impl(const tuple &tpl, Func &&func, + index_sequence) + { (func(get(tpl)), ...); } +template +inline void tuple_for_each(const tuple &tpl, Func &&func) + { + tuple_for_each_impl(tpl, std::forward(func), make_index_sequence{}); + } + +template +inline auto tuple_transform_idx_impl(const tuple &inputs, + Func &&func, index_sequence) + { + return tuple...> + {func(get(inputs), Is)...}; + } + +template +inline auto tuple_transform_idx(const tuple &inputs, Func &&func) + { + return tuple_transform_idx_impl(inputs, std::forward(func), + make_index_sequence{}); + } +template +inline void tuple_for_each_idx_impl(tuple &tpl, Func &&func, + index_sequence) + { (func(get(tpl), Is), ...); } +template +inline void tuple_for_each_idx(tuple &tpl, Func &&func) + { + tuple_for_each_idx_impl(tpl, std::forward(func), make_index_sequence{}); + } + +template inline auto to_ref (const Ttuple &tuple) + { + return tuple_transform(tuple,[](auto &&ptr) -> typename std::add_lvalue_reference_t{ return *ptr; }); + } + +template inline Ttuple update_pointers (const Ttuple &ptrs, + const vector> &str, size_t idim, size_t i) + { + return tuple_transform_idx(ptrs, [i,idim,&str](auto &&ptr, size_t idx) + { return ptr + i*str[idx][idim]; }); + } + +template inline Ttuple update_pointers_contiguous (const Ttuple &ptrs, + size_t i) + { + return tuple_transform(ptrs, [i](auto &&ptr) { return ptr+i; }); + } +template inline void advance_contiguous (Ttuple &ptrs) + { tuple_for_each(ptrs, [](auto &&ptr) { ++ptr; }); } +template inline void advance (Ttuple &ptrs, + const vector> &str, size_t idim) + { + tuple_for_each_idx(ptrs, [idim,&str](auto &&ptr, size_t idx) + { ptr += str[idx][idim]; }); + } +template inline void advance_by_n (Ttuple &ptrs, + const vector> &str, size_t idim, size_t n) + { + tuple_for_each_idx(ptrs, [idim,n,&str](auto &&ptr, size_t idx) + { ptr += n*str[idx][idim]; }); + } + +template + DUCC0_NOINLINE void applyHelper_block(size_t idim, const vector &shp, + const vector> &str, size_t bsi, size_t bsj, + const Ttuple &ptrs, Func &&func) + { + auto leni=shp[idim], lenj=shp[idim+1]; + size_t nbi = (leni+bsi-1)/bsi; + size_t nbj = (lenj+bsj-1)/bsj; + for (size_t bi=0; bi + DUCC0_NOINLINE void applyHelper(size_t idim, const vector &shp, + const vector> &str, size_t block0, size_t block1, + const Ttuple &ptrs, Func &&func, bool last_contiguous) + { + auto len = shp[idim]; + if ((idim+2==shp.size()) && (block0!=0)) // we should do blocking + applyHelper_block(idim, shp, str, block0, block1, ptrs, func); + else if (idim+1 + inline void applyHelper(const vector &shp, + const vector> &str, size_t block0, size_t block1, + const Ttuple &ptrs, Func &&func, size_t nthreads, bool last_contiguous) + { + if (shp.size()==0) + call_with_tuple(std::forward(func), to_ref(ptrs)); + else if (nthreads==1) + applyHelper(0, shp, str, block0, block1, ptrs, std::forward(func), last_contiguous); + else + execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) + { + auto locptrs = update_pointers(ptrs, str, 0, lo); + auto locshp(shp); + locshp[0] = hi-lo; + applyHelper(0, locshp, str, block0, block1, locptrs, func, last_contiguous); + }); + } + +template + void mav_apply(Func &&func, int nthreads, Targs... args) + { + vector infos; + (infos.push_back(args), ...); + vector tsizes; + (tsizes.push_back(sizeof(args.data()[0])), ...); + auto [shp, str, block0, block1] = multiprep(infos, tsizes); + bool last_contiguous = true; + if (shp.size()>0) + for (const auto &s:str) + last_contiguous &= (s.back()==1); + + auto ptrs = tuple_transform(forward_as_tuple(args...), + [](auto &&arg){return arg.data();}); + applyHelper(shp, str, block0, block1, ptrs, std::forward(func), nthreads, last_contiguous); + } + +DUCC0_NOINLINE tuple> + multiprep_noopt(const vector &info); + +template +inline void call_with_tuple_arg_impl(Func &&func, Arg &&arg, const Ttuple& tuple, + index_sequence) + { func(std::forward::type>(get(tuple))..., arg); } +template inline void call_with_tuple_arg + (Func &&func, Arg &&arg, Ttuple &&tuple) + { + call_with_tuple_arg_impl(std::forward(func), arg, tuple, + make_index_sequence()>()); + } +template + DUCC0_NOINLINE void applyHelper_with_index(size_t idim, const vector &shp, + const vector> &str, const Ttuple &ptrs, Func &&func, + vector &index) + { + auto len = shp[idim]; + if (idim+1 &>(index), to_ref(locptrs)); + index[idim] = idxbak; + } + } +template + inline void applyHelper_with_index(const vector &shp, + const vector> &str, const Ttuple &ptrs, Func &&func, + size_t nthreads, vector &index) + { + if (shp.size()==0) + call_with_tuple_arg(std::forward(func), const_cast &>(index), to_ref(ptrs)); + else if (nthreads==1) + applyHelper_with_index(0, shp, str, ptrs, std::forward(func), index); + else + execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) + { + auto locptrs = update_pointers(ptrs, str, 0, lo); + auto locshp(shp); + locshp[0] = hi-lo; + auto locidx(index); + locidx[0]=lo; + applyHelper_with_index(0, locshp, str, locptrs, func, locidx); + }); + } +template + void mav_apply_with_index(Func &&func, int nthreads, Targs... args) + { + vector infos; + (infos.push_back(args), ...); + auto [shp, str] = multiprep_noopt(infos); + vector index(shp.size(), 0); + + auto ptrs = tuple_transform(forward_as_tuple(args...), + [](auto &&arg){return arg.data();}); + applyHelper_with_index(shp, str, ptrs, std::forward(func), nthreads, index); + } + + +template class mavref + { + private: + const mav_info &info; + T *d; + + public: + using shape_t = typename mav_info::shape_t; + using stride_t = typename mav_info::stride_t; + mavref(const mav_info &info_, T *d_) : info(info_), d(d_) {} + template T &operator()(Ns... ns) const + { return d[info.idx(ns...)]; } + /// Returns the total number of entries in the object. + size_t size() const { return info.size(); } + /// Returns the shape of the object. + const shape_t &shape() const { return info.shape(); } + /// Returns the length along dimension \a i. + size_t shape(size_t i) const { return info.shape(i); } + /// Returns the strides of the object. + const stride_t &stride() const { return info.stride(); } + /// Returns the stride along dimension \a i. + const ptrdiff_t &stride(size_t i) const { return info.stride(i); } + /// Returns true iff the last dimension has stride 1. + /** Typically used for optimization purposes. */ + bool last_contiguous() const + { return info.last_contiguous(); } + /** Returns true iff the object is C-contiguous, i.e. if the stride of the + * last dimension is 1, the stride for the next-to-last dimension is the + * shape of the last dimension etc. */ + bool contiguous() const + { return info.contiguous(); } + /// Returns true iff this->shape and \a other.shape match. + bool conformable(const mavref &other) const + { return shape()==other.shape(); } + }; + +template + mavref make_mavref(const mav_info &info_, T *d_) + { return mavref(info_, d_); } + +template +inline auto tuple_transform2_impl(const tuple &i1, const tuple &i2, + Func &&func, index_sequence) + { return tuple...>{func(get(i1),get(i2))...}; } +template +inline auto tuple_transform2(const tuple &i1, const tuple &i2, + Func &&func) + { + return tuple_transform2_impl(i1, i2, std::forward(func), + make_index_sequence{}); + } +template + auto make_mavrefs(const Tptrs &ptrs, const Tinfos &infos) + { + return tuple_transform2(ptrs, infos, [](auto &&ptr, auto &&info) + { return make_mavref(info, ptr); }); + } + +template auto make_infos(const fmav_info &info) + { + if constexpr(ndim>0) + MR_assert(ndim<=info.ndim(), "bad dimensionality"); + auto iterdim = info.ndim()-ndim; + fmav_info fout({info.shape().begin(),info.shape().begin()+iterdim}, + {info.stride().begin(),info.stride().begin()+iterdim}); + + typename mav_info::shape_t shp; + typename mav_info::stride_t str; + if constexpr (ndim>0) // just to silence compiler warnings + for (size_t i=0; i iout(shp, str); + return make_tuple(fout, iout); + } + +template + DUCC0_NOINLINE void flexible_mav_applyHelper(size_t idim, const vector &shp, + const vector> &str, const Tptrs &ptrs, + const Tinfos &infos, Func &&func) + { + auto len = shp[idim]; + auto locptrs(ptrs); + if (idim+1 + DUCC0_NOINLINE void flexible_mav_applyHelper(const vector &shp, + const vector> &str, const Tptrs &ptrs, + const Tinfos &infos, Func &&func, size_t nthreads) + { + if (shp.size()==0) + call_with_tuple2(func, make_mavrefs(ptrs, infos)); + else if (nthreads==1) + flexible_mav_applyHelper(0, shp, str, ptrs, infos, std::forward(func)); + else + execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) + { + auto locptrs = update_pointers(ptrs, str, 0, lo); + auto locshp(shp); + locshp[0] = hi-lo; + flexible_mav_applyHelper(0, locshp, str, locptrs, infos, func); + }); + } + +template struct Xdim { static constexpr size_t dim=ndim; }; + +template + void xflexible_mav_apply(const Ttuple &tuple, const Tdim &dim, Func &&func, size_t nthreads) + { + auto fullinfos = tuple_transform2(tuple, dim, [](const auto &arg, const auto &dim) + { return make_infos::dim>(fmav_info(arg)); }); + vector iter_infos; + tuple_for_each(fullinfos,[&iter_infos](const auto &entry){iter_infos.push_back(get<0>(entry));}); + auto [shp, str] = multiprep(iter_infos); + + auto infos2 = tuple_transform(fullinfos, [](const auto &arg) + { return get<1>(arg); }); + auto ptrs = tuple_transform(tuple, [](auto &&arg){return arg.data();}); + flexible_mav_applyHelper(shp, str, ptrs, infos2, std::forward(func), nthreads); + } + +template + void flexible_mav_apply(Func &&func, size_t nthreads, T0 &&m0) + { + xflexible_mav_apply(forward_as_tuple(m0), + forward_as_tuple(Xdim()), + std::forward(func), nthreads); + } + +template + void flexible_mav_apply(Func &&func, size_t nthreads, T0 &&m0, T1 &&m1) + { + xflexible_mav_apply(forward_as_tuple(m0, m1), + forward_as_tuple(Xdim(), Xdim()), + std::forward(func), nthreads); + } + +template + void flexible_mav_apply(Func &&func, size_t nthreads, T0 &&m0, T1 &&m1, T2 &&m2) + { + xflexible_mav_apply(forward_as_tuple(m0, m1, m2), + forward_as_tuple(Xdim(), Xdim(), Xdim()), + std::forward(func), nthreads); + } + +} + +using detail_mav::UNINITIALIZED; +using detail_mav::fmav_info; +using detail_mav::mav_info; +using detail_mav::slice; +using detail_mav::MAXIDX; +using detail_mav::cfmav; +using detail_mav::vfmav; +using detail_mav::cmav; +using detail_mav::vmav; +using detail_mav::subarray; +using detail_mav::mav_apply; +using detail_mav::mav_apply_with_index; +using detail_mav::flexible_mav_apply; +} + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/misc_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/misc_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..494b65f79f64bd8ce367614654a073230d95fc8a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/misc_utils.h @@ -0,0 +1,128 @@ +/* Copyright (C) 2019-2021 Max-Planck-Society + Author: Martin Reinecke */ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_MISC_UTILS_H +#define DUCC0_MISC_UTILS_H + +#include +#include +#ifdef __GLIBC__ +#include +#include +#include +#endif + +namespace ducc0 { + +namespace detail_misc_utils { + +using namespace std; + +template auto calcShare(size_t nshares, size_t myshare, + const T &begin, const T &end) + { + auto nwork = end-begin; + auto nbase = nwork/nshares; + auto additional = nwork%nshares; + auto lo = begin + (myshare*nbase + ((myshare auto calcShare(size_t nshares, size_t myshare, const T &end) + { return calcShare(nshares, myshare, T(0), end); } + +template shp noncritical_shape(const shp &in, size_t elemsz) + { + constexpr size_t critstride = 4096; // must be a power of 2 + auto ndim = in.size(); + if (ndim==1) return in; + shp res(in); + size_t stride = elemsz; + for (size_t i=0, xi=ndim-1; i+1) +#include +#include +#include +#include +#include + +namespace ducc0 { + +namespace detail_simd { + +namespace stdx=std::experimental; +using stdx::native_simd; + +template struct simd_select + { using type = stdx::simd>; }; + +using stdx::element_aligned_tag; +template constexpr inline bool vectorizable = native_simd::size()>1; + +template constexpr bool simd_exists_h() + { + if constexpr (N>1) + if constexpr (vectorizable) + if constexpr (!std::is_same_v>, stdx::fixed_size_simd>) + return true; + return false; + } +template constexpr inline bool simd_exists = simd_exists_h(); + +template inline stdx::simd apply(stdx::simd in, Func func) + { + stdx::simd res; + for (size_t i=0; i inline stdx::simd sin(stdx::simd in) + { return apply(in,[](T v){return sin(v);}); } +template inline stdx::simd cos(stdx::simd in) + { return apply(in,[](T v){return cos(v);}); } + +} + +using detail_simd::element_aligned_tag; +using detail_simd::native_simd; +using detail_simd::simd_select; +using detail_simd::simd_exists; +using detail_simd::vectorizable; + +} + +#else + +// only enable SIMD support for gcc>=5.0 and clang>=5.0 +#ifndef DUCC0_NO_SIMD +#define DUCC0_NO_SIMD +#if defined(__clang__) +// AppleClang has their own version numbering +#ifdef __apple_build_version__ +# if (__clang_major__ > 9) || (__clang_major__ == 9 && __clang_minor__ >= 1) +# undef DUCC0_NO_SIMD +# endif +#elif __clang_major__ >= 5 +# undef DUCC0_NO_SIMD +#endif +#elif defined(__GNUC__) +#if __GNUC__>=5 +#undef DUCC0_NO_SIMD +#endif +#endif +#endif + +#include +#include +#include + +#ifndef DUCC0_NO_SIMD +#if defined(__SSE2__) // we are on an x86 platform and we have vector types +#include +#endif + +#if defined(__aarch64__) // let's check for SVE and Neon +#if defined(__ARM_FEATURE_SVE) && defined(__ARM_FEATURE_SVE_BITS) +#if __ARM_FEATURE_SVE_BITS>0 +// OK, we can use SVE +#define DUCC0_USE_SVE +#include +#endif +#endif +#ifndef DUCC0_USE_SVE +// see if we can use Neon +#if defined(__ARM_NEON) +#define DUCC0_USE_NEON +#include +#endif +#endif +#endif + +#endif + +namespace ducc0 { + +namespace detail_simd { + +/// true iff SIMD support is provided for \a T. +template constexpr inline bool vectorizable = false; +#if (!defined(DUCC0_NO_SIMD)) +#if defined(__SSE2__) || defined (DUCC0_USE_SVE) || defined (DUCC0_USE_NEON) +template<> constexpr inline bool vectorizable = true; +template<> constexpr inline bool vectorizable = true; +#endif +#endif + +/// true iff a SIMD type with vector length \a len exists for \a T. +template constexpr inline bool simd_exists = false; + +template constexpr size_t vectorlen + = vectorizable ? reglen/sizeof(T) : 1; + +template class helper_; +template struct vmask_ + { + private: + using hlp = helper_; + using Tm = typename hlp::Tm; + Tm v; + + public: +#if defined(_MSC_VER) + vmask_() {} + vmask_(const vmask_ &other) : v(other.v) {} + vmask_ &operator=(const vmask_ &other) + { v = other.v; return *this; } +#else + vmask_() = default; + vmask_(const vmask_ &other) = default; + vmask_ &operator=(const vmask_ &other) = default; +#endif + vmask_(Tm v_): v(v_) {} + operator Tm() const { return v; } + bool none() const { return hlp::mask_none(v); } + bool any() const { return hlp::mask_any(v); } + bool all() const { return hlp::mask_all(v); } + vmask_ operator& (const vmask_ &other) const { return hlp::mask_and(v,other.v); } + vmask_ operator| (const vmask_ &other) const { return hlp::mask_or(v,other.v); } + }; +struct element_aligned_tag {}; +template class vtp + { + private: + using hlp = helper_; + + public: + using value_type = T; + using Tv = typename hlp::Tv; + using Tm = vmask_; + static constexpr size_t size() { return len; } + + private: + Tv v; + + public: +#if defined(_MSC_VER) + vtp() {} + vtp(const vtp &other): v(other.v) {} + vtp &operator=(const vtp &other) + { v=other.v; return *this; } +#else + vtp() = default; + vtp(const vtp &other) = default; + vtp &operator=(const vtp &other) = default; +#endif + vtp(T other): vtp(hlp::from_scalar(other)) {} + vtp(const Tv &other) : v(other) {} + vtp &operator=(const T &other) { v=hlp::from_scalar(other); return *this; } + operator Tv() const { return v; } + + vtp(const T *ptr, element_aligned_tag) : v(hlp::loadu(ptr)) {} + void copy_to(T *ptr, element_aligned_tag) const { hlp::storeu(ptr, v); } + + vtp operator-() const { return vtp(-v); } + vtp operator+(vtp other) const { return vtp(v+other.v); } + vtp operator-(vtp other) const { return vtp(v-other.v); } + vtp operator*(vtp other) const { return vtp(v*other.v); } + vtp operator/(vtp other) const { return vtp(v/other.v); } + vtp &operator+=(vtp other) { v+=other.v; return *this; } + vtp &operator-=(vtp other) { v-=other.v; return *this; } + vtp &operator*=(vtp other) { v*=other.v; return *this; } + vtp &operator/=(vtp other) { v/=other.v; return *this; } + vtp abs() const { return hlp::abs(v); } + inline vtp sqrt() const + { return hlp::sqrt(v); } + vtp max(const vtp &other) const + { return hlp::max(v, other.v); } + Tm operator>(const vtp &other) const + { return hlp::gt(v, other.v); } + Tm operator>=(const vtp &other) const + { return hlp::ge(v, other.v); } + Tm operator<(const vtp &other) const + { return hlp::lt(v, other.v); } + Tm operator!=(const vtp &other) const + { return hlp::ne(v, other.v); } + static vtp blend(Tm mask, const vtp &a, const vtp &b) + { return hlp::blend(mask, a, b); } + + class reference + { + private: + vtp &v; + size_t i; + public: + reference (vtp &v_, size_t i_) + : v(v_), i(i_) {} + reference &operator= (T other) + { v.v[i] = other; return *this; } + reference &operator*= (T other) + { v.v[i] *= other; return *this; } + operator T() const { return v.v[i]; } + }; + + void Set(size_t i, T val) { v[i] = val; } + reference operator[](size_t i) { return reference(*this, i); } + T operator[](size_t i) const { return v[i]; } + + class where_expr + { + private: + vtp &v; + Tm m; + + public: + where_expr (Tm m_, vtp &v_) + : v(v_), m(m_) {} + where_expr &operator= (const vtp &other) + { v=hlp::blend(m, other.v, v.v); return *this; } + where_expr &operator*= (const vtp &other) + { v=hlp::blend(m, v.v*other.v, v.v); return *this; } + where_expr &operator+= (const vtp &other) + { v=hlp::blend(m, v.v+other.v, v.v); return *this; } + where_expr &operator-= (const vtp &other) + { v=hlp::blend(m, v.v-other.v, v.v); return *this; } + }; + }; +template inline vtp abs(vtp v) { return v.abs(); } +template typename vtp::where_expr where(typename vtp::Tm m, vtp &v) + { return typename vtp::where_expr(m, v); } +template vtp operator*(T0 a, vtp b) + { return b*a; } +template vtp operator+(T a, vtp b) + { return b+a; } +template vtp operator-(T a, vtp b) + { return vtp(a) - b; } +template vtp max(vtp a, vtp b) + { return a.max(b); } +template vtp sqrt(vtp v) + { return v.sqrt(); } +template inline bool none_of(const vmask_ &mask) + { return mask.none(); } +template inline bool any_of(const vmask_ &mask) + { return mask.any(); } +template inline bool all_of(const vmask_ &mask) + { return mask.all(); } +template inline vtp blend (const vmask_ &mask, const vtp &a, const vtp &b) + { return vtp::blend(mask, a, b); } +template T reduce(const vtp &v, Op op) + { + T res=v[0]; + for (size_t i=1; i vtp apply(vtp in, Func func) + { + vtp res; + for (size_t i=0; i class pseudoscalar + { + private: + T v; + + public: +#if defined(_MSC_VER) + pseudoscalar() {} + pseudoscalar(const pseudoscalar &other) : v(other.v) {} + pseudoscalar & operator=(const pseudoscalar &other) + { v=other.v; return *this; } +#else + pseudoscalar() = default; + pseudoscalar(const pseudoscalar &other) = default; + pseudoscalar & operator=(const pseudoscalar &other) = default; +#endif + pseudoscalar(T v_):v(v_) {} + pseudoscalar operator-() const { return pseudoscalar(-v); } + pseudoscalar operator+(pseudoscalar other) const { return pseudoscalar(v+other.v); } + pseudoscalar operator-(pseudoscalar other) const { return pseudoscalar(v-other.v); } + pseudoscalar operator*(pseudoscalar other) const { return pseudoscalar(v*other.v); } + pseudoscalar operator/(pseudoscalar other) const { return pseudoscalar(v/other.v); } + pseudoscalar &operator+=(pseudoscalar other) { v+=other.v; return *this; } + pseudoscalar &operator-=(pseudoscalar other) { v-=other.v; return *this; } + pseudoscalar &operator*=(pseudoscalar other) { v*=other.v; return *this; } + pseudoscalar &operator/=(pseudoscalar other) { v/=other.v; return *this; } + + pseudoscalar abs() const { return std::abs(v); } + inline pseudoscalar sqrt() const { return std::sqrt(v); } + pseudoscalar max(const pseudoscalar &other) const + { return std::max(v, other.v); } + + bool operator>(const pseudoscalar &other) const + { return v>other.v; } + bool operator>=(const pseudoscalar &other) const + { return v>=other.v; } + bool operator<(const pseudoscalar &other) const + { return v class helper_ + { + private: + static constexpr size_t len = 1; + public: + using Tv = pseudoscalar; + using Tm = bool; + + static Tv loadu(const T *ptr) { return *ptr; } + static void storeu(T *ptr, Tv v) { *ptr = v[0]; } + + static Tv from_scalar(T v) { return v; } + static Tv abs(Tv v) { return v.abs(); } + static Tv max(Tv v1, Tv v2) { return v1.max(v2); } + static Tv blend(Tm m, Tv v1, Tv v2) { return m ? v1 : v2; } + static Tv sqrt(Tv v) { return v.sqrt(); } + static Tm gt (Tv v1, Tv v2) { return v1>v2; } + static Tm ge (Tv v1, Tv v2) { return v1>=v2; } + static Tm lt (Tv v1, Tv v2) { return v1 constexpr inline bool simd_exists = true; +template<> class helper_ + { + private: + using T = double; + static constexpr size_t len = 8; + public: + using Tv = __m512d; + using Tm = __mmask8; + + static Tv loadu(const T *ptr) { return _mm512_loadu_pd(ptr); } + static void storeu(T *ptr, Tv v) { _mm512_storeu_pd(ptr, v); } + + static Tv from_scalar(T v) { return _mm512_set1_pd(v); } + static Tv abs(Tv v) { return __m512d(_mm512_andnot_epi64(__m512i(_mm512_set1_pd(-0.)),__m512i(v))); } + static Tv max(Tv v1, Tv v2) { return _mm512_max_pd(v1, v2); } + static Tv blend(Tm m, Tv v1, Tv v2) { return _mm512_mask_blend_pd(m, v2, v1); } + static Tv sqrt(Tv v) { return _mm512_sqrt_pd(v); } + static Tm gt (Tv v1, Tv v2) { return _mm512_cmp_pd_mask(v1,v2,_CMP_GT_OQ); } + static Tm ge (Tv v1, Tv v2) { return _mm512_cmp_pd_mask(v1,v2,_CMP_GE_OQ); } + static Tm lt (Tv v1, Tv v2) { return _mm512_cmp_pd_mask(v1,v2,_CMP_LT_OQ); } + static Tm ne (Tv v1, Tv v2) { return _mm512_cmp_pd_mask(v1,v2,_CMP_NEQ_OQ); } + static Tm mask_and (Tm v1, Tm v2) { return v1&v2; } + static Tm mask_or (Tm v1, Tm v2) { return v1|v2; } + static bool mask_none(Tm v) { return v==0; } + static bool mask_any(Tm v) { return v!=0; } + static bool mask_all(Tm v) + { + static constexpr auto fullmask = Tm((size_t(1)< constexpr inline bool simd_exists = true; +template<> class helper_ + { + private: + using T = float; + static constexpr size_t len = 16; + public: + using Tv = __m512; + using Tm = __mmask16; + + static Tv loadu(const T *ptr) { return _mm512_loadu_ps(ptr); } + static void storeu(T *ptr, Tv v) { _mm512_storeu_ps(ptr, v); } + + static Tv from_scalar(T v) { return _mm512_set1_ps(v); } + static Tv abs(Tv v) { return __m512(_mm512_andnot_epi32(__m512i(_mm512_set1_ps(-0.)),__m512i(v))); } + static Tv max(Tv v1, Tv v2) { return _mm512_max_ps(v1, v2); } + static Tv blend(Tm m, Tv v1, Tv v2) { return _mm512_mask_blend_ps(m, v2, v1); } + static Tv sqrt(Tv v) { return _mm512_sqrt_ps(v); } + static Tm gt (Tv v1, Tv v2) { return _mm512_cmp_ps_mask(v1,v2,_CMP_GT_OQ); } + static Tm ge (Tv v1, Tv v2) { return _mm512_cmp_ps_mask(v1,v2,_CMP_GE_OQ); } + static Tm lt (Tv v1, Tv v2) { return _mm512_cmp_ps_mask(v1,v2,_CMP_LT_OQ); } + static Tm ne (Tv v1, Tv v2) { return _mm512_cmp_ps_mask(v1,v2,_CMP_NEQ_OQ); } + static Tm mask_and (Tm v1, Tm v2) { return v1&v2; } + static Tm mask_or (Tm v1, Tm v2) { return v1|v2; } + static bool mask_none(Tm v) { return v==0; } + static bool mask_any(Tm v) { return v!=0; } + static bool mask_all(Tm v) + { + static constexpr auto fullmask = Tm((size_t(1)< constexpr inline bool simd_exists = true; +template<> class helper_ + { + private: + using T = double; + static constexpr size_t len = 4; + public: + using Tv = __m256d; + using Tm = __m256d; + + static Tv loadu(const T *ptr) { return _mm256_loadu_pd(ptr); } + static void storeu(T *ptr, Tv v) { _mm256_storeu_pd(ptr, v); } + + static Tv from_scalar(T v) { return _mm256_set1_pd(v); } + static Tv abs(Tv v) { return _mm256_andnot_pd(_mm256_set1_pd(-0.),v); } + static Tv max(Tv v1, Tv v2) { return _mm256_max_pd(v1, v2); } + static Tv blend(Tm m, Tv v1, Tv v2) { return _mm256_blendv_pd(v2, v1, m); } + static Tv sqrt(Tv v) { return _mm256_sqrt_pd(v); } + static Tm gt (Tv v1, Tv v2) { return _mm256_cmp_pd(v1,v2,_CMP_GT_OQ); } + static Tm ge (Tv v1, Tv v2) { return _mm256_cmp_pd(v1,v2,_CMP_GE_OQ); } + static Tm lt (Tv v1, Tv v2) { return _mm256_cmp_pd(v1,v2,_CMP_LT_OQ); } + static Tm ne (Tv v1, Tv v2) { return _mm256_cmp_pd(v1,v2,_CMP_NEQ_OQ); } + static Tm mask_and (Tm v1, Tm v2) { return _mm256_and_pd(v1,v2); } + static Tm mask_or (Tm v1, Tm v2) { return _mm256_or_pd(v1,v2); } + static size_t maskbits(Tm v) { return size_t(_mm256_movemask_pd(v)); } + static bool mask_none(Tm v) { return maskbits(v)==0; } + static bool mask_any(Tm v) { return maskbits(v)!=0; } + static bool mask_all(Tm v) + { + static constexpr auto fullmask = (size_t(1)< constexpr inline bool simd_exists = true; +template<> class helper_ + { + private: + using T = float; + static constexpr size_t len = 8; + public: + using Tv = __m256; + using Tm = __m256; + + static Tv loadu(const T *ptr) { return _mm256_loadu_ps(ptr); } + static void storeu(T *ptr, Tv v) { _mm256_storeu_ps(ptr, v); } + + static Tv from_scalar(T v) { return _mm256_set1_ps(v); } + static Tv abs(Tv v) { return _mm256_andnot_ps(_mm256_set1_ps(-0.),v); } + static Tv max(Tv v1, Tv v2) { return _mm256_max_ps(v1, v2); } + static Tv blend(Tm m, Tv v1, Tv v2) { return _mm256_blendv_ps(v2, v1, m); } + static Tv sqrt(Tv v) { return _mm256_sqrt_ps(v); } + static Tm gt (Tv v1, Tv v2) { return _mm256_cmp_ps(v1,v2,_CMP_GT_OQ); } + static Tm ge (Tv v1, Tv v2) { return _mm256_cmp_ps(v1,v2,_CMP_GE_OQ); } + static Tm lt (Tv v1, Tv v2) { return _mm256_cmp_ps(v1,v2,_CMP_LT_OQ); } + static Tm ne (Tv v1, Tv v2) { return _mm256_cmp_ps(v1,v2,_CMP_NEQ_OQ); } + static Tm mask_and (Tm v1, Tm v2) { return _mm256_and_ps(v1,v2); } + static Tm mask_or (Tm v1, Tm v2) { return _mm256_or_ps(v1,v2); } + static size_t maskbits(Tm v) { return size_t(_mm256_movemask_ps(v)); } + static bool mask_none(Tm v) { return maskbits(v)==0; } + static bool mask_any(Tm v) { return maskbits(v)!=0; } + static bool mask_all(Tm v) + { + static constexpr auto fullmask = (size_t(1)< constexpr inline bool simd_exists = true; +template<> class helper_ + { + private: + using T = double; + static constexpr size_t len = 2; + public: + using Tv = __m128d; + using Tm = __m128d; + + static Tv loadu(const T *ptr) { return _mm_loadu_pd(ptr); } + static void storeu(T *ptr, Tv v) { _mm_storeu_pd(ptr, v); } + + static Tv from_scalar(T v) { return _mm_set1_pd(v); } + static Tv abs(Tv v) { return _mm_andnot_pd(_mm_set1_pd(-0.),v); } + static Tv max(Tv v1, Tv v2) { return _mm_max_pd(v1, v2); } + static Tv blend(Tm m, Tv v1, Tv v2) + { +#if defined(__SSE4_1__) + return _mm_blendv_pd(v2,v1,m); +#else + return _mm_or_pd(_mm_and_pd(m,v1),_mm_andnot_pd(m,v2)); +#endif + } + static Tv sqrt(Tv v) { return _mm_sqrt_pd(v); } + static Tm gt (Tv v1, Tv v2) { return _mm_cmpgt_pd(v1,v2); } + static Tm ge (Tv v1, Tv v2) { return _mm_cmpge_pd(v1,v2); } + static Tm lt (Tv v1, Tv v2) { return _mm_cmplt_pd(v1,v2); } + static Tm ne (Tv v1, Tv v2) { return _mm_cmpneq_pd(v1,v2); } + static Tm mask_and (Tm v1, Tm v2) { return _mm_and_pd(v1,v2); } + static Tm mask_or (Tm v1, Tm v2) { return _mm_or_pd(v1,v2); } + static size_t maskbits(Tm v) { return size_t(_mm_movemask_pd(v)); } + static bool mask_none(Tm v) { return maskbits(v)==0; } + static bool mask_any(Tm v) { return maskbits(v)!=0; } + static bool mask_all(Tm v) + { + static constexpr auto fullmask = (size_t(1)< constexpr inline bool simd_exists = true; +template<> class helper_ + { + private: + using T = float; + static constexpr size_t len = 4; + public: + using Tv = __m128; + using Tm = __m128; + + static Tv loadu(const T *ptr) { return _mm_loadu_ps(ptr); } + static void storeu(T *ptr, Tv v) { _mm_storeu_ps(ptr, v); } + + static Tv from_scalar(T v) { return _mm_set1_ps(v); } + static Tv abs(Tv v) { return _mm_andnot_ps(_mm_set1_ps(-0.),v); } + static Tv max(Tv v1, Tv v2) { return _mm_max_ps(v1, v2); } + static Tv blend(Tm m, Tv v1, Tv v2) + { +#if defined(__SSE4_1__) + return _mm_blendv_ps(v2,v1,m); +#else + return _mm_or_ps(_mm_and_ps(m,v1),_mm_andnot_ps(m,v2)); +#endif + } + static Tv sqrt(Tv v) { return _mm_sqrt_ps(v); } + static Tm gt (Tv v1, Tv v2) { return _mm_cmpgt_ps(v1,v2); } + static Tm ge (Tv v1, Tv v2) { return _mm_cmpge_ps(v1,v2); } + static Tm lt (Tv v1, Tv v2) { return _mm_cmplt_ps(v1,v2); } + static Tm ne (Tv v1, Tv v2) { return _mm_cmpneq_ps(v1,v2); } + static Tm mask_and (Tm v1, Tm v2) { return _mm_and_ps(v1,v2); } + static Tm mask_or (Tm v1, Tm v2) { return _mm_or_ps(v1,v2); } + static size_t maskbits(Tm v) { return size_t(_mm_movemask_ps(v)); } + static bool mask_none(Tm v) { return maskbits(v)==0; } + static bool mask_any(Tm v) { return maskbits(v)!=0; } + static bool mask_all(Tm v) + { + static constexpr auto fullmask = (size_t(1)< class gnuvec_helper + { + public: + using Tv __attribute__ ((vector_size (len*sizeof(T)))) = T; + using Tm = decltype(Tv()v2; } + static Tm ge (Tv v1, Tv v2) { return v1>=v2; } + static Tm lt (Tv v1, Tv v2) { return v1 constexpr inline bool simd_exists = true; +template<> class helper_: public gnuvec_helper {}; +template<> constexpr inline bool simd_exists = true; +template<> class helper_: public gnuvec_helper {}; +#endif + +#if defined(DUCC0_USE_NEON) +template<> constexpr inline bool simd_exists = true; +template<> class helper_ + { + private: + using T = double; + static constexpr size_t len = 2; + public: + using Tv = float64x2_t; + using Tm = uint64x2_t; + + static Tv loadu(const T *ptr) { return vld1q_f64(ptr); } + static void storeu(T *ptr, Tv v) { vst1q_f64(ptr, v); } + + static Tv from_scalar(T v) { return vdupq_n_f64(v); } + static Tv abs(Tv v) { return vabsq_f64(v); } + static Tv max(Tv v1, Tv v2) { return vmaxq_f64(v1, v2); } + static Tv blend(Tm m, Tv v1, Tv v2) + { return vbslq_f64(m, v1, v2); } + static Tv sqrt(Tv v) { return vsqrtq_f64(v); } + static Tm gt (Tv v1, Tv v2) { return vcgtq_f64(v1,v2); } + static Tm ge (Tv v1, Tv v2) { return vcgeq_f64(v1,v2); } + static Tm lt (Tv v1, Tv v2) { return vcltq_f64(v1,v2); } + static Tm ne (Tv v1, Tv v2) + { return vreinterpretq_u64_u32(vmvnq_u32(vreinterpretq_u32_u64(vceqq_f64(v1,v2)))); } + static Tm mask_and (Tm v1, Tm v2) { return vandq_u64(v1,v2); } + static Tm mask_or (Tm v1, Tm v2) { return vorrq_u64(v1,v2); } + static size_t maskbits(Tm v) + { + auto high_bits = vshrq_n_u64(v, 63); + return vgetq_lane_u64(high_bits, 0) | ((vgetq_lane_u64(high_bits, 1)<<1)); + } + static bool mask_none(Tm v) { return maskbits(v)==0; } + static bool mask_any(Tm v) { return maskbits(v)!=0; } + static bool mask_all(Tm v) + { + static constexpr auto fullmask = (size_t(1)< constexpr inline bool simd_exists = true; +template<> class helper_ + { + private: + using T = float; + static constexpr size_t len = 4; + public: + using Tv = float32x4_t; + using Tm = uint32x4_t; + + static Tv loadu(const T *ptr) { return vld1q_f32(ptr); } + static void storeu(T *ptr, Tv v) { vst1q_f32(ptr, v); } + + static Tv from_scalar(T v) { return vdupq_n_f32(v); } + static Tv abs(Tv v) { return vabsq_f32(v); } + static Tv max(Tv v1, Tv v2) { return vmaxq_f32(v1, v2); } + static Tv blend(Tm m, Tv v1, Tv v2) { return vbslq_f32(m, v1, v2); } + static Tv sqrt(Tv v) { return vsqrtq_f32(v); } + static Tm gt (Tv v1, Tv v2) { return vcgtq_f32(v1,v2); } + static Tm ge (Tv v1, Tv v2) { return vcgeq_f32(v1,v2); } + static Tm lt (Tv v1, Tv v2) { return vcltq_f32(v1,v2); } + static Tm ne (Tv v1, Tv v2) { return vmvnq_u32(vceqq_f32(v1,v2)); } + static Tm mask_and (Tm v1, Tm v2) { return vandq_u32(v1,v2); } + static Tm mask_or (Tm v1, Tm v2) { return vorrq_u32(v1,v2); } + static size_t maskbits(Tm v) + { + static constexpr int32x4_t shift = {0, 1, 2, 3}; + auto tmp = vshrq_n_u32(v, 31); + return vaddvq_u32(vshlq_u32(tmp, shift)); + } + static bool mask_none(Tm v) { return maskbits(v)==0; } + static bool mask_any(Tm v) { return maskbits(v)!=0; } + static bool mask_all(Tm v) + { + static constexpr auto fullmask = (size_t(1)< using native_simd = vtp>; +#elif defined(__AVX__) +template using native_simd = vtp>; +#elif defined(__SSE2__) +template using native_simd = vtp>; +#elif defined(DUCC0_USE_SVE) +template using native_simd = vtp>; +#elif defined(DUCC0_USE_NEON) +template using native_simd = vtp>; +#else +template using native_simd = vtp; +#endif + +#else // DUCC0_NO_SIMD is defined +/// The SIMD type for \a T with the largest vector length on this platform. +template using native_simd = vtp; +#endif +/// Provides a SIMD type for \a T with vector length \a len, if it exists. +template struct simd_select + { using type = vtp; }; +template inline vtp sin(vtp in) + { return apply(in,[](T v){return std::sin(v);}); } +template inline vtp cos(vtp in) + { return apply(in,[](T v){return std::cos(v);}); } + +} + +using detail_simd::element_aligned_tag; +using detail_simd::native_simd; +using detail_simd::simd_select; +using detail_simd::simd_exists; +using detail_simd::vectorizable; + +} +#endif +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/threading.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/threading.h new file mode 100644 index 0000000000000000000000000000000000000000..eca79d8f338c3b968a8c7e085869accd9dc7fa45 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/threading.h @@ -0,0 +1,328 @@ +/** \file ducc0/infra/threading.h + * Mulithreading support, similar to functionality provided by OpenMP + * + * \copyright Copyright (C) 2019-2023 Peter Bell, Max-Planck-Society + * \authors Peter Bell, Martin Reinecke + */ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_THREADING_H +#define DUCC0_THREADING_H + +// Low level threading support can be influenced by the following macros: +// - DUCC0_NO_LOWLEVEL_THREADING: if defined, multithreading is disabled +// and all parallel regions will be executed sequentially +// on the invoking thread. +// - DUCC0_CUSTOM_LOWLEVEL_THREADING: if defined, external definitions of +// Mutex, UniqueLock, LockGuard, CondVar, set_active_pool(), +// and get active_pool() must be supplied in "ducc0_custom_lowlevel_threading.h" +// and the code will use those. +// Both macros must not be defined at the same time. +// If neither macro is defined, standard ducc0 multihreading will be active. + +#if (defined(DUCC0_NO_LOWLEVEL_THREADING) && defined(DUCC0_CUSTOM_LOWLEVEL_THREADING)) +static_assert(false, "DUCC0_NO_LOWLEVEL_THREADING and DUCC0_CUSTOMLOWLEVEL_THREADING must not be both defined"); +#endif + +#if defined(DUCC0_STDCXX_LOWLEVEL_THREADING) +static_assert(false, "DUCC0_STDCXX_LOWLEVEL_THREADING must not be defined externally"); +#endif + +#if ((!defined(DUCC0_NO_LOWLEVEL_THREADING)) && (!defined(DUCC0_CUSTOM_LOWLEVEL_THREADING))) +#define DUCC0_STDCXX_LOWLEVEL_THREADING +#endif + +#include +#include +#include + +// threading-specific headers +#ifdef DUCC0_STDCXX_LOWLEVEL_THREADING +#include +#include +#endif + +#ifdef DUCC0_NO_LOWLEVEL_THREADING +// no headers needed +#endif + +namespace ducc0 { +namespace detail_threading { + +using std::size_t; + +/// Abstract base class for minimalistic thread pool functionality +class thread_pool + { + public: + virtual ~thread_pool() {} + /// Returns the total number of threads managed by the pool + virtual size_t nthreads() const = 0; + /** "Normalizes" a requested number of threads. A useful convention could be + return (nthreads_in==0) ? nthreads() : min(nthreads(), nthreads_in); */ + virtual size_t adjust_nthreads(size_t nthreads_in) const = 0; + virtual void submit(std::function work) = 0; + }; + +}} + +#ifdef DUCC0_CUSTOM_LOWLEVEL_THREADING +#include "ducc0_custom_lowlevel_threading.h" +#endif + +namespace ducc0 { + +namespace detail_threading { + +thread_pool *set_active_pool(thread_pool *new_pool); +thread_pool *get_active_pool(); + +// define threading related types dependent on the underlying implementation +#ifdef DUCC0_STDCXX_LOWLEVEL_THREADING +using Mutex = std::mutex; +using UniqueLock = std::unique_lock; +using LockGuard = std::lock_guard; +using CondVar = std::condition_variable; +#endif + +#ifdef DUCC0_NO_LOWLEVEL_THREADING +struct Mutex + { + void lock(){} + void unlock(){} + }; +struct LockGuard + { + LockGuard(const Mutex &){} + }; +struct UniqueLock + { + UniqueLock(const Mutex &){} + void lock() {} + void unlock() {} + }; +struct CondVar + { + template + void wait(UniqueLock &, Predicate) {} + void notify_one() noexcept {} + void notify_all() noexcept {} + }; +#endif + +using std::size_t; + +class ScopedUseThreadPool + { + private: + thread_pool *old_pool_; + public: + ScopedUseThreadPool(thread_pool &pool) + { old_pool_ = set_active_pool(&pool); } + ~ScopedUseThreadPool() + { set_active_pool(old_pool_); } + }; + +/// Index range describing a chunk of work inside a parallelized loop +struct Range + { + size_t lo, //< first index of the chunk + hi; //< one-past-last index of the chunk + Range() : lo(0), hi(0) {} + Range(size_t lo_, size_t hi_) : lo(lo_), hi(hi_) {} + /// Returns true iff the chunk is not empty + operator bool() const { return hi>lo; } + }; + +/// Class supplied to parallel regions, which allows them to determine their +/// work chunks. +class Scheduler + { + public: + virtual ~Scheduler() {} + /// Returns the number of threads working in this parallel region + virtual size_t num_threads() const = 0; + /// Returns the number of this thread, from the range 0 to num_threads()-1. + virtual size_t thread_num() const = 0; + /// Returns information about the next chunk of work. + /// If this chunk is empty, the work on this thread is done. + virtual Range getNext() = 0; + }; + +/** Returns the maximum number of threads that are supported by currently + active thread pool. */ +size_t max_threads(); +size_t adjust_nthreads(size_t nthreads); + +/// Execute \a func over \a nwork work items, on a single thread. +void execSingle(size_t nwork, + std::function func); +/// Execute \a func over \a nwork work items, on \a nthreads threads. +/** Chunks will have the size \a chunksize, except for the last one which + * may be smaller. + * + * Chunks are statically assigned to threads at startup. */ +void execStatic(size_t nwork, size_t nthreads, size_t chunksize, + std::function func); +/// Execute \a func over \a nwork work items, on \a nthreads threads. +/** Chunks will have the size \a chunksize, except for the last one which + * may be smaller. + * + * Chunks are assigned dynamically to threads;whenever a thread is finished + * with its current chunk, it will obtain the next one from the list of + * remaining chunks. */ +void execDynamic(size_t nwork, size_t nthreads, size_t chunksize, + std::function func); +void execGuided(size_t nwork, size_t nthreads, size_t chunksize_min, + double fact_max, std::function func); +/// Execute \a func on \a nthreads threads. +/** Work subdivision must be organized within \a func. */ +void execParallel(size_t nthreads, std::function func); +/// Execute \a func on \a nthreads threads, passing only the thread number. +/** Work subdivision must be organized within \a func. */ +void execParallel(size_t nthreads, std::function func); +/// Execute \a func on work items [\a lo; \a hi[ over \a nthreads threads. +/** Work items are subdivided fairly among threads. */ +void execParallel(size_t work_lo, size_t work_hi, size_t nthreads, + std::function func); +/// Execute \a func on work items [0; \a nwork[ over \a nthreads threads. +/** Work items are subdivided fairly among threads. */ +inline void execParallel(size_t nwork, size_t nthreads, + std::function func) + { execParallel(0, nwork, nthreads, func); } +/// Execute \a func on work items [\a lo; \a hi[ over \a nthreads threads. +/** The first argument to \a func is the thread number. + * + * Work items are subdivided fairly among threads. */ +void execParallel(size_t work_lo, size_t work_hi, size_t nthreads, + std::function func); +/// Execute \a func on work items [0; \a nwork[ over \a nthreads threads. +/** The first argument to \a func is the thread number. + * + * Work items are subdivided fairly among threads. */ +inline void execParallel(size_t nwork, size_t nthreads, + std::function func) + { execParallel(0, nwork, nthreads, func); } + +template class Worklist + { + private: + Mutex mtx; + CondVar cv; + size_t nworking{0}; + std::vector items; + + public: + Worklist(const std::vector &items_) + : items(items_) {} + + std::optional get_item() + { + UniqueLock lck(mtx); + if ((--nworking==0) && items.empty()) cv.notify_all(); + cv.wait(lck,[&](){return (!items.empty()) || (nworking==0);}); + if (!items.empty()) + { + auto res = items.back(); + items.pop_back(); + ++nworking; + return res; + } + else + return {}; + } + void startup() + { + LockGuard lck(mtx); + ++nworking; + } + void put_item(const T &item) + { + LockGuard lck(mtx); + items.push_back(item); + cv.notify_one(); + } + }; + +/// Execute \a func on work items in \a items over \a nthreads threads. +/** While processing a work item, \a func may submit further items to the list + * of work items. For this purpose, \a func must take a const T & + * (the work item to be processed) as well as a function which also takes + * a const T & (the insert function). Work items will be assigned whenever a + * thread becomes available. */ +template auto execWorklist + (size_t nthreads, const std::vector &items, Func &&func) + { + Worklist wl(items); + execParallel(nthreads, [&wl, &func](auto &) { + wl.startup(); + while(auto wrk=wl.get_item()) + func(wrk.value(), [&wl](const T &item){wl.put_item(item);}); + }); + } + +} // end of namespace detail_threading + +using detail_threading::Mutex; +using detail_threading::LockGuard; +using detail_threading::UniqueLock; +using detail_threading::CondVar; +using detail_threading::thread_pool; +using detail_threading::ScopedUseThreadPool; +using detail_threading::max_threads; +using detail_threading::adjust_nthreads; +using detail_threading::Scheduler; +using detail_threading::execSingle; +using detail_threading::execStatic; +using detail_threading::execDynamic; +using detail_threading::execGuided; +using detail_threading::execParallel; +using detail_threading::execWorklist; + +} // end of namespace ducc0 + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/useful_macros.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/useful_macros.h new file mode 100644 index 0000000000000000000000000000000000000000..eaef2677922f350bea98f650f116fdfc62e61e9c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/infra/useful_macros.h @@ -0,0 +1,74 @@ +/* +This file is part of the ducc library. + +Copyright (C) 2010-2022 Max-Planck-Society + +Author: Martin Reinecke +*/ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_USEFUL_MACROS_H +#define DUCC0_USEFUL_MACROS_H + +#if defined(__GNUC__) +#define DUCC0_NOINLINE [[gnu::noinline]] +#define DUCC0_RESTRICT __restrict__ +#define DUCC0_PREFETCH_R(addr) __builtin_prefetch(addr); +#define DUCC0_PREFETCH_W(addr) __builtin_prefetch(addr,1); +#elif defined(_MSC_VER) +#define DUCC0_NOINLINE __declspec(noinline) +#define DUCC0_RESTRICT __restrict +#define DUCC0_PREFETCH_R(addr) +#define DUCC0_PREFETCH_W(addr) +#else +#define DUCC0_NOINLINE +#define DUCC0_RESTRICT +#define DUCC0_PREFETCH_R(addr) +#define DUCC0_PREFETCH_W(addr) +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/math/cmplx.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/math/cmplx.h new file mode 100644 index 0000000000000000000000000000000000000000..522a3bdda1111de23284fdb3ca9f9de0eda548ae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/math/cmplx.h @@ -0,0 +1,108 @@ +/** \file ducc0/math/cmplx.h + * Minimalistic complex number class + * + * \copyright Copyright (C) 2019-2023 Max-Planck-Society + * \author Martin Reinecke + */ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_CMPLX_H +#define DUCC0_CMPLX_H + +namespace ducc0 { + +/// Very basic class representing complex numbers +/** Meant exclusively for internal low-level use, e.g. in FFT routines. */ +template struct Cmplx { + T r, i; + Cmplx() {} + constexpr Cmplx(T r_, T i_) : r(r_), i(i_) {} + constexpr Cmplx(T r_) : r(r_), i(T(0)) {} + void Set(T r_, T i_) { r=r_; i=i_; } + void Set(T r_) { r=r_; i=T(0); } + void Split(T &r_, T &i_) const { r_=r; i_=i; } + void SplitConj(T &r_, T &i_) const { r_=r; i_=-i; } + Cmplx &operator+= (const Cmplx &other) + { r+=other.r; i+=other.i; return *this; } + templateCmplx &operator*= (T2 other) + { r*=other; i*=other; return *this; } + templateCmplx &operator*= (const Cmplx &other) + { + T tmp = r*other.r - i*other.i; + i = r*other.i + i*other.r; + r = tmp; + return *this; + } + Cmplx conj() const { return {r, -i}; } + templateCmplx &operator+= (const Cmplx &other) + { r+=other.r; i+=other.i; return *this; } + templateCmplx &operator-= (const Cmplx &other) + { r-=other.r; i-=other.i; return *this; } + template auto operator* (const T2 &other) const + -> Cmplx + { return {r*other, i*other}; } + template auto operator+ (const Cmplx &other) const + -> Cmplx + { return {r+other.r, i+other.i}; } + template auto operator- (const Cmplx &other) const + -> Cmplx + { return {r-other.r, i-other.i}; } + template auto operator* (const Cmplx &other) const + -> Cmplx + { return {r*other.r-i*other.i, r*other.i + i*other.r}; } + template auto special_mul (const Cmplx &other) const + -> Cmplx + { + using Tres = Cmplx; + return fwd ? Tres(r*other.r+i*other.i, i*other.r-r*other.i) + : Tres(r*other.r-i*other.i, r*other.i+i*other.r); + } + }; + +} + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/math/unity_roots.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/math/unity_roots.h new file mode 100644 index 0000000000000000000000000000000000000000..09df542b2a138a6bff2f9a2d30fd5925b6954870 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/ducc/src/ducc0/math/unity_roots.h @@ -0,0 +1,241 @@ +/* Copyright (C) 2019-2021 Max-Planck-Society + Author: Martin Reinecke */ + +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */ + +/* +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * This code is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this code; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUCC0_UNITY_ROOTS_H +#define DUCC0_UNITY_ROOTS_H + +#include +#include +#include +#include + +namespace ducc0 { + +namespace detail_unity_roots { + +using namespace std; + +template class UnityRoots + { + private: + using Thigh = typename conditional<(sizeof(T)>sizeof(double)), T, double>::type; + struct cmplx_ { Thigh r, i; }; + size_t N, mask, shift; + vector v1, v2; + + static cmplx_ calc(size_t x, size_t n, Thigh ang) + { + x<<=3; + if (x<4*n) // first half + { + if (x<2*n) // first quadrant + { + if (x>shift]; + return Tc(T(x1.r*x2.r-x1.i*x2.i), T(x1.r*x2.i+x1.i*x2.r)); + } + idx = N-idx; + auto x1=v1[idx&mask], x2=v2[idx>>shift]; + return Tc(T(x1.r*x2.r-x1.i*x2.i), -T(x1.r*x2.i+x1.i*x2.r)); + } + }; + +template class MultiExp + { + private: + using Thigh = typename conditional<(sizeof(T)>sizeof(double)), T, double>::type; + struct cmplx_ { Thigh r, i; }; + size_t N, mask, shift; + vector v1, v2; + + public: + MultiExp(T ang0, size_t n) + : N(n) + { + Thigh ang = ang0; + size_t nval = n+2; + shift = 1; + while((size_t(1)<>shift]; + return Tc(T(x1.r*x2.r-x1.i*x2.i), T(x1.r*x2.i+x1.i*x2.r)); + } + }; + +} + +using detail_unity_roots::UnityRoots; +using detail_unity_roots::MultiExp; + +} + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/farmhash_archive/src/farmhash.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/farmhash_archive/src/farmhash.h new file mode 100644 index 0000000000000000000000000000000000000000..4997bb715a0fc02a72531978e5a4a6626090a0e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/farmhash_archive/src/farmhash.h @@ -0,0 +1,328 @@ +// Copyright (c) 2014 Google, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// FarmHash, by Geoff Pike + +// +// http://code.google.com/p/farmhash/ +// +// This file provides a few functions for hashing strings and other +// data. All of them are high-quality functions in the sense that +// they do well on standard tests such as Austin Appleby's SMHasher. +// They're also fast. FarmHash is the successor to CityHash. +// +// Functions in the FarmHash family are not suitable for cryptography. +// +// WARNING: This code has been only lightly tested on big-endian platforms! +// It is known to work well on little-endian platforms that have a small penalty +// for unaligned reads, such as current Intel and AMD moderate-to-high-end CPUs. +// It should work on all 32-bit and 64-bit platforms that allow unaligned reads; +// bug reports are welcome. +// +// By the way, for some hash functions, given strings a and b, the hash +// of a+b is easily derived from the hashes of a and b. This property +// doesn't hold for any hash functions in this file. + +#ifndef FARM_HASH_H_ +#define FARM_HASH_H_ + +#include +#include +#include +#include // for memcpy and memset +#include + +#ifndef NAMESPACE_FOR_HASH_FUNCTIONS +#define NAMESPACE_FOR_HASH_FUNCTIONS util +#endif + +namespace NAMESPACE_FOR_HASH_FUNCTIONS { + +#if defined(FARMHASH_UINT128_T_DEFINED) +#if defined(__clang__) +#if !defined(uint128_t) +#define uint128_t __uint128_t +#endif +#endif +inline uint64_t Uint128Low64(const uint128_t x) { + return static_cast(x); +} +inline uint64_t Uint128High64(const uint128_t x) { + return static_cast(x >> 64); +} +inline uint128_t Uint128(uint64_t lo, uint64_t hi) { + return lo + (((uint128_t)hi) << 64); +} +#else +typedef std::pair uint128_t; +inline uint64_t Uint128Low64(const uint128_t x) { return x.first; } +inline uint64_t Uint128High64(const uint128_t x) { return x.second; } +inline uint128_t Uint128(uint64_t lo, uint64_t hi) { return uint128_t(lo, hi); } +#endif + + +// BASIC STRING HASHING + +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +size_t Hash(const char* s, size_t len); + +// Hash function for a byte array. Most useful in 32-bit binaries. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint32_t Hash32(const char* s, size_t len); + +// Hash function for a byte array. For convenience, a 32-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint32_t Hash32WithSeed(const char* s, size_t len, uint32_t seed); + +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint64_t Hash64(const char* s, size_t len); + +// Hash function for a byte array. For convenience, a 64-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint64_t Hash64WithSeed(const char* s, size_t len, uint64_t seed); + +// Hash function for a byte array. For convenience, two seeds are also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint64_t Hash64WithSeeds(const char* s, size_t len, + uint64_t seed0, uint64_t seed1); + +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint128_t Hash128(const char* s, size_t len); + +// Hash function for a byte array. For convenience, a 128-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint128_t Hash128WithSeed(const char* s, size_t len, uint128_t seed); + +// BASIC NON-STRING HASHING + +// Hash 128 input bits down to 64 bits of output. +// This is intended to be a reasonably good hash function. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +inline uint64_t Hash128to64(uint128_t x) { + // Murmur-inspired hashing. + const uint64_t kMul = 0x9ddfea08eb382d69ULL; + uint64_t a = (Uint128Low64(x) ^ Uint128High64(x)) * kMul; + a ^= (a >> 47); + uint64_t b = (Uint128High64(x) ^ a) * kMul; + b ^= (b >> 47); + b *= kMul; + return b; +} + +// FINGERPRINTING (i.e., good, portable, forever-fixed hash functions) + +// Fingerprint function for a byte array. Most useful in 32-bit binaries. +uint32_t Fingerprint32(const char* s, size_t len); + +// Fingerprint function for a byte array. +uint64_t Fingerprint64(const char* s, size_t len); + +// Fingerprint function for a byte array. +uint128_t Fingerprint128(const char* s, size_t len); + +// This is intended to be a good fingerprinting primitive. +// See below for more overloads. +inline uint64_t Fingerprint(uint128_t x) { + // Murmur-inspired hashing. + const uint64_t kMul = 0x9ddfea08eb382d69ULL; + uint64_t a = (Uint128Low64(x) ^ Uint128High64(x)) * kMul; + a ^= (a >> 47); + uint64_t b = (Uint128High64(x) ^ a) * kMul; + b ^= (b >> 44); + b *= kMul; + b ^= (b >> 41); + b *= kMul; + return b; +} + +// This is intended to be a good fingerprinting primitive. +inline uint64_t Fingerprint(uint64_t x) { + // Murmur-inspired hashing. + const uint64_t kMul = 0x9ddfea08eb382d69ULL; + uint64_t b = x * kMul; + b ^= (b >> 44); + b *= kMul; + b ^= (b >> 41); + b *= kMul; + return b; +} + +#ifndef FARMHASH_NO_CXX_STRING + +// Convenience functions to hash or fingerprint C++ strings. +// These require that Str::data() return a pointer to the first char +// (as a const char*) and that Str::length() return the string's length; +// they work with std::string, for example. + +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +template +inline size_t Hash(const Str& s) { + assert(sizeof(s[0]) == 1); + return Hash(s.data(), s.length()); +} + +// Hash function for a byte array. Most useful in 32-bit binaries. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +template +inline uint32_t Hash32(const Str& s) { + assert(sizeof(s[0]) == 1); + return Hash32(s.data(), s.length()); +} + +// Hash function for a byte array. For convenience, a 32-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +template +inline uint32_t Hash32WithSeed(const Str& s, uint32_t seed) { + assert(sizeof(s[0]) == 1); + return Hash32WithSeed(s.data(), s.length(), seed); +} + +// Hash 128 input bits down to 64 bits of output. +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +template +inline uint64_t Hash64(const Str& s) { + assert(sizeof(s[0]) == 1); + return Hash64(s.data(), s.length()); +} + +// Hash function for a byte array. For convenience, a 64-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +template +inline uint64_t Hash64WithSeed(const Str& s, uint64_t seed) { + assert(sizeof(s[0]) == 1); + return Hash64WithSeed(s.data(), s.length(), seed); +} + +// Hash function for a byte array. For convenience, two seeds are also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +template +inline uint64_t Hash64WithSeeds(const Str& s, uint64_t seed0, uint64_t seed1) { + assert(sizeof(s[0]) == 1); + return Hash64WithSeeds(s.data(), s.length(), seed0, seed1); +} + +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +template +inline uint128_t Hash128(const Str& s) { + assert(sizeof(s[0]) == 1); + return Hash128(s.data(), s.length()); +} + +// Hash function for a byte array. For convenience, a 128-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +template +inline uint128_t Hash128WithSeed(const Str& s, uint128_t seed) { + assert(sizeof(s[0]) == 1); + return Hash128(s.data(), s.length(), seed); +} + +// FINGERPRINTING (i.e., good, portable, forever-fixed hash functions) + +// Fingerprint function for a byte array. Most useful in 32-bit binaries. +template +inline uint32_t Fingerprint32(const Str& s) { + assert(sizeof(s[0]) == 1); + return Fingerprint32(s.data(), s.length()); +} + +// Fingerprint 128 input bits down to 64 bits of output. +// Fingerprint function for a byte array. +template +inline uint64_t Fingerprint64(const Str& s) { + assert(sizeof(s[0]) == 1); + return Fingerprint64(s.data(), s.length()); +} + +// Fingerprint function for a byte array. +template +inline uint128_t Fingerprint128(const Str& s) { + assert(sizeof(s[0]) == 1); + return Fingerprint128(s.data(), s.length()); +} + +#endif + +} // namespace NAMESPACE_FOR_HASH_FUNCTIONS + +/* gently define FARMHASH_BIG_ENDIAN when detected big-endian machine */ +#if defined(__BIG_ENDIAN__) + #if !defined(FARMHASH_BIG_ENDIAN) + #define FARMHASH_BIG_ENDIAN + #endif +#elif defined(__LITTLE_ENDIAN__) + // nothing for little-endian +#elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER == __ORDER_LITTLE_ENDIAN__) + // nothing for little-endian +#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER == __ORDER_BIG_ENDIAN__) + #if !defined(FARMHASH_BIG_ENDIAN) + #define FARMHASH_BIG_ENDIAN + #endif +#elif defined(__linux__) || defined(__CYGWIN__) || defined( __GNUC__ ) && !defined(_WIN32) || defined( __GNU_LIBRARY__ ) + #include // libc6-dev, GLIBC + #if BYTE_ORDER == BIG_ENDIAN + #if !defined(FARMHASH_BIG_ENDIAN) + #define FARMHASH_BIG_ENDIAN + #endif + #endif +#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__s390x__) + #include + #if BYTE_ORDER == BIG_ENDIAN + #if !defined(FARMHASH_BIG_ENDIAN) + #define FARMHASH_BIG_ENDIAN + #endif + #endif +#elif defined(_WIN32) + // Windows is (currently) little-endian +#else + #error "Unable to determine endianness!" +#endif /* __BIG_ENDIAN__ */ + +#endif // FARM_HASH_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/farmhash_gpu_archive/_virtual_includes/farmhash_gpu/third_party/farmhash_gpu/src/farmhash_gpu.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/farmhash_gpu_archive/_virtual_includes/farmhash_gpu/third_party/farmhash_gpu/src/farmhash_gpu.h new file mode 100644 index 0000000000000000000000000000000000000000..f6b2191f4eecf7e96abf53723ef5d68e391c4a17 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/farmhash_gpu_archive/_virtual_includes/farmhash_gpu/third_party/farmhash_gpu/src/farmhash_gpu.h @@ -0,0 +1,11896 @@ +// Copyright (c) 2014 Google, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// FarmHash, by Geoff Pike + +#ifndef FARM_HASH_GPU_H_ +#define FARM_HASH_GPU_H_ + +#include +#include // for memcpy and memset + +#define NAMESPACE_FOR_HASH_FUNCTIONS_GPU util_gpu +#define DEVICE_MODIFIER __device__ __host__ + +// We use DEVICE_MODIFIER to remove those code unused by GPUs. +#ifndef DEVICE_MODIFIER +#include "farmhash.h" +// FARMHASH ASSUMPTIONS: Modify as needed, or use -DFARMHASH_ASSUME_SSE42 etc. +// Note that if you use -DFARMHASH_ASSUME_SSE42 you likely need -msse42 +// (or its equivalent for your compiler); if you use -DFARMHASH_ASSUME_AESNI +// you likely need -maes (or its equivalent for your compiler). + +#ifdef FARMHASH_ASSUME_SSSE3 +#undef FARMHASH_ASSUME_SSSE3 +#define FARMHASH_ASSUME_SSSE3 1 +#endif + +#ifdef FARMHASH_ASSUME_SSE41 +#undef FARMHASH_ASSUME_SSE41 +#define FARMHASH_ASSUME_SSE41 1 +#endif + +#ifdef FARMHASH_ASSUME_SSE42 +#undef FARMHASH_ASSUME_SSE42 +#define FARMHASH_ASSUME_SSE42 1 +#endif + +#ifdef FARMHASH_ASSUME_AESNI +#undef FARMHASH_ASSUME_AESNI +#define FARMHASH_ASSUME_AESNI 1 +#endif + +#ifdef FARMHASH_ASSUME_AVX +#undef FARMHASH_ASSUME_AVX +#define FARMHASH_ASSUME_AVX 1 +#endif + +#if !defined(FARMHASH_CAN_USE_CXX11) && defined(LANG_CXX11) +#define FARMHASH_CAN_USE_CXX11 1 +#else +#undef FARMHASH_CAN_USE_CXX11 +#define FARMHASH_CAN_USE_CXX11 0 +#endif + +// FARMHASH PORTABILITY LAYER: Runtime error if misconfigured + +#ifndef FARMHASH_DIE_IF_MISCONFIGURED +#define FARMHASH_DIE_IF_MISCONFIGURED do { *(char*)(len % 17) = 0; } while (0) +#endif + +// FARMHASH PORTABILITY LAYER: "static inline" or similar + +#ifndef STATIC_INLINE +#define STATIC_INLINE static inline +#endif + +// FARMHASH PORTABILITY LAYER: LIKELY and UNLIKELY + +#if !defined(LIKELY) +#if defined(FARMHASH_NO_BUILTIN_EXPECT) || (defined(FARMHASH_OPTIONAL_BUILTIN_EXPECT) && !defined(HAVE_BUILTIN_EXPECT)) +#define LIKELY(x) (x) +#else +#define LIKELY(x) (__builtin_expect(!!(x), 1)) +#endif +#endif + +#undef UNLIKELY +#define UNLIKELY(x) !LIKELY(!(x)) + +// FARMHASH PORTABILITY LAYER: endianness and byteswapping functions + +#ifdef WORDS_BIGENDIAN +#undef FARMHASH_BIG_ENDIAN +#define FARMHASH_BIG_ENDIAN 1 +#endif + +#if defined(FARMHASH_LITTLE_ENDIAN) && defined(FARMHASH_BIG_ENDIAN) +#error +#endif + +#if !defined(FARMHASH_LITTLE_ENDIAN) && !defined(FARMHASH_BIG_ENDIAN) +#define FARMHASH_UNKNOWN_ENDIAN 1 +#endif + +#if !defined(bswap_32) || !defined(bswap_64) +#undef bswap_32 +#undef bswap_64 + +#if defined(HAVE_BUILTIN_BSWAP) || defined(__clang__) || \ + (defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || \ + __GNUC__ >= 5)) +// Easy case for bswap: no header file needed. +#define bswap_32(x) __builtin_bswap32(x) +#define bswap_64(x) __builtin_bswap64(x) +#endif + +#endif + +#if defined(FARMHASH_UNKNOWN_ENDIAN) || !defined(bswap_64) + +#ifdef _WIN32 + +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) _byteswap_ulong(x) +#define bswap_64(x) _byteswap_uint64(x) + +#elif defined(__APPLE__) + +// Mac OS X / Darwin features +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) OSSwapInt32(x) +#define bswap_64(x) OSSwapInt64(x) + +#elif defined(__sun) || defined(sun) + +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) BSWAP_32(x) +#define bswap_64(x) BSWAP_64(x) + +#elif defined(__FreeBSD__) || defined(__DragonFly__) + +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) + +#elif defined(__OpenBSD__) + +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) swap32(x) +#define bswap_64(x) swap64(x) + +#elif defined(__NetBSD__) + +#include +#include +#if defined(__BSWAP_RENAME) && !defined(__bswap_32) +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) +#endif + +#elif defined(__HAIKU__) + +#define _BSD_SOURCE +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) + +#else + +#undef bswap_32 +#undef bswap_64 +#undef _BYTESWAP_H +#include + +#endif + +#ifdef WORDS_BIGENDIAN +#define FARMHASH_BIG_ENDIAN 1 +#endif + +#endif + +#ifdef FARMHASH_BIG_ENDIAN +#define uint32_in_expected_order(x) (bswap_32(x)) +#define uint64_in_expected_order(x) (bswap_64(x)) +#else +#define uint32_in_expected_order(x) (x) +#define uint64_in_expected_order(x) (x) +#endif + +#endif // DEVICE_MODIFIER + +#define uint32_in_expected_order(x) (x) +#define uint64_in_expected_order(x) (x) + +#define STATIC_INLINE DEVICE_MODIFIER inline + +namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU { + +STATIC_INLINE uint64_t Fetch64(const char *p) { + uint64_t result; + memcpy(&result, p, sizeof(result)); + return uint64_in_expected_order(result); +} + +STATIC_INLINE uint32_t Fetch32(const char *p) { + uint32_t result; + memcpy(&result, p, sizeof(result)); + return uint32_in_expected_order(result); +} + +#ifndef DEVICE_MODIFIER +STATIC_INLINE uint32_t Bswap32(uint32_t val) { return bswap_32(val); } +STATIC_INLINE uint64_t Bswap64(uint64_t val) { return bswap_64(val); } + +// FARMHASH PORTABILITY LAYER: bitwise rot + +STATIC_INLINE uint32_t BasicRotate32(uint32_t val, int shift) { + // Avoid shifting by 32: doing so yields an undefined result. + return shift == 0 ? val : ((val >> shift) | (val << (32 - shift))); +} +#endif // DEVICE_MODIFIER + +STATIC_INLINE uint64_t BasicRotate64(uint64_t val, int shift) { + // Avoid shifting by 64: doing so yields an undefined result. + return shift == 0 ? val : ((val >> shift) | (val << (64 - shift))); +} + +#ifndef DEVICE_MODIFIER +#if defined(_WIN32) && defined(FARMHASH_ROTR) + +STATIC_INLINE uint32_t Rotate32(uint32_t val, int shift) { + return sizeof(unsigned long) == sizeof(val) ? + _lrotr(val, shift) : + BasicRotate32(val, shift); +} + +STATIC_INLINE uint64_t Rotate64(uint64_t val, int shift) { + return sizeof(unsigned long) == sizeof(val) ? + _lrotr(val, shift) : + BasicRotate64(val, shift); +} + +#else + +STATIC_INLINE uint32_t Rotate32(uint32_t val, int shift) { + return BasicRotate32(val, shift); +} +STATIC_INLINE uint64_t Rotate64(uint64_t val, int shift) { + return BasicRotate64(val, shift); +} + +#endif +#endif // DEVICE_MODIFIER + +STATIC_INLINE uint64_t Rotate64(uint64_t val, int shift) { + return BasicRotate64(val, shift); +} + +} // namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU + +// FARMHASH PORTABILITY LAYER: debug mode or max speed? +// One may use -DFARMHASH_DEBUG=1 or -DFARMHASH_DEBUG=0 to force the issue. + +#ifndef DEVICE_MODIFIER +#if !defined(FARMHASH_DEBUG) && (!defined(NDEBUG) || defined(_DEBUG)) +#define FARMHASH_DEBUG 1 +#endif + +#undef debug_mode +#if FARMHASH_DEBUG +#define debug_mode 1 +#else +#define debug_mode 0 +#endif + +// PLATFORM-SPECIFIC FUNCTIONS AND MACROS + +#undef x86_64 +#if defined (__x86_64) || defined (__x86_64__) +#define x86_64 1 +#else +#define x86_64 0 +#endif + +#undef x86 +#if defined(__i386__) || defined(__i386) || defined(__X86__) +#define x86 1 +#else +#define x86 x86_64 +#endif + +#if !defined(is_64bit) +#define is_64bit (x86_64 || (sizeof(void*) == 8)) +#endif + +#undef can_use_ssse3 +#if defined(__SSSE3__) || defined(FARMHASH_ASSUME_SSSE3) + +#include +#define can_use_ssse3 1 +// Now we can use _mm_hsub_epi16 and so on. + +#else +#define can_use_ssse3 0 +#endif + +#undef can_use_sse41 +#if defined(__SSE4_1__) || defined(FARMHASH_ASSUME_SSE41) + +#include +#define can_use_sse41 1 +// Now we can use _mm_insert_epi64 and so on. + +#else +#define can_use_sse41 0 +#endif + +#undef can_use_sse42 +#if defined(__SSE4_2__) || defined(FARMHASH_ASSUME_SSE42) + +#include +#define can_use_sse42 1 +// Now we can use _mm_crc32_u{32,16,8}. And on 64-bit platforms, _mm_crc32_u64. + +#else +#define can_use_sse42 0 +#endif + +#undef can_use_aesni +#if defined(__AES__) || defined(FARMHASH_ASSUME_AESNI) + +#include +#define can_use_aesni 1 +// Now we can use _mm_aesimc_si128 and so on. + +#else +#define can_use_aesni 0 +#endif + +#undef can_use_avx +#if defined(__AVX__) || defined(FARMHASH_ASSUME_AVX) + +#include +#define can_use_avx 1 + +#else +#define can_use_avx 0 +#endif + +#if can_use_ssse3 || can_use_sse41 || can_use_sse42 || can_use_aesni || can_use_avx +STATIC_INLINE __m128i Fetch128(const char* s) { + return _mm_loadu_si128(reinterpret_cast(s)); +} +#endif +// Building blocks for hash functions + +// std::swap() was in but is in from C++11 on. +#if !FARMHASH_CAN_USE_CXX11 +#include +#endif + +#undef PERMUTE3 +#define PERMUTE3(a, b, c) do { std::swap(a, b); std::swap(a, c); } while (0) +#endif // DEVICE_MODIFIER + +struct Pair { + uint64_t first; + uint64_t second; +}; + +namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU { + +// Some primes between 2^63 and 2^64 for various uses. +static const uint64_t k0 = 0xc3a5c85c97cb3127ULL; +static const uint64_t k1 = 0xb492b66fbe98f273ULL; +static const uint64_t k2 = 0x9ae16a3b2f90404fULL; + +#ifndef DEVICE_MODIFIER +// Magic numbers for 32-bit hashing. Copied from Murmur3. +static const uint32_t c1 = 0xcc9e2d51; +static const uint32_t c2 = 0x1b873593; + +// A 32-bit to 32-bit integer hash copied from Murmur3. +STATIC_INLINE uint32_t fmix(uint32_t h) +{ + h ^= h >> 16; + h *= 0x85ebca6b; + h ^= h >> 13; + h *= 0xc2b2ae35; + h ^= h >> 16; + return h; +} + +STATIC_INLINE uint32_t Mur(uint32_t a, uint32_t h) { + // Helper from Murmur3 for combining two 32-bit values. + a *= c1; + a = Rotate32(a, 17); + a *= c2; + h ^= a; + h = Rotate32(h, 19); + return h * 5 + 0xe6546b64; +} + +template STATIC_INLINE T DebugTweak(T x) { + if (debug_mode) { + if (sizeof(x) == 4) { + x = ~Bswap32(x * c1); + } else { + x = ~Bswap64(x * k1); + } + } + return x; +} + +template <> uint128_t DebugTweak(uint128_t x) { + if (debug_mode) { + uint64_t y = DebugTweak(Uint128Low64(x)); + uint64_t z = DebugTweak(Uint128High64(x)); + y += z; + z += y; + x = Uint128(y, z * k1); + } + return x; +} +#endif // DEVICE_MODIFIER +} // namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU + +#ifndef DEVICE_MODIFIER +using namespace std; +#endif // DEVICE_MODIFIER +using namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU; +namespace farmhashna_gpu { +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +#ifndef DEVICE_MODIFIER +#undef Bswap +#define Bswap Bswap64 +#endif // DEVICE_MODIFIER + +STATIC_INLINE uint64_t ShiftMix(uint64_t val) { + return val ^ (val >> 47); +} + +#ifndef DEVICE_MODIFIER +STATIC_INLINE uint64_t HashLen16(uint64_t u, uint64_t v) { + return Hash128to64(Uint128(u, v)); +} +#endif // DEVICE_MODIFIER + +STATIC_INLINE uint64_t HashLen16(uint64_t u, uint64_t v, uint64_t mul) { + // Murmur-inspired hashing. + uint64_t a = (u ^ v) * mul; + a ^= (a >> 47); + uint64_t b = (v ^ a) * mul; + b ^= (b >> 47); + b *= mul; + return b; +} + +STATIC_INLINE uint64_t HashLen0to16(const char *s, size_t len) { + if (len >= 8) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch(s) + k2; + uint64_t b = Fetch(s + len - 8); + uint64_t c = Rotate(b, 37) * mul + a; + uint64_t d = (Rotate(a, 25) + b) * mul; + return HashLen16(c, d, mul); + } + if (len >= 4) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch32(s); + return HashLen16(len + (a << 3), Fetch32(s + len - 4), mul); + } + if (len > 0) { + uint8_t a = s[0]; + uint8_t b = s[len >> 1]; + uint8_t c = s[len - 1]; + uint32_t y = static_cast(a) + (static_cast(b) << 8); + uint32_t z = len + (static_cast(c) << 2); + return ShiftMix(y * k2 ^ z * k0) * k2; + } + return k2; +} + +// This probably works well for 16-byte strings as well, but it may be overkill +// in that case. +STATIC_INLINE uint64_t HashLen17to32(const char *s, size_t len) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch(s) * k1; + uint64_t b = Fetch(s + 8); + uint64_t c = Fetch(s + len - 8) * mul; + uint64_t d = Fetch(s + len - 16) * k2; + return HashLen16(Rotate(a + b, 43) + Rotate(c, 30) + d, + a + Rotate(b + k2, 18) + c, mul); +} + +// Return a 16-byte hash for 48 bytes. Quick and dirty. +// Callers do best to use "random-looking" values for a and b. +STATIC_INLINE Pair WeakHashLen32WithSeeds( + uint64_t w, uint64_t x, uint64_t y, uint64_t z, uint64_t a, uint64_t b) { + a += w; + b = Rotate(b + a + z, 21); + uint64_t c = a; + a += x; + a += y; + b += Rotate(a, 44); + return Pair{a + z, b + c}; +} + +// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. +STATIC_INLINE Pair WeakHashLen32WithSeeds( + const char* s, uint64_t a, uint64_t b) { + return WeakHashLen32WithSeeds(Fetch(s), + Fetch(s + 8), + Fetch(s + 16), + Fetch(s + 24), + a, + b); +} + +// Return an 8-byte hash for 33 to 64 bytes. +STATIC_INLINE uint64_t HashLen33to64(const char *s, size_t len) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch(s) * k2; + uint64_t b = Fetch(s + 8); + uint64_t c = Fetch(s + len - 8) * mul; + uint64_t d = Fetch(s + len - 16) * k2; + uint64_t y = Rotate(a + b, 43) + Rotate(c, 30) + d; + uint64_t z = HashLen16(y, a + Rotate(b + k2, 18) + c, mul); + uint64_t e = Fetch(s + 16) * mul; + uint64_t f = Fetch(s + 24); + uint64_t g = (y + Fetch(s + len - 32)) * mul; + uint64_t h = (z + Fetch(s + len - 24)) * mul; + return HashLen16(Rotate(e + f, 43) + Rotate(g, 30) + h, + e + Rotate(f + a, 18) + g, mul); +} + +DEVICE_MODIFIER uint64_t Hash64(const char *s, size_t len) { + const uint64_t seed = 81; + if (len <= 32) { + if (len <= 16) { + return HashLen0to16(s, len); + } else { + return HashLen17to32(s, len); + } + } else if (len <= 64) { + return HashLen33to64(s, len); + } + + // For strings over 64 bytes we loop. Internal state consists of + // 56 bytes: v, w, x, y, and z. + uint64_t x = seed; + uint64_t y = seed * k1 + 113; + uint64_t z = ShiftMix(y * k2 + 113) * k2; + Pair v = {0, 0}; + Pair w = {0, 0}; + x = x * k2 + Fetch(s); + + // Set end so that after the loop we have 1 to 64 bytes left to process. + const char* end = s + ((len - 1) / 64) * 64; + const char* last64 = end + ((len - 1) & 63) - 63; + assert(s + len - 64 == last64); + do { + x = Rotate(x + y + v.first + Fetch(s + 8), 37) * k1; + y = Rotate(y + v.second + Fetch(s + 48), 42) * k1; + x ^= w.second; + y += v.first + Fetch(s + 40); + z = Rotate(z + w.first, 33) * k1; + v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first); + w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + auto tmp = z; + z = x; + x = tmp; + s += 64; + } while (s != end); + uint64_t mul = k1 + ((z & 0xff) << 1); + // Make s point to the last 64 bytes of input. + s = last64; + w.first += ((len - 1) & 63); + v.first += w.first; + w.first += v.first; + x = Rotate(x + y + v.first + Fetch(s + 8), 37) * mul; + y = Rotate(y + v.second + Fetch(s + 48), 42) * mul; + x ^= w.second * 9; + y += v.first * 9 + Fetch(s + 40); + z = Rotate(z + w.first, 33) * mul; + v = WeakHashLen32WithSeeds(s, v.second * mul, x + w.first); + w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + auto tmp = z; + z = x; + x = tmp; + return HashLen16(HashLen16(v.first, w.first, mul) + ShiftMix(y) * k0 + z, + HashLen16(v.second, w.second, mul) + x, + mul); +} + +#ifndef DEVICE_MODIFIER +uint64_t Hash64WithSeeds(const char *s, size_t len, uint64_t seed0, uint64_t seed1); + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + return Hash64WithSeeds(s, len, k2, seed); +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, uint64_t seed0, uint64_t seed1) { + return HashLen16(Hash64(s, len) - seed0, seed1); +} +#endif // DEVICE_MODIFIER +} // namespace farmhashna_gpu +#ifndef DEVICE_MODIFIER +namespace farmhashuo { +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +STATIC_INLINE uint64_t H(uint64_t x, uint64_t y, uint64_t mul, int r) { + uint64_t a = (x ^ y) * mul; + a ^= (a >> 47); + uint64_t b = (y ^ a) * mul; + return Rotate(b, r) * mul; +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, + uint64_t seed0, uint64_t seed1) { + if (len <= 64) { + return farmhashna::Hash64WithSeeds(s, len, seed0, seed1); + } + + // For strings over 64 bytes we loop. Internal state consists of + // 64 bytes: u, v, w, x, y, and z. + uint64_t x = seed0; + uint64_t y = seed1 * k2 + 113; + uint64_t z = farmhashna::ShiftMix(y * k2) * k2; + pair v = make_pair(seed0, seed1); + pair w = make_pair(0, 0); + uint64_t u = x - z; + x *= k2; + uint64_t mul = k2 + (u & 0x82); + + // Set end so that after the loop we have 1 to 64 bytes left to process. + const char* end = s + ((len - 1) / 64) * 64; + const char* last64 = end + ((len - 1) & 63) - 63; + assert(s + len - 64 == last64); + do { + uint64_t a0 = Fetch(s); + uint64_t a1 = Fetch(s + 8); + uint64_t a2 = Fetch(s + 16); + uint64_t a3 = Fetch(s + 24); + uint64_t a4 = Fetch(s + 32); + uint64_t a5 = Fetch(s + 40); + uint64_t a6 = Fetch(s + 48); + uint64_t a7 = Fetch(s + 56); + x += a0 + a1; + y += a2; + z += a3; + v.first += a4; + v.second += a5 + a1; + w.first += a6; + w.second += a7; + + x = Rotate(x, 26); + x *= 9; + y = Rotate(y, 29); + z *= mul; + v.first = Rotate(v.first, 33); + v.second = Rotate(v.second, 30); + w.first ^= x; + w.first *= 9; + z = Rotate(z, 32); + z += w.second; + w.second += z; + z *= 9; + std::swap(u, y); + + z += a0 + a6; + v.first += a2; + v.second += a3; + w.first += a4; + w.second += a5 + a6; + x += a1; + y += a7; + + y += v.first; + v.first += x - y; + v.second += w.first; + w.first += v.second; + w.second += x - y; + x += w.second; + w.second = Rotate(w.second, 34); + std::swap(u, z); + s += 64; + } while (s != end); + // Make s point to the last 64 bytes of input. + s = last64; + u *= 9; + v.second = Rotate(v.second, 28); + v.first = Rotate(v.first, 20); + w.first += ((len - 1) & 63); + u += y; + y += u; + x = Rotate(y - x + v.first + Fetch(s + 8), 37) * mul; + y = Rotate(y ^ v.second ^ Fetch(s + 48), 42) * mul; + x ^= w.second * 9; + y += v.first + Fetch(s + 40); + z = Rotate(z + w.first, 33) * mul; + v = farmhashna::WeakHashLen32WithSeeds(s, v.second * mul, x + w.first); + w = farmhashna::WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + return H(farmhashna::HashLen16(v.first + x, w.first ^ y, mul) + z - u, + H(v.second + y, w.second + z, k2, 30) ^ x, + k2, + 31); +} + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + return len <= 64 ? farmhashna::Hash64WithSeed(s, len, seed) : + Hash64WithSeeds(s, len, 0, seed); +} + +uint64_t Hash64(const char *s, size_t len) { + return len <= 64 ? farmhashna::Hash64(s, len) : + Hash64WithSeeds(s, len, 81, 0); +} +} // namespace farmhashuo +namespace farmhashxo { +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +STATIC_INLINE uint64_t H32(const char *s, size_t len, uint64_t mul, + uint64_t seed0 = 0, uint64_t seed1 = 0) { + uint64_t a = Fetch(s) * k1; + uint64_t b = Fetch(s + 8); + uint64_t c = Fetch(s + len - 8) * mul; + uint64_t d = Fetch(s + len - 16) * k2; + uint64_t u = Rotate(a + b, 43) + Rotate(c, 30) + d + seed0; + uint64_t v = a + Rotate(b + k2, 18) + c + seed1; + a = farmhashna::ShiftMix((u ^ v) * mul); + b = farmhashna::ShiftMix((v ^ a) * mul); + return b; +} + +// Return an 8-byte hash for 33 to 64 bytes. +STATIC_INLINE uint64_t HashLen33to64(const char *s, size_t len) { + uint64_t mul0 = k2 - 30; + uint64_t mul1 = k2 - 30 + 2 * len; + uint64_t h0 = H32(s, 32, mul0); + uint64_t h1 = H32(s + len - 32, 32, mul1); + return ((h1 * mul1) + h0) * mul1; +} + +// Return an 8-byte hash for 65 to 96 bytes. +STATIC_INLINE uint64_t HashLen65to96(const char *s, size_t len) { + uint64_t mul0 = k2 - 114; + uint64_t mul1 = k2 - 114 + 2 * len; + uint64_t h0 = H32(s, 32, mul0); + uint64_t h1 = H32(s + 32, 32, mul1); + uint64_t h2 = H32(s + len - 32, 32, mul1, h0, h1); + return (h2 * 9 + (h0 >> 17) + (h1 >> 21)) * mul1; +} + +uint64_t Hash64(const char *s, size_t len) { + if (len <= 32) { + if (len <= 16) { + return farmhashna::HashLen0to16(s, len); + } else { + return farmhashna::HashLen17to32(s, len); + } + } else if (len <= 64) { + return HashLen33to64(s, len); + } else if (len <= 96) { + return HashLen65to96(s, len); + } else if (len <= 256) { + return farmhashna::Hash64(s, len); + } else { + return farmhashuo::Hash64(s, len); + } +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, uint64_t seed0, uint64_t seed1) { + return farmhashuo::Hash64WithSeeds(s, len, seed0, seed1); +} + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + return farmhashuo::Hash64WithSeed(s, len, seed); +} +} // namespace farmhashxo +namespace farmhashte { +#if !can_use_sse41 || !x86_64 + +uint64_t Hash64(const char *s, size_t len) { + FARMHASH_DIE_IF_MISCONFIGURED; + return s == NULL ? 0 : len; +} + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed + Hash64(s, len); +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, + uint64_t seed0, uint64_t seed1) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed0 + seed1 + Hash64(s, len); +} + +#else + +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +#undef Bswap +#define Bswap Bswap64 + +// Helpers for data-parallel operations (1x 128 bits or 2x 64 or 4x 32). +STATIC_INLINE __m128i Add(__m128i x, __m128i y) { return _mm_add_epi64(x, y); } +STATIC_INLINE __m128i Xor(__m128i x, __m128i y) { return _mm_xor_si128(x, y); } +STATIC_INLINE __m128i Mul(__m128i x, __m128i y) { return _mm_mullo_epi32(x, y); } +STATIC_INLINE __m128i Shuf(__m128i x, __m128i y) { return _mm_shuffle_epi8(y, x); } + +// Requires n >= 256. Requires SSE4.1. Should be slightly faster if the +// compiler uses AVX instructions (e.g., use the -mavx flag with GCC). +STATIC_INLINE uint64_t Hash64Long(const char* s, size_t n, + uint64_t seed0, uint64_t seed1) { + const __m128i kShuf = + _mm_set_epi8(4, 11, 10, 5, 8, 15, 6, 9, 12, 2, 14, 13, 0, 7, 3, 1); + const __m128i kMult = + _mm_set_epi8(0xbd, 0xd6, 0x33, 0x39, 0x45, 0x54, 0xfa, 0x03, + 0x34, 0x3e, 0x33, 0xed, 0xcc, 0x9e, 0x2d, 0x51); + uint64_t seed2 = (seed0 + 113) * (seed1 + 9); + uint64_t seed3 = (Rotate(seed0, 23) + 27) * (Rotate(seed1, 30) + 111); + __m128i d0 = _mm_cvtsi64_si128(seed0); + __m128i d1 = _mm_cvtsi64_si128(seed1); + __m128i d2 = Shuf(kShuf, d0); + __m128i d3 = Shuf(kShuf, d1); + __m128i d4 = Xor(d0, d1); + __m128i d5 = Xor(d1, d2); + __m128i d6 = Xor(d2, d4); + __m128i d7 = _mm_set1_epi32(seed2 >> 32); + __m128i d8 = Mul(kMult, d2); + __m128i d9 = _mm_set1_epi32(seed3 >> 32); + __m128i d10 = _mm_set1_epi32(seed3); + __m128i d11 = Add(d2, _mm_set1_epi32(seed2)); + const char* end = s + (n & ~static_cast(255)); + do { + __m128i z; + z = Fetch128(s); + d0 = Add(d0, z); + d1 = Shuf(kShuf, d1); + d2 = Xor(d2, d0); + d4 = Xor(d4, z); + d4 = Xor(d4, d1); + std::swap(d0, d6); + z = Fetch128(s + 16); + d5 = Add(d5, z); + d6 = Shuf(kShuf, d6); + d8 = Shuf(kShuf, d8); + d7 = Xor(d7, d5); + d0 = Xor(d0, z); + d0 = Xor(d0, d6); + std::swap(d5, d11); + z = Fetch128(s + 32); + d1 = Add(d1, z); + d2 = Shuf(kShuf, d2); + d4 = Shuf(kShuf, d4); + d5 = Xor(d5, z); + d5 = Xor(d5, d2); + std::swap(d10, d4); + z = Fetch128(s + 48); + d6 = Add(d6, z); + d7 = Shuf(kShuf, d7); + d0 = Shuf(kShuf, d0); + d8 = Xor(d8, d6); + d1 = Xor(d1, z); + d1 = Add(d1, d7); + z = Fetch128(s + 64); + d2 = Add(d2, z); + d5 = Shuf(kShuf, d5); + d4 = Add(d4, d2); + d6 = Xor(d6, z); + d6 = Xor(d6, d11); + std::swap(d8, d2); + z = Fetch128(s + 80); + d7 = Xor(d7, z); + d8 = Shuf(kShuf, d8); + d1 = Shuf(kShuf, d1); + d0 = Add(d0, d7); + d2 = Add(d2, z); + d2 = Add(d2, d8); + std::swap(d1, d7); + z = Fetch128(s + 96); + d4 = Shuf(kShuf, d4); + d6 = Shuf(kShuf, d6); + d8 = Mul(kMult, d8); + d5 = Xor(d5, d11); + d7 = Xor(d7, z); + d7 = Add(d7, d4); + std::swap(d6, d0); + z = Fetch128(s + 112); + d8 = Add(d8, z); + d0 = Shuf(kShuf, d0); + d2 = Shuf(kShuf, d2); + d1 = Xor(d1, d8); + d10 = Xor(d10, z); + d10 = Xor(d10, d0); + std::swap(d11, d5); + z = Fetch128(s + 128); + d4 = Add(d4, z); + d5 = Shuf(kShuf, d5); + d7 = Shuf(kShuf, d7); + d6 = Add(d6, d4); + d8 = Xor(d8, z); + d8 = Xor(d8, d5); + std::swap(d4, d10); + z = Fetch128(s + 144); + d0 = Add(d0, z); + d1 = Shuf(kShuf, d1); + d2 = Add(d2, d0); + d4 = Xor(d4, z); + d4 = Xor(d4, d1); + z = Fetch128(s + 160); + d5 = Add(d5, z); + d6 = Shuf(kShuf, d6); + d8 = Shuf(kShuf, d8); + d7 = Xor(d7, d5); + d0 = Xor(d0, z); + d0 = Xor(d0, d6); + std::swap(d2, d8); + z = Fetch128(s + 176); + d1 = Add(d1, z); + d2 = Shuf(kShuf, d2); + d4 = Shuf(kShuf, d4); + d5 = Mul(kMult, d5); + d5 = Xor(d5, z); + d5 = Xor(d5, d2); + std::swap(d7, d1); + z = Fetch128(s + 192); + d6 = Add(d6, z); + d7 = Shuf(kShuf, d7); + d0 = Shuf(kShuf, d0); + d8 = Add(d8, d6); + d1 = Xor(d1, z); + d1 = Xor(d1, d7); + std::swap(d0, d6); + z = Fetch128(s + 208); + d2 = Add(d2, z); + d5 = Shuf(kShuf, d5); + d4 = Xor(d4, d2); + d6 = Xor(d6, z); + d6 = Xor(d6, d9); + std::swap(d5, d11); + z = Fetch128(s + 224); + d7 = Add(d7, z); + d8 = Shuf(kShuf, d8); + d1 = Shuf(kShuf, d1); + d0 = Xor(d0, d7); + d2 = Xor(d2, z); + d2 = Xor(d2, d8); + std::swap(d10, d4); + z = Fetch128(s + 240); + d3 = Add(d3, z); + d4 = Shuf(kShuf, d4); + d6 = Shuf(kShuf, d6); + d7 = Mul(kMult, d7); + d5 = Add(d5, d3); + d7 = Xor(d7, z); + d7 = Xor(d7, d4); + std::swap(d3, d9); + s += 256; + } while (s != end); + d6 = Add(Mul(kMult, d6), _mm_cvtsi64_si128(n)); + if (n % 256 != 0) { + d7 = Add(_mm_shuffle_epi32(d8, (0 << 6) + (3 << 4) + (2 << 2) + (1 << 0)), d7); + d8 = Add(Mul(kMult, d8), _mm_cvtsi64_si128(farmhashxo::Hash64(s, n % 256))); + } + __m128i t[8]; + d0 = Mul(kMult, Shuf(kShuf, Mul(kMult, d0))); + d3 = Mul(kMult, Shuf(kShuf, Mul(kMult, d3))); + d9 = Mul(kMult, Shuf(kShuf, Mul(kMult, d9))); + d1 = Mul(kMult, Shuf(kShuf, Mul(kMult, d1))); + d0 = Add(d11, d0); + d3 = Xor(d7, d3); + d9 = Add(d8, d9); + d1 = Add(d10, d1); + d4 = Add(d3, d4); + d5 = Add(d9, d5); + d6 = Xor(d1, d6); + d2 = Add(d0, d2); + t[0] = d0; + t[1] = d3; + t[2] = d9; + t[3] = d1; + t[4] = d4; + t[5] = d5; + t[6] = d6; + t[7] = d2; + return farmhashxo::Hash64(reinterpret_cast(t), sizeof(t)); +} + +uint64_t Hash64(const char *s, size_t len) { + // Empirically, farmhashxo seems faster until length 512. + return len >= 512 ? Hash64Long(s, len, k2, k1) : farmhashxo::Hash64(s, len); +} + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + return len >= 512 ? Hash64Long(s, len, k1, seed) : + farmhashxo::Hash64WithSeed(s, len, seed); +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, uint64_t seed0, uint64_t seed1) { + return len >= 512 ? Hash64Long(s, len, seed0, seed1) : + farmhashxo::Hash64WithSeeds(s, len, seed0, seed1); +} + +#endif +} // namespace farmhashte +namespace farmhashnt { +#if !can_use_sse41 || !x86_64 + +uint32_t Hash32(const char *s, size_t len) { + FARMHASH_DIE_IF_MISCONFIGURED; + return s == NULL ? 0 : len; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed + Hash32(s, len); +} + +#else + +uint32_t Hash32(const char *s, size_t len) { + return static_cast(farmhashte::Hash64(s, len)); +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + return static_cast(farmhashte::Hash64WithSeed(s, len, seed)); +} + +#endif +} // namespace farmhashnt +namespace farmhashmk { +#undef Fetch +#define Fetch Fetch32 + +#undef Rotate +#define Rotate Rotate32 + +#undef Bswap +#define Bswap Bswap32 + +STATIC_INLINE uint32_t Hash32Len13to24(const char *s, size_t len, uint32_t seed = 0) { + uint32_t a = Fetch(s - 4 + (len >> 1)); + uint32_t b = Fetch(s + 4); + uint32_t c = Fetch(s + len - 8); + uint32_t d = Fetch(s + (len >> 1)); + uint32_t e = Fetch(s); + uint32_t f = Fetch(s + len - 4); + uint32_t h = d * c1 + len + seed; + a = Rotate(a, 12) + f; + h = Mur(c, h) + a; + a = Rotate(a, 3) + c; + h = Mur(e, h) + a; + a = Rotate(a + f, 12) + d; + h = Mur(b ^ seed, h) + a; + return fmix(h); +} + +STATIC_INLINE uint32_t Hash32Len0to4(const char *s, size_t len, uint32_t seed = 0) { + uint32_t b = seed; + uint32_t c = 9; + for (size_t i = 0; i < len; i++) { + signed char v = s[i]; + b = b * c1 + v; + c ^= b; + } + return fmix(Mur(b, Mur(len, c))); +} + +STATIC_INLINE uint32_t Hash32Len5to12(const char *s, size_t len, uint32_t seed = 0) { + uint32_t a = len, b = len * 5, c = 9, d = b + seed; + a += Fetch(s); + b += Fetch(s + len - 4); + c += Fetch(s + ((len >> 1) & 4)); + return fmix(seed ^ Mur(c, Mur(b, Mur(a, d)))); +} + +uint32_t Hash32(const char *s, size_t len) { + if (len <= 24) { + return len <= 12 ? + (len <= 4 ? Hash32Len0to4(s, len) : Hash32Len5to12(s, len)) : + Hash32Len13to24(s, len); + } + + // len > 24 + uint32_t h = len, g = c1 * len, f = g; + uint32_t a0 = Rotate(Fetch(s + len - 4) * c1, 17) * c2; + uint32_t a1 = Rotate(Fetch(s + len - 8) * c1, 17) * c2; + uint32_t a2 = Rotate(Fetch(s + len - 16) * c1, 17) * c2; + uint32_t a3 = Rotate(Fetch(s + len - 12) * c1, 17) * c2; + uint32_t a4 = Rotate(Fetch(s + len - 20) * c1, 17) * c2; + h ^= a0; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + h ^= a2; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + g ^= a1; + g = Rotate(g, 19); + g = g * 5 + 0xe6546b64; + g ^= a3; + g = Rotate(g, 19); + g = g * 5 + 0xe6546b64; + f += a4; + f = Rotate(f, 19) + 113; + size_t iters = (len - 1) / 20; + do { + uint32_t a = Fetch(s); + uint32_t b = Fetch(s + 4); + uint32_t c = Fetch(s + 8); + uint32_t d = Fetch(s + 12); + uint32_t e = Fetch(s + 16); + h += a; + g += b; + f += c; + h = Mur(d, h) + e; + g = Mur(c, g) + a; + f = Mur(b + e * c1, f) + d; + f += g; + g += f; + s += 20; + } while (--iters != 0); + g = Rotate(g, 11) * c1; + g = Rotate(g, 17) * c1; + f = Rotate(f, 11) * c1; + f = Rotate(f, 17) * c1; + h = Rotate(h + g, 19); + h = h * 5 + 0xe6546b64; + h = Rotate(h, 17) * c1; + h = Rotate(h + f, 19); + h = h * 5 + 0xe6546b64; + h = Rotate(h, 17) * c1; + return h; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + if (len <= 24) { + if (len >= 13) return Hash32Len13to24(s, len, seed * c1); + else if (len >= 5) return Hash32Len5to12(s, len, seed); + else return Hash32Len0to4(s, len, seed); + } + uint32_t h = Hash32Len13to24(s, 24, seed ^ len); + return Mur(Hash32(s + 24, len - 24) + seed, h); +} +} // namespace farmhashmk +namespace farmhashsu { +#if !can_use_sse42 || !can_use_aesni + +uint32_t Hash32(const char *s, size_t len) { + FARMHASH_DIE_IF_MISCONFIGURED; + return s == NULL ? 0 : len; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed + Hash32(s, len); +} + +#else + +#undef Fetch +#define Fetch Fetch32 + +#undef Rotate +#define Rotate Rotate32 + +#undef Bswap +#define Bswap Bswap32 + +// Helpers for data-parallel operations (4x 32-bits). +STATIC_INLINE __m128i Add(__m128i x, __m128i y) { return _mm_add_epi32(x, y); } +STATIC_INLINE __m128i Xor(__m128i x, __m128i y) { return _mm_xor_si128(x, y); } +STATIC_INLINE __m128i Or(__m128i x, __m128i y) { return _mm_or_si128(x, y); } +STATIC_INLINE __m128i Mul(__m128i x, __m128i y) { return _mm_mullo_epi32(x, y); } +STATIC_INLINE __m128i Mul5(__m128i x) { return Add(x, _mm_slli_epi32(x, 2)); } +STATIC_INLINE __m128i RotateLeft(__m128i x, int c) { + return Or(_mm_slli_epi32(x, c), + _mm_srli_epi32(x, 32 - c)); +} +STATIC_INLINE __m128i Rol17(__m128i x) { return RotateLeft(x, 17); } +STATIC_INLINE __m128i Rol19(__m128i x) { return RotateLeft(x, 19); } +STATIC_INLINE __m128i Shuffle0321(__m128i x) { + return _mm_shuffle_epi32(x, (0 << 6) + (3 << 4) + (2 << 2) + (1 << 0)); +} + +uint32_t Hash32(const char *s, size_t len) { + const uint32_t seed = 81; + if (len <= 24) { + return len <= 12 ? + (len <= 4 ? + farmhashmk::Hash32Len0to4(s, len) : + farmhashmk::Hash32Len5to12(s, len)) : + farmhashmk::Hash32Len13to24(s, len); + } + + if (len < 40) { + uint32_t a = len, b = seed * c2, c = a + b; + a += Fetch(s + len - 4); + b += Fetch(s + len - 20); + c += Fetch(s + len - 16); + uint32_t d = a; + a = NAMESPACE_FOR_HASH_FUNCTIONS::Rotate32(a, 21); + a = Mur(a, Mur(b, _mm_crc32_u32(c, d))); + a += Fetch(s + len - 12); + b += Fetch(s + len - 8); + d += a; + a += d; + b = Mur(b, d) * c2; + a = _mm_crc32_u32(a, b + c); + return farmhashmk::Hash32Len13to24(s, (len + 1) / 2, a) + b; + } + +#undef Mulc1 +#define Mulc1(x) Mul((x), cc1) + +#undef Mulc2 +#define Mulc2(x) Mul((x), cc2) + +#undef Murk +#define Murk(a, h) \ + Add(k, \ + Mul5( \ + Rol19( \ + Xor( \ + Mulc2( \ + Rol17( \ + Mulc1(a))), \ + (h))))) + + const __m128i cc1 = _mm_set1_epi32(c1); + const __m128i cc2 = _mm_set1_epi32(c2); + __m128i h = _mm_set1_epi32(seed); + __m128i g = _mm_set1_epi32(c1 * seed); + __m128i f = g; + __m128i k = _mm_set1_epi32(0xe6546b64); + __m128i q; + if (len < 80) { + __m128i a = Fetch128(s); + __m128i b = Fetch128(s + 16); + __m128i c = Fetch128(s + (len - 15) / 2); + __m128i d = Fetch128(s + len - 32); + __m128i e = Fetch128(s + len - 16); + h = Add(h, a); + g = Add(g, b); + q = g; + g = Shuffle0321(g); + f = Add(f, c); + __m128i be = Add(b, Mulc1(e)); + h = Add(h, f); + f = Add(f, h); + h = Add(Murk(d, h), e); + k = Xor(k, _mm_shuffle_epi8(g, f)); + g = Add(Xor(c, g), a); + f = Add(Xor(be, f), d); + k = Add(k, be); + k = Add(k, _mm_shuffle_epi8(f, h)); + f = Add(f, g); + g = Add(g, f); + g = Add(_mm_set1_epi32(len), Mulc1(g)); + } else { + // len >= 80 + // The following is loosely modelled after farmhashmk::Hash32. + size_t iters = (len - 1) / 80; + len -= iters * 80; + +#undef Chunk +#define Chunk() do { \ + __m128i a = Fetch128(s); \ + __m128i b = Fetch128(s + 16); \ + __m128i c = Fetch128(s + 32); \ + __m128i d = Fetch128(s + 48); \ + __m128i e = Fetch128(s + 64); \ + h = Add(h, a); \ + g = Add(g, b); \ + g = Shuffle0321(g); \ + f = Add(f, c); \ + __m128i be = Add(b, Mulc1(e)); \ + h = Add(h, f); \ + f = Add(f, h); \ + h = Add(h, d); \ + q = Add(q, e); \ + h = Rol17(h); \ + h = Mulc1(h); \ + k = Xor(k, _mm_shuffle_epi8(g, f)); \ + g = Add(Xor(c, g), a); \ + f = Add(Xor(be, f), d); \ + std::swap(f, q); \ + q = _mm_aesimc_si128(q); \ + k = Add(k, be); \ + k = Add(k, _mm_shuffle_epi8(f, h)); \ + f = Add(f, g); \ + g = Add(g, f); \ + f = Mulc1(f); \ +} while (0) + + q = g; + while (iters-- != 0) { + Chunk(); + s += 80; + } + + if (len != 0) { + h = Add(h, _mm_set1_epi32(len)); + s = s + len - 80; + Chunk(); + } + } + + g = Shuffle0321(g); + k = Xor(k, g); + k = Xor(k, q); + h = Xor(h, q); + f = Mulc1(f); + k = Mulc2(k); + g = Mulc1(g); + h = Mulc2(h); + k = Add(k, _mm_shuffle_epi8(g, f)); + h = Add(h, f); + f = Add(f, h); + g = Add(g, k); + k = Add(k, g); + k = Xor(k, _mm_shuffle_epi8(f, h)); + __m128i buf[4]; + buf[0] = f; + buf[1] = g; + buf[2] = k; + buf[3] = h; + s = reinterpret_cast(buf); + uint32_t x = Fetch(s); + uint32_t y = Fetch(s+4); + uint32_t z = Fetch(s+8); + x = _mm_crc32_u32(x, Fetch(s+12)); + y = _mm_crc32_u32(y, Fetch(s+16)); + z = _mm_crc32_u32(z * c1, Fetch(s+20)); + x = _mm_crc32_u32(x, Fetch(s+24)); + y = _mm_crc32_u32(y * c1, Fetch(s+28)); + uint32_t o = y; + z = _mm_crc32_u32(z, Fetch(s+32)); + x = _mm_crc32_u32(x * c1, Fetch(s+36)); + y = _mm_crc32_u32(y, Fetch(s+40)); + z = _mm_crc32_u32(z * c1, Fetch(s+44)); + x = _mm_crc32_u32(x, Fetch(s+48)); + y = _mm_crc32_u32(y * c1, Fetch(s+52)); + z = _mm_crc32_u32(z, Fetch(s+56)); + x = _mm_crc32_u32(x, Fetch(s+60)); + return (o - x + y - z) * c1; +} + +#undef Chunk +#undef Murk +#undef Mulc2 +#undef Mulc1 + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + if (len <= 24) { + if (len >= 13) return farmhashmk::Hash32Len13to24(s, len, seed * c1); + else if (len >= 5) return farmhashmk::Hash32Len5to12(s, len, seed); + else return farmhashmk::Hash32Len0to4(s, len, seed); + } + uint32_t h = farmhashmk::Hash32Len13to24(s, 24, seed ^ len); + return _mm_crc32_u32(Hash32(s + 24, len - 24) + seed, h); +} + +#endif +} // namespace farmhashsu +namespace farmhashsa { +#if !can_use_sse42 + +uint32_t Hash32(const char *s, size_t len) { + FARMHASH_DIE_IF_MISCONFIGURED; + return s == NULL ? 0 : len; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed + Hash32(s, len); +} + +#else + +#undef Fetch +#define Fetch Fetch32 + +#undef Rotate +#define Rotate Rotate32 + +#undef Bswap +#define Bswap Bswap32 + +// Helpers for data-parallel operations (4x 32-bits). +STATIC_INLINE __m128i Add(__m128i x, __m128i y) { return _mm_add_epi32(x, y); } +STATIC_INLINE __m128i Xor(__m128i x, __m128i y) { return _mm_xor_si128(x, y); } +STATIC_INLINE __m128i Or(__m128i x, __m128i y) { return _mm_or_si128(x, y); } +STATIC_INLINE __m128i Mul(__m128i x, __m128i y) { return _mm_mullo_epi32(x, y); } +STATIC_INLINE __m128i Mul5(__m128i x) { return Add(x, _mm_slli_epi32(x, 2)); } +STATIC_INLINE __m128i Rotate(__m128i x, int c) { + return Or(_mm_slli_epi32(x, c), + _mm_srli_epi32(x, 32 - c)); +} +STATIC_INLINE __m128i Rot17(__m128i x) { return Rotate(x, 17); } +STATIC_INLINE __m128i Rot19(__m128i x) { return Rotate(x, 19); } +STATIC_INLINE __m128i Shuffle0321(__m128i x) { + return _mm_shuffle_epi32(x, (0 << 6) + (3 << 4) + (2 << 2) + (1 << 0)); +} + +uint32_t Hash32(const char *s, size_t len) { + const uint32_t seed = 81; + if (len <= 24) { + return len <= 12 ? + (len <= 4 ? + farmhashmk::Hash32Len0to4(s, len) : + farmhashmk::Hash32Len5to12(s, len)) : + farmhashmk::Hash32Len13to24(s, len); + } + + if (len < 40) { + uint32_t a = len, b = seed * c2, c = a + b; + a += Fetch(s + len - 4); + b += Fetch(s + len - 20); + c += Fetch(s + len - 16); + uint32_t d = a; + a = NAMESPACE_FOR_HASH_FUNCTIONS::Rotate32(a, 21); + a = Mur(a, Mur(b, Mur(c, d))); + a += Fetch(s + len - 12); + b += Fetch(s + len - 8); + d += a; + a += d; + b = Mur(b, d) * c2; + a = _mm_crc32_u32(a, b + c); + return farmhashmk::Hash32Len13to24(s, (len + 1) / 2, a) + b; + } + +#undef Mulc1 +#define Mulc1(x) Mul((x), cc1) + +#undef Mulc2 +#define Mulc2(x) Mul((x), cc2) + +#undef Murk +#define Murk(a, h) \ + Add(k, \ + Mul5( \ + Rot19( \ + Xor( \ + Mulc2( \ + Rot17( \ + Mulc1(a))), \ + (h))))) + + const __m128i cc1 = _mm_set1_epi32(c1); + const __m128i cc2 = _mm_set1_epi32(c2); + __m128i h = _mm_set1_epi32(seed); + __m128i g = _mm_set1_epi32(c1 * seed); + __m128i f = g; + __m128i k = _mm_set1_epi32(0xe6546b64); + if (len < 80) { + __m128i a = Fetch128(s); + __m128i b = Fetch128(s + 16); + __m128i c = Fetch128(s + (len - 15) / 2); + __m128i d = Fetch128(s + len - 32); + __m128i e = Fetch128(s + len - 16); + h = Add(h, a); + g = Add(g, b); + g = Shuffle0321(g); + f = Add(f, c); + __m128i be = Add(b, Mulc1(e)); + h = Add(h, f); + f = Add(f, h); + h = Add(Murk(d, h), e); + k = Xor(k, _mm_shuffle_epi8(g, f)); + g = Add(Xor(c, g), a); + f = Add(Xor(be, f), d); + k = Add(k, be); + k = Add(k, _mm_shuffle_epi8(f, h)); + f = Add(f, g); + g = Add(g, f); + g = Add(_mm_set1_epi32(len), Mulc1(g)); + } else { + // len >= 80 + // The following is loosely modelled after farmhashmk::Hash32. + size_t iters = (len - 1) / 80; + len -= iters * 80; + +#undef Chunk +#define Chunk() do { \ + __m128i a = Fetch128(s); \ + __m128i b = Fetch128(s + 16); \ + __m128i c = Fetch128(s + 32); \ + __m128i d = Fetch128(s + 48); \ + __m128i e = Fetch128(s + 64); \ + h = Add(h, a); \ + g = Add(g, b); \ + g = Shuffle0321(g); \ + f = Add(f, c); \ + __m128i be = Add(b, Mulc1(e)); \ + h = Add(h, f); \ + f = Add(f, h); \ + h = Add(Murk(d, h), e); \ + k = Xor(k, _mm_shuffle_epi8(g, f)); \ + g = Add(Xor(c, g), a); \ + f = Add(Xor(be, f), d); \ + k = Add(k, be); \ + k = Add(k, _mm_shuffle_epi8(f, h)); \ + f = Add(f, g); \ + g = Add(g, f); \ + f = Mulc1(f); \ +} while (0) + + while (iters-- != 0) { + Chunk(); + s += 80; + } + + if (len != 0) { + h = Add(h, _mm_set1_epi32(len)); + s = s + len - 80; + Chunk(); + } + } + + g = Shuffle0321(g); + k = Xor(k, g); + f = Mulc1(f); + k = Mulc2(k); + g = Mulc1(g); + h = Mulc2(h); + k = Add(k, _mm_shuffle_epi8(g, f)); + h = Add(h, f); + f = Add(f, h); + g = Add(g, k); + k = Add(k, g); + k = Xor(k, _mm_shuffle_epi8(f, h)); + __m128i buf[4]; + buf[0] = f; + buf[1] = g; + buf[2] = k; + buf[3] = h; + s = reinterpret_cast(buf); + uint32_t x = Fetch(s); + uint32_t y = Fetch(s+4); + uint32_t z = Fetch(s+8); + x = _mm_crc32_u32(x, Fetch(s+12)); + y = _mm_crc32_u32(y, Fetch(s+16)); + z = _mm_crc32_u32(z * c1, Fetch(s+20)); + x = _mm_crc32_u32(x, Fetch(s+24)); + y = _mm_crc32_u32(y * c1, Fetch(s+28)); + uint32_t o = y; + z = _mm_crc32_u32(z, Fetch(s+32)); + x = _mm_crc32_u32(x * c1, Fetch(s+36)); + y = _mm_crc32_u32(y, Fetch(s+40)); + z = _mm_crc32_u32(z * c1, Fetch(s+44)); + x = _mm_crc32_u32(x, Fetch(s+48)); + y = _mm_crc32_u32(y * c1, Fetch(s+52)); + z = _mm_crc32_u32(z, Fetch(s+56)); + x = _mm_crc32_u32(x, Fetch(s+60)); + return (o - x + y - z) * c1; +} + +#undef Chunk +#undef Murk +#undef Mulc2 +#undef Mulc1 + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + if (len <= 24) { + if (len >= 13) return farmhashmk::Hash32Len13to24(s, len, seed * c1); + else if (len >= 5) return farmhashmk::Hash32Len5to12(s, len, seed); + else return farmhashmk::Hash32Len0to4(s, len, seed); + } + uint32_t h = farmhashmk::Hash32Len13to24(s, 24, seed ^ len); + return _mm_crc32_u32(Hash32(s + 24, len - 24) + seed, h); +} + +#endif +} // namespace farmhashsa +namespace farmhashcc { +// This file provides a 32-bit hash equivalent to CityHash32 (v1.1.1) +// and a 128-bit hash equivalent to CityHash128 (v1.1.1). It also provides +// a seeded 32-bit hash function similar to CityHash32. + +#undef Fetch +#define Fetch Fetch32 + +#undef Rotate +#define Rotate Rotate32 + +#undef Bswap +#define Bswap Bswap32 + +STATIC_INLINE uint32_t Hash32Len13to24(const char *s, size_t len) { + uint32_t a = Fetch(s - 4 + (len >> 1)); + uint32_t b = Fetch(s + 4); + uint32_t c = Fetch(s + len - 8); + uint32_t d = Fetch(s + (len >> 1)); + uint32_t e = Fetch(s); + uint32_t f = Fetch(s + len - 4); + uint32_t h = len; + + return fmix(Mur(f, Mur(e, Mur(d, Mur(c, Mur(b, Mur(a, h))))))); +} + +STATIC_INLINE uint32_t Hash32Len0to4(const char *s, size_t len) { + uint32_t b = 0; + uint32_t c = 9; + for (size_t i = 0; i < len; i++) { + signed char v = s[i]; + b = b * c1 + v; + c ^= b; + } + return fmix(Mur(b, Mur(len, c))); +} + +STATIC_INLINE uint32_t Hash32Len5to12(const char *s, size_t len) { + uint32_t a = len, b = len * 5, c = 9, d = b; + a += Fetch(s); + b += Fetch(s + len - 4); + c += Fetch(s + ((len >> 1) & 4)); + return fmix(Mur(c, Mur(b, Mur(a, d)))); +} + +uint32_t Hash32(const char *s, size_t len) { + if (len <= 24) { + return len <= 12 ? + (len <= 4 ? Hash32Len0to4(s, len) : Hash32Len5to12(s, len)) : + Hash32Len13to24(s, len); + } + + // len > 24 + uint32_t h = len, g = c1 * len, f = g; + uint32_t a0 = Rotate(Fetch(s + len - 4) * c1, 17) * c2; + uint32_t a1 = Rotate(Fetch(s + len - 8) * c1, 17) * c2; + uint32_t a2 = Rotate(Fetch(s + len - 16) * c1, 17) * c2; + uint32_t a3 = Rotate(Fetch(s + len - 12) * c1, 17) * c2; + uint32_t a4 = Rotate(Fetch(s + len - 20) * c1, 17) * c2; + h ^= a0; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + h ^= a2; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + g ^= a1; + g = Rotate(g, 19); + g = g * 5 + 0xe6546b64; + g ^= a3; + g = Rotate(g, 19); + g = g * 5 + 0xe6546b64; + f += a4; + f = Rotate(f, 19); + f = f * 5 + 0xe6546b64; + size_t iters = (len - 1) / 20; + do { + uint32_t a0 = Rotate(Fetch(s) * c1, 17) * c2; + uint32_t a1 = Fetch(s + 4); + uint32_t a2 = Rotate(Fetch(s + 8) * c1, 17) * c2; + uint32_t a3 = Rotate(Fetch(s + 12) * c1, 17) * c2; + uint32_t a4 = Fetch(s + 16); + h ^= a0; + h = Rotate(h, 18); + h = h * 5 + 0xe6546b64; + f += a1; + f = Rotate(f, 19); + f = f * c1; + g += a2; + g = Rotate(g, 18); + g = g * 5 + 0xe6546b64; + h ^= a3 + a1; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + g ^= a4; + g = Bswap(g) * 5; + h += a4 * 5; + h = Bswap(h); + f += a0; + PERMUTE3(f, h, g); + s += 20; + } while (--iters != 0); + g = Rotate(g, 11) * c1; + g = Rotate(g, 17) * c1; + f = Rotate(f, 11) * c1; + f = Rotate(f, 17) * c1; + h = Rotate(h + g, 19); + h = h * 5 + 0xe6546b64; + h = Rotate(h, 17) * c1; + h = Rotate(h + f, 19); + h = h * 5 + 0xe6546b64; + h = Rotate(h, 17) * c1; + return h; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + if (len <= 24) { + if (len >= 13) return farmhashmk::Hash32Len13to24(s, len, seed * c1); + else if (len >= 5) return farmhashmk::Hash32Len5to12(s, len, seed); + else return farmhashmk::Hash32Len0to4(s, len, seed); + } + uint32_t h = farmhashmk::Hash32Len13to24(s, 24, seed ^ len); + return Mur(Hash32(s + 24, len - 24) + seed, h); +} + +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +#undef Bswap +#define Bswap Bswap64 + +STATIC_INLINE uint64_t ShiftMix(uint64_t val) { + return val ^ (val >> 47); +} + +STATIC_INLINE uint64_t HashLen16(uint64_t u, uint64_t v) { + return Hash128to64(Uint128(u, v)); +} + +STATIC_INLINE uint64_t HashLen16(uint64_t u, uint64_t v, uint64_t mul) { + // Murmur-inspired hashing. + uint64_t a = (u ^ v) * mul; + a ^= (a >> 47); + uint64_t b = (v ^ a) * mul; + b ^= (b >> 47); + b *= mul; + return b; +} + +STATIC_INLINE uint64_t HashLen0to16(const char *s, size_t len) { + if (len >= 8) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch(s) + k2; + uint64_t b = Fetch(s + len - 8); + uint64_t c = Rotate(b, 37) * mul + a; + uint64_t d = (Rotate(a, 25) + b) * mul; + return HashLen16(c, d, mul); + } + if (len >= 4) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch32(s); + return HashLen16(len + (a << 3), Fetch32(s + len - 4), mul); + } + if (len > 0) { + uint8_t a = s[0]; + uint8_t b = s[len >> 1]; + uint8_t c = s[len - 1]; + uint32_t y = static_cast(a) + (static_cast(b) << 8); + uint32_t z = len + (static_cast(c) << 2); + return ShiftMix(y * k2 ^ z * k0) * k2; + } + return k2; +} + +// Return a 16-byte hash for 48 bytes. Quick and dirty. +// Callers do best to use "random-looking" values for a and b. +STATIC_INLINE pair WeakHashLen32WithSeeds( + uint64_t w, uint64_t x, uint64_t y, uint64_t z, uint64_t a, uint64_t b) { + a += w; + b = Rotate(b + a + z, 21); + uint64_t c = a; + a += x; + a += y; + b += Rotate(a, 44); + return make_pair(a + z, b + c); +} + +// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. +STATIC_INLINE pair WeakHashLen32WithSeeds( + const char* s, uint64_t a, uint64_t b) { + return WeakHashLen32WithSeeds(Fetch(s), + Fetch(s + 8), + Fetch(s + 16), + Fetch(s + 24), + a, + b); +} + + + +// A subroutine for CityHash128(). Returns a decent 128-bit hash for strings +// of any length representable in signed long. Based on City and Murmur. +STATIC_INLINE uint128_t CityMurmur(const char *s, size_t len, uint128_t seed) { + uint64_t a = Uint128Low64(seed); + uint64_t b = Uint128High64(seed); + uint64_t c = 0; + uint64_t d = 0; + signed long l = len - 16; + if (l <= 0) { // len <= 16 + a = ShiftMix(a * k1) * k1; + c = b * k1 + HashLen0to16(s, len); + d = ShiftMix(a + (len >= 8 ? Fetch(s) : c)); + } else { // len > 16 + c = HashLen16(Fetch(s + len - 8) + k1, a); + d = HashLen16(b + len, c + Fetch(s + len - 16)); + a += d; + do { + a ^= ShiftMix(Fetch(s) * k1) * k1; + a *= k1; + b ^= a; + c ^= ShiftMix(Fetch(s + 8) * k1) * k1; + c *= k1; + d ^= c; + s += 16; + l -= 16; + } while (l > 0); + } + a = HashLen16(a, c); + b = HashLen16(d, b); + return Uint128(a ^ b, HashLen16(b, a)); +} + +uint128_t CityHash128WithSeed(const char *s, size_t len, uint128_t seed) { + if (len < 128) { + return CityMurmur(s, len, seed); + } + + // We expect len >= 128 to be the common case. Keep 56 bytes of state: + // v, w, x, y, and z. + pair v, w; + uint64_t x = Uint128Low64(seed); + uint64_t y = Uint128High64(seed); + uint64_t z = len * k1; + v.first = Rotate(y ^ k1, 49) * k1 + Fetch(s); + v.second = Rotate(v.first, 42) * k1 + Fetch(s + 8); + w.first = Rotate(y + z, 35) * k1 + x; + w.second = Rotate(x + Fetch(s + 88), 53) * k1; + + // This is the same inner loop as CityHash64(), manually unrolled. + do { + x = Rotate(x + y + v.first + Fetch(s + 8), 37) * k1; + y = Rotate(y + v.second + Fetch(s + 48), 42) * k1; + x ^= w.second; + y += v.first + Fetch(s + 40); + z = Rotate(z + w.first, 33) * k1; + v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first); + w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + std::swap(z, x); + s += 64; + x = Rotate(x + y + v.first + Fetch(s + 8), 37) * k1; + y = Rotate(y + v.second + Fetch(s + 48), 42) * k1; + x ^= w.second; + y += v.first + Fetch(s + 40); + z = Rotate(z + w.first, 33) * k1; + v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first); + w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + std::swap(z, x); + s += 64; + len -= 128; + } while (LIKELY(len >= 128)); + x += Rotate(v.first + z, 49) * k0; + y = y * k0 + Rotate(w.second, 37); + z = z * k0 + Rotate(w.first, 27); + w.first *= 9; + v.first *= k0; + // If 0 < len < 128, hash up to 4 chunks of 32 bytes each from the end of s. + for (size_t tail_done = 0; tail_done < len; ) { + tail_done += 32; + y = Rotate(x + y, 42) * k0 + v.second; + w.first += Fetch(s + len - tail_done + 16); + x = x * k0 + w.first; + z += w.second + Fetch(s + len - tail_done); + w.second += v.first; + v = WeakHashLen32WithSeeds(s + len - tail_done, v.first + z, v.second); + v.first *= k0; + } + // At this point our 56 bytes of state should contain more than + // enough information for a strong 128-bit hash. We use two + // different 56-byte-to-8-byte hashes to get a 16-byte final result. + x = HashLen16(x, v.first); + y = HashLen16(y + z, w.first); + return Uint128(HashLen16(x + v.second, w.second) + y, + HashLen16(x + w.second, y + v.second)); +} + +STATIC_INLINE uint128_t CityHash128(const char *s, size_t len) { + return len >= 16 ? + CityHash128WithSeed(s + 16, len - 16, + Uint128(Fetch(s), Fetch(s + 8) + k0)) : + CityHash128WithSeed(s, len, Uint128(k0, k1)); +} + +uint128_t Fingerprint128(const char* s, size_t len) { + return CityHash128(s, len); +} +} // namespace farmhashcc +#endif // DEVICE_MODIFIER +namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU { + +#ifndef DEVICE_MODIFIER +// BASIC STRING HASHING + +// Hash function for a byte array. See also Hash(), below. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint32_t Hash32(const char* s, size_t len) { + return DebugTweak( + (can_use_sse41 & x86_64) ? farmhashnt::Hash32(s, len) : + (can_use_sse42 & can_use_aesni) ? farmhashsu::Hash32(s, len) : + can_use_sse42 ? farmhashsa::Hash32(s, len) : + farmhashmk::Hash32(s, len)); +} + +// Hash function for a byte array. For convenience, a 32-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint32_t Hash32WithSeed(const char* s, size_t len, uint32_t seed) { + return DebugTweak( + (can_use_sse41 & x86_64) ? farmhashnt::Hash32WithSeed(s, len, seed) : + (can_use_sse42 & can_use_aesni) ? farmhashsu::Hash32WithSeed(s, len, seed) : + can_use_sse42 ? farmhashsa::Hash32WithSeed(s, len, seed) : + farmhashmk::Hash32WithSeed(s, len, seed)); +} + +// Hash function for a byte array. For convenience, a 64-bit seed is also +// hashed into the result. See also Hash(), below. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint64_t Hash64(const char* s, size_t len) { + return DebugTweak( + (can_use_sse42 & x86_64) ? + farmhashte::Hash64(s, len) : + farmhashxo::Hash64(s, len)); +} + +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +size_t Hash(const char* s, size_t len) { + return sizeof(size_t) == 8 ? Hash64(s, len) : Hash32(s, len); +} + +// Hash function for a byte array. For convenience, a 64-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint64_t Hash64WithSeed(const char* s, size_t len, uint64_t seed) { + return DebugTweak(farmhashna::Hash64WithSeed(s, len, seed)); +} + +// Hash function for a byte array. For convenience, two seeds are also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint64_t Hash64WithSeeds(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { + return DebugTweak(farmhashna::Hash64WithSeeds(s, len, seed0, seed1)); +} + +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint128_t Hash128(const char* s, size_t len) { + return DebugTweak(farmhashcc::Fingerprint128(s, len)); +} + +// Hash function for a byte array. For convenience, a 128-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint128_t Hash128WithSeed(const char* s, size_t len, uint128_t seed) { + return DebugTweak(farmhashcc::CityHash128WithSeed(s, len, seed)); +} + +// BASIC NON-STRING HASHING + +// FINGERPRINTING (i.e., good, portable, forever-fixed hash functions) + +// Fingerprint function for a byte array. Most useful in 32-bit binaries. +uint32_t Fingerprint32(const char* s, size_t len) { + return farmhashmk::Hash32(s, len); +} +#endif // DEVICE_MODIFIER + +// Fingerprint function for a byte array. +DEVICE_MODIFIER uint64_t Fingerprint64(const char* s, size_t len) { + return farmhashna_gpu::Hash64(s, len); +} + +#ifndef DEVICE_MODIFIER +// Fingerprint function for a byte array. +uint128_t Fingerprint128(const char* s, size_t len) { + return farmhashcc::Fingerprint128(s, len); +} + +// Older and still available but perhaps not as fast as the above: +// farmhashns::Hash32{,WithSeed}() +#endif // DEVICE_MODIFIER + +} // namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU + +#ifndef DEVICE_MODIFIER +#if FARMHASHSELFTEST + +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashccTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +4223616069u, +3696677242u, +1039179260u, 1690343979u, 1018511555u, 2464489001u, +20368522u, 2663783964u, 175201532u, 1619210592u, +4081014168u, +2576519988u, +3285042206u, 502478099u, 739479538u, 1500332790u, +13754768u, 3789353455u, 3473868058u, 1909255088u, +2212771159u, +1112731063u, +826915357u, 2893489933u, 118369799u, 1848668220u, +1308219822u, 249416982u, 64306364u, 4221800195u, +1020067935u, +3955445564u, +563346294u, 550236731u, 2339016688u, 1826259714u, +3872358639u, 2295981050u, 1870005390u, 4015628802u, +1451961420u, +653440099u, +1292493871u, 164377749u, 1717712483u, 463414587u, +3924343675u, 1050492084u, 3566618804u, 2046983362u, +31917516u, +2957164615u, +230718965u, 999595115u, 3534822176u, 2175709186u, +965707431u, 441796222u, 2481718051u, 1827777486u, +2590087362u, +3879448744u, +3515079898u, 1601433082u, 982764532u, 254808716u, +1293372530u, 4205605817u, 947001462u, 1138890052u, +176305566u, +2447367541u, +2973802542u, 4123621138u, 3083865840u, 1706367795u, +792114347u, 2880110657u, 440613768u, 195054868u, +1359016305u, +3363804638u, +649488537u, 1624045597u, 1441938215u, 3147758996u, +3199173578u, 2597283203u, 2191333609u, 3763129144u, +1117290165u, +1062549743u, +2565615889u, 1046361554u, 1581968261u, 1058773671u, +1123053168u, 3807622275u, 1486749916u, 3900816089u, +2437877004u, +1894455839u, +1912520953u, 1914997013u, 561048608u, 1643267444u, +3671572006u, 194811086u, 1468911468u, 2179206286u, +673206794u, +3486923651u, +3741426466u, 3292160512u, 697001377u, 1900763774u, +3726097344u, 629282039u, 3578723715u, 2868028489u, +3269862919u, +2303349487u, +3643953525u, 2307255916u, 849996280u, 732080434u, +909961480u, 3542445214u, 2628347095u, 4236856917u, +1380660650u, +2631821908u, +2007289004u, 3509705198u, 3788541675u, 789457322u, +3090670546u, 638977894u, 3503881773u, 947102987u, +1525325287u, +1816697045u, +2706647405u, 288763142u, 3505438495u, 481308609u, +2882636782u, 3745162621u, 3503467033u, 428247823u, +176408838u, +333551502u, +1001068721u, 1681483651u, 75380831u, 4191469679u, +3627361839u, 2736617386u, 3120737438u, 1297502456u, +864896482u, +85674920u, +2886047255u, 4119881331u, 2496990525u, 3442502055u, +1806582817u, 3186345024u, 4099591287u, 2560171465u, +3489229104u, +3065015872u, +2755089808u, 3098442882u, 378524719u, 2664097023u, +1771960725u, 2901182183u, 55258521u, 1266621443u, +581644891u, +37790450u, +1800731704u, 3601350920u, 53428754u, 2759476837u, +3391093099u, 1496510311u, 2511119507u, 2636877410u, +631613207u, +1573846064u, +260484875u, 1088212603u, 2369525206u, 322522428u, +3191396600u, 2076543340u, 1552496658u, 2739811558u, +3867875546u, +2051584261u, +2126250818u, 901517871u, 3651631165u, 1323139145u, +1521111765u, 477802997u, 3508559783u, 383954241u, +3804516756u, +4250206331u, +2655954340u, 2484996477u, 1417544845u, 1520282298u, +2745204366u, 2869345147u, 1872738335u, 2592877343u, +1619744564u, +1804962124u, +3458679890u, 423948620u, 273645618u, 4187865426u, +376057175u, 2943431463u, 3581950599u, 1035398331u, +1088213445u, +861988903u, +1323370244u, 777069428u, 506235917u, 369720851u, +2789995854u, 230915180u, 1505086948u, 940361236u, +3727873235u, +1159167499u, +1860302871u, 3456858862u, 3923555152u, 2131072714u, +2910461068u, 3671950363u, 2010742682u, 4088068851u, +3616470388u, +2087714788u, +221675509u, 1230154072u, 3450704646u, 1463226695u, +1998357699u, 266026801u, 619568740u, 3560427266u, +4148162586u, +3150417316u, +1356375822u, 2056097622u, 627905802u, 3881675638u, +2309738053u, 971916703u, 3447805361u, 1673575328u, +673084328u, +3317849401u, +2836362782u, 2377208890u, 3275350588u, 158350552u, +2553241779u, 2497264995u, 3262882649u, 3897937187u, +1598963653u, +3068514414u, +601541505u, 374517071u, 3380795976u, 235752573u, +284670003u, 2990192160u, 904937105u, 2306579150u, +2117362589u, +1635274830u, +3355572906u, 170799903u, 1226685528u, 664567688u, +413219134u, 878324258u, 4026159448u, 3620649295u, +1823625377u, +3175888439u, +1759344347u, 2640637095u, 3549558u, 2192984935u, +978623493u, 804017880u, 3877562323u, 3843116489u, +1641748342u, +1853539444u, +3001178468u, 3443560727u, 2685426077u, 1653064722u, +349231508u, 2726789654u, 3136215581u, 768402830u, +269384321u, +531936536u, +2592883487u, 1343156334u, 3628619802u, 1477143570u, +4269458419u, 3285611028u, 959104925u, 2712290710u, +3480237248u, +835796333u, +2020636251u, 1191914589u, 126521603u, 4288023938u, +3731699932u, 2136758855u, 985780142u, 193807575u, +1850544433u, +653947619u, +3929316796u, 381871169u, 950486363u, 1787262279u, +360480382u, 1800636585u, 1039258631u, 3682073259u, +1262819303u, +1786000319u, +1570627191u, 893065837u, 301304916u, 1478469809u, +623018819u, 2742232545u, 2058913014u, 1706060059u, +2421125401u, +1315829592u, +3208766775u, 1805586156u, 575853086u, 3085025513u, +4010908260u, 2344058256u, 3814407434u, 1458485673u, +2474514786u, +3581895658u, +2710719679u, 190812706u, 2135454262u, 2620080728u, +3400757986u, 1669914857u, 1559978393u, 1629811331u, +3096616493u, +1391424435u, +4158376003u, 1015657076u, 794783832u, 479952178u, +1150290207u, 2497437906u, 231815090u, 755078067u, +3832053281u, +63649475u, +2415822606u, 4105027719u, 1706992318u, 1106598740u, +3941945667u, 1271300761u, 505882259u, 760186809u, +2657183368u, +1925422058u, +1039773764u, 880219458u, 4275949176u, 1556833823u, +925882132u, 4216310340u, 757497522u, 461833914u, +3884002070u, +2790957660u, +2100050089u, 651959176u, 1380301291u, 1289124125u, +452314403u, 226156280u, 3306924715u, 1750807758u, +2290180542u, +1953760569u, +2253069096u, 3960924806u, 1786291620u, 60736185u, +2569018293u, 3870479674u, 2247005661u, 2239850953u, +4261808536u, +3282975782u, +780945879u, 3349849383u, 1579362556u, 2265045884u, +905088740u, 725212379u, 3156479246u, 2501620391u, +3062836263u, +4070422690u, +996797869u, 4082582315u, 976105756u, 303983602u, +1862104804u, 3864508254u, 3383979677u, 2835500286u, +2798364010u, +519359476u, +3447342725u, 194373889u, 3313466630u, 232399983u, +2841787856u, 1672751454u, 3345183154u, 1805381384u, +2226129336u, +2847829057u, +2350774567u, 2838540121u, 2757948482u, 1017002062u, +2329150951u, 2171488196u, 3668619047u, 3874977844u, +3287966998u, +262346753u, +2493054715u, 2298644430u, 2926101182u, 1528457638u, +598656233u, 2615845874u, 989110727u, 820441411u, +253617372u, +2201077208u, +2047569338u, 3114356329u, 3335563734u, 2967673540u, +768438341u, 1417708203u, 3873718246u, 1538441843u, +1279167650u, +3917966776u, +2218481734u, 1015935150u, 1957845042u, 1318150213u, +3146423971u, 4218994877u, 1162470863u, 1519718292u, +2594658906u, +665870414u, +3430347817u, 3933868731u, 1597041394u, 3138684682u, +3398212027u, 1064647658u, 1576321132u, 14792918u, +224938029u, +3706456050u, +847274786u, 2645698692u, 1743374687u, 2343133224u, +3066596790u, 2857270120u, 200596308u, 452055528u, +2319312082u, +3488655402u, +4146865894u, 608206438u, 2699777051u, 3687240713u, +327957508u, 3664730153u, 568134564u, 2993484554u, +4159860363u, +4274533921u, +1079994063u, 2360220210u, 3609597760u, 3639708902u, +2836180437u, 1069910270u, 1892427666u, 1874729790u, +1267712826u, +121886940u, +3572289214u, 2475945610u, 783779452u, 588827737u, +1531395014u, 2085084212u, 2219189792u, 3981444548u, +2218885336u, +1691622694u, +2053232885u, 1386558530u, 2182946189u, 2365247285u, +1871081313u, 2935751853u, 38413723u, 543465863u, +900691890u, +2899905665u, +575120562u, 93133904u, 457154948u, 2983705792u, +4232229200u, 2038565963u, 614693984u, 3405328302u, +4083090010u, +2088004171u, +244031209u, 1861889294u, 2417109253u, 3299562328u, +4158642443u, 4199064449u, 3161611046u, 885015950u, +3677904099u, +2969861785u, +772348805u, 1712263832u, 3219357614u, 484271305u, +3645706114u, 2059620251u, 409557488u, 2278896731u, +224475749u, +3523022952u, +2057140088u, 449131785u, 1149879244u, 4255363996u, +3602720135u, 1690010854u, 2503998822u, 2750828466u, +3340671802u, +1447583863u, +2649684943u, 2764747249u, 3046070595u, 3441726138u, +3840332559u, 3156747501u, 1288666680u, 1472744459u, +3452391933u, +1617542784u, +217869690u, 3718469527u, 348639731u, 590532355u, +43789787u, 22606314u, 1621559290u, 2231743261u, +2234620879u, +544748955u, +3169387920u, 203343594u, 3272552527u, 1078282365u, +809576321u, 854207584u, 3625491053u, 1193737267u, +1628966807u, +2661421060u, +2433442061u, 3886639039u, 2149304418u, 303000565u, +1432830882u, 137378235u, 1135974068u, 318705754u, +2491227157u, +2627534472u, +3520352233u, 2488397682u, 3969194920u, 3843962181u, +2135981459u, 2611933220u, 799460731u, 2300968851u, +3412851628u, +3070914013u, +3555224260u, 4125937572u, 240359903u, 722496673u, +2061023600u, 3843919221u, 2759960043u, 1191155322u, +1504041490u, +3735253656u, +1773124736u, 101110011u, 1627699578u, 2645634551u, +263603947u, 1388368439u, 677146538u, 1644201982u, +2625699644u, +2403862553u, +2426069017u, 3613511705u, 915141802u, 2981654265u, +3474818167u, 2611101773u, 627891434u, 762754924u, +2143021902u, +51067670u, +4017746573u, 2269879853u, 3037857950u, 2388899692u, +582729171u, 1886116725u, 2281219772u, 264704948u, +3509984037u, +4078683368u, +2172959411u, 1807195632u, 3357092302u, 2253764928u, +2320369390u, 3076335959u, 2623583210u, 168378015u, +1435562650u, +1100977467u, +3160490319u, 2550328495u, 2396855930u, 1347823908u, +1617990918u, 3849653099u, 3224111576u, 1681539821u, +4171542880u, +552200045u, +3562947778u, 1676237880u, 3747732307u, 2453332913u, +865530667u, 3566636849u, 3485502777u, 336779723u, +2535942410u, +1685000184u, +820545711u, 1893670486u, 1273910461u, 1193758569u, +970365241u, 381205962u, 3612810852u, 1160577445u, +541488143u, +4005031080u, +2333965236u, 2419855455u, 3484533538u, 3073937876u, +908466956u, 661391539u, 2342122412u, 1467049112u, +1785800827u, +135343033u, +139643209u, 2438375667u, 974654058u, 3216478230u, +3807620420u, 779043363u, 2812846449u, 333254784u, +1025244024u, +2242303095u, +2476683742u, 350018683u, 174652916u, 933097576u, +826905896u, 559603581u, 2777181260u, 164915169u, +4070353203u, +1459055748u, +297303985u, 3103837241u, 3812514233u, 232265137u, +2032819099u, 1523091376u, 3531238208u, 1403510182u, +2886832080u, +2599705941u, +2789695716u, 68437968u, 3823813791u, 1040994569u, +3024194990u, 2461740520u, 3735391266u, 2042207153u, +2461678616u, +3519231840u, +1344224923u, 411442756u, 1179779351u, 7661528u, +778352196u, 3288808867u, 589356197u, 2627504511u, +3374744599u, +3312172905u, +357423007u, 3539567796u, 4044452215u, 1445118403u, +2937983820u, 184089910u, 346201845u, 2427295202u, +1345448010u, +2884434843u, +3085001879u, 2640105409u, 315310640u, 3530289798u, +3362974764u, 963602652u, 75228477u, 3509381180u, +4012777756u, +2380345941u, +1073137836u, 2083960378u, 1220315185u, 3628720934u, +3508867818u, 67148343u, 3558085158u, 1753943368u, +863309561u, +2844713625u, +441921850u, 854732254u, 816793316u, 2555428747u, +3440623414u, 1707304366u, 3189874375u, 1623229221u, +1220335976u, +806745430u, +3909262947u, 1680369031u, 2926179486u, 3410391660u, +3991630434u, 2876458763u, 1179167079u, 536360759u, +1592117159u, +1514343977u, +1032622306u, 2057494855u, 784938958u, 178402996u, +1152907972u, 2326185495u, 2939973666u, 4181120253u, +552831733u, +664251856u, +1297139539u, 1969357631u, 1474065957u, 3055419017u, +3395829380u, 3316562752u, 2168409017u, 614624786u, +3585854336u, +668291094u, +1162889217u, 3773171307u, 2263271126u, 355089668u, +3195850578u, 3396793277u, 3519870267u, 527857605u, +3972392320u, +2224315010u, +4047225561u, 3271434798u, 3192704713u, 2798505213u, +3932215896u, 3792924012u, 3796843756u, 453872975u, +4050552799u, +1056432676u, +928166947u, 121311642u, 930989547u, 2087070683u, +1288978057u, 1556325239u, 1812435626u, 1682385724u, +1214364933u, +904760776u, +3957045528u, 3949822847u, 2411065880u, 3716420732u, +3424837835u, 3833550693u, 1799375326u, 2012368921u, +2768764136u, +1786111037u, +4055479315u, 3751639533u, 2808224623u, 3492656387u, +1306824780u, 2624000170u, 3134795218u, 1778409297u, +3900821801u, +593336325u, +2772069220u, 2980873673u, 3574497158u, 3994780459u, +4246519854u, 3482758570u, 4228015183u, 33101083u, +1769887734u, +4158035314u, +3690638998u, 1119035482u, 4134969651u, 2483207353u, +3932823321u, 285829887u, 3485140138u, 1304815138u, +995608264u, +3133997465u, +1195477617u, 2147693728u, 3506673112u, 4234467492u, +1183174337u, 1395340482u, 769199343u, 193262308u, +2798920256u, +3827889422u, +3399695609u, 3036045724u, 2999477386u, 3567001759u, +2682864314u, 1414023907u, 3699872975u, 3369870701u, +2662284872u, +2179640019u, +2485080099u, 3234415609u, 3755915606u, 1339453220u, +1567403399u, 2076272391u, 293946298u, 3861962750u, +1291949822u, +2916864995u, +132642326u, 2215117062u, 2205863575u, 2488805750u, +405632860u, 3248129390u, 2952606864u, 896734759u, +2047417173u, +3865951392u, +657296855u, 1328547532u, 3966511825u, 3959682388u, +4171801020u, 2981416957u, 1868896247u, 790081075u, +3143666398u, +2950766549u, +2065854887u, 2737081890u, 995061774u, 1510712611u, +2865954809u, 565044286u, 1565631102u, 1500654931u, +494822108u, +2803515503u, +1058154996u, 3506280187u, 856885925u, 4204610546u, +800905649u, 1130711562u, 558146282u, 2053400666u, +449794061u, +2643520245u, +2101248725u, 3123292429u, 3583524041u, 983372394u, +1587743780u, 672870813u, 444833475u, 100741452u, +366232251u, +1717951248u, +524144122u, 1362432726u, 1304947719u, 674306020u, +405665887u, 4081931036u, 1580408204u, 2343242778u, +3901654006u, +2627173567u, +3015148205u, 814686701u, 1327920712u, 1346494176u, +2468632605u, 2259795544u, 2519278184u, 2129281928u, +2860266380u, +4001619412u, +1154910973u, 2841022216u, 1199925485u, 1372200293u, +2713179055u, 3609776550u, 2896463880u, 1056406892u, +177413841u, +40180172u, +3274788406u, 660921784u, 1686225028u, 4003382965u, +2532691887u, 4256809101u, 1186018983u, 667359096u, +2375266493u, +2760222015u, +745187078u, 312264012u, 396822261u, 2588536966u, +2026998998u, 1766454365u, 3218807676u, 3915487497u, +2630550356u, +4130063378u, +4231937074u, 752212123u, 3085144349u, 3267186363u, +4103872100u, 4193207863u, 1306401710u, 3014853131u, +1067760598u, +2306188342u, +2437881506u, 4258185052u, 2506507580u, 130876929u, +1076894205u, 4106981702u, 2799540844u, 945747327u, +1436722291u, +2499772225u, +2571537041u, 2038830635u, 2066826058u, 2892892912u, +524875858u, 3392572161u, 2869992096u, 1308273341u, +923668994u, +1980407857u, +2275009652u, 240598096u, 2658376530u, 3505603048u, +1022603789u, 582423424u, 846379327u, 4092636095u, +4177298326u, +1004173023u, +2154027018u, 2993634669u, 1098364089u, 3035642175u, +1335688126u, 1376393415u, 1252369770u, 3815033328u, +1999309358u, +1234054757u, +1388595255u, 2859334775u, 366532860u, 3453410395u, +4226967708u, 1321729870u, 2078463405u, 156766592u, +3157683394u, +3549293384u, +3348214547u, 2879648344u, 1144813399u, 2758966254u, +647753581u, 813615926u, 2035441590u, 1961053117u, +600168686u, +2192833387u, +3156481401u, 3627320321u, 383550248u, 81209584u, +2339331745u, 1284116690u, 1980144976u, 2955724163u, +789301728u, +3842040415u, +1115881490u, 965249078u, 4098663322u, 1870257033u, +2923150701u, 4217108433u, 183816559u, 2104089285u, +2640095343u, +3173757052u, +927847464u, 2383114981u, 4287174363u, 1886129652u, +70635161u, 1182924521u, 1121440038u, 4246220730u, +3890583049u, +975913757u, +2436253031u, 1074894869u, 1301280627u, 992471939u, +735658128u, 244441856u, 1541612456u, 3457776165u, +3503534059u, +1931651133u, +349142786u, 3669028584u, 1828812038u, 99128389u, +1364272849u, 1963678455u, 3971963311u, 2316950886u, +1308901796u, +2789591580u, +1460494965u, 2380227479u, 1577190651u, 1755822080u, +2911014607u, 859387544u, 13023113u, 2319243370u, +2522582211u, +2299110490u, +3342378874u, 2589323490u, 1884430765u, 3739058655u, +2419330954u, 355389916u, 273950915u, 3670136553u, +410946824u, +3174041420u, +2609010298u, 3059091350u, 2300275014u, 725729828u, +2548380995u, 1738849964u, 1257081412u, 79430455u, +810321297u, +3246190593u, +1007937684u, 912115394u, 40880059u, 3450073327u, +4289832174u, 2253485111u, 1065639151u, 2953189309u, +124779113u, +654299738u, +115760833u, 1250932069u, 884995826u, 3998908281u, +1382882981u, 1134187162u, 3202324501u, 487502928u, +3032756345u, +4057517628u, +933197381u, 2319223127u, 2044528655u, 2554572663u, +4049450620u, 1620812836u, 2832905391u, 2273005481u, +1913090121u, +1055456023u, +510593296u, 3285343192u, 2912822536u, 1645225063u, +638418430u, 452701300u, 1025483165u, 1639370512u, +167948643u, +2809842730u, +2983135664u, 407521332u, 1543756616u, 3949773145u, +4283462892u, 659962275u, 3878013463u, 1000748756u, +4053212051u, +4099239406u, +3467581965u, 354635541u, 21301844u, 3831212473u, +3189450571u, 2264401966u, 4096484849u, 1736448515u, +3976926096u, +3727194724u, +2243487039u, 585209095u, 3143046007u, 969558123u, +3037113502u, 3594170243u, 2835860223u, 3775493975u, +2787220812u, +2274252217u, +2915380701u, 3077533278u, 1252871826u, 1519790952u, +205297661u, 2950557658u, 3956882191u, 2724439401u, +3694608025u, +124028038u, +216019153u, 1533010676u, 2259986336u, 2014061617u, +2068617849u, 3078123052u, 2692046098u, 1582812948u, +396916232u, +1470894001u, +1694309312u, 300268215u, 1553892743u, 671176040u, +1544988994u, 2793402821u, 4194972569u, 2296476154u, +748354332u, +3491325898u, +4261053291u, 1104998242u, 797816835u, 243564059u, +2197717393u, 299029458u, 1675252188u, 3139770041u, +583018574u, +2532106100u, +2099391658u, 3760526730u, 3422719327u, 3556917689u, +2374009285u, 2130865894u, 3710563151u, 1437538307u, +3938030842u, +2006930694u, +2151243336u, 1939741287u, 1957068175u, 2135147479u, +649553342u, 1713643042u, 4188696599u, 1698739939u, +3549427584u, +1016382174u, +322644378u, 2476164549u, 2037263020u, 88036019u, +2548960923u, 539867919u, 2871157727u, 4031659929u, +754087252u, +972656559u, +4246379429u, 3877308578u, 2059459630u, 3614934323u, +1410565271u, 2102980459u, 215395636u, 1083393481u, +3775523015u, +2062750105u, +2475645882u, 3041186774u, 3534315423u, 758607219u, +1686100614u, 180500983u, 1155581185u, 1476664671u, +2918661695u, +3812731350u, +4003853737u, 4148884881u, 1468469436u, 3278880418u, +1045838071u, 1049161262u, 360450415u, 3158065524u, +814443735u, +3391401707u, +729968410u, 738771593u, 3662738792u, 1672830580u, +4199496163u, 188487238u, 219098233u, 2141731267u, +3890250614u, +2988780375u, +4026279523u, 3489429375u, 2468433807u, 1178270701u, +2685094218u, 2716621497u, 3718335529u, 2273344755u, +701110882u, +1925717409u, +1515176562u, 2325460593u, 3954798930u, 784566105u, +3769422266u, 1641530321u, 2703876862u, 2907480267u, +1828076455u, +1805635221u, +3883381245u, 1476756210u, 2072514392u, 3658557081u, +2003610746u, 2556845550u, 729594004u, 3303898266u, +1968227254u, +423204951u, +231828688u, 4223697811u, 698619045u, 3636824418u, +2738779239u, 2333529003u, 2833158642u, 580285428u, +3038148234u, +1012378004u, +1113647298u, 1424593483u, 4053247723u, 1167152941u, +2677383578u, 3419485379u, 2135673840u, 440478166u, +1682229112u, +3226724137u, +1217439806u, 3828726923u, 3636576271u, 3467643156u, +2005614908u, 2655346461u, 2345488441u, 1027557096u, +3594084220u, +1372306343u, +2342583762u, 4291342905u, 4094931814u, 3254771759u, +821978248u, 2404930117u, 1143937655u, 3156949255u, +3460606610u, +449701786u, +3474906110u, 1932585294u, 2283357584u, 1808481478u, +3522851029u, 3040164731u, 1530172182u, 2950426149u, +1402416557u, +756419859u, +4132576145u, 724994790u, 2852015871u, 2177908339u, +899914731u, 139675671u, 1423281870u, 3198458070u, +807581308u, +2021611521u, +1801452575u, 1425984297u, 2833835949u, 1536827865u, +3902351840u, 164546042u, 1872840974u, 3986194780u, +792156290u, +3378681896u, +941547959u, 3931328334u, 3661060482u, 2386420777u, +3920146272u, 3458621279u, 3348500844u, 2269586542u, +797371473u, +3188953649u, +80514771u, 2913333490u, 1246325623u, 3253846094u, +1723906239u, 1606413555u, 587500718u, 1412413859u, +2310046829u, +2113313263u, +3855635608u, 47271944u, 1112281934u, 3440228404u, +2633519166u, 425094457u, 307659635u, 67338587u, +2412987939u, +2363930989u, +2853008596u, 2844637339u, 922568813u, 130379293u, +2825204405u, 2904442145u, 1176875333u, 1511685505u, +599177514u, +1872681372u, +682394826u, 1888849790u, 3635304282u, 1761257265u, +1571292431u, 355247075u, 1177210823u, 1691529530u, +3629531121u, +3760474006u, +1129340625u, 868116266u, 3908237785u, 1942124366u, +1266630014u, 3214841995u, 334023850u, 1110037019u, +369650727u, +1288666741u, +70535706u, 20230114u, 4284225520u, 727856157u, +293696779u, 1244943770u, 3976592462u, 560421917u, +4171688499u, +2438786950u, +1218144639u, 3809125983u, 1302395746u, 534542359u, +2121993015u, 2899519374u, 3192177626u, 1761707794u, +3101683464u, +1555403906u, +3225675390u, 1875263768u, 4278894569u, 651707603u, +2111591484u, 3802716028u, 2900262228u, 1181469202u, +3254743797u, +1822684466u, +860641829u, 3046128268u, 1284833012u, 1125261608u, +461384524u, 2331344566u, 1274400010u, 990498321u, +3462536298u, +3796842585u, +2346607194u, 279495949u, 3951194590u, 3522664971u, +3169688303u, 726831706u, 1123875117u, 1816166599u, +3759808754u, +2918558151u, +3713203220u, 3369939267u, 466047109u, 384042536u, +587271104u, 2191634696u, 2449929095u, 1157932232u, +2084466674u, +841370485u, +3241372562u, 4277738486u, 2150836793u, 1173569449u, +778768930u, 2594706485u, 3065269405u, 3019263663u, +2660146610u, +2789946230u, +77056913u, 728174395u, 3647185904u, 804562358u, +2697276483u, 881311175u, 1178696435u, 2059173891u, +2308303791u, +221481230u, +50241451u, 3689414100u, 1969074761u, 2732071529u, +1900890356u, 840789500u, 2100609300u, 985565597u, +1220850414u, +2456636259u, +223607678u, 1016310244u, 1937434395u, 85717256u, +275058190u, 3712011133u, 171916016u, 2389569096u, +3679765802u, +3575358777u, +3481108261u, 3178286380u, 2489642395u, 2931039055u, +3086601621u, 3079518902u, 3027718495u, 2506894644u, +2976869602u, +2134336365u, +2420172217u, 918054427u, 661522682u, 1403791357u, +3587174388u, 2623673551u, 1355661457u, 4159477684u, +1109013587u, +3112183488u, +2217849279u, 3500291996u, 2419603731u, 2929886201u, +3854470013u, 1358382103u, 1357666555u, 21053566u, +2716621233u, +3094836862u, +3309729704u, 57086558u, 839187419u, 2757944838u, +3651040558u, 3607536716u, 3691257732u, 2312878285u, +1202511724u, +183479927u, +2509829803u, 109313218u, 478173887u, 2072044014u, +190631406u, 2495604975u, 1010416260u, 3679857586u, +726566957u, +258500881u, +1805873908u, 3081447051u, 2352101327u, 534922207u, +1584552873u, 813470716u, 255914637u, 249169434u, +3193498057u, +1038802706u, +2590158653u, 3147907290u, 663060128u, 1156177857u, +634616100u, 312879189u, 1545020368u, 2054634247u, +3271451914u, +3438291534u, +2181454946u, 3864535432u, 2398586877u, 896491075u, +2810631478u, 2770357487u, 3372930052u, 898070638u, +2051007323u, +392959778u, +36645539u, 3743556044u, 4134529680u, 4124451188u, +566806297u, 2936523982u, 1304761965u, 537399498u, +1940818842u, +40862381u, +36288410u, 3063605629u, 2826611650u, 3961972098u, +1871578006u, 2392095486u, 1136931591u, 513864488u, +173276451u, +3039055682u, +3543322032u, 1943592006u, 657217094u, 1751698246u, +2969618445u, 456616022u, 900309519u, 113892716u, +1126392103u, +1235651045u, +1882073852u, 2136610853u, 2353639710u, 2819956700u, +3980083530u, 828773559u, 224069850u, 902434120u, +2802008036u, +94358995u, +2777723394u, 2812641403u, 2525832595u, 4157388110u, +4235563782u, 937800324u, 141690749u, 568062536u, +550123849u, +1330316521u, +1949488696u, 2296431366u, 1958465262u, 3564751729u, +3748252207u, 120455129u, 1607318832u, 2525729790u, +2640987481u, +2332096657u, +1775969159u, 1555085077u, 2913525137u, 1347085183u, +2376253113u, 3194050574u, 1806090610u, 678641356u, +1499146713u, +383849715u, +3299835823u, 2284860330u, 2614269636u, 3913628844u, +2761334210u, 1959484587u, 529797021u, 239966995u, +3102194829u, +3602307804u, +1122192627u, 3577510006u, 164486066u, 1680137310u, +1473396395u, 1467801424u, 903493660u, 1185943071u, +2798556505u, +2306744492u, +3167201310u, 3577947177u, 3067592134u, 2905506289u, +1210366329u, 204484056u, 2347778932u, 3862374472u, +3277439508u, +4187414621u, +1646699310u, 621385800u, 3934869089u, 3975491588u, +3580085916u, 1925674500u, 2436305348u, 3983301539u, +2739439523u, +3291507446u, +3395637920u, 3753389171u, 2955202032u, 2654255623u, +3771089254u, 2140443405u, 2779834738u, 3261942805u, +3526889244u, +1842009139u, +4048484340u, 2106218403u, 2161244271u, 772152700u, +1158647659u, 3776791619u, 3882186721u, 699525237u, +2954670460u, +1007105869u, +3359152025u, 1146388699u, 1401550303u, 2326582541u, +4181783540u, 1085644043u, 1942143795u, 1038368308u, +1526153809u, +4042547244u, +1891441000u, 2573991874u, 1281441253u, 3635098284u, +1980545715u, 825985487u, 3934748116u, 4228386979u, +1480870944u, +1042194545u, +2397771642u, 2248490001u, 3817869868u, 878654626u, +3785629484u, 1672470870u, 3229367873u, 1894538933u, +1010692731u, +1733824268u, +656620328u, 3048283803u, 3353340056u, 2324965120u, +4192585951u, 2284524675u, 3483884368u, 1510168293u, +1554942691u, +1309709396u, +1241133168u, 3162179280u, 4046378054u, 3171681593u, +1165297136u, 3496703563u, 150437903u, 1948622072u, +1076332463u, +2292479143u, +1464229958u, 3479738093u, 2328067598u, 2334503110u, +833324834u, 3981605747u, 3002629155u, 2854644186u, +2832201336u, +95796957u, +3269249397u, 2358313329u, 3411860910u, 4283292480u, +2802208697u, 1305947955u, 2156803420u, 1991340283u, +189678024u, +447602599u, +1055411517u, 1531748363u, 1555852656u, 412402681u, +3774988152u, 20597551u, 2925024131u, 1423989620u, +3749428061u, +1541439448u, +112270416u, 1936224776u, 132162941u, 3772011507u, +3814102518u, 1908807815u, 444154079u, 823765347u, +3362275567u, +3419047430u, +2108287005u, 2315102125u, 658593738u, 3195094029u, +3721937534u, 3176229204u, 3398835373u, 1271898712u, +1142546577u, +3185986817u, +3562705803u, 2046119567u, 912990621u, 1829977672u, +3459576979u, 1118045834u, 1369529376u, 3320601076u, +3954988953u, +4002467635u, +3359456351u, 1314849568u, 1766750942u, 2998874853u, +1181800239u, 707328036u, 3314954697u, 2066721120u, +598194215u, +1124451278u, +3156679616u, 3742684743u, 2960199690u, 2683497915u, +2566077529u, 937014607u, 102095219u, 4262922475u, +3132264275u, +1262099830u, +862722905u, 2717653494u, 3245583534u, 3427209989u, +3220278124u, 85457091u, 2222333500u, 3513997967u, +3522324951u, +2830855552u, +2215004781u, 3482411840u, 4227160614u, 2030964411u, +1741393851u, 2643723748u, 942813508u, 403442675u, +3112048748u, +530556423u, +3817755244u, 3543286628u, 2247276090u, 1532920842u, +4101962711u, 1446540991u, 3297821473u, 1861255389u, +1984398u, +2366525138u, +377589481u, 3549193828u, 1427765914u, 506831657u, +277278988u, 1447652775u, 3214362239u, 3142198690u, +2843087541u, +468915015u, +807895062u, 2198723907u, 4031145069u, 2417156212u, +4027298697u, 637175947u, 1229254212u, 1773257887u, +1659444818u, +451148891u, +2099741368u, 735351990u, 2534775713u, 3261804619u, +712519954u, 3527962772u, 3758642738u, 4245823575u, +1281314264u, +1167866160u, +1489546151u, 1197354389u, 1043278102u, 2563326586u, +371937794u, 2320164817u, 3189512691u, 573685198u, +4108603513u, +3758899588u, +3507030163u, 2947201212u, 2529492585u, 578234375u, +3362349842u, 3318878925u, 3611203517u, 3059253190u, +4270755916u, +4291274625u, +4237586791u, 4137422245u, 2927218651u, 2444687041u, +797128811u, 2043057612u, 396533859u, 2665256178u, +3346510674u, +1779586176u, +3076562062u, 1882746214u, 921095362u, 2026988397u, +514514911u, 3886379478u, 4218272420u, 1480386793u, +3900160816u, +2292273451u, +1276138356u, 1125461821u, 1912885715u, 3365266013u, +1333211627u, 4085009861u, 1390530102u, 3347984752u, +2721771301u, +1419492325u, +4066766256u, 3250852311u, 820111852u, 1382201318u, +2366036798u, 938032241u, 3100979439u, 487048687u, +2292851045u, +3241399180u, +3912670510u, 2416437067u, 2973194517u, 3507707986u, +1935099406u, 2533441488u, 104616731u, 2892622820u, +3801190339u, +4239188808u, +807238241u, 3300121546u, 2249406147u, 4032114017u, +3713738189u, 3324425575u, 4275607376u, 3663120298u, +4173658372u, +3984289690u, +1827636846u, 3264588778u, 3297165529u, 558623533u, +2728945672u, 1566297318u, 3447249966u, 481719551u, +1596842050u, +1838185946u, +265271620u, 1050246315u, 4046655705u, 1844193138u, +3807563245u, 1075384804u, 1292554949u, 1506525927u, +2921816148u, +2051885269u, +1930534041u, 3872721086u, 1564489377u, 2272482181u, +2849358683u, 589618304u, 2262072443u, 290363051u, +299168363u, +3867603931u, +2868688756u, 2545263115u, 1092098533u, 3885725603u, +2352430409u, 1981595469u, 2047946646u, 1332642839u, +793806516u, +214858837u, +1061484659u, 3192394476u, 1115054785u, 3690637234u, +996792368u, 2023479706u, 3046498231u, 4205835102u, +3870714754u, +257472875u, +3549864599u, 2040276129u, 2414778670u, 812235477u, +2674248196u, 1864096101u, 2257492689u, 1332556794u, +1079540713u, +465530720u, +2304763972u, 830724724u, 3354588920u, 2510713652u, +3103749409u, 468835585u, 1707620787u, 3038024846u, +1000303198u, +3462270146u, +2748698899u, 2100348093u, 511537258u, 1237187486u, +102049383u, 2268226698u, 3162251739u, 4219404629u, +838822407u, +1481440623u, +2989224077u, 2676681975u, 3246551821u, 3812079906u, +370572963u, 2283154352u, 3084789986u, 1961085583u, +1955640586u, +2409348147u, +2284780581u, 1634818716u, 4018221729u, 2320761377u, +3566831899u, 1799560520u, 91431959u, 1754113747u, +1459430477u, +3613658517u, +924489906u, 3406317699u, 866289774u, 3924821603u, +1265394945u, 1870668109u, 151949856u, 2747006534u, +3111906201u, +64039467u, +2314447545u, 2600195638u, 4095795204u, 4162096026u, +1026756826u, 2460047982u, 52686887u, 823198739u, +1518045160u, +2867527376u, +566410761u, 2200433819u, 2114146405u, 2893790965u, +881504901u, 974783212u, 490815659u, 937300283u, +1523735309u, +2511976468u, +2634644947u, 355119367u, 1373773092u, 309232995u, +3088671051u, 787126032u, 3442836843u, 4289194567u, +2177850062u, +1174136430u, +3248982914u, 3129039732u, 1166851580u, 2196451882u, +469595580u, 2130837700u, 3783349021u, 3745262548u, +1236930515u, +3032131496u, +1525591437u, 1823628217u, 1939019255u, 1950270463u, +3659899927u, 3688643445u, 3004399289u, 1155199552u, +357547234u, +2213110526u, +3122658210u, 2667800490u, 2718690333u, 3512372076u, +1098611683u, 2657518392u, 4248458835u, 3109874532u, +1592908438u, +2864927516u, +3635248840u, 1251777186u, 3797340158u, 3508496870u, +303354834u, 1482394062u, 2087100120u, 1595931912u, +608574156u, +723367884u, +907938402u, 3357047807u, 1619629851u, 3092082995u, +89030300u, 916336992u, 1861180168u, 3436334155u, +1375000544u, +3472936241u, +1321217853u, 791356402u, 2872410224u, 2326250297u, +2657644088u, 1748314108u, 4146771421u, 2913114440u, +2924821844u, +2101101496u, +3268017251u, 2109603066u, 690665520u, 1830067573u, +951427661u, 2982533150u, 3884512506u, 2358657479u, +2833210784u, +3419798214u, +3785893994u, 2103940206u, 86759766u, 4031230616u, +3745237192u, 2739453927u, 497038072u, 3303159408u, +1251537249u, +1993408196u, +3185905715u, 2885948408u, 3154277110u, 2444150313u, +2505582079u, 2120610195u, 3266465773u, 1814611964u, +3080050407u, +1079915522u, +1819346505u, 2529946763u, 892097374u, 3740257161u, +3618100441u, 1079900094u, 3607172225u, 737863389u, +360704560u, +3341993089u, +1139047381u, 3132219631u, 1248981859u, 1109338159u, +2004908615u, 4022302594u, 4166640860u, 2959140950u, +3949235962u, +2832278473u, +2200524012u, 2634933043u, 2495844522u, 2613799818u, +4034096813u, 683271795u, 1673546817u, 1363163726u, +1805395136u, +511749501u, +1231032599u, 2305979751u, 345737783u, 3339868854u, +2931857933u, 2323251738u, 1332068477u, 51846558u, +3927238177u, +1387182179u, +1701238601u, 1419275173u, 2580882268u, 3357874599u, +1726558907u, 1292901039u, 1371322339u, 1311713044u, +3526735232u, +4017884184u, +3366093428u, 77140994u, 2128996229u, 1357915765u, +4019691901u, 483989024u, 2390311750u, 2766065288u, +3938587520u, +3064810344u, +1054589198u, 1274997019u, 4040589616u, 1277751144u, +2274907047u, 4170399945u, 2886368209u, 4168922115u, +3901237033u, +3252972311u, +2205185840u, 3403097556u, 3385493699u, 2809751370u, +555319628u, 399539034u, 2998971454u, 1521596214u, +178870216u, +1471733541u, +519629198u, 514159209u, 1500582242u, 1928616587u, +2686427928u, 4133138798u, 1225914083u, 1432713584u, +3559310915u, +3925489366u, +1055613123u, 4126676029u, 2723867653u, 3290604111u, +1377022957u, 2373608155u, 3615237379u, 594338683u, +2645257602u, +2408427260u, +917033274u, 750455097u, 625657657u, 121713200u, +2191273413u, 4043949724u, 3293146785u, 3809297972u, +3947296919u, +115456894u, +1529576616u, 1459278275u, 2157117997u, 1747859293u, +4106665903u, 996939232u, 2007976332u, 4274649009u, +1017725787u, +4244666096u, +1219631331u, 3072426253u, 3547691720u, 1620822012u, +1397717508u, 2031597325u, 3345983430u, 2459068000u, +3645130467u, +2308642742u, +359955852u, 1348467968u, 1133123059u, 2435919062u, +2800365907u, 4213217210u, 4056565603u, 2811666556u, +2318007236u, +3823652401u, +3654086429u, 1273260424u, 1591610446u, 943349350u, +3441227678u, 3779964757u, 233818224u, 3469971032u, +3764095096u, +4009204587u, +678472092u, 1990559652u, 2583121088u, 2978143652u, +2496370864u, 2139539656u, 4287972050u, 295832576u, +3536742861u, +2257466133u, +2738052161u, 1988611898u, 2466189642u, 3294419573u, +2311186273u, 474374532u, 3081964174u, 2515138278u, +835731677u, +1178182694u, +3352119543u, 2884763225u, 3462399574u, 2900817210u, +1993698511u, 2868445043u, 2746444849u, 1205258179u, +2353442946u, +4079040070u, +3624133102u, 2907136076u, 2902521697u, 426813211u, +1418185512u, 3711189488u, 1351506552u, 1934749519u, +46595543u, +401688809u, +3514602124u, 1396852607u, 1951477943u, 2502249173u, +3199695820u, 2890250638u, 4205072507u, 1715623846u, +3266686789u, +3218688128u, +1697759742u, 851227671u, 2358709645u, 4174233268u, +500583683u, 3805940955u, 736234120u, 2710563712u, +1949664540u, +3139414003u, +4293073253u, 1284406972u, 1785182449u, 1051548274u, +2994248357u, 2499882522u, 717208669u, 2039517285u, +518424929u, +143136433u, +2303774671u, 1272930860u, 2286410920u, 788459311u, +273225293u, 2439291703u, 2254505236u, 3446287701u, +3655156558u, +1546628787u, +340081500u, 3285722006u, 1324810435u, 1053980860u, +1779472859u, 2700355724u, 686005017u, 3762376315u, +3963193100u, +1370881135u, +661300087u, 1152753704u, 2349891598u, 3910051187u, +2109444785u, 1311123870u, 2639837565u, 1896770931u, +1081414128u, +869877586u, +4284220400u, 63045374u, 235968615u, 184451062u, +1271099822u, 1319179857u, 3274963209u, 4172272710u, +3388797445u, +2965973320u, +3793110097u, 3327241723u, 2991804005u, 1199544355u, +771553759u, 2031749842u, 2596517372u, 1199888213u, +858347951u, +3340178832u, +2903875412u, 763490382u, 76949161u, 2056544406u, +1145227689u, 998233136u, 2354530024u, 427713587u, +3537837347u, +604661755u, +923986833u, 1023730418u, 798294227u, 432557449u, +801802449u, 1861313429u, 3899128441u, 4068407979u, +2352677083u, +3783539925u, +10731973u, 3390767975u, 3949540249u, 1920121661u, +3248580201u, 641956426u, 2104847395u, 604835744u, +1491663404u, +4255204651u, +1520970746u, 2845653368u, 3247412938u, 3730629005u, +855569514u, 3073294700u, 2429691698u, 3818342476u, +3938869985u, +2731201328u, +2335202643u, 778117742u, 13298408u, 228780590u, +2871715314u, 3253688653u, 4150999702u, 3846220408u, +930808u, +1397128726u, +1964216488u, 2781092828u, 116285375u, 2271239476u, +3724347554u, 2931203895u, 3893169206u, 1883912528u, +2093892660u, +3658787024u, +3095016046u, 1094059199u, 3640239610u, 558564267u, +2102812456u, 464734873u, 925262247u, 1609838036u, +588364741u, +1731409233u, +1576165139u, 3933979268u, 375316394u, 4247099643u, +3670508019u, 4080496835u, 2371248533u, 183762693u, +2078935389u, +2699810414u, +1491815683u, 2999180789u, 1831158425u, 1603373553u, +2006136905u, 3210230591u, 416748595u, 1536971415u, +3271869367u, +1266062739u, +2138414557u, 3337114778u, 1634586826u, 36472629u, +4482244u, 568009609u, 2721216780u, 4037289545u, +2235138807u, +1789351460u, +4067539527u, 1323062829u, 3864620647u, 4192026301u, +4278901241u, 1399025382u, 2826652805u, 1363860382u, +1801770651u, +1613381526u, +1165249276u, 4046576622u, 2535596946u, 3260388176u, +1078898578u, 2259750862u, 643387587u, 237144235u, +4199571427u, +3440917581u, +3067939258u, 2018625455u, 1460528353u, 3138629939u, +1666223528u, 3841139376u, 2528281125u, 885565193u, +2609492686u, +2517257479u, +560864620u, 2261471820u, 3491559165u, 1329620416u, +622383582u, 1759597655u, 2877873893u, 584692817u, +1901728399u, +2599000260u, +3169771644u, 296332336u, 774719455u, 4175920823u, +2287316070u, 4115615023u, 1073335619u, 4240292725u, +1359158837u, +1960974237u, +3173724597u, 1619084286u, 2876340752u, 4065675347u, +480741335u, 1237329941u, 701055566u, 3729009837u, +1314736422u, +4003180069u, +3118519317u, 3035354420u, 3380357671u, 4020909015u, +253958714u, 3545798863u, 3008185002u, 2624719888u, +3219955575u, +3060719376u, +573101682u, 1580316843u, 2610493412u, 3490983536u, +3601975611u, 851470366u, 635384901u, 3427048824u, +1470002757u, +3592460087u, +2265226856u, 4124282457u, 2106385486u, 3334305617u, +4208282753u, 3798749815u, 225396466u, 118791182u, +2523395972u, +194595464u, +2563824631u, 2521301383u, 4224409406u, 468670274u, +1761966400u, 1300908277u, 2570709228u, 1847901526u, +1470099163u, +2690466752u, +1472536718u, 2399279735u, 4150607803u, 1775080054u, +2082537685u, 4080034578u, 1256001880u, 392967725u, +2055838940u, +3349115816u, +1745947263u, 2213925887u, 1836572741u, 2417722792u, +636223705u, 2423329294u, 3960951311u, 1543591052u, +1547914361u, +2760945653u, +3519014111u, 313543871u, 4119598884u, 1071003714u, +2192556597u, 1526995535u, 3929839778u, 536388591u, +3040873792u, +3752682932u, +1640614237u, 2432794021u, 385337403u, 2794410617u, +2386128075u, 1055206708u, 1422747714u, 3759330929u, +2533597496u, +30440955u, +1482899460u, 3350385050u, 616259409u, 3980103795u, +1211364140u, 1040071544u, 594746920u, 1645973936u, +2547331531u, +1097726368u, +700666526u, 2976247482u, 1144906608u, 996506677u, +1997130756u, 800321417u, 1392942823u, 1601662248u, +2079778663u, +529512908u, +2925120134u, 4106433085u, 630221833u, 2423086156u, +1119859778u, 1726827981u, 1870859181u, 2559832707u, +1792284257u, +2059356387u, +3572353364u, 3229407475u, 575621095u, 3221893291u, +2372428048u, 2020123035u, 961449593u, 2243824063u, +3803906611u, +3735348189u, +2981620804u, 4180681078u, 1555330629u, 230736535u, +2075526640u, 749652975u, 713664372u, 2152096659u, +2142067223u, +3322302242u, +1421646830u, 2092832615u, 1213735101u, 3192136753u, +1106723940u, 3455398230u, 2541685524u, 2529956739u, +3789430647u, +1950084508u, +2157395621u, 850457360u, 2758902426u, 2848030169u, +6506379u, 1162213157u, 2981459221u, 272690871u, +3059420255u, +4242691285u, +588065598u, 1206949936u, 3968214184u, 566348532u, +126142880u, 1480567086u, 2959621988u, 2050218418u, +2242731195u, +3833514449u, +1898070331u, 3687399477u, 3891859374u, 868185955u, +2335308774u, 3676335246u, 3871121805u, 2189032743u, +3275728647u, +860492892u, +1590764344u, 4130384758u, 262871548u, 3004764525u, +2685542071u, 991231482u, 435122019u, 3031116998u, +2898921700u, +2917932604u, +4238665148u, 2459072654u, 3444612545u, 4207731740u, +1808564313u, 2798532269u, 3944553556u, 3926395409u, +1633200670u, +4138335224u, +2524878605u, 4184292650u, 3563398268u, 4288943552u, +3802121210u, 957502058u, 2410820887u, 4227117506u, +4018625153u, +4284329158u, +530216712u, 2978986531u, 863452221u, 1910162118u, +4088211378u, 4091971261u, 3150811451u, 4200871487u, +3794038652u, +3041564310u, +2045287082u, 887805614u, 2889167251u, 4120352181u, +1699912580u, 3478922097u, 3211994687u, 3136177842u, +1500806861u, +3211881347u, +2147976385u, 3342722260u, 3359650541u, 4197378460u, +781354073u, 1533623029u, 2204677828u, 3228172832u, +3248592437u, +3355841359u, +560815159u, 1144951236u, 4027015711u, 2882625391u, +339363613u, 2354572719u, 1769831876u, 4238589331u, +1519732871u, +2185834614u, +1601096831u, 129709881u, 39655633u, 367604993u, +1737681770u, 3259114599u, 2767070452u, 872365177u, +1574125529u, +3405020189u, +4181346685u, 1134030380u, 403769171u, 2193351164u, +1426232618u, 2885309450u, 3033612627u, 924948363u, +935514094u, +3202053329u, +912294839u, 1618472324u, 4159158431u, 3744999487u, +777064358u, 3974213124u, 1990246048u, 309725290u, +2449849392u, +1943692420u, +2288635750u, 2433793635u, 2168904061u, 683315308u, +3081493019u, 3477759434u, 3815496269u, 2823504699u, +586945121u, +3088963200u, +3492287335u, 636875049u, 1111206944u, 2037346120u, +1282050044u, 1409681512u, 1786128584u, 755810950u, +2332676758u, +2178142310u, +957827166u, 1014983590u, 1888800725u, 3608595803u, +3200072714u, 2534008478u, 659336139u, 1281728287u, +4060560529u, +2915575125u, +3521503774u, 2926487340u, 1096297674u, 653489861u, +2352326980u, 2561136777u, 1224141198u, 1250479629u, +1297625391u, +2409997371u, +1942483722u, 2481835750u, 1394715707u, 1673070941u, +2456039704u, 3980558014u, 3547934764u, 1882038812u, +1078160498u, +2488279087u, +1848235245u, 1211914722u, 2264928765u, 2807773070u, +270145554u, 583747883u, 3826009010u, 2996618216u, +425727157u, +992726957u, +3384462280u, 726650661u, 1955043265u, 1923879512u, +1854693773u, 2987614542u, 2660044993u, 2457260810u, +426299370u, +2671892900u, +1827308087u, 3083953443u, 1791749638u, 3265087416u, +2119752201u, 2547122538u, 3990783236u, 1912713468u, +3688865211u, +1815780016u, +303699291u, 2416763742u, 2690891610u, 1535193548u, +1107803989u, 1504143133u, 2235270371u, 2545884083u, +2276278682u, +411724404u, +3416925704u, 2565792091u, 3383911757u, 546058824u, +3374654444u, 2364630415u, 2693473470u, 2622125691u, +261864817u, +55682470u, +857617568u, 141304067u, 1885488541u, 155368182u, +1281949051u, 3384522408u, 3254816901u, 1959816782u, +1452224057u, +2830267691u, +3709231247u, 58988202u, 4218130458u, 2984061349u, +1888707848u, 4223605071u, 4241442486u, 375269213u, +3208327038u, +2199916493u, +550337252u, 2855061437u, 276088636u, 114362204u, +2321163647u, 2127813633u, 3289403024u, 2686973202u, +2717376797u, +3593428039u, +3648831666u, 890925902u, 3289404818u, 3289516821u, +4248913260u, 1858916580u, 3303932308u, 1752797086u, +1628149686u, +3245893605u, +1568537311u, 2844194502u, 1593855770u, 2408174109u, +124797514u, 2085649512u, 3188565660u, 2264996276u, +1926696513u, +3053957740u, +2238806881u, 2189050973u, 203685243u, 379855590u, +3920271562u, 1058600179u, 3698061923u, 4255106849u, +608401664u, +1598041932u, +3318266418u, 2535016555u, 852760884u, 1918098822u, +2200437599u, 1532285043u, 3425662132u, 3561293706u, +2231633206u, +4108785088u, +3359152801u, 173534780u, 208383607u, 2862988169u, +2406642243u, 426814583u, 2777335795u, 3322703596u, +954190623u, +615093090u, +4179102978u, 2452847930u, 100239619u, 42471741u, +818352432u, 2190624654u, 504379960u, 3631619975u, +633412456u, +1018421783u, +842645419u, 711808707u, 3424580813u, 2132457941u, +1158335882u, 3567952480u, 2302183699u, 1145788151u, +3474264138u, +3105085243u, +3115506027u, 2783713015u, 3871785309u, 539583269u, +1400252405u, 3857849984u, 4231186588u, 1278653799u, +1760227022u, +761044088u, +3838185417u, 2439542532u, 585283357u, 2055995220u, +937117124u, 3831944855u, 1823586038u, 3287917855u, +485082427u, +3209172809u, +1984570176u, 2818337297u, 2691869057u, 3790476953u, +839035557u, 3203129010u, 669981176u, 4121157385u, +3519870450u, +3792633352u, +3017650322u, 1603459507u, 4225677666u, 376555451u, +473780127u, 2018786277u, 3299822439u, 1010254499u, +2383887565u, +3155009499u, +3108110655u, 2641738274u, 3684908622u, 1606463047u, +3311068174u, 52708046u, 754181455u, 1018079176u, +3915670272u, +3366999425u, +1012880204u, 1339439715u, 466437962u, 1402662350u, +2504046911u, 736323938u, 2037800124u, 1725908589u, +716341840u, +1750123474u, +3366342464u, 1743666195u, 2975303189u, 3821364027u, +3253707772u, 3635548377u, 3840413796u, 1955642085u, +1018315169u, +1258092848u, +2095540656u, 1076256607u, 117289557u, 1311658655u, +2118301000u, 68721550u, 2886814107u, 2712432819u, +4201862886u, +753807148u, +1940229047u, 731347296u, 1068901393u, 3873155894u, +2852787666u, 1973464853u, 79735652u, 3966380587u, +3245740712u, +2525773438u, +734938109u, 3045656416u, 3335746354u, 4099732691u, +1911896517u, 1697006473u, 1145487066u, 1605663299u, +3053606724u, +2386289465u, +3821211369u, 1006215345u, 1256304829u, 1053001668u, +1289194958u, 118761054u, 1853688730u, 2803418011u, +188650809u, +3763686458u, +1006829556u, 2961984133u, 3390525025u, 2061199893u, +141792681u, 2439893463u, 2652982650u, 1804942682u, +1546510005u, +1246961405u, +2407577046u, 565772575u, 3751844810u, 2943166103u, +3750052451u, 3022527280u, 25162928u, 397381043u, +1818337632u, +3447363730u, +3936437150u, 2569420703u, 2215592390u, 2171555672u, +3665571006u, 4021712412u, 2939158353u, 4057813172u, +1823237318u, +103999245u, +3251978010u, 3591914940u, 3582495283u, 2519035265u, +3905726135u, 3180393349u, 2743117123u, 55247368u, +3325286701u, +705195946u, +1857526853u, 1480518550u, 3809990433u, 1398189338u, +3126362926u, 3959531492u, 1503658285u, 1977847740u, +3043964489u, +2613086143u, +1518119282u, 4238434900u, 3905746486u, 3064949667u, +1028122931u, 3309119457u, 4071194920u, 3096098907u, +4137180520u, +494467959u, +1231408687u, 1691606157u, 1793452569u, 2722196118u, +3478603952u, 1059665738u, 2282032278u, 3990268388u, +1719514651u, +4248311578u, +3799146721u, 898026304u, 3367808954u, 4162472815u, +170495870u, 1308116609u, 3428285344u, 1714716475u, +395576794u, +4153638621u, +2999745812u, 3483315953u, 304980828u, 595337120u, +3486516729u, 2331563143u, 2583609459u, 1885928417u, +3834283777u, +979337825u, +932057378u, 3124081189u, 1930356777u, 3865887996u, +4178282217u, 4214219408u, 3669465884u, 1472413856u, +3356866587u, +1012769806u, +3043639963u, 996996396u, 207308216u, 982967331u, +2991319933u, 318066902u, 721489670u, 1249967713u, +749240921u, +591392325u, +2379365192u, 2250868849u, 2163259329u, 143191325u, +3778285606u, 982149096u, 3536906200u, 2244353244u, +1443862317u, +3161549210u, +2183127464u, 2015409516u, 547003700u, 2032484282u, +523677821u, 4275663308u, 3827205526u, 3903778273u, +2444530525u, +2543645801u, +1173958423u, 784740616u, 2878693675u, 3127696736u, +3832037316u, 3161002398u, 4084166400u, 4213346853u, +223390424u, +4273380883u, +2130315482u, 3429606032u, 3367732613u, 1912357694u, +422632590u, 1266957023u, 3437535648u, 736404240u, +2281709372u, +415859912u, +212948797u, 351612650u, 3920561440u, 112963586u, +2230727543u, 2851076612u, 1990662634u, 2264296857u, +3131463650u, +2704034623u, +3541637839u, 2954232792u, 533986918u, 4158757533u, +65174248u, 4232639593u, 865906667u, 1948225652u, +779656112u, +3873989249u, +2372984749u, 2346988193u, 1104345713u, 1165654138u, +4045762610u, 3588205178u, 461363991u, 1111215752u, +1389675192u, +2404325151u, +2152228101u, 3808973622u, 1901235912u, 3458690696u, +314513238u, 2539459143u, 2847998873u, 952026138u, +2325705328u, +407844712u, +3727960715u, 2996448351u, 2374336760u, 3138756390u, +2600015243u, 539980418u, 1876285352u, 1670330799u, +1709360377u, +2868531654u, +494777964u, 2773053597u, 599486162u, 3962209577u, +1871328846u, 2171933018u, 110279472u, 384074780u, +4147021936u, +2333589647u, +4251778066u, 40493468u, 3099342316u, 4108779767u, +2812424588u, 954542332u, 2040682331u, 2251152306u, +45915516u, +259525626u, +1045384743u, 4134656562u, 749389261u, 874399445u, +616549904u, 2200447504u, 436024539u, 78972290u, +3210485762u, +1907985531u, +3013721395u, 4214533685u, 4198804243u, 534879265u, +1517190881u, 3756787754u, 1152563554u, 1718750948u, +777737463u, +1402478860u, +1824562784u, 1879401449u, 3515818786u, 513165201u, +1423491227u, 2103067918u, 2291777410u, 1097943000u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashcc::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashcc::Hash32(data, len++)); { uint128_t u = farmhashcc::Fingerprint128(data, len++); uint64_t h = Uint128Low64(u); IsAlive(h >> 32); IsAlive((h << 32) >> 32); h = Uint128High64(u); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +Check(farmhashcc::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashcc::Hash32(data + offset, len)); +{ uint128_t u = farmhashcc::Fingerprint128(data + offset, len); uint64_t h = Uint128Low64(u); Check(h >> 32); Check((h << 32) >> 32); h = Uint128High64(u); Check(h >> 32); Check((h << 32) >> 32); } +{ uint128_t u = farmhashcc::CityHash128WithSeed(data + offset, len, Uint128(SEED0, SEED1)); uint64_t h = Uint128Low64(u); Check(h >> 32); Check((h << 32) >> 32); h = Uint128High64(u); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashccTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashcc::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashcc::Hash32(data + offset, len) << "u," << endl; +{ uint128_t u = farmhashcc::Fingerprint128(data + offset, len); uint64_t h = Uint128Low64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u, "; h = Uint128High64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint128_t u = farmhashcc::CityHash128WithSeed(data + offset, len, Uint128(SEED0, SEED1)); uint64_t h = Uint128Low64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u, "; h = Uint128High64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashccTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashccTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashccTest::Dump(0, i); + } + farmhashccTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashmkTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +4223616069u, +3696677242u, +4081014168u, +2576519988u, +2212771159u, +1112731063u, +1020067935u, +3955445564u, +1451961420u, +653440099u, +31917516u, +2957164615u, +2590087362u, +3879448744u, +176305566u, +2447367541u, +1359016305u, +3363804638u, +1117290165u, +1062549743u, +2437877004u, +1894455839u, +673206794u, +3486923651u, +3269862919u, +2303349487u, +1380660650u, +595525107u, +1525325287u, +2025609358u, +176408838u, +1592885012u, +864896482u, +2101378090u, +3489229104u, +2118965695u, +581644891u, +2718789079u, +631613207u, +4228658372u, +3867875546u, +3531368319u, +3804516756u, +3317755099u, +1619744564u, +2884717286u, +1088213445u, +2667691076u, +3727873235u, +2330406762u, +3616470388u, +967660719u, +4148162586u, +315219121u, +673084328u, +3047602355u, +1598963653u, +1267826661u, +2117362589u, +2861192253u, +1823625377u, +1380350078u, +1641748342u, +1176094482u, +269384321u, +2178982315u, +3480237248u, +2660755208u, +1850544433u, +3429699438u, +1262819303u, +640556464u, +2421125401u, +2188368608u, +2612932825u, +1474432581u, +173790449u, +2124882189u, +831272654u, +622960146u, +4238751051u, +3250317967u, +2120810248u, +1948231495u, +1389029321u, +2200398357u, +2134232963u, +2948072329u, +617717625u, +681164587u, +114859387u, +430545646u, +57239089u, +3163338012u, +3482496399u, +557662576u, +1102441413u, +2670159360u, +991116729u, +846014240u, +4233741566u, +1802317242u, +3129528802u, +1459456375u, +1305643039u, +3258671612u, +1578285833u, +868590079u, +1631034517u, +1695432937u, +561078856u, +1004115553u, +3086090507u, +3818348650u, +731596645u, +780926790u, +2544205955u, +158479164u, +3983514188u, +2004735250u, +3436218400u, +673684751u, +1463431419u, +2880490219u, +3223748024u, +2218318859u, +1474466194u, +2636437533u, +2206794961u, +140995728u, +1186394086u, +1805716888u, +1640037724u, +3942729099u, +1944727013u, +918951560u, +498666871u, +3486974657u, +2967205462u, +1167253804u, +1884281041u, +2866015002u, +4158319270u, +2627220079u, +3733319624u, +3317092271u, +438323662u, +3195868065u, +3426606709u, +360708338u, +1905491012u, +650004803u, +1351266252u, +3133279000u, +3722811115u, +2722412434u, +918432408u, +3678271248u, +269599647u, +621514057u, +3117077855u, +1545425390u, +2597567410u, +1221437820u, +3493254589u, +102787342u, +918861168u, +348795089u, +3439883229u, +2353641807u, +2209585469u, +4035884492u, +2686995435u, +1649888022u, +3852893848u, +3042700028u, +314103172u, +726977769u, +2489830276u, +2872753660u, +1316214989u, +1488801501u, +1811420390u, +639581627u, +2362837215u, +3634581834u, +3648576802u, +1257314182u, +762118371u, +4268447045u, +730167096u, +755561509u, +882614845u, +3696972894u, +228263661u, +1478636142u, +2767751651u, +1532617116u, +3838657661u, +1944359935u, +1401102137u, +3772933173u, +1050098254u, +1658079354u, +1846025728u, +2204244794u, +2017217424u, +1275162853u, +1429816745u, +2175565479u, +1716109139u, +1187506761u, +2434641075u, +2725597783u, +1795687662u, +1393312782u, +3511565397u, +627885430u, +4145733164u, +2519005353u, +231414775u, +1242015635u, +2760723497u, +2185540568u, +727314436u, +2358790354u, +1186393454u, +4234795645u, +350567813u, +866773875u, +3145590392u, +1158374055u, +3903123687u, +1862119793u, +2204587556u, +4266276976u, +4151548555u, +915250402u, +2874695320u, +2360311410u, +1099212769u, +1271542714u, +3473148363u, +1637325418u, +1807795989u, +2493819794u, +3800917924u, +4001205856u, +2582153621u, +3365872040u, +2890146216u, +2626363824u, +3133351295u, +4046827296u, +3053118771u, +4113026751u, +884356716u, +3828347401u, +10608262u, +830987972u, +1841080500u, +3202717763u, +3561778749u, +1906000052u, +3058284660u, +1432904514u, +2567431677u, +2550162530u, +665557986u, +936887821u, +2101205308u, +4253535847u, +1662043545u, +1253611611u, +2091370094u, +2635077370u, +2602176041u, +3624115809u, +748442714u, +2709749154u, +1023493343u, +860291012u, +3924715584u, +1536436740u, +2551145800u, +2391782865u, +1467705048u, +2583909796u, +3616666170u, +1162857372u, +4228631071u, +1510132376u, +2739165009u, +2656606142u, +3454996358u, +3155038853u, +1022087316u, +100044110u, +494208296u, +2746186477u, +4216782431u, +225448834u, +3728320521u, +335282866u, +3148194874u, +953503703u, +1293353960u, +202372387u, +1326119870u, +4045123735u, +3819994846u, +1629004186u, +1081099186u, +3591584153u, +1670825804u, +3404257979u, +3262192301u, +2572846095u, +3714992543u, +4264142572u, +529616678u, +2882154574u, +3006354178u, +3865969421u, +2007174907u, +308283107u, +2629833703u, +3159124075u, +1146492131u, +494104332u, +493149727u, +1342910585u, +521642387u, +2201695937u, +2517980959u, +2426821287u, +777374655u, +2228189792u, +4027055486u, +228976000u, +3842083468u, +1723920223u, +1192126094u, +787744493u, +2740368380u, +2284153001u, +2773829458u, +442000614u, +387830783u, +2169780670u, +2253144627u, +3532502484u, +1969684059u, +1165351416u, +3055056536u, +3582324253u, +231419363u, +770979865u, +3213983597u, +3690452836u, +935794639u, +3230602762u, +2841762457u, +407598927u, +1164479891u, +3721799696u, +354738136u, +1801566618u, +3206038542u, +2621379981u, +1943487262u, +3534745636u, +1074424589u, +1304517521u, +4133400969u, +2339317978u, +2135116860u, +4180643791u, +2415309340u, +1855926417u, +3418648630u, +1968113037u, +597304222u, +3668824865u, +3810008716u, +3014702569u, +3151212026u, +156057449u, +373134533u, +2068234004u, +191580563u, +3832754488u, +2924104199u, +2026044494u, +4065780435u, +122565840u, +4194985167u, +2744823717u, +2494098735u, +3753793370u, +1885739217u, +2488161225u, +3643797615u, +2653367310u, +2494061477u, +189968132u, +899646597u, +392100396u, +4012318310u, +3855777086u, +3566860954u, +2698574996u, +2414249905u, +1330623339u, +1263222732u, +1277741760u, +2194959402u, +1629656136u, +120494320u, +1072368005u, +1084245077u, +4011372748u, +1366613353u, +3108643228u, +3332219532u, +2114746095u, +3964007334u, +371687128u, +1084813876u, +126459896u, +4292782331u, +321283184u, +398168499u, +3604983506u, +560701543u, +2073961354u, +4240841868u, +4151211362u, +1338986875u, +4093476832u, +2269279497u, +3500846299u, +2510225147u, +598000444u, +1330391422u, +1432533385u, +4171226231u, +426821154u, +2932270996u, +3378981077u, +2217871549u, +1619647984u, +4051608043u, +3180237819u, +12919578u, +1375401767u, +371320427u, +2986640571u, +2336669859u, +3796464715u, +1892383284u, +306814912u, +2125823211u, +1863678891u, +3249703818u, +3840225752u, +281579900u, +264680257u, +4266359110u, +4182229890u, +2239659703u, +3627947372u, +2373929191u, +224082765u, +4053639058u, +1862360303u, +3187739624u, +3392706679u, +948039509u, +817505760u, +1215842393u, +3462222651u, +536021853u, +182346832u, +2731944883u, +2346674384u, +2640961678u, +3446695687u, +2271722179u, +1301069656u, +2803881468u, +2832614405u, +1691544398u, +698756814u, +3980620906u, +3565421410u, +754769376u, +4115923404u, +3909962218u, +2747614077u, +2888289845u, +1016920862u, +2790946178u, +3067070960u, +3173251481u, +1572132982u, +255048203u, +2996538818u, +3405398987u, +136106013u, +3581605228u, +4277437977u, +2147300534u, +3728426265u, +3483629996u, +1478452694u, +20756076u, +2774992067u, +432987927u, +1516771026u, +3511588664u, +2130994978u, +509385406u, +873090347u, +2163904107u, +4192239086u, +2532489989u, +1090772651u, +3910797408u, +3710882132u, +155010959u, +1369823531u, +1599664937u, +4035593587u, +1212746925u, +795822552u, +116689518u, +3674240941u, +1135576664u, +756750261u, +1027431362u, +390555140u, +2228460216u, +1506940482u, +3733857700u, +3048762971u, +2511703196u, +548609887u, +1607354252u, +659053982u, +259884450u, +1793130460u, +4083364495u, +3148555881u, +1764350138u, +2436485683u, +4031563025u, +3261860724u, +2475833430u, +2101726086u, +3191176464u, +2646658847u, +2127042126u, +771316100u, +2115922959u, +3208515045u, +2355437783u, +3621147793u, +1580163615u, +3211555675u, +3299188490u, +191613920u, +466733956u, +2939029038u, +1509152039u, +130591314u, +1892874677u, +1646908044u, +3452406523u, +3998376606u, +1199243832u, +2187108812u, +3189230066u, +4161151481u, +3371454980u, +3681788646u, +180842187u, +3685022399u, +3058749895u, +3250165163u, +2895367943u, +2627101723u, +771755098u, +1332921024u, +3638871848u, +514215135u, +3591227378u, +2300310870u, +3689533503u, +851607114u, +114330368u, +2709027386u, +1743034877u, +1013693860u, +288169008u, +3545190686u, +1052165084u, +3995862307u, +96902755u, +1097819851u, +2645431442u, +2184148618u, +2151206566u, +350979797u, +3467920900u, +421116779u, +1246252u, +4057835428u, +329324407u, +4104482417u, +844624570u, +3306265806u, +3787625025u, +4263241191u, +3251413927u, +2921204431u, +2931915325u, +992134330u, +3986338354u, +1327895216u, +1458363596u, +1480608532u, +728594368u, +3804366693u, +794404223u, +1643240863u, +793417255u, +4167916443u, +2683488959u, +3124925324u, +4184843652u, +3750971752u, +308509829u, +1054550805u, +2797511972u, +4043123412u, +1587158240u, +4050518606u, +3030062190u, +2589912753u, +603440067u, +937013191u, +1071662315u, +2100661456u, +2602005741u, +435516078u, +2260470147u, +1256268350u, +3612035u, +3368856141u, +151516099u, +3081868591u, +3363755681u, +2049963149u, +2885320434u, +84682005u, +2411758308u, +2695174275u, +3099904644u, +1787308684u, +1132379308u, +564634346u, +510236510u, +2804443681u, +3931864252u, +2064427949u, +1893979229u, +2916544974u, +1885887717u, +2978018250u, +494192125u, +2642662373u, +901112508u, +636035003u, +1658643797u, +172746975u, +517504890u, +3440019372u, +4144498044u, +1854755456u, +3672653905u, +4176892856u, +382159097u, +282871690u, +3629300472u, +2500754041u, +1677659759u, +1067175061u, +161654075u, +1672575536u, +346120493u, +2730229631u, +203466442u, +1244549529u, +199761971u, +2744895408u, +3195315331u, +2124618519u, +3261045496u, +985339699u, +3385585455u, +1545740710u, +3636652160u, +2167020081u, +1207897204u, +28752417u, +2895834146u, +3640845375u, +3750293073u, +548997850u, +4207814196u, +4183030708u, +2462810989u, +3929965401u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashmk::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashmk::Hash32(data, len++)); IsAlive(farmhashmk::Hash32(data, len++)); len -= 3; return alive > 0; } +Check(farmhashmk::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashmk::Hash32(data + offset, len)); + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashmkTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashmk::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashmk::Hash32(data + offset, len) << "u," << endl; +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashmkTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashmkTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashmkTest::Dump(0, i); + } + farmhashmkTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashnaTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +1140953930u, 861465670u, +3277735313u, 2681724312u, +2598464059u, 797982799u, +890626835u, 800175912u, +2603993599u, 921001710u, +1410420968u, 2134990486u, +3283896453u, 1867689945u, +2914424215u, 2244477846u, +255297188u, 2992121793u, +1110588164u, 4186314283u, +161451183u, 3943596029u, +4019337850u, 452431531u, +283198166u, 2741341286u, +3379021470u, 2557197665u, +299850021u, 2532580744u, +452473466u, 1706958772u, +1298374911u, 3099673830u, +2199864459u, 3696623795u, +236935126u, 2976578695u, +4055299123u, 3281581178u, +1053458494u, 1882212500u, +2305012065u, 2169731866u, +3456121707u, 275903667u, +458884671u, 3033004529u, +3058973506u, 2379411653u, +1898235244u, 1402319660u, +2700149065u, 2699376854u, +147814787u, 720739346u, +2433714046u, 4222949502u, +4220361840u, 1712034059u, +3425469811u, 3690733394u, +4148372108u, 1330324210u, +594028478u, 2921867846u, +1635026870u, 192883107u, +780716741u, 1728752234u, +3280331829u, 326029180u, +3969463346u, 1436364519u, +393215742u, 3349570000u, +3824583307u, 1612122221u, +2859809759u, 3808705738u, +1379537552u, 1646032583u, +2233466664u, 1432476832u, +4023053163u, 2650381482u, +2052294713u, 3552092450u, +1628777059u, 1499109081u, +3476440786u, 3829307897u, +2960536756u, 1554038301u, +1145519619u, 3190844552u, +2902102606u, 3600725550u, +237495366u, 540224401u, +65721842u, 489963606u, +1448662590u, 397635823u, +1596489240u, 1562872448u, +1790705123u, 2128624475u, +180854224u, 2604346966u, +1435705557u, 1262831810u, +155445229u, 1672724608u, +1669465176u, 1341975128u, +663607706u, 2077310004u, +3610042449u, 1911523866u, +1043692997u, 1454396064u, +2563776023u, 294527927u, +1099072299u, 1389770549u, +703505868u, 678706990u, +2952353448u, 2026137563u, +3603803785u, 629449419u, +1933894405u, 3043213226u, +226132789u, 2489287368u, +1552847036u, 645684964u, +3828089804u, 3632594520u, +187883449u, 230403464u, +3151491850u, 3272648435u, +3729087873u, 1303930448u, +2002861219u, 165370827u, +916494250u, 1230085527u, +3103338579u, 3064290191u, +3807265751u, 3628174014u, +231181488u, 851743255u, +2295806711u, 1781190011u, +2988893883u, 1554380634u, +1142264800u, 3667013118u, +1968445277u, 315203929u, +2638023604u, 2290487377u, +732137533u, 1909203251u, +440398219u, 1891630171u, +1380301172u, 1498556724u, +4072067757u, 4165088768u, +4204318635u, 441430649u, +3931792696u, 197618179u, +956300927u, 914413116u, +3010839769u, 2837339569u, +2148126371u, 1913303225u, +3074915312u, 3117299654u, +4139181436u, 2993479124u, +3178848746u, 1357272220u, +1438494951u, 507436733u, +667183474u, 2084369203u, +3854939912u, 1413396341u, +126024219u, 146044391u, +1016656857u, 3022024459u, +3254014218u, 429095991u, +165589978u, 1578546616u, +985653208u, 1718653828u, +623071693u, 366414107u, +249776086u, 1207522198u, +3047342438u, 2991127487u, +3120876698u, 1684583131u, +46987739u, 1157614300u, +863214540u, 1087193030u, +199124911u, 520792961u, +3614377032u, 586863115u, +3331828431u, 1013201099u, +1716848157u, 4033596884u, +1164298657u, 4140791139u, +1146169032u, 1434258493u, +3824360466u, 3242407770u, +3725511003u, 232064808u, +872586426u, 762243036u, +2736953692u, 816692935u, +512845449u, 3748861010u, +2266795890u, 3781899767u, +4290630595u, 517646945u, +22638523u, 648000590u, +959214578u, 558910384u, +1283799121u, 3047062993u, +1024246061u, 4027776454u, +3544509313u, 622325861u, +834785312u, 382936554u, +411505255u, 1973395102u, +1825135056u, 2725923798u, +580988377u, 2826990641u, +3474970689u, 1029055034u, +812546227u, 2506885666u, +2584372201u, 1758123094u, +589567754u, 325737734u, +345313518u, 2022370576u, +3886113119u, 3338548567u, +257578986u, 3698087965u, +1776047957u, 1771384107u, +3604937815u, 3198590202u, +2305332220u, 191910725u, +4232136669u, 427759438u, +4244322689u, 542201663u, +3315355162u, 2135941665u, +556609672u, 45845311u, +1175961330u, 3948351189u, +23075771u, 3252374102u, +1634635545u, 4151937410u, +713127376u, 1467786451u, +663013031u, 3444053918u, +2638154051u, 810082938u, +3077742128u, 1062268187u, +2115441882u, 4081398201u, +3735739145u, 2794294783u, +2335576331u, 2560479831u, +1379288194u, 4225182569u, +2442302747u, 3948961926u, +3958366652u, 3067277639u, +3667516477u, 1709989541u, +1516711748u, 2339636583u, +4188504038u, 59581167u, +2725013602u, 3639843023u, +2658147000u, 2643979752u, +3758739543u, 4189944477u, +2470483982u, 877580602u, +2995362413u, 118817200u, +3252925478u, 2062343506u, +3981838403u, 3762572073u, +1231633714u, 4168280671u, +2931588131u, 3284356565u, +1129162571u, 732225574u, +4173605289u, 1407328702u, +1677744031u, 3532596884u, +3232041815u, 1652884780u, +2256541290u, 3459463480u, +3740979556u, 259034107u, +2227121257u, 1426140634u, +3606709555u, 3424793077u, +315836068u, 3200749877u, +1386256573u, 24035717u, +2982018998u, 1811050648u, +234531934u, 1115203611u, +1598686658u, 3146815575u, +1603559457u, 323296368u, +2632963283u, 1778459926u, +739944537u, 579625482u, +3486330348u, 492621815u, +1231665285u, 2457048126u, +3903349120u, 389846205u, +3355404249u, 3275550588u, +1052645068u, 862072556u, +2834153464u, 1481069623u, +2657392572u, 4279236653u, +1688445808u, 701920051u, +3740748788u, 3388062747u, +1873358321u, 2152785640u, +883382081u, 1005815394u, +1020177209u, 734239551u, +2371453141u, 100326520u, +3488500412u, 1279682138u, +2610427744u, 49703572u, +3026361211u, 605900428u, +302392721u, 2509302188u, +1416453607u, 2815915291u, +1862819968u, 519710058u, +2450888314u, 4017598378u, +937074653u, 3035635454u, +1590230729u, 3268013438u, +2710029305u, 12886044u, +3711259084u, 2627383582u, +3895772404u, 648534979u, +260307902u, 855990313u, +3669691805u, 263366740u, +2938543471u, 414331688u, +3080542944u, 3405007814u, +3565059103u, 1190977418u, +390836981u, 1606450012u, +2649808239u, 2514169310u, +2747519432u, 4129538640u, +1721522849u, 492099164u, +792990594u, 3625507637u, +2271095827u, 2993032712u, +2302363854u, 4013112951u, +1111617969u, 2183845740u, +795918276u, 1116991810u, +3110898804u, 3963062126u, +2737064702u, 462795667u, +937372240u, 1343017609u, +1091041189u, 2790555455u, +277024217u, 25485284u, +1166522068u, 1623631848u, +241727183u, 2836158787u, +3112996740u, 573836428u, +2721658101u, 1937681565u, +4175169209u, 3190765433u, +1970000788u, 1668258120u, +114616703u, 954762543u, +199237753u, 4094644498u, +2522281978u, 732086117u, +1756889687u, 2936126607u, +2437031370u, 4103143808u, +3883389541u, 3171090854u, +2483004780u, 1927385370u, +2360538162u, 2740855009u, +4241185118u, 1492209542u, +1672737098u, 2148675559u, +1789864670u, 2434313103u, +2319172611u, 2760941207u, +2636210123u, 1338083267u, +1128080590u, 822806371u, +1199583556u, 314727461u, +1335160250u, 2084630531u, +1156261526u, 316766066u, +112090465u, 3129033323u, +2746885618u, 636616055u, +2582210744u, 1721064910u, +3468394263u, 470463518u, +2076016059u, 408721884u, +2121041886u, 378460278u, +1915948002u, 357324860u, +2301682622u, 2691859523u, +1869756364u, 2429314418u, +2193146527u, 1185564327u, +2614088922u, 1975527044u, +919067651u, 2855948894u, +3662539576u, 1943802836u, +3529473373u, 1490330107u, +366036094u, 3384241033u, +4276268604u, 448403661u, +4271796078u, 1910401882u, +3077107698u, 299427366u, +2035665349u, 3201262636u, +3738454258u, 2554452696u, +3588997135u, 3363895827u, +1267505995u, 1852004679u, +2237827073u, 2803250686u, +3468044908u, 2143572850u, +1728158656u, 1022551180u, +1996680960u, 839529273u, +2400647871u, 2201096054u, +3606433628u, 2597259793u, +3544595875u, 3909443124u, +819278607u, 3447346709u, +806136613u, 2711436388u, +3656063205u, 837475154u, +694525336u, 4070212073u, +4011303412u, 1068395209u, +438095290u, 484603494u, +2673730227u, 737767009u, +642310823u, 3914002299u, +308425103u, 268427550u, +1334387085u, 4069797497u, +4280783219u, 2914011058u, +4243643405u, 2849988118u, +2504230175u, 1817156623u, +2804200483u, 3406991497u, +2948254999u, 2102063419u, +1071272117u, 514889942u, +571972433u, 1246595599u, +1735616066u, 1539151988u, +1230831543u, 277987182u, +4269526481u, 991511607u, +95237878u, 2005032160u, +1291113144u, 626619670u, +3560835907u, 164940926u, +1433635018u, 116647396u, +3039097112u, 2868163232u, +1141645918u, 1764165478u, +881378302u, 2159170082u, +2953647681u, 1011320066u, +184856151u, 1723308975u, +336034862u, 2017579106u, +1476681709u, 147523618u, +3896252223u, 2264728166u, +944743644u, 1694443528u, +2690700128u, 1947321519u, +735478508u, 4058183171u, +260177668u, 505662155u, +2391691262u, 1920739747u, +3216960415u, 1898176786u, +3722741628u, 1511077569u, +449636564u, 983350414u, +2580237367u, 2055059789u, +1103819072u, 2089123665u, +3873755579u, 2718467458u, +3124338704u, 3204250304u, +2475035432u, 1120017626u, +3873758287u, 1982999824u, +2950794582u, 780634378u, +2842141483u, 4029205195u, +1656892865u, 3330993377u, +80890710u, 1953796601u, +3873078673u, 136118734u, +2317676604u, 4199091610u, +1864448181u, 3063437608u, +1699452298u, 1403506686u, +1513069466u, 2348491299u, +4273657745u, 4055855649u, +1805475756u, 2562064338u, +973124563u, 4197091358u, +172861513u, 2858726767u, +4271866024u, 3071338162u, +3590386266u, 2328277259u, +1096050703u, 1189614342u, +459509140u, 771592405u, +817999971u, 3740825152u, +520400189u, 1941874618u, +185232757u, 4032960199u, +3928245258u, 3527721294u, +1301118856u, 752188080u, +3512945009u, 308584855u, +2105373972u, 752872278u, +3823368815u, 3760952096u, +4250142168u, 2565680167u, +3646354146u, 1259957455u, +1085857127u, 3471066607u, +38924274u, 3770488806u, +1083869477u, 3312508103u, +71956383u, 3738784936u, +3099963860u, 1255084262u, +4286969992u, 3621849251u, +1190908967u, 1831557743u, +2363435042u, 54945052u, +4059585566u, 4023974274u, +1788578453u, 3442180039u, +2534883189u, 2432427547u, +3909757989u, 731996369u, +4168347425u, 1356028512u, +2741583197u, 1280920000u, +312887059u, 3259015297u, +3946278527u, 4135481831u, +1281043691u, 1121403845u, +3312292477u, 1819941269u, +1741932545u, 3293015483u, +2127558730u, 713121337u, +2635469238u, 486003418u, +4015067527u, 2976737859u, +2108187161u, 927011680u, +1970188338u, 4177613234u, +1799789551u, 2118505126u, +4134691985u, 1958963937u, +1929210029u, 2555835851u, +2768832862u, 910892050u, +2567532373u, 4075249328u, +86689814u, 3726640307u, +1392137718u, 1240000030u, +4104757832u, 3026358429u, +313797689u, 1435798509u, +3101500919u, 1241665335u, +3573008472u, 3615577014u, +3767659003u, 3134294021u, +4063565523u, 2296824134u, +1541946015u, 3087190425u, +2693152531u, 2199672572u, +2123763822u, 1034244398u, +857839960u, 2515339233u, +2228007483u, 1628096047u, +2116502287u, 2502657424u, +2809830736u, 460237542u, +450205998u, 3646921704u, +3818199357u, 1808504491u, +1950698961u, 2069753399u, +3657033172u, 3734547671u, +4067859590u, 3292597295u, +1106466069u, 356742959u, +2469567432u, 3495418823u, +183440071u, 3248055817u, +3662626864u, 1750561299u, +3926138664u, 4088592524u, +567122118u, 3810297651u, +992181339u, 3384018814u, +3272124369u, 3177596743u, +320086295u, 2316548367u, +100741310u, 451656820u, +4086604273u, 3759628395u, +2553391092u, 1745659881u, +3650357479u, 2390172694u, +330172533u, 767377322u, +526742034u, 4102497288u, +2088767754u, 164402616u, +2482632320u, 2352347393u, +1873658044u, 3861555476u, +2751052984u, 1767810825u, +20037241u, 545143220u, +2594532522u, 472304191u, +3441135892u, 3323383489u, +258785117u, 2977745165u, +2781737565u, 2963590112u, +2756998822u, 207428029u, +2581558559u, 3824717027u, +1258619503u, 3472047571u, +2648427775u, 2360400900u, +2393763818u, 2332399088u, +3932701729u, 884421165u, +1396468647u, 1377764574u, +4061795938u, 1559119087u, +3343596838u, 3604258095u, +1435134775u, 1099809675u, +908163739u, 1418405656u, +368446627u, 3741651161u, +3374512975u, 3542220540u, +3244772570u, 200009340u, +3198975081u, 2521038253u, +4081637863u, 337070226u, +3235259030u, 3897262827u, +736956644u, 641040550u, +644850146u, 1306761320u, +4219448634u, 193750500u, +3293278106u, 1383997679u, +1242645122u, 4109252858u, +450747727u, 3716617561u, +362725793u, 2252520167u, +3377483696u, 1788337208u, +8130777u, 3226734120u, +759239140u, 1012411364u, +1658628529u, 2911512007u, +1002580201u, 1681898320u, +3039016929u, 4294520281u, +367022558u, 3071359622u, +3205848570u, 152989999u, +3839042136u, 2357687350u, +4273132307u, 3898950547u, +1176841812u, 1314157485u, +75443951u, 1027027239u, +1858986613u, 2040551642u, +36574105u, 2603059541u, +3456147251u, 2137668425u, +4077477194u, 3565689036u, +491832241u, 363703593u, +2579177168u, 3589545214u, +265993036u, 1864569342u, +4149035573u, 3189253455u, +1072259310u, 3153745937u, +923017956u, 490608221u, +855846773u, 845706553u, +1018226240u, 1604548872u, +3833372385u, 3287246572u, +2757959551u, 2452872151u, +1553870564u, 1713154780u, +2649450292u, 500120236u, +84251717u, 661869670u, +1444911517u, 2489716881u, +2810524030u, 1561519055u, +3884088359u, 2509890699u, +4247155916u, 1005636939u, +3224066062u, 2774151984u, +2035978240u, 2514910366u, +1478837908u, 3144450144u, +2107011431u, 96459446u, +3587732908u, 2389230590u, +3287635953u, 250533792u, +1235983679u, 4237425634u, +3704645833u, 3882376657u, +2976369049u, 1187061987u, +276949224u, 4100839753u, +1698347543u, 1629662314u, +1556151829u, 3784939568u, +427484362u, 4246879223u, +3155311770u, 4285163791u, +1693376813u, 124492786u, +1858777639u, 3476334357u, +1941442701u, 1121980173u, +3485932087u, 820852908u, +358032121u, 2511026735u, +1873607283u, 2556067450u, +2248275536u, 1528632094u, +1535473864u, 556796152u, +1499201704u, 1472623890u, +1526518503u, 3692729434u, +1476438092u, 2913077464u, +335109599u, 2167614601u, +4121131078u, 3158127917u, +3051522276u, 4046477658u, +2857717851u, 1863977403u, +1341023343u, 692059110u, +1802040304u, 990407433u, +3285847572u, 319814144u, +561105582u, 1540183799u, +4052924496u, 2926590471u, +2244539806u, 439121871u, +3317903224u, 3178387550u, +4265214507u, 82077489u, +1978918971u, 4279668976u, +128732476u, 2853224222u, +464407878u, 4190838199u, +997819001u, 3250520802u, +2330081301u, 4095846095u, +733509243u, 1583801700u, +722314527u, 3552883023u, +1403784280u, 432327540u, +1877837196u, 3912423882u, +505219998u, 696031431u, +908238873u, 4189387259u, +8759461u, 2540185277u, +3385159748u, 381355877u, +2519951681u, 1679786240u, +2019419351u, 4051584612u, +1933923923u, 3768201861u, +1670133081u, 3454981037u, +700836153u, 1675560450u, +371560700u, 338262316u, +847351840u, 2222395828u, +3130433948u, 405251683u, +3037574880u, 184098830u, +453340528u, 1385561439u, +2224044848u, 4071581802u, +1431235296u, 5570097u, +570114376u, 2287305551u, +2272418128u, 803575837u, +3943113491u, 414959787u, +708083137u, 2452657767u, +4019147902u, 3841480082u, +3791794715u, 2965956183u, +2763690963u, 2350937598u, +3424361375u, 779434428u, +1274947212u, 686105485u, +3426668051u, 3692865672u, +3057021940u, 2285701422u, +349809124u, 1379278508u, +3623750518u, 215970497u, +1783152480u, 823305654u, +216118434u, 1787189830u, +3692048450u, 2272612521u, +3032187389u, 4159715581u, +1388133148u, 1611772864u, +2544383526u, 552925303u, +3420960112u, 3198900547u, +3503230228u, 2603352423u, +2318375898u, 4064071435u, +3006227299u, 4194096960u, +1283392422u, 1510460996u, +174272138u, 3671038966u, +1775955687u, 1719108984u, +1763892006u, 1385029063u, +4083790740u, 406757708u, +684087286u, 531310503u, +3329923157u, 3492083607u, +1059031410u, 3037314475u, +3105682208u, 3382290593u, +2292208503u, 426380557u, +97373678u, 3842309471u, +777173623u, 3241407531u, +303065016u, 1477104583u, +4234905200u, 2512514774u, +2649684057u, 1397502982u, +1802596032u, 3973022223u, +2543566442u, 3139578968u, +3193669211u, 811750340u, +4013496209u, 567361887u, +4169410406u, 3622282782u, +3403136990u, 2540585554u, +895210040u, 3862229802u, +1145435213u, 4146963980u, +784952939u, 943914610u, +573034522u, 464420660u, +2356867109u, 3054347639u, +3985088434u, 1911188923u, +583391304u, 176468511u, +2990150068u, 2338031599u, +519948041u, 3181425568u, +496106033u, 4110294665u, +2736756930u, 1196757691u, +1089679033u, 240953857u, +3399092928u, 4040779538u, +2843673626u, 240495962u, +3017658263u, 3828377737u, +4243717901u, 2448373688u, +2759616657u, 2246245780u, +308018483u, 4262383425u, +2731780771u, 328023017u, +2884443148u, 841480070u, +3188015819u, 4051263539u, +2298178908u, 2944209234u, +1372958390u, 4164532914u, +4074952232u, 1683612329u, +2155036654u, 1872815858u, +2041174279u, 2368092311u, +206775997u, 2283918569u, +645945606u, 115406202u, +4206471368u, 3923500892u, +2217060665u, 350160869u, +706531239u, 2824302286u, +509981657u, 1469342315u, +140980u, 1891558063u, +164887091u, 3094962711u, +3437115622u, 13327420u, +422986366u, 330624974u, +3630863408u, 2425505046u, +824008515u, 3543885677u, +918718096u, 376390582u, +3224043675u, 3724791476u, +1837192976u, 2968738516u, +3424344721u, 3187805406u, +1550978788u, 1743089918u, +4251270061u, 645016762u, +3855037968u, 1928519266u, +1373803416u, 2289007286u, +1889218686u, 1610271373u, +3059200728u, 2108753646u, +582042641u, 812347242u, +3188172418u, 191994904u, +1343511943u, 2247006571u, +463291708u, 2697254095u, +1534175504u, 1106275740u, +622521957u, 917121602u, +4095777215u, 3955972648u, +3852234638u, 2845309942u, +3299763344u, 2864033668u, +2554947496u, 799569078u, +2551629074u, 1102873346u, +2661022773u, 2006922227u, +2900438444u, 1448194126u, +1321567432u, 1983773590u, +1237256330u, 3449066284u, +1691553115u, 3274671549u, +4271625619u, 2741371614u, +3285899651u, 786322314u, +1586632825u, 564385522u, +2530557509u, 2974240289u, +1244759631u, 3263135197u, +3592389776u, 3570296884u, +2749873561u, 521432811u, +987586766u, 3206261120u, +1327840078u, 4078716491u, +1753812954u, 976892272u, +1827135136u, 1781944746u, +1328622957u, 1015377974u, +3439601008u, 2209584557u, +2482286699u, 1109175923u, +874877499u, 2036083451u, +483570344u, 1091877599u, +4190721328u, 1129462471u, +640035849u, 1867372700u, +920761165u, 3273688770u, +1623777358u, 3389003793u, +3241132743u, 2734783008u, +696674661u, 2502161880u, +1646071378u, 1164309901u, +350411888u, 1978005963u, +2253937037u, 7371540u, +989577914u, 3626554867u, +3214796883u, 531343826u, +398899695u, 1145247203u, +1516846461u, 3656006011u, +529303412u, 3318455811u, +3062828129u, 1696355359u, +3698796465u, 3155218919u, +1457595996u, 3191404246u, +1395609912u, 2917345728u, +1237411891u, 1854985978u, +1091884675u, 3504488111u, +3109924189u, 1628881950u, +3939149151u, 878608872u, +778235395u, 1052990614u, +903730231u, 2069566979u, +2437686324u, 3163786257u, +2257884264u, 2123173186u, +939764916u, 2933010098u, +1235300371u, 1256485167u, +1950274665u, 2180372319u, +2648400302u, 122035049u, +1883344352u, 2083771672u, +3712110541u, 321199441u, +1896357377u, 508560958u, +3066325351u, 2770847216u, +3177982504u, 296902736u, +1486926688u, 456842861u, +601221482u, 3992583643u, +2794121515u, 1533934172u, +1706465470u, 4281971893u, +2557027816u, 900741486u, +227175484u, 550595824u, +690918144u, 2825943628u, +90375300u, 300318232u, +1985329734u, 1440763373u, +3670603707u, 2533900859u, +3253901179u, 542270815u, +3677388841u, 307706478u, +2570910669u, 3320103693u, +1273768482u, 1216399252u, +1652924805u, 1043647584u, +1120323676u, 639941430u, +325675502u, 3652676161u, +4241680335u, 1545838362u, +1991398008u, 4100211814u, +1097584090u, 3262252593u, +2254324292u, 1765019121u, +4060211241u, 2315856188u, +3704419305u, 411263051u, +238929055u, 3540688404u, +3094544537u, 3250435765u, +3460621305u, 1967599860u, +2016157366u, 847389916u, +1659615591u, 4020453639u, +901109753u, 2682611693u, +1661364280u, 177155177u, +3210561911u, 3802058181u, +797089608u, 3286110054u, +2110358240u, 1353279028u, +2479975820u, 471725410u, +2219863904u, 3623364733u, +3167128228u, 1052188336u, +3656587111u, 721788662u, +3061255808u, 1615375832u, +924941453u, 2547780700u, +3328169224u, 1310964134u, +2701956286u, 4145497671u, +1421461094u, 1221397398u, +1589183618u, 1492533854u, +449740816u, 2686506989u, +3035198924u, 1682886232u, +2529760244u, 3342031659u, +1235084019u, 2151665147u, +2315686577u, 3282027660u, +1140138691u, 2754346599u, +2091754612u, 1178454681u, +4226896579u, 2942520471u, +2122168506u, 3751680858u, +3213794286u, 2601416506u, +4142747914u, 3951404257u, +4243249649u, 748595836u, +4004834921u, 238887261u, +1927321047u, 2217148444u, +205977665u, 1885975275u, +186020771u, 2367569534u, +2941662631u, 2608559272u, +3342096731u, 741809437u, +1962659444u, 3539886328u, +3036596491u, 2282550094u, +2366462727u, 2748286642u, +2144472852u, 1390394371u, +1257385924u, 2205425874u, +2119055686u, 46865323u, +3597555910u, 3188438773u, +2372320753u, 3641116924u, +3116286108u, 2680722658u, +3371014971u, 2058751609u, +2966943726u, 2345078707u, +2330535244u, 4013841927u, +1169588594u, 857915866u, +1875260989u, 3175831309u, +3193475664u, 1955181430u, +923161569u, 4068653043u, +776445899u, 954196929u, +61509556u, 4248237857u, +3808667664u, 581227317u, +2893240187u, 4159497403u, +4212264930u, 3973886195u, +2077539039u, 851579036u, +2957587591u, 772351886u, +1173659554u, 946748363u, +2794103714u, 2094375930u, +4234750213u, 3671645488u, +2614250782u, 2620465358u, +3122317317u, 2365436865u, +3393973390u, 523513960u, +3645735309u, 2766686992u, +2023960931u, 2312244996u, +1875932218u, 3253711056u, +3622416881u, 3274929205u, +612094988u, 1555465129u, +2114270406u, 3553762793u, +1832633644u, 1087551556u, +3306195841u, 1702313921u, +3675066046u, 1735998785u, +1690923980u, 1482649756u, +1171351291u, 2043136409u, +1962596992u, 461214626u, +3278253346u, 1392428048u, +3744621107u, 1028502697u, +3991171462u, 1014064003u, +3642345425u, 3186995039u, +6114625u, 3359104346u, +414856965u, 2814387514u, +3583605071u, 2497896367u, +1024572712u, 1927582962u, +2892797583u, 845302635u, +328548052u, 1523379748u, +3392622118u, 1347167673u, +1012316581u, 37767602u, +2647726017u, 1070326065u, +2075035198u, 4202817168u, +2502924707u, 2612406822u, +2187115553u, 1180137213u, +701024148u, 1481965992u, +3223787553u, 2083541843u, +203230202u, 3876887380u, +1334816273u, 2870251538u, +2186205850u, 3985213979u, +333533378u, 806507642u, +1010064531u, 713520765u, +3084131515u, 2637421459u, +1703168933u, 1517562266u, +4089081247u, 3231042924u, +3079916123u, 3154574447u, +2253948262u, 1725190035u, +2452539325u, 1343734533u, +213706059u, 2519409656u, +108055211u, 2916327746u, +587001593u, 1917607088u, +4202913084u, 926304016u, +469255411u, 4042080256u, +3498936874u, 246692543u, +495780578u, 438717281u, +2259272650u, 4011324645u, +2836854664u, 2317249321u, +946828752u, 1280403658u, +1905648354u, 2034241661u, +774652981u, 1285694082u, +2200307766u, 2158671727u, +1135162148u, 232040752u, +397012087u, 1717527689u, +1720414106u, 918797022u, +2580119304u, 3568069742u, +2904461070u, 3893453420u, +973817938u, 667499332u, +3785870412u, 2088861715u, +1565179401u, 600903026u, +591806775u, 3512242245u, +997964515u, 2339605347u, +1134342772u, 3234226304u, +4084179455u, 302315791u, +2445626811u, 2590372496u, +345572299u, 2274770442u, +3600587867u, 3706939009u, +1430507980u, 2656330434u, +1079209397u, 2122849632u, +1423705223u, 3826321888u, +3683385276u, 1057038163u, +1242840526u, 3987000643u, +2398253089u, 1538190921u, +1295898647u, 3570196893u, +3065138774u, 3111336863u, +2524949549u, 4203895425u, +3025864372u, 968800353u, +1023721001u, 3763083325u, +526350786u, 635552097u, +2308118370u, 2166472723u, +2196937373u, 2643841788u, +3040011470u, 4010301879u, +2782379560u, 3474682856u, +4201389782u, 4223278891u, +1457302296u, 2251842132u, +1090062008u, 3188219189u, +292733931u, 1424229089u, +1590782640u, 1365212370u, +3975957073u, 3982969588u, +2927147928u, 1048291071u, +2766680094u, 884908196u, +35237839u, 2221180633u, +2490333812u, 4098360768u, +4029081103u, 3490831871u, +2392516272u, 3455379186u, +3948800722u, 335456628u, +2105117968u, 4181629008u, +1044201772u, 3335754111u, +540133451u, 3313113759u, +3786107905u, 2627207327u, +3540337875u, 3473113388u, +3430536378u, 2514123129u, +2124531276u, 3872633376u, +3272957388u, 3501994650u, +2418881542u, 487365389u, +3877672368u, 1512866656u, +3486531087u, 2102955203u, +1136054817u, 3004241477u, +1549075351u, 1302002008u, +3936430045u, 2258587644u, +4109233936u, 3679809321u, +3467083076u, 2484463221u, +1594979755u, 529218470u, +3527024461u, 1147434678u, +106799023u, 1823161970u, +1704656738u, 1675883700u, +3308746763u, 1875093248u, +1352868568u, 1898561846u, +2508994984u, 3177750780u, +4217929592u, 400784472u, +80090315u, 3564414786u, +3841585648u, 3379293868u, +160353261u, 2413172925u, +2378499279u, 673436726u, +1505702418u, 1330977363u, +1853298225u, 3201741245u, +2135714208u, 4069554166u, +3715612384u, 3692488887u, +3680311316u, 4274382900u, +914186796u, 2264886523u, +3869634032u, 1254199592u, +1131020455u, 194781179u, +429923922u, 2763792336u, +2052895198u, 3997373194u, +3440090658u, 2165746386u, +1575500242u, 3463310191u, +2064974716u, 3779513671u, +3106421434u, 880320527u, +3281914119u, 286569042u, +3909096631u, 122359727u, +1429837716u, 252230074u, +4111461225u, 762273136u, +93658514u, 2766407143u, +3623657004u, 3869801679u, +3925695921u, 2390397316u, +2499025338u, 2741806539u, +2507199021u, 1659221866u, +361292116u, 4048761557u, +3797133396u, 1517903247u, +3121647246u, 3884308578u, +1697201500u, 1558800262u, +4150812360u, 3161302278u, +2610217849u, 641564641u, +183814518u, 2075245419u, +611996508u, 2223461433u, +329123979u, 121860586u, +860985829u, 1137889144u, +4018949439u, 2904348960u, +947795261u, 1992594155u, +4255427501u, 2281583851u, +2892637604u, 1478186924u, +3050771207u, 2767035539u, +373510582u, 1963520320u, +3763848370u, 3756817798u, +627269409u, 1806905031u, +1814444610u, 3646665053u, +1822693920u, 278515794u, +584050483u, 4142579188u, +2149745808u, 3193071606u, +1179706341u, 2693495182u, +3259749808u, 644172091u, +880509048u, 3340630542u, +3365160815u, 2384445068u, +3053081915u, 2840648309u, +1986990122u, 1084703471u, +2370410550u, 1627743573u, +2244943480u, 4057483496u, +2611595995u, 2470013639u, +4024732359u, 3987190386u, +873421687u, 2447660175u, +3226583022u, 767655877u, +2528024413u, 1962070688u, +1233635843u, 2163464207u, +659054446u, 854207134u, +258410943u, 4197831420u, +2515400215u, 3100476924u, +1961549594u, 2219491151u, +3997658851u, 163850514u, +470325051u, 2598261204u, +3052145580u, 59836528u, +1376188597u, 966733415u, +850667549u, 3622479237u, +1083731990u, 1525777459u, +4005126532u, 1428155540u, +2781907007u, 943739431u, +1493961005u, 2839096988u, +2000057832u, 1941829603u, +1901484772u, 939810041u, +3377407371u, 3090115837u, +3310840540u, 2068409688u, +3261383939u, 2212130277u, +2594774045u, 2912652418u, +4179816101u, 3534504531u, +3349254805u, 2796552902u, +1385421283u, 4259908631u, +3714780837u, 3070073945u, +3372846298u, 3835884044u, +3047965714u, 3009018735u, +744091167u, 1861124263u, +2764936304u, 1338171648u, +4222019554u, 1395200692u, +1371426007u, 3338031581u, +2525665319u, 4196233786u, +2332743921u, 1474702008u, +2274266301u, 4255175517u, +2290169528u, 1793910997u, +2188254024u, 354202001u, +3864458796u, 4280290498u, +1554419340u, 1733094688u, +2010552302u, 1561807039u, +664313606u, 2548990879u, +1084699349u, 3233936866u, +973895284u, 2386881969u, +1831995860u, 2961465052u, +1428704144u, 3269904970u, +231648253u, 2602483763u, +4125013173u, 3319187387u, +3347011944u, 1892898231u, +4019114049u, 868879116u, +4085937045u, 2378411019u, +1072588531u, 3547435717u, +2208070766u, 1069899078u, +3142980597u, 2337088907u, +1593338562u, 919414554u, +688077849u, 3625708135u, +1472447348u, 1947711896u, +3953006207u, 877438080u, +845995820u, 3150361443u, +3053496713u, 2484577841u, +224271045u, 2914958001u, +2682612949u, 806655563u, +2436224507u, 1907729235u, +2920583824u, 1251814062u, +2070814520u, 4034325578u, +497847539u, 2714317144u, +385182008u, 640855184u, +1327075087u, 1062468773u, +1757405994u, 1374270191u, +4263183176u, 3041193150u, +1037871524u, 3633173991u, +4231821821u, 2830131945u, +3505072908u, 2830570613u, +4195208715u, 575398021u, +3992840257u, 3691788221u, +1949847968u, 2999344380u, +3183782163u, 3723754342u, +759716128u, 3284107364u, +1714496583u, 15918244u, +820509475u, 2553936299u, +2201876606u, 4237151697u, +2605688266u, 3253705097u, +1008333207u, 712158730u, +1722280252u, 1933868287u, +4152736859u, 2097020806u, +584426382u, 2836501956u, +2522777566u, 1996172430u, +2122199776u, 1069285218u, +1474209360u, 690831894u, +107482532u, 3695525410u, +670591796u, 768977505u, +2412057331u, 3647886687u, +3110327607u, 1072658422u, +379861934u, 1557579480u, +4124127129u, 2271365865u, +3880613089u, 739218494u, +547346027u, 388559045u, +3147335977u, 176230425u, +3094853730u, 2554321205u, +1495176194u, 4093461535u, +3521297827u, 4108148413u, +1913727929u, 1177947623u, +1911655402u, 1053371241u, +3265708874u, 1266515850u, +1045540427u, 3194420196u, +3717104621u, 1144474110u, +1464392345u, 52070157u, +4144237690u, 3350490823u, +4166253320u, 2747410691u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; { uint64_t h = farmhashna::Hash64WithSeeds(data, len++, SEED0, SEED1); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashna::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashna::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +{ uint64_t h = farmhashna::Hash64WithSeeds(data + offset, len, SEED0, SEED1); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashna::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashna::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashnaTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +{ uint64_t h = farmhashna::Hash64WithSeeds(data + offset, len, SEED0, SEED1); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashna::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashna::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashnaTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashnaTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashnaTest::Dump(0, i); + } + farmhashnaTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashntTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +2681724312u, +797982799u, +921001710u, +2134990486u, +2244477846u, +2992121793u, +3943596029u, +452431531u, +2557197665u, +2532580744u, +3099673830u, +3696623795u, +3281581178u, +1882212500u, +275903667u, +3033004529u, +1402319660u, +2699376854u, +4222949502u, +1712034059u, +1330324210u, +2921867846u, +1728752234u, +326029180u, +3349570000u, +1612122221u, +1646032583u, +1432476832u, +3552092450u, +1499109081u, +1554038301u, +3190844552u, +540224401u, +489963606u, +1562872448u, +2128624475u, +1262831810u, +1672724608u, +2077310004u, +1911523866u, +294527927u, +1389770549u, +2026137563u, +629449419u, +2489287368u, +645684964u, +230403464u, +3272648435u, +165370827u, +1230085527u, +3628174014u, +851743255u, +1554380634u, +3667013118u, +2290487377u, +1909203251u, +1498556724u, +4165088768u, +197618179u, +914413116u, +1913303225u, +3117299654u, +1357272220u, +507436733u, +1413396341u, +146044391u, +429095991u, +3056862311u, +366414107u, +2293458109u, +1684583131u, +1170404994u, +520792961u, +1577421232u, +4033596884u, +4229339322u, +3242407770u, +2649785113u, +816692935u, +3555213933u, +517646945u, +2180594090u, +3047062993u, +2391606125u, +382936554u, +788479970u, +2826990641u, +3167748333u, +1758123094u, +389974094u, +3338548567u, +2583576230u, +3198590202u, +4155628142u, +542201663u, +2856634168u, +3948351189u, +4194218315u, +1467786451u, +2743592929u, +1062268187u, +3810665822u, +2560479831u, +997658837u, +3067277639u, +1211737169u, +59581167u, +1389679610u, +4189944477u, +100876854u, +2062343506u, +3088828656u, +3284356565u, +3130054947u, +3532596884u, +3887208531u, +259034107u, +3233195759u, +3200749877u, +760633989u, +1115203611u, +1516407838u, +1778459926u, +2146672889u, +2457048126u, +2217471853u, +862072556u, +3745267835u, +701920051u, +581695350u, +1410111809u, +3326135446u, +2187968410u, +4267859263u, +479241367u, +2868987960u, +704325635u, +1418509533u, +735688735u, +3283299459u, +813690332u, +1439630796u, +3195309868u, +1616408198u, +3254795114u, +2799925823u, +3929484338u, +1798536177u, +4205965408u, +1499475160u, +4247675634u, +3779953975u, +785893184u, +2778575413u, +1160134629u, +823113169u, +4116162021u, +4167766971u, +2487440590u, +4004655503u, +4044418876u, +1462554406u, +2011102035u, +4265993528u, +576405853u, +4038839101u, +2425317635u, +1401013391u, +3062418115u, +3167030094u, +2602636307u, +4264167741u, +4017058800u, +1029665228u, +4036354071u, +2670703363u, +688472265u, +1054670286u, +338058159u, +1539305024u, +146827036u, +4060134777u, +2502815838u, +1603444633u, +2448966429u, +3891353218u, +1082330589u, +201837927u, +2848283092u, +883849006u, +1982110346u, +541496720u, +133643215u, +3847827123u, +4015671361u, +2849988118u, +3452457457u, +2102063419u, +3281002516u, +1539151988u, +1147951686u, +2005032160u, +2415262714u, +116647396u, +1029284767u, +2159170082u, +1919171906u, +2017579106u, +2473524405u, +1694443528u, +3671562289u, +505662155u, +1019936943u, +1511077569u, +773792826u, +2089123665u, +484732447u, +1120017626u, +2809286837u, +4029205195u, +1097806406u, +136118734u, +4017075736u, +1403506686u, +1516736273u, +2562064338u, +2984955003u, +3071338162u, +1923531348u, +771592405u, +2586632018u, +4032960199u, +2687561076u, +308584855u, +1692079268u, +2565680167u, +3674576684u, +3770488806u, +69201295u, +1255084262u, +3593730713u, +54945052u, +1939595371u, +2432427547u, +2295501078u, +1280920000u, +82177963u, +1121403845u, +2889101923u, +713121337u, +1747052377u, +927011680u, +4142246789u, +1958963937u, +1636932722u, +4075249328u, +2025886508u, +3026358429u, +1845587644u, +3615577014u, +1363253259u, +3087190425u, +341851980u, +2515339233u, +1276595523u, +460237542u, +4198897105u, +2069753399u, +4278599955u, +356742959u, +3735275001u, +1750561299u, +668829411u, +3384018814u, +4233785523u, +451656820u, +107312677u, +2390172694u, +1216645846u, +164402616u, +1689811113u, +1767810825u, +1397772514u, +3323383489u, +2986430557u, +207428029u, +2260498180u, +2360400900u, +1263709570u, +1377764574u, +4252610345u, +1099809675u, +2776960536u, +3542220540u, +3752806924u, +337070226u, +3267551635u, +1306761320u, +2220373824u, +4109252858u, +896322512u, +1788337208u, +1336556841u, +2911512007u, +3712582785u, +3071359622u, +2561488770u, +3898950547u, +536047554u, +2040551642u, +3528794619u, +3565689036u, +1197100813u, +1864569342u, +3329594980u, +490608221u, +1174785921u, +3287246572u, +2163330264u, +500120236u, +2520062970u, +1561519055u, +4042710240u, +2774151984u, +3160666939u, +96459446u, +1878067032u, +4237425634u, +2952135524u, +4100839753u, +1265237690u, +4246879223u, +834830418u, +3476334357u, +4277111759u, +2511026735u, +3065234219u, +556796152u, +198182691u, +2913077464u, +1535115487u, +4046477658u, +140762681u, +990407433u, +2198985327u, +2926590471u, +559702706u, +82077489u, +1096697687u, +4190838199u, +3046872820u, +1583801700u, +2185339100u, +3912423882u, +3703603898u, +2540185277u, +1446869792u, +4051584612u, +2719373510u, +1675560450u, +1996164093u, +405251683u, +2864244470u, +4071581802u, +2028708916u, +803575837u, +557660441u, +3841480082u, +255451671u, +779434428u, +3452203069u, +2285701422u, +1568745354u, +823305654u, +3184047862u, +4159715581u, +3160134214u, +3198900547u, +1566527339u, +4194096960u, +1496132623u, +1719108984u, +2584236470u, +531310503u, +3456882941u, +3382290593u, +467441309u, +3241407531u, +2540270567u, +1397502982u, +3348545480u, +811750340u, +1017047954u, +2540585554u, +3531646869u, +943914610u, +1903578924u, +1911188923u, +241574049u, +3181425568u, +3529565564u, +240953857u, +2964595704u, +3828377737u, +4260564140u, +4262383425u, +383233885u, +4051263539u, +919677938u, +1683612329u, +4204155962u, +2283918569u, +4153726847u, +350160869u, +1387233546u, +1891558063u, +740563169u, +330624974u, +2948665536u, +376390582u, +3799363969u, +3187805406u, +2263421398u, +1928519266u, +2746577402u, +2108753646u, +768287270u, +2247006571u, +212490675u, +917121602u, +2549835613u, +2864033668u, +3738062408u, +2006922227u, +2616619070u, +3449066284u, +431292293u, +786322314u, +1415970351u, +3263135197u, +2954777083u, +3206261120u, +2287507921u, +1781944746u, +4081586725u, +1109175923u, +1813855658u, +1129462471u, +1037031473u, +3389003793u, +3122687303u, +1164309901u, +3193251135u, +3626554867u, +3071568023u, +3656006011u, +1167681812u, +3155218919u, +2704165015u, +1854985978u, +1712976649u, +878608872u, +4155949943u, +3163786257u, +1626463554u, +1256485167u, +582664250u, +2083771672u, +804336148u, +2770847216u, +1674051445u, +3992583643u, +2966108111u, +900741486u, +4014551783u, +300318232u, +3517585534u, +542270815u, +760762191u, +1216399252u, +643179562u, +3652676161u, +2990167340u, +3262252593u, +2134299399u, +411263051u, +1342880802u, +1967599860u, +853593042u, +2682611693u, +850464484u, +3286110054u, +3842907484u, +3623364733u, +3693536939u, +1615375832u, +2318423400u, +4145497671u, +1728968857u, +2686506989u, +1502282913u, +2151665147u, +3651607391u, +1178454681u, +4146839064u, +2601416506u, +1448097974u, +238887261u, +4093725287u, +2367569534u, +679517009u, +3539886328u, +3086277222u, +1390394371u, +119173722u, +1766260771u, +751439914u, +215917713u, +2656990891u, +1570750352u, +3533987737u, +3576119563u, +963183826u, +3796810515u, +136547246u, +2592925324u, +427154472u, +1228758574u, +1464255968u, +2984611177u, +2001585786u, +1525438381u, +1348536411u, +2861338018u, +764077711u, +3785343245u, +457568934u, +4104954272u, +2381948487u, +3148473363u, +2180270337u, +1387729170u, +951677556u, +2721005055u, +66786703u, +1149351924u, +1895026827u, +3711056516u, +3638638708u, +2263003308u, +3448840877u, +225333538u, +3797521928u, +3262952567u, +2078619498u, +1178073973u, +3288261538u, +1496966875u, +2481012988u, +114945840u, +1632780103u, +2087949619u, +3787017905u, +2575395164u, +2971726178u, +3642087909u, +3894199764u, +203853421u, +425935223u, +3565833278u, +1748785729u, +580966986u, +2124704694u, +1107045577u, +1067532701u, +1406028344u, +18613994u, +3476683808u, +3762914298u, +1844996900u, +904215228u, +1118521573u, +3657647605u, +3136157065u, +2287683323u, +126005630u, +3555092974u, +49515858u, +1010661841u, +1902040126u, +1400735275u, +2771676666u, +2225229957u, +3454177594u, +2883475137u, +4144472319u, +1051332394u, +542648229u, +1669710469u, +553041029u, +584127807u, +2993670925u, +3587959456u, +1745399498u, +1404723176u, +1334333531u, +3239516985u, +1275954779u, +367320647u, +3684418197u, +4030809053u, +484559105u, +4255931645u, +4271715616u, +3171911678u, +928543347u, +2159512867u, +313902234u, +647086234u, +577214736u, +1130129573u, +995791646u, +1645086060u, +4122335794u, +1064648931u, +2752145076u, +3312498873u, +4238535494u, +1471227427u, +633688562u, +1959779970u, +766642813u, +1380896111u, +3647601207u, +1733961041u, +521947915u, +189164145u, +486382294u, +3770038872u, +3235740744u, +1912506671u, +2276864677u, +1588060152u, +2504457929u, +1471020554u, +3623212998u, +3026631806u, +2342164722u, +1674890530u, +3011542850u, +3549160092u, +4290680005u, +3943068002u, +2273781461u, +2127663659u, +1646681121u, +447810651u, +2366308558u, +970504950u, +2008155560u, +2695940969u, +3444688454u, +1739318893u, +2683090634u, +2774816580u, +437560100u, +512012738u, +3305170944u, +665292744u, +3580039116u, +1579404983u, +3397891494u, +710590371u, +2514565805u, +3624609754u, +3516075816u, +1314000850u, +1935166880u, +3257747610u, +3776931214u, +3183054185u, +675129307u, +3333261712u, +1154611403u, +2759854023u, +1963228038u, +505138315u, +1803966773u, +4032705384u, +798395739u, +3473799845u, +476400898u, +602972493u, +3289878097u, +2520311409u, +3214794876u, +748160407u, +1326769504u, +902775872u, +1372805534u, +1213925114u, +3009384989u, +3781981134u, +2835608783u, +2716786748u, +1669490957u, +1089334066u, +250756920u, +4041016629u, +2495807367u, +2008251381u, +106212622u, +1927268995u, +2251978818u, +3788056262u, +3678660147u, +2656772270u, +1997584981u, +2668998785u, +2954162084u, +845687881u, +776018378u, +2066910012u, +918315064u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashnt::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashnt::Hash32(data, len++)); IsAlive(farmhashnt::Hash32(data, len++)); len -= 3; return alive > 0; } +Check(farmhashnt::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashnt::Hash32(data + offset, len)); + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashntTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashnt::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashnt::Hash32(data + offset, len) << "u," << endl; +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashntTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashntTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashntTest::Dump(0, i); + } + farmhashntTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashsaTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +4223616069u, +3696677242u, +4081014168u, +2576519988u, +2212771159u, +1112731063u, +1020067935u, +3955445564u, +1451961420u, +653440099u, +31917516u, +2957164615u, +2590087362u, +3879448744u, +176305566u, +2447367541u, +1359016305u, +3363804638u, +1117290165u, +1062549743u, +2437877004u, +1894455839u, +673206794u, +3486923651u, +3269862919u, +2303349487u, +1380660650u, +595525107u, +1525325287u, +2025609358u, +176408838u, +1592885012u, +864896482u, +2101378090u, +3489229104u, +2118965695u, +581644891u, +2718789079u, +631613207u, +4228658372u, +3867875546u, +3531368319u, +3804516756u, +3317755099u, +1619744564u, +2884717286u, +1088213445u, +2667691076u, +3727873235u, +2330406762u, +858590707u, +123802208u, +4150036245u, +182283099u, +1478882570u, +3282617403u, +819171187u, +1172627392u, +4254302102u, +2957028020u, +437030323u, +2452147680u, +2868246750u, +3530169402u, +3154852132u, +215019192u, +357580983u, +1354454461u, +1108813287u, +2324008118u, +2315997713u, +4181601562u, +1360882441u, +92423273u, +3048866755u, +3369188505u, +3664371439u, +2920710428u, +1027891570u, +2653166430u, +3461888315u, +1475780447u, +292769636u, +1737473313u, +4064110516u, +4170160075u, +762850927u, +3630603695u, +2803307356u, +844987665u, +460980967u, +3005635467u, +2802568977u, +588668033u, +2148940781u, +3239099984u, +1266953698u, +3197808789u, +3519942533u, +2511995334u, +2553810188u, +871667697u, +1358675720u, +1499319171u, +2044931270u, +1210355103u, +807152540u, +3262320756u, +2810214575u, +1813386141u, +4089465863u, +903928165u, +1388899322u, +3209183659u, +834536144u, +2733354550u, +2742289921u, +3689042563u, +2655593281u, +4169686303u, +415985561u, +138892376u, +516115393u, +65683883u, +4162865100u, +889944635u, +313566528u, +3346420907u, +1504303591u, +2256809275u, +742243229u, +779775302u, +3140940172u, +2312556111u, +2304095772u, +1151741606u, +2194712422u, +1714084652u, +3272736835u, +1311540658u, +191179665u, +3996605106u, +1657345233u, +4205442903u, +1553339212u, +2351843044u, +1647502006u, +2525516233u, +292202846u, +1498646290u, +1429323381u, +974274898u, +3759331561u, +2881238887u, +826787221u, +1069622448u, +221991032u, +1462969082u, +2799661508u, +364022781u, +2594244377u, +797773898u, +4097839290u, +1529150125u, +2456805570u, +541503425u, +3936326142u, +3112719954u, +775223581u, +3074018423u, +3198488875u, +1772191849u, +2456535211u, +3154686028u, +1520862019u, +4005829426u, +1306433767u, +1943028506u, +2246000782u, +1057766454u, +3761996982u, +3441075333u, +898641979u, +3450209088u, +3941329307u, +3289922449u, +3085075827u, +1814193220u, +690422997u, +2627846676u, +2653520704u, +3739145533u, +3996776010u, +2287072592u, +1346671698u, +3082629900u, +2298811274u, +3639722036u, +1729419228u, +1836765953u, +3708118742u, +213436u, +950223749u, +3734247682u, +2924575678u, +1382024841u, +2431637732u, +3448846682u, +1341301397u, +4206956590u, +1730650902u, +2581075456u, +1542359141u, +707222542u, +2925350541u, +3846303536u, +3579103295u, +3932175763u, +1339615732u, +848825750u, +1070170828u, +1964973818u, +577060344u, +607721296u, +4031023048u, +406883794u, +3991905552u, +1198544082u, +872468460u, +1044847096u, +3159976313u, +3020028266u, +2108700400u, +3373767922u, +264431841u, +2817097007u, +3700061048u, +1733731531u, +3459415893u, +80378591u, +1479875104u, +19735612u, +1382658977u, +3416562245u, +1959852842u, +2384002344u, +124683828u, +3725782174u, +2300301222u, +393852269u, +1302492002u, +3623776492u, +3787086417u, +1730024749u, +1710531361u, +443700716u, +1461987482u, +671998131u, +3018380746u, +2592292305u, +3390799372u, +3945101155u, +3743494852u, +3716045582u, +996005166u, +320698449u, +3420221765u, +1518157951u, +2555810666u, +3381929684u, +2019638523u, +3088262796u, +2072178906u, +3433649364u, +203906916u, +34663784u, +290301305u, +1188021504u, +3754681145u, +3920313139u, +2840496520u, +1656802962u, +2288475489u, +3399185138u, +1296000826u, +2362384746u, +309633360u, +2719851778u, +776035930u, +3200733043u, +365690832u, +3326378243u, +1500331457u, +1625708592u, +4230903462u, +715344888u, +3363777768u, +2243620288u, +2890765789u, +553154234u, +4044100108u, +4056887320u, +1185656496u, +3671476744u, +1064586897u, +1154949698u, +3493481974u, +1294573722u, +1869224012u, +2530084956u, +995321553u, +833419249u, +563815282u, +250258043u, +2970801822u, +441007535u, +42246961u, +2820426655u, +2878882436u, +2363245780u, +2138489282u, +2972360481u, +2312619393u, +3598664848u, +3071556076u, +776990325u, +3220427357u, +2257939577u, +3817305903u, +1502979698u, +3159755934u, +3955997276u, +2423850008u, +1959927572u, +1219782288u, +4119776679u, +1124253854u, +3678052422u, +2620644947u, +1262408666u, +3480072280u, +2627137665u, +807538749u, +3276646337u, +518510128u, +1137828655u, +1498449110u, +3031692317u, +1125635969u, +1130096111u, +780007336u, +3111856399u, +1014917264u, +780877352u, +2909458336u, +4235949214u, +2423879289u, +275888892u, +3891926795u, +3538163953u, +54815161u, +162228302u, +258154068u, +3554455591u, +1801469029u, +2801563220u, +726560058u, +2450221940u, +3677582978u, +440993800u, +424762443u, +2624525253u, +2587715329u, +2292264424u, +1074856749u, +3294752007u, +3164112672u, +2399146799u, +1920182465u, +3858835361u, +193755240u, +3333610311u, +1757504059u, +2576027039u, +2775253365u, +2939191561u, +1046147275u, +235149906u, +4262218222u, +2900542726u, +2260154702u, +1019551635u, +1194720570u, +3519118691u, +3039483153u, +84918216u, +3053381097u, +2572396843u, +3849763371u, +2782686780u, +3710049554u, +3403430713u, +2346080784u, +2496307442u, +1597281872u, +696018239u, +704625714u, +623026921u, +3182413559u, +3794540330u, +305497722u, +1592680199u, +2377854072u, +3060601746u, +3953057908u, +3941551588u, +1033716182u, +2765716854u, +1309699058u, +3519400181u, +3073370877u, +115583008u, +4032909296u, +2944563574u, +3762753718u, +192842727u, +1711348701u, +3086147235u, +1658229443u, +1479783872u, +3839977157u, +225619117u, +1349684817u, +1964813173u, +565753187u, +2530252046u, +840014353u, +1645183704u, +3668429078u, +3438418557u, +639704059u, +360837811u, +2531807958u, +1572353913u, +2116037299u, +1948437512u, +744553393u, +2380697034u, +3775234105u, +3816065157u, +301868653u, +2960939561u, +3306528247u, +2389296549u, +805918610u, +1759358265u, +1760876328u, +2827601706u, +2944594708u, +3313666458u, +2022601495u, +730938791u, +193539397u, +2026103244u, +802928398u, +2630934308u, +782805818u, +3499326016u, +293509489u, +3646131514u, +3182478647u, +854800333u, +2284531628u, +438528022u, +2339298129u, +1692289216u, +2427728723u, +46501288u, +350652353u, +1355971222u, +889682372u, +944799254u, +2763906061u, +2807550612u, +2683762637u, +100870317u, +2449357318u, +2638348436u, +4206088869u, +1788948473u, +3537588549u, +2782490204u, +134406470u, +2409190528u, +2362439849u, +1861661528u, +2101513194u, +1424834765u, +3581765745u, +3185999525u, +2057487100u, +2303941176u, +3639628788u, +1180265315u, +230437935u, +2108319366u, +1131685143u, +1055685292u, +1509007009u, +1258485140u, +560525005u, +3598799040u, +3835680585u, +1851859628u, +332858996u, +641769248u, +4252450037u, +865386707u, +720719117u, +3133612164u, +3833045874u, +3492515435u, +2465970289u, +4234420011u, +573859916u, +252532886u, +870392318u, +4051320920u, +894929092u, +3748361688u, +699355960u, +1885212350u, +1609756949u, +461896870u, +1337065461u, +1775211059u, +1786193749u, +2815154643u, +2128729882u, +969639529u, +3960427545u, +859416958u, +2739758802u, +2698032197u, +2813292418u, +1985467524u, +396604317u, +4122172759u, +1201259789u, +4282051702u, +3270018895u, +961215209u, +961075860u, +4211926998u, +4088374597u, +577510509u, +3058349487u, +4025377754u, +2815478438u, +471023164u, +3947959608u, +4161486934u, +2299888461u, +1103571511u, +2450153872u, +1839939275u, +108299608u, +858086440u, +1030152945u, +3895328530u, +3009080718u, +3690840454u, +3847025277u, +152331362u, +161365689u, +831319961u, +2166017294u, +3945322722u, +4059970216u, +1420824131u, +2770648308u, +1567250186u, +2181067149u, +1939743488u, +3080158120u, +3435218248u, +2495237495u, +3814085102u, +3180983013u, +3199054292u, +2204745908u, +1140337267u, +2213569784u, +1941879842u, +2105562605u, +3618835614u, +2247103645u, +2492473487u, +856414299u, +166022030u, +4080104712u, +3218935344u, +3284220561u, +4261581452u, +1206944836u, +3496705432u, +2215996876u, +3154627465u, +3384005496u, +742170556u, +1333047620u, +802680366u, +156833431u, +2682100354u, +2493654830u, +584848366u, +1691693131u, +2169934170u, +779968026u, +2099545800u, +1423039695u, +4292110968u, +4266576788u, +149142597u, +748501873u, +3865014822u, +1913588198u, +130285614u, +3500768879u, +915458923u, +3071792750u, +1339986633u, +4143929149u, +4048379479u, +725193827u, +1375113643u, +2425277412u, +4144659274u, +465714768u, +226991589u, +2212127704u, +3936145258u, +2891024846u, +3816000225u, +979331165u, +1749907536u, +53847318u, +1462525833u, +2961425455u, +368859113u, +3572721452u, +453048644u, +1628629918u, +3497673923u, +3619079585u, +139870565u, +1518176798u, +3933074281u, +1878623729u, +2074035641u, +3016759257u, +1313053591u, +2557706970u, +2348296582u, +962370022u, +2337285014u, +1618936717u, +1915877085u, +2743743122u, +3250783882u, +1346652536u, +143311109u, +2443788461u, +1048248964u, +2806619339u, +3263266976u, +1668146349u, +3397428868u, +3276188862u, +1774196343u, +1993847813u, +2771079610u, +476672419u, +2119050359u, +2918326659u, +2245402721u, +2692910474u, +2374383269u, +342400227u, +2961437795u, +3899230368u, +337787132u, +3664444935u, +1269451153u, +2971526729u, +1486511182u, +791070133u, +2570319890u, +3482497490u, +2134230518u, +4273391202u, +1825511330u, +3947753714u, +1389755724u, +3995075516u, +2081052615u, +3626343470u, +4213603435u, +2137917278u, +2898987303u, +3059215715u, +3383237881u, +3003674434u, +409174425u, +1911915604u, +2087728055u, +2942005882u, +3386522440u, +714936074u, +261924004u, +3268784033u, +1141188757u, +2413217552u, +1515163433u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashsa::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashsa::Hash32(data, len++)); IsAlive(farmhashsa::Hash32(data, len++)); len -= 3; return alive > 0; } +Check(farmhashsa::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashsa::Hash32(data + offset, len)); + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashsaTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashsa::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashsa::Hash32(data + offset, len) << "u," << endl; +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashsaTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashsaTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashsaTest::Dump(0, i); + } + farmhashsaTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashsuTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +4223616069u, +3696677242u, +4081014168u, +2576519988u, +2212771159u, +1112731063u, +1020067935u, +3955445564u, +1451961420u, +653440099u, +31917516u, +2957164615u, +2590087362u, +3879448744u, +176305566u, +2447367541u, +1359016305u, +3363804638u, +1117290165u, +1062549743u, +2437877004u, +1894455839u, +673206794u, +3486923651u, +3269862919u, +2303349487u, +1380660650u, +595525107u, +1525325287u, +2025609358u, +176408838u, +1592885012u, +864896482u, +2101378090u, +3489229104u, +2118965695u, +581644891u, +2718789079u, +631613207u, +4228658372u, +3867875546u, +3531368319u, +3804516756u, +3317755099u, +1619744564u, +2884717286u, +1088213445u, +2667691076u, +3727873235u, +2330406762u, +858590707u, +457744844u, +4150036245u, +2000404290u, +1478882570u, +901678172u, +819171187u, +195942998u, +4254302102u, +3967266927u, +437030323u, +4018009204u, +2868246750u, +3540087514u, +3154852132u, +3319116625u, +357580983u, +3177665294u, +1108813287u, +1253366798u, +2315997713u, +510718750u, +1360882441u, +2770216279u, +3048866755u, +3406961221u, +3664371439u, +1151145514u, +1027891570u, +2699067992u, +3461888315u, +198061905u, +292769636u, +1106771795u, +4064110516u, +3258279756u, +762850927u, +1818699721u, +2803307356u, +3919169404u, +460980967u, +3125535078u, +2802568977u, +3582546426u, +2148940781u, +3963274378u, +1266953698u, +204185123u, +1100034381u, +3009193601u, +4200651967u, +274889605u, +2700589508u, +952511689u, +3765324859u, +3465498478u, +4014967037u, +2070988082u, +2972423530u, +3068638223u, +4156773651u, +489509804u, +1323863238u, +3731914806u, +2846098469u, +2728930632u, +346814072u, +848146907u, +551160669u, +4165126521u, +2039095001u, +4179859388u, +2434936359u, +2764414551u, +238491210u, +732483969u, +3366512764u, +478307468u, +4124179572u, +4142733597u, +1953448206u, +4199329278u, +865077060u, +2627662116u, +2802499360u, +3141206831u, +1959218197u, +911371451u, +125987200u, +2821366175u, +2530992747u, +2409206225u, +117991880u, +2133402461u, +895510531u, +428719601u, +3036014536u, +1223783733u, +733793540u, +970650405u, +547701766u, +570764615u, +3224485368u, +3192714940u, +319942831u, +3940200341u, +362056204u, +2832368105u, +1853281226u, +3296434636u, +3752508307u, +604292768u, +2231940616u, +1204094681u, +866194005u, +2405201650u, +2466384396u, +380829379u, +230033818u, +2783417588u, +4249886729u, +829569301u, +2988322580u, +2299983554u, +74748560u, +737514425u, +3153050211u, +652642663u, +1270205115u, +227197032u, +2773091790u, +325849216u, +49998791u, +4043203010u, +3662748068u, +1709364383u, +1179105165u, +1478504366u, +2980456610u, +1167476429u, +1590390732u, +1306256496u, +292008135u, +374690995u, +1809200819u, +1680595904u, +646040226u, +1742445560u, +2435776844u, +3703683804u, +478742495u, +814967947u, +2698190177u, +1003617993u, +1436118705u, +217056304u, +1412287094u, +2738417466u, +2933279339u, +3461877733u, +1203141205u, +2119492857u, +1134895723u, +1560001021u, +3786320122u, +3748116258u, +3486219595u, +702138030u, +1062984182u, +232789133u, +1566523968u, +3885443778u, +1820171888u, +3655858585u, +2316903005u, +2678779620u, +395625433u, +1609107564u, +3108726411u, +2937837224u, +3911907151u, +557272509u, +3893435978u, +1542613576u, +1079886893u, +2624566322u, +1413700616u, +2796974006u, +1922556114u, +562820464u, +2845409784u, +54180312u, +1898782464u, +3681814953u, +2417064617u, +1815464483u, +911626132u, +2964575550u, +1852696128u, +2319647785u, +1998904590u, +619992689u, +3073207513u, +1238163512u, +3199435982u, +828667254u, +3561155502u, +3943095163u, +1045711849u, +2238679131u, +2114975398u, +713808403u, +3871787494u, +2572031161u, +2360934075u, +2337781107u, +262596504u, +693836699u, +2129369850u, +3543189427u, +962205222u, +3685581020u, +692974477u, +725182211u, +646123906u, +2368836544u, +2505872733u, +1999977610u, +1639885802u, +1475058032u, +207023609u, +2773581234u, +3524857793u, +3433371102u, +3243027613u, +1787668353u, +985757946u, +3896012929u, +702356957u, +3559331129u, +884084870u, +4009998120u, +648888720u, +1403349048u, +1624342778u, +1766674171u, +2518582204u, +3251243146u, +792751003u, +1377201813u, +3629686054u, +1583734324u, +3647107626u, +4258564381u, +1469878609u, +1940598241u, +2755003690u, +1907120418u, +109916701u, +775347954u, +2090960874u, +611281803u, +3470490146u, +3301663253u, +1835412158u, +1803066146u, +591872433u, +550703713u, +1495089683u, +826492808u, +817200035u, +4177474571u, +688070143u, +971427632u, +1442499481u, +3568640348u, +2789993738u, +85808128u, +2058346726u, +394058570u, +3466511434u, +318905230u, +4149248030u, +415308316u, +165997598u, +1219639412u, +1648022659u, +2857432523u, +1422508004u, +468095522u, +296968649u, +430250611u, +1775562314u, +2976361671u, +1040036362u, +1372510167u, +292746272u, +3408238954u, +626061886u, +1317637569u, +1237775792u, +1218490455u, +2224234499u, +590942419u, +713995643u, +3541889330u, +4140218960u, +3529791107u, +354462673u, +842607274u, +365048533u, +2638303414u, +3560458014u, +31621379u, +4210854794u, +1273118792u, +2572743762u, +3513175801u, +402066986u, +602524471u, +565029192u, +180576438u, +1288605959u, +2896244423u, +1420543484u, +1329862227u, +1791567324u, +4248690247u, +12917038u, +3483481310u, +2082050731u, +1611921143u, +2443766548u, +2216338811u, +2528006095u, +2984009021u, +674210884u, +2857608106u, +2155534809u, +1023105067u, +2968955846u, +3303624302u, +2502112850u, +245749006u, +3175229091u, +3342796184u, +3613785362u, +1614168851u, +2582149283u, +895403488u, +416205023u, +3792242000u, +529397534u, +299415203u, +4284673348u, +2096851282u, +1864524731u, +2012577738u, +3426363316u, +1387308508u, +1143610148u, +2027467219u, +3772856163u, +3453862623u, +2661437174u, +2047145955u, +2533381447u, +2059534115u, +439426587u, +1537543414u, +2384289877u, +3174229055u, +2658017753u, +2293148474u, +2359450158u, +3930242475u, +1510302397u, +3354288821u, +920095603u, +2415746928u, +2729472638u, +2261143371u, +848667611u, +919157153u, +3322393117u, +4103299943u, +413569608u, +68911216u, +3334990170u, +1228068652u, +1570056373u, +1905477543u, +2622302276u, +2935063895u, +3224810004u, +4211768578u, +828688131u, +3556122839u, +1930935348u, +2605825202u, +1540993970u, +3209115883u, +122847500u, +665638794u, +506571051u, +2691795295u, +3996966556u, +714660621u, +3662432239u, +470651837u, +1807432621u, +3755290953u, +359878860u, +2793081615u, +4065031431u, +904653062u, +2317800777u, +568501094u, +3492871707u, +2738806116u, +2883859610u, +3242080257u, +364246691u, +3601786516u, +3159362524u, +1578272201u, +1283574375u, +2912186103u, +2256279032u, +1540671086u, +2356088973u, +2892277779u, +3441449267u, +2225005503u, +3846428419u, +2014549218u, +2290734767u, +2126684614u, +4235463487u, +3811556204u, +174739661u, +767525888u, +47684458u, +4211168099u, +889063422u, +469864411u, +767407110u, +413337343u, +1618456644u, +2814499820u, +2401124192u, +632089437u, +1234980238u, +1288585402u, +3153169944u, +2917822069u, +1843320264u, +3794359132u, +3074573530u, +258629454u, +3813357060u, +3806887248u, +1665524736u, +3324533324u, +3005091922u, +793108368u, +1529669805u, +2332660395u, +2217730223u, +2634687611u, +442806463u, +1968135266u, +454523002u, +3177866230u, +2808960136u, +4259114138u, +4103264843u, +3103714075u, +2462967542u, +1466891491u, +477973764u, +834565647u, +741089037u, +218837573u, +1710536528u, +2469088212u, +1229072375u, +2828341u, +176923431u, +985763350u, +4095477420u, +1984145538u, +1870791084u, +674956677u, +1978138947u, +1296493993u, +1818183554u, +3443333721u, +2124949983u, +2549590262u, +2700850794u, +2662736367u, +739638109u, +4061447096u, +2960078422u, +2453781158u, +929570940u, +3200328383u, +2406328791u, +1419180666u, +2152455739u, +2805741044u, +3305999074u, +3183816361u, +2303165050u, +4922104u, +63096005u, +936656347u, +3104453886u, +1088673880u, +1113407526u, +1457890086u, +453478383u, +1107686695u, +3626027824u, +1159687359u, +2248467888u, +2004578380u, +3274954621u, +1787958646u, +2628726704u, +1138419798u, +3735442315u, +692385301u, +313807213u, +2329068673u, +59375364u, +3261084359u, +2088644507u, +2471153194u, +788336435u, +4024527246u, +141504460u, +2307553888u, +1930559950u, +48975711u, +2745693338u, +230161982u, +3429230862u, +1335968626u, +609591304u, +57435073u, +4279281136u, +3152151665u, +3984484924u, +3459883943u, +397478330u, +1738762229u, +3033590066u, +3611539498u, +1363463523u, +3319364965u, +2671169141u, +3819548561u, +1691193757u, +2423834608u, +2820147055u, +1378120632u, +1240565187u, +3180720050u, +680831086u, +3309658414u, +1986166490u, +762099827u, +510883662u, +2047373648u, +3606742294u, +3894965352u, +2342078853u, +1091255717u, +776594727u, +3217317445u, +1574468485u, +3844504016u, +2819598918u, +1037401010u, +2550943503u, +3867184001u, +1687911772u, +165313836u, +1679575281u, +2418947263u, +2038774952u, +3913543652u, +3209155736u, +149905221u, +3859604717u, +713919631u, +4069810796u, +1882959164u, +1019939034u, +2379867302u, +3666323035u, +1157389013u, +2422300650u, +3366777340u, +2526452062u, +1313747885u, +1039617868u, +1620553692u, +2032976978u, +578789528u, +1592846839u, +2270630604u, +897850577u, +1603294178u, +3105664807u, +1442670138u, +1728019360u, +79313861u, +1683031101u, +1913067024u, +4070719870u, +708986470u, +2586453359u, +3993348863u, +3358251279u, +3003552537u, +750174793u, +836888956u, +4190747426u, +4251291318u, +4145164938u, +1366883260u, +1912910955u, +510192669u, +1851315039u, +3574241274u, +3220062924u, +2821142039u, +1317082195u, +2274293302u, +1839219569u, +126586168u, +3989293643u, +2680178207u, +347056948u, +799681430u, +2864517481u, +3180404853u, +213140045u, +1956305184u, +1474675286u, +3085723423u, +2841859626u, +308421914u, +3670309263u, +1765052231u, +245459238u, +113434331u, +4079521092u, +2115235526u, +2943408816u, +1055476938u, +1506442339u, +2291296392u, +3267864332u, +1282145528u, +3700108015u, +1932843667u, +2677701670u, +6041177u, +3889648557u, +1461025478u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashsu::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashsu::Hash32(data, len++)); IsAlive(farmhashsu::Hash32(data, len++)); len -= 3; return alive > 0; } +Check(farmhashsu::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashsu::Hash32(data + offset, len)); + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashsuTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashsu::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashsu::Hash32(data + offset, len) << "u," << endl; +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashsuTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashsuTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashsuTest::Dump(0, i); + } + farmhashsuTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashteTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +1140953930u, 861465670u, +3277735313u, 2681724312u, +2598464059u, 797982799u, +890626835u, 800175912u, +2603993599u, 921001710u, +1410420968u, 2134990486u, +3283896453u, 1867689945u, +2914424215u, 2244477846u, +255297188u, 2992121793u, +1110588164u, 4186314283u, +161451183u, 3943596029u, +4019337850u, 452431531u, +283198166u, 2741341286u, +3379021470u, 2557197665u, +299850021u, 2532580744u, +452473466u, 1706958772u, +1298374911u, 3099673830u, +2199864459u, 3696623795u, +236935126u, 2976578695u, +4055299123u, 3281581178u, +1053458494u, 1882212500u, +2305012065u, 2169731866u, +3456121707u, 275903667u, +458884671u, 3033004529u, +3058973506u, 2379411653u, +1898235244u, 1402319660u, +2700149065u, 2699376854u, +147814787u, 720739346u, +2433714046u, 4222949502u, +4220361840u, 1712034059u, +3425469811u, 3690733394u, +4148372108u, 1330324210u, +594028478u, 2921867846u, +1635026870u, 192883107u, +780716741u, 1728752234u, +3280331829u, 326029180u, +3969463346u, 1436364519u, +393215742u, 3349570000u, +3824583307u, 1612122221u, +2859809759u, 3808705738u, +1379537552u, 1646032583u, +2233466664u, 1432476832u, +4023053163u, 2650381482u, +2052294713u, 3552092450u, +1628777059u, 1499109081u, +3476440786u, 3829307897u, +2960536756u, 1554038301u, +1145519619u, 3190844552u, +2902102606u, 3600725550u, +237495366u, 540224401u, +65721842u, 489963606u, +1448662590u, 397635823u, +1596489240u, 1562872448u, +1790705123u, 2128624475u, +180854224u, 2604346966u, +1435705557u, 1262831810u, +155445229u, 1672724608u, +1669465176u, 1341975128u, +663607706u, 2077310004u, +3610042449u, 1911523866u, +1043692997u, 1454396064u, +2563776023u, 294527927u, +1099072299u, 1389770549u, +703505868u, 678706990u, +2952353448u, 2026137563u, +3603803785u, 629449419u, +1933894405u, 3043213226u, +226132789u, 2489287368u, +1552847036u, 645684964u, +3828089804u, 3632594520u, +187883449u, 230403464u, +3151491850u, 3272648435u, +3729087873u, 1303930448u, +2002861219u, 165370827u, +916494250u, 1230085527u, +3103338579u, 3064290191u, +3807265751u, 3628174014u, +231181488u, 851743255u, +2295806711u, 1781190011u, +2988893883u, 1554380634u, +1142264800u, 3667013118u, +1968445277u, 315203929u, +2638023604u, 2290487377u, +732137533u, 1909203251u, +440398219u, 1891630171u, +1380301172u, 1498556724u, +4072067757u, 4165088768u, +4204318635u, 441430649u, +3931792696u, 197618179u, +956300927u, 914413116u, +3010839769u, 2837339569u, +2148126371u, 1913303225u, +3074915312u, 3117299654u, +4139181436u, 2993479124u, +3178848746u, 1357272220u, +1438494951u, 507436733u, +667183474u, 2084369203u, +3854939912u, 1413396341u, +126024219u, 146044391u, +1016656857u, 3022024459u, +3254014218u, 429095991u, +990500595u, 3056862311u, +985653208u, 1718653828u, +623071693u, 366414107u, +1771289760u, 2293458109u, +3047342438u, 2991127487u, +3120876698u, 1684583131u, +3638043310u, 1170404994u, +863214540u, 1087193030u, +199124911u, 520792961u, +3169775996u, 1577421232u, +3331828431u, 1013201099u, +1716848157u, 4033596884u, +1770708857u, 4229339322u, +1146169032u, 1434258493u, +3824360466u, 3242407770u, +1926419493u, 2649785113u, +872586426u, 762243036u, +2736953692u, 816692935u, +1571283333u, 3555213933u, +2266795890u, 3781899767u, +4290630595u, 517646945u, +3006163611u, 2180594090u, +959214578u, 558910384u, +1283799121u, 3047062993u, +3830962609u, 2391606125u, +3544509313u, 622325861u, +834785312u, 382936554u, +1421463872u, 788479970u, +1825135056u, 2725923798u, +580988377u, 2826990641u, +247825043u, 3167748333u, +812546227u, 2506885666u, +2584372201u, 1758123094u, +1891789696u, 389974094u, +345313518u, 2022370576u, +3886113119u, 3338548567u, +1083486947u, 2583576230u, +1776047957u, 1771384107u, +3604937815u, 3198590202u, +3027522813u, 4155628142u, +4232136669u, 427759438u, +4244322689u, 542201663u, +1549591985u, 2856634168u, +556609672u, 45845311u, +1175961330u, 3948351189u, +4165739882u, 4194218315u, +1634635545u, 4151937410u, +713127376u, 1467786451u, +1327394015u, 2743592929u, +2638154051u, 810082938u, +3077742128u, 1062268187u, +4084325664u, 3810665822u, +3735739145u, 2794294783u, +2335576331u, 2560479831u, +690240711u, 997658837u, +2442302747u, 3948961926u, +3958366652u, 3067277639u, +2059157774u, 1211737169u, +1516711748u, 2339636583u, +4188504038u, 59581167u, +2767897792u, 1389679610u, +2658147000u, 2643979752u, +3758739543u, 4189944477u, +1454470782u, 100876854u, +2995362413u, 118817200u, +3252925478u, 2062343506u, +2804483644u, 3088828656u, +1231633714u, 4168280671u, +2931588131u, 3284356565u, +1255909792u, 3130054947u, +4173605289u, 1407328702u, +1677744031u, 3532596884u, +3162657845u, 3887208531u, +2256541290u, 3459463480u, +3740979556u, 259034107u, +392987633u, 3233195759u, +3606709555u, 3424793077u, +315836068u, 3200749877u, +4065431359u, 760633989u, +2982018998u, 1811050648u, +234531934u, 1115203611u, +3897494162u, 1516407838u, +1603559457u, 323296368u, +2632963283u, 1778459926u, +2879836826u, 2146672889u, +3486330348u, 492621815u, +1231665285u, 2457048126u, +3438440082u, 2217471853u, +3355404249u, 3275550588u, +1052645068u, 862072556u, +4110617119u, 3745267835u, +2657392572u, 4279236653u, +1688445808u, 701920051u, +956734128u, 581695350u, +3157862788u, 2585726058u, +1192588249u, 1410111809u, +1651193125u, 3326135446u, +1073280453u, 97376972u, +2513844237u, 2187968410u, +3976859649u, 4267859263u, +3429034542u, 564493077u, +3000537321u, 479241367u, +3845637831u, 2868987960u, +51544337u, 1029173765u, +393624922u, 704325635u, +2357610553u, 1418509533u, +2007814586u, 3866658271u, +3082385053u, 735688735u, +916110004u, 3283299459u, +1051684175u, 1083796807u, +4074716319u, 813690332u, +144264390u, 1439630796u, +1508556987u, 675582689u, +3748881891u, 3195309868u, +362884708u, 1616408198u, +43233176u, 837301135u, +881504822u, 3254795114u, +1385506591u, 2799925823u, +1469874582u, 3464841997u, +497175391u, 3929484338u, +3975771289u, 1798536177u, +2926265846u, 1374242438u, +3675707838u, 4205965408u, +3153165629u, 1499475160u, +187287713u, 548490821u, +3255259608u, 4247675634u, +1940181471u, 3779953975u, +687167150u, 2319566715u, +1742785722u, 785893184u, +2296977392u, 2778575413u, +1794720651u, 48131484u, +4084891412u, 1160134629u, +3737623280u, 823113169u, +3423207646u, 3803213486u, +710625654u, 4116162021u, +3693420287u, 4167766971u, +1666602807u, 295320990u, +3513255468u, 2487440590u, +234080704u, 4004655503u, +2971762528u, 1479656873u, +4090178629u, 4044418876u, +391947536u, 1462554406u, +3909295855u, 1239580330u, +1515601363u, 2011102035u, +1442068334u, 4265993528u, +1191921695u, 2291355695u, +4257172787u, 576405853u, +314332944u, 4038839101u, +55559918u, 2378985842u, +711098718u, 2425317635u, +1644327317u, 1401013391u, +4193760037u, 2958260436u, +3167371443u, 3062418115u, +3800755475u, 3167030094u, +3489648204u, 1405430357u, +526177822u, 2602636307u, +915406019u, 4264167741u, +1484090483u, 3070944737u, +254529415u, 4017058800u, +1702710265u, 1029665228u, +2000382906u, 3185573940u, +1381258384u, 4036354071u, +2900841028u, 2670703363u, +2921748807u, 2899069938u, +4130543625u, 688472265u, +4186808827u, 1054670286u, +1132985391u, 2840525968u, +4175776103u, 338058159u, +1735964501u, 1539305024u, +3497121710u, 1568260669u, +2227290760u, 146827036u, +3977176001u, 4060134777u, +857488494u, 250055052u, +4284109679u, 2502815838u, +2592281721u, 1603444633u, +1390562014u, 1556658131u, +616327404u, 2448966429u, +3051191726u, 3891353218u, +1213304082u, 762328245u, +2239052397u, 1082330589u, +2455957292u, 201837927u, +405397452u, 3079886794u, +2583939798u, 2848283092u, +3750724631u, 883849006u, +3204198988u, 3341327098u, +1855234968u, 1982110346u, +1485529487u, 541496720u, +4117290321u, 3607433551u, +2168864636u, 133643215u, +1055817409u, 3847827123u, +2960769387u, 4046101649u, +1176127003u, 4015671361u, +4243643405u, 2849988118u, +517111221u, 1796672358u, +2045051700u, 3452457457u, +2948254999u, 2102063419u, +1556410577u, 1536380876u, +3776661467u, 3281002516u, +1735616066u, 1539151988u, +1087795162u, 3332431596u, +685631442u, 1147951686u, +95237878u, 2005032160u, +4012206915u, 4224354805u, +3204999386u, 2415262714u, +1433635018u, 116647396u, +83167836u, 2881562655u, +2729416454u, 1029284767u, +881378302u, 2159170082u, +555057366u, 1169104445u, +3963877000u, 1919171906u, +336034862u, 2017579106u, +4059340529u, 3020819343u, +865146997u, 2473524405u, +944743644u, 1694443528u, +1804513294u, 2904752429u, +617975720u, 3671562289u, +260177668u, 505662155u, +1885941445u, 2504509403u, +2260041112u, 1019936943u, +3722741628u, 1511077569u, +3100701179u, 1379422864u, +1535670711u, 773792826u, +1103819072u, 2089123665u, +1157547425u, 329152940u, +4142587430u, 484732447u, +2475035432u, 1120017626u, +412145504u, 965125959u, +324924679u, 2809286837u, +2842141483u, 4029205195u, +2974306813u, 515627448u, +3791551981u, 1097806406u, +3873078673u, 136118734u, +1872130856u, 3632422367u, +3574135531u, 4017075736u, +1699452298u, 1403506686u, +344414660u, 1189129691u, +3487080616u, 1516736273u, +1805475756u, 2562064338u, +163335594u, 2732147834u, +4077452507u, 2984955003u, +4271866024u, 3071338162u, +2347111903u, 873829983u, +1948409509u, 1923531348u, +459509140u, 771592405u, +1750124750u, 2334938333u, +213811117u, 2586632018u, +185232757u, 4032960199u, +2447383637u, 284777551u, +1654276320u, 2687561076u, +3512945009u, 308584855u, +1861027147u, 4102279334u, +3203802620u, 1692079268u, +4250142168u, 2565680167u, +1507046104u, 841195925u, +520565830u, 3674576684u, +38924274u, 3770488806u, +2414430882u, 3978473838u, +3703994407u, 69201295u, +3099963860u, 1255084262u, +690971838u, 3539996781u, +3696902571u, 3593730713u, +2363435042u, 54945052u, +1785765213u, 184911581u, +1586241476u, 1939595371u, +2534883189u, 2432427547u, +2374171993u, 2039128933u, +2955715987u, 2295501078u, +2741583197u, 1280920000u, +686818699u, 1238742497u, +3843660102u, 82177963u, +1281043691u, 1121403845u, +1697846708u, 284852964u, +278661677u, 2889101923u, +2127558730u, 713121337u, +872502474u, 511142139u, +1261140657u, 1747052377u, +2108187161u, 927011680u, +955328267u, 3821994995u, +2707230761u, 4142246789u, +4134691985u, 1958963937u, +2498463509u, 1977988705u, +1419293714u, 1636932722u, +2567532373u, 4075249328u, +240575705u, 1956681213u, +2598802768u, 2025886508u, +4104757832u, 3026358429u, +3242615202u, 4026813725u, +255108733u, 1845587644u, +3573008472u, 3615577014u, +1222733548u, 1205557630u, +917608574u, 1363253259u, +1541946015u, 3087190425u, +1138008081u, 1444019663u, +109793386u, 341851980u, +857839960u, 2515339233u, +156283211u, 1906768669u, +3886713057u, 1276595523u, +2809830736u, 460237542u, +3420452099u, 142985419u, +205970448u, 4198897105u, +1950698961u, 2069753399u, +1142216925u, 1113051162u, +1033680610u, 4278599955u, +1106466069u, 356742959u, +531521052u, 3494863964u, +225629455u, 3735275001u, +3662626864u, 1750561299u, +1012864651u, 2101846429u, +1074553219u, 668829411u, +992181339u, 3384018814u, +3330664522u, 860966321u, +1885071395u, 4233785523u, +100741310u, 451656820u, +2148187612u, 1063001151u, +360256231u, 107312677u, +3650357479u, 2390172694u, +22452685u, 237319043u, +3600462351u, 1216645846u, +2088767754u, 164402616u, +2418980170u, 926137824u, +94638678u, 1689811113u, +2751052984u, 1767810825u, +271289013u, 3896132233u, +103797041u, 1397772514u, +3441135892u, 3323383489u, +2491268371u, 1662561885u, +1612872497u, 2986430557u, +2756998822u, 207428029u, +937973965u, 2791656726u, +1949717207u, 2260498180u, +2648427775u, 2360400900u, +2080496169u, 486358863u, +1582022990u, 1263709570u, +1396468647u, 1377764574u, +363008508u, 1293502429u, +224580012u, 4252610345u, +1435134775u, 1099809675u, +533671980u, 1533438766u, +1820532305u, 2776960536u, +3374512975u, 3542220540u, +822810075u, 3716663290u, +1157398049u, 3752806924u, +4081637863u, 337070226u, +3866585976u, 359270190u, +2110942730u, 3267551635u, +644850146u, 1306761320u, +746972907u, 934259457u, +2341378668u, 2220373824u, +1242645122u, 4109252858u, +1625266099u, 1173698481u, +383517064u, 896322512u, +3377483696u, 1788337208u, +455496839u, 3194373887u, +1837689083u, 1336556841u, +1658628529u, 2911512007u, +3838343487u, 2757664765u, +1537187340u, 3712582785u, +367022558u, 3071359622u, +3926147070u, 35432879u, +3093195926u, 2561488770u, +4273132307u, 3898950547u, +2838251049u, 2103926083u, +2549435227u, 536047554u, +1858986613u, 2040551642u, +1147412575u, 1972369852u, +4166184983u, 3528794619u, +4077477194u, 3565689036u, +808048238u, 3826350461u, +1359641525u, 1197100813u, +265993036u, 1864569342u, +725164342u, 2264788336u, +1831223342u, 3329594980u, +923017956u, 490608221u, +3818634478u, 258154469u, +1441714797u, 1174785921u, +3833372385u, 3287246572u, +1677395563u, 3569218731u, +868981704u, 2163330264u, +2649450292u, 500120236u, +465161780u, 746438382u, +1145009669u, 2520062970u, +2810524030u, 1561519055u, +1479878006u, 3864969305u, +2686075657u, 4042710240u, +3224066062u, 2774151984u, +2226179547u, 1643626042u, +2328730865u, 3160666939u, +2107011431u, 96459446u, +3920328742u, 3336407558u, +829404209u, 1878067032u, +1235983679u, 4237425634u, +466519055u, 3870676863u, +934312076u, 2952135524u, +276949224u, 4100839753u, +424001484u, 1955120893u, +4015478120u, 1265237690u, +427484362u, 4246879223u, +3452969617u, 1724363362u, +1553513184u, 834830418u, +1858777639u, 3476334357u, +4144030366u, 2450047160u, +2950762705u, 4277111759u, +358032121u, 2511026735u, +167923105u, 2059208280u, +251949572u, 3065234219u, +1535473864u, 556796152u, +1513237478u, 3150857516u, +1103404394u, 198182691u, +1476438092u, 2913077464u, +207119516u, 3963810232u, +2954651680u, 1535115487u, +3051522276u, 4046477658u, +917804636u, 864395565u, +632704095u, 140762681u, +1802040304u, 990407433u, +3771506212u, 4106024923u, +1287729497u, 2198985327u, +4052924496u, 2926590471u, +3084557148u, 1472898694u, +1009870118u, 559702706u, +4265214507u, 82077489u, +3067891003u, 3295678907u, +2402308151u, 1096697687u, +464407878u, 4190838199u, +4269578403u, 3060919438u, +2899950405u, 3046872820u, +733509243u, 1583801700u, +40453902u, 3879773881u, +1993425202u, 2185339100u, +1877837196u, 3912423882u, +3293122640u, 4104318469u, +1679617763u, 3703603898u, +8759461u, 2540185277u, +1152198475u, 2038345882u, +2503579743u, 1446869792u, +2019419351u, 4051584612u, +3178289407u, 3992503830u, +2879018745u, 2719373510u, +700836153u, 1675560450u, +4121245793u, 2064715719u, +343595772u, 1996164093u, +3130433948u, 405251683u, +2804817126u, 1607133689u, +463852893u, 2864244470u, +2224044848u, 4071581802u, +2537107938u, 2246347953u, +3207234525u, 2028708916u, +2272418128u, 803575837u, +38655481u, 2170452091u, +3272166407u, 557660441u, +4019147902u, 3841480082u, +298459606u, 2600943364u, +2440657523u, 255451671u, +3424361375u, 779434428u, +3088526123u, 490671625u, +1322855877u, 3452203069u, +3057021940u, 2285701422u, +2014993457u, 2390431709u, +2002090272u, 1568745354u, +1783152480u, 823305654u, +4053862835u, 2200236540u, +3009412313u, 3184047862u, +3032187389u, 4159715581u, +2966902888u, 252986948u, +1849329144u, 3160134214u, +3420960112u, 3198900547u, +749160960u, 379139040u, +1208883495u, 1566527339u, +3006227299u, 4194096960u, +556075248u, 497404038u, +1717327230u, 1496132623u, +1775955687u, 1719108984u, +1014328900u, 4189966956u, +2108574735u, 2584236470u, +684087286u, 531310503u, +4264509527u, 773405691u, +3088905079u, 3456882941u, +3105682208u, 3382290593u, +2289363624u, 3296306400u, +4168438718u, 467441309u, +777173623u, 3241407531u, +1183994815u, 1132983260u, +1610606159u, 2540270567u, +2649684057u, 1397502982u, +146657385u, 3318434267u, +2109315753u, 3348545480u, +3193669211u, 811750340u, +1073256162u, 3571673088u, +546596661u, 1017047954u, +3403136990u, 2540585554u, +1477047647u, 4145867423u, +2826408201u, 3531646869u, +784952939u, 943914610u, +2717443875u, 3657384638u, +1806867885u, 1903578924u, +3985088434u, 1911188923u, +1764002686u, 3672748083u, +1832925325u, 241574049u, +519948041u, 3181425568u, +2939747257u, 1634174593u, +3429894862u, 3529565564u, +1089679033u, 240953857u, +2025369941u, 2695166650u, +517086873u, 2964595704u, +3017658263u, 3828377737u, +2144895011u, 994799311u, +1184683823u, 4260564140u, +308018483u, 4262383425u, +1374752558u, 3431057723u, +1572637805u, 383233885u, +3188015819u, 4051263539u, +233319221u, 3794788167u, +2017406667u, 919677938u, +4074952232u, 1683612329u, +4213676186u, 327142514u, +3032591014u, 4204155962u, +206775997u, 2283918569u, +2395147154u, 3427505379u, +2211319468u, 4153726847u, +2217060665u, 350160869u, +2493667051u, 1648200185u, +3441709766u, 1387233546u, +140980u, 1891558063u, +760080239u, 2088061981u, +1580964938u, 740563169u, +422986366u, 330624974u, +4264507722u, 150928357u, +2738323042u, 2948665536u, +918718096u, 376390582u, +3966098971u, 717653678u, +3219466255u, 3799363969u, +3424344721u, 3187805406u, +375347278u, 3490350144u, +1992212097u, 2263421398u, +3855037968u, 1928519266u, +3866327955u, 1129127000u, +1782515131u, 2746577402u, +3059200728u, 2108753646u, +2738070963u, 1336849395u, +1705302106u, 768287270u, +1343511943u, 2247006571u, +1956142255u, 1780259453u, +3475618043u, 212490675u, +622521957u, 917121602u, +1852992332u, 1267987847u, +3170016833u, 2549835613u, +3299763344u, 2864033668u, +3378768767u, 1236609378u, +4169365948u, 3738062408u, +2661022773u, 2006922227u, +2760592161u, 3828932355u, +2636387819u, 2616619070u, +1237256330u, 3449066284u, +2871755260u, 3729280948u, +3862686086u, 431292293u, +3285899651u, 786322314u, +2531158535u, 724901242u, +2377363130u, 1415970351u, +1244759631u, 3263135197u, +965248856u, 174024139u, +2297418515u, 2954777083u, +987586766u, 3206261120u, +4059515114u, 3903854066u, +1931934525u, 2287507921u, +1827135136u, 1781944746u, +574617451u, 2299034788u, +2650140034u, 4081586725u, +2482286699u, 1109175923u, +458483596u, 618705848u, +4059852729u, 1813855658u, +4190721328u, 1129462471u, +4089998050u, 3575732749u, +2375584220u, 1037031473u, +1623777358u, 3389003793u, +546597541u, 352770237u, +1383747654u, 3122687303u, +1646071378u, 1164309901u, +290870767u, 830691298u, +929335420u, 3193251135u, +989577914u, 3626554867u, +591974737u, 3996958215u, +3163711272u, 3071568023u, +1516846461u, 3656006011u, +2698625268u, 2510865430u, +340274176u, 1167681812u, +3698796465u, 3155218919u, +4102288238u, 1673474350u, +3069708839u, 2704165015u, +1237411891u, 1854985978u, +3646837503u, 3625406022u, +921552000u, 1712976649u, +3939149151u, 878608872u, +3406359248u, 1068844551u, +1834682077u, 4155949943u, +2437686324u, 3163786257u, +2645117577u, 1988168803u, +747285578u, 1626463554u, +1235300371u, 1256485167u, +1914142538u, 4141546431u, +3838102563u, 582664250u, +1883344352u, 2083771672u, +2611657933u, 2139079047u, +2250573853u, 804336148u, +3066325351u, 2770847216u, +4275641370u, 1455750577u, +3346357270u, 1674051445u, +601221482u, 3992583643u, +1402445097u, 3622527604u, +2509017299u, 2966108111u, +2557027816u, 900741486u, +1790771021u, 2912643797u, +2631381069u, 4014551783u, +90375300u, 300318232u, +3269968032u, 2679371729u, +2664752123u, 3517585534u, +3253901179u, 542270815u, +1188641600u, 365479232u, +2210121140u, 760762191u, +1273768482u, 1216399252u, +3484324231u, 4287337666u, +16322182u, 643179562u, +325675502u, 3652676161u, +3120716054u, 3330259752u, +1011990087u, 2990167340u, +1097584090u, 3262252593u, +1829409951u, 3665087267u, +1214854475u, 2134299399u, +3704419305u, 411263051u, +1625446136u, 549838529u, +4283196353u, 1342880802u, +3460621305u, 1967599860u, +4282843369u, 1275671016u, +2544665755u, 853593042u, +901109753u, 2682611693u, +110631633u, 797487791u, +1472073141u, 850464484u, +797089608u, 3286110054u, +350397471u, 2775631060u, +366448238u, 3842907484u, +2219863904u, 3623364733u, +1850985302u, 4009616991u, +294963924u, 3693536939u, +3061255808u, 1615375832u, +1920066675u, 4113028420u, +4032223840u, 2318423400u, +2701956286u, 4145497671u, +3991532344u, 2536338351u, +1679099863u, 1728968857u, +449740816u, 2686506989u, +685242457u, 97590863u, +3258354115u, 1502282913u, +1235084019u, 2151665147u, +528459289u, 231097464u, +2477280726u, 3651607391u, +2091754612u, 1178454681u, +980597335u, 1604483865u, +1842333726u, 4146839064u, +3213794286u, 2601416506u, +754220096u, 3571436033u, +488595746u, 1448097974u, +4004834921u, 238887261u, +3320337489u, 1416989070u, +2928916831u, 4093725287u, +186020771u, 2367569534u, +3046087671u, 4090084518u, +3548184546u, 679517009u, +1962659444u, 3539886328u, +4192003933u, 1678423485u, +3827951761u, 3086277222u, +2144472852u, 1390394371u, +2976322029u, 1574517163u, +3553313841u, 119173722u, +1702434637u, 1766260771u, +3629581771u, 1407497759u, +895654784u, 751439914u, +4008409498u, 215917713u, +1482103833u, 695551833u, +1288382231u, 2656990891u, +2581779077u, 1570750352u, +3710689053u, 1741390464u, +2666411616u, 3533987737u, +4289478316u, 3576119563u, +4118694920u, 108199666u, +3869794273u, 963183826u, +2081410737u, 3796810515u, +791123882u, 2525792704u, +1036883117u, 136547246u, +875691100u, 2592925324u, +614302599u, 3013176417u, +2689342539u, 427154472u, +532957601u, 1228758574u, +1898117151u, 1181643858u, +1908591042u, 1464255968u, +446980910u, 2984611177u, +58509511u, 1046943619u, +3508927906u, 2001585786u, +2544767379u, 1525438381u, +552181222u, 1959725830u, +879448844u, 1348536411u, +4242243590u, 2861338018u, +1082052441u, 1034351453u, +601175800u, 764077711u, +530635011u, 3785343245u, +2178026726u, 117256687u, +2378297261u, 457568934u, +76438221u, 4104954272u, +956793873u, 3783168634u, +2485968477u, 2381948487u, +4226929450u, 3148473363u, +2518273601u, 3569490233u, +879369091u, 2180270337u, +3674375989u, 1387729170u, +977997984u, 4270646856u, +568650985u, 951677556u, +4213877384u, 2721005055u, +1073364549u, 2563403831u, +1678669911u, 66786703u, +2273631661u, 1149351924u, +3651298990u, 1581883443u, +246723096u, 1895026827u, +3810605772u, 3711056516u, +4058833288u, 2193790614u, +2080120290u, 3638638708u, +2915672708u, 2263003308u, +2361934197u, 4136767460u, +1976115991u, 3448840877u, +2019238520u, 225333538u, +874340815u, 2976159827u, +1555273378u, 3797521928u, +1942347150u, 3262952567u, +435997738u, 340403353u, +2817830907u, 2078619498u, +749534111u, 1178073973u, +894654712u, 3361226032u, +841092198u, 3288261538u, +1696412169u, 1496966875u, +697501571u, 1059158875u, +3739946319u, 2481012988u, +568983526u, 114945840u, +1559249010u, 2218244008u, +2841706923u, 1632780103u, +4020169654u, 2087949619u, +2438736103u, 24032648u, +833416317u, 3787017905u, +2373238993u, 2575395164u, +3434544481u, 3228481067u, +2542976862u, 2971726178u, +2880371864u, 3642087909u, +2407477975u, 2239080836u, +1043714217u, 3894199764u, +2235879182u, 203853421u, +2933669448u, 2504940536u, +834683330u, 425935223u, +3560796393u, 3565833278u, +1668000829u, 3683399154u, +3414330886u, 1748785729u, +1023171602u, 580966986u, +2531038985u, 3227325488u, +2657385925u, 2124704694u, +233442446u, 1107045577u, +3407293834u, 552770757u, +3899097693u, 1067532701u, +115667924u, 1406028344u, +1707768231u, 3724015962u, +2419657149u, 18613994u, +2532882091u, 3476683808u, +1560838678u, 811220224u, +895961699u, 3762914298u, +1328752423u, 1844996900u, +1420427894u, 1848067707u, +1210281744u, 904215228u, +4055325594u, 1118521573u, +2496554183u, 2579259919u, +3996647489u, 3657647605u, +325254059u, 3136157065u, +3951522674u, 4052925250u, +3341068436u, 2287683323u, +1313073005u, 126005630u, +2505120084u, 1194725057u, +853746559u, 3555092974u, +2689238752u, 49515858u, +1244776042u, 1069300695u, +61073168u, 1010661841u, +1269521335u, 1902040126u, +990632502u, 2378708922u, +3858321250u, 1400735275u, +2974699176u, 2771676666u, +170995186u, 2877798589u, +545726212u, 2225229957u, +1086473152u, 3454177594u, +3859483262u, 1499729584u, +2088002891u, 2883475137u, +3222194252u, 4144472319u, +2212229854u, 4146740722u, +567988835u, 1051332394u, +3932046135u, 542648229u, +3017852446u, 1277887997u, +162888005u, 1669710469u, +1492500905u, 553041029u, +1434876932u, 533989516u, +3817492747u, 584127807u, +4147115982u, 2993670925u, +4020312558u, 710021255u, +3509733475u, 3587959456u, +2088550465u, 1745399498u, +2952242967u, 1259815443u, +869648362u, 1404723176u, +3947542735u, 1334333531u, +3873471582u, 229399758u, +59634866u, 3239516985u, +3844250972u, 1275954779u, +492891666u, 1029533080u, +1552951157u, 367320647u, +699480890u, 3684418197u, +3707014310u, 471105777u, +1824587258u, 4030809053u, +3489914436u, 484559105u, +1235750398u, 1428453396u, +4230459084u, 4255931645u, +1848597055u, 4271715616u, +331780381u, 482425775u, +2435323270u, 3171911678u, +3507210587u, 928543347u, +4197807526u, 3680046204u, +2766042024u, 2159512867u, +179373257u, 313902234u, +4024837592u, 294795361u, +1622282562u, 647086234u, +2825039429u, 577214736u, +4043412446u, 2426981244u, +1277736097u, 1130129573u, +2601395338u, 995791646u, +36668922u, 3344746679u, +1521532225u, 1645086060u, +2622763015u, 4122335794u, +2936887705u, 494465807u, +2580840343u, 1064648931u, +1247887787u, 2752145076u, +1277612417u, 1249660507u, +2288678613u, 3312498873u, +2459273912u, 4238535494u, +3117488020u, 2571979978u, +2680188909u, 1471227427u, +1616494033u, 633688562u, +2268653416u, 3268237290u, +3021962815u, 1959779970u, +3321382074u, 766642813u, +204429780u, 1323319858u, +3676032891u, 1380896111u, +4030639049u, 3647601207u, +1830028502u, 2830263774u, +1375962216u, 1733961041u, +939765180u, 521947915u, +3903267364u, 497472767u, +1619700946u, 189164145u, +3115593885u, 486382294u, +1262445920u, 4062496162u, +2464795849u, 3770038872u, +4032121374u, 3235740744u, +3757765258u, 1777199847u, +2167243108u, 1912506671u, +4180515317u, 2276864677u, +536034089u, 2384915026u, +162938278u, 1588060152u, +4018349945u, 2504457929u, +841450426u, 2790120722u, +2719983588u, 1471020554u, +1390856732u, 3623212998u, +2506944218u, 1035080801u, +348812127u, 3026631806u, +746483541u, 2342164722u, +122104390u, 4074122771u, +3986865419u, 1674890530u, +3693306023u, 3011542850u, +1294951725u, 899303190u, +3577146915u, 3549160092u, +1241677652u, 4290680005u, +3193053279u, 2029187390u, +3298063095u, 3943068002u, +3946220635u, 2273781461u, +889053698u, 1376304022u, +1486839612u, 2127663659u, +344127443u, 1646681121u, +2780117810u, 2142045764u, +2694572773u, 447810651u, +2185527146u, 2366308558u, +290335413u, 584901173u, +2012370276u, 970504950u, +3258236042u, 2008155560u, +3945579565u, 614796295u, +24452072u, 2695940969u, +3983727134u, 3444688454u, +1327044473u, 3545633451u, +1875293322u, 1739318893u, +1707527799u, 2683090634u, +2848082386u, 2814622471u, +4111401777u, 2774816580u, +3849839194u, 437560100u, +2238350150u, 2462124836u, +665017710u, 512012738u, +2945294779u, 3305170944u, +819477765u, 59419271u, +155125658u, 665292744u, +444722813u, 3580039116u, +2355675635u, 663735032u, +3247800169u, 1579404983u, +1985115003u, 3397891494u, +358696453u, 1474896279u, +516388613u, 710590371u, +3490497111u, 2514565805u, +2386143445u, 477509654u, +412854590u, 3624609754u, +3214388668u, 3516075816u, +2731288520u, 1369482895u, +4033204378u, 1314000850u, +829769325u, 1935166880u, +1608191643u, 2607067237u, +423820371u, 3257747610u, +1355298041u, 3776931214u, +4105054901u, 2107080812u, +1911521879u, 3183054185u, +3910177801u, 675129307u, +1209358971u, 4205727791u, +1435726287u, 3333261712u, +1400982708u, 1154611403u, +1663501483u, 2837596667u, +3164734053u, 2759854023u, +4012043629u, 1963228038u, +3981675284u, 2677557877u, +520119591u, 505138315u, +897271356u, 1803966773u, +1016663294u, 616691903u, +2254742522u, 4032705384u, +2468470796u, 798395739u, +3025169002u, 3570037122u, +1461093710u, 3473799845u, +3702624858u, 476400898u, +1043039728u, 2304070437u, +181576948u, 602972493u, +3996616030u, 3289878097u, +2068516226u, 3922247304u, +1299968266u, 2520311409u, +1968824721u, 3214794876u, +1581813122u, 2668800905u, +3297613974u, 748160407u, +1145536484u, 1326769504u, +2973323521u, 3775262814u, +3218653169u, 902775872u, +3498603433u, 1372805534u, +704686363u, 3626542352u, +2271580579u, 1213925114u, +46329775u, 3009384989u, +1330254048u, 1194824134u, +514204310u, 3781981134u, +442526164u, 2835608783u, +3460471867u, 510634034u, +546406434u, 2716786748u, +2840500021u, 1669490957u, +2536189149u, 3251421224u, +1358736072u, 1089334066u, +3260749330u, 250756920u, +2974806681u, 1513718866u, +82635635u, 4041016629u, +3391765744u, 2495807367u, +3962674316u, 2822889695u, +753413337u, 2008251381u, +3123390177u, 106212622u, +490570565u, 1684884205u, +793892547u, 1927268995u, +2344148164u, 2251978818u, +437424236u, 2774023200u, +2674940754u, 3788056262u, +2597882666u, 3678660147u, +3797434193u, 3838215866u, +279687080u, 2656772270u, +2190204787u, 1997584981u, +3384401882u, 3160208845u, +3629379425u, 2668998785u, +1050036757u, 2954162084u, +917091826u, 1744374041u, +1454282570u, 845687881u, +2997173625u, 776018378u, +1137560602u, 1938378389u, +1748082354u, 2066910012u, +2677675207u, 918315064u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; { uint64_t h = farmhashte::Hash64WithSeeds(data, len++, SEED0, SEED1); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashte::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashte::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +{ uint64_t h = farmhashte::Hash64WithSeeds(data + offset, len, SEED0, SEED1); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashte::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashte::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashteTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +{ uint64_t h = farmhashte::Hash64WithSeeds(data + offset, len, SEED0, SEED1); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashte::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashte::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashteTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashteTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashteTest::Dump(0, i); + } + farmhashteTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashuoTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +3277735313u, 2681724312u, +2598464059u, 797982799u, +2603993599u, 921001710u, +1410420968u, 2134990486u, +2914424215u, 2244477846u, +255297188u, 2992121793u, +161451183u, 3943596029u, +4019337850u, 452431531u, +3379021470u, 2557197665u, +299850021u, 2532580744u, +1298374911u, 3099673830u, +2199864459u, 3696623795u, +4055299123u, 3281581178u, +1053458494u, 1882212500u, +3456121707u, 275903667u, +458884671u, 3033004529u, +1898235244u, 1402319660u, +2700149065u, 2699376854u, +2433714046u, 4222949502u, +4220361840u, 1712034059u, +4148372108u, 1330324210u, +594028478u, 2921867846u, +780716741u, 1728752234u, +3280331829u, 326029180u, +393215742u, 3349570000u, +3824583307u, 1612122221u, +1379537552u, 1646032583u, +2233466664u, 1432476832u, +2052294713u, 3552092450u, +1628777059u, 1499109081u, +2960536756u, 1554038301u, +1145519619u, 3190844552u, +237495366u, 540224401u, +65721842u, 489963606u, +1596489240u, 1562872448u, +1790705123u, 2128624475u, +1435705557u, 1262831810u, +155445229u, 1672724608u, +663607706u, 2077310004u, +3610042449u, 1911523866u, +2563776023u, 294527927u, +1099072299u, 1389770549u, +2952353448u, 2026137563u, +3603803785u, 629449419u, +226132789u, 2489287368u, +1552847036u, 645684964u, +187883449u, 230403464u, +3151491850u, 3272648435u, +2002861219u, 165370827u, +916494250u, 1230085527u, +3807265751u, 3628174014u, +231181488u, 851743255u, +2988893883u, 1554380634u, +1142264800u, 3667013118u, +2638023604u, 2290487377u, +732137533u, 1909203251u, +1380301172u, 1498556724u, +4072067757u, 4165088768u, +3931792696u, 197618179u, +956300927u, 914413116u, +2148126371u, 1913303225u, +3074915312u, 3117299654u, +3178848746u, 1357272220u, +1438494951u, 507436733u, +3854939912u, 1413396341u, +126024219u, 146044391u, +3254014218u, 429095991u, +165589978u, 1578546616u, +623071693u, 366414107u, +249776086u, 1207522198u, +3120876698u, 1684583131u, +46987739u, 1157614300u, +199124911u, 520792961u, +3614377032u, 586863115u, +1716848157u, 4033596884u, +1164298657u, 4140791139u, +3824360466u, 3242407770u, +3725511003u, 232064808u, +2736953692u, 816692935u, +512845449u, 3748861010u, +4290630595u, 517646945u, +22638523u, 648000590u, +1283799121u, 3047062993u, +1024246061u, 4027776454u, +834785312u, 382936554u, +411505255u, 1973395102u, +580988377u, 2826990641u, +3474970689u, 1029055034u, +2584372201u, 1758123094u, +589567754u, 325737734u, +3886113119u, 3338548567u, +257578986u, 3698087965u, +3604937815u, 3198590202u, +2305332220u, 191910725u, +4244322689u, 542201663u, +3315355162u, 2135941665u, +1175961330u, 3948351189u, +23075771u, 3252374102u, +713127376u, 1467786451u, +663013031u, 3444053918u, +3077742128u, 1062268187u, +2115441882u, 4081398201u, +2335576331u, 2560479831u, +1379288194u, 4225182569u, +3958366652u, 3067277639u, +3667516477u, 1709989541u, +4188504038u, 59581167u, +2725013602u, 3639843023u, +3758739543u, 4189944477u, +2470483982u, 877580602u, +3252925478u, 2062343506u, +3981838403u, 3762572073u, +2931588131u, 3284356565u, +1129162571u, 732225574u, +1677744031u, 3532596884u, +3232041815u, 1652884780u, +3740979556u, 259034107u, +2227121257u, 1426140634u, +315836068u, 3200749877u, +1386256573u, 24035717u, +234531934u, 1115203611u, +1598686658u, 3146815575u, +2632963283u, 1778459926u, +739944537u, 579625482u, +1231665285u, 2457048126u, +3903349120u, 389846205u, +1052645068u, 862072556u, +2834153464u, 1481069623u, +1688445808u, 701920051u, +3740748788u, 3388062747u, +1192588249u, 1410111809u, +2633463887u, 4050419847u, +2513844237u, 2187968410u, +2951683019u, 3015806005u, +3000537321u, 479241367u, +252167538u, 1231057113u, +393624922u, 704325635u, +1467197045u, 2066433573u, +3082385053u, 735688735u, +956434529u, 4028590195u, +4074716319u, 813690332u, +2124740535u, 804073145u, +3748881891u, 3195309868u, +841856605u, 2585865274u, +881504822u, 3254795114u, +1241815736u, 970796142u, +497175391u, 3929484338u, +4264993211u, 1835322201u, +3675707838u, 4205965408u, +300298607u, 3858319990u, +3255259608u, 4247675634u, +1095823272u, 1197245408u, +1742785722u, 785893184u, +1702965674u, 850401405u, +4084891412u, 1160134629u, +2555998391u, 1972759056u, +710625654u, 4116162021u, +3352753742u, 85121177u, +3513255468u, 2487440590u, +2480032715u, 2287747045u, +4090178629u, 4044418876u, +1703944517u, 486290428u, +1515601363u, 2011102035u, +573985957u, 3536053779u, +4257172787u, 576405853u, +1523550693u, 1014952061u, +711098718u, 2425317635u, +3460807169u, 3688987163u, +3167371443u, 3062418115u, +3330028292u, 1713171303u, +526177822u, 2602636307u, +1245357025u, 3346699703u, +254529415u, 4017058800u, +1829738451u, 2164236533u, +1381258384u, 4036354071u, +1749181924u, 4118435443u, +4130543625u, 688472265u, +2731071299u, 2547657502u, +4175776103u, 338058159u, +3729582129u, 4181845558u, +2227290760u, 146827036u, +2459178427u, 1025353883u, +4284109679u, 2502815838u, +825124804u, 2533140036u, +616327404u, 2448966429u, +413992636u, 2334782461u, +2239052397u, 1082330589u, +3381164715u, 199381437u, +2583939798u, 2848283092u, +2300168091u, 2156336315u, +1855234968u, 1982110346u, +2482046810u, 3158163887u, +2168864636u, 133643215u, +3904021624u, 3646514568u, +1176127003u, 4015671361u, +100525019u, 3534706803u, +2045051700u, 3452457457u, +1492267772u, 2308393828u, +3776661467u, 3281002516u, +4246334524u, 743955039u, +685631442u, 1147951686u, +2040912376u, 2911148054u, +3204999386u, 2415262714u, +313209105u, 777065474u, +2729416454u, 1029284767u, +1632078298u, 1817552554u, +3963877000u, 1919171906u, +3843219958u, 3073580867u, +865146997u, 2473524405u, +2593817617u, 3643076308u, +617975720u, 3671562289u, +121812599u, 2902367378u, +2260041112u, 1019936943u, +320945955u, 2337845588u, +1535670711u, 773792826u, +3152195900u, 4090794518u, +4142587430u, 484732447u, +419191319u, 3377973345u, +324924679u, 2809286837u, +1562277603u, 1378362199u, +3791551981u, 1097806406u, +1386297408u, 2304900033u, +3574135531u, 4017075736u, +1161238398u, 1358056883u, +3487080616u, 1516736273u, +851615042u, 2927899494u, +4077452507u, 2984955003u, +3907754394u, 3578173844u, +1948409509u, 1923531348u, +3578472493u, 3710074193u, +213811117u, 2586632018u, +1922589216u, 274958014u, +1654276320u, 2687561076u, +2569061755u, 3122046057u, +3203802620u, 1692079268u, +477806878u, 140587742u, +520565830u, 3674576684u, +91246882u, 1010215946u, +3703994407u, 69201295u, +776213083u, 3677771507u, +3696902571u, 3593730713u, +2907901228u, 3239753796u, +1586241476u, 1939595371u, +2268396558u, 3468719670u, +2955715987u, 2295501078u, +2775848696u, 1358532390u, +3843660102u, 82177963u, +4094477877u, 191727221u, +278661677u, 2889101923u, +1352525614u, 2844977667u, +1261140657u, 1747052377u, +2334120653u, 645125282u, +2707230761u, 4142246789u, +1068639717u, 2288162940u, +1419293714u, 1636932722u, +3252686293u, 318543902u, +2598802768u, 2025886508u, +2250788464u, 2711763065u, +255108733u, 1845587644u, +3719270134u, 3940707863u, +917608574u, 1363253259u, +788659330u, 673256220u, +109793386u, 341851980u, +2698465479u, 3011229884u, +3886713057u, 1276595523u, +2439962760u, 2700515456u, +205970448u, 4198897105u, +875511891u, 371715572u, +1033680610u, 4278599955u, +3120038721u, 1256300069u, +225629455u, 3735275001u, +3961944123u, 1769389163u, +1074553219u, 668829411u, +1098679359u, 2573697509u, +1885071395u, 4233785523u, +2513878053u, 2030193788u, +360256231u, 107312677u, +310517502u, 2618936366u, +3600462351u, 1216645846u, +2970730323u, 4278812598u, +94638678u, 1689811113u, +4125738800u, 3103759730u, +103797041u, 1397772514u, +1669653333u, 572567964u, +1612872497u, 2986430557u, +214990655u, 3117607990u, +1949717207u, 2260498180u, +1493936866u, 3554860960u, +1582022990u, 1263709570u, +1244120487u, 3416600761u, +224580012u, 4252610345u, +286306391u, 814956796u, +1820532305u, 2776960536u, +3082703465u, 1659265982u, +1157398049u, 3752806924u, +3508246460u, 2902716664u, +2110942730u, 3267551635u, +902835431u, 405228165u, +2341378668u, 2220373824u, +3303626294u, 1175118221u, +383517064u, 896322512u, +1697257567u, 2202820683u, +1837689083u, 1336556841u, +914535232u, 3634083711u, +1537187340u, 3712582785u, +1088201893u, 3270984620u, +3093195926u, 2561488770u, +1962968100u, 236189500u, +2549435227u, 536047554u, +422609195u, 2958815818u, +4166184983u, 3528794619u, +1042329086u, 3914176886u, +1359641525u, 1197100813u, +1269739674u, 3301844628u, +1831223342u, 3329594980u, +2433669782u, 494908536u, +1441714797u, 1174785921u, +1933050423u, 958901065u, +868981704u, 2163330264u, +3243110680u, 1443133429u, +1145009669u, 2520062970u, +3851564853u, 2664619323u, +2686075657u, 4042710240u, +2125408249u, 4165697916u, +2328730865u, 3160666939u, +588683409u, 2126275847u, +829404209u, 1878067032u, +2567792910u, 897670516u, +934312076u, 2952135524u, +504832490u, 3312698056u, +4015478120u, 1265237690u, +3376133707u, 967674402u, +1553513184u, 834830418u, +2396504772u, 3278582098u, +2950762705u, 4277111759u, +4159211303u, 1290097509u, +251949572u, 3065234219u, +1832020534u, 312136369u, +1103404394u, 198182691u, +1369599600u, 3906710870u, +2954651680u, 1535115487u, +2389327507u, 1813520230u, +632704095u, 140762681u, +3123202913u, 3336005523u, +1287729497u, 2198985327u, +2470730783u, 3821758006u, +1009870118u, 559702706u, +4274686257u, 3187546567u, +2402308151u, 1096697687u, +678932329u, 3716363135u, +2899950405u, 3046872820u, +3754655641u, 2021741414u, +1993425202u, 2185339100u, +2838253700u, 3099212100u, +1679617763u, 3703603898u, +1135665833u, 3559875668u, +2503579743u, 1446869792u, +879818611u, 3788305533u, +2879018745u, 2719373510u, +3606051203u, 2166567748u, +343595772u, 1996164093u, +1577656121u, 475248376u, +463852893u, 2864244470u, +1332049663u, 3326459767u, +3207234525u, 2028708916u, +938916154u, 3115246264u, +3272166407u, 557660441u, +1265684026u, 245033807u, +2440657523u, 255451671u, +3811885130u, 1399880284u, +1322855877u, 3452203069u, +1324994449u, 3796404024u, +2002090272u, 1568745354u, +3700047753u, 31799506u, +3009412313u, 3184047862u, +728680761u, 3848624873u, +1849329144u, 3160134214u, +1272923193u, 1474278816u, +1208883495u, 1566527339u, +4136466541u, 630825649u, +1717327230u, 1496132623u, +2449386742u, 128106940u, +2108574735u, 2584236470u, +2872246579u, 397338552u, +3088905079u, 3456882941u, +1715915153u, 2940716269u, +4168438718u, 467441309u, +872996731u, 3206901319u, +1610606159u, 2540270567u, +1301658081u, 2379410194u, +2109315753u, 3348545480u, +2041927873u, 2644077493u, +546596661u, 1017047954u, +2596792972u, 2783958892u, +2826408201u, 3531646869u, +2219352672u, 4217451852u, +1806867885u, 1903578924u, +2076465705u, 2373061493u, +1832925325u, 241574049u, +1509517110u, 3703614272u, +3429894862u, 3529565564u, +4010000614u, 2256197939u, +517086873u, 2964595704u, +3501035294u, 4079457298u, +1184683823u, 4260564140u, +2339268412u, 3871564102u, +1572637805u, 383233885u, +3351411126u, 3419328182u, +2017406667u, 919677938u, +29804156u, 46276077u, +3032591014u, 4204155962u, +1172319502u, 969309871u, +2211319468u, 4153726847u, +3094193193u, 4240669441u, +3441709766u, 1387233546u, +4048882438u, 1217896566u, +1580964938u, 740563169u, +3691850348u, 3176426539u, +2738323042u, 2948665536u, +1474029445u, 3513354882u, +3219466255u, 3799363969u, +3961796122u, 1055550923u, +1992212097u, 2263421398u, +4289759174u, 2516844140u, +1782515131u, 2746577402u, +721928440u, 3529570984u, +1705302106u, 768287270u, +3474902815u, 4000011125u, +3475618043u, 212490675u, +549130471u, 2970128275u, +3170016833u, 2549835613u, +3691104824u, 2694324482u, +4169365948u, 3738062408u, +602930397u, 2148954730u, +2636387819u, 2616619070u, +301617872u, 374657036u, +3862686086u, 431292293u, +4225245165u, 1358580562u, +2377363130u, 1415970351u, +3885060756u, 1438379807u, +2297418515u, 2954777083u, +3970368221u, 1229801760u, +1931934525u, 2287507921u, +1713471510u, 2145608111u, +2650140034u, 4081586725u, +4196863572u, 1896558394u, +4059852729u, 1813855658u, +2618400836u, 1396056469u, +2375584220u, 1037031473u, +249284003u, 2450077637u, +1383747654u, 3122687303u, +2664431743u, 3855028730u, +929335420u, 3193251135u, +137313762u, 1850894384u, +3163711272u, 3071568023u, +418541677u, 3621223039u, +340274176u, 1167681812u, +4106647531u, 4022465625u, +3069708839u, 2704165015u, +2332023349u, 641449034u, +921552000u, 1712976649u, +1876484273u, 2343049860u, +1834682077u, 4155949943u, +2061821157u, 4240649383u, +747285578u, 1626463554u, +165503115u, 359629739u, +3838102563u, 582664250u, +3878924635u, 4117237498u, +2250573853u, 804336148u, +331393443u, 4242530387u, +3346357270u, 1674051445u, +3348019777u, 1722242971u, +2509017299u, 2966108111u, +4189102509u, 3323592310u, +2631381069u, 4014551783u, +4250787412u, 3448394212u, +2664752123u, 3517585534u, +3605365141u, 1669471183u, +2210121140u, 760762191u, +249697459u, 3416920106u, +16322182u, 643179562u, +1564226597u, 2134630675u, +1011990087u, 2990167340u, +2349550842u, 1642428946u, +1214854475u, 2134299399u, +2704221532u, 2104175211u, +4283196353u, 1342880802u, +198529755u, 2004468390u, +2544665755u, 853593042u, +2090611294u, 2970943872u, +1472073141u, 850464484u, +1407609278u, 3062461105u, +366448238u, 3842907484u, +488797416u, 1432670231u, +294963924u, 3693536939u, +3390549825u, 1583234720u, +4032223840u, 2318423400u, +2965642867u, 930822729u, +1679099863u, 1728968857u, +900822335u, 702309817u, +3258354115u, 1502282913u, +2811888503u, 3924947660u, +2477280726u, 3651607391u, +3788310204u, 1300369123u, +1842333726u, 4146839064u, +2468893861u, 4091095953u, +488595746u, 1448097974u, +1159634090u, 1738834113u, +2928916831u, 4093725287u, +530850094u, 291657799u, +3548184546u, 679517009u, +399175380u, 2658337143u, +3827951761u, 3086277222u, +2067718397u, 3632376023u, +3553313841u, 119173722u, +1702434637u, 1766260771u, +895654784u, 751439914u, +4008409498u, 215917713u, +1288382231u, 2656990891u, +2581779077u, 1570750352u, +2666411616u, 3533987737u, +4289478316u, 3576119563u, +3869794273u, 963183826u, +2081410737u, 3796810515u, +1036883117u, 136547246u, +875691100u, 2592925324u, +2689342539u, 427154472u, +532957601u, 1228758574u, +1908591042u, 1464255968u, +446980910u, 2984611177u, +3508927906u, 2001585786u, +2544767379u, 1525438381u, +879448844u, 1348536411u, +4242243590u, 2861338018u, +601175800u, 764077711u, +530635011u, 3785343245u, +2378297261u, 457568934u, +76438221u, 4104954272u, +2485968477u, 2381948487u, +4226929450u, 3148473363u, +879369091u, 2180270337u, +3674375989u, 1387729170u, +568650985u, 951677556u, +4213877384u, 2721005055u, +1678669911u, 66786703u, +2273631661u, 1149351924u, +246723096u, 1895026827u, +3810605772u, 3711056516u, +2080120290u, 3638638708u, +2915672708u, 2263003308u, +1976115991u, 3448840877u, +2019238520u, 225333538u, +1555273378u, 3797521928u, +1942347150u, 3262952567u, +2817830907u, 2078619498u, +749534111u, 1178073973u, +841092198u, 3288261538u, +1696412169u, 1496966875u, +3739946319u, 2481012988u, +568983526u, 114945840u, +2841706923u, 1632780103u, +4020169654u, 2087949619u, +833416317u, 3787017905u, +2373238993u, 2575395164u, +2542976862u, 2971726178u, +2880371864u, 3642087909u, +1043714217u, 3894199764u, +2235879182u, 203853421u, +834683330u, 425935223u, +3560796393u, 3565833278u, +3414330886u, 1748785729u, +1023171602u, 580966986u, +2657385925u, 2124704694u, +233442446u, 1107045577u, +3899097693u, 1067532701u, +115667924u, 1406028344u, +2419657149u, 18613994u, +2532882091u, 3476683808u, +895961699u, 3762914298u, +1328752423u, 1844996900u, +1210281744u, 904215228u, +4055325594u, 1118521573u, +3996647489u, 3657647605u, +325254059u, 3136157065u, +3341068436u, 2287683323u, +1313073005u, 126005630u, +853746559u, 3555092974u, +2689238752u, 49515858u, +61073168u, 1010661841u, +1269521335u, 1902040126u, +3858321250u, 1400735275u, +2974699176u, 2771676666u, +545726212u, 2225229957u, +1086473152u, 3454177594u, +2088002891u, 2883475137u, +3222194252u, 4144472319u, +567988835u, 1051332394u, +3932046135u, 542648229u, +162888005u, 1669710469u, +1492500905u, 553041029u, +3817492747u, 584127807u, +4147115982u, 2993670925u, +3509733475u, 3587959456u, +2088550465u, 1745399498u, +869648362u, 1404723176u, +3947542735u, 1334333531u, +59634866u, 3239516985u, +3844250972u, 1275954779u, +2512155003u, 1685649437u, +639306006u, 2524620206u, +576786501u, 655707039u, +2864351838u, 3736264674u, +1200907897u, 2384379464u, +15823708u, 206117476u, +1193310960u, 1093099415u, +3696538026u, 4112584792u, +2069527017u, 547588820u, +4178147211u, 2827259351u, +940846775u, 1054995047u, +2976960697u, 1934305529u, +2199137382u, 1005722394u, +1875867180u, 2064356511u, +4019734130u, 3096333006u, +2069509024u, 2906358341u, +2232866485u, 1456016086u, +1422674894u, 867282151u, +1612503136u, 1739843072u, +134947567u, 2978775774u, +1284167756u, 1090844589u, +831688783u, 2079216362u, +1626991196u, 3644714163u, +3678110059u, 898470030u, +3916646913u, 3182422972u, +3630426828u, 969847973u, +3427164640u, 3463937250u, +3044785046u, 897322257u, +3443872170u, 4185408854u, +2557463241u, 4080940424u, +2048168570u, 2429169982u, +3174690447u, 2513494106u, +1213061732u, 3143736628u, +3482268149u, 1250714337u, +31648125u, 3872383625u, +1565760579u, 36665130u, +751041229u, 2257179590u, +2915361862u, 280819225u, +2907818413u, 4254297769u, +3493178615u, 3755944354u, +4043533423u, 1134196225u, +4177134659u, 127246419u, +2442615581u, 923049607u, +1004426206u, 782768297u, +2410586681u, 1430106871u, +4103323427u, 3168399477u, +3716682375u, 3616334719u, +3413209549u, 656672786u, +2876965944u, 182894450u, +456581318u, 2683752067u, +3877875910u, 3190666241u, +3240336907u, 4024807233u, +1681224377u, 1576191191u, +3599250276u, 2381111980u, +3495321877u, 3956024585u, +1611608524u, 3815677453u, +2062334396u, 1656117707u, +5457134u, 3234118251u, +470187419u, 2688566989u, +3259870297u, 660100446u, +442236198u, 2542452448u, +493137955u, 392411099u, +947967568u, 1234595917u, +4230082284u, 2762976773u, +2870085764u, 1455086530u, +2762099647u, 4011882747u, +1215981925u, 3227517889u, +3269061963u, 4037515364u, +3168911474u, 4255057396u, +2026092260u, 1736192508u, +3909727042u, 3114708966u, +1938800693u, 680793595u, +1525265867u, 2808224480u, +2122290603u, 1211197714u, +3520488321u, 3979192396u, +3540779343u, 4192918639u, +2736030448u, 1120335563u, +1698949078u, 3993310631u, +1966048551u, 2228221363u, +597941119u, 3498018399u, +393987327u, 454500547u, +1222959566u, 567151340u, +3774764786u, 1492844524u, +3308300614u, 805568076u, +868414882u, 177406999u, +1608110313u, 642061169u, +1027515771u, 3131251981u, +2851936150u, 4272755262u, +1532845092u, 709643652u, +682573592u, 1244104217u, +796769556u, 2500467040u, +3002618826u, 1112998535u, +1780193104u, 1243644607u, +3691719535u, 2958853053u, +466635014u, 2277292580u, +4082276003u, 1030800045u, +1750863246u, 379050598u, +3576413281u, 731493104u, +132259176u, 4115195437u, +1769890695u, 2715470335u, +1819263183u, 2028531518u, +2154809766u, 3672399742u, +76727603u, 4198182186u, +2304993586u, 1666387627u, +284366017u, 3359785538u, +3469807328u, 2926494787u, +3829072836u, 2493478921u, +3738499303u, 3311304980u, +932916545u, 2235559063u, +2909742396u, 1765719309u, +1456588655u, 508290328u, +1490719640u, 3356513470u, +2908490783u, 251085588u, +830410677u, 3172220325u, +3897208579u, 1940535730u, +151909546u, 2384458112u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; { uint64_t h = farmhashuo::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashuo::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashuo::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +{ uint64_t h = farmhashuo::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashuo::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashuoTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +{ uint64_t h = farmhashuo::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashuo::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashuoTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashuoTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashuoTest::Dump(0, i); + } + farmhashuoTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashxoTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +1140953930u, 861465670u, +3277735313u, 2681724312u, +2598464059u, 797982799u, +890626835u, 800175912u, +2603993599u, 921001710u, +1410420968u, 2134990486u, +3283896453u, 1867689945u, +2914424215u, 2244477846u, +255297188u, 2992121793u, +1110588164u, 4186314283u, +161451183u, 3943596029u, +4019337850u, 452431531u, +283198166u, 2741341286u, +3379021470u, 2557197665u, +299850021u, 2532580744u, +452473466u, 1706958772u, +1298374911u, 3099673830u, +2199864459u, 3696623795u, +236935126u, 2976578695u, +4055299123u, 3281581178u, +1053458494u, 1882212500u, +2305012065u, 2169731866u, +3456121707u, 275903667u, +458884671u, 3033004529u, +3058973506u, 2379411653u, +1898235244u, 1402319660u, +2700149065u, 2699376854u, +147814787u, 720739346u, +2433714046u, 4222949502u, +4220361840u, 1712034059u, +3425469811u, 3690733394u, +4148372108u, 1330324210u, +594028478u, 2921867846u, +1635026870u, 192883107u, +780716741u, 1728752234u, +3280331829u, 326029180u, +3969463346u, 1436364519u, +393215742u, 3349570000u, +3824583307u, 1612122221u, +2859809759u, 3808705738u, +1379537552u, 1646032583u, +2233466664u, 1432476832u, +4023053163u, 2650381482u, +2052294713u, 3552092450u, +1628777059u, 1499109081u, +3476440786u, 3829307897u, +2960536756u, 1554038301u, +1145519619u, 3190844552u, +2902102606u, 3600725550u, +237495366u, 540224401u, +65721842u, 489963606u, +1448662590u, 397635823u, +1596489240u, 1562872448u, +1790705123u, 2128624475u, +180854224u, 2604346966u, +1435705557u, 1262831810u, +155445229u, 1672724608u, +1669465176u, 1341975128u, +663607706u, 2077310004u, +3610042449u, 1911523866u, +1043692997u, 1454396064u, +2563776023u, 294527927u, +1099072299u, 1389770549u, +703505868u, 678706990u, +2952353448u, 2026137563u, +3603803785u, 629449419u, +1933894405u, 3043213226u, +226132789u, 2489287368u, +1552847036u, 645684964u, +3828089804u, 3632594520u, +187883449u, 230403464u, +3151491850u, 3272648435u, +3729087873u, 1303930448u, +2002861219u, 165370827u, +916494250u, 1230085527u, +3103338579u, 3064290191u, +3807265751u, 3628174014u, +231181488u, 851743255u, +2295806711u, 1781190011u, +2988893883u, 1554380634u, +1142264800u, 3667013118u, +1968445277u, 315203929u, +2638023604u, 2290487377u, +732137533u, 1909203251u, +440398219u, 1891630171u, +1380301172u, 1498556724u, +4072067757u, 4165088768u, +4204318635u, 441430649u, +3931792696u, 197618179u, +956300927u, 914413116u, +3010839769u, 2837339569u, +2148126371u, 1913303225u, +3074915312u, 3117299654u, +4139181436u, 2993479124u, +3178848746u, 1357272220u, +1438494951u, 507436733u, +667183474u, 2084369203u, +3854939912u, 1413396341u, +126024219u, 146044391u, +1016656857u, 3022024459u, +3254014218u, 429095991u, +990500595u, 3056862311u, +985653208u, 1718653828u, +623071693u, 366414107u, +1771289760u, 2293458109u, +3047342438u, 2991127487u, +3120876698u, 1684583131u, +3638043310u, 1170404994u, +863214540u, 1087193030u, +199124911u, 520792961u, +3169775996u, 1577421232u, +3331828431u, 1013201099u, +1716848157u, 4033596884u, +1770708857u, 4229339322u, +1146169032u, 1434258493u, +3824360466u, 3242407770u, +1926419493u, 2649785113u, +872586426u, 762243036u, +2736953692u, 816692935u, +1571283333u, 3555213933u, +2266795890u, 3781899767u, +4290630595u, 517646945u, +3006163611u, 2180594090u, +959214578u, 558910384u, +1283799121u, 3047062993u, +3830962609u, 2391606125u, +3544509313u, 622325861u, +834785312u, 382936554u, +1421463872u, 788479970u, +1825135056u, 2725923798u, +580988377u, 2826990641u, +247825043u, 3167748333u, +812546227u, 2506885666u, +2584372201u, 1758123094u, +1891789696u, 389974094u, +345313518u, 2022370576u, +3886113119u, 3338548567u, +1083486947u, 2583576230u, +1776047957u, 1771384107u, +3604937815u, 3198590202u, +3027522813u, 4155628142u, +4232136669u, 427759438u, +4244322689u, 542201663u, +1549591985u, 2856634168u, +556609672u, 45845311u, +1175961330u, 3948351189u, +4165739882u, 4194218315u, +1634635545u, 4151937410u, +713127376u, 1467786451u, +1327394015u, 2743592929u, +2638154051u, 810082938u, +3077742128u, 1062268187u, +4084325664u, 3810665822u, +3735739145u, 2794294783u, +2335576331u, 2560479831u, +690240711u, 997658837u, +2442302747u, 3948961926u, +3958366652u, 3067277639u, +2059157774u, 1211737169u, +1516711748u, 2339636583u, +4188504038u, 59581167u, +2767897792u, 1389679610u, +2658147000u, 2643979752u, +3758739543u, 4189944477u, +1454470782u, 100876854u, +2995362413u, 118817200u, +3252925478u, 2062343506u, +2804483644u, 3088828656u, +1231633714u, 4168280671u, +2931588131u, 3284356565u, +1255909792u, 3130054947u, +4173605289u, 1407328702u, +1677744031u, 3532596884u, +3162657845u, 3887208531u, +2256541290u, 3459463480u, +3740979556u, 259034107u, +392987633u, 3233195759u, +3606709555u, 3424793077u, +315836068u, 3200749877u, +4065431359u, 760633989u, +2982018998u, 1811050648u, +234531934u, 1115203611u, +3897494162u, 1516407838u, +1603559457u, 323296368u, +2632963283u, 1778459926u, +2879836826u, 2146672889u, +3486330348u, 492621815u, +1231665285u, 2457048126u, +3438440082u, 2217471853u, +3355404249u, 3275550588u, +1052645068u, 862072556u, +4110617119u, 3745267835u, +2657392572u, 4279236653u, +1688445808u, 701920051u, +956734128u, 581695350u, +3157862788u, 2585726058u, +1192588249u, 1410111809u, +1651193125u, 3326135446u, +1073280453u, 97376972u, +2513844237u, 2187968410u, +3976859649u, 4267859263u, +3429034542u, 564493077u, +3000537321u, 479241367u, +3845637831u, 2868987960u, +51544337u, 1029173765u, +393624922u, 704325635u, +2357610553u, 1418509533u, +2007814586u, 3866658271u, +3082385053u, 735688735u, +916110004u, 3283299459u, +1051684175u, 1083796807u, +4074716319u, 813690332u, +144264390u, 1439630796u, +1508556987u, 675582689u, +3748881891u, 3195309868u, +362884708u, 1616408198u, +43233176u, 837301135u, +881504822u, 3254795114u, +1385506591u, 2799925823u, +1469874582u, 3464841997u, +497175391u, 3929484338u, +3975771289u, 1798536177u, +2926265846u, 1374242438u, +3675707838u, 4205965408u, +3153165629u, 1499475160u, +187287713u, 548490821u, +3255259608u, 4247675634u, +1940181471u, 3779953975u, +687167150u, 2319566715u, +1742785722u, 785893184u, +2296977392u, 2778575413u, +1794720651u, 48131484u, +4084891412u, 1160134629u, +3737623280u, 823113169u, +3423207646u, 3803213486u, +710625654u, 4116162021u, +3693420287u, 4167766971u, +1666602807u, 295320990u, +3513255468u, 2487440590u, +234080704u, 4004655503u, +2971762528u, 1479656873u, +4090178629u, 4044418876u, +391947536u, 1462554406u, +3909295855u, 1239580330u, +1515601363u, 2011102035u, +1442068334u, 4265993528u, +1191921695u, 2291355695u, +4257172787u, 576405853u, +314332944u, 4038839101u, +55559918u, 2378985842u, +711098718u, 2425317635u, +1644327317u, 1401013391u, +4193760037u, 2958260436u, +3167371443u, 3062418115u, +3800755475u, 3167030094u, +3489648204u, 1405430357u, +526177822u, 2602636307u, +915406019u, 4264167741u, +1484090483u, 3070944737u, +254529415u, 4017058800u, +1702710265u, 1029665228u, +2000382906u, 3185573940u, +1381258384u, 4036354071u, +2900841028u, 2670703363u, +2921748807u, 2899069938u, +4130543625u, 688472265u, +4186808827u, 1054670286u, +1132985391u, 2840525968u, +4175776103u, 338058159u, +1735964501u, 1539305024u, +3497121710u, 1568260669u, +2227290760u, 146827036u, +3977176001u, 4060134777u, +857488494u, 250055052u, +4284109679u, 2502815838u, +2592281721u, 1603444633u, +1390562014u, 1556658131u, +616327404u, 2448966429u, +3051191726u, 3891353218u, +1213304082u, 762328245u, +2239052397u, 1082330589u, +2455957292u, 201837927u, +405397452u, 3079886794u, +2583939798u, 2848283092u, +3750724631u, 883849006u, +3204198988u, 3341327098u, +1855234968u, 1982110346u, +1485529487u, 541496720u, +4117290321u, 3607433551u, +2168864636u, 133643215u, +1055817409u, 3847827123u, +2960769387u, 4046101649u, +1176127003u, 4015671361u, +4243643405u, 2849988118u, +517111221u, 1796672358u, +2045051700u, 3452457457u, +2948254999u, 2102063419u, +1556410577u, 1536380876u, +3776661467u, 3281002516u, +1735616066u, 1539151988u, +1087795162u, 3332431596u, +685631442u, 1147951686u, +95237878u, 2005032160u, +4012206915u, 4224354805u, +3204999386u, 2415262714u, +1433635018u, 116647396u, +83167836u, 2881562655u, +2729416454u, 1029284767u, +881378302u, 2159170082u, +555057366u, 1169104445u, +3963877000u, 1919171906u, +336034862u, 2017579106u, +4059340529u, 3020819343u, +865146997u, 2473524405u, +944743644u, 1694443528u, +1804513294u, 2904752429u, +617975720u, 3671562289u, +260177668u, 505662155u, +1885941445u, 2504509403u, +2260041112u, 1019936943u, +3722741628u, 1511077569u, +3100701179u, 1379422864u, +1535670711u, 773792826u, +1103819072u, 2089123665u, +1157547425u, 329152940u, +4142587430u, 484732447u, +2475035432u, 1120017626u, +412145504u, 965125959u, +324924679u, 2809286837u, +2842141483u, 4029205195u, +2974306813u, 515627448u, +3791551981u, 1097806406u, +3873078673u, 136118734u, +1872130856u, 3632422367u, +3574135531u, 4017075736u, +1699452298u, 1403506686u, +344414660u, 1189129691u, +3487080616u, 1516736273u, +1805475756u, 2562064338u, +163335594u, 2732147834u, +4077452507u, 2984955003u, +4271866024u, 3071338162u, +2347111903u, 873829983u, +1948409509u, 1923531348u, +459509140u, 771592405u, +1750124750u, 2334938333u, +213811117u, 2586632018u, +185232757u, 4032960199u, +2447383637u, 284777551u, +1654276320u, 2687561076u, +3512945009u, 308584855u, +1861027147u, 4102279334u, +3203802620u, 1692079268u, +4250142168u, 2565680167u, +1507046104u, 841195925u, +520565830u, 3674576684u, +38924274u, 3770488806u, +2414430882u, 3978473838u, +3703994407u, 69201295u, +3099963860u, 1255084262u, +690971838u, 3539996781u, +3696902571u, 3593730713u, +2363435042u, 54945052u, +1785765213u, 184911581u, +1586241476u, 1939595371u, +2534883189u, 2432427547u, +2374171993u, 2039128933u, +2955715987u, 2295501078u, +2741583197u, 1280920000u, +686818699u, 1238742497u, +3843660102u, 82177963u, +1281043691u, 1121403845u, +1697846708u, 284852964u, +278661677u, 2889101923u, +2127558730u, 713121337u, +872502474u, 511142139u, +1261140657u, 1747052377u, +2108187161u, 927011680u, +955328267u, 3821994995u, +2707230761u, 4142246789u, +4134691985u, 1958963937u, +2498463509u, 1977988705u, +1419293714u, 1636932722u, +2567532373u, 4075249328u, +240575705u, 1956681213u, +2598802768u, 2025886508u, +4104757832u, 3026358429u, +3242615202u, 4026813725u, +255108733u, 1845587644u, +3573008472u, 3615577014u, +1222733548u, 1205557630u, +917608574u, 1363253259u, +1541946015u, 3087190425u, +1138008081u, 1444019663u, +109793386u, 341851980u, +857839960u, 2515339233u, +156283211u, 1906768669u, +3886713057u, 1276595523u, +2809830736u, 460237542u, +3420452099u, 142985419u, +205970448u, 4198897105u, +1950698961u, 2069753399u, +1142216925u, 1113051162u, +1033680610u, 4278599955u, +1106466069u, 356742959u, +531521052u, 3494863964u, +225629455u, 3735275001u, +3662626864u, 1750561299u, +1012864651u, 2101846429u, +1074553219u, 668829411u, +992181339u, 3384018814u, +3330664522u, 860966321u, +1885071395u, 4233785523u, +100741310u, 451656820u, +2148187612u, 1063001151u, +360256231u, 107312677u, +3650357479u, 2390172694u, +22452685u, 237319043u, +3600462351u, 1216645846u, +2088767754u, 164402616u, +2418980170u, 926137824u, +94638678u, 1689811113u, +2751052984u, 1767810825u, +271289013u, 3896132233u, +103797041u, 1397772514u, +3441135892u, 3323383489u, +2491268371u, 1662561885u, +1612872497u, 2986430557u, +2756998822u, 207428029u, +937973965u, 2791656726u, +1949717207u, 2260498180u, +2648427775u, 2360400900u, +2080496169u, 486358863u, +1582022990u, 1263709570u, +1396468647u, 1377764574u, +363008508u, 1293502429u, +224580012u, 4252610345u, +1435134775u, 1099809675u, +533671980u, 1533438766u, +1820532305u, 2776960536u, +3374512975u, 3542220540u, +822810075u, 3716663290u, +1157398049u, 3752806924u, +4081637863u, 337070226u, +3866585976u, 359270190u, +2110942730u, 3267551635u, +644850146u, 1306761320u, +746972907u, 934259457u, +2341378668u, 2220373824u, +1242645122u, 4109252858u, +1625266099u, 1173698481u, +383517064u, 896322512u, +3377483696u, 1788337208u, +455496839u, 3194373887u, +1837689083u, 1336556841u, +1658628529u, 2911512007u, +3838343487u, 2757664765u, +1537187340u, 3712582785u, +367022558u, 3071359622u, +3926147070u, 35432879u, +3093195926u, 2561488770u, +4273132307u, 3898950547u, +2838251049u, 2103926083u, +2549435227u, 536047554u, +1858986613u, 2040551642u, +1147412575u, 1972369852u, +4166184983u, 3528794619u, +4077477194u, 3565689036u, +808048238u, 3826350461u, +1359641525u, 1197100813u, +265993036u, 1864569342u, +725164342u, 2264788336u, +1831223342u, 3329594980u, +923017956u, 490608221u, +3818634478u, 258154469u, +1441714797u, 1174785921u, +3833372385u, 3287246572u, +1677395563u, 3569218731u, +868981704u, 2163330264u, +2649450292u, 500120236u, +465161780u, 746438382u, +1145009669u, 2520062970u, +2810524030u, 1561519055u, +1479878006u, 3864969305u, +2686075657u, 4042710240u, +3224066062u, 2774151984u, +2226179547u, 1643626042u, +2328730865u, 3160666939u, +2107011431u, 96459446u, +3920328742u, 3336407558u, +829404209u, 1878067032u, +1235983679u, 4237425634u, +466519055u, 3870676863u, +934312076u, 2952135524u, +276949224u, 4100839753u, +424001484u, 1955120893u, +4015478120u, 1265237690u, +427484362u, 4246879223u, +3452969617u, 1724363362u, +1553513184u, 834830418u, +1858777639u, 3476334357u, +4144030366u, 2450047160u, +2950762705u, 4277111759u, +358032121u, 2511026735u, +167923105u, 2059208280u, +251949572u, 3065234219u, +1535473864u, 556796152u, +1513237478u, 3150857516u, +1103404394u, 198182691u, +1476438092u, 2913077464u, +207119516u, 3963810232u, +2954651680u, 1535115487u, +3051522276u, 4046477658u, +917804636u, 864395565u, +632704095u, 140762681u, +1802040304u, 990407433u, +3771506212u, 4106024923u, +1287729497u, 2198985327u, +4052924496u, 2926590471u, +3084557148u, 1472898694u, +1009870118u, 559702706u, +4265214507u, 82077489u, +3067891003u, 3295678907u, +2402308151u, 1096697687u, +464407878u, 4190838199u, +4269578403u, 3060919438u, +2899950405u, 3046872820u, +733509243u, 1583801700u, +40453902u, 3879773881u, +1993425202u, 2185339100u, +1877837196u, 3912423882u, +3293122640u, 4104318469u, +1679617763u, 3703603898u, +8759461u, 2540185277u, +1152198475u, 2038345882u, +2503579743u, 1446869792u, +2019419351u, 4051584612u, +3178289407u, 3992503830u, +2879018745u, 2719373510u, +700836153u, 1675560450u, +4121245793u, 2064715719u, +343595772u, 1996164093u, +3130433948u, 405251683u, +2804817126u, 1607133689u, +463852893u, 2864244470u, +2224044848u, 4071581802u, +2537107938u, 2246347953u, +3207234525u, 2028708916u, +2272418128u, 803575837u, +38655481u, 2170452091u, +3272166407u, 557660441u, +4019147902u, 3841480082u, +298459606u, 2600943364u, +2440657523u, 255451671u, +3424361375u, 779434428u, +3088526123u, 490671625u, +1322855877u, 3452203069u, +3057021940u, 2285701422u, +2014993457u, 2390431709u, +2002090272u, 1568745354u, +1783152480u, 823305654u, +4053862835u, 2200236540u, +3009412313u, 3184047862u, +3032187389u, 4159715581u, +2966902888u, 252986948u, +1849329144u, 3160134214u, +3420960112u, 3198900547u, +749160960u, 379139040u, +1208883495u, 1566527339u, +3006227299u, 4194096960u, +556075248u, 497404038u, +1717327230u, 1496132623u, +1775955687u, 1719108984u, +1014328900u, 4189966956u, +2108574735u, 2584236470u, +684087286u, 531310503u, +4264509527u, 773405691u, +3088905079u, 3456882941u, +3105682208u, 3382290593u, +2289363624u, 3296306400u, +4168438718u, 467441309u, +777173623u, 3241407531u, +1183994815u, 1132983260u, +1610606159u, 2540270567u, +2649684057u, 1397502982u, +146657385u, 3318434267u, +2109315753u, 3348545480u, +3193669211u, 811750340u, +1073256162u, 3571673088u, +546596661u, 1017047954u, +3403136990u, 2540585554u, +1477047647u, 4145867423u, +2826408201u, 3531646869u, +784952939u, 943914610u, +2717443875u, 3657384638u, +1806867885u, 1903578924u, +3985088434u, 1911188923u, +1764002686u, 3672748083u, +1832925325u, 241574049u, +519948041u, 3181425568u, +2939747257u, 1634174593u, +3429894862u, 3529565564u, +1089679033u, 240953857u, +2025369941u, 2695166650u, +517086873u, 2964595704u, +3017658263u, 3828377737u, +2144895011u, 994799311u, +1184683823u, 4260564140u, +308018483u, 4262383425u, +1374752558u, 3431057723u, +1572637805u, 383233885u, +3188015819u, 4051263539u, +233319221u, 3794788167u, +2017406667u, 919677938u, +4074952232u, 1683612329u, +4213676186u, 327142514u, +3032591014u, 4204155962u, +206775997u, 2283918569u, +2395147154u, 3427505379u, +2211319468u, 4153726847u, +2217060665u, 350160869u, +2493667051u, 1648200185u, +3441709766u, 1387233546u, +140980u, 1891558063u, +760080239u, 2088061981u, +1580964938u, 740563169u, +422986366u, 330624974u, +4264507722u, 150928357u, +2738323042u, 2948665536u, +918718096u, 376390582u, +3966098971u, 717653678u, +3219466255u, 3799363969u, +3424344721u, 3187805406u, +375347278u, 3490350144u, +1992212097u, 2263421398u, +3855037968u, 1928519266u, +3866327955u, 1129127000u, +1782515131u, 2746577402u, +3059200728u, 2108753646u, +2738070963u, 1336849395u, +1705302106u, 768287270u, +1343511943u, 2247006571u, +1956142255u, 1780259453u, +3475618043u, 212490675u, +622521957u, 917121602u, +1852992332u, 1267987847u, +3170016833u, 2549835613u, +3299763344u, 2864033668u, +3378768767u, 1236609378u, +4169365948u, 3738062408u, +2661022773u, 2006922227u, +2760592161u, 3828932355u, +2636387819u, 2616619070u, +1237256330u, 3449066284u, +2871755260u, 3729280948u, +3862686086u, 431292293u, +3285899651u, 786322314u, +2531158535u, 724901242u, +2377363130u, 1415970351u, +1244759631u, 3263135197u, +965248856u, 174024139u, +2297418515u, 2954777083u, +987586766u, 3206261120u, +4059515114u, 3903854066u, +1931934525u, 2287507921u, +1827135136u, 1781944746u, +574617451u, 2299034788u, +2650140034u, 4081586725u, +2482286699u, 1109175923u, +458483596u, 618705848u, +4059852729u, 1813855658u, +4190721328u, 1129462471u, +4089998050u, 3575732749u, +2375584220u, 1037031473u, +1623777358u, 3389003793u, +546597541u, 352770237u, +1383747654u, 3122687303u, +1646071378u, 1164309901u, +290870767u, 830691298u, +929335420u, 3193251135u, +989577914u, 3626554867u, +591974737u, 3996958215u, +3163711272u, 3071568023u, +1516846461u, 3656006011u, +2698625268u, 2510865430u, +340274176u, 1167681812u, +3698796465u, 3155218919u, +4102288238u, 1673474350u, +3069708839u, 2704165015u, +1237411891u, 1854985978u, +3646837503u, 3625406022u, +921552000u, 1712976649u, +3939149151u, 878608872u, +3406359248u, 1068844551u, +1834682077u, 4155949943u, +2437686324u, 3163786257u, +2645117577u, 1988168803u, +747285578u, 1626463554u, +1235300371u, 1256485167u, +1914142538u, 4141546431u, +3838102563u, 582664250u, +1883344352u, 2083771672u, +2611657933u, 2139079047u, +2250573853u, 804336148u, +3066325351u, 2770847216u, +4275641370u, 1455750577u, +3346357270u, 1674051445u, +601221482u, 3992583643u, +1402445097u, 3622527604u, +2509017299u, 2966108111u, +2557027816u, 900741486u, +1790771021u, 2912643797u, +2631381069u, 4014551783u, +90375300u, 300318232u, +3269968032u, 2679371729u, +2664752123u, 3517585534u, +3253901179u, 542270815u, +1188641600u, 365479232u, +2210121140u, 760762191u, +1273768482u, 1216399252u, +3484324231u, 4287337666u, +16322182u, 643179562u, +325675502u, 3652676161u, +3120716054u, 3330259752u, +1011990087u, 2990167340u, +1097584090u, 3262252593u, +1829409951u, 3665087267u, +1214854475u, 2134299399u, +3704419305u, 411263051u, +1625446136u, 549838529u, +4283196353u, 1342880802u, +3460621305u, 1967599860u, +4282843369u, 1275671016u, +2544665755u, 853593042u, +901109753u, 2682611693u, +110631633u, 797487791u, +1472073141u, 850464484u, +797089608u, 3286110054u, +350397471u, 2775631060u, +366448238u, 3842907484u, +2219863904u, 3623364733u, +1850985302u, 4009616991u, +294963924u, 3693536939u, +3061255808u, 1615375832u, +1920066675u, 4113028420u, +4032223840u, 2318423400u, +2701956286u, 4145497671u, +3991532344u, 2536338351u, +1679099863u, 1728968857u, +449740816u, 2686506989u, +685242457u, 97590863u, +3258354115u, 1502282913u, +1235084019u, 2151665147u, +528459289u, 231097464u, +2477280726u, 3651607391u, +2091754612u, 1178454681u, +980597335u, 1604483865u, +1842333726u, 4146839064u, +3213794286u, 2601416506u, +754220096u, 3571436033u, +488595746u, 1448097974u, +4004834921u, 238887261u, +3320337489u, 1416989070u, +2928916831u, 4093725287u, +186020771u, 2367569534u, +3046087671u, 4090084518u, +3548184546u, 679517009u, +1962659444u, 3539886328u, +4192003933u, 1678423485u, +3827951761u, 3086277222u, +2144472852u, 1390394371u, +2976322029u, 1574517163u, +3553313841u, 119173722u, +1702434637u, 1766260771u, +3629581771u, 1407497759u, +895654784u, 751439914u, +4008409498u, 215917713u, +1482103833u, 695551833u, +1288382231u, 2656990891u, +2581779077u, 1570750352u, +3710689053u, 1741390464u, +2666411616u, 3533987737u, +4289478316u, 3576119563u, +4118694920u, 108199666u, +3869794273u, 963183826u, +2081410737u, 3796810515u, +791123882u, 2525792704u, +1036883117u, 136547246u, +875691100u, 2592925324u, +614302599u, 3013176417u, +2689342539u, 427154472u, +532957601u, 1228758574u, +1898117151u, 1181643858u, +1908591042u, 1464255968u, +446980910u, 2984611177u, +58509511u, 1046943619u, +3508927906u, 2001585786u, +2544767379u, 1525438381u, +552181222u, 1959725830u, +879448844u, 1348536411u, +4242243590u, 2861338018u, +1082052441u, 1034351453u, +601175800u, 764077711u, +530635011u, 3785343245u, +2178026726u, 117256687u, +2378297261u, 457568934u, +76438221u, 4104954272u, +956793873u, 3783168634u, +2485968477u, 2381948487u, +4226929450u, 3148473363u, +2518273601u, 3569490233u, +879369091u, 2180270337u, +3674375989u, 1387729170u, +977997984u, 4270646856u, +568650985u, 951677556u, +4213877384u, 2721005055u, +1073364549u, 2563403831u, +1678669911u, 66786703u, +2273631661u, 1149351924u, +3651298990u, 1581883443u, +246723096u, 1895026827u, +3810605772u, 3711056516u, +4058833288u, 2193790614u, +2080120290u, 3638638708u, +2915672708u, 2263003308u, +2361934197u, 4136767460u, +1976115991u, 3448840877u, +2019238520u, 225333538u, +874340815u, 2976159827u, +1555273378u, 3797521928u, +1942347150u, 3262952567u, +435997738u, 340403353u, +2817830907u, 2078619498u, +749534111u, 1178073973u, +894654712u, 3361226032u, +841092198u, 3288261538u, +1696412169u, 1496966875u, +697501571u, 1059158875u, +3739946319u, 2481012988u, +568983526u, 114945840u, +1559249010u, 2218244008u, +2841706923u, 1632780103u, +4020169654u, 2087949619u, +2438736103u, 24032648u, +833416317u, 3787017905u, +2373238993u, 2575395164u, +3434544481u, 3228481067u, +2542976862u, 2971726178u, +2880371864u, 3642087909u, +2407477975u, 2239080836u, +1043714217u, 3894199764u, +2235879182u, 203853421u, +2933669448u, 2504940536u, +834683330u, 425935223u, +3560796393u, 3565833278u, +1668000829u, 3683399154u, +3414330886u, 1748785729u, +1023171602u, 580966986u, +2531038985u, 3227325488u, +2657385925u, 2124704694u, +233442446u, 1107045577u, +3407293834u, 552770757u, +3899097693u, 1067532701u, +115667924u, 1406028344u, +1707768231u, 3724015962u, +2419657149u, 18613994u, +2532882091u, 3476683808u, +1560838678u, 811220224u, +895961699u, 3762914298u, +1328752423u, 1844996900u, +1420427894u, 1848067707u, +1210281744u, 904215228u, +4055325594u, 1118521573u, +2496554183u, 2579259919u, +3996647489u, 3657647605u, +325254059u, 3136157065u, +3951522674u, 4052925250u, +3341068436u, 2287683323u, +1313073005u, 126005630u, +2505120084u, 1194725057u, +853746559u, 3555092974u, +2689238752u, 49515858u, +1244776042u, 1069300695u, +61073168u, 1010661841u, +1269521335u, 1902040126u, +990632502u, 2378708922u, +3858321250u, 1400735275u, +2974699176u, 2771676666u, +170995186u, 2877798589u, +545726212u, 2225229957u, +1086473152u, 3454177594u, +3859483262u, 1499729584u, +2088002891u, 2883475137u, +3222194252u, 4144472319u, +2212229854u, 4146740722u, +567988835u, 1051332394u, +3932046135u, 542648229u, +3017852446u, 1277887997u, +162888005u, 1669710469u, +1492500905u, 553041029u, +1434876932u, 533989516u, +3817492747u, 584127807u, +4147115982u, 2993670925u, +4020312558u, 710021255u, +3509733475u, 3587959456u, +2088550465u, 1745399498u, +2952242967u, 1259815443u, +869648362u, 1404723176u, +3947542735u, 1334333531u, +3873471582u, 229399758u, +59634866u, 3239516985u, +3844250972u, 1275954779u, +1385684948u, 2243700741u, +2512155003u, 1685649437u, +639306006u, 2524620206u, +955360345u, 1646776457u, +576786501u, 655707039u, +2864351838u, 3736264674u, +655621239u, 362070173u, +1200907897u, 2384379464u, +15823708u, 206117476u, +3652870937u, 122927134u, +1193310960u, 1093099415u, +3696538026u, 4112584792u, +1834541277u, 845639252u, +2069527017u, 547588820u, +4178147211u, 2827259351u, +1764455305u, 3312003602u, +940846775u, 1054995047u, +2976960697u, 1934305529u, +3095615046u, 3354962706u, +2199137382u, 1005722394u, +1875867180u, 2064356511u, +3363633633u, 2688499147u, +4019734130u, 3096333006u, +2069509024u, 2906358341u, +3247463123u, 4191788132u, +2232866485u, 1456016086u, +1422674894u, 867282151u, +1851386407u, 1268304058u, +1612503136u, 1739843072u, +134947567u, 2978775774u, +2051592101u, 1017127033u, +1284167756u, 1090844589u, +831688783u, 2079216362u, +2079309682u, 1950585801u, +1626991196u, 3644714163u, +3678110059u, 898470030u, +1117570988u, 2517572125u, +3916646913u, 3182422972u, +3630426828u, 969847973u, +2835126238u, 53541366u, +3427164640u, 3463937250u, +3044785046u, 897322257u, +103038235u, 3804506837u, +3443872170u, 4185408854u, +2557463241u, 4080940424u, +3669923099u, 2789619871u, +2048168570u, 2429169982u, +3174690447u, 2513494106u, +3099587829u, 2627855577u, +1213061732u, 3143736628u, +3482268149u, 1250714337u, +3553412672u, 2689632914u, +31648125u, 3872383625u, +1565760579u, 36665130u, +1282106920u, 359361724u, +751041229u, 2257179590u, +2915361862u, 280819225u, +954406473u, 4101682199u, +2907818413u, 4254297769u, +3493178615u, 3755944354u, +3539557658u, 3330196096u, +4043533423u, 1134196225u, +4177134659u, 127246419u, +4213770762u, 1978302978u, +2442615581u, 923049607u, +1004426206u, 782768297u, +2702745496u, 1880389457u, +2410586681u, 1430106871u, +4103323427u, 3168399477u, +201787012u, 3105353527u, +3716682375u, 3616334719u, +3413209549u, 656672786u, +526032790u, 2895072131u, +2876965944u, 182894450u, +456581318u, 2683752067u, +1287916294u, 1270745752u, +3877875910u, 3190666241u, +3240336907u, 4024807233u, +4227999465u, 2389301430u, +1681224377u, 1576191191u, +3599250276u, 2381111980u, +3995044500u, 995595530u, +3495321877u, 3956024585u, +1611608524u, 3815677453u, +1520987487u, 3669102590u, +2062334396u, 1656117707u, +5457134u, 3234118251u, +4242065111u, 596879987u, +470187419u, 2688566989u, +3259870297u, 660100446u, +1042378442u, 2206034096u, +442236198u, 2542452448u, +493137955u, 392411099u, +3111186954u, 438250493u, +947967568u, 1234595917u, +4230082284u, 2762976773u, +421203727u, 3728409592u, +2870085764u, 1455086530u, +2762099647u, 4011882747u, +1785430706u, 3684427488u, +1215981925u, 3227517889u, +3269061963u, 4037515364u, +1749401388u, 2167451566u, +3168911474u, 4255057396u, +2026092260u, 1736192508u, +4123254745u, 2319366806u, +3909727042u, 3114708966u, +1938800693u, 680793595u, +3933041672u, 616863613u, +1525265867u, 2808224480u, +2122290603u, 1211197714u, +1186177814u, 2395325006u, +3520488321u, 3979192396u, +3540779343u, 4192918639u, +1763872074u, 3402419930u, +2736030448u, 1120335563u, +1698949078u, 3993310631u, +2947659998u, 1461045789u, +1966048551u, 2228221363u, +597941119u, 3498018399u, +1441110751u, 2229999711u, +393987327u, 454500547u, +1222959566u, 567151340u, +2496952483u, 1708770195u, +3774764786u, 1492844524u, +3308300614u, 805568076u, +4068812294u, 3404648243u, +868414882u, 177406999u, +1608110313u, 642061169u, +2093999089u, 222470301u, +1027515771u, 3131251981u, +2851936150u, 4272755262u, +2763002551u, 1881527822u, +1532845092u, 709643652u, +682573592u, 1244104217u, +440905170u, 1111321746u, +796769556u, 2500467040u, +3002618826u, 1112998535u, +1188525643u, 4212674512u, +1780193104u, 1243644607u, +3691719535u, 2958853053u, +2813437721u, 4036584207u, +466635014u, 2277292580u, +4082276003u, 1030800045u, +1899531424u, 609466946u, +1750863246u, 379050598u, +3576413281u, 731493104u, +2707384133u, 2289193651u, +132259176u, 4115195437u, +1769890695u, 2715470335u, +3348954692u, 2166575624u, +1819263183u, 2028531518u, +2154809766u, 3672399742u, +1142139448u, 88299682u, +76727603u, 4198182186u, +2304993586u, 1666387627u, +2488475423u, 3832777692u, +284366017u, 3359785538u, +3469807328u, 2926494787u, +1914195188u, 1134129972u, +3829072836u, 2493478921u, +3738499303u, 3311304980u, +726951526u, 911080963u, +932916545u, 2235559063u, +2909742396u, 1765719309u, +465269850u, 3803621553u, +1456588655u, 508290328u, +1490719640u, 3356513470u, +2262196163u, 1451774941u, +2908490783u, 251085588u, +830410677u, 3172220325u, +4039692645u, 1383603170u, +3897208579u, 1940535730u, +151909546u, 2384458112u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; { uint64_t h = farmhashxo::Hash64WithSeeds(data, len++, SEED0, SEED1); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashxo::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashxo::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +{ uint64_t h = farmhashxo::Hash64WithSeeds(data + offset, len, SEED0, SEED1); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashxo::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashxo::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashxoTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +{ uint64_t h = farmhashxo::Hash64WithSeeds(data + offset, len, SEED0, SEED1); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashxo::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashxo::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashxoTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashxoTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashxoTest::Dump(0, i); + } + farmhashxoTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif + +int main() { + farmhashccTest::RunTest(); + farmhashmkTest::RunTest(); + farmhashnaTest::RunTest(); + farmhashntTest::RunTest(); + farmhashsaTest::RunTest(); + farmhashsuTest::RunTest(); + farmhashteTest::RunTest(); + farmhashuoTest::RunTest(); + farmhashxoTest::RunTest(); + __builtin_unreachable(); +} + +#endif // FARMHASHSELFTEST +#endif // DEVICE_MODIFIER +#endif // FARM_HASH_GPU_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/farmhash_gpu_archive/src/farmhash_gpu.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/farmhash_gpu_archive/src/farmhash_gpu.h new file mode 100644 index 0000000000000000000000000000000000000000..f6b2191f4eecf7e96abf53723ef5d68e391c4a17 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/farmhash_gpu_archive/src/farmhash_gpu.h @@ -0,0 +1,11896 @@ +// Copyright (c) 2014 Google, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// FarmHash, by Geoff Pike + +#ifndef FARM_HASH_GPU_H_ +#define FARM_HASH_GPU_H_ + +#include +#include // for memcpy and memset + +#define NAMESPACE_FOR_HASH_FUNCTIONS_GPU util_gpu +#define DEVICE_MODIFIER __device__ __host__ + +// We use DEVICE_MODIFIER to remove those code unused by GPUs. +#ifndef DEVICE_MODIFIER +#include "farmhash.h" +// FARMHASH ASSUMPTIONS: Modify as needed, or use -DFARMHASH_ASSUME_SSE42 etc. +// Note that if you use -DFARMHASH_ASSUME_SSE42 you likely need -msse42 +// (or its equivalent for your compiler); if you use -DFARMHASH_ASSUME_AESNI +// you likely need -maes (or its equivalent for your compiler). + +#ifdef FARMHASH_ASSUME_SSSE3 +#undef FARMHASH_ASSUME_SSSE3 +#define FARMHASH_ASSUME_SSSE3 1 +#endif + +#ifdef FARMHASH_ASSUME_SSE41 +#undef FARMHASH_ASSUME_SSE41 +#define FARMHASH_ASSUME_SSE41 1 +#endif + +#ifdef FARMHASH_ASSUME_SSE42 +#undef FARMHASH_ASSUME_SSE42 +#define FARMHASH_ASSUME_SSE42 1 +#endif + +#ifdef FARMHASH_ASSUME_AESNI +#undef FARMHASH_ASSUME_AESNI +#define FARMHASH_ASSUME_AESNI 1 +#endif + +#ifdef FARMHASH_ASSUME_AVX +#undef FARMHASH_ASSUME_AVX +#define FARMHASH_ASSUME_AVX 1 +#endif + +#if !defined(FARMHASH_CAN_USE_CXX11) && defined(LANG_CXX11) +#define FARMHASH_CAN_USE_CXX11 1 +#else +#undef FARMHASH_CAN_USE_CXX11 +#define FARMHASH_CAN_USE_CXX11 0 +#endif + +// FARMHASH PORTABILITY LAYER: Runtime error if misconfigured + +#ifndef FARMHASH_DIE_IF_MISCONFIGURED +#define FARMHASH_DIE_IF_MISCONFIGURED do { *(char*)(len % 17) = 0; } while (0) +#endif + +// FARMHASH PORTABILITY LAYER: "static inline" or similar + +#ifndef STATIC_INLINE +#define STATIC_INLINE static inline +#endif + +// FARMHASH PORTABILITY LAYER: LIKELY and UNLIKELY + +#if !defined(LIKELY) +#if defined(FARMHASH_NO_BUILTIN_EXPECT) || (defined(FARMHASH_OPTIONAL_BUILTIN_EXPECT) && !defined(HAVE_BUILTIN_EXPECT)) +#define LIKELY(x) (x) +#else +#define LIKELY(x) (__builtin_expect(!!(x), 1)) +#endif +#endif + +#undef UNLIKELY +#define UNLIKELY(x) !LIKELY(!(x)) + +// FARMHASH PORTABILITY LAYER: endianness and byteswapping functions + +#ifdef WORDS_BIGENDIAN +#undef FARMHASH_BIG_ENDIAN +#define FARMHASH_BIG_ENDIAN 1 +#endif + +#if defined(FARMHASH_LITTLE_ENDIAN) && defined(FARMHASH_BIG_ENDIAN) +#error +#endif + +#if !defined(FARMHASH_LITTLE_ENDIAN) && !defined(FARMHASH_BIG_ENDIAN) +#define FARMHASH_UNKNOWN_ENDIAN 1 +#endif + +#if !defined(bswap_32) || !defined(bswap_64) +#undef bswap_32 +#undef bswap_64 + +#if defined(HAVE_BUILTIN_BSWAP) || defined(__clang__) || \ + (defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || \ + __GNUC__ >= 5)) +// Easy case for bswap: no header file needed. +#define bswap_32(x) __builtin_bswap32(x) +#define bswap_64(x) __builtin_bswap64(x) +#endif + +#endif + +#if defined(FARMHASH_UNKNOWN_ENDIAN) || !defined(bswap_64) + +#ifdef _WIN32 + +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) _byteswap_ulong(x) +#define bswap_64(x) _byteswap_uint64(x) + +#elif defined(__APPLE__) + +// Mac OS X / Darwin features +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) OSSwapInt32(x) +#define bswap_64(x) OSSwapInt64(x) + +#elif defined(__sun) || defined(sun) + +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) BSWAP_32(x) +#define bswap_64(x) BSWAP_64(x) + +#elif defined(__FreeBSD__) || defined(__DragonFly__) + +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) + +#elif defined(__OpenBSD__) + +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) swap32(x) +#define bswap_64(x) swap64(x) + +#elif defined(__NetBSD__) + +#include +#include +#if defined(__BSWAP_RENAME) && !defined(__bswap_32) +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) +#endif + +#elif defined(__HAIKU__) + +#define _BSD_SOURCE +#include +#undef bswap_32 +#undef bswap_64 +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) + +#else + +#undef bswap_32 +#undef bswap_64 +#undef _BYTESWAP_H +#include + +#endif + +#ifdef WORDS_BIGENDIAN +#define FARMHASH_BIG_ENDIAN 1 +#endif + +#endif + +#ifdef FARMHASH_BIG_ENDIAN +#define uint32_in_expected_order(x) (bswap_32(x)) +#define uint64_in_expected_order(x) (bswap_64(x)) +#else +#define uint32_in_expected_order(x) (x) +#define uint64_in_expected_order(x) (x) +#endif + +#endif // DEVICE_MODIFIER + +#define uint32_in_expected_order(x) (x) +#define uint64_in_expected_order(x) (x) + +#define STATIC_INLINE DEVICE_MODIFIER inline + +namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU { + +STATIC_INLINE uint64_t Fetch64(const char *p) { + uint64_t result; + memcpy(&result, p, sizeof(result)); + return uint64_in_expected_order(result); +} + +STATIC_INLINE uint32_t Fetch32(const char *p) { + uint32_t result; + memcpy(&result, p, sizeof(result)); + return uint32_in_expected_order(result); +} + +#ifndef DEVICE_MODIFIER +STATIC_INLINE uint32_t Bswap32(uint32_t val) { return bswap_32(val); } +STATIC_INLINE uint64_t Bswap64(uint64_t val) { return bswap_64(val); } + +// FARMHASH PORTABILITY LAYER: bitwise rot + +STATIC_INLINE uint32_t BasicRotate32(uint32_t val, int shift) { + // Avoid shifting by 32: doing so yields an undefined result. + return shift == 0 ? val : ((val >> shift) | (val << (32 - shift))); +} +#endif // DEVICE_MODIFIER + +STATIC_INLINE uint64_t BasicRotate64(uint64_t val, int shift) { + // Avoid shifting by 64: doing so yields an undefined result. + return shift == 0 ? val : ((val >> shift) | (val << (64 - shift))); +} + +#ifndef DEVICE_MODIFIER +#if defined(_WIN32) && defined(FARMHASH_ROTR) + +STATIC_INLINE uint32_t Rotate32(uint32_t val, int shift) { + return sizeof(unsigned long) == sizeof(val) ? + _lrotr(val, shift) : + BasicRotate32(val, shift); +} + +STATIC_INLINE uint64_t Rotate64(uint64_t val, int shift) { + return sizeof(unsigned long) == sizeof(val) ? + _lrotr(val, shift) : + BasicRotate64(val, shift); +} + +#else + +STATIC_INLINE uint32_t Rotate32(uint32_t val, int shift) { + return BasicRotate32(val, shift); +} +STATIC_INLINE uint64_t Rotate64(uint64_t val, int shift) { + return BasicRotate64(val, shift); +} + +#endif +#endif // DEVICE_MODIFIER + +STATIC_INLINE uint64_t Rotate64(uint64_t val, int shift) { + return BasicRotate64(val, shift); +} + +} // namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU + +// FARMHASH PORTABILITY LAYER: debug mode or max speed? +// One may use -DFARMHASH_DEBUG=1 or -DFARMHASH_DEBUG=0 to force the issue. + +#ifndef DEVICE_MODIFIER +#if !defined(FARMHASH_DEBUG) && (!defined(NDEBUG) || defined(_DEBUG)) +#define FARMHASH_DEBUG 1 +#endif + +#undef debug_mode +#if FARMHASH_DEBUG +#define debug_mode 1 +#else +#define debug_mode 0 +#endif + +// PLATFORM-SPECIFIC FUNCTIONS AND MACROS + +#undef x86_64 +#if defined (__x86_64) || defined (__x86_64__) +#define x86_64 1 +#else +#define x86_64 0 +#endif + +#undef x86 +#if defined(__i386__) || defined(__i386) || defined(__X86__) +#define x86 1 +#else +#define x86 x86_64 +#endif + +#if !defined(is_64bit) +#define is_64bit (x86_64 || (sizeof(void*) == 8)) +#endif + +#undef can_use_ssse3 +#if defined(__SSSE3__) || defined(FARMHASH_ASSUME_SSSE3) + +#include +#define can_use_ssse3 1 +// Now we can use _mm_hsub_epi16 and so on. + +#else +#define can_use_ssse3 0 +#endif + +#undef can_use_sse41 +#if defined(__SSE4_1__) || defined(FARMHASH_ASSUME_SSE41) + +#include +#define can_use_sse41 1 +// Now we can use _mm_insert_epi64 and so on. + +#else +#define can_use_sse41 0 +#endif + +#undef can_use_sse42 +#if defined(__SSE4_2__) || defined(FARMHASH_ASSUME_SSE42) + +#include +#define can_use_sse42 1 +// Now we can use _mm_crc32_u{32,16,8}. And on 64-bit platforms, _mm_crc32_u64. + +#else +#define can_use_sse42 0 +#endif + +#undef can_use_aesni +#if defined(__AES__) || defined(FARMHASH_ASSUME_AESNI) + +#include +#define can_use_aesni 1 +// Now we can use _mm_aesimc_si128 and so on. + +#else +#define can_use_aesni 0 +#endif + +#undef can_use_avx +#if defined(__AVX__) || defined(FARMHASH_ASSUME_AVX) + +#include +#define can_use_avx 1 + +#else +#define can_use_avx 0 +#endif + +#if can_use_ssse3 || can_use_sse41 || can_use_sse42 || can_use_aesni || can_use_avx +STATIC_INLINE __m128i Fetch128(const char* s) { + return _mm_loadu_si128(reinterpret_cast(s)); +} +#endif +// Building blocks for hash functions + +// std::swap() was in but is in from C++11 on. +#if !FARMHASH_CAN_USE_CXX11 +#include +#endif + +#undef PERMUTE3 +#define PERMUTE3(a, b, c) do { std::swap(a, b); std::swap(a, c); } while (0) +#endif // DEVICE_MODIFIER + +struct Pair { + uint64_t first; + uint64_t second; +}; + +namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU { + +// Some primes between 2^63 and 2^64 for various uses. +static const uint64_t k0 = 0xc3a5c85c97cb3127ULL; +static const uint64_t k1 = 0xb492b66fbe98f273ULL; +static const uint64_t k2 = 0x9ae16a3b2f90404fULL; + +#ifndef DEVICE_MODIFIER +// Magic numbers for 32-bit hashing. Copied from Murmur3. +static const uint32_t c1 = 0xcc9e2d51; +static const uint32_t c2 = 0x1b873593; + +// A 32-bit to 32-bit integer hash copied from Murmur3. +STATIC_INLINE uint32_t fmix(uint32_t h) +{ + h ^= h >> 16; + h *= 0x85ebca6b; + h ^= h >> 13; + h *= 0xc2b2ae35; + h ^= h >> 16; + return h; +} + +STATIC_INLINE uint32_t Mur(uint32_t a, uint32_t h) { + // Helper from Murmur3 for combining two 32-bit values. + a *= c1; + a = Rotate32(a, 17); + a *= c2; + h ^= a; + h = Rotate32(h, 19); + return h * 5 + 0xe6546b64; +} + +template STATIC_INLINE T DebugTweak(T x) { + if (debug_mode) { + if (sizeof(x) == 4) { + x = ~Bswap32(x * c1); + } else { + x = ~Bswap64(x * k1); + } + } + return x; +} + +template <> uint128_t DebugTweak(uint128_t x) { + if (debug_mode) { + uint64_t y = DebugTweak(Uint128Low64(x)); + uint64_t z = DebugTweak(Uint128High64(x)); + y += z; + z += y; + x = Uint128(y, z * k1); + } + return x; +} +#endif // DEVICE_MODIFIER +} // namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU + +#ifndef DEVICE_MODIFIER +using namespace std; +#endif // DEVICE_MODIFIER +using namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU; +namespace farmhashna_gpu { +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +#ifndef DEVICE_MODIFIER +#undef Bswap +#define Bswap Bswap64 +#endif // DEVICE_MODIFIER + +STATIC_INLINE uint64_t ShiftMix(uint64_t val) { + return val ^ (val >> 47); +} + +#ifndef DEVICE_MODIFIER +STATIC_INLINE uint64_t HashLen16(uint64_t u, uint64_t v) { + return Hash128to64(Uint128(u, v)); +} +#endif // DEVICE_MODIFIER + +STATIC_INLINE uint64_t HashLen16(uint64_t u, uint64_t v, uint64_t mul) { + // Murmur-inspired hashing. + uint64_t a = (u ^ v) * mul; + a ^= (a >> 47); + uint64_t b = (v ^ a) * mul; + b ^= (b >> 47); + b *= mul; + return b; +} + +STATIC_INLINE uint64_t HashLen0to16(const char *s, size_t len) { + if (len >= 8) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch(s) + k2; + uint64_t b = Fetch(s + len - 8); + uint64_t c = Rotate(b, 37) * mul + a; + uint64_t d = (Rotate(a, 25) + b) * mul; + return HashLen16(c, d, mul); + } + if (len >= 4) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch32(s); + return HashLen16(len + (a << 3), Fetch32(s + len - 4), mul); + } + if (len > 0) { + uint8_t a = s[0]; + uint8_t b = s[len >> 1]; + uint8_t c = s[len - 1]; + uint32_t y = static_cast(a) + (static_cast(b) << 8); + uint32_t z = len + (static_cast(c) << 2); + return ShiftMix(y * k2 ^ z * k0) * k2; + } + return k2; +} + +// This probably works well for 16-byte strings as well, but it may be overkill +// in that case. +STATIC_INLINE uint64_t HashLen17to32(const char *s, size_t len) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch(s) * k1; + uint64_t b = Fetch(s + 8); + uint64_t c = Fetch(s + len - 8) * mul; + uint64_t d = Fetch(s + len - 16) * k2; + return HashLen16(Rotate(a + b, 43) + Rotate(c, 30) + d, + a + Rotate(b + k2, 18) + c, mul); +} + +// Return a 16-byte hash for 48 bytes. Quick and dirty. +// Callers do best to use "random-looking" values for a and b. +STATIC_INLINE Pair WeakHashLen32WithSeeds( + uint64_t w, uint64_t x, uint64_t y, uint64_t z, uint64_t a, uint64_t b) { + a += w; + b = Rotate(b + a + z, 21); + uint64_t c = a; + a += x; + a += y; + b += Rotate(a, 44); + return Pair{a + z, b + c}; +} + +// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. +STATIC_INLINE Pair WeakHashLen32WithSeeds( + const char* s, uint64_t a, uint64_t b) { + return WeakHashLen32WithSeeds(Fetch(s), + Fetch(s + 8), + Fetch(s + 16), + Fetch(s + 24), + a, + b); +} + +// Return an 8-byte hash for 33 to 64 bytes. +STATIC_INLINE uint64_t HashLen33to64(const char *s, size_t len) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch(s) * k2; + uint64_t b = Fetch(s + 8); + uint64_t c = Fetch(s + len - 8) * mul; + uint64_t d = Fetch(s + len - 16) * k2; + uint64_t y = Rotate(a + b, 43) + Rotate(c, 30) + d; + uint64_t z = HashLen16(y, a + Rotate(b + k2, 18) + c, mul); + uint64_t e = Fetch(s + 16) * mul; + uint64_t f = Fetch(s + 24); + uint64_t g = (y + Fetch(s + len - 32)) * mul; + uint64_t h = (z + Fetch(s + len - 24)) * mul; + return HashLen16(Rotate(e + f, 43) + Rotate(g, 30) + h, + e + Rotate(f + a, 18) + g, mul); +} + +DEVICE_MODIFIER uint64_t Hash64(const char *s, size_t len) { + const uint64_t seed = 81; + if (len <= 32) { + if (len <= 16) { + return HashLen0to16(s, len); + } else { + return HashLen17to32(s, len); + } + } else if (len <= 64) { + return HashLen33to64(s, len); + } + + // For strings over 64 bytes we loop. Internal state consists of + // 56 bytes: v, w, x, y, and z. + uint64_t x = seed; + uint64_t y = seed * k1 + 113; + uint64_t z = ShiftMix(y * k2 + 113) * k2; + Pair v = {0, 0}; + Pair w = {0, 0}; + x = x * k2 + Fetch(s); + + // Set end so that after the loop we have 1 to 64 bytes left to process. + const char* end = s + ((len - 1) / 64) * 64; + const char* last64 = end + ((len - 1) & 63) - 63; + assert(s + len - 64 == last64); + do { + x = Rotate(x + y + v.first + Fetch(s + 8), 37) * k1; + y = Rotate(y + v.second + Fetch(s + 48), 42) * k1; + x ^= w.second; + y += v.first + Fetch(s + 40); + z = Rotate(z + w.first, 33) * k1; + v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first); + w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + auto tmp = z; + z = x; + x = tmp; + s += 64; + } while (s != end); + uint64_t mul = k1 + ((z & 0xff) << 1); + // Make s point to the last 64 bytes of input. + s = last64; + w.first += ((len - 1) & 63); + v.first += w.first; + w.first += v.first; + x = Rotate(x + y + v.first + Fetch(s + 8), 37) * mul; + y = Rotate(y + v.second + Fetch(s + 48), 42) * mul; + x ^= w.second * 9; + y += v.first * 9 + Fetch(s + 40); + z = Rotate(z + w.first, 33) * mul; + v = WeakHashLen32WithSeeds(s, v.second * mul, x + w.first); + w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + auto tmp = z; + z = x; + x = tmp; + return HashLen16(HashLen16(v.first, w.first, mul) + ShiftMix(y) * k0 + z, + HashLen16(v.second, w.second, mul) + x, + mul); +} + +#ifndef DEVICE_MODIFIER +uint64_t Hash64WithSeeds(const char *s, size_t len, uint64_t seed0, uint64_t seed1); + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + return Hash64WithSeeds(s, len, k2, seed); +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, uint64_t seed0, uint64_t seed1) { + return HashLen16(Hash64(s, len) - seed0, seed1); +} +#endif // DEVICE_MODIFIER +} // namespace farmhashna_gpu +#ifndef DEVICE_MODIFIER +namespace farmhashuo { +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +STATIC_INLINE uint64_t H(uint64_t x, uint64_t y, uint64_t mul, int r) { + uint64_t a = (x ^ y) * mul; + a ^= (a >> 47); + uint64_t b = (y ^ a) * mul; + return Rotate(b, r) * mul; +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, + uint64_t seed0, uint64_t seed1) { + if (len <= 64) { + return farmhashna::Hash64WithSeeds(s, len, seed0, seed1); + } + + // For strings over 64 bytes we loop. Internal state consists of + // 64 bytes: u, v, w, x, y, and z. + uint64_t x = seed0; + uint64_t y = seed1 * k2 + 113; + uint64_t z = farmhashna::ShiftMix(y * k2) * k2; + pair v = make_pair(seed0, seed1); + pair w = make_pair(0, 0); + uint64_t u = x - z; + x *= k2; + uint64_t mul = k2 + (u & 0x82); + + // Set end so that after the loop we have 1 to 64 bytes left to process. + const char* end = s + ((len - 1) / 64) * 64; + const char* last64 = end + ((len - 1) & 63) - 63; + assert(s + len - 64 == last64); + do { + uint64_t a0 = Fetch(s); + uint64_t a1 = Fetch(s + 8); + uint64_t a2 = Fetch(s + 16); + uint64_t a3 = Fetch(s + 24); + uint64_t a4 = Fetch(s + 32); + uint64_t a5 = Fetch(s + 40); + uint64_t a6 = Fetch(s + 48); + uint64_t a7 = Fetch(s + 56); + x += a0 + a1; + y += a2; + z += a3; + v.first += a4; + v.second += a5 + a1; + w.first += a6; + w.second += a7; + + x = Rotate(x, 26); + x *= 9; + y = Rotate(y, 29); + z *= mul; + v.first = Rotate(v.first, 33); + v.second = Rotate(v.second, 30); + w.first ^= x; + w.first *= 9; + z = Rotate(z, 32); + z += w.second; + w.second += z; + z *= 9; + std::swap(u, y); + + z += a0 + a6; + v.first += a2; + v.second += a3; + w.first += a4; + w.second += a5 + a6; + x += a1; + y += a7; + + y += v.first; + v.first += x - y; + v.second += w.first; + w.first += v.second; + w.second += x - y; + x += w.second; + w.second = Rotate(w.second, 34); + std::swap(u, z); + s += 64; + } while (s != end); + // Make s point to the last 64 bytes of input. + s = last64; + u *= 9; + v.second = Rotate(v.second, 28); + v.first = Rotate(v.first, 20); + w.first += ((len - 1) & 63); + u += y; + y += u; + x = Rotate(y - x + v.first + Fetch(s + 8), 37) * mul; + y = Rotate(y ^ v.second ^ Fetch(s + 48), 42) * mul; + x ^= w.second * 9; + y += v.first + Fetch(s + 40); + z = Rotate(z + w.first, 33) * mul; + v = farmhashna::WeakHashLen32WithSeeds(s, v.second * mul, x + w.first); + w = farmhashna::WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + return H(farmhashna::HashLen16(v.first + x, w.first ^ y, mul) + z - u, + H(v.second + y, w.second + z, k2, 30) ^ x, + k2, + 31); +} + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + return len <= 64 ? farmhashna::Hash64WithSeed(s, len, seed) : + Hash64WithSeeds(s, len, 0, seed); +} + +uint64_t Hash64(const char *s, size_t len) { + return len <= 64 ? farmhashna::Hash64(s, len) : + Hash64WithSeeds(s, len, 81, 0); +} +} // namespace farmhashuo +namespace farmhashxo { +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +STATIC_INLINE uint64_t H32(const char *s, size_t len, uint64_t mul, + uint64_t seed0 = 0, uint64_t seed1 = 0) { + uint64_t a = Fetch(s) * k1; + uint64_t b = Fetch(s + 8); + uint64_t c = Fetch(s + len - 8) * mul; + uint64_t d = Fetch(s + len - 16) * k2; + uint64_t u = Rotate(a + b, 43) + Rotate(c, 30) + d + seed0; + uint64_t v = a + Rotate(b + k2, 18) + c + seed1; + a = farmhashna::ShiftMix((u ^ v) * mul); + b = farmhashna::ShiftMix((v ^ a) * mul); + return b; +} + +// Return an 8-byte hash for 33 to 64 bytes. +STATIC_INLINE uint64_t HashLen33to64(const char *s, size_t len) { + uint64_t mul0 = k2 - 30; + uint64_t mul1 = k2 - 30 + 2 * len; + uint64_t h0 = H32(s, 32, mul0); + uint64_t h1 = H32(s + len - 32, 32, mul1); + return ((h1 * mul1) + h0) * mul1; +} + +// Return an 8-byte hash for 65 to 96 bytes. +STATIC_INLINE uint64_t HashLen65to96(const char *s, size_t len) { + uint64_t mul0 = k2 - 114; + uint64_t mul1 = k2 - 114 + 2 * len; + uint64_t h0 = H32(s, 32, mul0); + uint64_t h1 = H32(s + 32, 32, mul1); + uint64_t h2 = H32(s + len - 32, 32, mul1, h0, h1); + return (h2 * 9 + (h0 >> 17) + (h1 >> 21)) * mul1; +} + +uint64_t Hash64(const char *s, size_t len) { + if (len <= 32) { + if (len <= 16) { + return farmhashna::HashLen0to16(s, len); + } else { + return farmhashna::HashLen17to32(s, len); + } + } else if (len <= 64) { + return HashLen33to64(s, len); + } else if (len <= 96) { + return HashLen65to96(s, len); + } else if (len <= 256) { + return farmhashna::Hash64(s, len); + } else { + return farmhashuo::Hash64(s, len); + } +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, uint64_t seed0, uint64_t seed1) { + return farmhashuo::Hash64WithSeeds(s, len, seed0, seed1); +} + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + return farmhashuo::Hash64WithSeed(s, len, seed); +} +} // namespace farmhashxo +namespace farmhashte { +#if !can_use_sse41 || !x86_64 + +uint64_t Hash64(const char *s, size_t len) { + FARMHASH_DIE_IF_MISCONFIGURED; + return s == NULL ? 0 : len; +} + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed + Hash64(s, len); +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, + uint64_t seed0, uint64_t seed1) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed0 + seed1 + Hash64(s, len); +} + +#else + +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +#undef Bswap +#define Bswap Bswap64 + +// Helpers for data-parallel operations (1x 128 bits or 2x 64 or 4x 32). +STATIC_INLINE __m128i Add(__m128i x, __m128i y) { return _mm_add_epi64(x, y); } +STATIC_INLINE __m128i Xor(__m128i x, __m128i y) { return _mm_xor_si128(x, y); } +STATIC_INLINE __m128i Mul(__m128i x, __m128i y) { return _mm_mullo_epi32(x, y); } +STATIC_INLINE __m128i Shuf(__m128i x, __m128i y) { return _mm_shuffle_epi8(y, x); } + +// Requires n >= 256. Requires SSE4.1. Should be slightly faster if the +// compiler uses AVX instructions (e.g., use the -mavx flag with GCC). +STATIC_INLINE uint64_t Hash64Long(const char* s, size_t n, + uint64_t seed0, uint64_t seed1) { + const __m128i kShuf = + _mm_set_epi8(4, 11, 10, 5, 8, 15, 6, 9, 12, 2, 14, 13, 0, 7, 3, 1); + const __m128i kMult = + _mm_set_epi8(0xbd, 0xd6, 0x33, 0x39, 0x45, 0x54, 0xfa, 0x03, + 0x34, 0x3e, 0x33, 0xed, 0xcc, 0x9e, 0x2d, 0x51); + uint64_t seed2 = (seed0 + 113) * (seed1 + 9); + uint64_t seed3 = (Rotate(seed0, 23) + 27) * (Rotate(seed1, 30) + 111); + __m128i d0 = _mm_cvtsi64_si128(seed0); + __m128i d1 = _mm_cvtsi64_si128(seed1); + __m128i d2 = Shuf(kShuf, d0); + __m128i d3 = Shuf(kShuf, d1); + __m128i d4 = Xor(d0, d1); + __m128i d5 = Xor(d1, d2); + __m128i d6 = Xor(d2, d4); + __m128i d7 = _mm_set1_epi32(seed2 >> 32); + __m128i d8 = Mul(kMult, d2); + __m128i d9 = _mm_set1_epi32(seed3 >> 32); + __m128i d10 = _mm_set1_epi32(seed3); + __m128i d11 = Add(d2, _mm_set1_epi32(seed2)); + const char* end = s + (n & ~static_cast(255)); + do { + __m128i z; + z = Fetch128(s); + d0 = Add(d0, z); + d1 = Shuf(kShuf, d1); + d2 = Xor(d2, d0); + d4 = Xor(d4, z); + d4 = Xor(d4, d1); + std::swap(d0, d6); + z = Fetch128(s + 16); + d5 = Add(d5, z); + d6 = Shuf(kShuf, d6); + d8 = Shuf(kShuf, d8); + d7 = Xor(d7, d5); + d0 = Xor(d0, z); + d0 = Xor(d0, d6); + std::swap(d5, d11); + z = Fetch128(s + 32); + d1 = Add(d1, z); + d2 = Shuf(kShuf, d2); + d4 = Shuf(kShuf, d4); + d5 = Xor(d5, z); + d5 = Xor(d5, d2); + std::swap(d10, d4); + z = Fetch128(s + 48); + d6 = Add(d6, z); + d7 = Shuf(kShuf, d7); + d0 = Shuf(kShuf, d0); + d8 = Xor(d8, d6); + d1 = Xor(d1, z); + d1 = Add(d1, d7); + z = Fetch128(s + 64); + d2 = Add(d2, z); + d5 = Shuf(kShuf, d5); + d4 = Add(d4, d2); + d6 = Xor(d6, z); + d6 = Xor(d6, d11); + std::swap(d8, d2); + z = Fetch128(s + 80); + d7 = Xor(d7, z); + d8 = Shuf(kShuf, d8); + d1 = Shuf(kShuf, d1); + d0 = Add(d0, d7); + d2 = Add(d2, z); + d2 = Add(d2, d8); + std::swap(d1, d7); + z = Fetch128(s + 96); + d4 = Shuf(kShuf, d4); + d6 = Shuf(kShuf, d6); + d8 = Mul(kMult, d8); + d5 = Xor(d5, d11); + d7 = Xor(d7, z); + d7 = Add(d7, d4); + std::swap(d6, d0); + z = Fetch128(s + 112); + d8 = Add(d8, z); + d0 = Shuf(kShuf, d0); + d2 = Shuf(kShuf, d2); + d1 = Xor(d1, d8); + d10 = Xor(d10, z); + d10 = Xor(d10, d0); + std::swap(d11, d5); + z = Fetch128(s + 128); + d4 = Add(d4, z); + d5 = Shuf(kShuf, d5); + d7 = Shuf(kShuf, d7); + d6 = Add(d6, d4); + d8 = Xor(d8, z); + d8 = Xor(d8, d5); + std::swap(d4, d10); + z = Fetch128(s + 144); + d0 = Add(d0, z); + d1 = Shuf(kShuf, d1); + d2 = Add(d2, d0); + d4 = Xor(d4, z); + d4 = Xor(d4, d1); + z = Fetch128(s + 160); + d5 = Add(d5, z); + d6 = Shuf(kShuf, d6); + d8 = Shuf(kShuf, d8); + d7 = Xor(d7, d5); + d0 = Xor(d0, z); + d0 = Xor(d0, d6); + std::swap(d2, d8); + z = Fetch128(s + 176); + d1 = Add(d1, z); + d2 = Shuf(kShuf, d2); + d4 = Shuf(kShuf, d4); + d5 = Mul(kMult, d5); + d5 = Xor(d5, z); + d5 = Xor(d5, d2); + std::swap(d7, d1); + z = Fetch128(s + 192); + d6 = Add(d6, z); + d7 = Shuf(kShuf, d7); + d0 = Shuf(kShuf, d0); + d8 = Add(d8, d6); + d1 = Xor(d1, z); + d1 = Xor(d1, d7); + std::swap(d0, d6); + z = Fetch128(s + 208); + d2 = Add(d2, z); + d5 = Shuf(kShuf, d5); + d4 = Xor(d4, d2); + d6 = Xor(d6, z); + d6 = Xor(d6, d9); + std::swap(d5, d11); + z = Fetch128(s + 224); + d7 = Add(d7, z); + d8 = Shuf(kShuf, d8); + d1 = Shuf(kShuf, d1); + d0 = Xor(d0, d7); + d2 = Xor(d2, z); + d2 = Xor(d2, d8); + std::swap(d10, d4); + z = Fetch128(s + 240); + d3 = Add(d3, z); + d4 = Shuf(kShuf, d4); + d6 = Shuf(kShuf, d6); + d7 = Mul(kMult, d7); + d5 = Add(d5, d3); + d7 = Xor(d7, z); + d7 = Xor(d7, d4); + std::swap(d3, d9); + s += 256; + } while (s != end); + d6 = Add(Mul(kMult, d6), _mm_cvtsi64_si128(n)); + if (n % 256 != 0) { + d7 = Add(_mm_shuffle_epi32(d8, (0 << 6) + (3 << 4) + (2 << 2) + (1 << 0)), d7); + d8 = Add(Mul(kMult, d8), _mm_cvtsi64_si128(farmhashxo::Hash64(s, n % 256))); + } + __m128i t[8]; + d0 = Mul(kMult, Shuf(kShuf, Mul(kMult, d0))); + d3 = Mul(kMult, Shuf(kShuf, Mul(kMult, d3))); + d9 = Mul(kMult, Shuf(kShuf, Mul(kMult, d9))); + d1 = Mul(kMult, Shuf(kShuf, Mul(kMult, d1))); + d0 = Add(d11, d0); + d3 = Xor(d7, d3); + d9 = Add(d8, d9); + d1 = Add(d10, d1); + d4 = Add(d3, d4); + d5 = Add(d9, d5); + d6 = Xor(d1, d6); + d2 = Add(d0, d2); + t[0] = d0; + t[1] = d3; + t[2] = d9; + t[3] = d1; + t[4] = d4; + t[5] = d5; + t[6] = d6; + t[7] = d2; + return farmhashxo::Hash64(reinterpret_cast(t), sizeof(t)); +} + +uint64_t Hash64(const char *s, size_t len) { + // Empirically, farmhashxo seems faster until length 512. + return len >= 512 ? Hash64Long(s, len, k2, k1) : farmhashxo::Hash64(s, len); +} + +uint64_t Hash64WithSeed(const char *s, size_t len, uint64_t seed) { + return len >= 512 ? Hash64Long(s, len, k1, seed) : + farmhashxo::Hash64WithSeed(s, len, seed); +} + +uint64_t Hash64WithSeeds(const char *s, size_t len, uint64_t seed0, uint64_t seed1) { + return len >= 512 ? Hash64Long(s, len, seed0, seed1) : + farmhashxo::Hash64WithSeeds(s, len, seed0, seed1); +} + +#endif +} // namespace farmhashte +namespace farmhashnt { +#if !can_use_sse41 || !x86_64 + +uint32_t Hash32(const char *s, size_t len) { + FARMHASH_DIE_IF_MISCONFIGURED; + return s == NULL ? 0 : len; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed + Hash32(s, len); +} + +#else + +uint32_t Hash32(const char *s, size_t len) { + return static_cast(farmhashte::Hash64(s, len)); +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + return static_cast(farmhashte::Hash64WithSeed(s, len, seed)); +} + +#endif +} // namespace farmhashnt +namespace farmhashmk { +#undef Fetch +#define Fetch Fetch32 + +#undef Rotate +#define Rotate Rotate32 + +#undef Bswap +#define Bswap Bswap32 + +STATIC_INLINE uint32_t Hash32Len13to24(const char *s, size_t len, uint32_t seed = 0) { + uint32_t a = Fetch(s - 4 + (len >> 1)); + uint32_t b = Fetch(s + 4); + uint32_t c = Fetch(s + len - 8); + uint32_t d = Fetch(s + (len >> 1)); + uint32_t e = Fetch(s); + uint32_t f = Fetch(s + len - 4); + uint32_t h = d * c1 + len + seed; + a = Rotate(a, 12) + f; + h = Mur(c, h) + a; + a = Rotate(a, 3) + c; + h = Mur(e, h) + a; + a = Rotate(a + f, 12) + d; + h = Mur(b ^ seed, h) + a; + return fmix(h); +} + +STATIC_INLINE uint32_t Hash32Len0to4(const char *s, size_t len, uint32_t seed = 0) { + uint32_t b = seed; + uint32_t c = 9; + for (size_t i = 0; i < len; i++) { + signed char v = s[i]; + b = b * c1 + v; + c ^= b; + } + return fmix(Mur(b, Mur(len, c))); +} + +STATIC_INLINE uint32_t Hash32Len5to12(const char *s, size_t len, uint32_t seed = 0) { + uint32_t a = len, b = len * 5, c = 9, d = b + seed; + a += Fetch(s); + b += Fetch(s + len - 4); + c += Fetch(s + ((len >> 1) & 4)); + return fmix(seed ^ Mur(c, Mur(b, Mur(a, d)))); +} + +uint32_t Hash32(const char *s, size_t len) { + if (len <= 24) { + return len <= 12 ? + (len <= 4 ? Hash32Len0to4(s, len) : Hash32Len5to12(s, len)) : + Hash32Len13to24(s, len); + } + + // len > 24 + uint32_t h = len, g = c1 * len, f = g; + uint32_t a0 = Rotate(Fetch(s + len - 4) * c1, 17) * c2; + uint32_t a1 = Rotate(Fetch(s + len - 8) * c1, 17) * c2; + uint32_t a2 = Rotate(Fetch(s + len - 16) * c1, 17) * c2; + uint32_t a3 = Rotate(Fetch(s + len - 12) * c1, 17) * c2; + uint32_t a4 = Rotate(Fetch(s + len - 20) * c1, 17) * c2; + h ^= a0; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + h ^= a2; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + g ^= a1; + g = Rotate(g, 19); + g = g * 5 + 0xe6546b64; + g ^= a3; + g = Rotate(g, 19); + g = g * 5 + 0xe6546b64; + f += a4; + f = Rotate(f, 19) + 113; + size_t iters = (len - 1) / 20; + do { + uint32_t a = Fetch(s); + uint32_t b = Fetch(s + 4); + uint32_t c = Fetch(s + 8); + uint32_t d = Fetch(s + 12); + uint32_t e = Fetch(s + 16); + h += a; + g += b; + f += c; + h = Mur(d, h) + e; + g = Mur(c, g) + a; + f = Mur(b + e * c1, f) + d; + f += g; + g += f; + s += 20; + } while (--iters != 0); + g = Rotate(g, 11) * c1; + g = Rotate(g, 17) * c1; + f = Rotate(f, 11) * c1; + f = Rotate(f, 17) * c1; + h = Rotate(h + g, 19); + h = h * 5 + 0xe6546b64; + h = Rotate(h, 17) * c1; + h = Rotate(h + f, 19); + h = h * 5 + 0xe6546b64; + h = Rotate(h, 17) * c1; + return h; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + if (len <= 24) { + if (len >= 13) return Hash32Len13to24(s, len, seed * c1); + else if (len >= 5) return Hash32Len5to12(s, len, seed); + else return Hash32Len0to4(s, len, seed); + } + uint32_t h = Hash32Len13to24(s, 24, seed ^ len); + return Mur(Hash32(s + 24, len - 24) + seed, h); +} +} // namespace farmhashmk +namespace farmhashsu { +#if !can_use_sse42 || !can_use_aesni + +uint32_t Hash32(const char *s, size_t len) { + FARMHASH_DIE_IF_MISCONFIGURED; + return s == NULL ? 0 : len; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed + Hash32(s, len); +} + +#else + +#undef Fetch +#define Fetch Fetch32 + +#undef Rotate +#define Rotate Rotate32 + +#undef Bswap +#define Bswap Bswap32 + +// Helpers for data-parallel operations (4x 32-bits). +STATIC_INLINE __m128i Add(__m128i x, __m128i y) { return _mm_add_epi32(x, y); } +STATIC_INLINE __m128i Xor(__m128i x, __m128i y) { return _mm_xor_si128(x, y); } +STATIC_INLINE __m128i Or(__m128i x, __m128i y) { return _mm_or_si128(x, y); } +STATIC_INLINE __m128i Mul(__m128i x, __m128i y) { return _mm_mullo_epi32(x, y); } +STATIC_INLINE __m128i Mul5(__m128i x) { return Add(x, _mm_slli_epi32(x, 2)); } +STATIC_INLINE __m128i RotateLeft(__m128i x, int c) { + return Or(_mm_slli_epi32(x, c), + _mm_srli_epi32(x, 32 - c)); +} +STATIC_INLINE __m128i Rol17(__m128i x) { return RotateLeft(x, 17); } +STATIC_INLINE __m128i Rol19(__m128i x) { return RotateLeft(x, 19); } +STATIC_INLINE __m128i Shuffle0321(__m128i x) { + return _mm_shuffle_epi32(x, (0 << 6) + (3 << 4) + (2 << 2) + (1 << 0)); +} + +uint32_t Hash32(const char *s, size_t len) { + const uint32_t seed = 81; + if (len <= 24) { + return len <= 12 ? + (len <= 4 ? + farmhashmk::Hash32Len0to4(s, len) : + farmhashmk::Hash32Len5to12(s, len)) : + farmhashmk::Hash32Len13to24(s, len); + } + + if (len < 40) { + uint32_t a = len, b = seed * c2, c = a + b; + a += Fetch(s + len - 4); + b += Fetch(s + len - 20); + c += Fetch(s + len - 16); + uint32_t d = a; + a = NAMESPACE_FOR_HASH_FUNCTIONS::Rotate32(a, 21); + a = Mur(a, Mur(b, _mm_crc32_u32(c, d))); + a += Fetch(s + len - 12); + b += Fetch(s + len - 8); + d += a; + a += d; + b = Mur(b, d) * c2; + a = _mm_crc32_u32(a, b + c); + return farmhashmk::Hash32Len13to24(s, (len + 1) / 2, a) + b; + } + +#undef Mulc1 +#define Mulc1(x) Mul((x), cc1) + +#undef Mulc2 +#define Mulc2(x) Mul((x), cc2) + +#undef Murk +#define Murk(a, h) \ + Add(k, \ + Mul5( \ + Rol19( \ + Xor( \ + Mulc2( \ + Rol17( \ + Mulc1(a))), \ + (h))))) + + const __m128i cc1 = _mm_set1_epi32(c1); + const __m128i cc2 = _mm_set1_epi32(c2); + __m128i h = _mm_set1_epi32(seed); + __m128i g = _mm_set1_epi32(c1 * seed); + __m128i f = g; + __m128i k = _mm_set1_epi32(0xe6546b64); + __m128i q; + if (len < 80) { + __m128i a = Fetch128(s); + __m128i b = Fetch128(s + 16); + __m128i c = Fetch128(s + (len - 15) / 2); + __m128i d = Fetch128(s + len - 32); + __m128i e = Fetch128(s + len - 16); + h = Add(h, a); + g = Add(g, b); + q = g; + g = Shuffle0321(g); + f = Add(f, c); + __m128i be = Add(b, Mulc1(e)); + h = Add(h, f); + f = Add(f, h); + h = Add(Murk(d, h), e); + k = Xor(k, _mm_shuffle_epi8(g, f)); + g = Add(Xor(c, g), a); + f = Add(Xor(be, f), d); + k = Add(k, be); + k = Add(k, _mm_shuffle_epi8(f, h)); + f = Add(f, g); + g = Add(g, f); + g = Add(_mm_set1_epi32(len), Mulc1(g)); + } else { + // len >= 80 + // The following is loosely modelled after farmhashmk::Hash32. + size_t iters = (len - 1) / 80; + len -= iters * 80; + +#undef Chunk +#define Chunk() do { \ + __m128i a = Fetch128(s); \ + __m128i b = Fetch128(s + 16); \ + __m128i c = Fetch128(s + 32); \ + __m128i d = Fetch128(s + 48); \ + __m128i e = Fetch128(s + 64); \ + h = Add(h, a); \ + g = Add(g, b); \ + g = Shuffle0321(g); \ + f = Add(f, c); \ + __m128i be = Add(b, Mulc1(e)); \ + h = Add(h, f); \ + f = Add(f, h); \ + h = Add(h, d); \ + q = Add(q, e); \ + h = Rol17(h); \ + h = Mulc1(h); \ + k = Xor(k, _mm_shuffle_epi8(g, f)); \ + g = Add(Xor(c, g), a); \ + f = Add(Xor(be, f), d); \ + std::swap(f, q); \ + q = _mm_aesimc_si128(q); \ + k = Add(k, be); \ + k = Add(k, _mm_shuffle_epi8(f, h)); \ + f = Add(f, g); \ + g = Add(g, f); \ + f = Mulc1(f); \ +} while (0) + + q = g; + while (iters-- != 0) { + Chunk(); + s += 80; + } + + if (len != 0) { + h = Add(h, _mm_set1_epi32(len)); + s = s + len - 80; + Chunk(); + } + } + + g = Shuffle0321(g); + k = Xor(k, g); + k = Xor(k, q); + h = Xor(h, q); + f = Mulc1(f); + k = Mulc2(k); + g = Mulc1(g); + h = Mulc2(h); + k = Add(k, _mm_shuffle_epi8(g, f)); + h = Add(h, f); + f = Add(f, h); + g = Add(g, k); + k = Add(k, g); + k = Xor(k, _mm_shuffle_epi8(f, h)); + __m128i buf[4]; + buf[0] = f; + buf[1] = g; + buf[2] = k; + buf[3] = h; + s = reinterpret_cast(buf); + uint32_t x = Fetch(s); + uint32_t y = Fetch(s+4); + uint32_t z = Fetch(s+8); + x = _mm_crc32_u32(x, Fetch(s+12)); + y = _mm_crc32_u32(y, Fetch(s+16)); + z = _mm_crc32_u32(z * c1, Fetch(s+20)); + x = _mm_crc32_u32(x, Fetch(s+24)); + y = _mm_crc32_u32(y * c1, Fetch(s+28)); + uint32_t o = y; + z = _mm_crc32_u32(z, Fetch(s+32)); + x = _mm_crc32_u32(x * c1, Fetch(s+36)); + y = _mm_crc32_u32(y, Fetch(s+40)); + z = _mm_crc32_u32(z * c1, Fetch(s+44)); + x = _mm_crc32_u32(x, Fetch(s+48)); + y = _mm_crc32_u32(y * c1, Fetch(s+52)); + z = _mm_crc32_u32(z, Fetch(s+56)); + x = _mm_crc32_u32(x, Fetch(s+60)); + return (o - x + y - z) * c1; +} + +#undef Chunk +#undef Murk +#undef Mulc2 +#undef Mulc1 + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + if (len <= 24) { + if (len >= 13) return farmhashmk::Hash32Len13to24(s, len, seed * c1); + else if (len >= 5) return farmhashmk::Hash32Len5to12(s, len, seed); + else return farmhashmk::Hash32Len0to4(s, len, seed); + } + uint32_t h = farmhashmk::Hash32Len13to24(s, 24, seed ^ len); + return _mm_crc32_u32(Hash32(s + 24, len - 24) + seed, h); +} + +#endif +} // namespace farmhashsu +namespace farmhashsa { +#if !can_use_sse42 + +uint32_t Hash32(const char *s, size_t len) { + FARMHASH_DIE_IF_MISCONFIGURED; + return s == NULL ? 0 : len; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + FARMHASH_DIE_IF_MISCONFIGURED; + return seed + Hash32(s, len); +} + +#else + +#undef Fetch +#define Fetch Fetch32 + +#undef Rotate +#define Rotate Rotate32 + +#undef Bswap +#define Bswap Bswap32 + +// Helpers for data-parallel operations (4x 32-bits). +STATIC_INLINE __m128i Add(__m128i x, __m128i y) { return _mm_add_epi32(x, y); } +STATIC_INLINE __m128i Xor(__m128i x, __m128i y) { return _mm_xor_si128(x, y); } +STATIC_INLINE __m128i Or(__m128i x, __m128i y) { return _mm_or_si128(x, y); } +STATIC_INLINE __m128i Mul(__m128i x, __m128i y) { return _mm_mullo_epi32(x, y); } +STATIC_INLINE __m128i Mul5(__m128i x) { return Add(x, _mm_slli_epi32(x, 2)); } +STATIC_INLINE __m128i Rotate(__m128i x, int c) { + return Or(_mm_slli_epi32(x, c), + _mm_srli_epi32(x, 32 - c)); +} +STATIC_INLINE __m128i Rot17(__m128i x) { return Rotate(x, 17); } +STATIC_INLINE __m128i Rot19(__m128i x) { return Rotate(x, 19); } +STATIC_INLINE __m128i Shuffle0321(__m128i x) { + return _mm_shuffle_epi32(x, (0 << 6) + (3 << 4) + (2 << 2) + (1 << 0)); +} + +uint32_t Hash32(const char *s, size_t len) { + const uint32_t seed = 81; + if (len <= 24) { + return len <= 12 ? + (len <= 4 ? + farmhashmk::Hash32Len0to4(s, len) : + farmhashmk::Hash32Len5to12(s, len)) : + farmhashmk::Hash32Len13to24(s, len); + } + + if (len < 40) { + uint32_t a = len, b = seed * c2, c = a + b; + a += Fetch(s + len - 4); + b += Fetch(s + len - 20); + c += Fetch(s + len - 16); + uint32_t d = a; + a = NAMESPACE_FOR_HASH_FUNCTIONS::Rotate32(a, 21); + a = Mur(a, Mur(b, Mur(c, d))); + a += Fetch(s + len - 12); + b += Fetch(s + len - 8); + d += a; + a += d; + b = Mur(b, d) * c2; + a = _mm_crc32_u32(a, b + c); + return farmhashmk::Hash32Len13to24(s, (len + 1) / 2, a) + b; + } + +#undef Mulc1 +#define Mulc1(x) Mul((x), cc1) + +#undef Mulc2 +#define Mulc2(x) Mul((x), cc2) + +#undef Murk +#define Murk(a, h) \ + Add(k, \ + Mul5( \ + Rot19( \ + Xor( \ + Mulc2( \ + Rot17( \ + Mulc1(a))), \ + (h))))) + + const __m128i cc1 = _mm_set1_epi32(c1); + const __m128i cc2 = _mm_set1_epi32(c2); + __m128i h = _mm_set1_epi32(seed); + __m128i g = _mm_set1_epi32(c1 * seed); + __m128i f = g; + __m128i k = _mm_set1_epi32(0xe6546b64); + if (len < 80) { + __m128i a = Fetch128(s); + __m128i b = Fetch128(s + 16); + __m128i c = Fetch128(s + (len - 15) / 2); + __m128i d = Fetch128(s + len - 32); + __m128i e = Fetch128(s + len - 16); + h = Add(h, a); + g = Add(g, b); + g = Shuffle0321(g); + f = Add(f, c); + __m128i be = Add(b, Mulc1(e)); + h = Add(h, f); + f = Add(f, h); + h = Add(Murk(d, h), e); + k = Xor(k, _mm_shuffle_epi8(g, f)); + g = Add(Xor(c, g), a); + f = Add(Xor(be, f), d); + k = Add(k, be); + k = Add(k, _mm_shuffle_epi8(f, h)); + f = Add(f, g); + g = Add(g, f); + g = Add(_mm_set1_epi32(len), Mulc1(g)); + } else { + // len >= 80 + // The following is loosely modelled after farmhashmk::Hash32. + size_t iters = (len - 1) / 80; + len -= iters * 80; + +#undef Chunk +#define Chunk() do { \ + __m128i a = Fetch128(s); \ + __m128i b = Fetch128(s + 16); \ + __m128i c = Fetch128(s + 32); \ + __m128i d = Fetch128(s + 48); \ + __m128i e = Fetch128(s + 64); \ + h = Add(h, a); \ + g = Add(g, b); \ + g = Shuffle0321(g); \ + f = Add(f, c); \ + __m128i be = Add(b, Mulc1(e)); \ + h = Add(h, f); \ + f = Add(f, h); \ + h = Add(Murk(d, h), e); \ + k = Xor(k, _mm_shuffle_epi8(g, f)); \ + g = Add(Xor(c, g), a); \ + f = Add(Xor(be, f), d); \ + k = Add(k, be); \ + k = Add(k, _mm_shuffle_epi8(f, h)); \ + f = Add(f, g); \ + g = Add(g, f); \ + f = Mulc1(f); \ +} while (0) + + while (iters-- != 0) { + Chunk(); + s += 80; + } + + if (len != 0) { + h = Add(h, _mm_set1_epi32(len)); + s = s + len - 80; + Chunk(); + } + } + + g = Shuffle0321(g); + k = Xor(k, g); + f = Mulc1(f); + k = Mulc2(k); + g = Mulc1(g); + h = Mulc2(h); + k = Add(k, _mm_shuffle_epi8(g, f)); + h = Add(h, f); + f = Add(f, h); + g = Add(g, k); + k = Add(k, g); + k = Xor(k, _mm_shuffle_epi8(f, h)); + __m128i buf[4]; + buf[0] = f; + buf[1] = g; + buf[2] = k; + buf[3] = h; + s = reinterpret_cast(buf); + uint32_t x = Fetch(s); + uint32_t y = Fetch(s+4); + uint32_t z = Fetch(s+8); + x = _mm_crc32_u32(x, Fetch(s+12)); + y = _mm_crc32_u32(y, Fetch(s+16)); + z = _mm_crc32_u32(z * c1, Fetch(s+20)); + x = _mm_crc32_u32(x, Fetch(s+24)); + y = _mm_crc32_u32(y * c1, Fetch(s+28)); + uint32_t o = y; + z = _mm_crc32_u32(z, Fetch(s+32)); + x = _mm_crc32_u32(x * c1, Fetch(s+36)); + y = _mm_crc32_u32(y, Fetch(s+40)); + z = _mm_crc32_u32(z * c1, Fetch(s+44)); + x = _mm_crc32_u32(x, Fetch(s+48)); + y = _mm_crc32_u32(y * c1, Fetch(s+52)); + z = _mm_crc32_u32(z, Fetch(s+56)); + x = _mm_crc32_u32(x, Fetch(s+60)); + return (o - x + y - z) * c1; +} + +#undef Chunk +#undef Murk +#undef Mulc2 +#undef Mulc1 + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + if (len <= 24) { + if (len >= 13) return farmhashmk::Hash32Len13to24(s, len, seed * c1); + else if (len >= 5) return farmhashmk::Hash32Len5to12(s, len, seed); + else return farmhashmk::Hash32Len0to4(s, len, seed); + } + uint32_t h = farmhashmk::Hash32Len13to24(s, 24, seed ^ len); + return _mm_crc32_u32(Hash32(s + 24, len - 24) + seed, h); +} + +#endif +} // namespace farmhashsa +namespace farmhashcc { +// This file provides a 32-bit hash equivalent to CityHash32 (v1.1.1) +// and a 128-bit hash equivalent to CityHash128 (v1.1.1). It also provides +// a seeded 32-bit hash function similar to CityHash32. + +#undef Fetch +#define Fetch Fetch32 + +#undef Rotate +#define Rotate Rotate32 + +#undef Bswap +#define Bswap Bswap32 + +STATIC_INLINE uint32_t Hash32Len13to24(const char *s, size_t len) { + uint32_t a = Fetch(s - 4 + (len >> 1)); + uint32_t b = Fetch(s + 4); + uint32_t c = Fetch(s + len - 8); + uint32_t d = Fetch(s + (len >> 1)); + uint32_t e = Fetch(s); + uint32_t f = Fetch(s + len - 4); + uint32_t h = len; + + return fmix(Mur(f, Mur(e, Mur(d, Mur(c, Mur(b, Mur(a, h))))))); +} + +STATIC_INLINE uint32_t Hash32Len0to4(const char *s, size_t len) { + uint32_t b = 0; + uint32_t c = 9; + for (size_t i = 0; i < len; i++) { + signed char v = s[i]; + b = b * c1 + v; + c ^= b; + } + return fmix(Mur(b, Mur(len, c))); +} + +STATIC_INLINE uint32_t Hash32Len5to12(const char *s, size_t len) { + uint32_t a = len, b = len * 5, c = 9, d = b; + a += Fetch(s); + b += Fetch(s + len - 4); + c += Fetch(s + ((len >> 1) & 4)); + return fmix(Mur(c, Mur(b, Mur(a, d)))); +} + +uint32_t Hash32(const char *s, size_t len) { + if (len <= 24) { + return len <= 12 ? + (len <= 4 ? Hash32Len0to4(s, len) : Hash32Len5to12(s, len)) : + Hash32Len13to24(s, len); + } + + // len > 24 + uint32_t h = len, g = c1 * len, f = g; + uint32_t a0 = Rotate(Fetch(s + len - 4) * c1, 17) * c2; + uint32_t a1 = Rotate(Fetch(s + len - 8) * c1, 17) * c2; + uint32_t a2 = Rotate(Fetch(s + len - 16) * c1, 17) * c2; + uint32_t a3 = Rotate(Fetch(s + len - 12) * c1, 17) * c2; + uint32_t a4 = Rotate(Fetch(s + len - 20) * c1, 17) * c2; + h ^= a0; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + h ^= a2; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + g ^= a1; + g = Rotate(g, 19); + g = g * 5 + 0xe6546b64; + g ^= a3; + g = Rotate(g, 19); + g = g * 5 + 0xe6546b64; + f += a4; + f = Rotate(f, 19); + f = f * 5 + 0xe6546b64; + size_t iters = (len - 1) / 20; + do { + uint32_t a0 = Rotate(Fetch(s) * c1, 17) * c2; + uint32_t a1 = Fetch(s + 4); + uint32_t a2 = Rotate(Fetch(s + 8) * c1, 17) * c2; + uint32_t a3 = Rotate(Fetch(s + 12) * c1, 17) * c2; + uint32_t a4 = Fetch(s + 16); + h ^= a0; + h = Rotate(h, 18); + h = h * 5 + 0xe6546b64; + f += a1; + f = Rotate(f, 19); + f = f * c1; + g += a2; + g = Rotate(g, 18); + g = g * 5 + 0xe6546b64; + h ^= a3 + a1; + h = Rotate(h, 19); + h = h * 5 + 0xe6546b64; + g ^= a4; + g = Bswap(g) * 5; + h += a4 * 5; + h = Bswap(h); + f += a0; + PERMUTE3(f, h, g); + s += 20; + } while (--iters != 0); + g = Rotate(g, 11) * c1; + g = Rotate(g, 17) * c1; + f = Rotate(f, 11) * c1; + f = Rotate(f, 17) * c1; + h = Rotate(h + g, 19); + h = h * 5 + 0xe6546b64; + h = Rotate(h, 17) * c1; + h = Rotate(h + f, 19); + h = h * 5 + 0xe6546b64; + h = Rotate(h, 17) * c1; + return h; +} + +uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { + if (len <= 24) { + if (len >= 13) return farmhashmk::Hash32Len13to24(s, len, seed * c1); + else if (len >= 5) return farmhashmk::Hash32Len5to12(s, len, seed); + else return farmhashmk::Hash32Len0to4(s, len, seed); + } + uint32_t h = farmhashmk::Hash32Len13to24(s, 24, seed ^ len); + return Mur(Hash32(s + 24, len - 24) + seed, h); +} + +#undef Fetch +#define Fetch Fetch64 + +#undef Rotate +#define Rotate Rotate64 + +#undef Bswap +#define Bswap Bswap64 + +STATIC_INLINE uint64_t ShiftMix(uint64_t val) { + return val ^ (val >> 47); +} + +STATIC_INLINE uint64_t HashLen16(uint64_t u, uint64_t v) { + return Hash128to64(Uint128(u, v)); +} + +STATIC_INLINE uint64_t HashLen16(uint64_t u, uint64_t v, uint64_t mul) { + // Murmur-inspired hashing. + uint64_t a = (u ^ v) * mul; + a ^= (a >> 47); + uint64_t b = (v ^ a) * mul; + b ^= (b >> 47); + b *= mul; + return b; +} + +STATIC_INLINE uint64_t HashLen0to16(const char *s, size_t len) { + if (len >= 8) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch(s) + k2; + uint64_t b = Fetch(s + len - 8); + uint64_t c = Rotate(b, 37) * mul + a; + uint64_t d = (Rotate(a, 25) + b) * mul; + return HashLen16(c, d, mul); + } + if (len >= 4) { + uint64_t mul = k2 + len * 2; + uint64_t a = Fetch32(s); + return HashLen16(len + (a << 3), Fetch32(s + len - 4), mul); + } + if (len > 0) { + uint8_t a = s[0]; + uint8_t b = s[len >> 1]; + uint8_t c = s[len - 1]; + uint32_t y = static_cast(a) + (static_cast(b) << 8); + uint32_t z = len + (static_cast(c) << 2); + return ShiftMix(y * k2 ^ z * k0) * k2; + } + return k2; +} + +// Return a 16-byte hash for 48 bytes. Quick and dirty. +// Callers do best to use "random-looking" values for a and b. +STATIC_INLINE pair WeakHashLen32WithSeeds( + uint64_t w, uint64_t x, uint64_t y, uint64_t z, uint64_t a, uint64_t b) { + a += w; + b = Rotate(b + a + z, 21); + uint64_t c = a; + a += x; + a += y; + b += Rotate(a, 44); + return make_pair(a + z, b + c); +} + +// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. +STATIC_INLINE pair WeakHashLen32WithSeeds( + const char* s, uint64_t a, uint64_t b) { + return WeakHashLen32WithSeeds(Fetch(s), + Fetch(s + 8), + Fetch(s + 16), + Fetch(s + 24), + a, + b); +} + + + +// A subroutine for CityHash128(). Returns a decent 128-bit hash for strings +// of any length representable in signed long. Based on City and Murmur. +STATIC_INLINE uint128_t CityMurmur(const char *s, size_t len, uint128_t seed) { + uint64_t a = Uint128Low64(seed); + uint64_t b = Uint128High64(seed); + uint64_t c = 0; + uint64_t d = 0; + signed long l = len - 16; + if (l <= 0) { // len <= 16 + a = ShiftMix(a * k1) * k1; + c = b * k1 + HashLen0to16(s, len); + d = ShiftMix(a + (len >= 8 ? Fetch(s) : c)); + } else { // len > 16 + c = HashLen16(Fetch(s + len - 8) + k1, a); + d = HashLen16(b + len, c + Fetch(s + len - 16)); + a += d; + do { + a ^= ShiftMix(Fetch(s) * k1) * k1; + a *= k1; + b ^= a; + c ^= ShiftMix(Fetch(s + 8) * k1) * k1; + c *= k1; + d ^= c; + s += 16; + l -= 16; + } while (l > 0); + } + a = HashLen16(a, c); + b = HashLen16(d, b); + return Uint128(a ^ b, HashLen16(b, a)); +} + +uint128_t CityHash128WithSeed(const char *s, size_t len, uint128_t seed) { + if (len < 128) { + return CityMurmur(s, len, seed); + } + + // We expect len >= 128 to be the common case. Keep 56 bytes of state: + // v, w, x, y, and z. + pair v, w; + uint64_t x = Uint128Low64(seed); + uint64_t y = Uint128High64(seed); + uint64_t z = len * k1; + v.first = Rotate(y ^ k1, 49) * k1 + Fetch(s); + v.second = Rotate(v.first, 42) * k1 + Fetch(s + 8); + w.first = Rotate(y + z, 35) * k1 + x; + w.second = Rotate(x + Fetch(s + 88), 53) * k1; + + // This is the same inner loop as CityHash64(), manually unrolled. + do { + x = Rotate(x + y + v.first + Fetch(s + 8), 37) * k1; + y = Rotate(y + v.second + Fetch(s + 48), 42) * k1; + x ^= w.second; + y += v.first + Fetch(s + 40); + z = Rotate(z + w.first, 33) * k1; + v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first); + w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + std::swap(z, x); + s += 64; + x = Rotate(x + y + v.first + Fetch(s + 8), 37) * k1; + y = Rotate(y + v.second + Fetch(s + 48), 42) * k1; + x ^= w.second; + y += v.first + Fetch(s + 40); + z = Rotate(z + w.first, 33) * k1; + v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first); + w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch(s + 16)); + std::swap(z, x); + s += 64; + len -= 128; + } while (LIKELY(len >= 128)); + x += Rotate(v.first + z, 49) * k0; + y = y * k0 + Rotate(w.second, 37); + z = z * k0 + Rotate(w.first, 27); + w.first *= 9; + v.first *= k0; + // If 0 < len < 128, hash up to 4 chunks of 32 bytes each from the end of s. + for (size_t tail_done = 0; tail_done < len; ) { + tail_done += 32; + y = Rotate(x + y, 42) * k0 + v.second; + w.first += Fetch(s + len - tail_done + 16); + x = x * k0 + w.first; + z += w.second + Fetch(s + len - tail_done); + w.second += v.first; + v = WeakHashLen32WithSeeds(s + len - tail_done, v.first + z, v.second); + v.first *= k0; + } + // At this point our 56 bytes of state should contain more than + // enough information for a strong 128-bit hash. We use two + // different 56-byte-to-8-byte hashes to get a 16-byte final result. + x = HashLen16(x, v.first); + y = HashLen16(y + z, w.first); + return Uint128(HashLen16(x + v.second, w.second) + y, + HashLen16(x + w.second, y + v.second)); +} + +STATIC_INLINE uint128_t CityHash128(const char *s, size_t len) { + return len >= 16 ? + CityHash128WithSeed(s + 16, len - 16, + Uint128(Fetch(s), Fetch(s + 8) + k0)) : + CityHash128WithSeed(s, len, Uint128(k0, k1)); +} + +uint128_t Fingerprint128(const char* s, size_t len) { + return CityHash128(s, len); +} +} // namespace farmhashcc +#endif // DEVICE_MODIFIER +namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU { + +#ifndef DEVICE_MODIFIER +// BASIC STRING HASHING + +// Hash function for a byte array. See also Hash(), below. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint32_t Hash32(const char* s, size_t len) { + return DebugTweak( + (can_use_sse41 & x86_64) ? farmhashnt::Hash32(s, len) : + (can_use_sse42 & can_use_aesni) ? farmhashsu::Hash32(s, len) : + can_use_sse42 ? farmhashsa::Hash32(s, len) : + farmhashmk::Hash32(s, len)); +} + +// Hash function for a byte array. For convenience, a 32-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint32_t Hash32WithSeed(const char* s, size_t len, uint32_t seed) { + return DebugTweak( + (can_use_sse41 & x86_64) ? farmhashnt::Hash32WithSeed(s, len, seed) : + (can_use_sse42 & can_use_aesni) ? farmhashsu::Hash32WithSeed(s, len, seed) : + can_use_sse42 ? farmhashsa::Hash32WithSeed(s, len, seed) : + farmhashmk::Hash32WithSeed(s, len, seed)); +} + +// Hash function for a byte array. For convenience, a 64-bit seed is also +// hashed into the result. See also Hash(), below. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint64_t Hash64(const char* s, size_t len) { + return DebugTweak( + (can_use_sse42 & x86_64) ? + farmhashte::Hash64(s, len) : + farmhashxo::Hash64(s, len)); +} + +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +size_t Hash(const char* s, size_t len) { + return sizeof(size_t) == 8 ? Hash64(s, len) : Hash32(s, len); +} + +// Hash function for a byte array. For convenience, a 64-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint64_t Hash64WithSeed(const char* s, size_t len, uint64_t seed) { + return DebugTweak(farmhashna::Hash64WithSeed(s, len, seed)); +} + +// Hash function for a byte array. For convenience, two seeds are also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint64_t Hash64WithSeeds(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { + return DebugTweak(farmhashna::Hash64WithSeeds(s, len, seed0, seed1)); +} + +// Hash function for a byte array. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint128_t Hash128(const char* s, size_t len) { + return DebugTweak(farmhashcc::Fingerprint128(s, len)); +} + +// Hash function for a byte array. For convenience, a 128-bit seed is also +// hashed into the result. +// May change from time to time, may differ on different platforms, may differ +// depending on NDEBUG. +uint128_t Hash128WithSeed(const char* s, size_t len, uint128_t seed) { + return DebugTweak(farmhashcc::CityHash128WithSeed(s, len, seed)); +} + +// BASIC NON-STRING HASHING + +// FINGERPRINTING (i.e., good, portable, forever-fixed hash functions) + +// Fingerprint function for a byte array. Most useful in 32-bit binaries. +uint32_t Fingerprint32(const char* s, size_t len) { + return farmhashmk::Hash32(s, len); +} +#endif // DEVICE_MODIFIER + +// Fingerprint function for a byte array. +DEVICE_MODIFIER uint64_t Fingerprint64(const char* s, size_t len) { + return farmhashna_gpu::Hash64(s, len); +} + +#ifndef DEVICE_MODIFIER +// Fingerprint function for a byte array. +uint128_t Fingerprint128(const char* s, size_t len) { + return farmhashcc::Fingerprint128(s, len); +} + +// Older and still available but perhaps not as fast as the above: +// farmhashns::Hash32{,WithSeed}() +#endif // DEVICE_MODIFIER + +} // namespace NAMESPACE_FOR_HASH_FUNCTIONS_GPU + +#ifndef DEVICE_MODIFIER +#if FARMHASHSELFTEST + +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashccTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +4223616069u, +3696677242u, +1039179260u, 1690343979u, 1018511555u, 2464489001u, +20368522u, 2663783964u, 175201532u, 1619210592u, +4081014168u, +2576519988u, +3285042206u, 502478099u, 739479538u, 1500332790u, +13754768u, 3789353455u, 3473868058u, 1909255088u, +2212771159u, +1112731063u, +826915357u, 2893489933u, 118369799u, 1848668220u, +1308219822u, 249416982u, 64306364u, 4221800195u, +1020067935u, +3955445564u, +563346294u, 550236731u, 2339016688u, 1826259714u, +3872358639u, 2295981050u, 1870005390u, 4015628802u, +1451961420u, +653440099u, +1292493871u, 164377749u, 1717712483u, 463414587u, +3924343675u, 1050492084u, 3566618804u, 2046983362u, +31917516u, +2957164615u, +230718965u, 999595115u, 3534822176u, 2175709186u, +965707431u, 441796222u, 2481718051u, 1827777486u, +2590087362u, +3879448744u, +3515079898u, 1601433082u, 982764532u, 254808716u, +1293372530u, 4205605817u, 947001462u, 1138890052u, +176305566u, +2447367541u, +2973802542u, 4123621138u, 3083865840u, 1706367795u, +792114347u, 2880110657u, 440613768u, 195054868u, +1359016305u, +3363804638u, +649488537u, 1624045597u, 1441938215u, 3147758996u, +3199173578u, 2597283203u, 2191333609u, 3763129144u, +1117290165u, +1062549743u, +2565615889u, 1046361554u, 1581968261u, 1058773671u, +1123053168u, 3807622275u, 1486749916u, 3900816089u, +2437877004u, +1894455839u, +1912520953u, 1914997013u, 561048608u, 1643267444u, +3671572006u, 194811086u, 1468911468u, 2179206286u, +673206794u, +3486923651u, +3741426466u, 3292160512u, 697001377u, 1900763774u, +3726097344u, 629282039u, 3578723715u, 2868028489u, +3269862919u, +2303349487u, +3643953525u, 2307255916u, 849996280u, 732080434u, +909961480u, 3542445214u, 2628347095u, 4236856917u, +1380660650u, +2631821908u, +2007289004u, 3509705198u, 3788541675u, 789457322u, +3090670546u, 638977894u, 3503881773u, 947102987u, +1525325287u, +1816697045u, +2706647405u, 288763142u, 3505438495u, 481308609u, +2882636782u, 3745162621u, 3503467033u, 428247823u, +176408838u, +333551502u, +1001068721u, 1681483651u, 75380831u, 4191469679u, +3627361839u, 2736617386u, 3120737438u, 1297502456u, +864896482u, +85674920u, +2886047255u, 4119881331u, 2496990525u, 3442502055u, +1806582817u, 3186345024u, 4099591287u, 2560171465u, +3489229104u, +3065015872u, +2755089808u, 3098442882u, 378524719u, 2664097023u, +1771960725u, 2901182183u, 55258521u, 1266621443u, +581644891u, +37790450u, +1800731704u, 3601350920u, 53428754u, 2759476837u, +3391093099u, 1496510311u, 2511119507u, 2636877410u, +631613207u, +1573846064u, +260484875u, 1088212603u, 2369525206u, 322522428u, +3191396600u, 2076543340u, 1552496658u, 2739811558u, +3867875546u, +2051584261u, +2126250818u, 901517871u, 3651631165u, 1323139145u, +1521111765u, 477802997u, 3508559783u, 383954241u, +3804516756u, +4250206331u, +2655954340u, 2484996477u, 1417544845u, 1520282298u, +2745204366u, 2869345147u, 1872738335u, 2592877343u, +1619744564u, +1804962124u, +3458679890u, 423948620u, 273645618u, 4187865426u, +376057175u, 2943431463u, 3581950599u, 1035398331u, +1088213445u, +861988903u, +1323370244u, 777069428u, 506235917u, 369720851u, +2789995854u, 230915180u, 1505086948u, 940361236u, +3727873235u, +1159167499u, +1860302871u, 3456858862u, 3923555152u, 2131072714u, +2910461068u, 3671950363u, 2010742682u, 4088068851u, +3616470388u, +2087714788u, +221675509u, 1230154072u, 3450704646u, 1463226695u, +1998357699u, 266026801u, 619568740u, 3560427266u, +4148162586u, +3150417316u, +1356375822u, 2056097622u, 627905802u, 3881675638u, +2309738053u, 971916703u, 3447805361u, 1673575328u, +673084328u, +3317849401u, +2836362782u, 2377208890u, 3275350588u, 158350552u, +2553241779u, 2497264995u, 3262882649u, 3897937187u, +1598963653u, +3068514414u, +601541505u, 374517071u, 3380795976u, 235752573u, +284670003u, 2990192160u, 904937105u, 2306579150u, +2117362589u, +1635274830u, +3355572906u, 170799903u, 1226685528u, 664567688u, +413219134u, 878324258u, 4026159448u, 3620649295u, +1823625377u, +3175888439u, +1759344347u, 2640637095u, 3549558u, 2192984935u, +978623493u, 804017880u, 3877562323u, 3843116489u, +1641748342u, +1853539444u, +3001178468u, 3443560727u, 2685426077u, 1653064722u, +349231508u, 2726789654u, 3136215581u, 768402830u, +269384321u, +531936536u, +2592883487u, 1343156334u, 3628619802u, 1477143570u, +4269458419u, 3285611028u, 959104925u, 2712290710u, +3480237248u, +835796333u, +2020636251u, 1191914589u, 126521603u, 4288023938u, +3731699932u, 2136758855u, 985780142u, 193807575u, +1850544433u, +653947619u, +3929316796u, 381871169u, 950486363u, 1787262279u, +360480382u, 1800636585u, 1039258631u, 3682073259u, +1262819303u, +1786000319u, +1570627191u, 893065837u, 301304916u, 1478469809u, +623018819u, 2742232545u, 2058913014u, 1706060059u, +2421125401u, +1315829592u, +3208766775u, 1805586156u, 575853086u, 3085025513u, +4010908260u, 2344058256u, 3814407434u, 1458485673u, +2474514786u, +3581895658u, +2710719679u, 190812706u, 2135454262u, 2620080728u, +3400757986u, 1669914857u, 1559978393u, 1629811331u, +3096616493u, +1391424435u, +4158376003u, 1015657076u, 794783832u, 479952178u, +1150290207u, 2497437906u, 231815090u, 755078067u, +3832053281u, +63649475u, +2415822606u, 4105027719u, 1706992318u, 1106598740u, +3941945667u, 1271300761u, 505882259u, 760186809u, +2657183368u, +1925422058u, +1039773764u, 880219458u, 4275949176u, 1556833823u, +925882132u, 4216310340u, 757497522u, 461833914u, +3884002070u, +2790957660u, +2100050089u, 651959176u, 1380301291u, 1289124125u, +452314403u, 226156280u, 3306924715u, 1750807758u, +2290180542u, +1953760569u, +2253069096u, 3960924806u, 1786291620u, 60736185u, +2569018293u, 3870479674u, 2247005661u, 2239850953u, +4261808536u, +3282975782u, +780945879u, 3349849383u, 1579362556u, 2265045884u, +905088740u, 725212379u, 3156479246u, 2501620391u, +3062836263u, +4070422690u, +996797869u, 4082582315u, 976105756u, 303983602u, +1862104804u, 3864508254u, 3383979677u, 2835500286u, +2798364010u, +519359476u, +3447342725u, 194373889u, 3313466630u, 232399983u, +2841787856u, 1672751454u, 3345183154u, 1805381384u, +2226129336u, +2847829057u, +2350774567u, 2838540121u, 2757948482u, 1017002062u, +2329150951u, 2171488196u, 3668619047u, 3874977844u, +3287966998u, +262346753u, +2493054715u, 2298644430u, 2926101182u, 1528457638u, +598656233u, 2615845874u, 989110727u, 820441411u, +253617372u, +2201077208u, +2047569338u, 3114356329u, 3335563734u, 2967673540u, +768438341u, 1417708203u, 3873718246u, 1538441843u, +1279167650u, +3917966776u, +2218481734u, 1015935150u, 1957845042u, 1318150213u, +3146423971u, 4218994877u, 1162470863u, 1519718292u, +2594658906u, +665870414u, +3430347817u, 3933868731u, 1597041394u, 3138684682u, +3398212027u, 1064647658u, 1576321132u, 14792918u, +224938029u, +3706456050u, +847274786u, 2645698692u, 1743374687u, 2343133224u, +3066596790u, 2857270120u, 200596308u, 452055528u, +2319312082u, +3488655402u, +4146865894u, 608206438u, 2699777051u, 3687240713u, +327957508u, 3664730153u, 568134564u, 2993484554u, +4159860363u, +4274533921u, +1079994063u, 2360220210u, 3609597760u, 3639708902u, +2836180437u, 1069910270u, 1892427666u, 1874729790u, +1267712826u, +121886940u, +3572289214u, 2475945610u, 783779452u, 588827737u, +1531395014u, 2085084212u, 2219189792u, 3981444548u, +2218885336u, +1691622694u, +2053232885u, 1386558530u, 2182946189u, 2365247285u, +1871081313u, 2935751853u, 38413723u, 543465863u, +900691890u, +2899905665u, +575120562u, 93133904u, 457154948u, 2983705792u, +4232229200u, 2038565963u, 614693984u, 3405328302u, +4083090010u, +2088004171u, +244031209u, 1861889294u, 2417109253u, 3299562328u, +4158642443u, 4199064449u, 3161611046u, 885015950u, +3677904099u, +2969861785u, +772348805u, 1712263832u, 3219357614u, 484271305u, +3645706114u, 2059620251u, 409557488u, 2278896731u, +224475749u, +3523022952u, +2057140088u, 449131785u, 1149879244u, 4255363996u, +3602720135u, 1690010854u, 2503998822u, 2750828466u, +3340671802u, +1447583863u, +2649684943u, 2764747249u, 3046070595u, 3441726138u, +3840332559u, 3156747501u, 1288666680u, 1472744459u, +3452391933u, +1617542784u, +217869690u, 3718469527u, 348639731u, 590532355u, +43789787u, 22606314u, 1621559290u, 2231743261u, +2234620879u, +544748955u, +3169387920u, 203343594u, 3272552527u, 1078282365u, +809576321u, 854207584u, 3625491053u, 1193737267u, +1628966807u, +2661421060u, +2433442061u, 3886639039u, 2149304418u, 303000565u, +1432830882u, 137378235u, 1135974068u, 318705754u, +2491227157u, +2627534472u, +3520352233u, 2488397682u, 3969194920u, 3843962181u, +2135981459u, 2611933220u, 799460731u, 2300968851u, +3412851628u, +3070914013u, +3555224260u, 4125937572u, 240359903u, 722496673u, +2061023600u, 3843919221u, 2759960043u, 1191155322u, +1504041490u, +3735253656u, +1773124736u, 101110011u, 1627699578u, 2645634551u, +263603947u, 1388368439u, 677146538u, 1644201982u, +2625699644u, +2403862553u, +2426069017u, 3613511705u, 915141802u, 2981654265u, +3474818167u, 2611101773u, 627891434u, 762754924u, +2143021902u, +51067670u, +4017746573u, 2269879853u, 3037857950u, 2388899692u, +582729171u, 1886116725u, 2281219772u, 264704948u, +3509984037u, +4078683368u, +2172959411u, 1807195632u, 3357092302u, 2253764928u, +2320369390u, 3076335959u, 2623583210u, 168378015u, +1435562650u, +1100977467u, +3160490319u, 2550328495u, 2396855930u, 1347823908u, +1617990918u, 3849653099u, 3224111576u, 1681539821u, +4171542880u, +552200045u, +3562947778u, 1676237880u, 3747732307u, 2453332913u, +865530667u, 3566636849u, 3485502777u, 336779723u, +2535942410u, +1685000184u, +820545711u, 1893670486u, 1273910461u, 1193758569u, +970365241u, 381205962u, 3612810852u, 1160577445u, +541488143u, +4005031080u, +2333965236u, 2419855455u, 3484533538u, 3073937876u, +908466956u, 661391539u, 2342122412u, 1467049112u, +1785800827u, +135343033u, +139643209u, 2438375667u, 974654058u, 3216478230u, +3807620420u, 779043363u, 2812846449u, 333254784u, +1025244024u, +2242303095u, +2476683742u, 350018683u, 174652916u, 933097576u, +826905896u, 559603581u, 2777181260u, 164915169u, +4070353203u, +1459055748u, +297303985u, 3103837241u, 3812514233u, 232265137u, +2032819099u, 1523091376u, 3531238208u, 1403510182u, +2886832080u, +2599705941u, +2789695716u, 68437968u, 3823813791u, 1040994569u, +3024194990u, 2461740520u, 3735391266u, 2042207153u, +2461678616u, +3519231840u, +1344224923u, 411442756u, 1179779351u, 7661528u, +778352196u, 3288808867u, 589356197u, 2627504511u, +3374744599u, +3312172905u, +357423007u, 3539567796u, 4044452215u, 1445118403u, +2937983820u, 184089910u, 346201845u, 2427295202u, +1345448010u, +2884434843u, +3085001879u, 2640105409u, 315310640u, 3530289798u, +3362974764u, 963602652u, 75228477u, 3509381180u, +4012777756u, +2380345941u, +1073137836u, 2083960378u, 1220315185u, 3628720934u, +3508867818u, 67148343u, 3558085158u, 1753943368u, +863309561u, +2844713625u, +441921850u, 854732254u, 816793316u, 2555428747u, +3440623414u, 1707304366u, 3189874375u, 1623229221u, +1220335976u, +806745430u, +3909262947u, 1680369031u, 2926179486u, 3410391660u, +3991630434u, 2876458763u, 1179167079u, 536360759u, +1592117159u, +1514343977u, +1032622306u, 2057494855u, 784938958u, 178402996u, +1152907972u, 2326185495u, 2939973666u, 4181120253u, +552831733u, +664251856u, +1297139539u, 1969357631u, 1474065957u, 3055419017u, +3395829380u, 3316562752u, 2168409017u, 614624786u, +3585854336u, +668291094u, +1162889217u, 3773171307u, 2263271126u, 355089668u, +3195850578u, 3396793277u, 3519870267u, 527857605u, +3972392320u, +2224315010u, +4047225561u, 3271434798u, 3192704713u, 2798505213u, +3932215896u, 3792924012u, 3796843756u, 453872975u, +4050552799u, +1056432676u, +928166947u, 121311642u, 930989547u, 2087070683u, +1288978057u, 1556325239u, 1812435626u, 1682385724u, +1214364933u, +904760776u, +3957045528u, 3949822847u, 2411065880u, 3716420732u, +3424837835u, 3833550693u, 1799375326u, 2012368921u, +2768764136u, +1786111037u, +4055479315u, 3751639533u, 2808224623u, 3492656387u, +1306824780u, 2624000170u, 3134795218u, 1778409297u, +3900821801u, +593336325u, +2772069220u, 2980873673u, 3574497158u, 3994780459u, +4246519854u, 3482758570u, 4228015183u, 33101083u, +1769887734u, +4158035314u, +3690638998u, 1119035482u, 4134969651u, 2483207353u, +3932823321u, 285829887u, 3485140138u, 1304815138u, +995608264u, +3133997465u, +1195477617u, 2147693728u, 3506673112u, 4234467492u, +1183174337u, 1395340482u, 769199343u, 193262308u, +2798920256u, +3827889422u, +3399695609u, 3036045724u, 2999477386u, 3567001759u, +2682864314u, 1414023907u, 3699872975u, 3369870701u, +2662284872u, +2179640019u, +2485080099u, 3234415609u, 3755915606u, 1339453220u, +1567403399u, 2076272391u, 293946298u, 3861962750u, +1291949822u, +2916864995u, +132642326u, 2215117062u, 2205863575u, 2488805750u, +405632860u, 3248129390u, 2952606864u, 896734759u, +2047417173u, +3865951392u, +657296855u, 1328547532u, 3966511825u, 3959682388u, +4171801020u, 2981416957u, 1868896247u, 790081075u, +3143666398u, +2950766549u, +2065854887u, 2737081890u, 995061774u, 1510712611u, +2865954809u, 565044286u, 1565631102u, 1500654931u, +494822108u, +2803515503u, +1058154996u, 3506280187u, 856885925u, 4204610546u, +800905649u, 1130711562u, 558146282u, 2053400666u, +449794061u, +2643520245u, +2101248725u, 3123292429u, 3583524041u, 983372394u, +1587743780u, 672870813u, 444833475u, 100741452u, +366232251u, +1717951248u, +524144122u, 1362432726u, 1304947719u, 674306020u, +405665887u, 4081931036u, 1580408204u, 2343242778u, +3901654006u, +2627173567u, +3015148205u, 814686701u, 1327920712u, 1346494176u, +2468632605u, 2259795544u, 2519278184u, 2129281928u, +2860266380u, +4001619412u, +1154910973u, 2841022216u, 1199925485u, 1372200293u, +2713179055u, 3609776550u, 2896463880u, 1056406892u, +177413841u, +40180172u, +3274788406u, 660921784u, 1686225028u, 4003382965u, +2532691887u, 4256809101u, 1186018983u, 667359096u, +2375266493u, +2760222015u, +745187078u, 312264012u, 396822261u, 2588536966u, +2026998998u, 1766454365u, 3218807676u, 3915487497u, +2630550356u, +4130063378u, +4231937074u, 752212123u, 3085144349u, 3267186363u, +4103872100u, 4193207863u, 1306401710u, 3014853131u, +1067760598u, +2306188342u, +2437881506u, 4258185052u, 2506507580u, 130876929u, +1076894205u, 4106981702u, 2799540844u, 945747327u, +1436722291u, +2499772225u, +2571537041u, 2038830635u, 2066826058u, 2892892912u, +524875858u, 3392572161u, 2869992096u, 1308273341u, +923668994u, +1980407857u, +2275009652u, 240598096u, 2658376530u, 3505603048u, +1022603789u, 582423424u, 846379327u, 4092636095u, +4177298326u, +1004173023u, +2154027018u, 2993634669u, 1098364089u, 3035642175u, +1335688126u, 1376393415u, 1252369770u, 3815033328u, +1999309358u, +1234054757u, +1388595255u, 2859334775u, 366532860u, 3453410395u, +4226967708u, 1321729870u, 2078463405u, 156766592u, +3157683394u, +3549293384u, +3348214547u, 2879648344u, 1144813399u, 2758966254u, +647753581u, 813615926u, 2035441590u, 1961053117u, +600168686u, +2192833387u, +3156481401u, 3627320321u, 383550248u, 81209584u, +2339331745u, 1284116690u, 1980144976u, 2955724163u, +789301728u, +3842040415u, +1115881490u, 965249078u, 4098663322u, 1870257033u, +2923150701u, 4217108433u, 183816559u, 2104089285u, +2640095343u, +3173757052u, +927847464u, 2383114981u, 4287174363u, 1886129652u, +70635161u, 1182924521u, 1121440038u, 4246220730u, +3890583049u, +975913757u, +2436253031u, 1074894869u, 1301280627u, 992471939u, +735658128u, 244441856u, 1541612456u, 3457776165u, +3503534059u, +1931651133u, +349142786u, 3669028584u, 1828812038u, 99128389u, +1364272849u, 1963678455u, 3971963311u, 2316950886u, +1308901796u, +2789591580u, +1460494965u, 2380227479u, 1577190651u, 1755822080u, +2911014607u, 859387544u, 13023113u, 2319243370u, +2522582211u, +2299110490u, +3342378874u, 2589323490u, 1884430765u, 3739058655u, +2419330954u, 355389916u, 273950915u, 3670136553u, +410946824u, +3174041420u, +2609010298u, 3059091350u, 2300275014u, 725729828u, +2548380995u, 1738849964u, 1257081412u, 79430455u, +810321297u, +3246190593u, +1007937684u, 912115394u, 40880059u, 3450073327u, +4289832174u, 2253485111u, 1065639151u, 2953189309u, +124779113u, +654299738u, +115760833u, 1250932069u, 884995826u, 3998908281u, +1382882981u, 1134187162u, 3202324501u, 487502928u, +3032756345u, +4057517628u, +933197381u, 2319223127u, 2044528655u, 2554572663u, +4049450620u, 1620812836u, 2832905391u, 2273005481u, +1913090121u, +1055456023u, +510593296u, 3285343192u, 2912822536u, 1645225063u, +638418430u, 452701300u, 1025483165u, 1639370512u, +167948643u, +2809842730u, +2983135664u, 407521332u, 1543756616u, 3949773145u, +4283462892u, 659962275u, 3878013463u, 1000748756u, +4053212051u, +4099239406u, +3467581965u, 354635541u, 21301844u, 3831212473u, +3189450571u, 2264401966u, 4096484849u, 1736448515u, +3976926096u, +3727194724u, +2243487039u, 585209095u, 3143046007u, 969558123u, +3037113502u, 3594170243u, 2835860223u, 3775493975u, +2787220812u, +2274252217u, +2915380701u, 3077533278u, 1252871826u, 1519790952u, +205297661u, 2950557658u, 3956882191u, 2724439401u, +3694608025u, +124028038u, +216019153u, 1533010676u, 2259986336u, 2014061617u, +2068617849u, 3078123052u, 2692046098u, 1582812948u, +396916232u, +1470894001u, +1694309312u, 300268215u, 1553892743u, 671176040u, +1544988994u, 2793402821u, 4194972569u, 2296476154u, +748354332u, +3491325898u, +4261053291u, 1104998242u, 797816835u, 243564059u, +2197717393u, 299029458u, 1675252188u, 3139770041u, +583018574u, +2532106100u, +2099391658u, 3760526730u, 3422719327u, 3556917689u, +2374009285u, 2130865894u, 3710563151u, 1437538307u, +3938030842u, +2006930694u, +2151243336u, 1939741287u, 1957068175u, 2135147479u, +649553342u, 1713643042u, 4188696599u, 1698739939u, +3549427584u, +1016382174u, +322644378u, 2476164549u, 2037263020u, 88036019u, +2548960923u, 539867919u, 2871157727u, 4031659929u, +754087252u, +972656559u, +4246379429u, 3877308578u, 2059459630u, 3614934323u, +1410565271u, 2102980459u, 215395636u, 1083393481u, +3775523015u, +2062750105u, +2475645882u, 3041186774u, 3534315423u, 758607219u, +1686100614u, 180500983u, 1155581185u, 1476664671u, +2918661695u, +3812731350u, +4003853737u, 4148884881u, 1468469436u, 3278880418u, +1045838071u, 1049161262u, 360450415u, 3158065524u, +814443735u, +3391401707u, +729968410u, 738771593u, 3662738792u, 1672830580u, +4199496163u, 188487238u, 219098233u, 2141731267u, +3890250614u, +2988780375u, +4026279523u, 3489429375u, 2468433807u, 1178270701u, +2685094218u, 2716621497u, 3718335529u, 2273344755u, +701110882u, +1925717409u, +1515176562u, 2325460593u, 3954798930u, 784566105u, +3769422266u, 1641530321u, 2703876862u, 2907480267u, +1828076455u, +1805635221u, +3883381245u, 1476756210u, 2072514392u, 3658557081u, +2003610746u, 2556845550u, 729594004u, 3303898266u, +1968227254u, +423204951u, +231828688u, 4223697811u, 698619045u, 3636824418u, +2738779239u, 2333529003u, 2833158642u, 580285428u, +3038148234u, +1012378004u, +1113647298u, 1424593483u, 4053247723u, 1167152941u, +2677383578u, 3419485379u, 2135673840u, 440478166u, +1682229112u, +3226724137u, +1217439806u, 3828726923u, 3636576271u, 3467643156u, +2005614908u, 2655346461u, 2345488441u, 1027557096u, +3594084220u, +1372306343u, +2342583762u, 4291342905u, 4094931814u, 3254771759u, +821978248u, 2404930117u, 1143937655u, 3156949255u, +3460606610u, +449701786u, +3474906110u, 1932585294u, 2283357584u, 1808481478u, +3522851029u, 3040164731u, 1530172182u, 2950426149u, +1402416557u, +756419859u, +4132576145u, 724994790u, 2852015871u, 2177908339u, +899914731u, 139675671u, 1423281870u, 3198458070u, +807581308u, +2021611521u, +1801452575u, 1425984297u, 2833835949u, 1536827865u, +3902351840u, 164546042u, 1872840974u, 3986194780u, +792156290u, +3378681896u, +941547959u, 3931328334u, 3661060482u, 2386420777u, +3920146272u, 3458621279u, 3348500844u, 2269586542u, +797371473u, +3188953649u, +80514771u, 2913333490u, 1246325623u, 3253846094u, +1723906239u, 1606413555u, 587500718u, 1412413859u, +2310046829u, +2113313263u, +3855635608u, 47271944u, 1112281934u, 3440228404u, +2633519166u, 425094457u, 307659635u, 67338587u, +2412987939u, +2363930989u, +2853008596u, 2844637339u, 922568813u, 130379293u, +2825204405u, 2904442145u, 1176875333u, 1511685505u, +599177514u, +1872681372u, +682394826u, 1888849790u, 3635304282u, 1761257265u, +1571292431u, 355247075u, 1177210823u, 1691529530u, +3629531121u, +3760474006u, +1129340625u, 868116266u, 3908237785u, 1942124366u, +1266630014u, 3214841995u, 334023850u, 1110037019u, +369650727u, +1288666741u, +70535706u, 20230114u, 4284225520u, 727856157u, +293696779u, 1244943770u, 3976592462u, 560421917u, +4171688499u, +2438786950u, +1218144639u, 3809125983u, 1302395746u, 534542359u, +2121993015u, 2899519374u, 3192177626u, 1761707794u, +3101683464u, +1555403906u, +3225675390u, 1875263768u, 4278894569u, 651707603u, +2111591484u, 3802716028u, 2900262228u, 1181469202u, +3254743797u, +1822684466u, +860641829u, 3046128268u, 1284833012u, 1125261608u, +461384524u, 2331344566u, 1274400010u, 990498321u, +3462536298u, +3796842585u, +2346607194u, 279495949u, 3951194590u, 3522664971u, +3169688303u, 726831706u, 1123875117u, 1816166599u, +3759808754u, +2918558151u, +3713203220u, 3369939267u, 466047109u, 384042536u, +587271104u, 2191634696u, 2449929095u, 1157932232u, +2084466674u, +841370485u, +3241372562u, 4277738486u, 2150836793u, 1173569449u, +778768930u, 2594706485u, 3065269405u, 3019263663u, +2660146610u, +2789946230u, +77056913u, 728174395u, 3647185904u, 804562358u, +2697276483u, 881311175u, 1178696435u, 2059173891u, +2308303791u, +221481230u, +50241451u, 3689414100u, 1969074761u, 2732071529u, +1900890356u, 840789500u, 2100609300u, 985565597u, +1220850414u, +2456636259u, +223607678u, 1016310244u, 1937434395u, 85717256u, +275058190u, 3712011133u, 171916016u, 2389569096u, +3679765802u, +3575358777u, +3481108261u, 3178286380u, 2489642395u, 2931039055u, +3086601621u, 3079518902u, 3027718495u, 2506894644u, +2976869602u, +2134336365u, +2420172217u, 918054427u, 661522682u, 1403791357u, +3587174388u, 2623673551u, 1355661457u, 4159477684u, +1109013587u, +3112183488u, +2217849279u, 3500291996u, 2419603731u, 2929886201u, +3854470013u, 1358382103u, 1357666555u, 21053566u, +2716621233u, +3094836862u, +3309729704u, 57086558u, 839187419u, 2757944838u, +3651040558u, 3607536716u, 3691257732u, 2312878285u, +1202511724u, +183479927u, +2509829803u, 109313218u, 478173887u, 2072044014u, +190631406u, 2495604975u, 1010416260u, 3679857586u, +726566957u, +258500881u, +1805873908u, 3081447051u, 2352101327u, 534922207u, +1584552873u, 813470716u, 255914637u, 249169434u, +3193498057u, +1038802706u, +2590158653u, 3147907290u, 663060128u, 1156177857u, +634616100u, 312879189u, 1545020368u, 2054634247u, +3271451914u, +3438291534u, +2181454946u, 3864535432u, 2398586877u, 896491075u, +2810631478u, 2770357487u, 3372930052u, 898070638u, +2051007323u, +392959778u, +36645539u, 3743556044u, 4134529680u, 4124451188u, +566806297u, 2936523982u, 1304761965u, 537399498u, +1940818842u, +40862381u, +36288410u, 3063605629u, 2826611650u, 3961972098u, +1871578006u, 2392095486u, 1136931591u, 513864488u, +173276451u, +3039055682u, +3543322032u, 1943592006u, 657217094u, 1751698246u, +2969618445u, 456616022u, 900309519u, 113892716u, +1126392103u, +1235651045u, +1882073852u, 2136610853u, 2353639710u, 2819956700u, +3980083530u, 828773559u, 224069850u, 902434120u, +2802008036u, +94358995u, +2777723394u, 2812641403u, 2525832595u, 4157388110u, +4235563782u, 937800324u, 141690749u, 568062536u, +550123849u, +1330316521u, +1949488696u, 2296431366u, 1958465262u, 3564751729u, +3748252207u, 120455129u, 1607318832u, 2525729790u, +2640987481u, +2332096657u, +1775969159u, 1555085077u, 2913525137u, 1347085183u, +2376253113u, 3194050574u, 1806090610u, 678641356u, +1499146713u, +383849715u, +3299835823u, 2284860330u, 2614269636u, 3913628844u, +2761334210u, 1959484587u, 529797021u, 239966995u, +3102194829u, +3602307804u, +1122192627u, 3577510006u, 164486066u, 1680137310u, +1473396395u, 1467801424u, 903493660u, 1185943071u, +2798556505u, +2306744492u, +3167201310u, 3577947177u, 3067592134u, 2905506289u, +1210366329u, 204484056u, 2347778932u, 3862374472u, +3277439508u, +4187414621u, +1646699310u, 621385800u, 3934869089u, 3975491588u, +3580085916u, 1925674500u, 2436305348u, 3983301539u, +2739439523u, +3291507446u, +3395637920u, 3753389171u, 2955202032u, 2654255623u, +3771089254u, 2140443405u, 2779834738u, 3261942805u, +3526889244u, +1842009139u, +4048484340u, 2106218403u, 2161244271u, 772152700u, +1158647659u, 3776791619u, 3882186721u, 699525237u, +2954670460u, +1007105869u, +3359152025u, 1146388699u, 1401550303u, 2326582541u, +4181783540u, 1085644043u, 1942143795u, 1038368308u, +1526153809u, +4042547244u, +1891441000u, 2573991874u, 1281441253u, 3635098284u, +1980545715u, 825985487u, 3934748116u, 4228386979u, +1480870944u, +1042194545u, +2397771642u, 2248490001u, 3817869868u, 878654626u, +3785629484u, 1672470870u, 3229367873u, 1894538933u, +1010692731u, +1733824268u, +656620328u, 3048283803u, 3353340056u, 2324965120u, +4192585951u, 2284524675u, 3483884368u, 1510168293u, +1554942691u, +1309709396u, +1241133168u, 3162179280u, 4046378054u, 3171681593u, +1165297136u, 3496703563u, 150437903u, 1948622072u, +1076332463u, +2292479143u, +1464229958u, 3479738093u, 2328067598u, 2334503110u, +833324834u, 3981605747u, 3002629155u, 2854644186u, +2832201336u, +95796957u, +3269249397u, 2358313329u, 3411860910u, 4283292480u, +2802208697u, 1305947955u, 2156803420u, 1991340283u, +189678024u, +447602599u, +1055411517u, 1531748363u, 1555852656u, 412402681u, +3774988152u, 20597551u, 2925024131u, 1423989620u, +3749428061u, +1541439448u, +112270416u, 1936224776u, 132162941u, 3772011507u, +3814102518u, 1908807815u, 444154079u, 823765347u, +3362275567u, +3419047430u, +2108287005u, 2315102125u, 658593738u, 3195094029u, +3721937534u, 3176229204u, 3398835373u, 1271898712u, +1142546577u, +3185986817u, +3562705803u, 2046119567u, 912990621u, 1829977672u, +3459576979u, 1118045834u, 1369529376u, 3320601076u, +3954988953u, +4002467635u, +3359456351u, 1314849568u, 1766750942u, 2998874853u, +1181800239u, 707328036u, 3314954697u, 2066721120u, +598194215u, +1124451278u, +3156679616u, 3742684743u, 2960199690u, 2683497915u, +2566077529u, 937014607u, 102095219u, 4262922475u, +3132264275u, +1262099830u, +862722905u, 2717653494u, 3245583534u, 3427209989u, +3220278124u, 85457091u, 2222333500u, 3513997967u, +3522324951u, +2830855552u, +2215004781u, 3482411840u, 4227160614u, 2030964411u, +1741393851u, 2643723748u, 942813508u, 403442675u, +3112048748u, +530556423u, +3817755244u, 3543286628u, 2247276090u, 1532920842u, +4101962711u, 1446540991u, 3297821473u, 1861255389u, +1984398u, +2366525138u, +377589481u, 3549193828u, 1427765914u, 506831657u, +277278988u, 1447652775u, 3214362239u, 3142198690u, +2843087541u, +468915015u, +807895062u, 2198723907u, 4031145069u, 2417156212u, +4027298697u, 637175947u, 1229254212u, 1773257887u, +1659444818u, +451148891u, +2099741368u, 735351990u, 2534775713u, 3261804619u, +712519954u, 3527962772u, 3758642738u, 4245823575u, +1281314264u, +1167866160u, +1489546151u, 1197354389u, 1043278102u, 2563326586u, +371937794u, 2320164817u, 3189512691u, 573685198u, +4108603513u, +3758899588u, +3507030163u, 2947201212u, 2529492585u, 578234375u, +3362349842u, 3318878925u, 3611203517u, 3059253190u, +4270755916u, +4291274625u, +4237586791u, 4137422245u, 2927218651u, 2444687041u, +797128811u, 2043057612u, 396533859u, 2665256178u, +3346510674u, +1779586176u, +3076562062u, 1882746214u, 921095362u, 2026988397u, +514514911u, 3886379478u, 4218272420u, 1480386793u, +3900160816u, +2292273451u, +1276138356u, 1125461821u, 1912885715u, 3365266013u, +1333211627u, 4085009861u, 1390530102u, 3347984752u, +2721771301u, +1419492325u, +4066766256u, 3250852311u, 820111852u, 1382201318u, +2366036798u, 938032241u, 3100979439u, 487048687u, +2292851045u, +3241399180u, +3912670510u, 2416437067u, 2973194517u, 3507707986u, +1935099406u, 2533441488u, 104616731u, 2892622820u, +3801190339u, +4239188808u, +807238241u, 3300121546u, 2249406147u, 4032114017u, +3713738189u, 3324425575u, 4275607376u, 3663120298u, +4173658372u, +3984289690u, +1827636846u, 3264588778u, 3297165529u, 558623533u, +2728945672u, 1566297318u, 3447249966u, 481719551u, +1596842050u, +1838185946u, +265271620u, 1050246315u, 4046655705u, 1844193138u, +3807563245u, 1075384804u, 1292554949u, 1506525927u, +2921816148u, +2051885269u, +1930534041u, 3872721086u, 1564489377u, 2272482181u, +2849358683u, 589618304u, 2262072443u, 290363051u, +299168363u, +3867603931u, +2868688756u, 2545263115u, 1092098533u, 3885725603u, +2352430409u, 1981595469u, 2047946646u, 1332642839u, +793806516u, +214858837u, +1061484659u, 3192394476u, 1115054785u, 3690637234u, +996792368u, 2023479706u, 3046498231u, 4205835102u, +3870714754u, +257472875u, +3549864599u, 2040276129u, 2414778670u, 812235477u, +2674248196u, 1864096101u, 2257492689u, 1332556794u, +1079540713u, +465530720u, +2304763972u, 830724724u, 3354588920u, 2510713652u, +3103749409u, 468835585u, 1707620787u, 3038024846u, +1000303198u, +3462270146u, +2748698899u, 2100348093u, 511537258u, 1237187486u, +102049383u, 2268226698u, 3162251739u, 4219404629u, +838822407u, +1481440623u, +2989224077u, 2676681975u, 3246551821u, 3812079906u, +370572963u, 2283154352u, 3084789986u, 1961085583u, +1955640586u, +2409348147u, +2284780581u, 1634818716u, 4018221729u, 2320761377u, +3566831899u, 1799560520u, 91431959u, 1754113747u, +1459430477u, +3613658517u, +924489906u, 3406317699u, 866289774u, 3924821603u, +1265394945u, 1870668109u, 151949856u, 2747006534u, +3111906201u, +64039467u, +2314447545u, 2600195638u, 4095795204u, 4162096026u, +1026756826u, 2460047982u, 52686887u, 823198739u, +1518045160u, +2867527376u, +566410761u, 2200433819u, 2114146405u, 2893790965u, +881504901u, 974783212u, 490815659u, 937300283u, +1523735309u, +2511976468u, +2634644947u, 355119367u, 1373773092u, 309232995u, +3088671051u, 787126032u, 3442836843u, 4289194567u, +2177850062u, +1174136430u, +3248982914u, 3129039732u, 1166851580u, 2196451882u, +469595580u, 2130837700u, 3783349021u, 3745262548u, +1236930515u, +3032131496u, +1525591437u, 1823628217u, 1939019255u, 1950270463u, +3659899927u, 3688643445u, 3004399289u, 1155199552u, +357547234u, +2213110526u, +3122658210u, 2667800490u, 2718690333u, 3512372076u, +1098611683u, 2657518392u, 4248458835u, 3109874532u, +1592908438u, +2864927516u, +3635248840u, 1251777186u, 3797340158u, 3508496870u, +303354834u, 1482394062u, 2087100120u, 1595931912u, +608574156u, +723367884u, +907938402u, 3357047807u, 1619629851u, 3092082995u, +89030300u, 916336992u, 1861180168u, 3436334155u, +1375000544u, +3472936241u, +1321217853u, 791356402u, 2872410224u, 2326250297u, +2657644088u, 1748314108u, 4146771421u, 2913114440u, +2924821844u, +2101101496u, +3268017251u, 2109603066u, 690665520u, 1830067573u, +951427661u, 2982533150u, 3884512506u, 2358657479u, +2833210784u, +3419798214u, +3785893994u, 2103940206u, 86759766u, 4031230616u, +3745237192u, 2739453927u, 497038072u, 3303159408u, +1251537249u, +1993408196u, +3185905715u, 2885948408u, 3154277110u, 2444150313u, +2505582079u, 2120610195u, 3266465773u, 1814611964u, +3080050407u, +1079915522u, +1819346505u, 2529946763u, 892097374u, 3740257161u, +3618100441u, 1079900094u, 3607172225u, 737863389u, +360704560u, +3341993089u, +1139047381u, 3132219631u, 1248981859u, 1109338159u, +2004908615u, 4022302594u, 4166640860u, 2959140950u, +3949235962u, +2832278473u, +2200524012u, 2634933043u, 2495844522u, 2613799818u, +4034096813u, 683271795u, 1673546817u, 1363163726u, +1805395136u, +511749501u, +1231032599u, 2305979751u, 345737783u, 3339868854u, +2931857933u, 2323251738u, 1332068477u, 51846558u, +3927238177u, +1387182179u, +1701238601u, 1419275173u, 2580882268u, 3357874599u, +1726558907u, 1292901039u, 1371322339u, 1311713044u, +3526735232u, +4017884184u, +3366093428u, 77140994u, 2128996229u, 1357915765u, +4019691901u, 483989024u, 2390311750u, 2766065288u, +3938587520u, +3064810344u, +1054589198u, 1274997019u, 4040589616u, 1277751144u, +2274907047u, 4170399945u, 2886368209u, 4168922115u, +3901237033u, +3252972311u, +2205185840u, 3403097556u, 3385493699u, 2809751370u, +555319628u, 399539034u, 2998971454u, 1521596214u, +178870216u, +1471733541u, +519629198u, 514159209u, 1500582242u, 1928616587u, +2686427928u, 4133138798u, 1225914083u, 1432713584u, +3559310915u, +3925489366u, +1055613123u, 4126676029u, 2723867653u, 3290604111u, +1377022957u, 2373608155u, 3615237379u, 594338683u, +2645257602u, +2408427260u, +917033274u, 750455097u, 625657657u, 121713200u, +2191273413u, 4043949724u, 3293146785u, 3809297972u, +3947296919u, +115456894u, +1529576616u, 1459278275u, 2157117997u, 1747859293u, +4106665903u, 996939232u, 2007976332u, 4274649009u, +1017725787u, +4244666096u, +1219631331u, 3072426253u, 3547691720u, 1620822012u, +1397717508u, 2031597325u, 3345983430u, 2459068000u, +3645130467u, +2308642742u, +359955852u, 1348467968u, 1133123059u, 2435919062u, +2800365907u, 4213217210u, 4056565603u, 2811666556u, +2318007236u, +3823652401u, +3654086429u, 1273260424u, 1591610446u, 943349350u, +3441227678u, 3779964757u, 233818224u, 3469971032u, +3764095096u, +4009204587u, +678472092u, 1990559652u, 2583121088u, 2978143652u, +2496370864u, 2139539656u, 4287972050u, 295832576u, +3536742861u, +2257466133u, +2738052161u, 1988611898u, 2466189642u, 3294419573u, +2311186273u, 474374532u, 3081964174u, 2515138278u, +835731677u, +1178182694u, +3352119543u, 2884763225u, 3462399574u, 2900817210u, +1993698511u, 2868445043u, 2746444849u, 1205258179u, +2353442946u, +4079040070u, +3624133102u, 2907136076u, 2902521697u, 426813211u, +1418185512u, 3711189488u, 1351506552u, 1934749519u, +46595543u, +401688809u, +3514602124u, 1396852607u, 1951477943u, 2502249173u, +3199695820u, 2890250638u, 4205072507u, 1715623846u, +3266686789u, +3218688128u, +1697759742u, 851227671u, 2358709645u, 4174233268u, +500583683u, 3805940955u, 736234120u, 2710563712u, +1949664540u, +3139414003u, +4293073253u, 1284406972u, 1785182449u, 1051548274u, +2994248357u, 2499882522u, 717208669u, 2039517285u, +518424929u, +143136433u, +2303774671u, 1272930860u, 2286410920u, 788459311u, +273225293u, 2439291703u, 2254505236u, 3446287701u, +3655156558u, +1546628787u, +340081500u, 3285722006u, 1324810435u, 1053980860u, +1779472859u, 2700355724u, 686005017u, 3762376315u, +3963193100u, +1370881135u, +661300087u, 1152753704u, 2349891598u, 3910051187u, +2109444785u, 1311123870u, 2639837565u, 1896770931u, +1081414128u, +869877586u, +4284220400u, 63045374u, 235968615u, 184451062u, +1271099822u, 1319179857u, 3274963209u, 4172272710u, +3388797445u, +2965973320u, +3793110097u, 3327241723u, 2991804005u, 1199544355u, +771553759u, 2031749842u, 2596517372u, 1199888213u, +858347951u, +3340178832u, +2903875412u, 763490382u, 76949161u, 2056544406u, +1145227689u, 998233136u, 2354530024u, 427713587u, +3537837347u, +604661755u, +923986833u, 1023730418u, 798294227u, 432557449u, +801802449u, 1861313429u, 3899128441u, 4068407979u, +2352677083u, +3783539925u, +10731973u, 3390767975u, 3949540249u, 1920121661u, +3248580201u, 641956426u, 2104847395u, 604835744u, +1491663404u, +4255204651u, +1520970746u, 2845653368u, 3247412938u, 3730629005u, +855569514u, 3073294700u, 2429691698u, 3818342476u, +3938869985u, +2731201328u, +2335202643u, 778117742u, 13298408u, 228780590u, +2871715314u, 3253688653u, 4150999702u, 3846220408u, +930808u, +1397128726u, +1964216488u, 2781092828u, 116285375u, 2271239476u, +3724347554u, 2931203895u, 3893169206u, 1883912528u, +2093892660u, +3658787024u, +3095016046u, 1094059199u, 3640239610u, 558564267u, +2102812456u, 464734873u, 925262247u, 1609838036u, +588364741u, +1731409233u, +1576165139u, 3933979268u, 375316394u, 4247099643u, +3670508019u, 4080496835u, 2371248533u, 183762693u, +2078935389u, +2699810414u, +1491815683u, 2999180789u, 1831158425u, 1603373553u, +2006136905u, 3210230591u, 416748595u, 1536971415u, +3271869367u, +1266062739u, +2138414557u, 3337114778u, 1634586826u, 36472629u, +4482244u, 568009609u, 2721216780u, 4037289545u, +2235138807u, +1789351460u, +4067539527u, 1323062829u, 3864620647u, 4192026301u, +4278901241u, 1399025382u, 2826652805u, 1363860382u, +1801770651u, +1613381526u, +1165249276u, 4046576622u, 2535596946u, 3260388176u, +1078898578u, 2259750862u, 643387587u, 237144235u, +4199571427u, +3440917581u, +3067939258u, 2018625455u, 1460528353u, 3138629939u, +1666223528u, 3841139376u, 2528281125u, 885565193u, +2609492686u, +2517257479u, +560864620u, 2261471820u, 3491559165u, 1329620416u, +622383582u, 1759597655u, 2877873893u, 584692817u, +1901728399u, +2599000260u, +3169771644u, 296332336u, 774719455u, 4175920823u, +2287316070u, 4115615023u, 1073335619u, 4240292725u, +1359158837u, +1960974237u, +3173724597u, 1619084286u, 2876340752u, 4065675347u, +480741335u, 1237329941u, 701055566u, 3729009837u, +1314736422u, +4003180069u, +3118519317u, 3035354420u, 3380357671u, 4020909015u, +253958714u, 3545798863u, 3008185002u, 2624719888u, +3219955575u, +3060719376u, +573101682u, 1580316843u, 2610493412u, 3490983536u, +3601975611u, 851470366u, 635384901u, 3427048824u, +1470002757u, +3592460087u, +2265226856u, 4124282457u, 2106385486u, 3334305617u, +4208282753u, 3798749815u, 225396466u, 118791182u, +2523395972u, +194595464u, +2563824631u, 2521301383u, 4224409406u, 468670274u, +1761966400u, 1300908277u, 2570709228u, 1847901526u, +1470099163u, +2690466752u, +1472536718u, 2399279735u, 4150607803u, 1775080054u, +2082537685u, 4080034578u, 1256001880u, 392967725u, +2055838940u, +3349115816u, +1745947263u, 2213925887u, 1836572741u, 2417722792u, +636223705u, 2423329294u, 3960951311u, 1543591052u, +1547914361u, +2760945653u, +3519014111u, 313543871u, 4119598884u, 1071003714u, +2192556597u, 1526995535u, 3929839778u, 536388591u, +3040873792u, +3752682932u, +1640614237u, 2432794021u, 385337403u, 2794410617u, +2386128075u, 1055206708u, 1422747714u, 3759330929u, +2533597496u, +30440955u, +1482899460u, 3350385050u, 616259409u, 3980103795u, +1211364140u, 1040071544u, 594746920u, 1645973936u, +2547331531u, +1097726368u, +700666526u, 2976247482u, 1144906608u, 996506677u, +1997130756u, 800321417u, 1392942823u, 1601662248u, +2079778663u, +529512908u, +2925120134u, 4106433085u, 630221833u, 2423086156u, +1119859778u, 1726827981u, 1870859181u, 2559832707u, +1792284257u, +2059356387u, +3572353364u, 3229407475u, 575621095u, 3221893291u, +2372428048u, 2020123035u, 961449593u, 2243824063u, +3803906611u, +3735348189u, +2981620804u, 4180681078u, 1555330629u, 230736535u, +2075526640u, 749652975u, 713664372u, 2152096659u, +2142067223u, +3322302242u, +1421646830u, 2092832615u, 1213735101u, 3192136753u, +1106723940u, 3455398230u, 2541685524u, 2529956739u, +3789430647u, +1950084508u, +2157395621u, 850457360u, 2758902426u, 2848030169u, +6506379u, 1162213157u, 2981459221u, 272690871u, +3059420255u, +4242691285u, +588065598u, 1206949936u, 3968214184u, 566348532u, +126142880u, 1480567086u, 2959621988u, 2050218418u, +2242731195u, +3833514449u, +1898070331u, 3687399477u, 3891859374u, 868185955u, +2335308774u, 3676335246u, 3871121805u, 2189032743u, +3275728647u, +860492892u, +1590764344u, 4130384758u, 262871548u, 3004764525u, +2685542071u, 991231482u, 435122019u, 3031116998u, +2898921700u, +2917932604u, +4238665148u, 2459072654u, 3444612545u, 4207731740u, +1808564313u, 2798532269u, 3944553556u, 3926395409u, +1633200670u, +4138335224u, +2524878605u, 4184292650u, 3563398268u, 4288943552u, +3802121210u, 957502058u, 2410820887u, 4227117506u, +4018625153u, +4284329158u, +530216712u, 2978986531u, 863452221u, 1910162118u, +4088211378u, 4091971261u, 3150811451u, 4200871487u, +3794038652u, +3041564310u, +2045287082u, 887805614u, 2889167251u, 4120352181u, +1699912580u, 3478922097u, 3211994687u, 3136177842u, +1500806861u, +3211881347u, +2147976385u, 3342722260u, 3359650541u, 4197378460u, +781354073u, 1533623029u, 2204677828u, 3228172832u, +3248592437u, +3355841359u, +560815159u, 1144951236u, 4027015711u, 2882625391u, +339363613u, 2354572719u, 1769831876u, 4238589331u, +1519732871u, +2185834614u, +1601096831u, 129709881u, 39655633u, 367604993u, +1737681770u, 3259114599u, 2767070452u, 872365177u, +1574125529u, +3405020189u, +4181346685u, 1134030380u, 403769171u, 2193351164u, +1426232618u, 2885309450u, 3033612627u, 924948363u, +935514094u, +3202053329u, +912294839u, 1618472324u, 4159158431u, 3744999487u, +777064358u, 3974213124u, 1990246048u, 309725290u, +2449849392u, +1943692420u, +2288635750u, 2433793635u, 2168904061u, 683315308u, +3081493019u, 3477759434u, 3815496269u, 2823504699u, +586945121u, +3088963200u, +3492287335u, 636875049u, 1111206944u, 2037346120u, +1282050044u, 1409681512u, 1786128584u, 755810950u, +2332676758u, +2178142310u, +957827166u, 1014983590u, 1888800725u, 3608595803u, +3200072714u, 2534008478u, 659336139u, 1281728287u, +4060560529u, +2915575125u, +3521503774u, 2926487340u, 1096297674u, 653489861u, +2352326980u, 2561136777u, 1224141198u, 1250479629u, +1297625391u, +2409997371u, +1942483722u, 2481835750u, 1394715707u, 1673070941u, +2456039704u, 3980558014u, 3547934764u, 1882038812u, +1078160498u, +2488279087u, +1848235245u, 1211914722u, 2264928765u, 2807773070u, +270145554u, 583747883u, 3826009010u, 2996618216u, +425727157u, +992726957u, +3384462280u, 726650661u, 1955043265u, 1923879512u, +1854693773u, 2987614542u, 2660044993u, 2457260810u, +426299370u, +2671892900u, +1827308087u, 3083953443u, 1791749638u, 3265087416u, +2119752201u, 2547122538u, 3990783236u, 1912713468u, +3688865211u, +1815780016u, +303699291u, 2416763742u, 2690891610u, 1535193548u, +1107803989u, 1504143133u, 2235270371u, 2545884083u, +2276278682u, +411724404u, +3416925704u, 2565792091u, 3383911757u, 546058824u, +3374654444u, 2364630415u, 2693473470u, 2622125691u, +261864817u, +55682470u, +857617568u, 141304067u, 1885488541u, 155368182u, +1281949051u, 3384522408u, 3254816901u, 1959816782u, +1452224057u, +2830267691u, +3709231247u, 58988202u, 4218130458u, 2984061349u, +1888707848u, 4223605071u, 4241442486u, 375269213u, +3208327038u, +2199916493u, +550337252u, 2855061437u, 276088636u, 114362204u, +2321163647u, 2127813633u, 3289403024u, 2686973202u, +2717376797u, +3593428039u, +3648831666u, 890925902u, 3289404818u, 3289516821u, +4248913260u, 1858916580u, 3303932308u, 1752797086u, +1628149686u, +3245893605u, +1568537311u, 2844194502u, 1593855770u, 2408174109u, +124797514u, 2085649512u, 3188565660u, 2264996276u, +1926696513u, +3053957740u, +2238806881u, 2189050973u, 203685243u, 379855590u, +3920271562u, 1058600179u, 3698061923u, 4255106849u, +608401664u, +1598041932u, +3318266418u, 2535016555u, 852760884u, 1918098822u, +2200437599u, 1532285043u, 3425662132u, 3561293706u, +2231633206u, +4108785088u, +3359152801u, 173534780u, 208383607u, 2862988169u, +2406642243u, 426814583u, 2777335795u, 3322703596u, +954190623u, +615093090u, +4179102978u, 2452847930u, 100239619u, 42471741u, +818352432u, 2190624654u, 504379960u, 3631619975u, +633412456u, +1018421783u, +842645419u, 711808707u, 3424580813u, 2132457941u, +1158335882u, 3567952480u, 2302183699u, 1145788151u, +3474264138u, +3105085243u, +3115506027u, 2783713015u, 3871785309u, 539583269u, +1400252405u, 3857849984u, 4231186588u, 1278653799u, +1760227022u, +761044088u, +3838185417u, 2439542532u, 585283357u, 2055995220u, +937117124u, 3831944855u, 1823586038u, 3287917855u, +485082427u, +3209172809u, +1984570176u, 2818337297u, 2691869057u, 3790476953u, +839035557u, 3203129010u, 669981176u, 4121157385u, +3519870450u, +3792633352u, +3017650322u, 1603459507u, 4225677666u, 376555451u, +473780127u, 2018786277u, 3299822439u, 1010254499u, +2383887565u, +3155009499u, +3108110655u, 2641738274u, 3684908622u, 1606463047u, +3311068174u, 52708046u, 754181455u, 1018079176u, +3915670272u, +3366999425u, +1012880204u, 1339439715u, 466437962u, 1402662350u, +2504046911u, 736323938u, 2037800124u, 1725908589u, +716341840u, +1750123474u, +3366342464u, 1743666195u, 2975303189u, 3821364027u, +3253707772u, 3635548377u, 3840413796u, 1955642085u, +1018315169u, +1258092848u, +2095540656u, 1076256607u, 117289557u, 1311658655u, +2118301000u, 68721550u, 2886814107u, 2712432819u, +4201862886u, +753807148u, +1940229047u, 731347296u, 1068901393u, 3873155894u, +2852787666u, 1973464853u, 79735652u, 3966380587u, +3245740712u, +2525773438u, +734938109u, 3045656416u, 3335746354u, 4099732691u, +1911896517u, 1697006473u, 1145487066u, 1605663299u, +3053606724u, +2386289465u, +3821211369u, 1006215345u, 1256304829u, 1053001668u, +1289194958u, 118761054u, 1853688730u, 2803418011u, +188650809u, +3763686458u, +1006829556u, 2961984133u, 3390525025u, 2061199893u, +141792681u, 2439893463u, 2652982650u, 1804942682u, +1546510005u, +1246961405u, +2407577046u, 565772575u, 3751844810u, 2943166103u, +3750052451u, 3022527280u, 25162928u, 397381043u, +1818337632u, +3447363730u, +3936437150u, 2569420703u, 2215592390u, 2171555672u, +3665571006u, 4021712412u, 2939158353u, 4057813172u, +1823237318u, +103999245u, +3251978010u, 3591914940u, 3582495283u, 2519035265u, +3905726135u, 3180393349u, 2743117123u, 55247368u, +3325286701u, +705195946u, +1857526853u, 1480518550u, 3809990433u, 1398189338u, +3126362926u, 3959531492u, 1503658285u, 1977847740u, +3043964489u, +2613086143u, +1518119282u, 4238434900u, 3905746486u, 3064949667u, +1028122931u, 3309119457u, 4071194920u, 3096098907u, +4137180520u, +494467959u, +1231408687u, 1691606157u, 1793452569u, 2722196118u, +3478603952u, 1059665738u, 2282032278u, 3990268388u, +1719514651u, +4248311578u, +3799146721u, 898026304u, 3367808954u, 4162472815u, +170495870u, 1308116609u, 3428285344u, 1714716475u, +395576794u, +4153638621u, +2999745812u, 3483315953u, 304980828u, 595337120u, +3486516729u, 2331563143u, 2583609459u, 1885928417u, +3834283777u, +979337825u, +932057378u, 3124081189u, 1930356777u, 3865887996u, +4178282217u, 4214219408u, 3669465884u, 1472413856u, +3356866587u, +1012769806u, +3043639963u, 996996396u, 207308216u, 982967331u, +2991319933u, 318066902u, 721489670u, 1249967713u, +749240921u, +591392325u, +2379365192u, 2250868849u, 2163259329u, 143191325u, +3778285606u, 982149096u, 3536906200u, 2244353244u, +1443862317u, +3161549210u, +2183127464u, 2015409516u, 547003700u, 2032484282u, +523677821u, 4275663308u, 3827205526u, 3903778273u, +2444530525u, +2543645801u, +1173958423u, 784740616u, 2878693675u, 3127696736u, +3832037316u, 3161002398u, 4084166400u, 4213346853u, +223390424u, +4273380883u, +2130315482u, 3429606032u, 3367732613u, 1912357694u, +422632590u, 1266957023u, 3437535648u, 736404240u, +2281709372u, +415859912u, +212948797u, 351612650u, 3920561440u, 112963586u, +2230727543u, 2851076612u, 1990662634u, 2264296857u, +3131463650u, +2704034623u, +3541637839u, 2954232792u, 533986918u, 4158757533u, +65174248u, 4232639593u, 865906667u, 1948225652u, +779656112u, +3873989249u, +2372984749u, 2346988193u, 1104345713u, 1165654138u, +4045762610u, 3588205178u, 461363991u, 1111215752u, +1389675192u, +2404325151u, +2152228101u, 3808973622u, 1901235912u, 3458690696u, +314513238u, 2539459143u, 2847998873u, 952026138u, +2325705328u, +407844712u, +3727960715u, 2996448351u, 2374336760u, 3138756390u, +2600015243u, 539980418u, 1876285352u, 1670330799u, +1709360377u, +2868531654u, +494777964u, 2773053597u, 599486162u, 3962209577u, +1871328846u, 2171933018u, 110279472u, 384074780u, +4147021936u, +2333589647u, +4251778066u, 40493468u, 3099342316u, 4108779767u, +2812424588u, 954542332u, 2040682331u, 2251152306u, +45915516u, +259525626u, +1045384743u, 4134656562u, 749389261u, 874399445u, +616549904u, 2200447504u, 436024539u, 78972290u, +3210485762u, +1907985531u, +3013721395u, 4214533685u, 4198804243u, 534879265u, +1517190881u, 3756787754u, 1152563554u, 1718750948u, +777737463u, +1402478860u, +1824562784u, 1879401449u, 3515818786u, 513165201u, +1423491227u, 2103067918u, 2291777410u, 1097943000u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashcc::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashcc::Hash32(data, len++)); { uint128_t u = farmhashcc::Fingerprint128(data, len++); uint64_t h = Uint128Low64(u); IsAlive(h >> 32); IsAlive((h << 32) >> 32); h = Uint128High64(u); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +Check(farmhashcc::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashcc::Hash32(data + offset, len)); +{ uint128_t u = farmhashcc::Fingerprint128(data + offset, len); uint64_t h = Uint128Low64(u); Check(h >> 32); Check((h << 32) >> 32); h = Uint128High64(u); Check(h >> 32); Check((h << 32) >> 32); } +{ uint128_t u = farmhashcc::CityHash128WithSeed(data + offset, len, Uint128(SEED0, SEED1)); uint64_t h = Uint128Low64(u); Check(h >> 32); Check((h << 32) >> 32); h = Uint128High64(u); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashccTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashcc::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashcc::Hash32(data + offset, len) << "u," << endl; +{ uint128_t u = farmhashcc::Fingerprint128(data + offset, len); uint64_t h = Uint128Low64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u, "; h = Uint128High64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint128_t u = farmhashcc::CityHash128WithSeed(data + offset, len, Uint128(SEED0, SEED1)); uint64_t h = Uint128Low64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u, "; h = Uint128High64(u); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashccTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashccTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashccTest::Dump(0, i); + } + farmhashccTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashmkTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +4223616069u, +3696677242u, +4081014168u, +2576519988u, +2212771159u, +1112731063u, +1020067935u, +3955445564u, +1451961420u, +653440099u, +31917516u, +2957164615u, +2590087362u, +3879448744u, +176305566u, +2447367541u, +1359016305u, +3363804638u, +1117290165u, +1062549743u, +2437877004u, +1894455839u, +673206794u, +3486923651u, +3269862919u, +2303349487u, +1380660650u, +595525107u, +1525325287u, +2025609358u, +176408838u, +1592885012u, +864896482u, +2101378090u, +3489229104u, +2118965695u, +581644891u, +2718789079u, +631613207u, +4228658372u, +3867875546u, +3531368319u, +3804516756u, +3317755099u, +1619744564u, +2884717286u, +1088213445u, +2667691076u, +3727873235u, +2330406762u, +3616470388u, +967660719u, +4148162586u, +315219121u, +673084328u, +3047602355u, +1598963653u, +1267826661u, +2117362589u, +2861192253u, +1823625377u, +1380350078u, +1641748342u, +1176094482u, +269384321u, +2178982315u, +3480237248u, +2660755208u, +1850544433u, +3429699438u, +1262819303u, +640556464u, +2421125401u, +2188368608u, +2612932825u, +1474432581u, +173790449u, +2124882189u, +831272654u, +622960146u, +4238751051u, +3250317967u, +2120810248u, +1948231495u, +1389029321u, +2200398357u, +2134232963u, +2948072329u, +617717625u, +681164587u, +114859387u, +430545646u, +57239089u, +3163338012u, +3482496399u, +557662576u, +1102441413u, +2670159360u, +991116729u, +846014240u, +4233741566u, +1802317242u, +3129528802u, +1459456375u, +1305643039u, +3258671612u, +1578285833u, +868590079u, +1631034517u, +1695432937u, +561078856u, +1004115553u, +3086090507u, +3818348650u, +731596645u, +780926790u, +2544205955u, +158479164u, +3983514188u, +2004735250u, +3436218400u, +673684751u, +1463431419u, +2880490219u, +3223748024u, +2218318859u, +1474466194u, +2636437533u, +2206794961u, +140995728u, +1186394086u, +1805716888u, +1640037724u, +3942729099u, +1944727013u, +918951560u, +498666871u, +3486974657u, +2967205462u, +1167253804u, +1884281041u, +2866015002u, +4158319270u, +2627220079u, +3733319624u, +3317092271u, +438323662u, +3195868065u, +3426606709u, +360708338u, +1905491012u, +650004803u, +1351266252u, +3133279000u, +3722811115u, +2722412434u, +918432408u, +3678271248u, +269599647u, +621514057u, +3117077855u, +1545425390u, +2597567410u, +1221437820u, +3493254589u, +102787342u, +918861168u, +348795089u, +3439883229u, +2353641807u, +2209585469u, +4035884492u, +2686995435u, +1649888022u, +3852893848u, +3042700028u, +314103172u, +726977769u, +2489830276u, +2872753660u, +1316214989u, +1488801501u, +1811420390u, +639581627u, +2362837215u, +3634581834u, +3648576802u, +1257314182u, +762118371u, +4268447045u, +730167096u, +755561509u, +882614845u, +3696972894u, +228263661u, +1478636142u, +2767751651u, +1532617116u, +3838657661u, +1944359935u, +1401102137u, +3772933173u, +1050098254u, +1658079354u, +1846025728u, +2204244794u, +2017217424u, +1275162853u, +1429816745u, +2175565479u, +1716109139u, +1187506761u, +2434641075u, +2725597783u, +1795687662u, +1393312782u, +3511565397u, +627885430u, +4145733164u, +2519005353u, +231414775u, +1242015635u, +2760723497u, +2185540568u, +727314436u, +2358790354u, +1186393454u, +4234795645u, +350567813u, +866773875u, +3145590392u, +1158374055u, +3903123687u, +1862119793u, +2204587556u, +4266276976u, +4151548555u, +915250402u, +2874695320u, +2360311410u, +1099212769u, +1271542714u, +3473148363u, +1637325418u, +1807795989u, +2493819794u, +3800917924u, +4001205856u, +2582153621u, +3365872040u, +2890146216u, +2626363824u, +3133351295u, +4046827296u, +3053118771u, +4113026751u, +884356716u, +3828347401u, +10608262u, +830987972u, +1841080500u, +3202717763u, +3561778749u, +1906000052u, +3058284660u, +1432904514u, +2567431677u, +2550162530u, +665557986u, +936887821u, +2101205308u, +4253535847u, +1662043545u, +1253611611u, +2091370094u, +2635077370u, +2602176041u, +3624115809u, +748442714u, +2709749154u, +1023493343u, +860291012u, +3924715584u, +1536436740u, +2551145800u, +2391782865u, +1467705048u, +2583909796u, +3616666170u, +1162857372u, +4228631071u, +1510132376u, +2739165009u, +2656606142u, +3454996358u, +3155038853u, +1022087316u, +100044110u, +494208296u, +2746186477u, +4216782431u, +225448834u, +3728320521u, +335282866u, +3148194874u, +953503703u, +1293353960u, +202372387u, +1326119870u, +4045123735u, +3819994846u, +1629004186u, +1081099186u, +3591584153u, +1670825804u, +3404257979u, +3262192301u, +2572846095u, +3714992543u, +4264142572u, +529616678u, +2882154574u, +3006354178u, +3865969421u, +2007174907u, +308283107u, +2629833703u, +3159124075u, +1146492131u, +494104332u, +493149727u, +1342910585u, +521642387u, +2201695937u, +2517980959u, +2426821287u, +777374655u, +2228189792u, +4027055486u, +228976000u, +3842083468u, +1723920223u, +1192126094u, +787744493u, +2740368380u, +2284153001u, +2773829458u, +442000614u, +387830783u, +2169780670u, +2253144627u, +3532502484u, +1969684059u, +1165351416u, +3055056536u, +3582324253u, +231419363u, +770979865u, +3213983597u, +3690452836u, +935794639u, +3230602762u, +2841762457u, +407598927u, +1164479891u, +3721799696u, +354738136u, +1801566618u, +3206038542u, +2621379981u, +1943487262u, +3534745636u, +1074424589u, +1304517521u, +4133400969u, +2339317978u, +2135116860u, +4180643791u, +2415309340u, +1855926417u, +3418648630u, +1968113037u, +597304222u, +3668824865u, +3810008716u, +3014702569u, +3151212026u, +156057449u, +373134533u, +2068234004u, +191580563u, +3832754488u, +2924104199u, +2026044494u, +4065780435u, +122565840u, +4194985167u, +2744823717u, +2494098735u, +3753793370u, +1885739217u, +2488161225u, +3643797615u, +2653367310u, +2494061477u, +189968132u, +899646597u, +392100396u, +4012318310u, +3855777086u, +3566860954u, +2698574996u, +2414249905u, +1330623339u, +1263222732u, +1277741760u, +2194959402u, +1629656136u, +120494320u, +1072368005u, +1084245077u, +4011372748u, +1366613353u, +3108643228u, +3332219532u, +2114746095u, +3964007334u, +371687128u, +1084813876u, +126459896u, +4292782331u, +321283184u, +398168499u, +3604983506u, +560701543u, +2073961354u, +4240841868u, +4151211362u, +1338986875u, +4093476832u, +2269279497u, +3500846299u, +2510225147u, +598000444u, +1330391422u, +1432533385u, +4171226231u, +426821154u, +2932270996u, +3378981077u, +2217871549u, +1619647984u, +4051608043u, +3180237819u, +12919578u, +1375401767u, +371320427u, +2986640571u, +2336669859u, +3796464715u, +1892383284u, +306814912u, +2125823211u, +1863678891u, +3249703818u, +3840225752u, +281579900u, +264680257u, +4266359110u, +4182229890u, +2239659703u, +3627947372u, +2373929191u, +224082765u, +4053639058u, +1862360303u, +3187739624u, +3392706679u, +948039509u, +817505760u, +1215842393u, +3462222651u, +536021853u, +182346832u, +2731944883u, +2346674384u, +2640961678u, +3446695687u, +2271722179u, +1301069656u, +2803881468u, +2832614405u, +1691544398u, +698756814u, +3980620906u, +3565421410u, +754769376u, +4115923404u, +3909962218u, +2747614077u, +2888289845u, +1016920862u, +2790946178u, +3067070960u, +3173251481u, +1572132982u, +255048203u, +2996538818u, +3405398987u, +136106013u, +3581605228u, +4277437977u, +2147300534u, +3728426265u, +3483629996u, +1478452694u, +20756076u, +2774992067u, +432987927u, +1516771026u, +3511588664u, +2130994978u, +509385406u, +873090347u, +2163904107u, +4192239086u, +2532489989u, +1090772651u, +3910797408u, +3710882132u, +155010959u, +1369823531u, +1599664937u, +4035593587u, +1212746925u, +795822552u, +116689518u, +3674240941u, +1135576664u, +756750261u, +1027431362u, +390555140u, +2228460216u, +1506940482u, +3733857700u, +3048762971u, +2511703196u, +548609887u, +1607354252u, +659053982u, +259884450u, +1793130460u, +4083364495u, +3148555881u, +1764350138u, +2436485683u, +4031563025u, +3261860724u, +2475833430u, +2101726086u, +3191176464u, +2646658847u, +2127042126u, +771316100u, +2115922959u, +3208515045u, +2355437783u, +3621147793u, +1580163615u, +3211555675u, +3299188490u, +191613920u, +466733956u, +2939029038u, +1509152039u, +130591314u, +1892874677u, +1646908044u, +3452406523u, +3998376606u, +1199243832u, +2187108812u, +3189230066u, +4161151481u, +3371454980u, +3681788646u, +180842187u, +3685022399u, +3058749895u, +3250165163u, +2895367943u, +2627101723u, +771755098u, +1332921024u, +3638871848u, +514215135u, +3591227378u, +2300310870u, +3689533503u, +851607114u, +114330368u, +2709027386u, +1743034877u, +1013693860u, +288169008u, +3545190686u, +1052165084u, +3995862307u, +96902755u, +1097819851u, +2645431442u, +2184148618u, +2151206566u, +350979797u, +3467920900u, +421116779u, +1246252u, +4057835428u, +329324407u, +4104482417u, +844624570u, +3306265806u, +3787625025u, +4263241191u, +3251413927u, +2921204431u, +2931915325u, +992134330u, +3986338354u, +1327895216u, +1458363596u, +1480608532u, +728594368u, +3804366693u, +794404223u, +1643240863u, +793417255u, +4167916443u, +2683488959u, +3124925324u, +4184843652u, +3750971752u, +308509829u, +1054550805u, +2797511972u, +4043123412u, +1587158240u, +4050518606u, +3030062190u, +2589912753u, +603440067u, +937013191u, +1071662315u, +2100661456u, +2602005741u, +435516078u, +2260470147u, +1256268350u, +3612035u, +3368856141u, +151516099u, +3081868591u, +3363755681u, +2049963149u, +2885320434u, +84682005u, +2411758308u, +2695174275u, +3099904644u, +1787308684u, +1132379308u, +564634346u, +510236510u, +2804443681u, +3931864252u, +2064427949u, +1893979229u, +2916544974u, +1885887717u, +2978018250u, +494192125u, +2642662373u, +901112508u, +636035003u, +1658643797u, +172746975u, +517504890u, +3440019372u, +4144498044u, +1854755456u, +3672653905u, +4176892856u, +382159097u, +282871690u, +3629300472u, +2500754041u, +1677659759u, +1067175061u, +161654075u, +1672575536u, +346120493u, +2730229631u, +203466442u, +1244549529u, +199761971u, +2744895408u, +3195315331u, +2124618519u, +3261045496u, +985339699u, +3385585455u, +1545740710u, +3636652160u, +2167020081u, +1207897204u, +28752417u, +2895834146u, +3640845375u, +3750293073u, +548997850u, +4207814196u, +4183030708u, +2462810989u, +3929965401u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashmk::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashmk::Hash32(data, len++)); IsAlive(farmhashmk::Hash32(data, len++)); len -= 3; return alive > 0; } +Check(farmhashmk::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashmk::Hash32(data + offset, len)); + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashmkTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashmk::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashmk::Hash32(data + offset, len) << "u," << endl; +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashmkTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashmkTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashmkTest::Dump(0, i); + } + farmhashmkTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashnaTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +1140953930u, 861465670u, +3277735313u, 2681724312u, +2598464059u, 797982799u, +890626835u, 800175912u, +2603993599u, 921001710u, +1410420968u, 2134990486u, +3283896453u, 1867689945u, +2914424215u, 2244477846u, +255297188u, 2992121793u, +1110588164u, 4186314283u, +161451183u, 3943596029u, +4019337850u, 452431531u, +283198166u, 2741341286u, +3379021470u, 2557197665u, +299850021u, 2532580744u, +452473466u, 1706958772u, +1298374911u, 3099673830u, +2199864459u, 3696623795u, +236935126u, 2976578695u, +4055299123u, 3281581178u, +1053458494u, 1882212500u, +2305012065u, 2169731866u, +3456121707u, 275903667u, +458884671u, 3033004529u, +3058973506u, 2379411653u, +1898235244u, 1402319660u, +2700149065u, 2699376854u, +147814787u, 720739346u, +2433714046u, 4222949502u, +4220361840u, 1712034059u, +3425469811u, 3690733394u, +4148372108u, 1330324210u, +594028478u, 2921867846u, +1635026870u, 192883107u, +780716741u, 1728752234u, +3280331829u, 326029180u, +3969463346u, 1436364519u, +393215742u, 3349570000u, +3824583307u, 1612122221u, +2859809759u, 3808705738u, +1379537552u, 1646032583u, +2233466664u, 1432476832u, +4023053163u, 2650381482u, +2052294713u, 3552092450u, +1628777059u, 1499109081u, +3476440786u, 3829307897u, +2960536756u, 1554038301u, +1145519619u, 3190844552u, +2902102606u, 3600725550u, +237495366u, 540224401u, +65721842u, 489963606u, +1448662590u, 397635823u, +1596489240u, 1562872448u, +1790705123u, 2128624475u, +180854224u, 2604346966u, +1435705557u, 1262831810u, +155445229u, 1672724608u, +1669465176u, 1341975128u, +663607706u, 2077310004u, +3610042449u, 1911523866u, +1043692997u, 1454396064u, +2563776023u, 294527927u, +1099072299u, 1389770549u, +703505868u, 678706990u, +2952353448u, 2026137563u, +3603803785u, 629449419u, +1933894405u, 3043213226u, +226132789u, 2489287368u, +1552847036u, 645684964u, +3828089804u, 3632594520u, +187883449u, 230403464u, +3151491850u, 3272648435u, +3729087873u, 1303930448u, +2002861219u, 165370827u, +916494250u, 1230085527u, +3103338579u, 3064290191u, +3807265751u, 3628174014u, +231181488u, 851743255u, +2295806711u, 1781190011u, +2988893883u, 1554380634u, +1142264800u, 3667013118u, +1968445277u, 315203929u, +2638023604u, 2290487377u, +732137533u, 1909203251u, +440398219u, 1891630171u, +1380301172u, 1498556724u, +4072067757u, 4165088768u, +4204318635u, 441430649u, +3931792696u, 197618179u, +956300927u, 914413116u, +3010839769u, 2837339569u, +2148126371u, 1913303225u, +3074915312u, 3117299654u, +4139181436u, 2993479124u, +3178848746u, 1357272220u, +1438494951u, 507436733u, +667183474u, 2084369203u, +3854939912u, 1413396341u, +126024219u, 146044391u, +1016656857u, 3022024459u, +3254014218u, 429095991u, +165589978u, 1578546616u, +985653208u, 1718653828u, +623071693u, 366414107u, +249776086u, 1207522198u, +3047342438u, 2991127487u, +3120876698u, 1684583131u, +46987739u, 1157614300u, +863214540u, 1087193030u, +199124911u, 520792961u, +3614377032u, 586863115u, +3331828431u, 1013201099u, +1716848157u, 4033596884u, +1164298657u, 4140791139u, +1146169032u, 1434258493u, +3824360466u, 3242407770u, +3725511003u, 232064808u, +872586426u, 762243036u, +2736953692u, 816692935u, +512845449u, 3748861010u, +2266795890u, 3781899767u, +4290630595u, 517646945u, +22638523u, 648000590u, +959214578u, 558910384u, +1283799121u, 3047062993u, +1024246061u, 4027776454u, +3544509313u, 622325861u, +834785312u, 382936554u, +411505255u, 1973395102u, +1825135056u, 2725923798u, +580988377u, 2826990641u, +3474970689u, 1029055034u, +812546227u, 2506885666u, +2584372201u, 1758123094u, +589567754u, 325737734u, +345313518u, 2022370576u, +3886113119u, 3338548567u, +257578986u, 3698087965u, +1776047957u, 1771384107u, +3604937815u, 3198590202u, +2305332220u, 191910725u, +4232136669u, 427759438u, +4244322689u, 542201663u, +3315355162u, 2135941665u, +556609672u, 45845311u, +1175961330u, 3948351189u, +23075771u, 3252374102u, +1634635545u, 4151937410u, +713127376u, 1467786451u, +663013031u, 3444053918u, +2638154051u, 810082938u, +3077742128u, 1062268187u, +2115441882u, 4081398201u, +3735739145u, 2794294783u, +2335576331u, 2560479831u, +1379288194u, 4225182569u, +2442302747u, 3948961926u, +3958366652u, 3067277639u, +3667516477u, 1709989541u, +1516711748u, 2339636583u, +4188504038u, 59581167u, +2725013602u, 3639843023u, +2658147000u, 2643979752u, +3758739543u, 4189944477u, +2470483982u, 877580602u, +2995362413u, 118817200u, +3252925478u, 2062343506u, +3981838403u, 3762572073u, +1231633714u, 4168280671u, +2931588131u, 3284356565u, +1129162571u, 732225574u, +4173605289u, 1407328702u, +1677744031u, 3532596884u, +3232041815u, 1652884780u, +2256541290u, 3459463480u, +3740979556u, 259034107u, +2227121257u, 1426140634u, +3606709555u, 3424793077u, +315836068u, 3200749877u, +1386256573u, 24035717u, +2982018998u, 1811050648u, +234531934u, 1115203611u, +1598686658u, 3146815575u, +1603559457u, 323296368u, +2632963283u, 1778459926u, +739944537u, 579625482u, +3486330348u, 492621815u, +1231665285u, 2457048126u, +3903349120u, 389846205u, +3355404249u, 3275550588u, +1052645068u, 862072556u, +2834153464u, 1481069623u, +2657392572u, 4279236653u, +1688445808u, 701920051u, +3740748788u, 3388062747u, +1873358321u, 2152785640u, +883382081u, 1005815394u, +1020177209u, 734239551u, +2371453141u, 100326520u, +3488500412u, 1279682138u, +2610427744u, 49703572u, +3026361211u, 605900428u, +302392721u, 2509302188u, +1416453607u, 2815915291u, +1862819968u, 519710058u, +2450888314u, 4017598378u, +937074653u, 3035635454u, +1590230729u, 3268013438u, +2710029305u, 12886044u, +3711259084u, 2627383582u, +3895772404u, 648534979u, +260307902u, 855990313u, +3669691805u, 263366740u, +2938543471u, 414331688u, +3080542944u, 3405007814u, +3565059103u, 1190977418u, +390836981u, 1606450012u, +2649808239u, 2514169310u, +2747519432u, 4129538640u, +1721522849u, 492099164u, +792990594u, 3625507637u, +2271095827u, 2993032712u, +2302363854u, 4013112951u, +1111617969u, 2183845740u, +795918276u, 1116991810u, +3110898804u, 3963062126u, +2737064702u, 462795667u, +937372240u, 1343017609u, +1091041189u, 2790555455u, +277024217u, 25485284u, +1166522068u, 1623631848u, +241727183u, 2836158787u, +3112996740u, 573836428u, +2721658101u, 1937681565u, +4175169209u, 3190765433u, +1970000788u, 1668258120u, +114616703u, 954762543u, +199237753u, 4094644498u, +2522281978u, 732086117u, +1756889687u, 2936126607u, +2437031370u, 4103143808u, +3883389541u, 3171090854u, +2483004780u, 1927385370u, +2360538162u, 2740855009u, +4241185118u, 1492209542u, +1672737098u, 2148675559u, +1789864670u, 2434313103u, +2319172611u, 2760941207u, +2636210123u, 1338083267u, +1128080590u, 822806371u, +1199583556u, 314727461u, +1335160250u, 2084630531u, +1156261526u, 316766066u, +112090465u, 3129033323u, +2746885618u, 636616055u, +2582210744u, 1721064910u, +3468394263u, 470463518u, +2076016059u, 408721884u, +2121041886u, 378460278u, +1915948002u, 357324860u, +2301682622u, 2691859523u, +1869756364u, 2429314418u, +2193146527u, 1185564327u, +2614088922u, 1975527044u, +919067651u, 2855948894u, +3662539576u, 1943802836u, +3529473373u, 1490330107u, +366036094u, 3384241033u, +4276268604u, 448403661u, +4271796078u, 1910401882u, +3077107698u, 299427366u, +2035665349u, 3201262636u, +3738454258u, 2554452696u, +3588997135u, 3363895827u, +1267505995u, 1852004679u, +2237827073u, 2803250686u, +3468044908u, 2143572850u, +1728158656u, 1022551180u, +1996680960u, 839529273u, +2400647871u, 2201096054u, +3606433628u, 2597259793u, +3544595875u, 3909443124u, +819278607u, 3447346709u, +806136613u, 2711436388u, +3656063205u, 837475154u, +694525336u, 4070212073u, +4011303412u, 1068395209u, +438095290u, 484603494u, +2673730227u, 737767009u, +642310823u, 3914002299u, +308425103u, 268427550u, +1334387085u, 4069797497u, +4280783219u, 2914011058u, +4243643405u, 2849988118u, +2504230175u, 1817156623u, +2804200483u, 3406991497u, +2948254999u, 2102063419u, +1071272117u, 514889942u, +571972433u, 1246595599u, +1735616066u, 1539151988u, +1230831543u, 277987182u, +4269526481u, 991511607u, +95237878u, 2005032160u, +1291113144u, 626619670u, +3560835907u, 164940926u, +1433635018u, 116647396u, +3039097112u, 2868163232u, +1141645918u, 1764165478u, +881378302u, 2159170082u, +2953647681u, 1011320066u, +184856151u, 1723308975u, +336034862u, 2017579106u, +1476681709u, 147523618u, +3896252223u, 2264728166u, +944743644u, 1694443528u, +2690700128u, 1947321519u, +735478508u, 4058183171u, +260177668u, 505662155u, +2391691262u, 1920739747u, +3216960415u, 1898176786u, +3722741628u, 1511077569u, +449636564u, 983350414u, +2580237367u, 2055059789u, +1103819072u, 2089123665u, +3873755579u, 2718467458u, +3124338704u, 3204250304u, +2475035432u, 1120017626u, +3873758287u, 1982999824u, +2950794582u, 780634378u, +2842141483u, 4029205195u, +1656892865u, 3330993377u, +80890710u, 1953796601u, +3873078673u, 136118734u, +2317676604u, 4199091610u, +1864448181u, 3063437608u, +1699452298u, 1403506686u, +1513069466u, 2348491299u, +4273657745u, 4055855649u, +1805475756u, 2562064338u, +973124563u, 4197091358u, +172861513u, 2858726767u, +4271866024u, 3071338162u, +3590386266u, 2328277259u, +1096050703u, 1189614342u, +459509140u, 771592405u, +817999971u, 3740825152u, +520400189u, 1941874618u, +185232757u, 4032960199u, +3928245258u, 3527721294u, +1301118856u, 752188080u, +3512945009u, 308584855u, +2105373972u, 752872278u, +3823368815u, 3760952096u, +4250142168u, 2565680167u, +3646354146u, 1259957455u, +1085857127u, 3471066607u, +38924274u, 3770488806u, +1083869477u, 3312508103u, +71956383u, 3738784936u, +3099963860u, 1255084262u, +4286969992u, 3621849251u, +1190908967u, 1831557743u, +2363435042u, 54945052u, +4059585566u, 4023974274u, +1788578453u, 3442180039u, +2534883189u, 2432427547u, +3909757989u, 731996369u, +4168347425u, 1356028512u, +2741583197u, 1280920000u, +312887059u, 3259015297u, +3946278527u, 4135481831u, +1281043691u, 1121403845u, +3312292477u, 1819941269u, +1741932545u, 3293015483u, +2127558730u, 713121337u, +2635469238u, 486003418u, +4015067527u, 2976737859u, +2108187161u, 927011680u, +1970188338u, 4177613234u, +1799789551u, 2118505126u, +4134691985u, 1958963937u, +1929210029u, 2555835851u, +2768832862u, 910892050u, +2567532373u, 4075249328u, +86689814u, 3726640307u, +1392137718u, 1240000030u, +4104757832u, 3026358429u, +313797689u, 1435798509u, +3101500919u, 1241665335u, +3573008472u, 3615577014u, +3767659003u, 3134294021u, +4063565523u, 2296824134u, +1541946015u, 3087190425u, +2693152531u, 2199672572u, +2123763822u, 1034244398u, +857839960u, 2515339233u, +2228007483u, 1628096047u, +2116502287u, 2502657424u, +2809830736u, 460237542u, +450205998u, 3646921704u, +3818199357u, 1808504491u, +1950698961u, 2069753399u, +3657033172u, 3734547671u, +4067859590u, 3292597295u, +1106466069u, 356742959u, +2469567432u, 3495418823u, +183440071u, 3248055817u, +3662626864u, 1750561299u, +3926138664u, 4088592524u, +567122118u, 3810297651u, +992181339u, 3384018814u, +3272124369u, 3177596743u, +320086295u, 2316548367u, +100741310u, 451656820u, +4086604273u, 3759628395u, +2553391092u, 1745659881u, +3650357479u, 2390172694u, +330172533u, 767377322u, +526742034u, 4102497288u, +2088767754u, 164402616u, +2482632320u, 2352347393u, +1873658044u, 3861555476u, +2751052984u, 1767810825u, +20037241u, 545143220u, +2594532522u, 472304191u, +3441135892u, 3323383489u, +258785117u, 2977745165u, +2781737565u, 2963590112u, +2756998822u, 207428029u, +2581558559u, 3824717027u, +1258619503u, 3472047571u, +2648427775u, 2360400900u, +2393763818u, 2332399088u, +3932701729u, 884421165u, +1396468647u, 1377764574u, +4061795938u, 1559119087u, +3343596838u, 3604258095u, +1435134775u, 1099809675u, +908163739u, 1418405656u, +368446627u, 3741651161u, +3374512975u, 3542220540u, +3244772570u, 200009340u, +3198975081u, 2521038253u, +4081637863u, 337070226u, +3235259030u, 3897262827u, +736956644u, 641040550u, +644850146u, 1306761320u, +4219448634u, 193750500u, +3293278106u, 1383997679u, +1242645122u, 4109252858u, +450747727u, 3716617561u, +362725793u, 2252520167u, +3377483696u, 1788337208u, +8130777u, 3226734120u, +759239140u, 1012411364u, +1658628529u, 2911512007u, +1002580201u, 1681898320u, +3039016929u, 4294520281u, +367022558u, 3071359622u, +3205848570u, 152989999u, +3839042136u, 2357687350u, +4273132307u, 3898950547u, +1176841812u, 1314157485u, +75443951u, 1027027239u, +1858986613u, 2040551642u, +36574105u, 2603059541u, +3456147251u, 2137668425u, +4077477194u, 3565689036u, +491832241u, 363703593u, +2579177168u, 3589545214u, +265993036u, 1864569342u, +4149035573u, 3189253455u, +1072259310u, 3153745937u, +923017956u, 490608221u, +855846773u, 845706553u, +1018226240u, 1604548872u, +3833372385u, 3287246572u, +2757959551u, 2452872151u, +1553870564u, 1713154780u, +2649450292u, 500120236u, +84251717u, 661869670u, +1444911517u, 2489716881u, +2810524030u, 1561519055u, +3884088359u, 2509890699u, +4247155916u, 1005636939u, +3224066062u, 2774151984u, +2035978240u, 2514910366u, +1478837908u, 3144450144u, +2107011431u, 96459446u, +3587732908u, 2389230590u, +3287635953u, 250533792u, +1235983679u, 4237425634u, +3704645833u, 3882376657u, +2976369049u, 1187061987u, +276949224u, 4100839753u, +1698347543u, 1629662314u, +1556151829u, 3784939568u, +427484362u, 4246879223u, +3155311770u, 4285163791u, +1693376813u, 124492786u, +1858777639u, 3476334357u, +1941442701u, 1121980173u, +3485932087u, 820852908u, +358032121u, 2511026735u, +1873607283u, 2556067450u, +2248275536u, 1528632094u, +1535473864u, 556796152u, +1499201704u, 1472623890u, +1526518503u, 3692729434u, +1476438092u, 2913077464u, +335109599u, 2167614601u, +4121131078u, 3158127917u, +3051522276u, 4046477658u, +2857717851u, 1863977403u, +1341023343u, 692059110u, +1802040304u, 990407433u, +3285847572u, 319814144u, +561105582u, 1540183799u, +4052924496u, 2926590471u, +2244539806u, 439121871u, +3317903224u, 3178387550u, +4265214507u, 82077489u, +1978918971u, 4279668976u, +128732476u, 2853224222u, +464407878u, 4190838199u, +997819001u, 3250520802u, +2330081301u, 4095846095u, +733509243u, 1583801700u, +722314527u, 3552883023u, +1403784280u, 432327540u, +1877837196u, 3912423882u, +505219998u, 696031431u, +908238873u, 4189387259u, +8759461u, 2540185277u, +3385159748u, 381355877u, +2519951681u, 1679786240u, +2019419351u, 4051584612u, +1933923923u, 3768201861u, +1670133081u, 3454981037u, +700836153u, 1675560450u, +371560700u, 338262316u, +847351840u, 2222395828u, +3130433948u, 405251683u, +3037574880u, 184098830u, +453340528u, 1385561439u, +2224044848u, 4071581802u, +1431235296u, 5570097u, +570114376u, 2287305551u, +2272418128u, 803575837u, +3943113491u, 414959787u, +708083137u, 2452657767u, +4019147902u, 3841480082u, +3791794715u, 2965956183u, +2763690963u, 2350937598u, +3424361375u, 779434428u, +1274947212u, 686105485u, +3426668051u, 3692865672u, +3057021940u, 2285701422u, +349809124u, 1379278508u, +3623750518u, 215970497u, +1783152480u, 823305654u, +216118434u, 1787189830u, +3692048450u, 2272612521u, +3032187389u, 4159715581u, +1388133148u, 1611772864u, +2544383526u, 552925303u, +3420960112u, 3198900547u, +3503230228u, 2603352423u, +2318375898u, 4064071435u, +3006227299u, 4194096960u, +1283392422u, 1510460996u, +174272138u, 3671038966u, +1775955687u, 1719108984u, +1763892006u, 1385029063u, +4083790740u, 406757708u, +684087286u, 531310503u, +3329923157u, 3492083607u, +1059031410u, 3037314475u, +3105682208u, 3382290593u, +2292208503u, 426380557u, +97373678u, 3842309471u, +777173623u, 3241407531u, +303065016u, 1477104583u, +4234905200u, 2512514774u, +2649684057u, 1397502982u, +1802596032u, 3973022223u, +2543566442u, 3139578968u, +3193669211u, 811750340u, +4013496209u, 567361887u, +4169410406u, 3622282782u, +3403136990u, 2540585554u, +895210040u, 3862229802u, +1145435213u, 4146963980u, +784952939u, 943914610u, +573034522u, 464420660u, +2356867109u, 3054347639u, +3985088434u, 1911188923u, +583391304u, 176468511u, +2990150068u, 2338031599u, +519948041u, 3181425568u, +496106033u, 4110294665u, +2736756930u, 1196757691u, +1089679033u, 240953857u, +3399092928u, 4040779538u, +2843673626u, 240495962u, +3017658263u, 3828377737u, +4243717901u, 2448373688u, +2759616657u, 2246245780u, +308018483u, 4262383425u, +2731780771u, 328023017u, +2884443148u, 841480070u, +3188015819u, 4051263539u, +2298178908u, 2944209234u, +1372958390u, 4164532914u, +4074952232u, 1683612329u, +2155036654u, 1872815858u, +2041174279u, 2368092311u, +206775997u, 2283918569u, +645945606u, 115406202u, +4206471368u, 3923500892u, +2217060665u, 350160869u, +706531239u, 2824302286u, +509981657u, 1469342315u, +140980u, 1891558063u, +164887091u, 3094962711u, +3437115622u, 13327420u, +422986366u, 330624974u, +3630863408u, 2425505046u, +824008515u, 3543885677u, +918718096u, 376390582u, +3224043675u, 3724791476u, +1837192976u, 2968738516u, +3424344721u, 3187805406u, +1550978788u, 1743089918u, +4251270061u, 645016762u, +3855037968u, 1928519266u, +1373803416u, 2289007286u, +1889218686u, 1610271373u, +3059200728u, 2108753646u, +582042641u, 812347242u, +3188172418u, 191994904u, +1343511943u, 2247006571u, +463291708u, 2697254095u, +1534175504u, 1106275740u, +622521957u, 917121602u, +4095777215u, 3955972648u, +3852234638u, 2845309942u, +3299763344u, 2864033668u, +2554947496u, 799569078u, +2551629074u, 1102873346u, +2661022773u, 2006922227u, +2900438444u, 1448194126u, +1321567432u, 1983773590u, +1237256330u, 3449066284u, +1691553115u, 3274671549u, +4271625619u, 2741371614u, +3285899651u, 786322314u, +1586632825u, 564385522u, +2530557509u, 2974240289u, +1244759631u, 3263135197u, +3592389776u, 3570296884u, +2749873561u, 521432811u, +987586766u, 3206261120u, +1327840078u, 4078716491u, +1753812954u, 976892272u, +1827135136u, 1781944746u, +1328622957u, 1015377974u, +3439601008u, 2209584557u, +2482286699u, 1109175923u, +874877499u, 2036083451u, +483570344u, 1091877599u, +4190721328u, 1129462471u, +640035849u, 1867372700u, +920761165u, 3273688770u, +1623777358u, 3389003793u, +3241132743u, 2734783008u, +696674661u, 2502161880u, +1646071378u, 1164309901u, +350411888u, 1978005963u, +2253937037u, 7371540u, +989577914u, 3626554867u, +3214796883u, 531343826u, +398899695u, 1145247203u, +1516846461u, 3656006011u, +529303412u, 3318455811u, +3062828129u, 1696355359u, +3698796465u, 3155218919u, +1457595996u, 3191404246u, +1395609912u, 2917345728u, +1237411891u, 1854985978u, +1091884675u, 3504488111u, +3109924189u, 1628881950u, +3939149151u, 878608872u, +778235395u, 1052990614u, +903730231u, 2069566979u, +2437686324u, 3163786257u, +2257884264u, 2123173186u, +939764916u, 2933010098u, +1235300371u, 1256485167u, +1950274665u, 2180372319u, +2648400302u, 122035049u, +1883344352u, 2083771672u, +3712110541u, 321199441u, +1896357377u, 508560958u, +3066325351u, 2770847216u, +3177982504u, 296902736u, +1486926688u, 456842861u, +601221482u, 3992583643u, +2794121515u, 1533934172u, +1706465470u, 4281971893u, +2557027816u, 900741486u, +227175484u, 550595824u, +690918144u, 2825943628u, +90375300u, 300318232u, +1985329734u, 1440763373u, +3670603707u, 2533900859u, +3253901179u, 542270815u, +3677388841u, 307706478u, +2570910669u, 3320103693u, +1273768482u, 1216399252u, +1652924805u, 1043647584u, +1120323676u, 639941430u, +325675502u, 3652676161u, +4241680335u, 1545838362u, +1991398008u, 4100211814u, +1097584090u, 3262252593u, +2254324292u, 1765019121u, +4060211241u, 2315856188u, +3704419305u, 411263051u, +238929055u, 3540688404u, +3094544537u, 3250435765u, +3460621305u, 1967599860u, +2016157366u, 847389916u, +1659615591u, 4020453639u, +901109753u, 2682611693u, +1661364280u, 177155177u, +3210561911u, 3802058181u, +797089608u, 3286110054u, +2110358240u, 1353279028u, +2479975820u, 471725410u, +2219863904u, 3623364733u, +3167128228u, 1052188336u, +3656587111u, 721788662u, +3061255808u, 1615375832u, +924941453u, 2547780700u, +3328169224u, 1310964134u, +2701956286u, 4145497671u, +1421461094u, 1221397398u, +1589183618u, 1492533854u, +449740816u, 2686506989u, +3035198924u, 1682886232u, +2529760244u, 3342031659u, +1235084019u, 2151665147u, +2315686577u, 3282027660u, +1140138691u, 2754346599u, +2091754612u, 1178454681u, +4226896579u, 2942520471u, +2122168506u, 3751680858u, +3213794286u, 2601416506u, +4142747914u, 3951404257u, +4243249649u, 748595836u, +4004834921u, 238887261u, +1927321047u, 2217148444u, +205977665u, 1885975275u, +186020771u, 2367569534u, +2941662631u, 2608559272u, +3342096731u, 741809437u, +1962659444u, 3539886328u, +3036596491u, 2282550094u, +2366462727u, 2748286642u, +2144472852u, 1390394371u, +1257385924u, 2205425874u, +2119055686u, 46865323u, +3597555910u, 3188438773u, +2372320753u, 3641116924u, +3116286108u, 2680722658u, +3371014971u, 2058751609u, +2966943726u, 2345078707u, +2330535244u, 4013841927u, +1169588594u, 857915866u, +1875260989u, 3175831309u, +3193475664u, 1955181430u, +923161569u, 4068653043u, +776445899u, 954196929u, +61509556u, 4248237857u, +3808667664u, 581227317u, +2893240187u, 4159497403u, +4212264930u, 3973886195u, +2077539039u, 851579036u, +2957587591u, 772351886u, +1173659554u, 946748363u, +2794103714u, 2094375930u, +4234750213u, 3671645488u, +2614250782u, 2620465358u, +3122317317u, 2365436865u, +3393973390u, 523513960u, +3645735309u, 2766686992u, +2023960931u, 2312244996u, +1875932218u, 3253711056u, +3622416881u, 3274929205u, +612094988u, 1555465129u, +2114270406u, 3553762793u, +1832633644u, 1087551556u, +3306195841u, 1702313921u, +3675066046u, 1735998785u, +1690923980u, 1482649756u, +1171351291u, 2043136409u, +1962596992u, 461214626u, +3278253346u, 1392428048u, +3744621107u, 1028502697u, +3991171462u, 1014064003u, +3642345425u, 3186995039u, +6114625u, 3359104346u, +414856965u, 2814387514u, +3583605071u, 2497896367u, +1024572712u, 1927582962u, +2892797583u, 845302635u, +328548052u, 1523379748u, +3392622118u, 1347167673u, +1012316581u, 37767602u, +2647726017u, 1070326065u, +2075035198u, 4202817168u, +2502924707u, 2612406822u, +2187115553u, 1180137213u, +701024148u, 1481965992u, +3223787553u, 2083541843u, +203230202u, 3876887380u, +1334816273u, 2870251538u, +2186205850u, 3985213979u, +333533378u, 806507642u, +1010064531u, 713520765u, +3084131515u, 2637421459u, +1703168933u, 1517562266u, +4089081247u, 3231042924u, +3079916123u, 3154574447u, +2253948262u, 1725190035u, +2452539325u, 1343734533u, +213706059u, 2519409656u, +108055211u, 2916327746u, +587001593u, 1917607088u, +4202913084u, 926304016u, +469255411u, 4042080256u, +3498936874u, 246692543u, +495780578u, 438717281u, +2259272650u, 4011324645u, +2836854664u, 2317249321u, +946828752u, 1280403658u, +1905648354u, 2034241661u, +774652981u, 1285694082u, +2200307766u, 2158671727u, +1135162148u, 232040752u, +397012087u, 1717527689u, +1720414106u, 918797022u, +2580119304u, 3568069742u, +2904461070u, 3893453420u, +973817938u, 667499332u, +3785870412u, 2088861715u, +1565179401u, 600903026u, +591806775u, 3512242245u, +997964515u, 2339605347u, +1134342772u, 3234226304u, +4084179455u, 302315791u, +2445626811u, 2590372496u, +345572299u, 2274770442u, +3600587867u, 3706939009u, +1430507980u, 2656330434u, +1079209397u, 2122849632u, +1423705223u, 3826321888u, +3683385276u, 1057038163u, +1242840526u, 3987000643u, +2398253089u, 1538190921u, +1295898647u, 3570196893u, +3065138774u, 3111336863u, +2524949549u, 4203895425u, +3025864372u, 968800353u, +1023721001u, 3763083325u, +526350786u, 635552097u, +2308118370u, 2166472723u, +2196937373u, 2643841788u, +3040011470u, 4010301879u, +2782379560u, 3474682856u, +4201389782u, 4223278891u, +1457302296u, 2251842132u, +1090062008u, 3188219189u, +292733931u, 1424229089u, +1590782640u, 1365212370u, +3975957073u, 3982969588u, +2927147928u, 1048291071u, +2766680094u, 884908196u, +35237839u, 2221180633u, +2490333812u, 4098360768u, +4029081103u, 3490831871u, +2392516272u, 3455379186u, +3948800722u, 335456628u, +2105117968u, 4181629008u, +1044201772u, 3335754111u, +540133451u, 3313113759u, +3786107905u, 2627207327u, +3540337875u, 3473113388u, +3430536378u, 2514123129u, +2124531276u, 3872633376u, +3272957388u, 3501994650u, +2418881542u, 487365389u, +3877672368u, 1512866656u, +3486531087u, 2102955203u, +1136054817u, 3004241477u, +1549075351u, 1302002008u, +3936430045u, 2258587644u, +4109233936u, 3679809321u, +3467083076u, 2484463221u, +1594979755u, 529218470u, +3527024461u, 1147434678u, +106799023u, 1823161970u, +1704656738u, 1675883700u, +3308746763u, 1875093248u, +1352868568u, 1898561846u, +2508994984u, 3177750780u, +4217929592u, 400784472u, +80090315u, 3564414786u, +3841585648u, 3379293868u, +160353261u, 2413172925u, +2378499279u, 673436726u, +1505702418u, 1330977363u, +1853298225u, 3201741245u, +2135714208u, 4069554166u, +3715612384u, 3692488887u, +3680311316u, 4274382900u, +914186796u, 2264886523u, +3869634032u, 1254199592u, +1131020455u, 194781179u, +429923922u, 2763792336u, +2052895198u, 3997373194u, +3440090658u, 2165746386u, +1575500242u, 3463310191u, +2064974716u, 3779513671u, +3106421434u, 880320527u, +3281914119u, 286569042u, +3909096631u, 122359727u, +1429837716u, 252230074u, +4111461225u, 762273136u, +93658514u, 2766407143u, +3623657004u, 3869801679u, +3925695921u, 2390397316u, +2499025338u, 2741806539u, +2507199021u, 1659221866u, +361292116u, 4048761557u, +3797133396u, 1517903247u, +3121647246u, 3884308578u, +1697201500u, 1558800262u, +4150812360u, 3161302278u, +2610217849u, 641564641u, +183814518u, 2075245419u, +611996508u, 2223461433u, +329123979u, 121860586u, +860985829u, 1137889144u, +4018949439u, 2904348960u, +947795261u, 1992594155u, +4255427501u, 2281583851u, +2892637604u, 1478186924u, +3050771207u, 2767035539u, +373510582u, 1963520320u, +3763848370u, 3756817798u, +627269409u, 1806905031u, +1814444610u, 3646665053u, +1822693920u, 278515794u, +584050483u, 4142579188u, +2149745808u, 3193071606u, +1179706341u, 2693495182u, +3259749808u, 644172091u, +880509048u, 3340630542u, +3365160815u, 2384445068u, +3053081915u, 2840648309u, +1986990122u, 1084703471u, +2370410550u, 1627743573u, +2244943480u, 4057483496u, +2611595995u, 2470013639u, +4024732359u, 3987190386u, +873421687u, 2447660175u, +3226583022u, 767655877u, +2528024413u, 1962070688u, +1233635843u, 2163464207u, +659054446u, 854207134u, +258410943u, 4197831420u, +2515400215u, 3100476924u, +1961549594u, 2219491151u, +3997658851u, 163850514u, +470325051u, 2598261204u, +3052145580u, 59836528u, +1376188597u, 966733415u, +850667549u, 3622479237u, +1083731990u, 1525777459u, +4005126532u, 1428155540u, +2781907007u, 943739431u, +1493961005u, 2839096988u, +2000057832u, 1941829603u, +1901484772u, 939810041u, +3377407371u, 3090115837u, +3310840540u, 2068409688u, +3261383939u, 2212130277u, +2594774045u, 2912652418u, +4179816101u, 3534504531u, +3349254805u, 2796552902u, +1385421283u, 4259908631u, +3714780837u, 3070073945u, +3372846298u, 3835884044u, +3047965714u, 3009018735u, +744091167u, 1861124263u, +2764936304u, 1338171648u, +4222019554u, 1395200692u, +1371426007u, 3338031581u, +2525665319u, 4196233786u, +2332743921u, 1474702008u, +2274266301u, 4255175517u, +2290169528u, 1793910997u, +2188254024u, 354202001u, +3864458796u, 4280290498u, +1554419340u, 1733094688u, +2010552302u, 1561807039u, +664313606u, 2548990879u, +1084699349u, 3233936866u, +973895284u, 2386881969u, +1831995860u, 2961465052u, +1428704144u, 3269904970u, +231648253u, 2602483763u, +4125013173u, 3319187387u, +3347011944u, 1892898231u, +4019114049u, 868879116u, +4085937045u, 2378411019u, +1072588531u, 3547435717u, +2208070766u, 1069899078u, +3142980597u, 2337088907u, +1593338562u, 919414554u, +688077849u, 3625708135u, +1472447348u, 1947711896u, +3953006207u, 877438080u, +845995820u, 3150361443u, +3053496713u, 2484577841u, +224271045u, 2914958001u, +2682612949u, 806655563u, +2436224507u, 1907729235u, +2920583824u, 1251814062u, +2070814520u, 4034325578u, +497847539u, 2714317144u, +385182008u, 640855184u, +1327075087u, 1062468773u, +1757405994u, 1374270191u, +4263183176u, 3041193150u, +1037871524u, 3633173991u, +4231821821u, 2830131945u, +3505072908u, 2830570613u, +4195208715u, 575398021u, +3992840257u, 3691788221u, +1949847968u, 2999344380u, +3183782163u, 3723754342u, +759716128u, 3284107364u, +1714496583u, 15918244u, +820509475u, 2553936299u, +2201876606u, 4237151697u, +2605688266u, 3253705097u, +1008333207u, 712158730u, +1722280252u, 1933868287u, +4152736859u, 2097020806u, +584426382u, 2836501956u, +2522777566u, 1996172430u, +2122199776u, 1069285218u, +1474209360u, 690831894u, +107482532u, 3695525410u, +670591796u, 768977505u, +2412057331u, 3647886687u, +3110327607u, 1072658422u, +379861934u, 1557579480u, +4124127129u, 2271365865u, +3880613089u, 739218494u, +547346027u, 388559045u, +3147335977u, 176230425u, +3094853730u, 2554321205u, +1495176194u, 4093461535u, +3521297827u, 4108148413u, +1913727929u, 1177947623u, +1911655402u, 1053371241u, +3265708874u, 1266515850u, +1045540427u, 3194420196u, +3717104621u, 1144474110u, +1464392345u, 52070157u, +4144237690u, 3350490823u, +4166253320u, 2747410691u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; { uint64_t h = farmhashna::Hash64WithSeeds(data, len++, SEED0, SEED1); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashna::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashna::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +{ uint64_t h = farmhashna::Hash64WithSeeds(data + offset, len, SEED0, SEED1); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashna::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashna::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashnaTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +{ uint64_t h = farmhashna::Hash64WithSeeds(data + offset, len, SEED0, SEED1); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashna::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashna::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashnaTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashnaTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashnaTest::Dump(0, i); + } + farmhashnaTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashntTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +2681724312u, +797982799u, +921001710u, +2134990486u, +2244477846u, +2992121793u, +3943596029u, +452431531u, +2557197665u, +2532580744u, +3099673830u, +3696623795u, +3281581178u, +1882212500u, +275903667u, +3033004529u, +1402319660u, +2699376854u, +4222949502u, +1712034059u, +1330324210u, +2921867846u, +1728752234u, +326029180u, +3349570000u, +1612122221u, +1646032583u, +1432476832u, +3552092450u, +1499109081u, +1554038301u, +3190844552u, +540224401u, +489963606u, +1562872448u, +2128624475u, +1262831810u, +1672724608u, +2077310004u, +1911523866u, +294527927u, +1389770549u, +2026137563u, +629449419u, +2489287368u, +645684964u, +230403464u, +3272648435u, +165370827u, +1230085527u, +3628174014u, +851743255u, +1554380634u, +3667013118u, +2290487377u, +1909203251u, +1498556724u, +4165088768u, +197618179u, +914413116u, +1913303225u, +3117299654u, +1357272220u, +507436733u, +1413396341u, +146044391u, +429095991u, +3056862311u, +366414107u, +2293458109u, +1684583131u, +1170404994u, +520792961u, +1577421232u, +4033596884u, +4229339322u, +3242407770u, +2649785113u, +816692935u, +3555213933u, +517646945u, +2180594090u, +3047062993u, +2391606125u, +382936554u, +788479970u, +2826990641u, +3167748333u, +1758123094u, +389974094u, +3338548567u, +2583576230u, +3198590202u, +4155628142u, +542201663u, +2856634168u, +3948351189u, +4194218315u, +1467786451u, +2743592929u, +1062268187u, +3810665822u, +2560479831u, +997658837u, +3067277639u, +1211737169u, +59581167u, +1389679610u, +4189944477u, +100876854u, +2062343506u, +3088828656u, +3284356565u, +3130054947u, +3532596884u, +3887208531u, +259034107u, +3233195759u, +3200749877u, +760633989u, +1115203611u, +1516407838u, +1778459926u, +2146672889u, +2457048126u, +2217471853u, +862072556u, +3745267835u, +701920051u, +581695350u, +1410111809u, +3326135446u, +2187968410u, +4267859263u, +479241367u, +2868987960u, +704325635u, +1418509533u, +735688735u, +3283299459u, +813690332u, +1439630796u, +3195309868u, +1616408198u, +3254795114u, +2799925823u, +3929484338u, +1798536177u, +4205965408u, +1499475160u, +4247675634u, +3779953975u, +785893184u, +2778575413u, +1160134629u, +823113169u, +4116162021u, +4167766971u, +2487440590u, +4004655503u, +4044418876u, +1462554406u, +2011102035u, +4265993528u, +576405853u, +4038839101u, +2425317635u, +1401013391u, +3062418115u, +3167030094u, +2602636307u, +4264167741u, +4017058800u, +1029665228u, +4036354071u, +2670703363u, +688472265u, +1054670286u, +338058159u, +1539305024u, +146827036u, +4060134777u, +2502815838u, +1603444633u, +2448966429u, +3891353218u, +1082330589u, +201837927u, +2848283092u, +883849006u, +1982110346u, +541496720u, +133643215u, +3847827123u, +4015671361u, +2849988118u, +3452457457u, +2102063419u, +3281002516u, +1539151988u, +1147951686u, +2005032160u, +2415262714u, +116647396u, +1029284767u, +2159170082u, +1919171906u, +2017579106u, +2473524405u, +1694443528u, +3671562289u, +505662155u, +1019936943u, +1511077569u, +773792826u, +2089123665u, +484732447u, +1120017626u, +2809286837u, +4029205195u, +1097806406u, +136118734u, +4017075736u, +1403506686u, +1516736273u, +2562064338u, +2984955003u, +3071338162u, +1923531348u, +771592405u, +2586632018u, +4032960199u, +2687561076u, +308584855u, +1692079268u, +2565680167u, +3674576684u, +3770488806u, +69201295u, +1255084262u, +3593730713u, +54945052u, +1939595371u, +2432427547u, +2295501078u, +1280920000u, +82177963u, +1121403845u, +2889101923u, +713121337u, +1747052377u, +927011680u, +4142246789u, +1958963937u, +1636932722u, +4075249328u, +2025886508u, +3026358429u, +1845587644u, +3615577014u, +1363253259u, +3087190425u, +341851980u, +2515339233u, +1276595523u, +460237542u, +4198897105u, +2069753399u, +4278599955u, +356742959u, +3735275001u, +1750561299u, +668829411u, +3384018814u, +4233785523u, +451656820u, +107312677u, +2390172694u, +1216645846u, +164402616u, +1689811113u, +1767810825u, +1397772514u, +3323383489u, +2986430557u, +207428029u, +2260498180u, +2360400900u, +1263709570u, +1377764574u, +4252610345u, +1099809675u, +2776960536u, +3542220540u, +3752806924u, +337070226u, +3267551635u, +1306761320u, +2220373824u, +4109252858u, +896322512u, +1788337208u, +1336556841u, +2911512007u, +3712582785u, +3071359622u, +2561488770u, +3898950547u, +536047554u, +2040551642u, +3528794619u, +3565689036u, +1197100813u, +1864569342u, +3329594980u, +490608221u, +1174785921u, +3287246572u, +2163330264u, +500120236u, +2520062970u, +1561519055u, +4042710240u, +2774151984u, +3160666939u, +96459446u, +1878067032u, +4237425634u, +2952135524u, +4100839753u, +1265237690u, +4246879223u, +834830418u, +3476334357u, +4277111759u, +2511026735u, +3065234219u, +556796152u, +198182691u, +2913077464u, +1535115487u, +4046477658u, +140762681u, +990407433u, +2198985327u, +2926590471u, +559702706u, +82077489u, +1096697687u, +4190838199u, +3046872820u, +1583801700u, +2185339100u, +3912423882u, +3703603898u, +2540185277u, +1446869792u, +4051584612u, +2719373510u, +1675560450u, +1996164093u, +405251683u, +2864244470u, +4071581802u, +2028708916u, +803575837u, +557660441u, +3841480082u, +255451671u, +779434428u, +3452203069u, +2285701422u, +1568745354u, +823305654u, +3184047862u, +4159715581u, +3160134214u, +3198900547u, +1566527339u, +4194096960u, +1496132623u, +1719108984u, +2584236470u, +531310503u, +3456882941u, +3382290593u, +467441309u, +3241407531u, +2540270567u, +1397502982u, +3348545480u, +811750340u, +1017047954u, +2540585554u, +3531646869u, +943914610u, +1903578924u, +1911188923u, +241574049u, +3181425568u, +3529565564u, +240953857u, +2964595704u, +3828377737u, +4260564140u, +4262383425u, +383233885u, +4051263539u, +919677938u, +1683612329u, +4204155962u, +2283918569u, +4153726847u, +350160869u, +1387233546u, +1891558063u, +740563169u, +330624974u, +2948665536u, +376390582u, +3799363969u, +3187805406u, +2263421398u, +1928519266u, +2746577402u, +2108753646u, +768287270u, +2247006571u, +212490675u, +917121602u, +2549835613u, +2864033668u, +3738062408u, +2006922227u, +2616619070u, +3449066284u, +431292293u, +786322314u, +1415970351u, +3263135197u, +2954777083u, +3206261120u, +2287507921u, +1781944746u, +4081586725u, +1109175923u, +1813855658u, +1129462471u, +1037031473u, +3389003793u, +3122687303u, +1164309901u, +3193251135u, +3626554867u, +3071568023u, +3656006011u, +1167681812u, +3155218919u, +2704165015u, +1854985978u, +1712976649u, +878608872u, +4155949943u, +3163786257u, +1626463554u, +1256485167u, +582664250u, +2083771672u, +804336148u, +2770847216u, +1674051445u, +3992583643u, +2966108111u, +900741486u, +4014551783u, +300318232u, +3517585534u, +542270815u, +760762191u, +1216399252u, +643179562u, +3652676161u, +2990167340u, +3262252593u, +2134299399u, +411263051u, +1342880802u, +1967599860u, +853593042u, +2682611693u, +850464484u, +3286110054u, +3842907484u, +3623364733u, +3693536939u, +1615375832u, +2318423400u, +4145497671u, +1728968857u, +2686506989u, +1502282913u, +2151665147u, +3651607391u, +1178454681u, +4146839064u, +2601416506u, +1448097974u, +238887261u, +4093725287u, +2367569534u, +679517009u, +3539886328u, +3086277222u, +1390394371u, +119173722u, +1766260771u, +751439914u, +215917713u, +2656990891u, +1570750352u, +3533987737u, +3576119563u, +963183826u, +3796810515u, +136547246u, +2592925324u, +427154472u, +1228758574u, +1464255968u, +2984611177u, +2001585786u, +1525438381u, +1348536411u, +2861338018u, +764077711u, +3785343245u, +457568934u, +4104954272u, +2381948487u, +3148473363u, +2180270337u, +1387729170u, +951677556u, +2721005055u, +66786703u, +1149351924u, +1895026827u, +3711056516u, +3638638708u, +2263003308u, +3448840877u, +225333538u, +3797521928u, +3262952567u, +2078619498u, +1178073973u, +3288261538u, +1496966875u, +2481012988u, +114945840u, +1632780103u, +2087949619u, +3787017905u, +2575395164u, +2971726178u, +3642087909u, +3894199764u, +203853421u, +425935223u, +3565833278u, +1748785729u, +580966986u, +2124704694u, +1107045577u, +1067532701u, +1406028344u, +18613994u, +3476683808u, +3762914298u, +1844996900u, +904215228u, +1118521573u, +3657647605u, +3136157065u, +2287683323u, +126005630u, +3555092974u, +49515858u, +1010661841u, +1902040126u, +1400735275u, +2771676666u, +2225229957u, +3454177594u, +2883475137u, +4144472319u, +1051332394u, +542648229u, +1669710469u, +553041029u, +584127807u, +2993670925u, +3587959456u, +1745399498u, +1404723176u, +1334333531u, +3239516985u, +1275954779u, +367320647u, +3684418197u, +4030809053u, +484559105u, +4255931645u, +4271715616u, +3171911678u, +928543347u, +2159512867u, +313902234u, +647086234u, +577214736u, +1130129573u, +995791646u, +1645086060u, +4122335794u, +1064648931u, +2752145076u, +3312498873u, +4238535494u, +1471227427u, +633688562u, +1959779970u, +766642813u, +1380896111u, +3647601207u, +1733961041u, +521947915u, +189164145u, +486382294u, +3770038872u, +3235740744u, +1912506671u, +2276864677u, +1588060152u, +2504457929u, +1471020554u, +3623212998u, +3026631806u, +2342164722u, +1674890530u, +3011542850u, +3549160092u, +4290680005u, +3943068002u, +2273781461u, +2127663659u, +1646681121u, +447810651u, +2366308558u, +970504950u, +2008155560u, +2695940969u, +3444688454u, +1739318893u, +2683090634u, +2774816580u, +437560100u, +512012738u, +3305170944u, +665292744u, +3580039116u, +1579404983u, +3397891494u, +710590371u, +2514565805u, +3624609754u, +3516075816u, +1314000850u, +1935166880u, +3257747610u, +3776931214u, +3183054185u, +675129307u, +3333261712u, +1154611403u, +2759854023u, +1963228038u, +505138315u, +1803966773u, +4032705384u, +798395739u, +3473799845u, +476400898u, +602972493u, +3289878097u, +2520311409u, +3214794876u, +748160407u, +1326769504u, +902775872u, +1372805534u, +1213925114u, +3009384989u, +3781981134u, +2835608783u, +2716786748u, +1669490957u, +1089334066u, +250756920u, +4041016629u, +2495807367u, +2008251381u, +106212622u, +1927268995u, +2251978818u, +3788056262u, +3678660147u, +2656772270u, +1997584981u, +2668998785u, +2954162084u, +845687881u, +776018378u, +2066910012u, +918315064u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashnt::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashnt::Hash32(data, len++)); IsAlive(farmhashnt::Hash32(data, len++)); len -= 3; return alive > 0; } +Check(farmhashnt::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashnt::Hash32(data + offset, len)); + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashntTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashnt::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashnt::Hash32(data + offset, len) << "u," << endl; +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashntTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashntTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashntTest::Dump(0, i); + } + farmhashntTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashsaTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +4223616069u, +3696677242u, +4081014168u, +2576519988u, +2212771159u, +1112731063u, +1020067935u, +3955445564u, +1451961420u, +653440099u, +31917516u, +2957164615u, +2590087362u, +3879448744u, +176305566u, +2447367541u, +1359016305u, +3363804638u, +1117290165u, +1062549743u, +2437877004u, +1894455839u, +673206794u, +3486923651u, +3269862919u, +2303349487u, +1380660650u, +595525107u, +1525325287u, +2025609358u, +176408838u, +1592885012u, +864896482u, +2101378090u, +3489229104u, +2118965695u, +581644891u, +2718789079u, +631613207u, +4228658372u, +3867875546u, +3531368319u, +3804516756u, +3317755099u, +1619744564u, +2884717286u, +1088213445u, +2667691076u, +3727873235u, +2330406762u, +858590707u, +123802208u, +4150036245u, +182283099u, +1478882570u, +3282617403u, +819171187u, +1172627392u, +4254302102u, +2957028020u, +437030323u, +2452147680u, +2868246750u, +3530169402u, +3154852132u, +215019192u, +357580983u, +1354454461u, +1108813287u, +2324008118u, +2315997713u, +4181601562u, +1360882441u, +92423273u, +3048866755u, +3369188505u, +3664371439u, +2920710428u, +1027891570u, +2653166430u, +3461888315u, +1475780447u, +292769636u, +1737473313u, +4064110516u, +4170160075u, +762850927u, +3630603695u, +2803307356u, +844987665u, +460980967u, +3005635467u, +2802568977u, +588668033u, +2148940781u, +3239099984u, +1266953698u, +3197808789u, +3519942533u, +2511995334u, +2553810188u, +871667697u, +1358675720u, +1499319171u, +2044931270u, +1210355103u, +807152540u, +3262320756u, +2810214575u, +1813386141u, +4089465863u, +903928165u, +1388899322u, +3209183659u, +834536144u, +2733354550u, +2742289921u, +3689042563u, +2655593281u, +4169686303u, +415985561u, +138892376u, +516115393u, +65683883u, +4162865100u, +889944635u, +313566528u, +3346420907u, +1504303591u, +2256809275u, +742243229u, +779775302u, +3140940172u, +2312556111u, +2304095772u, +1151741606u, +2194712422u, +1714084652u, +3272736835u, +1311540658u, +191179665u, +3996605106u, +1657345233u, +4205442903u, +1553339212u, +2351843044u, +1647502006u, +2525516233u, +292202846u, +1498646290u, +1429323381u, +974274898u, +3759331561u, +2881238887u, +826787221u, +1069622448u, +221991032u, +1462969082u, +2799661508u, +364022781u, +2594244377u, +797773898u, +4097839290u, +1529150125u, +2456805570u, +541503425u, +3936326142u, +3112719954u, +775223581u, +3074018423u, +3198488875u, +1772191849u, +2456535211u, +3154686028u, +1520862019u, +4005829426u, +1306433767u, +1943028506u, +2246000782u, +1057766454u, +3761996982u, +3441075333u, +898641979u, +3450209088u, +3941329307u, +3289922449u, +3085075827u, +1814193220u, +690422997u, +2627846676u, +2653520704u, +3739145533u, +3996776010u, +2287072592u, +1346671698u, +3082629900u, +2298811274u, +3639722036u, +1729419228u, +1836765953u, +3708118742u, +213436u, +950223749u, +3734247682u, +2924575678u, +1382024841u, +2431637732u, +3448846682u, +1341301397u, +4206956590u, +1730650902u, +2581075456u, +1542359141u, +707222542u, +2925350541u, +3846303536u, +3579103295u, +3932175763u, +1339615732u, +848825750u, +1070170828u, +1964973818u, +577060344u, +607721296u, +4031023048u, +406883794u, +3991905552u, +1198544082u, +872468460u, +1044847096u, +3159976313u, +3020028266u, +2108700400u, +3373767922u, +264431841u, +2817097007u, +3700061048u, +1733731531u, +3459415893u, +80378591u, +1479875104u, +19735612u, +1382658977u, +3416562245u, +1959852842u, +2384002344u, +124683828u, +3725782174u, +2300301222u, +393852269u, +1302492002u, +3623776492u, +3787086417u, +1730024749u, +1710531361u, +443700716u, +1461987482u, +671998131u, +3018380746u, +2592292305u, +3390799372u, +3945101155u, +3743494852u, +3716045582u, +996005166u, +320698449u, +3420221765u, +1518157951u, +2555810666u, +3381929684u, +2019638523u, +3088262796u, +2072178906u, +3433649364u, +203906916u, +34663784u, +290301305u, +1188021504u, +3754681145u, +3920313139u, +2840496520u, +1656802962u, +2288475489u, +3399185138u, +1296000826u, +2362384746u, +309633360u, +2719851778u, +776035930u, +3200733043u, +365690832u, +3326378243u, +1500331457u, +1625708592u, +4230903462u, +715344888u, +3363777768u, +2243620288u, +2890765789u, +553154234u, +4044100108u, +4056887320u, +1185656496u, +3671476744u, +1064586897u, +1154949698u, +3493481974u, +1294573722u, +1869224012u, +2530084956u, +995321553u, +833419249u, +563815282u, +250258043u, +2970801822u, +441007535u, +42246961u, +2820426655u, +2878882436u, +2363245780u, +2138489282u, +2972360481u, +2312619393u, +3598664848u, +3071556076u, +776990325u, +3220427357u, +2257939577u, +3817305903u, +1502979698u, +3159755934u, +3955997276u, +2423850008u, +1959927572u, +1219782288u, +4119776679u, +1124253854u, +3678052422u, +2620644947u, +1262408666u, +3480072280u, +2627137665u, +807538749u, +3276646337u, +518510128u, +1137828655u, +1498449110u, +3031692317u, +1125635969u, +1130096111u, +780007336u, +3111856399u, +1014917264u, +780877352u, +2909458336u, +4235949214u, +2423879289u, +275888892u, +3891926795u, +3538163953u, +54815161u, +162228302u, +258154068u, +3554455591u, +1801469029u, +2801563220u, +726560058u, +2450221940u, +3677582978u, +440993800u, +424762443u, +2624525253u, +2587715329u, +2292264424u, +1074856749u, +3294752007u, +3164112672u, +2399146799u, +1920182465u, +3858835361u, +193755240u, +3333610311u, +1757504059u, +2576027039u, +2775253365u, +2939191561u, +1046147275u, +235149906u, +4262218222u, +2900542726u, +2260154702u, +1019551635u, +1194720570u, +3519118691u, +3039483153u, +84918216u, +3053381097u, +2572396843u, +3849763371u, +2782686780u, +3710049554u, +3403430713u, +2346080784u, +2496307442u, +1597281872u, +696018239u, +704625714u, +623026921u, +3182413559u, +3794540330u, +305497722u, +1592680199u, +2377854072u, +3060601746u, +3953057908u, +3941551588u, +1033716182u, +2765716854u, +1309699058u, +3519400181u, +3073370877u, +115583008u, +4032909296u, +2944563574u, +3762753718u, +192842727u, +1711348701u, +3086147235u, +1658229443u, +1479783872u, +3839977157u, +225619117u, +1349684817u, +1964813173u, +565753187u, +2530252046u, +840014353u, +1645183704u, +3668429078u, +3438418557u, +639704059u, +360837811u, +2531807958u, +1572353913u, +2116037299u, +1948437512u, +744553393u, +2380697034u, +3775234105u, +3816065157u, +301868653u, +2960939561u, +3306528247u, +2389296549u, +805918610u, +1759358265u, +1760876328u, +2827601706u, +2944594708u, +3313666458u, +2022601495u, +730938791u, +193539397u, +2026103244u, +802928398u, +2630934308u, +782805818u, +3499326016u, +293509489u, +3646131514u, +3182478647u, +854800333u, +2284531628u, +438528022u, +2339298129u, +1692289216u, +2427728723u, +46501288u, +350652353u, +1355971222u, +889682372u, +944799254u, +2763906061u, +2807550612u, +2683762637u, +100870317u, +2449357318u, +2638348436u, +4206088869u, +1788948473u, +3537588549u, +2782490204u, +134406470u, +2409190528u, +2362439849u, +1861661528u, +2101513194u, +1424834765u, +3581765745u, +3185999525u, +2057487100u, +2303941176u, +3639628788u, +1180265315u, +230437935u, +2108319366u, +1131685143u, +1055685292u, +1509007009u, +1258485140u, +560525005u, +3598799040u, +3835680585u, +1851859628u, +332858996u, +641769248u, +4252450037u, +865386707u, +720719117u, +3133612164u, +3833045874u, +3492515435u, +2465970289u, +4234420011u, +573859916u, +252532886u, +870392318u, +4051320920u, +894929092u, +3748361688u, +699355960u, +1885212350u, +1609756949u, +461896870u, +1337065461u, +1775211059u, +1786193749u, +2815154643u, +2128729882u, +969639529u, +3960427545u, +859416958u, +2739758802u, +2698032197u, +2813292418u, +1985467524u, +396604317u, +4122172759u, +1201259789u, +4282051702u, +3270018895u, +961215209u, +961075860u, +4211926998u, +4088374597u, +577510509u, +3058349487u, +4025377754u, +2815478438u, +471023164u, +3947959608u, +4161486934u, +2299888461u, +1103571511u, +2450153872u, +1839939275u, +108299608u, +858086440u, +1030152945u, +3895328530u, +3009080718u, +3690840454u, +3847025277u, +152331362u, +161365689u, +831319961u, +2166017294u, +3945322722u, +4059970216u, +1420824131u, +2770648308u, +1567250186u, +2181067149u, +1939743488u, +3080158120u, +3435218248u, +2495237495u, +3814085102u, +3180983013u, +3199054292u, +2204745908u, +1140337267u, +2213569784u, +1941879842u, +2105562605u, +3618835614u, +2247103645u, +2492473487u, +856414299u, +166022030u, +4080104712u, +3218935344u, +3284220561u, +4261581452u, +1206944836u, +3496705432u, +2215996876u, +3154627465u, +3384005496u, +742170556u, +1333047620u, +802680366u, +156833431u, +2682100354u, +2493654830u, +584848366u, +1691693131u, +2169934170u, +779968026u, +2099545800u, +1423039695u, +4292110968u, +4266576788u, +149142597u, +748501873u, +3865014822u, +1913588198u, +130285614u, +3500768879u, +915458923u, +3071792750u, +1339986633u, +4143929149u, +4048379479u, +725193827u, +1375113643u, +2425277412u, +4144659274u, +465714768u, +226991589u, +2212127704u, +3936145258u, +2891024846u, +3816000225u, +979331165u, +1749907536u, +53847318u, +1462525833u, +2961425455u, +368859113u, +3572721452u, +453048644u, +1628629918u, +3497673923u, +3619079585u, +139870565u, +1518176798u, +3933074281u, +1878623729u, +2074035641u, +3016759257u, +1313053591u, +2557706970u, +2348296582u, +962370022u, +2337285014u, +1618936717u, +1915877085u, +2743743122u, +3250783882u, +1346652536u, +143311109u, +2443788461u, +1048248964u, +2806619339u, +3263266976u, +1668146349u, +3397428868u, +3276188862u, +1774196343u, +1993847813u, +2771079610u, +476672419u, +2119050359u, +2918326659u, +2245402721u, +2692910474u, +2374383269u, +342400227u, +2961437795u, +3899230368u, +337787132u, +3664444935u, +1269451153u, +2971526729u, +1486511182u, +791070133u, +2570319890u, +3482497490u, +2134230518u, +4273391202u, +1825511330u, +3947753714u, +1389755724u, +3995075516u, +2081052615u, +3626343470u, +4213603435u, +2137917278u, +2898987303u, +3059215715u, +3383237881u, +3003674434u, +409174425u, +1911915604u, +2087728055u, +2942005882u, +3386522440u, +714936074u, +261924004u, +3268784033u, +1141188757u, +2413217552u, +1515163433u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashsa::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashsa::Hash32(data, len++)); IsAlive(farmhashsa::Hash32(data, len++)); len -= 3; return alive > 0; } +Check(farmhashsa::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashsa::Hash32(data + offset, len)); + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashsaTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashsa::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashsa::Hash32(data + offset, len) << "u," << endl; +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashsaTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashsaTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashsaTest::Dump(0, i); + } + farmhashsaTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashsuTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +4223616069u, +3696677242u, +4081014168u, +2576519988u, +2212771159u, +1112731063u, +1020067935u, +3955445564u, +1451961420u, +653440099u, +31917516u, +2957164615u, +2590087362u, +3879448744u, +176305566u, +2447367541u, +1359016305u, +3363804638u, +1117290165u, +1062549743u, +2437877004u, +1894455839u, +673206794u, +3486923651u, +3269862919u, +2303349487u, +1380660650u, +595525107u, +1525325287u, +2025609358u, +176408838u, +1592885012u, +864896482u, +2101378090u, +3489229104u, +2118965695u, +581644891u, +2718789079u, +631613207u, +4228658372u, +3867875546u, +3531368319u, +3804516756u, +3317755099u, +1619744564u, +2884717286u, +1088213445u, +2667691076u, +3727873235u, +2330406762u, +858590707u, +457744844u, +4150036245u, +2000404290u, +1478882570u, +901678172u, +819171187u, +195942998u, +4254302102u, +3967266927u, +437030323u, +4018009204u, +2868246750u, +3540087514u, +3154852132u, +3319116625u, +357580983u, +3177665294u, +1108813287u, +1253366798u, +2315997713u, +510718750u, +1360882441u, +2770216279u, +3048866755u, +3406961221u, +3664371439u, +1151145514u, +1027891570u, +2699067992u, +3461888315u, +198061905u, +292769636u, +1106771795u, +4064110516u, +3258279756u, +762850927u, +1818699721u, +2803307356u, +3919169404u, +460980967u, +3125535078u, +2802568977u, +3582546426u, +2148940781u, +3963274378u, +1266953698u, +204185123u, +1100034381u, +3009193601u, +4200651967u, +274889605u, +2700589508u, +952511689u, +3765324859u, +3465498478u, +4014967037u, +2070988082u, +2972423530u, +3068638223u, +4156773651u, +489509804u, +1323863238u, +3731914806u, +2846098469u, +2728930632u, +346814072u, +848146907u, +551160669u, +4165126521u, +2039095001u, +4179859388u, +2434936359u, +2764414551u, +238491210u, +732483969u, +3366512764u, +478307468u, +4124179572u, +4142733597u, +1953448206u, +4199329278u, +865077060u, +2627662116u, +2802499360u, +3141206831u, +1959218197u, +911371451u, +125987200u, +2821366175u, +2530992747u, +2409206225u, +117991880u, +2133402461u, +895510531u, +428719601u, +3036014536u, +1223783733u, +733793540u, +970650405u, +547701766u, +570764615u, +3224485368u, +3192714940u, +319942831u, +3940200341u, +362056204u, +2832368105u, +1853281226u, +3296434636u, +3752508307u, +604292768u, +2231940616u, +1204094681u, +866194005u, +2405201650u, +2466384396u, +380829379u, +230033818u, +2783417588u, +4249886729u, +829569301u, +2988322580u, +2299983554u, +74748560u, +737514425u, +3153050211u, +652642663u, +1270205115u, +227197032u, +2773091790u, +325849216u, +49998791u, +4043203010u, +3662748068u, +1709364383u, +1179105165u, +1478504366u, +2980456610u, +1167476429u, +1590390732u, +1306256496u, +292008135u, +374690995u, +1809200819u, +1680595904u, +646040226u, +1742445560u, +2435776844u, +3703683804u, +478742495u, +814967947u, +2698190177u, +1003617993u, +1436118705u, +217056304u, +1412287094u, +2738417466u, +2933279339u, +3461877733u, +1203141205u, +2119492857u, +1134895723u, +1560001021u, +3786320122u, +3748116258u, +3486219595u, +702138030u, +1062984182u, +232789133u, +1566523968u, +3885443778u, +1820171888u, +3655858585u, +2316903005u, +2678779620u, +395625433u, +1609107564u, +3108726411u, +2937837224u, +3911907151u, +557272509u, +3893435978u, +1542613576u, +1079886893u, +2624566322u, +1413700616u, +2796974006u, +1922556114u, +562820464u, +2845409784u, +54180312u, +1898782464u, +3681814953u, +2417064617u, +1815464483u, +911626132u, +2964575550u, +1852696128u, +2319647785u, +1998904590u, +619992689u, +3073207513u, +1238163512u, +3199435982u, +828667254u, +3561155502u, +3943095163u, +1045711849u, +2238679131u, +2114975398u, +713808403u, +3871787494u, +2572031161u, +2360934075u, +2337781107u, +262596504u, +693836699u, +2129369850u, +3543189427u, +962205222u, +3685581020u, +692974477u, +725182211u, +646123906u, +2368836544u, +2505872733u, +1999977610u, +1639885802u, +1475058032u, +207023609u, +2773581234u, +3524857793u, +3433371102u, +3243027613u, +1787668353u, +985757946u, +3896012929u, +702356957u, +3559331129u, +884084870u, +4009998120u, +648888720u, +1403349048u, +1624342778u, +1766674171u, +2518582204u, +3251243146u, +792751003u, +1377201813u, +3629686054u, +1583734324u, +3647107626u, +4258564381u, +1469878609u, +1940598241u, +2755003690u, +1907120418u, +109916701u, +775347954u, +2090960874u, +611281803u, +3470490146u, +3301663253u, +1835412158u, +1803066146u, +591872433u, +550703713u, +1495089683u, +826492808u, +817200035u, +4177474571u, +688070143u, +971427632u, +1442499481u, +3568640348u, +2789993738u, +85808128u, +2058346726u, +394058570u, +3466511434u, +318905230u, +4149248030u, +415308316u, +165997598u, +1219639412u, +1648022659u, +2857432523u, +1422508004u, +468095522u, +296968649u, +430250611u, +1775562314u, +2976361671u, +1040036362u, +1372510167u, +292746272u, +3408238954u, +626061886u, +1317637569u, +1237775792u, +1218490455u, +2224234499u, +590942419u, +713995643u, +3541889330u, +4140218960u, +3529791107u, +354462673u, +842607274u, +365048533u, +2638303414u, +3560458014u, +31621379u, +4210854794u, +1273118792u, +2572743762u, +3513175801u, +402066986u, +602524471u, +565029192u, +180576438u, +1288605959u, +2896244423u, +1420543484u, +1329862227u, +1791567324u, +4248690247u, +12917038u, +3483481310u, +2082050731u, +1611921143u, +2443766548u, +2216338811u, +2528006095u, +2984009021u, +674210884u, +2857608106u, +2155534809u, +1023105067u, +2968955846u, +3303624302u, +2502112850u, +245749006u, +3175229091u, +3342796184u, +3613785362u, +1614168851u, +2582149283u, +895403488u, +416205023u, +3792242000u, +529397534u, +299415203u, +4284673348u, +2096851282u, +1864524731u, +2012577738u, +3426363316u, +1387308508u, +1143610148u, +2027467219u, +3772856163u, +3453862623u, +2661437174u, +2047145955u, +2533381447u, +2059534115u, +439426587u, +1537543414u, +2384289877u, +3174229055u, +2658017753u, +2293148474u, +2359450158u, +3930242475u, +1510302397u, +3354288821u, +920095603u, +2415746928u, +2729472638u, +2261143371u, +848667611u, +919157153u, +3322393117u, +4103299943u, +413569608u, +68911216u, +3334990170u, +1228068652u, +1570056373u, +1905477543u, +2622302276u, +2935063895u, +3224810004u, +4211768578u, +828688131u, +3556122839u, +1930935348u, +2605825202u, +1540993970u, +3209115883u, +122847500u, +665638794u, +506571051u, +2691795295u, +3996966556u, +714660621u, +3662432239u, +470651837u, +1807432621u, +3755290953u, +359878860u, +2793081615u, +4065031431u, +904653062u, +2317800777u, +568501094u, +3492871707u, +2738806116u, +2883859610u, +3242080257u, +364246691u, +3601786516u, +3159362524u, +1578272201u, +1283574375u, +2912186103u, +2256279032u, +1540671086u, +2356088973u, +2892277779u, +3441449267u, +2225005503u, +3846428419u, +2014549218u, +2290734767u, +2126684614u, +4235463487u, +3811556204u, +174739661u, +767525888u, +47684458u, +4211168099u, +889063422u, +469864411u, +767407110u, +413337343u, +1618456644u, +2814499820u, +2401124192u, +632089437u, +1234980238u, +1288585402u, +3153169944u, +2917822069u, +1843320264u, +3794359132u, +3074573530u, +258629454u, +3813357060u, +3806887248u, +1665524736u, +3324533324u, +3005091922u, +793108368u, +1529669805u, +2332660395u, +2217730223u, +2634687611u, +442806463u, +1968135266u, +454523002u, +3177866230u, +2808960136u, +4259114138u, +4103264843u, +3103714075u, +2462967542u, +1466891491u, +477973764u, +834565647u, +741089037u, +218837573u, +1710536528u, +2469088212u, +1229072375u, +2828341u, +176923431u, +985763350u, +4095477420u, +1984145538u, +1870791084u, +674956677u, +1978138947u, +1296493993u, +1818183554u, +3443333721u, +2124949983u, +2549590262u, +2700850794u, +2662736367u, +739638109u, +4061447096u, +2960078422u, +2453781158u, +929570940u, +3200328383u, +2406328791u, +1419180666u, +2152455739u, +2805741044u, +3305999074u, +3183816361u, +2303165050u, +4922104u, +63096005u, +936656347u, +3104453886u, +1088673880u, +1113407526u, +1457890086u, +453478383u, +1107686695u, +3626027824u, +1159687359u, +2248467888u, +2004578380u, +3274954621u, +1787958646u, +2628726704u, +1138419798u, +3735442315u, +692385301u, +313807213u, +2329068673u, +59375364u, +3261084359u, +2088644507u, +2471153194u, +788336435u, +4024527246u, +141504460u, +2307553888u, +1930559950u, +48975711u, +2745693338u, +230161982u, +3429230862u, +1335968626u, +609591304u, +57435073u, +4279281136u, +3152151665u, +3984484924u, +3459883943u, +397478330u, +1738762229u, +3033590066u, +3611539498u, +1363463523u, +3319364965u, +2671169141u, +3819548561u, +1691193757u, +2423834608u, +2820147055u, +1378120632u, +1240565187u, +3180720050u, +680831086u, +3309658414u, +1986166490u, +762099827u, +510883662u, +2047373648u, +3606742294u, +3894965352u, +2342078853u, +1091255717u, +776594727u, +3217317445u, +1574468485u, +3844504016u, +2819598918u, +1037401010u, +2550943503u, +3867184001u, +1687911772u, +165313836u, +1679575281u, +2418947263u, +2038774952u, +3913543652u, +3209155736u, +149905221u, +3859604717u, +713919631u, +4069810796u, +1882959164u, +1019939034u, +2379867302u, +3666323035u, +1157389013u, +2422300650u, +3366777340u, +2526452062u, +1313747885u, +1039617868u, +1620553692u, +2032976978u, +578789528u, +1592846839u, +2270630604u, +897850577u, +1603294178u, +3105664807u, +1442670138u, +1728019360u, +79313861u, +1683031101u, +1913067024u, +4070719870u, +708986470u, +2586453359u, +3993348863u, +3358251279u, +3003552537u, +750174793u, +836888956u, +4190747426u, +4251291318u, +4145164938u, +1366883260u, +1912910955u, +510192669u, +1851315039u, +3574241274u, +3220062924u, +2821142039u, +1317082195u, +2274293302u, +1839219569u, +126586168u, +3989293643u, +2680178207u, +347056948u, +799681430u, +2864517481u, +3180404853u, +213140045u, +1956305184u, +1474675286u, +3085723423u, +2841859626u, +308421914u, +3670309263u, +1765052231u, +245459238u, +113434331u, +4079521092u, +2115235526u, +2943408816u, +1055476938u, +1506442339u, +2291296392u, +3267864332u, +1282145528u, +3700108015u, +1932843667u, +2677701670u, +6041177u, +3889648557u, +1461025478u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; IsAlive(farmhashsu::Hash32WithSeed(data, len++, SEED)); IsAlive(farmhashsu::Hash32(data, len++)); IsAlive(farmhashsu::Hash32(data, len++)); len -= 3; return alive > 0; } +Check(farmhashsu::Hash32WithSeed(data + offset, len, SEED)); +Check(farmhashsu::Hash32(data + offset, len)); + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashsuTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +cout << farmhashsu::Hash32WithSeed(data + offset, len, SEED) << "u," << endl; +cout << farmhashsu::Hash32(data + offset, len) << "u," << endl; +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashsuTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashsuTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashsuTest::Dump(0, i); + } + farmhashsuTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashteTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +1140953930u, 861465670u, +3277735313u, 2681724312u, +2598464059u, 797982799u, +890626835u, 800175912u, +2603993599u, 921001710u, +1410420968u, 2134990486u, +3283896453u, 1867689945u, +2914424215u, 2244477846u, +255297188u, 2992121793u, +1110588164u, 4186314283u, +161451183u, 3943596029u, +4019337850u, 452431531u, +283198166u, 2741341286u, +3379021470u, 2557197665u, +299850021u, 2532580744u, +452473466u, 1706958772u, +1298374911u, 3099673830u, +2199864459u, 3696623795u, +236935126u, 2976578695u, +4055299123u, 3281581178u, +1053458494u, 1882212500u, +2305012065u, 2169731866u, +3456121707u, 275903667u, +458884671u, 3033004529u, +3058973506u, 2379411653u, +1898235244u, 1402319660u, +2700149065u, 2699376854u, +147814787u, 720739346u, +2433714046u, 4222949502u, +4220361840u, 1712034059u, +3425469811u, 3690733394u, +4148372108u, 1330324210u, +594028478u, 2921867846u, +1635026870u, 192883107u, +780716741u, 1728752234u, +3280331829u, 326029180u, +3969463346u, 1436364519u, +393215742u, 3349570000u, +3824583307u, 1612122221u, +2859809759u, 3808705738u, +1379537552u, 1646032583u, +2233466664u, 1432476832u, +4023053163u, 2650381482u, +2052294713u, 3552092450u, +1628777059u, 1499109081u, +3476440786u, 3829307897u, +2960536756u, 1554038301u, +1145519619u, 3190844552u, +2902102606u, 3600725550u, +237495366u, 540224401u, +65721842u, 489963606u, +1448662590u, 397635823u, +1596489240u, 1562872448u, +1790705123u, 2128624475u, +180854224u, 2604346966u, +1435705557u, 1262831810u, +155445229u, 1672724608u, +1669465176u, 1341975128u, +663607706u, 2077310004u, +3610042449u, 1911523866u, +1043692997u, 1454396064u, +2563776023u, 294527927u, +1099072299u, 1389770549u, +703505868u, 678706990u, +2952353448u, 2026137563u, +3603803785u, 629449419u, +1933894405u, 3043213226u, +226132789u, 2489287368u, +1552847036u, 645684964u, +3828089804u, 3632594520u, +187883449u, 230403464u, +3151491850u, 3272648435u, +3729087873u, 1303930448u, +2002861219u, 165370827u, +916494250u, 1230085527u, +3103338579u, 3064290191u, +3807265751u, 3628174014u, +231181488u, 851743255u, +2295806711u, 1781190011u, +2988893883u, 1554380634u, +1142264800u, 3667013118u, +1968445277u, 315203929u, +2638023604u, 2290487377u, +732137533u, 1909203251u, +440398219u, 1891630171u, +1380301172u, 1498556724u, +4072067757u, 4165088768u, +4204318635u, 441430649u, +3931792696u, 197618179u, +956300927u, 914413116u, +3010839769u, 2837339569u, +2148126371u, 1913303225u, +3074915312u, 3117299654u, +4139181436u, 2993479124u, +3178848746u, 1357272220u, +1438494951u, 507436733u, +667183474u, 2084369203u, +3854939912u, 1413396341u, +126024219u, 146044391u, +1016656857u, 3022024459u, +3254014218u, 429095991u, +990500595u, 3056862311u, +985653208u, 1718653828u, +623071693u, 366414107u, +1771289760u, 2293458109u, +3047342438u, 2991127487u, +3120876698u, 1684583131u, +3638043310u, 1170404994u, +863214540u, 1087193030u, +199124911u, 520792961u, +3169775996u, 1577421232u, +3331828431u, 1013201099u, +1716848157u, 4033596884u, +1770708857u, 4229339322u, +1146169032u, 1434258493u, +3824360466u, 3242407770u, +1926419493u, 2649785113u, +872586426u, 762243036u, +2736953692u, 816692935u, +1571283333u, 3555213933u, +2266795890u, 3781899767u, +4290630595u, 517646945u, +3006163611u, 2180594090u, +959214578u, 558910384u, +1283799121u, 3047062993u, +3830962609u, 2391606125u, +3544509313u, 622325861u, +834785312u, 382936554u, +1421463872u, 788479970u, +1825135056u, 2725923798u, +580988377u, 2826990641u, +247825043u, 3167748333u, +812546227u, 2506885666u, +2584372201u, 1758123094u, +1891789696u, 389974094u, +345313518u, 2022370576u, +3886113119u, 3338548567u, +1083486947u, 2583576230u, +1776047957u, 1771384107u, +3604937815u, 3198590202u, +3027522813u, 4155628142u, +4232136669u, 427759438u, +4244322689u, 542201663u, +1549591985u, 2856634168u, +556609672u, 45845311u, +1175961330u, 3948351189u, +4165739882u, 4194218315u, +1634635545u, 4151937410u, +713127376u, 1467786451u, +1327394015u, 2743592929u, +2638154051u, 810082938u, +3077742128u, 1062268187u, +4084325664u, 3810665822u, +3735739145u, 2794294783u, +2335576331u, 2560479831u, +690240711u, 997658837u, +2442302747u, 3948961926u, +3958366652u, 3067277639u, +2059157774u, 1211737169u, +1516711748u, 2339636583u, +4188504038u, 59581167u, +2767897792u, 1389679610u, +2658147000u, 2643979752u, +3758739543u, 4189944477u, +1454470782u, 100876854u, +2995362413u, 118817200u, +3252925478u, 2062343506u, +2804483644u, 3088828656u, +1231633714u, 4168280671u, +2931588131u, 3284356565u, +1255909792u, 3130054947u, +4173605289u, 1407328702u, +1677744031u, 3532596884u, +3162657845u, 3887208531u, +2256541290u, 3459463480u, +3740979556u, 259034107u, +392987633u, 3233195759u, +3606709555u, 3424793077u, +315836068u, 3200749877u, +4065431359u, 760633989u, +2982018998u, 1811050648u, +234531934u, 1115203611u, +3897494162u, 1516407838u, +1603559457u, 323296368u, +2632963283u, 1778459926u, +2879836826u, 2146672889u, +3486330348u, 492621815u, +1231665285u, 2457048126u, +3438440082u, 2217471853u, +3355404249u, 3275550588u, +1052645068u, 862072556u, +4110617119u, 3745267835u, +2657392572u, 4279236653u, +1688445808u, 701920051u, +956734128u, 581695350u, +3157862788u, 2585726058u, +1192588249u, 1410111809u, +1651193125u, 3326135446u, +1073280453u, 97376972u, +2513844237u, 2187968410u, +3976859649u, 4267859263u, +3429034542u, 564493077u, +3000537321u, 479241367u, +3845637831u, 2868987960u, +51544337u, 1029173765u, +393624922u, 704325635u, +2357610553u, 1418509533u, +2007814586u, 3866658271u, +3082385053u, 735688735u, +916110004u, 3283299459u, +1051684175u, 1083796807u, +4074716319u, 813690332u, +144264390u, 1439630796u, +1508556987u, 675582689u, +3748881891u, 3195309868u, +362884708u, 1616408198u, +43233176u, 837301135u, +881504822u, 3254795114u, +1385506591u, 2799925823u, +1469874582u, 3464841997u, +497175391u, 3929484338u, +3975771289u, 1798536177u, +2926265846u, 1374242438u, +3675707838u, 4205965408u, +3153165629u, 1499475160u, +187287713u, 548490821u, +3255259608u, 4247675634u, +1940181471u, 3779953975u, +687167150u, 2319566715u, +1742785722u, 785893184u, +2296977392u, 2778575413u, +1794720651u, 48131484u, +4084891412u, 1160134629u, +3737623280u, 823113169u, +3423207646u, 3803213486u, +710625654u, 4116162021u, +3693420287u, 4167766971u, +1666602807u, 295320990u, +3513255468u, 2487440590u, +234080704u, 4004655503u, +2971762528u, 1479656873u, +4090178629u, 4044418876u, +391947536u, 1462554406u, +3909295855u, 1239580330u, +1515601363u, 2011102035u, +1442068334u, 4265993528u, +1191921695u, 2291355695u, +4257172787u, 576405853u, +314332944u, 4038839101u, +55559918u, 2378985842u, +711098718u, 2425317635u, +1644327317u, 1401013391u, +4193760037u, 2958260436u, +3167371443u, 3062418115u, +3800755475u, 3167030094u, +3489648204u, 1405430357u, +526177822u, 2602636307u, +915406019u, 4264167741u, +1484090483u, 3070944737u, +254529415u, 4017058800u, +1702710265u, 1029665228u, +2000382906u, 3185573940u, +1381258384u, 4036354071u, +2900841028u, 2670703363u, +2921748807u, 2899069938u, +4130543625u, 688472265u, +4186808827u, 1054670286u, +1132985391u, 2840525968u, +4175776103u, 338058159u, +1735964501u, 1539305024u, +3497121710u, 1568260669u, +2227290760u, 146827036u, +3977176001u, 4060134777u, +857488494u, 250055052u, +4284109679u, 2502815838u, +2592281721u, 1603444633u, +1390562014u, 1556658131u, +616327404u, 2448966429u, +3051191726u, 3891353218u, +1213304082u, 762328245u, +2239052397u, 1082330589u, +2455957292u, 201837927u, +405397452u, 3079886794u, +2583939798u, 2848283092u, +3750724631u, 883849006u, +3204198988u, 3341327098u, +1855234968u, 1982110346u, +1485529487u, 541496720u, +4117290321u, 3607433551u, +2168864636u, 133643215u, +1055817409u, 3847827123u, +2960769387u, 4046101649u, +1176127003u, 4015671361u, +4243643405u, 2849988118u, +517111221u, 1796672358u, +2045051700u, 3452457457u, +2948254999u, 2102063419u, +1556410577u, 1536380876u, +3776661467u, 3281002516u, +1735616066u, 1539151988u, +1087795162u, 3332431596u, +685631442u, 1147951686u, +95237878u, 2005032160u, +4012206915u, 4224354805u, +3204999386u, 2415262714u, +1433635018u, 116647396u, +83167836u, 2881562655u, +2729416454u, 1029284767u, +881378302u, 2159170082u, +555057366u, 1169104445u, +3963877000u, 1919171906u, +336034862u, 2017579106u, +4059340529u, 3020819343u, +865146997u, 2473524405u, +944743644u, 1694443528u, +1804513294u, 2904752429u, +617975720u, 3671562289u, +260177668u, 505662155u, +1885941445u, 2504509403u, +2260041112u, 1019936943u, +3722741628u, 1511077569u, +3100701179u, 1379422864u, +1535670711u, 773792826u, +1103819072u, 2089123665u, +1157547425u, 329152940u, +4142587430u, 484732447u, +2475035432u, 1120017626u, +412145504u, 965125959u, +324924679u, 2809286837u, +2842141483u, 4029205195u, +2974306813u, 515627448u, +3791551981u, 1097806406u, +3873078673u, 136118734u, +1872130856u, 3632422367u, +3574135531u, 4017075736u, +1699452298u, 1403506686u, +344414660u, 1189129691u, +3487080616u, 1516736273u, +1805475756u, 2562064338u, +163335594u, 2732147834u, +4077452507u, 2984955003u, +4271866024u, 3071338162u, +2347111903u, 873829983u, +1948409509u, 1923531348u, +459509140u, 771592405u, +1750124750u, 2334938333u, +213811117u, 2586632018u, +185232757u, 4032960199u, +2447383637u, 284777551u, +1654276320u, 2687561076u, +3512945009u, 308584855u, +1861027147u, 4102279334u, +3203802620u, 1692079268u, +4250142168u, 2565680167u, +1507046104u, 841195925u, +520565830u, 3674576684u, +38924274u, 3770488806u, +2414430882u, 3978473838u, +3703994407u, 69201295u, +3099963860u, 1255084262u, +690971838u, 3539996781u, +3696902571u, 3593730713u, +2363435042u, 54945052u, +1785765213u, 184911581u, +1586241476u, 1939595371u, +2534883189u, 2432427547u, +2374171993u, 2039128933u, +2955715987u, 2295501078u, +2741583197u, 1280920000u, +686818699u, 1238742497u, +3843660102u, 82177963u, +1281043691u, 1121403845u, +1697846708u, 284852964u, +278661677u, 2889101923u, +2127558730u, 713121337u, +872502474u, 511142139u, +1261140657u, 1747052377u, +2108187161u, 927011680u, +955328267u, 3821994995u, +2707230761u, 4142246789u, +4134691985u, 1958963937u, +2498463509u, 1977988705u, +1419293714u, 1636932722u, +2567532373u, 4075249328u, +240575705u, 1956681213u, +2598802768u, 2025886508u, +4104757832u, 3026358429u, +3242615202u, 4026813725u, +255108733u, 1845587644u, +3573008472u, 3615577014u, +1222733548u, 1205557630u, +917608574u, 1363253259u, +1541946015u, 3087190425u, +1138008081u, 1444019663u, +109793386u, 341851980u, +857839960u, 2515339233u, +156283211u, 1906768669u, +3886713057u, 1276595523u, +2809830736u, 460237542u, +3420452099u, 142985419u, +205970448u, 4198897105u, +1950698961u, 2069753399u, +1142216925u, 1113051162u, +1033680610u, 4278599955u, +1106466069u, 356742959u, +531521052u, 3494863964u, +225629455u, 3735275001u, +3662626864u, 1750561299u, +1012864651u, 2101846429u, +1074553219u, 668829411u, +992181339u, 3384018814u, +3330664522u, 860966321u, +1885071395u, 4233785523u, +100741310u, 451656820u, +2148187612u, 1063001151u, +360256231u, 107312677u, +3650357479u, 2390172694u, +22452685u, 237319043u, +3600462351u, 1216645846u, +2088767754u, 164402616u, +2418980170u, 926137824u, +94638678u, 1689811113u, +2751052984u, 1767810825u, +271289013u, 3896132233u, +103797041u, 1397772514u, +3441135892u, 3323383489u, +2491268371u, 1662561885u, +1612872497u, 2986430557u, +2756998822u, 207428029u, +937973965u, 2791656726u, +1949717207u, 2260498180u, +2648427775u, 2360400900u, +2080496169u, 486358863u, +1582022990u, 1263709570u, +1396468647u, 1377764574u, +363008508u, 1293502429u, +224580012u, 4252610345u, +1435134775u, 1099809675u, +533671980u, 1533438766u, +1820532305u, 2776960536u, +3374512975u, 3542220540u, +822810075u, 3716663290u, +1157398049u, 3752806924u, +4081637863u, 337070226u, +3866585976u, 359270190u, +2110942730u, 3267551635u, +644850146u, 1306761320u, +746972907u, 934259457u, +2341378668u, 2220373824u, +1242645122u, 4109252858u, +1625266099u, 1173698481u, +383517064u, 896322512u, +3377483696u, 1788337208u, +455496839u, 3194373887u, +1837689083u, 1336556841u, +1658628529u, 2911512007u, +3838343487u, 2757664765u, +1537187340u, 3712582785u, +367022558u, 3071359622u, +3926147070u, 35432879u, +3093195926u, 2561488770u, +4273132307u, 3898950547u, +2838251049u, 2103926083u, +2549435227u, 536047554u, +1858986613u, 2040551642u, +1147412575u, 1972369852u, +4166184983u, 3528794619u, +4077477194u, 3565689036u, +808048238u, 3826350461u, +1359641525u, 1197100813u, +265993036u, 1864569342u, +725164342u, 2264788336u, +1831223342u, 3329594980u, +923017956u, 490608221u, +3818634478u, 258154469u, +1441714797u, 1174785921u, +3833372385u, 3287246572u, +1677395563u, 3569218731u, +868981704u, 2163330264u, +2649450292u, 500120236u, +465161780u, 746438382u, +1145009669u, 2520062970u, +2810524030u, 1561519055u, +1479878006u, 3864969305u, +2686075657u, 4042710240u, +3224066062u, 2774151984u, +2226179547u, 1643626042u, +2328730865u, 3160666939u, +2107011431u, 96459446u, +3920328742u, 3336407558u, +829404209u, 1878067032u, +1235983679u, 4237425634u, +466519055u, 3870676863u, +934312076u, 2952135524u, +276949224u, 4100839753u, +424001484u, 1955120893u, +4015478120u, 1265237690u, +427484362u, 4246879223u, +3452969617u, 1724363362u, +1553513184u, 834830418u, +1858777639u, 3476334357u, +4144030366u, 2450047160u, +2950762705u, 4277111759u, +358032121u, 2511026735u, +167923105u, 2059208280u, +251949572u, 3065234219u, +1535473864u, 556796152u, +1513237478u, 3150857516u, +1103404394u, 198182691u, +1476438092u, 2913077464u, +207119516u, 3963810232u, +2954651680u, 1535115487u, +3051522276u, 4046477658u, +917804636u, 864395565u, +632704095u, 140762681u, +1802040304u, 990407433u, +3771506212u, 4106024923u, +1287729497u, 2198985327u, +4052924496u, 2926590471u, +3084557148u, 1472898694u, +1009870118u, 559702706u, +4265214507u, 82077489u, +3067891003u, 3295678907u, +2402308151u, 1096697687u, +464407878u, 4190838199u, +4269578403u, 3060919438u, +2899950405u, 3046872820u, +733509243u, 1583801700u, +40453902u, 3879773881u, +1993425202u, 2185339100u, +1877837196u, 3912423882u, +3293122640u, 4104318469u, +1679617763u, 3703603898u, +8759461u, 2540185277u, +1152198475u, 2038345882u, +2503579743u, 1446869792u, +2019419351u, 4051584612u, +3178289407u, 3992503830u, +2879018745u, 2719373510u, +700836153u, 1675560450u, +4121245793u, 2064715719u, +343595772u, 1996164093u, +3130433948u, 405251683u, +2804817126u, 1607133689u, +463852893u, 2864244470u, +2224044848u, 4071581802u, +2537107938u, 2246347953u, +3207234525u, 2028708916u, +2272418128u, 803575837u, +38655481u, 2170452091u, +3272166407u, 557660441u, +4019147902u, 3841480082u, +298459606u, 2600943364u, +2440657523u, 255451671u, +3424361375u, 779434428u, +3088526123u, 490671625u, +1322855877u, 3452203069u, +3057021940u, 2285701422u, +2014993457u, 2390431709u, +2002090272u, 1568745354u, +1783152480u, 823305654u, +4053862835u, 2200236540u, +3009412313u, 3184047862u, +3032187389u, 4159715581u, +2966902888u, 252986948u, +1849329144u, 3160134214u, +3420960112u, 3198900547u, +749160960u, 379139040u, +1208883495u, 1566527339u, +3006227299u, 4194096960u, +556075248u, 497404038u, +1717327230u, 1496132623u, +1775955687u, 1719108984u, +1014328900u, 4189966956u, +2108574735u, 2584236470u, +684087286u, 531310503u, +4264509527u, 773405691u, +3088905079u, 3456882941u, +3105682208u, 3382290593u, +2289363624u, 3296306400u, +4168438718u, 467441309u, +777173623u, 3241407531u, +1183994815u, 1132983260u, +1610606159u, 2540270567u, +2649684057u, 1397502982u, +146657385u, 3318434267u, +2109315753u, 3348545480u, +3193669211u, 811750340u, +1073256162u, 3571673088u, +546596661u, 1017047954u, +3403136990u, 2540585554u, +1477047647u, 4145867423u, +2826408201u, 3531646869u, +784952939u, 943914610u, +2717443875u, 3657384638u, +1806867885u, 1903578924u, +3985088434u, 1911188923u, +1764002686u, 3672748083u, +1832925325u, 241574049u, +519948041u, 3181425568u, +2939747257u, 1634174593u, +3429894862u, 3529565564u, +1089679033u, 240953857u, +2025369941u, 2695166650u, +517086873u, 2964595704u, +3017658263u, 3828377737u, +2144895011u, 994799311u, +1184683823u, 4260564140u, +308018483u, 4262383425u, +1374752558u, 3431057723u, +1572637805u, 383233885u, +3188015819u, 4051263539u, +233319221u, 3794788167u, +2017406667u, 919677938u, +4074952232u, 1683612329u, +4213676186u, 327142514u, +3032591014u, 4204155962u, +206775997u, 2283918569u, +2395147154u, 3427505379u, +2211319468u, 4153726847u, +2217060665u, 350160869u, +2493667051u, 1648200185u, +3441709766u, 1387233546u, +140980u, 1891558063u, +760080239u, 2088061981u, +1580964938u, 740563169u, +422986366u, 330624974u, +4264507722u, 150928357u, +2738323042u, 2948665536u, +918718096u, 376390582u, +3966098971u, 717653678u, +3219466255u, 3799363969u, +3424344721u, 3187805406u, +375347278u, 3490350144u, +1992212097u, 2263421398u, +3855037968u, 1928519266u, +3866327955u, 1129127000u, +1782515131u, 2746577402u, +3059200728u, 2108753646u, +2738070963u, 1336849395u, +1705302106u, 768287270u, +1343511943u, 2247006571u, +1956142255u, 1780259453u, +3475618043u, 212490675u, +622521957u, 917121602u, +1852992332u, 1267987847u, +3170016833u, 2549835613u, +3299763344u, 2864033668u, +3378768767u, 1236609378u, +4169365948u, 3738062408u, +2661022773u, 2006922227u, +2760592161u, 3828932355u, +2636387819u, 2616619070u, +1237256330u, 3449066284u, +2871755260u, 3729280948u, +3862686086u, 431292293u, +3285899651u, 786322314u, +2531158535u, 724901242u, +2377363130u, 1415970351u, +1244759631u, 3263135197u, +965248856u, 174024139u, +2297418515u, 2954777083u, +987586766u, 3206261120u, +4059515114u, 3903854066u, +1931934525u, 2287507921u, +1827135136u, 1781944746u, +574617451u, 2299034788u, +2650140034u, 4081586725u, +2482286699u, 1109175923u, +458483596u, 618705848u, +4059852729u, 1813855658u, +4190721328u, 1129462471u, +4089998050u, 3575732749u, +2375584220u, 1037031473u, +1623777358u, 3389003793u, +546597541u, 352770237u, +1383747654u, 3122687303u, +1646071378u, 1164309901u, +290870767u, 830691298u, +929335420u, 3193251135u, +989577914u, 3626554867u, +591974737u, 3996958215u, +3163711272u, 3071568023u, +1516846461u, 3656006011u, +2698625268u, 2510865430u, +340274176u, 1167681812u, +3698796465u, 3155218919u, +4102288238u, 1673474350u, +3069708839u, 2704165015u, +1237411891u, 1854985978u, +3646837503u, 3625406022u, +921552000u, 1712976649u, +3939149151u, 878608872u, +3406359248u, 1068844551u, +1834682077u, 4155949943u, +2437686324u, 3163786257u, +2645117577u, 1988168803u, +747285578u, 1626463554u, +1235300371u, 1256485167u, +1914142538u, 4141546431u, +3838102563u, 582664250u, +1883344352u, 2083771672u, +2611657933u, 2139079047u, +2250573853u, 804336148u, +3066325351u, 2770847216u, +4275641370u, 1455750577u, +3346357270u, 1674051445u, +601221482u, 3992583643u, +1402445097u, 3622527604u, +2509017299u, 2966108111u, +2557027816u, 900741486u, +1790771021u, 2912643797u, +2631381069u, 4014551783u, +90375300u, 300318232u, +3269968032u, 2679371729u, +2664752123u, 3517585534u, +3253901179u, 542270815u, +1188641600u, 365479232u, +2210121140u, 760762191u, +1273768482u, 1216399252u, +3484324231u, 4287337666u, +16322182u, 643179562u, +325675502u, 3652676161u, +3120716054u, 3330259752u, +1011990087u, 2990167340u, +1097584090u, 3262252593u, +1829409951u, 3665087267u, +1214854475u, 2134299399u, +3704419305u, 411263051u, +1625446136u, 549838529u, +4283196353u, 1342880802u, +3460621305u, 1967599860u, +4282843369u, 1275671016u, +2544665755u, 853593042u, +901109753u, 2682611693u, +110631633u, 797487791u, +1472073141u, 850464484u, +797089608u, 3286110054u, +350397471u, 2775631060u, +366448238u, 3842907484u, +2219863904u, 3623364733u, +1850985302u, 4009616991u, +294963924u, 3693536939u, +3061255808u, 1615375832u, +1920066675u, 4113028420u, +4032223840u, 2318423400u, +2701956286u, 4145497671u, +3991532344u, 2536338351u, +1679099863u, 1728968857u, +449740816u, 2686506989u, +685242457u, 97590863u, +3258354115u, 1502282913u, +1235084019u, 2151665147u, +528459289u, 231097464u, +2477280726u, 3651607391u, +2091754612u, 1178454681u, +980597335u, 1604483865u, +1842333726u, 4146839064u, +3213794286u, 2601416506u, +754220096u, 3571436033u, +488595746u, 1448097974u, +4004834921u, 238887261u, +3320337489u, 1416989070u, +2928916831u, 4093725287u, +186020771u, 2367569534u, +3046087671u, 4090084518u, +3548184546u, 679517009u, +1962659444u, 3539886328u, +4192003933u, 1678423485u, +3827951761u, 3086277222u, +2144472852u, 1390394371u, +2976322029u, 1574517163u, +3553313841u, 119173722u, +1702434637u, 1766260771u, +3629581771u, 1407497759u, +895654784u, 751439914u, +4008409498u, 215917713u, +1482103833u, 695551833u, +1288382231u, 2656990891u, +2581779077u, 1570750352u, +3710689053u, 1741390464u, +2666411616u, 3533987737u, +4289478316u, 3576119563u, +4118694920u, 108199666u, +3869794273u, 963183826u, +2081410737u, 3796810515u, +791123882u, 2525792704u, +1036883117u, 136547246u, +875691100u, 2592925324u, +614302599u, 3013176417u, +2689342539u, 427154472u, +532957601u, 1228758574u, +1898117151u, 1181643858u, +1908591042u, 1464255968u, +446980910u, 2984611177u, +58509511u, 1046943619u, +3508927906u, 2001585786u, +2544767379u, 1525438381u, +552181222u, 1959725830u, +879448844u, 1348536411u, +4242243590u, 2861338018u, +1082052441u, 1034351453u, +601175800u, 764077711u, +530635011u, 3785343245u, +2178026726u, 117256687u, +2378297261u, 457568934u, +76438221u, 4104954272u, +956793873u, 3783168634u, +2485968477u, 2381948487u, +4226929450u, 3148473363u, +2518273601u, 3569490233u, +879369091u, 2180270337u, +3674375989u, 1387729170u, +977997984u, 4270646856u, +568650985u, 951677556u, +4213877384u, 2721005055u, +1073364549u, 2563403831u, +1678669911u, 66786703u, +2273631661u, 1149351924u, +3651298990u, 1581883443u, +246723096u, 1895026827u, +3810605772u, 3711056516u, +4058833288u, 2193790614u, +2080120290u, 3638638708u, +2915672708u, 2263003308u, +2361934197u, 4136767460u, +1976115991u, 3448840877u, +2019238520u, 225333538u, +874340815u, 2976159827u, +1555273378u, 3797521928u, +1942347150u, 3262952567u, +435997738u, 340403353u, +2817830907u, 2078619498u, +749534111u, 1178073973u, +894654712u, 3361226032u, +841092198u, 3288261538u, +1696412169u, 1496966875u, +697501571u, 1059158875u, +3739946319u, 2481012988u, +568983526u, 114945840u, +1559249010u, 2218244008u, +2841706923u, 1632780103u, +4020169654u, 2087949619u, +2438736103u, 24032648u, +833416317u, 3787017905u, +2373238993u, 2575395164u, +3434544481u, 3228481067u, +2542976862u, 2971726178u, +2880371864u, 3642087909u, +2407477975u, 2239080836u, +1043714217u, 3894199764u, +2235879182u, 203853421u, +2933669448u, 2504940536u, +834683330u, 425935223u, +3560796393u, 3565833278u, +1668000829u, 3683399154u, +3414330886u, 1748785729u, +1023171602u, 580966986u, +2531038985u, 3227325488u, +2657385925u, 2124704694u, +233442446u, 1107045577u, +3407293834u, 552770757u, +3899097693u, 1067532701u, +115667924u, 1406028344u, +1707768231u, 3724015962u, +2419657149u, 18613994u, +2532882091u, 3476683808u, +1560838678u, 811220224u, +895961699u, 3762914298u, +1328752423u, 1844996900u, +1420427894u, 1848067707u, +1210281744u, 904215228u, +4055325594u, 1118521573u, +2496554183u, 2579259919u, +3996647489u, 3657647605u, +325254059u, 3136157065u, +3951522674u, 4052925250u, +3341068436u, 2287683323u, +1313073005u, 126005630u, +2505120084u, 1194725057u, +853746559u, 3555092974u, +2689238752u, 49515858u, +1244776042u, 1069300695u, +61073168u, 1010661841u, +1269521335u, 1902040126u, +990632502u, 2378708922u, +3858321250u, 1400735275u, +2974699176u, 2771676666u, +170995186u, 2877798589u, +545726212u, 2225229957u, +1086473152u, 3454177594u, +3859483262u, 1499729584u, +2088002891u, 2883475137u, +3222194252u, 4144472319u, +2212229854u, 4146740722u, +567988835u, 1051332394u, +3932046135u, 542648229u, +3017852446u, 1277887997u, +162888005u, 1669710469u, +1492500905u, 553041029u, +1434876932u, 533989516u, +3817492747u, 584127807u, +4147115982u, 2993670925u, +4020312558u, 710021255u, +3509733475u, 3587959456u, +2088550465u, 1745399498u, +2952242967u, 1259815443u, +869648362u, 1404723176u, +3947542735u, 1334333531u, +3873471582u, 229399758u, +59634866u, 3239516985u, +3844250972u, 1275954779u, +492891666u, 1029533080u, +1552951157u, 367320647u, +699480890u, 3684418197u, +3707014310u, 471105777u, +1824587258u, 4030809053u, +3489914436u, 484559105u, +1235750398u, 1428453396u, +4230459084u, 4255931645u, +1848597055u, 4271715616u, +331780381u, 482425775u, +2435323270u, 3171911678u, +3507210587u, 928543347u, +4197807526u, 3680046204u, +2766042024u, 2159512867u, +179373257u, 313902234u, +4024837592u, 294795361u, +1622282562u, 647086234u, +2825039429u, 577214736u, +4043412446u, 2426981244u, +1277736097u, 1130129573u, +2601395338u, 995791646u, +36668922u, 3344746679u, +1521532225u, 1645086060u, +2622763015u, 4122335794u, +2936887705u, 494465807u, +2580840343u, 1064648931u, +1247887787u, 2752145076u, +1277612417u, 1249660507u, +2288678613u, 3312498873u, +2459273912u, 4238535494u, +3117488020u, 2571979978u, +2680188909u, 1471227427u, +1616494033u, 633688562u, +2268653416u, 3268237290u, +3021962815u, 1959779970u, +3321382074u, 766642813u, +204429780u, 1323319858u, +3676032891u, 1380896111u, +4030639049u, 3647601207u, +1830028502u, 2830263774u, +1375962216u, 1733961041u, +939765180u, 521947915u, +3903267364u, 497472767u, +1619700946u, 189164145u, +3115593885u, 486382294u, +1262445920u, 4062496162u, +2464795849u, 3770038872u, +4032121374u, 3235740744u, +3757765258u, 1777199847u, +2167243108u, 1912506671u, +4180515317u, 2276864677u, +536034089u, 2384915026u, +162938278u, 1588060152u, +4018349945u, 2504457929u, +841450426u, 2790120722u, +2719983588u, 1471020554u, +1390856732u, 3623212998u, +2506944218u, 1035080801u, +348812127u, 3026631806u, +746483541u, 2342164722u, +122104390u, 4074122771u, +3986865419u, 1674890530u, +3693306023u, 3011542850u, +1294951725u, 899303190u, +3577146915u, 3549160092u, +1241677652u, 4290680005u, +3193053279u, 2029187390u, +3298063095u, 3943068002u, +3946220635u, 2273781461u, +889053698u, 1376304022u, +1486839612u, 2127663659u, +344127443u, 1646681121u, +2780117810u, 2142045764u, +2694572773u, 447810651u, +2185527146u, 2366308558u, +290335413u, 584901173u, +2012370276u, 970504950u, +3258236042u, 2008155560u, +3945579565u, 614796295u, +24452072u, 2695940969u, +3983727134u, 3444688454u, +1327044473u, 3545633451u, +1875293322u, 1739318893u, +1707527799u, 2683090634u, +2848082386u, 2814622471u, +4111401777u, 2774816580u, +3849839194u, 437560100u, +2238350150u, 2462124836u, +665017710u, 512012738u, +2945294779u, 3305170944u, +819477765u, 59419271u, +155125658u, 665292744u, +444722813u, 3580039116u, +2355675635u, 663735032u, +3247800169u, 1579404983u, +1985115003u, 3397891494u, +358696453u, 1474896279u, +516388613u, 710590371u, +3490497111u, 2514565805u, +2386143445u, 477509654u, +412854590u, 3624609754u, +3214388668u, 3516075816u, +2731288520u, 1369482895u, +4033204378u, 1314000850u, +829769325u, 1935166880u, +1608191643u, 2607067237u, +423820371u, 3257747610u, +1355298041u, 3776931214u, +4105054901u, 2107080812u, +1911521879u, 3183054185u, +3910177801u, 675129307u, +1209358971u, 4205727791u, +1435726287u, 3333261712u, +1400982708u, 1154611403u, +1663501483u, 2837596667u, +3164734053u, 2759854023u, +4012043629u, 1963228038u, +3981675284u, 2677557877u, +520119591u, 505138315u, +897271356u, 1803966773u, +1016663294u, 616691903u, +2254742522u, 4032705384u, +2468470796u, 798395739u, +3025169002u, 3570037122u, +1461093710u, 3473799845u, +3702624858u, 476400898u, +1043039728u, 2304070437u, +181576948u, 602972493u, +3996616030u, 3289878097u, +2068516226u, 3922247304u, +1299968266u, 2520311409u, +1968824721u, 3214794876u, +1581813122u, 2668800905u, +3297613974u, 748160407u, +1145536484u, 1326769504u, +2973323521u, 3775262814u, +3218653169u, 902775872u, +3498603433u, 1372805534u, +704686363u, 3626542352u, +2271580579u, 1213925114u, +46329775u, 3009384989u, +1330254048u, 1194824134u, +514204310u, 3781981134u, +442526164u, 2835608783u, +3460471867u, 510634034u, +546406434u, 2716786748u, +2840500021u, 1669490957u, +2536189149u, 3251421224u, +1358736072u, 1089334066u, +3260749330u, 250756920u, +2974806681u, 1513718866u, +82635635u, 4041016629u, +3391765744u, 2495807367u, +3962674316u, 2822889695u, +753413337u, 2008251381u, +3123390177u, 106212622u, +490570565u, 1684884205u, +793892547u, 1927268995u, +2344148164u, 2251978818u, +437424236u, 2774023200u, +2674940754u, 3788056262u, +2597882666u, 3678660147u, +3797434193u, 3838215866u, +279687080u, 2656772270u, +2190204787u, 1997584981u, +3384401882u, 3160208845u, +3629379425u, 2668998785u, +1050036757u, 2954162084u, +917091826u, 1744374041u, +1454282570u, 845687881u, +2997173625u, 776018378u, +1137560602u, 1938378389u, +1748082354u, 2066910012u, +2677675207u, 918315064u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; { uint64_t h = farmhashte::Hash64WithSeeds(data, len++, SEED0, SEED1); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashte::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashte::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +{ uint64_t h = farmhashte::Hash64WithSeeds(data + offset, len, SEED0, SEED1); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashte::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashte::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashteTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +{ uint64_t h = farmhashte::Hash64WithSeeds(data + offset, len, SEED0, SEED1); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashte::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashte::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashteTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashteTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashteTest::Dump(0, i); + } + farmhashteTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashuoTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +3277735313u, 2681724312u, +2598464059u, 797982799u, +2603993599u, 921001710u, +1410420968u, 2134990486u, +2914424215u, 2244477846u, +255297188u, 2992121793u, +161451183u, 3943596029u, +4019337850u, 452431531u, +3379021470u, 2557197665u, +299850021u, 2532580744u, +1298374911u, 3099673830u, +2199864459u, 3696623795u, +4055299123u, 3281581178u, +1053458494u, 1882212500u, +3456121707u, 275903667u, +458884671u, 3033004529u, +1898235244u, 1402319660u, +2700149065u, 2699376854u, +2433714046u, 4222949502u, +4220361840u, 1712034059u, +4148372108u, 1330324210u, +594028478u, 2921867846u, +780716741u, 1728752234u, +3280331829u, 326029180u, +393215742u, 3349570000u, +3824583307u, 1612122221u, +1379537552u, 1646032583u, +2233466664u, 1432476832u, +2052294713u, 3552092450u, +1628777059u, 1499109081u, +2960536756u, 1554038301u, +1145519619u, 3190844552u, +237495366u, 540224401u, +65721842u, 489963606u, +1596489240u, 1562872448u, +1790705123u, 2128624475u, +1435705557u, 1262831810u, +155445229u, 1672724608u, +663607706u, 2077310004u, +3610042449u, 1911523866u, +2563776023u, 294527927u, +1099072299u, 1389770549u, +2952353448u, 2026137563u, +3603803785u, 629449419u, +226132789u, 2489287368u, +1552847036u, 645684964u, +187883449u, 230403464u, +3151491850u, 3272648435u, +2002861219u, 165370827u, +916494250u, 1230085527u, +3807265751u, 3628174014u, +231181488u, 851743255u, +2988893883u, 1554380634u, +1142264800u, 3667013118u, +2638023604u, 2290487377u, +732137533u, 1909203251u, +1380301172u, 1498556724u, +4072067757u, 4165088768u, +3931792696u, 197618179u, +956300927u, 914413116u, +2148126371u, 1913303225u, +3074915312u, 3117299654u, +3178848746u, 1357272220u, +1438494951u, 507436733u, +3854939912u, 1413396341u, +126024219u, 146044391u, +3254014218u, 429095991u, +165589978u, 1578546616u, +623071693u, 366414107u, +249776086u, 1207522198u, +3120876698u, 1684583131u, +46987739u, 1157614300u, +199124911u, 520792961u, +3614377032u, 586863115u, +1716848157u, 4033596884u, +1164298657u, 4140791139u, +3824360466u, 3242407770u, +3725511003u, 232064808u, +2736953692u, 816692935u, +512845449u, 3748861010u, +4290630595u, 517646945u, +22638523u, 648000590u, +1283799121u, 3047062993u, +1024246061u, 4027776454u, +834785312u, 382936554u, +411505255u, 1973395102u, +580988377u, 2826990641u, +3474970689u, 1029055034u, +2584372201u, 1758123094u, +589567754u, 325737734u, +3886113119u, 3338548567u, +257578986u, 3698087965u, +3604937815u, 3198590202u, +2305332220u, 191910725u, +4244322689u, 542201663u, +3315355162u, 2135941665u, +1175961330u, 3948351189u, +23075771u, 3252374102u, +713127376u, 1467786451u, +663013031u, 3444053918u, +3077742128u, 1062268187u, +2115441882u, 4081398201u, +2335576331u, 2560479831u, +1379288194u, 4225182569u, +3958366652u, 3067277639u, +3667516477u, 1709989541u, +4188504038u, 59581167u, +2725013602u, 3639843023u, +3758739543u, 4189944477u, +2470483982u, 877580602u, +3252925478u, 2062343506u, +3981838403u, 3762572073u, +2931588131u, 3284356565u, +1129162571u, 732225574u, +1677744031u, 3532596884u, +3232041815u, 1652884780u, +3740979556u, 259034107u, +2227121257u, 1426140634u, +315836068u, 3200749877u, +1386256573u, 24035717u, +234531934u, 1115203611u, +1598686658u, 3146815575u, +2632963283u, 1778459926u, +739944537u, 579625482u, +1231665285u, 2457048126u, +3903349120u, 389846205u, +1052645068u, 862072556u, +2834153464u, 1481069623u, +1688445808u, 701920051u, +3740748788u, 3388062747u, +1192588249u, 1410111809u, +2633463887u, 4050419847u, +2513844237u, 2187968410u, +2951683019u, 3015806005u, +3000537321u, 479241367u, +252167538u, 1231057113u, +393624922u, 704325635u, +1467197045u, 2066433573u, +3082385053u, 735688735u, +956434529u, 4028590195u, +4074716319u, 813690332u, +2124740535u, 804073145u, +3748881891u, 3195309868u, +841856605u, 2585865274u, +881504822u, 3254795114u, +1241815736u, 970796142u, +497175391u, 3929484338u, +4264993211u, 1835322201u, +3675707838u, 4205965408u, +300298607u, 3858319990u, +3255259608u, 4247675634u, +1095823272u, 1197245408u, +1742785722u, 785893184u, +1702965674u, 850401405u, +4084891412u, 1160134629u, +2555998391u, 1972759056u, +710625654u, 4116162021u, +3352753742u, 85121177u, +3513255468u, 2487440590u, +2480032715u, 2287747045u, +4090178629u, 4044418876u, +1703944517u, 486290428u, +1515601363u, 2011102035u, +573985957u, 3536053779u, +4257172787u, 576405853u, +1523550693u, 1014952061u, +711098718u, 2425317635u, +3460807169u, 3688987163u, +3167371443u, 3062418115u, +3330028292u, 1713171303u, +526177822u, 2602636307u, +1245357025u, 3346699703u, +254529415u, 4017058800u, +1829738451u, 2164236533u, +1381258384u, 4036354071u, +1749181924u, 4118435443u, +4130543625u, 688472265u, +2731071299u, 2547657502u, +4175776103u, 338058159u, +3729582129u, 4181845558u, +2227290760u, 146827036u, +2459178427u, 1025353883u, +4284109679u, 2502815838u, +825124804u, 2533140036u, +616327404u, 2448966429u, +413992636u, 2334782461u, +2239052397u, 1082330589u, +3381164715u, 199381437u, +2583939798u, 2848283092u, +2300168091u, 2156336315u, +1855234968u, 1982110346u, +2482046810u, 3158163887u, +2168864636u, 133643215u, +3904021624u, 3646514568u, +1176127003u, 4015671361u, +100525019u, 3534706803u, +2045051700u, 3452457457u, +1492267772u, 2308393828u, +3776661467u, 3281002516u, +4246334524u, 743955039u, +685631442u, 1147951686u, +2040912376u, 2911148054u, +3204999386u, 2415262714u, +313209105u, 777065474u, +2729416454u, 1029284767u, +1632078298u, 1817552554u, +3963877000u, 1919171906u, +3843219958u, 3073580867u, +865146997u, 2473524405u, +2593817617u, 3643076308u, +617975720u, 3671562289u, +121812599u, 2902367378u, +2260041112u, 1019936943u, +320945955u, 2337845588u, +1535670711u, 773792826u, +3152195900u, 4090794518u, +4142587430u, 484732447u, +419191319u, 3377973345u, +324924679u, 2809286837u, +1562277603u, 1378362199u, +3791551981u, 1097806406u, +1386297408u, 2304900033u, +3574135531u, 4017075736u, +1161238398u, 1358056883u, +3487080616u, 1516736273u, +851615042u, 2927899494u, +4077452507u, 2984955003u, +3907754394u, 3578173844u, +1948409509u, 1923531348u, +3578472493u, 3710074193u, +213811117u, 2586632018u, +1922589216u, 274958014u, +1654276320u, 2687561076u, +2569061755u, 3122046057u, +3203802620u, 1692079268u, +477806878u, 140587742u, +520565830u, 3674576684u, +91246882u, 1010215946u, +3703994407u, 69201295u, +776213083u, 3677771507u, +3696902571u, 3593730713u, +2907901228u, 3239753796u, +1586241476u, 1939595371u, +2268396558u, 3468719670u, +2955715987u, 2295501078u, +2775848696u, 1358532390u, +3843660102u, 82177963u, +4094477877u, 191727221u, +278661677u, 2889101923u, +1352525614u, 2844977667u, +1261140657u, 1747052377u, +2334120653u, 645125282u, +2707230761u, 4142246789u, +1068639717u, 2288162940u, +1419293714u, 1636932722u, +3252686293u, 318543902u, +2598802768u, 2025886508u, +2250788464u, 2711763065u, +255108733u, 1845587644u, +3719270134u, 3940707863u, +917608574u, 1363253259u, +788659330u, 673256220u, +109793386u, 341851980u, +2698465479u, 3011229884u, +3886713057u, 1276595523u, +2439962760u, 2700515456u, +205970448u, 4198897105u, +875511891u, 371715572u, +1033680610u, 4278599955u, +3120038721u, 1256300069u, +225629455u, 3735275001u, +3961944123u, 1769389163u, +1074553219u, 668829411u, +1098679359u, 2573697509u, +1885071395u, 4233785523u, +2513878053u, 2030193788u, +360256231u, 107312677u, +310517502u, 2618936366u, +3600462351u, 1216645846u, +2970730323u, 4278812598u, +94638678u, 1689811113u, +4125738800u, 3103759730u, +103797041u, 1397772514u, +1669653333u, 572567964u, +1612872497u, 2986430557u, +214990655u, 3117607990u, +1949717207u, 2260498180u, +1493936866u, 3554860960u, +1582022990u, 1263709570u, +1244120487u, 3416600761u, +224580012u, 4252610345u, +286306391u, 814956796u, +1820532305u, 2776960536u, +3082703465u, 1659265982u, +1157398049u, 3752806924u, +3508246460u, 2902716664u, +2110942730u, 3267551635u, +902835431u, 405228165u, +2341378668u, 2220373824u, +3303626294u, 1175118221u, +383517064u, 896322512u, +1697257567u, 2202820683u, +1837689083u, 1336556841u, +914535232u, 3634083711u, +1537187340u, 3712582785u, +1088201893u, 3270984620u, +3093195926u, 2561488770u, +1962968100u, 236189500u, +2549435227u, 536047554u, +422609195u, 2958815818u, +4166184983u, 3528794619u, +1042329086u, 3914176886u, +1359641525u, 1197100813u, +1269739674u, 3301844628u, +1831223342u, 3329594980u, +2433669782u, 494908536u, +1441714797u, 1174785921u, +1933050423u, 958901065u, +868981704u, 2163330264u, +3243110680u, 1443133429u, +1145009669u, 2520062970u, +3851564853u, 2664619323u, +2686075657u, 4042710240u, +2125408249u, 4165697916u, +2328730865u, 3160666939u, +588683409u, 2126275847u, +829404209u, 1878067032u, +2567792910u, 897670516u, +934312076u, 2952135524u, +504832490u, 3312698056u, +4015478120u, 1265237690u, +3376133707u, 967674402u, +1553513184u, 834830418u, +2396504772u, 3278582098u, +2950762705u, 4277111759u, +4159211303u, 1290097509u, +251949572u, 3065234219u, +1832020534u, 312136369u, +1103404394u, 198182691u, +1369599600u, 3906710870u, +2954651680u, 1535115487u, +2389327507u, 1813520230u, +632704095u, 140762681u, +3123202913u, 3336005523u, +1287729497u, 2198985327u, +2470730783u, 3821758006u, +1009870118u, 559702706u, +4274686257u, 3187546567u, +2402308151u, 1096697687u, +678932329u, 3716363135u, +2899950405u, 3046872820u, +3754655641u, 2021741414u, +1993425202u, 2185339100u, +2838253700u, 3099212100u, +1679617763u, 3703603898u, +1135665833u, 3559875668u, +2503579743u, 1446869792u, +879818611u, 3788305533u, +2879018745u, 2719373510u, +3606051203u, 2166567748u, +343595772u, 1996164093u, +1577656121u, 475248376u, +463852893u, 2864244470u, +1332049663u, 3326459767u, +3207234525u, 2028708916u, +938916154u, 3115246264u, +3272166407u, 557660441u, +1265684026u, 245033807u, +2440657523u, 255451671u, +3811885130u, 1399880284u, +1322855877u, 3452203069u, +1324994449u, 3796404024u, +2002090272u, 1568745354u, +3700047753u, 31799506u, +3009412313u, 3184047862u, +728680761u, 3848624873u, +1849329144u, 3160134214u, +1272923193u, 1474278816u, +1208883495u, 1566527339u, +4136466541u, 630825649u, +1717327230u, 1496132623u, +2449386742u, 128106940u, +2108574735u, 2584236470u, +2872246579u, 397338552u, +3088905079u, 3456882941u, +1715915153u, 2940716269u, +4168438718u, 467441309u, +872996731u, 3206901319u, +1610606159u, 2540270567u, +1301658081u, 2379410194u, +2109315753u, 3348545480u, +2041927873u, 2644077493u, +546596661u, 1017047954u, +2596792972u, 2783958892u, +2826408201u, 3531646869u, +2219352672u, 4217451852u, +1806867885u, 1903578924u, +2076465705u, 2373061493u, +1832925325u, 241574049u, +1509517110u, 3703614272u, +3429894862u, 3529565564u, +4010000614u, 2256197939u, +517086873u, 2964595704u, +3501035294u, 4079457298u, +1184683823u, 4260564140u, +2339268412u, 3871564102u, +1572637805u, 383233885u, +3351411126u, 3419328182u, +2017406667u, 919677938u, +29804156u, 46276077u, +3032591014u, 4204155962u, +1172319502u, 969309871u, +2211319468u, 4153726847u, +3094193193u, 4240669441u, +3441709766u, 1387233546u, +4048882438u, 1217896566u, +1580964938u, 740563169u, +3691850348u, 3176426539u, +2738323042u, 2948665536u, +1474029445u, 3513354882u, +3219466255u, 3799363969u, +3961796122u, 1055550923u, +1992212097u, 2263421398u, +4289759174u, 2516844140u, +1782515131u, 2746577402u, +721928440u, 3529570984u, +1705302106u, 768287270u, +3474902815u, 4000011125u, +3475618043u, 212490675u, +549130471u, 2970128275u, +3170016833u, 2549835613u, +3691104824u, 2694324482u, +4169365948u, 3738062408u, +602930397u, 2148954730u, +2636387819u, 2616619070u, +301617872u, 374657036u, +3862686086u, 431292293u, +4225245165u, 1358580562u, +2377363130u, 1415970351u, +3885060756u, 1438379807u, +2297418515u, 2954777083u, +3970368221u, 1229801760u, +1931934525u, 2287507921u, +1713471510u, 2145608111u, +2650140034u, 4081586725u, +4196863572u, 1896558394u, +4059852729u, 1813855658u, +2618400836u, 1396056469u, +2375584220u, 1037031473u, +249284003u, 2450077637u, +1383747654u, 3122687303u, +2664431743u, 3855028730u, +929335420u, 3193251135u, +137313762u, 1850894384u, +3163711272u, 3071568023u, +418541677u, 3621223039u, +340274176u, 1167681812u, +4106647531u, 4022465625u, +3069708839u, 2704165015u, +2332023349u, 641449034u, +921552000u, 1712976649u, +1876484273u, 2343049860u, +1834682077u, 4155949943u, +2061821157u, 4240649383u, +747285578u, 1626463554u, +165503115u, 359629739u, +3838102563u, 582664250u, +3878924635u, 4117237498u, +2250573853u, 804336148u, +331393443u, 4242530387u, +3346357270u, 1674051445u, +3348019777u, 1722242971u, +2509017299u, 2966108111u, +4189102509u, 3323592310u, +2631381069u, 4014551783u, +4250787412u, 3448394212u, +2664752123u, 3517585534u, +3605365141u, 1669471183u, +2210121140u, 760762191u, +249697459u, 3416920106u, +16322182u, 643179562u, +1564226597u, 2134630675u, +1011990087u, 2990167340u, +2349550842u, 1642428946u, +1214854475u, 2134299399u, +2704221532u, 2104175211u, +4283196353u, 1342880802u, +198529755u, 2004468390u, +2544665755u, 853593042u, +2090611294u, 2970943872u, +1472073141u, 850464484u, +1407609278u, 3062461105u, +366448238u, 3842907484u, +488797416u, 1432670231u, +294963924u, 3693536939u, +3390549825u, 1583234720u, +4032223840u, 2318423400u, +2965642867u, 930822729u, +1679099863u, 1728968857u, +900822335u, 702309817u, +3258354115u, 1502282913u, +2811888503u, 3924947660u, +2477280726u, 3651607391u, +3788310204u, 1300369123u, +1842333726u, 4146839064u, +2468893861u, 4091095953u, +488595746u, 1448097974u, +1159634090u, 1738834113u, +2928916831u, 4093725287u, +530850094u, 291657799u, +3548184546u, 679517009u, +399175380u, 2658337143u, +3827951761u, 3086277222u, +2067718397u, 3632376023u, +3553313841u, 119173722u, +1702434637u, 1766260771u, +895654784u, 751439914u, +4008409498u, 215917713u, +1288382231u, 2656990891u, +2581779077u, 1570750352u, +2666411616u, 3533987737u, +4289478316u, 3576119563u, +3869794273u, 963183826u, +2081410737u, 3796810515u, +1036883117u, 136547246u, +875691100u, 2592925324u, +2689342539u, 427154472u, +532957601u, 1228758574u, +1908591042u, 1464255968u, +446980910u, 2984611177u, +3508927906u, 2001585786u, +2544767379u, 1525438381u, +879448844u, 1348536411u, +4242243590u, 2861338018u, +601175800u, 764077711u, +530635011u, 3785343245u, +2378297261u, 457568934u, +76438221u, 4104954272u, +2485968477u, 2381948487u, +4226929450u, 3148473363u, +879369091u, 2180270337u, +3674375989u, 1387729170u, +568650985u, 951677556u, +4213877384u, 2721005055u, +1678669911u, 66786703u, +2273631661u, 1149351924u, +246723096u, 1895026827u, +3810605772u, 3711056516u, +2080120290u, 3638638708u, +2915672708u, 2263003308u, +1976115991u, 3448840877u, +2019238520u, 225333538u, +1555273378u, 3797521928u, +1942347150u, 3262952567u, +2817830907u, 2078619498u, +749534111u, 1178073973u, +841092198u, 3288261538u, +1696412169u, 1496966875u, +3739946319u, 2481012988u, +568983526u, 114945840u, +2841706923u, 1632780103u, +4020169654u, 2087949619u, +833416317u, 3787017905u, +2373238993u, 2575395164u, +2542976862u, 2971726178u, +2880371864u, 3642087909u, +1043714217u, 3894199764u, +2235879182u, 203853421u, +834683330u, 425935223u, +3560796393u, 3565833278u, +3414330886u, 1748785729u, +1023171602u, 580966986u, +2657385925u, 2124704694u, +233442446u, 1107045577u, +3899097693u, 1067532701u, +115667924u, 1406028344u, +2419657149u, 18613994u, +2532882091u, 3476683808u, +895961699u, 3762914298u, +1328752423u, 1844996900u, +1210281744u, 904215228u, +4055325594u, 1118521573u, +3996647489u, 3657647605u, +325254059u, 3136157065u, +3341068436u, 2287683323u, +1313073005u, 126005630u, +853746559u, 3555092974u, +2689238752u, 49515858u, +61073168u, 1010661841u, +1269521335u, 1902040126u, +3858321250u, 1400735275u, +2974699176u, 2771676666u, +545726212u, 2225229957u, +1086473152u, 3454177594u, +2088002891u, 2883475137u, +3222194252u, 4144472319u, +567988835u, 1051332394u, +3932046135u, 542648229u, +162888005u, 1669710469u, +1492500905u, 553041029u, +3817492747u, 584127807u, +4147115982u, 2993670925u, +3509733475u, 3587959456u, +2088550465u, 1745399498u, +869648362u, 1404723176u, +3947542735u, 1334333531u, +59634866u, 3239516985u, +3844250972u, 1275954779u, +2512155003u, 1685649437u, +639306006u, 2524620206u, +576786501u, 655707039u, +2864351838u, 3736264674u, +1200907897u, 2384379464u, +15823708u, 206117476u, +1193310960u, 1093099415u, +3696538026u, 4112584792u, +2069527017u, 547588820u, +4178147211u, 2827259351u, +940846775u, 1054995047u, +2976960697u, 1934305529u, +2199137382u, 1005722394u, +1875867180u, 2064356511u, +4019734130u, 3096333006u, +2069509024u, 2906358341u, +2232866485u, 1456016086u, +1422674894u, 867282151u, +1612503136u, 1739843072u, +134947567u, 2978775774u, +1284167756u, 1090844589u, +831688783u, 2079216362u, +1626991196u, 3644714163u, +3678110059u, 898470030u, +3916646913u, 3182422972u, +3630426828u, 969847973u, +3427164640u, 3463937250u, +3044785046u, 897322257u, +3443872170u, 4185408854u, +2557463241u, 4080940424u, +2048168570u, 2429169982u, +3174690447u, 2513494106u, +1213061732u, 3143736628u, +3482268149u, 1250714337u, +31648125u, 3872383625u, +1565760579u, 36665130u, +751041229u, 2257179590u, +2915361862u, 280819225u, +2907818413u, 4254297769u, +3493178615u, 3755944354u, +4043533423u, 1134196225u, +4177134659u, 127246419u, +2442615581u, 923049607u, +1004426206u, 782768297u, +2410586681u, 1430106871u, +4103323427u, 3168399477u, +3716682375u, 3616334719u, +3413209549u, 656672786u, +2876965944u, 182894450u, +456581318u, 2683752067u, +3877875910u, 3190666241u, +3240336907u, 4024807233u, +1681224377u, 1576191191u, +3599250276u, 2381111980u, +3495321877u, 3956024585u, +1611608524u, 3815677453u, +2062334396u, 1656117707u, +5457134u, 3234118251u, +470187419u, 2688566989u, +3259870297u, 660100446u, +442236198u, 2542452448u, +493137955u, 392411099u, +947967568u, 1234595917u, +4230082284u, 2762976773u, +2870085764u, 1455086530u, +2762099647u, 4011882747u, +1215981925u, 3227517889u, +3269061963u, 4037515364u, +3168911474u, 4255057396u, +2026092260u, 1736192508u, +3909727042u, 3114708966u, +1938800693u, 680793595u, +1525265867u, 2808224480u, +2122290603u, 1211197714u, +3520488321u, 3979192396u, +3540779343u, 4192918639u, +2736030448u, 1120335563u, +1698949078u, 3993310631u, +1966048551u, 2228221363u, +597941119u, 3498018399u, +393987327u, 454500547u, +1222959566u, 567151340u, +3774764786u, 1492844524u, +3308300614u, 805568076u, +868414882u, 177406999u, +1608110313u, 642061169u, +1027515771u, 3131251981u, +2851936150u, 4272755262u, +1532845092u, 709643652u, +682573592u, 1244104217u, +796769556u, 2500467040u, +3002618826u, 1112998535u, +1780193104u, 1243644607u, +3691719535u, 2958853053u, +466635014u, 2277292580u, +4082276003u, 1030800045u, +1750863246u, 379050598u, +3576413281u, 731493104u, +132259176u, 4115195437u, +1769890695u, 2715470335u, +1819263183u, 2028531518u, +2154809766u, 3672399742u, +76727603u, 4198182186u, +2304993586u, 1666387627u, +284366017u, 3359785538u, +3469807328u, 2926494787u, +3829072836u, 2493478921u, +3738499303u, 3311304980u, +932916545u, 2235559063u, +2909742396u, 1765719309u, +1456588655u, 508290328u, +1490719640u, 3356513470u, +2908490783u, 251085588u, +830410677u, 3172220325u, +3897208579u, 1940535730u, +151909546u, 2384458112u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; { uint64_t h = farmhashuo::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashuo::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashuo::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +{ uint64_t h = farmhashuo::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashuo::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashuoTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +{ uint64_t h = farmhashuo::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashuo::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashuoTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashuoTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashuoTest::Dump(0, i); + } + farmhashuoTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif +#ifndef FARMHASH_SELF_TEST_GUARD +#define FARMHASH_SELF_TEST_GUARD +#include +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::hex; + +static const uint64_t kSeed0 = 1234567; +static const uint64_t kSeed1 = k0; +static const int kDataSize = 1 << 20; +static const int kTestSize = 300; +#define kSeed128 Uint128(kSeed0, kSeed1) + +static char data[kDataSize]; + +static int completed_self_tests = 0; +static int errors = 0; + +// Initialize data to pseudorandom values. +void Setup() { + if (completed_self_tests == 0) { + uint64_t a = 9; + uint64_t b = 777; + for (int i = 0; i < kDataSize; i++) { + a += b; + b += a; + a = (a ^ (a >> 41)) * k0; + b = (b ^ (b >> 41)) * k0 + i; + uint8_t u = b >> 37; + memcpy(data + i, &u, 1); // uint8_t -> char + } + } +} + +int NoteErrors() { +#define NUM_SELF_TESTS 9 + if (++completed_self_tests == NUM_SELF_TESTS) + std::exit(errors > 0); + return errors; +} + +template inline bool IsNonZero(T x) { + return x != 0; +} + +template <> inline bool IsNonZero(uint128_t x) { + return x != Uint128(0, 0); +} + +#endif // FARMHASH_SELF_TEST_GUARD + +namespace farmhashxoTest { + +uint32_t CreateSeed(int offset, int salt) { + uint32_t h = static_cast(salt & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h += static_cast(offset & 0xffffffff); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + h = h * c1; + h ^= (h >> 17); + return h; +} + +#undef SEED +#undef SEED1 +#undef SEED0 +#define SEED CreateSeed(offset, -1) +#define SEED0 CreateSeed(offset, 0) +#define SEED1 CreateSeed(offset, 1) + +#undef TESTING +#define TESTING 1 +#if TESTING +uint32_t expected[] = { +1140953930u, 861465670u, +3277735313u, 2681724312u, +2598464059u, 797982799u, +890626835u, 800175912u, +2603993599u, 921001710u, +1410420968u, 2134990486u, +3283896453u, 1867689945u, +2914424215u, 2244477846u, +255297188u, 2992121793u, +1110588164u, 4186314283u, +161451183u, 3943596029u, +4019337850u, 452431531u, +283198166u, 2741341286u, +3379021470u, 2557197665u, +299850021u, 2532580744u, +452473466u, 1706958772u, +1298374911u, 3099673830u, +2199864459u, 3696623795u, +236935126u, 2976578695u, +4055299123u, 3281581178u, +1053458494u, 1882212500u, +2305012065u, 2169731866u, +3456121707u, 275903667u, +458884671u, 3033004529u, +3058973506u, 2379411653u, +1898235244u, 1402319660u, +2700149065u, 2699376854u, +147814787u, 720739346u, +2433714046u, 4222949502u, +4220361840u, 1712034059u, +3425469811u, 3690733394u, +4148372108u, 1330324210u, +594028478u, 2921867846u, +1635026870u, 192883107u, +780716741u, 1728752234u, +3280331829u, 326029180u, +3969463346u, 1436364519u, +393215742u, 3349570000u, +3824583307u, 1612122221u, +2859809759u, 3808705738u, +1379537552u, 1646032583u, +2233466664u, 1432476832u, +4023053163u, 2650381482u, +2052294713u, 3552092450u, +1628777059u, 1499109081u, +3476440786u, 3829307897u, +2960536756u, 1554038301u, +1145519619u, 3190844552u, +2902102606u, 3600725550u, +237495366u, 540224401u, +65721842u, 489963606u, +1448662590u, 397635823u, +1596489240u, 1562872448u, +1790705123u, 2128624475u, +180854224u, 2604346966u, +1435705557u, 1262831810u, +155445229u, 1672724608u, +1669465176u, 1341975128u, +663607706u, 2077310004u, +3610042449u, 1911523866u, +1043692997u, 1454396064u, +2563776023u, 294527927u, +1099072299u, 1389770549u, +703505868u, 678706990u, +2952353448u, 2026137563u, +3603803785u, 629449419u, +1933894405u, 3043213226u, +226132789u, 2489287368u, +1552847036u, 645684964u, +3828089804u, 3632594520u, +187883449u, 230403464u, +3151491850u, 3272648435u, +3729087873u, 1303930448u, +2002861219u, 165370827u, +916494250u, 1230085527u, +3103338579u, 3064290191u, +3807265751u, 3628174014u, +231181488u, 851743255u, +2295806711u, 1781190011u, +2988893883u, 1554380634u, +1142264800u, 3667013118u, +1968445277u, 315203929u, +2638023604u, 2290487377u, +732137533u, 1909203251u, +440398219u, 1891630171u, +1380301172u, 1498556724u, +4072067757u, 4165088768u, +4204318635u, 441430649u, +3931792696u, 197618179u, +956300927u, 914413116u, +3010839769u, 2837339569u, +2148126371u, 1913303225u, +3074915312u, 3117299654u, +4139181436u, 2993479124u, +3178848746u, 1357272220u, +1438494951u, 507436733u, +667183474u, 2084369203u, +3854939912u, 1413396341u, +126024219u, 146044391u, +1016656857u, 3022024459u, +3254014218u, 429095991u, +990500595u, 3056862311u, +985653208u, 1718653828u, +623071693u, 366414107u, +1771289760u, 2293458109u, +3047342438u, 2991127487u, +3120876698u, 1684583131u, +3638043310u, 1170404994u, +863214540u, 1087193030u, +199124911u, 520792961u, +3169775996u, 1577421232u, +3331828431u, 1013201099u, +1716848157u, 4033596884u, +1770708857u, 4229339322u, +1146169032u, 1434258493u, +3824360466u, 3242407770u, +1926419493u, 2649785113u, +872586426u, 762243036u, +2736953692u, 816692935u, +1571283333u, 3555213933u, +2266795890u, 3781899767u, +4290630595u, 517646945u, +3006163611u, 2180594090u, +959214578u, 558910384u, +1283799121u, 3047062993u, +3830962609u, 2391606125u, +3544509313u, 622325861u, +834785312u, 382936554u, +1421463872u, 788479970u, +1825135056u, 2725923798u, +580988377u, 2826990641u, +247825043u, 3167748333u, +812546227u, 2506885666u, +2584372201u, 1758123094u, +1891789696u, 389974094u, +345313518u, 2022370576u, +3886113119u, 3338548567u, +1083486947u, 2583576230u, +1776047957u, 1771384107u, +3604937815u, 3198590202u, +3027522813u, 4155628142u, +4232136669u, 427759438u, +4244322689u, 542201663u, +1549591985u, 2856634168u, +556609672u, 45845311u, +1175961330u, 3948351189u, +4165739882u, 4194218315u, +1634635545u, 4151937410u, +713127376u, 1467786451u, +1327394015u, 2743592929u, +2638154051u, 810082938u, +3077742128u, 1062268187u, +4084325664u, 3810665822u, +3735739145u, 2794294783u, +2335576331u, 2560479831u, +690240711u, 997658837u, +2442302747u, 3948961926u, +3958366652u, 3067277639u, +2059157774u, 1211737169u, +1516711748u, 2339636583u, +4188504038u, 59581167u, +2767897792u, 1389679610u, +2658147000u, 2643979752u, +3758739543u, 4189944477u, +1454470782u, 100876854u, +2995362413u, 118817200u, +3252925478u, 2062343506u, +2804483644u, 3088828656u, +1231633714u, 4168280671u, +2931588131u, 3284356565u, +1255909792u, 3130054947u, +4173605289u, 1407328702u, +1677744031u, 3532596884u, +3162657845u, 3887208531u, +2256541290u, 3459463480u, +3740979556u, 259034107u, +392987633u, 3233195759u, +3606709555u, 3424793077u, +315836068u, 3200749877u, +4065431359u, 760633989u, +2982018998u, 1811050648u, +234531934u, 1115203611u, +3897494162u, 1516407838u, +1603559457u, 323296368u, +2632963283u, 1778459926u, +2879836826u, 2146672889u, +3486330348u, 492621815u, +1231665285u, 2457048126u, +3438440082u, 2217471853u, +3355404249u, 3275550588u, +1052645068u, 862072556u, +4110617119u, 3745267835u, +2657392572u, 4279236653u, +1688445808u, 701920051u, +956734128u, 581695350u, +3157862788u, 2585726058u, +1192588249u, 1410111809u, +1651193125u, 3326135446u, +1073280453u, 97376972u, +2513844237u, 2187968410u, +3976859649u, 4267859263u, +3429034542u, 564493077u, +3000537321u, 479241367u, +3845637831u, 2868987960u, +51544337u, 1029173765u, +393624922u, 704325635u, +2357610553u, 1418509533u, +2007814586u, 3866658271u, +3082385053u, 735688735u, +916110004u, 3283299459u, +1051684175u, 1083796807u, +4074716319u, 813690332u, +144264390u, 1439630796u, +1508556987u, 675582689u, +3748881891u, 3195309868u, +362884708u, 1616408198u, +43233176u, 837301135u, +881504822u, 3254795114u, +1385506591u, 2799925823u, +1469874582u, 3464841997u, +497175391u, 3929484338u, +3975771289u, 1798536177u, +2926265846u, 1374242438u, +3675707838u, 4205965408u, +3153165629u, 1499475160u, +187287713u, 548490821u, +3255259608u, 4247675634u, +1940181471u, 3779953975u, +687167150u, 2319566715u, +1742785722u, 785893184u, +2296977392u, 2778575413u, +1794720651u, 48131484u, +4084891412u, 1160134629u, +3737623280u, 823113169u, +3423207646u, 3803213486u, +710625654u, 4116162021u, +3693420287u, 4167766971u, +1666602807u, 295320990u, +3513255468u, 2487440590u, +234080704u, 4004655503u, +2971762528u, 1479656873u, +4090178629u, 4044418876u, +391947536u, 1462554406u, +3909295855u, 1239580330u, +1515601363u, 2011102035u, +1442068334u, 4265993528u, +1191921695u, 2291355695u, +4257172787u, 576405853u, +314332944u, 4038839101u, +55559918u, 2378985842u, +711098718u, 2425317635u, +1644327317u, 1401013391u, +4193760037u, 2958260436u, +3167371443u, 3062418115u, +3800755475u, 3167030094u, +3489648204u, 1405430357u, +526177822u, 2602636307u, +915406019u, 4264167741u, +1484090483u, 3070944737u, +254529415u, 4017058800u, +1702710265u, 1029665228u, +2000382906u, 3185573940u, +1381258384u, 4036354071u, +2900841028u, 2670703363u, +2921748807u, 2899069938u, +4130543625u, 688472265u, +4186808827u, 1054670286u, +1132985391u, 2840525968u, +4175776103u, 338058159u, +1735964501u, 1539305024u, +3497121710u, 1568260669u, +2227290760u, 146827036u, +3977176001u, 4060134777u, +857488494u, 250055052u, +4284109679u, 2502815838u, +2592281721u, 1603444633u, +1390562014u, 1556658131u, +616327404u, 2448966429u, +3051191726u, 3891353218u, +1213304082u, 762328245u, +2239052397u, 1082330589u, +2455957292u, 201837927u, +405397452u, 3079886794u, +2583939798u, 2848283092u, +3750724631u, 883849006u, +3204198988u, 3341327098u, +1855234968u, 1982110346u, +1485529487u, 541496720u, +4117290321u, 3607433551u, +2168864636u, 133643215u, +1055817409u, 3847827123u, +2960769387u, 4046101649u, +1176127003u, 4015671361u, +4243643405u, 2849988118u, +517111221u, 1796672358u, +2045051700u, 3452457457u, +2948254999u, 2102063419u, +1556410577u, 1536380876u, +3776661467u, 3281002516u, +1735616066u, 1539151988u, +1087795162u, 3332431596u, +685631442u, 1147951686u, +95237878u, 2005032160u, +4012206915u, 4224354805u, +3204999386u, 2415262714u, +1433635018u, 116647396u, +83167836u, 2881562655u, +2729416454u, 1029284767u, +881378302u, 2159170082u, +555057366u, 1169104445u, +3963877000u, 1919171906u, +336034862u, 2017579106u, +4059340529u, 3020819343u, +865146997u, 2473524405u, +944743644u, 1694443528u, +1804513294u, 2904752429u, +617975720u, 3671562289u, +260177668u, 505662155u, +1885941445u, 2504509403u, +2260041112u, 1019936943u, +3722741628u, 1511077569u, +3100701179u, 1379422864u, +1535670711u, 773792826u, +1103819072u, 2089123665u, +1157547425u, 329152940u, +4142587430u, 484732447u, +2475035432u, 1120017626u, +412145504u, 965125959u, +324924679u, 2809286837u, +2842141483u, 4029205195u, +2974306813u, 515627448u, +3791551981u, 1097806406u, +3873078673u, 136118734u, +1872130856u, 3632422367u, +3574135531u, 4017075736u, +1699452298u, 1403506686u, +344414660u, 1189129691u, +3487080616u, 1516736273u, +1805475756u, 2562064338u, +163335594u, 2732147834u, +4077452507u, 2984955003u, +4271866024u, 3071338162u, +2347111903u, 873829983u, +1948409509u, 1923531348u, +459509140u, 771592405u, +1750124750u, 2334938333u, +213811117u, 2586632018u, +185232757u, 4032960199u, +2447383637u, 284777551u, +1654276320u, 2687561076u, +3512945009u, 308584855u, +1861027147u, 4102279334u, +3203802620u, 1692079268u, +4250142168u, 2565680167u, +1507046104u, 841195925u, +520565830u, 3674576684u, +38924274u, 3770488806u, +2414430882u, 3978473838u, +3703994407u, 69201295u, +3099963860u, 1255084262u, +690971838u, 3539996781u, +3696902571u, 3593730713u, +2363435042u, 54945052u, +1785765213u, 184911581u, +1586241476u, 1939595371u, +2534883189u, 2432427547u, +2374171993u, 2039128933u, +2955715987u, 2295501078u, +2741583197u, 1280920000u, +686818699u, 1238742497u, +3843660102u, 82177963u, +1281043691u, 1121403845u, +1697846708u, 284852964u, +278661677u, 2889101923u, +2127558730u, 713121337u, +872502474u, 511142139u, +1261140657u, 1747052377u, +2108187161u, 927011680u, +955328267u, 3821994995u, +2707230761u, 4142246789u, +4134691985u, 1958963937u, +2498463509u, 1977988705u, +1419293714u, 1636932722u, +2567532373u, 4075249328u, +240575705u, 1956681213u, +2598802768u, 2025886508u, +4104757832u, 3026358429u, +3242615202u, 4026813725u, +255108733u, 1845587644u, +3573008472u, 3615577014u, +1222733548u, 1205557630u, +917608574u, 1363253259u, +1541946015u, 3087190425u, +1138008081u, 1444019663u, +109793386u, 341851980u, +857839960u, 2515339233u, +156283211u, 1906768669u, +3886713057u, 1276595523u, +2809830736u, 460237542u, +3420452099u, 142985419u, +205970448u, 4198897105u, +1950698961u, 2069753399u, +1142216925u, 1113051162u, +1033680610u, 4278599955u, +1106466069u, 356742959u, +531521052u, 3494863964u, +225629455u, 3735275001u, +3662626864u, 1750561299u, +1012864651u, 2101846429u, +1074553219u, 668829411u, +992181339u, 3384018814u, +3330664522u, 860966321u, +1885071395u, 4233785523u, +100741310u, 451656820u, +2148187612u, 1063001151u, +360256231u, 107312677u, +3650357479u, 2390172694u, +22452685u, 237319043u, +3600462351u, 1216645846u, +2088767754u, 164402616u, +2418980170u, 926137824u, +94638678u, 1689811113u, +2751052984u, 1767810825u, +271289013u, 3896132233u, +103797041u, 1397772514u, +3441135892u, 3323383489u, +2491268371u, 1662561885u, +1612872497u, 2986430557u, +2756998822u, 207428029u, +937973965u, 2791656726u, +1949717207u, 2260498180u, +2648427775u, 2360400900u, +2080496169u, 486358863u, +1582022990u, 1263709570u, +1396468647u, 1377764574u, +363008508u, 1293502429u, +224580012u, 4252610345u, +1435134775u, 1099809675u, +533671980u, 1533438766u, +1820532305u, 2776960536u, +3374512975u, 3542220540u, +822810075u, 3716663290u, +1157398049u, 3752806924u, +4081637863u, 337070226u, +3866585976u, 359270190u, +2110942730u, 3267551635u, +644850146u, 1306761320u, +746972907u, 934259457u, +2341378668u, 2220373824u, +1242645122u, 4109252858u, +1625266099u, 1173698481u, +383517064u, 896322512u, +3377483696u, 1788337208u, +455496839u, 3194373887u, +1837689083u, 1336556841u, +1658628529u, 2911512007u, +3838343487u, 2757664765u, +1537187340u, 3712582785u, +367022558u, 3071359622u, +3926147070u, 35432879u, +3093195926u, 2561488770u, +4273132307u, 3898950547u, +2838251049u, 2103926083u, +2549435227u, 536047554u, +1858986613u, 2040551642u, +1147412575u, 1972369852u, +4166184983u, 3528794619u, +4077477194u, 3565689036u, +808048238u, 3826350461u, +1359641525u, 1197100813u, +265993036u, 1864569342u, +725164342u, 2264788336u, +1831223342u, 3329594980u, +923017956u, 490608221u, +3818634478u, 258154469u, +1441714797u, 1174785921u, +3833372385u, 3287246572u, +1677395563u, 3569218731u, +868981704u, 2163330264u, +2649450292u, 500120236u, +465161780u, 746438382u, +1145009669u, 2520062970u, +2810524030u, 1561519055u, +1479878006u, 3864969305u, +2686075657u, 4042710240u, +3224066062u, 2774151984u, +2226179547u, 1643626042u, +2328730865u, 3160666939u, +2107011431u, 96459446u, +3920328742u, 3336407558u, +829404209u, 1878067032u, +1235983679u, 4237425634u, +466519055u, 3870676863u, +934312076u, 2952135524u, +276949224u, 4100839753u, +424001484u, 1955120893u, +4015478120u, 1265237690u, +427484362u, 4246879223u, +3452969617u, 1724363362u, +1553513184u, 834830418u, +1858777639u, 3476334357u, +4144030366u, 2450047160u, +2950762705u, 4277111759u, +358032121u, 2511026735u, +167923105u, 2059208280u, +251949572u, 3065234219u, +1535473864u, 556796152u, +1513237478u, 3150857516u, +1103404394u, 198182691u, +1476438092u, 2913077464u, +207119516u, 3963810232u, +2954651680u, 1535115487u, +3051522276u, 4046477658u, +917804636u, 864395565u, +632704095u, 140762681u, +1802040304u, 990407433u, +3771506212u, 4106024923u, +1287729497u, 2198985327u, +4052924496u, 2926590471u, +3084557148u, 1472898694u, +1009870118u, 559702706u, +4265214507u, 82077489u, +3067891003u, 3295678907u, +2402308151u, 1096697687u, +464407878u, 4190838199u, +4269578403u, 3060919438u, +2899950405u, 3046872820u, +733509243u, 1583801700u, +40453902u, 3879773881u, +1993425202u, 2185339100u, +1877837196u, 3912423882u, +3293122640u, 4104318469u, +1679617763u, 3703603898u, +8759461u, 2540185277u, +1152198475u, 2038345882u, +2503579743u, 1446869792u, +2019419351u, 4051584612u, +3178289407u, 3992503830u, +2879018745u, 2719373510u, +700836153u, 1675560450u, +4121245793u, 2064715719u, +343595772u, 1996164093u, +3130433948u, 405251683u, +2804817126u, 1607133689u, +463852893u, 2864244470u, +2224044848u, 4071581802u, +2537107938u, 2246347953u, +3207234525u, 2028708916u, +2272418128u, 803575837u, +38655481u, 2170452091u, +3272166407u, 557660441u, +4019147902u, 3841480082u, +298459606u, 2600943364u, +2440657523u, 255451671u, +3424361375u, 779434428u, +3088526123u, 490671625u, +1322855877u, 3452203069u, +3057021940u, 2285701422u, +2014993457u, 2390431709u, +2002090272u, 1568745354u, +1783152480u, 823305654u, +4053862835u, 2200236540u, +3009412313u, 3184047862u, +3032187389u, 4159715581u, +2966902888u, 252986948u, +1849329144u, 3160134214u, +3420960112u, 3198900547u, +749160960u, 379139040u, +1208883495u, 1566527339u, +3006227299u, 4194096960u, +556075248u, 497404038u, +1717327230u, 1496132623u, +1775955687u, 1719108984u, +1014328900u, 4189966956u, +2108574735u, 2584236470u, +684087286u, 531310503u, +4264509527u, 773405691u, +3088905079u, 3456882941u, +3105682208u, 3382290593u, +2289363624u, 3296306400u, +4168438718u, 467441309u, +777173623u, 3241407531u, +1183994815u, 1132983260u, +1610606159u, 2540270567u, +2649684057u, 1397502982u, +146657385u, 3318434267u, +2109315753u, 3348545480u, +3193669211u, 811750340u, +1073256162u, 3571673088u, +546596661u, 1017047954u, +3403136990u, 2540585554u, +1477047647u, 4145867423u, +2826408201u, 3531646869u, +784952939u, 943914610u, +2717443875u, 3657384638u, +1806867885u, 1903578924u, +3985088434u, 1911188923u, +1764002686u, 3672748083u, +1832925325u, 241574049u, +519948041u, 3181425568u, +2939747257u, 1634174593u, +3429894862u, 3529565564u, +1089679033u, 240953857u, +2025369941u, 2695166650u, +517086873u, 2964595704u, +3017658263u, 3828377737u, +2144895011u, 994799311u, +1184683823u, 4260564140u, +308018483u, 4262383425u, +1374752558u, 3431057723u, +1572637805u, 383233885u, +3188015819u, 4051263539u, +233319221u, 3794788167u, +2017406667u, 919677938u, +4074952232u, 1683612329u, +4213676186u, 327142514u, +3032591014u, 4204155962u, +206775997u, 2283918569u, +2395147154u, 3427505379u, +2211319468u, 4153726847u, +2217060665u, 350160869u, +2493667051u, 1648200185u, +3441709766u, 1387233546u, +140980u, 1891558063u, +760080239u, 2088061981u, +1580964938u, 740563169u, +422986366u, 330624974u, +4264507722u, 150928357u, +2738323042u, 2948665536u, +918718096u, 376390582u, +3966098971u, 717653678u, +3219466255u, 3799363969u, +3424344721u, 3187805406u, +375347278u, 3490350144u, +1992212097u, 2263421398u, +3855037968u, 1928519266u, +3866327955u, 1129127000u, +1782515131u, 2746577402u, +3059200728u, 2108753646u, +2738070963u, 1336849395u, +1705302106u, 768287270u, +1343511943u, 2247006571u, +1956142255u, 1780259453u, +3475618043u, 212490675u, +622521957u, 917121602u, +1852992332u, 1267987847u, +3170016833u, 2549835613u, +3299763344u, 2864033668u, +3378768767u, 1236609378u, +4169365948u, 3738062408u, +2661022773u, 2006922227u, +2760592161u, 3828932355u, +2636387819u, 2616619070u, +1237256330u, 3449066284u, +2871755260u, 3729280948u, +3862686086u, 431292293u, +3285899651u, 786322314u, +2531158535u, 724901242u, +2377363130u, 1415970351u, +1244759631u, 3263135197u, +965248856u, 174024139u, +2297418515u, 2954777083u, +987586766u, 3206261120u, +4059515114u, 3903854066u, +1931934525u, 2287507921u, +1827135136u, 1781944746u, +574617451u, 2299034788u, +2650140034u, 4081586725u, +2482286699u, 1109175923u, +458483596u, 618705848u, +4059852729u, 1813855658u, +4190721328u, 1129462471u, +4089998050u, 3575732749u, +2375584220u, 1037031473u, +1623777358u, 3389003793u, +546597541u, 352770237u, +1383747654u, 3122687303u, +1646071378u, 1164309901u, +290870767u, 830691298u, +929335420u, 3193251135u, +989577914u, 3626554867u, +591974737u, 3996958215u, +3163711272u, 3071568023u, +1516846461u, 3656006011u, +2698625268u, 2510865430u, +340274176u, 1167681812u, +3698796465u, 3155218919u, +4102288238u, 1673474350u, +3069708839u, 2704165015u, +1237411891u, 1854985978u, +3646837503u, 3625406022u, +921552000u, 1712976649u, +3939149151u, 878608872u, +3406359248u, 1068844551u, +1834682077u, 4155949943u, +2437686324u, 3163786257u, +2645117577u, 1988168803u, +747285578u, 1626463554u, +1235300371u, 1256485167u, +1914142538u, 4141546431u, +3838102563u, 582664250u, +1883344352u, 2083771672u, +2611657933u, 2139079047u, +2250573853u, 804336148u, +3066325351u, 2770847216u, +4275641370u, 1455750577u, +3346357270u, 1674051445u, +601221482u, 3992583643u, +1402445097u, 3622527604u, +2509017299u, 2966108111u, +2557027816u, 900741486u, +1790771021u, 2912643797u, +2631381069u, 4014551783u, +90375300u, 300318232u, +3269968032u, 2679371729u, +2664752123u, 3517585534u, +3253901179u, 542270815u, +1188641600u, 365479232u, +2210121140u, 760762191u, +1273768482u, 1216399252u, +3484324231u, 4287337666u, +16322182u, 643179562u, +325675502u, 3652676161u, +3120716054u, 3330259752u, +1011990087u, 2990167340u, +1097584090u, 3262252593u, +1829409951u, 3665087267u, +1214854475u, 2134299399u, +3704419305u, 411263051u, +1625446136u, 549838529u, +4283196353u, 1342880802u, +3460621305u, 1967599860u, +4282843369u, 1275671016u, +2544665755u, 853593042u, +901109753u, 2682611693u, +110631633u, 797487791u, +1472073141u, 850464484u, +797089608u, 3286110054u, +350397471u, 2775631060u, +366448238u, 3842907484u, +2219863904u, 3623364733u, +1850985302u, 4009616991u, +294963924u, 3693536939u, +3061255808u, 1615375832u, +1920066675u, 4113028420u, +4032223840u, 2318423400u, +2701956286u, 4145497671u, +3991532344u, 2536338351u, +1679099863u, 1728968857u, +449740816u, 2686506989u, +685242457u, 97590863u, +3258354115u, 1502282913u, +1235084019u, 2151665147u, +528459289u, 231097464u, +2477280726u, 3651607391u, +2091754612u, 1178454681u, +980597335u, 1604483865u, +1842333726u, 4146839064u, +3213794286u, 2601416506u, +754220096u, 3571436033u, +488595746u, 1448097974u, +4004834921u, 238887261u, +3320337489u, 1416989070u, +2928916831u, 4093725287u, +186020771u, 2367569534u, +3046087671u, 4090084518u, +3548184546u, 679517009u, +1962659444u, 3539886328u, +4192003933u, 1678423485u, +3827951761u, 3086277222u, +2144472852u, 1390394371u, +2976322029u, 1574517163u, +3553313841u, 119173722u, +1702434637u, 1766260771u, +3629581771u, 1407497759u, +895654784u, 751439914u, +4008409498u, 215917713u, +1482103833u, 695551833u, +1288382231u, 2656990891u, +2581779077u, 1570750352u, +3710689053u, 1741390464u, +2666411616u, 3533987737u, +4289478316u, 3576119563u, +4118694920u, 108199666u, +3869794273u, 963183826u, +2081410737u, 3796810515u, +791123882u, 2525792704u, +1036883117u, 136547246u, +875691100u, 2592925324u, +614302599u, 3013176417u, +2689342539u, 427154472u, +532957601u, 1228758574u, +1898117151u, 1181643858u, +1908591042u, 1464255968u, +446980910u, 2984611177u, +58509511u, 1046943619u, +3508927906u, 2001585786u, +2544767379u, 1525438381u, +552181222u, 1959725830u, +879448844u, 1348536411u, +4242243590u, 2861338018u, +1082052441u, 1034351453u, +601175800u, 764077711u, +530635011u, 3785343245u, +2178026726u, 117256687u, +2378297261u, 457568934u, +76438221u, 4104954272u, +956793873u, 3783168634u, +2485968477u, 2381948487u, +4226929450u, 3148473363u, +2518273601u, 3569490233u, +879369091u, 2180270337u, +3674375989u, 1387729170u, +977997984u, 4270646856u, +568650985u, 951677556u, +4213877384u, 2721005055u, +1073364549u, 2563403831u, +1678669911u, 66786703u, +2273631661u, 1149351924u, +3651298990u, 1581883443u, +246723096u, 1895026827u, +3810605772u, 3711056516u, +4058833288u, 2193790614u, +2080120290u, 3638638708u, +2915672708u, 2263003308u, +2361934197u, 4136767460u, +1976115991u, 3448840877u, +2019238520u, 225333538u, +874340815u, 2976159827u, +1555273378u, 3797521928u, +1942347150u, 3262952567u, +435997738u, 340403353u, +2817830907u, 2078619498u, +749534111u, 1178073973u, +894654712u, 3361226032u, +841092198u, 3288261538u, +1696412169u, 1496966875u, +697501571u, 1059158875u, +3739946319u, 2481012988u, +568983526u, 114945840u, +1559249010u, 2218244008u, +2841706923u, 1632780103u, +4020169654u, 2087949619u, +2438736103u, 24032648u, +833416317u, 3787017905u, +2373238993u, 2575395164u, +3434544481u, 3228481067u, +2542976862u, 2971726178u, +2880371864u, 3642087909u, +2407477975u, 2239080836u, +1043714217u, 3894199764u, +2235879182u, 203853421u, +2933669448u, 2504940536u, +834683330u, 425935223u, +3560796393u, 3565833278u, +1668000829u, 3683399154u, +3414330886u, 1748785729u, +1023171602u, 580966986u, +2531038985u, 3227325488u, +2657385925u, 2124704694u, +233442446u, 1107045577u, +3407293834u, 552770757u, +3899097693u, 1067532701u, +115667924u, 1406028344u, +1707768231u, 3724015962u, +2419657149u, 18613994u, +2532882091u, 3476683808u, +1560838678u, 811220224u, +895961699u, 3762914298u, +1328752423u, 1844996900u, +1420427894u, 1848067707u, +1210281744u, 904215228u, +4055325594u, 1118521573u, +2496554183u, 2579259919u, +3996647489u, 3657647605u, +325254059u, 3136157065u, +3951522674u, 4052925250u, +3341068436u, 2287683323u, +1313073005u, 126005630u, +2505120084u, 1194725057u, +853746559u, 3555092974u, +2689238752u, 49515858u, +1244776042u, 1069300695u, +61073168u, 1010661841u, +1269521335u, 1902040126u, +990632502u, 2378708922u, +3858321250u, 1400735275u, +2974699176u, 2771676666u, +170995186u, 2877798589u, +545726212u, 2225229957u, +1086473152u, 3454177594u, +3859483262u, 1499729584u, +2088002891u, 2883475137u, +3222194252u, 4144472319u, +2212229854u, 4146740722u, +567988835u, 1051332394u, +3932046135u, 542648229u, +3017852446u, 1277887997u, +162888005u, 1669710469u, +1492500905u, 553041029u, +1434876932u, 533989516u, +3817492747u, 584127807u, +4147115982u, 2993670925u, +4020312558u, 710021255u, +3509733475u, 3587959456u, +2088550465u, 1745399498u, +2952242967u, 1259815443u, +869648362u, 1404723176u, +3947542735u, 1334333531u, +3873471582u, 229399758u, +59634866u, 3239516985u, +3844250972u, 1275954779u, +1385684948u, 2243700741u, +2512155003u, 1685649437u, +639306006u, 2524620206u, +955360345u, 1646776457u, +576786501u, 655707039u, +2864351838u, 3736264674u, +655621239u, 362070173u, +1200907897u, 2384379464u, +15823708u, 206117476u, +3652870937u, 122927134u, +1193310960u, 1093099415u, +3696538026u, 4112584792u, +1834541277u, 845639252u, +2069527017u, 547588820u, +4178147211u, 2827259351u, +1764455305u, 3312003602u, +940846775u, 1054995047u, +2976960697u, 1934305529u, +3095615046u, 3354962706u, +2199137382u, 1005722394u, +1875867180u, 2064356511u, +3363633633u, 2688499147u, +4019734130u, 3096333006u, +2069509024u, 2906358341u, +3247463123u, 4191788132u, +2232866485u, 1456016086u, +1422674894u, 867282151u, +1851386407u, 1268304058u, +1612503136u, 1739843072u, +134947567u, 2978775774u, +2051592101u, 1017127033u, +1284167756u, 1090844589u, +831688783u, 2079216362u, +2079309682u, 1950585801u, +1626991196u, 3644714163u, +3678110059u, 898470030u, +1117570988u, 2517572125u, +3916646913u, 3182422972u, +3630426828u, 969847973u, +2835126238u, 53541366u, +3427164640u, 3463937250u, +3044785046u, 897322257u, +103038235u, 3804506837u, +3443872170u, 4185408854u, +2557463241u, 4080940424u, +3669923099u, 2789619871u, +2048168570u, 2429169982u, +3174690447u, 2513494106u, +3099587829u, 2627855577u, +1213061732u, 3143736628u, +3482268149u, 1250714337u, +3553412672u, 2689632914u, +31648125u, 3872383625u, +1565760579u, 36665130u, +1282106920u, 359361724u, +751041229u, 2257179590u, +2915361862u, 280819225u, +954406473u, 4101682199u, +2907818413u, 4254297769u, +3493178615u, 3755944354u, +3539557658u, 3330196096u, +4043533423u, 1134196225u, +4177134659u, 127246419u, +4213770762u, 1978302978u, +2442615581u, 923049607u, +1004426206u, 782768297u, +2702745496u, 1880389457u, +2410586681u, 1430106871u, +4103323427u, 3168399477u, +201787012u, 3105353527u, +3716682375u, 3616334719u, +3413209549u, 656672786u, +526032790u, 2895072131u, +2876965944u, 182894450u, +456581318u, 2683752067u, +1287916294u, 1270745752u, +3877875910u, 3190666241u, +3240336907u, 4024807233u, +4227999465u, 2389301430u, +1681224377u, 1576191191u, +3599250276u, 2381111980u, +3995044500u, 995595530u, +3495321877u, 3956024585u, +1611608524u, 3815677453u, +1520987487u, 3669102590u, +2062334396u, 1656117707u, +5457134u, 3234118251u, +4242065111u, 596879987u, +470187419u, 2688566989u, +3259870297u, 660100446u, +1042378442u, 2206034096u, +442236198u, 2542452448u, +493137955u, 392411099u, +3111186954u, 438250493u, +947967568u, 1234595917u, +4230082284u, 2762976773u, +421203727u, 3728409592u, +2870085764u, 1455086530u, +2762099647u, 4011882747u, +1785430706u, 3684427488u, +1215981925u, 3227517889u, +3269061963u, 4037515364u, +1749401388u, 2167451566u, +3168911474u, 4255057396u, +2026092260u, 1736192508u, +4123254745u, 2319366806u, +3909727042u, 3114708966u, +1938800693u, 680793595u, +3933041672u, 616863613u, +1525265867u, 2808224480u, +2122290603u, 1211197714u, +1186177814u, 2395325006u, +3520488321u, 3979192396u, +3540779343u, 4192918639u, +1763872074u, 3402419930u, +2736030448u, 1120335563u, +1698949078u, 3993310631u, +2947659998u, 1461045789u, +1966048551u, 2228221363u, +597941119u, 3498018399u, +1441110751u, 2229999711u, +393987327u, 454500547u, +1222959566u, 567151340u, +2496952483u, 1708770195u, +3774764786u, 1492844524u, +3308300614u, 805568076u, +4068812294u, 3404648243u, +868414882u, 177406999u, +1608110313u, 642061169u, +2093999089u, 222470301u, +1027515771u, 3131251981u, +2851936150u, 4272755262u, +2763002551u, 1881527822u, +1532845092u, 709643652u, +682573592u, 1244104217u, +440905170u, 1111321746u, +796769556u, 2500467040u, +3002618826u, 1112998535u, +1188525643u, 4212674512u, +1780193104u, 1243644607u, +3691719535u, 2958853053u, +2813437721u, 4036584207u, +466635014u, 2277292580u, +4082276003u, 1030800045u, +1899531424u, 609466946u, +1750863246u, 379050598u, +3576413281u, 731493104u, +2707384133u, 2289193651u, +132259176u, 4115195437u, +1769890695u, 2715470335u, +3348954692u, 2166575624u, +1819263183u, 2028531518u, +2154809766u, 3672399742u, +1142139448u, 88299682u, +76727603u, 4198182186u, +2304993586u, 1666387627u, +2488475423u, 3832777692u, +284366017u, 3359785538u, +3469807328u, 2926494787u, +1914195188u, 1134129972u, +3829072836u, 2493478921u, +3738499303u, 3311304980u, +726951526u, 911080963u, +932916545u, 2235559063u, +2909742396u, 1765719309u, +465269850u, 3803621553u, +1456588655u, 508290328u, +1490719640u, 3356513470u, +2262196163u, 1451774941u, +2908490783u, 251085588u, +830410677u, 3172220325u, +4039692645u, 1383603170u, +3897208579u, 1940535730u, +151909546u, 2384458112u, +}; + +// Return false only if offset is -1 and a spot check of 3 hashes all yield 0. +bool Test(int offset, int len = 0) { +#undef Check +#undef IsAlive + +#define Check(x) do { \ + const uint32_t actual = (x), e = expected[index++]; \ + bool ok = actual == e; \ + if (!ok) { \ + cerr << "expected " << hex << e << " but got " << actual << endl; \ + ++errors; \ + } \ + assert(ok); \ +} while (0) + +#define IsAlive(x) do { alive += IsNonZero(x); } while (0) + + // After the following line is where the uses of "Check" and such will go. + static int index = 0; +if (offset == -1) { int alive = 0; { uint64_t h = farmhashxo::Hash64WithSeeds(data, len++, SEED0, SEED1); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashxo::Hash64WithSeed(data, len++, SEED); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } { uint64_t h = farmhashxo::Hash64(data, len++); IsAlive(h >> 32); IsAlive((h << 32) >> 32); } len -= 3; return alive > 0; } +{ uint64_t h = farmhashxo::Hash64WithSeeds(data + offset, len, SEED0, SEED1); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashxo::Hash64WithSeed(data + offset, len, SEED); Check(h >> 32); Check((h << 32) >> 32); } +{ uint64_t h = farmhashxo::Hash64(data + offset, len); Check(h >> 32); Check((h << 32) >> 32); } + + return true; +#undef Check +#undef IsAlive +} + +int RunTest() { + Setup(); + int i = 0; + cout << "Running farmhashxoTest"; + if (!Test(-1)) { + cout << "... Unavailable\n"; + return NoteErrors(); + } + // Good. The function is attempting to hash, so run the full test. + int errors_prior_to_test = errors; + for ( ; i < kTestSize - 1; i++) { + Test(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + Test(0, i); + } + Test(0, kDataSize); + cout << (errors == errors_prior_to_test ? "... OK\n" : "... Failed\n"); + return NoteErrors(); +} + +#else + +// After the following line is where the code to print hash codes will go. +void Dump(int offset, int len) { +{ uint64_t h = farmhashxo::Hash64WithSeeds(data + offset, len, SEED0, SEED1); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashxo::Hash64WithSeed(data + offset, len, SEED); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +{ uint64_t h = farmhashxo::Hash64(data + offset, len); cout << (h >> 32) << "u, " << ((h << 32) >> 32) << "u," << endl; } +} + +#endif + +#undef SEED +#undef SEED1 +#undef SEED0 + +} // namespace farmhashxoTest + +#if !TESTING +int main(int argc, char** argv) { + Setup(); + cout << "uint32_t expected[] = {\n"; + int i = 0; + for ( ; i < kTestSize - 1; i++) { + farmhashxoTest::Dump(i * i, i); + } + for ( ; i < kDataSize; i += i / 7) { + farmhashxoTest::Dump(0, i); + } + farmhashxoTest::Dump(0, kDataSize); + cout << "};\n"; +} +#endif + +int main() { + farmhashccTest::RunTest(); + farmhashmkTest::RunTest(); + farmhashnaTest::RunTest(); + farmhashntTest::RunTest(); + farmhashsaTest::RunTest(); + farmhashsuTest::RunTest(); + farmhashteTest::RunTest(); + farmhashuoTest::RunTest(); + farmhashxoTest::RunTest(); + __builtin_unreachable(); +} + +#endif // FARMHASHSELFTEST +#endif // DEVICE_MODIFIER +#endif // FARM_HASH_GPU_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/flatbuffers/LICENSE b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/flatbuffers/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/flatbuffers/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/LICENSE b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint.h new file mode 100644 index 0000000000000000000000000000000000000000..56e95c00f7580d430a94e202fa465bc28773074d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint.h @@ -0,0 +1,914 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// fixedpoint.h: fixed-point arithmetic, with basic operations and +// a few math functions such as tanh. + +#ifndef GEMMLOWP_INTERNAL_FIXEDPOINT_H_ +#define GEMMLOWP_INTERNAL_FIXEDPOINT_H_ + +#include +#include +#include +#include +#include + +#include "../internal/detect_platform.h" + +namespace gemmlowp { + +// Part 1: Low-level integer-arithmetic primitives. +// The implementations here are generic implementations valid for +// scalar types (e.g. std::int32_t). Architecture-specific SIMD types +// (e.g. NEON int32x4_t) may be supported by providing +// specializations for them in separate files. +// +// The purpose of these primitives is two-fold: +// - They will be used to implement higher-level fixed-point +// abstractions, namely the FixedPoint class and its arithmetic +// operators. +// - They will be directly used to implement some more involved +// fixed-point computations, e.g. the fixed-point implementation +// of math functions such as tanh. + +// Some compile-time traits around raw types to handle SIMD aspects: +// number of lanes, underlying scalar type. +template +struct FixedPointRawTypeTraits {}; + +template <> +struct FixedPointRawTypeTraits { + typedef std::int32_t ScalarRawType; + static constexpr int kLanes = 1; +}; + +template <> +struct FixedPointRawTypeTraits { + typedef std::int16_t ScalarRawType; + static constexpr int kLanes = 1; +}; + +// Returns a SIMD value duplicating a scalar value across all lanes. +template +tRawType Dup(typename FixedPointRawTypeTraits::ScalarRawType x) { + return x; +} + +// Plain bit-wise AND +template +tIntegerType BitAnd(tIntegerType a, tIntegerType b) { + return a & b; +} + +// Plain bit-wise OR +template +tIntegerType BitOr(tIntegerType a, tIntegerType b) { + return a | b; +} + +// Plain bit-wise XOR +template +tIntegerType BitXor(tIntegerType a, tIntegerType b) { + return a ^ b; +} + +// Plain bit-wise NOT +template +tIntegerType BitNot(tIntegerType a) { + return ~a; +} + +// Integer addition. Not saturating. Overflow is undefined behavior. +template +tIntegerType Add(tIntegerType a, tIntegerType b) { + return a + b; +} + +// Integer multiplication. Not saturating. Overflow is undefined behavior. +template +tIntegerType Mul(tIntegerType a, tIntegerType b) { + return a * b; +} + +// Integer subtraction. Not saturating. Overflow is undefined behavior. +template +tIntegerType Sub(tIntegerType a, tIntegerType b) { + return a - b; +} + +// Integer unary negative. Not saturating. Overflow is undefined behavior. +template +tIntegerType Neg(tIntegerType a) { + return -a; +} + +// Integer arithmetic left-shift, equivalent to multiplying with a power of two. +// Negative values are OK. In case of overflow, no Undefined +// Behavior, but the results are implementation-defined (in practice, +// they currently are saturated, but we make no commitment to that). The idea +// is that the caller will want to implement the overflowing cases with +// saturation with compare-and-mask, so we don't care about the results +// in the overflow case, we just want to avoid undefined behavior. +// +// tIntegerType may be int32 or any narrower signed type. +template +tIntegerType ShiftLeft(tIntegerType a, OffsetType offset) { + const std::int64_t wide_a = static_cast(a); + const std::int64_t wide_shifted = wide_a * (1 << offset); + const auto min = std::numeric_limits::min(); + const auto max = std::numeric_limits::max(); + return wide_shifted < min + ? min + : wide_shifted > max ? max + : static_cast(wide_shifted); +} + +// Integer arithmetic right-shift. Not rounding. +// Relying on implementation-defined, but in-practice-consistent, +// C++ compiler behavior. +template +tIntegerType ShiftRight(tIntegerType a, int offset) { + return a >> offset; +} + +// Each bit of the result is set to the corresponding bit of either then_val or +// else_val depending on whether the corresponding bit of if_mask is set. +// Equivalent to the VBSL instruction in ARM NEON. +template +tIntegerType SelectUsingMask(tIntegerType if_mask, tIntegerType then_val, + tIntegerType else_val) { + return BitXor(BitAnd(if_mask, then_val), BitAnd(BitNot(if_mask), else_val)); +} + +// For each input scalar, the corresponding bits of the result are set if the +// input scalar is non-zero. +template +tIntegerType MaskIfNonZero(tIntegerType a) { + static constexpr tIntegerType zero = 0; + return a ? BitNot(zero) : zero; +} + +// For each input scalar, the corresponding bits of the result are set if the +// input scalar is zero. +template +tIntegerType MaskIfZero(tIntegerType a) { + return MaskIfNonZero(!a); +} + +// For each pair of input scalars, the corresponding bits of the result are +// set if the input scalars are equal. +template +tIntegerType MaskIfEqual(tIntegerType a, tIntegerType b) { + return MaskIfNonZero(a == b); +} + +// For each pair of input scalars, the corresponding bits of the result are +// set if the input scalars are not equal. +template +tIntegerType MaskIfNotEqual(tIntegerType a, tIntegerType b) { + return MaskIfNonZero(a != b); +} + +// For each pair of input scalars, the corresponding bits of the result are +// set if the input scalars a, b satisfy a > b. +template +tIntegerType MaskIfGreaterThan(tIntegerType a, tIntegerType b) { + return MaskIfNonZero(a > b); +} + +// For each pair of input scalars, the corresponding bits of the result are +// set if the input scalars a, b satisfy a >= b. +template +tIntegerType MaskIfGreaterThanOrEqual(tIntegerType a, tIntegerType b) { + return MaskIfNonZero(a >= b); +} + +// For each pair of input scalars, the corresponding bits of the result are +// set if the input scalars a, b satisfy a < b. +template +tIntegerType MaskIfLessThan(tIntegerType a, tIntegerType b) { + return MaskIfNonZero(a < b); +} + +// For each pair of input scalars, the corresponding bits of the result are +// set if the input scalars a, b satisfy a <= b. +template +tIntegerType MaskIfLessThanOrEqual(tIntegerType a, tIntegerType b) { + return MaskIfNonZero(a <= b); +} + +// Returns true if all of the input scalars are nonzero. +// This function may currently assume that each of the input scalars has either +// all or none of its bits set. Otherwise, its behavior is currently undefined. +template +bool All(tIntegerType a) { + return a; +} + +// Returns true if any of the input scalars are nonzero. +// This function may currently assume that each of the input scalars has either +// all or none of its bits set. Otherwise, its behavior is currently undefined. +template +bool Any(tIntegerType a) { + return a; +} + +// Returns (a+b)/2, rounded to the nearest integer. +// Equivalent to VRHADD in the ARM NEON instruction set. +template +IntegerType RoundingHalfSum(IntegerType a, IntegerType b) { + static_assert(std::is_same::value, "unimplemented"); + (void)b; + return a; +} + +template <> +inline std::int32_t RoundingHalfSum(std::int32_t a, std::int32_t b) { + std::int64_t a64 = a; + std::int64_t b64 = b; + std::int64_t sum = a64 + b64; + std::int64_t sign = sum >= 0 ? 1 : -1; + return static_cast((sum + sign) / 2); +} + +template <> +inline std::int16_t RoundingHalfSum(std::int16_t a, std::int16_t b) { + std::int32_t a32 = a; + std::int32_t b32 = b; + std::int32_t sum = a32 + b32; + std::int32_t sign = sum >= 0 ? 1 : -1; + return static_cast((sum + sign) / 2); +} + +template +IntegerType SaturatingAdd(IntegerType a, IntegerType b) { + static_assert(std::is_same::value, "unimplemented"); + (void)b; + return a; +} + +// So far this is only needed for int16. +template <> +inline std::int16_t SaturatingAdd(std::int16_t a, std::int16_t b) { + std::int32_t a32 = a; + std::int32_t b32 = b; + std::int32_t sum = a32 + b32; + return static_cast( + std::min(static_cast(32767), + std::max(static_cast(-32768), sum))); +} + +template <> +inline std::int8_t SaturatingAdd(std::int8_t a, std::int8_t b) { + std::int16_t a16 = a; + std::int16_t b16 = b; + std::int16_t sum = a16 + b16; + return static_cast(std::min( + static_cast(std::numeric_limits::max()), + std::max(static_cast(std::numeric_limits::min()), sum))); +} + +// Returns a+b, saturating if the integers are 16bit or narrower, +// otherwise just a plain addition. +template +struct AddSaturatingIf16BitImpl { + static IntegerType Run(IntegerType a, IntegerType b) { return Add(a, b); } +}; +template +struct AddSaturatingIf16BitImpl { + static IntegerType Run(IntegerType a, IntegerType b) { + return SaturatingAdd(a, b); + } +}; +template +IntegerType AddSaturatingIf16Bit(IntegerType a, IntegerType b) { + using ScalarType = + typename FixedPointRawTypeTraits::ScalarRawType; + return AddSaturatingIf16BitImpl::Run(a, + b); +} + +// Returns the integer that represents the product of two fixed-point +// numbers, interpreting all integers as fixed-point values in the +// interval [-1, 1), rounding to the nearest value, and saturating +// -1 * -1 to the maximum value (since 1 is not in the half-open +// interval [-1, 1)). +// +// [The explanation below specializes to std::int32_t for example purpose.] +// +// The mapping between IntegerType and the interval [-1, 1) is unique and +// implied by IntegerType, which is assumed to be signed. For example, +// for IntegerType==std::int32_t, the mapping is +// real_value = integer_value / 2^31. +// So in this case, and leaving aside rounding and saturating, this +// function computes ((a / 2^31) * (b / 2^31)) * 2^31, which simplifies to +// (a * b) / 2^31. +// +// The 'doubling' part in the name of this function comes from the fact that +// this operation is very close to a "multiply-high" operation, keeping only +// the top half bits, except that that would be effectively computing +// (a * b) / 2^32, +// so here we are computing 2x that, since +// 1/2^31 = 2 * 1/2^32. +// The idea is to use all of the available 32 bits in the destination int32 +// value. +// +// [End of the explanation specializing to int32.] +// +// This is equivalent to the VQRDMULH instruction in ARM NEON. +template +IntegerType SaturatingRoundingDoublingHighMul(IntegerType a, IntegerType b) { + static_assert(std::is_same::value, "unimplemented"); + (void)b; + return a; +} + +// This function implements the same computation as the ARMv7 NEON VQRDMULH +// instruction. +template <> +inline std::int32_t SaturatingRoundingDoublingHighMul(std::int32_t a, + std::int32_t b) { + bool overflow = a == b && a == std::numeric_limits::min(); + std::int64_t a_64(a); + std::int64_t b_64(b); + std::int64_t ab_64 = a_64 * b_64; + std::int32_t nudge = ab_64 >= 0 ? (1 << 30) : (1 - (1 << 30)); + std::int32_t ab_x2_high32 = + static_cast((ab_64 + nudge) / (1ll << 31)); + return overflow ? std::numeric_limits::max() : ab_x2_high32; +} + +template <> +inline std::int16_t SaturatingRoundingDoublingHighMul(std::int16_t a, + std::int16_t b) { + bool overflow = a == b && a == std::numeric_limits::min(); + std::int32_t a_32(a); + std::int32_t b_32(b); + std::int32_t ab_32 = a_32 * b_32; + std::int16_t nudge = ab_32 >= 0 ? (1 << 14) : (1 - (1 << 14)); + std::int16_t ab_x2_high16 = + static_cast((ab_32 + nudge) / (1 << 15)); + return overflow ? std::numeric_limits::max() : ab_x2_high16; +} + +// Correctly-rounded-to-nearest division by a power-of-two. +// Also known as a rounding arithmetic right shift. +template +inline IntegerType RoundingDivideByPOT(IntegerType x, ExponentType exponent) { + assert(exponent >= 0); + assert(exponent <= 31); + const IntegerType mask = Dup((1ll << exponent) - 1); + const IntegerType zero = Dup(0); + const IntegerType one = Dup(1); + const IntegerType remainder = BitAnd(x, mask); + const IntegerType threshold = + Add(ShiftRight(mask, 1), BitAnd(MaskIfLessThan(x, zero), one)); + return Add(ShiftRight(x, exponent), + BitAnd(MaskIfGreaterThan(remainder, threshold), one)); +} + +// Returns the product of a run-time integer value by a compile-time power +// of two, with either a positive exponent (equivalent to an arithmetic +// left shift, saturating) or a negative exponent (equivalent to an arithmetic +// right shift, rounding to nearest). +template 0 ? 1 : Exponent < 0 ? -1 : 0)> +struct ImplSaturatingRoundingMultiplyByPOT {}; + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static IntegerType eval(IntegerType x) { return x; } +}; + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static IntegerType eval(IntegerType x) { + using ScalarIntegerType = + typename FixedPointRawTypeTraits::ScalarRawType; + const IntegerType min = + Dup(std::numeric_limits::min()); + const IntegerType max = + Dup(std::numeric_limits::max()); + const int ScalarIntegerTypeBits = 8 * sizeof(ScalarIntegerType); + + const std::int32_t threshold = + ((1 << (ScalarIntegerTypeBits - 1 - Exponent)) - 1); + const IntegerType positive_mask = + MaskIfGreaterThan(x, Dup(threshold)); + const IntegerType negative_mask = + MaskIfLessThan(x, Dup(-threshold)); + + IntegerType result = ShiftLeft(x, Exponent); + result = SelectUsingMask(positive_mask, max, result); + result = SelectUsingMask(negative_mask, min, result); + return result; + } +}; + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static IntegerType eval(IntegerType x) { + return RoundingDivideByPOT(x, -Exponent); + } +}; + +template +IntegerType SaturatingRoundingMultiplyByPOT(IntegerType x) { + return ImplSaturatingRoundingMultiplyByPOT::eval(x); +} + +// Part 2: the FixedPoint class. + +// A FixedPoint object represents a fixed-point value stored in the underlying +// integer type tRawType, if tRawType is a plain scalar integer type. +// Alternatively, tRawType may be a SIMD type (e.g. NEON int32x4_t) in which +// case a FixedPoint object represents a corresponding SIMD vector of fixed +// point values. +// +// tIntegerBits describes the range of the fixed-point format: if +// tIntegerBits == m then the range of representable values is the half-open +// interval [-2^m; 2^m) where the open boundary on the right side means that +// 2^m is not representable (how close the maximum representable value is to +// it, depends on bit-depth of tRawType). +// +// In "Q format notation", +// https://en.wikipedia.org/wiki/Q_(number_format) +// we are describing the format +// Qm.n +// where +// m = tIntegerBits +// and +// n = NumberOfBits(tRawType) - (m + 1) +// Note that the (m + 1) in the above line is because we adopt the convention +// that we count the integer bits exclusively of the sign bit; so (m + 1) is +// the total number of integer bits inclusive of the sign bit. +// +// Accordingly, the number of integral representable values in our range +// [-2^m ; 2^m) +// is equal to 2^(m+1). +template +class FixedPoint { + public: + typedef tRawType RawType; + + typedef FixedPointRawTypeTraits RawTypeTraits; + typedef typename RawTypeTraits::ScalarRawType ScalarRawType; + + static constexpr int kTotalBits = 8 * sizeof(ScalarRawType); + static constexpr int kIntegerBits = tIntegerBits; + static constexpr int kFractionalBits = kTotalBits - 1 - kIntegerBits; + static_assert(kIntegerBits >= 0 && kIntegerBits < kTotalBits, + "bad IntegerBits"); + + typedef FixedPoint ScalarFixedPointType; + + static const ScalarRawType ScalarRawMin() { + return std::numeric_limits::min(); + } + + static const ScalarRawType ScalarRawMax() { + return std::numeric_limits::max(); + } + + static const ScalarRawType RawMin() { + return VectorFromScalar(ScalarRawMin()); + } + + static const ScalarRawType RawMax() { + return VectorFromScalar(ScalarRawMax()); + } + + static FixedPoint FromRaw(RawType x) { + FixedPoint retval; + retval.raw() = x; + return retval; + } + + static FixedPoint FromScalarRaw(ScalarRawType x) { + FixedPoint retval; + retval.raw() = Dup(x); + return retval; + } + + static FixedPoint FromScalarFixedPoint(ScalarFixedPointType x) { + return FromScalarRaw(x.raw()); + } + + template + static FixedPoint ConstantPOT() { + static constexpr int kOffset = kFractionalBits + Exponent; + static_assert( + kOffset < 31, + "Constant not exactly representable in this fixed-point format"); + return FromScalarRaw(ScalarRawType(1) << kOffset); + } + + static FixedPoint Zero() { return FromScalarRaw(0); } + + static FixedPoint One() { + return FromScalarRaw( + kIntegerBits == 0 + ? ScalarRawMax() + : (ScalarRawType(1) << (kIntegerBits == 0 ? 0 : kFractionalBits))); + } + + static FixedPoint FromDouble(double x) { + const double min_bound = static_cast(ScalarRawMin()); + const double max_bound = static_cast(ScalarRawMax()); + return FromScalarRaw(static_cast(std::min( + std::max(round(x * static_cast(1ll << kFractionalBits)), + min_bound), + max_bound))); + } + + RawType raw() const { return i_; } + RawType& raw() { return i_; } + + private: + RawType i_; +}; + +// Part 3: implementation of arithmetic operators for the +// FixedPoint class, and a few related functions. + +// A FixedPoint multiplication is just a +// SaturatingRoundingDoublingHighMul operation on the underlying +// raw integer values. The IntegerBits simply add up, as is obvious +// from the fact that the range is [-2^IntegerBits, 2^IntegerBits). +template +FixedPoint operator*( + FixedPoint a, + FixedPoint b) { + FixedPoint c; + c.raw() = SaturatingRoundingDoublingHighMul(a.raw(), b.raw()); + return c; +} + +// Tweaking IntegerBits gives exact multiplication by a power of two. +template +FixedPoint ExactMulByPot( + FixedPoint a) { + FixedPoint c; + c.raw() = a.raw(); + return c; +} + +// If we want to leave IntegerBits fixed, then multiplication +// by a power of two has to be saturating/rounding, not exact anymore. +template +FixedPoint SaturatingRoundingMultiplyByPOT( + FixedPoint a) { + return FixedPoint::FromRaw( + SaturatingRoundingMultiplyByPOT(a.raw())); +} + +// Generic arithmetic operators. + +#define MAKE_FIXEDPOINT_UNARY_FUNC(FuncName, ImplFuncName) \ + template \ + FixedPoint FuncName( \ + FixedPoint a) { \ + return FixedPoint::FromRaw(ImplFuncName(a.raw())); \ + } + +#define MAKE_FIXEDPOINT_BINARY_FUNC(FuncName, ImplFuncName) \ + template \ + FixedPoint FuncName( \ + FixedPoint a, \ + FixedPoint b) { \ + return FixedPoint::FromRaw( \ + ImplFuncName(a.raw(), b.raw())); \ + } + +MAKE_FIXEDPOINT_UNARY_FUNC(operator-, Neg) +MAKE_FIXEDPOINT_UNARY_FUNC(operator~, BitNot) +MAKE_FIXEDPOINT_BINARY_FUNC(operator+, Add) +MAKE_FIXEDPOINT_BINARY_FUNC(operator-, Sub) +MAKE_FIXEDPOINT_BINARY_FUNC(operator&, BitAnd) +MAKE_FIXEDPOINT_BINARY_FUNC(operator^, BitXor) +MAKE_FIXEDPOINT_BINARY_FUNC(operator|, BitOr) +MAKE_FIXEDPOINT_BINARY_FUNC(RoundingHalfSum, RoundingHalfSum) + +#undef MAKE_FIXEDPOINT_UNARY_FUNC +#undef MAKE_FIXEDPOINT_BINARY_FUNC + +#define MAKE_FIXEDPOINT_UNARY_FUNC_RETURNING_RAW(FuncName) \ + template \ + tRawType FuncName(FixedPoint a) { \ + return FuncName(a.raw()); \ + } + +#define MAKE_FIXEDPOINT_BINARY_FUNC_RETURNING_RAW(FuncName) \ + template \ + tRawType FuncName(FixedPoint a, \ + FixedPoint b) { \ + return FuncName(a.raw(), b.raw()); \ + } + +MAKE_FIXEDPOINT_UNARY_FUNC_RETURNING_RAW(MaskIfZero) +MAKE_FIXEDPOINT_UNARY_FUNC_RETURNING_RAW(MaskIfNonZero) +MAKE_FIXEDPOINT_BINARY_FUNC_RETURNING_RAW(MaskIfEqual) +MAKE_FIXEDPOINT_BINARY_FUNC_RETURNING_RAW(MaskIfNotEqual) +MAKE_FIXEDPOINT_BINARY_FUNC_RETURNING_RAW(MaskIfGreaterThan) +MAKE_FIXEDPOINT_BINARY_FUNC_RETURNING_RAW(MaskIfGreaterThanOrEqual) +MAKE_FIXEDPOINT_BINARY_FUNC_RETURNING_RAW(MaskIfLessThan) +MAKE_FIXEDPOINT_BINARY_FUNC_RETURNING_RAW(MaskIfLessThanOrEqual) + +#undef MAKE_FIXEDPOINT_UNARY_FUNC_RETURNING_RAW +#undef MAKE_FIXEDPOINT_BINARY_FUNC_RETURNING_RAW + +template +FixedPoint SelectUsingMask( + tRawType if_mask, FixedPoint then_val, + FixedPoint else_val) { + return FixedPoint::FromRaw( + SelectUsingMask(if_mask, then_val.raw(), else_val.raw())); +} + +template +bool operator==(FixedPoint a, + FixedPoint b) { + return All(MaskIfEqual(a.raw(), b.raw())); +} + +template +bool operator!=(FixedPoint a, + FixedPoint b) { + return !(a == b); +} + +template +FixedPoint SaturatingAdd( + FixedPoint a, + FixedPoint b) { + return FixedPoint::FromRaw( + SaturatingAdd(a.raw(), b.raw())); +} + +template +FixedPoint AddSaturatingIf16Bit( + FixedPoint a, + FixedPoint b) { + return FixedPoint::FromRaw( + AddSaturatingIf16Bit(a.raw(), b.raw())); +} + +// Conversion to floating-point. +template +double ToDouble(FixedPoint x) { + static_assert(FixedPointRawTypeTraits::kLanes == 1, + "not applicable to SIMD types"); + typedef FixedPoint F; + return x.raw() / static_cast(1ll << F::kFractionalBits); +} + +// Rescale changes the number of IntegerBits and updates the underlying +// raw integer value accordingly. +template +FixedPoint Rescale( + FixedPoint x) { + static constexpr int kExponent = tIntegerBitsSrc - tIntegerBitsDst; + FixedPoint result; + result.raw() = SaturatingRoundingMultiplyByPOT(x.raw()); + return result; +} + +// CheckedFixedPointConstant allows to specify fixed-point constants +// initialized as real numbers, in a way that does not compile floating-point +// arithmetic in production code, yet still checks agreement with the +// floating-point expressions when asserts are enabled. +// +// The raw integer value provided is always a int32, encoding a 32-bit +// fixed-point value, regardless of the actual Scalar type. This allows +// writing generic code that applies just as well to the 32-bit and 16-bit +// cases. In the 16-bit case, the raw integer value is internally +// rounding-shifted by 16 bits to the right. +template +inline typename FixedPointType::ScalarRawType RescaleConstantInitializer( + std::int32_t int32_value) { + typedef typename FixedPointType::ScalarRawType ScalarRawType; + static constexpr int ScalarTypeBits = 8 * sizeof(ScalarRawType); + return static_cast( + RoundingDivideByPOT(int32_value, 32 - ScalarTypeBits)); +} +#ifdef GEMMLOWP_ENABLE_FIXEDPOINT_CONSTANTS_CHECKS +template +FixedPointType CheckedFixedPointConstant(std::int32_t raw_value, + double double_value) { + const FixedPointType result = FixedPointType::FromScalarRaw(raw_value); + assert(result == FixedPointType::FromDouble(double_value)); + return result; +} +#define GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(FixedPointType, \ + ScalarRawInt32Value, DoubleValue) \ + (gemmlowp::CheckedFixedPointConstant( \ + gemmlowp::RescaleConstantInitializer( \ + ScalarRawInt32Value), \ + DoubleValue)) + +#else +#define GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(FixedPointType, \ + ScalarRawInt32Value, DoubleValue) \ + (FixedPointType::FromScalarRaw( \ + gemmlowp::RescaleConstantInitializer( \ + ScalarRawInt32Value))) +#endif + +// Implementation of exponential function. + +// Returns exp(x) for x in [-1/4, 0). +template +FixedPoint exp_on_interval_between_negative_one_quarter_and_0_excl( + FixedPoint a) { + typedef FixedPoint F; + const F constant_term = + GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(F, 1895147668, std::exp(-1.0 / 8.0)); + const F constant_1_over_3 = + GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(F, 715827883, 1.0 / 3.0); + // We're evaluating a Taylor expansion around -1/8, so we do the change of + // variable: x = a + 1/8. + // In fixed-point with 0 integer bits, 1/8 is represented by 1 << 28. + F x = a + F::template ConstantPOT<-3>(); + F x2 = x * x; + F x3 = x2 * x; + F x4 = x2 * x2; + F x4_over_4 = SaturatingRoundingMultiplyByPOT<-2>(x4); + F x4_over_24_plus_x3_over_6_plus_x2_over_2 = + SaturatingRoundingMultiplyByPOT<-1>( + ((x4_over_4 + x3) * constant_1_over_3) + x2); + return AddSaturatingIf16Bit( + constant_term, + constant_term * (x + x4_over_24_plus_x3_over_6_plus_x2_over_2)); +} + +// Returns exp(x) for x < 0. +template +FixedPoint exp_on_negative_values( + FixedPoint a) { + typedef FixedPoint InputF; + typedef FixedPoint ResultF; + static constexpr int kFractionalBits = InputF::kFractionalBits; + static constexpr int kIntegerBits = InputF::kIntegerBits; + const InputF kOneQuarter = InputF::template ConstantPOT<-2>(); + InputF mask = kOneQuarter - InputF::FromScalarRaw(1); + InputF a_mod_quarter_minus_one_quarter = (a & mask) - kOneQuarter; + ResultF result = exp_on_interval_between_negative_one_quarter_and_0_excl( + Rescale<0>(a_mod_quarter_minus_one_quarter)); + tRawType remainder = (a_mod_quarter_minus_one_quarter - a).raw(); + +#define GEMMLOWP_EXP_BARREL_SHIFTER(Exponent, FixedPointMultiplier) \ + if (kIntegerBits > Exponent) { \ + const ResultF kMultiplier = GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT( \ + ResultF, FixedPointMultiplier, std::exp(-std::pow(2.0, Exponent))); \ + static constexpr int kShiftAmount = \ + kIntegerBits > Exponent ? kFractionalBits + Exponent : 0; \ + result = SelectUsingMask( \ + MaskIfNonZero(BitAnd(remainder, Dup(1 << kShiftAmount))), \ + result * kMultiplier, result); \ + } + + // Constants below are Q0 representations of negative exp fractionals: + GEMMLOWP_EXP_BARREL_SHIFTER(-2, 1672461947); // exp(-1/4) + GEMMLOWP_EXP_BARREL_SHIFTER(-1, 1302514674); // exp(-1/2) + GEMMLOWP_EXP_BARREL_SHIFTER(+0, 790015084); // exp(-1) + GEMMLOWP_EXP_BARREL_SHIFTER(+1, 290630308); // exp(-2) + GEMMLOWP_EXP_BARREL_SHIFTER(+2, 39332535); // exp(-4) + GEMMLOWP_EXP_BARREL_SHIFTER(+3, 720401); // exp(-8) + GEMMLOWP_EXP_BARREL_SHIFTER(+4, 242); // exp(-16) + +#undef GEMMLOWP_EXP_BARREL_SHIFTER + + static constexpr int clampB = kIntegerBits > 5 ? 36 - kIntegerBits : 0; + if (kIntegerBits > 5) { + const InputF clamp = + GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(InputF, -(1 << clampB), -32.0); + result = SelectUsingMask(MaskIfLessThan(a, clamp), ResultF::Zero(), result); + } + + result = SelectUsingMask(MaskIfZero(a), ResultF::One(), result); + return result; +} + +// Implementation of tanh: (1 - exp(-2x)) / (1 + exp(-2x)). + +// Returns (1 - x) / (1 + x) for x in (0, 1). +template +FixedPoint one_minus_x_over_one_plus_x_for_x_in_0_1( + FixedPoint a) { + typedef FixedPoint F0; + typedef FixedPoint F2; + F0 half_denominator = RoundingHalfSum(a, F0::One()); + // Newton-Raphson division + // https://en.wikipedia.org/wiki/Division_algorithm#Newton.E2.80.93Raphson_division + // Refer to that page for the logic behind the 48/17 and 32/17 constants. + const F2 constant_48_over_17 = + GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(F2, 1515870810, 48.0 / 17.0); + const F2 constant_neg_32_over_17 = + GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(F2, -1010580540, -32.0 / 17.0); + F2 x = constant_48_over_17 + half_denominator * constant_neg_32_over_17; + for (int i = 0; i < 3; i++) { + F2 half_denominator_times_x = half_denominator * x; + F2 one_minus_half_denominator_times_x = + F2::One() - half_denominator_times_x; + x = x + Rescale<2>(x * one_minus_half_denominator_times_x); + } + return Rescale<0>(x - F2::One()); +} + +// Returns -tanh(x) for x < 0. +template +FixedPoint neg_tanh_on_negative_values( + FixedPoint a) { + return one_minus_x_over_one_plus_x_for_x_in_0_1( + exp_on_negative_values(ExactMulByPot<1>(a))); +} + +// Returns tanh(x) for any x. +template +FixedPoint tanh(FixedPoint a) { + typedef FixedPoint InputF; + typedef FixedPoint ResultF; + tRawType mask_if_negative = MaskIfLessThan(a, InputF::Zero()); + tRawType mask_if_zero = MaskIfZero(a); + InputF n = SelectUsingMask(mask_if_negative, a, -a); + ResultF t = neg_tanh_on_negative_values(n); + return SelectUsingMask(mask_if_zero, ResultF::Zero(), + SelectUsingMask(mask_if_negative, -t, t)); +} + +// Implementation of logistic function. + +// Returns 1 / (1 + x) for x in (0, 1). +template +FixedPoint one_over_one_plus_x_for_x_in_0_1( + FixedPoint a) { + typedef FixedPoint F0; + typedef FixedPoint F2; + F0 half_denominator = RoundingHalfSum(a, F0::One()); + // Newton-Raphson division + // https://en.wikipedia.org/wiki/Division_algorithm#Newton.E2.80.93Raphson_division + // Refer to that page for the logic behind the 48/17 and 32/17 constants. + const F2 constant_48_over_17 = + GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(F2, 1515870810, 48.0 / 17.0); + const F2 constant_neg_32_over_17 = + GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(F2, -1010580540, -32.0 / 17.0); + F2 x = constant_48_over_17 + half_denominator * constant_neg_32_over_17; + for (int i = 0; i < 3; i++) { + F2 half_denominator_times_x = half_denominator * x; + F2 one_minus_half_denominator_times_x = + F2::One() - half_denominator_times_x; + x = x + Rescale<2>(x * one_minus_half_denominator_times_x); + } + return Rescale<0>(ExactMulByPot<-1>(x)); +} + +// Returns logistic(x) = 1 / (1 + exp(-x)) for x > 0. +template +FixedPoint logistic_on_positive_values( + FixedPoint a) { + return one_over_one_plus_x_for_x_in_0_1(exp_on_negative_values(-a)); +} + +// Returns logistic(x) = 1 / (1 + exp(-x)) for any x. +template +FixedPoint logistic(FixedPoint a) { + typedef FixedPoint InputF; + typedef FixedPoint ResultF; + tRawType mask_if_positive = MaskIfGreaterThan(a, InputF::Zero()); + tRawType mask_if_zero = MaskIfZero(a); + InputF abs_input = SelectUsingMask(mask_if_positive, a, -a); + ResultF result_if_positive = logistic_on_positive_values(abs_input); + ResultF result_if_negative = ResultF::One() - result_if_positive; + const ResultF one_half = + GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(ResultF, 1 << 30, 0.5); + return SelectUsingMask(mask_if_zero, one_half, + SelectUsingMask(mask_if_positive, result_if_positive, + result_if_negative)); +} + +} // end namespace gemmlowp + +#ifdef GEMMLOWP_NEON +#include "./fixedpoint_neon.h" +#elif defined(GEMMLOWP_AVX2) +#include "./fixedpoint_avx.h" +#elif defined(GEMMLOWP_SSE4) +#include "./fixedpoint_sse.h" +#elif defined(GEMMLOWP_MSA) +#include "./fixedpoint_msa.h" +#elif defined(GEMMLOWP_WASMSIMD) +#include "./fixedpoint_wasmsimd.h" +#endif + +#endif // GEMMLOWP_INTERNAL_FIXEDPOINT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_avx.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_avx.h new file mode 100644 index 0000000000000000000000000000000000000000..f3fe7321bc2d98d9dc3320dc857e119966cdc006 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_avx.h @@ -0,0 +1,384 @@ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// fixedpoint_avx.h: optimized avx specializations of the templates +// in fixedpoint.h. + +#ifndef GEMMLOWP_INTERNAL_FIXEDPOINT_AVX_H_ +#define GEMMLOWP_INTERNAL_FIXEDPOINT_AVX_H_ + +#include +#include "fixedpoint.h" +#include "fixedpoint_sse.h" + +namespace gemmlowp { + +struct int16x16_m256i { + __m256i v; +}; + +// Keep int16x16_m256i trivially constructible/destructible and provide +// easily optimized helper function. +inline int16x16_m256i to_int16x16_m256i(__m256i w) { + int16x16_m256i r; + r.v = w; + return r; +} + +template <> +struct FixedPointRawTypeTraits<__m256i> { + typedef std::int32_t ScalarRawType; + // TODO: This can actually support up to 8 lanes, so we should either + // change to 8 or create int32x8_m256i struct to handle that case. + static const int kLanes = 4; +}; + +template <> +struct FixedPointRawTypeTraits { + typedef std::int16_t ScalarRawType; + static const int kLanes = 16; +}; + +template <> +inline __m256i BitAnd(__m256i a, __m256i b) { + return _mm256_and_si256(a, b); +} + +template <> +inline int16x16_m256i BitAnd(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_and_si256(a.v, b.v)); +} + +template <> +inline __m256i BitOr(__m256i a, __m256i b) { + return _mm256_or_si256(a, b); +} + +template <> +inline int16x16_m256i BitOr(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_or_si256(a.v, b.v)); +} + +template <> +inline __m256i BitXor(__m256i a, __m256i b) { + return _mm256_xor_si256(a, b); +} + +template <> +inline int16x16_m256i BitXor(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_xor_si256(a.v, b.v)); +} + +template <> +inline __m256i BitNot(__m256i a) { + return _mm256_andnot_si256(a, _mm256_set1_epi32(-1)); +} + +template <> +inline int16x16_m256i BitNot(int16x16_m256i a) { + return to_int16x16_m256i(_mm256_andnot_si256(a.v, _mm256_set1_epi16(-1))); +} + +template <> +inline __m256i Add(__m256i a, __m256i b) { + return _mm256_add_epi32(a, b); +} + +template <> +inline int16x16_m256i Add(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_add_epi16(a.v, b.v)); +} + +template <> +inline __m256i Mul(__m256i a, __m256i b) { + return _mm256_mullo_epi32(a, b); +} + +template <> +inline int16x16_m256i Mul(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_mullo_epi16(a.v, b.v)); +} + +template <> +inline __m256i Sub(__m256i a, __m256i b) { + return _mm256_sub_epi32(a, b); +} + +template <> +inline int16x16_m256i Sub(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_sub_epi16(a.v, b.v)); +} + +template <> +inline __m256i Neg(__m256i a) { + return _mm256_sign_epi32(a, _mm256_set1_epi32(-1)); +} + +template <> +inline int16x16_m256i Neg(int16x16_m256i a) { + return to_int16x16_m256i(_mm256_sign_epi16(a.v, _mm256_set1_epi16(-1))); +} + +template <> +inline __m256i ShiftLeft(__m256i a, int offset) { + return _mm256_slli_epi32(a, offset); +} + +template <> +inline int16x16_m256i ShiftLeft(int16x16_m256i a, int offset) { + return to_int16x16_m256i(_mm256_slli_epi16(a.v, offset)); +} + +template <> +inline __m256i ShiftRight(__m256i a, int offset) { + return _mm256_srai_epi32(a, offset); +} + +template <> +inline int16x16_m256i ShiftRight(int16x16_m256i a, int offset) { + return to_int16x16_m256i(_mm256_srai_epi16(a.v, offset)); +} + +template <> +inline __m256i SelectUsingMask(__m256i if_mask, __m256i then_val, + __m256i else_val) { + return _mm256_castps_si256(_mm256_blendv_ps(_mm256_castsi256_ps(else_val), + _mm256_castsi256_ps(then_val), + _mm256_castsi256_ps(if_mask))); +} + +template <> +inline int16x16_m256i SelectUsingMask(int16x16_m256i if_mask, + int16x16_m256i then_val, + int16x16_m256i else_val) { + // Borrowed from Intel's arm_neon_sse.h header. + return to_int16x16_m256i( + _mm256_or_si256(_mm256_and_si256(if_mask.v, then_val.v), + _mm256_andnot_si256(if_mask.v, else_val.v))); +} + +template <> +inline __m256i MaskIfEqual(__m256i a, __m256i b) { + return _mm256_cmpeq_epi32(a, b); +} + +template <> +inline int16x16_m256i MaskIfEqual(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_cmpeq_epi16(a.v, b.v)); +} + +template <> +inline __m256i MaskIfNotEqual(__m256i a, __m256i b) { + return BitNot(MaskIfEqual(a, b)); +} + +template <> +inline int16x16_m256i MaskIfNotEqual(int16x16_m256i a, int16x16_m256i b) { + return BitNot(MaskIfEqual(a, b)); +} + +template <> +inline __m256i MaskIfZero(__m256i a) { + return MaskIfEqual(a, _mm256_set1_epi32(0)); +} + +template <> +inline int16x16_m256i MaskIfZero(int16x16_m256i a) { + return MaskIfEqual(a, to_int16x16_m256i(_mm256_set1_epi16(0))); +} + +template <> +inline __m256i MaskIfNonZero(__m256i a) { + return MaskIfNotEqual(a, _mm256_set1_epi32(0)); +} + +template <> +inline int16x16_m256i MaskIfNonZero(int16x16_m256i a) { + return MaskIfNotEqual(a, to_int16x16_m256i(_mm256_set1_epi16(0))); +} + +template <> +inline __m256i MaskIfGreaterThan(__m256i a, __m256i b) { + return _mm256_cmpgt_epi32(a, b); +} + +template <> +inline int16x16_m256i MaskIfGreaterThan(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_cmpgt_epi16(a.v, b.v)); +} + +template <> +inline __m256i MaskIfLessThan(__m256i a, __m256i b) { + return _mm256_cmpgt_epi32(b, a); +} + +template <> +inline int16x16_m256i MaskIfLessThan(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_cmpgt_epi16(b.v, a.v)); +} + +template <> +inline __m256i MaskIfGreaterThanOrEqual(__m256i a, __m256i b) { + return BitNot(MaskIfLessThan(a, b)); +} + +template <> +inline int16x16_m256i MaskIfGreaterThanOrEqual(int16x16_m256i a, + int16x16_m256i b) { + return BitNot(MaskIfLessThan(a, b)); +} + +template <> +inline __m256i MaskIfLessThanOrEqual(__m256i a, __m256i b) { + return BitNot(MaskIfGreaterThan(a, b)); +} + +template <> +inline int16x16_m256i MaskIfLessThanOrEqual(int16x16_m256i a, + int16x16_m256i b) { + return BitNot(MaskIfGreaterThan(a, b)); +} + +/* Assumptions: + - All and Any are used on masks. + - masks are all_ones for true lanes, all_zeroes otherwise. +Hence, All means all 128bits set, and Any means any bit set. +*/ + +template <> +inline bool All(__m256i a) { + return _mm256_testc_si256(a, a); +} + +template <> +inline bool All(int16x16_m256i a) { + return _mm256_testc_si256(a.v, a.v); +} + +template <> +inline bool Any(__m256i a) { + return BitNot(_mm256_testz_si256(a, a)); +} + +template <> +inline bool Any(int16x16_m256i a) { + return BitNot(_mm256_testz_si256(a.v, a.v)); +} + +template <> +inline __m256i RoundingHalfSum(__m256i a, __m256i b) { + /* __m256i round_bit_mask, a_over_2, b_over_2, round_bit, sum; */ + /* We divide the inputs before the add to avoid the overflow and costly test + */ + /* of checking if an overflow occured on signed add */ + /* round_bit_mask = _mm_set1_epi32(1); */ + /* a_over_2 = _mm_srai_epi32(a, 1); */ + /* b_over_2 = _mm_srai_epi32(b, 1); */ + /* sum = Add(a_over_2, b_over_2); */ + /* round_bit = _mm_sign_epi32(BitAnd(BitOr(a,b), round_bit_mask), sum); */ + /* return Add(sum, round_bit); */ + + /* Other possibility detecting overflow and xor the sign if an overflow + * happened*/ + __m256i one, sign_bit_mask, sum, rounded_half_sum, overflow, result; + one = _mm256_set1_epi32(1); + sign_bit_mask = _mm256_set1_epi32(0x80000000); + sum = Add(a, b); + rounded_half_sum = _mm256_srai_epi32(Add(sum, one), 1); + overflow = + BitAnd(BitAnd(BitXor(a, rounded_half_sum), BitXor(b, rounded_half_sum)), + sign_bit_mask); + result = BitXor(rounded_half_sum, overflow); + return result; +} + +template <> +inline int16x16_m256i RoundingHalfSum(int16x16_m256i a, int16x16_m256i b) { + // Borrowed from Intel's arm_neon_sse.h header. + __m256i constant_neg_32768 = _mm256_set1_epi16(-32768); + __m256i a_unsigned = _mm256_sub_epi16(a.v, constant_neg_32768); + __m256i b_unsigned = _mm256_sub_epi16(b.v, constant_neg_32768); + __m256i avg_unsigned = _mm256_avg_epu16(a_unsigned, b_unsigned); + __m256i avg = _mm256_add_epi16(avg_unsigned, constant_neg_32768); + return to_int16x16_m256i(avg); +} + +template <> +inline __m256i SaturatingRoundingDoublingHighMul(__m256i a, __m256i b) { + __m256i min, saturation_mask, a0_a2, a1_a3, b0_b2, b1_b3; + __m256i a0b0_a2b2, a1b1_a3b3, a0b0_a2b2_rounded, a1b1_a3b3_rounded; + __m256i a0b0_a2b2_rounded_2x, a1b1_a3b3_rounded_2x, result; + __m256i nudge; + + // saturation only happen if a == b == INT_MIN + min = _mm256_set1_epi32(std::numeric_limits::min()); + saturation_mask = BitAnd(MaskIfEqual(a, b), MaskIfEqual(a, min)); + + // a = a0 | a1 | a2 | a3 + // b = b0 | b1 | b2 | b3 + a0_a2 = a; + a1_a3 = _mm256_srli_si256(a, 4); + b0_b2 = b; + b1_b3 = _mm256_srli_si256(b, 4); + + a0b0_a2b2 = _mm256_mul_epi32(a0_a2, b0_b2); + a1b1_a3b3 = _mm256_mul_epi32(a1_a3, b1_b3); + + // do the rounding and take into account that it will be doubled + nudge = _mm256_set1_epi64x(1 << 30); + a0b0_a2b2_rounded = _mm256_add_epi64(a0b0_a2b2, nudge); + a1b1_a3b3_rounded = _mm256_add_epi64(a1b1_a3b3, nudge); + + // do the doubling + a0b0_a2b2_rounded_2x = _mm256_slli_epi64(a0b0_a2b2_rounded, 1); + a1b1_a3b3_rounded_2x = _mm256_slli_epi64(a1b1_a3b3_rounded, 1); + + // get the high part of the products + result = _mm256_blend_epi16(_mm256_srli_si256(a0b0_a2b2_rounded_2x, 4), + a1b1_a3b3_rounded_2x, 0xcc); + + // saturate those which overflowed + return SelectUsingMask(saturation_mask, min, result); +} + +template <> +inline int16x16_m256i SaturatingRoundingDoublingHighMul(int16x16_m256i a, + int16x16_m256i b) { + // Use _mm256_mulhrs_epi16 then saturate with a bit-operation, + // borrowed from Intel's arm_neon_sse.h header. + __m256i result_unsaturated = _mm256_mulhrs_epi16(a.v, b.v); + __m256i saturation_mask = + _mm256_cmpeq_epi16(result_unsaturated, _mm256_set1_epi16(0x8000)); + __m256i result = _mm256_xor_si256(result_unsaturated, saturation_mask); + return to_int16x16_m256i(result); +} + +template <> +inline __m256i Dup<__m256i>(std::int32_t x) { + return _mm256_set1_epi32(x); +} + +template <> +inline int16x16_m256i Dup(std::int16_t x) { + return to_int16x16_m256i(_mm256_set1_epi16(x)); +} + +// So far this is only needed for int16. +template <> +inline int16x16_m256i SaturatingAdd(int16x16_m256i a, int16x16_m256i b) { + return to_int16x16_m256i(_mm256_adds_epi16(a.v, b.v)); +} + +} // end namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_FIXEDPOINT_AVX_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_msa.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_msa.h new file mode 100644 index 0000000000000000000000000000000000000000..b17f32aa0064a244dd6d5764e846f2eec2c61f77 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_msa.h @@ -0,0 +1,413 @@ +// Copyright 2018 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// fixedpoint_msa.h: optimized MSA specializations of the templates +// in fixedpoint.h. + +#ifndef GEMMLOWP_INTERNAL_FIXEDPOINT_MSA_H_ +#define GEMMLOWP_INTERNAL_FIXEDPOINT_MSA_H_ + +#include + +namespace gemmlowp { + +template <> +struct FixedPointRawTypeTraits { + typedef std::int32_t ScalarRawType; + static constexpr int kLanes = 4; +}; + +template <> +struct FixedPointRawTypeTraits { + typedef std::int16_t ScalarRawType; + static constexpr int kLanes = 8; +}; + +template <> +inline v4i32 BitAnd(v4i32 a, v4i32 b) { + return reinterpret_cast(__builtin_msa_and_v(reinterpret_cast(a), + reinterpret_cast(b))); +} + +template <> +inline v8i16 BitAnd(v8i16 a, v8i16 b) { + return reinterpret_cast(__builtin_msa_and_v(reinterpret_cast(a), + reinterpret_cast(b))); +} + +template <> +inline v4i32 BitOr(v4i32 a, v4i32 b) { + return reinterpret_cast(__builtin_msa_or_v(reinterpret_cast(a), + reinterpret_cast(b))); +} + +template <> +inline v8i16 BitOr(v8i16 a, v8i16 b) { + return reinterpret_cast(__builtin_msa_or_v(reinterpret_cast(a), + reinterpret_cast(b))); +} + +template <> +inline v4i32 BitXor(v4i32 a, v4i32 b) { + return reinterpret_cast(__builtin_msa_xor_v(reinterpret_cast(a), + reinterpret_cast(b))); +} + +template <> +inline v8i16 BitXor(v8i16 a, v8i16 b) { + return reinterpret_cast(__builtin_msa_xor_v(reinterpret_cast(a), + reinterpret_cast(b))); +} + +template <> +inline v4i32 BitNot(v4i32 a) { + return reinterpret_cast(__builtin_msa_nor_v(reinterpret_cast(a), + reinterpret_cast(a))); +} + +template <> +inline v8i16 BitNot(v8i16 a) { + return reinterpret_cast(__builtin_msa_nor_v(reinterpret_cast(a), + reinterpret_cast(a))); +} + +template <> +inline v4i32 Add(v4i32 a, v4i32 b) { + return __builtin_msa_addv_w(a, b); +} + +template <> +inline v8i16 Add(v8i16 a, v8i16 b) { + return __builtin_msa_addv_h(a, b); +} + +template <> +inline v4i32 Sub(v4i32 a, v4i32 b) { + return __builtin_msa_subv_w(a, b); +} + +template <> +inline v8i16 Sub(v8i16 a, v8i16 b) { + return __builtin_msa_subv_h(a, b); +} + +template <> +inline v4i32 Neg(v4i32 a) { + v4i32 zeroes = __builtin_msa_ldi_w(0); + return __builtin_msa_subv_w(zeroes, a); +} + +template <> +inline v8i16 Neg(v8i16 a) { + v8i16 zeroes = __builtin_msa_ldi_h(0); + return __builtin_msa_subv_h(zeroes, a); +} + +template <> +inline v4i32 ShiftLeft(v4i32 a, int offset) { + return __builtin_msa_sll_w(a, __builtin_msa_fill_w(offset)); +} + +template <> +inline v8i16 ShiftLeft(v8i16 a, int offset) { + return __builtin_msa_sll_h(a, __builtin_msa_fill_h(offset)); +} + +template <> +inline v4i32 ShiftRight(v4i32 a, int offset) { + return __builtin_msa_sra_w(a, __builtin_msa_fill_w(offset)); +} + +template <> +inline v8i16 ShiftRight(v8i16 a, int offset) { + return __builtin_msa_sra_h(a, __builtin_msa_fill_h(offset)); +} + +template <> +inline v4i32 SelectUsingMask(v4i32 if_mask, v4i32 then_val, v4i32 else_val) { + if_mask = reinterpret_cast(__builtin_msa_bsel_v(reinterpret_cast(if_mask), + reinterpret_cast(else_val), + reinterpret_cast(then_val))); + return if_mask; +} + +template <> +inline v8i16 SelectUsingMask(v8i16 if_mask, v8i16 then_val, v8i16 else_val) { + if_mask = reinterpret_cast(__builtin_msa_bsel_v(reinterpret_cast(if_mask), + reinterpret_cast(else_val), + reinterpret_cast(then_val))); + return if_mask; +} + +template <> +inline v4i32 MaskIfEqual(v4i32 a, v4i32 b) { + return __builtin_msa_ceq_w(a, b); +} + +template <> +inline v8i16 MaskIfEqual(v8i16 a, v8i16 b) { + return __builtin_msa_ceq_h(a, b); +} + +template <> +inline v4i32 MaskIfNotEqual(v4i32 a, v4i32 b) { + return BitNot(MaskIfEqual(a, b)); +} + +template <> +inline v8i16 MaskIfNotEqual(v8i16 a, v8i16 b) { + return BitNot(MaskIfEqual(a, b)); +} + +template <> +inline v4i32 MaskIfZero(v4i32 a) { + return __builtin_msa_ceqi_w(a, 0); +} + +template <> +inline v8i16 MaskIfZero(v8i16 a) { + return __builtin_msa_ceqi_h(a, 0); +} + +template <> +inline v4i32 MaskIfNonZero(v4i32 a) { + return BitNot(MaskIfZero(a)); +} + +template <> +inline v8i16 MaskIfNonZero(v8i16 a) { + return BitNot(MaskIfZero(a)); +} + +template <> +inline v4i32 MaskIfGreaterThan(v4i32 a, v4i32 b) { + return __builtin_msa_clt_s_w(b, a); +} + +template <> +inline v8i16 MaskIfGreaterThan(v8i16 a, v8i16 b) { + return __builtin_msa_clt_s_h(b, a); +} + +template <> +inline v4i32 MaskIfGreaterThanOrEqual(v4i32 a, v4i32 b) { + return __builtin_msa_cle_s_w(b, a); +} + +template <> +inline v8i16 MaskIfGreaterThanOrEqual(v8i16 a, v8i16 b) { + return __builtin_msa_cle_s_h(b, a); +} + +template <> +inline v4i32 MaskIfLessThan(v4i32 a, v4i32 b) { + return __builtin_msa_clt_s_w(a, b); +} + +template <> +inline v8i16 MaskIfLessThan(v8i16 a, v8i16 b) { + return __builtin_msa_clt_s_h(a, b); +} + +template <> +inline v4i32 MaskIfLessThanOrEqual(v4i32 a, v4i32 b) { + return __builtin_msa_cle_s_w(a, b); +} + +template <> +inline v8i16 MaskIfLessThanOrEqual(v8i16 a, v8i16 b) { + return __builtin_msa_cle_s_h(a, b); +} + +template <> +inline bool All(v4i32 a) { + return __builtin_msa_bz_v(reinterpret_cast(BitNot(a))); +} + +template <> +inline bool All(v8i16 a) { + return __builtin_msa_bz_v(reinterpret_cast(BitNot(a))); +} + +template <> +inline bool Any(v4i32 a) { + return __builtin_msa_bnz_v(reinterpret_cast(a)); +} + +template <> +inline bool Any(v8i16 a) { + return __builtin_msa_bnz_v(reinterpret_cast(a)); +} + +template <> +inline v4i32 RoundingHalfSum(v4i32 a, v4i32 b) { + return __builtin_msa_aver_s_w(a, b); +} + +template <> +inline v8i16 RoundingHalfSum(v8i16 a, v8i16 b) { + return __builtin_msa_aver_s_h(a, b); +} + +template <> +inline v4i32 SaturatingRoundingDoublingHighMul(v4i32 a, v4i32 b) { + return __builtin_msa_mulr_q_w(a, b); +} + +template <> +inline v8i16 SaturatingRoundingDoublingHighMul(v8i16 a, v8i16 b) { + return __builtin_msa_mulr_q_h(a, b); +} + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static v4i32 eval(v4i32 x) { + static_assert(Exponent >= 0 && Exponent < 32, ""); + if (Exponent < 5) { + for (int i = 0; i < Exponent; i++) { + x = __builtin_msa_adds_s_w(x, x); + } + return x; + } else { + // Saturate each signed 32-bit element to (32 - Exponent) + // bits (this takes full care of negative elements). + v4i32 res = __builtin_msa_sat_s_w(x, 31 - Exponent); + // Set tmp to 0x7FFFFFFF for those elements which staturated + // to smaller (positive) values and 0 for all others. + v4i32 tmp = __builtin_msa_srli_w(__builtin_msa_clt_s_w(res, x), 1); + // Shift the saturated elements. The positive saturated elements + // will have Exponent trailing zero bits after the shift. Those + // need to be ones, not zeroes. + res = __builtin_msa_slli_w(res, Exponent); + // Finally, set those trailing zero bits to ones. + res = reinterpret_cast(__builtin_msa_or_v(reinterpret_cast(res), + reinterpret_cast(tmp))); + return res; + } + } +}; + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static v8i16 eval(v8i16 x) { + static_assert(Exponent >= 0 && Exponent < 16, ""); + if (Exponent < 5) { + for (int i = 0; i < Exponent; i++) { + x = __builtin_msa_adds_s_h(x, x); + } + return x; + } else { + // Saturate each signed 16-bit element to (16 - Exponent) + // bits (this takes full care of negative elements). + v8i16 res = __builtin_msa_sat_s_h(x, 15 - Exponent); + // Set tmp to 0x7FFF for those elements which staturated + // to smaller (positive) values and 0 for all others. + v8i16 tmp = __builtin_msa_srli_h(__builtin_msa_clt_s_h(res, x), 1); + // Shift the saturated elements. The positive saturated elements + // will have Exponent trailing zero bits after the shift. Those + // need to be ones, not zeroes. + res = __builtin_msa_slli_h(res, Exponent); + // Finally, set those trailing zero bits to ones. + res = reinterpret_cast(__builtin_msa_or_v(reinterpret_cast(res), + reinterpret_cast(tmp))); + return res; + } + } +}; + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static v4i32 eval(v4i32 x) { + static_assert(-31 <= Exponent && Exponent <= -1, ""); + // Isolate the sign bits. + v4i32 sign = __builtin_msa_srli_w(x, 31); + // Decrement the negative elements by 1 (with saturation). + x = __builtin_msa_subs_s_w(x, sign); + // Arithmetic shift right with rounding. + // The srari instruction rounds all midpoint values towards +infinity. + // It will correctly round negative midpoint values as we just + // decremented the negative values by 1. + return __builtin_msa_srari_w(x, -Exponent); + } +}; + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static v8i16 eval(v8i16 x) { + static_assert(-15 <= Exponent && Exponent <= -1, ""); + // Isolate the sign bits. + v8i16 sign = __builtin_msa_srli_h(x, 15); + // Decrement the negative elements by 1 (with saturation). + x = __builtin_msa_subs_s_h(x, sign); + // Arithmetic shift right with rounding. + // The srari instruction rounds all midpoint values towards +infinity. + // It will correctly round negative midpoint values as we just + // decremented the negative values by 1. + return __builtin_msa_srari_h(x, -Exponent); + } +}; + +template <> +inline v4i32 RoundingDivideByPOT(v4i32 x, int exponent) { + v4i32 e = __builtin_msa_fill_w(exponent); + // Isolate the sign bits. + v4i32 sign = __builtin_msa_srli_w(x, 31); + // Reset them to 0 if exponent is 0. + sign = __builtin_msa_min_s_w(sign, e); + // Decrement the negative elements by 1 (with saturation) + // if exponent is non-zero. + x = __builtin_msa_subs_s_w(x, sign); + // Arithmetic shift right with rounding. + // The srar instruction rounds all midpoint values towards +infinity. + // It will correctly round negative midpoint values as we just + // decremented the negative values by 1. + return __builtin_msa_srar_w(x, e); +} + +template <> +inline v8i16 RoundingDivideByPOT(v8i16 x, int exponent) { + v8i16 e = __builtin_msa_fill_h(exponent); + // Isolate the sign bits. + v8i16 sign = __builtin_msa_srli_h(x, 15); + // Reset them to 0 if exponent is 0. + sign = __builtin_msa_min_s_h(sign, e); + // Decrement the negative elements by 1 (with saturation) + // if exponent is non-zero. + x = __builtin_msa_subs_s_h(x, sign); + // Arithmetic shift right with rounding. + // The srar instruction rounds all midpoint values towards +infinity. + // It will correctly round negative midpoint values as we just + // decremented the negative values by 1. + return __builtin_msa_srar_h(x, e); +} + +template <> +inline v4i32 Dup(std::int32_t x) { + return __builtin_msa_fill_w(x); +} + +template <> +inline v8i16 Dup(std::int16_t x) { + return __builtin_msa_fill_h(x); +} + +// So far this is only needed for int16. +template <> +inline v8i16 SaturatingAdd(v8i16 a, v8i16 b) { + return __builtin_msa_adds_s_h(a, b); +} + +} // end namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_FIXEDPOINT_MSA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_neon.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_neon.h new file mode 100644 index 0000000000000000000000000000000000000000..4dab6c9917fccd382b0ef19867ac7ab277aa4adc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_neon.h @@ -0,0 +1,357 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// fixedpoint_neon.h: optimized NEON specializations of the templates +// in fixedpoint.h. + +#ifndef GEMMLOWP_INTERNAL_FIXEDPOINT_NEON_H_ +#define GEMMLOWP_INTERNAL_FIXEDPOINT_NEON_H_ + +#include + +namespace gemmlowp { + +template <> +struct FixedPointRawTypeTraits { + typedef std::int32_t ScalarRawType; + static constexpr int kLanes = 4; +}; + +template <> +struct FixedPointRawTypeTraits { + typedef std::int16_t ScalarRawType; + static constexpr int kLanes = 8; +}; + +template <> +inline int32x4_t BitAnd(int32x4_t a, int32x4_t b) { + return vandq_s32(a, b); +} + +template <> +inline int16x8_t BitAnd(int16x8_t a, int16x8_t b) { + return vandq_s16(a, b); +} + +template <> +inline int32x4_t BitOr(int32x4_t a, int32x4_t b) { + return vorrq_s32(a, b); +} + +template <> +inline int16x8_t BitOr(int16x8_t a, int16x8_t b) { + return vorrq_s16(a, b); +} + +template <> +inline int32x4_t BitXor(int32x4_t a, int32x4_t b) { + return veorq_s32(a, b); +} + +template <> +inline int16x8_t BitXor(int16x8_t a, int16x8_t b) { + return veorq_s16(a, b); +} + +template <> +inline int32x4_t BitNot(int32x4_t a) { + return veorq_s32(a, vdupq_n_s32(-1)); +} + +template <> +inline int16x8_t BitNot(int16x8_t a) { + return veorq_s16(a, vdupq_n_s16(-1)); +} + +template <> +inline int32x4_t Add(int32x4_t a, int32x4_t b) { + return vaddq_s32(a, b); +} + +template <> +inline int16x8_t Add(int16x8_t a, int16x8_t b) { + return vaddq_s16(a, b); +} + +template <> +inline int32x4_t Sub(int32x4_t a, int32x4_t b) { + return vsubq_s32(a, b); +} + +template <> +inline int16x8_t Sub(int16x8_t a, int16x8_t b) { + return vsubq_s16(a, b); +} + +template <> +inline int32x4_t Neg(int32x4_t a) { + return vnegq_s32(a); +} + +template <> +inline int16x8_t Neg(int16x8_t a) { + return vnegq_s16(a); +} + +template <> +inline int32x4_t ShiftLeft(int32x4_t a, int offset) { + return vshlq_s32(a, vdupq_n_s32(offset)); +} + +template <> +inline int16x8_t ShiftLeft(int16x8_t a, int offset) { + return vshlq_s16(a, vdupq_n_s16(offset)); +} + +template <> +inline int32x4_t ShiftLeft(int32x4_t a, int32x4_t offset) { + return vshlq_s32(a, offset); +} + +template <> +inline int16x8_t ShiftLeft(int16x8_t a, int16x8_t offset) { + return vshlq_s16(a, offset); +} + +template <> +inline int32x4_t ShiftRight(int32x4_t a, int offset) { + return vshlq_s32(a, vdupq_n_s32(-offset)); +} + +template <> +inline int16x8_t ShiftRight(int16x8_t a, int offset) { + return vshlq_s16(a, vdupq_n_s16(-offset)); +} + +template <> +inline int32x4_t SelectUsingMask(int32x4_t if_mask, int32x4_t then_val, + int32x4_t else_val) { + return vbslq_s32(vreinterpretq_u32_s32(if_mask), then_val, else_val); +} + +template <> +inline int16x8_t SelectUsingMask(int16x8_t if_mask, int16x8_t then_val, + int16x8_t else_val) { + return vbslq_s16(vreinterpretq_u16_s16(if_mask), then_val, else_val); +} + +template <> +inline int32x4_t MaskIfEqual(int32x4_t a, int32x4_t b) { + return vreinterpretq_s32_u32(vceqq_s32(a, b)); +} + +template <> +inline int16x8_t MaskIfEqual(int16x8_t a, int16x8_t b) { + return vreinterpretq_s16_u16(vceqq_s16(a, b)); +} + +template <> +inline int32x4_t MaskIfNotEqual(int32x4_t a, int32x4_t b) { + return BitNot(MaskIfEqual(a, b)); +} + +template <> +inline int16x8_t MaskIfNotEqual(int16x8_t a, int16x8_t b) { + return BitNot(MaskIfEqual(a, b)); +} + +template <> +inline int32x4_t MaskIfZero(int32x4_t a) { + return MaskIfEqual(a, vdupq_n_s32(0)); +} + +template <> +inline int16x8_t MaskIfZero(int16x8_t a) { + return MaskIfEqual(a, vdupq_n_s16(0)); +} + +template <> +inline int32x4_t MaskIfNonZero(int32x4_t a) { + return vreinterpretq_s32_u32(vtstq_s32(a, a)); +} + +template <> +inline int16x8_t MaskIfNonZero(int16x8_t a) { + return vreinterpretq_s16_u16(vtstq_s16(a, a)); +} + +template <> +inline int32x4_t MaskIfGreaterThan(int32x4_t a, int32x4_t b) { + return vreinterpretq_s32_u32(vcgtq_s32(a, b)); +} + +template <> +inline int16x8_t MaskIfGreaterThan(int16x8_t a, int16x8_t b) { + return vreinterpretq_s16_u16(vcgtq_s16(a, b)); +} + +template <> +inline int32x4_t MaskIfGreaterThanOrEqual(int32x4_t a, int32x4_t b) { + return vreinterpretq_s32_u32(vcgeq_s32(a, b)); +} + +template <> +inline int16x8_t MaskIfGreaterThanOrEqual(int16x8_t a, int16x8_t b) { + return vreinterpretq_s16_u16(vcgeq_s16(a, b)); +} + +template <> +inline int32x4_t MaskIfLessThan(int32x4_t a, int32x4_t b) { + return vreinterpretq_s32_u32(vcltq_s32(a, b)); +} + +template <> +inline int16x8_t MaskIfLessThan(int16x8_t a, int16x8_t b) { + return vreinterpretq_s16_u16(vcltq_s16(a, b)); +} + +template <> +inline int32x4_t MaskIfLessThanOrEqual(int32x4_t a, int32x4_t b) { + return vreinterpretq_s32_u32(vcleq_s32(a, b)); +} + +template <> +inline int16x8_t MaskIfLessThanOrEqual(int16x8_t a, int16x8_t b) { + return vreinterpretq_s16_u16(vcleq_s16(a, b)); +} + +template <> +inline bool All(int32x4_t a) { + a = vandq_s32(a, vextq_s32(a, a, 1)); + a = vandq_s32(a, vextq_s32(a, a, 2)); + return vgetq_lane_s32(a, 0); +} + +template <> +inline bool All(int16x8_t a) { + a = vandq_s16(a, vextq_s16(a, a, 1)); + a = vandq_s16(a, vextq_s16(a, a, 2)); + a = vandq_s16(a, vextq_s16(a, a, 4)); + return vgetq_lane_s16(a, 0); +} + +template <> +inline bool Any(int32x4_t a) { + a = vorrq_s32(a, vextq_s32(a, a, 1)); + a = vorrq_s32(a, vextq_s32(a, a, 2)); + return vgetq_lane_s32(a, 0); +} + +template <> +inline bool Any(int16x8_t a) { + a = vorrq_s16(a, vextq_s16(a, a, 1)); + a = vorrq_s16(a, vextq_s16(a, a, 2)); + a = vorrq_s16(a, vextq_s16(a, a, 4)); + return vgetq_lane_s16(a, 0); +} + +template <> +inline int32x4_t RoundingHalfSum(int32x4_t a, int32x4_t b) { + return vrhaddq_s32(a, b); +} + +template <> +inline int16x8_t RoundingHalfSum(int16x8_t a, int16x8_t b) { + return vrhaddq_s16(a, b); +} + +template <> +inline int32x4_t SaturatingRoundingDoublingHighMul(int32x4_t a, int32x4_t b) { + return vqrdmulhq_s32(a, b); +} + +template <> +inline int16x8_t SaturatingRoundingDoublingHighMul(int16x8_t a, int16x8_t b) { + return vqrdmulhq_s16(a, b); +} + +template <> +inline int32x4_t RoundingDivideByPOT(int32x4_t x, int exponent) { + const int32x4_t shift_vec = vdupq_n_s32(-exponent); + const int32x4_t fixup = vshrq_n_s32(vandq_s32(x, shift_vec), 31); + const int32x4_t fixed_up_x = vqaddq_s32(x, fixup); + return vrshlq_s32(fixed_up_x, shift_vec); +} + +template <> +inline int16x8_t RoundingDivideByPOT(int16x8_t x, int exponent) { + const int16x8_t shift_vec = vdupq_n_s16(-exponent); + const int16x8_t fixup = vshrq_n_s16(vandq_s16(x, shift_vec), 15); + const int16x8_t fixed_up_x = vqaddq_s16(x, fixup); + return vrshlq_s16(fixed_up_x, shift_vec); +} + +template <> +inline int32x4_t RoundingDivideByPOT(int32x4_t x, int32x4_t exponent) { + const int32x4_t shift_vec = vnegq_s32(exponent); + const int32x4_t fixup = vshrq_n_s32(vandq_s32(x, shift_vec), 31); + const int32x4_t fixed_up_x = vqaddq_s32(x, fixup); + return vrshlq_s32(fixed_up_x, shift_vec); +} + +template <> +inline int16x8_t RoundingDivideByPOT(int16x8_t x, int16x8_t exponent) { + const int16x8_t shift_vec = vnegq_s16(exponent); + const int16x8_t fixup = vshrq_n_s16(vandq_s16(x, shift_vec), 15); + const int16x8_t fixed_up_x = vqaddq_s16(x, fixup); + return vrshlq_s16(fixed_up_x, shift_vec); +} + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static int32x4_t eval(int32x4_t x) { return vqshlq_n_s32(x, Exponent); } +}; + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static int32x4_t eval(int32x4_t x) { + const int32x4_t fixup = vshrq_n_s32(x, 31); + const int32x4_t fixed_up_x = vqaddq_s32(x, fixup); + return vrshrq_n_s32(fixed_up_x, -Exponent); + } +}; + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static int16x8_t eval(int16x8_t x) { return vqshlq_n_s16(x, Exponent); } +}; + +template +struct ImplSaturatingRoundingMultiplyByPOT { + static int16x8_t eval(int16x8_t x) { + const int16x8_t fixup = vshrq_n_s16(x, 15); + const int16x8_t fixed_up_x = vqaddq_s16(x, fixup); + return vrshrq_n_s16(fixed_up_x, -Exponent); + } +}; + +template <> +inline int32x4_t Dup(std::int32_t x) { + return vdupq_n_s32(x); +} + +template <> +inline int16x8_t Dup(std::int16_t x) { + return vdupq_n_s16(x); +} + +// So far this is only needed for int16. +template <> +inline int16x8_t SaturatingAdd(int16x8_t a, int16x8_t b) { + return vqaddq_s16(a, b); +} + +} // end namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_FIXEDPOINT_NEON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_sse.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_sse.h new file mode 100644 index 0000000000000000000000000000000000000000..fbaa26aab7ed0f211ba6ede8ecece4a638f66a38 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_sse.h @@ -0,0 +1,388 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// fixedpoint_SSE.h: optimized SSE specializations of the templates +// in fixedpoint.h. + +#ifndef GEMMLOWP_INTERNAL_FIXEDPOINT_SSE_H_ +#define GEMMLOWP_INTERNAL_FIXEDPOINT_SSE_H_ + +#include +#include "fixedpoint.h" + +namespace gemmlowp { + +// SSE intrinsics are not finely typed: there is a single __m128i vector +// type that does not distinguish between "int32x4" and "int16x8" use +// cases, unlike the NEON equivalents. Because we had initially focused +// on int32x4, we did not pay attention and specialized these fixedpoint +// templates directly for __m128i hardcoding the int32x4 semantics, +// not leaving room for int16x8 semantics. Amending that by adding a separate +// data type, int16x8_m128i, that wraps __m128i while being a separate +// type. +struct int16x8_m128i { + __m128i v; +}; + +// Keep int16x8_m128i trivially constructible/destructible and provide +// easily optimized helper function. +inline int16x8_m128i to_int16x8_m128i(__m128i w) { + int16x8_m128i r; + r.v = w; + return r; +} + +template <> +struct FixedPointRawTypeTraits<__m128i> { + typedef std::int32_t ScalarRawType; + static constexpr int kLanes = 4; +}; + +template <> +struct FixedPointRawTypeTraits { + typedef std::int16_t ScalarRawType; + static constexpr int kLanes = 8; +}; + +template <> +inline __m128i BitAnd(__m128i a, __m128i b) { + return _mm_and_si128(a, b); +} + +template <> +inline int16x8_m128i BitAnd(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_and_si128(a.v, b.v)); +} + +template <> +inline __m128i BitOr(__m128i a, __m128i b) { + return _mm_or_si128(a, b); +} + +template <> +inline int16x8_m128i BitOr(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_or_si128(a.v, b.v)); +} + +template <> +inline __m128i BitXor(__m128i a, __m128i b) { + return _mm_xor_si128(a, b); +} + +template <> +inline int16x8_m128i BitXor(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_xor_si128(a.v, b.v)); +} + +template <> +inline __m128i BitNot(__m128i a) { + return _mm_andnot_si128(a, _mm_set1_epi32(-1)); +} + +template <> +inline int16x8_m128i BitNot(int16x8_m128i a) { + return to_int16x8_m128i(_mm_andnot_si128(a.v, _mm_set1_epi16(-1))); +} + +template <> +inline __m128i Add(__m128i a, __m128i b) { + return _mm_add_epi32(a, b); +} + +template <> +inline int16x8_m128i Add(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_add_epi16(a.v, b.v)); +} + +template <> +inline __m128i Mul(__m128i a, __m128i b) { + return _mm_mullo_epi32(a, b); +} + +template <> +inline int16x8_m128i Mul(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_mullo_epi16(a.v, b.v)); +} + +template <> +inline __m128i Sub(__m128i a, __m128i b) { + return _mm_sub_epi32(a, b); +} + +template <> +inline int16x8_m128i Sub(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_sub_epi16(a.v, b.v)); +} + +template <> +inline __m128i Neg(__m128i a) { + return _mm_sign_epi32(a, _mm_set1_epi32(-1)); +} + +template <> +inline int16x8_m128i Neg(int16x8_m128i a) { + return to_int16x8_m128i(_mm_sign_epi16(a.v, _mm_set1_epi16(-1))); +} + +template <> +inline __m128i ShiftLeft(__m128i a, int offset) { + return _mm_slli_epi32(a, offset); +} + +template <> +inline int16x8_m128i ShiftLeft(int16x8_m128i a, int offset) { + return to_int16x8_m128i(_mm_slli_epi16(a.v, offset)); +} + +template <> +inline __m128i ShiftRight(__m128i a, int offset) { + return _mm_srai_epi32(a, offset); +} + +template <> +inline int16x8_m128i ShiftRight(int16x8_m128i a, int offset) { + return to_int16x8_m128i(_mm_srai_epi16(a.v, offset)); +} + +template <> +inline __m128i SelectUsingMask(__m128i if_mask, __m128i then_val, + __m128i else_val) { + // borrowed from Intel's arm_neon_sse.h header. + return _mm_or_si128(_mm_and_si128(if_mask, then_val), + _mm_andnot_si128(if_mask, else_val)); +} + +template <> +inline int16x8_m128i SelectUsingMask(int16x8_m128i if_mask, + int16x8_m128i then_val, + int16x8_m128i else_val) { + // borrowed from Intel's arm_neon_sse.h header. + return to_int16x8_m128i(SelectUsingMask(if_mask.v, then_val.v, else_val.v)); +} + +template <> +inline __m128i MaskIfEqual(__m128i a, __m128i b) { + return _mm_cmpeq_epi32(a, b); +} + +template <> +inline int16x8_m128i MaskIfEqual(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_cmpeq_epi16(a.v, b.v)); +} + +template <> +inline __m128i MaskIfNotEqual(__m128i a, __m128i b) { + return BitNot(MaskIfEqual(a, b)); +} + +template <> +inline int16x8_m128i MaskIfNotEqual(int16x8_m128i a, int16x8_m128i b) { + return BitNot(MaskIfEqual(a, b)); +} + +template <> +inline __m128i MaskIfZero(__m128i a) { + return MaskIfEqual(a, _mm_set1_epi32(0)); +} + +template <> +inline int16x8_m128i MaskIfZero(int16x8_m128i a) { + return MaskIfEqual(a, to_int16x8_m128i(_mm_set1_epi16(0))); +} + +template <> +inline __m128i MaskIfNonZero(__m128i a) { + return MaskIfNotEqual(a, _mm_set1_epi32(0)); +} + +template <> +inline int16x8_m128i MaskIfNonZero(int16x8_m128i a) { + return MaskIfNotEqual(a, to_int16x8_m128i(_mm_set1_epi16(0))); +} + +template <> +inline __m128i MaskIfGreaterThan(__m128i a, __m128i b) { + return _mm_cmpgt_epi32(a, b); +} + +template <> +inline int16x8_m128i MaskIfGreaterThan(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_cmpgt_epi16(a.v, b.v)); +} + +template <> +inline __m128i MaskIfLessThan(__m128i a, __m128i b) { + return _mm_cmplt_epi32(a, b); +} + +template <> +inline int16x8_m128i MaskIfLessThan(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_cmplt_epi16(a.v, b.v)); +} + +template <> +inline __m128i MaskIfGreaterThanOrEqual(__m128i a, __m128i b) { + return BitNot(MaskIfLessThan(a, b)); +} + +template <> +inline int16x8_m128i MaskIfGreaterThanOrEqual(int16x8_m128i a, + int16x8_m128i b) { + return BitNot(MaskIfLessThan(a, b)); +} + +template <> +inline __m128i MaskIfLessThanOrEqual(__m128i a, __m128i b) { + return BitNot(MaskIfGreaterThan(a, b)); +} + +template <> +inline int16x8_m128i MaskIfLessThanOrEqual(int16x8_m128i a, int16x8_m128i b) { + return BitNot(MaskIfGreaterThan(a, b)); +} + +/* Assumptions: + - All and Any are used on masks. + - masks are all_ones for true lanes, all_zeroes otherwise. +Hence, All means all 128bits set, and Any means any bit set. +*/ + +template <> +inline bool All(__m128i a) { + return _mm_testc_si128(a, a); +} + +template <> +inline bool All(int16x8_m128i a) { + return _mm_testc_si128(a.v, a.v); +} + +template <> +inline bool Any(__m128i a) { + return !_mm_testz_si128(a, a); +} + +template <> +inline bool Any(int16x8_m128i a) { + return !_mm_testz_si128(a.v, a.v); +} + +template <> +inline __m128i RoundingHalfSum(__m128i a, __m128i b) { + /* __m128i round_bit_mask, a_over_2, b_over_2, round_bit, sum; */ + /* We divide the inputs before the add to avoid the overflow and costly test + */ + /* of checking if an overflow occured on signed add */ + /* round_bit_mask = _mm_set1_epi32(1); */ + /* a_over_2 = _mm_srai_epi32(a, 1); */ + /* b_over_2 = _mm_srai_epi32(b, 1); */ + /* sum = Add(a_over_2, b_over_2); */ + /* round_bit = _mm_sign_epi32(BitAnd(BitOr(a,b), round_bit_mask), sum); */ + /* return Add(sum, round_bit); */ + + /* Other possibility detecting overflow and xor the sign if an overflow + * happened*/ + __m128i one, sign_bit_mask, sum, rounded_half_sum, overflow, result; + one = _mm_set1_epi32(1); + sign_bit_mask = _mm_set1_epi32(0x80000000); + sum = Add(a, b); + rounded_half_sum = _mm_srai_epi32(Add(sum, one), 1); + overflow = + BitAnd(BitAnd(BitXor(a, rounded_half_sum), BitXor(b, rounded_half_sum)), + sign_bit_mask); + result = BitXor(rounded_half_sum, overflow); + return result; +} + +template <> +inline int16x8_m128i RoundingHalfSum(int16x8_m128i a, int16x8_m128i b) { + // Idea: go to unsigned to use _mm_avg_epu16, + // borrowed from Intel's arm_neon_sse.h header. + __m128i constant_neg_32768 = _mm_set1_epi16(-32768); + __m128i a_unsigned = _mm_sub_epi16(a.v, constant_neg_32768); + __m128i b_unsigned = _mm_sub_epi16(b.v, constant_neg_32768); + __m128i avg_unsigned = _mm_avg_epu16(a_unsigned, b_unsigned); + __m128i avg = _mm_add_epi16(avg_unsigned, constant_neg_32768); + return to_int16x8_m128i(avg); +} + +template <> +inline __m128i SaturatingRoundingDoublingHighMul(__m128i a, __m128i b) { + __m128i min, saturation_mask, a0_a2, a1_a3, b0_b2, b1_b3; + __m128i a0b0_a2b2, a1b1_a3b3, a0b0_a2b2_rounded, a1b1_a3b3_rounded; + __m128i a0b0_a2b2_rounded_2x, a1b1_a3b3_rounded_2x, result; + __m128i nudge; + + // saturation only happen if a == b == INT_MIN + min = _mm_set1_epi32(std::numeric_limits::min()); + saturation_mask = BitAnd(MaskIfEqual(a, b), MaskIfEqual(a, min)); + + // a = a0 | a1 | a2 | a3 + // b = b0 | b1 | b2 | b3 + a0_a2 = a; + a1_a3 = _mm_srli_si128(a, 4); + b0_b2 = b; + b1_b3 = _mm_srli_si128(b, 4); + + a0b0_a2b2 = _mm_mul_epi32(a0_a2, b0_b2); + a1b1_a3b3 = _mm_mul_epi32(a1_a3, b1_b3); + + // do the rounding and take into account that it will be doubled + nudge = _mm_set1_epi64x(1 << 30); + a0b0_a2b2_rounded = _mm_add_epi64(a0b0_a2b2, nudge); + a1b1_a3b3_rounded = _mm_add_epi64(a1b1_a3b3, nudge); + + // do the doubling + a0b0_a2b2_rounded_2x = _mm_slli_epi64(a0b0_a2b2_rounded, 1); + a1b1_a3b3_rounded_2x = _mm_slli_epi64(a1b1_a3b3_rounded, 1); + + // get the high part of the products + result = _mm_blend_epi16(_mm_srli_si128(a0b0_a2b2_rounded_2x, 4), + a1b1_a3b3_rounded_2x, 0xcc); + + // saturate those which overflowed + return SelectUsingMask(saturation_mask, min, result); +} + +template <> +inline int16x8_m128i SaturatingRoundingDoublingHighMul(int16x8_m128i a, + int16x8_m128i b) { + // Idea: use _mm_mulhrs_epi16 then saturate with a bit-operation, + // borrowed from Intel's arm_neon_sse.h header. + __m128i result_unsaturated = _mm_mulhrs_epi16(a.v, b.v); + __m128i saturation_mask = + _mm_cmpeq_epi16(result_unsaturated, _mm_set1_epi16(0x8000)); + __m128i result = _mm_xor_si128(result_unsaturated, saturation_mask); + return to_int16x8_m128i(result); +} + +template <> +inline __m128i Dup<__m128i>(std::int32_t x) { + return _mm_set1_epi32(x); +} + +template <> +inline int16x8_m128i Dup(std::int16_t x) { + return to_int16x8_m128i(_mm_set1_epi16(x)); +} + +// So far this is only needed for int16. +template <> +inline int16x8_m128i SaturatingAdd(int16x8_m128i a, int16x8_m128i b) { + return to_int16x8_m128i(_mm_adds_epi16(a.v, b.v)); +} + +} // end namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_FIXEDPOINT_SSE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_wasmsimd.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_wasmsimd.h new file mode 100644 index 0000000000000000000000000000000000000000..868fbfed31887ba9d9f1eae00f2311596566147b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/fixedpoint/fixedpoint_wasmsimd.h @@ -0,0 +1,381 @@ +// Copyright 2020 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// fixedpoint_wasmsimd.h: optimized WAsm SIMD specializations of the templates +// in fixedpoint.h. + +#ifndef GEMMLOWP_INTERNAL_FIXEDPOINT_WASMSIMD_H_ +#define GEMMLOWP_INTERNAL_FIXEDPOINT_WASMSIMD_H_ + +#include + +namespace gemmlowp { + +// WAsm SIMD intrinsics are not typed: there is a single v128_t vector +// type that does not distinguish between "int32x4" and "int16x8" use +// cases, unlike the NEON equivalents. Because we had initially focused +// on int32x4, we did not pay attention and specialized these fixedpoint +// templates directly for v128_t hardcoding the int32x4 semantics, +// not leaving room for int16x8 semantics. Amending that by adding a separate +// data type, int16x8_v128_t, that wraps v128_t while being a separate +// type. +struct int16x8_v128_t { + v128_t v; +}; + +// Keep int16x8_v128_t trivially constructible/destructible and provide +// easily optimized helper function. +inline int16x8_v128_t to_int16x8_v128_t(v128_t w) { + int16x8_v128_t r; + r.v = w; + return r; +} + +template <> +struct FixedPointRawTypeTraits { + typedef std::int32_t ScalarRawType; + static constexpr int kLanes = 4; +}; + +template <> +struct FixedPointRawTypeTraits { + typedef std::int16_t ScalarRawType; + static constexpr int kLanes = 8; +}; + +template <> +inline v128_t BitAnd(v128_t a, v128_t b) { + return wasm_v128_and(a, b); +} + +template <> +inline int16x8_v128_t BitAnd(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_v128_and(a.v, b.v)); +} + +template <> +inline v128_t BitOr(v128_t a, v128_t b) { + return wasm_v128_or(a, b); +} + +template <> +inline int16x8_v128_t BitOr(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_v128_or(a.v, b.v)); +} + +template <> +inline v128_t BitXor(v128_t a, v128_t b) { + return wasm_v128_xor(a, b); +} + +template <> +inline int16x8_v128_t BitXor(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_v128_xor(a.v, b.v)); +} + +template <> +inline v128_t BitNot(v128_t a) { + return wasm_v128_not(a); +} + +template <> +inline int16x8_v128_t BitNot(int16x8_v128_t a) { + return to_int16x8_v128_t(wasm_v128_not(a.v)); +} + +template <> +inline v128_t Add(v128_t a, v128_t b) { + return wasm_i32x4_add(a, b); +} + +template <> +inline int16x8_v128_t Add(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_add(a.v, b.v)); +} + +template <> +inline v128_t Mul(v128_t a, v128_t b) { + return wasm_i32x4_mul(a, b); +} + +template <> +inline int16x8_v128_t Mul(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_mul(a.v, b.v)); +} + +template <> +inline v128_t Sub(v128_t a, v128_t b) { + return wasm_i32x4_sub(a, b); +} + +template <> +inline int16x8_v128_t Sub(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_sub(a.v, b.v)); +} + +template <> +inline v128_t Neg(v128_t a) { + return wasm_i32x4_neg(a); +} + +template <> +inline int16x8_v128_t Neg(int16x8_v128_t a) { + return to_int16x8_v128_t(wasm_i16x8_neg(a.v)); +} + +template <> +inline v128_t ShiftLeft(v128_t a, int offset) { + return wasm_i32x4_shl(a, offset); +} + +template <> +inline int16x8_v128_t ShiftLeft(int16x8_v128_t a, int offset) { + return to_int16x8_v128_t(wasm_i16x8_shl(a.v, offset)); +} + +template <> +inline v128_t ShiftRight(v128_t a, int offset) { + return wasm_i32x4_shr(a, offset); +} + +template <> +inline int16x8_v128_t ShiftRight(int16x8_v128_t a, int offset) { + return to_int16x8_v128_t(wasm_i16x8_shr(a.v, offset)); +} + +template <> +inline v128_t SelectUsingMask(v128_t if_mask, v128_t then_val, + v128_t else_val) { + return wasm_v128_bitselect(then_val, else_val, if_mask); +} + +template <> +inline int16x8_v128_t SelectUsingMask(int16x8_v128_t if_mask, + int16x8_v128_t then_val, + int16x8_v128_t else_val) { + return to_int16x8_v128_t( + wasm_v128_bitselect(then_val.v, else_val.v, if_mask.v)); +} + +template <> +inline v128_t MaskIfEqual(v128_t a, v128_t b) { + return wasm_i32x4_eq(a, b); +} + +template <> +inline int16x8_v128_t MaskIfEqual(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_eq(a.v, b.v)); +} + +template <> +inline v128_t MaskIfNotEqual(v128_t a, v128_t b) { + return wasm_i32x4_ne(a, b); +} + +template <> +inline int16x8_v128_t MaskIfNotEqual(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_ne(a.v, b.v)); +} + +template <> +inline v128_t MaskIfZero(v128_t a) { + return MaskIfEqual(a, wasm_i32x4_const(0, 0, 0, 0)); +} + +template <> +inline int16x8_v128_t MaskIfZero(int16x8_v128_t a) { + return MaskIfEqual( + a, to_int16x8_v128_t(wasm_i16x8_const(0, 0, 0, 0, 0, 0, 0, 0))); +} + +template <> +inline v128_t MaskIfNonZero(v128_t a) { + return MaskIfNotEqual(a, wasm_i32x4_const(0, 0, 0, 0)); +} + +template <> +inline int16x8_v128_t MaskIfNonZero(int16x8_v128_t a) { + return MaskIfNotEqual( + a, to_int16x8_v128_t(wasm_i16x8_const(0, 0, 0, 0, 0, 0, 0, 0))); +} + +template <> +inline v128_t MaskIfGreaterThan(v128_t a, v128_t b) { + return wasm_i32x4_gt(a, b); +} + +template <> +inline int16x8_v128_t MaskIfGreaterThan(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_gt(a.v, b.v)); +} + +template <> +inline v128_t MaskIfLessThan(v128_t a, v128_t b) { + return wasm_i32x4_lt(a, b); +} + +template <> +inline int16x8_v128_t MaskIfLessThan(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_lt(a.v, b.v)); +} + +template <> +inline v128_t MaskIfGreaterThanOrEqual(v128_t a, v128_t b) { + return wasm_i32x4_ge(a, b); +} + +template <> +inline int16x8_v128_t MaskIfGreaterThanOrEqual(int16x8_v128_t a, + int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_ge(a.v, b.v)); +} + +template <> +inline v128_t MaskIfLessThanOrEqual(v128_t a, v128_t b) { + return wasm_i32x4_le(a, b); +} + +template <> +inline int16x8_v128_t MaskIfLessThanOrEqual(int16x8_v128_t a, + int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_le(a.v, b.v)); +} + +/* Assumptions: + - All and Any are used on masks. + - masks are all_ones for true lanes, all_zeroes otherwise. +Hence, All means all 128bits set, and Any means any bit set. +*/ + +template <> +inline bool All(v128_t a) { + return wasm_i32x4_all_true(a); +} + +template <> +inline bool All(int16x8_v128_t a) { + return wasm_i16x8_all_true(a.v); +} + +template <> +inline bool Any(v128_t a) { + return wasm_i32x4_any_true(a); +} + +template <> +inline bool Any(int16x8_v128_t a) { + return wasm_i16x8_any_true(a.v); +} + +template <> +inline v128_t RoundingHalfSum(v128_t a, v128_t b) { + // We divide the inputs before the add to avoid the overflow and costly test. + const v128_t one = wasm_i32x4_const(1, 1, 1, 1); + const v128_t sign_bit_mask = + wasm_i32x4_const(0x80000000, 0x80000000, 0x80000000, 0x80000000); + const v128_t sum = Add(a, b); + const v128_t rounded_half_sum = ShiftRight(Add(sum, one), 1); + const v128_t overflow = + BitAnd(BitAnd(BitXor(a, rounded_half_sum), BitXor(b, rounded_half_sum)), + sign_bit_mask); + const v128_t result = BitXor(rounded_half_sum, overflow); + return result; +} + +template <> +inline int16x8_v128_t RoundingHalfSum(int16x8_v128_t a, int16x8_v128_t b) { + // Idea: go to unsigned to use wasm_u16x8_avgr, + // borrowed from Intel's arm_neon_sse.h header. + const v128_t constant_neg_32768 = wasm_i16x8_const( + -32768, -32768, -32768, -32768, -32768, -32768, -32768, -32768); + const v128_t a_unsigned = wasm_v128_xor(a.v, constant_neg_32768); + const v128_t b_unsigned = wasm_v128_xor(b.v, constant_neg_32768); + const v128_t avg_unsigned = wasm_u16x8_avgr(a_unsigned, b_unsigned); + const v128_t avg = wasm_v128_xor(avg_unsigned, constant_neg_32768); + return to_int16x8_v128_t(avg); +} + +template <> +inline v128_t SaturatingRoundingDoublingHighMul(v128_t a, v128_t b) { + // TODO: switch to extended multiplication once implemented in the toolchain + const v128_t a_sign = wasm_i32x4_shr(a, 31); + const v128_t b_sign = wasm_i32x4_shr(b, 31); + + const v128_t a_ext_lo = wasm_v32x4_shuffle(a, a_sign, 0, 4, 1, 5); + const v128_t a_ext_hi = wasm_v32x4_shuffle(a, a_sign, 2, 6, 3, 7); + const v128_t b_ext_lo = wasm_v32x4_shuffle(b, b_sign, 0, 4, 1, 5); + const v128_t b_ext_hi = wasm_v32x4_shuffle(b, b_sign, 2, 6, 3, 7); + + const v128_t ab_lo = wasm_i64x2_mul(a_ext_lo, b_ext_lo); + const v128_t ab_hi = wasm_i64x2_mul(a_ext_hi, b_ext_hi); + + const v128_t nudge_2x = + wasm_i64x2_const(INT64_C(0x80000000), INT64_C(0x80000000)); + const v128_t ab_lo_2x = wasm_i64x2_add(ab_lo, ab_lo); + const v128_t ab_hi_2x = wasm_i64x2_add(ab_hi, ab_hi); + + const v128_t ab_lo_rounded_2x = wasm_i64x2_add(ab_lo_2x, nudge_2x); + const v128_t ab_hi_rounded_2x = wasm_i64x2_add(ab_hi_2x, nudge_2x); + + const v128_t prod = + wasm_v32x4_shuffle(ab_lo_rounded_2x, ab_hi_rounded_2x, 1, 3, 5, 7); + + // Saturation only happen if a == b == INT_MIN, and this is the only case + // where prod == INT_MIN (0x80000000) instead of INT_MAX (0x7FFFFFFF). + const v128_t min = wasm_i32x4_const(INT32_C(0x80000000), INT32_C(0x80000000), + INT32_C(0x80000000), INT32_C(0x80000000)); + + return wasm_v128_xor(prod, wasm_i32x4_eq(prod, min)); +} + +template <> +inline int16x8_v128_t SaturatingRoundingDoublingHighMul(int16x8_v128_t a, + int16x8_v128_t b) { +#if 0 + // TODO: enable if https://github.com/WebAssembly/simd/pull/365 is accepted + return to_int16x8_v128_t(__builtin_wasm_q15mulr_saturate_s_i16x8(a.v, b.v)); +#else + // TODO: switch to extended multiplication once implemented in the toolchain + v128_t lo = wasm_i32x4_mul(wasm_i32x4_widen_low_i16x8(a.v), + wasm_i32x4_widen_low_i16x8(b.v)); + v128_t hi = wasm_i32x4_mul(wasm_i32x4_widen_high_i16x8(a.v), + wasm_i32x4_widen_high_i16x8(b.v)); + const v128_t inc = wasm_i32x4_const(0x4000, 0x4000, 0x4000, 0x4000); + lo = wasm_i32x4_add(lo, inc); + hi = wasm_i32x4_add(hi, inc); + lo = wasm_i32x4_shr(lo, 15); + hi = wasm_i32x4_shr(hi, 15); + return to_int16x8_v128_t(wasm_i16x8_narrow_i32x4(lo, hi)); +#endif +} + +template <> +inline v128_t Dup(std::int32_t x) { + return wasm_i32x4_splat(x); +} + +template <> +inline int16x8_v128_t Dup(std::int16_t x) { + return to_int16x8_v128_t(wasm_i16x8_splat(x)); +} + +// So far this is only needed for int16. +template <> +inline int16x8_v128_t SaturatingAdd(int16x8_v128_t a, int16x8_v128_t b) { + return to_int16x8_v128_t(wasm_i16x8_add_saturate(a.v, b.v)); +} + +} // end namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_FIXEDPOINT_WASMSIMD_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/allocator.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/allocator.h new file mode 100644 index 0000000000000000000000000000000000000000..e71df155596b6950323098069f62060c4a284e8b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/allocator.h @@ -0,0 +1,197 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// allocator.h: a buffer allocator that allows avoiding most of the +// malloc/free overhead, by: +// 1. Requiring all N allocations to be reserved in advance, and +// then commited at once, turning N allocations into 1. +// 2. Being persistent, the allocated storage is reused across commits, +// and only reallocated as needed when the commit size gets larger. +// +// This is driven by Android-specific needs: +// 1. On Android, the default (Bionic) allocator tends to aggressively +// unmap pages, which means that malloc/free can be surprisingly expensive. +// 2. On Android, stack allocations with alloca() can't be as large as on +// desktop platforms. +// +// General usage: +// 1. Reserve blocks by calling Reserve(), which returns a Handle. +// 2. Call Commit() once. +// 3. Now it is possible to get pointers to allocated buffers by calling +// GetPointer(). +// 4. Call Decommit() once. +// 5. The allocator is now reverted to its original state, except that +// it retained its allocated storage, so the next Commit() will be faster. +// The allocated storage is only freed when the Allocator object is +// destroyed. + +#ifndef GEMMLOWP_INTERNAL_ALLOCATOR_H_ +#define GEMMLOWP_INTERNAL_ALLOCATOR_H_ + +#include "common.h" + +namespace gemmlowp { + +enum class TypeId : std::uint8_t { Uint8, Int8, Uint16, Int16, Uint32, Int32 }; + +template +struct GetTypeIdImpl {}; + +template +inline TypeId GetTypeId() { + return GetTypeIdImpl::Value; +} + +template +struct GetTypeIdImpl : GetTypeIdImpl {}; + +#define GEMMLOWP_REGISTER_TYPEID(type_, id) \ + template <> \ + struct GetTypeIdImpl { \ + static const TypeId Value = TypeId::id; \ + }; + +GEMMLOWP_REGISTER_TYPEID(std::uint8_t, Uint8) +GEMMLOWP_REGISTER_TYPEID(std::int8_t, Int8) +GEMMLOWP_REGISTER_TYPEID(std::uint16_t, Uint16) +GEMMLOWP_REGISTER_TYPEID(std::int16_t, Int16) +GEMMLOWP_REGISTER_TYPEID(std::uint32_t, Uint32) +GEMMLOWP_REGISTER_TYPEID(std::int32_t, Int32) + +class Allocator { + public: + Allocator() + : committed_(false), + storage_size_(0), + storage_(nullptr), + reserved_blocks_(0), + reserved_bytes_(0), + generation_(0) {} + + ~Allocator() { + assert(!committed_); + assert(!reserved_blocks_); + DeallocateStorage(); + } + + // Alignment of allocated blocks. + static constexpr std::size_t kAlignment = kDefaultCacheLineSize; + + // This is all we need so far, and since the usage pattern is fixed, + // there is no point in allowing more until we need to. + static constexpr std::size_t kMaxBlocks = 5; + + void Commit() { + assert(!committed_); + + if (reserved_bytes_ > storage_size_) { + DeallocateStorage(); + storage_size_ = RoundUpToPowerOfTwo(reserved_bytes_); + storage_ = aligned_alloc(kAlignment, storage_size_); + } + + ReleaseBuildAssertion(!storage_size_ || storage_, "allocation failure"); + committed_ = true; + } + + void Decommit() { + assert(committed_); + committed_ = false; + generation_++; + + reserved_blocks_ = 0; + reserved_bytes_ = 0; + } + + // See generation_ + typedef std::size_t generation_t; + + // A handle on a reserved block. The user obtains + // one by calling Reserve() and, after committing, + // passes it to GetPointer(). + class Handle { + std::uint8_t index_; + generation_t generation_; + TypeId type_; + + friend class Allocator; + }; + + // Reserves a block sized for n elements of type T, and + // returns a handle to it. Must be called before committing. + template + Handle Reserve(std::size_t n) { + assert(!committed_ && "can't reserve blocks while committed"); + assert(reserved_blocks_ < kMaxBlocks && + "didn't expect to allocate this many blocks"); + const std::size_t bytes = RoundUp(n * sizeof(T)); + const std::size_t offset = reserved_bytes_; + const std::size_t index = reserved_blocks_; + + reserved_blocks_offsets_[index] = offset; + Handle h; + h.index_ = index; + h.generation_ = generation_; + h.type_ = GetTypeId(); + + reserved_blocks_++; + reserved_bytes_ += bytes; + + return h; + } + + // Returns the pointer to the allocated buffer for the given handle. + // Must be called after committing. + template + T* GetPointer(const Handle& h) const { + assert(committed_ && "can't get block pointers unless committed"); + assert(h.index_ < reserved_blocks_ && + "bad handle, points to inexistant block"); + assert(h.generation_ == generation_ && + "handle from earlier generation, have decommitted since"); + assert(h.type_ == GetTypeId() && "type mismatch"); + std::size_t offset = reserved_blocks_offsets_[h.index_]; + std::uintptr_t addr = reinterpret_cast(storage_) + offset; + return reinterpret_cast(addr); + } + + private: + void DeallocateStorage() { + assert(!committed_); + aligned_free(storage_); + storage_size_ = 0; + } + + // Set to true by Commit() and to false by Decommit(). Initially false. + bool committed_; + + // The actually allocated storage size and buffer pointer. + std::size_t storage_size_; + mutable void* storage_; + + // The number of blocks that have been reserved by Reserve(). + std::size_t reserved_blocks_; + // The number of bytes that have been reserved by Reserve(). + std::size_t reserved_bytes_; + // The offsets of reserved blocks into the storage buffer. + std::size_t reserved_blocks_offsets_[kMaxBlocks]; + + // The 'generation' is incremented on Decommit() and allows catching + // bad GetPointer() calls still referring to a previous commit. + generation_t generation_; +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_ALLOCATOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/block_params.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/block_params.h new file mode 100644 index 0000000000000000000000000000000000000000..aedd2614a538be8ff38e2889e298539d6991063c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/block_params.h @@ -0,0 +1,177 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// block_params.h: Logic to choose L1 and L2 block sizes +// to optimize cache-friendliness. + +#ifndef GEMMLOWP_INTERNAL_BLOCK_PARAMS_H_ +#define GEMMLOWP_INTERNAL_BLOCK_PARAMS_H_ + +#include "common.h" + +namespace gemmlowp { + +// A BlockParams instance contains a full description of all the block size +// parameters to be used by a Gemm. +// There are two nested levels of block subdivisions: first a subdivision +// into large blocks that should fit in last-level cache (what we call L2 here) +// and then another subdivision into smaller blocks that should fit in +// L1 cache. There is then actually a third level of subdivision to fit +// in registers, but we are not concerned with that here. +struct BlockParams { + // L1 block parameters determine the size of small blocks that should + // fit in L1 cache. + int l1_rows; + int l1_cols; + int l1_depth; + + // L2 block parameters determine the size of larger blocks that should + // fit in L2 cache. + int l2_rows; + int l2_cols; + int l2_depth; + + template + void Init(int rows, int cols, int depth, int num_threads, int l1_bytes_to_use, + int l2_bytes_to_use, float l2_rhs_factor) { + FindL2BlockSizes(rows, cols, depth, num_threads, + l2_bytes_to_use, l2_rhs_factor, &l2_rows, + &l2_cols, &l2_depth); + FindL1BlockSizes(l2_rows, l2_cols, l2_depth, l1_bytes_to_use, + &l1_rows, &l1_cols, &l1_depth); + } + + template + static void FindL2BlockSizes(int rows, int cols, int depth, int num_threads, + int l2_bytes_to_use, float l2_rhs_factor, + int* out_l2_rows, int* out_l2_cols, + int* out_l2_depth) { + int l2_rows = 0; + int l2_cols = 0; + int l2_depth = 0; + + int per_thread_rows = + std::max(1, RoundUp(rows) / num_threads); + + // No L2 blocking in the depth dimension at the moment. + // Too much loss of accuracy due to storing intermediate results in + // low precision. + // However, we still want to round l2_depth up to the next multiple + // of register size, so as to avoid having to special-case unaligned depths. + l2_depth = RoundUp(depth); + + { + int max_cache_friendly_l2_cols = std::max( + 1, static_cast(l2_rhs_factor * (l2_bytes_to_use / l2_depth))); + int min_l2_cols_blocks = + std::max(1, CeilQuotient(cols, max_cache_friendly_l2_cols)); + l2_cols = + RoundUp(CeilQuotient(cols, min_l2_cols_blocks)); + } + + // No L2 blocking in the row dimension if l2_rhs_factor is 1.0 as the row + // dimension concerns only the LHS. Blocking only RHS matrix for L2 enhances + // the performance on x86. + if (l2_rhs_factor == 1.0f) { + l2_rows = RoundUp(per_thread_rows); + } else { + int max_cache_friendly_l2_rows = + std::max(1, (l2_bytes_to_use - l2_depth * l2_cols) / + (num_threads * (l2_depth + 4 * l2_cols))); + int min_l2_rows_blocks = std::max( + 1, CeilQuotient(per_thread_rows, max_cache_friendly_l2_rows)); + l2_rows = RoundUp( + CeilQuotient(per_thread_rows, min_l2_rows_blocks)); + } + + *out_l2_rows = l2_rows; + *out_l2_cols = l2_cols; + *out_l2_depth = l2_depth; + } + + template + static void FindL1BlockSizes(int rows, int cols, int depth, + int l1_bytes_to_use, int* out_l1_rows, + int* out_l1_cols, int* out_l1_depth) { + int l1_rows = 0; + int l1_cols = 0; + int l1_depth = 0; + + // L2 block sizes should already be multiples of kernel block sizes. + assert(rows % KernelFormat::kRows == 0); + assert(cols % KernelFormat::kCols == 0); + assert(depth % KernelFormat::kDepth == 0); + + // No L1 blocking in the columns dimension at the moment. + // Thought not to be needed. Similar to Eigen. + l1_cols = cols; + + { + int max_cache_friendly_l1_depth = std::max( + 1, (l1_bytes_to_use - 4 * KernelFormat::kRows * KernelFormat::kCols) / + (KernelFormat::kRows + KernelFormat::kCols)); + int min_l1_depth_blocks = + std::max(1, CeilQuotient(depth, max_cache_friendly_l1_depth)); + l1_depth = + RoundUp(CeilQuotient(depth, min_l1_depth_blocks)); + } + + { + int max_cache_friendly_l1_rows = + std::max(1, l1_bytes_to_use / (l1_depth + 4 * l1_cols)); + int min_l1_rows_blocks = + std::max(1, CeilQuotient(rows, max_cache_friendly_l1_rows)); + l1_rows = + RoundUp(CeilQuotient(rows, min_l1_rows_blocks)); + } + + *out_l1_rows = l1_rows; + *out_l1_cols = l1_cols; + *out_l1_depth = l1_depth; + } +}; + +// A SideBlockParams instance contains only the block params relevant to +// one side (LHS or RHS), expressed in terms of 'width' instead of +// rows/colums. See the explanation in kernel.h: in the LHS, 'width' means +// the number of rows, while in the RHS, 'width' means the number of columns. +// That allows us to write generic code that applies to either LHS or RHS. +struct SideBlockParams { + // L1 block parameters determine the size of small blocks that should + // fit in L1 cache. + int l1_width; + int l1_depth; + + // L2 block parameters determine the size of larger blocks that should + // fit in L2 cache. + int l2_width; + int l2_depth; +}; + +enum class Side { Lhs, Rhs }; + +inline void GetSideBlockParams(Side side, SideBlockParams* side_block_params, + const BlockParams& block_params) { + side_block_params->l1_width = + side == Side::Lhs ? block_params.l1_rows : block_params.l1_cols; + side_block_params->l2_width = + side == Side::Lhs ? block_params.l2_rows : block_params.l2_cols; + + side_block_params->l1_depth = block_params.l1_depth; + side_block_params->l2_depth = block_params.l2_depth; +} + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_BLOCK_PARAMS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/common.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/common.h new file mode 100644 index 0000000000000000000000000000000000000000..708cc4078fce3ebaa817fafbe862ae64d1ef1a6f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/common.h @@ -0,0 +1,184 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// common.h: contains stuff that's used throughout gemmlowp +// and should always be available. + +#ifndef GEMMLOWP_INTERNAL_COMMON_H_ +#define GEMMLOWP_INTERNAL_COMMON_H_ + +#include "../internal/platform.h" +#include "../profiling/pthread_everywhere.h" + +#include +#include +#include +#include + +#include "../internal/detect_platform.h" +#include "../profiling/instrumentation.h" + +namespace gemmlowp { + +// Standard cache line size. Useful to optimize alignment and +// prefetches. Ideally we would query this at runtime, however +// 64 byte cache lines are the vast majority, and even if it's +// wrong on some device, it will be wrong by no more than a 2x factor, +// which should be acceptable. +const int kDefaultCacheLineSize = 64; + +// Default L1 and L2 data cache sizes. +// The L1 cache size is assumed to be for each core. +// The L2 cache size is assumed to be shared among all cores. What +// we call 'L2' here is effectively top-level cache. +// +// On x86, we should ideally query this at +// runtime. On ARM, the instruction to query this is privileged and +// Android kernels do not expose it to userspace. Fortunately, the majority +// of ARM devices have roughly comparable values: +// Nexus 5: L1 16k, L2 1M +// Android One: L1 32k, L2 512k +// The following values are equal to or somewhat lower than that, and were +// found to perform well on both the Nexus 5 and Android One. +// Of course, these values are in principle too low for typical x86 CPUs +// where we should set the L2 value to (L3 cache size / number of cores) at +// least. +// +#if defined(GEMMLOWP_ARM) && defined(__APPLE__) +// iPhone/iPad +const int kDefaultL1CacheSize = 48 * 1024; +const int kDefaultL2CacheSize = 2 * 1024 * 1024; +#elif defined(GEMMLOWP_ARM) || defined(GEMMLOWP_ANDROID) +// Other ARM or ARM-like hardware (Android implies ARM-like) so here it's OK +// to tune for ARM, although on x86 Atom we might be able to query +// cache sizes at runtime, which would be better. +const int kDefaultL1CacheSize = 16 * 1024; +const int kDefaultL2CacheSize = 384 * 1024; +#elif defined(GEMMLOWP_X86_64) +// x86-64 and not Android. Therefore, likely desktop-class x86 hardware. +// Thus we assume larger cache sizes, though we really should query +// them at runtime. +const int kDefaultL1CacheSize = 32 * 1024; +const int kDefaultL2CacheSize = 4 * 1024 * 1024; +#elif defined(GEMMLOWP_X86_32) +// x86-32 and not Android. Same as x86-64 but less bullish. +const int kDefaultL1CacheSize = 32 * 1024; +const int kDefaultL2CacheSize = 2 * 1024 * 1024; +#elif defined(GEMMLOWP_MIPS) +// MIPS and not Android. TODO: MIPS and Android? +const int kDefaultL1CacheSize = 32 * 1024; +const int kDefaultL2CacheSize = 1024 * 1024; +#else +// Less common hardware. Maybe some unusual or older or embedded thing. +// Assume smaller caches, but don't depart too far from what we do +// on ARM/Android to avoid accidentally exposing unexpected behavior. +const int kDefaultL1CacheSize = 16 * 1024; +const int kDefaultL2CacheSize = 256 * 1024; +#endif + +// The proportion of the cache that we intend to use for storing +// RHS blocks. This should be between 0 and 1, and typically closer to 1, +// as we typically want to use most of the L2 cache for storing a large +// RHS block. +#if defined(GEMMLOWP_X86) +// For IA, use the entire L2 cache for the RHS matrix. LHS matrix is not blocked +// for L2 cache. +const float kDefaultL2RhsFactor = 1.00f; +#else +const float kDefaultL2RhsFactor = 0.75f; +#endif + +// The number of bytes in a SIMD register. This is used to determine +// the dimensions of PackingRegisterBlock so that such blocks can +// be efficiently loaded into registers, so that packing code can +// work within registers as much as possible. +// In the non-SIMD generic fallback code, this is just a generic array +// size, so any size would work there. Different platforms may set this +// to different values but must ensure that their own optimized packing paths +// are consistent with this value. + +#ifdef GEMMLOWP_AVX2 +const int kRegisterSize = 32; +#else +const int kRegisterSize = 16; +#endif + +// Hints the CPU to prefetch the cache line containing ptr. +inline void Prefetch(const void* ptr) { +#if defined GEMMLOWP_ARM_64 && defined GEMMLOWP_ALLOW_INLINE_ASM + // Aarch64 has very detailed prefetch instructions, that compilers + // can't know how to map __builtin_prefetch to, and as a result, don't, + // leaving __builtin_prefetch a no-op on this architecture. + // For our purposes, "pldl1keep" is usually what we want, meaning: + // "prefetch for load, into L1 cache, using each value multiple times". + asm volatile("prfm pldl1keep, [%[ptr]]\n" ::[ptr] "r"(ptr) :); +#elif defined \ + __GNUC__ // Clang and GCC define __GNUC__ and have __builtin_prefetch. + __builtin_prefetch(ptr); +#else + (void)ptr; +#endif +} + +// Returns the runtime argument rounded down to the nearest multiple of +// the fixed Modulus. +template +Integer RoundDown(Integer i) { + return i - (i % Modulus); +} + +// Returns the runtime argument rounded up to the nearest multiple of +// the fixed Modulus. +template +Integer RoundUp(Integer i) { + return RoundDown(i + Modulus - 1); +} + +// Returns the quotient a / b rounded up ('ceil') to the nearest integer. +template +Integer CeilQuotient(Integer a, Integer b) { + return (a + b - 1) / b; +} + +// Returns the argument rounded up to the nearest power of two. +template +Integer RoundUpToPowerOfTwo(Integer n) { + Integer i = n - 1; + i |= i >> 1; + i |= i >> 2; + i |= i >> 4; + i |= i >> 8; + i |= i >> 16; + return i + 1; +} + +template +struct IsPowerOfTwo { + static constexpr bool value = !(N & (N - 1)); +}; + +template +void MarkMemoryAsInitialized(T* ptr, int size) { +#ifdef GEMMLOWP_MARK_MEMORY_AS_INITIALIZED + GEMMLOWP_MARK_MEMORY_AS_INITIALIZED(static_cast(ptr), + size * sizeof(T)); +#else + (void)ptr; + (void)size; +#endif +} + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_COMMON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/compute.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/compute.h new file mode 100644 index 0000000000000000000000000000000000000000..441750703b5470c8c8e0a56d1163d4ccc35ead16 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/compute.h @@ -0,0 +1,118 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// compute.h: the central stage of the Gemm computation, operates +// on already-packed LHS and RHS blocks and calls the Gemm kernel +// to compute a block of the product. + +#ifndef GEMMLOWP_INTERNAL_COMPUTE_H_ +#define GEMMLOWP_INTERNAL_COMPUTE_H_ + +#include "block_params.h" +#include "kernel.h" +#include "pack.h" + +namespace gemmlowp { + +template +class ComputeImpl { + typedef typename PackedLhs::KernelSideFormat KernelLhsFormat; + typedef typename PackedRhs::KernelSideFormat KernelRhsFormat; + typedef KernelFormat Format; + + const KernelBase& kernel_; + const BlockParams& block_params_; + + PackedResult* const packed_result_; + const PackedLhs& packed_lhs_; + const PackedRhs& packed_rhs_; + + public: + ComputeImpl(const KernelBase& _kernel, const BlockParams& _block_params, + PackedResult* _packed_result, const PackedLhs& _packed_lhs, + const PackedRhs& _packed_rhs) + : kernel_(_kernel), + block_params_(_block_params), + packed_result_(_packed_result), + packed_lhs_(_packed_lhs), + packed_rhs_(_packed_rhs) {} + + void Compute(int depth) { + depth = RoundUp(depth); + assert(depth <= block_params_.l2_depth); + for (int d = 0; d < depth; d += block_params_.l1_depth) { + int ds = std::min(block_params_.l1_depth, depth - d); + + for (int r = 0; r < block_params_.l2_rows; r += block_params_.l1_rows) { + int rs = std::min(block_params_.l1_rows, block_params_.l2_rows - r); + + ComputeL1(r, rs, 0, block_params_.l2_cols, d, ds); + } + } + } + + private: + static void MarkPackedResultBlockAsInitialized( + const MatrixMap& packed_result_block) { +#ifdef GEMMLOWP_MARK_MEMORY_AS_INITIALIZED + for (int col = 0; col < packed_result_block.cols(); col++) { + MarkMemoryAsInitialized( + packed_result_block.data() + col * packed_result_block.cols_stride(), + packed_result_block.rows()); + } +#else + (void)packed_result_block; +#endif + } + + void ComputeRun(int start_row, int start_col, int start_depth, + int depth) GEMMLOWP_NOINLINE { + packed_lhs_.seek_run(start_row, start_depth); + packed_rhs_.seek_run(start_col, start_depth); + auto packed_result_block = packed_result_->Map().block( + start_row, start_col, Format::kRows, Format::kCols); + kernel_.Run(packed_result_block.data(), packed_result_block.rows_stride(), + packed_result_block.cols_stride(), packed_lhs_.current_data(), + packed_rhs_.current_data(), start_depth, depth); + MarkPackedResultBlockAsInitialized(packed_result_block); + } + + void ComputeL1(int start_row, int rows, int start_col, int cols, + int start_depth, int depth) { + assert(rows % Format::kRows == 0); + assert(cols % Format::kCols == 0); + assert(depth % Format::kDepth == 0); + + for (int c = 0; c < cols; c += Format::kCols) { + for (int r = 0; r < rows; r += Format::kRows) { + ComputeRun(start_row + r, start_col + c, start_depth, depth); + } + } + } +}; + +template +void Compute(const KernelBase& kernel, const BlockParams& block_params, + PackedResult* packed_result, const PackedLhs& packed_lhs, + const PackedRhs& packed_rhs, int depth) { + ScopedProfilingLabel label("compute"); + ComputeImpl impl( + kernel, block_params, packed_result, packed_lhs, packed_rhs); + + impl.Compute(depth); +} + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_COMPUTE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/detect_platform.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/detect_platform.h new file mode 100644 index 0000000000000000000000000000000000000000..6fd51bca5f76b44fc68cfad5baa9eabfe5995343 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/detect_platform.h @@ -0,0 +1,171 @@ +// Copyright 2018 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// detect_platform.h: Sets up macros that control architecture-specific +// features of gemmlowp's implementation. + +#ifndef GEMMLOWP_INTERNAL_DETECT_PLATFORM_H_ +#define GEMMLOWP_INTERNAL_DETECT_PLATFORM_H_ + +// Our inline assembly path assume GCC/Clang syntax. +// Native Client doesn't seem to support inline assembly(?). +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__native_client__) +#define GEMMLOWP_ALLOW_INLINE_ASM +#endif + +// Define macro statement that avoids inlining for GCC. +// For non-GCC, define as empty macro. +#if defined(__GNUC__) +#define GEMMLOWP_NOINLINE __attribute__((noinline)) +#else +#define GEMMLOWP_NOINLINE +#endif + +// Detect ARM, 32-bit or 64-bit +#ifdef __arm__ +#define GEMMLOWP_ARM_32 +#endif + +#ifdef __aarch64__ +#define GEMMLOWP_ARM_64 +#endif + +#if defined(GEMMLOWP_ARM_32) || defined(GEMMLOWP_ARM_64) +#define GEMMLOWP_ARM +#endif + +// Detect MIPS, 32-bit or 64-bit +#if defined(__mips) && !defined(__LP64__) +#define GEMMLOWP_MIPS_32 +#endif + +#if defined(__mips) && defined(__LP64__) +#define GEMMLOWP_MIPS_64 +#endif + +#if defined(GEMMLOWP_MIPS_32) || defined(GEMMLOWP_MIPS_64) +#define GEMMLOWP_MIPS +#endif + +// Detect x86, 32-bit or 64-bit +#if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || defined(__i386) +#define GEMMLOWP_X86_32 +#endif + +#if defined(__x86_64__) || defined(_M_X64) || defined(__amd64) +#define GEMMLOWP_X86_64 +#endif + +#if defined(GEMMLOWP_X86_32) || defined(GEMMLOWP_X86_64) +#define GEMMLOWP_X86 +#endif + +// Detect WebAssembly SIMD. +#if defined(__wasm_simd128__) +#define GEMMLOWP_WASMSIMD +#endif + +// Some of our optimized paths use inline assembly and for +// now we don't bother enabling some other optimized paths using intrinddics +// where we can't use inline assembly paths. +#ifdef GEMMLOWP_ALLOW_INLINE_ASM + +// Detect NEON. It's important to check for both tokens. +#if (defined __ARM_NEON) || (defined __ARM_NEON__) +#define GEMMLOWP_NEON +#endif + +// Convenience NEON tokens for 32-bit or 64-bit +#if defined(GEMMLOWP_NEON) && defined(GEMMLOWP_ARM_32) +#define GEMMLOWP_NEON_32 +#endif + +#if defined(GEMMLOWP_NEON) && defined(GEMMLOWP_ARM_64) +#define GEMMLOWP_NEON_64 +#endif + +// Detect MIPS MSA. +// Limit MSA optimizations to little-endian CPUs for now. +// TODO: Perhaps, eventually support MSA optimizations on big-endian CPUs? +#if defined(GEMMLOWP_MIPS) && (__mips_isa_rev >= 5) && defined(__mips_msa) && \ + defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +#define GEMMLOWP_MSA +#endif + +// Convenience MIPS MSA tokens for 32-bit or 64-bit. +#if defined(GEMMLOWP_MSA) && defined(GEMMLOWP_MIPS_32) +#define GEMMLOWP_MSA_32 +#endif + +#if defined(GEMMLOWP_MSA) && defined(GEMMLOWP_MIPS_64) +#define GEMMLOWP_MSA_64 +#endif + +// compiler define for AVX2 -D GEMMLOWP_ENABLE_AVX2 +// Detect AVX2 +#if defined(__AVX2__) && defined(GEMMLOWP_ENABLE_AVX2) +#define GEMMLOWP_AVX2 +// Detect SSE4. +// MSVC does not have __SSE4_1__ macro, but will enable SSE4 +// when AVX is turned on. +#elif defined(__SSE4_1__) || (defined(_MSC_VER) && defined(__AVX__)) +#define GEMMLOWP_SSE4 +// Detect SSE3. +#elif defined(__SSE3__) +#define GEMMLOWP_SSE3 +#endif + +// Convenience SSE4 tokens for 32-bit or 64-bit +#if defined(GEMMLOWP_SSE4) && defined(GEMMLOWP_X86_32) && \ + !defined(GEMMLOWP_DISABLE_SSE4) +#define GEMMLOWP_SSE4_32 +#endif + +#if defined(GEMMLOWP_SSE3) && defined(GEMMLOWP_X86_32) +#define GEMMLOWP_SSE3_32 +#endif + +#if defined(GEMMLOWP_SSE4) && defined(GEMMLOWP_X86_64) && \ + !defined(GEMMLOWP_DISABLE_SSE4) +#define GEMMLOWP_SSE4_64 +#endif + +#if defined(GEMMLOWP_SSE3) && defined(GEMMLOWP_X86_64) +#define GEMMLOWP_SSE3_64 +#endif + +#if defined(GEMMLOWP_AVX2) && defined(GEMMLOWP_X86_64) +#define GEMMLOWP_AVX2_64 +#endif + +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#include +#define GEMMLOWP_MARK_MEMORY_AS_INITIALIZED __msan_unpoison +#elif __has_feature(address_sanitizer) +#include +#define GEMMLOWP_MARK_MEMORY_AS_INITIALIZED __asan_unpoison_memory_region +#endif +#endif + +#endif // GEMMLOWP_ALLOW_INLINE_ASM + +// Detect Android. Don't conflate with ARM - we care about tuning +// for non-ARM Android devices too. This can be used in conjunction +// with x86 to tune differently for mobile x86 CPUs (Atom) vs. desktop x86 CPUs. +#if defined(__ANDROID__) || defined(ANDROID) +#define GEMMLOWP_ANDROID +#endif + +#endif // GEMMLOWP_INTERNAL_DETECT_PLATFORM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/dispatch_gemm_shape.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/dispatch_gemm_shape.h new file mode 100644 index 0000000000000000000000000000000000000000..b844f7895661193ca868c62545252eddff878785 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/dispatch_gemm_shape.h @@ -0,0 +1,207 @@ +// Copyright 2017 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// dispatch_gemm_shape.h: dispatch GEMM calls according to their shape + +#ifndef GEMMLOWP_INTERNAL_DISPATCH_GEMM_SHAPE_H_ +#define GEMMLOWP_INTERNAL_DISPATCH_GEMM_SHAPE_H_ + +#include "../internal/kernel_default.h" +#include "../public/map.h" +#include "../public/output_stages.h" +#include "multi_thread_gemm.h" + +namespace gemmlowp { + +template +struct TransposeImpl { + typedef T DstType; + static T Run(const T& t) { return t; } +}; + +template +using TransposeType = typename TransposeImpl::DstType; + +template +TransposeType Transpose(const T& t) { + return TransposeImpl::Run(t); +} + +template +struct TransposeMapOrder { + static constexpr MapOrder Value = + Order == MapOrder::RowMajor ? MapOrder::ColMajor : MapOrder::RowMajor; +}; + +template +struct TransposeVectorShape { + static constexpr VectorShape Value = + Shape == VectorShape::Row ? VectorShape::Col : VectorShape::Row; +}; + +template +struct TransposeImpl> { + typedef VectorMap SrcType; + static constexpr VectorShape TransposedShape = + TransposeVectorShape::Value; + typedef VectorMap DstType; + static DstType Run(const SrcType& src) { + return DstType(src.data(), src.size()); + } +}; + +template +struct TransposeImpl> { + typedef MatrixMap SrcType; + static constexpr MapOrder TransposedOrder = TransposeMapOrder::Value; + typedef MatrixMap DstType; + static DstType Run(const SrcType& src) { + return DstType(src.data(), src.cols(), src.rows(), src.stride()); + } +}; + +template +struct TransposeImpl> { + typedef OutputStageQuantizeDownInt32ToUint8ScalePC SrcType; + static constexpr VectorShape TransposedShape = + TransposeVectorShape::Value; + typedef OutputStageQuantizeDownInt32ToUint8ScalePC DstType; + static DstType Run(const SrcType& src) { + DstType dst; + dst.result_shift = src.result_shift; + dst.result_offset = Transpose(src.result_offset); + dst.result_mult_int = Transpose(src.result_mult_int); + return dst; + } +}; + +template +struct TransposeImpl> { + typedef OutputStageScaleInt32ByFixedPointAndExponentPC SrcType; + static constexpr VectorShape TransposedShape = + TransposeVectorShape::Value; + typedef OutputStageScaleInt32ByFixedPointAndExponentPC + DstType; + static DstType Run(const SrcType& src) { + DstType dst; + dst.result_fixedpoint_multiplier = + Transpose(src.result_fixedpoint_multiplier); + dst.result_exponent = Transpose(src.result_exponent); + dst.result_offset_after_shift = src.result_offset_after_shift; + return dst; + } +}; + +template +struct TransposeImpl> { + typedef OutputStageBiasAddition SrcType; + typedef TransposeType TransposedVectorMapType; + typedef OutputStageBiasAddition DstType; + static DstType Run(const SrcType& src) { + DstType dst; + dst.bias_vector = Transpose(src.bias_vector); + return dst; + } +}; + +// TODO(benoitjacob) - does anyone understand C++ variadic templates? +// How to use them to implement TransposeTuple? Note: there are lots +// of answers on StackOverflow but they seem to all involve either +// C++14/C++17 (we can only use C++11) or lots of abstract nonsense. +inline std::tuple<> TransposeTuple(const std::tuple<>& t) { return t; } + +template +std::tuple> TransposeTuple(const std::tuple& t) { + return std::make_tuple(Transpose(std::get<0>(t))); +} + +template +std::tuple, TransposeType> TransposeTuple( + const std::tuple& t) { + return std::make_tuple(Transpose(std::get<0>(t)), Transpose(std::get<1>(t))); +} + +template +std::tuple, TransposeType, TransposeType> +TransposeTuple(const std::tuple& t) { + return std::make_tuple(Transpose(std::get<0>(t)), Transpose(std::get<1>(t)), + Transpose(std::get<2>(t))); +} + +template +std::tuple, TransposeType, TransposeType, + TransposeType> +TransposeTuple(const std::tuple& t) { + return std::make_tuple(Transpose(std::get<0>(t)), Transpose(std::get<1>(t)), + Transpose(std::get<2>(t)), Transpose(std::get<3>(t))); +} + +template +std::tuple, TransposeType, TransposeType, + TransposeType, TransposeType> +TransposeTuple(const std::tuple& t) { + return std::make_tuple(Transpose(std::get<0>(t)), Transpose(std::get<1>(t)), + Transpose(std::get<2>(t)), Transpose(std::get<3>(t)), + Transpose(std::get<4>(t))); +} + +template +std::tuple, TransposeType, TransposeType, + TransposeType, TransposeType, TransposeType> +TransposeTuple(const std::tuple& t) { + return std::make_tuple(Transpose(std::get<0>(t)), Transpose(std::get<1>(t)), + Transpose(std::get<2>(t)), Transpose(std::get<3>(t)), + Transpose(std::get<4>(t)), Transpose(std::get<5>(t))); +} + +template +void DispatchGemmShape(GemmContextType* context, + const MatrixMap& lhs, + const MatrixMap& rhs, + MatrixMap* result, + const LhsOffset& lhs_offset, const RhsOffset& rhs_offset, + const OutputPipelineType& output_pipeline) { + assert(lhs.cols() == rhs.rows()); + + int rows = result->rows(); + int cols = result->cols(); + int depth = lhs.cols(); + + if (rows == 0 || cols == 0 || depth == 0) { + // Vacuous GEMM, return early to avoid having to deal with + // zero sizes below. + return; + } + + if (rows < cols) { + auto transposed_result_map = Transpose(*result); + return DispatchGemmShape( + context, Transpose(rhs), Transpose(lhs), &transposed_result_map, + Transpose(rhs_offset), Transpose(lhs_offset), + TransposeTuple(output_pipeline)); + } + + typedef DefaultKernel Kernel; + MultiThreadGemm(context, Kernel(), lhs, rhs, result, + lhs_offset, rhs_offset, output_pipeline); +} + +} // end namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_DISPATCH_GEMM_SHAPE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel.h new file mode 100644 index 0000000000000000000000000000000000000000..f1a3fd8493a1d6995a8c750dfd5af893d5d62156 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel.h @@ -0,0 +1,251 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// kernel.h: general definitions for kernels. + +#ifndef GEMMLOWP_INTERNAL_KERNEL_H_ +#define GEMMLOWP_INTERNAL_KERNEL_H_ + +#include "../public/bit_depth.h" +#include "common.h" + +namespace gemmlowp { + +// Explanation of general gemmlowp terminology +// =========================================== +// +// We use the following abbreviations: +// LHS = "left-hand side" +// RHS = "right-hand side" +// Sometimes when referring to either LHS or RHS, we just say a "Side". +// +// In a matrix product of a MxK matrix times a KxN matrix, +// we call K the 'depth'. Note that M is the number of rows +// of the result (and of the LHS), and N is the number of columns +// of the result (and of the RHS). +// +// In each of the LHS and RHS matrices, we call 'width' the +// other dimension, besides the depth. So in the LHS, 'width' +// is the number of rows, while in the RHS, 'width' is the number +// of columns. +// +// So in the LHS MxK matrix, the depth is K and the width in M. +// And in the RHS KxN matrix, the depth is K and the width in N. +// +// This is illustrated in this picture: +// +// RHS width +// <-----------------> +// +-----------------+ ^ +// | RHS | | Depth +// +-----------------+ v +// ^ +--+ +-----------------+ +// | |L | | | +// LHS width | |H | | Result | +// | |S | | | +// v +--+ +-----------------+ +// <--> +// Depth + +// Explanation of gemmlowp kernel formats and "cells" +// ================================================== +// +// Kernels operate on small LHS and RHS blocks that fit in registers. +// These blocks are stored contiguously in memory, but not always +// in a traditional column-major or row-major order; instead, +// they consist of a number of sub-blocks, which we call "cells", +// that are stored in column-major or row-major order. However, +// what really matters to us is not so much rows vs columns, but +// rather width vs depth. So we refer to "width-major" and "depth-major" +// storage orders. In the LHS, width-major means row-major, +// while in the RHS, width-major means column-major. +// There is also a third possibility, "diagonal order", +// which is unused at the moment. +// +// We aim to treat both sides, LHS and RHS, on an equal footing, +// so we call them both 'sides'. A KernelFormat thus is just a pair +// of KernelSideFormat's, one for LHS and one for RHS; each KernelSideFormat +// contains a CellFormat and a number of cells; cells are only ever +// stacked in the width dimension, which means stacked vertically in the +// LHS and stacked horizondally in the RHS. +// +// Example +// ======= +// +// Let's work out the data layout expected by a kernel having the +// following format (the struct names here are defined below in this file): +// +// KernelFormat< +// KernelSideFormat, 3>, +// KernelSideFormat, 2> +// > +// +// The LHS format, KernelSideFormat, 3>, means: +// 3 cells, each cell having dimensions (width=3, depth=4), laid out in +// DepthMajor order (the default value, see CellFormat). In the LHS, +// DepthMajor means column-major, so the LHS cells are of size 3x4 in +// column-major order, so the LHS layout is: +// +// 0 3 6 9 +// 1 4 7 10 +// 2 5 8 11 +// 12 15 18 21 +// 13 16 19 22 +// 14 17 20 23 +// 24 27 30 33 +// 25 28 31 34 +// 26 29 32 35 +// +// The RHS format, KernelSideFormat, 2>, means: +// 2 cells each having dimensions (width=5, depth=4), laid out in +// DepthMajor order (the default value, see CellFormat). In the RHS, +// DepthMajor means row-major, so the RHS cells are of size 4x5 in +// row-major order, so the RHS layout is: +// +// 0 1 2 3 4 20 21 22 23 24 +// 5 6 7 8 9 25 26 27 28 29 +// 10 11 12 13 14 30 31 32 33 34 +// 15 16 17 18 19 35 36 37 38 39 + +// CellOrder enumerates the possible storage orders (=layouts) for +// a cell (see explanation above). +enum class CellOrder { DepthMajor, WidthMajor, Diagonal }; + +// CellFormat describes how data is laid +// out in a cell. That is, a CellOrder together with actual dimensions. +template +struct CellFormat { + static constexpr int kWidth = tWidth; + static constexpr int kDepth = tDepth; + static constexpr CellOrder kOrder = tOrder; + + static constexpr int kSize = kWidth * kDepth; +}; + +// KernelSideFormat describes how data is laid out in a kernel side +// (i.e. LHS or RHS). That is, a CellFormat together with a number of +// cells. These cells are always stacked in the Width dimension. +// For example, in the LHS case, the Width dimension is the rows dimension, +// se we're saying that in the LHS, cells are stacked vertically. +// We never stack cells in the Depth dimension. +template +struct KernelSideFormat { + typedef tCellFormat Cell; + static constexpr int kCells = tCells; + static constexpr int kWidth = kCells * Cell::kWidth; + static constexpr int kDepth = Cell::kDepth; + typedef std::uint8_t Scalar; // The scalar type of the Format. + typedef std::uint8_t InputScalar; // The scalar type of the original input. +}; + +// KernelSideFormat for int8 fast kernel trick. The original input is uint8, but +// packs converts it to int8. +template +struct KernelSideFormatInt8 : KernelSideFormat { + typedef std::int8_t Scalar; + typedef std::uint8_t InputScalar; +}; + +// KernelSideFormat for int8 inputs, enabling int8 fast kernel trick without +// pack conversion. +template +struct KernelSideFormatInt8Inputs : KernelSideFormat { + typedef std::int8_t Scalar; + typedef std::int8_t InputScalar; +}; + +// KernelFormat describes fully the input data layout that a kernel expects. +// It consists of two KernelSideFormat's, one for LHS and one for RHS. +template +struct KernelFormat { + typedef tLhs Lhs; + typedef tRhs Rhs; + + static_assert(Lhs::Cell::kDepth == Rhs::Cell::kDepth, ""); + static constexpr int kDepth = Lhs::Cell::kDepth; + static constexpr int kRows = Lhs::Cell::kWidth * Lhs::kCells; + static constexpr int kCols = Rhs::Cell::kWidth * Rhs::kCells; +}; + +inline const char* CellOrderName(CellOrder o) { + switch (o) { + case CellOrder::DepthMajor: + return "DepthMajor"; + case CellOrder::WidthMajor: + return "WidthMajor"; + case CellOrder::Diagonal: + return "Diagonal"; + default: + assert(false); + return nullptr; + } +} + +// Returns the offset into a cell, at which a given coefficient is stored. +template +inline int OffsetIntoCell(int w, int d) { + const int size = CellFormat::kWidth; + switch (CellFormat::kOrder) { + case CellOrder::DepthMajor: + return w + d * CellFormat::kWidth; + case CellOrder::WidthMajor: + return d + w * CellFormat::kDepth; + case CellOrder::Diagonal: + assert(CellFormat::kWidth == CellFormat::kDepth); + return ((size + w - d) * size + d) % (size * size); + default: + assert(false); + return 0; + } +} + +// KernelBase is the virtual base class below all kernels. +// The idea is that we don't need to templatize all our code on the exact +// kernel type; we only need to templatize on kernel format. Kernels +// sharing the same format can thus share the same packing/unpacking code. +struct KernelBase { + virtual const char* Name() const = 0; + + // This is the kernel implementation. We use the word 'run' consistently + // throughout gemmlowp to mean an inner loop, the implementation of which + // is to be provided by a separate optimized function. + virtual void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const = 0; + + virtual ~KernelBase() {} +}; + +template +struct ZeroPointInputValue {}; + +template <> +struct ZeroPointInputValue { + static constexpr std::uint8_t kValue = 0; +}; + +template <> +struct ZeroPointInputValue { + static constexpr std::uint8_t kValue = 128; +}; + +template <> +struct ZeroPointInputValue { + static constexpr std::uint8_t kValue = 0; +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_KERNEL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_avx.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_avx.h new file mode 100644 index 0000000000000000000000000000000000000000..2fe1249cd53094e867f0953b34f941be89280507 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_avx.h @@ -0,0 +1,361 @@ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// kernel_SSE.h: a collection of Intel SSE optimized kernels. +// Check in kernel_default.h which one(s) are actually used by default. +// Others are mere experiments; they are still covered by tests +// in case they might be useful some day. +// + +#ifndef GEMMLOWP_INTERNAL_KERNEL_AVX_H_ +#define GEMMLOWP_INTERNAL_KERNEL_AVX_H_ + +#include "kernel.h" + +#include +#include + +namespace gemmlowp { + +#ifdef GEMMLOWP_AVX2_64 +struct AVX2_64_Kernel24x8Depth2 : KernelBase { + typedef KernelFormat, 3>, + KernelSideFormat, 1>> + Format; + + const char *Name() const override { return "AVX, 24x8, depth 2"; } + + void Run(std::int32_t *dst_ptr, std::size_t dst_row_stride, std::size_t dst_col_stride, + const std::uint8_t *lhs_ptr, const std::uint8_t *rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + ScopedProfilingLabel label("optimized kernel"); + assert(dst_row_stride == 1); + const std::int64_t run_depth_cells = run_depth / Format::kDepth; + const std::int64_t dst_col_stride_q = dst_col_stride; + + /* Main loop */ + + // A 2x8 cell of Rhs is stored in 16bit in ymm1 . + // A 24x2 block of 3 8x2 cells Lhs is stored in 16bit in ymm0, replaced + // every Iteration. + // A 8x8 block of accumulators is stored in 32bit in xmm4--xmm15. + // + // +-------+-------+-------+-------+ + // |ymm1[0] |ymm2[2] | + // Rhs +-------+---------------+-------+ + // |ymm1[1] |ymm1[4] | + // +-------+-------+-------+-------+ + // + // | | | | | + // + // Lhs | | | | | + // + // +--+--+ - - - - +-------+-------+-------+-------+ + // |ymm0 | | ymm4 | ymm5 | ymm6 | ymm7 | + // |ymm0 | (Iter1) | ymm4 | ymm5 | ymm6 | ymm7 | + // |ymm0 | | ymm4 | ymm5 | ymm6 | ymm7 | + // |ymm0 | | ymm4 | ymm5 | ymm6 | ymm7 | + // +--+--+ - - - - +-------+-------+-------+-------+ + // |ymm0 | | ymm8 | ymm9 | ymm10 | ymm11 | + // |ymm0 | (Iter2) | ymm8 | ymm9 | ymm10 | ymm11 | + // |ymm0 | | ymm8 | ymm9 | ymm10 | ymm11 | + // |ymm0 | | ymm8 | ymm9 | ymm10 | ymm11 | + // +--+--+ - - - - +-------+-------+-------+-------+ + // |ymm0 | | ymm12 | ymm13 | ymm14 | ymm15 | + // |ymm0 | (Iter3) | ymm12 | ymm13 | ymm14 | ymm15 | + // |ymm0 | | ymm12 | ymm13 | ymm14 | ymm15 | + // |ymm0 | | ymm12 | ymm13 | ymm14 | ymm15 | + // +--+--+ - - - - +-------+-------+-------+-------+ + // + // Accumulator + + asm volatile( + // Set registers for destination + "movq %[dst_col_stride_q], %%r12\n\t" // stride is r12 + "shlq $2, %%r12\n\t" // set stride dword + "leaq (%%r12,%%r12,0x2), %%r13\n\t" // load stride aligned r13 + + // Set accumulators to zero. + "vpxor %%ymm4, %%ymm4, %%ymm4 \n\t" // zero accumulators + "vpxor %%ymm5, %%ymm5, %%ymm5 \n\t" // zero accumulators + "vpxor %%ymm6, %%ymm6, %%ymm6 \n\t" // zero accumulators + "vpxor %%ymm7, %%ymm7, %%ymm7 \n\t" // zero accumulators + "vpxor %%ymm8, %%ymm8, %%ymm8 \n\t" // zero accumulators + "vpxor %%ymm9, %%ymm9, %%ymm9 \n\t" // zero accumulators + "vpxor %%ymm10, %%ymm10, %%ymm10\n\t" // zero accumulators + "vpxor %%ymm11, %%ymm11, %%ymm11\n\t" // zero accumulators + "vpxor %%ymm12, %%ymm12, %%ymm12\n\t" // zero accumulators + "vpxor %%ymm13, %%ymm13, %%ymm13\n\t" // zero accumulators + "vpxor %%ymm14, %%ymm14, %%ymm14\n\t" // zero accumulators + "vpxor %%ymm15, %%ymm15, %%ymm15\n\t" // zero accumulators + + "movq %[run_depth_cells], %%r14 \n\t" // load cell depth r14 + "subq $2, %%r14 \n\t" // cell depth is 2 + "js outerLoop1%= \n\t" // outerloop for matrix + + // Loop for K unrolled by 4 + "outerLoop2%=: \n\t" // outer loop unroll + + // K = 0,1,2,3 + // RHS cell to ymm1 + + // lower half + "vpmovzxbw (%[rhs_ptr]), %%ymm1 \n\t" // mov rhs to ymm1 + "vpermq $0x44,%%ymm1, %%ymm1 \n\t" + // LHS cell elements 0 and 1 + "vpmovzxbw 0x00(%[lhs_ptr]), %%ymm0\n\t" // mov lhs to ymm0 + "vpshufd $0x00,%%ymm1,%%ymm2 \n\t" // move rhs 0 element to all ymm2 + "vpshufd $0x55,%%ymm1,%%ymm3 \n\t" // move rhs 1 element to all ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // mul add lhs rhs0 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // mul add lhs rhs1 into ymm3 + "vpaddd %%ymm2, %%ymm4, %%ymm4 \n\t" // add muladd lhs + rhs0 into ymm4 + "vpaddd %%ymm3, %%ymm5, %%ymm5 \n\t" // add muladd lhs + rhs1 into ymm5 + // LHS cell elements 2 and 3 + "vpshufd $0xaa, %%ymm1, %%ymm2 \n\t" // move rhs 2 element to all ymm2 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // mul add lhs rh3 into ymm2 + "vpshufd $0xff,%%ymm1,%%ymm3 \n\t" // mov rhs 3 element into all ymm3 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // mul add lhs rh4 into ymm3 + "vpaddd %%ymm2, %%ymm6, %%ymm6 \n\t" // add muladd lhs + rhs2 into ymm6 + "vpaddd %%ymm3, %%ymm7, %%ymm7 \n\t" // add muladd lhs + rhs3 into ymm7 + + // cache prefect lhs //see if it works better? + //"prefetcht0 0x80(%[lhs_ptr]) \n\t" //prefetch cache lines + "vpmovzxbw (%[rhs_ptr]), %%ymm1 \n\t" // mov rhs to ymm1 + "vpermq $0x44,%%ymm1, %%ymm1 \n\t" + + // K = 5,6,7,8 + // next LHS cell elements 0 and 1 + "vpmovzxbw 0x10(%[lhs_ptr]), %%ymm0 \n\t" // mov lhs to ymm0 + "vpshufd $0x00,%%ymm1,%%ymm2 \n\t" // mov rhs 0 element to all ymm2 + "vpshufd $0x55,%%ymm1,%%ymm3 \n\t" // mov rhs 1 element to all ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // mul add lhs rhs0 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // mul add lhs rhs1 into ymm3 + "vpaddd %%ymm2, %%ymm8, %%ymm8 \n\t" // add muladd lhs + rhs0 into ymm8 + "vpaddd %%ymm3, %%ymm9, %%ymm9 \n\t" // add muladd lhs + rhs1 into ymm9 + // next LHS cell elements 2 and 3 + "vpshufd $0xaa,%%ymm1,%%ymm2 \n\t" // mov rhs 2 element to all ymm2 + "vpshufd $0xff,%%ymm1,%%ymm3 \n\t" // mov rhs 3 element to all ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // mul add lhs rhs2 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // mul add lhs rhs3 into ymm3 + "vpaddd %%ymm2, %%ymm10, %%ymm10 \n\t" // add muladd lhs + rhs2 into ymm10 + "vpaddd %%ymm3, %%ymm11, %%ymm11 \n\t" // add muladd lhs + rhs3 into ymm11 + + // rhs lower half + "vpmovzxbw (%[rhs_ptr]), %%ymm1 \n\t" // mov rhs to ymm1 + "vpermq $0x44,%%ymm1, %%ymm1 \n\t" // duplcate lower 16 + + // next LHS cell elements 0 and 1 + "vpmovzxbw 0x20(%[lhs_ptr]), %%ymm0 \n\t" // mov lhs to ymm0 + "vpshufd $0x00,%%ymm1,%%ymm2 \n\t" // mov rhs 0 element to all ymm2 + "vpshufd $0x55,%%ymm1,%%ymm3 \n\t" // mov rhs 1 element to all ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // mul add lhs rhs0 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // mul add lhs rhs1 into ymm3 + "vpaddd %%ymm2, %%ymm12, %%ymm12 \n\t" // add muladd lhs + rhs0 into ymm8 + "vpaddd %%ymm3, %%ymm13, %%ymm13 \n\t" // add muladd lhs + rhs1 into ymm9 + + // cache prefetch rhs //see if it works better? + //"prefetcht0 0x80(%[rhs_ptr]) \n\t" + + // next LHS cell elements 2 and 3 + "vpshufd $0xaa,%%ymm1,%%ymm2 \n\t" // mov rhs 2 element to all ymm2 + "vpshufd $0xff,%%ymm1,%%ymm3 \n\t" // mov rhs 3 element to all ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // mul add lhs rhs2 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // mul add lhs rhs3 into ymm3 + "vpaddd %%ymm2, %%ymm14, %%ymm14 \n\t" // add muladd lhs + rhs2 into ymm10 + "vpaddd %%ymm3, %%ymm15, %%ymm15 \n\t" // add muladd lhs + rhs3 into ymm11 + + // current result in ymm4, ymm5, ymm6, ymm7, ymm8, ymm9, ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 + + // rhs+10 lower half + "vpmovzxbw 0x08(%[rhs_ptr]), %%ymm1 \n\t" // mov rhs to ymm1 + "vpermq $0x44,%%ymm1, %%ymm1 \n\t" + // next LHS cell elements 0 and 1 + "vpmovzxbw 0x30(%[lhs_ptr]), %%ymm0 \n\t" // mov lhs to ymm0 + "vpshufd $0x00,%%ymm1,%%ymm2 \n\t" // move rhs 0 element to ymm2 + "vpshufd $0x55,%%ymm1,%%ymm3 \n\t" // move rhs 1 element to ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // muladd lhs rhs0 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // muladd lhs rhs1 into ymm3 + "vpaddd %%ymm2, %%ymm4, %%ymm4 \n\t" // accumulate to ymm4 + "vpaddd %%ymm3, %%ymm5, %%ymm5 \n\t" // accumulate to ymm5 + // next LHS cell elements 2 and 3 + "vpshufd $0xaa,%%ymm1,%%ymm2 \n\t" // mov rhs 2 element to ymm2 + "vpshufd $0xff,%%ymm1,%%ymm3 \n\t" // mov rhs 3 element to ymm2 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // mul add lhs rhs2 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // mull add lhs rhs3 into ymm3 + "vpaddd %%ymm2, %%ymm6, %%ymm6 \n\t" // add lhs rhs2 to ymm6 + "vpaddd %%ymm3, %%ymm7, %%ymm7 \n\t" // add lhs rhs3 to ymm7 + + // rhs+10 lower half + "vpmovzxbw 0x08(%[rhs_ptr]), %%ymm1 \n\t" // mov rhs to ymm1 + "vpermq $0x44,%%ymm1, %%ymm1 \n\t" + + // next LHS cell elements 4 and 5 + "vpmovzxbw 0x40(%[lhs_ptr]), %%ymm0 \n\t" // mov lhs to ymm0 + "vpshufd $0x00,%%ymm1,%%ymm2 \n\t" // move rhs 0 element to ymm2 + "vpshufd $0x55,%%ymm1,%%ymm3 \n\t" // move rhs 1 element to ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // muladd lhs rhs0 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // muladd lhs rhs1 into ymm3 + "vpaddd %%ymm2, %%ymm8, %%ymm8 \n\t" // accumulate to ymm8 + "vpaddd %%ymm3, %%ymm9, %%ymm9 \n\t" // accumulate to ymm9 + // next LHS cell elements 6 and 7 + "vpshufd $0xaa,%%ymm1,%%ymm2 \n\t" // mov rhs 2 element to ymm2 + "vpshufd $0xff,%%ymm1,%%ymm3 \n\t" // mov rhs 3 element to ymm2 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // mul add lhs rhs2 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // mull add lhs rhs3 into ymm3 + "vpaddd %%ymm2, %%ymm10, %%ymm10 \n\t" // add lhs rhs2 to ymm10 + "vpaddd %%ymm3, %%ymm11, %%ymm11 \n\t" // add lhs rhs3 to ymm11 + + "vpmovzxbw 0x08(%[rhs_ptr]), %%ymm1 \n\t" // mov rhs to ymm1 + "vpermq $0x44,%%ymm1, %%ymm1 \n\t" + // next LHS cell elements 9 and 10 + "vpmovzxbw 0x50(%[lhs_ptr]), %%ymm0 \n\t" // mov lhs to ymm0 + "vpshufd $0x00,%%ymm1,%%ymm2 \n\t" // move rhs 0 element to ymm2 + "vpshufd $0x55,%%ymm1,%%ymm3 \n\t" // move rhs 1 element to ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // muladd lhs rhs0 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // muladd lhs rhs1 into ymm3 + "vpaddd %%ymm2, %%ymm12, %%ymm12 \n\t" // accumulate to ymm12 + "vpaddd %%ymm3, %%ymm13, %%ymm13 \n\t" // accumulate to ymm13 + + // next LHS cell elements 11 and 12 + "vpshufd $0xaa,%%ymm1,%%ymm2 \n\t" // mov rhs 2 element to ymm2 + "vpshufd $0xff,%%ymm1,%%ymm3 \n\t" // mov rhs 3 element to ymm2 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // mul add lhs rhs2 into ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // mull add lhs rhs3 into ymm3 + "vpaddd %%ymm2, %%ymm14, %%ymm14 \n\t" // add lhs rhs2 to ymm14 + "vpaddd %%ymm3, %%ymm15, %%ymm15 \n\t" // add lhs rhs3 to ymm15 + + // completed rhs+10 + "addq $0x60, %[lhs_ptr] \n\t" // increment stride lhs + "addq $0x10, %[rhs_ptr] \n\t" // increment stride rhs + + "subq $2, %[run_depth_cells] \n\t" + "ja outerLoop2%= \n\t" + + "movq %[run_depth_cells], %%r14 \n\t" + "decq %%r14 \n\t" + "js finish%= \n\t" + + // Loop for K unrolled by 2 + "outerLoop1%=: \n\t" + + // rhs lower + "vpmovzxbw (%[rhs_ptr]), %%ymm1 \n\t" // get rhs into ymm1 + "vpermq $0x44,%%ymm1, %%ymm1 \n\t" + + // LHS cell + "vpmovzxbw (%[lhs_ptr]), %%ymm0 \n\t" // lhs in into ymm0 + "vpshufd $0x00,%%ymm1,%%ymm2 \n\t" // rhs element 0 into ymm2 + "vpshufd $0x55,%%ymm1,%%ymm3 \n\t" // rhs element 1 into ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // muladd lhs rhs element 0 ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // muladd lhs rhs element 1 ymm3 + "vpaddd %%ymm2, %%ymm4, %%ymm4 \n\t" // acc element 0 ymm4 + "vpaddd %%ymm3, %%ymm5, %%ymm5 \n\t" // acc element 1 ymm5 + "vpshufd $0xaa,%%ymm1,%%ymm2 \n\t" // rhs element 2 into ymm2 + "vpshufd $0xff,%%ymm1,%%ymm3 \n\t" // rhs element 3 into ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // muladd lhs rhs element 2 ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // muladd lhs rhs element 3 ymm3 + "vpaddd %%ymm2, %%ymm6, %%ymm6 \n\t" // acc element 2 into ymm6 + "vpaddd %%ymm3, %%ymm7, %%ymm7 \n\t" // acc element 3 into ymm7 + + // lhs+10 + "vpmovzxbw 0x10(%[lhs_ptr]), %%ymm0 \n\t" // lhs in into ymm0 + "vpshufd $0x00, %%ymm1, %%ymm2 \n\t" // rhs element 0 into ymm2 + "vpshufd $0x55, %%ymm1, %%ymm3 \n\t" // rhs element 1 into ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // muladd lhs rhs element 0 ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // muladd lhs rhs element 1 ymm3 + "vpaddd %%ymm2, %%ymm8, %%ymm8 \n\t" // acc element 0 ymm8 + "vpaddd %%ymm3, %%ymm9, %%ymm9 \n\t" // acc element 1 ymm9 + "vpshufd $0xaa,%%ymm1,%%ymm2 \n\t" // rhs element 2 into ymm2 + "vpshufd $0xff,%%ymm1,%%ymm3 \n\t" // rhs element 3 into ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // muladd lhs rhs element 2 ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // muladd lhs rhs element 3 ymm3 + "vpaddd %%ymm2, %%ymm10, %%ymm10 \n\t" // acc element 2 into ymm10 + "vpaddd %%ymm3, %%ymm11, %%ymm11 \n\t" // acc element 3 into ymm11 + + "vpmovzxbw 0x20(%[lhs_ptr]), %%ymm0 \n\t" + "vpshufd $0x00, %%ymm1, %%ymm2 \n\t" // rhs element 0 into ymm2 + "vpshufd $0x55, %%ymm1, %%ymm3 \n\t" // rhs element 1 into ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // muladd lhs rhs element 0 ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // muladd lhs rhs element 1 ymm3 + "vpaddd %%ymm2, %%ymm12, %%ymm12 \n\t" // acc element 0 ymm12 + "vpaddd %%ymm3, %%ymm13, %%ymm13 \n\t" // acc element 1 ymm13 + "vpshufd $0xaa,%%ymm1,%%ymm2 \n\t" // rhs element 2 into ymm2 + "vpshufd $0xff,%%ymm1,%%ymm3 \n\t" // rhs element 3 into ymm3 + "vpmaddwd %%ymm0, %%ymm2, %%ymm2 \n\t" // muladd lhs rhs element 2 ymm2 + "vpmaddwd %%ymm0, %%ymm3, %%ymm3 \n\t" // muladd lhs rhs element 3 ymm3 + "vpaddd %%ymm2, %%ymm14, %%ymm14 \n\t" // acc element 2 into ymm14 + "vpaddd %%ymm3, %%ymm15, %%ymm15 \n\t" // acc element 3 into ymm15 + + // update matrix pointers + "addq $0x30, %[lhs_ptr] \n\t" + "addq $0x08, %[rhs_ptr] \n\t" + + "decq %[run_depth_cells] \n\t" + "jnz outerLoop1%= \n\t" + + "finish%=:\n\t" + + "test %[start_depth], %[start_depth] \n\t" + "jz storeDst%= \n\t" + + "vpaddd 0x00(%[dst_ptr]), %%ymm4, %%ymm4 \n\t" // rhs0 + "vpaddd 0x20(%[dst_ptr]), %%ymm8, %%ymm8 \n\t" // rhs0 + "vpaddd 0x40(%[dst_ptr]), %%ymm12, %%ymm12 \n\t" // rhs0 + + "vpaddd 0x00(%[dst_ptr], %%r12, 1) , %%ymm5, %%ymm5 \n\t" // rhs1 + "vpaddd 0x20(%[dst_ptr], %%r12, 1) , %%ymm9, %%ymm9 \n\t" // rhs1 + "vpaddd 0x40(%[dst_ptr], %%r12, 1) , %%ymm13, %%ymm13 \n\t" // rhs1 + + "vpaddd 0x00(%[dst_ptr], %%r12, 2) , %%ymm6, %%ymm6 \n\t" // rhs2 + "vpaddd 0x20(%[dst_ptr], %%r12, 2) , %%ymm10, %%ymm10 \n\t" // rhs2 + "vpaddd 0x40(%[dst_ptr], %%r12, 2) , %%ymm14, %%ymm14 \n\t" // rhs2 + + "vpaddd 0x00(%[dst_ptr], %%r13, 1) , %%ymm7, %%ymm7 \n\t" // rhs3 + "vpaddd 0x20(%[dst_ptr], %%r13, 1) , %%ymm11, %%ymm11 \n\t" // rhs3 + "vpaddd 0x40(%[dst_ptr], %%r13, 1) , %%ymm15, %%ymm15 \n\t" // rhs3 + + "storeDst%=:\n\t" + + "vmovdqu %%ymm4, 0x00(%[dst_ptr]) \n\t" // rhs0 + "vmovdqu %%ymm8, 0x20(%[dst_ptr]) \n\t" // rhs0 + "vmovdqu %%ymm12, 0x40(%[dst_ptr]) \n\t" // rhs0 + + "vmovdqu %%ymm5, 0x00(%[dst_ptr], %%r12, 1) \n\t" // rhs1 + "vmovdqu %%ymm9, 0x20(%[dst_ptr], %%r12, 1) \n\t" // rhs1 + "vmovdqu %%ymm13, 0x40(%[dst_ptr], %%r12, 1) \n\t" // rhs1 + + "vmovdqu %%ymm6, 0x00(%[dst_ptr], %%r12, 2) \n\t" // rhs2 + "vmovdqu %%ymm10, 0x20(%[dst_ptr], %%r12, 2) \n\t" // rhs2 + "vmovdqu %%ymm14, 0x40(%[dst_ptr], %%r12, 2) \n\t" // rhs2 + + "vmovdqu %%ymm7, 0x00(%[dst_ptr], %%r13, 1) \n\t" // rhs3 + "vmovdqu %%ymm11, 0x20(%[dst_ptr], %%r13, 1) \n\t" // rhs3 + "vmovdqu %%ymm15, 0x40(%[dst_ptr], %%r13, 1) \n\t" // rhs3 + + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [dst_ptr] "+r"(dst_ptr) + : // inputs + [start_depth] "r"(start_depth), [dst_col_stride_q] "r"(dst_col_stride_q), + [run_depth_cells] "r"(run_depth_cells) + : // clobbers + "cc", "memory", "%ymm0", "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5", "%ymm6", "%ymm7", + "%ymm8", "%ymm9", "%ymm10", "%ymm11", "%ymm12", "%ymm13", "%ymm14", "%ymm15", "%r12", + "%r13", "%r14"); + } +}; +#endif + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_KERNEL_AVX_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_default.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_default.h new file mode 100644 index 0000000000000000000000000000000000000000..29b09913fe9de12b1f9c0947fc2ed1448b1243be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_default.h @@ -0,0 +1,112 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// kernel_default.h: Chooses default GEMM and GEMV kernels for the +// host platform. + +#ifndef GEMMLOWP_INTERNAL_KERNEL_DEFAULT_H_ +#define GEMMLOWP_INTERNAL_KERNEL_DEFAULT_H_ + +#include "../public/bit_depth.h" +#include "common.h" +#include "kernel.h" +#include "kernel_reference.h" + +namespace gemmlowp { + +template +struct DefaultKernelImpl {}; + +// Partial specialization implementing the logic that if we want to use +// a kernel for MaxProductIsLessThan4096 but do not have such a kernel, then we +// fall back to a generic kernel not taking advantage of +// MaxProductIsLessThan4096. +template +struct DefaultKernelImpl + : DefaultKernelImpl {}; + +// Partial specialization implementing the logic that if we want to use +// a kernel for LhsNonZero but do not have such a kernel, then we fall +// back to a generic kernel not taking advantage of LhsNonZero. +template +struct DefaultKernelImpl + : DefaultKernelImpl {}; + +template +struct DefaultKernel + : DefaultKernelImpl<(BitDepthParams::LhsRange::kMaxValue * + BitDepthParams::RhsRange::kMaxValue < + 4096), + (BitDepthParams::LhsRange::kMinValue >= 0), + (BitDepthParams::LhsRange::kMinValue > 0 || + (BitDepthParams::LhsRange::kMaxValue <= 127 && + BitDepthParams::LhsRange::kMinValue > -128))> {}; + +} // end namespace gemmlowp + +#define GEMMLOWP_SET_DEFAULT_KERNEL(MaxProductIsLessThan4096, IsUnsigned, \ + LhsAlwaysNonZero, Kernel) \ + namespace gemmlowp { \ + template <> \ + struct DefaultKernelImpl : Kernel {}; \ + } + +// User-provided int8 inputs is only supported in the NEON path currently. +#if defined GEMMLOWP_NEON_32 +#include "kernel_neon.h" +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, false, NEON_32_Kernel12x4Depth2) +GEMMLOWP_SET_DEFAULT_KERNEL(true, true, false, + NEON_32_Kernel12x4Depth2Assuming12BitProducts) +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, true, + NEON_32bit_GEMM_Int8Operands_LhsNonzero) +GEMMLOWP_SET_DEFAULT_KERNEL(false, false, true, + NEON_32bit_GEMM_Int8Operands_LhsNonzero_Int8Inputs) +#elif defined GEMMLOWP_NEON_64 +#include "kernel_neon.h" +#if defined GEMMLOWP_DOTPROD_KERNEL +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, false, + NEON_64_Kernel12x8Depth4_dotprod) +#else +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, false, NEON_64_Kernel12x8Depth2) +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, true, + NEON_64bit_GEMM_Int8Operands_LhsNonzero) +#endif +GEMMLOWP_SET_DEFAULT_KERNEL(false, false, true, + NEON_64bit_GEMM_Int8Operands_LhsNonzero_Int8Inputs) +#elif defined(GEMMLOWP_MSA) +#include "kernel_msa.h" +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, false, MSA_Kernel12x8Depth2) +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, true, MSA_GEMM_Int8Operands_LhsNonzero) +#elif defined GEMMLOWP_SSE4_32 +#include "kernel_sse.h" +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, false, SSE4_32_Kernel4x4Depth2) +#elif defined GEMMLOWP_SSE4_64 +#include "kernel_sse.h" +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, false, SSE4_64_Kernel12x4Depth2) +#elif defined GEMMLOWP_AVX2_64 +#include "kernel_avx.h" +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, false, AVX2_64_Kernel24x8Depth2) +#else +#include "kernel_reference.h" +namespace gemmlowp { +typedef ReferenceKernel, 1>, + KernelSideFormat, 1> > > + DefaultReferenceKernel; +} +GEMMLOWP_SET_DEFAULT_KERNEL(false, true, false, DefaultReferenceKernel) +#endif + +#endif // GEMMLOWP_INTERNAL_KERNEL_DEFAULT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_msa.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_msa.h new file mode 100644 index 0000000000000000000000000000000000000000..a9205f6405962fcd14ae58a2ff88acf950f2f8ff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_msa.h @@ -0,0 +1,579 @@ +// Copyright 2018 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// kernel_msa.h: a collection of MSA optimized kernels. +// Check in kernel_default.h which one(s) are actually used by default. +// Others are mere experiments; they are still covered by tests +// in case they might be useful some day. + +#ifndef GEMMLOWP_INTERNAL_KERNEL_MSA_H_ +#define GEMMLOWP_INTERNAL_KERNEL_MSA_H_ + +#include "kernel.h" + +#include +#include + +namespace gemmlowp { + +#ifdef GEMMLOWP_MSA + +// Some convenience macros to hide differences between MIPS32 and MIPS64. +#ifdef GEMMLOWP_MIPS_64 +#define GEMMLOWP_MIPS_XADDU "daddu" +#define GEMMLOWP_MIPS_XADDIU "daddiu" +#define GEMMLOWP_MIPS_XSLL "dsll" +#else +#define GEMMLOWP_MIPS_XADDU "addu" +#define GEMMLOWP_MIPS_XADDIU "addiu" +#define GEMMLOWP_MIPS_XSLL "sll" +#endif + +// Our main GEMM kernel. +struct MSA_Kernel12x8Depth2 : KernelBase { + typedef KernelFormat, 3>, + KernelSideFormat, 2> > + Format; + + const char* Name() const override { return "MSA, 12x8, depth 2"; } + + // TODO(benoitjacob): reorder function arguments so dst comes last + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + ScopedProfilingLabel label("optimized kernel (MSA 12x8)"); +// See comments above for why we need local numerical labels in our asm. +#define GEMMLOWP_LABEL_CLEAR_ACCUMULATORS "1" +#define GEMMLOWP_LABEL_BEFORE_LOOP "2" +#define GEMMLOWP_LABEL_LOOP "3" +#define GEMMLOWP_LABEL_AFTER_LOOP "4" + + assert(dst_row_stride == 1); + asm volatile( + // Multiply dst_col_stride by 4 == sizeof(int32) to use + // it as a byte offset below. + GEMMLOWP_MIPS_XSLL + " %[dst_col_stride], %[dst_col_stride], 2\n" + + // Check if start_depth==0 to decide whether we will clear + // accumulators or load existing accumulators. + "beqz %[start_depth], " GEMMLOWP_LABEL_CLEAR_ACCUMULATORS "f\n" + + // Load accumulators (start_depth != 0). + GEMMLOWP_MIPS_XADDU " $a0, %[dst_ptr], %[dst_col_stride]\n" + "ld.w $w0, (0*16)(%[dst_ptr])\n" + "ld.w $w4, (1*16)(%[dst_ptr])\n" + "ld.w $w8, (2*16)(%[dst_ptr])\n" GEMMLOWP_MIPS_XADDU " $a1, $a0, %[dst_col_stride]\n" + "ld.w $w1, (0*16)($a0)\n" + "ld.w $w5, (1*16)($a0)\n" + "ld.w $w9, (2*16)($a0)\n" GEMMLOWP_MIPS_XADDU " $a0, $a1, %[dst_col_stride]\n" + "ld.w $w2, (0*16)($a1)\n" + "ld.w $w6, (1*16)($a1)\n" + "ld.w $w10, (2*16)($a1)\n" GEMMLOWP_MIPS_XADDU " $a1, $a0, %[dst_col_stride]\n" + "ld.w $w3, (0*16)($a0)\n" + "ld.w $w7, (1*16)($a0)\n" + "ld.w $w11, (2*16)($a0)\n" GEMMLOWP_MIPS_XADDU " $a0, $a1, %[dst_col_stride]\n" + "ld.w $w12, (0*16)($a1)\n" + "ld.w $w16, (1*16)($a1)\n" + "ld.w $w20, (2*16)($a1)\n" GEMMLOWP_MIPS_XADDU " $a1, $a0, %[dst_col_stride]\n" + "ld.w $w13, (0*16)($a0)\n" + "ld.w $w17, (1*16)($a0)\n" + "ld.w $w21, (2*16)($a0)\n" GEMMLOWP_MIPS_XADDU " $a0, $a1, %[dst_col_stride]\n" + "ld.w $w14, (0*16)($a1)\n" + "ld.w $w18, (1*16)($a1)\n" + "ld.w $w22, (2*16)($a1)\n" + "ld.w $w15, (0*16)($a0)\n" + "ld.w $w19, (1*16)($a0)\n" + "ld.w $w23, (2*16)($a0)\n" + "b " GEMMLOWP_LABEL_BEFORE_LOOP "f\n" + + GEMMLOWP_LABEL_CLEAR_ACCUMULATORS ":\n" + // Clear accumulators (start_depth == 0). + "ldi.w $w0, 0\n" + "ldi.w $w4, 0\n" + "ldi.w $w8, 0\n" + "ldi.w $w1, 0\n" + "ldi.w $w5, 0\n" + "ldi.w $w9, 0\n" + "ldi.w $w2, 0\n" + "ldi.w $w6, 0\n" + "ldi.w $w10, 0\n" + "ldi.w $w3, 0\n" + "ldi.w $w7, 0\n" + "ldi.w $w11, 0\n" + "ldi.w $w12, 0\n" + "ldi.w $w16, 0\n" + "ldi.w $w20, 0\n" + "ldi.w $w13, 0\n" + "ldi.w $w17, 0\n" + "ldi.w $w21, 0\n" + "ldi.w $w14, 0\n" + "ldi.w $w18, 0\n" + "ldi.w $w22, 0\n" + "ldi.w $w15, 0\n" + "ldi.w $w19, 0\n" + "ldi.w $w23, 0\n" + + GEMMLOWP_LABEL_BEFORE_LOOP ":\n" + + GEMMLOWP_LABEL_LOOP ":\n" + // Overview of register layout: + // + // A half of the 2 2x4 cells of Rhs is stored in 16bit in w28-w31 + // (each register contains 4 replicas of a pair of elements). + // A 12x2 block of 3 4x2 cells Lhs is stored in 16bit in w24-w26. + // A 12x8 block of accumulators is stored in 32bit in w0-w23. + // + // +------+------+------+------+ + // Rhs |w28 |w29 |w30 |w31 | + // +------+------+------+------+ + // + // | | | | | + // + // Lhs | | | | | + // + // +---+ - - - - +------+------+------+------+ + // |w24| |w0/12 |w1/13 |w2/14 |w3/15 | + // |w24| |w0/12 |w1/13 |w2/14 |w3/15 | + // |w24| |w0/12 |w1/13 |w2/14 |w3/15 | + // |w24| |w0/12 |w1/13 |w2/14 |w3/15 | + // +---+ - - - - +------+------+------+------+ + // |w25| |w4/16 |w5/17 |w6/18 |w7/19 | + // |w25| |w4/16 |w5/17 |w6/18 |w7/19 | + // |w25| |w4/16 |w5/17 |w6/18 |w7/19 | + // |w25| |w4/16 |w5/17 |w6/18 |w7/19 | + // +---+ - - - - +------+------+------+------+ + // |w26| |w8/20 |w9/21 |w10/22|w11/23| + // |w26| |w8/20 |w9/21 |w10/22|w11/23| + // |w26| |w8/20 |w9/21 |w10/22|w11/23| + // |w26| |w8/20 |w9/21 |w10/22|w11/23| + // +---+ - - - - +------+------+------+------+ + // + // Accumulators + + // Load 3 x 8 bytes of lhs[] with 2 16-byte overlapped loads. + "ld.b $w24, 0(%[lhs_ptr])\n" + "ld.b $w25, 8(%[lhs_ptr])\n" + + // Load 2 x 8 bytes of rhs[]. + "ld.b $w27, 0(%[rhs_ptr])\n" + + // Zero-extend 8-bit elements of lhs[] to 16 bits. + "ldi.b $w31, 0\n" + "ilvr.b $w24, $w31, $w24\n" + "ilvl.b $w26, $w31, $w25\n" + "ilvr.b $w25, $w31, $w25\n" + + // First half of depths 0 and 1. + // Zero-extend 8-bit elements of rhs[] to 16 bits. + "ilvr.b $w31, $w31, $w27\n" + // Make 4 replicas of every pair of rhs[] elements. + "splati.w $w28, $w31[0]\n" + "splati.w $w29, $w31[1]\n" + "splati.w $w30, $w31[2]\n" + "splati.w $w31, $w31[3]\n" + // Dot-product-(and)-add doubles multiplicand width. + "dpadd_u.w $w0, $w24, $w28\n" + "dpadd_u.w $w4, $w25, $w28\n" + "dpadd_u.w $w8, $w26, $w28\n" + "dpadd_u.w $w1, $w24, $w29\n" + "dpadd_u.w $w5, $w25, $w29\n" + "dpadd_u.w $w9, $w26, $w29\n" + "dpadd_u.w $w2, $w24, $w30\n" + "dpadd_u.w $w6, $w25, $w30\n" + "dpadd_u.w $w10, $w26, $w30\n" + "dpadd_u.w $w3, $w24, $w31\n" + "dpadd_u.w $w7, $w25, $w31\n" + "dpadd_u.w $w11, $w26, $w31\n" + + // Second half of depths 0 and 1. + // Zero-extend 8-bit elements of rhs[] to 16 bits. + "ldi.b $w31, 0\n" + "ilvl.b $w31, $w31, $w27\n" + // Make 4 replicas of every pair of rhs[] elements. + "splati.w $w28, $w31[0]\n" + "splati.w $w29, $w31[1]\n" + "splati.w $w30, $w31[2]\n" + "splati.w $w31, $w31[3]\n" + // Dot-product-(and)-add doubles multiplicand width. + "dpadd_u.w $w12, $w24, $w28\n" + "dpadd_u.w $w16, $w25, $w28\n" + "dpadd_u.w $w20, $w26, $w28\n" + "dpadd_u.w $w13, $w24, $w29\n" + "dpadd_u.w $w17, $w25, $w29\n" + "dpadd_u.w $w21, $w26, $w29\n" + "dpadd_u.w $w14, $w24, $w30\n" + "dpadd_u.w $w18, $w25, $w30\n" + "dpadd_u.w $w22, $w26, $w30\n" + "dpadd_u.w $w15, $w24, $w31\n" + "dpadd_u.w $w19, $w25, $w31\n" + "dpadd_u.w $w23, $w26, $w31\n" + + GEMMLOWP_MIPS_XADDIU " %[run_depth], -2\n" GEMMLOWP_MIPS_XADDIU + " %[lhs_ptr], 24\n" GEMMLOWP_MIPS_XADDIU " %[rhs_ptr], 16\n" + "bnez %[run_depth]," GEMMLOWP_LABEL_LOOP "b\n" + + GEMMLOWP_LABEL_AFTER_LOOP ":\n" + + // Store accumulators. + GEMMLOWP_MIPS_XADDU " $a0, %[dst_ptr], %[dst_col_stride]\n" + "st.w $w0, (0*16)(%[dst_ptr])\n" + "st.w $w4, (1*16)(%[dst_ptr])\n" + "st.w $w8, (2*16)(%[dst_ptr])\n" GEMMLOWP_MIPS_XADDU " $a1, $a0, %[dst_col_stride]\n" + "st.w $w1, (0*16)($a0)\n" + "st.w $w5, (1*16)($a0)\n" + "st.w $w9, (2*16)($a0)\n" GEMMLOWP_MIPS_XADDU " $a0, $a1, %[dst_col_stride]\n" + "st.w $w2, (0*16)($a1)\n" + "st.w $w6, (1*16)($a1)\n" + "st.w $w10, (2*16)($a1)\n" GEMMLOWP_MIPS_XADDU " $a1, $a0, %[dst_col_stride]\n" + "st.w $w3, (0*16)($a0)\n" + "st.w $w7, (1*16)($a0)\n" + "st.w $w11, (2*16)($a0)\n" GEMMLOWP_MIPS_XADDU " $a0, $a1, %[dst_col_stride]\n" + "st.w $w12, (0*16)($a1)\n" + "st.w $w16, (1*16)($a1)\n" + "st.w $w20, (2*16)($a1)\n" GEMMLOWP_MIPS_XADDU " $a1, $a0, %[dst_col_stride]\n" + "st.w $w13, (0*16)($a0)\n" + "st.w $w17, (1*16)($a0)\n" + "st.w $w21, (2*16)($a0)\n" GEMMLOWP_MIPS_XADDU " $a0, $a1, %[dst_col_stride]\n" + "st.w $w14, (0*16)($a1)\n" + "st.w $w18, (1*16)($a1)\n" + "st.w $w22, (2*16)($a1)\n" + "st.w $w15, (0*16)($a0)\n" + "st.w $w19, (1*16)($a0)\n" + "st.w $w23, (2*16)($a0)\n" + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), [run_depth] "+r"(run_depth), + [dst_col_stride] "+r"(dst_col_stride) + : // inputs + [dst_ptr] "r"(dst_ptr), + [start_depth] "r"(start_depth) + : // clobbers + "memory", "a0", "a1", "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", "$f9", + "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", "$f16", "$f17", "$f18", "$f19", "$f20", + "$f21", "$f22", "$f23", "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31"); + +#undef GEMMLOWP_LABEL_CLEAR_ACCUMULATORS +#undef GEMMLOWP_LABEL_BEFORE_LOOP +#undef GEMMLOWP_LABEL_LOOP +#undef GEMMLOWP_LABEL_AFTER_LOOP + } +}; + +// Fast kernel operating on int8 operands. +// It is assumed that one of the two int8 operands only takes values +// in [-127, 127], while the other may freely range in [-128, 127]. +// The issue with both operands taking the value -128 is that: +// -128*-128 + -128*-128 == -32768 overflows int16. +// Every other expression a*b + c*d, for any int8 a,b,c,d, fits in int16 +// range. That is the basic idea of this kernel. +struct MSA_GEMM_Int8Operands_LhsNonzero : KernelBase { + typedef KernelFormat< + KernelSideFormatInt8, 1>, + KernelSideFormatInt8, 1> > + Format; + + const char* Name() const override { + return "MSA, 4x4, depth 16, accumulating two within signed int16"; + } + + // TODO(benoitjacob): reorder function arguments so dst comes last + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + (void)dst_row_stride; +#define GEMMLOWP_LABEL_AFTER_LOOP_LAST16 "1" +#define GEMMLOWP_LABEL_LOOP "2" +#define GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES "3" +#define GEMMLOWP_LABEL_STORE "4" + asm volatile( + GEMMLOWP_MIPS_XADDIU " %[run_depth], -16\n" + // Load lhs[] and rhs[], zero out internal accumulators. + "ld.b $w16, 0(%[lhs_ptr])\n" + "ldi.b $w0, 0\n" + "ld.b $w20, 0(%[rhs_ptr])\n" + "ldi.b $w1, 0\n" + "ld.b $w17, 16(%[lhs_ptr])\n" + "ldi.b $w2, 0\n" + "ld.b $w21, 16(%[rhs_ptr])\n" + "ldi.b $w3, 0\n" + "ld.b $w18, 32(%[lhs_ptr])\n" + "ldi.b $w4, 0\n" + "ld.b $w19, 48(%[lhs_ptr])\n" + "ldi.b $w5, 0\n" + "ld.b $w22, 32(%[rhs_ptr])\n" + "ldi.b $w6, 0\n" + "ld.b $w23, 48(%[rhs_ptr])\n" + "ldi.b $w7, 0\n" + "ldi.b $w8, 0\n" + "ldi.b $w9, 0\n" + "ldi.b $w10, 0\n" + "ldi.b $w11, 0\n" + "ldi.b $w12, 0\n" + "ldi.b $w13, 0\n" + "ldi.b $w14, 0\n" + "ldi.b $w15, 0\n" + "ldi.h $w31, 1\n" + // If the loop depth is only 16, then we can skip the general loop + // and go straight to the final part of the code. + "beqz %[run_depth], " GEMMLOWP_LABEL_AFTER_LOOP_LAST16 "f\n" + + GEMMLOWP_LABEL_LOOP ":\n" + // Overview of register layout: + // + // A 4x16 block of Rhs is stored in 8 bit in w16-w19. + // A 4x16 block of Lhs is stored in 8 bit in w20-w23. + // + // A 4x4 block of accumulators is stored in w0-w15 (as 4x32 bit + // components which need to be horizontally added at the end). + // + // Dot products of Lhs and Rhs are 16-bit values, which can't + // immediately be accumulated in 32-bit accumulators by that + // same instruction that calculates them. + // For example, "dotp_s.h $w25, $w16, $w20" produces 8 16-bit + // sums in w25 (note, the 16 sums have already been reduced to 8 + // by the horizontal addition of the dotp instruction). + // They are then sign-extended to 32 bits, horizontally added + // (again) to form 4 32-bit sums and then they are finally added + // to the 32-bit accumulators, all by "dpadd_s.w $w0, $w25, $w31". + // + // +-----+-----+-----+-----+ + // Rhs | w20 | w21 | w22 | w23 | + // +-----+-----+-----+-----+ + // + // | | | | | + // + // Lhs | | | | | + // + // +---+ - - - - +-----+-----+-----+-----+ + // |w16| | w0 | w4 | w8 | w12 | + // |w17| | w1 | w5 | w9 | w13 | + // |w18| | w2 | w6 | w10 | w14 | + // |w19| | w3 | w7 | w11 | w15 | + // +---+ - - - - +-----+-----+-----+-----+ + // + // Accumulators + + // Calculate the results for 16 depths and load + // lhs[] and rhs[] for the next iteration. + GEMMLOWP_MIPS_XADDIU " %[lhs_ptr], 64\n" + GEMMLOWP_MIPS_XADDIU " %[rhs_ptr], 64\n" + GEMMLOWP_MIPS_XADDIU " %[run_depth], -16\n" + + // Dot product: multiply-add pairs of adjacent int8 elements. + // Each dot product takes 16*2 int8 values in and produces 8 int16 sums. + "dotp_s.h $w25, $w16, $w20\n" + "dotp_s.h $w26, $w17, $w20\n" + "dotp_s.h $w27, $w16, $w21\n" + "dotp_s.h $w28, $w17, $w21\n" + "dotp_s.h $w29, $w18, $w20\n" + // Horizontal add of pairs of adjacent int16 sums into internal int32 + // accumulators. + "dpadd_s.w $w0, $w25, $w31\n" + "dpadd_s.w $w1, $w26, $w31\n" + "dpadd_s.w $w4, $w27, $w31\n" + "dpadd_s.w $w5, $w28, $w31\n" + "dpadd_s.w $w2, $w29, $w31\n" + + // Dot product: multiply-add pairs of adjacent int8 elements. + // Each dot product takes 16*2 int8 values in and produces 8 int16 sums. + "dotp_s.h $w24, $w16, $w22\n" + "dotp_s.h $w25, $w19, $w20\n" + "dotp_s.h $w26, $w16, $w23\n" + "dotp_s.h $w27, $w17, $w22\n" + "ld.b $w20, 0(%[rhs_ptr])\n" + "dotp_s.h $w28, $w17, $w23\n" + "ld.b $w16, 0(%[lhs_ptr])\n" + "dotp_s.h $w29, $w18, $w21\n" + "ld.b $w17, 16(%[lhs_ptr])\n" + // Horizontal add of pairs of adjacent int16 sums into internal int32 + // accumulators. + "dpadd_s.w $w8, $w24, $w31\n" + "dpadd_s.w $w3, $w25, $w31\n" + "dpadd_s.w $w12, $w26, $w31\n" + "dpadd_s.w $w9, $w27, $w31\n" + "dpadd_s.w $w13, $w28, $w31\n" + "dpadd_s.w $w6, $w29, $w31\n" + + // Dot product: multiply-add pairs of adjacent int8 elements. + // Each dot product takes 16*2 int8 values in and produces 8 int16 sums. + "dotp_s.h $w25, $w19, $w21\n" + "dotp_s.h $w26, $w18, $w22\n" + "dotp_s.h $w27, $w18, $w23\n" + "ld.b $w21, 16(%[rhs_ptr])\n" + "dotp_s.h $w28, $w19, $w22\n" + "ld.b $w18, 32(%[lhs_ptr])\n" + "dotp_s.h $w29, $w19, $w23\n" + "ld.b $w22, 32(%[rhs_ptr])\n" + // Horizontal add of pairs of adjacent int16 sums into internal int32 + // accumulators. + "dpadd_s.w $w7, $w25, $w31\n" + "ld.b $w19, 48(%[lhs_ptr])\n" + "dpadd_s.w $w10, $w26, $w31\n" + "ld.b $w23, 48(%[rhs_ptr])\n" + "dpadd_s.w $w14, $w27, $w31\n" + "dpadd_s.w $w11, $w28, $w31\n" + "dpadd_s.w $w15, $w29, $w31\n" + + "bnez %[run_depth], " GEMMLOWP_LABEL_LOOP "b\n" + + GEMMLOWP_LABEL_AFTER_LOOP_LAST16 ":\n" + // Calculate the results for the last 16 depths. + + // Dot product: multiply-add pairs of adjacent int8 elements. + // Each dot product takes 16*2 int8 values in and produces 8 int16 sums. + "dotp_s.h $w25, $w16, $w20\n" + "dotp_s.h $w26, $w17, $w20\n" + "dotp_s.h $w27, $w16, $w21\n" + "dotp_s.h $w28, $w17, $w21\n" + "dotp_s.h $w29, $w18, $w20\n" + // Horizontal add of pairs of adjacent int16 sums into internal int32 + // accumulators. + "dpadd_s.w $w0, $w25, $w31\n" + "dpadd_s.w $w1, $w26, $w31\n" + "dpadd_s.w $w4, $w27, $w31\n" + "dpadd_s.w $w5, $w28, $w31\n" + "dpadd_s.w $w2, $w29, $w31\n" + + // Dot product: multiply-add pairs of adjacent int8 elements. + // Each dot product takes 16*2 int8 values in and produces 8 int16 sums. + "dotp_s.h $w24, $w16, $w22\n" + "dotp_s.h $w25, $w19, $w20\n" + "dotp_s.h $w26, $w16, $w23\n" + "dotp_s.h $w27, $w17, $w22\n" + "dotp_s.h $w28, $w17, $w23\n" + "dotp_s.h $w29, $w18, $w21\n" + // Horizontal add of pairs of adjacent int16 sums into internal int32 + // accumulators. + "dpadd_s.w $w8, $w24, $w31\n" + "dpadd_s.w $w3, $w25, $w31\n" + "dpadd_s.w $w12, $w26, $w31\n" + "dpadd_s.w $w9, $w27, $w31\n" + "dpadd_s.w $w13, $w28, $w31\n" + "dpadd_s.w $w6, $w29, $w31\n" + + // Dot product: multiply-add pairs of adjacent int8 elements. + // Each dot product takes 16*2 int8 values in and produces 8 int16 sums. + "dotp_s.h $w25, $w19, $w21\n" + "dotp_s.h $w26, $w18, $w22\n" + "dotp_s.h $w27, $w18, $w23\n" + "dotp_s.h $w28, $w19, $w22\n" + "dotp_s.h $w29, $w19, $w23\n" + // Horizontal add of pairs of adjacent int16 sums into internal int32 + // accumulators. + "dpadd_s.w $w7, $w25, $w31\n" + "dpadd_s.w $w10, $w26, $w31\n" + "dpadd_s.w $w14, $w27, $w31\n" + "dpadd_s.w $w11, $w28, $w31\n" + "dpadd_s.w $w15, $w29, $w31\n" + + // Horizontal-add internal accumulators. + "hadd_s.d $w0, $w0, $w0\n" + "hadd_s.d $w1, $w1, $w1\n" + "hadd_s.d $w2, $w2, $w2\n" + "hadd_s.d $w3, $w3, $w3\n" + "hadd_s.d $w4, $w4, $w4\n" + "hadd_s.d $w5, $w5, $w5\n" + "hadd_s.d $w6, $w6, $w6\n" + "hadd_s.d $w7, $w7, $w7\n" + "hadd_s.d $w8, $w8, $w8\n" + "hadd_s.d $w9, $w9, $w9\n" + "hadd_s.d $w10, $w10, $w10\n" + "hadd_s.d $w11, $w11, $w11\n" + "hadd_s.d $w12, $w12, $w12\n" + "hadd_s.d $w13, $w13, $w13\n" + "hadd_s.d $w14, $w14, $w14\n" + "hadd_s.d $w15, $w15, $w15\n" + "pckev.w $w0, $w1, $w0\n" + "pckev.w $w2, $w3, $w2\n" + "pckev.w $w4, $w5, $w4\n" + "pckev.w $w6, $w7, $w6\n" + "pckev.w $w8, $w9, $w8\n" + "pckev.w $w10, $w11, $w10\n" + "pckev.w $w12, $w13, $w12\n" + "pckev.w $w14, $w15, $w14\n" + "hadd_s.d $w0, $w0, $w0\n" + "hadd_s.d $w2, $w2, $w2\n" + "hadd_s.d $w4, $w4, $w4\n" + "hadd_s.d $w6, $w6, $w6\n" + "hadd_s.d $w8, $w8, $w8\n" + "hadd_s.d $w10, $w10, $w10\n" + "hadd_s.d $w12, $w12, $w12\n" + "hadd_s.d $w14, $w14, $w14\n" + // 4 more pckev instructions follow in both paths below. + + // Check if start_depth==0 to decide whether we will load + // existing accumulators from memory. + "bnez %[start_depth], " GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES "f\n" + + "pckev.w $w0, $w2, $w0\n" + "pckev.w $w1, $w6, $w4\n" + "pckev.w $w2, $w10, $w8\n" + "pckev.w $w3, $w14, $w12\n" + + "b " GEMMLOWP_LABEL_STORE "f\n" + + GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES ":\n" + // Load accumulators from memory. + "ld.w $w16, 0(%[dst_ptr0])\n" + "pckev.w $w0, $w2, $w0\n" + "ld.w $w17, 0(%[dst_ptr1])\n" + "pckev.w $w1, $w6, $w4\n" + "ld.w $w18, 0(%[dst_ptr2])\n" + "pckev.w $w2, $w10, $w8\n" + "ld.w $w19, 0(%[dst_ptr3])\n" + "pckev.w $w3, $w14, $w12\n" + + // Add them to internal accumulators. + "addv.w $w0, $w0, $w16\n" + "addv.w $w1, $w1, $w17\n" + "addv.w $w2, $w2, $w18\n" + "addv.w $w3, $w3, $w19\n" + + GEMMLOWP_LABEL_STORE ":\n" + // Store accumulators. + "st.w $w0, 0(%[dst_ptr0])\n" + "st.w $w1, 0(%[dst_ptr1])\n" + "st.w $w2, 0(%[dst_ptr2])\n" + "st.w $w3, 0(%[dst_ptr3])\n" + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [run_depth] "+r"(run_depth) + : // inputs + [dst_ptr0] "r"(dst_ptr), [dst_ptr1] "r"(dst_ptr + dst_col_stride), + [dst_ptr2] "r"(dst_ptr + dst_col_stride * 2), + [dst_ptr3] "r"(dst_ptr + dst_col_stride * 3), + [start_depth] "r"(start_depth) + : // clobbers + "memory", "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", + "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", "$f16", "$f17", + "$f18", "$f19", "$f20", "$f21", "$f22", "$f23", "$f24", "$f25", "$f26", + "$f27", "$f28", "$f29", "$f30", "$f31"); +#undef GEMMLOWP_LABEL_LOOP +#undef GEMMLOWP_LABEL_AFTER_LOOP_LAST16 +#undef GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES +#undef GEMMLOWP_LABEL_STORE + } +}; + +#undef GEMMLOWP_MIPS_XADDU +#undef GEMMLOWP_MIPS_XADDIU +#undef GEMMLOWP_MIPS_XSLL + +#endif // GEMMLOWP_MSA + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_KERNEL_MSA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_neon.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_neon.h new file mode 100644 index 0000000000000000000000000000000000000000..9859637f41eaac2ed0e161cd6daed74c3145c04b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_neon.h @@ -0,0 +1,1913 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// kernel_neon.h: a collection of NEON optimized kernels. +// Check in kernel_default.h which one(s) are actually used by default. +// Others are mere experiments; they are still covered by tests +// in case they might be useful some day. + +#ifndef GEMMLOWP_INTERNAL_KERNEL_NEON_H_ +#define GEMMLOWP_INTERNAL_KERNEL_NEON_H_ + +#include "kernel.h" + +#include +#include + +namespace gemmlowp { + +// The kernels here are specifically arm 32bit assembly, not arm 64bit. +#ifdef GEMMLOWP_NEON_32 + +// Our main GEMM kernel. +struct NEON_32_Kernel12x4Depth2 : KernelBase { + typedef KernelFormat, 3>, + KernelSideFormat, 1> > + Format; + + const char* Name() const override { return "NEON, 12x4, depth 2"; } + + // TODO(benoitjacob): reorder function arguments so dst comes last + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + ScopedProfilingLabel label("optimized kernel (NEON 12x4)"); + +// For iOS assembler, the %= style of local labels cause compilation errors, +// so use numerical ones instead. See +// http://stackoverflow.com/questions/3898435/labels-in-gcc-inline-assembly +// If you add any labels, remember to undef them at the end. +#define GEMMLOWP_LABEL_CLEAR_ACCUMULATORS "1" +#define GEMMLOWP_LABEL_BEFORE_LOOP "2" +#define GEMMLOWP_LABEL_LOOP "3" +#define GEMMLOWP_LABEL_AFTER_LOOP "4" + + assert(dst_row_stride == 1); + (void)dst_row_stride; + asm volatile( + // Overview of register layout: + // + // A 2x4 cell of Rhs is stored in 16bit in d0--d1 (q0). + // A 12x2 block of 3 4x2 cells Lhs is stored in 16bit in d2--d7 + // (q1--q3). + // A 12x4 block of accumulators is stored in 32bit in q4--q15. + // + // +-----+-----+-----+-----+ + // |d0[0]|d0[1]|d0[2]|d0[3]| + // Rhs +-----+-----+-----+-----+ + // |d1[0]|d1[1]|d1[2]|d1[3]| + // +-----+-----+-----+-----+ + // + // | | | | | + // + // Lhs | | | | | + // + // +--+--+ - - - - +-----+-----+-----+-----+ + // |d2|d3| | q4 | q5 | q6 | q7 | + // |d2|d3| | q4 | q5 | q6 | q7 | + // |d2|d3| | q4 | q5 | q6 | q7 | + // |d2|d3| | q4 | q5 | q6 | q7 | + // +--+--+ - - - - +-----+-----+-----+-----+ + // |d4|d5| | q8 | q9 | q10 | q11 | + // |d4|d5| | q8 | q9 | q10 | q11 | + // |d4|d5| | q8 | q9 | q10 | q11 | + // |d4|d5| | q8 | q9 | q10 | q11 | + // +--+--+ - - - - +-----+-----+-----+-----+ + // |d6|d7| | q12 | q13 | q14 | q15 | + // |d6|d7| | q12 | q13 | q14 | q15 | + // |d6|d7| | q12 | q13 | q14 | q15 | + // |d6|d7| | q12 | q13 | q14 | q15 | + // +--+--+ - - - - +-----+-----+-----+-----+ + // + // Accumulator + + // Load 1 Rhs cell of size 2x4 + "vld1.8 {d0}, [%[rhs_ptr]]!\n" + // Load 3 Lhs cells of size 4x2 each + "vld1.8 {d2}, [%[lhs_ptr]]!\n" + "vld1.8 {d4}, [%[lhs_ptr]]!\n" + "vld1.8 {d6}, [%[lhs_ptr]]!\n" + + // Check if start_depth==0 to decide whether we will clear + // accumulators or load existing accumulators. + "cmp %[start_depth], #0\n" + + // Multiply dst_col_stride by 4 == sizeof(int32) to use + // it as a byte offset below. + "lsl %[dst_col_stride], #2\n" + + "beq " GEMMLOWP_LABEL_CLEAR_ACCUMULATORS + "f\n" + + // Load accumulators (start_depth != 0) + "mov r1, %[dst_ptr]\n" + "subs %[run_depth], #2\n" + "mov r0, r1\n" + "vld1.32 {d8, d9}, [r0]!\n" + "add r1, %[dst_col_stride]\n" + "vld1.32 {d16, d17}, [r0]!\n" + "vld1.32 {d24, d25}, [r0]\n" + "mov r0, r1\n" + "vld1.32 {d10, d11}, [r0]!\n" + "add r1, %[dst_col_stride]\n" + "vld1.32 {d18, d19}, [r0]!\n" + "vld1.32 {d26, d27}, [r0]\n" + "mov r0, r1\n" + "vld1.32 {d12, d13}, [r0]!\n" + "add r1, %[dst_col_stride]\n" + "vld1.32 {d20, d21}, [r0]!\n" + "vld1.32 {d28, d29}, [r0]\n" + "mov r0, r1\n" + "vld1.32 {d14, d15}, [r0]!\n" + "vld1.32 {d22, d23}, [r0]!\n" + "vld1.32 {d30, d31}, [r0]\n" + + "b " GEMMLOWP_LABEL_BEFORE_LOOP "f\n" + + GEMMLOWP_LABEL_CLEAR_ACCUMULATORS + ":\n" + + // Clear accumulators (start_depth == 0) + "vmov.s32 q4, #0\n" + "subs %[run_depth], #2\n" + "vmov.s32 q8, q4\n" + "vmov.s32 q12, q4\n" + "vmov.s32 q5, q4\n" + "vmov.s32 q9, q4\n" + "vmov.s32 q13, q4\n" + "vmov.s32 q6, q4\n" + "vmov.s32 q10, q4\n" + "vmov.s32 q14, q4\n" + "vmov.s32 q7, q4\n" + "vmov.s32 q11, q4\n" + "vmov.s32 q15, q4\n" + + GEMMLOWP_LABEL_BEFORE_LOOP + ":\n" + + // If there are only two levels of depth, skip the loop. + "beq " GEMMLOWP_LABEL_AFTER_LOOP "f\n" + + GEMMLOWP_LABEL_LOOP + ":\n" + // Expand Lhs/Rhs cells to 16 bit. + // Note: moving theses vmovls further down to allow for + // longer data pipelining helps a little on A57 but is + // harmful on A53 --- It looks as if A53 doesn't like + // interleaving vmovl's into the vmlal's. + "vmovl.u8 q0, d0\n" + "vmovl.u8 q1, d2\n" + "vmovl.u8 q2, d4\n" + "vmovl.u8 q3, d6\n" + + // Multiply-accumulate, level of depth 0 + "vmlal.u16 q4, d2, d0[0]\n" + "vmlal.u16 q5, d2, d0[1]\n" + "vmlal.u16 q6, d2, d0[2]\n" + "vmlal.u16 q7, d2, d0[3]\n" + "vldr d2, [%[lhs_ptr]]\n" + "vmlal.u16 q8, d4, d0[0]\n" + "vmlal.u16 q9, d4, d0[1]\n" + "vmlal.u16 q10, d4, d0[2]\n" + "vmlal.u16 q11, d4, d0[3]\n" + "vldr d4, [%[lhs_ptr], #8]\n" + "vmlal.u16 q12, d6, d0[0]\n" + "vmlal.u16 q13, d6, d0[1]\n" + "vmlal.u16 q14, d6, d0[2]\n" + "vmlal.u16 q15, d6, d0[3]\n" + "vldr d6, [%[lhs_ptr], #16]\n" + "vldr d0, [%[rhs_ptr]]\n" + + // Multiply-accumulate, level of depth 1 + "vmlal.u16 q4, d3, d1[0]\n" + "vmlal.u16 q5, d3, d1[1]\n" + "add %[lhs_ptr], #24\n" + "vmlal.u16 q6, d3, d1[2]\n" + "vmlal.u16 q7, d3, d1[3]\n" + "add %[rhs_ptr], #8\n" + "vmlal.u16 q8, d5, d1[0]\n" + "vmlal.u16 q9, d5, d1[1]\n" + "subs %[run_depth], #2\n" + "vmlal.u16 q10, d5, d1[2]\n" + "vmlal.u16 q11, d5, d1[3]\n" + "vmlal.u16 q12, d7, d1[0]\n" + "vmlal.u16 q13, d7, d1[1]\n" + "vmlal.u16 q14, d7, d1[2]\n" + "vmlal.u16 q15, d7, d1[3]\n" + + "bne " GEMMLOWP_LABEL_LOOP "b\n" + + GEMMLOWP_LABEL_AFTER_LOOP + ":\n" + + // Do remaining arithmetic for the last 2 levels of depth. + + // Expand Lhs/Rhs cells to 16 bit. + "vmovl.u8 q0, d0\n" + "vmovl.u8 q1, d2\n" + "vmovl.u8 q2, d4\n" + "vmovl.u8 q3, d6\n" + + // Multiply-accumulate, level of depth 0 + "vmlal.u16 q4, d2, d0[0]\n" + "vmlal.u16 q5, d2, d0[1]\n" + "vmlal.u16 q6, d2, d0[2]\n" + "vmlal.u16 q7, d2, d0[3]\n" + "vmlal.u16 q8, d4, d0[0]\n" + "vmlal.u16 q9, d4, d0[1]\n" + "vmlal.u16 q10, d4, d0[2]\n" + "vmlal.u16 q11, d4, d0[3]\n" + "vmlal.u16 q12, d6, d0[0]\n" + "vmlal.u16 q13, d6, d0[1]\n" + "vmlal.u16 q14, d6, d0[2]\n" + "vmlal.u16 q15, d6, d0[3]\n" + + // Multiply-accumulate, level of depth 1 + "vmlal.u16 q4, d3, d1[0]\n" + "vmlal.u16 q5, d3, d1[1]\n" + "vmlal.u16 q6, d3, d1[2]\n" + "vmlal.u16 q7, d3, d1[3]\n" + "vmlal.u16 q8, d5, d1[0]\n" + "vmlal.u16 q9, d5, d1[1]\n" + "vmlal.u16 q10, d5, d1[2]\n" + "vmlal.u16 q11, d5, d1[3]\n" + "vmlal.u16 q12, d7, d1[0]\n" + "vmlal.u16 q13, d7, d1[1]\n" + "vmlal.u16 q14, d7, d1[2]\n" + "vmlal.u16 q15, d7, d1[3]\n" + + // Store accumulators + "mov r1, %[dst_ptr]\n" + "mov r0, r1\n" + "vst1.32 {d8, d9}, [r0]!\n" + "add r1, %[dst_col_stride]\n" + "vst1.32 {d16, d17}, [r0]!\n" + "vst1.32 {d24, d25}, [r0]\n" + "mov r0, r1\n" + "vst1.32 {d10, d11}, [r0]!\n" + "add r1, %[dst_col_stride]\n" + "vst1.32 {d18, d19}, [r0]!\n" + "vst1.32 {d26, d27}, [r0]\n" + "mov r0, r1\n" + "vst1.32 {d12, d13}, [r0]!\n" + "add r1, %[dst_col_stride]\n" + "vst1.32 {d20, d21}, [r0]!\n" + "vst1.32 {d28, d29}, [r0]\n" + "mov r0, r1\n" + "vst1.32 {d14, d15}, [r0]!\n" + "vst1.32 {d22, d23}, [r0]!\n" + "vst1.32 {d30, d31}, [r0]\n" + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [dst_ptr] "+r"(dst_ptr), + [run_depth] "+r"(run_depth) + : // inputs + [start_depth] "r"(start_depth), + [dst_col_stride] "r"(dst_col_stride) + : // clobbers + "cc", "memory", "r0", "r1", + // note: someone on internet says that quad registers are + // unsupported in the clobber list! + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", + "d31"); +#undef GEMMLOWP_LABEL_CLEAR_ACCUMULATORS +#undef GEMMLOWP_LABEL_BEFORE_LOOP +#undef GEMMLOWP_LABEL_LOOP +#undef GEMMLOWP_LABEL_AFTER_LOOP + } +}; + +struct NEON_32_Kernel12x4Depth2Assuming12BitProducts : KernelBase { + typedef KernelFormat< + KernelSideFormat, 3>, + KernelSideFormat, 1> > + Format; + + const char* Name() const override { + return "NEON, 12x4, depth 2, assuming 12-bit products"; + } + + // TODO(benoitjacob): reorder function arguments so dst comes last + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + ScopedProfilingLabel label( + "optimized kernel (NEON 12x4, assuming 12-bit products)"); + assert(dst_row_stride == 1); + (void)dst_row_stride; + +// See comments above for why we need local numerical labels in our asm. +#define GEMMLOWP_LOOP_NEON_32_KERNEL_12X4_DEPTH2_ASSUMING_12BIT_PRODUCTS "1" +#define GEMMLOWP_LOAD_GLOBAL_ACCUMULATORS_NEON_32_KERNEL_12X4_DEPTH2_12BIT "2" +#define GEMMLOWP_LABEL_32 "3" +#define GEMMLOWP_LABEL_24 "4" +#define GEMMLOWP_LABEL_16 "5" +#define GEMMLOWP_LABEL_8 "6" +#define GEMMLOWP_LABEL_2 "7" + + // This kernel is special in that it uses local 16-bit accumulators. + // Because it assumes that each product fits in 12 bits, it can accumulate + // 16 products into a local 16-bit accumulator without risking overflow. + // At that point, it must accumulate these local 16-bit accumulators back + // into global 32-bit accumulators, which have to be stored in memory for + // lack of register space. + // This 12x4 block of global accumulators is laid out as 3 cells of size 4x4 + // stored in diagonal-major order like this for the first 4x4 cell: + // + // 0 4 8 12 + // 13 1 5 9 + // 10 14 2 6 + // 7 11 15 3 + // + // and likewise for the 2nd cell (16--31) and 3rd cell (32--47) + std::int32_t global_accumulators[3 * 4 * 4]; + asm volatile( + // Compute stride between consecutive columns, in bytes + "mov r0, #4\n" // multiply by 4 = sizeof(int32) + "mul %[dst_col_stride], r0\n" + + "cmp %[start_depth], #0\n" + "bne" + " " GEMMLOWP_LOAD_GLOBAL_ACCUMULATORS_NEON_32_KERNEL_12X4_DEPTH2_12BIT + "f\n" + + // If start_depth==0, we need to clear our global accumulators + "mov r0, %[global_accumulators]\n" + "vmov.s32 q8, #0\n" + "vmov.s32 q9, q8\n" + "vst1.32 {d16,d17,d18,d19}, [r0]!\n" + "vst1.32 {d16,d17,d18,d19}, [r0]!\n" + "vst1.32 {d16,d17,d18,d19}, [r0]!\n" + "vst1.32 {d16,d17,d18,d19}, [r0]!\n" + "vst1.32 {d16,d17,d18,d19}, [r0]!\n" + "vst1.32 {d16,d17,d18,d19}, [r0]!\n" + "b " GEMMLOWP_LOOP_NEON_32_KERNEL_12X4_DEPTH2_ASSUMING_12BIT_PRODUCTS + "f\n" + + // If start_depth!=0, we need to load our existing global accumulators + GEMMLOWP_LOAD_GLOBAL_ACCUMULATORS_NEON_32_KERNEL_12X4_DEPTH2_12BIT + ":\n" + // Load global accumulators from destination matrix, column-major + "mov r1, %[dst_ptr]\n" + "mov r0, %[dst_col_stride]\n" + "sub r0, #32\n" + "vld1.32 {d0,d1}, [r1]!\n" + "vld1.32 {d8,d9}, [r1]!\n" + "vld1.32 {d16,d17}, [r1], r0\n" + "vld1.32 {d2,d3}, [r1]!\n" + "vld1.32 {d10,d11}, [r1]!\n" + "vld1.32 {d18,d19}, [r1], r0\n" + "vld1.32 {d4,d5}, [r1]!\n" + "vld1.32 {d12,d13}, [r1]!\n" + "vld1.32 {d20,d21}, [r1], r0\n" + "vld1.32 {d6,d7}, [r1]!\n" + "vld1.32 {d14,d15}, [r1]!\n" + "vld1.32 {d22,d23}, [r1], r0\n" + // Now we need to convert the global accumulator registers to + // 4x4-block-wise diagonal-major order. What we effectively want to do + // is to rotate the rows, however the accumulators are stored in + // column-major order in registers. So we achieve this by + // transposing, rotating the registers, and transposing again each + // 4x4 block. + // + // Transpose 3 4x4 blocks separately + "vtrn.32 q0, q1\n" + "vtrn.32 q2, q3\n" + "vswp d1, d4\n" + "vswp d3, d6\n" + "vtrn.32 q4, q5\n" + "vtrn.32 q6, q7\n" + "vswp d9, d12\n" + "vswp d11, d14\n" + "vtrn.32 q8, q9\n" + "vtrn.32 q10, q11\n" + "vswp d17, d20\n" + "vswp d19, d22\n" + // Rotate the registers + "vext.32 q1, q1, q1, #1\n" + "vext.32 q2, q2, q2, #2\n" + "vext.32 q3, q3, q3, #3\n" + "vext.32 q5, q5, q5, #1\n" + "vext.32 q6, q6, q6, #2\n" + "vext.32 q7, q7, q7, #3\n" + "vext.32 q9, q9, q9, #1\n" + "vext.32 q10, q10, q10, #2\n" + "vext.32 q11, q11, q11, #3\n" + // Transpose again and store into our global accumulators + // buffer. These two operations are done at once using vst4. + "mov r0, %[global_accumulators]\n" + "vst4.32 {d0,d2,d4,d6}, [r0]!\n" + "vst4.32 {d1,d3,d5,d7}, [r0]!\n" + "vst4.32 {d8,d10,d12,d14}, [r0]!\n" + "vst4.32 {d9,d11,d13,d15}, [r0]!\n" + "vst4.32 {d16,d18,d20,d22}, [r0]!\n" + "vst4.32 {d17,d19,d21,d23}, [r0]!\n" + + /* Main loop */ + + GEMMLOWP_LOOP_NEON_32_KERNEL_12X4_DEPTH2_ASSUMING_12BIT_PRODUCTS + ":\n" + + // Overview of register layout: + // + // Registers q4--q16 are the local 16-bit accumulators. + // However, each entry in the result matrix is represented + // by *two* local 16-bit accumulators: one for even levels + // of depth and one for odd levels of depth. These correspond + // to the scalars at even and odd indices within each q-register. + // Thus we effectively use 32 bits of register space for each + // entry in the result matrix. The accumulators register layout + // is the same as was described above for the global 32-bit + // accumulators (3 cells of size 4x4 in diagonal-major order) + // with the only difference that instead of 32bit values we have + // pairs of 16bit values. + // + // A 2x4 cell of Rhs is stored in 8bit in d0. + // A 12x2 block of 3 4x2 cells Lhs is stored in 8bit in d1--d3. + // + // +--------+--------+--------+--------+ + // |d0[0] |d0[2] |d0[4] |d0[6] | + // Rhs +--------+--------+--------+--------+ + // |d0[1] |d0[3] |d0[5] |d0[7] | + // +--------+--------+--------+--------+ + // + // | | | | | + // + // Lhs | | | | | + // + // +-----+-----+ - - - +--------+--------+--------+--------+ + // |d1[0]|d1[1]| |q4[0,1] |q5[0,1] |q6[0,1] |q7[0,1] | + // |d1[2]|d1[3]| |q7[2,3] |q4[2,3] |q5[2,3] |q6[2,3] | + // |d1[4]|d1[5]| |q6[4,5] |q7[4,5] |q4[4,5] |q5[4,5] | + // |d1[6]|d1[7]| |q5[6,7] |q6[6,7] |q7[6,7] |q4[6,7] | + // +-----+-----+ - - - +--------+--------+--------+--------+ + // |d2[0]|d2[1]| |q8[0,1] |q8[0,1] |q8[0,1] |q8[0,1] | + // |d2[2]|d2[3]| |q9[2,3] |q9[2,3] |q9[2,3] |q9[2,3] | + // |d2[4]|d2[5]| |q10[4,5]|q10[4,5]|q10[4,5]|q10[4,5]| + // |d2[6]|d2[7]| |q11[6,7]|q11[6,7]|q11[6,7]|q11[6,7]| + // +-----+-----+ - - - +--------+--------+--------+--------+ + // |d3[0]|d3[1]| |q12[0,1]|q12[0,1]|q12[0,1]|q12[0,1]| + // |d3[2]|d3[3]| |q13[2,3]|q13[2,3]|q13[2,3]|q13[2,3]| + // |d3[4]|d3[5]| |q14[4,5]|q14[4,5]|q14[4,5]|q14[4,5]| + // |d3[6]|d3[7]| |q15[6,7]|q15[6,7]|q15[6,7]|q15[6,7]| + // +-----+-----+ - - - +--------+--------+--------+--------+ + // + // Local 16-bit accumulators + // Note: 2 scalars per matrix entry + +#define GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH \ + /* Load 3 Lhs cells of size 4x2 */ \ + "vld1.8 {d1,d2,d3}, [%[lhs_ptr]:64]!\n" \ + \ + /* Load 1 Rhs cell of size 2x4 */ \ + "vld1.8 {d0}, [%[rhs_ptr]:64]!\n" \ + \ + /* Multiply-accumulate */ \ + "vmlal.u8 q4, d1, d0\n" \ + "vmlal.u8 q8, d2, d0\n" \ + "vmlal.u8 q12, d3, d0\n" \ + "vext.8 d0, d0, d0, #2\n" \ + "vmlal.u8 q5, d1, d0\n" \ + "vmlal.u8 q9, d2, d0\n" \ + "vmlal.u8 q13, d3, d0\n" \ + "vext.8 d0, d0, d0, #2\n" \ + "vmlal.u8 q6, d1, d0\n" \ + "vmlal.u8 q10, d2, d0\n" \ + "vmlal.u8 q14, d3, d0\n" \ + "vext.8 d0, d0, d0, #2\n" \ + "vmlal.u8 q7, d1, d0\n" \ + "vmlal.u8 q11, d2, d0\n" \ + "vmlal.u8 q15, d3, d0\n" \ + \ + "sub %[run_depth], #2\n" + +#define GEMMLOWP_ACCUMULATE_8_LEVELS_OF_DEPTH \ + GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH \ + GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH \ + GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH \ + GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH + + // Clear local 16-bit accumulators + "vmov.s32 q4, #0\n" + "vmov.s32 q5, q4\n" + "vmov.s32 q6, q4\n" + "vmov.s32 q7, q4\n" + "vmov.s32 q8, q4\n" + "vmov.s32 q9, q4\n" + "vmov.s32 q10, q4\n" + "vmov.s32 q11, q4\n" + "vmov.s32 q12, q4\n" + "vmov.s32 q13, q4\n" + "vmov.s32 q14, q4\n" + "vmov.s32 q15, q4\n" + + // Select a suitable number of depth levels + // to process at this iteration. TODO (benoitjacob) I guess that + // someone who really knows asm should make this a jump table. + "cmp %[run_depth], #32\n" + "bge " GEMMLOWP_LABEL_32 + "f\n" + "cmp %[run_depth], #24\n" + "bge " GEMMLOWP_LABEL_24 + "f\n" + "cmp %[run_depth], #16\n" + "bge " GEMMLOWP_LABEL_16 + "f\n" + "cmp %[run_depth], #8\n" + "bge " GEMMLOWP_LABEL_8 + "f\n" + "b " GEMMLOWP_LABEL_2 "f\n" + + GEMMLOWP_LABEL_32 + ":\n" GEMMLOWP_ACCUMULATE_8_LEVELS_OF_DEPTH GEMMLOWP_LABEL_24 + ":\n" GEMMLOWP_ACCUMULATE_8_LEVELS_OF_DEPTH GEMMLOWP_LABEL_16 + ":\n" GEMMLOWP_ACCUMULATE_8_LEVELS_OF_DEPTH GEMMLOWP_LABEL_8 + ":\n" GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH + GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH + GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH GEMMLOWP_LABEL_2 + ":\n" GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH + + // Accumulate the local accumulators into the global accumulators. + // This is about summing adjacent pairs of 16-bit scalars into + // single 32-bit scalars, so we use pairwise long addition (vpadal). + "mov r0, %[global_accumulators]\n" + "mov r1, %[global_accumulators]\n" + "vld1.32 {d0,d1,d2,d3}, [r0]!\n" + "vld1.32 {d4,d5,d6,d7}, [r0]!\n" + "vpadal.u16 q0, q4\n" + "vpadal.u16 q1, q5\n" + "vpadal.u16 q2, q6\n" + "vpadal.u16 q3, q7\n" + "vst1.32 {d0,d1,d2,d3}, [r1]!\n" + "vst1.32 {d4,d5,d6,d7}, [r1]!\n" + "vld1.32 {d0,d1,d2,d3}, [r0]!\n" + "vld1.32 {d4,d5,d6,d7}, [r0]!\n" + "vpadal.u16 q0, q8\n" + "vpadal.u16 q1, q9\n" + "vpadal.u16 q2, q10\n" + "vpadal.u16 q3, q11\n" + "vst1.32 {d0,d1,d2,d3}, [r1]!\n" + "vst1.32 {d4,d5,d6,d7}, [r1]!\n" + "vld1.32 {d0,d1,d2,d3}, [r0]!\n" + "vld1.32 {d4,d5,d6,d7}, [r0]!\n" + "vpadal.u16 q0, q12\n" + "vpadal.u16 q1, q13\n" + "vpadal.u16 q2, q14\n" + "vpadal.u16 q3, q15\n" + "vst1.32 {d0,d1,d2,d3}, [r1]!\n" + "vst1.32 {d4,d5,d6,d7}, [r1]!\n" + + // Loop. + "cmp %[run_depth], #0\n" + "bne " GEMMLOWP_LOOP_NEON_32_KERNEL_12X4_DEPTH2_ASSUMING_12BIT_PRODUCTS + "b\n" + +#undef GEMMLOWP_CLEAR_LOCAL_ACCUMULATORS +#undef GEMMLOWP_ACCUMULATE_8_LEVELS_OF_DEPTH +#undef GEMMLOWP_ACCUMULATE_2_LEVELS_OF_DEPTH +#undef GEMMLOWP_ADD_TO_GLOBAL_ACCUMULATORS + + /* end of main loop */ + + // Store the global accumulators to the destination matrix + // (column-major) + // This is the reverse of the steps that we followed at the beginning + // when we load the global accumulators from the destination matrix. + // The problem is the same: how to convert 4x4 blocks + // between column-major and diagonal-major orders. + // Like above, we do this by rotating rows, and we achieve that by + // tranposing, rotating columns, and transposing again. + // + // Load and transpose 4x4 blocks of global accumulators + // These two steps are done at once by the vld4 instruction. + "mov r0, %[global_accumulators]\n" + "vld4.32 {d0,d2,d4,d6}, [r0]!\n" + "vld4.32 {d1,d3,d5,d7}, [r0]!\n" + "vld4.32 {d8,d10,d12,d14}, [r0]!\n" + "vld4.32 {d9,d11,d13,d15}, [r0]!\n" + "vld4.32 {d16,d18,d20,d22}, [r0]!\n" + "vld4.32 {d17,d19,d21,d23}, [r0]!\n" + // Rotate the rows of each 4x4 block + "vext.32 q1, q1, q1, #3\n" + "vext.32 q2, q2, q2, #2\n" + "vext.32 q3, q3, q3, #1\n" + "vext.32 q5, q5, q5, #3\n" + "vext.32 q6, q6, q6, #2\n" + "vext.32 q7, q7, q7, #1\n" + "vext.32 q9, q9, q9, #3\n" + "vext.32 q10, q10, q10, #2\n" + "vext.32 q11, q11, q11, #1\n" + // Transpose again each 4x4 block + "vtrn.32 q0, q1\n" + "vtrn.32 q2, q3\n" + "vswp d1, d4\n" + "vswp d3, d6\n" + "vtrn.32 q4, q5\n" + "vtrn.32 q6, q7\n" + "vswp d9, d12\n" + "vswp d11, d14\n" + "vtrn.32 q8, q9\n" + "vtrn.32 q10, q11\n" + "vswp d17, d20\n" + "vswp d19, d22\n" + // Store into the column-major destination matrix + "mov r1, %[dst_ptr]\n" + "mov r0, %[dst_col_stride]\n" + "sub r0, #32\n" + "vst1.32 {d0,d1}, [r1]!\n" + "vst1.32 {d8,d9}, [r1]!\n" + "vst1.32 {d16,d17}, [r1], r0\n" + "vst1.32 {d2,d3}, [r1]!\n" + "vst1.32 {d10,d11}, [r1]!\n" + "vst1.32 {d18,d19}, [r1], r0\n" + "vst1.32 {d4,d5}, [r1]!\n" + "vst1.32 {d12,d13}, [r1]!\n" + "vst1.32 {d20,d21}, [r1], r0\n" + "vst1.32 {d6,d7}, [r1]!\n" + "vst1.32 {d14,d15}, [r1]!\n" + "vst1.32 {d22,d23}, [r1], r0\n" + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [dst_ptr] "+r"(dst_ptr), + [run_depth] "+r"(run_depth) + : // inputs + [start_depth] "r"(start_depth), [dst_col_stride] "r"(dst_col_stride), + [global_accumulators] "r"(&global_accumulators[0]) + : // clobbers + "cc", "memory", "r0", "r1", + // note: someone on internet says that quad registers are + // unsupported in the clobber list! + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", + "d31"); +#undef GEMMLOWP_LOOP_NEON_32_KERNEL_12X4_DEPTH2_ASSUMING_12BIT_PRODUCTS +#undef GEMMLOWP_LOAD_GLOBAL_ACCUMULATORS_NEON_32_KERNEL_12X4_DEPTH2_12BIT +#undef GEMMLOWP_LABEL_32 +#undef GEMMLOWP_LABEL_24 +#undef GEMMLOWP_LABEL_16 +#undef GEMMLOWP_LABEL_8 +#undef GEMMLOWP_LABEL_2 + } +}; + +struct NEON_32bit_GEMM_Int8Operands_LhsNonzero : KernelBase { + typedef KernelFormat< + KernelSideFormatInt8, 1>, + KernelSideFormatInt8, 1> > + Format; + const char* Name() const override { + return "NEON, 4x2, depth 16, accumulating two within signed int16"; + } + + // TODO(benoitjacob): reorder function arguments so dst comes last + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + (void)dst_row_stride; +#define GEMMLOWP_LABEL_AFTER_LOOP "1" +#define GEMMLOWP_LABEL_LOOP "2" +#define GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES "3" +#define GEMMLOWP_LABEL_STORE "4" + asm volatile( + // Multiply dst_col_stride by 4 == sizeof(int32) to use + // it as a byte offset below. + "lsl %[dst_col_stride], %[dst_col_stride], #2\n" + + // Overview of register layout: + // + // A 2x16 block of Rhs is stored in 8 bit in d0--d3. + // A 4x16 block of Lhs is stored in 8 bit in d4--d7. That is only + // half of the register space required, so we loop over these registers + // twice. Only half of it, a 2x16 block, is stored in d4--d7 at + // any given time. + // + // A 4x2 block of accumulators is stored in q8--q15 (as 4x32 bit + // components which need to be horizontally-added at the end) + // + // The Lhs vectors are multiplied by the Rhs vectors with a widening + // multiply over the 8 first levels of depth, producing int16x8 + // vectors of products for each position in the accumulator matrix. + // Here comes the special trick: since the operands are signed int8, + // their range being [ -2^7 , 2^7 ), their products are in range + // [ -2^14 , 2^14 - 1 ), meaning that we can add two such values + // without any risk of overflowing int16. + // We thus proceed with the 8 next levels of depth, multiplying + // again Lhs by Rhs, accumulating into this existing int16x8 vector. + // + // Only then, having processed 16 levels of depth, do we need to + // horizontally add these int16x8 accumulators into the final + // int32x4 accumulators. + // + // As we do not have enough registers to store all 16 int16x8 + // temporary-16bit-accumulators, we have them cycle through q4--q7. + // + // + // Register layout (ignoring the q4--q7 temporary 16bit accumulators): + // + // +----+----+ + // | d0 | d2 | + // | . | . | + // | . | . | + // | . | . | + // Rhs +----+----+ + // | d1 | d3 | + // | . | . | + // | . | . | + // | . | . | + // +----+----+ + // + // | | | + // + // Lhs | | | + // + // +--------+--------+ - - - - +----+----+ + // | d4 ... | d5 ... | | q8 | q9 | + // | d6 ... | d7 ... | | q10| q11| + // | d4 ... | d5 ... | | q12| q13| + // | d6 ... | d7 ... | | q14| q15| + // +--------+--------+ - - - - +----+----+ + // + // Accumulator + // + + // Clear accumulators, and, interleaved with it, + // initial loads of the first loop iteration, + // taken out of the loop so that in the loop itself we have + // optimal streaming of data from memory. + "vldr d0, [%[rhs_ptr], #0]\n" + "vmov.i32 q8, #0\n" + "vldr d4, [%[lhs_ptr], #0]\n" + "vmov.i32 q9, #0\n" + "vldr d2, [%[rhs_ptr], #16]\n" + "vmov.i32 q10, q8\n" + "vldr d6, [%[lhs_ptr], #16]\n" + "vmov.i32 q11, q8\n" + "vldr d1, [%[rhs_ptr], #8]\n" + "vmov.i32 q12, q8\n" + "vldr d5, [%[lhs_ptr], #8]\n" + "vmov.i32 q13, q8\n" + "vldr d3, [%[rhs_ptr], #24]\n" + "vmov.i32 q14, q8\n" + "vldr d7, [%[lhs_ptr], #24]\n" + "vmov.i32 q15, q8\n" + + // General loop. + GEMMLOWP_LABEL_LOOP + ":\n" + + // Multiply 8 first levels of depth. + "vmull.s8 q4, d0, d4\n" + "add %[rhs_ptr], %[rhs_ptr], #32\n" + "vmull.s8 q5, d2, d4\n" + "vldr d4, [%[lhs_ptr], #32]\n" + "vmull.s8 q6, d0, d6\n" + "vmull.s8 q7, d2, d6\n" + "vldr d6, [%[lhs_ptr], #48]\n" + + // Multiply-accumulate second-half, again into the same + // 16bit local accumulator registers. This is where we + // take advantage of having int8 instead of uint8 and therefore + // being able to accumulate two products into int16. + "vmlal.s8 q4, d1, d5\n" + "vmlal.s8 q5, d3, d5\n" + "vldr d5, [%[lhs_ptr], #40]\n" + "vmlal.s8 q6, d1, d7\n" + "vmlal.s8 q7, d3, d7\n" + "vldr d7, [%[lhs_ptr], #56]\n" + + // Add pairwise, accumulate into 32-bit accumulators. + "vpadal.s16 q8, q4\n" + "add %[lhs_ptr], %[lhs_ptr], #64\n" + "vpadal.s16 q9, q5\n" + "subs %[run_depth], %[run_depth], #16\n" + "vpadal.s16 q10, q6\n" + "vpadal.s16 q11, q7\n" + + "beq " GEMMLOWP_LABEL_AFTER_LOOP + "f\n" + + // Multiply first half. + "vmull.s8 q4, d0, d4\n" + "vmull.s8 q5, d2, d4\n" + "vldr d4, [%[lhs_ptr], #0]\n" + "vmull.s8 q6, d0, d6\n" + "vldr d0, [%[rhs_ptr], #0]\n" + "vmull.s8 q7, d2, d6\n" + "vldr d2, [%[rhs_ptr], #16]\n" + + // Multiply-accumulate second-half, again into the same + // 16bit local accumulator registers. This is where we + // take advantage of having int8 instead of uint8 and therefore + // being able to accumulate two products into int16. + "vmlal.s8 q4, d1, d5\n" + "vldr d6, [%[lhs_ptr], #16]\n" + "vmlal.s8 q5, d3, d5\n" + "vldr d5, [%[lhs_ptr], #8]\n" + "vmlal.s8 q6, d1, d7\n" + "vldr d1, [%[rhs_ptr], #8]\n" + "vmlal.s8 q7, d3, d7\n" + "vldr d3, [%[rhs_ptr], #24]\n" + + // Add pairwise, accumulate into 32-bit accumulators. + "vpadal.s16 q12, q4\n" + "vldr d7, [%[lhs_ptr], #24]\n" + "vpadal.s16 q13, q5\n" + "vpadal.s16 q14, q6\n" + "vpadal.s16 q15, q7\n" + + "b " GEMMLOWP_LABEL_LOOP "b\n" + + GEMMLOWP_LABEL_AFTER_LOOP + ":\n" + + // Multiply first half. + "vmull.s8 q4, d0, d4\n" + "vmull.s8 q5, d2, d4\n" + "vmull.s8 q6, d0, d6\n" + "vmull.s8 q7, d2, d6\n" + + // Multiply-accumulate second-half, again into the same + // 16bit local accumulator registers. This is where we + // take advantage of having int8 instead of uint8 and therefore + // being able to accumulate two products into int16. + "vmlal.s8 q4, d1, d5\n" + "vmlal.s8 q5, d3, d5\n" + "vmlal.s8 q6, d1, d7\n" + "vmlal.s8 q7, d3, d7\n" + + // Add pairwise, accumulate into 32-bit accumulators. + "vpadal.s16 q12, q4\n" + "vpadal.s16 q13, q5\n" + "vpadal.s16 q14, q6\n" + "vpadal.s16 q15, q7\n" + "cmp %[start_depth], #0\n" + + // Reduce 32bit accumulators horizontally. + "vpadd.s32 d0, d16, d17\n" + "vpadd.s32 d1, d18, d19\n" + "vpadd.s32 d2, d20, d21\n" + "vpadd.s32 d3, d22, d23\n" + "vpadd.s32 d4, d24, d25\n" + "vpadd.s32 d5, d26, d27\n" + "vpadd.s32 d6, d28, d29\n" + "vpadd.s32 d7, d30, d31\n" + + "bne " GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES + "f\n" + + // Reduce 32bit accumulators horizontally, second pass + // (each pass adds pairwise. we need to add 4-wise). + "vpadd.s32 d8, d0, d2\n" + "vpadd.s32 d9, d4, d6\n" + "vpadd.s32 d10, d1, d3\n" + "vpadd.s32 d11, d5, d7\n" + + "b " GEMMLOWP_LABEL_STORE "f\n" + + GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES + ":\n" + + // Reduce 32bit accumulators horizontally, second pass + // (each pass adds pairwise. we need to add 4-wise), + // and load destination values from memory. + "mov r0, %[dst_ptr]\n" + "vld1.32 {d16, d17}, [r0], %[dst_col_stride]\n" + "vpadd.s32 d8, d0, d2\n" + "vpadd.s32 d9, d4, d6\n" + "vld1.32 {d18, d19}, [r0]\n" + "vpadd.s32 d10, d1, d3\n" + "vpadd.s32 d11, d5, d7\n" + + // Add horizontally-reduced accumulators into + // the values loaded from memory + "vadd.s32 q4, q8, q4\n" + "vadd.s32 q5, q9, q5\n" + + GEMMLOWP_LABEL_STORE + ":\n" + // Store back into memory + "mov r0, %[dst_ptr]\n" + "vst1.32 {d8, d9}, [r0], %[dst_col_stride]\n" + "vst1.32 {d10, d11}, [r0]\n" + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [dst_ptr] "+r"(dst_ptr), [run_depth] "+r"(run_depth) + : // inputs + [start_depth] "r"(start_depth), + [dst_col_stride] "r"(dst_col_stride) + : // clobbers + "cc", "memory", "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", + "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", + "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", + "d28", "d29", "d30", "d31"); +#undef GEMMLOWP_LABEL_LOOP +#undef GEMMLOWP_LABEL_AFTER_LOOP +#undef GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES +#undef GEMMLOWP_LABEL_STORE + } +}; + +// Same as NEON_32bit_GEMM_Int8Operands_LhsNonzero, but uses a side format that +// requires that user inputs were originally int8. This avoids the uint8->int8 +// conversion in the pack step. +struct NEON_32bit_GEMM_Int8Operands_LhsNonzero_Int8Inputs + : NEON_32bit_GEMM_Int8Operands_LhsNonzero { + typedef KernelFormat< + KernelSideFormatInt8Inputs, 1>, + KernelSideFormatInt8Inputs, 1> > + Format; +}; + +#endif // GEMMLOWP_NEON_32 + +// The kernels here are specifically arm 64bit assembly, not arm 32bit. +#ifdef GEMMLOWP_NEON_64 + +struct NEON_64bit_GEMM_Int8Operands_LhsNonzero : KernelBase { + typedef KernelFormat< + KernelSideFormatInt8, 1>, + KernelSideFormatInt8, 1> > + Format; + const char* Name() const override { + return "NEON, 4x4, depth 16, accumulating two within signed int16"; + } + + // TODO(benoitjacob): reorder function arguments so dst comes last + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + (void)dst_row_stride; +#define GEMMLOWP_LABEL_AFTER_LOOP_LAST16 "1" +#define GEMMLOWP_LABEL_LOOP "2" +#define GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES "3" +#define GEMMLOWP_LABEL_STORE "4" + asm volatile( + // Clear accumulators, and, interleaved with it, + // initial loads of the first loop iteration, + // taken out of the loop so that in the loop itself we have + // optimal streaming of data from memory. + "ld1 {v0.16b}, [%[rhs_ptr]], #16\n" + "dup v16.4s, wzr\n" + "ld1 {v4.16b}, [%[lhs_ptr]], #16\n" + "dup v17.4s, wzr\n" + "ld1 {v1.16b}, [%[rhs_ptr]], #16\n" + "dup v18.4s, wzr\n" + "ld1 {v5.16b}, [%[lhs_ptr]], #16\n" + "dup v19.4s, wzr\n" + "ld1 {v2.16b}, [%[rhs_ptr]], #16\n" + "dup v20.4s, wzr\n" + "ld1 {v3.16b}, [%[rhs_ptr]], #16\n" + "dup v21.4s, wzr\n" + "ld1 {v6.16b}, [%[lhs_ptr]], #16\n" + "dup v22.4s, wzr\n" + "ld1 {v7.16b}, [%[lhs_ptr]], #16\n" + "dup v23.4s, wzr\n" + "dup v24.4s, wzr\n" + "dup v25.4s, wzr\n" + "dup v26.4s, wzr\n" + "dup v27.4s, wzr\n" + "dup v28.4s, wzr\n" + "dup v29.4s, wzr\n" + "dup v30.4s, wzr\n" + "dup v31.4s, wzr\n" + + // Multiply dst_col_stride by 4 == sizeof(int32) to use + // it as a byte offset below. + "lsl %[dst_col_stride], %[dst_col_stride], #2\n" + + // Initial arithmetic of the first loop iteration, + // taken out of the loop so that in the loop itself we have + // optimal streaming of data from memory. + "smull v8.8h, v0.8b, v4.8b\n" + "smull v9.8h, v1.8b, v4.8b\n" + "smull v10.8h, v2.8b, v4.8b\n" + "smull v11.8h, v3.8b, v4.8b\n" + "smull v12.8h, v0.8b, v5.8b\n" + "smull v13.8h, v1.8b, v5.8b\n" + "smull v14.8h, v2.8b, v5.8b\n" + "smull v15.8h, v3.8b, v5.8b\n" + + // Multiply-accumulate second-half, again into the same + // 16bit local accumulator registers. This is where we + // take advantage of having int8 instead of uint8 and therefore + // being able to accumulate two products into int16. + "smlal2 v8.8h, v0.16b, v4.16b\n" + "smlal2 v9.8h, v1.16b, v4.16b\n" + "smlal2 v10.8h, v2.16b, v4.16b\n" + "smlal2 v11.8h, v3.16b, v4.16b\n" + "smlal2 v12.8h, v0.16b, v5.16b\n" + "smlal2 v13.8h, v1.16b, v5.16b\n" + "smlal2 v14.8h, v2.16b, v5.16b\n" + "smlal2 v15.8h, v3.16b, v5.16b\n" + + "subs %[run_depth], %[run_depth], #16\n" + + // If the loop depth is only 16, then we can skip the general loop + // and go straight to the final part of the code. + "beq " GEMMLOWP_LABEL_AFTER_LOOP_LAST16 "f\n" + + // General loop. + GEMMLOWP_LABEL_LOOP + ":\n" + + // Overview of register layout: + // + // A 4x16 block of Rhs is stored in 8 bit in v0--v3. + // A 4x16 block of Lhs is stored in 8 bit in v4--v7. + // + // A 4x4 block of accumulators is stored in v16-v31 (as 4x32 bit + // components which need to be horizontally-added at the end) + // + // The Lhs vectors are multiplied by the Rhs vectors with a widening + // multiply over the 8 first levels of depth, producing int16x8 + // vectors of products for each position in the accumulator matrix. + // Here comes the special trick: since the operands are signed int8, + // their range being [ -2^7 , 2^7 ), their products are in range + // [ -2^14 , 2^14 - 1 ), meaning that we can add two such values + // without any risk of overflowing int16. + // We thus proceed with the 8 next levels of depth, multiplying + // again Lhs by Rhs, accumulating into this existing int16x8 vector. + // + // Only then, having processed 16 levels of depth, do we need to + // horizontally add these int16x8 accumulators into the final + // int32x4 accumulators. + // + // As we do not have enough registers to store all 16 int16x8 + // temporary-16bit-accumulators, we have them cycle through v8--v15. + // + // + // Register layout (ignoring the v8--v15 temporary 16bit accumulators): + // + // +--------+--------+--------+--------+ + // |v0.b[0] |v1.b[0] |v2.b[0] |v3.b[0] | + // Rhs +--------+--------+--------+--------+ + // | ... | ... | ... | ... | + // +--------+--------+--------+--------| + // |v0.b[15]|v1.b[15]|v2.b[15]|v3.b[15]| + // +--------+--------+--------+--------+ + // + // | | | | | + // + // Lhs | | | | | + // + // +-------+-----+--------+ - - +--------+--------+--------+--------+ + // |v4.b[0]| ... |v4.b[15]| | v16.4s | v17.4s | v18.4s | v19.4s | + // |v5.b[0]| ... |v5.b[15]| | v20.4s | v21.4s | v22.4s | v23.4s | + // |v6.b[0]| ... |v6.b[15]| | v24.4s | v25.4s | v26.4s | v27.4s | + // |v7.b[0]| ... |v7.b[15]| | v28.4s | v29.4s | v30.4s | v31.4s | + // +-------+--------------+ - - +--------+--------+--------+--------+ + // + // Accumulator + // + + // Some multiplications and 16-bit accumulation were already done above, + // so we start right away in the middle. + "sadalp v16.4s, v8.8h\n" + "ld1 {v4.16b}, [%[lhs_ptr]], #16\n" + "smull v8.8h, v0.8b, v6.8b\n" + "sadalp v17.4s, v9.8h\n" + "ld1 {v5.16b}, [%[lhs_ptr]], #16\n" + "smull v9.8h, v1.8b, v6.8b\n" + "sadalp v18.4s, v10.8h\n" + "smull v10.8h, v2.8b, v6.8b\n" + "sadalp v19.4s, v11.8h\n" + "smull v11.8h, v3.8b, v6.8b\n" + "sadalp v20.4s, v12.8h\n" + "smull v12.8h, v0.8b, v7.8b\n" + "sadalp v21.4s, v13.8h\n" + "smull v13.8h, v1.8b, v7.8b\n" + "sadalp v22.4s, v14.8h\n" + "smull v14.8h, v2.8b, v7.8b\n" + "sadalp v23.4s, v15.8h\n" + "smull v15.8h, v3.8b, v7.8b\n" + + // Multiply-accumulate second-half, again into the same + // 16bit local accumulator registers. This is where we + // take advantage of having int8 instead of uint8 and therefore + // being able to accumulate two products into int16. + "smlal2 v8.8h, v0.16b, v6.16b\n" + "smlal2 v9.8h, v1.16b, v6.16b\n" + "smlal2 v10.8h, v2.16b, v6.16b\n" + "smlal2 v11.8h, v3.16b, v6.16b\n" + + "ld1 {v6.16b}, [%[lhs_ptr]], #16\n" + + "smlal2 v12.8h, v0.16b, v7.16b\n" + "ld1 {v0.16b}, [%[rhs_ptr]], #16\n" + "smlal2 v13.8h, v1.16b, v7.16b\n" + "ld1 {v1.16b}, [%[rhs_ptr]], #16\n" + "smlal2 v14.8h, v2.16b, v7.16b\n" + "ld1 {v2.16b}, [%[rhs_ptr]], #16\n" + "smlal2 v15.8h, v3.16b, v7.16b\n" + "ld1 {v3.16b}, [%[rhs_ptr]], #16\n" + + "sadalp v24.4s, v8.8h\n" + "smull v8.8h, v0.8b, v4.8b\n" + "sadalp v25.4s, v9.8h\n" + "ld1 {v7.16b}, [%[lhs_ptr]], #16\n" + "smull v9.8h, v1.8b, v4.8b\n" + "sadalp v26.4s, v10.8h\n" + "smull v10.8h, v2.8b, v4.8b\n" + "sadalp v27.4s, v11.8h\n" + "smull v11.8h, v3.8b, v4.8b\n" + "sadalp v28.4s, v12.8h\n" + "smull v12.8h, v0.8b, v5.8b\n" + "sadalp v29.4s, v13.8h\n" + "smull v13.8h, v1.8b, v5.8b\n" + "sadalp v30.4s, v14.8h\n" + "smull v14.8h, v2.8b, v5.8b\n" + "sadalp v31.4s, v15.8h\n" + "smull v15.8h, v3.8b, v5.8b\n" + + // Multiply-accumulate second-half, again into the same + // 16bit local accumulator registers. This is where we + // take advantage of having int8 instead of uint8 and therefore + // being able to accumulate two products into int16. + "smlal2 v8.8h, v0.16b, v4.16b\n" + "smlal2 v9.8h, v1.16b, v4.16b\n" + "smlal2 v10.8h, v2.16b, v4.16b\n" + "smlal2 v11.8h, v3.16b, v4.16b\n" + + // Loop. Decrement loop index (depth) by 16, since we just handled + // 16 levels of depth. Do this subs a bit before the end of the loop + // for better dispatch on A57. + "subs %[run_depth], %[run_depth], #16\n" + + "smlal2 v12.8h, v0.16b, v5.16b\n" + "smlal2 v13.8h, v1.16b, v5.16b\n" + "smlal2 v14.8h, v2.16b, v5.16b\n" + "smlal2 v15.8h, v3.16b, v5.16b\n" + + "bne " GEMMLOWP_LABEL_LOOP "b\n" + + // Final code for the last 16 levels of depth. + // There is nothing to load anymore, only some arithmetic to finish. + GEMMLOWP_LABEL_AFTER_LOOP_LAST16 + ":\n" + + // Some multiplications and 16-bit accumulation were already done above, + // so we start right away in the middle. + "sadalp v16.4s, v8.8h\n" + "smull v8.8h, v0.8b, v6.8b\n" + "sadalp v17.4s, v9.8h\n" + "smull v9.8h, v1.8b, v6.8b\n" + "sadalp v18.4s, v10.8h\n" + "smull v10.8h, v2.8b, v6.8b\n" + "sadalp v19.4s, v11.8h\n" + "smull v11.8h, v3.8b, v6.8b\n" + "sadalp v20.4s, v12.8h\n" + "smull v12.8h, v0.8b, v7.8b\n" + "sadalp v21.4s, v13.8h\n" + "smull v13.8h, v1.8b, v7.8b\n" + "sadalp v22.4s, v14.8h\n" + "smull v14.8h, v2.8b, v7.8b\n" + "sadalp v23.4s, v15.8h\n" + "smull v15.8h, v3.8b, v7.8b\n" + + // Multiply-accumulate second-half, again into the same + // 16bit local accumulator registers. This is where we + // take advantage of having int8 instead of uint8 and therefore + // being able to accumulate two products into int16. + "smlal2 v8.8h, v0.16b, v6.16b\n" + "smlal2 v9.8h, v1.16b, v6.16b\n" + "smlal2 v10.8h, v2.16b, v6.16b\n" + "smlal2 v11.8h, v3.16b, v6.16b\n" + "smlal2 v12.8h, v0.16b, v7.16b\n" + "smlal2 v13.8h, v1.16b, v7.16b\n" + "smlal2 v14.8h, v2.16b, v7.16b\n" + "smlal2 v15.8h, v3.16b, v7.16b\n" + + "sadalp v24.4s, v8.8h\n" + "sadalp v25.4s, v9.8h\n" + "sadalp v26.4s, v10.8h\n" + "sadalp v27.4s, v11.8h\n" + "sadalp v28.4s, v12.8h\n" + "sadalp v29.4s, v13.8h\n" + "sadalp v30.4s, v14.8h\n" + "sadalp v31.4s, v15.8h\n" + + // Reduce 32bit accumulators horizontally. + "addp v0.4s, v16.4s, v20.4s\n" + "addp v2.4s, v17.4s, v21.4s\n" + "addp v4.4s, v18.4s, v22.4s\n" + "addp v6.4s, v19.4s, v23.4s\n" + "addp v1.4s, v24.4s, v28.4s\n" + "addp v3.4s, v25.4s, v29.4s\n" + "addp v5.4s, v26.4s, v30.4s\n" + "addp v7.4s, v27.4s, v31.4s\n" + + "cmp %[start_depth], #0\n" + "bne " GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES + "f\n" + + // Reduce 32bit accumulators horizontally, second pass + // (each pass adds pairwise. we need to add 4-wise). + "addp v12.4s, v0.4s, v1.4s\n" + "addp v13.4s, v2.4s, v3.4s\n" + "addp v14.4s, v4.4s, v5.4s\n" + "addp v15.4s, v6.4s, v7.4s\n" + + "b " GEMMLOWP_LABEL_STORE "f\n" + + GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES + ":\n" + + // Reduce 32bit accumulators horizontally, second pass + // (each pass adds pairwise. we need to add 4-wise), + // and load destination values from memory. + "mov x0, %[dst_ptr]\n" + "ld1 {v12.16b}, [x0], %[dst_col_stride]\n" + "addp v8.4s, v0.4s, v1.4s\n" + "ld1 {v13.16b}, [x0], %[dst_col_stride]\n" + "addp v9.4s, v2.4s, v3.4s\n" + "ld1 {v14.16b}, [x0], %[dst_col_stride]\n" + "addp v10.4s, v4.4s, v5.4s\n" + "ld1 {v15.16b}, [x0]\n" + "addp v11.4s, v6.4s, v7.4s\n" + + // Add horizontally-reduced accumulators into + // the values loaded from memory + "add v12.4s, v12.4s, v8.4s\n" + "add v13.4s, v13.4s, v9.4s\n" + "add v14.4s, v14.4s, v10.4s\n" + "add v15.4s, v15.4s, v11.4s\n" + + GEMMLOWP_LABEL_STORE + ":\n" + // Store back into memory + "mov x0, %[dst_ptr]\n" + "st1 {v12.16b}, [x0], %[dst_col_stride]\n" + "st1 {v13.16b}, [x0], %[dst_col_stride]\n" + "st1 {v14.16b}, [x0], %[dst_col_stride]\n" + "st1 {v15.16b}, [x0]\n" + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [dst_ptr] "+r"(dst_ptr), [run_depth] "+r"(run_depth), + [dst_col_stride] "+r"(dst_col_stride) + : // inputs + [start_depth] "r"(start_depth) + : // clobbers + "cc", "memory", "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", + "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", + "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", + "v28", "v29", "v30", "v31"); +#undef GEMMLOWP_LABEL_LOOP +#undef GEMMLOWP_LABEL_AFTER_LOOP_LAST16 +#undef GEMMLOWP_LABEL_ACCUMULATE_EXISTING_DST_VALUES +#undef GEMMLOWP_LABEL_STORE + } +}; + +// Same as NEON_32bit_GEMM_Int8Operands_LhsNonzero, but uses a side format that +// requires that user inputs were originally int8. This avoids the uint8->int8 +// conversion in the pack step. +struct NEON_64bit_GEMM_Int8Operands_LhsNonzero_Int8Inputs + : NEON_64bit_GEMM_Int8Operands_LhsNonzero { + typedef KernelFormat< + KernelSideFormatInt8Inputs, 1>, + KernelSideFormatInt8Inputs, 1> > + Format; +}; + +// Our main GEMM kernel. +struct NEON_64_Kernel12x8Depth2 : KernelBase { + typedef KernelFormat, 3>, + KernelSideFormat, 2> > + Format; + + const char* Name() const override { return "NEON, 12x8, depth 2"; } + + // TODO(benoitjacob): reorder function arguments so dst comes last + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + (void)dst_row_stride; + ScopedProfilingLabel label("optimized kernel (NEON 12x8)"); +// See comments above for why we need local numerical labels in our asm. +#define GEMMLOWP_LABEL_CLEAR_ACCUMULATORS "1" +#define GEMMLOWP_LABEL_BEFORE_LOOP "2" +#define GEMMLOWP_LABEL_LOOP "3" +#define GEMMLOWP_LABEL_AFTER_LOOP "4" + + assert(dst_row_stride == 1); + asm volatile( + // Load 1 Rhs cell of size 2x8 + "ld1 {v5.8b}, [%[rhs_ptr]], #8\n" + "ld1 {v6.8b}, [%[rhs_ptr]], #8\n" + + // Load 3 Lhs cells of size 4x2 each + "ld1 {v2.8b}, [%[lhs_ptr]], #8\n" + "ld1 {v3.8b}, [%[lhs_ptr]], #8\n" + "ld1 {v4.8b}, [%[lhs_ptr]], #8\n" + + // Multiply dst_col_stride by 4 == sizeof(int32) to use + // it as a byte offset below. + "lsl %[dst_col_stride], %[dst_col_stride], #2\n" + + "cmp %[start_depth], #0\n" + "beq " GEMMLOWP_LABEL_CLEAR_ACCUMULATORS + "f\n" + + // Load accumulators + "mov x1, %[dst_ptr]\n" + "mov x0, x1\n" + "ld1 {v8.16b}, [x0], #16\n" + "subs %[run_depth], %[run_depth], #2\n" + "ld1 {v16.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v24.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v9.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v17.16b}, [x0], #16\n" + "ld1 {v25.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v10.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v18.16b}, [x0], #16\n" + "ld1 {v26.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v11.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v19.16b}, [x0], #16\n" + "ld1 {v27.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v12.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v20.16b}, [x0], #16\n" + "ld1 {v28.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v13.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v21.16b}, [x0], #16\n" + "ld1 {v29.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v14.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v22.16b}, [x0], #16\n" + "ld1 {v30.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v15.16b}, [x0], #16\n" + "ld1 {v23.16b}, [x0], #16\n" + "ld1 {v31.16b}, [x0]\n" + + "b " GEMMLOWP_LABEL_BEFORE_LOOP "f\n" + + GEMMLOWP_LABEL_CLEAR_ACCUMULATORS + ":\n" + + // Clear accumulator registers (see layout below) + "dup v8.4s, wzr\n" + "subs %[run_depth], %[run_depth], #2\n" + "dup v9.4s, wzr\n" + "dup v10.4s, wzr\n" + "dup v11.4s, wzr\n" + "dup v12.4s, wzr\n" + "dup v13.4s, wzr\n" + "dup v14.4s, wzr\n" + "dup v15.4s, wzr\n" + "dup v16.4s, wzr\n" + "dup v17.4s, wzr\n" + "dup v18.4s, wzr\n" + "dup v19.4s, wzr\n" + "dup v20.4s, wzr\n" + "dup v21.4s, wzr\n" + "dup v22.4s, wzr\n" + "dup v23.4s, wzr\n" + "dup v24.4s, wzr\n" + "dup v25.4s, wzr\n" + "dup v26.4s, wzr\n" + "dup v27.4s, wzr\n" + "dup v28.4s, wzr\n" + "dup v29.4s, wzr\n" + "dup v30.4s, wzr\n" + "dup v31.4s, wzr\n" + + GEMMLOWP_LABEL_BEFORE_LOOP + ":\n" + + "beq " GEMMLOWP_LABEL_AFTER_LOOP "f\n" + + GEMMLOWP_LABEL_LOOP + ":\n" + + // Overview of register layout: + // + // A 2x8 block of 2 2x4 cells of Rhs is stored in 16bit in v0--v1. + // A 12x2 block of 3 4x2 cells Lhs is stored in 16bit in v2--v4. + // A 12x8 block of accumulators is stored in 32bit in v8--v31. + // + // +--------+--------+-----+--------+--------+ + // |v0.h[0] |v0.h[1] | ... |v1.h[2] |v1.h[3] | + // Rhs +--------+--------+-----+--------+--------+ + // |v0.h[4] |v0.h[5] | ... |v1.h[6] |v1.h[7] | + // +--------+--------+-----+--------+--------+ + // + // | | | | | | + // + // Lhs | | | | | | + // + // +-------+-------+ - - +--------+--------+-----+--------+--------+ + // |v2.h[0]|v2.h[4]| |v8.s[0] |v9.s[0] | ... |v14.s[0]|v15.s[0]| + // |v2.h[1]|v2.h[5]| |v8.s[1] |v9.s[1] | ... |v14.s[1]|v15.s[1]| + // |v2.h[2]|v2.h[6]| |v8.s[2] |v9.s[2] | ... |v14.s[2]|v15.s[2]| + // |v2.h[3]|v2.h[7]| |v8.s[3] |v9.s[3] | ... |v14.s[3]|v15.s[3]| + // +-------+-------+ - - +--------+--------+-----+--------+--------+ + // |v3.h[0]|v3.h[4]| |v16.s[0]|v17.s[0]| ... |v22.s[0]|v23.s[0]| + // |v3.h[1]|v3.h[5]| |v16.s[1]|v17.s[1]| ... |v22.s[1]|v23.s[1]| + // |v3.h[2]|v3.h[6]| |v16.s[2]|v17.s[2]| ... |v22.s[2]|v23.s[2]| + // |v3.h[3]|v3.h[7]| |v16.s[3]|v17.s[3]| ... |v22.s[3]|v23.s[3]| + // +-------+-------+ - - +--------+--------+-----+--------+--------+ + // |v4.h[0]|v4.h[4]| |v24.s[0]|v25.s[0]| ... |v30.s[0]|v31.s[0]| + // |v4.h[1]|v4.h[5]| |v24.s[1]|v25.s[1]| ... |v30.s[1]|v31.s[1]| + // |v4.h[2]|v4.h[6]| |v24.s[2]|v25.s[2]| ... |v30.s[2]|v31.s[2]| + // |v4.h[3]|v4.h[7]| |v24.s[3]|v25.s[3]| ... |v30.s[3]|v31.s[3]| + // +-------+-------+ - - +--------+--------+-----+--------+--------+ + // + // Accumulator + + // Expand Lhs/Rhs cells to 16 bit. + "uxtl v0.8h, v5.8b\n" + "ld1 {v5.8b}, [%[rhs_ptr]], #8\n" + "uxtl v1.8h, v6.8b\n" + "ld1 {v6.8b}, [%[rhs_ptr]], #8\n" + "uxtl v2.8h, v2.8b\n" + "uxtl v3.8h, v3.8b\n" + "uxtl v4.8h, v4.8b\n" + + // Multiply-accumulate, top third + "umlal v8.4s, v2.4h, v0.h[0]\n" + "umlal v9.4s, v2.4h, v0.h[1]\n" + "umlal v10.4s, v2.4h, v0.h[2]\n" + "umlal v11.4s, v2.4h, v0.h[3]\n" + "umlal v12.4s, v2.4h, v1.h[0]\n" + "umlal v13.4s, v2.4h, v1.h[1]\n" + "umlal v14.4s, v2.4h, v1.h[2]\n" + "umlal v15.4s, v2.4h, v1.h[3]\n" + "umlal2 v8.4s, v2.8h, v0.h[4]\n" + "umlal2 v9.4s, v2.8h, v0.h[5]\n" + "umlal2 v10.4s, v2.8h, v0.h[6]\n" + "umlal2 v11.4s, v2.8h, v0.h[7]\n" + "umlal2 v12.4s, v2.8h, v1.h[4]\n" + "umlal2 v13.4s, v2.8h, v1.h[5]\n" + "umlal2 v14.4s, v2.8h, v1.h[6]\n" + "umlal2 v15.4s, v2.8h, v1.h[7]\n" + "ld1 {v2.8b}, [%[lhs_ptr]], #8\n" + + // Multiply-accumulate, middle third + "umlal v16.4s, v3.4h, v0.h[0]\n" + "umlal v17.4s, v3.4h, v0.h[1]\n" + "umlal v18.4s, v3.4h, v0.h[2]\n" + "umlal v19.4s, v3.4h, v0.h[3]\n" + "umlal v20.4s, v3.4h, v1.h[0]\n" + "umlal v21.4s, v3.4h, v1.h[1]\n" + "umlal v22.4s, v3.4h, v1.h[2]\n" + "umlal v23.4s, v3.4h, v1.h[3]\n" + "umlal2 v16.4s, v3.8h, v0.h[4]\n" + "umlal2 v17.4s, v3.8h, v0.h[5]\n" + "umlal2 v18.4s, v3.8h, v0.h[6]\n" + "umlal2 v19.4s, v3.8h, v0.h[7]\n" + "umlal2 v20.4s, v3.8h, v1.h[4]\n" + "umlal2 v21.4s, v3.8h, v1.h[5]\n" + "umlal2 v22.4s, v3.8h, v1.h[6]\n" + "umlal2 v23.4s, v3.8h, v1.h[7]\n" + "ld1 {v3.8b}, [%[lhs_ptr]], #8\n" + + "subs %[run_depth], %[run_depth], #2\n" + + // Multiply-accumulate, bottom third + "umlal v24.4s, v4.4h, v0.h[0]\n" + "umlal v25.4s, v4.4h, v0.h[1]\n" + "umlal v26.4s, v4.4h, v0.h[2]\n" + "umlal v27.4s, v4.4h, v0.h[3]\n" + "umlal v28.4s, v4.4h, v1.h[0]\n" + "umlal v29.4s, v4.4h, v1.h[1]\n" + "umlal v30.4s, v4.4h, v1.h[2]\n" + "umlal v31.4s, v4.4h, v1.h[3]\n" + "umlal2 v24.4s, v4.8h, v0.h[4]\n" + "umlal2 v25.4s, v4.8h, v0.h[5]\n" + "umlal2 v26.4s, v4.8h, v0.h[6]\n" + "umlal2 v27.4s, v4.8h, v0.h[7]\n" + "umlal2 v28.4s, v4.8h, v1.h[4]\n" + "umlal2 v29.4s, v4.8h, v1.h[5]\n" + "umlal2 v30.4s, v4.8h, v1.h[6]\n" + "umlal2 v31.4s, v4.8h, v1.h[7]\n" + "ld1 {v4.8b}, [%[lhs_ptr]], #8\n" + + "bne " GEMMLOWP_LABEL_LOOP "b\n" + + GEMMLOWP_LABEL_AFTER_LOOP + ":\n" + + // Expand Lhs/Rhs cells to 16 bit. + "uxtl v0.8h, v5.8b\n" + "uxtl v1.8h, v6.8b\n" + "uxtl v2.8h, v2.8b\n" + "uxtl v3.8h, v3.8b\n" + "uxtl v4.8h, v4.8b\n" + + // Multiply-accumulate, level of depth 0 + "umlal v8.4s, v2.4h, v0.h[0]\n" + "umlal v9.4s, v2.4h, v0.h[1]\n" + "umlal v10.4s, v2.4h, v0.h[2]\n" + "umlal v11.4s, v2.4h, v0.h[3]\n" + "umlal v12.4s, v2.4h, v1.h[0]\n" + "umlal v13.4s, v2.4h, v1.h[1]\n" + "umlal v14.4s, v2.4h, v1.h[2]\n" + "umlal v15.4s, v2.4h, v1.h[3]\n" + "umlal v16.4s, v3.4h, v0.h[0]\n" + "umlal v17.4s, v3.4h, v0.h[1]\n" + "umlal v18.4s, v3.4h, v0.h[2]\n" + "umlal v19.4s, v3.4h, v0.h[3]\n" + "umlal v20.4s, v3.4h, v1.h[0]\n" + "umlal v21.4s, v3.4h, v1.h[1]\n" + "umlal v22.4s, v3.4h, v1.h[2]\n" + "umlal v23.4s, v3.4h, v1.h[3]\n" + "umlal v24.4s, v4.4h, v0.h[0]\n" + "umlal v25.4s, v4.4h, v0.h[1]\n" + "umlal v26.4s, v4.4h, v0.h[2]\n" + "umlal v27.4s, v4.4h, v0.h[3]\n" + "umlal v28.4s, v4.4h, v1.h[0]\n" + "umlal v29.4s, v4.4h, v1.h[1]\n" + "umlal v30.4s, v4.4h, v1.h[2]\n" + "umlal v31.4s, v4.4h, v1.h[3]\n" + + // Multiply-accumulate, level of depth 1 + "umlal2 v8.4s, v2.8h, v0.h[4]\n" + "umlal2 v9.4s, v2.8h, v0.h[5]\n" + "umlal2 v10.4s, v2.8h, v0.h[6]\n" + "umlal2 v11.4s, v2.8h, v0.h[7]\n" + "umlal2 v12.4s, v2.8h, v1.h[4]\n" + "umlal2 v13.4s, v2.8h, v1.h[5]\n" + "umlal2 v14.4s, v2.8h, v1.h[6]\n" + "umlal2 v15.4s, v2.8h, v1.h[7]\n" + "umlal2 v16.4s, v3.8h, v0.h[4]\n" + "umlal2 v17.4s, v3.8h, v0.h[5]\n" + "umlal2 v18.4s, v3.8h, v0.h[6]\n" + "umlal2 v19.4s, v3.8h, v0.h[7]\n" + "umlal2 v20.4s, v3.8h, v1.h[4]\n" + "umlal2 v21.4s, v3.8h, v1.h[5]\n" + "umlal2 v22.4s, v3.8h, v1.h[6]\n" + "umlal2 v23.4s, v3.8h, v1.h[7]\n" + "umlal2 v24.4s, v4.8h, v0.h[4]\n" + "umlal2 v25.4s, v4.8h, v0.h[5]\n" + "umlal2 v26.4s, v4.8h, v0.h[6]\n" + "umlal2 v27.4s, v4.8h, v0.h[7]\n" + "umlal2 v28.4s, v4.8h, v1.h[4]\n" + "umlal2 v29.4s, v4.8h, v1.h[5]\n" + "umlal2 v30.4s, v4.8h, v1.h[6]\n" + "umlal2 v31.4s, v4.8h, v1.h[7]\n" + + // Store accumulators + "mov x1, %[dst_ptr]\n" + "mov x0, x1\n" + "st1 {v8.16b}, [x0], #16\n" + "subs %[run_depth], %[run_depth], #2\n" + "st1 {v16.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v24.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v9.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v17.16b}, [x0], #16\n" + "st1 {v25.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v10.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v18.16b}, [x0], #16\n" + "st1 {v26.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v11.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v19.16b}, [x0], #16\n" + "st1 {v27.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v12.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v20.16b}, [x0], #16\n" + "st1 {v28.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v13.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v21.16b}, [x0], #16\n" + "st1 {v29.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v14.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v22.16b}, [x0], #16\n" + "st1 {v30.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v15.16b}, [x0], #16\n" + "st1 {v23.16b}, [x0], #16\n" + "st1 {v31.16b}, [x0]\n" +#undef GEMMLOWP_LABEL_CLEAR_ACCUMULATORS +#undef GEMMLOWP_LABEL_BEFORE_LOOP +#undef GEMMLOWP_LABEL_LOOP +#undef GEMMLOWP_LABEL_AFTER_LOOP + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [dst_ptr] "+r"(dst_ptr), + [run_depth] "+r"(run_depth) + : // inputs + [start_depth] "r"(start_depth), + [dst_col_stride] "r"(dst_col_stride) + : // clobbers + "cc", "memory", "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", + "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", + "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", + "v27", "v28", "v29", "v30", "v31"); + } +}; + +#ifdef GEMMLOWP_DOTPROD_KERNEL +#ifndef __ARM_FEATURE_DOTPROD +#error This kernel requires ARM dot-product instructions. Enable them by \ + adding '+dotprod' to a compiler flag, e.g. -march=armv8.2-a+dotprod . \ + Note that Clang up to version 7 fails to define the corresponding \ + preprocessor token __ARM_FEATURE_DOTPROD, so you will still have to define \ + it manually. +#endif +// Kernels utilizing the Armv8.2 Dot Product extension. +// +// The dot product instructions work by taking 4 consecutive 8-bit depth +// values from each operand, multiplying the 4 pairs together and +// accumulating all the results into the corresponding 32-bit accumulator +// lane. As such, the operation is identical to a 32-bit instruction (like +// FMLA used in SGEMM), except that 4 depth values are processed at a time +// instead of 1. + +// Thus, this first kernel is a carbon copy of +// "NEON_64bit_GEMM_Float32_WithScalar_A57" (which should provide good +// performance for most processors) below with the opcode (fmla -> udot) and +// types (float32 -> uint8/uint32) changed. +// +// A signed version of this kernel could be produced by replacing "udot" +// with "sdot" - performance should be identical to this udot kernel. +struct NEON_64_Kernel12x8Depth4_dotprod : KernelBase { + typedef KernelFormat, 3>, + KernelSideFormat, 2> > + Format; + + const char* Name() const override { return "NEON, 12x8, depth 4, dotprod"; } + + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, std::size_t dst_col_stride, + const std::uint8_t* lhs_ptr, const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t depth) const override { + (void)dst_row_stride; + ScopedProfilingLabel label("optimized kernel (NEON 12x8, depth 4, dotprod)"); +// See comments above for why we need local numerical labels in our asm. +#define GEMMLOWP_LABEL_CLEAR_ACCUMULATORS "1" +#define GEMMLOWP_LABEL_BEFORE_LOOP "2" +#define GEMMLOWP_LABEL_LOOP "3" +#define GEMMLOWP_LABEL_AFTER_LOOP "4" + + assert(dst_row_stride == 1); + asm volatile( + // Multiply dst_col_stride by 4 == sizeof(int32) to use + // it as a byte offset below. + "lsl %[dst_col_stride], %[dst_col_stride], #2\n" + + "cmp %[start_depth], #0\n" + "beq " GEMMLOWP_LABEL_CLEAR_ACCUMULATORS "f\n" + + // Load accumulators + "mov x1, %[dst_ptr]\n" + "mov x0, x1\n" + "ld1 {v8.16b}, [x0], #16\n" + "ld1 {v16.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v24.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v9.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v17.16b}, [x0], #16\n" + "ld1 {v25.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v10.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v18.16b}, [x0], #16\n" + "ld1 {v26.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v11.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v19.16b}, [x0], #16\n" + "ld1 {v27.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v12.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v20.16b}, [x0], #16\n" + "ld1 {v28.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v13.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v21.16b}, [x0], #16\n" + "ld1 {v29.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v14.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "ld1 {v22.16b}, [x0], #16\n" + "ld1 {v30.16b}, [x0]\n" + "mov x0, x1\n" + "ld1 {v15.16b}, [x0], #16\n" + "ld1 {v23.16b}, [x0], #16\n" + "ld1 {v31.16b}, [x0]\n" + + "b " GEMMLOWP_LABEL_BEFORE_LOOP "f\n" + + GEMMLOWP_LABEL_CLEAR_ACCUMULATORS ":\n" + + // Clear accumulator registers (see layout below) + "dup v8.4s, wzr\n" + "dup v9.4s, wzr\n" + "dup v10.4s, wzr\n" + "dup v11.4s, wzr\n" + "dup v12.4s, wzr\n" + "dup v13.4s, wzr\n" + "dup v14.4s, wzr\n" + "dup v15.4s, wzr\n" + "dup v16.4s, wzr\n" + "dup v17.4s, wzr\n" + "dup v18.4s, wzr\n" + "dup v19.4s, wzr\n" + "dup v20.4s, wzr\n" + "dup v21.4s, wzr\n" + "dup v22.4s, wzr\n" + "dup v23.4s, wzr\n" + "dup v24.4s, wzr\n" + "dup v25.4s, wzr\n" + "dup v26.4s, wzr\n" + "dup v27.4s, wzr\n" + "dup v28.4s, wzr\n" + "dup v29.4s, wzr\n" + "dup v30.4s, wzr\n" + "dup v31.4s, wzr\n" + + GEMMLOWP_LABEL_BEFORE_LOOP ":\n" + + "subs %w[depth], %w[depth], #4\n" + + // The start of the loop assumes first Rhs cell is already loaded, so + // do it here for first iteration. + "ld1 {v0.16b}, [%[rhs_ptr]], #16\n" + + // And the same for the first Lhs cell. + "ld1 {v2.16b}, [%[lhs_ptr]], #16\n" + + "beq " GEMMLOWP_LABEL_AFTER_LOOP "f\n" + + GEMMLOWP_LABEL_LOOP ":\n" + + // Start the MACs at the head of the loop - 1st cell from each side + // already loaded. + ".word 0x6f80e048 // udot v8.4s, v2.16b, v0.4b[0]\n" + ".word 0x6fa0e049 // udot v9.4s, v2.16b, v0.4b[1]\n" + "ld1 {v1.16b}, [%[rhs_ptr]], #16\n" // Load second Rhs cell. + ".word 0x6f80e84a // udot v10.4s, v2.16b, v0.4b[2]\n" + ".word 0x6fa0e84b // udot v11.4s, v2.16b, v0.4b[3]\n" + "ld1 {v3.16b}, [%[lhs_ptr]], #16\n" // Load second Lhs cell. + ".word 0x6f81e04c // udot v12.4s, v2.16b, v1.4b[0]\n" + ".word 0x6fa1e04d // udot v13.4s, v2.16b, v1.4b[1]\n" + "ld1 {v4.16b}, [%[lhs_ptr]], #16\n" // Load third Lhs cell. + ".word 0x6f81e84e // udot v14.4s, v2.16b, v1.4b[2]\n" + ".word 0x6fa1e84f // udot v15.4s, v2.16b, v1.4b[3]\n" + "ld1 {v2.16b}, [%[lhs_ptr]], #16\n" // Done with first Lhs cell - load + // for the next iteration early. + ".word 0x6f80e070 // udot v16.4s, v3.16b, v0.4b[0]\n" + ".word 0x6fa0e071 // udot v17.4s, v3.16b, v0.4b[1]\n" + ".word 0x6f80e872 // udot v18.4s, v3.16b, v0.4b[2]\n" + ".word 0x6fa0e873 // udot v19.4s, v3.16b, v0.4b[3]\n" + ".word 0x6f81e074 // udot v20.4s, v3.16b, v1.4b[0]\n" + ".word 0x6fa1e075 // udot v21.4s, v3.16b, v1.4b[1]\n" + ".word 0x6f81e876 // udot v22.4s, v3.16b, v1.4b[2]\n" + ".word 0x6fa1e877 // udot v23.4s, v3.16b, v1.4b[3]\n" + ".word 0x6f80e098 // udot v24.4s, v4.16b, v0.4b[0]\n" + ".word 0x6fa0e099 // udot v25.4s, v4.16b, v0.4b[1]\n" + ".word 0x6f80e89a // udot v26.4s, v4.16b, v0.4b[2]\n" + ".word 0x6fa0e89b // udot v27.4s, v4.16b, v0.4b[3]\n" + "ld1 {v0.16b}, [%[rhs_ptr]], #16\n" // Done with the first Rhs cell - + // load for the next iteration early. + ".word 0x6f81e09c // udot v28.4s, v4.16b, v1.4b[0]\n" + ".word 0x6fa1e09d // udot v29.4s, v4.16b, v1.4b[1]\n" + + // Loop. Decrement loop index (depth) by 4 as udot processes 4 + // depth values. + "subs %w[depth], %w[depth], #4\n" + ".word 0x6f81e89e // udot v30.4s, v4.16b, v1.4b[2]\n" + ".word 0x6fa1e89f // udot v31.4s, v4.16b, v1.4b[3]\n" + + "bne " GEMMLOWP_LABEL_LOOP "b\n" + + GEMMLOWP_LABEL_AFTER_LOOP ":\n" + + // Final iteration. v0 and v2 were already loaded, don't load + // them again, don't read past the end of buffers. + ".word 0x6f80e048 // udot v8.4s, v2.16b, v0.4b[0]\n" + ".word 0x6fa0e049 // udot v9.4s, v2.16b, v0.4b[1]\n" + "ld1 {v1.16b}, [%[rhs_ptr]], #16\n" // Load second Rhs cell. + ".word 0x6f80e84a // udot v10.4s, v2.16b, v0.4b[2]\n" + ".word 0x6fa0e84b // udot v11.4s, v2.16b, v0.4b[3]\n" + "ld1 {v3.16b}, [%[lhs_ptr]], #16\n" // Load second Lhs cell. + ".word 0x6f81e04c // udot v12.4s, v2.16b, v1.4b[0]\n" + ".word 0x6fa1e04d // udot v13.4s, v2.16b, v1.4b[1]\n" + "ld1 {v4.16b}, [%[lhs_ptr]], #16\n" // Load third Lhs cell. + ".word 0x6f81e84e // udot v14.4s, v2.16b, v1.4b[2]\n" + ".word 0x6fa1e84f // udot v15.4s, v2.16b, v1.4b[3]\n" + ".word 0x6f80e070 // udot v16.4s, v3.16b, v0.4b[0]\n" + ".word 0x6fa0e071 // udot v17.4s, v3.16b, v0.4b[1]\n" + ".word 0x6f80e872 // udot v18.4s, v3.16b, v0.4b[2]\n" + ".word 0x6fa0e873 // udot v19.4s, v3.16b, v0.4b[3]\n" + ".word 0x6f81e074 // udot v20.4s, v3.16b, v1.4b[0]\n" + ".word 0x6fa1e075 // udot v21.4s, v3.16b, v1.4b[1]\n" + ".word 0x6f81e876 // udot v22.4s, v3.16b, v1.4b[2]\n" + ".word 0x6fa1e877 // udot v23.4s, v3.16b, v1.4b[3]\n" + ".word 0x6f80e098 // udot v24.4s, v4.16b, v0.4b[0]\n" + ".word 0x6fa0e099 // udot v25.4s, v4.16b, v0.4b[1]\n" + ".word 0x6f80e89a // udot v26.4s, v4.16b, v0.4b[2]\n" + ".word 0x6fa0e89b // udot v27.4s, v4.16b, v0.4b[3]\n" + ".word 0x6f81e09c // udot v28.4s, v4.16b, v1.4b[0]\n" + ".word 0x6fa1e09d // udot v29.4s, v4.16b, v1.4b[1]\n" + + // Loop. Decrement loop index (depth) by 4 as udot processes 4 + // depth values. + "subs %w[depth], %w[depth], #4\n" + ".word 0x6f81e89e // udot v30.4s, v4.16b, v1.4b[2]\n" + ".word 0x6fa1e89f // udot v31.4s, v4.16b, v1.4b[3]\n" + + // Store accumulators + "mov x1, %[dst_ptr]\n" + "mov x0, x1\n" + "st1 {v8.16b}, [x0], #16\n" + "st1 {v16.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v24.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v9.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v17.16b}, [x0], #16\n" + "st1 {v25.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v10.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v18.16b}, [x0], #16\n" + "st1 {v26.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v11.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v19.16b}, [x0], #16\n" + "st1 {v27.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v12.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v20.16b}, [x0], #16\n" + "st1 {v28.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v13.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v21.16b}, [x0], #16\n" + "st1 {v29.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v14.16b}, [x0], #16\n" + "add x1, x1, %[dst_col_stride]\n" + "st1 {v22.16b}, [x0], #16\n" + "st1 {v30.16b}, [x0]\n" + "mov x0, x1\n" + "st1 {v15.16b}, [x0], #16\n" + "st1 {v23.16b}, [x0], #16\n" + "st1 {v31.16b}, [x0]\n" + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [depth] "+r"(depth) + : // inputs + [dst_ptr] "r"(dst_ptr), [dst_col_stride] "r"(dst_col_stride), [start_depth] "r"(start_depth) + : // clobbers + "cc", "memory", "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", + "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"); + } +}; +#endif // GEMMLOWP_DOTPROD_KERNEL + +#endif // GEMMLOWP_NEON_64 + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_KERNEL_NEON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_reference.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_reference.h new file mode 100644 index 0000000000000000000000000000000000000000..3458c6a992295bdea6df4e8957d005a41a0f7c57 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_reference.h @@ -0,0 +1,118 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// kernel_reference.h: a reference kernel for CPU architectures where we don't +// have optimized kernels yet. Also useful for testing, as it's templatized +// to have any arbitrary format, allowing tests to cover all sorts of corner +// cases. + +#ifndef GEMMLOWP_INTERNAL_KERNEL_REFERENCE_H_ +#define GEMMLOWP_INTERNAL_KERNEL_REFERENCE_H_ + +#include "kernel.h" + +#include +#include + +namespace gemmlowp { + +// This kernel is templatized in an arbitrary Format template parameter, +// allowing it to have any arbitrary format. +template +struct ReferenceKernel : KernelBase { + typedef tFormat Format; + + const char* Name() const override { + static char buf[256]; + snprintf(buf, sizeof(buf), + "reference(Lhs: %d cells %dx%d %s, Rhs: %d cells %dx%d %s)", + Format::Lhs::kCells, Format::Lhs::Cell::kWidth, + Format::Lhs::Cell::kDepth, + CellOrderName(Format::Lhs::Cell::kOrder), Format::Rhs::kCells, + Format::Rhs::Cell::kDepth, Format::Rhs::Cell::kWidth, + CellOrderName(Format::Rhs::Cell::kOrder)); + return buf; + } + + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + std::int32_t accumulator[Format::kRows * Format::kCols]; + memset(accumulator, 0, sizeof(accumulator)); + + const int run_depth_cells = static_cast(run_depth / Format::kDepth); + + // The outer loop is over the depth dimension. + for (int dc = 0; dc < run_depth_cells; dc++) { + // The next two loops are over cells of the Lhs (stacked vertically), + // and over cells of the Rhs (stacked horizontally). + for (int rc = 0; rc < Format::Lhs::kCells; rc++) { + const std::uint8_t* lhs_cell_ptr = + lhs_ptr + (dc * Format::Lhs::kCells + rc) * + Format::Lhs::Cell::kWidth * Format::kDepth; + for (int cc = 0; cc < Format::Rhs::kCells; cc++) { + const std::uint8_t* rhs_cell_ptr = + rhs_ptr + (dc * Format::Rhs::kCells + cc) * + Format::Rhs::Cell::kWidth * Format::kDepth; + + // Now we are inside one cell of the Lhs and inside one cell + // of the Rhs, so the remaining inner loops are just + // traditional three loops of matrix multiplication. + for (int di = 0; di < Format::kDepth; di++) { + for (int ri = 0; ri < Format::Lhs::Cell::kWidth; ri++) { + for (int ci = 0; ci < Format::Rhs::Cell::kWidth; ci++) { + const std::uint8_t* lhs_coeff_ptr = + lhs_cell_ptr + + OffsetIntoCell(ri, di); + const std::uint8_t* rhs_coeff_ptr = + rhs_cell_ptr + + OffsetIntoCell(ci, di); + std::int32_t* accumulator_coeff_ptr = + accumulator + (ri + rc * Format::Lhs::Cell::kWidth) + + (ci + cc * Format::Rhs::Cell::kWidth) * Format::kRows; + *accumulator_coeff_ptr += + std::int32_t(*lhs_coeff_ptr) * std::int32_t(*rhs_coeff_ptr); + } + } + } + } + } + } + + if (start_depth == 0) { + // start_depth == 0 means we haven't accumulated anything yet, so we need + // to overwrite the accumulator, as it hasn't been initialized to zero. + for (int r = 0; r < Format::kRows; r++) { + for (int c = 0; c < Format::kCols; c++) { + dst_ptr[r * dst_row_stride + c * dst_col_stride] = + accumulator[r + c * Format::kRows]; + } + } + } else { + // We have already accumulated stuff, so we need to continue accumulating + // instead of just overwriting. + for (int r = 0; r < Format::kRows; r++) { + for (int c = 0; c < Format::kCols; c++) { + dst_ptr[r * dst_row_stride + c * dst_col_stride] += + accumulator[r + c * Format::kRows]; + } + } + } + } +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_KERNEL_REFERENCE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_sse.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_sse.h new file mode 100644 index 0000000000000000000000000000000000000000..ba7959b9f650492da268dc4a1bd629a8c07fe4ba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/kernel_sse.h @@ -0,0 +1,519 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// kernel_SSE.h: a collection of Intel SSE optimized kernels. +// Check in kernel_default.h which one(s) are actually used by default. +// Others are mere experiments; they are still covered by tests +// in case they might be useful some day. +// + +#ifndef GEMMLOWP_INTERNAL_KERNEL_SSE_H_ +#define GEMMLOWP_INTERNAL_KERNEL_SSE_H_ + +#include "kernel.h" + +#include +#include + +namespace gemmlowp { + +#ifdef GEMMLOWP_SSE4_32 +struct SSE4_32_Kernel4x4Depth2 : KernelBase { + typedef KernelFormat< + KernelSideFormat, 1>, + KernelSideFormat, 1> > + Format; + + const char* Name() const override { return "SSE, 4x4, depth 2"; } + + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + ScopedProfilingLabel label("optimized kernel"); + assert(dst_row_stride == 1); + (void)dst_row_stride; + std::int32_t run_depth_cells = run_depth / Format::kDepth; + /* Main loop */ + + // A 2x4 cell of Rhs is stored in 16bit in xmm1 . + // A 4x2 block Lhs is stored in 16bit in xmm0. + // A 4x4 block of accumulators is stored in 32bit in xmm4--xmm7. + // + // +-------+-------+-------+-------+ + // |xmm1[0]|xmm1[2]|xmm1[4]|xmm1[6]| + // Rhs +-------+---------------+-------+ + // |xmm1[1]|xmm1[3]|xmm1[5]|xmm1[7]| + // +-------+-------+-------+-------+ + // + // | | | | | + // + // Lhs | | | | | + // + // +--+--+ - - - - +-------+-------+-------+-------+ + // |xmm0 | | xmm4 | xmm5 | xmm6 | xmm7 | + // |xmm0 | (Iter1) | xmm4 | xmm5 | xmm6 | xmm7 | + // |xmm0 | | xmm4 | xmm5 | xmm6 | xmm7 | + // |xmm0 | | xmm4 | xmm5 | xmm6 | xmm7 | + // +--+--+ - - - - +-------+-------+-------+-------+ + // + // Accumulator + + asm volatile( + + // set accumulators to zero. + "pxor %%xmm4 , %%xmm4 \n\t" + "pxor %%xmm5 , %%xmm5 \n\t" + "pxor %%xmm6 , %%xmm6 \n\t" + "pxor %%xmm7 , %%xmm7 \n\t" + + "movl %[run_depth_cells], %%eax\n\t" + "subl $2, %%eax\n\t" + "js outerLoop1%=\n\t" + + // Loop for K unrolled by 4 + "outerLoop2%=:\n\t" + + // K = 1,2 + // RHS cell to xmm1 + "pmovzxbw (%[rhs_ptr]), %%xmm1\n\t" + + // LHS cell + "pmovzxbw 0x00(%[lhs_ptr]), %%xmm0\n\t" + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm4 \n\t" + "paddd %%xmm3, %%xmm5 \n\t" + + "prefetcht0 0x80(%[lhs_ptr]) \n\t" + + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + + "prefetcht0 0x80(%[rhs_ptr]) \n\t" + + // K = 3,4 + // RHS cell to xmm1 + "pmovzxbw 0x08(%[rhs_ptr]), %%xmm1\n\t" + + "paddd %%xmm2, %%xmm6 \n\t" + "paddd %%xmm3, %%xmm7 \n\t" + + // LHS cell + "pmovzxbw 0x08(%[lhs_ptr]), %%xmm0\n\t" + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm4 \n\t" + "paddd %%xmm3, %%xmm5 \n\t" + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + + "addl $0x10, %[lhs_ptr] \n\t" + "addl $0x10, %[rhs_ptr] \n\t" + + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm3, %%xmm7 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "paddd %%xmm2, %%xmm6 \n\t" + + "subl $2, %[run_depth_cells]\n\t" + "ja outerLoop2%=\n\t" + + "movl %[run_depth_cells], %%eax\n\t" + "decl %%eax\n\t" + "js finish%=\n\t" + + // Loop for K unrolled by 2 + "outerLoop1%=:\n\t" + + // RHS cell to xmm1 + "pmovzxbw (%[rhs_ptr]), %%xmm1\n\t" + + // LHS cell + "pmovzxbw 0x00(%[lhs_ptr]), %%xmm0\n\t" + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "paddd %%xmm2, %%xmm4 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm3, %%xmm5 \n\t" + + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "paddd %%xmm2, %%xmm6 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm3, %%xmm7 \n\t" + + "addl $0x08, %[lhs_ptr]\n\t" + "addl $0x08, %[rhs_ptr]\n\t" + + "decl %[run_depth_cells]\n\t" + "jnz outerLoop1%=\n\t" + + "finish%=:\n\t" + + "movl %[dst_col_stride], %%eax\n\t" + "shll $2, %%eax\n\t" + + "movl %[start_depth], %%ecx\n\t" + "test %%ecx, %%ecx\n\t" + "jz storeDst%=\n\t" + + "leal (%%eax,%%eax,0x2), %%ecx\n\t" + "paddd 0x00(%[dst_ptr]) , %%xmm4 \n\t" + "paddd 0x00(%[dst_ptr], %%eax, 1) , %%xmm5 \n\t" + "paddd 0x00(%[dst_ptr], %%eax, 2) , %%xmm6 \n\t" + "paddd 0x00(%[dst_ptr], %%ecx, 1) , %%xmm7 \n\t" + + "storeDst%=:\n\t" + + "leal (%%eax,%%eax,0x2), %%ecx\n\t" + "movdqu %%xmm4 , 0x00(%[dst_ptr]) \n\t" + "movdqu %%xmm5 , 0x00(%[dst_ptr], %%eax, 1)\n\t" + "movdqu %%xmm6 , 0x00(%[dst_ptr], %%eax, 2)\n\t" + "movdqu %%xmm7 , 0x00(%[dst_ptr], %%ecx, 1)\n\t" + + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [dst_ptr] "+r"(dst_ptr) + : // inputs + [start_depth] "g"(start_depth), [dst_col_stride] "g"(dst_col_stride), + [run_depth_cells] "g"(run_depth_cells) + : // clobbers + "cc", "memory", "%xmm0", "%xmm1", "%xmm3", "%xmm2", "%xmm4", "%xmm5", + "%xmm6", "%xmm7", "%eax", "%ecx"); + } +}; +#endif +#ifdef GEMMLOWP_SSE4_64 +struct SSE4_64_Kernel12x4Depth2 : KernelBase { + typedef KernelFormat< + KernelSideFormat, 3>, + KernelSideFormat, 1> > + Format; + + const char* Name() const override { return "SSE, 12x4, depth 2"; } + + void Run(std::int32_t* dst_ptr, std::size_t dst_row_stride, + std::size_t dst_col_stride, const std::uint8_t* lhs_ptr, + const std::uint8_t* rhs_ptr, std::size_t start_depth, + std::size_t run_depth) const override { + ScopedProfilingLabel label("optimized kernel"); + assert(dst_row_stride == 1); + (void)dst_row_stride; + const std::int64_t run_depth_cells = run_depth / Format::kDepth; + const std::int64_t dst_col_stride_q = dst_col_stride; + + /* Main loop */ + + // A 2x4 cell of Rhs is stored in 16bit in xmm1 . + // A 12x2 block of 3 4x2 cells Lhs is stored in 16bit in xmm0, replaced + // every Iteration. + // A 12x4 block of accumulators is stored in 32bit in xmm4--xmm15. + // + // +-------+-------+-------+-------+ + // |xmm1[0]|xmm1[2]|xmm1[4]|xmm1[6]| + // Rhs +-------+---------------+-------+ + // |xmm1[1]|xmm1[3]|xmm1[5]|xmm1[7]| + // +-------+-------+-------+-------+ + // + // | | | | | + // + // Lhs | | | | | + // + // +--+--+ - - - - +-------+-------+-------+-------+ + // |xmm0 | | xmm4 | xmm5 | xmm6 | xmm7 | + // |xmm0 | (Iter1) | xmm4 | xmm5 | xmm6 | xmm7 | + // |xmm0 | | xmm4 | xmm5 | xmm6 | xmm7 | + // |xmm0 | | xmm4 | xmm5 | xmm6 | xmm7 | + // +--+--+ - - - - +-------+-------+-------+-------+ + // |xmm0 | | xmm8 | xmm9 | xmm10 | xmm11 | + // |xmm0 | (Iter2) | xmm8 | xmm9 | xmm10 | xmm11 | + // |xmm0 | | xmm8 | xmm9 | xmm10 | xmm11 | + // |xmm0 | | xmm8 | xmm9 | xmm10 | xmm11 | + // +--+--+ - - - - +-------+-------+-------+-------+ + // |xmm0 | | xmm12 | xmm13 | xmm14 | xmm15 | + // |xmm0 | (Iter3) | xmm12 | xmm13 | xmm14 | xmm15 | + // |xmm0 | | xmm12 | xmm13 | xmm14 | xmm15 | + // |xmm0 | | xmm12 | xmm13 | xmm14 | xmm15 | + // +--+--+ - - - - +-------+-------+-------+-------+ + // + // Accumulator + + asm volatile( + + // Set registers for destination + "movq %[dst_col_stride_q], %%r12\n\t" + "shlq $2, %%r12\n\t" + "leaq (%%r12,%%r12,0x2), %%r13\n\t" + + // Set accumulators to zero. + "pxor %%xmm4 , %%xmm4 \n\t" + "pxor %%xmm5 , %%xmm5 \n\t" + "pxor %%xmm6 , %%xmm6 \n\t" + "pxor %%xmm7 , %%xmm7 \n\t" + "pxor %%xmm8 , %%xmm8 \n\t" + "pxor %%xmm9 , %%xmm9 \n\t" + "pxor %%xmm10 , %%xmm10\n\t" + "pxor %%xmm11 , %%xmm11\n\t" + "pxor %%xmm12 , %%xmm12\n\t" + "pxor %%xmm13 , %%xmm13\n\t" + "pxor %%xmm14 , %%xmm14\n\t" + "pxor %%xmm15 , %%xmm15\n\t" + + "movq %[run_depth_cells], %%r14\n\t" + "subq $2, %%r14\n\t" + "js outerLoop1%=\n\t" + + // Loop for K unrolled by 4 + "outerLoop2%=:\n\t" + + // K = 1,2 + // RHS cell to xmm1 + + "pmovzxbw (%[rhs_ptr]), %%xmm1\n\t" + + // LHS cell + "pmovzxbw 0x00(%[lhs_ptr]), %%xmm0\n\t" + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm4 \n\t" + "paddd %%xmm3, %%xmm5 \n\t" + + "prefetcht0 0x80(%[lhs_ptr]) \n\t" + + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + + // next LHS cell + "pmovzxbw 0x08(%[lhs_ptr]), %%xmm0\n\t" + + "paddd %%xmm2, %%xmm6 \n\t" + "paddd %%xmm3, %%xmm7 \n\t" + + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm8 \n\t" + "paddd %%xmm3, %%xmm9 \n\t" + + "prefetcht0 0x80(%[rhs_ptr]) \n\t" + + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm10 \n\t" + "paddd %%xmm3, %%xmm11 \n\t" + + // next LHS cell + "pmovzxbw 0x10(%[lhs_ptr]), %%xmm0\n\t" + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm12 \n\t" + "paddd %%xmm3, %%xmm13 \n\t" + + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm14 \n\t" + "paddd %%xmm3, %%xmm15 \n\t" + + // K = 3,4 + // RHS cell to xmm1 + "pmovzxbw 0x08(%[rhs_ptr]), %%xmm1\n\t" + + // LHS cell + "pmovzxbw 0x18(%[lhs_ptr]), %%xmm0\n\t" + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm4 \n\t" + "paddd %%xmm3, %%xmm5 \n\t" + + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm6 \n\t" + "paddd %%xmm3, %%xmm7 \n\t" + + // next LHS cell + "pmovzxbw 0x20(%[lhs_ptr]), %%xmm0\n\t" + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm8 \n\t" + "paddd %%xmm3, %%xmm9 \n\t" + + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm10 \n\t" + "paddd %%xmm3, %%xmm11 \n\t" + + // next LHS cell + "pmovzxbw 0x28(%[lhs_ptr]), %%xmm0\n\t" + + "addq $0x30, %[lhs_ptr] \n\t" + "addq $0x10, %[rhs_ptr] \n\t" + + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm12 \n\t" + "paddd %%xmm3, %%xmm13 \n\t" + + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm14 \n\t" + "paddd %%xmm3, %%xmm15 \n\t" + + "subq $2, %[run_depth_cells]\n\t" + "ja outerLoop2%=\n\t" + + "movq %[run_depth_cells], %%r14\n\t" + "decq %%r14\n\t" + "js finish%=\n\t" + + // Loop for K unrolled by 2 + "outerLoop1%=:\n\t" + + // RHS cell to xmm1 + "pmovzxbw (%[rhs_ptr]), %%xmm1\n\t" + + // LHS cell + "pmovzxbw 0x00(%[lhs_ptr]), %%xmm0\n\t" + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm4 \n\t" + "paddd %%xmm3, %%xmm5 \n\t" + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm6 \n\t" + "paddd %%xmm3, %%xmm7 \n\t" + + // next LHS cell + "pmovzxbw 0x08(%[lhs_ptr]), %%xmm0\n\t" + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm8 \n\t" + "paddd %%xmm3, %%xmm9 \n\t" + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm10 \n\t" + "paddd %%xmm3, %%xmm11 \n\t" + + // next LHS cell + "pmovzxbw 0x10(%[lhs_ptr]), %%xmm0\n\t" + + "addq $0x18, %[lhs_ptr] \n\t" + "addq $0x08, %[rhs_ptr] \n\t" + + "pshufd $0x00,%%xmm1,%%xmm2 \n\t" + "pshufd $0x55,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm12 \n\t" + "paddd %%xmm3, %%xmm13 \n\t" + "pshufd $0xaa,%%xmm1,%%xmm2 \n\t" + "pshufd $0xff,%%xmm1,%%xmm3 \n\t" + "pmaddwd %%xmm0, %%xmm2 \n\t" + "pmaddwd %%xmm0, %%xmm3 \n\t" + "paddd %%xmm2, %%xmm14 \n\t" + "paddd %%xmm3, %%xmm15 \n\t" + + "decq %[run_depth_cells]\n\t" + "jnz outerLoop1%=\n\t" + + "finish%=:\n\t" + + "test %[start_depth], %[start_depth]\n\t" + "jz storeDst%=\n\t" + + "paddd 0x00(%[dst_ptr]) , %%xmm4 \n\t" + "paddd 0x10(%[dst_ptr]) , %%xmm8 \n\t" + "paddd 0x20(%[dst_ptr]) , %%xmm12\n\t" + "paddd 0x00(%[dst_ptr], %%r12, 1) , %%xmm5 \n\t" + "paddd 0x10(%[dst_ptr], %%r12, 1) , %%xmm9 \n\t" + "paddd 0x20(%[dst_ptr], %%r12, 1) , %%xmm13\n\t" + "paddd 0x00(%[dst_ptr], %%r12, 2) , %%xmm6 \n\t" + "paddd 0x10(%[dst_ptr], %%r12, 2) , %%xmm10\n\t" + "paddd 0x20(%[dst_ptr], %%r12, 2) , %%xmm14\n\t" + "paddd 0x00(%[dst_ptr], %%r13, 1) , %%xmm7 \n\t" + "paddd 0x10(%[dst_ptr], %%r13, 1) , %%xmm11\n\t" + "paddd 0x20(%[dst_ptr], %%r13, 1) , %%xmm15\n\t" + + "storeDst%=:\n\t" + + "movdqu %%xmm4 , 0x00(%[dst_ptr]) \n\t" + "movdqu %%xmm8 , 0x10(%[dst_ptr]) \n\t" + "movdqu %%xmm12 , 0x20(%[dst_ptr]) \n\t" + "movdqu %%xmm5 , 0x00(%[dst_ptr], %%r12, 1)\n\t" + "movdqu %%xmm9 , 0x10(%[dst_ptr], %%r12, 1)\n\t" + "movdqu %%xmm13 , 0x20(%[dst_ptr], %%r12, 1)\n\t" + "movdqu %%xmm6 , 0x00(%[dst_ptr], %%r12, 2)\n\t" + "movdqu %%xmm10 , 0x10(%[dst_ptr], %%r12, 2)\n\t" + "movdqu %%xmm14 , 0x20(%[dst_ptr], %%r12, 2)\n\t" + "movdqu %%xmm7 , 0x00(%[dst_ptr], %%r13, 1)\n\t" + "movdqu %%xmm11 , 0x10(%[dst_ptr], %%r13, 1)\n\t" + "movdqu %%xmm15 , 0x20(%[dst_ptr], %%r13, 1)\n\t" + + : // outputs + [lhs_ptr] "+r"(lhs_ptr), [rhs_ptr] "+r"(rhs_ptr), + [dst_ptr] "+r"(dst_ptr) + : // inputs + [start_depth] "r"(start_depth), + [dst_col_stride_q] "r"(dst_col_stride_q), + [run_depth_cells] "r"(run_depth_cells) + : // clobbers + "cc", "memory", "%xmm0", "%xmm1", "%xmm3", "%xmm2", "%xmm4", "%xmm5", + "%xmm6", "%xmm7", "%xmm8", "%xmm9", "%xmm10", "%r12", "%r13", "%r14", + "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15"); + } +}; +#endif + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_KERNEL_SSE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/multi_thread_gemm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/multi_thread_gemm.h new file mode 100644 index 0000000000000000000000000000000000000000..97183e72c8329fe324e5194665ae1e9b1c0e5f3f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/multi_thread_gemm.h @@ -0,0 +1,721 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// multi_thread_gemm.h: Multi-threaded GEMM entry point. +// Readers note: To understand this file, it is useful to first +// read and understand the much simpler single_thread_gemm.h. + +#ifndef GEMMLOWP_INTERNAL_MULTI_THREAD_GEMM_H_ +#define GEMMLOWP_INTERNAL_MULTI_THREAD_GEMM_H_ + +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include + +#include "single_thread_gemm.h" + +namespace gemmlowp { + +// This value was empirically derived on an end-to-end application benchmark. +// That this number of cycles means that we may be sleeping substantially longer +// than a scheduler timeslice's duration is not necessarily surprising. The +// idea is to pick up quickly new work after having finished the previous +// workload. When it's new work within the same GEMM as the previous work, the +// time interval that we might be busy-waiting is very small, so for that +// purpose it would be more than enough to sleep for 1 million cycles. +// That is all what we would observe on a GEMM benchmark. However, in a real +// application, after having finished a GEMM, we might do unrelated work for +// a little while, then start on a new GEMM. Think of a neural network +// application performing inference, where many but not all layers are +// implemented by a GEMM. In such cases, our worker threads might be idle for +// longer periods of time before having work again. If we let them passively +// wait, on a mobile device, the CPU scheduler might aggressively clock down +// or even turn off the CPU cores that they were running on. That would result +// in a long delay the next time these need to be turned back on for the next +// GEMM. So we need to strike a balance that reflects typical time intervals +// between consecutive GEMM invokations, not just intra-GEMM considerations. +// Of course, we need to balance keeping CPUs spinning longer to resume work +// faster, versus passively waiting to conserve power. +const int kMaxBusyWaitNOPs = 4 * 1000 * 1000; + +// On X86 and ARM platforms we may use NOP instructions to know how long we +// are busy-waiting. + +#if defined(GEMMLOWP_ALLOW_INLINE_ASM) && !defined(GEMMLOWP_NO_BUSYWAIT) && \ + (defined(GEMMLOWP_ARM) || defined(GEMMLOWP_X86)) + +#define GEMMLOWP_NOP "nop\n" + +#define GEMMLOWP_STRING_CONCAT_4(X) X X X X +#define GEMMLOWP_NOP4 GEMMLOWP_STRING_CONCAT_4(GEMMLOWP_NOP) +#define GEMMLOWP_NOP16 GEMMLOWP_STRING_CONCAT_4(GEMMLOWP_NOP4) +#define GEMMLOWP_NOP64 GEMMLOWP_STRING_CONCAT_4(GEMMLOWP_NOP16) + +inline int DoSomeNOPs() { + asm volatile(GEMMLOWP_NOP64); + return 64; +} + +#undef GEMMLOWP_STRING_CONCAT_4 +#undef GEMMLOWP_NOP64 +#undef GEMMLOWP_NOP16 +#undef GEMMLOWP_NOP4 +#undef GEMMLOWP_NOP + +#else // May not use asm NOP. + +// If we can't use NOPs, let's use a non-inline function call as a basic +// thing that has some vaguely known, nonzero cost. +GEMMLOWP_NOINLINE +inline int DoSomeNOPs() { + // Pretend that calling an empty function takes as long as 16 NOPs... + return 16; +} +#endif + +// Waits until *var != initial_value. +// +// Returns the new value of *var. The guarantee here is that +// the return value is different from initial_value, and that that +// new value has been taken by *var at some point during the +// execution of this function. There is no guarantee that this is +// still the value of *var when this function returns, since *var is +// not assumed to be guarded by any lock. +// +// First does some busy-waiting for a fixed number of no-op cycles, +// then falls back to passive waiting for the given condvar, guarded +// by the given mutex. +// +// The idea of doing some initial busy-waiting is to help get +// better and more consistent multithreading benefits for small GEMM sizes. +// Busy-waiting help ensuring that if we need to wake up soon after having +// started waiting, then we can wake up quickly (as opposed to, say, +// having to wait to be scheduled again by the OS). On the other hand, +// we must still eventually revert to passive waiting for longer waits +// (e.g. worker threads having finished a GEMM and waiting until the next GEMM) +// so as to avoid permanently spinning. +// +template +T WaitForVariableChange(std::atomic* var, T initial_value, + pthread_cond_t* cond, pthread_mutex_t* mutex) { + // First, trivial case where the variable already changed value. + T new_value = var->load(std::memory_order_acquire); + if (new_value != initial_value) { + return new_value; + } + // Then try busy-waiting. + int nops = 0; + while (nops < kMaxBusyWaitNOPs) { + nops += DoSomeNOPs(); + new_value = var->load(std::memory_order_acquire); + if (new_value != initial_value) { + return new_value; + } + } + + // Finally, do real passive waiting. + pthread_mutex_lock(mutex); + new_value = var->load(std::memory_order_acquire); + while (new_value == initial_value) { + pthread_cond_wait(cond, mutex); + new_value = var->load(std::memory_order_acquire); + } + pthread_mutex_unlock(mutex); + return new_value; +} + +// A BlockingCounter lets one thread to wait for N events to occur. +// This is how the master thread waits for all the worker threads +// to have finished working. +// The waiting is done using a naive spinlock waiting for the atomic +// count_ to hit the value 0. This is acceptable because in our usage +// pattern, BlockingCounter is used only to synchronize threads after +// short-lived tasks (performing parts of the same GEMM). It is not used +// for synchronizing longer waits (resuming work on the next GEMM). +class BlockingCounter { + public: + BlockingCounter() : count_(0) {} + + // Sets/resets the counter; initial_count is the number of + // decrementing events that the Wait() call will be waiting for. + void Reset(std::size_t initial_count) { + std::size_t old_count_value = count_.load(std::memory_order_relaxed); + assert(old_count_value == 0); + (void)old_count_value; + count_.store(initial_count, std::memory_order_release); + } + + // Decrements the counter; if the counter hits zero, signals + // the threads that were waiting for that, and returns true. + // Otherwise (if the decremented count is still nonzero), + // returns false. + bool DecrementCount() { + std::size_t old_count_value = + count_.fetch_sub(1, std::memory_order_acq_rel); + assert(old_count_value > 0); + std::size_t count_value = old_count_value - 1; + return count_value == 0; + } + + // Waits for the N other threads (N having been set by Reset()) + // to hit the BlockingCounter. + void Wait() { + ScopedProfilingLabel label("BlockingCounter::Wait"); + // Busy-wait until the count value is 0. + int nops = 0; + while (count_.load(std::memory_order_acquire)) { + nops += DoSomeNOPs(); + if (nops > kMaxBusyWaitNOPs) { + nops = 0; + // If we are unlucky, the blocking thread (that calls DecrementCount) + // and the blocked thread (here, calling Wait) may be scheduled on + // the same CPU, so the busy-waiting of the present thread may prevent + // the blocking thread from resuming and unblocking. + // If we are even unluckier, the priorities of the present thread + // might be higher than that of the blocking thread, so just yielding + // wouldn't allow the blocking thread to resume. So we sleep for + // a substantial amount of time in that case. Notice that we only + // do so after having busy-waited for kMaxBusyWaitNOPs, which is + // typically several milliseconds, so sleeping 1 more millisecond + // isn't terrible at that point. + // + // How this is mitigated in practice: + // In practice, it is well known that the application should be + // conservative in choosing how many threads to tell gemmlowp to use, + // as it's hard to know how many CPU cores it will get to run on, + // on typical mobile devices. + // It seems impossible for gemmlowp to make this choice automatically, + // which is why gemmlowp's default is to use only 1 thread, and + // applications may override that if they know that they can count on + // using more than that. + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + } + } + + private: + std::atomic count_; +}; + +// A workload for a worker. +struct Task { + Task() : local_allocator(nullptr) {} + virtual ~Task() {} + virtual void Run() = 0; + Allocator* local_allocator; +}; + +// A worker thread. +class Worker { + public: + enum class State { + ThreadStartup, // The initial state before the thread main loop runs. + Ready, // Is not working, has not yet received new work to do. + HasWork, // Has work to do. + ExitAsSoonAsPossible // Should exit at earliest convenience. + }; + + explicit Worker(BlockingCounter* counter_to_decrement_when_ready) + : task_(nullptr), + state_(State::ThreadStartup), + counter_to_decrement_when_ready_(counter_to_decrement_when_ready) { + pthread_cond_init(&state_cond_, nullptr); + pthread_mutex_init(&state_mutex_, nullptr); + pthread_create(&thread_, nullptr, ThreadFunc, this); + } + + ~Worker() { + ChangeState(State::ExitAsSoonAsPossible); + pthread_join(thread_, nullptr); + pthread_cond_destroy(&state_cond_); + pthread_mutex_destroy(&state_mutex_); + } + + // Changes State; may be called from either the worker thread + // or the master thread; however, not all state transitions are legal, + // which is guarded by assertions. + // + // The Task argument is to be used only with new_state==HasWork. + // It specifies the Task being handed to this Worker. + void ChangeState(State new_state, Task* task = nullptr) { + ScopedProfilingLabel label("Worker::ChangeState"); + pthread_mutex_lock(&state_mutex_); + State old_state = state_.load(std::memory_order_relaxed); + assert(old_state != new_state); + switch (old_state) { + case State::ThreadStartup: + assert(new_state == State::Ready); + break; + case State::Ready: + assert(new_state == State::HasWork || + new_state == State::ExitAsSoonAsPossible); + break; + case State::HasWork: + assert(new_state == State::Ready || + new_state == State::ExitAsSoonAsPossible); + break; + default: + abort(); + } + switch (new_state) { + case State::Ready: + if (task_) { + // Doing work is part of reverting to 'ready' state. + task_->Run(); + task_ = nullptr; + } + break; + case State::HasWork: + assert(!task_); + task->local_allocator = &local_allocator_; + task_ = task; + break; + default: + break; + } + state_.store(new_state, std::memory_order_relaxed); + pthread_cond_broadcast(&state_cond_); + pthread_mutex_unlock(&state_mutex_); + if (new_state == State::Ready) { + counter_to_decrement_when_ready_->DecrementCount(); + } + } + + // Thread entry point. + void ThreadFunc() { + ScopedProfilingLabel label("Worker::ThreadFunc"); + + ChangeState(State::Ready); + + // Thread main loop + while (true) { + // Get a state to act on + // In the 'Ready' state, we have nothing to do but to wait until + // we switch to another state. + State state_to_act_upon = WaitForVariableChange( + &state_, State::Ready, &state_cond_, &state_mutex_); + + // We now have a state to act on, so act. + switch (state_to_act_upon) { + case State::HasWork: + // Got work to do! So do it, and then revert to 'Ready' state. + ChangeState(State::Ready); + break; + case State::ExitAsSoonAsPossible: + return; + default: + abort(); + } + } + } + + static void* ThreadFunc(void* arg) { + static_cast(arg)->ThreadFunc(); + return nullptr; + } + + // Called by the master thead to give this worker work to do. + void StartWork(Task* task) { ChangeState(State::HasWork, task); } + + private: + // The underlying thread. + pthread_t thread_; + + // The task to be worked on. + Task* task_; + + // The condition variable and mutex guarding state changes. + pthread_cond_t state_cond_; + pthread_mutex_t state_mutex_; + + // The state enum tells if we're currently working, waiting for work, etc. + // Its concurrent accesses by the worker and main threads are guarded by + // state_mutex_, and can thus use memory_order_relaxed. This still needs + // to be a std::atomic because we use WaitForVariableChange. + std::atomic state_; + + // Each thread had a local allocator so they can allocate temporary + // buffers without blocking each other. + Allocator local_allocator_; + + // pointer to the master's thread BlockingCounter object, to notify the + // master thread of when this worker switches to the 'Ready' state. + BlockingCounter* const counter_to_decrement_when_ready_; +}; + +// A very simple pool of workers, that only allows the very +// specific parallelization pattern that we use here: +// a fixed number of workers can be given work, and one then +// waits for all of them to finish. +// +// See MultiThreadGemmContextBase for how other WorkersPool implementations can +// be used. +class WorkersPool { + public: + WorkersPool() {} + + ~WorkersPool() { + for (auto w : workers_) { + delete w; + } + } + + // Just executes the tasks. Does not destroy them. Similar to + // ruy::ThreadPool::Execute. + template + void Execute(int tasks_count, TaskType* tasks) { + assert(tasks_count >= 1); + // One of the tasks will be run on the current thread. + std::size_t workers_count = tasks_count - 1; + CreateWorkers(workers_count); + assert(workers_count <= workers_.size()); + counter_to_decrement_when_ready_.Reset(workers_count); + for (std::size_t i = 0; i < tasks_count - 1; i++) { + workers_[i]->StartWork(&tasks[i]); + } + // Execute the remaining workload immediately on the current thread. + Task* task = &tasks[tasks_count - 1]; + task->local_allocator = &main_thread_task_allocator_; + task->Run(); + // Wait for the workers submitted above to finish. + counter_to_decrement_when_ready_.Wait(); + } + + // Legacy: executes the tasks and destroys them + void LegacyExecuteAndDestroyTasks(const std::vector& tasks) { + std::size_t tasks_count = tasks.size(); + assert(tasks_count >= 1); + // One of the tasks will be run on the current thread. + std::size_t workers_count = tasks_count - 1; + CreateWorkers(workers_count); + assert(workers_count <= workers_.size()); + counter_to_decrement_when_ready_.Reset(workers_count); + for (int i = 0; i < tasks_count - 1; i++) { + workers_[i]->StartWork(tasks[i]); + } + // Execute the remaining workload immediately on the current thread. + Task* task = tasks[tasks_count - 1]; + task->local_allocator = &main_thread_task_allocator_; + task->Run(); + // Wait for the workers submitted above to finish. + counter_to_decrement_when_ready_.Wait(); + // Cleanup tasks (best to do this from the same thread that allocated + // the memory). + std::for_each(tasks.begin(), tasks.end(), [](Task* task) { delete task; }); + } + + // Legacy old name of LegacyExecuteAndDestroyTasks + void Execute(const std::vector& tasks) { + LegacyExecuteAndDestroyTasks(tasks); + } + + private: + // Ensures that the pool has at least the given count of workers. + // If any new worker has to be created, this function waits for it to + // be ready. + void CreateWorkers(std::size_t workers_count) { + if (workers_.size() >= workers_count) { + return; + } + counter_to_decrement_when_ready_.Reset(workers_count - workers_.size()); + while (workers_.size() < workers_count) { + workers_.push_back(new Worker(&counter_to_decrement_when_ready_)); + } + counter_to_decrement_when_ready_.Wait(); + } + + // copy construction disallowed + WorkersPool(const WorkersPool&) = delete; + + // The workers in this pool. They are owned by the pool: + // the pool creates workers and destroys them in its destructor. + std::vector workers_; + + // The BlockingCounter used to wait for the workers. + BlockingCounter counter_to_decrement_when_ready_; + + // For N-threaded operations, we will use only N-1 worker threads + // while the last task will be run directly on the main thread. + // It will then use this main_thread_task_allocator_; having a + // dedicated allocator for that (separate from the base allocator_) + // allows to use the same code for all tasks regardless of which + // thread they run on. + Allocator main_thread_task_allocator_; +}; + +// The task we use to implement a multi-threaded Gemm: a block of the +// RHS has been packed by the master thread; each worker thread +// then has to pack a block of the LHS and accumulate the Gemm of these +// packed LHS and RHS blocks. +template +struct GemmWithPackedRhsTask : Task { + typedef PackedSideBlock PackedLhs; + typedef PackedSideBlock PackedRhs; + GemmWithPackedRhsTask(GemmContextType* _context, const KernelBase& _kernel, + const MatrixMap& _lhs, + const PackedRhs& _packed_rhs, + MatrixMap* _result, + const MatrixBlockBounds& _result_block, + const LhsOffset& _lhs_offset, + const RhsOffset& _rhs_offset, + const BlockParams& _block_params, + const OutputPipelineType& _output_pipeline) + : context(_context), + kernel(_kernel), + lhs(_lhs), + packed_rhs(_packed_rhs), + result(*_result), + result_block(_result_block), + lhs_offset(_lhs_offset), + rhs_offset(_rhs_offset), + block_params(_block_params), + output_pipeline(_output_pipeline) {} + + void Run() override { + ScopedProfilingLabel label("GemmWithPackedRhsTask"); + + const int rows = result_block.rows; + const int cols = result_block.cols; + const int depth = lhs.cols(); + + PackedLhs packed_lhs(Side::Lhs, local_allocator, block_params); + + PackedResult packed_result(local_allocator, block_params); + + local_allocator->Commit(); + + for (int c = 0; c < cols; c += block_params.l2_cols) { + int cs = std::min(block_params.l2_cols, cols - c); + + for (int r = 0; r < rows; r += block_params.l2_rows) { + int rs = std::min(block_params.l2_rows, rows - r); + + PackLhs(&packed_lhs, lhs.block(r, 0, rs, depth)); + + Compute(kernel, block_params, &packed_result, packed_lhs, packed_rhs, + depth); + + auto curr_result_block = MatrixBlockBounds( + result_block.start_row + r, result_block.start_col + c, rs, cs); + UnpackResult( + &result, curr_result_block, packed_result, depth, + packed_lhs.sums_of_each_slice(), packed_rhs.sums_of_each_slice(), + lhs_offset.block(curr_result_block.start_row, rs), + rhs_offset.block(curr_result_block.start_col, cs), output_pipeline); + } + } + + local_allocator->Decommit(); + } + + const GemmContextType* context; + const KernelBase& kernel; + const MatrixMap lhs; + const PackedRhs packed_rhs; + MatrixMap result; + const MatrixBlockBounds result_block; + const LhsOffset& lhs_offset; + const RhsOffset& rhs_offset; + const BlockParams& block_params; + const OutputPipelineType& output_pipeline; +}; + +// This base class for multi-threading allows subclasses to implement their own +// workers_pool() method. See MultiThreadGemmContext below for an example; +// any other implementation of workers_pool() must return an object with the +// same public methods as WorkersPool. +class MultiThreadGemmContextBase : public SingleThreadGemmContext { + public: + void set_max_num_threads(int n) { max_num_threads_ = n; } + + int max_num_threads() const { return max_num_threads_; } + + protected: + // The maximum number of worker threads to use (including + // the master thread). + // The default value 1 means single-threading. That is the default + // because gemmlowp's primary target is mobile hardware, where thermal + // constraints usually mean that it may not be realistic to use more + // than 1 CPU core even if multiple cores are present. + // The special value 0 means try to detect the number of hardware threads. + // Note: this assumes that all CPU cores are equivalent. That assumption + // is defeated on big.LITTLE ARM devices, where we have no API to query + // the number of big cores (which is typically what we would want to use, + // leaving aside above-mentioned thermal issues). That is the other reason + // why the best compromise here is to let max_num_threads_ default to 1, + // so users who want multi-threading have to make the decision of how many + // threads to use by themselves. + int max_num_threads_ = 1; +}; + +class MultiThreadGemmContext : public MultiThreadGemmContextBase { + public: + WorkersPool* workers_pool() { return &workers_pool_; } + + private: + // The workers pool used by MultiThreadGemm. Making + // this part of the context allows it to be persistent, + // avoiding recreating threads on every Gemm. + WorkersPool workers_pool_; +}; + +// Determines how many threads should be used for a given Gemm +// operation. +template +inline int HowManyThreads(int max_num_threads, int rows, int cols, int depth) { + // Early-exit in the default case where multi-threading is disabled. + if (max_num_threads == 1) { + return 1; + } + + // Determine the maximum number of threads. + int max_count = GetHardwareConcurrency(max_num_threads); + + // Basic calculation: take into account max pool size, and + // how many rows we have to feed our kernel. + // The motivation for an absolute minimum number of rows per thread, + // potentially higher than KernelRows, is that very thin thread workload + // currently defeat assumptions of the AddMod generator, resulting + // in substantial bias in TestWithRealData on 24 threads. + // Ideally, the AddMod generator should be aware of global (r,c) coordinates + // so as to be independent of the number of threads. + static const int AbsoluteMinRowsPerThread = 16; + static const int MinRowsPerThread = KernelRows > AbsoluteMinRowsPerThread + ? KernelRows + : AbsoluteMinRowsPerThread; + int thread_count = std::min(max_count, CeilQuotient(rows, MinRowsPerThread)); + + // At this point for small products we already have thread_count==1 so + // we can avoid doing more work; otherwise, we still want to check + // that the cubic size (rows*cols*depth) is big enough to keep + // workers_ busy. + if (thread_count > 1) { + // Empirically determined value. + static const std::uint64_t min_cubic_size_per_thread = 64 * 1024; + + // We can only multiply two out of three sizes without risking overflow + const std::uint64_t cubic_size = + std::uint64_t(rows) * std::uint64_t(cols) * std::uint64_t(depth); + + thread_count = + std::min(thread_count, int(cubic_size / min_cubic_size_per_thread)); + + if (thread_count < 1) { + thread_count = 1; + } + } + + assert(thread_count > 0 && thread_count <= max_count); + return thread_count; +} + +// The main multi-threaded Gemm function. +// To understand it, first read the code of SingleThreadGemm(). +// The parallelization scheme used here is to have this master function +// pack a block of RHS and then start worker threads to pack a block of LHS +// each, and accumulate the corresponding products. +template +void MultiThreadGemm(GemmContextType* context, const KernelBase& kernel, + const MatrixMap& lhs, + const MatrixMap& rhs, + MatrixMap* result, + const LhsOffset& lhs_offset, const RhsOffset& rhs_offset, + const OutputPipelineType& output_pipeline) { + ScopedProfilingLabel label("gemmlowp::MultiThreadGemm"); + + assert(lhs.cols() == rhs.rows()); + + int rows = result->rows(); + int cols = result->cols(); + int depth = lhs.cols(); + + // zero sizes should have been caught earlier and early-returned. + assert(rows > 0); + assert(cols > 0); + assert(depth > 0); + + // The case of rows= cols); + + const int thread_count = HowManyThreads( + context->max_num_threads(), rows, cols, depth); + if (thread_count == 1) { + return SingleThreadGemm(context, kernel, lhs, rhs, result, + lhs_offset, rhs_offset, + output_pipeline); + } + assert(thread_count > 1); + + // Simple 1:1 mapping of tasks to physical cores, which is very important + // to getting good multithreaded performance, specially for not-very-large + // GEMMs, and especially on Android. + const int task_count = thread_count; + + Allocator* allocator = context->allocator(); + auto* workers_pool = context->workers_pool(); + + BlockParams block_params; + block_params.Init( + rows, cols, depth, task_count, context->l1_bytes_to_use(), + context->l2_bytes_to_use(), context->l2_rhs_factor()); + + PackedSideBlock packed_rhs(Side::Rhs, allocator, + block_params); + allocator->Commit(); + + // We loop over large blocks of the RHS. + for (int c = 0; c < cols; c += block_params.l2_cols) { + int cs = std::min(block_params.l2_cols, cols - c); + + // Pack a large block of the RHS. + PackRhs(&packed_rhs, rhs.block(0, c, depth, cs)); + + // Give work to each worker. + std::vector tasks; + int next_start_row = 0; + for (int n = 0; n < task_count; ++n) { + int start_row = next_start_row; + next_start_row = std::min( + rows, RoundUp(rows * (n + 1) / task_count)); + + int block_rows = next_start_row - start_row; + auto lhs_block = lhs.block(start_row, 0, block_rows, depth); + typedef GemmWithPackedRhsTask + TaskType; + tasks.push_back( + new TaskType(context, kernel, lhs_block, packed_rhs, result, + MatrixBlockBounds(start_row, c, block_rows, cs), + lhs_offset, rhs_offset, block_params, output_pipeline)); + } + // Execute the work on the workers (and partially on this thread). + workers_pool->Execute(tasks); + } + + allocator->Decommit(); +} + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_MULTI_THREAD_GEMM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output.h new file mode 100644 index 0000000000000000000000000000000000000000..92bf7b9f8e207747c47e5edbf0affa895b9fe1cf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output.h @@ -0,0 +1,579 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// output.h: processing the 32-bit accumulators output by the unpack +// stage, obtaining the final result matrix entries and storing them into +// the destination matrix. + +#ifndef GEMMLOWP_INTERNAL_OUTPUT_H_ +#define GEMMLOWP_INTERNAL_OUTPUT_H_ + +#include +#include +#include +#include + +#include "../fixedpoint/fixedpoint.h" +#include "../public/output_stages.h" +#include "simd_wrappers.h" + +namespace gemmlowp { + +template +struct OutputStageEvalBufferImpl { + // This generic template body should never be hit. + static_assert( + std::is_same::value, + "Unimplemented: missing implementation of this output pipeline stage " + "for this data type. This would happen if some architecture-specific " + "SIMD back-end (output_$arch.h) were incomplete."); +}; + +template +struct OutputStageEvalImpl { + static constexpr int kRows = InputType::kRows; + static constexpr int kCols = InputType::kCols; + using InputBufferType = typename InputType::BufferType; + using BufferEvalImplType = + OutputStageEvalBufferImpl; + using OutputBufferType = typename BufferEvalImplType::OutputType; + using OutputScalarType = typename OutputBufferType::ScalarType; + using OutputType = RegisterBlock; + + OutputStageEvalImpl(const OutputStage& s) : buffer_eval_impl(s) {} + + OutputType Eval(InputType input, int, int) const { + OutputType output; + output.buf = buffer_eval_impl.Eval(input.buf); + return output; + } + + const BufferEvalImplType buffer_eval_impl; +}; + +template +struct OutputStageEvalBufferImpl> { + using InputType = RegisterBuffer; + using OutputType = RegisterBuffer; + + typedef OutputStageQuantizeDownInt32ToUint8Scale OutputStage; + + OutputStageEvalBufferImpl(const OutputStage& s) : output_stage(s) {} + + OutputType Eval(InputType input) const { + const int result_shift = output_stage.result_shift; + const std::int32_t result_mult_int = output_stage.result_mult_int; + using RegisterType = typename InputType::RegisterType; + const RegisterType result_offset = + Dup(output_stage.result_offset); + OutputType output; + for (int i = 0; i < InputType::kRegisterCount; i++) { + output.reg[i] = RoundingDivideByPOT( + Mul(Add(input.reg[i], result_offset), result_mult_int), result_shift); + } + return output; + } + + const OutputStage& output_stage; +}; + +template +struct OutputStageEvalImpl, + RegisterBlock> { + typedef RegisterBlock InputType; + typedef RegisterBlock OutputType; + typedef OutputStageQuantizeDownInt32ToUint8ScalePC OutputStage; + + OutputStageEvalImpl(const OutputStage& s) : output_stage(s) {} + + OutputType Eval(InputType input, int row, int col) const { + OutputType output; + const int result_shift = output_stage.result_shift; + const int pos = Shape == VectorShape::Col ? row : col; + const auto result_mult_int = + LoadForBroadcasting(output_stage.result_mult_int, pos); + const auto result_offset = + LoadForBroadcasting(output_stage.result_offset, pos); + const auto dividend = BroadcastMul( + BroadcastAdd(input, result_offset), result_mult_int); + for (int i = 0; i < InputType::kRegisterCount; i++) { + output.buf.reg[i] = + RoundingDivideByPOT(dividend.buf.reg[i], result_shift); + } + return output; + } + + const OutputStage& output_stage; +}; + +template +struct OutputStageEvalBufferImpl< + OutputStageQuantizeDownInt32ByFixedPoint, + RegisterBuffer> { + typedef RegisterBuffer InputType; + typedef RegisterBuffer OutputType; + + typedef OutputStageQuantizeDownInt32ByFixedPoint OutputStage; + + OutputStageEvalBufferImpl(const OutputStage& s) : output_stage(s) {} + + OutputType Eval(InputType input) const { + OutputType output; + using RegisterType = typename InputType::RegisterType; + const RegisterType result_offset_after_shift = + Dup(output_stage.result_offset_after_shift); + for (int i = 0; i < InputType::kRegisterCount; i++) { + const RegisterType mulhigh_val = SaturatingRoundingDoublingHighMul( + input.reg[i], output_stage.result_fixedpoint_multiplier); + output.reg[i] = + Add(RoundingDivideByPOT(mulhigh_val, output_stage.result_shift), + result_offset_after_shift); + } + return output; + } + + const OutputStage& output_stage; +}; + +template +struct OutputStageEvalBufferImpl> { + typedef RegisterBuffer InputType; + typedef RegisterBuffer OutputType; + + typedef OutputStageScaleInt32ByFixedPointAndExponent OutputStage; + + OutputStageEvalBufferImpl(const OutputStage& s) : output_stage(s) { + left_shift = std::max(0, output_stage.result_exponent); + right_shift = std::max(0, -output_stage.result_exponent); + } + + OutputType Eval(InputType input) const { + OutputType output; + using RegisterType = typename InputType::RegisterType; + const RegisterType result_offset_after_shift = + Dup(output_stage.result_offset_after_shift); + for (int i = 0; i < InputType::kRegisterCount; i++) { + const RegisterType mulhigh_val = SaturatingRoundingDoublingHighMul( + ShiftLeft(input.reg[i], left_shift), + output_stage.result_fixedpoint_multiplier); + output.reg[i] = Add(RoundingDivideByPOT(mulhigh_val, right_shift), + result_offset_after_shift); + } + return output; + } + + const OutputStage& output_stage; + int left_shift; + int right_shift; +}; + +template +struct OutputStageEvalImpl< + OutputStageScaleInt32ByFixedPointAndExponentPC, + RegisterBlock> { + typedef RegisterBlock InputType; + typedef RegisterBlock OutputType; + + typedef OutputStageScaleInt32ByFixedPointAndExponentPC OutputStage; + + OutputStageEvalImpl(const OutputStage& s) : output_stage(s) {} + + OutputType Eval(InputType input, int row, int col) const { + OutputType output; + const int pos = Shape == VectorShape::Row ? col : row; + using RegisterType = typename InputType::RegisterType; + const RegisterType result_offset_after_shift = + Dup(output_stage.result_offset_after_shift); + auto left_shift = + LoadForBroadcasting(output_stage.result_exponent, pos); + auto right_shift = + LoadForBroadcasting(output_stage.result_exponent, pos); + const auto result_fixedpoint_multiplier = LoadForBroadcasting( + output_stage.result_fixedpoint_multiplier, pos); + for (int i = 0; i < decltype(left_shift)::kRegisterCount; i++) { + left_shift.buf.reg[i] = Max(left_shift.buf.reg[i], 0); + right_shift.buf.reg[i] = Max(-right_shift.buf.reg[i], 0); + } + const auto mulhigh_val = BroadcastSaturatingRoundingDoublingHighMul( + BroadcastShiftLeft(input, left_shift), result_fixedpoint_multiplier); + const auto rdpot_val = + BroadcastRoundingDivideByPOT(mulhigh_val, right_shift); + for (int i = 0; i < InputType::kRegisterCount; i++) { + output.buf.reg[i] = Add(rdpot_val.buf.reg[i], result_offset_after_shift); + } + return output; + } + + const OutputStage& output_stage; +}; + +// Implementation of OutputStageSaturatingCastToUint8 for scalar data. +template +struct OutputStageEvalBufferImpl> { + typedef RegisterBuffer InputType; + typedef RegisterBuffer OutputType; + static_assert(InputType::kRegisterLanes == 1, + "This path is only for scalar values"); + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + for (int i = 0; i < InputType::kRegisterCount; i++) { + std::int32_t data = input.reg[i]; + output.reg[i] = data > 255 ? 255 : data < 0 ? 0 : data; + } + return output; + } +}; + +// Implementation of OutputStageSaturatingCastToInt8 for scalar data. +template +struct OutputStageEvalBufferImpl> { + typedef RegisterBuffer InputType; + typedef RegisterBuffer OutputType; + static_assert(InputType::kRegisterLanes == 1, + "This path is only for scalar values"); + + typedef OutputStageSaturatingCastToInt8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + for (int i = 0; i < InputType::kRegisterCount; i++) { + std::int32_t data = input.reg[i]; + output.reg[i] = data > 127 ? 127 : data < -128 ? -128 : data; + } + return output; + } +}; + +// Implementation of OutputStageSaturatingCastToInt16 for scalar data. +template +struct OutputStageEvalBufferImpl> { + typedef RegisterBuffer InputType; + typedef RegisterBuffer OutputType; + static_assert(InputType::kRegisterLanes == 1, + "This path is only for scalar values"); + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + for (int i = 0; i < InputType::kRegisterCount; i++) { + std::int32_t data = input.reg[i]; + output.reg[i] = data > 32767 ? 32767 : data < -32768 ? -32768 : data; + } + return output; + } +}; + +// Implementation of OutputStageTruncatingCastToUint8 for scalar data +template +struct OutputStageEvalBufferImpl> { + typedef RegisterBuffer InputType; + typedef RegisterBuffer OutputType; + static_assert(InputType::kRegisterLanes == 1, + "This path is only for scalar values"); + + typedef OutputStageTruncatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + for (int i = 0; i < InputType::kRegisterCount; i++) { + output.reg[i] = input.reg[i]; + } + return output; + } +}; + +template +struct OutputStageEvalImpl, + RegisterBlock> { + typedef RegisterBlock InputType; + typedef RegisterBlock OutputType; + typedef OutputStageBiasAddition OutputStage; + + OutputStageEvalImpl(const OutputStage& s) : output_stage(s) {} + + OutputType Eval(InputType input, int row, int col) const { + const int pos = VectorType::kShape == VectorShape::Row ? col : row; + return BroadcastAdd( + input, LoadForBroadcasting(output_stage.bias_vector, pos)); + } + + const OutputStage& output_stage; +}; + +template +struct OutputStageEvalBufferImpl> { + typedef RegisterBuffer InputType; + typedef RegisterBuffer OutputType; + + typedef OutputStageClamp OutputStage; + + OutputStageEvalBufferImpl(const OutputStage& s) : output_stage(s) {} + + OutputType Eval(InputType input) const { + using RegisterType = typename InputType::RegisterType; + const RegisterType min = Dup(output_stage.min); + const RegisterType max = Dup(output_stage.max); + OutputType output; + for (int i = 0; i < InputType::kRegisterCount; i++) { + output.reg[i] = Min(Max(input.reg[i], min), max); + } + return output; + } + + const OutputStage& output_stage; +}; + +template +struct OutputStageEvalBufferImpl> { + typedef RegisterBuffer InputType; + typedef RegisterBuffer OutputType; + using RegisterType = typename InputType::RegisterType; + typedef RegisterType DataType; + typedef OutputStageTanh OutputStage; + + OutputStageEvalBufferImpl(const OutputStage& s) : output_stage(s) { + const std::int32_t real_zero_as_int32 = output_stage.real_zero_as_int32; + const std::int32_t real_amplitude_as_int32 = + output_stage.real_amplitude_as_int32; + + input_cutoff_min = real_zero_as_int32 - 8 * real_amplitude_as_int32; + input_cutoff_max = real_zero_as_int32 + 8 * real_amplitude_as_int32; + output_min = real_zero_as_int32 - real_amplitude_as_int32; + output_max = real_zero_as_int32 + real_amplitude_as_int32; + + double inverse_amplitude_normalized_double = 1.0 / real_amplitude_as_int32; + inverse_amplitude_neg_exponent = 0; + while (inverse_amplitude_normalized_double < 0.5) { + inverse_amplitude_normalized_double *= 2; + inverse_amplitude_neg_exponent++; + } + inverse_amplitude_normalized = FixedPoint::FromDouble( + inverse_amplitude_normalized_double); + + double amplitude_normalized_double = real_amplitude_as_int32; + amplitude_exponent = 0; + while (amplitude_normalized_double >= 1.0) { + amplitude_normalized_double *= 0.5; + amplitude_exponent++; + } + amplitude_normalized = + FixedPoint::FromDouble(amplitude_normalized_double); + } + + OutputType Eval(InputType input) const { + const std::int32_t real_zero_as_int32 = output_stage.real_zero_as_int32; + + typedef FixedPoint F3; + typedef FixedPoint F0; + + OutputType output; + + for (int i = 0; i < OutputType::kRegisterCount; i++) { + // fixed-point affine transformation + DataType input_centered = + Sub(input.reg[i], Dup(real_zero_as_int32)); + F3 fixedpoint_input = + F3::FromRaw(input_centered) * inverse_amplitude_normalized; + // left shift + fixedpoint_input.raw() = ShiftLeft(fixedpoint_input.raw(), + 28 - inverse_amplitude_neg_exponent); + // fixed-point tanh and multiplication + F0 fixedpoint_output = tanh(fixedpoint_input) * amplitude_normalized; + // right shift + DataType int32_output = + Add(Dup(real_zero_as_int32), + ShiftRight(fixedpoint_output.raw(), 31 - amplitude_exponent)); + + DataType mask_if_below_cutoff_min = + MaskIfLessThanOrEqual(input.reg[i], Dup(input_cutoff_min)); + DataType mask_if_above_cutoff_max = MaskIfGreaterThanOrEqual( + input.reg[i], Dup(input_cutoff_max)); + + output.reg[i] = SelectUsingMask( + mask_if_below_cutoff_min, Dup(output_min), + SelectUsingMask(mask_if_above_cutoff_max, Dup(output_max), + int32_output)); + } + return output; + } + + const OutputStage& output_stage; + std::int32_t input_cutoff_min, input_cutoff_max; + std::int32_t output_min, output_max; + FixedPoint inverse_amplitude_normalized; + int inverse_amplitude_neg_exponent; + FixedPoint amplitude_normalized; + int amplitude_exponent; +}; + +// OutputPipelineOutputType is a helper to determine the output data type of a +// pipeline, for a +// given input data type. It is a recursive template; see the explanation on +// OutputPipelineEvalImpl below. +template ::value> +struct OutputPipelineOutputType { + typedef typename std::tuple_element::type + FirstStageType; + typedef typename OutputStageEvalImpl::OutputType + FirstStageOutputType; + typedef typename OutputPipelineOutputType::Type Type; +}; + +template +struct OutputPipelineOutputType { + typedef InputType Type; +}; + +// OutputPipelineEvalImpl is a helper to implement the evaluation of +// the whole pipeline. It is a recursive template to implement compile-time +// unrolling of the loop over all pipeline stages. The 'FirstStage' parameter +// is how we implement recursion: each specialization implements only +// evaluation starting at 'FirstStage'. The StopRecursion parameter is just a +// helper to implement the termination of the recursion as a partial +// specialization below. +template ::value> +struct OutputPipelineEvalImpl { + typedef typename std::tuple_element::type + FirstStageType; + typedef typename OutputStageEvalImpl::OutputType + FirstStageOutputType; + typedef typename OutputPipelineOutputType::Type OutputType; + + OutputPipelineEvalImpl(const OutputPipelineType& output_pipeline) + : head_impl(std::get(output_pipeline)), + tail_impl(output_pipeline) {} + + OutputType Eval(InputType input, int row, int col) const { + // Evaluate the first stage. + FirstStageOutputType first_stage_output = head_impl.Eval(input, row, col); + // Recurse into the remaining stages. + return tail_impl.Eval(first_stage_output, row, col); + } + + const OutputStageEvalImpl head_impl; + const OutputPipelineEvalImpl + tail_impl; +}; + +// Specialization on 'StopRecursion' for terminating the recursion. +template +struct OutputPipelineEvalImpl { + OutputPipelineEvalImpl(const OutputPipelineType&) {} + + InputType Eval(InputType input, int, int) const { + // Terminating the recursion. + return input; + } +}; + +template +struct StoreFinalOutputImpl { + static_assert(std::is_same::value, + "This generic impl should never be hit"); +}; + +template +struct StoreFinalOutputImpl, DstType> { + using RegisterBlockType = RegisterBlock; + static void Run(const RegisterBlockType& src, DstType* dst, int row, + int col) { + for (int r = 0; r < Rows; r++) { + for (int c = 0; c < Cols; c++) { + *dst->data(row + r, col + c) = src.buf.reg[r + c * Rows]; + } + } + } +}; + +// StoreFinalOutput takes the final value at the end of the output pipeline and +// stores it into the destination matrix. It can be specialized for different +// data types; the generic implementation here is typically used only for plain +// old scalar (not SIMD) types. +template +void StoreFinalOutput(RegisterBlockType src, DstType* dst, int row, int col) { + StoreFinalOutputImpl::Run(src, dst, row, col); +} + +template +struct OutputPipelineExecutor { + OutputPipelineExecutor(const OutputPipelineType& output_pipeline) + : output_pipeline_eval_impl_(output_pipeline) {} + + // Execute is the entry point into the output pipeline evaluation + // code. It should be the only thing that unpack code calls. It takes the + // result + // of the unpack stage and stores it into the destination matrix. + template + void Execute(InputType input, DstType* dst, int src_global_row, + int src_global_col, int dst_row, int dst_col) const { + // Statically assert that the output pipeline matches the given destination + // matrix's scalar type. + typedef typename OutputPipelineOutputType< + OutputPipelineType, 0, InputType>::Type::BufferType::ScalarType + + ScalarOutputType; + typedef typename DstType::Scalar ScalarDstType; + static_assert(std::is_same::value, + "mismatched destination scalar type and output pipeline"); + + // Evaluate the output pipeline. + auto output = + output_pipeline_eval_impl_.Eval(input, src_global_row, src_global_col); + // Store the result into the destination matrix. + StoreFinalOutput(output, dst, dst_row, dst_col); + } + + const OutputPipelineEvalImpl + output_pipeline_eval_impl_; +}; + +} // namespace gemmlowp + +#ifdef GEMMLOWP_NEON +#include "output_neon.h" +#elif defined(GEMMLOWP_SSE4) +#include "output_sse.h" +#elif defined(GEMMLOWP_MSA) +#include "output_msa.h" +#endif + +#endif // GEMMLOWP_INTERNAL_OUTPUT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_avx.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_avx.h new file mode 100644 index 0000000000000000000000000000000000000000..b8f94fba537af5296028d8c9d4dbae8f2207c43c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_avx.h @@ -0,0 +1,19 @@ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// output_avx.h: optimized AVX 2 specializations of the templates in output.h. + +#ifndef GEMMLOWP_INTERNAL_OUTPUT_AVX_H_ +#define GEMMLOWP_INTERNAL_OUTPUT_AVX_H_ + +#endif // GEMMLOWP_INTERNAL_OUTPUT_AVX_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_msa.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_msa.h new file mode 100644 index 0000000000000000000000000000000000000000..0540bb34fc537b9cbbfca0312c1e8fb88f4c9a2b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_msa.h @@ -0,0 +1,1111 @@ +// Copyright 2018 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// output_msa.h: optimized MSA specializations of the templates in output.h. + +#ifndef GEMMLOWP_INTERNAL_OUTPUT_MSA_H_ +#define GEMMLOWP_INTERNAL_OUTPUT_MSA_H_ + +#include "output.h" + +#include + +namespace gemmlowp { + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<4> InputType; + typedef RegBufferUint8<4> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + // Signed saturate each 32-bit element to 9 bits + // (this takes full care of non-negative elements). + v4i32 tmp = __builtin_msa_sat_s_w(input.reg[0], 8); + // Zero out negative elements. + tmp = __builtin_msa_maxi_s_w(tmp, 0); + // Pack every 32-bit element into 16 bits. + tmp = reinterpret_cast(__builtin_msa_pckev_h( + reinterpret_cast(tmp), reinterpret_cast(tmp))); + // Pack every element into 8 bits. + tmp = reinterpret_cast(__builtin_msa_pckev_b( + reinterpret_cast(tmp), reinterpret_cast(tmp))); + // Return 4 uint8_t elements as uint32_t. + output.reg[0] = __builtin_msa_copy_s_w(tmp, 0); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<8> InputType; + typedef RegBufferUint8<8> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + // Signed saturate each 32-bit element to 9 bits + // (this takes full care of non-negative elements). + v4i32 tmp_lo = __builtin_msa_sat_s_w(input.reg[0], 8); + v4i32 tmp_hi = __builtin_msa_sat_s_w(input.reg[1], 8); + // Pack every 32-bit element into 16 bits, + // combining all 8 elements into one vector. + tmp_lo = reinterpret_cast(__builtin_msa_pckev_h( + reinterpret_cast(tmp_hi), reinterpret_cast(tmp_lo))); + // Zero out negative elements. + tmp_lo = reinterpret_cast(__builtin_msa_maxi_s_h( + reinterpret_cast(tmp_lo), 0)); + // Pack every element into 8 bits. + tmp_lo = reinterpret_cast(__builtin_msa_pckev_b( + reinterpret_cast(tmp_lo), reinterpret_cast(tmp_lo))); + // Return 8 uint8_t elements as 2 uint32_t's. + output.reg[0] = __builtin_msa_copy_s_w(tmp_lo, 0); + output.reg[1] = __builtin_msa_copy_s_w(tmp_lo, 1); + return output; + } +}; + +#define GEMMLOWP_MIPS_SAT_U8_16(out, in0, in1, in2, in3) \ + { \ + v4i32 tmp0 = __builtin_msa_sat_s_w(in0, 8); \ + v4i32 tmp1 = __builtin_msa_sat_s_w(in1, 8); \ + v4i32 tmp2 = __builtin_msa_sat_s_w(in2, 8); \ + v4i32 tmp3 = __builtin_msa_sat_s_w(in3, 8); \ + tmp0 = reinterpret_cast(__builtin_msa_pckev_h( \ + reinterpret_cast(tmp1), reinterpret_cast(tmp0))); \ + tmp2 = reinterpret_cast(__builtin_msa_pckev_h( \ + reinterpret_cast(tmp3), reinterpret_cast(tmp2))); \ + tmp0 = reinterpret_cast(__builtin_msa_maxi_s_h( \ + reinterpret_cast(tmp0), 0)); \ + tmp2 = reinterpret_cast(__builtin_msa_maxi_s_h( \ + reinterpret_cast(tmp2), 0)); \ + tmp0 = reinterpret_cast(__builtin_msa_pckev_b( \ + reinterpret_cast(tmp2), reinterpret_cast(tmp0))); \ + out = reinterpret_cast(tmp0); \ + } + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<16> InputType; + typedef RegBufferUint8<16> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + GEMMLOWP_MIPS_SAT_U8_16(output.reg[0], input.reg[0], input.reg[1], + input.reg[2], input.reg[3]); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<32> InputType; + typedef RegBufferUint8<32> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + GEMMLOWP_MIPS_SAT_U8_16(output.reg[0], input.reg[0], input.reg[1], + input.reg[2], input.reg[3]); + GEMMLOWP_MIPS_SAT_U8_16(output.reg[1], input.reg[4], input.reg[5], + input.reg[6], input.reg[7]); + return output; + } +}; + +#undef GEMMLOWP_MIPS_SAT_U8_16 + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<4> InputType; + typedef RegBufferInt16<4> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + // Signed saturate each 32-bit element to 16 bits. + v8i16 tmp = + reinterpret_cast(__builtin_msa_sat_s_w(input.reg[0], 15)); + output.reg[0] = __builtin_msa_copy_s_h(tmp, 0); + output.reg[1] = __builtin_msa_copy_s_h(tmp, 2); + output.reg[2] = __builtin_msa_copy_s_h(tmp, 4); + output.reg[3] = __builtin_msa_copy_s_h(tmp, 6); + return output; + } +}; + +#define GEMMLOWP_MIPS_SAT_I16_8(out, in0, in1) \ + { \ + v4i32 tmp0 = __builtin_msa_sat_s_w(in0, 15); \ + v4i32 tmp1 = __builtin_msa_sat_s_w(in1, 15); \ + out = __builtin_msa_pckev_h(reinterpret_cast(tmp1), \ + reinterpret_cast(tmp0)); \ + } + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<8> InputType; + typedef RegBufferInt16<8> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + GEMMLOWP_MIPS_SAT_I16_8(output.reg[0], input.reg[0], input.reg[1]); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<16> InputType; + typedef RegBufferInt16<16> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + GEMMLOWP_MIPS_SAT_I16_8(output.reg[0], input.reg[0], input.reg[1]); + GEMMLOWP_MIPS_SAT_I16_8(output.reg[1], input.reg[2], input.reg[3]); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<32> InputType; + typedef RegBufferInt16<32> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + GEMMLOWP_MIPS_SAT_I16_8(output.reg[0], input.reg[0], input.reg[1]); + GEMMLOWP_MIPS_SAT_I16_8(output.reg[1], input.reg[2], input.reg[3]); + GEMMLOWP_MIPS_SAT_I16_8(output.reg[2], input.reg[4], input.reg[5]); + GEMMLOWP_MIPS_SAT_I16_8(output.reg[3], input.reg[6], input.reg[7]); + return output; + } +}; + +#undef GEMMLOWP_MIPS_SAT_I16_8 + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<4> InputType; + typedef RegBufferUint8<4> OutputType; + + typedef OutputStageTruncatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + // Pack every 32-bit element into 16 bits. + v4i32 tmp = reinterpret_cast(__builtin_msa_pckev_h( + reinterpret_cast(input.reg[0]), + reinterpret_cast(input.reg[0]))); + // Pack every element into 8 bits. + tmp = reinterpret_cast(__builtin_msa_pckev_b( + reinterpret_cast(tmp), reinterpret_cast(tmp))); + // Return 4 uint8_t elements as uint32_t. + output.reg[0] = __builtin_msa_copy_s_w(tmp, 0); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<8> InputType; + typedef RegBufferUint8<8> OutputType; + + typedef OutputStageTruncatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + // Pack every 32-bit element into 16 bits. + v4i32 tmp = reinterpret_cast(__builtin_msa_pckev_h( + reinterpret_cast(input.reg[1]), + reinterpret_cast(input.reg[0]))); + // Pack every element into 8 bits. + tmp = reinterpret_cast(__builtin_msa_pckev_b( + reinterpret_cast(tmp), reinterpret_cast(tmp))); + // Return 8 uint8_t elements as 2 uint32_t's. + output.reg[0] = __builtin_msa_copy_s_w(tmp, 0); + output.reg[1] = __builtin_msa_copy_s_w(tmp, 1); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<16> InputType; + typedef RegBufferUint8<16> OutputType; + + typedef OutputStageTruncatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + // Pack every 32-bit element into 16 bits. + v8i16 tmp0 = __builtin_msa_pckev_h( + reinterpret_cast(input.reg[1]), + reinterpret_cast(input.reg[0])); + v8i16 tmp1 = __builtin_msa_pckev_h( + reinterpret_cast(input.reg[3]), + reinterpret_cast(input.reg[2])); + // Pack every element into 8 bits. + output.reg[0] = __builtin_msa_pckev_b( + reinterpret_cast(tmp1), reinterpret_cast(tmp0)); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<32> InputType; + typedef RegBufferUint8<32> OutputType; + + typedef OutputStageTruncatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + // Pack every 32-bit element into 16 bits. + v8i16 tmp0 = __builtin_msa_pckev_h( + reinterpret_cast(input.reg[1]), + reinterpret_cast(input.reg[0])); + v8i16 tmp1 = __builtin_msa_pckev_h( + reinterpret_cast(input.reg[3]), + reinterpret_cast(input.reg[2])); + v8i16 tmp2 = __builtin_msa_pckev_h( + reinterpret_cast(input.reg[5]), + reinterpret_cast(input.reg[4])); + v8i16 tmp3 = __builtin_msa_pckev_h( + reinterpret_cast(input.reg[7]), + reinterpret_cast(input.reg[6])); + // Pack every element into 8 bits. + output.reg[0] = __builtin_msa_pckev_b( + reinterpret_cast(tmp1), reinterpret_cast(tmp0)); + output.reg[1] = __builtin_msa_pckev_b( + reinterpret_cast(tmp3), reinterpret_cast(tmp2)); + return output; + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<4, 1>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + StoreInt32x4(dst->data(row, col), src.buf.reg[0]); + } else { + *dst->data(row + 0, col) = GetLane<0>(src.buf.reg[0]); + *dst->data(row + 1, col) = GetLane<1>(src.buf.reg[0]); + *dst->data(row + 2, col) = GetLane<2>(src.buf.reg[0]); + *dst->data(row + 3, col) = GetLane<3>(src.buf.reg[0]); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<8, 1>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + StoreInt32x4(dst->data(row, col), src.buf.reg[0]); + StoreInt32x4(dst->data(row + 4, col), src.buf.reg[1]); + } else { + *dst->data(row + 0, col) = GetLane<0>(src.buf.reg[0]); + *dst->data(row + 1, col) = GetLane<1>(src.buf.reg[0]); + *dst->data(row + 2, col) = GetLane<2>(src.buf.reg[0]); + *dst->data(row + 3, col) = GetLane<3>(src.buf.reg[0]); + *dst->data(row + 4, col) = GetLane<0>(src.buf.reg[1]); + *dst->data(row + 5, col) = GetLane<1>(src.buf.reg[1]); + *dst->data(row + 6, col) = GetLane<2>(src.buf.reg[1]); + *dst->data(row + 7, col) = GetLane<3>(src.buf.reg[1]); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<4, 1>& src, DstType* dst, int row, + int col) { + *dst->data(row + 0, col) = src.buf.reg[0]; + *dst->data(row + 1, col) = src.buf.reg[1]; + *dst->data(row + 2, col) = src.buf.reg[2]; + *dst->data(row + 3, col) = src.buf.reg[3]; + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<8, 1>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + StoreInt16x8(dst->data(row, col), src.buf.reg[0]); + } else { + *dst->data(row + 0, col) = __builtin_msa_copy_s_h(src.buf.reg[0], 0); + *dst->data(row + 1, col) = __builtin_msa_copy_s_h(src.buf.reg[0], 1); + *dst->data(row + 2, col) = __builtin_msa_copy_s_h(src.buf.reg[0], 2); + *dst->data(row + 3, col) = __builtin_msa_copy_s_h(src.buf.reg[0], 3); + *dst->data(row + 4, col) = __builtin_msa_copy_s_h(src.buf.reg[0], 4); + *dst->data(row + 5, col) = __builtin_msa_copy_s_h(src.buf.reg[0], 5); + *dst->data(row + 6, col) = __builtin_msa_copy_s_h(src.buf.reg[0], 6); + *dst->data(row + 7, col) = __builtin_msa_copy_s_h(src.buf.reg[0], 7); + } + } +}; + +inline RegBlockInt32<4, 4> Transpose(const RegBlockInt32<4, 4>& src) { + RegBlockInt32<4, 4> result; + v4i32 tmp0, tmp1; + tmp0 = __builtin_msa_ilvr_w(src.buf.reg[1], src.buf.reg[0]); + tmp1 = __builtin_msa_ilvr_w(src.buf.reg[3], src.buf.reg[2]); + result.buf.reg[0] = reinterpret_cast(__builtin_msa_ilvr_d( + reinterpret_cast(tmp1), reinterpret_cast(tmp0))); + result.buf.reg[1] = reinterpret_cast(__builtin_msa_ilvl_d( + reinterpret_cast(tmp1), reinterpret_cast(tmp0))); + tmp0 = __builtin_msa_ilvl_w(src.buf.reg[1], src.buf.reg[0]); + tmp1 = __builtin_msa_ilvl_w(src.buf.reg[3], src.buf.reg[2]); + result.buf.reg[2] = reinterpret_cast(__builtin_msa_ilvr_d( + reinterpret_cast(tmp1), reinterpret_cast(tmp0))); + result.buf.reg[3] = reinterpret_cast(__builtin_msa_ilvl_d( + reinterpret_cast(tmp1), reinterpret_cast(tmp0))); + return result; +} + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<4, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row, col + i), src.buf.reg[i]); + } + } else { + const auto transpose = Transpose(src); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + i, col), transpose.buf.reg[i]); + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<4, 4>& src, DstType* dst, int row, + int col) { + std::int16_t buf[16]; + StoreInt16x8(buf + 0, src.buf.reg[0]); + StoreInt16x8(buf + 8, src.buf.reg[1]); + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + *dst->data(row + i, col + j) = buf[i + 4 * j]; + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<8, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row, col + i), src.buf.reg[2 * i]); + StoreInt32x4(dst->data(row + 4, col + i), src.buf.reg[2 * i + 1]); + } + } else { + RegBlockInt32<4, 4> top; + top.buf.reg[0] = src.buf.reg[0]; + top.buf.reg[1] = src.buf.reg[2]; + top.buf.reg[2] = src.buf.reg[4]; + top.buf.reg[3] = src.buf.reg[6]; + const auto transpose_top = Transpose(top); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + i, col), transpose_top.buf.reg[i]); + } + RegBlockInt32<4, 4> bottom; + bottom.buf.reg[0] = src.buf.reg[1]; + bottom.buf.reg[1] = src.buf.reg[3]; + bottom.buf.reg[2] = src.buf.reg[5]; + bottom.buf.reg[3] = src.buf.reg[7]; + const auto transpose_bottom = Transpose(bottom); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + 4 + i, col), transpose_bottom.buf.reg[i]); + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<8, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 4; i++) { + StoreInt16x8(dst->data(row, col + i), src.buf.reg[i]); + } + } else { + std::int16_t buf[32]; + StoreInt16x8(buf + 0, src.buf.reg[0]); + StoreInt16x8(buf + 8, src.buf.reg[1]); + StoreInt16x8(buf + 16, src.buf.reg[2]); + StoreInt16x8(buf + 24, src.buf.reg[3]); + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 4; j++) { + *dst->data(row + i, col + j) = buf[i + 8 * j]; + } + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<8, 8>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 8; i++) { + StoreInt32x4(dst->data(row, col + i), src.buf.reg[2 * i]); + StoreInt32x4(dst->data(row + 4, col + i), src.buf.reg[2 * i + 1]); + } + } else { + RegBlockInt32<4, 4> top_left; + top_left.buf.reg[0] = src.buf.reg[0]; + top_left.buf.reg[1] = src.buf.reg[2]; + top_left.buf.reg[2] = src.buf.reg[4]; + top_left.buf.reg[3] = src.buf.reg[6]; + const auto transpose_top_left = Transpose(top_left); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + i, col), transpose_top_left.buf.reg[i]); + } + RegBlockInt32<4, 4> bottom_left; + bottom_left.buf.reg[0] = src.buf.reg[1]; + bottom_left.buf.reg[1] = src.buf.reg[3]; + bottom_left.buf.reg[2] = src.buf.reg[5]; + bottom_left.buf.reg[3] = src.buf.reg[7]; + const auto transpose_bottom_left = Transpose(bottom_left); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + 4 + i, col), + transpose_bottom_left.buf.reg[i]); + } + RegBlockInt32<4, 4> top_right; + top_right.buf.reg[0] = src.buf.reg[8]; + top_right.buf.reg[1] = src.buf.reg[10]; + top_right.buf.reg[2] = src.buf.reg[12]; + top_right.buf.reg[3] = src.buf.reg[14]; + const auto transpose_top_right = Transpose(top_right); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + i, col + 4), + transpose_top_right.buf.reg[i]); + } + RegBlockInt32<4, 4> bottom_right; + bottom_right.buf.reg[0] = src.buf.reg[9]; + bottom_right.buf.reg[1] = src.buf.reg[11]; + bottom_right.buf.reg[2] = src.buf.reg[13]; + bottom_right.buf.reg[3] = src.buf.reg[15]; + const auto transpose_bottom_right = Transpose(bottom_right); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + 4 + i, col + 4), + transpose_bottom_right.buf.reg[i]); + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<8, 8>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 8; i++) { + StoreInt16x8(dst->data(row, col + i), src.buf.reg[i]); + } + } else { + // top-left 4x4 + v4i32 t0 = reinterpret_cast( + __builtin_msa_ilvr_h(src.buf.reg[1], src.buf.reg[0])); + v4i32 t1 = reinterpret_cast( + __builtin_msa_ilvr_h(src.buf.reg[3], src.buf.reg[2])); + v2i64 u0 = reinterpret_cast(__builtin_msa_ilvr_w(t1, t0)); + v2i64 u1 = reinterpret_cast(__builtin_msa_ilvl_w(t1, t0)); + // top-right 4x4 + v4i32 t2 = reinterpret_cast( + __builtin_msa_ilvr_h(src.buf.reg[5], src.buf.reg[4])); + v4i32 t3 = reinterpret_cast( + __builtin_msa_ilvr_h(src.buf.reg[7], src.buf.reg[6])); + v2i64 u2 = reinterpret_cast(__builtin_msa_ilvr_w(t3, t2)); + v2i64 u3 = reinterpret_cast(__builtin_msa_ilvl_w(t3, t2)); + // bottom-left 4x4 + v4i32 t4 = reinterpret_cast( + __builtin_msa_ilvl_h(src.buf.reg[1], src.buf.reg[0])); + v4i32 t5 = reinterpret_cast( + __builtin_msa_ilvl_h(src.buf.reg[3], src.buf.reg[2])); + v2i64 u4 = reinterpret_cast(__builtin_msa_ilvr_w(t5, t4)); + v2i64 u5 = reinterpret_cast(__builtin_msa_ilvl_w(t5, t4)); + // bottom-right 4x4 + v4i32 t6 = reinterpret_cast( + __builtin_msa_ilvl_h(src.buf.reg[5], src.buf.reg[4])); + v4i32 t7 = reinterpret_cast( + __builtin_msa_ilvl_h(src.buf.reg[7], src.buf.reg[6])); + v2i64 u6 = reinterpret_cast(__builtin_msa_ilvr_w(t7, t6)); + v2i64 u7 = reinterpret_cast(__builtin_msa_ilvl_w(t7, t6)); + + StoreInt16x8(dst->data(row + 0, col), + reinterpret_cast(__builtin_msa_ilvr_d(u2, u0))); + StoreInt16x8(dst->data(row + 1, col), + reinterpret_cast(__builtin_msa_ilvl_d(u2, u0))); + StoreInt16x8(dst->data(row + 2, col), + reinterpret_cast(__builtin_msa_ilvr_d(u3, u1))); + StoreInt16x8(dst->data(row + 3, col), + reinterpret_cast(__builtin_msa_ilvl_d(u3, u1))); + StoreInt16x8(dst->data(row + 4, col), + reinterpret_cast(__builtin_msa_ilvr_d(u6, u4))); + StoreInt16x8(dst->data(row + 5, col), + reinterpret_cast(__builtin_msa_ilvl_d(u6, u4))); + StoreInt16x8(dst->data(row + 6, col), + reinterpret_cast(__builtin_msa_ilvr_d(u7, u5))); + StoreInt16x8(dst->data(row + 7, col), + reinterpret_cast(__builtin_msa_ilvl_d(u7, u5))); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<1, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + *dst->data(row, col + 0) = GetLane<0>(src.buf.reg[0]); + *dst->data(row, col + 1) = GetLane<1>(src.buf.reg[0]); + *dst->data(row, col + 2) = GetLane<2>(src.buf.reg[0]); + *dst->data(row, col + 3) = GetLane<3>(src.buf.reg[0]); + } else { + StoreInt32x4(dst->data(row, col), src.buf.reg[0]); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<4, 1>& src, DstType* dst, int row, + int col) { + const std::uint32_t src_reg = src.buf.reg[0]; + for (int i = 0; i < 4; i++) { + *dst->data(row + i, col) = (src_reg >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 1>& src, DstType* dst, int row, + int col) { + for (int i = 0; i < 4; i++) { + *dst->data(row + i, col) = (src.buf.reg[0] >> (8 * i)); + } + for (int i = 0; i < 4; i++) { + *dst->data(row + 4 + i, col) = (src.buf.reg[1] >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<1, 4>& src, DstType* dst, int row, + int col) { + for (int i = 0; i < 4; i++) { + *dst->data(row, col + i) = (src.buf.reg[0] >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<4, 4>& src, DstType* dst, int row, + int col) { + std::uint8_t buf[16]; + StoreUint8x16(buf, src.buf.reg[0]); + for (int c = 0; c < 4; c++) { + for (int r = 0; r < 4; r++) { + *dst->data(row + r, col + c) = buf[r + 4 * c]; + } + } + } +}; + +// There's no way to express in C++ the desired machine code for +// StoreFinalOutputImpl, DstType> and +// StoreFinalOutputImpl, DstType>. +// Hence, if we can, we use inline assembly, which takes advantage +// of little-endian byte order and specifics of different CPU revisions. +// Note, clang currently can't derive MSA register names from floating- +// point register names and vice versa in inline assembly. +#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) && \ + !defined(__clang__) + +// Instructions for pointer-sized operands. +#ifdef GEMMLOWP_MIPS_64 +#define GEMMLOWP_MIPS_XADDU "daddu" +#define GEMMLOWP_MIPS_XLSA "dlsa" +#else +#define GEMMLOWP_MIPS_XADDU "addu" +#define GEMMLOWP_MIPS_XLSA "lsa" +#endif + +// Stores 4 8-byte half-vectors with a stride. +inline void MipsMsaStore4x8(const RegBlockUint8<8, 4>& src, + std::uint8_t* dst_ptr, int stride) { +#if (__mips_isa_rev >= 6) + // Assembly temporaries that will be handily referred to by their names. + std::uint8_t *dst_ptr1, *dst_ptr2, *dst_ptr3; + v16i8 vtmp0, vtmp1; + asm volatile( + GEMMLOWP_MIPS_XADDU " %[dst_ptr1], %[dst_ptr0], %[stride]\n" + "ilvl.d %w[vtmp0], %w[src0], %w[src0]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr2], %[stride], %[dst_ptr0], 1\n" + "ilvl.d %w[vtmp1], %w[src1], %w[src1]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr3], %[stride], %[dst_ptr1], 1\n" + "sdc1 %[src0], 0(%[dst_ptr0])\n" + "sdc1 %[vtmp0], 0(%[dst_ptr1])\n" + "sdc1 %[src1], 0(%[dst_ptr2])\n" + "sdc1 %[vtmp1], 0(%[dst_ptr3])\n" + : + // Outputs. + [dst_ptr0] "+r"(dst_ptr), [dst_ptr1] "=&r"(dst_ptr1), + [dst_ptr2] "=&r"(dst_ptr2), [dst_ptr3] "=&r"(dst_ptr3), + [vtmp0] "=&f"(vtmp0), [vtmp1] "=&f"(vtmp1) + : + // Inputs. + [src0] "f"(src.buf.reg[0]), [src1] "f"(src.buf.reg[1]), + [stride] "r"(stride) + : + // Clobbers. + "memory"); +#else + // Assembly temporaries that will be handily referred to by their names. + std::uint8_t *dst_ptr1, *dst_ptr2, *dst_ptr3; + int tmp0, tmp1, tmp2, tmp3; + asm volatile( + GEMMLOWP_MIPS_XADDU " %[dst_ptr1], %[dst_ptr0], %[stride]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr2], %[stride], %[dst_ptr0], 1\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr3], %[stride], %[dst_ptr1], 1\n" + "copy_s.w %[tmp0], %w[src0][0]\n" + "copy_s.w %[tmp1], %w[src0][1]\n" + "copy_s.w %[tmp2], %w[src0][2]\n" + "copy_s.w %[tmp3], %w[src0][3]\n" + "swr %[tmp0], 0(%[dst_ptr0])\n" + "swl %[tmp0], 3(%[dst_ptr0])\n" + "swr %[tmp1], 4(%[dst_ptr0])\n" + "swl %[tmp1], 7(%[dst_ptr0])\n" + "swr %[tmp2], 0(%[dst_ptr1])\n" + "swl %[tmp2], 3(%[dst_ptr1])\n" + "swr %[tmp3], 4(%[dst_ptr1])\n" + "swl %[tmp3], 7(%[dst_ptr1])\n" + "copy_s.w %[tmp0], %w[src1][0]\n" + "copy_s.w %[tmp1], %w[src1][1]\n" + "copy_s.w %[tmp2], %w[src1][2]\n" + "copy_s.w %[tmp3], %w[src1][3]\n" + "swr %[tmp0], 0(%[dst_ptr2])\n" + "swl %[tmp0], 3(%[dst_ptr2])\n" + "swr %[tmp1], 4(%[dst_ptr2])\n" + "swl %[tmp1], 7(%[dst_ptr2])\n" + "swr %[tmp2], 0(%[dst_ptr3])\n" + "swl %[tmp2], 3(%[dst_ptr3])\n" + "swr %[tmp3], 4(%[dst_ptr3])\n" + "swl %[tmp3], 7(%[dst_ptr3])\n" + : + // Outputs. + [dst_ptr0] "+r"(dst_ptr), [dst_ptr1] "=&r"(dst_ptr1), + [dst_ptr2] "=&r"(dst_ptr2), [dst_ptr3] "=&r"(dst_ptr3), [tmp0] "=&r"(tmp0), + [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), [tmp3] "=&r"(tmp3) + : + // Inputs. + [src0] "f"(src.buf.reg[0]), [src1] "f"(src.buf.reg[1]), + [stride] "r"(stride) + : + // Clobbers. + "memory"); +#endif +} + +// Stores 8 4-byte quarter-vectors with a stride. +inline void MipsMsaStore8x4(const RegBlockUint8<4, 8>& src, + std::uint8_t* dst_ptr, int stride) { +#if (__mips_isa_rev >= 6) + // Assembly temporaries that will be handily referred to by their names. + std::uint8_t *dst_ptr1, *dst_ptr2, *dst_ptr3, *dst_ptr4, *dst_ptr5, + *dst_ptr6, *dst_ptr7; + int tmp1, tmp2, tmp3; + asm volatile( + GEMMLOWP_MIPS_XADDU " %[dst_ptr1], %[dst_ptr0], %[stride]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr2], %[stride], %[dst_ptr0], 1\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr4], %[stride], %[dst_ptr0], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr3], %[stride], %[dst_ptr1], 1\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr5], %[stride], %[dst_ptr1], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr6], %[stride], %[dst_ptr2], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr7], %[stride], %[dst_ptr3], 2\n" + "copy_s.w %[tmp1], %w[src0][1]\n" + "copy_s.w %[tmp2], %w[src0][2]\n" + "copy_s.w %[tmp3], %w[src0][3]\n" + "swc1 %[src0], 0(%[dst_ptr0])\n" + "sw %[tmp1], 0(%[dst_ptr1])\n" + "sw %[tmp2], 0(%[dst_ptr2])\n" + "sw %[tmp3], 0(%[dst_ptr3])\n" + "copy_s.w %[tmp1], %w[src1][1]\n" + "copy_s.w %[tmp2], %w[src1][2]\n" + "copy_s.w %[tmp3], %w[src1][3]\n" + "swc1 %[src1], 0(%[dst_ptr4])\n" + "sw %[tmp1], 0(%[dst_ptr5])\n" + "sw %[tmp2], 0(%[dst_ptr6])\n" + "sw %[tmp3], 0(%[dst_ptr7])\n" + : + // Outputs. + [dst_ptr0] "+r"(dst_ptr), [dst_ptr1] "=&r"(dst_ptr1), + [dst_ptr2] "=&r"(dst_ptr2), [dst_ptr3] "=&r"(dst_ptr3), + [dst_ptr4] "=&r"(dst_ptr4), [dst_ptr5] "=&r"(dst_ptr5), + [dst_ptr6] "=&r"(dst_ptr6), [dst_ptr7] "=&r"(dst_ptr7), + [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), [tmp3] "=&r"(tmp3) + : + // Inputs. + [src0] "f"(src.buf.reg[0]), [src1] "f"(src.buf.reg[1]), + [stride] "r"(stride) + : + // Clobbers. + "memory"); +#else + // Assembly temporaries that will be handily referred to by their names. + std::uint8_t *dst_ptr1, *dst_ptr2, *dst_ptr3, *dst_ptr4, *dst_ptr5, + *dst_ptr6, *dst_ptr7; + int tmp0, tmp1, tmp2, tmp3; + asm volatile( + GEMMLOWP_MIPS_XADDU " %[dst_ptr1], %[dst_ptr0], %[stride]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr2], %[stride], %[dst_ptr0], 1\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr4], %[stride], %[dst_ptr0], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr3], %[stride], %[dst_ptr1], 1\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr5], %[stride], %[dst_ptr1], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr6], %[stride], %[dst_ptr2], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr7], %[stride], %[dst_ptr3], 2\n" + "copy_s.w %[tmp0], %w[src0][0]\n" + "copy_s.w %[tmp1], %w[src0][1]\n" + "copy_s.w %[tmp2], %w[src0][2]\n" + "copy_s.w %[tmp3], %w[src0][3]\n" + "swr %[tmp0], 0(%[dst_ptr0])\n" + "swl %[tmp0], 3(%[dst_ptr0])\n" + "swr %[tmp1], 0(%[dst_ptr1])\n" + "swl %[tmp1], 3(%[dst_ptr1])\n" + "swr %[tmp2], 0(%[dst_ptr2])\n" + "swl %[tmp2], 3(%[dst_ptr2])\n" + "swr %[tmp3], 0(%[dst_ptr3])\n" + "swl %[tmp3], 3(%[dst_ptr3])\n" + "copy_s.w %[tmp0], %w[src1][0]\n" + "copy_s.w %[tmp1], %w[src1][1]\n" + "copy_s.w %[tmp2], %w[src1][2]\n" + "copy_s.w %[tmp3], %w[src1][3]\n" + "swr %[tmp0], 0(%[dst_ptr4])\n" + "swl %[tmp0], 3(%[dst_ptr4])\n" + "swr %[tmp1], 0(%[dst_ptr5])\n" + "swl %[tmp1], 3(%[dst_ptr5])\n" + "swr %[tmp2], 0(%[dst_ptr6])\n" + "swl %[tmp2], 3(%[dst_ptr6])\n" + "swr %[tmp3], 0(%[dst_ptr7])\n" + "swl %[tmp3], 3(%[dst_ptr7])\n" + : + // Outputs. + [dst_ptr0] "+r"(dst_ptr), [dst_ptr1] "=&r"(dst_ptr1), + [dst_ptr2] "=&r"(dst_ptr2), [dst_ptr3] "=&r"(dst_ptr3), + [dst_ptr4] "=&r"(dst_ptr4), [dst_ptr5] "=&r"(dst_ptr5), + [dst_ptr6] "=&r"(dst_ptr6), [dst_ptr7] "=&r"(dst_ptr7), + [tmp0] "=&r"(tmp0), [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), + [tmp3] "=&r"(tmp3) + : + // Inputs. + [src0] "f"(src.buf.reg[0]), [src1] "f"(src.buf.reg[1]), + [stride] "r"(stride) + : + // Clobbers. + "memory"); +#endif +} + +// Stores 8 8-byte half-vectors with a stride. +inline void MipsMsaStore8x8(const RegBlockUint8<8, 8>& src, + std::uint8_t* dst_ptr, int stride) { +#if (__mips_isa_rev >= 6) + // Assembly temporaries that will be handily referred to by their names. + std::uint8_t *dst_ptr1, *dst_ptr2, *dst_ptr3, *dst_ptr4, *dst_ptr5, + *dst_ptr6, *dst_ptr7; + v16i8 vtmp0, vtmp1, vtmp2, vtmp3; + asm volatile( + "ilvl.d %w[vtmp0], %w[src0], %w[src0]\n" + GEMMLOWP_MIPS_XADDU " %[dst_ptr1], %[dst_ptr0], %[stride]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr2], %[stride], %[dst_ptr0], 1\n" + "ilvl.d %w[vtmp1], %w[src1], %w[src1]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr4], %[stride], %[dst_ptr0], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr3], %[stride], %[dst_ptr1], 1\n" + "ilvl.d %w[vtmp2], %w[src2], %w[src2]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr5], %[stride], %[dst_ptr1], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr6], %[stride], %[dst_ptr2], 2\n" + "ilvl.d %w[vtmp3], %w[src3], %w[src3]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr7], %[stride], %[dst_ptr3], 2\n" + "sdc1 %[src0], 0(%[dst_ptr0])\n" + "sdc1 %[vtmp0], 0(%[dst_ptr1])\n" + "sdc1 %[src1], 0(%[dst_ptr2])\n" + "sdc1 %[vtmp1], 0(%[dst_ptr3])\n" + "sdc1 %[src2], 0(%[dst_ptr4])\n" + "sdc1 %[vtmp2], 0(%[dst_ptr5])\n" + "sdc1 %[src3], 0(%[dst_ptr6])\n" + "sdc1 %[vtmp3], 0(%[dst_ptr7])\n" + : + // Outputs. + [dst_ptr0] "+r"(dst_ptr), [dst_ptr1] "=&r"(dst_ptr1), + [dst_ptr2] "=&r"(dst_ptr2), [dst_ptr3] "=&r"(dst_ptr3), + [dst_ptr4] "=&r"(dst_ptr4), [dst_ptr5] "=&r"(dst_ptr5), + [dst_ptr6] "=&r"(dst_ptr6), [dst_ptr7] "=&r"(dst_ptr7), + [vtmp0] "=&f"(vtmp0), [vtmp1] "=&f"(vtmp1), [vtmp2] "=&f"(vtmp2), + [vtmp3] "=&f"(vtmp3) + : + // Inputs. + [src0] "f"(src.buf.reg[0]), [src1] "f"(src.buf.reg[1]), + [src2] "f"(src.buf.reg[2]), [src3] "f"(src.buf.reg[3]), + [stride] "r"(stride) + : + // Clobbers. + "memory"); +#else + // Assembly temporaries that will be handily referred to by their names. + std::uint8_t *dst_ptr1, *dst_ptr2, *dst_ptr3, *dst_ptr4, *dst_ptr5, + *dst_ptr6, *dst_ptr7; + int tmp0, tmp1, tmp2, tmp3; + asm volatile( + GEMMLOWP_MIPS_XADDU " %[dst_ptr1], %[dst_ptr0], %[stride]\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr2], %[stride], %[dst_ptr0], 1\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr4], %[stride], %[dst_ptr0], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr3], %[stride], %[dst_ptr1], 1\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr5], %[stride], %[dst_ptr1], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr6], %[stride], %[dst_ptr2], 2\n" + GEMMLOWP_MIPS_XLSA " %[dst_ptr7], %[stride], %[dst_ptr3], 2\n" + "copy_s.w %[tmp0], %w[src0][0]\n" + "copy_s.w %[tmp1], %w[src0][1]\n" + "copy_s.w %[tmp2], %w[src0][2]\n" + "copy_s.w %[tmp3], %w[src0][3]\n" + "swr %[tmp0], 0(%[dst_ptr0])\n" + "swl %[tmp0], 3(%[dst_ptr0])\n" + "swr %[tmp1], 4(%[dst_ptr0])\n" + "swl %[tmp1], 7(%[dst_ptr0])\n" + "swr %[tmp2], 0(%[dst_ptr1])\n" + "swl %[tmp2], 3(%[dst_ptr1])\n" + "swr %[tmp3], 4(%[dst_ptr1])\n" + "swl %[tmp3], 7(%[dst_ptr1])\n" + "copy_s.w %[tmp0], %w[src1][0]\n" + "copy_s.w %[tmp1], %w[src1][1]\n" + "copy_s.w %[tmp2], %w[src1][2]\n" + "copy_s.w %[tmp3], %w[src1][3]\n" + "swr %[tmp0], 0(%[dst_ptr2])\n" + "swl %[tmp0], 3(%[dst_ptr2])\n" + "swr %[tmp1], 4(%[dst_ptr2])\n" + "swl %[tmp1], 7(%[dst_ptr2])\n" + "swr %[tmp2], 0(%[dst_ptr3])\n" + "swl %[tmp2], 3(%[dst_ptr3])\n" + "swr %[tmp3], 4(%[dst_ptr3])\n" + "swl %[tmp3], 7(%[dst_ptr3])\n" + "copy_s.w %[tmp0], %w[src2][0]\n" + "copy_s.w %[tmp1], %w[src2][1]\n" + "copy_s.w %[tmp2], %w[src2][2]\n" + "copy_s.w %[tmp3], %w[src2][3]\n" + "swr %[tmp0], 0(%[dst_ptr4])\n" + "swl %[tmp0], 3(%[dst_ptr4])\n" + "swr %[tmp1], 4(%[dst_ptr4])\n" + "swl %[tmp1], 7(%[dst_ptr4])\n" + "swr %[tmp2], 0(%[dst_ptr5])\n" + "swl %[tmp2], 3(%[dst_ptr5])\n" + "swr %[tmp3], 4(%[dst_ptr5])\n" + "swl %[tmp3], 7(%[dst_ptr5])\n" + "copy_s.w %[tmp0], %w[src3][0]\n" + "copy_s.w %[tmp1], %w[src3][1]\n" + "copy_s.w %[tmp2], %w[src3][2]\n" + "copy_s.w %[tmp3], %w[src3][3]\n" + "swr %[tmp0], 0(%[dst_ptr6])\n" + "swl %[tmp0], 3(%[dst_ptr6])\n" + "swr %[tmp1], 4(%[dst_ptr6])\n" + "swl %[tmp1], 7(%[dst_ptr6])\n" + "swr %[tmp2], 0(%[dst_ptr7])\n" + "swl %[tmp2], 3(%[dst_ptr7])\n" + "swr %[tmp3], 4(%[dst_ptr7])\n" + "swl %[tmp3], 7(%[dst_ptr7])\n" + : + // Outputs. + [dst_ptr0] "+r"(dst_ptr), [dst_ptr1] "=&r"(dst_ptr1), + [dst_ptr2] "=&r"(dst_ptr2), [dst_ptr3] "=&r"(dst_ptr3), + [dst_ptr4] "=&r"(dst_ptr4), [dst_ptr5] "=&r"(dst_ptr5), + [dst_ptr6] "=&r"(dst_ptr6), [dst_ptr7] "=&r"(dst_ptr7), + [tmp0] "=&r"(tmp0), [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), + [tmp3] "=&r"(tmp3) + : + // Inputs. + [src0] "f"(src.buf.reg[0]), [src1] "f"(src.buf.reg[1]), + [src2] "f"(src.buf.reg[2]), [src3] "f"(src.buf.reg[3]), + [stride] "r"(stride) + : + // Clobbers. + "memory"); +#endif +} + +#undef GEMMLOWP_MIPS_XADDU +#undef GEMMLOWP_MIPS_XLSA + +// Transposes a column-major 8x4 block for storage into a row-major matrix. +inline RegBlockUint8<4, 8> Transpose(const RegBlockUint8<8, 4>& src) { + v16i8 tmp0 = __builtin_msa_ilvr_b(src.buf.reg[1], src.buf.reg[0]); + v16i8 tmp1 = __builtin_msa_ilvl_b(src.buf.reg[1], src.buf.reg[0]); + RegBlockUint8<4, 8> result; + result.buf.reg[0] = __builtin_msa_ilvr_b(tmp1, tmp0); + result.buf.reg[1] = __builtin_msa_ilvl_b(tmp1, tmp0); + return result; +} + +inline RegBlockUint8<8, 8> Transpose(const RegBlockUint8<8, 8>& src) { + v16i8 tmp0[4]; + tmp0[0] = __builtin_msa_ilvr_b(src.buf.reg[1], src.buf.reg[0]); + tmp0[1] = __builtin_msa_ilvl_b(src.buf.reg[1], src.buf.reg[0]); + tmp0[2] = __builtin_msa_ilvr_b(src.buf.reg[3], src.buf.reg[2]); + tmp0[3] = __builtin_msa_ilvl_b(src.buf.reg[3], src.buf.reg[2]); + v16i8 tmp1[4]; + tmp1[0] = __builtin_msa_ilvr_b(tmp0[1], tmp0[0]); + tmp1[1] = __builtin_msa_ilvl_b(tmp0[1], tmp0[0]); + tmp1[2] = __builtin_msa_ilvr_b(tmp0[3], tmp0[2]); + tmp1[3] = __builtin_msa_ilvl_b(tmp0[3], tmp0[2]); + RegBlockUint8<8, 8> result; + result.buf.reg[0] = reinterpret_cast(__builtin_msa_ilvr_w( + reinterpret_cast(tmp1[2]), reinterpret_cast(tmp1[0]))); + result.buf.reg[1] = reinterpret_cast(__builtin_msa_ilvl_w( + reinterpret_cast(tmp1[2]), reinterpret_cast(tmp1[0]))); + result.buf.reg[2] = reinterpret_cast(__builtin_msa_ilvr_w( + reinterpret_cast(tmp1[3]), reinterpret_cast(tmp1[1]))); + result.buf.reg[3] = reinterpret_cast(__builtin_msa_ilvl_w( + reinterpret_cast(tmp1[3]), reinterpret_cast(tmp1[1]))); + return result; +} + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + std::uint8_t* dst_ptr = dst->data(row, col); + int col_stride = dst->cols_stride(); + MipsMsaStore4x8(src, dst_ptr, col_stride); + } else { + const auto& block = Transpose(src); + std::uint8_t* dst_ptr = dst->data(row, col); + int row_stride = dst->rows_stride(); + MipsMsaStore8x4(block, dst_ptr, row_stride); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 8>& src, DstType* dst, int row, + int col) { + const auto& block = + (DstType::kOrder == MapOrder::ColMajor) ? src : Transpose(src); + std::uint8_t* dst_ptr = dst->data(row, col); + int stride = dst->stride(); + MipsMsaStore8x8(block, dst_ptr, stride); + } +}; + +#else + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 4>& src, DstType* dst, int row, + int col) { + std::uint8_t buf[32]; + StoreUint8x16(buf, src.buf.reg[0]); + StoreUint8x16(buf + 16, src.buf.reg[1]); + for (int c = 0; c < 4; c++) { + for (int r = 0; r < 8; r++) { + *dst->data(row + r, col + c) = buf[r + 8 * c]; + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 8>& src, DstType* dst, int row, + int col) { + std::uint8_t buf[64]; + StoreUint8x16(buf, src.buf.reg[0]); + StoreUint8x16(buf + 16, src.buf.reg[1]); + StoreUint8x16(buf + 32, src.buf.reg[2]); + StoreUint8x16(buf + 48, src.buf.reg[3]); + for (int c = 0; c < 8; c++) { + for (int r = 0; r < 8; r++) { + *dst->data(row + r, col + c) = buf[r + 8 * c]; + } + } + } +}; + +#endif // Endianness, compiler. + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_OUTPUT_MSA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_neon.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_neon.h new file mode 100644 index 0000000000000000000000000000000000000000..52ea1bc457991fd82f6c27bbd9251bff40e701ca --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_neon.h @@ -0,0 +1,922 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// output_neon.h: optimized NEON specializations of the templates in output.h. + +#ifndef GEMMLOWP_INTERNAL_OUTPUT_NEON_H_ +#define GEMMLOWP_INTERNAL_OUTPUT_NEON_H_ + +#include "output.h" + +#include + +namespace gemmlowp { + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<4> InputType; + typedef RegBufferUint8<4> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + int16x4_t res_16 = vqmovn_s32(input.reg[0]); + uint8x8_t res_8 = vqmovun_s16(vcombine_s16(res_16, res_16)); + output.reg[0] = vget_lane_u32(vreinterpret_u32_u8(res_8), 0); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<8> InputType; + typedef RegBufferUint8<8> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + int16x8_t res_16 = + vcombine_s16(vqmovn_s32(input.reg[0]), vqmovn_s32(input.reg[1])); + output.reg[0] = vqmovun_s16(res_16); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<16> InputType; + typedef RegBufferUint8<16> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + int16x8_t res_16_0 = + vcombine_s16(vqmovn_s32(input.reg[0]), vqmovn_s32(input.reg[1])); + int16x8_t res_16_1 = + vcombine_s16(vqmovn_s32(input.reg[2]), vqmovn_s32(input.reg[3])); + output.reg[0] = vqmovun_s16(res_16_0); + output.reg[1] = vqmovun_s16(res_16_1); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<32> InputType; + typedef RegBufferUint8<32> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + int16x8_t res_16[4]; + for (int i = 0; i < 4; i++) { + res_16[i] = vcombine_s16(vqmovn_s32(input.reg[2 * i]), + vqmovn_s32(input.reg[2 * i + 1])); + } + for (int i = 0; i < 4; i++) { + output.reg[i] = vqmovun_s16(res_16[i]); + } + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<4> InputType; + typedef RegBufferInt8<4> OutputType; + + typedef OutputStageSaturatingCastToInt8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + int16x4_t res_16 = vqmovn_s32(input.reg[0]); + int8x8_t res_8 = vqmovn_s16(vcombine_s16(res_16, res_16)); + output.reg[0] = vget_lane_s32(vreinterpret_s32_s8(res_8), 0); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<8> InputType; + typedef RegBufferInt8<8> OutputType; + + typedef OutputStageSaturatingCastToInt8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + int16x8_t res_16 = + vcombine_s16(vqmovn_s32(input.reg[0]), vqmovn_s32(input.reg[1])); + output.reg[0] = vqmovn_s16(res_16); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<16> InputType; + typedef RegBufferInt8<16> OutputType; + + typedef OutputStageSaturatingCastToInt8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + int16x8_t res_16_0 = + vcombine_s16(vqmovn_s32(input.reg[0]), vqmovn_s32(input.reg[1])); + int16x8_t res_16_1 = + vcombine_s16(vqmovn_s32(input.reg[2]), vqmovn_s32(input.reg[3])); + output.reg[0] = vqmovn_s16(res_16_0); + output.reg[1] = vqmovn_s16(res_16_1); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<32> InputType; + typedef RegBufferInt8<32> OutputType; + + typedef OutputStageSaturatingCastToInt8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + int16x8_t res_16[4]; + for (int i = 0; i < 4; i++) { + res_16[i] = vcombine_s16(vqmovn_s32(input.reg[2 * i]), + vqmovn_s32(input.reg[2 * i + 1])); + } + for (int i = 0; i < 4; i++) { + output.reg[i] = vqmovn_s16(res_16[i]); + } + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<4> InputType; + typedef RegBufferInt16<4> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + output.reg[0] = vqmovn_s32(input.reg[0]); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<8> InputType; + typedef RegBufferInt16<8> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + output.reg[0] = + vcombine_s16(vqmovn_s32(input.reg[0]), vqmovn_s32(input.reg[1])); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<16> InputType; + typedef RegBufferInt16<16> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + output.reg[0] = + vcombine_s16(vqmovn_s32(input.reg[0]), vqmovn_s32(input.reg[1])); + output.reg[1] = + vcombine_s16(vqmovn_s32(input.reg[2]), vqmovn_s32(input.reg[3])); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<32> InputType; + typedef RegBufferInt16<32> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + output.reg[0] = + vcombine_s16(vqmovn_s32(input.reg[0]), vqmovn_s32(input.reg[1])); + output.reg[1] = + vcombine_s16(vqmovn_s32(input.reg[2]), vqmovn_s32(input.reg[3])); + output.reg[2] = + vcombine_s16(vqmovn_s32(input.reg[4]), vqmovn_s32(input.reg[5])); + output.reg[3] = + vcombine_s16(vqmovn_s32(input.reg[6]), vqmovn_s32(input.reg[7])); + return output; + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<8, 1>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + StoreInt32x4(dst->data(row, col), src.buf.reg[0]); + StoreInt32x4(dst->data(row + 4, col), src.buf.reg[1]); + } else { + vst1q_lane_s32(dst->data(row + 0, col), src.buf.reg[0], 0); + vst1q_lane_s32(dst->data(row + 1, col), src.buf.reg[0], 1); + vst1q_lane_s32(dst->data(row + 2, col), src.buf.reg[0], 2); + vst1q_lane_s32(dst->data(row + 3, col), src.buf.reg[0], 3); + vst1q_lane_s32(dst->data(row + 4, col), src.buf.reg[1], 0); + vst1q_lane_s32(dst->data(row + 5, col), src.buf.reg[1], 1); + vst1q_lane_s32(dst->data(row + 6, col), src.buf.reg[1], 2); + vst1q_lane_s32(dst->data(row + 7, col), src.buf.reg[1], 3); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<4, 1>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + StoreInt16x4(dst->data(row, col), src.buf.reg[0]); + } else { + vst1_lane_s16(dst->data(row + 0, col), src.buf.reg[0], 0); + vst1_lane_s16(dst->data(row + 1, col), src.buf.reg[0], 1); + vst1_lane_s16(dst->data(row + 2, col), src.buf.reg[0], 2); + vst1_lane_s16(dst->data(row + 3, col), src.buf.reg[0], 3); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<8, 1>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + StoreInt16x8(dst->data(row, col), src.buf.reg[0]); + } else { + vst1q_lane_s16(dst->data(row + 0, col), src.buf.reg[0], 0); + vst1q_lane_s16(dst->data(row + 1, col), src.buf.reg[0], 1); + vst1q_lane_s16(dst->data(row + 2, col), src.buf.reg[0], 2); + vst1q_lane_s16(dst->data(row + 3, col), src.buf.reg[0], 3); + vst1q_lane_s16(dst->data(row + 4, col), src.buf.reg[0], 4); + vst1q_lane_s16(dst->data(row + 5, col), src.buf.reg[0], 5); + vst1q_lane_s16(dst->data(row + 6, col), src.buf.reg[0], 6); + vst1q_lane_s16(dst->data(row + 7, col), src.buf.reg[0], 7); + } + } +}; + +inline RegBlockInt32<4, 4> Transpose(const RegBlockInt32<4, 4>& src) { + const int32x4x2_t t0 = vtrnq_s32(src.buf.reg[0], src.buf.reg[1]); + const int32x4x2_t t1 = vtrnq_s32(src.buf.reg[2], src.buf.reg[3]); + RegBlockInt32<4, 4> result; + result.buf.reg[0] = + vcombine_s32(vget_low_s32(t0.val[0]), vget_low_s32(t1.val[0])); + result.buf.reg[1] = + vcombine_s32(vget_low_s32(t0.val[1]), vget_low_s32(t1.val[1])); + result.buf.reg[2] = + vcombine_s32(vget_high_s32(t0.val[0]), vget_high_s32(t1.val[0])); + result.buf.reg[3] = + vcombine_s32(vget_high_s32(t0.val[1]), vget_high_s32(t1.val[1])); + return result; +} + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<4, 4>& src, DstType* dst, int row, + int col) { + const auto& block = + DstType::kOrder == MapOrder::ColMajor ? src : Transpose(src); + std::int32_t* dst_ptr = dst->data(row, col); + int stride = dst->stride(); + for (int i = 0; i < 4; i++) { + vst1q_s32(dst_ptr + i * stride, block.buf.reg[i]); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<4, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + vst1_s16(dst->data(row, col + 0), vget_low_s16(src.buf.reg[0])); + vst1_s16(dst->data(row, col + 1), vget_high_s16(src.buf.reg[0])); + vst1_s16(dst->data(row, col + 2), vget_low_s16(src.buf.reg[1])); + vst1_s16(dst->data(row, col + 3), vget_high_s16(src.buf.reg[1])); + } else { + const int16x4x2_t t0 = + vtrn_s16(vget_low_s16(src.buf.reg[0]), vget_high_s16(src.buf.reg[0])); + const int16x4x2_t t1 = + vtrn_s16(vget_low_s16(src.buf.reg[1]), vget_high_s16(src.buf.reg[1])); + const int32x4x2_t t = + vtrnq_s32(vreinterpretq_s32_s16(vcombine_s16(t0.val[0], t0.val[1])), + vreinterpretq_s32_s16(vcombine_s16(t1.val[0], t1.val[1]))); + vst1_s16(dst->data(row + 0, col), + vget_low_s16(vreinterpretq_s16_s32(t.val[0]))); + vst1_s16(dst->data(row + 1, col), + vget_high_s16(vreinterpretq_s16_s32(t.val[0]))); + vst1_s16(dst->data(row + 2, col), + vget_low_s16(vreinterpretq_s16_s32(t.val[1]))); + vst1_s16(dst->data(row + 3, col), + vget_high_s16(vreinterpretq_s16_s32(t.val[1]))); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<8, 4>& src, DstType* dst, int row, + int col) { + std::int32_t* dst_ptr = dst->data(row, col); + if (DstType::kOrder == MapOrder::ColMajor) { + int col_stride = dst->cols_stride(); + for (int i = 0; i < 4; i++) { + vst1q_s32(dst_ptr + i * col_stride + 0, src.buf.reg[2 * i + 0]); + vst1q_s32(dst_ptr + i * col_stride + 4, src.buf.reg[2 * i + 1]); + } + } else { + int row_stride = dst->rows_stride(); + RegBlockInt32<4, 4> top; + top.buf.reg[0] = src.buf.reg[0]; + top.buf.reg[1] = src.buf.reg[2]; + top.buf.reg[2] = src.buf.reg[4]; + top.buf.reg[3] = src.buf.reg[6]; + const auto transpose_top = Transpose(top); + for (int i = 0; i < 4; i++) { + vst1q_s32(dst_ptr + i * row_stride, transpose_top.buf.reg[i]); + } + RegBlockInt32<4, 4> bottom; + bottom.buf.reg[0] = src.buf.reg[1]; + bottom.buf.reg[1] = src.buf.reg[3]; + bottom.buf.reg[2] = src.buf.reg[5]; + bottom.buf.reg[3] = src.buf.reg[7]; + const auto transpose_bottom = Transpose(bottom); + for (int i = 0; i < 4; i++) { + vst1q_s32(dst_ptr + (i + 4) * row_stride, transpose_bottom.buf.reg[i]); + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<8, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + vst1q_s16(dst->data(row, col + 0), src.buf.reg[0]); + vst1q_s16(dst->data(row, col + 1), src.buf.reg[1]); + vst1q_s16(dst->data(row, col + 2), src.buf.reg[2]); + vst1q_s16(dst->data(row, col + 3), src.buf.reg[3]); + } else { + const int16x8x2_t t0 = vtrnq_s16(src.buf.reg[0], src.buf.reg[1]); + const int16x8x2_t t1 = vtrnq_s16(src.buf.reg[2], src.buf.reg[3]); + const int32x4x2_t u0 = vtrnq_s32(vreinterpretq_s32_s16(t0.val[0]), + vreinterpretq_s32_s16(t1.val[0])); + const int32x4x2_t u1 = vtrnq_s32(vreinterpretq_s32_s16(t0.val[1]), + vreinterpretq_s32_s16(t1.val[1])); + vst1_s16(dst->data(row + 0, col), + vget_low_s16(vreinterpretq_s16_s32(u0.val[0]))); + vst1_s16(dst->data(row + 1, col), + vget_low_s16(vreinterpretq_s16_s32(u1.val[0]))); + vst1_s16(dst->data(row + 2, col), + vget_low_s16(vreinterpretq_s16_s32(u0.val[1]))); + vst1_s16(dst->data(row + 3, col), + vget_low_s16(vreinterpretq_s16_s32(u1.val[1]))); + vst1_s16(dst->data(row + 4, col), + vget_high_s16(vreinterpretq_s16_s32(u0.val[0]))); + vst1_s16(dst->data(row + 5, col), + vget_high_s16(vreinterpretq_s16_s32(u1.val[0]))); + vst1_s16(dst->data(row + 6, col), + vget_high_s16(vreinterpretq_s16_s32(u0.val[1]))); + vst1_s16(dst->data(row + 7, col), + vget_high_s16(vreinterpretq_s16_s32(u1.val[1]))); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<8, 8>& src, DstType* dst, int row, + int col) { + std::int32_t* dst_ptr = dst->data(row, col); + if (DstType::kOrder == MapOrder::ColMajor) { + int col_stride = dst->cols_stride(); + for (int i = 0; i < 8; i++) { + vst1q_s32(dst_ptr + i * col_stride, src.buf.reg[2 * i]); + vst1q_s32(dst_ptr + i * col_stride + 4, src.buf.reg[2 * i + 1]); + } + } else { + int row_stride = dst->rows_stride(); + RegBlockInt32<4, 4> top_left; + top_left.buf.reg[0] = src.buf.reg[0]; + top_left.buf.reg[1] = src.buf.reg[2]; + top_left.buf.reg[2] = src.buf.reg[4]; + top_left.buf.reg[3] = src.buf.reg[6]; + const auto transpose_top_left = Transpose(top_left); + for (int i = 0; i < 4; i++) { + vst1q_s32(dst_ptr + i * row_stride, transpose_top_left.buf.reg[i]); + } + RegBlockInt32<4, 4> bottom_left; + bottom_left.buf.reg[0] = src.buf.reg[1]; + bottom_left.buf.reg[1] = src.buf.reg[3]; + bottom_left.buf.reg[2] = src.buf.reg[5]; + bottom_left.buf.reg[3] = src.buf.reg[7]; + const auto transpose_bottom_left = Transpose(bottom_left); + for (int i = 0; i < 4; i++) { + vst1q_s32(dst_ptr + (i + 4) * row_stride, + transpose_bottom_left.buf.reg[i]); + } + RegBlockInt32<4, 4> top_right; + top_right.buf.reg[0] = src.buf.reg[8]; + top_right.buf.reg[1] = src.buf.reg[10]; + top_right.buf.reg[2] = src.buf.reg[12]; + top_right.buf.reg[3] = src.buf.reg[14]; + const auto transpose_top_right = Transpose(top_right); + for (int i = 0; i < 4; i++) { + vst1q_s32(dst_ptr + i * row_stride + 4, transpose_top_right.buf.reg[i]); + } + RegBlockInt32<4, 4> bottom_right; + bottom_right.buf.reg[0] = src.buf.reg[9]; + bottom_right.buf.reg[1] = src.buf.reg[11]; + bottom_right.buf.reg[2] = src.buf.reg[13]; + bottom_right.buf.reg[3] = src.buf.reg[15]; + const auto transpose_bottom_right = Transpose(bottom_right); + for (int i = 0; i < 4; i++) { + vst1q_s32(dst_ptr + (i + 4) * row_stride + 4, + transpose_bottom_right.buf.reg[i]); + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<4, 1>& src, DstType* dst, int row, + int col) { + std::int32_t* dst_ptr = dst->data(row, col); + if (DstType::kOrder == MapOrder::ColMajor) { + vst1q_s32(dst_ptr, src.buf.reg[0]); + } else { + int row_stride = dst->rows_stride(); + vst1q_lane_s32(dst_ptr + 0 * row_stride, src.buf.reg[0], 0); + vst1q_lane_s32(dst_ptr + 1 * row_stride, src.buf.reg[0], 1); + vst1q_lane_s32(dst_ptr + 2 * row_stride, src.buf.reg[0], 2); + vst1q_lane_s32(dst_ptr + 3 * row_stride, src.buf.reg[0], 3); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<1, 4>& src, DstType* dst, int row, + int col) { + std::int32_t* dst_ptr = dst->data(row, col); + if (DstType::kOrder == MapOrder::RowMajor) { + vst1q_s32(dst_ptr, src.buf.reg[0]); + } else { + int col_stride = dst->cols_stride(); + vst1q_lane_s32(dst_ptr + 0 * col_stride, src.buf.reg[0], 0); + vst1q_lane_s32(dst_ptr + 1 * col_stride, src.buf.reg[0], 1); + vst1q_lane_s32(dst_ptr + 2 * col_stride, src.buf.reg[0], 2); + vst1q_lane_s32(dst_ptr + 3 * col_stride, src.buf.reg[0], 3); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<1, 4>& src, DstType* dst, int row, + int col) { + std::int16_t* dst_ptr = dst->data(row, col); + if (DstType::kOrder == MapOrder::RowMajor) { + vst1_s16(dst_ptr, src.buf.reg[0]); + } else { + int col_stride = dst->cols_stride(); + vst1_lane_s16(dst_ptr + 0 * col_stride, src.buf.reg[0], 0); + vst1_lane_s16(dst_ptr + 1 * col_stride, src.buf.reg[0], 1); + vst1_lane_s16(dst_ptr + 2 * col_stride, src.buf.reg[0], 2); + vst1_lane_s16(dst_ptr + 3 * col_stride, src.buf.reg[0], 3); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<4, 1>& src, DstType* dst, int row, + int col) { + const std::uint32_t src_reg = src.buf.reg[0]; + for (int i = 0; i < 4; i++) { + *dst->data(row + i, col) = (src_reg >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<1, 4>& src, DstType* dst, int row, + int col) { + for (int i = 0; i < 4; i++) { + *dst->data(row, col + i) = (src.buf.reg[0] >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 1>& src, DstType* dst, int row, + int col) { + std::uint8_t* dst_ptr = dst->data(row, col); + if (DstType::kOrder == MapOrder::ColMajor) { + vst1_u8(dst_ptr, src.buf.reg[0]); + } else { + const int row_stride = dst->rows_stride(); + vst1_lane_u8(dst_ptr + 0 * row_stride, src.buf.reg[0], 0); + vst1_lane_u8(dst_ptr + 1 * row_stride, src.buf.reg[0], 1); + vst1_lane_u8(dst_ptr + 2 * row_stride, src.buf.reg[0], 2); + vst1_lane_u8(dst_ptr + 3 * row_stride, src.buf.reg[0], 3); + vst1_lane_u8(dst_ptr + 4 * row_stride, src.buf.reg[0], 4); + vst1_lane_u8(dst_ptr + 5 * row_stride, src.buf.reg[0], 5); + vst1_lane_u8(dst_ptr + 6 * row_stride, src.buf.reg[0], 6); + vst1_lane_u8(dst_ptr + 7 * row_stride, src.buf.reg[0], 7); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<4, 4>& src, DstType* dst, int row, + int col) { + std::uint8_t* dst_ptr = dst->data(row, col); + const int row_stride = dst->rows_stride(); + const int col_stride = dst->cols_stride(); + for (int i = 0; i < 2; i++) { + vst1_lane_u8(dst_ptr + 0 * row_stride + (2 * i + 0) * col_stride, + src.buf.reg[i], 0); + vst1_lane_u8(dst_ptr + 1 * row_stride + (2 * i + 0) * col_stride, + src.buf.reg[i], 1); + vst1_lane_u8(dst_ptr + 2 * row_stride + (2 * i + 0) * col_stride, + src.buf.reg[i], 2); + vst1_lane_u8(dst_ptr + 3 * row_stride + (2 * i + 0) * col_stride, + src.buf.reg[i], 3); + vst1_lane_u8(dst_ptr + 0 * row_stride + (2 * i + 1) * col_stride, + src.buf.reg[i], 4); + vst1_lane_u8(dst_ptr + 1 * row_stride + (2 * i + 1) * col_stride, + src.buf.reg[i], 5); + vst1_lane_u8(dst_ptr + 2 * row_stride + (2 * i + 1) * col_stride, + src.buf.reg[i], 6); + vst1_lane_u8(dst_ptr + 3 * row_stride + (2 * i + 1) * col_stride, + src.buf.reg[i], 7); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 4>& src, DstType* dst, int row, + int col) { + std::uint8_t* dst_ptr = dst->data(row, col); + if (DstType::kOrder == MapOrder::ColMajor) { + int col_stride = dst->cols_stride(); + for (int i = 0; i < 4; i++) { + vst1_u8(dst_ptr + i * col_stride, src.buf.reg[i]); + } + } else { + int row_stride = dst->rows_stride(); + for (int i = 0; i < 4; i++) { + std::uint8_t* col_ptr = dst_ptr + i; + vst1_lane_u8(col_ptr + 0 * row_stride, src.buf.reg[i], 0); + vst1_lane_u8(col_ptr + 1 * row_stride, src.buf.reg[i], 1); + vst1_lane_u8(col_ptr + 2 * row_stride, src.buf.reg[i], 2); + vst1_lane_u8(col_ptr + 3 * row_stride, src.buf.reg[i], 3); + vst1_lane_u8(col_ptr + 4 * row_stride, src.buf.reg[i], 4); + vst1_lane_u8(col_ptr + 5 * row_stride, src.buf.reg[i], 5); + vst1_lane_u8(col_ptr + 6 * row_stride, src.buf.reg[i], 6); + vst1_lane_u8(col_ptr + 7 * row_stride, src.buf.reg[i], 7); + } + } + } +}; + +inline RegBlockUint8<8, 8> Transpose(const RegBlockUint8<8, 8>& src) { + uint8x8x2_t a[4]; + a[0] = vtrn_u8(src.buf.reg[0], src.buf.reg[1]); + a[1] = vtrn_u8(src.buf.reg[2], src.buf.reg[3]); + a[2] = vtrn_u8(src.buf.reg[4], src.buf.reg[5]); + a[3] = vtrn_u8(src.buf.reg[6], src.buf.reg[7]); + uint16x4x2_t b[4]; + b[0] = vtrn_u16(vreinterpret_u16_u8(a[0].val[0]), + vreinterpret_u16_u8(a[1].val[0])); + b[1] = vtrn_u16(vreinterpret_u16_u8(a[0].val[1]), + vreinterpret_u16_u8(a[1].val[1])); + b[2] = vtrn_u16(vreinterpret_u16_u8(a[2].val[0]), + vreinterpret_u16_u8(a[3].val[0])); + b[3] = vtrn_u16(vreinterpret_u16_u8(a[2].val[1]), + vreinterpret_u16_u8(a[3].val[1])); + uint32x2x2_t c[4]; + c[0] = vtrn_u32(vreinterpret_u32_u16(b[0].val[0]), + vreinterpret_u32_u16(b[2].val[0])); + c[1] = vtrn_u32(vreinterpret_u32_u16(b[1].val[0]), + vreinterpret_u32_u16(b[3].val[0])); + c[2] = vtrn_u32(vreinterpret_u32_u16(b[0].val[1]), + vreinterpret_u32_u16(b[2].val[1])); + c[3] = vtrn_u32(vreinterpret_u32_u16(b[1].val[1]), + vreinterpret_u32_u16(b[3].val[1])); + RegBlockUint8<8, 8> result; + result.buf.reg[0] = vreinterpret_u8_u32(c[0].val[0]); + result.buf.reg[1] = vreinterpret_u8_u32(c[1].val[0]); + result.buf.reg[2] = vreinterpret_u8_u32(c[2].val[0]); + result.buf.reg[3] = vreinterpret_u8_u32(c[3].val[0]); + result.buf.reg[4] = vreinterpret_u8_u32(c[0].val[1]); + result.buf.reg[5] = vreinterpret_u8_u32(c[1].val[1]); + result.buf.reg[6] = vreinterpret_u8_u32(c[2].val[1]); + result.buf.reg[7] = vreinterpret_u8_u32(c[3].val[1]); + return result; +} + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 8>& src, DstType* dst, int row, + int col) { + const auto& block = + DstType::kOrder == MapOrder::ColMajor ? src : Transpose(src); + std::uint8_t* dst_ptr = dst->data(row, col); + int stride = dst->stride(); + for (int i = 0; i < 8; i++) { + vst1_u8(dst_ptr + i * stride, block.buf.reg[i]); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt8<4, 1>& src, DstType* dst, int row, + int col) { + const std::int32_t src_reg = src.buf.reg[0]; + for (int i = 0; i < 4; i++) { + *dst->data(row + i, col) = (src_reg >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt8<1, 4>& src, DstType* dst, int row, + int col) { + for (int i = 0; i < 4; i++) { + *dst->data(row, col + i) = (src.buf.reg[0] >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt8<8, 1>& src, DstType* dst, int row, + int col) { + std::int8_t* dst_ptr = dst->data(row, col); + if (DstType::kOrder == MapOrder::ColMajor) { + vst1_s8(dst_ptr, src.buf.reg[0]); + } else { + const int row_stride = dst->rows_stride(); + vst1_lane_s8(dst_ptr + 0 * row_stride, src.buf.reg[0], 0); + vst1_lane_s8(dst_ptr + 1 * row_stride, src.buf.reg[0], 1); + vst1_lane_s8(dst_ptr + 2 * row_stride, src.buf.reg[0], 2); + vst1_lane_s8(dst_ptr + 3 * row_stride, src.buf.reg[0], 3); + vst1_lane_s8(dst_ptr + 4 * row_stride, src.buf.reg[0], 4); + vst1_lane_s8(dst_ptr + 5 * row_stride, src.buf.reg[0], 5); + vst1_lane_s8(dst_ptr + 6 * row_stride, src.buf.reg[0], 6); + vst1_lane_s8(dst_ptr + 7 * row_stride, src.buf.reg[0], 7); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt8<4, 4>& src, DstType* dst, int row, + int col) { + std::int8_t* dst_ptr = dst->data(row, col); + const int row_stride = dst->rows_stride(); + const int col_stride = dst->cols_stride(); + for (int i = 0; i < 2; i++) { + vst1_lane_s8(dst_ptr + 0 * row_stride + (2 * i + 0) * col_stride, + src.buf.reg[i], 0); + vst1_lane_s8(dst_ptr + 1 * row_stride + (2 * i + 0) * col_stride, + src.buf.reg[i], 1); + vst1_lane_s8(dst_ptr + 2 * row_stride + (2 * i + 0) * col_stride, + src.buf.reg[i], 2); + vst1_lane_s8(dst_ptr + 3 * row_stride + (2 * i + 0) * col_stride, + src.buf.reg[i], 3); + vst1_lane_s8(dst_ptr + 0 * row_stride + (2 * i + 1) * col_stride, + src.buf.reg[i], 4); + vst1_lane_s8(dst_ptr + 1 * row_stride + (2 * i + 1) * col_stride, + src.buf.reg[i], 5); + vst1_lane_s8(dst_ptr + 2 * row_stride + (2 * i + 1) * col_stride, + src.buf.reg[i], 6); + vst1_lane_s8(dst_ptr + 3 * row_stride + (2 * i + 1) * col_stride, + src.buf.reg[i], 7); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt8<8, 4>& src, DstType* dst, int row, + int col) { + std::int8_t* dst_ptr = dst->data(row, col); + if (DstType::kOrder == MapOrder::ColMajor) { + int col_stride = dst->cols_stride(); + for (int i = 0; i < 4; i++) { + vst1_s8(dst_ptr + i * col_stride, src.buf.reg[i]); + } + } else { + int row_stride = dst->rows_stride(); + for (int i = 0; i < 4; i++) { + std::int8_t* col_ptr = dst_ptr + i; + vst1_lane_s8(col_ptr + 0 * row_stride, src.buf.reg[i], 0); + vst1_lane_s8(col_ptr + 1 * row_stride, src.buf.reg[i], 1); + vst1_lane_s8(col_ptr + 2 * row_stride, src.buf.reg[i], 2); + vst1_lane_s8(col_ptr + 3 * row_stride, src.buf.reg[i], 3); + vst1_lane_s8(col_ptr + 4 * row_stride, src.buf.reg[i], 4); + vst1_lane_s8(col_ptr + 5 * row_stride, src.buf.reg[i], 5); + vst1_lane_s8(col_ptr + 6 * row_stride, src.buf.reg[i], 6); + vst1_lane_s8(col_ptr + 7 * row_stride, src.buf.reg[i], 7); + } + } + } +}; + +inline RegBlockInt8<8, 8> Transpose(const RegBlockInt8<8, 8>& src) { + int8x8x2_t a[4]; + a[0] = vtrn_s8(src.buf.reg[0], src.buf.reg[1]); + a[1] = vtrn_s8(src.buf.reg[2], src.buf.reg[3]); + a[2] = vtrn_s8(src.buf.reg[4], src.buf.reg[5]); + a[3] = vtrn_s8(src.buf.reg[6], src.buf.reg[7]); + int16x4x2_t b[4]; + b[0] = vtrn_s16(vreinterpret_s16_s8(a[0].val[0]), + vreinterpret_s16_s8(a[1].val[0])); + b[1] = vtrn_s16(vreinterpret_s16_s8(a[0].val[1]), + vreinterpret_s16_s8(a[1].val[1])); + b[2] = vtrn_s16(vreinterpret_s16_s8(a[2].val[0]), + vreinterpret_s16_s8(a[3].val[0])); + b[3] = vtrn_s16(vreinterpret_s16_s8(a[2].val[1]), + vreinterpret_s16_s8(a[3].val[1])); + int32x2x2_t c[4]; + c[0] = vtrn_s32(vreinterpret_s32_s16(b[0].val[0]), + vreinterpret_s32_s16(b[2].val[0])); + c[1] = vtrn_s32(vreinterpret_s32_s16(b[1].val[0]), + vreinterpret_s32_s16(b[3].val[0])); + c[2] = vtrn_s32(vreinterpret_s32_s16(b[0].val[1]), + vreinterpret_s32_s16(b[2].val[1])); + c[3] = vtrn_s32(vreinterpret_s32_s16(b[1].val[1]), + vreinterpret_s32_s16(b[3].val[1])); + RegBlockInt8<8, 8> result; + result.buf.reg[0] = vreinterpret_s8_s32(c[0].val[0]); + result.buf.reg[1] = vreinterpret_s8_s32(c[1].val[0]); + result.buf.reg[2] = vreinterpret_s8_s32(c[2].val[0]); + result.buf.reg[3] = vreinterpret_s8_s32(c[3].val[0]); + result.buf.reg[4] = vreinterpret_s8_s32(c[0].val[1]); + result.buf.reg[5] = vreinterpret_s8_s32(c[1].val[1]); + result.buf.reg[6] = vreinterpret_s8_s32(c[2].val[1]); + result.buf.reg[7] = vreinterpret_s8_s32(c[3].val[1]); + return result; +} + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt8<8, 8>& src, DstType* dst, int row, + int col) { + const auto& block = + DstType::kOrder == MapOrder::ColMajor ? src : Transpose(src); + std::int8_t* dst_ptr = dst->data(row, col); + int stride = dst->stride(); + for (int i = 0; i < 8; i++) { + vst1_s8(dst_ptr + i * stride, block.buf.reg[i]); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<8, 8>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + vst1q_s16(dst->data(row, col + 0), src.buf.reg[0]); + vst1q_s16(dst->data(row, col + 1), src.buf.reg[1]); + vst1q_s16(dst->data(row, col + 2), src.buf.reg[2]); + vst1q_s16(dst->data(row, col + 3), src.buf.reg[3]); + vst1q_s16(dst->data(row, col + 4), src.buf.reg[4]); + vst1q_s16(dst->data(row, col + 5), src.buf.reg[5]); + vst1q_s16(dst->data(row, col + 6), src.buf.reg[6]); + vst1q_s16(dst->data(row, col + 7), src.buf.reg[7]); + } else { + int16x8x2_t a[4]; + a[0] = vtrnq_s16(src.buf.reg[0], src.buf.reg[1]); + a[1] = vtrnq_s16(src.buf.reg[2], src.buf.reg[3]); + a[2] = vtrnq_s16(src.buf.reg[4], src.buf.reg[5]); + a[3] = vtrnq_s16(src.buf.reg[6], src.buf.reg[7]); + int32x4x2_t b[4]; + b[0] = vtrnq_s32(vreinterpretq_s32_s16(a[0].val[0]), + vreinterpretq_s32_s16(a[1].val[0])); + b[1] = vtrnq_s32(vreinterpretq_s32_s16(a[0].val[1]), + vreinterpretq_s32_s16(a[1].val[1])); + b[2] = vtrnq_s32(vreinterpretq_s32_s16(a[2].val[0]), + vreinterpretq_s32_s16(a[3].val[0])); + b[3] = vtrnq_s32(vreinterpretq_s32_s16(a[2].val[1]), + vreinterpretq_s32_s16(a[3].val[1])); + vst1_s16(dst->data(row + 0, col + 0), + vget_low_s16(vreinterpretq_s16_s32(b[0].val[0]))); + vst1_s16(dst->data(row + 0, col + 4), + vget_low_s16(vreinterpretq_s16_s32(b[2].val[0]))); + vst1_s16(dst->data(row + 1, col + 0), + vget_low_s16(vreinterpretq_s16_s32(b[1].val[0]))); + vst1_s16(dst->data(row + 1, col + 4), + vget_low_s16(vreinterpretq_s16_s32(b[3].val[0]))); + vst1_s16(dst->data(row + 2, col + 0), + vget_low_s16(vreinterpretq_s16_s32(b[0].val[1]))); + vst1_s16(dst->data(row + 2, col + 4), + vget_low_s16(vreinterpretq_s16_s32(b[2].val[1]))); + vst1_s16(dst->data(row + 3, col + 0), + vget_low_s16(vreinterpretq_s16_s32(b[1].val[1]))); + vst1_s16(dst->data(row + 3, col + 4), + vget_low_s16(vreinterpretq_s16_s32(b[3].val[1]))); + vst1_s16(dst->data(row + 4, col + 0), + vget_high_s16(vreinterpretq_s16_s32(b[0].val[0]))); + vst1_s16(dst->data(row + 4, col + 4), + vget_high_s16(vreinterpretq_s16_s32(b[2].val[0]))); + vst1_s16(dst->data(row + 5, col + 0), + vget_high_s16(vreinterpretq_s16_s32(b[1].val[0]))); + vst1_s16(dst->data(row + 5, col + 4), + vget_high_s16(vreinterpretq_s16_s32(b[3].val[0]))); + vst1_s16(dst->data(row + 6, col + 0), + vget_high_s16(vreinterpretq_s16_s32(b[0].val[1]))); + vst1_s16(dst->data(row + 6, col + 4), + vget_high_s16(vreinterpretq_s16_s32(b[2].val[1]))); + vst1_s16(dst->data(row + 7, col + 0), + vget_high_s16(vreinterpretq_s16_s32(b[1].val[1]))); + vst1_s16(dst->data(row + 7, col + 4), + vget_high_s16(vreinterpretq_s16_s32(b[3].val[1]))); + } + } +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_OUTPUT_NEON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_sse.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_sse.h new file mode 100644 index 0000000000000000000000000000000000000000..6ea3290b15c88d31bf8d2a20ce12bbe02e450cad --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/output_sse.h @@ -0,0 +1,561 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// output_sse.h: optimized SSE4.2 specializations of the templates in output.h. + +#ifndef GEMMLOWP_INTERNAL_OUTPUT_SSE_H_ +#define GEMMLOWP_INTERNAL_OUTPUT_SSE_H_ + +#include "output.h" + +#include + +namespace gemmlowp { + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<4> InputType; + typedef RegBufferUint8<4> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + __m128i res_16 = _mm_packs_epi32(input.reg[0], input.reg[0]); + __m128i res_8 = _mm_packus_epi16(res_16, res_16); + output.reg[0] = _mm_cvtsi128_si32(res_8); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<8> InputType; + typedef RegBufferUint8<8> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + __m128i res_16 = _mm_packs_epi32(input.reg[0], input.reg[1]); + __m128i res_8 = _mm_packus_epi16(res_16, res_16); + output.reg[0] = _mm_extract_epi32(res_8, 0); + output.reg[1] = _mm_extract_epi32(res_8, 1); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<16> InputType; + typedef RegBufferUint8<16> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + __m128i res_16_0 = _mm_packs_epi32(input.reg[0], input.reg[1]); + __m128i res_16_1 = _mm_packs_epi32(input.reg[2], input.reg[3]); + output.reg[0] = _mm_packus_epi16(res_16_0, res_16_1); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<32> InputType; + typedef RegBufferUint8<32> OutputType; + + typedef OutputStageSaturatingCastToUint8 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + __m128i res_16_0 = _mm_packs_epi32(input.reg[0], input.reg[1]); + __m128i res_16_1 = _mm_packs_epi32(input.reg[2], input.reg[3]); + output.reg[0] = _mm_packus_epi16(res_16_0, res_16_1); + __m128i res_16_2 = _mm_packs_epi32(input.reg[4], input.reg[5]); + __m128i res_16_3 = _mm_packs_epi32(input.reg[6], input.reg[7]); + output.reg[1] = _mm_packus_epi16(res_16_2, res_16_3); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<4> InputType; + typedef RegBufferInt16<4> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + __m128i res_16 = _mm_packs_epi32(input.reg[0], input.reg[0]); + output.reg[0] = _mm_extract_epi16(res_16, 0); + output.reg[1] = _mm_extract_epi16(res_16, 1); + output.reg[2] = _mm_extract_epi16(res_16, 2); + output.reg[3] = _mm_extract_epi16(res_16, 3); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<8> InputType; + typedef RegBufferInt16<8> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + output.reg[0] = _mm_packs_epi32(input.reg[0], input.reg[1]); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<16> InputType; + typedef RegBufferInt16<16> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + output.reg[0] = _mm_packs_epi32(input.reg[0], input.reg[1]); + output.reg[1] = _mm_packs_epi32(input.reg[2], input.reg[3]); + return output; + } +}; + +template <> +struct OutputStageEvalBufferImpl> { + typedef RegBufferInt32<32> InputType; + typedef RegBufferInt16<32> OutputType; + + typedef OutputStageSaturatingCastToInt16 OutputStage; + + OutputStageEvalBufferImpl(const OutputStage&) {} + + OutputType Eval(InputType input) const { + OutputType output; + output.reg[0] = _mm_packs_epi32(input.reg[0], input.reg[1]); + output.reg[1] = _mm_packs_epi32(input.reg[2], input.reg[3]); + output.reg[2] = _mm_packs_epi32(input.reg[4], input.reg[5]); + output.reg[3] = _mm_packs_epi32(input.reg[6], input.reg[7]); + return output; + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<4, 1>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + StoreInt32x4(dst->data(row, col), src.buf.reg[0]); + } else { + *dst->data(row + 0, col) = GetLane<0>(src.buf.reg[0]); + *dst->data(row + 1, col) = GetLane<1>(src.buf.reg[0]); + *dst->data(row + 2, col) = GetLane<2>(src.buf.reg[0]); + *dst->data(row + 3, col) = GetLane<3>(src.buf.reg[0]); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<8, 1>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + StoreInt32x4(dst->data(row, col), src.buf.reg[0]); + StoreInt32x4(dst->data(row + 4, col), src.buf.reg[1]); + } else { + *dst->data(row + 0, col) = GetLane<0>(src.buf.reg[0]); + *dst->data(row + 1, col) = GetLane<1>(src.buf.reg[0]); + *dst->data(row + 2, col) = GetLane<2>(src.buf.reg[0]); + *dst->data(row + 3, col) = GetLane<3>(src.buf.reg[0]); + *dst->data(row + 4, col) = GetLane<0>(src.buf.reg[1]); + *dst->data(row + 5, col) = GetLane<1>(src.buf.reg[1]); + *dst->data(row + 6, col) = GetLane<2>(src.buf.reg[1]); + *dst->data(row + 7, col) = GetLane<3>(src.buf.reg[1]); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<4, 1>& src, DstType* dst, int row, + int col) { + *dst->data(row + 0, col) = src.buf.reg[0]; + *dst->data(row + 1, col) = src.buf.reg[1]; + *dst->data(row + 2, col) = src.buf.reg[2]; + *dst->data(row + 3, col) = src.buf.reg[3]; + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<8, 1>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + StoreInt16x8(dst->data(row, col), src.buf.reg[0]); + } else { + *dst->data(row + 0, col) = _mm_extract_epi16(src.buf.reg[0], 0); + *dst->data(row + 1, col) = _mm_extract_epi16(src.buf.reg[0], 1); + *dst->data(row + 2, col) = _mm_extract_epi16(src.buf.reg[0], 2); + *dst->data(row + 3, col) = _mm_extract_epi16(src.buf.reg[0], 3); + *dst->data(row + 4, col) = _mm_extract_epi16(src.buf.reg[0], 4); + *dst->data(row + 5, col) = _mm_extract_epi16(src.buf.reg[0], 5); + *dst->data(row + 6, col) = _mm_extract_epi16(src.buf.reg[0], 6); + *dst->data(row + 7, col) = _mm_extract_epi16(src.buf.reg[0], 7); + } + } +}; + +inline RegBlockInt32<4, 4> Transpose(const RegBlockInt32<4, 4>& src) { + __m128i t0 = _mm_unpacklo_epi32(src.buf.reg[0], src.buf.reg[1]); + __m128i t1 = _mm_unpacklo_epi32(src.buf.reg[2], src.buf.reg[3]); + __m128i t2 = _mm_unpackhi_epi32(src.buf.reg[0], src.buf.reg[1]); + __m128i t3 = _mm_unpackhi_epi32(src.buf.reg[2], src.buf.reg[3]); + + RegBlockInt32<4, 4> result; + result.buf.reg[0] = _mm_unpacklo_epi64(t0, t1); + result.buf.reg[1] = _mm_unpackhi_epi64(t0, t1); + result.buf.reg[2] = _mm_unpacklo_epi64(t2, t3); + result.buf.reg[3] = _mm_unpackhi_epi64(t2, t3); + return result; +} + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<4, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row, col + i), src.buf.reg[i]); + } + } else { + const auto transpose = Transpose(src); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + i, col), transpose.buf.reg[i]); + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<4, 4>& src, DstType* dst, int row, + int col) { + std::int16_t buf[16]; + StoreInt16x8(buf + 0, src.buf.reg[0]); + StoreInt16x8(buf + 8, src.buf.reg[1]); + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + *dst->data(row + i, col + j) = buf[i + 4 * j]; + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<8, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row, col + i), src.buf.reg[2 * i]); + StoreInt32x4(dst->data(row + 4, col + i), src.buf.reg[2 * i + 1]); + } + } else { + RegBlockInt32<4, 4> top; + top.buf.reg[0] = src.buf.reg[0]; + top.buf.reg[1] = src.buf.reg[2]; + top.buf.reg[2] = src.buf.reg[4]; + top.buf.reg[3] = src.buf.reg[6]; + const auto transpose_top = Transpose(top); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + i, col), transpose_top.buf.reg[i]); + } + RegBlockInt32<4, 4> bottom; + bottom.buf.reg[0] = src.buf.reg[1]; + bottom.buf.reg[1] = src.buf.reg[3]; + bottom.buf.reg[2] = src.buf.reg[5]; + bottom.buf.reg[3] = src.buf.reg[7]; + const auto transpose_bottom = Transpose(bottom); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + 4 + i, col), transpose_bottom.buf.reg[i]); + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<8, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 4; i++) { + StoreInt16x8(dst->data(row, col + i), src.buf.reg[i]); + } + } else { + std::int16_t buf[32]; + StoreInt16x8(buf + 0, src.buf.reg[0]); + StoreInt16x8(buf + 8, src.buf.reg[1]); + StoreInt16x8(buf + 16, src.buf.reg[2]); + StoreInt16x8(buf + 24, src.buf.reg[3]); + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 4; j++) { + *dst->data(row + i, col + j) = buf[i + 8 * j]; + } + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<8, 8>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 8; i++) { + StoreInt32x4(dst->data(row, col + i), src.buf.reg[2 * i]); + StoreInt32x4(dst->data(row + 4, col + i), src.buf.reg[2 * i + 1]); + } + } else { + RegBlockInt32<4, 4> top_left; + top_left.buf.reg[0] = src.buf.reg[0]; + top_left.buf.reg[1] = src.buf.reg[2]; + top_left.buf.reg[2] = src.buf.reg[4]; + top_left.buf.reg[3] = src.buf.reg[6]; + const auto transpose_top_left = Transpose(top_left); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + i, col), transpose_top_left.buf.reg[i]); + } + RegBlockInt32<4, 4> bottom_left; + bottom_left.buf.reg[0] = src.buf.reg[1]; + bottom_left.buf.reg[1] = src.buf.reg[3]; + bottom_left.buf.reg[2] = src.buf.reg[5]; + bottom_left.buf.reg[3] = src.buf.reg[7]; + const auto transpose_bottom_left = Transpose(bottom_left); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + 4 + i, col), + transpose_bottom_left.buf.reg[i]); + } + RegBlockInt32<4, 4> top_right; + top_right.buf.reg[0] = src.buf.reg[8]; + top_right.buf.reg[1] = src.buf.reg[10]; + top_right.buf.reg[2] = src.buf.reg[12]; + top_right.buf.reg[3] = src.buf.reg[14]; + const auto transpose_top_right = Transpose(top_right); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + i, col + 4), + transpose_top_right.buf.reg[i]); + } + RegBlockInt32<4, 4> bottom_right; + bottom_right.buf.reg[0] = src.buf.reg[9]; + bottom_right.buf.reg[1] = src.buf.reg[11]; + bottom_right.buf.reg[2] = src.buf.reg[13]; + bottom_right.buf.reg[3] = src.buf.reg[15]; + const auto transpose_bottom_right = Transpose(bottom_right); + for (int i = 0; i < 4; i++) { + StoreInt32x4(dst->data(row + 4 + i, col + 4), + transpose_bottom_right.buf.reg[i]); + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt16<8, 8>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + for (int i = 0; i < 8; i++) { + StoreInt16x8(dst->data(row, col + i), src.buf.reg[i]); + } + } else { + // top-left 4x4 + __m128i t0 = _mm_unpacklo_epi16(src.buf.reg[0], src.buf.reg[1]); + __m128i t1 = _mm_unpacklo_epi16(src.buf.reg[2], src.buf.reg[3]); + __m128i u0 = _mm_unpacklo_epi32(t0, t1); + __m128i u1 = _mm_unpackhi_epi32(t0, t1); + // top-right 4x4 + __m128i t2 = _mm_unpacklo_epi16(src.buf.reg[4], src.buf.reg[5]); + __m128i t3 = _mm_unpacklo_epi16(src.buf.reg[6], src.buf.reg[7]); + __m128i u2 = _mm_unpacklo_epi32(t2, t3); + __m128i u3 = _mm_unpackhi_epi32(t2, t3); + // bottom-left 4x4 + __m128i t4 = _mm_unpackhi_epi16(src.buf.reg[0], src.buf.reg[1]); + __m128i t5 = _mm_unpackhi_epi16(src.buf.reg[2], src.buf.reg[3]); + __m128i u4 = _mm_unpacklo_epi32(t4, t5); + __m128i u5 = _mm_unpackhi_epi32(t4, t5); + // bottom-right 4x4 + __m128i t6 = _mm_unpackhi_epi16(src.buf.reg[4], src.buf.reg[5]); + __m128i t7 = _mm_unpackhi_epi16(src.buf.reg[6], src.buf.reg[7]); + __m128i u6 = _mm_unpacklo_epi32(t6, t7); + __m128i u7 = _mm_unpackhi_epi32(t6, t7); + + StoreInt16x8(dst->data(row + 0, col), _mm_unpacklo_epi64(u0, u2)); + StoreInt16x8(dst->data(row + 1, col), _mm_unpackhi_epi64(u0, u2)); + StoreInt16x8(dst->data(row + 2, col), _mm_unpacklo_epi64(u1, u3)); + StoreInt16x8(dst->data(row + 3, col), _mm_unpackhi_epi64(u1, u3)); + StoreInt16x8(dst->data(row + 4, col), _mm_unpacklo_epi64(u4, u6)); + StoreInt16x8(dst->data(row + 5, col), _mm_unpackhi_epi64(u4, u6)); + StoreInt16x8(dst->data(row + 6, col), _mm_unpacklo_epi64(u5, u7)); + StoreInt16x8(dst->data(row + 7, col), _mm_unpackhi_epi64(u5, u7)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockInt32<1, 4>& src, DstType* dst, int row, + int col) { + if (DstType::kOrder == MapOrder::ColMajor) { + *dst->data(row, col + 0) = GetLane<0>(src.buf.reg[0]); + *dst->data(row, col + 1) = GetLane<1>(src.buf.reg[0]); + *dst->data(row, col + 2) = GetLane<2>(src.buf.reg[0]); + *dst->data(row, col + 3) = GetLane<3>(src.buf.reg[0]); + } else { + StoreInt32x4(dst->data(row, col), src.buf.reg[0]); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<4, 1>& src, DstType* dst, int row, + int col) { + const std::uint32_t src_reg = src.buf.reg[0]; + for (int i = 0; i < 4; i++) { + *dst->data(row + i, col) = (src_reg >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 1>& src, DstType* dst, int row, + int col) { + for (int i = 0; i < 4; i++) { + *dst->data(row + i, col) = (src.buf.reg[0] >> (8 * i)); + } + for (int i = 0; i < 4; i++) { + *dst->data(row + 4 + i, col) = (src.buf.reg[1] >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<1, 4>& src, DstType* dst, int row, + int col) { + for (int i = 0; i < 4; i++) { + *dst->data(row, col + i) = (src.buf.reg[0] >> (8 * i)); + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<4, 4>& src, DstType* dst, int row, + int col) { + std::uint8_t buf[16]; + StoreUint8x16(buf, src.buf.reg[0]); + for (int c = 0; c < 4; c++) { + for (int r = 0; r < 4; r++) { + *dst->data(row + r, col + c) = buf[r + 4 * c]; + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 4>& src, DstType* dst, int row, + int col) { + std::uint8_t buf[32]; + StoreUint8x16(buf, src.buf.reg[0]); + StoreUint8x16(buf + 16, src.buf.reg[1]); + for (int c = 0; c < 4; c++) { + for (int r = 0; r < 8; r++) { + *dst->data(row + r, col + c) = buf[r + 8 * c]; + } + } + } +}; + +template +struct StoreFinalOutputImpl, DstType> { + static void Run(const RegBlockUint8<8, 8>& src, DstType* dst, int row, + int col) { + std::uint8_t buf[64]; + StoreUint8x16(buf, src.buf.reg[0]); + StoreUint8x16(buf + 16, src.buf.reg[1]); + StoreUint8x16(buf + 32, src.buf.reg[2]); + StoreUint8x16(buf + 48, src.buf.reg[3]); + for (int c = 0; c < 8; c++) { + for (int r = 0; r < 8; r++) { + *dst->data(row + r, col + c) = buf[r + 8 * c]; + } + } + } +}; + +// Specialization for MatrixMap, for performance. +template +struct StoreFinalOutputImpl, MatrixMap> { + static void Run(const RegBlockUint8<8, 8>& src, + MatrixMap* dst, int row, int col) { + std::uint8_t buf[64]; + StoreUint8x16(buf, src.buf.reg[0]); + StoreUint8x16(buf + 16, src.buf.reg[1]); + StoreUint8x16(buf + 32, src.buf.reg[2]); + StoreUint8x16(buf + 48, src.buf.reg[3]); + // Make a local copy so that the compiler can prove that data_ does not + // alias &data_ or &stride_. + MatrixMap local = *dst; + for (int c = 0; c < 8; c++) { + for (int r = 0; r < 8; r++) { + *local.data(row + r, col + c) = buf[r + 8 * c]; + } + } + } +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_OUTPUT_SSE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack.h new file mode 100644 index 0000000000000000000000000000000000000000..a9eb396af953ee03555865b004e7e5686daac876 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack.h @@ -0,0 +1,444 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pack.h: packing blocks of the LHS and RHS into the data layout +// that is expected by compute.h and eventually by kernels. +// Because this data layout depends on the kernel format, code here +// is templated in KernelLhsFormat/KernelRhsFormat. +// +// Readers note: an important theme around here is that we try hard +// to handle both Lhs and Rhs with a single piece of code. We indifferently +// refer to the Lhs and Rhs as a 'Side'. Instead of addressing matrices +// by (row, column) indices, we address them by (width, depth), as explained +// in kernel.h. This allows us to handle both Lhs and Rhs on an equal footing, +// at once. + +#ifndef GEMMLOWP_INTERNAL_PACK_H_ +#define GEMMLOWP_INTERNAL_PACK_H_ + +#include + +#include "allocator.h" +#include "block_params.h" +#include "common.h" +#include "kernel.h" + +namespace gemmlowp { + +// A PackedSideBlock instance is a packed block of either the LHS or RHS +// (whence the generic 'Side' name). +// +// 'Packed' means that it is laid out in the storage order that +// is expected by the specified kernel format. From a block of the input +// LHS or RHS matrix, one obtains a PackedSideBlock by calling PackLhs() +// or PackRhs(). +template +class PackedSideBlock { + public: + typedef tKernelSideFormat KernelSideFormat; + + PackedSideBlock(Side side, Allocator* allocator, + const BlockParams& block_params) + : allocator_(allocator), pos_(0) { + GetSideBlockParams(side, ¶ms_, block_params); + data_handle_ = + allocator_->Reserve(params_.l2_width * params_.l2_depth); + sums_of_each_slice_handle_ = + allocator_->Reserve(params_.l2_width); + } + + ~PackedSideBlock() {} + + void seek_run(int start_width, int start_depth) const { + int kernel_run_depth = + std::min(params_.l1_depth, params_.l2_depth - start_depth); + pos_ = params_.l2_width * start_depth + start_width * kernel_run_depth; + } + + void seek_next_cell() const { pos_ += KernelSideFormat::Cell::kSize; } + + void seek_forward_n_cells(int n) const { + pos_ += n * KernelSideFormat::Cell::kSize; + } + + // TODO(suharshs): The datatype can now be int8 as well. We could introduce a + // new int8 current_data impl as well. This change would propagate to all pack + // impls and the Kernel::Run API, which all assume uint8. For now we leave + // this as-is pending future refactor. + const std::uint8_t* current_data() const { + return allocator_->GetPointer(data_handle_) + pos_; + } + + std::uint8_t* current_data() { + return allocator_->GetPointer(data_handle_) + pos_; + } + + std::int32_t* sums_of_each_slice() { + return allocator_->GetPointer(sums_of_each_slice_handle_); + } + + const std::int32_t* sums_of_each_slice() const { + return allocator_->GetPointer( + sums_of_each_slice_handle_); + } + + const SideBlockParams& params() const { return params_; } + + private: + // The block size parameters that this PackedSizeBlock follows. + // The L2 parameters determine its overall size, while the L1 parameters, + // together with the kernel format template parameter, determine + // the fine details of the storage/traversal order. + SideBlockParams params_; + + // Pointer to the allocator provided by the caller. Not owned. + // The Allocator is assumed to outlive the PackedSideBlock. + Allocator* const allocator_; + + // Handle on the buffer backing this packed block. Owned. + Allocator::Handle data_handle_; + + // Handle on the additional buffer backing the vector of sums of slices + // associated with this block. Owned. + Allocator::Handle sums_of_each_slice_handle_; + + // pos_ is the current position in the buffer, which we access + // sequentially, like a file. + // The idea is that we pack data in the same order as it is + // going to be traversed during the computation, which for + // cache-friendliness reasons is complicated to random-access, + // as the offsets calculations would be intricate. So we + // give up random-access addressing, and instead content ourselves + // with sequential access. + // + // pos_ is mutable because during the computation we will want to + // be able to iterate on the data in a const PackedSideBlock. + mutable int pos_; +}; + +// WidthMajor and DepthMajor are custom phrases modelled after the +// standard terminology 'row-major' and 'column-major'. Their meaning +// should be transparent once one has read the explanation in kernel.h: +// for example, in the Lhs, the 'width' dimension is the rows dimension, +// so there WidthMajor means RowMajor, while in the Rhs it is the opposite. +// Another way to put it: WidthMajor means that contiguous storage is used +// for entries having the same 'width' index. +enum class SideMapOrder { WidthMajor, DepthMajor }; + +// Similar to MatrixMap from map.h, but in terms of width/depth instead of +// rows/columns. Used to address blocks of the input LHS/RHS matrices when +// packing them. +template +class SideMap { + public: + typedef tScalar Scalar; + static constexpr SideMapOrder kOrder = tOrder; + + SideMap(Scalar* data, int width, int depth, int stride) + : data_(data), width_(width), depth_(depth), stride_(stride) {} + + SideMap(Scalar* data, int width, int depth) + : data_(data), width_(width), depth_(depth) { + stride_ = kOrder == SideMapOrder::WidthMajor ? depth_ : width_; + } + + SideMap(const SideMap& other) = default; + SideMap& operator=(const SideMap& other) = default; + + int width() const { return width_; } + int depth() const { return depth_; } + int stride() const { return stride_; } + int width_stride() const { + return kOrder == SideMapOrder::DepthMajor ? 1 : stride_; + } + int depth_stride() const { + return kOrder == SideMapOrder::WidthMajor ? 1 : stride_; + } + Scalar* data() const { return data_; } + Scalar* data(int w, int d) const { + return data_ + w * width_stride() + d * depth_stride(); + } + Scalar operator()(int w, int d) const { return *data(w, d); } + Scalar& operator()(int w, int d) { return *data(w, d); } + + SideMap block(int start_width, int start_depth, int block_width, + int block_depth) const { + assert(start_width >= 0); + assert(start_width + block_width <= width_); + assert(start_depth >= 0); + assert(start_depth + block_depth <= depth_); + + return SideMap(data(start_width, start_depth), block_width, block_depth, + stride_); + } + + private: + Scalar* data_; // not owned. + int width_, depth_, stride_; +}; + +// A PackingRegisterBlock is a small fixed-size block of a matrix being +// packed. This class is the generic non-optimized implementation, +// it is inherited by the generic implementation of PackingRegisterBlock, +// which may be overriden by template specialization. Overriding it is how +// one may provide optimized packing code paths. +// +// The packing of a block proceeds in two steps: +// 1. Ensuring that we have a complete block of source data, i.e. a block of +// the compile-time prescribed size. This is where we handle unaligned +// boundaries: if we don't have a complete block of source data, then +// we copy and zero-extend it into a local temporary (complete_src_), +// see MakeCompleteSrc. In the generic case, we do have a complete block, +// so we just use it in-place, see UseCompleteSrcInPlace. +// 2. Packing a complete block into the destination, see Pack. This is the +// most critical part, so it's convenient that unaligned boundaries have +// already been handled in step 1. +template +class PackingRegisterBlockBase { + public: + typedef typename PackedSideBlock::KernelSideFormat KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + typedef typename KernelSideFormat::InputScalar KernelInputScalar; + typedef typename KernelSideFormat::Scalar KernelScalar; + static constexpr int kCells = KernelSideFormat::kCells; + static constexpr int kCellWidth = CellFormat::kWidth; + static constexpr int kKernelWidth = CellFormat::kWidth * kCells; + static constexpr int kCellDepth = CellFormat::kDepth; + static constexpr int kCellSize = CellFormat::kSize; + static constexpr SideMapOrder kSrcOrder = SrcMapType::kOrder; + static constexpr int kZeroPointInputValue = + ZeroPointInputValue::kValue; + + PackingRegisterBlockBase() : complete_src_(nullptr, 0, 0, 0) {} + + protected: + // The source data that's ready for packing. May point to + // in-place actual source data if it's already a complete block, + // (see UseCompleteSrcInPlace) + // or to the local buf_ below into which we copy incomplete blocks + // (see MakeCompleteSrc) + SrcMapType complete_src_; + + // Temporary buffer for loading incomplete blocks to, + // in the source storage order + std::uint8_t buf_[kKernelWidth * kRegisterSize]; + + public: + // Selects a block if in-place source data that's already a complete block. + void UseCompleteSrcInPlace(const SrcMapType& src) { complete_src_ = src; } + // Copies an incomplete block of source data into a local temporary + // complete block by zero-extending it. + void MakeCompleteSrc(const SrcMapType& src) { + memset(buf_, kZeroPointInputValue, kKernelWidth * kRegisterSize); + if (kSrcOrder == SideMapOrder::WidthMajor) { + for (int w = 0; w < src.width(); w++) { + memcpy(buf_ + w * kRegisterSize, src.data(w, 0), src.depth()); + } + } else { + assert(kSrcOrder == SideMapOrder::DepthMajor); + for (int d = 0; d < src.depth(); d++) { + memcpy(buf_ + d * kKernelWidth, src.data(0, d), src.width()); + } + } + + // Since the KernelInputScalar type may not be uint8, we need to cast buf_. + complete_src_ = SrcMapType(reinterpret_cast(buf_), + kKernelWidth, kRegisterSize); + } + // Packs a complete block into the destination. This is the most + // critical part and the part that we most typically want to + // override in architecture-specific optimized specializations. + void Pack(PackedSideBlock* dst, int start_width) { + std::uint8_t* dst_ptr = dst->current_data(); + for (int cell_start_depth = 0; cell_start_depth < kRegisterSize; + cell_start_depth += kCellDepth) { + for (int cell_start_width = 0; cell_start_width < kKernelWidth; + cell_start_width += kCellWidth) { + std::int32_t* cell_sums_of_each_slice_ptr = + dst->sums_of_each_slice() + start_width + cell_start_width; + const SideMap src_cell_map( + complete_src_.block(cell_start_width, cell_start_depth, kCellWidth, + kCellDepth)); + for (int w = 0; w < kCellWidth; w++) { + std::int32_t sum = 0; + for (int d = 0; d < kCellDepth; d++) { + const std::uint8_t src_val = src_cell_map(w, d); + const std::int16_t kernel_val_unwrapped = + src_val - kZeroPointInputValue; + const std::uint8_t kernel_val_uint8 = kernel_val_unwrapped; + dst_ptr[OffsetIntoCell(w, d)] = kernel_val_uint8; + sum += kernel_val_unwrapped; + } + cell_sums_of_each_slice_ptr[w] += sum; + } + dst_ptr += kCellSize; + } + } + dst->seek_forward_n_cells(kCells * kRegisterSize / kCellDepth); + } +}; + +template +class PackingRegisterBlock + : public PackingRegisterBlockBase {}; + +// Large-scale implementation of packing. +template +class PackSideBlockImpl { + public: + typedef typename PackedSideBlock::KernelSideFormat KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static constexpr int kCells = KernelSideFormat::kCells; + static constexpr int kCellWidth = CellFormat::kWidth; + static constexpr int kKernelWidth = CellFormat::kWidth * kCells; + static constexpr int kCellDepth = CellFormat::kDepth; + + typedef PackingRegisterBlock + PackingRegisterBlockType; + + PackSideBlockImpl(PackedSideBlock* packed_side_block, + const SrcMapType& src_map) + : packed_side_block_(packed_side_block), src_map_(src_map) {} + + PackedSideBlock* packed_side_block() const { return packed_side_block_; } + + const SrcMapType& src_map() const { return src_map_; } + + // The public entry point to pack a block. + void PackL2() { + memset(packed_side_block_->sums_of_each_slice(), 0, + sizeof(std::int32_t) * packed_side_block_->params().l2_width); + for (int d = 0; d < src_map_.depth(); + d += packed_side_block_->params().l1_depth) { + int ds = std::min(packed_side_block_->params().l1_depth, + src_map_.depth() - d); + + for (int w = 0; w < src_map_.width(); + w += packed_side_block_->params().l1_width) { + int ws = std::min(packed_side_block_->params().l1_width, + src_map_.width() - w); + + PrefetchL1(w, ws, d, ds); + PackL1(w, ws, d, ds); + } + } + } + + protected: + // The intermediate-level loops, between PackL2 and PackRun. + void PackL1(int start_width, int width, int start_depth, int depth) { + for (int w = 0; w < width; w += kKernelWidth) { + int ws = std::min(+kKernelWidth, width - w); + packed_side_block_->seek_run(start_width + w, start_depth); + PackRun(start_width + w, ws, start_depth, depth); + } + } + + // Prefetches the data that will be read by PackL1. + void PrefetchL1(int start_width, int width, int start_depth, int depth) { + if (SrcMapType::kOrder == SideMapOrder::WidthMajor) { + for (int d = 0; d < depth; d += kDefaultCacheLineSize) { + for (int w = 0; w < width; w += 1) { + Prefetch(src_map_.data(start_width + w, start_depth + d)); + } + } + } else { + for (int d = 0; d < depth; d++) { + for (int w = 0; w < width; w += kDefaultCacheLineSize) { + Prefetch(src_map_.data(start_width + w, start_depth + d)); + } + } + } + } + + // PackRun packs only a run i.e. is the inner loop in the depth dimension. + void PackRun(int start_width, int width, int start_depth, int depth) { + PackingRegisterBlockType b; + if (width == kKernelWidth) { + const int register_aligned_depth = RoundDown(depth); + if (register_aligned_depth) { + for (int d = 0; d < register_aligned_depth; d += kRegisterSize) { + b.UseCompleteSrcInPlace(src_map_.block(start_width, start_depth + d, + width, kRegisterSize)); + b.Pack(packed_side_block_, start_width); + } + } + if (register_aligned_depth < depth) { + b.MakeCompleteSrc( + src_map_.block(start_width, start_depth + register_aligned_depth, + width, depth - register_aligned_depth)); + b.Pack(packed_side_block_, start_width); + } + } else { + assert(width < kKernelWidth); + for (int d = 0; d < depth; d += kRegisterSize) { + const int ds = std::min(+kRegisterSize, depth - d); + b.MakeCompleteSrc( + src_map_.block(start_width, start_depth + d, width, ds)); + b.Pack(packed_side_block_, start_width); + } + } + } + + // The PackedSideBlock being packed, i.e. the 'destination'. + PackedSideBlock* const packed_side_block_; + + // A map on the block of the original matrix block being packed, + // i.e. the 'source'. + const SrcMapType& src_map_; +}; + +// Packs a block of the input LHS matrix, into a PackedSideBlock. +template +void PackLhs(PackedSideBlock* dst, const MatrixMapType& src) { + ScopedProfilingLabel label("pack LHS"); + static const SideMapOrder kSideMapOrder = + MatrixMapType::kOrder == MapOrder::RowMajor ? SideMapOrder::WidthMajor + : SideMapOrder::DepthMajor; + typedef typename MatrixMapType::Scalar Scalar; + typedef SideMap SideMapType; + SideMapType src_side_map(src.data(), src.rows(), src.cols(), src.stride()); + typedef PackSideBlockImpl ImplType; + ImplType impl(dst, src_side_map); + impl.PackL2(); +} + +// Packs a block of the input RHS matrix, into a PackedSideBlock. +template +void PackRhs(PackedSideBlock* dst, const MatrixMapType& src) { + ScopedProfilingLabel label("pack RHS"); + static const SideMapOrder kSideMapOrder = + MatrixMapType::kOrder == MapOrder::ColMajor ? SideMapOrder::WidthMajor + : SideMapOrder::DepthMajor; + typedef typename MatrixMapType::Scalar Scalar; + typedef SideMap SideMapType; + SideMapType src_side_map(src.data(), src.cols(), src.rows(), src.stride()); + typedef PackSideBlockImpl ImplType; + ImplType impl(dst, src_side_map); + impl.PackL2(); +} + +} // namespace gemmlowp + +#ifdef GEMMLOWP_NEON +#include "pack_neon.h" +#elif defined(GEMMLOWP_SSE4) +#include "pack_sse.h" +#elif defined(GEMMLOWP_AVX2) +#include "pack_avx.h" +#elif defined(GEMMLOWP_MSA) +#include "pack_msa.h" +#endif + +#endif // GEMMLOWP_INTERNAL_PACK_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_avx.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_avx.h new file mode 100644 index 0000000000000000000000000000000000000000..1ef5ce1efe6e15206957f1eb8cf1ccb275832832 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_avx.h @@ -0,0 +1,282 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pack_avx.h: optimized AVX specializations of the templates in pack.h. + +#ifndef GEMMLOWP_INTERNAL_PACK_AVX_H_ +#define GEMMLOWP_INTERNAL_PACK_AVX_H_ + +#include +#include "pack.h" + +namespace gemmlowp { + +// TODO: Add DepthMajorUint8SideMap + +typedef SideMap + WidthMajorUint8SideMap; + +template +using WidthMajorSideFormatNCells4x2 = + KernelSideFormat, Cells>; + +template +class PackingRegisterBlock< + WidthMajorUint8SideMap, + PackedSideBlock>> + : public PackingRegisterBlockBase< + WidthMajorUint8SideMap, + PackedSideBlock>> { + public: + typedef WidthMajorSideFormatNCells4x2 KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static const int kCells = KernelSideFormat::kCells; + static const int kCellWidth = CellFormat::kWidth; + static const int kKernelWidth = CellFormat::kWidth * kCells; + static const int kCellDepth = CellFormat::kDepth; + static const int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock *dst, int start_width) { + std::uint8_t *dst_ptr = dst->current_data(); + const int width_stride = this->complete_src_.width_stride(); + int depth_step = 16; + + __m256i one = _mm256_set1_epi16(1); + for (int cell_start_depth = 0; cell_start_depth < kRegisterSize; + cell_start_depth += depth_step) { + for (int cell_start_width = 0; cell_start_width < kKernelWidth; + cell_start_width += kCellWidth) { + std::int32_t *cell_sums_of_each_slice_ptr = + dst->sums_of_each_slice() + start_width + cell_start_width; + const std::uint8_t *src_data = + this->complete_src_.data(cell_start_width, cell_start_depth); + + __m128i xmm1 = + _mm_loadu_si128(reinterpret_cast(&src_data[0])); + __m128i xmm2 = _mm_loadu_si128( + reinterpret_cast(&src_data[1 * width_stride])); + __m128i xmm3 = _mm_loadu_si128( + reinterpret_cast(&src_data[2 * width_stride])); + __m128i xmm4 = _mm_loadu_si128( + reinterpret_cast(&src_data[3 * width_stride])); + __m128i xmm5 = _mm_loadu_si128( + reinterpret_cast(&src_data[4 * width_stride])); + __m128i xmm6 = _mm_loadu_si128( + reinterpret_cast(&src_data[5 * width_stride])); + __m128i xmm7 = _mm_loadu_si128( + reinterpret_cast(&src_data[6 * width_stride])); + __m128i xmm8 = _mm_loadu_si128( + reinterpret_cast(&src_data[7 * width_stride])); + + __m256i ymm1 = _mm256_set_m128i(xmm5, xmm1); + __m256i ymm2 = _mm256_set_m128i(xmm6, xmm2); + __m256i ymm3 = _mm256_set_m128i(xmm7, xmm3); + __m256i ymm4 = _mm256_set_m128i(xmm8, xmm4); + + __m256i ymm5 = _mm256_unpacklo_epi16(ymm1, ymm2); + __m256i ymm6 = _mm256_unpacklo_epi16(ymm3, ymm4); + + __m256i ymm9 = _mm256_unpackhi_epi16(ymm1, ymm2); + __m256i ymm10 = _mm256_unpackhi_epi16(ymm3, ymm4); + + __m256i ymm7 = _mm256_unpacklo_epi32(ymm5, ymm6); + __m256i ymm8 = _mm256_unpackhi_epi32(ymm5, ymm6); + + __m256i ymm13 = _mm256_unpacklo_epi32(ymm9, ymm10); + __m256i ymm14 = _mm256_unpackhi_epi32(ymm9, ymm10); + + __m256i ymm11 = _mm256_permute4x64_epi64(ymm7, 0xd8); + __m256i ymm12 = _mm256_permute4x64_epi64(ymm8, 0xd8); + + __m256i ymm15 = _mm256_permute4x64_epi64(ymm13, 0xd8); + __m256i ymm16 = _mm256_permute4x64_epi64(ymm14, 0xd8); + + __m128i xmm9 = _mm256_castsi256_si128(ymm11); + __m128i xmm10 = _mm256_castsi256_si128(ymm12); + __m128i xmm11 = _mm256_extracti128_si256(ymm11, 1); + __m128i xmm12 = _mm256_extracti128_si256(ymm12, 1); + + xmm1 = _mm256_castsi256_si128(ymm15); + xmm2 = _mm256_castsi256_si128(ymm16); + xmm3 = _mm256_extracti128_si256(ymm15, 1); + xmm4 = _mm256_extracti128_si256(ymm16, 1); + + _mm_storeu_si128(reinterpret_cast<__m128i *>(&dst_ptr[0]), xmm9); + _mm_storeu_si128( + reinterpret_cast<__m128i *>(&dst_ptr[kCellSize * kCells]), xmm11); + _mm_storeu_si128( + reinterpret_cast<__m128i *>(&dst_ptr[2 * kCellSize * kCells]), + xmm10); + _mm_storeu_si128( + reinterpret_cast<__m128i *>(&dst_ptr[3 * kCellSize * kCells]), + xmm12); + _mm_storeu_si128( + reinterpret_cast<__m128i *>(&dst_ptr[4 * kCellSize * kCells]), + xmm1); + _mm_storeu_si128( + reinterpret_cast<__m128i *>(&dst_ptr[5 * kCellSize * kCells]), + xmm3); + + _mm_storeu_si128( + reinterpret_cast<__m128i *>(&dst_ptr[6 * kCellSize * kCells]), + xmm2); + _mm_storeu_si128( + reinterpret_cast<__m128i *>(&dst_ptr[7 * kCellSize * kCells]), + xmm4); + + ymm6 = _mm256_cvtepu8_epi16(xmm9); + ymm7 = _mm256_madd_epi16(ymm6, one); + __m256i sums_of_each_slice_xmm = _mm256_loadu_si256( + reinterpret_cast(&cell_sums_of_each_slice_ptr[0])); + sums_of_each_slice_xmm = _mm256_add_epi32(sums_of_each_slice_xmm, ymm7); + + ymm6 = _mm256_cvtepu8_epi16(xmm11); + ymm7 = _mm256_madd_epi16(ymm6, one); + sums_of_each_slice_xmm = _mm256_add_epi32(sums_of_each_slice_xmm, ymm7); + + ymm6 = _mm256_cvtepu8_epi16(xmm10); + ymm7 = _mm256_madd_epi16(ymm6, one); + sums_of_each_slice_xmm = _mm256_add_epi32(sums_of_each_slice_xmm, ymm7); + + ymm6 = _mm256_cvtepu8_epi16(xmm12); + ymm7 = _mm256_madd_epi16(ymm6, one); + sums_of_each_slice_xmm = _mm256_add_epi32(sums_of_each_slice_xmm, ymm7); + + ymm6 = _mm256_cvtepu8_epi16(xmm1); + ymm7 = _mm256_madd_epi16(ymm6, one); + sums_of_each_slice_xmm = _mm256_add_epi32(sums_of_each_slice_xmm, ymm7); + + ymm6 = _mm256_cvtepu8_epi16(xmm3); + ymm7 = _mm256_madd_epi16(ymm6, one); + sums_of_each_slice_xmm = _mm256_add_epi32(sums_of_each_slice_xmm, ymm7); + + ymm6 = _mm256_cvtepu8_epi16(xmm2); + ymm7 = _mm256_madd_epi16(ymm6, one); + sums_of_each_slice_xmm = _mm256_add_epi32(sums_of_each_slice_xmm, ymm7); + + ymm6 = _mm256_cvtepu8_epi16(xmm4); + ymm7 = _mm256_madd_epi16(ymm6, one); + sums_of_each_slice_xmm = _mm256_add_epi32(sums_of_each_slice_xmm, ymm7); + + _mm256_storeu_si256( + reinterpret_cast<__m256i *>(&cell_sums_of_each_slice_ptr[0]), + sums_of_each_slice_xmm); + dst_ptr += kCellSize; + } + dst_ptr += 7 * kCellSize * kCells; + } + dst->seek_forward_n_cells(kCells * kRegisterSize / kCellDepth); + } +}; + +// Pack format for 4x2 rhs format +template +using RhsWidthMajorSideFormatNCells4x2 = + KernelSideFormat, Cells>; + +template +class PackingRegisterBlock< + WidthMajorUint8SideMap, + PackedSideBlock>> + : public PackingRegisterBlockBase< + WidthMajorUint8SideMap, + PackedSideBlock>> { + public: + typedef RhsWidthMajorSideFormatNCells4x2 KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static const int kCells = KernelSideFormat::kCells; + static const int kCellWidth = CellFormat::kWidth; + static const int kKernelWidth = CellFormat::kWidth * kCells; + static const int kCellDepth = CellFormat::kDepth; + static const int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock *dst, int start_width) { + std::uint8_t *dst_ptr = dst->current_data(); + const int width_stride = this->complete_src_.width_stride(); + int depth_step = 8; + + __m128i one = _mm_set1_epi16(1); + for (int cell_start_depth = 0; cell_start_depth < kRegisterSize; + cell_start_depth += depth_step) { + for (int cell_start_width = 0; cell_start_width < kKernelWidth; + cell_start_width += kCellWidth) { + std::int32_t *cell_sums_of_each_slice_ptr = + dst->sums_of_each_slice() + start_width + cell_start_width; + const std::uint8_t *src_data = + this->complete_src_.data(cell_start_width, cell_start_depth); + + __m128i xmm1 = + _mm_loadl_epi64(reinterpret_cast(&src_data[0])); + __m128i xmm2 = _mm_loadl_epi64( + reinterpret_cast(&src_data[1 * width_stride])); + __m128i xmm3 = _mm_loadl_epi64( + reinterpret_cast(&src_data[2 * width_stride])); + __m128i xmm4 = _mm_loadl_epi64( + reinterpret_cast(&src_data[3 * width_stride])); + + __m128i xmm5 = _mm_unpacklo_epi16(xmm1, xmm2); + __m128i xmm8 = _mm_shuffle_epi32(xmm5, 0x31); + + __m128i xmm6 = _mm_unpacklo_epi16(xmm3, xmm4); + __m128i xmm7 = _mm_shuffle_epi32(xmm6, 0x80); + + __m128i xmm9 = _mm_blend_epi16(xmm5, xmm7, 0xcc); + __m128i xmm10 = _mm_blend_epi16(xmm8, xmm6, 0xcc); + + _mm_storel_epi64(reinterpret_cast<__m128i *>(&dst_ptr[0]), xmm9); + _mm_storel_epi64( + reinterpret_cast<__m128i *>(&dst_ptr[kCellSize * kCells]), xmm10); + + __m128i xmm11 = _mm_shuffle_epi32(xmm9, 0xee); + __m128i xmm12 = _mm_shuffle_epi32(xmm10, 0xee); + + _mm_storel_epi64( + reinterpret_cast<__m128i *>(&dst_ptr[2 * kCellSize * kCells]), + xmm11); + _mm_storel_epi64( + reinterpret_cast<__m128i *>(&dst_ptr[3 * kCellSize * kCells]), + xmm12); + + xmm1 = _mm_cvtepu8_epi16(xmm9); + xmm2 = _mm_madd_epi16(xmm1, one); + __m128i sums_of_each_slice_xmm = _mm_loadu_si128( + reinterpret_cast(&cell_sums_of_each_slice_ptr[0])); + sums_of_each_slice_xmm = _mm_add_epi32(sums_of_each_slice_xmm, xmm2); + + xmm1 = _mm_cvtepu8_epi16(xmm10); + xmm2 = _mm_madd_epi16(xmm1, one); + sums_of_each_slice_xmm = _mm_add_epi32(sums_of_each_slice_xmm, xmm2); + + xmm1 = _mm_cvtepu8_epi16(xmm11); + xmm2 = _mm_madd_epi16(xmm1, one); + sums_of_each_slice_xmm = _mm_add_epi32(sums_of_each_slice_xmm, xmm2); + + xmm1 = _mm_cvtepu8_epi16(xmm12); + xmm2 = _mm_madd_epi16(xmm1, one); + sums_of_each_slice_xmm = _mm_add_epi32(sums_of_each_slice_xmm, xmm2); + + _mm_storeu_si128( + reinterpret_cast<__m128i *>(&cell_sums_of_each_slice_ptr[0]), + sums_of_each_slice_xmm); + dst_ptr += kCellSize; + } + dst_ptr += 3 * kCellSize * kCells; + } + dst->seek_forward_n_cells(kCells * kRegisterSize / kCellDepth); + } +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_PACK_AVX_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_msa.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_msa.h new file mode 100644 index 0000000000000000000000000000000000000000..4072229b012ad6fdb6a090e289543de43febd472 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_msa.h @@ -0,0 +1,431 @@ +// Copyright 2018 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pack_msa.h: optimized MSA specializations of the templates in pack.h. + +#ifndef GEMMLOWP_INTERNAL_PACK_MSA_H_ +#define GEMMLOWP_INTERNAL_PACK_MSA_H_ + +#include "pack.h" + +#include + +namespace gemmlowp { + +typedef SideMap + WidthMajorUint8SideMap; + +template +using DepthMajorSideFormatNCells4x2 = KernelSideFormat, Cells>; + +template +class PackingRegisterBlock< + WidthMajorUint8SideMap, + PackedSideBlock>> + : public PackingRegisterBlockBase< + WidthMajorUint8SideMap, + PackedSideBlock>> { + public: + typedef DepthMajorSideFormatNCells4x2 KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static constexpr int kCells = KernelSideFormat::kCells; + static const int kCellWidth = CellFormat::kWidth; + static const int kKernelWidth = CellFormat::kWidth * kCells; + static const int kCellDepth = CellFormat::kDepth; + static const int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock* dst, int start_width) { + std::uint8_t* dst_ptr = dst->current_data(); + const std::uint8_t* const src_ptr = this->complete_src_.data(); + const int stride = this->complete_src_.stride(); + // Load source WidthMajor data + v16i8 src_lines[4 * kCells]; + for (int i = 0; i < 4 * kCells; i++) { + src_lines[i] = __builtin_msa_ld_b( + const_cast(src_ptr + i * stride), 0); + } + // Reorder the data within registers to make DepthMajor 4x2 cells + v16i8 src_lines_intertwined_2x[2 * kCells][2]; + for (int i = 0; i < kCells; i++) { + src_lines_intertwined_2x[2 * i][0] = + __builtin_msa_ilvr_b(src_lines[4 * i + 2], src_lines[4 * i]); + src_lines_intertwined_2x[2 * i][1] = + __builtin_msa_ilvl_b(src_lines[4 * i + 2], src_lines[4 * i]); + src_lines_intertwined_2x[2 * i + 1][0] = + __builtin_msa_ilvr_b(src_lines[4 * i + 3], src_lines[4 * i + 1]); + src_lines_intertwined_2x[2 * i + 1][1] = + __builtin_msa_ilvl_b(src_lines[4 * i + 3], src_lines[4 * i + 1]); + } + v16i8 src_lines_intertwined_4x[2 * kCells][2]; + for (int i = 0; i < kCells; i++) { + src_lines_intertwined_4x[2 * i][0] = + __builtin_msa_ilvr_b(src_lines_intertwined_2x[2 * i + 1][0], + src_lines_intertwined_2x[2 * i][0]); + src_lines_intertwined_4x[2 * i][1] = + __builtin_msa_ilvl_b(src_lines_intertwined_2x[2 * i + 1][0], + src_lines_intertwined_2x[2 * i][0]); + src_lines_intertwined_4x[2 * i + 1][0] = + __builtin_msa_ilvr_b(src_lines_intertwined_2x[2 * i + 1][1], + src_lines_intertwined_2x[2 * i][1]); + src_lines_intertwined_4x[2 * i + 1][1] = + __builtin_msa_ilvl_b(src_lines_intertwined_2x[2 * i + 1][1], + src_lines_intertwined_2x[2 * i][1]); + } + // Store the resulting DepthMajor 4x2 cells in the destination packed block + for (int outer = 0; outer < 2; outer++) { + for (int inner = 0; inner < 2; inner++) { + if (kCells % 2 == 0) { + for (int cell = 0; cell < kCells; cell += 2) { + v2i64 tmp = __builtin_msa_ilvr_d( + reinterpret_cast( + src_lines_intertwined_4x[2 * (cell + 1) + outer][inner]), + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + } + for (int cell = 0; cell < kCells; cell += 2) { + v2i64 tmp = __builtin_msa_ilvl_d( + reinterpret_cast( + src_lines_intertwined_4x[2 * (cell + 1) + outer][inner]), + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + } + } else { + // Store even number of low vector halves. + for (int cell = 0; cell < kCells - 1; cell += 2) { + v2i64 tmp = __builtin_msa_ilvr_d( + reinterpret_cast( + src_lines_intertwined_4x[2 * (cell + 1) + outer][inner]), + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + } + // Store last low half and first high half. + v2i64 tmp = reinterpret_cast( + src_lines_intertwined_4x[2 * 0 + outer][inner]); + tmp = __builtin_msa_insve_d( + tmp, 0, + reinterpret_cast( + src_lines_intertwined_4x[2 * (kCells - 1) + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + // Store even number of high vector halves. + for (int cell = 1; cell < kCells; cell += 2) { + v2i64 tmp = __builtin_msa_ilvl_d( + reinterpret_cast( + src_lines_intertwined_4x[2 * (cell + 1) + outer][inner]), + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + } + } + } + } + // Compute sums across the depth dimension + v8i16 sums_of_2_cells[kCells][4]; + const v16i8 zeroes = __builtin_msa_ldi_b(0); + for (int outer = 0; outer < 2; outer++) { + for (int inner = 0; inner < 2; inner++) { + int i = 2 * outer + inner; + for (int cell = 0; cell < kCells; cell++) { + v8i16 tmp0 = reinterpret_cast(__builtin_msa_ilvr_b( + zeroes, src_lines_intertwined_4x[2 * cell + outer][inner])); + v8i16 tmp1 = reinterpret_cast(__builtin_msa_ilvl_b( + zeroes, src_lines_intertwined_4x[2 * cell + outer][inner])); + sums_of_2_cells[cell][i] = __builtin_msa_addv_h(tmp0, tmp1); + } + } + } + v4i32 sums_of_4_cells[kCells][4]; + for (int i = 0; i < 4; i++) { + for (int cell = 0; cell < kCells; cell++) { + v4i32 tmp0 = reinterpret_cast(__builtin_msa_ilvr_h( + reinterpret_cast(zeroes), sums_of_2_cells[cell][i])); + v4i32 tmp1 = reinterpret_cast(__builtin_msa_ilvl_h( + reinterpret_cast(zeroes), sums_of_2_cells[cell][i])); + sums_of_4_cells[cell][i] = __builtin_msa_addv_w(tmp0, tmp1); + } + } + // Update the sums_of_each_slice vector + for (int cell = 0; cell < kCells; cell++) { + v4i32 s01 = __builtin_msa_addv_w(sums_of_4_cells[cell][0], + sums_of_4_cells[cell][1]); + v4i32 s23 = __builtin_msa_addv_w(sums_of_4_cells[cell][2], + sums_of_4_cells[cell][3]); + v4i32 s = __builtin_msa_addv_w(s01, s23); + std::int32_t* sums_of_each_slice_ptr = + dst->sums_of_each_slice() + start_width + 4 * cell; + v4i32 tmp = __builtin_msa_ld_w(sums_of_each_slice_ptr, 0); + tmp = __builtin_msa_addv_w(tmp, s); + __builtin_msa_st_w(tmp, sums_of_each_slice_ptr, 0); + } + dst->seek_forward_n_cells(kCells * kRegisterSize / kCellDepth); + } +}; + +template +using WidthMajorSideFormatNCells4x2 = + KernelSideFormat, Cells>; + +template +class PackingRegisterBlock< + WidthMajorUint8SideMap, + PackedSideBlock>> + : public PackingRegisterBlockBase< + WidthMajorUint8SideMap, + PackedSideBlock>> { + public: + typedef WidthMajorSideFormatNCells4x2 KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static constexpr int kCells = KernelSideFormat::kCells; + static const int kCellWidth = CellFormat::kWidth; + static const int kKernelWidth = CellFormat::kWidth * kCells; + static const int kCellDepth = CellFormat::kDepth; + static const int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock* dst, int start_width) { + std::uint8_t* dst_ptr = dst->current_data(); + const std::uint8_t* src_ptr = this->complete_src_.data(); + const int stride = this->complete_src_.stride(); + // Load source WidthMajor data + v8i16 src_lines[kCells * 4]; + for (int i = 0; i < kCells; i++) { +#define GEMMLOWP_UNROLLED_LOOP_ITER(k) \ + src_lines[4 * i + k] = \ + __builtin_msa_ld_h(const_cast(src_ptr), 0); \ + src_ptr += stride; + + GEMMLOWP_UNROLLED_LOOP_ITER(0) + GEMMLOWP_UNROLLED_LOOP_ITER(1) + GEMMLOWP_UNROLLED_LOOP_ITER(2) + GEMMLOWP_UNROLLED_LOOP_ITER(3) + +#undef GEMMLOWP_UNROLLED_LOOP_ITER + } + // Reorder the data within registers to make WidthMajor 4x2 cells + v8i16 src_lines_intertwined_2x[2 * kCells][2]; + for (int i = 0; i < kCells; i++) { + src_lines_intertwined_2x[2 * i][0] = + __builtin_msa_ilvr_h(src_lines[4 * i + 2], src_lines[4 * i]); + src_lines_intertwined_2x[2 * i][1] = + __builtin_msa_ilvl_h(src_lines[4 * i + 2], src_lines[4 * i]); + src_lines_intertwined_2x[2 * i + 1][0] = + __builtin_msa_ilvr_h(src_lines[4 * i + 3], src_lines[4 * i + 1]); + src_lines_intertwined_2x[2 * i + 1][1] = + __builtin_msa_ilvl_h(src_lines[4 * i + 3], src_lines[4 * i + 1]); + } + v8i16 src_lines_intertwined_4x[2 * kCells][2]; + for (int i = 0; i < kCells; i++) { + src_lines_intertwined_4x[2 * i][0] = + __builtin_msa_ilvr_h(src_lines_intertwined_2x[2 * i + 1][0], + src_lines_intertwined_2x[2 * i][0]); + src_lines_intertwined_4x[2 * i][1] = + __builtin_msa_ilvl_h(src_lines_intertwined_2x[2 * i + 1][0], + src_lines_intertwined_2x[2 * i][0]); + src_lines_intertwined_4x[2 * i + 1][0] = + __builtin_msa_ilvr_h(src_lines_intertwined_2x[2 * i + 1][1], + src_lines_intertwined_2x[2 * i][1]); + src_lines_intertwined_4x[2 * i + 1][1] = + __builtin_msa_ilvl_h(src_lines_intertwined_2x[2 * i + 1][1], + src_lines_intertwined_2x[2 * i][1]); + } + // Store the resulting WidthMajor 4x2 cells in the destination packed block + for (int outer = 0; outer < 2; outer++) { + for (int inner = 0; inner < 2; inner++) { + if (kCells % 2 == 0) { + for (int cell = 0; cell < kCells; cell += 2) { + v2i64 tmp = __builtin_msa_ilvr_d( + reinterpret_cast( + src_lines_intertwined_4x[2 * (cell + 1) + outer][inner]), + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + } + for (int cell = 0; cell < kCells; cell += 2) { + v2i64 tmp = __builtin_msa_ilvl_d( + reinterpret_cast( + src_lines_intertwined_4x[2 * (cell + 1) + outer][inner]), + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + } + } else { + // Store even number of low vector halves. + for (int cell = 0; cell < kCells - 1; cell += 2) { + v2i64 tmp = __builtin_msa_ilvr_d( + reinterpret_cast( + src_lines_intertwined_4x[2 * (cell + 1) + outer][inner]), + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + } + // Store last low half and first high half. + v2i64 tmp = reinterpret_cast( + src_lines_intertwined_4x[2 * 0 + outer][inner]); + tmp = __builtin_msa_insve_d( + tmp, 0, + reinterpret_cast( + src_lines_intertwined_4x[2 * (kCells - 1) + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + // Store even number of high vector halves. + for (int cell = 1; cell < kCells; cell += 2) { + v2i64 tmp = __builtin_msa_ilvl_d( + reinterpret_cast( + src_lines_intertwined_4x[2 * (cell + 1) + outer][inner]), + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner])); + __builtin_msa_st_b(reinterpret_cast(tmp), dst_ptr, 0); + dst_ptr += 16; + } + } + } + } + // Compute sums across the depth dimension + v8i16 sums_of_2[kCells][4]; + for (int outer = 0; outer < 2; outer++) { + for (int inner = 0; inner < 2; inner++) { + int i = 2 * outer + inner; + for (int cell = 0; cell < kCells; cell++) { + sums_of_2[cell][i] = reinterpret_cast(__builtin_msa_hadd_u_h( + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner]), + reinterpret_cast( + src_lines_intertwined_4x[2 * cell + outer][inner]))); + } + } + } + v8i16 sums_of_4[kCells][2]; + for (int i = 0; i < 2; i++) { + for (int cell = 0; cell < kCells; cell++) { + sums_of_4[cell][i] = __builtin_msa_addv_h(sums_of_2[cell][2 * i], + sums_of_2[cell][2 * i + 1]); + } + } + v8i16 sums_of_8[kCells]; + for (int cell = 0; cell < kCells; cell++) { + sums_of_8[cell] = + __builtin_msa_addv_h(sums_of_4[cell][0], sums_of_4[cell][1]); + } + + v4i32 sums_of_16[kCells]; + const v8i16 zeroes = __builtin_msa_ldi_h(0); + for (int cell = 0; cell < kCells; cell++) { + sums_of_16[cell] = reinterpret_cast( + __builtin_msa_ilvr_h(zeroes, sums_of_8[cell])); + v8i16 tmp = __builtin_msa_ilvl_h(zeroes, sums_of_8[cell]); + sums_of_16[cell] = + __builtin_msa_addv_w(sums_of_16[cell], reinterpret_cast(tmp)); + } + // Update the sums_of_each_slice vector + for (int cell = 0; cell < kCells; cell++) { + std::int32_t* sums_of_each_slice_ptr = + dst->sums_of_each_slice() + start_width + 4 * cell; + v4i32 tmp = __builtin_msa_ld_w(sums_of_each_slice_ptr, 0); + tmp = __builtin_msa_addv_w(tmp, sums_of_16[cell]); + __builtin_msa_st_w(tmp, sums_of_each_slice_ptr, 0); + } + dst->seek_forward_n_cells(kCells * kRegisterSize / kCellDepth); + } +}; + +template +using Int8FastKernelFormat = + KernelSideFormatInt8, 1>; + +template +class PackingRegisterBlock>> + : public PackingRegisterBlockBase< + WidthMajorUint8SideMap, + PackedSideBlock>> { + public: + static_assert(Width == 2 || Width == 4, ""); + typedef Int8FastKernelFormat KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static const int kCells = KernelSideFormat::kCells; + static const int kCellWidth = CellFormat::kWidth; + static const int kKernelWidth = CellFormat::kWidth * kCells; + static const int kCellDepth = CellFormat::kDepth; + static const int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock* dst, int start_width) { + std::int32_t* sums_ptr = dst->sums_of_each_slice() + start_width; + std::uint8_t* dst_ptr = dst->current_data(); + const std::uint8_t* const src_ptr = this->complete_src_.data(); + const int stride = this->complete_src_.stride(); + // Load source WidthMajor data. + v16i8 src_lines[Width]; + for (int i = 0; i < Width; i++) { + src_lines[i] = __builtin_msa_ld_b( + const_cast(src_ptr + i * stride), 0); + } + for (int i = 0; i < Width; i++) { + // Subtract 128 by inverting bit 7. + src_lines[i] = reinterpret_cast( + __builtin_msa_bnegi_b(reinterpret_cast(src_lines[i]), 7)); + } + for (int i = 0; i < Width; i++) { + __builtin_msa_st_b(src_lines[i], dst_ptr + 16 * i, 0); + } + v8i16 sums2[Width]; + for (int i = 0; i < Width; i++) { + sums2[i] = __builtin_msa_hadd_s_h(src_lines[i], src_lines[i]); + } + v4i32 sums4_wide[Width]; + for (int i = 0; i < Width; i++) { + sums4_wide[i] = __builtin_msa_hadd_s_w(sums2[i], sums2[i]); + } + v8i16 sums4[Width / 2]; + for (int i = 0; i < Width / 2; i++) { + sums4[i] = __builtin_msa_pckev_h( + reinterpret_cast(sums4_wide[2 * i + 1]), + reinterpret_cast(sums4_wide[2 * i])); + } + v4i32 sums8_wide[Width / 2]; + for (int i = 0; i < Width / 2; i++) { + sums8_wide[i] = __builtin_msa_hadd_s_w(sums4[i], sums4[i]); + } + if (Width == 4) { + v4i32 sum = __builtin_msa_ld_w(const_cast(sums_ptr), 0); + v8i16 sums8 = __builtin_msa_pckev_h( + reinterpret_cast(sums8_wide[1]), + reinterpret_cast(sums8_wide[0])); + v4i32 sums16 = __builtin_msa_hadd_s_w(sums8, sums8); + sum = __builtin_msa_addv_w(sum, sums16); + __builtin_msa_st_w(sum, sums_ptr, 0); + } else { + assert(Width == 2); + std::int32_t sum[2] = { sums_ptr[0], sums_ptr[1] }; + v2i64 sums16 = __builtin_msa_hadd_s_d(sums8_wide[0], sums8_wide[0]); + sum[0] += __builtin_msa_copy_s_w(reinterpret_cast(sums16), 0); + sum[1] += __builtin_msa_copy_s_w(reinterpret_cast(sums16), 2); + sums_ptr[0] = sum[0]; + sums_ptr[1] = sum[1]; + } + dst->seek_forward_n_cells(1); + } +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_PACK_MSA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_neon.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_neon.h new file mode 100644 index 0000000000000000000000000000000000000000..f113d9efa7d2b61abcdbff22761b8a6b1c21a0d0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_neon.h @@ -0,0 +1,384 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pack_neon.h: optimized NEON specializations of the templates in pack.h. + +#ifndef GEMMLOWP_INTERNAL_PACK_NEON_H_ +#define GEMMLOWP_INTERNAL_PACK_NEON_H_ + +#include "pack.h" + +#include + +namespace gemmlowp { + +typedef SideMap + WidthMajorUint8SideMap; + +typedef SideMap + WidthMajorInt8SideMap; + +template +using DepthMajorSideFormatNCells4x2 = KernelSideFormat, Cells>; + +template +class PackingRegisterBlock< + WidthMajorUint8SideMap, + PackedSideBlock>> + : public PackingRegisterBlockBase< + WidthMajorUint8SideMap, + PackedSideBlock>> { + public: + typedef DepthMajorSideFormatNCells4x2 KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static const int kCells = KernelSideFormat::kCells; + static const int kCellWidth = CellFormat::kWidth; + static const int kKernelWidth = CellFormat::kWidth * kCells; + static const int kCellDepth = CellFormat::kDepth; + static const int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock* dst, int start_width) { + std::uint8_t* dst_ptr = dst->current_data(); + const std::uint8_t* const src_ptr = this->complete_src_.data(); + const int stride = this->complete_src_.stride(); + // Load source WidthMajor data + uint8x16_t src_lines[4 * kCells]; + for (int i = 0; i < 4 * kCells; i++) { + src_lines[i] = vld1q_u8(src_ptr + i * stride); + } + // Reorder the data within registers to make DepthMajor 4x2 cells + uint8x16x2_t src_lines_intertwined_2x[2 * kCells]; + for (int i = 0; i < kCells; i++) { + src_lines_intertwined_2x[2 * i] = + vzipq_u8(src_lines[4 * i], src_lines[4 * i + 2]); + src_lines_intertwined_2x[2 * i + 1] = + vzipq_u8(src_lines[4 * i + 1], src_lines[4 * i + 3]); + } + uint8x16x2_t src_lines_intertwined_4x[2 * kCells]; + for (int i = 0; i < kCells; i++) { + src_lines_intertwined_4x[2 * i] = + vzipq_u8(src_lines_intertwined_2x[2 * i].val[0], + src_lines_intertwined_2x[2 * i + 1].val[0]); + src_lines_intertwined_4x[2 * i + 1] = + vzipq_u8(src_lines_intertwined_2x[2 * i].val[1], + src_lines_intertwined_2x[2 * i + 1].val[1]); + } + // Store the resulting DepthMajor 4x2 cells in the destination packed block + for (int outer = 0; outer < 2; outer++) { + for (int inner = 0; inner < 2; inner++) { + for (int cell = 0; cell < kCells; cell++) { + uint8x8_t value = vget_low_u8( + src_lines_intertwined_4x[2 * cell + outer].val[inner]); + vst1_u8(dst_ptr, value); + dst_ptr += 8; + } + for (int cell = 0; cell < kCells; cell++) { + uint8x8_t value = vget_high_u8( + src_lines_intertwined_4x[2 * cell + outer].val[inner]); + vst1_u8(dst_ptr, value); + dst_ptr += 8; + } + } + } + // Compute sums across the depth dimension + uint16x8_t sums_of_2_cells[kCells][4]; + for (int outer = 0; outer < 2; outer++) { + for (int inner = 0; inner < 2; inner++) { + int i = 2 * outer + inner; + for (int cell = 0; cell < kCells; cell++) { + sums_of_2_cells[cell][i] = vaddl_u8( + vget_low_u8( + src_lines_intertwined_4x[2 * cell + outer].val[inner]), + vget_high_u8( + src_lines_intertwined_4x[2 * cell + outer].val[inner])); + } + } + } + int32x4_t sums_of_4_cells[kCells][4]; + for (int i = 0; i < 4; i++) { + for (int cell = 0; cell < kCells; cell++) { + sums_of_4_cells[cell][i] = vreinterpretq_s32_u32( + vaddl_u16(vget_low_u16(sums_of_2_cells[cell][i]), + vget_high_u16(sums_of_2_cells[cell][i]))); + } + } + // Update the sums_of_each_slice vector + for (int cell = 0; cell < kCells; cell++) { + int32x4_t s01 = + vaddq_s32(sums_of_4_cells[cell][0], sums_of_4_cells[cell][1]); + int32x4_t s23 = + vaddq_s32(sums_of_4_cells[cell][2], sums_of_4_cells[cell][3]); + int32x4_t s = vaddq_s32(s01, s23); + std::int32_t* sums_of_each_slice_ptr = + dst->sums_of_each_slice() + start_width + 4 * cell; + vst1q_s32(sums_of_each_slice_ptr, + vaddq_s32(s, vld1q_s32(sums_of_each_slice_ptr))); + } + dst->seek_forward_n_cells(kCells * kRegisterSize / kCellDepth); + } +}; + +template +using WidthMajorSideFormatNCells4x2 = + KernelSideFormat, Cells>; + +template +class PackingRegisterBlock< + WidthMajorUint8SideMap, + PackedSideBlock>> + : public PackingRegisterBlockBase< + WidthMajorUint8SideMap, + PackedSideBlock>> { + public: + typedef WidthMajorSideFormatNCells4x2 KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static const int kCells = KernelSideFormat::kCells; + static const int kCellWidth = CellFormat::kWidth; + static const int kKernelWidth = CellFormat::kWidth * kCells; + static const int kCellDepth = CellFormat::kDepth; + static const int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock* dst, int start_width) { + std::uint8_t* dst_ptr = dst->current_data(); + const std::uint8_t* src_ptr = this->complete_src_.data(); + const int stride = this->complete_src_.stride(); + // Load source WidthMajor data + uint16x8_t src_lines[kCells * 4]; + for (int i = 0; i < kCells; i++) { + // This packing path is used with our current + // less-than-8-bit kernel, and the partial unrolling of this loop + // results in substantially faster code (thanks to better + // register allocation) on Nexus 5. + +#define GEMMLOWP_UNROLLED_LOOP_ITER(k) \ + src_lines[4 * i + k] = vreinterpretq_u16_u8(vld1q_u8(src_ptr)); \ + src_ptr += stride; + + GEMMLOWP_UNROLLED_LOOP_ITER(0) + GEMMLOWP_UNROLLED_LOOP_ITER(1) + GEMMLOWP_UNROLLED_LOOP_ITER(2) + GEMMLOWP_UNROLLED_LOOP_ITER(3) + +#undef GEMMLOWP_UNROLLED_LOOP_ITER + } + // Reorder the data within registers to make WidthMajor 4x2 cells + uint16x8x2_t src_lines_intertwined_2x[2 * kCells]; + for (int i = 0; i < kCells; i++) { + src_lines_intertwined_2x[2 * i] = + vzipq_u16(src_lines[4 * i], src_lines[4 * i + 2]); + src_lines_intertwined_2x[2 * i + 1] = + vzipq_u16(src_lines[4 * i + 1], src_lines[4 * i + 3]); + } + uint16x8x2_t src_lines_intertwined_4x[2 * kCells]; + for (int i = 0; i < kCells; i++) { + src_lines_intertwined_4x[2 * i] = + vzipq_u16(src_lines_intertwined_2x[2 * i].val[0], + src_lines_intertwined_2x[2 * i + 1].val[0]); + src_lines_intertwined_4x[2 * i + 1] = + vzipq_u16(src_lines_intertwined_2x[2 * i].val[1], + src_lines_intertwined_2x[2 * i + 1].val[1]); + } + // Store the resulting WidthMajor 4x2 cells in the destination packed block + for (int outer = 0; outer < 2; outer++) { + for (int inner = 0; inner < 2; inner++) { + for (int cell = 0; cell < kCells; cell++) { + uint8x8_t value = vreinterpret_u8_u16(vget_low_u16( + src_lines_intertwined_4x[2 * cell + outer].val[inner])); + vst1_u8(dst_ptr, value); + dst_ptr += 8; + } + for (int cell = 0; cell < kCells; cell++) { + uint8x8_t value = vreinterpret_u8_u16(vget_high_u16( + src_lines_intertwined_4x[2 * cell + outer].val[inner])); + vst1_u8(dst_ptr, value); + dst_ptr += 8; + } + } + } + // Compute sums across the depth dimension + uint16x8_t sums_of_2[kCells][4]; + for (int outer = 0; outer < 2; outer++) { + for (int inner = 0; inner < 2; inner++) { + int i = 2 * outer + inner; + for (int cell = 0; cell < kCells; cell++) { + sums_of_2[cell][i] = vpaddlq_u8(vreinterpretq_u8_u16( + src_lines_intertwined_4x[2 * cell + outer].val[inner])); + } + } + } + uint16x8_t sums_of_4[kCells][2]; + for (int i = 0; i < 2; i++) { + for (int cell = 0; cell < kCells; cell++) { + sums_of_4[cell][i] = + vaddq_u16(sums_of_2[cell][2 * i], sums_of_2[cell][2 * i + 1]); + } + } + uint16x8_t sums_of_8[kCells]; + for (int cell = 0; cell < kCells; cell++) { + sums_of_8[cell] = vaddq_u16(sums_of_4[cell][0], sums_of_4[cell][1]); + } + + uint16x4_t sums_of_16[kCells]; + for (int cell = 0; cell < kCells; cell++) { + sums_of_16[cell] = vadd_u16(vget_low_u16(sums_of_8[cell]), + vget_high_u16(sums_of_8[cell])); + } + // Update the sums_of_each_slice vector + for (int cell = 0; cell < kCells; cell++) { + int32x4_t s = vreinterpretq_s32_u32(vmovl_u16(sums_of_16[cell])); + std::int32_t* sums_of_each_slice_ptr = + dst->sums_of_each_slice() + start_width + 4 * cell; + vst1q_s32(sums_of_each_slice_ptr, + vaddq_s32(s, vld1q_s32(sums_of_each_slice_ptr))); + } + dst->seek_forward_n_cells(kCells * kRegisterSize / kCellDepth); + } +}; + +#ifdef GEMMLOWP_NEON_32 +inline int16x8_t vpaddq_s16(int16x8_t a, int16x8_t b) { + const int16x4_t c = vpadd_s16(vget_low_s16(a), vget_high_s16(a)); + const int16x4_t d = vpadd_s16(vget_low_s16(b), vget_high_s16(b)); + return vcombine_s16(c, d); +} +#endif + +template +using Int8FastKernelFormat = + KernelSideFormatInt8, 1>; + +template +class PackingRegisterBlock>> + : public PackingRegisterBlockBase< + WidthMajorUint8SideMap, + PackedSideBlock>> { + public: + static_assert(Width == 2 || Width == 4, ""); + typedef Int8FastKernelFormat KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static const int kCells = KernelSideFormat::kCells; + static const int kCellWidth = CellFormat::kWidth; + static const int kKernelWidth = CellFormat::kWidth * kCells; + static const int kCellDepth = CellFormat::kDepth; + static const int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock* dst, int start_width) { + std::int32_t* sums_ptr = dst->sums_of_each_slice() + start_width; + std::uint8_t* dst_ptr = dst->current_data(); + const std::uint8_t* const src_ptr = this->complete_src_.data(); + const int stride = this->complete_src_.stride(); + // Load source WidthMajor data + uint8x16_t src_lines[Width]; + for (int i = 0; i < Width; i++) { + src_lines[i] = vld1q_u8(src_ptr + i * stride); + } + const uint8x16_t sign_bit_dup = vdupq_n_u8(0x80); + for (int i = 0; i < Width; i++) { + src_lines[i] = veorq_u8(src_lines[i], sign_bit_dup); + } + for (int i = 0; i < Width; i++) { + vst1q_u8(dst_ptr + 16 * i, src_lines[i]); + } + int16x8_t sums2[Width]; + for (int i = 0; i < Width; i++) { + const int8x8_t lo = vreinterpret_s8_u8(vget_low_u8(src_lines[i])); + const int8x8_t hi = vreinterpret_s8_u8(vget_high_u8(src_lines[i])); + sums2[i] = vaddl_s8(lo, hi); + } + int16x8_t sums4[Width / 2]; + for (int i = 0; i < Width / 2; i++) { + sums4[i] = vpaddq_s16(sums2[2 * i], sums2[2 * i + 1]); + } + if (Width == 4) { + int32x4_t sum = vld1q_s32(sums_ptr); + int16x8_t sums8 = vpaddq_s16(sums4[0], sums4[1]); + sum = vpadalq_s16(sum, sums8); + vst1q_s32(sums_ptr, sum); + } else { + assert(Width == 2); + int32x2_t sum = vld1_s32(sums_ptr); + int16x4_t sums8 = + vpadd_s16(vget_low_s16(sums4[0]), vget_high_s16(sums4[0])); + sum = vpadal_s16(sum, sums8); + vst1_s32(sums_ptr, sum); + } + dst->seek_forward_n_cells(1); + } +}; + +template +using Int8InputsFastKernelFormat = + KernelSideFormatInt8Inputs, 1>; + +// Same as above, but for int8 inputs, avoiding the uint8 -> int8 conversion. +template +class PackingRegisterBlock>> + : public PackingRegisterBlockBase< + WidthMajorInt8SideMap, + PackedSideBlock>> { + public: + static_assert(Width == 2 || Width == 4, ""); + typedef Int8InputsFastKernelFormat KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static const int kCells = KernelSideFormat::kCells; + static const int kCellWidth = CellFormat::kWidth; + static const int kKernelWidth = CellFormat::kWidth * kCells; + static const int kCellDepth = CellFormat::kDepth; + static const int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock* dst, int start_width) { + std::int32_t* sums_ptr = dst->sums_of_each_slice() + start_width; + std::int8_t* dst_ptr = reinterpret_cast(dst->current_data()); + const std::int8_t* const src_ptr = this->complete_src_.data(); + const int stride = this->complete_src_.stride(); + // Load source WidthMajor data + int8x16_t src_lines[Width]; + for (int i = 0; i < Width; i++) { + src_lines[i] = vld1q_s8(src_ptr + i * stride); + } + for (int i = 0; i < Width; i++) { + vst1q_s8(dst_ptr + 16 * i, src_lines[i]); + } + int16x8_t sums2[Width]; + for (int i = 0; i < Width; i++) { + const int8x8_t lo = vget_low_s8(src_lines[i]); + const int8x8_t hi = vget_high_s8(src_lines[i]); + sums2[i] = vaddl_s8(lo, hi); + } + int16x8_t sums4[Width / 2]; + for (int i = 0; i < Width / 2; i++) { + sums4[i] = vpaddq_s16(sums2[2 * i], sums2[2 * i + 1]); + } + if (Width == 4) { + int32x4_t sum = vld1q_s32(sums_ptr); + int16x8_t sums8 = vpaddq_s16(sums4[0], sums4[1]); + sum = vpadalq_s16(sum, sums8); + vst1q_s32(sums_ptr, sum); + } else { + assert(Width == 2); + int32x2_t sum = vld1_s32(sums_ptr); + int16x4_t sums8 = + vpadd_s16(vget_low_s16(sums4[0]), vget_high_s16(sums4[0])); + sum = vpadal_s16(sum, sums8); + vst1_s32(sums_ptr, sum); + } + dst->seek_forward_n_cells(1); + } +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_PACK_NEON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_sse.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_sse.h new file mode 100644 index 0000000000000000000000000000000000000000..b729014ae9adbabda531aaf5d7293bdbfa88d40a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/pack_sse.h @@ -0,0 +1,128 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pack_SSE.h: optimized SSE specializations of the templates in pack.h. + +#ifndef GEMMLOWP_INTERNAL_PACK_SSE_H_ +#define GEMMLOWP_INTERNAL_PACK_SSE_H_ + +#include +#include "pack.h" + +namespace gemmlowp { + +// TODO: Add DepthMajorUint8SideMap + +typedef SideMap + WidthMajorUint8SideMap; + +template +using WidthMajorSideFormatNCells4x2 = + KernelSideFormat, Cells>; + +template +class PackingRegisterBlock< + WidthMajorUint8SideMap, + PackedSideBlock > > + : public PackingRegisterBlockBase< + WidthMajorUint8SideMap, + PackedSideBlock > > { + public: + typedef WidthMajorSideFormatNCells4x2 KernelSideFormat; + typedef typename KernelSideFormat::Cell CellFormat; + static constexpr int kCells = KernelSideFormat::kCells; + static constexpr int kCellWidth = CellFormat::kWidth; + static constexpr int kKernelWidth = CellFormat::kWidth * kCells; + static constexpr int kCellDepth = CellFormat::kDepth; + static constexpr int kCellSize = CellFormat::kSize; + + void Pack(PackedSideBlock* dst, int start_width) { + std::uint8_t* dst_ptr = dst->current_data(); + const int width_stride = this->complete_src_.width_stride(); + int depth_step = 8; + + __m128i one = _mm_set1_epi16(1); + for (int cell_start_depth = 0; cell_start_depth < kRegisterSize; + cell_start_depth += depth_step) { + for (int cell_start_width = 0; cell_start_width < kKernelWidth; + cell_start_width += kCellWidth) { + std::int32_t* cell_sums_of_each_slice_ptr = + dst->sums_of_each_slice() + start_width + cell_start_width; + const std::uint8_t* src_data = + this->complete_src_.data(cell_start_width, cell_start_depth); + + __m128i xmm1 = + _mm_loadl_epi64(reinterpret_cast(&src_data[0])); + __m128i xmm2 = _mm_loadl_epi64( + reinterpret_cast(&src_data[1 * width_stride])); + __m128i xmm3 = _mm_loadl_epi64( + reinterpret_cast(&src_data[2 * width_stride])); + __m128i xmm4 = _mm_loadl_epi64( + reinterpret_cast(&src_data[3 * width_stride])); + + __m128i xmm5 = _mm_unpacklo_epi16(xmm1, xmm2); + __m128i xmm8 = _mm_shuffle_epi32(xmm5, 0x31); + + __m128i xmm6 = _mm_unpacklo_epi16(xmm3, xmm4); + __m128i xmm7 = _mm_shuffle_epi32(xmm6, 0x80); + + __m128i xmm9 = _mm_blend_epi16(xmm5, xmm7, 0xcc); + __m128i xmm10 = _mm_blend_epi16(xmm8, xmm6, 0xcc); + + _mm_storel_epi64(reinterpret_cast<__m128i*>(&dst_ptr[0]), xmm9); + _mm_storel_epi64( + reinterpret_cast<__m128i*>(&dst_ptr[kCellSize * kCells]), xmm10); + + __m128i xmm11 = _mm_shuffle_epi32(xmm9, 0xee); + __m128i xmm12 = _mm_shuffle_epi32(xmm10, 0xee); + + _mm_storel_epi64( + reinterpret_cast<__m128i*>(&dst_ptr[2 * kCellSize * kCells]), + xmm11); + _mm_storel_epi64( + reinterpret_cast<__m128i*>(&dst_ptr[3 * kCellSize * kCells]), + xmm12); + + xmm1 = _mm_cvtepu8_epi16(xmm9); + xmm2 = _mm_madd_epi16(xmm1, one); + __m128i sums_of_each_slice_xmm = _mm_loadu_si128( + reinterpret_cast(&cell_sums_of_each_slice_ptr[0])); + sums_of_each_slice_xmm = _mm_add_epi32(sums_of_each_slice_xmm, xmm2); + + xmm1 = _mm_cvtepu8_epi16(xmm10); + xmm2 = _mm_madd_epi16(xmm1, one); + sums_of_each_slice_xmm = _mm_add_epi32(sums_of_each_slice_xmm, xmm2); + + xmm1 = _mm_cvtepu8_epi16(xmm11); + xmm2 = _mm_madd_epi16(xmm1, one); + sums_of_each_slice_xmm = _mm_add_epi32(sums_of_each_slice_xmm, xmm2); + + xmm1 = _mm_cvtepu8_epi16(xmm12); + xmm2 = _mm_madd_epi16(xmm1, one); + sums_of_each_slice_xmm = _mm_add_epi32(sums_of_each_slice_xmm, xmm2); + + _mm_storeu_si128( + reinterpret_cast<__m128i*>(&cell_sums_of_each_slice_ptr[0]), + sums_of_each_slice_xmm); + dst_ptr += kCellSize; + } + dst_ptr += 3 * kCellSize * kCells; + } + dst->seek_forward_n_cells(kCells * kRegisterSize / kCellDepth); + } +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_PACK_SSE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/platform.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/platform.h new file mode 100644 index 0000000000000000000000000000000000000000..ab714146cb4ba87a1c84763ebb26e7cca93ae0a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/platform.h @@ -0,0 +1,117 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// internal/platform.h: a place to put platform specific code + +#ifndef GEMMLOWP_INTERNAL_PLATFORM_H_ +#define GEMMLOWP_INTERNAL_PLATFORM_H_ + +#ifdef _WIN32 +#include +#include +#else +#include +#include +#include +#endif + +#ifdef __APPLE__ +#include +#endif + +#if defined ANDROID || defined __ANDROID__ +#include +#include +// The 18 here should be 16, but has to be 18 for now due +// to a Google-internal issue. +#if __ANDROID_API__ < 18 +#define GEMMLOWP_USE_MEMALIGN +#endif +// posix_memalign is missing on some 4.1 x86 devices +#if __ANDROID_API__ == 18 +#ifdef GEMMLOWP_X86_32 +#define GEMMLOWP_USE_MEMALIGN +#endif +#endif +#endif + +// Needed by chrome native builds +#ifndef _SC_NPROCESSORS_CONF +#define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_ONLN +#endif + +namespace gemmlowp { + +#ifdef _WIN32 +inline void *aligned_alloc(size_t alignment, size_t size) { + return _aligned_malloc(size, alignment); +} + +inline void aligned_free(void *memptr) { _aligned_free(memptr); } + +inline int GetHardwareConcurrency(int max_threads) { + if (max_threads == 0) { + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; + } + return max_threads; +} + +inline double real_time_in_seconds() { + __int64 wintime; + GetSystemTimeAsFileTime((FILETIME *)&wintime); + wintime -= 116444736000000000LL; // 1jan1601 to 1jan1970 + return wintime / 10000000LL + wintime % 10000000LL * 100 * 1e-9; +} + +#else +inline void *aligned_alloc(size_t alignment, size_t size) { +#ifdef GEMMLOWP_USE_MEMALIGN + return memalign(alignment, size); +#else + void *memptr; + if (posix_memalign(&memptr, alignment, size)) { + memptr = nullptr; + } + return memptr; +#endif +} + +inline int GetHardwareConcurrency(int max_threads) { + if (max_threads == 0) { + static const int hardware_threads_count = + static_cast(sysconf(_SC_NPROCESSORS_CONF)); + return hardware_threads_count; + } + return max_threads; +} + +inline void aligned_free(void *memptr) { free(memptr); } + +inline double real_time_in_seconds() { +#ifdef __APPLE__ + timeval t; + gettimeofday(&t, nullptr); + return t.tv_sec + 1e-6 * t.tv_usec; +#else + timespec t; + clock_gettime(CLOCK_REALTIME, &t); + return t.tv_sec + 1e-9 * t.tv_nsec; +#endif +} + +#endif +} // namespace gemmlowp +#endif // GEMMLOWP_INTERNAL_PLATFORM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers.h new file mode 100644 index 0000000000000000000000000000000000000000..4e4cce8664a0d94438708ddcf7b639b670b9207f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers.h @@ -0,0 +1,669 @@ +// Copyright 2017 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// simd_wrappers.h: some inline functions wrapping SIMD intrinsics, +// extending the set of such functions from fixedpoint.h. + +#ifndef GEMMLOWP_INTERNAL_SIMD_WRAPPERS_H_ +#define GEMMLOWP_INTERNAL_SIMD_WRAPPERS_H_ + +#include +#include +#include "../fixedpoint/fixedpoint.h" + +namespace gemmlowp { + +template +struct RegisterType { + using Type = ScalarType; +}; + +inline std::int32_t Min(std::int32_t a, std::int32_t b) { + return std::min(a, b); +} + +inline std::int32_t Max(std::int32_t a, std::int32_t b) { + return std::max(a, b); +} + +inline void MulAdd(std::int32_t lhs, std::int32_t rhs, std::int32_t* acc) { + *acc += lhs * rhs; +} + +template +struct RegisterBuffer { + using ScalarType = tScalarType; + static constexpr int kScalarCount = tScalarCount; + using RegisterType = typename RegisterType::Type; + static_assert((kScalarCount & (kScalarCount - 1)) == 0, + "kScalarCount must be a power of two"); + static_assert(sizeof(RegisterType) % sizeof(ScalarType) == 0, ""); + static constexpr int kRegisterLanes = + sizeof(RegisterType) / sizeof(ScalarType); + static constexpr int kRegisterCount = + (kScalarCount * sizeof(ScalarType) + sizeof(RegisterType) - 1) / + sizeof(RegisterType); + + RegisterType reg[kRegisterCount]; +}; + +template +struct RegisterBlock { + using ScalarType = tScalarType; + static constexpr int kRows = tRows; + static constexpr int kCols = tCols; + static constexpr int kScalarCount = kRows * kCols; + using BufferType = RegisterBuffer; + using RegisterType = typename BufferType::RegisterType; + static constexpr int kRegisterCount = BufferType::kRegisterCount; + static constexpr int kRegisterLanes = BufferType::kRegisterLanes; + + BufferType buf; +}; + +template +struct RegisterBlockAddImpl { + static RegisterBlockType Run(const RegisterBlockType& lhs, + const RegisterBlockType& rhs) { + RegisterBlockType result; + for (int i = 0; i < RegisterBlockType::kRegisterCount; i++) { + result.buf.reg[i] = Add(lhs.buf.reg[i], rhs.buf.reg[i]); + } + return result; + } +}; + +template +RegisterBlockType RegisterBlockAdd(const RegisterBlockType& lhs, + const RegisterBlockType& rhs) { + return RegisterBlockAddImpl::Run(lhs, rhs); +} + +template +struct ShouldFlipLhsRhs { + static constexpr bool kValue = + (LhsType::kScalarCount < RhsType::kScalarCount) || + (LhsType::kScalarCount == RhsType::kScalarCount && + (LhsType::kRows < RhsType::kRows)); +}; + +template ::kValue> +struct FlipLhsRhs { + using FlippedLhsType = LhsType; + using FlippedRhsType = RhsType; + static const FlippedLhsType& FlippedLhs(const LhsType& lhs, + const RhsType& rhs) { + (void)rhs; + return lhs; + } + static const FlippedRhsType& FlippedRhs(const LhsType& lhs, + const RhsType& rhs) { + (void)lhs; + return rhs; + } +}; + +template +struct FlipLhsRhs { + using FlippedLhsType = RhsType; + using FlippedRhsType = LhsType; + static const FlippedLhsType& FlippedLhs(const LhsType& lhs, + const RhsType& rhs) { + (void)lhs; + return rhs; + } + static const FlippedRhsType& FlippedRhs(const LhsType& lhs, + const RhsType& rhs) { + (void)rhs; + return lhs; + } +}; + +template +struct BroadcastBinaryOpShape { + static constexpr int kRows = + Lhs::kRows > Rhs::kRows ? Lhs::kRows : Rhs::kRows; + static constexpr int kCols = + Lhs::kCols > Rhs::kCols ? Lhs::kCols : Rhs::kCols; +}; + +template +struct BroadcastBinaryOpRegisterBlock { + using Shape = BroadcastBinaryOpShape; + using ScalarType = typename Lhs::ScalarType; + using Type = RegisterBlock; +}; + +template +struct BroadcastAddImpl { + using ResultBlockType = + typename BroadcastBinaryOpRegisterBlock::Type; + static ResultBlockType Run(const Lhs& lhs, const Rhs& rhs) { + ResultBlockType result; + static constexpr int Rows = ResultBlockType::kRows; + static constexpr int Cols = ResultBlockType::kCols; + static constexpr int LhsRows = Lhs::kRows; + static constexpr int LhsCols = Lhs::kCols; + static constexpr int RhsRows = Rhs::kRows; + static constexpr int RhsCols = Rhs::kCols; + + static_assert(LhsRows == Rows || LhsRows == 1, ""); + static_assert(RhsRows == Rows || RhsRows == 1, ""); + static_assert(LhsCols == Cols || LhsCols == 1, ""); + static_assert(RhsCols == Cols || RhsCols == 1, ""); + static_assert(ResultBlockType::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Lhs::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Rhs::kRegisterLanes == 1, + "This path is only for scalar values"); + + for (int c = 0; c < Cols; c++) { + const int lhs_c = LhsCols == Cols ? c : 0; + const int rhs_c = RhsCols == Cols ? c : 0; + for (int r = 0; r < Rows; r++) { + const int lhs_r = LhsRows == Rows ? r : 0; + const int rhs_r = RhsRows == Rows ? r : 0; + result.buf.reg[r + c * Rows] = + Add(lhs.buf.reg[lhs_r + lhs_c * LhsRows], + rhs.buf.reg[rhs_r + rhs_c * RhsRows]); + } + } + return result; + } +}; + +template +typename BroadcastBinaryOpRegisterBlock::Type BroadcastAdd( + const Lhs& lhs, const Rhs& rhs) { + using Flip = FlipLhsRhs; + return BroadcastAddImpl< + typename Flip::FlippedLhsType, + typename Flip::FlippedRhsType>::Run(Flip::FlippedLhs(lhs, rhs), + Flip::FlippedRhs(lhs, rhs)); +} + +template +struct BroadcastShiftLeftImpl { + using ResultBlockType = + typename BroadcastBinaryOpRegisterBlock::Type; + static ResultBlockType Run(const Lhs& lhs, const Rhs& rhs) { + ResultBlockType result; + static constexpr int Rows = ResultBlockType::kRows; + static constexpr int Cols = ResultBlockType::kCols; + static constexpr int LhsRows = Lhs::kRows; + static constexpr int LhsCols = Lhs::kCols; + static constexpr int RhsRows = Rhs::kRows; + static constexpr int RhsCols = Rhs::kCols; + + static_assert(LhsRows == Rows || LhsRows == 1, ""); + static_assert(RhsRows == Rows || RhsRows == 1, ""); + static_assert(LhsCols == Cols || LhsCols == 1, ""); + static_assert(RhsCols == Cols || RhsCols == 1, ""); + static_assert(ResultBlockType::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Lhs::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Rhs::kRegisterLanes == 1, + "This path is only for scalar values"); + + for (int c = 0; c < Cols; c++) { + const int lhs_c = LhsCols == Cols ? c : 0; + const int rhs_c = RhsCols == Cols ? c : 0; + for (int r = 0; r < Rows; r++) { + const int lhs_r = LhsRows == Rows ? r : 0; + const int rhs_r = RhsRows == Rows ? r : 0; + result.buf.reg[r + c * Rows] = + ShiftLeft(lhs.buf.reg[lhs_r + lhs_c * LhsRows], + rhs.buf.reg[rhs_r + rhs_c * RhsRows]); + } + } + return result; + } +}; + +template +typename BroadcastBinaryOpRegisterBlock::Type BroadcastShiftLeft( + const Lhs& lhs, const Rhs& rhs) { + using Flip = FlipLhsRhs; + return BroadcastShiftLeftImpl< + typename Flip::FlippedLhsType, + typename Flip::FlippedRhsType>::Run(Flip::FlippedLhs(lhs, rhs), + Flip::FlippedRhs(lhs, rhs)); +} + +template +struct BroadcastSaturatingRoundingDoublingHighMulImpl { + using ResultBlockType = + typename BroadcastBinaryOpRegisterBlock::Type; + static ResultBlockType Run(const Lhs& lhs, const Rhs& rhs) { + ResultBlockType result; + static constexpr int Rows = ResultBlockType::kRows; + static constexpr int Cols = ResultBlockType::kCols; + static constexpr int LhsRows = Lhs::kRows; + static constexpr int LhsCols = Lhs::kCols; + static constexpr int RhsRows = Rhs::kRows; + static constexpr int RhsCols = Rhs::kCols; + + static_assert(LhsRows == Rows || LhsRows == 1, ""); + static_assert(RhsRows == Rows || RhsRows == 1, ""); + static_assert(LhsCols == Cols || LhsCols == 1, ""); + static_assert(RhsCols == Cols || RhsCols == 1, ""); + static_assert(ResultBlockType::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Lhs::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Rhs::kRegisterLanes == 1, + "This path is only for scalar values"); + + for (int c = 0; c < Cols; c++) { + const int lhs_c = LhsCols == Cols ? c : 0; + const int rhs_c = RhsCols == Cols ? c : 0; + for (int r = 0; r < Rows; r++) { + const int lhs_r = LhsRows == Rows ? r : 0; + const int rhs_r = RhsRows == Rows ? r : 0; + result.buf.reg[r + c * Rows] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[lhs_r + lhs_c * LhsRows], + rhs.buf.reg[rhs_r + rhs_c * RhsRows]); + } + } + return result; + } +}; + +template +typename BroadcastBinaryOpRegisterBlock::Type +BroadcastSaturatingRoundingDoublingHighMul(const Lhs& lhs, const Rhs& rhs) { + using Flip = FlipLhsRhs; + return BroadcastSaturatingRoundingDoublingHighMulImpl< + typename Flip::FlippedLhsType, + typename Flip::FlippedRhsType>::Run(Flip::FlippedLhs(lhs, rhs), + Flip::FlippedRhs(lhs, rhs)); +} + +template +struct BroadcastRoundingDivideByPOTImpl { + using ResultBlockType = + typename BroadcastBinaryOpRegisterBlock::Type; + static ResultBlockType Run(const Lhs& lhs, const Rhs& rhs) { + ResultBlockType result; + static constexpr int Rows = ResultBlockType::kRows; + static constexpr int Cols = ResultBlockType::kCols; + static constexpr int LhsRows = Lhs::kRows; + static constexpr int LhsCols = Lhs::kCols; + static constexpr int RhsRows = Rhs::kRows; + static constexpr int RhsCols = Rhs::kCols; + + static_assert(LhsRows == Rows || LhsRows == 1, ""); + static_assert(RhsRows == Rows || RhsRows == 1, ""); + static_assert(LhsCols == Cols || LhsCols == 1, ""); + static_assert(RhsCols == Cols || RhsCols == 1, ""); + static_assert(ResultBlockType::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Lhs::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Rhs::kRegisterLanes == 1, + "This path is only for scalar values"); + + for (int c = 0; c < Cols; c++) { + const int lhs_c = LhsCols == Cols ? c : 0; + const int rhs_c = RhsCols == Cols ? c : 0; + for (int r = 0; r < Rows; r++) { + const int lhs_r = LhsRows == Rows ? r : 0; + const int rhs_r = RhsRows == Rows ? r : 0; + result.buf.reg[r + c * Rows] = + RoundingDivideByPOT(lhs.buf.reg[lhs_r + lhs_c * LhsRows], + rhs.buf.reg[rhs_r + rhs_c * RhsRows]); + } + } + return result; + } +}; + +template +typename BroadcastBinaryOpRegisterBlock::Type +BroadcastRoundingDivideByPOT(const Lhs& lhs, const Rhs& rhs) { + using Flip = FlipLhsRhs; + return BroadcastRoundingDivideByPOTImpl< + typename Flip::FlippedLhsType, + typename Flip::FlippedRhsType>::Run(Flip::FlippedLhs(lhs, rhs), + Flip::FlippedRhs(lhs, rhs)); +} + +template +struct BroadcastMulImpl { + using ResultBlockType = + typename BroadcastBinaryOpRegisterBlock::Type; + static ResultBlockType Run(const Lhs& lhs, const Rhs& rhs) { + ResultBlockType result; + static constexpr int Rows = ResultBlockType::kRows; + static constexpr int Cols = ResultBlockType::kCols; + static constexpr int LhsRows = Lhs::kRows; + static constexpr int LhsCols = Lhs::kCols; + static constexpr int RhsRows = Rhs::kRows; + static constexpr int RhsCols = Rhs::kCols; + static_assert(ResultBlockType::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Lhs::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Rhs::kRegisterLanes == 1, + "This path is only for scalar values"); + + static_assert(LhsRows == Rows || LhsRows == 1, ""); + static_assert(RhsRows == Rows || RhsRows == 1, ""); + static_assert(LhsCols == Cols || LhsCols == 1, ""); + static_assert(RhsCols == Cols || RhsCols == 1, ""); + for (int c = 0; c < Cols; c++) { + const int lhs_c = LhsCols == Cols ? c : 0; + const int rhs_c = RhsCols == Cols ? c : 0; + for (int r = 0; r < Rows; r++) { + const int lhs_r = LhsRows == Rows ? r : 0; + const int rhs_r = RhsRows == Rows ? r : 0; + result.buf.reg[r + c * Rows] = + Mul(lhs.buf.reg[lhs_r + lhs_c * LhsRows], + rhs.buf.reg[rhs_r + rhs_c * RhsRows]); + } + } + return result; + } +}; + +template +typename BroadcastBinaryOpRegisterBlock::Type BroadcastMul( + const Lhs& lhs, const Rhs& rhs) { + using Flip = FlipLhsRhs; + return BroadcastMulImpl< + typename Flip::FlippedLhsType, + typename Flip::FlippedRhsType>::Run(Flip::FlippedLhs(lhs, rhs), + Flip::FlippedRhs(lhs, rhs)); +} + +template +struct BroadcastMulAddImpl { + static void Run(const Lhs& lhs, const Rhs& rhs, Acc* acc) { + static constexpr int Rows = Acc::kRows; + static constexpr int Cols = Acc::kCols; + static constexpr int LhsRows = Lhs::kRows; + static constexpr int LhsCols = Lhs::kCols; + static constexpr int RhsRows = Rhs::kRows; + static constexpr int RhsCols = Rhs::kCols; + static_assert(Acc::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Lhs::kRegisterLanes == 1, + "This path is only for scalar values"); + static_assert(Rhs::kRegisterLanes == 1, + "This path is only for scalar values"); + + static_assert(LhsRows == Rows || LhsRows == 1, ""); + static_assert(RhsRows == Rows || RhsRows == 1, ""); + static_assert(LhsCols == Cols || LhsCols == 1, ""); + static_assert(RhsCols == Cols || RhsCols == 1, ""); + for (int c = 0; c < Cols; c++) { + const int lhs_c = LhsCols == Cols ? c : 0; + const int rhs_c = RhsCols == Cols ? c : 0; + for (int r = 0; r < Rows; r++) { + const int lhs_r = LhsRows == Rows ? r : 0; + const int rhs_r = RhsRows == Rows ? r : 0; + MulAdd(lhs.buf.reg[lhs_r + lhs_c * LhsRows], + rhs.buf.reg[rhs_r + rhs_c * RhsRows], + &acc->buf.reg[r + c * Rows]); + } + } + } +}; + +template +void BroadcastMulAdd(const Lhs& lhs, const Rhs& rhs, Acc* acc) { + using Flip = FlipLhsRhs; + BroadcastMulAddImpl::Run(Flip::FlippedLhs(lhs, rhs), + Flip::FlippedRhs(lhs, rhs), acc); +} + +template +struct LoadImpl { + static_assert(std::is_same::value, + "This generic impl should never be hit"); +}; + +template +struct LoadImpl, + MatrixMap> { + using RegisterBlockType = RegisterBlock; + using SrcObjectType = MatrixMap; + static RegisterBlockType Run(const SrcObjectType& src, int row, int col) { + RegisterBlockType result; + int i = 0; + for (int c = 0; c < Cols; c++) { + const ScalarType* src_ptr = src.data(row, col + c); + for (int r = 0; r < Rows; r++) { + result.buf.reg[i++] = *src_ptr++; + } + } + return result; + } +}; + +template +struct LoadImpl, + VectorMap> { + using RegisterBlockType = RegisterBlock; + using SrcObjectType = VectorMap; + static RegisterBlockType Run(const SrcObjectType& src, int pos) { + static_assert(Shape == VectorShape::Col || Rows == 1, ""); + static_assert(Shape == VectorShape::Row || Cols == 1, ""); + RegisterBlockType result; + for (int i = 0; i < Rows * Cols; i++) { + result.buf.reg[i] = src(pos + i); + } + return result; + } +}; + +template +struct LoadImpl, + VectorDup> { + using RegisterBlockType = RegisterBlock; + using SrcObjectType = VectorDup; + static RegisterBlockType Run(const SrcObjectType& src, int) { + static_assert(Shape == VectorShape::Col || Rows == 1, ""); + static_assert(Shape == VectorShape::Row || Cols == 1, ""); + RegisterBlockType result; + for (int i = 0; i < Rows * Cols; i++) { + result.buf.reg[i] = src(0); + } + return result; + } +}; + +template +RegisterBlockType Load(const SrcObjectType& src, int row, int col) { + return LoadImpl::Run(src, row, col); +} + +template +RegisterBlockType Load(const SrcObjectType& src, int pos) { + return LoadImpl::Run(src, pos); +} + +template +struct LoadContiguousImpl { + using ScalarType = typename RegisterBlockType::ScalarType; + static_assert(RegisterBlockType::kRegisterLanes == 1, + "This path is only for scalar values"); + static RegisterBlockType Run(const ScalarType* src) { + RegisterBlockType result; + for (int i = 0; i < RegisterBlockType::kScalarCount; i++) { + result.buf.reg[i] = src[i]; + } + return result; + } +}; + +template +RegisterBlockType LoadContiguous( + const typename RegisterBlockType::ScalarType* src) { + return LoadContiguousImpl::Run(src); +} + +template +struct LoadForBroadcastingShape {}; + +template +struct LoadForBroadcastingShape> { + static constexpr int kRows = Shape == VectorShape::Col ? BroadcastRows : 1; + static constexpr int kCols = Shape == VectorShape::Row ? BroadcastCols : 1; +}; + +template +struct LoadForBroadcastingShape> { + static constexpr int kRows = 1; + static constexpr int kCols = 1; +}; + +template +struct LoadForBroadcastingRegisterBlock { + using Shape = + LoadForBroadcastingShape; + using ScalarType = typename RegisterBlockType::ScalarType; + using Type = RegisterBlock; +}; + +template +struct LoadForBroadcastingImpl { + static_assert(std::is_same::value, + "This generic impl should never be hit"); +}; + +template +struct LoadForBroadcastingImpl, + VectorMap> { + using RegisterBlockType = RegisterBlock; + using SrcObjectType = VectorMap; + using ResultBlockType = + typename LoadForBroadcastingRegisterBlock::Type; + static_assert(ResultBlockType::kRegisterLanes == 1, + "This path is only for scalar values"); + static ResultBlockType Run(const SrcObjectType& src, int pos) { + ResultBlockType result; + for (int c = 0; c < ResultBlockType::kCols; c++) { + for (int r = 0; r < ResultBlockType::kRows; r++) { + const int i = Shape == VectorShape::Col ? r : c; + result.buf.reg[r + c * ResultBlockType::kRows] = src(pos + i); + } + } + return result; + } +}; + +template +struct LoadForBroadcastingImpl, + VectorDup> { + using RegisterBlockType = RegisterBlock; + using SrcObjectType = VectorDup; + using ResultBlockType = + typename LoadForBroadcastingRegisterBlock::Type; + static_assert(ResultBlockType::kRegisterLanes == 1, + "This path is only for scalar values"); + static ResultBlockType Run(const SrcObjectType& src, int) { + ResultBlockType result; + for (int c = 0; c < ResultBlockType::kCols; c++) { + for (int r = 0; r < ResultBlockType::kRows; r++) { + result.buf.reg[r + c * ResultBlockType::kRows] = src(0); + } + } + return result; + } +}; + +template +typename LoadForBroadcastingRegisterBlock::Type +LoadForBroadcasting(const SrcObjectType& src, int row, int col) { + return LoadForBroadcastingImpl::Run( + src, row, col); +} + +template +typename LoadForBroadcastingRegisterBlock::Type +LoadForBroadcasting(const SrcObjectType& src, int pos) { + return LoadForBroadcastingImpl::Run(src, + pos); +} + +template +struct AddConstantImpl { + static void Run(RegisterBlockType* block) { + using RegisterType = typename RegisterBlockType::RegisterType; + const RegisterType dup = Dup(ConstantValue); + for (int i = 0; i < RegisterBlockType::kRegisterCount; i++) { + block->buf.reg[i] = Add(block->buf.reg[i], dup); + } + } +}; + +template +struct AddConstantImpl<0, RegisterBlockType> { + static void Run(RegisterBlockType*) { + // This is a no-op. + } +}; + +template +void AddConstant(RegisterBlockType* block) { + AddConstantImpl::Run(block); +} + +template +using RegBufferInt32 = RegisterBuffer; +template +using RegBufferInt16 = RegisterBuffer; +template +using RegBufferUint8 = RegisterBuffer; +template +using RegBufferInt8 = RegisterBuffer; +template +using RegBlockInt32 = RegisterBlock; +template +using RegBlockInt16 = RegisterBlock; +template +using RegBlockUint8 = RegisterBlock; +template +using RegBlockInt8 = RegisterBlock; + +} // end namespace gemmlowp + +#if defined GEMMLOWP_NEON +#include "simd_wrappers_neon.h" +#elif defined GEMMLOWP_SSE4 +#include "simd_wrappers_sse.h" +#elif defined GEMMLOWP_MSA +#include "simd_wrappers_msa.h" +#endif + +#endif // GEMMLOWP_INTERNAL_SIMD_WRAPPERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_common_neon_sse.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_common_neon_sse.h new file mode 100644 index 0000000000000000000000000000000000000000..694bf998fdac957753cd3ce0a4e404ba26a679c8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_common_neon_sse.h @@ -0,0 +1,850 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// simd_wrappers_common_neon_sse.h: common SIMD (NEON and SSE) wrapper code + +#ifndef GEMMLOWP_INTERNAL_SIMD_WRAPPERS_COMMON_NEON_SSE_H_ +#define GEMMLOWP_INTERNAL_SIMD_WRAPPERS_COMMON_NEON_SSE_H_ + +#include "simd_wrappers.h" + +namespace gemmlowp { + +template +struct LoadImpl, + MatrixMap> { + static RegBlockInt32<4, N> Run( + const MatrixMap& src, int row, + int col) { + RegBlockInt32<4, N> result; + for (int i = 0; i < N; i++) { + result.buf.reg[i] = LoadInt32x4(src.data(row, col + i)); + } + return result; + } +}; + +template +struct LoadImpl, + MatrixMap> { + static RegBlockInt32<8, N> Run( + const MatrixMap& src, int row, + int col) { + RegBlockInt32<8, N> result; + for (int i = 0; i < N; i++) { + result.buf.reg[2 * i + 0] = LoadInt32x4(src.data(row + 0, col + i)); + result.buf.reg[2 * i + 1] = LoadInt32x4(src.data(row + 4, col + i)); + } + return result; + } +}; + +template +struct LoadImpl, + MatrixMap> { + static RegBlockInt32<1, 4> Run( + const MatrixMap& src, int row, + int col) { + RegBlockInt32<1, 4> result; + std::int32_t buf[4]; + for (int i = 0; i < 4; i++) { + buf[i] = src(row, col + i); + } + result.buf.reg[0] = LoadInt32x4(buf); + return result; + } +}; + +template +struct LoadImpl, + MatrixMap> { + static RegBlockInt32<1, 8> Run( + const MatrixMap& src, int row, + int col) { + RegBlockInt32<1, 8> result; + std::int32_t buf[8]; + for (int i = 0; i < 8; i++) { + buf[i] = src(row, col + i); + } + result.buf.reg[0] = LoadInt32x4(buf); + result.buf.reg[1] = LoadInt32x4(buf + 4); + return result; + } +}; + +template +struct LoadImpl, + VectorMap> { + static RegBlockInt32<4, 1> Run( + const VectorMap& src, int pos) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = LoadInt32x4(src.data(pos)); + return result; + } +}; + +template +struct LoadImpl, + VectorDup> { + static RegBlockInt32<4, 1> Run( + const VectorDup& src, int) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = LoadInt32x4(src(0)); + return result; + } +}; + +template +struct LoadForBroadcastingImpl, + VectorMap> { + using SrcObjectType = VectorMap; + using RegisterBlockType = RegBlockInt32<4, N>; + using ResultBlockType = + typename LoadForBroadcastingRegisterBlock::Type; + + static ResultBlockType Run(const SrcObjectType& src, int pos) { + ResultBlockType result; + static_assert(ResultBlockType::kRegisterCount == 1, ""); + result.buf.reg[0] = LoadInt32x4(src.data(pos)); + return result; + } +}; + +template +struct LoadForBroadcastingImpl, + VectorMap> { + using SrcObjectType = VectorMap; + using RegisterBlockType = RegBlockInt32<8, N>; + using ResultBlockType = + typename LoadForBroadcastingRegisterBlock::Type; + + static ResultBlockType Run(const SrcObjectType& src, int pos) { + ResultBlockType result; + static_assert(ResultBlockType::kRegisterCount == 2, ""); + result.buf.reg[0] = LoadInt32x4(src.data(pos)); + result.buf.reg[1] = LoadInt32x4(src.data(pos + 4)); + return result; + } +}; + +template +struct LoadForBroadcastingImpl, + VectorMap> { + using SrcObjectType = VectorMap; + using RegisterBlockType = RegBlockInt32<4, 1>; + using ResultBlockType = + typename LoadForBroadcastingRegisterBlock::Type; + + static ResultBlockType Run(const SrcObjectType& src, int pos) { + ResultBlockType result; + result.buf.reg[0] = src(pos); + return result; + } +}; + +template +struct LoadForBroadcastingImpl, + VectorMap> { + using SrcObjectType = VectorMap; + using RegisterBlockType = RegBlockInt32; + using ResultBlockType = + typename LoadForBroadcastingRegisterBlock::Type; + + static ResultBlockType Run(const SrcObjectType& src, int pos) { + ResultBlockType result; + static_assert(ResultBlockType::kRegisterCount == 1, ""); + result.buf.reg[0] = LoadInt32x4(src.data(pos)); + return result; + } +}; + +template +struct LoadForBroadcastingImpl, + VectorMap> { + using SrcObjectType = VectorMap; + using RegisterBlockType = RegBlockInt32; + using ResultBlockType = + typename LoadForBroadcastingRegisterBlock::Type; + + static ResultBlockType Run(const SrcObjectType& src, int pos) { + ResultBlockType result; + static_assert(ResultBlockType::kRegisterCount == 2, ""); + result.buf.reg[0] = LoadInt32x4(src.data(pos)); + result.buf.reg[1] = LoadInt32x4(src.data(pos + 4)); + return result; + } +}; + +// 4x1 := 4x1 + 1x1 +template <> +struct BroadcastAddImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 1x4 := 1x4 + 1x1 +template <> +struct BroadcastAddImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 4x1 := 4x1 + 4x1 +template <> +struct BroadcastAddImpl, RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 1x4 := 1x4 + 1x4 +template <> +struct BroadcastAddImpl, RegBlockInt32<1, 4>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 4x4 := 4x4 + 1x4 +template <> +struct BroadcastAddImpl, RegBlockInt32<1, 4>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<4, 4> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[1] = Add(lhs.buf.reg[1], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[2] = Add(lhs.buf.reg[2], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[3] = Add(lhs.buf.reg[3], DupLane<3>(rhs.buf.reg[0])); + return result; + } +}; + +// 4x4 := 4x4 + 4x1 +template <> +struct BroadcastAddImpl, RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 4> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = Add(lhs.buf.reg[1], rhs.buf.reg[0]); + result.buf.reg[2] = Add(lhs.buf.reg[2], rhs.buf.reg[0]); + result.buf.reg[3] = Add(lhs.buf.reg[3], rhs.buf.reg[0]); + return result; + } +}; + +// 8x1 := 8x1 + 1x1 +template <> +struct BroadcastAddImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<8, 1> result; + const Int32x4 p = Dup(rhs.buf.reg[0]); + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = Add(lhs.buf.reg[i], p); + } + return result; + } +}; + +// 8x1 := 8x1 + 8x1 +template <> +struct BroadcastAddImpl, RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 1> result; + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = Add(lhs.buf.reg[i], rhs.buf.reg[i]); + } + return result; + } +}; + +// 8x4 := 8x4 + 1x4 +template <> +struct BroadcastAddImpl, RegBlockInt32<1, 4>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<8, 4> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[1] = Add(lhs.buf.reg[1], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[2] = Add(lhs.buf.reg[2], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[3] = Add(lhs.buf.reg[3], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[4] = Add(lhs.buf.reg[4], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[5] = Add(lhs.buf.reg[5], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[6] = Add(lhs.buf.reg[6], DupLane<3>(rhs.buf.reg[0])); + result.buf.reg[7] = Add(lhs.buf.reg[7], DupLane<3>(rhs.buf.reg[0])); + return result; + } +}; + +// 8x4 := 8x4 + 8x1 +template <> +struct BroadcastAddImpl, RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 4> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = Add(lhs.buf.reg[1], rhs.buf.reg[1]); + result.buf.reg[2] = Add(lhs.buf.reg[2], rhs.buf.reg[0]); + result.buf.reg[3] = Add(lhs.buf.reg[3], rhs.buf.reg[1]); + result.buf.reg[4] = Add(lhs.buf.reg[4], rhs.buf.reg[0]); + result.buf.reg[5] = Add(lhs.buf.reg[5], rhs.buf.reg[1]); + result.buf.reg[6] = Add(lhs.buf.reg[6], rhs.buf.reg[0]); + result.buf.reg[7] = Add(lhs.buf.reg[7], rhs.buf.reg[1]); + return result; + } +}; + +// 1x8 := 1x8 + 1x8 +template <> +struct BroadcastAddImpl, RegBlockInt32<1, 8>> { + static RegBlockInt32<1, 8> Run(const RegBlockInt32<1, 8>& lhs, + const RegBlockInt32<1, 8>& rhs) { + RegBlockInt32<1, 8> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = Add(lhs.buf.reg[1], rhs.buf.reg[1]); + return result; + } +}; + +// 1x8 := 1x8 + 1x1 +template <> +struct BroadcastAddImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<1, 8> Run(const RegBlockInt32<1, 8>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<1, 8> result; + result.buf.reg[0] = Add(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + result.buf.reg[1] = Add(lhs.buf.reg[1], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 4x1 := 4x1 + 1x1 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<1, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 1x4 := 1x4 + 1x1 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<1, 1>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 4x1 := 4x1 + 4x1 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 1x4 := 1x4 + 1x4 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<1, 4>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 4x4 := 4x4 + 1x4 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<1, 4>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<4, 4> result; + result.buf.reg[0] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[0], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[1] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[1], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[2] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[2], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[3] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[3], DupLane<3>(rhs.buf.reg[0])); + return result; + } +}; + +// 4x4 := 4x4 + 4x1 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 4> result; + result.buf.reg[0] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[1], rhs.buf.reg[0]); + result.buf.reg[2] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[2], rhs.buf.reg[0]); + result.buf.reg[3] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[3], rhs.buf.reg[0]); + return result; + } +}; + +// 8x1 := 8x1 + 1x1 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<1, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<8, 1> result; + const Int32x4 p = Dup(rhs.buf.reg[0]); + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = SaturatingRoundingDoublingHighMul(lhs.buf.reg[i], p); + } + return result; + } +}; + +// 8x1 := 8x1 + 8x1 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 1> result; + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[i], rhs.buf.reg[i]); + } + return result; + } +}; + +// 8x4 := 8x4 + 1x4 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<1, 4>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<8, 4> result; + result.buf.reg[0] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[0], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[1] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[1], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[2] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[2], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[3] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[3], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[4] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[4], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[5] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[5], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[6] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[6], DupLane<3>(rhs.buf.reg[0])); + result.buf.reg[7] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[7], DupLane<3>(rhs.buf.reg[0])); + return result; + } +}; + +// 8x4 := 8x4 + 8x1 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 4> result; + result.buf.reg[0] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[1], rhs.buf.reg[1]); + result.buf.reg[2] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[2], rhs.buf.reg[0]); + result.buf.reg[3] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[3], rhs.buf.reg[1]); + result.buf.reg[4] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[4], rhs.buf.reg[0]); + result.buf.reg[5] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[5], rhs.buf.reg[1]); + result.buf.reg[6] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[6], rhs.buf.reg[0]); + result.buf.reg[7] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[7], rhs.buf.reg[1]); + return result; + } +}; + +// 1x8 := 1x8 + 1x8 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<1, 8>> { + static RegBlockInt32<1, 8> Run(const RegBlockInt32<1, 8>& lhs, + const RegBlockInt32<1, 8>& rhs) { + RegBlockInt32<1, 8> result; + result.buf.reg[0] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = + SaturatingRoundingDoublingHighMul(lhs.buf.reg[1], rhs.buf.reg[1]); + return result; + } +}; + +// 1x8 := 1x8 + 1x1 +template <> +struct BroadcastSaturatingRoundingDoublingHighMulImpl, + RegBlockInt32<1, 1>> { + static RegBlockInt32<1, 8> Run(const RegBlockInt32<1, 8>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<1, 8> result; + result.buf.reg[0] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + result.buf.reg[1] = SaturatingRoundingDoublingHighMul( + lhs.buf.reg[1], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 4x1 := 4x1 * 1x1 +template <> +struct BroadcastMulImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = Mul(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 4x1 := 4x1 * 4x1 +template <> +struct BroadcastMulImpl, RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = Mul(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 1x4 := 1x4 * 1x4 +template <> +struct BroadcastMulImpl, RegBlockInt32<1, 4>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = Mul(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 1x4 := 1x4 * 1x1 +template <> +struct BroadcastMulImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = Mul(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 4x4 := 4x4 * 1x4 +template <> +struct BroadcastMulImpl, RegBlockInt32<1, 4>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<4, 4> result; + const Int32x4 p = rhs.buf.reg[0]; + result.buf.reg[0] = MulByRhsLane<0>(lhs.buf.reg[0], p); + result.buf.reg[1] = MulByRhsLane<1>(lhs.buf.reg[1], p); + result.buf.reg[2] = MulByRhsLane<2>(lhs.buf.reg[2], p); + result.buf.reg[3] = MulByRhsLane<3>(lhs.buf.reg[3], p); + return result; + } +}; + +// 4x4 := 4x4 * 4x1 +template <> +struct BroadcastMulImpl, RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 4> result; + const Int32x4 p = rhs.buf.reg[0]; + result.buf.reg[0] = Mul(lhs.buf.reg[0], p); + result.buf.reg[1] = Mul(lhs.buf.reg[1], p); + result.buf.reg[2] = Mul(lhs.buf.reg[2], p); + result.buf.reg[3] = Mul(lhs.buf.reg[3], p); + return result; + } +}; + +// 8x1 := 8x1 * 1x1 +template <> +struct BroadcastMulImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<8, 1> result; + const std::int32_t p = rhs.buf.reg[0]; + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = Mul(lhs.buf.reg[i], p); + } + return result; + } +}; + +// 8x1 := 8x1 * 8x1 +template <> +struct BroadcastMulImpl, RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 1> result; + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = Mul(lhs.buf.reg[i], rhs.buf.reg[i]); + } + return result; + } +}; + +// 8x4 := 8x4 * 1x4 +template <> +struct BroadcastMulImpl, RegBlockInt32<1, 4>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<8, 4> result; + const Int32x4 p = rhs.buf.reg[0]; + for (int i = 0; i < 2; i++) { + result.buf.reg[i + 0] = MulByRhsLane<0>(lhs.buf.reg[i + 0], p); + result.buf.reg[i + 2] = MulByRhsLane<1>(lhs.buf.reg[i + 2], p); + result.buf.reg[i + 4] = MulByRhsLane<2>(lhs.buf.reg[i + 4], p); + result.buf.reg[i + 6] = MulByRhsLane<3>(lhs.buf.reg[i + 6], p); + } + return result; + } +}; + +// 8x4 := 8x4 * 8x1 +template <> +struct BroadcastMulImpl, RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 4> result; + const Int32x4 p[2]{rhs.buf.reg[0], rhs.buf.reg[1]}; + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 2; j++) { + const int k = j + 2 * i; + result.buf.reg[k] = Mul(lhs.buf.reg[k], p[j]); + } + } + return result; + } +}; + +// Rx1 += Rx1 * 1x1 +template +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32> { + static void Run(const RegBlockInt32& lhs, + const RegBlockInt32<1, 1>& rhs, RegBlockInt32* acc) { + const std::int32_t p = rhs.buf.reg[0]; + for (int i = 0; i < RegBlockInt32::kRegisterCount; i++) { + MulAdd(lhs.buf.reg[i], p, &acc->buf.reg[i]); + } + } +}; + +// RxC += Rx1 * 1x1 +template +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32> { + static void Run(const RegBlockInt32& lhs, + const RegBlockInt32<1, 1>& rhs, + RegBlockInt32* acc) { + const std::int32_t p = rhs.buf.reg[0]; + static constexpr int kRegsPerCol = RegBlockInt32::kRegisterCount; + for (int i = 0; i < kRegsPerCol; i++) { + const Int32x4 q = Mul(lhs.buf.reg[i], p); + for (int j = 0; j < Cols; j++) { + acc->buf.reg[i + j * kRegsPerCol] = + Add(acc->buf.reg[i + j * kRegsPerCol], q); + } + } + } +}; + +// 1xC += 1xC * 1x1 +template +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32<1, Cols>> { + static void Run(const RegBlockInt32<1, Cols>& lhs, + const RegBlockInt32<1, 1>& rhs, RegBlockInt32<1, Cols>* acc) { + const std::int32_t p = rhs.buf.reg[0]; + for (int i = 0; i < RegBlockInt32<1, Cols>::kRegisterCount; i++) { + MulAdd(lhs.buf.reg[i], p, &acc->buf.reg[i]); + } + } +}; + +// RxC += 1x1 * 1x1 +template +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32> { + static void Run(const RegBlockInt32<1, 1>& lhs, + const RegBlockInt32<1, 1>& rhs, + RegBlockInt32* acc) { + const Int32x4 p = Dup(Mul(lhs.buf.reg[0], rhs.buf.reg[0])); + for (int i = 0; i < RegBlockInt32::kRegisterCount; i++) { + acc->buf.reg[i] = Add(acc->buf.reg[i], p); + } + } +}; + +// 1x1 += 1x1 * 1x1 +template <> +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32<1, 1>> { + static void Run(const RegBlockInt32<1, 1>& lhs, + const RegBlockInt32<1, 1>& rhs, RegBlockInt32<1, 1>* acc) { + MulAdd(lhs.buf.reg[0], rhs.buf.reg[0], &acc->buf.reg[0]); + } +}; + +// Rx4 += Rx1 * 1x4 +template +struct BroadcastMulAddImpl, RegBlockInt32<1, 4>, + RegBlockInt32> { + static void Run(const RegBlockInt32& lhs, + const RegBlockInt32<1, 4>& rhs, RegBlockInt32* acc) { + const Int32x4 p = rhs.buf.reg[0]; + static constexpr int kRegsPerCol = RegBlockInt32::kRegisterCount; + for (int i = 0; i < kRegsPerCol; i++) { + MulAddByRhsLane<0>(lhs.buf.reg[i], p, &acc->buf.reg[i + 0 * kRegsPerCol]); + MulAddByRhsLane<1>(lhs.buf.reg[i], p, &acc->buf.reg[i + 1 * kRegsPerCol]); + MulAddByRhsLane<2>(lhs.buf.reg[i], p, &acc->buf.reg[i + 2 * kRegsPerCol]); + MulAddByRhsLane<3>(lhs.buf.reg[i], p, &acc->buf.reg[i + 3 * kRegsPerCol]); + } + } +}; + +// Rx4 += 1x4 * 1x1 +template +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32> { + static void Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 1>& rhs, RegBlockInt32* acc) { + const Int32x4 p = Mul(lhs.buf.reg[0], rhs.buf.reg[0]); + Int32x4 q[4]; + q[0] = DupLane<0>(p); + q[1] = DupLane<1>(p); + q[2] = DupLane<2>(p); + q[3] = DupLane<3>(p); + static constexpr int kRegsPerCol = RegBlockInt32::kRegisterCount; + for (int i = 0; i < kRegsPerCol; i++) { + for (int j = 0; j < 4; j++) { + acc->buf.reg[i + j * kRegsPerCol] = + Add(q[j], acc->buf.reg[i + j * kRegsPerCol]); + } + } + } +}; + +// 1xC += 1x1 * 1x1 +template +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32<1, Cols>> { + static void Run(const RegBlockInt32<1, 1>& lhs, + const RegBlockInt32<1, 1>& rhs, RegBlockInt32<1, Cols>* acc) { + const Int32x4 p = Dup(Mul(lhs.buf.reg[0], rhs.buf.reg[0])); + for (int i = 0; i < RegBlockInt32<1, Cols>::kRegisterCount; i++) { + acc->buf.reg[i] = Add(acc->buf.reg[i], p); + } + } +}; + +// 1x4 += 1x4 * 1x1 +template <> +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32<1, 4>> { + static void Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 1>& rhs, RegBlockInt32<1, 4>* acc) { + const std::int32_t p = rhs.buf.reg[0]; + MulAdd(lhs.buf.reg[0], p, &acc->buf.reg[0]); + } +}; + +// 4xC += 4x1 * 1x1 +template +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32<4, Cols>> { + static void Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<1, 1>& rhs, RegBlockInt32<4, Cols>* acc) { + const Int32x4 p = Mul(lhs.buf.reg[0], rhs.buf.reg[0]); + for (int i = 0; i < Cols; i++) { + acc->buf.reg[i] = Add(p, acc->buf.reg[i]); + } + } +}; + +// 4x1 += 4x1 * 1x1 +template <> +struct BroadcastMulAddImpl, RegBlockInt32<1, 1>, + RegBlockInt32<4, 1>> { + static void Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<1, 1>& rhs, RegBlockInt32<4, 1>* acc) { + const std::int32_t p = rhs.buf.reg[0]; + MulAdd(lhs.buf.reg[0], p, &acc->buf.reg[0]); + } +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_SIMD_WRAPPERS_COMMON_NEON_SSE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_msa.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_msa.h new file mode 100644 index 0000000000000000000000000000000000000000..7de01ff55aefeffabe44099c008cdf5b1c3ff204 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_msa.h @@ -0,0 +1,191 @@ +// Copyright 2018 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// simd_wrappers_msa.h: MSA specialization of simd_wrappers.h + +#ifndef GEMMLOWP_INTERNAL_SIMD_WRAPPERS_MSA_H_ +#define GEMMLOWP_INTERNAL_SIMD_WRAPPERS_MSA_H_ + +#include + +namespace gemmlowp { + +using Int32x4 = v4i32; +using Int16x8 = v8i16; +using Uint8x16 = v16i8; + +template +struct RegisterType { + using Type = + typename std::conditional= 4, Int32x4, std::int32_t>::type; +}; + +template +struct RegisterType { + using Type = typename std::conditional= 8, Int16x8, std::int16_t>::type; +}; + +template +struct RegisterType { + using Type = typename std::conditional< + ScalarCount >= 16, Uint8x16, + typename std::conditional= 4, std::uint32_t, + std::uint8_t>::type>::type; +}; + +inline Int32x4 LoadInt32x4(const std::int32_t* src) { + return __builtin_msa_ld_w(const_cast(src), 0); +} + +inline Int32x4 LoadInt32x4(const Int32x4* src) { + return __builtin_msa_ld_w(const_cast(src), 0); +} + +inline void StoreInt32x4(std::int32_t* dst, Int32x4 value) { + __builtin_msa_st_w(value, dst, 0); +} + +inline void StoreInt32x4(Int32x4* dst, Int32x4 value) { + __builtin_msa_st_w(value, dst, 0); +} + +inline Int16x8 LoadInt16x8(const std::int16_t* src) { + return __builtin_msa_ld_h(const_cast(src), 0); +} + +inline Int16x8 LoadInt16x8(const Int16x8* src) { + return __builtin_msa_ld_h(const_cast(src), 0); +} + +inline void StoreInt16x8(std::int16_t* dst, Int16x8 value) { __builtin_msa_st_h(value, dst, 0); } + +inline void StoreInt16x8(Int16x8* dst, Int16x8 value) { __builtin_msa_st_h(value, dst, 0); } + +inline Uint8x16 LoadUint8x16(const std::uint8_t* src) { + return __builtin_msa_ld_b(const_cast(src), 0); +} + +inline Uint8x16 LoadUint8x16(const Uint8x16* src) { + return __builtin_msa_ld_b(const_cast(src), 0); +} + +inline void StoreUint8x16(std::uint8_t* dst, Uint8x16 value) { + __builtin_msa_st_b(value, dst, 0); +} + +inline void StoreUint8x16(Uint8x16* dst, Uint8x16 value) { + __builtin_msa_st_b(value, dst, 0); +} + +template +std::int32_t GetLane(Int32x4 value) { + return __builtin_msa_copy_s_w(value, Lane); +} + +template +Int32x4 DupLane(Int32x4 value) { + static_assert(Lane >= 0 && Lane <= 3, ""); + return __builtin_msa_splati_w(value, Lane); +} + +inline Int32x4 Mul(Int32x4 a, std::int32_t b) { + return __builtin_msa_mulv_w(a, __builtin_msa_fill_w(b)); +} + +inline Int32x4 Min(Int32x4 a, Int32x4 b) { return __builtin_msa_min_s_w(a, b); } + +inline Int32x4 Max(Int32x4 a, Int32x4 b) { return __builtin_msa_max_s_w(a, b); } + +inline Int32x4 SaturatingRoundingDoublingHighMul(Int32x4 a, std::int32_t b) { + return __builtin_msa_mulr_q_w(a, __builtin_msa_fill_w(b)); +} + +template +Int32x4 MulByRhsLane(Int32x4 a, Int32x4 b) { + static_assert(Lane >= 0 && Lane <= 3, ""); + return __builtin_msa_mulv_w(a, __builtin_msa_splati_w(b, Lane)); +} + +static inline v4i32 workaround_msa_maddv_w(v4i32 a, v4i32 b, v4i32 c) { + // Workaround for incorrect encoding of maddv.df in gcc (a exchanged with c). +#if 0 + return __builtin_msa_maddv_w(a, b, c); +#else + asm volatile("maddv.w %w[a], %w[b], %w[c]\n" + // Outputs + : [a] "+f"(a) + // Inputs + : [b] "f"(b), [c] "f"(c)); + return a; +#endif +} + +inline void MulAdd(Int32x4 lhs, Int32x4 rhs, Int32x4* acc) { + Int32x4 tmp = LoadInt32x4(acc); + tmp = workaround_msa_maddv_w(tmp, lhs, rhs); + StoreInt32x4(acc, tmp); +} + +inline void MulAdd(Int32x4 lhs, std::int32_t rhs, Int32x4* acc) { + Int32x4 tmp = LoadInt32x4(acc); + tmp = workaround_msa_maddv_w(tmp, lhs, __builtin_msa_fill_w(rhs)); + StoreInt32x4(acc, tmp); +} + +template +inline void MulAddByRhsLane(Int32x4 lhs, Int32x4 rhs, Int32x4* acc) { + static_assert(Lane >= 0 && Lane <= 3, ""); + Int32x4 tmp = LoadInt32x4(acc); + tmp = workaround_msa_maddv_w(tmp, lhs, __builtin_msa_splati_w(rhs, Lane)); + StoreInt32x4(acc, tmp); +} + +template <> +struct LoadContiguousImpl> { + static RegBlockUint8<8, 8> Run(const std::uint8_t* src) { + RegBlockUint8<8, 8> result; + for (int i = 0; i < 4; i++) { + result.buf.reg[i] = LoadUint8x16(src + 16 * i); + } + return result; + } +}; + +template <> +struct LoadContiguousImpl> { + static RegBlockInt32<8, 8> Run(const std::int32_t* src) { + RegBlockInt32<8, 8> result; + for (int i = 0; i < 16; i++) { + result.buf.reg[i] = LoadInt32x4(src + 4 * i); + } + return result; + } +}; + +template <> +struct LoadContiguousImpl> { + static RegBlockInt16<8, 8> Run(const std::int16_t* src) { + RegBlockInt16<8, 8> result; + for (int i = 0; i < 8; i++) { + result.buf.reg[i] = LoadInt16x8(src + 8 * i); + } + return result; + } +}; + +} // end namespace gemmlowp + +#include "simd_wrappers_common_neon_sse.h" + +#endif // GEMMLOWP_INTERNAL_SIMD_WRAPPERS_MSA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_neon.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_neon.h new file mode 100644 index 0000000000000000000000000000000000000000..6871055ab4a5b64aa1c231f1c43d2061123f765c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_neon.h @@ -0,0 +1,551 @@ +// Copyright 2017 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// simd_wrappers_neon.h: NEON specialization of simd_wrappers.h + +#ifndef GEMMLOWP_INTERNAL_SIMD_WRAPPERS_NEON_H_ +#define GEMMLOWP_INTERNAL_SIMD_WRAPPERS_NEON_H_ + +#include + +namespace gemmlowp { + +using Int32x4 = int32x4_t; +using Int16x4 = int16x4_t; +using Int16x8 = int16x8_t; +using Uint8x8 = uint8x8_t; +using Int8x8 = int8x8_t; + +template +struct RegisterType { + using Type = + typename std::conditional= 4, Int32x4, std::int32_t>::type; +}; + +template +struct RegisterType { + using Type = typename std::conditional< + ScalarCount >= 8, Int16x8, + typename std::conditional= 4, Int16x4, + std::int16_t>::type>::type; +}; + +template +struct RegisterType { + using Type = typename std::conditional< + ScalarCount >= 8, Uint8x8, + typename std::conditional= 4, std::uint32_t, + std::uint8_t>::type>::type; +}; + +template +struct RegisterType { + using Type = typename std::conditional< + ScalarCount >= 8, Int8x8, + typename std::conditional= 4, std::int32_t, + std::int8_t>::type>::type; +}; + +inline Int32x4 LoadInt32x4(const std::int32_t* src) { return vld1q_s32(src); } +inline Int16x4 LoadInt16x4(const std::int16_t* src) { return vld1_s16(src); } +inline Int16x8 LoadInt16x8(const std::int16_t* src) { return vld1q_s16(src); } + +inline void StoreInt32x4(std::int32_t* dst, Int32x4 value) { + vst1q_s32(dst, value); +} + +inline void StoreInt16x4(std::int16_t* dst, Int16x4 value) { + vst1_s16(dst, value); +} + +inline void StoreInt16x8(std::int16_t* dst, Int16x8 value) { + vst1q_s16(dst, value); +} + +template +std::int32_t GetLane(Int32x4 value) { + return vgetq_lane_s32(value, Lane); +} + +template +Int32x4 DupLane(Int32x4 value) { + switch (Lane) { + case 0: + return vdupq_lane_s32(vget_low_s32(value), 0); + case 1: + return vdupq_lane_s32(vget_low_s32(value), 1); + case 2: + return vdupq_lane_s32(vget_high_s32(value), 0); + case 3: + return vdupq_lane_s32(vget_high_s32(value), 1); + default: + static_assert(Lane >= 0 && Lane <= 3, ""); + return vdupq_n_s32(0); + } +} + +inline Int32x4 Mul(Int32x4 a, std::int32_t b) { return vmulq_n_s32(a, b); } + +inline Int32x4 Min(Int32x4 a, Int32x4 b) { return vminq_s32(a, b); } + +inline Int32x4 Max(Int32x4 a, Int32x4 b) { return vmaxq_s32(a, b); } + +inline Int32x4 Max(Int32x4 a, std::int32_t b) { + return vmaxq_s32(a, vdupq_n_s32(b)); +} + +inline Int32x4 SaturatingRoundingDoublingHighMul(Int32x4 a, std::int32_t b) { + return vqrdmulhq_n_s32(a, b); +} + +template +Int32x4 MulByRhsLane(Int32x4 a, Int32x4 b) { + switch (Lane) { + case 0: + return vmulq_lane_s32(a, vget_low_s32(b), 0); + case 1: + return vmulq_lane_s32(a, vget_low_s32(b), 1); + case 2: + return vmulq_lane_s32(a, vget_high_s32(b), 0); + case 3: + return vmulq_lane_s32(a, vget_high_s32(b), 1); + default: + static_assert(Lane >= 0 && Lane <= 3, ""); + return vdupq_n_s32(0); + } +} + +inline void MulAdd(Int32x4 lhs, Int32x4 rhs, Int32x4* acc) { + *acc = vmlaq_s32(*acc, lhs, rhs); +} + +inline void MulAdd(Int32x4 lhs, std::int32_t rhs, Int32x4* acc) { + *acc = vmlaq_n_s32(*acc, lhs, rhs); +} + +template +inline void MulAddByRhsLane(Int32x4 lhs, Int32x4 rhs, Int32x4* acc) { + switch (Lane) { + case 0: + *acc = vmlaq_lane_s32(*acc, lhs, vget_low_s32(rhs), 0); + break; + case 1: + *acc = vmlaq_lane_s32(*acc, lhs, vget_low_s32(rhs), 1); + break; + case 2: + *acc = vmlaq_lane_s32(*acc, lhs, vget_high_s32(rhs), 0); + break; + case 3: + *acc = vmlaq_lane_s32(*acc, lhs, vget_high_s32(rhs), 1); + break; + default: + static_assert(Lane >= 0 && Lane <= 3, ""); + } +} + +template <> +struct LoadContiguousImpl> { + static RegBlockInt16<8, 8> Run(const std::int16_t* src) { + RegBlockInt16<8, 8> result; + for (int i = 0; i < 8; i++) { + result.buf.reg[i] = vld1q_s16(src + 8 * i); + } + return result; + } +}; + +template <> +struct LoadContiguousImpl> { + static RegBlockUint8<8, 8> Run(const std::uint8_t* src) { + RegBlockUint8<8, 8> result; + for (int i = 0; i < 8; i++) { + result.buf.reg[i] = vld1_u8(src + 8 * i); + } + return result; + } +}; + +template <> +struct LoadContiguousImpl> { + static RegBlockInt8<8, 8> Run(const std::int8_t* src) { + RegBlockInt8<8, 8> result; + for (int i = 0; i < 8; i++) { + result.buf.reg[i] = vld1_s8(src + 8 * i); + } + return result; + } +}; + +template <> +struct LoadContiguousImpl> { + static RegBlockInt32<8, 8> Run(const std::int32_t* src) { + RegBlockInt32<8, 8> result; + for (int i = 0; i < 16; i++) { + result.buf.reg[i] = vld1q_s32(src + 4 * i); + } + return result; + } +}; + +// 4x1 := 4x1 + 1x1 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 1x4 := 1x4 + 1x1 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 4x1 := 4x1 + 4x1 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 1x4 := 1x4 + 1x4 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<1, 4>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 4x4 := 4x4 + 1x4 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<1, 4>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<4, 4> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[1] = ShiftLeft(lhs.buf.reg[1], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[2] = ShiftLeft(lhs.buf.reg[2], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[3] = ShiftLeft(lhs.buf.reg[3], DupLane<3>(rhs.buf.reg[0])); + return result; + } +}; + +// 4x4 := 4x4 + 4x1 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 4> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = ShiftLeft(lhs.buf.reg[1], rhs.buf.reg[0]); + result.buf.reg[2] = ShiftLeft(lhs.buf.reg[2], rhs.buf.reg[0]); + result.buf.reg[3] = ShiftLeft(lhs.buf.reg[3], rhs.buf.reg[0]); + return result; + } +}; + +// 8x1 := 8x1 + 1x1 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<8, 1> result; + const Int32x4 p = Dup(rhs.buf.reg[0]); + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = ShiftLeft(lhs.buf.reg[i], p); + } + return result; + } +}; + +// 8x1 := 8x1 + 8x1 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 1> result; + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = ShiftLeft(lhs.buf.reg[i], rhs.buf.reg[i]); + } + return result; + } +}; + +// 8x4 := 8x4 + 1x4 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<1, 4>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<8, 4> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[1] = ShiftLeft(lhs.buf.reg[1], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[2] = ShiftLeft(lhs.buf.reg[2], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[3] = ShiftLeft(lhs.buf.reg[3], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[4] = ShiftLeft(lhs.buf.reg[4], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[5] = ShiftLeft(lhs.buf.reg[5], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[6] = ShiftLeft(lhs.buf.reg[6], DupLane<3>(rhs.buf.reg[0])); + result.buf.reg[7] = ShiftLeft(lhs.buf.reg[7], DupLane<3>(rhs.buf.reg[0])); + return result; + } +}; + +// 8x4 := 8x4 + 8x1 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 4> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = ShiftLeft(lhs.buf.reg[1], rhs.buf.reg[1]); + result.buf.reg[2] = ShiftLeft(lhs.buf.reg[2], rhs.buf.reg[0]); + result.buf.reg[3] = ShiftLeft(lhs.buf.reg[3], rhs.buf.reg[1]); + result.buf.reg[4] = ShiftLeft(lhs.buf.reg[4], rhs.buf.reg[0]); + result.buf.reg[5] = ShiftLeft(lhs.buf.reg[5], rhs.buf.reg[1]); + result.buf.reg[6] = ShiftLeft(lhs.buf.reg[6], rhs.buf.reg[0]); + result.buf.reg[7] = ShiftLeft(lhs.buf.reg[7], rhs.buf.reg[1]); + return result; + } +}; + +// 1x8 := 1x8 + 1x8 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<1, 8>> { + static RegBlockInt32<1, 8> Run(const RegBlockInt32<1, 8>& lhs, + const RegBlockInt32<1, 8>& rhs) { + RegBlockInt32<1, 8> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = ShiftLeft(lhs.buf.reg[1], rhs.buf.reg[1]); + return result; + } +}; + +// 1x8 := 1x8 + 1x1 +template <> +struct BroadcastShiftLeftImpl, RegBlockInt32<1, 1>> { + static RegBlockInt32<1, 8> Run(const RegBlockInt32<1, 8>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<1, 8> result; + result.buf.reg[0] = ShiftLeft(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + result.buf.reg[1] = ShiftLeft(lhs.buf.reg[1], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 4x1 := 4x1 + 1x1 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<1, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = + RoundingDivideByPOT(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 1x4 := 1x4 + 1x1 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<1, 1>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = + RoundingDivideByPOT(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + return result; + } +}; + +// 4x1 := 4x1 + 4x1 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 1> Run(const RegBlockInt32<4, 1>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 1> result; + result.buf.reg[0] = RoundingDivideByPOT(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 1x4 := 1x4 + 1x4 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<1, 4>> { + static RegBlockInt32<1, 4> Run(const RegBlockInt32<1, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<1, 4> result; + result.buf.reg[0] = RoundingDivideByPOT(lhs.buf.reg[0], rhs.buf.reg[0]); + return result; + } +}; + +// 4x4 := 4x4 + 1x4 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<1, 4>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<4, 4> result; + result.buf.reg[0] = + RoundingDivideByPOT(lhs.buf.reg[0], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[1] = + RoundingDivideByPOT(lhs.buf.reg[1], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[2] = + RoundingDivideByPOT(lhs.buf.reg[2], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[3] = + RoundingDivideByPOT(lhs.buf.reg[3], DupLane<3>(rhs.buf.reg[0])); + return result; + } +}; + +// 4x4 := 4x4 + 4x1 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<4, 1>> { + static RegBlockInt32<4, 4> Run(const RegBlockInt32<4, 4>& lhs, + const RegBlockInt32<4, 1>& rhs) { + RegBlockInt32<4, 4> result; + result.buf.reg[0] = RoundingDivideByPOT(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = RoundingDivideByPOT(lhs.buf.reg[1], rhs.buf.reg[0]); + result.buf.reg[2] = RoundingDivideByPOT(lhs.buf.reg[2], rhs.buf.reg[0]); + result.buf.reg[3] = RoundingDivideByPOT(lhs.buf.reg[3], rhs.buf.reg[0]); + return result; + } +}; + +// 8x1 := 8x1 + 1x1 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<1, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<8, 1> result; + const Int32x4 p = Dup(rhs.buf.reg[0]); + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = RoundingDivideByPOT(lhs.buf.reg[i], p); + } + return result; + } +}; + +// 8x1 := 8x1 + 8x1 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 1> Run(const RegBlockInt32<8, 1>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 1> result; + for (int i = 0; i < 2; i++) { + result.buf.reg[i] = RoundingDivideByPOT(lhs.buf.reg[i], rhs.buf.reg[i]); + } + return result; + } +}; + +// 8x4 := 8x4 + 1x4 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<1, 4>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<1, 4>& rhs) { + RegBlockInt32<8, 4> result; + result.buf.reg[0] = + RoundingDivideByPOT(lhs.buf.reg[0], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[1] = + RoundingDivideByPOT(lhs.buf.reg[1], DupLane<0>(rhs.buf.reg[0])); + result.buf.reg[2] = + RoundingDivideByPOT(lhs.buf.reg[2], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[3] = + RoundingDivideByPOT(lhs.buf.reg[3], DupLane<1>(rhs.buf.reg[0])); + result.buf.reg[4] = + RoundingDivideByPOT(lhs.buf.reg[4], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[5] = + RoundingDivideByPOT(lhs.buf.reg[5], DupLane<2>(rhs.buf.reg[0])); + result.buf.reg[6] = + RoundingDivideByPOT(lhs.buf.reg[6], DupLane<3>(rhs.buf.reg[0])); + result.buf.reg[7] = + RoundingDivideByPOT(lhs.buf.reg[7], DupLane<3>(rhs.buf.reg[0])); + return result; + } +}; + +// 8x4 := 8x4 + 8x1 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<8, 1>> { + static RegBlockInt32<8, 4> Run(const RegBlockInt32<8, 4>& lhs, + const RegBlockInt32<8, 1>& rhs) { + RegBlockInt32<8, 4> result; + result.buf.reg[0] = RoundingDivideByPOT(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = RoundingDivideByPOT(lhs.buf.reg[1], rhs.buf.reg[1]); + result.buf.reg[2] = RoundingDivideByPOT(lhs.buf.reg[2], rhs.buf.reg[0]); + result.buf.reg[3] = RoundingDivideByPOT(lhs.buf.reg[3], rhs.buf.reg[1]); + result.buf.reg[4] = RoundingDivideByPOT(lhs.buf.reg[4], rhs.buf.reg[0]); + result.buf.reg[5] = RoundingDivideByPOT(lhs.buf.reg[5], rhs.buf.reg[1]); + result.buf.reg[6] = RoundingDivideByPOT(lhs.buf.reg[6], rhs.buf.reg[0]); + result.buf.reg[7] = RoundingDivideByPOT(lhs.buf.reg[7], rhs.buf.reg[1]); + return result; + } +}; + +// 1x8 := 1x8 + 1x8 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<1, 8>> { + static RegBlockInt32<1, 8> Run(const RegBlockInt32<1, 8>& lhs, + const RegBlockInt32<1, 8>& rhs) { + RegBlockInt32<1, 8> result; + result.buf.reg[0] = RoundingDivideByPOT(lhs.buf.reg[0], rhs.buf.reg[0]); + result.buf.reg[1] = RoundingDivideByPOT(lhs.buf.reg[1], rhs.buf.reg[1]); + return result; + } +}; + +// 1x8 := 1x8 + 1x1 +template <> +struct BroadcastRoundingDivideByPOTImpl, + RegBlockInt32<1, 1>> { + static RegBlockInt32<1, 8> Run(const RegBlockInt32<1, 8>& lhs, + const RegBlockInt32<1, 1>& rhs) { + RegBlockInt32<1, 8> result; + result.buf.reg[0] = + RoundingDivideByPOT(lhs.buf.reg[0], Dup(rhs.buf.reg[0])); + result.buf.reg[1] = + RoundingDivideByPOT(lhs.buf.reg[1], Dup(rhs.buf.reg[0])); + return result; + } +}; + +} // end namespace gemmlowp + +#include "simd_wrappers_common_neon_sse.h" + +#endif // GEMMLOWP_INTERNAL_SIMD_WRAPPERS_NEON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_sse.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_sse.h new file mode 100644 index 0000000000000000000000000000000000000000..3b78cb41b344f110aeeb4e487c39c14d987b66a3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/simd_wrappers_sse.h @@ -0,0 +1,149 @@ +// Copyright 2017 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// simd_wrappers_neon.h: SSE SIMD wrappers + +#ifndef GEMMLOWP_INTERNAL_SIMD_WRAPPERS_SSE_H_ +#define GEMMLOWP_INTERNAL_SIMD_WRAPPERS_SSE_H_ + +#include + +namespace gemmlowp { + +using Int32x4 = __m128i; +using Int16x8 = __m128i; +using Uint8x16 = __m128i; + +template +struct RegisterType { + using Type = + typename std::conditional= 4, Int32x4, std::int32_t>::type; +}; + +template +struct RegisterType { + using Type = + typename std::conditional= 8, Int16x8, std::int16_t>::type; +}; + +template +struct RegisterType { + using Type = typename std::conditional< + ScalarCount >= 16, Uint8x16, + typename std::conditional= 4, std::uint32_t, + std::uint8_t>::type>::type; +}; + +inline Int32x4 LoadInt32x4(const std::int32_t* src) { + return _mm_loadu_si128(reinterpret_cast(src)); +} + +inline Int32x4 LoadInt16x8(const std::int16_t* src) { + return _mm_loadu_si128(reinterpret_cast(src)); +} + +inline void StoreInt32x4(std::int32_t* dst, Int32x4 value) { + _mm_storeu_si128(reinterpret_cast<__m128i*>(dst), value); +} + +inline void StoreInt16x8(std::int16_t* dst, Int16x8 value) { + _mm_storeu_si128(reinterpret_cast<__m128i*>(dst), value); +} + +inline Uint8x16 LoadUint8x16(const std::uint8_t* src) { + return _mm_loadu_si128(reinterpret_cast(src)); +} + +inline void StoreUint8x16(std::uint8_t* dst, Uint8x16 value) { + _mm_storeu_si128(reinterpret_cast<__m128i*>(dst), value); +} + +template +std::int32_t GetLane(Int32x4 value) { + return _mm_extract_epi32(value, Lane); +} + +template +Int32x4 DupLane(Int32x4 value) { + return _mm_shuffle_epi32(value, _MM_SHUFFLE(Lane, Lane, Lane, Lane)); +} + +inline Int32x4 Mul(Int32x4 a, std::int32_t b) { + return Mul(a, Dup(b)); +} + +inline Int32x4 Min(Int32x4 a, Int32x4 b) { return _mm_min_epi32(a, b); } + +inline Int32x4 Max(Int32x4 a, Int32x4 b) { return _mm_max_epi32(a, b); } + +inline Int32x4 SaturatingRoundingDoublingHighMul(Int32x4 a, std::int32_t b) { + return SaturatingRoundingDoublingHighMul(a, Dup(b)); +} + +template +Int32x4 MulByRhsLane(Int32x4 a, Int32x4 b) { + return Mul(a, DupLane(b)); +} + +inline void MulAdd(Int32x4 lhs, Int32x4 rhs, Int32x4* acc) { + *acc = Add(*acc, Mul(lhs, rhs)); +} + +inline void MulAdd(Int32x4 lhs, std::int32_t rhs, Int32x4* acc) { + *acc = Add(*acc, Mul(lhs, rhs)); +} + +template +inline void MulAddByRhsLane(Int32x4 lhs, Int32x4 rhs, Int32x4* acc) { + *acc = Add(*acc, MulByRhsLane(lhs, rhs)); +} + +template <> +struct LoadContiguousImpl> { + static RegBlockUint8<8, 8> Run(const std::uint8_t* src) { + RegBlockUint8<8, 8> result; + for (int i = 0; i < 4; i++) { + result.buf.reg[i] = LoadUint8x16(src + 16 * i); + } + return result; + } +}; + +template <> +struct LoadContiguousImpl> { + static RegBlockInt32<8, 8> Run(const std::int32_t* src) { + RegBlockInt32<8, 8> result; + for (int i = 0; i < 16; i++) { + result.buf.reg[i] = LoadInt32x4(src + 4 * i); + } + return result; + } +}; + +template <> +struct LoadContiguousImpl> { + static RegBlockInt16<8, 8> Run(const std::int16_t* src) { + RegBlockInt16<8, 8> result; + for (int i = 0; i < 8; i++) { + result.buf.reg[i] = LoadInt16x8(src + 8 * i); + } + return result; + } +}; + +} // end namespace gemmlowp + +#include "simd_wrappers_common_neon_sse.h" + +#endif // GEMMLOWP_INTERNAL_SIMD_WRAPPERS_SSE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/single_thread_gemm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/single_thread_gemm.h new file mode 100644 index 0000000000000000000000000000000000000000..35a78350385a2513a73d738be7b91f2a0d1f32c8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/single_thread_gemm.h @@ -0,0 +1,157 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// single_thread_gemm.h: Single-threaded GEMM implementation. +// This is a good place to start reading code, as it shows the overall +// structure of a GEMM and is much simpler than multi_thread_gemm.h. + +#ifndef GEMMLOWP_INTERNAL_SINGLE_THREAD_GEMM_H_ +#define GEMMLOWP_INTERNAL_SINGLE_THREAD_GEMM_H_ + +#include + +#include "../public/map.h" +#include "allocator.h" +#include "compute.h" +#include "kernel.h" +#include "pack.h" +#include "unpack.h" + +#ifdef GEMMLOWP_PROFILING_SIZES +#ifndef GEMMLOWP_PROFILING +#error GEMMLOWP_PROFILING_SIZES without GEMMLOWP_PROFILING +#endif +#include +#include +#endif + +namespace gemmlowp { + +class SingleThreadGemmContext { + public: + Allocator* allocator() { return &allocator_; } + + void set_l1_bytes_to_use(int n) { l1_bytes_to_use_ = n; } + void set_l2_bytes_to_use(int n) { l2_bytes_to_use_ = n; } + void set_l2_rhs_factor(float n) { l2_rhs_factor_ = n; } + + int l1_bytes_to_use() const { return l1_bytes_to_use_; } + int l2_bytes_to_use() const { return l2_bytes_to_use_; } + float l2_rhs_factor() const { return l2_rhs_factor_; } + + protected: + Allocator allocator_; + + // The cache configurationt to use. + int l1_bytes_to_use_ = kDefaultL1CacheSize; + int l2_bytes_to_use_ = kDefaultL2CacheSize; + float l2_rhs_factor_ = kDefaultL2RhsFactor; +}; + +template +void SingleThreadGemm(SingleThreadGemmContext* context, + const KernelBase& kernel, + const MatrixMap& lhs, + const MatrixMap& rhs, + MatrixMap* result, + const LhsOffset& lhs_offset, const RhsOffset& rhs_offset, + const OutputPipelineType& output_pipeline) { + ScopedProfilingLabel label("gemmlowp::SingleThreadGemm"); + + assert(lhs.cols() == rhs.rows()); + + int rows = result->rows(); + int cols = result->cols(); + int depth = lhs.cols(); + + // zero sizes should have been caught earlier and early-returned. + assert(rows > 0); + assert(cols > 0); + assert(depth > 0); + + // The case of rows= cols); + + Allocator* allocator = context->allocator(); + + BlockParams block_params; + block_params.Init( + rows, cols, depth, 1, context->l1_bytes_to_use(), + context->l2_bytes_to_use(), context->l2_rhs_factor()); + +#ifdef GEMMLOWP_PROFILING_SIZES + // Using a static map of label strings. Not reentrant at all! + static std::unordered_map labels_map; + std::uint64_t sizes_hash = static_cast(rows) ^ + (static_cast(depth) << 16) ^ + (static_cast(cols) << 32); + if (!labels_map.count(sizes_hash)) { + char label[256]; + snprintf(label, sizeof(label), + "(rows = %d, depth = %d, cols = %d, l2_rows = %d, l2_depth = %d, " + "l2_cols = %d, l1_rows = %d, l1_depth = %d, l1_cols = %d)", + rows, depth, cols, block_params.l2_rows, block_params.l2_depth, + block_params.l2_cols, block_params.l1_rows, block_params.l1_depth, + block_params.l1_cols); + labels_map[sizes_hash] = label; + } + ScopedProfilingLabel size_label(labels_map[sizes_hash].c_str()); +#endif + + PackedSideBlock packed_lhs(Side::Lhs, allocator, + block_params); + PackedSideBlock packed_rhs(Side::Rhs, allocator, + block_params); + + PackedResult packed_result(allocator, block_params); + + allocator->Commit(); + + const bool pack_rhs_once = block_params.l2_cols >= cols; + + if (pack_rhs_once) { + PackRhs(&packed_rhs, rhs); + } + + for (int r = 0; r < rows; r += block_params.l2_rows) { + int rs = std::min(block_params.l2_rows, rows - r); + + PackLhs(&packed_lhs, lhs.block(r, 0, rs, depth)); + + for (int c = 0; c < cols; c += block_params.l2_cols) { + int cs = std::min(block_params.l2_cols, cols - c); + + if (!pack_rhs_once) { + PackRhs(&packed_rhs, rhs.block(0, c, depth, cs)); + } + + Compute(kernel, block_params, &packed_result, packed_lhs, packed_rhs, + depth); + + UnpackResult( + result, MatrixBlockBounds(r, c, rs, cs), packed_result, depth, + packed_lhs.sums_of_each_slice(), packed_rhs.sums_of_each_slice(), + lhs_offset.block(r, rs), rhs_offset.block(c, cs), output_pipeline); + } + } + + allocator->Decommit(); +} + +} // namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_SINGLE_THREAD_GEMM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/unpack.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/unpack.h new file mode 100644 index 0000000000000000000000000000000000000000..021f4aa08858df3801bc6b26b1f80daa192f53ce --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/internal/unpack.h @@ -0,0 +1,280 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// unpack.h: unpacking the result blocks computed by compute.h, +// storing them into the destination matrix. + +#ifndef GEMMLOWP_INTERNAL_UNPACK_H_ +#define GEMMLOWP_INTERNAL_UNPACK_H_ + +#include "allocator.h" +#include "block_params.h" +#include "output.h" +#include "pack.h" + +#include + +namespace gemmlowp { + +class PackedResult { + public: + PackedResult(Allocator* _allocator, const BlockParams& _block_params) + : allocator_(_allocator), block_params_(_block_params) { + matrix_handle_ = allocator_->Reserve(block_params_.l2_rows * + block_params_.l2_cols); + } + + ~PackedResult() {} + + MatrixMap Map() { + return MatrixMap( + allocator_->GetPointer(matrix_handle_), + block_params_.l2_rows, block_params_.l2_cols, block_params_.l2_rows); + } + + MatrixMap Map() const { + return MatrixMap( + allocator_->GetPointer(matrix_handle_), + block_params_.l2_rows, block_params_.l2_cols, block_params_.l2_rows); + } + + private: + Allocator* allocator_; + Allocator::Handle matrix_handle_; + const BlockParams& block_params_; +}; + +struct MatrixBlockBounds { + int start_row; + int start_col; + int rows; + int cols; + + MatrixBlockBounds(int start_row_, int start_col_, int rows_, int cols_) + : start_row(start_row_), + start_col(start_col_), + rows(rows_), + cols(cols_) {} +}; + +template +void PrefetchResultBlock(const SrcMapType& src, + const VectorMap& + lhs_sums_of_each_slice, + int src_row, int src_col) { + const std::int32_t* src_data = src.data(src_row, src_col); + const int src_stride = src.stride(); + const std::int32_t* lhs_sums_data = lhs_sums_of_each_slice.data(src_row); + for (int r = 0; r < Rows; r += 4) { + Prefetch(lhs_sums_data + r); + } + for (int c = 0; c < Cols; c++) { + for (int r = 0; r < Rows; r += 4) { + Prefetch(src_data + r + c * src_stride); + } + } +} + +template +void UnpackResultBlock(const SrcMapType& src, + const OutputPipelineExecutorType& executor, DstType* dst, + const VectorMap& + lhs_sums_of_each_slice, + const VectorMap& + rhs_sums_of_each_slice, + const LhsOffset& lhs_offset, const RhsOffset& rhs_offset, + int depth, int src_row, int src_col, int src_global_row, + int src_global_col, int dst_row, int dst_col) { + using KernelLhsInputScalar = typename KernelFormat::Lhs::InputScalar; + using KernelLhsScalar = typename KernelFormat::Lhs::Scalar; + using KernelRhsInputScalar = typename KernelFormat::Rhs::InputScalar; + using KernelRhsScalar = typename KernelFormat::Rhs::Scalar; + static constexpr int KernelLhsZeroPointInput = + ZeroPointInputValue::kValue; + static constexpr int KernelRhsZeroPointInput = + ZeroPointInputValue::kValue; + auto acc = Load(src, src_row, src_col); + const auto& lhs_sums_of_each_slice_block = + LoadForBroadcasting(lhs_sums_of_each_slice, src_row); + const auto& rhs_sums_of_each_slice_block = + LoadForBroadcasting(rhs_sums_of_each_slice, src_col); + auto lhs_offset_block = + LoadForBroadcasting(lhs_offset, src_row); + auto rhs_offset_block = + LoadForBroadcasting(rhs_offset, src_col); + AddConstant(&lhs_offset_block); + AddConstant(&rhs_offset_block); + BroadcastMulAdd(lhs_sums_of_each_slice_block, rhs_offset_block, &acc); + for (int i = 0; i < decltype(rhs_offset_block)::kRegisterCount; i++) { + rhs_offset_block.buf.reg[i] = Mul(rhs_offset_block.buf.reg[i], depth); + } + BroadcastMulAdd(BroadcastAdd(rhs_sums_of_each_slice_block, rhs_offset_block), + lhs_offset_block, &acc); + executor.Execute(acc, dst, src_global_row, src_global_col, dst_row, dst_col); +} + +template +void UnpackResult(ResultBlockType* dst, const MatrixBlockBounds& dst_block, + const PackedResultType& src, int depth, + const std::int32_t* lhs_sums_of_each_slice_ptr, + const std::int32_t* rhs_sums_of_each_slice_ptr, + const LhsOffset& lhs_offset, const RhsOffset& rhs_offset, + const OutputPipelineType& output_pipeline) { + ScopedProfilingLabel label(ResultBlockType::kOrder == MapOrder::ColMajor + ? "unpack to column-major" + : "unpack to row-major"); + assert(dst_block.start_row >= 0); + assert(dst_block.start_row + dst_block.rows <= dst->rows()); + assert(dst_block.start_col >= 0); + assert(dst_block.start_col + dst_block.cols <= dst->cols()); + const auto src_map = src.Map(); + const VectorMap lhs_sums_of_each_slice( + lhs_sums_of_each_slice_ptr, dst_block.rows); + const VectorMap rhs_sums_of_each_slice( + rhs_sums_of_each_slice_ptr, dst_block.cols); + using Int32x1x1 = RegisterBlock; + using Int32x4x1 = RegisterBlock; + using Int32x8x1 = RegisterBlock; + using Int32x1x4 = RegisterBlock; + using Int32x4x4 = RegisterBlock; + using Int32x8x4 = RegisterBlock; + + using DstScalarType = typename ResultBlockType::Scalar; + using DstScalarx8x8 = RegisterBlock; + + OutputPipelineExecutor + output_pipeline_executor_1x1(output_pipeline); + OutputPipelineExecutor + output_pipeline_executor_4x1(output_pipeline); + OutputPipelineExecutor + output_pipeline_executor_8x1(output_pipeline); + OutputPipelineExecutor + output_pipeline_executor_1x4(output_pipeline); + OutputPipelineExecutor + output_pipeline_executor_4x4(output_pipeline); + OutputPipelineExecutor + output_pipeline_executor_8x4(output_pipeline); + + int c8 = 0; + if (ResultBlockType::kOrder == MapOrder::RowMajor) { + for (; c8 <= dst_block.cols - 8; c8 += 8) { + PrefetchResultBlock<8, 8>(src_map, lhs_sums_of_each_slice, 0, c8); + int r = 0; + for (; r <= dst_block.rows - 8; r += 8) { + const int global_row = r + dst_block.start_row; + PrefetchResultBlock<8, 8>(src_map, lhs_sums_of_each_slice, r + 8, c8); + DstScalarType dst_colmajor_buf[64]; + MatrixMap dst_colmajor_map( + dst_colmajor_buf, 8, 8); + for (int cx = 0; cx < 8; cx += 4) { + const int c = c8 + cx; + const int global_col = c + dst_block.start_col; + UnpackResultBlock( + src_map, output_pipeline_executor_8x4, &dst_colmajor_map, + lhs_sums_of_each_slice, rhs_sums_of_each_slice, lhs_offset, + rhs_offset, depth, r, c, global_row, global_col, 0, cx); + } + StoreFinalOutput(LoadContiguous(dst_colmajor_buf), dst, + r + dst_block.start_row, c8 + dst_block.start_col); + } + for (; r <= dst_block.rows - 4; r += 4) { + const int global_row = r + dst_block.start_row; + for (int cx = 0; cx < 8; cx += 4) { + const int c = c8 + cx; + const int global_col = c + dst_block.start_col; + UnpackResultBlock( + src_map, output_pipeline_executor_4x4, dst, + lhs_sums_of_each_slice, rhs_sums_of_each_slice, lhs_offset, + rhs_offset, depth, r, c, global_row, global_col, global_row, + global_col); + } + } + for (; r < dst_block.rows; r++) { + const int global_row = r + dst_block.start_row; + for (int cx = 0; cx < 8; cx += 4) { + const int c = c8 + cx; + const int global_col = c + dst_block.start_col; + UnpackResultBlock( + src_map, output_pipeline_executor_1x4, dst, + lhs_sums_of_each_slice, rhs_sums_of_each_slice, lhs_offset, + rhs_offset, depth, r, c, global_row, global_col, global_row, + global_col); + } + } + } + } + int c = c8; + for (; c <= dst_block.cols - 4; c += 4) { + const int global_col = c + dst_block.start_col; + PrefetchResultBlock<8, 4>(src_map, lhs_sums_of_each_slice, 0, c); + int r = 0; + for (; r <= dst_block.rows - 8; r += 8) { + const int global_row = r + dst_block.start_row; + PrefetchResultBlock<8, 4>(src_map, lhs_sums_of_each_slice, r + 8, c); + UnpackResultBlock( + src_map, output_pipeline_executor_8x4, dst, lhs_sums_of_each_slice, + rhs_sums_of_each_slice, lhs_offset, rhs_offset, depth, r, c, + global_row, global_col, global_row, global_col); + } + for (; r <= dst_block.rows - 4; r += 4) { + const int global_row = r + dst_block.start_row; + UnpackResultBlock( + src_map, output_pipeline_executor_4x4, dst, lhs_sums_of_each_slice, + rhs_sums_of_each_slice, lhs_offset, rhs_offset, depth, r, c, + global_row, global_col, global_row, global_col); + } + for (; r < dst_block.rows; r++) { + const int global_row = r + dst_block.start_row; + UnpackResultBlock( + src_map, output_pipeline_executor_1x4, dst, lhs_sums_of_each_slice, + rhs_sums_of_each_slice, lhs_offset, rhs_offset, depth, r, c, + global_row, global_col, global_row, global_col); + } + } + for (; c < dst_block.cols; c++) { + const int global_col = c + dst_block.start_col; + PrefetchResultBlock<8, 1>(src_map, lhs_sums_of_each_slice, 0, c); + int r = 0; + for (; r <= dst_block.rows - 8; r += 8) { + const int global_row = r + dst_block.start_row; + PrefetchResultBlock<8, 1>(src_map, lhs_sums_of_each_slice, r + 8, c); + UnpackResultBlock( + src_map, output_pipeline_executor_8x1, dst, lhs_sums_of_each_slice, + rhs_sums_of_each_slice, lhs_offset, rhs_offset, depth, r, c, + global_row, global_col, global_row, global_col); + } + for (; r <= dst_block.rows - 4; r += 4) { + const int global_row = r + dst_block.start_row; + UnpackResultBlock( + src_map, output_pipeline_executor_4x1, dst, lhs_sums_of_each_slice, + rhs_sums_of_each_slice, lhs_offset, rhs_offset, depth, r, c, + global_row, global_col, global_row, global_col); + } + for (; r < dst_block.rows; r++) { + const int global_row = r + dst_block.start_row; + UnpackResultBlock( + src_map, output_pipeline_executor_1x1, dst, lhs_sums_of_each_slice, + rhs_sums_of_each_slice, lhs_offset, rhs_offset, depth, r, c, + global_row, global_col, global_row, global_col); + } + } +} + +} // end namespace gemmlowp + +#endif // GEMMLOWP_INTERNAL_UNPACK_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/base.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/base.h new file mode 100644 index 0000000000000000000000000000000000000000..4eeb88d54dbf4ec4941926ee8e4f63d8eb4821a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/base.h @@ -0,0 +1,145 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_BASE_H_ +#define GEMMLOWP_META_BASE_H_ + +#include +#include + +#include "../internal/common.h" + +namespace gemmlowp { +namespace meta { + +template +inline int AlignTo(int value) { + return ((value + align - 1) / align) * align; +} + +inline int AlignTo(int align, int value) { + return ((value + align - 1) / align) * align; +} + +template +struct FusedKernelParams { + public: + typedef Kernel_ Kernel; + typedef OutputStream_ OutputStream; + + Kernel kernel; + OutputStream output_stream; +}; + +template +struct GemmParams { + public: + typedef InType_ InType; + typedef OutType_ OutType; + typedef LeftStream_ LeftStream; + typedef RightStream_ RightStream; + typedef Kernel_ Kernel; + typedef OutputStream_ OutputStream; + + typedef FusedKernelParams FusedKernel; + + // Common parameters. + + int m; + int n; + int k; + + const InType* lhs; + const InType* rhs; + OutType* result; + std::uint8_t* scratch; + + // Specialized parameters. + + LeftStream left_stream; + RightStream right_stream; + FusedKernel fused_kernel; +}; + +template +class Stream { + public: + static void Pack(const InType* in, const StreamParams& params, InType* out); + + static int UnpackedAdvance(const StreamParams& params); + + static int PackedAdvance(const StreamParams& params); + + static int UnpackedStride(const StreamParams& params); + + static int PackedStride(const StreamParams& params); +}; + +template +class StreamUtil { + public: + static const InType* Offset(const StreamType& params, const InType* source, + int offset_stride, int offset_advance); + + static int Scratch(const StreamType& params, int lanes); +}; + +template +class MulKernel { + public: + static void Multiply(const InType* lhs, const InType* rhs, + const FusedKernelParams& params, + OutType* result); +}; + +template +struct Transform1DParams { + typedef InType_ InType; + typedef OutType_ OutType; + typedef Kernel_ Kernel; + + const InType* input; + OutType* output; + std::uint8_t* scratch; + + Kernel kernel; +}; + +template +class Transform1DKernel { + public: + static void Transform(const InType* input, const Kernel& params, + OutType* output); +}; + +template +class Transform1DUtil { + public: + static int EstimateComputeCost(const Transform& params); + + static const InType* OffsetInput(const Transform& params, const InType* input, + int offset); + + static OutType* OffsetOutput(const Transform& params, OutType* output, + int offset); +}; + +} // namespace meta +} // namespace gemmlowp + +#endif // GEMMLOWP_META_BASE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_multi_thread_common.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_multi_thread_common.h new file mode 100644 index 0000000000000000000000000000000000000000..d4cec6fef07d236b9db2e43a2fe5919a1b2a5977 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_multi_thread_common.h @@ -0,0 +1,151 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// multi_thread_common.h: Multithreading code shared by different meta gemm +// versions. + +#ifndef GEMMLOWP_META_MULTI_THREAD_COMMON_H_ +#define GEMMLOWP_META_MULTI_THREAD_COMMON_H_ + +#include "../internal/multi_thread_gemm.h" + +namespace gemmlowp { +namespace meta { +namespace internal { + +const std::int32_t kMinTaskSize = 16000; +const std::int32_t kMinTaskDimension = 4; + +struct TaskRect { + std::int32_t m_offset; + std::int32_t m; + std::int32_t n_offset; + std::int32_t n; + + TaskRect(std::int32_t m_offset, std::int32_t m, std::int32_t n_offset, + std::int32_t n) + : m_offset(m_offset), m(m), n_offset(n_offset), n(n) {} +}; + +template +struct MetaTask : gemmlowp::Task { + std::uint8_t* scratch; + const IN_TYPE* lhs; + const IN_TYPE* rhs; + TaskRect task_rect; + std::int32_t k; + OUT_TYPE* result; + std::int32_t result_stride; + const F& operation; + + MetaTask(std::uint8_t* scratch, const IN_TYPE* lhs, const IN_TYPE* rhs, + const TaskRect& task_rect, std::int32_t k, OUT_TYPE* result, + std::int32_t result_stride, const F& operation) + : scratch(scratch), + lhs(lhs), + rhs(rhs), + task_rect(task_rect), + k(k), + result(result), + result_stride(result_stride), + operation(operation) {} + + void Run() override { + const IN_TYPE* task_lhs = lhs + task_rect.m_offset * k; + const IN_TYPE* task_rhs = rhs + task_rect.n_offset * k; + OUT_TYPE* task_result = + result + task_rect.m_offset * result_stride + task_rect.n_offset; + operation.ExecuteMatrixMatrix(scratch, task_lhs, task_rhs, task_rect.m, + task_rect.n, k, task_result, result_stride); + } +}; + +std::int32_t ResolveMaxThreads(std::int32_t max_threads) { + if (max_threads == 0) { + static const int hardware_threads_count = + static_cast(sysconf(_SC_NPROCESSORS_CONF)); + return hardware_threads_count; + } + return max_threads; +} + +void PrepareTasks(std::int32_t max_tasks, std::int32_t m, std::int32_t n, + std::int32_t k, std::vector* tasks) { + const std::int32_t max_tasks_by_size = (m * n * k) / kMinTaskSize; + const std::int32_t max_tasks_m = m / kMinTaskDimension; + const std::int32_t max_tasks_n = n / kMinTaskDimension; + const std::int32_t max_tasks_dimension = std::max(max_tasks_m, max_tasks_n); + + std::int32_t real_tasks = std::max( + 1, std::min(max_tasks, std::min(max_tasks_by_size, max_tasks_dimension))); + + if (real_tasks == 1) { + tasks->push_back(TaskRect(0, m, 0, n)); + return; + } + + if (max_tasks_m > max_tasks_n) { + const std::int32_t m_chunk = m / real_tasks; + for (int i = 0; i < real_tasks - 1; ++i) { + tasks->push_back(TaskRect(i * m_chunk, m_chunk, 0, n)); + } + const std::int32_t last_m_offset = (real_tasks - 1) * m_chunk; + tasks->push_back(TaskRect(last_m_offset, m - last_m_offset, 0, n)); + } else { + const std::int32_t n_chunk = n / real_tasks; + for (int i = 0; i < real_tasks - 1; ++i) { + tasks->push_back(TaskRect(0, m, i * n_chunk, n_chunk)); + } + const std::int32_t last_n_offset = (real_tasks - 1) * n_chunk; + tasks->push_back(TaskRect(0, m, last_n_offset, n - last_n_offset)); + } +} + +template +void MultiThreadedMatrixMatrix(gemmlowp::WorkersPool* pool, + std::int32_t max_threads, std::uint8_t* scratch, + const IN_TYPE* lhs, const IN_TYPE* rhs, + std::int32_t m, std::int32_t n, std::int32_t k, + OUT_TYPE* result, std::int32_t result_stride, + const F& operation) { + max_threads = internal::ResolveMaxThreads(max_threads); + + std::vector task_rects; + internal::PrepareTasks(max_threads, m, n, k, &task_rects); + + if (task_rects.size() == 1) { + operation.ExecuteMatrixMatrix(scratch, lhs, rhs, m, n, k, result, + result_stride); + return; + } + + std::uint8_t* task_scratch = scratch; + std::int32_t scratch_per_thread = operation.ScratchPerThread(m, n, k); + std::vector tasks; + std::for_each( + task_rects.begin(), task_rects.end(), + [&tasks, &task_scratch, lhs, rhs, k, result, result_stride, operation, + scratch_per_thread](internal::TaskRect& rect) { + tasks.push_back(new internal::MetaTask( + task_scratch, lhs, rhs, rect, k, result, result_stride, operation)); + task_scratch += scratch_per_thread; + }); + pool->Execute(tasks); +} + +} // namespace internal +} // namespace meta +} // namespace gemmlowp + +#endif // GEMMLOWP_META_MULTI_THREAD_COMMON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_multi_thread_gemm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_multi_thread_gemm.h new file mode 100644 index 0000000000000000000000000000000000000000..a1e48c3a0fcd1d9a8fe566d373adfbd10b2f619c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_multi_thread_gemm.h @@ -0,0 +1,260 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_MULTI_THREAD_GEMM_H_ +#define GEMMLOWP_META_MULTI_THREAD_GEMM_H_ + +#include "../internal/common.h" + +#ifdef GEMMLOWP_NEON + +#include "legacy_multi_thread_common.h" +#include "legacy_multi_thread_gemv.h" +#include "legacy_operations_common.h" +#include "legacy_single_thread_gemm.h" + +namespace gemmlowp { +namespace meta { +namespace internal { + +const std::int32_t kMaxCacheFriendlySize = 256 * 1024; + +template +void CacheFriendlyMatrixMatrix(std::uint8_t* scratch, const IN_TYPE* lhs, + const IN_TYPE* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, OUT_TYPE* result, + std::int32_t result_stride, const F& operation) { + const std::int32_t rhs_size = n * k * sizeof(IN_TYPE); + if (rhs_size > kMaxCacheFriendlySize) { + const std::int32_t optimal_n = + std::max(1, 4 * (kMaxCacheFriendlySize / (k * 4))); + const std::int32_t chunks_count_less_one = n / optimal_n - 1; + const std::int32_t chunk_size = optimal_n * k; + for (int i = 0; i < chunks_count_less_one; ++i) { + operation.ExecuteCacheFriendlyMatrixMatrix( + scratch, lhs, rhs + i * chunk_size, m, optimal_n, k, + result + i * optimal_n, result_stride); + } + const std::int32_t n_left = n - chunks_count_less_one * optimal_n; + operation.ExecuteCacheFriendlyMatrixMatrix( + scratch, lhs, rhs + chunks_count_less_one * chunk_size, m, n_left, k, + result + chunks_count_less_one * optimal_n, result_stride); + } else { + operation.ExecuteCacheFriendlyMatrixMatrix(scratch, lhs, rhs, m, n, k, + result, result_stride); + } +} + +class GemmQuantized8BitOperation : public Quantized8BitOperation { + public: + GemmQuantized8BitOperation(std::int32_t lhs_offset, std::int32_t rhs_offset, + std::int32_t sum_offset, std::int32_t multiplier, + std::int32_t shift) + : Quantized8BitOperation(lhs_offset, rhs_offset, sum_offset, multiplier, + shift) {} + + void ExecuteMatrixMatrix(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, std::uint8_t* result, + std::int32_t result_stride) const { + CacheFriendlyMatrixMatrix(scratch, lhs, rhs, m, n, k, result, result_stride, + *this); + } + + void ExecuteCacheFriendlyMatrixMatrix(std::uint8_t* scratch, + const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, + std::uint8_t* result, + std::int32_t result_stride) const { + gemm_q8_strided(scratch, lhs, rhs, m, n, k, lhs_offset, rhs_offset, + sum_offset, multiplier, shift, result, result_stride); + } + + static std::int32_t ScratchPerThread(std::int32_t m, std::int32_t n, + std::int32_t k) { + return 4 * kMaxCacheFriendlySize; + } +}; + +class GemmFloatOperation : public FloatOperation { + public: + GemmFloatOperation(std::int32_t lhs_offset, std::int32_t rhs_offset, + float result_offset) + : FloatOperation(lhs_offset, rhs_offset, result_offset) {} + + void ExecuteMatrixMatrix(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, float* result, + std::int32_t result_stride) const { + CacheFriendlyMatrixMatrix(scratch, lhs, rhs, m, n, k, result, result_stride, + *this); + } + + void ExecuteCacheFriendlyMatrixMatrix(std::uint8_t* scratch, + const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, + float* result, + std::int32_t result_stride) const { + gemm_f_strided(scratch, lhs, rhs, m, n, k, lhs_offset, rhs_offset, + result_offset, result, result_stride); + } + + static std::int32_t ScratchPerThread(std::int32_t m, std::int32_t n, + std::int32_t k) { + return 4 * kMaxCacheFriendlySize; + } +}; + +class GemmInt32Operation : public Int32Operation { + public: + GemmInt32Operation(std::int32_t lhs_offset, std::int32_t rhs_offset) + : Int32Operation(lhs_offset, rhs_offset) {} + + void ExecuteMatrixMatrix(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, std::int32_t* result, + std::int32_t result_stride) const { + CacheFriendlyMatrixMatrix(scratch, lhs, rhs, m, n, k, result, result_stride, + *this); + } + + void ExecuteCacheFriendlyMatrixMatrix(std::uint8_t* scratch, + const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, + std::int32_t* result, + std::int32_t result_stride) const { + gemm_i32_strided(scratch, lhs, rhs, m, n, k, lhs_offset, rhs_offset, result, + result_stride); + } + + static std::int32_t ScratchPerThread(std::int32_t m, std::int32_t n, + std::int32_t k) { + return 4 * kMaxCacheFriendlySize; + } +}; + +} // namespace internal + +std::int32_t gemm_q8_scratch(std::int32_t m, std::int32_t n, std::int32_t k, + std::int32_t max_threads) { + return internal::ResolveMaxThreads(max_threads) * + internal::GemmQuantized8BitOperation::ScratchPerThread(m, n, k); +} + +void multi_thread_gemm_q8(gemmlowp::WorkersPool* pool, std::int32_t max_threads, + std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, + std::int32_t lhs_offset, std::int32_t rhs_offset, + std::int32_t sum_offset, std::int32_t multiplier, + std::int32_t shift, std::uint8_t* result) { + if (m == 1) { + multi_thread_gemv_q8(pool, max_threads, scratch, lhs, rhs, n, k, lhs_offset, + rhs_offset, sum_offset, multiplier, shift, result); + return; + } else if (n == 1) { + multi_thread_gemv_q8(pool, max_threads, scratch, rhs, lhs, m, k, rhs_offset, + lhs_offset, sum_offset, multiplier, shift, result); + return; + } + + max_threads = internal::ResolveMaxThreads(max_threads); + internal::GemmQuantized8BitOperation operation(lhs_offset, rhs_offset, + sum_offset, multiplier, shift); + if (max_threads == 1) { + internal::CacheFriendlyMatrixMatrix(scratch, lhs, rhs, m, n, k, result, n, + operation); + } else { + internal::MultiThreadedMatrixMatrix(pool, max_threads, scratch, lhs, rhs, m, + n, k, result, n, operation); + } +} + +std::int32_t gemm_f_scratch(std::int32_t m, std::int32_t n, std::int32_t k, + std::int32_t max_threads) { + return internal::ResolveMaxThreads(max_threads) * + internal::GemmFloatOperation::ScratchPerThread(m, n, k); +} + +void multi_thread_gemm_f(gemmlowp::WorkersPool* pool, std::int32_t max_threads, + std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, + std::int32_t lhs_offset, std::int32_t rhs_offset, + float result_offset, float* result) { + if (m == 1) { + multi_thread_gemv_f(pool, max_threads, scratch, lhs, rhs, n, k, lhs_offset, + rhs_offset, result_offset, result); + return; + } else if (n == 1) { + multi_thread_gemv_f(pool, max_threads, scratch, rhs, lhs, m, k, rhs_offset, + lhs_offset, result_offset, result); + return; + } + + max_threads = internal::ResolveMaxThreads(max_threads); + internal::GemmFloatOperation operation(lhs_offset, rhs_offset, result_offset); + if (max_threads == 1) { + internal::CacheFriendlyMatrixMatrix(scratch, lhs, rhs, m, n, k, result, n, + operation); + } else { + internal::MultiThreadedMatrixMatrix(pool, max_threads, scratch, lhs, rhs, m, + n, k, result, n, operation); + } +} + +std::int32_t gemm_i32_scratch(std::int32_t m, std::int32_t n, std::int32_t k, + std::int32_t max_threads) { + return internal::ResolveMaxThreads(max_threads) * + internal::GemmInt32Operation::ScratchPerThread(m, n, k); +} + +void multi_thread_gemm_i32(gemmlowp::WorkersPool* pool, + std::int32_t max_threads, std::uint8_t* scratch, + const std::uint8_t* lhs, const std::uint8_t* rhs, + std::int32_t m, std::int32_t n, std::int32_t k, + std::int32_t lhs_offset, std::int32_t rhs_offset, + std::int32_t* result) { + if (m == 1) { + multi_thread_gemv_i32(pool, max_threads, scratch, lhs, rhs, n, k, + lhs_offset, rhs_offset, result); + return; + } else if (n == 1) { + multi_thread_gemv_i32(pool, max_threads, scratch, rhs, lhs, m, k, + rhs_offset, lhs_offset, result); + return; + } + + max_threads = internal::ResolveMaxThreads(max_threads); + internal::GemmInt32Operation operation(lhs_offset, rhs_offset); + if (max_threads == 1) { + internal::CacheFriendlyMatrixMatrix(scratch, lhs, rhs, m, n, k, result, n, + operation); + } else { + internal::MultiThreadedMatrixMatrix(pool, max_threads, scratch, lhs, rhs, m, + n, k, result, n, operation); + } +} + +} // namespace meta +} // namespace gemmlowp + +#else +#warning "Meta gemm fast-path requires GEMMLOWP_NEON_(32|64)!" +#endif + +#endif // GEMMLOWP_META_MULTI_THREAD_GEMM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_multi_thread_gemv.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_multi_thread_gemv.h new file mode 100644 index 0000000000000000000000000000000000000000..7af5684baa098ac99d9bdc05012e90371dac5288 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_multi_thread_gemv.h @@ -0,0 +1,168 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// multi_thread_gemv.h: Entry point to the multithreaded version of the +// generated (meta) gemv library. + +#ifndef GEMMLOWP_META_MULTI_THREAD_GEMV_H_ +#define GEMMLOWP_META_MULTI_THREAD_GEMV_H_ + +#ifdef GEMMLOWP_NEON + +#include "legacy_multi_thread_common.h" +#include "legacy_operations_common.h" +#include "legacy_single_thread_gemm.h" + +namespace gemmlowp { +namespace meta { +namespace internal { + +class GemvQuantized8BitOperation : public Quantized8BitOperation { + public: + GemvQuantized8BitOperation(std::int32_t lhs_offset, std::int32_t rhs_offset, + std::int32_t sum_offset, std::int32_t multiplier, + std::int32_t shift) + : Quantized8BitOperation(lhs_offset, rhs_offset, sum_offset, multiplier, + shift) {} + + void ExecuteMatrixMatrix(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, std::uint8_t* result, + std::int32_t result_stride) const { + gemv_q8(scratch, lhs, rhs, n, k, lhs_offset, rhs_offset, sum_offset, + multiplier, shift, result); + } + + static std::int32_t ScratchPerThread(std::int32_t m, std::int32_t n, + std::int32_t k) { + return 128 * 1024; + } +}; + +class GemvFloatOperation : public FloatOperation { + public: + GemvFloatOperation(std::int32_t lhs_offset, std::int32_t rhs_offset, + float result_offset) + : FloatOperation(lhs_offset, rhs_offset, result_offset) {} + + void ExecuteMatrixMatrix(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, float* result, + std::int32_t result_stride) const { + gemv_f(scratch, lhs, rhs, n, k, lhs_offset, rhs_offset, result_offset, + result); + } + + static std::int32_t ScratchPerThread(std::int32_t m, std::int32_t n, + std::int32_t k) { + return 128 * 1024; + } +}; + +class GemvInt32Operation : public Int32Operation { + public: + GemvInt32Operation(std::int32_t lhs_offset, std::int32_t rhs_offset) + : Int32Operation(lhs_offset, rhs_offset) {} + + void ExecuteMatrixMatrix(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, + std::int32_t n, std::int32_t k, std::int32_t* result, + std::int32_t result_stride) const { + gemv_i32(scratch, lhs, rhs, n, k, lhs_offset, rhs_offset, result); + } + + static std::int32_t ScratchPerThread(std::int32_t m, std::int32_t n, + std::int32_t k) { + return 128 * 1024; + } +}; + +} // namespace internal + +std::int32_t gemv_q8_scratch(std::int32_t m, std::int32_t n, std::int32_t k, + std::int32_t max_threads) { + return internal::ResolveMaxThreads(max_threads) * + internal::GemvQuantized8BitOperation::ScratchPerThread(m, n, k); +} + +void multi_thread_gemv_q8(gemmlowp::WorkersPool* pool, std::int32_t max_threads, + std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t n, + std::int32_t k, std::int32_t lhs_offset, + std::int32_t rhs_offset, std::int32_t sum_offset, + std::int32_t multiplier, std::int32_t shift, + std::uint8_t* result) { + max_threads = internal::ResolveMaxThreads(max_threads); + internal::GemvQuantized8BitOperation operation(lhs_offset, rhs_offset, + sum_offset, multiplier, shift); + if (max_threads == 1) { + operation.ExecuteMatrixMatrix(scratch, lhs, rhs, 1, n, k, result, n); + } else { + internal::MultiThreadedMatrixMatrix(pool, max_threads, scratch, lhs, rhs, 1, + n, k, result, n, operation); + } +} + +std::int32_t gemv_f_scratch(std::int32_t m, std::int32_t n, std::int32_t k, + std::int32_t max_threads) { + return internal::ResolveMaxThreads(max_threads) * + internal::GemvFloatOperation::ScratchPerThread(m, n, k); +} + +void multi_thread_gemv_f(gemmlowp::WorkersPool* pool, std::int32_t max_threads, + std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t n, + std::int32_t k, std::int32_t lhs_offset, + std::int32_t rhs_offset, float result_offset, + float* result) { + max_threads = internal::ResolveMaxThreads(max_threads); + internal::GemvFloatOperation operation(lhs_offset, rhs_offset, result_offset); + if (max_threads == 1) { + operation.ExecuteMatrixMatrix(scratch, lhs, rhs, 1, n, k, result, n); + } else { + internal::MultiThreadedMatrixMatrix(pool, max_threads, scratch, lhs, rhs, 1, + n, k, result, n, operation); + } +} + +std::int32_t gemv_i32_scratch(std::int32_t m, std::int32_t n, std::int32_t k, + std::int32_t max_threads) { + return internal::ResolveMaxThreads(max_threads) * + internal::GemvInt32Operation::ScratchPerThread(m, n, k); +} + +void multi_thread_gemv_i32(gemmlowp::WorkersPool* pool, + std::int32_t max_threads, std::uint8_t* scratch, + const std::uint8_t* lhs, const std::uint8_t* rhs, + std::int32_t n, std::int32_t k, + std::int32_t lhs_offset, std::int32_t rhs_offset, + std::int32_t* result) { + max_threads = internal::ResolveMaxThreads(max_threads); + internal::GemvInt32Operation operation(lhs_offset, rhs_offset); + if (max_threads == 1) { + operation.ExecuteMatrixMatrix(scratch, lhs, rhs, 1, n, k, result, n); + } else { + internal::MultiThreadedMatrixMatrix(pool, max_threads, scratch, lhs, rhs, 1, + n, k, result, n, operation); + } +} + +} // namespace meta +} // namespace gemmlowp + +#else +#warning "Meta gemm fast-path requires GEMMLOWP_NEON_(32|64)!" +#endif + +#endif // GEMMLOWP_META_MULTI_THREAD_GEMV_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_operations_common.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_operations_common.h new file mode 100644 index 0000000000000000000000000000000000000000..fadfa3b635157917f3cd4e67afc132a8634154c5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_operations_common.h @@ -0,0 +1,61 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_OPERATIONS_COMMON_H_ +#define GEMMLOWP_META_OPERATIONS_COMMON_H_ + +class Quantized8BitOperation { + public: + Quantized8BitOperation(std::int32_t lhs_offset, std::int32_t rhs_offset, + std::int32_t sum_offset, std::int32_t multiplier, + std::int32_t shift) + : lhs_offset(lhs_offset), + rhs_offset(rhs_offset), + sum_offset(sum_offset), + multiplier(multiplier), + shift(shift) {} + + protected: + std::int32_t lhs_offset; + std::int32_t rhs_offset; + std::int32_t sum_offset; + std::int32_t multiplier; + std::int32_t shift; +}; + +class FloatOperation { + public: + FloatOperation(std::int32_t lhs_offset, std::int32_t rhs_offset, + float result_offset) + : lhs_offset(lhs_offset), + rhs_offset(rhs_offset), + result_offset(result_offset) {} + + protected: + std::int32_t lhs_offset; + std::int32_t rhs_offset; + float result_offset; +}; + +class Int32Operation { + public: + Int32Operation(std::int32_t lhs_offset, std::int32_t rhs_offset) + : lhs_offset(lhs_offset), rhs_offset(rhs_offset) {} + + protected: + std::int32_t lhs_offset; + std::int32_t rhs_offset; +}; + +#endif // GEMMLOWP_META_OPERATIONS_COMMON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_single_thread_gemm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_single_thread_gemm.h new file mode 100644 index 0000000000000000000000000000000000000000..d662e47dc103f4f0b5e2693ffe63a82ab88d26a5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/legacy_single_thread_gemm.h @@ -0,0 +1,299 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_LEGACY_SINGLE_THREAD_GEMM_H_ +#define GEMMLOWP_META_LEGACY_SINGLE_THREAD_GEMM_H_ + +#include "../internal/common.h" + +#ifdef GEMMLOWP_NEON + +#include "quantized_mul_kernels.h" +#include "single_thread_gemm.h" +#include "streams.h" + +namespace gemmlowp { +namespace meta { + +void gemm_q8_strided(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, std::int32_t n, + std::int32_t k, std::int32_t lhs_offset, + std::int32_t rhs_offset, std::int32_t result_offset, + std::int32_t multiplicative_offset, std::int32_t shift, + std::uint8_t* result, std::int32_t result_stride) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_LEGACY_VERBOSE + std::cout << "Legacy::GemmQ8." << std::endl; +#endif +#endif + typedef GemmParams + Params; + Params params; + + params.m = m; + params.n = n; + params.k = k; + + params.lhs = lhs; + params.rhs = rhs; + params.result = result; + params.scratch = scratch; + + params.left_stream.count = k; + params.left_stream.stride = k; + params.left_stream.multiplicative_sum_offset = rhs_offset; + params.left_stream.additive_sum_offset = + result_offset + k * lhs_offset * rhs_offset; + + params.right_stream.count = k; + params.right_stream.stride = k; + params.right_stream.multiplicative_sum_offset = lhs_offset; + params.right_stream.additive_sum_offset = 0; + + params.fused_kernel.kernel.multiplicative_offset = multiplicative_offset; + params.fused_kernel.kernel.rounding_offset = (1 << (shift - 1)); + params.fused_kernel.kernel.shift = -shift; + params.fused_kernel.kernel.count = k; + params.fused_kernel.output_stream.stride = result_stride; + + Gemm(params); +} + +void gemv_q8(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t n, std::int32_t k, + std::int32_t lhs_offset, std::int32_t rhs_offset, + std::int32_t result_offset, std::int32_t multiplicative_offset, + std::int32_t shift, std::uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_LEGACY_VERBOSE + std::cout << "Legacy::GemvQ8." << std::endl; +#endif +#endif + typedef GemmParams + Params; + Params params; + + params.m = 1; + params.n = n; + params.k = k; + + params.lhs = lhs; + params.rhs = rhs; + params.result = result; + params.scratch = scratch; + + params.left_stream.count = k; + params.left_stream.stride = k; + params.left_stream.multiplicative_sum_offset = rhs_offset; + params.left_stream.additive_sum_offset = + result_offset + k * lhs_offset * rhs_offset; + + params.right_stream.count = k; + params.right_stream.stride = k; + params.right_stream.multiplicative_sum_offset = lhs_offset; + params.right_stream.additive_sum_offset = 0; + + params.fused_kernel.kernel.multiplicative_offset = multiplicative_offset; + params.fused_kernel.kernel.rounding_offset = (1 << (shift - 1)); + params.fused_kernel.kernel.shift = -shift; + params.fused_kernel.kernel.count = k; + params.fused_kernel.output_stream.stride = n; + + if (k < 1536) { + Gemm(params); + } else { + Gemm(params); + } +} + +void gemm_i32_strided(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, std::int32_t n, + std::int32_t k, std::int32_t lhs_offset, + std::int32_t rhs_offset, std::int32_t* result, + std::int32_t result_stride) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_LEGACY_VERBOSE + std::cout << "Legacy::GemmI32." << std::endl; +#endif +#endif + typedef GemmParams + Params; + Params params; + + params.m = m; + params.n = n; + params.k = k; + + params.lhs = lhs; + params.rhs = rhs; + params.result = result; + params.scratch = scratch; + + params.left_stream.count = k; + params.left_stream.stride = k; + params.left_stream.multiplicative_sum_offset = rhs_offset; + params.left_stream.additive_sum_offset = k * lhs_offset * rhs_offset; + + params.right_stream.count = k; + params.right_stream.stride = k; + params.right_stream.multiplicative_sum_offset = lhs_offset; + params.right_stream.additive_sum_offset = 0; + + params.fused_kernel.kernel.count = k; + params.fused_kernel.output_stream.stride = result_stride * 4; + + Gemm(params); +} + +void gemv_i32(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t n, std::int32_t k, + std::int32_t lhs_offset, std::int32_t rhs_offset, + std::int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_LEGACY_VERBOSE + std::cout << "Legacy::GemvI32." << std::endl; +#endif +#endif + typedef GemmParams + Params; + Params params; + + params.m = 1; + params.n = n; + params.k = k; + + params.lhs = lhs; + params.rhs = rhs; + params.result = result; + params.scratch = scratch; + + params.left_stream.count = k; + params.left_stream.stride = k; + params.left_stream.multiplicative_sum_offset = rhs_offset; + params.left_stream.additive_sum_offset = k * lhs_offset * rhs_offset; + + params.right_stream.count = k; + params.right_stream.stride = k; + params.right_stream.multiplicative_sum_offset = lhs_offset; + params.right_stream.additive_sum_offset = 0; + + params.fused_kernel.kernel.count = k; + params.fused_kernel.output_stream.stride = 0; + + if (k < 1664) { + Gemm(params); + } else { + Gemm(params); + } +} + +void gemm_f_strided(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t m, std::int32_t n, + std::int32_t k, std::int32_t lhs_offset, + std::int32_t rhs_offset, float result_offset, float* result, + std::int32_t result_stride) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_LEGACY_VERBOSE + std::cout << "Legacy::GemmF." << std::endl; +#endif +#endif + typedef GemmParams + Params; + Params params; + + params.m = m; + params.n = n; + params.k = k; + + params.lhs = lhs; + params.rhs = rhs; + params.result = result; + params.scratch = scratch; + + params.left_stream.count = k; + params.left_stream.stride = k; + params.left_stream.multiplicative_sum_offset = rhs_offset; + params.left_stream.additive_sum_offset = k * lhs_offset * rhs_offset; + + params.right_stream.count = k; + params.right_stream.stride = k; + params.right_stream.multiplicative_sum_offset = lhs_offset; + params.right_stream.additive_sum_offset = 0; + + params.fused_kernel.kernel.count = k; + params.fused_kernel.kernel.scale = result_offset; + params.fused_kernel.output_stream.stride = result_stride * 4; + + Gemm(params); +} + +void gemv_f(std::uint8_t* scratch, const std::uint8_t* lhs, + const std::uint8_t* rhs, std::int32_t n, std::int32_t k, + std::int32_t lhs_offset, std::int32_t rhs_offset, + float result_offset, float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_LEGACY_VERBOSE + std::cout << "Legacy::GemvF." << std::endl; +#endif +#endif + typedef GemmParams + Params; + Params params; + + params.m = 1; + params.n = n; + params.k = k; + + params.lhs = lhs; + params.rhs = rhs; + params.result = result; + params.scratch = scratch; + + params.left_stream.count = k; + params.left_stream.stride = k; + params.left_stream.multiplicative_sum_offset = rhs_offset; + params.left_stream.additive_sum_offset = k * lhs_offset * rhs_offset; + + params.right_stream.count = k; + params.right_stream.stride = k; + params.right_stream.multiplicative_sum_offset = lhs_offset; + params.right_stream.additive_sum_offset = 0; + + params.fused_kernel.kernel.count = k; + params.fused_kernel.kernel.scale = result_offset; + params.fused_kernel.output_stream.stride = 0; + + if (k < 1664) { + Gemm(params); + } else { + Gemm(params); + } +} + +} // namespace meta +} // namespace gemmlowp + +#else +#warning "Meta gemm fast-path requires GEMMLOWP_NEON_(32|64)!" +#endif + +#endif // GEMMLOWP_META_LEGACY_SINGLE_THREAD_GEMM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/multi_thread_common.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/multi_thread_common.h new file mode 100644 index 0000000000000000000000000000000000000000..b39c3f2e5250586f0b5167c791f50ac8ff230e38 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/multi_thread_common.h @@ -0,0 +1,56 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_MULTI_THREAD_COMMON_H_ +#define GEMMLOWP_META_MULTI_THREAD_COMMON_H_ + +#include "../internal/multi_thread_gemm.h" + +namespace gemmlowp { +namespace meta { + +inline int ResolveMaxThreads(int max_threads) { + if (max_threads == 0) { +#ifdef _WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; +#else + static const int hardware_threads_count = + static_cast(sysconf(_SC_NPROCESSORS_CONF)); + return hardware_threads_count; +#endif + } + return max_threads; +} + +template +class SimpleContext { + public: + SimpleContext(int max_num_threads, WorkersPool* pool) + : max_num_threads_(max_num_threads), pool_(pool) {} + + WorkersPool* workers_pool() { return pool_; } + + int max_num_threads() { return max_num_threads_; } + + private: + int max_num_threads_; + WorkersPool* pool_; +}; + +} // namespace meta +} // namespace gemmlowp + +#endif // GEMMLOWP_META_MULTI_THREAD_COMMON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/multi_thread_gemm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/multi_thread_gemm.h new file mode 100644 index 0000000000000000000000000000000000000000..f69f810a9e0e57a1701826bdbe74149d95568284 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/multi_thread_gemm.h @@ -0,0 +1,144 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_MULTI_THREAD_GEMM_H_ +#define GEMMLOWP_META_MULTI_THREAD_GEMM_H_ + +#include "multi_thread_common.h" +#include "single_thread_gemm.h" + +namespace gemmlowp { +namespace meta { +namespace internal { + +const std::int32_t kMinGemmTaskSize = 16000; +const std::int32_t kMinGemmTaskDimension = 4; + +template +std::uint8_t* PrepareGemmTask(const Params& params, int kernel_m, int kernel_n, + int kernel_k, std::uint8_t* scratch, int m_start, + int m, int n_start, int n, + std::vector* tasks) { + tasks->push_back(params); + Params& task = tasks->back(); + task.scratch = scratch; + + task.m = m; + task.lhs = + StreamUtil::Offset( + params.left_stream, params.lhs, m_start, 0); + + task.n = n; + task.rhs = + StreamUtil::Offset( + params.right_stream, params.rhs, n_start, 0); + + task.result = + StreamUtil:: + Offset(params.fused_kernel.output_stream, params.result, m_start, + n_start); + + return scratch + Executor::template EstimateScratchSize( + task, kernel_m, kernel_n, kernel_k); +} + +template +bool PrepareGemmTasks(MultiThreadingContext* context, const Params& params, + int kernel_m, int kernel_n, int kernel_k, + std::vector* task_params) { + const int max_threads = ResolveMaxThreads(context->max_num_threads()); + const int max_tasks_by_size = + (params.m * params.n * params.k) / kMinGemmTaskSize; + const int max_tasks_m = params.m / kMinGemmTaskDimension; + const int max_tasks_n = params.n / kMinGemmTaskDimension; + const int max_tasks_dimension = std::max(max_tasks_m, max_tasks_n); + + const int real_tasks = std::max( + 1, + std::min(max_threads, std::min(max_tasks_by_size, max_tasks_dimension))); + + if (real_tasks == 1) { + return false; + } + + std::uint8_t* scratch = params.scratch; + + if (max_tasks_m > max_tasks_n) { + const int m_chunk = params.m / real_tasks; + for (int i = 0; i < real_tasks - 1; ++i) { + scratch = PrepareGemmTask( + params, kernel_m, kernel_n, kernel_k, scratch, i * m_chunk, m_chunk, + 0, params.n, task_params); + } + const int sum_m = (real_tasks - 1) * m_chunk; + PrepareGemmTask(params, kernel_m, kernel_n, kernel_k, + scratch, sum_m, params.m - sum_m, 0, + params.n, task_params); + } else { + const int n_chunk = params.n / real_tasks; + for (int i = 0; i < real_tasks - 1; ++i) { + scratch = PrepareGemmTask( + params, kernel_m, kernel_n, kernel_k, scratch, 0, params.m, + i * n_chunk, n_chunk, task_params); + } + int sum_n = (real_tasks - 1) * n_chunk; + PrepareGemmTask(params, kernel_m, kernel_n, kernel_k, + scratch, 0, params.m, sum_n, + params.n - sum_n, task_params); + } + + return true; +} + +template +struct GemmTaskRunner : gemmlowp::Task { + GemmTaskRunner(const Params& params) : params(params) {} + + void Run() override { + Gemm(params); + } + + Params params; +}; + +} // namespace internal + +template +inline void MultiThreadGemm(MultiThreadingContext* context, + const Params& params) { + typedef internal::GemmTaskRunner + TaskRunnerType; + + std::vector task_params; + if (!internal::PrepareGemmTasks( + context, params, kernel_m, kernel_n, kernel_k, &task_params)) { + Gemm(params); + return; + } + + auto workers_pool = context->workers_pool(); + std::vector tasks; + for (auto& task_param : task_params) { + tasks.push_back(new TaskRunnerType(task_param)); + }; + workers_pool->Execute(tasks); +} + +} // namespace meta +} // namespace gemmlowp + +#endif // GEMMLOWP_META_MULTI_THREAD_GEMM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/multi_thread_transform.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/multi_thread_transform.h new file mode 100644 index 0000000000000000000000000000000000000000..3bd4b3e770dcba6ea2c9b847977e7629747c2f0c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/multi_thread_transform.h @@ -0,0 +1,98 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_MULTI_THREAD_TRANSFORM_H_ +#define GEMMLOWP_META_MULTI_THREAD_TRANSFORM_H_ + +#include "multi_thread_common.h" +#include "single_thread_transform.h" + +namespace gemmlowp { +namespace meta { +namespace internal { + +const int kTransformTaskOverhead = 128000; +const int kMinTransformTaskSize = 32000; + +template +inline bool PrepareTransform1DTasks(MultiThreadingContext* context, + const Params& params, int kernel_size, + std::vector* task_params) { + typedef Transform1DUtil + Util; + + const int max_threads = ResolveMaxThreads(context->max_num_threads()); + const int task_size = Util::EstimateComputeCost(params.kernel); + const int max_tasks_by_size = + (task_size - kTransformTaskOverhead) / kMinTransformTaskSize; + + const int real_tasks = std::max(1, std::min(max_threads, max_tasks_by_size)); + + if (real_tasks == 1) { + return false; + } + + const int chunk = params.kernel.count / real_tasks; + for (int i = 0; i < real_tasks - 1; ++i) { + task_params->push_back(params); + Params& task = task_params->back(); + task.kernel.count = chunk; + task.input = Util::OffsetInput(params.kernel, params.input, i * chunk); + task.output = Util::OffsetOutput(params.kernel, params.output, i * chunk); + } + task_params->push_back(params); + Params& task = task_params->back(); + const int sum_chunk = (real_tasks - 1) * chunk; + task.kernel.count = params.kernel.count - sum_chunk; + task.input = Util::OffsetInput(params.kernel, params.input, sum_chunk); + task.output = Util::OffsetOutput(params.kernel, params.output, sum_chunk); + return true; +} + +template +struct Transform1DTaskRunner : gemmlowp::Task { + Transform1DTaskRunner(const Params& params) : params(params) {} + + void Run() override { Transform1D(params); } + + Params params; +}; + +} // namespace internal + +template +inline void MultiThreadTransform1D(MultiThreadingContext* context, + const Params& params) { + typedef internal::Transform1DTaskRunner TaskRunnerType; + + std::vector task_params; + if (!internal::PrepareTransform1DTasks( + context, params, kernel_size, &task_params)) { + Transform1D(params); + return; + } + + auto workers_pool = context->workers_pool(); + std::vector tasks; + for (auto& task_param : task_params) { + tasks.push_back(new TaskRunnerType(task_param)); + } + workers_pool->Execute(tasks); +} + +} // namespace meta +} // namespace gemmlowp + +#endif // GEMMLOWP_META_MULTI_THREAD_TRANSFORM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/quantized_mul_kernels.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/quantized_mul_kernels.h new file mode 100644 index 0000000000000000000000000000000000000000..8b4bebee2fcb635fff7366254b3b3d21084caac2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/quantized_mul_kernels.h @@ -0,0 +1,177 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_QUANTIZED_MUL_KERNELS_H_ +#define GEMMLOWP_META_QUANTIZED_MUL_KERNELS_H_ + +#include +#include + +#include "base.h" +#include "streams.h" + +namespace gemmlowp { +namespace meta { + +struct QuantizedStaticPreprocessed { + public: + int multiplicative_offset; + int rounding_offset; + int shift; + int count; +}; + +template +class MulKernel { + public: + typedef FusedKernelParams FusedKernel; + + static void Multiply(const InType* lhs, const InType*, + const FusedKernel& params, OutType* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "MulQSPR(" << typeid(InType).name() << ", " + << typeid(OutType).name() << ")::Multiply() -- " << m << "x" << n + << "x" << k << std::endl; +#endif +#else + if (m != 0 && n != 0) { + std::cerr << "FATAL: QuantizedStaticPreprocessed_RowMajor::Multiply not " + << "implemented." << std::endl; + std::exit(1); + } +#endif + } + +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + static void Debug(const FusedKernel& params) { + std::cout << "MulQSPR(" << typeid(InType).name() << ", " + << typeid(OutType).name() << ") -- " << m << "x" << n << "x" << k + << std::endl; + std::cout << " params:" << std::endl; + std::cout << " kernel.multiplicative_offset: " + << params.kernel.multiplicative_offset << std::endl; + std::cout << " kernel.rounding_offset: " << params.kernel.rounding_offset + << std::endl; + std::cout << " kernel.shift: " << params.kernel.shift << std::endl; + std::cout << " kernel.count: " << params.kernel.count << std::endl; + std::cout << " output_stream.stride: " << params.output_stream.stride + << std::endl; + } +#endif +#endif +}; + +struct QuantizedStaticPreprocessedAsInt32 { + public: + int count; +}; + +template +class MulKernel { + public: + typedef FusedKernelParams + FusedKernel; + + static void Multiply(const InType* lhs, const InType*, + const FusedKernel& params, OutType* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "MulQSPI32R(" << typeid(InType).name() << ", " + << typeid(OutType).name() << ")::Multiply() -- " << m << "x" << n + << "x" << k << std::endl; +#endif +#else + if (m != 0 && n != 0) { + std::cerr << "FATAL: QuantizedStaticPreprocessedAsInt32_RowMajor::" + << "Multiply not implemented." << std::endl; + std::exit(1); + } +#endif + } + +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + static void Debug(const FusedKernel& params) { + std::cout << "MulQSPI32R(" << typeid(InType).name() << ", " + << typeid(OutType).name() << ") -- " << m << "x" << n << "x" << k + << std::endl; + std::cout << " params:" << std::endl; + std::cout << " kernel.count: " << params.kernel.count << std::endl; + std::cout << " output_stream.stride: " << params.output_stream.stride + << std::endl; + } +#endif +#endif +}; + +struct QuantizedStaticPreprocessedAsFloat { + public: + int count; + float scale; +}; + +template +class MulKernel { + public: + typedef FusedKernelParams + FusedKernel; + + static void Multiply(const InType* lhs, const InType*, + const FusedKernel& params, OutType* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "MulQSPFR(" << typeid(InType).name() << ", " + << typeid(OutType).name() << ")::Multiply() -- " << m << "x" << n + << "x" << k << std::endl; +#endif +#else + if (m != 0 && n != 0) { + std::cerr << "FATAL: QuantizedStaticPreprocessedAsFloat_RowMajor::" + << "Multiply not implemented." << std::endl; + std::exit(1); + } +#endif + } + +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + static void Debug(const FusedKernel& params) { + std::cout << "MulQSPFR(" << typeid(InType).name() << ", " + << typeid(OutType).name() << ") -- " << m << "x" << n << "x" << k + << std::endl; + std::cout << " params:" << std::endl; + std::cout << " kernel.count: " << params.kernel.count << std::endl; + std::cout << " kernel.scale: " << params.kernel.scale << std::endl; + std::cout << " output_stream.stride: " << params.output_stream.stride + << std::endl; + } +#endif +#endif +}; + +} // namespace meta +} // namespace gemmlowp + +#ifdef GEMMLOWP_NEON_32 +#include "quantized_mul_kernels_arm_32.h" +#elif defined(GEMMLOWP_NEON_64) +#include "quantized_mul_kernels_arm_64.h" +#endif + +#endif // GEMMLOWP_META_QUANTIZED_MUL_KERNELS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/quantized_mul_kernels_arm_32.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/quantized_mul_kernels_arm_32.h new file mode 100644 index 0000000000000000000000000000000000000000..1619c9d97b0f997d8844f0e6085b7dd7b387689d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/quantized_mul_kernels_arm_32.h @@ -0,0 +1,4288 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_QUANTIZED_MUL_KERNELS_ARM_32_H_ +#define GEMMLOWP_META_QUANTIZED_MUL_KERNELS_ARM_32_H_ + +#ifdef GEMMLOWP_NEON_32 + +#include +#include + +namespace gemmlowp { +namespace meta { + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d2}, [%[lhs]:64]!\n" + "vld1.32 {d3}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q2, d3, d2\n" + "vpadal.u16 q0, q2\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[multiplicative_offset]\n" + "vdup.32 q7, %[rounding_offset]\n" + "vdup.32 q8, %[shift]\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d0, d0, d0\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + "vmul.i32 q0, q0, q6\n" + "vadd.i32 q0, q0, q7\n" + "vshl.s32 q0, q0, q8\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + // RowMajorOutput::Output + "vst1.8 {d0[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d8", "d9", "d10", "d11", "d12", + "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d4}, [%[lhs]:64]!\n" + "vld1.32 {d5, d6}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q4, d5, d4\n" + "vmull.u8 q5, d6, d4\n" + "vpadal.u16 q0, q4\n" + "vpadal.u16 q1, q5\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[multiplicative_offset]\n" + "vdup.32 q7, %[rounding_offset]\n" + "vdup.32 q8, %[shift]\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d0, d0, d2\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + "vmul.i32 q0, q0, q6\n" + "vadd.i32 q0, q0, q7\n" + "vshl.s32 q0, q0, q8\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + // RowMajorOutput::Output + "vst1.16 {d0[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d8", "d9", "d10", "d11", + "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d6}, [%[lhs]:64]!\n" + "vld1.32 {d7, d8, d9}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q5, d7, d6\n" + "vmull.u8 q6, d8, d6\n" + "vmull.u8 q7, d9, d6\n" + "vpadal.u16 q0, q5\n" + "vpadal.u16 q1, q6\n" + "vpadal.u16 q2, q7\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[multiplicative_offset]\n" + "vdup.32 q7, %[rounding_offset]\n" + "vdup.32 q8, %[shift]\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d4\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + "vmul.i32 q0, q0, q6\n" + "vadd.i32 q0, q0, q7\n" + "vshl.s32 q0, q0, q8\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + // RowMajorOutput::Output + "vst1.16 {d0[0]}, [%[result]]!\n" + "vst1.8 {d0[2]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d8}, [%[lhs]:64]!\n" + "vld1.32 {d9, d10, d11, d12}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q7, d9, d8\n" + "vmull.u8 q8, d10, d8\n" + "vmull.u8 q9, d11, d8\n" + "vmull.u8 q10, d12, d8\n" + "vpadal.u16 q0, q7\n" + "vpadal.u16 q1, q8\n" + "vpadal.u16 q2, q9\n" + "vpadal.u16 q3, q10\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[multiplicative_offset]\n" + "vdup.32 q7, %[rounding_offset]\n" + "vdup.32 q8, %[shift]\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + "vmul.i32 q0, q0, q6\n" + "vadd.i32 q0, q0, q7\n" + "vshl.s32 q0, q0, q8\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d10, d11, d12, d13}, [%[rhs]:64]!\n" + "vld1.32 {d14}, [%[lhs]:64]!\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q8, d10, d14\n" + "vmull.u8 q9, d11, d14\n" + "vmull.u8 q10, d12, d14\n" + "vmull.u8 q11, d13, d14\n" + "vld1.32 {d10}, [%[rhs]:64]!\n" + "pld [%[rhs], #128]\n" + "vpadal.u16 q0, q8\n" + "vpadal.u16 q1, q9\n" + "vpadal.u16 q2, q10\n" + "vpadal.u16 q3, q11\n" + "vmull.u8 q8, d10, d14\n" + "vpadal.u16 q4, q8\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d10, d11}, [%[lhs]:64]!\n" + "vld1.32 {d12, d13, d14, d15}, [%[rhs]:64]!\n" + "vdup.32 q8, %[multiplicative_offset]\n" + "vdup.32 q9, %[rounding_offset]\n" + "vdup.32 q10, %[shift]\n" + "vdup.32 q5, d10[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d8\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q1, q1, q5\n" + "vadd.s32 q0, q0, q6\n" + "vadd.s32 q1, q1, q7\n" + "vmul.i32 q0, q0, q8\n" + "vmul.i32 q1, q1, q8\n" + "vadd.i32 q0, q0, q9\n" + "vadd.i32 q1, q1, q9\n" + "vshl.s32 q0, q0, q10\n" + "vshl.s32 q1, q1, q10\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + "vst1.8 {d0[4]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d12, d13, d14, d15}, [%[rhs]:64]!\n" + "vld1.32 {d16}, [%[lhs]:64]!\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q9, d12, d16\n" + "vmull.u8 q10, d13, d16\n" + "vmull.u8 q11, d14, d16\n" + "vmull.u8 q12, d15, d16\n" + "vld1.32 {d12, d13}, [%[rhs]:64]!\n" + "pld [%[rhs], #128]\n" + "vpadal.u16 q0, q9\n" + "vpadal.u16 q1, q10\n" + "vpadal.u16 q2, q11\n" + "vpadal.u16 q3, q12\n" + "vmull.u8 q9, d12, d16\n" + "vmull.u8 q10, d13, d16\n" + "vpadal.u16 q4, q9\n" + "vpadal.u16 q5, q10\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15, d16, d17}, [%[rhs]:64]!\n" + "vdup.32 q9, %[multiplicative_offset]\n" + "vdup.32 q10, %[rounding_offset]\n" + "vdup.32 q11, %[shift]\n" + "vdup.32 q6, d12[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d10\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q6\n" + "vadd.s32 q1, q1, q6\n" + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q1, q1, q8\n" + "vmul.i32 q0, q0, q9\n" + "vmul.i32 q1, q1, q9\n" + "vadd.i32 q0, q0, q10\n" + "vadd.i32 q1, q1, q10\n" + "vshl.s32 q0, q0, q11\n" + "vshl.s32 q1, q1, q11\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + "vst1.16 {d0[2]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d14, d15, d16, d17}, [%[rhs]:64]!\n" + "vld1.32 {d18}, [%[lhs]:64]!\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q10, d14, d18\n" + "vmull.u8 q11, d15, d18\n" + "vmull.u8 q12, d16, d18\n" + "vmull.u8 q13, d17, d18\n" + "vld1.32 {d14, d15, d16}, [%[rhs]:64]!\n" + "pld [%[rhs], #128]\n" + "vpadal.u16 q0, q10\n" + "vpadal.u16 q1, q11\n" + "vpadal.u16 q2, q12\n" + "vpadal.u16 q3, q13\n" + "vmull.u8 q10, d14, d18\n" + "vmull.u8 q11, d15, d18\n" + "vmull.u8 q12, d16, d18\n" + "vpadal.u16 q4, q10\n" + "vpadal.u16 q5, q11\n" + "vpadal.u16 q6, q12\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d14, d15}, [%[lhs]:64]!\n" + "vld1.32 {d16, d17, d18, d19}, [%[rhs]:64]!\n" + "vdup.32 q10, %[multiplicative_offset]\n" + "vdup.32 q11, %[rounding_offset]\n" + "vdup.32 q12, %[shift]\n" + "vdup.32 q7, d14[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d10\n" + "vpadd.u32 d3, d12, d12\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q1, q1, q7\n" + "vadd.s32 q0, q0, q8\n" + "vadd.s32 q1, q1, q9\n" + "vmul.i32 q0, q0, q10\n" + "vmul.i32 q1, q1, q10\n" + "vadd.i32 q0, q0, q11\n" + "vadd.i32 q1, q1, q11\n" + "vshl.s32 q0, q0, q12\n" + "vshl.s32 q1, q1, q12\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + "vst1.16 {d0[2]}, [%[result]]!\n" + "vst1.8 {d0[6]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + "vmov.i32 q7, q4\n" + + // 1x8 lanes loop. + "1:" + + "vld1.32 {d17, d18, d19, d20}, [%[rhs]:256]!\n" + "vld1.32 {d16}, [%[lhs]:64]!\n" + "vmull.u8 q11, d16, d17\n" + "vmull.u8 q12, d16, d18\n" + "vmull.u8 q13, d16, d19\n" + "vmull.u8 q14, d16, d20\n" + "vld1.32 {d17, d18, d19, d20}, [%[rhs]:256]!\n" + "vpadal.u16 q0, q11\n" + "vpadal.u16 q1, q12\n" + "vpadal.u16 q2, q13\n" + "vpadal.u16 q3, q14\n" + "pld [%[rhs], #256]\n" + "vmull.u8 q15, d16, d17\n" + "vmull.u8 q11, d16, d18\n" + "vmull.u8 q12, d16, d19\n" + "vmull.u8 q13, d16, d20\n" + "pld [%[lhs], #32]\n" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vpadal.u16 q4, q15\n" + "vpadal.u16 q5, q11\n" + "vpadal.u16 q6, q12\n" + "vpadal.u16 q7, q13\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d16, d17}, [%[lhs]:64]!\n" + "vld1.32 {d18, d19, d20, d21}, [%[rhs]:64]!\n" + "vdup.32 q11, %[multiplicative_offset]\n" + "vdup.32 q12, %[rounding_offset]\n" + "vdup.32 q13, %[shift]\n" + "vdup.32 q8, d16[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d14, d14, d15\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d10\n" + "vpadd.u32 d3, d12, d14\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q8\n" + "vadd.s32 q1, q1, q8\n" + "vadd.s32 q0, q0, q9\n" + "vadd.s32 q1, q1, q10\n" + "vmul.i32 q0, q0, q11\n" + "vmul.i32 q1, q1, q11\n" + "vadd.i32 q0, q0, q12\n" + "vadd.i32 q1, q1, q12\n" + "vshl.s32 q0, q0, q13\n" + "vshl.s32 q1, q1, q13\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", + "d31", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d4, d5}, [%[lhs]:64]!\n" + "vld1.32 {d6}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q4, d6, d4\n" + "vmull.u8 q5, d6, d5\n" + "vpadal.u16 q0, q4\n" + "vpadal.u16 q1, q5\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[multiplicative_offset]\n" + "vdup.32 q7, %[rounding_offset]\n" + "vdup.32 q8, %[shift]\n" + "vdup.32 q2, d8[0]\n" + "vdup.32 q4, d8[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d0, d0, d0\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d2, d2, d2\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q2\n" + "vadd.s32 q1, q1, q4\n" + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q1, q1, q5\n" + "vmul.i32 q0, q0, q6\n" + "vmul.i32 q1, q1, q6\n" + "vadd.i32 q0, q0, q7\n" + "vadd.i32 q1, q1, q7\n" + "vshl.s32 q0, q0, q8\n" + "vshl.s32 q1, q1, q8\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d2, q1\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d2, q1\n" + + // RowMajorOutput::Output + "vst1.8 {d0[0]}, [%[result]]!\n" + "vst1.8 {d2[0]}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q6, d10, d8\n" + "vmull.u8 q7, d11, d8\n" + "vmull.u8 q8, d10, d9\n" + "vmull.u8 q9, d11, d9\n" + "vpadal.u16 q0, q6\n" + "vpadal.u16 q1, q7\n" + "vpadal.u16 q2, q8\n" + "vpadal.u16 q3, q9\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[multiplicative_offset]\n" + "vdup.32 q7, %[rounding_offset]\n" + "vdup.32 q8, %[shift]\n" + "vdup.32 q9, d8[0]\n" + "vdup.32 q4, d8[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d4, d4, d6\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q9\n" + "vadd.s32 q2, q2, q4\n" + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q2, q2, q5\n" + "vmul.i32 q0, q0, q6\n" + "vmul.i32 q2, q2, q6\n" + "vadd.i32 q0, q0, q7\n" + "vadd.i32 q2, q2, q7\n" + "vshl.s32 q0, q0, q8\n" + "vshl.s32 q2, q2, q8\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d4, q2\n" + + // RowMajorOutput::Output + "vst1.16 {d0[0]}, [%[result]]!\n" + "vst1.16 {d4[0]}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15, d16}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q9, d14, d12\n" + "vmull.u8 q10, d15, d12\n" + "vmull.u8 q11, d16, d12\n" + "vmull.u8 q12, d14, d13\n" + "vmull.u8 q13, d15, d13\n" + "vmull.u8 q14, d16, d13\n" + "vpadal.u16 q0, q9\n" + "vpadal.u16 q1, q10\n" + "vpadal.u16 q2, q11\n" + "vpadal.u16 q3, q12\n" + "vpadal.u16 q4, q13\n" + "vpadal.u16 q5, q14\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15}, [%[rhs]:64]!\n" + "vdup.32 q8, %[multiplicative_offset]\n" + "vdup.32 q9, %[rounding_offset]\n" + "vdup.32 q10, %[shift]\n" + "vdup.32 q11, d12[0]\n" + "vdup.32 q6, d12[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d4\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d6, d6, d8\n" + "vpadd.u32 d7, d10, d10\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q11\n" + "vadd.s32 q3, q3, q6\n" + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q3, q3, q7\n" + "vmul.i32 q0, q0, q8\n" + "vmul.i32 q3, q3, q8\n" + "vadd.i32 q0, q0, q9\n" + "vadd.i32 q3, q3, q9\n" + "vshl.s32 q0, q0, q10\n" + "vshl.s32 q3, q3, q10\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d6, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d6, q3\n" + + // RowMajorOutput::Output + "vst1.16 {d0[0]}, [%[result]]!\n" + "vst1.8 {d0[2]}, [%[result]]!\n" + "vst1.16 {d6[0]}, [r0]!\n" + "vst1.8 {d6[2]}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "cc", + "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + "vmov.i32 q7, q4\n" + + // 2x4 lanes loop. + "1:" + + "vld1.8 {d18, d19, d20, d21}, [%[rhs]:256]!\n" + "vld1.8 {d16}, [%[lhs]:64]!\n" + "vmull.u8 q11, d16, d18\n" + "vld1.8 {d17}, [%[lhs]:64]!\n" + "vmull.u8 q12, d16, d19\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q13, d16, d20\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q14, d16, d21\n" + "vmull.u8 q15, d17, d18\n" + "vpadal.u16 q0, q11\n" + "vpadal.u16 q1, q12\n" + "vpadal.u16 q2, q13\n" + "vmull.u8 q11, d17, d19\n" + "vmull.u8 q12, d17, d20\n" + "vmull.u8 q13, d17, d21\n" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vpadal.u16 q3, q14\n" + "vpadal.u16 q4, q15\n" + "vpadal.u16 q5, q11\n" + "vpadal.u16 q6, q12\n" + "vpadal.u16 q7, q13\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d16, d17}, [%[lhs]:64]!\n" + "vld1.32 {d18, d19}, [%[rhs]:64]!\n" + "vdup.32 q10, %[multiplicative_offset]\n" + "vdup.32 q11, %[rounding_offset]\n" + "vdup.32 q12, %[shift]\n" + "vdup.32 q13, d16[0]\n" + "vdup.32 q8, d16[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d14, d14, d15\n" + "vpadd.u32 d8, d8, d10\n" + "vpadd.u32 d9, d12, d14\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q13\n" + "vadd.s32 q4, q4, q8\n" + "vadd.s32 q0, q0, q9\n" + "vadd.s32 q4, q4, q9\n" + "vmul.i32 q0, q0, q10\n" + "vmul.i32 q4, q4, q10\n" + "vadd.i32 q0, q0, q11\n" + "vadd.i32 q4, q4, q11\n" + "vshl.s32 q0, q0, q12\n" + "vshl.s32 q4, q4, q12\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d8, q4\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d8, q4\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + "vst1.32 {d8[0]}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", + "d31", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d6, d7, d8}, [%[lhs]:64]!\n" + "vld1.32 {d9}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q5, d9, d6\n" + "vmull.u8 q6, d9, d7\n" + "vmull.u8 q7, d9, d8\n" + "vpadal.u16 q0, q5\n" + "vpadal.u16 q1, q6\n" + "vpadal.u16 q2, q7\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[multiplicative_offset]\n" + "vdup.32 q7, %[rounding_offset]\n" + "vdup.32 q8, %[shift]\n" + "vdup.32 q3, d8[0]\n" + "vdup.32 q9, d8[1]\n" + "vdup.32 q4, d9[0]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + "add r1, r0, %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d0, d0, d0\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d2, d2, d2\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d4, d4, d4\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q3\n" + "vadd.s32 q1, q1, q9\n" + "vadd.s32 q2, q2, q4\n" + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q1, q1, q5\n" + "vadd.s32 q2, q2, q5\n" + "vmul.i32 q0, q0, q6\n" + "vmul.i32 q1, q1, q6\n" + "vmul.i32 q2, q2, q6\n" + "vadd.i32 q0, q0, q7\n" + "vadd.i32 q1, q1, q7\n" + "vadd.i32 q2, q2, q7\n" + "vshl.s32 q0, q0, q8\n" + "vshl.s32 q1, q1, q8\n" + "vshl.s32 q2, q2, q8\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d2, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d2, q1\n" + "vqmovun.s16 d4, q2\n" + + // RowMajorOutput::Output + "vst1.8 {d0[0]}, [%[result]]!\n" + "vst1.8 {d2[0]}, [r0]!\n" + "vst1.8 {d4[0]}, [r1]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d12, d13, d14}, [%[lhs]:64]!\n" + "vld1.32 {d15, d16}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q9, d15, d12\n" + "vmull.u8 q10, d16, d12\n" + "vmull.u8 q11, d15, d13\n" + "vmull.u8 q12, d16, d13\n" + "vmull.u8 q13, d15, d14\n" + "vmull.u8 q14, d16, d14\n" + "vpadal.u16 q0, q9\n" + "vpadal.u16 q1, q10\n" + "vpadal.u16 q2, q11\n" + "vpadal.u16 q3, q12\n" + "vpadal.u16 q4, q13\n" + "vpadal.u16 q5, q14\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15}, [%[rhs]:64]!\n" + "vdup.32 q8, %[multiplicative_offset]\n" + "vdup.32 q9, %[rounding_offset]\n" + "vdup.32 q10, %[shift]\n" + "vdup.32 q11, d12[0]\n" + "vdup.32 q12, d12[1]\n" + "vdup.32 q6, d13[0]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + "add r1, r0, %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d4, d4, d6\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d8, d8, d10\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q11\n" + "vadd.s32 q2, q2, q12\n" + "vadd.s32 q4, q4, q6\n" + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q2, q2, q7\n" + "vadd.s32 q4, q4, q7\n" + "vmul.i32 q0, q0, q8\n" + "vmul.i32 q2, q2, q8\n" + "vmul.i32 q4, q4, q8\n" + "vadd.i32 q0, q0, q9\n" + "vadd.i32 q2, q2, q9\n" + "vadd.i32 q4, q4, q9\n" + "vshl.s32 q0, q0, q10\n" + "vshl.s32 q2, q2, q10\n" + "vshl.s32 q4, q4, q10\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d8, q4\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d4, q2\n" + "vqmovun.s16 d8, q4\n" + + // RowMajorOutput::Output + "vst1.16 {d0[0]}, [%[result]]!\n" + "vst1.16 {d4[0]}, [r0]!\n" + "vst1.16 {d8[0]}, [r1]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + "vmov.i32 q7, q4\n" + "vmov.i32 q8, q5\n" + + // 3x3 lanes loop. + "1:" + + "vld1.8 {d21, d22, d23}, [%[rhs]:64]!\n" + "vld1.8 {d18}, [%[lhs]:64]!\n" + "vmull.u8 q12, d18, d21\n" + "vld1.8 {d19}, [%[lhs]:64]!\n" + "vmull.u8 q13, d18, d22\n" + "vld1.8 {d20}, [%[lhs]:64]!\n" + "vmull.u8 q14, d18, d23\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q15, d19, d21\n" + "pld [%[rhs], #64]\n" + "vpadal.u16 q0, q12\n" + "vpadal.u16 q1, q13\n" + "vpadal.u16 q2, q14\n" + "vpadal.u16 q3, q15\n" + "vmull.u8 q12, d19, d22\n" + "vmull.u8 q13, d19, d23\n" + "vmull.u8 q14, d20, d21\n" + "vmull.u8 q15, d20, d22\n" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vmull.u8 q9, d20, d23\n" + "vpadal.u16 q4, q12\n" + "vpadal.u16 q5, q13\n" + "vpadal.u16 q6, q14\n" + "vpadal.u16 q7, q15\n" + "vpadal.u16 q8, q9\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "vld1.32 {d18, d19}, [%[lhs]:64]!\n" + "vld1.32 {d20, d21}, [%[rhs]:64]!\n" + "vdup.32 q11, %[multiplicative_offset]\n" + "vdup.32 q12, %[rounding_offset]\n" + "vdup.32 q13, %[shift]\n" + "vdup.32 q14, d18[0]\n" + "vdup.32 q15, d18[1]\n" + "vdup.32 q9, d19[0]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + "add r1, r0, %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d4\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d6, d6, d8\n" + "vpadd.u32 d7, d10, d10\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d14, d14, d15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d12, d12, d14\n" + "vpadd.u32 d13, d16, d16\n" + + // StaticQuantization::Transform + "vadd.s32 q0, q0, q14\n" + "vadd.s32 q3, q3, q15\n" + "vadd.s32 q6, q6, q9\n" + "vadd.s32 q0, q0, q10\n" + "vadd.s32 q3, q3, q10\n" + "vadd.s32 q6, q6, q10\n" + "vmul.i32 q0, q0, q11\n" + "vmul.i32 q3, q3, q11\n" + "vmul.i32 q6, q6, q11\n" + "vadd.i32 q0, q0, q12\n" + "vadd.i32 q3, q3, q12\n" + "vadd.i32 q6, q6, q12\n" + "vshl.s32 q0, q0, q13\n" + "vshl.s32 q3, q3, q13\n" + "vshl.s32 q6, q6, q13\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d6, q3\n" + "vqmovn.s32 d12, q6\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d6, q3\n" + "vqmovun.s16 d12, q6\n" + + // RowMajorOutput::Output + "vst1.16 {d0[0]}, [%[result]]!\n" + "vst1.8 {d0[2]}, [%[result]]!\n" + "vst1.16 {d6[0]}, [r0]!\n" + "vst1.8 {d6[2]}, [r0]!\n" + "vst1.16 {d12[0]}, [r1]!\n" + "vst1.8 {d12[2]}, [r1]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "d30", "d31", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d2}, [%[lhs]:64]!\n" + "vld1.32 {d3}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q2, d3, d2\n" + "vpadal.u16 q0, q2\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d0, d0, d0\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "d0", "d1", "d2", "d3", "d4", "d5", "d8", "d9", "d10", "d11", "cc", + "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d4}, [%[lhs]:64]!\n" + "vld1.32 {d5, d6}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q4, d5, d4\n" + "vmull.u8 q5, d6, d4\n" + "vpadal.u16 q0, q4\n" + "vpadal.u16 q1, q5\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d0, d0, d2\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d8", "d9", "d10", "d11", + "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d6}, [%[lhs]:64]!\n" + "vld1.32 {d7, d8, d9}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q5, d7, d6\n" + "vmull.u8 q6, d8, d6\n" + "vmull.u8 q7, d9, d6\n" + "vpadal.u16 q0, q5\n" + "vpadal.u16 q1, q6\n" + "vpadal.u16 q2, q7\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d4\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d1[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 4, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d8}, [%[lhs]:64]!\n" + "vld1.32 {d9, d10, d11, d12}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q7, d9, d8\n" + "vmull.u8 q8, d10, d8\n" + "vmull.u8 q9, d11, d8\n" + "vmull.u8 q10, d12, d8\n" + "vpadal.u16 q0, q7\n" + "vpadal.u16 q1, q8\n" + "vpadal.u16 q2, q9\n" + "vpadal.u16 q3, q10\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d14", "d15", "d16", "d17", "d18", "d19", "d20", "d21", + "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 5, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d10, d11, d12, d13}, [%[rhs]:64]!\n" + "vld1.32 {d14}, [%[lhs]:64]!\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q8, d10, d14\n" + "vmull.u8 q9, d11, d14\n" + "vmull.u8 q10, d12, d14\n" + "vmull.u8 q11, d13, d14\n" + "vld1.32 {d10}, [%[rhs]:64]!\n" + "pld [%[rhs], #128]\n" + "vpadal.u16 q0, q8\n" + "vpadal.u16 q1, q9\n" + "vpadal.u16 q2, q10\n" + "vpadal.u16 q3, q11\n" + "vmull.u8 q8, d10, d14\n" + "vpadal.u16 q4, q8\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d10, d11}, [%[lhs]:64]!\n" + "vld1.32 {d12, d13, d14, d15}, [%[rhs]:64]!\n" + "vdup.32 q5, d10[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d8\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q1, q1, q5\n" + "vadd.s32 q0, q0, q6\n" + "vadd.s32 q1, q1, q7\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1}, [%[result]]!\n" + "vst1.32 {d2[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 6, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d12, d13, d14, d15}, [%[rhs]:64]!\n" + "vld1.32 {d16}, [%[lhs]:64]!\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q9, d12, d16\n" + "vmull.u8 q10, d13, d16\n" + "vmull.u8 q11, d14, d16\n" + "vmull.u8 q12, d15, d16\n" + "vld1.32 {d12, d13}, [%[rhs]:64]!\n" + "pld [%[rhs], #128]\n" + "vpadal.u16 q0, q9\n" + "vpadal.u16 q1, q10\n" + "vpadal.u16 q2, q11\n" + "vpadal.u16 q3, q12\n" + "vmull.u8 q9, d12, d16\n" + "vmull.u8 q10, d13, d16\n" + "vpadal.u16 q4, q9\n" + "vpadal.u16 q5, q10\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15, d16, d17}, [%[rhs]:64]!\n" + "vdup.32 q6, d12[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d10\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q6\n" + "vadd.s32 q1, q1, q6\n" + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q1, q1, q8\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1, d2}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 7, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d14, d15, d16, d17}, [%[rhs]:64]!\n" + "vld1.32 {d18}, [%[lhs]:64]!\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q10, d14, d18\n" + "vmull.u8 q11, d15, d18\n" + "vmull.u8 q12, d16, d18\n" + "vmull.u8 q13, d17, d18\n" + "vld1.32 {d14, d15, d16}, [%[rhs]:64]!\n" + "pld [%[rhs], #128]\n" + "vpadal.u16 q0, q10\n" + "vpadal.u16 q1, q11\n" + "vpadal.u16 q2, q12\n" + "vpadal.u16 q3, q13\n" + "vmull.u8 q10, d14, d18\n" + "vmull.u8 q11, d15, d18\n" + "vmull.u8 q12, d16, d18\n" + "vpadal.u16 q4, q10\n" + "vpadal.u16 q5, q11\n" + "vpadal.u16 q6, q12\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d14, d15}, [%[lhs]:64]!\n" + "vld1.32 {d16, d17, d18, d19}, [%[rhs]:64]!\n" + "vdup.32 q7, d14[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d10\n" + "vpadd.u32 d3, d12, d12\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q1, q1, q7\n" + "vadd.s32 q0, q0, q8\n" + "vadd.s32 q1, q1, q9\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1, d2}, [%[result]]!\n" + "vst1.32 {d3[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 8, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + "vmov.i32 q7, q4\n" + + // 1x8 lanes loop. + "1:" + + "vld1.32 {d17, d18, d19, d20}, [%[rhs]:256]!\n" + "vld1.32 {d16}, [%[lhs]:64]!\n" + "vmull.u8 q11, d16, d17\n" + "vmull.u8 q12, d16, d18\n" + "vmull.u8 q13, d16, d19\n" + "vmull.u8 q14, d16, d20\n" + "vld1.32 {d17, d18, d19, d20}, [%[rhs]:256]!\n" + "vpadal.u16 q0, q11\n" + "vpadal.u16 q1, q12\n" + "vpadal.u16 q2, q13\n" + "vpadal.u16 q3, q14\n" + "pld [%[rhs], #256]\n" + "vmull.u8 q15, d16, d17\n" + "vmull.u8 q11, d16, d18\n" + "vmull.u8 q12, d16, d19\n" + "vmull.u8 q13, d16, d20\n" + "pld [%[lhs], #32]\n" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vpadal.u16 q4, q15\n" + "vpadal.u16 q5, q11\n" + "vpadal.u16 q6, q12\n" + "vpadal.u16 q7, q13\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d16, d17}, [%[lhs]:64]!\n" + "vld1.32 {d18, d19, d20, d21}, [%[rhs]:64]!\n" + "vdup.32 q8, d16[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d14, d14, d15\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d10\n" + "vpadd.u32 d3, d12, d14\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q8\n" + "vadd.s32 q1, q1, q8\n" + "vadd.s32 q0, q0, q9\n" + "vadd.s32 q1, q1, q10\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1, d2, d3}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", + "d31", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 2, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d4, d5}, [%[lhs]:64]!\n" + "vld1.32 {d6}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q4, d6, d4\n" + "vmull.u8 q5, d6, d5\n" + "vpadal.u16 q0, q4\n" + "vpadal.u16 q1, q5\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q2, d8[0]\n" + "vdup.32 q4, d8[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d0, d0, d0\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d2, d2, d2\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q2\n" + "vadd.s32 q1, q1, q4\n" + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q1, q1, q5\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + "vst1.32 {d2[0]}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d8", "d9", "d10", + "d11", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 2, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q6, d10, d8\n" + "vmull.u8 q7, d11, d8\n" + "vmull.u8 q8, d10, d9\n" + "vmull.u8 q9, d11, d9\n" + "vpadal.u16 q0, q6\n" + "vpadal.u16 q1, q7\n" + "vpadal.u16 q2, q8\n" + "vpadal.u16 q3, q9\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, d8[0]\n" + "vdup.32 q4, d8[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d4, d4, d6\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q6\n" + "vadd.s32 q2, q2, q4\n" + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q2, q2, q5\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d4}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 2, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15, d16}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q9, d14, d12\n" + "vmull.u8 q10, d15, d12\n" + "vmull.u8 q11, d16, d12\n" + "vmull.u8 q12, d14, d13\n" + "vmull.u8 q13, d15, d13\n" + "vmull.u8 q14, d16, d13\n" + "vpadal.u16 q0, q9\n" + "vpadal.u16 q1, q10\n" + "vpadal.u16 q2, q11\n" + "vpadal.u16 q3, q12\n" + "vpadal.u16 q4, q13\n" + "vpadal.u16 q5, q14\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15}, [%[rhs]:64]!\n" + "vdup.32 q8, d12[0]\n" + "vdup.32 q6, d12[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d4\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d6, d6, d8\n" + "vpadd.u32 d7, d10, d10\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q8\n" + "vadd.s32 q3, q3, q6\n" + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q3, q3, q7\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d1[0]}, [%[result]]!\n" + "vst1.32 {d6}, [r0]!\n" + "vst1.32 {d7[0]}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "cc", + "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 2, 4, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + "vmov.i32 q7, q4\n" + + // 2x4 lanes loop. + "1:" + + "vld1.8 {d18, d19, d20, d21}, [%[rhs]:256]!\n" + "vld1.8 {d16}, [%[lhs]:64]!\n" + "vmull.u8 q11, d16, d18\n" + "vld1.8 {d17}, [%[lhs]:64]!\n" + "vmull.u8 q12, d16, d19\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q13, d16, d20\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q14, d16, d21\n" + "vmull.u8 q15, d17, d18\n" + "vpadal.u16 q0, q11\n" + "vpadal.u16 q1, q12\n" + "vpadal.u16 q2, q13\n" + "vmull.u8 q11, d17, d19\n" + "vmull.u8 q12, d17, d20\n" + "vmull.u8 q13, d17, d21\n" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vpadal.u16 q3, q14\n" + "vpadal.u16 q4, q15\n" + "vpadal.u16 q5, q11\n" + "vpadal.u16 q6, q12\n" + "vpadal.u16 q7, q13\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d16, d17}, [%[lhs]:64]!\n" + "vld1.32 {d18, d19}, [%[rhs]:64]!\n" + "vdup.32 q10, d16[0]\n" + "vdup.32 q8, d16[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d14, d14, d15\n" + "vpadd.u32 d8, d8, d10\n" + "vpadd.u32 d9, d12, d14\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q10\n" + "vadd.s32 q4, q4, q8\n" + "vadd.s32 q0, q0, q9\n" + "vadd.s32 q4, q4, q9\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1}, [%[result]]!\n" + "vst1.32 {d8, d9}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", + "d31", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 3, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d6, d7, d8}, [%[lhs]:64]!\n" + "vld1.32 {d9}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q5, d9, d6\n" + "vmull.u8 q6, d9, d7\n" + "vmull.u8 q7, d9, d8\n" + "vpadal.u16 q0, q5\n" + "vpadal.u16 q1, q6\n" + "vpadal.u16 q2, q7\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q3, d8[0]\n" + "vdup.32 q6, d8[1]\n" + "vdup.32 q4, d9[0]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + "add r1, r0, %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d0, d0, d0\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d2, d2, d2\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d4, d4, d4\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q3\n" + "vadd.s32 q1, q1, q6\n" + "vadd.s32 q2, q2, q4\n" + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q1, q1, q5\n" + "vadd.s32 q2, q2, q5\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + "vst1.32 {d2[0]}, [r0]!\n" + "vst1.32 {d4[0]}, [r1]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 3, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d12, d13, d14}, [%[lhs]:64]!\n" + "vld1.32 {d15, d16}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q9, d15, d12\n" + "vmull.u8 q10, d16, d12\n" + "vmull.u8 q11, d15, d13\n" + "vmull.u8 q12, d16, d13\n" + "vmull.u8 q13, d15, d14\n" + "vmull.u8 q14, d16, d14\n" + "vpadal.u16 q0, q9\n" + "vpadal.u16 q1, q10\n" + "vpadal.u16 q2, q11\n" + "vpadal.u16 q3, q12\n" + "vpadal.u16 q4, q13\n" + "vpadal.u16 q5, q14\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15}, [%[rhs]:64]!\n" + "vdup.32 q8, d12[0]\n" + "vdup.32 q9, d12[1]\n" + "vdup.32 q6, d13[0]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + "add r1, r0, %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d4, d4, d6\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d8, d8, d10\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q8\n" + "vadd.s32 q2, q2, q9\n" + "vadd.s32 q4, q4, q6\n" + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q2, q2, q7\n" + "vadd.s32 q4, q4, q7\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d4}, [r0]!\n" + "vst1.32 {d8}, [r1]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 3, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + "vmov.i32 q7, q4\n" + "vmov.i32 q8, q5\n" + + // 3x3 lanes loop. + "1:" + + "vld1.8 {d21, d22, d23}, [%[rhs]:64]!\n" + "vld1.8 {d18}, [%[lhs]:64]!\n" + "vmull.u8 q12, d18, d21\n" + "vld1.8 {d19}, [%[lhs]:64]!\n" + "vmull.u8 q13, d18, d22\n" + "vld1.8 {d20}, [%[lhs]:64]!\n" + "vmull.u8 q14, d18, d23\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q15, d19, d21\n" + "pld [%[rhs], #64]\n" + "vpadal.u16 q0, q12\n" + "vpadal.u16 q1, q13\n" + "vpadal.u16 q2, q14\n" + "vpadal.u16 q3, q15\n" + "vmull.u8 q12, d19, d22\n" + "vmull.u8 q13, d19, d23\n" + "vmull.u8 q14, d20, d21\n" + "vmull.u8 q15, d20, d22\n" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vmull.u8 q9, d20, d23\n" + "vpadal.u16 q4, q12\n" + "vpadal.u16 q5, q13\n" + "vpadal.u16 q6, q14\n" + "vpadal.u16 q7, q15\n" + "vpadal.u16 q8, q9\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "vld1.32 {d18, d19}, [%[lhs]:64]!\n" + "vld1.32 {d20, d21}, [%[rhs]:64]!\n" + "vdup.32 q11, d18[0]\n" + "vdup.32 q12, d18[1]\n" + "vdup.32 q9, d19[0]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + "add r1, r0, %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d4\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d6, d6, d8\n" + "vpadd.u32 d7, d10, d10\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d14, d14, d15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d12, d12, d14\n" + "vpadd.u32 d13, d16, d16\n" + + // StaticQuantizationInt32::Transform + "vadd.s32 q0, q0, q11\n" + "vadd.s32 q3, q3, q12\n" + "vadd.s32 q6, q6, q9\n" + "vadd.s32 q0, q0, q10\n" + "vadd.s32 q3, q3, q10\n" + "vadd.s32 q6, q6, q10\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d1[0]}, [%[result]]!\n" + "vst1.32 {d6}, [r0]!\n" + "vst1.32 {d7[0]}, [r0]!\n" + "vst1.32 {d12}, [r1]!\n" + "vst1.32 {d13[0]}, [r1]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "d30", "d31", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d2}, [%[lhs]:64]!\n" + "vld1.32 {d3}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q2, d3, d2\n" + "vpadal.u16 q0, q2\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[scale]\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d0, d0, d0\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + "vcvt.f32.s32 q0, q0\n" + "vmul.f32 q0, q0, q6\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d8", "d9", "d10", "d11", "d12", + "d13", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d4}, [%[lhs]:64]!\n" + "vld1.32 {d5, d6}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q4, d5, d4\n" + "vmull.u8 q5, d6, d4\n" + "vpadal.u16 q0, q4\n" + "vpadal.u16 q1, q5\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[scale]\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d0, d0, d2\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + "vcvt.f32.s32 q0, q0\n" + "vmul.f32 q0, q0, q6\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d8", "d9", "d10", "d11", + "d12", "d13", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d6}, [%[lhs]:64]!\n" + "vld1.32 {d7, d8, d9}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q5, d7, d6\n" + "vmull.u8 q6, d8, d6\n" + "vmull.u8 q7, d9, d6\n" + "vpadal.u16 q0, q5\n" + "vpadal.u16 q1, q6\n" + "vpadal.u16 q2, q7\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[scale]\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d4\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + "vcvt.f32.s32 q0, q0\n" + "vmul.f32 q0, q0, q6\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d1[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 4, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d8}, [%[lhs]:64]!\n" + "vld1.32 {d9, d10, d11, d12}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q7, d9, d8\n" + "vmull.u8 q8, d10, d8\n" + "vmull.u8 q9, d11, d8\n" + "vmull.u8 q10, d12, d8\n" + "vpadal.u16 q0, q7\n" + "vpadal.u16 q1, q8\n" + "vpadal.u16 q2, q9\n" + "vpadal.u16 q3, q10\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[scale]\n" + "vdup.32 q4, d8[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q4\n" + "vadd.s32 q0, q0, q5\n" + "vcvt.f32.s32 q0, q0\n" + "vmul.f32 q0, q0, q6\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 5, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d10, d11, d12, d13}, [%[rhs]:64]!\n" + "vld1.32 {d14}, [%[lhs]:64]!\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q8, d10, d14\n" + "vmull.u8 q9, d11, d14\n" + "vmull.u8 q10, d12, d14\n" + "vmull.u8 q11, d13, d14\n" + "vld1.32 {d10}, [%[rhs]:64]!\n" + "pld [%[rhs], #128]\n" + "vpadal.u16 q0, q8\n" + "vpadal.u16 q1, q9\n" + "vpadal.u16 q2, q10\n" + "vpadal.u16 q3, q11\n" + "vmull.u8 q8, d10, d14\n" + "vpadal.u16 q4, q8\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d10, d11}, [%[lhs]:64]!\n" + "vld1.32 {d12, d13, d14, d15}, [%[rhs]:64]!\n" + "vdup.32 q8, %[scale]\n" + "vdup.32 q5, d10[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d8\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q1, q1, q5\n" + "vadd.s32 q0, q0, q6\n" + "vadd.s32 q1, q1, q7\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1}, [%[result]]!\n" + "vst1.32 {d2[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 6, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d12, d13, d14, d15}, [%[rhs]:64]!\n" + "vld1.32 {d16}, [%[lhs]:64]!\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q9, d12, d16\n" + "vmull.u8 q10, d13, d16\n" + "vmull.u8 q11, d14, d16\n" + "vmull.u8 q12, d15, d16\n" + "vld1.32 {d12, d13}, [%[rhs]:64]!\n" + "pld [%[rhs], #128]\n" + "vpadal.u16 q0, q9\n" + "vpadal.u16 q1, q10\n" + "vpadal.u16 q2, q11\n" + "vpadal.u16 q3, q12\n" + "vmull.u8 q9, d12, d16\n" + "vmull.u8 q10, d13, d16\n" + "vpadal.u16 q4, q9\n" + "vpadal.u16 q5, q10\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15, d16, d17}, [%[rhs]:64]!\n" + "vdup.32 q9, %[scale]\n" + "vdup.32 q6, d12[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d10\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q6\n" + "vadd.s32 q1, q1, q6\n" + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q1, q1, q8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1, d2}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 7, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d14, d15, d16, d17}, [%[rhs]:64]!\n" + "vld1.32 {d18}, [%[lhs]:64]!\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q10, d14, d18\n" + "vmull.u8 q11, d15, d18\n" + "vmull.u8 q12, d16, d18\n" + "vmull.u8 q13, d17, d18\n" + "vld1.32 {d14, d15, d16}, [%[rhs]:64]!\n" + "pld [%[rhs], #128]\n" + "vpadal.u16 q0, q10\n" + "vpadal.u16 q1, q11\n" + "vpadal.u16 q2, q12\n" + "vpadal.u16 q3, q13\n" + "vmull.u8 q10, d14, d18\n" + "vmull.u8 q11, d15, d18\n" + "vmull.u8 q12, d16, d18\n" + "vpadal.u16 q4, q10\n" + "vpadal.u16 q5, q11\n" + "vpadal.u16 q6, q12\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d14, d15}, [%[lhs]:64]!\n" + "vld1.32 {d16, d17, d18, d19}, [%[rhs]:64]!\n" + "vdup.32 q10, %[scale]\n" + "vdup.32 q7, d14[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d10\n" + "vpadd.u32 d3, d12, d12\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q1, q1, q7\n" + "vadd.s32 q0, q0, q8\n" + "vadd.s32 q1, q1, q9\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vmul.f32 q0, q0, q10\n" + "vmul.f32 q1, q1, q10\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1, d2}, [%[result]]!\n" + "vst1.32 {d3[0]}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 8, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + "vmov.i32 q7, q4\n" + + // 1x8 lanes loop. + "1:" + + "vld1.32 {d17, d18, d19, d20}, [%[rhs]:256]!\n" + "vld1.32 {d16}, [%[lhs]:64]!\n" + "vmull.u8 q11, d16, d17\n" + "vmull.u8 q12, d16, d18\n" + "vmull.u8 q13, d16, d19\n" + "vmull.u8 q14, d16, d20\n" + "vld1.32 {d17, d18, d19, d20}, [%[rhs]:256]!\n" + "vpadal.u16 q0, q11\n" + "vpadal.u16 q1, q12\n" + "vpadal.u16 q2, q13\n" + "vpadal.u16 q3, q14\n" + "pld [%[rhs], #256]\n" + "vmull.u8 q15, d16, d17\n" + "vmull.u8 q11, d16, d18\n" + "vmull.u8 q12, d16, d19\n" + "vmull.u8 q13, d16, d20\n" + "pld [%[lhs], #32]\n" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vpadal.u16 q4, q15\n" + "vpadal.u16 q5, q11\n" + "vpadal.u16 q6, q12\n" + "vpadal.u16 q7, q13\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d16, d17}, [%[lhs]:64]!\n" + "vld1.32 {d18, d19, d20, d21}, [%[rhs]:64]!\n" + "vdup.32 q11, %[scale]\n" + "vdup.32 q8, d16[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d14, d14, d15\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d2, d8, d10\n" + "vpadd.u32 d3, d12, d14\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q8\n" + "vadd.s32 q1, q1, q8\n" + "vadd.s32 q0, q0, q9\n" + "vadd.s32 q1, q1, q10\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vmul.f32 q0, q0, q11\n" + "vmul.f32 q1, q1, q11\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1, d2, d3}, [%[result]]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", + "d31", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 2, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d4, d5}, [%[lhs]:64]!\n" + "vld1.32 {d6}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q4, d6, d4\n" + "vmull.u8 q5, d6, d5\n" + "vpadal.u16 q0, q4\n" + "vpadal.u16 q1, q5\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[scale]\n" + "vdup.32 q2, d8[0]\n" + "vdup.32 q4, d8[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d0, d0, d0\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d2, d2, d2\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q2\n" + "vadd.s32 q1, q1, q4\n" + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q1, q1, q5\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + "vst1.32 {d2[0]}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 2, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q6, d10, d8\n" + "vmull.u8 q7, d11, d8\n" + "vmull.u8 q8, d10, d9\n" + "vmull.u8 q9, d11, d9\n" + "vpadal.u16 q0, q6\n" + "vpadal.u16 q1, q7\n" + "vpadal.u16 q2, q8\n" + "vpadal.u16 q3, q9\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[scale]\n" + "vdup.32 q7, d8[0]\n" + "vdup.32 q4, d8[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d4, d4, d6\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q2, q2, q4\n" + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q2, q2, q5\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q2, q2\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q2, q2, q6\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d4}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 2, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15, d16}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q9, d14, d12\n" + "vmull.u8 q10, d15, d12\n" + "vmull.u8 q11, d16, d12\n" + "vmull.u8 q12, d14, d13\n" + "vmull.u8 q13, d15, d13\n" + "vmull.u8 q14, d16, d13\n" + "vpadal.u16 q0, q9\n" + "vpadal.u16 q1, q10\n" + "vpadal.u16 q2, q11\n" + "vpadal.u16 q3, q12\n" + "vpadal.u16 q4, q13\n" + "vpadal.u16 q5, q14\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15}, [%[rhs]:64]!\n" + "vdup.32 q8, %[scale]\n" + "vdup.32 q9, d12[0]\n" + "vdup.32 q6, d12[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d4\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d6, d6, d8\n" + "vpadd.u32 d7, d10, d10\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q9\n" + "vadd.s32 q3, q3, q6\n" + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q3, q3, q7\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q3, q3\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q3, q3, q8\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d1[0]}, [%[result]]!\n" + "vst1.32 {d6}, [r0]!\n" + "vst1.32 {d7[0]}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "cc", + "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 2, 4, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + "vmov.i32 q7, q4\n" + + // 2x4 lanes loop. + "1:" + + "vld1.8 {d18, d19, d20, d21}, [%[rhs]:256]!\n" + "vld1.8 {d16}, [%[lhs]:64]!\n" + "vmull.u8 q11, d16, d18\n" + "vld1.8 {d17}, [%[lhs]:64]!\n" + "vmull.u8 q12, d16, d19\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q13, d16, d20\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q14, d16, d21\n" + "vmull.u8 q15, d17, d18\n" + "vpadal.u16 q0, q11\n" + "vpadal.u16 q1, q12\n" + "vpadal.u16 q2, q13\n" + "vmull.u8 q11, d17, d19\n" + "vmull.u8 q12, d17, d20\n" + "vmull.u8 q13, d17, d21\n" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vpadal.u16 q3, q14\n" + "vpadal.u16 q4, q15\n" + "vpadal.u16 q5, q11\n" + "vpadal.u16 q6, q12\n" + "vpadal.u16 q7, q13\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d16, d17}, [%[lhs]:64]!\n" + "vld1.32 {d18, d19}, [%[rhs]:64]!\n" + "vdup.32 q10, %[scale]\n" + "vdup.32 q11, d16[0]\n" + "vdup.32 q8, d16[1]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d6\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d14, d14, d15\n" + "vpadd.u32 d8, d8, d10\n" + "vpadd.u32 d9, d12, d14\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q11\n" + "vadd.s32 q4, q4, q8\n" + "vadd.s32 q0, q0, q9\n" + "vadd.s32 q4, q4, q9\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q4, q4\n" + "vmul.f32 q0, q0, q10\n" + "vmul.f32 q4, q4, q10\n" + + // RowMajorOutput::Output + "vst1.32 {d0, d1}, [%[result]]!\n" + "vst1.32 {d8, d9}, [r0]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "r0", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", + "d31", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 3, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d6, d7, d8}, [%[lhs]:64]!\n" + "vld1.32 {d9}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q5, d9, d6\n" + "vmull.u8 q6, d9, d7\n" + "vmull.u8 q7, d9, d8\n" + "vpadal.u16 q0, q5\n" + "vpadal.u16 q1, q6\n" + "vpadal.u16 q2, q7\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d8, d9}, [%[lhs]:64]!\n" + "vld1.32 {d10, d11}, [%[rhs]:64]!\n" + "vdup.32 q6, %[scale]\n" + "vdup.32 q3, d8[0]\n" + "vdup.32 q7, d8[1]\n" + "vdup.32 q4, d9[0]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + "add r1, r0, %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d0, d0, d0\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d2, d2, d2\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d4, d4, d4\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q3\n" + "vadd.s32 q1, q1, q7\n" + "vadd.s32 q2, q2, q4\n" + "vadd.s32 q0, q0, q5\n" + "vadd.s32 q1, q1, q5\n" + "vadd.s32 q2, q2, q5\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + + // RowMajorOutput::Output + "vst1.32 {d0[0]}, [%[result]]!\n" + "vst1.32 {d2[0]}, [r0]!\n" + "vst1.32 {d4[0]}, [r1]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 3, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vld1.32 {d12, d13, d14}, [%[lhs]:64]!\n" + "vld1.32 {d15, d16}, [%[rhs]:64]!\n" + "pld [%[lhs], #64]\n" + "pld [%[rhs], #64]\n" + "vmull.u8 q9, d15, d12\n" + "vmull.u8 q10, d16, d12\n" + "vmull.u8 q11, d15, d13\n" + "vmull.u8 q12, d16, d13\n" + "vmull.u8 q13, d15, d14\n" + "vmull.u8 q14, d16, d14\n" + "vpadal.u16 q0, q9\n" + "vpadal.u16 q1, q10\n" + "vpadal.u16 q2, q11\n" + "vpadal.u16 q3, q12\n" + "vpadal.u16 q4, q13\n" + "vpadal.u16 q5, q14\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d12, d13}, [%[lhs]:64]!\n" + "vld1.32 {d14, d15}, [%[rhs]:64]!\n" + "vdup.32 q8, %[scale]\n" + "vdup.32 q9, d12[0]\n" + "vdup.32 q10, d12[1]\n" + "vdup.32 q6, d13[0]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + "add r1, r0, %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d4, d4, d6\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d8, d8, d10\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q9\n" + "vadd.s32 q2, q2, q10\n" + "vadd.s32 q4, q4, q6\n" + "vadd.s32 q0, q0, q7\n" + "vadd.s32 q2, q2, q7\n" + "vadd.s32 q4, q4, q7\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q4, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q4, q4, q8\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d4}, [r0]!\n" + "vst1.32 {d8}, [r1]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 3, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "pld [%[lhs]]\n" + "pld [%[rhs]]\n" + + // Clear aggregators. + "vmov.i32 q0, #0\n" + "vmov.i32 q1, #0\n" + "vmov.i32 q2, #0\n" + "vmov.i32 q3, q0\n" + "vmov.i32 q4, q1\n" + "vmov.i32 q5, q2\n" + "vmov.i32 q6, q3\n" + "vmov.i32 q7, q4\n" + "vmov.i32 q8, q5\n" + + // 3x3 lanes loop. + "1:" + + "vld1.8 {d21, d22, d23}, [%[rhs]:64]!\n" + "vld1.8 {d18}, [%[lhs]:64]!\n" + "vmull.u8 q12, d18, d21\n" + "vld1.8 {d19}, [%[lhs]:64]!\n" + "vmull.u8 q13, d18, d22\n" + "vld1.8 {d20}, [%[lhs]:64]!\n" + "vmull.u8 q14, d18, d23\n" + "pld [%[lhs], #64]\n" + "vmull.u8 q15, d19, d21\n" + "pld [%[rhs], #64]\n" + "vpadal.u16 q0, q12\n" + "vpadal.u16 q1, q13\n" + "vpadal.u16 q2, q14\n" + "vpadal.u16 q3, q15\n" + "vmull.u8 q12, d19, d22\n" + "vmull.u8 q13, d19, d23\n" + "vmull.u8 q14, d20, d21\n" + "vmull.u8 q15, d20, d22\n" + + // Subtract counter. + "subs %[count], %[count], #8\n" + + "vmull.u8 q9, d20, d23\n" + "vpadal.u16 q4, q12\n" + "vpadal.u16 q5, q13\n" + "vpadal.u16 q6, q14\n" + "vpadal.u16 q7, q15\n" + "vpadal.u16 q8, q9\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "vld1.32 {d18, d19}, [%[lhs]:64]!\n" + "vld1.32 {d20, d21}, [%[rhs]:64]!\n" + "vdup.32 q11, %[scale]\n" + "vdup.32 q12, d18[0]\n" + "vdup.32 q13, d18[1]\n" + "vdup.32 q9, d19[0]\n" + + // RowMajorOutput::Prepare + "add r0, %[result], %[stride]\n" + "add r1, r0, %[stride]\n" + + // Reduce aggregators. + "vpadd.u32 d0, d0, d1\n" + "vpadd.u32 d2, d2, d3\n" + "vpadd.u32 d4, d4, d5\n" + "vpadd.u32 d0, d0, d2\n" + "vpadd.u32 d1, d4, d4\n" + "vpadd.u32 d6, d6, d7\n" + "vpadd.u32 d8, d8, d9\n" + "vpadd.u32 d10, d10, d11\n" + "vpadd.u32 d6, d6, d8\n" + "vpadd.u32 d7, d10, d10\n" + "vpadd.u32 d12, d12, d13\n" + "vpadd.u32 d14, d14, d15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d12, d12, d14\n" + "vpadd.u32 d13, d16, d16\n" + + // StaticQuantizationFloat::Transform + "vadd.s32 q0, q0, q12\n" + "vadd.s32 q3, q3, q13\n" + "vadd.s32 q6, q6, q9\n" + "vadd.s32 q0, q0, q10\n" + "vadd.s32 q3, q3, q10\n" + "vadd.s32 q6, q6, q10\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q6, q6\n" + "vmul.f32 q0, q0, q11\n" + "vmul.f32 q3, q3, q11\n" + "vmul.f32 q6, q6, q11\n" + + // RowMajorOutput::Output + "vst1.32 {d0}, [%[result]]!\n" + "vst1.32 {d1[0]}, [%[result]]!\n" + "vst1.32 {d6}, [r0]!\n" + "vst1.32 {d7[0]}, [r0]!\n" + "vst1.32 {d12}, [r1]!\n" + "vst1.32 {d13[0]}, [r1]!\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "d30", "d31", "cc", "memory"); +} + +} // namespace meta +} // namespace gemmlowp + +#else +#warning "Meta gemm for arm32 requires: GEMMLOWP_NEON_32!" +#endif + +#endif // GEMMLOWP_META_QUANTIZED_MUL_KERNELS_ARM_32_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/quantized_mul_kernels_arm_64.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/quantized_mul_kernels_arm_64.h new file mode 100644 index 0000000000000000000000000000000000000000..abda496dfb132c6c53cd5ce8ec83da40e46a46d0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/quantized_mul_kernels_arm_64.h @@ -0,0 +1,4106 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_QUANTIZED_MUL_KERNELS_ARM_64_H_ +#define GEMMLOWP_META_QUANTIZED_MUL_KERNELS_ARM_64_H_ + +#ifdef GEMMLOWP_NEON_64 + +#include +#include + +namespace gemmlowp { +namespace meta { + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v1.2s}, [%x[lhs]], #8\n" + "ld1 {v2.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v3.8h, v2.8b, v1.8b\n" + "uadalp v0.4s, v3.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[multiplicative_offset]\n" + "dup v7.4s, %w[rounding_offset]\n" + "dup v8.4s, %w[shift]\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v0.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "mul v0.4s, v0.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "sshl v0.4s, v0.4s, v8.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + // RowMajorOutput::Output + "st1 {v0.b}[0], [%x[result]], #1\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v2.2s}, [%x[lhs]], #8\n" + "ld1 {v3.2s, v4.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v5.8h, v3.8b, v2.8b\n" + "umull v6.8h, v4.8b, v2.8b\n" + "uadalp v0.4s, v5.8h\n" + "uadalp v1.4s, v6.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[multiplicative_offset]\n" + "dup v7.4s, %w[rounding_offset]\n" + "dup v8.4s, %w[shift]\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "mul v0.4s, v0.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "sshl v0.4s, v0.4s, v8.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + // RowMajorOutput::Output + "st1 {v0.h}[0], [%x[result]], #2\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v3.2s}, [%x[lhs]], #8\n" + "ld1 {v4.2s, v5.2s, v6.2s}, [%x[rhs]], #24\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v7.8h, v4.8b, v3.8b\n" + "umull v8.8h, v5.8b, v3.8b\n" + "umull v9.8h, v6.8b, v3.8b\n" + "uadalp v0.4s, v7.8h\n" + "uadalp v1.4s, v8.8h\n" + "uadalp v2.4s, v9.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[multiplicative_offset]\n" + "dup v7.4s, %w[rounding_offset]\n" + "dup v8.4s, %w[shift]\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "mul v0.4s, v0.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "sshl v0.4s, v0.4s, v8.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + // RowMajorOutput::Output + "st1 {v0.h}[0], [%x[result]], #2\n" + "st1 {v0.b}[2], [%x[result]], #1\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", + "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v4.2s}, [%x[lhs]], #8\n" + "ld1 {v5.2s, v6.2s, v7.2s, v8.2s}, [%x[rhs]], #32\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v9.8h, v5.8b, v4.8b\n" + "umull v10.8h, v6.8b, v4.8b\n" + "umull v11.8h, v7.8b, v4.8b\n" + "umull v12.8h, v8.8b, v4.8b\n" + "uadalp v0.4s, v9.8h\n" + "uadalp v1.4s, v10.8h\n" + "uadalp v2.4s, v11.8h\n" + "uadalp v3.4s, v12.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[multiplicative_offset]\n" + "dup v7.4s, %w[rounding_offset]\n" + "dup v8.4s, %w[shift]\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "mul v0.4s, v0.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "sshl v0.4s, v0.4s, v8.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v5.2s, v6.2s, v7.2s, v8.2s}, [%x[rhs]], #32\n" + "ld1 {v9.2s}, [%x[lhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v10.8h, v5.8b, v9.8b\n" + "umull v11.8h, v6.8b, v9.8b\n" + "umull v12.8h, v7.8b, v9.8b\n" + "umull v13.8h, v8.8b, v9.8b\n" + "ld1 {v5.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[rhs], #128]\n" + "uadalp v0.4s, v10.8h\n" + "uadalp v1.4s, v11.8h\n" + "uadalp v2.4s, v12.8h\n" + "uadalp v3.4s, v13.8h\n" + "umull v10.8h, v5.8b, v9.8b\n" + "uadalp v4.4s, v10.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v5.4s}, [%x[lhs]], #16\n" + "ld1 {v6.4s, v7.4s}, [%x[rhs]], #32\n" + "dup v8.4s, %w[multiplicative_offset]\n" + "dup v9.4s, %w[rounding_offset]\n" + "dup v10.4s, %w[shift]\n" + "dup v5.4s, v5.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v4.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v4.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v5.4s\n" + "add v1.4s, v1.4s, v5.4s\n" + "add v0.4s, v0.4s, v6.4s\n" + "add v1.4s, v1.4s, v7.4s\n" + "mul v0.4s, v0.4s, v8.4s\n" + "mul v1.4s, v1.4s, v8.4s\n" + "add v0.4s, v0.4s, v9.4s\n" + "add v1.4s, v1.4s, v9.4s\n" + "sshl v0.4s, v0.4s, v10.4s\n" + "sshl v1.4s, v1.4s, v10.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + "st1 {v0.b}[4], [%x[result]], #1\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v6.2s, v7.2s, v8.2s, v9.2s}, [%x[rhs]], #32\n" + "ld1 {v10.2s}, [%x[lhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v11.8h, v6.8b, v10.8b\n" + "umull v12.8h, v7.8b, v10.8b\n" + "umull v13.8h, v8.8b, v10.8b\n" + "umull v14.8h, v9.8b, v10.8b\n" + "ld1 {v6.2s, v7.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[rhs], #128]\n" + "uadalp v0.4s, v11.8h\n" + "uadalp v1.4s, v12.8h\n" + "uadalp v2.4s, v13.8h\n" + "uadalp v3.4s, v14.8h\n" + "umull v11.8h, v6.8b, v10.8b\n" + "umull v12.8h, v7.8b, v10.8b\n" + "uadalp v4.4s, v11.8h\n" + "uadalp v5.4s, v12.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v6.4s}, [%x[lhs]], #16\n" + "ld1 {v7.4s, v8.4s}, [%x[rhs]], #32\n" + "dup v9.4s, %w[multiplicative_offset]\n" + "dup v10.4s, %w[rounding_offset]\n" + "dup v11.4s, %w[shift]\n" + "dup v6.4s, v6.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v4.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v6.4s\n" + "add v1.4s, v1.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v1.4s, v1.4s, v8.4s\n" + "mul v0.4s, v0.4s, v9.4s\n" + "mul v1.4s, v1.4s, v9.4s\n" + "add v0.4s, v0.4s, v10.4s\n" + "add v1.4s, v1.4s, v10.4s\n" + "sshl v0.4s, v0.4s, v11.4s\n" + "sshl v1.4s, v1.4s, v11.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + "st1 {v0.h}[2], [%x[result]], #2\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v7.2s, v8.2s, v9.2s, v10.2s}, [%x[rhs]], #32\n" + "ld1 {v11.2s}, [%x[lhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v12.8h, v7.8b, v11.8b\n" + "umull v13.8h, v8.8b, v11.8b\n" + "umull v14.8h, v9.8b, v11.8b\n" + "umull v15.8h, v10.8b, v11.8b\n" + "ld1 {v7.2s, v8.2s, v9.2s}, [%x[rhs]], #24\n" + "prfm pldl1keep, [%x[rhs], #128]\n" + "uadalp v0.4s, v12.8h\n" + "uadalp v1.4s, v13.8h\n" + "uadalp v2.4s, v14.8h\n" + "uadalp v3.4s, v15.8h\n" + "umull v12.8h, v7.8b, v11.8b\n" + "umull v13.8h, v8.8b, v11.8b\n" + "umull v14.8h, v9.8b, v11.8b\n" + "uadalp v4.4s, v12.8h\n" + "uadalp v5.4s, v13.8h\n" + "uadalp v6.4s, v14.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v7.4s}, [%x[lhs]], #16\n" + "ld1 {v8.4s, v9.4s}, [%x[rhs]], #32\n" + "dup v10.4s, %w[multiplicative_offset]\n" + "dup v11.4s, %w[rounding_offset]\n" + "dup v12.4s, %w[shift]\n" + "dup v7.4s, v7.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v6.4s, v6.4s, v6.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v6.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v7.4s\n" + "add v1.4s, v1.4s, v7.4s\n" + "add v0.4s, v0.4s, v8.4s\n" + "add v1.4s, v1.4s, v9.4s\n" + "mul v0.4s, v0.4s, v10.4s\n" + "mul v1.4s, v1.4s, v10.4s\n" + "add v0.4s, v0.4s, v11.4s\n" + "add v1.4s, v1.4s, v11.4s\n" + "sshl v0.4s, v0.4s, v12.4s\n" + "sshl v1.4s, v1.4s, v12.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + "st1 {v0.h}[2], [%x[result]], #2\n" + "st1 {v0.b}[6], [%x[result]], #1\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + "mov v7.16b, v4.16b\n" + + // 1x8 lanes loop. + "1:" + + "ld1 {v9.2s, v10.2s, v11.2s, v12.2s}, [%x[rhs]], #32\n" + "ld1 {v8.2s}, [%x[lhs]], #8\n" + "umull v13.8h, v8.8b, v9.8b\n" + "umull v14.8h, v8.8b, v10.8b\n" + "umull v15.8h, v8.8b, v11.8b\n" + "umull v16.8h, v8.8b, v12.8b\n" + "ld1 {v9.2s, v10.2s, v11.2s, v12.2s}, [%x[rhs]], #32\n" + "uadalp v0.4s, v13.8h\n" + "uadalp v1.4s, v14.8h\n" + "uadalp v2.4s, v15.8h\n" + "uadalp v3.4s, v16.8h\n" + "prfm pldl1keep, [%x[rhs], #256]\n" + "umull v17.8h, v8.8b, v9.8b\n" + "umull v13.8h, v8.8b, v10.8b\n" + "umull v14.8h, v8.8b, v11.8b\n" + "umull v15.8h, v8.8b, v12.8b\n" + "prfm pldl1keep, [%x[lhs], #32]\n" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "uadalp v4.4s, v17.8h\n" + "uadalp v5.4s, v13.8h\n" + "uadalp v6.4s, v14.8h\n" + "uadalp v7.4s, v15.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v8.4s}, [%x[lhs]], #16\n" + "ld1 {v9.4s, v10.4s}, [%x[rhs]], #32\n" + "dup v11.4s, %w[multiplicative_offset]\n" + "dup v12.4s, %w[rounding_offset]\n" + "dup v13.4s, %w[shift]\n" + "dup v8.4s, v8.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v6.4s, v6.4s, v7.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v6.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v8.4s\n" + "add v1.4s, v1.4s, v8.4s\n" + "add v0.4s, v0.4s, v9.4s\n" + "add v1.4s, v1.4s, v10.4s\n" + "mul v0.4s, v0.4s, v11.4s\n" + "mul v1.4s, v1.4s, v11.4s\n" + "add v0.4s, v0.4s, v12.4s\n" + "add v1.4s, v1.4s, v12.4s\n" + "sshl v0.4s, v0.4s, v13.4s\n" + "sshl v1.4s, v1.4s, v13.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v2.2s, v3.2s}, [%x[lhs]], #16\n" + "ld1 {v4.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v5.8h, v4.8b, v2.8b\n" + "umull v6.8h, v4.8b, v3.8b\n" + "uadalp v0.4s, v5.8h\n" + "uadalp v1.4s, v6.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[multiplicative_offset]\n" + "dup v7.4s, %w[rounding_offset]\n" + "dup v8.4s, %w[shift]\n" + "dup v2.4s, v4.s[0]\n" + "dup v4.4s, v4.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v0.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v2.4s\n" + "add v1.4s, v1.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "add v1.4s, v1.4s, v5.4s\n" + "mul v0.4s, v0.4s, v6.4s\n" + "mul v1.4s, v1.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v1.4s, v1.4s, v7.4s\n" + "sshl v0.4s, v0.4s, v8.4s\n" + "sshl v1.4s, v1.4s, v8.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn v1.4h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun v1.8b, v1.8h\n" + + // RowMajorOutput::Output + "st1 {v0.b}[0], [%x[result]], #1\n" + "st1 {v1.b}[0], [x0], #1\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "cc", + "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v4.2s, v5.2s}, [%x[lhs]], #16\n" + "ld1 {v6.2s, v7.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v8.8h, v6.8b, v4.8b\n" + "umull v9.8h, v7.8b, v4.8b\n" + "umull v10.8h, v6.8b, v5.8b\n" + "umull v11.8h, v7.8b, v5.8b\n" + "uadalp v0.4s, v8.8h\n" + "uadalp v1.4s, v9.8h\n" + "uadalp v2.4s, v10.8h\n" + "uadalp v3.4s, v11.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[multiplicative_offset]\n" + "dup v7.4s, %w[rounding_offset]\n" + "dup v8.4s, %w[shift]\n" + "dup v9.4s, v4.s[0]\n" + "dup v4.4s, v4.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v9.4s\n" + "add v2.4s, v2.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "add v2.4s, v2.4s, v5.4s\n" + "mul v0.4s, v0.4s, v6.4s\n" + "mul v2.4s, v2.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v2.4s, v2.4s, v7.4s\n" + "sshl v0.4s, v0.4s, v8.4s\n" + "sshl v2.4s, v2.4s, v8.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun v2.8b, v2.8h\n" + + // RowMajorOutput::Output + "st1 {v0.h}[0], [%x[result]], #2\n" + "st1 {v2.h}[0], [x0], #2\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v6.2s, v7.2s}, [%x[lhs]], #16\n" + "ld1 {v8.2s, v9.2s, v10.2s}, [%x[rhs]], #24\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v11.8h, v8.8b, v6.8b\n" + "umull v12.8h, v9.8b, v6.8b\n" + "umull v13.8h, v10.8b, v6.8b\n" + "umull v14.8h, v8.8b, v7.8b\n" + "umull v15.8h, v9.8b, v7.8b\n" + "umull v16.8h, v10.8b, v7.8b\n" + "uadalp v0.4s, v11.8h\n" + "uadalp v1.4s, v12.8h\n" + "uadalp v2.4s, v13.8h\n" + "uadalp v3.4s, v14.8h\n" + "uadalp v4.4s, v15.8h\n" + "uadalp v5.4s, v16.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v6.4s}, [%x[lhs]], #16\n" + "ld1 {v7.4s}, [%x[rhs]], #16\n" + "dup v8.4s, %w[multiplicative_offset]\n" + "dup v9.4s, %w[rounding_offset]\n" + "dup v10.4s, %w[shift]\n" + "dup v11.4s, v6.s[0]\n" + "dup v6.4s, v6.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v3.4s, v3.4s, v4.4s\n" + "addp v5.4s, v5.4s, v5.4s\n" + "addp v3.4s, v3.4s, v5.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v11.4s\n" + "add v3.4s, v3.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v3.4s, v3.4s, v7.4s\n" + "mul v0.4s, v0.4s, v8.4s\n" + "mul v3.4s, v3.4s, v8.4s\n" + "add v0.4s, v0.4s, v9.4s\n" + "add v3.4s, v3.4s, v9.4s\n" + "sshl v0.4s, v0.4s, v10.4s\n" + "sshl v3.4s, v3.4s, v10.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn v3.4h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun v3.8b, v3.8h\n" + + // RowMajorOutput::Output + "st1 {v0.h}[0], [%x[result]], #2\n" + "st1 {v0.b}[2], [%x[result]], #1\n" + "st1 {v3.h}[0], [x0], #2\n" + "st1 {v3.b}[2], [x0], #1\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + "mov v7.16b, v4.16b\n" + + // 2x4 lanes loop. + "1:" + + "ld1 {v10.8b, v11.8b, v12.8b, v13.8b}, [%x[rhs]], #32\n" + "ld1 {v8.8b}, [%x[lhs]], #8\n" + "umull v14.8h, v8.8b, v10.8b\n" + "ld1 {v9.8b}, [%x[lhs]], #8\n" + "umull v15.8h, v8.8b, v11.8b\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v16.8h, v8.8b, v12.8b\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v17.8h, v8.8b, v13.8b\n" + "umull v18.8h, v9.8b, v10.8b\n" + "uadalp v0.4s, v14.8h\n" + "uadalp v1.4s, v15.8h\n" + "uadalp v2.4s, v16.8h\n" + "umull v14.8h, v9.8b, v11.8b\n" + "umull v15.8h, v9.8b, v12.8b\n" + "umull v16.8h, v9.8b, v13.8b\n" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "uadalp v3.4s, v17.8h\n" + "uadalp v4.4s, v18.8h\n" + "uadalp v5.4s, v14.8h\n" + "uadalp v6.4s, v15.8h\n" + "uadalp v7.4s, v16.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v8.4s}, [%x[lhs]], #16\n" + "ld1 {v9.4s}, [%x[rhs]], #16\n" + "dup v10.4s, %w[multiplicative_offset]\n" + "dup v11.4s, %w[rounding_offset]\n" + "dup v12.4s, %w[shift]\n" + "dup v13.4s, v8.s[0]\n" + "dup v8.4s, v8.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v6.4s, v6.4s, v7.4s\n" + "addp v4.4s, v4.4s, v6.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v13.4s\n" + "add v4.4s, v4.4s, v8.4s\n" + "add v0.4s, v0.4s, v9.4s\n" + "add v4.4s, v4.4s, v9.4s\n" + "mul v0.4s, v0.4s, v10.4s\n" + "mul v4.4s, v4.4s, v10.4s\n" + "add v0.4s, v0.4s, v11.4s\n" + "add v4.4s, v4.4s, v11.4s\n" + "sshl v0.4s, v0.4s, v12.4s\n" + "sshl v4.4s, v4.4s, v12.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn v4.4h, v4.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun v4.8b, v4.8h\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + "st1 {v4.s}[0], [x0], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v3.2s, v4.2s, v5.2s}, [%x[lhs]], #24\n" + "ld1 {v6.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v7.8h, v6.8b, v3.8b\n" + "umull v8.8h, v6.8b, v4.8b\n" + "umull v9.8h, v6.8b, v5.8b\n" + "uadalp v0.4s, v7.8h\n" + "uadalp v1.4s, v8.8h\n" + "uadalp v2.4s, v9.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[multiplicative_offset]\n" + "dup v7.4s, %w[rounding_offset]\n" + "dup v8.4s, %w[shift]\n" + "dup v3.4s, v4.s[0]\n" + "dup v9.4s, v4.s[1]\n" + "dup v4.4s, v4.s[2]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + "add x1, x0, %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v0.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v3.4s\n" + "add v1.4s, v1.4s, v9.4s\n" + "add v2.4s, v2.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "add v1.4s, v1.4s, v5.4s\n" + "add v2.4s, v2.4s, v5.4s\n" + "mul v0.4s, v0.4s, v6.4s\n" + "mul v1.4s, v1.4s, v6.4s\n" + "mul v2.4s, v2.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v1.4s, v1.4s, v7.4s\n" + "add v2.4s, v2.4s, v7.4s\n" + "sshl v0.4s, v0.4s, v8.4s\n" + "sshl v1.4s, v1.4s, v8.4s\n" + "sshl v2.4s, v2.4s, v8.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn v1.4h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun v1.8b, v1.8h\n" + "sqxtun v2.8b, v2.8h\n" + + // RowMajorOutput::Output + "st1 {v0.b}[0], [%x[result]], #1\n" + "st1 {v1.b}[0], [x0], #1\n" + "st1 {v2.b}[0], [x1], #1\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v6.2s, v7.2s, v8.2s}, [%x[lhs]], #24\n" + "ld1 {v9.2s, v10.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v11.8h, v9.8b, v6.8b\n" + "umull v12.8h, v10.8b, v6.8b\n" + "umull v13.8h, v9.8b, v7.8b\n" + "umull v14.8h, v10.8b, v7.8b\n" + "umull v15.8h, v9.8b, v8.8b\n" + "umull v16.8h, v10.8b, v8.8b\n" + "uadalp v0.4s, v11.8h\n" + "uadalp v1.4s, v12.8h\n" + "uadalp v2.4s, v13.8h\n" + "uadalp v3.4s, v14.8h\n" + "uadalp v4.4s, v15.8h\n" + "uadalp v5.4s, v16.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v6.4s}, [%x[lhs]], #16\n" + "ld1 {v7.4s}, [%x[rhs]], #16\n" + "dup v8.4s, %w[multiplicative_offset]\n" + "dup v9.4s, %w[rounding_offset]\n" + "dup v10.4s, %w[shift]\n" + "dup v11.4s, v6.s[0]\n" + "dup v12.4s, v6.s[1]\n" + "dup v6.4s, v6.s[2]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + "add x1, x0, %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v4.4s, v4.4s, v4.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v11.4s\n" + "add v2.4s, v2.4s, v12.4s\n" + "add v4.4s, v4.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v2.4s, v2.4s, v7.4s\n" + "add v4.4s, v4.4s, v7.4s\n" + "mul v0.4s, v0.4s, v8.4s\n" + "mul v2.4s, v2.4s, v8.4s\n" + "mul v4.4s, v4.4s, v8.4s\n" + "add v0.4s, v0.4s, v9.4s\n" + "add v2.4s, v2.4s, v9.4s\n" + "add v4.4s, v4.4s, v9.4s\n" + "sshl v0.4s, v0.4s, v10.4s\n" + "sshl v2.4s, v2.4s, v10.4s\n" + "sshl v4.4s, v4.4s, v10.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn v4.4h, v4.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun v2.8b, v2.8h\n" + "sqxtun v4.8b, v4.8h\n" + + // RowMajorOutput::Output + "st1 {v0.h}[0], [%x[result]], #2\n" + "st1 {v2.h}[0], [x0], #2\n" + "st1 {v4.h}[0], [x1], #2\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "v15", "v16", "cc", "memory"); +} + +template <> +inline void +MulKernel::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + uint8_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + "mov v7.16b, v4.16b\n" + "mov v8.16b, v5.16b\n" + + // 3x3 lanes loop. + "1:" + + "ld1 {v12.8b, v13.8b, v14.8b}, [%x[rhs]], #24\n" + "ld1 {v9.8b}, [%x[lhs]], #8\n" + "umull v15.8h, v9.8b, v12.8b\n" + "ld1 {v10.8b}, [%x[lhs]], #8\n" + "umull v16.8h, v9.8b, v13.8b\n" + "ld1 {v11.8b}, [%x[lhs]], #8\n" + "umull v17.8h, v9.8b, v14.8b\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v18.8h, v10.8b, v12.8b\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "uadalp v0.4s, v15.8h\n" + "uadalp v1.4s, v16.8h\n" + "uadalp v2.4s, v17.8h\n" + "uadalp v3.4s, v18.8h\n" + "umull v15.8h, v10.8b, v13.8b\n" + "umull v16.8h, v10.8b, v14.8b\n" + "umull v17.8h, v11.8b, v12.8b\n" + "umull v18.8h, v11.8b, v13.8b\n" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "umull v9.8h, v11.8b, v14.8b\n" + "uadalp v4.4s, v15.8h\n" + "uadalp v5.4s, v16.8h\n" + "uadalp v6.4s, v17.8h\n" + "uadalp v7.4s, v18.8h\n" + "uadalp v8.4s, v9.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantization::Prepare + "ld1 {v9.4s}, [%x[lhs]], #16\n" + "ld1 {v10.4s}, [%x[rhs]], #16\n" + "dup v11.4s, %w[multiplicative_offset]\n" + "dup v12.4s, %w[rounding_offset]\n" + "dup v13.4s, %w[shift]\n" + "dup v14.4s, v9.s[0]\n" + "dup v15.4s, v9.s[1]\n" + "dup v9.4s, v9.s[2]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + "add x1, x0, %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v3.4s, v3.4s, v4.4s\n" + "addp v5.4s, v5.4s, v5.4s\n" + "addp v3.4s, v3.4s, v5.4s\n" + "addp v6.4s, v6.4s, v7.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v6.4s, v6.4s, v8.4s\n" + + // StaticQuantization::Transform + "add v0.4s, v0.4s, v14.4s\n" + "add v3.4s, v3.4s, v15.4s\n" + "add v6.4s, v6.4s, v9.4s\n" + "add v0.4s, v0.4s, v10.4s\n" + "add v3.4s, v3.4s, v10.4s\n" + "add v6.4s, v6.4s, v10.4s\n" + "mul v0.4s, v0.4s, v11.4s\n" + "mul v3.4s, v3.4s, v11.4s\n" + "mul v6.4s, v6.4s, v11.4s\n" + "add v0.4s, v0.4s, v12.4s\n" + "add v3.4s, v3.4s, v12.4s\n" + "add v6.4s, v6.4s, v12.4s\n" + "sshl v0.4s, v0.4s, v13.4s\n" + "sshl v3.4s, v3.4s, v13.4s\n" + "sshl v6.4s, v6.4s, v13.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn v3.4h, v3.4s\n" + "sqxtn v6.4h, v6.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun v3.8b, v3.8h\n" + "sqxtun v6.8b, v6.8h\n" + + // RowMajorOutput::Output + "st1 {v0.h}[0], [%x[result]], #2\n" + "st1 {v0.b}[2], [%x[result]], #1\n" + "st1 {v3.h}[0], [x0], #2\n" + "st1 {v3.b}[2], [x0], #1\n" + "st1 {v6.h}[0], [x1], #2\n" + "st1 {v6.b}[2], [x1], #1\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [multiplicative_offset] "r"(params.kernel.multiplicative_offset), + [shift] "r"(params.kernel.shift), + [stride] "r"(params.output_stream.stride), + [rounding_offset] "r"(params.kernel.rounding_offset) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "cc", + "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v1.2s}, [%x[lhs]], #8\n" + "ld1 {v2.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v3.8h, v2.8b, v1.8b\n" + "uadalp v0.4s, v3.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v0.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "v0", "v1", "v2", "v3", "v4", "v5", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v2.2s}, [%x[lhs]], #8\n" + "ld1 {v3.2s, v4.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v5.8h, v3.8b, v2.8b\n" + "umull v6.8h, v4.8b, v2.8b\n" + "uadalp v0.4s, v5.8h\n" + "uadalp v1.4s, v6.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v3.2s}, [%x[lhs]], #8\n" + "ld1 {v4.2s, v5.2s, v6.2s}, [%x[rhs]], #24\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v7.8h, v4.8b, v3.8b\n" + "umull v8.8h, v5.8b, v3.8b\n" + "umull v9.8h, v6.8b, v3.8b\n" + "uadalp v0.4s, v7.8h\n" + "uadalp v1.4s, v8.8h\n" + "uadalp v2.4s, v9.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v0.s}[2], [%x[result]], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", + "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 4, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v4.2s}, [%x[lhs]], #8\n" + "ld1 {v5.2s, v6.2s, v7.2s, v8.2s}, [%x[rhs]], #32\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v9.8h, v5.8b, v4.8b\n" + "umull v10.8h, v6.8b, v4.8b\n" + "umull v11.8h, v7.8b, v4.8b\n" + "umull v12.8h, v8.8b, v4.8b\n" + "uadalp v0.4s, v9.8h\n" + "uadalp v1.4s, v10.8h\n" + "uadalp v2.4s, v11.8h\n" + "uadalp v3.4s, v12.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 5, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v5.2s, v6.2s, v7.2s, v8.2s}, [%x[rhs]], #32\n" + "ld1 {v9.2s}, [%x[lhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v10.8h, v5.8b, v9.8b\n" + "umull v11.8h, v6.8b, v9.8b\n" + "umull v12.8h, v7.8b, v9.8b\n" + "umull v13.8h, v8.8b, v9.8b\n" + "ld1 {v5.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[rhs], #128]\n" + "uadalp v0.4s, v10.8h\n" + "uadalp v1.4s, v11.8h\n" + "uadalp v2.4s, v12.8h\n" + "uadalp v3.4s, v13.8h\n" + "umull v10.8h, v5.8b, v9.8b\n" + "uadalp v4.4s, v10.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v5.4s}, [%x[lhs]], #16\n" + "ld1 {v6.4s, v7.4s}, [%x[rhs]], #32\n" + "dup v5.4s, v5.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v4.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v4.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v5.4s\n" + "add v1.4s, v1.4s, v5.4s\n" + "add v0.4s, v0.4s, v6.4s\n" + "add v1.4s, v1.4s, v7.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + "st1 {v1.s}[0], [%x[result]], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 6, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v6.2s, v7.2s, v8.2s, v9.2s}, [%x[rhs]], #32\n" + "ld1 {v10.2s}, [%x[lhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v11.8h, v6.8b, v10.8b\n" + "umull v12.8h, v7.8b, v10.8b\n" + "umull v13.8h, v8.8b, v10.8b\n" + "umull v14.8h, v9.8b, v10.8b\n" + "ld1 {v6.2s, v7.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[rhs], #128]\n" + "uadalp v0.4s, v11.8h\n" + "uadalp v1.4s, v12.8h\n" + "uadalp v2.4s, v13.8h\n" + "uadalp v3.4s, v14.8h\n" + "umull v11.8h, v6.8b, v10.8b\n" + "umull v12.8h, v7.8b, v10.8b\n" + "uadalp v4.4s, v11.8h\n" + "uadalp v5.4s, v12.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v6.4s}, [%x[lhs]], #16\n" + "ld1 {v7.4s, v8.4s}, [%x[rhs]], #32\n" + "dup v6.4s, v6.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v4.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v6.4s\n" + "add v1.4s, v1.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v1.4s, v1.4s, v8.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + "st1 {v1.2s}, [%x[result]], #8\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 7, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v7.2s, v8.2s, v9.2s, v10.2s}, [%x[rhs]], #32\n" + "ld1 {v11.2s}, [%x[lhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v12.8h, v7.8b, v11.8b\n" + "umull v13.8h, v8.8b, v11.8b\n" + "umull v14.8h, v9.8b, v11.8b\n" + "umull v15.8h, v10.8b, v11.8b\n" + "ld1 {v7.2s, v8.2s, v9.2s}, [%x[rhs]], #24\n" + "prfm pldl1keep, [%x[rhs], #128]\n" + "uadalp v0.4s, v12.8h\n" + "uadalp v1.4s, v13.8h\n" + "uadalp v2.4s, v14.8h\n" + "uadalp v3.4s, v15.8h\n" + "umull v12.8h, v7.8b, v11.8b\n" + "umull v13.8h, v8.8b, v11.8b\n" + "umull v14.8h, v9.8b, v11.8b\n" + "uadalp v4.4s, v12.8h\n" + "uadalp v5.4s, v13.8h\n" + "uadalp v6.4s, v14.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v7.4s}, [%x[lhs]], #16\n" + "ld1 {v8.4s, v9.4s}, [%x[rhs]], #32\n" + "dup v7.4s, v7.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v6.4s, v6.4s, v6.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v6.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v7.4s\n" + "add v1.4s, v1.4s, v7.4s\n" + "add v0.4s, v0.4s, v8.4s\n" + "add v1.4s, v1.4s, v9.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + "st1 {v1.2s}, [%x[result]], #8\n" + "st1 {v1.s}[2], [%x[result]], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 1, 8, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + "mov v7.16b, v4.16b\n" + + // 1x8 lanes loop. + "1:" + + "ld1 {v9.2s, v10.2s, v11.2s, v12.2s}, [%x[rhs]], #32\n" + "ld1 {v8.2s}, [%x[lhs]], #8\n" + "umull v13.8h, v8.8b, v9.8b\n" + "umull v14.8h, v8.8b, v10.8b\n" + "umull v15.8h, v8.8b, v11.8b\n" + "umull v16.8h, v8.8b, v12.8b\n" + "ld1 {v9.2s, v10.2s, v11.2s, v12.2s}, [%x[rhs]], #32\n" + "uadalp v0.4s, v13.8h\n" + "uadalp v1.4s, v14.8h\n" + "uadalp v2.4s, v15.8h\n" + "uadalp v3.4s, v16.8h\n" + "prfm pldl1keep, [%x[rhs], #256]\n" + "umull v17.8h, v8.8b, v9.8b\n" + "umull v13.8h, v8.8b, v10.8b\n" + "umull v14.8h, v8.8b, v11.8b\n" + "umull v15.8h, v8.8b, v12.8b\n" + "prfm pldl1keep, [%x[lhs], #32]\n" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "uadalp v4.4s, v17.8h\n" + "uadalp v5.4s, v13.8h\n" + "uadalp v6.4s, v14.8h\n" + "uadalp v7.4s, v15.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v8.4s}, [%x[lhs]], #16\n" + "ld1 {v9.4s, v10.4s}, [%x[rhs]], #32\n" + "dup v8.4s, v8.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v6.4s, v6.4s, v7.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v6.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v8.4s\n" + "add v1.4s, v1.4s, v8.4s\n" + "add v0.4s, v0.4s, v9.4s\n" + "add v1.4s, v1.4s, v10.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s, v1.4s}, [%x[result]], #32\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 2, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v2.2s, v3.2s}, [%x[lhs]], #16\n" + "ld1 {v4.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v5.8h, v4.8b, v2.8b\n" + "umull v6.8h, v4.8b, v3.8b\n" + "uadalp v0.4s, v5.8h\n" + "uadalp v1.4s, v6.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v2.4s, v4.s[0]\n" + "dup v4.4s, v4.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v0.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v2.4s\n" + "add v1.4s, v1.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "add v1.4s, v1.4s, v5.4s\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + "st1 {v1.s}[0], [x0], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 2, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v4.2s, v5.2s}, [%x[lhs]], #16\n" + "ld1 {v6.2s, v7.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v8.8h, v6.8b, v4.8b\n" + "umull v9.8h, v7.8b, v4.8b\n" + "umull v10.8h, v6.8b, v5.8b\n" + "umull v11.8h, v7.8b, v5.8b\n" + "uadalp v0.4s, v8.8h\n" + "uadalp v1.4s, v9.8h\n" + "uadalp v2.4s, v10.8h\n" + "uadalp v3.4s, v11.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, v4.s[0]\n" + "dup v4.4s, v4.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v6.4s\n" + "add v2.4s, v2.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "add v2.4s, v2.4s, v5.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v2.2s}, [x0], #8\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 2, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v6.2s, v7.2s}, [%x[lhs]], #16\n" + "ld1 {v8.2s, v9.2s, v10.2s}, [%x[rhs]], #24\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v11.8h, v8.8b, v6.8b\n" + "umull v12.8h, v9.8b, v6.8b\n" + "umull v13.8h, v10.8b, v6.8b\n" + "umull v14.8h, v8.8b, v7.8b\n" + "umull v15.8h, v9.8b, v7.8b\n" + "umull v16.8h, v10.8b, v7.8b\n" + "uadalp v0.4s, v11.8h\n" + "uadalp v1.4s, v12.8h\n" + "uadalp v2.4s, v13.8h\n" + "uadalp v3.4s, v14.8h\n" + "uadalp v4.4s, v15.8h\n" + "uadalp v5.4s, v16.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v6.4s}, [%x[lhs]], #16\n" + "ld1 {v7.4s}, [%x[rhs]], #16\n" + "dup v8.4s, v6.s[0]\n" + "dup v6.4s, v6.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v3.4s, v3.4s, v4.4s\n" + "addp v5.4s, v5.4s, v5.4s\n" + "addp v3.4s, v3.4s, v5.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v8.4s\n" + "add v3.4s, v3.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v3.4s, v3.4s, v7.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v0.s}[2], [%x[result]], #4\n" + "st1 {v3.2s}, [x0], #8\n" + "st1 {v3.s}[2], [x0], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 2, 4, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + "mov v7.16b, v4.16b\n" + + // 2x4 lanes loop. + "1:" + + "ld1 {v10.8b, v11.8b, v12.8b, v13.8b}, [%x[rhs]], #32\n" + "ld1 {v8.8b}, [%x[lhs]], #8\n" + "umull v14.8h, v8.8b, v10.8b\n" + "ld1 {v9.8b}, [%x[lhs]], #8\n" + "umull v15.8h, v8.8b, v11.8b\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v16.8h, v8.8b, v12.8b\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v17.8h, v8.8b, v13.8b\n" + "umull v18.8h, v9.8b, v10.8b\n" + "uadalp v0.4s, v14.8h\n" + "uadalp v1.4s, v15.8h\n" + "uadalp v2.4s, v16.8h\n" + "umull v14.8h, v9.8b, v11.8b\n" + "umull v15.8h, v9.8b, v12.8b\n" + "umull v16.8h, v9.8b, v13.8b\n" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "uadalp v3.4s, v17.8h\n" + "uadalp v4.4s, v18.8h\n" + "uadalp v5.4s, v14.8h\n" + "uadalp v6.4s, v15.8h\n" + "uadalp v7.4s, v16.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v8.4s}, [%x[lhs]], #16\n" + "ld1 {v9.4s}, [%x[rhs]], #16\n" + "dup v10.4s, v8.s[0]\n" + "dup v8.4s, v8.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v6.4s, v6.4s, v7.4s\n" + "addp v4.4s, v4.4s, v6.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v10.4s\n" + "add v4.4s, v4.4s, v8.4s\n" + "add v0.4s, v0.4s, v9.4s\n" + "add v4.4s, v4.4s, v9.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + "st1 {v4.4s}, [x0], #16\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 3, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v3.2s, v4.2s, v5.2s}, [%x[lhs]], #24\n" + "ld1 {v6.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v7.8h, v6.8b, v3.8b\n" + "umull v8.8h, v6.8b, v4.8b\n" + "umull v9.8h, v6.8b, v5.8b\n" + "uadalp v0.4s, v7.8h\n" + "uadalp v1.4s, v8.8h\n" + "uadalp v2.4s, v9.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v3.4s, v4.s[0]\n" + "dup v6.4s, v4.s[1]\n" + "dup v4.4s, v4.s[2]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + "add x1, x0, %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v0.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v3.4s\n" + "add v1.4s, v1.4s, v6.4s\n" + "add v2.4s, v2.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "add v1.4s, v1.4s, v5.4s\n" + "add v2.4s, v2.4s, v5.4s\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + "st1 {v1.s}[0], [x0], #4\n" + "st1 {v2.s}[0], [x1], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 3, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v6.2s, v7.2s, v8.2s}, [%x[lhs]], #24\n" + "ld1 {v9.2s, v10.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v11.8h, v9.8b, v6.8b\n" + "umull v12.8h, v10.8b, v6.8b\n" + "umull v13.8h, v9.8b, v7.8b\n" + "umull v14.8h, v10.8b, v7.8b\n" + "umull v15.8h, v9.8b, v8.8b\n" + "umull v16.8h, v10.8b, v8.8b\n" + "uadalp v0.4s, v11.8h\n" + "uadalp v1.4s, v12.8h\n" + "uadalp v2.4s, v13.8h\n" + "uadalp v3.4s, v14.8h\n" + "uadalp v4.4s, v15.8h\n" + "uadalp v5.4s, v16.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v6.4s}, [%x[lhs]], #16\n" + "ld1 {v7.4s}, [%x[rhs]], #16\n" + "dup v8.4s, v6.s[0]\n" + "dup v9.4s, v6.s[1]\n" + "dup v6.4s, v6.s[2]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + "add x1, x0, %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v4.4s, v4.4s, v4.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v8.4s\n" + "add v2.4s, v2.4s, v9.4s\n" + "add v4.4s, v4.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v2.4s, v2.4s, v7.4s\n" + "add v4.4s, v4.4s, v7.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v2.2s}, [x0], #8\n" + "st1 {v4.2s}, [x1], #8\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "v15", "v16", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, int32_t, QuantizedStaticPreprocessedAsInt32, RowMajor, 3, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + int32_t* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsInt32RowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + "mov v7.16b, v4.16b\n" + "mov v8.16b, v5.16b\n" + + // 3x3 lanes loop. + "1:" + + "ld1 {v12.8b, v13.8b, v14.8b}, [%x[rhs]], #24\n" + "ld1 {v9.8b}, [%x[lhs]], #8\n" + "umull v15.8h, v9.8b, v12.8b\n" + "ld1 {v10.8b}, [%x[lhs]], #8\n" + "umull v16.8h, v9.8b, v13.8b\n" + "ld1 {v11.8b}, [%x[lhs]], #8\n" + "umull v17.8h, v9.8b, v14.8b\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v18.8h, v10.8b, v12.8b\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "uadalp v0.4s, v15.8h\n" + "uadalp v1.4s, v16.8h\n" + "uadalp v2.4s, v17.8h\n" + "uadalp v3.4s, v18.8h\n" + "umull v15.8h, v10.8b, v13.8b\n" + "umull v16.8h, v10.8b, v14.8b\n" + "umull v17.8h, v11.8b, v12.8b\n" + "umull v18.8h, v11.8b, v13.8b\n" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "umull v9.8h, v11.8b, v14.8b\n" + "uadalp v4.4s, v15.8h\n" + "uadalp v5.4s, v16.8h\n" + "uadalp v6.4s, v17.8h\n" + "uadalp v7.4s, v18.8h\n" + "uadalp v8.4s, v9.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationInt32::Prepare + "ld1 {v9.4s}, [%x[lhs]], #16\n" + "ld1 {v10.4s}, [%x[rhs]], #16\n" + "dup v11.4s, v9.s[0]\n" + "dup v12.4s, v9.s[1]\n" + "dup v9.4s, v9.s[2]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + "add x1, x0, %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v3.4s, v3.4s, v4.4s\n" + "addp v5.4s, v5.4s, v5.4s\n" + "addp v3.4s, v3.4s, v5.4s\n" + "addp v6.4s, v6.4s, v7.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v6.4s, v6.4s, v8.4s\n" + + // StaticQuantizationInt32::Transform + "add v0.4s, v0.4s, v11.4s\n" + "add v3.4s, v3.4s, v12.4s\n" + "add v6.4s, v6.4s, v9.4s\n" + "add v0.4s, v0.4s, v10.4s\n" + "add v3.4s, v3.4s, v10.4s\n" + "add v6.4s, v6.4s, v10.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v0.s}[2], [%x[result]], #4\n" + "st1 {v3.2s}, [x0], #8\n" + "st1 {v3.s}[2], [x0], #4\n" + "st1 {v6.2s}, [x1], #8\n" + "st1 {v6.s}[2], [x1], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "cc", + "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v1.2s}, [%x[lhs]], #8\n" + "ld1 {v2.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v3.8h, v2.8b, v1.8b\n" + "uadalp v0.4s, v3.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[scale]\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v0.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "scvtf v0.4s, v0.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v2.2s}, [%x[lhs]], #8\n" + "ld1 {v3.2s, v4.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v5.8h, v3.8b, v2.8b\n" + "umull v6.8h, v4.8b, v2.8b\n" + "uadalp v0.4s, v5.8h\n" + "uadalp v1.4s, v6.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[scale]\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "scvtf v0.4s, v0.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v3.2s}, [%x[lhs]], #8\n" + "ld1 {v4.2s, v5.2s, v6.2s}, [%x[rhs]], #24\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v7.8h, v4.8b, v3.8b\n" + "umull v8.8h, v5.8b, v3.8b\n" + "umull v9.8h, v6.8b, v3.8b\n" + "uadalp v0.4s, v7.8h\n" + "uadalp v1.4s, v8.8h\n" + "uadalp v2.4s, v9.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[scale]\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "scvtf v0.4s, v0.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v0.s}[2], [%x[result]], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", + "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 4, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v4.2s}, [%x[lhs]], #8\n" + "ld1 {v5.2s, v6.2s, v7.2s, v8.2s}, [%x[rhs]], #32\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v9.8h, v5.8b, v4.8b\n" + "umull v10.8h, v6.8b, v4.8b\n" + "umull v11.8h, v7.8b, v4.8b\n" + "umull v12.8h, v8.8b, v4.8b\n" + "uadalp v0.4s, v9.8h\n" + "uadalp v1.4s, v10.8h\n" + "uadalp v2.4s, v11.8h\n" + "uadalp v3.4s, v12.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[scale]\n" + "dup v4.4s, v4.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "scvtf v0.4s, v0.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 5, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v5.2s, v6.2s, v7.2s, v8.2s}, [%x[rhs]], #32\n" + "ld1 {v9.2s}, [%x[lhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v10.8h, v5.8b, v9.8b\n" + "umull v11.8h, v6.8b, v9.8b\n" + "umull v12.8h, v7.8b, v9.8b\n" + "umull v13.8h, v8.8b, v9.8b\n" + "ld1 {v5.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[rhs], #128]\n" + "uadalp v0.4s, v10.8h\n" + "uadalp v1.4s, v11.8h\n" + "uadalp v2.4s, v12.8h\n" + "uadalp v3.4s, v13.8h\n" + "umull v10.8h, v5.8b, v9.8b\n" + "uadalp v4.4s, v10.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v5.4s}, [%x[lhs]], #16\n" + "ld1 {v6.4s, v7.4s}, [%x[rhs]], #32\n" + "dup v8.4s, %w[scale]\n" + "dup v5.4s, v5.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v4.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v4.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v5.4s\n" + "add v1.4s, v1.4s, v5.4s\n" + "add v0.4s, v0.4s, v6.4s\n" + "add v1.4s, v1.4s, v7.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + "st1 {v1.s}[0], [%x[result]], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 6, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v6.2s, v7.2s, v8.2s, v9.2s}, [%x[rhs]], #32\n" + "ld1 {v10.2s}, [%x[lhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v11.8h, v6.8b, v10.8b\n" + "umull v12.8h, v7.8b, v10.8b\n" + "umull v13.8h, v8.8b, v10.8b\n" + "umull v14.8h, v9.8b, v10.8b\n" + "ld1 {v6.2s, v7.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[rhs], #128]\n" + "uadalp v0.4s, v11.8h\n" + "uadalp v1.4s, v12.8h\n" + "uadalp v2.4s, v13.8h\n" + "uadalp v3.4s, v14.8h\n" + "umull v11.8h, v6.8b, v10.8b\n" + "umull v12.8h, v7.8b, v10.8b\n" + "uadalp v4.4s, v11.8h\n" + "uadalp v5.4s, v12.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v6.4s}, [%x[lhs]], #16\n" + "ld1 {v7.4s, v8.4s}, [%x[rhs]], #32\n" + "dup v9.4s, %w[scale]\n" + "dup v6.4s, v6.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v4.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v6.4s\n" + "add v1.4s, v1.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v1.4s, v1.4s, v8.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + "st1 {v1.2s}, [%x[result]], #8\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 7, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + + // General 1xM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v7.2s, v8.2s, v9.2s, v10.2s}, [%x[rhs]], #32\n" + "ld1 {v11.2s}, [%x[lhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v12.8h, v7.8b, v11.8b\n" + "umull v13.8h, v8.8b, v11.8b\n" + "umull v14.8h, v9.8b, v11.8b\n" + "umull v15.8h, v10.8b, v11.8b\n" + "ld1 {v7.2s, v8.2s, v9.2s}, [%x[rhs]], #24\n" + "prfm pldl1keep, [%x[rhs], #128]\n" + "uadalp v0.4s, v12.8h\n" + "uadalp v1.4s, v13.8h\n" + "uadalp v2.4s, v14.8h\n" + "uadalp v3.4s, v15.8h\n" + "umull v12.8h, v7.8b, v11.8b\n" + "umull v13.8h, v8.8b, v11.8b\n" + "umull v14.8h, v9.8b, v11.8b\n" + "uadalp v4.4s, v12.8h\n" + "uadalp v5.4s, v13.8h\n" + "uadalp v6.4s, v14.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v7.4s}, [%x[lhs]], #16\n" + "ld1 {v8.4s, v9.4s}, [%x[rhs]], #32\n" + "dup v10.4s, %w[scale]\n" + "dup v7.4s, v7.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v6.4s, v6.4s, v6.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v6.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v7.4s\n" + "add v1.4s, v1.4s, v7.4s\n" + "add v0.4s, v0.4s, v8.4s\n" + "add v1.4s, v1.4s, v9.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fmul v0.4s, v0.4s, v10.4s\n" + "fmul v1.4s, v1.4s, v10.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + "st1 {v1.2s}, [%x[result]], #8\n" + "st1 {v1.s}[2], [%x[result]], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 1, 8, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + "mov v7.16b, v4.16b\n" + + // 1x8 lanes loop. + "1:" + + "ld1 {v9.2s, v10.2s, v11.2s, v12.2s}, [%x[rhs]], #32\n" + "ld1 {v8.2s}, [%x[lhs]], #8\n" + "umull v13.8h, v8.8b, v9.8b\n" + "umull v14.8h, v8.8b, v10.8b\n" + "umull v15.8h, v8.8b, v11.8b\n" + "umull v16.8h, v8.8b, v12.8b\n" + "ld1 {v9.2s, v10.2s, v11.2s, v12.2s}, [%x[rhs]], #32\n" + "uadalp v0.4s, v13.8h\n" + "uadalp v1.4s, v14.8h\n" + "uadalp v2.4s, v15.8h\n" + "uadalp v3.4s, v16.8h\n" + "prfm pldl1keep, [%x[rhs], #256]\n" + "umull v17.8h, v8.8b, v9.8b\n" + "umull v13.8h, v8.8b, v10.8b\n" + "umull v14.8h, v8.8b, v11.8b\n" + "umull v15.8h, v8.8b, v12.8b\n" + "prfm pldl1keep, [%x[lhs], #32]\n" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "uadalp v4.4s, v17.8h\n" + "uadalp v5.4s, v13.8h\n" + "uadalp v6.4s, v14.8h\n" + "uadalp v7.4s, v15.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v8.4s}, [%x[lhs]], #16\n" + "ld1 {v9.4s, v10.4s}, [%x[rhs]], #32\n" + "dup v11.4s, %w[scale]\n" + "dup v8.4s, v8.s[0]\n" + + // RowMajorOutput::Prepare + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v6.4s, v6.4s, v7.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v1.4s, v4.4s, v6.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v8.4s\n" + "add v1.4s, v1.4s, v8.4s\n" + "add v0.4s, v0.4s, v9.4s\n" + "add v1.4s, v1.4s, v10.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fmul v0.4s, v0.4s, v11.4s\n" + "fmul v1.4s, v1.4s, v11.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s, v1.4s}, [%x[result]], #32\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 2, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v2.2s, v3.2s}, [%x[lhs]], #16\n" + "ld1 {v4.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v5.8h, v4.8b, v2.8b\n" + "umull v6.8h, v4.8b, v3.8b\n" + "uadalp v0.4s, v5.8h\n" + "uadalp v1.4s, v6.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[scale]\n" + "dup v2.4s, v4.s[0]\n" + "dup v4.4s, v4.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v0.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v2.4s\n" + "add v1.4s, v1.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "add v1.4s, v1.4s, v5.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + "st1 {v1.s}[0], [x0], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 2, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v4.2s, v5.2s}, [%x[lhs]], #16\n" + "ld1 {v6.2s, v7.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v8.8h, v6.8b, v4.8b\n" + "umull v9.8h, v7.8b, v4.8b\n" + "umull v10.8h, v6.8b, v5.8b\n" + "umull v11.8h, v7.8b, v5.8b\n" + "uadalp v0.4s, v8.8h\n" + "uadalp v1.4s, v9.8h\n" + "uadalp v2.4s, v10.8h\n" + "uadalp v3.4s, v11.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[scale]\n" + "dup v7.4s, v4.s[0]\n" + "dup v4.4s, v4.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v7.4s\n" + "add v2.4s, v2.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "add v2.4s, v2.4s, v5.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v2.4s, v2.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v2.2s}, [x0], #8\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 2, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v6.2s, v7.2s}, [%x[lhs]], #16\n" + "ld1 {v8.2s, v9.2s, v10.2s}, [%x[rhs]], #24\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v11.8h, v8.8b, v6.8b\n" + "umull v12.8h, v9.8b, v6.8b\n" + "umull v13.8h, v10.8b, v6.8b\n" + "umull v14.8h, v8.8b, v7.8b\n" + "umull v15.8h, v9.8b, v7.8b\n" + "umull v16.8h, v10.8b, v7.8b\n" + "uadalp v0.4s, v11.8h\n" + "uadalp v1.4s, v12.8h\n" + "uadalp v2.4s, v13.8h\n" + "uadalp v3.4s, v14.8h\n" + "uadalp v4.4s, v15.8h\n" + "uadalp v5.4s, v16.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v6.4s}, [%x[lhs]], #16\n" + "ld1 {v7.4s}, [%x[rhs]], #16\n" + "dup v8.4s, %w[scale]\n" + "dup v9.4s, v6.s[0]\n" + "dup v6.4s, v6.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v3.4s, v3.4s, v4.4s\n" + "addp v5.4s, v5.4s, v5.4s\n" + "addp v3.4s, v3.4s, v5.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v9.4s\n" + "add v3.4s, v3.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v3.4s, v3.4s, v7.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v3.4s, v3.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v0.s}[2], [%x[result]], #4\n" + "st1 {v3.2s}, [x0], #8\n" + "st1 {v3.s}[2], [x0], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 2, 4, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + "mov v7.16b, v4.16b\n" + + // 2x4 lanes loop. + "1:" + + "ld1 {v10.8b, v11.8b, v12.8b, v13.8b}, [%x[rhs]], #32\n" + "ld1 {v8.8b}, [%x[lhs]], #8\n" + "umull v14.8h, v8.8b, v10.8b\n" + "ld1 {v9.8b}, [%x[lhs]], #8\n" + "umull v15.8h, v8.8b, v11.8b\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v16.8h, v8.8b, v12.8b\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v17.8h, v8.8b, v13.8b\n" + "umull v18.8h, v9.8b, v10.8b\n" + "uadalp v0.4s, v14.8h\n" + "uadalp v1.4s, v15.8h\n" + "uadalp v2.4s, v16.8h\n" + "umull v14.8h, v9.8b, v11.8b\n" + "umull v15.8h, v9.8b, v12.8b\n" + "umull v16.8h, v9.8b, v13.8b\n" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "uadalp v3.4s, v17.8h\n" + "uadalp v4.4s, v18.8h\n" + "uadalp v5.4s, v14.8h\n" + "uadalp v6.4s, v15.8h\n" + "uadalp v7.4s, v16.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v8.4s}, [%x[lhs]], #16\n" + "ld1 {v9.4s}, [%x[rhs]], #16\n" + "dup v10.4s, %w[scale]\n" + "dup v11.4s, v8.s[0]\n" + "dup v8.4s, v8.s[1]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v6.4s, v6.4s, v7.4s\n" + "addp v4.4s, v4.4s, v6.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v11.4s\n" + "add v4.4s, v4.4s, v8.4s\n" + "add v0.4s, v0.4s, v9.4s\n" + "add v4.4s, v4.4s, v9.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v4.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v10.4s\n" + "fmul v4.4s, v4.4s, v10.4s\n" + + // RowMajorOutput::Output + "st1 {v0.4s}, [%x[result]], #16\n" + "st1 {v4.4s}, [x0], #16\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 3, 1, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v3.2s, v4.2s, v5.2s}, [%x[lhs]], #24\n" + "ld1 {v6.2s}, [%x[rhs]], #8\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v7.8h, v6.8b, v3.8b\n" + "umull v8.8h, v6.8b, v4.8b\n" + "umull v9.8h, v6.8b, v5.8b\n" + "uadalp v0.4s, v7.8h\n" + "uadalp v1.4s, v8.8h\n" + "uadalp v2.4s, v9.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v4.4s}, [%x[lhs]], #16\n" + "ld1 {v5.4s}, [%x[rhs]], #16\n" + "dup v6.4s, %w[scale]\n" + "dup v3.4s, v4.s[0]\n" + "dup v7.4s, v4.s[1]\n" + "dup v4.4s, v4.s[2]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + "add x1, x0, %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v0.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + "addp v1.4s, v1.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v3.4s\n" + "add v1.4s, v1.4s, v7.4s\n" + "add v2.4s, v2.4s, v4.4s\n" + "add v0.4s, v0.4s, v5.4s\n" + "add v1.4s, v1.4s, v5.4s\n" + "add v2.4s, v2.4s, v5.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + + // RowMajorOutput::Output + "st1 {v0.s}[0], [%x[result]], #4\n" + "st1 {v1.s}[0], [x0], #4\n" + "st1 {v2.s}[0], [x1], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 3, 2, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + + // General NxM lanes loop. + "1:" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "ld1 {v6.2s, v7.2s, v8.2s}, [%x[lhs]], #24\n" + "ld1 {v9.2s, v10.2s}, [%x[rhs]], #16\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "umull v11.8h, v9.8b, v6.8b\n" + "umull v12.8h, v10.8b, v6.8b\n" + "umull v13.8h, v9.8b, v7.8b\n" + "umull v14.8h, v10.8b, v7.8b\n" + "umull v15.8h, v9.8b, v8.8b\n" + "umull v16.8h, v10.8b, v8.8b\n" + "uadalp v0.4s, v11.8h\n" + "uadalp v1.4s, v12.8h\n" + "uadalp v2.4s, v13.8h\n" + "uadalp v3.4s, v14.8h\n" + "uadalp v4.4s, v15.8h\n" + "uadalp v5.4s, v16.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v6.4s}, [%x[lhs]], #16\n" + "ld1 {v7.4s}, [%x[rhs]], #16\n" + "dup v8.4s, %w[scale]\n" + "dup v9.4s, v6.s[0]\n" + "dup v10.4s, v6.s[1]\n" + "dup v6.4s, v6.s[2]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + "add x1, x0, %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v0.4s, v0.4s, v0.4s\n" + "addp v2.4s, v2.4s, v3.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v4.4s, v4.4s, v5.4s\n" + "addp v4.4s, v4.4s, v4.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v9.4s\n" + "add v2.4s, v2.4s, v10.4s\n" + "add v4.4s, v4.4s, v6.4s\n" + "add v0.4s, v0.4s, v7.4s\n" + "add v2.4s, v2.4s, v7.4s\n" + "add v4.4s, v4.4s, v7.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v4.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v4.4s, v4.4s, v8.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v2.2s}, [x0], #8\n" + "st1 {v4.2s}, [x1], #8\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "v15", "v16", "cc", "memory"); +} + +template <> +inline void MulKernel< + uint8_t, float, QuantizedStaticPreprocessedAsFloat, RowMajor, 3, 3, + 8>::Multiply(const uint8_t* lhs, const uint8_t* rhs, + const FusedKernelParams& params, + float* result) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") QuantizedStaticPreprocessedAsFloatRowMajor::Multiply()" + << std::endl + << std::flush; +#endif +#endif + asm volatile( + "prfm pldl1keep, [%x[lhs]]\n" + "prfm pldl1keep, [%x[rhs]]\n" + + // Clear aggregators. + "movi v0.4s, #0\n" + "movi v1.4s, #0\n" + "movi v2.4s, #0\n" + "mov v3.16b, v0.16b\n" + "mov v4.16b, v1.16b\n" + "mov v5.16b, v2.16b\n" + "mov v6.16b, v3.16b\n" + "mov v7.16b, v4.16b\n" + "mov v8.16b, v5.16b\n" + + // 3x3 lanes loop. + "1:" + + "ld1 {v12.8b, v13.8b, v14.8b}, [%x[rhs]], #24\n" + "ld1 {v9.8b}, [%x[lhs]], #8\n" + "umull v15.8h, v9.8b, v12.8b\n" + "ld1 {v10.8b}, [%x[lhs]], #8\n" + "umull v16.8h, v9.8b, v13.8b\n" + "ld1 {v11.8b}, [%x[lhs]], #8\n" + "umull v17.8h, v9.8b, v14.8b\n" + "prfm pldl1keep, [%x[lhs], #64]\n" + "umull v18.8h, v10.8b, v12.8b\n" + "prfm pldl1keep, [%x[rhs], #64]\n" + "uadalp v0.4s, v15.8h\n" + "uadalp v1.4s, v16.8h\n" + "uadalp v2.4s, v17.8h\n" + "uadalp v3.4s, v18.8h\n" + "umull v15.8h, v10.8b, v13.8b\n" + "umull v16.8h, v10.8b, v14.8b\n" + "umull v17.8h, v11.8b, v12.8b\n" + "umull v18.8h, v11.8b, v13.8b\n" + + // Subtract counter. + "subs %x[count], %x[count], #8\n" + + "umull v9.8h, v11.8b, v14.8b\n" + "uadalp v4.4s, v15.8h\n" + "uadalp v5.4s, v16.8h\n" + "uadalp v6.4s, v17.8h\n" + "uadalp v7.4s, v18.8h\n" + "uadalp v8.4s, v9.8h\n" + + // Loop break. + "bgt 1b\n" + + // StaticQuantizationFloat::Prepare + "ld1 {v9.4s}, [%x[lhs]], #16\n" + "ld1 {v10.4s}, [%x[rhs]], #16\n" + "dup v11.4s, %w[scale]\n" + "dup v12.4s, v9.s[0]\n" + "dup v13.4s, v9.s[1]\n" + "dup v9.4s, v9.s[2]\n" + + // RowMajorOutput::Prepare + "add x0, %x[result], %x[stride]\n" + "add x1, x0, %x[stride]\n" + + // Reduce aggregators. + "addp v0.4s, v0.4s, v1.4s\n" + "addp v2.4s, v2.4s, v2.4s\n" + "addp v0.4s, v0.4s, v2.4s\n" + "addp v3.4s, v3.4s, v4.4s\n" + "addp v5.4s, v5.4s, v5.4s\n" + "addp v3.4s, v3.4s, v5.4s\n" + "addp v6.4s, v6.4s, v7.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v6.4s, v6.4s, v8.4s\n" + + // StaticQuantizationFloat::Transform + "add v0.4s, v0.4s, v12.4s\n" + "add v3.4s, v3.4s, v13.4s\n" + "add v6.4s, v6.4s, v9.4s\n" + "add v0.4s, v0.4s, v10.4s\n" + "add v3.4s, v3.4s, v10.4s\n" + "add v6.4s, v6.4s, v10.4s\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v6.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v11.4s\n" + "fmul v3.4s, v3.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + + // RowMajorOutput::Output + "st1 {v0.2s}, [%x[result]], #8\n" + "st1 {v0.s}[2], [%x[result]], #4\n" + "st1 {v3.2s}, [x0], #8\n" + "st1 {v3.s}[2], [x0], #4\n" + "st1 {v6.2s}, [x1], #8\n" + "st1 {v6.s}[2], [x1], #4\n" + : [rhs] "+r"(rhs), [lhs] "+r"(lhs), [result] "+r"(result) + : [count] "r"(params.kernel.count), + [stride] "r"(params.output_stream.stride), + [scale] "r"(params.kernel.scale) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "cc", + "memory"); +} + +} // namespace meta +} // namespace gemmlowp + +#else +#warning "Meta gemm for arm64 requires: GEMMLOWP_NEON_64!" +#endif + +#endif // GEMMLOWP_META_QUANTIZED_MUL_KERNELS_ARM_64_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/single_thread_gemm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/single_thread_gemm.h new file mode 100644 index 0000000000000000000000000000000000000000..258de69fdd46239bfd69777a6c0bfac9275b54f0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/single_thread_gemm.h @@ -0,0 +1,688 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_SINGLE_THREAD_GEMM_H_ +#define GEMMLOWP_META_SINGLE_THREAD_GEMM_H_ + +#include +#include "base.h" + +namespace gemmlowp { +namespace meta { + +template +void Gemm(const Params& params); + +class GemmExecutorPackRHS { + public: + template + static int EstimateScratchSize(const P& params, int kernel_m, int kernel_n, + int kernel_k) { + const int lhs_scratch = + StreamUtil::Scratch( + params.left_stream, kernel_m, kernel_k); + const int rhs_chunks = ((params.n + kernel_n - 1) / kernel_n); + const int rhs_scratch = + rhs_chunks * + StreamUtil::Scratch( + params.right_stream, kernel_n, kernel_k); + return AlignTo<64 * 1024>(lhs_scratch + rhs_scratch); + } + + template + static void ExecuteDispatch3D(const P& params) { + // Shorthand typedefs for streams and multiply kernels. + typedef typename P::InType InType; + typedef typename P::OutType OutType; + + typedef Stream + LeftStreamF; + typedef Stream + LeftStreamL; + + typedef Stream + RightStreamF; + typedef Stream + RightStreamL; + + typedef Stream + OutputStreamFF; + typedef Stream + OutputStreamLF; + + typedef MulKernel + KernelFF; + typedef MulKernel + KernelFL; + typedef MulKernel + KernelLF; + typedef MulKernel + KernelLL; + +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "GemmExecutor(" << typeid(P).name() << "): " << m << "x" << n + << "x" << k << " -- " << m_leftovers << "x" << n_leftovers << "x" + << k_leftovers << " -- " << params.m << "x" << params.n << "x" + << params.k << std::endl; + LeftStreamF::Debug(params.left_stream); + LeftStreamL::Debug(params.left_stream); + + RightStreamF::Debug(params.right_stream); + RightStreamL::Debug(params.right_stream); + + OutputStreamFF::Debug(params.fused_kernel.output_stream); + OutputStreamLF::Debug(params.fused_kernel.output_stream); + + KernelFF::Debug(params.fused_kernel); + KernelFL::Debug(params.fused_kernel); + KernelLF::Debug(params.fused_kernel); + KernelLL::Debug(params.fused_kernel); +#endif +#endif + + int lhs_chunks = params.m / m; + int rhs_chunks = params.n / n; + + // Scratch memory for packed LHS & RHS chunks. + + std::uint8_t* packed_lhs = params.scratch; + std::uint8_t* packed_rhs = + params.scratch + LeftStreamF::Scratch(params.left_stream); + + // Pack full RHS first. + + std::uint8_t* packed_rhs_chunk = packed_rhs; + const int packed_rhs_chunk_size = + RightStreamF::PackedStride(params.right_stream); + + { + const std::uint8_t* rhs_chunk = + reinterpret_cast(params.rhs); + const int rhs_chunk_size = + RightStreamF::UnpackedStride(params.right_stream); + + for (int i = 0; i < rhs_chunks; ++i) { + RightStreamF::Pack(reinterpret_cast(rhs_chunk), + params.right_stream, + reinterpret_cast(packed_rhs_chunk)); + + rhs_chunk += rhs_chunk_size; + packed_rhs_chunk += packed_rhs_chunk_size; + } + + RightStreamL::Pack(reinterpret_cast(rhs_chunk), + params.right_stream, + reinterpret_cast(packed_rhs_chunk)); + } + + // Multiply RHS by LHS one LHS chunk at a time. + + const std::uint8_t* lhs_chunk = + reinterpret_cast(params.lhs); + std::uint8_t* result_strip = reinterpret_cast(params.result); + std::uint8_t* result_chunk = result_strip; + + { + const int lhs_chunk_size = + LeftStreamF::UnpackedStride(params.left_stream); + const int result_strip_size = + OutputStreamFF::UnpackedStride(params.fused_kernel.output_stream); + const int result_chunk_size = + OutputStreamFF::UnpackedAdvance(params.fused_kernel.output_stream); + + for (int i = 0; i < lhs_chunks; ++i) { + LeftStreamF::Pack(reinterpret_cast(lhs_chunk), + params.left_stream, + reinterpret_cast(packed_lhs)); + + result_chunk = result_strip; + packed_rhs_chunk = packed_rhs; + + for (int j = 0; j < rhs_chunks; ++j) { + KernelFF::Multiply(reinterpret_cast(packed_lhs), + reinterpret_cast(packed_rhs_chunk), + params.fused_kernel, + reinterpret_cast(result_chunk)); + + result_chunk += result_chunk_size; + packed_rhs_chunk += packed_rhs_chunk_size; + } + + KernelFL::Multiply(reinterpret_cast(packed_lhs), + reinterpret_cast(packed_rhs_chunk), + params.fused_kernel, + reinterpret_cast(result_chunk)); + + lhs_chunk += lhs_chunk_size; + result_strip += result_strip_size; + } + } + + // Leftover LHS chunk. + if (m_leftovers > 0) { // static if + const int result_chunk_size = + OutputStreamLF::UnpackedAdvance(params.fused_kernel.output_stream); + + LeftStreamL::Pack(reinterpret_cast(lhs_chunk), + params.left_stream, + reinterpret_cast(packed_lhs)); + + result_chunk = result_strip; + packed_rhs_chunk = packed_rhs; + + for (int i = 0; i < rhs_chunks; ++i) { + KernelLF::Multiply(reinterpret_cast(packed_lhs), + reinterpret_cast(packed_rhs_chunk), + params.fused_kernel, + reinterpret_cast(result_chunk)); + + result_chunk += result_chunk_size; + packed_rhs_chunk += packed_rhs_chunk_size; + } + + KernelLL::Multiply(reinterpret_cast(packed_lhs), + reinterpret_cast(packed_rhs_chunk), + params.fused_kernel, + reinterpret_cast(result_chunk)); + } + } +}; + +class GemmExecutorPackLHS { + public: + template + static int EstimateScratchSize(const P& params, int kernel_m, int kernel_n, + int kernel_k) { + const int lhs_chunks = ((params.m + kernel_m - 1) / kernel_m); + const int lhs_scratch = + lhs_chunks * + StreamUtil::Scratch( + params.left_stream, kernel_m, kernel_k); + const int rhs_scratch = + StreamUtil::Scratch( + params.right_stream, kernel_n, kernel_k); + return AlignTo<64 * 1024>(lhs_scratch + rhs_scratch); + } + + template + static void ExecuteDispatch3D(const P& params) { + // Shorthand typedefs for streams and multiply kernels. + typedef typename P::InType InType; + typedef typename P::OutType OutType; + + typedef Stream + LeftStreamF; + typedef Stream + LeftStreamL; + + typedef Stream + RightStreamF; + typedef Stream + RightStreamL; + + typedef Stream + OutputStreamFF; + typedef Stream + OutputStreamFL; + + typedef MulKernel + KernelFF; + typedef MulKernel + KernelFL; + typedef MulKernel + KernelLF; + typedef MulKernel + KernelLL; +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "GemmExecutor(" << typeid(P).name() << "): " << m << "x" << n + << "x" << k << " -- " << m_leftovers << "x" << n_leftovers << "x" + << k_leftovers << " -- " << params.m << "x" << params.n << "x" + << params.k << std::endl; + LeftStreamF::Debug(params.left_stream); + LeftStreamL::Debug(params.left_stream); + + RightStreamF::Debug(params.right_stream); + RightStreamL::Debug(params.right_stream); + + OutputStreamFF::Debug(params.fused_kernel.output_stream); + OutputStreamFL::Debug(params.fused_kernel.output_stream); + + KernelFF::Debug(params.fused_kernel); + KernelFL::Debug(params.fused_kernel); + KernelLF::Debug(params.fused_kernel); + KernelLL::Debug(params.fused_kernel); +#endif +#endif + + int lhs_chunks = params.m / m; + int rhs_chunks = params.n / n; + + // Scratch memory for packed LHS & RHS chunks. + std::uint8_t* packed_rhs = params.scratch; + std::uint8_t* packed_lhs = + params.scratch + RightStreamF::Scratch(params.right_stream); + + // Pack full LHS first. + + std::uint8_t* packed_lhs_chunk = packed_lhs; + const int packed_lhs_chunk_size = + LeftStreamF::PackedStride(params.left_stream); + + { + const std::uint8_t* lhs_chunk = + reinterpret_cast(params.lhs); + const int lhs_chunk_size = + LeftStreamF::UnpackedStride(params.left_stream); + + for (int i = 0; i < lhs_chunks; ++i) { + LeftStreamF::Pack(reinterpret_cast(lhs_chunk), + params.left_stream, + reinterpret_cast(packed_lhs_chunk)); + + lhs_chunk += lhs_chunk_size; + packed_lhs_chunk += packed_lhs_chunk_size; + } + + LeftStreamL::Pack(reinterpret_cast(lhs_chunk), + params.left_stream, + reinterpret_cast(packed_lhs_chunk)); + } + + // Multiply RHS by LHS one RHS chunk at a time. + + const std::uint8_t* rhs_chunk = + reinterpret_cast(params.rhs); + std::uint8_t* result_strip = reinterpret_cast(params.result); + std::uint8_t* result_chunk = result_strip; + + { + const int rhs_chunk_size = + RightStreamF::UnpackedStride(params.right_stream); + const int result_strip_size = + OutputStreamFF::UnpackedAdvance(params.fused_kernel.output_stream); + const int result_chunk_size = + OutputStreamFF::UnpackedStride(params.fused_kernel.output_stream); + + for (int i = 0; i < rhs_chunks; ++i) { + RightStreamF::Pack(reinterpret_cast(rhs_chunk), + params.right_stream, + reinterpret_cast(packed_rhs)); + + result_chunk = result_strip; + packed_lhs_chunk = packed_lhs; + + for (int j = 0; j < lhs_chunks; ++j) { + KernelFF::Multiply(reinterpret_cast(packed_lhs_chunk), + reinterpret_cast(packed_rhs), + params.fused_kernel, + reinterpret_cast(result_chunk)); + + result_chunk += result_chunk_size; + packed_lhs_chunk += packed_lhs_chunk_size; + } + + KernelLF::Multiply(reinterpret_cast(packed_lhs_chunk), + reinterpret_cast(packed_rhs), + params.fused_kernel, + reinterpret_cast(result_chunk)); + + rhs_chunk += rhs_chunk_size; + result_strip += result_strip_size; + } + } + + // Leftover RHS chunk. + if (n_leftovers > 0) { // static if + const int result_chunk_size = + OutputStreamFL::UnpackedStride(params.fused_kernel.output_stream); + + RightStreamL::Pack(reinterpret_cast(rhs_chunk), + params.right_stream, + reinterpret_cast(packed_rhs)); + + result_chunk = result_strip; + packed_lhs_chunk = packed_lhs; + + for (int i = 0; i < lhs_chunks; ++i) { + KernelFL::Multiply(reinterpret_cast(packed_lhs_chunk), + reinterpret_cast(packed_rhs), + params.fused_kernel, + reinterpret_cast(result_chunk)); + + result_chunk += result_chunk_size; + packed_lhs_chunk += packed_lhs_chunk_size; + } + + KernelLL::Multiply(reinterpret_cast(packed_lhs_chunk), + reinterpret_cast(packed_rhs), + params.fused_kernel, + reinterpret_cast(result_chunk)); + } + } +}; + +namespace internal { + +inline int CalculateCacheFriendlyTasksCount(int cache_size, int constant_memory, + int per_chunk_memory, int total_dim, + int chunk_dim) { + assert(constant_memory + per_chunk_memory < cache_size); + const int available_cache = cache_size - constant_memory; + const int available_chunks = available_cache / per_chunk_memory; + const int chunks_count = (total_dim + chunk_dim - 1) / chunk_dim; + return (chunks_count + available_chunks - 1) / available_chunks; +} + +template +inline void UpdateCacheFriendlyTask(int m_offset, int m, int n_offset, int n, + const Params& params, Params* task_params) { + task_params->m = m; + task_params->lhs = + StreamUtil::Offset( + params.left_stream, params.lhs, m_offset, 0); + + task_params->n = n; + task_params->rhs = + StreamUtil::Offset( + params.right_stream, params.rhs, n_offset, 0); + + task_params->result = + StreamUtil:: + Offset(params.fused_kernel.output_stream, params.result, m_offset, + n_offset); +} + +} // namespace internal + +template +class GemmExecutorPackRHSCacheFriendly { + public: + template + static int EstimateScratchSize(const P& params, int kernel_m, int kernel_n, + int kernel_k) { + return cache_size; + } + + template + static void ExecuteDispatch3D(const P& params) { + typedef Stream + LeftStream; + + typedef Stream + RightStream; + + const int lhs_scratch = LeftStream::Scratch(params.left_stream); + const int rhs_scratch = RightStream::Scratch(params.right_stream); + + const int cache_friendly_tasks_count = + internal::CalculateCacheFriendlyTasksCount(cache_size, lhs_scratch, + rhs_scratch, params.n, n); + + if (cache_friendly_tasks_count == 1) { + GemmExecutorPackRHS::ExecuteDispatch3D(params); + return; + } + + const int cache_friendly_dim = params.n / cache_friendly_tasks_count; + + P task_params = params; + for (int i = 0; i < cache_friendly_tasks_count - 1; ++i) { + internal::UpdateCacheFriendlyTask(0, params.m, i * cache_friendly_dim, + cache_friendly_dim, params, + &task_params); + Gemm(task_params); + } + const int dim_sum = (cache_friendly_tasks_count - 1) * cache_friendly_dim; + internal::UpdateCacheFriendlyTask(0, params.m, dim_sum, params.n - dim_sum, + params, &task_params); + Gemm(task_params); + } +}; + +template +class GemmExecutorPackLHSCacheFriendly { + public: + template + static int EstimateScratchSize(const P& params, int kernel_m, int kernel_n, + int kernel_k) { + return cache_size; + } + + template + static void ExecuteDispatch3D(const P& params) { + typedef Stream + LeftStream; + + typedef Stream + RightStream; + + const int lhs_scratch = LeftStream::Scratch(params.left_stream); + const int rhs_scratch = RightStream::Scratch(params.right_stream); + + const int cache_friendly_tasks_count = + internal::CalculateCacheFriendlyTasksCount(cache_size, rhs_scratch, + lhs_scratch, params.m, m); + + if (cache_friendly_tasks_count == 1) { + GemmExecutorPackLHS::ExecuteDispatch3D(params); + return; + } + + const int cache_friendly_dim = params.m / cache_friendly_tasks_count; + + P task_params = params; + for (int i = 0; i < cache_friendly_tasks_count - 1; ++i) { + internal::UpdateCacheFriendlyTask(i * cache_friendly_dim, + cache_friendly_dim, 0, params.n, params, + &task_params); + Gemm(task_params); + } + const int dim_sum = (cache_friendly_tasks_count - 1) * cache_friendly_dim; + internal::UpdateCacheFriendlyTask(dim_sum, params.m - dim_sum, 0, params.n, + params, &task_params); + Gemm(task_params); + } +}; + +namespace internal { + +// Stage 3. + +template +struct Dispatch3DStage3 { + static void Execute(const P& params, int k) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Dispatch(3): " << dim_m << "x" << dim_n << "x" << dim_k + << " : " << fixed_m << "x" << fixed_n << "x" << variable_k + << std::endl + << std::flush; +#endif +#endif + if (k == variable_k) { + E::template ExecuteDispatch3D(params); + } else { + Dispatch3DStage3::Execute(params, k); + } + } +}; + +template +struct Dispatch3DStage3 { + static void Execute(const P& params, int k) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Dispatch(3): " << dim_m << "x" << dim_n << "x" << dim_k + << " : " << fixed_m << "x" << fixed_n << "x" << 0 << std::endl + << std::flush; +#endif +#endif + if (k == 0) { + E::template ExecuteDispatch3D(params); + } else { + std::cerr << "FATAL: dispatch3DStage3 failed: ran out of cases." + << std::endl + << std::flush; + std::exit(1); + } + } +}; + +// Stage 2. + +template +struct Dispatch3DStage2 { + static void Execute(const P& params, int n, int k) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Dispatch(2): " << dim_m << "x" << dim_n << "x" << dim_k + << " : " << fixed_m << "x" << variable_n << std::endl + << std::flush; +#endif +#endif + if (n == variable_n) { + Dispatch3DStage3::Execute(params, k); + } else { + Dispatch3DStage2::Execute(params, n, k); + } + } +}; + +template +struct Dispatch3DStage2 { + static void Execute(const P& params, int n, int k) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Dispatch(2): " << dim_m << "x" << dim_n << "x" << dim_k + << " : " << fixed_m << "x" << 0 << std::endl + << std::flush; +#endif +#endif + if (n == 0) { + Dispatch3DStage3::Execute(params, k); + } else { + std::cerr << "FATAL: dispatch3DStage2 failed: ran out of cases." + << std::endl + << std::flush; + std::exit(1); + } + } +}; + +// Stage 1. + +template +struct Dispatch3DStage1 { + static void Execute(const P& params, int m, int n, int k) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Dispatch(1): " << dim_m << "x" << dim_n << "x" << dim_k + << " : " << variable_m << std::endl + << std::flush; +#endif +#endif + if (m == variable_m) { + Dispatch3DStage2::Execute(params, n, k); + } else { + Dispatch3DStage1::Execute( + params, m, n, k); + } + } +}; + +template +struct Dispatch3DStage1 { + static void Execute(const P& params, int m, int n, int k) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Dispatch(1): " << dim_m << "x" << dim_n << "x" << dim_k + << " : " << 0 << std::endl + << std::flush; +#endif +#endif + if (m == 0) { + Dispatch3DStage2::Execute(params, + n, k); + } else { + std::cerr << "FATAL: dispatch3DStage1 failed: ran out of cases." + << std::endl + << std::flush; + std::exit(1); + } + } +}; + +} // namespace internal + +template +inline void Gemm(const Params& params) { + internal::Dispatch3DStage1::Execute(params, params.m % kernel_m, + params.n % kernel_n, + params.k % kernel_k); +} + +} // namespace meta +} // namespace gemmlowp + +#endif // GEMMLOWP_META_SINGLE_THREAD_GEMM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/single_thread_transform.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/single_thread_transform.h new file mode 100644 index 0000000000000000000000000000000000000000..6f79529aab1e6b401ceabca98c488d294825a31d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/single_thread_transform.h @@ -0,0 +1,90 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_SINGLE_THREAD_TRANSFORM_H_ +#define GEMMLOWP_META_SINGLE_THREAD_TRANSFORM_H_ + +#include +#include "base.h" + +namespace gemmlowp { +namespace meta { + +template +void Transform1D(const Params& params); + +namespace internal { + +class Transform1DExecutor { + public: + template + static void ExecuteDispatch1D(const P& params) { + Transform1DKernel::Transform(params.input, params.kernel, + params.output); + } +}; + +template +struct Dispatch1D { + static void Execute(const P& params, int leftovers) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Dispatch(1): " << kernel_size << ":" << variable_leftovers + << std::endl + << std::flush; +#endif +#endif + if (leftovers == variable_leftovers) { + E::template ExecuteDispatch1D(params); + } else { + Dispatch1D::Execute(params, + leftovers); + } + } +}; + +template +struct Dispatch1D { + static void Execute(const P& params, int leftovers) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Dispatch(1): " << kernel_size << ": 0" << std::endl + << std::flush; +#endif +#endif + if (leftovers == 0) { + E::template ExecuteDispatch1D(params); + } else { + std::cerr << "FATAL: dispatch1D failed: ran out of cases." << std::endl + << std::flush; + std::exit(1); + } + } +}; + +} // namespace internal + +template +inline void Transform1D(const Params& params) { + internal::Dispatch1D::Execute(params, params.kernel.count % + kernel_size); +} + +} // namespace meta +} // namespace gemmlowp + +#endif // GEMMLOWP_META_SINGLE_THREAD_TRANSFORM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/streams.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/streams.h new file mode 100644 index 0000000000000000000000000000000000000000..90ae7bb1a2913008c1c99f4d7c1303fda8136b91 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/streams.h @@ -0,0 +1,312 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_STREAMS_H_ +#define GEMMLOWP_META_STREAMS_H_ + +#include +#include +#include "base.h" + +namespace gemmlowp { +namespace meta { + +struct RowMajor { + public: + int count; + int stride; +}; + +struct RowMajorWithSum { + public: + int count; + int stride; + int multiplicative_sum_offset; + int additive_sum_offset; +}; + +struct ColumnMajorWithSum { + public: + int count; + int stride; + int multiplicative_sum_offset; + int additive_sum_offset; +}; + +template +class StreamUtil { + public: + static const InType* Offset(const RowMajor& params, const InType* source, + int offset_stride, int offset_advance) { + return reinterpret_cast( + reinterpret_cast(source) + + offset_stride * params.stride + offset_advance * sizeof(InType)); + } + + static InType* Offset(const RowMajor& params, InType* source, + int offset_stride, int offset_advance) { + return reinterpret_cast(reinterpret_cast(source) + + offset_stride * params.stride + + offset_advance * sizeof(InType)); + } + + static int Scratch(const RowMajor& params, int lanes_count, int pack_size) { + return AlignTo<64>(lanes_count * AlignTo(pack_size, params.stride)); + } +}; + +template +class StreamUtil { + public: + static const InType* Offset(const RowMajorWithSum& params, + const InType* source, int offset_stride, + int offset_advance) { + return reinterpret_cast( + reinterpret_cast(source) + + offset_stride * params.stride + offset_advance * sizeof(InType)); + } + + static InType* Offset(const RowMajorWithSum& params, InType* source, + int offset_stride, int offset_advance) { + return reinterpret_cast(reinterpret_cast(source) + + offset_stride * params.stride + + offset_advance * sizeof(InType)); + } + + static int Scratch(const RowMajorWithSum& params, int lanes_count, + int pack_size) { + return 32 + AlignTo<32>(sizeof(InType) * lanes_count * + AlignTo(pack_size, params.count)); + } +}; + +template +class StreamUtil { + public: + static const InType* Offset(const ColumnMajorWithSum& params, + const InType* source, int offset_stride, + int offset_advance) { + return reinterpret_cast( + reinterpret_cast(source) + + params.stride * offset_advance + offset_stride * sizeof(InType)); + } + + static const InType* Offset(const ColumnMajorWithSum& params, InType* source, + int offset_stride, int offset_advance) { + return reinterpret_cast(reinterpret_cast(source) + + params.stride * offset_advance + + offset_stride * sizeof(InType)); + } + + static int Scratch(const ColumnMajorWithSum& params, int lanes_count, + int pack_size) { + return 32 + AlignTo<32>(sizeof(InType) * lanes_count * + AlignTo(pack_size, params.count)); + } +}; + +template +class Stream { + public: + static void Pack(const InType* in, const RowMajor& params, InType* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "RowMajor(" << std::string(typeid(InType).name()) + << ")::Pack() -- " << lanes_count << "x" << pack_size << " + " + << leftovers << std::endl; +#endif +#else + if (lanes_count != 0) { + std::cerr << "FATAL: RowMajorWithSum::Pack not implemented." << std::endl; + std::exit(1); + } +#endif + } + + static int UnpackedAdvance(const RowMajor& params) { + return sizeof(InType) * pack_size; + } + + static int PackedAdvance(const RowMajor& params) { + return sizeof(InType) * pack_size * lanes_count; + } + + static int UnpackedStride(const RowMajor& params) { + return lanes_count * params.stride; + } + + static int PackedStride(const RowMajor& params) { + return AlignTo<32>(lanes_count * AlignTo(params.stride)); + } + + static int Scratch(const RowMajor& params) { return PackedStride(params); } + +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + static void Debug(const RowMajor& params) { + std::cout << "RowMajor(" << typeid(InType).name() << ")" << std::endl; + std::cout << " dims: " << lanes_count << "x" << pack_size << " + " + << leftovers << std::endl; + std::cout << " scratch: " << Scratch(params) << std::endl; + std::cout << " unpacked advance: " << UnpackedAdvance(params) << std::endl; + std::cout << " packed advance: " << PackedAdvance(params) << std::endl; + std::cout << " unpacked stride: " << UnpackedStride(params) << std::endl; + std::cout << " packed stride: " << PackedStride(params) << std::endl; + std::cout << " params:" << std::endl; + std::cout << " count: " << params.count << std::endl; + std::cout << " stride: " << params.stride << std::endl; + } +#endif +#endif +}; + +template +class Stream { + public: + static void Pack(const InType* in, const RowMajorWithSum& params, + InType* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "RowMajorWithSum(" << typeid(InType).name() << ")::Pack() -- " + << lanes_count << "x" << pack_size << " + " << leftovers + << std::endl; +#endif +#else + if (lanes_count != 0) { + std::cerr << "FATAL: RowMajorWithSum::Pack not implemented." << std::endl; + std::exit(1); + } +#endif + } + + static int UnpackedAdvance(const RowMajorWithSum& params) { + return sizeof(InType) * pack_size; + } + + static int PackedAdvance(const RowMajorWithSum& params) { + return sizeof(InType) * pack_size * lanes_count; + } + + static int UnpackedStride(const RowMajorWithSum& params) { + return sizeof(InType) * lanes_count * params.stride; + } + + static int PackedStride(const RowMajorWithSum& params) { + return 32 + AlignTo<32>(sizeof(InType) * lanes_count * + AlignTo(params.count)); + } + + static int Scratch(const RowMajorWithSum& params) { + return PackedStride(params); + } + +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + static void Debug(const RowMajorWithSum& params) { + std::cout << "RowMajorWithSum(" << typeid(InType).name() << ")" + << std::endl; + std::cout << " dims: " << lanes_count << "x" << pack_size << " + " + << leftovers << std::endl; + std::cout << " scratch: " << Scratch(params) << std::endl; + std::cout << " unpacked advance: " << UnpackedAdvance(params) << std::endl; + std::cout << " packed advance: " << PackedAdvance(params) << std::endl; + std::cout << " unpacked stride: " << UnpackedStride(params) << std::endl; + std::cout << " packed stride: " << PackedStride(params) << std::endl; + std::cout << " params:" << std::endl; + std::cout << " count: " << params.count << std::endl; + std::cout << " stride: " << params.stride << std::endl; + std::cout << " multiplicative_sum_offset: " + << params.multiplicative_sum_offset << std::endl; + std::cout << " additive_sum_offset: " << params.additive_sum_offset + << std::endl; + } +#endif +#endif +}; + +template +class Stream { + public: + static void Pack(const InType* in, const ColumnMajorWithSum& params, + InType* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "ColumnMajorWithSum(" << typeid(InType).name() + << ")::Pack() -- " << lanes_count << "x" << pack_size << " + " + << leftovers << std::endl; +#endif +#else + if (lanes_count != 0) { + std::cerr << "FATAL: ColumnMajorWithSum::Pack not implemented." + << std::endl; + std::exit(1); + } +#endif + } + + static int UnpackedAdvance(const ColumnMajorWithSum& params) { + return sizeof(InType) * pack_size * params.stride; + } + + static int PackedAdvance(const ColumnMajorWithSum& params) { + return sizeof(InType) * pack_size * lanes_count; + } + + static int UnpackedStride(const ColumnMajorWithSum& params) { + return sizeof(InType) * lanes_count; + } + + static int PackedStride(const ColumnMajorWithSum& params) { + return 32 + AlignTo<32>(sizeof(InType) * lanes_count * + AlignTo(params.count)); + } + + static int Scratch(const ColumnMajorWithSum& params) { + return PackedStride(params); + } + +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + static void Debug(const ColumnMajorWithSum& params) { + std::cout << "ColumnMajorWithSum(" << typeid(InType).name() << ")" + << std::endl; + std::cout << " dims: " << lanes_count << "x" << pack_size << " + " + << leftovers << std::endl; + std::cout << " scratch: " << Scratch(params) << std::endl; + std::cout << " unpacked advance: " << UnpackedAdvance(params) << std::endl; + std::cout << " packed advance: " << PackedAdvance(params) << std::endl; + std::cout << " unpacked stride: " << UnpackedStride(params) << std::endl; + std::cout << " packed stride: " << PackedStride(params) << std::endl; + std::cout << " params:" << std::endl; + std::cout << " count: " << params.count << std::endl; + std::cout << " stride: " << params.stride << std::endl; + std::cout << " multiplicative_sum_offset: " + << params.multiplicative_sum_offset << std::endl; + std::cout << " additive_sum_offset: " << params.additive_sum_offset + << std::endl; + } +#endif +#endif +}; + +} // namespace meta +} // namespace gemmlowp + +#ifdef GEMMLOWP_NEON_32 +#include "streams_arm_32.h" +#elif defined(GEMMLOWP_NEON_64) +#include "streams_arm_64.h" +#endif + +#endif // GEMMLOWP_META_STREAMS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/streams_arm_32.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/streams_arm_32.h new file mode 100644 index 0000000000000000000000000000000000000000..8ef4cdd6219b4581029d7001b77100c194249c49 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/streams_arm_32.h @@ -0,0 +1,12248 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_STREAMS_ARM_32_H_ +#define GEMMLOWP_META_STREAMS_ARM_32_H_ + +#ifdef GEMMLOWP_NEON_32 + +#include +#include + +namespace gemmlowp { +namespace meta { + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "vmov.i16 q8, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 1x8. + "vld1.32 {d0}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 1x8. + "vld1.32 {d0}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x1. + "vmov.i8 d0, #0\n" + "vld1.8 {d0[0]}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 1x8. + "vld1.32 {d0}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x2. + "vmov.i8 d0, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 1x8. + "vld1.32 {d0}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x3. + "vmov.i8 d0, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[2]}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 1x8. + "vld1.32 {d0}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x4. + "vmov.i8 d0, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 1x8. + "vld1.32 {d0}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x5. + "vmov.i8 d0, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[4]}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 1x8. + "vld1.32 {d0}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x6. + "vmov.i8 d0, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 1x8. + "vld1.32 {d0}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x7. + "vmov.i8 d0, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.8 {d0[6]}, [%[in]]!\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 2x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 2x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x1. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.8 {d0[0]}, [%[in]]!\n" + "vld1.8 {d1[0]}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 2x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x2. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 2x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x3. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[2]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.8 {d1[2]}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 2x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x4. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 2x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x5. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[4]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.8 {d1[4]}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 2x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x6. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 2x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x7. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.8 {d0[6]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.8 {d1[6]}, [r0]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 3x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 3x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x1. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld1.8 {d0[0]}, [%[in]]!\n" + "vld1.8 {d1[0]}, [r0]!\n" + "vld1.8 {d2[0]}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 3x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x2. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 3x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x3. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[2]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.8 {d1[2]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.8 {d2[2]}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 3x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x4. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 3x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x5. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[4]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.8 {d1[4]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.8 {d2[4]}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 3x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x6. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 3x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x7. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.8 {d0[6]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.8 {d1[6]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.8 {d2[6]}, [r1]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", + "d21", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 4x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 4x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x1. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.8 {d0[0]}, [%[in]]!\n" + "vld1.8 {d1[0]}, [r0]!\n" + "vld1.8 {d2[0]}, [r1]!\n" + "vld1.8 {d3[0]}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 4x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x2. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 4x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x3. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[2]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.8 {d1[2]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.8 {d2[2]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vld1.8 {d3[2]}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 4x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x4. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 4x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x5. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[4]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.8 {d1[4]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.8 {d2[4]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.8 {d3[4]}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 4x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x6. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 4x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x7. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.8 {d0[6]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.8 {d1[6]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.8 {d2[6]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vld1.8 {d3[6]}, [r2]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 5x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "d0", "d1", "d2", "d3", "d4", "d16", "d17", + "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 5x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x1. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.8 {d0[0]}, [%[in]]!\n" + "vld1.8 {d1[0]}, [r0]!\n" + "vld1.8 {d2[0]}, [r1]!\n" + "vld1.8 {d3[0]}, [r2]!\n" + "vld1.8 {d4[0]}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "d0", "d1", "d2", "d3", "d4", "d16", "d17", + "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 5x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x2. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vld1.16 {d4[0]}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "d0", "d1", "d2", "d3", "d4", "d16", "d17", + "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 5x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x3. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[2]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.8 {d1[2]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.8 {d2[2]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vld1.8 {d3[2]}, [r2]!\n" + "vld1.16 {d4[0]}, [r3]!\n" + "vld1.8 {d4[2]}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "d0", "d1", "d2", "d3", "d4", "d16", "d17", + "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 5x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x4. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "d0", "d1", "d2", "d3", "d4", "d16", "d17", + "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 5x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x5. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[4]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.8 {d1[4]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.8 {d2[4]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.8 {d3[4]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.8 {d4[4]}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "d0", "d1", "d2", "d3", "d4", "d16", "d17", + "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 5x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x6. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.16 {d4[2]}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "d0", "d1", "d2", "d3", "d4", "d16", "d17", + "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 5x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x7. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.8 {d0[6]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.8 {d1[6]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.8 {d2[6]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vld1.8 {d3[6]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.16 {d4[2]}, [r3]!\n" + "vld1.8 {d4[6]}, [r3]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "d0", "d1", "d2", "d3", "d4", "d16", "d17", + "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 6x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "d0", "d1", "d2", "d3", "d4", "d5", "d16", + "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", + "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 6x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x1. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.8 {d0[0]}, [%[in]]!\n" + "vld1.8 {d1[0]}, [r0]!\n" + "vld1.8 {d2[0]}, [r1]!\n" + "vld1.8 {d3[0]}, [r2]!\n" + "vld1.8 {d4[0]}, [r3]!\n" + "vld1.8 {d5[0]}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "d0", "d1", "d2", "d3", "d4", "d5", "d16", + "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", + "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 6x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x2. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vld1.16 {d4[0]}, [r3]!\n" + "vld1.16 {d5[0]}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "d0", "d1", "d2", "d3", "d4", "d5", "d16", + "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", + "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 6x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x3. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[2]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.8 {d1[2]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.8 {d2[2]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vld1.8 {d3[2]}, [r2]!\n" + "vld1.16 {d4[0]}, [r3]!\n" + "vld1.8 {d4[2]}, [r3]!\n" + "vld1.16 {d5[0]}, [r4]!\n" + "vld1.8 {d5[2]}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "d0", "d1", "d2", "d3", "d4", "d5", "d16", + "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", + "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 6x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x4. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "d0", "d1", "d2", "d3", "d4", "d5", "d16", + "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", + "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 6x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x5. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[4]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.8 {d1[4]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.8 {d2[4]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.8 {d3[4]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.8 {d4[4]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.8 {d5[4]}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "d0", "d1", "d2", "d3", "d4", "d5", "d16", + "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", + "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 6x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x6. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.16 {d4[2]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.16 {d5[2]}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "d0", "d1", "d2", "d3", "d4", "d5", "d16", + "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", + "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 6x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x7. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.8 {d0[6]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.8 {d1[6]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.8 {d2[6]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vld1.8 {d3[6]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.16 {d4[2]}, [r3]!\n" + "vld1.8 {d4[6]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.16 {d5[2]}, [r4]!\n" + "vld1.8 {d5[6]}, [r4]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "d0", "d1", "d2", "d3", "d4", "d5", "d16", + "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", + "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 7x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", + "d25", "d26", "d27", "d28", "d29", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 7x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x1. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.8 {d0[0]}, [%[in]]!\n" + "vld1.8 {d1[0]}, [r0]!\n" + "vld1.8 {d2[0]}, [r1]!\n" + "vld1.8 {d3[0]}, [r2]!\n" + "vld1.8 {d4[0]}, [r3]!\n" + "vld1.8 {d5[0]}, [r4]!\n" + "vld1.8 {d6[0]}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", + "d25", "d26", "d27", "d28", "d29", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 7x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x2. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vld1.16 {d4[0]}, [r3]!\n" + "vld1.16 {d5[0]}, [r4]!\n" + "vld1.16 {d6[0]}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", + "d25", "d26", "d27", "d28", "d29", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 7x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x3. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[2]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.8 {d1[2]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.8 {d2[2]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vld1.8 {d3[2]}, [r2]!\n" + "vld1.16 {d4[0]}, [r3]!\n" + "vld1.8 {d4[2]}, [r3]!\n" + "vld1.16 {d5[0]}, [r4]!\n" + "vld1.8 {d5[2]}, [r4]!\n" + "vld1.16 {d6[0]}, [r5]!\n" + "vld1.8 {d6[2]}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", + "d25", "d26", "d27", "d28", "d29", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 7x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x4. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.32 {d6[0]}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", + "d25", "d26", "d27", "d28", "d29", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 7x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x5. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[4]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.8 {d1[4]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.8 {d2[4]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.8 {d3[4]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.8 {d4[4]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.8 {d5[4]}, [r4]!\n" + "vld1.32 {d6[0]}, [r5]!\n" + "vld1.8 {d6[4]}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", + "d25", "d26", "d27", "d28", "d29", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 7x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x6. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.16 {d4[2]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.16 {d5[2]}, [r4]!\n" + "vld1.32 {d6[0]}, [r5]!\n" + "vld1.16 {d6[2]}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", + "d25", "d26", "d27", "d28", "d29", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 7x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x7. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.8 {d0[6]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.8 {d1[6]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.8 {d2[6]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vld1.8 {d3[6]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.16 {d4[2]}, [r3]!\n" + "vld1.8 {d4[6]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.16 {d5[2]}, [r4]!\n" + "vld1.8 {d5[6]}, [r4]!\n" + "vld1.32 {d6[0]}, [r5]!\n" + "vld1.16 {d6[2]}, [r5]!\n" + "vld1.8 {d6[6]}, [r5]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", + "d25", "d26", "d27", "d28", "d29", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "add r6, r5, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 8x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vld1.32 {d7}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "add r6, r5, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 8x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vld1.32 {d7}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x1. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.8 {d0[0]}, [%[in]]!\n" + "vld1.8 {d1[0]}, [r0]!\n" + "vld1.8 {d2[0]}, [r1]!\n" + "vld1.8 {d3[0]}, [r2]!\n" + "vld1.8 {d4[0]}, [r3]!\n" + "vld1.8 {d5[0]}, [r4]!\n" + "vld1.8 {d6[0]}, [r5]!\n" + "vld1.8 {d7[0]}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "add r6, r5, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 8x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vld1.32 {d7}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x2. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vld1.16 {d4[0]}, [r3]!\n" + "vld1.16 {d5[0]}, [r4]!\n" + "vld1.16 {d6[0]}, [r5]!\n" + "vld1.16 {d7[0]}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "add r6, r5, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 8x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vld1.32 {d7}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x3. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.16 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[2]}, [%[in]]!\n" + "vld1.16 {d1[0]}, [r0]!\n" + "vld1.8 {d1[2]}, [r0]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.8 {d2[2]}, [r1]!\n" + "vld1.16 {d3[0]}, [r2]!\n" + "vld1.8 {d3[2]}, [r2]!\n" + "vld1.16 {d4[0]}, [r3]!\n" + "vld1.8 {d4[2]}, [r3]!\n" + "vld1.16 {d5[0]}, [r4]!\n" + "vld1.8 {d5[2]}, [r4]!\n" + "vld1.16 {d6[0]}, [r5]!\n" + "vld1.8 {d6[2]}, [r5]!\n" + "vld1.16 {d7[0]}, [r6]!\n" + "vld1.8 {d7[2]}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "add r6, r5, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 8x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vld1.32 {d7}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x4. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.32 {d6[0]}, [r5]!\n" + "vld1.32 {d7[0]}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "add r6, r5, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 8x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vld1.32 {d7}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x5. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d0[4]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.8 {d1[4]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.8 {d2[4]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.8 {d3[4]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.8 {d4[4]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.8 {d5[4]}, [r4]!\n" + "vld1.32 {d6[0]}, [r5]!\n" + "vld1.8 {d6[4]}, [r5]!\n" + "vld1.32 {d7[0]}, [r6]!\n" + "vld1.8 {d7[4]}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "add r6, r5, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 8x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vld1.32 {d7}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x6. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.16 {d4[2]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.16 {d5[2]}, [r4]!\n" + "vld1.32 {d6[0]}, [r5]!\n" + "vld1.16 {d6[2]}, [r5]!\n" + "vld1.32 {d7[0]}, [r6]!\n" + "vld1.16 {d7[2]}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add r0, %[in], %[stride]\n" + "add r1, r0, %[stride]\n" + "add r2, r1, %[stride]\n" + "add r3, r2, %[stride]\n" + "add r4, r3, %[stride]\n" + "add r5, r4, %[stride]\n" + "add r6, r5, %[stride]\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store: 8x8. + "vld1.32 {d0}, [%[in]]!\n" + "vld1.32 {d1}, [r0]!\n" + "vld1.32 {d2}, [r1]!\n" + "vld1.32 {d3}, [r2]!\n" + "vld1.32 {d4}, [r3]!\n" + "vld1.32 {d5}, [r4]!\n" + "vld1.32 {d6}, [r5]!\n" + "vld1.32 {d7}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x7. + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d0[2]}, [%[in]]!\n" + "vld1.8 {d0[6]}, [%[in]]!\n" + "vld1.32 {d1[0]}, [r0]!\n" + "vld1.16 {d1[2]}, [r0]!\n" + "vld1.8 {d1[6]}, [r0]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "vld1.16 {d2[2]}, [r1]!\n" + "vld1.8 {d2[6]}, [r1]!\n" + "vld1.32 {d3[0]}, [r2]!\n" + "vld1.16 {d3[2]}, [r2]!\n" + "vld1.8 {d3[6]}, [r2]!\n" + "vld1.32 {d4[0]}, [r3]!\n" + "vld1.16 {d4[2]}, [r3]!\n" + "vld1.8 {d4[6]}, [r3]!\n" + "vld1.32 {d5[0]}, [r4]!\n" + "vld1.16 {d5[2]}, [r4]!\n" + "vld1.8 {d5[6]}, [r4]!\n" + "vld1.32 {d6[0]}, [r5]!\n" + "vld1.16 {d6[2]}, [r5]!\n" + "vld1.8 {d6[6]}, [r5]!\n" + "vld1.32 {d7[0]}, [r6]!\n" + "vld1.16 {d7[2]}, [r6]!\n" + "vld1.8 {d7[6]}, [r6]!\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "ldr r0, %[multiplicative_sum_offset]\n" + "ldr r1, %[additive_sum_offset]\n" + "vmov.32 d0[0], r0\n" + "vdup.32 q1, r1\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "vld1.8 {d0[6]}, [%[in]], %[stride]\n" + "vld1.8 {d0[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "vld1.8 {d0[6]}, [%[in]], %[stride]\n" + "vld1.8 {d0[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x1 + "vmov.i8 d0, #0\n" + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "vld1.8 {d0[6]}, [%[in]], %[stride]\n" + "vld1.8 {d0[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x2 + "vmov.i8 d0, #0\n" + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "vld1.8 {d0[6]}, [%[in]], %[stride]\n" + "vld1.8 {d0[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x3 + "vmov.i8 d0, #0\n" + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "vld1.8 {d0[6]}, [%[in]], %[stride]\n" + "vld1.8 {d0[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x4 + "vmov.i8 d0, #0\n" + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "vld1.8 {d0[6]}, [%[in]], %[stride]\n" + "vld1.8 {d0[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x5 + "vmov.i8 d0, #0\n" + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "vld1.8 {d0[6]}, [%[in]], %[stride]\n" + "vld1.8 {d0[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x6 + "vmov.i8 d0, #0\n" + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "vld1.8 {d0[6]}, [%[in]], %[stride]\n" + "vld1.8 {d0[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x7 + "vmov.i8 d0, #0\n" + "vld1.8 {d0[0]}, [%[in]], %[stride]\n" + "vld1.8 {d0[1]}, [%[in]], %[stride]\n" + "vld1.8 {d0[2]}, [%[in]], %[stride]\n" + "vld1.8 {d0[3]}, [%[in]], %[stride]\n" + "vld1.8 {d0[4]}, [%[in]], %[stride]\n" + "vld1.8 {d0[5]}, [%[in]], %[stride]\n" + "vld1.8 {d0[6]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vaddw.u8 q8, q8, d0\n" + "vst1.32 {d0}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d16, d16, d16\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d2", "d3", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "vld1.16 {d1[2]}, [%[in]], %[stride]\n" + "vld1.16 {d1[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "vld1.16 {d1[2]}, [%[in]], %[stride]\n" + "vld1.16 {d1[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x1 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "vld1.16 {d1[2]}, [%[in]], %[stride]\n" + "vld1.16 {d1[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x2 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "vld1.16 {d1[2]}, [%[in]], %[stride]\n" + "vld1.16 {d1[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x3 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "vld1.16 {d1[2]}, [%[in]], %[stride]\n" + "vld1.16 {d1[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x4 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "vld1.16 {d1[2]}, [%[in]], %[stride]\n" + "vld1.16 {d1[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x5 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "vld1.16 {d1[2]}, [%[in]], %[stride]\n" + "vld1.16 {d1[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x6 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "vld1.16 {d1[2]}, [%[in]], %[stride]\n" + "vld1.16 {d1[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x7 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vld1.16 {d0[0]}, [%[in]], %[stride]\n" + "vld1.16 {d0[1]}, [%[in]], %[stride]\n" + "vld1.16 {d0[2]}, [%[in]], %[stride]\n" + "vld1.16 {d0[3]}, [%[in]], %[stride]\n" + "vld1.16 {d1[0]}, [%[in]], %[stride]\n" + "vld1.16 {d1[1]}, [%[in]], %[stride]\n" + "vld1.16 {d1[2]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vuzp.8 d0, d1\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vst1.32 {d0, d1}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d16, d16, d18\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vld3.8 {d0[6], d1[6], d2[6]}, [%[in]], %[stride]\n" + "vld3.8 {d0[7], d1[7], d2[7]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vld3.8 {d0[6], d1[6], d2[6]}, [%[in]], %[stride]\n" + "vld3.8 {d0[7], d1[7], d2[7]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x1 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vld3.8 {d0[6], d1[6], d2[6]}, [%[in]], %[stride]\n" + "vld3.8 {d0[7], d1[7], d2[7]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x2 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vld3.8 {d0[6], d1[6], d2[6]}, [%[in]], %[stride]\n" + "vld3.8 {d0[7], d1[7], d2[7]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x3 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vld3.8 {d0[6], d1[6], d2[6]}, [%[in]], %[stride]\n" + "vld3.8 {d0[7], d1[7], d2[7]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x4 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vld3.8 {d0[6], d1[6], d2[6]}, [%[in]], %[stride]\n" + "vld3.8 {d0[7], d1[7], d2[7]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x5 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vld3.8 {d0[6], d1[6], d2[6]}, [%[in]], %[stride]\n" + "vld3.8 {d0[7], d1[7], d2[7]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x6 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vld3.8 {d0[6], d1[6], d2[6]}, [%[in]], %[stride]\n" + "vld3.8 {d0[7], d1[7], d2[7]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x7 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vld3.8 {d0[0], d1[0], d2[0]}, [%[in]], %[stride]\n" + "vld3.8 {d0[1], d1[1], d2[1]}, [%[in]], %[stride]\n" + "vld3.8 {d0[2], d1[2], d2[2]}, [%[in]], %[stride]\n" + "vld3.8 {d0[3], d1[3], d2[3]}, [%[in]], %[stride]\n" + "vld3.8 {d0[4], d1[4], d2[4]}, [%[in]], %[stride]\n" + "vld3.8 {d0[5], d1[5], d2[5]}, [%[in]], %[stride]\n" + "vld3.8 {d0[6], d1[6], d2[6]}, [%[in]], %[stride]\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vst1.32 {d0, d1, d2}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d20\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "cc", + "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x1 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x2 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x3 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x4 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x5 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x6 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x7 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vld1.32 {d0[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vmul.i32 q8, q8, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vst1.32 {d16, d17}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19", "d20", "d21", "d22", + "d23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.8 {d4[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.8 {d4[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d16", "d17", "d18", "d19", "d20", "d21", + "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.8 {d4[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.8 {d4[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x1 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d16", "d17", "d18", "d19", "d20", "d21", + "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.8 {d4[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.8 {d4[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x2 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d16", "d17", "d18", "d19", "d20", "d21", + "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.8 {d4[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.8 {d4[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x3 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d16", "d17", "d18", "d19", "d20", "d21", + "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.8 {d4[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.8 {d4[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x4 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d16", "d17", "d18", "d19", "d20", "d21", + "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.8 {d4[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.8 {d4[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x5 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d16", "d17", "d18", "d19", "d20", "d21", + "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.8 {d4[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.8 {d4[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x6 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d16", "d17", "d18", "d19", "d20", "d21", + "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.8 {d4[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.8 {d4[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x7 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.8 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.8 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.8 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.8 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.8 {d4[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.8 {d4[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.8 {d4[6]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d24\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d16", "d17", "d18", "d19", "d20", "d21", + "d22", "d23", "d24", "d25", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.16 {d5[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.16 {d5[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.16 {d5[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.16 {d5[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x1 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.16 {d5[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.16 {d5[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x2 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.16 {d5[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.16 {d5[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x3 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.16 {d5[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.16 {d5[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x4 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.16 {d5[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.16 {d5[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x5 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.16 {d5[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.16 {d5[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x6 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.16 {d5[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld1.16 {d5[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x7 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld1.16 {d4[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld1.16 {d4[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld1.16 {d4[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld1.16 {d4[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld1.16 {d5[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld1.16 {d5[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld1.16 {d5[2]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vuzp.8 d4, d5\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:128]!\n" + "vst1.32 {d4, d5}, [%[out]:128]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:128]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d16", "d17", "d18", "d19", "d20", + "d21", "d22", "d23", "d24", "d25", "d26", "d27", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld3.8 {d4[6], d5[6], d6[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld3.8 {d4[7], d5[7], d6[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld3.8 {d4[6], d5[6], d6[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld3.8 {d4[7], d5[7], d6[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x1 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld3.8 {d4[6], d5[6], d6[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld3.8 {d4[7], d5[7], d6[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x2 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld3.8 {d4[6], d5[6], d6[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld3.8 {d4[7], d5[7], d6[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x3 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld3.8 {d4[6], d5[6], d6[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld3.8 {d4[7], d5[7], d6[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x4 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld3.8 {d4[6], d5[6], d6[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld3.8 {d4[7], d5[7], d6[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x5 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld3.8 {d4[6], d5[6], d6[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld3.8 {d4[7], d5[7], d6[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x6 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %[stride], %[stride], #4\n" + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld3.8 {d4[6], d5[6], d6[6]}, [%[in]], %[stride]\n" + "vld1.32 {d3[1]}, [%[in]]!\n" + "vld3.8 {d4[7], d5[7], d6[7]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x7 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vld1.32 {d0[0]}, [%[in]]!\n" + "vld3.8 {d4[0], d5[0], d6[0]}, [%[in]], %[stride]\n" + "vld1.32 {d1[0]}, [%[in]]!\n" + "vld3.8 {d4[1], d5[1], d6[1]}, [%[in]], %[stride]\n" + "vld1.32 {d2[0]}, [%[in]]!\n" + "vld3.8 {d4[2], d5[2], d6[2]}, [%[in]], %[stride]\n" + "vld1.32 {d3[0]}, [%[in]]!\n" + "vld3.8 {d4[3], d5[3], d6[3]}, [%[in]], %[stride]\n" + "vld1.32 {d0[1]}, [%[in]]!\n" + "vld3.8 {d4[4], d5[4], d6[4]}, [%[in]], %[stride]\n" + "vld1.32 {d1[1]}, [%[in]]!\n" + "vld3.8 {d4[5], d5[5], d6[5]}, [%[in]], %[stride]\n" + "vld1.32 {d2[1]}, [%[in]]!\n" + "vld3.8 {d4[6], d5[6], d6[6]}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:64]!\n" + "vst1.32 {d4, d5, d6}, [%[out]:64]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d28\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:64]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "vld1.32 {d6}, [%[in]], %[stride]\n" + "vld1.32 {d7}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d16", "d17", "d18", + "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", + "d29", "d30", "d31", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "vld1.32 {d6}, [%[in]], %[stride]\n" + "vld1.32 {d7}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x1 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d16", "d17", "d18", + "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", + "d29", "d30", "d31", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "vld1.32 {d6}, [%[in]], %[stride]\n" + "vld1.32 {d7}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x2 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d16", "d17", "d18", + "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", + "d29", "d30", "d31", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "vld1.32 {d6}, [%[in]], %[stride]\n" + "vld1.32 {d7}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x3 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d16", "d17", "d18", + "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", + "d29", "d30", "d31", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "vld1.32 {d6}, [%[in]], %[stride]\n" + "vld1.32 {d7}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x4 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d16", "d17", "d18", + "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", + "d29", "d30", "d31", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "vld1.32 {d6}, [%[in]], %[stride]\n" + "vld1.32 {d7}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x5 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d16", "d17", "d18", + "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", + "d29", "d30", "d31", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "vld1.32 {d6}, [%[in]], %[stride]\n" + "vld1.32 {d7}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x6 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d16", "d17", "d18", + "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", + "d29", "d30", "d31", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "vmov.i16 q8, #0\n" + "vmov.i16 q9, #0\n" + "vmov.i16 q10, #0\n" + "vmov.i16 q11, #0\n" + "vmov.i16 q12, #0\n" + "vmov.i16 q13, #0\n" + "vmov.i16 q14, #0\n" + "vmov.i16 q15, #0\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "vld1.32 {d6}, [%[in]], %[stride]\n" + "vld1.32 {d7}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x7 + "vmov.i8 d0, #0\n" + "vmov.i8 d1, #0\n" + "vmov.i8 d2, #0\n" + "vmov.i8 d3, #0\n" + "vmov.i8 d4, #0\n" + "vmov.i8 d5, #0\n" + "vmov.i8 d6, #0\n" + "vmov.i8 d7, #0\n" + "vld1.32 {d0}, [%[in]], %[stride]\n" + "vld1.32 {d1}, [%[in]], %[stride]\n" + "vld1.32 {d2}, [%[in]], %[stride]\n" + "vld1.32 {d3}, [%[in]], %[stride]\n" + "vld1.32 {d4}, [%[in]], %[stride]\n" + "vld1.32 {d5}, [%[in]], %[stride]\n" + "vld1.32 {d6}, [%[in]], %[stride]\n" + "pld [%[in]]\n" + "vtrn.8 d0, d1\n" + "vtrn.8 d2, d3\n" + "vtrn.8 d4, d5\n" + "vtrn.8 d6, d7\n" + "vtrn.16 d0, d2\n" + "vtrn.16 d1, d3\n" + "vtrn.16 d4, d6\n" + "vtrn.16 d5, d7\n" + "vtrn.32 d0, d4\n" + "vtrn.32 d1, d5\n" + "vtrn.32 d2, d6\n" + "vtrn.32 d3, d7\n" + "vaddw.u8 q8, q8, d0\n" + "vaddw.u8 q9, q9, d1\n" + "vaddw.u8 q10, q10, d2\n" + "vaddw.u8 q11, q11, d3\n" + "vaddw.u8 q12, q12, d4\n" + "vaddw.u8 q13, q13, d5\n" + "vaddw.u8 q14, q14, d6\n" + "vaddw.u8 q15, q15, d7\n" + "vst1.32 {d0, d1, d2, d3}, [%[out]:256]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[out]:256]!\n" + + // Aggregator Reduction. + "vmov.32 d0[0], %[multiplicative_sum_offset]\n" + "vdup.32 q1, %[additive_sum_offset]\n" + "vpaddl.u16 q8, q8\n" + "vpaddl.u16 q9, q9\n" + "vpaddl.u16 q10, q10\n" + "vpaddl.u16 q11, q11\n" + "vpaddl.u16 q12, q12\n" + "vpaddl.u16 q13, q13\n" + "vpaddl.u16 q14, q14\n" + "vpaddl.u16 q15, q15\n" + "vpadd.u32 d16, d16, d17\n" + "vpadd.u32 d18, d18, d19\n" + "vpadd.u32 d20, d20, d21\n" + "vpadd.u32 d22, d22, d23\n" + "vpadd.u32 d24, d24, d25\n" + "vpadd.u32 d26, d26, d27\n" + "vpadd.u32 d28, d28, d29\n" + "vpadd.u32 d30, d30, d31\n" + "vpadd.u32 d16, d16, d18\n" + "vpadd.u32 d17, d20, d22\n" + "vpadd.u32 d18, d24, d26\n" + "vpadd.u32 d19, d28, d30\n" + "vmul.i32 q8, q8, d0[0]\n" + "vmul.i32 q9, q9, d0[0]\n" + "vadd.i32 q8, q8, q1\n" + "vadd.i32 q9, q9, q1\n" + "vst1.32 {d16, d17, d18, d19}, [%[out]:256]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d16", "d17", "d18", + "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", + "d29", "d30", "d31", "cc", "memory"); +} + +} // namespace meta +} // namespace gemmlowp + +#else +#warning "Meta gemm for arm32 requires: GEMMLOWP_NEON_32!" +#endif + +#endif // GEMMLOWP_META_STREAMS_ARM_32_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/streams_arm_64.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/streams_arm_64.h new file mode 100644 index 0000000000000000000000000000000000000000..c17d33615fd0d7601824baab43b980c35618139b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/streams_arm_64.h @@ -0,0 +1,12273 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_STREAMS_ARM_64_H_ +#define GEMMLOWP_META_STREAMS_ARM_64_H_ + +#ifdef GEMMLOWP_NEON_64 + +#include +#include + +namespace gemmlowp { +namespace meta { + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "movi v8.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 1x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 1x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x1. + "movi v0.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 1x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x2. + "movi v0.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 1x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x3. + "movi v0.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v0.b}[2], [%x[in]], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 1x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x4. + "movi v0.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 1x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x5. + "movi v0.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.b}[4], [%x[in]], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 1x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x6. + "movi v0.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 1x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 1x7. + "movi v0.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v0.b}[6], [%x[in]], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 2x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "v8", "v9", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 2x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x1. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], #1\n" + "ld1 {v1.b}[0], [x0], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "v8", "v9", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 2x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x2. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v1.h}[0], [x0], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "v8", "v9", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 2x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x3. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v0.b}[2], [%x[in]], #1\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v1.b}[2], [x0], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "v8", "v9", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 2x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x4. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v1.s}[0], [x0], #4\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "v8", "v9", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 2x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x5. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.b}[4], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.b}[4], [x0], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "v8", "v9", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 2x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x6. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "v8", "v9", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 2x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 2x7. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v0.b}[6], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v1.b}[6], [x0], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "st1 {v0.2s, v1.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "v8", "v9", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 3x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 3x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x1. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], #1\n" + "ld1 {v1.b}[0], [x0], #1\n" + "ld1 {v2.b}[0], [x1], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 3x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x2. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v2.h}[0], [x1], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 3x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x3. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v0.b}[2], [%x[in]], #1\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v1.b}[2], [x0], #1\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v2.b}[2], [x1], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 3x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x4. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v2.s}[0], [x1], #4\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 3x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x5. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.b}[4], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.b}[4], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.b}[4], [x1], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 3x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x6. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 3x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 3x7. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v0.b}[6], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v1.b}[6], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v2.b}[6], [x1], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 4x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 4x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x1. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], #1\n" + "ld1 {v1.b}[0], [x0], #1\n" + "ld1 {v2.b}[0], [x1], #1\n" + "ld1 {v3.b}[0], [x2], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 4x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x2. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v3.h}[0], [x2], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 4x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x3. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v0.b}[2], [%x[in]], #1\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v1.b}[2], [x0], #1\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v2.b}[2], [x1], #1\n" + "ld1 {v3.h}[0], [x2], #2\n" + "ld1 {v3.b}[2], [x2], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 4x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x4. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v3.s}[0], [x2], #4\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 4x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x5. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.b}[4], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.b}[4], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.b}[4], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.b}[4], [x2], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 4x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x6. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 4x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 4x7. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v0.b}[6], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v1.b}[6], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v2.b}[6], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "ld1 {v3.b}[6], [x2], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 5x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 5x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x1. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], #1\n" + "ld1 {v1.b}[0], [x0], #1\n" + "ld1 {v2.b}[0], [x1], #1\n" + "ld1 {v3.b}[0], [x2], #1\n" + "ld1 {v4.b}[0], [x3], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 5x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x2. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v3.h}[0], [x2], #2\n" + "ld1 {v4.h}[0], [x3], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 5x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x3. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v0.b}[2], [%x[in]], #1\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v1.b}[2], [x0], #1\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v2.b}[2], [x1], #1\n" + "ld1 {v3.h}[0], [x2], #2\n" + "ld1 {v3.b}[2], [x2], #1\n" + "ld1 {v4.h}[0], [x3], #2\n" + "ld1 {v4.b}[2], [x3], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 5x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x4. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v4.s}[0], [x3], #4\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 5x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x5. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.b}[4], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.b}[4], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.b}[4], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.b}[4], [x2], #1\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.b}[4], [x3], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 5x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x6. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.h}[2], [x3], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 5x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 5x7. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v0.b}[6], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v1.b}[6], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v2.b}[6], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "ld1 {v3.b}[6], [x2], #1\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.h}[2], [x3], #2\n" + "ld1 {v4.b}[6], [x3], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "v0", "v1", "v2", "v3", "v4", "v8", "v9", "v10", + "v11", "v12", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 6x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "v0", "v1", "v2", "v3", "v4", "v5", "v8", + "v9", "v10", "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 6x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x1. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], #1\n" + "ld1 {v1.b}[0], [x0], #1\n" + "ld1 {v2.b}[0], [x1], #1\n" + "ld1 {v3.b}[0], [x2], #1\n" + "ld1 {v4.b}[0], [x3], #1\n" + "ld1 {v5.b}[0], [x4], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "v0", "v1", "v2", "v3", "v4", "v5", "v8", + "v9", "v10", "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 6x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x2. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v3.h}[0], [x2], #2\n" + "ld1 {v4.h}[0], [x3], #2\n" + "ld1 {v5.h}[0], [x4], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "v0", "v1", "v2", "v3", "v4", "v5", "v8", + "v9", "v10", "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 6x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x3. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v0.b}[2], [%x[in]], #1\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v1.b}[2], [x0], #1\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v2.b}[2], [x1], #1\n" + "ld1 {v3.h}[0], [x2], #2\n" + "ld1 {v3.b}[2], [x2], #1\n" + "ld1 {v4.h}[0], [x3], #2\n" + "ld1 {v4.b}[2], [x3], #1\n" + "ld1 {v5.h}[0], [x4], #2\n" + "ld1 {v5.b}[2], [x4], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "v0", "v1", "v2", "v3", "v4", "v5", "v8", + "v9", "v10", "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 6x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x4. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v5.s}[0], [x4], #4\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "v0", "v1", "v2", "v3", "v4", "v5", "v8", + "v9", "v10", "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 6x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x5. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.b}[4], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.b}[4], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.b}[4], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.b}[4], [x2], #1\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.b}[4], [x3], #1\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v5.b}[4], [x4], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "v0", "v1", "v2", "v3", "v4", "v5", "v8", + "v9", "v10", "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 6x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x6. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.h}[2], [x3], #2\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v5.h}[2], [x4], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "v0", "v1", "v2", "v3", "v4", "v5", "v8", + "v9", "v10", "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 6x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 6x7. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v0.b}[6], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v1.b}[6], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v2.b}[6], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "ld1 {v3.b}[6], [x2], #1\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.h}[2], [x3], #2\n" + "ld1 {v4.b}[6], [x3], #1\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v5.h}[2], [x4], #2\n" + "ld1 {v5.b}[6], [x4], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset), + [additive_sum_offset] "r"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "v0", "v1", "v2", "v3", "v4", "v5", "v8", + "v9", "v10", "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 7x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "v0", "v1", "v2", "v3", "v4", "v5", + "v6", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 7x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x1. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], #1\n" + "ld1 {v1.b}[0], [x0], #1\n" + "ld1 {v2.b}[0], [x1], #1\n" + "ld1 {v3.b}[0], [x2], #1\n" + "ld1 {v4.b}[0], [x3], #1\n" + "ld1 {v5.b}[0], [x4], #1\n" + "ld1 {v6.b}[0], [x5], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "v0", "v1", "v2", "v3", "v4", "v5", + "v6", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 7x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x2. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v3.h}[0], [x2], #2\n" + "ld1 {v4.h}[0], [x3], #2\n" + "ld1 {v5.h}[0], [x4], #2\n" + "ld1 {v6.h}[0], [x5], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "v0", "v1", "v2", "v3", "v4", "v5", + "v6", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 7x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x3. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v0.b}[2], [%x[in]], #1\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v1.b}[2], [x0], #1\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v2.b}[2], [x1], #1\n" + "ld1 {v3.h}[0], [x2], #2\n" + "ld1 {v3.b}[2], [x2], #1\n" + "ld1 {v4.h}[0], [x3], #2\n" + "ld1 {v4.b}[2], [x3], #1\n" + "ld1 {v5.h}[0], [x4], #2\n" + "ld1 {v5.b}[2], [x4], #1\n" + "ld1 {v6.h}[0], [x5], #2\n" + "ld1 {v6.b}[2], [x5], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "v0", "v1", "v2", "v3", "v4", "v5", + "v6", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 7x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x4. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v6.s}[0], [x5], #4\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "v0", "v1", "v2", "v3", "v4", "v5", + "v6", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 7x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x5. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.b}[4], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.b}[4], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.b}[4], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.b}[4], [x2], #1\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.b}[4], [x3], #1\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v5.b}[4], [x4], #1\n" + "ld1 {v6.s}[0], [x5], #4\n" + "ld1 {v6.b}[4], [x5], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "v0", "v1", "v2", "v3", "v4", "v5", + "v6", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 7x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x6. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.h}[2], [x3], #2\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v5.h}[2], [x4], #2\n" + "ld1 {v6.s}[0], [x5], #4\n" + "ld1 {v6.h}[2], [x5], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "v0", "v1", "v2", "v3", "v4", "v5", + "v6", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 7x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 7x7. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v0.b}[6], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v1.b}[6], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v2.b}[6], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "ld1 {v3.b}[6], [x2], #1\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.h}[2], [x3], #2\n" + "ld1 {v4.b}[6], [x3], #1\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v5.h}[2], [x4], #2\n" + "ld1 {v5.b}[6], [x4], #1\n" + "ld1 {v6.s}[0], [x5], #4\n" + "ld1 {v6.h}[2], [x5], #2\n" + "ld1 {v6.b}[6], [x5], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "v0", "v1", "v2", "v3", "v4", "v5", + "v6", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "add x6, x5, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 8x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "ld1 {v7.2s}, [x6], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "v0", "v1", "v2", "v3", "v4", + "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "add x6, x5, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 8x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "ld1 {v7.2s}, [x6], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x1. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], #1\n" + "ld1 {v1.b}[0], [x0], #1\n" + "ld1 {v2.b}[0], [x1], #1\n" + "ld1 {v3.b}[0], [x2], #1\n" + "ld1 {v4.b}[0], [x3], #1\n" + "ld1 {v5.b}[0], [x4], #1\n" + "ld1 {v6.b}[0], [x5], #1\n" + "ld1 {v7.b}[0], [x6], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "v0", "v1", "v2", "v3", "v4", + "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "add x6, x5, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 8x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "ld1 {v7.2s}, [x6], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x2. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v3.h}[0], [x2], #2\n" + "ld1 {v4.h}[0], [x3], #2\n" + "ld1 {v5.h}[0], [x4], #2\n" + "ld1 {v6.h}[0], [x5], #2\n" + "ld1 {v7.h}[0], [x6], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "v0", "v1", "v2", "v3", "v4", + "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "add x6, x5, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 8x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "ld1 {v7.2s}, [x6], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x3. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], #2\n" + "ld1 {v0.b}[2], [%x[in]], #1\n" + "ld1 {v1.h}[0], [x0], #2\n" + "ld1 {v1.b}[2], [x0], #1\n" + "ld1 {v2.h}[0], [x1], #2\n" + "ld1 {v2.b}[2], [x1], #1\n" + "ld1 {v3.h}[0], [x2], #2\n" + "ld1 {v3.b}[2], [x2], #1\n" + "ld1 {v4.h}[0], [x3], #2\n" + "ld1 {v4.b}[2], [x3], #1\n" + "ld1 {v5.h}[0], [x4], #2\n" + "ld1 {v5.b}[2], [x4], #1\n" + "ld1 {v6.h}[0], [x5], #2\n" + "ld1 {v6.b}[2], [x5], #1\n" + "ld1 {v7.h}[0], [x6], #2\n" + "ld1 {v7.b}[2], [x6], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "v0", "v1", "v2", "v3", "v4", + "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "add x6, x5, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 8x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "ld1 {v7.2s}, [x6], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x4. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v6.s}[0], [x5], #4\n" + "ld1 {v7.s}[0], [x6], #4\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "v0", "v1", "v2", "v3", "v4", + "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "add x6, x5, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 8x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "ld1 {v7.2s}, [x6], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x5. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.b}[4], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.b}[4], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.b}[4], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.b}[4], [x2], #1\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.b}[4], [x3], #1\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v5.b}[4], [x4], #1\n" + "ld1 {v6.s}[0], [x5], #4\n" + "ld1 {v6.b}[4], [x5], #1\n" + "ld1 {v7.s}[0], [x6], #4\n" + "ld1 {v7.b}[4], [x6], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "v0", "v1", "v2", "v3", "v4", + "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "add x6, x5, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 8x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "ld1 {v7.2s}, [x6], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x6. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.h}[2], [x3], #2\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v5.h}[2], [x4], #2\n" + "ld1 {v6.s}[0], [x5], #4\n" + "ld1 {v6.h}[2], [x5], #2\n" + "ld1 {v7.s}[0], [x6], #4\n" + "ld1 {v7.h}[2], [x6], #2\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "v0", "v1", "v2", "v3", "v4", + "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const RowMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") RowMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + "add x0, %x[in], %x[stride]\n" + "add x1, x0, %x[stride]\n" + "add x2, x1, %x[stride]\n" + "add x3, x2, %x[stride]\n" + "add x4, x3, %x[stride]\n" + "add x5, x4, %x[stride]\n" + "add x6, x5, %x[stride]\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store: 8x8. + "ld1 {v0.2s}, [%x[in]], #8\n" + "ld1 {v1.2s}, [x0], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "ld1 {v3.2s}, [x2], #8\n" + "ld1 {v4.2s}, [x3], #8\n" + "ld1 {v5.2s}, [x4], #8\n" + "ld1 {v6.2s}, [x5], #8\n" + "ld1 {v7.2s}, [x6], #8\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store: 8x7. + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v0.h}[2], [%x[in]], #2\n" + "ld1 {v0.b}[6], [%x[in]], #1\n" + "ld1 {v1.s}[0], [x0], #4\n" + "ld1 {v1.h}[2], [x0], #2\n" + "ld1 {v1.b}[6], [x0], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v2.b}[6], [x1], #1\n" + "ld1 {v3.s}[0], [x2], #4\n" + "ld1 {v3.h}[2], [x2], #2\n" + "ld1 {v3.b}[6], [x2], #1\n" + "ld1 {v4.s}[0], [x3], #4\n" + "ld1 {v4.h}[2], [x3], #2\n" + "ld1 {v4.b}[6], [x3], #1\n" + "ld1 {v5.s}[0], [x4], #4\n" + "ld1 {v5.h}[2], [x4], #2\n" + "ld1 {v5.b}[6], [x4], #1\n" + "ld1 {v6.s}[0], [x5], #4\n" + "ld1 {v6.h}[2], [x5], #2\n" + "ld1 {v6.b}[6], [x5], #1\n" + "ld1 {v7.s}[0], [x6], #4\n" + "ld1 {v7.h}[2], [x6], #2\n" + "ld1 {v7.b}[6], [x6], #1\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "uaddw v15.8h, v15.8h, v7.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s, v7.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "ldr w0, %[multiplicative_sum_offset]\n" + "ldr w1, %[additive_sum_offset]\n" + "mov v0.s[0], w0\n" + "dup v1.4s, w1\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [in] "+r"(in), [out] "+r"(out) + : [stride] "r"(params.stride), + [multiplicative_sum_offset] "m"(params.multiplicative_sum_offset), + [additive_sum_offset] "m"(params.additive_sum_offset) + : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "v0", "v1", "v2", "v3", "v4", + "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", + "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x1 + "movi v0.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x2 + "movi v0.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x3 + "movi v0.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x4 + "movi v0.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x5 + "movi v0.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x6 + "movi v0.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 1x8 + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 1x7 + "movi v0.8b, #0\n" + "ld1 {v0.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v0.b}[6], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "st1 {v0.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "addp v8.4s, v8.4s, v8.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v8", "v0", "v1", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x1 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x2 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x3 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x4 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x5 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x6 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 2x8 + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 2x7 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "ld1 {v0.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v0.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.h}[2], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uzp1 v2.8b, v0.8b, v1.8b\n" + "uzp2 v3.8b, v0.8b, v1.8b\n" + "uaddw v8.8h, v8.8h, v2.8b\n" + "uaddw v9.8h, v9.8h, v3.8b\n" + "st1 {v2.2s, v3.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v8.4s, v8.4s, v8.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[6], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[6], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x1 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[6], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x2 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[6], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x3 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[6], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x4 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[6], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x5 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[6], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x6 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 3x8 + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[6], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 3x7 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "ld3 {v0.b, v1.b, v2.b}[0], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[1], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[2], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[3], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[4], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[5], [%x[in]], %x[stride]\n" + "ld3 {v0.b, v1.b, v2.b}[6], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "st1 {v0.2s, v1.2s, v2.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v10.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v8", "v9", "v10", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x1 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x2 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x3 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x4 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x5 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x6 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 4x8 + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 4x7 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v4.4h, v0.4h, v2.4h\n" + "trn2 v6.4h, v0.4h, v2.4h\n" + "trn1 v5.4h, v1.4h, v3.4h\n" + "trn2 v7.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v4.8b, v5.8b\n" + "trn2 v1.8b, v4.8b, v5.8b\n" + "trn1 v2.8b, v6.8b, v7.8b\n" + "trn2 v3.8b, v6.8b, v7.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "st1 {v8.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x1 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x2 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x3 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x4 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x5 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x6 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 5x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 5x7 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v4.b}[6], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v5.4h, v0.4h, v2.4h\n" + "trn2 v7.4h, v0.4h, v2.4h\n" + "trn1 v6.4h, v1.4h, v3.4h\n" + "trn2 v13.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v5.8b, v6.8b\n" + "trn2 v1.8b, v5.8b, v6.8b\n" + "trn1 v2.8b, v7.8b, v13.8b\n" + "trn2 v3.8b, v7.8b, v13.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s}, [%x[out]], #8\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v12.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x1 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x2 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x3 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x4 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x5 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x6 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 6x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 6x7 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld1 {v4.h}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld1 {v5.h}[2], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v6.4h, v0.4h, v2.4h\n" + "trn2 v14.4h, v0.4h, v2.4h\n" + "trn1 v7.4h, v1.4h, v3.4h\n" + "trn2 v15.4h, v1.4h, v3.4h\n" + "uzp1 v16.8b, v4.8b, v5.8b\n" + "uzp2 v17.8b, v4.8b, v5.8b\n" + "trn1 v0.8b, v6.8b, v7.8b\n" + "trn2 v1.8b, v6.8b, v7.8b\n" + "trn1 v2.8b, v14.8b, v15.8b\n" + "trn2 v3.8b, v14.8b, v15.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v16.8b\n" + "uaddw v13.8h, v13.8h, v17.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v16.2s, v17.2s}, [%x[out]], #16\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v12.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x1 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x2 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x3 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x4 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x5 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x6 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "sub %x[stride], %x[stride], #4\n" + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 7x8 + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[6], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[7], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 7x7 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "ld1 {v0.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[0], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[1], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[2], [%x[in]], %x[stride]\n" + "ld1 {v3.s}[0], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[3], [%x[in]], %x[stride]\n" + "ld1 {v0.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[4], [%x[in]], %x[stride]\n" + "ld1 {v1.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[5], [%x[in]], %x[stride]\n" + "ld1 {v2.s}[1], [%x[in]], #4\n" + "ld3 {v4.b, v5.b, v6.b}[6], [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v7.4h, v0.4h, v2.4h\n" + "trn2 v16.4h, v0.4h, v2.4h\n" + "trn1 v15.4h, v1.4h, v3.4h\n" + "trn2 v17.4h, v1.4h, v3.4h\n" + "trn1 v0.8b, v7.8b, v15.8b\n" + "trn2 v1.8b, v7.8b, v15.8b\n" + "trn1 v2.8b, v16.8b, v17.8b\n" + "trn2 v3.8b, v16.8b, v17.8b\n" + "uaddw v8.8h, v8.8h, v0.8b\n" + "uaddw v9.8h, v9.8h, v1.8b\n" + "uaddw v10.8h, v10.8h, v2.8b\n" + "uaddw v11.8h, v11.8h, v3.8b\n" + "uaddw v12.8h, v12.8h, v4.8b\n" + "uaddw v13.8h, v13.8h, v5.8b\n" + "uaddw v14.8h, v14.8h, v6.8b\n" + "st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [%x[out]], #32\n" + "st1 {v4.2s, v5.2s, v6.2s}, [%x[out]], #24\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v14.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "ld1 {v6.2s}, [%x[in]], %x[stride]\n" + "ld1 {v7.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", + "v21", "v22", "v23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "ld1 {v6.2s}, [%x[in]], %x[stride]\n" + "ld1 {v7.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x1 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", + "v21", "v22", "v23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "ld1 {v6.2s}, [%x[in]], %x[stride]\n" + "ld1 {v7.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x2 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", + "v21", "v22", "v23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "ld1 {v6.2s}, [%x[in]], %x[stride]\n" + "ld1 {v7.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x3 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", + "v21", "v22", "v23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "ld1 {v6.2s}, [%x[in]], %x[stride]\n" + "ld1 {v7.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x4 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", + "v21", "v22", "v23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "ld1 {v6.2s}, [%x[in]], %x[stride]\n" + "ld1 {v7.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x5 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", + "v21", "v22", "v23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "ld1 {v6.2s}, [%x[in]], %x[stride]\n" + "ld1 {v7.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x6 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", + "v21", "v22", "v23", "cc", "memory"); +} + +template <> +inline void Stream::Pack( + const uint8_t* in, const ColumnMajorWithSum& params, uint8_t* out) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout + << __FILE__ << "(" << __LINE__ + << ") ColumnMajorWithSum::Pack()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + int params_stride_copy = params.stride; + asm volatile( + "movi v8.8h, #0\n" + "movi v9.8h, #0\n" + "movi v10.8h, #0\n" + "movi v11.8h, #0\n" + "movi v12.8h, #0\n" + "movi v13.8h, #0\n" + "movi v14.8h, #0\n" + "movi v15.8h, #0\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #8\n" + + // Load Aggregate Store - column major 8x8 + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "ld1 {v6.2s}, [%x[in]], %x[stride]\n" + "ld1 {v7.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + "bne 1b\n" + + "2:" + + // Load Aggregate Store - column major 8x7 + "movi v0.8b, #0\n" + "movi v1.8b, #0\n" + "movi v2.8b, #0\n" + "movi v3.8b, #0\n" + "movi v4.8b, #0\n" + "movi v5.8b, #0\n" + "movi v6.8b, #0\n" + "movi v7.8b, #0\n" + "ld1 {v0.2s}, [%x[in]], %x[stride]\n" + "ld1 {v1.2s}, [%x[in]], %x[stride]\n" + "ld1 {v2.2s}, [%x[in]], %x[stride]\n" + "ld1 {v3.2s}, [%x[in]], %x[stride]\n" + "ld1 {v4.2s}, [%x[in]], %x[stride]\n" + "ld1 {v5.2s}, [%x[in]], %x[stride]\n" + "ld1 {v6.2s}, [%x[in]], %x[stride]\n" + "prfm pldl1keep, [%x[in]]\n" + "trn1 v16.8b, v0.8b, v1.8b\n" + "trn2 v17.8b, v0.8b, v1.8b\n" + "trn1 v18.8b, v2.8b, v3.8b\n" + "trn2 v19.8b, v2.8b, v3.8b\n" + "trn1 v20.8b, v4.8b, v5.8b\n" + "trn2 v21.8b, v4.8b, v5.8b\n" + "trn1 v22.8b, v6.8b, v7.8b\n" + "trn2 v23.8b, v6.8b, v7.8b\n" + "trn1 v0.4h, v16.4h, v18.4h\n" + "trn2 v2.4h, v16.4h, v18.4h\n" + "trn1 v1.4h, v17.4h, v19.4h\n" + "trn2 v3.4h, v17.4h, v19.4h\n" + "trn1 v4.4h, v20.4h, v22.4h\n" + "trn2 v6.4h, v20.4h, v22.4h\n" + "trn1 v5.4h, v21.4h, v23.4h\n" + "trn2 v7.4h, v21.4h, v23.4h\n" + "trn1 v16.2s, v0.2s, v4.2s\n" + "trn2 v20.2s, v0.2s, v4.2s\n" + "trn1 v17.2s, v1.2s, v5.2s\n" + "trn2 v21.2s, v1.2s, v5.2s\n" + "trn1 v18.2s, v2.2s, v6.2s\n" + "trn2 v22.2s, v2.2s, v6.2s\n" + "trn1 v19.2s, v3.2s, v7.2s\n" + "trn2 v23.2s, v3.2s, v7.2s\n" + "uaddw v8.8h, v8.8h, v16.8b\n" + "uaddw v9.8h, v9.8h, v17.8b\n" + "uaddw v10.8h, v10.8h, v18.8b\n" + "uaddw v11.8h, v11.8h, v19.8b\n" + "uaddw v12.8h, v12.8h, v20.8b\n" + "uaddw v13.8h, v13.8h, v21.8b\n" + "uaddw v14.8h, v14.8h, v22.8b\n" + "uaddw v15.8h, v15.8h, v23.8b\n" + "st1 {v16.2s, v17.2s, v18.2s, v19.2s}, [%x[out]], #32\n" + "st1 {v20.2s, v21.2s, v22.2s, v23.2s}, [%x[out]], #32\n" + + // Aggregator Reduction. + "mov v0.s[0], %w[multiplicative_sum_offset]\n" + "dup v1.4s, %w[additive_sum_offset]\n" + "uaddlp v8.4s, v8.8h\n" + "uaddlp v9.4s, v9.8h\n" + "uaddlp v10.4s, v10.8h\n" + "uaddlp v11.4s, v11.8h\n" + "uaddlp v12.4s, v12.8h\n" + "uaddlp v13.4s, v13.8h\n" + "uaddlp v14.4s, v14.8h\n" + "uaddlp v15.4s, v15.8h\n" + "addp v8.4s, v8.4s, v9.4s\n" + "addp v10.4s, v10.4s, v11.4s\n" + "addp v12.4s, v12.4s, v13.4s\n" + "addp v14.4s, v14.4s, v15.4s\n" + "addp v8.4s, v8.4s, v10.4s\n" + "addp v9.4s, v12.4s, v14.4s\n" + "mul v8.4s, v8.4s, v0.s[0]\n" + "mul v9.4s, v9.4s, v0.s[0]\n" + "add v8.4s, v8.4s, v1.4s\n" + "add v9.4s, v9.4s, v1.4s\n" + "st1 {v8.4s, v9.4s}, [%x[out]]\n" + : [count] "+r"(params_count_copy), [stride] "+r"(params_stride_copy), + [out] "+r"(out), [in] "+r"(in) + : [additive_sum_offset] "r"(params.additive_sum_offset), + [multiplicative_sum_offset] "r"(params.multiplicative_sum_offset) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", + "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", + "v21", "v22", "v23", "cc", "memory"); +} + +} // namespace meta +} // namespace gemmlowp + +#else +#warning "Meta gemm for arm64 requires: GEMMLOWP_NEON_64!" +#endif + +#endif // GEMMLOWP_META_STREAMS_ARM_64_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/transform_kernels.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/transform_kernels.h new file mode 100644 index 0000000000000000000000000000000000000000..44896564f9af07e0952c47f37f72315c0b89f082 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/transform_kernels.h @@ -0,0 +1,244 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_TRANSFORM_KERNELS_H_ +#define GEMMLOWP_META_TRANSFORM_KERNELS_H_ + +#include "base.h" + +namespace gemmlowp { +namespace meta { + +struct Quantize { + float range_min; + float range_offset; + float range_scale; + int count; +}; + +struct Dequantize { + float range_min; + float range_offset; + float range_scale; + int count; +}; + +struct Requantize { + float input_range_min; + float input_range_offset; + float input_range_scale; + float output_range_min; + float output_range_offset; + float one_over_output_range_scale; + int count; +}; + +template +struct MinMax { + Type min; + Type max; + int count; +}; + +template +struct BiasAdd { + float input_range_min; + float input_range_offset; + float input_range_scale; + float bias_range_min; + float bias_range_offset; + float bias_range_scale; + float output_range_min; + float output_range_offset; + float one_over_output_range_scale; + int count; + int rows; + const BiasType* bias; +}; + +template +class Transform1DKernel { + public: + static void Transform(const InType* in, const Quantize& params, + OutType* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Quantize::Transform(" << std::string(typeid(InType).name()) + << ", " << std::string(typeid(OutType).name()) << ") -- " + << kernel_size << "x" << leftovers << std::endl; +#endif +#else + std::cerr << "FATAL: Quantize::Transform not implemented." << std::endl; + std::exit(1); +#endif + } +}; + +template +class Transform1DKernel { + public: + static void Transform(const InType* in, const Dequantize& params, + OutType* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Dequantize::Transform(" << std::string(typeid(InType).name()) + << ", " << std::string(typeid(OutType).name()) << ") -- " + << kernel_size << "x" << leftovers << std::endl; +#endif +#else + std::cerr << "FATAL: Dequantize::Transform not implemented." << std::endl; + std::exit(1); +#endif + } +}; + +template +class Transform1DKernel { + public: + static void Transform(const InType* in, const Requantize& params, + OutType* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "Requantize::Transform(" << std::string(typeid(InType).name()) + << ", " << std::string(typeid(OutType).name()) << ") -- " + << kernel_size << "x" << leftovers << std::endl; +#endif +#else + std::cerr << "FATAL: Requantize::Transform not implemented." << std::endl; + std::exit(1); +#endif + } +}; + +template +class Transform1DKernel, kernel_size, leftovers> { + public: + static void Transform(const InType* in, const MinMax& params, + OutType* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "MinMax::Transform(" << std::string(typeid(InType).name()) + << ", " << std::string(typeid(OutType).name()) << ") -- " + << kernel_size << "x" << leftovers << std::endl; +#endif +#else + std::cerr << "FATAL: MinMax::Transform not implemented." << std::endl; + std::exit(1); +#endif + } +}; + +template +class Transform1DKernel, kernel_size, + leftovers> { + public: + static void Transform(const InType* in, const BiasAdd& params, + OutType* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << "BiasAdd::Transform(" << std::string(typeid(InType).name()) + << ", " << std::string(typeid(OutType).name()) << ") -- " + << kernel_size << "x" << leftovers << std::endl; +#endif +#else + std::cerr << "FATAL: BiasAdd::Transform not implemented." << std::endl; + std::exit(1); +#endif + } +}; + +template +class Transform1DUtil { + public: + static int EstimateComputeCost(const Quantize& params) { + return params.count * 8; + } + + static const InType* OffsetInput(const Quantize& params, const InType* input, + int offset) { + return input + offset; + } + + static OutType* OffsetOutput(const Quantize& params, OutType* output, + int offset) { + return output + offset; + } +}; + +template +class Transform1DUtil { + public: + static int EstimateComputeCost(const Requantize& params) { + return params.count * 12; + } + + static const InType* OffsetInput(const Requantize& params, + const InType* input, int offset) { + return input + offset; + } + + static OutType* OffsetOutput(const Requantize& params, OutType* output, + int offset) { + return output + offset; + } +}; + +template +class Transform1DUtil { + public: + static int EstimateComputeCost(const Dequantize& params) { + return params.count * 12; + } + + static const InType* OffsetInput(const Dequantize& params, + const InType* input, int offset) { + return input + offset; + } + + static OutType* OffsetOutput(const Dequantize& params, OutType* output, + int offset) { + return output + offset; + } +}; + +template +class Transform1DUtil> { + public: + static int EstimateComputeCost(const MinMax& params) { + return params.count * 4; + } + + static const InType* OffsetInput(const MinMax& params, + const InType* input, int offset) { + return input + offset; + } + + static OutType* OffsetOutput(const MinMax& params, + OutType* output, int offset) { + return output + offset; + } +}; + +} // namespace meta +} // namespace gemmlowp + +#ifdef GEMMLOWP_NEON_32 +#include "transform_kernels_arm_32.h" +#elif defined(GEMMLOWP_NEON_64) +#include "transform_kernels_arm_64.h" +#endif + +#endif // GEMMLOWP_META_TRANSFORM_KERNELS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/transform_kernels_arm_32.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/transform_kernels_arm_32.h new file mode 100644 index 0000000000000000000000000000000000000000..64e744eabfd757d9e82fc4f71648409d48a3069d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/transform_kernels_arm_32.h @@ -0,0 +1,8109 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_TRANSFORM_KERNELS_ARM_32_H_ +#define GEMMLOWP_META_TRANSFORM_KERNELS_ARM_32_H_ + +#ifdef GEMMLOWP_NEON_32 + +#include +#include + +namespace gemmlowp { +namespace meta { + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vsub.f32 q0, q0, q6\n" + "vmul.f32 q0, q0, q7\n" + "vadd.f32 q0, q0, q4\n" + "vmul.f32 q0, q0, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + "vst1.8 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vsub.f32 q0, q0, q6\n" + "vmul.f32 q0, q0, q7\n" + "vadd.f32 q0, q0, q4\n" + "vmul.f32 q0, q0, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + "vst1.16 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vsub.f32 q0, q0, q6\n" + "vmul.f32 q0, q0, q7\n" + "vadd.f32 q0, q0, q4\n" + "vmul.f32 q0, q0, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + "vst1.16 {d0[0]}, [%[output]]!\n" + "vst1.8 {d0[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vsub.f32 q0, q0, q6\n" + "vmul.f32 q0, q0, q7\n" + "vadd.f32 q0, q0, q4\n" + "vmul.f32 q0, q0, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d2[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "vst1.8 {d0[4]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "vst1.16 {d0[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2}, [%[input]]!\n" + "vld1.32 {d3[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "vst1.16 {d0[2]}, [%[output]]!\n" + "vst1.8 {d0[6]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #8\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #9\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.8 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #10\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.16 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #11\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4}, [%[input]]!\n" + "vld1.32 {d5[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.16 {d1[0]}, [%[output]]!\n" + "vst1.8 {d1[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #12\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #13\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5}, [%[input]]!\n" + "vld1.32 {d6[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "vst1.8 {d1[4]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #14\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "vst1.16 {d1[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "vdup.32 q4, %[input_range_min]\n" + "vdup.32 q5, %[output_range_min]\n" + "vdup.32 q6, %[input_range_offset]\n" + "vdup.32 q7, %[input_range_scale]\n" + "vdup.32 q8, %[one_over_output_range_scale]\n" + "vsub.f32 q4, q4, q5\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #15\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6}, [%[input]]!\n" + "vld1.32 {d7[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q6\n" + "vsub.f32 q1, q1, q6\n" + "vsub.f32 q2, q2, q6\n" + "vsub.f32 q3, q3, q6\n" + "vmul.f32 q0, q0, q7\n" + "vmul.f32 q1, q1, q7\n" + "vmul.f32 q2, q2, q7\n" + "vmul.f32 q3, q3, q7\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q8\n" + "vmul.f32 q1, q1, q8\n" + "vmul.f32 q2, q2, q8\n" + "vmul.f32 q3, q3, q8\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "vst1.16 {d1[2]}, [%[output]]!\n" + "vst1.8 {d1[6]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [input_range_scale] "r"(params.input_range_scale) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "d14", "d15", "d16", "d17", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vmul.f32 q0, q0, q6\n" + "vadd.f32 q0, q0, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + "vst1.8 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vmul.f32 q0, q0, q6\n" + "vadd.f32 q0, q0, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + "vst1.16 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vmul.f32 q0, q0, q6\n" + "vadd.f32 q0, q0, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + "vst1.16 {d0[0]}, [%[output]]!\n" + "vst1.8 {d0[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vmul.f32 q0, q0, q6\n" + "vadd.f32 q0, q0, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vqmovn.s32 d0, q0\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d2[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "vst1.8 {d0[4]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "vst1.16 {d0[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2}, [%[input]]!\n" + "vld1.32 {d3[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "vst1.16 {d0[2]}, [%[output]]!\n" + "vst1.8 {d0[6]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #8\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovun.s16 d0, q0\n" + + "vst1.32 {d0}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #9\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.8 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #10\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.16 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #11\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4}, [%[input]]!\n" + "vld1.32 {d5[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.16 {d1[0]}, [%[output]]!\n" + "vst1.8 {d1[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #12\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #13\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5}, [%[input]]!\n" + "vld1.32 {d6[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "vst1.8 {d1[4]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #14\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "vst1.16 {d1[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #15\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6, d7}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "vld1.32 {d0, d1, d2, d3}, [%[input]]!\n" + "vld1.32 {d4, d5, d6}, [%[input]]!\n" + "vld1.32 {d7[0]}, [%[input]]!\n" + "pld [%[input], #64]\n" + "vsub.f32 q0, q0, q4\n" + "vsub.f32 q1, q1, q4\n" + "vsub.f32 q2, q2, q4\n" + "vsub.f32 q3, q3, q4\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q5\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q5\n" + "vadd.f32 q3, q3, q5\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + "vqmovn.s32 d0, q0\n" + "vqmovn.s32 d1, q1\n" + "vqmovn.s32 d4, q2\n" + "vqmovn.s32 d5, q3\n" + "vqmovun.s16 d0, q0\n" + "vqmovun.s16 d1, q2\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "vst1.16 {d1[2]}, [%[output]]!\n" + "vst1.8 {d1[6]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.8 {d0[0]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vsub.f32 q0, q0, q5\n" + "vmul.f32 q0, q0, q6\n" + "vadd.f32 q0, q0, q4\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.16 {d0[0]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vsub.f32 q0, q0, q5\n" + "vmul.f32 q0, q0, q6\n" + "vadd.f32 q0, q0, q4\n" + + "vst1.32 {d0}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.16 {d0[0]}, [%[input]]!\n" + "vld1.8 {d0[2]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vsub.f32 q0, q0, q5\n" + "vmul.f32 q0, q0, q6\n" + "vadd.f32 q0, q0, q4\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vsub.f32 q0, q0, q5\n" + "vmul.f32 q0, q0, q6\n" + "vadd.f32 q0, q0, q4\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.8 {d0[4]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "vst1.32 {d2[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.16 {d0[2]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + + "vst1.32 {d0, d1, d2}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.16 {d0[2]}, [%[input]]!\n" + "vld1.8 {d0[6]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + + "vst1.32 {d0, d1, d2}, [%[output]]!\n" + "vst1.32 {d3[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #8\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #9\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.8 {d1[0]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #10\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.16 {d1[0]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #11\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.16 {d1[0]}, [%[input]]!\n" + "vld1.8 {d1[2]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4}, [%[output]]!\n" + "vst1.32 {d5[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #12\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #13\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.8 {d1[4]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5}, [%[output]]!\n" + "vst1.32 {d6[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #14\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.16 {d1[2]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "vdup.32 q4, %[range_min]\n" + "vdup.32 q5, %[range_offset]\n" + "vdup.32 q6, %[range_scale]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #15\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // Dequantize::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.16 {d1[2]}, [%[input]]!\n" + "vld1.8 {d1[6]}, [%[input]]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vsub.f32 q0, q0, q5\n" + "vsub.f32 q1, q1, q5\n" + "vsub.f32 q2, q2, q5\n" + "vsub.f32 q3, q3, q5\n" + "vmul.f32 q0, q0, q6\n" + "vmul.f32 q1, q1, q6\n" + "vmul.f32 q2, q2, q6\n" + "vmul.f32 q3, q3, q6\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q4\n" + "vadd.f32 q3, q3, q4\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6}, [%[output]]!\n" + "vst1.32 {d7[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", + "d11", "d12", "d13", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 0>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "0>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 1>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "1>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #1\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.8 {d0[0]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.8 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 2>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "2>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #2\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.16 {d0[0]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.16 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 3>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "3>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #3\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.16 {d0[0]}, [%[input]]!\n" + "vld1.8 {d0[2]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.16 {d0[0]}, [%[output]]!\n" + "vst1.8 {d0[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 4>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "4>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #4\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 5>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "5>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #5\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.8 {d0[4]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "vst1.8 {d0[4]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 6>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "6>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #6\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.16 {d0[2]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "vst1.16 {d0[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 7>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "7>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #7\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.16 {d0[2]}, [%[input]]!\n" + "vld1.8 {d0[6]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "vst1.16 {d0[2]}, [%[output]]!\n" + "vst1.8 {d0[6]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 8>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "8>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #8\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 9>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "9>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #9\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.8 {d1[0]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.8 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 10>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "10>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #10\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.16 {d1[0]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.16 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 11>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "11>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #11\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.16 {d1[0]}, [%[input]]!\n" + "vld1.8 {d1[2]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.16 {d1[0]}, [%[output]]!\n" + "vst1.8 {d1[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 12>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "12>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #12\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 13>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "13>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #13\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.8 {d1[4]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "vst1.8 {d1[4]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 14>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "14>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #14\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.16 {d1[2]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "vst1.16 {d1[2]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 15>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "15>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "vdup.8 q4, %[min]\n" + "vdup.8 q5, %[max]\n" + + // Reduce count by leftovers. + "subs %[count], %[count], #15\n" + "beq 2f\n" + + "1:" + "subs %[count], %[count], #16\n" + + // MinMax::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.16 {d1[2]}, [%[input]]!\n" + "vld1.8 {d1[6]}, [%[input]]!\n" + "pld [%[input], #16]\n" + "vmax.u8 q0, q0, q4\n" + "vmin.u8 q0, q0, q5\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "vst1.16 {d1[2]}, [%[output]]!\n" + "vst1.8 {d1[6]}, [%[output]]!\n" + "pld [%[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "d0", "d1", "d8", "d9", "d10", "d11", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 0>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "0>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 1>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "1>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #1\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.8 {d0[0]}, [%[input]]!\n" + "vld1.8 {d2[0]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q1, d2\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q1, d2\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q10\n" + "vadd.f32 q0, q0, q1\n" + "vsub.f32 q0, q0, q12\n" + "vmul.f32 q0, q0, q13\n" + "vadd.f32 q0, q0, q14\n" + "vcvt.s32.f32 q0, q0\n" + + "vst1.32 {d0[0]}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 2>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "2>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #2\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.16 {d0[0]}, [%[input]]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q1, d2\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q1, d2\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q10\n" + "vadd.f32 q0, q0, q1\n" + "vsub.f32 q0, q0, q12\n" + "vmul.f32 q0, q0, q13\n" + "vadd.f32 q0, q0, q14\n" + "vcvt.s32.f32 q0, q0\n" + + "vst1.32 {d0}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 3>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "3>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #3\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.16 {d0[0]}, [%[input]]!\n" + "vld1.8 {d0[2]}, [%[input]]!\n" + "vld1.16 {d2[0]}, [r1]!\n" + "vld1.8 {d2[2]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q1, d2\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q1, d2\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q10\n" + "vadd.f32 q0, q0, q1\n" + "vsub.f32 q0, q0, q12\n" + "vmul.f32 q0, q0, q13\n" + "vadd.f32 q0, q0, q14\n" + "vcvt.s32.f32 q0, q0\n" + + "vst1.32 {d0}, [%[output]]!\n" + "vst1.32 {d1[0]}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 4>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "4>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #4\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.32 {d2[0]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q1, d2\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q1, d2\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q10\n" + "vadd.f32 q0, q0, q1\n" + "vsub.f32 q0, q0, q12\n" + "vmul.f32 q0, q0, q13\n" + "vadd.f32 q0, q0, q14\n" + "vcvt.s32.f32 q0, q0\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 5>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "5>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #5\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.8 {d0[4]}, [%[input]]!\n" + "vld1.32 {d4[0]}, [r1]!\n" + "vld1.8 {d4[4]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q2, d4\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q3, d5\n" + "vmovl.s16 q2, d4\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q11\n" + "vmul.f32 q3, q3, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q10\n" + "vadd.f32 q3, q3, q10\n" + "vadd.f32 q0, q0, q2\n" + "vadd.f32 q1, q1, q3\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + + "vst1.32 {d0, d1}, [%[output]]!\n" + "vst1.32 {d2[0]}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 6>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "6>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #6\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.16 {d0[2]}, [%[input]]!\n" + "vld1.32 {d4[0]}, [r1]!\n" + "vld1.16 {d4[2]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q2, d4\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q3, d5\n" + "vmovl.s16 q2, d4\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q11\n" + "vmul.f32 q3, q3, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q10\n" + "vadd.f32 q3, q3, q10\n" + "vadd.f32 q0, q0, q2\n" + "vadd.f32 q1, q1, q3\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + + "vst1.32 {d0, d1, d2}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 7>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "7>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #7\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0[0]}, [%[input]]!\n" + "vld1.16 {d0[2]}, [%[input]]!\n" + "vld1.8 {d0[6]}, [%[input]]!\n" + "vld1.32 {d4[0]}, [r1]!\n" + "vld1.16 {d4[2]}, [r1]!\n" + "vld1.8 {d4[6]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q2, d4\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q3, d5\n" + "vmovl.s16 q2, d4\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q11\n" + "vmul.f32 q3, q3, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q10\n" + "vadd.f32 q3, q3, q10\n" + "vadd.f32 q0, q0, q2\n" + "vadd.f32 q1, q1, q3\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + + "vst1.32 {d0, d1, d2}, [%[output]]!\n" + "vst1.32 {d3[0]}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 8>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "8>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #8\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d4}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q2, d4\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q3, d5\n" + "vmovl.s16 q2, d4\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q11\n" + "vmul.f32 q3, q3, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q10\n" + "vadd.f32 q3, q3, q10\n" + "vadd.f32 q0, q0, q2\n" + "vadd.f32 q1, q1, q3\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 9>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "9>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #9\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.8 {d1[0]}, [%[input]]!\n" + "vld1.32 {d6}, [r1]!\n" + "vld1.8 {d7[0]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q4, d7\n" + "vmovl.u8 q3, d6\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q5, d8\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q4, d7\n" + "vmovl.s16 q3, d6\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q11\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q10\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q0, q0, q3\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q5\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4[0]}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 10>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "10>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #10\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.16 {d1[0]}, [%[input]]!\n" + "vld1.32 {d6}, [r1]!\n" + "vld1.16 {d7[0]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q4, d7\n" + "vmovl.u8 q3, d6\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q5, d8\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q4, d7\n" + "vmovl.s16 q3, d6\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q11\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q10\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q0, q0, q3\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q5\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 11>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "11>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #11\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.16 {d1[0]}, [%[input]]!\n" + "vld1.8 {d1[2]}, [%[input]]!\n" + "vld1.32 {d6}, [r1]!\n" + "vld1.16 {d7[0]}, [r1]!\n" + "vld1.8 {d7[2]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q4, d7\n" + "vmovl.u8 q3, d6\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q5, d8\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q4, d7\n" + "vmovl.s16 q3, d6\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q11\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q10\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q0, q0, q3\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q5\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4}, [%[output]]!\n" + "vst1.32 {d5[0]}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 12>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "12>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #12\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.32 {d6}, [r1]!\n" + "vld1.32 {d7[0]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q4, d7\n" + "vmovl.u8 q3, d6\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q5, d8\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q4, d7\n" + "vmovl.s16 q3, d6\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q11\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q10\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q0, q0, q3\n" + "vadd.f32 q1, q1, q4\n" + "vadd.f32 q2, q2, q5\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 13>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "13>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #13\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.8 {d1[4]}, [%[input]]!\n" + "vld1.32 {d8}, [r1]!\n" + "vld1.32 {d9[0]}, [r1]!\n" + "vld1.8 {d9[4]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5}, [%[output]]!\n" + "vst1.32 {d6[0]}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 14>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "14>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #14\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.16 {d1[2]}, [%[input]]!\n" + "vld1.32 {d8}, [r1]!\n" + "vld1.32 {d9[0]}, [r1]!\n" + "vld1.16 {d9[2]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 15>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "15>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr r0, %[input_range_min]\n" + "vdup.32 q8, r0\n" + "ldr r0, %[input_range_scale]\n" + "vdup.32 q9, r0\n" + "ldr r0, %[bias_range_min]\n" + "vdup.32 q10, r0\n" + "ldr r0, %[bias_range_scale]\n" + "vdup.32 q11, r0\n" + "ldr r0, %[output_range_min]\n" + "vdup.32 q12, r0\n" + "ldr r0, %[one_over_output_range_scale]\n" + "vdup.32 q13, r0\n" + "ldr r0, %[output_range_offset]\n" + "vdup.32 q14, r0\n" + "1:" + "mov r0, %[count]\n" + "mov r1, %[bias]\n" + "subs r0, r0, #15\n" + "beq 3f\n" + "2:" + "subs r0, r0, #16\n" + + // BiasAdd::Transform + "vld1.32 {d0, d1}, [%[input]]!\n" + "vld1.32 {d8, d9}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6, d7}, [%[output]]!\n" + "pld [%[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "vld1.32 {d0}, [%[input]]!\n" + "vld1.32 {d1[0]}, [%[input]]!\n" + "vld1.16 {d1[2]}, [%[input]]!\n" + "vld1.8 {d1[6]}, [%[input]]!\n" + "vld1.32 {d8}, [r1]!\n" + "vld1.32 {d9[0]}, [r1]!\n" + "vld1.16 {d9[2]}, [r1]!\n" + "vld1.8 {d9[6]}, [r1]!\n" + "pld [%[input], #32]\n" + "vmovl.u8 q1, d1\n" + "vmovl.u8 q0, d0\n" + "vmovl.u8 q5, d9\n" + "vmovl.u8 q4, d8\n" + "vmovl.s16 q3, d3\n" + "vmovl.s16 q2, d2\n" + "vmovl.s16 q7, d11\n" + "vmovl.s16 q6, d10\n" + "vmovl.s16 q1, d1\n" + "vmovl.s16 q0, d0\n" + "vmovl.s16 q5, d9\n" + "vmovl.s16 q4, d8\n" + "vcvt.f32.s32 q0, q0\n" + "vcvt.f32.s32 q1, q1\n" + "vcvt.f32.s32 q2, q2\n" + "vcvt.f32.s32 q3, q3\n" + "vcvt.f32.s32 q4, q4\n" + "vcvt.f32.s32 q5, q5\n" + "vcvt.f32.s32 q6, q6\n" + "vcvt.f32.s32 q7, q7\n" + "vmul.f32 q0, q0, q9\n" + "vmul.f32 q1, q1, q9\n" + "vmul.f32 q2, q2, q9\n" + "vmul.f32 q3, q3, q9\n" + "vmul.f32 q4, q4, q11\n" + "vmul.f32 q5, q5, q11\n" + "vmul.f32 q6, q6, q11\n" + "vmul.f32 q7, q7, q11\n" + "vadd.f32 q0, q0, q8\n" + "vadd.f32 q1, q1, q8\n" + "vadd.f32 q2, q2, q8\n" + "vadd.f32 q3, q3, q8\n" + "vadd.f32 q4, q4, q10\n" + "vadd.f32 q5, q5, q10\n" + "vadd.f32 q6, q6, q10\n" + "vadd.f32 q7, q7, q10\n" + "vadd.f32 q0, q0, q4\n" + "vadd.f32 q1, q1, q5\n" + "vadd.f32 q2, q2, q6\n" + "vadd.f32 q3, q3, q7\n" + "vsub.f32 q0, q0, q12\n" + "vsub.f32 q1, q1, q12\n" + "vsub.f32 q2, q2, q12\n" + "vsub.f32 q3, q3, q12\n" + "vmul.f32 q0, q0, q13\n" + "vmul.f32 q1, q1, q13\n" + "vmul.f32 q2, q2, q13\n" + "vmul.f32 q3, q3, q13\n" + "vadd.f32 q0, q0, q14\n" + "vadd.f32 q1, q1, q14\n" + "vadd.f32 q2, q2, q14\n" + "vadd.f32 q3, q3, q14\n" + "vcvt.s32.f32 q0, q0\n" + "vcvt.s32.f32 q1, q1\n" + "vcvt.s32.f32 q2, q2\n" + "vcvt.s32.f32 q3, q3\n" + + "vst1.32 {d0, d1, d2, d3}, [%[output]]!\n" + "vst1.32 {d4, d5, d6}, [%[output]]!\n" + "vst1.32 {d7[0]}, [%[output]]!\n" + "pld [%[output]]\n" + "subs %[rows], %[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "r0", "r1", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", + "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", + "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", + "cc", "memory"); +} + +} // namespace meta +} // namespace gemmlowp + +#else +#warning "Meta gemm for arm32 requires: GEMMLOWP_NEON_32!" +#endif + +#endif // GEMMLOWP_META_TRANSFORM_KERNELS_ARM_32_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/transform_kernels_arm_64.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/transform_kernels_arm_64.h new file mode 100644 index 0000000000000000000000000000000000000000..86b54119539c8fc9cc896234fc1f43c4fb404bae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/meta/transform_kernels_arm_64.h @@ -0,0 +1,8097 @@ +// Copyright 2016 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GEMMLOWP_META_TRANSFORM_KERNELS_ARM_64_H_ +#define GEMMLOWP_META_TRANSFORM_KERNELS_ARM_64_H_ + +#ifdef GEMMLOWP_NEON_64 + +#include +#include + +namespace gemmlowp { +namespace meta { + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.b}[0], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.h}[0], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.h}[0], [%x[output]], #2\n" + "st1 {v0.b}[2], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v1.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "st1 {v0.b}[4], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v1.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "st1 {v0.h}[2], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v1.2s}, [%x[input]], #8\n" + "ld1 {v1.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "st1 {v0.h}[2], [%x[output]], #2\n" + "st1 {v0.b}[6], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #8\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s, v1.4s}, [%x[input]], #32\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #9\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s, v1.4s}, [%x[input]], #32\n" + "ld1 {v2.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.b}[8], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #10\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s, v1.4s}, [%x[input]], #32\n" + "ld1 {v2.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.h}[4], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #11\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s, v1.4s}, [%x[input]], #32\n" + "ld1 {v2.2s}, [%x[input]], #8\n" + "ld1 {v2.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.h}[4], [%x[output]], #2\n" + "st1 {v0.b}[10], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #12\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s}, [%x[input]], #48\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #13\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s}, [%x[input]], #48\n" + "ld1 {v3.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "st1 {v0.b}[12], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #14\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s}, [%x[input]], #48\n" + "ld1 {v3.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "st1 {v0.h}[6], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const int32_t* input, const Requantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Requantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Requantize::Prepare + "dup v4.4s, %w[input_range_min]\n" + "dup v5.4s, %w[output_range_min]\n" + "dup v6.4s, %w[input_range_offset]\n" + "dup v7.4s, %w[input_range_scale]\n" + "dup v8.4s, %w[one_over_output_range_scale]\n" + "dup v9.4s, %w[output_range_offset]\n" + "fsub v4.4s, v4.4s, v5.4s\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #15\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Requantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s}, [%x[input]], #48\n" + "ld1 {v3.2s}, [%x[input]], #8\n" + "ld1 {v3.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v6.4s\n" + "fsub v1.4s, v1.4s, v6.4s\n" + "fsub v2.4s, v2.4s, v6.4s\n" + "fsub v3.4s, v3.4s, v6.4s\n" + "fmul v0.4s, v0.4s, v7.4s\n" + "fmul v1.4s, v1.4s, v7.4s\n" + "fmul v2.4s, v2.4s, v7.4s\n" + "fmul v3.4s, v3.4s, v7.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v8.4s\n" + "fmul v1.4s, v1.4s, v8.4s\n" + "fmul v2.4s, v2.4s, v8.4s\n" + "fmul v3.4s, v3.4s, v8.4s\n" + "fadd v0.4s, v0.4s, v9.4s\n" + "fadd v1.4s, v1.4s, v9.4s\n" + "fadd v2.4s, v2.4s, v9.4s\n" + "fadd v3.4s, v3.4s, v9.4s\n" + "fcvtns v0.4s, v0.4s\n" + "fcvtns v1.4s, v1.4s\n" + "fcvtns v2.4s, v2.4s\n" + "fcvtns v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "st1 {v0.h}[6], [%x[output]], #2\n" + "st1 {v0.b}[14], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [input_range_min] "r"(params.input_range_min), + [output_range_min] "r"(params.output_range_min), + [input_range_offset] "r"(params.input_range_offset), + [one_over_output_range_scale] "r"(params.one_over_output_range_scale), + [output_range_offset] "r"(params.output_range_offset), + [input_range_scale] "r"(params.input_range_scale) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.b}[0], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.h}[0], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.h}[0], [%x[output]], #2\n" + "st1 {v0.b}[2], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v1.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "st1 {v0.b}[4], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v1.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "st1 {v0.h}[2], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v1.2s}, [%x[input]], #8\n" + "ld1 {v1.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "st1 {v0.h}[2], [%x[output]], #2\n" + "st1 {v0.b}[6], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #8\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s, v1.4s}, [%x[input]], #32\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtun v0.8b, v0.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #9\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s, v1.4s}, [%x[input]], #32\n" + "ld1 {v2.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.b}[8], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #10\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s, v1.4s}, [%x[input]], #32\n" + "ld1 {v2.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.h}[4], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #11\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s, v1.4s}, [%x[input]], #32\n" + "ld1 {v2.2s}, [%x[input]], #8\n" + "ld1 {v2.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.h}[4], [%x[output]], #2\n" + "st1 {v0.b}[10], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #12\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s}, [%x[input]], #48\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #13\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s}, [%x[input]], #48\n" + "ld1 {v3.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "st1 {v0.b}[12], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #14\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s}, [%x[input]], #48\n" + "ld1 {v3.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "st1 {v0.h}[6], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const float* input, const Quantize& params, uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Quantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Quantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #15\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[input]], #64\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Quantize::Transform + "ld1 {v0.4s, v1.4s, v2.4s}, [%x[input]], #48\n" + "ld1 {v3.2s}, [%x[input]], #8\n" + "ld1 {v3.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #64]\n" + "fsub v0.4s, v0.4s, v4.4s\n" + "fsub v1.4s, v1.4s, v4.4s\n" + "fsub v2.4s, v2.4s, v4.4s\n" + "fsub v3.4s, v3.4s, v4.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v5.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fadd v3.4s, v3.4s, v5.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + "sqxtn v0.4h, v0.4s\n" + "sqxtn2 v0.8h, v1.4s\n" + "sqxtn v2.4h, v2.4s\n" + "sqxtn2 v2.8h, v3.4s\n" + "sqxtun v0.8b, v0.8h\n" + "sqxtun2 v0.16b, v2.8h\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "st1 {v0.h}[6], [%x[output]], #2\n" + "st1 {v0.b}[14], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.b}[0], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.h}[0], [%x[input]], #2\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.h}[0], [%x[input]], #2\n" + "ld1 {v0.b}[2], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v0.b}[4], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "st1 {v1.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v0.h}[2], [%x[input]], #2\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "st1 {v1.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v0.h}[2], [%x[input]], #2\n" + "ld1 {v0.b}[6], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "st1 {v1.2s}, [%x[output]], #8\n" + "st1 {v1.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #8\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s}, [%x[output]], #32\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #9\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.b}[8], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s}, [%x[output]], #32\n" + "st1 {v2.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #10\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.h}[4], [%x[input]], #2\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s}, [%x[output]], #32\n" + "st1 {v2.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #11\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.h}[4], [%x[input]], #2\n" + "ld1 {v0.b}[10], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s}, [%x[output]], #32\n" + "st1 {v2.2s}, [%x[output]], #8\n" + "st1 {v2.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #12\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s}, [%x[output]], #48\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #13\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v0.b}[12], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s}, [%x[output]], #48\n" + "st1 {v3.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #14\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v0.h}[6], [%x[input]], #2\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s}, [%x[output]], #48\n" + "st1 {v3.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel::Transform( + const uint8_t* input, const Dequantize& params, float* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") Dequantize::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // Dequantize::Prepare + "dup v4.4s, %w[range_min]\n" + "dup v5.4s, %w[range_offset]\n" + "dup v6.4s, %w[range_scale]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #15\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // Dequantize::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // Dequantize::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v0.h}[6], [%x[input]], #2\n" + "ld1 {v0.b}[14], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v5.4s\n" + "fsub v1.4s, v1.4s, v5.4s\n" + "fsub v2.4s, v2.4s, v5.4s\n" + "fsub v3.4s, v3.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v6.4s\n" + "fmul v1.4s, v1.4s, v6.4s\n" + "fmul v2.4s, v2.4s, v6.4s\n" + "fmul v3.4s, v3.4s, v6.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v4.4s\n" + "fadd v3.4s, v3.4s, v4.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s}, [%x[output]], #48\n" + "st1 {v3.2s}, [%x[output]], #8\n" + "st1 {v3.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [range_offset] "r"(params.range_offset), + [range_scale] "r"(params.range_scale), [range_min] "r"(params.range_min) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 0>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "0>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 1>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "1>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #1\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.b}[0], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.b}[0], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 2>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "2>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #2\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.h}[0], [%x[input]], #2\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.h}[0], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 3>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "3>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #3\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.h}[0], [%x[input]], #2\n" + "ld1 {v0.b}[2], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.h}[0], [%x[output]], #2\n" + "st1 {v0.b}[2], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 4>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "4>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #4\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 5>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "5>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #5\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v0.b}[4], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "st1 {v0.b}[4], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 6>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "6>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #6\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v0.h}[2], [%x[input]], #2\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "st1 {v0.h}[2], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 7>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "7>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #7\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v0.h}[2], [%x[input]], #2\n" + "ld1 {v0.b}[6], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "st1 {v0.h}[2], [%x[output]], #2\n" + "st1 {v0.b}[6], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 8>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "8>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #8\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 9>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "9>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #9\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.b}[8], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.b}[8], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 10>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "10>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #10\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.h}[4], [%x[input]], #2\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.h}[4], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 11>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "11>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #11\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.h}[4], [%x[input]], #2\n" + "ld1 {v0.b}[10], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.h}[4], [%x[output]], #2\n" + "st1 {v0.b}[10], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 12>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "12>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #12\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 13>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "13>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #13\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v0.b}[12], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "st1 {v0.b}[12], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 14>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "14>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #14\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v0.h}[6], [%x[input]], #2\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "st1 {v0.h}[6], [%x[output]], #2\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 15>::Transform(const uint8_t* input, + const MinMax& params, + uint8_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") MinMax, 16, " + "15>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_count_copy = params.count; + asm volatile( + + // MinMax::Prepare + "dup v4.16b, %w[min]\n" + "dup v5.16b, %w[max]\n" + + // Reduce count by leftovers. + "subs %x[count], %x[count], #15\n" + "beq 2f\n" + + "1:" + "subs %x[count], %x[count], #16\n" + + // MinMax::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + + "bne 1b\n" + "2:" + + // Handle leftovers. + + // MinMax::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v0.h}[6], [%x[input]], #2\n" + "ld1 {v0.b}[14], [%x[input]], #1\n" + "prfm pldl1keep, [%x[input], #16]\n" + "umax v0.16b, v0.16b, v4.16b\n" + "umin v0.16b, v0.16b, v5.16b\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "st1 {v0.h}[6], [%x[output]], #2\n" + "st1 {v0.b}[14], [%x[output]], #1\n" + "prfm pldl1keep, [%x[output]]\n" + : [count] "+r"(params_count_copy), [input] "+r"(input), + [output] "+r"(output) + : [max] "r"(params.max), [min] "r"(params.min) + : "v0", "v4", "v5", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 0>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "0>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 1>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "1>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #1\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.b}[0], [%x[input]], #1\n" + "ld1 {v1.b}[0], [x1], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "uxtl v1.8h, v1.8b\n" + "sxtl v0.4s, v0.4h\n" + "sxtl v1.4s, v1.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + + "st1 {v0.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 2>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "2>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #2\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.h}[0], [%x[input]], #2\n" + "ld1 {v1.h}[0], [x1], #2\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "uxtl v1.8h, v1.8b\n" + "sxtl v0.4s, v0.4h\n" + "sxtl v1.4s, v1.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 3>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "3>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #3\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.h}[0], [%x[input]], #2\n" + "ld1 {v0.b}[2], [%x[input]], #1\n" + "ld1 {v1.h}[0], [x1], #2\n" + "ld1 {v1.b}[2], [x1], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "uxtl v1.8h, v1.8b\n" + "sxtl v0.4s, v0.4h\n" + "sxtl v1.4s, v1.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + + "st1 {v0.2s}, [%x[output]], #8\n" + "st1 {v0.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 4>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "4>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #4\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v1.s}[0], [x1], #4\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "uxtl v1.8h, v1.8b\n" + "sxtl v0.4s, v0.4h\n" + "sxtl v1.4s, v1.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v1.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 5>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "5>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #5\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v0.b}[4], [%x[input]], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.b}[4], [x1], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "uxtl v2.8h, v2.8b\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v3.4s, v2.8h\n" + "sxtl v2.4s, v2.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v11.4s\n" + "fmul v3.4s, v3.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v10.4s\n" + "fadd v3.4s, v3.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v2.4s\n" + "fadd v1.4s, v1.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "st1 {v1.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 6>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "6>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #6\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v0.h}[2], [%x[input]], #2\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "uxtl v2.8h, v2.8b\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v3.4s, v2.8h\n" + "sxtl v2.4s, v2.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v11.4s\n" + "fmul v3.4s, v3.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v10.4s\n" + "fadd v3.4s, v3.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v2.4s\n" + "fadd v1.4s, v1.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "st1 {v1.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 7>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "7>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #7\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.s}[0], [%x[input]], #4\n" + "ld1 {v0.h}[2], [%x[input]], #2\n" + "ld1 {v0.b}[6], [%x[input]], #1\n" + "ld1 {v2.s}[0], [x1], #4\n" + "ld1 {v2.h}[2], [x1], #2\n" + "ld1 {v2.b}[6], [x1], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "uxtl v2.8h, v2.8b\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v3.4s, v2.8h\n" + "sxtl v2.4s, v2.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v11.4s\n" + "fmul v3.4s, v3.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v10.4s\n" + "fadd v3.4s, v3.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v2.4s\n" + "fadd v1.4s, v1.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + + "st1 {v0.4s}, [%x[output]], #16\n" + "st1 {v1.2s}, [%x[output]], #8\n" + "st1 {v1.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 8>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "8>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #8\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v2.2s}, [x1], #8\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl v0.8h, v0.8b\n" + "uxtl v2.8h, v2.8b\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v3.4s, v2.8h\n" + "sxtl v2.4s, v2.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v11.4s\n" + "fmul v3.4s, v3.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v10.4s\n" + "fadd v3.4s, v3.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v2.4s\n" + "fadd v1.4s, v1.4s, v3.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + + "st1 {v0.4s, v1.4s}, [%x[output]], #32\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 9>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "9>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #9\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.b}[8], [%x[input]], #1\n" + "ld1 {v3.2s}, [x1], #8\n" + "ld1 {v3.b}[8], [x1], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v4.8h, v3.16b\n" + "uxtl v3.8h, v3.8b\n" + "sxtl v2.4s, v1.4h\n" + "sxtl v5.4s, v4.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v4.4s, v3.8h\n" + "sxtl v3.4s, v3.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v11.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v10.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v3.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + + "st1 {v0.4s, v1.4s}, [%x[output]], #32\n" + "st1 {v2.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 10>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "10>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #10\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.h}[4], [%x[input]], #2\n" + "ld1 {v3.2s}, [x1], #8\n" + "ld1 {v3.h}[4], [x1], #2\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v4.8h, v3.16b\n" + "uxtl v3.8h, v3.8b\n" + "sxtl v2.4s, v1.4h\n" + "sxtl v5.4s, v4.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v4.4s, v3.8h\n" + "sxtl v3.4s, v3.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v11.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v10.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v3.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + + "st1 {v0.4s, v1.4s}, [%x[output]], #32\n" + "st1 {v2.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 11>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "11>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #11\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.h}[4], [%x[input]], #2\n" + "ld1 {v0.b}[10], [%x[input]], #1\n" + "ld1 {v3.2s}, [x1], #8\n" + "ld1 {v3.h}[4], [x1], #2\n" + "ld1 {v3.b}[10], [x1], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v4.8h, v3.16b\n" + "uxtl v3.8h, v3.8b\n" + "sxtl v2.4s, v1.4h\n" + "sxtl v5.4s, v4.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v4.4s, v3.8h\n" + "sxtl v3.4s, v3.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v11.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v10.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v3.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + + "st1 {v0.4s, v1.4s}, [%x[output]], #32\n" + "st1 {v2.2s}, [%x[output]], #8\n" + "st1 {v2.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 12>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "12>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #12\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v3.2s}, [x1], #8\n" + "ld1 {v3.s}[2], [x1], #4\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v4.8h, v3.16b\n" + "uxtl v3.8h, v3.8b\n" + "sxtl v2.4s, v1.4h\n" + "sxtl v5.4s, v4.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v4.4s, v3.8h\n" + "sxtl v3.4s, v3.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v11.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v10.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v3.4s\n" + "fadd v1.4s, v1.4s, v4.4s\n" + "fadd v2.4s, v2.4s, v5.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s}, [%x[output]], #48\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 13>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "13>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #13\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v0.b}[12], [%x[input]], #1\n" + "ld1 {v4.2s}, [x1], #8\n" + "ld1 {v4.s}[2], [x1], #4\n" + "ld1 {v4.b}[12], [x1], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s}, [%x[output]], #48\n" + "st1 {v3.s}[0], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 14>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "14>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #14\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v0.h}[6], [%x[input]], #2\n" + "ld1 {v4.2s}, [x1], #8\n" + "ld1 {v4.s}[2], [x1], #4\n" + "ld1 {v4.h}[6], [x1], #2\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s}, [%x[output]], #48\n" + "st1 {v3.2s}, [%x[output]], #8\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +template <> +inline void Transform1DKernel, 16, + 15>::Transform(const uint8_t* input, + const BiasAdd& params, + int32_t* output) { +#ifdef DEBUG +#ifdef DEBUG_METAGEMM_VERBOSE + std::cout << __FILE__ << "(" << __LINE__ + << ") BiasAdd, 16, " + "15>::Transform()" + << std::endl + << std::flush; +#endif +#endif + int params_rows_copy = params.rows; + asm volatile( + "ldr w0, %[input_range_min]\n" + "dup v8.4s, w0\n" + "ldr w0, %[input_range_scale]\n" + "dup v9.4s, w0\n" + "ldr w0, %[bias_range_min]\n" + "dup v10.4s, w0\n" + "ldr w0, %[bias_range_scale]\n" + "dup v11.4s, w0\n" + "ldr w0, %[output_range_min]\n" + "dup v12.4s, w0\n" + "ldr w0, %[one_over_output_range_scale]\n" + "dup v13.4s, w0\n" + "ldr w0, %[output_range_offset]\n" + "dup v14.4s, w0\n" + "1:" + "mov x0, %x[count]\n" + "mov x1, %x[bias]\n" + "subs x0, x0, #15\n" + "beq 3f\n" + "2:" + "subs x0, x0, #16\n" + + // BiasAdd::Transform + "ld1 {v0.4s}, [%x[input]], #16\n" + "ld1 {v4.4s}, [x1], #16\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s, v3.4s}, [%x[output]], #64\n" + "prfm pldl1keep, [%x[output]]\n" + "bne 2b\n" + "3:" + + // BiasAdd::Transform + "ld1 {v0.2s}, [%x[input]], #8\n" + "ld1 {v0.s}[2], [%x[input]], #4\n" + "ld1 {v0.h}[6], [%x[input]], #2\n" + "ld1 {v0.b}[14], [%x[input]], #1\n" + "ld1 {v4.2s}, [x1], #8\n" + "ld1 {v4.s}[2], [x1], #4\n" + "ld1 {v4.h}[6], [x1], #2\n" + "ld1 {v4.b}[14], [x1], #1\n" + "prfm pldl1keep, [%x[input], #32]\n" + "uxtl2 v1.8h, v0.16b\n" + "uxtl v0.8h, v0.8b\n" + "uxtl2 v5.8h, v4.16b\n" + "uxtl v4.8h, v4.8b\n" + "sxtl2 v3.4s, v1.8h\n" + "sxtl v2.4s, v1.4h\n" + "sxtl2 v7.4s, v5.8h\n" + "sxtl v6.4s, v5.4h\n" + "sxtl2 v1.4s, v0.8h\n" + "sxtl v0.4s, v0.4h\n" + "sxtl2 v5.4s, v4.8h\n" + "sxtl v4.4s, v4.4h\n" + "scvtf v0.4s, v0.4s\n" + "scvtf v1.4s, v1.4s\n" + "scvtf v2.4s, v2.4s\n" + "scvtf v3.4s, v3.4s\n" + "scvtf v4.4s, v4.4s\n" + "scvtf v5.4s, v5.4s\n" + "scvtf v6.4s, v6.4s\n" + "scvtf v7.4s, v7.4s\n" + "fmul v0.4s, v0.4s, v9.4s\n" + "fmul v1.4s, v1.4s, v9.4s\n" + "fmul v2.4s, v2.4s, v9.4s\n" + "fmul v3.4s, v3.4s, v9.4s\n" + "fmul v4.4s, v4.4s, v11.4s\n" + "fmul v5.4s, v5.4s, v11.4s\n" + "fmul v6.4s, v6.4s, v11.4s\n" + "fmul v7.4s, v7.4s, v11.4s\n" + "fadd v0.4s, v0.4s, v8.4s\n" + "fadd v1.4s, v1.4s, v8.4s\n" + "fadd v2.4s, v2.4s, v8.4s\n" + "fadd v3.4s, v3.4s, v8.4s\n" + "fadd v4.4s, v4.4s, v10.4s\n" + "fadd v5.4s, v5.4s, v10.4s\n" + "fadd v6.4s, v6.4s, v10.4s\n" + "fadd v7.4s, v7.4s, v10.4s\n" + "fadd v0.4s, v0.4s, v4.4s\n" + "fadd v1.4s, v1.4s, v5.4s\n" + "fadd v2.4s, v2.4s, v6.4s\n" + "fadd v3.4s, v3.4s, v7.4s\n" + "fsub v0.4s, v0.4s, v12.4s\n" + "fsub v1.4s, v1.4s, v12.4s\n" + "fsub v2.4s, v2.4s, v12.4s\n" + "fsub v3.4s, v3.4s, v12.4s\n" + "fmul v0.4s, v0.4s, v13.4s\n" + "fmul v1.4s, v1.4s, v13.4s\n" + "fmul v2.4s, v2.4s, v13.4s\n" + "fmul v3.4s, v3.4s, v13.4s\n" + "fadd v0.4s, v0.4s, v14.4s\n" + "fadd v1.4s, v1.4s, v14.4s\n" + "fadd v2.4s, v2.4s, v14.4s\n" + "fadd v3.4s, v3.4s, v14.4s\n" + "fcvtzs v0.4s, v0.4s\n" + "fcvtzs v1.4s, v1.4s\n" + "fcvtzs v2.4s, v2.4s\n" + "fcvtzs v3.4s, v3.4s\n" + + "st1 {v0.4s, v1.4s, v2.4s}, [%x[output]], #48\n" + "st1 {v3.2s}, [%x[output]], #8\n" + "st1 {v3.s}[2], [%x[output]], #4\n" + "prfm pldl1keep, [%x[output]]\n" + "subs %x[rows], %x[rows], #1\n" + "bne 1b\n" + : [input] "+r"(input), [output] "+r"(output) + : [count] "r"(params.count), [rows] "r"(params_rows_copy), + [output_range_offset] "m"(params.output_range_offset), + [input_range_scale] "m"(params.input_range_scale), + [one_over_output_range_scale] "m"(params.one_over_output_range_scale), + [bias_range_min] "m"(params.bias_range_min), + [output_range_min] "m"(params.output_range_min), + [bias_range_scale] "m"(params.bias_range_scale), + [bias] "r"(params.bias), [input_range_min] "m"(params.input_range_min) + : "x0", "x1", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "cc", "memory"); +} + +} // namespace meta +} // namespace gemmlowp + +#else +#warning "Meta gemm for arm64 requires: GEMMLOWP_NEON_64!" +#endif + +#endif // GEMMLOWP_META_TRANSFORM_KERNELS_ARM_64_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/profiling/instrumentation.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/profiling/instrumentation.h new file mode 100644 index 0000000000000000000000000000000000000000..c1f852e866564ad00997a377bb6f3099bb83dd82 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/profiling/instrumentation.h @@ -0,0 +1,243 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// instrumentation.h: contains the definitions needed to +// instrument code for profiling: +// ScopedProfilingLabel, RegisterCurrentThreadForProfiling. +// +// profiler.h is only needed to drive the profiler: +// StartProfiling, FinishProfiling. +// +// See the usage example in profiler.h. + +#ifndef GEMMLOWP_PROFILING_INSTRUMENTATION_H_ +#define GEMMLOWP_PROFILING_INSTRUMENTATION_H_ + +#include + +#ifndef GEMMLOWP_USE_STLPORT +#include +#else +#include +namespace std { +using ::int16_t; +using ::int32_t; +using ::int8_t; +using ::size_t; +using ::uint16_t; +using ::uint32_t; +using ::uint8_t; +using ::uintptr_t; +} // namespace std +#endif + +#include +#include +#include + +#ifdef GEMMLOWP_PROFILING +#include +#include +#endif + +#include "./pthread_everywhere.h" + +namespace gemmlowp { + +inline void ReleaseBuildAssertion(bool condition, const char* msg) { + if (!condition) { + fprintf(stderr, "gemmlowp error: %s\n", msg); + abort(); + } +} + +class Mutex { + public: + Mutex(const Mutex&) = delete; + Mutex& operator=(const Mutex&) = delete; + + Mutex() { pthread_mutex_init(&m, NULL); } + ~Mutex() { pthread_mutex_destroy(&m); } + + void Lock() { pthread_mutex_lock(&m); } + void Unlock() { pthread_mutex_unlock(&m); } + + private: + pthread_mutex_t m; +}; + +class GlobalMutexes { + public: + static Mutex* Profiler() { + static Mutex m; + return &m; + } + + static Mutex* EightBitIntGemm() { + static Mutex m; + return &m; + } +}; + +// A very simple RAII helper to lock and unlock a Mutex +struct ScopedLock { + ScopedLock(Mutex* m) : _m(m) { _m->Lock(); } + ~ScopedLock() { _m->Unlock(); } + + private: + Mutex* _m; +}; + +// Profiling definitions. Two paths: when profiling is enabled, +// and when profiling is disabled. +#ifdef GEMMLOWP_PROFILING +// This code path is when profiling is enabled. + +// A pseudo-call-stack. Contrary to a real call-stack, this only +// contains pointers to literal strings that were manually entered +// in the instrumented code (see ScopedProfilingLabel). +struct ProfilingStack { + static const std::size_t kMaxSize = 30; + typedef const char* LabelsArrayType[kMaxSize]; + LabelsArrayType labels; + std::size_t size; + Mutex* lock; + + ProfilingStack() { memset(this, 0, sizeof(ProfilingStack)); } + ~ProfilingStack() { delete lock; } + + void Push(const char* label) { + ScopedLock sl(lock); + ReleaseBuildAssertion(size < kMaxSize, "ProfilingStack overflow"); + labels[size] = label; + size++; + } + + void Pop() { + ScopedLock sl(lock); + ReleaseBuildAssertion(size > 0, "ProfilingStack underflow"); + size--; + } + + void UpdateTop(const char* new_label) { + ScopedLock sl(lock); + assert(size); + labels[size - 1] = new_label; + } + + ProfilingStack& operator=(const ProfilingStack& other) { + memcpy(this, &other, sizeof(ProfilingStack)); + return *this; + } + + bool operator==(const ProfilingStack& other) const { + return !memcmp(this, &other, sizeof(ProfilingStack)); + } +}; + +static_assert( + !(sizeof(ProfilingStack) & (sizeof(ProfilingStack) - 1)), + "ProfilingStack should have power-of-two size to fit in cache lines"); + +struct ThreadInfo; + +// The global set of threads being profiled. +inline std::set& ThreadsUnderProfiling() { + static std::set v; + return v; +} + +struct ThreadInfo { + pthread_key_t key; // used only to get a callback at thread exit. + ProfilingStack stack; + + ThreadInfo() { + pthread_key_create(&key, ThreadExitCallback); + pthread_setspecific(key, this); + stack.lock = new Mutex(); + } + + static void ThreadExitCallback(void* ptr) { + ScopedLock sl(GlobalMutexes::Profiler()); + ThreadInfo* self = static_cast(ptr); + ThreadsUnderProfiling().erase(self); + } +}; + +inline ThreadInfo& ThreadLocalThreadInfo() { + static pthread_key_t key; + static auto DeleteThreadInfo = [](void* threadInfoPtr) { + ThreadInfo* threadInfo = static_cast(threadInfoPtr); + if (threadInfo) { + delete threadInfo; + } + }; + + // key_result is unused. The purpose of this 'static' local object is + // to have its initializer (the pthread_key_create call) performed exactly + // once, in a way that is guaranteed (since C++11) to be reentrant. + static const int key_result = pthread_key_create(&key, DeleteThreadInfo); + (void)key_result; + + ThreadInfo* threadInfo = static_cast(pthread_getspecific(key)); + if (!threadInfo) { + threadInfo = new ThreadInfo(); + pthread_setspecific(key, threadInfo); + } + return *threadInfo; +} + +// ScopedProfilingLabel is how one instruments code for profiling +// with this profiler. Construct local ScopedProfilingLabel variables, +// passing a literal string describing the local code. Profile +// samples will then be annotated with this label, while it is in scope +// (whence the name --- also known as RAII). +// See the example in profiler.h. +class ScopedProfilingLabel { + ProfilingStack* profiling_stack_; + + public: + explicit ScopedProfilingLabel(const char* label) + : profiling_stack_(&ThreadLocalThreadInfo().stack) { + profiling_stack_->Push(label); + } + + ~ScopedProfilingLabel() { profiling_stack_->Pop(); } + + void Update(const char* new_label) { profiling_stack_->UpdateTop(new_label); } +}; + +// To be called once on each thread to be profiled. +inline void RegisterCurrentThreadForProfiling() { + ScopedLock sl(GlobalMutexes::Profiler()); + ThreadsUnderProfiling().insert(&ThreadLocalThreadInfo()); +} + +#else // not GEMMLOWP_PROFILING +// This code path is when profiling is disabled. + +// This empty definition of ScopedProfilingLabel ensures that +// it has zero runtime overhead when profiling is disabled. +struct ScopedProfilingLabel { + explicit ScopedProfilingLabel(const char*) {} + void Update(const char*) {} +}; + +inline void RegisterCurrentThreadForProfiling() {} + +#endif + +} // end namespace gemmlowp + +#endif // GEMMLOWP_PROFILING_INSTRUMENTATION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/profiling/profiler.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/profiling/profiler.h new file mode 100644 index 0000000000000000000000000000000000000000..018da577a8ed4beacbdc450225e92a05180da51e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/profiling/profiler.h @@ -0,0 +1,373 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// profiler.h: a simple sampling profiler that's always just one #include away! +// +// Overview +// ======== +// +// This profiler only samples a pseudo-stack, not the actual call stack. +// The code to be profiled needs to be instrumented with +// pseudo-stack "labels", see ScopedProfilingLabel. +// Using pseudo-stacks allows this profiler to be very simple, low-overhead, +// portable, and independent of compilation details such as function inlining +// and frame pointers. The granularity of instrumentation can be freely chosen, +// and it is possible to get some annotate-like detail, i.e. detail within one +// function without splitting it into multiple functions. +// +// This profiler should remain small and simple; its key feature is to fit in +// a single header file so that there should never be a reason to refrain +// from profiling. More complex and feature-rich alternatives are +// readily available. This one offers a strict superset of its +// functionality: https://github.com/bgirard/GeckoProfiler, including +// intertwining pseudostacks with real call stacks, more annotation options, +// and advanced visualization. +// +// Usage +// ===== +// +// 0. Enable profiling by defining GEMMLOWP_PROFILING. When profiling is +// not enabled, profiling instrumentation from instrumentation.h +// (ScopedProfilingLabel, RegisterCurrentThreadForProfiling) +// is still defined but does nothing. On the other hand, +// when profiling is not enabled, it is an error to #include the +// present file. +// +// 1. Each thread can opt in to profiling by calling +// RegisterCurrentThreadForProfiling() defined in instrumentation.h. +// This can be done at any time, before or during profiling. +// No sample will be collected from a thread until +// it has called RegisterCurrentThreadForProfiling(). +// +// 2. Instrument your code to be profiled with ScopedProfilingLabel, +// which is a RAII helper defined in instrumentation.h. The identifier +// names (some_label, etc) do not matter; what will show up +// in the profile is the string passed to the constructor, which +// must be a literal string. See the full example below. +// +// Note: the overhead of ScopedProfilingLabel is zero when not +// enabling profiling (when not defining GEMMLOWP_PROFILING). +// +// 3. Use the profiler.h interface to control profiling. There are two +// functions: StartProfiling() and FinishProfiling(). They must be +// called on the same thread. FinishProfiling() prints the profile +// on stdout. +// +// Full example +// ============ +/* + #define GEMMLOWP_PROFILING + #include "profiling/instrumentation.h" + using namespace gemmlowp; + + const int iters = 100000000; + volatile int i; + + void Bar() { + ScopedProfilingLabel label("Bar"); + for (i = 0; i < iters; i++) {} + } + + void Foo() { + ScopedProfilingLabel label("Foo"); + for (i = 0; i < iters; i++) {} + Bar(); + } + + void Init() { + RegisterCurrentThreadForProfiling(); + } + + #include "profiling/profiler.h" + + int main() { + Init(); + StartProfiling(); + Foo(); + FinishProfiling(); + } +* +* Output: +* + gemmlowp profile (1 threads, 304 samples) + 100.00% Foo + 51.32% other + 48.68% Bar + 0.00% other (outside of any label) +*/ +// +// Interpreting results +// ==================== +// +// Each node shows the absolute percentage, among all the samples, +// of the number of samples that recorded the given pseudo-stack. +// The percentages are *NOT* relative to the parent node. In addition +// to your own labels, you will also see 'other' nodes that collect +// the remainder of samples under the parent node that didn't fall into +// any of the labelled child nodes. Example: +// +// 20% Foo +// 12% Bar +// 6% Xyz +// 2% other +// +// This means that 20% of all labels were under Foo, of which 12%/20%==60% +// were under Bar, 6%/20%==30% were under Xyz, and 2%/20%==10% were not +// under either Bar or Xyz. +// +// Typically, one wants to keep adding ScopedProfilingLabel's until +// the 'other' nodes show low percentages. +// +// Interpreting results with multiple threads +// ========================================== +// +// At each sample, each thread registered for profiling gets sampled once. +// So if there is one "main thread" spending its time in MainFunc() and +// 4 "worker threads" spending time in WorkerFunc(), then 80% (=4/5) of the +// samples will be in WorkerFunc, so the profile will look like this: +// +// 80% WorkerFunc +// 20% MainFunc + +#ifndef GEMMLOWP_PROFILING_PROFILER_H_ +#define GEMMLOWP_PROFILING_PROFILER_H_ + +#ifndef GEMMLOWP_PROFILING +#error Profiling is not enabled! +#endif + +#include + +#include "instrumentation.h" + +namespace gemmlowp { + +// A tree view of a profile. +class ProfileTreeView { + struct Node { + std::vector children; + const char* label; + std::size_t weight; + Node() : label(nullptr), weight(0) {} + ~Node() { + for (auto child : children) { + delete child; + } + } + }; + + static bool CompareNodes(Node* n1, Node* n2) { + return n1->weight > n2->weight; + } + + Node root_; + + void PrintNode(const Node* node, int level) const { + if (level) { + for (int i = 1; i < level; i++) { + printf(" "); + } + printf("%.2f%% %s\n", 100.0f * node->weight / root_.weight, node->label); + } + for (auto child : node->children) { + PrintNode(child, level + 1); + } + } + + static void AddStackToNode(const ProfilingStack& stack, Node* node, + std::size_t level) { + node->weight++; + if (stack.size == level) { + return; + } + Node* child_to_add_to = nullptr; + for (auto child : node->children) { + if (child->label == stack.labels[level]) { + child_to_add_to = child; + break; + } + } + if (!child_to_add_to) { + child_to_add_to = new Node; + child_to_add_to->label = stack.labels[level]; + node->children.push_back(child_to_add_to); + } + AddStackToNode(stack, child_to_add_to, level + 1); + return; + } + + void AddStack(const ProfilingStack& stack) { + AddStackToNode(stack, &root_, 0); + } + + void AddOtherChildrenToNode(Node* node) { + std::size_t top_level_children_weight = 0; + for (auto c : node->children) { + AddOtherChildrenToNode(c); + top_level_children_weight += c->weight; + } + if (top_level_children_weight) { + Node* other_child = new Node; + other_child->label = + node == &root_ ? "other (outside of any label)" : "other"; + other_child->weight = node->weight - top_level_children_weight; + node->children.push_back(other_child); + } + } + + void AddOtherNodes() { AddOtherChildrenToNode(&root_); } + + void SortNode(Node* node) { + std::sort(node->children.begin(), node->children.end(), CompareNodes); + for (auto child : node->children) { + SortNode(child); + } + } + + void Sort() { SortNode(&root_); } + + public: + explicit ProfileTreeView(const std::vector& stacks) { + for (auto stack : stacks) { + AddStack(stack); + } + AddOtherNodes(); + Sort(); + } + + void Print() const { + printf("\n"); + printf("gemmlowp profile (%d threads, %d samples)\n", + static_cast(ThreadsUnderProfiling().size()), + static_cast(root_.weight)); + PrintNode(&root_, 0); + printf("\n"); + } +}; + +// This function is the only place that determines our sampling frequency. +inline void WaitOneProfilerTick() { + static const int millisecond = 1000000; + +#if defined __arm__ || defined __aarch64__ + // Reduced sampling frequency on mobile devices helps limit time and memory + // overhead there. + static const int interval = 10 * millisecond; +#else + static const int interval = 1 * millisecond; +#endif + + timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = interval; + nanosleep(&ts, nullptr); +} + +// This is how we track whether we've already started profiling, +// to guard against misuse of the API. +inline bool& IsProfiling() { + static bool b; + return b; +} + +// This is how we tell the profiler thread to finish. +inline bool& ProfilerThreadShouldFinish() { + static bool b; + return b; +} + +// The profiler thread. See ProfilerThreadFunc. +inline pthread_t& ProfilerThread() { + static pthread_t t; + return t; +} + +// Records a stack from a running thread. +// The tricky part is that we're not interrupting the thread. +// This is OK because we're looking at a pseudo-stack of labels, +// not at the real thread stack, and if the pseudo-stack changes +// while we're recording it, we are OK with getting either the +// old or the new stack. Note that ProfilingStack::Pop +// only decrements the size, and doesn't null the popped label, +// so if we're concurrently recording it, it shouldn't change +// under our feet until another label is pushed, at which point +// we are OK with getting either this new label or the old one. +// In the end, the key atomicity property that we are relying on +// here is that pointers are changed atomically, and the labels +// are pointers (to literal strings). +inline void RecordStack(ThreadInfo* thread, ProfilingStack* dst) { + ScopedLock sl(thread->stack.lock); + assert(!dst->size); + while (dst->size < thread->stack.size) { + dst->labels[dst->size] = thread->stack.labels[dst->size]; + dst->size++; + } +} + +// The profiler thread's entry point. +// Note that a separate thread is to be started each time we call +// StartProfiling(), and finishes when we call FinishProfiling(). +// So here we only need to handle the recording and reporting of +// a single profile. +inline void* ProfilerThreadFunc(void*) { + assert(ProfilerThread() == pthread_self()); + + // Since we only handle one profile per profiler thread, the + // profile data (the array of recorded stacks) can be a local variable here. + std::vector stacks; + + while (!ProfilerThreadShouldFinish()) { + WaitOneProfilerTick(); + { + ScopedLock sl(GlobalMutexes::Profiler()); + for (auto t : ThreadsUnderProfiling()) { + ProfilingStack s; + RecordStack(t, &s); + stacks.push_back(s); + } + } + } + + // Profiling is finished and we now report the results. + ProfileTreeView(stacks).Print(); + + return nullptr; +} + +// Starts recording samples. +inline void StartProfiling() { + ScopedLock sl(GlobalMutexes::Profiler()); + ReleaseBuildAssertion(!IsProfiling(), "We're already profiling!"); + IsProfiling() = true; + ProfilerThreadShouldFinish() = false; + pthread_create(&ProfilerThread(), nullptr, ProfilerThreadFunc, nullptr); +} + +// Stops recording samples, and prints a profile tree-view on stdout. +inline void FinishProfiling() { + { + ScopedLock sl(GlobalMutexes::Profiler()); + ReleaseBuildAssertion(IsProfiling(), "We weren't profiling!"); + // The ProfilerThreadShouldFinish() mechanism here is really naive and bad, + // as the scary comments below should make clear. + // Should we use a condition variable? + ProfilerThreadShouldFinish() = true; + } // must release the lock here to avoid deadlock with profiler thread. + pthread_join(ProfilerThread(), nullptr); + IsProfiling() = false; // yikes, this should be guarded by the lock! +} + +} // namespace gemmlowp + +#endif // GEMMLOWP_PROFILING_PROFILER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/profiling/pthread_everywhere.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/profiling/pthread_everywhere.h new file mode 100644 index 0000000000000000000000000000000000000000..2569bbcd1b75602b00c68c00d8004913e8d53504 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/profiling/pthread_everywhere.h @@ -0,0 +1,77 @@ +// Copyright 2017 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// pthread_everywhere.h: Either includes or implements a +// subset of pthread functionality on top of C++11 for portability. + +#ifndef GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_ +#define GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_ + +#ifndef _WIN32 +#define GEMMLOWP_USE_PTHREAD +#endif + +#if defined GEMMLOWP_USE_PTHREAD +#include +#else +// Implement a small subset of pthread on top of C++11 threads. +// The function signatures differ from true pthread functions in two ways: +// - True pthread functions return int error codes, ours return void. +// Rationale: the c++11 equivalent functions return void +// and use exceptions to report errors; we don't want to deal with +// exceptions in this code, so we couldn't meaningfully return errors +// in the polyfill. Also, the gemmlowp code using these pthread functions +// never checks their return values anyway. +// - True pthread *_create/*_init functions take pointers to 'attribute' +// structs; ours take nullptr_t. That is because gemmlowp always passes +// nullptr at the moment, so any support we would code for non-null +// attribs would be unused. +#include +#include +#include +#include +namespace gemmlowp { +using pthread_t = std::thread *; +using pthread_mutex_t = std::mutex *; +using pthread_cond_t = std::condition_variable *; +inline void pthread_create(pthread_t *thread, std::nullptr_t, + void *(*start_routine)(void *), void *arg) { + *thread = new std::thread(start_routine, arg); +} +inline void pthread_join(pthread_t thread, std::nullptr_t) { thread->join(); } +inline void pthread_mutex_init(pthread_mutex_t *mutex, std::nullptr_t) { + *mutex = new std::mutex; +} +inline void pthread_mutex_lock(pthread_mutex_t *mutex) { (*mutex)->lock(); } +inline void pthread_mutex_unlock(pthread_mutex_t *mutex) { (*mutex)->unlock(); } +inline void pthread_mutex_destroy(pthread_mutex_t *mutex) { delete *mutex; } +inline void pthread_cond_init(pthread_cond_t *cond, std::nullptr_t) { + *cond = new std::condition_variable; +} +inline void pthread_cond_signal(pthread_cond_t *cond) { (*cond)->notify_one(); } +inline void pthread_cond_broadcast(pthread_cond_t *cond) { + (*cond)->notify_all(); +} +inline void pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) { + std::unique_lock lock(**mutex, std::adopt_lock); + (*cond)->wait(lock); + // detach lock from mutex so when we leave this conext + // the lock is not released + lock.release(); +} +inline void pthread_cond_destroy(pthread_cond_t *cond) { delete *cond; } +} // end namespace gemmlowp +#endif + +#endif // GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/bit_depth.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/bit_depth.h new file mode 100644 index 0000000000000000000000000000000000000000..5b1943067e26dcc4931553c94179416e96737265 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/bit_depth.h @@ -0,0 +1,68 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bit_depth.h: defines the settins controlling LHS/RHS bit depth + +#ifndef GEMMLOWP_PUBLIC_BIT_DEPTH_H_ +#define GEMMLOWP_PUBLIC_BIT_DEPTH_H_ + +namespace gemmlowp { + +// The range of allowed values for an operand. +template +struct OperandRange { + static constexpr int kMinValue = tMinValue; + static constexpr int kMaxValue = tMaxValue; + static_assert(kMinValue < kMaxValue, ""); +}; + +using Uint8Range = OperandRange<0, 255>; +using Uint8RangeExcludingZero = OperandRange<1, 255>; + +using Int8Range = OperandRange<-128, 127>; +using Int8RangeExcludingLow = OperandRange<-127, 127>; + +template +struct BitDepthParams { + using LhsRange = tLhsRange; + using RhsRange = tRhsRange; +}; + +// Default: LHS and RHS are 8bit. +using DefaultL8R8BitDepthParams = BitDepthParams; + +// Variant: LHS may not take the value 0. This allows using +// faster kernels using signed arithmetic, see +// NEON_64bit_GEMM_Int8Operands_Int32Accumulators_AccumTwoWithin16Bits +using L8R8WithLhsNonzeroBitDepthParams = + BitDepthParams; + +// Signed Variant: This allows using faster kernels using signed arithmetic, see +// NEON_64bit_GEMM_Int8Operands_Int32Accumulators_AccumTwoWithin16Bits +using SignedL8R8WithLhsNonzeroBitDepthParams = + BitDepthParams; + +// Deprecated: when gemmlowp used to allow requantizing 8bit +// inputs to less-than-8-bit depths, the public setting allowing +// that was DefaultL7R5BitDepthParams. That requantization +// feature has been removed, but as the whole point of that +// requantization was to make less-than-8-bit an internal +// optimization without any impact on the API (other than lowering +// accuracy), we can temporarily support users who were using it +// by mapping it to the default 8bit behavior. +using DefaultL7R5BitDepthParams = DefaultL8R8BitDepthParams; + +} // namespace gemmlowp + +#endif // GEMMLOWP_PUBLIC_BIT_DEPTH_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/gemmlowp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/gemmlowp.h new file mode 100644 index 0000000000000000000000000000000000000000..05b0f47146b4894dd82bcb38232a0c9768d3c089 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/gemmlowp.h @@ -0,0 +1,87 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// gemmlowp.h: the main public interface header of gemmlowp. + +#ifndef GEMMLOWP_PUBLIC_GEMMLOWP_H_ +#define GEMMLOWP_PUBLIC_GEMMLOWP_H_ +#include "../internal/dispatch_gemm_shape.h" +#include "bit_depth.h" +#include "map.h" +#include "output_stages.h" + +namespace gemmlowp { + +class GemmContext : public MultiThreadGemmContext {}; + +// Computes a general matrix product ("GEMM"). +// This is a version that supports per channel quantization. +template +void GemmWithOutputPipelinePC(GemmContextType* context, + const MatrixMap& lhs, + const MatrixMap& rhs, + MatrixMap* result, + const LhsOffset& lhs_offset, + const RhsOffset& rhs_offset, + const OutputPipelineType& output_pipeline) { + DispatchGemmShape( + context, lhs, rhs, result, lhs_offset, rhs_offset, output_pipeline); +} + +// Computes a general matrix product ("GEMM"). +// This is the legacy version that does not support per channel quantization. +// The meaning of the offsets, result_mult_int and result_shift +// parameters is the same as in the standard EightBitIntGemm interface +// (which is also implemented in the eight_bit_int_gemm directory). +template +void GemmWithOutputPipeline(GemmContextType* context, + const MatrixMap& lhs, + const MatrixMap& rhs, + MatrixMap* result, + int lhs_offset, int rhs_offset, + const OutputPipelineType& output_pipeline) { + typedef VectorDup OffsetColDup; + typedef VectorDup OffsetRowDup; + const OffsetColDup lhs_offset_vector(lhs_offset, lhs.rows()); + const OffsetRowDup rhs_offset_vector(rhs_offset, rhs.cols()); + DispatchGemmShape( + context, lhs, rhs, result, lhs_offset_vector, rhs_offset_vector, + output_pipeline); +} + +// Computes a general matrix product ("GEMM"). +// The meaning of the offsets, result_mult_int and result_shift +// parameters is the same as in the standard EightBitIntGemm interface +// (which is also implemented in the eight_bit_int_gemm directory). +template +void Gemm(GemmContextType* context, + const MatrixMap& lhs, + const MatrixMap& rhs, + MatrixMap* result, int lhs_offset, + int rhs_offset, int result_offset, int result_mult_int, + int result_shift) { + GemmWithOutputPipeline( + context, lhs, rhs, result, lhs_offset, rhs_offset, + MakeStandardOutputPipeline(result_offset, result_mult_int, result_shift)); +} + +} // namespace gemmlowp + +#endif // GEMMLOWP_PUBLIC_GEMMLOWP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/map.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/map.h new file mode 100644 index 0000000000000000000000000000000000000000..6810b2b9b23b8806601ffa9dde73ae29dd40fa12 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/map.h @@ -0,0 +1,142 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// map.h: a minimalist view-existing-buffer-as-a-matrix class, +// which is how gemmlowp interfaces with external matrix data. + +#ifndef GEMMLOWP_PUBLIC_MAP_H_ +#define GEMMLOWP_PUBLIC_MAP_H_ + +#include "../internal/common.h" + +namespace gemmlowp { + +// The two storage orders allowed to map buffers as matrices: ColMajor +// means column-major, RowMajor means row-major. +enum class MapOrder { ColMajor, RowMajor }; + +// A MatrixMap is a view of an existing buffer as a matrix. It does not own +// the buffer. +template +class MatrixMap { + public: + typedef tScalar Scalar; + static constexpr MapOrder kOrder = tOrder; + + protected: + Scalar* data_; // not owned. + int rows_, cols_, stride_; + + public: + MatrixMap() : data_(nullptr), rows_(0), cols_(0), stride_(0) {} + MatrixMap(Scalar* data, int rows, int cols) + : data_(data), + rows_(rows), + cols_(cols), + stride_(kOrder == MapOrder::ColMajor ? rows : cols) {} + MatrixMap(Scalar* data, int rows, int cols, int stride) + : data_(data), rows_(rows), cols_(cols), stride_(stride) {} + MatrixMap(const MatrixMap& other) + : data_(other.data_), + rows_(other.rows_), + cols_(other.cols_), + stride_(other.stride_) {} + + int rows() const { return rows_; } + int cols() const { return cols_; } + int stride() const { return stride_; } + int rows_stride() const { return kOrder == MapOrder::ColMajor ? 1 : stride_; } + int cols_stride() const { return kOrder == MapOrder::RowMajor ? 1 : stride_; } + Scalar* data() const { return data_; } + Scalar* data(int row, int col) const { + return data_ + row * rows_stride() + col * cols_stride(); + } + Scalar& operator()(int row, int col) const { return *data(row, col); } + + MatrixMap block(int start_row, int start_col, int block_rows, + int block_cols) const { + assert(start_row >= 0); + assert(start_row + block_rows <= rows_); + assert(start_col >= 0); + assert(start_col + block_cols <= cols_); + + return MatrixMap(data(start_row, start_col), block_rows, block_cols, + stride_); + } +}; + +enum class VectorShape { Col, Row }; + +// A VectorMap is a view of an existing buffer as a vector. It does not own +// the buffer. +template +class VectorMap { + public: + typedef tScalar Scalar; + static constexpr VectorShape kShape = tShape; + + protected: + Scalar* data_; // not owned. + int size_; + + public: + VectorMap() : data_(nullptr), size_(0) {} + VectorMap(Scalar* data, int size) : data_(data), size_(size) {} + VectorMap(const VectorMap& other) = default; + VectorMap& operator=(const VectorMap& other) = default; + + int size() const { return size_; } + Scalar* data() const { return data_; } + Scalar* data(int index) const { return data_ + index; } + Scalar& operator()(int index) const { return *data(index); } + + VectorMap block(int start, int len) const { + assert(start >= 0); + assert(start + len <= size_); + + return VectorMap(data(start), len); + } +}; + +// A VectorDup is a (duplicated value) vector where all components are the same. +template +class VectorDup { + public: + typedef tScalar Scalar; + static constexpr VectorShape kShape = tShape; + + protected: + Scalar data_; + int size_; + + public: + VectorDup() : data_(0), size_(0) {} + VectorDup(Scalar data, int size) : data_(data), size_(size) {} + VectorDup(const VectorDup& other) : data_(other.data_), size_(other.size_) {} + + int size() const { return size_; } + Scalar& operator()(int) const { return data_; } + + VectorDup block(int start, int len) const { + assert(start >= 0); + assert(start + len <= size_); + + (void)start; + return VectorDup(data_, len); + } +}; + +} // namespace gemmlowp + +#endif // GEMMLOWP_PUBLIC_MAP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/output_stages.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/output_stages.h new file mode 100644 index 0000000000000000000000000000000000000000..797b6626b28c37dedb9ae5922498b89ce980cb8a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gemmlowp/public/output_stages.h @@ -0,0 +1,243 @@ +// Copyright 2015 The Gemmlowp Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// output_stages.h: public definitions of the output stages that can +// be assembled into an output pipeline, to control how internal +// 32-bit accumulators are transformed to obtain the final uint8 +// result matrix entries. + +#ifndef GEMMLOWP_PUBLIC_OUTPUT_STAGES_H_ +#define GEMMLOWP_PUBLIC_OUTPUT_STAGES_H_ + +#include + +#include "../internal/common.h" + +namespace gemmlowp { + +// This output stage takes int32 values and returns still int32 values, +// but "quantized down" to the uint8 scale; in other words, its output +// is typically what one would then clamp to [0..255] and cast to uint8 +// (see OutputStageSaturatingCastToUint8). +// +// This "quantization down" process depends on 3 parameters, +// result_offset, result_mult_int, result_shift, +// and the result is: +// ((input + result_offset) * result_mult_int + rounding) >> result_shift +// where +// rounding = (result_shift < 1) ? 0 : (1 << (result_shift - 1)); +struct OutputStageQuantizeDownInt32ToUint8Scale { + std::int32_t result_offset; + std::int32_t result_mult_int; + std::int32_t result_shift; +}; + +// This output stage takes int32 values and returns still int32 values, +// but "quantized down" to the uint8 scale; in other words, its output +// is typically what one would then clamp to [0..255] and cast to uint8 +// (see OutputStageSaturatingCastToUint8). +// +// This "quantization down" process depends on 3 parameters, +// result_offset, result_mult_int, result_shift, +// and the result is: +// ((input + result_offset) * result_mult_int + rounding) >> result_shift +// where +// rounding = (result_shift < 1) ? 0 : (1 << (result_shift - 1)); +// +// Difference from OutputStageQuantizeDownInt32ToUint8Scale here is that each +// row or column of the output (depending on tShape) has its own result_offset +// and result_mult_int numbers. +template +struct OutputStageQuantizeDownInt32ToUint8ScalePC { + VectorMap result_offset; + VectorMap result_mult_int; + std::int32_t result_shift; +}; + +// This output stage takes int32 values and returns still int32 values, +// but "quantized down" to a difference scale; for example, in a pipeline +// that outputs uint8 values in [0..255], the output of this stage would be +// int32 values ready to be clamped to [0..255] and casted to uint8 +// (see OutputStageSaturatingCastToUint8). +// +// This "quantization down" process depends on 3 parameters, +// result_offset, result_fixedpoint_multiplier, result_shift, +// and the result is: +// ((FixedPointMul(input, result_fixedpoint_multiplier) + +// rounding) >> result_shift) + result_offset_after_shift +// where +// rounding = (result_shift < 1) ? 0 : (1 << (result_shift - 1)); +// and where FixedPointMul(x, y) is the nearest integer to the following +// mathematical expression, evaluated without overflow or intermediate +// rounding: +// (x * y) / 2^31 +// In practice, it is expected that FixedPointMul will be implemented +// using hardware "rounding doubling int32 multiply high" instructions, +// such as VQRDMULH on ARM. See in fixedpoint.h the generic function, +// SaturatingRoundingDoublingHighMul. +// +// Notice that the other difference from +// OutputStageQuantizeDownInt32ToUint8Scale is that the result offset +// is applied after the multiplier and shift, not before. This ensures +// that no matter what the multiplier and shift are, the result offset +// is effectively integral: offsetting the final result by an integer. +// The motivation for this is to faithfully support quantization schemes +// where the formula linking quantized values to the real mathematical +// values that they represent, is of the form +// +// real_value = scale * (quantized_value - zero_point) +// +// where scale is a real number (represented in quantized form by +// result_fixedpoint_multiplier and result_shift) and zero_point +// is an integer telling which quantized value correspond to the +// real value 0, and is represented here by (the opposite of) +// result_offset_after_shift. +// The motivation for such a quantization scheme, designed to +// ensure that 0 is always a representable value, is that in +// many applications, we need to 0-pad arrays and that can only be +// done for quantized arrays if 0 is a representable value in +// quantized form. In particular, convolution-like operations +// are often implemented using 0-padding, or "im2col"-like +// expansions that implicitly rely on 0-padding. If 0 were not +// a representable value, such operations would have to pad +// using a nonzero value, introducing bias in the computation. +struct OutputStageQuantizeDownInt32ByFixedPoint { + std::int32_t result_fixedpoint_multiplier; + std::int32_t result_shift; + std::int32_t result_offset_after_shift; +}; + +// OutputStageQuantizeDownInt32ToUint8ScaleByFixedPoint is the old deprecated +// name of OutputStageQuantizeDownInt32ByFixedPoint, before we noticed that +// there really wasn't anything Uint8-specific about it. +using OutputStageQuantizeDownInt32ToUint8ScaleByFixedPoint = OutputStageQuantizeDownInt32ByFixedPoint; + +// Variant of OutputStageQuantizeDownInt32ByFixedPoint where the 'shift' +// is not necessarily just a right shift, so we can represent multipliers +// greater than 1. This takes an result_exponent parameter; when it's +// <= 0, this is equivalent to OutputStageQuantizeDownInt32ByFixedPoint +// with result_shift = -result_exponent. +// In the general case, this consists in first left-shifting by +// std::max(result_exponent, 0), before doing the same as +// OutputStageQuantizeDownInt32ByFixedPoint with +// result_shift = std::max(-result_exponent, 0). +struct OutputStageScaleInt32ByFixedPointAndExponent { + std::int32_t result_fixedpoint_multiplier; + std::int32_t result_exponent; + std::int32_t result_offset_after_shift; +}; + +// Variant of OutputStageQuantizeDownInt32ByFixedPoint where the 'shift' +// is not necessarily just a right shift, so we can represent multipliers +// greater than 1. This takes an result_exponent parameter; when it's +// <= 0, this is equivalent to OutputStageQuantizeDownInt32ByFixedPoint +// with result_shift = -result_exponent. +// In the general case, this consists in first left-shifting by +// std::max(result_exponent, 0), before doing the same as +// OutputStageQuantizeDownInt32ByFixedPoint with +// result_shift = std::max(-result_exponent, 0). +// +// Difference from OutputStageScaleInt32ByFixedPointAndExponent here is that +// each row or column of the output (depending on tShape) has its own +// result_fixedpoint_multiplier and result_exponent numbers. +template +struct OutputStageScaleInt32ByFixedPointAndExponentPC { + VectorMap result_fixedpoint_multiplier; + VectorMap result_exponent; + std::int32_t result_offset_after_shift; +}; + +// This output stage takes int32 values that are expected to be already +// on the final uint8 scale, but not necessarily in the [0..255] range. +// It clamps them to the [0..255] range and returns them casted to uint8. +struct OutputStageSaturatingCastToUint8 {}; + +// This output stage takes int32 values that are expected to be already +// on the final int8 scale, but not necessarily in the [-128..127] range. +// It clamps them to the [-128..127] range and returns them casted to int8. +struct OutputStageSaturatingCastToInt8 {}; + +// This output stage takes int32 values that are expected to be already +// in the [0..255] range and returns them casted to uint8. +// This stage can save time if used instead of the +// OutputStageSaturatingCastToUint8 stage immediately after the +// OutputStageClamp stage. +struct OutputStageTruncatingCastToUint8 {}; + +// This output stage takes int32 values that are expected to be already +// on the final int16 scale, but not necessarily in the [-32768..32767] range. +// It clamps them to the [-32768..32767] range and returns them casted to int16. +struct OutputStageSaturatingCastToInt16 {}; + +// This output stage depends on a "bias vector" that should contain int32 +// entries, and be either a row-vector of the same number of columns as the +// result matrix, or a column-vector of the same number of rows as the +// result matrix. This output stage takes int32 values and adds to them +// the corresponding entry of the bias vector (broadcasted in the other +// direction to fit the matrix's shape), outputting int32 values. +template +struct OutputStageBiasAddition { + VectorType bias_vector; +}; + +// This output stage clamps value between the specified min and max bounds. +// It can be used to implement "rectified linear unit" activation functions +// in neural networks. +struct OutputStageClamp { + std::int32_t min; + std::int32_t max; +}; + +struct OutputStageTanh { + std::int32_t real_zero_as_int32; + std::int32_t real_amplitude_as_int32; +}; + +// An output pipeline is just a std::tuple of output stages. +// This function generates a standard output pipeline consisting of two stages: +// OutputStageQuantizeDownInt32ToUint8Scale, OutputStageSaturatingCastToUint8. +inline std::tuple +MakeStandardOutputPipeline(std::int32_t result_offset, + std::int32_t result_mult_int, + std::int32_t result_shift) { + OutputStageQuantizeDownInt32ToUint8Scale quantize_down_stage; + quantize_down_stage.result_offset = result_offset; + quantize_down_stage.result_mult_int = result_mult_int; + quantize_down_stage.result_shift = result_shift; + OutputStageSaturatingCastToUint8 saturating_cast_stage; + return std::make_tuple(quantize_down_stage, saturating_cast_stage); +} + +// An output pipeline is just a std::tuple of output stages. +// This function generates a standard output pipeline consisting of two stages: +// OutputStageQuantizeDownInt32ToUint8ScalePC, OutputStageSaturatingCastToUint8. +template +inline std::tuple, + OutputStageSaturatingCastToUint8> +MakeStandardOutputPipeline( + const VectorMap& result_offset, + const VectorMap& result_mult_int, + std::int32_t result_shift) { + OutputStageQuantizeDownInt32ToUint8ScalePC quantize_down_stage; + quantize_down_stage.result_offset = result_offset; + quantize_down_stage.result_mult_int = result_mult_int; + quantize_down_stage.result_shift = result_shift; + OutputStageSaturatingCastToUint8 saturating_cast_stage; + return std::make_tuple(quantize_down_stage, saturating_cast_stage); +} + +} // namespace gemmlowp + +#endif // GEMMLOWP_PUBLIC_OUTPUT_STAGES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gif/gif_hash.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gif/gif_hash.h new file mode 100644 index 0000000000000000000000000000000000000000..6a1b585e1f42c7141fd00d8237b35d3acee0ed5f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gif/gif_hash.h @@ -0,0 +1,41 @@ +/****************************************************************************** + +gif_hash.h - magfic constants and declarations for GIF LZW + +SPDX-License-Identifier: MIT + +******************************************************************************/ + +#ifndef _GIF_HASH_H_ +#define _GIF_HASH_H_ + +#include +#include + +#define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */ +#define HT_KEY_MASK 0x1FFF /* 13bits keys */ +#define HT_KEY_NUM_BITS 13 /* 13bits keys */ +#define HT_MAX_KEY 8191 /* 13bits - 1, maximal code possible */ +#define HT_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ + +/* The 32 bits of the long are divided into two parts for the key & code: */ +/* 1. The code is 12 bits as our compression algorithm is limited to 12bits */ +/* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits. */ +/* The key is the upper 20 bits. The code is the lower 12. */ +#define HT_GET_KEY(l) (l >> 12) +#define HT_GET_CODE(l) (l & 0x0FFF) +#define HT_PUT_KEY(l) (l << 12) +#define HT_PUT_CODE(l) (l & 0x0FFF) + +typedef struct GifHashTableType { + uint32_t HTable[HT_SIZE]; +} GifHashTableType; + +GifHashTableType *_InitHashTable(void); +void _ClearHashTable(GifHashTableType *HashTable); +void _InsertHashTable(GifHashTableType *HashTable, uint32_t Key, int Code); +int _ExistsHashTable(GifHashTableType *HashTable, uint32_t Key); + +#endif /* _GIF_HASH_H_ */ + +/* end */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gif/gif_lib.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gif/gif_lib.h new file mode 100644 index 0000000000000000000000000000000000000000..ebdbd3cd390f35f19aade94cb20447b19dd59a14 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gif/gif_lib.h @@ -0,0 +1,303 @@ +/****************************************************************************** + +gif_lib.h - service library for decoding and encoding GIF images + +SPDX-License-Identifier: MIT + +*****************************************************************************/ + +#ifndef _GIF_LIB_H_ +#define _GIF_LIB_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GIFLIB_MAJOR 5 +#define GIFLIB_MINOR 2 +#define GIFLIB_RELEASE 1 + +#define GIF_ERROR 0 +#define GIF_OK 1 + +#include +#include + +#define GIF_STAMP "GIFVER" /* First chars in file - GIF stamp. */ +#define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1 +#define GIF_VERSION_POS 3 /* Version first character in stamp. */ +#define GIF87_STAMP "GIF87a" /* First chars in file - GIF stamp. */ +#define GIF89_STAMP "GIF89a" /* First chars in file - GIF stamp. */ + +typedef unsigned char GifPixelType; +typedef unsigned char *GifRowType; +typedef unsigned char GifByteType; +typedef unsigned int GifPrefixType; +typedef int GifWord; + +typedef struct GifColorType { + GifByteType Red, Green, Blue; +} GifColorType; + +typedef struct ColorMapObject { + int ColorCount; + int BitsPerPixel; + bool SortFlag; + GifColorType *Colors; /* on malloc(3) heap */ +} ColorMapObject; + +typedef struct GifImageDesc { + GifWord Left, Top, Width, Height; /* Current image dimensions. */ + bool Interlace; /* Sequential/Interlaced lines. */ + ColorMapObject *ColorMap; /* The local color map */ +} GifImageDesc; + +typedef struct ExtensionBlock { + int ByteCount; + GifByteType *Bytes; /* on malloc(3) heap */ + int Function; /* The block function code */ +#define CONTINUE_EXT_FUNC_CODE 0x00 /* continuation subblock */ +#define COMMENT_EXT_FUNC_CODE 0xfe /* comment */ +#define GRAPHICS_EXT_FUNC_CODE 0xf9 /* graphics control (GIF89) */ +#define PLAINTEXT_EXT_FUNC_CODE 0x01 /* plaintext */ +#define APPLICATION_EXT_FUNC_CODE 0xff /* application block (GIF89) */ +} ExtensionBlock; + +typedef struct SavedImage { + GifImageDesc ImageDesc; + GifByteType *RasterBits; /* on malloc(3) heap */ + int ExtensionBlockCount; /* Count of extensions before image */ + ExtensionBlock *ExtensionBlocks; /* Extensions before image */ +} SavedImage; + +typedef struct GifFileType { + GifWord SWidth, SHeight; /* Size of virtual canvas */ + GifWord SColorResolution; /* How many colors can we generate? */ + GifWord SBackGroundColor; /* Background color for virtual canvas */ + GifByteType AspectByte; /* Used to compute pixel aspect ratio */ + ColorMapObject *SColorMap; /* Global colormap, NULL if nonexistent. */ + int ImageCount; /* Number of current image (both APIs) */ + GifImageDesc Image; /* Current image (low-level API) */ + SavedImage *SavedImages; /* Image sequence (high-level API) */ + int ExtensionBlockCount; /* Count extensions past last image */ + ExtensionBlock *ExtensionBlocks; /* Extensions past last image */ + int Error; /* Last error condition reported */ + void *UserData; /* hook to attach user data (TVT) */ + void *Private; /* Don't mess with this! */ +} GifFileType; + +#define GIF_ASPECT_RATIO(n) ((n)+15.0/64.0) + +typedef enum { + UNDEFINED_RECORD_TYPE, + SCREEN_DESC_RECORD_TYPE, + IMAGE_DESC_RECORD_TYPE, /* Begin with ',' */ + EXTENSION_RECORD_TYPE, /* Begin with '!' */ + TERMINATE_RECORD_TYPE /* Begin with ';' */ +} GifRecordType; + +/* func type to read gif data from arbitrary sources (TVT) */ +typedef int (*InputFunc) (GifFileType *, GifByteType *, int); + +/* func type to write gif data to arbitrary targets. + * Returns count of bytes written. (MRB) + */ +typedef int (*OutputFunc) (GifFileType *, const GifByteType *, int); + +/****************************************************************************** + GIF89 structures +******************************************************************************/ + +typedef struct GraphicsControlBlock { + int DisposalMode; +#define DISPOSAL_UNSPECIFIED 0 /* No disposal specified. */ +#define DISPOSE_DO_NOT 1 /* Leave image in place */ +#define DISPOSE_BACKGROUND 2 /* Set area too background color */ +#define DISPOSE_PREVIOUS 3 /* Restore to previous content */ + bool UserInputFlag; /* User confirmation required before disposal */ + int DelayTime; /* pre-display delay in 0.01sec units */ + int TransparentColor; /* Palette index for transparency, -1 if none */ +#define NO_TRANSPARENT_COLOR -1 +} GraphicsControlBlock; + +/****************************************************************************** + GIF encoding routines +******************************************************************************/ + +/* Main entry points */ +GifFileType *EGifOpenFileName(const char *GifFileName, + const bool GifTestExistence, int *Error); +GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error); +GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error); +int EGifSpew(GifFileType * GifFile); +const char *EGifGetGifVersion(GifFileType *GifFile); /* new in 5.x */ +int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); + +#define E_GIF_SUCCEEDED 0 +#define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */ +#define E_GIF_ERR_WRITE_FAILED 2 +#define E_GIF_ERR_HAS_SCRN_DSCR 3 +#define E_GIF_ERR_HAS_IMAG_DSCR 4 +#define E_GIF_ERR_NO_COLOR_MAP 5 +#define E_GIF_ERR_DATA_TOO_BIG 6 +#define E_GIF_ERR_NOT_ENOUGH_MEM 7 +#define E_GIF_ERR_DISK_IS_FULL 8 +#define E_GIF_ERR_CLOSE_FAILED 9 +#define E_GIF_ERR_NOT_WRITEABLE 10 + +/* These are legacy. You probably do not want to call them directly */ +int EGifPutScreenDesc(GifFileType *GifFile, + const int GifWidth, const int GifHeight, + const int GifColorRes, + const int GifBackGround, + const ColorMapObject *GifColorMap); +int EGifPutImageDesc(GifFileType *GifFile, + const int GifLeft, const int GifTop, + const int GifWidth, const int GifHeight, + const bool GifInterlace, + const ColorMapObject *GifColorMap); +void EGifSetGifVersion(GifFileType *GifFile, const bool gif89); +int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, + int GifLineLen); +int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel); +int EGifPutComment(GifFileType *GifFile, const char *GifComment); +int EGifPutExtensionLeader(GifFileType *GifFile, const int GifExtCode); +int EGifPutExtensionBlock(GifFileType *GifFile, + const int GifExtLen, const void *GifExtension); +int EGifPutExtensionTrailer(GifFileType *GifFile); +int EGifPutExtension(GifFileType *GifFile, const int GifExtCode, + const int GifExtLen, + const void *GifExtension); +int EGifPutCode(GifFileType *GifFile, int GifCodeSize, + const GifByteType *GifCodeBlock); +int EGifPutCodeNext(GifFileType *GifFile, + const GifByteType *GifCodeBlock); + +/****************************************************************************** + GIF decoding routines +******************************************************************************/ + +/* Main entry points */ +GifFileType *DGifOpenFileName(const char *GifFileName, int *Error); +GifFileType *DGifOpenFileHandle(int GifFileHandle, int *Error); +int DGifSlurp(GifFileType * GifFile); +GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new one (TVT) */ + int DGifCloseFile(GifFileType * GifFile, int *ErrorCode); + +#define D_GIF_SUCCEEDED 0 +#define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */ +#define D_GIF_ERR_READ_FAILED 102 +#define D_GIF_ERR_NOT_GIF_FILE 103 +#define D_GIF_ERR_NO_SCRN_DSCR 104 +#define D_GIF_ERR_NO_IMAG_DSCR 105 +#define D_GIF_ERR_NO_COLOR_MAP 106 +#define D_GIF_ERR_WRONG_RECORD 107 +#define D_GIF_ERR_DATA_TOO_BIG 108 +#define D_GIF_ERR_NOT_ENOUGH_MEM 109 +#define D_GIF_ERR_CLOSE_FAILED 110 +#define D_GIF_ERR_NOT_READABLE 111 +#define D_GIF_ERR_IMAGE_DEFECT 112 +#define D_GIF_ERR_EOF_TOO_SOON 113 + +/* These are legacy. You probably do not want to call them directly */ +int DGifGetScreenDesc(GifFileType *GifFile); +int DGifGetRecordType(GifFileType *GifFile, GifRecordType *GifType); +int DGifGetImageHeader(GifFileType *GifFile); +int DGifGetImageDesc(GifFileType *GifFile); +int DGifGetLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); +int DGifGetPixel(GifFileType *GifFile, GifPixelType GifPixel); +int DGifGetExtension(GifFileType *GifFile, int *GifExtCode, + GifByteType **GifExtension); +int DGifGetExtensionNext(GifFileType *GifFile, GifByteType **GifExtension); +int DGifGetCode(GifFileType *GifFile, int *GifCodeSize, + GifByteType **GifCodeBlock); +int DGifGetCodeNext(GifFileType *GifFile, GifByteType **GifCodeBlock); +int DGifGetLZCodes(GifFileType *GifFile, int *GifCode); +const char *DGifGetGifVersion(GifFileType *GifFile); + + +/****************************************************************************** + Error handling and reporting. +******************************************************************************/ +extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ + +/***************************************************************************** + Everything below this point is new after version 1.2, supporting `slurp + mode' for doing I/O in two big belts with all the image-bashing in core. +******************************************************************************/ + +/****************************************************************************** + Color map handling from gif_alloc.c +******************************************************************************/ + +extern ColorMapObject *GifMakeMapObject(int ColorCount, + const GifColorType *ColorMap); +extern void GifFreeMapObject(ColorMapObject *Object); +extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, + const ColorMapObject *ColorIn2, + GifPixelType ColorTransIn2[]); +extern int GifBitSize(int n); + +/****************************************************************************** + Support for the in-core structures allocation (slurp mode). +******************************************************************************/ + +extern void GifApplyTranslation(SavedImage *Image, GifPixelType Translation[]); +extern int GifAddExtensionBlock(int *ExtensionBlock_Count, + ExtensionBlock **ExtensionBlocks, + int Function, + unsigned int Len, unsigned char ExtData[]); +extern void GifFreeExtensions(int *ExtensionBlock_Count, + ExtensionBlock **ExtensionBlocks); +extern SavedImage *GifMakeSavedImage(GifFileType *GifFile, + const SavedImage *CopyFrom); +extern void GifFreeSavedImages(GifFileType *GifFile); + +/****************************************************************************** + 5.x functions for GIF89 graphics control blocks +******************************************************************************/ + +int DGifExtensionToGCB(const size_t GifExtensionLength, + const GifByteType *GifExtension, + GraphicsControlBlock *GCB); +size_t EGifGCBToExtension(const GraphicsControlBlock *GCB, + GifByteType *GifExtension); + +int DGifSavedExtensionToGCB(GifFileType *GifFile, + int ImageIndex, + GraphicsControlBlock *GCB); +int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, + GifFileType *GifFile, + int ImageIndex); + +/****************************************************************************** + The library's internal utility font +******************************************************************************/ + +#define GIF_FONT_WIDTH 8 +#define GIF_FONT_HEIGHT 8 +extern const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH]; + +extern void GifDrawText8x8(SavedImage *Image, + const int x, const int y, + const char *legend, const int color); + +extern void GifDrawBox(SavedImage *Image, + const int x, const int y, + const int w, const int d, const int color); + +extern void GifDrawRectangle(SavedImage *Image, + const int x, const int y, + const int w, const int d, const int color); + +extern void GifDrawBoxedText8x8(SavedImage *Image, + const int x, const int y, + const char *legend, + const int border, const int bg, const int fg); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* _GIF_LIB_H */ + +/* end */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gif/gif_lib_private.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gif/gif_lib_private.h new file mode 100644 index 0000000000000000000000000000000000000000..14e5e30dc3e66cdab8fb0c0adbef4ac3b87a68b8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/gif/gif_lib_private.h @@ -0,0 +1,70 @@ +/**************************************************************************** + +gif_lib_private.h - internal giflib routines and structures + +SPDX-License-Identifier: MIT + +****************************************************************************/ + +#ifndef _GIF_LIB_PRIVATE_H +#define _GIF_LIB_PRIVATE_H + +#include "gif_lib.h" +#include "gif_hash.h" + +#ifndef SIZE_MAX + #define SIZE_MAX UINTPTR_MAX +#endif + +#define EXTENSION_INTRODUCER 0x21 +#define DESCRIPTOR_INTRODUCER 0x2c +#define TERMINATOR_INTRODUCER 0x3b + +#define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ +#define LZ_BITS 12 + +#define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */ +#define FIRST_CODE 4097 /* Impossible code, to signal first. */ +#define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */ + +#define FILE_STATE_WRITE 0x01 +#define FILE_STATE_SCREEN 0x02 +#define FILE_STATE_IMAGE 0x04 +#define FILE_STATE_READ 0x08 + +#define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ) +#define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE) + +typedef struct GifFilePrivateType { + GifWord FileState, FileHandle, /* Where all this data goes to! */ + BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */ + ClearCode, /* The CLEAR LZ code. */ + EOFCode, /* The EOF LZ code. */ + RunningCode, /* The next code algorithm can generate. */ + RunningBits, /* The number of bits required to represent RunningCode. */ + MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ + LastCode, /* The code before the current code. */ + CrntCode, /* Current algorithm code. */ + StackPtr, /* For character stack (see below). */ + CrntShiftState; /* Number of bits in CrntShiftDWord. */ + unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */ + unsigned long PixelCount; /* Number of pixels in image. */ + FILE *File; /* File as stream. */ + InputFunc Read; /* function to read gif input (TVT) */ + OutputFunc Write; /* function to write gif output (MRB) */ + GifByteType Buf[256]; /* Compressed input is buffered here. */ + GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */ + GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */ + GifPrefixType Prefix[LZ_MAX_CODE + 1]; + GifHashTableType *HashTable; + bool gif89; +} GifFilePrivateType; + +#ifndef HAVE_REALLOCARRAY +extern void *openbsd_reallocarray(void *optr, size_t nmemb, size_t size); +#define reallocarray openbsd_reallocarray +#endif + +#endif /* _GIF_LIB_PRIVATE_H */ + +/* end */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/arch_specific.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/arch_specific.h new file mode 100644 index 0000000000000000000000000000000000000000..0b8c38417384d38cdd6c20c6d0f9d4880ef80116 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/arch_specific.h @@ -0,0 +1,179 @@ +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef HIGHWAYHASH_ARCH_SPECIFIC_H_ +#define HIGHWAYHASH_ARCH_SPECIFIC_H_ + +// WARNING: this is a "restricted" header because it is included from +// translation units compiled with different flags. This header and its +// dependencies must not define any function unless it is static inline and/or +// within namespace HH_TARGET_NAME. +// +// Background: older GCC/Clang require flags such as -mavx2 before AVX2 SIMD +// intrinsics can be used. These intrinsics are only used within blocks that +// first verify CPU capabilities. However, the flag also allows the compiler to +// generate AVX2 code in other places. This can violate the One Definition Rule, +// which requires multiple instances of a function with external linkage +// (e.g. extern inline in a header) to be "equivalent". To prevent the resulting +// crashes on non-AVX2 CPUs, any header (transitively) included from a +// translation unit compiled with different flags is "restricted". This means +// all function definitions must have internal linkage (e.g. static inline), or +// reside in namespace HH_TARGET_NAME, which expands to a name unique to the +// current compiler flags. +// +// Most C system headers are safe to include, but C++ headers should generally +// be avoided because they often do not specify static linkage and cannot +// reliably be wrapped in a namespace. + +#include "highwayhash/compiler_specific.h" + +#include + +#if HH_MSC_VERSION +#include // _byteswap_* +#endif + +namespace highwayhash { + +#if defined(__x86_64__) || defined(_M_X64) +#define HH_ARCH_X64 1 +#else +#define HH_ARCH_X64 0 +#endif + +#if defined(__aarch64__) || defined(__arm64__) +#define HH_ARCH_AARCH64 1 +#else +#define HH_ARCH_AARCH64 0 +#endif + +#ifdef __arm__ +#define HH_ARCH_ARM 1 +#else +#define HH_ARCH_ARM 0 +#endif + +#if defined(__ARM_NEON__) || defined(__ARM_NEON) +#define HH_ARCH_NEON 1 +#else +#define HH_ARCH_NEON 0 +#endif + +#if defined(__powerpc64__) || defined(_M_PPC) +#define HH_ARCH_PPC 1 +#else +#define HH_ARCH_PPC 0 +#endif + +// Target := instruction set extension(s) such as SSE41. A translation unit can +// only provide a single target-specific implementation because they require +// different compiler flags. + +// Either the build system specifies the target by defining HH_TARGET_NAME +// (which is necessary for Portable on X64, and SSE41 on MSVC), or we'll choose +// the most efficient one that can be compiled given the current flags: +#ifndef HH_TARGET_NAME + +// To avoid excessive code size and dispatch overhead, we only support a few +// groups of extensions, e.g. FMA+BMI2+AVX+AVX2 =: "AVX2". These names must +// match the HH_TARGET_* suffixes below. +#ifdef __AVX2__ +#define HH_TARGET_NAME AVX2 +// MSVC does not set SSE4_1, but it does set AVX; checking for the latter means +// we at least get SSE4 on machines supporting AVX but not AVX2. +// https://stackoverflow.com/questions/18563978/detect-the-availability-of-sse-sse2-instruction-set-in-visual-studio +#elif defined(__SSE4_1__) || (HH_MSC_VERSION != 0 && defined(__AVX__)) +#define HH_TARGET_NAME SSE41 +#elif defined(__VSX__) +#define HH_TARGET_NAME VSX +#elif HH_ARCH_NEON +#define HH_TARGET_NAME NEON +#else +#define HH_TARGET_NAME Portable +#endif + +#endif // HH_TARGET_NAME + +#define HH_CONCAT(first, second) first##second +// Required due to macro expansion rules. +#define HH_EXPAND_CONCAT(first, second) HH_CONCAT(first, second) +// Appends HH_TARGET_NAME to "identifier_prefix". +#define HH_ADD_TARGET_SUFFIX(identifier_prefix) \ + HH_EXPAND_CONCAT(identifier_prefix, HH_TARGET_NAME) + +// HH_TARGET expands to an integer constant. Typical usage: HHStateT. +// This ensures your code will work correctly when compiler flags are changed, +// and benefit from subsequently added targets/specializations. +#define HH_TARGET HH_ADD_TARGET_SUFFIX(HH_TARGET_) + +// Deprecated former name of HH_TARGET; please use HH_TARGET instead. +#define HH_TARGET_PREFERRED HH_TARGET + +// Associate targets with integer literals so the preprocessor can compare them +// with HH_TARGET. Do not instantiate templates with these values - use +// HH_TARGET instead. Must be unique powers of two, see TargetBits. Always +// defined even if unavailable on this HH_ARCH to allow calling TargetName. +// The suffixes must match the HH_TARGET_NAME identifiers. +#define HH_TARGET_Portable 1 +#define HH_TARGET_SSE41 2 +#define HH_TARGET_AVX2 4 +#define HH_TARGET_VSX 8 +#define HH_TARGET_NEON 16 + +// Bit array for one or more HH_TARGET_*. Used to indicate which target(s) are +// supported or were called by InstructionSets::RunAll. +using TargetBits = unsigned; + +namespace HH_TARGET_NAME { + +// Calls func(bit_value) for every nonzero bit in "bits". +template +void ForeachTarget(TargetBits bits, const Func& func) { + while (bits != 0) { + const TargetBits lowest = bits & (~bits + 1); + func(lowest); + bits &= ~lowest; + } +} + +} // namespace HH_TARGET_NAME + +// Returns a brief human-readable string literal identifying one of the above +// bits, or nullptr if zero, multiple, or unknown bits are set. +const char* TargetName(const TargetBits target_bit); + +// Returns the nominal (without Turbo Boost) CPU clock rate [Hertz]. Useful for +// (roughly) characterizing the CPU speed. +double NominalClockRate(); + +// Returns tsc_timer frequency, useful for converting ticks to seconds. This is +// unaffected by CPU throttling ("invariant"). Thread-safe. Returns timebase +// frequency on PPC and NominalClockRate on all other platforms. +double InvariantTicksPerSecond(); + +#if HH_ARCH_X64 + +// Calls CPUID instruction with eax=level and ecx=count and returns the result +// in abcd array where abcd = {eax, ebx, ecx, edx} (hence the name abcd). +void Cpuid(const uint32_t level, const uint32_t count, + uint32_t* HH_RESTRICT abcd); + +// Returns the APIC ID of the CPU on which we're currently running. +uint32_t ApicId(); + +#endif // HH_ARCH_X64 + +} // namespace highwayhash + +#endif // HIGHWAYHASH_ARCH_SPECIFIC_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/compiler_specific.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/compiler_specific.h new file mode 100644 index 0000000000000000000000000000000000000000..4789f9a6104feb8223b444f191cb803edd0722a5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/compiler_specific.h @@ -0,0 +1,90 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef HIGHWAYHASH_COMPILER_SPECIFIC_H_ +#define HIGHWAYHASH_COMPILER_SPECIFIC_H_ + +// WARNING: this is a "restricted" header because it is included from +// translation units compiled with different flags. This header and its +// dependencies must not define any function unless it is static inline and/or +// within namespace HH_TARGET_NAME. See arch_specific.h for details. + +// Compiler + +// #if is shorter and safer than #ifdef. *_VERSION are zero if not detected, +// otherwise 100 * major + minor version. Note that other packages check for +// #ifdef COMPILER_MSVC, so we cannot use that same name. + +#ifdef _MSC_VER +#define HH_MSC_VERSION _MSC_VER +#else +#define HH_MSC_VERSION 0 +#endif + +#ifdef __GNUC__ +#define HH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) +#else +#define HH_GCC_VERSION 0 +#endif + +#ifdef __clang__ +#define HH_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) +#else +#define HH_CLANG_VERSION 0 +#endif + +//----------------------------------------------------------------------------- + +#if HH_GCC_VERSION && HH_GCC_VERSION < 408 +#define HH_ALIGNAS(multiple) __attribute__((aligned(multiple))) +#else +#define HH_ALIGNAS(multiple) alignas(multiple) // C++11 +#endif + +#if HH_MSC_VERSION +#define HH_RESTRICT __restrict +#elif HH_GCC_VERSION +#define HH_RESTRICT __restrict__ +#else +#define HH_RESTRICT +#endif + +#if HH_MSC_VERSION +#define HH_INLINE __forceinline +#define HH_NOINLINE __declspec(noinline) +#else +#define HH_INLINE inline +#define HH_NOINLINE __attribute__((noinline)) +#endif + +#if HH_MSC_VERSION +// Unsupported, __assume is not the same. +#define HH_LIKELY(expr) expr +#define HH_UNLIKELY(expr) expr +#else +#define HH_LIKELY(expr) __builtin_expect(!!(expr), 1) +#define HH_UNLIKELY(expr) __builtin_expect(!!(expr), 0) +#endif + +#if HH_MSC_VERSION +#include +#pragma intrinsic(_ReadWriteBarrier) +#define HH_COMPILER_FENCE _ReadWriteBarrier() +#elif HH_GCC_VERSION +#define HH_COMPILER_FENCE asm volatile("" : : : "memory") +#else +#define HH_COMPILER_FENCE +#endif + +#endif // HIGHWAYHASH_COMPILER_SPECIFIC_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/endianess.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/endianess.h new file mode 100644 index 0000000000000000000000000000000000000000..776a02fa218b309c5407c26d03a2e4e695acdc15 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/endianess.h @@ -0,0 +1,108 @@ +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef HIGHWAYHASH_ENDIANESS_H_ +#define HIGHWAYHASH_ENDIANESS_H_ + +// WARNING: this is a "restricted" header because it is included from +// translation units compiled with different flags. This header and its +// dependencies must not define any function unless it is static inline and/or +// within namespace HH_TARGET_NAME. See arch_specific.h for details. + +#include + +#if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) + + /* Someone has already included or equivalent. */ + +#elif defined(__LITTLE_ENDIAN__) + +# define HH_IS_LITTLE_ENDIAN 1 +# define HH_IS_BIG_ENDIAN 0 +# ifdef __BIG_ENDIAN__ +# error "Platform is both little and big endian?" +# endif + +#elif defined(__BIG_ENDIAN__) + +# define HH_IS_LITTLE_ENDIAN 0 +# define HH_IS_BIG_ENDIAN 1 + +#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \ + defined(__ORDER_LITTLE_ENDIAN__) + +# define HH_IS_LITTLE_ENDIAN (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +# define HH_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + +#elif defined(__linux__) || defined(__CYGWIN__) || defined( __GNUC__ ) || \ + defined( __GNU_LIBRARY__ ) + +# include + +#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || \ + defined(__DragonFly__) + +# include + +#elif defined(_WIN32) + +#define HH_IS_LITTLE_ENDIAN 1 +#define HH_IS_BIG_ENDIAN 0 + +#else + +# error "Unsupported platform. Cannot determine byte order." + +#endif + + +#ifndef HH_IS_LITTLE_ENDIAN +# define HH_IS_LITTLE_ENDIAN (BYTE_ORDER == LITTLE_ENDIAN) +# define HH_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) +#endif + + +namespace highwayhash { + +#if HH_IS_LITTLE_ENDIAN + +static inline uint32_t le32_from_host(uint32_t x) { return x; } +static inline uint32_t host_from_le32(uint32_t x) { return x; } +static inline uint64_t le64_from_host(uint64_t x) { return x; } +static inline uint64_t host_from_le64(uint64_t x) { return x; } + +#elif !HH_IS_BIG_ENDIAN + +# error "Unsupported byte order." + +#elif defined(_WIN16) || defined(_WIN32) || defined(_WIN64) + +#include +static inline uint32_t host_from_le32(uint32_t x) { return _byteswap_ulong(x); } +static inline uint32_t le32_from_host(uint32_t x) { return _byteswap_ulong(x); } +static inline uint64_t host_from_le64(uint64_t x) { return _byteswap_uint64(x);} +static inline uint64_t le64_from_host(uint64_t x) { return _byteswap_uint64(x);} + +#else + +static inline uint32_t host_from_le32(uint32_t x) {return __builtin_bswap32(x);} +static inline uint32_t le32_from_host(uint32_t x) {return __builtin_bswap32(x);} +static inline uint64_t host_from_le64(uint64_t x) {return __builtin_bswap64(x);} +static inline uint64_t le64_from_host(uint64_t x) {return __builtin_bswap64(x);} + +#endif + +} // namespace highwayhash + +#endif // HIGHWAYHASH_ENDIANESS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/sip_hash.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/sip_hash.h new file mode 100644 index 0000000000000000000000000000000000000000..eebe3dc9447d7558d0dba5f7baa6f64b5ab68621 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/sip_hash.h @@ -0,0 +1,171 @@ +// Copyright 2016 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef HIGHWAYHASH_SIP_HASH_H_ +#define HIGHWAYHASH_SIP_HASH_H_ + +// Portable but fast SipHash implementation. + +#include +#include // memcpy + +#include "highwayhash/arch_specific.h" +#include "highwayhash/compiler_specific.h" +#include "highwayhash/endianess.h" +#include "highwayhash/state_helpers.h" + +namespace highwayhash { + +// Paper: https://www.131002.net/siphash/siphash.pdf +template +class SipHashStateT { + public: + using Key = HH_U64[2]; + static const size_t kPacketSize = sizeof(HH_U64); + + explicit HH_INLINE SipHashStateT(const Key& key) { + v0 = 0x736f6d6570736575ull ^ key[0]; + v1 = 0x646f72616e646f6dull ^ key[1]; + v2 = 0x6c7967656e657261ull ^ key[0]; + v3 = 0x7465646279746573ull ^ key[1]; + } + + HH_INLINE void Update(const char* bytes) { + HH_U64 packet; + memcpy(&packet, bytes, sizeof(packet)); + packet = host_from_le64(packet); + + v3 ^= packet; + + Compress(); + + v0 ^= packet; + } + + HH_INLINE HH_U64 Finalize() { + // Mix in bits to avoid leaking the key if all packets were zero. + v2 ^= 0xFF; + + Compress(); + + return (v0 ^ v1) ^ (v2 ^ v3); + } + private: + // Rotate a 64-bit value "v" left by N bits. + template + static HH_INLINE HH_U64 RotateLeft(const HH_U64 v) { + const HH_U64 left = v << bits; + const HH_U64 right = v >> (64 - bits); + return left | right; + } + + template + HH_INLINE void Compress() { + for (size_t i = 0; i < rounds; ++i) { + // ARX network: add, rotate, exclusive-or. + v0 += v1; + v2 += v3; + v1 = RotateLeft<13>(v1); + v3 = RotateLeft<16>(v3); + v1 ^= v0; + v3 ^= v2; + + v0 = RotateLeft<32>(v0); + + v2 += v1; + v0 += v3; + v1 = RotateLeft<17>(v1); + v3 = RotateLeft<21>(v3); + v1 ^= v2; + v3 ^= v0; + + v2 = RotateLeft<32>(v2); + } + } + + HH_U64 v0; + HH_U64 v1; + HH_U64 v2; + HH_U64 v3; +}; + +using SipHashState = SipHashStateT<2, 4>; +using SipHash13State = SipHashStateT<1, 3>; + +// Override the HighwayTreeHash padding scheme with that of SipHash so that +// the hash output matches the known-good values in sip_hash_test. +template <> +HH_INLINE void PaddedUpdate(const HH_U64 size, + const char* remaining_bytes, + const HH_U64 remaining_size, + SipHashState* state) { + // Copy to avoid overrunning the input buffer. + char final_packet[SipHashState::kPacketSize] = {0}; + memcpy(final_packet, remaining_bytes, remaining_size); + final_packet[SipHashState::kPacketSize - 1] = static_cast(size & 0xFF); + state->Update(final_packet); +} + +template <> +HH_INLINE void PaddedUpdate(const HH_U64 size, + const char* remaining_bytes, + const HH_U64 remaining_size, + SipHash13State* state) { + // Copy to avoid overrunning the input buffer. + char final_packet[SipHash13State::kPacketSize] = {0}; + memcpy(final_packet, remaining_bytes, remaining_size); + final_packet[SipHash13State::kPacketSize - 1] = + static_cast(size & 0xFF); + state->Update(final_packet); +} + +// Fast, cryptographically strong pseudo-random function, e.g. for +// deterministic/idempotent 'random' number generation. See also +// README.md for information on resisting hash flooding attacks. +// +// Robust versus timing attacks because memory accesses are sequential +// and the algorithm is branch-free. Compute time is proportional to the +// number of 8-byte packets and about twice as fast as an sse41 implementation. +// +// "key" is a secret 128-bit key unknown to attackers. +// "bytes" is the data to hash; ceil(size / 8) * 8 bytes are read. +// Returns a 64-bit hash of the given data bytes, which are swapped on +// big-endian CPUs so the return value is the same as on little-endian CPUs. +static HH_INLINE HH_U64 SipHash(const SipHashState::Key& key, const char* bytes, + const HH_U64 size) { + return ComputeHash(key, bytes, size); +} + +// Round-reduced SipHash version (1 update and 3 finalization rounds). +static HH_INLINE HH_U64 SipHash13(const SipHash13State::Key& key, + const char* bytes, const HH_U64 size) { + return ComputeHash(key, bytes, size); +} + +template +static HH_INLINE HH_U64 ReduceSipTreeHash( + const typename SipHashStateT::Key& key, + const uint64_t (&hashes)[kNumLanes]) { + SipHashStateT state(key); + + for (int i = 0; i < kNumLanes; ++i) { + state.Update(reinterpret_cast(&hashes[i])); + } + + return state.Finalize(); +} + +} // namespace highwayhash + +#endif // HIGHWAYHASH_SIP_HASH_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/state_helpers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/state_helpers.h new file mode 100644 index 0000000000000000000000000000000000000000..83d63c19e436dd880dd3fac1e2af24d265885b96 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/highwayhash/highwayhash/state_helpers.h @@ -0,0 +1,128 @@ +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef HIGHWAYHASH_STATE_H_ +#define HIGHWAYHASH_STATE_H_ + +// Helper functions to split inputs into packets and call State::Update on each. + +#include +#include +#include +#include + +#include "highwayhash/compiler_specific.h" + +namespace highwayhash { + +// uint64_t is unsigned long on Linux; we need 'unsigned long long' +// for interoperability with TensorFlow. +typedef unsigned long long HH_U64; // NOLINT + +// Copies the remaining bytes to a zero-padded buffer, sets the upper byte to +// size % 256 (always possible because this should only be called if the +// total size is not a multiple of the packet size) and updates hash state. +// +// The padding scheme is essentially from SipHash, but permuted for the +// convenience of AVX-2 masked loads. This function must use the same layout so +// that the vector and scalar HighwayTreeHash have the same result. +// +// "remaining_size" is the number of accessible/remaining bytes +// (size % kPacketSize). +// +// Primary template; the specialization for AVX-2 is faster. Intended as an +// implementation detail, do not call directly. +template +HH_INLINE void PaddedUpdate(const HH_U64 size, const char* remaining_bytes, + const HH_U64 remaining_size, State* state) { + char final_packet[State::kPacketSize] HH_ALIGNAS(32) = {0}; + + // This layout matches the AVX-2 specialization in highway_tree_hash.h. + uint32_t packet4 = static_cast(size) << 24; + + const size_t remainder_mod4 = remaining_size & 3; + if (remainder_mod4 != 0) { + const char* final_bytes = remaining_bytes + remaining_size - remainder_mod4; + packet4 += static_cast(final_bytes[0]); + const int idx1 = remainder_mod4 >> 1; + const int idx2 = remainder_mod4 - 1; + packet4 += static_cast(final_bytes[idx1]) << 8; + packet4 += static_cast(final_bytes[idx2]) << 16; + } + + memcpy(final_packet, remaining_bytes, remaining_size - remainder_mod4); + memcpy(final_packet + State::kPacketSize - 4, &packet4, sizeof(packet4)); + + state->Update(final_packet); +} + +// Updates hash state for every whole packet, and once more for the final +// padded packet. +template +HH_INLINE void UpdateState(const char* bytes, const HH_U64 size, State* state) { + // Feed entire packets. + const int kPacketSize = State::kPacketSize; + static_assert((kPacketSize & (kPacketSize - 1)) == 0, "Size must be 2^i."); + const size_t remainder = size & (kPacketSize - 1); + const size_t truncated_size = size - remainder; + for (size_t i = 0; i < truncated_size; i += kPacketSize) { + state->Update(bytes + i); + } + + PaddedUpdate(size, bytes + truncated_size, remainder, state); +} + +// Convenience function for updating with the bytes of a string. +template +HH_INLINE void UpdateState(const String& s, State* state) { + const char* bytes = reinterpret_cast(s.data()); + const size_t size = s.length() * sizeof(typename String::value_type); + UpdateState(bytes, size, state); +} + +// Computes a hash of a byte array using the given hash State class. +// +// Example: const SipHashState::Key key = { 1, 2 }; char data[4]; +// ComputeHash(key, data, sizeof(data)); +// +// This function avoids duplicating Update/Finalize in every call site. +// Callers wanting to combine multiple hashes should repeatedly UpdateState() +// and only call State::Finalize once. +template +HH_U64 ComputeHash(const typename State::Key& key, const char* bytes, + const HH_U64 size) { + State state(key); + UpdateState(bytes, size, &state); + return state.Finalize(); +} + +// Computes a hash of a string's bytes using the given hash State class. +// +// Example: const SipHashState::Key key = { 1, 2 }; +// StringHasher()(key, std::u16string(u"abc")); +// +// A struct with nested function template enables deduction of the String type. +template +struct StringHasher { + template + HH_U64 operator()(const typename State::Key& key, const String& s) { + State state(key); + UpdateState(s, &state); + return state.Finalize(); + } +}; + +} // namespace highwayhash + +#endif // HIGHWAYHASH_STATE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/bmpset.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/bmpset.h new file mode 100644 index 0000000000000000000000000000000000000000..e1982ac669db859b4ec5dc90aa9659b49395be21 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/bmpset.h @@ -0,0 +1,164 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2007, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: bmpset.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2007jan29 +* created by: Markus W. Scherer +*/ + +#ifndef __BMPSET_H__ +#define __BMPSET_H__ + +#include "unicode/utypes.h" +#include "unicode/uniset.h" + +U_NAMESPACE_BEGIN + +/* + * Helper class for frozen UnicodeSets, implements contains() and span() + * optimized for BMP code points. Structured to be UTF-8-friendly. + * + * Latin-1: Look up bytes. + * 2-byte characters: Bits organized vertically. + * 3-byte characters: Use zero/one/mixed data per 64-block in U+0000..U+FFFF, + * with mixed for illegal ranges. + * Supplementary characters: Binary search over + * the supplementary part of the parent set's inversion list. + */ +class BMPSet : public UMemory { +public: + BMPSet(const int32_t *parentList, int32_t parentListLength); + BMPSet(const BMPSet &otherBMPSet, const int32_t *newParentList, int32_t newParentListLength); + virtual ~BMPSet(); + + virtual UBool contains(UChar32 c) const; + + /* + * Span the initial substring for which each character c has spanCondition==contains(c). + * It must be s0 and spanCondition==0 or 1. + * @return The string pointer which limits the span. + */ + const uint8_t *spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCondition) const; + + /* + * Span the trailing substring for which each character c has spanCondition==contains(c). + * It must be length>0 and spanCondition==0 or 1. + * @return The start of the span. + */ + int32_t spanBackUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCondition) const; + +private: + void initBits(); + void overrideIllegal(); + + /** + * Same as UnicodeSet::findCodePoint(UChar32 c) const except that the + * binary search is restricted for finding code points in a certain range. + * + * For restricting the search for finding in the range start..end, + * pass in + * lo=findCodePoint(start) and + * hi=findCodePoint(end) + * with 0<=lo<=hiLanguageBreakEngines implement language-specific knowledge for + * finding text boundaries within a run of characters belonging to a + * specific set. The boundaries will be of a specific kind, e.g. word, + * line, etc.

+ * + *

LanguageBreakEngines should normally be implemented so as to + * be shared between threads without locking.

+ */ +class LanguageBreakEngine : public UMemory { + public: + + /** + *

Default constructor.

+ * + */ + LanguageBreakEngine(); + + /** + *

Virtual destructor.

+ */ + virtual ~LanguageBreakEngine(); + + /** + *

Indicate whether this engine handles a particular character for + * a particular kind of break.

+ * + * @param c A character which begins a run that the engine might handle + * @return true if this engine handles the particular character and break + * type. + */ + virtual UBool handles(UChar32 c) const = 0; + + /** + *

Find any breaks within a run in the supplied text.

+ * + * @param text A UText representing the text. The + * iterator is left at the end of the run of characters which the engine + * is capable of handling. + * @param startPos The start of the run within the supplied text. + * @param endPos The end of the run within the supplied text. + * @param foundBreaks A Vector of int32_t to receive the breaks. + * @return The number of breaks found. + */ + virtual int32_t findBreaks( UText *text, + int32_t startPos, + int32_t endPos, + UVector32 &foundBreaks ) const = 0; + +}; + +/******************************************************************* + * LanguageBreakFactory + */ + +/** + *

LanguageBreakFactorys find and return a LanguageBreakEngine + * that can determine breaks for characters in a specific set, if + * such an object can be found.

+ * + *

If a LanguageBreakFactory is to be shared between threads, + * appropriate synchronization must be used; there is none internal + * to the factory.

+ * + *

A LanguageBreakEngine returned by a LanguageBreakFactory can + * normally be shared between threads without synchronization, unless + * the specific subclass of LanguageBreakFactory indicates otherwise.

+ * + *

A LanguageBreakFactory is responsible for deleting any LanguageBreakEngine + * it returns when it itself is deleted, unless the specific subclass of + * LanguageBreakFactory indicates otherwise. Naturally, the factory should + * not be deleted until the LanguageBreakEngines it has returned are no + * longer needed.

+ */ +class LanguageBreakFactory : public UMemory { + public: + + /** + *

Default constructor.

+ * + */ + LanguageBreakFactory(); + + /** + *

Virtual destructor.

+ */ + virtual ~LanguageBreakFactory(); + + /** + *

Find and return a LanguageBreakEngine that can find the desired + * kind of break for the set of characters to which the supplied + * character belongs. It is up to the set of available engines to + * determine what the sets of characters are.

+ * + * @param c A character that begins a run for which a LanguageBreakEngine is + * sought. + * @return A LanguageBreakEngine with the desired characteristics, or 0. + */ + virtual const LanguageBreakEngine *getEngineFor(UChar32 c) = 0; + +}; + +/******************************************************************* + * UnhandledEngine + */ + +/** + *

UnhandledEngine is a special subclass of LanguageBreakEngine that + * handles characters that no other LanguageBreakEngine is available to + * handle. It is told the character and the type of break; at its + * discretion it may handle more than the specified character (e.g., + * the entire script to which that character belongs.

+ * + *

UnhandledEngines may not be shared between threads without + * external synchronization.

+ */ + +class UnhandledEngine : public LanguageBreakEngine { + private: + + /** + * The sets of characters handled. + * @internal + */ + + UnicodeSet *fHandled; + + public: + + /** + *

Default constructor.

+ * + */ + UnhandledEngine(UErrorCode &status); + + /** + *

Virtual destructor.

+ */ + virtual ~UnhandledEngine(); + + /** + *

Indicate whether this engine handles a particular character for + * a particular kind of break.

+ * + * @param c A character which begins a run that the engine might handle + * @return true if this engine handles the particular character and break + * type. + */ + virtual UBool handles(UChar32 c) const; + + /** + *

Find any breaks within a run in the supplied text.

+ * + * @param text A UText representing the text (TODO: UText). The + * iterator is left at the end of the run of characters which the engine + * is capable of handling. + * @param startPos The start of the run within the supplied text. + * @param endPos The end of the run within the supplied text. + * @param foundBreaks An allocated C array of the breaks found, if any + * @return The number of breaks found. + */ + virtual int32_t findBreaks( UText *text, + int32_t startPos, + int32_t endPos, + UVector32 &foundBreaks ) const; + + /** + *

Tell the engine to handle a particular character and break type.

+ * + * @param c A character which the engine should handle + */ + virtual void handleCharacter(UChar32 c); + +}; + +/******************************************************************* + * ICULanguageBreakFactory + */ + +/** + *

ICULanguageBreakFactory is the default LanguageBreakFactory for + * ICU. It creates dictionary-based LanguageBreakEngines from dictionary + * data in the ICU data file.

+ */ +class ICULanguageBreakFactory : public LanguageBreakFactory { + private: + + /** + * The stack of break engines created by this factory + * @internal + */ + + UStack *fEngines; + + public: + + /** + *

Standard constructor.

+ * + */ + ICULanguageBreakFactory(UErrorCode &status); + + /** + *

Virtual destructor.

+ */ + virtual ~ICULanguageBreakFactory(); + + /** + *

Find and return a LanguageBreakEngine that can find the desired + * kind of break for the set of characters to which the supplied + * character belongs. It is up to the set of available engines to + * determine what the sets of characters are.

+ * + * @param c A character that begins a run for which a LanguageBreakEngine is + * sought. + * @return A LanguageBreakEngine with the desired characteristics, or 0. + */ + virtual const LanguageBreakEngine *getEngineFor(UChar32 c); + +protected: + /** + *

Create a LanguageBreakEngine for the set of characters to which + * the supplied character belongs, for the specified break type.

+ * + * @param c A character that begins a run for which a LanguageBreakEngine is + * sought. + * @return A LanguageBreakEngine with the desired characteristics, or 0. + */ + virtual const LanguageBreakEngine *loadEngineFor(UChar32 c); + + /** + *

Create a DictionaryMatcher for the specified script and break type.

+ * @param script An ISO 15924 script code that identifies the dictionary to be + * created. + * @return A DictionaryMatcher with the desired characteristics, or NULL. + */ + virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script); +}; + +U_NAMESPACE_END + + /* BRKENG_H */ +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/bytesinkutil.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/bytesinkutil.h new file mode 100644 index 0000000000000000000000000000000000000000..ab2516432d31118358159b92ae14c6ce9e5b6b40 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/bytesinkutil.h @@ -0,0 +1,83 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// bytesinkutil.h +// created: 2017sep14 Markus W. Scherer + +#include "unicode/utypes.h" +#include "unicode/bytestream.h" +#include "unicode/edits.h" +#include "cmemory.h" +#include "uassert.h" + +U_NAMESPACE_BEGIN + +class ByteSink; +class CharString; +class Edits; + +class U_COMMON_API ByteSinkUtil { +public: + ByteSinkUtil() = delete; // all static + + /** (length) bytes were mapped to valid (s16, s16Length). */ + static UBool appendChange(int32_t length, + const char16_t *s16, int32_t s16Length, + ByteSink &sink, Edits *edits, UErrorCode &errorCode); + + /** The bytes at [s, limit[ were mapped to valid (s16, s16Length). */ + static UBool appendChange(const uint8_t *s, const uint8_t *limit, + const char16_t *s16, int32_t s16Length, + ByteSink &sink, Edits *edits, UErrorCode &errorCode); + + /** (length) bytes were mapped/changed to valid code point c. */ + static void appendCodePoint(int32_t length, UChar32 c, ByteSink &sink, Edits *edits = nullptr); + + /** The few bytes at [src, nextSrc[ were mapped/changed to valid code point c. */ + static inline void appendCodePoint(const uint8_t *src, const uint8_t *nextSrc, UChar32 c, + ByteSink &sink, Edits *edits = nullptr) { + appendCodePoint((int32_t)(nextSrc - src), c, sink, edits); + } + + /** Append the two-byte character (U+0080..U+07FF). */ + static void appendTwoBytes(UChar32 c, ByteSink &sink); + + static UBool appendUnchanged(const uint8_t *s, int32_t length, + ByteSink &sink, uint32_t options, Edits *edits, + UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return false; } + if (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); } + return true; + } + + static UBool appendUnchanged(const uint8_t *s, const uint8_t *limit, + ByteSink &sink, uint32_t options, Edits *edits, + UErrorCode &errorCode); + +private: + static void appendNonEmptyUnchanged(const uint8_t *s, int32_t length, + ByteSink &sink, uint32_t options, Edits *edits); +}; + +class U_COMMON_API CharStringByteSink : public ByteSink { +public: + CharStringByteSink(CharString* dest); + ~CharStringByteSink() override; + + CharStringByteSink() = delete; + CharStringByteSink(const CharStringByteSink&) = delete; + CharStringByteSink& operator=(const CharStringByteSink&) = delete; + + void Append(const char* bytes, int32_t n) override; + + char* GetAppendBuffer(int32_t min_capacity, + int32_t desired_capacity_hint, + char* scratch, + int32_t scratch_capacity, + int32_t* result_capacity) override; + +private: + CharString& dest_; +}; + +U_NAMESPACE_END diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/capi_helper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/capi_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..54b1db9e3318051e59ec5f4c894eb175eddd2679 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/capi_helper.h @@ -0,0 +1,97 @@ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#ifndef __CAPI_HELPER_H__ +#define __CAPI_HELPER_H__ + +#include "unicode/utypes.h" + +U_NAMESPACE_BEGIN + +/** + * An internal helper class to help convert between C and C++ APIs. + */ +template +class IcuCApiHelper { + public: + /** + * Convert from the C type to the C++ type (const version). + */ + static const CPPType* validate(const CType* input, UErrorCode& status); + + /** + * Convert from the C type to the C++ type (non-const version). + */ + static CPPType* validate(CType* input, UErrorCode& status); + + /** + * Convert from the C++ type to the C type (const version). + */ + const CType* exportConstForC() const; + + /** + * Convert from the C++ type to the C type (non-const version). + */ + CType* exportForC(); + + /** + * Invalidates the object. + */ + ~IcuCApiHelper(); + + private: + /** + * While the object is valid, fMagic equals kMagic. + */ + int32_t fMagic = kMagic; +}; + + +template +const CPPType* +IcuCApiHelper::validate(const CType* input, UErrorCode& status) { + if (U_FAILURE(status)) { + return nullptr; + } + if (input == nullptr) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return nullptr; + } + auto* impl = reinterpret_cast(input); + if (static_cast*>(impl)->fMagic != kMagic) { + status = U_INVALID_FORMAT_ERROR; + return nullptr; + } + return impl; +} + +template +CPPType* +IcuCApiHelper::validate(CType* input, UErrorCode& status) { + auto* constInput = static_cast(input); + auto* validated = validate(constInput, status); + return const_cast(validated); +} + +template +const CType* +IcuCApiHelper::exportConstForC() const { + return reinterpret_cast(static_cast(this)); +} + +template +CType* +IcuCApiHelper::exportForC() { + return reinterpret_cast(static_cast(this)); +} + +template +IcuCApiHelper::~IcuCApiHelper() { + // head off application errors by preventing use of of deleted objects. + fMagic = 0; +} + + +U_NAMESPACE_END + +#endif // __CAPI_HELPER_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/charstr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/charstr.h new file mode 100644 index 0000000000000000000000000000000000000000..175acd1c0a2b408d683c4d87b14dc1fca7a3f191 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/charstr.h @@ -0,0 +1,193 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2001-2015, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 11/19/2001 aliu Creation. +* 05/19/2010 markus Rewritten from scratch +********************************************************************** +*/ + +#ifndef CHARSTRING_H +#define CHARSTRING_H + +#include "unicode/utypes.h" +#include "unicode/unistr.h" +#include "unicode/uobject.h" +#include "cmemory.h" + +U_NAMESPACE_BEGIN + +// Windows needs us to DLL-export the MaybeStackArray template specialization, +// but MacOS X cannot handle it. Same as in digitlst.h. +#if !U_PLATFORM_IS_DARWIN_BASED +template class U_COMMON_API MaybeStackArray; +#endif + +/** + * ICU-internal char * string class. + * This class does not assume or enforce any particular character encoding. + * Raw bytes can be stored. The string object owns its characters. + * A terminating NUL is stored, but the class does not prevent embedded NUL characters. + * + * This class wants to be convenient but is also deliberately minimalist. + * Please do not add methods if they only add minor convenience. + * For example: + * cs.data()[5]='a'; // no need for setCharAt(5, 'a') + */ +class U_COMMON_API CharString : public UMemory { +public: + CharString() : len(0) { buffer[0]=0; } + CharString(StringPiece s, UErrorCode &errorCode) : len(0) { + buffer[0]=0; + append(s, errorCode); + } + CharString(const CharString &s, UErrorCode &errorCode) : len(0) { + buffer[0]=0; + append(s, errorCode); + } + CharString(const char *s, int32_t sLength, UErrorCode &errorCode) : len(0) { + buffer[0]=0; + append(s, sLength, errorCode); + } + ~CharString() {} + + /** + * Move constructor; might leave src in an undefined state. + * This string will have the same contents and state that the source string had. + */ + CharString(CharString &&src) U_NOEXCEPT; + /** + * Move assignment operator; might leave src in an undefined state. + * This string will have the same contents and state that the source string had. + * The behavior is undefined if *this and src are the same object. + */ + CharString &operator=(CharString &&src) U_NOEXCEPT; + + /** + * Replaces this string's contents with the other string's contents. + * CharString does not support the standard copy constructor nor + * the assignment operator, to make copies explicit and to + * use a UErrorCode where memory allocations might be needed. + */ + CharString ©From(const CharString &other, UErrorCode &errorCode); + + UBool isEmpty() const { return len==0; } + int32_t length() const { return len; } + char operator[](int32_t index) const { return buffer[index]; } + StringPiece toStringPiece() const { return StringPiece(buffer.getAlias(), len); } + + const char *data() const { return buffer.getAlias(); } + char *data() { return buffer.getAlias(); } + /** + * Allocates length()+1 chars and copies the NUL-terminated data(). + * The caller must uprv_free() the result. + */ + char *cloneData(UErrorCode &errorCode) const; + /** + * Copies the contents of the string into dest. + * Checks if there is enough space in dest, extracts the entire string if possible, + * and NUL-terminates dest if possible. + * + * If the string fits into dest but cannot be NUL-terminated (length()==capacity), + * then the error code is set to U_STRING_NOT_TERMINATED_WARNING. + * If the string itself does not fit into dest (length()>capacity), + * then the error code is set to U_BUFFER_OVERFLOW_ERROR. + * + * @param dest Destination string buffer. + * @param capacity Size of the dest buffer (number of chars). + * @param errorCode ICU error code. + * @return length() + */ + int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const; + + bool operator==(StringPiece other) const { + return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0); + } + bool operator!=(StringPiece other) const { + return !operator==(other); + } + + /** @return last index of c, or -1 if c is not in this string */ + int32_t lastIndexOf(char c) const; + + bool contains(StringPiece s) const; + + CharString &clear() { len=0; buffer[0]=0; return *this; } + CharString &truncate(int32_t newLength); + + CharString &append(char c, UErrorCode &errorCode); + CharString &append(StringPiece s, UErrorCode &errorCode) { + return append(s.data(), s.length(), errorCode); + } + CharString &append(const CharString &s, UErrorCode &errorCode) { + return append(s.data(), s.length(), errorCode); + } + CharString &append(const char *s, int32_t sLength, UErrorCode &status); + + CharString &appendNumber(int32_t number, UErrorCode &status); + + /** + * Returns a writable buffer for appending and writes the buffer's capacity to + * resultCapacity. Guarantees resultCapacity>=minCapacity if U_SUCCESS(). + * There will additionally be space for a terminating NUL right at resultCapacity. + * (This function is similar to ByteSink.GetAppendBuffer().) + * + * The returned buffer is only valid until the next write operation + * on this string. + * + * After writing at most resultCapacity bytes, call append() with the + * pointer returned from this function and the number of bytes written. + * + * @param minCapacity required minimum capacity of the returned buffer; + * must be non-negative + * @param desiredCapacityHint desired capacity of the returned buffer; + * must be non-negative + * @param resultCapacity will be set to the capacity of the returned buffer + * @param errorCode in/out error code + * @return a buffer with resultCapacity>=min_capacity + */ + char *getAppendBuffer(int32_t minCapacity, + int32_t desiredCapacityHint, + int32_t &resultCapacity, + UErrorCode &errorCode); + + CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode); + CharString &appendInvariantChars(const UChar* uchars, int32_t ucharsLen, UErrorCode& errorCode); + + /** + * Appends a filename/path part, e.g., a directory name. + * First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary. + * Does nothing if s is empty. + */ + CharString &appendPathPart(StringPiece s, UErrorCode &errorCode); + + /** + * Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty + * and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR. + */ + CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode); + +private: + MaybeStackArray buffer; + int32_t len; + + UBool ensureCapacity(int32_t capacity, int32_t desiredCapacityHint, UErrorCode &errorCode); + + CharString(const CharString &other); // forbid copying of this class + CharString &operator=(const CharString &other); // forbid copying of this class + + /** + * Returns U_FILE_ALT_SEP_CHAR if found in string, and U_FILE_SEP_CHAR is not found. + * Otherwise returns U_FILE_SEP_CHAR. + */ + char getDirSepChar() const; +}; + +U_NAMESPACE_END + +#endif +//eof diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/charstrmap.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/charstrmap.h new file mode 100644 index 0000000000000000000000000000000000000000..3320a4620852ce7324c43ce07f01655ee99f08b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/charstrmap.h @@ -0,0 +1,55 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// charstrmap.h +// created: 2020sep01 Frank Yung-Fong Tang + +#ifndef __CHARSTRMAP_H__ +#define __CHARSTRMAP_H__ + +#include +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "uhash.h" + +U_NAMESPACE_BEGIN + +/** + * Map of const char * keys & values. + * Stores pointers as is: Does not own/copy/adopt/release strings. + */ +class CharStringMap final : public UMemory { +public: + /** Constructs an unusable non-map. */ + CharStringMap() : map(nullptr) {} + CharStringMap(int32_t size, UErrorCode &errorCode) { + map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars, + size, &errorCode); + } + CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) { + other.map = nullptr; + } + CharStringMap(const CharStringMap &other) = delete; + ~CharStringMap() { + uhash_close(map); + } + + CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT { + map = other.map; + other.map = nullptr; + return *this; + } + CharStringMap &operator=(const CharStringMap &other) = delete; + + const char *get(const char *key) const { return static_cast(uhash_get(map, key)); } + void put(const char *key, const char *value, UErrorCode &errorCode) { + uhash_put(map, const_cast(key), const_cast(value), &errorCode); + } + +private: + UHashtable *map; +}; + +U_NAMESPACE_END + +#endif // __CHARSTRMAP_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cmemory.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cmemory.h new file mode 100644 index 0000000000000000000000000000000000000000..f03b7dcce6b9abb82eee296d3310d21c2b3d7ce0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cmemory.h @@ -0,0 +1,900 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* File CMEMORY.H +* +* Contains stdlib.h/string.h memory functions +* +* @author Bertrand A. Damiba +* +* Modification History: +* +* Date Name Description +* 6/20/98 Bertrand Created. +* 05/03/99 stephen Changed from functions to macros. +* +****************************************************************************** +*/ + +#ifndef CMEMORY_H +#define CMEMORY_H + +#include "unicode/utypes.h" + +#include +#include +#include "unicode/localpointer.h" +#include "uassert.h" + +#if U_DEBUG && defined(UPRV_MALLOC_COUNT) +#include +#endif + +// uprv_memcpy and uprv_memmove +#if defined(__clang__) +#define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + /* Suppress warnings about addresses that will never be NULL */ \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Waddress\"") \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + _Pragma("clang diagnostic pop") \ + U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + /* Suppress warnings about addresses that will never be NULL */ \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Waddress\"") \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + _Pragma("clang diagnostic pop") \ + U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#elif defined(__GNUC__) +#define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + /* Suppress warnings about addresses that will never be NULL */ \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Waddress\"") \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + _Pragma("GCC diagnostic pop") \ + U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + /* Suppress warnings about addresses that will never be NULL */ \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Waddress\"") \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + _Pragma("GCC diagnostic pop") \ + U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#else +#define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#endif + +/** + * \def UPRV_LENGTHOF + * Convenience macro to determine the length of a fixed array at compile-time. + * @param array A fixed length array + * @return The length of the array, in elements + * @internal + */ +#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) +#define uprv_memset(buffer, mark, size) U_STANDARD_CPP_NAMESPACE memset(buffer, mark, size) +#define uprv_memcmp(buffer1, buffer2, size) U_STANDARD_CPP_NAMESPACE memcmp(buffer1, buffer2,size) +#define uprv_memchr(ptr, value, num) U_STANDARD_CPP_NAMESPACE memchr(ptr, value, num) + +U_CAPI void * U_EXPORT2 +uprv_malloc(size_t s) U_MALLOC_ATTR U_ALLOC_SIZE_ATTR(1); + +U_CAPI void * U_EXPORT2 +uprv_realloc(void *mem, size_t size) U_ALLOC_SIZE_ATTR(2); + +U_CAPI void U_EXPORT2 +uprv_free(void *mem); + +U_CAPI void * U_EXPORT2 +uprv_calloc(size_t num, size_t size) U_MALLOC_ATTR U_ALLOC_SIZE_ATTR2(1,2); + +/** + * Get the least significant bits of a pointer (a memory address). + * For example, with a mask of 3, the macro gets the 2 least significant bits, + * which will be 0 if the pointer is 32-bit (4-byte) aligned. + * + * uintptr_t is the most appropriate integer type to cast to. + */ +#define U_POINTER_MASK_LSB(ptr, mask) ((uintptr_t)(ptr) & (mask)) + +/** + * Create & return an instance of "type" in statically allocated storage. + * e.g. + * static std::mutex *myMutex = STATIC_NEW(std::mutex); + * To destroy an object created in this way, invoke the destructor explicitly, e.g. + * myMutex->~mutex(); + * DO NOT use delete. + * DO NOT use with class UMutex, which has specific support for static instances. + * + * STATIC_NEW is intended for use when + * - We want a static (or global) object. + * - We don't want it to ever be destructed, or to explicitly control destruction, + * to avoid use-after-destruction problems. + * - We want to avoid an ordinary heap allocated object, + * to avoid the possibility of memory allocation failures, and + * to avoid memory leak reports, from valgrind, for example. + * This is defined as a macro rather than a template function because each invocation + * must define distinct static storage for the object being returned. + */ +#define STATIC_NEW(type) [] () { \ + alignas(type) static char storage[sizeof(type)]; \ + return new(storage) type();} () + +/** + * Heap clean up function, called from u_cleanup() + * Clears any user heap functions from u_setMemoryFunctions() + * Does NOT deallocate any remaining allocated memory. + */ +U_CFUNC UBool +cmemory_cleanup(void); + +/** + * A function called by uhash_remove, + * uhash_close, or uhash_put to delete + * an existing key or value. + * @param obj A key or value stored in a hashtable + * @see uprv_deleteUObject + */ +typedef void U_CALLCONV UObjectDeleter(void* obj); + +/** + * Deleter for UObject instances. + * Works for all subclasses of UObject because it has a virtual destructor. + */ +U_CAPI void U_EXPORT2 +uprv_deleteUObject(void *obj); + +#ifdef __cplusplus + +#include +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN + +/** + * "Smart pointer" class, deletes memory via uprv_free(). + * For most methods see the LocalPointerBase base class. + * Adds operator[] for array item access. + * + * @see LocalPointerBase + */ +template +class LocalMemory : public LocalPointerBase { +public: + using LocalPointerBase::operator*; + using LocalPointerBase::operator->; + /** + * Constructor takes ownership. + * @param p simple pointer to an array of T items that is adopted + */ + explicit LocalMemory(T *p=NULL) : LocalPointerBase(p) {} + /** + * Move constructor, leaves src with isNull(). + * @param src source smart pointer + */ + LocalMemory(LocalMemory &&src) U_NOEXCEPT : LocalPointerBase(src.ptr) { + src.ptr=NULL; + } + /** + * Destructor deletes the memory it owns. + */ + ~LocalMemory() { + uprv_free(LocalPointerBase::ptr); + } + /** + * Move assignment operator, leaves src with isNull(). + * The behavior is undefined if *this and src are the same object. + * @param src source smart pointer + * @return *this + */ + LocalMemory &operator=(LocalMemory &&src) U_NOEXCEPT { + uprv_free(LocalPointerBase::ptr); + LocalPointerBase::ptr=src.ptr; + src.ptr=NULL; + return *this; + } + /** + * Swap pointers. + * @param other other smart pointer + */ + void swap(LocalMemory &other) U_NOEXCEPT { + T *temp=LocalPointerBase::ptr; + LocalPointerBase::ptr=other.ptr; + other.ptr=temp; + } + /** + * Non-member LocalMemory swap function. + * @param p1 will get p2's pointer + * @param p2 will get p1's pointer + */ + friend inline void swap(LocalMemory &p1, LocalMemory &p2) U_NOEXCEPT { + p1.swap(p2); + } + /** + * Deletes the array it owns, + * and adopts (takes ownership of) the one passed in. + * @param p simple pointer to an array of T items that is adopted + */ + void adoptInstead(T *p) { + uprv_free(LocalPointerBase::ptr); + LocalPointerBase::ptr=p; + } + /** + * Deletes the array it owns, allocates a new one and reset its bytes to 0. + * Returns the new array pointer. + * If the allocation fails, then the current array is unchanged and + * this method returns NULL. + * @param newCapacity must be >0 + * @return the allocated array pointer, or NULL if the allocation failed + */ + inline T *allocateInsteadAndReset(int32_t newCapacity=1); + /** + * Deletes the array it owns and allocates a new one, copying length T items. + * Returns the new array pointer. + * If the allocation fails, then the current array is unchanged and + * this method returns NULL. + * @param newCapacity must be >0 + * @param length number of T items to be copied from the old array to the new one; + * must be no more than the capacity of the old array, + * which the caller must track because the LocalMemory does not track it + * @return the allocated array pointer, or NULL if the allocation failed + */ + inline T *allocateInsteadAndCopy(int32_t newCapacity=1, int32_t length=0); + /** + * Array item access (writable). + * No index bounds check. + * @param i array index + * @return reference to the array item + */ + T &operator[](ptrdiff_t i) const { return LocalPointerBase::ptr[i]; } +}; + +template +inline T *LocalMemory::allocateInsteadAndReset(int32_t newCapacity) { + if(newCapacity>0) { + T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); + if(p!=NULL) { + uprv_memset(p, 0, newCapacity*sizeof(T)); + uprv_free(LocalPointerBase::ptr); + LocalPointerBase::ptr=p; + } + return p; + } else { + return NULL; + } +} + + +template +inline T *LocalMemory::allocateInsteadAndCopy(int32_t newCapacity, int32_t length) { + if(newCapacity>0) { + T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); + if(p!=NULL) { + if(length>0) { + if(length>newCapacity) { + length=newCapacity; + } + uprv_memcpy(p, LocalPointerBase::ptr, (size_t)length*sizeof(T)); + } + uprv_free(LocalPointerBase::ptr); + LocalPointerBase::ptr=p; + } + return p; + } else { + return NULL; + } +} + +/** + * Simple array/buffer management class using uprv_malloc() and uprv_free(). + * Provides an internal array with fixed capacity. Can alias another array + * or allocate one. + * + * The array address is properly aligned for type T. It might not be properly + * aligned for types larger than T (or larger than the largest subtype of T). + * + * Unlike LocalMemory and LocalArray, this class never adopts + * (takes ownership of) another array. + * + * WARNING: MaybeStackArray only works with primitive (plain-old data) types. + * It does NOT know how to call a destructor! If you work with classes with + * destructors, consider: + * + * - LocalArray in localpointer.h if you know the length ahead of time + * - MaybeStackVector if you know the length at runtime + */ +template +class MaybeStackArray { +public: + // No heap allocation. Use only on the stack. + static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete; +#if U_HAVE_PLACEMENT_NEW + static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete; +#endif + + /** + * Default constructor initializes with internal T[stackCapacity] buffer. + */ + MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} + /** + * Automatically allocates the heap array if the argument is larger than the stack capacity. + * Intended for use when an approximate capacity is known at compile time but the true + * capacity is not known until runtime. + */ + MaybeStackArray(int32_t newCapacity, UErrorCode status) : MaybeStackArray() { + if (U_FAILURE(status)) { + return; + } + if (capacity < newCapacity) { + if (resize(newCapacity) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + } + } + /** + * Destructor deletes the array (if owned). + */ + ~MaybeStackArray() { releaseArray(); } + /** + * Move constructor: transfers ownership or copies the stack array. + */ + MaybeStackArray(MaybeStackArray &&src) U_NOEXCEPT; + /** + * Move assignment: transfers ownership or copies the stack array. + */ + MaybeStackArray &operator=(MaybeStackArray &&src) U_NOEXCEPT; + /** + * Returns the array capacity (number of T items). + * @return array capacity + */ + int32_t getCapacity() const { return capacity; } + /** + * Access without ownership change. + * @return the array pointer + */ + T *getAlias() const { return ptr; } + /** + * Returns the array limit. Simple convenience method. + * @return getAlias()+getCapacity() + */ + T *getArrayLimit() const { return getAlias()+capacity; } + // No "operator T *() const" because that can make + // expressions like mbs[index] ambiguous for some compilers. + /** + * Array item access (const). + * No index bounds check. + * @param i array index + * @return reference to the array item + */ + const T &operator[](ptrdiff_t i) const { return ptr[i]; } + /** + * Array item access (writable). + * No index bounds check. + * @param i array index + * @return reference to the array item + */ + T &operator[](ptrdiff_t i) { return ptr[i]; } + /** + * Deletes the array (if owned) and aliases another one, no transfer of ownership. + * If the arguments are illegal, then the current array is unchanged. + * @param otherArray must not be NULL + * @param otherCapacity must be >0 + */ + void aliasInstead(T *otherArray, int32_t otherCapacity) { + if(otherArray!=NULL && otherCapacity>0) { + releaseArray(); + ptr=otherArray; + capacity=otherCapacity; + needToRelease=false; + } + } + /** + * Deletes the array (if owned) and allocates a new one, copying length T items. + * Returns the new array pointer. + * If the allocation fails, then the current array is unchanged and + * this method returns NULL. + * @param newCapacity can be less than or greater than the current capacity; + * must be >0 + * @param length number of T items to be copied from the old array to the new one + * @return the allocated array pointer, or NULL if the allocation failed + */ + inline T *resize(int32_t newCapacity, int32_t length=0); + /** + * Gives up ownership of the array if owned, or else clones it, + * copying length T items; resets itself to the internal stack array. + * Returns NULL if the allocation failed. + * @param length number of T items to copy when cloning, + * and capacity of the clone when cloning + * @param resultCapacity will be set to the returned array's capacity (output-only) + * @return the array pointer; + * caller becomes responsible for deleting the array + */ + inline T *orphanOrClone(int32_t length, int32_t &resultCapacity); + +protected: + // Resizes the array to the size of src, then copies the contents of src. + void copyFrom(const MaybeStackArray &src, UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + if (this->resize(src.capacity, 0) == NULL) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memcpy(this->ptr, src.ptr, (size_t)capacity * sizeof(T)); + } + +private: + T *ptr; + int32_t capacity; + UBool needToRelease; + T stackArray[stackCapacity]; + void releaseArray() { + if(needToRelease) { + uprv_free(ptr); + } + } + void resetToStackArray() { + ptr=stackArray; + capacity=stackCapacity; + needToRelease=false; + } + /* No comparison operators with other MaybeStackArray's. */ + bool operator==(const MaybeStackArray & /*other*/) = delete; + bool operator!=(const MaybeStackArray & /*other*/) = delete; + /* No ownership transfer: No copy constructor, no assignment operator. */ + MaybeStackArray(const MaybeStackArray & /*other*/) = delete; + void operator=(const MaybeStackArray & /*other*/) = delete; +}; + +template +icu::MaybeStackArray::MaybeStackArray( + MaybeStackArray && src) U_NOEXCEPT + : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) { + if (src.ptr == src.stackArray) { + ptr = stackArray; + uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); + } else { + src.resetToStackArray(); // take ownership away from src + } +} + +template +inline MaybeStackArray & +MaybeStackArray::operator=(MaybeStackArray && src) U_NOEXCEPT { + releaseArray(); // in case this instance had its own memory allocated + capacity = src.capacity; + needToRelease = src.needToRelease; + if (src.ptr == src.stackArray) { + ptr = stackArray; + uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); + } else { + ptr = src.ptr; + src.resetToStackArray(); // take ownership away from src + } + return *this; +} + +template +inline T *MaybeStackArray::resize(int32_t newCapacity, int32_t length) { + if(newCapacity>0) { +#if U_DEBUG && defined(UPRV_MALLOC_COUNT) + ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); +#endif + T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); + if(p!=NULL) { + if(length>0) { + if(length>capacity) { + length=capacity; + } + if(length>newCapacity) { + length=newCapacity; + } + uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); + } + releaseArray(); + ptr=p; + capacity=newCapacity; + needToRelease=true; + } + return p; + } else { + return NULL; + } +} + +template +inline T *MaybeStackArray::orphanOrClone(int32_t length, int32_t &resultCapacity) { + T *p; + if(needToRelease) { + p=ptr; + } else if(length<=0) { + return NULL; + } else { + if(length>capacity) { + length=capacity; + } + p=(T *)uprv_malloc(length*sizeof(T)); +#if U_DEBUG && defined(UPRV_MALLOC_COUNT) + ::fprintf(::stderr,"MaybeStacArray (orphan) alloc %d * %lu\n", length,sizeof(T)); +#endif + if(p==NULL) { + return NULL; + } + uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); + } + resultCapacity=length; + resetToStackArray(); + return p; +} + +/** + * Variant of MaybeStackArray that allocates a header struct and an array + * in one contiguous memory block, using uprv_malloc() and uprv_free(). + * Provides internal memory with fixed array capacity. Can alias another memory + * block or allocate one. + * The stackCapacity is the number of T items in the internal memory, + * not counting the H header. + * Unlike LocalMemory and LocalArray, this class never adopts + * (takes ownership of) another memory block. + */ +template +class MaybeStackHeaderAndArray { +public: + // No heap allocation. Use only on the stack. + static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete; +#if U_HAVE_PLACEMENT_NEW + static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete; +#endif + + /** + * Default constructor initializes with internal H+T[stackCapacity] buffer. + */ + MaybeStackHeaderAndArray() : ptr(&stackHeader), capacity(stackCapacity), needToRelease(false) {} + /** + * Destructor deletes the memory (if owned). + */ + ~MaybeStackHeaderAndArray() { releaseMemory(); } + /** + * Returns the array capacity (number of T items). + * @return array capacity + */ + int32_t getCapacity() const { return capacity; } + /** + * Access without ownership change. + * @return the header pointer + */ + H *getAlias() const { return ptr; } + /** + * Returns the array start. + * @return array start, same address as getAlias()+1 + */ + T *getArrayStart() const { return reinterpret_cast(getAlias()+1); } + /** + * Returns the array limit. + * @return array limit + */ + T *getArrayLimit() const { return getArrayStart()+capacity; } + /** + * Access without ownership change. Same as getAlias(). + * A class instance can be used directly in expressions that take a T *. + * @return the header pointer + */ + operator H *() const { return ptr; } + /** + * Array item access (writable). + * No index bounds check. + * @param i array index + * @return reference to the array item + */ + T &operator[](ptrdiff_t i) { return getArrayStart()[i]; } + /** + * Deletes the memory block (if owned) and aliases another one, no transfer of ownership. + * If the arguments are illegal, then the current memory is unchanged. + * @param otherArray must not be NULL + * @param otherCapacity must be >0 + */ + void aliasInstead(H *otherMemory, int32_t otherCapacity) { + if(otherMemory!=NULL && otherCapacity>0) { + releaseMemory(); + ptr=otherMemory; + capacity=otherCapacity; + needToRelease=false; + } + } + /** + * Deletes the memory block (if owned) and allocates a new one, + * copying the header and length T array items. + * Returns the new header pointer. + * If the allocation fails, then the current memory is unchanged and + * this method returns NULL. + * @param newCapacity can be less than or greater than the current capacity; + * must be >0 + * @param length number of T items to be copied from the old array to the new one + * @return the allocated pointer, or NULL if the allocation failed + */ + inline H *resize(int32_t newCapacity, int32_t length=0); + /** + * Gives up ownership of the memory if owned, or else clones it, + * copying the header and length T array items; resets itself to the internal memory. + * Returns NULL if the allocation failed. + * @param length number of T items to copy when cloning, + * and array capacity of the clone when cloning + * @param resultCapacity will be set to the returned array's capacity (output-only) + * @return the header pointer; + * caller becomes responsible for deleting the array + */ + inline H *orphanOrClone(int32_t length, int32_t &resultCapacity); +private: + H *ptr; + int32_t capacity; + UBool needToRelease; + // stackHeader must precede stackArray immediately. + H stackHeader; + T stackArray[stackCapacity]; + void releaseMemory() { + if(needToRelease) { + uprv_free(ptr); + } + } + /* No comparison operators with other MaybeStackHeaderAndArray's. */ + bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return false;} + bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return true;} + /* No ownership transfer: No copy constructor, no assignment operator. */ + MaybeStackHeaderAndArray(const MaybeStackHeaderAndArray & /*other*/) {} + void operator=(const MaybeStackHeaderAndArray & /*other*/) {} +}; + +template +inline H *MaybeStackHeaderAndArray::resize(int32_t newCapacity, + int32_t length) { + if(newCapacity>=0) { +#if U_DEBUG && defined(UPRV_MALLOC_COUNT) + ::fprintf(::stderr,"MaybeStackHeaderAndArray alloc %d + %d * %ul\n", sizeof(H),newCapacity,sizeof(T)); +#endif + H *p=(H *)uprv_malloc(sizeof(H)+newCapacity*sizeof(T)); + if(p!=NULL) { + if(length<0) { + length=0; + } else if(length>0) { + if(length>capacity) { + length=capacity; + } + if(length>newCapacity) { + length=newCapacity; + } + } + uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T)); + releaseMemory(); + ptr=p; + capacity=newCapacity; + needToRelease=true; + } + return p; + } else { + return NULL; + } +} + +template +inline H *MaybeStackHeaderAndArray::orphanOrClone(int32_t length, + int32_t &resultCapacity) { + H *p; + if(needToRelease) { + p=ptr; + } else { + if(length<0) { + length=0; + } else if(length>capacity) { + length=capacity; + } +#if U_DEBUG && defined(UPRV_MALLOC_COUNT) + ::fprintf(::stderr,"MaybeStackHeaderAndArray (orphan) alloc %ul + %d * %lu\n", sizeof(H),length,sizeof(T)); +#endif + p=(H *)uprv_malloc(sizeof(H)+length*sizeof(T)); + if(p==NULL) { + return NULL; + } + uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T)); + } + resultCapacity=length; + ptr=&stackHeader; + capacity=stackCapacity; + needToRelease=false; + return p; +} + +/** + * A simple memory management class that creates new heap allocated objects (of + * any class that has a public constructor), keeps track of them and eventually + * deletes them all in its own destructor. + * + * A typical use-case would be code like this: + * + * MemoryPool pool; + * + * MyType* o1 = pool.create(); + * if (o1 != nullptr) { + * foo(o1); + * } + * + * MyType* o2 = pool.create(1, 2, 3); + * if (o2 != nullptr) { + * bar(o2); + * } + * + * // MemoryPool will take care of deleting the MyType objects. + * + * It doesn't do anything more than that, and is intentionally kept minimalist. + */ +template +class MemoryPool : public UMemory { +public: + MemoryPool() : fCount(0), fPool() {} + + ~MemoryPool() { + for (int32_t i = 0; i < fCount; ++i) { + delete fPool[i]; + } + } + + MemoryPool(const MemoryPool&) = delete; + MemoryPool& operator=(const MemoryPool&) = delete; + + MemoryPool(MemoryPool&& other) U_NOEXCEPT : fCount(other.fCount), + fPool(std::move(other.fPool)) { + other.fCount = 0; + } + + MemoryPool& operator=(MemoryPool&& other) U_NOEXCEPT { + // Since `this` may contain instances that need to be deleted, we can't + // just throw them away and replace them with `other`. The normal way of + // dealing with this in C++ is to swap `this` and `other`, rather than + // simply overwrite: the destruction of `other` can then take care of + // running MemoryPool::~MemoryPool() over the still-to-be-deallocated + // instances. + std::swap(fCount, other.fCount); + std::swap(fPool, other.fPool); + return *this; + } + + /** + * Creates a new object of typename T, by forwarding any and all arguments + * to the typename T constructor. + * + * @param args Arguments to be forwarded to the typename T constructor. + * @return A pointer to the newly created object, or nullptr on error. + */ + template + T* create(Args&&... args) { + int32_t capacity = fPool.getCapacity(); + if (fCount == capacity && + fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, + capacity) == nullptr) { + return nullptr; + } + return fPool[fCount++] = new T(std::forward(args)...); + } + + template + T* createAndCheckErrorCode(UErrorCode &status, Args &&... args) { + if (U_FAILURE(status)) { + return nullptr; + } + T *pointer = this->create(args...); + if (U_SUCCESS(status) && pointer == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + return pointer; + } + + /** + * @return Number of elements that have been allocated. + */ + int32_t count() const { + return fCount; + } + +protected: + int32_t fCount; + MaybeStackArray fPool; +}; + +/** + * An internal Vector-like implementation based on MemoryPool. + * + * Heap-allocates each element and stores pointers. + * + * To append an item to the vector, use emplaceBack. + * + * MaybeStackVector vector; + * MyType* element = vector.emplaceBack(); + * if (!element) { + * status = U_MEMORY_ALLOCATION_ERROR; + * } + * // do stuff with element + * + * To loop over the vector, use a for loop with indices: + * + * for (int32_t i = 0; i < vector.length(); i++) { + * MyType* element = vector[i]; + * } + */ +template +class MaybeStackVector : protected MemoryPool { +public: + template + T* emplaceBack(Args&&... args) { + return this->create(args...); + } + + template + T *emplaceBackAndCheckErrorCode(UErrorCode &status, Args &&... args) { + return this->createAndCheckErrorCode(status, args...); + } + + int32_t length() const { + return this->fCount; + } + + T** getAlias() { + return this->fPool.getAlias(); + } + + const T *const *getAlias() const { + return this->fPool.getAlias(); + } + + /** + * Array item access (read-only). + * No index bounds check. + * @param i array index + * @return reference to the array item + */ + const T* operator[](ptrdiff_t i) const { + return this->fPool[i]; + } + + /** + * Array item access (writable). + * No index bounds check. + * @param i array index + * @return reference to the array item + */ + T* operator[](ptrdiff_t i) { + return this->fPool[i]; + } +}; + + +U_NAMESPACE_END + +#endif /* __cplusplus */ +#endif /* CMEMORY_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cpputils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cpputils.h new file mode 100644 index 0000000000000000000000000000000000000000..307e570486439f8aa13292f0d7ba326d1ed1270c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cpputils.h @@ -0,0 +1,97 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: cpputils.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +*/ + +#ifndef CPPUTILS_H +#define CPPUTILS_H + +#include "unicode/utypes.h" +#include "unicode/unistr.h" +#include "cmemory.h" + +/*==========================================================================*/ +/* Array copy utility functions */ +/*==========================================================================*/ + +static +inline void uprv_arrayCopy(const double* src, double* dst, int32_t count) +{ uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } + +static +inline void uprv_arrayCopy(const double* src, int32_t srcStart, + double* dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } + +static +inline void uprv_arrayCopy(const int8_t* src, int8_t* dst, int32_t count) + { uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } + +static +inline void uprv_arrayCopy(const int8_t* src, int32_t srcStart, + int8_t* dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } + +static +inline void uprv_arrayCopy(const int16_t* src, int16_t* dst, int32_t count) +{ uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } + +static +inline void uprv_arrayCopy(const int16_t* src, int32_t srcStart, + int16_t* dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } + +static +inline void uprv_arrayCopy(const int32_t* src, int32_t* dst, int32_t count) +{ uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } + +static +inline void uprv_arrayCopy(const int32_t* src, int32_t srcStart, + int32_t* dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } + +static +inline void +uprv_arrayCopy(const UChar *src, int32_t srcStart, + UChar *dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } + +/** + * Copy an array of UnicodeString OBJECTS (not pointers). + * @internal + */ +static inline void +uprv_arrayCopy(const icu::UnicodeString *src, icu::UnicodeString *dst, int32_t count) +{ while(count-- > 0) *dst++ = *src++; } + +/** + * Copy an array of UnicodeString OBJECTS (not pointers). + * @internal + */ +static inline void +uprv_arrayCopy(const icu::UnicodeString *src, int32_t srcStart, + icu::UnicodeString *dst, int32_t dstStart, int32_t count) +{ uprv_arrayCopy(src+srcStart, dst+dstStart, count); } + +/** + * Checks that the string is readable and writable. + * Sets U_ILLEGAL_ARGUMENT_ERROR if the string isBogus() or has an open getBuffer(). + */ +inline void +uprv_checkCanGetBuffer(const icu::UnicodeString &s, UErrorCode &errorCode) { + if(U_SUCCESS(errorCode) && s.isBogus()) { + errorCode=U_ILLEGAL_ARGUMENT_ERROR; + } +} + +#endif /* _CPPUTILS */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cstr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cstr.h new file mode 100644 index 0000000000000000000000000000000000000000..c33f487ea121cd18ce472d328f6be4ef4e3be75d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cstr.h @@ -0,0 +1,60 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* File: cstr.h +*/ + +#ifndef CSTR_H +#define CSTR_H + +#include "unicode/unistr.h" +#include "unicode/uobject.h" +#include "unicode/utypes.h" + +#include "charstr.h" + +/** + * ICU-internal class CStr, a small helper class to facilitate passing UnicodeStrings + * to functions needing (const char *) strings, such as printf(). + * + * It is intended primarily for use in debugging or in tests. Uses platform + * default code page conversion, which will do the best job possible, + * but may be lossy, depending on the platform. + * + * If no other conversion is available, use invariant conversion and substitue + * '?' for non-invariant characters. + * + * Example Usage: + * UnicodeString s = whatever; + * printf("%s", CStr(s)()); + * + * The explicit call to the CStr() constructor creates a temporary object. + * Operator () on the temporary object returns a (const char *) pointer. + * The lifetime of the (const char *) data is that of the temporary object, + * which works well when passing it as a parameter to another function, such as printf. + */ + +U_NAMESPACE_BEGIN + +class U_COMMON_API CStr : public UMemory { + public: + CStr(const UnicodeString &in); + ~CStr(); + const char * operator ()() const; + + private: + CharString s; + CStr(const CStr &other); // Forbid copying of this class. + CStr &operator =(const CStr &other); // Forbid assignment. +}; + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cstring.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cstring.h new file mode 100644 index 0000000000000000000000000000000000000000..3a14e4216c8e516013882f63a517188fd96db525 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cstring.h @@ -0,0 +1,126 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* File CSTRING.H +* +* Contains CString interface +* +* @author Helena Shih +* +* Modification History: +* +* Date Name Description +* 6/17/98 hshih Created. +* 05/03/99 stephen Changed from functions to macros. +* 06/14/99 stephen Added icu_strncat, icu_strncmp, icu_tolower +* +****************************************************************************** +*/ + +#ifndef CSTRING_H +#define CSTRING_H 1 + +#include "unicode/utypes.h" +#include "cmemory.h" +#include +#include +#include + +#define uprv_strcpy(dst, src) U_STANDARD_CPP_NAMESPACE strcpy(dst, src) +#define uprv_strlen(str) U_STANDARD_CPP_NAMESPACE strlen(str) +#define uprv_strcmp(s1, s2) U_STANDARD_CPP_NAMESPACE strcmp(s1, s2) +#define uprv_strcat(dst, src) U_STANDARD_CPP_NAMESPACE strcat(dst, src) +#define uprv_strchr(s, c) U_STANDARD_CPP_NAMESPACE strchr(s, c) +#define uprv_strstr(s, c) U_STANDARD_CPP_NAMESPACE strstr(s, c) +#define uprv_strrchr(s, c) U_STANDARD_CPP_NAMESPACE strrchr(s, c) +#define uprv_strncpy(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size) +#define uprv_strncmp(s1, s2, n) U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n) +#define uprv_strncat(dst, src, n) U_STANDARD_CPP_NAMESPACE strncat(dst, src, n) + +/** + * Is c an ASCII-repertoire letter a-z or A-Z? + * Note: The implementation is specific to whether ICU is compiled for + * an ASCII-based or EBCDIC-based machine. There just does not seem to be a better name for this. + */ +U_CAPI UBool U_EXPORT2 +uprv_isASCIILetter(char c); + +// NOTE: For u_asciiToUpper that takes a UChar, see ustr_imp.h + +U_CAPI char U_EXPORT2 +uprv_toupper(char c); + + +U_CAPI char U_EXPORT2 +uprv_asciitolower(char c); + +U_CAPI char U_EXPORT2 +uprv_ebcdictolower(char c); + +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define uprv_tolower uprv_asciitolower +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define uprv_tolower uprv_ebcdictolower +#else +# error U_CHARSET_FAMILY is not valid +#endif + +#define uprv_strtod(source, end) U_STANDARD_CPP_NAMESPACE strtod(source, end) +#define uprv_strtoul(str, end, base) U_STANDARD_CPP_NAMESPACE strtoul(str, end, base) +#define uprv_strtol(str, end, base) U_STANDARD_CPP_NAMESPACE strtol(str, end, base) + +/* Conversion from a digit to the character with radix base from 2-19 */ +/* May need to use U_UPPER_ORDINAL*/ +#define T_CString_itosOffset(a) ((a)<=9?('0'+(a)):('A'+(a)-10)) + +U_CAPI char* U_EXPORT2 +uprv_strdup(const char *src); + +/** + * uprv_malloc n+1 bytes, and copy n bytes from src into the new string. + * Terminate with a null at offset n. If n is -1, works like uprv_strdup + * @param src + * @param n length of the input string, not including null. + * @return new string (owned by caller, use uprv_free to free). + * @internal + */ +U_CAPI char* U_EXPORT2 +uprv_strndup(const char *src, int32_t n); + +U_CAPI char* U_EXPORT2 +T_CString_toLowerCase(char* str); + +U_CAPI char* U_EXPORT2 +T_CString_toUpperCase(char* str); + +U_CAPI int32_t U_EXPORT2 +T_CString_integerToString(char *buffer, int32_t n, int32_t radix); + +U_CAPI int32_t U_EXPORT2 +T_CString_int64ToString(char *buffer, int64_t n, uint32_t radix); + +U_CAPI int32_t U_EXPORT2 +T_CString_stringToInteger(const char *integerString, int32_t radix); + +/** + * Case-insensitive, language-independent string comparison + * limited to the ASCII character repertoire. + */ +U_CAPI int U_EXPORT2 +uprv_stricmp(const char *str1, const char *str2); + +/** + * Case-insensitive, language-independent string comparison + * limited to the ASCII character repertoire. + */ +U_CAPI int U_EXPORT2 +uprv_strnicmp(const char *str1, const char *str2, uint32_t n); + +#endif /* ! CSTRING_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cwchar.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cwchar.h new file mode 100644 index 0000000000000000000000000000000000000000..8fd041a1b9c568dbd1c07a711b923e869f43541f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/cwchar.h @@ -0,0 +1,58 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2001, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: cwchar.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2001may25 +* created by: Markus W. Scherer +* +* This file contains ICU-internal definitions of wchar_t operations. +* These definitions were moved here from cstring.h so that fewer +* ICU implementation files include wchar.h. +*/ + +#ifndef __CWCHAR_H__ +#define __CWCHAR_H__ + +#include +#include +#include "unicode/utypes.h" + +/* Do this after utypes.h so that we have U_HAVE_WCHAR_H . */ +#if U_HAVE_WCHAR_H +# include +#endif + +/*===========================================================================*/ +/* Wide-character functions */ +/*===========================================================================*/ + +/* The following are not available on all systems, defined in wchar.h or string.h. */ +#if U_HAVE_WCSCPY +# define uprv_wcscpy wcscpy +# define uprv_wcscat wcscat +# define uprv_wcslen wcslen +#else +U_CAPI wchar_t* U_EXPORT2 +uprv_wcscpy(wchar_t *dst, const wchar_t *src); +U_CAPI wchar_t* U_EXPORT2 +uprv_wcscat(wchar_t *dst, const wchar_t *src); +U_CAPI size_t U_EXPORT2 +uprv_wcslen(const wchar_t *src); +#endif + +/* The following are part of the ANSI C standard, defined in stdlib.h . */ +#define uprv_wcstombs(mbstr, wcstr, count) U_STANDARD_CPP_NAMESPACE wcstombs(mbstr, wcstr, count) +#define uprv_mbstowcs(wcstr, mbstr, count) U_STANDARD_CPP_NAMESPACE mbstowcs(wcstr, mbstr, count) + + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/dictbe.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/dictbe.h new file mode 100644 index 0000000000000000000000000000000000000000..4ea676fc71610f70b4e490c3dc3afceab49d55ff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/dictbe.h @@ -0,0 +1,402 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/** + ******************************************************************************* + * Copyright (C) 2006-2014, International Business Machines Corporation * + * and others. All Rights Reserved. * + ******************************************************************************* + */ + +#ifndef DICTBE_H +#define DICTBE_H + +#include "unicode/utypes.h" +#include "unicode/uniset.h" +#include "unicode/utext.h" + +#include "brkeng.h" +#include "uvectr32.h" + +U_NAMESPACE_BEGIN + +class DictionaryMatcher; +class Normalizer2; + +/******************************************************************* + * DictionaryBreakEngine + */ + +/** + *

DictionaryBreakEngine is a kind of LanguageBreakEngine that uses a + * dictionary to determine language-specific breaks.

+ * + *

After it is constructed a DictionaryBreakEngine may be shared between + * threads without synchronization.

+ */ +class DictionaryBreakEngine : public LanguageBreakEngine { + private: + /** + * The set of characters handled by this engine + * @internal + */ + + UnicodeSet fSet; + + public: + + /** + *

Constructor

+ */ + DictionaryBreakEngine(); + + /** + *

Virtual destructor.

+ */ + virtual ~DictionaryBreakEngine(); + + /** + *

Indicate whether this engine handles a particular character for + * a particular kind of break.

+ * + * @param c A character which begins a run that the engine might handle + * @return true if this engine handles the particular character and break + * type. + */ + virtual UBool handles(UChar32 c) const; + + /** + *

Find any breaks within a run in the supplied text.

+ * + * @param text A UText representing the text. The iterator is left at + * the end of the run of characters which the engine is capable of handling + * that starts from the first character in the range. + * @param startPos The start of the run within the supplied text. + * @param endPos The end of the run within the supplied text. + * @param foundBreaks vector of int32_t to receive the break positions + * @return The number of breaks found. + */ + virtual int32_t findBreaks( UText *text, + int32_t startPos, + int32_t endPos, + UVector32 &foundBreaks ) const; + + protected: + + /** + *

Set the character set handled by this engine.

+ * + * @param set A UnicodeSet of the set of characters handled by the engine + */ + virtual void setCharacters( const UnicodeSet &set ); + + /** + *

Divide up a range of known dictionary characters handled by this break engine.

+ * + * @param text A UText representing the text + * @param rangeStart The start of the range of dictionary characters + * @param rangeEnd The end of the range of dictionary characters + * @param foundBreaks Output of C array of int32_t break positions, or 0 + * @return The number of breaks found + */ + virtual int32_t divideUpDictionaryRange( UText *text, + int32_t rangeStart, + int32_t rangeEnd, + UVector32 &foundBreaks ) const = 0; + +}; + +/******************************************************************* + * ThaiBreakEngine + */ + +/** + *

ThaiBreakEngine is a kind of DictionaryBreakEngine that uses a + * dictionary and heuristics to determine Thai-specific breaks.

+ * + *

After it is constructed a ThaiBreakEngine may be shared between + * threads without synchronization.

+ */ +class ThaiBreakEngine : public DictionaryBreakEngine { + private: + /** + * The set of characters handled by this engine + * @internal + */ + + UnicodeSet fThaiWordSet; + UnicodeSet fEndWordSet; + UnicodeSet fBeginWordSet; + UnicodeSet fSuffixSet; + UnicodeSet fMarkSet; + DictionaryMatcher *fDictionary; + + public: + + /** + *

Default constructor.

+ * + * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the + * engine is deleted. + */ + ThaiBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status); + + /** + *

Virtual destructor.

+ */ + virtual ~ThaiBreakEngine(); + + protected: + /** + *

Divide up a range of known dictionary characters handled by this break engine.

+ * + * @param text A UText representing the text + * @param rangeStart The start of the range of dictionary characters + * @param rangeEnd The end of the range of dictionary characters + * @param foundBreaks Output of C array of int32_t break positions, or 0 + * @return The number of breaks found + */ + virtual int32_t divideUpDictionaryRange( UText *text, + int32_t rangeStart, + int32_t rangeEnd, + UVector32 &foundBreaks ) const; + +}; + +/******************************************************************* + * LaoBreakEngine + */ + +/** + *

LaoBreakEngine is a kind of DictionaryBreakEngine that uses a + * dictionary and heuristics to determine Lao-specific breaks.

+ * + *

After it is constructed a LaoBreakEngine may be shared between + * threads without synchronization.

+ */ +class LaoBreakEngine : public DictionaryBreakEngine { + private: + /** + * The set of characters handled by this engine + * @internal + */ + + UnicodeSet fLaoWordSet; + UnicodeSet fEndWordSet; + UnicodeSet fBeginWordSet; + UnicodeSet fMarkSet; + DictionaryMatcher *fDictionary; + + public: + + /** + *

Default constructor.

+ * + * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the + * engine is deleted. + */ + LaoBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status); + + /** + *

Virtual destructor.

+ */ + virtual ~LaoBreakEngine(); + + protected: + /** + *

Divide up a range of known dictionary characters handled by this break engine.

+ * + * @param text A UText representing the text + * @param rangeStart The start of the range of dictionary characters + * @param rangeEnd The end of the range of dictionary characters + * @param foundBreaks Output of C array of int32_t break positions, or 0 + * @return The number of breaks found + */ + virtual int32_t divideUpDictionaryRange( UText *text, + int32_t rangeStart, + int32_t rangeEnd, + UVector32 &foundBreaks ) const; + +}; + +/******************************************************************* + * BurmeseBreakEngine + */ + +/** + *

BurmeseBreakEngine is a kind of DictionaryBreakEngine that uses a + * DictionaryMatcher and heuristics to determine Burmese-specific breaks.

+ * + *

After it is constructed a BurmeseBreakEngine may be shared between + * threads without synchronization.

+ */ +class BurmeseBreakEngine : public DictionaryBreakEngine { + private: + /** + * The set of characters handled by this engine + * @internal + */ + + UnicodeSet fBurmeseWordSet; + UnicodeSet fEndWordSet; + UnicodeSet fBeginWordSet; + UnicodeSet fMarkSet; + DictionaryMatcher *fDictionary; + + public: + + /** + *

Default constructor.

+ * + * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the + * engine is deleted. + */ + BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status); + + /** + *

Virtual destructor.

+ */ + virtual ~BurmeseBreakEngine(); + + protected: + /** + *

Divide up a range of known dictionary characters.

+ * + * @param text A UText representing the text + * @param rangeStart The start of the range of dictionary characters + * @param rangeEnd The end of the range of dictionary characters + * @param foundBreaks Output of C array of int32_t break positions, or 0 + * @return The number of breaks found + */ + virtual int32_t divideUpDictionaryRange( UText *text, + int32_t rangeStart, + int32_t rangeEnd, + UVector32 &foundBreaks ) const; + +}; + +/******************************************************************* + * KhmerBreakEngine + */ + +/** + *

KhmerBreakEngine is a kind of DictionaryBreakEngine that uses a + * DictionaryMatcher and heuristics to determine Khmer-specific breaks.

+ * + *

After it is constructed a KhmerBreakEngine may be shared between + * threads without synchronization.

+ */ +class KhmerBreakEngine : public DictionaryBreakEngine { + private: + /** + * The set of characters handled by this engine + * @internal + */ + + UnicodeSet fKhmerWordSet; + UnicodeSet fEndWordSet; + UnicodeSet fBeginWordSet; + UnicodeSet fMarkSet; + DictionaryMatcher *fDictionary; + + public: + + /** + *

Default constructor.

+ * + * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the + * engine is deleted. + */ + KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status); + + /** + *

Virtual destructor.

+ */ + virtual ~KhmerBreakEngine(); + + protected: + /** + *

Divide up a range of known dictionary characters.

+ * + * @param text A UText representing the text + * @param rangeStart The start of the range of dictionary characters + * @param rangeEnd The end of the range of dictionary characters + * @param foundBreaks Output of C array of int32_t break positions, or 0 + * @return The number of breaks found + */ + virtual int32_t divideUpDictionaryRange( UText *text, + int32_t rangeStart, + int32_t rangeEnd, + UVector32 &foundBreaks ) const; + +}; + +#if !UCONFIG_NO_NORMALIZATION + +/******************************************************************* + * CjkBreakEngine + */ + +//indicates language/script that the CjkBreakEngine will handle +enum LanguageType { + kKorean, + kChineseJapanese +}; + +/** + *

CjkBreakEngine is a kind of DictionaryBreakEngine that uses a + * dictionary with costs associated with each word and + * Viterbi decoding to determine CJK-specific breaks.

+ */ +class CjkBreakEngine : public DictionaryBreakEngine { + protected: + /** + * The set of characters handled by this engine + * @internal + */ + UnicodeSet fHangulWordSet; + UnicodeSet fHanWordSet; + UnicodeSet fKatakanaWordSet; + UnicodeSet fHiraganaWordSet; + + DictionaryMatcher *fDictionary; + const Normalizer2 *nfkcNorm2; + + public: + + /** + *

Default constructor.

+ * + * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the + * engine is deleted. The DictionaryMatcher must contain costs for each word + * in order for the dictionary to work properly. + */ + CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType type, UErrorCode &status); + + /** + *

Virtual destructor.

+ */ + virtual ~CjkBreakEngine(); + + protected: + /** + *

Divide up a range of known dictionary characters handled by this break engine.

+ * + * @param text A UText representing the text + * @param rangeStart The start of the range of dictionary characters + * @param rangeEnd The end of the range of dictionary characters + * @param foundBreaks Output of C array of int32_t break positions, or 0 + * @return The number of breaks found + */ + virtual int32_t divideUpDictionaryRange( UText *text, + int32_t rangeStart, + int32_t rangeEnd, + UVector32 &foundBreaks ) const; + +}; + +#endif + +U_NAMESPACE_END + + /* DICTBE_H */ +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/dictionarydata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/dictionarydata.h new file mode 100644 index 0000000000000000000000000000000000000000..0d303d9a8dcfdbcb255c24465d7cd8c509140923 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/dictionarydata.h @@ -0,0 +1,191 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2014, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* dictionarydata.h +* +* created on: 2012may31 +* created by: Markus W. Scherer & Maxime Serrano +*/ + +#ifndef __DICTIONARYDATA_H__ +#define __DICTIONARYDATA_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/utext.h" +#include "unicode/udata.h" +#include "udataswp.h" +#include "unicode/uobject.h" +#include "unicode/ustringtrie.h" + +U_NAMESPACE_BEGIN + +class UCharsTrie; +class BytesTrie; + +class U_COMMON_API DictionaryData : public UMemory { +public: + static const int32_t TRIE_TYPE_BYTES; // = 0; + static const int32_t TRIE_TYPE_UCHARS; // = 1; + static const int32_t TRIE_TYPE_MASK; // = 7; + static const int32_t TRIE_HAS_VALUES; // = 8; + + static const int32_t TRANSFORM_NONE; // = 0; + static const int32_t TRANSFORM_TYPE_OFFSET; // = 0x1000000; + static const int32_t TRANSFORM_TYPE_MASK; // = 0x7f000000; + static const int32_t TRANSFORM_OFFSET_MASK; // = 0x1fffff; + + enum { + // Byte offsets from the start of the data, after the generic header. + IX_STRING_TRIE_OFFSET, + IX_RESERVED1_OFFSET, + IX_RESERVED2_OFFSET, + IX_TOTAL_SIZE, + + // Trie type: TRIE_HAS_VALUES | TRIE_TYPE_BYTES etc. + IX_TRIE_TYPE, + // Transform specification: TRANSFORM_TYPE_OFFSET | 0xe00 etc. + IX_TRANSFORM, + + IX_RESERVED6, + IX_RESERVED7, + IX_COUNT + }; +}; + +/** + * Wrapper class around generic dictionaries, implementing matches(). + * getType() should return a TRIE_TYPE_??? constant from DictionaryData. + * + * All implementations of this interface must be thread-safe if they are to be used inside of the + * dictionary-based break iteration code. + */ +class U_COMMON_API DictionaryMatcher : public UMemory { +public: + DictionaryMatcher() {} + virtual ~DictionaryMatcher(); + // this should emulate CompactTrieDictionary::matches() + /* @param text The text in which to look for matching words. Matching begins + * at the current position of the UText. + * @param maxLength The max length of match to consider. Units are the native indexing + * units of the UText. + * @param limit Capacity of output arrays, which is also the maximum number of + * matching words to be found. + * @param lengths output array, filled with the lengths of the matches, in order, + * from shortest to longest. Lengths are in native indexing units + * of the UText. May be NULL. + * @param cpLengths output array, filled with the lengths of the matches, in order, + * from shortest to longest. Lengths are the number of Unicode code points. + * May be NULL. + * @param values Output array, filled with the values associated with the words found. + * May be NULL. + * @param prefix Output parameter, the code point length of the prefix match, even if that + * prefix didn't lead to a complete word. Will always be >= the cpLength + * of the longest complete word matched. May be NULL. + * @return Number of matching words found. + */ + virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit, + int32_t *lengths, int32_t *cpLengths, int32_t *values, + int32_t *prefix) const = 0; + + /** @return DictionaryData::TRIE_TYPE_XYZ */ + virtual int32_t getType() const = 0; +}; + +// Implementation of the DictionaryMatcher interface for a UCharsTrie dictionary +class U_COMMON_API UCharsDictionaryMatcher : public DictionaryMatcher { +public: + // constructs a new UCharsDictionaryMatcher. + // The UDataMemory * will be closed on this object's destruction. + UCharsDictionaryMatcher(const UChar *c, UDataMemory *f) : characters(c), file(f) { } + virtual ~UCharsDictionaryMatcher(); + virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit, + int32_t *lengths, int32_t *cpLengths, int32_t *values, + int32_t *prefix) const; + virtual int32_t getType() const; +private: + const UChar *characters; + UDataMemory *file; +}; + +// Implementation of the DictionaryMatcher interface for a BytesTrie dictionary +class U_COMMON_API BytesDictionaryMatcher : public DictionaryMatcher { +public: + // constructs a new BytesTrieDictionaryMatcher + // the transform constant should be the constant read from the file, not a masked version! + // the UDataMemory * fed in here will be closed on this object's destruction + BytesDictionaryMatcher(const char *c, int32_t t, UDataMemory *f) + : characters(c), transformConstant(t), file(f) { } + virtual ~BytesDictionaryMatcher(); + virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit, + int32_t *lengths, int32_t *cpLengths, int32_t *values, + int32_t *prefix) const; + virtual int32_t getType() const; +private: + UChar32 transform(UChar32 c) const; + + const char *characters; + int32_t transformConstant; + UDataMemory *file; +}; + +U_NAMESPACE_END + +U_CAPI int32_t U_EXPORT2 +udict_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode); + +/** + * Format of dictionary .dict data files. + * Format version 1.0. + * + * A dictionary .dict data file contains a byte-serialized BytesTrie or + * a UChars-serialized UCharsTrie. + * Such files are used in dictionary-based break iteration (DBBI). + * + * For a BytesTrie, a transformation type is specified for + * transforming Unicode strings into byte sequences. + * + * A .dict file begins with a standard ICU data file header + * (DataHeader, see ucmndata.h and unicode/udata.h). + * The UDataInfo.dataVersion field is currently unused (set to 0.0.0.0). + * + * After the header, the file contains the following parts. + * Constants are defined in the DictionaryData class. + * + * For the data structure of BytesTrie & UCharsTrie see + * http://site.icu-project.org/design/struct/tries + * and the bytestrie.h and ucharstrie.h header files. + * + * int32_t indexes[indexesLength]; -- indexesLength=indexes[IX_STRING_TRIE_OFFSET]/4; + * + * The first four indexes are byte offsets in ascending order. + * Each byte offset marks the start of the next part in the data file, + * and the end of the previous one. + * When two consecutive byte offsets are the same, then the corresponding part is empty. + * Byte offsets are offsets from after the header, + * that is, from the beginning of the indexes[]. + * Each part starts at an offset with proper alignment for its data. + * If necessary, the previous part may include padding bytes to achieve this alignment. + * + * trieType=indexes[IX_TRIE_TYPE] defines the trie type. + * transform=indexes[IX_TRANSFORM] defines the Unicode-to-bytes transformation. + * If the transformation type is TRANSFORM_TYPE_OFFSET, + * then the lower 21 bits contain the offset code point. + * Each code point c is mapped to byte b = (c - offset). + * Code points outside the range offset..(offset+0xff) cannot be mapped + * and do not occur in the dictionary. + * + * stringTrie; -- a serialized BytesTrie or UCharsTrie + * + * The dictionary maps strings to specific values (TRIE_HAS_VALUES bit set in trieType), + * or it maps all strings to 0 (TRIE_HAS_VALUES bit not set). + */ + +#endif /* !UCONFIG_NO_BREAK_ITERATION */ +#endif /* __DICTIONARYDATA_H__ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/hash.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/hash.h new file mode 100644 index 0000000000000000000000000000000000000000..b927ddb3c365af50474cb3bfbdcf389324af5d7b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/hash.h @@ -0,0 +1,267 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 1997-2014, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* Date Name Description +* 03/28/00 aliu Creation. +****************************************************************************** +*/ + +#ifndef HASH_H +#define HASH_H + +#include "unicode/unistr.h" +#include "unicode/uobject.h" +#include "cmemory.h" +#include "uhash.h" + +U_NAMESPACE_BEGIN + +/** + * Hashtable is a thin C++ wrapper around UHashtable, a general-purpose void* + * hashtable implemented in C. Hashtable is designed to be idiomatic and + * easy-to-use in C++. + * + * Hashtable is an INTERNAL CLASS. + */ +class U_COMMON_API Hashtable : public UMemory { + UHashtable* hash; + UHashtable hashObj; + + inline void init(UHashFunction *keyHash, UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status); + + inline void initSize(UHashFunction *keyHash, UKeyComparator *keyComp, UValueComparator *valueComp, int32_t size, UErrorCode& status); + +public: + /** + * Construct a hashtable + * @param ignoreKeyCase If true, keys are case insensitive. + * @param status Error code + */ + inline Hashtable(UBool ignoreKeyCase, UErrorCode& status); + + /** + * Construct a hashtable + * @param ignoreKeyCase If true, keys are case insensitive. + * @param size initial size allocation + * @param status Error code + */ + inline Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status); + + /** + * Construct a hashtable + * @param keyComp Comparator for comparing the keys + * @param valueComp Comparator for comparing the values + * @param status Error code + */ + inline Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status); + + /** + * Construct a hashtable + * @param status Error code + */ + inline Hashtable(UErrorCode& status); + + /** + * Construct a hashtable, _disregarding any error_. Use this constructor + * with caution. + */ + inline Hashtable(); + + /** + * Non-virtual destructor; make this virtual if Hashtable is subclassed + * in the future. + */ + inline ~Hashtable(); + + inline UObjectDeleter *setValueDeleter(UObjectDeleter *fn); + + inline int32_t count() const; + + inline void* put(const UnicodeString& key, void* value, UErrorCode& status); + + inline int32_t puti(const UnicodeString& key, int32_t value, UErrorCode& status); + + inline int32_t putiAllowZero(const UnicodeString& key, int32_t value, UErrorCode& status); + + inline void* get(const UnicodeString& key) const; + + inline int32_t geti(const UnicodeString& key) const; + + inline int32_t getiAndFound(const UnicodeString& key, UBool &found) const; + + inline void* remove(const UnicodeString& key); + + inline int32_t removei(const UnicodeString& key); + + inline void removeAll(void); + + inline UBool containsKey(const UnicodeString& key) const; + + inline const UHashElement* find(const UnicodeString& key) const; + + /** + * @param pos - must be UHASH_FIRST on first call, and untouched afterwards. + * @see uhash_nextElement + */ + inline const UHashElement* nextElement(int32_t& pos) const; + + inline UKeyComparator* setKeyComparator(UKeyComparator*keyComp); + + inline UValueComparator* setValueComparator(UValueComparator* valueComp); + + inline UBool equals(const Hashtable& that) const; +private: + Hashtable(const Hashtable &other); // forbid copying of this class + Hashtable &operator=(const Hashtable &other); // forbid copying of this class +}; + +/********************************************************************* + * Implementation + ********************************************************************/ + +inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp, + UValueComparator *valueComp, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + uhash_init(&hashObj, keyHash, keyComp, valueComp, &status); + if (U_SUCCESS(status)) { + hash = &hashObj; + uhash_setKeyDeleter(hash, uprv_deleteUObject); + } +} + +inline void Hashtable::initSize(UHashFunction *keyHash, UKeyComparator *keyComp, + UValueComparator *valueComp, int32_t size, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + uhash_initSize(&hashObj, keyHash, keyComp, valueComp, size, &status); + if (U_SUCCESS(status)) { + hash = &hashObj; + uhash_setKeyDeleter(hash, uprv_deleteUObject); + } +} + +inline Hashtable::Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, + UErrorCode& status) : hash(0) { + init( uhash_hashUnicodeString, keyComp, valueComp, status); +} + +inline Hashtable::Hashtable(UBool ignoreKeyCase, UErrorCode& status) + : hash(0) +{ + init(ignoreKeyCase ? uhash_hashCaselessUnicodeString + : uhash_hashUnicodeString, + ignoreKeyCase ? uhash_compareCaselessUnicodeString + : uhash_compareUnicodeString, + NULL, + status); +} + +inline Hashtable::Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status) + : hash(0) +{ + initSize(ignoreKeyCase ? uhash_hashCaselessUnicodeString + : uhash_hashUnicodeString, + ignoreKeyCase ? uhash_compareCaselessUnicodeString + : uhash_compareUnicodeString, + NULL, size, + status); +} + +inline Hashtable::Hashtable(UErrorCode& status) + : hash(0) +{ + init(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, status); +} + +inline Hashtable::Hashtable() + : hash(0) +{ + UErrorCode status = U_ZERO_ERROR; + init(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, status); +} + +inline Hashtable::~Hashtable() { + if (hash != NULL) { + uhash_close(hash); + } +} + +inline UObjectDeleter *Hashtable::setValueDeleter(UObjectDeleter *fn) { + return uhash_setValueDeleter(hash, fn); +} + +inline int32_t Hashtable::count() const { + return uhash_count(hash); +} + +inline void* Hashtable::put(const UnicodeString& key, void* value, UErrorCode& status) { + return uhash_put(hash, new UnicodeString(key), value, &status); +} + +inline int32_t Hashtable::puti(const UnicodeString& key, int32_t value, UErrorCode& status) { + return uhash_puti(hash, new UnicodeString(key), value, &status); +} + +inline int32_t Hashtable::putiAllowZero(const UnicodeString& key, int32_t value, + UErrorCode& status) { + return uhash_putiAllowZero(hash, new UnicodeString(key), value, &status); +} + +inline void* Hashtable::get(const UnicodeString& key) const { + return uhash_get(hash, &key); +} + +inline int32_t Hashtable::geti(const UnicodeString& key) const { + return uhash_geti(hash, &key); +} + +inline int32_t Hashtable::getiAndFound(const UnicodeString& key, UBool &found) const { + return uhash_getiAndFound(hash, &key, &found); +} + +inline void* Hashtable::remove(const UnicodeString& key) { + return uhash_remove(hash, &key); +} + +inline int32_t Hashtable::removei(const UnicodeString& key) { + return uhash_removei(hash, &key); +} + +inline UBool Hashtable::containsKey(const UnicodeString& key) const { + return uhash_containsKey(hash, &key); +} + +inline const UHashElement* Hashtable::find(const UnicodeString& key) const { + return uhash_find(hash, &key); +} + +inline const UHashElement* Hashtable::nextElement(int32_t& pos) const { + return uhash_nextElement(hash, &pos); +} + +inline void Hashtable::removeAll(void) { + uhash_removeAll(hash); +} + +inline UKeyComparator* Hashtable::setKeyComparator(UKeyComparator*keyComp){ + return uhash_setKeyComparator(hash, keyComp); +} + +inline UValueComparator* Hashtable::setValueComparator(UValueComparator* valueComp){ + return uhash_setValueComparator(hash, valueComp); +} + +inline UBool Hashtable::equals(const Hashtable& that)const{ + return uhash_equals(hash, that.hash); +} +U_NAMESPACE_END + +#endif + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/icuplugimp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/icuplugimp.h new file mode 100644 index 0000000000000000000000000000000000000000..9df309204e7a1d27ce85466c12f00fef9d1dca81 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/icuplugimp.h @@ -0,0 +1,93 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2009-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : icuplugimp.h +* +* Internal functions for the ICU plugin system +* +* Date Name Description +* 10/29/2009 sl New. +****************************************************************************** +*/ + + +#ifndef ICUPLUGIMP_H +#define ICUPLUGIMP_H + +#include "unicode/icuplug.h" + +#if UCONFIG_ENABLE_PLUGINS + +/*========================*/ +/** @{ Library Manipulation + */ + +/** + * Open a library, adding a reference count if needed. + * @param libName library name to load + * @param status error code + * @return the library pointer, or NULL + * @internal internal use only + */ +U_CAPI void * U_EXPORT2 +uplug_openLibrary(const char *libName, UErrorCode *status); + +/** + * Close a library, if its reference count is 0 + * @param lib the library to close + * @param status error code + * @internal internal use only + */ +U_CAPI void U_EXPORT2 +uplug_closeLibrary(void *lib, UErrorCode *status); + +/** + * Get a library's name, or NULL if not found. + * @param lib the library's name + * @param status error code + * @return the library name, or NULL if not found. + * @internal internal use only + */ +U_CAPI char * U_EXPORT2 +uplug_findLibrary(void *lib, UErrorCode *status); + +/** @} */ + +/*========================*/ +/** {@ ICU Plugin internal interfaces + */ + +/** + * Initialize the plugins + * @param status error result + * @internal - Internal use only. + */ +U_CAPI void U_EXPORT2 +uplug_init(UErrorCode *status); + +/** + * Get raw plug N + * @internal - Internal use only + */ +U_CAPI UPlugData* U_EXPORT2 +uplug_getPlugInternal(int32_t n); + +/** + * Get the name of the plugin file. + * @internal - Internal use only. + */ +U_CAPI const char* U_EXPORT2 +uplug_getPluginFile(void); + +/** @} */ + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/localeprioritylist.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/localeprioritylist.h new file mode 100644 index 0000000000000000000000000000000000000000..41e9d3ea081f5615f72de3d23e5123ce80a04990 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/localeprioritylist.h @@ -0,0 +1,115 @@ +// © 2019 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// localeprioritylist.h +// created: 2019jul11 Markus W. Scherer + +#ifndef __LOCALEPRIORITYLIST_H__ +#define __LOCALEPRIORITYLIST_H__ + +#include "unicode/utypes.h" +#include "unicode/locid.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" + +struct UHashtable; + +U_NAMESPACE_BEGIN + +struct LocaleAndWeightArray; + +/** + * Parses a list of locales from an accept-language string. + * We are a bit more lenient than the spec: + * We accept extra whitespace in more places, empty range fields, + * and any number of qvalue fraction digits. + * + * https://tools.ietf.org/html/rfc2616#section-14.4 + * 14.4 Accept-Language + * + * Accept-Language = "Accept-Language" ":" + * 1#( language-range [ ";" "q" "=" qvalue ] ) + * language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" ) + * + * Each language-range MAY be given an associated quality value which + * represents an estimate of the user's preference for the languages + * specified by that range. The quality value defaults to "q=1". For + * example, + * + * Accept-Language: da, en-gb;q=0.8, en;q=0.7 + * + * https://tools.ietf.org/html/rfc2616#section-3.9 + * 3.9 Quality Values + * + * HTTP content negotiation (section 12) uses short "floating point" + * numbers to indicate the relative importance ("weight") of various + * negotiable parameters. A weight is normalized to a real number in + * the range 0 through 1, where 0 is the minimum and 1 the maximum + * value. If a parameter has a quality value of 0, then content with + * this parameter is `not acceptable' for the client. HTTP/1.1 + * applications MUST NOT generate more than three digits after the + * decimal point. User configuration of these values SHOULD also be + * limited in this fashion. + * + * qvalue = ( "0" [ "." 0*3DIGIT ] ) + * | ( "1" [ "." 0*3("0") ] ) + */ +class U_COMMON_API LocalePriorityList : public UMemory { +public: + class Iterator : public Locale::Iterator { + public: + UBool hasNext() const override { return count < length; } + + const Locale &next() override { + for(;;) { + const Locale *locale = list.localeAt(index++); + if (locale != nullptr) { + ++count; + return *locale; + } + } + } + + private: + friend class LocalePriorityList; + + Iterator(const LocalePriorityList &list) : list(list), length(list.getLength()) {} + + const LocalePriorityList &list; + int32_t index = 0; + int32_t count = 0; + const int32_t length; + }; + + LocalePriorityList(StringPiece s, UErrorCode &errorCode); + + ~LocalePriorityList(); + + int32_t getLength() const { return listLength - numRemoved; } + + int32_t getLengthIncludingRemoved() const { return listLength; } + + Iterator iterator() const { return Iterator(*this); } + + const Locale *localeAt(int32_t i) const; + + Locale *orphanLocaleAt(int32_t i); + +private: + LocalePriorityList(const LocalePriorityList &) = delete; + LocalePriorityList &operator=(const LocalePriorityList &) = delete; + + bool add(const Locale &locale, int32_t weight, UErrorCode &errorCode); + + void sort(UErrorCode &errorCode); + + LocaleAndWeightArray *list = nullptr; + int32_t listLength = 0; + int32_t numRemoved = 0; + bool hasWeights = false; // other than 1.0 + UHashtable *map = nullptr; +}; + +U_NAMESPACE_END + +#endif // __LOCALEPRIORITYLIST_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/localsvc.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/localsvc.h new file mode 100644 index 0000000000000000000000000000000000000000..33640195135bd8ad2f03fb40db5e53b987b5e31a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/localsvc.h @@ -0,0 +1,27 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +*************************************************************************** +* Copyright (C) 2006 International Business Machines Corporation * +* and others. All rights reserved. * +*************************************************************************** +*/ + +#ifndef LOCALSVC_H +#define LOCALSVC_H + +#include "unicode/utypes.h" + +#if defined(U_LOCAL_SERVICE_HOOK) && U_LOCAL_SERVICE_HOOK +/** + * Prototype for user-supplied service hook. This function is expected to return + * a type of factory object specific to the requested service. + * + * @param what service-specific string identifying the specific user hook + * @param status error status + * @return a service-specific hook, or NULL on failure. + */ +U_CAPI void* uprv_svc_hook(const char *what, UErrorCode *status); +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locbased.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locbased.h new file mode 100644 index 0000000000000000000000000000000000000000..45738863b5ec96c6178143f9345a3571e56e303b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locbased.h @@ -0,0 +1,107 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2004-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: January 16 2004 +* Since: ICU 2.8 +********************************************************************** +*/ +#ifndef LOCBASED_H +#define LOCBASED_H + +#include "unicode/locid.h" +#include "unicode/uobject.h" + +/** + * Macro to declare a locale LocaleBased wrapper object for the given + * object, which must have two members named `validLocale' and + * `actualLocale' of size ULOC_FULLNAME_CAPACITY + */ +#define U_LOCALE_BASED(varname, objname) \ + LocaleBased varname((objname).validLocale, (objname).actualLocale) + +U_NAMESPACE_BEGIN + +/** + * A utility class that unifies the implementation of getLocale() by + * various ICU services. This class is likely to be removed in the + * ICU 3.0 time frame in favor of an integrated approach with the + * services framework. + * @since ICU 2.8 + */ +class U_COMMON_API LocaleBased : public UMemory { + + public: + + /** + * Construct a LocaleBased wrapper around the two pointers. These + * will be aliased for the lifetime of this object. + */ + inline LocaleBased(char* validAlias, char* actualAlias); + + /** + * Construct a LocaleBased wrapper around the two const pointers. + * These will be aliased for the lifetime of this object. + */ + inline LocaleBased(const char* validAlias, const char* actualAlias); + + /** + * Return locale meta-data for the service object wrapped by this + * object. Either the valid or the actual locale may be + * retrieved. + * @param type either ULOC_VALID_LOCALE or ULOC_ACTUAL_LOCALE + * @param status input-output error code + * @return the indicated locale + */ + Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; + + /** + * Return the locale ID for the service object wrapped by this + * object. Either the valid or the actual locale may be + * retrieved. + * @param type either ULOC_VALID_LOCALE or ULOC_ACTUAL_LOCALE + * @param status input-output error code + * @return the indicated locale ID + */ + const char* getLocaleID(ULocDataLocaleType type, UErrorCode& status) const; + + /** + * Set the locale meta-data for the service object wrapped by this + * object. If either parameter is zero, it is ignored. + * @param valid the ID of the valid locale + * @param actual the ID of the actual locale + */ + void setLocaleIDs(const char* valid, const char* actual); + + /** + * Set the locale meta-data for the service object wrapped by this + * object. + * @param valid the ID of the valid locale + * @param actual the ID of the actual locale + */ + void setLocaleIDs(const Locale& valid, const Locale& actual); + + private: + + char* valid; + + char* actual; +}; + +inline LocaleBased::LocaleBased(char* validAlias, char* actualAlias) : + valid(validAlias), actual(actualAlias) { +} + +inline LocaleBased::LocaleBased(const char* validAlias, + const char* actualAlias) : + // ugh: cast away const + valid((char*)validAlias), actual((char*)actualAlias) { +} + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locdistance.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locdistance.h new file mode 100644 index 0000000000000000000000000000000000000000..51b777e6272312ff75f99595bb7ebbbace8c7c5b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locdistance.h @@ -0,0 +1,151 @@ +// © 2019 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// locdistance.h +// created: 2019may08 Markus W. Scherer + +#ifndef __LOCDISTANCE_H__ +#define __LOCDISTANCE_H__ + +#include "unicode/utypes.h" +#include "unicode/bytestrie.h" +#include "unicode/localematcher.h" +#include "unicode/locid.h" +#include "unicode/uobject.h" +#include "lsr.h" + +U_NAMESPACE_BEGIN + +struct LocaleDistanceData; + +/** + * Offline-built data for LocaleMatcher. + * Mostly but not only the data for mapping locales to their maximized forms. + */ +class LocaleDistance final : public UMemory { +public: + static const LocaleDistance *getSingleton(UErrorCode &errorCode); + + static int32_t shiftDistance(int32_t distance) { + return distance << DISTANCE_SHIFT; + } + + static int32_t getShiftedDistance(int32_t indexAndDistance) { + return indexAndDistance & DISTANCE_MASK; + } + + static double getDistanceDouble(int32_t indexAndDistance) { + double shiftedDistance = getShiftedDistance(indexAndDistance); + return shiftedDistance / (1 << DISTANCE_SHIFT); + } + + static int32_t getDistanceFloor(int32_t indexAndDistance) { + return (indexAndDistance & DISTANCE_MASK) >> DISTANCE_SHIFT; + } + + static int32_t getIndex(int32_t indexAndDistance) { + // assert indexAndDistance >= 0; + return indexAndDistance >> INDEX_SHIFT; + } + + /** + * Finds the supported LSR with the smallest distance from the desired one. + * Equivalent LSR subtags must be normalized into a canonical form. + * + *

Returns the index of the lowest-distance supported LSR in the high bits + * (negative if none has a distance below the threshold), + * and its distance (0..ABOVE_THRESHOLD) in the low bits. + */ + int32_t getBestIndexAndDistance(const LSR &desired, + const LSR **supportedLSRs, int32_t supportedLSRsLength, + int32_t shiftedThreshold, + ULocMatchFavorSubtag favorSubtag, + ULocMatchDirection direction) const; + + UBool isParadigmLSR(const LSR &lsr) const; + + int32_t getDefaultScriptDistance() const { + return defaultScriptDistance; + } + + int32_t getDefaultDemotionPerDesiredLocale() const { + return defaultDemotionPerDesiredLocale; + } + +private: + // The distance is shifted left to gain some fraction bits. + static constexpr int32_t DISTANCE_SHIFT = 3; + static constexpr int32_t DISTANCE_FRACTION_MASK = 7; + // 7 bits for 0..100 + static constexpr int32_t DISTANCE_INT_SHIFT = 7; + static constexpr int32_t INDEX_SHIFT = DISTANCE_INT_SHIFT + DISTANCE_SHIFT; + static constexpr int32_t DISTANCE_MASK = 0x3ff; + // tic constexpr int32_t MAX_INDEX = 0x1fffff; // avoids sign bit + static constexpr int32_t INDEX_NEG_1 = 0xfffffc00; + + LocaleDistance(const LocaleDistanceData &data, const XLikelySubtags &likely); + LocaleDistance(const LocaleDistance &other) = delete; + LocaleDistance &operator=(const LocaleDistance &other) = delete; + + static void initLocaleDistance(UErrorCode &errorCode); + + UBool isMatch(const LSR &desired, const LSR &supported, + int32_t shiftedThreshold, ULocMatchFavorSubtag favorSubtag) const { + const LSR *pSupp = &supported; + return getBestIndexAndDistance( + desired, &pSupp, 1, + shiftedThreshold, favorSubtag, ULOCMATCH_DIRECTION_WITH_ONE_WAY) >= 0; + } + + static int32_t getDesSuppScriptDistance(BytesTrie &iter, uint64_t startState, + const char *desired, const char *supported); + + static int32_t getRegionPartitionsDistance( + BytesTrie &iter, uint64_t startState, + const char *desiredPartitions, const char *supportedPartitions, + int32_t threshold); + + static int32_t getFallbackRegionDistance(BytesTrie &iter, uint64_t startState); + + static int32_t trieNext(BytesTrie &iter, const char *s, bool wantValue); + + const char *partitionsForRegion(const LSR &lsr) const { + // ill-formed region -> one non-matching string + int32_t pIndex = regionToPartitionsIndex[lsr.regionIndex]; + return partitionArrays[pIndex]; + } + + int32_t getDefaultRegionDistance() const { + return defaultRegionDistance; + } + + const XLikelySubtags &likelySubtags; + + // The trie maps each dlang+slang+dscript+sscript+dregion+sregion + // (encoded in ASCII with bit 7 set on the last character of each subtag) to a distance. + // There is also a trie value for each subsequence of whole subtags. + // One '*' is used for a (desired, supported) pair of "und", "Zzzz"/"", or "ZZ"/"". + BytesTrie trie; + + /** + * Maps each region to zero or more single-character partitions. + */ + const uint8_t *regionToPartitionsIndex; + const char **partitionArrays; + + /** + * Used to get the paradigm region for a cluster, if there is one. + */ + const LSR *paradigmLSRs; + int32_t paradigmLSRsLength; + + int32_t defaultLanguageDistance; + int32_t defaultScriptDistance; + int32_t defaultRegionDistance; + int32_t minRegionDistance; + int32_t defaultDemotionPerDesiredLocale; +}; + +U_NAMESPACE_END + +#endif // __LOCDISTANCE_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/loclikelysubtags.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/loclikelysubtags.h new file mode 100644 index 0000000000000000000000000000000000000000..14a01a5eac7ebab829e82932514b06d273f1ce26 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/loclikelysubtags.h @@ -0,0 +1,121 @@ +// © 2019 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// loclikelysubtags.h +// created: 2019may08 Markus W. Scherer + +#ifndef __LOCLIKELYSUBTAGS_H__ +#define __LOCLIKELYSUBTAGS_H__ + +#include +#include "unicode/utypes.h" +#include "unicode/bytestrie.h" +#include "unicode/locid.h" +#include "unicode/uobject.h" +#include "unicode/ures.h" +#include "charstrmap.h" +#include "lsr.h" + +U_NAMESPACE_BEGIN + +struct XLikelySubtagsData; + +struct LocaleDistanceData { + LocaleDistanceData() = default; + LocaleDistanceData(LocaleDistanceData &&data); + ~LocaleDistanceData(); + + const uint8_t *distanceTrieBytes = nullptr; + const uint8_t *regionToPartitions = nullptr; + const char **partitions = nullptr; + const LSR *paradigms = nullptr; + int32_t paradigmsLength = 0; + const int32_t *distances = nullptr; + +private: + LocaleDistanceData &operator=(const LocaleDistanceData &) = delete; +}; + +// TODO(ICU-20777): Rename to just LikelySubtags. +class XLikelySubtags final : public UMemory { +public: + ~XLikelySubtags(); + + static constexpr int32_t SKIP_SCRIPT = 1; + + // VisibleForTesting + static const XLikelySubtags *getSingleton(UErrorCode &errorCode); + + // VisibleForTesting + LSR makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const; + + /** + * Tests whether lsr is "more likely" than other. + * For example, fr-Latn-FR is more likely than fr-Latn-CH because + * FR is the default region for fr-Latn. + * + * The likelyInfo caches lookup information between calls. + * The return value is an updated likelyInfo value, + * with bit 0 set if lsr is "more likely". + * The initial value of likelyInfo must be negative. + */ + int32_t compareLikely(const LSR &lsr, const LSR &other, int32_t likelyInfo) const; + + // TODO(ICU-20777): Switch Locale/uloc_ likely-subtags API from the old code + // in loclikely.cpp to this new code, including activating this + // minimizeSubtags() function. The LocaleMatcher does not minimize. +#if 0 + LSR minimizeSubtags(const char *languageIn, const char *scriptIn, const char *regionIn, + ULocale.Minimize fieldToFavor, UErrorCode &errorCode) const; +#endif + + // visible for LocaleDistance + const LocaleDistanceData &getDistanceData() const { return distanceData; } + +private: + XLikelySubtags(XLikelySubtagsData &data); + XLikelySubtags(const XLikelySubtags &other) = delete; + XLikelySubtags &operator=(const XLikelySubtags &other) = delete; + + static void initLikelySubtags(UErrorCode &errorCode); + + LSR makeMaximizedLsr(const char *language, const char *script, const char *region, + const char *variant, UErrorCode &errorCode) const; + + /** + * Raw access to addLikelySubtags. Input must be in canonical format, eg "en", not "eng" or "EN". + */ + LSR maximize(const char *language, const char *script, const char *region) const; + + int32_t getLikelyIndex(const char *language, const char *script) const; + + static int32_t trieNext(BytesTrie &iter, const char *s, int32_t i); + + UResourceBundle *langInfoBundle; + // We could store the strings by value, except that if there were few enough strings, + // moving the contents could copy it to a different array, + // invalidating the pointers stored in the maps. + CharString *strings; + CharStringMap languageAliases; + CharStringMap regionAliases; + + // The trie maps each lang+script+region (encoded in ASCII) to an index into lsrs. + // There is also a trie value for each intermediate lang and lang+script. + // '*' is used instead of "und", "Zzzz"/"" and "ZZ"/"". + BytesTrie trie; + uint64_t trieUndState; + uint64_t trieUndZzzzState; + int32_t defaultLsrIndex; + uint64_t trieFirstLetterStates[26]; + const LSR *lsrs; +#if U_DEBUG + int32_t lsrsLength; +#endif + + // distance/matcher data: see comment in XLikelySubtagsData::load() + LocaleDistanceData distanceData; +}; + +U_NAMESPACE_END + +#endif // __LOCLIKELYSUBTAGS_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locmap.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locmap.h new file mode 100644 index 0000000000000000000000000000000000000000..e669873a143bfd8a994295965fff73b43dd1511a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locmap.h @@ -0,0 +1,40 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1996-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* File locmap.h : Locale Mapping Classes +* +* +* Created by: Helena Shih +* +* Modification History: +* +* Date Name Description +* 3/11/97 aliu Added setId(). +* 4/20/99 Madhu Added T_convertToPosix() +* 09/18/00 george Removed the memory leaks. +* 08/23/01 george Convert to C +*============================================================================ +*/ + +#ifndef LOCMAP_H +#define LOCMAP_H + +#include "unicode/utypes.h" + +#define LANGUAGE_LCID(hostID) (uint16_t)(0x03FF & hostID) + +U_CAPI int32_t uprv_convertToPosix(uint32_t hostid, char* posixID, int32_t posixIDCapacity, UErrorCode* status); + +/* Don't call these functions directly. Use uloc_getLCID instead. */ +U_CAPI uint32_t uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status); // Leverage platform conversion if possible +U_CAPI uint32_t uprv_convertToLCID(const char* langID, const char* posixID, UErrorCode* status); + +#endif /* LOCMAP_H */ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locutil.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locutil.h new file mode 100644 index 0000000000000000000000000000000000000000..31bfffd7a5920f6fac09aaa0cb9d9d1553b301b6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/locutil.h @@ -0,0 +1,39 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/** + ******************************************************************************* + * Copyright (C) 2002-2005, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + * + ******************************************************************************* + */ +#ifndef LOCUTIL_H +#define LOCUTIL_H + +#include "unicode/utypes.h" +#include "hash.h" + +#if !UCONFIG_NO_SERVICE || !UCONFIG_NO_TRANSLITERATION + + +U_NAMESPACE_BEGIN + +// temporary utility functions, till I know where to find them +// in header so tests can also access them + +class U_COMMON_API LocaleUtility { +public: + static UnicodeString& canonicalLocaleString(const UnicodeString* id, UnicodeString& result); + static Locale& initLocaleFromName(const UnicodeString& id, Locale& result); + static UnicodeString& initNameFromLocale(const Locale& locale, UnicodeString& result); + static const Hashtable* getAvailableLocaleNames(const UnicodeString& bundleID); + static UBool isFallbackOf(const UnicodeString& root, const UnicodeString& child); +}; + +U_NAMESPACE_END + + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/lsr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/lsr.h new file mode 100644 index 0000000000000000000000000000000000000000..a33f855245335e5da563ea9e10dd9333db322c4f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/lsr.h @@ -0,0 +1,82 @@ +// © 2019 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// lsr.h +// created: 2019may08 Markus W. Scherer + +#ifndef __LSR_H__ +#define __LSR_H__ + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "cstring.h" + +U_NAMESPACE_BEGIN + +struct LSR final : public UMemory { + static constexpr int32_t REGION_INDEX_LIMIT = 1001 + 26 * 26; + + static constexpr int32_t EXPLICIT_LSR = 7; + static constexpr int32_t EXPLICIT_LANGUAGE = 4; + static constexpr int32_t EXPLICIT_SCRIPT = 2; + static constexpr int32_t EXPLICIT_REGION = 1; + static constexpr int32_t IMPLICIT_LSR = 0; + static constexpr int32_t DONT_CARE_FLAGS = 0; + + const char *language; + const char *script; + const char *region; + char *owned = nullptr; + /** Index for region, 0 if ill-formed. @see indexForRegion */ + int32_t regionIndex = 0; + int32_t flags = 0; + /** Only set for LSRs that will be used in a hash table. */ + int32_t hashCode = 0; + + LSR() : language("und"), script(""), region("") {} + + /** Constructor which aliases all subtag pointers. */ + LSR(const char *lang, const char *scr, const char *r, int32_t f) : + language(lang), script(scr), region(r), + regionIndex(indexForRegion(region)), flags(f) {} + /** + * Constructor which prepends the prefix to the language and script, + * copies those into owned memory, and aliases the region. + */ + LSR(char prefix, const char *lang, const char *scr, const char *r, int32_t f, + UErrorCode &errorCode); + LSR(LSR &&other) U_NOEXCEPT; + LSR(const LSR &other) = delete; + inline ~LSR() { + // Pure inline code for almost all instances. + if (owned != nullptr) { + deleteOwned(); + } + } + + LSR &operator=(LSR &&other) U_NOEXCEPT; + LSR &operator=(const LSR &other) = delete; + + /** + * Returns a positive index (>0) for a well-formed region code. + * Do not rely on a particular region->index mapping; it may change. + * Returns 0 for ill-formed strings. + */ + static int32_t indexForRegion(const char *region); + + UBool isEquivalentTo(const LSR &other) const; + UBool operator==(const LSR &other) const; + + inline UBool operator!=(const LSR &other) const { + return !operator==(other); + } + + LSR &setHashCode(); + +private: + void deleteOwned(); +}; + +U_NAMESPACE_END + +#endif // __LSR_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/messageimpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/messageimpl.h new file mode 100644 index 0000000000000000000000000000000000000000..a56479066bc0589218e59f73973e25699279e176 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/messageimpl.h @@ -0,0 +1,65 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2011, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: messageimpl.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2011apr04 +* created by: Markus W. Scherer +*/ + +#ifndef __MESSAGEIMPL_H__ +#define __MESSAGEIMPL_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/messagepattern.h" + +U_NAMESPACE_BEGIN + +/** + * Helper functions for use of MessagePattern. + * In Java, these are package-private methods in MessagePattern itself. + * In C++, they are declared here and implemented in messagepattern.cpp. + */ +class U_COMMON_API MessageImpl { +public: + /** + * @return true if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED + */ + static UBool jdkAposMode(const MessagePattern &msgPattern) { + return msgPattern.getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED; + } + + /** + * Appends the s[start, limit[ substring to sb, but with only half of the apostrophes + * according to JDK pattern behavior. + */ + static void appendReducedApostrophes(const UnicodeString &s, int32_t start, int32_t limit, + UnicodeString &sb); + + /** + * Appends the sub-message to the result string. + * Omits SKIP_SYNTAX and appends whole arguments using appendReducedApostrophes(). + */ + static UnicodeString &appendSubMessageWithoutSkipSyntax(const MessagePattern &msgPattern, + int32_t msgStart, + UnicodeString &result); + +private: + MessageImpl(); // no constructor: all static methods +}; + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_FORMATTING + +#endif // __MESSAGEIMPL_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/msvcres.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/msvcres.h new file mode 100644 index 0000000000000000000000000000000000000000..0cace85e7472d04188a1ac16951a714bcb825e3f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/msvcres.h @@ -0,0 +1,25 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +//{{NO_DEPENDENCIES}} +// Copyright (c) 2003-2010 International Business Machines +// Corporation and others. All Rights Reserved. +// +// Used by common.rc and other .rc files. +//Do not edit with Microsoft Developer Studio because it will modify this +//header the wrong way. This is here to prevent Visual Studio .NET from +//unnessarily building the resource files when it's not needed. +// + +/* +These are defined before unicode/uversion.h in order to prevent +STLPort's broken stddef.h from being used when rc.exe parses this file. +*/ +#define _STLP_OUTERMOST_HEADER_ID 0 +#define _STLP_WINCE 1 + +#include "unicode/uversion.h" + +#define ICU_WEBSITE "http://icu-project.org" +#define ICU_COMPANY "The ICU Project" +#define ICU_PRODUCT_PREFIX "ICU" +#define ICU_PRODUCT "International Components for Unicode" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/mutex.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/mutex.h new file mode 100644 index 0000000000000000000000000000000000000000..44b1f90ba04dd2f095756e3f6e41ed46244360ca --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/mutex.h @@ -0,0 +1,77 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +*/ +//---------------------------------------------------------------------------- +// File: mutex.h +// +// Lightweight C++ wrapper for umtx_ C mutex functions +// +// Author: Alan Liu 1/31/97 +// History: +// 06/04/97 helena Updated setImplementation as per feedback from 5/21 drop. +// 04/07/1999 srl refocused as a thin wrapper +// +//---------------------------------------------------------------------------- +#ifndef MUTEX_H +#define MUTEX_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "umutex.h" + +U_NAMESPACE_BEGIN + +/** + * Mutex is a helper class for convenient locking and unlocking of a UMutex. + * + * Creating a local scope Mutex will lock a UMutex, holding the lock until the Mutex + * goes out of scope. + * + * If no UMutex is specified, the ICU global mutex is implied. + * + * For example: + * + * static UMutex myMutex; + * + * void Function(int arg1, int arg2) + * { + * static Object* foo; // Shared read-write object + * Mutex mutex(&myMutex); // or no args for the global lock + * foo->Method(); + * // When 'mutex' goes out of scope and gets destroyed here, the lock is released + * } + * + * Note: Do NOT use the form 'Mutex mutex();' as that merely forward-declares a function + * returning a Mutex. This is a common mistake which silently slips through the + * compiler!! + */ + +class U_COMMON_API Mutex : public UMemory { +public: + Mutex(UMutex *mutex = nullptr) : fMutex(mutex) { + umtx_lock(fMutex); + } + ~Mutex() { + umtx_unlock(fMutex); + } + + Mutex(const Mutex &other) = delete; // forbid assigning of this class + Mutex &operator=(const Mutex &other) = delete; // forbid copying of this class + void *operator new(size_t s) = delete; // forbid heap allocation. Locals only. + +private: + UMutex *fMutex; +}; + + +U_NAMESPACE_END + +#endif //_MUTEX_ +//eof diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/norm2_nfc_data.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/norm2_nfc_data.h new file mode 100644 index 0000000000000000000000000000000000000000..455cc0c42850ae4b709943ae14ada7290dbec212 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/norm2_nfc_data.h @@ -0,0 +1,1149 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// Copyright (C) 1999-2016, International Business Machines +// Corporation and others. All Rights Reserved. +// +// file name: norm2_nfc_data.h +// +// machine-generated by: icu/source/tools/gennorm2/n2builder.cpp + + +#ifdef INCLUDED_FROM_NORMALIZER2_CPP + +static const UVersionInfo norm2_nfc_data_formatVersion={4,0,0,0}; +static const UVersionInfo norm2_nfc_data_dataVersion={0xd,0,0,0}; + +static const int32_t norm2_nfc_data_indexes[Normalizer2Impl::IX_COUNT]={ +0x50,0x4bac,0x8814,0x8914,0x8914,0x8914,0x8914,0x8914,0xc0,0x300,0xae2,0x29e0,0x3c66,0xfc00,0x1288,0x3b9c, +0x3c34,0x3c66,0x300,0 +}; + +static const uint16_t norm2_nfc_data_trieIndex[1746]={ +0,0x40,0x7b,0xbb,0xfb,0x13a,0x17a,0x1b2,0x1f2,0x226,0x254,0x226,0x294,0x2d4,0x313,0x353, +0x393,0x3d2,0x40f,0x44e,0x226,0x226,0x488,0x4c8,0x4f8,0x530,0x226,0x570,0x59f,0x5de,0x226,0x5f3, +0x631,0x65f,0x226,0x68c,0x6cc,0x709,0x729,0x768,0x7a7,0x7e4,0x803,0x840,0x729,0x879,0x8a7,0x8e6, +0x226,0x920,0x937,0x977,0x98e,0x9cd,0x226,0xa03,0xa23,0xa5e,0xa6a,0xaa5,0xacd,0xb0a,0xb4a,0xb84, +0xb9f,0x226,0xbda,0x226,0xc1a,0xc39,0xc6f,0xcac,0x226,0x226,0x226,0x226,0x226,0xccf,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xcfb,0x226,0x226,0xd30, +0x226,0x226,0xd4e,0x226,0xd78,0x226,0x226,0x226,0xdb4,0xdd4,0xe14,0xe53,0xe8e,0xece,0xf02,0xf2e, +0x808,0x226,0x226,0xf62,0x226,0x226,0x226,0xfa2,0xfe2,0x1022,0x1062,0x10a2,0x10e2,0x1122,0x1162,0x11a2, +0x11e2,0x226,0x226,0x1212,0x1243,0x226,0x1273,0x12a6,0x12e3,0x1322,0x1362,0x1398,0x13c6,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x13f1,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0xcbd,0x226,0x140e,0x226,0x144e,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x148e,0x14c8,0x1506,0x1546,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1585,0x15c3,0x15e3,0x226,0x226,0x226,0x226, +0x161d,0x226,0x226,0x1645,0x1677,0x16a5,0x80c,0x16b8,0x226,0x226,0x16c8,0x1708,0x226,0x226,0x226,0x1420, +0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750, +0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760, +0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754, +0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748, +0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758, +0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c, +0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c, +0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750, +0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760, +0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754, +0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x1794,0x226, +0x17d4,0x180f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x184f,0x188f,0x18cf,0x190f,0x194f,0x198f,0x19cf,0x1a0f,0x1a32,0x1a72,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1a92,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x655,0x664,0x67c,0x69b,0x6b0,0x6b0,0x6b0,0x6b4,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xbda,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x54f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x40c, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ac5,0x226,0x226,0x1ad5,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0xdc6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ae5,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x15d6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x1aef,0x54f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x7eb,0x226,0x226, +0x9ba,0x226,0x1aff,0x1b0c,0x1b18,0x226,0x226,0x226,0x226,0x414,0x226,0x1b23,0x1b33,0x226,0x226,0x226, +0x7e0,0x226,0x226,0x226,0x226,0x1b43,0x226,0x226,0x226,0x1b4e,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x1b55,0x226,0x226,0x226,0x226,0x1b60,0x1b6f,0x8f6,0x1b7d,0x412,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x1b8b,0x798,0x226,0x226,0x226,0x226,0x226,0x1b9b,0x1baa,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x8d6,0x1bb2,0x1bc2,0x226, +0x226,0x226,0x9ba,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bcc,0x226,0x226,0x226,0x226,0x226, +0x226,0x7e6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bc9, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bdc, +0x7e0,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x84d,0x226,0x226,0x226,0x7ed,0x7ea, +0x226,0x226,0x226,0x226,0x7e8,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x9ba,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xbd4,0x226,0x226,0x226, +0x226,0x7ea,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x1bec,0x226,0x226,0x226,0xefb,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x1bfc,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bfe, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x1c0d,0x1c1d,0x1c2b,0x1c38,0x226,0x1c44,0x1c52,0x1c62,0x226,0x226, +0x226,0x226,0xcea,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c72,0x1c7a, +0x1c88,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0xefb,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x4fc,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x1c98,0x226,0x226,0x226,0x226,0x226,0x226,0x1ca4,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x1cb4,0x1cc4,0x1cd4,0x1ce4,0x1cf4,0x1d04,0x1d14,0x1d24,0x1d34,0x1d44,0x1d54, +0x1d64,0x1d74,0x1d84,0x1d94,0x1da4,0x1db4,0x1dc4,0x1dd4,0x1de4,0x1df4,0x1e04,0x1e14,0x1e24,0x1e34,0x1e44,0x1e54, +0x1e64,0x1e74,0x1e84,0x1e94,0x1ea4,0x1eb4,0x1ec4,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x408,0x428,0xc4,0xc4,0xc4,0x448,0x457,0x46d,0x489,0x4a6,0x4c2, +0x4df,0x4fc,0x51b,0x538,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, +0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x552,0xc4,0x566,0xc4,0xc4,0xc4,0xc4, +0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, +0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x586,0xc4,0xc4,0xc4,0xc4,0xc4, +0xc4,0xc4,0xc4,0x591,0x5ae,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x5ce,0x5e2,0xc4,0xc4,0x5f5, +0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, +0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, +0x615,0x635 +}; + +static const uint16_t norm2_nfc_data_trieData[7892]={ +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,4,8,0xc,1, +1,0x10,0x50,0x5c,0x70,0x88,0xcc,0xd0,0xec,0x108,0x144,0x148,0x15c,0x174,0x180,0x1a4, +0x1e4,1,0x1ec,0x20c,0x228,0x244,0x290,0x298,0x2b0,0x2b8,0x2dc,1,1,1,1,1, +1,0x2f4,0x334,0x340,0x354,0x36c,0x3b0,0x3b4,0x3d0,0x3f0,0x428,0x430,0x444,0x45c,0x468,0x48c, +0x4cc,1,0x4d4,0x4f4,0x510,0x530,0x57c,0x584,0x5a0,0x5a8,0x5d0,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0x5e8,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0x128a,0x1290,0xae4,0x1296,0xafa, +0xb04,0x5f4,0xb0e,0x129c,0x12a2,0xb18,0x12a8,0x12ae,0x12b4,0x12ba,0xb2e,1,0x12c0,0x12c6,0x12cc,0xb38, +0xb4e,0xb60,1,0x5fc,0x12d2,0x12d8,0x12de,0xb6a,0x12e4,1,1,0x12ea,0x12f0,0xb80,0x12f6,0xb96, +0xba0,0x600,0xbaa,0x12fc,0x1302,0xbb4,0x1308,0x130e,0x1314,0x131a,0xbca,1,0x1320,0x1326,0x132c,0xbd4, +0xbea,0xbfc,1,0x608,0x1332,0x1338,0x133e,0xc06,0x1344,1,0x134a,0x1350,0x1356,0xc1c,0xc32,0x135d, +0x1363,0x1368,0x136e,0x1374,0x137a,0x1380,0x1386,0x138c,0x1392,0x1398,0x139e,1,1,0xc48,0xc56,0x13a4, +0x13aa,0x13b0,0x13b6,0x13bd,0x13c3,0x13c8,0x13ce,0x13d4,0x13da,0x13e0,0x13e6,0x13ec,0x13f2,0x13f9,0x13ff,0x1404, +0x140a,1,1,0x1410,0x1416,0x141c,0x1422,0x1428,0x142e,0x1435,0x143b,0x1440,1,1,1,0x1447, +0x144d,0x1453,0x1459,1,0x145e,0x1464,0x146b,0x1471,0x1476,0x147c,1,1,1,0x1482,0x1488,0x148f, +0x1495,0x149a,0x14a0,1,1,1,0xc64,0xc72,0x14a6,0x14ac,0x14b2,0x14b8,1,1,0x14be,0x14c4, +0x14cb,0x14d1,0x14d6,0x14dc,0xc80,0xc8a,0x14e2,0x14e8,0x14ef,0x14f5,0xc94,0xc9e,0x14fb,0x1501,0x1506,0x150c, +1,1,0xca8,0xcb2,0xcbc,0xcc6,0x1512,0x1518,0x151e,0x1524,0x152a,0x1530,0x1537,0x153d,0x1542,0x1548, +0x154e,0x1554,0x155a,0x1560,0x1566,0x156c,0x1572,0x1578,0x157e,0x60c,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,0xcd0,0xcea,1,1,1,1, +1,1,1,1,1,1,1,1,1,0xd04,0xd1e,1,1,1,1,1, +1,0x610,1,1,1,1,1,1,1,1,1,1,1,1,1,0x1584, +0x158a,0x1590,0x1596,0x159c,0x15a2,0x15a8,0x15ae,0x15b6,0x15c0,0x15ca,0x15d4,0x15de,0x15e8,0x15f2,0x15fc,1, +0x1606,0x1610,0x161a,0x1624,0x162d,0x1633,1,1,0x1638,0x163e,0x1644,0x164a,0xd38,0xd42,0x1653,0x165d, +0x1665,0x166b,0x1671,1,1,1,0x1676,0x167c,1,1,0x1682,0x1688,0x1690,0x169a,0x16a3,0x16a9, +0x16af,0x16b5,0x16ba,0x16c0,0x16c6,0x16cc,0x16d2,0x16d8,0x16de,0x16e4,0x16ea,0x16f0,0x16f6,0x16fc,0x1702,0x1708, +0x170e,0x1714,0x171a,0x1720,0x1726,0x172c,0x1732,0x1738,0x173e,0x1744,0x174a,0x1750,0x1756,0x175c,1,1, +0x1762,0x1768,1,1,1,1,1,1,0xd4c,0xd56,0xd60,0xd6a,0x1770,0x177a,0x1784,0x178e, +0xd74,0xd7e,0x1798,0x17a2,0x17aa,0x17b0,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0x614,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xffcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc,0xfdcc, +0xfdcc,0xffcc,0xffcc,0xfdcc,0xffcc,0xfdcc,0xffcc,0xfdcc,0xfdcc,0xffd0,0xffb8,0xffb8,0xffb8,0xffb8,0xffd0,0xfdb0, +0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xff94,0xff94,0xfdb8,0xfdb8,0xfdb8,0xfdb8,0xfd94,0xfd94,0xffb8,0xffb8,0xffb8, +0xffb8,0xfdb8,0xfdb8,0xffb8,0xfdb8,0xfdb8,0xffb8,0xffb8,0xfe02,0xfe02,0xfe02,0xfe02,0xfc02,0xffb8,0xffb8,0xffb8, +0xffb8,0xffcc,0xffcc,0xffcc,0x3c36,0x3c3c,0xfdcc,0x3c42,0x3c48,0xfde0,0xffcc,0xffb8,0xffb8,0xffb8,0xffcc,0xffcc, +0xffcc,0xffb8,0xffb8,1,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,0xffd0,0xffb8,0xffb8,0xffcc, +0xffd2,0xffd4,0xffd4,0xffd2,0xffd4,0xffd4,0xffd2,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,0x29e1,1,1,1,1,1,1,1, +1,1,0x29e5,1,1,1,1,1,0x17b7,0x17bd,0x29e9,0x17c3,0x17c9,0x17cf,1,0x17d5, +1,0x17db,0x17e1,0x17e9,0x618,1,1,1,0x634,1,0x644,1,0x658,1,1,1, +1,1,0x674,1,0x684,1,1,1,0x688,1,1,1,0x6a0,0x17f1,0x17f7,0xd88, +0x17fd,0xd92,0x1803,0x180b,0x6b4,1,1,1,0x6d4,1,0x6e4,1,0x6fc,1,1,1, +1,1,0x71c,1,0x72c,1,1,1,0x734,1,1,1,0x754,0xd9c,0xdae,0x1813, +0x1819,0xdc0,1,1,1,0x76c,0x181f,0x1825,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0x182b,0x1831,1,0x1837,1,1,0x774,0x183d,1,1,1,1,0x1843, +0x1849,0x184f,1,0x778,1,1,0x780,1,0x784,0x790,0x798,0x79c,0x1855,0x7ac,1,1, +1,0x7b0,1,1,1,1,0x7b4,1,1,1,0x7c4,1,1,1,0x7c8,1, +0x7cc,1,1,0x7d0,1,1,0x7d8,1,0x7dc,0x7e8,0x7f0,0x7f4,0x185b,0x804,1,1, +1,0x808,1,1,1,0x80c,1,1,1,0x81c,1,1,1,0x820,1,0x824, +1,1,0x1861,0x1867,1,0x186d,1,1,0x828,0x1873,1,1,1,1,0x1879,0x187f, +0x1885,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0x82c,0x830,0x188b,0x1891,1,1,1,1,1,1, +1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x1897, +0x189d,1,1,1,1,1,1,1,1,1,1,1,1,1,0x18a3,0x18a9, +0x18af,0x18b5,1,1,0x18bb,0x18c1,0x834,0x838,0x18c7,0x18cd,0x18d3,0x18d9,0x18df,0x18e5,1,1, +0x18eb,0x18f1,0x18f7,0x18fd,0x1903,0x1909,0x83c,0x840,0x190f,0x1915,0x191b,0x1921,0x1927,0x192d,0x1933,0x1939, +0x193f,0x1945,0x194b,0x1951,1,1,0x1957,0x195d,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc, +0xffcc,0xffcc,0xffbc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8, +0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffbc,0xffc8,0xffcc,0xfe14,0xfe16,0xfe18,0xfe1a,0xfe1c,0xfe1e,0xfe20,0xfe22, +0xfe24,0xfe26,0xfe26,0xfe28,0xfe2a,0xfe2c,1,0xfe2e,1,0xfe30,0xfe32,1,0xffcc,0xffb8,1,0xfe24, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xfe3c,0xfe3e,0xfe40,1,1,1,1,1,1,1,0x1962,0x1968,0x196f,0x1975,0x197b,0x844, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0x850,1,0x854,0xfe36,0xfe38,0xfe3a,0xfe3c,0xfe3e, +0xfe40,0xfe42,0xfe44,0xfdcc,0xfdcc,0xfdb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0xfe46,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0x1981,0x858,0x1987,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0x85c,0x198d,1,0x860,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,0xffcc, +0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,1,1,0xffcc,0xffcc,1,0xffb8,0xffcc,0xffcc,0xffb8,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0xfe48,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xffcc, +0xffb8,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffcc,0xffb8,0xffb8,0xffcc,0xffb8,0xffcc,0xffcc, +0xffb8,0xffcc,0xffb8,0xffcc,0xffb8,0xffcc,0xffb8,0xffcc,0xffcc,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,1,1,1,1,1,1,1,1,1, +0xffb8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xffb8,0xffb8,0xffb8,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xffb8, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffb8, +0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xfe36,0xfe38,0xfe3a,0xffcc, +0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0x864,0x1993,1,1,1,1,1,1,0x868,0x1999,1,0x86c, +0x199f,1,1,1,1,1,1,1,0xfc0e,1,1,1,1,1,1,1, +1,1,1,1,1,1,0xfe12,1,1,1,0xffcc,0xffb8,0xffcc,0xffcc,1,1, +1,0x29ec,0x29f2,0x29f8,0x29fe,0x2a04,0x2a0a,0x2a10,0x2a16,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0xfe0e,1,0xfc00,1,1,1,1,1,1,1,0x870, +1,1,1,0x19a5,0x19ab,0xfe12,1,1,1,1,1,1,1,1,1,0xfc00, +1,1,1,1,0x2a1c,0x2a22,1,0x2a28,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0xffcc,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,0x2a2e,1,1,0x2a34,1,1, +1,1,1,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1, +1,0xfe12,1,1,1,1,1,1,1,1,1,1,1,0x2a3a,0x2a40,0x2a46, +1,1,0x2a4c,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe0e, +1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0x878,0x19b1,1,1,0x19b7,0x19bd,0xfe12,1,1,1,1,1,1,1,1,0xfc00, +0xfc00,1,1,1,1,0x2a52,0x2a58,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0x884,1,0x19c3,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0xfc00,1,1,1,1,1,1,0x888,0x890,1,1, +0x19c9,0x19cf,0x19d5,0xfe12,1,1,1,1,1,1,1,1,1,0xfc00,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0x894,1,0x19db,1,1,1,1,0xfe12,1,1, +1,1,1,1,1,0xfea8,0xfcb6,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xfe0e,1,1,0x898,0x19e1,1,0xfc00,1,1,1,0x89c,0x19e7,0x19ed, +1,0xdca,0x19f5,1,0xfe12,1,1,1,1,1,1,1,0xfc00,0xfc00,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0xfe12,0xfe12,1,0xfc00,1,1,1, +1,1,1,0x8a8,0x8b0,1,1,0x19fd,0x1a03,0x1a09,0xfe12,1,1,1,1,1, +1,1,1,1,0xfc00,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,0xfc12,1,1, +1,1,0xfc00,1,1,1,1,1,1,1,1,1,0x8b4,0x1a0f,1,0xdd4, +0x1a17,0x1a1f,0xfc00,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0xfece,0xfece,0xfe12,1,1, +1,1,1,1,1,1,0xfed6,0xfed6,0xfed6,0xfed6,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xfeec,0xfeec,0xfe12,1,1,1,1,1,1,1,1,0xfef4,0xfef4,0xfef4, +0xfef4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xffb8,1,0xffb8,1,0xffb0,1,1,1,1,1,1,0x2a5f,1,1, +1,1,1,1,1,1,1,0x2a65,1,1,1,1,0x2a6b,1,1,1, +1,0x2a71,1,1,1,1,0x2a77,1,1,1,1,1,1,1,1,1, +1,1,1,0x2a7d,1,1,1,1,1,1,1,0xff02,0xff04,0x3c50,0xff08,0x3c58, +0x2a82,1,0x2a88,1,0xff04,0xff04,0xff04,0xff04,1,1,0xff04,0x3c60,0xffcc,0xffcc,0xfe12,1, +0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x2a8f,1,1, +1,1,1,1,1,1,1,0x2a95,1,1,1,1,0x2a9b,1,1,1, +1,0x2aa1,1,1,1,1,0x2aa7,1,1,1,1,1,1,1,1,1, +1,1,1,0x2aad,1,1,1,1,1,1,0xffb8,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0x8c0,0x1a25,1,1,1,1,1,1,1,0xfc00,1,1, +1,1,1,1,1,1,0xfe0e,1,0xfe12,0xfe12,1,1,1,1,1,1, +1,1,1,1,1,1,1,0xffb8,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00, +0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00, +0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,0xffcc,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0xffc8,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,0xffbc,0xffcc,0xffb8,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffb8,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,1,1,0xffb8,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc, +0xffcc,0xffb8,1,0xffb8,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0x8c4,0x1a2b,0x8c8,0x1a31,0x8cc,0x1a37,0x8d0,0x1a3d,0x8d4,0x1a43,1,1,0x8d8, +0x1a49,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xfe0e,0xfc00,1,1,1,1,0x8dc,0x1a4f,0x8e0,0x1a55,0x8e4,0x8e8,0x1a5b,0x1a61, +0x8ec,0x1a67,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,0xfe12,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0xfe0e,1,1,1,1,1,1,1,1,1,1,1, +0xfe12,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xffcc,0xffcc,0xffcc,1,0xfe02,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8, +0xffb8,0xffb8,0xffcc,1,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,1,1,1,1,0xffb8, +1,1,1,1,1,1,0xffcc,1,1,1,0xffcc,0xffcc,1,1,1,1, +1,1,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffd4, +0xffac,0xffb8,0xff94,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffd0,0xffc8,0xffc8,0xffb8,1,0xffcc,0xffd2,0xffb8, +0xffcc,0xffb8,0x1a6c,0x1a72,0x1a78,0x1a7e,0x1a85,0x1a8b,0x1a91,0x1a97,0x1a9f,0x1aa9,0x1ab0,0x1ab6,0x1abc,0x1ac2, +0x1ac8,0x1ace,0x1ad5,0x1adb,0x1ae0,0x1ae6,0x1aee,0x1af8,0x1b02,0x1b0c,0x1b14,0x1b1a,0x1b20,0x1b26,0x1b2f,0x1b39, +0x1b41,0x1b47,0x1b4c,0x1b52,0x1b58,0x1b5e,0x1b64,0x1b6a,0x1b70,0x1b76,0x1b7d,0x1b83,0x1b88,0x1b8e,0x1b94,0x1b9a, +0x1ba2,0x1bac,0x1bb4,0x1bba,0x1bc0,0x1bc6,0x1bcc,0x1bd2,0xdde,0xde8,0x1bda,0x1be4,0x1bec,0x1bf2,0x1bf8,0x1bfe, +0x1c04,0x1c0a,0x1c10,0x1c16,0x1c1d,0x1c23,0x1c28,0x1c2e,0x1c34,0x1c3a,0x1c40,0x1c46,0x1c4c,0x1c52,0x1c5a,0x1c64, +0x1c6e,0x1c78,0x1c82,0x1c8c,0x1c96,0x1ca0,0x1ca9,0x1caf,0x1cb5,0x1cbb,0x1cc0,0x1cc6,0xdf2,0xdfc,0x1cce,0x1cd8, +0x1ce0,0x1ce6,0x1cec,0x1cf2,0xe06,0xe10,0x1cfa,0x1d04,0x1d0e,0x1d18,0x1d22,0x1d2c,0x1d34,0x1d3a,0x1d40,0x1d46, +0x1d4c,0x1d52,0x1d58,0x1d5e,0x1d64,0x1d6a,0x1d70,0x1d76,0x1d7c,0x1d82,0x1d8a,0x1d94,0x1d9e,0x1da8,0x1db0,0x1db6, +0x1dbd,0x1dc3,0x1dc8,0x1dce,0x1dd4,0x1dda,0x1de0,0x1de6,0x1dec,0x1df2,0x1df9,0x1dff,0x1e05,0x1e0b,0x1e11,0x1e17, +0x1e1c,0x1e22,0x1e28,0x1e2e,0x1e35,0x1e3b,0x1e41,0x1e47,0x1e4c,0x1e52,0x1e58,0x1e5e,1,0x1e65,1,1, +1,1,0xe1a,0xe28,0x1e6a,0x1e70,0x1e78,0x1e82,0x1e8c,0x1e96,0x1ea0,0x1eaa,0x1eb4,0x1ebe,0x1ec8,0x1ed2, +0x1edc,0x1ee6,0x1ef0,0x1efa,0x1f04,0x1f0e,0x1f18,0x1f22,0x1f2c,0x1f36,0xe36,0xe40,0x1f3e,0x1f44,0x1f4a,0x1f50, +0x1f58,0x1f62,0x1f6c,0x1f76,0x1f80,0x1f8a,0x1f94,0x1f9e,0x1fa8,0x1fb2,0x1fba,0x1fc0,0x1fc6,0x1fcc,0xe4a,0xe54, +0x1fd2,0x1fd8,0x1fe0,0x1fea,0x1ff4,0x1ffe,0x2008,0x2012,0x201c,0x2026,0x2030,0x203a,0x2044,0x204e,0x2058,0x2062, +0x206c,0x2076,0x2080,0x208a,0x2094,0x209e,0x20a6,0x20ac,0x20b2,0x20b8,0x20c0,0x20ca,0x20d4,0x20de,0x20e8,0x20f2, +0x20fc,0x2106,0x2110,0x211a,0x2122,0x2128,0x212f,0x2135,0x213a,0x2140,0x2146,0x214c,1,1,1,1, +1,1,0xe5e,0xe74,0xe8c,0xe9a,0xea8,0xeb6,0xec4,0xed2,0xede,0xef4,0xf0c,0xf1a,0xf28,0xf36, +0xf44,0xf52,0xf5e,0xf6c,0x2155,0x215f,0x2169,0x2173,1,1,0xf7a,0xf88,0x217d,0x2187,0x2191,0x219b, +1,1,0xf96,0xfac,0xfc4,0xfd2,0xfe0,0xfee,0xffc,0x100a,0x1016,0x102c,0x1044,0x1052,0x1060,0x106e, +0x107c,0x108a,0x1096,0x10a8,0x21a5,0x21af,0x21b9,0x21c3,0x21cd,0x21d7,0x10ba,0x10cc,0x21e1,0x21eb,0x21f5,0x21ff, +0x2209,0x2213,0x10de,0x10ec,0x221d,0x2227,0x2231,0x223b,1,1,0x10fa,0x1108,0x2245,0x224f,0x2259,0x2263, +1,1,0x1116,0x1128,0x226d,0x2277,0x2281,0x228b,0x2295,0x229f,1,0x113a,1,0x22a9,1,0x22b3, +1,0x22bd,0x114c,0x1162,0x117a,0x1188,0x1196,0x11a4,0x11b2,0x11c0,0x11cc,0x11e2,0x11fa,0x1208,0x1216,0x1224, +0x1232,0x1240,0x124c,0x3b9e,0x22c5,0x3ba6,0x1256,0x3bae,0x22cb,0x3bb6,0x22d1,0x3bbe,0x22d7,0x3bc6,0x1260,0x3bce, +1,1,0x22de,0x22e8,0x22f7,0x2307,0x2317,0x2327,0x2337,0x2347,0x2352,0x235c,0x236b,0x237b,0x238b,0x239b, +0x23ab,0x23bb,0x23c6,0x23d0,0x23df,0x23ef,0x23ff,0x240f,0x241f,0x242f,0x243a,0x2444,0x2453,0x2463,0x2473,0x2483, +0x2493,0x24a3,0x24ae,0x24b8,0x24c7,0x24d7,0x24e7,0x24f7,0x2507,0x2517,0x2522,0x252c,0x253b,0x254b,0x255b,0x256b, +0x257b,0x258b,0x2595,0x259b,0x25a3,0x25aa,0x25b3,1,0x126a,0x25bd,0x25c5,0x25cb,0x25d1,0x3bd6,0x25d6,1, +0x2ab2,0x8f0,1,0x25dd,0x25e5,0x25ec,0x25f5,1,0x1274,0x25ff,0x2607,0x3bde,0x260d,0x3be6,0x2612,0x2619, +0x261f,0x2625,0x262b,0x2631,0x2639,0x3bf0,1,1,0x2641,0x2649,0x2651,0x2657,0x265d,0x3bfa,1,0x2663, +0x2669,0x266f,0x2675,0x267b,0x2683,0x3c04,0x268b,0x2691,0x2697,0x269f,0x26a7,0x26ad,0x26b3,0x3c0e,0x26b9,0x26bf, +0x3c16,0x2ab7,1,1,0x26c7,0x26ce,0x26d7,1,0x127e,0x26e1,0x26e9,0x3c1e,0x26ef,0x3c26,0x26f4,0x2abb, +0x8fc,1,0xfa09,0xfa09,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xffcc,0xffcc,0xfe02,0xfe02,0xffcc,0xffcc,0xffcc,0xffcc,0xfe02,0xfe02,0xfe02,0xffcc,0xffcc,1, +1,1,1,0xffcc,1,1,1,0xfe02,0xfe02,0xffcc,0xffb8,0xffcc,0xfe02,0xfe02,0xffb8,0xffb8, +0xffb8,0xffb8,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0x2abe,1,1,1,0x2ac2,0x3c2e,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0x908,1,0x90c,1,0x910,1,1,1,1,1,0x26fb,0x2701,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,0x2707,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0x270d,0x2713,0x2719,0x914,1,0x918,1,0x91c,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0x920,0x271f,1,1,1,0x924,0x2725,1,0x928,0x272b, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0x92c,0x2731,0x930,0x2737,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x934, +1,1,1,0x273d,1,0x938,0x2743,0x93c,1,0x2749,0x940,0x274f,1,1,1,0x944, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0x2755,0x948,0x275b,1,0x94c,0x950,1,1,1,1,1,1,1,0x2761, +0x2767,0x276d,0x2773,0x2779,0x954,0x958,0x277f,0x2785,0x95c,0x960,0x278b,0x2791,0x964,0x968,0x96c,0x970, +1,1,0x2797,0x279d,0x974,0x978,0x27a3,0x27a9,0x97c,0x980,0x27af,0x27b5,1,1,1,1, +1,1,1,0x984,0x988,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0x98c,1,1,1,1,1,0x990,0x994,1,0x998,0x27bb,0x27c1, +0x27c7,0x27cd,1,1,0x99c,0x9a0,0x9a4,0x9a8,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0x27d3,0x27d9,0x27df,0x27e5,1,1,1,1, +1,1,0x27eb,0x27f1,0x27f7,0x27fd,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x2ac7, +0x2acb,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,0x2acf,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xffb4,0xffc8,0xffd0,0xffbc,0xffc0,0xffc0,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x9ac,1, +1,1,1,0x9b0,0x2803,0x9b4,0x2809,0x9b8,0x280f,0x9bc,0x2815,0x9c0,0x281b,0x9c4,0x2821,0x9c8, +0x2827,0x9cc,0x282d,0x9d0,0x2833,0x9d4,0x2839,0x9d8,0x283f,0x9dc,0x2845,1,0x9e0,0x284b,0x9e4,0x2851, +0x9e8,0x2857,1,1,1,1,1,0x9ec,0x285d,0x2863,0x9f4,0x2869,0x286f,0x9fc,0x2875,0x287b, +0xa04,0x2881,0x2887,0xa0c,0x288d,0x2893,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,0x2899,1,1,1,1,0xfc10, +0xfc10,1,1,0xa14,0x289f,1,1,1,1,1,1,1,0xa18,1,1,1, +1,0xa1c,0x28a5,0xa20,0x28ab,0xa24,0x28b1,0xa28,0x28b7,0xa2c,0x28bd,0xa30,0x28c3,0xa34,0x28c9,0xa38, +0x28cf,0xa3c,0x28d5,0xa40,0x28db,0xa44,0x28e1,0xa48,0x28e7,1,0xa4c,0x28ed,0xa50,0x28f3,0xa54,0x28f9, +1,1,1,1,1,0xa58,0x28ff,0x2905,0xa60,0x290b,0x2911,0xa68,0x2917,0x291d,0xa70,0x2923, +0x2929,0xa78,0x292f,0x2935,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0xa80,0xa84,0xa88,0xa8c,1,0x293b,1,1,0x2941,0x2947,0x294d, +0x2953,1,1,0xa90,0x2959,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0xffcc,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0xfe12,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xffb8,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xfe12,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xffcc,1,0xffcc,0xffcc,0xffb8,1,1,0xffcc, +0xffcc,1,1,1,1,1,0xffcc,0xffcc,1,0xffcc,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,1, +1,1,1,1,1,1,1,1,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, +0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, +0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, +0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, +0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, +0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289,0x1289, +0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, +0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0x3c66,1,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x3c66,0x3c66, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0x3c66,1,1,1,1,0x3c66,1,1,1,0x3c66,1,0x3c66,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,0x3b97,1,0x2ad5, +0x2ad9,0x2add,0x2ae1,0x2ae5,0x2ae9,0x2aed,0x2af1,0x2af1,0x2af5,0x2af9,0x2afd,0x2b01,0x2b05,0x2b09,0x2b0d,0x2b11, +0x2b15,0x2b19,0x2b1d,0x2b21,0x2b25,0x2b29,0x2b2d,0x2b31,0x2b35,0x2b39,0x2b3d,0x2b41,0x2b45,0x2b49,0x2b4d,0x2b51, +0x2b55,0x2b59,0x2b5d,0x2b61,0x2b65,0x2b69,0x2b6d,0x2b71,0x2b75,0x2b79,0x2b7d,0x2b81,0x2b85,0x2b89,0x2b8d,0x2b91, +0x2b95,0x2b99,0x2b9d,0x2ba1,0x2ba5,0x2ba9,0x2bad,0x2bb1,0x2bb5,0x2bb9,0x2bbd,0x2bc1,0x2bc5,0x2bc9,0x2bcd,0x2bd1, +0x2bd5,0x2bd9,0x2bdd,0x2be1,0x2be5,0x2be9,0x2bed,0x2bf1,0x2bf5,0x2bf9,0x2bfd,0x2c01,0x2c05,0x2c09,0x2c0d,0x2c11, +0x2c15,0x2c19,0x2c1d,0x2c21,0x2c25,0x2c29,0x2c2d,0x2c31,0x2c35,0x2c39,0x2c3d,0x2b21,0x2c41,0x2c45,0x2c49,0x2c4d, +0x2c51,0x2c55,0x2c59,0x2c5d,0x2c61,0x2c65,0x2c69,0x2c6d,0x2c71,0x2c75,0x2c79,0x2c7d,0x2c81,0x2c85,0x2c89,0x2c8d, +0x2c91,0x2c95,0x2c99,0x2c9d,0x2ca1,0x2ca5,0x2ca9,0x2cad,0x2cb1,0x2cb5,0x2cb9,0x2cbd,0x2cc1,0x2cc5,0x2cc9,0x2ccd, +0x2cd1,0x2cd5,0x2cd9,0x2cdd,0x2ce1,0x2ce5,0x2ce9,0x2ced,0x2cf1,0x2cf5,0x2cf9,0x2cfd,0x2d01,0x2d05,0x2d09,0x2d0d, +0x2d11,0x2d15,0x2d19,0x2d1d,0x2d21,0x2d25,0x2d29,0x2d2d,0x2d31,0x2d35,0x2d39,0x2d3d,0x2d41,0x2d45,0x2d49,0x2d4d, +0x2c89,0x2d51,0x2d55,0x2d59,0x2d5d,0x2d61,0x2d65,0x2d69,0x2d6d,0x2c49,0x2d71,0x2d75,0x2d79,0x2d7d,0x2d81,0x2d85, +0x2d89,0x2d8d,0x2d91,0x2d95,0x2d99,0x2d9d,0x2da1,0x2da5,0x2da9,0x2dad,0x2db1,0x2db5,0x2db9,0x2dbd,0x2b21,0x2dc1, +0x2dc5,0x2dc9,0x2dcd,0x2dd1,0x2dd5,0x2dd9,0x2ddd,0x2de1,0x2de5,0x2de9,0x2ded,0x2df1,0x2df5,0x2df9,0x2dfd,0x2e01, +0x2e05,0x2e09,0x2e0d,0x2e11,0x2e15,0x2e19,0x2e1d,0x2e21,0x2e25,0x2e29,0x2c51,0x2e2d,0x2e31,0x2e35,0x2e39,0x2e3d, +0x2e41,0x2e45,0x2e49,0x2e4d,0x2e51,0x2e55,0x2e59,0x2e5d,0x2e61,0x2e65,0x2e69,0x2e6d,0x2e71,0x2e75,0x2e79,0x2e7d, +0x2e81,0x2e85,0x2e89,0x2e8d,0x2e91,0x2e95,0x2e99,0x2e9d,0x2ea1,0x2ea5,0x2ea9,0x2ead,0x2eb1,0x2eb5,0x2eb9,0x2ebd, +0x2ec1,0x2ec5,0x2ec9,0x2ecd,0x2ed1,0x2ed5,0x2ed9,0x2edd,0x2ee1,0x2ee5,0x2ee9,0x2eed,0x2ef1,1,1,0x2ef5, +1,0x2ef9,1,1,0x2efd,0x2f01,0x2f05,0x2f09,0x2f0d,0x2f11,0x2f15,0x2f19,0x2f1d,0x2f21,1,0x2f25, +1,0x2f29,1,1,0x2f2d,0x2f31,1,1,1,0x2f35,0x2f39,0x2f3d,0x2f41,0x2f45,0x2f49,0x2f4d, +0x2f51,0x2f55,0x2f59,0x2f5d,0x2f61,0x2f65,0x2f69,0x2f6d,0x2f71,0x2f75,0x2f79,0x2f7d,0x2f81,0x2f85,0x2f89,0x2f8d, +0x2f91,0x2f95,0x2f99,0x2f9d,0x2fa1,0x2fa5,0x2fa9,0x2fad,0x2fb1,0x2fb5,0x2fb9,0x2fbd,0x2fc1,0x2fc5,0x2fc9,0x2fcd, +0x2fd1,0x2fd5,0x2fd9,0x2fdd,0x2fe1,0x2fe5,0x2d25,0x2fe9,0x2fed,0x2ff1,0x2ff5,0x2ff9,0x2ffd,0x2ffd,0x3001,0x3005, +0x3009,0x300d,0x3011,0x3015,0x3019,0x301d,0x2f2d,0x3021,0x3025,0x3029,0x302d,0x3031,0x3037,1,1,0x303b, +0x303f,0x3043,0x3047,0x304b,0x304f,0x3053,0x3057,0x2f65,0x305b,0x305f,0x3063,0x2ef5,0x3067,0x306b,0x306f,0x3073, +0x3077,0x307b,0x307f,0x3083,0x3087,0x308b,0x308f,0x3093,0x2f89,0x3097,0x2f8d,0x309b,0x309f,0x30a3,0x30a7,0x30ab, +0x2ef9,0x2b75,0x30af,0x30b3,0x30b7,0x2c8d,0x2de9,0x30bb,0x30bf,0x2fa9,0x30c3,0x2fad,0x30c7,0x30cb,0x30cf,0x2f01, +0x30d3,0x30d7,0x30db,0x30df,0x30e3,0x2f05,0x30e7,0x30eb,0x30ef,0x30f3,0x30f7,0x30fb,0x2fe5,0x30ff,0x3103,0x2d25, +0x3107,0x2ff5,0x310b,0x310f,0x3113,0x3117,0x311b,0x3009,0x311f,0x2f29,0x3123,0x300d,0x2c41,0x3127,0x3011,0x312b, +0x3019,0x312f,0x3133,0x3137,0x313b,0x313f,0x3021,0x2f19,0x3143,0x3025,0x3147,0x3029,0x314b,0x2af1,0x314f,0x3155, +0x315b,0x3161,0x3165,0x3169,0x316d,0x3173,0x3179,0x317f,0x3183,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x3186, +0xfe34,0x318c,1,1,1,1,1,1,1,1,1,1,0x3192,0x3198,0x31a0,0x31aa, +0x31b2,0x31b8,0x31be,0x31c4,0x31ca,0x31d0,0x31d6,0x31dc,0x31e2,1,0x31e8,0x31ee,0x31f4,0x31fa,0x3200,1, +0x3206,1,0x320c,0x3212,1,0x3218,0x321e,1,0x3224,0x322a,0x3230,0x3236,0x323c,0x3242,0x3248,0x324e, +0x3254,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8, +0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xffb8,1,0xffcc,1,1,1,1,1,1,1,1,0xffcc,0xfe02,0xffb8, +1,1,1,1,0xfe12,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1, +1,1,1,1,1,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffb8,0xffb8,0xffb8,1, +1,1,1,1,1,1,1,1,0xa94,0x295f,0xa9a,0x2969,1,1,1,1, +1,0xaa0,1,1,1,1,1,0x2973,1,1,1,1,1,1,1,1, +1,0xfe12,0xfc0e,1,1,1,1,1,1,1,0xfc00,1,1,1,1,1, +1,0x297d,0x2987,1,0xaa6,0xaac,0xfe12,0xfe12,1,1,1,1,1,1,1,1, +1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,0xfe0e,1,1, +1,1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,0xfe0e,0xfe12, +1,1,1,1,1,1,1,1,1,1,1,0xfe0e,0xfe0e,1,0xfc00,1, +1,1,1,1,1,1,0xab2,1,1,1,0x2991,0x299b,0xfe12,1,1,1, +1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,0xfe12,1,1, +1,0xfe0e,1,1,1,1,1,1,1,1,1,0xfc00,1,1,1,1, +1,1,1,1,0xabe,0xfc00,0x29a5,0x29af,0xfc00,0x29b9,1,1,0xfe12,0xfe0e,1,1, +1,1,1,1,1,1,1,1,1,1,0xad0,0xad6,0x29c3,0x29cd,1,1, +1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,0xfc00,1,1,1, +1,0xadc,1,1,0x29d7,1,1,1,1,0xfe12,0xfe12,1,0xfe02,0xfe02,0xfe02,0xfe02, +0xfe02,1,1,1,1,1,1,1,1,1,1,1,0xfe0c,0xfe0c,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0xfe02,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0x325a,0x3264,0x3278,0x3290,0x32a8, +0x32c0,0x32d8,0xffb0,0xffb0,0xfe02,0xfe02,0xfe02,1,1,1,0xffc4,0xffb0,0xffb0,0xffb0,1,1, +1,1,1,1,1,1,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,1,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc, +0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x32e6,0x32f0,0x3304, +0x331c,0x3334,0x334c,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,1,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,1,1,1,1,1,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1, +1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xfe0e,1, +1,1,1,1,0x335b,0x335f,0x3363,0x3367,0x336d,0x2f4d,0x3371,0x3375,0x3379,0x337d,0x2f51,0x3381, +0x3385,0x3389,0x2f55,0x338f,0x3393,0x3397,0x339b,0x33a1,0x33a5,0x33a9,0x33ad,0x33b3,0x33b7,0x33bb,0x33bf,0x303f, +0x33c3,0x33c9,0x33cd,0x33d1,0x33d5,0x33d9,0x33dd,0x33e1,0x33e5,0x3053,0x2f59,0x2f5d,0x3057,0x33e9,0x33ed,0x2c59, +0x33f1,0x2f61,0x33f5,0x33f9,0x33fd,0x3401,0x3401,0x3401,0x3405,0x340b,0x340f,0x3413,0x3417,0x341d,0x3421,0x3425, +0x3429,0x342d,0x3431,0x3435,0x3439,0x343d,0x3441,0x3445,0x3449,0x344d,0x344d,0x305f,0x3451,0x3455,0x3459,0x345d, +0x2f69,0x3461,0x3465,0x3469,0x2ebd,0x346d,0x3471,0x3475,0x3479,0x347d,0x3481,0x3485,0x3489,0x348d,0x3493,0x3497, +0x349b,0x349f,0x34a3,0x34a7,0x34ab,0x34b1,0x34b7,0x34bb,0x34bf,0x34c3,0x34c7,0x34cb,0x34cf,0x34d3,0x34d7,0x34d7, +0x34db,0x34e1,0x34e5,0x2c49,0x34e9,0x34ed,0x34f3,0x34f7,0x34fb,0x34ff,0x3503,0x3507,0x2f7d,0x350b,0x350f,0x3513, +0x3519,0x351d,0x3523,0x3527,0x352b,0x352f,0x3533,0x3537,0x353b,0x353f,0x3543,0x3547,0x354b,0x354f,0x3555,0x3559, +0x355d,0x3561,0x2b71,0x3565,0x356b,0x356f,0x356f,0x3575,0x3579,0x3579,0x357d,0x3581,0x3587,0x358d,0x3591,0x3595, +0x3599,0x359d,0x35a1,0x35a5,0x35a9,0x35ad,0x35b1,0x2f81,0x35b5,0x35bb,0x35bf,0x35c3,0x308f,0x35c3,0x35c7,0x2f89, +0x35cb,0x35cf,0x35d3,0x35d7,0x2f8d,0x2b05,0x35db,0x35df,0x35e3,0x35e7,0x35eb,0x35ef,0x35f3,0x35f9,0x35fd,0x3601, +0x3605,0x3609,0x360d,0x3613,0x3617,0x361b,0x361f,0x3623,0x3627,0x362b,0x362f,0x3633,0x2f91,0x3637,0x363b,0x3641, +0x3645,0x3649,0x364d,0x2f99,0x3651,0x3655,0x3659,0x365d,0x3661,0x3665,0x3669,0x366d,0x2b75,0x30af,0x3671,0x3675, +0x3679,0x367d,0x3683,0x3687,0x368b,0x368f,0x2f9d,0x3693,0x3699,0x369d,0x36a1,0x3161,0x36a5,0x36a9,0x36ad,0x36b1, +0x36b5,0x36bb,0x36bf,0x36c3,0x36c7,0x36cd,0x36d1,0x36d5,0x36d9,0x2c8d,0x36dd,0x36e1,0x36e7,0x36ed,0x36f3,0x36f7, +0x36fd,0x3701,0x3705,0x3709,0x370d,0x2fa1,0x2de9,0x3711,0x3715,0x3719,0x371d,0x3723,0x3727,0x372b,0x372f,0x30bf, +0x3733,0x3737,0x373d,0x3741,0x3745,0x374b,0x3751,0x3755,0x30c3,0x3759,0x375d,0x3761,0x3765,0x3769,0x376d,0x3771, +0x3777,0x377b,0x3781,0x3785,0x378b,0x30cb,0x378f,0x3793,0x3799,0x379d,0x37a1,0x37a7,0x37ad,0x37b1,0x37b5,0x37b9, +0x37bd,0x37bd,0x37c1,0x37c5,0x30d3,0x37c9,0x37cd,0x37d1,0x37d5,0x37d9,0x37df,0x37e3,0x2c55,0x37e9,0x37ef,0x37f3, +0x37f9,0x37ff,0x3805,0x3809,0x30eb,0x380d,0x3813,0x3819,0x381f,0x3825,0x3829,0x3829,0x30ef,0x3169,0x382d,0x3831, +0x3835,0x3839,0x383f,0x2bbd,0x30f7,0x3843,0x3847,0x2fcd,0x384d,0x3853,0x2f15,0x3859,0x385d,0x2fdd,0x3861,0x3865, +0x3869,0x386f,0x386f,0x3875,0x3879,0x387d,0x3883,0x3887,0x388b,0x388f,0x3895,0x3899,0x389d,0x38a1,0x38a5,0x38a9, +0x38af,0x38b3,0x38b7,0x38bb,0x38bf,0x38c3,0x38c7,0x38cd,0x38d3,0x38d7,0x38dd,0x38e1,0x38e7,0x38eb,0x2ff5,0x38ef, +0x38f5,0x38fb,0x38ff,0x3905,0x3909,0x390f,0x3913,0x3917,0x391b,0x391f,0x3923,0x3927,0x392d,0x3933,0x3939,0x3575, +0x393f,0x3943,0x3947,0x394b,0x394f,0x3953,0x3957,0x395b,0x395f,0x3963,0x3967,0x396b,0x2c9d,0x3971,0x3975,0x3979, +0x397d,0x3981,0x3985,0x3001,0x3989,0x398d,0x3991,0x3995,0x3999,0x399f,0x39a5,0x39ab,0x39af,0x39b3,0x39b7,0x39bb, +0x39c1,0x39c5,0x39cb,0x39cf,0x39d3,0x39d9,0x39df,0x39e3,0x2ba9,0x39e7,0x39eb,0x39ef,0x39f3,0x39f7,0x39fb,0x3113, +0x39ff,0x3a03,0x3a07,0x3a0b,0x3a0f,0x3a13,0x3a17,0x3a1b,0x3a1f,0x3a23,0x3a29,0x3a2d,0x3a31,0x3a35,0x3a39,0x3a3d, +0x3a43,0x3a49,0x3a4d,0x3a51,0x3127,0x312b,0x3a55,0x3a59,0x3a5f,0x3a63,0x3a67,0x3a6b,0x3a6f,0x3a75,0x3a7b,0x3a7f, +0x3a83,0x3a87,0x3a8d,0x312f,0x3a91,0x3a97,0x3a9d,0x3aa1,0x3aa5,0x3aa9,0x3aaf,0x3ab3,0x3ab7,0x3abb,0x3abf,0x3ac3, +0x3ac7,0x3acb,0x3ad1,0x3ad5,0x3ad9,0x3add,0x3ae3,0x3ae7,0x3aeb,0x3aef,0x3af3,0x3af9,0x3aff,0x3b03,0x3b07,0x3b0b, +0x3b11,0x3b15,0x3147,0x3147,0x3b1b,0x3b1f,0x3b25,0x3b29,0x3b2d,0x3b31,0x3b35,0x3b39,0x3b3d,0x3b41,0x314b,0x3b47, +0x3b4b,0x3b4f,0x3b53,0x3b57,0x3b5b,0x3b61,0x3b65,0x3b6b,0x3b71,0x3b77,0x3b7b,0x3b7f,0x3b83,0x3b87,0x3b8b,0x3b8f, +0x3b93,0x3b97,1,1 +}; + +static const UCPTrie norm2_nfc_data_trie={ + norm2_nfc_data_trieIndex, + { norm2_nfc_data_trieData }, + 1746, 7892, + 0x2fc00, 0x30, + 0, 0, + 0, 0, + 0xc4, 0x226, + 0x1, +}; + +static const uint16_t norm2_nfc_data_extraData[7732]={ +0xffff,0xffff,0x8670,0x44dc,0x8670,0x44c0,0x8670,0x44de,0x600,0x180,0x602,0x182,0x604,0x185,0x606,0x186, +0x608,0x200,0x60c,0x205,0x60e,0x44d,0x610,0x189,0x612,0x3d44,0x614,0x18b,0x618,0x39a,0x61e,0x400, +0x622,0x404,0x646,0x3d41,0x64a,0x3c00,0x8650,0x208,0x60e,0x3c04,0x646,0x3c08,0x8662,0x3c0c,0x602,0x20c, +0x604,0x210,0x60e,0x214,0x618,0x218,0x864e,0x18f,0x60e,0x3c14,0x618,0x21c,0x646,0x3c18,0x64e,0x3c20, +0x65a,0x3c24,0x8662,0x3c1c,0x600,0x190,0x602,0x192,0x604,0x195,0x606,0x3d78,0x608,0x225,0x60c,0x228, +0x60e,0x22c,0x610,0x196,0x612,0x3d74,0x618,0x234,0x61e,0x408,0x622,0x40c,0x646,0x3d71,0x64e,0x451, +0x650,0x230,0x65a,0x3c30,0x8660,0x3c34,0x860e,0x3c3c,0x602,0x3e8,0x604,0x238,0x608,0x3c40,0x60c,0x23c, +0x60e,0x240,0x618,0x3cc,0x864e,0x244,0x604,0x248,0x60e,0x3c44,0x610,0x3c4c,0x618,0x43c,0x646,0x3c48, +0x64e,0x3c50,0x865c,0x3c54,0x600,0x198,0x602,0x19a,0x604,0x19c,0x606,0x250,0x608,0x254,0x60c,0x258, +0x60e,0x260,0x610,0x19f,0x612,0x3d90,0x618,0x39e,0x61e,0x410,0x622,0x414,0x646,0x3d94,0x650,0x25c, +0x8660,0x3c58,0x8604,0x268,0x602,0x3c60,0x618,0x3d0,0x646,0x3c64,0x64e,0x26c,0x8662,0x3c68,0x602,0x272, +0x618,0x27a,0x646,0x3c6d,0x64e,0x276,0x65a,0x3c78,0x8662,0x3c74,0x602,0x3c7c,0x60e,0x3c80,0x8646,0x3c84, +0x600,0x3f0,0x602,0x286,0x606,0x1a2,0x60e,0x3c88,0x618,0x28e,0x646,0x3c8c,0x64e,0x28a,0x65a,0x3c94, +0x8662,0x3c90,0x600,0x1a4,0x602,0x1a6,0x604,0x1a9,0x606,0x1ab,0x608,0x299,0x60c,0x29c,0x60e,0x45d, +0x610,0x1ad,0x612,0x3d9c,0x616,0x2a0,0x618,0x3a2,0x61e,0x418,0x622,0x41c,0x636,0x341,0x646,0x3d99, +0x8650,0x3d5,0x602,0x3ca8,0x860e,0x3cac,0x602,0x2a8,0x60e,0x3cb0,0x618,0x2b0,0x61e,0x420,0x622,0x424, +0x646,0x3cb5,0x64e,0x2ac,0x8662,0x3cbc,0x602,0x2b5,0x604,0x2b8,0x60e,0x3cc0,0x618,0x2c1,0x646,0x3cc5, +0x64c,0x430,0x864e,0x2bc,0x60e,0x3cd4,0x618,0x2c8,0x646,0x3cd8,0x64c,0x434,0x64e,0x2c4,0x65a,0x3ce0, +0x8662,0x3cdc,0x600,0x1b2,0x602,0x1b4,0x604,0x1b6,0x606,0x2d1,0x608,0x2d5,0x60c,0x2d8,0x610,0x1b9, +0x612,0x3dcc,0x614,0x2dc,0x616,0x2e0,0x618,0x3a6,0x61e,0x428,0x622,0x42c,0x636,0x35f,0x646,0x3dc8, +0x648,0x3ce4,0x650,0x2e4,0x65a,0x3cec,0x8660,0x3ce8,0x606,0x3cf8,0x8646,0x3cfc,0x600,0x3d00,0x602,0x3d04, +0x604,0x2e8,0x60e,0x3d0c,0x610,0x3d08,0x8646,0x3d10,0x60e,0x3d14,0x8610,0x3d18,0x600,0x3de4,0x602,0x1ba, +0x604,0x2ec,0x606,0x3df0,0x608,0x464,0x60e,0x3d1c,0x610,0x2f0,0x612,0x3dec,0x8646,0x3de8,0x602,0x2f2, +0x604,0x3d20,0x60e,0x2f6,0x618,0x2fa,0x646,0x3d24,0x8662,0x3d28,0x600,0x1c0,0x602,0x1c2,0x604,0x1c5, +0x606,0x1c6,0x608,0x202,0x60c,0x207,0x60e,0x44f,0x610,0x1c9,0x612,0x3d46,0x614,0x1cb,0x618,0x39c, +0x61e,0x402,0x622,0x406,0x646,0x3d43,0x64a,0x3c02,0x8650,0x20a,0x60e,0x3c06,0x646,0x3c0a,0x8662,0x3c0e, +0x602,0x20e,0x604,0x212,0x60e,0x216,0x618,0x21a,0x864e,0x1cf,0x60e,0x3c16,0x618,0x21e,0x646,0x3c1a, +0x64e,0x3c22,0x65a,0x3c26,0x8662,0x3c1e,0x600,0x1d0,0x602,0x1d2,0x604,0x1d5,0x606,0x3d7a,0x608,0x227, +0x60c,0x22a,0x60e,0x22e,0x610,0x1d6,0x612,0x3d76,0x618,0x236,0x61e,0x40a,0x622,0x40e,0x646,0x3d73, +0x64e,0x453,0x650,0x232,0x65a,0x3c32,0x8660,0x3c36,0x860e,0x3c3e,0x602,0x3ea,0x604,0x23a,0x608,0x3c42, +0x60c,0x23e,0x60e,0x242,0x618,0x3ce,0x864e,0x246,0x604,0x24a,0x60e,0x3c46,0x610,0x3c4e,0x618,0x43e, +0x646,0x3c4a,0x64e,0x3c52,0x65c,0x3c56,0x8662,0x3d2c,0x600,0x1d8,0x602,0x1da,0x604,0x1dc,0x606,0x252, +0x608,0x256,0x60c,0x25a,0x610,0x1df,0x612,0x3d92,0x618,0x3a0,0x61e,0x412,0x622,0x416,0x646,0x3d96, +0x650,0x25e,0x8660,0x3c5a,0x604,0x26a,0x8618,0x3e0,0x602,0x3c62,0x618,0x3d2,0x646,0x3c66,0x64e,0x26e, +0x8662,0x3c6a,0x602,0x274,0x618,0x27c,0x646,0x3c6f,0x64e,0x278,0x65a,0x3c7a,0x8662,0x3c76,0x602,0x3c7e, +0x60e,0x3c82,0x8646,0x3c86,0x600,0x3f2,0x602,0x288,0x606,0x1e2,0x60e,0x3c8a,0x618,0x290,0x646,0x3c8e, +0x64e,0x28c,0x65a,0x3c96,0x8662,0x3c92,0x600,0x1e4,0x602,0x1e6,0x604,0x1e9,0x606,0x1eb,0x608,0x29b, +0x60c,0x29e,0x60e,0x45f,0x610,0x1ed,0x612,0x3d9e,0x616,0x2a2,0x618,0x3a4,0x61e,0x41a,0x622,0x41e, +0x636,0x343,0x646,0x3d9b,0x8650,0x3d7,0x602,0x3caa,0x860e,0x3cae,0x602,0x2aa,0x60e,0x3cb2,0x618,0x2b2, +0x61e,0x422,0x622,0x426,0x646,0x3cb7,0x64e,0x2ae,0x8662,0x3cbe,0x602,0x2b7,0x604,0x2ba,0x60e,0x3cc2, +0x618,0x2c3,0x646,0x3cc7,0x64c,0x432,0x864e,0x2be,0x60e,0x3cd6,0x610,0x3d2e,0x618,0x2ca,0x646,0x3cda, +0x64c,0x436,0x64e,0x2c6,0x65a,0x3ce2,0x8662,0x3cde,0x600,0x1f2,0x602,0x1f4,0x604,0x1f6,0x606,0x2d3, +0x608,0x2d7,0x60c,0x2da,0x610,0x1f9,0x612,0x3dce,0x614,0x2de,0x616,0x2e2,0x618,0x3a8,0x61e,0x42a, +0x622,0x42e,0x636,0x361,0x646,0x3dca,0x648,0x3ce6,0x650,0x2e6,0x65a,0x3cee,0x8660,0x3cea,0x606,0x3cfa, +0x8646,0x3cfe,0x600,0x3d02,0x602,0x3d06,0x604,0x2ea,0x60e,0x3d0e,0x610,0x3d0a,0x614,0x3d30,0x8646,0x3d12, +0x60e,0x3d16,0x8610,0x3d1a,0x600,0x3de6,0x602,0x1fa,0x604,0x2ee,0x606,0x3df2,0x608,0x466,0x60e,0x3d1e, +0x610,0x1fe,0x612,0x3dee,0x614,0x3d32,0x8646,0x3dea,0x602,0x2f4,0x604,0x3d22,0x60e,0x2f8,0x618,0x2fc, +0x646,0x3d26,0x8662,0x3d2a,0x600,0x3fda,0x602,0x70a,0x8684,0x3f82,0x602,0x3f8,0x8608,0x3c4,0x8602,0x3fc, +0x602,0x3fa,0x8608,0x3c6,0x8602,0x3fe,0x860e,0x3d36,0x8618,0x3dc,0x8618,0x3de,0x600,0x3f74,0x602,0x70c, +0x608,0x3f72,0x60c,0x3f70,0x626,0x3e11,0x628,0x3e13,0x868a,0x3f78,0x600,0x3f90,0x602,0x710,0x626,0x3e31, +0x8628,0x3e33,0x600,0x3f94,0x602,0x712,0x626,0x3e51,0x628,0x3e53,0x868a,0x3f98,0x600,0x3fb4,0x602,0x714, +0x608,0x3fb2,0x60c,0x3fb0,0x610,0x754,0x626,0x3e71,0x8628,0x3e73,0x600,0x3ff0,0x602,0x718,0x626,0x3e91, +0x8628,0x3e93,0x8628,0x3fd8,0x600,0x3fd4,0x602,0x71c,0x608,0x3fd2,0x60c,0x3fd0,0x610,0x756,0x8628,0x3eb3, +0x600,0x3ff4,0x602,0x71e,0x626,0x3ed1,0x628,0x3ed3,0x868a,0x3ff8,0x600,0x3ee1,0x602,0x759,0x608,0x3f62, +0x60c,0x3f60,0x626,0x3e01,0x628,0x3e03,0x684,0x3f6d,0x868a,0x3f66,0x600,0x3ee4,0x602,0x75a,0x626,0x3e21, +0x8628,0x3e23,0x600,0x3ee9,0x602,0x75d,0x626,0x3e41,0x628,0x3e43,0x684,0x3f8d,0x868a,0x3f86,0x600,0x3eec, +0x602,0x75e,0x608,0x3fa2,0x60c,0x3fa0,0x610,0x795,0x626,0x3e61,0x628,0x3e63,0x8684,0x3fac,0x600,0x3ef0, +0x602,0x798,0x626,0x3e81,0x8628,0x3e83,0x626,0x3fc8,0x8628,0x3fca,0x600,0x3ef4,0x602,0x79a,0x608,0x3fc2, +0x60c,0x3fc0,0x610,0x797,0x626,0x3ea1,0x628,0x3ea3,0x8684,0x3fcc,0x600,0x3ef9,0x602,0x79d,0x626,0x3ec1, +0x628,0x3ec3,0x684,0x3fed,0x868a,0x3fe6,0x602,0x7a6,0x8610,0x7a8,0x8610,0x80e,0x60c,0x9a0,0x8610,0x9a4, +0x8602,0x806,0x600,0x800,0x60c,0x9ac,0x8610,0x802,0x60c,0x982,0x8610,0x9b8,0x8610,0x9bc,0x600,0x81a, +0x608,0x9c4,0x60c,0x832,0x8610,0x9c8,0x8602,0x818,0x8610,0x9cc,0x608,0x9dc,0x60c,0x81c,0x610,0x9e0, +0x8616,0x9e4,0x8610,0x9e8,0x8610,0x9f0,0x8610,0x9d8,0x60c,0x9a2,0x8610,0x9a6,0x8602,0x8a6,0x600,0x8a0, +0x60c,0x9ae,0x8610,0x8a2,0x60c,0x984,0x8610,0x9ba,0x8610,0x9be,0x600,0x8ba,0x608,0x9c6,0x60c,0x872, +0x8610,0x9ca,0x8602,0x8b8,0x8610,0x9ce,0x608,0x9de,0x60c,0x8bc,0x610,0x9e2,0x8616,0x9e6,0x8610,0x9ea, +0x8610,0x9f2,0x8610,0x9da,0x8610,0x8ae,0x861e,0x8ec,0x861e,0x8ee,0x8610,0x9b4,0x8610,0x9b6,0x8610,0x9d4, +0x8610,0x9d6,0xca6,0xc44,0xca8,0xc46,0x8caa,0xc4a,0x8ca8,0xc48,0x8ca8,0xc4c,0x8ca8,0xd84,0x8ca8,0xda6, +0x8ca8,0xd80,0x9278,0x1252,0x9278,0x1262,0x9278,0x1268,0x137c,0x1396,0x93ae,0x1398,0x167c,0x1696,0x16ac,0x1690, +0x96ae,0x1698,0x97ae,0x1728,0x177c,0x1794,0x97ae,0x1798,0x977c,0x1796,0x98ac,0x1890,0x99aa,0x1980,0x1984,0x1995, +0x19aa,0x198e,0x99ac,0x1990,0x1a7c,0x1a94,0x9aae,0x1a98,0x9a7c,0x1a96,0x1b94,0x1bb4,0x1b9e,0x1bb9,0x9bbe,0x1bbc, +0xa05c,0x204c,0xb66a,0x360c,0xb66a,0x3610,0xb66a,0x3614,0xb66a,0x3618,0xb66a,0x361c,0xb66a,0x3624,0xb66a,0x3676, +0xb66a,0x367a,0xb66a,0x3680,0xb66a,0x3682,0xb66a,0x3686,0x600,0x3f9a,0x602,0x3f9c,0x8684,0x3f9e,0x600,0x3fba, +0x602,0x3fbc,0x8684,0x3fbe,0x8670,0x4334,0x8670,0x4336,0x8670,0x435c,0x8670,0x439a,0x8670,0x439e,0x8670,0x439c, +0x8670,0x4408,0x8670,0x4412,0x8670,0x4418,0x8670,0x4448,0x8670,0x444c,0x8670,0x4482,0x8670,0x4488,0x8670,0x448e, +0x8670,0x4492,0x8670,0x44da,0x8670,0x44c4,0x8670,0x44e0,0x8670,0x44e2,0x8670,0x44e8,0x8670,0x44ea,0x8670,0x44f0, +0x8670,0x44f2,0x8670,0x4500,0x8670,0x4502,0x8670,0x45c0,0x8670,0x45c2,0x8670,0x4508,0x8670,0x450a,0x8670,0x4510, +0x8670,0x4512,0x8670,0x45c4,0x8670,0x45c6,0x8670,0x4558,0x8670,0x455a,0x8670,0x455c,0x8670,0x455e,0x8670,0x45d4, +0x8670,0x45d6,0x8670,0x45d8,0x8670,0x45da,0xe132,0x6128,0xe132,0x6098,0xe132,0x609c,0xe132,0x60a0,0xe132,0x60a4, +0xe132,0x60a8,0xe132,0x60ac,0xe132,0x60b0,0xe132,0x60b4,0xe132,0x60b8,0xe132,0x60bc,0xe132,0x60c0,0xe132,0x60c4, +0xe132,0x60ca,0xe132,0x60ce,0xe132,0x60d2,0x6132,0x60e0,0xe134,0x60e2,0x6132,0x60e6,0xe134,0x60e8,0x6132,0x60ec, +0xe134,0x60ee,0x6132,0x60f2,0xe134,0x60f4,0x6132,0x60f8,0xe134,0x60fa,0xe132,0x613c,0xe132,0x61e8,0xe132,0x6158, +0xe132,0x615c,0xe132,0x6160,0xe132,0x6164,0xe132,0x6168,0xe132,0x616c,0xe132,0x6170,0xe132,0x6174,0xe132,0x6178, +0xe132,0x617c,0xe132,0x6180,0xe132,0x6184,0xe132,0x618a,0xe132,0x618e,0xe132,0x6192,0x6132,0x61a0,0xe134,0x61a2, +0x6132,0x61a6,0xe134,0x61a8,0x6132,0x61ac,0xe134,0x61ae,0x6132,0x61b2,0xe134,0x61b4,0x6132,0x61b8,0xe134,0x61ba, +0xe132,0x61ee,0xe132,0x61f0,0xe132,0x61f2,0xe132,0x61f4,0xe132,0x61fc,0xb489,0x2e82,0x2134,0xb489,0x2e82,0x2138, +0xb489,0x2e82,0x2156,0xb489,0x49c2,0x225c,0xb489,0x49c2,0x225e,0x3489,0xcf82,0x2696,0xb489,0xd5c2,0x2698,0x348b, +0x2c02,0x2978,0x348b,0x2e82,0x2976,0xb48b,0x2f42,0x297c,0xb48b,0x6bc2,0x2b74,0xb48b,0x6bc2,0x2b76,0xb48d,0x4c02, +0x3270,2,0xe602,0x41,0x302,0x600,0x3d4c,0x602,0x3d48,0x606,0x3d54,0x8612,0x3d50,0xe602,0x41,0x308, +0x8608,0x3bc,0xe602,0x41,0x30a,0x8602,0x3f4,0xca02,0x43,0x327,0x8602,0x3c10,0xe602,0x45,0x302,0x600, +0x3d80,0x602,0x3d7c,0x606,0x3d88,0x8612,0x3d84,0xe602,0x49,0x308,0x8602,0x3c5c,0xe602,0x4f,0x302,0x600, +0x3da4,0x602,0x3da0,0x606,0x3dac,0x8612,0x3da8,0xe602,0x4f,0x303,0x602,0x3c98,0x608,0x458,0x8610,0x3c9c, +0xe602,0x4f,0x308,0x8608,0x454,0xe602,0x55,0x308,0x600,0x3b6,0x602,0x3ae,0x608,0x3aa,0x8618,0x3b2, +0xe602,0x61,0x302,0x600,0x3d4e,0x602,0x3d4a,0x606,0x3d56,0x8612,0x3d52,0xe602,0x61,0x308,0x8608,0x3be, +0xe602,0x61,0x30a,0x8602,0x3f6,0xca02,0x63,0x327,0x8602,0x3c12,0xe602,0x65,0x302,0x600,0x3d82,0x602, +0x3d7e,0x606,0x3d8a,0x8612,0x3d86,0xe602,0x69,0x308,0x8602,0x3c5e,0xe602,0x6f,0x302,0x600,0x3da6,0x602, +0x3da2,0x606,0x3dae,0x8612,0x3daa,0xe602,0x6f,0x303,0x602,0x3c9a,0x608,0x45a,0x8610,0x3c9e,0xe602,0x6f, +0x308,0x8608,0x456,0xe602,0x75,0x308,0x600,0x3b8,0x602,0x3b0,0x608,0x3ac,0x8618,0x3b4,0xe602,0x41, +0x306,0x600,0x3d60,0x602,0x3d5c,0x606,0x3d68,0x8612,0x3d64,0xe602,0x61,0x306,0x600,0x3d62,0x602,0x3d5e, +0x606,0x3d6a,0x8612,0x3d66,0xe602,0x45,0x304,0x600,0x3c28,0x8602,0x3c2c,0xe602,0x65,0x304,0x600,0x3c2a, +0x8602,0x3c2e,0xe602,0x4f,0x304,0x600,0x3ca0,0x8602,0x3ca4,0xe602,0x6f,0x304,0x600,0x3ca2,0x8602,0x3ca6, +0xe602,0x53,0x301,0x860e,0x3cc8,0xe602,0x73,0x301,0x860e,0x3cca,0xe602,0x53,0x30c,0x860e,0x3ccc,0xe602, +0x73,0x30c,0x860e,0x3cce,0xe602,0x55,0x303,0x8602,0x3cf0,0xe602,0x75,0x303,0x8602,0x3cf2,0xe602,0x55, +0x304,0x8610,0x3cf4,0xe602,0x75,0x304,0x8610,0x3cf6,0xd802,0x4f,0x31b,0x600,0x3db8,0x602,0x3db4,0x606, +0x3dc0,0x612,0x3dbc,0x8646,0x3dc4,0xd802,0x6f,0x31b,0x600,0x3dba,0x602,0x3db6,0x606,0x3dc2,0x612,0x3dbe, +0x8646,0x3dc6,0xd802,0x55,0x31b,0x600,0x3dd4,0x602,0x3dd0,0x606,0x3ddc,0x612,0x3dd8,0x8646,0x3de0,0xd802, +0x75,0x31b,0x600,0x3dd6,0x602,0x3dd2,0x606,0x3dde,0x612,0x3dda,0x8646,0x3de2,0xca02,0x4f,0x328,0x8608, +0x3d8,0xca02,0x6f,0x328,0x8608,0x3da,0xe602,0x41,0x307,0x8608,0x3c0,0xe602,0x61,0x307,0x8608,0x3c2, +0xca02,0x45,0x327,0x860c,0x3c38,0xca02,0x65,0x327,0x860c,0x3c3a,0xe602,0x4f,0x307,0x8608,0x460,0xe602, +0x6f,0x307,0x8608,0x462,0xe602,0x3b1,0x301,0x868a,0x3f68,0xe602,0x3b7,0x301,0x868a,0x3f88,0xe602,0x3b9, +0x308,0x600,0x3fa4,0x602,0x720,0x8684,0x3fae,0xe602,0x3c5,0x308,0x600,0x3fc4,0x602,0x760,0x8684,0x3fce, +0xe602,0x3c9,0x301,0x868a,0x3fe8,2,0xcc6,0xcc2,0x99aa,0x1996,2,0xdd9,0xdcf,0x9b94,0x1bba,0xdc02, +0x4c,0x323,0x8608,0x3c70,0xdc02,0x6c,0x323,0x8608,0x3c72,0xdc02,0x52,0x323,0x8608,0x3cb8,0xdc02,0x72, +0x323,0x8608,0x3cba,0xdc02,0x53,0x323,0x860e,0x3cd0,0xdc02,0x73,0x323,0x860e,0x3cd2,0xdc02,0x41,0x323, +0x604,0x3d58,0x860c,0x3d6c,0xdc02,0x61,0x323,0x604,0x3d5a,0x860c,0x3d6e,0xdc02,0x45,0x323,0x8604,0x3d8c, +0xdc02,0x65,0x323,0x8604,0x3d8e,0xdc02,0x4f,0x323,0x8604,0x3db0,0xdc02,0x6f,0x323,0x8604,0x3db2,0xe602, +0x3b1,0x313,0x600,0x3e05,0x602,0x3e09,0x684,0x3e0d,0x868a,0x3f00,0xe602,0x3b1,0x314,0x600,0x3e07,0x602, +0x3e0b,0x684,0x3e0f,0x868a,0x3f02,0x1f00,0xe643,0x3b1,0x313,0x300,0x868a,0x3f04,0x1f01,0xe643,0x3b1,0x314, +0x300,0x868a,0x3f06,0x1f00,0xe643,0x3b1,0x313,0x301,0x868a,0x3f08,0x1f01,0xe643,0x3b1,0x314,0x301,0x868a, +0x3f0a,0x1f00,0xe643,0x3b1,0x313,0x342,0x868a,0x3f0c,0x1f01,0xe643,0x3b1,0x314,0x342,0x868a,0x3f0e,0xe602, +0x391,0x313,0x600,0x3e15,0x602,0x3e19,0x684,0x3e1d,0x868a,0x3f10,0xe602,0x391,0x314,0x600,0x3e17,0x602, +0x3e1b,0x684,0x3e1f,0x868a,0x3f12,0x1f08,0xe643,0x391,0x313,0x300,0x868a,0x3f14,0x1f09,0xe643,0x391,0x314, +0x300,0x868a,0x3f16,0x1f08,0xe643,0x391,0x313,0x301,0x868a,0x3f18,0x1f09,0xe643,0x391,0x314,0x301,0x868a, +0x3f1a,0x1f08,0xe643,0x391,0x313,0x342,0x868a,0x3f1c,0x1f09,0xe643,0x391,0x314,0x342,0x868a,0x3f1e,0xe602, +0x3b5,0x313,0x600,0x3e24,0x8602,0x3e28,0xe602,0x3b5,0x314,0x600,0x3e26,0x8602,0x3e2a,0xe602,0x395,0x313, +0x600,0x3e34,0x8602,0x3e38,0xe602,0x395,0x314,0x600,0x3e36,0x8602,0x3e3a,0xe602,0x3b7,0x313,0x600,0x3e45, +0x602,0x3e49,0x684,0x3e4d,0x868a,0x3f20,0xe602,0x3b7,0x314,0x600,0x3e47,0x602,0x3e4b,0x684,0x3e4f,0x868a, +0x3f22,0x1f20,0xe643,0x3b7,0x313,0x300,0x868a,0x3f24,0x1f21,0xe643,0x3b7,0x314,0x300,0x868a,0x3f26,0x1f20, +0xe643,0x3b7,0x313,0x301,0x868a,0x3f28,0x1f21,0xe643,0x3b7,0x314,0x301,0x868a,0x3f2a,0x1f20,0xe643,0x3b7, +0x313,0x342,0x868a,0x3f2c,0x1f21,0xe643,0x3b7,0x314,0x342,0x868a,0x3f2e,0xe602,0x397,0x313,0x600,0x3e55, +0x602,0x3e59,0x684,0x3e5d,0x868a,0x3f30,0xe602,0x397,0x314,0x600,0x3e57,0x602,0x3e5b,0x684,0x3e5f,0x868a, +0x3f32,0x1f28,0xe643,0x397,0x313,0x300,0x868a,0x3f34,0x1f29,0xe643,0x397,0x314,0x300,0x868a,0x3f36,0x1f28, +0xe643,0x397,0x313,0x301,0x868a,0x3f38,0x1f29,0xe643,0x397,0x314,0x301,0x868a,0x3f3a,0x1f28,0xe643,0x397, +0x313,0x342,0x868a,0x3f3c,0x1f29,0xe643,0x397,0x314,0x342,0x868a,0x3f3e,0xe602,0x3b9,0x313,0x600,0x3e64, +0x602,0x3e68,0x8684,0x3e6c,0xe602,0x3b9,0x314,0x600,0x3e66,0x602,0x3e6a,0x8684,0x3e6e,0xe602,0x399,0x313, +0x600,0x3e74,0x602,0x3e78,0x8684,0x3e7c,0xe602,0x399,0x314,0x600,0x3e76,0x602,0x3e7a,0x8684,0x3e7e,0xe602, +0x3bf,0x313,0x600,0x3e84,0x8602,0x3e88,0xe602,0x3bf,0x314,0x600,0x3e86,0x8602,0x3e8a,0xe602,0x39f,0x313, +0x600,0x3e94,0x8602,0x3e98,0xe602,0x39f,0x314,0x600,0x3e96,0x8602,0x3e9a,0xe602,0x3c5,0x313,0x600,0x3ea4, +0x602,0x3ea8,0x8684,0x3eac,0xe602,0x3c5,0x314,0x600,0x3ea6,0x602,0x3eaa,0x8684,0x3eae,0xe602,0x3a5,0x314, +0x600,0x3eb6,0x602,0x3eba,0x8684,0x3ebe,0xe602,0x3c9,0x313,0x600,0x3ec5,0x602,0x3ec9,0x684,0x3ecd,0x868a, +0x3f40,0xe602,0x3c9,0x314,0x600,0x3ec7,0x602,0x3ecb,0x684,0x3ecf,0x868a,0x3f42,0x1f60,0xe643,0x3c9,0x313, +0x300,0x868a,0x3f44,0x1f61,0xe643,0x3c9,0x314,0x300,0x868a,0x3f46,0x1f60,0xe643,0x3c9,0x313,0x301,0x868a, +0x3f48,0x1f61,0xe643,0x3c9,0x314,0x301,0x868a,0x3f4a,0x1f60,0xe643,0x3c9,0x313,0x342,0x868a,0x3f4c,0x1f61, +0xe643,0x3c9,0x314,0x342,0x868a,0x3f4e,0xe602,0x3a9,0x313,0x600,0x3ed5,0x602,0x3ed9,0x684,0x3edd,0x868a, +0x3f50,0xe602,0x3a9,0x314,0x600,0x3ed7,0x602,0x3edb,0x684,0x3edf,0x868a,0x3f52,0x1f68,0xe643,0x3a9,0x313, +0x300,0x868a,0x3f54,0x1f69,0xe643,0x3a9,0x314,0x300,0x868a,0x3f56,0x1f68,0xe643,0x3a9,0x313,0x301,0x868a, +0x3f58,0x1f69,0xe643,0x3a9,0x314,0x301,0x868a,0x3f5a,0x1f68,0xe643,0x3a9,0x313,0x342,0x868a,0x3f5c,0x1f69, +0xe643,0x3a9,0x314,0x342,0x868a,0x3f5e,0xe602,0x3b1,0x300,0x868a,0x3f64,0xe602,0x3b7,0x300,0x868a,0x3f84, +0xe602,0x3c9,0x300,0x868a,0x3fe4,0xe602,0x3b1,0x342,0x868a,0x3f6e,0xe602,0x3b7,0x342,0x868a,0x3f8e,0xe602, +0x3c9,0x342,0x868a,0x3fee,3,0xe602,0x41,0x300,0xe602,0x41,0x301,0xe602,0x41,0x303,0xe602,0x45, +0x300,0xe602,0x45,0x301,0xe602,0x45,0x308,0xe602,0x49,0x300,0xe602,0x49,0x301,0xe602,0x49,0x302, +0xe602,0x4e,0x303,0xe602,0x4f,0x300,0xe602,0x4f,0x301,0xe602,0x55,0x300,0xe602,0x55,0x301,0xe602, +0x55,0x302,0xe602,0x59,0x301,0xe602,0x61,0x300,0xe602,0x61,0x301,0xe602,0x61,0x303,0xe602,0x65, +0x300,0xe602,0x65,0x301,0xe602,0x65,0x308,0xe602,0x69,0x300,0xe602,0x69,0x301,0xe602,0x69,0x302, +0xe602,0x6e,0x303,0xe602,0x6f,0x300,0xe602,0x6f,0x301,0xe602,0x75,0x300,0xe602,0x75,0x301,0xe602, +0x75,0x302,0xe602,0x79,0x301,0xe602,0x79,0x308,0xe602,0x41,0x304,0xe602,0x61,0x304,0xca02,0x41, +0x328,0xca02,0x61,0x328,0xe602,0x43,0x301,0xe602,0x63,0x301,0xe602,0x43,0x302,0xe602,0x63,0x302, +0xe602,0x43,0x307,0xe602,0x63,0x307,0xe602,0x43,0x30c,0xe602,0x63,0x30c,0xe602,0x44,0x30c,0xe602, +0x64,0x30c,0xe602,0x45,0x306,0xe602,0x65,0x306,0xe602,0x45,0x307,0xe602,0x65,0x307,0xca02,0x45, +0x328,0xca02,0x65,0x328,0xe602,0x45,0x30c,0xe602,0x65,0x30c,0xe602,0x47,0x302,0xe602,0x67,0x302, +0xe602,0x47,0x306,0xe602,0x67,0x306,0xe602,0x47,0x307,0xe602,0x67,0x307,0xca02,0x47,0x327,0xca02, +0x67,0x327,0xe602,0x48,0x302,0xe602,0x68,0x302,0xe602,0x49,0x303,0xe602,0x69,0x303,0xe602,0x49, +0x304,0xe602,0x69,0x304,0xe602,0x49,0x306,0xe602,0x69,0x306,0xca02,0x49,0x328,0xca02,0x69,0x328, +0xe602,0x49,0x307,0xe602,0x4a,0x302,0xe602,0x6a,0x302,0xca02,0x4b,0x327,0xca02,0x6b,0x327,0xe602, +0x4c,0x301,0xe602,0x6c,0x301,0xca02,0x4c,0x327,0xca02,0x6c,0x327,0xe602,0x4c,0x30c,0xe602,0x6c, +0x30c,0xe602,0x4e,0x301,0xe602,0x6e,0x301,0xca02,0x4e,0x327,0xca02,0x6e,0x327,0xe602,0x4e,0x30c, +0xe602,0x6e,0x30c,0xe602,0x4f,0x306,0xe602,0x6f,0x306,0xe602,0x4f,0x30b,0xe602,0x6f,0x30b,0xe602, +0x52,0x301,0xe602,0x72,0x301,0xca02,0x52,0x327,0xca02,0x72,0x327,0xe602,0x52,0x30c,0xe602,0x72, +0x30c,0xe602,0x53,0x302,0xe602,0x73,0x302,0xca02,0x53,0x327,0xca02,0x73,0x327,0xca02,0x54,0x327, +0xca02,0x74,0x327,0xe602,0x54,0x30c,0xe602,0x74,0x30c,0xe602,0x55,0x306,0xe602,0x75,0x306,0xe602, +0x55,0x30a,0xe602,0x75,0x30a,0xe602,0x55,0x30b,0xe602,0x75,0x30b,0xca02,0x55,0x328,0xca02,0x75, +0x328,0xe602,0x57,0x302,0xe602,0x77,0x302,0xe602,0x59,0x302,0xe602,0x79,0x302,0xe602,0x59,0x308, +0xe602,0x5a,0x301,0xe602,0x7a,0x301,0xe602,0x5a,0x307,0xe602,0x7a,0x307,0xe602,0x5a,0x30c,0xe602, +0x7a,0x30c,0xe602,0x41,0x30c,0xe602,0x61,0x30c,0xe602,0x49,0x30c,0xe602,0x69,0x30c,0xe602,0x4f, +0x30c,0xe602,0x6f,0x30c,0xe602,0x55,0x30c,0xe602,0x75,0x30c,0xdc,0xe643,0x55,0x308,0x304,0xfc, +0xe643,0x75,0x308,0x304,0xdc,0xe643,0x55,0x308,0x301,0xfc,0xe643,0x75,0x308,0x301,0xdc,0xe643, +0x55,0x308,0x30c,0xfc,0xe643,0x75,0x308,0x30c,0xdc,0xe643,0x55,0x308,0x300,0xfc,0xe643,0x75, +0x308,0x300,0xc4,0xe643,0x41,0x308,0x304,0xe4,0xe643,0x61,0x308,0x304,0x226,0xe643,0x41,0x307, +0x304,0x227,0xe643,0x61,0x307,0x304,0xe602,0xc6,0x304,0xe602,0xe6,0x304,0xe602,0x47,0x30c,0xe602, +0x67,0x30c,0xe602,0x4b,0x30c,0xe602,0x6b,0x30c,0x1ea,0xe643,0x4f,0x328,0x304,0x1eb,0xe643,0x6f, +0x328,0x304,0xe602,0x1b7,0x30c,0xe602,0x292,0x30c,0xe602,0x6a,0x30c,0xe602,0x47,0x301,0xe602,0x67, +0x301,0xe602,0x4e,0x300,0xe602,0x6e,0x300,0xc5,0xe643,0x41,0x30a,0x301,0xe5,0xe643,0x61,0x30a, +0x301,0xe602,0xc6,0x301,0xe602,0xe6,0x301,0xe602,0xd8,0x301,0xe602,0xf8,0x301,0xe602,0x41,0x30f, +0xe602,0x61,0x30f,0xe602,0x41,0x311,0xe602,0x61,0x311,0xe602,0x45,0x30f,0xe602,0x65,0x30f,0xe602, +0x45,0x311,0xe602,0x65,0x311,0xe602,0x49,0x30f,0xe602,0x69,0x30f,0xe602,0x49,0x311,0xe602,0x69, +0x311,0xe602,0x4f,0x30f,0xe602,0x6f,0x30f,0xe602,0x4f,0x311,0xe602,0x6f,0x311,0xe602,0x52,0x30f, +0xe602,0x72,0x30f,0xe602,0x52,0x311,0xe602,0x72,0x311,0xe602,0x55,0x30f,0xe602,0x75,0x30f,0xe602, +0x55,0x311,0xe602,0x75,0x311,0xdc02,0x53,0x326,0xdc02,0x73,0x326,0xdc02,0x54,0x326,0xdc02,0x74, +0x326,0xe602,0x48,0x30c,0xe602,0x68,0x30c,0xd6,0xe643,0x4f,0x308,0x304,0xf6,0xe643,0x6f,0x308, +0x304,0xd5,0xe643,0x4f,0x303,0x304,0xf5,0xe643,0x6f,0x303,0x304,0x22e,0xe643,0x4f,0x307,0x304, +0x22f,0xe643,0x6f,0x307,0x304,0xe602,0x59,0x304,0xe602,0x79,0x304,0xe602,0xa8,0x301,0xe602,0x391, +0x301,0xe602,0x395,0x301,0xe602,0x397,0x301,0xe602,0x399,0x301,0xe602,0x39f,0x301,0xe602,0x3a5,0x301, +0xe602,0x3a9,0x301,0x3ca,0xe643,0x3b9,0x308,0x301,0xe602,0x399,0x308,0xe602,0x3a5,0x308,0xe602,0x3b5, +0x301,0xe602,0x3b9,0x301,0x3cb,0xe643,0x3c5,0x308,0x301,0xe602,0x3bf,0x301,0xe602,0x3c5,0x301,0xe602, +0x3d2,0x301,0xe602,0x3d2,0x308,0xe602,0x415,0x300,0xe602,0x415,0x308,0xe602,0x413,0x301,0xe602,0x406, +0x308,0xe602,0x41a,0x301,0xe602,0x418,0x300,0xe602,0x423,0x306,0xe602,0x418,0x306,0xe602,0x438,0x306, +0xe602,0x435,0x300,0xe602,0x435,0x308,0xe602,0x433,0x301,0xe602,0x456,0x308,0xe602,0x43a,0x301,0xe602, +0x438,0x300,0xe602,0x443,0x306,0xe602,0x474,0x30f,0xe602,0x475,0x30f,0xe602,0x416,0x306,0xe602,0x436, +0x306,0xe602,0x410,0x306,0xe602,0x430,0x306,0xe602,0x410,0x308,0xe602,0x430,0x308,0xe602,0x415,0x306, +0xe602,0x435,0x306,0xe602,0x4d8,0x308,0xe602,0x4d9,0x308,0xe602,0x416,0x308,0xe602,0x436,0x308,0xe602, +0x417,0x308,0xe602,0x437,0x308,0xe602,0x418,0x304,0xe602,0x438,0x304,0xe602,0x418,0x308,0xe602,0x438, +0x308,0xe602,0x41e,0x308,0xe602,0x43e,0x308,0xe602,0x4e8,0x308,0xe602,0x4e9,0x308,0xe602,0x42d,0x308, +0xe602,0x44d,0x308,0xe602,0x423,0x304,0xe602,0x443,0x304,0xe602,0x423,0x308,0xe602,0x443,0x308,0xe602, +0x423,0x30b,0xe602,0x443,0x30b,0xe602,0x427,0x308,0xe602,0x447,0x308,0xe602,0x42b,0x308,0xe602,0x44b, +0x308,0xe602,0x627,0x653,0xe602,0x627,0x654,0xe602,0x648,0x654,0xdc02,0x627,0x655,0xe602,0x64a,0x654, +0xe602,0x6d5,0x654,0xe602,0x6c1,0x654,0xe602,0x6d2,0x654,0x702,0x928,0x93c,0x702,0x930,0x93c,0x702, +0x933,0x93c,2,0x9c7,0x9be,2,0x9c7,0x9d7,2,0xb47,0xb56,2,0xb47,0xb3e,2,0xb47, +0xb57,2,0xb92,0xbd7,2,0xbc6,0xbbe,2,0xbc7,0xbbe,2,0xbc6,0xbd7,0x5b02,0xc46,0xc56, +2,0xcbf,0xcd5,2,0xcc6,0xcd5,2,0xcc6,0xcd6,0xcca,0x43,0xcc6,0xcc2,0xcd5,2,0xd46, +0xd3e,2,0xd47,0xd3e,2,0xd46,0xd57,0x902,0xdd9,0xdca,0xddc,0x943,0xdd9,0xdcf,0xdca,2, +0xdd9,0xddf,2,0x1025,0x102e,2,0x1b05,0x1b35,2,0x1b07,0x1b35,2,0x1b09,0x1b35,2,0x1b0b, +0x1b35,2,0x1b0d,0x1b35,2,0x1b11,0x1b35,2,0x1b3a,0x1b35,2,0x1b3c,0x1b35,2,0x1b3e,0x1b35, +2,0x1b3f,0x1b35,2,0x1b42,0x1b35,0xdc02,0x41,0x325,0xdc02,0x61,0x325,0xe602,0x42,0x307,0xe602, +0x62,0x307,0xdc02,0x42,0x323,0xdc02,0x62,0x323,0xdc02,0x42,0x331,0xdc02,0x62,0x331,0xc7,0xe643, +0x43,0x327,0x301,0xe7,0xe643,0x63,0x327,0x301,0xe602,0x44,0x307,0xe602,0x64,0x307,0xdc02,0x44, +0x323,0xdc02,0x64,0x323,0xdc02,0x44,0x331,0xdc02,0x64,0x331,0xca02,0x44,0x327,0xca02,0x64,0x327, +0xdc02,0x44,0x32d,0xdc02,0x64,0x32d,0x112,0xe643,0x45,0x304,0x300,0x113,0xe643,0x65,0x304,0x300, +0x112,0xe643,0x45,0x304,0x301,0x113,0xe643,0x65,0x304,0x301,0xdc02,0x45,0x32d,0xdc02,0x65,0x32d, +0xdc02,0x45,0x330,0xdc02,0x65,0x330,0x228,0xe643,0x45,0x327,0x306,0x229,0xe643,0x65,0x327,0x306, +0xe602,0x46,0x307,0xe602,0x66,0x307,0xe602,0x47,0x304,0xe602,0x67,0x304,0xe602,0x48,0x307,0xe602, +0x68,0x307,0xdc02,0x48,0x323,0xdc02,0x68,0x323,0xe602,0x48,0x308,0xe602,0x68,0x308,0xca02,0x48, +0x327,0xca02,0x68,0x327,0xdc02,0x48,0x32e,0xdc02,0x68,0x32e,0xdc02,0x49,0x330,0xdc02,0x69,0x330, +0xcf,0xe643,0x49,0x308,0x301,0xef,0xe643,0x69,0x308,0x301,0xe602,0x4b,0x301,0xe602,0x6b,0x301, +0xdc02,0x4b,0x323,0xdc02,0x6b,0x323,0xdc02,0x4b,0x331,0xdc02,0x6b,0x331,0x1e36,0xe643,0x4c,0x323, +0x304,0x1e37,0xe643,0x6c,0x323,0x304,0xdc02,0x4c,0x331,0xdc02,0x6c,0x331,0xdc02,0x4c,0x32d,0xdc02, +0x6c,0x32d,0xe602,0x4d,0x301,0xe602,0x6d,0x301,0xe602,0x4d,0x307,0xe602,0x6d,0x307,0xdc02,0x4d, +0x323,0xdc02,0x6d,0x323,0xe602,0x4e,0x307,0xe602,0x6e,0x307,0xdc02,0x4e,0x323,0xdc02,0x6e,0x323, +0xdc02,0x4e,0x331,0xdc02,0x6e,0x331,0xdc02,0x4e,0x32d,0xdc02,0x6e,0x32d,0xd5,0xe643,0x4f,0x303, +0x301,0xf5,0xe643,0x6f,0x303,0x301,0xd5,0xe643,0x4f,0x303,0x308,0xf5,0xe643,0x6f,0x303,0x308, +0x14c,0xe643,0x4f,0x304,0x300,0x14d,0xe643,0x6f,0x304,0x300,0x14c,0xe643,0x4f,0x304,0x301,0x14d, +0xe643,0x6f,0x304,0x301,0xe602,0x50,0x301,0xe602,0x70,0x301,0xe602,0x50,0x307,0xe602,0x70,0x307, +0xe602,0x52,0x307,0xe602,0x72,0x307,0x1e5a,0xe643,0x52,0x323,0x304,0x1e5b,0xe643,0x72,0x323,0x304, +0xdc02,0x52,0x331,0xdc02,0x72,0x331,0xe602,0x53,0x307,0xe602,0x73,0x307,0x15a,0xe643,0x53,0x301, +0x307,0x15b,0xe643,0x73,0x301,0x307,0x160,0xe643,0x53,0x30c,0x307,0x161,0xe643,0x73,0x30c,0x307, +0x1e62,0xe643,0x53,0x323,0x307,0x1e63,0xe643,0x73,0x323,0x307,0xe602,0x54,0x307,0xe602,0x74,0x307, +0xdc02,0x54,0x323,0xdc02,0x74,0x323,0xdc02,0x54,0x331,0xdc02,0x74,0x331,0xdc02,0x54,0x32d,0xdc02, +0x74,0x32d,0xdc02,0x55,0x324,0xdc02,0x75,0x324,0xdc02,0x55,0x330,0xdc02,0x75,0x330,0xdc02,0x55, +0x32d,0xdc02,0x75,0x32d,0x168,0xe643,0x55,0x303,0x301,0x169,0xe643,0x75,0x303,0x301,0x16a,0xe643, +0x55,0x304,0x308,0x16b,0xe643,0x75,0x304,0x308,0xe602,0x56,0x303,0xe602,0x76,0x303,0xdc02,0x56, +0x323,0xdc02,0x76,0x323,0xe602,0x57,0x300,0xe602,0x77,0x300,0xe602,0x57,0x301,0xe602,0x77,0x301, +0xe602,0x57,0x308,0xe602,0x77,0x308,0xe602,0x57,0x307,0xe602,0x77,0x307,0xdc02,0x57,0x323,0xdc02, +0x77,0x323,0xe602,0x58,0x307,0xe602,0x78,0x307,0xe602,0x58,0x308,0xe602,0x78,0x308,0xe602,0x59, +0x307,0xe602,0x79,0x307,0xe602,0x5a,0x302,0xe602,0x7a,0x302,0xdc02,0x5a,0x323,0xdc02,0x7a,0x323, +0xdc02,0x5a,0x331,0xdc02,0x7a,0x331,0xdc02,0x68,0x331,0xe602,0x74,0x308,0xe602,0x77,0x30a,0xe602, +0x79,0x30a,0xe602,0x17f,0x307,0xe602,0x41,0x309,0xe602,0x61,0x309,0xc2,0xe643,0x41,0x302,0x301, +0xe2,0xe643,0x61,0x302,0x301,0xc2,0xe643,0x41,0x302,0x300,0xe2,0xe643,0x61,0x302,0x300,0xc2, +0xe643,0x41,0x302,0x309,0xe2,0xe643,0x61,0x302,0x309,0xc2,0xe643,0x41,0x302,0x303,0xe2,0xe643, +0x61,0x302,0x303,0x1ea0,0xe643,0x41,0x323,0x302,0x1ea1,0xe643,0x61,0x323,0x302,0x102,0xe643,0x41, +0x306,0x301,0x103,0xe643,0x61,0x306,0x301,0x102,0xe643,0x41,0x306,0x300,0x103,0xe643,0x61,0x306, +0x300,0x102,0xe643,0x41,0x306,0x309,0x103,0xe643,0x61,0x306,0x309,0x102,0xe643,0x41,0x306,0x303, +0x103,0xe643,0x61,0x306,0x303,0x1ea0,0xe643,0x41,0x323,0x306,0x1ea1,0xe643,0x61,0x323,0x306,0xe602, +0x45,0x309,0xe602,0x65,0x309,0xe602,0x45,0x303,0xe602,0x65,0x303,0xca,0xe643,0x45,0x302,0x301, +0xea,0xe643,0x65,0x302,0x301,0xca,0xe643,0x45,0x302,0x300,0xea,0xe643,0x65,0x302,0x300,0xca, +0xe643,0x45,0x302,0x309,0xea,0xe643,0x65,0x302,0x309,0xca,0xe643,0x45,0x302,0x303,0xea,0xe643, +0x65,0x302,0x303,0x1eb8,0xe643,0x45,0x323,0x302,0x1eb9,0xe643,0x65,0x323,0x302,0xe602,0x49,0x309, +0xe602,0x69,0x309,0xdc02,0x49,0x323,0xdc02,0x69,0x323,0xe602,0x4f,0x309,0xe602,0x6f,0x309,0xd4, +0xe643,0x4f,0x302,0x301,0xf4,0xe643,0x6f,0x302,0x301,0xd4,0xe643,0x4f,0x302,0x300,0xf4,0xe643, +0x6f,0x302,0x300,0xd4,0xe643,0x4f,0x302,0x309,0xf4,0xe643,0x6f,0x302,0x309,0xd4,0xe643,0x4f, +0x302,0x303,0xf4,0xe643,0x6f,0x302,0x303,0x1ecc,0xe643,0x4f,0x323,0x302,0x1ecd,0xe643,0x6f,0x323, +0x302,0x1a0,0xe643,0x4f,0x31b,0x301,0x1a1,0xe643,0x6f,0x31b,0x301,0x1a0,0xe643,0x4f,0x31b,0x300, +0x1a1,0xe643,0x6f,0x31b,0x300,0x1a0,0xe643,0x4f,0x31b,0x309,0x1a1,0xe643,0x6f,0x31b,0x309,0x1a0, +0xe643,0x4f,0x31b,0x303,0x1a1,0xe643,0x6f,0x31b,0x303,0x1a0,0xdc43,0x4f,0x31b,0x323,0x1a1,0xdc43, +0x6f,0x31b,0x323,0xdc02,0x55,0x323,0xdc02,0x75,0x323,0xe602,0x55,0x309,0xe602,0x75,0x309,0x1af, +0xe643,0x55,0x31b,0x301,0x1b0,0xe643,0x75,0x31b,0x301,0x1af,0xe643,0x55,0x31b,0x300,0x1b0,0xe643, +0x75,0x31b,0x300,0x1af,0xe643,0x55,0x31b,0x309,0x1b0,0xe643,0x75,0x31b,0x309,0x1af,0xe643,0x55, +0x31b,0x303,0x1b0,0xe643,0x75,0x31b,0x303,0x1af,0xdc43,0x55,0x31b,0x323,0x1b0,0xdc43,0x75,0x31b, +0x323,0xe602,0x59,0x300,0xe602,0x79,0x300,0xdc02,0x59,0x323,0xdc02,0x79,0x323,0xe602,0x59,0x309, +0xe602,0x79,0x309,0xe602,0x59,0x303,0xe602,0x79,0x303,0x1f10,0xe643,0x3b5,0x313,0x300,0x1f11,0xe643, +0x3b5,0x314,0x300,0x1f10,0xe643,0x3b5,0x313,0x301,0x1f11,0xe643,0x3b5,0x314,0x301,0x1f18,0xe643,0x395, +0x313,0x300,0x1f19,0xe643,0x395,0x314,0x300,0x1f18,0xe643,0x395,0x313,0x301,0x1f19,0xe643,0x395,0x314, +0x301,0x1f30,0xe643,0x3b9,0x313,0x300,0x1f31,0xe643,0x3b9,0x314,0x300,0x1f30,0xe643,0x3b9,0x313,0x301, +0x1f31,0xe643,0x3b9,0x314,0x301,0x1f30,0xe643,0x3b9,0x313,0x342,0x1f31,0xe643,0x3b9,0x314,0x342,0x1f38, +0xe643,0x399,0x313,0x300,0x1f39,0xe643,0x399,0x314,0x300,0x1f38,0xe643,0x399,0x313,0x301,0x1f39,0xe643, +0x399,0x314,0x301,0x1f38,0xe643,0x399,0x313,0x342,0x1f39,0xe643,0x399,0x314,0x342,0x1f40,0xe643,0x3bf, +0x313,0x300,0x1f41,0xe643,0x3bf,0x314,0x300,0x1f40,0xe643,0x3bf,0x313,0x301,0x1f41,0xe643,0x3bf,0x314, +0x301,0x1f48,0xe643,0x39f,0x313,0x300,0x1f49,0xe643,0x39f,0x314,0x300,0x1f48,0xe643,0x39f,0x313,0x301, +0x1f49,0xe643,0x39f,0x314,0x301,0x1f50,0xe643,0x3c5,0x313,0x300,0x1f51,0xe643,0x3c5,0x314,0x300,0x1f50, +0xe643,0x3c5,0x313,0x301,0x1f51,0xe643,0x3c5,0x314,0x301,0x1f50,0xe643,0x3c5,0x313,0x342,0x1f51,0xe643, +0x3c5,0x314,0x342,0x1f59,0xe643,0x3a5,0x314,0x300,0x1f59,0xe643,0x3a5,0x314,0x301,0x1f59,0xe643,0x3a5, +0x314,0x342,0xe602,0x3b5,0x300,0xe602,0x3b9,0x300,0xe602,0x3bf,0x300,0xe602,0x3c5,0x300,0x1f00,0xf043, +0x3b1,0x313,0x345,0x1f01,0xf043,0x3b1,0x314,0x345,0x1f02,0x345,2,0xf044,0x3b1,0x313,0x300,0x345, +0x1f03,0x345,2,0xf044,0x3b1,0x314,0x300,0x345,0x1f04,0x345,2,0xf044,0x3b1,0x313,0x301,0x345, +0x1f05,0x345,2,0xf044,0x3b1,0x314,0x301,0x345,0x1f06,0x345,2,0xf044,0x3b1,0x313,0x342,0x345, +0x1f07,0x345,2,0xf044,0x3b1,0x314,0x342,0x345,0x1f08,0xf043,0x391,0x313,0x345,0x1f09,0xf043,0x391, +0x314,0x345,0x1f0a,0x345,2,0xf044,0x391,0x313,0x300,0x345,0x1f0b,0x345,2,0xf044,0x391,0x314, +0x300,0x345,0x1f0c,0x345,2,0xf044,0x391,0x313,0x301,0x345,0x1f0d,0x345,2,0xf044,0x391,0x314, +0x301,0x345,0x1f0e,0x345,2,0xf044,0x391,0x313,0x342,0x345,0x1f0f,0x345,2,0xf044,0x391,0x314, +0x342,0x345,0x1f20,0xf043,0x3b7,0x313,0x345,0x1f21,0xf043,0x3b7,0x314,0x345,0x1f22,0x345,2,0xf044, +0x3b7,0x313,0x300,0x345,0x1f23,0x345,2,0xf044,0x3b7,0x314,0x300,0x345,0x1f24,0x345,2,0xf044, +0x3b7,0x313,0x301,0x345,0x1f25,0x345,2,0xf044,0x3b7,0x314,0x301,0x345,0x1f26,0x345,2,0xf044, +0x3b7,0x313,0x342,0x345,0x1f27,0x345,2,0xf044,0x3b7,0x314,0x342,0x345,0x1f28,0xf043,0x397,0x313, +0x345,0x1f29,0xf043,0x397,0x314,0x345,0x1f2a,0x345,2,0xf044,0x397,0x313,0x300,0x345,0x1f2b,0x345, +2,0xf044,0x397,0x314,0x300,0x345,0x1f2c,0x345,2,0xf044,0x397,0x313,0x301,0x345,0x1f2d,0x345, +2,0xf044,0x397,0x314,0x301,0x345,0x1f2e,0x345,2,0xf044,0x397,0x313,0x342,0x345,0x1f2f,0x345, +2,0xf044,0x397,0x314,0x342,0x345,0x1f60,0xf043,0x3c9,0x313,0x345,0x1f61,0xf043,0x3c9,0x314,0x345, +0x1f62,0x345,2,0xf044,0x3c9,0x313,0x300,0x345,0x1f63,0x345,2,0xf044,0x3c9,0x314,0x300,0x345, +0x1f64,0x345,2,0xf044,0x3c9,0x313,0x301,0x345,0x1f65,0x345,2,0xf044,0x3c9,0x314,0x301,0x345, +0x1f66,0x345,2,0xf044,0x3c9,0x313,0x342,0x345,0x1f67,0x345,2,0xf044,0x3c9,0x314,0x342,0x345, +0x1f68,0xf043,0x3a9,0x313,0x345,0x1f69,0xf043,0x3a9,0x314,0x345,0x1f6a,0x345,2,0xf044,0x3a9,0x313, +0x300,0x345,0x1f6b,0x345,2,0xf044,0x3a9,0x314,0x300,0x345,0x1f6c,0x345,2,0xf044,0x3a9,0x313, +0x301,0x345,0x1f6d,0x345,2,0xf044,0x3a9,0x314,0x301,0x345,0x1f6e,0x345,2,0xf044,0x3a9,0x313, +0x342,0x345,0x1f6f,0x345,2,0xf044,0x3a9,0x314,0x342,0x345,0xe602,0x3b1,0x306,0xe602,0x3b1,0x304, +0x1f70,0xf043,0x3b1,0x300,0x345,0xf002,0x3b1,0x345,0x3ac,0xf043,0x3b1,0x301,0x345,0x1fb6,0xf043,0x3b1, +0x342,0x345,0xe602,0x391,0x306,0xe602,0x391,0x304,0xe602,0x391,0x300,0xf002,0x391,0x345,0xe602,0xa8, +0x342,0x1f74,0xf043,0x3b7,0x300,0x345,0xf002,0x3b7,0x345,0x3ae,0xf043,0x3b7,0x301,0x345,0x1fc6,0xf043, +0x3b7,0x342,0x345,0xe602,0x395,0x300,0xe602,0x397,0x300,0xf002,0x397,0x345,0xe602,0x1fbf,0x300,0xe602, +0x1fbf,0x301,0xe602,0x1fbf,0x342,0xe602,0x3b9,0x306,0xe602,0x3b9,0x304,0x3ca,0xe643,0x3b9,0x308,0x300, +0xe602,0x3b9,0x342,0x3ca,0xe643,0x3b9,0x308,0x342,0xe602,0x399,0x306,0xe602,0x399,0x304,0xe602,0x399, +0x300,0xe602,0x1ffe,0x300,0xe602,0x1ffe,0x301,0xe602,0x1ffe,0x342,0xe602,0x3c5,0x306,0xe602,0x3c5,0x304, +0x3cb,0xe643,0x3c5,0x308,0x300,0xe602,0x3c1,0x313,0xe602,0x3c1,0x314,0xe602,0x3c5,0x342,0x3cb,0xe643, +0x3c5,0x308,0x342,0xe602,0x3a5,0x306,0xe602,0x3a5,0x304,0xe602,0x3a5,0x300,0xe602,0x3a1,0x314,0xe602, +0xa8,0x300,0x1f7c,0xf043,0x3c9,0x300,0x345,0xf002,0x3c9,0x345,0x3ce,0xf043,0x3c9,0x301,0x345,0x1ff6, +0xf043,0x3c9,0x342,0x345,0xe602,0x39f,0x300,0xe602,0x3a9,0x300,0xf002,0x3a9,0x345,0x102,0x2190,0x338, +0x102,0x2192,0x338,0x102,0x2194,0x338,0x102,0x21d0,0x338,0x102,0x21d4,0x338,0x102,0x21d2,0x338,0x102, +0x2203,0x338,0x102,0x2208,0x338,0x102,0x220b,0x338,0x102,0x2223,0x338,0x102,0x2225,0x338,0x102,0x223c, +0x338,0x102,0x2243,0x338,0x102,0x2245,0x338,0x102,0x2248,0x338,0x102,0x3d,0x338,0x102,0x2261,0x338, +0x102,0x224d,0x338,0x102,0x3c,0x338,0x102,0x3e,0x338,0x102,0x2264,0x338,0x102,0x2265,0x338,0x102, +0x2272,0x338,0x102,0x2273,0x338,0x102,0x2276,0x338,0x102,0x2277,0x338,0x102,0x227a,0x338,0x102,0x227b, +0x338,0x102,0x2282,0x338,0x102,0x2283,0x338,0x102,0x2286,0x338,0x102,0x2287,0x338,0x102,0x22a2,0x338, +0x102,0x22a8,0x338,0x102,0x22a9,0x338,0x102,0x22ab,0x338,0x102,0x227c,0x338,0x102,0x227d,0x338,0x102, +0x2291,0x338,0x102,0x2292,0x338,0x102,0x22b2,0x338,0x102,0x22b3,0x338,0x102,0x22b4,0x338,0x102,0x22b5, +0x338,0x802,0x304b,0x3099,0x802,0x304d,0x3099,0x802,0x304f,0x3099,0x802,0x3051,0x3099,0x802,0x3053,0x3099, +0x802,0x3055,0x3099,0x802,0x3057,0x3099,0x802,0x3059,0x3099,0x802,0x305b,0x3099,0x802,0x305d,0x3099,0x802, +0x305f,0x3099,0x802,0x3061,0x3099,0x802,0x3064,0x3099,0x802,0x3066,0x3099,0x802,0x3068,0x3099,0x802,0x306f, +0x3099,0x802,0x306f,0x309a,0x802,0x3072,0x3099,0x802,0x3072,0x309a,0x802,0x3075,0x3099,0x802,0x3075,0x309a, +0x802,0x3078,0x3099,0x802,0x3078,0x309a,0x802,0x307b,0x3099,0x802,0x307b,0x309a,0x802,0x3046,0x3099,0x802, +0x309d,0x3099,0x802,0x30ab,0x3099,0x802,0x30ad,0x3099,0x802,0x30af,0x3099,0x802,0x30b1,0x3099,0x802,0x30b3, +0x3099,0x802,0x30b5,0x3099,0x802,0x30b7,0x3099,0x802,0x30b9,0x3099,0x802,0x30bb,0x3099,0x802,0x30bd,0x3099, +0x802,0x30bf,0x3099,0x802,0x30c1,0x3099,0x802,0x30c4,0x3099,0x802,0x30c6,0x3099,0x802,0x30c8,0x3099,0x802, +0x30cf,0x3099,0x802,0x30cf,0x309a,0x802,0x30d2,0x3099,0x802,0x30d2,0x309a,0x802,0x30d5,0x3099,0x802,0x30d5, +0x309a,0x802,0x30d8,0x3099,0x802,0x30d8,0x309a,0x802,0x30db,0x3099,0x802,0x30db,0x309a,0x802,0x30a6,0x3099, +0x802,0x30ef,0x3099,0x802,0x30f0,0x3099,0x802,0x30f1,0x3099,0x802,0x30f2,0x3099,0x802,0x30fd,0x3099,0x704, +0xd804,0xdc99,0xd804,0xdcba,0x704,0xd804,0xdc9b,0xd804,0xdcba,0x704,0xd804,0xdca5,0xd804,0xdcba,4,0xd804, +0xdd31,0xd804,0xdd27,4,0xd804,0xdd32,0xd804,0xdd27,4,0xd804,0xdf47,0xd804,0xdf3e,4,0xd804,0xdf47, +0xd804,0xdf57,4,0xd805,0xdcb9,0xd805,0xdcba,4,0xd805,0xdcb9,0xd805,0xdcb0,4,0xd805,0xdcb9,0xd805, +0xdcbd,4,0xd805,0xddb8,0xd805,0xddaf,4,0xd805,0xddb9,0xd805,0xddaf,4,0xd806,0xdd35,0xd806,0xdd30, +1,0x2b9,1,0x3b,1,0xb7,0x702,0x915,0x93c,0x702,0x916,0x93c,0x702,0x917,0x93c,0x702, +0x91c,0x93c,0x702,0x921,0x93c,0x702,0x922,0x93c,0x702,0x92b,0x93c,0x702,0x92f,0x93c,0x702,0x9a1, +0x9bc,0x702,0x9a2,0x9bc,0x702,0x9af,0x9bc,0x702,0xa32,0xa3c,0x702,0xa38,0xa3c,0x702,0xa16,0xa3c, +0x702,0xa17,0xa3c,0x702,0xa1c,0xa3c,0x702,0xa2b,0xa3c,0x702,0xb21,0xb3c,0x702,0xb22,0xb3c,2, +0xf42,0xfb7,2,0xf4c,0xfb7,2,0xf51,0xfb7,2,0xf56,0xfb7,2,0xf5b,0xfb7,2,0xf40, +0xfb5,0x8202,0xfb2,0xf80,0x8202,0xfb3,0xf80,2,0xf92,0xfb7,2,0xf9c,0xfb7,2,0xfa1,0xfb7, +2,0xfa6,0xfb7,2,0xfab,0xfb7,2,0xf90,0xfb5,1,0x3b9,1,0x60,1,0xb4,1, +0x3a9,1,0x4b,1,0x3008,1,0x3009,0x102,0x2add,0x338,1,0x8c48,1,0x66f4,1,0x8eca, +1,0x8cc8,1,0x6ed1,1,0x4e32,1,0x53e5,1,0x9f9c,1,0x5951,1,0x91d1,1,0x5587, +1,0x5948,1,0x61f6,1,0x7669,1,0x7f85,1,0x863f,1,0x87ba,1,0x88f8,1,0x908f, +1,0x6a02,1,0x6d1b,1,0x70d9,1,0x73de,1,0x843d,1,0x916a,1,0x99f1,1,0x4e82, +1,0x5375,1,0x6b04,1,0x721b,1,0x862d,1,0x9e1e,1,0x5d50,1,0x6feb,1,0x85cd, +1,0x8964,1,0x62c9,1,0x81d8,1,0x881f,1,0x5eca,1,0x6717,1,0x6d6a,1,0x72fc, +1,0x90ce,1,0x4f86,1,0x51b7,1,0x52de,1,0x64c4,1,0x6ad3,1,0x7210,1,0x76e7, +1,0x8001,1,0x8606,1,0x865c,1,0x8def,1,0x9732,1,0x9b6f,1,0x9dfa,1,0x788c, +1,0x797f,1,0x7da0,1,0x83c9,1,0x9304,1,0x9e7f,1,0x8ad6,1,0x58df,1,0x5f04, +1,0x7c60,1,0x807e,1,0x7262,1,0x78ca,1,0x8cc2,1,0x96f7,1,0x58d8,1,0x5c62, +1,0x6a13,1,0x6dda,1,0x6f0f,1,0x7d2f,1,0x7e37,1,0x964b,1,0x52d2,1,0x808b, +1,0x51dc,1,0x51cc,1,0x7a1c,1,0x7dbe,1,0x83f1,1,0x9675,1,0x8b80,1,0x62cf, +1,0x8afe,1,0x4e39,1,0x5be7,1,0x6012,1,0x7387,1,0x7570,1,0x5317,1,0x78fb, +1,0x4fbf,1,0x5fa9,1,0x4e0d,1,0x6ccc,1,0x6578,1,0x7d22,1,0x53c3,1,0x585e, +1,0x7701,1,0x8449,1,0x8aaa,1,0x6bba,1,0x8fb0,1,0x6c88,1,0x62fe,1,0x82e5, +1,0x63a0,1,0x7565,1,0x4eae,1,0x5169,1,0x51c9,1,0x6881,1,0x7ce7,1,0x826f, +1,0x8ad2,1,0x91cf,1,0x52f5,1,0x5442,1,0x5973,1,0x5eec,1,0x65c5,1,0x6ffe, +1,0x792a,1,0x95ad,1,0x9a6a,1,0x9e97,1,0x9ece,1,0x529b,1,0x66c6,1,0x6b77, +1,0x8f62,1,0x5e74,1,0x6190,1,0x6200,1,0x649a,1,0x6f23,1,0x7149,1,0x7489, +1,0x79ca,1,0x7df4,1,0x806f,1,0x8f26,1,0x84ee,1,0x9023,1,0x934a,1,0x5217, +1,0x52a3,1,0x54bd,1,0x70c8,1,0x88c2,1,0x5ec9,1,0x5ff5,1,0x637b,1,0x6bae, +1,0x7c3e,1,0x7375,1,0x4ee4,1,0x56f9,1,0x5dba,1,0x601c,1,0x73b2,1,0x7469, +1,0x7f9a,1,0x8046,1,0x9234,1,0x96f6,1,0x9748,1,0x9818,1,0x4f8b,1,0x79ae, +1,0x91b4,1,0x96b8,1,0x60e1,1,0x4e86,1,0x50da,1,0x5bee,1,0x5c3f,1,0x6599, +1,0x71ce,1,0x7642,1,0x84fc,1,0x907c,1,0x9f8d,1,0x6688,1,0x962e,1,0x5289, +1,0x677b,1,0x67f3,1,0x6d41,1,0x6e9c,1,0x7409,1,0x7559,1,0x786b,1,0x7d10, +1,0x985e,1,0x516d,1,0x622e,1,0x9678,1,0x502b,1,0x5d19,1,0x6dea,1,0x8f2a, +1,0x5f8b,1,0x6144,1,0x6817,1,0x9686,1,0x5229,1,0x540f,1,0x5c65,1,0x6613, +1,0x674e,1,0x68a8,1,0x6ce5,1,0x7406,1,0x75e2,1,0x7f79,1,0x88cf,1,0x88e1, +1,0x91cc,1,0x96e2,1,0x533f,1,0x6eba,1,0x541d,1,0x71d0,1,0x7498,1,0x85fa, +1,0x96a3,1,0x9c57,1,0x9e9f,1,0x6797,1,0x6dcb,1,0x81e8,1,0x7acb,1,0x7b20, +1,0x7c92,1,0x72c0,1,0x7099,1,0x8b58,1,0x4ec0,1,0x8336,1,0x523a,1,0x5207, +1,0x5ea6,1,0x62d3,1,0x7cd6,1,0x5b85,1,0x6d1e,1,0x66b4,1,0x8f3b,1,0x884c, +1,0x964d,1,0x898b,1,0x5ed3,1,0x5140,1,0x55c0,1,0x585a,1,0x6674,1,0x51de, +1,0x732a,1,0x76ca,1,0x793c,1,0x795e,1,0x7965,1,0x798f,1,0x9756,1,0x7cbe, +1,0x7fbd,1,0x8612,1,0x8af8,1,0x9038,1,0x90fd,1,0x98ef,1,0x98fc,1,0x9928, +1,0x9db4,1,0x90de,1,0x96b7,1,0x4fae,1,0x50e7,1,0x514d,1,0x52c9,1,0x52e4, +1,0x5351,1,0x559d,1,0x5606,1,0x5668,1,0x5840,1,0x58a8,1,0x5c64,1,0x5c6e, +1,0x6094,1,0x6168,1,0x618e,1,0x61f2,1,0x654f,1,0x65e2,1,0x6691,1,0x6885, +1,0x6d77,1,0x6e1a,1,0x6f22,1,0x716e,1,0x722b,1,0x7422,1,0x7891,1,0x793e, +1,0x7949,1,0x7948,1,0x7950,1,0x7956,1,0x795d,1,0x798d,1,0x798e,1,0x7a40, +1,0x7a81,1,0x7bc0,1,0x7e09,1,0x7e41,1,0x7f72,1,0x8005,1,0x81ed,1,0x8279, +1,0x8457,1,0x8910,1,0x8996,1,0x8b01,1,0x8b39,1,0x8cd3,1,0x8d08,1,0x8fb6, +1,0x96e3,1,0x97ff,1,0x983b,1,0x6075,2,0xd850,0xdeee,1,0x8218,1,0x4e26,1, +0x51b5,1,0x5168,1,0x4f80,1,0x5145,1,0x5180,1,0x52c7,1,0x52fa,1,0x5555,1, +0x5599,1,0x55e2,1,0x58b3,1,0x5944,1,0x5954,1,0x5a62,1,0x5b28,1,0x5ed2,1, +0x5ed9,1,0x5f69,1,0x5fad,1,0x60d8,1,0x614e,1,0x6108,1,0x6160,1,0x6234,1, +0x63c4,1,0x641c,1,0x6452,1,0x6556,1,0x671b,1,0x6756,1,0x6b79,1,0x6edb,1, +0x6ecb,1,0x701e,1,0x77a7,1,0x7235,1,0x72af,1,0x7471,1,0x7506,1,0x753b,1, +0x761d,1,0x761f,1,0x76db,1,0x76f4,1,0x774a,1,0x7740,1,0x78cc,1,0x7ab1,1, +0x7c7b,1,0x7d5b,1,0x7f3e,1,0x8352,1,0x83ef,1,0x8779,1,0x8941,1,0x8986,1, +0x8abf,1,0x8acb,1,0x8aed,1,0x8b8a,1,0x8f38,1,0x9072,1,0x9199,1,0x9276,1, +0x967c,1,0x97db,1,0x980b,1,0x9b12,2,0xd84a,0xdc4a,2,0xd84a,0xdc44,2,0xd84c,0xdfd5, +1,0x3b9d,1,0x4018,1,0x4039,2,0xd854,0xde49,2,0xd857,0xdcd0,2,0xd85f,0xded3,1, +0x9f43,1,0x9f8e,0xe02,0x5d9,0x5b4,0x1102,0x5f2,0x5b7,0x1802,0x5e9,0x5c1,0x1902,0x5e9,0x5c2,0xfb49, +0x1843,0x5e9,0x5bc,0x5c1,0xfb49,0x1943,0x5e9,0x5bc,0x5c2,0x1102,0x5d0,0x5b7,0x1202,0x5d0,0x5b8,0x1502, +0x5d0,0x5bc,0x1502,0x5d1,0x5bc,0x1502,0x5d2,0x5bc,0x1502,0x5d3,0x5bc,0x1502,0x5d4,0x5bc,0x1502,0x5d5, +0x5bc,0x1502,0x5d6,0x5bc,0x1502,0x5d8,0x5bc,0x1502,0x5d9,0x5bc,0x1502,0x5da,0x5bc,0x1502,0x5db,0x5bc, +0x1502,0x5dc,0x5bc,0x1502,0x5de,0x5bc,0x1502,0x5e0,0x5bc,0x1502,0x5e1,0x5bc,0x1502,0x5e3,0x5bc,0x1502, +0x5e4,0x5bc,0x1502,0x5e6,0x5bc,0x1502,0x5e7,0x5bc,0x1502,0x5e8,0x5bc,0x1502,0x5e9,0x5bc,0x1502,0x5ea, +0x5bc,0x1302,0x5d5,0x5b9,0x1702,0x5d1,0x5bf,0x1702,0x5db,0x5bf,0x1702,0x5e4,0x5bf,0xd804,0xd834,0xdd57, +0xd834,0xdd65,0xd804,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd5f,0xd834,0xdd6e,4,0xd846,0xd834,0xdd58,0xd834, +0xdd65,0xd834,0xdd6e,0xd834,0xdd5f,0xd834,0xdd6f,4,0xd846,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd6f,0xd834, +0xdd5f,0xd834,0xdd70,4,0xd846,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd70,0xd834,0xdd5f,0xd834,0xdd71,4, +0xd846,0xd834,0xdd58,0xd834,0xdd65,0xd834,0xdd71,0xd834,0xdd5f,0xd834,0xdd72,4,0xd846,0xd834,0xdd58,0xd834, +0xdd65,0xd834,0xdd72,0xd804,0xd834,0xddb9,0xd834,0xdd65,0xd804,0xd834,0xddba,0xd834,0xdd65,0xd834,0xddbb,0xd834, +0xdd6e,4,0xd846,0xd834,0xddb9,0xd834,0xdd65,0xd834,0xdd6e,0xd834,0xddbc,0xd834,0xdd6e,4,0xd846,0xd834, +0xddba,0xd834,0xdd65,0xd834,0xdd6e,0xd834,0xddbb,0xd834,0xdd6f,4,0xd846,0xd834,0xddb9,0xd834,0xdd65,0xd834, +0xdd6f,0xd834,0xddbc,0xd834,0xdd6f,4,0xd846,0xd834,0xddba,0xd834,0xdd65,0xd834,0xdd6f,1,0x4e3d,1, +0x4e38,1,0x4e41,2,0xd840,0xdd22,1,0x4f60,1,0x4fbb,1,0x5002,1,0x507a,1,0x5099, +1,0x50cf,1,0x349e,2,0xd841,0xde3a,1,0x5154,1,0x5164,1,0x5177,2,0xd841,0xdd1c, +1,0x34b9,1,0x5167,1,0x518d,2,0xd841,0xdd4b,1,0x5197,1,0x51a4,1,0x4ecc,1, +0x51ac,2,0xd864,0xdddf,1,0x51f5,1,0x5203,1,0x34df,1,0x523b,1,0x5246,1,0x5272, +1,0x5277,1,0x3515,1,0x5305,1,0x5306,1,0x5349,1,0x535a,1,0x5373,1,0x537d, +1,0x537f,2,0xd842,0xde2c,1,0x7070,1,0x53ca,1,0x53df,2,0xd842,0xdf63,1,0x53eb, +1,0x53f1,1,0x5406,1,0x549e,1,0x5438,1,0x5448,1,0x5468,1,0x54a2,1,0x54f6, +1,0x5510,1,0x5553,1,0x5563,1,0x5584,1,0x55ab,1,0x55b3,1,0x55c2,1,0x5716, +1,0x5717,1,0x5651,1,0x5674,1,0x58ee,1,0x57ce,1,0x57f4,1,0x580d,1,0x578b, +1,0x5832,1,0x5831,1,0x58ac,2,0xd845,0xdce4,1,0x58f2,1,0x58f7,1,0x5906,1, +0x591a,1,0x5922,1,0x5962,2,0xd845,0xdea8,2,0xd845,0xdeea,1,0x59ec,1,0x5a1b,1, +0x5a27,1,0x59d8,1,0x5a66,1,0x36ee,1,0x36fc,1,0x5b08,1,0x5b3e,2,0xd846,0xddc8, +1,0x5bc3,1,0x5bd8,1,0x5bf3,2,0xd846,0xdf18,1,0x5bff,1,0x5c06,1,0x5f53,1, +0x5c22,1,0x3781,1,0x5c60,1,0x5cc0,1,0x5c8d,2,0xd847,0xdde4,1,0x5d43,2,0xd847, +0xdde6,1,0x5d6e,1,0x5d6b,1,0x5d7c,1,0x5de1,1,0x5de2,1,0x382f,1,0x5dfd,1, +0x5e28,1,0x5e3d,1,0x5e69,1,0x3862,2,0xd848,0xdd83,1,0x387c,1,0x5eb0,1,0x5eb3, +1,0x5eb6,2,0xd868,0xdf92,1,0x5efe,2,0xd848,0xdf31,1,0x8201,1,0x5f22,1,0x38c7, +2,0xd84c,0xdeb8,2,0xd858,0xddda,1,0x5f62,1,0x5f6b,1,0x38e3,1,0x5f9a,1,0x5fcd, +1,0x5fd7,1,0x5ff9,1,0x6081,1,0x393a,1,0x391c,2,0xd849,0xded4,1,0x60c7,1, +0x6148,1,0x614c,1,0x617a,1,0x61b2,1,0x61a4,1,0x61af,1,0x61de,1,0x6210,1, +0x621b,1,0x625d,1,0x62b1,1,0x62d4,1,0x6350,2,0xd84a,0xdf0c,1,0x633d,1,0x62fc, +1,0x6368,1,0x6383,1,0x63e4,2,0xd84a,0xdff1,1,0x6422,1,0x63c5,1,0x63a9,1, +0x3a2e,1,0x6469,1,0x647e,1,0x649d,1,0x6477,1,0x3a6c,1,0x656c,2,0xd84c,0xdc0a, +1,0x65e3,1,0x66f8,1,0x6649,1,0x3b19,1,0x3b08,1,0x3ae4,1,0x5192,1,0x5195, +1,0x6700,1,0x669c,1,0x80ad,1,0x43d9,1,0x6721,1,0x675e,1,0x6753,2,0xd84c, +0xdfc3,1,0x3b49,1,0x67fa,1,0x6785,1,0x6852,2,0xd84d,0xdc6d,1,0x688e,1,0x681f, +1,0x6914,1,0x6942,1,0x69a3,1,0x69ea,1,0x6aa8,2,0xd84d,0xdea3,1,0x6adb,1, +0x3c18,1,0x6b21,2,0xd84e,0xdca7,1,0x6b54,1,0x3c4e,1,0x6b72,1,0x6b9f,1,0x6bbb, +2,0xd84e,0xde8d,2,0xd847,0xdd0b,2,0xd84e,0xdefa,1,0x6c4e,2,0xd84f,0xdcbc,1,0x6cbf, +1,0x6ccd,1,0x6c67,1,0x6d16,1,0x6d3e,1,0x6d69,1,0x6d78,1,0x6d85,2,0xd84f, +0xdd1e,1,0x6d34,1,0x6e2f,1,0x6e6e,1,0x3d33,1,0x6ec7,2,0xd84f,0xded1,1,0x6df9, +1,0x6f6e,2,0xd84f,0xdf5e,2,0xd84f,0xdf8e,1,0x6fc6,1,0x7039,1,0x701b,1,0x3d96, +1,0x704a,1,0x707d,1,0x7077,1,0x70ad,2,0xd841,0xdd25,1,0x7145,2,0xd850,0xde63, +1,0x719c,2,0xd850,0xdfab,1,0x7228,1,0x7250,2,0xd851,0xde08,1,0x7280,1,0x7295, +2,0xd851,0xdf35,2,0xd852,0xdc14,1,0x737a,1,0x738b,1,0x3eac,1,0x73a5,1,0x3eb8, +1,0x7447,1,0x745c,1,0x7485,1,0x74ca,1,0x3f1b,1,0x7524,2,0xd853,0xdc36,1, +0x753e,2,0xd853,0xdc92,2,0xd848,0xdd9f,1,0x7610,2,0xd853,0xdfa1,2,0xd853,0xdfb8,2, +0xd854,0xdc44,1,0x3ffc,1,0x4008,2,0xd854,0xdcf3,2,0xd854,0xdcf2,2,0xd854,0xdd19,2, +0xd854,0xdd33,1,0x771e,1,0x771f,1,0x778b,1,0x4046,1,0x4096,2,0xd855,0xdc1d,1, +0x784e,1,0x40e3,2,0xd855,0xde26,2,0xd855,0xde9a,2,0xd855,0xdec5,1,0x79eb,1,0x412f, +1,0x7a4a,1,0x7a4f,2,0xd856,0xdd7c,2,0xd856,0xdea7,1,0x7aee,1,0x4202,2,0xd856, +0xdfab,1,0x7bc6,1,0x7bc9,1,0x4227,2,0xd857,0xdc80,1,0x7cd2,1,0x42a0,1,0x7ce8, +1,0x7ce3,1,0x7d00,2,0xd857,0xdf86,1,0x7d63,1,0x4301,1,0x7dc7,1,0x7e02,1, +0x7e45,1,0x4334,2,0xd858,0xde28,2,0xd858,0xde47,1,0x4359,2,0xd858,0xded9,1,0x7f7a, +2,0xd858,0xdf3e,1,0x7f95,1,0x7ffa,2,0xd859,0xdcda,2,0xd859,0xdd23,1,0x8060,2, +0xd859,0xdda8,1,0x8070,2,0xd84c,0xdf5f,1,0x43d5,1,0x80b2,1,0x8103,1,0x440b,1, +0x813e,1,0x5ab5,2,0xd859,0xdfa7,2,0xd859,0xdfb5,2,0xd84c,0xdf93,2,0xd84c,0xdf9c,1, +0x8204,1,0x8f9e,1,0x446b,1,0x8291,1,0x828b,1,0x829d,1,0x52b3,1,0x82b1,1, +0x82b3,1,0x82bd,1,0x82e6,2,0xd85a,0xdf3c,1,0x831d,1,0x8363,1,0x83ad,1,0x8323, +1,0x83bd,1,0x83e7,1,0x8353,1,0x83ca,1,0x83cc,1,0x83dc,2,0xd85b,0xdc36,2, +0xd85b,0xdd6b,2,0xd85b,0xdcd5,1,0x452b,1,0x84f1,1,0x84f3,1,0x8516,2,0xd85c,0xdfca, +1,0x8564,2,0xd85b,0xdf2c,1,0x455d,1,0x4561,2,0xd85b,0xdfb1,2,0xd85c,0xdcd2,1, +0x456b,1,0x8650,1,0x8667,1,0x8669,1,0x86a9,1,0x8688,1,0x870e,1,0x86e2,1, +0x8728,1,0x876b,1,0x8786,1,0x45d7,1,0x87e1,1,0x8801,1,0x45f9,1,0x8860,1, +0x8863,2,0xd85d,0xde67,1,0x88d7,1,0x88de,1,0x4635,1,0x88fa,1,0x34bb,2,0xd85e, +0xdcae,2,0xd85e,0xdd66,1,0x46be,1,0x46c7,1,0x8aa0,1,0x8c55,2,0xd85f,0xdca8,1, +0x8cab,1,0x8cc1,1,0x8d1b,1,0x8d77,2,0xd85f,0xdf2f,2,0xd842,0xdc04,1,0x8dcb,1, +0x8dbc,1,0x8df0,2,0xd842,0xdcde,1,0x8ed4,2,0xd861,0xddd2,2,0xd861,0xdded,1,0x9094, +1,0x90f1,1,0x9111,2,0xd861,0xdf2e,1,0x911b,1,0x9238,1,0x92d7,1,0x92d8,1, +0x927c,1,0x93f9,1,0x9415,2,0xd862,0xdffa,1,0x958b,1,0x4995,1,0x95b7,2,0xd863, +0xdd77,1,0x49e6,1,0x96c3,1,0x5db2,1,0x9723,2,0xd864,0xdd45,2,0xd864,0xde1a,1, +0x4a6e,1,0x4a76,1,0x97e0,2,0xd865,0xdc0a,1,0x4ab2,2,0xd865,0xdc96,1,0x9829,2, +0xd865,0xddb6,1,0x98e2,1,0x4b33,1,0x9929,1,0x99a7,1,0x99c2,1,0x99fe,1,0x4bce, +2,0xd866,0xdf30,1,0x9c40,1,0x9cfd,1,0x4cce,1,0x4ced,1,0x9d67,2,0xd868,0xdcce, +1,0x4cf8,2,0xd868,0xdd05,2,0xd868,0xde0e,2,0xd868,0xde91,1,0x9ebb,1,0x4d56,1, +0x9ef9,1,0x9efe,1,0x9f05,1,0x9f0f,1,0x9f16,1,0x9f3b,2,0xd869,0xde00,0x3ac,0xe642, +0x3b1,0x301,0x3ad,0xe642,0x3b5,0x301,0x3ae,0xe642,0x3b7,0x301,0x3af,0xe642,0x3b9,0x301,0x3cc,0xe642, +0x3bf,0x301,0x3cd,0xe642,0x3c5,0x301,0x3ce,0xe642,0x3c9,0x301,0x386,0xe642,0x391,0x301,0x388,0xe642, +0x395,0x301,0x389,0xe642,0x397,0x301,0x390,1,0xe643,0x3b9,0x308,0x301,0x38a,0xe642,0x399,0x301, +0x3b0,1,0xe643,0x3c5,0x308,0x301,0x38e,0xe642,0x3a5,0x301,0x385,0xe642,0xa8,0x301,0x38c,0xe642, +0x39f,0x301,0x38f,0xe642,0x3a9,0x301,0xc5,0xe642,0x41,0x30a,0xe6e6,0xe681,0x300,0xe6e6,0xe681,0x301, +0xe6e6,0xe681,0x313,0xe6e6,0xe682,0x308,0x301,0x8100,0x8282,0xf71,0xf72,0x8100,0x8482,0xf71,0xf74,0x8100, +0x8282,0xf71,0xf80,0 +}; + +static const uint8_t norm2_nfc_data_smallFCD[256]={ +0xc0,0xef,3,0x7f,0xdf,0x70,0xcf,0x87,0xc7,0xe6,0x66,0x46,0x64,0x46,0x66,0x5b, +0x12,0,0,4,0,0,0,0x43,0x20,2,0x69,0xae,0xc2,0xc0,0xff,0xff, +0xc0,0x72,0xbf,0,0,0,0,0,0,0,0x40,0,0x80,0x88,0,0, +0xfe,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0x98,0,0xc3,0x66,0xe0,0x80,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,7,0,0,2,0 +}; + +#endif // INCLUDED_FROM_NORMALIZER2_CPP diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/norm2allmodes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/norm2allmodes.h new file mode 100644 index 0000000000000000000000000000000000000000..584835da57b6be1487a143b45fb5d34eedb02ed4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/norm2allmodes.h @@ -0,0 +1,405 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2014, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* norm2allmodes.h +* +* created on: 2014sep07 +* created by: Markus W. Scherer +*/ + +#ifndef __NORM2ALLMODES_H__ +#define __NORM2ALLMODES_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/edits.h" +#include "unicode/normalizer2.h" +#include "unicode/stringoptions.h" +#include "unicode/unistr.h" +#include "cpputils.h" +#include "normalizer2impl.h" + +U_NAMESPACE_BEGIN + +// Intermediate class: +// Has Normalizer2Impl and does boilerplate argument checking and setup. +class Normalizer2WithImpl : public Normalizer2 { +public: + Normalizer2WithImpl(const Normalizer2Impl &ni) : impl(ni) {} + virtual ~Normalizer2WithImpl(); + + // normalize + virtual UnicodeString & + normalize(const UnicodeString &src, + UnicodeString &dest, + UErrorCode &errorCode) const U_OVERRIDE { + if(U_FAILURE(errorCode)) { + dest.setToBogus(); + return dest; + } + const UChar *sArray=src.getBuffer(); + if(&dest==&src || sArray==NULL) { + errorCode=U_ILLEGAL_ARGUMENT_ERROR; + dest.setToBogus(); + return dest; + } + dest.remove(); + ReorderingBuffer buffer(impl, dest); + if(buffer.init(src.length(), errorCode)) { + normalize(sArray, sArray+src.length(), buffer, errorCode); + } + return dest; + } + virtual void + normalize(const UChar *src, const UChar *limit, + ReorderingBuffer &buffer, UErrorCode &errorCode) const = 0; + + // normalize and append + virtual UnicodeString & + normalizeSecondAndAppend(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const U_OVERRIDE { + return normalizeSecondAndAppend(first, second, true, errorCode); + } + virtual UnicodeString & + append(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const U_OVERRIDE { + return normalizeSecondAndAppend(first, second, false, errorCode); + } + UnicodeString & + normalizeSecondAndAppend(UnicodeString &first, + const UnicodeString &second, + UBool doNormalize, + UErrorCode &errorCode) const { + uprv_checkCanGetBuffer(first, errorCode); + if(U_FAILURE(errorCode)) { + return first; + } + const UChar *secondArray=second.getBuffer(); + if(&first==&second || secondArray==NULL) { + errorCode=U_ILLEGAL_ARGUMENT_ERROR; + return first; + } + int32_t firstLength=first.length(); + UnicodeString safeMiddle; + { + ReorderingBuffer buffer(impl, first); + if(buffer.init(firstLength+second.length(), errorCode)) { + normalizeAndAppend(secondArray, secondArray+second.length(), doNormalize, + safeMiddle, buffer, errorCode); + } + } // The ReorderingBuffer destructor finalizes the first string. + if(U_FAILURE(errorCode)) { + // Restore the modified suffix of the first string. + first.replace(firstLength-safeMiddle.length(), 0x7fffffff, safeMiddle); + } + return first; + } + virtual void + normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize, + UnicodeString &safeMiddle, + ReorderingBuffer &buffer, UErrorCode &errorCode) const = 0; + virtual UBool + getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE { + UChar buffer[4]; + int32_t length; + const UChar *d=impl.getDecomposition(c, buffer, length); + if(d==NULL) { + return false; + } + if(d==buffer) { + decomposition.setTo(buffer, length); // copy the string (Jamos from Hangul syllable c) + } else { + decomposition.setTo(false, d, length); // read-only alias + } + return true; + } + virtual UBool + getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE { + UChar buffer[30]; + int32_t length; + const UChar *d=impl.getRawDecomposition(c, buffer, length); + if(d==NULL) { + return false; + } + if(d==buffer) { + decomposition.setTo(buffer, length); // copy the string (algorithmic decomposition) + } else { + decomposition.setTo(false, d, length); // read-only alias + } + return true; + } + virtual UChar32 + composePair(UChar32 a, UChar32 b) const U_OVERRIDE { + return impl.composePair(a, b); + } + + virtual uint8_t + getCombiningClass(UChar32 c) const U_OVERRIDE { + return impl.getCC(impl.getNorm16(c)); + } + + // quick checks + virtual UBool + isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE { + if(U_FAILURE(errorCode)) { + return false; + } + const UChar *sArray=s.getBuffer(); + if(sArray==NULL) { + errorCode=U_ILLEGAL_ARGUMENT_ERROR; + return false; + } + const UChar *sLimit=sArray+s.length(); + return sLimit==spanQuickCheckYes(sArray, sLimit, errorCode); + } + virtual UNormalizationCheckResult + quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE { + return Normalizer2WithImpl::isNormalized(s, errorCode) ? UNORM_YES : UNORM_NO; + } + virtual int32_t + spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE { + if(U_FAILURE(errorCode)) { + return 0; + } + const UChar *sArray=s.getBuffer(); + if(sArray==NULL) { + errorCode=U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } + return (int32_t)(spanQuickCheckYes(sArray, sArray+s.length(), errorCode)-sArray); + } + virtual const UChar * + spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const = 0; + + virtual UNormalizationCheckResult getQuickCheck(UChar32) const { + return UNORM_YES; + } + + const Normalizer2Impl &impl; +}; + +class DecomposeNormalizer2 : public Normalizer2WithImpl { +public: + DecomposeNormalizer2(const Normalizer2Impl &ni) : Normalizer2WithImpl(ni) {} + virtual ~DecomposeNormalizer2(); + +private: + virtual void + normalize(const UChar *src, const UChar *limit, + ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE { + impl.decompose(src, limit, &buffer, errorCode); + } + using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function. + virtual void + normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize, + UnicodeString &safeMiddle, + ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE { + impl.decomposeAndAppend(src, limit, doNormalize, safeMiddle, buffer, errorCode); + } + + void + normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, + Edits *edits, UErrorCode &errorCode) const U_OVERRIDE { + if (U_FAILURE(errorCode)) { + return; + } + if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) { + edits->reset(); + } + const uint8_t *s = reinterpret_cast(src.data()); + impl.decomposeUTF8(options, s, s + src.length(), &sink, edits, errorCode); + sink.Flush(); + } + virtual UBool + isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const U_OVERRIDE { + if(U_FAILURE(errorCode)) { + return false; + } + const uint8_t *s = reinterpret_cast(sp.data()); + const uint8_t *sLimit = s + sp.length(); + return sLimit == impl.decomposeUTF8(0, s, sLimit, nullptr, nullptr, errorCode); + } + + virtual const UChar * + spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE { + return impl.decompose(src, limit, NULL, errorCode); + } + using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function. + virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE { + return impl.isDecompYes(impl.getNorm16(c)) ? UNORM_YES : UNORM_NO; + } + virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE { + return impl.hasDecompBoundaryBefore(c); + } + virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE { + return impl.hasDecompBoundaryAfter(c); + } + virtual UBool isInert(UChar32 c) const U_OVERRIDE { + return impl.isDecompInert(c); + } +}; + +class ComposeNormalizer2 : public Normalizer2WithImpl { +public: + ComposeNormalizer2(const Normalizer2Impl &ni, UBool fcc) : + Normalizer2WithImpl(ni), onlyContiguous(fcc) {} + virtual ~ComposeNormalizer2(); + +private: + virtual void + normalize(const UChar *src, const UChar *limit, + ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE { + impl.compose(src, limit, onlyContiguous, true, buffer, errorCode); + } + using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function. + + void + normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, + Edits *edits, UErrorCode &errorCode) const U_OVERRIDE { + if (U_FAILURE(errorCode)) { + return; + } + if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) { + edits->reset(); + } + const uint8_t *s = reinterpret_cast(src.data()); + impl.composeUTF8(options, onlyContiguous, s, s + src.length(), + &sink, edits, errorCode); + sink.Flush(); + } + + virtual void + normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize, + UnicodeString &safeMiddle, + ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE { + impl.composeAndAppend(src, limit, doNormalize, onlyContiguous, safeMiddle, buffer, errorCode); + } + + virtual UBool + isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE { + if(U_FAILURE(errorCode)) { + return false; + } + const UChar *sArray=s.getBuffer(); + if(sArray==NULL) { + errorCode=U_ILLEGAL_ARGUMENT_ERROR; + return false; + } + UnicodeString temp; + ReorderingBuffer buffer(impl, temp); + if(!buffer.init(5, errorCode)) { // small destCapacity for substring normalization + return false; + } + return impl.compose(sArray, sArray+s.length(), onlyContiguous, false, buffer, errorCode); + } + virtual UBool + isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const U_OVERRIDE { + if(U_FAILURE(errorCode)) { + return false; + } + const uint8_t *s = reinterpret_cast(sp.data()); + return impl.composeUTF8(0, onlyContiguous, s, s + sp.length(), nullptr, nullptr, errorCode); + } + virtual UNormalizationCheckResult + quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE { + if(U_FAILURE(errorCode)) { + return UNORM_MAYBE; + } + const UChar *sArray=s.getBuffer(); + if(sArray==NULL) { + errorCode=U_ILLEGAL_ARGUMENT_ERROR; + return UNORM_MAYBE; + } + UNormalizationCheckResult qcResult=UNORM_YES; + impl.composeQuickCheck(sArray, sArray+s.length(), onlyContiguous, &qcResult); + return qcResult; + } + virtual const UChar * + spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &) const U_OVERRIDE { + return impl.composeQuickCheck(src, limit, onlyContiguous, NULL); + } + using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function. + virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE { + return impl.getCompQuickCheck(impl.getNorm16(c)); + } + virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE { + return impl.hasCompBoundaryBefore(c); + } + virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE { + return impl.hasCompBoundaryAfter(c, onlyContiguous); + } + virtual UBool isInert(UChar32 c) const U_OVERRIDE { + return impl.isCompInert(c, onlyContiguous); + } + + const UBool onlyContiguous; +}; + +class FCDNormalizer2 : public Normalizer2WithImpl { +public: + FCDNormalizer2(const Normalizer2Impl &ni) : Normalizer2WithImpl(ni) {} + virtual ~FCDNormalizer2(); + +private: + virtual void + normalize(const UChar *src, const UChar *limit, + ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE { + impl.makeFCD(src, limit, &buffer, errorCode); + } + using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function. + virtual void + normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize, + UnicodeString &safeMiddle, + ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE { + impl.makeFCDAndAppend(src, limit, doNormalize, safeMiddle, buffer, errorCode); + } + virtual const UChar * + spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE { + return impl.makeFCD(src, limit, NULL, errorCode); + } + using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function. + virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE { + return impl.hasFCDBoundaryBefore(c); + } + virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE { + return impl.hasFCDBoundaryAfter(c); + } + virtual UBool isInert(UChar32 c) const U_OVERRIDE { + return impl.isFCDInert(c); + } +}; + +struct Norm2AllModes : public UMemory { + Norm2AllModes(Normalizer2Impl *i) + : impl(i), comp(*i, false), decomp(*i), fcd(*i), fcc(*i, true) {} + ~Norm2AllModes(); + + static Norm2AllModes *createInstance(Normalizer2Impl *impl, UErrorCode &errorCode); + static Norm2AllModes *createNFCInstance(UErrorCode &errorCode); + static Norm2AllModes *createInstance(const char *packageName, + const char *name, + UErrorCode &errorCode); + + static const Norm2AllModes *getNFCInstance(UErrorCode &errorCode); + static const Norm2AllModes *getNFKCInstance(UErrorCode &errorCode); + static const Norm2AllModes *getNFKC_CFInstance(UErrorCode &errorCode); + + Normalizer2Impl *impl; + ComposeNormalizer2 comp; + DecomposeNormalizer2 decomp; + FCDNormalizer2 fcd; + ComposeNormalizer2 fcc; +}; + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_NORMALIZATION +#endif // __NORM2ALLMODES_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/normalizer2impl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/normalizer2impl.h new file mode 100644 index 0000000000000000000000000000000000000000..bdb6767a925c90e355603b5f65f89ae58d129a15 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/normalizer2impl.h @@ -0,0 +1,987 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: normalizer2impl.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009nov22 +* created by: Markus W. Scherer +*/ + +#ifndef __NORMALIZER2IMPL_H__ +#define __NORMALIZER2IMPL_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/normalizer2.h" +#include "unicode/ucptrie.h" +#include "unicode/unistr.h" +#include "unicode/unorm.h" +#include "unicode/utf.h" +#include "unicode/utf16.h" +#include "mutex.h" +#include "udataswp.h" +#include "uset_imp.h" + +// When the nfc.nrm data is *not* hardcoded into the common library +// (with this constant set to 0), +// then it needs to be built into the data package: +// Add nfc.nrm to icu4c/source/data/Makefile.in DAT_FILES_SHORT +#define NORM2_HARDCODE_NFC_DATA 1 + +U_NAMESPACE_BEGIN + +struct CanonIterData; + +class ByteSink; +class Edits; +class InitCanonIterData; +class LcccContext; + +class U_COMMON_API Hangul { +public: + /* Korean Hangul and Jamo constants */ + enum { + JAMO_L_BASE=0x1100, /* "lead" jamo */ + JAMO_L_END=0x1112, + JAMO_V_BASE=0x1161, /* "vowel" jamo */ + JAMO_V_END=0x1175, + JAMO_T_BASE=0x11a7, /* "trail" jamo */ + JAMO_T_END=0x11c2, + + HANGUL_BASE=0xac00, + HANGUL_END=0xd7a3, + + JAMO_L_COUNT=19, + JAMO_V_COUNT=21, + JAMO_T_COUNT=28, + + JAMO_VT_COUNT=JAMO_V_COUNT*JAMO_T_COUNT, + + HANGUL_COUNT=JAMO_L_COUNT*JAMO_V_COUNT*JAMO_T_COUNT, + HANGUL_LIMIT=HANGUL_BASE+HANGUL_COUNT + }; + + static inline UBool isHangul(UChar32 c) { + return HANGUL_BASE<=c && c(INERT) : + UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c); + } + uint16_t getRawNorm16(UChar32 c) const { return UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c); } + + UNormalizationCheckResult getCompQuickCheck(uint16_t norm16) const { + if(norm16=MIN_NORMAL_MAYBE_YES) { + return getCCFromNormalYesOrMaybe(norm16); + } + if(norm16> OFFSET_SHIFT); + } + static uint8_t getCCFromYesOrMaybe(uint16_t norm16) { + return norm16>=MIN_NORMAL_MAYBE_YES ? getCCFromNormalYesOrMaybe(norm16) : 0; + } + uint8_t getCCFromYesOrMaybeCP(UChar32 c) const { + if (c < minCompNoMaybeCP) { return 0; } + return getCCFromYesOrMaybe(getNorm16(c)); + } + + /** + * Returns the FCD data for code point c. + * @param c A Unicode code point. + * @return The lccc(c) in bits 15..8 and tccc(c) in bits 7..0. + */ + uint16_t getFCD16(UChar32 c) const { + if(c>8]; + if(bits==0) { return false; } + return (UBool)((bits>>((lead>>5)&7))&1); + } + /** Returns the FCD value from the regular normalization data. */ + uint16_t getFCD16FromNormData(UChar32 c) const; + + /** + * Gets the decomposition for one code point. + * @param c code point + * @param buffer out-only buffer for algorithmic decompositions + * @param length out-only, takes the length of the decomposition, if any + * @return pointer to the decomposition, or NULL if none + */ + const UChar *getDecomposition(UChar32 c, UChar buffer[4], int32_t &length) const; + + /** + * Gets the raw decomposition for one code point. + * @param c code point + * @param buffer out-only buffer for algorithmic decompositions + * @param length out-only, takes the length of the decomposition, if any + * @return pointer to the decomposition, or NULL if none + */ + const UChar *getRawDecomposition(UChar32 c, UChar buffer[30], int32_t &length) const; + + UChar32 composePair(UChar32 a, UChar32 b) const; + + UBool isCanonSegmentStarter(UChar32 c) const; + UBool getCanonStartSet(UChar32 c, UnicodeSet &set) const; + + enum { + // Fixed norm16 values. + MIN_YES_YES_WITH_CC=0xfe02, + JAMO_VT=0xfe00, + MIN_NORMAL_MAYBE_YES=0xfc00, + JAMO_L=2, // offset=1 hasCompBoundaryAfter=false + INERT=1, // offset=0 hasCompBoundaryAfter=true + + // norm16 bit 0 is comp-boundary-after. + HAS_COMP_BOUNDARY_AFTER=1, + OFFSET_SHIFT=1, + + // For algorithmic one-way mappings, norm16 bits 2..1 indicate the + // tccc (0, 1, >1) for quick FCC boundary-after tests. + DELTA_TCCC_0=0, + DELTA_TCCC_1=2, + DELTA_TCCC_GT_1=4, + DELTA_TCCC_MASK=6, + DELTA_SHIFT=3, + + MAX_DELTA=0x40 + }; + + enum { + // Byte offsets from the start of the data, after the generic header. + IX_NORM_TRIE_OFFSET, + IX_EXTRA_DATA_OFFSET, + IX_SMALL_FCD_OFFSET, + IX_RESERVED3_OFFSET, + IX_RESERVED4_OFFSET, + IX_RESERVED5_OFFSET, + IX_RESERVED6_OFFSET, + IX_TOTAL_SIZE, + + // Code point thresholds for quick check codes. + IX_MIN_DECOMP_NO_CP, + IX_MIN_COMP_NO_MAYBE_CP, + + // Norm16 value thresholds for quick check combinations and types of extra data. + + /** Mappings & compositions in [minYesNo..minYesNoMappingsOnly[. */ + IX_MIN_YES_NO, + /** Mappings are comp-normalized. */ + IX_MIN_NO_NO, + IX_LIMIT_NO_NO, + IX_MIN_MAYBE_YES, + + /** Mappings only in [minYesNoMappingsOnly..minNoNo[. */ + IX_MIN_YES_NO_MAPPINGS_ONLY, + /** Mappings are not comp-normalized but have a comp boundary before. */ + IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE, + /** Mappings do not have a comp boundary before. */ + IX_MIN_NO_NO_COMP_NO_MAYBE_CC, + /** Mappings to the empty string. */ + IX_MIN_NO_NO_EMPTY, + + IX_MIN_LCCC_CP, + IX_RESERVED19, + IX_COUNT + }; + + enum { + MAPPING_HAS_CCC_LCCC_WORD=0x80, + MAPPING_HAS_RAW_MAPPING=0x40, + // unused bit 0x20, + MAPPING_LENGTH_MASK=0x1f + }; + + enum { + COMP_1_LAST_TUPLE=0x8000, + COMP_1_TRIPLE=1, + COMP_1_TRAIL_LIMIT=0x3400, + COMP_1_TRAIL_MASK=0x7ffe, + COMP_1_TRAIL_SHIFT=9, // 10-1 for the "triple" bit + COMP_2_TRAIL_SHIFT=6, + COMP_2_TRAIL_MASK=0xffc0 + }; + + // higher-level functionality ------------------------------------------ *** + + // NFD without an NFD Normalizer2 instance. + UnicodeString &decompose(const UnicodeString &src, UnicodeString &dest, + UErrorCode &errorCode) const; + /** + * Decomposes [src, limit[ and writes the result to dest. + * limit can be NULL if src is NUL-terminated. + * destLengthEstimate is the initial dest buffer capacity and can be -1. + */ + void decompose(const UChar *src, const UChar *limit, + UnicodeString &dest, int32_t destLengthEstimate, + UErrorCode &errorCode) const; + + const UChar *decompose(const UChar *src, const UChar *limit, + ReorderingBuffer *buffer, UErrorCode &errorCode) const; + void decomposeAndAppend(const UChar *src, const UChar *limit, + UBool doDecompose, + UnicodeString &safeMiddle, + ReorderingBuffer &buffer, + UErrorCode &errorCode) const; + + /** sink==nullptr: isNormalized()/spanQuickCheckYes() */ + const uint8_t *decomposeUTF8(uint32_t options, + const uint8_t *src, const uint8_t *limit, + ByteSink *sink, Edits *edits, UErrorCode &errorCode) const; + + UBool compose(const UChar *src, const UChar *limit, + UBool onlyContiguous, + UBool doCompose, + ReorderingBuffer &buffer, + UErrorCode &errorCode) const; + const UChar *composeQuickCheck(const UChar *src, const UChar *limit, + UBool onlyContiguous, + UNormalizationCheckResult *pQCResult) const; + void composeAndAppend(const UChar *src, const UChar *limit, + UBool doCompose, + UBool onlyContiguous, + UnicodeString &safeMiddle, + ReorderingBuffer &buffer, + UErrorCode &errorCode) const; + + /** sink==nullptr: isNormalized() */ + UBool composeUTF8(uint32_t options, UBool onlyContiguous, + const uint8_t *src, const uint8_t *limit, + ByteSink *sink, icu::Edits *edits, UErrorCode &errorCode) const; + + const UChar *makeFCD(const UChar *src, const UChar *limit, + ReorderingBuffer *buffer, UErrorCode &errorCode) const; + void makeFCDAndAppend(const UChar *src, const UChar *limit, + UBool doMakeFCD, + UnicodeString &safeMiddle, + ReorderingBuffer &buffer, + UErrorCode &errorCode) const; + + UBool hasDecompBoundaryBefore(UChar32 c) const; + UBool norm16HasDecompBoundaryBefore(uint16_t norm16) const; + UBool hasDecompBoundaryAfter(UChar32 c) const; + UBool norm16HasDecompBoundaryAfter(uint16_t norm16) const; + UBool isDecompInert(UChar32 c) const { return isDecompYesAndZeroCC(getNorm16(c)); } + + UBool hasCompBoundaryBefore(UChar32 c) const { + return c=minMaybeYes; } + static UBool isInert(uint16_t norm16) { return norm16==INERT; } + static UBool isJamoL(uint16_t norm16) { return norm16==JAMO_L; } + static UBool isJamoVT(uint16_t norm16) { return norm16==JAMO_VT; } + uint16_t hangulLVT() const { return minYesNoMappingsOnly|HAS_COMP_BOUNDARY_AFTER; } + UBool isHangulLV(uint16_t norm16) const { return norm16==minYesNo; } + UBool isHangulLVT(uint16_t norm16) const { + return norm16==hangulLVT(); + } + UBool isCompYesAndZeroCC(uint16_t norm16) const { return norm16=MIN_YES_YES_WITH_CC || norm16=limitNoNo; } + + // For use with isCompYes(). + // Perhaps the compiler can combine the two tests for MIN_YES_YES_WITH_CC. + // static uint8_t getCCFromYes(uint16_t norm16) { + // return norm16>=MIN_YES_YES_WITH_CC ? getCCFromNormalYesOrMaybe(norm16) : 0; + // } + uint8_t getCCFromNoNo(uint16_t norm16) const { + const uint16_t *mapping=getMapping(norm16); + if(*mapping&MAPPING_HAS_CCC_LCCC_WORD) { + return (uint8_t)*(mapping-1); + } else { + return 0; + } + } + // requires that the [cpStart..cpLimit[ character passes isCompYesAndZeroCC() + uint8_t getTrailCCFromCompYesAndZeroCC(uint16_t norm16) const { + if(norm16<=minYesNo) { + return 0; // yesYes and Hangul LV have ccc=tccc=0 + } else { + // For Hangul LVT we harmlessly fetch a firstUnit with tccc=0 here. + return (uint8_t)(*getMapping(norm16)>>8); // tccc from yesNo + } + } + uint8_t getPreviousTrailCC(const UChar *start, const UChar *p) const; + uint8_t getPreviousTrailCC(const uint8_t *start, const uint8_t *p) const; + + // Requires algorithmic-NoNo. + UChar32 mapAlgorithmic(UChar32 c, uint16_t norm16) const { + return c+(norm16>>DELTA_SHIFT)-centerNoNoDelta; + } + UChar32 getAlgorithmicDelta(uint16_t norm16) const { + return (norm16>>DELTA_SHIFT)-centerNoNoDelta; + } + + // Requires minYesNo>OFFSET_SHIFT); } + const uint16_t *getCompositionsListForDecompYes(uint16_t norm16) const { + if(norm16>OFFSET_SHIFT); + } + /** + * @param c code point must have compositions + * @return compositions list pointer + */ + const uint16_t *getCompositionsList(uint16_t norm16) const { + return isDecompYes(norm16) ? + getCompositionsListForDecompYes(norm16) : + getCompositionsListForComposite(norm16); + } + + const UChar *copyLowPrefixFromNulTerminated(const UChar *src, + UChar32 minNeedDataCP, + ReorderingBuffer *buffer, + UErrorCode &errorCode) const; + + enum StopAt { STOP_AT_LIMIT, STOP_AT_DECOMP_BOUNDARY, STOP_AT_COMP_BOUNDARY }; + + const UChar *decomposeShort(const UChar *src, const UChar *limit, + UBool stopAtCompBoundary, UBool onlyContiguous, + ReorderingBuffer &buffer, UErrorCode &errorCode) const; + UBool decompose(UChar32 c, uint16_t norm16, + ReorderingBuffer &buffer, UErrorCode &errorCode) const; + + const uint8_t *decomposeShort(const uint8_t *src, const uint8_t *limit, + StopAt stopAt, UBool onlyContiguous, + ReorderingBuffer &buffer, UErrorCode &errorCode) const; + + static int32_t combine(const uint16_t *list, UChar32 trail); + void addComposites(const uint16_t *list, UnicodeSet &set) const; + void recompose(ReorderingBuffer &buffer, int32_t recomposeStartIndex, + UBool onlyContiguous) const; + + UBool hasCompBoundaryBefore(UChar32 c, uint16_t norm16) const { + return c + * Note: Both properties include ASCII as well as non-ASCII, non-Latin-1 code points, + * and both properties only include BMP code points (no supplementary ones). + * Pattern_Syntax includes some unassigned code points. + *

+ * [:Pattern_White_Space:] = + * [\u0009-\u000D\ \u0085\u200E\u200F\u2028\u2029] + *

+ * [:Pattern_Syntax:] = + * [!-/\:-@\[-\^`\{-~\u00A1-\u00A7\u00A9\u00AB\u00AC\u00AE + * \u00B0\u00B1\u00B6\u00BB\u00BF\u00D7\u00F7 + * \u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E + * \u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F + * \u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46] + * @author mscherer + */ +class U_COMMON_API PatternProps { +public: + /** + * @return true if c is a Pattern_Syntax code point. + */ + static UBool isSyntax(UChar32 c); + + /** + * @return true if c is a Pattern_Syntax or Pattern_White_Space code point. + */ + static UBool isSyntaxOrWhiteSpace(UChar32 c); + + /** + * @return true if c is a Pattern_White_Space character. + */ + static UBool isWhiteSpace(UChar32 c); + + /** + * Skips over Pattern_White_Space starting at s. + * @return The smallest pointer at or after s with a non-white space character. + */ + static const UChar *skipWhiteSpace(const UChar *s, int32_t length); + + /** + * Skips over Pattern_White_Space starting at index start in s. + * @return The smallest index at or after start with a non-white space character. + */ + static int32_t skipWhiteSpace(const UnicodeString &s, int32_t start); + + /** + * @return s except with leading and trailing Pattern_White_Space removed and length adjusted. + */ + static const UChar *trimWhiteSpace(const UChar *s, int32_t &length); + + /** + * Tests whether the string contains a "pattern identifier", that is, + * whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters. + * @return true if there are no Pattern_White_Space or Pattern_Syntax characters in s. + */ + static UBool isIdentifier(const UChar *s, int32_t length); + + /** + * Skips over a "pattern identifier" starting at index s. + * @return The smallest pointer at or after s with + * a Pattern_White_Space or Pattern_Syntax character. + */ + static const UChar *skipIdentifier(const UChar *s, int32_t length); + +private: + PatternProps(); // no constructor: all static methods +}; + +U_NAMESPACE_END + +#endif // __PATTERNPROPS_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/pluralmap.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/pluralmap.h new file mode 100644 index 0000000000000000000000000000000000000000..2a14a07af1fcdfba8019c9ff135ec82c662b9422 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/pluralmap.h @@ -0,0 +1,292 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2015, International Business Machines Corporation and +* others. All Rights Reserved. +****************************************************************************** +* +* File pluralmap.h - PluralMap class that maps plural categories to values. +****************************************************************************** +*/ + +#ifndef __PLURAL_MAP_H__ +#define __PLURAL_MAP_H__ + +#include "unicode/uobject.h" +#include "cmemory.h" + +U_NAMESPACE_BEGIN + +class UnicodeString; + +class U_COMMON_API PluralMapBase : public UMemory { +public: + /** + * The names of all the plural categories. NONE is not an actual plural + * category, but rather represents the absence of a plural category. + */ + enum Category { + NONE = -1, + OTHER, + ZERO, + ONE, + TWO, + FEW, + MANY, + CATEGORY_COUNT + }; + + /** + * Converts a category name such as "zero", "one", "two", "few", "many" + * or "other" to a category enum. Returns NONE for an unrecognized + * category name. + */ + static Category toCategory(const char *categoryName); + + /** + * Converts a category name such as "zero", "one", "two", "few", "many" + * or "other" to a category enum. Returns NONE for urecongized + * category name. + */ + static Category toCategory(const UnicodeString &categoryName); + + /** + * Converts a category to a name. + * Passing NONE or CATEGORY_COUNT for category returns NULL. + */ + static const char *getCategoryName(Category category); +}; + +/** + * A Map of plural categories to values. It maintains ownership of the + * values. + * + * Type T is the value type. T must provide the followng: + * 1) Default constructor + * 2) Copy constructor + * 3) Assignment operator + * 4) Must extend UMemory + */ +template +class PluralMap : public PluralMapBase { +public: + /** + * Other category is maps to a copy of the default value. + */ + PluralMap() : fOtherVariant() { + initializeNew(); + } + + /** + * Other category is mapped to otherVariant. + */ + PluralMap(const T &otherVariant) : fOtherVariant(otherVariant) { + initializeNew(); + } + + PluralMap(const PluralMap &other) : fOtherVariant(other.fOtherVariant) { + fVariants[0] = &fOtherVariant; + for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) { + fVariants[i] = other.fVariants[i] ? + new T(*other.fVariants[i]) : NULL; + } + } + + PluralMap &operator=(const PluralMap &other) { + if (this == &other) { + return *this; + } + for (int32_t i = 0; i < UPRV_LENGTHOF(fVariants); ++i) { + if (fVariants[i] != NULL && other.fVariants[i] != NULL) { + *fVariants[i] = *other.fVariants[i]; + } else if (fVariants[i] != NULL) { + delete fVariants[i]; + fVariants[i] = NULL; + } else if (other.fVariants[i] != NULL) { + fVariants[i] = new T(*other.fVariants[i]); + } else { + // do nothing + } + } + return *this; + } + + ~PluralMap() { + for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) { + delete fVariants[i]; + } + } + + /** + * Removes all mappings and makes 'other' point to the default value. + */ + void clear() { + *fVariants[0] = T(); + for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) { + delete fVariants[i]; + fVariants[i] = NULL; + } + } + + /** + * Iterates through the mappings in this instance, set index to NONE + * prior to using. Call next repeatedly to get the values until it + * returns NULL. Each time next returns, caller may pass index + * to getCategoryName() to get the name of the plural category. + * When this function returns NULL, index is CATEGORY_COUNT + */ + const T *next(Category &index) const { + int32_t idx = index; + ++idx; + for (; idx < UPRV_LENGTHOF(fVariants); ++idx) { + if (fVariants[idx] != NULL) { + index = static_cast(idx); + return fVariants[idx]; + } + } + index = static_cast(idx); + return NULL; + } + + /** + * non const version of next. + */ + T *nextMutable(Category &index) { + const T *result = next(index); + return const_cast(result); + } + + /** + * Returns the 'other' variant. + * Same as calling get(OTHER). + */ + const T &getOther() const { + return get(OTHER); + } + + /** + * Returns the value associated with a category. + * If no value found, or v is NONE or CATEGORY_COUNT, falls + * back to returning the value for the 'other' category. + */ + const T &get(Category v) const { + int32_t index = v; + if (index < 0 || index >= UPRV_LENGTHOF(fVariants) || fVariants[index] == NULL) { + return *fVariants[0]; + } + return *fVariants[index]; + } + + /** + * Convenience routine to get the value by category name. Otherwise + * works just like get(Category). + */ + const T &get(const char *category) const { + return get(toCategory(category)); + } + + /** + * Convenience routine to get the value by category name as a + * UnicodeString. Otherwise works just like get(category). + */ + const T &get(const UnicodeString &category) const { + return get(toCategory(category)); + } + + /** + * Returns a pointer to the value associated with a category + * that caller can safely modify. If the value was defaulting to the 'other' + * variant because no explicit value was stored, this method creates a + * new value using the default constructor at the returned pointer. + * + * @param category the category with the value to change. + * @param status error returned here if index is NONE or CATEGORY_COUNT + * or memory could not be allocated, or any other error happens. + */ + T *getMutable( + Category category, + UErrorCode &status) { + return getMutable(category, NULL, status); + } + + /** + * Convenience routine to get a mutable pointer to a value by category name. + * Otherwise works just like getMutable(Category, UErrorCode &). + * reports an error if the category name is invalid. + */ + T *getMutable( + const char *category, + UErrorCode &status) { + return getMutable(toCategory(category), NULL, status); + } + + /** + * Just like getMutable(Category, UErrorCode &) but copies defaultValue to + * returned pointer if it was defaulting to the 'other' variant + * because no explicit value was stored. + */ + T *getMutableWithDefault( + Category category, + const T &defaultValue, + UErrorCode &status) { + return getMutable(category, &defaultValue, status); + } + + /** + * Returns true if this object equals rhs. + */ + UBool equals( + const PluralMap &rhs, + UBool (*eqFunc)(const T &, const T &)) const { + for (int32_t i = 0; i < UPRV_LENGTHOF(fVariants); ++i) { + if (fVariants[i] == rhs.fVariants[i]) { + continue; + } + if (fVariants[i] == NULL || rhs.fVariants[i] == NULL) { + return false; + } + if (!eqFunc(*fVariants[i], *rhs.fVariants[i])) { + return false; + } + } + return true; + } + +private: + T fOtherVariant; + T* fVariants[6]; + + T *getMutable( + Category category, + const T *defaultValue, + UErrorCode &status) { + if (U_FAILURE(status)) { + return NULL; + } + int32_t index = category; + if (index < 0 || index >= UPRV_LENGTHOF(fVariants)) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return NULL; + } + if (fVariants[index] == NULL) { + fVariants[index] = defaultValue == NULL ? + new T() : new T(*defaultValue); + } + if (!fVariants[index]) { + status = U_MEMORY_ALLOCATION_ERROR; + } + return fVariants[index]; + } + + void initializeNew() { + fVariants[0] = &fOtherVariant; + for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) { + fVariants[i] = NULL; + } + } +}; + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/propname.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/propname.h new file mode 100644 index 0000000000000000000000000000000000000000..1a8ced5b87906226887f00b1d136e8f4aa0177e9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/propname.h @@ -0,0 +1,212 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2011, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: October 30 2002 +* Since: ICU 2.4 +* 2010nov19 Markus Scherer Rewrite for formatVersion 2. +********************************************************************** +*/ +#ifndef PROPNAME_H +#define PROPNAME_H + +#include "unicode/utypes.h" +#include "unicode/bytestrie.h" +#include "unicode/uchar.h" +#include "udataswp.h" +#include "uprops.h" + +/* + * This header defines the in-memory layout of the property names data + * structure representing the UCD data files PropertyAliases.txt and + * PropertyValueAliases.txt. It is used by: + * propname.cpp - reads data + * genpname - creates data + */ + +/* low-level char * property name comparison -------------------------------- */ + +U_CDECL_BEGIN + +/** + * \var uprv_comparePropertyNames + * Unicode property names and property value names are compared "loosely". + * + * UCD.html 4.0.1 says: + * For all property names, property value names, and for property values for + * Enumerated, Binary, or Catalog properties, use the following + * loose matching rule: + * + * LM3. Ignore case, whitespace, underscore ('_'), and hyphens. + * + * This function does just that, for (char *) name strings. + * It is almost identical to ucnv_compareNames() but also ignores + * C0 White_Space characters (U+0009..U+000d, and U+0085 on EBCDIC). + * + * @internal + */ + +U_CAPI int32_t U_EXPORT2 +uprv_compareASCIIPropertyNames(const char *name1, const char *name2); + +U_CAPI int32_t U_EXPORT2 +uprv_compareEBCDICPropertyNames(const char *name1, const char *name2); + +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define uprv_comparePropertyNames uprv_compareASCIIPropertyNames +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define uprv_comparePropertyNames uprv_compareEBCDICPropertyNames +#else +# error U_CHARSET_FAMILY is not valid +#endif + +U_CDECL_END + +/* UDataMemory structure and signatures ------------------------------------- */ + +#define PNAME_DATA_NAME "pnames" +#define PNAME_DATA_TYPE "icu" + +/* Fields in UDataInfo: */ + +/* PNAME_SIG[] is encoded as numeric literals for compatibility with the HP compiler */ +#define PNAME_SIG_0 ((uint8_t)0x70) /* p */ +#define PNAME_SIG_1 ((uint8_t)0x6E) /* n */ +#define PNAME_SIG_2 ((uint8_t)0x61) /* a */ +#define PNAME_SIG_3 ((uint8_t)0x6D) /* m */ + +U_NAMESPACE_BEGIN + +class PropNameData { +public: + enum { + // Byte offsets from the start of the data, after the generic header. + IX_VALUE_MAPS_OFFSET, + IX_BYTE_TRIES_OFFSET, + IX_NAME_GROUPS_OFFSET, + IX_RESERVED3_OFFSET, + IX_RESERVED4_OFFSET, + IX_TOTAL_SIZE, + + // Other values. + IX_MAX_NAME_LENGTH, + IX_RESERVED7, + IX_COUNT + }; + + static const char *getPropertyName(int32_t property, int32_t nameChoice); + static const char *getPropertyValueName(int32_t property, int32_t value, int32_t nameChoice); + + static int32_t getPropertyEnum(const char *alias); + static int32_t getPropertyValueEnum(int32_t property, const char *alias); + +private: + static int32_t findProperty(int32_t property); + static int32_t findPropertyValueNameGroup(int32_t valueMapIndex, int32_t value); + static const char *getName(const char *nameGroup, int32_t nameIndex); + static UBool containsName(BytesTrie &trie, const char *name); + + static int32_t getPropertyOrValueEnum(int32_t bytesTrieOffset, const char *alias); + + static const int32_t indexes[]; + static const int32_t valueMaps[]; + static const uint8_t bytesTries[]; + static const char nameGroups[]; +}; + +/* + * pnames.icu formatVersion 2 + * + * formatVersion 2 is new in ICU 4.8. + * In ICU 4.8, the pnames.icu data file is used only in ICU4J. + * ICU4C 4.8 has the same data structures hardcoded in source/common/propname_data.h. + * + * For documentation of pnames.icu formatVersion 1 see ICU4C 4.6 (2010-dec-01) + * or earlier versions of this header file (source/common/propname.h). + * + * The pnames.icu begins with the standard ICU DataHeader/UDataInfo. + * After that: + * + * int32_t indexes[8]; + * + * (See the PropNameData::IX_... constants.) + * + * The first 6 indexes are byte offsets from the beginning of the data + * (beginning of indexes[]) to following structures. + * The length of each structure is the difference between its offset + * and the next one. + * All offsets are filled in: Where there is no data between two offsets, + * those two offsets are the same. + * The last offset (indexes[PropNameData::IX_TOTAL_SIZE]) indicates the + * total number of bytes in the file. (Not counting the standard headers.) + * + * The sixth index (indexes[PropNameData::IX_MAX_NAME_LENGTH]) has the + * maximum length of any Unicode property (or property value) alias. + * (Without normalization, that is, including underscores etc.) + * + * int32_t valueMaps[]; + * + * The valueMaps[] begins with a map from UProperty enums to properties, + * followed by the per-property value maps from property values to names, + * for those properties that have named values. + * (Binary & enumerated, plus General_Category_Mask.) + * + * valueMaps[0] contains the number of UProperty enum ranges. + * For each range: + * int32_t start, limit -- first and last+1 UProperty enum of a dense range + * Followed by (limit-start) pairs of + * int32_t nameGroupOffset; + * Offset into nameGroups[] for the property's names/aliases. + * int32_t valueMapIndex; + * Offset of the property's value map in the valueMaps[] array. + * If the valueMapIndex is 0, then the property does not have named values. + * + * For each property's value map: + * int32_t bytesTrieOffset; -- Offset into bytesTries[] for name->value mapping. + * int32_t numRanges; + * If numRanges is in the range 1..15, then that many ranges of values follow. + * Per range: + * int32_t start, limit -- first and last+1 UProperty enum of a range + * Followed by (limit-start) entries of + * int32_t nameGroupOffset; + * Offset into nameGroups[] for the property value's names/aliases. + * If the nameGroupOffset is 0, then this is not a named value for this property. + * (That is, the ranges need not be dense.) + * If numRanges is >=0x10, then (numRanges-0x10) sorted values + * and then (numRanges-0x10) corresponding nameGroupOffsets follow. + * Values are sorted as signed integers. + * In this case, the set of values is dense; no nameGroupOffset will be 0. + * + * For both properties and property values, ranges are sorted by their start/limit values. + * + * uint8_t bytesTries[]; + * + * This is a sequence of BytesTrie structures, byte-serialized tries for + * mapping from names/aliases to values. + * The first one maps from property names/aliases to UProperty enum constants. + * The following ones are indexed by property value map bytesTrieOffsets + * for mapping each property's names/aliases to their property values. + * + * char nameGroups[]; + * + * This is a sequence of property name groups. + * Each group is a list of names/aliases (invariant-character strings) for + * one property or property value, in the order of UCharNameChoice. + * The first byte of each group is the number of names in the group. + * It is followed by that many NUL-terminated strings. + * The first string is for the short name; if there is no short name, + * then the first string is empty. + * The second string is the long name. Further strings are additional aliases. + * + * The first name group is for a property rather than a property value, + * so that a nameGroupOffset of 0 can be used to indicate "no value" + * in a property's sparse value ranges. + */ + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/propname_data.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/propname_data.h new file mode 100644 index 0000000000000000000000000000000000000000..6f63e9cdd476ceb1d774b521d00a1adeac32f08a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/propname_data.h @@ -0,0 +1,1919 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// Copyright (C) 1999-2016, International Business Machines +// Corporation and others. All Rights Reserved. +// +// file name: propname_data.h +// +// machine-generated by: icu/tools/unicode/c/genprops/pnamesbuilder.cpp + + +#ifdef INCLUDED_FROM_PROPNAME_CPP + +U_NAMESPACE_BEGIN + +const int32_t PropNameData::indexes[8]={0x20,0x15b8,0x5048,0xa69a,0xa69a,0xa69a,0x2f,0}; + +const int32_t PropNameData::valueMaps[1382]={ +6,0,0x41,0,0xe3,0x368,0xe3,0x37e,0xe3,0x393,0xe3,0x3a9,0xe3,0x3b4,0xe3,0x3d5, +0xe3,0x3e5,0xe3,0x3f4,0xe3,0x402,0xe3,0x426,0xe3,0x43d,0xe3,0x455,0xe3,0x46c,0xe3,0x47b, +0xe3,0x48a,0xe3,0x49b,0xe3,0x4a9,0xe3,0x4bb,0xe3,0x4d5,0xe3,0x4f0,0xe3,0x505,0xe3,0x522, +0xe3,0x533,0xe3,0x53e,0xe3,0x55d,0xe3,0x573,0xe3,0x584,0xe3,0x594,0xe3,0x5af,0xe3,0x5c8, +0xe3,0x5d9,0xe3,0x5f3,0xe3,0x606,0xe3,0x616,0xe3,0x630,0xe3,0x649,0xe3,0x660,0xe3,0x674, +0xe3,0x68a,0xe3,0x69e,0xe3,0x6b4,0xe3,0x6ce,0xe3,0x6e6,0xe3,0x702,0xe3,0x70a,0xe3,0x712, +0xe3,0x71a,0xe3,0x722,0xe3,0x72b,0xe3,0x738,0xe3,0x74b,0xe3,0x768,0xe3,0x785,0xe3,0x7a2, +0xe3,0x7c0,0xe3,0x7de,0xe3,0x802,0xe3,0x80f,0xe3,0x829,0xe3,0x83e,0xe3,0x859,0xe3,0x870, +0xe3,0x887,0xe3,0x8a9,0xe3,0x1000,0x1019,0x8c8,0x15f,0xae8,0x17a,0x2f11,0xe9,0x2f30,0x2b3,0x306e, +0x2c9,0x30c8,0x2d3,0x3325,0x2f5,0x3c20,0x35f,0x3c90,0x369,0x3f2a,0x398,0x3f68,0x3a0,0x4a5b,0x465,0x4ad9, +0x46f,0x4afe,0x475,0x4b18,0x47b,0x4b39,0x482,0x4b53,0xe9,0x4b78,0xe9,0x4b9e,0x489,0x4c48,0x49f,0x4cc1, +0x4b2,0x4d73,0x4cd,0x4daa,0x4d4,0x4f8a,0x4e8,0x540a,0x510,0x2000,0x2001,0x5469,0x518,0x3000,0x3001,0x54f5, +0,0x4000,0x400e,0x5507,0,0x5510,0,0x552a,0,0x553b,0,0x554c,0,0x5562,0,0x556b, +0,0x5588,0,0x55a6,0,0x55c4,0,0x55e2,0,0x55f8,0,0x560c,0,0x5622,0,0x7000, +0x7001,0x563b,0,0x7d6,0x12,0,1,0x12,0x20,0x7f4,0x4a,0,1,6,7,8, +9,0xa,0xb,0xc,0xd,0xe,0xf,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18, +0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x54,0x5b,0x67,0x6b, +0x76,0x7a,0x81,0x82,0x84,0x85,0xc8,0xca,0xd6,0xd8,0xda,0xdc,0xde,0xe0,0xe2,0xe4, +0xe6,0xe8,0xe9,0xea,0xf0,0x2e,0x40,0x4c,0x5e,0x68,0x79,0x84,0x91,0x9e,0xab,0xb8, +0xc5,0xd2,0xdf,0xec,0xf9,0x106,0x113,0x120,0x12d,0x13a,0x147,0x154,0x161,0x16e,0x17b,0x188, +0x195,0x1a2,0x1af,0x1bc,0x1c9,0x1d6,0x1e3,0x1f0,0x1fd,0x20c,0x21b,0x22a,0x239,0x248,0x257,0x266, +0x275,0x28f,0x2a3,0x2b7,0x2d2,0x2e1,0x2ea,0x2fa,0x302,0x30b,0x31a,0x323,0x333,0x344,0x355,0x995, +1,0,0x17,0x8d7,0x8e8,0x8f9,0x90d,0x924,0x93c,0x94e,0x963,0x97a,0x98f,0x99f,0x9b1,0x9ce, +0x9ea,0x9fc,0xa19,0xa35,0xa51,0xa66,0xa7b,0xa95,0xab0,0xacb,0xb37,1,0,0x135,0xaf3,0xb00, +0xb13,0xb3b,0xb59,0xb77,0xb8f,0xbba,0xbe4,0xbfc,0xc0f,0xc22,0xc31,0xc40,0xc4f,0xc5e,0xc75,0xc86, +0xc99,0xcac,0xcb9,0xcc6,0xcd5,0xce6,0xcfb,0xd0c,0xd17,0xd20,0xd31,0xd42,0xd55,0xd67,0xd7a,0xd8d, +0xdcc,0xdd9,0xde6,0xdf3,0xe08,0xe38,0xe52,0xe73,0xe9e,0xec1,0xf1f,0xf46,0xf61,0xf70,0xf97,0xfbf, +0xfe2,0x1005,0x102f,0x1048,0x1067,0x108a,0x10ae,0x10c1,0x10db,0x1105,0x111d,0x1145,0x116e,0x1181,0x1194,0x11a7, +0x11ce,0x11dd,0x11fd,0x122b,0x1249,0x1277,0x1293,0x12ae,0x12c7,0x12e0,0x1301,0x1331,0x1350,0x1372,0x13a6,0x13d3, +0x1418,0x1439,0x1463,0x1484,0x14ad,0x14c0,0x14f3,0x150a,0x1519,0x152a,0x1555,0x156c,0x159d,0x15cb,0x160e,0x1619, +0x1652,0x1663,0x1674,0x1681,0x1694,0x16ce,0x16f2,0x1716,0x1750,0x1788,0x17b3,0x17cb,0x17f7,0x1823,0x1830,0x183f, +0x185c,0x187e,0x18ac,0x18cc,0x18f3,0x191a,0x1939,0x194c,0x195d,0x196e,0x1993,0x19b8,0x19df,0x1a13,0x1a40,0x1a5e, +0x1a71,0x1a8a,0x1ac3,0x1ad2,0x1af2,0x1b14,0x1b36,0x1b4d,0x1b64,0x1b91,0x1baa,0x1bc3,0x1bf4,0x1c1e,0x1c39,0x1c4c, +0x1c6b,0x1c74,0x1c87,0x1ca5,0x1cc3,0x1cd6,0x1ced,0x1d02,0x1d37,0x1d5b,0x1d70,0x1d7f,0x1d92,0x1db6,0x1dbf,0x1de3, +0x1dfa,0x1e0d,0x1e1c,0x1e27,0x1e48,0x1e60,0x1e6f,0x1e7e,0x1e8d,0x1ea4,0x1eb9,0x1ece,0x1f07,0x1f1a,0x1f36,0x1f41, +0x1f4e,0x1f7c,0x1fa0,0x1fc3,0x1fd6,0x1ff8,0x200b,0x2026,0x2049,0x206c,0x2091,0x20a2,0x20d1,0x20fe,0x2115,0x2130, +0x213f,0x216a,0x21a2,0x21dc,0x220a,0x221b,0x2228,0x224c,0x225b,0x2277,0x2291,0x22ae,0x22e6,0x22fb,0x2328,0x2347, +0x2375,0x2395,0x23c9,0x23d8,0x2402,0x2425,0x2450,0x245b,0x246c,0x2487,0x24ab,0x24b8,0x24cd,0x24f4,0x251f,0x2556, +0x2569,0x257a,0x25aa,0x25bb,0x25ca,0x25df,0x25fd,0x2610,0x2623,0x263a,0x2657,0x2662,0x266b,0x268d,0x26a2,0x26c7, +0x26de,0x2707,0x2722,0x2737,0x2750,0x2771,0x27a6,0x27b7,0x27e8,0x280c,0x281d,0x2836,0x2841,0x286e,0x2890,0x28be, +0x28f1,0x2900,0x2911,0x292e,0x2970,0x2997,0x29a4,0x29b9,0x29dd,0x2a03,0x2a3c,0x2a4d,0x2a71,0x2a7c,0x2a89,0x2a98, +0x2abd,0x2aeb,0x2b07,0x2b24,0x2b31,0x2b42,0x2b60,0x2b83,0x2ba0,0x2bad,0x2bcd,0x2bea,0x2c0b,0x2c34,0x2c45,0x2c64, +0x2c7d,0x2c96,0x2ca7,0x2cf0,0x2d01,0x2d1a,0x2d49,0x2d76,0x2d9b,0x2ddd,0x2df9,0x2e08,0x2e1f,0x2e4d,0x2e66,0x2e8f, +0x2ea9,0x2ee4,0x2f02,0x1e85,1,0,0x12,0x2f47,0x2f57,0x2f6a,0x2f7a,0x2f8a,0x2f99,0x2fa9,0x2fbb,0x2fce, +0x2fe0,0x2ff0,0x3000,0x300f,0x301e,0x302e,0x303b,0x304a,0x305e,0x1f43,1,0,6,0x3083,0x308e,0x309b, +0x30a8,0x30b5,0x30c0,0x1f87,1,0,0x1e,0x30dd,0x30ec,0x3101,0x3116,0x312b,0x313f,0x3150,0x3164,0x3177, +0x3188,0x31a1,0x31b3,0x31c4,0x31d8,0x31eb,0x3203,0x3215,0x3220,0x3230,0x323e,0x3253,0x3268,0x327e,0x3298,0x32ae, +0x32be,0x32d2,0x32e6,0x32f7,0x330f,0x21b2,1,0,0x66,0x3337,0x335a,0x3363,0x3370,0x337b,0x3384,0x338f, +0x3398,0x33b1,0x33b6,0x33bf,0x33dc,0x33e5,0x33f2,0x33fb,0x341f,0x3426,0x342f,0x3442,0x344d,0x3456,0x3461,0x347a, +0x3483,0x3492,0x349d,0x34a6,0x34b1,0x34ba,0x34c1,0x34ca,0x34d5,0x34de,0x34f7,0x3500,0x350d,0x3518,0x3529,0x3534, +0x3549,0x3560,0x3569,0x3572,0x358b,0x3596,0x359f,0x35a8,0x35bf,0x35dc,0x35e7,0x35f8,0x3603,0x360a,0x3617,0x3624, +0x3651,0x3666,0x366f,0x368a,0x36ad,0x36ce,0x36ef,0x3714,0x373b,0x375c,0x377f,0x37a0,0x37c7,0x37e8,0x380d,0x382c, +0x384b,0x386a,0x3887,0x38a8,0x38c9,0x38ec,0x3911,0x3930,0x394f,0x3970,0x3997,0x39bc,0x39db,0x39fc,0x3a1f,0x3a3a, +0x3a53,0x3a6e,0x3a87,0x3aa4,0x3abf,0x3adc,0x3afb,0x3b18,0x3b35,0x3b54,0x3b71,0x3b8c,0x3ba9,0x3bc6,0x3bf9,0x24f7, +1,0,6,0x3c31,0x3c40,0x3c50,0x3c60,0x3c70,0x3c81,0x2555,1,0,0x2b,0x3c9f,0x3cab,0x3cb9, +0x3cc8,0x3cd7,0x3ce7,0x3cf8,0x3d0c,0x3d21,0x3d37,0x3d4a,0x3d5e,0x3d6e,0x3d77,0x3d82,0x3d92,0x3dae,0x3dc0,0x3dce, +0x3ddd,0x3de9,0x3dfe,0x3e12,0x3e25,0x3e33,0x3e47,0x3e55,0x3e5f,0x3e71,0x3e7d,0x3e8b,0x3e9b,0x3ea2,0x3ea9,0x3eb0, +0x3eb7,0x3ebe,0x3ed4,0x3ef5,0x870,0x3f07,0x3f12,0x3f21,0x27ae,1,0,4,0x3f3b,0x3f46,0x3f52,0x3f5c, +0x27d4,1,0,0xc1,0x3f73,0x3f80,0x3f95,0x3fa2,0x3fb1,0x3fbf,0x3fce,0x3fdd,0x3fef,0x3ffe,0x400c,0x401d, +0x402c,0x403b,0x4048,0x4054,0x4063,0x4072,0x407c,0x4089,0x4096,0x40a5,0x40b3,0x40c2,0x40ce,0x40d8,0x40e4,0x40f4, +0x4104,0x4112,0x411e,0x412f,0x413b,0x4147,0x4155,0x4162,0x416e,0x417b,0xd0c,0x4188,0x4196,0x41b0,0x41b9,0x41c7, +0x41d5,0x41e1,0x41f0,0x41fe,0x420c,0x4218,0x4227,0x4235,0x4243,0x4250,0x425f,0x427a,0x4289,0x429a,0x42ab,0x42be, +0x42d0,0x42df,0x42f1,0x4300,0x430c,0x4317,0x1e1c,0x4324,0x432f,0x433a,0x4345,0x4350,0x436b,0x4376,0x4381,0x438c, +0x439f,0x43b3,0x43be,0x43cd,0x43dc,0x43e7,0x43f2,0x43ff,0x440e,0x441c,0x4427,0x4442,0x444c,0x445d,0x446e,0x447d, +0x448e,0x4499,0x44a4,0x44af,0x44ba,0x44c5,0x44d0,0x44db,0x44e5,0x44f0,0x4500,0x450b,0x4519,0x4526,0x4531,0x4540, +0x454d,0x455a,0x4569,0x4576,0x4587,0x4599,0x45a9,0x45b4,0x45c7,0x45de,0x45ec,0x45f9,0x4604,0x4611,0x4622,0x463e, +0x4654,0x465f,0x467c,0x468c,0x469b,0x46a6,0x46b1,0x1f36,0x46bd,0x46c8,0x46e0,0x46f0,0x46ff,0x470d,0x471b,0x4726, +0x4731,0x4745,0x475c,0x4774,0x4784,0x4794,0x47a4,0x47b6,0x47c1,0x47cc,0x47d6,0x47e2,0x47f0,0x4803,0x480f,0x481c, +0x4827,0x4843,0x4850,0x485e,0x4877,0x2836,0x4886,0x2657,0x4893,0x48a1,0x48b3,0x48c1,0x48cd,0x48dd,0x2a71,0x48eb, +0x48f7,0x4902,0x490d,0x4918,0x492c,0x493a,0x4951,0x495d,0x4971,0x497f,0x4991,0x49a7,0x49b5,0x49c7,0x49d5,0x49f2, +0x4a04,0x4a11,0x4a22,0x4a34,0x4a4e,0x31cc,1,0,6,0x4a75,0x4a88,0x4a98,0x4aa6,0x4ab7,0x4ac7,0x3228, +0x12,0,1,0x4af1,0x4af7,0x3235,0x12,0,1,0x4af1,0x4af7,0x3242,1,0,3,0x4af1, +0x4af7,0x4b30,0x3258,1,0,3,0x4af1,0x4af7,0x4b30,0x326e,1,0,0x12,0x4bba,0x4bc4,0x4bd0, +0x4bd7,0x4be2,0x4be7,0x4bee,0x4bf5,0x4bfe,0x4c03,0x4c08,0x4c18,0x870,0x3f07,0x4c24,0x3f12,0x4c34,0x3f21,0x3317, +1,0,0xf,0x4bba,0x4c5b,0x4c65,0x4c6f,0x4c7a,0x3ddd,0x4c84,0x4c90,0x4c98,0x4c9f,0x4ca9,0x4bd0,0x4bd7, +0x4be7,0x4cb3,0x339e,1,0,0x17,0x4bba,0x4cd0,0x4c6f,0x4cdc,0x4ce9,0x4cf7,0x3ddd,0x4d02,0x4bd0,0x4d13, +0x4be7,0x4d22,0x4d30,0x870,0x3ef5,0x4d3c,0x4d4d,0x3f07,0x4c24,0x3f12,0x4c34,0x3f21,0x4d5e,0x34bb,1,0, +3,0x4d91,0x4d99,0x4da1,0x34d4,1,0,0x10,0x4dca,0x4dd1,0x4de0,0x4e01,0x4e24,0x4e2f,0x4e4e,0x4e65, +0x4e72,0x4e7b,0x4e9a,0x4ecd,0x4ee8,0x4f17,0x4f34,0x4f59,0x356d,1,0,0x24,0x4fa8,0x4fb5,0x4fc8,0x4fd5, +0x5002,0x5027,0x503c,0x505b,0x507c,0x50a9,0x50e2,0x5105,0x5128,0x5155,0x518a,0x51b1,0x51da,0x5211,0x5240,0x5261, +0x5286,0x5295,0x52b8,0x52cf,0x52dc,0x52eb,0x5308,0x5321,0x5344,0x5369,0x5382,0x5397,0x53a6,0x53b7,0x53c4,0x53e5, +0x373d,1,0,4,0x5423,0x542e,0x5446,0x545e,0x3779,0x36,1,2,4,8,0xe,0x10, +0x20,0x3e,0x40,0x80,0x100,0x1c0,0x200,0x400,0x800,0xe00,0x1000,0x2000,0x4000,0x7000,0x8000,0x10000, +0x20000,0x40000,0x78001,0x80000,0x100000,0x200000,0x400000,0x800000,0x1000000,0x2000000,0x4000000,0x8000000,0xf000000,0x10000000,0x20000000,0x30f80000, +0x30dd,0x30ec,0x3101,0x3116,0x5497,0x312b,0x313f,0x548d,0x3150,0x3164,0x3177,0x54a8,0x3188,0x31a1,0x31b3,0x54bf, +0x31c4,0x31d8,0x31eb,0x54e8,0x3203,0x3215,0x3220,0x3230,0x5484,0x323e,0x3253,0x3268,0x327e,0x3298,0x32ae,0x32be, +0x32d2,0x32e6,0x54de,0x32f7,0x330f,0x54c9 +}; + +const uint8_t PropNameData::bytesTries[14992]={ +0,0x15,0x6d,0xc3,0x78,0x73,0xc2,0x12,0x76,0x7a,0x76,0x6a,0x77,0xa2,0x52,0x78, +1,0x64,0x50,0x69,0x10,0x64,1,0x63,0x30,0x73,0x62,0x13,0x74,0x61,0x72,0x74, +0x63,0x60,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x61,0x13,0x69,0x67,0x69,0x74, +0x81,3,0x61,0x2e,0x65,0x4c,0x6f,0xc3,0x18,0x73,0x69,0x1e,0x72,0x69,0x61,0x74, +0x69,0x6f,0x6e,0x73,0x65,0x6c,0x65,0x63,0x74,0x6f,0x72,0x69,0x10,0x72,0x1f,0x74, +0x69,0x63,0x61,0x6c,0x6f,0x72,0x69,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0xc3, +0x18,3,0x62,0xc3,0x14,0x68,0x32,0x6f,0x42,0x73,0x13,0x70,0x61,0x63,0x65,0x5f, +0x17,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x5f,0x16,0x72,0x64,0x62,0x72,0x65, +0x61,0x6b,0xc3,0x14,0x73,0xa2,0x49,0x74,0xa4,0x3b,0x75,3,0x63,0xd9,0x40,0xc, +0x69,0x52,0x6e,0x58,0x70,0x12,0x70,0x65,0x72,0x5c,0x13,0x63,0x61,0x73,0x65,0x5c, +0x16,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,0xc,0x12,0x64,0x65,0x6f,0x5b, +0x10,0x69,1,0x63,0x3e,0x66,0x1b,0x69,0x65,0x64,0x69,0x64,0x65,0x6f,0x67,0x72, +0x61,0x70,0x68,0x5b,0x17,0x6f,0x64,0x65,0x31,0x6e,0x61,0x6d,0x65,0xd9,0x40,0xb, +0xa,0x69,0x84,0x70,0x19,0x70,0x30,0x74,0x36,0x75,0x10,0x63,0xd9,0x40,9,0x12, +0x61,0x63,0x65,0x5f,1,0x63,0xd9,0x40,8,0x65,0x11,0x72,0x6d,0x67,0x69,0x3c, +0x6c,0xa2,0x5f,0x6f,0x17,0x66,0x74,0x64,0x6f,0x74,0x74,0x65,0x64,0x57,0x13,0x6d, +0x70,0x6c,0x65,3,0x63,0x50,0x6c,0x68,0x74,0x8a,0x75,0x1e,0x70,0x70,0x65,0x72, +0x63,0x61,0x73,0x65,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,9,0x19,0x61, +0x73,0x65,0x66,0x6f,0x6c,0x64,0x69,0x6e,0x67,0xd9,0x40,6,0x1e,0x6f,0x77,0x65, +0x72,0x63,0x61,0x73,0x65,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,7,0x1e, +0x69,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9, +0x40,8,0x10,0x63,0xd9,0x40,7,0x62,0xc3,0x13,0x63,0x34,0x64,0x57,0x65,0x6e, +0x66,0x10,0x63,0xd9,0x40,6,0xc2,0xa,2,0x66,0xd9,0x40,6,0x72,0x28,0x78, +0xd9,0x70,0,0x12,0x69,0x70,0x74,0xc2,0xa,0x19,0x65,0x78,0x74,0x65,0x6e,0x73, +0x69,0x6f,0x6e,0x73,0xd9,0x70,0,1,0x67,0x6a,0x6e,1,0x73,0x54,0x74,0x13, +0x65,0x6e,0x63,0x65,1,0x62,0x34,0x74,0x16,0x65,0x72,0x6d,0x69,0x6e,0x61,0x6c, +0x67,0x13,0x72,0x65,0x61,0x6b,0xc3,0x13,0x14,0x69,0x74,0x69,0x76,0x65,0x65,1, +0x6d,0x2e,0x73,0x13,0x74,0x61,0x72,0x74,0x73,0x19,0x65,0x6e,0x74,0x73,0x74,0x61, +0x72,0x74,0x65,0x72,0x73,3,0x63,0x66,0x65,0x72,0x69,0x98,0x72,0x19,0x61,0x69, +0x6c,0x63,0x61,0x6e,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,0x62,0x69, +0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,0x11,0xd8,0x40,0xa,0x11,0x63, +0x63,0xc3,0x11,0x11,0x72,0x6d,0x58,0x1e,0x69,0x6e,0x61,0x6c,0x70,0x75,0x6e,0x63, +0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x59,0x1d,0x74,0x6c,0x65,0x63,0x61,0x73,0x65, +0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,0xa,0x6d,0x70,0x6e,0x76,0x70,0xa2, +0xf1,0x71,0xa4,0x43,0x72,2,0x61,0x28,0x65,0x32,0x69,0x9d,0x14,0x64,0x69,0x63, +0x61,0x6c,0x55,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64,0x69,0x63,0x61, +0x74,0x6f,0x72,0x9d,0x12,0x61,0x74,0x68,0x4f,6,0x6f,0x39,0x6f,0x32,0x74,0xc3, +9,0x75,0x54,0x76,0xd9,0x30,0,0x12,0x6e,0x63,0x68,0x1f,0x61,0x72,0x61,0x63, +0x74,0x65,0x72,0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x51,0x14,0x6d,0x65, +0x72,0x69,0x63,1,0x74,0x32,0x76,0x13,0x61,0x6c,0x75,0x65,0xd9,0x30,0,0x12, +0x79,0x70,0x65,0xc3,9,0x61,0xa2,0x77,0x63,0xa2,0x82,0x66,2,0x63,0x98,0x64, +0xa2,0x53,0x6b,1,0x63,0x56,0x64,1,0x69,0x42,0x71,1,0x63,0xc3,0xd,0x75, +0x17,0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xd,0x13,0x6e,0x65,0x72,0x74, +0x6d,1,0x69,0x42,0x71,1,0x63,0xc3,0xf,0x75,0x17,0x69,0x63,0x6b,0x63,0x68, +0x65,0x63,0x6b,0xc3,0xf,0x13,0x6e,0x65,0x72,0x74,0x71,1,0x69,0x42,0x71,1, +0x63,0xc3,0xe,0x75,0x17,0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xe,0x13, +0x6e,0x65,0x72,0x74,0x6f,1,0x69,0x42,0x71,1,0x63,0xc3,0xc,0x75,0x17,0x69, +0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xc,0x13,0x6e,0x65,0x72,0x74,0x6b,0xd8, +0x40,5,1,0x31,0xd9,0x40,0xb,0x6d,0x10,0x65,0xd9,0x40,5,0x12,0x68,0x61, +0x72,0x51,2,0x61,0x6c,0x63,0xa2,0x4c,0x72,1,0x65,0x2a,0x69,0x11,0x6e,0x74, +0x7f,0x16,0x70,0x65,0x6e,0x64,0x65,0x64,0x63,0x1f,0x6f,0x6e,0x63,0x61,0x74,0x65, +0x6e,0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x9f,0x10,0x74,2,0x73,0x2c, +0x74,0x30,0x77,0x10,0x73,0x77,0x11,0x79,0x6e,0x75,0x12,0x65,0x72,0x6e,1,0x73, +0x38,0x77,0x18,0x68,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x77,0x14,0x79,0x6e, +0x74,0x61,0x78,0x75,0x10,0x6d,0x9f,1,0x6d,0x3c,0x75,0x1a,0x6f,0x74,0x61,0x74, +0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x53,0x12,0x61,0x72,0x6b,0x53,0x66,0xc1,0xf8, +0x69,0xc1,0x3c,0x69,0xa2,0x6f,0x6a,0xa4,9,0x6c,4,0x62,0xc3,8,0x63,0x8c, +0x65,0x98,0x69,0xa2,0x56,0x6f,2,0x65,0x4b,0x67,0x4c,0x77,0x11,0x65,0x72,0x4c, +0x13,0x63,0x61,0x73,0x65,0x4c,0x16,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40, +4,0x11,0x69,0x63,0x1f,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72,0x65,0x78,0x63,0x65, +0x70,0x74,0x69,0x6f,0x6e,0x4b,0xd8,0x40,4,0x11,0x63,0x63,0xc3,0x10,0x18,0x61, +0x64,0x63,0x61,0x6e,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,0x62,0x69, +0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,0x10,0x16,0x6e,0x65,0x62,0x72, +0x65,0x61,0x6b,0xc3,8,2,0x64,0x4a,0x6e,0xa2,0x5b,0x73,1,0x63,0xd9,0x40, +3,0x6f,0x16,0x63,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0xd9,0x40,3,2,0x63,0x80, +0x65,0x90,0x73,0x40,1,0x62,0x52,0x74,0x46,1,0x61,0x40,0x72,0x1c,0x69,0x6e, +0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x47,0x11,0x72,0x74,0x41, +0x44,0x1c,0x69,0x6e,0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x45, +0x3e,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x3f,0x10,0x6f,0x42,0x16,0x67,0x72, +0x61,0x70,0x68,0x69,0x63,0x43,2,0x64,0x2e,0x70,0x86,0x73,0x10,0x63,0xc3,0x17, +0x11,0x69,0x63,1,0x70,0x46,0x73,0x1e,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x63, +0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc3,0x17,0x10,0x6f,0x1f,0x73,0x69,0x74,0x69, +0x6f,0x6e,0x61,0x6c,0x63,0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc3,0x16,0x10,0x63, +0xc3,0x16,2,0x67,0xc3,6,0x6f,0x26,0x74,0xc3,7,0x11,0x69,0x6e,1,0x63, +0x4a,0x69,0x11,0x6e,0x67,1,0x67,0x2e,0x74,0x12,0x79,0x70,0x65,0xc3,7,0x13, +0x72,0x6f,0x75,0x70,0xc3,6,0x48,0x15,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x49,0x66, +0x86,0x67,0xa2,0x4a,0x68,3,0x61,0x36,0x65,0x58,0x73,0x68,0x79,0x13,0x70,0x68, +0x65,0x6e,0x3d,0x1f,0x6e,0x67,0x75,0x6c,0x73,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65, +0x74,0x79,0x70,0x65,0xc3,0xb,0x10,0x78,0x3a,0x14,0x64,0x69,0x67,0x69,0x74,0x3b, +0x10,0x74,0xc3,0xb,0x16,0x75,0x6c,0x6c,0x63,0x6f,0x6d,0x70,0x1f,0x6f,0x73,0x69, +0x74,0x69,0x6f,0x6e,0x65,0x78,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x33,2,0x63, +0xa2,0x44,0x65,0xa2,0x4b,0x72,3,0x61,0x34,0x62,0x84,0x65,0x8a,0x6c,0x12,0x69, +0x6e,0x6b,0x39,0x11,0x70,0x68,0x7c,0x12,0x65,0x6d,0x65,3,0x62,0x5e,0x63,0x30, +0x65,0x48,0x6c,0x12,0x69,0x6e,0x6b,0x39,0x1a,0x6c,0x75,0x73,0x74,0x65,0x72,0x62, +0x72,0x65,0x61,0x6b,0xc3,0x12,0x14,0x78,0x74,0x65,0x6e,0x64,0x37,0x12,0x61,0x73, +0x65,0x35,0x11,0x78,0x74,0x37,0xc2,5,1,0x62,0xc3,0x12,0x6d,0xd9,0x20,0, +0x1c,0x6e,0x65,0x72,0x61,0x6c,0x63,0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc2,5, +0x13,0x6d,0x61,0x73,0x6b,0xd9,0x20,0,0x61,0xa2,0x90,0x62,0xa2,0xbe,0x63,0xa4, +0x30,0x64,0xa4,0xfd,0x65,5,0x6d,0x63,0x6d,0x6e,0x70,0xa2,0x59,0x78,0x10,0x74, +0x30,1,0x65,0x2c,0x70,0x12,0x69,0x63,0x74,0xa1,0x12,0x6e,0x64,0x65,1,0x64, +0x24,0x72,0x31,0x1b,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63, +0xa1,0x10,0x6f,1,0x64,0x97,0x6a,0x10,0x69,0x92,2,0x63,0x40,0x6d,0x50,0x70, +0x1a,0x72,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0x95,0x17,0x6f,0x6d, +0x70,0x6f,0x6e,0x65,0x6e,0x74,0x9b,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x96, +0x13,0x62,0x61,0x73,0x65,0x99,0x12,0x72,0x65,0x73,0x95,0x61,0x30,0x62,0x4e,0x63, +0x12,0x6f,0x6d,0x70,0x9b,0xc2,4,0x1b,0x73,0x74,0x61,0x73,0x69,0x61,0x6e,0x77, +0x69,0x64,0x74,0x68,0xc3,4,0x12,0x61,0x73,0x65,0x99,3,0x67,0x44,0x68,0x4a, +0x6c,0x4e,0x73,0x1a,0x63,0x69,0x69,0x68,0x65,0x78,0x64,0x69,0x67,0x69,0x74,0x23, +0x10,0x65,0xd9,0x40,0,0x11,0x65,0x78,0x23,1,0x6e,0x38,0x70,0x11,0x68,0x61, +0x20,0x14,0x62,0x65,0x74,0x69,0x63,0x21,0x11,0x75,0x6d,0x79,4,0x63,0xc3,0, +0x69,0x3e,0x6c,0xa2,0x57,0x6d,0xa2,0x64,0x70,1,0x62,0xd9,0x40,0xd,0x74,0xc3, +0x15,0x11,0x64,0x69,2,0x63,0x54,0x6d,0x74,0x70,0x1b,0x61,0x69,0x72,0x65,0x64, +0x62,0x72,0x61,0x63,0x6b,0x65,0x74,0xd8,0x40,0xd,0x13,0x74,0x79,0x70,0x65,0xc3, +0x15,0x24,1,0x6c,0x30,0x6f,0x14,0x6e,0x74,0x72,0x6f,0x6c,0x25,0x12,0x61,0x73, +0x73,0xc3,0,0x26,0x14,0x69,0x72,0x72,0x6f,0x72,1,0x65,0x38,0x69,0x16,0x6e, +0x67,0x67,0x6c,0x79,0x70,0x68,0xd9,0x40,1,0x10,0x64,0x27,2,0x61,0x32,0x6b, +0xc3,1,0x6f,0x11,0x63,0x6b,0xc3,1,0x11,0x6e,0x6b,0x7b,0x10,0x67,0xd9,0x40, +1,6,0x68,0x7c,0x68,0x54,0x69,0x85,0x6f,0xa2,0x6f,0x77,4,0x63,0x30,0x6b, +0x36,0x6c,0x87,0x74,0x8b,0x75,0x89,1,0x66,0x8d,0x6d,0x8f,0x11,0x63,0x66,0x91, +0x18,0x61,0x6e,0x67,0x65,0x73,0x77,0x68,0x65,0x6e,4,0x63,0x44,0x6c,0x6c,0x6e, +0x7e,0x74,0x98,0x75,0x18,0x70,0x70,0x65,0x72,0x63,0x61,0x73,0x65,0x64,0x89,0x12, +0x61,0x73,0x65,1,0x66,0x30,0x6d,0x14,0x61,0x70,0x70,0x65,0x64,0x8f,0x14,0x6f, +0x6c,0x64,0x65,0x64,0x8d,0x18,0x6f,0x77,0x65,0x72,0x63,0x61,0x73,0x65,0x64,0x87, +0x1c,0x66,0x6b,0x63,0x63,0x61,0x73,0x65,0x66,0x6f,0x6c,0x64,0x65,0x64,0x91,0x18, +0x69,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,0x64,0x8b,0x13,0x6d,0x70,0x65,0x78,0x33, +0x61,0x2e,0x63,0xa2,0x48,0x66,0xd9,0x40,2,1,0x6e,0x72,0x73,0x10,0x65,3, +0x64,0x83,0x66,0x3a,0x69,0x4a,0x73,0x17,0x65,0x6e,0x73,0x69,0x74,0x69,0x76,0x65, +0x65,0x15,0x6f,0x6c,0x64,0x69,0x6e,0x67,0xd9,0x40,2,0x17,0x67,0x6e,0x6f,0x72, +0x61,0x62,0x6c,0x65,0x85,0x13,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d, +0x62,0x69,0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,2,0x10,0x63,0xc3, +2,3,0x61,0x30,0x65,0x34,0x69,0xa2,0x41,0x74,0xc3,3,0x11,0x73,0x68,0x29, +2,0x63,0x3a,0x66,0x58,0x70,0x2c,0x16,0x72,0x65,0x63,0x61,0x74,0x65,0x64,0x2d, +0x1d,0x6f,0x6d,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x74,0x79,0x70,0x65,0xc3, +3,0x15,0x61,0x75,0x6c,0x74,0x69,0x67,0x1f,0x6e,0x6f,0x72,0x61,0x62,0x6c,0x65, +0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x2b,0x2a,0x10,0x61,0x2e,0x15,0x63, +0x72,0x69,0x74,0x69,0x63,0x2f,3,0x66,0x34,0x6e,0x3e,0x74,0x42,0x79,0x22,0x11, +0x65,0x73,0x23,0x20,0x13,0x61,0x6c,0x73,0x65,0x21,0x20,0x10,0x6f,0x21,0x22,0x12, +0x72,0x75,0x65,0x23,0xb,0x6b,0x5b,0x6f,0x23,0x6f,0x3c,0x72,0x4c,0x76,1,0x69, +0x24,0x72,0x33,0x13,0x72,0x61,0x6d,0x61,0x33,0x10,0x76,0x22,0x14,0x65,0x72,0x6c, +0x61,0x79,0x23,0xa2,0xe2,0x13,0x69,0x67,0x68,0x74,0xa3,0xe2,0x6b,0x58,0x6c,0x74, +0x6e,3,0x6b,0x2f,0x6f,0x30,0x72,0x21,0x75,0x12,0x6b,0x74,0x61,0x2f,0x19,0x74, +0x72,0x65,0x6f,0x72,0x64,0x65,0x72,0x65,0x64,0x21,1,0x61,0x24,0x76,0x31,0x18, +0x6e,0x61,0x76,0x6f,0x69,0x63,0x69,0x6e,0x67,0x31,0xa2,0xe0,0x12,0x65,0x66,0x74, +0xa3,0xe0,0x64,0x45,0x64,0x4e,0x68,0x88,0x69,1,0x6f,0x26,0x73,0xa3,0xf0,0x1a, +0x74,0x61,0x73,0x75,0x62,0x73,0x63,0x72,0x69,0x70,0x74,0xa3,0xf0,2,0x61,0xa3, +0xea,0x62,0xa3,0xe9,0x6f,0x13,0x75,0x62,0x6c,0x65,1,0x61,0x30,0x62,0x13,0x65, +0x6c,0x6f,0x77,0xa3,0xe9,0x13,0x62,0x6f,0x76,0x65,0xa3,0xea,0x12,0x61,0x6e,0x72, +0x2c,0x15,0x65,0x61,0x64,0x69,0x6e,0x67,0x2d,0x61,0xa2,0x7b,0x62,0xa2,0xd4,0x63, +0x11,0x63,0x63,4,0x31,0x3c,0x32,0xa2,0x42,0x33,0xa2,0x56,0x38,0xa2,0x64,0x39, +0x10,0x31,0xa3,0x5b,9,0x35,0xa,0x35,0x3f,0x36,0x41,0x37,0x43,0x38,0x45,0x39, +0x47,0x30,0x30,0x31,0x3c,0x32,0x42,0x33,0x4e,0x34,0x3d,0x34,1,0x33,0xa3,0x67, +0x37,0xa3,0x6b,0x36,0x10,0x38,0xa3,0x76,0x38,1,0x32,0xa3,0x7a,0x39,0xa3,0x81, +0x3a,2,0x30,0xa3,0x82,0x32,0xa3,0x84,0x33,0xa3,0x85,9,0x35,0xa,0x35,0x53, +0x36,0x55,0x37,0x57,0x38,0x59,0x39,0x5b,0x30,0x49,0x31,0x4b,0x32,0x4d,0x33,0x4f, +0x34,0x51,6,0x33,8,0x33,0x63,0x34,0x65,0x35,0x67,0x36,0x69,0x30,0x5d,0x31, +0x5f,0x32,0x61,0x10,0x34,0xa3,0x54,0xa2,0xe6,3,0x62,0xa0,0x6c,0xa3,0xe4,0x72, +0xa3,0xe8,0x74,2,0x61,0x74,0x62,0x7c,0x74,0x14,0x61,0x63,0x68,0x65,0x64,1, +0x61,0x3e,0x62,0x13,0x65,0x6c,0x6f,0x77,0xa2,0xca,0x13,0x6c,0x65,0x66,0x74,0xa3, +0xc8,0x13,0x62,0x6f,0x76,0x65,0xa2,0xd6,0x14,0x72,0x69,0x67,0x68,0x74,0xa3,0xd8, +0xa2,0xd6,0x10,0x72,0xa3,0xd8,0xa2,0xca,0x10,0x6c,0xa3,0xc8,0x12,0x6f,0x76,0x65, +0xa2,0xe6,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68,0x74,0xa3,0xe8,0x12,0x65,0x66, +0x74,0xa3,0xe4,0xa2,0xdc,2,0x65,0x2c,0x6c,0xa3,0xda,0x72,0xa3,0xde,0x12,0x6c, +0x6f,0x77,0xa2,0xdc,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68,0x74,0xa3,0xde,0x12, +0x65,0x66,0x74,0xa3,0xda,0xb,0x6e,0xc0,0xca,0x72,0x5f,0x72,0x46,0x73,0xa2,0x48, +0x77,1,0x68,0x24,0x73,0x33,0x17,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x33, +0x22,1,0x69,0x30,0x6c,2,0x65,0x3d,0x69,0x4b,0x6f,0x3f,0x18,0x67,0x68,0x74, +0x74,0x6f,0x6c,0x65,0x66,0x74,0x22,2,0x65,0x38,0x69,0x48,0x6f,0x16,0x76,0x65, +0x72,0x72,0x69,0x64,0x65,0x3f,0x17,0x6d,0x62,0x65,0x64,0x64,0x69,0x6e,0x67,0x3d, +0x15,0x73,0x6f,0x6c,0x61,0x74,0x65,0x4b,0x30,0x1e,0x65,0x67,0x6d,0x65,0x6e,0x74, +0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x31,0x6e,0xa2,0x41,0x6f,0xa2,0x53, +0x70,2,0x61,0x66,0x64,0x86,0x6f,0x1b,0x70,0x64,0x69,0x72,0x65,0x63,0x74,0x69, +0x6f,0x6e,0x61,0x6c,1,0x66,0x32,0x69,0x15,0x73,0x6f,0x6c,0x61,0x74,0x65,0x4d, +0x14,0x6f,0x72,0x6d,0x61,0x74,0x41,0x1f,0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73, +0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x2f,1,0x66,0x41,0x69,0x4d,1,0x6f, +0x28,0x73,0x10,0x6d,0x43,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e,0x67,0x6d,0x61, +0x72,0x6b,0x43,1,0x6e,0x35,0x74,0x19,0x68,0x65,0x72,0x6e,0x65,0x75,0x74,0x72, +0x61,0x6c,0x35,0x65,0x88,0x65,0x98,0x66,0xa2,0x6a,0x6c,0x20,1,0x65,0x30,0x72, +2,0x65,0x37,0x69,0x49,0x6f,0x39,0x18,0x66,0x74,0x74,0x6f,0x72,0x69,0x67,0x68, +0x74,0x20,2,0x65,0x38,0x69,0x48,0x6f,0x16,0x76,0x65,0x72,0x72,0x69,0x64,0x65, +0x39,0x17,0x6d,0x62,0x65,0x64,0x64,0x69,0x6e,0x67,0x37,0x15,0x73,0x6f,0x6c,0x61, +0x74,0x65,0x49,3,0x6e,0x25,0x73,0x27,0x74,0x29,0x75,0x15,0x72,0x6f,0x70,0x65, +0x61,0x6e,2,0x6e,0x3c,0x73,0x46,0x74,0x18,0x65,0x72,0x6d,0x69,0x6e,0x61,0x74, +0x6f,0x72,0x29,0x14,0x75,0x6d,0x62,0x65,0x72,0x25,0x17,0x65,0x70,0x61,0x72,0x61, +0x74,0x6f,0x72,0x27,1,0x69,0x28,0x73,0x10,0x69,0x47,0x1f,0x72,0x73,0x74,0x73, +0x74,0x72,0x6f,0x6e,0x67,0x69,0x73,0x6f,0x6c,0x61,0x74,0x65,0x47,0x61,0x4e,0x62, +0x84,0x63,1,0x6f,0x24,0x73,0x2d,0x1c,0x6d,0x6d,0x6f,0x6e,0x73,0x65,0x70,0x61, +0x72,0x61,0x74,0x6f,0x72,0x2d,2,0x6c,0x3b,0x6e,0x2b,0x72,0x13,0x61,0x62,0x69, +0x63,1,0x6c,0x30,0x6e,0x14,0x75,0x6d,0x62,0x65,0x72,0x2b,0x14,0x65,0x74,0x74, +0x65,0x72,0x3b,0x2e,1,0x6e,0x45,0x6f,0x1c,0x75,0x6e,0x64,0x61,0x72,0x79,0x6e, +0x65,0x75,0x74,0x72,0x61,0x6c,0x45,0,0x16,0x6d,0xc8,0xc8,0x74,0xc1,0xee,0x77, +0x6a,0x77,0x48,0x79,0x70,0x7a,0x1d,0x61,0x6e,0x61,0x62,0x61,0x7a,0x61,0x72,0x73, +0x71,0x75,0x61,0x72,0x65,0xa5,0x18,0x10,0x61,1,0x6e,0x36,0x72,0x16,0x61,0x6e, +0x67,0x63,0x69,0x74,0x69,0xa3,0xfc,0x12,0x63,0x68,0x6f,0xa5,0x2c,1,0x65,0x88, +0x69,2,0x6a,0x3c,0x72,0x68,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x73, +0xa3,0x48,0x12,0x69,0x6e,0x67,0xa2,0x74,0x1e,0x68,0x65,0x78,0x61,0x67,0x72,0x61, +0x6d,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x74,0x16,0x61,0x64,0x69,0x63,0x61, +0x6c,0x73,0xa3,0x49,0x13,0x7a,0x69,0x64,0x69,0xa5,0x34,0x74,0xa2,0x59,0x75,0xa4, +0x35,0x76,2,0x61,0x36,0x65,0x7a,0x73,0xa2,0x6c,0x12,0x73,0x75,0x70,0xa3,0x7d, +1,0x69,0xa3,0x9f,0x72,0x1e,0x69,0x61,0x74,0x69,0x6f,0x6e,0x73,0x65,0x6c,0x65, +0x63,0x74,0x6f,0x72,0x73,0xa2,0x6c,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65, +0x6e,0x74,0xa3,0x7d,1,0x64,0x3c,0x72,0x19,0x74,0x69,0x63,0x61,0x6c,0x66,0x6f, +0x72,0x6d,0x73,0xa3,0x91,0x14,0x69,0x63,0x65,0x78,0x74,0xa2,0xaf,0x16,0x65,0x6e, +0x73,0x69,0x6f,0x6e,0x73,0xa3,0xaf,4,0x61,0x68,0x65,0xa2,0xad,0x68,0xa2,0xb0, +0x69,0xa2,0xb8,0x72,0x1c,0x61,0x6e,0x73,0x70,0x6f,0x72,0x74,0x61,0x6e,0x64,0x6d, +0x61,0x70,0xa2,0xcf,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xcf,4,0x67, +0x7e,0x69,0xa2,0x41,0x6b,0xa2,0x6a,0x6d,0xa2,0x6c,0x6e,0x12,0x67,0x75,0x74,0xa4, +0x10,1,0x63,0x40,0x73,0x11,0x75,0x70,0xa4,0x33,0x16,0x70,0x6c,0x65,0x6d,0x65, +0x6e,0x74,0xa5,0x33,0x18,0x6f,0x6d,0x70,0x6f,0x6e,0x65,0x6e,0x74,0x73,0xa5,0x11, +2,0x61,0x2a,0x62,0x32,0x73,0xa3,0x60,0x12,0x6c,0x6f,0x67,0xa3,0x62,0x13,0x61, +0x6e,0x77,0x61,0xa3,0x65,3,0x6c,0x52,0x74,0x56,0x76,0x5e,0x78,0x16,0x75,0x61, +0x6e,0x6a,0x69,0x6e,0x67,0xa2,0x7c,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3, +0x7c,0x10,0x65,0xa3,0x70,0x12,0x68,0x61,0x6d,0xa3,0xae,0x12,0x69,0x65,0x74,0xa3, +0xb7,0x11,0x72,0x69,0xa3,0xdc,0x11,0x69,0x6c,0x48,0x12,0x73,0x75,0x70,0xa4,0x2b, +0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x2b,0x13,0x6c,0x75,0x67,0x75,0x4b, +0x10,0x61,1,0x61,0x24,0x69,0x53,0x11,0x6e,0x61,0x3d,2,0x62,0x34,0x66,0x3c, +0x72,0x13,0x68,0x75,0x74,0x61,0xa3,0xfb,0x13,0x65,0x74,0x61,0x6e,0x57,0x14,0x69, +0x6e,0x61,0x67,0x68,0xa3,0x90,2,0x63,0x82,0x67,0x92,0x6e,0x1f,0x69,0x66,0x69, +0x65,0x64,0x63,0x61,0x6e,0x61,0x64,0x69,0x61,0x6e,0x61,0x62,0x6f,0x1f,0x72,0x69, +0x67,0x69,0x6e,0x61,0x6c,0x73,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x73,0x62,0x17, +0x65,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,0xa3,0xad,0x11,0x61,0x73,0x62,0x12,0x65, +0x78,0x74,0xa3,0xad,0x15,0x61,0x72,0x69,0x74,0x69,0x63,0xa3,0x78,0x70,0xc3,0x4b, +0x70,0xa6,0x61,0x72,0xa8,0x1d,0x73,7,0x6f,0xc1,0xbe,0x6f,0xa2,0x69,0x70,0xa2, +0x85,0x75,0xa2,0xa4,0x79,2,0x6c,0x50,0x6d,0x62,0x72,0x12,0x69,0x61,0x63,0x3a, +0x12,0x73,0x75,0x70,0xa4,0x17,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x17, +0x17,0x6f,0x74,0x69,0x6e,0x61,0x67,0x72,0x69,0xa3,0x8f,0x13,0x62,0x6f,0x6c,0x73, +1,0x61,0x4c,0x66,0x10,0x6f,0x1f,0x72,0x6c,0x65,0x67,0x61,0x63,0x79,0x63,0x6f, +0x6d,0x70,0x75,0x74,0x69,0x6e,0x67,0xa5,0x32,0x1f,0x6e,0x64,0x70,0x69,0x63,0x74, +0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x78,0x74,1,0x61,0xa5,0x2a,0x65,0x14, +0x6e,0x64,0x65,0x64,0x61,0xa5,0x2a,2,0x67,0x34,0x72,0x3e,0x79,0x13,0x6f,0x6d, +0x62,0x6f,0xa5,0x16,0x13,0x64,0x69,0x61,0x6e,0xa5,0x23,0x17,0x61,0x73,0x6f,0x6d, +0x70,0x65,0x6e,0x67,0xa3,0xda,1,0x61,0x32,0x65,0x14,0x63,0x69,0x61,0x6c,0x73, +0xa3,0x56,0x12,0x63,0x69,0x6e,0x1f,0x67,0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x72, +0x6c,0x65,0x74,0x74,0x65,0x72,0x73,0x2d,2,0x6e,0x48,0x70,0x76,0x74,0x1d,0x74, +0x6f,0x6e,0x73,0x69,0x67,0x6e,0x77,0x72,0x69,0x74,0x69,0x6e,0x67,0xa5,6,0x15, +0x64,0x61,0x6e,0x65,0x73,0x65,0xa2,0x9b,0x12,0x73,0x75,0x70,0xa2,0xdb,0x16,0x70, +0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xdb,4,0x61,0xa2,0xa8,0x65,0x5c,0x6d,0x9e, +0x70,0xa2,0x4b,0x73,0x13,0x79,0x6d,0x62,0x6f,0x1f,0x6c,0x73,0x61,0x6e,0x64,0x70, +0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa5,5,0x10,0x72,1,0x61, +0x4e,0x73,0x12,0x63,0x72,0x69,0x1f,0x70,0x74,0x73,0x61,0x6e,0x64,0x73,0x75,0x62, +0x73,0x63,0x72,0x69,0x70,0x74,0x73,0x73,0x14,0x6e,0x64,0x73,0x75,0x62,0x73,0x1b, +0x61,0x74,0x68,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x73,0xa3,0x6a,1,0x6c, +0x40,0x75,1,0x61,0x6e,0x6e,0x17,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3, +0x8e,0x15,0x65,0x6d,0x65,0x6e,0x74,0x61,1,0x6c,0x50,0x72,0x1e,0x79,0x70,0x72, +0x69,0x76,0x61,0x74,0x65,0x75,0x73,0x65,0x61,0x72,0x65,0x61,1,0x61,0xa3,0x6d, +0x62,0xa3,0x6e,3,0x61,0x5c,0x6d,0x78,0x70,0xa2,0x41,0x73,0x13,0x79,0x6d,0x62, +0x6f,0x1f,0x6c,0x73,0x61,0x6e,0x64,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70, +0x68,0x73,0xa5,5,0x14,0x72,0x72,0x6f,0x77,0x73,2,0x61,0xa3,0x67,0x62,0xa3, +0x68,0x63,0xa3,0xfa,0x13,0x61,0x74,0x68,0x65,0x1f,0x6d,0x61,0x74,0x69,0x63,0x61, +0x6c,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x73,0xa3,0x6a,0x19,0x75,0x6e,0x63, +0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x8e,0x61,0x88,0x68,0xa2,0x48,0x69,0xa2, +0x71,0x6d,0x12,0x61,0x6c,0x6c,1,0x66,0x46,0x6b,0x15,0x61,0x6e,0x61,0x65,0x78, +0x74,0xa4,0x29,0x15,0x65,0x6e,0x73,0x69,0x6f,0x6e,0xa5,0x29,0x12,0x6f,0x72,0x6d, +1,0x73,0xa3,0x54,0x76,0x16,0x61,0x72,0x69,0x61,0x6e,0x74,0x73,0xa3,0x54,1, +0x6d,0x36,0x75,0x16,0x72,0x61,0x73,0x68,0x74,0x72,0x61,0xa3,0xa1,0x15,0x61,0x72, +0x69,0x74,0x61,0x6e,0xa3,0xac,1,0x61,0x52,0x6f,0x13,0x72,0x74,0x68,0x61,0x1f, +0x6e,0x64,0x66,0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x73, +0xa3,0xf7,1,0x72,0x2e,0x76,0x12,0x69,0x61,0x6e,0xa3,0x79,0x12,0x61,0x64,0x61, +0xa3,0xd9,1,0x64,0x50,0x6e,0x13,0x68,0x61,0x6c,0x61,0x50,0x1d,0x61,0x72,0x63, +0x68,0x61,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0xf9,0x13,0x64,0x68, +0x61,0x6d,0xa3,0xf8,5,0x72,0x35,0x72,0x44,0x73,0x64,0x75,1,0x61,0xa3,0x4e, +0x6e,0x17,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x71,0x17,0x69,0x76,0x61,0x74, +0x65,0x75,0x73,0x65,0xa2,0x4e,0x13,0x61,0x72,0x65,0x61,0xa3,0x4e,0x1b,0x61,0x6c, +0x74,0x65,0x72,0x70,0x61,0x68,0x6c,0x61,0x76,0x69,0xa3,0xf6,0x61,0x40,0x68,0x82, +0x6c,0x19,0x61,0x79,0x69,0x6e,0x67,0x63,0x61,0x72,0x64,0x73,0xa3,0xcc,2,0x68, +0x38,0x6c,0x4a,0x75,0x15,0x63,0x69,0x6e,0x68,0x61,0x75,0xa3,0xf5,0x17,0x61,0x77, +0x68,0x68,0x6d,0x6f,0x6e,0x67,0xa3,0xf3,0x15,0x6d,0x79,0x72,0x65,0x6e,0x65,0xa3, +0xf4,1,0x61,0x8e,0x6f,1,0x65,0x74,0x6e,0x16,0x65,0x74,0x69,0x63,0x65,0x78, +0x74,0xa2,0x72,1,0x65,0x2c,0x73,0x11,0x75,0x70,0xa3,0x8d,0x15,0x6e,0x73,0x69, +0x6f,0x6e,0x73,0xa2,0x72,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74, +0xa3,0x8d,0x15,0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3,0x97,1,0x67,0x3e,0x69,0x13, +0x73,0x74,0x6f,0x73,0xa2,0xa6,0x13,0x64,0x69,0x73,0x63,0xa3,0xa6,0x12,0x73,0x70, +0x61,0xa3,0x96,1,0x65,0x5c,0x75,1,0x6d,0x2a,0x6e,0x11,0x69,0x63,0x67,0x10, +0x69,0xa2,0xc0,0x1d,0x6e,0x75,0x6d,0x65,0x72,0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f, +0x6c,0x73,0xa3,0xc0,0x13,0x6a,0x61,0x6e,0x67,0xa3,0xa3,0x6d,0xa2,0xe6,0x6e,0xa8, +0x19,0x6f,6,0x70,0x63,0x70,0x56,0x72,0x8a,0x73,0xa2,0x4c,0x74,0x10,0x74,0x1f, +0x6f,0x6d,0x61,0x6e,0x73,0x69,0x79,0x61,0x71,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73, +0xa5,0x28,0x18,0x74,0x69,0x63,0x61,0x6c,0x63,0x68,0x61,0x72,0x1f,0x61,0x63,0x74, +0x65,0x72,0x72,0x65,0x63,0x6f,0x67,0x6e,0x69,0x74,0x69,0x6f,0x6e,0x85,1,0x69, +0x46,0x6e,0x1e,0x61,0x6d,0x65,0x6e,0x74,0x61,0x6c,0x64,0x69,0x6e,0x67,0x62,0x61, +0x74,0x73,0xa3,0xf2,0x11,0x79,0x61,0x47,1,0x61,0x30,0x6d,0x13,0x61,0x6e,0x79, +0x61,0xa3,0x7a,0x11,0x67,0x65,0xa5,0xf,0x63,0xa2,0x71,0x67,0xa2,0x71,0x6c,1, +0x63,0xa2,0x62,0x64,5,0x70,0x38,0x70,0x36,0x73,0x56,0x74,0x14,0x75,0x72,0x6b, +0x69,0x63,0xa3,0xbf,0x11,0x65,0x72,1,0x6d,0x2e,0x73,0x12,0x69,0x61,0x6e,0xa3, +0x8c,0x11,0x69,0x63,0xa3,0xf1,0x10,0x6f,1,0x67,0x3a,0x75,0x18,0x74,0x68,0x61, +0x72,0x61,0x62,0x69,0x61,0x6e,0xa3,0xbb,0x13,0x64,0x69,0x61,0x6e,0xa5,0x22,0x68, +0x42,0x69,0x54,0x6e,0x1a,0x6f,0x72,0x74,0x68,0x61,0x72,0x61,0x62,0x69,0x61,0x6e, +0xa3,0xf0,0x17,0x75,0x6e,0x67,0x61,0x72,0x69,0x61,0x6e,0xa5,4,0x14,0x74,0x61, +0x6c,0x69,0x63,0xa3,0x58,0x13,0x68,0x69,0x6b,0x69,0xa3,0x9d,0x10,0x72,0x85,0x12, +0x68,0x61,0x6d,0x65,6,0x6f,0x86,0x6f,0x6c,0x72,0xa2,0x61,0x75,0xa2,0x62,0x79, +0x14,0x61,0x6e,0x6d,0x61,0x72,0x58,0x12,0x65,0x78,0x74,2,0x61,0xa3,0xb6,0x62, +0xa3,0xee,0x65,0x13,0x6e,0x64,0x65,0x64,1,0x61,0xa3,0xb6,0x62,0xa3,0xee,1, +0x64,0x52,0x6e,0x15,0x67,0x6f,0x6c,0x69,0x61,0x6e,0x6a,0x12,0x73,0x75,0x70,0xa4, +0xd,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0xd,0x10,0x69,0xa2,0xec,0x13, +0x66,0x69,0x65,0x72,1,0x6c,0x3c,0x74,0x19,0x6f,0x6e,0x65,0x6c,0x65,0x74,0x74, +0x65,0x72,0x73,0xa3,0x8a,0x15,0x65,0x74,0x74,0x65,0x72,0x73,0x2d,0x10,0x6f,0xa3, +0xed,1,0x6c,0x44,0x73,0x11,0x69,0x63,0xa2,0x5c,0x18,0x61,0x6c,0x73,0x79,0x6d, +0x62,0x6f,0x6c,0x73,0xa3,0x5c,0x13,0x74,0x61,0x6e,0x69,0xa5,3,0x61,0xa2,0x9b, +0x65,0xa4,0x4c,0x69,1,0x61,0xa2,0x8f,0x73,0x10,0x63,5,0x70,0x18,0x70,0xa2, +0x71,0x73,0x36,0x74,0x17,0x65,0x63,0x68,0x6e,0x69,0x63,0x61,0x6c,0x81,0x15,0x79, +0x6d,0x62,0x6f,0x6c,0x73,0x8f,0x61,0xa2,0x66,0x65,0x46,0x6d,0x19,0x61,0x74,0x68, +0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,1,0x61,0xa3,0x66,0x62,0xa3,0x69,0x17,0x6c, +0x6c,0x61,0x6e,0x65,0x6f,0x75,0x73,2,0x6d,0x3a,0x73,0x6c,0x74,0x17,0x65,0x63, +0x68,0x6e,0x69,0x63,0x61,0x6c,0x81,0x11,0x61,0x74,0x1f,0x68,0x65,0x6d,0x61,0x74, +0x69,0x63,0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,1,0x61,0xa3,0x66,0x62, +0xa3,0x69,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x8e,0x12,0x61,0x6e,0x64,1,0x61, +0x3c,0x70,0x19,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa3,0xcd,0x14, +0x72,0x72,0x6f,0x77,0x73,0xa3,0x73,0x10,0x6f,0xa3,0xd8,7,0x72,0x6f,0x72,0x44, +0x73,0x4e,0x74,0x62,0x79,0x19,0x61,0x6e,0x6e,0x75,0x6d,0x65,0x72,0x61,0x6c,0x73, +0xa5,0x20,0x13,0x63,0x68,0x65,0x6e,0xa5,0xc,0x18,0x61,0x72,0x61,0x6d,0x67,0x6f, +0x6e,0x64,0x69,0xa5,0x14,0x10,0x68,2,0x61,0x3a,0x65,0x4a,0x6f,0x17,0x70,0x65, +0x72,0x61,0x74,0x6f,0x72,0x73,0x7f,0x16,0x6c,0x70,0x68,0x61,0x6e,0x75,0x6d,0xa3, +0x5d,0x16,0x6d,0x61,0x74,0x69,0x63,0x61,0x6c,1,0x61,0x36,0x6f,0x17,0x70,0x65, +0x72,0x61,0x74,0x6f,0x72,0x73,0x7f,0x11,0x6c,0x70,0x1f,0x68,0x61,0x6e,0x75,0x6d, +0x65,0x72,0x69,0x63,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x5d,0x68,0x50,0x6b, +0x7e,0x6c,0x88,0x6e,1,0x64,0x34,0x69,0x15,0x63,0x68,0x61,0x65,0x61,0x6e,0xa3, +0xea,0x12,0x61,0x69,0x63,0xa3,0xc6,1,0x61,0x3e,0x6a,0x12,0x6f,0x6e,0x67,0xa2, +0xaa,0x14,0x74,0x69,0x6c,0x65,0x73,0xa3,0xaa,0x13,0x6a,0x61,0x6e,0x69,0xa3,0xe9, +0x13,0x61,0x73,0x61,0x72,0xa5,0x1f,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,0x4f,3, +0x64,0x6c,0x65,0x7e,0x6e,0xa2,0x47,0x72,0x14,0x6f,0x69,0x74,0x69,0x63,1,0x63, +0x3c,0x68,0x19,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0xd7,0x15, +0x75,0x72,0x73,0x69,0x76,0x65,0xa3,0xd6,0x17,0x65,0x66,0x61,0x69,0x64,0x72,0x69, +0x6e,0xa5,0x21,0x17,0x74,0x65,0x69,0x6d,0x61,0x79,0x65,0x6b,0xa2,0xb8,0x12,0x65, +0x78,0x74,0xa2,0xd5,0x16,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa3,0xd5,0x18,0x64, +0x65,0x6b,0x69,0x6b,0x61,0x6b,0x75,0x69,0xa3,0xeb,6,0x6b,0x3b,0x6b,0x56,0x6f, +0x5a,0x75,0x64,0x79,0x11,0x69,0x61,0x1f,0x6b,0x65,0x6e,0x67,0x70,0x75,0x61,0x63, +0x68,0x75,0x65,0x68,0x6d,0x6f,0x6e,0x67,0xa5,0x27,0x10,0x6f,0xa3,0x92,0x14,0x62, +0x6c,0x6f,0x63,0x6b,0x21,1,0x6d,0x2c,0x73,0x11,0x68,0x75,0xa5,0x15,0x17,0x62, +0x65,0x72,0x66,0x6f,0x72,0x6d,0x73,0x7b,0x61,0x44,0x62,0x21,0x65,0x10,0x77,1, +0x61,0xa5,0xe,0x74,0x14,0x61,0x69,0x6c,0x75,0x65,0xa3,0x8b,1,0x62,0x38,0x6e, +0x17,0x64,0x69,0x6e,0x61,0x67,0x61,0x72,0x69,0xa5,0x26,0x15,0x61,0x74,0x61,0x65, +0x61,0x6e,0xa3,0xef,0x67,0xc4,0x32,0x6a,0xc1,0xb9,0x6a,0xa2,0xd5,0x6b,0xa2,0xee, +0x6c,4,0x61,0x54,0x65,0xa2,0x61,0x69,0xa2,0x78,0x6f,0xa2,0xb7,0x79,1,0x63, +0x2e,0x64,0x12,0x69,0x61,0x6e,0xa3,0xa9,0x12,0x69,0x61,0x6e,0xa3,0xa7,1,0x6f, +0x55,0x74,0x11,0x69,0x6e,1,0x31,0x82,0x65,0x11,0x78,0x74,4,0x61,0x5c,0x62, +0x29,0x63,0xa3,0x94,0x64,0xa3,0x95,0x65,0xa2,0xe7,0x13,0x6e,0x64,0x65,0x64,4, +0x61,0x36,0x62,0x29,0x63,0xa3,0x94,0x64,0xa3,0x95,0x65,0xa3,0xe7,0x26,0x18,0x64, +0x64,0x69,0x74,0x69,0x6f,0x6e,0x61,0x6c,0x6d,0x24,0x12,0x73,0x75,0x70,0x24,0x16, +0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x25,1,0x70,0x42,0x74,0x1d,0x74,0x65,0x72, +0x6c,0x69,0x6b,0x65,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x79,0x12,0x63,0x68,0x61, +0xa3,0x9c,2,0x6d,0x4e,0x6e,0x54,0x73,0x10,0x75,0xa2,0xb0,0x12,0x73,0x75,0x70, +0xa4,0x31,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x31,0x11,0x62,0x75,0xa3, +0x6f,0x12,0x65,0x61,0x72,1,0x61,0xa3,0xe8,0x62,1,0x69,0x38,0x73,0x17,0x79, +0x6c,0x6c,0x61,0x62,0x61,0x72,0x79,0xa3,0x75,0x17,0x64,0x65,0x6f,0x67,0x72,0x61, +0x6d,0x73,0xa3,0x76,0x1a,0x77,0x73,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73, +0xa3,0x4d,0x10,0x61,1,0x6d,0x32,0x76,0x14,0x61,0x6e,0x65,0x73,0x65,0xa3,0xb5, +0x10,0x6f,0x5c,0x12,0x65,0x78,0x74,1,0x61,0xa3,0xb4,0x62,0xa3,0xb9,1,0x61, +0xa2,0x43,0x68,4,0x61,0x40,0x69,0x50,0x6d,0x6e,0x6f,0x86,0x75,0x15,0x64,0x61, +0x77,0x61,0x64,0x69,0xa3,0xe6,0x16,0x72,0x6f,0x73,0x68,0x74,0x68,0x69,0xa3,0x89, +0x1d,0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73,0x63,0x72,0x69,0x70,0x74,0xa5, +0x30,0x11,0x65,0x72,0x68,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x71,0x12, +0x6a,0x6b,0x69,0xa3,0xe5,3,0x69,0x3a,0x6e,0x42,0x74,0xa2,0x51,0x79,0x13,0x61, +0x68,0x6c,0x69,0xa3,0xa2,0x12,0x74,0x68,0x69,0xa3,0xc1,3,0x61,0x34,0x62,0x76, +0x67,0x7c,0x6e,0x12,0x61,0x64,0x61,0x4d,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2, +0xcb,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xcb,0x11,0x78,0x74,1,0x61, +0xa5,0x13,0x65,0x14,0x6e,0x64,0x65,0x64,0x61,0xa5,0x13,0x11,0x75,0x6e,0xa3,0x42, +0x11,0x78,0x69,0x96,0x17,0x72,0x61,0x64,0x69,0x63,0x61,0x6c,0x73,0x97,0x14,0x61, +0x6b,0x61,0x6e,0x61,0x9e,1,0x65,0x4c,0x70,0x10,0x68,0x1f,0x6f,0x6e,0x65,0x74, +0x69,0x63,0x65,0x78,0x74,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa3,0x6b,0x11,0x78, +0x74,0xa3,0x6b,0x67,0xa2,0xb5,0x68,0xa4,0x84,0x69,3,0x64,0x4c,0x6d,0xa2,0x55, +0x6e,0xa2,0x62,0x70,0x13,0x61,0x65,0x78,0x74,0x2a,0x16,0x65,0x6e,0x73,0x69,0x6f, +0x6e,0x73,0x2b,1,0x63,0x99,0x65,0x17,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63, +1,0x64,0x56,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa4,0xb,0x1d,0x61,0x6e, +0x64,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa5,0xb,0x13,0x65, +0x73,0x63,0x72,0x1f,0x69,0x70,0x74,0x69,0x6f,0x6e,0x63,0x68,0x61,0x72,0x61,0x63, +0x74,0x65,0x72,0x73,0x99,0x1c,0x70,0x65,0x72,0x69,0x61,0x6c,0x61,0x72,0x61,0x6d, +0x61,0x69,0x63,0xa3,0xba,1,0x64,0x62,0x73,0x1b,0x63,0x72,0x69,0x70,0x74,0x69, +0x6f,0x6e,0x61,0x6c,0x70,0x61,1,0x68,0x32,0x72,0x14,0x74,0x68,0x69,0x61,0x6e, +0xa3,0xbd,0x13,0x6c,0x61,0x76,0x69,0xa3,0xbe,0x11,0x69,0x63,1,0x6e,0x3e,0x73, +0x1a,0x69,0x79,0x61,0x71,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa5,0x1e,0x19,0x75, +0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d,0x73,0xa3,0xb2,4,0x65,0x74,0x6c,0xa2, +0x82,0x6f,0xa2,0x9a,0x72,0xa2,0x9e,0x75,2,0x6a,0x34,0x6e,0x3e,0x72,0x14,0x6d, +0x75,0x6b,0x68,0x69,0x43,0x14,0x61,0x72,0x61,0x74,0x69,0x45,0x18,0x6a,0x61,0x6c, +0x61,0x67,0x6f,0x6e,0x64,0x69,0xa5,0x1c,1,0x6e,0xa2,0x46,0x6f,1,0x6d,0x6e, +0x72,0x13,0x67,0x69,0x61,0x6e,0x5a,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,0x87, +0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x87,0x11,0x78,0x74,0xa4,0x1b,0x14, +0x65,0x6e,0x64,0x65,0x64,0xa5,0x1b,0x1a,0x65,0x74,0x72,0x69,0x63,0x73,0x68,0x61, +0x70,0x65,0x73,0x8c,0x12,0x65,0x78,0x74,0xa2,0xe3,0x14,0x65,0x6e,0x64,0x65,0x64, +0xa3,0xe3,0x1e,0x65,0x72,0x61,0x6c,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69, +0x6f,0x6e,0x71,0x17,0x61,0x67,0x6f,0x6c,0x69,0x74,0x69,0x63,0xa2,0x88,0x12,0x73, +0x75,0x70,0xa4,0xa,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0xa,0x13,0x74, +0x68,0x69,0x63,0xa3,0x59,1,0x61,0x5c,0x65,0x11,0x65,0x6b,0x30,1,0x61,0x38, +0x65,0x11,0x78,0x74,0x6e,0x14,0x65,0x6e,0x64,0x65,0x64,0x6f,0x17,0x6e,0x64,0x63, +0x6f,0x70,0x74,0x69,0x63,0x31,0x13,0x6e,0x74,0x68,0x61,0xa3,0xe4,2,0x61,0xa2, +0x48,0x65,0xa2,0xdf,0x69,1,0x67,0x30,0x72,0x14,0x61,0x67,0x61,0x6e,0x61,0x9d, +0x10,0x68,1,0x70,0x3a,0x73,0x18,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73, +0xa3,0x4b,1,0x72,0x3c,0x75,0x19,0x73,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65, +0x73,0xa3,0x4c,0x11,0x69,0x76,0x1f,0x61,0x74,0x65,0x75,0x73,0x65,0x73,0x75,0x72, +0x72,0x6f,0x67,0x61,0x74,0x65,0x73,0xa3,0x4c,2,0x6c,0x32,0x6e,0x9a,0x74,0x12, +0x72,0x61,0x6e,0xa5,2,0x10,0x66,2,0x61,0x58,0x6d,0x70,0x77,0x14,0x69,0x64, +0x74,0x68,0x61,0x1f,0x6e,0x64,0x66,0x75,0x6c,0x6c,0x77,0x69,0x64,0x74,0x68,0x66, +0x6f,0x72,0x6d,0x73,0xa3,0x57,0x1a,0x6e,0x64,0x66,0x75,0x6c,0x6c,0x66,0x6f,0x72, +0x6d,0x73,0xa3,0x57,0x13,0x61,0x72,0x6b,0x73,0xa3,0x52,2,0x67,0x34,0x69,0xa2, +0x45,0x75,0x12,0x6e,0x6f,0x6f,0xa3,0x63,0x11,0x75,0x6c,0xa2,0x4a,2,0x63,0x3c, +0x6a,0x5e,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x73,0xa3,0x4a,0x1f,0x6f, +0x6d,0x70,0x61,0x74,0x69,0x62,0x69,0x6c,0x69,0x74,0x79,0x6a,0x61,0x6d,0x6f,0xa3, +0x41,0x12,0x61,0x6d,0x6f,0x5c,0x17,0x65,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,1, +0x61,0xa3,0xb4,0x62,0xa3,0xb9,0x19,0x66,0x69,0x72,0x6f,0x68,0x69,0x6e,0x67,0x79, +0x61,0xa5,0x1d,0x13,0x62,0x72,0x65,0x77,0x37,0x61,0xa4,5,0x62,0xa6,0x45,0x63, +0xa8,0x1a,0x64,0xac,0xb8,0x65,5,0x6d,0xa2,0x6d,0x86,0x6e,0x96,0x74,0x15,0x68, +0x69,0x6f,0x70,0x69,0x63,0x5e,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,0x86,0x16, +0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x86,0x11,0x78,0x74,0xa2,0x85,1,0x61, +0xa3,0xc8,0x65,0x13,0x6e,0x64,0x65,0x64,0xa2,0x85,0x10,0x61,0xa3,0xc8,0x16,0x6f, +0x74,0x69,0x63,0x6f,0x6e,0x73,0xa3,0xce,0x15,0x63,0x6c,0x6f,0x73,0x65,0x64,2, +0x61,0x5a,0x63,0x9e,0x69,0x1c,0x64,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63, +0x73,0x75,0x70,0xa2,0xc4,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xc4,0x16, +0x6c,0x70,0x68,0x61,0x6e,0x75,0x6d,0x86,1,0x65,0x2c,0x73,0x11,0x75,0x70,0xa3, +0xc3,0x13,0x72,0x69,0x63,0x73,0x86,0x18,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e, +0x74,0xa3,0xc3,0x11,0x6a,0x6b,0xa2,0x44,0x1f,0x6c,0x65,0x74,0x74,0x65,0x72,0x73, +0x61,0x6e,0x64,0x6d,0x6f,0x6e,0x74,0x68,0x73,0xa3,0x44,0x61,0x4a,0x67,0x76,0x6c, +1,0x62,0x30,0x79,0x13,0x6d,0x61,0x69,0x63,0xa5,0x25,0x13,0x61,0x73,0x61,0x6e, +0xa3,0xe2,0x13,0x72,0x6c,0x79,0x64,0x1f,0x79,0x6e,0x61,0x73,0x74,0x69,0x63,0x63, +0x75,0x6e,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa5,1,0x1f,0x79,0x70,0x74,0x69,0x61, +0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,1,0x66,0x26,0x73,0xa3, +0xc2,0x1c,0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x73,0xa5, +0x24,7,0x6e,0xc0,0xe5,0x6e,0x3e,0x72,0xa2,0x5d,0x73,0xa2,0xd8,0x76,0x14,0x65, +0x73,0x74,0x61,0x6e,0xa3,0xbc,1,0x61,0x92,0x63,0x13,0x69,0x65,0x6e,0x74,1, +0x67,0x34,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xa5,0x13,0x72,0x65,0x65, +0x6b,1,0x6d,0x34,0x6e,0x15,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x7f,0x13,0x75, +0x73,0x69,0x63,0xa2,0x7e,0x19,0x61,0x6c,0x6e,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e, +0xa3,0x7e,0x10,0x74,0x1f,0x6f,0x6c,0x69,0x61,0x6e,0x68,0x69,0x65,0x72,0x6f,0x67, +0x6c,0x79,0x70,0x68,0x73,0xa3,0xfe,2,0x61,0x32,0x6d,0xa2,0x71,0x72,0x12,0x6f, +0x77,0x73,0x7d,0x12,0x62,0x69,0x63,0x38,3,0x65,0x4a,0x6d,0x66,0x70,0xa2,0x43, +0x73,0x11,0x75,0x70,0xa2,0x80,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x80, +0x11,0x78,0x74,1,0x61,0xa3,0xd2,0x65,0x14,0x6e,0x64,0x65,0x64,0x61,0xa3,0xd2, +0x12,0x61,0x74,0x68,0xa2,0xd3,0x18,0x65,0x6d,0x61,0x74,0x69,0x63,0x61,0x6c,0x61, +0x1f,0x6c,0x70,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x73,0x79,0x6d,0x62,0x6f,0x6c, +0x73,0xa3,0xd3,1,0x66,0x42,0x72,0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69, +0x6f,0x6e,0x66,0x6f,0x72,0x6d,0x73,1,0x61,0xa3,0x51,0x62,0xa3,0x55,0x14,0x65, +0x6e,0x69,0x61,0x6e,0x35,0x12,0x63,0x69,0x69,0x23,0x64,0x9e,0x65,0xa2,0x42,0x68, +0xa2,0x4d,0x6c,1,0x63,0x62,0x70,0x17,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x70, +1,0x66,0xa3,0x50,0x72,0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e, +0x66,0x6f,0x72,0x6d,0x73,0xa3,0x50,0x16,0x68,0x65,0x6d,0x69,0x63,0x61,0x6c,0xa2, +0xd0,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xd0,0x12,0x6c,0x61,0x6d,0xa5, +7,0x1a,0x67,0x65,0x61,0x6e,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x77,0x11, +0x6f,0x6d,0xa3,0xfd,7,0x6f,0x71,0x6f,0x64,0x72,0xa2,0x41,0x75,0xa2,0x58,0x79, +0x1b,0x7a,0x61,0x6e,0x74,0x69,0x6e,0x65,0x6d,0x75,0x73,0x69,0x63,0xa2,0x5b,0x18, +0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x5b,1,0x70,0x34,0x78,0x16, +0x64,0x72,0x61,0x77,0x69,0x6e,0x67,0x89,0x14,0x6f,0x6d,0x6f,0x66,0x6f,0xa0,0x12, +0x65,0x78,0x74,0xa2,0x43,0x14,0x65,0x6e,0x64,0x65,0x64,0xa3,0x43,0x10,0x61,1, +0x68,0x40,0x69,0x12,0x6c,0x6c,0x65,0x92,0x17,0x70,0x61,0x74,0x74,0x65,0x72,0x6e, +0x73,0x93,0x11,0x6d,0x69,0xa3,0xc9,1,0x67,0x2c,0x68,0x11,0x69,0x64,0xa3,0x64, +0x14,0x69,0x6e,0x65,0x73,0x65,0xa3,0x81,0x61,0x48,0x65,0xa2,0x4e,0x68,0xa2,0x52, +0x6c,0x1a,0x6f,0x63,0x6b,0x65,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x73,0x8b,3,0x6c, +0x34,0x6d,0x40,0x73,0x66,0x74,0x11,0x61,0x6b,0xa3,0xc7,0x14,0x69,0x6e,0x65,0x73, +0x65,0xa3,0x93,0x11,0x75,0x6d,0xa2,0xb1,0x12,0x73,0x75,0x70,0xa2,0xca,0x16,0x70, +0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xca,1,0x69,0x30,0x73,0x13,0x61,0x76,0x61, +0x68,0xa3,0xdd,0x15,0x63,0x6c,0x61,0x74,0x69,0x6e,0x23,0x14,0x6e,0x67,0x61,0x6c, +0x69,0x41,0x16,0x61,0x69,0x6b,0x73,0x75,0x6b,0x69,0xa5,8,5,0x6f,0xc1,0x4c, +0x6f,0xa2,0x55,0x75,0xa4,0x10,0x79,1,0x70,0x9c,0x72,0x14,0x69,0x6c,0x6c,0x69, +0x63,0x32,1,0x65,0x4c,0x73,0x11,0x75,0x70,0xa2,0x61,0x16,0x70,0x6c,0x65,0x6d, +0x65,0x6e,0x74,0xa2,0x61,0x12,0x61,0x72,0x79,0xa3,0x61,0x11,0x78,0x74,3,0x61, +0xa3,0x9e,0x62,0xa3,0xa0,0x63,0xa5,9,0x65,0x13,0x6e,0x64,0x65,0x64,2,0x61, +0xa3,0x9e,0x62,0xa3,0xa0,0x63,0xa5,9,0x1c,0x72,0x69,0x6f,0x74,0x73,0x79,0x6c, +0x6c,0x61,0x62,0x61,0x72,0x79,0xa3,0x7b,3,0x6d,0x5a,0x6e,0xa2,0x95,0x70,0xa2, +0xa0,0x75,0x17,0x6e,0x74,0x69,0x6e,0x67,0x72,0x6f,0x64,0xa2,0x9a,0x17,0x6e,0x75, +0x6d,0x65,0x72,0x61,0x6c,0x73,0xa3,0x9a,2,0x62,0x3a,0x6d,0xa2,0x5f,0x70,0x15, +0x61,0x74,0x6a,0x61,0x6d,0x6f,0xa3,0x41,0x14,0x69,0x6e,0x69,0x6e,0x67,2,0x64, +0x46,0x68,0x9e,0x6d,0x1d,0x61,0x72,0x6b,0x73,0x66,0x6f,0x72,0x73,0x79,0x6d,0x62, +0x6f,0x6c,0x73,0x77,0x1e,0x69,0x61,0x63,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x6d, +0x61,0x72,0x6b,0x73,0x2e,2,0x65,0x40,0x66,0xa6,0x41,0x73,0x18,0x75,0x70,0x70, +0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x83,0x16,0x78,0x74,0x65,0x6e,0x64,0x65,0x64, +0xa3,0xe0,0x17,0x61,0x6c,0x66,0x6d,0x61,0x72,0x6b,0x73,0xa3,0x52,0x11,0x6f,0x6e, +0x1f,0x69,0x6e,0x64,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d, +0x73,0xa3,0xb2,0x1b,0x74,0x72,0x6f,0x6c,0x70,0x69,0x63,0x74,0x75,0x72,0x65,0x73, +0x83,0x12,0x74,0x69,0x63,0xa2,0x84,0x1b,0x65,0x70,0x61,0x63,0x74,0x6e,0x75,0x6d, +0x62,0x65,0x72,0x73,0xa3,0xdf,1,0x6e,0x3e,0x72,0x1b,0x72,0x65,0x6e,0x63,0x79, +0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x75,0x15,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa2, +0x98,0x16,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa2,0x99,0x1d,0x61,0x6e,0x64,0x70, +0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x99,0x61,0xa2,0xe1,0x68, +0xa4,0xb,0x6a,0x10,0x6b,0xa2,0x47,4,0x63,0x8c,0x65,0xa2,0x80,0x72,0xa2,0x98, +0x73,0xa2,0xaa,0x75,0x1f,0x6e,0x69,0x66,0x69,0x65,0x64,0x69,0x64,0x65,0x6f,0x67, +0x72,0x61,0x70,0x68,0x73,0xa2,0x47,0x18,0x65,0x78,0x74,0x65,0x6e,0x73,0x69,0x6f, +0x6e,6,0x64,0x6b,0x64,0xa3,0xd1,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e, +0x14,0x6f,0x6d,0x70,0x61,0x74,0xa2,0x45,1,0x66,0x96,0x69,1,0x62,0x44,0x64, +0x17,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x12,0x73,0x75,0x70,0xa3, +0x5f,0x14,0x69,0x6c,0x69,0x74,0x79,0xa2,0x45,1,0x66,0x54,0x69,0x18,0x64,0x65, +0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x19,0x73,0x75,0x70,0x70,0x6c,0x65, +0x6d,0x65,0x6e,0x74,0xa3,0x5f,0x13,0x6f,0x72,0x6d,0x73,0xa3,0x53,0x11,0x78,0x74, +6,0x64,0xc,0x64,0xa3,0xd1,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e,0x61, +0xa3,0x46,0x62,0xa3,0x5e,0x63,0xa3,0xc5,0x19,0x61,0x64,0x69,0x63,0x61,0x6c,0x73, +0x73,0x75,0x70,0x94,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x95,1,0x74,0x50, +0x79,0x14,0x6d,0x62,0x6f,0x6c,0x73,0x9a,0x1d,0x61,0x6e,0x64,0x70,0x75,0x6e,0x63, +0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x9b,0x14,0x72,0x6f,0x6b,0x65,0x73,0xa3,0x82, +2,0x6e,0x48,0x72,0x64,0x75,0x1d,0x63,0x61,0x73,0x69,0x61,0x6e,0x61,0x6c,0x62, +0x61,0x6e,0x69,0x61,0x6e,0xa3,0xde,0x1d,0x61,0x64,0x69,0x61,0x6e,0x73,0x79,0x6c, +0x6c,0x61,0x62,0x69,0x63,0x73,0x63,0x12,0x69,0x61,0x6e,0xa3,0xa8,2,0x61,0x3a, +0x65,0x4c,0x6f,0x16,0x72,0x61,0x73,0x6d,0x69,0x61,0x6e,0xa5,0x2d,1,0x6b,0x26, +0x6d,0xa3,0xa4,0x11,0x6d,0x61,0xa3,0xd4,1,0x72,0x38,0x73,0x17,0x73,0x73,0x79, +0x6d,0x62,0x6f,0x6c,0x73,0xa5,0x19,0x13,0x6f,0x6b,0x65,0x65,0x60,0x12,0x73,0x75, +0x70,0xa2,0xff,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xff,3,0x65,0x3e, +0x69,0x7e,0x6f,0xa2,0x69,0x75,0x15,0x70,0x6c,0x6f,0x79,0x61,0x6e,0xa3,0xe1,1, +0x73,0x50,0x76,0x16,0x61,0x6e,0x61,0x67,0x61,0x72,0x69,0x3e,0x12,0x65,0x78,0x74, +0xa2,0xb3,0x14,0x65,0x6e,0x64,0x65,0x64,0xa3,0xb3,0x13,0x65,0x72,0x65,0x74,0xa3, +0x5a,2,0x61,0x3a,0x6e,0x82,0x76,0x16,0x65,0x73,0x61,0x6b,0x75,0x72,0x75,0xa5, +0x2f,0x18,0x63,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x73,0x2e,2,0x65,0x30,0x66, +0x36,0x73,0x11,0x75,0x70,0xa3,0x83,0x11,0x78,0x74,0xa3,0xe0,0x18,0x6f,0x72,0x73, +0x79,0x6d,0x62,0x6f,0x6c,0x73,0x77,0x14,0x67,0x62,0x61,0x74,0x73,0x91,1,0x67, +0x3e,0x6d,0x12,0x69,0x6e,0x6f,0xa2,0xab,0x14,0x74,0x69,0x6c,0x65,0x73,0xa3,0xab, +0x11,0x72,0x61,0xa5,0x1a,8,0x6d,0x5f,0x6d,0x3a,0x6e,0x48,0x73,0x7a,0x76,0xa2, +0x4b,0x77,0x12,0x69,0x64,0x65,0x43,0x11,0x65,0x64,0x32,0x12,0x69,0x61,0x6c,0x33, +2,0x61,0x40,0x62,0x37,0x6f,1,0x62,0x28,0x6e,0x10,0x65,0x21,0x13,0x72,0x65, +0x61,0x6b,0x37,0x10,0x72,0x34,0x12,0x72,0x6f,0x77,0x35,2,0x6d,0x38,0x71,0x46, +0x75,1,0x62,0x3d,0x70,0x3e,0x11,0x65,0x72,0x3f,1,0x61,0x24,0x6c,0x39,0x11, +0x6c,0x6c,0x39,1,0x72,0x3b,0x75,0x12,0x61,0x72,0x65,0x3b,0x12,0x65,0x72,0x74, +0x40,0x13,0x69,0x63,0x61,0x6c,0x41,0x63,0x58,0x65,0x92,0x66,0x96,0x69,1,0x6e, +0x36,0x73,0x10,0x6f,0x30,0x14,0x6c,0x61,0x74,0x65,0x64,0x31,0x11,0x69,0x74,0x2e, +0x12,0x69,0x61,0x6c,0x2f,2,0x61,0x36,0x69,0x48,0x6f,0x10,0x6d,0x24,0x12,0x70, +0x61,0x74,0x25,0x10,0x6e,0x22,0x15,0x6f,0x6e,0x69,0x63,0x61,0x6c,0x23,0x13,0x72, +0x63,0x6c,0x65,0x27,0x11,0x6e,0x63,0x27,2,0x69,0x3a,0x6f,0x44,0x72,0x10,0x61, +0x2c,0x14,0x63,0x74,0x69,0x6f,0x6e,0x2d,0x10,0x6e,0x28,0x11,0x61,0x6c,0x29,0x11, +0x6e,0x74,0x2b,4,0x61,0x3a,0x66,0x4c,0x68,0x5e,0x6e,0x70,0x77,0x2a,0x12,0x69, +0x64,0x65,0x2b,0x22,0x17,0x6d,0x62,0x69,0x67,0x75,0x6f,0x75,0x73,0x23,0x26,0x17, +0x75,0x6c,0x6c,0x77,0x69,0x64,0x74,0x68,0x27,0x24,0x17,0x61,0x6c,0x66,0x77,0x69, +0x64,0x74,0x68,0x25,0x20,1,0x61,0x30,0x65,0x14,0x75,0x74,0x72,0x61,0x6c,0x21, +0x28,0x13,0x72,0x72,0x6f,0x77,0x29,0xd,0x6e,0xc0,0xfb,0x73,0x6d,0x73,0x3a,0x74, +0x98,0x75,0xa2,0x49,0x7a,2,0x6c,0x3b,0x70,0x3d,0x73,0x39,5,0x6f,0x28,0x6f, +0x57,0x70,0x34,0x75,0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x45,0x11,0x61,0x63, +1,0x65,0x32,0x69,0x15,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x31,0x18,0x73,0x65,0x70, +0x61,0x72,0x61,0x74,0x6f,0x72,0x39,0x63,0x53,0x6b,0x55,0x6d,0x51,0x1d,0x69,0x74, +0x6c,0x65,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x27,1,0x6e,0x40, +0x70,0x1c,0x70,0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x23, +0x17,0x61,0x73,0x73,0x69,0x67,0x6e,0x65,0x64,0x21,0x6e,0x8a,0x6f,0xa2,0x47,0x70, +8,0x66,0x14,0x66,0x5b,0x69,0x59,0x6f,0x4f,0x72,0x24,0x73,0x49,0x17,0x69,0x76, +0x61,0x74,0x65,0x75,0x73,0x65,0x43,0x61,0x2c,0x63,0x4d,0x64,0x47,0x65,0x4b,0x1f, +0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72, +0x3d,2,0x64,0x33,0x6c,0x35,0x6f,0x36,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e, +0x67,0x6d,0x61,0x72,0x6b,0x2d,1,0x70,0x7c,0x74,0x12,0x68,0x65,0x72,3,0x6c, +0x38,0x6e,0x42,0x70,0x4c,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0x57,0x14,0x65,0x74, +0x74,0x65,0x72,0x2b,0x14,0x75,0x6d,0x62,0x65,0x72,0x37,0x19,0x75,0x6e,0x63,0x74, +0x75,0x61,0x74,0x69,0x6f,0x6e,0x4f,0x1c,0x65,0x6e,0x70,0x75,0x6e,0x63,0x74,0x75, +0x61,0x74,0x69,0x6f,0x6e,0x49,0x66,0x9e,0x66,0x88,0x69,0xa2,0x4b,0x6c,0xa2,0x5c, +0x6d,4,0x61,0x60,0x63,0x31,0x65,0x2f,0x6e,0x2d,0x6f,0x15,0x64,0x69,0x66,0x69, +0x65,0x72,1,0x6c,0x30,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0x55,0x14,0x65,0x74, +0x74,0x65,0x72,0x29,0x17,0x74,0x68,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x51,1,0x69, +0x2e,0x6f,0x13,0x72,0x6d,0x61,0x74,0x41,0x1d,0x6e,0x61,0x6c,0x70,0x75,0x6e,0x63, +0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x5b,0x10,0x6e,0x1f,0x69,0x74,0x69,0x61,0x6c, +0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x59,6,0x6d,0x18,0x6d, +0x29,0x6f,0x28,0x74,0x27,0x75,0x23,0x2a,0x1c,0x77,0x65,0x72,0x63,0x61,0x73,0x65, +0x6c,0x65,0x74,0x74,0x65,0x72,0x25,0x65,0x28,0x69,0x3c,0x6c,0x25,0x19,0x74,0x74, +0x65,0x72,0x6e,0x75,0x6d,0x62,0x65,0x72,0x35,0x1a,0x6e,0x65,0x73,0x65,0x70,0x61, +0x72,0x61,0x74,0x6f,0x72,0x3b,0x63,0x44,0x64,0xa2,0x60,0x65,0x1b,0x6e,0x63,0x6c, +0x6f,0x73,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x2f,6,0x6e,0x39,0x6e,0x46,0x6f, +0x4e,0x73,0x45,0x75,0x1b,0x72,0x72,0x65,0x6e,0x63,0x79,0x73,0x79,0x6d,0x62,0x6f, +0x6c,0x53,0x20,0x12,0x74,0x72,0x6c,0x3f,0x42,0x10,0x6e,1,0x6e,0x2c,0x74,0x12, +0x72,0x6f,0x6c,0x3f,0x1f,0x65,0x63,0x74,0x6f,0x72,0x70,0x75,0x6e,0x63,0x74,0x75, +0x61,0x74,0x69,0x6f,0x6e,0x4d,0x63,0x3f,0x66,0x41,0x6c,0x1d,0x6f,0x73,0x65,0x70, +0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4b,2,0x61,0x30,0x65,0x4a, +0x69,0x12,0x67,0x69,0x74,0x33,0x1c,0x73,0x68,0x70,0x75,0x6e,0x63,0x74,0x75,0x61, +0x74,0x69,0x6f,0x6e,0x47,0x1a,0x63,0x69,0x6d,0x61,0x6c,0x6e,0x75,0x6d,0x62,0x65, +0x72,0x33,0,0x12,0x6d,0xc2,0x3f,0x73,0xa1,0x73,0x4e,0x74,0xa2,0x56,0x77,0xa2, +0x72,0x79,0xa2,0x73,0x7a,1,0x61,0x2c,0x68,0x12,0x61,0x69,0x6e,0x8b,0x11,0x69, +0x6e,0x85,5,0x74,0x22,0x74,0x38,0x77,0x4c,0x79,0x16,0x72,0x69,0x61,0x63,0x77, +0x61,0x77,0x6f,0x18,0x72,0x61,0x69,0x67,0x68,0x74,0x77,0x61,0x77,0xa3,0x55,0x15, +0x61,0x73,0x68,0x6b,0x61,0x66,0x6d,0x61,0x2e,0x65,0x38,0x68,0x11,0x69,0x6e,0x6b, +0x10,0x64,0x62,0x11,0x68,0x65,0x65,1,0x65,0x2e,0x6d,0x13,0x6b,0x61,0x74,0x68, +0x69,0x10,0x6e,0x67,1,0x61,0x4e,0x65,1,0x68,0x28,0x74,0x10,0x68,0x77,0x16, +0x6d,0x61,0x72,0x62,0x75,0x74,0x61,0x74,0x13,0x67,0x6f,0x61,0x6c,0x3d,1,0x68, +0x71,0x77,0x73,0x11,0x61,0x77,0x79,1,0x65,0x32,0x75,0x11,0x64,0x68,0x80,0x11, +0x68,0x65,0x83,0x10,0x68,0x7a,1,0x62,0x34,0x77,0x16,0x69,0x74,0x68,0x74,0x61, +0x69,0x6c,0x7f,0x14,0x61,0x72,0x72,0x65,0x65,0x7d,0x6d,0x6c,0x6e,0xa4,0x6b,0x70, +0xa4,0x88,0x71,0xa4,0x88,0x72,1,0x65,0x38,0x6f,0x18,0x68,0x69,0x6e,0x67,0x79, +0x61,0x79,0x65,0x68,0x93,1,0x68,0x5f,0x76,0x16,0x65,0x72,0x73,0x65,0x64,0x70, +0x65,0x61,2,0x61,0x2e,0x65,0xa4,0x3e,0x69,0x10,0x6d,0x53,1,0x6c,0xa2,0xe7, +0x6e,0x16,0x69,0x63,0x68,0x61,0x65,0x61,0x6e,0,0x12,0x6e,0x76,0x73,0x51,0x73, +0x3e,0x74,0x5c,0x77,0xa0,0x79,0xa2,0x42,0x7a,0x13,0x61,0x79,0x69,0x6e,0xa3,0x54, +0x10,0x61,1,0x64,0x2e,0x6d,0x12,0x65,0x6b,0x68,0xa3,0x4c,0x11,0x68,0x65,0xa3, +0x4b,3,0x61,0x38,0x65,0x3c,0x68,0x4a,0x77,0x13,0x65,0x6e,0x74,0x79,0xa3,0x51, +0x10,0x77,0xa3,0x4d,1,0x6e,0xa3,0x4e,0x74,0x10,0x68,0xa3,0x4f,0x14,0x61,0x6d, +0x65,0x64,0x68,0xa3,0x50,0x11,0x61,0x77,0xa3,0x52,0x12,0x6f,0x64,0x68,0xa3,0x53, +0x6e,0x3a,0x6f,0x40,0x70,0x46,0x71,0x4a,0x72,0x12,0x65,0x73,0x68,0xa3,0x4a,0x11, +0x75,0x6e,0xa3,0x46,0x11,0x6e,0x65,0xa3,0x47,0x10,0x65,0xa3,0x48,0x12,0x6f,0x70, +0x68,0xa3,0x49,0x67,0x33,0x67,0x38,0x68,0x40,0x6b,0x5e,0x6c,0x66,0x6d,0x11,0x65, +0x6d,0xa3,0x45,0x13,0x69,0x6d,0x65,0x6c,0xa1,1,0x65,0x32,0x75,0x14,0x6e,0x64, +0x72,0x65,0x64,0xa3,0x42,0x11,0x74,0x68,0xa3,0x41,0x12,0x61,0x70,0x68,0xa3,0x43, +0x14,0x61,0x6d,0x65,0x64,0x68,0xa3,0x44,0x61,0x34,0x62,0x4a,0x64,0x50,0x66,0x12, +0x69,0x76,0x65,0x9f,1,0x6c,0x2a,0x79,0x11,0x69,0x6e,0x97,0x12,0x65,0x70,0x68, +0x95,0x12,0x65,0x74,0x68,0x99,1,0x61,0x30,0x68,0x14,0x61,0x6d,0x65,0x64,0x68, +0x9d,0x13,0x6c,0x65,0x74,0x68,0x9b,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,6,0x6e, +0x2c,0x6e,0x34,0x72,0x5e,0x73,0x62,0x74,0x11,0x74,0x61,0xa3,0x63,2,0x67,0x2e, +0x6e,0x32,0x79,0x10,0x61,0xa3,0x60,0x10,0x61,0xa3,0x5d,1,0x61,0xa3,0x5e,0x6e, +0x10,0x61,0xa3,0x5f,0x10,0x61,0xa3,0x61,0x11,0x73,0x61,0xa3,0x62,0x62,0x3c,0x6a, +0x42,0x6c,0x10,0x6c,1,0x61,0xa3,0x5b,0x6c,0x10,0x61,0xa3,0x5c,0x11,0x68,0x61, +0xa3,0x59,0x10,0x61,0xa3,0x5a,0x11,0x65,0x6d,0x51,2,0x6f,0x2c,0x75,0x50,0x79, +0x10,0x61,0x91,1,0x6a,0x28,0x6f,0x10,0x6e,0x55,0x1a,0x6f,0x69,0x6e,0x69,0x6e, +0x67,0x67,0x72,0x6f,0x75,0x70,0x21,0x10,0x6e,0x57,0x10,0x65,0x59,0x10,0x61,1, +0x66,0x5b,0x70,0x10,0x68,0x5d,0x66,0x9a,0x66,0x42,0x67,0x7a,0x68,0x8a,0x6b,0xa2, +0x75,0x6c,0x11,0x61,0x6d,0x4c,0x12,0x61,0x64,0x68,0x4f,2,0x61,0x3e,0x65,0x4a, +0x69,0x19,0x6e,0x61,0x6c,0x73,0x65,0x6d,0x6b,0x61,0x74,0x68,0x35,0x15,0x72,0x73, +0x69,0x79,0x65,0x68,0x8f,0x86,0x10,0x68,0x33,0x10,0x61,1,0x66,0x37,0x6d,0x11, +0x61,0x6c,0x39,1,0x61,0x40,0x65,0x3e,1,0x68,0x28,0x74,0x10,0x68,0x45,0x40, +0x13,0x67,0x6f,0x61,0x6c,0x43,2,0x68,0x3b,0x6d,0x5c,0x6e,0x1a,0x69,0x66,0x69, +0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,1,0x6b,0x2a,0x70,0x10,0x61,0xa3,0x65, +0x15,0x69,0x6e,0x6e,0x61,0x79,0x61,0xa3,0x64,0x1a,0x7a,0x61,0x6f,0x6e,0x68,0x65, +0x68,0x67,0x6f,0x61,0x6c,0x3d,2,0x61,0x3a,0x68,0x44,0x6e,0x17,0x6f,0x74,0x74, +0x65,0x64,0x68,0x65,0x68,0x4b,1,0x66,0x47,0x70,0x10,0x68,0x49,0x12,0x61,0x70, +0x68,0x89,0x61,0x2e,0x62,0x8a,0x64,0xa2,0x51,0x65,0x31,2,0x66,0x3c,0x69,0x70, +0x6c,1,0x61,0x28,0x65,0x10,0x66,0x27,0x11,0x70,0x68,0x25,0x14,0x72,0x69,0x63, +0x61,0x6e,2,0x66,0x30,0x6e,0x36,0x71,0x11,0x61,0x66,0xa3,0x58,0x11,0x65,0x68, +0xa3,0x56,0x12,0x6f,0x6f,0x6e,0xa3,0x57,0x10,0x6e,0x23,1,0x65,0x4a,0x75,0x10, +0x72,0x1f,0x75,0x73,0x68,0x61,0x73,0x6b,0x69,0x79,0x65,0x68,0x62,0x61,0x72,0x72, +0x65,0x65,0x8d,1,0x68,0x29,0x74,0x10,0x68,0x2b,0x11,0x61,0x6c,0x2c,0x16,0x61, +0x74,0x68,0x72,0x69,0x73,0x68,0x2f,7,0x6e,0x2e,0x6e,0x2c,0x72,0x3e,0x74,0x56, +0x75,0x21,0x18,0x6f,0x6e,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x21,0x28,0x1a,0x69, +0x67,0x68,0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x29,0x2a,0x19,0x72,0x61,0x6e, +0x73,0x70,0x61,0x72,0x65,0x6e,0x74,0x2b,0x63,0x23,0x64,0x40,0x6a,0x56,0x6c,0x26, +0x19,0x65,0x66,0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x27,0x24,0x19,0x75,0x61, +0x6c,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x25,0x19,0x6f,0x69,0x6e,0x63,0x61,0x75, +0x73,0x69,0x6e,0x67,0x23,0,0x13,0x6e,0xc0,0xd0,0x73,0x49,0x73,0x48,0x75,0x78, +0x77,0x84,0x78,0x9c,0x7a,0x10,0x77,0x58,1,0x6a,0x75,0x73,0x13,0x70,0x61,0x63, +0x65,0x59,4,0x61,0x51,0x67,0x53,0x70,0x28,0x75,0x30,0x79,0x57,0x54,0x12,0x61, +0x63,0x65,0x55,0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x53,0x15,0x6e,0x6b,0x6e, +0x6f,0x77,0x6e,0x21,1,0x6a,0x5d,0x6f,0x17,0x72,0x64,0x6a,0x6f,0x69,0x6e,0x65, +0x72,0x5d,0x10,0x78,0x21,0x6e,0x60,0x6f,0xa2,0x41,0x70,0xa2,0x50,0x71,0xa2,0x6e, +0x72,1,0x65,0x24,0x69,0x6f,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64, +0x69,0x63,0x61,0x74,0x6f,0x72,0x6f,4,0x65,0x3e,0x6c,0x5b,0x6f,0x46,0x73,0x45, +0x75,0x46,0x14,0x6d,0x65,0x72,0x69,0x63,0x47,0x15,0x78,0x74,0x6c,0x69,0x6e,0x65, +0x5b,0x17,0x6e,0x73,0x74,0x61,0x72,0x74,0x65,0x72,0x45,0x10,0x70,0x48,0x1c,0x65, +0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x49,1,0x6f,0x3e, +0x72,0x4c,0x1a,0x65,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69,0x63,0x4d,0x4a, +0x1b,0x73,0x74,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69,0x63,0x4b,0x10,0x75, +0x4e,0x16,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x4f,0x68,0x7b,0x68,0x50,0x69,0x86, +0x6a,0xa2,0x61,0x6c,0xa2,0x65,0x6d,0x1c,0x61,0x6e,0x64,0x61,0x74,0x6f,0x72,0x79, +0x62,0x72,0x65,0x61,0x6b,0x2d,4,0x32,0x5f,0x33,0x61,0x65,0x34,0x6c,0x6d,0x79, +0x3a,0x13,0x70,0x68,0x65,0x6e,0x3b,0x19,0x62,0x72,0x65,0x77,0x6c,0x65,0x74,0x74, +0x65,0x72,0x6d,2,0x64,0x28,0x6e,0x3c,0x73,0x41,0x3c,0x18,0x65,0x6f,0x67,0x72, +0x61,0x70,0x68,0x69,0x63,0x3d,0x3e,1,0x66,0x3e,0x73,0x11,0x65,0x70,1,0x61, +0x22,0x65,0x14,0x72,0x61,0x62,0x6c,0x65,0x3f,0x18,0x69,0x78,0x6e,0x75,0x6d,0x65, +0x72,0x69,0x63,0x41,2,0x6c,0x63,0x74,0x65,0x76,0x67,1,0x66,0x43,0x69,0x15, +0x6e,0x65,0x66,0x65,0x65,0x64,0x43,0x61,0x40,0x62,0x70,0x63,0xa2,0x55,0x65,0xa2, +0xdb,0x67,0x10,0x6c,0x38,0x11,0x75,0x65,0x39,2,0x69,0x23,0x6c,0x34,0x6d,0x16, +0x62,0x69,0x67,0x75,0x6f,0x75,0x73,0x23,0x24,0x17,0x70,0x68,0x61,0x62,0x65,0x74, +0x69,0x63,0x25,4,0x32,0x27,0x61,0x29,0x62,0x2b,0x6b,0x2d,0x72,0x12,0x65,0x61, +0x6b,2,0x61,0x36,0x62,0x3e,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x57,0x13, +0x66,0x74,0x65,0x72,0x29,1,0x65,0x2a,0x6f,0x11,0x74,0x68,0x27,0x13,0x66,0x6f, +0x72,0x65,0x2b,7,0x6d,0x51,0x6d,0x33,0x6f,0x28,0x70,0x69,0x72,0x35,1,0x6d, +0x76,0x6e,1,0x64,0x3c,0x74,0x1a,0x69,0x6e,0x67,0x65,0x6e,0x74,0x62,0x72,0x65, +0x61,0x6b,0x2f,0x15,0x69,0x74,0x69,0x6f,0x6e,0x61,0x1f,0x6c,0x6a,0x61,0x70,0x61, +0x6e,0x65,0x73,0x65,0x73,0x74,0x61,0x72,0x74,0x65,0x72,0x6b,1,0x62,0x3a,0x70, +0x19,0x6c,0x65,0x78,0x63,0x6f,0x6e,0x74,0x65,0x78,0x74,0x51,0x18,0x69,0x6e,0x69, +0x6e,0x67,0x6d,0x61,0x72,0x6b,0x33,0x61,0x6a,0x62,0x2f,0x6a,0x6b,0x6c,0x30,0x13, +0x6f,0x73,0x65,0x70,1,0x61,0x38,0x75,0x18,0x6e,0x63,0x74,0x75,0x61,0x74,0x69, +0x6f,0x6e,0x31,0x18,0x72,0x65,0x6e,0x74,0x68,0x65,0x73,0x69,0x73,0x69,0x1b,0x72, +0x72,0x69,0x61,0x67,0x65,0x72,0x65,0x74,0x75,0x72,0x6e,0x35,2,0x62,0x3e,0x6d, +0x46,0x78,0x36,0x18,0x63,0x6c,0x61,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x37,0x70,0x12, +0x61,0x73,0x65,0x71,0x72,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x73,1,0x64, +0x42,0x6e,1,0x6f,0x32,0x75,0x26,0x14,0x6d,0x65,0x72,0x69,0x63,0x27,0x11,0x6e, +0x65,0x21,1,0x65,0x2e,0x69,0x24,0x12,0x67,0x69,0x74,0x25,0x22,0x14,0x63,0x69, +0x6d,0x61,0x6c,0x23,0,0x18,0x6e,0xc4,0x2a,0x74,0xc1,0x6d,0x77,0x96,0x77,0xa2, +0x4c,0x78,0xa2,0x70,0x79,0xa2,0x7a,0x7a,6,0x73,0x1e,0x73,0x34,0x78,0x42,0x79, +0x48,0x7a,0x11,0x7a,0x7a,0xa3,0x67,0x10,0x79,1,0x65,0xa3,0xae,0x6d,0xa3,0x81, +0x11,0x78,0x78,0xa3,0x66,0x11,0x79,0x79,0x21,0x61,0x30,0x69,0x58,0x6d,0x11,0x74, +0x68,0xa3,0x80,0x10,0x6e,1,0x61,0x26,0x62,0xa3,0xb1,0x1a,0x62,0x61,0x7a,0x61, +0x72,0x73,0x71,0x75,0x61,0x72,0x65,0xa3,0xb1,0x11,0x6e,0x68,0x23,2,0x61,0x30, +0x63,0x5a,0x6f,0x11,0x6c,0x65,0xa3,0x9b,1,0x6e,0x3c,0x72,0x10,0x61,0xa2,0x92, +0x15,0x6e,0x67,0x63,0x69,0x74,0x69,0xa3,0x92,0x12,0x63,0x68,0x6f,0xa3,0xbc,0x11, +0x68,0x6f,0xa3,0xbc,1,0x70,0x2c,0x73,0x11,0x75,0x78,0xa3,0x65,0x11,0x65,0x6f, +0x9b,1,0x65,0x2c,0x69,0x72,0x11,0x69,0x69,0x73,0x11,0x7a,0x69,0xa2,0xc0,0x11, +0x64,0x69,0xa3,0xc0,0x74,0x4a,0x75,0xa2,0xba,0x76,1,0x61,0x2c,0x69,0x11,0x73, +0x70,0xa3,0x64,0x10,0x69,0xa2,0x63,0x10,0x69,0xa3,0x63,5,0x67,0x36,0x67,0x68, +0x68,0x6c,0x69,2,0x62,0x3a,0x66,0x4a,0x72,0x10,0x68,0xa2,0x9e,0x12,0x75,0x74, +0x61,0xa3,0x9e,1,0x65,0x24,0x74,0x6f,0x12,0x74,0x61,0x6e,0x6f,0x14,0x69,0x6e, +0x61,0x67,0x68,0x99,0x11,0x6c,0x67,0x75,0x10,0x61,1,0x61,0x24,0x69,0x6d,0x6a, +0x11,0x6e,0x61,0x6b,0x61,0x30,0x65,0xa2,0x5b,0x66,0x11,0x6e,0x67,0x99,6,0x6c, +0x21,0x6c,0x32,0x6d,0x38,0x6e,0x44,0x76,0x10,0x74,0xa3,0x7f,1,0x65,0x89,0x75, +0x97,1,0x69,0x24,0x6c,0x67,0x10,0x6c,0x67,0x10,0x67,0xa2,0x9a,0x11,0x75,0x74, +0xa3,0x9a,0x67,0x36,0x69,0x52,0x6b,0x10,0x72,0xa2,0x99,0x10,0x69,0xa3,0x99,1, +0x61,0x30,0x62,0x7a,0x13,0x61,0x6e,0x77,0x61,0x7b,0x12,0x6c,0x6f,0x67,0x75,2, +0x6c,0x32,0x74,0x34,0x76,0x12,0x69,0x65,0x74,0xa3,0x7f,0x10,0x65,0x89,0x12,0x68, +0x61,0x6d,0xa3,0x6a,1,0x6c,0x2a,0x6e,0x10,0x67,0xa3,0x62,0x10,0x75,0x68,0x11, +0x67,0x75,0x69,1,0x67,0x32,0x6e,0x14,0x6b,0x6e,0x6f,0x77,0x6e,0xa3,0x67,0x11, +0x61,0x72,0x8a,0x13,0x69,0x74,0x69,0x63,0x8b,0x71,0xc1,0x13,0x71,0xa2,0xde,0x72, +0xa2,0xe3,0x73,6,0x69,0x8a,0x69,0x72,0x6f,0xa2,0x4c,0x75,0xa2,0x75,0x79,1, +0x6c,0x46,0x72,4,0x63,0x65,0x65,0xa3,0x5f,0x69,0x2c,0x6a,0xa3,0x60,0x6e,0xa3, +0x61,0x11,0x61,0x63,0x65,0x10,0x6f,0x94,0x16,0x74,0x69,0x6e,0x61,0x67,0x72,0x69, +0x95,2,0x64,0x3c,0x67,0x4c,0x6e,1,0x64,0xa3,0x91,0x68,0x62,0x12,0x61,0x6c, +0x61,0x63,0x10,0x64,0xa2,0xa6,0x12,0x68,0x61,0x6d,0xa3,0xa6,0x17,0x6e,0x77,0x72, +0x69,0x74,0x69,0x6e,0x67,0xa3,0x70,2,0x67,0x3a,0x72,0x52,0x79,0x10,0x6f,0xa2, +0xb0,0x12,0x6d,0x62,0x6f,0xa3,0xb0,1,0x64,0x26,0x6f,0xa3,0xb8,0xa2,0xb7,0x12, +0x69,0x61,0x6e,0xa3,0xb7,0x10,0x61,0xa2,0x98,0x16,0x73,0x6f,0x6d,0x70,0x65,0x6e, +0x67,0xa3,0x98,0x11,0x6e,0x64,0xa2,0x71,0x14,0x61,0x6e,0x65,0x73,0x65,0xa3,0x71, +0x61,0x5c,0x67,0xa2,0x43,0x68,1,0x61,0x2a,0x72,0x10,0x64,0xa3,0x97,2,0x72, +0x28,0x76,0x30,0x77,0x87,0x12,0x61,0x64,0x61,0xa3,0x97,0x12,0x69,0x61,0x6e,0x87, +2,0x6d,0x40,0x72,0x58,0x75,0x10,0x72,0xa2,0x6f,0x15,0x61,0x73,0x68,0x74,0x72, +0x61,0xa3,0x6f,1,0x61,0x26,0x72,0xa3,0x7e,0x14,0x72,0x69,0x74,0x61,0x6e,0xa3, +0x7e,1,0x61,0xa3,0x5e,0x62,0xa3,0x85,0x11,0x6e,0x77,0xa3,0x70,0x11,0x61,0x61, +1,0x63,0x2f,0x69,0x23,3,0x65,0x3e,0x6a,0x48,0x6f,0x4e,0x75,0x10,0x6e,1, +0x69,0x24,0x72,0x61,0x10,0x63,0x61,0x13,0x6a,0x61,0x6e,0x67,0xa3,0x6e,0x11,0x6e, +0x67,0xa3,0x6e,1,0x68,0x2a,0x72,0x10,0x6f,0xa3,0x5d,0x10,0x67,0xa3,0xb6,0x6e, +0xa2,0x83,0x6f,0xa2,0xf2,0x70,5,0x6c,0x1e,0x6c,0x44,0x72,0x4a,0x73,0x1b,0x61, +0x6c,0x74,0x65,0x72,0x70,0x61,0x68,0x6c,0x61,0x76,0x69,0xa3,0x7b,0x11,0x72,0x64, +0xa3,0x5c,0x11,0x74,0x69,0xa3,0x7d,0x61,0x7c,0x65,0xa2,0x54,0x68,3,0x61,0x3e, +0x6c,0x4e,0x6e,0x5e,0x6f,0x16,0x65,0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3,0x5b,0x10, +0x67,0xa2,0x5a,0x12,0x73,0x70,0x61,0xa3,0x5a,2,0x69,0xa3,0x7a,0x70,0xa3,0x7b, +0x76,0xa3,0x7c,0x10,0x78,0xa3,0x5b,2,0x68,0x3e,0x6c,0x50,0x75,0x10,0x63,0xa2, +0xa5,0x14,0x69,0x6e,0x68,0x61,0x75,0xa3,0xa5,0x17,0x61,0x77,0x68,0x68,0x6d,0x6f, +0x6e,0x67,0xa3,0x4b,0x10,0x6d,0xa2,0x90,0x14,0x79,0x72,0x65,0x6e,0x65,0xa3,0x90, +0x11,0x72,0x6d,0xa3,0x59,6,0x6b,0x36,0x6b,0x56,0x73,0x6e,0x75,0x74,0x79,0x11, +0x69,0x61,0x1f,0x6b,0x65,0x6e,0x67,0x70,0x75,0x61,0x63,0x68,0x75,0x65,0x68,0x6d, +0x6f,0x6e,0x67,0xa3,0xba,1,0x67,0x2e,0x6f,0xa2,0x57,0x10,0x6f,0xa3,0x57,0x10, +0x62,0xa3,0x84,0x11,0x68,0x75,0xa3,0x96,0x12,0x73,0x68,0x75,0xa3,0x96,0x61,0x42, +0x62,0x80,0x65,0x10,0x77,1,0x61,0xa3,0xaa,0x74,0x14,0x61,0x69,0x6c,0x75,0x65, +0x97,2,0x62,0x2e,0x6e,0x3c,0x72,0x10,0x62,0xa3,0x8e,0x15,0x61,0x74,0x61,0x65, +0x61,0x6e,0xa3,0x8f,0x10,0x64,0xa2,0xbb,0x16,0x69,0x6e,0x61,0x67,0x61,0x72,0x69, +0xa3,0xbb,0x11,0x61,0x74,0xa3,0x8f,3,0x67,0x5a,0x6c,0x6c,0x72,0xa2,0x93,0x73, +2,0x61,0x36,0x67,0x3c,0x6d,0x10,0x61,0x84,0x12,0x6e,0x79,0x61,0x85,0x11,0x67, +0x65,0xa3,0xab,0x10,0x65,0xa3,0xab,1,0x61,0x2a,0x68,0x11,0x61,0x6d,0x5b,0x10, +0x6d,0x5b,1,0x63,0xa2,0x60,0x64,5,0x70,0x37,0x70,0x36,0x73,0x54,0x74,0x14, +0x75,0x72,0x6b,0x69,0x63,0xa3,0x58,0x11,0x65,0x72,1,0x6d,0x2c,0x73,0x12,0x69, +0x61,0x6e,0x9b,0x11,0x69,0x63,0xa3,0x59,0x10,0x6f,1,0x67,0x3a,0x75,0x18,0x74, +0x68,0x61,0x72,0x61,0x62,0x69,0x61,0x6e,0xa3,0x85,0x13,0x64,0x69,0x61,0x6e,0xa3, +0xb8,0x68,0x42,0x69,0x54,0x6e,0x1a,0x6f,0x72,0x74,0x68,0x61,0x72,0x61,0x62,0x69, +0x61,0x6e,0xa3,0x8e,0x17,0x75,0x6e,0x67,0x61,0x72,0x69,0x61,0x6e,0xa3,0x4c,0x14, +0x74,0x61,0x6c,0x69,0x63,0x5d,1,0x68,0x26,0x6b,0xa3,0x6d,0x12,0x69,0x6b,0x69, +0xa3,0x6d,2,0x69,0x2c,0x6b,0x30,0x79,0x10,0x61,0x5f,0x11,0x79,0x61,0x5f,0x10, +0x68,0xa3,0x58,0x68,0xc3,0xd,0x6b,0xc2,0x24,0x6b,0xa4,0x17,0x6c,0xa4,0xb2,0x6d, +8,0x6f,0x46,0x6f,0x48,0x72,0x74,0x74,0x80,0x75,0x86,0x79,1,0x61,0x28,0x6d, +0x10,0x72,0x59,0x13,0x6e,0x6d,0x61,0x72,0x59,2,0x64,0x2e,0x6e,0x32,0x6f,0x10, +0x6e,0xa3,0x72,0x10,0x69,0xa3,0xa3,0x10,0x67,0x56,0x14,0x6f,0x6c,0x69,0x61,0x6e, +0x57,0x10,0x6f,0xa2,0x95,0x10,0x6f,0xa3,0x95,0x11,0x65,0x69,0xa3,0x73,0x11,0x6c, +0x74,0xa2,0xa4,0x12,0x61,0x6e,0x69,0xa3,0xa4,0x61,0x36,0x65,0xa2,0x67,0x69,0xa2, +0xbd,0x6c,0x11,0x79,0x6d,0x55,6,0x6e,0x38,0x6e,0x32,0x72,0x5c,0x73,0x6c,0x79, +0x10,0x61,0xa3,0x55,1,0x64,0x38,0x69,0xa2,0x79,0x15,0x63,0x68,0x61,0x65,0x61, +0x6e,0xa3,0x79,0xa2,0x54,0x12,0x61,0x69,0x63,0xa3,0x54,0x10,0x63,0xa2,0xa9,0x12, +0x68,0x65,0x6e,0xa3,0xa9,0x18,0x61,0x72,0x61,0x6d,0x67,0x6f,0x6e,0x64,0x69,0xa3, +0xaf,0x68,0x36,0x6b,0x4c,0x6c,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,0x55,1,0x61, +0x26,0x6a,0xa3,0xa0,0x13,0x6a,0x61,0x6e,0x69,0xa3,0xa0,0x10,0x61,0xa2,0xb4,0x12, +0x73,0x61,0x72,0xa3,0xb4,3,0x64,0x78,0x65,0x94,0x6e,0xa2,0x42,0x72,1,0x63, +0xa3,0x8d,0x6f,0xa2,0x56,0x13,0x69,0x74,0x69,0x63,1,0x63,0x3c,0x68,0x19,0x69, +0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x56,0x15,0x75,0x72,0x73,0x69, +0x76,0x65,0xa3,0x8d,1,0x65,0x26,0x66,0xa3,0xb5,0x16,0x66,0x61,0x69,0x64,0x72, +0x69,0x6e,0xa3,0xb5,0x17,0x74,0x65,0x69,0x6d,0x61,0x79,0x65,0x6b,0xa3,0x73,0x10, +0x64,0xa2,0x8c,0x17,0x65,0x6b,0x69,0x6b,0x61,0x6b,0x75,0x69,0xa3,0x8c,0x11,0x61, +0x6f,0xa3,0x5c,6,0x6e,0x1a,0x6e,0x34,0x6f,0x38,0x70,0x3e,0x74,0x11,0x68,0x69, +0xa3,0x78,0x11,0x64,0x61,0x4b,0x11,0x72,0x65,0xa3,0x77,0x11,0x65,0x6c,0xa3,0x8a, +0x61,0x30,0x68,0x9a,0x69,0x11,0x74,0x73,0xa3,0xbf,4,0x69,0x3c,0x6c,0x44,0x6e, +0x48,0x74,0x56,0x79,0x13,0x61,0x68,0x6c,0x69,0xa3,0x4f,0x12,0x74,0x68,0x69,0xa3, +0x78,0x10,0x69,0xa3,0x4f,1,0x61,0x4d,0x6e,0x12,0x61,0x64,0x61,0x4b,0x14,0x61, +0x6b,0x61,0x6e,0x61,0x4c,0x19,0x6f,0x72,0x68,0x69,0x72,0x61,0x67,0x61,0x6e,0x61, +0x8d,4,0x61,0x40,0x69,0x52,0x6d,0x70,0x6f,0x7c,0x75,0x15,0x64,0x61,0x77,0x61, +0x64,0x69,0xa3,0x91,0x10,0x72,0x92,0x15,0x6f,0x73,0x68,0x74,0x68,0x69,0x93,0x1d, +0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73,0x63,0x72,0x69,0x70,0x74,0xa3,0xbf, +1,0x65,0x24,0x72,0x4f,0x10,0x72,0x4f,0x10,0x6a,0xa2,0x9d,0x11,0x6b,0x69,0xa3, +0x9d,4,0x61,0x5c,0x65,0x90,0x69,0xa0,0x6f,0xa2,0x5d,0x79,1,0x63,0x34,0x64, +0x10,0x69,0xa2,0x6c,0x11,0x61,0x6e,0xa3,0x6c,0x10,0x69,0xa2,0x6b,0x11,0x61,0x6e, +0xa3,0x6b,2,0x6e,0x42,0x6f,0x46,0x74,3,0x66,0xa3,0x50,0x67,0xa3,0x51,0x69, +0x24,0x6e,0x53,0x10,0x6e,0x53,0x10,0x61,0xa3,0x6a,0x50,0x10,0x6f,0x51,0x11,0x70, +0x63,0xa2,0x52,0x11,0x68,0x61,0xa3,0x52,2,0x6d,0x2e,0x6e,0x36,0x73,0x10,0x75, +0xa3,0x83,0x10,0x62,0x80,0x10,0x75,0x81,2,0x61,0xa3,0x53,0x62,0x83,0x65,0x11, +0x61,0x72,1,0x61,0xa3,0x53,0x62,0x83,0x11,0x6d,0x61,0xa3,0x8b,0x68,0x6e,0x69, +0xa2,0x95,0x6a,2,0x61,0x30,0x70,0x52,0x75,0x11,0x72,0x63,0xa3,0x94,1,0x6d, +0x38,0x76,0x10,0x61,0xa2,0x4e,0x13,0x6e,0x65,0x73,0x65,0xa3,0x4e,0x10,0x6f,0xa3, +0xad,0x11,0x61,0x6e,0xa3,0x69,6,0x6c,0x1e,0x6c,0x34,0x6d,0x3a,0x72,0x48,0x75, +0x11,0x6e,0x67,0xa3,0x4c,0x11,0x75,0x77,0xa3,0x9c,0x10,0x6e,1,0x67,0xa3,0x4b, +0x70,0xa3,0xba,0x11,0x6b,0x74,0x8d,0x61,0x3c,0x65,0xa2,0x43,0x69,0x11,0x72,0x61, +0x48,0x13,0x67,0x61,0x6e,0x61,0x49,1,0x6e,0x34,0x74,0x10,0x72,0xa2,0xa2,0x11, +0x61,0x6e,0xa3,0xa2,0x42,6,0x6f,0xe,0x6f,0x77,0x73,0xa3,0x49,0x74,0xa3,0x4a, +0x75,0x12,0x6e,0x6f,0x6f,0x77,0x62,0xa3,0xac,0x67,0x3e,0x69,0x42,0x19,0x66,0x69, +0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,0xa3,0xb6,0x44,0x11,0x75,0x6c,0x45,0x11, +0x62,0x72,0x46,0x11,0x65,0x77,0x47,2,0x6d,0x2e,0x6e,0x4a,0x74,0x11,0x61,0x6c, +0x5d,0x1c,0x70,0x65,0x72,0x69,0x61,0x6c,0x61,0x72,0x61,0x6d,0x61,0x69,0x63,0xa3, +0x74,2,0x64,0x66,0x68,0x6a,0x73,0x1b,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,0x6e, +0x61,0x6c,0x70,0x61,1,0x68,0x32,0x72,0x14,0x74,0x68,0x69,0x61,0x6e,0xa3,0x7d, +0x13,0x6c,0x61,0x76,0x69,0xa3,0x7a,0x10,0x73,0xa3,0x4d,0x15,0x65,0x72,0x69,0x74, +0x65,0x64,0x23,0x64,0xc1,0xd,0x64,0xa2,0x7a,0x65,0xa2,0xc1,0x67,4,0x65,0x82, +0x6c,0x9a,0x6f,0xa2,0x46,0x72,0xa2,0x55,0x75,2,0x6a,0x3c,0x6e,0x4e,0x72,1, +0x6d,0x24,0x75,0x41,0x13,0x75,0x6b,0x68,0x69,0x41,1,0x61,0x24,0x72,0x3f,0x13, +0x72,0x61,0x74,0x69,0x3f,0x18,0x6a,0x61,0x6c,0x61,0x67,0x6f,0x6e,0x64,0x69,0xa3, +0xb3,0x10,0x6f,1,0x6b,0xa3,0x48,0x72,0x38,0x13,0x67,0x69,0x61,0x6e,0x39,0x11, +0x61,0x67,0x90,0x15,0x6f,0x6c,0x69,0x74,0x69,0x63,0x91,1,0x6e,0x30,0x74,0x10, +0x68,0x3a,0x11,0x69,0x63,0x3b,1,0x67,0xa3,0xb3,0x6d,0xa3,0xaf,1,0x61,0x32, +0x65,1,0x65,0x24,0x6b,0x3d,0x10,0x6b,0x3d,0x10,0x6e,0xa2,0x89,0x12,0x74,0x68, +0x61,0xa3,0x89,4,0x65,0x46,0x69,0x6c,0x6f,0x8c,0x73,0x9a,0x75,0x11,0x70,0x6c, +0xa2,0x87,0x13,0x6f,0x79,0x61,0x6e,0xa3,0x87,1,0x73,0x38,0x76,0x10,0x61,0x34, +0x15,0x6e,0x61,0x67,0x61,0x72,0x69,0x35,0x13,0x65,0x72,0x65,0x74,0x33,1,0x61, +0x36,0x76,0x16,0x65,0x73,0x61,0x6b,0x75,0x72,0x75,0xa3,0xbe,0x10,0x6b,0xa3,0xbe, +0x11,0x67,0x72,0xa2,0xb2,0x10,0x61,0xa3,0xb2,0x11,0x72,0x74,0x33,2,0x67,0x3a, +0x6c,0x72,0x74,0x11,0x68,0x69,0x36,0x13,0x6f,0x70,0x69,0x63,0x37,0x10,0x79,2, +0x64,0xa3,0x45,0x68,0xa3,0x46,0x70,0xa2,0x47,0x1e,0x74,0x69,0x61,0x6e,0x68,0x69, +0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x47,1,0x62,0x36,0x79,0x10, +0x6d,0xa2,0xb9,0x12,0x61,0x69,0x63,0xa3,0xb9,0x10,0x61,0xa2,0x88,0x12,0x73,0x61, +0x6e,0xa3,0x88,0x61,0xa2,0xb4,0x62,0xa4,0x19,0x63,6,0x6f,0x3d,0x6f,0x5a,0x70, +0x76,0x75,0x7a,0x79,1,0x70,0x3e,0x72,2,0x69,0x2a,0x6c,0x31,0x73,0xa3,0x44, +0x13,0x6c,0x6c,0x69,0x63,0x31,0x13,0x72,0x69,0x6f,0x74,0x7f,1,0x6d,0x30,0x70, +0x10,0x74,0x2e,0x11,0x69,0x63,0x2f,0x12,0x6d,0x6f,0x6e,0x21,0x11,0x72,0x74,0x7f, +0x16,0x6e,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa3,0x65,0x61,0x32,0x68,0xa2,0x41,0x69, +0x11,0x72,0x74,0xa3,0x43,3,0x6b,0x4c,0x6e,0x50,0x72,0x76,0x75,0x1d,0x63,0x61, +0x73,0x69,0x61,0x6e,0x61,0x6c,0x62,0x61,0x6e,0x69,0x61,0x6e,0xa3,0x9f,0x10,0x6d, +0xa3,0x76,1,0x61,0x24,0x73,0x71,0x1d,0x64,0x69,0x61,0x6e,0x61,0x62,0x6f,0x72, +0x69,0x67,0x69,0x6e,0x61,0x6c,0x71,0x10,0x69,0xa2,0x68,0x11,0x61,0x6e,0xa3,0x68, +3,0x61,0x32,0x65,0x44,0x6f,0x52,0x72,0x10,0x73,0xa3,0xbd,1,0x6b,0x26,0x6d, +0xa3,0x42,0x11,0x6d,0x61,0xa3,0x76,0x10,0x72,0x2c,0x13,0x6f,0x6b,0x65,0x65,0x2d, +0x16,0x72,0x61,0x73,0x6d,0x69,0x61,0x6e,0xa3,0xbd,6,0x68,0x4a,0x68,0x48,0x6e, +0x4e,0x72,0x76,0x76,1,0x65,0x2a,0x73,0x10,0x74,0xa3,0x75,0x13,0x73,0x74,0x61, +0x6e,0xa3,0x75,0x11,0x6f,0x6d,0xa3,0xa1,0x11,0x61,0x74,0x1f,0x6f,0x6c,0x69,0x61, +0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x9c,1,0x61, +0x3e,0x6d,2,0x65,0x2a,0x69,0xa3,0x74,0x6e,0x27,0x13,0x6e,0x69,0x61,0x6e,0x27, +0x10,0x62,0x24,0x11,0x69,0x63,0x25,0x64,0x30,0x66,0x44,0x67,0x11,0x68,0x62,0xa3, +0x9f,0x10,0x6c,1,0x61,0x26,0x6d,0xa3,0xa7,0x10,0x6d,0xa3,0xa7,0x11,0x61,0x6b, +0xa3,0x93,6,0x6c,0x3c,0x6c,0x52,0x6f,0x56,0x72,0x66,0x75,1,0x67,0x30,0x68, +1,0x64,0x79,0x69,0x10,0x64,0x79,0x10,0x69,0x8e,0x13,0x6e,0x65,0x73,0x65,0x8f, +0x11,0x69,0x73,0xa1,0x11,0x70,0x6f,0x2a,0x13,0x6d,0x6f,0x66,0x6f,0x2b,0x10,0x61, +1,0x68,0x2e,0x69,0x7c,0x12,0x6c,0x6c,0x65,0x7d,0xa2,0x41,0x11,0x6d,0x69,0xa3, +0x41,0x61,0x48,0x65,0x9c,0x68,1,0x61,0x2a,0x6b,0x10,0x73,0xa3,0xa8,0x15,0x69, +0x6b,0x73,0x75,0x6b,0x69,0xa3,0xa8,3,0x6c,0x3a,0x6d,0x48,0x73,0x54,0x74,1, +0x61,0x24,0x6b,0x9f,0x10,0x6b,0x9f,0x10,0x69,0x9c,0x13,0x6e,0x65,0x73,0x65,0x9d, +0x10,0x75,0xa2,0x82,0x10,0x6d,0xa3,0x82,0x10,0x73,0xa2,0x86,0x13,0x61,0x76,0x61, +0x68,0xa3,0x86,0x11,0x6e,0x67,0x28,0x12,0x61,0x6c,0x69,0x29,3,0x6c,0x42,0x6e, +0x90,0x74,0xa2,0x46,0x76,0x24,0x17,0x6f,0x77,0x65,0x6c,0x6a,0x61,0x6d,0x6f,0x25, +0x22,1,0x65,0x54,0x76,0x28,1,0x73,0x38,0x74,0x2a,0x17,0x73,0x79,0x6c,0x6c, +0x61,0x62,0x6c,0x65,0x2b,0x16,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x29,0x18,0x61, +0x64,0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x23,1,0x61,0x21,0x6f,0x1a,0x74,0x61, +0x70,0x70,0x6c,0x69,0x63,0x61,0x62,0x6c,0x65,0x21,0x26,0x1a,0x72,0x61,0x69,0x6c, +0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x27,1,0x6e,0x2c,0x79,0x22,0x11,0x65,0x73, +0x23,0x20,0x10,0x6f,0x21,1,0x6e,0x2c,0x79,0x22,0x11,0x65,0x73,0x23,0x20,0x10, +0x6f,0x21,2,0x6d,0x30,0x6e,0x3a,0x79,0x22,0x11,0x65,0x73,0x23,0x24,0x13,0x61, +0x79,0x62,0x65,0x25,0x20,0x10,0x6f,0x21,2,0x6d,0x30,0x6e,0x3a,0x79,0x22,0x11, +0x65,0x73,0x23,0x24,0x13,0x61,0x79,0x62,0x65,0x25,0x20,0x10,0x6f,0x21,0xb,0x72, +0x39,0x76,0xc,0x76,0x33,0x78,0x2a,0x7a,0x11,0x77,0x6a,0x43,0x10,0x78,0x21,0x72, +0x28,0x73,0x50,0x74,0x31,1,0x65,0x24,0x69,0x39,0x1e,0x67,0x69,0x6f,0x6e,0x61, +0x6c,0x69,0x6e,0x64,0x69,0x63,0x61,0x74,0x6f,0x72,0x39,1,0x6d,0x35,0x70,0x18, +0x61,0x63,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x35,0x6c,0x1f,0x6c,0x3c,0x6f,0x4a, +0x70,1,0x70,0x37,0x72,0x14,0x65,0x70,0x65,0x6e,0x64,0x37,0x28,1,0x66,0x2b, +0x76,0x2c,0x10,0x74,0x2f,0x13,0x74,0x68,0x65,0x72,0x21,0x63,0x4c,0x65,0x64,0x67, +1,0x61,0x3a,0x6c,0x19,0x75,0x65,0x61,0x66,0x74,0x65,0x72,0x7a,0x77,0x6a,0x41, +0x10,0x7a,0x41,2,0x6e,0x23,0x6f,0x24,0x72,0x25,0x14,0x6e,0x74,0x72,0x6f,0x6c, +0x23,2,0x62,0x34,0x6d,0x4e,0x78,0x26,0x13,0x74,0x65,0x6e,0x64,0x27,0x3a,1, +0x61,0x24,0x67,0x3d,0x11,0x73,0x65,0x3a,0x12,0x67,0x61,0x7a,0x3d,0x3e,0x16,0x6f, +0x64,0x69,0x66,0x69,0x65,0x72,0x3f,9,0x6e,0x4a,0x6e,0x34,0x6f,0x44,0x73,0x60, +0x75,0x94,0x78,0x10,0x78,0x21,0x10,0x75,0x2a,0x14,0x6d,0x65,0x72,0x69,0x63,0x2b, +1,0x6c,0x2c,0x74,0x12,0x68,0x65,0x72,0x21,0x14,0x65,0x74,0x74,0x65,0x72,0x2d, +3,0x63,0x36,0x65,0x46,0x70,0x31,0x74,0x32,0x12,0x65,0x72,0x6d,0x33,0x3c,0x16, +0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x3d,0x2e,0x10,0x70,0x2f,0x10,0x70,0x34,0x12, +0x70,0x65,0x72,0x35,0x61,0x46,0x63,0x52,0x65,0x64,0x66,0x72,0x6c,2,0x65,0x2d, +0x66,0x3b,0x6f,0x28,0x12,0x77,0x65,0x72,0x29,0x10,0x74,0x22,0x12,0x65,0x72,0x6d, +0x23,1,0x6c,0x24,0x72,0x37,0x24,0x12,0x6f,0x73,0x65,0x25,0x10,0x78,0x38,0x13, +0x74,0x65,0x6e,0x64,0x39,0x10,0x6f,0x26,0x13,0x72,0x6d,0x61,0x74,0x27,0,0x10, +0x6c,0x88,0x72,0x40,0x72,0x36,0x73,0x5e,0x77,0x7a,0x78,0x8a,0x7a,0x11,0x77,0x6a, +0x4b,1,0x65,0x24,0x69,0x3b,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64, +0x69,0x63,0x61,0x74,0x6f,0x72,0x3b,1,0x69,0x24,0x71,0x3f,0x18,0x6e,0x67,0x6c, +0x65,0x71,0x75,0x6f,0x74,0x65,0x3f,0x17,0x73,0x65,0x67,0x73,0x70,0x61,0x63,0x65, +0x4d,0x10,0x78,0x21,0x6c,0x36,0x6d,0x3c,0x6e,0x76,0x6f,0x13,0x74,0x68,0x65,0x72, +0x21,1,0x65,0x23,0x66,0x35,3,0x62,0x37,0x69,0x28,0x6c,0x29,0x6e,0x2b,0x10, +0x64,1,0x6c,0x34,0x6e,0x11,0x75,0x6d,0x2a,0x12,0x6c,0x65,0x74,0x37,0x14,0x65, +0x74,0x74,0x65,0x72,0x29,2,0x65,0x36,0x6c,0x39,0x75,0x2c,0x14,0x6d,0x65,0x72, +0x69,0x63,0x2d,0x14,0x77,0x6c,0x69,0x6e,0x65,0x39,0x66,0x3f,0x66,0x40,0x67,0x4e, +0x68,0x70,0x6b,0x10,0x61,0x26,0x15,0x74,0x61,0x6b,0x61,0x6e,0x61,0x27,0x10,0x6f, +0x24,0x13,0x72,0x6d,0x61,0x74,0x25,1,0x61,0x3a,0x6c,0x19,0x75,0x65,0x61,0x66, +0x74,0x65,0x72,0x7a,0x77,0x6a,0x49,0x10,0x7a,0x49,1,0x65,0x24,0x6c,0x3d,0x19, +0x62,0x72,0x65,0x77,0x6c,0x65,0x74,0x74,0x65,0x72,0x3d,0x61,0x86,0x63,0x92,0x64, +0x94,0x65,2,0x62,0x44,0x6d,0x5e,0x78,0x2e,0x13,0x74,0x65,0x6e,0x64,0x32,0x15, +0x6e,0x75,0x6d,0x6c,0x65,0x74,0x2f,0x42,1,0x61,0x24,0x67,0x45,0x11,0x73,0x65, +0x42,0x12,0x67,0x61,0x7a,0x45,0x46,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x47, +0x15,0x6c,0x65,0x74,0x74,0x65,0x72,0x23,0x10,0x72,0x31,1,0x6f,0x24,0x71,0x41, +0x18,0x75,0x62,0x6c,0x65,0x71,0x75,0x6f,0x74,0x65,0x41,2,0x63,0x32,0x6e,0x3c, +0x6f,0x22,0x12,0x70,0x65,0x6e,0x23,0x24,0x13,0x6c,0x6f,0x73,0x65,0x25,0x20,0x12, +0x6f,0x6e,0x65,0x21,6,0x6f,0x65,0x6f,0x4a,0x72,0x5c,0x74,0x64,0x76,0x1d,0x69, +0x73,0x75,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72,0x6c,0x65,0x66,0x74,0x3d,0x18,0x76, +0x65,0x72,0x73,0x74,0x72,0x75,0x63,0x6b,0x2d,0x13,0x69,0x67,0x68,0x74,0x2f,0x11, +0x6f,0x70,0x30,0x12,0x61,0x6e,0x64,2,0x62,0x32,0x6c,0x62,0x72,0x13,0x69,0x67, +0x68,0x74,0x3b,0x14,0x6f,0x74,0x74,0x6f,0x6d,0x32,0x12,0x61,0x6e,0x64,1,0x6c, +0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x35,0x12,0x65,0x66,0x74,0x3f,0x12,0x65,0x66, +0x74,0x36,0x17,0x61,0x6e,0x64,0x72,0x69,0x67,0x68,0x74,0x39,0x62,0x2c,0x6c,0x5c, +0x6e,0x10,0x61,0x21,0x14,0x6f,0x74,0x74,0x6f,0x6d,0x22,0x12,0x61,0x6e,0x64,1, +0x6c,0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x27,0x12,0x65,0x66,0x74,0x25,0x12,0x65, +0x66,0x74,0x28,0x17,0x61,0x6e,0x64,0x72,0x69,0x67,0x68,0x74,0x2b,0xd,0x6e,0xaa, +0x72,0x70,0x72,0x92,0x73,0xa2,0x46,0x74,0xa2,0x54,0x76,1,0x69,0x60,0x6f,0x12, +0x77,0x65,0x6c,0x62,1,0x64,0x3a,0x69,0x19,0x6e,0x64,0x65,0x70,0x65,0x6e,0x64, +0x65,0x6e,0x74,0x67,0x17,0x65,0x70,0x65,0x6e,0x64,0x65,0x6e,0x74,0x65,1,0x72, +0x2e,0x73,0x13,0x61,0x72,0x67,0x61,0x61,0x12,0x61,0x6d,0x61,0x5f,0x1d,0x65,0x67, +0x69,0x73,0x74,0x65,0x72,0x73,0x68,0x69,0x66,0x74,0x65,0x72,0x57,0x1e,0x79,0x6c, +0x6c,0x61,0x62,0x6c,0x65,0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x59,0x12,0x6f, +0x6e,0x65,1,0x6c,0x2c,0x6d,0x12,0x61,0x72,0x6b,0x5d,0x14,0x65,0x74,0x74,0x65, +0x72,0x5b,0x6e,0x3c,0x6f,0x7c,0x70,0x18,0x75,0x72,0x65,0x6b,0x69,0x6c,0x6c,0x65, +0x72,0x55,1,0x6f,0x4c,0x75,1,0x6b,0x3c,0x6d,0x12,0x62,0x65,0x72,0x50,0x15, +0x6a,0x6f,0x69,0x6e,0x65,0x72,0x53,0x11,0x74,0x61,0x4f,0x16,0x6e,0x6a,0x6f,0x69, +0x6e,0x65,0x72,0x4d,0x13,0x74,0x68,0x65,0x72,0x21,0x67,0x3e,0x67,0x4a,0x69,0x64, +0x6a,0x82,0x6d,0x1d,0x6f,0x64,0x69,0x66,0x79,0x69,0x6e,0x67,0x6c,0x65,0x74,0x74, +0x65,0x72,0x4b,0x1c,0x65,0x6d,0x69,0x6e,0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72, +0x6b,0x45,0x1e,0x6e,0x76,0x69,0x73,0x69,0x62,0x6c,0x65,0x73,0x74,0x61,0x63,0x6b, +0x65,0x72,0x47,0x14,0x6f,0x69,0x6e,0x65,0x72,0x49,0x61,0xa2,0xba,0x62,0xa2,0xc0, +0x63,1,0x61,0xa2,0xa2,0x6f,0x16,0x6e,0x73,0x6f,0x6e,0x61,0x6e,0x74,0x2a,8, +0x6b,0x67,0x6b,0x48,0x6d,0x52,0x70,0x5c,0x73,0xa2,0x42,0x77,0x19,0x69,0x74,0x68, +0x73,0x74,0x61,0x63,0x6b,0x65,0x72,0x43,0x14,0x69,0x6c,0x6c,0x65,0x72,0x35,0x14, +0x65,0x64,0x69,0x61,0x6c,0x37,1,0x6c,0x52,0x72,0x10,0x65,1,0x63,0x2e,0x66, +0x13,0x69,0x78,0x65,0x64,0x3d,0x19,0x65,0x64,0x69,0x6e,0x67,0x72,0x65,0x70,0x68, +0x61,0x3b,0x18,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64,0x65,0x72,0x39,0x10,0x75,1, +0x62,0x3e,0x63,0x1b,0x63,0x65,0x65,0x64,0x69,0x6e,0x67,0x72,0x65,0x70,0x68,0x61, +0x41,0x15,0x6a,0x6f,0x69,0x6e,0x65,0x64,0x3f,0x64,0x4c,0x66,0x52,0x68,0x5a,0x69, +0x1e,0x6e,0x69,0x74,0x69,0x61,0x6c,0x70,0x6f,0x73,0x74,0x66,0x69,0x78,0x65,0x64, +0x33,0x12,0x65,0x61,0x64,0x2d,0x13,0x69,0x6e,0x61,0x6c,0x2f,0x18,0x65,0x61,0x64, +0x6c,0x65,0x74,0x74,0x65,0x72,0x31,0x1d,0x6e,0x74,0x69,0x6c,0x6c,0x61,0x74,0x69, +0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x29,0x16,0x76,0x61,0x67,0x72,0x61,0x68,0x61,0x23, +1,0x69,0x4a,0x72,0x10,0x61,0x1f,0x68,0x6d,0x69,0x6a,0x6f,0x69,0x6e,0x69,0x6e, +0x67,0x6e,0x75,0x6d,0x62,0x65,0x72,0x27,0x12,0x6e,0x64,0x75,0x25,2,0x72,0x38, +0x74,0x46,0x75,0x26,0x15,0x70,0x72,0x69,0x67,0x68,0x74,0x27,0x20,0x15,0x6f,0x74, +0x61,0x74,0x65,0x64,0x21,1,0x72,0x24,0x75,0x25,0x22,0x18,0x61,0x6e,0x73,0x66, +0x6f,0x72,0x6d,0x65,0x64,1,0x72,0x32,0x75,0x15,0x70,0x72,0x69,0x67,0x68,0x74, +0x25,0x15,0x6f,0x74,0x61,0x74,0x65,0x64,0x23,0xd,0x6e,0xc1,0x86,0x73,0xa8,0x73, +0x4c,0x74,0xa2,0x76,0x75,0xa2,0x83,0x7a,0xd8,0x70,0,2,0x6c,0xd9,0x20,0, +0x70,0xd9,0x40,0,0x73,0xc3,0,0xfe,0xf,0,0,0,7,0x6f,0x3c,0x6f, +0xff,8,0,0,0,0x70,0x3a,0x75,0x6e,0x79,0x13,0x6d,0x62,0x6f,0x6c,0xff, +0xf,0,0,0,0x11,0x61,0x63,1,0x65,0x34,0x69,0x15,0x6e,0x67,0x6d,0x61, +0x72,0x6b,0xa5,0,0x18,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xc3,0, +0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0xe1,0,0,0x63,0xff,2,0,0, +0,0x65,0x38,0x6b,0xff,4,0,0,0,0x6d,0xff,1,0,0,0,0x16, +0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x70,0,0x1d,0x69,0x74,0x6c,0x65,0x63, +0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x31,1,0x6e,0x40,0x70,0x1c,0x70, +0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x25,0x17,0x61,0x73, +0x73,0x69,0x67,0x6e,0x65,0x64,0x23,0x6e,0xa2,0x69,0x6f,0xa2,0x89,0x70,0xfe,0x30, +0xf8,0,0,9,0x69,0x33,0x69,0xff,0x10,0,0,0,0x6f,0xfd,0x80,0, +0,0x72,0x54,0x73,0xf9,0,0,0x75,0x12,0x6e,0x63,0x74,0xfe,0x30,0xf8,0, +0,0x15,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff,0x30,0xf8,0,0,0x17,0x69,0x76, +0x61,0x74,0x65,0x75,0x73,0x65,0xdd,0,0,0x61,0x48,0x63,0xfd,0x40,0,0, +0x64,0xe9,0,0,0x65,0xfd,0x20,0,0,0x66,0xff,0x20,0,0,0,0x1f, +0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72, +0xd9,0x40,0,0xbe,0,3,0x64,0xa7,0,0x6c,0xab,0,0x6f,0x30,0x75,0x13, +0x6d,0x62,0x65,0x72,0xbf,0,0xb2,0,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e, +0x67,0x6d,0x61,0x72,0x6b,0xa1,1,0x70,0x92,0x74,0x12,0x68,0x65,0x72,0xe6,0x80, +1,3,0x6c,0x40,0x6e,0x4a,0x70,0x56,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff, +8,0,0,0,0x14,0x65,0x74,0x74,0x65,0x72,0x61,0x14,0x75,0x6d,0x62,0x65, +0x72,0xb3,0,0x19,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x80, +0,0,0x1c,0x65,0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e, +0xf9,0,0,0x66,0xc0,0xc4,0x66,0xa2,0x47,0x69,0xa2,0x64,0x6c,0xa2,0x79,0x6d, +0xa4,0xc0,4,0x61,0x6c,0x63,0xa5,0,0x65,0xa3,0x80,0x6e,0xa1,0x6f,0x15,0x64, +0x69,0x66,0x69,0x65,0x72,1,0x6c,0x38,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff, +4,0,0,0,0x14,0x65,0x74,0x74,0x65,0x72,0x41,1,0x72,0x3c,0x74,0x16, +0x68,0x73,0x79,0x6d,0x62,0x6f,0x6c,0xff,1,0,0,0,0x10,0x6b,0xa5,0xc0, +1,0x69,0x32,0x6f,0x13,0x72,0x6d,0x61,0x74,0xdb,0,0,0x1d,0x6e,0x61,0x6c, +0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff,0x20,0,0,0, +0x10,0x6e,0x1f,0x69,0x74,0x69,0x61,0x6c,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74, +0x69,0x6f,0x6e,0xff,0x10,0,0,0,0x9c,7,0x6d,0x18,0x6d,0x41,0x6f,0x28, +0x74,0x31,0x75,0x25,0x60,0x1c,0x77,0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74, +0x74,0x65,0x72,0x29,0x63,0x3d,0x65,0x28,0x69,0x42,0x6c,0x29,0x13,0x74,0x74,0x65, +0x72,0x9c,0x15,0x6e,0x75,0x6d,0x62,0x65,0x72,0xab,0,0x1a,0x6e,0x65,0x73,0x65, +0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x20,0,0x63,0x46,0x64,0xa2,0x96,0x65, +0x1b,0x6e,0x63,0x6c,0x6f,0x73,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa3,0x80,0xe6, +0x80,1,7,0x6e,0x57,0x6e,0x52,0x6f,0x5e,0x73,0xe1,0,0,0x75,0x1b,0x72, +0x72,0x65,0x6e,0x63,0x79,0x73,0x79,0x6d,0x62,0x6f,0x6c,0xff,2,0,0,0, +0x22,0x12,0x74,0x72,0x6c,0xd9,0x80,0,0xdc,0,0,1,0x6d,0x62,0x6e,1, +0x6e,0x30,0x74,0x12,0x72,0x6f,0x6c,0xd9,0x80,0,0x1f,0x65,0x63,0x74,0x6f,0x72, +0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x40,0,0,0x19, +0x62,0x69,0x6e,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa5,0xc0,0x61,0x58,0x63,0xd9, +0x80,0,0x66,0xdb,0,0,0x6c,0x1d,0x6f,0x73,0x65,0x70,0x75,0x6e,0x63,0x74, +0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x20,0,0,0x18,0x73,0x65,0x64,0x6c,0x65, +0x74,0x74,0x65,0x72,0x3d,2,0x61,0x32,0x65,0x50,0x69,0x12,0x67,0x69,0x74,0xa7, +0,0x1c,0x73,0x68,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xe9, +0,0,0x1a,0x63,0x69,0x6d,0x61,0x6c,0x6e,0x75,0x6d,0x62,0x65,0x72,0xa7,0 +}; + +const char PropNameData::nameGroups[22098]={ +2,'A','l','p','h','a',0,'A','l','p','h','a','b','e','t','i','c',0, +4,'N',0,'N','o',0,'F',0,'F','a','l','s','e',0,4,'Y',0,'Y','e','s',0,'T',0,'T','r','u','e',0, +2,'N','R',0,'N','o','t','_','R','e','o','r','d','e','r','e','d',0, +2,'O','V',0,'O','v','e','r','l','a','y',0,2,'H','A','N','R',0,'H','a','n','_','R','e','a','d','i','n','g',0, +2,'N','K',0,'N','u','k','t','a',0,2,'K','V',0,'K','a','n','a','_','V','o','i','c','i','n','g',0, +2,'V','R',0,'V','i','r','a','m','a',0,2,'C','C','C','1','0',0,'C','C','C','1','0',0, +2,'C','C','C','1','1',0,'C','C','C','1','1',0,2,'C','C','C','1','2',0,'C','C','C','1','2',0, +2,'C','C','C','1','3',0,'C','C','C','1','3',0,2,'C','C','C','1','4',0,'C','C','C','1','4',0, +2,'C','C','C','1','5',0,'C','C','C','1','5',0,2,'C','C','C','1','6',0,'C','C','C','1','6',0, +2,'C','C','C','1','7',0,'C','C','C','1','7',0,2,'C','C','C','1','8',0,'C','C','C','1','8',0, +2,'C','C','C','1','9',0,'C','C','C','1','9',0,2,'C','C','C','2','0',0,'C','C','C','2','0',0, +2,'C','C','C','2','1',0,'C','C','C','2','1',0,2,'C','C','C','2','2',0,'C','C','C','2','2',0, +2,'C','C','C','2','3',0,'C','C','C','2','3',0,2,'C','C','C','2','4',0,'C','C','C','2','4',0, +2,'C','C','C','2','5',0,'C','C','C','2','5',0,2,'C','C','C','2','6',0,'C','C','C','2','6',0, +2,'C','C','C','2','7',0,'C','C','C','2','7',0,2,'C','C','C','2','8',0,'C','C','C','2','8',0, +2,'C','C','C','2','9',0,'C','C','C','2','9',0,2,'C','C','C','3','0',0,'C','C','C','3','0',0, +2,'C','C','C','3','1',0,'C','C','C','3','1',0,2,'C','C','C','3','2',0,'C','C','C','3','2',0, +2,'C','C','C','3','3',0,'C','C','C','3','3',0,2,'C','C','C','3','4',0,'C','C','C','3','4',0, +2,'C','C','C','3','5',0,'C','C','C','3','5',0,2,'C','C','C','3','6',0,'C','C','C','3','6',0, +2,'C','C','C','8','4',0,'C','C','C','8','4',0,2,'C','C','C','9','1',0,'C','C','C','9','1',0, +2,'C','C','C','1','0','3',0,'C','C','C','1','0','3',0,2,'C','C','C','1','0','7',0,'C','C','C','1','0','7',0, +2,'C','C','C','1','1','8',0,'C','C','C','1','1','8',0,2,'C','C','C','1','2','2',0,'C','C','C','1','2','2',0, +2,'C','C','C','1','2','9',0,'C','C','C','1','2','9',0,2,'C','C','C','1','3','0',0,'C','C','C','1','3','0',0, +2,'C','C','C','1','3','2',0,'C','C','C','1','3','2',0,2,'C','C','C','1','3','3',0,'C','C','C','1','3','3',0, +2,'A','T','B','L',0,'A','t','t','a','c','h','e','d','_','B','e','l','o','w','_','L','e','f','t',0, +2,'A','T','B',0,'A','t','t','a','c','h','e','d','_','B','e','l','o','w',0, +2,'A','T','A',0,'A','t','t','a','c','h','e','d','_','A','b','o','v','e',0, +2,'A','T','A','R',0,'A','t','t','a','c','h','e','d','_','A','b','o','v','e','_','R','i','g','h','t',0, +2,'B','L',0,'B','e','l','o','w','_','L','e','f','t',0,2,'B',0,'B','e','l','o','w',0, +2,'B','R',0,'B','e','l','o','w','_','R','i','g','h','t',0, +2,'L',0,'L','e','f','t',0,2,'R',0,'R','i','g','h','t',0, +2,'A','L',0,'A','b','o','v','e','_','L','e','f','t',0,2,'A',0,'A','b','o','v','e',0, +2,'A','R',0,'A','b','o','v','e','_','R','i','g','h','t',0, +2,'D','B',0,'D','o','u','b','l','e','_','B','e','l','o','w',0, +2,'D','A',0,'D','o','u','b','l','e','_','A','b','o','v','e',0, +2,'I','S',0,'I','o','t','a','_','S','u','b','s','c','r','i','p','t',0, +2,'A','H','e','x',0,'A','S','C','I','I','_','H','e','x','_','D','i','g','i','t',0, +2,'B','i','d','i','_','C',0,'B','i','d','i','_','C','o','n','t','r','o','l',0, +2,'B','i','d','i','_','M',0,'B','i','d','i','_','M','i','r','r','o','r','e','d',0, +2,'D','a','s','h',0,'D','a','s','h',0,2,'D','I',0,'D','e','f','a','u','l','t','_','I','g','n','o','r','a','b','l','e', +'_','C','o','d','e','_','P','o','i','n','t',0,2,'D','e','p',0,'D','e','p','r','e','c','a','t','e','d',0, +2,'D','i','a',0,'D','i','a','c','r','i','t','i','c',0,2,'E','x','t',0,'E','x','t','e','n','d','e','r',0, +2,'C','o','m','p','_','E','x',0,'F','u','l','l','_','C','o','m','p','o','s','i','t','i','o','n','_','E','x','c','l','u','s', +'i','o','n',0,2,'G','r','_','B','a','s','e',0,'G','r','a','p','h','e','m','e','_','B','a','s','e',0, +2,'G','r','_','E','x','t',0,'G','r','a','p','h','e','m','e','_','E','x','t','e','n','d',0, +2,'G','r','_','L','i','n','k',0,'G','r','a','p','h','e','m','e','_','L','i','n','k',0, +2,'H','e','x',0,'H','e','x','_','D','i','g','i','t',0,2,'H','y','p','h','e','n',0,'H','y','p','h','e','n',0, +2,'I','D','C',0,'I','D','_','C','o','n','t','i','n','u','e',0, +2,'I','D','S',0,'I','D','_','S','t','a','r','t',0,2,'I','d','e','o',0,'I','d','e','o','g','r','a','p','h','i','c',0, +2,'I','D','S','B',0,'I','D','S','_','B','i','n','a','r','y','_','O','p','e','r','a','t','o','r',0, +2,'I','D','S','T',0,'I','D','S','_','T','r','i','n','a','r','y','_','O','p','e','r','a','t','o','r',0, +2,'J','o','i','n','_','C',0,'J','o','i','n','_','C','o','n','t','r','o','l',0, +2,'L','O','E',0,'L','o','g','i','c','a','l','_','O','r','d','e','r','_','E','x','c','e','p','t','i','o','n',0, +2,'L','o','w','e','r',0,'L','o','w','e','r','c','a','s','e',0, +2,'M','a','t','h',0,'M','a','t','h',0,2,'N','C','h','a','r',0,'N','o','n','c','h','a','r','a','c','t','e','r','_','C', +'o','d','e','_','P','o','i','n','t',0,2,'Q','M','a','r','k',0,'Q','u','o','t','a','t','i','o','n','_','M','a','r','k',0, +2,'R','a','d','i','c','a','l',0,'R','a','d','i','c','a','l',0, +2,'S','D',0,'S','o','f','t','_','D','o','t','t','e','d',0, +2,'T','e','r','m',0,'T','e','r','m','i','n','a','l','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'U','I','d','e','o',0,'U','n','i','f','i','e','d','_','I','d','e','o','g','r','a','p','h',0, +2,'U','p','p','e','r',0,'U','p','p','e','r','c','a','s','e',0, +3,'W','S','p','a','c','e',0,'W','h','i','t','e','_','S','p','a','c','e',0,'s','p','a','c','e',0, +2,'X','I','D','C',0,'X','I','D','_','C','o','n','t','i','n','u','e',0, +2,'X','I','D','S',0,'X','I','D','_','S','t','a','r','t',0, +2,'S','e','n','s','i','t','i','v','e',0,'C','a','s','e','_','S','e','n','s','i','t','i','v','e',0, +2,'S','T','e','r','m',0,'S','e','n','t','e','n','c','e','_','T','e','r','m','i','n','a','l',0, +2,'V','S',0,'V','a','r','i','a','t','i','o','n','_','S','e','l','e','c','t','o','r',0, +2,'n','f','d','i','n','e','r','t',0,'N','F','D','_','I','n','e','r','t',0, +2,'n','f','k','d','i','n','e','r','t',0,'N','F','K','D','_','I','n','e','r','t',0, +2,'n','f','c','i','n','e','r','t',0,'N','F','C','_','I','n','e','r','t',0, +2,'n','f','k','c','i','n','e','r','t',0,'N','F','K','C','_','I','n','e','r','t',0, +2,'s','e','g','s','t','a','r','t',0,'S','e','g','m','e','n','t','_','S','t','a','r','t','e','r',0, +2,'P','a','t','_','S','y','n',0,'P','a','t','t','e','r','n','_','S','y','n','t','a','x',0, +2,'P','a','t','_','W','S',0,'P','a','t','t','e','r','n','_','W','h','i','t','e','_','S','p','a','c','e',0, +2,0,'a','l','n','u','m',0,2,0,'b','l','a','n','k',0, +2,0,'g','r','a','p','h',0,2,0,'p','r','i','n','t',0, +2,0,'x','d','i','g','i','t',0,2,'C','a','s','e','d',0,'C','a','s','e','d',0, +2,'C','I',0,'C','a','s','e','_','I','g','n','o','r','a','b','l','e',0, +2,'C','W','L',0,'C','h','a','n','g','e','s','_','W','h','e','n','_','L','o','w','e','r','c','a','s','e','d',0, +2,'C','W','U',0,'C','h','a','n','g','e','s','_','W','h','e','n','_','U','p','p','e','r','c','a','s','e','d',0, +2,'C','W','T',0,'C','h','a','n','g','e','s','_','W','h','e','n','_','T','i','t','l','e','c','a','s','e','d',0, +2,'C','W','C','F',0,'C','h','a','n','g','e','s','_','W','h','e','n','_','C','a','s','e','f','o','l','d','e','d',0, +2,'C','W','C','M',0,'C','h','a','n','g','e','s','_','W','h','e','n','_','C','a','s','e','m','a','p','p','e','d',0, +2,'C','W','K','C','F',0,'C','h','a','n','g','e','s','_','W','h','e','n','_','N','F','K','C','_','C','a','s','e','f','o','l', +'d','e','d',0,2,'E','m','o','j','i',0,'E','m','o','j','i',0, +2,'E','P','r','e','s',0,'E','m','o','j','i','_','P','r','e','s','e','n','t','a','t','i','o','n',0, +2,'E','M','o','d',0,'E','m','o','j','i','_','M','o','d','i','f','i','e','r',0, +2,'E','B','a','s','e',0,'E','m','o','j','i','_','M','o','d','i','f','i','e','r','_','B','a','s','e',0, +2,'E','C','o','m','p',0,'E','m','o','j','i','_','C','o','m','p','o','n','e','n','t',0, +2,'R','I',0,'R','e','g','i','o','n','a','l','_','I','n','d','i','c','a','t','o','r',0, +2,'P','C','M',0,'P','r','e','p','e','n','d','e','d','_','C','o','n','c','a','t','e','n','a','t','i','o','n','_','M','a','r', +'k',0,2,'E','x','t','P','i','c','t',0,'E','x','t','e','n','d','e','d','_','P','i','c','t','o','g','r','a','p','h','i','c', +0,2,'b','c',0,'B','i','d','i','_','C','l','a','s','s',0, +2,'L',0,'L','e','f','t','_','T','o','_','R','i','g','h','t',0, +2,'R',0,'R','i','g','h','t','_','T','o','_','L','e','f','t',0, +2,'E','N',0,'E','u','r','o','p','e','a','n','_','N','u','m','b','e','r',0, +2,'E','S',0,'E','u','r','o','p','e','a','n','_','S','e','p','a','r','a','t','o','r',0, +2,'E','T',0,'E','u','r','o','p','e','a','n','_','T','e','r','m','i','n','a','t','o','r',0, +2,'A','N',0,'A','r','a','b','i','c','_','N','u','m','b','e','r',0, +2,'C','S',0,'C','o','m','m','o','n','_','S','e','p','a','r','a','t','o','r',0, +2,'B',0,'P','a','r','a','g','r','a','p','h','_','S','e','p','a','r','a','t','o','r',0, +2,'S',0,'S','e','g','m','e','n','t','_','S','e','p','a','r','a','t','o','r',0, +2,'W','S',0,'W','h','i','t','e','_','S','p','a','c','e',0, +2,'O','N',0,'O','t','h','e','r','_','N','e','u','t','r','a','l',0, +2,'L','R','E',0,'L','e','f','t','_','T','o','_','R','i','g','h','t','_','E','m','b','e','d','d','i','n','g',0, +2,'L','R','O',0,'L','e','f','t','_','T','o','_','R','i','g','h','t','_','O','v','e','r','r','i','d','e',0, +2,'A','L',0,'A','r','a','b','i','c','_','L','e','t','t','e','r',0, +2,'R','L','E',0,'R','i','g','h','t','_','T','o','_','L','e','f','t','_','E','m','b','e','d','d','i','n','g',0, +2,'R','L','O',0,'R','i','g','h','t','_','T','o','_','L','e','f','t','_','O','v','e','r','r','i','d','e',0, +2,'P','D','F',0,'P','o','p','_','D','i','r','e','c','t','i','o','n','a','l','_','F','o','r','m','a','t',0, +2,'N','S','M',0,'N','o','n','s','p','a','c','i','n','g','_','M','a','r','k',0, +2,'B','N',0,'B','o','u','n','d','a','r','y','_','N','e','u','t','r','a','l',0, +2,'F','S','I',0,'F','i','r','s','t','_','S','t','r','o','n','g','_','I','s','o','l','a','t','e',0, +2,'L','R','I',0,'L','e','f','t','_','T','o','_','R','i','g','h','t','_','I','s','o','l','a','t','e',0, +2,'R','L','I',0,'R','i','g','h','t','_','T','o','_','L','e','f','t','_','I','s','o','l','a','t','e',0, +2,'P','D','I',0,'P','o','p','_','D','i','r','e','c','t','i','o','n','a','l','_','I','s','o','l','a','t','e',0, +2,'b','l','k',0,'B','l','o','c','k',0,2,'N','B',0,'N','o','_','B','l','o','c','k',0, +2,'A','S','C','I','I',0,'B','a','s','i','c','_','L','a','t','i','n',0, +3,'L','a','t','i','n','_','1','_','S','u','p',0,'L','a','t','i','n','_','1','_','S','u','p','p','l','e','m','e','n','t',0, +'L','a','t','i','n','_','1',0,2,'L','a','t','i','n','_','E','x','t','_','A',0,'L','a','t','i','n','_','E','x','t','e','n', +'d','e','d','_','A',0,2,'L','a','t','i','n','_','E','x','t','_','B',0,'L','a','t','i','n','_','E','x','t','e','n','d','e', +'d','_','B',0,2,'I','P','A','_','E','x','t',0,'I','P','A','_','E','x','t','e','n','s','i','o','n','s',0, +2,'M','o','d','i','f','i','e','r','_','L','e','t','t','e','r','s',0,'S','p','a','c','i','n','g','_','M','o','d','i','f','i', +'e','r','_','L','e','t','t','e','r','s',0,2,'D','i','a','c','r','i','t','i','c','a','l','s',0, +'C','o','m','b','i','n','i','n','g','_','D','i','a','c','r','i','t','i','c','a','l','_','M','a','r','k','s',0, +2,'G','r','e','e','k',0,'G','r','e','e','k','_','A','n','d','_','C','o','p','t','i','c',0, +2,'C','y','r','i','l','l','i','c',0,'C','y','r','i','l','l','i','c',0, +2,'A','r','m','e','n','i','a','n',0,'A','r','m','e','n','i','a','n',0, +2,'H','e','b','r','e','w',0,'H','e','b','r','e','w',0,2,'A','r','a','b','i','c',0,'A','r','a','b','i','c',0, +2,'S','y','r','i','a','c',0,'S','y','r','i','a','c',0,2,'T','h','a','a','n','a',0,'T','h','a','a','n','a',0, +2,'D','e','v','a','n','a','g','a','r','i',0,'D','e','v','a','n','a','g','a','r','i',0, +2,'B','e','n','g','a','l','i',0,'B','e','n','g','a','l','i',0, +2,'G','u','r','m','u','k','h','i',0,'G','u','r','m','u','k','h','i',0, +2,'G','u','j','a','r','a','t','i',0,'G','u','j','a','r','a','t','i',0, +2,'O','r','i','y','a',0,'O','r','i','y','a',0,2,'T','a','m','i','l',0,'T','a','m','i','l',0, +2,'T','e','l','u','g','u',0,'T','e','l','u','g','u',0,2,'K','a','n','n','a','d','a',0, +'K','a','n','n','a','d','a',0,2,'M','a','l','a','y','a','l','a','m',0,'M','a','l','a','y','a','l','a','m',0, +2,'S','i','n','h','a','l','a',0,'S','i','n','h','a','l','a',0, +2,'T','h','a','i',0,'T','h','a','i',0,2,'L','a','o',0,'L','a','o',0, +2,'T','i','b','e','t','a','n',0,'T','i','b','e','t','a','n',0, +2,'M','y','a','n','m','a','r',0,'M','y','a','n','m','a','r',0, +2,'G','e','o','r','g','i','a','n',0,'G','e','o','r','g','i','a','n',0, +2,'J','a','m','o',0,'H','a','n','g','u','l','_','J','a','m','o',0, +2,'E','t','h','i','o','p','i','c',0,'E','t','h','i','o','p','i','c',0, +2,'C','h','e','r','o','k','e','e',0,'C','h','e','r','o','k','e','e',0, +3,'U','C','A','S',0,'U','n','i','f','i','e','d','_','C','a','n','a','d','i','a','n','_','A','b','o','r','i','g','i','n','a', +'l','_','S','y','l','l','a','b','i','c','s',0,'C','a','n','a','d','i','a','n','_','S','y','l','l','a','b','i','c','s',0, +2,'O','g','h','a','m',0,'O','g','h','a','m',0,2,'R','u','n','i','c',0,'R','u','n','i','c',0, +2,'K','h','m','e','r',0,'K','h','m','e','r',0,2,'M','o','n','g','o','l','i','a','n',0, +'M','o','n','g','o','l','i','a','n',0,2,'L','a','t','i','n','_','E','x','t','_','A','d','d','i','t','i','o','n','a','l',0, +'L','a','t','i','n','_','E','x','t','e','n','d','e','d','_','A','d','d','i','t','i','o','n','a','l',0, +2,'G','r','e','e','k','_','E','x','t',0,'G','r','e','e','k','_','E','x','t','e','n','d','e','d',0, +2,'P','u','n','c','t','u','a','t','i','o','n',0,'G','e','n','e','r','a','l','_','P','u','n','c','t','u','a','t','i','o','n', +0,2,'S','u','p','e','r','_','A','n','d','_','S','u','b',0,'S','u','p','e','r','s','c','r','i','p','t','s','_','A','n','d', +'_','S','u','b','s','c','r','i','p','t','s',0,2,'C','u','r','r','e','n','c','y','_','S','y','m','b','o','l','s',0, +'C','u','r','r','e','n','c','y','_','S','y','m','b','o','l','s',0, +3,'D','i','a','c','r','i','t','i','c','a','l','s','_','F','o','r','_','S','y','m','b','o','l','s',0, +'C','o','m','b','i','n','i','n','g','_','D','i','a','c','r','i','t','i','c','a','l','_','M','a','r','k','s','_','F','o','r','_', +'S','y','m','b','o','l','s',0,'C','o','m','b','i','n','i','n','g','_','M','a','r','k','s','_','F','o','r','_','S','y','m','b', +'o','l','s',0,2,'L','e','t','t','e','r','l','i','k','e','_','S','y','m','b','o','l','s',0, +'L','e','t','t','e','r','l','i','k','e','_','S','y','m','b','o','l','s',0, +2,'N','u','m','b','e','r','_','F','o','r','m','s',0,'N','u','m','b','e','r','_','F','o','r','m','s',0, +2,'A','r','r','o','w','s',0,'A','r','r','o','w','s',0,2,'M','a','t','h','_','O','p','e','r','a','t','o','r','s',0, +'M','a','t','h','e','m','a','t','i','c','a','l','_','O','p','e','r','a','t','o','r','s',0, +2,'M','i','s','c','_','T','e','c','h','n','i','c','a','l',0,'M','i','s','c','e','l','l','a','n','e','o','u','s','_','T','e', +'c','h','n','i','c','a','l',0,2,'C','o','n','t','r','o','l','_','P','i','c','t','u','r','e','s',0, +'C','o','n','t','r','o','l','_','P','i','c','t','u','r','e','s',0, +2,'O','C','R',0,'O','p','t','i','c','a','l','_','C','h','a','r','a','c','t','e','r','_','R','e','c','o','g','n','i','t','i', +'o','n',0,2,'E','n','c','l','o','s','e','d','_','A','l','p','h','a','n','u','m',0,'E','n','c','l','o','s','e','d','_','A', +'l','p','h','a','n','u','m','e','r','i','c','s',0,2,'B','o','x','_','D','r','a','w','i','n','g',0, +'B','o','x','_','D','r','a','w','i','n','g',0,2,'B','l','o','c','k','_','E','l','e','m','e','n','t','s',0, +'B','l','o','c','k','_','E','l','e','m','e','n','t','s',0,2,'G','e','o','m','e','t','r','i','c','_','S','h','a','p','e','s', +0,'G','e','o','m','e','t','r','i','c','_','S','h','a','p','e','s',0, +2,'M','i','s','c','_','S','y','m','b','o','l','s',0,'M','i','s','c','e','l','l','a','n','e','o','u','s','_','S','y','m','b', +'o','l','s',0,2,'D','i','n','g','b','a','t','s',0,'D','i','n','g','b','a','t','s',0, +2,'B','r','a','i','l','l','e',0,'B','r','a','i','l','l','e','_','P','a','t','t','e','r','n','s',0, +2,'C','J','K','_','R','a','d','i','c','a','l','s','_','S','u','p',0,'C','J','K','_','R','a','d','i','c','a','l','s','_','S', +'u','p','p','l','e','m','e','n','t',0,2,'K','a','n','g','x','i',0,'K','a','n','g','x','i','_','R','a','d','i','c','a','l', +'s',0,2,'I','D','C',0,'I','d','e','o','g','r','a','p','h','i','c','_','D','e','s','c','r','i','p','t','i','o','n','_','C', +'h','a','r','a','c','t','e','r','s',0,2,'C','J','K','_','S','y','m','b','o','l','s',0,'C','J','K','_','S','y','m','b','o', +'l','s','_','A','n','d','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'H','i','r','a','g','a','n','a',0,'H','i','r','a','g','a','n','a',0, +2,'K','a','t','a','k','a','n','a',0,'K','a','t','a','k','a','n','a',0, +2,'B','o','p','o','m','o','f','o',0,'B','o','p','o','m','o','f','o',0, +2,'C','o','m','p','a','t','_','J','a','m','o',0,'H','a','n','g','u','l','_','C','o','m','p','a','t','i','b','i','l','i','t', +'y','_','J','a','m','o',0,2,'K','a','n','b','u','n',0,'K','a','n','b','u','n',0, +2,'B','o','p','o','m','o','f','o','_','E','x','t',0,'B','o','p','o','m','o','f','o','_','E','x','t','e','n','d','e','d',0, +2,'E','n','c','l','o','s','e','d','_','C','J','K',0,'E','n','c','l','o','s','e','d','_','C','J','K','_','L','e','t','t','e', +'r','s','_','A','n','d','_','M','o','n','t','h','s',0,2,'C','J','K','_','C','o','m','p','a','t',0, +'C','J','K','_','C','o','m','p','a','t','i','b','i','l','i','t','y',0, +2,'C','J','K','_','E','x','t','_','A',0,'C','J','K','_','U','n','i','f','i','e','d','_','I','d','e','o','g','r','a','p','h', +'s','_','E','x','t','e','n','s','i','o','n','_','A',0,2,'C','J','K',0,'C','J','K','_','U','n','i','f','i','e','d','_','I', +'d','e','o','g','r','a','p','h','s',0,2,'Y','i','_','S','y','l','l','a','b','l','e','s',0, +'Y','i','_','S','y','l','l','a','b','l','e','s',0,2,'Y','i','_','R','a','d','i','c','a','l','s',0, +'Y','i','_','R','a','d','i','c','a','l','s',0,2,'H','a','n','g','u','l',0,'H','a','n','g','u','l','_','S','y','l','l','a', +'b','l','e','s',0,2,'H','i','g','h','_','S','u','r','r','o','g','a','t','e','s',0,'H','i','g','h','_','S','u','r','r','o', +'g','a','t','e','s',0,2,'H','i','g','h','_','P','U','_','S','u','r','r','o','g','a','t','e','s',0, +'H','i','g','h','_','P','r','i','v','a','t','e','_','U','s','e','_','S','u','r','r','o','g','a','t','e','s',0, +2,'L','o','w','_','S','u','r','r','o','g','a','t','e','s',0,'L','o','w','_','S','u','r','r','o','g','a','t','e','s',0, +3,'P','U','A',0,'P','r','i','v','a','t','e','_','U','s','e','_','A','r','e','a',0,'P','r','i','v','a','t','e','_','U','s', +'e',0,2,'C','J','K','_','C','o','m','p','a','t','_','I','d','e','o','g','r','a','p','h','s',0, +'C','J','K','_','C','o','m','p','a','t','i','b','i','l','i','t','y','_','I','d','e','o','g','r','a','p','h','s',0, +2,'A','l','p','h','a','b','e','t','i','c','_','P','F',0,'A','l','p','h','a','b','e','t','i','c','_','P','r','e','s','e','n', +'t','a','t','i','o','n','_','F','o','r','m','s',0,3,'A','r','a','b','i','c','_','P','F','_','A',0, +'A','r','a','b','i','c','_','P','r','e','s','e','n','t','a','t','i','o','n','_','F','o','r','m','s','_','A',0, +'A','r','a','b','i','c','_','P','r','e','s','e','n','t','a','t','i','o','n','_','F','o','r','m','s','-','A',0, +2,'H','a','l','f','_','M','a','r','k','s',0,'C','o','m','b','i','n','i','n','g','_','H','a','l','f','_','M','a','r','k','s', +0,2,'C','J','K','_','C','o','m','p','a','t','_','F','o','r','m','s',0,'C','J','K','_','C','o','m','p','a','t','i','b','i', +'l','i','t','y','_','F','o','r','m','s',0,2,'S','m','a','l','l','_','F','o','r','m','s',0, +'S','m','a','l','l','_','F','o','r','m','_','V','a','r','i','a','n','t','s',0, +2,'A','r','a','b','i','c','_','P','F','_','B',0,'A','r','a','b','i','c','_','P','r','e','s','e','n','t','a','t','i','o','n', +'_','F','o','r','m','s','_','B',0,2,'S','p','e','c','i','a','l','s',0,'S','p','e','c','i','a','l','s',0, +2,'H','a','l','f','_','A','n','d','_','F','u','l','l','_','F','o','r','m','s',0,'H','a','l','f','w','i','d','t','h','_','A', +'n','d','_','F','u','l','l','w','i','d','t','h','_','F','o','r','m','s',0, +2,'O','l','d','_','I','t','a','l','i','c',0,'O','l','d','_','I','t','a','l','i','c',0, +2,'G','o','t','h','i','c',0,'G','o','t','h','i','c',0,2,'D','e','s','e','r','e','t',0, +'D','e','s','e','r','e','t',0,2,'B','y','z','a','n','t','i','n','e','_','M','u','s','i','c',0, +'B','y','z','a','n','t','i','n','e','_','M','u','s','i','c','a','l','_','S','y','m','b','o','l','s',0, +2,'M','u','s','i','c',0,'M','u','s','i','c','a','l','_','S','y','m','b','o','l','s',0, +2,'M','a','t','h','_','A','l','p','h','a','n','u','m',0,'M','a','t','h','e','m','a','t','i','c','a','l','_','A','l','p','h', +'a','n','u','m','e','r','i','c','_','S','y','m','b','o','l','s',0, +2,'C','J','K','_','E','x','t','_','B',0,'C','J','K','_','U','n','i','f','i','e','d','_','I','d','e','o','g','r','a','p','h', +'s','_','E','x','t','e','n','s','i','o','n','_','B',0,2,'C','J','K','_','C','o','m','p','a','t','_','I','d','e','o','g','r', +'a','p','h','s','_','S','u','p',0,'C','J','K','_','C','o','m','p','a','t','i','b','i','l','i','t','y','_','I','d','e','o','g', +'r','a','p','h','s','_','S','u','p','p','l','e','m','e','n','t',0, +2,'T','a','g','s',0,'T','a','g','s',0,3,'C','y','r','i','l','l','i','c','_','S','u','p',0, +'C','y','r','i','l','l','i','c','_','S','u','p','p','l','e','m','e','n','t',0,'C','y','r','i','l','l','i','c','_','S','u','p', +'p','l','e','m','e','n','t','a','r','y',0,2,'T','a','g','a','l','o','g',0,'T','a','g','a','l','o','g',0, +2,'H','a','n','u','n','o','o',0,'H','a','n','u','n','o','o',0, +2,'B','u','h','i','d',0,'B','u','h','i','d',0,2,'T','a','g','b','a','n','w','a',0,'T','a','g','b','a','n','w','a',0, +2,'M','i','s','c','_','M','a','t','h','_','S','y','m','b','o','l','s','_','A',0,'M','i','s','c','e','l','l','a','n','e','o', +'u','s','_','M','a','t','h','e','m','a','t','i','c','a','l','_','S','y','m','b','o','l','s','_','A',0, +2,'S','u','p','_','A','r','r','o','w','s','_','A',0,'S','u','p','p','l','e','m','e','n','t','a','l','_','A','r','r','o','w', +'s','_','A',0,2,'S','u','p','_','A','r','r','o','w','s','_','B',0,'S','u','p','p','l','e','m','e','n','t','a','l','_','A', +'r','r','o','w','s','_','B',0,2,'M','i','s','c','_','M','a','t','h','_','S','y','m','b','o','l','s','_','B',0, +'M','i','s','c','e','l','l','a','n','e','o','u','s','_','M','a','t','h','e','m','a','t','i','c','a','l','_','S','y','m','b','o', +'l','s','_','B',0,2,'S','u','p','_','M','a','t','h','_','O','p','e','r','a','t','o','r','s',0, +'S','u','p','p','l','e','m','e','n','t','a','l','_','M','a','t','h','e','m','a','t','i','c','a','l','_','O','p','e','r','a','t', +'o','r','s',0,2,'K','a','t','a','k','a','n','a','_','E','x','t',0,'K','a','t','a','k','a','n','a','_','P','h','o','n','e', +'t','i','c','_','E','x','t','e','n','s','i','o','n','s',0,2,'V','S',0,'V','a','r','i','a','t','i','o','n','_','S','e','l', +'e','c','t','o','r','s',0,2,'S','u','p','_','P','U','A','_','A',0,'S','u','p','p','l','e','m','e','n','t','a','r','y','_', +'P','r','i','v','a','t','e','_','U','s','e','_','A','r','e','a','_','A',0, +2,'S','u','p','_','P','U','A','_','B',0,'S','u','p','p','l','e','m','e','n','t','a','r','y','_','P','r','i','v','a','t','e', +'_','U','s','e','_','A','r','e','a','_','B',0,2,'L','i','m','b','u',0,'L','i','m','b','u',0, +2,'T','a','i','_','L','e',0,'T','a','i','_','L','e',0,2,'K','h','m','e','r','_','S','y','m','b','o','l','s',0, +'K','h','m','e','r','_','S','y','m','b','o','l','s',0,2,'P','h','o','n','e','t','i','c','_','E','x','t',0, +'P','h','o','n','e','t','i','c','_','E','x','t','e','n','s','i','o','n','s',0, +2,'M','i','s','c','_','A','r','r','o','w','s',0,'M','i','s','c','e','l','l','a','n','e','o','u','s','_','S','y','m','b','o', +'l','s','_','A','n','d','_','A','r','r','o','w','s',0,2,'Y','i','j','i','n','g',0,'Y','i','j','i','n','g','_','H','e','x', +'a','g','r','a','m','_','S','y','m','b','o','l','s',0,2,'L','i','n','e','a','r','_','B','_','S','y','l','l','a','b','a','r', +'y',0,'L','i','n','e','a','r','_','B','_','S','y','l','l','a','b','a','r','y',0, +2,'L','i','n','e','a','r','_','B','_','I','d','e','o','g','r','a','m','s',0,'L','i','n','e','a','r','_','B','_','I','d','e', +'o','g','r','a','m','s',0,2,'A','e','g','e','a','n','_','N','u','m','b','e','r','s',0,'A','e','g','e','a','n','_','N','u', +'m','b','e','r','s',0,2,'U','g','a','r','i','t','i','c',0,'U','g','a','r','i','t','i','c',0, +2,'S','h','a','v','i','a','n',0,'S','h','a','v','i','a','n',0, +2,'O','s','m','a','n','y','a',0,'O','s','m','a','n','y','a',0, +2,'C','y','p','r','i','o','t','_','S','y','l','l','a','b','a','r','y',0,'C','y','p','r','i','o','t','_','S','y','l','l','a', +'b','a','r','y',0,2,'T','a','i','_','X','u','a','n','_','J','i','n','g',0,'T','a','i','_','X','u','a','n','_','J','i','n', +'g','_','S','y','m','b','o','l','s',0,2,'V','S','_','S','u','p',0,'V','a','r','i','a','t','i','o','n','_','S','e','l','e', +'c','t','o','r','s','_','S','u','p','p','l','e','m','e','n','t',0, +2,'A','n','c','i','e','n','t','_','G','r','e','e','k','_','M','u','s','i','c',0,'A','n','c','i','e','n','t','_','G','r','e', +'e','k','_','M','u','s','i','c','a','l','_','N','o','t','a','t','i','o','n',0, +2,'A','n','c','i','e','n','t','_','G','r','e','e','k','_','N','u','m','b','e','r','s',0,'A','n','c','i','e','n','t','_','G', +'r','e','e','k','_','N','u','m','b','e','r','s',0,2,'A','r','a','b','i','c','_','S','u','p',0, +'A','r','a','b','i','c','_','S','u','p','p','l','e','m','e','n','t',0, +2,'B','u','g','i','n','e','s','e',0,'B','u','g','i','n','e','s','e',0, +2,'C','J','K','_','S','t','r','o','k','e','s',0,'C','J','K','_','S','t','r','o','k','e','s',0, +2,'D','i','a','c','r','i','t','i','c','a','l','s','_','S','u','p',0,'C','o','m','b','i','n','i','n','g','_','D','i','a','c', +'r','i','t','i','c','a','l','_','M','a','r','k','s','_','S','u','p','p','l','e','m','e','n','t',0, +2,'C','o','p','t','i','c',0,'C','o','p','t','i','c',0,2,'E','t','h','i','o','p','i','c','_','E','x','t',0, +'E','t','h','i','o','p','i','c','_','E','x','t','e','n','d','e','d',0, +2,'E','t','h','i','o','p','i','c','_','S','u','p',0,'E','t','h','i','o','p','i','c','_','S','u','p','p','l','e','m','e','n', +'t',0,2,'G','e','o','r','g','i','a','n','_','S','u','p',0,'G','e','o','r','g','i','a','n','_','S','u','p','p','l','e','m', +'e','n','t',0,2,'G','l','a','g','o','l','i','t','i','c',0,'G','l','a','g','o','l','i','t','i','c',0, +2,'K','h','a','r','o','s','h','t','h','i',0,'K','h','a','r','o','s','h','t','h','i',0, +2,'M','o','d','i','f','i','e','r','_','T','o','n','e','_','L','e','t','t','e','r','s',0,'M','o','d','i','f','i','e','r','_', +'T','o','n','e','_','L','e','t','t','e','r','s',0,2,'N','e','w','_','T','a','i','_','L','u','e',0, +'N','e','w','_','T','a','i','_','L','u','e',0,2,'O','l','d','_','P','e','r','s','i','a','n',0, +'O','l','d','_','P','e','r','s','i','a','n',0,2,'P','h','o','n','e','t','i','c','_','E','x','t','_','S','u','p',0, +'P','h','o','n','e','t','i','c','_','E','x','t','e','n','s','i','o','n','s','_','S','u','p','p','l','e','m','e','n','t',0, +2,'S','u','p','_','P','u','n','c','t','u','a','t','i','o','n',0,'S','u','p','p','l','e','m','e','n','t','a','l','_','P','u', +'n','c','t','u','a','t','i','o','n',0,2,'S','y','l','o','t','i','_','N','a','g','r','i',0, +'S','y','l','o','t','i','_','N','a','g','r','i',0,2,'T','i','f','i','n','a','g','h',0,'T','i','f','i','n','a','g','h',0, +2,'V','e','r','t','i','c','a','l','_','F','o','r','m','s',0,'V','e','r','t','i','c','a','l','_','F','o','r','m','s',0, +2,'N','K','o',0,'N','K','o',0,2,'B','a','l','i','n','e','s','e',0,'B','a','l','i','n','e','s','e',0, +2,'L','a','t','i','n','_','E','x','t','_','C',0,'L','a','t','i','n','_','E','x','t','e','n','d','e','d','_','C',0, +2,'L','a','t','i','n','_','E','x','t','_','D',0,'L','a','t','i','n','_','E','x','t','e','n','d','e','d','_','D',0, +2,'P','h','a','g','s','_','P','a',0,'P','h','a','g','s','_','P','a',0, +2,'P','h','o','e','n','i','c','i','a','n',0,'P','h','o','e','n','i','c','i','a','n',0, +2,'C','u','n','e','i','f','o','r','m',0,'C','u','n','e','i','f','o','r','m',0, +2,'C','u','n','e','i','f','o','r','m','_','N','u','m','b','e','r','s',0,'C','u','n','e','i','f','o','r','m','_','N','u','m', +'b','e','r','s','_','A','n','d','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'C','o','u','n','t','i','n','g','_','R','o','d',0,'C','o','u','n','t','i','n','g','_','R','o','d','_','N','u','m','e','r', +'a','l','s',0,2,'S','u','n','d','a','n','e','s','e',0,'S','u','n','d','a','n','e','s','e',0, +2,'L','e','p','c','h','a',0,'L','e','p','c','h','a',0,2,'O','l','_','C','h','i','k','i',0, +'O','l','_','C','h','i','k','i',0,2,'C','y','r','i','l','l','i','c','_','E','x','t','_','A',0, +'C','y','r','i','l','l','i','c','_','E','x','t','e','n','d','e','d','_','A',0, +2,'V','a','i',0,'V','a','i',0,2,'C','y','r','i','l','l','i','c','_','E','x','t','_','B',0, +'C','y','r','i','l','l','i','c','_','E','x','t','e','n','d','e','d','_','B',0, +2,'S','a','u','r','a','s','h','t','r','a',0,'S','a','u','r','a','s','h','t','r','a',0, +2,'K','a','y','a','h','_','L','i',0,'K','a','y','a','h','_','L','i',0, +2,'R','e','j','a','n','g',0,'R','e','j','a','n','g',0,2,'C','h','a','m',0,'C','h','a','m',0, +2,'A','n','c','i','e','n','t','_','S','y','m','b','o','l','s',0,'A','n','c','i','e','n','t','_','S','y','m','b','o','l','s', +0,2,'P','h','a','i','s','t','o','s',0,'P','h','a','i','s','t','o','s','_','D','i','s','c',0, +2,'L','y','c','i','a','n',0,'L','y','c','i','a','n',0,2,'C','a','r','i','a','n',0,'C','a','r','i','a','n',0, +2,'L','y','d','i','a','n',0,'L','y','d','i','a','n',0,2,'M','a','h','j','o','n','g',0, +'M','a','h','j','o','n','g','_','T','i','l','e','s',0,2,'D','o','m','i','n','o',0,'D','o','m','i','n','o','_','T','i','l', +'e','s',0,2,'S','a','m','a','r','i','t','a','n',0,'S','a','m','a','r','i','t','a','n',0, +2,'U','C','A','S','_','E','x','t',0,'U','n','i','f','i','e','d','_','C','a','n','a','d','i','a','n','_','A','b','o','r','i', +'g','i','n','a','l','_','S','y','l','l','a','b','i','c','s','_','E','x','t','e','n','d','e','d',0, +2,'T','a','i','_','T','h','a','m',0,'T','a','i','_','T','h','a','m',0, +2,'V','e','d','i','c','_','E','x','t',0,'V','e','d','i','c','_','E','x','t','e','n','s','i','o','n','s',0, +2,'L','i','s','u',0,'L','i','s','u',0,2,'B','a','m','u','m',0,'B','a','m','u','m',0, +2,'I','n','d','i','c','_','N','u','m','b','e','r','_','F','o','r','m','s',0,'C','o','m','m','o','n','_','I','n','d','i','c', +'_','N','u','m','b','e','r','_','F','o','r','m','s',0,2,'D','e','v','a','n','a','g','a','r','i','_','E','x','t',0, +'D','e','v','a','n','a','g','a','r','i','_','E','x','t','e','n','d','e','d',0, +2,'J','a','m','o','_','E','x','t','_','A',0,'H','a','n','g','u','l','_','J','a','m','o','_','E','x','t','e','n','d','e','d', +'_','A',0,2,'J','a','v','a','n','e','s','e',0,'J','a','v','a','n','e','s','e',0, +2,'M','y','a','n','m','a','r','_','E','x','t','_','A',0,'M','y','a','n','m','a','r','_','E','x','t','e','n','d','e','d','_', +'A',0,2,'T','a','i','_','V','i','e','t',0,'T','a','i','_','V','i','e','t',0, +2,'M','e','e','t','e','i','_','M','a','y','e','k',0,'M','e','e','t','e','i','_','M','a','y','e','k',0, +2,'J','a','m','o','_','E','x','t','_','B',0,'H','a','n','g','u','l','_','J','a','m','o','_','E','x','t','e','n','d','e','d', +'_','B',0,2,'I','m','p','e','r','i','a','l','_','A','r','a','m','a','i','c',0,'I','m','p','e','r','i','a','l','_','A','r', +'a','m','a','i','c',0,2,'O','l','d','_','S','o','u','t','h','_','A','r','a','b','i','a','n',0, +'O','l','d','_','S','o','u','t','h','_','A','r','a','b','i','a','n',0, +2,'A','v','e','s','t','a','n',0,'A','v','e','s','t','a','n',0, +2,'I','n','s','c','r','i','p','t','i','o','n','a','l','_','P','a','r','t','h','i','a','n',0, +'I','n','s','c','r','i','p','t','i','o','n','a','l','_','P','a','r','t','h','i','a','n',0, +2,'I','n','s','c','r','i','p','t','i','o','n','a','l','_','P','a','h','l','a','v','i',0,'I','n','s','c','r','i','p','t','i', +'o','n','a','l','_','P','a','h','l','a','v','i',0,2,'O','l','d','_','T','u','r','k','i','c',0, +'O','l','d','_','T','u','r','k','i','c',0,2,'R','u','m','i',0,'R','u','m','i','_','N','u','m','e','r','a','l','_','S','y', +'m','b','o','l','s',0,2,'K','a','i','t','h','i',0,'K','a','i','t','h','i',0, +2,'E','g','y','p','t','i','a','n','_','H','i','e','r','o','g','l','y','p','h','s',0,'E','g','y','p','t','i','a','n','_','H', +'i','e','r','o','g','l','y','p','h','s',0,2,'E','n','c','l','o','s','e','d','_','A','l','p','h','a','n','u','m','_','S','u', +'p',0,'E','n','c','l','o','s','e','d','_','A','l','p','h','a','n','u','m','e','r','i','c','_','S','u','p','p','l','e','m','e', +'n','t',0,2,'E','n','c','l','o','s','e','d','_','I','d','e','o','g','r','a','p','h','i','c','_','S','u','p',0, +'E','n','c','l','o','s','e','d','_','I','d','e','o','g','r','a','p','h','i','c','_','S','u','p','p','l','e','m','e','n','t',0, +2,'C','J','K','_','E','x','t','_','C',0,'C','J','K','_','U','n','i','f','i','e','d','_','I','d','e','o','g','r','a','p','h', +'s','_','E','x','t','e','n','s','i','o','n','_','C',0,2,'M','a','n','d','a','i','c',0,'M','a','n','d','a','i','c',0, +2,'B','a','t','a','k',0,'B','a','t','a','k',0,2,'E','t','h','i','o','p','i','c','_','E','x','t','_','A',0, +'E','t','h','i','o','p','i','c','_','E','x','t','e','n','d','e','d','_','A',0, +2,'B','r','a','h','m','i',0,'B','r','a','h','m','i',0,2,'B','a','m','u','m','_','S','u','p',0, +'B','a','m','u','m','_','S','u','p','p','l','e','m','e','n','t',0, +2,'K','a','n','a','_','S','u','p',0,'K','a','n','a','_','S','u','p','p','l','e','m','e','n','t',0, +2,'P','l','a','y','i','n','g','_','C','a','r','d','s',0,'P','l','a','y','i','n','g','_','C','a','r','d','s',0, +2,'M','i','s','c','_','P','i','c','t','o','g','r','a','p','h','s',0,'M','i','s','c','e','l','l','a','n','e','o','u','s','_', +'S','y','m','b','o','l','s','_','A','n','d','_','P','i','c','t','o','g','r','a','p','h','s',0, +2,'E','m','o','t','i','c','o','n','s',0,'E','m','o','t','i','c','o','n','s',0, +2,'T','r','a','n','s','p','o','r','t','_','A','n','d','_','M','a','p',0,'T','r','a','n','s','p','o','r','t','_','A','n','d', +'_','M','a','p','_','S','y','m','b','o','l','s',0,2,'A','l','c','h','e','m','i','c','a','l',0, +'A','l','c','h','e','m','i','c','a','l','_','S','y','m','b','o','l','s',0, +2,'C','J','K','_','E','x','t','_','D',0,'C','J','K','_','U','n','i','f','i','e','d','_','I','d','e','o','g','r','a','p','h', +'s','_','E','x','t','e','n','s','i','o','n','_','D',0,2,'A','r','a','b','i','c','_','E','x','t','_','A',0, +'A','r','a','b','i','c','_','E','x','t','e','n','d','e','d','_','A',0, +2,'A','r','a','b','i','c','_','M','a','t','h',0,'A','r','a','b','i','c','_','M','a','t','h','e','m','a','t','i','c','a','l', +'_','A','l','p','h','a','b','e','t','i','c','_','S','y','m','b','o','l','s',0, +2,'C','h','a','k','m','a',0,'C','h','a','k','m','a',0,2,'M','e','e','t','e','i','_','M','a','y','e','k','_','E','x','t', +0,'M','e','e','t','e','i','_','M','a','y','e','k','_','E','x','t','e','n','s','i','o','n','s',0, +2,'M','e','r','o','i','t','i','c','_','C','u','r','s','i','v','e',0,'M','e','r','o','i','t','i','c','_','C','u','r','s','i', +'v','e',0,2,'M','e','r','o','i','t','i','c','_','H','i','e','r','o','g','l','y','p','h','s',0, +'M','e','r','o','i','t','i','c','_','H','i','e','r','o','g','l','y','p','h','s',0, +2,'M','i','a','o',0,'M','i','a','o',0,2,'S','h','a','r','a','d','a',0,'S','h','a','r','a','d','a',0, +2,'S','o','r','a','_','S','o','m','p','e','n','g',0,'S','o','r','a','_','S','o','m','p','e','n','g',0, +2,'S','u','n','d','a','n','e','s','e','_','S','u','p',0,'S','u','n','d','a','n','e','s','e','_','S','u','p','p','l','e','m', +'e','n','t',0,2,'T','a','k','r','i',0,'T','a','k','r','i',0, +2,'B','a','s','s','a','_','V','a','h',0,'B','a','s','s','a','_','V','a','h',0, +2,'C','a','u','c','a','s','i','a','n','_','A','l','b','a','n','i','a','n',0,'C','a','u','c','a','s','i','a','n','_','A','l', +'b','a','n','i','a','n',0,2,'C','o','p','t','i','c','_','E','p','a','c','t','_','N','u','m','b','e','r','s',0, +'C','o','p','t','i','c','_','E','p','a','c','t','_','N','u','m','b','e','r','s',0, +2,'D','i','a','c','r','i','t','i','c','a','l','s','_','E','x','t',0,'C','o','m','b','i','n','i','n','g','_','D','i','a','c', +'r','i','t','i','c','a','l','_','M','a','r','k','s','_','E','x','t','e','n','d','e','d',0, +2,'D','u','p','l','o','y','a','n',0,'D','u','p','l','o','y','a','n',0, +2,'E','l','b','a','s','a','n',0,'E','l','b','a','s','a','n',0, +2,'G','e','o','m','e','t','r','i','c','_','S','h','a','p','e','s','_','E','x','t',0,'G','e','o','m','e','t','r','i','c','_', +'S','h','a','p','e','s','_','E','x','t','e','n','d','e','d',0, +2,'G','r','a','n','t','h','a',0,'G','r','a','n','t','h','a',0, +2,'K','h','o','j','k','i',0,'K','h','o','j','k','i',0,2,'K','h','u','d','a','w','a','d','i',0, +'K','h','u','d','a','w','a','d','i',0,2,'L','a','t','i','n','_','E','x','t','_','E',0,'L','a','t','i','n','_','E','x','t', +'e','n','d','e','d','_','E',0,2,'L','i','n','e','a','r','_','A',0,'L','i','n','e','a','r','_','A',0, +2,'M','a','h','a','j','a','n','i',0,'M','a','h','a','j','a','n','i',0, +2,'M','a','n','i','c','h','a','e','a','n',0,'M','a','n','i','c','h','a','e','a','n',0, +2,'M','e','n','d','e','_','K','i','k','a','k','u','i',0,'M','e','n','d','e','_','K','i','k','a','k','u','i',0, +2,'M','o','d','i',0,'M','o','d','i',0,2,'M','r','o',0,'M','r','o',0, +2,'M','y','a','n','m','a','r','_','E','x','t','_','B',0,'M','y','a','n','m','a','r','_','E','x','t','e','n','d','e','d','_', +'B',0,2,'N','a','b','a','t','a','e','a','n',0,'N','a','b','a','t','a','e','a','n',0, +2,'O','l','d','_','N','o','r','t','h','_','A','r','a','b','i','a','n',0,'O','l','d','_','N','o','r','t','h','_','A','r','a', +'b','i','a','n',0,2,'O','l','d','_','P','e','r','m','i','c',0,'O','l','d','_','P','e','r','m','i','c',0, +2,'O','r','n','a','m','e','n','t','a','l','_','D','i','n','g','b','a','t','s',0,'O','r','n','a','m','e','n','t','a','l','_', +'D','i','n','g','b','a','t','s',0,2,'P','a','h','a','w','h','_','H','m','o','n','g',0,'P','a','h','a','w','h','_','H','m', +'o','n','g',0,2,'P','a','l','m','y','r','e','n','e',0,'P','a','l','m','y','r','e','n','e',0, +2,'P','a','u','_','C','i','n','_','H','a','u',0,'P','a','u','_','C','i','n','_','H','a','u',0, +2,'P','s','a','l','t','e','r','_','P','a','h','l','a','v','i',0,'P','s','a','l','t','e','r','_','P','a','h','l','a','v','i', +0,2,'S','h','o','r','t','h','a','n','d','_','F','o','r','m','a','t','_','C','o','n','t','r','o','l','s',0, +'S','h','o','r','t','h','a','n','d','_','F','o','r','m','a','t','_','C','o','n','t','r','o','l','s',0, +2,'S','i','d','d','h','a','m',0,'S','i','d','d','h','a','m',0, +2,'S','i','n','h','a','l','a','_','A','r','c','h','a','i','c','_','N','u','m','b','e','r','s',0, +'S','i','n','h','a','l','a','_','A','r','c','h','a','i','c','_','N','u','m','b','e','r','s',0, +2,'S','u','p','_','A','r','r','o','w','s','_','C',0,'S','u','p','p','l','e','m','e','n','t','a','l','_','A','r','r','o','w', +'s','_','C',0,2,'T','i','r','h','u','t','a',0,'T','i','r','h','u','t','a',0, +2,'W','a','r','a','n','g','_','C','i','t','i',0,'W','a','r','a','n','g','_','C','i','t','i',0, +2,'A','h','o','m',0,'A','h','o','m',0,2,'A','n','a','t','o','l','i','a','n','_','H','i','e','r','o','g','l','y','p','h', +'s',0,'A','n','a','t','o','l','i','a','n','_','H','i','e','r','o','g','l','y','p','h','s',0, +2,'C','h','e','r','o','k','e','e','_','S','u','p',0,'C','h','e','r','o','k','e','e','_','S','u','p','p','l','e','m','e','n', +'t',0,2,'C','J','K','_','E','x','t','_','E',0,'C','J','K','_','U','n','i','f','i','e','d','_','I','d','e','o','g','r','a', +'p','h','s','_','E','x','t','e','n','s','i','o','n','_','E',0, +2,'E','a','r','l','y','_','D','y','n','a','s','t','i','c','_','C','u','n','e','i','f','o','r','m',0, +'E','a','r','l','y','_','D','y','n','a','s','t','i','c','_','C','u','n','e','i','f','o','r','m',0, +2,'H','a','t','r','a','n',0,'H','a','t','r','a','n',0,2,'M','u','l','t','a','n','i',0, +'M','u','l','t','a','n','i',0,2,'O','l','d','_','H','u','n','g','a','r','i','a','n',0,'O','l','d','_','H','u','n','g','a', +'r','i','a','n',0,2,'S','u','p','_','S','y','m','b','o','l','s','_','A','n','d','_','P','i','c','t','o','g','r','a','p','h', +'s',0,'S','u','p','p','l','e','m','e','n','t','a','l','_','S','y','m','b','o','l','s','_','A','n','d','_','P','i','c','t','o', +'g','r','a','p','h','s',0,2,'S','u','t','t','o','n','_','S','i','g','n','W','r','i','t','i','n','g',0, +'S','u','t','t','o','n','_','S','i','g','n','W','r','i','t','i','n','g',0, +2,'A','d','l','a','m',0,'A','d','l','a','m',0,2,'B','h','a','i','k','s','u','k','i',0, +'B','h','a','i','k','s','u','k','i',0,2,'C','y','r','i','l','l','i','c','_','E','x','t','_','C',0, +'C','y','r','i','l','l','i','c','_','E','x','t','e','n','d','e','d','_','C',0, +2,'G','l','a','g','o','l','i','t','i','c','_','S','u','p',0,'G','l','a','g','o','l','i','t','i','c','_','S','u','p','p','l', +'e','m','e','n','t',0,2,'I','d','e','o','g','r','a','p','h','i','c','_','S','y','m','b','o','l','s',0, +'I','d','e','o','g','r','a','p','h','i','c','_','S','y','m','b','o','l','s','_','A','n','d','_','P','u','n','c','t','u','a','t', +'i','o','n',0,2,'M','a','r','c','h','e','n',0,'M','a','r','c','h','e','n',0, +2,'M','o','n','g','o','l','i','a','n','_','S','u','p',0,'M','o','n','g','o','l','i','a','n','_','S','u','p','p','l','e','m', +'e','n','t',0,2,'N','e','w','a',0,'N','e','w','a',0,2,'O','s','a','g','e',0,'O','s','a','g','e',0, +2,'T','a','n','g','u','t',0,'T','a','n','g','u','t',0,2,'T','a','n','g','u','t','_','C','o','m','p','o','n','e','n','t', +'s',0,'T','a','n','g','u','t','_','C','o','m','p','o','n','e','n','t','s',0, +2,'C','J','K','_','E','x','t','_','F',0,'C','J','K','_','U','n','i','f','i','e','d','_','I','d','e','o','g','r','a','p','h', +'s','_','E','x','t','e','n','s','i','o','n','_','F',0,2,'K','a','n','a','_','E','x','t','_','A',0, +'K','a','n','a','_','E','x','t','e','n','d','e','d','_','A',0, +2,'M','a','s','a','r','a','m','_','G','o','n','d','i',0,'M','a','s','a','r','a','m','_','G','o','n','d','i',0, +2,'N','u','s','h','u',0,'N','u','s','h','u',0,2,'S','o','y','o','m','b','o',0,'S','o','y','o','m','b','o',0, +2,'S','y','r','i','a','c','_','S','u','p',0,'S','y','r','i','a','c','_','S','u','p','p','l','e','m','e','n','t',0, +2,'Z','a','n','a','b','a','z','a','r','_','S','q','u','a','r','e',0,'Z','a','n','a','b','a','z','a','r','_','S','q','u','a', +'r','e',0,2,'C','h','e','s','s','_','S','y','m','b','o','l','s',0,'C','h','e','s','s','_','S','y','m','b','o','l','s',0, +2,'D','o','g','r','a',0,'D','o','g','r','a',0,2,'G','e','o','r','g','i','a','n','_','E','x','t',0, +'G','e','o','r','g','i','a','n','_','E','x','t','e','n','d','e','d',0, +2,'G','u','n','j','a','l','a','_','G','o','n','d','i',0,'G','u','n','j','a','l','a','_','G','o','n','d','i',0, +2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a',0,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a', +0,2,'I','n','d','i','c','_','S','i','y','a','q','_','N','u','m','b','e','r','s',0,'I','n','d','i','c','_','S','i','y','a', +'q','_','N','u','m','b','e','r','s',0,2,'M','a','k','a','s','a','r',0,'M','a','k','a','s','a','r',0, +2,'M','a','y','a','n','_','N','u','m','e','r','a','l','s',0,'M','a','y','a','n','_','N','u','m','e','r','a','l','s',0, +2,'M','e','d','e','f','a','i','d','r','i','n',0,'M','e','d','e','f','a','i','d','r','i','n',0, +2,'O','l','d','_','S','o','g','d','i','a','n',0,'O','l','d','_','S','o','g','d','i','a','n',0, +2,'S','o','g','d','i','a','n',0,'S','o','g','d','i','a','n',0, +2,'E','g','y','p','t','i','a','n','_','H','i','e','r','o','g','l','y','p','h','_','F','o','r','m','a','t','_','C','o','n','t', +'r','o','l','s',0,'E','g','y','p','t','i','a','n','_','H','i','e','r','o','g','l','y','p','h','_','F','o','r','m','a','t','_', +'C','o','n','t','r','o','l','s',0,2,'E','l','y','m','a','i','c',0,'E','l','y','m','a','i','c',0, +2,'N','a','n','d','i','n','a','g','a','r','i',0,'N','a','n','d','i','n','a','g','a','r','i',0, +2,'N','y','i','a','k','e','n','g','_','P','u','a','c','h','u','e','_','H','m','o','n','g',0, +'N','y','i','a','k','e','n','g','_','P','u','a','c','h','u','e','_','H','m','o','n','g',0, +2,'O','t','t','o','m','a','n','_','S','i','y','a','q','_','N','u','m','b','e','r','s',0,'O','t','t','o','m','a','n','_','S', +'i','y','a','q','_','N','u','m','b','e','r','s',0,2,'S','m','a','l','l','_','K','a','n','a','_','E','x','t',0, +'S','m','a','l','l','_','K','a','n','a','_','E','x','t','e','n','s','i','o','n',0, +2,'S','y','m','b','o','l','s','_','A','n','d','_','P','i','c','t','o','g','r','a','p','h','s','_','E','x','t','_','A',0, +'S','y','m','b','o','l','s','_','A','n','d','_','P','i','c','t','o','g','r','a','p','h','s','_','E','x','t','e','n','d','e','d', +'_','A',0,2,'T','a','m','i','l','_','S','u','p',0,'T','a','m','i','l','_','S','u','p','p','l','e','m','e','n','t',0, +2,'W','a','n','c','h','o',0,'W','a','n','c','h','o',0,2,'C','h','o','r','a','s','m','i','a','n',0, +'C','h','o','r','a','s','m','i','a','n',0,2,'C','J','K','_','E','x','t','_','G',0,'C','J','K','_','U','n','i','f','i','e', +'d','_','I','d','e','o','g','r','a','p','h','s','_','E','x','t','e','n','s','i','o','n','_','G',0, +2,'D','i','v','e','s','_','A','k','u','r','u',0,'D','i','v','e','s','_','A','k','u','r','u',0, +2,'K','h','i','t','a','n','_','S','m','a','l','l','_','S','c','r','i','p','t',0,'K','h','i','t','a','n','_','S','m','a','l', +'l','_','S','c','r','i','p','t',0,2,'L','i','s','u','_','S','u','p',0,'L','i','s','u','_','S','u','p','p','l','e','m','e', +'n','t',0,2,'S','y','m','b','o','l','s','_','F','o','r','_','L','e','g','a','c','y','_','C','o','m','p','u','t','i','n','g', +0,'S','y','m','b','o','l','s','_','F','o','r','_','L','e','g','a','c','y','_','C','o','m','p','u','t','i','n','g',0, +2,'T','a','n','g','u','t','_','S','u','p',0,'T','a','n','g','u','t','_','S','u','p','p','l','e','m','e','n','t',0, +2,'Y','e','z','i','d','i',0,'Y','e','z','i','d','i',0,2,'c','c','c',0,'C','a','n','o','n','i','c','a','l','_','C','o', +'m','b','i','n','i','n','g','_','C','l','a','s','s',0,2,'d','t',0,'D','e','c','o','m','p','o','s','i','t','i','o','n','_', +'T','y','p','e',0,3,'N','o','n','e',0,'N','o','n','e',0,'n','o','n','e',0, +3,'C','a','n',0,'C','a','n','o','n','i','c','a','l',0,'c','a','n',0, +3,'C','o','m',0,'C','o','m','p','a','t',0,'c','o','m',0, +3,'E','n','c',0,'C','i','r','c','l','e',0,'e','n','c',0, +3,'F','i','n',0,'F','i','n','a','l',0,'f','i','n',0,3,'F','o','n','t',0,'F','o','n','t',0, +'f','o','n','t',0,3,'F','r','a',0,'F','r','a','c','t','i','o','n',0,'f','r','a',0, +3,'I','n','i','t',0,'I','n','i','t','i','a','l',0,'i','n','i','t',0, +3,'I','s','o',0,'I','s','o','l','a','t','e','d',0,'i','s','o',0, +3,'M','e','d',0,'M','e','d','i','a','l',0,'m','e','d',0, +3,'N','a','r',0,'N','a','r','r','o','w',0,'n','a','r',0, +3,'N','b',0,'N','o','b','r','e','a','k',0,'n','b',0,3,'S','m','l',0,'S','m','a','l','l',0, +'s','m','l',0,3,'S','q','r',0,'S','q','u','a','r','e',0,'s','q','r',0, +3,'S','u','b',0,'S','u','b',0,'s','u','b',0,3,'S','u','p',0,'S','u','p','e','r',0, +'s','u','p',0,3,'V','e','r','t',0,'V','e','r','t','i','c','a','l',0,'v','e','r','t',0, +3,'W','i','d','e',0,'W','i','d','e',0,'w','i','d','e',0, +2,'e','a',0,'E','a','s','t','_','A','s','i','a','n','_','W','i','d','t','h',0, +2,'N',0,'N','e','u','t','r','a','l',0,2,'A',0,'A','m','b','i','g','u','o','u','s',0, +2,'H',0,'H','a','l','f','w','i','d','t','h',0,2,'F',0,'F','u','l','l','w','i','d','t','h',0, +2,'N','a',0,'N','a','r','r','o','w',0,2,'W',0,'W','i','d','e',0, +2,'g','c',0,'G','e','n','e','r','a','l','_','C','a','t','e','g','o','r','y',0, +2,'C','n',0,'U','n','a','s','s','i','g','n','e','d',0,2,'L','u',0,'U','p','p','e','r','c','a','s','e','_','L','e','t', +'t','e','r',0,2,'L','l',0,'L','o','w','e','r','c','a','s','e','_','L','e','t','t','e','r',0, +2,'L','t',0,'T','i','t','l','e','c','a','s','e','_','L','e','t','t','e','r',0, +2,'L','m',0,'M','o','d','i','f','i','e','r','_','L','e','t','t','e','r',0, +2,'L','o',0,'O','t','h','e','r','_','L','e','t','t','e','r',0, +2,'M','n',0,'N','o','n','s','p','a','c','i','n','g','_','M','a','r','k',0, +2,'M','e',0,'E','n','c','l','o','s','i','n','g','_','M','a','r','k',0, +2,'M','c',0,'S','p','a','c','i','n','g','_','M','a','r','k',0, +3,'N','d',0,'D','e','c','i','m','a','l','_','N','u','m','b','e','r',0,'d','i','g','i','t',0, +2,'N','l',0,'L','e','t','t','e','r','_','N','u','m','b','e','r',0, +2,'N','o',0,'O','t','h','e','r','_','N','u','m','b','e','r',0, +2,'Z','s',0,'S','p','a','c','e','_','S','e','p','a','r','a','t','o','r',0, +2,'Z','l',0,'L','i','n','e','_','S','e','p','a','r','a','t','o','r',0, +2,'Z','p',0,'P','a','r','a','g','r','a','p','h','_','S','e','p','a','r','a','t','o','r',0, +3,'C','c',0,'C','o','n','t','r','o','l',0,'c','n','t','r','l',0, +2,'C','f',0,'F','o','r','m','a','t',0,2,'C','o',0,'P','r','i','v','a','t','e','_','U','s','e',0, +2,'C','s',0,'S','u','r','r','o','g','a','t','e',0,2,'P','d',0,'D','a','s','h','_','P','u','n','c','t','u','a','t','i', +'o','n',0,2,'P','s',0,'O','p','e','n','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'P','e',0,'C','l','o','s','e','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'P','c',0,'C','o','n','n','e','c','t','o','r','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'P','o',0,'O','t','h','e','r','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'S','m',0,'M','a','t','h','_','S','y','m','b','o','l',0, +2,'S','c',0,'C','u','r','r','e','n','c','y','_','S','y','m','b','o','l',0, +2,'S','k',0,'M','o','d','i','f','i','e','r','_','S','y','m','b','o','l',0, +2,'S','o',0,'O','t','h','e','r','_','S','y','m','b','o','l',0, +2,'P','i',0,'I','n','i','t','i','a','l','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'P','f',0,'F','i','n','a','l','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'j','g',0,'J','o','i','n','i','n','g','_','G','r','o','u','p',0, +2,'N','o','_','J','o','i','n','i','n','g','_','G','r','o','u','p',0,'N','o','_','J','o','i','n','i','n','g','_','G','r','o', +'u','p',0,2,'A','i','n',0,'A','i','n',0,2,'A','l','a','p','h',0,'A','l','a','p','h',0, +2,'A','l','e','f',0,'A','l','e','f',0,2,'B','e','h',0,'B','e','h',0, +2,'B','e','t','h',0,'B','e','t','h',0,2,'D','a','l',0,'D','a','l',0, +2,'D','a','l','a','t','h','_','R','i','s','h',0,'D','a','l','a','t','h','_','R','i','s','h',0, +2,'E',0,'E',0,2,'F','e','h',0,'F','e','h',0,2,'F','i','n','a','l','_','S','e','m','k','a','t','h',0, +'F','i','n','a','l','_','S','e','m','k','a','t','h',0,2,'G','a','f',0,'G','a','f',0, +2,'G','a','m','a','l',0,'G','a','m','a','l',0,2,'H','a','h',0,'H','a','h',0, +2,'T','e','h','_','M','a','r','b','u','t','a','_','G','o','a','l',0,'H','a','m','z','a','_','O','n','_','H','e','h','_','G', +'o','a','l',0,2,'H','e',0,'H','e',0,2,'H','e','h',0,'H','e','h',0, +2,'H','e','h','_','G','o','a','l',0,'H','e','h','_','G','o','a','l',0, +2,'H','e','t','h',0,'H','e','t','h',0,2,'K','a','f',0,'K','a','f',0, +2,'K','a','p','h',0,'K','a','p','h',0,2,'K','n','o','t','t','e','d','_','H','e','h',0, +'K','n','o','t','t','e','d','_','H','e','h',0,2,'L','a','m',0,'L','a','m',0, +2,'L','a','m','a','d','h',0,'L','a','m','a','d','h',0,2,'M','e','e','m',0,'M','e','e','m',0, +2,'M','i','m',0,'M','i','m',0,2,'N','o','o','n',0,'N','o','o','n',0, +2,'N','u','n',0,'N','u','n',0,2,'P','e',0,'P','e',0, +2,'Q','a','f',0,'Q','a','f',0,2,'Q','a','p','h',0,'Q','a','p','h',0, +2,'R','e','h',0,'R','e','h',0,2,'R','e','v','e','r','s','e','d','_','P','e',0,'R','e','v','e','r','s','e','d','_','P', +'e',0,2,'S','a','d',0,'S','a','d',0,2,'S','a','d','h','e',0,'S','a','d','h','e',0, +2,'S','e','e','n',0,'S','e','e','n',0,2,'S','e','m','k','a','t','h',0,'S','e','m','k','a','t','h',0, +2,'S','h','i','n',0,'S','h','i','n',0,2,'S','w','a','s','h','_','K','a','f',0,'S','w','a','s','h','_','K','a','f',0, +2,'S','y','r','i','a','c','_','W','a','w',0,'S','y','r','i','a','c','_','W','a','w',0, +2,'T','a','h',0,'T','a','h',0,2,'T','a','w',0,'T','a','w',0, +2,'T','e','h','_','M','a','r','b','u','t','a',0,'T','e','h','_','M','a','r','b','u','t','a',0, +2,'T','e','t','h',0,'T','e','t','h',0,2,'W','a','w',0,'W','a','w',0, +2,'Y','e','h',0,'Y','e','h',0,2,'Y','e','h','_','B','a','r','r','e','e',0,'Y','e','h','_','B','a','r','r','e','e',0, +2,'Y','e','h','_','W','i','t','h','_','T','a','i','l',0,'Y','e','h','_','W','i','t','h','_','T','a','i','l',0, +2,'Y','u','d','h',0,'Y','u','d','h',0,2,'Y','u','d','h','_','H','e',0,'Y','u','d','h','_','H','e',0, +2,'Z','a','i','n',0,'Z','a','i','n',0,2,'F','e',0,'F','e',0, +2,'K','h','a','p','h',0,'K','h','a','p','h',0,2,'Z','h','a','i','n',0,'Z','h','a','i','n',0, +2,'B','u','r','u','s','h','a','s','k','i','_','Y','e','h','_','B','a','r','r','e','e',0,'B','u','r','u','s','h','a','s','k', +'i','_','Y','e','h','_','B','a','r','r','e','e',0,2,'F','a','r','s','i','_','Y','e','h',0, +'F','a','r','s','i','_','Y','e','h',0,2,'N','y','a',0,'N','y','a',0, +2,'R','o','h','i','n','g','y','a','_','Y','e','h',0,'R','o','h','i','n','g','y','a','_','Y','e','h',0, +2,'M','a','n','i','c','h','a','e','a','n','_','A','l','e','p','h',0,'M','a','n','i','c','h','a','e','a','n','_','A','l','e', +'p','h',0,2,'M','a','n','i','c','h','a','e','a','n','_','A','y','i','n',0,'M','a','n','i','c','h','a','e','a','n','_','A', +'y','i','n',0,2,'M','a','n','i','c','h','a','e','a','n','_','B','e','t','h',0,'M','a','n','i','c','h','a','e','a','n','_', +'B','e','t','h',0,2,'M','a','n','i','c','h','a','e','a','n','_','D','a','l','e','t','h',0, +'M','a','n','i','c','h','a','e','a','n','_','D','a','l','e','t','h',0, +2,'M','a','n','i','c','h','a','e','a','n','_','D','h','a','m','e','d','h',0,'M','a','n','i','c','h','a','e','a','n','_','D', +'h','a','m','e','d','h',0,2,'M','a','n','i','c','h','a','e','a','n','_','F','i','v','e',0, +'M','a','n','i','c','h','a','e','a','n','_','F','i','v','e',0, +2,'M','a','n','i','c','h','a','e','a','n','_','G','i','m','e','l',0,'M','a','n','i','c','h','a','e','a','n','_','G','i','m', +'e','l',0,2,'M','a','n','i','c','h','a','e','a','n','_','H','e','t','h',0,'M','a','n','i','c','h','a','e','a','n','_','H', +'e','t','h',0,2,'M','a','n','i','c','h','a','e','a','n','_','H','u','n','d','r','e','d',0, +'M','a','n','i','c','h','a','e','a','n','_','H','u','n','d','r','e','d',0, +2,'M','a','n','i','c','h','a','e','a','n','_','K','a','p','h',0,'M','a','n','i','c','h','a','e','a','n','_','K','a','p','h', +0,2,'M','a','n','i','c','h','a','e','a','n','_','L','a','m','e','d','h',0,'M','a','n','i','c','h','a','e','a','n','_','L', +'a','m','e','d','h',0,2,'M','a','n','i','c','h','a','e','a','n','_','M','e','m',0,'M','a','n','i','c','h','a','e','a','n', +'_','M','e','m',0,2,'M','a','n','i','c','h','a','e','a','n','_','N','u','n',0,'M','a','n','i','c','h','a','e','a','n','_', +'N','u','n',0,2,'M','a','n','i','c','h','a','e','a','n','_','O','n','e',0,'M','a','n','i','c','h','a','e','a','n','_','O', +'n','e',0,2,'M','a','n','i','c','h','a','e','a','n','_','P','e',0,'M','a','n','i','c','h','a','e','a','n','_','P','e',0, +2,'M','a','n','i','c','h','a','e','a','n','_','Q','o','p','h',0,'M','a','n','i','c','h','a','e','a','n','_','Q','o','p','h', +0,2,'M','a','n','i','c','h','a','e','a','n','_','R','e','s','h',0,'M','a','n','i','c','h','a','e','a','n','_','R','e','s', +'h',0,2,'M','a','n','i','c','h','a','e','a','n','_','S','a','d','h','e',0,'M','a','n','i','c','h','a','e','a','n','_','S', +'a','d','h','e',0,2,'M','a','n','i','c','h','a','e','a','n','_','S','a','m','e','k','h',0, +'M','a','n','i','c','h','a','e','a','n','_','S','a','m','e','k','h',0, +2,'M','a','n','i','c','h','a','e','a','n','_','T','a','w',0,'M','a','n','i','c','h','a','e','a','n','_','T','a','w',0, +2,'M','a','n','i','c','h','a','e','a','n','_','T','e','n',0,'M','a','n','i','c','h','a','e','a','n','_','T','e','n',0, +2,'M','a','n','i','c','h','a','e','a','n','_','T','e','t','h',0,'M','a','n','i','c','h','a','e','a','n','_','T','e','t','h', +0,2,'M','a','n','i','c','h','a','e','a','n','_','T','h','a','m','e','d','h',0,'M','a','n','i','c','h','a','e','a','n','_', +'T','h','a','m','e','d','h',0,2,'M','a','n','i','c','h','a','e','a','n','_','T','w','e','n','t','y',0, +'M','a','n','i','c','h','a','e','a','n','_','T','w','e','n','t','y',0, +2,'M','a','n','i','c','h','a','e','a','n','_','W','a','w',0,'M','a','n','i','c','h','a','e','a','n','_','W','a','w',0, +2,'M','a','n','i','c','h','a','e','a','n','_','Y','o','d','h',0,'M','a','n','i','c','h','a','e','a','n','_','Y','o','d','h', +0,2,'M','a','n','i','c','h','a','e','a','n','_','Z','a','y','i','n',0,'M','a','n','i','c','h','a','e','a','n','_','Z','a', +'y','i','n',0,2,'S','t','r','a','i','g','h','t','_','W','a','w',0,'S','t','r','a','i','g','h','t','_','W','a','w',0, +2,'A','f','r','i','c','a','n','_','F','e','h',0,'A','f','r','i','c','a','n','_','F','e','h',0, +2,'A','f','r','i','c','a','n','_','N','o','o','n',0,'A','f','r','i','c','a','n','_','N','o','o','n',0, +2,'A','f','r','i','c','a','n','_','Q','a','f',0,'A','f','r','i','c','a','n','_','Q','a','f',0, +2,'M','a','l','a','y','a','l','a','m','_','B','h','a',0,'M','a','l','a','y','a','l','a','m','_','B','h','a',0, +2,'M','a','l','a','y','a','l','a','m','_','J','a',0,'M','a','l','a','y','a','l','a','m','_','J','a',0, +2,'M','a','l','a','y','a','l','a','m','_','L','l','a',0,'M','a','l','a','y','a','l','a','m','_','L','l','a',0, +2,'M','a','l','a','y','a','l','a','m','_','L','l','l','a',0,'M','a','l','a','y','a','l','a','m','_','L','l','l','a',0, +2,'M','a','l','a','y','a','l','a','m','_','N','g','a',0,'M','a','l','a','y','a','l','a','m','_','N','g','a',0, +2,'M','a','l','a','y','a','l','a','m','_','N','n','a',0,'M','a','l','a','y','a','l','a','m','_','N','n','a',0, +2,'M','a','l','a','y','a','l','a','m','_','N','n','n','a',0,'M','a','l','a','y','a','l','a','m','_','N','n','n','a',0, +2,'M','a','l','a','y','a','l','a','m','_','N','y','a',0,'M','a','l','a','y','a','l','a','m','_','N','y','a',0, +2,'M','a','l','a','y','a','l','a','m','_','R','a',0,'M','a','l','a','y','a','l','a','m','_','R','a',0, +2,'M','a','l','a','y','a','l','a','m','_','S','s','a',0,'M','a','l','a','y','a','l','a','m','_','S','s','a',0, +2,'M','a','l','a','y','a','l','a','m','_','T','t','a',0,'M','a','l','a','y','a','l','a','m','_','T','t','a',0, +2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','K','i','n','n','a','_','Y','a',0, +'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','K','i','n','n','a','_','Y','a',0, +2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','P','a',0,'H','a','n','i','f','i','_','R','o','h','i','n', +'g','y','a','_','P','a',0,2,'j','t',0,'J','o','i','n','i','n','g','_','T','y','p','e',0, +2,'U',0,'N','o','n','_','J','o','i','n','i','n','g',0,2,'C',0,'J','o','i','n','_','C','a','u','s','i','n','g',0, +2,'D',0,'D','u','a','l','_','J','o','i','n','i','n','g',0, +2,'L',0,'L','e','f','t','_','J','o','i','n','i','n','g',0, +2,'R',0,'R','i','g','h','t','_','J','o','i','n','i','n','g',0, +2,'T',0,'T','r','a','n','s','p','a','r','e','n','t',0,2,'l','b',0,'L','i','n','e','_','B','r','e','a','k',0, +2,'X','X',0,'U','n','k','n','o','w','n',0,2,'A','I',0,'A','m','b','i','g','u','o','u','s',0, +2,'A','L',0,'A','l','p','h','a','b','e','t','i','c',0,2,'B','2',0,'B','r','e','a','k','_','B','o','t','h',0, +2,'B','A',0,'B','r','e','a','k','_','A','f','t','e','r',0, +2,'B','B',0,'B','r','e','a','k','_','B','e','f','o','r','e',0, +2,'B','K',0,'M','a','n','d','a','t','o','r','y','_','B','r','e','a','k',0, +2,'C','B',0,'C','o','n','t','i','n','g','e','n','t','_','B','r','e','a','k',0, +2,'C','L',0,'C','l','o','s','e','_','P','u','n','c','t','u','a','t','i','o','n',0, +2,'C','M',0,'C','o','m','b','i','n','i','n','g','_','M','a','r','k',0, +2,'C','R',0,'C','a','r','r','i','a','g','e','_','R','e','t','u','r','n',0, +2,'E','X',0,'E','x','c','l','a','m','a','t','i','o','n',0, +2,'G','L',0,'G','l','u','e',0,2,'H','Y',0,'H','y','p','h','e','n',0, +2,'I','D',0,'I','d','e','o','g','r','a','p','h','i','c',0, +3,'I','N',0,'I','n','s','e','p','a','r','a','b','l','e',0,'I','n','s','e','p','e','r','a','b','l','e',0, +2,'I','S',0,'I','n','f','i','x','_','N','u','m','e','r','i','c',0, +2,'L','F',0,'L','i','n','e','_','F','e','e','d',0,2,'N','S',0,'N','o','n','s','t','a','r','t','e','r',0, +2,'N','U',0,'N','u','m','e','r','i','c',0,2,'O','P',0,'O','p','e','n','_','P','u','n','c','t','u','a','t','i','o','n', +0,2,'P','O',0,'P','o','s','t','f','i','x','_','N','u','m','e','r','i','c',0, +2,'P','R',0,'P','r','e','f','i','x','_','N','u','m','e','r','i','c',0, +2,'Q','U',0,'Q','u','o','t','a','t','i','o','n',0,2,'S','A',0,'C','o','m','p','l','e','x','_','C','o','n','t','e','x', +'t',0,2,'S','G',0,'S','u','r','r','o','g','a','t','e',0, +2,'S','P',0,'S','p','a','c','e',0,2,'S','Y',0,'B','r','e','a','k','_','S','y','m','b','o','l','s',0, +2,'Z','W',0,'Z','W','S','p','a','c','e',0,2,'N','L',0,'N','e','x','t','_','L','i','n','e',0, +2,'W','J',0,'W','o','r','d','_','J','o','i','n','e','r',0, +2,'H','2',0,'H','2',0,2,'H','3',0,'H','3',0,2,'J','L',0,'J','L',0, +2,'J','T',0,'J','T',0,2,'J','V',0,'J','V',0,2,'C','P',0,'C','l','o','s','e','_','P','a','r','e','n','t','h','e', +'s','i','s',0,2,'C','J',0,'C','o','n','d','i','t','i','o','n','a','l','_','J','a','p','a','n','e','s','e','_','S','t','a', +'r','t','e','r',0,2,'H','L',0,'H','e','b','r','e','w','_','L','e','t','t','e','r',0, +2,'E','B',0,'E','_','B','a','s','e',0,2,'E','M',0,'E','_','M','o','d','i','f','i','e','r',0, +2,'Z','W','J',0,'Z','W','J',0,2,'n','t',0,'N','u','m','e','r','i','c','_','T','y','p','e',0, +2,'N','o','n','e',0,'N','o','n','e',0,2,'D','e',0,'D','e','c','i','m','a','l',0, +2,'D','i',0,'D','i','g','i','t',0,2,'N','u',0,'N','u','m','e','r','i','c',0, +2,'s','c',0,'S','c','r','i','p','t',0,2,'Z','y','y','y',0,'C','o','m','m','o','n',0, +3,'Z','i','n','h',0,'I','n','h','e','r','i','t','e','d',0,'Q','a','a','i',0, +2,'A','r','a','b',0,'A','r','a','b','i','c',0,2,'A','r','m','n',0,'A','r','m','e','n','i','a','n',0, +2,'B','e','n','g',0,'B','e','n','g','a','l','i',0,2,'B','o','p','o',0,'B','o','p','o','m','o','f','o',0, +2,'C','h','e','r',0,'C','h','e','r','o','k','e','e',0,3,'C','o','p','t',0,'C','o','p','t','i','c',0, +'Q','a','a','c',0,2,'C','y','r','l',0,'C','y','r','i','l','l','i','c',0, +2,'D','s','r','t',0,'D','e','s','e','r','e','t',0,2,'D','e','v','a',0,'D','e','v','a','n','a','g','a','r','i',0, +2,'E','t','h','i',0,'E','t','h','i','o','p','i','c',0,2,'G','e','o','r',0,'G','e','o','r','g','i','a','n',0, +2,'G','o','t','h',0,'G','o','t','h','i','c',0,2,'G','r','e','k',0,'G','r','e','e','k',0, +2,'G','u','j','r',0,'G','u','j','a','r','a','t','i',0,2,'G','u','r','u',0,'G','u','r','m','u','k','h','i',0, +2,'H','a','n','i',0,'H','a','n',0,2,'H','a','n','g',0,'H','a','n','g','u','l',0, +2,'H','e','b','r',0,'H','e','b','r','e','w',0,2,'H','i','r','a',0,'H','i','r','a','g','a','n','a',0, +2,'K','n','d','a',0,'K','a','n','n','a','d','a',0,2,'K','a','n','a',0,'K','a','t','a','k','a','n','a',0, +2,'K','h','m','r',0,'K','h','m','e','r',0,2,'L','a','o','o',0,'L','a','o',0, +2,'L','a','t','n',0,'L','a','t','i','n',0,2,'M','l','y','m',0,'M','a','l','a','y','a','l','a','m',0, +2,'M','o','n','g',0,'M','o','n','g','o','l','i','a','n',0, +2,'M','y','m','r',0,'M','y','a','n','m','a','r',0,2,'O','g','a','m',0,'O','g','h','a','m',0, +2,'I','t','a','l',0,'O','l','d','_','I','t','a','l','i','c',0, +2,'O','r','y','a',0,'O','r','i','y','a',0,2,'R','u','n','r',0,'R','u','n','i','c',0, +2,'S','i','n','h',0,'S','i','n','h','a','l','a',0,2,'S','y','r','c',0,'S','y','r','i','a','c',0, +2,'T','a','m','l',0,'T','a','m','i','l',0,2,'T','e','l','u',0,'T','e','l','u','g','u',0, +2,'T','h','a','a',0,'T','h','a','a','n','a',0,2,'T','i','b','t',0,'T','i','b','e','t','a','n',0, +2,'C','a','n','s',0,'C','a','n','a','d','i','a','n','_','A','b','o','r','i','g','i','n','a','l',0, +2,'Y','i','i','i',0,'Y','i',0,2,'T','g','l','g',0,'T','a','g','a','l','o','g',0, +2,'H','a','n','o',0,'H','a','n','u','n','o','o',0,2,'B','u','h','d',0,'B','u','h','i','d',0, +2,'T','a','g','b',0,'T','a','g','b','a','n','w','a',0,2,'B','r','a','i',0,'B','r','a','i','l','l','e',0, +2,'C','p','r','t',0,'C','y','p','r','i','o','t',0,2,'L','i','m','b',0,'L','i','m','b','u',0, +2,'L','i','n','b',0,'L','i','n','e','a','r','_','B',0,2,'O','s','m','a',0,'O','s','m','a','n','y','a',0, +2,'S','h','a','w',0,'S','h','a','v','i','a','n',0,2,'T','a','l','e',0,'T','a','i','_','L','e',0, +2,'U','g','a','r',0,'U','g','a','r','i','t','i','c',0,2,'H','r','k','t',0,'K','a','t','a','k','a','n','a','_','O','r', +'_','H','i','r','a','g','a','n','a',0,2,'B','u','g','i',0,'B','u','g','i','n','e','s','e',0, +2,'G','l','a','g',0,'G','l','a','g','o','l','i','t','i','c',0, +2,'K','h','a','r',0,'K','h','a','r','o','s','h','t','h','i',0, +2,'S','y','l','o',0,'S','y','l','o','t','i','_','N','a','g','r','i',0, +2,'T','a','l','u',0,'N','e','w','_','T','a','i','_','L','u','e',0, +2,'T','f','n','g',0,'T','i','f','i','n','a','g','h',0,2,'X','p','e','o',0,'O','l','d','_','P','e','r','s','i','a','n', +0,2,'B','a','l','i',0,'B','a','l','i','n','e','s','e',0, +2,'B','a','t','k',0,'B','a','t','a','k',0,2,'B','l','i','s',0,'B','l','i','s',0, +2,'B','r','a','h',0,'B','r','a','h','m','i',0,2,'C','i','r','t',0,'C','i','r','t',0, +2,'C','y','r','s',0,'C','y','r','s',0,2,'E','g','y','d',0,'E','g','y','d',0, +2,'E','g','y','h',0,'E','g','y','h',0,2,'E','g','y','p',0,'E','g','y','p','t','i','a','n','_','H','i','e','r','o','g', +'l','y','p','h','s',0,2,'G','e','o','k',0,'G','e','o','k',0, +2,'H','a','n','s',0,'H','a','n','s',0,2,'H','a','n','t',0,'H','a','n','t',0, +2,'H','m','n','g',0,'P','a','h','a','w','h','_','H','m','o','n','g',0, +2,'H','u','n','g',0,'O','l','d','_','H','u','n','g','a','r','i','a','n',0, +2,'I','n','d','s',0,'I','n','d','s',0,2,'J','a','v','a',0,'J','a','v','a','n','e','s','e',0, +2,'K','a','l','i',0,'K','a','y','a','h','_','L','i',0,2,'L','a','t','f',0,'L','a','t','f',0, +2,'L','a','t','g',0,'L','a','t','g',0,2,'L','e','p','c',0,'L','e','p','c','h','a',0, +2,'L','i','n','a',0,'L','i','n','e','a','r','_','A',0,2,'M','a','n','d',0,'M','a','n','d','a','i','c',0, +2,'M','a','y','a',0,'M','a','y','a',0,2,'M','e','r','o',0,'M','e','r','o','i','t','i','c','_','H','i','e','r','o','g', +'l','y','p','h','s',0,2,'N','k','o','o',0,'N','k','o',0, +2,'O','r','k','h',0,'O','l','d','_','T','u','r','k','i','c',0, +2,'P','e','r','m',0,'O','l','d','_','P','e','r','m','i','c',0, +2,'P','h','a','g',0,'P','h','a','g','s','_','P','a',0,2,'P','h','n','x',0,'P','h','o','e','n','i','c','i','a','n',0, +2,'P','l','r','d',0,'M','i','a','o',0,2,'R','o','r','o',0,'R','o','r','o',0, +2,'S','a','r','a',0,'S','a','r','a',0,2,'S','y','r','e',0,'S','y','r','e',0, +2,'S','y','r','j',0,'S','y','r','j',0,2,'S','y','r','n',0,'S','y','r','n',0, +2,'T','e','n','g',0,'T','e','n','g',0,2,'V','a','i','i',0,'V','a','i',0, +2,'V','i','s','p',0,'V','i','s','p',0,2,'X','s','u','x',0,'C','u','n','e','i','f','o','r','m',0, +2,'Z','x','x','x',0,'Z','x','x','x',0,2,'Z','z','z','z',0,'U','n','k','n','o','w','n',0, +2,'C','a','r','i',0,'C','a','r','i','a','n',0,2,'J','p','a','n',0,'J','p','a','n',0, +2,'L','a','n','a',0,'T','a','i','_','T','h','a','m',0,2,'L','y','c','i',0,'L','y','c','i','a','n',0, +2,'L','y','d','i',0,'L','y','d','i','a','n',0,2,'O','l','c','k',0,'O','l','_','C','h','i','k','i',0, +2,'R','j','n','g',0,'R','e','j','a','n','g',0,2,'S','a','u','r',0,'S','a','u','r','a','s','h','t','r','a',0, +2,'S','g','n','w',0,'S','i','g','n','W','r','i','t','i','n','g',0, +2,'S','u','n','d',0,'S','u','n','d','a','n','e','s','e',0, +2,'M','o','o','n',0,'M','o','o','n',0,2,'M','t','e','i',0,'M','e','e','t','e','i','_','M','a','y','e','k',0, +2,'A','r','m','i',0,'I','m','p','e','r','i','a','l','_','A','r','a','m','a','i','c',0, +2,'A','v','s','t',0,'A','v','e','s','t','a','n',0,2,'C','a','k','m',0,'C','h','a','k','m','a',0, +2,'K','o','r','e',0,'K','o','r','e',0,2,'K','t','h','i',0,'K','a','i','t','h','i',0, +2,'M','a','n','i',0,'M','a','n','i','c','h','a','e','a','n',0, +2,'P','h','l','i',0,'I','n','s','c','r','i','p','t','i','o','n','a','l','_','P','a','h','l','a','v','i',0, +2,'P','h','l','p',0,'P','s','a','l','t','e','r','_','P','a','h','l','a','v','i',0, +2,'P','h','l','v',0,'P','h','l','v',0,2,'P','r','t','i',0,'I','n','s','c','r','i','p','t','i','o','n','a','l','_','P', +'a','r','t','h','i','a','n',0,2,'S','a','m','r',0,'S','a','m','a','r','i','t','a','n',0, +2,'T','a','v','t',0,'T','a','i','_','V','i','e','t',0,2,'Z','m','t','h',0,'Z','m','t','h',0, +2,'Z','s','y','m',0,'Z','s','y','m',0,2,'B','a','m','u',0,'B','a','m','u','m',0, +2,'N','k','g','b',0,'N','k','g','b',0,2,'S','a','r','b',0,'O','l','d','_','S','o','u','t','h','_','A','r','a','b','i', +'a','n',0,2,'B','a','s','s',0,'B','a','s','s','a','_','V','a','h',0, +2,'D','u','p','l',0,'D','u','p','l','o','y','a','n',0,2,'E','l','b','a',0,'E','l','b','a','s','a','n',0, +2,'G','r','a','n',0,'G','r','a','n','t','h','a',0,2,'K','p','e','l',0,'K','p','e','l',0, +2,'L','o','m','a',0,'L','o','m','a',0,2,'M','e','n','d',0,'M','e','n','d','e','_','K','i','k','a','k','u','i',0, +2,'M','e','r','c',0,'M','e','r','o','i','t','i','c','_','C','u','r','s','i','v','e',0, +2,'N','a','r','b',0,'O','l','d','_','N','o','r','t','h','_','A','r','a','b','i','a','n',0, +2,'N','b','a','t',0,'N','a','b','a','t','a','e','a','n',0, +2,'P','a','l','m',0,'P','a','l','m','y','r','e','n','e',0, +2,'S','i','n','d',0,'K','h','u','d','a','w','a','d','i',0, +2,'W','a','r','a',0,'W','a','r','a','n','g','_','C','i','t','i',0, +2,'A','f','a','k',0,'A','f','a','k',0,2,'J','u','r','c',0,'J','u','r','c',0, +2,'M','r','o','o',0,'M','r','o',0,2,'N','s','h','u',0,'N','u','s','h','u',0, +2,'S','h','r','d',0,'S','h','a','r','a','d','a',0,2,'S','o','r','a',0,'S','o','r','a','_','S','o','m','p','e','n','g', +0,2,'T','a','k','r',0,'T','a','k','r','i',0,2,'T','a','n','g',0,'T','a','n','g','u','t',0, +2,'W','o','l','e',0,'W','o','l','e',0,2,'H','l','u','w',0,'A','n','a','t','o','l','i','a','n','_','H','i','e','r','o', +'g','l','y','p','h','s',0,2,'K','h','o','j',0,'K','h','o','j','k','i',0, +2,'T','i','r','h',0,'T','i','r','h','u','t','a',0,2,'A','g','h','b',0,'C','a','u','c','a','s','i','a','n','_','A','l', +'b','a','n','i','a','n',0,2,'M','a','h','j',0,'M','a','h','a','j','a','n','i',0, +2,'H','a','t','r',0,'H','a','t','r','a','n',0,2,'M','u','l','t',0,'M','u','l','t','a','n','i',0, +2,'P','a','u','c',0,'P','a','u','_','C','i','n','_','H','a','u',0, +2,'S','i','d','d',0,'S','i','d','d','h','a','m',0,2,'A','d','l','m',0,'A','d','l','a','m',0, +2,'B','h','k','s',0,'B','h','a','i','k','s','u','k','i',0, +2,'M','a','r','c',0,'M','a','r','c','h','e','n',0,2,'O','s','g','e',0,'O','s','a','g','e',0, +2,'H','a','n','b',0,'H','a','n','b',0,2,'J','a','m','o',0,'J','a','m','o',0, +2,'Z','s','y','e',0,'Z','s','y','e',0,2,'G','o','n','m',0,'M','a','s','a','r','a','m','_','G','o','n','d','i',0, +2,'S','o','y','o',0,'S','o','y','o','m','b','o',0,2,'Z','a','n','b',0,'Z','a','n','a','b','a','z','a','r','_','S','q', +'u','a','r','e',0,2,'D','o','g','r',0,'D','o','g','r','a',0, +2,'G','o','n','g',0,'G','u','n','j','a','l','a','_','G','o','n','d','i',0, +2,'M','a','k','a',0,'M','a','k','a','s','a','r',0,2,'M','e','d','f',0,'M','e','d','e','f','a','i','d','r','i','n',0, +2,'R','o','h','g',0,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a',0, +2,'S','o','g','d',0,'S','o','g','d','i','a','n',0,2,'S','o','g','o',0,'O','l','d','_','S','o','g','d','i','a','n',0, +2,'E','l','y','m',0,'E','l','y','m','a','i','c',0,2,'H','m','n','p',0,'N','y','i','a','k','e','n','g','_','P','u','a', +'c','h','u','e','_','H','m','o','n','g',0,2,'N','a','n','d',0,'N','a','n','d','i','n','a','g','a','r','i',0, +2,'W','c','h','o',0,'W','a','n','c','h','o',0,2,'C','h','r','s',0,'C','h','o','r','a','s','m','i','a','n',0, +2,'D','i','a','k',0,'D','i','v','e','s','_','A','k','u','r','u',0, +2,'K','i','t','s',0,'K','h','i','t','a','n','_','S','m','a','l','l','_','S','c','r','i','p','t',0, +2,'Y','e','z','i',0,'Y','e','z','i','d','i',0,2,'h','s','t',0,'H','a','n','g','u','l','_','S','y','l','l','a','b','l', +'e','_','T','y','p','e',0,2,'N','A',0,'N','o','t','_','A','p','p','l','i','c','a','b','l','e',0, +2,'L',0,'L','e','a','d','i','n','g','_','J','a','m','o',0, +2,'V',0,'V','o','w','e','l','_','J','a','m','o',0,2,'T',0,'T','r','a','i','l','i','n','g','_','J','a','m','o',0, +2,'L','V',0,'L','V','_','S','y','l','l','a','b','l','e',0, +2,'L','V','T',0,'L','V','T','_','S','y','l','l','a','b','l','e',0, +2,'N','F','D','_','Q','C',0,'N','F','D','_','Q','u','i','c','k','_','C','h','e','c','k',0, +2,'N',0,'N','o',0,2,'Y',0,'Y','e','s',0,2,'N','F','K','D','_','Q','C',0,'N','F','K','D','_','Q','u','i','c','k', +'_','C','h','e','c','k',0,2,'N','F','C','_','Q','C',0,'N','F','C','_','Q','u','i','c','k','_','C','h','e','c','k',0, +2,'M',0,'M','a','y','b','e',0,2,'N','F','K','C','_','Q','C',0,'N','F','K','C','_','Q','u','i','c','k','_','C','h','e', +'c','k',0,2,'l','c','c','c',0,'L','e','a','d','_','C','a','n','o','n','i','c','a','l','_','C','o','m','b','i','n','i','n', +'g','_','C','l','a','s','s',0,2,'t','c','c','c',0,'T','r','a','i','l','_','C','a','n','o','n','i','c','a','l','_','C','o', +'m','b','i','n','i','n','g','_','C','l','a','s','s',0,2,'G','C','B',0,'G','r','a','p','h','e','m','e','_','C','l','u','s', +'t','e','r','_','B','r','e','a','k',0,2,'X','X',0,'O','t','h','e','r',0, +2,'C','N',0,'C','o','n','t','r','o','l',0,2,'C','R',0,'C','R',0, +2,'E','X',0,'E','x','t','e','n','d',0,2,'L',0,'L',0, +2,'L','F',0,'L','F',0,2,'L','V',0,'L','V',0,2,'L','V','T',0,'L','V','T',0, +2,'T',0,'T',0,2,'V',0,'V',0,2,'S','M',0,'S','p','a','c','i','n','g','M','a','r','k',0, +2,'P','P',0,'P','r','e','p','e','n','d',0,2,'E','B','G',0,'E','_','B','a','s','e','_','G','A','Z',0, +2,'G','A','Z',0,'G','l','u','e','_','A','f','t','e','r','_','Z','w','j',0, +2,'S','B',0,'S','e','n','t','e','n','c','e','_','B','r','e','a','k',0, +2,'A','T',0,'A','T','e','r','m',0,2,'C','L',0,'C','l','o','s','e',0, +2,'F','O',0,'F','o','r','m','a','t',0,2,'L','O',0,'L','o','w','e','r',0, +2,'L','E',0,'O','L','e','t','t','e','r',0,2,'S','E',0,'S','e','p',0, +2,'S','P',0,'S','p',0,2,'S','T',0,'S','T','e','r','m',0, +2,'U','P',0,'U','p','p','e','r',0,2,'S','C',0,'S','C','o','n','t','i','n','u','e',0, +2,'W','B',0,'W','o','r','d','_','B','r','e','a','k',0,2,'L','E',0,'A','L','e','t','t','e','r',0, +2,'K','A',0,'K','a','t','a','k','a','n','a',0,2,'M','L',0,'M','i','d','L','e','t','t','e','r',0, +2,'M','N',0,'M','i','d','N','u','m',0,2,'E','X',0,'E','x','t','e','n','d','N','u','m','L','e','t',0, +2,'E','x','t','e','n','d',0,'E','x','t','e','n','d',0,2,'M','B',0,'M','i','d','N','u','m','L','e','t',0, +2,'N','L',0,'N','e','w','l','i','n','e',0,2,'S','Q',0,'S','i','n','g','l','e','_','Q','u','o','t','e',0, +2,'D','Q',0,'D','o','u','b','l','e','_','Q','u','o','t','e',0, +2,'W','S','e','g','S','p','a','c','e',0,'W','S','e','g','S','p','a','c','e',0, +2,'b','p','t',0,'B','i','d','i','_','P','a','i','r','e','d','_','B','r','a','c','k','e','t','_','T','y','p','e',0, +2,'n',0,'N','o','n','e',0,2,'o',0,'O','p','e','n',0, +2,'c',0,'C','l','o','s','e',0,2,'I','n','P','C',0,'I','n','d','i','c','_','P','o','s','i','t','i','o','n','a','l','_', +'C','a','t','e','g','o','r','y',0,2,'N','A',0,'N','A',0, +2,'B','o','t','t','o','m',0,'B','o','t','t','o','m',0,2,'B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0, +'B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0, +2,'B','o','t','t','o','m','_','A','n','d','_','R','i','g','h','t',0,'B','o','t','t','o','m','_','A','n','d','_','R','i','g', +'h','t',0,2,'L','e','f','t',0,'L','e','f','t',0,2,'L','e','f','t','_','A','n','d','_','R','i','g','h','t',0, +'L','e','f','t','_','A','n','d','_','R','i','g','h','t',0,2,'O','v','e','r','s','t','r','u','c','k',0, +'O','v','e','r','s','t','r','u','c','k',0,2,'R','i','g','h','t',0,'R','i','g','h','t',0, +2,'T','o','p',0,'T','o','p',0,2,'T','o','p','_','A','n','d','_','B','o','t','t','o','m',0, +'T','o','p','_','A','n','d','_','B','o','t','t','o','m',0,2,'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A', +'n','d','_','R','i','g','h','t',0,'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A','n','d','_','R','i','g','h', +'t',0,2,'T','o','p','_','A','n','d','_','L','e','f','t',0,'T','o','p','_','A','n','d','_','L','e','f','t',0, +2,'T','o','p','_','A','n','d','_','L','e','f','t','_','A','n','d','_','R','i','g','h','t',0, +'T','o','p','_','A','n','d','_','L','e','f','t','_','A','n','d','_','R','i','g','h','t',0, +2,'T','o','p','_','A','n','d','_','R','i','g','h','t',0,'T','o','p','_','A','n','d','_','R','i','g','h','t',0, +2,'V','i','s','u','a','l','_','O','r','d','e','r','_','L','e','f','t',0,'V','i','s','u','a','l','_','O','r','d','e','r','_', +'L','e','f','t',0,2,'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0, +'T','o','p','_','A','n','d','_','B','o','t','t','o','m','_','A','n','d','_','L','e','f','t',0, +2,'I','n','S','C',0,'I','n','d','i','c','_','S','y','l','l','a','b','i','c','_','C','a','t','e','g','o','r','y',0, +2,'O','t','h','e','r',0,'O','t','h','e','r',0,2,'A','v','a','g','r','a','h','a',0,'A','v','a','g','r','a','h','a',0, +2,'B','i','n','d','u',0,'B','i','n','d','u',0,2,'B','r','a','h','m','i','_','J','o','i','n','i','n','g','_','N','u','m', +'b','e','r',0,'B','r','a','h','m','i','_','J','o','i','n','i','n','g','_','N','u','m','b','e','r',0, +2,'C','a','n','t','i','l','l','a','t','i','o','n','_','M','a','r','k',0,'C','a','n','t','i','l','l','a','t','i','o','n','_', +'M','a','r','k',0,2,'C','o','n','s','o','n','a','n','t',0,'C','o','n','s','o','n','a','n','t',0, +2,'C','o','n','s','o','n','a','n','t','_','D','e','a','d',0,'C','o','n','s','o','n','a','n','t','_','D','e','a','d',0, +2,'C','o','n','s','o','n','a','n','t','_','F','i','n','a','l',0,'C','o','n','s','o','n','a','n','t','_','F','i','n','a','l', +0,2,'C','o','n','s','o','n','a','n','t','_','H','e','a','d','_','L','e','t','t','e','r',0, +'C','o','n','s','o','n','a','n','t','_','H','e','a','d','_','L','e','t','t','e','r',0, +2,'C','o','n','s','o','n','a','n','t','_','I','n','i','t','i','a','l','_','P','o','s','t','f','i','x','e','d',0, +'C','o','n','s','o','n','a','n','t','_','I','n','i','t','i','a','l','_','P','o','s','t','f','i','x','e','d',0, +2,'C','o','n','s','o','n','a','n','t','_','K','i','l','l','e','r',0,'C','o','n','s','o','n','a','n','t','_','K','i','l','l', +'e','r',0,2,'C','o','n','s','o','n','a','n','t','_','M','e','d','i','a','l',0,'C','o','n','s','o','n','a','n','t','_','M', +'e','d','i','a','l',0,2,'C','o','n','s','o','n','a','n','t','_','P','l','a','c','e','h','o','l','d','e','r',0, +'C','o','n','s','o','n','a','n','t','_','P','l','a','c','e','h','o','l','d','e','r',0, +2,'C','o','n','s','o','n','a','n','t','_','P','r','e','c','e','d','i','n','g','_','R','e','p','h','a',0, +'C','o','n','s','o','n','a','n','t','_','P','r','e','c','e','d','i','n','g','_','R','e','p','h','a',0, +2,'C','o','n','s','o','n','a','n','t','_','P','r','e','f','i','x','e','d',0,'C','o','n','s','o','n','a','n','t','_','P','r', +'e','f','i','x','e','d',0,2,'C','o','n','s','o','n','a','n','t','_','S','u','b','j','o','i','n','e','d',0, +'C','o','n','s','o','n','a','n','t','_','S','u','b','j','o','i','n','e','d',0, +2,'C','o','n','s','o','n','a','n','t','_','S','u','c','c','e','e','d','i','n','g','_','R','e','p','h','a',0, +'C','o','n','s','o','n','a','n','t','_','S','u','c','c','e','e','d','i','n','g','_','R','e','p','h','a',0, +2,'C','o','n','s','o','n','a','n','t','_','W','i','t','h','_','S','t','a','c','k','e','r',0, +'C','o','n','s','o','n','a','n','t','_','W','i','t','h','_','S','t','a','c','k','e','r',0, +2,'G','e','m','i','n','a','t','i','o','n','_','M','a','r','k',0,'G','e','m','i','n','a','t','i','o','n','_','M','a','r','k', +0,2,'I','n','v','i','s','i','b','l','e','_','S','t','a','c','k','e','r',0,'I','n','v','i','s','i','b','l','e','_','S','t', +'a','c','k','e','r',0,2,'J','o','i','n','e','r',0,'J','o','i','n','e','r',0, +2,'M','o','d','i','f','y','i','n','g','_','L','e','t','t','e','r',0,'M','o','d','i','f','y','i','n','g','_','L','e','t','t', +'e','r',0,2,'N','o','n','_','J','o','i','n','e','r',0,'N','o','n','_','J','o','i','n','e','r',0, +2,'N','u','k','t','a',0,'N','u','k','t','a',0,2,'N','u','m','b','e','r',0,'N','u','m','b','e','r',0, +2,'N','u','m','b','e','r','_','J','o','i','n','e','r',0,'N','u','m','b','e','r','_','J','o','i','n','e','r',0, +2,'P','u','r','e','_','K','i','l','l','e','r',0,'P','u','r','e','_','K','i','l','l','e','r',0, +2,'R','e','g','i','s','t','e','r','_','S','h','i','f','t','e','r',0,'R','e','g','i','s','t','e','r','_','S','h','i','f','t', +'e','r',0,2,'S','y','l','l','a','b','l','e','_','M','o','d','i','f','i','e','r',0,'S','y','l','l','a','b','l','e','_','M', +'o','d','i','f','i','e','r',0,2,'T','o','n','e','_','L','e','t','t','e','r',0,'T','o','n','e','_','L','e','t','t','e','r', +0,2,'T','o','n','e','_','M','a','r','k',0,'T','o','n','e','_','M','a','r','k',0, +2,'V','i','r','a','m','a',0,'V','i','r','a','m','a',0,2,'V','i','s','a','r','g','a',0, +'V','i','s','a','r','g','a',0,2,'V','o','w','e','l',0,'V','o','w','e','l',0, +2,'V','o','w','e','l','_','D','e','p','e','n','d','e','n','t',0,'V','o','w','e','l','_','D','e','p','e','n','d','e','n','t', +0,2,'V','o','w','e','l','_','I','n','d','e','p','e','n','d','e','n','t',0,'V','o','w','e','l','_','I','n','d','e','p','e', +'n','d','e','n','t',0,2,'v','o',0,'V','e','r','t','i','c','a','l','_','O','r','i','e','n','t','a','t','i','o','n',0, +2,'R',0,'R','o','t','a','t','e','d',0,2,'T','r',0,'T','r','a','n','s','f','o','r','m','e','d','_','R','o','t','a','t', +'e','d',0,2,'T','u',0,'T','r','a','n','s','f','o','r','m','e','d','_','U','p','r','i','g','h','t',0, +2,'U',0,'U','p','r','i','g','h','t',0,2,'g','c','m',0,'G','e','n','e','r','a','l','_','C','a','t','e','g','o','r','y', +'_','M','a','s','k',0,2,'C',0,'O','t','h','e','r',0,2,'L',0,'L','e','t','t','e','r',0, +2,'L','C',0,'C','a','s','e','d','_','L','e','t','t','e','r',0, +3,'M',0,'M','a','r','k',0,'C','o','m','b','i','n','i','n','g','_','M','a','r','k',0, +2,'N',0,'N','u','m','b','e','r',0,3,'P',0,'P','u','n','c','t','u','a','t','i','o','n',0, +'p','u','n','c','t',0,2,'S',0,'S','y','m','b','o','l',0, +2,'Z',0,'S','e','p','a','r','a','t','o','r',0,2,'n','v',0,'N','u','m','e','r','i','c','_','V','a','l','u','e',0, +2,'a','g','e',0,'A','g','e',0,2,'b','m','g',0,'B','i','d','i','_','M','i','r','r','o','r','i','n','g','_','G','l','y', +'p','h',0,2,'c','f',0,'C','a','s','e','_','F','o','l','d','i','n','g',0, +2,'i','s','c',0,'I','S','O','_','C','o','m','m','e','n','t',0, +2,'l','c',0,'L','o','w','e','r','c','a','s','e','_','M','a','p','p','i','n','g',0, +2,'n','a',0,'N','a','m','e',0,3,'s','c','f',0,'S','i','m','p','l','e','_','C','a','s','e','_','F','o','l','d','i','n', +'g',0,'s','f','c',0,2,'s','l','c',0,'S','i','m','p','l','e','_','L','o','w','e','r','c','a','s','e','_','M','a','p','p', +'i','n','g',0,2,'s','t','c',0,'S','i','m','p','l','e','_','T','i','t','l','e','c','a','s','e','_','M','a','p','p','i','n', +'g',0,2,'s','u','c',0,'S','i','m','p','l','e','_','U','p','p','e','r','c','a','s','e','_','M','a','p','p','i','n','g',0, +2,'t','c',0,'T','i','t','l','e','c','a','s','e','_','M','a','p','p','i','n','g',0, +2,'n','a','1',0,'U','n','i','c','o','d','e','_','1','_','N','a','m','e',0, +2,'u','c',0,'U','p','p','e','r','c','a','s','e','_','M','a','p','p','i','n','g',0, +2,'b','p','b',0,'B','i','d','i','_','P','a','i','r','e','d','_','B','r','a','c','k','e','t',0, +2,'s','c','x',0,'S','c','r','i','p','t','_','E','x','t','e','n','s','i','o','n','s',0 +}; + +U_NAMESPACE_END + +#endif // INCLUDED_FROM_PROPNAME_CPP diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/propsvec.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/propsvec.h new file mode 100644 index 0000000000000000000000000000000000000000..39080615ea38110f14aa03f81027592540111742 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/propsvec.h @@ -0,0 +1,178 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2010, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: propsvec.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002feb22 +* created by: Markus W. Scherer +* +* Store bits (Unicode character properties) in bit set vectors. +*/ + +#ifndef __UPROPSVEC_H__ +#define __UPROPSVEC_H__ + +#include "unicode/utypes.h" +#include "utrie.h" +#include "utrie2.h" + +U_CDECL_BEGIN + +/** + * Unicode Properties Vectors associated with code point ranges. + * + * Rows of uint32_t integers in a contiguous array store + * the range limits and the properties vectors. + * + * Logically, each row has a certain number of uint32_t values, + * which is set via the upvec_open() "columns" parameter. + * + * Internally, two additional columns are stored. + * In each internal row, + * row[0] contains the start code point and + * row[1] contains the limit code point, + * which is the start of the next range. + * + * Initially, there is only one "normal" row for + * range [0..0x110000[ with values 0. + * There are additional rows for special purposes, see UPVEC_FIRST_SPECIAL_CP. + * + * It would be possible to store only one range boundary per row, + * but self-contained rows allow to later sort them by contents. + */ +struct UPropsVectors; +typedef struct UPropsVectors UPropsVectors; + +/* + * Special pseudo code points for storing the initialValue and the errorValue, + * which are used to initialize a UTrie2 or similar. + */ +#define UPVEC_FIRST_SPECIAL_CP 0x110000 +#define UPVEC_INITIAL_VALUE_CP 0x110000 +#define UPVEC_ERROR_VALUE_CP 0x110001 +#define UPVEC_MAX_CP 0x110001 + +/* + * Special pseudo code point used in upvec_compact() signalling the end of + * delivering special values and the beginning of delivering real ones. + * Stable value, unlike UPVEC_MAX_CP which might grow over time. + */ +#define UPVEC_START_REAL_VALUES_CP 0x200000 + +/* + * Open a UPropsVectors object. + * @param columns Number of value integers (uint32_t) per row. + */ +U_CAPI UPropsVectors * U_EXPORT2 +upvec_open(int32_t columns, UErrorCode *pErrorCode); + +U_CAPI void U_EXPORT2 +upvec_close(UPropsVectors *pv); + +/* + * In rows for code points [start..end], select the column, + * reset the mask bits and set the value bits (ANDed with the mask). + * + * Will set U_NO_WRITE_PERMISSION if called after upvec_compact(). + */ +U_CAPI void U_EXPORT2 +upvec_setValue(UPropsVectors *pv, + UChar32 start, UChar32 end, + int32_t column, + uint32_t value, uint32_t mask, + UErrorCode *pErrorCode); + +/* + * Logically const but must not be used on the same pv concurrently! + * Always returns 0 if called after upvec_compact(). + */ +U_CAPI uint32_t U_EXPORT2 +upvec_getValue(const UPropsVectors *pv, UChar32 c, int32_t column); + +/* + * pRangeStart and pRangeEnd can be NULL. + * @return NULL if rowIndex out of range and for illegal arguments, + * or if called after upvec_compact() + */ +U_CAPI uint32_t * U_EXPORT2 +upvec_getRow(const UPropsVectors *pv, int32_t rowIndex, + UChar32 *pRangeStart, UChar32 *pRangeEnd); + +/* + * Compact the vectors: + * - modify the memory + * - keep only unique vectors + * - store them contiguously from the beginning of the memory + * - for each (non-unique) row, call the handler function + * + * The handler's rowIndex is the index of the row in the compacted + * memory block. + * (Therefore, it starts at 0 increases in increments of the columns value.) + * + * In a first phase, only special values are delivered (each exactly once), + * with start==end both equalling a special pseudo code point. + * Then the handler is called once more with start==end==UPVEC_START_REAL_VALUES_CP + * where rowIndex is the length of the compacted array, + * and the row is arbitrary (but not NULL). + * Then, in the second phase, the handler is called for each row of real values. + */ +typedef void U_CALLCONV +UPVecCompactHandler(void *context, + UChar32 start, UChar32 end, + int32_t rowIndex, uint32_t *row, int32_t columns, + UErrorCode *pErrorCode); + +U_CAPI void U_EXPORT2 +upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UErrorCode *pErrorCode); + +/* + * Get the vectors array after calling upvec_compact(). + * The caller must not modify nor release the returned array. + * Returns NULL if called before upvec_compact(). + */ +U_CAPI const uint32_t * U_EXPORT2 +upvec_getArray(const UPropsVectors *pv, int32_t *pRows, int32_t *pColumns); + +/* + * Get a clone of the vectors array after calling upvec_compact(). + * The caller owns the returned array and must uprv_free() it. + * Returns NULL if called before upvec_compact(). + */ +U_CAPI uint32_t * U_EXPORT2 +upvec_cloneArray(const UPropsVectors *pv, + int32_t *pRows, int32_t *pColumns, UErrorCode *pErrorCode); + +/* + * Call upvec_compact(), create a 16-bit UTrie2 with indexes into the compacted + * vectors array, and freeze the trie. + */ +U_CAPI UTrie2 * U_EXPORT2 +upvec_compactToUTrie2WithRowIndexes(UPropsVectors *pv, UErrorCode *pErrorCode); + +struct UPVecToUTrie2Context { + UTrie2 *trie; + int32_t initialValue; + int32_t errorValue; + int32_t maxValue; +}; +typedef struct UPVecToUTrie2Context UPVecToUTrie2Context; + +/* context=UPVecToUTrie2Context, creates the trie and stores the rowIndex values */ +U_CAPI void U_CALLCONV +upvec_compactToUTrie2Handler(void *context, + UChar32 start, UChar32 end, + int32_t rowIndex, uint32_t *row, int32_t columns, + UErrorCode *pErrorCode); + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/punycode.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/punycode.h new file mode 100644 index 0000000000000000000000000000000000000000..9e28f770c407ec5d349405b874588efb60d140c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/punycode.h @@ -0,0 +1,120 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2003, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: punycode.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002jan31 +* created by: Markus W. Scherer +*/ + +/* This ICU code derived from: */ +/* +punycode.c 0.4.0 (2001-Nov-17-Sat) +http://www.cs.berkeley.edu/~amc/idn/ +Adam M. Costello +http://www.nicemice.net/amc/ +*/ + +#ifndef __PUNYCODE_H__ +#define __PUNYCODE_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_IDNA + +/** + * u_strToPunycode() converts Unicode to Punycode. + * + * The input string must not contain single, unpaired surrogates. + * The output will be represented as an array of ASCII code points. + * + * The output string is NUL-terminated according to normal ICU + * string output rules. + * + * @param src Input Unicode string. + * This function handles a limited amount of code points + * (the limit is >=64). + * U_INDEX_OUTOFBOUNDS_ERROR is set if the limit is exceeded. + * @param srcLength Number of UChars in src, or -1 if NUL-terminated. + * @param dest Output Punycode array. + * @param destCapacity Size of dest. + * @param caseFlags Vector of boolean values, one per input UChar, + * indicating that the corresponding character is to be + * marked for the decoder optionally + * uppercasing (true) or lowercasing (false) + * the character. + * ASCII characters are output directly in the case as marked. + * Flags corresponding to trail surrogates are ignored. + * If caseFlags==NULL then input characters are not + * case-mapped. + * @param pErrorCode ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * @return Number of ASCII characters in puny. + * + * @see u_strFromPunycode + */ +U_CAPI int32_t +u_strToPunycode(const UChar *src, int32_t srcLength, + UChar *dest, int32_t destCapacity, + const UBool *caseFlags, + UErrorCode *pErrorCode); + +/** + * u_strFromPunycode() converts Punycode to Unicode. + * The Unicode string will be at most as long (in UChars) + * than the Punycode string (in chars). + * + * @param src Input Punycode string. + * @param srcLength Length of puny, or -1 if NUL-terminated + * @param dest Output Unicode string buffer. + * @param destCapacity Size of dest in number of UChars, + * and of caseFlags in numbers of UBools. + * @param caseFlags Output array for case flags as + * defined by the Punycode string. + * The caller should uppercase (true) or lowercase (FASLE) + * the corresponding character in dest. + * For supplementary characters, only the lead surrogate + * is marked, and false is stored for the trail surrogate. + * This is redundant and not necessary for ASCII characters + * because they are already in the case indicated. + * Can be NULL if the case flags are not needed. + * @param pErrorCode ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if a non-ASCII character + * precedes the last delimiter ('-'), + * or if an invalid character (not a-zA-Z0-9) is found + * after the last delimiter. + * U_ILLEGAL_CHAR_FOUND if the delta sequence is ill-formed. + * @return Number of UChars written to dest. + * + * @see u_strToPunycode + */ +U_CAPI int32_t +u_strFromPunycode(const UChar *src, int32_t srcLength, + UChar *dest, int32_t destCapacity, + UBool *caseFlags, + UErrorCode *pErrorCode); + +#endif /* #if !UCONFIG_NO_IDNA */ + +#endif + +/* + * Hey, Emacs, please set the following: + * + * Local Variables: + * indent-tabs-mode: nil + * End: + * + */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/putilimp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/putilimp.h new file mode 100644 index 0000000000000000000000000000000000000000..5b95a68418c4285c486f2381207e1d9bc25f5ec0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/putilimp.h @@ -0,0 +1,615 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : putilimp.h +* +* Date Name Description +* 10/17/04 grhoten Move internal functions from putil.h to this file. +****************************************************************************** +*/ + +#ifndef PUTILIMP_H +#define PUTILIMP_H + +#include "unicode/utypes.h" +#include "unicode/putil.h" + +/** + * \def U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC + * Nearly all CPUs and compilers implement a right-shift of a signed integer + * as an Arithmetic Shift Right which copies the sign bit (the Most Significant Bit (MSB)) + * into the vacated bits (sign extension). + * For example, (int32_t)0xfff5fff3>>4 becomes 0xffff5fff and -1>>1=-1. + * + * This can be useful for storing a signed value in the upper bits + * and another bit field in the lower bits. + * The signed value can be retrieved by simple right-shifting. + * + * This is consistent with the Java language. + * + * However, the C standard allows compilers to implement a right-shift of a signed integer + * as a Logical Shift Right which copies a 0 into the vacated bits. + * For example, (int32_t)0xfff5fff3>>4 becomes 0x0fff5fff and -1>>1=0x7fffffff. + * + * Code that depends on the natural behavior should be guarded with this macro, + * with an alternate path for unusual platforms. + * @internal + */ +#ifdef U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC + /* Use the predefined value. */ +#else + /* + * Nearly all CPUs & compilers implement a right-shift of a signed integer + * as an Arithmetic Shift Right (with sign extension). + */ +# define U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC 1 +#endif + +/** Define this to 1 if your platform supports IEEE 754 floating point, + to 0 if it does not. */ +#ifndef IEEE_754 +# define IEEE_754 1 +#endif + +/** + * uintptr_t is an optional part of the standard definitions in stdint.h. + * The opengroup.org documentation for stdint.h says + * "On XSI-conformant systems, the intptr_t and uintptr_t types are required; + * otherwise, they are optional." + * We assume that when uintptr_t is defined, UINTPTR_MAX is defined as well. + * + * Do not use ptrdiff_t since it is signed. size_t is unsigned. + */ +/* TODO: This check fails on some z environments. Filed a ticket #9357 for this. */ +#if !defined(__intptr_t_defined) && !defined(UINTPTR_MAX) && (U_PLATFORM != U_PF_OS390) +typedef size_t uintptr_t; +#endif + +/*===========================================================================*/ +/** @{ Information about POSIX support */ +/*===========================================================================*/ + +#ifdef U_HAVE_NL_LANGINFO_CODESET + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_ANDROID || U_PLATFORM == U_PF_QNX +# define U_HAVE_NL_LANGINFO_CODESET 0 +#else +# define U_HAVE_NL_LANGINFO_CODESET 1 +#endif + +#ifdef U_NL_LANGINFO_CODESET + /* Use the predefined value. */ +#elif !U_HAVE_NL_LANGINFO_CODESET +# define U_NL_LANGINFO_CODESET -1 +#elif U_PLATFORM == U_PF_OS400 + /* not defined */ +#else +# define U_NL_LANGINFO_CODESET CODESET +#endif + +#if defined(U_TZSET) || defined(U_HAVE_TZSET) + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API + // UWP doesn't support tzset or environment variables for tz +#if U_PLATFORM_HAS_WINUWP_API == 0 +# define U_TZSET _tzset +#endif +#elif U_PLATFORM == U_PF_OS400 + /* not defined */ +#else +# define U_TZSET tzset +#endif + +#if defined(U_TIMEZONE) || defined(U_HAVE_TIMEZONE) + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_ANDROID +# define U_TIMEZONE timezone +#elif defined(__UCLIBC__) + // uClibc does not have __timezone or _timezone. +#elif defined(_NEWLIB_VERSION) +# define U_TIMEZONE _timezone +#elif defined(__GLIBC__) + // glibc +# define U_TIMEZONE __timezone +#elif U_PLATFORM_IS_LINUX_BASED + // not defined +#elif U_PLATFORM_USES_ONLY_WIN32_API +# define U_TIMEZONE _timezone +#elif U_PLATFORM == U_PF_BSD && !defined(__NetBSD__) + /* not defined */ +#elif U_PLATFORM == U_PF_OS400 + /* not defined */ +#elif U_PLATFORM == U_PF_IPHONE + /* not defined */ +#else +# define U_TIMEZONE timezone +#endif + +#if defined(U_TZNAME) || defined(U_HAVE_TZNAME) + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API + /* not usable on all windows platforms */ +#if U_PLATFORM_HAS_WINUWP_API == 0 +# define U_TZNAME _tzname +#endif +#elif U_PLATFORM == U_PF_OS400 + /* not defined */ +#else +# define U_TZNAME tzname +#endif + +#ifdef U_HAVE_MMAP + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API +# define U_HAVE_MMAP 0 +#else +# define U_HAVE_MMAP 1 +#endif + +#ifdef U_HAVE_POPEN + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API +# define U_HAVE_POPEN 0 +#elif U_PLATFORM == U_PF_OS400 +# define U_HAVE_POPEN 0 +#else +# define U_HAVE_POPEN 1 +#endif + +/** + * \def U_HAVE_DIRENT_H + * Defines whether dirent.h is available. + * @internal + */ +#ifdef U_HAVE_DIRENT_H + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API +# define U_HAVE_DIRENT_H 0 +#else +# define U_HAVE_DIRENT_H 1 +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Programs used by ICU code */ +/*===========================================================================*/ + +/** + * \def U_MAKE_IS_NMAKE + * Defines whether the "make" program is Windows nmake. + */ +#ifdef U_MAKE_IS_NMAKE + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_WINDOWS +# define U_MAKE_IS_NMAKE 1 +#else +# define U_MAKE_IS_NMAKE 0 +#endif + +/** @} */ + +/*==========================================================================*/ +/* Platform utilities */ +/*==========================================================================*/ + +/** + * Platform utilities isolates the platform dependencies of the + * library. For each platform which this code is ported to, these + * functions may have to be re-implemented. + */ + +/** + * Floating point utility to determine if a double is Not a Number (NaN). + * @internal + */ +U_CAPI UBool U_EXPORT2 uprv_isNaN(double d); +/** + * Floating point utility to determine if a double has an infinite value. + * @internal + */ +U_CAPI UBool U_EXPORT2 uprv_isInfinite(double d); +/** + * Floating point utility to determine if a double has a positive infinite value. + * @internal + */ +U_CAPI UBool U_EXPORT2 uprv_isPositiveInfinity(double d); +/** + * Floating point utility to determine if a double has a negative infinite value. + * @internal + */ +U_CAPI UBool U_EXPORT2 uprv_isNegativeInfinity(double d); +/** + * Floating point utility that returns a Not a Number (NaN) value. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_getNaN(void); +/** + * Floating point utility that returns an infinite value. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_getInfinity(void); + +/** + * Floating point utility to truncate a double. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_trunc(double d); +/** + * Floating point utility to calculate the floor of a double. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_floor(double d); +/** + * Floating point utility to calculate the ceiling of a double. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_ceil(double d); +/** + * Floating point utility to calculate the absolute value of a double. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_fabs(double d); +/** + * Floating point utility to calculate the fractional and integer parts of a double. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_modf(double d, double* pinteger); +/** + * Floating point utility to calculate the remainder of a double divided by another double. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_fmod(double d, double y); +/** + * Floating point utility to calculate d to the power of exponent (d^exponent). + * @internal + */ +U_CAPI double U_EXPORT2 uprv_pow(double d, double exponent); +/** + * Floating point utility to calculate 10 to the power of exponent (10^exponent). + * @internal + */ +U_CAPI double U_EXPORT2 uprv_pow10(int32_t exponent); +/** + * Floating point utility to calculate the maximum value of two doubles. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_fmax(double d, double y); +/** + * Floating point utility to calculate the minimum value of two doubles. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_fmin(double d, double y); +/** + * Private utility to calculate the maximum value of two integers. + * @internal + */ +U_CAPI int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y); +/** + * Private utility to calculate the minimum value of two integers. + * @internal + */ +U_CAPI int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y); + +#if U_IS_BIG_ENDIAN +# define uprv_isNegative(number) (*((signed char *)&(number))<0) +#else +# define uprv_isNegative(number) (*((signed char *)&(number)+sizeof(number)-1)<0) +#endif + +/** + * Return the largest positive number that can be represented by an integer + * type of arbitrary bit length. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_maxMantissa(void); + +/** + * Floating point utility to calculate the logarithm of a double. + * @internal + */ +U_CAPI double U_EXPORT2 uprv_log(double d); + +/** + * Does common notion of rounding e.g. uprv_floor(x + 0.5); + * @param x the double number + * @return the rounded double + * @internal + */ +U_CAPI double U_EXPORT2 uprv_round(double x); + +/** + * Adds the signed integers a and b, storing the result in res. + * Checks for signed integer overflow. + * Similar to the GCC/Clang extension __builtin_add_overflow + * + * @param a The first operand. + * @param b The second operand. + * @param res a + b + * @return true if overflow occurred; false if no overflow occurred. + * @internal + */ +U_CAPI UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res); + +/** + * Multiplies the signed integers a and b, storing the result in res. + * Checks for signed integer overflow. + * Similar to the GCC/Clang extension __builtin_mul_overflow + * + * @param a The first multiplicand. + * @param b The second multiplicand. + * @param res a * b + * @return true if overflow occurred; false if no overflow occurred. + * @internal + */ +U_CAPI UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res); + +#if 0 +/** + * Returns the number of digits after the decimal point in a double number x. + * + * @param x the double number + * @return the number of digits after the decimal point in a double number x. + * @internal + */ +/*U_CAPI int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/ +#endif + +#if !U_CHARSET_IS_UTF8 +/** + * Please use ucnv_getDefaultName() instead. + * Return the default codepage for this platform and locale. + * This function can call setlocale() on Unix platforms. Please read the + * platform documentation on setlocale() before calling this function. + * @return the default codepage for this platform + * @internal + */ +U_CAPI const char* U_EXPORT2 uprv_getDefaultCodepage(void); +#endif + +/** + * Please use uloc_getDefault() instead. + * Return the default locale ID string by querying the system, or + * zero if one cannot be found. + * This function can call setlocale() on Unix platforms. Please read the + * platform documentation on setlocale() before calling this function. + * @return the default locale ID string + * @internal + */ +U_CAPI const char* U_EXPORT2 uprv_getDefaultLocaleID(void); + +/** + * Time zone utilities + * + * Wrappers for C runtime library functions relating to timezones. + * The t_tzset() function (similar to tzset) uses the current setting + * of the environment variable TZ to assign values to three global + * variables: daylight, timezone, and tzname. These variables have the + * following meanings, and are declared in <time.h>. + * + * daylight Nonzero if daylight-saving-time zone (DST) is specified + * in TZ; otherwise, 0. Default value is 1. + * timezone Difference in seconds between coordinated universal + * time and local time. E.g., -28,800 for PST (GMT-8hrs) + * tzname(0) Three-letter time-zone name derived from TZ environment + * variable. E.g., "PST". + * tzname(1) Three-letter DST zone name derived from TZ environment + * variable. E.g., "PDT". If DST zone is omitted from TZ, + * tzname(1) is an empty string. + * + * Notes: For example, to set the TZ environment variable to correspond + * to the current time zone in Germany, you can use one of the + * following statements: + * + * set TZ=GST1GDT + * set TZ=GST+1GDT + * + * If the TZ value is not set, t_tzset() attempts to use the time zone + * information specified by the operating system. Under Windows NT + * and Windows 95, this information is specified in the Control Panel's + * Date/Time application. + * @internal + */ +U_CAPI void U_EXPORT2 uprv_tzset(void); + +/** + * Difference in seconds between coordinated universal + * time and local time. E.g., -28,800 for PST (GMT-8hrs) + * @return the difference in seconds between coordinated universal time and local time. + * @internal + */ +U_CAPI int32_t U_EXPORT2 uprv_timezone(void); + +/** + * tzname(0) Three-letter time-zone name derived from TZ environment + * variable. E.g., "PST". + * tzname(1) Three-letter DST zone name derived from TZ environment + * variable. E.g., "PDT". If DST zone is omitted from TZ, + * tzname(1) is an empty string. + * @internal + */ +U_CAPI const char* U_EXPORT2 uprv_tzname(int n); + +/** + * Reset the global tzname cache. + * @internal + */ +U_CAPI void uprv_tzname_clear_cache(void); + +/** + * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. + * This function is affected by 'faketime' and should be the bottleneck for all user-visible ICU time functions. + * @return the UTC time measured in milliseconds + * @internal + */ +U_CAPI UDate U_EXPORT2 uprv_getUTCtime(void); + +/** + * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. + * This function is not affected by 'faketime', so it should only be used by low level test functions- not by anything that + * exposes time to the end user. + * @return the UTC time measured in milliseconds + * @internal + */ +U_CAPI UDate U_EXPORT2 uprv_getRawUTCtime(void); + +/** + * Determine whether a pathname is absolute or not, as defined by the platform. + * @param path Pathname to test + * @return true if the path is absolute + * @internal (ICU 3.0) + */ +U_CAPI UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path); + +/** + * Use U_MAX_PTR instead of this function. + * @param void pointer to test + * @return the largest possible pointer greater than the base + * @internal (ICU 3.8) + */ +U_CAPI void * U_EXPORT2 uprv_maximumPtr(void *base); + +/** + * Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer. + * In fact, buffer sizes must not exceed 2GB so that the difference between + * the buffer limit and the buffer start can be expressed in an int32_t. + * + * The definition of U_MAX_PTR must fulfill the following conditions: + * - return the largest possible pointer greater than base + * - return a valid pointer according to the machine architecture (AS/400, 64-bit, etc.) + * - avoid wrapping around at high addresses + * - make sure that the returned pointer is not farther from base than 0x7fffffff bytes + * + * @param base The beginning of a buffer to find the maximum offset from + * @internal + */ +#ifndef U_MAX_PTR +# if U_PLATFORM == U_PF_OS390 && !defined(_LP64) + /* We have 31-bit pointers. */ +# define U_MAX_PTR(base) ((void *)0x7fffffff) +# elif U_PLATFORM == U_PF_OS400 +# define U_MAX_PTR(base) uprv_maximumPtr((void *)base) +# elif 0 + /* + * For platforms where pointers are scalar values (which is normal, but unlike i5/OS) + * but that do not define uintptr_t. + * + * However, this does not work on modern compilers: + * The C++ standard does not define pointer overflow, and allows compilers to + * assume that p+u>p for any pointer p and any integer u>0. + * Thus, modern compilers optimize away the ">" comparison. + * (See ICU tickets #7187 and #8096.) + */ +# define U_MAX_PTR(base) \ + ((void *)(((char *)(base)+0x7fffffffu) > (char *)(base) \ + ? ((char *)(base)+0x7fffffffu) \ + : (char *)-1)) +# else + /* Default version. C++ standard compliant for scalar pointers. */ +# define U_MAX_PTR(base) \ + ((void *)(((uintptr_t)(base)+0x7fffffffu) > (uintptr_t)(base) \ + ? ((uintptr_t)(base)+0x7fffffffu) \ + : (uintptr_t)-1)) +# endif +#endif + + +#ifdef __cplusplus +/** + * Pin a buffer capacity such that doing pointer arithmetic + * on the destination pointer and capacity cannot overflow. + * + * The pinned capacity must fulfill the following conditions (for positive capacities): + * - dest + capacity is a valid pointer according to the machine architecture (AS/400, 64-bit, etc.) + * - (dest + capacity) >= dest + * - The size (in bytes) of T[capacity] does not exceed 0x7fffffff + * + * @param dest the destination buffer pointer. + * @param capacity the requested buffer capacity, in units of type T. + * @return the pinned capacity. + * @internal + */ +template +inline int32_t pinCapacity(T *dest, int32_t capacity) { + if (capacity <= 0) { return capacity; } + + uintptr_t destInt = (uintptr_t)dest; + uintptr_t maxInt; + +# if U_PLATFORM == U_PF_OS390 && !defined(_LP64) + // We have 31-bit pointers. + maxInt = 0x7fffffff; +# elif U_PLATFORM == U_PF_OS400 + maxInt = (uintptr_t)uprv_maximumPtr((void *)dest); +# else + maxInt = destInt + 0x7fffffffu; + if (maxInt < destInt) { + // Less than 2GB to the end of the address space. + // Pin to that to prevent address overflow. + maxInt = (uintptr_t)-1; + } +# endif + + uintptr_t maxBytes = maxInt - destInt; // max. 2GB + int32_t maxCapacity = (int32_t)(maxBytes / sizeof(T)); + return capacity <= maxCapacity ? capacity : maxCapacity; +} +#endif // __cplusplus + +/* Dynamic Library Functions */ + +typedef void (UVoidFunction)(void); + +#if U_ENABLE_DYLOAD +/** + * Load a library + * @internal (ICU 4.4) + */ +U_CAPI void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status); + +/** + * Close a library + * @internal (ICU 4.4) + */ +U_CAPI void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status); + +/** + * Extract a symbol from a library (function) + * @internal (ICU 4.8) + */ +U_CAPI UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symbolName, UErrorCode *status); + +/** + * Extract a symbol from a library (function) + * Not implemented, no clients. + * @internal + */ +/* U_CAPI void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */ + +#endif + +/** + * Define malloc and related functions + * @internal + */ +#if U_PLATFORM == U_PF_OS400 +# define uprv_default_malloc(x) _C_TS_malloc(x) +# define uprv_default_realloc(x,y) _C_TS_realloc(x,y) +# define uprv_default_free(x) _C_TS_free(x) +/* also _C_TS_calloc(x) */ +#else +/* C defaults */ +# define uprv_default_malloc(x) malloc(x) +# define uprv_default_realloc(x,y) realloc(x,y) +# define uprv_default_free(x) free(x) +#endif + + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbi_cache.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbi_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..597312e85c45368c43bcb56e261c1e2a7827e7e8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbi_cache.h @@ -0,0 +1,203 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// file: rbbi_cache.h +// +#ifndef RBBI_CACHE_H +#define RBBI_CACHE_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/rbbi.h" +#include "unicode/uobject.h" + +#include "uvectr32.h" + +U_NAMESPACE_BEGIN + +/* DictionaryCache stores the boundaries obtained from a run of dictionary characters. + * Dictionary boundaries are moved first to this cache, then from here + * to the main BreakCache, where they may inter-leave with non-dictionary + * boundaries. The public BreakIterator API always fetches directly + * from the main BreakCache, not from here. + * + * In common situations, the number of boundaries in a single dictionary run + * should be quite small, it will be terminated by punctuation, spaces, + * or any other non-dictionary characters. The main BreakCache may end + * up with boundaries from multiple dictionary based runs. + * + * The boundaries are stored in a simple ArrayList (vector), with the + * assumption that they will be accessed sequentially. + */ +class RuleBasedBreakIterator::DictionaryCache: public UMemory { + public: + DictionaryCache(RuleBasedBreakIterator *bi, UErrorCode &status); + ~DictionaryCache(); + + void reset(); + + UBool following(int32_t fromPos, int32_t *pos, int32_t *statusIndex); + UBool preceding(int32_t fromPos, int32_t *pos, int32_t *statusIndex); + + /** + * Populate the cache with the dictionary based boundaries within a region of text. + * @param startPos The start position of a range of text + * @param endPos The end position of a range of text + * @param firstRuleStatus The rule status index that applies to the break at startPos + * @param otherRuleStatus The rule status index that applies to boundaries other than startPos + * @internal + */ + void populateDictionary(int32_t startPos, int32_t endPos, + int32_t firstRuleStatus, int32_t otherRuleStatus); + + + + RuleBasedBreakIterator *fBI; + + UVector32 fBreaks; // A vector containing the boundaries. + int32_t fPositionInCache; // Index in fBreaks of last boundary returned by following() + // or preceding(). Optimizes sequential access. + int32_t fStart; // Text position of first boundary in cache. + int32_t fLimit; // Last boundary in cache. Which is the limit of the + // text segment being handled by the dictionary. + int32_t fFirstRuleStatusIndex; // Rule status info for first boundary. + int32_t fOtherRuleStatusIndex; // Rule status info for 2nd through last boundaries. +}; + + +/* + * class BreakCache + * + * Cache of break boundary positions and rule status values. + * Break iterator API functions, next(), previous(), etc., will use cached results + * when possible, and otherwise cache new results as they are obtained. + * + * Uniformly caches both dictionary and rule based (non-dictionary) boundaries. + * + * The cache is implemented as a single circular buffer. + */ + +/* + * size of the circular cache buffer. + */ + +class RuleBasedBreakIterator::BreakCache: public UMemory { + public: + BreakCache(RuleBasedBreakIterator *bi, UErrorCode &status); + virtual ~BreakCache(); + void reset(int32_t pos = 0, int32_t ruleStatus = 0); + void next() { if (fBufIdx == fEndBufIdx) { + nextOL(); + } else { + fBufIdx = modChunkSize(fBufIdx + 1); + fTextIdx = fBI->fPosition = fBoundaries[fBufIdx]; + fBI->fRuleStatusIndex = fStatuses[fBufIdx]; + } + } + + + void nextOL(); + void previous(UErrorCode &status); + + // Move the iteration state to the position following the startPosition. + // Input position must be pinned to the input length. + void following(int32_t startPosition, UErrorCode &status); + + void preceding(int32_t startPosition, UErrorCode &status); + + /* + * Update the state of the public BreakIterator (fBI) to reflect the + * current state of the break iterator cache (this). + */ + int32_t current(); + + /** + * Add boundaries to the cache near the specified position. + * The given position need not be a boundary itself. + * The input position must be within the range of the text, and + * on a code point boundary. + * If the requested position is a break boundary, leave the iteration + * position on it. + * If the requested position is not a boundary, leave the iteration + * position on the preceding boundary and include both the + * preceding and following boundaries in the cache. + * Additional boundaries, either preceding or following, may be added + * to the cache as a side effect. + * + * Return false if the operation failed. + */ + UBool populateNear(int32_t position, UErrorCode &status); + + /** + * Add boundary(s) to the cache following the current last boundary. + * Return false if at the end of the text, and no more boundaries can be added. + * Leave iteration position at the first newly added boundary, or unchanged if no boundary was added. + */ + UBool populateFollowing(); + + /** + * Add one or more boundaries to the cache preceding the first currently cached boundary. + * Leave the iteration position on the first added boundary. + * Return false if no boundaries could be added (if at the start of the text.) + */ + UBool populatePreceding(UErrorCode &status); + + enum UpdatePositionValues { + RetainCachePosition = 0, + UpdateCachePosition = 1 + }; + + /* + * Add the boundary following the current position. + * The current position can be left as it was, or changed to the newly added boundary, + * as specified by the update parameter. + */ + void addFollowing(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update); + + + /* + * Add the boundary preceding the current position. + * The current position can be left as it was, or changed to the newly added boundary, + * as specified by the update parameter. + */ + bool addPreceding(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update); + + /** + * Set the cache position to the specified position, or, if the position + * falls between to cached boundaries, to the preceding boundary. + * Fails if the requested position is outside of the range of boundaries currently held by the cache. + * The startPosition must be on a code point boundary. + * + * Return true if successful, false if the specified position is after + * the last cached boundary or before the first. + */ + UBool seek(int32_t startPosition); + + void dumpCache(); + + private: + static inline int32_t modChunkSize(int index) { return index & (CACHE_SIZE - 1); } + + static constexpr int32_t CACHE_SIZE = 128; + static_assert((CACHE_SIZE & (CACHE_SIZE-1)) == 0, "CACHE_SIZE must be power of two."); + + RuleBasedBreakIterator *fBI; + int32_t fStartBufIdx; + int32_t fEndBufIdx; // inclusive + + int32_t fTextIdx; + int32_t fBufIdx; + + int32_t fBoundaries[CACHE_SIZE]; + uint16_t fStatuses[CACHE_SIZE]; + + UVector32 fSideBuffer; +}; + +U_NAMESPACE_END + +#endif // #if !UCONFIG_NO_BREAK_ITERATION + +#endif // RBBI_CACHE_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbidata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbidata.h new file mode 100644 index 0000000000000000000000000000000000000000..3749f16799e6c5b784f61fdce196d4b71477b643 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbidata.h @@ -0,0 +1,212 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 1999-2014 International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: rbbidata.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* RBBI data formats Includes +* +* Structs that describes the format of the Binary RBBI data, +* as it is stored in ICU's data file. +* +* RBBIDataWrapper - Instances of this class sit between the +* raw data structs and the RulesBasedBreakIterator objects +* that are created by applications. The wrapper class +* provides reference counting for the underlying data, +* and direct pointers to data that would not otherwise +* be accessible without ugly pointer arithmetic. The +* wrapper does not attempt to provide any higher level +* abstractions for the data itself. +* +* There will be only one instance of RBBIDataWrapper for any +* set of RBBI run time data being shared by instances +* (clones) of RulesBasedBreakIterator. +*/ + +#ifndef __RBBIDATA_H__ +#define __RBBIDATA_H__ + +#include "unicode/utypes.h" +#include "unicode/udata.h" +#include "udataswp.h" + +/** + * Swap RBBI data. See udataswp.h. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ubrk_swap(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +#ifdef __cplusplus + +#include "unicode/ucptrie.h" +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/uversion.h" +#include "umutex.h" + + +U_NAMESPACE_BEGIN + +// The current RBBI data format version. +static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {6, 0, 0, 0}; + +/* + * The following structs map exactly onto the raw data from ICU common data file. + */ +struct RBBIDataHeader { + uint32_t fMagic; /* == 0xbla0 */ + UVersionInfo fFormatVersion; /* Data Format. Same as the value in struct UDataInfo */ + /* if there is one associated with this data. */ + /* (version originates in rbbi, is copied to UDataInfo) */ + uint32_t fLength; /* Total length in bytes of this RBBI Data, */ + /* including all sections, not just the header. */ + uint32_t fCatCount; /* Number of character categories. */ + + /* */ + /* Offsets and sizes of each of the subsections within the RBBI data. */ + /* All offsets are bytes from the start of the RBBIDataHeader. */ + /* All sizes are in bytes. */ + /* */ + uint32_t fFTable; /* forward state transition table. */ + uint32_t fFTableLen; + uint32_t fRTable; /* Offset to the reverse state transition table. */ + uint32_t fRTableLen; + uint32_t fTrie; /* Offset to Trie data for character categories */ + uint32_t fTrieLen; + uint32_t fRuleSource; /* Offset to the source for for the break */ + uint32_t fRuleSourceLen; /* rules. Stored UChar *. */ + uint32_t fStatusTable; /* Offset to the table of rule status values */ + uint32_t fStatusTableLen; + + uint32_t fReserved[6]; /* Reserved for expansion */ + +}; + + + +template +struct RBBIStateTableRowT { + T fAccepting; // Non-zero if this row is for an accepting state. + // Value 0: not an accepting state. + // 1: (ACCEPTING_UNCONDITIONAL) Unconditional Accepting state. + // >1: Look-ahead match has completed. + // Actual boundary position happened earlier. + // Value here == fLookAhead in earlier + // state, at actual boundary pos. + T fLookAhead; // Non-zero if this row is for a state that + // corresponds to a '/' in the rule source. + // Value is the same as the fAccepting + // value for the rule (which will appear + // in a different state. + T fTagsIdx; // Non-zero if this row covers a {tagged} position + // from a rule. Value is the index in the + // StatusTable of the set of matching + // tags (rule status values) + T fNextState[1]; // Next State, indexed by char category. + // Variable-length array declared with length 1 + // to disable bounds checkers. + // Array Size is actually fData->fHeader->fCatCount + // CAUTION: see RBBITableBuilder::getTableSize() + // before changing anything here. +}; + +typedef RBBIStateTableRowT RBBIStateTableRow8; +typedef RBBIStateTableRowT RBBIStateTableRow16; + +constexpr uint16_t ACCEPTING_UNCONDITIONAL = 1; // Value constant for RBBIStateTableRow::fAccepting + +union RBBIStateTableRow { + RBBIStateTableRow16 r16; + RBBIStateTableRow8 r8; +}; + +struct RBBIStateTable { + uint32_t fNumStates; // Number of states. + uint32_t fRowLen; // Length of a state table row, in bytes. + uint32_t fDictCategoriesStart; // Char category number of the first dictionary + // char class, or the the largest category number + 1 + // if there are no dictionary categories. + uint32_t fLookAheadResultsSize; // Size of run-time array required for holding + // look-ahead results. Indexed by row.fLookAhead. + uint32_t fFlags; // Option Flags for this state table. + char fTableData[1]; // First RBBIStateTableRow begins here. + // Variable-length array declared with length 1 + // to disable bounds checkers. + // (making it char[] simplifies ugly address + // arithmetic for indexing variable length rows.) +}; + +constexpr uint32_t RBBI_LOOKAHEAD_HARD_BREAK = 1; +constexpr uint32_t RBBI_BOF_REQUIRED = 2; +constexpr uint32_t RBBI_8BITS_ROWS = 4; + + +/* */ +/* The reference counting wrapper class */ +/* */ +class RBBIDataWrapper : public UMemory { +public: + enum EDontAdopt { + kDontAdopt + }; + RBBIDataWrapper(const RBBIDataHeader *data, UErrorCode &status); + RBBIDataWrapper(const RBBIDataHeader *data, enum EDontAdopt dontAdopt, UErrorCode &status); + RBBIDataWrapper(UDataMemory* udm, UErrorCode &status); + ~RBBIDataWrapper(); + + static UBool isDataVersionAcceptable(const UVersionInfo version); + + void init0(); + void init(const RBBIDataHeader *data, UErrorCode &status); + RBBIDataWrapper *addReference(); + void removeReference(); + UBool operator ==(const RBBIDataWrapper &other) const; + int32_t hashCode(); + const UnicodeString &getRuleSourceString() const; + void printData(); + void printTable(const char *heading, const RBBIStateTable *table); + + /* */ + /* Pointers to items within the data */ + /* */ + const RBBIDataHeader *fHeader; + const RBBIStateTable *fForwardTable; + const RBBIStateTable *fReverseTable; + const char *fRuleSource; + const int32_t *fRuleStatusTable; + + /* number of int32_t values in the rule status table. Used to sanity check indexing */ + int32_t fStatusMaxIdx; + + UCPTrie *fTrie; + +private: + u_atomic_int32_t fRefCount; + UDataMemory *fUDataMem; + UnicodeString fRuleString; + UBool fDontFreeData; + + RBBIDataWrapper(const RBBIDataWrapper &other) = delete; /* forbid copying of this class */ + RBBIDataWrapper &operator=(const RBBIDataWrapper &other) = delete; /* forbid copying of this class */ +}; + + + +U_NAMESPACE_END + +U_CFUNC UBool rbbi_cleanup(void); + +#endif /* C++ */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbinode.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbinode.h new file mode 100644 index 0000000000000000000000000000000000000000..cff3ba70c427695f1b7f46853c91b96a1b23d8c7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbinode.h @@ -0,0 +1,127 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/******************************************************************** + * COPYRIGHT: + * Copyright (c) 2001-2016, International Business Machines Corporation and + * others. All Rights Reserved. + ********************************************************************/ + +#ifndef RBBINODE_H +#define RBBINODE_H + +#include "unicode/utypes.h" +#include "unicode/unistr.h" +#include "unicode/uobject.h" + +// +// class RBBINode +// +// Represents a node in the parse tree generated when reading +// a rule file. +// + +U_NAMESPACE_BEGIN + +class UnicodeSet; +class UVector; + +class RBBINode : public UMemory { + public: + enum NodeType { + setRef, + uset, + varRef, + leafChar, + lookAhead, + tag, + endMark, + opStart, + opCat, + opOr, + opStar, + opPlus, + opQuestion, + opBreak, + opReverse, + opLParen + }; + + enum OpPrecedence { + precZero, + precStart, + precLParen, + precOpOr, + precOpCat + }; + + NodeType fType; + RBBINode *fParent; + RBBINode *fLeftChild; + RBBINode *fRightChild; + UnicodeSet *fInputSet; // For uset nodes only. + OpPrecedence fPrecedence; // For binary ops only. + + UnicodeString fText; // Text corresponding to this node. + // May be lazily evaluated when (if) needed + // for some node types. + int fFirstPos; // Position in the rule source string of the + // first text associated with the node. + // If there's a left child, this will be the same + // as that child's left pos. + int fLastPos; // Last position in the rule source string + // of any text associated with this node. + // If there's a right child, this will be the same + // as that child's last postion. + + UBool fNullable; // See Aho. + int32_t fVal; // For leafChar nodes, the value. + // Values are the character category, + // corresponds to columns in the final + // state transition table. + + UBool fLookAheadEnd; // For endMark nodes, set true if + // marking the end of a look-ahead rule. + + UBool fRuleRoot; // True if this node is the root of a rule. + UBool fChainIn; // True if chaining into this rule is allowed + // (no '^' present). + + UVector *fFirstPosSet; + UVector *fLastPosSet; // TODO: rename fFirstPos & fLastPos to avoid confusion. + UVector *fFollowPos; + + + RBBINode(NodeType t); + RBBINode(const RBBINode &other); + ~RBBINode(); + + RBBINode *cloneTree(); + RBBINode *flattenVariables(); + void flattenSets(); + void findNodes(UVector *dest, RBBINode::NodeType kind, UErrorCode &status); + +#ifdef RBBI_DEBUG + static void printNodeHeader(); + static void printNode(const RBBINode *n); + static void printTree(const RBBINode *n, UBool withHeading); +#endif + + private: + RBBINode &operator = (const RBBINode &other); // No defs. + UBool operator == (const RBBINode &other); // Private, so these functions won't accidently be used. + +#ifdef RBBI_DEBUG + public: + int fSerialNum; // Debugging aids. +#endif +}; + +#ifdef RBBI_DEBUG +U_CFUNC void +RBBI_DEBUG_printUnicodeString(const UnicodeString &s, int minWidth=0); +#endif + +U_NAMESPACE_END + +#endif + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbirb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbirb.h new file mode 100644 index 0000000000000000000000000000000000000000..037c1dc2ce8ff798ead8a3e4fe44b958f7a8b69c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbirb.h @@ -0,0 +1,237 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// rbbirb.h +// +// Copyright (C) 2002-2008, International Business Machines Corporation and others. +// All Rights Reserved. +// +// This file contains declarations for several classes from the +// Rule Based Break Iterator rule builder. +// + + +#ifndef RBBIRB_H +#define RBBIRB_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +#include + +#include "unicode/uobject.h" +#include "unicode/rbbi.h" +#include "unicode/uniset.h" +#include "unicode/parseerr.h" +#include "uhash.h" +#include "uvector.h" +#include "unicode/symtable.h"// For UnicodeSet parsing, is the interface that + // looks up references to $variables within a set. + + +U_NAMESPACE_BEGIN + +class RBBIRuleScanner; +struct RBBIRuleTableEl; +class RBBISetBuilder; +class RBBINode; +class RBBITableBuilder; + + + +//-------------------------------------------------------------------------------- +// +// RBBISymbolTable. Implements SymbolTable interface that is used by the +// UnicodeSet parser to resolve references to $variables. +// +//-------------------------------------------------------------------------------- +class RBBISymbolTableEntry : public UMemory { // The symbol table hash table contains one +public: // of these structs for each entry. + RBBISymbolTableEntry(); + UnicodeString key; + RBBINode *val; + ~RBBISymbolTableEntry(); + +private: + RBBISymbolTableEntry(const RBBISymbolTableEntry &other); // forbid copying of this class + RBBISymbolTableEntry &operator=(const RBBISymbolTableEntry &other); // forbid copying of this class +}; + + +class RBBISymbolTable : public UMemory, public SymbolTable { +private: + const UnicodeString &fRules; + UHashtable *fHashTable; + RBBIRuleScanner *fRuleScanner; + + // These next two fields are part of the mechanism for passing references to + // already-constructed UnicodeSets back to the UnicodeSet constructor + // when the pattern includes $variable references. + const UnicodeString ffffString; // = "/uffff" + UnicodeSet *fCachedSetLookup; + +public: + // API inherited from class SymbolTable + virtual const UnicodeString* lookup(const UnicodeString& s) const; + virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const; + virtual UnicodeString parseReference(const UnicodeString& text, + ParsePosition& pos, int32_t limit) const; + + // Additional Functions + RBBISymbolTable(RBBIRuleScanner *, const UnicodeString &fRules, UErrorCode &status); + virtual ~RBBISymbolTable(); + + virtual RBBINode *lookupNode(const UnicodeString &key) const; + virtual void addEntry (const UnicodeString &key, RBBINode *val, UErrorCode &err); + +#ifdef RBBI_DEBUG + virtual void rbbiSymtablePrint() const; +#else + // A do-nothing inline function for non-debug builds. Member funcs can't be empty + // or the call sites won't compile. + int32_t fFakeField; + #define rbbiSymtablePrint() fFakeField=0; +#endif + +private: + RBBISymbolTable(const RBBISymbolTable &other); // forbid copying of this class + RBBISymbolTable &operator=(const RBBISymbolTable &other); // forbid copying of this class +}; + + +//-------------------------------------------------------------------------------- +// +// class RBBIRuleBuilder The top-level class handling RBBI rule compiling. +// +//-------------------------------------------------------------------------------- +class RBBIRuleBuilder : public UMemory { +public: + + // Create a rule based break iterator from a set of rules. + // This function is the main entry point into the rule builder. The + // public ICU API for creating RBBIs uses this function to do the actual work. + // + static BreakIterator * createRuleBasedBreakIterator( const UnicodeString &rules, + UParseError *parseError, + UErrorCode &status); + +public: + // The "public" functions and data members that appear below are accessed + // (and shared) by the various parts that make up the rule builder. They + // are NOT intended to be accessed by anything outside of the + // rule builder implementation. + RBBIRuleBuilder(const UnicodeString &rules, + UParseError *parseErr, + UErrorCode &status + ); + + virtual ~RBBIRuleBuilder(); + + /** + * Build the state tables and char class Trie from the source rules. + */ + RBBIDataHeader *build(UErrorCode &status); + + + /** + * Fold together redundant character classes (table columns) and + * redundant states (table rows). Done after initial table generation, + * before serializing the result. + */ + void optimizeTables(); + + char *fDebugEnv; // controls debug trace output + UErrorCode *fStatus; // Error reporting. Keeping status + UParseError *fParseError; // here avoids passing it everywhere. + const UnicodeString &fRules; // The rule string that we are compiling + UnicodeString fStrippedRules; // The rule string, with comments stripped. + + RBBIRuleScanner *fScanner; // The scanner. + RBBINode *fForwardTree; // The parse trees, generated by the scanner, + RBBINode *fReverseTree; // then manipulated by subsequent steps. + RBBINode *fSafeFwdTree; + RBBINode *fSafeRevTree; + + RBBINode **fDefaultTree; // For rules not qualified with a ! + // the tree to which they belong to. + + UBool fChainRules; // True for chained Unicode TR style rules. + // False for traditional regexp rules. + + UBool fLBCMNoChain; // True: suppress chaining of rules on + // chars with LineBreak property == CM. + + UBool fLookAheadHardBreak; // True: Look ahead matches cause an + // immediate break, no continuing for the + // longest match. + + RBBISetBuilder *fSetBuilder; // Set and Character Category builder. + UVector *fUSetNodes; // Vector of all uset nodes. + + RBBITableBuilder *fForwardTable; // State transition table, build time form. + + UVector *fRuleStatusVals; // The values that can be returned + // from getRuleStatus(). + + RBBIDataHeader *flattenData(); // Create the flattened (runtime format) + // data tables.. +private: + RBBIRuleBuilder(const RBBIRuleBuilder &other); // forbid copying of this class + RBBIRuleBuilder &operator=(const RBBIRuleBuilder &other); // forbid copying of this class +}; + + + + +//---------------------------------------------------------------------------- +// +// RBBISetTableEl is an entry in the hash table of UnicodeSets that have +// been encountered. The val Node will be of nodetype uset +// and contain pointers to the actual UnicodeSets. +// The Key is the source string for initializing the set. +// +// The hash table is used to avoid creating duplicate +// unnamed (not $var references) UnicodeSets. +// +// Memory Management: +// The Hash Table owns these RBBISetTableEl structs and +// the key strings. It does NOT own the val nodes. +// +//---------------------------------------------------------------------------- +struct RBBISetTableEl { + UnicodeString *key; + RBBINode *val; +}; + +/** + * A pair of ints, used to bundle pairs of states or pairs of character classes. + */ +typedef std::pair IntPair; + + +//---------------------------------------------------------------------------- +// +// RBBIDebugPrintf Printf equivalent, for debugging output. +// Conditional compilation of the implementation lets us +// get rid of the stdio dependency in environments where it +// is unavailable. +// +//---------------------------------------------------------------------------- +#ifdef RBBI_DEBUG +#include +#define RBBIDebugPrintf printf +#define RBBIDebugPuts puts +#else +#undef RBBIDebugPrintf +#define RBBIDebugPuts(arg) +#endif + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif + + + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbirpt.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbirpt.h new file mode 100644 index 0000000000000000000000000000000000000000..586953c90c6fa4e0f817432e113cc97a89fdb175 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbirpt.h @@ -0,0 +1,296 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +//--------------------------------------------------------------------------------- +// +// Generated Header File. Do not edit by hand. +// This file contains the state table for the ICU Rule Based Break Iterator +// rule parser. +// It is generated by the Perl script "rbbicst.pl" from +// the rule parser state definitions file "rbbirpt.txt". +// +// Copyright (C) 2002-2016 International Business Machines Corporation +// and others. All rights reserved. +// +//--------------------------------------------------------------------------------- +#ifndef RBBIRPT_H +#define RBBIRPT_H + +#include "unicode/utypes.h" + +U_NAMESPACE_BEGIN +// +// Character classes for RBBI rule scanning. +// + static const uint8_t kRuleSet_digit_char = 128; + static const uint8_t kRuleSet_name_char = 129; + static const uint8_t kRuleSet_name_start_char = 130; + static const uint8_t kRuleSet_rule_char = 131; + static const uint8_t kRuleSet_white_space = 132; + + +enum RBBI_RuleParseAction { + doCheckVarDef, + doDotAny, + doEndAssign, + doEndOfRule, + doEndVariableName, + doExit, + doExprCatOperator, + doExprFinished, + doExprOrOperator, + doExprRParen, + doExprStart, + doLParen, + doNOP, + doNoChain, + doOptionEnd, + doOptionStart, + doReverseDir, + doRuleChar, + doRuleError, + doRuleErrorAssignExpr, + doScanUnicodeSet, + doSlash, + doStartAssign, + doStartTagValue, + doStartVariableName, + doTagDigit, + doTagExpectedError, + doTagValue, + doUnaryOpPlus, + doUnaryOpQuestion, + doUnaryOpStar, + doVariableNameExpectedErr, + rbbiLastAction}; + +//------------------------------------------------------------------------------- +// +// RBBIRuleTableEl represents the structure of a row in the transition table +// for the rule parser state machine. +//------------------------------------------------------------------------------- +struct RBBIRuleTableEl { + RBBI_RuleParseAction fAction; + uint8_t fCharClass; // 0-127: an individual ASCII character + // 128-255: character class index + uint8_t fNextState; // 0-250: normal next-stat numbers + // 255: pop next-state from stack. + uint8_t fPushState; + UBool fNextChar; +}; + +static const struct RBBIRuleTableEl gRuleParseStateTable[] = { + {doNOP, 0, 0, 0, TRUE} + , {doExprStart, 254, 29, 9, FALSE} // 1 start + , {doNOP, 132, 1,0, TRUE} // 2 + , {doNoChain, 94 /* ^ */, 12, 9, TRUE} // 3 + , {doExprStart, 36 /* $ */, 88, 98, FALSE} // 4 + , {doNOP, 33 /* ! */, 19,0, TRUE} // 5 + , {doNOP, 59 /* ; */, 1,0, TRUE} // 6 + , {doNOP, 252, 0,0, FALSE} // 7 + , {doExprStart, 255, 29, 9, FALSE} // 8 + , {doEndOfRule, 59 /* ; */, 1,0, TRUE} // 9 break-rule-end + , {doNOP, 132, 9,0, TRUE} // 10 + , {doRuleError, 255, 103,0, FALSE} // 11 + , {doExprStart, 254, 29,0, FALSE} // 12 start-after-caret + , {doNOP, 132, 12,0, TRUE} // 13 + , {doRuleError, 94 /* ^ */, 103,0, FALSE} // 14 + , {doExprStart, 36 /* $ */, 88, 37, FALSE} // 15 + , {doRuleError, 59 /* ; */, 103,0, FALSE} // 16 + , {doRuleError, 252, 103,0, FALSE} // 17 + , {doExprStart, 255, 29,0, FALSE} // 18 + , {doNOP, 33 /* ! */, 21,0, TRUE} // 19 rev-option + , {doReverseDir, 255, 28, 9, FALSE} // 20 + , {doOptionStart, 130, 23,0, TRUE} // 21 option-scan1 + , {doRuleError, 255, 103,0, FALSE} // 22 + , {doNOP, 129, 23,0, TRUE} // 23 option-scan2 + , {doOptionEnd, 255, 25,0, FALSE} // 24 + , {doNOP, 59 /* ; */, 1,0, TRUE} // 25 option-scan3 + , {doNOP, 132, 25,0, TRUE} // 26 + , {doRuleError, 255, 103,0, FALSE} // 27 + , {doExprStart, 255, 29, 9, FALSE} // 28 reverse-rule + , {doRuleChar, 254, 38,0, TRUE} // 29 term + , {doNOP, 132, 29,0, TRUE} // 30 + , {doRuleChar, 131, 38,0, TRUE} // 31 + , {doNOP, 91 /* [ */, 94, 38, FALSE} // 32 + , {doLParen, 40 /* ( */, 29, 38, TRUE} // 33 + , {doNOP, 36 /* $ */, 88, 37, FALSE} // 34 + , {doDotAny, 46 /* . */, 38,0, TRUE} // 35 + , {doRuleError, 255, 103,0, FALSE} // 36 + , {doCheckVarDef, 255, 38,0, FALSE} // 37 term-var-ref + , {doNOP, 132, 38,0, TRUE} // 38 expr-mod + , {doUnaryOpStar, 42 /* * */, 43,0, TRUE} // 39 + , {doUnaryOpPlus, 43 /* + */, 43,0, TRUE} // 40 + , {doUnaryOpQuestion, 63 /* ? */, 43,0, TRUE} // 41 + , {doNOP, 255, 43,0, FALSE} // 42 + , {doExprCatOperator, 254, 29,0, FALSE} // 43 expr-cont + , {doNOP, 132, 43,0, TRUE} // 44 + , {doExprCatOperator, 131, 29,0, FALSE} // 45 + , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 46 + , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 47 + , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 48 + , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 49 + , {doExprCatOperator, 47 /* / */, 55,0, FALSE} // 50 + , {doExprCatOperator, 123 /* { */, 67,0, TRUE} // 51 + , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 52 + , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 53 + , {doExprFinished, 255, 255,0, FALSE} // 54 + , {doSlash, 47 /* / */, 57,0, TRUE} // 55 look-ahead + , {doNOP, 255, 103,0, FALSE} // 56 + , {doExprCatOperator, 254, 29,0, FALSE} // 57 expr-cont-no-slash + , {doNOP, 132, 43,0, TRUE} // 58 + , {doExprCatOperator, 131, 29,0, FALSE} // 59 + , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 60 + , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 61 + , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 62 + , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 63 + , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 64 + , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 65 + , {doExprFinished, 255, 255,0, FALSE} // 66 + , {doNOP, 132, 67,0, TRUE} // 67 tag-open + , {doStartTagValue, 128, 70,0, FALSE} // 68 + , {doTagExpectedError, 255, 103,0, FALSE} // 69 + , {doNOP, 132, 74,0, TRUE} // 70 tag-value + , {doNOP, 125 /* } */, 74,0, FALSE} // 71 + , {doTagDigit, 128, 70,0, TRUE} // 72 + , {doTagExpectedError, 255, 103,0, FALSE} // 73 + , {doNOP, 132, 74,0, TRUE} // 74 tag-close + , {doTagValue, 125 /* } */, 77,0, TRUE} // 75 + , {doTagExpectedError, 255, 103,0, FALSE} // 76 + , {doExprCatOperator, 254, 29,0, FALSE} // 77 expr-cont-no-tag + , {doNOP, 132, 77,0, TRUE} // 78 + , {doExprCatOperator, 131, 29,0, FALSE} // 79 + , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 80 + , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 81 + , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 82 + , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 83 + , {doExprCatOperator, 47 /* / */, 55,0, FALSE} // 84 + , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 85 + , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 86 + , {doExprFinished, 255, 255,0, FALSE} // 87 + , {doStartVariableName, 36 /* $ */, 90,0, TRUE} // 88 scan-var-name + , {doNOP, 255, 103,0, FALSE} // 89 + , {doNOP, 130, 92,0, TRUE} // 90 scan-var-start + , {doVariableNameExpectedErr, 255, 103,0, FALSE} // 91 + , {doNOP, 129, 92,0, TRUE} // 92 scan-var-body + , {doEndVariableName, 255, 255,0, FALSE} // 93 + , {doScanUnicodeSet, 91 /* [ */, 255,0, TRUE} // 94 scan-unicode-set + , {doScanUnicodeSet, 112 /* p */, 255,0, TRUE} // 95 + , {doScanUnicodeSet, 80 /* P */, 255,0, TRUE} // 96 + , {doNOP, 255, 103,0, FALSE} // 97 + , {doNOP, 132, 98,0, TRUE} // 98 assign-or-rule + , {doStartAssign, 61 /* = */, 29, 101, TRUE} // 99 + , {doNOP, 255, 37, 9, FALSE} // 100 + , {doEndAssign, 59 /* ; */, 1,0, TRUE} // 101 assign-end + , {doRuleErrorAssignExpr, 255, 103,0, FALSE} // 102 + , {doExit, 255, 103,0, TRUE} // 103 errorDeath + }; +#ifdef RBBI_DEBUG +static const char * const RBBIRuleStateNames[] = { 0, + "start", + 0, + 0, + 0, + 0, + 0, + 0, + 0, + "break-rule-end", + 0, + 0, + "start-after-caret", + 0, + 0, + 0, + 0, + 0, + 0, + "rev-option", + 0, + "option-scan1", + 0, + "option-scan2", + 0, + "option-scan3", + 0, + 0, + "reverse-rule", + "term", + 0, + 0, + 0, + 0, + 0, + 0, + 0, + "term-var-ref", + "expr-mod", + 0, + 0, + 0, + 0, + "expr-cont", + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + "look-ahead", + 0, + "expr-cont-no-slash", + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + "tag-open", + 0, + 0, + "tag-value", + 0, + 0, + 0, + "tag-close", + 0, + 0, + "expr-cont-no-tag", + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + "scan-var-name", + 0, + "scan-var-start", + 0, + "scan-var-body", + 0, + "scan-unicode-set", + 0, + 0, + 0, + "assign-or-rule", + 0, + 0, + "assign-end", + 0, + "errorDeath", + 0}; +#endif + +U_NAMESPACE_END +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbiscan.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbiscan.h new file mode 100644 index 0000000000000000000000000000000000000000..58022002c5543e6270d101324f25d0a947e05df6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbiscan.h @@ -0,0 +1,167 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// rbbiscan.h +// +// Copyright (C) 2002-2016, International Business Machines Corporation and others. +// All Rights Reserved. +// +// This file contains declarations for class RBBIRuleScanner +// + + +#ifndef RBBISCAN_H +#define RBBISCAN_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/rbbi.h" +#include "unicode/uniset.h" +#include "unicode/parseerr.h" +#include "uhash.h" +#include "uvector.h" +#include "unicode/symtable.h"// For UnicodeSet parsing, is the interface that + // looks up references to $variables within a set. +#include "rbbinode.h" +#include "rbbirpt.h" + +U_NAMESPACE_BEGIN + +class RBBIRuleBuilder; +class RBBISymbolTable; + + +//-------------------------------------------------------------------------------- +// +// class RBBIRuleScanner does the lowest level, character-at-a-time +// scanning of break iterator rules. +// +// The output of the scanner is parse trees for +// the rule expressions and a list of all Unicode Sets +// encountered. +// +//-------------------------------------------------------------------------------- + +class RBBIRuleScanner : public UMemory { +public: + + enum { + kStackSize = 100 // The size of the state stack for + }; // rules parsing. Corresponds roughly + // to the depth of parentheses nesting + // that is allowed in the rules. + + struct RBBIRuleChar { + UChar32 fChar; + UBool fEscaped; + RBBIRuleChar() : fChar(0), fEscaped(false) {} + }; + + RBBIRuleScanner(RBBIRuleBuilder *rb); + + + virtual ~RBBIRuleScanner(); + + void nextChar(RBBIRuleChar &c); // Get the next char from the input stream. + // Return false if at end. + + UBool push(const RBBIRuleChar &c); // Push (unget) one character. + // Only a single character may be pushed. + + void parse(); // Parse the rules, generating two parse + // trees, one each for the forward and + // reverse rules, + // and a list of UnicodeSets encountered. + + int32_t numRules(); // Return the number of rules that have been seen. + + /** + * Return a rules string without unnecessary + * characters. + */ + static UnicodeString stripRules(const UnicodeString &rules); +private: + + UBool doParseActions(int32_t a); + void error(UErrorCode e); // error reporting convenience function. + void fixOpStack(RBBINode::OpPrecedence p); + // a character. + void findSetFor(const UnicodeString &s, RBBINode *node, UnicodeSet *setToAdopt = NULL); + + UChar32 nextCharLL(); +#ifdef RBBI_DEBUG + void printNodeStack(const char *title); +#endif + RBBINode *pushNewNode(RBBINode::NodeType t); + void scanSet(); + + + RBBIRuleBuilder *fRB; // The rule builder that we are part of. + + int32_t fScanIndex; // Index of current character being processed + // in the rule input string. + int32_t fNextIndex; // Index of the next character, which + // is the first character not yet scanned. + UBool fQuoteMode; // Scan is in a 'quoted region' + int32_t fLineNum; // Line number in input file. + int32_t fCharNum; // Char position within the line. + UChar32 fLastChar; // Previous char, needed to count CR-LF + // as a single line, not two. + + RBBIRuleChar fC; // Current char for parse state machine + // processing. + UnicodeString fVarName; // $variableName, valid when we've just + // scanned one. + + RBBIRuleTableEl **fStateTable; // State Transition Table for RBBI Rule + // parsing. index by p[state][char-class] + + uint16_t fStack[kStackSize]; // State stack, holds state pushes + int32_t fStackPtr; // and pops as specified in the state + // transition rules. + + RBBINode *fNodeStack[kStackSize]; // Node stack, holds nodes created + // during the parse of a rule + int32_t fNodeStackPtr; + + + UBool fReverseRule; // True if the rule currently being scanned + // is a reverse direction rule (if it + // starts with a '!') + + UBool fLookAheadRule; // True if the rule includes a '/' + // somewhere within it. + + UBool fNoChainInRule; // True if the current rule starts with a '^'. + + RBBISymbolTable *fSymbolTable; // symbol table, holds definitions of + // $variable symbols. + + UHashtable *fSetTable; // UnicocodeSet hash table, holds indexes to + // the sets created while parsing rules. + // The key is the string used for creating + // the set. + + UnicodeSet fRuleSets[10]; // Unicode Sets that are needed during + // the scanning of RBBI rules. The + // indicies for these are assigned by the + // perl script that builds the state tables. + // See rbbirpt.h. + + int32_t fRuleNum; // Counts each rule as it is scanned. + + int32_t fOptionStart; // Input index of start of a !!option + // keyword, while being scanned. + + UnicodeSet *gRuleSet_rule_char; + UnicodeSet *gRuleSet_white_space; + UnicodeSet *gRuleSet_name_char; + UnicodeSet *gRuleSet_name_start_char; + + RBBIRuleScanner(const RBBIRuleScanner &other); // forbid copying of this class + RBBIRuleScanner &operator=(const RBBIRuleScanner &other); // forbid copying of this class +}; + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbisetb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbisetb.h new file mode 100644 index 0000000000000000000000000000000000000000..6409a4ea57983220f8df3c8aaf1c49614d8ab1ab --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbisetb.h @@ -0,0 +1,147 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// rbbisetb.h +/* +********************************************************************** +* Copyright (c) 2001-2005, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef RBBISETB_H +#define RBBISETB_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/ucptrie.h" +#include "unicode/umutablecptrie.h" +#include "unicode/uobject.h" +#include "rbbirb.h" +#include "uvector.h" + +U_NAMESPACE_BEGIN + +// +// RBBISetBuilder Derives the character categories used by the runtime RBBI engine +// from the Unicode Sets appearing in the source RBBI rules, and +// creates the TRIE table used to map from Unicode to the +// character categories. +// + + +// +// RangeDescriptor +// +// Each of the non-overlapping character ranges gets one of these descriptors. +// All of them are strung together in a linked list, which is kept in order +// (by character) +// +class RangeDescriptor : public UMemory { +public: + UChar32 fStartChar {}; // Start of range, unicode 32 bit value. + UChar32 fEndChar {}; // End of range, unicode 32 bit value. + int32_t fNum {0}; // runtime-mapped input value for this range. + bool fIncludesDict {false}; // True if the range includes $dictionary. + bool fFirstInGroup {false}; // True if first range in a group with the same fNum. + UVector *fIncludesSets {nullptr}; // vector of the the original + // Unicode sets that include this range. + // (Contains ptrs to uset nodes) + RangeDescriptor *fNext {nullptr}; // Next RangeDescriptor in the linked list. + + RangeDescriptor(UErrorCode &status); + RangeDescriptor(const RangeDescriptor &other, UErrorCode &status); + ~RangeDescriptor(); + void split(UChar32 where, UErrorCode &status); // Spit this range in two at "where", with + // where appearing in the second (higher) part. + bool isDictionaryRange(); // Check whether this range appears as part of + // the Unicode set named "dictionary" + + RangeDescriptor(const RangeDescriptor &other) = delete; // forbid default copying of this class + RangeDescriptor &operator=(const RangeDescriptor &other) = delete; // forbid assigning of this class +}; + + +// +// RBBISetBuilder Handles processing of Unicode Sets from RBBI rules. +// +// Starting with the rules parse tree from the scanner, +// +// - Enumerate the set of UnicodeSets that are referenced +// by the RBBI rules. +// - compute a derived set of non-overlapping UnicodeSets +// that will correspond to columns in the state table for +// the RBBI execution engine. +// - construct the trie table that maps input characters +// to set numbers in the non-overlapping set of sets. +// + + +class RBBISetBuilder : public UMemory { +public: + RBBISetBuilder(RBBIRuleBuilder *rb); + ~RBBISetBuilder(); + + void buildRanges(); + void buildTrie(); + void addValToSets(UVector *sets, uint32_t val); + void addValToSet (RBBINode *usetNode, uint32_t val); + int32_t getNumCharCategories() const; // CharCategories are the same as input symbol set to the + // runtime state machine, which are the same as + // columns in the DFA state table + int32_t getDictCategoriesStart() const; // First char category that includes $dictionary, or + // last category + 1 if there are no dictionary categories. + int32_t getTrieSize() /*const*/; // Size in bytes of the serialized Trie. + void serializeTrie(uint8_t *where); // write out the serialized Trie. + UChar32 getFirstChar(int32_t val) const; + UBool sawBOF() const; // Indicate whether any references to the {bof} pseudo + // character were encountered. + /** + * Merge two character categories that have been identified as having equivalent behavior. + * The ranges belonging to the second category (table column) will be added to the first. + * @param categories the pair of categories to be merged. + */ + void mergeCategories(IntPair categories); + +#ifdef RBBI_DEBUG + void printSets(); + void printRanges(); + void printRangeGroups(); +#else + #define printSets() + #define printRanges() + #define printRangeGroups() +#endif + +private: + RBBIRuleBuilder *fRB; // The RBBI Rule Compiler that owns us. + UErrorCode *fStatus; + + RangeDescriptor *fRangeList; // Head of the linked list of RangeDescriptors + + UMutableCPTrie *fMutableTrie; // The mapping TRIE that is the end result of processing + UCPTrie *fTrie; // the Unicode Sets. + uint32_t fTrieSize; + + // Number of range groups, which are groups of ranges that are in the same original UnicodeSets. + int32_t fGroupCount; + + // The number of the first dictionary char category. + // If there are no Dictionary categories, set to the last category + 1. + int32_t fDictCategoriesStart; + + UBool fSawBOF; + + RBBISetBuilder(const RBBISetBuilder &other); // forbid copying of this class + RBBISetBuilder &operator=(const RBBISetBuilder &other); // forbid copying of this class +}; + + + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbitblb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbitblb.h new file mode 100644 index 0000000000000000000000000000000000000000..fe3db8d7bf1ae8e44be56a77455dbf8705c0368d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/rbbitblb.h @@ -0,0 +1,232 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// rbbitblb.h +// + +/* +********************************************************************** +* Copyright (c) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef RBBITBLB_H +#define RBBITBLB_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/uobject.h" +#include "unicode/rbbi.h" +#include "rbbidata.h" +#include "rbbirb.h" +#include "rbbinode.h" + + +U_NAMESPACE_BEGIN + +class RBBIRuleScanner; +class RBBIRuleBuilder; +class UVector32; + +// +// class RBBITableBuilder is part of the RBBI rule compiler. +// It builds the state transition table used by the RBBI runtime +// from the expression syntax tree generated by the rule scanner. +// +// This class is part of the RBBI implementation only. +// There is no user-visible public API here. +// + +class RBBITableBuilder : public UMemory { +public: + RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status); + ~RBBITableBuilder(); + + void buildForwardTable(); + + /** Return the runtime size in bytes of the built state table. */ + int32_t getTableSize() const; + + /** Fill in the runtime state table. Sufficient memory must exist at the specified location. + */ + void exportTable(void *where); + + /** Use 8 bits to encode the forward table */ + bool use8BitsForTable() const; + + /** + * Find duplicate (redundant) character classes. Begin looking with categories.first. + * Duplicate, if found are returned in the categories parameter. + * This is an iterator-like function, used to identify character classes + * (state table columns) that can be eliminated. + * @param categories in/out parameter, specifies where to start looking for duplicates, + * and returns the first pair of duplicates found, if any. + * @return true if duplicate char classes were found, false otherwise. + */ + bool findDuplCharClassFrom(IntPair *categories); + + /** Remove a column from the state table. Used when two character categories + * have been found equivalent, and merged together, to eliminate the uneeded table column. + */ + void removeColumn(int32_t column); + + /** + * Check for, and remove dupicate states (table rows). + * @return the number of states removed. + */ + int32_t removeDuplicateStates(); + + /** Build the safe reverse table from the already-constructed forward table. */ + void buildSafeReverseTable(UErrorCode &status); + + /** Return the runtime size in bytes of the built safe reverse state table. */ + int32_t getSafeTableSize() const; + + /** Fill in the runtime safe state table. Sufficient memory must exist at the specified location. + */ + void exportSafeTable(void *where); + + /** Use 8 bits to encode the safe reverse table */ + bool use8BitsForSafeTable() const; + +private: + void calcNullable(RBBINode *n); + void calcFirstPos(RBBINode *n); + void calcLastPos(RBBINode *n); + void calcFollowPos(RBBINode *n); + void calcChainedFollowPos(RBBINode *n, RBBINode *endMarkNode); + void bofFixup(); + void buildStateTable(); + void mapLookAheadRules(); + void flagAcceptingStates(); + void flagLookAheadStates(); + void flagTaggedStates(); + void mergeRuleStatusVals(); + + /** + * Merge redundant state table columns, eliminating character classes with identical behavior. + * Done after the state tables are generated, just before converting to their run-time format. + */ + int32_t mergeColumns(); + + void addRuleRootNodes(UVector *dest, RBBINode *node); + + /** + * Find duplicate (redundant) states, beginning at the specified pair, + * within this state table. This is an iterator-like function, used to + * identify states (state table rows) that can be eliminated. + * @param states in/out parameter, specifies where to start looking for duplicates, + * and returns the first pair of duplicates found, if any. + * @return true if duplicate states were found, false otherwise. + */ + bool findDuplicateState(IntPair *states); + + /** Remove a duplicate state. + * @param duplStates The duplicate states. The first is kept, the second is removed. + * All references to the second in the state table are retargeted + * to the first. + */ + void removeState(IntPair duplStates); + + /** Find the next duplicate state in the safe reverse table. An iterator function. + * @param states in/out parameter, specifies where to start looking for duplicates, + * and returns the first pair of duplicates found, if any. + * @return true if a duplicate pair of states was found. + */ + bool findDuplicateSafeState(IntPair *states); + + /** Remove a duplicate state from the safe table. + * @param duplStates The duplicate states. The first is kept, the second is removed. + * All references to the second in the state table are retargeted + * to the first. + */ + void removeSafeState(IntPair duplStates); + + // Set functions for UVector. + // TODO: make a USet subclass of UVector + + void setAdd(UVector *dest, UVector *source); + UBool setEquals(UVector *a, UVector *b); + + void sortedAdd(UVector **dest, int32_t val); + +public: +#ifdef RBBI_DEBUG + void printSet(UVector *s); + void printPosSets(RBBINode *n /* = NULL*/); + void printStates(); + void printRuleStatusTable(); + void printReverseTable(); +#else + #define printSet(s) + #define printPosSets(n) + #define printStates() + #define printRuleStatusTable() + #define printReverseTable() +#endif + +private: + RBBIRuleBuilder *fRB; + RBBINode *&fTree; // The root node of the parse tree to build a + // table for. + UErrorCode *fStatus; + + /** State Descriptors, UVector */ + UVector *fDStates; // D states (Aho's terminology) + // Index is state number + // Contents are RBBIStateDescriptor pointers. + + /** Synthesized safe table, UVector of UnicodeString, one string per table row. */ + UVector *fSafeTable; + + /** Map from rule number (fVal in look ahead nodes) to sequential lookahead index. */ + UVector32 *fLookAheadRuleMap = nullptr; + + /* Counter used when assigning lookahead rule numbers. + * Contains the last look-ahead number already in use. + * The first look-ahead number is 2; Number 1 (ACCEPTING_UNCONDITIONAL) is reserved + * for non-lookahead accepting states. See the declarations of RBBIStateTableRowT. */ + int32_t fLASlotsInUse = ACCEPTING_UNCONDITIONAL; + + + RBBITableBuilder(const RBBITableBuilder &other) = delete; // forbid copying of this class + RBBITableBuilder &operator=(const RBBITableBuilder &other) = delete; // forbid copying of this class +}; + +// +// RBBIStateDescriptor - The DFA is constructed as a set of these descriptors, +// one for each state. +class RBBIStateDescriptor : public UMemory { +public: + UBool fMarked; + uint32_t fAccepting; + uint32_t fLookAhead; + UVector *fTagVals; + int32_t fTagsIdx; + UVector *fPositions; // Set of parse tree positions associated + // with this state. Unordered (it's a set). + // UVector contents are RBBINode * + + UVector32 *fDtran; // Transitions out of this state. + // indexed by input character + // contents is int index of dest state + // in RBBITableBuilder.fDStates + + RBBIStateDescriptor(int maxInputSymbol, UErrorCode *fStatus); + ~RBBIStateDescriptor(); + +private: + RBBIStateDescriptor(const RBBIStateDescriptor &other); // forbid copying of this class + RBBIStateDescriptor &operator=(const RBBIStateDescriptor &other); // forbid copying of this class +}; + + + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/resource.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/resource.h new file mode 100644 index 0000000000000000000000000000000000000000..48f5b9fa6ec7cc55274f3699d146609d642d95be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/resource.h @@ -0,0 +1,295 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2015-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* resource.h +* +* created on: 2015nov04 +* created by: Markus W. Scherer +*/ + +#ifndef __URESOURCE_H__ +#define __URESOURCE_H__ + +/** + * \file + * \brief ICU resource bundle key and value types. + */ + +// Note: Ported from ICU4J class UResource and its nested classes, +// but the C++ classes are separate, not nested. + +// We use the Resource prefix for C++ classes, as usual. +// The UResource prefix would be used for C types. + +#include "unicode/utypes.h" +#include "unicode/unistr.h" +#include "unicode/ures.h" +#include "restrace.h" + +struct ResourceData; + +U_NAMESPACE_BEGIN + +class ResourceValue; + +// Note: In C++, we use const char * pointers for keys, +// rather than an abstraction like Java UResource.Key. + +/** + * Interface for iterating over a resource bundle array resource. + */ +class U_COMMON_API ResourceArray { +public: + /** Constructs an empty array object. */ + ResourceArray() : items16(NULL), items32(NULL), length(0) {} + + /** Only for implementation use. @internal */ + ResourceArray(const uint16_t *i16, const uint32_t *i32, int32_t len, + const ResourceTracer& traceInfo) : + items16(i16), items32(i32), length(len), + fTraceInfo(traceInfo) {} + + /** + * @return The number of items in the array resource. + */ + int32_t getSize() const { return length; } + /** + * @param i Array item index. + * @param value Output-only, receives the value of the i'th item. + * @return true if i is non-negative and less than getSize(). + */ + UBool getValue(int32_t i, ResourceValue &value) const; + + /** Only for implementation use. @internal */ + uint32_t internalGetResource(const ResourceData *pResData, int32_t i) const; + +private: + const uint16_t *items16; + const uint32_t *items32; + int32_t length; + ResourceTracer fTraceInfo; +}; + +/** + * Interface for iterating over a resource bundle table resource. + */ +class U_COMMON_API ResourceTable { +public: + /** Constructs an empty table object. */ + ResourceTable() : keys16(NULL), keys32(NULL), items16(NULL), items32(NULL), length(0) {} + + /** Only for implementation use. @internal */ + ResourceTable(const uint16_t *k16, const int32_t *k32, + const uint16_t *i16, const uint32_t *i32, int32_t len, + const ResourceTracer& traceInfo) : + keys16(k16), keys32(k32), items16(i16), items32(i32), length(len), + fTraceInfo(traceInfo) {} + + /** + * @return The number of items in the array resource. + */ + int32_t getSize() const { return length; } + /** + * @param i Table item index. + * @param key Output-only, receives the key of the i'th item. + * @param value Output-only, receives the value of the i'th item. + * @return true if i is non-negative and less than getSize(). + */ + UBool getKeyAndValue(int32_t i, const char *&key, ResourceValue &value) const; + + /** + * @param key Key string to find in the table. + * @param value Output-only, receives the value of the item with that key. + * @return true if the table contains the key. + */ + UBool findValue(const char *key, ResourceValue &value) const; + +private: + const uint16_t *keys16; + const int32_t *keys32; + const uint16_t *items16; + const uint32_t *items32; + int32_t length; + ResourceTracer fTraceInfo; +}; + +/** + * Represents a resource bundle item's value. + * Avoids object creations as much as possible. + * Mutable, not thread-safe. + */ +class U_COMMON_API ResourceValue : public UObject { +public: + virtual ~ResourceValue(); + + /** + * @return ICU resource type, for example, URES_STRING + */ + virtual UResType getType() const = 0; + + /** + * Sets U_RESOURCE_TYPE_MISMATCH if this is not a string resource. + * + * @see ures_getString() + */ + virtual const UChar *getString(int32_t &length, UErrorCode &errorCode) const = 0; + + inline UnicodeString getUnicodeString(UErrorCode &errorCode) const { + int32_t len = 0; + const UChar *r = getString(len, errorCode); + return UnicodeString(true, r, len); + } + + /** + * Sets U_RESOURCE_TYPE_MISMATCH if this is not an alias resource. + */ + virtual const UChar *getAliasString(int32_t &length, UErrorCode &errorCode) const = 0; + + inline UnicodeString getAliasUnicodeString(UErrorCode &errorCode) const { + int32_t len = 0; + const UChar *r = getAliasString(len, errorCode); + return UnicodeString(true, r, len); + } + + /** + * Sets U_RESOURCE_TYPE_MISMATCH if this is not an integer resource. + * + * @see ures_getInt() + */ + virtual int32_t getInt(UErrorCode &errorCode) const = 0; + + /** + * Sets U_RESOURCE_TYPE_MISMATCH if this is not an integer resource. + * + * @see ures_getUInt() + */ + virtual uint32_t getUInt(UErrorCode &errorCode) const = 0; + + /** + * Sets U_RESOURCE_TYPE_MISMATCH if this is not an intvector resource. + * + * @see ures_getIntVector() + */ + virtual const int32_t *getIntVector(int32_t &length, UErrorCode &errorCode) const = 0; + + /** + * Sets U_RESOURCE_TYPE_MISMATCH if this is not a binary-blob resource. + * + * @see ures_getBinary() + */ + virtual const uint8_t *getBinary(int32_t &length, UErrorCode &errorCode) const = 0; + + /** + * Sets U_RESOURCE_TYPE_MISMATCH if this is not an array resource + */ + virtual ResourceArray getArray(UErrorCode &errorCode) const = 0; + + /** + * Sets U_RESOURCE_TYPE_MISMATCH if this is not a table resource + */ + virtual ResourceTable getTable(UErrorCode &errorCode) const = 0; + + /** + * Is this a no-fallback/no-inheritance marker string? + * Such a marker is used for + * CLDR no-fallback data values of (three empty-set symbols)=={2205, 2205, 2205} + * when enumerating tables with fallback from the specific resource bundle to root. + * + * @return true if this is a no-inheritance marker string + */ + virtual UBool isNoInheritanceMarker() const = 0; + + /** + * Sets the dest strings from the string values in this array resource. + * + * @return the number of strings in this array resource. + * If greater than capacity, then an overflow error is set. + * + * Sets U_RESOURCE_TYPE_MISMATCH if this is not an array resource + * or if any of the array items is not a string + */ + virtual int32_t getStringArray(UnicodeString *dest, int32_t capacity, + UErrorCode &errorCode) const = 0; + + /** + * Same as + *

+     * if (getType() == URES_STRING) {
+     *     return new String[] { getString(); }
+     * } else {
+     *     return getStringArray();
+     * }
+     * 
+ * + * Sets U_RESOURCE_TYPE_MISMATCH if this is + * neither a string resource nor an array resource containing strings + * @see getString() + * @see getStringArray() + */ + virtual int32_t getStringArrayOrStringAsArray(UnicodeString *dest, int32_t capacity, + UErrorCode &errorCode) const = 0; + + /** + * Same as + *
+     * if (getType() == URES_STRING) {
+     *     return getString();
+     * } else {
+     *     return getStringArray()[0];
+     * }
+     * 
+ * + * Sets U_RESOURCE_TYPE_MISMATCH if this is + * neither a string resource nor an array resource containing strings + * @see getString() + * @see getStringArray() + */ + virtual UnicodeString getStringOrFirstOfArray(UErrorCode &errorCode) const = 0; + +protected: + ResourceValue() {} + +private: + ResourceValue(const ResourceValue &); // no copy constructor + ResourceValue &operator=(const ResourceValue &); // no assignment operator +}; + +/** + * Sink for ICU resource bundle contents. + */ +class U_COMMON_API ResourceSink : public UObject { +public: + ResourceSink() {} + virtual ~ResourceSink(); + + /** + * Called once for each bundle (child-parent-...-root). + * The value is normally an array or table resource, + * and implementations of this method normally iterate over the + * tree of resource items stored there. + * + * @param key The key string of the enumeration-start resource. + * Empty if the enumeration starts at the top level of the bundle. + * @param value Call getArray() or getTable() as appropriate. Then reuse for + * output values from Array and Table getters. Note: ResourceTable and + * ResourceArray instances must outlive the ResourceValue instance for + * ResourceTracer to be happy. + * @param noFallback true if the bundle has no parent; + * that is, its top-level table has the nofallback attribute, + * or it is the root bundle of a locale tree. + */ + virtual void put(const char *key, ResourceValue &value, UBool noFallback, + UErrorCode &errorCode) = 0; + +private: + ResourceSink(const ResourceSink &); // no copy constructor + ResourceSink &operator=(const ResourceSink &); // no assignment operator +}; + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/restrace.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/restrace.h new file mode 100644 index 0000000000000000000000000000000000000000..ef29eaed578107ad55bc3d4189249050b2f2b8a4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/restrace.h @@ -0,0 +1,147 @@ +// © 2019 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#ifndef __RESTRACE_H__ +#define __RESTRACE_H__ + +#include "unicode/utypes.h" + +#if U_ENABLE_TRACING + +struct UResourceBundle; + +U_NAMESPACE_BEGIN + +class CharString; + +/** + * Instances of this class store information used to trace reads from resource + * bundles when ICU is built with --enable-tracing. + * + * All arguments of type const UResourceBundle*, const char*, and + * const ResourceTracer& are stored as pointers. The caller must retain + * ownership for the lifetime of this ResourceTracer. + * + * Exported as U_COMMON_API for Windows because it is a value field + * in other exported types. + */ +class U_COMMON_API ResourceTracer { +public: + ResourceTracer() : + fResB(nullptr), + fParent(nullptr), + fKey(nullptr), + fIndex(-1) {} + + ResourceTracer(const UResourceBundle* resB) : + fResB(resB), + fParent(nullptr), + fKey(nullptr), + fIndex(-1) {} + + ResourceTracer(const UResourceBundle* resB, const char* key) : + fResB(resB), + fParent(nullptr), + fKey(key), + fIndex(-1) {} + + ResourceTracer(const UResourceBundle* resB, int32_t index) : + fResB(resB), + fParent(nullptr), + fKey(nullptr), + fIndex(index) {} + + ResourceTracer(const ResourceTracer& parent, const char* key) : + fResB(nullptr), + fParent(&parent), + fKey(key), + fIndex(-1) {} + + ResourceTracer(const ResourceTracer& parent, int32_t index) : + fResB(nullptr), + fParent(&parent), + fKey(nullptr), + fIndex(index) {} + + ~ResourceTracer(); + + void trace(const char* type) const; + void traceOpen() const; + + /** + * Calls trace() if the resB or parent provided to the constructor was + * non-null; otherwise, does nothing. + */ + void maybeTrace(const char* type) const { + if (fResB || fParent) { + trace(type); + } + } + +private: + const UResourceBundle* fResB; + const ResourceTracer* fParent; + const char* fKey; + int32_t fIndex; + + CharString& getFilePath(CharString& output, UErrorCode& status) const; + + CharString& getResPath(CharString& output, UErrorCode& status) const; +}; + +/** + * This class provides methods to trace data file reads when ICU is built + * with --enable-tracing. + */ +class FileTracer { +public: + static void traceOpen(const char* path, const char* type, const char* name); + +private: + static void traceOpenDataFile(const char* path, const char* type, const char* name); + static void traceOpenResFile(const char* path, const char* name); +}; + +U_NAMESPACE_END + +#else // U_ENABLE_TRACING + +U_NAMESPACE_BEGIN + +/** + * Default trivial implementation when --enable-tracing is not used. + */ +class U_COMMON_API ResourceTracer { +public: + ResourceTracer() {} + + ResourceTracer(const void*) {} + + ResourceTracer(const void*, const char*) {} + + ResourceTracer(const void*, int32_t) {} + + ResourceTracer(const ResourceTracer&, const char*) {} + + ResourceTracer(const ResourceTracer&, int32_t) {} + + void trace(const char*) const {} + + void traceOpen() const {} + + void maybeTrace(const char*) const {} +}; + +/** + * Default trivial implementation when --enable-tracing is not used. + */ +class FileTracer { +public: + static void traceOpen(const char*, const char*, const char*) {} +}; + +U_NAMESPACE_END + +#endif // U_ENABLE_TRACING + +#endif //__RESTRACE_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ruleiter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ruleiter.h new file mode 100644 index 0000000000000000000000000000000000000000..28e2ca57530e9d45df30cadff72d504b752dce25 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ruleiter.h @@ -0,0 +1,233 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2003-2011, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: September 24 2003 +* Since: ICU 2.8 +********************************************************************** +*/ +#ifndef _RULEITER_H_ +#define _RULEITER_H_ + +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN + +class UnicodeString; +class ParsePosition; +class SymbolTable; + +/** + * An iterator that returns 32-bit code points. This class is deliberately + * not related to any of the ICU character iterator classes + * in order to minimize complexity. + * @author Alan Liu + * @since ICU 2.8 + */ +class RuleCharacterIterator : public UMemory { + + // TODO: Ideas for later. (Do not implement if not needed, lest the + // code coverage numbers go down due to unused methods.) + // 1. Add a copy constructor, operator==() method. + // 2. Rather than return DONE, throw an exception if the end + // is reached -- this is an alternate usage model, probably not useful. + +private: + /** + * Text being iterated. + */ + const UnicodeString& text; + + /** + * Position of iterator. + */ + ParsePosition& pos; + + /** + * Symbol table used to parse and dereference variables. May be 0. + */ + const SymbolTable* sym; + + /** + * Current variable expansion, or 0 if none. + */ + const UnicodeString* buf; + + /** + * Position within buf. Meaningless if buf == 0. + */ + int32_t bufPos; + +public: + /** + * Value returned when there are no more characters to iterate. + */ + enum { DONE = -1 }; + + /** + * Bitmask option to enable parsing of variable names. If (options & + * PARSE_VARIABLES) != 0, then an embedded variable will be expanded to + * its value. Variables are parsed using the SymbolTable API. + */ + enum { PARSE_VARIABLES = 1 }; + + /** + * Bitmask option to enable parsing of escape sequences. If (options & + * PARSE_ESCAPES) != 0, then an embedded escape sequence will be expanded + * to its value. Escapes are parsed using Utility.unescapeAt(). + */ + enum { PARSE_ESCAPES = 2 }; + + /** + * Bitmask option to enable skipping of whitespace. If (options & + * SKIP_WHITESPACE) != 0, then Pattern_White_Space characters will be silently + * skipped, as if they were not present in the input. + */ + enum { SKIP_WHITESPACE = 4 }; + + /** + * Constructs an iterator over the given text, starting at the given + * position. + * @param text the text to be iterated + * @param sym the symbol table, or null if there is none. If sym is null, + * then variables will not be deferenced, even if the PARSE_VARIABLES + * option is set. + * @param pos upon input, the index of the next character to return. If a + * variable has been dereferenced, then pos will not increment as + * characters of the variable value are iterated. + */ + RuleCharacterIterator(const UnicodeString& text, const SymbolTable* sym, + ParsePosition& pos); + + /** + * Returns true if this iterator has no more characters to return. + */ + UBool atEnd() const; + + /** + * Returns the next character using the given options, or DONE if there + * are no more characters, and advance the position to the next + * character. + * @param options one or more of the following options, bitwise-OR-ed + * together: PARSE_VARIABLES, PARSE_ESCAPES, SKIP_WHITESPACE. + * @param isEscaped output parameter set to true if the character + * was escaped + * @param ec input-output error code. An error will only be set by + * this routing if options includes PARSE_VARIABLES and an unknown + * variable name is seen, or if options includes PARSE_ESCAPES and + * an invalid escape sequence is seen. + * @return the current 32-bit code point, or DONE + */ + UChar32 next(int32_t options, UBool& isEscaped, UErrorCode& ec); + + /** + * Returns true if this iterator is currently within a variable expansion. + */ + inline UBool inVariable() const; + + /** + * An opaque object representing the position of a RuleCharacterIterator. + */ + struct Pos : public UMemory { + private: + const UnicodeString* buf; + int32_t pos; + int32_t bufPos; + friend class RuleCharacterIterator; + }; + + /** + * Sets an object which, when later passed to setPos(), will + * restore this iterator's position. Usage idiom: + * + * RuleCharacterIterator iterator = ...; + * RuleCharacterIterator::Pos pos; + * iterator.getPos(pos); + * for (;;) { + * iterator.getPos(pos); + * int c = iterator.next(...); + * ... + * } + * iterator.setPos(pos); + * + * @param p a position object to be set to this iterator's + * current position. + */ + void getPos(Pos& p) const; + + /** + * Restores this iterator to the position it had when getPos() + * set the given object. + * @param p a position object previously set by getPos() + */ + void setPos(const Pos& p); + + /** + * Skips ahead past any ignored characters, as indicated by the given + * options. This is useful in conjunction with the lookahead() method. + * + * Currently, this only has an effect for SKIP_WHITESPACE. + * @param options one or more of the following options, bitwise-OR-ed + * together: PARSE_VARIABLES, PARSE_ESCAPES, SKIP_WHITESPACE. + */ + void skipIgnored(int32_t options); + + /** + * Returns a string containing the remainder of the characters to be + * returned by this iterator, without any option processing. If the + * iterator is currently within a variable expansion, this will only + * extend to the end of the variable expansion. This method is provided + * so that iterators may interoperate with string-based APIs. The typical + * sequence of calls is to call skipIgnored(), then call lookahead(), then + * parse the string returned by lookahead(), then call jumpahead() to + * resynchronize the iterator. + * @param result a string to receive the characters to be returned + * by future calls to next() + * @param maxLookAhead The maximum to copy into the result. + * @return a reference to result + */ + UnicodeString& lookahead(UnicodeString& result, int32_t maxLookAhead = -1) const; + + /** + * Advances the position by the given number of 16-bit code units. + * This is useful in conjunction with the lookahead() method. + * @param count the number of 16-bit code units to jump over + */ + void jumpahead(int32_t count); + + /** + * Returns a string representation of this object, consisting of the + * characters being iterated, with a '|' marking the current position. + * Position within an expanded variable is not indicated. + * @param result output parameter to receive a string + * representation of this object + */ +// UnicodeString& toString(UnicodeString& result) const; + +private: + /** + * Returns the current 32-bit code point without parsing escapes, parsing + * variables, or skipping whitespace. + * @return the current 32-bit code point + */ + UChar32 _current() const; + + /** + * Advances the position by the given amount. + * @param count the number of 16-bit code units to advance past + */ + void _advance(int32_t count); +}; + +inline UBool RuleCharacterIterator::inVariable() const { + return buf != 0; +} + +U_NAMESPACE_END + +#endif // _RULEITER_H_ +//eof diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/serv.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/serv.h new file mode 100644 index 0000000000000000000000000000000000000000..ca070b6c6d69c25b8c18e5f8ddd18526dcd771a1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/serv.h @@ -0,0 +1,996 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/** + ******************************************************************************* + * Copyright (C) 2001-2011, International Business Machines Corporation. * + * All Rights Reserved. * + ******************************************************************************* + */ + +#ifndef ICUSERV_H +#define ICUSERV_H + +#include "unicode/utypes.h" + +#if UCONFIG_NO_SERVICE + +U_NAMESPACE_BEGIN + +/* + * Allow the declaration of APIs with pointers to ICUService + * even when service is removed from the build. + */ +class ICUService; + +U_NAMESPACE_END + +#else + +#include "unicode/unistr.h" +#include "unicode/locid.h" +#include "unicode/umisc.h" + +#include "hash.h" +#include "uvector.h" +#include "servnotf.h" + +class ICUServiceTest; + +U_NAMESPACE_BEGIN + +class ICUServiceKey; +class ICUServiceFactory; +class SimpleFactory; +class ServiceListener; +class ICUService; + +class DNCache; + +/******************************************************************* + * ICUServiceKey + */ + +/** + *

ICUServiceKeys are used to communicate with factories to + * generate an instance of the service. ICUServiceKeys define how + * ids are canonicalized, provide both a current id and a current + * descriptor to use in querying the cache and factories, and + * determine the fallback strategy.

+ * + *

ICUServiceKeys provide both a currentDescriptor and a currentID. + * The descriptor contains an optional prefix, followed by '/' + * and the currentID. Factories that handle complex keys, + * for example number format factories that generate multiple + * kinds of formatters for the same locale, use the descriptor + * to provide a fully unique identifier for the service object, + * while using the currentID (in this case, the locale string), + * as the visible IDs that can be localized.

+ * + *

The default implementation of ICUServiceKey has no fallbacks and + * has no custom descriptors.

+ */ +class U_COMMON_API ICUServiceKey : public UObject { + private: + const UnicodeString _id; + + protected: + static const UChar PREFIX_DELIMITER; + + public: + + /** + *

Construct a key from an id.

+ * + * @param id the ID from which to construct the key. + */ + ICUServiceKey(const UnicodeString& id); + + /** + *

Virtual destructor.

+ */ + virtual ~ICUServiceKey(); + + /** + *

Return the original ID used to construct this key.

+ * + * @return the ID used to construct this key. + */ + virtual const UnicodeString& getID() const; + + /** + *

Return the canonical version of the original ID. This implementation + * appends the original ID to result. Result is returned as a convenience.

+ * + * @param result the output parameter to which the id will be appended. + * @return the modified result. + */ + virtual UnicodeString& canonicalID(UnicodeString& result) const; + + /** + *

Return the (canonical) current ID. This implementation appends + * the canonical ID to result. Result is returned as a convenience.

+ * + * @param result the output parameter to which the current id will be appended. + * @return the modified result. + */ + virtual UnicodeString& currentID(UnicodeString& result) const; + + /** + *

Return the current descriptor. This implementation appends + * the current descriptor to result. Result is returned as a convenience.

+ * + *

The current descriptor is used to fully + * identify an instance of the service in the cache. A + * factory may handle all descriptors for an ID, or just a + * particular descriptor. The factory can either parse the + * descriptor or use custom API on the key in order to + * instantiate the service.

+ * + * @param result the output parameter to which the current id will be appended. + * @return the modified result. + */ + virtual UnicodeString& currentDescriptor(UnicodeString& result) const; + + /** + *

If the key has a fallback, modify the key and return true, + * otherwise return false. The current ID will change if there + * is a fallback. No currentIDs should be repeated, and fallback + * must eventually return false. This implementation has no fallbacks + * and always returns false.

+ * + * @return true if the ICUServiceKey changed to a valid fallback value. + */ + virtual UBool fallback(); + + /** + *

Return true if a key created from id matches, or would eventually + * fallback to match, the canonical ID of this ICUServiceKey.

+ * + * @param id the id to test. + * @return true if this ICUServiceKey's canonical ID is a fallback of id. + */ + virtual UBool isFallbackOf(const UnicodeString& id) const; + + /** + *

Return the prefix. This implementation leaves result unchanged. + * Result is returned as a convenience.

+ * + * @param result the output parameter to which the prefix will be appended. + * @return the modified result. + */ + virtual UnicodeString& prefix(UnicodeString& result) const; + + /** + *

A utility to parse the prefix out of a descriptor string. Only + * the (undelimited) prefix, if any, remains in result. Result is returned as a + * convenience.

+ * + * @param result an input/output parameter that on entry is a descriptor, and + * on exit is the prefix of that descriptor. + * @return the modified result. + */ + static UnicodeString& parsePrefix(UnicodeString& result); + + /** + *

A utility to parse the suffix out of a descriptor string. Only + * the (undelimited) suffix, if any, remains in result. Result is returned as a + * convenience.

+ * + * @param result an input/output parameter that on entry is a descriptor, and + * on exit is the suffix of that descriptor. + * @return the modified result. + */ + static UnicodeString& parseSuffix(UnicodeString& result); + +public: + /** + * UObject RTTI boilerplate. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * UObject RTTI boilerplate. + */ + virtual UClassID getDynamicClassID() const; + +#ifdef SERVICE_DEBUG + public: + virtual UnicodeString& debug(UnicodeString& result) const; + virtual UnicodeString& debugClass(UnicodeString& result) const; +#endif + +}; + + /******************************************************************* + * ICUServiceFactory + */ + + /** + *

An implementing ICUServiceFactory generates the service objects maintained by the + * service. A factory generates a service object from a key, + * updates id->factory mappings, and returns the display name for + * a supported id.

+ */ +class U_COMMON_API ICUServiceFactory : public UObject { + public: + virtual ~ICUServiceFactory(); + + /** + *

Create a service object from the key, if this factory + * supports the key. Otherwise, return NULL.

+ * + *

If the factory supports the key, then it can call + * the service's getKey(ICUServiceKey, String[], ICUServiceFactory) method + * passing itself as the factory to get the object that + * the service would have created prior to the factory's + * registration with the service. This can change the + * key, so any information required from the key should + * be extracted before making such a callback.

+ * + * @param key the service key. + * @param service the service with which this factory is registered. + * @param status the error code status. + * @return the service object, or NULL if the factory does not support the key. + */ + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const = 0; + + /** + *

Update result to reflect the IDs (not descriptors) that this + * factory publicly handles. Result contains mappings from ID to + * factory. On entry it will contain all (visible) mappings from + * previously-registered factories.

+ * + *

This function, together with getDisplayName, are used to + * support ICUService::getDisplayNames. The factory determines + * which IDs (of those it supports) it will make visible, and of + * those, which it will provide localized display names for. In + * most cases it will register mappings from all IDs it supports + * to itself.

+ * + * @param result the mapping table to update. + * @param status the error code status. + */ + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const = 0; + + /** + *

Return, in result, the display name of the id in the provided locale. + * This is an id, not a descriptor. If the id is + * not visible, sets result to bogus. If the + * incoming result is bogus, it remains bogus. Result is returned as a + * convenience. Results are not defined if id is not one supported by this + * factory.

+ * + * @param id a visible id supported by this factory. + * @param locale the locale for which to generate the corresponding localized display name. + * @param result output parameter to hold the display name. + * @return result. + */ + virtual UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const = 0; +}; + +/* + ****************************************************************** + */ + + /** + *

A default implementation of factory. This provides default + * implementations for subclasses, and implements a singleton + * factory that matches a single ID and returns a single + * (possibly deferred-initialized) instance. This implements + * updateVisibleIDs to add a mapping from its ID to itself + * if visible is true, or to remove any existing mapping + * for its ID if visible is false. No localization of display + * names is performed.

+ */ +class U_COMMON_API SimpleFactory : public ICUServiceFactory { + protected: + UObject* _instance; + const UnicodeString _id; + const UBool _visible; + + public: + /** + *

Construct a SimpleFactory that maps a single ID to a single + * service instance. If visible is true, the ID will be visible. + * The instance must not be NULL. The SimpleFactory will adopt + * the instance, which must not be changed subsequent to this call.

+ * + * @param instanceToAdopt the service instance to adopt. + * @param id the ID to assign to this service instance. + * @param visible if true, the ID will be visible. + */ + SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible = true); + + /** + *

Destructor.

+ */ + virtual ~SimpleFactory(); + + /** + *

This implementation returns a clone of the service instance if the factory's ID is equal to + * the key's currentID. Service and prefix are ignored.

+ * + * @param key the service key. + * @param service the service with which this factory is registered. + * @param status the error code status. + * @return the service object, or NULL if the factory does not support the key. + */ + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; + + /** + *

This implementation adds a mapping from ID -> this to result if visible is true, + * otherwise it removes ID from result.

+ * + * @param result the mapping table to update. + * @param status the error code status. + */ + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; + + /** + *

This implementation returns the factory ID if it equals id and visible is true, + * otherwise it returns the empty string. (This implementation provides + * no localized id information.)

+ * + * @param id a visible id supported by this factory. + * @param locale the locale for which to generate the corresponding localized display name. + * @param result output parameter to hold the display name. + * @return result. + */ + virtual UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const; + +public: + /** + * UObject RTTI boilerplate. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * UObject RTTI boilerplate. + */ + virtual UClassID getDynamicClassID() const; + +#ifdef SERVICE_DEBUG + public: + virtual UnicodeString& debug(UnicodeString& toAppendTo) const; + virtual UnicodeString& debugClass(UnicodeString& toAppendTo) const; +#endif + +}; + +/* + ****************************************************************** + */ + +/** + *

ServiceListener is the listener that ICUService provides by default. + * ICUService will notifiy this listener when factories are added to + * or removed from the service. Subclasses can provide + * different listener interfaces that extend EventListener, and modify + * acceptsListener and notifyListener as appropriate.

+ */ +class U_COMMON_API ServiceListener : public EventListener { +public: + virtual ~ServiceListener(); + + /** + *

This method is called when the service changes. At the time of the + * call this listener is registered with the service. It must + * not modify the notifier in the context of this call.

+ * + * @param service the service that changed. + */ + virtual void serviceChanged(const ICUService& service) const = 0; + +public: + /** + * UObject RTTI boilerplate. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * UObject RTTI boilerplate. + */ + virtual UClassID getDynamicClassID() const; + +}; + +/* + ****************************************************************** + */ + +/** + *

A StringPair holds a displayName/ID pair. ICUService uses it + * as the array elements returned by getDisplayNames. + */ +class U_COMMON_API StringPair : public UMemory { +public: + /** + *

The display name of the pair.

+ */ + const UnicodeString displayName; + + /** + *

The ID of the pair.

+ */ + const UnicodeString id; + + /** + *

Creates a string pair from a displayName and an ID.

+ * + * @param displayName the displayName. + * @param id the ID. + * @param status the error code status. + * @return a StringPair if the creation was successful, otherwise NULL. + */ + static StringPair* create(const UnicodeString& displayName, + const UnicodeString& id, + UErrorCode& status); + + /** + *

Return true if either string of the pair is bogus.

+ * @return true if either string of the pair is bogus. + */ + UBool isBogus() const; + +private: + StringPair(const UnicodeString& displayName, const UnicodeString& id); +}; + +/******************************************************************* + * ICUService + */ + + /** + *

A Service provides access to service objects that implement a + * particular service, e.g. transliterators. Users provide a String + * id (for example, a locale string) to the service, and get back an + * object for that id. Service objects can be any kind of object. A + * new service object is returned for each query. The caller is + * responsible for deleting it.

+ * + *

Services 'canonicalize' the query ID and use the canonical ID to + * query for the service. The service also defines a mechanism to + * 'fallback' the ID multiple times. Clients can optionally request + * the actual ID that was matched by a query when they use an ID to + * retrieve a service object.

+ * + *

Service objects are instantiated by ICUServiceFactory objects + * registered with the service. The service queries each + * ICUServiceFactory in turn, from most recently registered to + * earliest registered, until one returns a service object. If none + * responds with a service object, a fallback ID is generated, and the + * process repeats until a service object is returned or until the ID + * has no further fallbacks.

+ * + *

In ICU 2.4, UObject (the base class of service instances) does + * not define a polymorphic clone function. ICUService uses clones to + * manage ownership. Thus, for now, ICUService defines an abstract + * method, cloneInstance, that clients must implement to create clones + * of the service instances. This may change in future releases of + * ICU.

+ * + *

ICUServiceFactories can be dynamically registered and + * unregistered with the service. When registered, an + * ICUServiceFactory is installed at the head of the factory list, and + * so gets 'first crack' at any keys or fallback keys. When + * unregistered, it is removed from the service and can no longer be + * located through it. Service objects generated by this factory and + * held by the client are unaffected.

+ * + *

If a service has variants (e.g., the different variants of + * BreakIterator) an ICUServiceFactory can use the prefix of the + * ICUServiceKey to determine the variant of a service to generate. + * If it does not support all variants, it can request + * previously-registered factories to handle the ones it does not + * support.

+ * + *

ICUService uses ICUServiceKeys to query factories and perform + * fallback. The ICUServiceKey defines the canonical form of the ID, + * and implements the fallback strategy. Custom ICUServiceKeys can be + * defined that parse complex IDs into components that + * ICUServiceFactories can more easily use. The ICUServiceKey can + * cache the results of this parsing to save repeated effort. + * ICUService provides convenience APIs that take UnicodeStrings and + * generate default ICUServiceKeys for use in querying.

+ * + *

ICUService provides API to get the list of IDs publicly + * supported by the service (although queries aren't restricted to + * this list). This list contains only 'simple' IDs, and not fully + * unique IDs. ICUServiceFactories are associated with each simple ID + * and the responsible factory can also return a human-readable + * localized version of the simple ID, for use in user interfaces. + * ICUService can also provide an array of the all the localized + * visible IDs and their corresponding internal IDs.

+ * + *

ICUService implements ICUNotifier, so that clients can register + * to receive notification when factories are added or removed from + * the service. ICUService provides a default EventListener + * subinterface, ServiceListener, which can be registered with the + * service. When the service changes, the ServiceListener's + * serviceChanged method is called with the service as the + * argument.

+ * + *

The ICUService API is both rich and generic, and it is expected + * that most implementations will statically 'wrap' ICUService to + * present a more appropriate API-- for example, to declare the type + * of the objects returned from get, to limit the factories that can + * be registered with the service, or to define their own listener + * interface with a custom callback method. They might also customize + * ICUService by overriding it, for example, to customize the + * ICUServiceKey and fallback strategy. ICULocaleService is a + * subclass of ICUService that uses Locale names as IDs and uses + * ICUServiceKeys that implement the standard resource bundle fallback + * strategy. Most clients will wish to subclass it instead of + * ICUService.

+ */ +class U_COMMON_API ICUService : public ICUNotifier { + protected: + /** + * Name useful for debugging. + */ + const UnicodeString name; + + private: + + /** + * Timestamp so iterators can be fail-fast. + */ + uint32_t timestamp; + + /** + * All the factories registered with this service. + */ + UVector* factories; + + /** + * The service cache. + */ + Hashtable* serviceCache; + + /** + * The ID cache. + */ + Hashtable* idCache; + + /** + * The name cache. + */ + DNCache* dnCache; + + /** + * Constructor. + */ + public: + /** + *

Construct a new ICUService.

+ */ + ICUService(); + + /** + *

Construct with a name (useful for debugging).

+ * + * @param name a name to use in debugging. + */ + ICUService(const UnicodeString& name); + + /** + *

Destructor.

+ */ + virtual ~ICUService(); + + /** + *

Return the name of this service. This will be the empty string if none was assigned. + * Returns result as a convenience.

+ * + * @param result an output parameter to contain the name of this service. + * @return the name of this service. + */ + UnicodeString& getName(UnicodeString& result) const; + + /** + *

Convenience override for get(ICUServiceKey&, UnicodeString*). This uses + * createKey to create a key for the provided descriptor.

+ * + * @param descriptor the descriptor. + * @param status the error code status. + * @return the service instance, or NULL. + */ + UObject* get(const UnicodeString& descriptor, UErrorCode& status) const; + + /** + *

Convenience override for get(ICUServiceKey&, UnicodeString*). This uses + * createKey to create a key from the provided descriptor.

+ * + * @param descriptor the descriptor. + * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL. + * @param status the error code status. + * @return the service instance, or NULL. + */ + UObject* get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const; + + /** + *

Convenience override for get(ICUServiceKey&, UnicodeString*).

+ * + * @param key the key. + * @param status the error code status. + * @return the service instance, or NULL. + */ + UObject* getKey(ICUServiceKey& key, UErrorCode& status) const; + + /** + *

Given a key, return a service object, and, if actualReturn + * is not NULL, the descriptor with which it was found in the + * first element of actualReturn. If no service object matches + * this key, returns NULL and leaves actualReturn unchanged.

+ * + *

This queries the cache using the key's descriptor, and if no + * object in the cache matches, tries the key on each + * registered factory, in order. If none generates a service + * object for the key, repeats the process with each fallback of + * the key, until either a factory returns a service object, or the key + * has no fallback. If no object is found, the result of handleDefault + * is returned.

+ * + *

Subclasses can override this method to further customize the + * result before returning it. + * + * @param key the key. + * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL. + * @param status the error code status. + * @return the service instance, or NULL. + */ + virtual UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const; + + /** + *

This version of getKey is only called by ICUServiceFactories within the scope + * of a previous getKey call, to determine what previously-registered factories would + * have returned. For details, see getKey(ICUServiceKey&, UErrorCode&). Subclasses + * should not call it directly, but call through one of the other get functions.

+ * + * @param key the key. + * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL. + * @param factory the factory making the recursive call. + * @param status the error code status. + * @return the service instance, or NULL. + */ + UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const; + + /** + *

Convenience override for getVisibleIDs(String) that passes null + * as the fallback, thus returning all visible IDs.

+ * + * @param result a vector to hold the returned IDs. + * @param status the error code status. + * @return the result vector. + */ + UVector& getVisibleIDs(UVector& result, UErrorCode& status) const; + + /** + *

Return a snapshot of the visible IDs for this service. This + * list will not change as ICUServiceFactories are added or removed, but the + * supported IDs will, so there is no guarantee that all and only + * the IDs in the returned list will be visible and supported by the + * service in subsequent calls.

+ * + *

The IDs are returned as pointers to UnicodeStrings. The + * caller owns the IDs. Previous contents of result are discarded before + * new elements, if any, are added.

+ * + *

matchID is passed to createKey to create a key. If the key + * is not NULL, its isFallbackOf method is used to filter out IDs + * that don't match the key or have it as a fallback.

+ * + * @param result a vector to hold the returned IDs. + * @param matchID an ID used to filter the result, or NULL if all IDs are desired. + * @param status the error code status. + * @return the result vector. + */ + UVector& getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorCode& status) const; + + /** + *

Convenience override for getDisplayName(const UnicodeString&, const Locale&, UnicodeString&) that + * uses the current default locale.

+ * + * @param id the ID for which to retrieve the localized displayName. + * @param result an output parameter to hold the display name. + * @return the modified result. + */ + UnicodeString& getDisplayName(const UnicodeString& id, UnicodeString& result) const; + + /** + *

Given a visible ID, return the display name in the requested locale. + * If there is no directly supported ID corresponding to this ID, result is + * set to bogus.

+ * + * @param id the ID for which to retrieve the localized displayName. + * @param result an output parameter to hold the display name. + * @param locale the locale in which to localize the ID. + * @return the modified result. + */ + UnicodeString& getDisplayName(const UnicodeString& id, UnicodeString& result, const Locale& locale) const; + + /** + *

Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that + * uses the current default Locale as the locale and NULL for + * the matchID.

+ * + * @param result a vector to hold the returned displayName/id StringPairs. + * @param status the error code status. + * @return the modified result vector. + */ + UVector& getDisplayNames(UVector& result, UErrorCode& status) const; + + /** + *

Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that + * uses NULL for the matchID.

+ * + * @param result a vector to hold the returned displayName/id StringPairs. + * @param locale the locale in which to localize the ID. + * @param status the error code status. + * @return the modified result vector. + */ + UVector& getDisplayNames(UVector& result, const Locale& locale, UErrorCode& status) const; + + /** + *

Return a snapshot of the mapping from display names to visible + * IDs for this service. This set will not change as factories + * are added or removed, but the supported IDs will, so there is + * no guarantee that all and only the IDs in the returned map will + * be visible and supported by the service in subsequent calls, + * nor is there any guarantee that the current display names match + * those in the result.

+ * + *

The names are returned as pointers to StringPairs, which + * contain both the displayName and the corresponding ID. The + * caller owns the StringPairs. Previous contents of result are + * discarded before new elements, if any, are added.

+ * + *

matchID is passed to createKey to create a key. If the key + * is not NULL, its isFallbackOf method is used to filter out IDs + * that don't match the key or have it as a fallback.

+ * + * @param result a vector to hold the returned displayName/id StringPairs. + * @param locale the locale in which to localize the ID. + * @param matchID an ID used to filter the result, or NULL if all IDs are desired. + * @param status the error code status. + * @return the result vector. */ + UVector& getDisplayNames(UVector& result, + const Locale& locale, + const UnicodeString* matchID, + UErrorCode& status) const; + + /** + *

A convenience override of registerInstance(UObject*, const UnicodeString&, UBool) + * that defaults visible to true.

+ * + * @param objToAdopt the object to register and adopt. + * @param id the ID to assign to this object. + * @param status the error code status. + * @return a registry key that can be passed to unregister to unregister + * (and discard) this instance. + */ + URegistryKey registerInstance(UObject* objToAdopt, const UnicodeString& id, UErrorCode& status); + + /** + *

Register a service instance with the provided ID. The ID will be + * canonicalized. The canonicalized ID will be returned by + * getVisibleIDs if visible is true. The service instance will be adopted and + * must not be modified subsequent to this call.

+ * + *

This issues a serviceChanged notification to registered listeners.

+ * + *

This implementation wraps the object using + * createSimpleFactory, and calls registerFactory.

+ * + * @param objToAdopt the object to register and adopt. + * @param id the ID to assign to this object. + * @param visible true if getVisibleIDs is to return this ID. + * @param status the error code status. + * @return a registry key that can be passed to unregister() to unregister + * (and discard) this instance. + */ + virtual URegistryKey registerInstance(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status); + + /** + *

Register an ICUServiceFactory. Returns a registry key that + * can be used to unregister the factory. The factory + * must not be modified subsequent to this call. The service owns + * all registered factories. In case of an error, the factory is + * deleted.

+ * + *

This issues a serviceChanged notification to registered listeners.

+ * + *

The default implementation accepts all factories.

+ * + * @param factoryToAdopt the factory to register and adopt. + * @param status the error code status. + * @return a registry key that can be passed to unregister to unregister + * (and discard) this factory. + */ + virtual URegistryKey registerFactory(ICUServiceFactory* factoryToAdopt, UErrorCode& status); + + /** + *

Unregister a factory using a registry key returned by + * registerInstance or registerFactory. After a successful call, + * the factory will be removed from the service factory list and + * deleted, and the key becomes invalid.

+ * + *

This issues a serviceChanged notification to registered + * listeners.

+ * + * @param rkey the registry key. + * @param status the error code status. + * @return true if the call successfully unregistered the factory. + */ + virtual UBool unregister(URegistryKey rkey, UErrorCode& status); + + /** + *

Reset the service to the default factories. The factory + * lock is acquired and then reInitializeFactories is called.

+ * + *

This issues a serviceChanged notification to registered listeners.

+ */ + virtual void reset(void); + + /** + *

Return true if the service is in its default state.

+ * + *

The default implementation returns true if there are no + * factories registered.

+ */ + virtual UBool isDefault(void) const; + + /** + *

Create a key from an ID. If ID is NULL, returns NULL.

+ * + *

The default implementation creates an ICUServiceKey instance. + * Subclasses can override to define more useful keys appropriate + * to the factories they accept.

+ * + * @param a pointer to the ID for which to create a default ICUServiceKey. + * @param status the error code status. + * @return the ICUServiceKey corresponding to ID, or NULL. + */ + virtual ICUServiceKey* createKey(const UnicodeString* id, UErrorCode& status) const; + + /** + *

Clone object so that caller can own the copy. In ICU2.4, UObject doesn't define + * clone, so we need an instance-aware method that knows how to do this. + * This is public so factories can call it, but should really be protected.

+ * + * @param instance the service instance to clone. + * @return a clone of the passed-in instance, or NULL if cloning was unsuccessful. + */ + virtual UObject* cloneInstance(UObject* instance) const = 0; + + + /************************************************************************ + * Subclassing API + */ + + protected: + + /** + *

Create a factory that wraps a single service object. Called by registerInstance.

+ * + *

The default implementation returns an instance of SimpleFactory.

+ * + * @param instanceToAdopt the service instance to adopt. + * @param id the ID to assign to this service instance. + * @param visible if true, the ID will be visible. + * @param status the error code status. + * @return an instance of ICUServiceFactory that maps this instance to the provided ID. + */ + virtual ICUServiceFactory* createSimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status); + + /** + *

Reinitialize the factory list to its default state. After this call, isDefault() + * must return true.

+ * + *

This issues a serviceChanged notification to registered listeners.

+ * + *

The default implementation clears the factory list. + * Subclasses can override to provide other default initialization + * of the factory list. Subclasses must not call this method + * directly, since it must only be called while holding write + * access to the factory list.

+ */ + virtual void reInitializeFactories(void); + + /** + *

Default handler for this service if no factory in the factory list + * handled the key passed to getKey.

+ * + *

The default implementation returns NULL.

+ * + * @param key the key. + * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL. + * @param status the error code status. + * @return the service instance, or NULL. + */ + virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const; + + /** + *

Clear caches maintained by this service.

+ * + *

Subclasses can override if they implement additional caches + * that need to be cleared when the service changes. Subclasses + * should generally not call this method directly, as it must only + * be called while synchronized on the factory lock.

+ */ + virtual void clearCaches(void); + + /** + *

Return true if the listener is accepted.

+ * + *

The default implementation accepts the listener if it is + * a ServiceListener. Subclasses can override this to accept + * different listeners.

+ * + * @param l the listener to test. + * @return true if the service accepts the listener. + */ + virtual UBool acceptsListener(const EventListener& l) const; + + /** + *

Notify the listener of a service change.

+ * + *

The default implementation assumes a ServiceListener. + * If acceptsListener has been overridden to accept different + * listeners, this should be overridden as well.

+ * + * @param l the listener to notify. + */ + virtual void notifyListener(EventListener& l) const; + + /************************************************************************ + * Utilities for subclasses. + */ + + /** + *

Clear only the service cache.

+ * + *

This can be called by subclasses when a change affects the service + * cache but not the ID caches, e.g., when the default locale changes + * the resolution of IDs also changes, requiring the cache to be + * flushed, but not the visible IDs themselves.

+ */ + void clearServiceCache(void); + + /** + *

Return a map from visible IDs to factories. + * This must only be called when the mutex is held.

+ * + * @param status the error code status. + * @return a Hashtable containing mappings from visible + * IDs to factories. + */ + const Hashtable* getVisibleIDMap(UErrorCode& status) const; + + /** + *

Allow subclasses to read the time stamp.

+ * + * @return the timestamp. + */ + int32_t getTimestamp(void) const; + + /** + *

Return the number of registered factories.

+ * + * @return the number of factories registered at the time of the call. + */ + int32_t countFactories(void) const; + +private: + + friend class ::ICUServiceTest; // give tests access to countFactories. +}; + +U_NAMESPACE_END + + /* UCONFIG_NO_SERVICE */ +#endif + + /* ICUSERV_H */ +#endif + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/servloc.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/servloc.h new file mode 100644 index 0000000000000000000000000000000000000000..ccf6433379ddb3353eb7e25496b2ae344938ec70 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/servloc.h @@ -0,0 +1,551 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/** + ******************************************************************************* + * Copyright (C) 2001-2011, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + * + ******************************************************************************* + */ +#ifndef ICULSERV_H +#define ICULSERV_H + +#include "unicode/utypes.h" + +#if UCONFIG_NO_SERVICE + +U_NAMESPACE_BEGIN + +/* + * Allow the declaration of APIs with pointers to ICUService + * even when service is removed from the build. + */ +class ICULocaleService; + +U_NAMESPACE_END + +#else + +#include "unicode/unistr.h" +#include "unicode/locid.h" +#include "unicode/strenum.h" + +#include "hash.h" +#include "uvector.h" + +#include "serv.h" +#include "locutil.h" + +U_NAMESPACE_BEGIN + +class ICULocaleService; + +class LocaleKey; +class LocaleKeyFactory; +class SimpleLocaleKeyFactory; +class ServiceListener; + +/* + ****************************************************************** + */ + +/** + * A subclass of Key that implements a locale fallback mechanism. + * The first locale to search for is the locale provided by the + * client, and the fallback locale to search for is the current + * default locale. If a prefix is present, the currentDescriptor + * includes it before the locale proper, separated by "/". This + * is the default key instantiated by ICULocaleService.

+ * + *

Canonicalization adjusts the locale string so that the + * section before the first understore is in lower case, and the rest + * is in upper case, with no trailing underscores.

+ */ + +class U_COMMON_API LocaleKey : public ICUServiceKey { + private: + int32_t _kind; + UnicodeString _primaryID; + UnicodeString _fallbackID; + UnicodeString _currentID; + + public: + enum { + KIND_ANY = -1 + }; + + /** + * Create a LocaleKey with canonical primary and fallback IDs. + */ + static LocaleKey* createWithCanonicalFallback(const UnicodeString* primaryID, + const UnicodeString* canonicalFallbackID, + UErrorCode& status); + + /** + * Create a LocaleKey with canonical primary and fallback IDs. + */ + static LocaleKey* createWithCanonicalFallback(const UnicodeString* primaryID, + const UnicodeString* canonicalFallbackID, + int32_t kind, + UErrorCode& status); + + protected: + /** + * PrimaryID is the user's requested locale string, + * canonicalPrimaryID is this string in canonical form, + * fallbackID is the current default locale's string in + * canonical form. + */ + LocaleKey(const UnicodeString& primaryID, + const UnicodeString& canonicalPrimaryID, + const UnicodeString* canonicalFallbackID, + int32_t kind); + + public: + /** + * Append the prefix associated with the kind, or nothing if the kind is KIND_ANY. + */ + virtual UnicodeString& prefix(UnicodeString& result) const; + + /** + * Return the kind code associated with this key. + */ + virtual int32_t kind() const; + + /** + * Return the canonicalID. + */ + virtual UnicodeString& canonicalID(UnicodeString& result) const; + + /** + * Return the currentID. + */ + virtual UnicodeString& currentID(UnicodeString& result) const; + + /** + * Return the (canonical) current descriptor, or null if no current id. + */ + virtual UnicodeString& currentDescriptor(UnicodeString& result) const; + + /** + * Convenience method to return the locale corresponding to the (canonical) original ID. + */ + virtual Locale& canonicalLocale(Locale& result) const; + + /** + * Convenience method to return the locale corresponding to the (canonical) current ID. + */ + virtual Locale& currentLocale(Locale& result) const; + + /** + * If the key has a fallback, modify the key and return true, + * otherwise return false.

+ * + *

First falls back through the primary ID, then through + * the fallbackID. The final fallback is the empty string, + * unless the primary id was the empty string, in which case + * there is no fallback. + */ + virtual UBool fallback(); + + /** + * Return true if a key created from id matches, or would eventually + * fallback to match, the canonical ID of this key. + */ + virtual UBool isFallbackOf(const UnicodeString& id) const; + + public: + /** + * UObject boilerplate. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + virtual UClassID getDynamicClassID() const; + + /** + * Destructor. + */ + virtual ~LocaleKey(); + +#ifdef SERVICE_DEBUG + public: + virtual UnicodeString& debug(UnicodeString& result) const; + virtual UnicodeString& debugClass(UnicodeString& result) const; +#endif + +}; + +/* + ****************************************************************** + */ + +/** + * A subclass of ICUServiceFactory that uses LocaleKeys, and is able to + * 'cover' more specific locales with more general locales that it + * supports. + * + *

Coverage may be either of the values VISIBLE or INVISIBLE. + * + *

'Visible' indicates that the specific locale(s) supported by + * the factory are registered in getSupportedIDs, 'Invisible' + * indicates that they are not. + * + *

Localization of visible ids is handled + * by the handling factory, regardless of kind. + */ +class U_COMMON_API LocaleKeyFactory : public ICUServiceFactory { +protected: + const UnicodeString _name; + const int32_t _coverage; + +public: + enum { + /** + * Coverage value indicating that the factory makes + * its locales visible, and does not cover more specific + * locales. + */ + VISIBLE = 0, + + /** + * Coverage value indicating that the factory does not make + * its locales visible, and does not cover more specific + * locales. + */ + INVISIBLE = 1 + }; + + /** + * Destructor. + */ + virtual ~LocaleKeyFactory(); + +protected: + /** + * Constructor used by subclasses. + */ + LocaleKeyFactory(int32_t coverage); + + /** + * Constructor used by subclasses. + */ + LocaleKeyFactory(int32_t coverage, const UnicodeString& name); + + /** + * Implement superclass abstract method. This checks the currentID of + * the key against the supported IDs, and passes the canonicalLocale and + * kind off to handleCreate (which subclasses must implement). + */ +public: + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; + +protected: + virtual UBool handlesKey(const ICUServiceKey& key, UErrorCode& status) const; + +public: + /** + * Override of superclass method. This adjusts the result based + * on the coverage rule for this factory. + */ + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; + + /** + * Return a localized name for the locale represented by id. + */ + virtual UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const; + +protected: + /** + * Utility method used by create(ICUServiceKey, ICUService). Subclasses can implement + * this instead of create. The default returns NULL. + */ + virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const; + + /** + * Return true if this id is one the factory supports (visible or + * otherwise). + */ + // virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const; + + /** + * Return the set of ids that this factory supports (visible or + * otherwise). This can be called often and might need to be + * cached if it is expensive to create. + */ + virtual const Hashtable* getSupportedIDs(UErrorCode& status) const; + +public: + /** + * UObject boilerplate. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + virtual UClassID getDynamicClassID() const; + +#ifdef SERVICE_DEBUG + public: + virtual UnicodeString& debug(UnicodeString& result) const; + virtual UnicodeString& debugClass(UnicodeString& result) const; +#endif + +}; + +/* + ****************************************************************** + */ + +/** + * A LocaleKeyFactory that just returns a single object for a kind/locale. + */ + +class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory { + private: + UObject* _obj; + UnicodeString _id; + const int32_t _kind; + + public: + SimpleLocaleKeyFactory(UObject* objToAdopt, + const UnicodeString& locale, + int32_t kind, + int32_t coverage); + + SimpleLocaleKeyFactory(UObject* objToAdopt, + const Locale& locale, + int32_t kind, + int32_t coverage); + + /** + * Destructor. + */ + virtual ~SimpleLocaleKeyFactory(); + + /** + * Override of superclass method. Returns the service object if kind/locale match. Service is not used. + */ + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; + + /** + * Override of superclass method. This adjusts the result based + * on the coverage rule for this factory. + */ + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; + + protected: + /** + * Return true if this id is equal to the locale name. + */ + //virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const; + + +public: + /** + * UObject boilerplate. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + virtual UClassID getDynamicClassID() const; + +#ifdef SERVICE_DEBUG + public: + virtual UnicodeString& debug(UnicodeString& result) const; + virtual UnicodeString& debugClass(UnicodeString& result) const; +#endif + +}; + +/* + ****************************************************************** + */ + +/** + * A LocaleKeyFactory that creates a service based on the ICU locale data. + * This is a base class for most ICU factories. Subclasses instantiate it + * with a constructor that takes a bundle name, which determines the supported + * IDs. Subclasses then override handleCreate to create the actual service + * object. The default implementation returns a resource bundle. + */ +class U_COMMON_API ICUResourceBundleFactory : public LocaleKeyFactory +{ + protected: + UnicodeString _bundleName; + + public: + /** + * Convenience constructor that uses the main ICU bundle name. + */ + ICUResourceBundleFactory(); + + /** + * A service factory based on ICU resource data in resources with + * the given name. This should be a 'path' that can be passed to + * ures_openAvailableLocales, such as U_ICUDATA or U_ICUDATA_COLL. + * The empty string is equivalent to U_ICUDATA. + */ + ICUResourceBundleFactory(const UnicodeString& bundleName); + + /** + * Destructor + */ + virtual ~ICUResourceBundleFactory(); + +protected: + /** + * Return the supported IDs. This is the set of all locale names in ICULocaleData. + */ + virtual const Hashtable* getSupportedIDs(UErrorCode& status) const; + + /** + * Create the service. The default implementation returns the resource bundle + * for the locale, ignoring kind, and service. + */ + virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const; + +public: + /** + * UObject boilerplate. + */ + static UClassID U_EXPORT2 getStaticClassID(); + virtual UClassID getDynamicClassID() const; + + +#ifdef SERVICE_DEBUG + public: + virtual UnicodeString& debug(UnicodeString& result) const; + virtual UnicodeString& debugClass(UnicodeString& result) const; +#endif + +}; + +/* + ****************************************************************** + */ + +class U_COMMON_API ICULocaleService : public ICUService +{ + private: + Locale fallbackLocale; + UnicodeString fallbackLocaleName; + + public: + /** + * Construct an ICULocaleService. + */ + ICULocaleService(); + + /** + * Construct an ICULocaleService with a name (useful for debugging). + */ + ICULocaleService(const UnicodeString& name); + + /** + * Destructor. + */ + virtual ~ICULocaleService(); + +#if 0 + // redeclare because of overload resolution rules? + // no, causes ambiguities since both UnicodeString and Locale have constructors that take a const char* + // need some compiler flag to remove warnings + UObject* get(const UnicodeString& descriptor, UErrorCode& status) const { + return ICUService::get(descriptor, status); + } + + UObject* get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const { + return ICUService::get(descriptor, actualReturn, status); + } +#endif + + /** + * Convenience override for callers using locales. This calls + * get(Locale, int, Locale[]) with KIND_ANY for kind and null for + * actualReturn. + */ + UObject* get(const Locale& locale, UErrorCode& status) const; + + /** + * Convenience override for callers using locales. This calls + * get(Locale, int, Locale[]) with a null actualReturn. + */ + UObject* get(const Locale& locale, int32_t kind, UErrorCode& status) const; + + /** + * Convenience override for callers using locales. This calls + * get(Locale, String, Locale[]) with a null kind. + */ + UObject* get(const Locale& locale, Locale* actualReturn, UErrorCode& status) const; + + /** + * Convenience override for callers using locales. This uses + * createKey(Locale.toString(), kind) to create a key, calls getKey, and then + * if actualReturn is not null, returns the actualResult from + * getKey (stripping any prefix) into a Locale. + */ + UObject* get(const Locale& locale, int32_t kind, Locale* actualReturn, UErrorCode& status) const; + + /** + * Convenience override for callers using locales. This calls + * registerObject(Object, Locale, int32_t kind, int coverage) + * passing KIND_ANY for the kind, and VISIBLE for the coverage. + */ + virtual URegistryKey registerInstance(UObject* objToAdopt, const Locale& locale, UErrorCode& status); + + /** + * Convenience function for callers using locales. This calls + * registerObject(Object, Locale, int kind, int coverage) + * passing VISIBLE for the coverage. + */ + virtual URegistryKey registerInstance(UObject* objToAdopt, const Locale& locale, int32_t kind, UErrorCode& status); + + /** + * Convenience function for callers using locales. This instantiates + * a SimpleLocaleKeyFactory, and registers the factory. + */ + virtual URegistryKey registerInstance(UObject* objToAdopt, const Locale& locale, int32_t kind, int32_t coverage, UErrorCode& status); + + + /** + * (Stop compiler from complaining about hidden overrides.) + * Since both UnicodeString and Locale have constructors that take const char*, adding a public + * method that takes UnicodeString causes ambiguity at call sites that use const char*. + * We really need a flag that is understood by all compilers that will suppress the warning about + * hidden overrides. + */ + virtual URegistryKey registerInstance(UObject* objToAdopt, const UnicodeString& locale, UBool visible, UErrorCode& status); + + /** + * Convenience method for callers using locales. This returns the standard + * service ID enumeration. + */ + virtual StringEnumeration* getAvailableLocales(void) const; + + protected: + + /** + * Return the name of the current fallback locale. If it has changed since this was + * last accessed, the service cache is cleared. + */ + const UnicodeString& validateFallbackLocale() const; + + /** + * Override superclass createKey method. + */ + virtual ICUServiceKey* createKey(const UnicodeString* id, UErrorCode& status) const; + + /** + * Additional createKey that takes a kind. + */ + virtual ICUServiceKey* createKey(const UnicodeString* id, int32_t kind, UErrorCode& status) const; + + friend class ServiceEnumeration; +}; + +U_NAMESPACE_END + + /* UCONFIG_NO_SERVICE */ +#endif + + /* ICULSERV_H */ +#endif + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/servnotf.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/servnotf.h new file mode 100644 index 0000000000000000000000000000000000000000..73ce38c772e948e2837af86d9d02de7cee3637fa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/servnotf.h @@ -0,0 +1,125 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/** + ******************************************************************************* + * Copyright (C) 2001-2014, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + */ +#ifndef ICUNOTIF_H +#define ICUNOTIF_H + +#include "unicode/utypes.h" + +#if UCONFIG_NO_SERVICE + +U_NAMESPACE_BEGIN + +/* + * Allow the declaration of APIs with pointers to BreakIterator + * even when break iteration is removed from the build. + */ +class ICUNotifier; + +U_NAMESPACE_END + +#else + +#include "unicode/uobject.h" +#include "unicode/unistr.h" + +#include "mutex.h" +#include "uvector.h" + +U_NAMESPACE_BEGIN + +class U_COMMON_API EventListener : public UObject { +public: + virtual ~EventListener(); + +public: + static UClassID U_EXPORT2 getStaticClassID(); + + virtual UClassID getDynamicClassID() const; + +public: +#ifdef SERVICE_DEBUG + virtual UnicodeString& debug(UnicodeString& result) const { + return debugClass(result); + } + + virtual UnicodeString& debugClass(UnicodeString& result) const { + return result.append((UnicodeString)"Key"); + } +#endif +}; + +/** + *

Abstract implementation of a notification facility. Clients add + * EventListeners with addListener and remove them with removeListener. + * Notifiers call notifyChanged when they wish to notify listeners. + * This queues the listener list on the notification thread, which + * eventually dequeues the list and calls notifyListener on each + * listener in the list.

+ * + *

Subclasses override acceptsListener and notifyListener + * to add type-safe notification. AcceptsListener should return + * true if the listener is of the appropriate type; ICUNotifier + * itself will ensure the listener is non-null and that the + * identical listener is not already registered with the Notifier. + * NotifyListener should cast the listener to the appropriate + * type and call the appropriate method on the listener. + */ + +class U_COMMON_API ICUNotifier : public UMemory { +private: UVector* listeners; + +public: + ICUNotifier(void); + + virtual ~ICUNotifier(void); + + /** + * Add a listener to be notified when notifyChanged is called. + * The listener must not be null. AcceptsListener must return + * true for the listener. Attempts to concurrently + * register the identical listener more than once will be + * silently ignored. + */ + virtual void addListener(const EventListener* l, UErrorCode& status); + + /** + * Stop notifying this listener. The listener must + * not be null. Attempts to remove a listener that is + * not registered will be silently ignored. + */ + virtual void removeListener(const EventListener* l, UErrorCode& status); + + /** + * ICU doesn't spawn its own threads. All listeners are notified in + * the thread of the caller. Misbehaved listeners can therefore + * indefinitely block the calling thread. Callers should beware of + * deadlock situations. + */ + virtual void notifyChanged(void); + +protected: + /** + * Subclasses implement this to return true if the listener is + * of the appropriate type. + */ + virtual UBool acceptsListener(const EventListener& l) const = 0; + + /** + * Subclasses implement this to notify the listener. + */ + virtual void notifyListener(EventListener& l) const = 0; +}; + +U_NAMESPACE_END + +/* UCONFIG_NO_SERVICE */ +#endif + +/* ICUNOTIF_H */ +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/sharedobject.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/sharedobject.h new file mode 100644 index 0000000000000000000000000000000000000000..6ccfb27b018baa5b1c734b89ebf7dd0385f24ace --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/sharedobject.h @@ -0,0 +1,184 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2015-2016, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* sharedobject.h +*/ + +#ifndef __SHAREDOBJECT_H__ +#define __SHAREDOBJECT_H__ + + +#include "unicode/uobject.h" +#include "umutex.h" + +U_NAMESPACE_BEGIN + +class SharedObject; + +/** + * Base class for unified cache exposing enough methods to SharedObject + * instances to allow their addRef() and removeRef() methods to + * update cache metrics. No other part of ICU, except for SharedObject, + * should directly call the methods of this base class. + */ +class U_COMMON_API UnifiedCacheBase : public UObject { +public: + UnifiedCacheBase() { } + + /** + * Notify the cache implementation that an object was seen transitioning to + * zero hard references. The cache may use this to keep track the number of + * unreferenced SharedObjects, and to trigger evictions. + */ + virtual void handleUnreferencedObject() const = 0; + + virtual ~UnifiedCacheBase(); +private: + UnifiedCacheBase(const UnifiedCacheBase &); + UnifiedCacheBase &operator=(const UnifiedCacheBase &); +}; + +/** + * Base class for shared, reference-counted, auto-deleted objects. + * Subclasses can be immutable. + * If they are mutable, then they must implement their copy constructor + * so that copyOnWrite() works. + * + * Either stack-allocate, use LocalPointer, or use addRef()/removeRef(). + * Sharing requires reference-counting. + */ +class U_COMMON_API SharedObject : public UObject { +public: + /** Initializes totalRefCount, softRefCount to 0. */ + SharedObject() : + softRefCount(0), + hardRefCount(0), + cachePtr(NULL) {} + + /** Initializes totalRefCount, softRefCount to 0. */ + SharedObject(const SharedObject &other) : + UObject(other), + softRefCount(0), + hardRefCount(0), + cachePtr(NULL) {} + + virtual ~SharedObject(); + + /** + * Increments the number of hard references to this object. Thread-safe. + * Not for use from within the Unified Cache implementation. + */ + void addRef() const; + + /** + * Decrements the number of hard references to this object, and + * arrange for possible cache-eviction and/or deletion if ref + * count goes to zero. Thread-safe. + * + * Not for use from within the UnifiedCache implementation. + */ + void removeRef() const; + + /** + * Returns the number of hard references for this object. + * Uses a memory barrier. + */ + int32_t getRefCount() const; + + /** + * If noHardReferences() == true then this object has no hard references. + * Must be called only from within the internals of UnifiedCache. + */ + inline UBool noHardReferences() const { return getRefCount() == 0; } + + /** + * If hasHardReferences() == true then this object has hard references. + * Must be called only from within the internals of UnifiedCache. + */ + inline UBool hasHardReferences() const { return getRefCount() != 0; } + + /** + * Deletes this object if it has no references. + * Available for non-cached SharedObjects only. Ownership of cached objects + * is with the UnifiedCache, which is solely responsible for eviction and deletion. + */ + void deleteIfZeroRefCount() const; + + + /** + * Returns a writable version of ptr. + * If there is exactly one owner, then ptr itself is returned as a + * non-const pointer. + * If there are multiple owners, then ptr is replaced with a + * copy-constructed clone, + * and that is returned. + * Returns NULL if cloning failed. + * + * T must be a subclass of SharedObject. + */ + template + static T *copyOnWrite(const T *&ptr) { + const T *p = ptr; + if(p->getRefCount() <= 1) { return const_cast(p); } + T *p2 = new T(*p); + if(p2 == NULL) { return NULL; } + p->removeRef(); + ptr = p2; + p2->addRef(); + return p2; + } + + /** + * Makes dest an owner of the object pointed to by src while adjusting + * reference counts and deleting the previous object dest pointed to + * if necessary. Before this call is made, dest must either be NULL or + * be included in the reference count of the object it points to. + * + * T must be a subclass of SharedObject. + */ + template + static void copyPtr(const T *src, const T *&dest) { + if(src != dest) { + if(dest != NULL) { dest->removeRef(); } + dest = src; + if(src != NULL) { src->addRef(); } + } + } + + /** + * Equivalent to copyPtr(NULL, dest). + */ + template + static void clearPtr(const T *&ptr) { + if (ptr != NULL) { + ptr->removeRef(); + ptr = NULL; + } + } + +private: + /** + * The number of references from the UnifiedCache, which is + * the number of times that the sharedObject is stored as a hash table value. + * For use by UnifiedCache implementation code only. + * All access is synchronized by UnifiedCache's gCacheMutex + */ + mutable int32_t softRefCount; + friend class UnifiedCache; + + /** + * Reference count, excluding references from within the UnifiedCache implementation. + */ + mutable u_atomic_int32_t hardRefCount; + + mutable const UnifiedCacheBase *cachePtr; + +}; + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/sprpimpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/sprpimpl.h new file mode 100644 index 0000000000000000000000000000000000000000..ca0bcdb51695cc756aa4e36f73cb48f1477bd207 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/sprpimpl.h @@ -0,0 +1,130 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * + * Copyright (C) 2003-2006, International Business Machines + * Corporation and others. All Rights Reserved. + * + ******************************************************************************* + * file name: sprpimpl.h + * encoding: UTF-8 + * tab size: 8 (not used) + * indentation:4 + * + * created on: 2003feb1 + * created by: Ram Viswanadha + */ + +#ifndef SPRPIMPL_H +#define SPRPIMPL_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_IDNA + +#include "unicode/ustring.h" +#include "unicode/parseerr.h" +#include "unicode/usprep.h" +#include "unicode/udata.h" +#include "utrie.h" +#include "udataswp.h" +#include "ubidi_props.h" + +#define _SPREP_DATA_TYPE "spp" + +enum UStringPrepType{ + USPREP_UNASSIGNED = 0x0000 , + USPREP_MAP = 0x0001 , + USPREP_PROHIBITED = 0x0002 , + USPREP_DELETE = 0x0003 , + USPREP_TYPE_LIMIT = 0x0004 +}; + +typedef enum UStringPrepType UStringPrepType; + +#ifdef USPREP_TYPE_NAMES_ARRAY +static const char* usprepTypeNames[] ={ + "UNASSIGNED" , + "MAP" , + "PROHIBITED" , + "DELETE", + "TYPE_LIMIT" +}; +#endif + +enum{ + _SPREP_NORMALIZATION_ON = 0x0001, + _SPREP_CHECK_BIDI_ON = 0x0002 +}; + +enum{ + _SPREP_TYPE_THRESHOLD = 0xFFF0, + _SPREP_MAX_INDEX_VALUE = 0x3FBF, /*16139*/ + _SPREP_MAX_INDEX_TOP_LENGTH = 0x0003 +}; + +/* indexes[] value names */ +enum { + _SPREP_INDEX_TRIE_SIZE = 0, /* number of bytes in StringPrep trie */ + _SPREP_INDEX_MAPPING_DATA_SIZE = 1, /* The array that contains the mapping */ + _SPREP_NORM_CORRECTNS_LAST_UNI_VERSION = 2, /* The index of Unicode version of last entry in NormalizationCorrections.txt */ + _SPREP_ONE_UCHAR_MAPPING_INDEX_START = 3, /* The starting index of 1 UChar mapping index in the mapping data array */ + _SPREP_TWO_UCHARS_MAPPING_INDEX_START = 4, /* The starting index of 2 UChars mapping index in the mapping data array */ + _SPREP_THREE_UCHARS_MAPPING_INDEX_START = 5, /* The starting index of 3 UChars mapping index in the mapping data array */ + _SPREP_FOUR_UCHARS_MAPPING_INDEX_START = 6, /* The starting index of 4 UChars mapping index in the mapping data array */ + _SPREP_OPTIONS = 7, /* Bit set of options to turn on in the profile */ + _SPREP_INDEX_TOP=16 /* changing this requires a new formatVersion */ +}; + +typedef struct UStringPrepKey UStringPrepKey; + + +struct UStringPrepKey{ + char* name; + char* path; +}; + +struct UStringPrepProfile{ + int32_t indexes[_SPREP_INDEX_TOP]; + UTrie sprepTrie; + const uint16_t* mappingData; + UDataMemory* sprepData; + int32_t refCount; + UBool isDataLoaded; + UBool doNFKC; + UBool checkBiDi; +}; + +/** + * Helper function for populating the UParseError struct + * @internal + */ +U_CAPI void U_EXPORT2 +uprv_syntaxError(const UChar* rules, + int32_t pos, + int32_t rulesLen, + UParseError* parseError); + + +/** + * Swap StringPrep .spp profile data. See udataswp.h. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +usprep_swap(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +#endif /* #if !UCONFIG_NO_IDNA */ + +#endif + +/* + * Hey, Emacs, please set the following: + * + * Local Variables: + * indent-tabs-mode: nil + * End: + * + */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/static_unicode_sets.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/static_unicode_sets.h new file mode 100644 index 0000000000000000000000000000000000000000..5d90ce5908de9817be4069ed717ff56f04d6fa0d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/static_unicode_sets.h @@ -0,0 +1,140 @@ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// This file contains utilities to deal with static-allocated UnicodeSets. +// +// Common use case: you write a "private static final" UnicodeSet in Java, and +// want something similarly easy in C++. Originally written for number +// parsing, but this header can be used for other applications. +// +// Main entrypoint: `unisets::get(unisets::MY_SET_ID_HERE)` +// +// This file is in common instead of i18n because it is needed by ucurr.cpp. +// +// Author: sffc + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING +#ifndef __STATIC_UNICODE_SETS_H__ +#define __STATIC_UNICODE_SETS_H__ + +#include "unicode/uniset.h" +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN +namespace unisets { + +enum Key { + // NONE is used to indicate null in chooseFrom(). + // EMPTY is used to get an empty UnicodeSet. + NONE = -1, + EMPTY = 0, + + // Ignorables + DEFAULT_IGNORABLES, + STRICT_IGNORABLES, + + // Separators + // Notes: + // - COMMA is a superset of STRICT_COMMA + // - PERIOD is a superset of SCRICT_PERIOD + // - ALL_SEPARATORS is the union of COMMA, PERIOD, and OTHER_GROUPING_SEPARATORS + // - STRICT_ALL_SEPARATORS is the union of STRICT_COMMA, STRICT_PERIOD, and OTHER_GRP_SEPARATORS + COMMA, + PERIOD, + STRICT_COMMA, + STRICT_PERIOD, + APOSTROPHE_SIGN, + OTHER_GROUPING_SEPARATORS, + ALL_SEPARATORS, + STRICT_ALL_SEPARATORS, + + // Symbols + MINUS_SIGN, + PLUS_SIGN, + PERCENT_SIGN, + PERMILLE_SIGN, + INFINITY_SIGN, + + // Currency Symbols + DOLLAR_SIGN, + POUND_SIGN, + RUPEE_SIGN, + YEN_SIGN, + WON_SIGN, + + // Other + DIGITS, + + // Combined Separators with Digits (for lead code points) + DIGITS_OR_ALL_SEPARATORS, + DIGITS_OR_STRICT_ALL_SEPARATORS, + + // The number of elements in the enum. + UNISETS_KEY_COUNT +}; + +/** + * Gets the static-allocated UnicodeSet according to the provided key. The + * pointer will be deleted during u_cleanup(); the caller should NOT delete it. + * + * Exported as U_COMMON_API for ucurr.cpp + * + * This method is always safe and OK to chain: in the case of a memory or other + * error, it returns an empty set from static memory. + * + * Example: + * + * UBool hasIgnorables = unisets::get(unisets::DEFAULT_IGNORABLES)->contains(...); + * + * @param key The desired UnicodeSet according to the enum in this file. + * @return The requested UnicodeSet. Guaranteed to be frozen and non-null, but + * may be empty if an error occurred during data loading. + */ +U_COMMON_API const UnicodeSet* get(Key key); + +/** + * Checks if the UnicodeSet given by key1 contains the given string. + * + * Exported as U_COMMON_API for numparse_decimal.cpp + * + * @param str The string to check. + * @param key1 The set to check. + * @return key1 if the set contains str, or NONE if not. + */ +U_COMMON_API Key chooseFrom(UnicodeString str, Key key1); + +/** + * Checks if the UnicodeSet given by either key1 or key2 contains the string. + * + * Exported as U_COMMON_API for numparse_decimal.cpp + * + * @param str The string to check. + * @param key1 The first set to check. + * @param key2 The second set to check. + * @return key1 if that set contains str; key2 if that set contains str; or + * NONE if neither set contains str. + */ +U_COMMON_API Key chooseFrom(UnicodeString str, Key key1, Key key2); + +// TODO: Load these from data: ICU-20108 +// Unused in C++: +// Key chooseCurrency(UnicodeString str); +// Used instead: +static const struct { + Key key; + UChar32 exemplar; +} kCurrencyEntries[] = { + {DOLLAR_SIGN, u'$'}, + {POUND_SIGN, u'£'}, + {RUPEE_SIGN, u'₹'}, + {YEN_SIGN, u'¥'}, + {WON_SIGN, u'₩'}, +}; + +} // namespace unisets +U_NAMESPACE_END + +#endif //__STATIC_UNICODE_SETS_H__ +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uarrsort.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uarrsort.h new file mode 100644 index 0000000000000000000000000000000000000000..a55dca5b9eabfe8b00d648b9c410850676bdd5c3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uarrsort.h @@ -0,0 +1,103 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2003-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uarrsort.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2003aug04 +* created by: Markus W. Scherer +* +* Internal function for sorting arrays. +*/ + +#ifndef __UARRSORT_H__ +#define __UARRSORT_H__ + +#include "unicode/utypes.h" + +U_CDECL_BEGIN +/** + * Function type for comparing two items as part of sorting an array or similar. + * Callback function for uprv_sortArray(). + * + * @param context Application-specific pointer, passed through by uprv_sortArray(). + * @param left Pointer to the "left" item. + * @param right Pointer to the "right" item. + * @return 32-bit signed integer comparison result: + * <0 if left0 if left>right + * + * @internal + */ +typedef int32_t U_CALLCONV +UComparator(const void *context, const void *left, const void *right); +U_CDECL_END + +/** + * Array sorting function. + * Uses a UComparator for comparing array items to each other, and simple + * memory copying to move items. + * + * @param array The array to be sorted. + * @param length The number of items in the array. + * @param itemSize The size in bytes of each array item. + * @param cmp UComparator function used to compare two items each. + * @param context Application-specific pointer, passed through to the UComparator. + * @param sortStable If true, a stable sorting algorithm must be used. + * @param pErrorCode ICU in/out UErrorCode parameter. + * + * @internal + */ +U_CAPI void U_EXPORT2 +uprv_sortArray(void *array, int32_t length, int32_t itemSize, + UComparator *cmp, const void *context, + UBool sortStable, UErrorCode *pErrorCode); + +/** + * Convenience UComparator implementation for uint16_t arrays. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +uprv_uint16Comparator(const void *context, const void *left, const void *right); + +/** + * Convenience UComparator implementation for int32_t arrays. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +uprv_int32Comparator(const void *context, const void *left, const void *right); + +/** + * Convenience UComparator implementation for uint32_t arrays. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +uprv_uint32Comparator(const void *context, const void *left, const void *right); + +/** + * Much like Java Collections.binarySearch(list, key, comparator). + * + * Except: Java documents "If the list contains multiple elements equal to + * the specified object, there is no guarantee which one will be found." + * + * This version here will return the largest index of any equal item, + * for use in stable sorting. + * + * @return the index>=0 where the item was found: + * the largest such index, if multiple, for stable sorting; + * or the index<0 for inserting the item at ~index in sorted order + */ +U_CAPI int32_t U_EXPORT2 +uprv_stableBinarySearch(char *array, int32_t length, void *item, int32_t itemSize, + UComparator *cmp, const void *context); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uassert.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uassert.h new file mode 100644 index 0000000000000000000000000000000000000000..afd31eeffd91a47ebf799609a1ab07094e662ce3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uassert.h @@ -0,0 +1,51 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2002-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* File uassert.h +* +* Contains the U_ASSERT and UPRV_UNREACHABLE macros +* +****************************************************************************** +*/ +#ifndef U_ASSERT_H +#define U_ASSERT_H + +/* utypes.h is included to get the proper define for uint8_t */ +#include "unicode/utypes.h" +/* for abort */ +#include + +/** + * \def U_ASSERT + * By default, U_ASSERT just wraps the C library assert macro. + * By changing the definition here, the assert behavior for ICU can be changed + * without affecting other non - ICU uses of the C library assert(). +*/ +#if U_DEBUG +# include +# define U_ASSERT(exp) assert(exp) +#elif U_CPLUSPLUS_VERSION +# define U_ASSERT(exp) (void)0 +#else +# define U_ASSERT(exp) +#endif + +/** + * \def UPRV_UNREACHABLE + * This macro is used to unconditionally abort if unreachable code is ever executed. + * @internal +*/ +#if defined(UPRV_UNREACHABLE) + // Use the predefined value. +#else +# define UPRV_UNREACHABLE abort() +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubidi_props.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubidi_props.h new file mode 100644 index 0000000000000000000000000000000000000000..698ee9c52bd6cbab9f7790d0daae6f5bc2a6a95f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubidi_props.h @@ -0,0 +1,148 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2004-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: ubidi_props.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2004dec30 +* created by: Markus W. Scherer +* +* Low-level Unicode bidi/shaping properties access. +*/ + +#ifndef __UBIDI_PROPS_H__ +#define __UBIDI_PROPS_H__ + +#include "unicode/utypes.h" +#include "unicode/uset.h" +#include "putilimp.h" +#include "uset_imp.h" +#include "udataswp.h" + +U_CDECL_BEGIN + +/* library API -------------------------------------------------------------- */ + +U_CFUNC void +ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode); + +/* property access functions */ + +U_CFUNC int32_t +ubidi_getMaxValue(UProperty which); + +U_CAPI UCharDirection +ubidi_getClass(UChar32 c); + +U_CFUNC UBool +ubidi_isMirrored(UChar32 c); + +U_CFUNC UChar32 +ubidi_getMirror(UChar32 c); + +U_CFUNC UBool +ubidi_isBidiControl(UChar32 c); + +U_CFUNC UBool +ubidi_isJoinControl(UChar32 c); + +U_CFUNC UJoiningType +ubidi_getJoiningType(UChar32 c); + +U_CFUNC UJoiningGroup +ubidi_getJoiningGroup(UChar32 c); + +U_CFUNC UBidiPairedBracketType +ubidi_getPairedBracketType(UChar32 c); + +U_CFUNC UChar32 +ubidi_getPairedBracket(UChar32 c); + +/* file definitions --------------------------------------------------------- */ + +#define UBIDI_DATA_NAME "ubidi" +#define UBIDI_DATA_TYPE "icu" + +/* format "BiDi" */ +#define UBIDI_FMT_0 0x42 +#define UBIDI_FMT_1 0x69 +#define UBIDI_FMT_2 0x44 +#define UBIDI_FMT_3 0x69 + +/* indexes into indexes[] */ +enum { + UBIDI_IX_INDEX_TOP, + UBIDI_IX_LENGTH, + UBIDI_IX_TRIE_SIZE, + UBIDI_IX_MIRROR_LENGTH, + + UBIDI_IX_JG_START, + UBIDI_IX_JG_LIMIT, + UBIDI_IX_JG_START2, /* new in format version 2.2, ICU 54 */ + UBIDI_IX_JG_LIMIT2, + + UBIDI_MAX_VALUES_INDEX=15, + UBIDI_IX_TOP=16 +}; + +/* definitions for 16-bit bidi/shaping properties word ---------------------- */ + +enum { + /* UBIDI_CLASS_SHIFT=0, */ /* bidi class: 5 bits (4..0) */ + UBIDI_JT_SHIFT=5, /* joining type: 3 bits (7..5) */ + + UBIDI_BPT_SHIFT=8, /* Bidi_Paired_Bracket_Type(bpt): 2 bits (9..8) */ + + UBIDI_JOIN_CONTROL_SHIFT=10, + UBIDI_BIDI_CONTROL_SHIFT=11, + + UBIDI_IS_MIRRORED_SHIFT=12, /* 'is mirrored' */ + UBIDI_MIRROR_DELTA_SHIFT=13, /* bidi mirroring delta: 3 bits (15..13) */ + + UBIDI_MAX_JG_SHIFT=16 /* max JG value in indexes[UBIDI_MAX_VALUES_INDEX] bits 23..16 */ +}; + +#define UBIDI_CLASS_MASK 0x0000001f +#define UBIDI_JT_MASK 0x000000e0 +#define UBIDI_BPT_MASK 0x00000300 + +#define UBIDI_MAX_JG_MASK 0x00ff0000 + +#define UBIDI_GET_CLASS(props) ((props)&UBIDI_CLASS_MASK) +#define UBIDI_GET_FLAG(props, shift) (((props)>>(shift))&1) + +#if U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC +# define UBIDI_GET_MIRROR_DELTA(props) ((int16_t)(props)>>UBIDI_MIRROR_DELTA_SHIFT) +#else +# define UBIDI_GET_MIRROR_DELTA(props) (int16_t)(((props)&0x8000) ? (((props)>>UBIDI_MIRROR_DELTA_SHIFT)|0xe000) : ((props)>>UBIDI_MIRROR_DELTA_SHIFT)) +#endif + +enum { + UBIDI_ESC_MIRROR_DELTA=-4, + UBIDI_MIN_MIRROR_DELTA=-3, + UBIDI_MAX_MIRROR_DELTA=3 +}; + +/* definitions for 32-bit mirror table entry -------------------------------- */ + +enum { + /* the source Unicode code point takes 21 bits (20..0) */ + UBIDI_MIRROR_INDEX_SHIFT=21, + UBIDI_MAX_MIRROR_INDEX=0x7ff +}; + +#define UBIDI_GET_MIRROR_CODE_POINT(m) (UChar32)((m)&0x1fffff) + +#define UBIDI_GET_MIRROR_INDEX(m) ((m)>>UBIDI_MIRROR_INDEX_SHIFT) + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubidi_props_data.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubidi_props_data.h new file mode 100644 index 0000000000000000000000000000000000000000..7a34870bd8003f58b7de7d5190833a0e0109bfec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubidi_props_data.h @@ -0,0 +1,922 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// Copyright (C) 1999-2016, International Business Machines +// Corporation and others. All Rights Reserved. +// +// file name: ubidi_props_data.h +// +// machine-generated by: icu/tools/unicode/c/genprops/bidipropsbuilder.cpp + + +#ifdef INCLUDED_FROM_UBIDI_PROPS_C + +static const UVersionInfo ubidi_props_dataVersion={0xd,0,0,0}; + +static const int32_t ubidi_props_indexes[UBIDI_IX_TOP]={0x10,0x67ec,0x6200,0x28,0x620,0x8c8,0x10ac0,0x10d24,0,0,0,0,0,0,0,0x6502b6}; + +static const uint16_t ubidi_props_trieIndex[12536]={ +0x37c,0x384,0x38c,0x394,0x3ac,0x3b4,0x3bc,0x3c4,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4, +0x39c,0x3a4,0x39c,0x3a4,0x3ca,0x3d2,0x3da,0x3e2,0x3ea,0x3f2,0x3ee,0x3f6,0x3fe,0x406,0x401,0x409, +0x39c,0x3a4,0x39c,0x3a4,0x411,0x419,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,0x41f,0x427,0x42f,0x437, +0x43f,0x447,0x44f,0x457,0x45d,0x465,0x46d,0x475,0x47d,0x485,0x48b,0x493,0x49b,0x4a3,0x4ab,0x4b3, +0x4bf,0x4bb,0x4c7,0x4cf,0x431,0x4df,0x4e6,0x4d7,0x4ee,0x4f0,0x4f8,0x500,0x508,0x509,0x511,0x519, +0x521,0x509,0x529,0x52e,0x521,0x509,0x536,0x53e,0x508,0x546,0x54e,0x500,0x556,0x39c,0x55e,0x562, +0x56a,0x56c,0x574,0x57c,0x508,0x584,0x58c,0x500,0x413,0x590,0x511,0x500,0x508,0x39c,0x598,0x39c, +0x39c,0x59e,0x5a6,0x39c,0x39c,0x5aa,0x5b2,0x39c,0x5b6,0x5bd,0x39c,0x5c5,0x5cd,0x5d4,0x555,0x39c, +0x39c,0x5dc,0x5e4,0x5ec,0x5f4,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x5fc,0x39c,0x604,0x39c,0x39c,0x39c, +0x60c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x614,0x39c,0x39c,0x39c,0x61c,0x61c,0x515,0x515,0x39c,0x622,0x62a,0x604, +0x640,0x632,0x632,0x648,0x64f,0x638,0x39c,0x39c,0x39c,0x657,0x65f,0x39c,0x39c,0x39c,0x661,0x669, +0x671,0x39c,0x678,0x680,0x39c,0x688,0x56b,0x39c,0x545,0x690,0x556,0x698,0x413,0x6a0,0x39c,0x6a7, +0x39c,0x6ac,0x39c,0x39c,0x39c,0x39c,0x6b2,0x6ba,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x3ea,0x6c2, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x6ca,0x6d2,0x6d6, +0x6ee,0x6f4,0x6de,0x6e6,0x6fc,0x704,0x708,0x5d7,0x710,0x718,0x720,0x39c,0x728,0x669,0x669,0x669, +0x738,0x740,0x748,0x750,0x755,0x75d,0x765,0x730,0x76d,0x775,0x39c,0x77b,0x782,0x669,0x669,0x669, +0x669,0x582,0x788,0x669,0x790,0x39c,0x39c,0x666,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669, +0x669,0x669,0x669,0x669,0x669,0x798,0x669,0x669,0x669,0x669,0x669,0x79e,0x669,0x669,0x7a6,0x7ae, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x669,0x669,0x7be,0x7c6,0x7ce,0x7b6, +0x7de,0x7e6,0x7ee,0x7f5,0x7fc,0x804,0x808,0x7d6,0x669,0x669,0x669,0x810,0x816,0x669,0x669,0x81c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x824,0x39c,0x39c,0x39c,0x82c,0x39c,0x39c,0x39c,0x3ea, +0x834,0x83c,0x840,0x39c,0x848,0x669,0x669,0x66c,0x669,0x669,0x669,0x669,0x669,0x669,0x84f,0x855, +0x865,0x85d,0x39c,0x39c,0x86d,0x60c,0x39c,0x3c3,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x82b, +0x3d1,0x39c,0x875,0x87d,0x39c,0x885,0x88d,0x39c,0x39c,0x39c,0x39c,0x891,0x39c,0x39c,0x661,0x3c2, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x875,0x669,0x582,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x898,0x39c,0x39c,0x89d,0x56c,0x39c,0x39c,0x5b8,0x669,0x660,0x39c,0x39c,0x8a5,0x39c,0x39c,0x39c, +0x8ad,0x8b4,0x632,0x8bc,0x39c,0x39c,0x58e,0x8c4,0x39c,0x8cc,0x8d3,0x39c,0x4ee,0x8d8,0x39c,0x507, +0x39c,0x8e0,0x8e8,0x509,0x39c,0x8ec,0x508,0x8f4,0x39c,0x39c,0x39c,0x8fa,0x39c,0x39c,0x39c,0x901, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x915,0x909,0x90d,0x49b,0x49b,0x49b,0x49b,0x49b, +0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x91d,0x49b,0x49b,0x49b,0x49b,0x925,0x929, +0x931,0x939,0x93d,0x945,0x49b,0x49b,0x49b,0x949,0x951,0x38c,0x959,0x961,0x39c,0x39c,0x39c,0x969, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0xe70,0xe70,0xeb0,0xef0,0xe70,0xe70,0xe70,0xe70,0xe70,0xe70,0xf28,0xf68,0xfa8,0xfb8,0xff8,0x1004, +0xe70,0xe70,0x1044,0xe70,0xe70,0xe70,0x107c,0x10bc,0x10fc,0x113c,0x1174,0x11b4,0x11f4,0x122c,0x126c,0x12ac, +0xa40,0xa80,0xac0,0xaff,0x1a0,0x1a0,0xb3f,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xb68,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xba8,0x1a0,0x1a0,0xbdd,0xc1d,0xc5d,0xc9d,0xcdd,0xd1d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0xd9d,0xdad,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x971,0x39c,0x669,0x669,0x979,0x60c,0x39c,0x501, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x981,0x39c,0x39c,0x39c,0x988,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x990,0x431,0x431,0x431,0x431,0x431,0x431,0x431, +0x998,0x99c,0x431,0x431,0x431,0x431,0x9ac,0x9a4,0x431,0x9b4,0x431,0x431,0x9bc,0x9c2,0x431,0x431, +0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x9d2,0x9ca,0x431,0x431,0x431,0x431,0x431,0x431, +0x431,0x431,0x431,0x9da,0x431,0x9e2,0x431,0x431,0x431,0x9e6,0x9ed,0x9f3,0x431,0x9f7,0x9ff,0x431, +0x508,0xa07,0xa0e,0xa15,0x413,0xa18,0x39c,0x39c,0x4ee,0xa1f,0x39c,0xa25,0x413,0xa2a,0xa32,0x39c, +0x39c,0xa37,0x39c,0x39c,0x39c,0x39c,0x82c,0xa3f,0x413,0x590,0x56b,0xa46,0x39c,0x39c,0x39c,0x39c, +0x39c,0xa07,0xa4e,0x39c,0x39c,0xa56,0xa5e,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xa62,0xa6a,0x39c, +0x39c,0xa72,0x56b,0xa7a,0x39c,0xa80,0x39c,0x39c,0x5fc,0xa88,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0xa8d,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xa94,0xa9c,0x39c,0x39c,0x39c,0xa9f,0x56b,0xaa7, +0xaab,0xab3,0x39c,0xaba,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0xac1,0x39c,0x39c,0xacf,0xac9,0x39c,0x39c,0x39c,0xad7,0xadf,0x39c,0xae3,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x592,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xaf0,0xaeb,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0xaf8,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xaff, +0x39c,0xb05,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0xa26,0x39c,0xb0b,0x39c,0x39c,0xb13,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x522,0xb1b,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb22,0xb2a,0xb30,0x39c,0x39c,0x669,0x669,0xb38, +0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x83f,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0xb3a,0x39c,0xb41,0x39c,0xb3d,0x39c,0xb44,0x39c,0xb4c,0xb50,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x3ea,0xb58,0x3ea, +0xb5f,0xb66,0xb6e,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb76,0xb7e,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb05,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0xb83,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x431,0x431,0x431, +0x431,0x431,0x431,0xb8b,0x431,0xb93,0xb93,0xb9a,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431, +0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431, +0x90d,0x49b,0x49b,0x431,0x431,0x49b,0x49b,0x9f3,0x431,0x431,0x431,0x431,0x431,0x49b,0x49b,0x49b, +0x49b,0x49b,0x49b,0x49b,0xba2,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x669,0xbaa,0x669, +0x669,0x66c,0xbaf,0xbb3,0x84f,0xbbb,0x3be,0x39c,0xbc1,0x39c,0xbc6,0x39c,0x39c,0x39c,0x39c,0x39c, +0x779,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669, +0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669, +0x669,0x669,0x669,0x66b,0x979,0x669,0x669,0x669,0x66c,0x669,0x669,0xbce,0x66e,0xbaa,0x669,0xbd6, +0x669,0xbde,0xbe3,0x39c,0x39c,0x669,0x669,0x669,0xbeb,0x669,0x669,0x798,0x669,0x669,0x669,0x66c, +0xbf2,0xbfa,0xc00,0xc05,0x39c,0x669,0x669,0x669,0x669,0xc0d,0x669,0x788,0xc15,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xc1c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xc1c,0xc2c,0xc24,0xc24, +0xc24,0xc2d,0xc2d,0xc2d,0xc2d,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0xc35,0xc2d,0xc2d,0xc2d, +0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d, +0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d, +0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d, +0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0x37b,0x37b,0x37b, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,8,7,8,9,7,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,7,7,7,8, +9,0xa,0xa,4,4,4,0xa,0xa,0x310a,0xf20a,0xa,3,6,3,6,6, +2,2,2,2,2,2,2,2,2,2,6,0xa,0x500a,0xa,0xd00a,0xa, +0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0x510a,0xa,0xd20a,0xa,0xa, +0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0x510a,0xa,0xd20a,0xa,0x12, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x12,0x12,0x12,0x12,0x12,7,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +6,0xa,4,4,4,4,0xa,0xa,0xa,0xa,0,0x900a,0xa,0xb2,0xa,0xa, +4,4,2,2,0xa,0,0xa,0xa,0xa,2,0,0x900a,0xa,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xa,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xa,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0xa,0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xa,0xa,0,0, +0,0,0,0,0,0,0xa,0,0,0,0,0,0xa,0xa,0,0xa, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xa,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xa,0,0,0xa,0xa,4,1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,0xb1,1,0xb1,0xb1,1, +0xb1,0xb1,1,0xb1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5, +5,5,0xa,0xa,0xd,4,4,0xd,6,0xd,0xa,0xa,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0x8ad,0xd,0xd,0xd,0x4d,0xd,0x8d,0x8d, +0x8d,0x8d,0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x2d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,5,5,5,5, +5,5,5,5,5,5,4,5,5,0xd,0x4d,0x4d,0xb1,0x8d,0x8d,0x8d, +0xd,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d, +0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, +0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x8d,0x8d,0xd,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,5,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xb1,0xb1,0xa,0xb1,0xb1, +0xb1,0xb1,0x8d,0x8d,2,2,2,2,2,2,2,2,2,2,0x4d,0x4d, +0x4d,0xd,0xd,0x4d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xad,0x8d,0xb1,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d, +0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,0x4d, +0x8d,0x4d,0x4d,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d, +0x8d,0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1, +1,1,1,1,1,1,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +1,1,0xa,0xa,0xa,0xa,0x21,1,1,0xb1,1,1,0xb1,0xb1,0xb1,0xb1, +1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xb1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,0xb1,0xb1,0x81,0x41,0x41,0x41, +0x41,0x41,0x81,0x81,0x41,0x81,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, +0x81,0x41,0x81,0x81,0x81,0xb1,0xb1,0xb1,1,1,1,1,0x4d,0xd,0x4d,0x4d, +0x4d,0x4d,0xd,0x8d,0x4d,0x8d,0x8d,0xd,0xd,0xd,0xd,0xd,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,5,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0xd,0x8d,0x4d,0x4d,0x8d,0x8d,0x4d, +0x4d,0xd,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0,0, +0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0,0, +0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xb1,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0, +0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,4, +0,0,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0,0,0xb1, +0xb1,0xb1,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1, +0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0, +0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0, +0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0,0, +0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0xb1,0xb1,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0, +0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa, +0xa,4,0xa,0,0,0,0,0,0xb1,0,0,0,0xb1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0xa0, +0,0,0,0,0,0,0xa0,0,0,0,0,0,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0, +0,0,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0,0,4,0,0,0,0,0,0,0,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0xb1,0x310a,0xf20a, +0x310a,0xf20a,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0, +0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, +0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0xb1,0xb1,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0xb1,0xb1, +0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0, +0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0x310a,0xf20a,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0, +0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0, +0,0,0,4,0,0xb1,0,0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0x40,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x4a,0xa,0xa,0x2a,0xb1,0xb1,0xb1,0x12,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0,0,0,0,0,0,0, +0,0xb1,0xb1,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0xb1,0xb1,0, +0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0xb1,0, +0,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,0,0xa,0,0,0, +0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0xb1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0xb1,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0xb1,0,0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,0xb1,0,0,0, +0xb1,0xb1,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xa,0,0xa,0xa,0xa,0,0,0,0,0,0, +0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xa,0xa,0,0xa,0xa,0xa,0xa,6,0x310a,0xf20a,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,9,0xb2,0xb2,0xb2,0xb2,0xb2,0x12,0x814,0x815, +0x813,0x816,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,2,0,0,0,2,2,2,2, +2,2,3,3,0xa,0x310a,0xf20a,0,9,9,9,9,9,9,9,9, +9,9,9,0xb2,0x412,0x432,0x8a0,0x8a1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,9,7,0x8ab,0x8ae,0x8b0,0x8ac,0x8af,6, +4,4,4,4,4,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa, +2,2,2,2,2,2,2,2,2,2,3,3,0xa,0x310a,0xf20a,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xa,0xa,0,0xa,0xa,0xa,0xa,0,0xa,0xa,0,0,0,0,0,0, +0,0,0,0,0xa,0,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa, +0xa,0xa,0xa,0xa,0,0xa,0,0xa,0,0xa,0,0,0,0,4,0, +0,0,0,0,0,0,0,0,0,0,0xa,0xa,0,0,0,0, +0x100a,0xa,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0,0, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0,0,0,0, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa, +0x300a,0xf00a,0x900a,0x900a,0x900a,0x100a,0x900a,0x900a,0x100a,0x100a,0x900a,0x900a,0x900a,0x900a,0x900a,0x100a, +0xa,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0x700a,0x700a,0x700a,0xb00a,0xb00a,0xb00a,0xa,0xa, +0xa,0x100a,3,4,0xa,0x900a,0x100a,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0x900a, +0x900a,0x900a,0x900a,0xa,0x900a,0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a, +0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x300a,0xf00a,0x100a,0x100a, +0x100a,0x100a,0x100a,0x900a,0x100a,0x900a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x900a,0xa,0xa,0xa, +0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a, +0x100a,0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a, +0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a, +0x100a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0x900a,0x100a,0x900a,0x900a,0x100a,0x900a, +0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x900a,0xa,0xa,0xa, +0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a, +0xf00a,0x900a,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a, +0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0xa,0x300a,0xf00a,0x310a,0xf20a,0xa, +0x300a,0xf00a,0xa,0x500a,0x100a,0xd00a,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0x300a,0xf00a,0xa, +0xa,0xa,0xa,0xa,0x900a,0x300a,0xf00a,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x310a,0xf20a, +0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x100a,0x100a,0xa,0xa, +0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x900a,0x100a,0x100a, +0x300a,0xf00a,0xa,0xa,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a, +0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x710a,0x320a,0xf10a,0xb20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a, +0xf20a,0xa,0xa,0x900a,0x100a,0x100a,0x100a,0x100a,0x900a,0xa,0x100a,0x900a,0x300a,0xf00a,0x100a,0x100a, +0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0x100a,0x300a,0xf00a,0xa,0xa, +0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa, +0x310a,0xf20a,0x310a,0xf20a,0x100a,0xa,0xa,0xa,0xa,0xa,0x100a,0x900a,0x900a,0x900a,0x100a,0xa, +0xa,0xa,0xa,0xa,0x300a,0xf00a,0x900a,0xa,0xa,0xa,0xa,0x100a,0xa,0xa,0xa,0x300a, +0xf00a,0x300a,0xf00a,0x100a,0xa,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a, +0x100a,0x100a,0x100a,0x100a,0x100a,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0x100a,0xa,0x100a,0xa, +0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa, +0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a, +0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0x100a,0x100a, +0x100a,0x100a,0xa,0x100a,0x100a,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a, +0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a, +0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a, +0xf00a,0x300a,0xf00a,0x100a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a, +0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a, +0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x900a,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x900a,0xa, +0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0xb1, +0xb1,0xb1,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, +0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa, +0x300a,0xf00a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0,0,0,0,0xa,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0xb1,0,0,0xa,0,0,0,0,0,0xa,0xa,0,0,0,0, +0,0xa,0xa,0xa,9,0xa,0xa,0xa,0xa,0,0,0,0x310a,0xf20a,0x310a,0xf20a, +0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a, +0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xa, +0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xa,0xa,0,0,0,0,0,0,0,0,0xa,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0,0,0,0xb1,0,0,0,0,0xb1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xb1,0xb1,0,0xa,0xa,0xa,0xa,0xb1,0,0,0, +0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0, +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, +0x40,0x40,0x60,0,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, +0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xb1,0,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0, +0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0,0,0, +0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,1,1,1,1,1,1,1,1,1,3,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,1,0xb1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xa,0xa,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xa,0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0, +0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,6,0xa,6,0,0xa,6,0xa,0xa,0xa,0x310a,0xf20a,0x310a, +0xf20a,0x310a,0xf20a,4,0xa,0xa,3,3,0x300a,0xf00a,0xa,0,0xa,4,4,0xa, +0,0,0,0,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xb2,0,0xa,0xa,4,4,4,0xa,0xa,0x310a,0xf20a,0xa,3, +6,3,6,6,2,2,2,2,2,2,2,2,2,2,6,0xa, +0x500a,0xa,0xd00a,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x510a, +0xa,0xd20a,0xa,0x310a,0xf20a,0xa,0x310a,0xf20a,0xa,0xa,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,4,4,0xa,0xa,0xa,4,4,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0xaa,0xaa,0xaa, +0xa,0xa,0x12,0x12,0,0xa,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0,0,0,0xb1,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xa, +1,0xb1,0xb1,0xb1,1,0xb1,0xb1,1,1,1,1,1,0xb1,0xb1,0xb1,0xb1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xb1,0xb1,0xb1,1,1,1,1,0xb1, +0x41,0x81,1,1,0x81,0xb1,0xb1,1,1,1,1,0x41,0x41,0x41,0x41,0x81, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0x41,0x41,0x41,0x41,0x41,0x81,1,0x81,1,0x81,0x81,1,1,0x61,0x81,0x81, +0x81,0x81,0x81,0x41,0x41,0x41,0x41,0x61,0x41,0x41,0x41,0x41,0x41,0x81,0x41,0x41, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0x41,0x81,0x41,0x81,0x81,0x81,0x41,0x41,0x41,0x81,0x41,0x41,0x81,0x41,0x81,0x81, +0x41,0x81,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,0x81,0x81,0x81,0x81,0x41,0x41,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0x4d,0x4d,0x8d,0x4d,0xb1,0xb1,0xb1,0xb1, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,5,5,5,5,5,5,5,5, +5,5,0xd,0xd,0xd,0xd,0xd,0xd,0x6d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,1,1,1,1,1,1,1,1,1, +1,1,1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x8d,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0x41,1,0x41,0x41, +0x81,0x81,0x81,1,0x41,0x81,0x81,0x41,0x41,0x81,0x41,0x41,1,0x41,0x81,0x81, +0x41,1,1,1,1,0x81,0x41,0x61,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0, +0xb1,0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,0,0,0,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0,0xb1,0,0,0,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0xb1,0,0xb1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0, +0,0,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xb1,0, +0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xa0,0xa0,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0, +0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0,0xa0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0, +0,0xb1,0,0xb1,0,0,0,0,0,0,0,0,4,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,4,4,4, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0, +0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb2,0xb2,0xb2,0xb2, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, +0xb1,0xb1,0,0,0,0,0,0,0,0,0,0xb2,0xb2,0xb2,0xb2,0xb2, +0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xa,0xa,0xb1,0xb1,0xb1,0xa,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0x100a,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0x100a,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0x100a,0,0,0,0,0,0,0,0,0,0,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0, +0,0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,4,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,0x41,0x41,0x41,0x41, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xa1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,2,2,2,2, +2,2,2,2,2,2,2,0xa,0xa,0xa,0xa,0xa,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa, +0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xa,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0,0,0, +0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0, +0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,2,2,2,2,2,2,2,2,2,2,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x12,0x12, +0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, +0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, +0x12,0xb2,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0,0,0,0 +}; + +static const uint32_t ubidi_props_mirrors[40]={ +0x2000ab,0xbb,0x4202215,0x4e0221f,0x3e02220,0x3a02221,0x3c02222,0x4c02224,0x2202243,0x1402245,0x120224c,0x4002298,0x44022a6,0x48022a8,0x46022a9,0x4a022ab, +0x38022b8,0x10022cd,0x2e022f2,0x30022f3,0x32022f4,0x34022f6,0x36022f7,0x24022fa,0x26022fb,0x28022fc,0x2a022fd,0x2c022fe,0x20027dc,0xa0299b,0xc029a0,0x8029a3, +0x16029b8,0x4029f5,0x1802ade,0x1c02ae3,0x1a02ae4,0x1e02ae5,0xe02aee,0x602bfe +}; + +static const uint8_t ubidi_props_jgArray[680]={ +0x2d,0,3,3,0x2c,3,0x2d,3,4,0x2a,4,4,0xd,0xd,0xd,6, +6,0x1f,0x1f,0x23,0x23,0x21,0x21,0x28,0x28,1,1,0xb,0xb,0x37,0x37,0x37, +0,9,0x1d,0x13,0x16,0x18,0x1a,0x10,0x2c,0x2d,0x2d,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0x1d, +0,3,3,3,0,3,0x2c,0x2c,0x2d,4,4,4,4,4,4,4, +4,0xd,0xd,0xd,0xd,0xd,0xd,0xd,6,6,6,6,6,6,6,6, +6,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x23,0x23,0x23,0x21,0x21,0x28, +1,9,9,9,9,9,9,0x1d,0x1d,0xb,0x26,0xb,0x13,0x13,0x13,0xb, +0xb,0xb,0xb,0xb,0xb,0x16,0x16,0x16,0x16,0x1a,0x1a,0x1a,0x1a,0x38,0x15,0xd, +0x2a,0x11,0x11,0xe,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x37,0x2f,0x37,0x2c, +0x2d,0x2d,0x2e,0x2e,0,0x2a,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0x1f, +0,0,0,0,0,0,0,0,0,0,0x23,0x21,1,0,0,0x15, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,0,5,0xc,0xc,7,7,0xf,0x27,0x32,0x12,0x2b,0x2b,0x30,0x31,0x14, +0x17,0x19,0x1b,0x24,0xa,8,0x1c,0x20,0x22,0x1e,7,0x25,0x29,5,0xc,7, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0x35,0x34,0x33, +4,4,4,4,4,4,4,0xd,0xd,6,6,0x1f,0x23,1,1,1, +9,9,0xb,0xb,0xb,0x18,0x18,0x1a,0x1a,0x1a,0x16,0x1f,0x1f,0x23,0xd,0xd, +0x23,0x1f,0xd,3,3,0x37,0x37,0x2d,0x2c,0x2c,0x36,0x36,0xd,0x23,0x23,0x13, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x5d,0x5a,0x60,0x63,0x5e,0x5f,0x59,0x61,0x5b,0x5c,0x62,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,4,0xd,0x28,9,0x1d,0x16,0x18,0x2d,0x2d,0x1f,0x2c,0x39,0,6,0x21, +0xb,0x55,0x1f,1,0x13,0,4,4,4,0x1f,0x2d,0x56,0x58,0x57,4,4, +4,0xd,0xb,1,0x58,0xd,0xd,0x16 +}; + +static const uint8_t ubidi_props_jgArray2[612]={ +0x3a,0x3c,0x3c,0x40,0x40,0x3d,0,0x52,0,0x54,0x54,0,0,0x41,0x4f,0x53, +0x43,0x43,0x43,0x44,0x3e,0x50,0x45,0x46,0x4c,0x3b,0x3b,0x48,0x48,0x4b,0x49,0x49, +0x49,0x4a,0,0,0x4d,0,0,0,0,0,0,0x47,0x3f,0x4e,0x51,0x42, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0x65,0,0,0,0,0,0,0x65,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0x64,0,0,0x65,0,0x64,0, +0x64,0,0,0x64 +}; + +static const UBiDiProps ubidi_props_singleton={ + NULL, + ubidi_props_indexes, + ubidi_props_mirrors, + ubidi_props_jgArray, + ubidi_props_jgArray2, + { + ubidi_props_trieIndex, + ubidi_props_trieIndex+3568, + NULL, + 3568, + 8968, + 0x1a0, + 0xe70, + 0x0, + 0x0, + 0x110000, + 0x30f4, + NULL, 0, FALSE, FALSE, 0, NULL + }, + { 2,2,0,0 } +}; + +#endif // INCLUDED_FROM_UBIDI_PROPS_C diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubidiimp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubidiimp.h new file mode 100644 index 0000000000000000000000000000000000000000..e48fc6f941621b7fb61b6c6cbe423f24021f54a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubidiimp.h @@ -0,0 +1,484 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ubidiimp.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999aug06 +* created by: Markus W. Scherer, updated by Matitiahu Allouche +*/ + +#ifndef UBIDIIMP_H +#define UBIDIIMP_H + +#include "unicode/utypes.h" +#include "unicode/ubidi.h" +#include "unicode/uchar.h" +#include "ubidi_props.h" + +/* miscellaneous definitions ---------------------------------------------- */ + +// ICU-20853=ICU-20935 Solaris #defines CS and ES in sys/regset.h +#ifdef CS +# undef CS +#endif +#ifdef ES +# undef ES +#endif + +typedef uint8_t DirProp; +typedef uint32_t Flags; + +/* Comparing the description of the BiDi algorithm with this implementation + is easier with the same names for the BiDi types in the code as there. + See UCharDirection in uchar.h . +*/ +enum { + L= U_LEFT_TO_RIGHT, /* 0 */ + R= U_RIGHT_TO_LEFT, /* 1 */ + EN= U_EUROPEAN_NUMBER, /* 2 */ + ES= U_EUROPEAN_NUMBER_SEPARATOR, /* 3 */ + ET= U_EUROPEAN_NUMBER_TERMINATOR, /* 4 */ + AN= U_ARABIC_NUMBER, /* 5 */ + CS= U_COMMON_NUMBER_SEPARATOR, /* 6 */ + B= U_BLOCK_SEPARATOR, /* 7 */ + S= U_SEGMENT_SEPARATOR, /* 8 */ + WS= U_WHITE_SPACE_NEUTRAL, /* 9 */ + ON= U_OTHER_NEUTRAL, /* 10 */ + LRE=U_LEFT_TO_RIGHT_EMBEDDING, /* 11 */ + LRO=U_LEFT_TO_RIGHT_OVERRIDE, /* 12 */ + AL= U_RIGHT_TO_LEFT_ARABIC, /* 13 */ + RLE=U_RIGHT_TO_LEFT_EMBEDDING, /* 14 */ + RLO=U_RIGHT_TO_LEFT_OVERRIDE, /* 15 */ + PDF=U_POP_DIRECTIONAL_FORMAT, /* 16 */ + NSM=U_DIR_NON_SPACING_MARK, /* 17 */ + BN= U_BOUNDARY_NEUTRAL, /* 18 */ + FSI=U_FIRST_STRONG_ISOLATE, /* 19 */ + LRI=U_LEFT_TO_RIGHT_ISOLATE, /* 20 */ + RLI=U_RIGHT_TO_LEFT_ISOLATE, /* 21 */ + PDI=U_POP_DIRECTIONAL_ISOLATE, /* 22 */ + ENL, /* EN after W7 */ /* 23 */ + ENR, /* EN not subject to W7 */ /* 24 */ + dirPropCount +}; + +/* Sometimes, bit values are more appropriate + to deal with directionality properties. + Abbreviations in these macro names refer to names + used in the BiDi algorithm. +*/ +#define DIRPROP_FLAG(dir) (1UL<<(dir)) +#define PURE_DIRPROP(prop) ((prop)&~0xE0) ????????????????????????? + +/* special flag for multiple runs from explicit embedding codes */ +#define DIRPROP_FLAG_MULTI_RUNS (1UL<<31) + +/* are there any characters that are LTR or RTL? */ +#define MASK_LTR (DIRPROP_FLAG(L)|DIRPROP_FLAG(EN)|DIRPROP_FLAG(ENL)|DIRPROP_FLAG(ENR)|DIRPROP_FLAG(AN)|DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO)|DIRPROP_FLAG(LRI)) +#define MASK_RTL (DIRPROP_FLAG(R)|DIRPROP_FLAG(AL)|DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO)|DIRPROP_FLAG(RLI)) +#define MASK_R_AL (DIRPROP_FLAG(R)|DIRPROP_FLAG(AL)) +#define MASK_STRONG_EN_AN (DIRPROP_FLAG(L)|DIRPROP_FLAG(R)|DIRPROP_FLAG(AL)|DIRPROP_FLAG(EN)|DIRPROP_FLAG(AN)) + +/* explicit embedding codes */ +#define MASK_EXPLICIT (DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO)|DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO)|DIRPROP_FLAG(PDF)) + +/* explicit isolate codes */ +#define MASK_ISO (DIRPROP_FLAG(LRI)|DIRPROP_FLAG(RLI)|DIRPROP_FLAG(FSI)|DIRPROP_FLAG(PDI)) + +#define MASK_BN_EXPLICIT (DIRPROP_FLAG(BN)|MASK_EXPLICIT) + +/* paragraph and segment separators */ +#define MASK_B_S (DIRPROP_FLAG(B)|DIRPROP_FLAG(S)) + +/* all types that are counted as White Space or Neutral in some steps */ +#define MASK_WS (MASK_B_S|DIRPROP_FLAG(WS)|MASK_BN_EXPLICIT|MASK_ISO) + +/* types that are neutrals or could becomes neutrals in (Wn) */ +#define MASK_POSSIBLE_N (DIRPROP_FLAG(ON)|DIRPROP_FLAG(CS)|DIRPROP_FLAG(ES)|DIRPROP_FLAG(ET)|MASK_WS) + +/* + * These types may be changed to "e", + * the embedding type (L or R) of the run, + * in the BiDi algorithm (N2) + */ +#define MASK_EMBEDDING (DIRPROP_FLAG(NSM)|MASK_POSSIBLE_N) + +/* the dirProp's L and R are defined to 0 and 1 values in UCharDirection */ +#define GET_LR_FROM_LEVEL(level) ((DirProp)((level)&1)) + +#define IS_DEFAULT_LEVEL(level) ((level)>=0xfe) + +/* + * The following bit is used for the directional isolate status. + * Stack entries corresponding to isolate sequences are greater than ISOLATE. + */ +#define ISOLATE 0x0100 + +U_CFUNC UBiDiLevel +ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t index); + +#define GET_PARALEVEL(ubidi, index) \ + ((UBiDiLevel)(!(ubidi)->defaultParaLevel || (index)<(ubidi)->paras[0].limit ? \ + (ubidi)->paraLevel : ubidi_getParaLevelAtIndex((ubidi), (index)))) + +/* number of paras entries allocated initially without malloc */ +#define SIMPLE_PARAS_COUNT 10 +/* number of isolate entries allocated initially without malloc */ +#define SIMPLE_ISOLATES_COUNT 5 +/* number of isolate run entries for paired brackets allocated initially without malloc */ +#define SIMPLE_OPENINGS_COUNT 20 + +#define CR 0x000D +#define LF 0x000A + +/* Run structure for reordering --------------------------------------------- */ +enum { + LRM_BEFORE=1, + LRM_AFTER=2, + RLM_BEFORE=4, + RLM_AFTER=8 +}; + +typedef struct Para { + int32_t limit; + int32_t level; +} Para; + +enum { /* flags for Opening.flags */ + FOUND_L=DIRPROP_FLAG(L), + FOUND_R=DIRPROP_FLAG(R) +}; + +typedef struct Opening { + int32_t position; /* position of opening bracket */ + int32_t match; /* matching char or -position of closing bracket */ + int32_t contextPos; /* position of last strong char found before opening */ + uint16_t flags; /* bits for L or R/AL found within the pair */ + UBiDiDirection contextDir; /* L or R according to last strong char before opening */ + uint8_t filler; /* to complete a nice multiple of 4 chars */ +} Opening; + +typedef struct IsoRun { + int32_t contextPos; /* position of char determining context */ + uint16_t start; /* index of first opening entry for this run */ + uint16_t limit; /* index after last opening entry for this run */ + UBiDiLevel level; /* level of this run */ + DirProp lastStrong; /* bidi class of last strong char found in this run */ + DirProp lastBase; /* bidi class of last base char found in this run */ + UBiDiDirection contextDir; /* L or R to use as context for following openings */ +} IsoRun; + +typedef struct BracketData { + UBiDi *pBiDi; + /* array of opening entries which should be enough in most cases; no malloc() */ + Opening simpleOpenings[SIMPLE_OPENINGS_COUNT]; + Opening *openings; /* pointer to current array of entries */ + int32_t openingsCount; /* number of allocated entries */ + int32_t isoRunLast; /* index of last used entry */ + /* array of nested isolated sequence entries; can never excess UBIDI_MAX_EXPLICIT_LEVEL + + 1 for index 0, + 1 for before the first isolated sequence */ + IsoRun isoRuns[UBIDI_MAX_EXPLICIT_LEVEL+2]; + UBool isNumbersSpecial; /* reordering mode for NUMBERS_SPECIAL */ +} BracketData; + +typedef struct Isolate { + int32_t startON; + int32_t start1; + int32_t state; + int16_t stateImp; +} Isolate; + +typedef struct Run { + int32_t logicalStart, /* first character of the run; b31 indicates even/odd level */ + visualLimit, /* last visual position of the run +1 */ + insertRemove; /* if >0, flags for inserting LRM/RLM before/after run, + if <0, count of bidi controls within run */ +} Run; + +/* in a Run, logicalStart will get this bit set if the run level is odd */ +#define INDEX_ODD_BIT (1UL<<31) + +#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((int32_t)((level)&1)<<31)) +#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((int32_t)((level)&1)<<31)) +#define REMOVE_ODD_BIT(x) ((x)&=~INDEX_ODD_BIT) + +#define GET_INDEX(x) ((x)&~INDEX_ODD_BIT) +#define GET_ODD_BIT(x) ((uint32_t)(x)>>31) +#define IS_ODD_RUN(x) ((UBool)(((x)&INDEX_ODD_BIT)!=0)) +#define IS_EVEN_RUN(x) ((UBool)(((x)&INDEX_ODD_BIT)==0)) + +U_CFUNC UBool +ubidi_getRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); + +/** BiDi control code points */ +enum { + ZWNJ_CHAR=0x200c, + ZWJ_CHAR, + LRM_CHAR, + RLM_CHAR, + LRE_CHAR=0x202a, + RLE_CHAR, + PDF_CHAR, + LRO_CHAR, + RLO_CHAR, + LRI_CHAR=0x2066, + RLI_CHAR, + FSI_CHAR, + PDI_CHAR +}; + +#define IS_BIDI_CONTROL_CHAR(c) (((uint32_t)(c)&0xfffffffc)==ZWNJ_CHAR || (uint32_t)((c)-LRE_CHAR)<5 || (uint32_t)((c)-LRI_CHAR)<4) + +/* InsertPoints structure for noting where to put BiDi marks ---------------- */ + +typedef struct Point { + int32_t pos; /* position in text */ + int32_t flag; /* flag for LRM/RLM, before/after */ +} Point; + +typedef struct InsertPoints { + int32_t capacity; /* number of points allocated */ + int32_t size; /* number of points used */ + int32_t confirmed; /* number of points confirmed */ + UErrorCode errorCode; /* for eventual memory shortage */ + Point *points; /* pointer to array of points */ +} InsertPoints; + + +/* UBiDi structure ----------------------------------------------------------- */ + +struct UBiDi { + /* pointer to parent paragraph object (pointer to self if this object is + * a paragraph object); set to NULL in a newly opened object; set to a + * real value after a successful execution of ubidi_setPara or ubidi_setLine + */ + const UBiDi * pParaBiDi; + + /* alias pointer to the current text */ + const UChar *text; + + /* length of the current text */ + int32_t originalLength; + + /* if the UBIDI_OPTION_STREAMING option is set, this is the length + * of text actually processed by ubidi_setPara, which may be shorter than + * the original length. + * Otherwise, it is identical to the original length. + */ + int32_t length; + + /* if the UBIDI_OPTION_REMOVE_CONTROLS option is set, and/or + * marks are allowed to be inserted in one of the reordering mode, the + * length of the result string may be different from the processed length. + */ + int32_t resultLength; + + /* memory sizes in bytes */ + int32_t dirPropsSize, levelsSize, openingsSize, parasSize, runsSize, isolatesSize; + + /* allocated memory */ + DirProp *dirPropsMemory; + UBiDiLevel *levelsMemory; + Opening *openingsMemory; + Para *parasMemory; + Run *runsMemory; + Isolate *isolatesMemory; + + /* indicators for whether memory may be allocated after ubidi_open() */ + UBool mayAllocateText, mayAllocateRuns; + + /* arrays with one value per text-character */ + DirProp *dirProps; + UBiDiLevel *levels; + + /* are we performing an approximation of the "inverse BiDi" algorithm? */ + UBool isInverse; + + /* are we using the basic algorithm or its variation? */ + UBiDiReorderingMode reorderingMode; + + /* UBIDI_REORDER_xxx values must be ordered so that all the regular + * logical to visual modes come first, and all inverse BiDi modes + * come last. + */ + #define UBIDI_REORDER_LAST_LOGICAL_TO_VISUAL UBIDI_REORDER_NUMBERS_SPECIAL + + /* bitmask for reordering options */ + uint32_t reorderingOptions; + + /* must block separators receive level 0? */ + UBool orderParagraphsLTR; + + /* the paragraph level */ + UBiDiLevel paraLevel; + /* original paraLevel when contextual */ + /* must be one of UBIDI_DEFAULT_xxx or 0 if not contextual */ + UBiDiLevel defaultParaLevel; + + /* context data */ + const UChar *prologue; + int32_t proLength; + const UChar *epilogue; + int32_t epiLength; + + /* the following is set in ubidi_setPara, used in processPropertySeq */ + const struct ImpTabPair * pImpTabPair; /* pointer to levels state table pair */ + + /* the overall paragraph or line directionality - see UBiDiDirection */ + UBiDiDirection direction; + + /* flags is a bit set for which directional properties are in the text */ + Flags flags; + + /* lastArabicPos is index to the last AL in the text, -1 if none */ + int32_t lastArabicPos; + + /* characters after trailingWSStart are WS and are */ + /* implicitly at the paraLevel (rule (L1)) - levels may not reflect that */ + int32_t trailingWSStart; + + /* fields for paragraph handling */ + int32_t paraCount; /* set in getDirProps() */ + /* filled in getDirProps() */ + Para *paras; + + /* for relatively short text, we only need a tiny array of paras (no malloc()) */ + Para simpleParas[SIMPLE_PARAS_COUNT]; + + /* fields for line reordering */ + int32_t runCount; /* ==-1: runs not set up yet */ + Run *runs; + + /* for non-mixed text, we only need a tiny array of runs (no malloc()) */ + Run simpleRuns[1]; + + /* maximum or current nesting depth of isolate sequences */ + /* Within resolveExplicitLevels() and checkExplicitLevels(), this is the maximal + nesting encountered. + Within resolveImplicitLevels(), this is the index of the current isolates + stack entry. */ + int32_t isolateCount; + Isolate *isolates; + + /* for simple text, have a small stack (no malloc()) */ + Isolate simpleIsolates[SIMPLE_ISOLATES_COUNT]; + + /* for inverse Bidi with insertion of directional marks */ + InsertPoints insertPoints; + + /* for option UBIDI_OPTION_REMOVE_CONTROLS */ + int32_t controlCount; + + /* for Bidi class callback */ + UBiDiClassCallback *fnClassCallback; /* action pointer */ + const void *coClassCallback; /* context pointer */ +}; + +#define IS_VALID_PARA(x) ((x) && ((x)->pParaBiDi==(x))) +#define IS_VALID_PARA_OR_LINE(x) ((x) && ((x)->pParaBiDi==(x) || (((x)->pParaBiDi) && (x)->pParaBiDi->pParaBiDi==(x)->pParaBiDi))) + +typedef union { + DirProp *dirPropsMemory; + UBiDiLevel *levelsMemory; + Opening *openingsMemory; + Para *parasMemory; + Run *runsMemory; + Isolate *isolatesMemory; +} BidiMemoryForAllocation; + +/* Macros for initial checks at function entry */ +#define RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \ + if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return retvalue; \ +} UPRV_BLOCK_MACRO_END +#define RETURN_IF_NOT_VALID_PARA(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \ + if(!IS_VALID_PARA(bidi)) { \ + errcode=U_INVALID_STATE_ERROR; \ + return retvalue; \ + } \ +} UPRV_BLOCK_MACRO_END +#define RETURN_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \ + if(!IS_VALID_PARA_OR_LINE(bidi)) { \ + errcode=U_INVALID_STATE_ERROR; \ + return retvalue; \ + } \ +} UPRV_BLOCK_MACRO_END +#define RETURN_IF_BAD_RANGE(arg, start, limit, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \ + if((arg)<(start) || (arg)>=(limit)) { \ + (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \ + return retvalue; \ + } \ +} UPRV_BLOCK_MACRO_END + +#define RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrcode) UPRV_BLOCK_MACRO_BEGIN { \ + if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return; \ +} UPRV_BLOCK_MACRO_END +#define RETURN_VOID_IF_NOT_VALID_PARA(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \ + if(!IS_VALID_PARA(bidi)) { \ + errcode=U_INVALID_STATE_ERROR; \ + return; \ + } \ +} UPRV_BLOCK_MACRO_END +#define RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \ + if(!IS_VALID_PARA_OR_LINE(bidi)) { \ + errcode=U_INVALID_STATE_ERROR; \ + return; \ + } \ +} UPRV_BLOCK_MACRO_END +#define RETURN_VOID_IF_BAD_RANGE(arg, start, limit, errcode) UPRV_BLOCK_MACRO_BEGIN { \ + if((arg)<(start) || (arg)>=(limit)) { \ + (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \ + return; \ + } \ +} UPRV_BLOCK_MACRO_END + +/* helper function to (re)allocate memory if allowed */ +U_CFUNC UBool +ubidi_getMemory(BidiMemoryForAllocation *pMemory, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded); + +/* helper macros for each allocated array in UBiDi */ +#define getDirPropsMemory(pBiDi, length) \ + ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \ + (pBiDi)->mayAllocateText, (length)) + +#define getLevelsMemory(pBiDi, length) \ + ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \ + (pBiDi)->mayAllocateText, (length)) + +#define getRunsMemory(pBiDi, length) \ + ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \ + (pBiDi)->mayAllocateRuns, (length)*sizeof(Run)) + +/* additional macros used by ubidi_open() - always allow allocation */ +#define getInitialDirPropsMemory(pBiDi, length) \ + ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \ + true, (length)) + +#define getInitialLevelsMemory(pBiDi, length) \ + ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \ + true, (length)) + +#define getInitialOpeningsMemory(pBiDi, length) \ + ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->openingsMemory, &(pBiDi)->openingsSize, \ + true, (length)*sizeof(Opening)) + +#define getInitialParasMemory(pBiDi, length) \ + ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->parasMemory, &(pBiDi)->parasSize, \ + true, (length)*sizeof(Para)) + +#define getInitialRunsMemory(pBiDi, length) \ + ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \ + true, (length)*sizeof(Run)) + +#define getInitialIsolatesMemory(pBiDi, length) \ + ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->isolatesMemory, &(pBiDi)->isolatesSize, \ + true, (length)*sizeof(Isolate)) + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubrkimpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubrkimpl.h new file mode 100644 index 0000000000000000000000000000000000000000..8197f66339e47f9415a08885adff32e2d5501899 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ubrkimpl.h @@ -0,0 +1,15 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2006, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef UBRKIMPL_H +#define UBRKIMPL_H + +#define U_ICUDATA_BRKITR U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "brkitr" + +#endif /*UBRKIMPL_H*/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucase.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucase.h new file mode 100644 index 0000000000000000000000000000000000000000..a018f82b81b22925c3c6140e36a699cf15cf5c5d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucase.h @@ -0,0 +1,445 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2004-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: ucase.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2004aug30 +* created by: Markus W. Scherer +* +* Low-level Unicode character/string case mapping code. +*/ + +#ifndef __UCASE_H__ +#define __UCASE_H__ + +#include "unicode/utypes.h" +#include "unicode/uset.h" +#include "putilimp.h" +#include "uset_imp.h" +#include "udataswp.h" +#include "utrie2.h" + +#ifdef __cplusplus +U_NAMESPACE_BEGIN + +class UnicodeString; + +U_NAMESPACE_END +#endif + +/* library API -------------------------------------------------------------- */ + +U_CFUNC void U_EXPORT2 +ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode); + +/** + * Requires non-NULL locale ID but otherwise does the equivalent of + * checking for language codes as if uloc_getLanguage() were called: + * Accepts both 2- and 3-letter codes and accepts case variants. + */ +U_CFUNC int32_t +ucase_getCaseLocale(const char *locale); + +/* Casing locale types for ucase_getCaseLocale */ +enum { + UCASE_LOC_UNKNOWN, + UCASE_LOC_ROOT, + UCASE_LOC_TURKISH, + UCASE_LOC_LITHUANIAN, + UCASE_LOC_GREEK, + UCASE_LOC_DUTCH, + UCASE_LOC_ARMENIAN +}; + +/** + * Bit mask for getting just the options from a string compare options word + * that are relevant for case-insensitive string comparison. + * See stringoptions.h. Also include _STRNCMP_STYLE and U_COMPARE_CODE_POINT_ORDER. + * @internal + */ +#define _STRCASECMP_OPTIONS_MASK 0xffff + +/** + * Bit mask for getting just the options from a string compare options word + * that are relevant for case folding (of a single string or code point). + * + * Currently only bit 0 for U_FOLD_CASE_EXCLUDE_SPECIAL_I. + * It is conceivable that at some point we might use one more bit for using uppercase sharp s. + * It is conceivable that at some point we might want the option to use only simple case foldings + * when operating on strings. + * + * See stringoptions.h. + * @internal + */ +#define _FOLD_CASE_OPTIONS_MASK 7 + +/* single-code point functions */ + +U_CAPI UChar32 U_EXPORT2 +ucase_tolower(UChar32 c); + +U_CAPI UChar32 U_EXPORT2 +ucase_toupper(UChar32 c); + +U_CAPI UChar32 U_EXPORT2 +ucase_totitle(UChar32 c); + +U_CAPI UChar32 U_EXPORT2 +ucase_fold(UChar32 c, uint32_t options); + +/** + * Adds all simple case mappings and the full case folding for c to sa, + * and also adds special case closure mappings. + * c itself is not added. + * For example, the mappings + * - for s include long s + * - for sharp s include ss + * - for k include the Kelvin sign + */ +U_CFUNC void U_EXPORT2 +ucase_addCaseClosure(UChar32 c, const USetAdder *sa); + +/** + * Maps the string to single code points and adds the associated case closure + * mappings. + * The string is mapped to code points if it is their full case folding string. + * In other words, this performs a reverse full case folding and then + * adds the case closure items of the resulting code points. + * If the string is found and its closure applied, then + * the string itself is added as well as part of its code points' closure. + * It must be length>=0. + * + * @return true if the string was found + */ +U_CFUNC UBool U_EXPORT2 +ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa); + +#ifdef __cplusplus +U_NAMESPACE_BEGIN + +/** + * Iterator over characters with more than one code point in the full default Case_Folding. + */ +class U_COMMON_API FullCaseFoldingIterator { +public: + /** Constructor. */ + FullCaseFoldingIterator(); + /** + * Returns the next (cp, full) pair where "full" is cp's full default Case_Folding. + * Returns a negative cp value at the end of the iteration. + */ + UChar32 next(UnicodeString &full); +private: + FullCaseFoldingIterator(const FullCaseFoldingIterator &); // no copy + FullCaseFoldingIterator &operator=(const FullCaseFoldingIterator &); // no assignment + + const UChar *unfold; + int32_t unfoldRows; + int32_t unfoldRowWidth; + int32_t unfoldStringWidth; + int32_t currentRow; + int32_t rowCpIndex; +}; + +/** + * Fast case mapping data for ASCII/Latin. + * Linear arrays of delta bytes: 0=no mapping; EXC=exception. + * Deltas must not cross the ASCII boundary, or else they cannot be easily used + * in simple UTF-8 code. + */ +namespace LatinCase { + +/** Case mapping/folding data for code points up to U+017F. */ +constexpr UChar LIMIT = 0x180; +/** U+017F case-folds and uppercases crossing the ASCII boundary. */ +constexpr UChar LONG_S = 0x17f; +/** Exception: Complex mapping, or too-large delta. */ +constexpr int8_t EXC = -0x80; + +/** Deltas for lowercasing for most locales, and default case folding. */ +extern const int8_t TO_LOWER_NORMAL[LIMIT]; +/** Deltas for lowercasing for tr/az/lt, and Turkic case folding. */ +extern const int8_t TO_LOWER_TR_LT[LIMIT]; + +/** Deltas for uppercasing for most locales. */ +extern const int8_t TO_UPPER_NORMAL[LIMIT]; +/** Deltas for uppercasing for tr/az. */ +extern const int8_t TO_UPPER_TR[LIMIT]; + +} // namespace LatinCase + +U_NAMESPACE_END +#endif + +/** @return UCASE_NONE, UCASE_LOWER, UCASE_UPPER, UCASE_TITLE */ +U_CAPI int32_t U_EXPORT2 +ucase_getType(UChar32 c); + +/** @return like ucase_getType() but also sets UCASE_IGNORABLE if c is case-ignorable */ +U_CAPI int32_t U_EXPORT2 +ucase_getTypeOrIgnorable(UChar32 c); + +U_CAPI UBool U_EXPORT2 +ucase_isSoftDotted(UChar32 c); + +U_CAPI UBool U_EXPORT2 +ucase_isCaseSensitive(UChar32 c); + +/* string case mapping functions */ + +U_CDECL_BEGIN + +/** + * Iterator function for string case mappings, which need to look at the + * context (surrounding text) of a given character for conditional mappings. + * + * The iterator only needs to go backward or forward away from the + * character in question. It does not use any indexes on this interface. + * It does not support random access or an arbitrary change of + * iteration direction. + * + * The code point being case-mapped itself is never returned by + * this iterator. + * + * @param context A pointer to the iterator's working data. + * @param dir If <0 then start iterating backward from the character; + * if >0 then start iterating forward from the character; + * if 0 then continue iterating in the current direction. + * @return Next code point, or <0 when the iteration is done. + */ +typedef UChar32 U_CALLCONV +UCaseContextIterator(void *context, int8_t dir); + +/** + * Sample struct which may be used by some implementations of + * UCaseContextIterator. + */ +struct UCaseContext { + void *p; + int32_t start, index, limit; + int32_t cpStart, cpLimit; + int8_t dir; + int8_t b1, b2, b3; +}; +typedef struct UCaseContext UCaseContext; + +U_CDECL_END + +#define UCASECONTEXT_INITIALIZER { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + +enum { + /** + * For string case mappings, a single character (a code point) is mapped + * either to itself (in which case in-place mapping functions do nothing), + * or to another single code point, or to a string. + * Aside from the string contents, these are indicated with a single int32_t + * value as follows: + * + * Mapping to self: Negative values (~self instead of -self to support U+0000) + * + * Mapping to another code point: Positive values >UCASE_MAX_STRING_LENGTH + * + * Mapping to a string: The string length (0..UCASE_MAX_STRING_LENGTH) is + * returned. Note that the string result may indeed have zero length. + */ + UCASE_MAX_STRING_LENGTH=0x1f +}; + +/** + * Get the full lowercase mapping for c. + * + * @param csp Case mapping properties. + * @param c Character to be mapped. + * @param iter Character iterator, used for context-sensitive mappings. + * See UCaseContextIterator for details. + * If iter==NULL then a context-independent result is returned. + * @param context Pointer to be passed into iter. + * @param pString If the mapping result is a string, then the pointer is + * written to *pString. + * @param caseLocale Case locale value from ucase_getCaseLocale(). + * @return Output code point or string length, see UCASE_MAX_STRING_LENGTH. + * + * @see UCaseContextIterator + * @see UCASE_MAX_STRING_LENGTH + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ucase_toFullLower(UChar32 c, + UCaseContextIterator *iter, void *context, + const UChar **pString, + int32_t caseLocale); + +U_CAPI int32_t U_EXPORT2 +ucase_toFullUpper(UChar32 c, + UCaseContextIterator *iter, void *context, + const UChar **pString, + int32_t caseLocale); + +U_CAPI int32_t U_EXPORT2 +ucase_toFullTitle(UChar32 c, + UCaseContextIterator *iter, void *context, + const UChar **pString, + int32_t caseLocale); + +U_CAPI int32_t U_EXPORT2 +ucase_toFullFolding(UChar32 c, + const UChar **pString, + uint32_t options); + +U_CFUNC int32_t U_EXPORT2 +ucase_hasBinaryProperty(UChar32 c, UProperty which); + + +U_CDECL_BEGIN + +/** + * @internal + */ +typedef int32_t U_CALLCONV +UCaseMapFull(UChar32 c, + UCaseContextIterator *iter, void *context, + const UChar **pString, + int32_t caseLocale); + +U_CDECL_END + +/* file definitions --------------------------------------------------------- */ + +#define UCASE_DATA_NAME "ucase" +#define UCASE_DATA_TYPE "icu" + +/* format "cAsE" */ +#define UCASE_FMT_0 0x63 +#define UCASE_FMT_1 0x41 +#define UCASE_FMT_2 0x53 +#define UCASE_FMT_3 0x45 + +/* indexes into indexes[] */ +enum { + UCASE_IX_INDEX_TOP, + UCASE_IX_LENGTH, + UCASE_IX_TRIE_SIZE, + UCASE_IX_EXC_LENGTH, + UCASE_IX_UNFOLD_LENGTH, + + UCASE_IX_MAX_FULL_LENGTH=15, + UCASE_IX_TOP=16 +}; + +/* definitions for 16-bit case properties word ------------------------------ */ + +U_CFUNC const UTrie2 * U_EXPORT2 +ucase_getTrie(); + +/* 2-bit constants for types of cased characters */ +#define UCASE_TYPE_MASK 3 +enum { + UCASE_NONE, + UCASE_LOWER, + UCASE_UPPER, + UCASE_TITLE +}; + +#define UCASE_GET_TYPE(props) ((props)&UCASE_TYPE_MASK) +#define UCASE_GET_TYPE_AND_IGNORABLE(props) ((props)&7) + +#define UCASE_IS_UPPER_OR_TITLE(props) ((props)&2) + +#define UCASE_IGNORABLE 4 +#define UCASE_EXCEPTION 8 +#define UCASE_SENSITIVE 0x10 + +#define UCASE_HAS_EXCEPTION(props) ((props)&UCASE_EXCEPTION) + +#define UCASE_DOT_MASK 0x60 +enum { + UCASE_NO_DOT=0, /* normal characters with cc=0 */ + UCASE_SOFT_DOTTED=0x20, /* soft-dotted characters with cc=0 */ + UCASE_ABOVE=0x40, /* "above" accents with cc=230 */ + UCASE_OTHER_ACCENT=0x60 /* other accent character (0>UCASE_DELTA_SHIFT) +#else +# define UCASE_GET_DELTA(props) (int16_t)(((props)&0x8000) ? (((props)>>UCASE_DELTA_SHIFT)|0xfe00) : ((uint16_t)(props)>>UCASE_DELTA_SHIFT)) +#endif + +/* exception: bits 15..4 are an unsigned 12-bit index into the exceptions array */ +#define UCASE_EXC_SHIFT 4 +#define UCASE_EXC_MASK 0xfff0 +#define UCASE_MAX_EXCEPTIONS ((UCASE_EXC_MASK>>UCASE_EXC_SHIFT)+1) + +/* definitions for 16-bit main exceptions word ------------------------------ */ + +/* first 8 bits indicate values in optional slots */ +enum { + UCASE_EXC_LOWER, + UCASE_EXC_FOLD, + UCASE_EXC_UPPER, + UCASE_EXC_TITLE, + UCASE_EXC_DELTA, + UCASE_EXC_5, /* reserved */ + UCASE_EXC_CLOSURE, + UCASE_EXC_FULL_MAPPINGS, + UCASE_EXC_ALL_SLOTS /* one past the last slot */ +}; + +/* each slot is 2 uint16_t instead of 1 */ +#define UCASE_EXC_DOUBLE_SLOTS 0x100 + +enum { + UCASE_EXC_NO_SIMPLE_CASE_FOLDING=0x200, + UCASE_EXC_DELTA_IS_NEGATIVE=0x400, + UCASE_EXC_SENSITIVE=0x800 +}; + +/* UCASE_EXC_DOT_MASK=UCASE_DOT_MASK< &ownedIter, UErrorCode &errorCode); + +#endif + +U_NAMESPACE_END + +#include "unicode/unistr.h" // for UStringCaseMapper + +/* + * Internal string casing functions implementing + * ustring.h/ustrcase.cpp and UnicodeString case mapping functions. + */ + +struct UCaseMap : public icu::UMemory { + /** Implements most of ucasemap_open(). */ + UCaseMap(const char *localeID, uint32_t opts, UErrorCode *pErrorCode); + ~UCaseMap(); + +#if !UCONFIG_NO_BREAK_ITERATION + icu::BreakIterator *iter; /* We adopt the iterator, so we own it. */ +#endif + char locale[32]; + int32_t caseLocale; + uint32_t options; +}; + +#if UCONFIG_NO_BREAK_ITERATION +# define UCASEMAP_BREAK_ITERATOR_PARAM +# define UCASEMAP_BREAK_ITERATOR_UNUSED +# define UCASEMAP_BREAK_ITERATOR +# define UCASEMAP_BREAK_ITERATOR_NULL +#else +# define UCASEMAP_BREAK_ITERATOR_PARAM icu::BreakIterator *iter, +# define UCASEMAP_BREAK_ITERATOR_UNUSED icu::BreakIterator *, +# define UCASEMAP_BREAK_ITERATOR iter, +# define UCASEMAP_BREAK_ITERATOR_NULL NULL, +#endif + +U_CFUNC int32_t +ustrcase_getCaseLocale(const char *locale); + +// TODO: swap src / dest if approved for new public api +/** Implements UStringCaseMapper. */ +U_CFUNC int32_t U_CALLCONV +ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM + UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + icu::Edits *edits, + UErrorCode &errorCode); + +/** Implements UStringCaseMapper. */ +U_CFUNC int32_t U_CALLCONV +ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM + UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + icu::Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** Implements UStringCaseMapper. */ +U_CFUNC int32_t U_CALLCONV +ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, + icu::BreakIterator *iter, + UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + icu::Edits *edits, + UErrorCode &errorCode); + +#endif + +/** Implements UStringCaseMapper. */ +U_CFUNC int32_t U_CALLCONV +ustrcase_internalFold(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM + UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + icu::Edits *edits, + UErrorCode &errorCode); + +/** + * Common string case mapping implementation for ucasemap_toXyz() and UnicodeString::toXyz(). + * Implements argument checking. + */ +U_CFUNC int32_t +ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM + UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UStringCaseMapper *stringCaseMapper, + icu::Edits *edits, + UErrorCode &errorCode); + +/** + * Common string case mapping implementation for old-fashioned u_strToXyz() functions + * that allow the source string to overlap the destination buffer. + * Implements argument checking and internally works with an intermediate buffer if necessary. + */ +U_CFUNC int32_t +ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM + UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UStringCaseMapper *stringCaseMapper, + UErrorCode &errorCode); + +/** + * UTF-8 string case mapping function type, used by ucasemap_mapUTF8(). + * UTF-8 version of UStringCaseMapper. + * All error checking must be done. + * The UCaseMap must be fully initialized, with locale and/or iter set as needed. + */ +typedef void U_CALLCONV +UTF8CaseMapper(int32_t caseLocale, uint32_t options, +#if !UCONFIG_NO_BREAK_ITERATION + icu::BreakIterator *iter, +#endif + const uint8_t *src, int32_t srcLength, + icu::ByteSink &sink, icu::Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** Implements UTF8CaseMapper. */ +U_CFUNC void U_CALLCONV +ucasemap_internalUTF8ToTitle(int32_t caseLocale, uint32_t options, + icu::BreakIterator *iter, + const uint8_t *src, int32_t srcLength, + icu::ByteSink &sink, icu::Edits *edits, + UErrorCode &errorCode); + +#endif + +void +ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM + const char *src, int32_t srcLength, + UTF8CaseMapper *stringCaseMapper, + icu::ByteSink &sink, icu::Edits *edits, + UErrorCode &errorCode); + +/** + * Implements argument checking and buffer handling + * for UTF-8 string case mapping as a common function. + */ +int32_t +ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM + char *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UTF8CaseMapper *stringCaseMapper, + icu::Edits *edits, + UErrorCode &errorCode); + +U_NAMESPACE_BEGIN +namespace GreekUpper { + +// Data bits. +static const uint32_t UPPER_MASK = 0x3ff; +static const uint32_t HAS_VOWEL = 0x1000; +static const uint32_t HAS_YPOGEGRAMMENI = 0x2000; +static const uint32_t HAS_ACCENT = 0x4000; +static const uint32_t HAS_DIALYTIKA = 0x8000; +// Further bits during data building and processing, not stored in the data map. +static const uint32_t HAS_COMBINING_DIALYTIKA = 0x10000; +static const uint32_t HAS_OTHER_GREEK_DIACRITIC = 0x20000; + +static const uint32_t HAS_VOWEL_AND_ACCENT = HAS_VOWEL | HAS_ACCENT; +static const uint32_t HAS_VOWEL_AND_ACCENT_AND_DIALYTIKA = + HAS_VOWEL_AND_ACCENT | HAS_DIALYTIKA; +static const uint32_t HAS_EITHER_DIALYTIKA = HAS_DIALYTIKA | HAS_COMBINING_DIALYTIKA; + +// State bits. +static const uint32_t AFTER_CASED = 1; +static const uint32_t AFTER_VOWEL_WITH_ACCENT = 2; + +uint32_t getLetterData(UChar32 c); + +/** + * Returns a non-zero value for each of the Greek combining diacritics + * listed in The Unicode Standard, version 8, chapter 7.2 Greek, + * plus some perispomeni look-alikes. + */ +uint32_t getDiacriticData(UChar32 c); + +} // namespace GreekUpper +U_NAMESPACE_END + +#endif // __cplusplus + +#endif // __UCASEMAP_IMP_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uchar_props_data.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uchar_props_data.h new file mode 100644 index 0000000000000000000000000000000000000000..9a78918204f0e9e925f9f18d480df37138b6d85c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uchar_props_data.h @@ -0,0 +1,3860 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// Copyright (C) 1999-2016, International Business Machines +// Corporation and others. All Rights Reserved. +// +// file name: uchar_props_data.h +// +// machine-generated by: icu/tools/unicode/c/genprops/corepropsbuilder.cpp + + +#ifdef INCLUDED_FROM_UCHAR_C + +static const UVersionInfo dataVersion={0xd,0,0,0}; + +static const uint16_t propsTrie_index[22276]={ +0x46d,0x475,0x47d,0x485,0x49d,0x4a5,0x4ad,0x4b5,0x4bd,0x4c5,0x4cb,0x4d3,0x4db,0x4e3,0x4eb,0x4f3, +0x4f9,0x501,0x509,0x511,0x514,0x51c,0x524,0x52c,0x534,0x53c,0x538,0x540,0x548,0x550,0x555,0x55d, +0x565,0x56d,0x571,0x579,0x581,0x589,0x591,0x599,0x595,0x59d,0x5a2,0x5aa,0x5b0,0x5b8,0x5c0,0x5c8, +0x5d0,0x5d8,0x5e0,0x5e8,0x5ed,0x5f5,0x5f8,0x600,0x608,0x610,0x616,0x61e,0x61d,0x625,0x62d,0x635, +0x645,0x63d,0x64d,0x655,0x48d,0x665,0x66b,0x65d,0x67b,0x67d,0x685,0x673,0x695,0x69b,0x6a3,0x68d, +0x6b3,0x6b9,0x6c1,0x6ab,0x6d1,0x6d7,0x6df,0x6c9,0x6ef,0x6f5,0x6fd,0x6e7,0x70d,0x715,0x71d,0x705, +0x72d,0x733,0x73b,0x725,0x74b,0x751,0x759,0x743,0x769,0x76e,0x776,0x761,0x786,0x78d,0x795,0x77e, +0x619,0x79d,0x7a5,0x48d,0x7ad,0x7b4,0x7bc,0x48d,0x7c4,0x7cc,0x7d4,0x7d9,0x7e1,0x7e8,0x7f0,0x48d, +0x5d8,0x7f8,0x800,0x808,0x810,0x565,0x820,0x818,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x828,0x5d8,0x830,0x834,0x83c,0x5d8,0x842,0x5d8,0x848,0x850,0x858,0x565,0x565,0x860, +0x868,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x86d,0x875,0x5d8,0x5d8,0x87d,0x885,0x88d,0x895,0x89d,0x5d8,0x8a5,0x8ad,0x8b5, +0x8c5,0x5d8,0x8cd,0x8cf,0x8d7,0x8bd,0x5d8,0x8da,0x8ee,0x8e2,0x8ea,0x8f6,0x5d8,0x8fe,0x904,0x90c, +0x914,0x5d8,0x924,0x92c,0x934,0x91c,0x944,0x48d,0x94c,0x94f,0x957,0x93c,0x967,0x95f,0x5d8,0x96e, +0x5d8,0x97d,0x976,0x985,0x98d,0x991,0x999,0x9a1,0x50d,0x9a9,0x9ac,0x9b2,0x9b9,0x9ac,0x534,0x9c1, +0x4bd,0x4bd,0x4bd,0x4bd,0x9c9,0x4bd,0x4bd,0x4bd,0x9d9,0x9e1,0x9e9,0x9f1,0x9f9,0x9fd,0xa05,0x9d1, +0xa1d,0xa25,0xa0d,0xa15,0xa2d,0xa35,0xa3d,0xa45,0xa5d,0xa4d,0xa55,0xa65,0xa6d,0xa7c,0xa81,0xa74, +0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa91,0xa99,0x90c,0xa9c,0xaa4,0xaab,0xab0,0xab8, +0x90c,0xabf,0xabe,0xacf,0xad2,0x90c,0x90c,0xac7,0x90c,0x90c,0x90c,0x90c,0x90c,0xae1,0xae9,0xad9, +0x90c,0x90c,0x90c,0xaee,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xaf4,0xafc,0x90c,0xb04,0xb0b, +0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xa89,0xa89,0xa89,0xa89,0xb13,0xa89,0xb1a,0xb21, +0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0x90c,0xb29,0xb30,0xb34,0xb3a,0x90c,0x90c,0x90c, +0x565,0xb4a,0xb42,0xb52,0x4bd,0x4bd,0x4bd,0xb5a,0x50d,0xb62,0x5d8,0xb68,0xb78,0xb70,0xb70,0x534, +0xb80,0xb88,0xb90,0x48d,0xb98,0x90c,0x90c,0xb9f,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xba7,0xbad, +0xbbd,0xbb5,0x619,0x5d8,0xbc5,0x868,0x5d8,0xbcd,0xbd5,0xbd9,0x5d8,0x5d8,0xbde,0x5d8,0x90c,0xbe5, +0xab9,0xbed,0xbf3,0x90c,0xbed,0xbfb,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, +0xc03,0x5d8,0x5d8,0x5d8,0xc0b,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0xc11,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc16,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x90c,0x90c, +0xc1e,0x5d8,0xc21,0x5d8,0xc29,0xc2f,0xc37,0xc3f,0xc44,0x5d8,0x5d8,0xc48,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc4f,0x5d8,0xc56,0xc5c,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc64,0x5d8,0x5d8,0x5d8,0xc6c,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc6e,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc75,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0xc7c,0x5d8,0x5d8,0x5d8,0xc83,0xc8b,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc90,0x5d8,0x5d8,0xc98,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc9c,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc9f,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xca2,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0xca8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0xcb0,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0xcb5,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xcba,0x5d8,0x5d8,0x5d8,0xcbf,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0xcc7,0xcce,0xcd2,0x5d8,0x5d8,0x5d8,0xcd9,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8ce, +0xce7,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0xcdf,0x90c,0xcef,0x985,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0xcf4,0xcfc,0x4bd,0xd0c,0xd04,0x5d8,0x5d8,0xd14,0xd1c,0xd2c,0x4bd,0xd31,0xd39,0xd3f,0xd47,0xd24, +0xd4f,0xd57,0x5d8,0xd5f,0xd6f,0xd72,0xd67,0xd7a,0x62d,0xd82,0xd89,0x8ce,0x67b,0xd99,0xd91,0xda1, +0x5d8,0xda9,0xdb1,0xdb9,0x5d8,0xdc1,0xdc9,0xdd1,0xdd9,0xde1,0xde5,0xded,0x50d,0x50d,0x5d8,0xdf5, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xdfd,0xe09,0xe01, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11, +0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0x5d8,0x5d8,0x5d8,0xe21,0x5d8,0xcda,0xe28,0xe2d, +0x5d8,0x5d8,0x5d8,0xe35,0x5d8,0x5d8,0x8d9,0x48d,0xe4b,0xe3b,0xe43,0x5d8,0x5d8,0xe53,0xe5b,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xe60,0xe68,0x5d8,0xe6c,0x5d8,0xe72,0xe76, +0xe7e,0xe86,0xe8d,0xe95,0x5d8,0x5d8,0x5d8,0xe9b,0xeb3,0x47d,0xebb,0xec3,0xec8,0x8ee,0xea3,0xeab, +0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11, +0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11, +0x1234,0x1234,0x1274,0x12b4,0x12f4,0x132c,0x136c,0x13ac,0x13e4,0x1424,0x1450,0x1490,0x14d0,0x14e0,0x1520,0x1554, +0x1594,0x15c4,0x1604,0x1644,0x1654,0x1688,0x16c0,0x1700,0x1740,0x1780,0x17b4,0x17e0,0x1820,0x1858,0x1874,0x18b4, +0xa80,0xac0,0xb00,0xb40,0xb80,0xa40,0xbc0,0xa40,0xbe2,0xa40,0xa40,0xa40,0xa40,0xc22,0x1db,0x1db, +0xc62,0xca2,0xa40,0xa40,0xa40,0xa40,0xce2,0xd02,0xa40,0xa40,0xd42,0xd82,0xdc2,0xe02,0xe42,0xe82, +0xec2,0xef9,0x1db,0x1db,0xf1d,0xf51,0x1db,0xf79,0x1db,0x1db,0x1db,0x1db,0xfa6,0x1db,0x1db,0x1db, +0x1db,0x1db,0x1db,0x1db,0xfba,0x1db,0xff2,0x1032,0x1db,0x103d,0x1db,0x1db,0x1db,0x1073,0xa40,0x10b3, +0x1db,0x1db,0x10f3,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0x1133,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700, +0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1173, +0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700, +0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1173, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0xed0,0xed7,0xedf,0x48d,0x5d8,0x5d8,0x5d8,0xee7,0xef7,0xeef,0xf0e,0xeff,0xf06,0xf16,0xf1a,0xf1e, +0x48d,0x48d,0x48d,0x48d,0x8ce,0x5d8,0xf26,0xf2e,0x5d8,0xf36,0xf3e,0xf42,0xf4a,0x5d8,0xf52,0x48d, +0x565,0x56f,0xf5a,0x5d8,0xf5e,0xf66,0xf76,0xf6e,0x5d8,0xf7e,0x5d8,0xf85,0x48d,0x48d,0x48d,0x48d, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xb78,0x8da,0xe72,0x48d,0x48d,0x48d,0x48d, +0xf95,0xf8d,0xf98,0xfa0,0x8ee,0xfa8,0x48d,0xfb0,0xfb8,0xfc0,0x48d,0x48d,0x5d8,0xfd0,0xfd8,0xfc8, +0xfe8,0xfef,0xfe0,0xff7,0xfff,0x48d,0x100f,0x1007,0x5d8,0x1012,0x101a,0x1022,0x102a,0x1032,0x48d,0x48d, +0x5d8,0x5d8,0x103a,0x48d,0x565,0x1042,0x50d,0x104a,0x5d8,0x1052,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x105a,0x5d8,0x1062,0x48d,0x48d,0x106a,0x1072,0x1079,0x48d,0x48d,0xe68,0x1081,0xb78, +0x1091,0x60e,0x1099,0x1089,0x967,0x10a1,0x10a9,0x10af,0x10c7,0x10b7,0x10bf,0x10cb,0x967,0x10db,0x10d3,0x10e3, +0x10f3,0x10eb,0x48d,0x48d,0x10fa,0x1102,0x630,0x110a,0x111a,0x1120,0x1128,0x1112,0x48d,0x48d,0x48d,0x48d, +0x5d8,0x1130,0x1138,0x1140,0x5d8,0x1148,0x1150,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x1158,0x1160,0x48d, +0x5d8,0x1168,0x1170,0x1178,0x5d8,0x1188,0x1180,0x48d,0x848,0x1190,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x5d8,0x1198,0x48d,0x48d,0x48d,0x565,0x50d,0x11a0,0x11b0,0x11b6,0x11a8,0x48d,0x48d,0x11c6,0x11ca,0x11be, +0x11e2,0x11d2,0x11da,0x5d8,0x11f2,0x11ea,0x5d8,0x8cf,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x1208,0x120d,0x11fa,0x1202,0x121d,0x1215,0x48d,0x48d,0x122c,0x1230,0x1224,0x1240,0x1238,0x1180,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x1244,0x48d,0x48d,0x48d,0x48d,0x48d,0x124b,0x125b,0x1253, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8d9,0x48d,0x48d,0x48d, +0x126b,0x1273,0x127b,0x1263,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1283,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x128b,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x1293,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x8cf,0x8ee,0x129b,0x48d,0x48d,0xe68,0x12a3,0x5d8,0x12b3,0x12bb,0x12c3,0x12ab,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x565,0x50d,0x12cb,0x48d,0x48d,0x48d,0x5d8,0x5d8,0x12d3,0x12d8,0x12de,0x48d, +0x48d,0x12e6,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x12ee,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8da,0x48d,0x103a,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8ee,0x48d,0x12f4,0x12fb,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xe01,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x1301,0x1306,0x130e,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xba7,0x90c,0x1316,0x90c,0x131d,0x1325,0x132b, +0x90c,0x1331,0x90c,0x90c,0x1339,0x48d,0x48d,0x48d,0x48d,0x1341,0x90c,0x90c,0xabb,0x1349,0x48d,0x48d, +0x48d,0x48d,0x1359,0x1360,0x1365,0x136b,0x1373,0x137b,0x1383,0x135d,0x138b,0x1393,0x139b,0x13a0,0x1372,0x1359, +0x1360,0x135c,0x136b,0x13a8,0x135a,0x13ab,0x135d,0x13b3,0x13bb,0x13c3,0x13ca,0x13b6,0x13be,0x13c6,0x13cd,0x13b9, +0x13d5,0x1351,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, +0x90c,0x90c,0x534,0x13e5,0x534,0x13ec,0x13f3,0x13dd,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x13fa,0x1402,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x1412,0x140a,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x141a,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1422,0x48d,0x565,0x1432,0x142a,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x143a,0x144a,0x1442,0x48d,0x48d,0x145a,0x1452,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x146a,0x1472,0x147a,0x1482,0x148a,0x1492,0x48d,0x1462,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x90c,0x149a,0x90c,0x90c,0xb9f,0x149f,0x14a3,0xba7,0x14ab,0x90c,0x90c,0x90c,0x90c,0xba9, +0x48d,0x14b3,0x14bb,0x14bf,0x14c7,0x14cf,0x48d,0x48d,0x48d,0x48d,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, +0x90c,0x14d7,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, +0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x14df,0x14e7,0x90c,0x90c,0x90c,0xb9f,0x90c,0x90c, +0x14ef,0x14f7,0x149a,0x90c,0x14ff,0x90c,0x1507,0x150c,0x48d,0x48d,0x90c,0x90c,0x90c,0x1514,0x90c,0x90c, +0x151b,0x90c,0x90c,0x90c,0xb9f,0x1520,0x1528,0x152e,0x1533,0x48d,0x90c,0x90c,0x90c,0x90c,0x153b,0x90c, +0xabe,0x117c,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x1543,0x5d8,0x5d8,0x154a,0x5d8,0x5d8,0x5d8,0x1552,0x5d8,0x155a,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0xc80,0x5d8,0x5d8,0x1562,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x156a,0x1572,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xcbf,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1579,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x1580,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1587,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0xf5e,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x158b,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0xf5e,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x1066,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x1590,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x1598,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0xf5e,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, +0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x655,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x15a8,0x15a0,0x15a0,0x15a0,0x48d,0x48d,0x48d,0x48d,0x534,0x534,0x534,0x534,0x534, +0x534,0x534,0x15b0,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, +0x48d,0x48d,0x48d,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, +0xe19,0xe19,0x15b8,0x46c,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf, +0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf, +0xf,0xf,0xf,0xf,0xc,0x17,0x17,0x17,0x19,0x17,0x17,0x17,0x14,0x15,0x17,0x18, +0x17,0x13,0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17, +0x18,0x18,0x18,0x17,0x17,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x14, +0x17,0x15,0x1a,0x16,0x1a,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0x14, +0x18,0x15,0x18,0xf,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf, +0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf, +0xf,0xf,0xf,0xf,0xc,0x17,0x19,0x19,0x19,0x19,0x1b,0x17,0x1a,0x1b,5,0x1c, +0x18,0x10,0x1b,0x1a,0x1b,0x18,0x34b,0x38b,0x1a,2,0x17,0x17,0x1a,0x30b,5,0x1d, +0x34cb,0x344b,0x3ccb,0x17,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0x18,1,1,1,1, +1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,0x18,2,2,2,2, +2,2,2,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,2,1,2,1, +2,1,2,1,2,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,1,2,1,2,1,2,2,2,1,1,2, +1,2,1,1,2,1,1,1,2,2,1,1,1,1,2,1, +1,2,1,1,1,2,2,2,1,1,2,1,1,2,1,2, +1,2,1,1,2,1,2,2,1,2,1,1,2,1,1,1, +2,1,2,1,1,2,2,5,1,2,2,2,5,5,5,5, +1,3,2,1,3,2,1,3,2,1,2,1,2,1,2,1, +2,1,2,1,2,1,2,1,2,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,2,1,3,2, +1,2,1,1,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,2,2,2,2,2,2,1,1, +2,1,1,2,2,1,2,1,1,1,1,2,1,2,1,2, +1,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,5,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, +4,4,0x1a,0x1a,0x1a,0x1a,4,4,4,4,4,4,4,4,4,4, +4,4,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, +4,4,4,4,4,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,4,0x1a,4,0x1a, +0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +1,2,1,2,4,0x1a,1,2,0,0,4,2,2,2,0x17,1, +0,0,0,0,0x1a,0x1a,1,0x17,1,1,1,0,1,0,1,1, +2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0,1,1,1,1,1,1,1,1,1,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,1,2,2,1,1,1,2,2,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,2,2,2,2,1,2,0x18,1,2,1,1,2, +2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,0x1b,6,6,6,6,6,7,7,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,1,2,1,2,1,2,1,2,1,2,1, +2,1,2,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,0,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, +0,4,0x17,0x17,0x17,0x17,0x17,0x17,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,0x17,0x13,0,0,0x1b,0x1b,0x19, +0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,0x13,6, +0x17,6,6,0x17,6,6,0x17,6,0,0,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,5, +5,5,5,0x17,0x17,0,0,0,0,0,0,0,0,0,0,0, +0x10,0x10,0x10,0x10,0x10,0x10,0x18,0x18,0x18,0x17,0x17,0x19,0x17,0x17,0x1b,0x1b, +6,6,6,6,6,6,6,6,6,6,6,0x17,0x10,0,0x17,0x17, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +4,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17,5,5, +6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0x17,5,6,6,6,6,6,6,6,0x10,0x1b,6, +6,6,6,6,6,4,4,6,6,0x1b,6,6,6,6,5,5, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,5,0x1b,0x1b,5, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0x10, +5,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,0,0,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6, +6,6,6,6,6,5,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6, +6,6,6,6,6,6,6,6,4,4,0x1b,0x17,0x17,0x17,4,0, +0,6,0x19,0x19,6,6,6,6,4,6,6,6,4,6,6,6, +6,6,0,0,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,6,6,6,6,4,6, +6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6, +0,0,0x17,0,5,5,5,5,5,5,5,5,5,5,5,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,6,6,0x10,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5, +5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,6, +6,6,6,6,6,6,6,6,6,6,6,6,5,5,6,6, +0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,4,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,8, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,8, +6,5,8,8,8,6,6,6,6,6,6,6,6,8,8,8, +8,6,8,8,5,6,6,6,6,6,6,6,5,5,5,5, +5,5,5,5,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189, +0x1c9,0x209,0x249,0x289,5,5,0x19,0x19,0x37cb,0x35cb,0x3fcb,0x34cb,0x3ccb,0x94b,0x1b,0x19, +5,0x17,6,0,5,6,8,8,0,5,5,5,5,5,5,5, +5,0,0,5,5,0,0,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,5,5,5,5,5,5,5,0,5,0, +0,0,5,5,5,5,0,0,6,5,8,8,8,6,6,6, +6,0,0,8,8,0,0,8,8,6,5,0,0,0,0,0, +0,0,0,8,0,0,0,0,5,5,0,5,0,0,0,0, +0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,6,6,5,5, +5,6,0x17,0,0,0,0,0,0,0,0,0,0,6,6,8, +0,5,5,5,5,5,5,0,0,0,0,5,5,0,0,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5, +5,5,5,5,5,0,5,5,0,5,5,0,5,5,0,0, +6,0,8,8,8,6,6,0,0,0,0,6,6,0,0,6, +6,6,0,0,0,6,0,0,0,0,0,0,0,5,5,5, +5,0,5,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189, +0x1c9,0x209,0x249,0x289,0x17,0x19,0,0,0,0,0,0,0,5,6,6, +6,6,6,6,0,6,6,8,0,5,5,5,5,5,5,5, +5,5,0,5,5,5,0,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,5,5,5,5,5,5,5,0,5,5, +0,5,5,5,5,5,0,0,6,5,8,8,8,6,6,6, +6,6,0,6,6,8,0,8,8,6,0,0,5,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,5,6,6, +0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x1b,5,0x34cb,0x344b, +0x3ccb,0x37cb,0x35cb,0x3fcb,0,0,0,0,0,0,0,0,0,6,8,8, +0,5,5,5,5,5,5,5,5,0,0,5,5,0,0,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5, +5,5,5,5,5,0,5,5,0,5,5,5,5,5,0,0, +6,5,8,6,8,6,6,6,6,0,0,8,8,0,0,8, +8,6,0,0,0,0,0,0,0,6,6,8,0,0,0,0, +5,5,0,5,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189, +0x1c9,0x209,0x249,0x289,0x7cb,0x1e4b,0x784b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x1b,0, +0,0,0,0,0,0,6,5,0,5,5,5,5,5,5,0, +0,0,5,5,5,0,5,5,5,5,0,0,0,5,5,0, +5,0,5,5,0,0,0,5,5,0,0,0,5,5,5,0, +0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0, +0,0,8,8,6,8,8,0,0,0,8,8,8,0,8,8, +8,6,0,0,5,0,0,0,0,0,0,8,0,0,0,0, +0,0,0,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189, +0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,0,0x17,0x54b,0x58b,0x5cb,0x60b, +0x58b,0x5cb,0x60b,0x1b,6,8,8,8,6,5,5,5,5,5,5,5, +5,0,5,5,5,0,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0,0,0,5,6,6,6,8,8,8, +8,0,6,6,6,0,6,6,6,6,0,0,0,0,0,0, +0,6,6,0,5,5,5,0,0,0,0,0,5,5,6,6, +0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,5,5,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,6,8,8, +0x17,5,5,5,5,5,5,5,5,0,5,5,5,0,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5, +5,5,5,5,5,5,5,5,0,5,5,5,5,5,0,0, +6,5,8,6,8,8,8,8,8,0,6,8,8,0,8,8, +6,6,0,0,0,0,0,0,0,8,8,0,0,0,0,0, +0,0,5,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189, +0x1c9,0x209,0x249,0x289,0x7cb,0x1e4b,0x784b,0x34cb,0x344b,0x3ccb,0x37cb,0x35cb,0x3fcb,0x1b,5,5, +5,5,5,5,6,6,8,8,5,5,5,5,5,5,5,5, +5,0,5,5,5,0,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,6,6,5,8,8,8,6,6,6,6,0,8,8, +8,0,8,8,8,6,5,0x1b,0,0,0,0,5,5,5,8, +0xcc0b,0xca0b,0xcb4b,0xc90b,0x364b,0xc94b,0x350b,5,0,0,0,0,0,0,0x49,0x89, +0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,8,8,0x17,0,0,0, +0,0,0,0,0,0,0,0,0,6,8,8,0,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0, +0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,5, +0,5,0,0,5,5,5,5,5,5,5,0,0,0,6,0, +0,0,0,8,8,8,6,6,6,0,6,0,8,8,8,8, +8,8,8,8,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,6,5,5,6,6,6,6,6,6,6,0, +0,0,0,0x19,5,5,5,5,5,5,4,6,6,6,6,6, +6,6,6,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17, +0,0,0,0,0,5,5,0,5,0,5,5,5,5,5,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0,5,0,5,5,5,5,5,5,5,5,5, +5,6,5,5,6,6,6,6,6,6,6,6,6,5,0,0, +5,5,5,5,5,0,4,0,6,6,6,6,6,6,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,5,5,5,5, +5,0x1b,0x1b,0x1b,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0x1b,0x17,0x1b,0x1b,0x1b,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x344b,0x3c4b,0x444b,0x4c4b,0x544b,0x5c4b, +0x644b,0x6c4b,0x744b,0x2c4b,0x1b,6,0x1b,6,0x1b,6,0x14,0x15,0x14,0x15,8,8, +5,5,5,5,5,5,5,5,0,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,8,6,6,6,6,6,0x17,6,6,5,5,5,5, +5,6,6,6,6,6,6,6,6,6,6,6,0,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,0,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b, +0x17,0x17,0x17,0x17,0x17,0x1b,0x1b,0x1b,0x1b,0x17,0x17,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,8,8,6,6,6, +6,8,6,6,6,6,6,6,8,6,6,8,8,6,6,5, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17,0x17,0x17, +5,5,5,5,5,5,8,8,6,6,5,5,5,5,6,6, +6,5,8,8,8,5,5,8,8,8,8,8,8,8,5,5, +5,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5, +5,5,6,8,8,6,6,8,8,8,8,8,8,6,5,8, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,8,8,8,6,0x1b,0x1b, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,0x17,4,2,2,2, +1,1,1,1,1,1,0,1,0,0,0,0,0,1,0,0, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +5,5,5,5,5,5,5,5,5,0,5,5,5,5,0,0, +5,5,5,5,5,5,5,0,5,0,5,5,5,5,0,0, +5,5,5,5,5,5,5,5,5,0,5,5,5,5,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0,5,5,5,5,0,0,5,5,5,5,5,5,5,0, +5,0,5,5,5,5,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0,5,5,5,5,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,0,6,6,6, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b, +0x4cb,0x50b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x788b,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0,0,2,2,2,2,2,2,0,0, +0x13,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x1b,0x17,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0xc,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x14, +0x15,0,0,0,5,5,5,5,5,5,5,5,5,5,5,0x17, +0x17,0x17,0x98a,0x9ca,0xa0a,5,5,5,5,5,5,5,5,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,0,5,5,5,5,6,6,6,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,6,6,6,0x17,0x17,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,6,6,0,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,0,5,5,5,0,6,6,0,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,6,6,8,6,6,6,6,6, +6,6,8,8,8,8,8,8,8,8,6,8,8,6,6,6, +6,6,6,6,6,6,6,6,0x17,0x17,0x17,4,0x17,0x17,0x17,0x19, +5,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +0,0,0,0,0x54b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,6,5,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0x17,0x17,0x17,0x17,0x17,0x17,0x13,0x17,0x17,0x17,0x17,6, +6,6,0x10,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +0,0,0,0,5,5,5,4,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,0,0,0,0,0,0,5,5,5,5, +5,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0, +0,0,0,0,0,0,0,0,6,6,6,8,8,8,8,6, +6,8,8,8,0,0,0,0,8,8,6,8,8,8,8,8, +8,6,6,6,0,0,0,0,0x1b,0,0,0,0x17,0x17,0x49,0x89, +0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0,0,5,5,5,5,5,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x30b,0,0,0,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,6,6,8,8,6,0,0,0x17,0x17, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,4,0x17,0x17,0x17,0x17,0x17,0x17,0,0, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,6, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,8,6,8,6,6,6,6,6,6,6,0, +6,8,6,8,8,6,6,6,6,6,6,6,6,8,8,8, +8,8,8,6,6,6,6,6,6,6,6,6,6,0,0,6, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, +0x17,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,6,6,6,6, +6,6,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0, +6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +6,6,6,6,8,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +6,8,6,6,6,6,6,8,6,8,8,8,8,8,6,8, +8,5,5,5,5,5,5,5,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17,0x17,0x17,5,8,6,6, +6,6,8,8,6,6,8,6,6,6,5,5,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,5,5,5,5,6,6,8,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,8, +6,6,8,8,8,6,8,6,6,6,8,8,0,0,0,0, +0,0,0,0,0x17,0x17,0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0,0,0,5,5,5,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,5,5,5,5,5,5,8,8,8,8,8,8,8,8, +6,6,6,6,6,6,6,6,8,8,6,6,0,0,0,0x17, +0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4, +4,4,0x17,0x17,2,2,2,2,2,2,2,2,2,0,0,0, +0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, +0,1,1,1,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0, +0,0,0,0,6,6,6,0x17,6,6,6,6,6,6,6,6, +6,6,6,6,6,8,6,6,6,6,6,6,6,5,5,5, +5,6,5,5,5,5,5,5,6,5,5,8,6,6,5,0, +0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, +4,4,4,2,2,2,2,2,2,2,2,2,2,2,2,2, +4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4, +4,4,4,4,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,6, +6,6,6,6,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,2,2,2,2,2,2, +2,2,1,2,2,2,2,2,2,2,2,2,1,1,1,1, +1,0x1a,0x1a,0x1a,0,0,2,2,2,0,2,2,1,1,1,1, +3,0x1a,0x1a,0,2,2,2,2,2,2,2,2,1,1,1,1, +1,1,1,1,2,2,2,2,2,2,0,0,1,1,1,1, +1,1,0,0,2,2,2,2,2,2,2,2,1,1,1,1, +1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1, +1,1,1,1,2,2,2,2,2,2,0,0,1,1,1,1, +1,1,0,0,2,2,2,2,2,2,2,2,0,1,0,1, +0,1,0,1,2,2,2,2,2,2,2,2,1,1,1,1, +1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,0,0,2,2,2,2,2,2,2,2,3,3,3,3, +3,3,3,3,2,2,2,2,2,2,2,2,3,3,3,3, +3,3,3,3,2,2,2,2,2,0,2,2,1,1,1,1, +3,0x1a,2,0x1a,0x1a,0x1a,2,2,2,0,2,2,1,1,1,1, +3,0x1a,0x1a,0x1a,2,2,2,2,0,0,2,2,1,1,1,1, +0,0x1a,0x1a,0x1a,0x16,0x17,0x17,0x17,0x18,0x14,0x15,0x17,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x17,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0xc,0x10,0x10,0x10,0x10,0x10,0,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x2cb,4,0,0,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x18,0x18, +0x18,0x14,0x15,4,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0xc,0x10, +0x10,0x10,0x10,0x10,0x13,0x13,0x13,0x13,0x13,0x13,0x17,0x17,0x1c,0x1d,0x14,0x1c, +0x1c,0x1d,0x14,0x1c,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0xd,0xe,0x10,0x10, +0x10,0x10,0x10,0xc,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x1c,0x1d,0x17, +0x17,0x17,0x17,0x16,0x2cb,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x18,0x18, +0x18,0x14,0x15,0,4,4,4,4,4,4,4,4,4,4,4,4, +4,0,0,0,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, +0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, +0x19,0x19,0x19,0x19,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6, +6,7,7,7,7,6,7,7,7,6,6,6,6,6,6,6, +6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x1b,0x1b,0x1b,0x1b,1,0x1b,1,0x1b,1,0x1b,1,1, +1,1,0x1b,2,1,1,1,1,2,5,5,5,5,2,0x1b,0x1b, +2,2,1,1,0x18,0x18,0x18,0x18,0x18,1,2,2,2,2,0x1b,0x18, +0x1b,0x1b,2,0x1b,0x358b,0x360b,0x364b,0x348b,0x388b,0x350b,0x390b,0x3d0b,0x410b,0x354b,0x454b,0x35cb, +0x3dcb,0x45cb,0x4dcb,0x58b,0x1b,0x1b,1,0x1b,0x1b,0x1b,0x1b,1,0x1b,0x1b,2,1, +1,1,2,2,1,1,1,2,0x1b,1,0x1b,0x1b,0x18,1,1,1, +1,1,0x1b,0x1b,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x7ca,0x80a,0x84a, +0x11ca,0x1e4a,0x980a,0x784a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x7ca,0x80a,0x84a, +0x11ca,0x1e4a,0x980a,0x784a,0x784a,0x984a,0x788a,1,2,0x6ca,0x11ca,0x988a,0x78ca,0x54b,0x1b,0x1b, +0,0,0,0,0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x18, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x1b,0x1b,0x18,0x1b,0x1b,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x18,0x18,0x1b,0x1b,0x18,0x1b,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x14,0x15,0x14,0x15, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x14,0x15,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18, +0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x2cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b, +0xa4b,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x2cb,0x30b,0x34b,0x38b,0x3cb, +0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,0xa4b, +0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b, +0x98b,0x9cb,0xa0b,0xa4b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15, +0x14,0x15,0x14,0x15,0x14,0x15,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb, +0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b, +0x48b,0x4cb,0x50b,0x7cb,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x18,0x18,0x18,0x18,0x18,0x14,0x15,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x14, +0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14, +0x15,0x14,0x15,0x14,0x15,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x14,0x15,0x14,0x15,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x14,0x15,0x18,0x18,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,1,2,1,1,1,2,2,1, +2,1,2,1,2,1,1,1,1,2,1,2,2,1,2,2, +2,2,2,2,4,4,1,1,1,2,1,2,2,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,1,2,1,2,6,6,6,1,2,0,0,0,0, +0,0x17,0x17,0x17,0x17,0x344b,0x17,0x17,2,2,2,2,2,2,0,2, +0,0,0,0,0,2,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,4, +0x17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6, +5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,0, +5,5,5,5,5,5,5,0,5,5,5,5,5,5,5,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0, +0x17,0x17,0x1c,0x1d,0x1c,0x1d,0x17,0x17,0x17,0x1c,0x1d,0x17,0x1c,0x1d,0x17,0x17, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x13,0x17,0x17,0x13,0x17,0x1c,0x1d,0x17,0x17, +0x1c,0x1d,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x17,0x17,0x17,0x17,0x17,4, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x13,0x13,0x17,0x17,0x17,0x17, +0x13,0x17,0x14,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x1b,0x1b,0x17,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0,0,0,0,0x1b,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,6,6, +6,6,8,8,0x13,4,4,4,4,4,0x1b,0x1b,0x7ca,0xa4a,0xcca,4, +5,0x17,0x1b,0x1b,0xc,0x17,0x17,0x17,0x1b,4,5,0x54a,0x14,0x15,0x14,0x15, +0x14,0x15,0x14,0x15,0x14,0x15,0x1b,0x1b,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15, +0x13,0x14,0x15,0x15,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,0,6,6,0x1a, +0x1a,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x17, +4,4,4,5,0,0,0,0,0,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,0,0x1b,0x1b,0x58b,0x5cb,0x60b,0x64b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1b,0xa8b,0xacb,0xb0b, +0xb4b,0xb8b,0xbcb,0xc0b,0xc4b,0xc8b,0xccb,0xd0b,0xd4b,0xd8b,0xdcb,0xe0b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0xe4b,0xe8b,0xecb, +0xf0b,0xf4b,0xf8b,0xfcb,0x100b,0x104b,0x108b,0x10cb,0x110b,0x114b,0x118b,0x11cb,5,5,5,5, +5,0x685,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x5c5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x685,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0x705,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0x585,5,5,0x705,5,5,5,0x7885, +5,0x605,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x785,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x5c5,5,5,5,5,5,5,5,0x685,5,0x645,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0x7985,0x7c5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0x7845,5,5,5,5, +5,5,5,5,0x605,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0x685,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x1e45,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x7985,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x7a85,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x5c5,5,0x745,5,0x6c5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x7c5,5,0x7845,0xa45,0xcc5,5,5,5,5,5,5,0xf45,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x605,0x605,0x605,0x605,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,0x645,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0x585,5,5,5,5,5,5,5,0x585,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0x585,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0x785,0xa45,5,5,5,5, +5,5,5,5,5,5,5,5,0x585,0x5c5,0x605,5,0x5c5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x7c5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0x745,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,0x705,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x785,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x1e45,5, +5,5,5,5,5,5,0x645,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x7885,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0x5c5,5,5,5,5,0x5c5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0x5c5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0x7845,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x6c5,5, +5,5,5,5,0x1e45,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x6c5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0x545,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,4,5,5,5,5,5,5,5,5,5,5,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,4,0x17,0x17,0x17, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,4,4,6,6, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,6, +7,7,7,0x17,6,6,6,6,6,6,6,6,6,6,0x17,4, +5,5,5,5,5,5,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x54a, +6,6,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0, +0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, +0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,4,4,4,4,4,4,4,4,4, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,2,5,4,4,2,5,5,5,5,5, +0x1a,0x1a,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +2,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,2,4,2,2,2,2,2,2,2,2,1,2,1, +2,1,1,2,1,2,1,2,1,2,1,2,4,0x1a,0x1a,1, +2,1,2,5,1,2,1,2,2,2,1,2,1,2,1,2, +1,2,1,2,1,2,1,1,1,1,1,2,1,1,1,1, +1,2,1,2,1,2,1,2,1,2,1,2,0,0,1,2, +1,1,1,1,2,1,2,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,5,6,5, +5,5,6,5,5,5,5,6,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8, +8,6,6,8,0x1b,0x1b,0x1b,0x1b,6,0,0,0,0x34cb,0x344b,0x3ccb,0x37cb, +0x35cb,0x3fcb,0x1b,0x1b,0x19,0x1b,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,8,8,8,8, +6,6,0,0,0,0,0,0,0,0,0x17,0x17,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,8,8,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,8, +8,8,8,8,8,8,8,8,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5, +0x17,0x17,0x17,5,0x17,5,5,6,5,5,5,5,5,5,6,6, +6,6,6,6,6,6,0x17,0x17,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6, +6,6,6,6,6,6,8,8,0,0,0,0,0,0,0,0, +0,0,0,0x17,8,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x17,0x17,0,4,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +0,0,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,6,8,8,6,6,6,6,8,8, +6,6,8,8,5,5,5,5,5,6,4,5,5,5,5,5, +5,5,5,5,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5, +5,5,5,0,5,5,5,5,5,5,5,5,5,6,6,6, +6,6,6,8,8,6,6,8,8,6,6,0,0,0,0,0, +0,0,0,0,5,5,5,6,5,5,5,5,5,5,5,5, +6,8,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,4,5,5,5,5,5,5,0x1b,0x1b,0x1b,5,8, +6,8,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,6,5,6,6,6,5,5,6,6,5,5,5, +5,5,6,6,5,6,5,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, +5,4,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,8, +6,6,8,8,0x17,0x17,5,4,4,8,6,0,0,0,0,0, +0,0,0,0,0,5,5,5,5,5,5,0,0,5,5,5, +5,5,5,0,0,5,5,5,5,5,5,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,0,5,5,5,5, +5,5,5,0,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0x1a, +4,4,4,4,2,2,2,2,2,2,2,2,2,4,0x1a,0x1a, +0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,5,5,5,8,8,6,8,8,6,8,8,0x17, +8,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +0,0,0,0,5,5,5,5,0,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0,0,0,0,5,5,5,5,5,5,5,0,0,0,0,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, +0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, +0x11,0x11,0x11,0x11,5,5,5,5,5,5,5,5,5,5,5,0x605, +5,5,5,5,5,5,5,0x7c5,5,5,5,5,0x5c5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x6c5,5,0x6c5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x7c5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0x18,5,5,5,5,5,5,5,5,5,5, +5,5,5,0,5,5,5,5,5,0,5,0,5,5,0,5, +5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,2,2,2,2, +2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2, +2,2,2,2,0,0,0,0,0,5,6,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x1a,0x1a, +0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x15,0x14, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,0x19,0x1b,0,0,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14, +0x15,0x17,0,0,0,0,0,0,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,0x17,0x13,0x13,0x16,0x16,0x14,0x15,0x14, +0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x17,0x17,0x14,0x15,0x17,0x17,0x17, +0x17,0x16,0x16,0x16,0x17,0x17,0x17,0,0x17,0x17,0x17,0x17,0x13,0x14,0x15,0x14, +0x15,0x14,0x15,0x17,0x17,0x17,0x18,0x13,0x18,0x18,0x18,0,0x17,0x19,0x17,0x17, +0,0,0,0,5,5,5,5,5,0,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0,0,0x10,0,0,5,5, +5,5,5,5,0,0,5,5,5,5,5,5,0,0,5,5, +5,5,5,5,0,0,5,5,5,0,0,0,0x19,0x19,0x18,0x1a, +0x1b,0x19,0x19,0,0x1b,0x18,0x18,0x18,0x18,0x1b,0x1b,0,0,0,0,0, +0,0,0,0,0,0x10,0x10,0x10,0x1b,0x1b,0,0,0,0x17,0x17,0x17, +0x19,0x17,0x17,0x17,0x14,0x15,0x17,0x18,0x17,0x13,0x17,0x17,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x18,0x18,0x18,0x17,0x1a,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,0x14,0x18,0x15,0x18,0x14,0x15,0x17,0x14,0x15, +0x17,0x17,5,5,5,5,5,5,5,5,5,5,4,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4, +5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,0,5,5,0,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,0,0,0,0,0,0xb00b,0xb80b,0x784b,0x804b, +0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b, +0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x17,0x17,0x17,0, +0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b, +0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0x7ca,0x7ca,0x7ca,0x7ca, +0x7ca,0xcca,0x11ca,0x11ca,0x11ca,0x11ca,0x1e4a,0x880a,0x980a,0x980a,0x980a,0x980a,0x980a,0x784a,0x984a,0x68a, +0x11ca,0x344b,0x344b,0x388b,0x3ccb,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x54b,0x34cb,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x34ca,0x344a,0x58a,0x68a,0x11ca,0x980a,0x984a,0x988a, +0x68a,0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x984a,0x68a,0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x788a,0x988a,0x7ca, +0x58a,0x58a,0x58a,0x5ca,0x5ca,0x5ca,0x5ca,0x68a,0x1b,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,6,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,6,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b, +0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b, +0xa00b,0xa80b,0xb00b,0xb80b,0,0,0,0,0x58b,0x68b,0x7cb,0x11cb,0,0,0,0, +0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x1bca,5,5,5,5,5,5, +5,5,0xb80a,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6, +6,6,6,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0,0x17,5,5,5,5,0,0,0,0, +5,5,5,5,5,5,5,5,0x17,0x58a,0x5ca,0x7ca,0xa4a,0x1e4a,0,0, +0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0,0,0,0,0,0,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,0,0,0,0,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, +2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0, +0,0,0,0x17,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0,5,5,0,0,0, +5,0,0,5,5,5,5,5,5,5,0,0,5,0,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0,0x17,0x58b,0x5cb,0x60b,0x7cb,0xa4b,0x1e4b,0x784b,0x788b, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,0x1b,0x1b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b, +0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x64b,0x68b,0x7cb,0xa4b,0x1e4b, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,0,5,5,0,0,0,0,0,0x58b,0x68b,0x7cb,0xa4b,0x1e4b, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0x58b,0x7cb,0xa4b,0x1e4b,0x5cb,0x60b,0,0,0,0x17, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0x17, +0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x88cb, +0x90cb,0x98cb,0xa0cb,0xa8cb,0xb0cb,0xb8cb,0x36cb,0x354b,0x34cb,0x348b,0x46cb,0x344b,0x4ecb,0x388b,0x3ccb,0x454b, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,0,0,0,0x5ecb,0x344b,5,5, +0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb, +0,0,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b, +0x30b,0x34b,0x38b,0x3cb,0x7cb,0xa4b,0x1e4b,0x784b,0x344b,0,0,0,0,0,0,0, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0, +5,6,6,6,0,6,6,0,0,0,0,0,6,6,6,6, +5,5,5,5,0,5,5,5,0,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,0,0,6,6,6,0,0,0,0,6,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x58b,0x11cb,0x17,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x58b,0x7cb,0xa4b,5,5,5,5, +5,6,6,0,0,0,0,0x58b,0x68b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,0x1b,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0, +0,0x17,0x17,0x17,0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0, +0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0, +0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0, +0,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0,0, +0,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, +0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0, +0,0,0x58b,0x68b,0x7cb,0x11cb,0x1e4b,0x784b,5,5,5,5,6,6,6,6, +0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0,0,0,0,0,0,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb, +0x50b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b, +0xa80b,0xb00b,0xb80b,0x344b,0x34cb,0x348b,0x388b,0,5,5,5,5,5,5,5,5, +5,5,0,6,6,0x13,0,0,5,5,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b,0xccb,0x1e4b,0x344b,5, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6, +6,6,6,6,6,0x58b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17,0x17,0,0, +0,0,0,0,5,5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x784b,0x49,0x89,0xc9,0x109,0x149,0x189, +0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,6,8,6,8,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,6,6,6,6,6,6,6,0x17,0x17,0x17,0x17,0x17, +0x17,0x17,0,0,0,0,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb, +0xa4b,0xccb,0xf4b,0x11cb,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,8,8,8,6,6,6,6,8,8,6,6,0x17, +0x17,0x10,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0, +0,0x10,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,5,5,5,5, +5,5,5,6,6,6,6,6,8,6,6,6,6,6,6,6, +6,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17, +5,8,8,5,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6, +0x17,0x17,5,0,0,0,0,0,0,0,0,0,8,5,5,5, +5,0x17,0x17,0x17,0x17,6,6,6,6,0x17,8,6,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,5,0x17,5,0x17,0x17,0x17,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8, +8,8,6,6,6,6,6,6,6,6,6,8,0,0x58b,0x5cb,0x60b, +0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b, +0x784b,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,8,8,8,6,6,6,8,8, +6,8,6,6,0x17,0x17,0x17,0x17,0x17,0x17,6,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0, +5,0,5,5,5,5,0,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,5, +5,0x17,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,8,8,8,6,6,6,6,6, +6,6,6,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0,0,0,0,0,0,5,5,8,8,0,0,6,6, +6,6,6,6,6,0,0,0,6,6,6,6,6,0,0,0, +0,0,0,0,0,0,0,0,6,6,8,8,0,5,5,5, +5,5,5,5,5,0,0,5,5,0,0,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5, +5,0,5,5,0,5,5,5,5,5,0,6,6,5,8,8, +6,8,8,8,8,0,0,8,8,0,0,8,8,8,0,0, +5,0,0,0,0,0,0,8,0,0,0,0,0,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,8,8,8,6,6,6,6,6,6,6,6, +8,8,6,6,6,8,6,5,5,5,5,0x17,0x17,0x17,0x17,0x17, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0,0x17,6,5, +5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +8,8,8,6,6,6,6,6,6,8,6,8,8,8,8,6, +6,8,6,6,5,5,0x17,5,0,0,0,0,0,0,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8, +8,8,6,6,6,6,0,0,8,8,8,8,6,6,8,6, +6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,5,5,5,5,6,6,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +8,8,8,6,6,6,6,6,6,6,6,8,8,6,8,6, +6,0x17,0x17,0x17,5,0,0,0,0,0,0,0,0,0,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,6,8,6,8,8, +6,6,6,6,6,6,8,6,5,0,0,0,0,0,0,0, +8,8,6,6,6,6,8,6,6,6,6,6,0,0,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0x17,0x17,0x17,0x1b, +5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,6, +6,6,6,6,6,6,6,6,8,6,6,0x17,0,0,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b, +0x16cb,0x194b,0x1bcb,0,0,0,0,0,0,0,0,0,0,0,0,5, +8,5,8,6,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, +5,5,5,5,5,5,5,0,0,5,0,0,5,5,5,5, +5,5,5,5,0,5,5,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,8,8,8,8,8,8,0,8, +8,0,0,6,6,8,6,5,6,5,0x17,5,8,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,8,8,8,6,6,6,6, +0,0,6,6,8,8,8,8,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6, +6,8,5,6,6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,6, +0,0,0,0,0,0,0,0,5,6,6,6,6,6,6,8, +8,6,6,6,5,5,5,5,5,6,6,6,6,6,6,6, +6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0x17,0x17,0x17,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,8, +6,6,0x17,0x17,0x17,5,0x17,0x17,5,0x17,0x17,0x17,0x17,0x17,0,0, +0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb, +0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0,0,0,0x17,0x17,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,8,6,6,6,6,6,6,6,0,6,6,6,6, +6,6,8,6,6,6,6,6,6,6,6,6,0,8,6,6, +6,6,6,6,6,8,6,6,8,6,6,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0,0,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,5,6,0,0,0,0,0,0,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, +5,5,5,5,5,5,5,0,5,5,0,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,6,6,6,6,6,6,0,0,0,6,0,6,6,0,6, +5,5,5,5,5,5,5,5,5,5,8,8,8,8,8,0, +6,6,0,8,8,6,8,6,5,0,0,0,0,0,0,0, +5,5,5,5,5,5,0,5,5,0,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,6,6,8,8,0x17,0x17,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x19,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0, +0,0,0,0,0,0,0,0,0,0,0,0x17,0xcd0b,0xcc0b,0xcb0b,0xd00b, +0xca0b,0xcf0b,0xcb4b,0xd04b,0xc90b,0x37cb,0x37cb,0x364b,0x35cb,0xc94b,0x3fcb,0x350b,0x34cb,0x344b,0x344b,0x3ccb, +0xcd0b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x19,0x19,0x34ca,0x354a,0x34ca,0x34ca, +0x344a,0x348a,0x388a,0xf4a,0x11ca,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0,0x17,0x17,0x17,0x17, +0x17,0,0,0,0,0,0,0,0,0,0,0,0x5ca,0x60a,0x64a,0x68a, +0x6ca,0x70a,0x74a,0x78a,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x64a,0x68a,0x6ca,0x70a,0x74a, +0x78a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x5ca, +0x60a,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x60a,0x64a,0x68a,0xc08a,0xc18a, +0x58a,0x5ca,0x60a,0x60a,0x64a,0x68a,0x60a,0x60a,0x64a,0x64a,0x64a,0x64a,0x6ca,0x70a,0x70a,0x70a, +0x74a,0x74a,0x78a,0x78a,0x78a,0x78a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x58a,0x5ca,0x60a,0x64a,0x64a, +0x68a,0x68a,0x5ca,0x60a,0x58a,0x5ca,0x348a,0x388a,0x454a,0x348a,0x388a,0x35ca,5,5,5,5, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0x17,0x17,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0,0,6,6,6,6, +6,0x17,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6, +6,6,6,0x17,0x17,0x17,0x17,0x17,0x1b,0x1b,0x1b,0x1b,4,4,4,4, +0x17,0x1b,0,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0x7cb,0x1e4b,0x788b,0x790b,0x798b,0x7a0b,0x7a8b,0,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0,0,0,0,0,5,5,5,0x54b,0x58b,0x5cb,0x60b, +0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b, +0x58b,0x5cb,0x60b,0x17,0x17,0x17,0x17,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,0,0,0,0,6,5,8,8,8, +8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, +8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, +0,0,0,0,0,0,0,6,6,6,6,4,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,0x17,4,6,0,0,0, +0,0,0,0,0,0,0,0,8,8,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,0,0,0x1b,6,6,0x17,0x10,0x10,0x10,0x10,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0, +0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,8,8,6,6,6,0x1b,0x1b, +0x1b,8,8,8,8,8,8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,6, +6,6,6,6,6,6,6,0x1b,0x1b,6,6,6,6,6,6,6, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,6,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x1b,0x1b,6,6,6,0x1b,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x54b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x80b, +0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,0,0,0,0,0,0,0,0, +0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb, +0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x58b,0x5cb,0x60b,0x64b,0x68b,0x58b,0x68b,0,0,0, +0,0,0,0,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189, +0x1c9,0x209,0x249,0x289,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,2,2,2,2,2,2,2,0,2,2,2,2,2,2, +2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,1,0,1,1,0,0,1,0, +0,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1, +1,1,2,2,2,2,0,2,0,2,2,2,2,2,2,2, +0,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2, +1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,1, +1,0,1,1,1,1,1,1,1,0,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,1,1,0,1,1,1,1,0,1,1,1,1, +1,0,1,0,0,0,1,1,1,1,1,1,1,0,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2, +2,2,0,0,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,0x18,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,0x18,2,2,2,2,2,2,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0x18,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,0x18,2,2, +2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,2,2,2,0x18,2,2,2,2,2,2,1,2, +0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,0x1b,0x1b,0x1b,0x1b,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +6,0x1b,0x1b,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,0, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,0,0,6,6,6,6,6,6,6,0,6,6,0,6,6, +6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0,0,0,0,5,0x1b,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,0,0,6,6,6,6,6,6,6,4, +4,4,4,4,4,4,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,6,6,6,6,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0,0,0,0,0,0x19,5,5,5,5,5,0,0,0x58b, +0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,6,6,6,6,6,6,6,0, +0,0,0,0,0,0,0,0,2,2,2,2,6,6,6,6, +6,6,6,4,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0,0,0,0,0x17,0x17,1,1,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b, +0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x78cb,0x794b,0x814b,0x58b,0x5cb,0x60b,0x64b,0x68b, +0x6cb,0x70b,0x74b,0x78b,0x1b,0x34cb,0x344b,0x3ccb,0x19,0x58b,0x5cb,0x788b,0x78cb,0,0,0, +0,0,0,0,0,0,0,0,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b, +0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b, +0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b, +0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x1b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb, +0x900b,0xa00b,0x804b,0x788b,0x344b,0x354b,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b, +0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b, +0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x18,0x18,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,0,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,5,5,0,5,0,0,5, +0,5,5,5,5,5,5,5,5,5,5,0,5,5,5,5, +0,5,0,5,0,0,0,0,0,0,5,0,0,0,0,5, +0,5,0,5,0,5,5,5,0,5,5,0,5,0,0,5, +0,5,0,5,0,5,0,5,0,5,5,0,5,0,0,5, +5,5,5,0,5,5,5,5,5,5,5,0,5,5,5,5, +0,5,5,5,5,0,5,0,5,5,5,5,5,5,5,5, +5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0,0,0,0,0,5,5,5,0,5,5,5, +5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x2cb,0x2cb,0x30b,0x34b, +0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x54b,0x54b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0, +0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0, +0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0,0,0,0,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,5,0x705,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0x645,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0x645,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x685,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0xcc5,5,5,5,5, +5,5,5,5,0xf45,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0xf45,5,5,5,5,5,5,5,5,5,5,5, +5,5,0x6c5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0x605,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x605,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0x605,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0x605,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x645,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x785,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0,0x10,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, +0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0,0, +0,0,0,0 +}; + +static const UTrie2 propsTrie={ + propsTrie_index, + propsTrie_index+4532, + NULL, + 4532, + 17744, + 0xa40, + 0x1234, + 0x0, + 0x0, + 0x110000, + 0x5700, + NULL, 0, FALSE, FALSE, 0, NULL +}; + +static const uint16_t propsVectorsTrie_index[31228]={ +0x4e8,0x4f0,0x4f8,0x500,0x518,0x520,0x528,0x530,0x538,0x540,0x548,0x550,0x558,0x560,0x568,0x570, +0x577,0x57f,0x587,0x58f,0x592,0x59a,0x5a2,0x5aa,0x5b2,0x5ba,0x5c2,0x5ca,0x5d2,0x5da,0x5e2,0x5ea, +0x5f2,0x5fa,0x601,0x609,0x611,0x619,0x621,0x629,0x631,0x639,0x63e,0x646,0x64d,0x655,0x65d,0x665, +0x66d,0x675,0x67d,0x685,0x68c,0x694,0x69c,0x6a4,0x6ac,0x6b4,0x6bc,0x6c4,0x6cc,0x6d4,0x6dc,0x6e4, +0x1a38,0xd5e,0xe35,0x6ec,0x508,0xe9c,0xea4,0x1bf2,0x1300,0x1310,0x12f8,0x1308,0x7c5,0x7cb,0x7d3,0x7db, +0x7e3,0x7e9,0x7f1,0x7f9,0x801,0x807,0x80f,0x817,0x81f,0x825,0x82d,0x835,0x83d,0x845,0x84d,0x854, +0x85c,0x862,0x86a,0x872,0x87a,0x880,0x888,0x890,0x898,0x1318,0x8a0,0x8a8,0x8b0,0x8b7,0x8bf,0x8c7, +0x8cf,0x8d3,0x8db,0x8e2,0x8ea,0x8f2,0x8fa,0x902,0x162c,0x1634,0x90a,0x912,0x91a,0x922,0x92a,0x931, +0x1692,0x1682,0x168a,0x1973,0x197b,0x1328,0x939,0x1320,0x1572,0x1572,0x1574,0x133c,0x133d,0x1330,0x1332,0x1334, +0x169a,0x169c,0x941,0x169c,0x949,0x94e,0x956,0x16a1,0x95c,0x169c,0x962,0x96a,0xc39,0x16a9,0x16a9,0x972, +0x16b9,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba, +0x16ba,0x16ba,0x16ba,0x16b1,0x97a,0x16c2,0x16c2,0x982,0xb59,0xb61,0xb69,0xb71,0x16d2,0x16ca,0x98a,0x992, +0x99a,0x16dc,0x16e4,0x9a2,0x16da,0x9aa,0x1a40,0xd66,0xb79,0xb81,0xb89,0xb8e,0x18e1,0xc6c,0xc73,0x1849, +0xc09,0x1a48,0xd6e,0xd76,0xd7e,0xd86,0xf47,0xf48,0x1939,0x193e,0xca8,0xcb0,0x19af,0x19b7,0x1b11,0xe3d, +0x19bf,0xcf2,0xcfa,0x19c7,0x10f6,0x1196,0xf27,0xd8e,0x1869,0x1851,0x1861,0x1859,0x18f9,0x18f1,0x18b9,0xc19, +0x1345,0x1345,0x1345,0x1345,0x1348,0x1345,0x1345,0x1350,0x9b2,0x1358,0x9b6,0x9be,0x1358,0x9c6,0x9ce,0x9d6, +0x1368,0x1360,0x1370,0x9de,0x9e6,0x1378,0x9ee,0x9f6,0x1380,0x1388,0x1390,0x1398,0x9fe,0x13a0,0x13a7,0x13af, +0x13b7,0x13bf,0x13c7,0x13cf,0x13d7,0x13de,0x13e6,0x13ee,0x13f6,0x13fe,0x1401,0x1403,0x16ec,0x17dc,0x17e2,0x1929, +0x140b,0xa06,0xa0e,0x1525,0x152a,0x152d,0x1535,0x1413,0x153d,0x153d,0x1423,0x141b,0x142b,0x1433,0x143b,0x1443, +0x144b,0x1453,0x145b,0x1463,0x17ea,0x1841,0x1983,0x1ad9,0x1473,0x147a,0x1482,0x148a,0x146b,0x1492,0x17f2,0x17f9, +0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x1801,0x1804,0x1801,0x1801,0x180c,0x1813,0x1815,0x181c, +0x1824,0x1828,0x1828,0x182b,0x1828,0x1828,0x1831,0x1828,0x1871,0x1931,0x198b,0xb96,0xb9c,0x1c36,0x1c3e,0x1d15, +0x18d1,0xc49,0xc4d,0x1946,0x18c1,0x18c1,0x18c1,0xc21,0x18c9,0xc41,0x1911,0xc98,0xc29,0xc31,0xc31,0x19cf, +0x1901,0x1993,0xc83,0xc88,0xa16,0x16fc,0x16fc,0xa1e,0x1704,0x1704,0x1704,0x1704,0x1704,0x1704,0xa26,0x6f0, +0x155a,0x157c,0xa2e,0x1584,0xa36,0x158c,0x1594,0x159c,0xa3e,0xa43,0x15a4,0x15ab,0xa48,0x170c,0x1921,0xc11, +0xa50,0x1606,0x160d,0x15b3,0x1615,0x161c,0x15bb,0x15bf,0x15d8,0x15d8,0x15da,0x15c7,0x15cf,0x15cf,0x15d0,0x1624, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, +0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1717,0x1879,0x1879, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, +0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e9,0x1a30,0x12b5, +0x171f,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725, +0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725, +0x1725,0x1725,0x1725,0x1725,0xa58,0x172d,0xa60,0x1a50,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db, +0x19d7,0xd02,0x19eb,0x19e3,0x19ed,0x1a58,0x1a58,0xd96,0x18d9,0x194e,0x19a3,0x19a7,0x199b,0x1b09,0xcb8,0xcbb, +0x1909,0xc90,0x1956,0xcc3,0x19f5,0x19f8,0xd0a,0x1a60,0x1a08,0x1a00,0xd12,0xd9e,0x1a68,0x1a6c,0xda6,0xff0, +0x1a10,0xd1a,0xd22,0x1a74,0x1a84,0x1a7c,0xdae,0xef7,0xe45,0xe4d,0x1c85,0xfa8,0x1d32,0x1d32,0x1a8c,0xdb6, +0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675, +0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677, +0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679, +0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674, +0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676, +0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678, +0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a, +0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675, +0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677, +0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679, +0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674, +0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676, +0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678, +0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a, +0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675, +0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677, +0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679, +0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674, +0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676, +0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678, +0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a, +0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0xa68,0xdbe,0xdc1, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c, +0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1, +0x15f6,0x15fe,0x1839,0x12bd,0x1919,0x1919,0x12c1,0x12c8,0xa70,0xa78,0xa80,0x14b2,0x14b9,0x14c1,0xa88,0x14c9, +0x14fa,0x14fa,0x14a2,0x14aa,0x14d1,0x14f1,0x14f2,0x1502,0x14d9,0x149a,0xa90,0x14e1,0xa98,0x14e9,0xaa0,0xaa4, +0xca0,0x150a,0xaac,0xab4,0x1512,0x1518,0x151d,0xabc,0xacc,0x1562,0x156a,0x154d,0x1552,0xad4,0xadc,0xac4, +0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c, +0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x1644,0x1644,0x1644,0x1644, +0x1420,0x1420,0x1460,0x14a0,0x14e0,0x1520,0x1560,0x15a0,0x15dc,0x161c,0x1648,0x1688,0x16c8,0x1708,0x1748,0x1788, +0x17c8,0x1804,0x1844,0x1884,0x18c4,0x18f8,0x1934,0x1974,0x19b4,0x19f4,0x1a30,0x1a70,0x1ab0,0x1af0,0x1b30,0x1b70, +0xa80,0xac0,0xb00,0xb40,0xb80,0xa40,0xe75,0xa40,0xe97,0xa40,0xa40,0xa40,0xa40,0xbc0,0x12dd,0x12dd, +0xed7,0xc00,0xa40,0xa40,0xa40,0xa40,0xf17,0xc2d,0xa40,0xa40,0xc6d,0xcad,0xced,0xd2d,0xe35,0xda5, +0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d, +0x121d,0x121d,0x121d,0x121d,0xf57,0x125d,0x1092,0x10d2,0x129d,0x10dd,0x131d,0x131d,0x131d,0xf97,0xfb7,0xff7, +0x135d,0x135d,0x1037,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7, +0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0x1052, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xde5,0xdf5,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d, +0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x111d, +0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd, +0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x115d, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0xba4,0xbab,0xbb3,0xbbb,0x1881,0x1881,0x1881,0xbc3,0xbcb,0xbce,0x18b1,0x18a9,0xc01,0xd2a,0xd2e,0xd32, +0x508,0x508,0x508,0x508,0xd3a,0x1a18,0xd42,0xf3f,0x1735,0xae4,0xaea,0x1000,0xbd6,0x18e9,0xc7b,0x508, +0x174a,0x173d,0x1742,0x1889,0xbde,0xbe6,0x1134,0x113a,0x1c6d,0xf5d,0x1c5d,0x6f8,0x508,0x508,0x508,0x508, +0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0xfb0,0xfb8,0xfc0,0x508,0x508,0x508,0x508, +0xbee,0xbf1,0xdc9,0x1cd5,0xff8,0x700,0x508,0x1092,0xccb,0xd4a,0x508,0x508,0x1c02,0xeff,0xf07,0x1d1d, +0xc55,0xc5c,0xc64,0x1a94,0x1cb5,0x508,0x1c95,0xfd0,0x1a9c,0xdd1,0xdd9,0xde1,0x1020,0x708,0x508,0x508, +0x1aa4,0x1aa4,0x710,0x508,0x1d4a,0x10aa,0x1d42,0x10b2,0x1e0e,0x11ac,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0xde9,0x1e66,0x1291,0x508,0x508,0x1e2e,0x11d4,0x11db,0x718,0x508,0x71c,0x1248,0x11e3, +0x1b19,0x1b1b,0xe55,0xe5c,0x1aac,0x1ab4,0xdf1,0xf1f,0x1bfa,0xee7,0xeef,0xfc8,0x1c1a,0x1c1e,0x1c26,0x1040, +0xf93,0xf98,0x724,0x508,0x109a,0x10a2,0x1c7d,0xfa0,0xf75,0xf7b,0xf83,0xf8b,0x508,0x508,0x508,0x508, +0x1daa,0x1da2,0x1124,0x112c,0x1cfd,0x1cf5,0x1068,0x508,0x508,0x508,0x508,0x508,0x1ce5,0x1028,0x1030,0x1038, +0x1cad,0x1ca5,0xfe0,0x111c,0x1c2e,0xf2f,0x72c,0x508,0x1078,0x1080,0x508,0x508,0x508,0x508,0x508,0x508, +0x1e06,0x118e,0x734,0x508,0x508,0x1d0d,0x1d05,0x1070,0x1250,0x1256,0x125e,0x508,0x508,0x11eb,0x11ef,0x11f7, +0x1dde,0x1dd6,0x1176,0x1dce,0x1dc6,0x73c,0x1cdd,0x1018,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x10da,0x10df,0x10e7,0x10ee,0x110e,0x1114,0x508,0x508,0x115a,0x115e,0x1166,0x119e,0x11a4,0x744,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x11bc,0x508,0x508,0x508,0x508,0x508,0x748,0x1e4e,0x1238, +0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e, +0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x1963,0xcd3,0xcda,0xcda,0xcda, +0x196b,0x196b,0x196b,0xce2,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x750,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23, +0x1b23,0xe64,0xfe8,0x758,0x508,0x508,0x75c,0xf37,0x1ccd,0x1cc5,0x1008,0x1010,0x764,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x1e26,0x1e1e,0x11cc,0x508,0x508,0x508,0x1c12,0x1c12,0xf0f,0x1c0a,0xf17,0x508,0x508,0x1106, +0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba, +0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dbe,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76, +0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1266,0x126c,0x1286,0x1289,0x1289,0x1289,0x76c,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1c65,0x1c65,0x1c65, +0xf50,0xf55,0x774,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1752,0x1752,0x1752, +0x1752,0x1752,0x1752,0x1752,0xaf2,0x1762,0xafa,0x1763,0x175a,0x176b,0x1771,0x1779,0xb02,0x18a1,0x18a1,0x77c, +0x508,0x508,0x508,0x508,0x11c4,0x1891,0x1891,0xbf9,0xcea,0x508,0x508,0x508,0x508,0x17aa,0x17b1,0xb0a, +0x17b4,0xb12,0xb1a,0xb22,0x17ae,0xb2a,0xb32,0xb3a,0x17b3,0x17bb,0x17aa,0x17b1,0x17ad,0x17b4,0x17bc,0x17ab, +0x17b2,0x17ae,0xb41,0x1781,0x1789,0x1790,0x1797,0x1784,0x178c,0x1793,0x179a,0xb49,0x17a2,0x1d62,0x1d62,0x1d62, +0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d52,0x1d55,0x1d52, +0x1d5c,0x10ca,0x784,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x10fe,0x78c,0x508, +0x508,0x508,0x508,0x508,0x508,0x1e46,0x11ff,0x794,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x1e56,0x1240,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1c9d,0x1c9d,0x1c9d, +0x1c9d,0x1c9d,0x1c9d,0xfd8,0x508,0x1d9a,0x1d92,0x10d2,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x798,0x1e16,0x11b4,0x508,0x508,0x1207,0x1208,0x7a0,0x508,0x508,0x508,0x508,0x508,0xeac,0xeb4,0xebc, +0xec4,0xecc,0xed4,0xedb,0xedf,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x7a4,0x1048,0x1ced,0x104e,0x1ced,0x1056,0x105b,0x1060,0x1060,0x1d72,0x1d82,0x1d8a, +0x10ba,0x1d7a,0x1e36,0x10c2,0x1dee,0x1e3e,0x1e3e,0x117e,0x1186,0x121f,0x1225,0x122a,0x1230,0x1e5e,0x1e5e,0x1e5e, +0x1e5e,0x1274,0x1e5e,0x127a,0x127e,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac, +0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac, +0x7ac,0x7ac,0x7ac,0x7ac,0x7ad,0xb51,0x17c4,0x17c4,0x17c4,0x7b5,0x7b5,0x7b5,0x7b5,0x1899,0x1899,0x1899, +0x1899,0x1899,0x1899,0x1899,0x7bd,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5, +0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5, +0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5, +0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5, +0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x1a20,0xd52,0x1a28,0x1a28,0xd56,0xe6c,0xe74,0xe7c,0x1ae9,0x1ad1,0x1af1, +0x1af9,0x1ae1,0xe01,0xe05,0xe0c,0xe14,0xe1b,0xe23,0xe2b,0xe2d,0xe2d,0xe2d,0xe2d,0x1b5a,0x1b62,0x1b5a, +0x1b68,0x1b70,0x1b3b,0x1b78,0x1b80,0x1b5a,0x1b88,0x1b90,0x1b97,0x1b9f,0x1b43,0x1b5a,0x1ba4,0x1b4b,0x1b52,0x1bac, +0x1bb2,0x1c4e,0x1c55,0x1c46,0x1bba,0x1bc2,0x1bca,0x1bd2,0x1cbd,0x1bda,0x1be2,0xe84,0xe8c,0x1b2b,0x1b2b,0x1b2b, +0xe94,0x1c75,0x1c75,0xf65,0xf6d,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc, +0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abe,0x1abc,0x1ac6,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc, +0x1ac9,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0xdf9,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25, +0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d2a,0x1d25,0x1d25,0x1d25,0x1088,0x108a,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, +0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, +0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, +0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, +0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1142,0x1b33,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x114a, +0x1152,0x1210,0x1217,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x116e,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, +0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, +0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, +0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, +0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x12d0,0x1299,0x1b01, +0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, +0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, +0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x12a1,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4, +0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x12d8,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x12a5,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, +0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, +0x1e6e,0x12ad,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, +0x1299,0x12a5,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, +0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, +0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, +0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x12e0,0x1bea,0x1bea,0x1bea,0x1bea, +0x1bea,0x1bea,0x12e8,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, +0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, +0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, +0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, +0x1d6a,0x1d6a,0x12f0,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1664,0x1664,0x1664, +0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, +0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, +0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, +0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1654,0x166c,0x166c,0x166c, +0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, +0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, +0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, +0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x165c,0x1664,0x1664,0x1664, +0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, +0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, +0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, +0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x166c,0x166c,0x166c, +0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, +0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, +0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, +0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x17cc,0x17cc,0x17cc, +0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, +0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, +0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, +0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x1b01,0x1b01,0x1b01, +0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, +0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, +0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, +0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1d6a,0x1d6a,0x1d6a, +0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, +0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, +0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, +0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1db2,0x1db2,0x1db2, +0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, +0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, +0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, +0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1df6,0x1df6,0x1df6, +0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, +0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, +0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, +0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1e6e,0x1e6e,0x1e6e, +0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, +0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, +0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, +0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x4e7,0x4e7,0x4e7, +0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2ca,0x2d3,0x2cd,0x2cd,0x2d0,0x2c7,0x2c7, +0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7, +0x7fb,0x7f5,0x7da,0x7d1,0x7c8,0x7c5,0x7bc,0x7d7,0x7c2,0x7ce,0x7d1,0x7ec,0x7e3,0x7d4,0x7f8,0x7cb, +0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7e0,0x7dd,0x7e6,0x7e6,0x7e6,0x7f5, +0x7bc,0x807,0x807,0x807,0x807,0x807,0x807,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801, +0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x7c2,0x7c8,0x7ce,0x7f2,0x7b6, +0x7ef,0x804,0x804,0x804,0x804,0x804,0x804,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe, +0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7c2,0x7e9,0x7bf,0x7e6,0x2c7, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2e5,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6, +0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6, +0x2d9,0x651,0x810,0x813,0x657,0x813,0x80d,0x64e,0x645,0x2df,0x663,0x2e2,0x816,0x63c,0x65a,0x80a, +0x654,0x660,0x642,0x642,0x648,0x2dc,0x64e,0x64b,0x645,0x642,0x663,0x2e2,0x63f,0x63f,0x63f,0x651, +0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb, +0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x65d,0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x66c,0x666, +0x669,0x669,0x2e8,0x2e8,0x2e8,0x2e8,0x666,0x2e8,0x669,0x669,0x669,0x2e8,0x669,0x669,0x2e8,0x2e8, +0x666,0x2e8,0x669,0x669,0x2e8,0x2e8,0x2e8,0x65d,0x666,0x669,0x669,0x2e8,0x669,0x2e8,0x666,0x2e8, +0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee, +0x2f4,0x66f,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee, +0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee, +0x2f7,0x66f,0x67b,0x675,0x2f7,0x2ee,0x2f7,0x2ee,0x66f,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x67b, +0x675,0x678,0x66f,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x672,0x67e,0x678,0x66f,0x2f7,0x672,0x2f7,0x2ee, +0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee, +0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee, +0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f1, +0x2fa,0x306,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x306,0x306,0x2fa,0x2fa,0x306,0x306, +0x306,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x306,0x306,0x2fa,0x2fa,0x2fa,0x306,0x306,0x2fa,0x306, +0x309,0x2fd,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x2fa,0x2fa,0x306,0x2fa,0x306,0x309, +0x2fd,0x306,0x306,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x2fa,0x303,0x306,0x2fa,0x2fa,0x2fa, +0x303,0x303,0x303,0x303,0x30c,0x30c,0x300,0x30c,0x30c,0x300,0x30c,0x30c,0x300,0x309,0x681,0x309, +0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x2fa,0x309,0x2fd, +0x309,0x2fd,0x309,0x2fd,0x306,0x2fa,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd, +0x2fd,0x30c,0x30c,0x300,0x309,0x2fd,0x9ea,0x9ea,0x9ed,0x9e7,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd, +0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd, +0x309,0x2fd,0x309,0x2fd,0x9ed,0x9e7,0x9ed,0x9e7,0x9ea,0x9e4,0x9ed,0x9e7,0xbaf,0xcb7,0x9ea,0x9e4, +0x9ea,0x9e4,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7, +0xcb7,0xcb7,0xcb7,0xdb6,0xdb6,0xdb6,0xdb9,0xdb9,0xdb6,0xdb9,0xdb9,0xdb6,0xdb6,0xdb9,0xefa,0xefd, +0xefd,0xefd,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0x30f,0x684,0x30f,0x30f, +0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x684,0x30f,0x30f, +0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f, +0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x312,0x30f,0x30f,0x30f, +0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f, +0x30f,0x9f0,0x9f0,0x9f0,0x9f0,0x9f0,0xcba,0xcba,0x327,0x327,0x327,0x327,0x327,0x327,0x327,0x327, +0x327,0x31e,0x31e,0x31e,0x31e,0x31e,0x31e,0x31e,0x31b,0x31b,0x318,0x318,0x68a,0x318,0x31e,0x68d, +0x321,0x68d,0x68d,0x68d,0x321,0x68d,0x31e,0x31e,0x690,0x324,0x318,0x318,0x318,0x318,0x318,0x318, +0x687,0x687,0x687,0x687,0x315,0x687,0x318,0xb25,0x327,0x327,0x327,0x327,0x327,0x318,0x318,0x318, +0x318,0x318,0x9f9,0x9f9,0x9f6,0x9f3,0x9f6,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd, +0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693, +0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693, +0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693, +0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693, +0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x696,0x696,0x94b,0x696,0x696,0x94e,0xb28,0xb28, +0xb28,0xb28,0xb28,0xb28,0xb28,0xb28,0xb28,0xc6c,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83, +0xebe,0xebe,0xebe,0xebe,0xec1,0xd86,0xd86,0xd86,0x699,0x699,0xb2b,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4, +0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xfa8,0xfa5,0xfa8,0xfa5,0x333,0x33c,0xfa8,0xfa5, +9,9,0x342,0xf00,0xf00,0xf00,0x32a,0x14fd,9,9,9,9,0x33f,0x32d,0x351,0x330, +0x351,0x351,0x351,9,0x351,9,0x351,0x351,0x348,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f, +0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,9,0x69f,0x69f,0x69f,0x69f,0x69f, +0x69f,0x69f,0x351,0x351,0x348,0x348,0x348,0x348,0x348,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c, +0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x345,0x69c,0x69c,0x69c,0x69c,0x69c, +0x69c,0x69c,0x348,0x348,0x348,0x348,0x348,0xfa8,0x354,0x354,0x357,0x351,0x351,0x354,0x34b,0x9fc, +0xbb8,0xbb5,0x34e,0x9fc,0x34e,0x9fc,0x34e,0x9fc,0x34e,0x9fc,0x339,0x336,0x339,0x336,0x339,0x336, +0x339,0x336,0x339,0x336,0x339,0x336,0x339,0x336,0x354,0x354,0x34b,0x345,0xb67,0xb64,0xbb2,0xcc3, +0xcc0,0xcc6,0xcc3,0xcc0,0xdbc,0xdbf,0xdbf,0xdbf,0xa0b,0x6ab,0x363,0x366,0x363,0x363,0x363,0x366, +0x363,0x363,0x363,0x363,0x366,0xa0b,0x366,0x363,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8, +0x6a8,0x6ab,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8, +0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2, +0x6a2,0x6a5,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2, +0x6a2,0x6a2,0x6a2,0x6a2,0xa05,0x6a5,0x35d,0x360,0x35d,0x35d,0x35d,0x360,0x35d,0x35d,0x35d,0x35d, +0x360,0xa05,0x360,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d, +0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x366,0x360,0x363,0x35d,0x363,0x35d, +0x363,0x35d,0x363,0x35d,0x363,0x35d,0x35a,0x957,0x95a,0x93c,0x93c,0x114f,0x9ff,0x9ff,0xbbe,0xbbb, +0xa08,0xa02,0xa08,0xa02,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d, +0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d, +0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d, +0x363,0x35d,0x363,0x35d,0x363,0x366,0x360,0x363,0x35d,0xbbe,0xbbb,0x363,0x35d,0xbbe,0xbbb,0x363, +0x35d,0xbbe,0xbbb,0xf03,0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,0x363,0x35d,0x366,0x360, +0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360, +0xa0b,0xa05,0x366,0x360,0x366,0x360,0x366,0x360,0x366,0x360,0xdc5,0xdc2,0x366,0x360,0xf06,0xf03, +0xf06,0xf03,0xf06,0xf03,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a, +0xc2d,0xc2a,0xc2d,0xc2a,0xf33,0xf30,0xf33,0xf30,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020, +0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1188,0x1185,0x1371,0x136e,0x1536,0x1533,0x1536,0x1533, +0x1536,0x1533,0x1536,0x1533,0xc,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378, +0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0xc, +0xc,0x37b,0x369,0x369,0x369,0x36f,0x369,0x36c,0x1941,0x372,0x372,0x372,0x372,0x372,0x372,0x372, +0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372, +0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x375,0x1941,0x37e,0xa0e,0xc, +0xc,0x1500,0x1500,0x141c,0xf,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e, +0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0xdc8,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e, +0x97e,0x97e,0x97e,0x97e,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0xf09,0x381, +0x381,0x381,0x38d,0x381,0x384,0x381,0x381,0x390,0x981,0xdcb,0xdce,0xdcb,0xf,0xf,0xf,0xf, +0xf,0xf,0xf,0xf,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393, +0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0xf, +0xf,0xf,0xf,0x1944,0x393,0x393,0x393,0x38a,0x387,0xf,0xf,0xf,0xf,0xf,0xf,0xf, +0xf,0xf,0xf,0xf,0xcdb,0xcdb,0xcdb,0xcdb,0x141f,0x1503,0xfb1,0xfb1,0xfb1,0xfae,0xfae,0xdd4, +0x8c7,0xcd5,0xcd2,0xcd2,0xcc9,0xcc9,0xcc9,0xcc9,0xcc9,0xcc9,0xfab,0xfab,0xfab,0xfab,0xfab,0x8c4, +0x14fa,0x12,0xdd7,0x8ca,0x1338,0x3ae,0x3b1,0x3b1,0x3b1,0x3b1,0x3b1,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae, +0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xfb4, +0xfb4,0xfb4,0xfb4,0xfb4,0x8cd,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x942, +0x942,0x942,0x942,0x942,0x942,0x942,0x942,0xb5e,0xb5e,0xb5e,0xcc9,0xccf,0xccc,0xdd1,0xdd1,0xdd1, +0xdd1,0xdd1,0xdd1,0x1335,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x3a8,0x3a5, +0x3a2,0x39f,0xbc1,0xbc1,0x93f,0x3ae,0x3ae,0x3ba,0x3ae,0x3b4,0x3b4,0x3b4,0x3b4,0x3ae,0x3ae,0x3ae, +0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae, +0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae, +0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae, +0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14,0xa14,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14, +0x3b1,0x3ae,0x3b1,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14, +0x3ae,0x3ae,0x3ae,0x3b1,0x95d,0x3ae,0x399,0x399,0x399,0x399,0x399,0x399,0x399,0x396,0x39f,0x39c, +0x39c,0x399,0x399,0x399,0x399,0x3b7,0x3b7,0x399,0x399,0x39f,0x39c,0x39c,0x39c,0x399,0xcd8,0xcd8, +0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0xa14,0xa14,0xa14,0xa11,0xa11,0xcd8, +0xa29,0xa29,0xa29,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa20,0xa23,0xa20,0x15,0xa2c, +0xa26,0xa17,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26, +0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xcde,0xcde,0xcde, +0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d, +0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0x15,0x15,0xcde,0xcde,0xcde, +0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37, +0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0x1035,0x1035, +0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035, +0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32, +0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32, +0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f, +0xa2f,0xbc4,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e, +0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e, +0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf42,0xf42,0xf42,0xf42,0xf42, +0xf42,0xf42,0xf42,0xf42,0xf51,0xf51,0xf45,0xf45,0xf48,0xf57,0xf54,0x10b,0x10b,0x1968,0x196b,0x196b, +0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x252,0x252,0x252,0x252,0x252, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xb37,0xb37,0xb3a,0xb3a,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0x72,0x72,0x72,0x72, +0x15ba,0x15ba,0x15ba,0x15ba,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x15b7, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x174,0x174,0x174,0x174,0x174,0x174,0x174, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7, +0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x18e7,0x18ea,0x18ea,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x261,0x261,0x261,0x261,0x261,0x261, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1b1b,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d, +0x17a9,0x17a9,0x17a9,0x17a9,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x1e9,0x1e9,0x1e9,0x1e9,0x1665,0x1665, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1, +0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1713,0x1713,0x1713,0x1713,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xe2e,0xe2e,0xe2b,0xe2b,0xe2b,0xe2e,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x225,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1845,0x1845,0x231,0x1845,0x1845,0x231,0x1845,0x1845,0x1845,0x1845,0x1845,0x231,0x231,0x231,0x231,0x231, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x282,0x282,0x282,0x282,0x1a70,0x1a6a, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x267,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb, +0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x97b,0x97b, +3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +3,3,0x97b,0x97b,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c, +0xd8c,0xd8c,0xd8c,0xd8c,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,0x1509,0x3d5,0x3e4,0x3e4,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea, +0x3ea,0x1b,0x1b,0x3ea,0x3ea,0x1b,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea, +0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x3ea,0x1b, +0x1b,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x1b,0x3d8,0xce4,0x3d5,0x3e4,0x3e4,0x3d5,0x3d5,0x3d5, +0x3d5,0x1b,0x1b,0x3e4,0x3e4,0x1b,0x1b,0x3e7,0x3e7,0x3db,0xddd,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x3d5,0x1b,0x1b,0x1b,0x1b,0x3ed,0x3ed,0x1b,0x3ed,0x3ea,0x3ea,0x3d5,0x3d5, +0x1b,0x1b,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x3ea,0x3ea,0x3e1,0x3e1, +0x3de,0x3de,0x3de,0x3de,0x3de,0x3e1,0x3de,0x115e,0x18a2,0x189f,0x1947,0x1b,0x1e,0xce7,0x3f0,0xcea, +0x1e,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x1e,0x1e,0x1e,0x3fc,0x3fc,0x1e,0x1e,0x3fc, +0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x3fc,0x3fc, +0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x3fc,0x3ff,0x1e,0x3fc,0x3ff,0x1e,0x3fc,0x3fc,0x1e,0x1e, +0x3f3,0x1e,0x3f9,0x3f9,0x3f9,0x3f0,0x3f0,0x1e,0x1e,0x1e,0x1e,0x3f0,0x3f0,0x1e,0x1e,0x3f0, +0x3f0,0x3f6,0x1e,0x1e,0x1e,0xfbd,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x3ff,0x3ff,0x3ff, +0x3fc,0x1e,0x3ff,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x969,0x969,0x969,0x969,0x969,0x969, +0x969,0x969,0x969,0x969,0x3f0,0x3f0,0x3fc,0x3fc,0x3fc,0xfbd,0x194a,0x1e,0x1e,0x1e,0x1e,0x1e, +0x1e,0x1e,0x1e,0x1e,0x21,0x402,0x402,0x40b,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e, +0xcf3,0x40e,0x21,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e, +0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x40e,0x40e, +0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x21,0x405,0x40e,0x40b,0x40b,0x40b,0x402,0x402,0x402, +0x402,0x402,0x21,0x402,0x402,0x40b,0x21,0x40b,0x40b,0x408,0x21,0x21,0x40e,0x21,0x21,0x21, +0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x40e,0xcf3,0xced,0xced, +0x21,0x21,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x1422,0xcf0,0x21,0x21, +0x21,0x21,0x21,0x21,0x21,0x1725,0x18a5,0x18a5,0x18a5,0x18a8,0x18a8,0x18a8,0x24,0x411,0x420,0x420, +0x24,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x24,0x24,0x426,0x426,0x24,0x24,0x426, +0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x24,0x426,0x426, +0x426,0x426,0x426,0x426,0x426,0x24,0x426,0x426,0x24,0xcf6,0x426,0x426,0x426,0x426,0x24,0x24, +0x414,0x426,0x411,0x411,0x420,0x411,0x411,0x411,0xfc0,0x24,0x24,0x420,0x423,0x24,0x24,0x423, +0x423,0x417,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x1ab5,0x411,0x411,0x24,0x24,0x24,0x24, +0x429,0x429,0x24,0x426,0x426,0x426,0xfc0,0xfc0,0x24,0x24,0x41d,0x41d,0x41d,0x41d,0x41d,0x41d, +0x41d,0x41d,0x41d,0x41d,0x41a,0xcf6,0x1344,0x1344,0x1344,0x1344,0x1344,0x1344,0x24,0x24,0x24,0x24, +0x24,0x24,0x24,0x24,0x27,0x27,0x42c,0x438,0x27,0x438,0x438,0x438,0x438,0x438,0x438,0x27, +0x27,0x27,0x438,0x438,0x438,0x27,0x438,0x438,0x43b,0x438,0x27,0x27,0x27,0x438,0x438,0x27, +0x438,0x27,0x438,0x438,0x27,0x27,0x27,0x438,0x438,0x27,0x27,0x27,0x438,0x438,0x438,0x27, +0x27,0x27,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0xde0,0x438,0x438,0x438,0x27,0x27, +0x27,0x27,0x42c,0x432,0x42c,0x432,0x432,0x27,0x27,0x27,0x432,0x432,0x432,0x27,0x435,0x435, +0x435,0x42f,0x27,0x27,0xfc3,0x27,0x27,0x27,0x27,0x27,0x27,0x42c,0x27,0x27,0x27,0x27, +0x27,0x27,0x27,0x27,0x27,0x27,0xef7,0x972,0x972,0x972,0x972,0x972,0x972,0x972,0x972,0x972, +0x96f,0x96f,0x96f,0xdb0,0xcf9,0xcf9,0xcf9,0xcf9,0xcf9,0xcfc,0xcf9,0x27,0x27,0x27,0x27,0x27, +0x150c,0x44a,0x44a,0x44a,0x194d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x2a,0x44d,0x44d, +0x44d,0x2a,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d, +0x44d,0x2a,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x150f,0x44d,0x44d,0x44d, +0x44d,0x44d,0x2a,0x2a,0x2a,0xfcc,0x43e,0x43e,0x43e,0x44a,0x44a,0x44a,0x44a,0x2a,0x43e,0x43e, +0x441,0x2a,0x43e,0x43e,0x43e,0x444,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x43e,0x43e,0x2a, +0xfcc,0xfcc,0x1728,0x2a,0x2a,0x2a,0x2a,0x2a,0x44d,0x44d,0xfc6,0xfc6,0x2a,0x2a,0x447,0x447, +0x447,0x447,0x447,0x447,0x447,0x447,0x447,0x447,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x1a19, +0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0x17e5,0x1512,0x456,0x456,0x1950,0x45c,0x45c,0x45c, +0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c, +0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c, +0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x2d,0xcff,0xd02,0x456,0x450, +0x459,0x456,0x450,0x456,0x456,0x2d,0x450,0x459,0x459,0x2d,0x459,0x459,0x450,0x453,0x2d,0x2d, +0x2d,0x2d,0x2d,0x2d,0x2d,0x450,0x450,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x45c,0x2d, +0x45c,0x45c,0xf0f,0xf0f,0x2d,0x2d,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975, +0x2d,0xf12,0xf12,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, +0x18ab,0x1515,0x468,0x468,0x1ab8,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x30,0x46e,0x46e, +0x46e,0x30,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e, +0x468,0x45f,0x45f,0x45f,0xfcf,0x30,0x468,0x468,0x468,0x30,0x46b,0x46b,0x46b,0x462,0x134a,0x17e8, +0x30,0x30,0x30,0x30,0x17eb,0x17eb,0x17eb,0x45f,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x172b, +0x46e,0x46e,0xfcf,0xfcf,0x30,0x30,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465, +0xfd2,0xfd2,0xfd2,0xfd2,0xfd2,0xfd2,0x17e8,0x17e8,0x17e8,0xfd5,0xfd8,0xfd8,0xfd8,0xfd8,0xfd8,0xfd8, +0x33,0x1abb,0xa3e,0xa3e,0x33,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44, +0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0x33,0x33,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44, +0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0xa44, +0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0xa44,0x33,0x33,0xa44,0xa44,0xa44,0xa44, +0xa44,0xa44,0xa44,0x33,0x33,0x33,0xa38,0x33,0x33,0x33,0x33,0xa35,0xa3e,0xa3e,0xa35,0xa35, +0xa35,0x33,0xa35,0x33,0xa3e,0xa3e,0xa41,0xa3e,0xa41,0xa41,0xa41,0xa35,0x33,0x33,0x33,0x33, +0x33,0x33,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x33,0x33,0xa3e,0xa3e, +0xa3b,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x489,0x489,0x489, +0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489, +0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x474,0x489,0x486, +0x474,0x474,0x474,0x474,0x474,0x474,0x47a,0x36,0x36,0x36,0x36,0x471,0x48f,0x48f,0x48f,0x48f, +0x48f,0x489,0x48c,0x477,0x477,0x477,0x477,0x477,0x477,0x474,0x477,0x47d,0x483,0x483,0x483,0x483, +0x483,0x483,0x483,0x483,0x483,0x483,0x480,0x480,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x39,0x49e,0x49e,0x39,0x49e,0x39,0x1a1f,0x49e, +0x49e,0x1a1f,0x49e,0x39,0x1a1f,0x49e,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x49e,0x49e,0x49e,0x49e, +0x1a1f,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x1a1f,0x49e,0x49e,0x49e,0x39,0x49e,0x39,0x49e, +0x1a1f,0x1a1f,0x49e,0x49e,0x1a1f,0x49e,0x49e,0x49e,0x49e,0x492,0x49e,0x49b,0x492,0x492,0x492,0x492, +0x492,0x492,0x1a1c,0x492,0x492,0x49e,0x39,0x39,0x4a7,0x4a7,0x4a7,0x4a7,0x4a7,0x39,0x4a4,0x39, +0x495,0x495,0x495,0x495,0x495,0x492,0x39,0x39,0x498,0x498,0x498,0x498,0x498,0x498,0x498,0x498, +0x498,0x498,0x39,0x39,0x4a1,0x4a1,0x1425,0x1425,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, +0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, +0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7, +0x3c,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba, +0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7, +0x9b7,0x9ba,0xa53,0xfe4,0xfe4,0x3c,0x3c,0x3c,0x3c,0x984,0x984,0x987,0x984,0x987,0x987,0x990, +0x987,0x990,0x984,0x984,0x984,0x984,0x984,0x9b1,0x984,0x987,0x98a,0x98a,0x98d,0x996,0x98a,0x98a, +0x9b7,0x9b7,0x9b7,0x9b7,0x1353,0x134d,0x134d,0x134d,0x984,0x984,0x984,0x987,0x984,0x984,0xa47,0x984, +0x3c,0x984,0x984,0x984,0x984,0x987,0x984,0x984,0x984,0x984,0x987,0x984,0x984,0x984,0x984,0x987, +0x984,0x984,0x984,0x984,0x987,0x984,0xa47,0xa47,0xa47,0x984,0x984,0x984,0x984,0x984,0x984,0x984, +0xa47,0x987,0xa47,0xa47,0xa47,0x3c,0xa50,0xa50,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4a,0xa4d, +0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0x3c,0xfdb,0xa4d,0xde3,0xde3,0xfde,0xfe1,0xfdb,0x1161,0x1161,0x1161, +0x1161,0x1350,0x1350,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, +0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, +0x3c,0x3c,0x3c,0x3c,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x3f,0x142b,0x3f,0x3f,0x3f,0x3f, +0x3f,0x142b,0x3f,0x3f,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa, +0x4aa,0x4aa,0x4aa,0x4aa,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d, +0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0xa7d,0x42,0xa7d,0xa7d, +0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d, +0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, +0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42, +0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42, +0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42, +0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2, +0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2, +0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, +0xa7d,0xa7d,0xa7d,0x42,0x42,0x1356,0x1356,0xdec,0xdef,0xa77,0xa80,0xa74,0xa74,0xa74,0xa74,0xa80, +0xa80,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa71,0xa71,0xa71,0xa71,0xa71,0xa71, +0xa71,0xa71,0xa71,0xa71,0xa71,0x42,0x42,0x42,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83, +0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0x1731,0x45,0x45, +0x172e,0x172e,0x172e,0x172e,0x172e,0x172e,0x45,0x45,0xa95,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98, +0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98, +0xa98,0xa98,0xa98,0xa92,0xa8f,0x48,0x48,0x48,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e, +0xa9e,0xa9e,0xa9e,0xa9b,0xa9b,0xa9b,0xa9e,0xa9e,0xa9e,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b, +0x151b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0xabf,0xabf,0xabf,0xabf,0xabf,0xabf,0xaa1,0xabf, +0xabf,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa7,0xaa4,0xab6,0xab6,0xab9,0xac2, +0xab0,0xaad,0xab6,0xab3,0xac2,0xd05,0x4e,0x4e,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc, +0xabc,0xabc,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08, +0xd08,0xd08,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0xad1,0xad1,0xb52,0xb55,0xad7,0xb4f,0xad4,0xad1, +0xada,0xae9,0xadd,0xaec,0xaec,0xaec,0xac8,0x51,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0, +0xae0,0xae0,0x51,0x51,0x51,0x51,0x51,0x51,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, +0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, +0x1953,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, +0xae3,0xacb,0x1002,0x51,0x51,0x51,0x51,0x51,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8, +0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, +0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54, +0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x54,0x54,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, +0x54,0x4ce,0x54,0x4ce,0x54,0x4ce,0x54,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, +0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, +0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, +0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb, +0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c5,0x4cb,0x4c5,0x4c5,0x4c2,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb, +0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c2,0x4c2,0x4c2,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,0x4cb,0x4cb, +0x4ce,0x4ce,0x4ce,0x4ce,0x54,0x4c2,0x4c2,0x4c2,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, +0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c2,0x4c2,0x4c2,0x54,0x54,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb, +0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c8,0x4c5,0x54,0xbca,0xbcd,0xbcd,0xbcd,0x100b,0x57,0x14f7,0x14f7, +0x14f7,0x14f7,0x4d7,0x4d7,0x4d7,0x4d7,0x4d7,0x4d7,0x522,0xbdf,0x5a,0x5a,0x6e1,0x522,0x522,0x522, +0x522,0x522,0x528,0x53a,0x528,0x534,0x52e,0x6e4,0x51f,0x6de,0x6de,0x6de,0x6de,0x51f,0x51f,0x51f, +0x51f,0x51f,0x525,0x537,0x525,0x531,0x52b,0x5a,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0x1359,0x1359,0x1359, +0x1359,0x1359,0x1359,0x1359,0x1359,0x5a,0x5a,0x5a,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d, +0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x549,0x549,0x549,0x549,0x549,0x549,0x549,0x549, +0x549,0x549,0x549,0x549,0x549,0x546,0x546,0x546,0x546,0x549,0xafb,0xafe,0xbe5,0xbeb,0xbeb,0xbe8, +0xbe8,0xbe8,0xbe8,0xe01,0xf15,0xf15,0xf15,0xf15,0x114c,0x60,0x60,0x60,0x60,0x60,0x60,0x60, +0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x579,0x579,0x579,0xb07,0xf1e,0x1011,0x1011,0x1011, +0x1011,0x12ab,0x1737,0x1737,0x63,0x63,0x63,0x63,0x70b,0x70b,0x70b,0x70b,0x70e,0x70e,0x70e,0x70e, +0x70e,0x70e,0x585,0x585,0x582,0x582,0x582,0x582,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0xb13,0xb13,0x66, +0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66, +0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af, +0x5af,0x5af,0x5af,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, +0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, +0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, +0xb2e,0xb2e,0x6c,0xb2e,0xb2e,0xb2e,0xb2e,0xb31,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, +0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb31,0x6c,0x6c,0x6c,0x6c, +0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34, +0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0x6f,0x6f, +0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x75,0x843,0x83d,0x843,0x83d,0x843,0x83d,0x843, +0x83d,0x843,0x83d,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d, +0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x83d,0x83d,0x83d,0x843,0x83d,0x843,0x83d,0x843, +0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x843,0x83d,0x83d,0x83d,0x83d,0x83d,0x840,0xc93,0xc93,0x75, +0x75,0x954,0x954,0x91e,0x91e,0x846,0x849,0xc90,0x78,0x78,0x78,0x78,0x78,0x85b,0x85b,0x85b, +0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b, +0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x113a,0x191a,0x1a01,0x7b,0x85e,0x85e,0x85e, +0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x7b, +0x927,0x927,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a, +0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867, +0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0xd98,0xd98,0x7e, +0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0x81,0x81,0x81, +0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c, +0xb4c,0xc9c,0xb4c,0xb4c,0xb4c,0xc9c,0xb4c,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, +0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df, +0x9db,0x9db,0x9db,0x9db,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87, +0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254, +0x60c,0x60c,0x60c,0x60c,0x60c,0x60c,0x60c,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, +0x8a,0x8a,0x8a,0x5fa,0x5fa,0x5fa,0x5fa,0x5fa,0x8a,0x8a,0x8a,0x8a,0x8a,0xb1f,0x5fd,0x603, +0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x600,0x603,0x603,0x603,0x603,0x603,0x603, +0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x8a,0x603,0x603,0x603,0x603,0x603,0x8a,0x603,0x8a, +0x603,0x603,0x8a,0x603,0x603,0x8a,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x606, +0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618, +0x136b,0x136b,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, +0x8d,0x8d,0x8d,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x61e,0x618, +0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, +0x61b,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x618,0x61b,0x618,0x618,0x61b,0x61b,0x618,0x618, +0x618,0x618,0x618,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x61b,0x61b,0x618,0x61b,0x61b,0x61b,0x61b, +0x8d,0x8d,0x61b,0x61b,0x61b,0x61b,0x618,0x618,0x61b,0x618,0x618,0x618,0x618,0x61b,0x618,0x618, +0x618,0x618,0x618,0x61b,0x61b,0x61b,0x618,0x618,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, +0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a, +0x61e,0x61e,0x978,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x615,0x615,0xc24,0xdb3,0x8d,0x8d, +0x87f,0x891,0x88e,0x891,0x88e,0xcb1,0xcb1,0xda4,0xda1,0x882,0x882,0x882,0x882,0x894,0x894,0x894, +0x8ac,0x8af,0x8be,0x90,0x8b2,0x8b5,0x8c1,0x8c1,0x8a9,0x8a0,0x89a,0x8a0,0x89a,0x8a0,0x89a,0x89d, +0x89d,0x8b8,0x8b8,0x8bb,0x8b8,0x8b8,0x8b8,0x90,0x8b8,0x8a6,0x8a3,0x89d,0x90,0x90,0x90,0x90, +0x62a,0x636,0x62a,0xc27,0x62a,0x93,0x62a,0x636,0x62a,0x636,0x62a,0x636,0x62a,0x636,0x62a,0x636, +0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633, +0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x93,0x93,0x627, +0x77d,0x780,0x795,0x798,0x777,0x780,0x780,0x99,0x75f,0x762,0x762,0x762,0x762,0x75f,0x75f,0x99, +0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0xb22,0xb22,0xb22,0x9de,0x759,0x639,0x639, +0x99,0x7a7,0x786,0x777,0x780,0x77d,0x777,0x789,0x77a,0x774,0x777,0x795,0x78c,0x783,0x7a4,0x777, +0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x792,0x78f,0x795,0x795,0x795,0x7a7, +0x768,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765, +0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x99, +0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765, +0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,0x99,0x99,0x765,0x765,0x765,0x99,0x99,0x99, +0xb6d,0xb6d,0xb6d,0xb6d,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x18b7,0x18b7,0x18b7, +0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73, +0xb73,0xb73,0xb73,0x9f,0x9f,0x9f,0x9f,0x9f,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683, +0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xa2,0xa2, +0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xa5, +0xa5,0x101d,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, +0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d, +0x173d,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5, +0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xa8,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xa8,0xba0,0xba0,0xa8,0xa8,0xba0,0xa8,0xa8,0xba0,0xba0,0xa8, +0xa8,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d, +0xb9d,0xb9d,0xa8,0xb9d,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xd29,0xb9d,0xb9d,0xa8,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xa8,0xba0, +0xba0,0xba0,0xba0,0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0, +0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xa8, +0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xe16,0xe16,0xa8,0xa8,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xf2d,0xf2a, +0xa8,0xa8,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a, +0xb9a,0xb9a,0xb9a,0xb9a,0xab,0xba6,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab, +0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab, +0xab,0xab,0xab,0xab,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36, +0xc36,0xae,0xc36,0xc36,0xc36,0xc36,0xc30,0xc30,0xc33,0xae,0xae,0xae,0xae,0xae,0xae,0xae, +0xae,0xae,0xae,0xae,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f, +0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc39,0xc39,0xc3c,0xca5,0xca5,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45, +0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc42,0xc42,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4, +0xb4,0xb4,0xb4,0xb4,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b, +0xc4b,0xb7,0xc4b,0xc4b,0xc4b,0xb7,0xc48,0xc48,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7, +0xb7,0xb7,0xb7,0xb7,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b, +0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b, +0xd3b,0x1539,0x1539,0xba,0xd2c,0xd2c,0xd2c,0xd38,0xd38,0xd38,0xd38,0xd2c,0xd2c,0xd38,0xd38,0xd38, +0xba,0xba,0xba,0xba,0xd38,0xd38,0xd2c,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd2f,0xd2f,0xd2f, +0xba,0xba,0xba,0xba,0xd32,0xba,0xba,0xba,0xd3e,0xd3e,0xd35,0xd35,0xd35,0xd35,0xd35,0xd35, +0xd35,0xd35,0xd35,0xd35,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41, +0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xbd,0xbd,0xd41,0xd41,0xd41,0xd41,0xd41,0xbd,0xbd,0xbd, +0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, +0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0xc0,0xc0,0x153c,0x153c, +0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, +0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0xc0,0x1abe,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, +0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68, +0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68, +0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68, +0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,0xd68,0xd68, +0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xc3,0xd68,0xd68,0xd68,0xd68, +0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, +0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, +0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xd6b,0xd6b,0xd6b,0xd6b, +0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b, +0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xc6,0xc6,0xc6,0xc6,0xc6,0xdad,0xdad,0xdad,0xc9, +0xc9,0xc9,0xc9,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7, +0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xc9,0xc9,0xc9,0xdaa, +0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71, +0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71, +0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xcc,0xd6e,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a, +0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a, +0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xcf,0xcf,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77, +0xd77,0xd77,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b, +0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd2,0xd2, +0xd7d,0xd2,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d, +0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd2,0xd7d,0xd7d,0xd2,0xd2,0xd2, +0xd7d,0xd2,0xd2,0xd7d,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80, +0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd5,0xd5,0xd5,0xd5,0xd5, +0xd5,0xd5,0xd5,0xd5,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0x153f, +0x153f,0x17f1,0x17f1,0xdb,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119, +0x1acd,0x132,0x132,0x132,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43, +0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe3a,0xe3a,0xe40,0xe40,0xe3a, +0xde,0xde,0xe3d,0xe3d,0x1149,0x1149,0x1149,0x1149,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1, +0xe1,0xe1,0xe1,0xe1,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2, +0xca2,0xca2,0xca2,0xca2,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1542,0x1542,0x1542,0x1542,0x1542, +0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1545,0x18bd,0x18bd,0x193e,0x18bd,0xe4,0x17f4, +0x1377,0x118b,0xf3c,0xf3c,0xe55,0xe52,0xe55,0xe52,0xe52,0xe49,0xe49,0xe49,0xe49,0xe49,0xe49,0x1194, +0x1191,0x1194,0x1191,0x118e,0x118e,0x118e,0x1434,0x1431,0xe7,0xe7,0xe7,0xe7,0xe7,0xe4f,0xe4c,0xe4c, +0xe4c,0xe49,0xe4f,0xe4c,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58, +0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xea,0xea,0xea,0xea, +0xea,0xea,0xea,0xea,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58, +0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58, +0xe58,0xe58,0xe58,0xea,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e, +0xe5e,0xe5e,0xe5e,0xe5e,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xed,0xed, +0xed,0xed,0xed,0xed,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xf0,0x1437,0xf0,0xf0,0xf0,0xf0, +0xf0,0x1437,0xf0,0xf0,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8, +0xeb8,0xeb8,0xeb8,0xeb8,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67, +0xe67,0xe67,0xe67,0xf3,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64, +0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64, +0xe64,0xe64,0xe64,0xf3,0xe79,0xe6d,0xe6d,0xe6d,0xf6,0xe6d,0xe6d,0xf6,0xf6,0xf6,0xf6,0xf6, +0xe6d,0xe6d,0xe6d,0xe6d,0xe79,0xe79,0xe79,0xe79,0xf6,0xe79,0xe79,0xe79,0xf6,0xe79,0xe79,0xe79, +0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79, +0xe79,0xe79,0xe79,0xe79,0x195c,0x195c,0xf6,0xf6,0xe6a,0xe6a,0xe6a,0xf6,0xf6,0xf6,0xf6,0xe70, +0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0x1959,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6, +0xe76,0xe76,0xe76,0xe76,0xe76,0xe76,0xe7c,0xe7c,0xe73,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6, +0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0x119a,0x119a,0xf9,0xf9,0xf9,0xf9, +0xe88,0xe88,0xe88,0xe88,0xe88,0xe8b,0xe8b,0xe8b,0xe88,0xe88,0xe8b,0xe88,0xe88,0xe88,0xe88,0xe88, +0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xe85,0xe85,0xe85,0xe85, +0xe85,0xe85,0xe85,0xe85,0xe85,0xe85,0x1197,0xf9,0xf9,0xf9,0xe82,0xe82,0xe91,0xe91,0xe91,0xe91, +0xfc,0xfc,0xfc,0xfc,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe8e,0xe91,0xe91,0xe91, +0xe91,0xe91,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0x154e,0x1554,0x1551,0x189c, +0x17f7,0x18c0,0x18c0,0x18c0,0x18c0,0x18c0,0x1962,0x195f,0x1965,0x195f,0x1965,0x1a25,0x1ac1,0x1ac1,0x1ac1,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xeb5,0xeb5,0xeb5,0xeb2,0xeb2,0xea9,0xea9,0xeb2,0xeaf,0xeaf,0xeaf,0xeaf,0x1ac4,0x102,0x102,0x102, +0x1314,0x1314,0x1314,0x1317,0x1317,0x1317,0x130e,0x130e,0x1311,0x130e,0x156,0x156,0x156,0x156,0x156,0x156, +0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0x1443,0x1443,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0xebb, +0x137d,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x137a, +0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc75, +0xee8,0xed9,0xed3,0xee5,0xee2,0xedc,0xedc,0xeeb,0xed6,0xedf,0x108,0x108,0x108,0x108,0x108,0x108, +0xf6f,0xf6f,0xf5a,0xf6f,0xf72,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0x10e,0x10e,0x10e,0x10e, +0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf7b,0xf7b,0xf60,0xf66,0xf7b,0xf7b, +0xf63,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d, +0xf5d,0xf5d,0xf5d,0xf5d,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0x10e,0x10e,0x10e, +0x111,0x111,0x1a2b,0x1a28,0x1a2b,0x1a2b,0x1a2b,0x1aca,0x1ac7,0x1aca,0x1ac7,0x111,0x111,0x111,0x111,0x111, +0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111, +0x111,0x1aca,0x1ac7,0x155d,0x144c,0x144c,0x1380,0x1074,0x1074,0x1074,0x1074,0x1074,0xf8a,0xf8a,0xf8a,0xf8a, +0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a, +0xf87,0xf87,0xf8d,0xf8d,0x114,0x114,0x114,0x114,0x114,0x114,0x114,0x114,0xf96,0xf96,0xf96,0xf96, +0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96, +0xf96,0xf96,0xf90,0xf90,0xf90,0xf90,0x11a3,0x11a3,0x117,0x117,0x117,0xf93,0x1563,0x1563,0x1563,0x1563, +0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563, +0x1563,0x1563,0x1563,0x1563,0x1563,0x174c,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a, +0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a, +0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0xf9f,0xf9f,0xf9f,0x1569,0x1569,0x1569,0x1569,0x1569, +0x1569,0x1569,0x1569,0x1569,0x1569,0x1569,0x1569,0x11d,0xf9c,0xf9c,0xf9c,0xf9c,0x1566,0x11d,0x11d,0x11d, +0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2, +0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974, +0x1974,0x120,0x120,0x120,0x120,0x120,0x120,0x120,0x109b,0x109b,0x109b,0x109b,0x1098,0x1098,0x1098,0x1098, +0x1098,0x1098,0x1098,0x1098,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1098,0x1098,0x108f,0x108c, +0x123,0x123,0x123,0x109e,0x109e,0x1092,0x1092,0x1092,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095, +0x1095,0x1095,0x123,0x123,0x123,0x109b,0x109b,0x109b,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1, +0x10a1,0x10a1,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6, +0x10b6,0x10b6,0x10b9,0x10b9,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126, +0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x10e0,0x10e0,0x10e0,0x10e0,0x10da,0x17fd,0x129,0x129, +0x129,0x129,0x129,0x129,0x129,0x129,0x10e6,0x10e6,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd, +0x10dd,0x10dd,0x129,0x129,0x129,0x129,0x129,0x129,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x10f8, +0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10fe,0x1101,0x12c,0x12c,0x12c,0x12c, +0x12c,0x12c,0x12c,0x12c,0x12c,0x12c,0x12c,0x10fb,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113, +0x1113,0x1107,0x1107,0x1107,0x1107,0x1107,0x1107,0x1110,0x1110,0x1107,0x1107,0x1110,0x1110,0x1107,0x1107,0x12f, +0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x1113,0x1113,0x1113,0x1107,0x1113,0x1113,0x1113,0x1113, +0x1113,0x1113,0x1113,0x1113,0x1107,0x1110,0x12f,0x12f,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d, +0x110d,0x110d,0x12f,0x12f,0x110a,0x1116,0x1116,0x1116,0x1575,0x132,0x132,0x132,0x132,0x132,0x132,0x132, +0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132, +0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c, +0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c, +0x111c,0x111c,0x111c,0x111c,0x111c,0x111f,0x135,0x135,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122, +0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122, +0x1122,0x1122,0x1122,0x1122,0x1122,0x138,0x138,0x138,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125, +0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b, +0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b, +0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b, +0x112b,0x112b,0x13e,0x13e,0x13e,0x13e,0x13e,0x1128,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e, +0x112e,0x112e,0x112e,0x112e,0x141,0x141,0x141,0x141,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131, +0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x144,0x144,0x144,0x144, +0x144,0x144,0x144,0x144,0x144,0x144,0x144,0x144,0x11a9,0x11a9,0x11a9,0x11a9,0x11b2,0x11a9,0x11a9,0x11a9, +0x11b2,0x11a9,0x11a9,0x11a9,0x11a9,0x11a6,0x147,0x147,0x11af,0x11af,0x11af,0x11af,0x11af,0x11af,0x11af,0x11b5, +0x11af,0x11b5,0x11af,0x11af,0x11af,0x11b5,0x11b5,0x147,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8, +0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x14a,0x14a, +0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3, +0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d0,0x11bb,0x11d0, +0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x14d,0x11c4,0x11cd,0x11bb,0x11cd,0x11cd,0x11bb,0x11bb,0x11bb, +0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11d0,0x11d0,0x11d0,0x11d0,0x11d0,0x11d0,0x11bb,0x11bb,0x11c1,0x11c1,0x11c1, +0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x14d,0x14d,0x11be,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca, +0x11ca,0x11ca,0x14d,0x14d,0x14d,0x14d,0x14d,0x14d,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca, +0x11ca,0x11ca,0x14d,0x14d,0x14d,0x14d,0x14d,0x14d,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11d6, +0x11d9,0x11d9,0x11d9,0x11d9,0x11c7,0x11c7,0x14d,0x14d,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0, +0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15bd,0x1adf,0x1329,0x1302,0x1320,0x1320,0x1320,0x1320,0x1320,0x1320, +0x1320,0x1308,0x1305,0x12fc,0x12fc,0x1326,0x12fc,0x12fc,0x12fc,0x12fc,0x130b,0x14eb,0x14f1,0x14ee,0x14ee,0x193b, +0x1716,0x1716,0x1aac,0x150,0x150,0x150,0x150,0x150,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee, +0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11e5,0x11e5,0x11e8,0x11f1,0x11eb,0x11eb,0x11eb,0x11f1, +0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea, +0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea, +0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x159,0x159,0x159,0x120f,0x1203,0x1203,0x1203,0x1203,0x1203,0x1203,0x1206, +0x1215,0x1215,0x1203,0x1203,0x1203,0x1203,0x15c,0x131a,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209, +0x1209,0x1209,0x15c,0x15c,0x15c,0x15c,0x1203,0x1203,0x1233,0x1227,0x1233,0x15f,0x15f,0x15f,0x15f,0x15f, +0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f, +0x15f,0x15f,0x15f,0x1230,0x1230,0x1236,0x122a,0x122d,0x124b,0x124b,0x124b,0x1245,0x1245,0x123c,0x1245,0x1245, +0x123c,0x1245,0x1245,0x124e,0x1248,0x123f,0x162,0x162,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242, +0x1242,0x1242,0x162,0x162,0x162,0x162,0x162,0x162,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x165, +0x165,0x165,0x165,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251, +0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251, +0x165,0x165,0x165,0x165,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d, +0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x168,0x125a,0x1257,0x1257,0x1257,0x1257, +0x1257,0x1257,0x1257,0x1257,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c, +0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x16b,0x16b,0x16b,0x1266,0x1269,0x1269, +0x1269,0x1269,0x1269,0x1269,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272, +0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x16e,0x16e,0x126f,0x126f,0x126f,0x126f, +0x126f,0x126f,0x126f,0x126f,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278, +0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x171,0x171,0x171,0x171,0x171,0x1275,0x1275,0x1275,0x1275, +0x1275,0x1275,0x1275,0x1275,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e, +0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e, +0x127e,0x127e,0x127e,0x177,0x1299,0x1299,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a, +0x17a,0x197d,0x17a,0x17a,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca, +0x14ca,0x14ca,0x14ca,0x14ca,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f, +0x129f,0x129f,0x129f,0x17d,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a52,0x1a4c,0x279,0x279,0x279, +0x279,0x279,0x279,0x279,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e, +0x187e,0x1ad0,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180, +0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180, +0x180,0x180,0x180,0x180,0x180,0x180,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x12f6,0x13f5,0x13f2,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183, +0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f3,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0, +0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f3,0x12f0,0x12f0,0x13f5,0x13f5, +0x13f5,0x13f5,0x13f5,0x13f2,0x13f5,0x13f5,0x13f5,0x1881,0x183,0x183,0x183,0x183,0x12ed,0x12ed,0x12ed,0x12ed, +0x12ed,0x12ed,0x12ed,0x12ed,0x12ed,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x1419,0x1419,0x183,0x183, +0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x1920,0x1920,0x1920,0x1920, +0x1920,0x1920,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183, +0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183, +0x183,0x183,0x183,0x183,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395, +0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x138f,0x138f,0x138f, +0x186,0x186,0x1392,0x186,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x1398,0x13a1,0x139b,0x139b,0x13a1,0x13a1, +0x13a1,0x139b,0x13a1,0x139b,0x139b,0x139b,0x13a4,0x13a4,0x189,0x189,0x189,0x189,0x189,0x189,0x189,0x189, +0x139e,0x139e,0x139e,0x139e,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x13aa,0x13aa,0x13aa, +0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x18c,0x18c,0x18c, +0x18c,0x18c,0x18c,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x13aa,0x13aa,0x13aa,0x13aa, +0x13aa,0x13aa,0x13aa,0x18c,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d, +0x161d,0x161d,0x161d,0x161d,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13b0,0x13c2,0x13c2,0x13b6,0x13b6,0x13b6, +0x13b6,0x13b6,0x18f,0x18f,0x18f,0x18f,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3, +0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9, +0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x1584, +0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5, +0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x192,0x192,0x192,0x192,0x192,0x192,0x192, +0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x195, +0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x1587, +0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13fe, +0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8, +0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587, +0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195, +0x1413,0x1410,0x1410,0x1410,0x1410,0x1410,0x159c,0x159c,0x159c,0x159c,0x159c,0x159f,0x170d,0x159f,0x159f,0x159f, +0x17d9,0x188a,0x188a,0x18c3,0x18c3,0x1a8e,0x1b39,0x1b39,0x198,0x198,0x198,0x198,0x198,0x198,0x198,0x198, +0x159f,0x159f,0x159f,0x159f,0x159f,0x159f,0x159c,0x159c,0x159c,0x159f,0x159c,0x170a,0x170a,0x198,0x198,0x198, +0x159f,0x159c,0x159c,0x159f,0x188a,0x188a,0x188a,0x1926,0x1926,0x1a07,0x1a8e,0x1b39,0x1b39,0x198,0x198,0x198, +0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb, +0x13cb,0x13cb,0x13cb,0x13cb,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b, +0x1467,0x15a5,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x15a5,0x15a5,0x15a5, +0x15a5,0x15a5,0x15a5,0x175e,0x175e,0x19e,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1ad3,0x1ad3, +0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e, +0x19e,0x19e,0x19e,0x1983,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806, +0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d, +0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d, +0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d, +0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x1a1,0x1a1, +0x1a1,0x1a1,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x146d,0x146d, +0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d, +0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d, +0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x1a1, +0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d, +0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x1a1,0x1a1,0x1a1, +0x1a1,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d, +0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x1a1,0x1a1,0x1a1, +0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1, +0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x146a,0x146a,0x1a1,0x1a1, +0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1482,0x1482,0x1482,0x1482, +0x1482,0x1482,0x1482,0x1470,0x1470,0x1470,0x1470,0x1470,0x147f,0x1470,0x1473,0x1473,0x1470,0x1470,0x1470,0x1476, +0x1476,0x1a4,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x1479,0x1485,0x1485,0x1485, +0x1989,0x1986,0x1986,0x1ad6,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x162f,0x162f,0x162f,0x162f, +0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x1491,0x1491,0x1491,0x1491, +0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x148e,0x1488,0x1488,0x148e,0x148e,0x1497,0x1497,0x1491,0x1494, +0x1494,0x148e,0x148b,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x149a,0x149a,0x149a,0x149a, +0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a, +0x149a,0x149a,0x149a,0x149a,0x1aa,0x1aa,0x1aa,0x1aa,0x1761,0x1761,0x149a,0x149a,0x1761,0x1761,0x1761,0x1761, +0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1aa,0x1aa,0x1761,0x1761, +0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x14a6,0x14a6,0x14a6,0x14a6, +0x14a6,0x1a37,0x1a37,0x1a37,0x1a37,0x1a37,0x1a37,0x1ad,0x1ad,0x1ad,0x1ad,0x1a31,0x14a6,0x14a3,0x14a3,0x14a3, +0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x1a34,0x1a34,0x1a34,0x1a34, +0x1a34,0x1a34,0x1a34,0x1a34,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x14a0,0x14a0,0x14a0,0x14a0,0x14a9, +0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14ca,0x14ca,0x14ca,0x14ca, +0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x14c7,0x14c7,0x14c7,0x14c7, +0x14c7,0x14c7,0x14c7,0x14c7,0x14c7,0x14c7,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x14cd,0x14cd,0x14cd,0x14cd, +0x14cd,0x14cd,0x14cd,0x14cd,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1323,0x1320,0x1323,0x12ff, +0x1320,0x1326,0x1326,0x1329,0x1326,0x1329,0x132c,0x1320,0x1329,0x1329,0x1320,0x1320,0x14df,0x14df,0x14df,0x14df, +0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14d0,0x14d9,0x14d0,0x14d9,0x14d9,0x14d0,0x14d0,0x14d0,0x14d0, +0x14d0,0x14d0,0x14dc,0x14d3,0x1a3a,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x15b1,0x15b1,0x15b1,0x15b1, +0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x1b9,0x1b9,0x15ae,0x15ae,0x15ae,0x15ae, +0x15ae,0x15b4,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1719,0x1710,0x1710,0x1710, +0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710, +0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1bf,0x1bf,0x1bf,0x1bf,0x1adf,0x1c2,0x1c2,0x1c2, +0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2, +0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2, +0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,0x1c5,0x1c5,0x1c5, +0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,0x1c5, +0x1c5,0x1c5,0x1c5,0x1c5,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5, +0x15c9,0x15c3,0x15c6,0x15cf,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x1c8,0x1c8,0x1c8,0x1c8, +0x1c8,0x1c8,0x1c8,0x1c8,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba, +0x15ba,0x15ba,0x15ba,0x15ba,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5, +0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x198c,0x198c,0x198c,0x198c,0x1cb,0x1cb,0x1cb, +0x1cb,0x1cb,0x1cb,0x1cb,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91, +0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb, +0x1cb,0x1cb,0x1cb,0x1cb,0x1776,0x171c,0x15de,0x1722,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7, +0x15e7,0x1ce,0x1ce,0x15e7,0x15e7,0x1ce,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7, +0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x15e7,0x15e7, +0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x1a16,0x171f,0x15e7,0x15d8,0x15de,0x15d8,0x15de,0x15de,0x15de, +0x15de,0x1ce,0x1ce,0x15de,0x15de,0x1ce,0x1ce,0x15e1,0x15e1,0x15e4,0x1ce,0x1ce,0x1779,0x1ce,0x1ce,0x1ce, +0x1ce,0x1ce,0x1ce,0x15d8,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x15ea,0x15e7,0x15e7,0x15e7,0x15e7,0x15de,0x15de, +0x1ce,0x1ce,0x15db,0x15db,0x15db,0x15db,0x15db,0x15db,0x15db,0x1ce,0x1ce,0x1ce,0x15db,0x15db,0x15db,0x15db, +0x15db,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x15ff,0x15ff,0x15ff,0x15ff, +0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x1d1,0x15ff, +0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15f9,0x15f9,0x15f9,0x15ed, +0x15ed,0x15ed,0x15f9,0x15f9,0x15ed,0x15fc,0x15f0,0x15ed,0x1602,0x1602,0x15f6,0x1602,0x1602,0x15f3,0x180c,0x1d1, +0x1611,0x1611,0x1611,0x1605,0x1605,0x1605,0x1605,0x1605,0x1605,0x1608,0x160b,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4, +0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4, +0x177c,0x177c,0x177c,0x177c,0x161d,0x161a,0x1a3d,0x1a3d,0x1ae5,0x1ae8,0x1ae2,0x1ae2,0x1d7,0x1d7,0x1d7,0x1d7, +0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6, +0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623, +0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da, +0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623, +0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da, +0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da, +0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da, +0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f, +0x162f,0x162f,0x162f,0x1626,0x1629,0x162c,0x162f,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd, +0x163e,0x163e,0x163e,0x163e,0x163e,0x1632,0x1632,0x1e0,0x1e0,0x1e0,0x1e0,0x1635,0x1635,0x1635,0x1635,0x1635, +0x163b,0x163b,0x163b,0x163b,0x163b,0x163b,0x1638,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0, +0x1647,0x1647,0x1647,0x1647,0x1647,0x1e3,0x1e3,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644, +0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3, +0x164a,0x165c,0x165c,0x1650,0x1659,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6, +0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6, +0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662, +0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1e9, +0x166e,0x166e,0x166e,0x166e,0x166e,0x1668,0x1671,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e, +0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166e,0x166e,0x166e,0x166e,0x166e,0x1ec, +0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677, +0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1ef, +0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683, +0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1680,0x1680,0x1680,0x1680,0x1680,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2, +0x169b,0x169b,0x169e,0x169e,0x16a1,0x1692,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5, +0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1f5,0x1692,0x1692,0x1692,0x1692,0x1692, +0x1692,0x1692,0x1f5,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, +0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x169b,0x169b,0x169b, +0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa, +0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8, +0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3, +0x16b3,0x16b3,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x16b0,0x16b0,0x16b0,0x16b0,0x1fb,0x1fb,0x1fb, +0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16b6, +0x16c8,0x16c8,0x16b6,0x16b6,0x16b6,0x16b6,0x201,0x201,0x16c8,0x16c8,0x16cb,0x16cb,0x16b6,0x16b6,0x16c8,0x16bc, +0x16b9,0x16bf,0x16d1,0x16d1,0x16c2,0x16c2,0x16c5,0x16c5,0x16c5,0x16d1,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785, +0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1782,0x1782,0x1782,0x1782,0x177f,0x177f,0x201,0x201, +0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201, +0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201, +0x204,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4, +0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204, +0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x207,0x207,0x207,0x207, +0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, +0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, +0x16d7,0x16d7,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, +0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, +0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x207,0x207,0x1aeb,0x1aeb,0x207,0x207, +0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207, +0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207, +0x16da,0x16e9,0x16e0,0x16dd,0x16ef,0x16ef,0x16e3,0x16ef,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a, +0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a, +0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2, +0x16f2,0x16f2,0x16f2,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x16fb, +0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797, +0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x198f,0x210,0x210,0x1788,0x1788,0x1788, +0x1794,0x1794,0x1788,0x1788,0x1788,0x1788,0x1794,0x1788,0x1788,0x1788,0x1788,0x178b,0x210,0x210,0x210,0x210, +0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x178e,0x178e,0x179a,0x179a,0x179a,0x178e, +0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213, +0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213, +0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af, +0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x219,0x17af,0x17af,0x219,0x219, +0x219,0x219,0x219,0x17ac,0x17ac,0x17ac,0x17ac,0x17ac,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x21c, +0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2, +0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2, +0x17b2,0x17b5,0x21c,0x21c,0x21c,0x21c,0x21c,0x21c,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614, +0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be, +0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x21f,0x21f,0x21f,0x21f,0x21f, +0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb, +0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x21f,0x21f,0x21f,0x21f,0x21f, +0x21f,0x21f,0x17b8,0x17b8,0x17b8,0x17b8,0x17b8,0x17b8,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929, +0x1929,0x1929,0x1929,0x1929,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a94,0x1b3c,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1b3f, +0x1b3c,0x222,0x1a0a,0x1a94,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x17df,0x1a0a,0x1a0a,0x1a94,0x1a94,0x1a94,0x1a94,0x1a94, +0x1a94,0x1a94,0x1a94,0x1b3c,0x222,0x1a97,0x1a97,0x1a97,0x1929,0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,0x192c, +0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,0x1929,0x1929,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,0x17c4,0x17c4,0x17c7, +0x17ca,0x17c7,0x17c7,0x17c4,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225, +0x225,0x225,0x225,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x1821,0x1821,0x1821,0x1821,0x1818,0x1818,0x1818,0x1812, +0x1815,0x1815,0x1815,0x1a40,0x228,0x228,0x228,0x228,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e, +0x181e,0x181e,0x228,0x228,0x228,0x228,0x181b,0x181b,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c, +0x183c,0x22b,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c, +0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x1839,0x1827,0x1827,0x1827,0x1827, +0x1827,0x1827,0x1827,0x22b,0x1827,0x1827,0x1827,0x1827,0x1827,0x1827,0x1839,0x182a,0x183c,0x183f,0x183f,0x1833, +0x1830,0x1830,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x1836,0x1836,0x1836,0x1836, +0x1836,0x1836,0x1836,0x1836,0x1836,0x1836,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d, +0x182d,0x182d,0x182d,0x182d,0x182d,0x22b,0x22b,0x22b,0x184b,0x184e,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854, +0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842, +0x1842,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad, +0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x231, +0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845, +0x1845,0x231,0x231,0x1845,0x1845,0x1845,0x1845,0x1845,0x1893,0x192f,0x1a9a,0x1a9d,0x1b45,0x234,0x234,0x234, +0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x1b42,0x1b42,0x234,0x234,0x234,0x234,0x234,0x234, +0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854, +0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x237,0x237,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848, +0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x237,0x1851,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848, +0x1848,0x1851,0x1848,0x1848,0x1851,0x1848,0x1848,0x237,0x237,0x237,0x237,0x237,0x237,0x237,0x237,0x237, +0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x23a,0x23a,0x23a, +0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a, +0x186f,0x186f,0x1860,0x185a,0x185a,0x186f,0x185d,0x1872,0x1872,0x1872,0x1872,0x1875,0x1875,0x1869,0x1866,0x1863, +0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x1aee,0x1869,0x23d,0x1863,0x1992,0x1a43, +0x1af1,0x1af1,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d, +0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d, +0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b, +0x187b,0x187b,0x187b,0x187b,0x240,0x240,0x240,0x240,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878, +0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878, +0x1878,0x1878,0x1878,0x1878,0x240,0x240,0x240,0x240,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896, +0x1896,0x1896,0x1896,0x1896,0x1896,0x1a13,0x1a13,0x1a13,0x1a13,0x1a13,0x1aa0,0x1aa0,0x1aa0,0x1aa0,0x1aa0,0x1aa0, +0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935, +0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935, +0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246, +0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288, +0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x249, +0x18d5,0x18d5,0x249,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5, +0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x249, +0x249,0x249,0x18c9,0x249,0x18c9,0x18c9,0x249,0x18c9,0x18c9,0x18c9,0x18cc,0x18c9,0x18cf,0x18cf,0x18d8,0x18c9, +0x249,0x249,0x249,0x249,0x249,0x249,0x249,0x249,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2, +0x18d2,0x18d2,0x249,0x249,0x249,0x249,0x249,0x249,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938, +0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938, +0x1938,0x1938,0x1938,0x1938,0x24c,0x24c,0x24c,0x24c,0x1905,0x1908,0x1917,0x1917,0x1908,0x190b,0x1905,0x1902, +0x255,0x255,0x255,0x255,0x255,0x255,0x255,0x255,0x18f0,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18ed, +0x18ed,0x18db,0x18db,0x18db,0x18f0,0x18f0,0x18f0,0x18f0,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49, +0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x258,0x258,0x258,0x258, +0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998, +0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x258,0x258,0x1aa9,0x1aa9,0x1aa9,0x1aa9,0x1b4b,0x28b,0x28b,0x28b, +0x1aa9,0x1aa9,0x1aa9,0x28b,0x28b,0x28b,0x28b,0x28b,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa, +0x19aa,0x19aa,0x19aa,0x19aa,0x19a7,0x19a7,0x19a7,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b, +0x19a7,0x19a1,0x199e,0x19a4,0x25b,0x25b,0x25b,0x25b,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad, +0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad, +0x19ad,0x19ad,0x19ad,0x25e,0x25e,0x19ad,0x19ad,0x19ad,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x261,0x19bc, +0x19bc,0x261,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc, +0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19b9,0x19b9,0x19b9,0x19b9,0x19b9,0x261, +0x19b0,0x19b0,0x261,0x19b9,0x19b9,0x19b0,0x19b9,0x19b3,0x19bc,0x261,0x261,0x261,0x261,0x261,0x261,0x261, +0x19c5,0x19c5,0x19c8,0x19c8,0x19bf,0x19bf,0x19bf,0x19bf,0x264,0x264,0x264,0x264,0x264,0x264,0x264,0x264, +0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x264,0x264,0x264,0x264,0x264,0x264, +0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19ce,0x19cb,0x19cb,0x19cb, +0x19ce,0x19cb,0x19cb,0x19cb,0x19cb,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267, +0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7, +0x19d7,0x19d7,0x19d7,0x19d1,0x19d1,0x19d4,0x19d4,0x19da,0x19da,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a, +0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd, +0x19dd,0x19dd,0x19dd,0x19dd,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d, +0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0, +0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e3,0x19ec,0x19e0,0x19e0,0x270,0x270,0x270,0x270,0x270, +0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19f2,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273, +0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb, +0x19fb,0x19fb,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f8,0x19f8,0x19f8, +0x19f8,0x19fe,0x19fe,0x19fe,0x19fe,0x19fe,0x276,0x276,0x276,0x276,0x276,0x276,0x1a55,0x1a55,0x1a55,0x1a55, +0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55, +0x1a55,0x1a55,0x1a55,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x1a64,0x1a64,0x1a64,0x1a64, +0x1a64,0x1a64,0x1a64,0x1a64,0x27f,0x27f,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64, +0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a61,0x1a61,0x1a61, +0x1a58,0x1a58,0x1a58,0x1a58,0x27f,0x27f,0x1a58,0x1a58,0x1a61,0x1a61,0x1a61,0x1a61,0x1a5b,0x1a64,0x1a5e,0x1a64, +0x1a61,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f, +0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x1a70,0x1a70,0x1a70,0x1a70, +0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x282,0x282,0x282,0x1a67,0x1a67,0x1a67,0x1a67, +0x1a67,0x1a67,0x1a67,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a73,0x1a73,0x282,0x282,0x285,0x1a76,0x1a76,0x1a76, +0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76, +0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x285,0x285, +0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288, +0x1aa3,0x1aa3,0x1aa3,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288, +0x1aa6,0x1aa6,0x1aa6,0x1aa6,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x1938,0x1938,0x1938,0x1938, +0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1aa9,0x1aa9,0x1aa9,0x1b4b, +0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1aa9,0x1aa9,0x1aa9,0x1aa9, +0x1aa9,0x1aa9,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b, +0x28b,0x28b,0x28b,0x28b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,0x28b,0x28b, +0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b, +0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b, +0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b, +0x1a7f,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79, +0x1a79,0x1a79,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x1a7c, +0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a82,0x1a82,0x1a82,0x1a82, +0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x291,0x291,0x291,0x291,0x291,0x1a85, +0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x294,0x294,0x294,0x294, +0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294, +0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x297,0x297,0x1b12,0x297,0x297,0x1b12,0x1b12,0x1b12,0x1b12, +0x1b12,0x1b12,0x1b12,0x1b12,0x297,0x1b12,0x1b12,0x297,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12, +0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1afa,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x297,0x1b09, +0x1b0c,0x297,0x297,0x1afa,0x1afa,0x1b0f,0x1b00,0x1b15,0x1b09,0x1b15,0x1b09,0x1afd,0x1b18,0x1b03,0x1b18,0x297, +0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06, +0x1b06,0x1b06,0x297,0x297,0x297,0x297,0x297,0x297,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51, +0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x29a,0x29a, +0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a, +0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a, +0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e, +0x1b1e,0x1b1e,0x1b1e,0x2a0,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e, +0x1b1e,0x1b1e,0x1b1e,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0, +0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21, +0x1b21,0x1b21,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54, +0x1b54,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3, +0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3, +0x2a3,0x2a3,0x2a3,0x2a3,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x2a6,0x1b24, +0x1b24,0x1b27,0x2a6,0x2a6,0x1b2a,0x1b2a,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6, +0x2a6,0x2a6,0x2a6,0x2a6,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, +0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, +0x2a9,0x2a9,0x2a9,0x2a9,0x1932,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1, +0x2c1,0x2c1,0x2c1,0x2c1,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, +0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, +0x2a9,0x2a9,0x97b,0x97b,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x2c4, +0x2c4,0x2c4,0x2c4,0x2c4,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, +0x2a9,0x2a9,0x2a9,0x2a9,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x1a04, +0x1a04,0x1a04,0x1a04,0x1a04,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33, +0x1b33,0x2ac,0x2ac,0x2ac,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0x12e4, +0x12e4,0x12e4,0x2af,0x2af,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0, +0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0x2af,0x2af, +0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af, +0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af, +0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9, +0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x2b2,0x2b2, +0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac, +0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0x2b5,0x2b5, +0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9, +0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8, +0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416, +0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x2bb,0x2bb, +0x17dc,0x17dc,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be, +0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932, +0x3cc,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3cc,0x3cc,0x3cc,0x3cc,0x3c6,0x1158,0x133e, +0x3cf,0x945,0x948,0x3bd,0x3bd,0x1155,0x133b,0x133b,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2, +0x1155,0x3c0,0x3c0,0x3cc,0xce1,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf, +0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf, +0x3cf,0x3cf,0x3c0,0x3c0,0x8d0,0x8d3,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963, +0x3c9,0xfba,0xfb7,0x1341,0x1341,0x1341,0x1341,0x1341,0x1506,0x115b,0x115b,0xf0c,0xf0c,0xdda,0xf0c,0xf0c, +0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3d2,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf, +0x3cf,0x3d2,0x3cf,0x3cf,0x3d2,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x133b,0x133e,0x3c3,0x3cf,0x3cc,0x3cc, +0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x1347,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e, +0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x1347,0x18ae,0x18ae,0xfd8,0x45f,0x468, +0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa, +0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0xbc7,0xbc7,0xde6,0xde6,0x8d6,0xde9,0x1428,0x1428,0x1428, +0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad, +0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad, +0x4b3,0x4b3,0x4b3,0x1170,0x1170,0x1170,0x1170,0x1170,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0, +0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0, +0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x116d,0x116d,0x116d,0x116d,0x116d,0x116d, +0x4b6,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3, +0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3, +0x4b3,0x4b3,0x4b3,0x4b3,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9, +0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9, +0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4b9,0x4b9,0x4b9,0x4b9,0x4bc,0x9bd,0x1005,0x1005,0x1008,0x1005, +0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9, +0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x1008,0x1005,0x1008,0x1005,0x1008,0x1005, +0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce, +0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce, +0x6ae,0x6ae,0x6b1,0x4e9,0x6bd,0x6ba,0x6ba,0x6b7,0x513,0x513,0x4d1,0x4d1,0x4d1,0x4d1,0x4d1,0xb58, +0x6c0,0x4f5,0x6d8,0x6db,0x50a,0x6c0,0x4f8,0x4f8,0x4e9,0x504,0x504,0x6ae,0x510,0x50d,0x6b4,0x4e3, +0x4da,0x4da,0x4dd,0x4dd,0x4dd,0x4dd,0x4dd,0x4e0,0x4dd,0x4dd,0x4dd,0x4d4,0x51c,0x519,0x516,0x516, +0x6cc,0x4fe,0x4fb,0x6c9,0x6c6,0x6c3,0x6d5,0x4ec,0x6d2,0x6d2,0x501,0x504,0x6cf,0x6cf,0x501,0x504, +0x4e6,0x4e9,0x4e9,0x4e9,0x507,0x4f2,0x4ef,0xbdc,0xaf2,0xaf5,0xaef,0xaef,0xaef,0xaef,0xbd3,0xbd3, +0xbd3,0xbd3,0xbd9,0xd0e,0xd0b,0xdf5,0xdf8,0xbd6,0xdf8,0xdf8,0xdf8,0xdf8,0xdf5,0xdf8,0xdf8,0xbd0, +0x540,0x540,0x540,0x540,0x540,0x540,0x540,0x53d,0x543,0x75c,0x540,0x9c0,0x9e1,0xaf8,0xaf8,0xaf8, +0xbe2,0xbe2,0xdfe,0xdfe,0xdfe,0xdfe,0x1179,0x117c,0x117c,0x135c,0x14f4,0x151e,0x1521,0x1521,0x1734,0x18b1, +0x54f,0x54f,0x567,0x6ea,0x54c,0x6e7,0x54f,0x564,0x54c,0x6ea,0x55e,0x567,0x567,0x567,0x55e,0x55e, +0x567,0x567,0x567,0x6f3,0x54c,0x567,0x6ed,0x54c,0x55b,0x567,0x567,0x567,0x567,0x567,0x54c,0x54c, +0x552,0x6e7,0x6f0,0x54c,0x567,0x54c,0x6f6,0x54c,0x567,0x555,0x56d,0x6f9,0x567,0x567,0x558,0x55e, +0x567,0x567,0x56a,0x567,0x55e,0x561,0x561,0x561,0x561,0xb04,0xb01,0xd11,0xe07,0xbf7,0xbfa,0xbfa, +0xbf4,0xbf1,0xbf1,0xbf1,0xbf1,0xbfa,0xbf7,0xbf7,0xbf7,0xbf7,0xbee,0xbf1,0xe04,0xf18,0xf1b,0x100e, +0x117f,0x117f,0x117f,0x6ff,0x6fc,0x570,0x573,0x573,0x573,0x573,0x573,0x6fc,0x6ff,0x6ff,0x6fc,0x573, +0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x57c,0x57c,0x57c,0x57c, +0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x576,0x576,0x576,0x576,0x576,0x576, +0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x57f,0x588,0x588,0x582,0x582,0x582,0x585,0x57f, +0x582,0x582,0x57f,0x57f,0x57f,0x57f,0x582,0x582,0x708,0x708,0x57f,0x57f,0x582,0x582,0x582,0x582, +0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x585,0x585,0x585,0x582,0x582,0x70b,0x582, +0x70b,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x57f,0x582,0x57f,0x57f,0x57f,0x57f,0x57f,0x57f, +0x582,0x582,0x57f,0x708,0x57f,0x57f,0x57f,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a, +0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0x711,0x58b,0x711,0x711, +0x58e,0x58b,0x58b,0x711,0x711,0x58e,0x58b,0x711,0x58e,0x58b,0x58b,0x711,0x58b,0x711,0x59a,0x597, +0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x711,0x711,0x711,0x711,0x58b,0x58b,0x711, +0x58e,0x711,0x58e,0x711,0x711,0x711,0x711,0x711,0x717,0x591,0x711,0x591,0x591,0x58b,0x58b,0x58b, +0x711,0x711,0x711,0x711,0x58b,0x58b,0x58b,0x58b,0x711,0x711,0x58b,0x58b,0x58b,0x58e,0x58b,0x58b, +0x58e,0x58b,0x58b,0x58e,0x711,0x58e,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b, +0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x714,0x711,0x58e,0x58b, +0x711,0x711,0x711,0x711,0x58b,0x58b,0x711,0x711,0x58b,0x58e,0x714,0x714,0x58e,0x58e,0x58b,0x58b, +0x58e,0x58e,0x58b,0x58b,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x711,0x711, +0x58e,0x58e,0x711,0x711,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b, +0x58b,0x711,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b, +0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b, +0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b, +0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b, +0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b, +0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x594,0x58b,0x58b,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00, +0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0x59d,0xb0d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d, +0x5a9,0x5a6,0x5a9,0x5a6,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x71a,0x59d,0x59d,0x59d,0x59d,0x59d, +0x59d,0x59d,0x81f,0x81f,0x59d,0x59d,0x59d,0x59d,0x5a3,0x5a3,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d, +0x5a0,0x825,0x822,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d, +0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d, +0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0xb0d,0xc06,0xb0d,0xb0d,0xb0d,0x5ac,0x5ac,0x5ac,0x5ac, +0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac, +0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x723,0x723,0x723,0x723, +0x723,0x723,0x723,0x723,0x723,0x723,0x5b2,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f, +0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xd89,0x72c,0x72c,0x72c,0x72c, +0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c, +0x5b5,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x72c,0x72c,0x72c,0x72c, +0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x5b8,0x5b8,0x5b8,0x5b8,0x72c,0x72c,0x72c,0x72c, +0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72f,0x72f,0x72f,0x72f, +0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x5bb,0x5bb,0x72f,0x72f, +0x72f,0x72f,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0x735,0x735,0x5be,0x732, +0x732,0x732,0x732,0x732,0x732,0x732,0x5c1,0x5c1,0x5be,0x5be,0x5c4,0x5c4,0x5c4,0x5c4,0x735,0x735, +0x5c4,0x5c4,0x738,0x735,0x5be,0x5be,0x5be,0x5be,0x735,0x735,0x5c4,0x5c4,0x738,0x735,0x5be,0x5be, +0x5be,0x5be,0x735,0x735,0x732,0x5be,0x5c4,0x735,0x5be,0x5be,0x732,0x735,0x735,0x735,0x5c4,0x5c4, +0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x735,0x732, +0x735,0x732,0x5be,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5be,0x5be,0x732,0xb16,0xb16,0xb16,0xb16, +0xb16,0xb16,0xb16,0xb16,0xc0c,0xc0c,0xc0c,0xc0f,0xc0f,0xc8a,0xc8a,0xc0c,0x5d3,0x5d3,0x5d3,0x5d3, +0x5d0,0x74a,0x747,0x5ca,0x5ca,0x73b,0x5ca,0x5ca,0x5ca,0x5ca,0x741,0x73b,0x5ca,0x5d0,0x5ca,0x5c7, +0xd92,0xd92,0xc15,0xc15,0xe13,0xb19,0x5cd,0x5cd,0x73e,0x5d6,0x73e,0x5cd,0x5d0,0x5ca,0x5d0,0x5d0, +0x5ca,0x5ca,0x5d0,0x5ca,0x5ca,0x5ca,0x5d0,0x5ca,0x5ca,0x5ca,0x5d0,0x5d0,0x5ca,0x5ca,0x5ca,0x5ca, +0x5ca,0x5ca,0x5ca,0x5ca,0x5d0,0x5d3,0x5d3,0x5cd,0x5ca,0x5ca,0x5ca,0x5ca,0x74d,0x5ca,0x74d,0x5ca, +0x5ca,0x5ca,0x5ca,0x5ca,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828, +0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5d0,0x74d,0x74a,0x5d9,0x74d, +0x73b,0x741,0x5d0,0x73b,0x744,0x73b,0x73b,0x5ca,0x73b,0x74a,0x5d9,0x74a,0xb19,0xb19,0xc18,0xc18, +0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc1b,0xc18,0xc18,0xe10,0xec7,0x5dc,0x5dc,0x5dc,0x5dc, +0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc, +0x5df,0x13e6,0x13e6,0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x152a,0x5eb,0x5f4,0x5eb, +0x5eb,0x13e6,0x5df,0x5df,0x5f4,0x5f4,0x13e9,0x13e9,0x5f7,0x5f7,0x5e8,0x5ee,0x5e8,0x5e8,0x5ee,0x5df, +0x5ee,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df, +0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5ee,0x5df,0x5df,0x5df, +0x5df,0x5df,0x5df,0x5df,0x5df,0x753,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5df,0x5df,0x5ee, +0x5df,0x5df,0x5df,0x5df,0x13e6,0x5df,0x13e6,0x5df,0x5df,0x5df,0x5df,0x13e6,0x13e6,0x13e6,0x5df,0x12de, +0x5df,0x5df,0x5df,0x5e5,0x5e5,0x5e5,0x5e5,0x1368,0x1368,0x5df,0x5e2,0x5f1,0x5f4,0x5e8,0x5e8,0x5e8, +0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0x750,0x750, +0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df, +0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df, +0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x13e6,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, +0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x621,0x621,0x621,0x621, +0x621,0x621,0x621,0x621,0x618,0x61e,0x60f,0x612,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, +0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, +0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x615,0x615,0x615,0x615,0x615,0x615,0x618,0x618,0x618,0x618, +0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, +0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618, +0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618, +0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618, +0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618, +0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618, +0x61b,0x621,0x61e,0x618,0x61e,0x618,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b, +0x136b,0x136b,0x136b,0x136b,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61b,0x621,0x61e,0x618, +0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61b,0x61e,0x618,0x61b, +0x61e,0x618,0x61b,0x621,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, +0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b, +0x61b,0x61b,0x61b,0x61b,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, +0x61e,0x61e,0x61e,0x61e,0x61e,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, +0x618,0x618,0x618,0x618,0x61b,0x61b,0x618,0x61b,0x618,0x61b,0x618,0x618,0x61b,0x618,0x618,0x61b, +0x618,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x61b,0x618,0x618,0x618,0x61b,0x618,0x618,0x618,0x618, +0x618,0x61b,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, +0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x618, +0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b, +0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b, +0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x621,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, +0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, +0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621, +0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x61e,0x61e,0x61e, +0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x624,0x624,0x624,0x624,0x101a,0x101a,0x101a,0x152d, +0x152d,0x152d,0x152d,0x152d,0x152d,0x152d,0x173a,0x173a,0x885,0x88b,0x88b,0x897,0x897,0x888,0x87f,0x888, +0x87f,0x888,0x87f,0x888,0x87f,0x888,0x87f,0x888,0x633,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633, +0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x630, +0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633, +0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630, +0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630, +0x636,0x633,0x62d,0x630,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720, +0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d, +0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d, +0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x726,0x726,0x726,0x726,0x726,0x726, +0x726,0x726,0x726,0x726,0x726,0x726,0x729,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726, +0x726,0x726,0x726,0x726,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723, +0x723,0x723,0x723,0x723,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c, +0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c, +0x72c,0x72c,0x72c,0x72c,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756, +0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756, +0x756,0x756,0x756,0x756,0xc78,0x8e8,0x8e2,0x8df,0x8e5,0x8dc,0x76b,0x76e,0x76e,0x76e,0x76e,0x76e, +0x76e,0x76e,0x76e,0x76e,0x8ee,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b, +0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b, +0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x8eb,0x8eb,0x771,0x8fd,0x900,0x906,0x82b,0x837,0x91b,0x834, +0x8f4,0x8f1,0x8f4,0x8f1,0x8fa,0x8f7,0x8fa,0x8f7,0x8f4,0x8f1,0x831,0x906,0x8f4,0x8f1,0x8f4,0x8f1, +0x8f4,0x8f1,0x8f4,0x8f1,0x909,0x912,0x90f,0x90f,0x777,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7ad, +0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad, +0x7ad,0x7ad,0x7ad,0x77a,0x795,0x774,0x79b,0x79e,0x798,0x7b0,0x7b0,0x7b0,0x7b0,0x7b0,0x7b0,0x7aa, +0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa, +0x7aa,0x7aa,0x7aa,0x77a,0x795,0x774,0x795,0xc7b,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819, +0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819, +0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x12d8,0x12d8,0x12d8,0x12d8,0x12d8,0x81c, +0x831,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x951,0x951,0x951,0x951,0x83a,0x83a, +0x90c,0x918,0x918,0x918,0x918,0x915,0x82e,0x903,0xb3d,0xb3d,0xb3d,0xc8d,0xcab,0xca8,0xb5b,0x8d9, +0x840,0x83d,0x840,0x843,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d, +0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x83d, +0xcae,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x84c,0x84f,0x84c,0x84f,0x84c, +0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c, +0x84f,0x84c,0x84f,0x852,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c, +0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84c, +0x84c,0x84c,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x852,0x84c, +0x84c,0x84c,0x84c,0x84c,0x84f,0x852,0x852,0x84f,0x84f,0x84f,0x84f,0x921,0x924,0x855,0x858,0xc96, +0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e, +0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e, +0x861,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e, +0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x86a,0x86a,0x86a,0x86a, +0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a, +0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0xd9b,0xd9b,0xeca,0x864,0x92d,0x92d,0x92d,0x92d, +0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0xd95,0xd95,0xd95,0xd95,0x86d,0x86d,0x86d,0x86d, +0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d, +0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x1ab2,0x936,0x936,0x936,0x936, +0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x870,0x870,0x870, +0x870,0x870,0x870,0xd9e,0xd9e,0xd9e,0xd9e,0x939,0x939,0x939,0x939,0x939,0x870,0x870,0x870,0x870, +0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870, +0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0xd9e,0xd9e, +0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873, +0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873, +0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876, +0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876, +0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd, +0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd, +0x113d,0x113d,0x113d,0x113d,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879, +0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879, +0x879,0x879,0x879,0x879,0x879,0x879,0x87c,0x87c,0x879,0x87c,0x879,0x87c,0x87c,0x879,0x879,0x879, +0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x87c,0x879,0x87c,0x879,0x87c,0x87c,0x879,0x879,0x87c, +0x87c,0x87c,0x879,0x879,0x879,0x879,0x14e5,0x14e5,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f, +0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d, +0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d, +0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x131d,0x131d,0x131d,0x131d,0x12bd,0x12bd,0x12bd,0x12bd, +0x12bd,0x12bd,0x12bd,0x12bd,0xd95,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99, +0xc99,0xc99,0xc99,0xc99,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930, +0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x933,0x930,0x933,0x930,0x930, +0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930, +0x930,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99, +0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936, +0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0xd9e, +0x9b7,0x999,0x999,0x999,0x999,0x993,0x999,0x999,0x9ab,0x999,0x999,0x996,0x9a2,0x9a8,0x9a8,0x9a8, +0x9a8,0x9a8,0x9ab,0x993,0x99f,0x993,0x993,0x993,0x98a,0x98a,0x993,0x993,0x993,0x993,0x993,0x993, +0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x993,0x993,0x993,0x993,0x993,0x993, +0x993,0x993,0x993,0x993,0x996,0x98a,0x993,0x98a,0x993,0x98a,0x9a5,0x99c,0x9a5,0x99c,0x9b4,0x9b4, +0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3, +0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3, +0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6, +0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6, +0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9, +0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9, +0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2, +0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9cc,0x9cc, +0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5, +0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9cf,0x9cf, +0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2, +0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2, +0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5, +0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5, +0x9d8,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db, +0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9d8,0x9db,0x9db,0x9db, +0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db, +0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0xa68,0xa68,0xfff,0xa68,0xa68,0xa68,0xa6b,0xa68, +0xfff,0xa68,0xa68,0xff6,0xa62,0xa56,0xa56,0xa56,0xa56,0xa65,0xa56,0xfe7,0xfe7,0xfe7,0xa56,0xa59, +0xa62,0xa5c,0xfed,0xff9,0xff9,0xfe7,0xfe7,0xfff,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61, +0xb61,0xb61,0xa6e,0xa6e,0xa5f,0xa5f,0xa5f,0xa5f,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa65,0xa65, +0xa56,0xa56,0xfff,0xfff,0xfff,0xfff,0xfe7,0xfe7,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68, +0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68, +0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2, +0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, +0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, +0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, +0xa7d,0xa7d,0xa7d,0xa7d,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83, +0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83, +0xa83,0xa83,0xa83,0xa83,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89, +0xa89,0xa86,0xa8c,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0x1176,0x1176,0x1176,0x1176,0x1176, +0x1176,0x1176,0x1176,0x1176,0x1173,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89, +0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89, +0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e, +0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e, +0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xac2,0xac2,0xac2,0xac5,0xac5,0xac2,0xac2,0xac2, +0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xaaa,0xaaa,0xabf,0xaa1, +0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xabf,0xabf,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2, +0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2, +0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xae3,0xae3,0xae3,0xae3,0xae3,0xace,0xace,0xae3, +0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, +0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, +0xae3,0xae3,0xae3,0xae6,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, +0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, +0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb10,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d, +0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xc06,0xc06,0xc06,0xc06,0xc06, +0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c, +0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c, +0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, +0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, +0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34, +0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34, +0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40, +0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0x13ec,0x13ec,0x13ec,0x1b2d,0x1b2d,0x1b2d,0x1b2d,0x1b2d, +0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43, +0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43, +0xb43,0xb43,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0xb46,0xb46,0xb46,0xb46, +0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46, +0xb46,0xb49,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46, +0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46, +0xb46,0xb46,0xb46,0xb46,0xb4c,0xb4c,0xc9c,0xc9c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c, +0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xc9c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c, +0xb4c,0xb4c,0xb4c,0xb4c,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70, +0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70, +0xb70,0xb70,0xb70,0x1530,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xd26,0xd26,0xb76,0xb76,0xb76,0xb76, +0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76, +0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xd23,0xd23,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74, +0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79, +0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79, +0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb82,0xb8e,0xb94, +0xb94,0xb94,0xb88,0xb88,0xb88,0xb91,0xb85,0xb85,0xb85,0xb85,0xb85,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f, +0xb7f,0xb7f,0xb7f,0xb94,0xb94,0xb94,0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, +0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, +0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb8b,0xb8b,0xb94,0xb94,0xb94,0xb88, +0xb88,0xb94,0xb94,0xb94,0xb94,0xb94,0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, +0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb94,0xb94, +0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb8b, +0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, +0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, +0xb88,0xb88,0x173d,0x173d,0xba0,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb97, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb97, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, +0xba0,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a, +0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a, +0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, +0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, +0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0, +0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3, +0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3, +0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9, +0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9, +0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac, +0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac, +0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06, +0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc03,0xc06,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03, +0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xd14,0xd17,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a, +0xe0a,0xe0a,0xe0a,0xe0a,0xf24,0xf24,0xf24,0xf24,0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc12,0xc12, +0xc12,0xc12,0xd1a,0xd1a,0xd1a,0xd1a,0xd1a,0xd1a,0xd1d,0xd1d,0xe10,0xec4,0xe10,0xe10,0xe10,0xe10, +0xe0d,0xe10,0xe0d,0xe10,0xe10,0x1014,0x12ae,0x12ae,0xe19,0xe19,0xe19,0xe19,0xe19,0xe1f,0xe1c,0xf36, +0xf36,0xf36,0xf36,0x142e,0x1026,0x142e,0x1374,0x1374,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e, +0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc81,0xc7e,0xc81,0xc7e,0xc81,0xc7e, +0x1137,0x1134,0x102c,0x1029,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51, +0xc51,0xc51,0xc51,0xc51,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54, +0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54, +0xc54,0xc54,0xc54,0xc54,0xc57,0xc57,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54, +0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc87,0xc84,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60, +0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a, +0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a, +0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc60,0xc5d, +0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a, +0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc5a,0xc5a, +0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc69,0xc63,0xc63,0xc63, +0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63, +0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63, +0xc69,0xc69,0xc69,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63, +0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63, +0xc66,0xc63,0xc63,0xc63,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f, +0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f, +0xc9f,0xc9f,0xc9f,0xc9f,0xd20,0xd8f,0xe0d,0xe0d,0xe0d,0xe0d,0xe0d,0xe10,0xe0d,0xe0d,0xec4,0xec4, +0xe0d,0xe0d,0xe0d,0xe0d,0xe10,0xe10,0xf27,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014, +0x1014,0x12db,0x12db,0x12b1,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44, +0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44, +0xd44,0xd44,0xd44,0xd44,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd4a,0xd4a,0xd4a,0xd4a,0xd4a,0xd47, +0xd5c,0xd5c,0xd5c,0xd56,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd56, +0xd5c,0xd5c,0xd5c,0xd5c,0xd50,0xd50,0xd59,0xd59,0xd59,0xd59,0xd4d,0xd4d,0xd4d,0xd4d,0xd4d,0xd53, +0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe22,0xe25,0xe25,0xe25, +0xe25,0xe25,0xe25,0xe25,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c, +0xd5c,0xd5c,0xd56,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c, +0xd5c,0xd50,0xd50,0xd50,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53, +0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53, +0xd53,0xd53,0xd53,0xd53,0xd5f,0xd5f,0xd5f,0xd5f,0xd5f,0xd62,0xd62,0xd62,0xd5f,0xd5f,0xd5f,0xd5f, +0xd5f,0xd5f,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xf39,0xf39,0xf39,0xf39,0xf39,0xf39,0xf39,0x1140, +0x1140,0x102f,0x102f,0x102f,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65, +0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65, +0xd65,0xd65,0xd65,0xd65,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b, +0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b, +0xd6b,0xd6b,0xd6b,0xd6b,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74, +0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74, +0xd74,0xd74,0xd74,0xd74,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80, +0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80, +0xd80,0xd80,0xd80,0xd80,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c, +0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c, +0xd8c,0xd8c,0xd8c,0xd8c,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e, +0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e, +0xe2e,0xe2e,0xe2e,0xe2e,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34, +0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31, +0xe31,0xe31,0xe31,0xe31,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34, +0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34, +0xe34,0xe34,0xe34,0xe34,0xef4,0xef4,0xe46,0xe46,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0x103b, +0x103b,0x103b,0x103b,0x103b,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038, +0x1038,0x1038,0x1038,0x1038,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52, +0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52, +0xe55,0xe52,0xe55,0xe52,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61, +0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61, +0xe61,0xe61,0xe61,0xe61,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67, +0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67, +0xe67,0xe67,0xe67,0xe67,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xe7f,0xe7f,0xe7f,0xe7f, +0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xf3f,0xf3f,0xf3f,0xf3f,0x103e, +0x103e,0x103e,0x103e,0x103e,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88, +0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88, +0xe88,0xe88,0xe88,0xe88,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91, +0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91, +0xe91,0xe91,0xe91,0xe91,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a, +0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a, +0xe9a,0xe9a,0xe9a,0xe94,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97, +0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe9a, +0xe9a,0xe9a,0xe9a,0xe9a,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3, +0xea3,0xea3,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xe9d,0xea6,0x104a,0x1044,0x1053,0x1041, +0xea3,0xea3,0x1041,0x1041,0xeb5,0xeb5,0xea9,0xeb5,0xeb5,0xeb5,0xeac,0xeb5,0xeb5,0xeb5,0xeb5,0xea9, +0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5, +0xeb5,0xeb5,0xeb5,0xeb5,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8, +0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8, +0xeb8,0xeb8,0xeb8,0xeb8,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0, +0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0, +0xed0,0xed0,0xed0,0xed0,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1, +0xef1,0xef1,0xef1,0xef1,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149, +0x1149,0x1149,0x1149,0x1149,0xf24,0xf24,0xf24,0xf21,0xf21,0xf21,0xf21,0xf21,0x1182,0x13dd,0x13dd,0x13dd, +0x13dd,0x135f,0x135f,0x135f,0x13e0,0x1362,0x1362,0x13e0,0x1524,0x1524,0x1524,0x1524,0x1527,0x1527,0x1527,0x17ee, +0x17ee,0x17ee,0x17ee,0x18b4,0xf39,0xf39,0xf39,0xf39,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f, +0x102f,0x102f,0x102f,0x102f,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032, +0x1032,0x1032,0x1032,0x1032,0xf5a,0xf5a,0xf5a,0xf5a,0xf6c,0xf75,0xf78,0xf75,0xf78,0xf75,0xf78,0xf75, +0xf78,0xf75,0xf78,0xf75,0xf75,0xf75,0xf78,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75, +0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf5d,0xf5a,0xf5a,0xf5a, +0xf5a,0xf5a,0xf5a,0xf6f,0xf5a,0xf6f,0xf6c,0xf6c,0xf81,0xf7e,0xf81,0xf81,0xf81,0xf7e,0xf7e,0xf81, +0xf7e,0xf81,0xf7e,0xf81,0xf7e,0x1065,0x1065,0x1065,0x11a0,0x105c,0x1065,0x105c,0xf7e,0xf81,0xf7e,0xf7e, +0x105c,0x105c,0x105c,0x105c,0x105f,0x1062,0x11a0,0x11a0,0xf84,0xf84,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e, +0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x106e,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e, +0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a, +0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a, +0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99, +0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99, +0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0x1563,0x1563,0x1563,0x1563,0x1563, +0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0xf9f,0xf9f,0xf9f,0xf9f, +0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f, +0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xfe7,0xfff,0xff6,0xffc, +0xffc,0xfff,0xfff,0xff6,0xff6,0xffc,0xffc,0xffc,0xffc,0xffc,0xfff,0xfff,0xfff,0xfe7,0xfe7,0xfe7, +0xfe7,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfe7,0xff6, +0xff9,0xfe7,0xfe7,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xfea,0xfff,0xffc,0xff3,0xff3,0xff3,0xff3, +0xff3,0xff3,0xff3,0xff3,0xff3,0xff3,0x116a,0x116a,0x1167,0x1164,0xff0,0xff0,0x1017,0x1017,0x1017,0x1017, +0x12db,0x12db,0x12b1,0x12b1,0x12b7,0x12ae,0x12ae,0x12ae,0x12ae,0x12b1,0x13e3,0x12b7,0x12b1,0x12b7,0x12ae,0x12b7, +0x12db,0x12ae,0x12ae,0x12ae,0x12b1,0x12b1,0x12ae,0x12ae,0x12b1,0x12ae,0x12ae,0x12b1,0x1032,0x1032,0x1032,0x1032, +0x1032,0x102f,0x102f,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x153c,0x153c,0x153c,0x1140,0x102f,0x102f,0x102f, +0x102f,0x12e7,0x12c0,0x12c0,0x12c0,0x12c0,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x1050,0x1050,0x104d,0x1047, +0x104d,0x1047,0x104d,0x1047,0x104d,0x1047,0x1044,0x1044,0x1044,0x1044,0x1059,0x1056,0x1044,0x119d,0x143a,0x143d, +0x143d,0x143a,0x143a,0x143a,0x143a,0x143a,0x1440,0x1440,0x1557,0x154b,0x154b,0x1548,0x1077,0x106e,0x1077,0x106e, +0x1077,0x106e,0x1077,0x106e,0x106b,0x1068,0x1068,0x1077,0x106e,0x1383,0x1380,0x1746,0x1383,0x1380,0x1449,0x1446, +0x155a,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1077,0x106e,0x1077,0x106e, +0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e, +0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1071,0x106e,0x106e,0x106e, +0x106e,0x106e,0x106e,0x106e,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x1077,0x106e,0x107a,0x107a,0x1080,0x1086, +0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086, +0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1080,0x107a,0x107a, +0x107a,0x107a,0x1080,0x1080,0x107a,0x107a,0x1083,0x1452,0x144f,0x144f,0x1086,0x1086,0x107d,0x107d,0x107d,0x107d, +0x107d,0x107d,0x107d,0x107d,0x107d,0x107d,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x109b,0x109b,0x109b,0x109b, +0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b, +0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x10a4,0x10a4,0x10a4,0x10a4, +0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4, +0x10a4,0x10a4,0x10a4,0x10a4,0x10a7,0x10a7,0x10a7,0x10aa,0x10a7,0x10a7,0x10ad,0x10ad,0x10b0,0x10b0,0x10b0,0x10b0, +0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0, +0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b9,0x10b9,0x10b9,0x10b9, +0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10bc,0x10b3,0x10c2,0x10bf,0x10b9,0x10b9,0x10b9,0x10b9, +0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9, +0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x1389,0x1386,0x10d4,0x10ce, +0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d1,0x1152,0x10c5,0x10c5,0x10c5,0x10cb, +0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x10c8,0x10c8,0x10cb,0x10d7,0x10d4,0x10ce,0x10d4,0x10ce, +0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce, +0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x156f,0x156c,0x156f,0x156c, +0x1572,0x1572,0x174f,0x1458,0x10e0,0x10e0,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3, +0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3, +0x10e3,0x10e3,0x10e3,0x10e3,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0, +0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10ec,0x10ec,0x10ec,0x1146,0x10f5, +0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104, +0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2, +0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2, +0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113, +0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113, +0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125, +0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125, +0x112e,0x112e,0x112e,0x112e,0x1143,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e, +0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e, +0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131, +0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131, +0x113d,0x113d,0x113d,0x113d,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x14e2,0x17cd,0x17cd,0x17cd, +0x17cd,0x17cd,0x17cd,0x17cd,0x17cd,0x17cd,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d, +0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2, +0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11a9,0x11a9,0x11ac,0x11ac,0x11b2,0x11a9,0x11a9,0x11a9,0x11a9,0x11a9, +0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8, +0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8, +0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3, +0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3, +0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df, +0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11dc,0x11e2, +0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee, +0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee, +0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4, +0x11f4,0x132f,0x11fa,0x1332,0x11fa,0x11fa,0x11fa,0x11fa,0x11f7,0x11f7,0x11f7,0x11fa,0x1752,0x1755,0x197a,0x1977, +0x11fd,0x11fd,0x11fd,0x120c,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212, +0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212, +0x1212,0x1212,0x1212,0x1200,0x120c,0x120c,0x11fd,0x11fd,0x11fd,0x11fd,0x120c,0x120c,0x11fd,0x11fd,0x120c,0x120c, +0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e, +0x1221,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x1218,0x1218,0x1218,0x121e,0x121b,0x1578,0x157b,0x157e,0x157e, +0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230, +0x1224,0x1230,0x1224,0x1224,0x1224,0x1239,0x1239,0x1224,0x1224,0x1239,0x1230,0x1239,0x1239,0x1230,0x1224,0x1227, +0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230, +0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230, +0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b, +0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b, +0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263, +0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1260,0x1260,0x1260, +0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c, +0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c, +0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b, +0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b, +0x1281,0x1281,0x1290,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293, +0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1296,0x1293,0x1296,0x1293,0x1293,0x1293, +0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1296,0x1293,0x1293,0x1293,0x1293, +0x1290,0x1290,0x1290,0x1284,0x1284,0x1284,0x1284,0x1290,0x1290,0x128a,0x1287,0x128d,0x128d,0x129c,0x1299,0x1299, +0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f, +0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f, +0x12a5,0x12a5,0x12a5,0x12a2,0x12a2,0x12a2,0x129f,0x129f,0x129f,0x129f,0x12a2,0x129f,0x129f,0x129f,0x12a5,0x12a2, +0x12a5,0x12a2,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f, +0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x12a5,0x12a2,0x12a2, +0x129f,0x129f,0x129f,0x129f,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c9, +0x12c9,0x12c9,0x12a8,0x1980,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7, +0x13d7,0x12d2,0x13d7,0x12d2,0x12b1,0x12b1,0x1365,0x12ae,0x1365,0x1365,0x1365,0x1365,0x12ae,0x12b4,0x12db,0x12ae, +0x12ae,0x12ae,0x12ae,0x12ae,0x12b4,0x12b7,0x12db,0x12db,0x12b7,0x12db,0x12ae,0x12b7,0x12b7,0x12ba,0x12db,0x12ae, +0x12ae,0x12db,0x12b1,0x12b1,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12c3,0x12c3, +0x12c3,0x12c3,0x13ef,0x13ce,0x12cc,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x187e, +0x187e,0x187e,0x187e,0x187e,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x1581, +0x1581,0x1ad0,0x1ad0,0x1ad0,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6, +0x12c6,0x12c6,0x12c6,0x12c6,0x13d7,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x12cc,0x12cc, +0x12cc,0x12cc,0x12cc,0x13d1,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x13d4,0x13d4,0x13d4, +0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x145b,0x145b, +0x1a2e,0x1ad0,0x1ad0,0x1ad0,0x13da,0x13da,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x12cf, +0x12cf,0x13d4,0x13da,0x12d5,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9, +0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9, +0x12f9,0x12f9,0x12f9,0x12f9,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1449,0x1560, +0x1560,0x1560,0x17fa,0x196e,0x1560,0x1560,0x1749,0x1749,0x1749,0x1743,0x1749,0x1743,0x1971,0x196e,0x1a2b,0x1a28, +0x1a2b,0x1a28,0x1a2b,0x1a28,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7, +0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7, +0x13a7,0x13a7,0x13a7,0x13a7,0x13bc,0x13ad,0x13bc,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13c5,0x13c5,0x13c5,0x13c5, +0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5, +0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13cb,0x13cb,0x13cb,0x13cb, +0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb, +0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13fb,0x13f8,0x1923,0x1923, +0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923, +0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1401,0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1404,0x1404,0x1404,0x1401,0x1404,0x1401,0x1404, +0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1401,0x1404,0x1401,0x1401,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401, +0x1401,0x1401,0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401, +0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x158a,0x158a,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x1590,0x1590,0x1596,0x1596,0x1596,0x1596, +0x1596,0x1596,0x1596,0x1596,0x1596,0x17d0,0x17d0,0x17d0,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x17d0,0x17d0, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1590,0x1590,0x1596,0x1596,0x1590,0x1596,0x1596,0x1596,0x158d,0x158d,0x1596,0x1596, +0x1404,0x1404,0x1407,0x1407,0x1407,0x1701,0x1404,0x1407,0x1404,0x1404,0x1407,0x1599,0x1599,0x1596,0x1596,0x17d0, +0x17d0,0x17d0,0x17d0,0x17d0,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1590,0x1590,0x1596,0x1701,0x1596,0x1590,0x1596,0x17d0,0x17d0,0x17d0,0x17d3,0x17d3,0x17d3,0x17d3,0x17d3, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596, +0x1404,0x1596,0x1407,0x1407,0x1404,0x1404,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407, +0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407, +0x1407,0x1407,0x1407,0x1407,0x1407,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1407,0x1407,0x1407, +0x1404,0x1407,0x1407,0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1407,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1701,0x1404,0x1404,0x1404,0x1404,0x1596,0x1590,0x17d0, +0x145e,0x145e,0x145e,0x145e,0x158a,0x158a,0x158d,0x158d,0x158d,0x1593,0x1596,0x17d0,0x17d0,0x17d0,0x17d0,0x1758, +0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, +0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1590,0x1590,0x1596,0x1599,0x1599,0x1596,0x1596, +0x1596,0x1596,0x1887,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1590,0x1596,0x1590,0x1590,0x1590,0x1590, +0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1590,0x1590,0x1590,0x1596,0x158d,0x158d,0x158d,0x158d, +0x158d,0x158d,0x1596,0x1404,0x1404,0x1404,0x1404,0x1404,0x14e8,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a, +0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,0x14e8,0x140a,0x14e8, +0x140a,0x14e8,0x140a,0x14e8,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x14e8,0x14e8, +0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x14e8,0x14e8,0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a, +0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x1707,0x1707,0x17d6,0x17d6,0x140d,0x140d,0x140d, +0x140a,0x140a,0x140a,0x140d,0x140d,0x140d,0x140d,0x140d,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686, +0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410, +0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410, +0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1413,0x1410,0x1410,0x1410,0x1410, +0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1413,0x1413,0x1413,0x1410, +0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416, +0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416, +0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1803,0x1803,0x1800,0x175b,0x1464,0x1464,0x1464,0x1464, +0x1464,0x1464,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464, +0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x15a2,0x1470,0x1470,0x1470,0x1482,0x1482,0x1482,0x1482,0x1482, +0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482, +0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d, +0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d, +0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3, +0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3, +0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x1a34,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6, +0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6, +0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14ac,0x14ac,0x14b8,0x14be,0x14be,0x14be,0x14be,0x14be, +0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be, +0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14b8,0x14b8,0x14b8,0x14ac,0x14ac, +0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14b8,0x14bb,0x14be,0x14c1,0x14c1,0x14be,0x14c4,0x14c4,0x14af, +0x14b2,0x1764,0x1767,0x1767,0x1767,0x15ab,0x1adc,0x1ad9,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5, +0x14b5,0x14b5,0x15a8,0x176d,0x1770,0x176a,0x1773,0x1773,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df, +0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df, +0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, +0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, +0x153c,0x153c,0x1956,0x1956,0x1956,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, +0x153c,0x1a22,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x18ba,0x1956,0x1956,0x1956,0x1956,0x1956, +0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1590,0x1590,0x1596,0x1596,0x1596,0x1590,0x1590,0x1590, +0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1596,0x158d,0x158d,0x158d,0x158d, +0x158d,0x158d,0x158d,0x158d,0x1596,0x1596,0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596, +0x1590,0x1590,0x1596,0x1596,0x1596,0x1596,0x1590,0x1590,0x1599,0x1590,0x1590,0x1590,0x1590,0x1704,0x1704,0x1590, +0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1884,0x1596,0x1590,0x1590,0x1596,0x1590,0x1590,0x1590, +0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590, +0x1596,0x1590,0x1590,0x1590,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba, +0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba, +0x15ba,0x15ba,0x15ba,0x15ba,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc, +0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc, +0x15cc,0x15cc,0x15cc,0x15cc,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2, +0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2, +0x15d2,0x15d2,0x15d2,0x15d2,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5, +0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5, +0x15d5,0x15d5,0x15d5,0x15d5,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614, +0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614, +0x1614,0x1614,0x1614,0x1605,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d, +0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x1617, +0x1620,0x1620,0x1620,0x1620,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623, +0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623, +0x1623,0x1623,0x1623,0x1623,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x1635,0x163e,0x163e,0x163e, +0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e, +0x163e,0x163e,0x163e,0x163e,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647, +0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647, +0x1647,0x1647,0x1647,0x1647,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659, +0x1659,0x1659,0x1659,0x1659,0x1656,0x1656,0x1656,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x1656, +0x1656,0x164a,0x1656,0x164d,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659, +0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659, +0x1659,0x1659,0x1659,0x1659,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d, +0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d, +0x167d,0x167a,0x167a,0x167a,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686, +0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x168c,0x168c,0x168c,0x1689,0x1689,0x1689, +0x1686,0x1686,0x1686,0x1686,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, +0x169b,0x169b,0x169b,0x169b,0x168f,0x168f,0x168f,0x168f,0x168f,0x168f,0x168f,0x16a1,0x16a1,0x1695,0x1692,0x1692, +0x1692,0x1692,0x1692,0x1692,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, +0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, +0x169b,0x169b,0x169b,0x169b,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7, +0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a4,0x16a4,0x16a4,0x16a4,0x16a4, +0x16a4,0x16a4,0x16a4,0x16a4,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa, +0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa, +0x16aa,0x16aa,0x16aa,0x16aa,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce, +0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce, +0x16ce,0x16ce,0x16ce,0x16ce,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, +0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, +0x16d7,0x16d7,0x16d7,0x16d7,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef, +0x16ef,0x16ef,0x16ef,0x16ef,0x16da,0x16e9,0x16e9,0x16da,0x16da,0x16da,0x16da,0x16da,0x16da,0x16e9,0x16da,0x16ec, +0x16ec,0x16da,0x16ec,0x16da,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef, +0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef, +0x16ef,0x16ef,0x16ef,0x16ef,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8, +0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8, +0x16f8,0x16f8,0x16f8,0x16f8,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe, +0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe, +0x16fe,0x16fe,0x16fe,0x16fe,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956, +0x1740,0x1740,0x1740,0x1740,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956, +0x1956,0x1956,0x1956,0x1a22,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761, +0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761, +0x1761,0x1761,0x1761,0x1761,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d, +0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d, +0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x17a3,0x17a0,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d, +0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6, +0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6, +0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9, +0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9, +0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb, +0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb, +0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be, +0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be, +0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1, +0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1, +0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1, +0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c4,0x17c4,0x17c4, +0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4, +0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4, +0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc, +0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc, +0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6, +0x18c6,0x18c6,0x18c6,0x18c6,0x1b3f,0x1a94,0x1a94,0x1a97,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df, +0x17e2,0x1890,0x1890,0x1890,0x1890,0x1890,0x1890,0x192c,0x17df,0x17df,0x17df,0x17df,0x17df,0x188d,0x188d,0x188d, +0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929, +0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1890,0x188d, +0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1890,0x192c,0x192c,0x1890,0x1890,0x1890,0x1890,0x1890, +0x1890,0x1890,0x188d,0x180f,0x1890,0x1890,0x1890,0x1a94,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x180f,0x188d, +0x188d,0x188d,0x188d,0x188d,0x1929,0x1a0a,0x1a0a,0x1a0a,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d, +0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1929,0x1824,0x1824,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821, +0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821, +0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824, +0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824, +0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872, +0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x186f,0x186f,0x186f, +0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872, +0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872, +0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896, +0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896, +0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899, +0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899, +0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48, +0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x18f0,0x18f0,0x18f0,0x18f0,0x1a46,0x1a46,0x18f3,0x18f3, +0x18f3,0x18f3,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18ed, +0x18de,0x18e1,0x18e4,0x18f6,0x18f6,0x1995,0x18e7,0x18e7,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0, +0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0, +0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911, +0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x18fc,0x1902,0x18ff,0x18ff,0x18ff, +0x18ff,0x190e,0x1914,0x18ff,0x18ff,0x18ff,0x18ff,0x190b,0x1911,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff, +0x18ff,0x18ff,0x18ff,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911, +0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923, +0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923, +0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1a0a, +0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a, +0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932, +0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932, +0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938, +0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938, +0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa, +0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa, +0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5, +0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5, +0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb, +0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb, +0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6, +0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6, +0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9, +0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9, +0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2, +0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2, +0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19ef,0x19ef,0x19ef,0x1a0a,0x1a0a,0x1a0a,0x1b3c,0x1b3c,0x1a94,0x1a94,0x1a94, +0x1a94,0x1a94,0x1a94,0x1b3c,0x1b3c,0x1b3c,0x1a94,0x1a94,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0a,0x1a10,0x1a10,0x1a0a, +0x1a10,0x1a10,0x1a94,0x1a97,0x1a94,0x1a94,0x1a94,0x1a94,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49, +0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49, +0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70, +0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70, +0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79, +0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1aaf,0x1aaf,0x1a79,0x1aaf,0x1a79,0x1a79,0x1a79,0x1a79, +0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a7f,0x1a7f,0x1a7f,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b, +0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b, +0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e, +0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e, +0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a, +0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a, +0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e, +0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e, +0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51, +0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51, +0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0,0,0,0 +}; + +static const UTrie2 propsVectorsTrie={ + propsVectorsTrie_index, + propsVectorsTrie_index+5024, + NULL, + 5024, + 26204, + 0xa40, + 0x1420, + 0x0, + 0x0, + 0x110000, + 0x79f8, + NULL, 0, FALSE, FALSE, 0, NULL +}; + +static const uint32_t propsVectors[6999]={ +0x67,0,0,0x67,0,0x4e00000,0x67,0x80000,0x20,0x867,0,0,0xa67,0,0,0xb67, +0,0,0xc67,0,0,0xd67,0,0,0xe67,0,0,0x1067,0,0,0x1167,0, +0,0x1267,0,0,0x1367,0,0,0x1467,0,0,0x1567,0,0,0x1667,0,0, +0x1767,0,0,0x1867,0,0,0x1967,0,0,0x1a67,0,0,0x1b67,0,0,0x1d67, +0,0,0x1f67,0,0,0x2067,0,0,0x2267,0,0,0x2367,0,0,0x2467,0, +0,0x2567,0,0,0x2767,0,0,0x2867,0x80000,0x20,0x2967,0,0,0x2a67,0,0x1600000, +0x2b67,0,0,0x2d67,0,0,0x3167,0x20000000,0,0x3267,0x20000000,0,0x3a67,0,0,0x3b67, +0,0,0x3c67,0,0,0x3e67,0,0,0x4067,0,0,0x4167,0,0,0x4467,0, +0,0x4867,0,0,0x4967,0,0,0x4a67,0,0,0x5067,0,0,0x5167,0,0, +0x5467,0,0,0x5567,0,0,0x5667,0x80000,0x20,0x5767,0,0,0x5867,0,0,0x5967, +0,0,0x5b67,0,0,0x5c67,0,0,0x5d67,0,0,0x6067,0x80000,0x20,0x6267,0, +0,0x6367,0,0,0x6467,0,0,0x6567,0,0,0x6f67,0,0,0x7067,0,0, +0x7367,0x20000000,0,0x7567,0,0,0x7667,0,0,0x7767,0,0,0x7867,0,0,0x7a67, +0,0,0x7b67,0,0,0x7c67,0,0,0x7e67,0,0,0x7f67,0,0,0x8167,0, +0,0x8267,0,0,0x8367,0,0,0x8467,0,0,0x8567,0,0,0x8667,0,0, +0x8767,0,0,0x8867,0,0,0x8967,0,0,0x8b67,0,0,0x8c67,0,0,0x8e67, +0x20000000,0,0x8f67,0,0,0x9067,0,0,0x9167,0,0,0x9267,0,0,0x9367,0, +0,0x9567,0,0,0x9667,0,0,0x9767,0,0,0x9867,0,0,0x9967,0,0, +0x9a67,0,0,0x9c67,0,0,0x9f67,0,0,0xa167,0,0,0xa367,0,0,0xa467, +0,0,0xa567,0,0,0xa667,0,0,0xa767,0,0,0xa867,0,0,0xa967,0, +0,0xaa67,0,0x4e00000,0xab67,0,0x4e00000,0xac67,0,0,0xad67,0,0,0xae67,0,0, +0xaf67,0,0,0xb167,0,0,0xb267,0,0,0xb467,0,0,0xb567,0,0,0xb767, +0,0,0xb867,0,0,0xb967,0,0,0xba67,0,0,0xbc67,0,0,0xbd67,0, +0,0xbe67,0,0,0xbf67,0,0,0xc067,0,0,0xc167,0,0,0xc267,0,0, +0xc367,0,0x4e00000,0xc467,0,0x4e00000,0xc667,0,0,0xc767,0,0,0xc867,0,0,0xc967, +0,0,0xca67,0,0,0xcc67,0,0x4e00000,0xcf67,0,0x4e00000,0xd067,0,0x4e00000,0xd267,0, +0,0xd367,0,0,0xd467,0,0,0xd567,0,0,0xd667,0,0,0xd867,0,0, +0xda67,0,0,0xdb67,0,0,0xdc67,0,0,0xdd67,0,0,0xde67,0,0,0xdf67, +0,0,0xe067,0,0,0xe167,0,0,0xe267,0,0,0xe367,0,0x4e00000,0xe467,0, +0,0xe567,0,0,0xe667,0,0,0xe767,0,0,0xe867,0,0,0xe967,0,0, +0xea67,0,0,0xeb67,0,0,0xec67,0,0,0xed67,0,0,0xee67,0,0,0xef67, +0,0,0xf167,0,0,0xf367,0,0,0xf567,0,0,0xf667,0,0,0xf767,0, +0,0xf867,0,0,0xf967,0,0,0xfa67,0,0x4e00000,0xfb67,0,0,0xfc67,0,0, +0xfd67,0,0,0xfe67,0,0,0x10167,0,0,0x10267,0,0,0x10367,0,0,0x10467, +0,0,0x10567,0,0x4e00000,0x10667,0,0,0x10767,0,0,0x10867,0,0,0x10967,0, +0,0x10a67,0,0,0x10b67,0,0,0x10c67,0,0,0x10d67,0,0,0x10e67,0,0, +0x10f67,0,0,0x11067,0,0,0x11367,0,0,0x11467,0,0,0x11567,0,0,0x11667, +0,0,0x11767,0,0,0x11867,0,0,0x11967,0,0x4e00000,0x11a67,0,0,0x11b67,0, +0,0x11c67,0,0,0x11d67,0,0,0x11e67,0,0,0x11f67,0,0,0x12067,0,0, +0x12167,0,0,0x12267,0,0,0x12367,0,0,0x12467,0,0,0x12567,0,0,0x12667, +0,0,0x12767,0,0,0x12867,0,0,0x12967,0,0,0x12a67,0,0x4e00000,0x12b67,0, +0,0x12c67,0,0,0x12d67,0,0,0x12f67,0,0,0x13067,0,0,0x13167,0,0, +0x13267,0,0,0x13367,0,0,0x13467,0,0,0xa0067,0,0xe00000,0xa4767,0,0xe00000,0xa4f67, +0,0xe00000,0xa5e67,0,0xe00000,0xa5f67,0,0xe00000,0xac567,0,0xe00000,0xad167,0,0xe00000,0xb0067,0, +0xe00000,0xb1267,0,0xe00000,0xb2e67,0,0xe00000,0x11000100,0,0x900020,0x11000100,0x40000001,0x440020,0x11000100,0x40000001,0x643020, +0x11000100,0x40000001,0xa5a040,0x11000100,0x40000001,0x116a8a0,0x11000200,0,0x900020,0x11000200,0x4000001,0xc4000b,0x11000200,0x7c00100,0x220402,0x11000200, +0x24000000,0x14200000,0x11000200,0x24000008,0x1710000,0x11000200,0x40000001,0x1d3b020,0x11000219,0x7c00100,0x220401,0x11000219,0x7c00100,0x250401,0x11000319,0x7c00100, +0x220401,0x11000319,0x7c00100,0x220402,0x11000319,0x7c00100,0x250400,0x11000319,0x7c00100,0x250401,0x11000419,0x7c00100,0x220400,0x11000419,0x7c00100,0x220401, +0x11000419,0x7c00100,0x220402,0x11000419,0x7c00100,0x230400,0x11000419,0x7c00100,0x250400,0x11000419,0x7c00100,0x250401,0x11000419,0x7c00100,0x250402,0x11000519, +0x7c00100,0x220400,0x11000519,0x7c00100,0x230400,0x11000600,0x4000400,0x200002,0x11000600,0x4000400,0x200400,0x11000600,0x7c00500,0x220400,0x11000600,0x7c00500, +0x230400,0x11000600,0x7c00500,0x530400,0x11000600,0x7c00d00,0x230400,0x11000619,0x7c00500,0x22040f,0x11000800,0x4000010,0x1001401,0x11000800,0x4000400,0x200001, +0x11000800,0x6800010,0x201001,0x11000800,0x7c00500,0x230401,0x11000807,0x7c00100,0x220400,0x11000807,0x7c00100,0x250400,0x1100080e,0x4000400,0x200000,0x1100080e, +0x4000400,0x200002,0x1100080e,0x7000500,0x220402,0x1100080e,0x7c00100,0x220400,0x1100080e,0x7c00100,0x220401,0x1100080e,0x7c00100,0x220402,0x1100080e,0x7c00100, +0x250400,0x1100080e,0x7c00100,0x250401,0x1100080e,0x7c00120,0x220402,0x1100080e,0x7c00120,0x250402,0x11000908,0x4000000,0x200000,0x11000908,0x7c00100,0x220400, +0x11000908,0x7c00100,0x220401,0x11000908,0x7c00100,0x250400,0x11000908,0x7c00100,0x250401,0x11000a03,0x4000000,0x200400,0x11000a03,0x4000000,0x201000,0x11000a03, +0x4000000,0x270000,0x11000a03,0x7c00100,0x220400,0x11000a03,0x7c00100,0x220402,0x11000a03,0x7c00100,0x250400,0x11000a03,0x7c00500,0x230400,0x11000a03,0xc000010, +0x1049400,0x11000b13,0x2802500,0x962460,0x11000b13,0x4000000,0x200000,0x11000b13,0x4000000,0x201000,0x11000b13,0x4000000,0x230400,0x11000b13,0x4000002,0x400000, +0x11000b13,0x4000010,0x200000,0x11000b13,0x7c00100,0x2633800,0x11000c00,0x80000000,0x218960,0x11000c02,0x2802100,0x962460,0x11000c02,0x2802400,0x962460,0x11000c02, +0x4000000,0x200000,0x11000c02,0x4000000,0x1329400,0x11000c02,0x4000000,0x1329800,0x11000c02,0x4000000,0x1500000,0x11000c02,0x6800000,0x1329800,0x11000c02,0x7c00100, +0x230400,0x11000c02,0x7c00100,0x230401,0x11000c02,0x7c00100,0x230402,0x11000c02,0x7c00500,0x230400,0x11000c02,0x7d00100,0x230400,0x11000f01,0x2802400,0x962460, +0x11000f0a,0x2802100,0x962460,0x11000f0a,0x2802400,0x962460,0x11000f0a,0x2806400,0x962460,0x11000f0a,0x4000000,0x200000,0x11000f0a,0x6800100,0x962540,0x11000f0a, +0x7c00100,0x230400,0x11000f0a,0x7c00100,0x230401,0x11001004,0x2802100,0x962460,0x11001004,0x2802400,0x962460,0x11001004,0x2806400,0x962460,0x11001004,0x4000000, +0x200000,0x11001004,0x4000000,0x1500000,0x11001004,0x6800100,0x962540,0x11001004,0x6800100,0x962541,0x11001004,0x7c00100,0x230400,0x11001004,0x7c00100,0x230401, +0x11001110,0x2802100,0x962460,0x11001110,0x2802400,0x962460,0x11001110,0x2806400,0x962460,0x11001110,0x6800100,0x962540,0x11001110,0x7c00100,0x230400,0x11001110, +0x7c00100,0x230401,0x1100120f,0x2802100,0x962460,0x1100120f,0x2802400,0x962460,0x1100120f,0x2806400,0x962460,0x1100120f,0x6800100,0x962540,0x1100120f,0x7c00100, +0x230400,0x1100131f,0x2802100,0x962460,0x1100131f,0x2802400,0x962460,0x1100131f,0x2806400,0x962460,0x1100131f,0x4000000,0x200000,0x1100131f,0x6800000,0x1329800, +0x1100131f,0x6800100,0x962540,0x1100131f,0x6800100,0x962541,0x1100131f,0x7c00100,0x230400,0x1100131f,0x7c00100,0x230401,0x11001423,0x2802100,0x962460,0x11001423, +0x2806400,0x962460,0x11001423,0x6800100,0x962540,0x11001423,0x6800100,0x962541,0x11001423,0x7c00100,0x230400,0x11001423,0x7c00100,0x230401,0x11001524,0x2802100, +0x962460,0x11001524,0x2802100,0x962461,0x11001524,0x2806400,0x962460,0x11001524,0x6800000,0x1329800,0x11001524,0x6800100,0x962540,0x11001524,0x7c00100,0x230400, +0x11001615,0x2802100,0x962460,0x11001615,0x2806400,0x962460,0x11001615,0x6800100,0x962540,0x11001615,0x6800100,0x962541,0x11001615,0x7c00100,0x230400,0x1100171a, +0x2802100,0x962460,0x1100171a,0x2806400,0x962460,0x1100171a,0x6800000,0x1329800,0x1100171a,0x6800100,0x962540,0x1100171a,0x6800100,0x962541,0x1100171a,0x7c00100, +0x230400,0x11001900,0x4000000,0x1600000,0x11001926,0x2802100,0x1862460,0x11001926,0x2802400,0x1862460,0x11001926,0x2806100,0x1862460,0x11001926,0x4000000,0x200000, +0x11001926,0x4000010,0x400000,0x11001926,0x6800000,0x1329800,0x11001926,0x7800100,0x1830142,0x11001926,0x7c00100,0x1830000,0x11001926,0x7c00900,0x1830000,0x11001926, +0x7e00100,0x1830000,0x11001a18,0x2802100,0x1862460,0x11001a18,0x2802400,0x1862460,0x11001a18,0x6800000,0x1329800,0x11001a18,0x7800100,0x1830142,0x11001a18,0x7c00100, +0x1830000,0x11001a18,0x7c00100,0x1830002,0x11001a18,0x7c00900,0x1830000,0x11001a18,0x7e00100,0x1830000,0x11001d0c,0x7c00100,0x230400,0x11001d0c,0x7c00100,0x250400, +0x11001e12,0x7c00100,0x2230500,0x11001e12,0x7c00100,0x2330520,0x11001e12,0x7c80100,0x2330520,0x11002619,0x7c00100,0x220401,0x11002619,0x7c00100,0x220402,0x11002619, +0x7c00100,0x250401,0x1100270e,0x4000400,0x200001,0x1100270e,0x4000400,0x200002,0x1100270e,0x4000400,0x500001,0x1100270e,0x7c00100,0x220401,0x1100270e,0x7c00100, +0x250401,0x11002800,0x80000,0x918820,0x11002800,0x80000,0x1c18020,0x11002800,0x180000,0x918820,0x11002800,0x4000001,0x445801,0x11002800,0x4000001,0x445802, +0x11002800,0x4000001,0xc4000b,0x11002800,0x6800000,0x201c00,0x11002800,0x6800020,0x201c00,0x11002800,0x24000000,0x200000,0x11002800,0x24000000,0x200002,0x11002800, +0x24000000,0x810000,0x11002800,0x24000000,0x1410000,0x11002800,0x24000000,0x1500000,0x11002800,0x24000000,0x1500002,0x11002800,0x24000002,0x400000,0x11002800,0x24000006, +0xc0000b,0x11002800,0x24000008,0x1410000,0x11002800,0x24000008,0x1710000,0x11002800,0x24000020,0x1001400,0x11002800,0x24000020,0x1500002,0x11002800,0x2c000010,0x1248000, +0x11002800,0x2c000010,0x15248002,0x11002800,0x40000001,0x63b020,0x11002800,0x40080000,0x918820,0x11002801,0x80000,0xaa65620,0x11002801,0x82000,0x962460,0x11002900, +0x4000000,0x20000e,0x11002900,0x4000000,0x20000f,0x11002900,0x4000020,0x20000e,0x11002900,0x4000020,0x20000f,0x11002900,0x4000020,0x81000e,0x11002900,0x4000020, +0x81000f,0x11002900,0x4000020,0x141000e,0x11002900,0x4000020,0x141000f,0x11002900,0x4000022,0x20000e,0x11002900,0x4000022,0x20000f,0x11002a00,0x4000000,0x1500000, +0x11002a00,0x4000000,0x1600000,0x11002a00,0x4000000,0x1600002,0x11002b01,0x2000,0x962460,0x11002b01,0x2802020,0x962460,0x11002c00,0x4000000,0x200000,0x11002c00, +0x4000000,0x200002,0x11002c00,0x4000000,0x20000f,0x11002c00,0x4000020,0x200000,0x11002c00,0x7c00000,0x200000,0x11002c00,0x7c00020,0x200000,0x11002c00,0x7c00120, +0x220405,0x11002c00,0x7c00120,0x230402,0x11002c00,0x7c00120,0x250402,0x11002c00,0x7c00120,0x250405,0x11002c19,0x7c00100,0x250400,0x11002c19,0x7c00100,0x250401, +0x11002d00,0x4000000,0x100006,0x11002d00,0x4000000,0x200006,0x11002d19,0x7c00100,0x220402,0x11002d19,0x7c00100,0x230400,0x11002d19,0x7c00100,0x250402,0x11002e00, +0x24000000,0x200000,0x11002e00,0x24000020,0x200000,0x11002e00,0x24000020,0x200001,0x11002e00,0x24000020,0x14200000,0x11002f00,0x24000020,0x200000,0x11002f00,0x24000020, +0x200001,0x11002f00,0x24000020,0x200002,0x11002f00,0x24000020,0xf00000,0x11002f00,0x24000020,0x1600000,0x11002f00,0x24000022,0x1600000,0x11003000,0x24000000,0x200000, +0x11003000,0x24000000,0x14200000,0x11003000,0x24000020,0x200000,0x11003000,0x24000020,0x810000,0x11003000,0x24000020,0x1410000,0x11003100,0x24000000,0x200000,0x11003200, +0x24000000,0x200000,0x11003300,0x4000000,0x100003,0x11003400,0x24000000,0x100000,0x11003400,0x24000000,0x200000,0x11003500,0x24000000,0x200000,0x11003600,0x24000000, +0x200000,0x11003600,0x24000000,0x14200000,0x11003600,0x24000020,0x200000,0x11003700,0x24000000,0x200000,0x11003700,0x24000000,0x4200000,0x11003700,0x24000000,0x4e00000, +0x11003700,0x24000000,0x14200000,0x11003700,0x24000000,0x14e00000,0x11003700,0x24000000,0x96800000,0x11003700,0x24000020,0x4200000,0x11003800,0x4000000,0x100000,0x11003800, +0x24000000,0x200000,0x11003800,0x24000000,0xb00000,0x11003800,0x24000000,0x1710000,0x11003800,0x24000000,0x4200000,0x11003800,0x24000000,0x4e00000,0x11003800,0x24000000, +0x14200000,0x11003800,0x24000000,0x14b00000,0x11003800,0x24000000,0x14e00000,0x11003800,0x24000000,0x96800000,0x11005003,0x7c00100,0x220402,0x11005013,0x2802500,0x962460, +0x11005013,0x4000020,0x200005,0x11005013,0x7c00100,0x2633801,0x11005013,0x7c00100,0x2633802,0x11005013,0x7c00100,0x2633805,0x11005019,0x7c00100,0x220402,0x11005100, +0x24000000,0x810000,0x11005100,0x24000000,0x1410000,0x11005102,0x7000100,0x230408,0x11005102,0x7c00100,0x230404,0x11005102,0x7c00100,0x230407,0x11005102,0x7c00100, +0x230408,0x11005102,0x7c00100,0x230409,0x11005201,0x2802400,0x962460,0x11005500,0x80000,0x1e18820,0x11005502,0x7000100,0x230408,0x11005502,0x7c00100,0x230404, +0x11005502,0x7c00100,0x230407,0x11005502,0x7c00100,0x230408,0x11005502,0x7c00100,0x230409,0x11005667,0x1000,0,0x11020200,0x80004,0x418820,0x11020200, +0x4000000,0x100006,0x11020200,0x4000000,0x10000f,0x11020200,0x4000400,0x100002,0x11020200,0x4000400,0x500002,0x11020200,0x6800c00,0x101000,0x11020200,0x24000000, +0x100000,0x11020200,0x24000000,0x1400000,0x11020200,0x24000000,0x1500000,0x11020200,0x24000000,0x1600000,0x11020200,0x24000000,0x14200000,0x11020200,0x24000020,0x100000, +0x11020200,0x24000020,0x1600000,0x11020219,0x7c00100,0x12040f,0x11020219,0x7c00100,0x220400,0x11020219,0x7c00100,0x220401,0x11020219,0x7c00100,0x250400,0x11020319, +0x7c00100,0x220400,0x11020319,0x7c00100,0x220401,0x11020319,0x7c00100,0x220402,0x11020319,0x7c00100,0x250400,0x11020319,0x7c00100,0x250402,0x11020319,0x7d00100, +0x220402,0x11020419,0x7c00100,0x220401,0x11020519,0x7c00100,0x220400,0x11020600,0x4000400,0x100002,0x11020600,0x4000400,0x200400,0x11020600,0x7c00500,0x130400, +0x11020600,0x7c00d00,0x130400,0x11020701,0x2802400,0x962460,0x11020701,0x2802400,0x962461,0x11020701,0x2802400,0xc62460,0x1102080e,0x7c00100,0x220400,0x1102080e, +0x7c00100,0x250400,0x11020908,0x7c00100,0x220400,0x11020908,0x7c00100,0x220401,0x11020908,0x7c00100,0x250400,0x11020908,0x7c00100,0x250401,0x11022800,0x24000000, +0x100000,0x11022800,0x24000000,0x200000,0x11022800,0x24000000,0x200002,0x11022800,0x24000000,0x401000,0x11022800,0x24000000,0xf00002,0x11022800,0x24000000,0xf0ac02, +0x11022800,0x24000000,0x1500000,0x11022800,0x24000002,0x100000,0x11022800,0x24000002,0x370000,0x11022800,0x24000002,0x470000,0x11022800,0x24000006,0x400000,0x11022800, +0x24000008,0x1710000,0x11022800,0x24000008,0x1712c00,0x11022800,0x24000020,0x100000,0x11022800,0x24000020,0x1500000,0x11022800,0x24000020,0x1500002,0x11022900,0x4000000, +0x10000e,0x11022900,0x4000000,0x10000f,0x11022919,0x7c00100,0x12040f,0x11022c00,0x4000000,0x100002,0x11022c00,0x4000000,0x1500002,0x11022c00,0x4000000,0x1600002, +0x11022c00,0x4000000,0x1410000f,0x11022c00,0x7c00120,0x120405,0x11022c0e,0x7c00100,0x250401,0x11022c19,0x7c00100,0x150401,0x11022d00,0x4000000,0x100006,0x11022d00, +0x4000000,0x200006,0x11022d19,0x7c00100,0x120402,0x11022d19,0x7c00100,0x150402,0x11022e00,0x24000000,0x200000,0x11022e00,0x24000020,0x100000,0x11022e00,0x24000020, +0x14100000,0x11022f00,0x24000020,0x100000,0x11022f00,0x24000020,0x100001,0x11022f00,0x24000020,0x100002,0x11023000,0x24000000,0x100000,0x11023300,0x4000000,0x100002, +0x11023300,0x4000000,0x100003,0x11023300,0x4000100,0x120403,0x11023300,0x4000100,0x150403,0x11023300,0x4000100,0x14150403,0x11023400,0x24000000,0x100000,0x11023500, +0x24000000,0x100000,0x11023600,0x24000000,0x100000,0x11023600,0x24000020,0x100000,0x11023600,0x24000020,0x14100000,0x11023700,0x24000000,0x4100000,0x11023700,0x24000000, +0x4e00000,0x11023700,0x24000000,0x14100000,0x11023700,0x24000000,0x14e00000,0x11023700,0x24000020,0x100000,0x11023700,0x24000020,0x4100000,0x11023700,0x24000020,0x14100000, +0x11023800,0x4000000,0x100000,0x11023800,0x24000000,0x200000,0x11024e67,0,0,0x11025600,0x4000000,0x100000,0x11042a00,0x4000000,0x1600000,0x11045700, +0x4000000,0x20000a,0x11045700,0x4000020,0x20000a,0x11045712,0x7c00100,0xe3040a,0x11045712,0x7c80100,0xe3040a,0x11045716,0x7c00100,0xe30c0a,0x11045716,0x7c00100, +0x2530c0a,0x11063d00,0x4000001,0x445811,0x11065700,0x4000000,0x810011,0x11065700,0x4000000,0xe00011,0x11065700,0x4000000,0x1410011,0x11065700,0x4000000,0x1500011, +0x11065700,0x4000000,0x1600011,0x11065700,0x4000006,0xe70011,0x11065700,0x4000008,0xe00011,0x11065700,0x4000008,0xe02c11,0x11065700,0x4000010,0x871411,0x11065700, +0x4000010,0x1201411,0x11065700,0x4000010,0x1271011,0x11065700,0x4000020,0xe00011,0x11065700,0x4000400,0xe00011,0x11065700,0x4000420,0xe00011,0x11065700,0x6800000, +0xe01c11,0x11065700,0x6800040,0xe29811,0x11065700,0xc000010,0x80ac11,0x11065700,0xc000010,0xb48011,0x11065719,0x7c00100,0xe20411,0x11065719,0x7c00100,0xe50411, +0x11065719,0x7c00140,0xe20411,0x11065719,0x7c00140,0xe50411,0x11080100,0x6800000,0x201c00,0x11080100,0x68000c0,0x19329800,0x11080100,0x24000000,0x200000,0x11080100, +0x24000000,0x810000,0x11080100,0x24000000,0x1410000,0x11080100,0x24000000,0x1500000,0x11080100,0x24000000,0x1600000,0x11080100,0x24000000,0x1b00000,0x11080100,0x24000000, +0x2410000,0x11080100,0x24000000,0x18200000,0x11080100,0x24000006,0xd70000,0x11080100,0x24000008,0x1713c00,0x11080100,0x24000008,0x1714000,0x11080100,0x24000010,0x1001400, +0x11080100,0x24000010,0x1071000,0x11080100,0x24000010,0x1071400,0x11080100,0x24000020,0x200000,0x11080100,0x24000020,0x400000,0x11080100,0x24000020,0x1600000,0x11080100, +0x24000400,0x200000,0x11080100,0x24000420,0x200000,0x11080100,0x2c000010,0xb48000,0x11080100,0x2c000010,0x100ac00,0x11080100,0x44000001,0x1a45800,0x11080119,0x7c00100, +0x220400,0x11080119,0x7c00100,0x250400,0x11080119,0x7c001c0,0x220400,0x11080119,0x7c001c0,0x250400,0x11080200,0x4000400,0x200002,0x11080200,0x24000000,0x200000, +0x11080200,0x24000000,0x1500000,0x11080200,0x24000000,0x1600000,0x11080200,0x24000020,0x200000,0x110a1e12,0x7c00100,0x2130480,0x110a1e12,0x7c80100,0x2130480,0x110a3000, +0x24000000,0x34e00000,0x110a3000,0x24100000,0x810001,0x110a3000,0x24100000,0x1410001,0x110a3700,0x24000000,0x34200000,0x110a3d00,0x4000000,0xe00000,0x110a3d00,0x4000000, +0xe00002,0x110a3d00,0x24000000,0xe00000,0x110a3d11,0x7c00300,0xe30000,0x110a3d11,0x7c00900,0x1230400,0x110a3d12,0x2802400,0x962460,0x110a3e14,0x7c00100,0xe30000, +0x110a3e14,0x7c00100,0xe30001,0x110a3e14,0x7c00100,0x2530000,0x110a3e14,0x7c00900,0x1230000,0x110a3e14,0x7c00900,0x1230001,0x110a3f16,0x7c00100,0xe30c00,0x110a3f16, +0x7c00100,0xe30c01,0x110a3f16,0x7c00100,0x2530c00,0x110a3f16,0x7c00900,0x1230c00,0x110a3f16,0x7c00900,0x1230c01,0x110a4005,0x7c00100,0xe30400,0x110a4112,0x7c00100, +0xe30402,0x110a4112,0x7c80100,0xe30402,0x110a4400,0x4000000,0xe00000,0x110a4412,0x4000000,0xe00002,0x110a4412,0x4000000,0xe00003,0x110a4416,0x4000000,0xe00c03, +0x110a4500,0x4000000,0xe0000d,0x110a4516,0x4000000,0xe00c0d,0x110a4711,0x7c40300,0xe30000,0x110a4f11,0x7c00300,0xe30001,0x110a4f11,0x7c40300,0xe30000,0x110a5300, +0x4000000,0x810010,0x110a5300,0x4000000,0xe00002,0x110a5300,0x4000000,0xe00010,0x110a5300,0x4000000,0x1410010,0x110a5300,0x4000002,0xe70010,0x110a5300,0x4000008, +0x810010,0x110a5300,0x4000008,0x1410010,0x110a5300,0x6800000,0xe01c02,0x110a5300,0x6800000,0xe01c10,0x110a5400,0x4000000,0x81000c,0x110a5400,0x4000000,0xe0000c, +0x110a5400,0x4000000,0x141000c,0x110a5400,0x4000000,0x150000c,0x110a5400,0x4000000,0x160000c,0x110a5400,0x4000002,0xe7000c,0x110a5400,0x4000010,0x87140c,0x110a5400, +0x4000010,0xe7000c,0x110a5400,0x4000010,0x120140c,0x110a5400,0x4000010,0x127100c,0x110a5400,0x4000020,0xe0000c,0x110a5400,0x4000026,0xe7000c,0x110a5400,0xc000010, +0x80ac0c,0x110a5400,0xc000010,0xb4800c,0x11400c0c,0x4000010,0xb00000,0x11400c0c,0x4000010,0x1071400,0x11400c0c,0xc000010,0xb48000,0x11400c16,0x7c00900,0x230400, +0x11400f40,0xc000010,0x448000,0x11400f54,0xc000010,0x448000,0x11401d89,0x4000000,0x200000,0x11403dbf,0x4000000,0xe00000,0x114457b4,0x4000004,0x120000a,0x114457b4, +0x4000008,0x81000a,0x114457b4,0x4000008,0x141000a,0x114457b4,0x4000010,0x87000a,0x114457b4,0xc000010,0x84800a,0x114457bd,0x3802500,0x126246a,0x114457bd,0x7c00d00, +0x2530c0a,0x114a3db4,0x24000000,0x810000,0x114a3db4,0x24000000,0x1410000,0x114a3db4,0x24000008,0x810000,0x114a3db4,0x24000008,0x1410000,0x114a3db4,0x24000010,0x870000, +0x114a3db4,0x2c000010,0x848000,0x114a3dba,0x4000000,0xe00000,0x114a3dba,0x24000000,0xe00000,0x114a3dba,0x24000002,0x1200000,0x114a3dba,0x24000002,0x14e00000,0x114a3dba, +0x24000008,0x810000,0x114a3dba,0x24000008,0x1410000,0x114a3dbd,0x7c00900,0x930c00,0x114a3dbd,0x7c00900,0xe30c00,0x114a3dbf,0x7c00300,0xe30000,0x114a3ebd,0x7000400, +0x1200c02,0x114a3fb4,0x4000004,0x1200000,0x114a3fbd,0x7c00d00,0x2530c00,0x114a42bf,0x4000000,0xe00000,0x114a42bf,0x4000000,0xe0000f,0x114a44bf,0x4000000,0xe00002, +0x114a44bf,0x4000000,0xe00003,0x114a44bf,0x4000000,0x14e00003,0x114a45bf,0x4000000,0xe00002,0x114a45bf,0x4000000,0xe0000d,0x1180090a,0x2802400,0x962460,0x11800c1e, +0x2802100,0x962460,0x11800c1e,0x2802500,0x962460,0x11800f27,0x2802400,0x962460,0x11800f34,0x2802400,0x962460,0x11820700,0x2802400,0x962460,0x11820700,0x2802500, +0x962460,0x118a3dc0,0x2802400,0x962460,0x118a3ebd,0x2802400,0x962460,0x11c00904,0x2802400,0x962460,0x11c00908,0x2802400,0x962460,0x11c00c20,0xc000010,0xb48000, +0x11c00c23,0x6800000,0x1329800,0x11c00f6d,0x6800000,0x1329800,0x11c01072,0x6800000,0x1329800,0x11c01176,0x6800000,0x1329800,0x11c0127a,0x6800000,0x1329800,0x11c0147e, +0x4000000,0x200000,0x11c0147e,0x6800000,0x1329800,0x11c01682,0x6800000,0x1329800,0x11c051fa,0x7c00100,0x230408,0x20000067,0x1000,0,0x20000b13,0x2802400, +0x962460,0x20000b13,0x2802500,0x962460,0x20001b27,0x2802100,0x962460,0x20001b27,0x2802100,0x962461,0x20001b27,0x2802400,0x962460,0x20001b27,0x2806400,0x962460, +0x20001b27,0x2902100,0x962462,0x20001b27,0x4000000,0x200000,0x20001b27,0x4000000,0x400000,0x20001b27,0x4000000,0x500000,0x20001b27,0x4000000,0x810000,0x20001b27, +0x4000000,0xb00000,0x20001b27,0x4000000,0xc0000b,0x20001b27,0x4000000,0x1410000,0x20001b27,0x4000010,0xb00000,0x20001b27,0x4000010,0xc00000,0x20001b27,0x6800000, +0x1329800,0x20001b27,0x6800100,0x462540,0x20001b27,0x6800400,0x962540,0x20001b27,0x7c00100,0x230400,0x20001b27,0x7c00100,0x230401,0x20002619,0x7c00100,0x220401, +0x20002a00,0x4000000,0x1600000,0x20004b67,0,0x1900000,0x20004c67,0,0x1900000,0x20004d67,0,0x1900000,0x20006d67,0x1000,0,0x20006e67, +0x1000,0,0x20026d67,0,0,0x20026e67,0,0,0x200a4a12,0x7c00100,0x1f304c1,0x200a4a12,0x7c00100,0x20304e1,0x21005600,0x4000000, +0x700000,0x21022a00,0x4000000,0x1600000,0x30000419,0x7c00100,0x220400,0x30000419,0x7c00100,0x220401,0x30000419,0x7c00100,0x250400,0x30000419,0x7c00100,0x250401, +0x30000519,0x7c00100,0x220400,0x30000600,0x4000400,0x200400,0x30000600,0x7c00500,0x230400,0x30000605,0x4000400,0x200400,0x3000080e,0x7c00100,0x220400,0x30000908, +0x2000,0x962460,0x30000908,0x7c00100,0x220400,0x30000908,0x7c00100,0x220401,0x30000908,0x7c00100,0x250400,0x30000908,0x7c00100,0x250401,0x30000a03,0x4000006, +0x400400,0x30000c02,0x4000000,0x200000,0x30000c02,0x7c00100,0x230400,0x30000d22,0x2802100,0x962460,0x30000d22,0x2802400,0x962460,0x30000d22,0x2802500,0x962460, +0x30000d22,0x4000000,0x200000,0x30000d22,0x4000010,0x200000,0x30000d22,0x7c00100,0x230400,0x30000d22,0xc000010,0x248000,0x30000d22,0x80000000,0x218960,0x30000e25, +0x2802500,0x962460,0x30000e25,0x7c00100,0x230400,0x30001821,0x2802100,0x962460,0x30001821,0x2806400,0x962460,0x30001821,0x4000000,0x200000,0x30001821,0x6800100, +0x962540,0x30001821,0x6800100,0x962541,0x30001821,0x7c00100,0x230400,0x30001b27,0x2802100,0x962460,0x30001b27,0x2802400,0x962460,0x30001b27,0x4000000,0x200000, +0x30001b27,0x4000000,0x400000,0x30001b27,0x7c00100,0x230400,0x30001c1c,0x2802100,0x1862460,0x30001c1c,0x2802400,0x1862460,0x30001c1c,0x2806400,0x1862460,0x30001c1c, +0x4000000,0x200000,0x30001c1c,0x6800100,0x1862400,0x30001c1c,0x6800100,0x1862540,0x30001c1c,0x7c00100,0x1830000,0x30001c1c,0x7c00100,0x1830001,0x30001c1c,0xc000010, +0x448000,0x30001f0b,0x4000000,0x200000,0x30001f0b,0x4000010,0x200000,0x30001f0b,0x4000010,0x400000,0x30001f0b,0x6800000,0x200000,0x30001f0b,0x7c00100,0x230400, +0x30001f0b,0xc000010,0x248000,0x30002006,0x7c00100,0x250400,0x30002128,0x4000000,0x200000,0x30002128,0x7c00100,0x230400,0x30002128,0xc000010,0x248000,0x3000221d, +0x4000000,0x810000,0x3000221d,0x4000000,0x1410000,0x3000221d,0x4000001,0x445800,0x3000221d,0x7c00100,0x230400,0x30002300,0x4000010,0x400000,0x30002320,0x7c00100, +0x230400,0x30002417,0x2802100,0x1862460,0x30002417,0x2802400,0x1862460,0x30002417,0x2806400,0x1862460,0x30002417,0x2882000,0x1862460,0x30002417,0x4000000,0x200000, +0x30002417,0x4000000,0x400000,0x30002417,0x4000000,0x1600000,0x30002417,0x4000010,0x400000,0x30002417,0x4000010,0x1200000,0x30002417,0x6800000,0x1329800,0x30002417, +0x6800100,0x1862540,0x30002417,0x7c00100,0x1830000,0x30002417,0x7d00100,0x1830000,0x3000251b,0x80000,0xc18820,0x3000251b,0x2802100,0x962460,0x3000251b,0x3c02100, +0x962460,0x3000251b,0x4000000,0x200000,0x3000251b,0x4000006,0x500000,0x3000251b,0x4000010,0x400000,0x3000251b,0x4000010,0xb70000,0x3000251b,0x4000800,0x200000, +0x3000251b,0x6800000,0x1329800,0x3000251b,0x7c00100,0x230400,0x3000251b,0x7c00900,0x230400,0x3000251b,0xc000010,0xb48000,0x3000251b,0x12882000,0x962460,0x30002800, +0x24000000,0x200000,0x30002800,0x2c000010,0x1248002,0x30002800,0x2c000010,0x15248002,0x30002a00,0x4000000,0x1600000,0x30002b01,0x2000,0x962460,0x30002b01,0x2000, +0x8962460,0x30002c00,0x4000000,0x200000,0x30002c00,0x7c00100,0x14220405,0x30002d19,0x7c00100,0x250400,0x30002e00,0x24000000,0x200000,0x30003000,0x24000000,0x200000, +0x30003000,0x24000000,0x4200000,0x30003100,0x24000000,0x200000,0x30003600,0x24000000,0x200000,0x30003700,0x24000000,0x4200000,0x3000392e,0x24000000,0x200000,0x30005013, +0x7c00100,0x2633801,0x30005600,0,0x918820,0x30020600,0x4000400,0x500400,0x30020701,0x2802400,0x962460,0x30020701,0x2802400,0xc62460,0x300a3a11,0x4020000, +0xe00000,0x300a3a11,0x4020000,0xe00002,0x300a3b11,0x4020000,0xe00002,0x300a3c00,0x4008000,0xe00000,0x300a3c00,0x4010000,0xe00000,0x300a3d11,0x7c00300,0xe30002, +0x300a4305,0x7c00100,0xe30400,0x300a4611,0x7c40300,0xe30000,0x300a4829,0x7c00100,0xe30400,0x300a4829,0x7c00900,0x1230400,0x300a4929,0x4000000,0xe00000,0x3040258f, +0x4000010,0x400000,0x3040258f,0x4000010,0xb70000,0x3040258f,0xc000010,0xb48000,0x304028af,0x4000001,0xc41c0b,0x304a3dbf,0x4000000,0xe00000,0x30800c1e,0x2802100, +0x962460,0x30c01c87,0x6800000,0x1329800,0x3100080e,0x7c00120,0x220402,0x3100080e,0x7c00120,0x250402,0x31005167,0x1000,0,0x3100581e,0x4000000,0x200000, +0x3100581e,0x7c00100,0x230400,0x3100590d,0x7c00100,0x230400,0x31005a09,0x7c00100,0x220400,0x31005a09,0x7c00100,0x250400,0x31005b00,0x4000000,0x200000,0x31005c00, +0x80000,0x918820,0x31005c00,0x2802000,0x962460,0x31005c00,0x2802400,0x962460,0x31005c00,0x4000000,0x200000,0x31005c00,0x4000000,0x200001,0x31005c00,0x6800000, +0x962540,0x31005c00,0x6800400,0x962540,0x31005c01,0x2802400,0x962460,0x31005d00,0x4000020,0x200005,0x31005d00,0x6800020,0x1329805,0x31005d00,0x7c00120,0x220405, +0x31005d00,0x7c00120,0x250405,0x31006000,0x82000,0x8962460,0x31006000,0x180000,0x918820,0x310a5e11,0x7c40300,0xe30000,0x310a5f11,0x7c00300,0xe30001,0x32000419, +0x7c00100,0x250400,0x3200080e,0x4000020,0x200000,0x3200080e,0x7c00100,0x220400,0x3200080e,0x7c00100,0x250400,0x32000908,0x7c00100,0x220400,0x32000908,0x7c00100, +0x250400,0x32000c02,0x7c00100,0x230400,0x32000e25,0x7c00100,0x230400,0x32001d0c,0x7c00100,0x230400,0x32002800,0x80000,0x1e18820,0x32002800,0x80020,0x218820, +0x32002800,0x4000001,0x445802,0x32002800,0x24000000,0x200000,0x32002800,0x24000000,0x200002,0x32002800,0x24000020,0x200000,0x32002800,0x2c000010,0x1248002,0x32002919, +0x7c00100,0x22040f,0x32002a00,0x4000000,0x1600000,0x32002b01,0x2000,0x962460,0x32002b01,0x2802000,0x962460,0x32002b01,0x2802020,0x962460,0x32002c00,0x4000000, +0x200000,0x32002c00,0x4000020,0x200000,0x32002c00,0x4000020,0x200005,0x32002c00,0x7c00120,0x220405,0x32002c00,0x7c00120,0x250405,0x32002e00,0x24000020,0x200000, +0x32002f00,0x24000020,0x200000,0x32003000,0x24000000,0x200000,0x32003000,0x24000020,0x200000,0x32003500,0x24000000,0x200000,0x32003600,0x24000020,0x200000,0x32003600, +0x24000020,0x14200000,0x32003700,0x24000000,0x200000,0x32003700,0x24000000,0x4100000,0x32003700,0x24000000,0x4200000,0x32003700,0x24000000,0x14200000,0x32003800,0x24000000, +0x810000,0x32003800,0x24000000,0x1410000,0x32005102,0x4000000,0x1500008,0x32005502,0x7c00100,0x230400,0x32006108,0x7c00100,0x220400,0x32006108,0x7c00100,0x250400, +0x3200622a,0x2802100,0x962460,0x3200622a,0x2806000,0x962460,0x3200622a,0x7c00100,0x230400,0x3200632b,0x2802100,0x962460,0x3200632b,0x2806000,0x962460,0x3200632b, +0x7c00100,0x230400,0x3200642c,0x2802100,0x962460,0x3200642c,0x7c00100,0x230400,0x3200652d,0x2802100,0x962460,0x3200652d,0x7c00100,0x230400,0x32006600,0x24000020, +0x200000,0x32006700,0x24000020,0x200000,0x32006800,0x24000020,0x200000,0x32006800,0x24000020,0x14200000,0x32006900,0x24000020,0x200000,0x32006900,0x24000020,0x810000, +0x32006900,0x24000020,0x1410000,0x32006a00,0x24000020,0x200000,0x32006a00,0x24000020,0x200001,0x32006a00,0x24000020,0x200002,0x32020701,0x2882000,0xc62460,0x32023300, +0x4000000,0x100000,0x32026c01,0x12882000,0x962460,0x32026c01,0x12882000,0x8962460,0x32065700,0x4000000,0x810011,0x32065700,0x4000000,0x1410011,0x32086600,0x24000020, +0x810000,0x32086600,0x24000020,0x1410000,0x32086900,0x24000020,0x810000,0x32086900,0x24000020,0x1410000,0x320a3600,0x24000020,0x34200000,0x320a3d11,0x7c00100,0x1230400, +0x320a3e14,0x7c00100,0xe30010,0x320a3e14,0x7c00100,0x2530000,0x320a3f16,0x7c00100,0xe30c10,0x320a4400,0x4000000,0xe00003,0x320a4929,0x4000000,0xe00000,0x320a4f11, +0x7c00300,0xe30001,0x320a6b16,0x7c00100,0x2530c00,0x3240638b,0xc000010,0x448000,0x324a3dc2,0x4000000,0x14e00000,0x324a3dc2,0x7c00100,0x1230400,0x324a3fbd,0x4000002, +0x1200c00,0x324a53ba,0x24000000,0xe00000,0x32820701,0x2802000,0x962460,0x40000419,0x7c00100,0x220400,0x40000519,0x7c00100,0x220400,0x40000600,0x4000400,0x200400, +0x4000080e,0x7c00100,0x220400,0x4000080e,0x7c00100,0x250400,0x4000080e,0x7c00100,0x250402,0x40000c02,0x2802100,0x962460,0x40000c02,0x2802400,0x962460,0x40000c02, +0x2802500,0x962460,0x40000c02,0x4000000,0x200000,0x40000c02,0x4000000,0x1071400,0x40000c02,0x7c00100,0x230400,0x40000c02,0x80000000,0x218960,0x40000d22,0x7c00100, +0x230400,0x40000f0a,0x7c00100,0x230400,0x40001004,0x7c00100,0x230400,0x40001110,0x2802100,0x962460,0x40001110,0x6800100,0x962540,0x4000120f,0x2802100,0x962460, +0x4000120f,0x4000000,0x1600000,0x4000120f,0x7c00100,0x230400,0x4000131f,0x7c00100,0x230400,0x40001423,0x4000000,0x200000,0x40001423,0x4000000,0x1600000,0x40001615, +0x2802400,0x962460,0x40001615,0x7c00100,0x230400,0x40002417,0x2802400,0x1862460,0x40002417,0x4000000,0x200000,0x40002800,0x6800000,0x201c00,0x40002800,0x24000002, +0x200000,0x40002c00,0x4000000,0x200002,0x40003000,0x24000000,0x14200000,0x40003000,0x24000020,0x200000,0x40003700,0x24000000,0x200000,0x40003700,0x24000000,0x4200000, +0x40003700,0x24000000,0x14200000,0x40005a09,0x7c00100,0x220400,0x40005a09,0x7c00100,0x250400,0x40005d00,0x7c00120,0x220405,0x40006f30,0x2802100,0x962460,0x40006f30, +0x2802400,0x962460,0x40006f30,0x4000000,0x200000,0x40006f30,0x6800000,0x1329800,0x40006f30,0x6800100,0x962540,0x40006f30,0x7c00100,0x230400,0x40006f30,0xc000010, +0xb48000,0x40007034,0x7c00100,0x1830000,0x40007117,0x4000000,0x200000,0x40007208,0x7c00100,0x220400,0x4000720e,0x7c00100,0x220400,0x4000720e,0x7c00500,0x22040e, +0x4000720e,0x7c00500,0x22040f,0x40007219,0x7c00100,0x220400,0x40007219,0x7c00500,0x220400,0x40007219,0x7c00500,0x22040e,0x40007219,0x7c00500,0x22040f,0x40007300, +0x24000000,0x200000,0x40007300,0x24000000,0x14200000,0x40007400,0x4000000,0x200000,0x40007531,0x7c00100,0x230400,0x40007631,0x7c00100,0x230400,0x40007835,0x4000010, +0x400000,0x40007835,0x7c00100,0x230400,0x40007933,0x7c00100,0x230400,0x40007a32,0x6800000,0x1329800,0x40007a32,0x7c00100,0x230400,0x40007b2f,0x7c00100,0x230400, +0x40007c00,0x4000000,0x200000,0x40020701,0x2802400,0x962460,0x40020701,0x2802400,0xc62460,0x40023300,0x4000000,0x200000,0x40027d01,0x12882000,0x962460,0x400a3700, +0x24000000,0x34200000,0x400a3700,0x24000000,0x34e00000,0x400a4400,0x4000000,0xe0000d,0x400a4412,0x4000000,0xe00002,0x400a4412,0x4000000,0xe00003,0x400a4500,0x4000000, +0xe0000d,0x400a5300,0x4000000,0x810010,0x400a5300,0x4000000,0x1410010,0x404077fc,0x4000000,0x200000,0x404077ff,0x4000000,0x200000,0x404077ff,0x4000000,0x400000, +0x40c0147e,0x4000000,0x200000,0x40c051fa,0x4000000,0x200000,0x41000419,0x7c00100,0x220400,0x41000419,0x7c00100,0x250400,0x4100080e,0x7c00100,0x220400,0x4100080e, +0x7c00100,0x250400,0x41000908,0x7c00100,0x220400,0x41000908,0x7c00100,0x250400,0x41000b13,0x2802000,0x962460,0x41000b13,0x2802100,0x962460,0x41000b13,0x4000000, +0xb00000,0x41000c02,0x2802100,0x962460,0x41000c02,0x4000000,0x1500000,0x41000c02,0xc000010,0xb48000,0x41000f0a,0x7c00100,0x230400,0x41001004,0x7c00100,0x230400, +0x41001423,0x7c00100,0x230400,0x41001b27,0x4000000,0x500000,0x41001d0c,0x7c00100,0x230400,0x41001d0c,0x7c00100,0x23040f,0x41001f0b,0x2802400,0x962460,0x41001f0b, +0x4000000,0x200000,0x41001f0b,0x7c00100,0x230400,0x41002800,0x24000000,0x200000,0x41002800,0x24000000,0x400000,0x41002919,0x7c00100,0x22040e,0x41002a00,0x4000000, +0x1600000,0x41002b01,0x2802020,0x962460,0x41002c00,0x4000000,0x200000,0x41002c00,0x7c00120,0x220405,0x41003000,0x24000000,0x200000,0x41003700,0x24000000,0x4200000, +0x41003700,0x24000000,0x14200000,0x41003700,0x24000000,0x14e00000,0x41005d00,0x7c00120,0x220405,0x41006600,0x24000020,0x200000,0x41006600,0x24000020,0x810000,0x41006600, +0x24000020,0x1410000,0x41007208,0x7c00100,0x22040f,0x41007219,0x7c00100,0x220400,0x41007300,0x24000000,0x200000,0x41007e0e,0x2802000,0x962460,0x41007e0e,0x4000000, +0x200000,0x41007f0e,0x4000000,0x200000,0x41007f0e,0x7c00100,0x230400,0x41008002,0x7c00100,0x230400,0x41008137,0x2802100,0x962460,0x41008137,0x4000000,0x200000, +0x41008137,0x6800100,0x962540,0x41008137,0x7c00100,0x230400,0x41008301,0x2802000,0x962460,0x41008407,0x4000000,0x200000,0x41008407,0x4000000,0x400000,0x41008407, +0x4000000,0xb00000,0x41008407,0x7c00100,0x220400,0x41008407,0x7c00100,0x250400,0x4100850b,0x7c00100,0x230400,0x4100860b,0x4000000,0x200000,0x4100860b,0x7c00100, +0x230400,0x4100870c,0x7c00100,0x220400,0x41008838,0x7c00100,0x220400,0x41008838,0x7c00100,0x250400,0x41008939,0x2802000,0x962460,0x41008939,0x2802100,0x962460, +0x41008939,0x2806000,0x962460,0x41008939,0x4000000,0x200000,0x41008939,0x4000000,0x400000,0x41008939,0x7c00100,0x230400,0x41008939,0xc000010,0x448000,0x41008a00, +0x4000400,0x200400,0x41008b3b,0x4000000,0x1800000,0x41008b3b,0x6800000,0x1329800,0x41008b3b,0x7c00100,0x1830000,0x41008b3b,0x7e00100,0x1830000,0x41008c3d,0x4000010, +0x400000,0x41008c3d,0x7c00100,0x230400,0x41008d0e,0x7c00100,0x22040f,0x41008d19,0x7c00100,0x220400,0x41008d19,0x7c00100,0x22040f,0x41008e00,0x24000000,0x200000, +0x41008e00,0x24000000,0x400000,0x41008e00,0x24000000,0x1710000,0x41008e00,0x24000006,0x400000,0x41008f3a,0x2802100,0x962460,0x41008f3a,0x2806000,0x962460,0x41008f3a, +0x4000000,0x200000,0x41008f3a,0x6800100,0x962540,0x41008f3a,0x7c00100,0x230400,0x4100903c,0x7c00100,0x230400,0x4100903c,0x7c00100,0x23040f,0x41020701,0x2802000, +0x962460,0x41020701,0x2802000,0xc62460,0x410a3700,0x24000000,0x34200000,0x410a3700,0x24000000,0x34e00000,0x410a4412,0x4000000,0xe00003,0x410a4711,0x7c40300,0xe30000, +0x410a4f11,0x7c00300,0xe30001,0x410a9100,0x4000000,0x800010,0x410a9100,0x4000000,0x810010,0x410a9100,0x4000000,0x870010,0x410a9100,0x4000000,0xb00010,0x410a9100, +0x4000000,0xf00010,0x410a9100,0x4000000,0x1001410,0x410a9100,0x4000000,0x1071010,0x410a9100,0x4000000,0x1071410,0x410a9100,0x4000000,0x1410010,0x41408ac5,0x4000400, +0x200000,0x414a82bf,0x4000000,0xe00000,0x41808300,0x2802000,0x962460,0x41c0147e,0x6800000,0x1329800,0x50000419,0x7c00100,0x220400,0x50000419,0x7c00100,0x250400, +0x5000080e,0x7c00100,0x220400,0x50000908,0x7c00100,0x220400,0x50000908,0x7c00100,0x250400,0x50000b13,0x2802500,0x962460,0x50000f0a,0x7c00100,0x230400,0x50001615, +0x2802100,0x962460,0x50001615,0x7c00100,0x230400,0x50002b01,0x2802020,0x962460,0x50002c00,0x4000000,0x200000,0x50002c19,0x7c00100,0x220400,0x50002d19,0x7c00100, +0x220400,0x50003000,0x24000000,0x200000,0x50003000,0x24000020,0x200000,0x50003700,0x24000000,0x4200000,0x50005d00,0x7c00120,0x220405,0x50005d00,0x7c00120,0x250405, +0x50006108,0x7c00100,0x220400,0x50006108,0x7c00100,0x250400,0x50006600,0x24000020,0x200000,0x50007300,0x24000000,0x200000,0x50008301,0x2802400,0x962460,0x50008a00, +0x7c00500,0x230400,0x50009257,0x2802400,0x962460,0x50009257,0x4000000,0x200000,0x50009257,0x4000010,0x1071400,0x50009257,0x6800000,0x1329800,0x50009257,0x7c00100, +0x230400,0x50009257,0x7c00500,0x230400,0x50009257,0x7c00900,0x230400,0x50009257,0xc000010,0xb48000,0x5000933e,0x2802100,0x962460,0x5000933e,0x2802400,0x962460, +0x5000933e,0x4000000,0x200000,0x5000933e,0x4000000,0x400000,0x5000933e,0x4000010,0x400000,0x5000933e,0x6800000,0x1329800,0x5000933e,0x6800100,0x962540,0x5000933e, +0x6800100,0x962541,0x5000933e,0x6804400,0x962540,0x5000933e,0x7c00100,0x230400,0x5000933e,0x7c00100,0x230401,0x5000933e,0xc000010,0x448000,0x50009419,0x7c00100, +0x220400,0x50009419,0x7c00100,0x250400,0x50009500,0x4000400,0x200400,0x5000965a,0x4000000,0x500000,0x5000965a,0x7c00100,0x230400,0x5000965a,0xc000010,0xb48000, +0x5000975b,0x4000000,0x200000,0x5000975b,0x4000010,0x400000,0x5000975b,0x7c00100,0x230400,0x50009865,0x7c00100,0x230400,0x50009965,0x4000010,0x400000,0x50009965, +0x7c00100,0x230400,0x50409abf,0x4000000,0x200000,0x5100080e,0x7c00100,0x220400,0x5100080e,0x7c00100,0x250400,0x51000c02,0x2802100,0x962460,0x51000c02,0x4000000, +0x1500000,0x51000c02,0x4000020,0x200000,0x51000c02,0x7c00100,0x230400,0x51000f0a,0x7c00100,0x230400,0x51000f0a,0x7c00500,0x230400,0x51001110,0x2802100,0x962460, +0x5100131f,0x2802100,0x962460,0x51001423,0x7c00100,0x230400,0x51001524,0x2802100,0x962460,0x51001524,0x4000000,0x200000,0x51001524,0x7c00100,0x230400,0x5100171a, +0x2802100,0x962460,0x5100171a,0x4000000,0x200000,0x5100171a,0x4000000,0x1500000,0x5100171a,0x7c00100,0x230400,0x51001b27,0x4000000,0x200000,0x51001b27,0x4000000, +0x400000,0x51001b27,0x4000000,0x500000,0x51001b27,0x7c00100,0x230400,0x51001c1c,0x2802100,0x1862460,0x51001c1c,0x2802500,0x1862460,0x51001c1c,0x2806400,0x1862460, +0x51001c1c,0x4000000,0x1800000,0x51001c1c,0x6800000,0x1329800,0x51001c1c,0x6800100,0x1862400,0x51001c1c,0x6800100,0x1862540,0x51001c1c,0x6800500,0x1862400,0x51001c1c, +0x7c00100,0x1830000,0x5100251b,0x7c00100,0x230400,0x51002619,0x7c00100,0x220400,0x51002619,0x7c00100,0x250400,0x51002800,0x80020,0x218820,0x51002c00,0x4000000, +0x200000,0x51002d19,0x7c00100,0x230400,0x51003700,0x24000000,0x4200000,0x51003700,0x24000000,0x4e00000,0x51005201,0x2802400,0x962460,0x51005c00,0x4000000,0x200000, +0x51006108,0x7c00100,0x220400,0x51006108,0x7c00100,0x250400,0x51006600,0x24000020,0x200000,0x51006600,0x24000020,0x810000,0x51006600,0x24000020,0x1410000,0x51007300, +0x24000000,0x200000,0x51007300,0x24000020,0x200000,0x51008002,0x7c00100,0x230400,0x51008301,0x2802000,0x962460,0x51008301,0x2802400,0x962460,0x51008a00,0x7c00500, +0x230400,0x51008e00,0x24000000,0x200000,0x51008e00,0x24000000,0x400000,0x51008e00,0x24000000,0x810000,0x51008e00,0x24000000,0x1400000,0x51008e00,0x24000000,0x1410000, +0x51008e00,0x24000000,0x1710000,0x51008e00,0x24000002,0x200000,0x51008e00,0x24000500,0x230400,0x51008e00,0x2c000010,0xb48000,0x51009419,0x7c00100,0x220400,0x51009419, +0x7c00100,0x22040e,0x51009419,0x7c00100,0x22040f,0x51009419,0x7c00100,0x250400,0x51009500,0x4000400,0x200400,0x51009500,0x7c00500,0x230400,0x51009519,0x7c00100, +0x220400,0x51009519,0x7c00100,0x22040f,0x51009519,0x7c00100,0x230400,0x51009519,0x7c00100,0x250400,0x51009b71,0x2802100,0x962460,0x51009b71,0x6800000,0x1329800, +0x51009b71,0x6800100,0x962540,0x51009b71,0x6804400,0x962540,0x51009b71,0x7c00100,0x230400,0x51009c52,0x2802100,0x962460,0x51009c52,0x2802400,0x962460,0x51009c52, +0x2802d00,0x962460,0x51009c52,0x4000010,0x400000,0x51009c52,0x6800000,0x1329800,0x51009c52,0x6800100,0x962540,0x51009c52,0x7c00100,0x230400,0x51009c52,0xc000010, +0x448000,0x51009d6d,0x6800000,0x1329800,0x51009d6d,0x7c00100,0x230400,0x51009d6d,0x7c00500,0x230400,0x51009d6d,0x7c00d00,0x230400,0x51009d6d,0xc000010,0x448000, +0x51009e08,0x2802100,0x962460,0x51009f63,0x4000010,0x400000,0x51009f63,0x6800000,0x1329800,0x51009f63,0x7c00100,0x230400,0x51009f63,0x7c00900,0x230400,0x51009f63, +0xc000010,0x448000,0x51009f63,0xc000010,0xb48000,0x5100a008,0x2000,0x962460,0x5100a008,0x2802400,0x962460,0x5100a008,0x4000000,0x200000,0x5100a008,0x7c00100, +0x220400,0x5100a008,0x7c00100,0x230400,0x5100a008,0x7c00100,0x250400,0x5100a008,0x7c00500,0x230400,0x5100a16f,0x2806400,0x962460,0x5100a16f,0x6800000,0x1329800, +0x5100a16f,0x6800100,0x962540,0x5100a16f,0x7c00100,0x230400,0x5100a16f,0xc000010,0x448000,0x5100a24f,0x2802100,0x962460,0x5100a24f,0x2802400,0x962460,0x5100a24f, +0x6800000,0x1329800,0x5100a24f,0x7c00100,0x230400,0x5100a24f,0xc000010,0x448000,0x5100a36e,0x2802100,0x962460,0x5100a36e,0x4000000,0x200000,0x5100a36e,0x6800100, +0x962540,0x5100a36e,0x6804400,0x962540,0x5100a36e,0x7c00100,0x230400,0x5100a442,0x2802100,0x962460,0x5100a442,0x4000000,0x200000,0x5100a442,0x6800000,0x1329800, +0x5100a442,0x6800100,0x962540,0x5100a442,0x7c00100,0x230400,0x5100a442,0xc000010,0x448000,0x5100a500,0x4000000,0x200000,0x5100a600,0x4000000,0x200000,0x5100a601, +0x2802000,0x962460,0x5100a76b,0x7c00100,0x230400,0x5100a868,0x7c00100,0x230400,0x5100a96c,0x4000000,0x200000,0x5100a96c,0x7c00100,0x230400,0x5100aa00,0x4000000, +0x4e00000,0x5100ab00,0x4000000,0x4e00000,0x51086600,0x24000020,0x810000,0x51086600,0x24000020,0x1410000,0x510a4005,0x7c00100,0xe30400,0x510a4711,0x7c40300,0xe30000, +0x510a7300,0x24000000,0x34200000,0x510aaa00,0x4000000,0x34e00000,0x5140a2f3,0x4000400,0x400000,0x514a82bf,0x4000000,0xe00000,0x51802bb1,0x2802000,0x962460,0x51c00908, +0x2802400,0x962460,0x51c0a008,0x2802400,0x962460,0x52000f0a,0x2802100,0x962460,0x52000f0a,0x6800100,0x962540,0x52000f0a,0x7c00100,0x230400,0x52001004,0x4000000, +0x1600000,0x52001b00,0x4000000,0x200000,0x52001c1c,0x2802100,0x1862460,0x52001c1c,0x6800100,0x1862400,0x52001c1c,0x6800500,0x1862400,0x52001e12,0x7c00100,0x2230500, +0x52001e12,0x7c00100,0x2330520,0x52002128,0x4000002,0x400000,0x52002128,0x7c00100,0x230400,0x52002a00,0x4000000,0x1500000,0x52002a00,0x4000000,0x1600000,0x52002d00, +0x4000000,0x200006,0x52003000,0x24000000,0x200000,0x52006108,0x7c00100,0x220400,0x52006108,0x7c00100,0x250400,0x52008301,0x2802400,0x962460,0x52008407,0x2802400, +0x962460,0x52008407,0x7c00100,0x220400,0x52008407,0x7c00100,0x250400,0x52008b3b,0x6800000,0x1800000,0x52008b3b,0x7c00100,0x1830000,0x52008e00,0x24000000,0x400000, +0x52009419,0x7c00100,0x250400,0x5200975b,0x4000000,0x200000,0x5200ac7e,0x2802000,0x962460,0x5200ac7e,0x2802100,0x962460,0x5200ac7e,0x2802400,0x962460,0x5200ac7e, +0x4000010,0x200000,0x5200ac7e,0x7c00100,0x230400,0x5200ac7e,0xc000010,0x248000,0x5200ad28,0x7c00100,0x230400,0x5200ae6a,0x2802100,0x1862460,0x5200ae6a,0x2802400, +0x962460,0x5200ae6a,0x2802400,0x1862460,0x5200ae6a,0x2806000,0x1862460,0x5200ae6a,0x4000000,0x1800000,0x5200ae6a,0x6800000,0x1329800,0x5200ae6a,0x6800100,0x1862400, +0x5200ae6a,0x6800100,0x1862540,0x5200ae6a,0x7c00100,0x1830000,0x5200ae6a,0x7c00900,0x1830000,0x5200ae6a,0xc000010,0x1848000,0x5200b083,0x4000010,0x400000,0x5200b083, +0x7c00100,0x230400,0x5200b083,0xc000010,0x448000,0x5200b182,0x2802400,0x962460,0x5200b182,0x4000000,0x200000,0x5200b182,0x4000010,0x400000,0x5200b182,0x7c00100, +0x230400,0x5200b182,0xc000010,0x448000,0x5200b30a,0x2802400,0x962460,0x5200b30a,0x4000000,0x200000,0x5200b30a,0x7c00100,0x230400,0x5200b54e,0x2802100,0x962460, +0x5200b54e,0x2802400,0x962460,0x5200b54e,0x4000000,0x200000,0x5200b54e,0x4000010,0x400000,0x5200b54e,0x6800000,0x1329800,0x5200b54e,0x6800100,0x962540,0x5200b54e, +0x6804400,0x962540,0x5200b54e,0x7c00100,0x230400,0x5200b54e,0xc000010,0x448000,0x5200b61c,0x4000000,0x1800000,0x5200b61c,0x6800500,0x1862400,0x5200b61c,0x7c00100, +0x1830000,0x5200b61c,0x7c00900,0x1830000,0x5200b77f,0x2802100,0x1862460,0x5200b77f,0x2802400,0x1862460,0x5200b77f,0x4000000,0x1800000,0x5200b77f,0x4000010,0x1800000, +0x5200b77f,0x7c00100,0x1830000,0x5200b77f,0x7c00500,0x1830000,0x5200b77f,0x7c00900,0x1830000,0x5200b77f,0x7e00100,0x1830000,0x5200b873,0x2802100,0x962460,0x5200b873, +0x2806400,0x962460,0x5200b873,0x6800000,0x1329800,0x5200b873,0x6800100,0x962540,0x5200b873,0x6800400,0x962540,0x5200b873,0x7c00100,0x230400,0x5200b873,0xc000010, +0x448000,0x5200b912,0x7c00100,0x2230500,0x5200b912,0x7c00100,0x2330520,0x5200ba74,0x4000000,0x200000,0x5200ba74,0x4000010,0x400000,0x5200ba74,0x7c00100,0x230400, +0x5200bb85,0x4000000,0x200000,0x5200bb85,0x7c00100,0x230400,0x5200bc75,0x4000000,0x400000,0x5200bc75,0x4000010,0x400000,0x5200bc75,0x7c00100,0x230400,0x5200bd7d, +0x4000000,0x200000,0x5200bd7d,0x7c00100,0x230400,0x5200be7a,0x4000000,0x200000,0x5200be7a,0x7c00100,0x230400,0x5200bf58,0x7c00100,0x230400,0x5200c002,0x4000000, +0x200000,0x5200c178,0x2802000,0x962460,0x5200c178,0x2802100,0x962460,0x5200c178,0x2802400,0x962460,0x5200c178,0x2806400,0x962460,0x5200c178,0x4000000,0x200000, +0x5200c178,0x6800100,0x962540,0x5200c178,0x7c00100,0x230400,0x5200c178,0x7c00100,0x230401,0x5200c178,0xc000010,0x448000,0x5200c178,0x80000000,0x218960,0x5200c247, +0x7c00100,0x230400,0x5200c247,0x7c00100,0x830400,0x5200c247,0x7c00100,0x1430400,0x5200c300,0x4000000,0x200003,0x52022d00,0x4000000,0x100006,0x52023700,0x24000000, +0x4100000,0x52023700,0x24000000,0x4e00000,0x52023700,0x24000000,0x14100000,0x52023700,0x24000000,0x14e00000,0x52023700,0x24000000,0x96800000,0x52024400,0x4000000,0x100000, +0x52027300,0x24000000,0x100000,0x5202c300,0x4000000,0x100000,0x5202c300,0x4000000,0x100002,0x5202c300,0x4000000,0x100003,0x5202c300,0x4000000,0x10000d,0x5202c300, +0x4000100,0x150400,0x5202c300,0x4000100,0x15040d,0x5202c300,0x4000100,0x14150400,0x520a1e12,0x7c00100,0x2130480,0x520a3700,0x24000000,0x34e00000,0x520a3800,0x24000000, +0x34100000,0x520a4711,0x7c40300,0xe30000,0x520a4f11,0x7c00300,0xe30001,0x520a7300,0x24000000,0x34100000,0x520ab412,0x7c00100,0x2130480,0x520ac400,0x4000000,0xe00002, +0x520ac400,0x4000000,0xe0000d,0x520ac400,0x4000000,0x34e0000d,0x520ac414,0x4000000,0xe0000d,0x520ac511,0x7c40300,0xe30000,0x5240af91,0x7c00100,0x230400,0x5240af96, +0x4000400,0x200000,0x5240af98,0x6800400,0x962540,0x5240af98,0x7c00100,0x230400,0x5240afa2,0x7c00100,0x230400,0x5240afa4,0x7c00100,0x230400,0x5240b2c7,0x4000000, +0x200000,0x5240b2c7,0x4000000,0x1500000,0x5240b2d2,0x4000000,0x200000,0x5240b2e0,0x4000000,0x200000,0x5240b5f6,0x7c00900,0x230400,0x524a44bf,0x4000000,0xe00003, +0x5280af91,0x2802400,0x962460,0x5280af92,0x2802400,0x962460,0x5280af98,0x2802400,0x962460,0x5280af9a,0x2802400,0x962460,0x5280af9c,0x2802400,0x962460,0x52c0b3ed, +0x2802400,0x962460,0x52c0b3f1,0x7c00100,0x230400,0x60000c02,0x2802100,0x962460,0x60000c02,0x7c00100,0x230400,0x60000f0a,0x2802100,0x962460,0x60000f0a,0x6800100, +0x962540,0x60000f0a,0x7c00100,0x230400,0x6000131f,0x4000000,0x200000,0x6000171a,0x7c00100,0x230400,0x6000171a,0x7c00100,0x230560,0x60001b27,0x2802100,0x962460, +0x60001b27,0x4000000,0xc00000,0x60001b27,0x7c00100,0x230400,0x60001f0b,0x2802400,0x962460,0x60002919,0x7c00100,0x22040e,0x60002a00,0x4000000,0x1600000,0x60003000, +0x24000000,0x14200000,0x60003000,0x24000000,0x14e00000,0x60003700,0x24000000,0x4200000,0x60003800,0x24000000,0x1710000,0x60005102,0x4000000,0x200000,0x60006108,0x7c00100, +0x220400,0x60006108,0x7c00100,0x250400,0x60006600,0x24000020,0x200000,0x60008301,0x2802000,0x962460,0x6000903c,0x2806000,0x962460,0x6000903c,0x4000000,0x400000, +0x60009519,0x7c00100,0x220400,0x60009519,0x7c00100,0x250400,0x6000a008,0x7c00100,0x220400,0x6000a008,0x7c00100,0x250400,0x6000c300,0x4000000,0x3a703580,0x6000c654, +0x2802000,0x962460,0x6000c654,0x4000010,0x200000,0x6000c654,0x7c00100,0x230400,0x6000c73f,0x2802000,0x962460,0x6000c73f,0x2802100,0x962460,0x6000c73f,0x4000000, +0x200000,0x6000c73f,0x6800100,0x962540,0x6000c73f,0x6804000,0x962540,0x6000c73f,0x7c00100,0x230400,0x6000c80b,0x7c00100,0x230400,0x6000c941,0x2802100,0x962460, +0x6000c941,0x2806000,0x962460,0x6000c941,0x4000000,0x200000,0x6000c941,0x4000010,0x200000,0x6000c941,0x6800000,0x1329800,0x6000c941,0x6800100,0x962540,0x6000c941, +0x7c00100,0x230400,0x6000c941,0xc000010,0x448000,0x6000ca82,0x7c00100,0x230400,0x6000cc00,0x4000000,0x4e00000,0x6000d000,0x4000000,0x200000,0x6002c300,0x4000000, +0x100000,0x6002c300,0x4000000,0x10000d,0x6002c300,0x4000100,0x150400,0x6002c300,0x4000100,0x15040d,0x6002c300,0x4000100,0x14150400,0x600a3000,0x24000000,0x34200000, +0x600a3000,0x24000000,0x34e00000,0x600a3700,0x24000000,0x34200000,0x600a3800,0x24000000,0x34200000,0x600a3800,0x24000000,0xb6800000,0x600a4305,0x7c00100,0xe30400,0x600ac300, +0x4000000,0x34100000,0x600ac400,0x4000000,0x14e0000d,0x600ac400,0x4000000,0x34e0000d,0x600acb14,0x7c00100,0xe30000,0x600acb16,0x7c00100,0xe30c00,0x600acc00,0x4000000, +0x34e00000,0x600acd00,0x4000000,0x34200000,0x600acd00,0x4000000,0x34e00000,0x600acd00,0x4000000,0xb6800000,0x600ace00,0x4000000,0x34e00000,0x600ace00,0x4000000,0xb6800000, +0x600acf00,0x4000000,0x34e00000,0x600acf00,0x4000000,0xb6800000,0x600ad111,0x7c40300,0xe30000,0x604ac4bf,0x4000000,0x34e00003,0x61000a03,0x4000000,0x1600000,0x61000c02, +0x80000000,0x218960,0x6100120f,0x4000000,0x200000,0x61001a18,0x7c00100,0x1830000,0x61001d0c,0x7c00100,0x230400,0x61001d0c,0x7c00100,0x250400,0x61006600,0x24000020, +0x200000,0x61008407,0x7c00100,0x220400,0x61008407,0x7c00100,0x250400,0x6100870c,0x7c00100,0x220400,0x61008e00,0x24000000,0x200000,0x61008e00,0x24000000,0x400000, +0x61008e00,0x24000002,0x300000,0x6100903c,0x7c00100,0x230400,0x61009519,0x7c00100,0x220400,0x61009519,0x7c00100,0x250400,0x61009519,0x7c00500,0x22040f,0x61009b71, +0x2802100,0x962460,0x61009b71,0x2806400,0x962460,0x61009b71,0x7c00100,0x230400,0x6100a008,0x2802100,0x962460,0x6100c300,0x4000000,0x20000f,0x6100cd00,0x4000000, +0x200000,0x6100d202,0x2802400,0x962460,0x6100d202,0x2802500,0x962460,0x6100d202,0x7c00100,0x230400,0x6100d302,0x4000020,0x200000,0x6100d302,0x7c00120,0x230405, +0x6100d476,0x2802100,0x962460,0x6100d476,0x2802100,0x962461,0x6100d476,0x2806400,0x962460,0x6100d476,0x4000000,0x400000,0x6100d476,0x6800000,0x1329800,0x6100d476, +0x6800100,0x962540,0x6100d476,0x7c00100,0x230400,0x6100d476,0xc000010,0x448000,0x6100d573,0x2802100,0x962460,0x6100d573,0x2806400,0x962460,0x6100d573,0x6800100, +0x962540,0x6100d573,0x7c00100,0x230400,0x6100d573,0x7c00900,0x230400,0x6100d573,0xc000010,0x448000,0x6100d68d,0x7c00100,0x230400,0x6100d756,0x7c00100,0x230400, +0x6100d85c,0x2802500,0x962460,0x6100d85c,0x6800100,0x962540,0x6100d85c,0x7c00100,0x230400,0x6100d85c,0x7c00500,0x230400,0x6100d997,0x2802100,0x962460,0x6100d997, +0x4000000,0x200000,0x6100d997,0x4000000,0x400000,0x6100d997,0x6800000,0x1329800,0x6100d997,0x6800100,0x962540,0x6100d997,0x6804400,0x962540,0x6100d997,0x7c00100, +0x230400,0x6100d997,0x7c00100,0x230560,0x6100d997,0xc000010,0x448000,0x6100da98,0x6800000,0x1329800,0x6100da98,0x7c00100,0x230400,0x6100db71,0x4000000,0x200000, +0x6100dc99,0x2802100,0x962460,0x6100dc99,0x2802400,0x962460,0x6100dc99,0x6800000,0x1329800,0x6100dc99,0x6800100,0x962540,0x6100dc99,0x6804400,0x962540,0x6100dc99, +0x7c00100,0x230400,0x610a4711,0x7c40300,0xe30000,0x610a4f11,0x7c00300,0xe30001,0x610ace00,0x4000000,0x34e00000,0x6140af96,0x7c00100,0x230400,0x6140af98,0x7c00100, +0x230400,0x6180af93,0x2802400,0x962460,0x62002a00,0x4000000,0x1600000,0x63002800,0x80000,0x918820,0x63c00c14,0x80000,0x918820,0x7000080e,0x7c00100,0x250400, +0x70000a03,0x4000000,0x200000,0x70000c00,0x80000000,0x218960,0x70000f0a,0x7c00100,0x230400,0x70001004,0x7c00100,0x230400,0x70001524,0x2802100,0x962460,0x70001524, +0x7c00100,0x230400,0x70001615,0x2802100,0x962460,0x7000171a,0x2802100,0x962460,0x70001821,0x6800000,0x1329800,0x70002320,0x7c00100,0x230400,0x70002a00,0x4000000, +0x1500000,0x70002a00,0x4000000,0x1600000,0x70003000,0x24000000,0x200000,0x70003000,0x24000000,0x14200000,0x70003800,0x24000000,0x4e00000,0x70005201,0x2802400,0x962460, +0x7000581e,0x7c00100,0x230400,0x70006108,0x7c00100,0x220400,0x70006108,0x7c00100,0x250400,0x70006f30,0x7c00100,0x230400,0x70007300,0x24000000,0x200000,0x70007f0e, +0x4000000,0x200000,0x70008301,0x2802100,0x962460,0x70008301,0x2802400,0x962460,0x70008e00,0x24000000,0x200000,0x70008e00,0x24000000,0x400000,0x70008e00,0x24000002, +0x400000,0x70008e00,0x24000008,0x1410000,0x70008e00,0x24000010,0x400000,0x70008e00,0x2c000010,0x448000,0x70009519,0x7c00100,0x220400,0x70009519,0x7c00100,0x230400, +0x70009519,0x7c00100,0x250400,0x70009865,0x7c00100,0x230400,0x70009965,0x4000010,0x400000,0x70009965,0x7c00100,0x230400,0x7000a008,0x7c00100,0x220400,0x7000a008, +0x7c00100,0x250400,0x7000a008,0x7c00500,0x22040f,0x7000a50e,0x4000000,0x200000,0x7000b61c,0x2802500,0x1862460,0x7000b61c,0x6800500,0x1862400,0x7000b61c,0x7c00100, +0x1830000,0x7000c300,0x4000000,0x100000,0x7000c941,0x2806000,0x962460,0x7000cc00,0x4000000,0x4e00000,0x7000cd00,0x4000000,0x200000,0x7000cd00,0x4000000,0x4200000, +0x7000cd00,0x4000000,0x4e00000,0x7000cd00,0x4000000,0x14200000,0x7000cd00,0x4000000,0x14e00000,0x7000cd00,0x4000000,0x96800000,0x7000cf00,0x4000000,0x4e00000,0x7000cf00, +0x4000000,0x14e00000,0x7000d202,0x2802100,0x962460,0x7000d202,0x7c00100,0x230400,0x7000d997,0x7c00100,0x230400,0x7000d997,0xc000010,0x248000,0x7000dd86,0x2802400, +0x962460,0x7000dd86,0x7c00100,0x230400,0x7000dd86,0xc000010,0x448000,0x7000de9f,0x4000000,0x200000,0x7000de9f,0x7c00100,0x230400,0x7000e001,0x2000,0x962460, +0x7000e001,0x2802400,0x962460,0x7000e187,0x2802000,0x962460,0x7000e187,0x2802100,0x962460,0x7000e187,0x4000000,0x200000,0x7000e187,0x7c00100,0x230400,0x7000e187, +0xc000010,0x448000,0x7000e288,0x7c00100,0x230400,0x7000e300,0x4000000,0x200000,0x7000e489,0x2802100,0x962460,0x7000e489,0x2802400,0x962460,0x7000e489,0x6800100, +0x962540,0x7000e489,0x6800100,0x962541,0x7000e489,0x6804400,0x962540,0x7000e489,0x7c00100,0x230400,0x7000e489,0x7c00900,0x230400,0x7000e59d,0x2802100,0x962460, +0x7000e59d,0x2802400,0x962460,0x7000e59d,0x4000000,0x200000,0x7000e59d,0x4000010,0x200000,0x7000e59d,0x6800100,0x962540,0x7000e59d,0x6804400,0x962540,0x7000e59d, +0x7c00100,0x230400,0x7000e59d,0xc000010,0x448000,0x7000e691,0x2802100,0x962460,0x7000e691,0x2802400,0x962460,0x7000e691,0x2806400,0x962460,0x7000e691,0x6800000, +0x1329800,0x7000e691,0x6800100,0x962540,0x7000e691,0x7c00100,0x230400,0x7000e700,0x4000400,0x200400,0x7000e70e,0x7c00100,0x220400,0x7000e719,0x7c00100,0x220400, +0x7000e719,0x7c00500,0x22040f,0x7000e853,0x7c00100,0x230400,0x7000e9a0,0x2802400,0x962460,0x7000e9a0,0x4000000,0x200000,0x7000e9a0,0x4000000,0x500000,0x7000e9a0, +0x7c00100,0x230400,0x7000ea79,0x2802400,0x962460,0x7000ea79,0x4000000,0x200000,0x7000ea79,0x4000000,0xf00000,0x7000ea79,0x4000010,0x400000,0x7000ea79,0x7c00100, +0x230400,0x7000eb8c,0x2802400,0x962460,0x7000eb8c,0x4000000,0x200000,0x7000eb8c,0x7c00100,0x230400,0x7000eca3,0x2802100,0x962460,0x7000eca3,0x2806400,0x962460, +0x7000eca3,0x4000000,0x200000,0x7000eca3,0x6800000,0x1329800,0x7000eca3,0x6800100,0x962540,0x7000eca3,0x7c00100,0x230400,0x7000eca3,0xc000010,0x448000,0x7000ed95, +0x6800000,0x1329800,0x7000ed95,0x7c00100,0x230400,0x7000ed95,0xc000010,0x448000,0x7000ee1c,0x2802500,0x1862460,0x7000ee1c,0x6800000,0x1329800,0x7000ee1c,0x7c00100, +0x1830000,0x7000ee1c,0x7c00900,0x1830000,0x7000ef8f,0x4000000,0x200000,0x7000ef8f,0x7c00100,0x230400,0x7000f08e,0x4000000,0x200000,0x7000f08e,0x7c00100,0x230400, +0x7000f159,0x2802100,0x962460,0x7000f159,0x7c00100,0x230400,0x7000f200,0x4000000,0x200000,0x7000f200,0x4000000,0x1200000,0x7000f200,0x4000000,0x1710000,0x7000f34b, +0x2802400,0x962460,0x7000f34b,0x4000000,0x200000,0x7000f34b,0x4000010,0x400000,0x7000f34b,0x6800000,0x1329800,0x7000f34b,0x7c00100,0x230400,0x7000f34b,0x7c00900, +0x230400,0x7000f34b,0xc000010,0x448000,0x7000f490,0x4000000,0x200000,0x7000f490,0x7c00100,0x230400,0x7000f5a5,0x7c00100,0x230400,0x7000f67b,0x4000000,0x200000, +0x7000f67b,0x4000010,0x200000,0x7000f67b,0x7c00100,0x230400,0x7000f8a6,0x2802100,0x962460,0x7000f8a6,0x2802400,0x962460,0x7000f8a6,0x2806400,0x962460,0x7000f8a6, +0x4000000,0x500000,0x7000f8a6,0x4000010,0xb00000,0x7000f8a6,0x4000800,0x200000,0x7000f8a6,0x6800100,0x962540,0x7000f8a6,0x6800100,0x962541,0x7000f8a6,0x7c00100, +0x230400,0x7000f8a6,0xc000010,0x448000,0x7000f921,0x4000000,0x200000,0x7000fa00,0x4000000,0x200000,0x7000fb9e,0x2802100,0x962460,0x7000fb9e,0x2802400,0x962460, +0x7000fb9e,0x2806400,0x962460,0x7000fb9e,0x4000000,0x200000,0x7000fb9e,0x6800000,0x1329800,0x7000fb9e,0x6800100,0x962540,0x7000fb9e,0x6800100,0x962541,0x7000fb9e, +0x7c00100,0x230400,0x7000fc92,0x4000000,0x200000,0x7000fc92,0x6800000,0x1329800,0x7000fc92,0x7c00100,0x220400,0x7000fc92,0x7c00100,0x230400,0x7000fc92,0x7c00100, +0x250400,0x700acd00,0x4000000,0x34e00000,0x700acd00,0x4000000,0xb6800000,0x700ace00,0x4000000,0x34e00000,0x700acf00,0x4000000,0x34e00000,0x700acf00,0x4000000,0xb6800000, +0x7050df01,0x4000000,0x200000,0x7050f705,0x80000,0x918820,0x7080af96,0x2802400,0x962460,0x7090df01,0x2802400,0x962460,0x70d0e403,0x2802100,0x962460,0x70d0e403, +0x2802400,0x962460,0x70d0e403,0x6800100,0x962540,0x8000120f,0x7c00100,0x230400,0x80001524,0x7c00100,0x230400,0x8000171a,0x7c00100,0x230400,0x80002006,0x7c00100, +0x220400,0x80002006,0x7c00100,0x250400,0x80002a00,0x4000000,0x1500000,0x80002d00,0x4000000,0x200000,0x80005208,0x2802400,0x962460,0x80005c00,0x4000000,0x200000, +0x80007300,0x24000000,0x200000,0x80009519,0x7c00100,0x220400,0x80009519,0x7c00100,0x230400,0x80009519,0x7c00100,0x250400,0x80009865,0x7c00100,0x230400,0x8000a008, +0x2802100,0x962460,0x8000b30a,0x4000000,0x500000,0x8000b30a,0x7c00100,0x230400,0x8000cd00,0x4000000,0x4e00000,0x8000d202,0x2802500,0x962460,0x8000d202,0x7c00100, +0x230400,0x8000d68d,0x4000000,0x200000,0x8000d997,0x2802000,0x962460,0x8000d997,0x2802400,0x962460,0x8000d997,0x4000000,0x400000,0x8000d997,0x4000000,0x500000, +0x8000d997,0x7c00100,0x230400,0x8000d997,0xc000010,0x448000,0x8000e489,0x2802100,0x962460,0x8000e489,0x7c00100,0x230400,0x8000e719,0x7c00100,0x220400,0x8000f8a6, +0x2802100,0x962460,0x8000f8a6,0x7c00100,0x230400,0x8000f8a6,0xc000010,0x448000,0x8000fda1,0x2802100,0x1862460,0x8000fda1,0x2806400,0x1862460,0x8000fda1,0x4000000, +0x1800000,0x8000fda1,0x6800000,0x1329800,0x8000fda1,0x6800100,0x1862540,0x8000fda1,0x7c00100,0x1830000,0x8000fda1,0xc000010,0x448000,0x8000fe9c,0x7c00100,0x230400, +0x8000fe9c,0x7c00100,0x830400,0x8000fe9c,0x7c00100,0x1430400,0x8000ff06,0x7c00100,0x220400,0x80010165,0x7c00100,0x230400,0x800102a2,0x4000000,0x200000,0x800102a2, +0x7c00100,0x230400,0x800103a4,0x7c00100,0x230400,0x800103a4,0xc000010,0x448000,0x8001044c,0x4000000,0x200000,0x8001044c,0x7c00100,0x220400,0x8001044c,0x7c00100, +0x250400,0x80010670,0x2802000,0x962460,0x80010670,0x4000000,0x200000,0x80010670,0x4000010,0x400000,0x80010670,0xc000010,0x448000,0x800a4711,0x7c40300,0xe30000, +0x800acd00,0x4000000,0x34e00000,0x800acd00,0x4000000,0x7a902460,0x800ace00,0x4000000,0x34e00000,0x800acf00,0x4000000,0x34e00000,0x800b0011,0x7c40300,0xe30000,0x800b0500, +0x4000000,0x34e00000,0x800b0500,0x4000000,0xb6800000,0x90001615,0x7c00100,0x230400,0x9000171a,0x4000000,0x200000,0x9000171a,0x7c00100,0x230400,0x90003000,0x24000000, +0x200000,0x90007f0e,0x4000000,0x200000,0x90008301,0x2802000,0x962460,0x90008e00,0x24000000,0x400000,0x90009519,0x7c00100,0x250400,0x9000a16f,0x2802100,0x962460, +0x9000d200,0x80000000,0x218960,0x9000d202,0x2802000,0x962460,0x9000d202,0x2802100,0x962460,0x9000d202,0x7c00100,0x230400,0x9000e59d,0x2802100,0x962460,0x90010500, +0x4000000,0xe00000,0x900107a7,0x2802100,0x962460,0x900107a7,0x2802400,0x962460,0x900107a7,0x2802c00,0x962460,0x900107a7,0x4000000,0x1400000,0x900107a7,0x6800000, +0x1329800,0x900107a7,0x7c00100,0x220400,0x900107a7,0x7c00100,0x250400,0x900108a8,0x2802100,0x962460,0x900108a8,0x2806400,0x962460,0x900108a8,0x4000000,0x200000, +0x900108a8,0x4000000,0x400000,0x900108a8,0x4000010,0x400000,0x900108a8,0x6800000,0x1329800,0x900108a8,0x6800100,0x962540,0x900108a8,0x7c00100,0x230400,0x900108a8, +0xc000010,0x448000,0x90010908,0x7c00100,0x220400,0x90010a38,0x2802100,0x962460,0x90010ca9,0x2802100,0x962460,0x90010ca9,0x4000000,0x500000,0x90010ca9,0x4000010, +0xb00000,0x90010ca9,0x6800100,0x962540,0x90010ca9,0x7c00100,0x230400,0x90010d1b,0x4000000,0x500000,0x90010eaa,0x2802100,0x962460,0x90010eaa,0x2802400,0x962460, +0x90010eaa,0x2806400,0x962460,0x90010eaa,0x4000000,0x200000,0x90010eaa,0x4000000,0x400000,0x90010eaa,0x4000010,0x400000,0x90010eaa,0x6800000,0x1329800,0x90010eaa, +0x6800100,0x962540,0x90010eaa,0x7c00100,0x230400,0x90010eaa,0xc000010,0x448000,0x90010fab,0x7c00100,0x220400,0x90010fab,0x7c00100,0x250400,0x9002c300,0x4000000, +0x100000,0x900ac400,0x4000000,0xe0000d,0x900acd00,0x4000000,0x34e00000,0x900acd00,0x4000000,0xb6800000,0x900acf00,0x4000000,0x34e00000,0x900b0500,0x4000000,0x34e00000, +0x900b0500,0x4000000,0xb6800000,0x900b0b9a,0x7c00900,0x1230400,0x900b109a,0x7c00300,0xe30000,0x900b119a,0x7c00300,0xe30000,0x90408e06,0x24000000,0x400000,0xa0001004, +0x4000000,0x200000,0xa0001004,0x7c00100,0x230400,0xa000120f,0x2802100,0x962460,0xa000120f,0x2802400,0x962460,0xa000171a,0x2802100,0x962460,0xa000171a,0x2806400, +0x962460,0xa0002a00,0x4000000,0x1600000,0xa0003000,0x24000000,0x200000,0xa000581e,0x7c00100,0x230400,0xa0007300,0x24000000,0x200000,0xa0008301,0x2802400,0x962460, +0xa0008e00,0x24000000,0x400000,0xa000cf00,0x4000000,0x4e00000,0xa0010500,0x4000000,0x200000,0xa00114af,0x2802100,0x962460,0xa00114af,0x2802400,0x962460,0xa00114af, +0x2806400,0x962460,0xa00114af,0x6800000,0x1329800,0xa00114af,0x7c00100,0x230400,0xa00114af,0x7c00100,0x230560,0xa00116b0,0x2802100,0x962460,0xa00116b0,0x2802800, +0x962460,0xa00116b0,0x2806400,0x962460,0xa00116b0,0x4000000,0x400000,0xa00116b0,0x4000000,0x500000,0xa00116b0,0x4000010,0x400000,0xa00116b0,0x6800100,0x962540, +0xa00116b0,0x7c00100,0x230400,0xa00116b0,0x7c00100,0x230560,0xa00116b0,0xc000010,0x448000,0xa0011722,0x7c00100,0x230400,0xa00118b1,0x2802000,0x962460,0xa00118b1, +0x2802100,0x962460,0xa00118b1,0x2806400,0x962460,0xa00118b1,0x4000000,0x200000,0xa00118b1,0x4000000,0x400000,0xa00118b1,0x4000000,0x500000,0xa00118b1,0x6800100, +0x962540,0xa00118b1,0x7c00100,0x230400,0xa00118b1,0x7c00100,0x230560,0xa00118b1,0xc000010,0x448000,0xa00a4005,0x7c00100,0xe30400,0xa00a4711,0x7c40300,0xe30000, +0xa00ac400,0x4000000,0x4e00000,0xa00acb14,0x7c00100,0xe30000,0xa00acf00,0x4000000,0x34e00000,0xa00b0500,0x4000000,0x34e00000,0xa00b0500,0x4000000,0xb6800000,0xa00b0b96, +0x7c00900,0x1230400,0xa00b1211,0x7c40300,0xe30000,0xa00b1314,0x7c00100,0xe30000,0xa00b1596,0x7c00300,0xe30000,0xa040afac,0x6800400,0x962540,0xa08083ad,0x2802400, +0x962460,0xb0000a03,0x7c00100,0x220400,0xb0000b13,0x7c00100,0x2633800,0xb0001004,0x2802000,0x962460,0xb0001110,0x4000000,0x200000,0xb0001524,0x2802000,0x962460, +0xb0001615,0x4000000,0x500000,0xb000251b,0x7c00100,0x230400,0xb0007300,0x24000000,0x200000,0xb0008939,0x4000000,0x200000,0xb0008939,0x7c00100,0x230400,0xb0008e00, +0x24000000,0x200000,0xb0008e00,0x24000000,0x400000,0xb0008e00,0x24000010,0x400000,0xb0009257,0x2802000,0x962460,0xb0009257,0x4000000,0x1600000,0xb0009519,0x7c00100, +0x220400,0xb0009519,0x7c00100,0x250400,0xb0009a00,0x4000000,0x200000,0xb000b30a,0x2802100,0x962460,0xb000b30a,0x7c00100,0x230400,0xb000c178,0x80000000,0x218960, +0xb000c300,0x4000000,0x4200000,0xb000d202,0x2802000,0x962460,0xb000d476,0x6800100,0x962540,0xb000d476,0x7c00100,0x230400,0xb000e300,0x4000000,0x4e00000,0xb000fda1, +0x7c00100,0x1830000,0xb0010eaa,0x2802000,0x962460,0xb00116b0,0x7c00100,0x230400,0xb0011900,0x4000000,0x4e00000,0xb0011ab2,0x2802100,0x962460,0xb0011ab2,0x2802400, +0x962460,0xb0011ab2,0x2806400,0x962460,0xb0011ab2,0x4000000,0x200000,0xb0011ab2,0x6800100,0x962540,0xb0011ab2,0x7c00100,0x230400,0xb0011b0c,0x7c00100,0x230400, +0xb0011cb3,0x2802100,0x962460,0xb0011cb3,0x2806400,0x962460,0xb0011cb3,0x6800000,0x1329800,0xb0011cb3,0x6800100,0x962540,0xb0011cb3,0x7c00100,0x230400,0xb0011db6, +0x2802500,0x962460,0xb0011db6,0x6800000,0x1329800,0xb0011db6,0x7c00100,0x230400,0xb0011db6,0x7c00500,0x230400,0xb0011e00,0x4000000,0x200000,0xb0011e00,0x4000000, +0x1500000,0xb0011fb4,0x2802100,0x962460,0xb0011fb4,0x6800100,0x962540,0xb0011fb4,0x7c00100,0x230400,0xb0011fb4,0xc000010,0x248000,0xb0012000,0x4000000,0x200000, +0xb00121b5,0x4000000,0x200000,0xb00121b5,0x4000010,0x400000,0xb00121b5,0x7c00100,0x220400,0xb00121b5,0x7c00100,0x250400,0xb00121b5,0xc000010,0x448000,0xb00122b8, +0x4000000,0x200000,0xb00122b8,0x7c00100,0x230400,0xb00123b7,0x2802400,0x962460,0xb00123b7,0x4000000,0x200000,0xb00123b7,0x7c00100,0x230400,0xb00123b7,0xc000010, +0x248000,0xb00a4005,0x7c00100,0xe30400,0xb00a4711,0x7c40300,0xe30000,0xb00acf00,0x4000000,0x34e00000,0xb00b0500,0x4000000,0x34e00000,0xb00b0500,0x4000000,0x3ce00000, +0xb00b0500,0x4000000,0xb6800000,0xb00b109a,0x7c00300,0xe30000,0xb080e47c,0x2802000,0x962460,0xc0001524,0x4000000,0x500000,0xc0001a18,0x2806400,0x1862460,0xc0001a18, +0x7c00100,0x1830000,0xc0007300,0x24000000,0x200000,0xc0008e00,0x24000010,0x400000,0xc0009519,0x7c00100,0x220400,0xc0009519,0x7c00100,0x250400,0xc000c300,0x4000000, +0x420000f,0xc000d85c,0x2802100,0x962460,0xc000d85c,0x6800100,0x962540,0xc000d85c,0x7c00100,0x230400,0xc000dc99,0x7c00100,0x230400,0xc000e719,0x7c00100,0x220400, +0xc00107a7,0x7c00100,0x230400,0xc0010eaa,0x7c00100,0x230400,0xc00116b0,0x7c00100,0x230560,0xc0011900,0x4000000,0x4200000,0xc0012447,0,0x818820,0xc0012447, +0,0xc18820,0xc0012447,0,0x1418820,0xc00125b9,0x7c00100,0x230400,0xc00126bb,0x2802100,0x962460,0xc00126bb,0x2806400,0x962460,0xc00126bb,0x4000000, +0x500000,0xc00126bb,0x6800100,0x962540,0xc00126bb,0x7c00100,0x230400,0xc00127ba,0x2802400,0x962460,0xc00127ba,0x4000000,0x200000,0xc00127ba,0x6800000,0x1329800, +0xc00127ba,0x7c00100,0x230400,0xc00127ba,0x7c00900,0x230400,0xc0012800,0x4000000,0x200000,0xc0012b23,0x4000000,0x200000,0xc0012b23,0x4000000,0x400000,0xc0012b23, +0x4000000,0x1500000,0xc0012cbc,0x2802400,0x962460,0xc0012cbc,0x4000000,0x1600000,0xc0012cbc,0x6800000,0x1329800,0xc0012cbc,0x7c00100,0x230400,0xc00acf00,0x4000000, +0x34e00000,0xc00ae300,0x4000000,0x34e00000,0xc00b0500,0x4000000,0x34e00000,0xc00b0500,0x4000000,0xb6800000,0xc00b0b00,0x4000000,0x1200000,0xc00b0b00,0x7c00900,0x1230400, +0xc00b109a,0x7c00300,0xe30000,0xc00b2914,0x7c00100,0x2530000,0xc00b2916,0x7c00100,0x2530c00,0xc00b2a00,0x4000000,0x34e00000,0xc040af53,0x7c00100,0x230400,0xc0c12b7e, +0x4000000,0x200000,0xc14a44bf,0x4000000,0xe0000d,0xd000131f,0x2802c00,0x962460,0xd000171a,0x7c00100,0x230400,0xd0001821,0x2802100,0x962460,0xd0007300,0x24000000, +0x200000,0xd0008e00,0x24000000,0x200000,0xd0008f3a,0x2806000,0x962460,0xd0009519,0x7c00100,0x220400,0xd0009519,0x7c00100,0x250400,0xd000a500,0x4000000,0x200000, +0xd000c300,0x4000000,0x4e00000,0xd000d202,0x7c00100,0x230400,0xd000d476,0x7c00100,0x230400,0xd000d997,0x2802100,0x962460,0xd000d997,0x6800100,0x962540,0xd000e001, +0x2802100,0x962460,0xd000e700,0x4000400,0x200000,0xd000e719,0x7c00100,0x220400,0xd000e719,0x7c00500,0x23040f,0xd000fa00,0x4000000,0x4e00000,0xd0010eaa,0x4000010, +0x400000,0xd0010eaa,0x7c00100,0x230400,0xd0012dbd,0x4000000,0x200000,0xd0012dbd,0x7c00100,0x230400,0xd0012fbe,0x2802100,0x962460,0xd0012fbe,0x2802400,0x962460, +0xd0012fbe,0x2806400,0x962460,0xd0012fbe,0x4000000,0x400000,0xd0012fbe,0x6800000,0x1329800,0xd0012fbe,0x6800100,0x962540,0xd0012fbe,0x6800100,0x962541,0xd0012fbe, +0x6804400,0x962540,0xd0012fbe,0x7c00100,0x230400,0xd0012fbe,0x7c00100,0x230560,0xd0012fbe,0xc000010,0x448000,0xd0013183,0x7c00100,0x230400,0xd0013200,0x4000000, +0x200000,0xd0013200,0x6800000,0x1329805,0xd00134c0,0x2802100,0x962460,0xd00134c0,0x4000002,0x400000,0xd00134c0,0x7c00100,0x230400,0xd00a4305,0x7c00100,0xe30400, +0xd00a4611,0x7c40300,0xe30000,0xd00a4711,0x7c40300,0xe30000,0xd00a5e11,0x7c40300,0xe30000,0xd00acf00,0x4000000,0x34e00000,0xd00b0500,0x4000000,0x34e00000,0xd00b0500, +0x4000000,0xb6800000,0xd00b0b11,0x6800500,0x962540,0xd00b0bbf,0x2802200,0xc62460,0xd00b119a,0x7c00300,0xe30000,0xd00b2a00,0x4000000,0x34e00000,0xd00b2e11,0x7c40300, +0xe30000,0xd00b30bf,0x7c00300,0x230000,0xd00b339a,0x7c00300,0xe30000}; + +static const int32_t countPropsVectors=6999; +static const int32_t propsVectorsColumns=3; +static const uint16_t scriptExtensions[262]={ +0x800e,0x8019,8,0x8059,8,2,8,0x8038,8,6,8,0x8019,2,0x22,0x25,0xb6, +0x80c0,2,0x22,0x8025,2,0x11,2,0x22,0x54,0x79,0x7b,0xa7,0xb6,0x80b7,2,0x8022, +2,0x25,0x80c0,2,0x20,2,0x80b6,4,0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23, +0x24,0x89,0x97,0x809e,4,0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23,0x24,0x89,0x809e, +4,0xa,0xf,0x10,0x15,0x1a,0x1f,0x21,0x23,0x24,0x3a,0x89,0x91,0x99,0x9e,0xa0, +0xaf,0xb2,0xb3,0x80bb,4,0xa,0xf,0x10,0x15,0x1a,0x1f,0x21,0x23,0x24,0x30,0x3a, +0x89,0x91,0x99,0x9e,0xa0,0xaf,0xb2,0xb3,0x80bb,0xa,0x78,0xa0,0x80b2,0xa,0x69,4, +0x3a,0x8076,4,0x6f,0x10,0x80a4,0x10,0x74,0xf,0x809d,0xf,0x78,0x23,0x8089,0x23,0x7c, +0x15,0x80bb,0x15,0x80,0x1c,0x34,0x8076,0x1c,0x84,0xc,0x8019,0x2a,0x2b,0x2c,0x802d,0x1b, +0x805a,0x800a,4,0xa,0x15,0x8089,0xa,0x8089,4,0x800a,0xa,0x8097,0xa,0x15,0x1a,0x1f, +0x23,0x8024,0xa,0x80bb,4,0xa,0x15,0x1f,0x24,0x89,0x9e,0x80bb,0x8004,8,0x8022,0x19, +0x801b,0xa,0x19,0x8089,5,0x11,0x12,0x14,0x16,0x8029,5,0x11,0x12,0x14,0x8016,0x8011, +5,0x8011,0x11,0x14,0x8016,0x11,0x8019,0xa,0xf,0x10,0x78,0x91,0x99,0x9d,0x9e,0xa0, +0xa3,0x80b2,0xa,0xf,0x10,0x15,0x1a,0x78,0x91,0x99,0x9d,0x9e,0xa0,0xa3,0xb2,0x80bb, +0xa,0xf,0x10,0x15,0x78,0x91,0x99,0x9d,0x9e,0xa0,0xa3,0xb2,0x80bb,0xa,0x98,0xa, +0x8023,0xa,0xef,0x19,0x1c,0x804f,0x37,0x804e,2,0x8025,2,0xf8,0x2f,0x31,0x8053,0x2f, +0x8031,2,0x8007,0x89,0x7c,0x8087}; + +static const int32_t indexes[UPROPS_INDEX_COUNT]={0x2b96,0x2b96,0x2b96,0x2b96,0x6898,3,0x83ef,0x8472,0x8472,0x8472,0xb34c0,0x2a75a31,0,0,0,0}; + +#endif // INCLUDED_FROM_UCHAR_C diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucln.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucln.h new file mode 100644 index 0000000000000000000000000000000000000000..fe6666efed3f188fb7736be7c47146899e19c0f4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucln.h @@ -0,0 +1,91 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2001-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ucln.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2001July05 +* created by: George Rhoten +*/ + +#ifndef __UCLN_H__ +#define __UCLN_H__ + +#include "unicode/utypes.h" + +/** These are the functions used to register a library's memory cleanup + * functions. Each library should define a single library register function + * to call this API. In the i18n library, it is ucln_i18n_registerCleanup(). + * + * None of the cleanup functions should use a mutex to clean up an API's + * allocated memory because a cleanup function is not meant to be thread safe, + * and plenty of data cannot be reference counted in order to make sure that + * no one else needs the allocated data. + * + * In order to make a cleanup function get called when u_cleanup is called, + * You should add your function to the library specific cleanup function. + * If the cleanup function is not in the common library, the code that + * allocates the memory should call the library specific cleanup function. + * For instance, in the i18n library, any memory allocated statically must + * call ucln_i18n_registerCleanup() from the ucln_in.h header. These library + * cleanup functions are needed in order to prevent a circular dependency + * between the common library and any other library. + * + * The order of the cleanup is very important. In general, an API that + * depends on a second API should be cleaned up before the second API. + * For instance, the default converter in ustring depends upon the converter + * API. So the default converter should be closed before the converter API + * has its cache flushed. This will prevent any memory leaks due to + * reference counting. + * + * Please see common/ucln_cmn.{h,c} and i18n/ucln_in.{h,c} for examples. + */ + +/** + * Data Type for cleanup function selector. These roughly correspond to libraries. + */ +typedef enum ECleanupLibraryType { + UCLN_START = -1, + UCLN_UPLUG, /* ICU plugins */ + UCLN_CUSTOM, /* Custom is for anyone else. */ + UCLN_CTESTFW, + UCLN_TOOLUTIL, + UCLN_LAYOUTEX, + UCLN_LAYOUT, + UCLN_IO, + UCLN_I18N, + UCLN_COMMON /* This must be the last one to cleanup. */ +} ECleanupLibraryType; + +/** + * Data type for cleanup function pointer + */ +U_CDECL_BEGIN +typedef UBool U_CALLCONV cleanupFunc(void); +typedef void U_CALLCONV initFunc(UErrorCode *); +U_CDECL_END + +/** + * Register a cleanup function + * @param type which library to register for. + * @param func the function pointer + */ +U_CAPI void U_EXPORT2 ucln_registerCleanup(ECleanupLibraryType type, + cleanupFunc *func); + +/** + * Request cleanup for one specific library. + * Not thread safe. + * @param type which library to cleanup + */ +U_CAPI void U_EXPORT2 ucln_cleanupOne(ECleanupLibraryType type); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucln_cmn.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucln_cmn.h new file mode 100644 index 0000000000000000000000000000000000000000..44b73e94da791ffc1483aa0929e2a7fe04497b0e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucln_cmn.h @@ -0,0 +1,77 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2001-2016, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* file name: ucln_cmn.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2001July05 +* created by: George Rhoten +*/ + +#ifndef __UCLN_CMN_H__ +#define __UCLN_CMN_H__ + +#include "unicode/utypes.h" +#include "ucln.h" + +/* These are the cleanup functions for various APIs. */ +/* @return true if cleanup complete successfully.*/ +U_CFUNC UBool utrace_cleanup(void); + +U_CFUNC UBool ucln_lib_cleanup(void); + +/* +Please keep the order of enums declared in same order +as the cleanup functions are suppose to be called. */ +typedef enum ECleanupCommonType { + UCLN_COMMON_START = -1, + UCLN_COMMON_NUMPARSE_UNISETS, + UCLN_COMMON_USPREP, + UCLN_COMMON_BREAKITERATOR, + UCLN_COMMON_RBBI, + UCLN_COMMON_SERVICE, + UCLN_COMMON_LOCALE_KEY_TYPE, + UCLN_COMMON_LOCALE, + UCLN_COMMON_LOCALE_ALIAS, + UCLN_COMMON_LOCALE_KNOWN_CANONICALIZED, + UCLN_COMMON_LOCALE_AVAILABLE, + UCLN_COMMON_LIKELY_SUBTAGS, + UCLN_COMMON_LOCALE_DISTANCE, + UCLN_COMMON_ULOC, + UCLN_COMMON_CURRENCY, + UCLN_COMMON_LOADED_NORMALIZER2, + UCLN_COMMON_NORMALIZER2, + UCLN_COMMON_CHARACTERPROPERTIES, + UCLN_COMMON_USET, + UCLN_COMMON_UNAMES, + UCLN_COMMON_UPROPS, + UCLN_COMMON_UCNV, + UCLN_COMMON_UCNV_IO, + UCLN_COMMON_UDATA, + UCLN_COMMON_PUTIL, + UCLN_COMMON_UINIT, + + /* + Unified caches caches collation stuff. Collation data structures + contain resource bundles which means that unified cache cleanup + must happen before resource bundle clean up. + */ + UCLN_COMMON_UNIFIED_CACHE, + UCLN_COMMON_URES, + UCLN_COMMON_MUTEX, // Mutexes should be the last to be cleaned up. + UCLN_COMMON_COUNT /* This must be last */ +} ECleanupCommonType; + +/* Main library cleanup registration function. */ +/* See common/ucln.h for details on adding a cleanup function. */ +/* Note: the global mutex must not be held when calling this function. */ +U_CFUNC void U_EXPORT2 ucln_common_registerCleanup(ECleanupCommonType type, + cleanupFunc *func); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucln_imp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucln_imp.h new file mode 100644 index 0000000000000000000000000000000000000000..63a54c86f62414b7f837b59e95819398d72b28fc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucln_imp.h @@ -0,0 +1,182 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2009-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ucln_imp.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* This file contains the platform specific implementation of per-library cleanup. +* +*/ + + +#ifndef __UCLN_IMP_H__ +#define __UCLN_IMP_H__ + +#include "ucln.h" +#include + +/** + * Auto cleanup of ICU libraries + * There are several methods in per library cleanup of icu libraries: + * 1) Compiler/Platform based cleanup: + * a) Windows MSVC uses DllMain() + * b) GCC uses destructor function attribute + * c) Sun Studio, AIX VA, and HP-UX aCC uses a linker option to set the exit function + * 2) Using atexit() + * 3) Implementing own automatic cleanup functions + * + * For option 1, ensure that UCLN_NO_AUTO_CLEANUP is set to 0 by using --enable-auto-cleanup + * configure option or by otherwise setting UCLN_NO_AUTO_CLEANUP to 0 + * For option 2, follow option 1 and also define UCLN_AUTO_ATEXIT + * For option 3, follow option 1 and also define UCLN_AUTO_LOCAL (see below for more information) + */ + +#if !UCLN_NO_AUTO_CLEANUP + +/* + * The following declarations are for when UCLN_AUTO_LOCAL or UCLN_AUTO_ATEXIT + * are defined. They are commented out because they are static and will be defined + * later. The information is still here to provide some guidance for the developer + * who chooses to use UCLN_AUTO_LOCAL. + */ +/** + * Give the library an opportunity to register an automatic cleanup. + * This may be called more than once. + */ +/*static void ucln_registerAutomaticCleanup();*/ +/** + * Unregister an automatic cleanup, if possible. Called from cleanup. + */ +/*static void ucln_unRegisterAutomaticCleanup();*/ + +#ifdef UCLN_TYPE_IS_COMMON +# define UCLN_CLEAN_ME_UP u_cleanup() +#else +# define UCLN_CLEAN_ME_UP ucln_cleanupOne(UCLN_TYPE) +#endif + +/* ------------ automatic cleanup: registration. Choose ONE ------- */ +#if defined(UCLN_AUTO_LOCAL) +/* To use: + * 1. define UCLN_AUTO_LOCAL, + * 2. create ucln_local_hook.c containing implementations of + * static void ucln_registerAutomaticCleanup() + * static void ucln_unRegisterAutomaticCleanup() + */ +#include "ucln_local_hook.c" + +#elif defined(UCLN_AUTO_ATEXIT) +/* + * Use the ANSI C 'atexit' function. Note that this mechanism does not + * guarantee the order of cleanup relative to other users of ICU! + */ +static UBool gAutoCleanRegistered = false; + +static void ucln_atexit_handler() +{ + UCLN_CLEAN_ME_UP; +} + +static void ucln_registerAutomaticCleanup() +{ + if(!gAutoCleanRegistered) { + gAutoCleanRegistered = true; + atexit(&ucln_atexit_handler); + } +} + +static void ucln_unRegisterAutomaticCleanup () { +} +/* ------------end of automatic cleanup: registration. ------- */ + +#elif defined (UCLN_FINI) +/** + * If UCLN_FINI is defined, it is the (versioned, etc) name of a cleanup + * entrypoint. Add a stub to call ucln_cleanupOne + * Used on AIX, Solaris, and HP-UX + */ +U_CAPI void U_EXPORT2 UCLN_FINI (void); + +U_CAPI void U_EXPORT2 UCLN_FINI () +{ + /* This function must be defined, if UCLN_FINI is defined, else link error. */ + UCLN_CLEAN_ME_UP; +} + +/* Windows: DllMain */ +#elif U_PLATFORM_HAS_WIN32_API +/* + * ICU's own DllMain. + */ + +/* these are from putil.c */ +/* READ READ READ READ! Are you getting compilation errors from windows.h? + Any source file which includes this (ucln_imp.h) header MUST + be defined with language extensions ON. */ +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +# define VC_EXTRALEAN +# define NOUSER +# define NOSERVICE +# define NOIME +# define NOMCX +# include +/* + * This is a stub DllMain function with icu specific process handling code. + */ +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + BOOL status = true; + + switch(fdwReason) { + case DLL_PROCESS_ATTACH: + /* ICU does not trap process attach, but must pass these through properly. */ + /* ICU specific process attach could go here */ + break; + + case DLL_PROCESS_DETACH: + /* Here is the one we actually care about. */ + + UCLN_CLEAN_ME_UP; + + break; + + case DLL_THREAD_ATTACH: + /* ICU does not trap thread attach, but must pass these through properly. */ + /* ICU specific thread attach could go here */ + break; + + case DLL_THREAD_DETACH: + /* ICU does not trap thread detach, but must pass these through properly. */ + /* ICU specific thread detach could go here */ + break; + + } + return status; +} + +#elif defined(__GNUC__) +/* GCC - use __attribute((destructor)) */ +static void ucln_destructor() __attribute__((destructor)) ; + +static void ucln_destructor() +{ + UCLN_CLEAN_ME_UP; +} + +#endif + +#endif /* UCLN_NO_AUTO_CLEANUP */ + +#else +#error This file can only be included once. +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucmndata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucmndata.h new file mode 100644 index 0000000000000000000000000000000000000000..c3eba9f4d021022a41e41dad37bf8a9dbfdef09e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucmndata.h @@ -0,0 +1,117 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************/ + + +/*---------------------------------------------------------------------------------- + * + * UCommonData An abstract interface for dealing with ICU Common Data Files. + * ICU Common Data Files are a grouping of a number of individual + * data items (resources, converters, tables, anything) into a + * single file or dll. The combined format includes a table of + * contents for locating the individual items by name. + * + * Two formats for the table of contents are supported, which is + * why there is an abstract inteface involved. + * + * These functions are part of the ICU internal implementation, and + * are not inteded to be used directly by applications. + */ + +#ifndef __UCMNDATA_H__ +#define __UCMNDATA_H__ + +#include "unicode/udata.h" +#include "umapfile.h" + + +#define COMMON_DATA_NAME U_ICUDATA_NAME + +typedef struct { + uint16_t headerSize; + uint8_t magic1; + uint8_t magic2; +} MappedData; + + +typedef struct { + MappedData dataHeader; + UDataInfo info; +} DataHeader; + +typedef struct { + uint32_t nameOffset; + uint32_t dataOffset; +} UDataOffsetTOCEntry; + +typedef struct { + uint32_t count; + /** + * Variable-length array declared with length 1 to disable bounds checkers. + * The actual array length is in the count field. + */ + UDataOffsetTOCEntry entry[1]; +} UDataOffsetTOC; + +/** + * Get the header size from a const DataHeader *udh. + * Handles opposite-endian data. + * + * @internal + */ +U_CFUNC uint16_t +udata_getHeaderSize(const DataHeader *udh); + +/** + * Get the UDataInfo.size from a const UDataInfo *info. + * Handles opposite-endian data. + * + * @internal + */ +U_CFUNC uint16_t +udata_getInfoSize(const UDataInfo *info); + +U_CDECL_BEGIN +/* + * "Virtual" functions for data lookup. + * To call one, given a UDataMemory *p, the code looks like this: + * p->vFuncs.Lookup(p, tocEntryName, pErrorCode); + * (I sure do wish this was written in C++, not C) + */ + +typedef const DataHeader * +(U_CALLCONV * LookupFn)(const UDataMemory *pData, + const char *tocEntryName, + int32_t *pLength, + UErrorCode *pErrorCode); + +typedef uint32_t +(U_CALLCONV * NumEntriesFn)(const UDataMemory *pData); + +U_CDECL_END + +typedef struct { + LookupFn Lookup; + NumEntriesFn NumEntries; +} commonDataFuncs; + + +/* + * Functions to check whether a UDataMemory refers to memory containing + * a recognizable header and table of contents a Common Data Format + * + * If a valid header and TOC are found, + * set the CommonDataFuncs function dispatch vector in the UDataMemory + * to point to the right functions for the TOC type. + * otherwise + * set an errorcode. + */ +U_CFUNC void udata_checkCommonData(UDataMemory *pData, UErrorCode *pErrorCode); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_bld.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_bld.h new file mode 100644 index 0000000000000000000000000000000000000000..43e6c09ac0b0f8fc28457bac3eb13e7e38ba2751 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_bld.h @@ -0,0 +1,296 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2015 International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* +* ucnv_bld.h: +* Contains internal data structure definitions +* Created by Bertrand A. Damiba +* +* Change history: +* +* 06/29/2000 helena Major rewrite of the callback APIs. +*/ + +#ifndef UCNV_BLD_H +#define UCNV_BLD_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "unicode/ucnv_err.h" +#include "unicode/utf16.h" +#include "ucnv_cnv.h" +#include "ucnvmbcs.h" +#include "ucnv_ext.h" +#include "udataswp.h" + +/* size of the overflow buffers in UConverter, enough for escaping callbacks */ +#define UCNV_ERROR_BUFFER_LENGTH 32 + +/* at most 4 bytes per substitution character (part of .cnv file format! see UConverterStaticData) */ +#define UCNV_MAX_SUBCHAR_LEN 4 + +/* at most 8 bytes per character in toUBytes[] (UTF-8 uses up to 6) */ +#define UCNV_MAX_CHAR_LEN 8 + +/* converter options bits */ +#define UCNV_OPTION_VERSION 0xf +#define UCNV_OPTION_SWAP_LFNL 0x10 + +#define UCNV_GET_VERSION(cnv) ((cnv)->options&UCNV_OPTION_VERSION) + +U_CDECL_BEGIN /* We must declare the following as 'extern "C"' so that if ucnv + itself is compiled under C++, the linkage of the funcptrs will + work. + */ + +union UConverterTable { + UConverterMBCSTable mbcs; +}; + +typedef union UConverterTable UConverterTable; + +struct UConverterImpl; +typedef struct UConverterImpl UConverterImpl; + +/** values for the unicodeMask */ +#define UCNV_HAS_SUPPLEMENTARY 1 +#define UCNV_HAS_SURROGATES 2 + +typedef struct UConverterStaticData { /* +offset: size */ + uint32_t structSize; /* +0: 4 Size of this structure */ + + char name + [UCNV_MAX_CONVERTER_NAME_LENGTH]; /* +4: 60 internal name of the converter- invariant chars */ + + int32_t codepage; /* +64: 4 codepage # (now IBM-$codepage) */ + + int8_t platform; /* +68: 1 platform of the converter (only IBM now) */ + int8_t conversionType; /* +69: 1 conversion type */ + + int8_t minBytesPerChar; /* +70: 1 Minimum # bytes per char in this codepage */ + int8_t maxBytesPerChar; /* +71: 1 Maximum # bytes output per UChar in this codepage */ + + uint8_t subChar[UCNV_MAX_SUBCHAR_LEN]; /* +72: 4 [note: 4 and 8 byte boundary] */ + int8_t subCharLen; /* +76: 1 */ + + uint8_t hasToUnicodeFallback; /* +77: 1 UBool needs to be changed to UBool to be consistent across platform */ + uint8_t hasFromUnicodeFallback; /* +78: 1 */ + uint8_t unicodeMask; /* +79: 1 bit 0: has supplementary bit 1: has single surrogates */ + uint8_t subChar1; /* +80: 1 single-byte substitution character for IBM MBCS (0 if none) */ + uint8_t reserved[19]; /* +81: 19 to round out the structure */ + /* total size: 100 */ +} UConverterStaticData; + +/* + * Defines the UConverterSharedData struct, + * the immutable, shared part of UConverter. + */ +struct UConverterSharedData { + uint32_t structSize; /* Size of this structure */ + uint32_t referenceCounter; /* used to count number of clients, unused for static/immutable SharedData */ + + const void *dataMemory; /* from udata_openChoice() - for cleanup */ + + const UConverterStaticData *staticData; /* pointer to the static (non changing) data. */ + + UBool sharedDataCached; /* true: shared data is in cache, don't destroy on ucnv_close() if 0 ref. false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */ + /** If false, then referenceCounter is not used. Must not change after initialization. */ + UBool isReferenceCounted; + + const UConverterImpl *impl; /* vtable-style struct of mostly function pointers */ + + /*initial values of some members of the mutable part of object */ + uint32_t toUnicodeStatus; + + /* + * Shared data structures currently come in two flavors: + * - readonly for built-in algorithmic converters + * - allocated for MBCS, with a pointer to an allocated UConverterTable + * which always has a UConverterMBCSTable + * + * To eliminate one allocation, I am making the UConverterMBCSTable + * a member of the shared data. + * + * markus 2003-nov-07 + */ + UConverterMBCSTable mbcs; +}; + +/** UConverterSharedData initializer for static, non-reference-counted converters. */ +#define UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(pStaticData, pImpl) \ + { \ + sizeof(UConverterSharedData), ~((uint32_t)0), \ + NULL, pStaticData, false, false, pImpl, \ + 0, UCNV_MBCS_TABLE_INITIALIZER \ + } + +/* Defines a UConverter, the lightweight mutable part the user sees */ + +struct UConverter { + /* + * Error function pointer called when conversion issues + * occur during a ucnv_fromUnicode call + */ + void (U_EXPORT2 *fromUCharErrorBehaviour) (const void *context, + UConverterFromUnicodeArgs *args, + const UChar *codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode *); + /* + * Error function pointer called when conversion issues + * occur during a ucnv_toUnicode call + */ + void (U_EXPORT2 *fromCharErrorBehaviour) (const void *context, + UConverterToUnicodeArgs *args, + const char *codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode *); + + /* + * Pointer to additional data that depends on the converter type. + * Used by ISO 2022, SCSU, GB 18030 converters, possibly more. + */ + void *extraInfo; + + const void *fromUContext; + const void *toUContext; + + /* + * Pointer to charset bytes for substitution string if subCharLen>0, + * or pointer to Unicode string (UChar *) if subCharLen<0. + * subCharLen==0 is equivalent to using a skip callback. + * If the pointer is !=subUChars then it is allocated with + * UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR bytes. + * The subUChars field is declared as UChar[] not uint8_t[] to + * guarantee alignment for UChars. + */ + uint8_t *subChars; + + UConverterSharedData *sharedData; /* Pointer to the shared immutable part of the converter object */ + + uint32_t options; /* options flags from UConverterOpen, may contain additional bits */ + + UBool sharedDataIsCached; /* true: shared data is in cache, don't destroy on ucnv_close() if 0 ref. false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */ + UBool isCopyLocal; /* true if UConverter is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */ + UBool isExtraLocal; /* true if extraInfo is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */ + + UBool useFallback; + int8_t toULength; /* number of bytes in toUBytes */ + uint8_t toUBytes[UCNV_MAX_CHAR_LEN-1];/* more "toU status"; keeps the bytes of the current character */ + uint32_t toUnicodeStatus; /* Used to internalize stream status information */ + int32_t mode; + uint32_t fromUnicodeStatus; + + /* + * More fromUnicode() status. Serves 3 purposes: + * - keeps a lead surrogate between buffers (similar to toUBytes[]) + * - keeps a lead surrogate at the end of the stream, + * which the framework handles as truncated input + * - if the fromUnicode() implementation returns to the framework + * (ucnv.c ucnv_fromUnicode()), then the framework calls the callback + * for this code point + */ + UChar32 fromUChar32; + + /* + * value for ucnv_getMaxCharSize() + * + * usually simply copied from the static data, but ucnvmbcs.c modifies + * the value depending on the converter type and options + */ + int8_t maxBytesPerUChar; + + int8_t subCharLen; /* length of the codepage specific character sequence */ + int8_t invalidCharLength; + int8_t charErrorBufferLength; /* number of valid bytes in charErrorBuffer */ + + int8_t invalidUCharLength; + int8_t UCharErrorBufferLength; /* number of valid UChars in charErrorBuffer */ + + uint8_t subChar1; /* single-byte substitution character if different from subChar */ + UBool useSubChar1; + char invalidCharBuffer[UCNV_MAX_CHAR_LEN]; /* bytes from last error/callback situation */ + uint8_t charErrorBuffer[UCNV_ERROR_BUFFER_LENGTH]; /* codepage output from Error functions */ + UChar subUChars[UCNV_MAX_SUBCHAR_LEN/U_SIZEOF_UCHAR]; /* see subChars documentation */ + + UChar invalidUCharBuffer[U16_MAX_LENGTH]; /* UChars from last error/callback situation */ + UChar UCharErrorBuffer[UCNV_ERROR_BUFFER_LENGTH]; /* unicode output from Error functions */ + + /* fields for conversion extension */ + + /* store previous UChars/chars to continue partial matches */ + UChar32 preFromUFirstCP; /* >=0: partial match */ + UChar preFromU[UCNV_EXT_MAX_UCHARS]; + char preToU[UCNV_EXT_MAX_BYTES]; + int8_t preFromULength, preToULength; /* negative: replay */ + int8_t preToUFirstLength; /* length of first character */ + + /* new fields for ICU 4.0 */ + UConverterCallbackReason toUCallbackReason; /* (*fromCharErrorBehaviour) reason, set when error is detected */ +}; + +U_CDECL_END /* end of UConverter */ + +#define CONVERTER_FILE_EXTENSION ".cnv" + + +/** + * Return the number of all converter names. + * @param pErrorCode The error code + * @return the number of all converter names + */ +U_CFUNC uint16_t +ucnv_bld_countAvailableConverters(UErrorCode *pErrorCode); + +/** + * Return the (n)th converter name in mixed case, or NULL + * if there is none (typically, if the data cannot be loaded). + * 0<=indexisReferenceCounted + * and this function must be called inside umtx_lock(&cnvCacheMutex). + */ +U_CAPI void +ucnv_unload(UConverterSharedData *sharedData); + +/** + * Swap ICU .cnv conversion tables. See udataswp.h. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ucnv_swap(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +U_CAPI void U_EXPORT2 +ucnv_enableCleanup(void); + +#endif + +#endif /* _UCNV_BLD */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_cnv.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_cnv.h new file mode 100644 index 0000000000000000000000000000000000000000..59be8bdb37b59353187efb01ba2e3d6b2a4bb3a0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_cnv.h @@ -0,0 +1,323 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* ucnv_cnv.h: +* Definitions for converter implementations. +* +* Modification History: +* +* Date Name Description +* 05/09/00 helena Added implementation to handle fallback mappings. +* 06/29/2000 helena Major rewrite of the callback APIs. +*/ + +#ifndef UCNV_CNV_H +#define UCNV_CNV_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "unicode/ucnv_err.h" +#include "unicode/uset.h" +#include "uset_imp.h" + +U_CDECL_BEGIN + +/* this is used in fromUnicode DBCS tables as an "unassigned" marker */ +#define missingCharMarker 0xFFFF + +/* + * #define missingUCharMarker 0xfffe + * + * commented out because there are actually two values used in toUnicode tables: + * U+fffe "unassigned" + * U+ffff "illegal" + */ + +/** Forward declaration, see ucnv_bld.h */ +struct UConverterSharedData; +typedef struct UConverterSharedData UConverterSharedData; + +/* function types for UConverterImpl ---------------------------------------- */ + +/* struct with arguments for UConverterLoad and ucnv_load() */ +typedef struct { + int32_t size; /* sizeof(UConverterLoadArgs) */ + int32_t nestedLoads; /* count nested ucnv_load() calls */ + UBool onlyTestIsLoadable; /* input: don't actually load */ + UBool reserved0; /* reserved - for good alignment of the pointers */ + int16_t reserved; /* reserved - for good alignment of the pointers */ + uint32_t options; + const char *pkg, *name, *locale; +} UConverterLoadArgs; + +#define UCNV_LOAD_ARGS_INITIALIZER \ + { (int32_t)sizeof(UConverterLoadArgs), 0, false, false, 0, 0, NULL, NULL, NULL } + +typedef void (*UConverterLoad) (UConverterSharedData *sharedData, + UConverterLoadArgs *pArgs, + const uint8_t *raw, UErrorCode *pErrorCode); +typedef void (*UConverterUnload) (UConverterSharedData *sharedData); + +typedef void (*UConverterOpen) (UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *pErrorCode); +typedef void (*UConverterClose) (UConverter *cnv); + +typedef enum UConverterResetChoice { + UCNV_RESET_BOTH, + UCNV_RESET_TO_UNICODE, + UCNV_RESET_FROM_UNICODE +} UConverterResetChoice; + +typedef void (*UConverterReset) (UConverter *cnv, UConverterResetChoice choice); + +/* + * Converter implementation function(s) for ucnv_toUnicode(). + * If the toUnicodeWithOffsets function pointer is NULL, + * then the toUnicode function will be used and the offsets will be set to -1. + * + * Must maintain state across buffers. Use toUBytes[toULength] for partial input + * sequences; it will be checked in ucnv.c at the end of the input stream + * to detect truncated input. + * Some converters may need additional detection and may then set U_TRUNCATED_CHAR_FOUND. + * + * The toUnicodeWithOffsets must write exactly as many offset values as target + * units. Write offset values of -1 for when the source index corresponding to + * the output unit is not known (e.g., the character started in an earlier buffer). + * The pArgs->offsets pointer need not be moved forward. + * + * At function return, either one of the following conditions must be true: + * - U_BUFFER_OVERFLOW_ERROR and the target is full: target==targetLimit + * - another error code with toUBytes[toULength] set to the offending input + * - no error, and the source is consumed: source==sourceLimit + * + * The ucnv.c code will handle the end of the input (reset) + * (reset, and truncation detection) and callbacks. + */ +typedef void (*UConverterToUnicode) (UConverterToUnicodeArgs *, UErrorCode *); + +/* + * Same rules as for UConverterToUnicode. + * A lead surrogate is kept in fromUChar32 across buffers, and if an error + * occurs, then the offending input code point must be put into fromUChar32 + * as well. + */ +typedef void (*UConverterFromUnicode) (UConverterFromUnicodeArgs *, UErrorCode *); + +/* + * Converter implementation function for ucnv_convertEx(), for direct conversion + * between two charsets without pivoting through UTF-16. + * The rules are the same as for UConverterToUnicode and UConverterFromUnicode. + * In addition, + * - The toUnicode side must behave and keep state exactly like the + * UConverterToUnicode implementation for the same source charset. + * - A U_USING_DEFAULT_WARNING can be set to request to temporarily fall back + * to pivoting. When this function is called, the conversion framework makes + * sure that this warning is not set on input. + * - Continuing a partial match and flushing the toUnicode replay buffer + * are handled by pivoting, using the toUnicode and fromUnicode functions. + */ +typedef void (*UConverterConvert) (UConverterFromUnicodeArgs *pFromUArgs, + UConverterToUnicodeArgs *pToUArgs, + UErrorCode *pErrorCode); + +/* + * Converter implementation function for ucnv_getNextUChar(). + * If the function pointer is NULL, then the toUnicode function will be used. + * + * Will be called at a character boundary (toULength==0). + * May return with + * - U_INDEX_OUTOFBOUNDS_ERROR if there was no output for the input + * (the return value will be ignored) + * - U_TRUNCATED_CHAR_FOUND or another error code (never U_BUFFER_OVERFLOW_ERROR!) + * with toUBytes[toULength] set to the offending input + * (the return value will be ignored) + * - return UCNV_GET_NEXT_UCHAR_USE_TO_U, without moving the source pointer, + * to indicate that the ucnv.c code shall call the toUnicode function instead + * - return a real code point result + * + * Unless UCNV_GET_NEXT_UCHAR_USE_TO_U is returned, the source bytes must be consumed. + * + * The ucnv.c code will handle the end of the input (reset) + * (except for truncation detection!) and callbacks. + */ +typedef UChar32 (*UConverterGetNextUChar) (UConverterToUnicodeArgs *, UErrorCode *); + +typedef void (*UConverterGetStarters)(const UConverter* converter, + UBool starters[256], + UErrorCode *pErrorCode); + +/* If this function pointer is null or if the function returns null + * the name field in static data struct should be returned by + * ucnv_getName() API function + */ +typedef const char * (*UConverterGetName) (const UConverter *cnv); + +/** + * Write the codepage substitution character. + * If this function is not set, then ucnv_cbFromUWriteSub() writes + * the substitution character from UConverter. + * For stateful converters, it is typically necessary to handle this + * specificially for the converter in order to properly maintain the state. + */ +typedef void (*UConverterWriteSub) (UConverterFromUnicodeArgs *pArgs, int32_t offsetIndex, UErrorCode *pErrorCode); + +/** + * For converter-specific safeClone processing + * If this function is not set, then ucnv_safeClone assumes that the converter has no private data that changes + * after the converter is done opening. + * If this function is set, then it is called just after a memcpy() of + * converter data to the new, empty converter, and is expected to set up + * the initial state of the converter. It is not expected to increment the + * reference counts of the standard data types such as the shared data. + */ +typedef UConverter * (*UConverterSafeClone) (const UConverter *cnv, + void *stackBuffer, + int32_t *pBufferSize, + UErrorCode *status); + +/** + * Filters for some ucnv_getUnicodeSet() implementation code. + */ +typedef enum UConverterSetFilter { + UCNV_SET_FILTER_NONE, + UCNV_SET_FILTER_DBCS_ONLY, + UCNV_SET_FILTER_2022_CN, + UCNV_SET_FILTER_SJIS, + UCNV_SET_FILTER_GR94DBCS, + UCNV_SET_FILTER_HZ, + UCNV_SET_FILTER_COUNT +} UConverterSetFilter; + +/** + * Fills the set of Unicode code points that can be converted by an ICU converter. + * The API function ucnv_getUnicodeSet() clears the USet before calling + * the converter's getUnicodeSet() implementation; the converter should only + * add the appropriate code points to allow recursive use. + * For example, the ISO-2022-JP converter will call each subconverter's + * getUnicodeSet() implementation to consecutively add code points to + * the same USet, which will result in a union of the sets of all subconverters. + * + * For more documentation, see ucnv_getUnicodeSet() in ucnv.h. + */ +typedef void (*UConverterGetUnicodeSet) (const UConverter *cnv, + const USetAdder *sa, + UConverterUnicodeSet which, + UErrorCode *pErrorCode); + +UBool CONVERSION_U_SUCCESS (UErrorCode err); + +/** + * UConverterImpl contains all the data and functions for a converter type. + * Its function pointers work much like a C++ vtable. + * Many converter types need to define only a subset of the functions; + * when a function pointer is NULL, then a default action will be performed. + * + * Every converter type must implement toUnicode, fromUnicode, and getNextUChar, + * otherwise the converter may crash. + * Every converter type that has variable-length codepage sequences should + * also implement toUnicodeWithOffsets and fromUnicodeWithOffsets for + * correct offset handling. + * All other functions may or may not be implemented - it depends only on + * whether the converter type needs them. + * + * When open() fails, then close() will be called, if present. + */ +struct UConverterImpl { + UConverterType type; + + UConverterLoad load; + UConverterUnload unload; + + UConverterOpen open; + UConverterClose close; + UConverterReset reset; + + UConverterToUnicode toUnicode; + UConverterToUnicode toUnicodeWithOffsets; + UConverterFromUnicode fromUnicode; + UConverterFromUnicode fromUnicodeWithOffsets; + UConverterGetNextUChar getNextUChar; + + UConverterGetStarters getStarters; + UConverterGetName getName; + UConverterWriteSub writeSub; + UConverterSafeClone safeClone; + UConverterGetUnicodeSet getUnicodeSet; + + UConverterConvert toUTF8; + UConverterConvert fromUTF8; +}; + +extern const UConverterSharedData + _MBCSData, _Latin1Data, + _UTF8Data, _UTF16BEData, _UTF16LEData, _UTF32BEData, _UTF32LEData, + _ISO2022Data, + _LMBCSData1,_LMBCSData2, _LMBCSData3, _LMBCSData4, _LMBCSData5, _LMBCSData6, + _LMBCSData8,_LMBCSData11,_LMBCSData16,_LMBCSData17,_LMBCSData18,_LMBCSData19, + _HZData,_ISCIIData, _SCSUData, _ASCIIData, + _UTF7Data, _Bocu1Data, _UTF16Data, _UTF32Data, _CESU8Data, _IMAPData, _CompoundTextData; + +U_CDECL_END + +/** Always use fallbacks from codepage to Unicode */ +#define TO_U_USE_FALLBACK(useFallback) true +#define UCNV_TO_U_USE_FALLBACK(cnv) true + +/** Use fallbacks from Unicode to codepage when cnv->useFallback or for private-use code points */ +#define IS_PRIVATE_USE(c) ((uint32_t)((c)-0xe000)<0x1900 || (uint32_t)((c)-0xf0000)<0x20000) +#define FROM_U_USE_FALLBACK(useFallback, c) ((useFallback) || IS_PRIVATE_USE(c)) +#define UCNV_FROM_U_USE_FALLBACK(cnv, c) FROM_U_USE_FALLBACK((cnv)->useFallback, c) + +/** + * Magic number for ucnv_getNextUChar(), returned by a + * getNextUChar() implementation to indicate to use the converter's toUnicode() + * instead of the native function. + * @internal + */ +#define UCNV_GET_NEXT_UCHAR_USE_TO_U -9 + +U_CFUNC void +ucnv_getCompleteUnicodeSet(const UConverter *cnv, + const USetAdder *sa, + UConverterUnicodeSet which, + UErrorCode *pErrorCode); + +U_CFUNC void +ucnv_getNonSurrogateUnicodeSet(const UConverter *cnv, + const USetAdder *sa, + UConverterUnicodeSet which, + UErrorCode *pErrorCode); + +U_CFUNC void +ucnv_fromUWriteBytes(UConverter *cnv, + const char *bytes, int32_t length, + char **target, const char *targetLimit, + int32_t **offsets, + int32_t sourceIndex, + UErrorCode *pErrorCode); +U_CFUNC void +ucnv_toUWriteUChars(UConverter *cnv, + const UChar *uchars, int32_t length, + UChar **target, const UChar *targetLimit, + int32_t **offsets, + int32_t sourceIndex, + UErrorCode *pErrorCode); + +U_CFUNC void +ucnv_toUWriteCodePoint(UConverter *cnv, + UChar32 c, + UChar **target, const UChar *targetLimit, + int32_t **offsets, + int32_t sourceIndex, + UErrorCode *pErrorCode); + +#endif + +#endif /* UCNV_CNV */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_ext.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_ext.h new file mode 100644 index 0000000000000000000000000000000000000000..dceea7ef12617a3254855c7eeef31e60f809e7ba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_ext.h @@ -0,0 +1,481 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2003-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ucnv_ext.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2003jun13 +* created by: Markus W. Scherer +* +* Conversion extensions +*/ + +#ifndef __UCNV_EXT_H__ +#define __UCNV_EXT_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "ucnv_cnv.h" + +/* + * See icuhtml/design/conversion/conversion_extensions.html + * + * Conversion extensions serve three purposes: + * 1. They support m:n mappings. + * 2. They support extension-only conversion files that are used together + * with the regular conversion data in base files. + * 3. They support mappings with more complicated meta data, + * for example "good one-way" mappings (|4). + * + * A base file may contain an extension table (explicitly requested or + * implicitly generated for m:n mappings), but its extension table is not + * used when an extension-only file is used. + * + * It is an error if a base file contains any regular (not extension) mapping + * from the same sequence as a mapping in the extension file + * because the base mapping would hide the extension mapping. + * + * + * Data for conversion extensions: + * + * One set of data structures per conversion direction (to/from Unicode). + * The data structures are sorted by input units to allow for binary search. + * Input sequences of more than one unit are handled like contraction tables + * in collation: + * The lookup value of a unit points to another table that is to be searched + * for the next unit, recursively. + * + * For conversion from Unicode, the initial code point is looked up in + * a 3-stage trie for speed, + * with an additional table of unique results to save space. + * + * Long output strings are stored in separate arrays, with length and index + * in the lookup tables. + * Output results also include a flag distinguishing roundtrip from + * (reverse) fallback mappings. + * + * Input Unicode strings must not begin or end with unpaired surrogates + * to avoid problems with matches on parts of surrogate pairs. + * + * Mappings from multiple characters (code points or codepage state + * table sequences) must be searched preferring the longest match. + * For this to work and be efficient, the variable-width table must contain + * all mappings that contain prefixes of the multiple characters. + * If an extension table is built on top of a base table in another file + * and a base table entry is a prefix of a multi-character mapping, then + * this is an error. + * + * + * Implementation note: + * + * Currently, the parser and several checks in the code limit the number + * of UChars or bytes in a mapping to + * UCNV_EXT_MAX_UCHARS and UCNV_EXT_MAX_BYTES, respectively, + * which are output value limits in the data structure. + * + * For input, this is not strictly necessary - it is a hard limit only for the + * buffers in UConverter that are used to store partial matches. + * + * Input sequences could otherwise be arbitrarily long if partial matches + * need not be stored (i.e., if a sequence does not span several buffers with too + * many units before the last buffer), although then results would differ + * depending on whether partial matches exceed the limits or not, + * which depends on the pattern of buffer sizes. + * + * + * Data structure: + * + * int32_t indexes[>=32]; + * + * Array of indexes and lengths etc. The length of the array is at least 32. + * The actual length is stored in indexes[0] to be forward compatible. + * + * Each index to another array is the number of bytes from indexes[]. + * Each length of an array is the number of array base units in that array. + * + * Some of the structures may not be present, in which case their indexes + * and lengths are 0. + * + * Usage of indexes[i]: + * [0] length of indexes[] + * + * // to Unicode table + * [1] index of toUTable[] (array of uint32_t) + * [2] length of toUTable[] + * [3] index of toUUChars[] (array of UChar) + * [4] length of toUUChars[] + * + * // from Unicode table, not for the initial code point + * [5] index of fromUTableUChars[] (array of UChar) + * [6] index of fromUTableValues[] (array of uint32_t) + * [7] length of fromUTableUChars[] and fromUTableValues[] + * [8] index of fromUBytes[] (array of char) + * [9] length of fromUBytes[] + * + * // from Unicode trie for initial-code point lookup + * [10] index of fromUStage12[] (combined array of uint16_t for stages 1 & 2) + * [11] length of stage 1 portion of fromUStage12[] + * [12] length of fromUStage12[] + * [13] index of fromUStage3[] (array of uint16_t indexes into fromUStage3b[]) + * [14] length of fromUStage3[] + * [15] index of fromUStage3b[] (array of uint32_t like fromUTableValues[]) + * [16] length of fromUStage3b[] + * + * [17] Bit field containing numbers of bytes: + * 31..24 reserved, 0 + * 23..16 maximum input bytes + * 15.. 8 maximum output bytes + * 7.. 0 maximum bytes per UChar + * + * [18] Bit field containing numbers of UChars: + * 31..24 reserved, 0 + * 23..16 maximum input UChars + * 15.. 8 maximum output UChars + * 7.. 0 maximum UChars per byte + * + * [19] Bit field containing flags: + * (extension table unicodeMask) + * 1 UCNV_HAS_SURROGATES flag for the extension table + * 0 UCNV_HAS_SUPPLEMENTARY flag for the extension table + * + * [20]..[30] reserved, 0 + * [31] number of bytes for the entire extension structure + * [>31] reserved; there are indexes[0] indexes + * + * + * uint32_t toUTable[]; + * + * Array of byte/value pairs for lookups for toUnicode conversion. + * The array is partitioned into sections like collation contraction tables. + * Each section contains one word with the number of following words and + * a default value for when the lookup in this section yields no match. + * + * A section is sorted in ascending order of input bytes, + * allowing for fast linear or binary searches. + * The builder may store entries for a contiguous range of byte values + * (compare difference between the first and last one with count), + * which then allows for direct array access. + * The builder should always do this for the initial table section. + * + * Entries may have 0 values, see below. + * No two entries in a section have the same byte values. + * + * Each uint32_t contains an input byte value in bits 31..24 and the + * corresponding lookup value in bits 23..0. + * Interpret the value as follows: + * if(value==0) { + * no match, see below + * } else if(value<0x1f0000) { + * partial match - use value as index to the next toUTable section + * and match the next unit; (value indexes toUTable[value]) + * } else { + * if(bit 23 set) { + * roundtrip; + * } else { + * fallback; + * } + * unset value bit 23; + * if(value<=0x2fffff) { + * (value-0x1f0000) is a code point; (BMP: value<=0x1fffff) + * } else { + * bits 17..0 (value&0x3ffff) is an index to + * the result UChars in toUUChars[]; (0 indexes toUUChars[0]) + * length of the result=((value>>18)-12); (length=0..19) + * } + * } + * + * The first word in a section contains the number of following words in the + * input byte position (bits 31..24, number=1..0xff). + * The value of the initial word is used when the current byte is not found + * in this section. + * If the value is not 0, then it represents a result as above. + * If the value is 0, then the search has to return a shorter match with an + * earlier default value as the result, or result in "unmappable" even for the + * initial bytes. + * If the value is 0 for the initial toUTable entry, then the initial byte + * does not start any mapping input. + * + * + * UChar toUUChars[]; + * + * Contains toUnicode mapping results, stored as sequences of UChars. + * Indexes and lengths stored in the toUTable[]. + * + * + * UChar fromUTableUChars[]; + * uint32_t fromUTableValues[]; + * + * The fromUTable is split into two arrays, but works otherwise much like + * the toUTable. The array is partitioned into sections like collation + * contraction tables and toUTable. + * A row in the table consists of same-index entries in fromUTableUChars[] + * and fromUTableValues[]. + * + * Interpret a value as follows: + * if(value==0) { + * no match, see below + * } else if(value<=0xffffff) { (bits 31..24 are 0) + * partial match - use value as index to the next fromUTable section + * and match the next unit; (value indexes fromUTable[value]) + * } else { + * if(value==0x80000001) { + * return no mapping, but request for ; + * } + * if(bit 31 set) { + * roundtrip (|0); + * } else if(bit 30 set) { + * "good one-way" mapping (|4); -- new in ICU4C 51, _MBCSHeader.version 5.4/4.4 + * } else { + * normal fallback (|1); + * } + * // bit 29 reserved, 0 + * length=(value>>24)&0x1f; (bits 28..24) + * if(length==1..3) { + * bits 23..0 contain 1..3 bytes, padded with 00s on the left; + * } else { + * bits 23..0 (value&0xffffff) is an index to + * the result bytes in fromUBytes[]; (0 indexes fromUBytes[0]) + * } + * } + * + * The first pair in a section contains the number of following pairs in the + * UChar position (16 bits, number=1..0xffff). + * The value of the initial pair is used when the current UChar is not found + * in this section. + * If the value is not 0, then it represents a result as above. + * If the value is 0, then the search has to return a shorter match with an + * earlier default value as the result, or result in "unmappable" even for the + * initial UChars. + * + * If the from Unicode trie is present, then the from Unicode search tables + * are not used for initial code points. + * In this case, the first entries (index 0) in the tables are not used + * (reserved, set to 0) because a value of 0 is used in trie results + * to indicate no mapping. + * + * + * uint16_t fromUStage12[]; + * + * Stages 1 & 2 of a trie that maps an initial code point. + * Indexes in stage 1 are all offset by the length of stage 1 so that the + * same array pointer can be used for both stages. + * If (c>>10)>=(length of stage 1) then c does not start any mapping. + * Same bit distribution as for regular conversion tries. + * + * + * uint16_t fromUStage3[]; + * uint32_t fromUStage3b[]; + * + * Stage 3 of the trie. The first array simply contains indexes to the second, + * which contains words in the same format as fromUTableValues[]. + * Use a stage 3 granularity of 4, which allows for 256k stage 3 entries, + * and 16-bit entries in stage 3 allow for 64k stage 3b entries. + * The stage 3 granularity means that the stage 2 entry needs to be left-shifted. + * + * Two arrays are used because it is expected that more than half of the stage 3 + * entries will be zero. The 16-bit index stage 3 array saves space even + * considering storing a total of 6 bytes per non-zero entry in both arrays + * together. + * Using a stage 3 granularity of >1 diminishes the compactability in that stage + * but provides a larger effective addressing space in stage 2. + * All but the final result stage use 16-bit entries to save space. + * + * fromUStage3b[] contains a zero for "no mapping" at its index 0, + * and may contain UCNV_EXT_FROM_U_SUBCHAR1 at index 1 for " SUB mapping" + * (i.e., "no mapping" with preference for rather than ), + * and all other items are unique non-zero results. + * + * The default value of a fromUTableValues[] section that is referenced + * _directly_ from a fromUStage3b[] item may also be UCNV_EXT_FROM_U_SUBCHAR1, + * but this value must not occur anywhere else in fromUTableValues[] + * because "no mapping" is always a property of a single code point, + * never of multiple. + * + * + * char fromUBytes[]; + * + * Contains fromUnicode mapping results, stored as sequences of chars. + * Indexes and lengths stored in the fromUTableValues[]. + */ +enum { + UCNV_EXT_INDEXES_LENGTH, /* 0 */ + + UCNV_EXT_TO_U_INDEX, /* 1 */ + UCNV_EXT_TO_U_LENGTH, + UCNV_EXT_TO_U_UCHARS_INDEX, + UCNV_EXT_TO_U_UCHARS_LENGTH, + + UCNV_EXT_FROM_U_UCHARS_INDEX, /* 5 */ + UCNV_EXT_FROM_U_VALUES_INDEX, + UCNV_EXT_FROM_U_LENGTH, + UCNV_EXT_FROM_U_BYTES_INDEX, + UCNV_EXT_FROM_U_BYTES_LENGTH, + + UCNV_EXT_FROM_U_STAGE_12_INDEX, /* 10 */ + UCNV_EXT_FROM_U_STAGE_1_LENGTH, + UCNV_EXT_FROM_U_STAGE_12_LENGTH, + UCNV_EXT_FROM_U_STAGE_3_INDEX, + UCNV_EXT_FROM_U_STAGE_3_LENGTH, + UCNV_EXT_FROM_U_STAGE_3B_INDEX, + UCNV_EXT_FROM_U_STAGE_3B_LENGTH, + + UCNV_EXT_COUNT_BYTES, /* 17 */ + UCNV_EXT_COUNT_UCHARS, + UCNV_EXT_FLAGS, + + UCNV_EXT_RESERVED_INDEX, /* 20, moves with additional indexes */ + + UCNV_EXT_SIZE=31, + UCNV_EXT_INDEXES_MIN_LENGTH=32 +}; + +/* get the pointer to an extension array from indexes[index] */ +#define UCNV_EXT_ARRAY(indexes, index, itemType) \ + ((const itemType *)((const char *)(indexes)+(indexes)[index])) + +#define UCNV_GET_MAX_BYTES_PER_UCHAR(indexes) \ + ((indexes)[UCNV_EXT_COUNT_BYTES]&0xff) + +/* internal API ------------------------------------------------------------- */ + +U_CFUNC UBool +ucnv_extInitialMatchToU(UConverter *cnv, const int32_t *cx, + int32_t firstLength, + const char **src, const char *srcLimit, + UChar **target, const UChar *targetLimit, + int32_t **offsets, int32_t srcIndex, + UBool flush, + UErrorCode *pErrorCode); + +U_CFUNC UChar32 +ucnv_extSimpleMatchToU(const int32_t *cx, + const char *source, int32_t length, + UBool useFallback); + +U_CFUNC void +ucnv_extContinueMatchToU(UConverter *cnv, + UConverterToUnicodeArgs *pArgs, int32_t srcIndex, + UErrorCode *pErrorCode); + + +U_CFUNC UBool +ucnv_extInitialMatchFromU(UConverter *cnv, const int32_t *cx, + UChar32 cp, + const UChar **src, const UChar *srcLimit, + char **target, const char *targetLimit, + int32_t **offsets, int32_t srcIndex, + UBool flush, + UErrorCode *pErrorCode); + +U_CFUNC int32_t +ucnv_extSimpleMatchFromU(const int32_t *cx, + UChar32 cp, uint32_t *pValue, + UBool useFallback); + +U_CFUNC void +ucnv_extContinueMatchFromU(UConverter *cnv, + UConverterFromUnicodeArgs *pArgs, int32_t srcIndex, + UErrorCode *pErrorCode); + +/* + * Add code points and strings to the set according to the extension mappings. + * Limitation on the UConverterSetFilter: + * The filters currently assume that they are used with 1:1 mappings. + * They only apply to single input code points, and then they pass through + * only mappings with single-charset-code results. + * For example, the Shift-JIS filter only works for 2-byte results and tests + * that those 2 bytes are in the JIS X 0208 range of Shift-JIS. + */ +U_CFUNC void +ucnv_extGetUnicodeSet(const UConverterSharedData *sharedData, + const USetAdder *sa, + UConverterUnicodeSet which, + UConverterSetFilter filter, + UErrorCode *pErrorCode); + +/* toUnicode helpers -------------------------------------------------------- */ + +#define UCNV_EXT_TO_U_BYTE_SHIFT 24 +#define UCNV_EXT_TO_U_VALUE_MASK 0xffffff +#define UCNV_EXT_TO_U_MIN_CODE_POINT 0x1f0000 +#define UCNV_EXT_TO_U_MAX_CODE_POINT 0x2fffff +#define UCNV_EXT_TO_U_ROUNDTRIP_FLAG ((uint32_t)1<<23) +#define UCNV_EXT_TO_U_INDEX_MASK 0x3ffff +#define UCNV_EXT_TO_U_LENGTH_SHIFT 18 +#define UCNV_EXT_TO_U_LENGTH_OFFSET 12 + +/* maximum number of indexed UChars */ +#define UCNV_EXT_MAX_UCHARS 19 + +#define UCNV_EXT_TO_U_MAKE_WORD(byte, value) (((uint32_t)(byte)<>UCNV_EXT_TO_U_BYTE_SHIFT) +#define UCNV_EXT_TO_U_GET_VALUE(word) ((word)&UCNV_EXT_TO_U_VALUE_MASK) + +#define UCNV_EXT_TO_U_IS_PARTIAL(value) ((value)>UCNV_EXT_TO_U_LENGTH_SHIFT)-UCNV_EXT_TO_U_LENGTH_OFFSET) + +/* fromUnicode helpers ------------------------------------------------------ */ + +/* most trie constants are shared with ucnvmbcs.h */ + +/* see similar utrie.h UTRIE_INDEX_SHIFT and UTRIE_DATA_GRANULARITY */ +#define UCNV_EXT_STAGE_2_LEFT_SHIFT 2 +#define UCNV_EXT_STAGE_3_GRANULARITY 4 + +/* trie access, returns the stage 3 value=index to stage 3b; s1Index=c>>10 */ +#define UCNV_EXT_FROM_U(stage12, stage3, s1Index, c) \ + (stage3)[ ((int32_t)(stage12)[ (stage12)[s1Index] +(((c)>>4)&0x3f) ]< (impossible roundtrip to 0 bytes, value 01) */ +#define UCNV_EXT_FROM_U_SUBCHAR1 0x80000001 + +/* at most 3 bytes in the lower part of the value */ +#define UCNV_EXT_FROM_U_MAX_DIRECT_LENGTH 3 + +/* maximum number of indexed bytes */ +#define UCNV_EXT_MAX_BYTES 0x1f + +#define UCNV_EXT_FROM_U_IS_PARTIAL(value) (((value)>>UCNV_EXT_FROM_U_LENGTH_SHIFT)==0) +#define UCNV_EXT_FROM_U_GET_PARTIAL_INDEX(value) (value) + +#define UCNV_EXT_FROM_U_IS_ROUNDTRIP(value) (((value)&UCNV_EXT_FROM_U_ROUNDTRIP_FLAG)!=0) +#define UCNV_EXT_FROM_U_MASK_ROUNDTRIP(value) ((value)&~UCNV_EXT_FROM_U_ROUNDTRIP_FLAG) + +/* get length; masks away all other bits */ +#define UCNV_EXT_FROM_U_GET_LENGTH(value) (int32_t)(((value)>>UCNV_EXT_FROM_U_LENGTH_SHIFT)&UCNV_EXT_MAX_BYTES) + +/* get bytes or bytes index */ +#define UCNV_EXT_FROM_U_GET_DATA(value) ((value)&UCNV_EXT_FROM_U_DATA_MASK) + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_imp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_imp.h new file mode 100644 index 0000000000000000000000000000000000000000..c5e6aeb47e48d861e026b4d0ae0100ba4afe6d37 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_imp.h @@ -0,0 +1,139 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* +* ucnv_imp.h: +* Contains all internal and external data structure definitions +* Created & Maitained by Bertrand A. Damiba +* +* +* +* ATTENTION: +* --------- +* Although the data structures in this file are open and stack allocatable +* we reserve the right to hide them in further releases. +*/ + +#ifndef UCNV_IMP_H +#define UCNV_IMP_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/uloc.h" +#include "ucnv_bld.h" + +/* + * Fast check for whether a charset name is "UTF-8". + * This does not recognize all of the variations that ucnv_open() + * and other functions recognize, but it covers most cases. + * @param name const char * charset name + * @return + */ +#define UCNV_FAST_IS_UTF8(name) \ + (((name[0]=='U' ? \ + ( name[1]=='T' && name[2]=='F') : \ + (name[0]=='u' && name[1]=='t' && name[2]=='f'))) \ + && (name[3]=='-' ? \ + (name[4]=='8' && name[5]==0) : \ + (name[3]=='8' && name[4]==0))) + +typedef struct { + char cnvName[UCNV_MAX_CONVERTER_NAME_LENGTH]; + char locale[ULOC_FULLNAME_CAPACITY]; + uint32_t options; +} UConverterNamePieces; + +U_CFUNC UBool +ucnv_canCreateConverter(const char *converterName, UErrorCode *err); + +/* figures out if we need to go to file to read in the data tables. + * @param converterName The name of the converter + * @param err The error code + * @return the newly created converter + */ +U_CAPI UConverter * +ucnv_createConverter(UConverter *myUConverter, const char *converterName, UErrorCode * err); + +/* + * Open a purely algorithmic converter, specified by a type constant. + * @param myUConverter NULL, or pre-allocated UConverter structure to avoid + * a memory allocation + * @param type requested converter type + * @param locale locale parameter, or "" + * @param options converter options bit set (default 0) + * @param err ICU error code, not tested for U_FAILURE on input + * because this is an internal function + * @internal + */ +U_CFUNC UConverter * +ucnv_createAlgorithmicConverter(UConverter *myUConverter, + UConverterType type, + const char *locale, uint32_t options, + UErrorCode *err); + +/* + * Creates a converter from shared data. + * Adopts mySharedConverterData: No matter what happens, the caller must not + * unload mySharedConverterData, except via ucnv_close(return value) + * if this function is successful. + */ +U_CFUNC UConverter * +ucnv_createConverterFromSharedData(UConverter *myUConverter, + UConverterSharedData *mySharedConverterData, + UConverterLoadArgs *pArgs, + UErrorCode *err); + +U_CFUNC UConverter * +ucnv_createConverterFromPackage(const char *packageName, const char *converterName, UErrorCode *err); + +/** + * Load a converter but do not create a UConverter object. + * Simply return the UConverterSharedData. + * Performs alias lookup etc. + * The UConverterNamePieces need not be initialized + * before calling this function. + * The UConverterLoadArgs must be initialized + * before calling this function. + * If the args are passed in, then the pieces must be passed in too. + * In other words, the following combinations are allowed: + * - pieces==NULL && args==NULL + * - pieces!=NULL && args==NULL + * - pieces!=NULL && args!=NULL + * @internal + */ +U_CFUNC UConverterSharedData * +ucnv_loadSharedData(const char *converterName, + UConverterNamePieces *pieces, + UConverterLoadArgs *pArgs, + UErrorCode * err); + +/** + * This may unload the shared data in a thread safe manner. + * This will only unload the data if no other converters are sharing it. + */ +U_CFUNC void +ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData); + +/** + * This is a thread safe way to increment the reference count. + */ +U_CFUNC void +ucnv_incrementRefCount(UConverterSharedData *sharedData); + +/** + * These are the default error handling callbacks for the charset conversion framework. + * For performance reasons, they are only called to handle an error (not normally called for a reset or close). + */ +#define UCNV_TO_U_DEFAULT_CALLBACK ((UConverterToUCallback) UCNV_TO_U_CALLBACK_SUBSTITUTE) +#define UCNV_FROM_U_DEFAULT_CALLBACK ((UConverterFromUCallback) UCNV_FROM_U_CALLBACK_SUBSTITUTE) + +#endif + +#endif /* _UCNV_IMP */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_io.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_io.h new file mode 100644 index 0000000000000000000000000000000000000000..8f2d7b5a02bbfa07140fea5d9283b4b36bc04a4b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnv_io.h @@ -0,0 +1,127 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ********************************************************************** + * Copyright (C) 1999-2006, International Business Machines + * Corporation and others. All Rights Reserved. + ********************************************************************** + * + * + * ucnv_io.h: + * defines variables and functions pertaining to converter name resolution + * aspect of the conversion code + */ + +#ifndef UCNV_IO_H +#define UCNV_IO_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "udataswp.h" + +#define UCNV_AMBIGUOUS_ALIAS_MAP_BIT 0x8000 +#define UCNV_CONTAINS_OPTION_BIT 0x4000 +#define UCNV_CONVERTER_INDEX_MASK 0xFFF +#define UCNV_NUM_RESERVED_TAGS 2 +#define UCNV_NUM_HIDDEN_TAGS 1 + +enum { + UCNV_IO_UNNORMALIZED, + UCNV_IO_STD_NORMALIZED, + UCNV_IO_NORM_TYPE_COUNT +}; + +typedef struct { + uint16_t stringNormalizationType; + uint16_t containsCnvOptionInfo; +} UConverterAliasOptions; + +typedef struct UConverterAlias { + const uint16_t *converterList; + const uint16_t *tagList; + const uint16_t *aliasList; + const uint16_t *untaggedConvArray; + const uint16_t *taggedAliasArray; + const uint16_t *taggedAliasLists; + const UConverterAliasOptions *optionTable; + const uint16_t *stringTable; + const uint16_t *normalizedStringTable; + + uint32_t converterListSize; + uint32_t tagListSize; + uint32_t aliasListSize; + uint32_t untaggedConvArraySize; + uint32_t taggedAliasArraySize; + uint32_t taggedAliasListsSize; + uint32_t optionTableSize; + uint32_t stringTableSize; + uint32_t normalizedStringTableSize; +} UConverterAlias; + +/** + * \var ucnv_io_stripForCompare + * Remove the underscores, dashes and spaces from the name, and convert + * the name to lower case. + * @param dst The destination buffer, which is <= the buffer of name. + * @param dst The destination buffer, which is <= the buffer of name. + * @see ucnv_compareNames + * @return the destination buffer. + */ +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define ucnv_io_stripForCompare ucnv_io_stripASCIIForCompare +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define ucnv_io_stripForCompare ucnv_io_stripEBCDICForCompare +#else +# error U_CHARSET_FAMILY is not valid +#endif + +U_CAPI char * U_CALLCONV +ucnv_io_stripASCIIForCompare(char *dst, const char *name); + +U_CAPI char * U_CALLCONV +ucnv_io_stripEBCDICForCompare(char *dst, const char *name); + +/** + * Map a converter alias name to a canonical converter name. + * The alias is searched for case-insensitively, the converter name + * is returned in mixed-case. + * Returns NULL if the alias is not found. + * @param alias The alias name to be searched. + * @param containsOption A return value stating whether the returned converter name contains an option (a comma) + * @param pErrorCode The error code + * @return the converter name in mixed-case, return NULL if the alias is not found. + */ +U_CAPI const char * +ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *pErrorCode); + +/** + * Return the number of all known converter names (no aliases). + * @param pErrorCode The error code + * @return the number of all aliases + */ +U_CAPI uint16_t +ucnv_io_countKnownConverters(UErrorCode *pErrorCode); + +/** + * Swap an ICU converter alias table. See implementation for details. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ucnv_swapAliases(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +#endif + +#endif /* _UCNV_IO */ + +/* + * Hey, Emacs, please set the following: + * + * Local Variables: + * indent-tabs-mode: nil + * End: + * + */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnvmbcs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnvmbcs.h new file mode 100644 index 0000000000000000000000000000000000000000..c8f3b89a5e464d4dccd47331a07d42b89cbcd316 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucnvmbcs.h @@ -0,0 +1,605 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2000-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ucnvmbcs.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2000jul07 +* created by: Markus W. Scherer +*/ + +#ifndef __UCNVMBCS_H__ +#define __UCNVMBCS_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "ucnv_cnv.h" +#include "ucnv_ext.h" + +/** + * ICU conversion (.cnv) data file structure, following the usual UDataInfo + * header. + * + * Format version: 6.2 + * + * struct UConverterStaticData -- struct containing the converter name, IBM CCSID, + * min/max bytes per character, etc. + * see ucnv_bld.h + * + * -------------------- + * + * The static data is followed by conversionType-specific data structures. + * At the moment, there are only variations of MBCS converters. They all have + * the same toUnicode structures, while the fromUnicode structures for SBCS + * differ from those for other MBCS-style converters. + * + * _MBCSHeader.version 5 is optional and not backward-compatible + * (as usual for changes in the major version field). + * + * Versions 5.m work like versions 4.m except: + * - The _MBCSHeader has variable length (and is always longer than in version 4). + * See the struct _MBCSHeader further description below. + * - There is a set of flags which indicate further incompatible changes. + * (Reader code must reject the file if it does not recognize them all.) + * - In particular, one of these flags indicates that most of the fromUnicode + * data is missing and must be reconstituted from the toUnicode data + * and from the utf8Friendly mbcsIndex at load time. + * (This only works with a utf8Friendly table.) + * In this case, makeconv may increase maxFastUChar automatically to U+FFFF. + * + * The first of these versions is 5.3, which is like 4.3 except for the differences above. + * + * When possible, makeconv continues to generate version 4.m files. + * + * _MBCSHeader.version 5.4/4.4 supports "good one-way" mappings (|4) + * in the extension tables (fromUTableValues bit 30). See ucnv_ext.h for details. + * + * _MBCSHeader.version 4.3 optionally modifies the fromUnicode data structures + * slightly and optionally adds a table for conversion to MBCS (non-SBCS) + * charsets. + * + * The modifications are to make the data utf8Friendly. Not every 4.3 file + * file contains utf8Friendly data. + * It is utf8Friendly if _MBCSHeader.version[2]!=0. + * In this case, the data structures are utf8Friendly up to the code point + * maxFastUChar=((_MBCSHeader.version[2]<<8)|0xff) + * + * A utf8Friendly file has fromUnicode stage 3 entries for code points up to + * maxFastUChar allocated in blocks of 64 for indexing with the 6 bits from + * a UTF-8 trail byte. ASCII is allocated linearly with 128 contiguous entries. + * + * In addition, a utf8Friendly MBCS file contains an additional + * uint16_t mbcsIndex[(maxFastUChar+1)>>6]; + * which replaces the stage 1 and 2 tables for indexing with bits from the + * UTF-8 lead byte and middle trail byte. Unlike the older MBCS stage 2 table, + * the mbcsIndex does not contain roundtrip flags. Therefore, all fallbacks + * from code points up to maxFastUChar (and roundtrips to 0x00) are moved to + * the extension data structure. This also allows for faster roundtrip + * conversion from UTF-16. + * + * SBCS files do not contain an additional sbcsIndex[] array because the + * proportional size increase would be noticeable, but the runtime + * code builds one for the code point range for which the runtime conversion + * code is optimized. + * + * For SBCS, maxFastUChar should be at least U+0FFF. The initial makeconv + * implementation sets it to U+1FFF. Because the sbcsIndex is not stored in + * the file, a larger maxFastUChar only affects stage 3 block allocation size + * and is free in empty blocks. (Larger blocks with sparse contents cause larger + * files.) U+1FFF includes almost all of the small scripts. + * U+0FFF covers UTF-8 two-byte sequences and three-byte sequences starting with + * 0xe0. This includes most scripts with legacy SBCS charsets. + * The initial runtime implementation using 4.3 files only builds an sbcsIndex + * for code points up to U+0FFF. + * + * For MBCS, maxFastUChar should be at least U+D7FF (=initial value). + * This boundary is convenient because practically all of the commonly used + * characters are below it, and because it is the boundary to surrogate + * code points, above which special handling is necessary anyway. + * (Surrogate pair assembly for UTF-16, validity checking for UTF-8.) + * + * maxFastUChar could be up to U+FFFF to cover the whole BMP, which could be + * useful especially for conversion from UTF-8 when the input can be assumed + * to be valid, because the surrogate range would then not have to be + * checked. + * (With maxFastUChar=0xffff, makeconv would have to check for mbcsIndex value + * overflow because with the all-unassigned block 0 and nearly full mappings + * from the BMP it is theoretically possible that an index into stage 3 + * exceeds 16 bits.) + * + * _MBCSHeader.version 4.2 adds an optional conversion extension data structure. + * If it is present, then an ICU version reading header versions 4.0 or 4.1 + * will be able to use the base table and ignore the extension. + * + * The unicodeMask in the static data is part of the base table data structure. + * Especially, the UCNV_HAS_SUPPLEMENTARY flag determines the length of the + * fromUnicode stage 1 array. + * The static data unicodeMask refers only to the base table's properties if + * a base table is included. + * In an extension-only file, the static data unicodeMask is 0. + * The extension data indexes have a separate field with the unicodeMask flags. + * + * MBCS-style data structure following the static data. + * Offsets are counted in bytes from the beginning of the MBCS header structure. + * Details about usage in comments in ucnvmbcs.c. + * + * struct _MBCSHeader (see the definition in this header file below) + * contains 32-bit fields as follows: + * 8 values: + * 0 uint8_t[4] MBCS version in UVersionInfo format (currently 4.3.x.0) + * 1 uint32_t countStates + * 2 uint32_t countToUFallbacks + * 3 uint32_t offsetToUCodeUnits + * 4 uint32_t offsetFromUTable + * 5 uint32_t offsetFromUBytes + * 6 uint32_t flags, bits: + * 31.. 8 offsetExtension -- _MBCSHeader.version 4.2 (ICU 2.8) and higher + * 0 for older versions and if + * there is not extension structure + * 7.. 0 outputType + * 7 uint32_t fromUBytesLength -- _MBCSHeader.version 4.1 (ICU 2.4) and higher + * counts bytes in fromUBytes[] + * + * New and required in version 5: + * 8 uint32_t options, bits: + * 31..16 reserved for flags that can be added without breaking + * backward compatibility + * 15.. 6 reserved for flags whose addition will break + * backward compatibility + * 6 MBCS_OPT_FROM_U -- if set, + * then most of the fromUnicode data is omitted; + * fullStage2Length is present and the missing + * bottom part of stage 2 must be reconstituted from + * the toUnicode data; + * stage 3 is missing completely as well; + * not used for SBCS tables + * 5.. 0 length of the _MBCSHeader (number of uint32_t) + * + * New and optional in version 5: + * 9 uint32_t fullStage2Length: used if MBCS_OPT_FROM_U is set + * specifies the full length of stage 2 + * including the omitted part + * + * if(outputType==MBCS_OUTPUT_EXT_ONLY) { + * -- base table name for extension-only table + * char baseTableName[variable]; -- with NUL plus padding for 4-alignment + * + * -- all _MBCSHeader fields except for version and flags are 0 + * } else { + * -- normal base table with optional extension + * + * int32_t stateTable[countStates][256]; + * + * struct _MBCSToUFallback { (fallbacks are sorted by offset) + * uint32_t offset; + * UChar32 codePoint; + * } toUFallbacks[countToUFallbacks]; + * + * uint16_t unicodeCodeUnits[(offsetFromUTable-offsetToUCodeUnits)/2]; + * (padded to an even number of units) + * + * -- stage 1 tables + * if(staticData.unicodeMask&UCNV_HAS_SUPPLEMENTARY) { + * -- stage 1 table for all of Unicode + * uint16_t fromUTable[0x440]; (32-bit-aligned) + * } else { + * -- BMP-only tables have a smaller stage 1 table + * uint16_t fromUTable[0x40]; (32-bit-aligned) + * } + * + * -- stage 2 tables + * length determined by top of stage 1 and bottom of stage 3 tables + * if(outputType==MBCS_OUTPUT_1) { + * -- SBCS: pure indexes + * uint16_t stage 2 indexes[?]; + * } else { + * -- DBCS, MBCS, EBCDIC_STATEFUL, ...: roundtrip flags and indexes + * uint32_t stage 2 flags and indexes[?]; + * if(options&MBCS_OPT_NO_FROM_U) { + * stage 2 really has length fullStage2Length + * and the omitted lower part must be reconstituted from + * the toUnicode data + * } + * } + * + * -- stage 3 tables with byte results + * if(outputType==MBCS_OUTPUT_1) { + * -- SBCS: each 16-bit result contains flags and the result byte, see ucnvmbcs.c + * uint16_t fromUBytes[fromUBytesLength/2]; + * } else if(!(options&MBCS_OPT_NO_FROM_U)) { + * -- DBCS, MBCS, EBCDIC_STATEFUL, ... 2/3/4 bytes result, see ucnvmbcs.c + * uint8_t fromUBytes[fromUBytesLength]; or + * uint16_t fromUBytes[fromUBytesLength/2]; or + * uint32_t fromUBytes[fromUBytesLength/4]; + * } else { + * fromUBytes[] must be reconstituted from the toUnicode data + * } + * + * -- optional utf8Friendly mbcsIndex -- _MBCSHeader.version 4.3 (ICU 3.8) and higher + * if(outputType!=MBCS_OUTPUT_1 && + * _MBCSHeader.version[1]>=3 && + * (maxFastUChar=_MBCSHeader.version[2])!=0 + * ) { + * maxFastUChar=(maxFastUChar<<8)|0xff; + * uint16_t mbcsIndex[(maxFastUChar+1)>>6]; + * } + * } + * + * -- extension table, details see ucnv_ext.h + * int32_t indexes[>=32]; ... + */ + +/* MBCS converter data and state -------------------------------------------- */ + +enum { + MBCS_MAX_STATE_COUNT=128 +}; + +/** + * MBCS action codes for conversions to Unicode. + * These values are in bits 23..20 of the state table entries. + */ +enum { + MBCS_STATE_VALID_DIRECT_16, + MBCS_STATE_VALID_DIRECT_20, + + MBCS_STATE_FALLBACK_DIRECT_16, + MBCS_STATE_FALLBACK_DIRECT_20, + + MBCS_STATE_VALID_16, + MBCS_STATE_VALID_16_PAIR, + + MBCS_STATE_UNASSIGNED, + MBCS_STATE_ILLEGAL, + + MBCS_STATE_CHANGE_ONLY +}; + +/* Macros for state table entries */ +#define MBCS_ENTRY_TRANSITION(state, offset) (int32_t)(((int32_t)(state)<<24L)|(offset)) +#define MBCS_ENTRY_TRANSITION_SET_OFFSET(entry, offset) (int32_t)(((entry)&0xff000000)|(offset)) +#define MBCS_ENTRY_TRANSITION_ADD_OFFSET(entry, offset) (int32_t)((entry)+(offset)) + +#define MBCS_ENTRY_FINAL(state, action, value) (int32_t)(0x80000000|((int32_t)(state)<<24L)|((action)<<20L)|(value)) +#define MBCS_ENTRY_SET_FINAL(entry) (int32_t)((entry)|0x80000000) +#define MBCS_ENTRY_FINAL_SET_ACTION(entry, action) (int32_t)(((entry)&0xff0fffff)|((int32_t)(action)<<20L)) +#define MBCS_ENTRY_FINAL_SET_VALUE(entry, value) (int32_t)(((entry)&0xfff00000)|(value)) +#define MBCS_ENTRY_FINAL_SET_ACTION_VALUE(entry, action, value) (int32_t)(((entry)&0xff000000)|((int32_t)(action)<<20L)|(value)) + +#define MBCS_ENTRY_SET_STATE(entry, state) (int32_t)(((entry)&0x80ffffff)|((int32_t)(state)<<24L)) + +#define MBCS_ENTRY_STATE(entry) ((((uint32_t)entry)>>24)&0x7f) + +#define MBCS_ENTRY_IS_TRANSITION(entry) ((entry)>=0) +#define MBCS_ENTRY_IS_FINAL(entry) ((entry)<0) + +#define MBCS_ENTRY_TRANSITION_STATE(entry) (((uint32_t)entry)>>24) +#define MBCS_ENTRY_TRANSITION_OFFSET(entry) ((entry)&0xffffff) + +#define MBCS_ENTRY_FINAL_STATE(entry) ((((uint32_t)entry)>>24)&0x7f) +#define MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry) ((entry)<(int32_t)0x80100000) +#define MBCS_ENTRY_FINAL_ACTION(entry) ((((uint32_t)entry)>>20)&0xf) +#define MBCS_ENTRY_FINAL_VALUE(entry) ((entry)&0xfffff) +#define MBCS_ENTRY_FINAL_VALUE_16(entry) (uint16_t)(entry) + +#define IS_ASCII_ROUNDTRIP(b, asciiRoundtrips) (((asciiRoundtrips) & (1<<((b)>>2)))!=0) + +/* single-byte fromUnicode: get the 16-bit result word */ +#define MBCS_SINGLE_RESULT_FROM_U(table, results, c) (results)[ (table)[ (table)[(c)>>10] +(((c)>>4)&0x3f) ] +((c)&0xf) ] + +/* single-byte fromUnicode using the sbcsIndex */ +#define SBCS_RESULT_FROM_LOW_BMP(table, results, c) (results)[ (table)[(c)>>6] +((c)&0x3f) ] + +/* single-byte fromUTF8 using the sbcsIndex; l and t must be masked externally; can be l=0 and t<=0x7f */ +#define SBCS_RESULT_FROM_UTF8(table, results, l, t) (results)[ (table)[l] +(t) ] + +/* multi-byte fromUnicode: get the 32-bit stage 2 entry */ +#define MBCS_STAGE_2_FROM_U(table, c) ((const uint32_t *)(table))[ (table)[(c)>>10] +(((c)>>4)&0x3f) ] +#define MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, c) ( ((stage2Entry) & ((uint32_t)1<< (16+((c)&0xf)) )) !=0) + +#define MBCS_VALUE_2_FROM_STAGE_2(bytes, stage2Entry, c) ((uint16_t *)(bytes))[16*(uint32_t)(uint16_t)(stage2Entry)+((c)&0xf)] +#define MBCS_VALUE_4_FROM_STAGE_2(bytes, stage2Entry, c) ((uint32_t *)(bytes))[16*(uint32_t)(uint16_t)(stage2Entry)+((c)&0xf)] + +#define MBCS_POINTER_3_FROM_STAGE_2(bytes, stage2Entry, c) ((bytes)+(16*(uint32_t)(uint16_t)(stage2Entry)+((c)&0xf))*3) + +/* double-byte fromUnicode using the mbcsIndex */ +#define DBCS_RESULT_FROM_MOST_BMP(table, results, c) (results)[ (table)[(c)>>6] +((c)&0x3f) ] + +/* double-byte fromUTF8 using the mbcsIndex; l and t1 combined into lt1; lt1 and t2 must be masked externally */ +#define DBCS_RESULT_FROM_UTF8(table, results, lt1, t2) (results)[ (table)[lt1] +(t2) ] + + +/** + * MBCS output types for conversions from Unicode. + * These per-converter types determine the storage method in stage 3 of the lookup table, + * mostly how many bytes are stored per entry. + */ +enum { + MBCS_OUTPUT_1, /* 0 */ + MBCS_OUTPUT_2, /* 1 */ + MBCS_OUTPUT_3, /* 2 */ + MBCS_OUTPUT_4, /* 3 */ + + MBCS_OUTPUT_3_EUC=8, /* 8 */ + MBCS_OUTPUT_4_EUC, /* 9 */ + + MBCS_OUTPUT_2_SISO=12, /* c */ + MBCS_OUTPUT_2_HZ, /* d */ + + MBCS_OUTPUT_EXT_ONLY, /* e */ + + MBCS_OUTPUT_COUNT, + + MBCS_OUTPUT_DBCS_ONLY=0xdb /* runtime-only type for DBCS-only handling of SISO tables */ +}; + +/** + * Fallbacks to Unicode are stored outside the normal state table and code point structures + * in a vector of items of this type. They are sorted by offset. + */ +typedef struct { + uint32_t offset; + UChar32 codePoint; +} _MBCSToUFallback; + +/** Constants for fast and UTF-8-friendly conversion. */ +enum { + SBCS_FAST_MAX=0x0fff, /* maximum code point with UTF-8-friendly SBCS runtime code, see makeconv SBCS_UTF8_MAX */ + SBCS_FAST_LIMIT=SBCS_FAST_MAX+1, /* =0x1000 */ + MBCS_FAST_MAX=0xd7ff, /* maximum code point with UTF-8-friendly MBCS runtime code, see makeconv MBCS_UTF8_MAX */ + MBCS_FAST_LIMIT=MBCS_FAST_MAX+1 /* =0xd800 */ +}; + +/** + * This is the MBCS part of the UConverterTable union (a runtime data structure). + * It keeps all the per-converter data and points into the loaded mapping tables. + * + * utf8Friendly data structures added with _MBCSHeader.version 4.3 + */ +typedef struct UConverterMBCSTable { + /* toUnicode */ + uint8_t countStates, dbcsOnlyState, stateTableOwned; + uint32_t countToUFallbacks; + + const int32_t (*stateTable)/*[countStates]*/[256]; + int32_t (*swapLFNLStateTable)/*[countStates]*/[256]; /* for swaplfnl */ + const uint16_t *unicodeCodeUnits/*[countUnicodeResults]*/; + const _MBCSToUFallback *toUFallbacks; + + /* fromUnicode */ + const uint16_t *fromUnicodeTable; + const uint16_t *mbcsIndex; /* for fast conversion from most of BMP to MBCS (utf8Friendly data) */ + uint16_t sbcsIndex[SBCS_FAST_LIMIT>>6]; /* for fast conversion from low BMP to SBCS (utf8Friendly data) */ + const uint8_t *fromUnicodeBytes; + uint8_t *swapLFNLFromUnicodeBytes; /* for swaplfnl */ + uint32_t fromUBytesLength; + uint8_t outputType, unicodeMask; + UBool utf8Friendly; /* for utf8Friendly data */ + UChar maxFastUChar; /* for utf8Friendly data */ + + /* roundtrips */ + uint32_t asciiRoundtrips; + + /* reconstituted data that was omitted from the .cnv file */ + uint8_t *reconstitutedData; + + /* converter name for swaplfnl */ + char *swapLFNLName; + + /* extension data */ + struct UConverterSharedData *baseSharedData; + const int32_t *extIndexes; +} UConverterMBCSTable; + +#define UCNV_MBCS_TABLE_INITIALIZER { \ + /* toUnicode */ \ + 0, 0, 0, \ + 0, \ + \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + \ + /* fromUnicode */ \ + NULL, \ + NULL, \ + { 0 }, \ + NULL, \ + NULL, \ + 0, \ + 0, 0, \ + false, \ + 0, \ + \ + /* roundtrips */ \ + 0, \ + \ + /* reconstituted data that was omitted from the .cnv file */ \ + NULL, \ + \ + /* converter name for swaplfnl */ \ + NULL, \ + \ + /* extension data */ \ + NULL, \ + NULL \ +} + +enum { + MBCS_OPT_LENGTH_MASK=0x3f, + MBCS_OPT_NO_FROM_U=0x40, + /* + * If any of the following options bits are set, + * then the file must be rejected. + */ + MBCS_OPT_INCOMPATIBLE_MASK=0xffc0, + /* + * Remove bits from this mask as more options are recognized + * by all implementations that use this constant. + */ + MBCS_OPT_UNKNOWN_INCOMPATIBLE_MASK=0xff80 +}; + +enum { + MBCS_HEADER_V4_LENGTH=8, + MBCS_HEADER_V5_MIN_LENGTH=9 +}; + +/** + * MBCS data header. See data format description above. + */ +typedef struct { + UVersionInfo version; + uint32_t countStates, + countToUFallbacks, + offsetToUCodeUnits, + offsetFromUTable, + offsetFromUBytes, + flags, + fromUBytesLength; + + /* new and required in version 5 */ + uint32_t options; + + /* new and optional in version 5; used if options&MBCS_OPT_NO_FROM_U */ + uint32_t fullStage2Length; /* number of 32-bit units */ +} _MBCSHeader; + +#define UCNV_MBCS_HEADER_INITIALIZER { { 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + +/* + * This is a simple version of _MBCSGetNextUChar() that is used + * by other converter implementations. + * It only returns an "assigned" result if it consumes the entire input. + * It does not use state from the converter, nor error codes. + * It does not handle the EBCDIC swaplfnl option (set in UConverter). + * It handles conversion extensions but not GB 18030. + * + * Return value: + * U+fffe unassigned + * U+ffff illegal + * otherwise the Unicode code point + */ +U_CFUNC UChar32 +ucnv_MBCSSimpleGetNextUChar(UConverterSharedData *sharedData, + const char *source, int32_t length, + UBool useFallback); + +/** + * This version of _MBCSSimpleGetNextUChar() is optimized for single-byte, single-state codepages. + * It does not handle the EBCDIC swaplfnl option (set in UConverter). + * It does not handle conversion extensions (_extToU()). + */ +U_CFUNC UChar32 +ucnv_MBCSSingleSimpleGetNextUChar(UConverterSharedData *sharedData, + uint8_t b, UBool useFallback); + +/** + * This macro version of _MBCSSingleSimpleGetNextUChar() gets a code point from a byte. + * It works for single-byte, single-state codepages that only map + * to and from BMP code points, and it always + * returns fallback values. + */ +#define _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP(sharedData, b) \ + (UChar)MBCS_ENTRY_FINAL_VALUE_16((sharedData)->mbcs.stateTable[0][(uint8_t)(b)]) + +/** + * This is an internal function that allows other converter implementations + * to check whether a byte is a lead byte. + */ +U_CFUNC UBool +ucnv_MBCSIsLeadByte(UConverterSharedData *sharedData, char byte); + +/** This is a macro version of _MBCSIsLeadByte(). */ +#define _MBCS_IS_LEAD_BYTE(sharedData, byte) \ + (UBool)MBCS_ENTRY_IS_TRANSITION((sharedData)->mbcs.stateTable[0][(uint8_t)(byte)]) + +/* + * This is another simple conversion function for internal use by other + * conversion implementations. + * It does not use the converter state nor call callbacks. + * It does not handle the EBCDIC swaplfnl option (set in UConverter). + * It handles conversion extensions but not GB 18030. + * + * It converts one single Unicode code point into codepage bytes, encoded + * as one 32-bit value. The function returns the number of bytes in *pValue: + * 1..4 the number of bytes in *pValue + * 0 unassigned (*pValue undefined) + * -1 illegal (currently not used, *pValue undefined) + * + * *pValue will contain the resulting bytes with the last byte in bits 7..0, + * the second to last byte in bits 15..8, etc. + * Currently, the function assumes but does not check that 0<=c<=0x10ffff. + */ +U_CFUNC int32_t +ucnv_MBCSFromUChar32(UConverterSharedData *sharedData, + UChar32 c, uint32_t *pValue, + UBool useFallback); + +/** + * This version of _MBCSFromUChar32() is optimized for single-byte codepages. + * It does not handle the EBCDIC swaplfnl option (set in UConverter). + * + * It returns the codepage byte for the code point, or -1 if it is unassigned. + */ +U_CFUNC int32_t +ucnv_MBCSSingleFromUChar32(UConverterSharedData *sharedData, + UChar32 c, + UBool useFallback); + +/** + * SBCS, DBCS, and EBCDIC_STATEFUL are replaced by MBCS, but + * we cheat a little about the type, returning the old types if appropriate. + */ +U_CFUNC UConverterType +ucnv_MBCSGetType(const UConverter* converter); + +U_CFUNC void +ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, + UErrorCode *pErrorCode); +U_CFUNC void +ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, + UErrorCode *pErrorCode); + +/* + * Internal function returning a UnicodeSet for toUnicode() conversion. + * Currently only used for ISO-2022-CN, and only handles roundtrip mappings. + * In the future, if we add support for fallback sets, this function + * needs to be updated. + * Handles extensions. + * Does not empty the set first. + */ +U_CFUNC void +ucnv_MBCSGetUnicodeSetForUnicode(const UConverterSharedData *sharedData, + const USetAdder *sa, + UConverterUnicodeSet which, + UErrorCode *pErrorCode); + +/* + * Same as ucnv_MBCSGetUnicodeSetForUnicode() but + * the set can be filtered by encoding scheme. + * Used by stateful converters which share regular conversion tables + * but only use a subset of their mappings. + */ +U_CFUNC void +ucnv_MBCSGetFilteredUnicodeSetForUnicode(const UConverterSharedData *sharedData, + const USetAdder *sa, + UConverterUnicodeSet which, + UConverterSetFilter filter, + UErrorCode *pErrorCode); + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucol_data.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucol_data.h new file mode 100644 index 0000000000000000000000000000000000000000..83f54abba133ab06c1b302a15cebd5ff53291c26 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucol_data.h @@ -0,0 +1,89 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2000-2011, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: ucol_data.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2011jul02 +* created by: Markus Scherer +* +* Private implementation header for C/C++ collation. +* Some file data structure definitions were moved here from i18n/ucol_imp.h +* so that the common library (via ucol_swp.cpp) need not depend on the i18n library at all. +* +* We do not want to move the collation swapper to the i18n library because +* a) the resource bundle swapper depends on it and would have to move too, and +* b) we might want to eventually implement runtime data swapping, +* which might (or might not) be easier if all swappers are in the common library. +*/ + +#ifndef __UCOL_DATA_H__ +#define __UCOL_DATA_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_COLLATION + +/* let us know whether reserved fields are reset to zero or junked */ +#define UCOL_HEADER_MAGIC 0x20030618 + +typedef struct { + int32_t size; + /* all the offsets are in bytes */ + /* to get the address add to the header address and cast properly */ + uint32_t options; /* these are the default options for the collator */ + uint32_t UCAConsts; /* structure which holds values for indirect positioning and implicit ranges */ + uint32_t contractionUCACombos; /* this one is needed only for UCA, to copy the appropriate contractions */ + uint32_t magic; /* magic number - lets us know whether reserved data is reset or junked */ + uint32_t mappingPosition; /* const uint8_t *mappingPosition; */ + uint32_t expansion; /* uint32_t *expansion; */ + uint32_t contractionIndex; /* UChar *contractionIndex; */ + uint32_t contractionCEs; /* uint32_t *contractionCEs; */ + uint32_t contractionSize; /* needed for various closures */ + /*int32_t latinOneMapping;*/ /* this is now handled in the trie itself *//* fast track to latin1 chars */ + + uint32_t endExpansionCE; /* array of last collation element in + expansion */ + uint32_t expansionCESize; /* array of maximum expansion size + corresponding to the expansion + collation elements with last element + in endExpansionCE*/ + int32_t endExpansionCECount; /* size of endExpansionCE */ + uint32_t unsafeCP; /* hash table of unsafe code points */ + uint32_t contrEndCP; /* hash table of final code points */ + /* in contractions. */ + + int32_t contractionUCACombosSize; /* number of UCA contraction items. */ + /*Length is contractionUCACombosSize*contractionUCACombosWidth*sizeof(UChar) */ + UBool jamoSpecial; /* is jamoSpecial */ + UBool isBigEndian; /* is this data big endian? from the UDataInfo header*/ + uint8_t charSetFamily; /* what is the charset family of this data from the UDataInfo header*/ + uint8_t contractionUCACombosWidth; /* width of UCA combos field */ + UVersionInfo version; + UVersionInfo UCAVersion; /* version of the UCA, read from file */ + UVersionInfo UCDVersion; /* UCD version, obtained by u_getUnicodeVersion */ + UVersionInfo formatVersion; /* format version from the UDataInfo header */ + uint32_t scriptToLeadByte; /* offset to script to lead collation byte mapping data */ + uint32_t leadByteToScript; /* offset to lead collation byte to script mapping data */ + uint8_t reserved[76]; /* for future use */ +} UCATableHeader; + +typedef struct { + uint32_t byteSize; + uint32_t tableSize; + uint32_t contsSize; + uint32_t table; + uint32_t conts; + UVersionInfo UCAVersion; /* version of the UCA, read from file */ + uint8_t padding[8]; +} InverseUCATableHeader; + +#endif /* !UCONFIG_NO_COLLATION */ + +#endif /* __UCOL_DATA_H__ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucol_swp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucol_swp.h new file mode 100644 index 0000000000000000000000000000000000000000..0c2990a85ecfc2889544559d487ba049afe91168 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucol_swp.h @@ -0,0 +1,58 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2003-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: ucol_swp.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2003sep10 +* created by: Markus W. Scherer +* +* Swap collation binaries. +*/ + +#ifndef __UCOL_SWP_H__ +#define __UCOL_SWP_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_COLLATION + +#include "udataswp.h" + +/* + * Does the data look like a collation binary? + * @internal + */ +U_CAPI UBool U_EXPORT2 +ucol_looksLikeCollationBinary(const UDataSwapper *ds, + const void *inData, int32_t length); + +/** + * Swap ICU collation data like ucadata.icu. See udataswp.h. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ucol_swap(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Swap inverse UCA collation data (invuca.icu). See udataswp.h. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ucol_swapInverseUCA(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +#endif /* #if !UCONFIG_NO_COLLATION */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucptrie_impl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucptrie_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..1fe6a18ac5319e97ea2e3ff11342b5ca4d7ee2ed --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucptrie_impl.h @@ -0,0 +1,289 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// ucptrie_impl.h (modified from utrie2_impl.h) +// created: 2017dec29 Markus W. Scherer + +#ifndef __UCPTRIE_IMPL_H__ +#define __UCPTRIE_IMPL_H__ + +#include "unicode/ucptrie.h" +#ifdef UCPTRIE_DEBUG +#include "unicode/umutablecptrie.h" +#endif + +// UCPTrie signature values, in platform endianness and opposite endianness. +// The UCPTrie signature ASCII byte values spell "Tri3". +#define UCPTRIE_SIG 0x54726933 +#define UCPTRIE_OE_SIG 0x33697254 + +/** + * Header data for the binary, memory-mappable representation of a UCPTrie/CodePointTrie. + * @internal + */ +struct UCPTrieHeader { + /** "Tri3" in big-endian US-ASCII (0x54726933) */ + uint32_t signature; + + /** + * Options bit field: + * Bits 15..12: Data length bits 19..16. + * Bits 11..8: Data null block offset bits 19..16. + * Bits 7..6: UCPTrieType + * Bits 5..3: Reserved (0). + * Bits 2..0: UCPTrieValueWidth + */ + uint16_t options; + + /** Total length of the index tables. */ + uint16_t indexLength; + + /** Data length bits 15..0. */ + uint16_t dataLength; + + /** Index-3 null block offset, 0x7fff or 0xffff if none. */ + uint16_t index3NullOffset; + + /** Data null block offset bits 15..0, 0xfffff if none. */ + uint16_t dataNullOffset; + + /** + * First code point of the single-value range ending with U+10ffff, + * rounded up and then shifted right by UCPTRIE_SHIFT_2. + */ + uint16_t shiftedHighStart; +}; + +/** + * Constants for use with UCPTrieHeader.options. + * @internal + */ +enum { + UCPTRIE_OPTIONS_DATA_LENGTH_MASK = 0xf000, + UCPTRIE_OPTIONS_DATA_NULL_OFFSET_MASK = 0xf00, + UCPTRIE_OPTIONS_RESERVED_MASK = 0x38, + UCPTRIE_OPTIONS_VALUE_BITS_MASK = 7, + /** + * Value for index3NullOffset which indicates that there is no index-3 null block. + * Bit 15 is unused for this value because this bit is used if the index-3 contains + * 18-bit indexes. + */ + UCPTRIE_NO_INDEX3_NULL_OFFSET = 0x7fff, + UCPTRIE_NO_DATA_NULL_OFFSET = 0xfffff +}; + +// Internal constants. +enum { + /** The length of the BMP index table. 1024=0x400 */ + UCPTRIE_BMP_INDEX_LENGTH = 0x10000 >> UCPTRIE_FAST_SHIFT, + + UCPTRIE_SMALL_LIMIT = 0x1000, + UCPTRIE_SMALL_INDEX_LENGTH = UCPTRIE_SMALL_LIMIT >> UCPTRIE_FAST_SHIFT, + + /** Shift size for getting the index-3 table offset. */ + UCPTRIE_SHIFT_3 = 4, + + /** Shift size for getting the index-2 table offset. */ + UCPTRIE_SHIFT_2 = 5 + UCPTRIE_SHIFT_3, + + /** Shift size for getting the index-1 table offset. */ + UCPTRIE_SHIFT_1 = 5 + UCPTRIE_SHIFT_2, + + /** + * Difference between two shift sizes, + * for getting an index-2 offset from an index-3 offset. 5=9-4 + */ + UCPTRIE_SHIFT_2_3 = UCPTRIE_SHIFT_2 - UCPTRIE_SHIFT_3, + + /** + * Difference between two shift sizes, + * for getting an index-1 offset from an index-2 offset. 5=14-9 + */ + UCPTRIE_SHIFT_1_2 = UCPTRIE_SHIFT_1 - UCPTRIE_SHIFT_2, + + /** + * Number of index-1 entries for the BMP. (4) + * This part of the index-1 table is omitted from the serialized form. + */ + UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UCPTRIE_SHIFT_1, + + /** Number of entries in an index-2 block. 32=0x20 */ + UCPTRIE_INDEX_2_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_1_2, + + /** Mask for getting the lower bits for the in-index-2-block offset. */ + UCPTRIE_INDEX_2_MASK = UCPTRIE_INDEX_2_BLOCK_LENGTH - 1, + + /** Number of code points per index-2 table entry. 512=0x200 */ + UCPTRIE_CP_PER_INDEX_2_ENTRY = 1 << UCPTRIE_SHIFT_2, + + /** Number of entries in an index-3 block. 32=0x20 */ + UCPTRIE_INDEX_3_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_2_3, + + /** Mask for getting the lower bits for the in-index-3-block offset. */ + UCPTRIE_INDEX_3_MASK = UCPTRIE_INDEX_3_BLOCK_LENGTH - 1, + + /** Number of entries in a small data block. 16=0x10 */ + UCPTRIE_SMALL_DATA_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_3, + + /** Mask for getting the lower bits for the in-small-data-block offset. */ + UCPTRIE_SMALL_DATA_MASK = UCPTRIE_SMALL_DATA_BLOCK_LENGTH - 1 +}; + +typedef UChar32 +UCPTrieGetRange(const void *trie, UChar32 start, + UCPMapValueFilter *filter, const void *context, uint32_t *pValue); + +U_CFUNC UChar32 +ucptrie_internalGetRange(UCPTrieGetRange *getRange, + const void *trie, UChar32 start, + UCPMapRangeOption option, uint32_t surrogateValue, + UCPMapValueFilter *filter, const void *context, uint32_t *pValue); + +#ifdef UCPTRIE_DEBUG +U_CFUNC void +ucptrie_printLengths(const UCPTrie *trie, const char *which); + +U_CFUNC void umutablecptrie_setName(UMutableCPTrie *builder, const char *name); +#endif + +/* + * Format of the binary, memory-mappable representation of a UCPTrie/CodePointTrie. + * For overview information see http://site.icu-project.org/design/struct/utrie + * + * The binary trie data should be 32-bit-aligned. + * The overall layout is: + * + * UCPTrieHeader header; -- 16 bytes, see struct definition above + * uint16_t index[header.indexLength]; + * uintXY_t data[header.dataLength]; + * + * The trie data array is an array of uint16_t, uint32_t, or uint8_t, + * specified via the UCPTrieValueWidth when building the trie. + * The data array is 32-bit-aligned for uint32_t, otherwise 16-bit-aligned. + * The overall length of the trie data is a multiple of 4 bytes. + * (Padding is added at the end of the index array and/or near the end of the data array as needed.) + * + * The length of the data array (dataLength) is stored as an integer split across two fields + * of the header struct (high bits in header.options). + * + * The trie type can be "fast" or "small" which determines the index structure, + * specified via the UCPTrieType when building the trie. + * + * The type and valueWidth are stored in the header.options. + * There are reserved type and valueWidth values, and reserved header.options bits. + * They could be used in future format extensions. + * Code reading the trie structure must fail with an error when unknown values or options are set. + * + * Values for ASCII character (U+0000..U+007F) can always be found at the start of the data array. + * + * Values for code points below a type-specific fast-indexing limit are found via two-stage lookup. + * For a "fast" trie, the limit is the BMP/supplementary boundary at U+10000. + * For a "small" trie, the limit is UCPTRIE_SMALL_MAX+1=U+1000. + * + * All code points in the range highStart..U+10FFFF map to a single highValue + * which is stored at the second-to-last position of the data array. + * (See UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET.) + * The highStart value is header.shiftedHighStart<>UCPTRIE_SHIFT_1. + * (For 0x100000 supplementary code points U+10000..U+10ffff.) + * + * After this index-1 table follow the variable-length index-3 and index-2 tables. + * + * The supplementary index tables are omitted completely + * if there is only BMP data (highStart<=U+10000). + * + * For a "small" trie: + * + * The index array starts with a fast-index table for lookup of code points U+0000..U+0FFF. + * + * The "supplementary" index tables are always stored. + * The index-1 table starts from U+0000, its maximum length is 68=0x44=0x110000>>UCPTRIE_SHIFT_1. + * + * For both trie types: + * + * The last index-2 block may be a partial block, storing indexes only for code points + * below highStart. + * + * Lookup for ASCII code point c: + * + * Linear access from the start of the data array. + * + * value = data[c]; + * + * Lookup for fast-range code point c: + * + * Shift the code point right by UCPTRIE_FAST_SHIFT=6 bits, + * fetch the index array value at that offset, + * add the lower code point bits, index into the data array. + * + * value = data[index[c>>6] + (c&0x3f)]; + * + * (This works for ASCII as well.) + * + * Lookup for small-range code point c below highStart: + * + * Split the code point into four bit fields using several sets of shifts & masks + * to read consecutive values from the index-1, index-2, index-3 and data tables. + * + * If all of the data block offsets in an index-3 block fit within 16 bits (up to 0xffff), + * then the data block offsets are stored directly as uint16_t. + * + * Otherwise (this is very unusual but possible), the index-2 entry for the index-3 block + * has bit 15 (0x8000) set, and each set of 8 index-3 entries is preceded by + * an additional uint16_t word. Data block offsets are 18 bits wide, with the top 2 bits stored + * in the additional word. + * + * See ucptrie_internalSmallIndex() for details. + * + * (In a "small" trie, this works for ASCII and below-fast_limit code points as well.) + * + * Compaction: + * + * Multiple code point ranges ("blocks") that are aligned on certain boundaries + * (determined by the shifting/bit fields of code points) and + * map to the same data values normally share a single subsequence of the data array. + * Data blocks can also overlap partially. + * (Depending on the builder code finding duplicate and overlapping blocks.) + * + * Iteration over same-value ranges: + * + * Range iteration (ucptrie_getRange()) walks the structure from a start code point + * until some code point is found that maps to a different value; + * the end of the returned range is just before that. + * + * The header.dataNullOffset (split across two header fields, high bits in header.options) + * is the offset of a widely shared data block filled with one single value. + * It helps quickly skip over large ranges of data with that value. + * The builder must ensure that if the start of any data block (fast or small) + * matches the dataNullOffset, then the whole block must be filled with the null value. + * Special care must be taken if there is no fast null data block + * but a small one, which is shorter, and it matches the *start* of some fast data block. + * + * Similarly, the header.index3NullOffset is the index-array offset of an index-3 block + * where all index entries point to the dataNullOffset. + * If there is no such data or index-3 block, then these offsets are set to + * values that cannot be reached (data offset out of range/reserved index offset), + * normally UCPTRIE_NO_DATA_NULL_OFFSET or UCPTRIE_NO_INDEX3_NULL_OFFSET respectively. + */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucurrimp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucurrimp.h new file mode 100644 index 0000000000000000000000000000000000000000..6d9588295df7bb9401b798606b88f05ce3607e80 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ucurrimp.h @@ -0,0 +1,78 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef _UCURR_IMP_H_ +#define _UCURR_IMP_H_ + +#include "unicode/utypes.h" +#include "unicode/unistr.h" +#include "unicode/parsepos.h" +#include "unicode/uniset.h" + +/** + * Internal method. Given a currency ISO code and a locale, return + * the "static" currency name. This is usually the same as the + * UCURR_SYMBOL_NAME, but if the latter is a choice format, then the + * format is applied to the number 2.0 (to yield the more common + * plural) to return a static name. + * + * This is used for backward compatibility with old currency logic in + * DecimalFormat and DecimalFormatSymbols. + */ +U_CAPI void +uprv_getStaticCurrencyName(const UChar* iso, const char* loc, + icu::UnicodeString& result, UErrorCode& ec); + +/** + * Attempt to parse the given string as a currency, either as a + * display name in the given locale, or as a 3-letter ISO 4217 + * code. If multiple display names match, then the longest one is + * selected. If both a display name and a 3-letter ISO code + * match, then the display name is preferred, unless it's length + * is less than 3. + * + * The parameters must not be NULL. + * + * @param locale the locale of the display names to match + * @param text the text to parse + * @param pos input-output position; on input, the position within + * text to match; must have 0 <= pos.getIndex() < text.length(); + * on output, the position after the last matched character. If + * the parse fails, the position in unchanged upon output. + * @param type currency type to parse against, LONG_NAME only or not + * @param partialMatchLen The length of the longest matching prefix; + * this may be nonzero even if no full currency was matched. + * @return the ISO 4217 code, as a string, of the best match, or + * null if there is no match + * + * @internal + */ +U_CAPI void +uprv_parseCurrency(const char* locale, + const icu::UnicodeString& text, + icu::ParsePosition& pos, + int8_t type, + int32_t* partialMatchLen, + UChar* result, + UErrorCode& ec); + +/** + * Puts all possible first-characters of a currency into the + * specified UnicodeSet. + * + * @param locale the locale of the display names of interest + * @param result the UnicodeSet to which to add the starting characters + */ +void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode& ec); + + + +#endif /* #ifndef _UCURR_IMP_H_ */ + +//eof diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/udatamem.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/udatamem.h new file mode 100644 index 0000000000000000000000000000000000000000..a05dd69756825eb736865a07c266325dee9eb575 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/udatamem.h @@ -0,0 +1,61 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2010, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************/ + + +/*---------------------------------------------------------------------------------- + * + * UDataMemory A class-like struct that serves as a handle to a piece of memory + * that contains some ICU data (resource, converters, whatever.) + * + * When an application opens ICU data (with udata_open, for example, + * a UDataMemory * is returned. + * + *----------------------------------------------------------------------------------*/ +#ifndef __UDATAMEM_H__ +#define __UDATAMEM_H__ + +#include "unicode/udata.h" +#include "ucmndata.h" + +struct UDataMemory { + const commonDataFuncs *vFuncs; /* Function Pointers for accessing TOC */ + + const DataHeader *pHeader; /* Header of the memory being described by this */ + /* UDataMemory object. */ + const void *toc; /* For common memory, table of contents for */ + /* the pieces within. */ + UBool heapAllocated; /* True if this UDataMemory Object is on the */ + /* heap and thus needs to be deleted when closed. */ + + void *mapAddr; /* For mapped or allocated memory, the start addr. */ + /* Only non-null if a close operation should unmap */ + /* the associated data. */ + void *map; /* Handle, or other data, OS dependent. */ + /* Only non-null if a close operation should unmap */ + /* the associated data, and additional info */ + /* beyond the mapAddr is needed to do that. */ + int32_t length; /* Length of the data in bytes; -1 if unknown. */ +}; + +U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr); +U_CFUNC void UDatamemory_assign (UDataMemory *dest, UDataMemory *source); +U_CFUNC void UDataMemory_init (UDataMemory *This); +U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This); +U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr); + +U_CFUNC const DataHeader *UDataMemory_normalizeDataPointer(const void *p); + +U_CAPI int32_t U_EXPORT2 +udata_getLength(const UDataMemory *pData); + +U_CAPI const void * U_EXPORT2 +udata_getRawMemory(const UDataMemory *pData); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/udataswp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/udataswp.h new file mode 100644 index 0000000000000000000000000000000000000000..5e7b043c4c934c995715852f3dab70ec14f2dd10 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/udataswp.h @@ -0,0 +1,404 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2003-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: udataswp.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2003jun05 +* created by: Markus W. Scherer +* +* Definitions for ICU data transformations for different platforms, +* changing between big- and little-endian data and/or between +* charset families (ASCII<->EBCDIC). +*/ + +#ifndef __UDATASWP_H__ +#define __UDATASWP_H__ + +#include +#include "unicode/utypes.h" + +/* forward declaration */ + +U_CDECL_BEGIN + +struct UDataSwapper; +typedef struct UDataSwapper UDataSwapper; + +/** + * Function type for data transformation. + * Transforms data, or just returns the length of the data if + * the input length is -1. + * Swap functions assume that their data pointers are aligned properly. + * + * Quick implementation outline: + * (best to copy and adapt and existing swapper implementation) + * check that the data looks like the expected format + * if(length<0) { + * preflight: + * never dereference outData + * read inData and determine the data size + * assume that inData is long enough for this + * } else { + * outData can be NULL if length==0 + * inData==outData (in-place swapping) possible but not required! + * verify that length>=(actual size) + * if there is a chance that not every byte up to size is reached + * due to padding etc.: + * if(inData!=outData) { + * memcpy(outData, inData, actual size); + * } + * swap contents + * } + * return actual size + * + * Further implementation notes: + * - read integers from inData before swapping them + * because in-place swapping can make them unreadable + * - compareInvChars compares a local Unicode string with already-swapped + * output charset strings + * + * @param ds Pointer to UDataSwapper containing global data about the + * transformation and function pointers for handling primitive + * types. + * @param inData Pointer to the input data to be transformed or examined. + * @param length Length of the data, counting bytes. May be -1 for preflighting. + * If length>=0, then transform the data. + * If length==-1, then only determine the length of the data. + * The length cannot be determined from the data itself for all + * types of data (e.g., not for simple arrays of integers). + * @param outData Pointer to the output data buffer. + * If length>=0 (transformation), then the output buffer must + * have a capacity of at least length. + * If length==-1, then outData will not be used and can be NULL. + * @param pErrorCode ICU UErrorCode parameter, must not be NULL and must + * fulfill U_SUCCESS on input. + * @return The actual length of the data. + * + * @see UDataSwapper + * @internal ICU 2.8 + */ +typedef int32_t U_CALLCONV +UDataSwapFn(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Convert one uint16_t from input to platform endianness. + * @internal ICU 2.8 + */ +typedef uint16_t U_CALLCONV +UDataReadUInt16(uint16_t x); + +/** + * Convert one uint32_t from input to platform endianness. + * @internal ICU 2.8 + */ +typedef uint32_t U_CALLCONV +UDataReadUInt32(uint32_t x); + +/** + * Convert one uint16_t from platform to input endianness. + * @internal ICU 2.8 + */ +typedef void U_CALLCONV +UDataWriteUInt16(uint16_t *p, uint16_t x); + +/** + * Convert one uint32_t from platform to input endianness. + * @internal ICU 2.8 + */ +typedef void U_CALLCONV +UDataWriteUInt32(uint32_t *p, uint32_t x); + +/** + * Compare invariant-character strings, one in the output data and the + * other one caller-provided in Unicode. + * An output data string is compared because strings are usually swapped + * before the rest of the data, to allow for sorting of string tables + * according to the output charset. + * You can use -1 for the length parameters of NUL-terminated strings as usual. + * Returns Unicode code point order for invariant characters. + * @internal ICU 2.8 + */ +typedef int32_t U_CALLCONV +UDataCompareInvChars(const UDataSwapper *ds, + const char *outString, int32_t outLength, + const UChar *localString, int32_t localLength); + +/** + * Function for message output when an error occurs during data swapping. + * A format string and variable number of arguments are passed + * like for vprintf(). + * + * @param context A function-specific context pointer. + * @param fmt The format string. + * @param args The arguments for format string inserts. + * + * @internal ICU 2.8 + */ +typedef void U_CALLCONV +UDataPrintError(void *context, const char *fmt, va_list args); + +struct UDataSwapper { + /** Input endianness. @internal ICU 2.8 */ + UBool inIsBigEndian; + /** Input charset family. @see U_CHARSET_FAMILY @internal ICU 2.8 */ + uint8_t inCharset; + /** Output endianness. @internal ICU 2.8 */ + UBool outIsBigEndian; + /** Output charset family. @see U_CHARSET_FAMILY @internal ICU 2.8 */ + uint8_t outCharset; + + /* basic functions for reading data values */ + + /** Convert one uint16_t from input to platform endianness. @internal ICU 2.8 */ + UDataReadUInt16 *readUInt16; + /** Convert one uint32_t from input to platform endianness. @internal ICU 2.8 */ + UDataReadUInt32 *readUInt32; + /** Compare an invariant-character output string with a local one. @internal ICU 2.8 */ + UDataCompareInvChars *compareInvChars; + + /* basic functions for writing data values */ + + /** Convert one uint16_t from platform to input endianness. @internal ICU 2.8 */ + UDataWriteUInt16 *writeUInt16; + /** Convert one uint32_t from platform to input endianness. @internal ICU 2.8 */ + UDataWriteUInt32 *writeUInt32; + + /* basic functions for data transformations */ + + /** Transform an array of 16-bit integers. @internal ICU 2.8 */ + UDataSwapFn *swapArray16; + /** Transform an array of 32-bit integers. @internal ICU 2.8 */ + UDataSwapFn *swapArray32; + /** Transform an array of 64-bit integers. @internal ICU 53 */ + UDataSwapFn *swapArray64; + /** Transform an invariant-character string. @internal ICU 2.8 */ + UDataSwapFn *swapInvChars; + + /** + * Function for message output when an error occurs during data swapping. + * Can be NULL. + * @internal ICU 2.8 + */ + UDataPrintError *printError; + /** Context pointer for printError. @internal ICU 2.8 */ + void *printErrorContext; +}; + +U_CDECL_END + +U_CAPI UDataSwapper * U_EXPORT2 +udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset, + UBool outIsBigEndian, uint8_t outCharset, + UErrorCode *pErrorCode); + +/** + * Open a UDataSwapper for the given input data and the specified output + * characteristics. + * Values of -1 for any of the characteristics mean the local platform's + * characteristics. + * + * @see udata_swap + * @internal ICU 2.8 + */ +U_CAPI UDataSwapper * U_EXPORT2 +udata_openSwapperForInputData(const void *data, int32_t length, + UBool outIsBigEndian, uint8_t outCharset, + UErrorCode *pErrorCode); + +U_CAPI void U_EXPORT2 +udata_closeSwapper(UDataSwapper *ds); + +/** + * Read the beginning of an ICU data piece, recognize magic bytes, + * swap the structure. + * Set a U_UNSUPPORTED_ERROR if it does not look like an ICU data piece. + * + * @return The size of the data header, in bytes. + * + * @internal ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +udata_swapDataHeader(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Convert one int16_t from input to platform endianness. + * @internal ICU 2.8 + */ +U_CAPI int16_t U_EXPORT2 +udata_readInt16(const UDataSwapper *ds, int16_t x); + +/** + * Convert one int32_t from input to platform endianness. + * @internal ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +udata_readInt32(const UDataSwapper *ds, int32_t x); + +/** + * Swap a block of invariant, NUL-terminated strings, but not padding + * bytes after the last string. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +udata_swapInvStringBlock(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +U_CAPI void U_EXPORT2 +udata_printError(const UDataSwapper *ds, + const char *fmt, + ...); + +/* internal exports from putil.c -------------------------------------------- */ + +/* declared here to keep them out of the public putil.h */ + +/** + * Swap invariant char * strings ASCII->EBCDIC. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +uprv_ebcdicFromAscii(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Copy invariant ASCII char * strings and verify they are invariant. + * @internal + */ +U_CFUNC int32_t +uprv_copyAscii(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Swap invariant char * strings EBCDIC->ASCII. + * @internal + */ +U_CFUNC int32_t +uprv_asciiFromEbcdic(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Copy invariant EBCDIC char * strings and verify they are invariant. + * @internal + */ +U_CFUNC int32_t +uprv_copyEbcdic(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Compare ASCII invariant char * with Unicode invariant UChar * + * @internal + */ +U_CFUNC int32_t +uprv_compareInvAscii(const UDataSwapper *ds, + const char *outString, int32_t outLength, + const UChar *localString, int32_t localLength); + +/** + * Compare EBCDIC invariant char * with Unicode invariant UChar * + * @internal + */ +U_CFUNC int32_t +uprv_compareInvEbcdic(const UDataSwapper *ds, + const char *outString, int32_t outLength, + const UChar *localString, int32_t localLength); + +/** + * \def uprv_compareInvWithUChar + * Compare an invariant-character strings with a UChar string + * @internal + */ +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define uprv_compareInvWithUChar uprv_compareInvAscii +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define uprv_compareInvWithUChar uprv_compareInvEbcdic +#else +# error Unknown charset family! +#endif + +// utrie_swap.cpp -----------------------------------------------------------*** + +/** + * Swaps a serialized UTrie. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +utrie_swap(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Swaps a serialized UTrie2. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +utrie2_swap(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Swaps a serialized UCPTrie. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ucptrie_swap(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/** + * Swaps a serialized UTrie, UTrie2, or UCPTrie. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +utrie_swapAnyVersion(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +/* material... -------------------------------------------------------------- */ + +#if 0 + +/* udata.h */ + +/** + * Public API function in udata.c + * + * Same as udata_openChoice() but automatically swaps the data. + * isAcceptable, if not NULL, may accept data with endianness and charset family + * different from the current platform's properties. + * If the data is acceptable and the platform properties do not match, then + * the swap function is called to swap an allocated version of the data. + * Preflighting may or may not be performed depending on whether the size of + * the loaded data item is known. + * + * @param isAcceptable Same as for udata_openChoice(). May be NULL. + * + * @internal ICU 2.8 + */ +U_CAPI UDataMemory * U_EXPORT2 +udata_openSwap(const char *path, const char *type, const char *name, + UDataMemoryIsAcceptable *isAcceptable, void *isAcceptableContext, + UDataSwapFn *swap, + UDataPrintError *printError, void *printErrorContext, + UErrorCode *pErrorCode); + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uelement.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uelement.h new file mode 100644 index 0000000000000000000000000000000000000000..88dd4d66fb992cb412e136666b6a2d8dd2eb958d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uelement.h @@ -0,0 +1,91 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 1997-2011, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: uelement.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2011jul04 +* created by: Markus W. Scherer +* +* Common definitions for UHashTable and UVector. +* UHashTok moved here from uhash.h and renamed UElement. +* This allows users of UVector to avoid the confusing #include of uhash.h. +* uhash.h aliases UElement to UHashTok, +* so that we need not change all of its code and its users. +*/ + +#ifndef __UELEMENT_H__ +#define __UELEMENT_H__ + +#include "unicode/utypes.h" + +U_CDECL_BEGIN + +/** + * A UVector element, or a key or value within a UHashtable. + * It may be either a 32-bit integral value or an opaque void* pointer. + * The void* pointer may be smaller than 32 bits (e.g. 24 bits) + * or may be larger (e.g. 64 bits). + * + * Because a UElement is the size of a native pointer or a 32-bit + * integer, we pass it around by value. + */ +union UElement { + void* pointer; + int32_t integer; +}; +typedef union UElement UElement; + +/** + * An element-equality (boolean) comparison function. + * @param e1 An element (object or integer) + * @param e2 An element (object or integer) + * @return true if the two elements are equal. + */ +typedef UBool U_CALLCONV UElementsAreEqual(const UElement e1, const UElement e2); + +/** + * An element sorting (three-way) comparison function. + * @param e1 An element (object or integer) + * @param e2 An element (object or integer) + * @return 0 if the two elements are equal, -1 if e1 is < e2, or +1 if e1 is > e2. + */ +typedef int8_t U_CALLCONV UElementComparator(UElement e1, UElement e2); + +/** + * An element assignment function. It may copy an integer, copy + * a pointer, or clone a pointer, as appropriate. + * @param dst The element to be assigned to + * @param src The element to assign from + */ +typedef void U_CALLCONV UElementAssigner(UElement *dst, UElement *src); + +U_CDECL_END + +/** + * Comparator function for UnicodeString* keys. Implements UElementsAreEqual. + * @param key1 The string for comparison + * @param key2 The string for comparison + * @return true if key1 and key2 are equal, return false otherwise. + */ +U_CAPI UBool U_EXPORT2 +uhash_compareUnicodeString(const UElement key1, const UElement key2); + +/** + * Comparator function for UnicodeString* keys (case insensitive). + * Make sure to use together with uhash_hashCaselessUnicodeString. + * Implements UElementsAreEqual. + * @param key1 The string for comparison + * @param key2 The string for comparison + * @return true if key1 and key2 are equal, return false otherwise. + */ +U_CAPI UBool U_EXPORT2 +uhash_compareCaselessUnicodeString(const UElement key1, const UElement key2); + +#endif /* __UELEMENT_H__ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uenumimp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uenumimp.h new file mode 100644 index 0000000000000000000000000000000000000000..9c9df75ae0497a95050a8c22bb3a6fa1fb77ce4e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uenumimp.h @@ -0,0 +1,155 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2006, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uenumimp.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:2 +* +* created on: 2002jul08 +* created by: Vladimir Weinstein +*/ + +#ifndef __UENUMIMP_H +#define __UENUMIMP_H + +#include "unicode/uenum.h" + +U_CDECL_BEGIN + +/** + * following are the type declarations for + * implementations of APIs. If any of these + * functions are NULL, U_UNSUPPORTED_ERROR + * is returned. If close is NULL, the enumeration + * object is going to be released. + * Initial error checking is done in the body + * of API function, so the implementations + * need not to check the initial error condition. + */ + +/** + * Function type declaration for uenum_close(). + * + * This function should cleanup the enumerator object + * + * @param en enumeration to be closed + */ +typedef void U_CALLCONV +UEnumClose(UEnumeration *en); + +/** + * Function type declaration for uenum_count(). + * + * This function should count the number of elements + * in this enumeration + * + * @param en enumeration to be counted + * @param status pointer to UErrorCode variable + * @return number of elements in enumeration + */ +typedef int32_t U_CALLCONV +UEnumCount(UEnumeration *en, UErrorCode *status); + +/** + * Function type declaration for uenum_unext(). + * + * This function returns the next element as a UChar *, + * or NULL after all elements haven been enumerated. + * + * @param en enumeration + * @param resultLength pointer to result length + * @param status pointer to UErrorCode variable + * @return next element as UChar *, + * or NULL after all elements haven been enumerated + */ +typedef const UChar* U_CALLCONV +UEnumUNext(UEnumeration* en, + int32_t* resultLength, + UErrorCode* status); + +/** + * Function type declaration for uenum_next(). + * + * This function returns the next element as a char *, + * or NULL after all elements haven been enumerated. + * + * @param en enumeration + * @param resultLength pointer to result length + * @param status pointer to UErrorCode variable + * @return next element as char *, + * or NULL after all elements haven been enumerated + */ +typedef const char* U_CALLCONV +UEnumNext(UEnumeration* en, + int32_t* resultLength, + UErrorCode* status); + +/** + * Function type declaration for uenum_reset(). + * + * This function should reset the enumeration + * object + * + * @param en enumeration + * @param status pointer to UErrorCode variable + */ +typedef void U_CALLCONV +UEnumReset(UEnumeration* en, + UErrorCode* status); + + +struct UEnumeration { + /* baseContext. For the base class only. Don't touch! */ + void *baseContext; + + /* context. Use it for what you need */ + void *context; + + /** + * these are functions that will + * be used for APIs + */ + /* called from uenum_close */ + UEnumClose *close; + /* called from uenum_count */ + UEnumCount *count; + /* called from uenum_unext */ + UEnumUNext *uNext; + /* called from uenum_next */ + UEnumNext *next; + /* called from uenum_reset */ + UEnumReset *reset; +}; + +U_CDECL_END + +/* This is the default implementation for uenum_unext(). + * It automatically converts the char * string to UChar *. + * Don't call this directly. This is called internally by uenum_unext + * when a UEnumeration is defined with 'uNext' pointing to this + * function. + */ +U_CAPI const UChar* U_EXPORT2 +uenum_unextDefault(UEnumeration* en, + int32_t* resultLength, + UErrorCode* status); + +/* This is the default implementation for uenum_next(). + * It automatically converts the UChar * string to char *. + * Don't call this directly. This is called internally by uenum_next + * when a UEnumeration is defined with 'next' pointing to this + * function. + */ +U_CAPI const char* U_EXPORT2 +uenum_nextDefault(UEnumeration* en, + int32_t* resultLength, + UErrorCode* status); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uhash.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uhash.h new file mode 100644 index 0000000000000000000000000000000000000000..af75999860dbb4fc678bcdb4fb91d2aaad11ff1c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uhash.h @@ -0,0 +1,811 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 1997-2015, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* Date Name Description +* 03/22/00 aliu Adapted from original C++ ICU Hashtable. +* 07/06/01 aliu Modified to support int32_t keys on +* platforms with sizeof(void*) < 32. +****************************************************************************** +*/ + +#ifndef UHASH_H +#define UHASH_H + +#include "unicode/utypes.h" +#include "cmemory.h" +#include "uelement.h" +#include "unicode/localpointer.h" + +/** + * UHashtable stores key-value pairs and does moderately fast lookup + * based on keys. It provides a good tradeoff between access time and + * storage space. As elements are added to it, it grows to accommodate + * them. By default, the table never shrinks, even if all elements + * are removed from it. + * + * Keys and values are stored as void* pointers. These void* pointers + * may be actual pointers to strings, objects, or any other structure + * in memory, or they may simply be integral values cast to void*. + * UHashtable doesn't care and manipulates them via user-supplied + * functions. These functions hash keys, compare keys, delete keys, + * and delete values. Some function pointers are optional (may be + * NULL); others must be supplied. Several prebuilt functions exist + * to handle common key types. + * + * UHashtable ownership of keys and values is flexible, and controlled + * by whether or not the key deleter and value deleter functions are + * set. If a void* key is actually a pointer to a deletable object, + * then UHashtable can be made to delete that object by setting the + * key deleter function pointer to a non-NULL value. If this is done, + * then keys passed to uhash_put() are owned by the hashtable and will + * be deleted by it at some point, either as keys are replaced, or + * when uhash_close() is finally called. The same is true of values + * and the value deleter function pointer. Keys passed to methods + * other than uhash_put() are never owned by the hashtable. + * + * NULL values are not allowed. uhash_get() returns NULL to indicate + * a key that is not in the table, and having a NULL value in the + * table would generate an ambiguous result. If a key and a NULL + * value is passed to uhash_put(), this has the effect of doing a + * uhash_remove() on that key. This keeps uhash_get(), uhash_count(), + * and uhash_nextElement() consistent with one another. + * + * Keys and values can be integers. + * Functions that work with an integer key have an "i" prefix. + * Functions that work with an integer value have an "i" suffix. + * As with putting a NULL value pointer, putting a zero value integer removes the item. + * Except, there are pairs of functions that allow setting zero values + * and fetching (value, found) pairs. + * + * To see everything in a hashtable, use uhash_nextElement() to + * iterate through its contents. Each call to this function returns a + * UHashElement pointer. A hash element contains a key, value, and + * hashcode. During iteration an element may be deleted by calling + * uhash_removeElement(); iteration may safely continue thereafter. + * The uhash_remove() function may also be safely called in + * mid-iteration. If uhash_put() is called during iteration, + * the iteration is still guaranteed to terminate reasonably, but + * there is no guarantee that every element will be returned or that + * some won't be returned more than once. + * + * Under no circumstances should the UHashElement returned by + * uhash_nextElement be modified directly. + * + * By default, the hashtable grows when necessary, but never shrinks, + * even if all items are removed. For most applications this is + * optimal. However, in a highly dynamic usage where memory is at a + * premium, the table can be set to both grow and shrink by calling + * uhash_setResizePolicy() with the policy U_GROW_AND_SHRINK. In a + * situation where memory is critical and the client wants a table + * that does not grow at all, the constant U_FIXED can be used. + */ + +/******************************************************************** + * Data Structures + ********************************************************************/ + +U_CDECL_BEGIN + +/** + * A key or value within a UHashtable. + * The hashing and comparison functions take a pointer to a + * UHashTok, but the deleter receives the void* pointer within it. + */ +typedef UElement UHashTok; + +/** + * This is a single hash element. + */ +struct UHashElement { + /* Reorder these elements to pack nicely if necessary */ + int32_t hashcode; + UHashTok value; + UHashTok key; +}; +typedef struct UHashElement UHashElement; + +/** + * A hashing function. + * @param key A key stored in a hashtable + * @return A NON-NEGATIVE hash code for parm. + */ +typedef int32_t U_CALLCONV UHashFunction(const UHashTok key); + +/** + * A key equality (boolean) comparison function. + */ +typedef UElementsAreEqual UKeyComparator; + +/** + * A value equality (boolean) comparison function. + */ +typedef UElementsAreEqual UValueComparator; + +/* see cmemory.h for UObjectDeleter and uprv_deleteUObject() */ + +/** + * This specifies whether or not, and how, the hastable resizes itself. + * See uhash_setResizePolicy(). + */ +enum UHashResizePolicy { + U_GROW, /* Grow on demand, do not shrink */ + U_GROW_AND_SHRINK, /* Grow and shrink on demand */ + U_FIXED /* Never change size */ +}; + +/** + * The UHashtable struct. Clients should treat this as an opaque data + * type and manipulate it only through the uhash_... API. + */ +struct UHashtable { + + /* Main key-value pair storage array */ + + UHashElement *elements; + + /* Function pointers */ + + UHashFunction *keyHasher; /* Computes hash from key. + * Never null. */ + UKeyComparator *keyComparator; /* Compares keys for equality. + * Never null. */ + UValueComparator *valueComparator; /* Compares the values for equality */ + + UObjectDeleter *keyDeleter; /* Deletes keys when required. + * If NULL won't do anything */ + UObjectDeleter *valueDeleter; /* Deletes values when required. + * If NULL won't do anything */ + + /* Size parameters */ + + int32_t count; /* The number of key-value pairs in this table. + * 0 <= count <= length. In practice we + * never let count == length (see code). */ + int32_t length; /* The physical size of the arrays hashes, keys + * and values. Must be prime. */ + + /* Rehashing thresholds */ + + int32_t highWaterMark; /* If count > highWaterMark, rehash */ + int32_t lowWaterMark; /* If count < lowWaterMark, rehash */ + float highWaterRatio; /* 0..1; high water as a fraction of length */ + float lowWaterRatio; /* 0..1; low water as a fraction of length */ + + int8_t primeIndex; /* Index into our prime table for length. + * length == PRIMES[primeIndex] */ + UBool allocated; /* Was this UHashtable allocated? */ +}; +typedef struct UHashtable UHashtable; + +U_CDECL_END + +/******************************************************************** + * API + ********************************************************************/ + +/** + * Initialize a new UHashtable. + * @param keyHash A pointer to the key hashing function. Must not be + * NULL. + * @param keyComp A pointer to the function that compares keys. Must + * not be NULL. + * @param status A pointer to an UErrorCode to receive any errors. + * @return A pointer to a UHashtable, or 0 if an error occurred. + * @see uhash_openSize + */ +U_CAPI UHashtable* U_EXPORT2 +uhash_open(UHashFunction *keyHash, + UKeyComparator *keyComp, + UValueComparator *valueComp, + UErrorCode *status); + +/** + * Initialize a new UHashtable with a given initial size. + * @param keyHash A pointer to the key hashing function. Must not be + * NULL. + * @param keyComp A pointer to the function that compares keys. Must + * not be NULL. + * @param size The initial capacity of this hash table. + * @param status A pointer to an UErrorCode to receive any errors. + * @return A pointer to a UHashtable, or 0 if an error occurred. + * @see uhash_open + */ +U_CAPI UHashtable* U_EXPORT2 +uhash_openSize(UHashFunction *keyHash, + UKeyComparator *keyComp, + UValueComparator *valueComp, + int32_t size, + UErrorCode *status); + +/** + * Initialize an existing UHashtable. + * @param keyHash A pointer to the key hashing function. Must not be + * NULL. + * @param keyComp A pointer to the function that compares keys. Must + * not be NULL. + * @param status A pointer to an UErrorCode to receive any errors. + * @return A pointer to a UHashtable, or 0 if an error occurred. + * @see uhash_openSize + */ +U_CAPI UHashtable* U_EXPORT2 +uhash_init(UHashtable *hash, + UHashFunction *keyHash, + UKeyComparator *keyComp, + UValueComparator *valueComp, + UErrorCode *status); + +/** + * Initialize an existing UHashtable. + * @param keyHash A pointer to the key hashing function. Must not be + * NULL. + * @param keyComp A pointer to the function that compares keys. Must + * not be NULL. + * @param size The initial capacity of this hash table. + * @param status A pointer to an UErrorCode to receive any errors. + * @return A pointer to a UHashtable, or 0 if an error occurred. + * @see uhash_openSize + */ +U_CAPI UHashtable* U_EXPORT2 +uhash_initSize(UHashtable *hash, + UHashFunction *keyHash, + UKeyComparator *keyComp, + UValueComparator *valueComp, + int32_t size, + UErrorCode *status); + +/** + * Close a UHashtable, releasing the memory used. + * @param hash The UHashtable to close. If hash is NULL no operation is performed. + */ +U_CAPI void U_EXPORT2 +uhash_close(UHashtable *hash); + + + +/** + * Set the function used to hash keys. + * @param hash The UHashtable to set + * @param fn the function to be used hash keys; must not be NULL + * @return the previous key hasher; non-NULL + */ +U_CAPI UHashFunction *U_EXPORT2 +uhash_setKeyHasher(UHashtable *hash, UHashFunction *fn); + +/** + * Set the function used to compare keys. The default comparison is a + * void* pointer comparison. + * @param hash The UHashtable to set + * @param fn the function to be used compare keys; must not be NULL + * @return the previous key comparator; non-NULL + */ +U_CAPI UKeyComparator *U_EXPORT2 +uhash_setKeyComparator(UHashtable *hash, UKeyComparator *fn); + +/** + * Set the function used to compare values. The default comparison is a + * void* pointer comparison. + * @param hash The UHashtable to set + * @param fn the function to be used compare keys; must not be NULL + * @return the previous key comparator; non-NULL + */ +U_CAPI UValueComparator *U_EXPORT2 +uhash_setValueComparator(UHashtable *hash, UValueComparator *fn); + +/** + * Set the function used to delete keys. If this function pointer is + * NULL, this hashtable does not delete keys. If it is non-NULL, this + * hashtable does delete keys. This function should be set once + * before any elements are added to the hashtable and should not be + * changed thereafter. + * @param hash The UHashtable to set + * @param fn the function to be used delete keys, or NULL + * @return the previous key deleter; may be NULL + */ +U_CAPI UObjectDeleter *U_EXPORT2 +uhash_setKeyDeleter(UHashtable *hash, UObjectDeleter *fn); + +/** + * Set the function used to delete values. If this function pointer + * is NULL, this hashtable does not delete values. If it is non-NULL, + * this hashtable does delete values. This function should be set + * once before any elements are added to the hashtable and should not + * be changed thereafter. + * @param hash The UHashtable to set + * @param fn the function to be used delete values, or NULL + * @return the previous value deleter; may be NULL + */ +U_CAPI UObjectDeleter *U_EXPORT2 +uhash_setValueDeleter(UHashtable *hash, UObjectDeleter *fn); + +/** + * Specify whether or not, and how, the hastable resizes itself. + * By default, tables grow but do not shrink (policy U_GROW). + * See enum UHashResizePolicy. + * @param hash The UHashtable to set + * @param policy The way the hashtable resizes itself, {U_GROW, U_GROW_AND_SHRINK, U_FIXED} + */ +U_CAPI void U_EXPORT2 +uhash_setResizePolicy(UHashtable *hash, enum UHashResizePolicy policy); + +/** + * Get the number of key-value pairs stored in a UHashtable. + * @param hash The UHashtable to query. + * @return The number of key-value pairs stored in hash. + */ +U_CAPI int32_t U_EXPORT2 +uhash_count(const UHashtable *hash); + +/** + * Put a (key=pointer, value=pointer) item in a UHashtable. If the + * keyDeleter is non-NULL, then the hashtable owns 'key' after this + * call. If the valueDeleter is non-NULL, then the hashtable owns + * 'value' after this call. Storing a NULL value is the same as + * calling uhash_remove(). + * @param hash The target UHashtable. + * @param key The key to store. + * @param value The value to store, may be NULL (see above). + * @param status A pointer to an UErrorCode to receive any errors. + * @return The previous value, or NULL if none. + * @see uhash_get + */ +U_CAPI void* U_EXPORT2 +uhash_put(UHashtable *hash, + void *key, + void *value, + UErrorCode *status); + +/** + * Put a (key=integer, value=pointer) item in a UHashtable. + * keyDeleter must be NULL. If the valueDeleter is non-NULL, then the + * hashtable owns 'value' after this call. Storing a NULL value is + * the same as calling uhash_remove(). + * @param hash The target UHashtable. + * @param key The integer key to store. + * @param value The value to store, may be NULL (see above). + * @param status A pointer to an UErrorCode to receive any errors. + * @return The previous value, or NULL if none. + * @see uhash_get + */ +U_CAPI void* U_EXPORT2 +uhash_iput(UHashtable *hash, + int32_t key, + void* value, + UErrorCode *status); + +/** + * Put a (key=pointer, value=integer) item in a UHashtable. If the + * keyDeleter is non-NULL, then the hashtable owns 'key' after this + * call. valueDeleter must be NULL. Storing a 0 value is the same as + * calling uhash_remove(). + * @param hash The target UHashtable. + * @param key The key to store. + * @param value The integer value to store. + * @param status A pointer to an UErrorCode to receive any errors. + * @return The previous value, or 0 if none. + * @see uhash_get + */ +U_CAPI int32_t U_EXPORT2 +uhash_puti(UHashtable *hash, + void* key, + int32_t value, + UErrorCode *status); + +/** + * Put a (key=integer, value=integer) item in a UHashtable. If the + * keyDeleter is non-NULL, then the hashtable owns 'key' after this + * call. valueDeleter must be NULL. Storing a 0 value is the same as + * calling uhash_remove(). + * @param hash The target UHashtable. + * @param key The key to store. + * @param value The integer value to store. + * @param status A pointer to an UErrorCode to receive any errors. + * @return The previous value, or 0 if none. + * @see uhash_get + */ +U_CAPI int32_t U_EXPORT2 +uhash_iputi(UHashtable *hash, + int32_t key, + int32_t value, + UErrorCode *status); + +/** + * Put a (key=pointer, value=integer) item in a UHashtable. If the + * keyDeleter is non-NULL, then the hashtable owns 'key' after this + * call. valueDeleter must be NULL. + * Storing a 0 value is possible; call uhash_igetiAndFound() to retrieve values including zero. + * + * @param hash The target UHashtable. + * @param key The key to store. + * @param value The integer value to store. + * @param status A pointer to an UErrorCode to receive any errors. + * @return The previous value, or 0 if none. + * @see uhash_getiAndFound + */ +U_CAPI int32_t U_EXPORT2 +uhash_putiAllowZero(UHashtable *hash, + void *key, + int32_t value, + UErrorCode *status); + +/** + * Put a (key=integer, value=integer) item in a UHashtable. If the + * keyDeleter is non-NULL, then the hashtable owns 'key' after this + * call. valueDeleter must be NULL. + * Storing a 0 value is possible; call uhash_igetiAndFound() to retrieve values including zero. + * + * @param hash The target UHashtable. + * @param key The key to store. + * @param value The integer value to store. + * @param status A pointer to an UErrorCode to receive any errors. + * @return The previous value, or 0 if none. + * @see uhash_igetiAndFound + */ +U_CAPI int32_t U_EXPORT2 +uhash_iputiAllowZero(UHashtable *hash, + int32_t key, + int32_t value, + UErrorCode *status); + +/** + * Retrieve a pointer value from a UHashtable using a pointer key, + * as previously stored by uhash_put(). + * @param hash The target UHashtable. + * @param key A pointer key stored in a hashtable + * @return The requested item, or NULL if not found. + */ +U_CAPI void* U_EXPORT2 +uhash_get(const UHashtable *hash, + const void *key); + +/** + * Retrieve a pointer value from a UHashtable using a integer key, + * as previously stored by uhash_iput(). + * @param hash The target UHashtable. + * @param key An integer key stored in a hashtable + * @return The requested item, or NULL if not found. + */ +U_CAPI void* U_EXPORT2 +uhash_iget(const UHashtable *hash, + int32_t key); + +/** + * Retrieve an integer value from a UHashtable using a pointer key, + * as previously stored by uhash_puti(). + * @param hash The target UHashtable. + * @param key A pointer key stored in a hashtable + * @return The requested item, or 0 if not found. + */ +U_CAPI int32_t U_EXPORT2 +uhash_geti(const UHashtable *hash, + const void* key); +/** + * Retrieve an integer value from a UHashtable using an integer key, + * as previously stored by uhash_iputi(). + * @param hash The target UHashtable. + * @param key An integer key stored in a hashtable + * @return The requested item, or 0 if not found. + */ +U_CAPI int32_t U_EXPORT2 +uhash_igeti(const UHashtable *hash, + int32_t key); + +/** + * Retrieves an integer value from a UHashtable using a pointer key, + * as previously stored by uhash_putiAllowZero() or uhash_puti(). + * + * @param hash The target UHashtable. + * @param key A pointer key stored in a hashtable + * @param found A pointer to a boolean which will be set for whether the key was found. + * @return The requested item, or 0 if not found. + */ +U_CAPI int32_t U_EXPORT2 +uhash_getiAndFound(const UHashtable *hash, + const void *key, + UBool *found); + +/** + * Retrieves an integer value from a UHashtable using an integer key, + * as previously stored by uhash_iputiAllowZero() or uhash_iputi(). + * + * @param hash The target UHashtable. + * @param key An integer key stored in a hashtable + * @param found A pointer to a boolean which will be set for whether the key was found. + * @return The requested item, or 0 if not found. + */ +U_CAPI int32_t U_EXPORT2 +uhash_igetiAndFound(const UHashtable *hash, + int32_t key, + UBool *found); + +/** + * Remove an item from a UHashtable stored by uhash_put(). + * @param hash The target UHashtable. + * @param key A key stored in a hashtable + * @return The item removed, or NULL if not found. + */ +U_CAPI void* U_EXPORT2 +uhash_remove(UHashtable *hash, + const void *key); + +/** + * Remove an item from a UHashtable stored by uhash_iput(). + * @param hash The target UHashtable. + * @param key An integer key stored in a hashtable + * @return The item removed, or NULL if not found. + */ +U_CAPI void* U_EXPORT2 +uhash_iremove(UHashtable *hash, + int32_t key); + +/** + * Remove an item from a UHashtable stored by uhash_puti(). + * @param hash The target UHashtable. + * @param key An key stored in a hashtable + * @return The item removed, or 0 if not found. + */ +U_CAPI int32_t U_EXPORT2 +uhash_removei(UHashtable *hash, + const void* key); + +/** + * Remove an item from a UHashtable stored by uhash_iputi(). + * @param hash The target UHashtable. + * @param key An integer key stored in a hashtable + * @return The item removed, or 0 if not found. + */ +U_CAPI int32_t U_EXPORT2 +uhash_iremovei(UHashtable *hash, + int32_t key); + +/** + * Remove all items from a UHashtable. + * @param hash The target UHashtable. + */ +U_CAPI void U_EXPORT2 +uhash_removeAll(UHashtable *hash); + +/** + * Returns true if the UHashtable contains an item with this pointer key. + * + * @param hash The target UHashtable. + * @param key A pointer key stored in a hashtable + * @return true if the key is found. + */ +U_CAPI UBool U_EXPORT2 +uhash_containsKey(const UHashtable *hash, const void *key); + +/** + * Returns true if the UHashtable contains an item with this integer key. + * + * @param hash The target UHashtable. + * @param key An integer key stored in a hashtable + * @return true if the key is found. + */ +U_CAPI UBool U_EXPORT2 +uhash_icontainsKey(const UHashtable *hash, int32_t key); + +/** + * Locate an element of a UHashtable. The caller must not modify the + * returned object. The primary use of this function is to obtain the + * stored key when it may not be identical to the search key. For + * example, if the compare function is a case-insensitive string + * compare, then the hash key may be desired in order to obtain the + * canonical case corresponding to a search key. + * @param hash The target UHashtable. + * @param key A key stored in a hashtable + * @return a hash element, or NULL if the key is not found. + */ +U_CAPI const UHashElement* U_EXPORT2 +uhash_find(const UHashtable *hash, const void* key); + +/** + * \def UHASH_FIRST + * Constant for use with uhash_nextElement + * @see uhash_nextElement + */ +#define UHASH_FIRST (-1) + +/** + * Iterate through the elements of a UHashtable. The caller must not + * modify the returned object. However, uhash_removeElement() may be + * called during iteration to remove an element from the table. + * Iteration may safely be resumed afterwards. If uhash_put() is + * called during iteration the iteration will then be out of sync and + * should be restarted. + * @param hash The target UHashtable. + * @param pos This should be set to UHASH_FIRST initially, and left untouched + * thereafter. + * @return a hash element, or NULL if no further key-value pairs + * exist in the table. + */ +U_CAPI const UHashElement* U_EXPORT2 +uhash_nextElement(const UHashtable *hash, + int32_t *pos); + +/** + * Remove an element, returned by uhash_nextElement(), from the table. + * Iteration may be safely continued afterwards. + * @param hash The hashtable + * @param e The element, returned by uhash_nextElement(), to remove. + * Must not be NULL. Must not be an empty or deleted element (as long + * as this was returned by uhash_nextElement() it will not be empty or + * deleted). Note: Although this parameter is const, it will be + * modified. + * @return the value that was removed. + */ +U_CAPI void* U_EXPORT2 +uhash_removeElement(UHashtable *hash, const UHashElement* e); + +/******************************************************************** + * UHashTok convenience + ********************************************************************/ + +/** + * Return a UHashTok for an integer. + * @param i The given integer + * @return a UHashTok for an integer. + */ +/*U_CAPI UHashTok U_EXPORT2 +uhash_toki(int32_t i);*/ + +/** + * Return a UHashTok for a pointer. + * @param p The given pointer + * @return a UHashTok for a pointer. + */ +/*U_CAPI UHashTok U_EXPORT2 +uhash_tokp(void* p);*/ + +/******************************************************************** + * UChar* and char* Support Functions + ********************************************************************/ + +/** + * Generate a hash code for a null-terminated UChar* string. If the + * string is not null-terminated do not use this function. Use + * together with uhash_compareUChars. + * @param key The string (const UChar*) to hash. + * @return A hash code for the key. + */ +U_CAPI int32_t U_EXPORT2 +uhash_hashUChars(const UHashTok key); + +/** + * Generate a hash code for a null-terminated char* string. If the + * string is not null-terminated do not use this function. Use + * together with uhash_compareChars. + * @param key The string (const char*) to hash. + * @return A hash code for the key. + */ +U_CAPI int32_t U_EXPORT2 +uhash_hashChars(const UHashTok key); + +/** + * Generate a case-insensitive hash code for a null-terminated char* + * string. If the string is not null-terminated do not use this + * function. Use together with uhash_compareIChars. + * @param key The string (const char*) to hash. + * @return A hash code for the key. + */ +U_CAPI int32_t U_EXPORT2 +uhash_hashIChars(const UHashTok key); + +/** + * Comparator for null-terminated UChar* strings. Use together with + * uhash_hashUChars. + * @param key1 The string for comparison + * @param key2 The string for comparison + * @return true if key1 and key2 are equal, return false otherwise. + */ +U_CAPI UBool U_EXPORT2 +uhash_compareUChars(const UHashTok key1, const UHashTok key2); + +/** + * Comparator for null-terminated char* strings. Use together with + * uhash_hashChars. + * @param key1 The string for comparison + * @param key2 The string for comparison + * @return true if key1 and key2 are equal, return false otherwise. + */ +U_CAPI UBool U_EXPORT2 +uhash_compareChars(const UHashTok key1, const UHashTok key2); + +/** + * Case-insensitive comparator for null-terminated char* strings. Use + * together with uhash_hashIChars. + * @param key1 The string for comparison + * @param key2 The string for comparison + * @return true if key1 and key2 are equal, return false otherwise. + */ +U_CAPI UBool U_EXPORT2 +uhash_compareIChars(const UHashTok key1, const UHashTok key2); + +/******************************************************************** + * UnicodeString Support Functions + ********************************************************************/ + +/** + * Hash function for UnicodeString* keys. + * @param key The string (const char*) to hash. + * @return A hash code for the key. + */ +U_CAPI int32_t U_EXPORT2 +uhash_hashUnicodeString(const UElement key); + +/** + * Hash function for UnicodeString* keys (case insensitive). + * Make sure to use together with uhash_compareCaselessUnicodeString. + * @param key The string (const char*) to hash. + * @return A hash code for the key. + */ +U_CAPI int32_t U_EXPORT2 +uhash_hashCaselessUnicodeString(const UElement key); + +/******************************************************************** + * int32_t Support Functions + ********************************************************************/ + +/** + * Hash function for 32-bit integer keys. + * @param key The string (const char*) to hash. + * @return A hash code for the key. + */ +U_CAPI int32_t U_EXPORT2 +uhash_hashLong(const UHashTok key); + +/** + * Comparator function for 32-bit integer keys. + * @param key1 The integer for comparison + * @param Key2 The integer for comparison + * @return true if key1 and key2 are equal, return false otherwise + */ +U_CAPI UBool U_EXPORT2 +uhash_compareLong(const UHashTok key1, const UHashTok key2); + +/******************************************************************** + * Other Support Functions + ********************************************************************/ + +/** + * Deleter for Hashtable objects. + * @param obj The object to be deleted + */ +U_CAPI void U_EXPORT2 +uhash_deleteHashtable(void *obj); + +/* Use uprv_free() itself as a deleter for any key or value allocated using uprv_malloc. */ + +/** + * Checks if the given hash tables are equal or not. + * @param hash1 + * @param hash2 + * @return true if the hashtables are equal and false if not. + */ +U_CAPI UBool U_EXPORT2 +uhash_equals(const UHashtable* hash1, const UHashtable* hash2); + + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUHashtablePointer + * "Smart pointer" class, closes a UHashtable via uhash_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUHashtablePointer, UHashtable, uhash_close); + +U_NAMESPACE_END + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uinvchar.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uinvchar.h new file mode 100644 index 0000000000000000000000000000000000000000..9b7a9bd114172e285afd026f1d19df6ae0818270 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uinvchar.h @@ -0,0 +1,219 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 1999-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uinvchar.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:2 +* +* created on: 2004sep14 +* created by: Markus W. Scherer +* +* Definitions for handling invariant characters, moved here from putil.c +* for better modularization. +*/ + +#ifndef __UINVCHAR_H__ +#define __UINVCHAR_H__ + +#include "unicode/utypes.h" +#ifdef __cplusplus +#include "unicode/unistr.h" +#endif + +/** + * Check if a char string only contains invariant characters. + * See utypes.h for details. + * + * @param s Input string pointer. + * @param length Length of the string, can be -1 if NUL-terminated. + * @return true if s contains only invariant characters. + * + * @internal (ICU 2.8) + */ +U_CAPI UBool U_EXPORT2 +uprv_isInvariantString(const char *s, int32_t length); + +/** + * Check if a Unicode string only contains invariant characters. + * See utypes.h for details. + * + * @param s Input string pointer. + * @param length Length of the string, can be -1 if NUL-terminated. + * @return true if s contains only invariant characters. + * + * @internal (ICU 2.8) + */ +U_CAPI UBool U_EXPORT2 +uprv_isInvariantUString(const UChar *s, int32_t length); + +/** + * \def U_UPPER_ORDINAL + * Get the ordinal number of an uppercase invariant character + * @internal + */ +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define U_UPPER_ORDINAL(x) ((x)-'A') +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \ + (((x) < 'S') ? ((x)-'J'+9) : \ + ((x)-'S'+18))) +#else +# error Unknown charset family! +#endif + +#ifdef __cplusplus + +U_NAMESPACE_BEGIN + +/** + * Like U_UPPER_ORDINAL(x) but with validation. + * Returns 0..25 for A..Z else a value outside 0..25. + */ +inline int32_t uprv_upperOrdinal(int32_t c) { +#if U_CHARSET_FAMILY==U_ASCII_FAMILY + return c - 'A'; +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY + // EBCDIC: A-Z (26 letters) is split into three ranges A-I (9 letters), J-R (9), S-Z (8). + // https://en.wikipedia.org/wiki/EBCDIC_037#Codepage_layout + if (c <= 'I') { return c - 'A'; } // A-I --> 0-8 + if (c < 'J') { return -1; } + if (c <= 'R') { return c - 'J' + 9; } // J-R --> 9..17 + if (c < 'S') { return -1; } + return c - 'S' + 18; // S-Z --> 18..25 +#else +# error Unknown charset family! +#endif +} + +// Like U_UPPER_ORDINAL(x) but for lowercase and with validation. +// Returns 0..25 for a..z else a value outside 0..25. +inline int32_t uprv_lowerOrdinal(int32_t c) { +#if U_CHARSET_FAMILY==U_ASCII_FAMILY + return c - 'a'; +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY + // EBCDIC: a-z (26 letters) is split into three ranges a-i (9 letters), j-r (9), s-z (8). + // https://en.wikipedia.org/wiki/EBCDIC_037#Codepage_layout + if (c <= 'i') { return c - 'a'; } // a-i --> 0-8 + if (c < 'j') { return -1; } + if (c <= 'r') { return c - 'j' + 9; } // j-r --> 9..17 + if (c < 's') { return -1; } + return c - 's' + 18; // s-z --> 18..25 +#else +# error Unknown charset family! +#endif +} + +U_NAMESPACE_END + +#endif + +/** + * Returns true if c == '@' is possible. + * The @ sign is variant, and the @ sign used on one + * EBCDIC machine won't be compiled the same way on other EBCDIC based machines. + * @internal + */ +U_CFUNC UBool +uprv_isEbcdicAtSign(char c); + +/** + * \def uprv_isAtSign + * Returns true if c == '@' is possible. + * For ASCII, checks for exactly '@'. For EBCDIC, calls uprv_isEbcdicAtSign(). + * @internal + */ +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define uprv_isAtSign(c) ((c)=='@') +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define uprv_isAtSign(c) uprv_isEbcdicAtSign(c) +#else +# error Unknown charset family! +#endif + +/** + * Compare two EBCDIC invariant-character strings in ASCII order. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2); + +/** + * \def uprv_compareInvCharsAsAscii + * Compare two invariant-character strings in ASCII order. + * @internal + */ +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define uprv_compareInvCharsAsAscii(s1, s2) uprv_strcmp(s1, s2) +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define uprv_compareInvCharsAsAscii(s1, s2) uprv_compareInvEbcdicAsAscii(s1, s2) +#else +# error Unknown charset family! +#endif + +/** + * Converts an EBCDIC invariant character to ASCII. + * @internal + */ +U_CAPI char U_EXPORT2 +uprv_ebcdicToAscii(char c); + +/** + * \def uprv_invCharToAscii + * Converts an invariant character to ASCII. + * @internal + */ +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define uprv_invCharToAscii(c) (c) +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define uprv_invCharToAscii(c) uprv_ebcdicToAscii(c) +#else +# error Unknown charset family! +#endif + +/** + * Converts an EBCDIC invariant character to lowercase ASCII. + * @internal + */ +U_CAPI char U_EXPORT2 +uprv_ebcdicToLowercaseAscii(char c); + +/** + * \def uprv_invCharToLowercaseAscii + * Converts an invariant character to lowercase ASCII. + * @internal + */ +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define uprv_invCharToLowercaseAscii uprv_asciitolower +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define uprv_invCharToLowercaseAscii uprv_ebcdicToLowercaseAscii +#else +# error Unknown charset family! +#endif + +/** + * Copy EBCDIC to ASCII + * @internal + * @see uprv_strncpy + */ +U_CAPI uint8_t* U_EXPORT2 +uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n); + + +/** + * Copy ASCII to EBCDIC + * @internal + * @see uprv_strncpy + */ +U_CAPI uint8_t* U_EXPORT2 +uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n); + + + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ulayout_props.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ulayout_props.h new file mode 100644 index 0000000000000000000000000000000000000000..c0f028c7132609234e22ac763556b297e41d2123 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ulayout_props.h @@ -0,0 +1,46 @@ +// © 2019 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// ulayout_props.h +// created: 2019feb12 Markus W. Scherer + +#ifndef __ULAYOUT_PROPS_H__ +#define __ULAYOUT_PROPS_H__ + +#include "unicode/utypes.h" + +// file definitions ------------------------------------------------------------ + +#define ULAYOUT_DATA_NAME "ulayout" +#define ULAYOUT_DATA_TYPE "icu" + +// data format "Layo" +#define ULAYOUT_FMT_0 0x4c +#define ULAYOUT_FMT_1 0x61 +#define ULAYOUT_FMT_2 0x79 +#define ULAYOUT_FMT_3 0x6f + +// indexes into indexes[] +enum { + // Element 0 stores the length of the indexes[] array. + ULAYOUT_IX_INDEXES_LENGTH, + // Elements 1..7 store the tops of consecutive code point tries. + // No trie is stored if the difference between two of these is less than 16. + ULAYOUT_IX_INPC_TRIE_TOP, + ULAYOUT_IX_INSC_TRIE_TOP, + ULAYOUT_IX_VO_TRIE_TOP, + ULAYOUT_IX_RESERVED_TOP, + + ULAYOUT_IX_TRIES_TOP = 7, + + ULAYOUT_IX_MAX_VALUES = 9, + + // Length of indexes[]. Multiple of 4 to 16-align the tries. + ULAYOUT_IX_COUNT = 12 +}; + +constexpr int32_t ULAYOUT_MAX_INPC_SHIFT = 24; +constexpr int32_t ULAYOUT_MAX_INSC_SHIFT = 16; +constexpr int32_t ULAYOUT_MAX_VO_SHIFT = 8; + +#endif // __ULAYOUT_PROPS_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ulist.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ulist.h new file mode 100644 index 0000000000000000000000000000000000000000..de58a4ad02c1786efef0a5411c5778f46a814704 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ulist.h @@ -0,0 +1,50 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2009-2016, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +*/ + +#ifndef ULIST_H +#define ULIST_H + +#include "unicode/utypes.h" +#include "unicode/uenum.h" + +struct UList; +typedef struct UList UList; + +U_CAPI UList * U_EXPORT2 ulist_createEmptyList(UErrorCode *status); + +U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool forceDelete, UErrorCode *status); + +U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBool forceDelete, UErrorCode *status); + +U_CAPI UBool U_EXPORT2 ulist_containsString(const UList *list, const char *data, int32_t length); + +U_CAPI UBool U_EXPORT2 ulist_removeString(UList *list, const char *data); + +U_CAPI void *U_EXPORT2 ulist_getNext(UList *list); + +U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList *list); + +U_CAPI void U_EXPORT2 ulist_resetList(UList *list); + +U_CAPI void U_EXPORT2 ulist_deleteList(UList *list); + +/* + * The following are for use when creating UEnumeration object backed by UList. + */ +U_CAPI void U_EXPORT2 ulist_close_keyword_values_iterator(UEnumeration *en); + +U_CAPI int32_t U_EXPORT2 ulist_count_keyword_values(UEnumeration *en, UErrorCode *status); + +U_CAPI const char * U_EXPORT2 ulist_next_keyword_value(UEnumeration* en, int32_t *resultLength, UErrorCode* status); + +U_CAPI void U_EXPORT2 ulist_reset_keyword_values_iterator(UEnumeration* en, UErrorCode* status); + +U_CAPI UList * U_EXPORT2 ulist_getListFromEnum(UEnumeration *en); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ulocimp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ulocimp.h new file mode 100644 index 0000000000000000000000000000000000000000..1f796aa213048aa1b1e286fadbd231115df15d83 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ulocimp.h @@ -0,0 +1,310 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2004-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef ULOCIMP_H +#define ULOCIMP_H + +#include "unicode/bytestream.h" +#include "unicode/uloc.h" + +#include "charstr.h" + +/** + * Create an iterator over the specified keywords list + * @param keywordList double-null terminated list. Will be copied. + * @param keywordListSize size in bytes of keywordList + * @param status err code + * @return enumeration (owned by caller) of the keyword list. + * @internal ICU 3.0 + */ +U_CAPI UEnumeration* U_EXPORT2 +uloc_openKeywordList(const char *keywordList, int32_t keywordListSize, UErrorCode* status); + +/** + * Look up a resource bundle table item with fallback on the table level. + * This is accessible so it can be called by C++ code. + */ +U_CAPI const UChar * U_EXPORT2 +uloc_getTableStringWithFallback( + const char *path, + const char *locale, + const char *tableKey, + const char *subTableKey, + const char *itemKey, + int32_t *pLength, + UErrorCode *pErrorCode); + +/*returns true if a is an ID separator false otherwise*/ +#define _isIDSeparator(a) (a == '_' || a == '-') + +U_CFUNC const char* +uloc_getCurrentCountryID(const char* oldID); + +U_CFUNC const char* +uloc_getCurrentLanguageID(const char* oldID); + +U_CFUNC void +ulocimp_getKeywords(const char *localeID, + char prev, + icu::ByteSink& sink, + UBool valuesToo, + UErrorCode *status); + +icu::CharString U_EXPORT2 +ulocimp_getLanguage(const char *localeID, + const char **pEnd, + UErrorCode &status); + +icu::CharString U_EXPORT2 +ulocimp_getScript(const char *localeID, + const char **pEnd, + UErrorCode &status); + +icu::CharString U_EXPORT2 +ulocimp_getCountry(const char *localeID, + const char **pEnd, + UErrorCode &status); + +U_CAPI void U_EXPORT2 +ulocimp_getName(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err); + +U_CAPI void U_EXPORT2 +ulocimp_getBaseName(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err); + +U_CAPI void U_EXPORT2 +ulocimp_canonicalize(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err); + +U_CAPI void U_EXPORT2 +ulocimp_getKeywordValue(const char* localeID, + const char* keywordName, + icu::ByteSink& sink, + UErrorCode* status); + +/** + * Writes a well-formed language tag for this locale ID. + * + * **Note**: When `strict` is false, any locale fields which do not satisfy the + * BCP47 syntax requirement will be omitted from the result. When `strict` is + * true, this function sets U_ILLEGAL_ARGUMENT_ERROR to the `err` if any locale + * fields do not satisfy the BCP47 syntax requirement. + * + * @param localeID the input locale ID + * @param sink the output sink receiving the BCP47 language + * tag for this Locale. + * @param strict boolean value indicating if the function returns + * an error for an ill-formed input locale ID. + * @param err error information if receiving the language + * tag failed. + * @return The length of the BCP47 language tag. + * + * @internal ICU 64 + */ +U_CAPI void U_EXPORT2 +ulocimp_toLanguageTag(const char* localeID, + icu::ByteSink& sink, + UBool strict, + UErrorCode* err); + +/** + * Returns a locale ID for the specified BCP47 language tag string. + * If the specified language tag contains any ill-formed subtags, + * the first such subtag and all following subtags are ignored. + *

+ * This implements the 'Language-Tag' production of BCP 47, and so + * supports legacy language tags (marked as “Type: grandfathered” in BCP 47) + * (regular and irregular) as well as private use language tags. + * + * Private use tags are represented as 'x-whatever', + * and legacy tags are converted to their canonical replacements where they exist. + * + * Note that a few legacy tags have no modern replacement; + * these will be converted using the fallback described in + * the first paragraph, so some information might be lost. + * + * @param langtag the input BCP47 language tag. + * @param tagLen the length of langtag, or -1 to call uprv_strlen(). + * @param sink the output sink receiving a locale ID for the + * specified BCP47 language tag. + * @param parsedLength if not NULL, successfully parsed length + * for the input language tag is set. + * @param err error information if receiving the locald ID + * failed. + * @internal ICU 63 + */ +U_CAPI void U_EXPORT2 +ulocimp_forLanguageTag(const char* langtag, + int32_t tagLen, + icu::ByteSink& sink, + int32_t* parsedLength, + UErrorCode* err); + +/** + * Get the region to use for supplemental data lookup. Uses + * (1) any region specified by locale tag "rg"; if none then + * (2) any unicode_region_tag in the locale ID; if none then + * (3) if inferRegion is true, the region suggested by + * getLikelySubtags on the localeID. + * If no region is found, returns length 0. + * + * @param localeID + * The complete locale ID (with keywords) from which + * to get the region to use for supplemental data. + * @param inferRegion + * If true, will try to infer region from localeID if + * no other region is found. + * @param region + * Buffer in which to put the region ID found; should + * have a capacity at least ULOC_COUNTRY_CAPACITY. + * @param regionCapacity + * The actual capacity of the region buffer. + * @param status + * Pointer to in/out UErrorCode value for latest status. + * @return + * The length of any region code found, or 0 if none. + * @internal ICU 57 + */ +U_CAPI int32_t U_EXPORT2 +ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion, + char *region, int32_t regionCapacity, UErrorCode* status); + +/** + * Add the likely subtags for a provided locale ID, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If localeID is already in the maximal form, or there is no data available + * for maximization, it will be copied to the output buffer. For example, + * "und-Zzzz" cannot be maximized, since there is no reasonable maximization. + * + * Examples: + * + * "en" maximizes to "en_Latn_US" + * + * "de" maximizes to "de_Latn_US" + * + * "sr" maximizes to "sr_Cyrl_RS" + * + * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.) + * + * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.) + * + * @param localeID The locale to maximize + * @param sink The output sink receiving the maximized locale + * @param err Error information if maximizing the locale failed. If the length + * of the localeID and the null-terminator is greater than the maximum allowed size, + * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. + * @internal ICU 64 + */ +U_CAPI void U_EXPORT2 +ulocimp_addLikelySubtags(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err); + +/** + * Minimize the subtags for a provided locale ID, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If localeID is already in the minimal form, or there is no data available + * for minimization, it will be copied to the output buffer. Since the + * minimization algorithm relies on proper maximization, see the comments + * for ulocimp_addLikelySubtags for reasons why there might not be any data. + * + * Examples: + * + * "en_Latn_US" minimizes to "en" + * + * "de_Latn_US" minimizes to "de" + * + * "sr_Cyrl_RS" minimizes to "sr" + * + * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the + * script, and minimizing to "zh" would imply "zh_Hans_CN".) + * + * @param localeID The locale to minimize + * @param sink The output sink receiving the maximized locale + * @param err Error information if minimizing the locale failed. If the length + * of the localeID and the null-terminator is greater than the maximum allowed size, + * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. + * @internal ICU 64 + */ +U_CAPI void U_EXPORT2 +ulocimp_minimizeSubtags(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err); + +U_CAPI const char * U_EXPORT2 +locale_getKeywordsStart(const char *localeID); + +U_CFUNC UBool +ultag_isExtensionSubtags(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isLanguageSubtag(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isPrivateuseValueSubtags(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isRegionSubtag(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isScriptSubtag(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isTransformedExtensionSubtags(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isUnicodeExtensionSubtags(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isUnicodeLocaleAttribute(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isUnicodeLocaleAttributes(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isUnicodeLocaleKey(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isUnicodeLocaleType(const char* s, int32_t len); + +U_CFUNC UBool +ultag_isVariantSubtags(const char* s, int32_t len); + +U_CAPI const char * U_EXPORT2 +ultag_getTKeyStart(const char *localeID); + +U_CFUNC const char* +ulocimp_toBcpKey(const char* key); + +U_CFUNC const char* +ulocimp_toLegacyKey(const char* key); + +U_CFUNC const char* +ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType); + +U_CFUNC const char* +ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType); + +/* Function for testing purpose */ +U_CAPI const char* const* ulocimp_getKnownCanonicalizedLocaleForTest(int32_t* length); + +// Return true if the value is already canonicalized. +U_CAPI bool ulocimp_isCanonicalizedLocaleForTest(const char* localeName); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/umapfile.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/umapfile.h new file mode 100644 index 0000000000000000000000000000000000000000..92bd567a2a98952845eb489391092a6a64d9dfbc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/umapfile.h @@ -0,0 +1,57 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************/ + +/*---------------------------------------------------------------------------------- + * + * Memory mapped file wrappers for use by the ICU Data Implementation + * + * Porting note: The implementation of these functions is very platform specific. + * Not all platforms can do real memory mapping. Those that can't + * still must implement these functions, getting the data into memory using + * whatever means are available. + * + * These functions are part of the ICU internal implementation, and + * are not inteded to be used directly by applications. + * + *----------------------------------------------------------------------------------*/ + +#ifndef __UMAPFILE_H__ +#define __UMAPFILE_H__ + +#include "unicode/putil.h" +#include "unicode/udata.h" +#include "putilimp.h" + +U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path, UErrorCode *status); +U_CFUNC void uprv_unmapFile(UDataMemory *pData); + +/* MAP_NONE: no memory mapping, no file access at all */ +#define MAP_NONE 0 +#define MAP_WIN32 1 +#define MAP_POSIX 2 +#define MAP_STDIO 3 +#define MAP_390DLL 4 + +#if UCONFIG_NO_FILE_IO +# define MAP_IMPLEMENTATION MAP_NONE +#elif U_PLATFORM_USES_ONLY_WIN32_API +# define MAP_IMPLEMENTATION MAP_WIN32 +#elif U_HAVE_MMAP || U_PLATFORM == U_PF_OS390 +# if U_PLATFORM == U_PF_OS390 && defined (OS390_STUBDATA) + /* No memory mapping for 390 batch mode. Fake it using dll loading. */ +# define MAP_IMPLEMENTATION MAP_390DLL +# else +# define MAP_IMPLEMENTATION MAP_POSIX +# endif +#else /* unknown platform, no memory map implementation: use stdio.h and uprv_malloc() instead */ +# define MAP_IMPLEMENTATION MAP_STDIO +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/umutex.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/umutex.h new file mode 100644 index 0000000000000000000000000000000000000000..8d76b3f3e6f59628779774cbb993307655b2729b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/umutex.h @@ -0,0 +1,277 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1997-2015, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File UMUTEX.H +* +* Modification History: +* +* Date Name Description +* 04/02/97 aliu Creation. +* 04/07/99 srl rewrite - C interface, multiple mutices +* 05/13/99 stephen Changed to umutex (from cmutex) +****************************************************************************** +*/ + +#ifndef UMUTEX_H +#define UMUTEX_H + +#include +#include +#include +#include + +#include "unicode/utypes.h" +#include "unicode/uclean.h" +#include "unicode/uobject.h" + +#include "putilimp.h" + +#if defined(U_USER_ATOMICS_H) || defined(U_USER_MUTEX_H) +// Support for including an alternate implementation of atomic & mutex operations has been withdrawn. +// See issue ICU-20185. +#error U_USER_ATOMICS and U_USER_MUTEX_H are not supported +#endif + +// Export an explicit template instantiation of std::atomic. +// When building DLLs for Windows this is required as it is used as a data member of the exported SharedObject class. +// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples. +// +// Similar story for std::atomic, and the exported UMutex class. +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN) +#if defined(__clang__) || defined(_MSC_VER) + #if defined(__clang__) + // Suppress the warning that the explicit instantiation after explicit specialization has no effect. + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Winstantiation-after-specialization" + #endif +template struct U_COMMON_API std::atomic; +template struct U_COMMON_API std::atomic; + #if defined(__clang__) + #pragma clang diagnostic pop + #endif +#elif defined(__GNUC__) +// For GCC this class is already exported/visible, so no need for U_COMMON_API. +template struct std::atomic; +template struct std::atomic; +#endif +#endif + + +U_NAMESPACE_BEGIN + +/**************************************************************************** + * + * Low Level Atomic Operations, ICU wrappers for. + * + ****************************************************************************/ + +typedef std::atomic u_atomic_int32_t; +#define ATOMIC_INT32_T_INITIALIZER(val) ATOMIC_VAR_INIT(val) + +inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) { + return var.load(std::memory_order_acquire); +} + +inline void umtx_storeRelease(u_atomic_int32_t &var, int32_t val) { + var.store(val, std::memory_order_release); +} + +inline int32_t umtx_atomic_inc(u_atomic_int32_t *var) { + return var->fetch_add(1) + 1; +} + +inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) { + return var->fetch_sub(1) - 1; +} + + +/************************************************************************************************* + * + * UInitOnce Definitions. + * + *************************************************************************************************/ + +struct UInitOnce { + u_atomic_int32_t fState; + UErrorCode fErrCode; + void reset() {fState = 0;} + UBool isReset() {return umtx_loadAcquire(fState) == 0;} +// Note: isReset() is used by service registration code. +// Thread safety of this usage needs review. +}; + +#define U_INITONCE_INITIALIZER {ATOMIC_INT32_T_INITIALIZER(0), U_ZERO_ERROR} + + +U_COMMON_API UBool U_EXPORT2 umtx_initImplPreInit(UInitOnce &); +U_COMMON_API void U_EXPORT2 umtx_initImplPostInit(UInitOnce &); + +template void umtx_initOnce(UInitOnce &uio, T *obj, void (U_CALLCONV T::*fp)()) { + if (umtx_loadAcquire(uio.fState) == 2) { + return; + } + if (umtx_initImplPreInit(uio)) { + (obj->*fp)(); + umtx_initImplPostInit(uio); + } +} + + +// umtx_initOnce variant for plain functions, or static class functions. +// No context parameter. +inline void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)()) { + if (umtx_loadAcquire(uio.fState) == 2) { + return; + } + if (umtx_initImplPreInit(uio)) { + (*fp)(); + umtx_initImplPostInit(uio); + } +} + +// umtx_initOnce variant for plain functions, or static class functions. +// With ErrorCode, No context parameter. +inline void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(UErrorCode &), UErrorCode &errCode) { + if (U_FAILURE(errCode)) { + return; + } + if (umtx_loadAcquire(uio.fState) != 2 && umtx_initImplPreInit(uio)) { + // We run the initialization. + (*fp)(errCode); + uio.fErrCode = errCode; + umtx_initImplPostInit(uio); + } else { + // Someone else already ran the initialization. + if (U_FAILURE(uio.fErrCode)) { + errCode = uio.fErrCode; + } + } +} + +// umtx_initOnce variant for plain functions, or static class functions, +// with a context parameter. +template void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(T), T context) { + if (umtx_loadAcquire(uio.fState) == 2) { + return; + } + if (umtx_initImplPreInit(uio)) { + (*fp)(context); + umtx_initImplPostInit(uio); + } +} + +// umtx_initOnce variant for plain functions, or static class functions, +// with a context parameter and an error code. +template void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(T, UErrorCode &), T context, UErrorCode &errCode) { + if (U_FAILURE(errCode)) { + return; + } + if (umtx_loadAcquire(uio.fState) != 2 && umtx_initImplPreInit(uio)) { + // We run the initialization. + (*fp)(context, errCode); + uio.fErrCode = errCode; + umtx_initImplPostInit(uio); + } else { + // Someone else already ran the initialization. + if (U_FAILURE(uio.fErrCode)) { + errCode = uio.fErrCode; + } + } +} + +// UMutex should be constexpr-constructible, so that no initialization code +// is run during startup. +// This works on all C++ libraries except MS VS before VS2019. +#if (defined(_CPPLIB_VER) && !defined(_MSVC_STL_VERSION)) || \ + (defined(_MSVC_STL_VERSION) && _MSVC_STL_VERSION < 142) + // (VS std lib older than VS2017) || (VS std lib version < VS2019) +# define UMUTEX_CONSTEXPR +#else +# define UMUTEX_CONSTEXPR constexpr +#endif + +/** + * UMutex - ICU Mutex class. + * + * This is the preferred Mutex class for use within ICU implementation code. + * It is a thin wrapper over C++ std::mutex, with these additions: + * - Static instances are safe, not triggering static construction or destruction, + * and the associated order of construction or destruction issues. + * - Plumbed into u_cleanup() for destructing the underlying std::mutex, + * which frees any OS level resources they may be holding. + * + * Limitations: + * - Static or global instances only. Cannot be heap allocated. Cannot appear as a + * member of another class. + * - No condition variables or other advanced features. If needed, you will need to use + * std::mutex and std::condition_variable directly. For an example, see unifiedcache.cpp + * + * Typical Usage: + * static UMutex myMutex; + * + * { + * Mutex lock(myMutex); + * ... // Do stuff that is protected by myMutex; + * } // myMutex is released when lock goes out of scope. + */ + +class U_COMMON_API UMutex { +public: + UMUTEX_CONSTEXPR UMutex() {} + ~UMutex() = default; + + UMutex(const UMutex &other) = delete; + UMutex &operator =(const UMutex &other) = delete; + void *operator new(size_t) = delete; + + // requirements for C++ BasicLockable, allows UMutex to work with std::lock_guard + void lock() { + std::mutex *m = fMutex.load(std::memory_order_acquire); + if (m == nullptr) { m = getMutex(); } + m->lock(); + } + void unlock() { fMutex.load(std::memory_order_relaxed)->unlock(); } + + static void cleanup(); + +private: + alignas(std::mutex) char fStorage[sizeof(std::mutex)] {}; + std::atomic fMutex { nullptr }; + + /** All initialized UMutexes are kept in a linked list, so that they can be found, + * and the underlying std::mutex destructed, by u_cleanup(). + */ + UMutex *fListLink { nullptr }; + static UMutex *gListHead; + + /** Out-of-line function to lazily initialize a UMutex on first use. + * Initial fast check is inline, in lock(). The returned value may never + * be nullptr. + */ + std::mutex *getMutex(); +}; + + +/* Lock a mutex. + * @param mutex The given mutex to be locked. Pass NULL to specify + * the global ICU mutex. Recursive locks are an error + * and may cause a deadlock on some platforms. + */ +U_CAPI void U_EXPORT2 umtx_lock(UMutex* mutex); + +/* Unlock a mutex. + * @param mutex The given mutex to be unlocked. Pass NULL to specify + * the global ICU mutex. + */ +U_CAPI void U_EXPORT2 umtx_unlock (UMutex* mutex); + + +U_NAMESPACE_END + +#endif /* UMUTEX_H */ +/*eof*/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/appendable.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/appendable.h new file mode 100644 index 0000000000000000000000000000000000000000..fc99254de14e582bd5bf064d6cd0a3274e8d7e9d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/appendable.h @@ -0,0 +1,239 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2011-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: appendable.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010dec07 +* created by: Markus W. Scherer +*/ + +#ifndef __APPENDABLE_H__ +#define __APPENDABLE_H__ + +/** + * \file + * \brief C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts). + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN + +class UnicodeString; + +/** + * Base class for objects to which Unicode characters and strings can be appended. + * Combines elements of Java Appendable and ICU4C ByteSink. + * + * This class can be used in APIs where it does not matter whether the actual destination is + * a UnicodeString, a char16_t[] array, a UnicodeSet, or any other object + * that receives and processes characters and/or strings. + * + * Implementation classes must implement at least appendCodeUnit(char16_t). + * The base class provides default implementations for the other methods. + * + * The methods do not take UErrorCode parameters. + * If an error occurs (e.g., out-of-memory), + * in addition to returning false from failing operations, + * the implementation must prevent unexpected behavior (e.g., crashes) + * from further calls and should make the error condition available separately + * (e.g., store a UErrorCode, make/keep a UnicodeString bogus). + * @stable ICU 4.8 + */ +class U_COMMON_API Appendable : public UObject { +public: + /** + * Destructor. + * @stable ICU 4.8 + */ + ~Appendable(); + + /** + * Appends a 16-bit code unit. + * @param c code unit + * @return true if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendCodeUnit(char16_t c) = 0; + + /** + * Appends a code point. + * The default implementation calls appendCodeUnit(char16_t) once or twice. + * @param c code point 0..0x10ffff + * @return true if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendCodePoint(UChar32 c); + + /** + * Appends a string. + * The default implementation calls appendCodeUnit(char16_t) for each code unit. + * @param s string, must not be NULL if length!=0 + * @param length string length, or -1 if NUL-terminated + * @return true if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendString(const char16_t *s, int32_t length); + + /** + * Tells the object that the caller is going to append roughly + * appendCapacity char16_ts. A subclass might use this to pre-allocate + * a larger buffer if necessary. + * The default implementation does nothing. (It always returns true.) + * @param appendCapacity estimated number of char16_ts that will be appended + * @return true if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool reserveAppendCapacity(int32_t appendCapacity); + + /** + * Returns a writable buffer for appending and writes the buffer's capacity to + * *resultCapacity. Guarantees *resultCapacity>=minCapacity. + * May return a pointer to the caller-owned scratch buffer which must have + * scratchCapacity>=minCapacity. + * The returned buffer is only valid until the next operation + * on this Appendable. + * + * After writing at most *resultCapacity char16_ts, call appendString() with the + * pointer returned from this function and the number of char16_ts written. + * Many appendString() implementations will avoid copying char16_ts if this function + * returned an internal buffer. + * + * Partial usage example: + * \code + * int32_t capacity; + * char16_t* buffer = app.getAppendBuffer(..., &capacity); + * ... Write n char16_ts into buffer, with n <= capacity. + * app.appendString(buffer, n); + * \endcode + * In many implementations, that call to append will avoid copying char16_ts. + * + * If the Appendable allocates or reallocates an internal buffer, it should use + * the desiredCapacityHint if appropriate. + * If a caller cannot provide a reasonable guess at the desired capacity, + * it should pass desiredCapacityHint=0. + * + * If a non-scratch buffer is returned, the caller may only pass + * a prefix to it to appendString(). + * That is, it is not correct to pass an interior pointer to appendString(). + * + * The default implementation always returns the scratch buffer. + * + * @param minCapacity required minimum capacity of the returned buffer; + * must be non-negative + * @param desiredCapacityHint desired capacity of the returned buffer; + * must be non-negative + * @param scratch default caller-owned buffer + * @param scratchCapacity capacity of the scratch buffer + * @param resultCapacity pointer to an integer which will be set to the + * capacity of the returned buffer + * @return a buffer with *resultCapacity>=minCapacity + * @stable ICU 4.8 + */ + virtual char16_t *getAppendBuffer(int32_t minCapacity, + int32_t desiredCapacityHint, + char16_t *scratch, int32_t scratchCapacity, + int32_t *resultCapacity); +}; + +/** + * An Appendable implementation which writes to a UnicodeString. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API UnicodeStringAppendable : public Appendable { +public: + /** + * Aliases the UnicodeString (keeps its reference) for writing. + * @param s The UnicodeString to which this Appendable will write. + * @stable ICU 4.8 + */ + explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {} + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~UnicodeStringAppendable(); + + /** + * Appends a 16-bit code unit to the string. + * @param c code unit + * @return true if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendCodeUnit(char16_t c); + + /** + * Appends a code point to the string. + * @param c code point 0..0x10ffff + * @return true if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendCodePoint(UChar32 c); + + /** + * Appends a string to the UnicodeString. + * @param s string, must not be NULL if length!=0 + * @param length string length, or -1 if NUL-terminated + * @return true if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendString(const char16_t *s, int32_t length); + + /** + * Tells the UnicodeString that the caller is going to append roughly + * appendCapacity char16_ts. + * @param appendCapacity estimated number of char16_ts that will be appended + * @return true if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool reserveAppendCapacity(int32_t appendCapacity); + + /** + * Returns a writable buffer for appending and writes the buffer's capacity to + * *resultCapacity. Guarantees *resultCapacity>=minCapacity. + * May return a pointer to the caller-owned scratch buffer which must have + * scratchCapacity>=minCapacity. + * The returned buffer is only valid until the next write operation + * on the UnicodeString. + * + * For details see Appendable::getAppendBuffer(). + * + * @param minCapacity required minimum capacity of the returned buffer; + * must be non-negative + * @param desiredCapacityHint desired capacity of the returned buffer; + * must be non-negative + * @param scratch default caller-owned buffer + * @param scratchCapacity capacity of the scratch buffer + * @param resultCapacity pointer to an integer which will be set to the + * capacity of the returned buffer + * @return a buffer with *resultCapacity>=minCapacity + * @stable ICU 4.8 + */ + virtual char16_t *getAppendBuffer(int32_t minCapacity, + int32_t desiredCapacityHint, + char16_t *scratch, int32_t scratchCapacity, + int32_t *resultCapacity); + +private: + UnicodeString &str; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __APPENDABLE_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/brkiter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/brkiter.h new file mode 100644 index 0000000000000000000000000000000000000000..9bba5fcccc319da73040cdcf834e19322cdfe144 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/brkiter.h @@ -0,0 +1,670 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File brkiter.h +* +* Modification History: +* +* Date Name Description +* 02/18/97 aliu Added typedef for TextCount. Made DONE const. +* 05/07/97 aliu Fixed DLL declaration. +* 07/09/97 jfitz Renamed BreakIterator and interface synced with JDK +* 08/11/98 helena Sync-up JDK1.2. +* 01/13/2000 helena Added UErrorCode parameter to createXXXInstance methods. +******************************************************************************** +*/ + +#ifndef BRKITER_H +#define BRKITER_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Break Iterator. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if UCONFIG_NO_BREAK_ITERATION + +U_NAMESPACE_BEGIN + +/* + * Allow the declaration of APIs with pointers to BreakIterator + * even when break iteration is removed from the build. + */ +class BreakIterator; + +U_NAMESPACE_END + +#else + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/chariter.h" +#include "unicode/locid.h" +#include "unicode/ubrk.h" +#include "unicode/strenum.h" +#include "unicode/utext.h" +#include "unicode/umisc.h" + +U_NAMESPACE_BEGIN + +/** + * The BreakIterator class implements methods for finding the location + * of boundaries in text. BreakIterator is an abstract base class. + * Instances of BreakIterator maintain a current position and scan over + * text returning the index of characters where boundaries occur. + *

+ * Line boundary analysis determines where a text string can be broken + * when line-wrapping. The mechanism correctly handles punctuation and + * hyphenated words. + *

+ * Sentence boundary analysis allows selection with correct + * interpretation of periods within numbers and abbreviations, and + * trailing punctuation marks such as quotation marks and parentheses. + *

+ * Word boundary analysis is used by search and replace functions, as + * well as within text editing applications that allow the user to + * select words with a double click. Word selection provides correct + * interpretation of punctuation marks within and following + * words. Characters that are not part of a word, such as symbols or + * punctuation marks, have word-breaks on both sides. + *

+ * Character boundary analysis allows users to interact with + * characters as they expect to, for example, when moving the cursor + * through a text string. Character boundary analysis provides correct + * navigation of through character strings, regardless of how the + * character is stored. For example, an accented character might be + * stored as a base character and a diacritical mark. What users + * consider to be a character can differ between languages. + *

+ * The text boundary positions are found according to the rules + * described in Unicode Standard Annex #29, Text Boundaries, and + * Unicode Standard Annex #14, Line Breaking Properties. These + * are available at http://www.unicode.org/reports/tr14/ and + * http://www.unicode.org/reports/tr29/. + *

+ * In addition to the C++ API defined in this header file, a + * plain C API with equivalent functionality is defined in the + * file ubrk.h + *

+ * Code snippets illustrating the use of the Break Iterator APIs + * are available in the ICU User Guide, + * http://icu-project.org/userguide/boundaryAnalysis.html + * and in the sample program icu/source/samples/break/break.cpp + * + */ +class U_COMMON_API BreakIterator : public UObject { +public: + /** + * destructor + * @stable ICU 2.0 + */ + virtual ~BreakIterator(); + + /** + * Return true if another object is semantically equal to this + * one. The other object should be an instance of the same subclass of + * BreakIterator. Objects of different subclasses are considered + * unequal. + *

+ * Return true if this BreakIterator is at the same position in the + * same text, and is the same class and type (word, line, etc.) of + * BreakIterator, as the argument. Text is considered the same if + * it contains the same characters, it need not be the same + * object, and styles are not considered. + * @stable ICU 2.0 + */ + virtual UBool operator==(const BreakIterator&) const = 0; + + /** + * Returns the complement of the result of operator== + * @param rhs The BreakIterator to be compared for inequality + * @return the complement of the result of operator== + * @stable ICU 2.0 + */ + UBool operator!=(const BreakIterator& rhs) const { return !operator==(rhs); } + + /** + * Return a polymorphic copy of this object. This is an abstract + * method which subclasses implement. + * @stable ICU 2.0 + */ + virtual BreakIterator* clone() const = 0; + + /** + * Return a polymorphic class ID for this object. Different subclasses + * will return distinct unequal values. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const = 0; + + /** + * Return a CharacterIterator over the text being analyzed. + * @stable ICU 2.0 + */ + virtual CharacterIterator& getText(void) const = 0; + + + /** + * Get a UText for the text being analyzed. + * The returned UText is a shallow clone of the UText used internally + * by the break iterator implementation. It can safely be used to + * access the text without impacting any break iterator operations, + * but the underlying text itself must not be altered. + * + * @param fillIn A UText to be filled in. If NULL, a new UText will be + * allocated to hold the result. + * @param status receives any error codes. + * @return The current UText for this break iterator. If an input + * UText was provided, it will always be returned. + * @stable ICU 3.4 + */ + virtual UText *getUText(UText *fillIn, UErrorCode &status) const = 0; + + /** + * Change the text over which this operates. The text boundary is + * reset to the start. + * + * The BreakIterator will retain a reference to the supplied string. + * The caller must not modify or delete the text while the BreakIterator + * retains the reference. + * + * @param text The UnicodeString used to change the text. + * @stable ICU 2.0 + */ + virtual void setText(const UnicodeString &text) = 0; + + /** + * Reset the break iterator to operate over the text represented by + * the UText. The iterator position is reset to the start. + * + * This function makes a shallow clone of the supplied UText. This means + * that the caller is free to immediately close or otherwise reuse the + * Utext that was passed as a parameter, but that the underlying text itself + * must not be altered while being referenced by the break iterator. + * + * All index positions returned by break iterator functions are + * native indices from the UText. For example, when breaking UTF-8 + * encoded text, the break positions returned by next(), previous(), etc. + * will be UTF-8 string indices, not UTF-16 positions. + * + * @param text The UText used to change the text. + * @param status receives any error codes. + * @stable ICU 3.4 + */ + virtual void setText(UText *text, UErrorCode &status) = 0; + + /** + * Change the text over which this operates. The text boundary is + * reset to the start. + * Note that setText(UText *) provides similar functionality to this function, + * and is more efficient. + * @param it The CharacterIterator used to change the text. + * @stable ICU 2.0 + */ + virtual void adoptText(CharacterIterator* it) = 0; + + enum { + /** + * DONE is returned by previous() and next() after all valid + * boundaries have been returned. + * @stable ICU 2.0 + */ + DONE = (int32_t)-1 + }; + + /** + * Sets the current iteration position to the beginning of the text, position zero. + * @return The offset of the beginning of the text, zero. + * @stable ICU 2.0 + */ + virtual int32_t first(void) = 0; + + /** + * Set the iterator position to the index immediately BEYOND the last character in the text being scanned. + * @return The index immediately BEYOND the last character in the text being scanned. + * @stable ICU 2.0 + */ + virtual int32_t last(void) = 0; + + /** + * Set the iterator position to the boundary preceding the current boundary. + * @return The character index of the previous text boundary or DONE if all + * boundaries have been returned. + * @stable ICU 2.0 + */ + virtual int32_t previous(void) = 0; + + /** + * Advance the iterator to the boundary following the current boundary. + * @return The character index of the next text boundary or DONE if all + * boundaries have been returned. + * @stable ICU 2.0 + */ + virtual int32_t next(void) = 0; + + /** + * Return character index of the current iterator position within the text. + * @return The boundary most recently returned. + * @stable ICU 2.0 + */ + virtual int32_t current(void) const = 0; + + /** + * Advance the iterator to the first boundary following the specified offset. + * The value returned is always greater than the offset or + * the value BreakIterator.DONE + * @param offset the offset to begin scanning. + * @return The first boundary after the specified offset. + * @stable ICU 2.0 + */ + virtual int32_t following(int32_t offset) = 0; + + /** + * Set the iterator position to the first boundary preceding the specified offset. + * The value returned is always smaller than the offset or + * the value BreakIterator.DONE + * @param offset the offset to begin scanning. + * @return The first boundary before the specified offset. + * @stable ICU 2.0 + */ + virtual int32_t preceding(int32_t offset) = 0; + + /** + * Return true if the specified position is a boundary position. + * As a side effect, the current position of the iterator is set + * to the first boundary position at or following the specified offset. + * @param offset the offset to check. + * @return True if "offset" is a boundary position. + * @stable ICU 2.0 + */ + virtual UBool isBoundary(int32_t offset) = 0; + + /** + * Set the iterator position to the nth boundary from the current boundary + * @param n the number of boundaries to move by. A value of 0 + * does nothing. Negative values move to previous boundaries + * and positive values move to later boundaries. + * @return The new iterator position, or + * DONE if there are fewer than |n| boundaries in the specified direction. + * @stable ICU 2.0 + */ + virtual int32_t next(int32_t n) = 0; + + /** + * For RuleBasedBreakIterators, return the status tag from the break rule + * that determined the boundary at the current iteration position. + *

+ * For break iterator types that do not support a rule status, + * a default value of 0 is returned. + *

+ * @return the status from the break rule that determined the boundary at + * the current iteration position. + * @see RuleBaseBreakIterator::getRuleStatus() + * @see UWordBreak + * @stable ICU 52 + */ + virtual int32_t getRuleStatus() const; + + /** + * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) + * that determined the boundary at the current iteration position. + *

+ * For break iterator types that do not support rule status, + * no values are returned. + *

+ * The returned status value(s) are stored into an array provided by the caller. + * The values are stored in sorted (ascending) order. + * If the capacity of the output array is insufficient to hold the data, + * the output will be truncated to the available length, and a + * U_BUFFER_OVERFLOW_ERROR will be signaled. + *

+ * @see RuleBaseBreakIterator::getRuleStatusVec + * + * @param fillInVec an array to be filled in with the status values. + * @param capacity the length of the supplied vector. A length of zero causes + * the function to return the number of status values, in the + * normal way, without attempting to store any values. + * @param status receives error codes. + * @return The number of rule status values from rules that determined + * the boundary at the current iteration position. + * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value + * is the total number of status values that were available, + * not the reduced number that were actually returned. + * @see getRuleStatus + * @stable ICU 52 + */ + virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status); + + /** + * Create BreakIterator for word-breaks using the given locale. + * Returns an instance of a BreakIterator implementing word breaks. + * WordBreak is useful for word selection (ex. double click) + * @param where the locale. + * @param status the error code + * @return A BreakIterator for word-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createWordInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for line-breaks using specified locale. + * Returns an instance of a BreakIterator implementing line breaks. Line + * breaks are logically possible line breaks, actual line breaks are + * usually determined based on display width. + * LineBreak is useful for word wrapping text. + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for line-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createLineInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for character-breaks using specified locale + * Returns an instance of a BreakIterator implementing character breaks. + * Character breaks are boundaries of combining character sequences. + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for character-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createCharacterInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for sentence-breaks using specified locale + * Returns an instance of a BreakIterator implementing sentence breaks. + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for sentence-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createSentenceInstance(const Locale& where, UErrorCode& status); + +#ifndef U_HIDE_DEPRECATED_API + /** + * Create BreakIterator for title-casing breaks using the specified locale + * Returns an instance of a BreakIterator implementing title breaks. + * The iterator returned locates title boundaries as described for + * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, + * please use a word boundary iterator. See {@link #createWordInstance }. + * + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for title-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @deprecated ICU 64 Use createWordInstance instead. + */ + static BreakIterator* U_EXPORT2 + createTitleInstance(const Locale& where, UErrorCode& status); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Get the set of Locales for which TextBoundaries are installed. + *

Note: this will not return locales added through the register + * call. To see the registered locales too, use the getAvailableLocales + * function that returns a StringEnumeration object

+ * @param count the output parameter of number of elements in the locale list + * @return available locales + * @stable ICU 2.0 + */ + static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); + + /** + * Get name of the object for the desired Locale, in the desired language. + * @param objectLocale must be from getAvailableLocales. + * @param displayLocale specifies the desired locale for output. + * @param name the fill-in parameter of the return value + * Uses best match. + * @return user-displayable name + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, + const Locale& displayLocale, + UnicodeString& name); + + /** + * Get name of the object for the desired Locale, in the language of the + * default locale. + * @param objectLocale must be from getMatchingLocales + * @param name the fill-in parameter of the return value + * @return user-displayable name + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, + UnicodeString& name); + +#ifndef U_FORCE_HIDE_DEPRECATED_API + /** + * Deprecated functionality. Use clone() instead. + * + * Thread safe client-buffer-based cloning operation + * Do NOT call delete on a safeclone, since 'new' is not used to create it. + * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * @param BufferSize reference to size of allocated space. + * If BufferSize == 0, a sufficient size for use in cloning will + * be returned ('pre-flighting') + * If BufferSize is not enough for a stack-based safe clone, + * new memory will be allocated. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were + * necessary. + * @return pointer to the new clone + * + * @deprecated ICU 52. Use clone() instead. + */ + virtual BreakIterator * createBufferClone(void *stackBuffer, + int32_t &BufferSize, + UErrorCode &status) = 0; +#endif // U_FORCE_HIDE_DEPRECATED_API + +#ifndef U_HIDE_DEPRECATED_API + + /** + * Determine whether the BreakIterator was created in user memory by + * createBufferClone(), and thus should not be deleted. Such objects + * must be closed by an explicit call to the destructor (not delete). + * @deprecated ICU 52. Always delete the BreakIterator. + */ + inline UBool isBufferClone(void); + +#endif /* U_HIDE_DEPRECATED_API */ + +#if !UCONFIG_NO_SERVICE + /** + * Register a new break iterator of the indicated kind, to use in the given locale. + * The break iterator will be adopted. Clones of the iterator will be returned + * if a request for a break iterator of the given kind matches or falls back to + * this locale. + * Because ICU may choose to cache BreakIterators internally, this must + * be called at application startup, prior to any calls to + * BreakIterator::createXXXInstance to avoid undefined behavior. + * @param toAdopt the BreakIterator instance to be adopted + * @param locale the Locale for which this instance is to be registered + * @param kind the type of iterator for which this instance is to be registered + * @param status the in/out status code, no special meanings are assigned + * @return a registry key that can be used to unregister this instance + * @stable ICU 2.4 + */ + static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt, + const Locale& locale, + UBreakIteratorType kind, + UErrorCode& status); + + /** + * Unregister a previously-registered BreakIterator using the key returned from the + * register call. Key becomes invalid after a successful call and should not be used again. + * The BreakIterator corresponding to the key will be deleted. + * Because ICU may choose to cache BreakIterators internally, this should + * be called during application shutdown, after all calls to + * BreakIterator::createXXXInstance to avoid undefined behavior. + * @param key the registry key returned by a previous call to registerInstance + * @param status the in/out status code, no special meanings are assigned + * @return true if the iterator for the key was successfully unregistered + * @stable ICU 2.4 + */ + static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); + + /** + * Return a StringEnumeration over the locales available at the time of the call, + * including registered locales. + * @return a StringEnumeration over the locales available at the time of the call + * @stable ICU 2.4 + */ + static StringEnumeration* U_EXPORT2 getAvailableLocales(void); +#endif + + /** + * Returns the locale for this break iterator. Two flavors are available: valid and + * actual locale. + * @stable ICU 2.8 + */ + Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; + +#ifndef U_HIDE_INTERNAL_API + /** Get the locale for this break iterator object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale + * @internal + */ + const char *getLocaleID(ULocDataLocaleType type, UErrorCode& status) const; +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the matching state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator implementation never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized, + * system-level code. One example use case is with garbage collection that moves + * the text in memory. + * + * @param input The new (moved) text string. + * @param status Receives errors detected by this function. + * @return *this + * + * @stable ICU 49 + */ + virtual BreakIterator &refreshInputText(UText *input, UErrorCode &status) = 0; + + private: + static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status); + static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status); + static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status); + + friend class ICUBreakIteratorFactory; + friend class ICUBreakIteratorService; + +protected: + // Do not enclose protected default/copy constructors with #ifndef U_HIDE_INTERNAL_API + // or else the compiler will create a public ones. + /** @internal */ + BreakIterator(); + /** @internal */ + BreakIterator (const BreakIterator &other); +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + BreakIterator (const Locale& valid, const Locale &actual); + /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */ + BreakIterator &operator = (const BreakIterator &other); +#endif /* U_HIDE_INTERNAL_API */ + +private: + + /** @internal (private) */ + char actualLocale[ULOC_FULLNAME_CAPACITY]; + char validLocale[ULOC_FULLNAME_CAPACITY]; +}; + +#ifndef U_HIDE_DEPRECATED_API + +inline UBool BreakIterator::isBufferClone() +{ + return false; +} + +#endif /* U_HIDE_DEPRECATED_API */ + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // BRKITER_H +//eof diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/bytestream.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/bytestream.h new file mode 100644 index 0000000000000000000000000000000000000000..9735ee0bf86f5fed7296fd4d0de270d3654e9113 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/bytestream.h @@ -0,0 +1,307 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// Copyright (C) 2009-2012, International Business Machines +// Corporation and others. All Rights Reserved. +// +// Copyright 2007 Google Inc. All Rights Reserved. +// Author: sanjay@google.com (Sanjay Ghemawat) +// +// Abstract interface that consumes a sequence of bytes (ByteSink). +// +// Used so that we can write a single piece of code that can operate +// on a variety of output string types. +// +// Various implementations of this interface are provided: +// ByteSink: +// CheckedArrayByteSink Write to a flat array, with bounds checking +// StringByteSink Write to an STL string + +// This code is a contribution of Google code, and the style used here is +// a compromise between the original Google code and the ICU coding guidelines. +// For example, data types are ICU-ified (size_t,int->int32_t), +// and API comments doxygen-ified, but function names and behavior are +// as in the original, if possible. +// Assertion-style error handling, not available in ICU, was changed to +// parameter "pinning" similar to UnicodeString. +// +// In addition, this is only a partial port of the original Google code, +// limited to what was needed so far. The (nearly) complete original code +// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib +// (see ICU ticket 6765, r25517). + +#ifndef __BYTESTREAM_H__ +#define __BYTESTREAM_H__ + +/** + * \file + * \brief C++ API: Interface for writing bytes, and implementation classes. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" +#include "unicode/std_string.h" + +U_NAMESPACE_BEGIN + +/** + * A ByteSink can be filled with bytes. + * @stable ICU 4.2 + */ +class U_COMMON_API ByteSink : public UMemory { +public: + /** + * Default constructor. + * @stable ICU 4.2 + */ + ByteSink() { } + /** + * Virtual destructor. + * @stable ICU 4.2 + */ + virtual ~ByteSink(); + + /** + * Append "bytes[0,n-1]" to this. + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 4.2 + */ + virtual void Append(const char* bytes, int32_t n) = 0; + + /** + * Appends n bytes to this. Same as Append(). + * Call AppendU8() with u8"string literals" which are const char * in C++11 + * but const char8_t * in C++20. + * If the compiler does support char8_t as a distinct type, + * then an AppendU8() overload for that is defined and will be chosen. + * + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 67 + */ + inline void AppendU8(const char* bytes, int32_t n) { + Append(bytes, n); + } + +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) + /** + * Appends n bytes to this. Same as Append() but for a const char8_t * pointer. + * Call AppendU8() with u8"string literals" which are const char * in C++11 + * but const char8_t * in C++20. + * If the compiler does support char8_t as a distinct type, + * then this AppendU8() overload for that is defined and will be chosen. + * + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 67 + */ + inline void AppendU8(const char8_t* bytes, int32_t n) { + Append(reinterpret_cast(bytes), n); + } +#endif + + /** + * Returns a writable buffer for appending and writes the buffer's capacity to + * *result_capacity. Guarantees *result_capacity>=min_capacity. + * May return a pointer to the caller-owned scratch buffer which must have + * scratch_capacity>=min_capacity. + * The returned buffer is only valid until the next operation + * on this ByteSink. + * + * After writing at most *result_capacity bytes, call Append() with the + * pointer returned from this function and the number of bytes written. + * Many Append() implementations will avoid copying bytes if this function + * returned an internal buffer. + * + * Partial usage example: + * int32_t capacity; + * char* buffer = sink->GetAppendBuffer(..., &capacity); + * ... Write n bytes into buffer, with n <= capacity. + * sink->Append(buffer, n); + * In many implementations, that call to Append will avoid copying bytes. + * + * If the ByteSink allocates or reallocates an internal buffer, it should use + * the desired_capacity_hint if appropriate. + * If a caller cannot provide a reasonable guess at the desired capacity, + * it should pass desired_capacity_hint=0. + * + * If a non-scratch buffer is returned, the caller may only pass + * a prefix to it to Append(). + * That is, it is not correct to pass an interior pointer to Append(). + * + * The default implementation always returns the scratch buffer. + * + * @param min_capacity required minimum capacity of the returned buffer; + * must be non-negative + * @param desired_capacity_hint desired capacity of the returned buffer; + * must be non-negative + * @param scratch default caller-owned buffer + * @param scratch_capacity capacity of the scratch buffer + * @param result_capacity pointer to an integer which will be set to the + * capacity of the returned buffer + * @return a buffer with *result_capacity>=min_capacity + * @stable ICU 4.2 + */ + virtual char* GetAppendBuffer(int32_t min_capacity, + int32_t desired_capacity_hint, + char* scratch, int32_t scratch_capacity, + int32_t* result_capacity); + + /** + * Flush internal buffers. + * Some byte sinks use internal buffers or provide buffering + * and require calling Flush() at the end of the stream. + * The ByteSink should be ready for further Append() calls after Flush(). + * The default implementation of Flush() does nothing. + * @stable ICU 4.2 + */ + virtual void Flush(); + +private: + ByteSink(const ByteSink &) = delete; + ByteSink &operator=(const ByteSink &) = delete; +}; + +// ------------------------------------------------------------- +// Some standard implementations + +/** + * Implementation of ByteSink that writes to a flat byte array, + * with bounds-checking: + * This sink will not write more than capacity bytes to outbuf. + * If more than capacity bytes are Append()ed, then excess bytes are ignored, + * and Overflowed() will return true. + * Overflow does not cause a runtime error. + * @stable ICU 4.2 + */ +class U_COMMON_API CheckedArrayByteSink : public ByteSink { +public: + /** + * Constructs a ByteSink that will write to outbuf[0..capacity-1]. + * @param outbuf buffer to write to + * @param capacity size of the buffer + * @stable ICU 4.2 + */ + CheckedArrayByteSink(char* outbuf, int32_t capacity); + /** + * Destructor. + * @stable ICU 4.2 + */ + virtual ~CheckedArrayByteSink(); + /** + * Returns the sink to its original state, without modifying the buffer. + * Useful for reusing both the buffer and the sink for multiple streams. + * Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0 + * and Overflowed()=false. + * @return *this + * @stable ICU 4.6 + */ + virtual CheckedArrayByteSink& Reset(); + /** + * Append "bytes[0,n-1]" to this. + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 4.2 + */ + virtual void Append(const char* bytes, int32_t n); + /** + * Returns a writable buffer for appending and writes the buffer's capacity to + * *result_capacity. For details see the base class documentation. + * @param min_capacity required minimum capacity of the returned buffer; + * must be non-negative + * @param desired_capacity_hint desired capacity of the returned buffer; + * must be non-negative + * @param scratch default caller-owned buffer + * @param scratch_capacity capacity of the scratch buffer + * @param result_capacity pointer to an integer which will be set to the + * capacity of the returned buffer + * @return a buffer with *result_capacity>=min_capacity + * @stable ICU 4.2 + */ + virtual char* GetAppendBuffer(int32_t min_capacity, + int32_t desired_capacity_hint, + char* scratch, int32_t scratch_capacity, + int32_t* result_capacity); + /** + * Returns the number of bytes actually written to the sink. + * @return number of bytes written to the buffer + * @stable ICU 4.2 + */ + int32_t NumberOfBytesWritten() const { return size_; } + /** + * Returns true if any bytes were discarded, i.e., if there was an + * attempt to write more than 'capacity' bytes. + * @return true if more than 'capacity' bytes were Append()ed + * @stable ICU 4.2 + */ + UBool Overflowed() const { return overflowed_; } + /** + * Returns the number of bytes appended to the sink. + * If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten() + * else they return the same number. + * @return number of bytes written to the buffer + * @stable ICU 4.6 + */ + int32_t NumberOfBytesAppended() const { return appended_; } +private: + char* outbuf_; + const int32_t capacity_; + int32_t size_; + int32_t appended_; + UBool overflowed_; + + CheckedArrayByteSink() = delete; + CheckedArrayByteSink(const CheckedArrayByteSink &) = delete; + CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete; +}; + +/** + * Implementation of ByteSink that writes to a "string". + * The StringClass is usually instantiated with a std::string. + * @stable ICU 4.2 + */ +template +class StringByteSink : public ByteSink { + public: + /** + * Constructs a ByteSink that will append bytes to the dest string. + * @param dest pointer to string object to append to + * @stable ICU 4.2 + */ + StringByteSink(StringClass* dest) : dest_(dest) { } + /** + * Constructs a ByteSink that reserves append capacity and will append bytes to the dest string. + * + * @param dest pointer to string object to append to + * @param initialAppendCapacity capacity beyond dest->length() to be reserve()d + * @stable ICU 60 + */ + StringByteSink(StringClass* dest, int32_t initialAppendCapacity) : dest_(dest) { + if (initialAppendCapacity > 0 && + (uint32_t)initialAppendCapacity > (dest->capacity() - dest->length())) { + dest->reserve(dest->length() + initialAppendCapacity); + } + } + /** + * Append "bytes[0,n-1]" to this. + * @param data the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 4.2 + */ + virtual void Append(const char* data, int32_t n) { dest_->append(data, n); } + private: + StringClass* dest_; + + StringByteSink() = delete; + StringByteSink(const StringByteSink &) = delete; + StringByteSink &operator=(const StringByteSink &) = delete; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __BYTESTREAM_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/bytestrie.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/bytestrie.h new file mode 100644 index 0000000000000000000000000000000000000000..271a81d1b4d7d492ae5d3aa595020fab525e79b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/bytestrie.h @@ -0,0 +1,568 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: bytestrie.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010sep25 +* created by: Markus W. Scherer +*/ + +#ifndef __BYTESTRIE_H__ +#define __BYTESTRIE_H__ + +/** + * \file + * \brief C++ API: Trie for mapping byte sequences to integer values. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" +#include "unicode/ustringtrie.h" + +class BytesTrieTest; + +U_NAMESPACE_BEGIN + +class ByteSink; +class BytesTrieBuilder; +class CharString; +class UVector32; + +/** + * Light-weight, non-const reader class for a BytesTrie. + * Traverses a byte-serialized data structure with minimal state, + * for mapping byte sequences to non-negative integer values. + * + * This class owns the serialized trie data only if it was constructed by + * the builder's build() method. + * The public constructor and the copy constructor only alias the data (only copy the pointer). + * There is no assignment operator. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API BytesTrie : public UMemory { +public: + /** + * Constructs a BytesTrie reader instance. + * + * The trieBytes must contain a copy of a byte sequence from the BytesTrieBuilder, + * starting with the first byte of that sequence. + * The BytesTrie object will not read more bytes than + * the BytesTrieBuilder generated in the corresponding build() call. + * + * The array is not copied/cloned and must not be modified while + * the BytesTrie object is in use. + * + * @param trieBytes The byte array that contains the serialized trie. + * @stable ICU 4.8 + */ + BytesTrie(const void *trieBytes) + : ownedArray_(NULL), bytes_(static_cast(trieBytes)), + pos_(bytes_), remainingMatchLength_(-1) {} + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~BytesTrie(); + + /** + * Copy constructor, copies the other trie reader object and its state, + * but not the byte array which will be shared. (Shallow copy.) + * @param other Another BytesTrie object. + * @stable ICU 4.8 + */ + BytesTrie(const BytesTrie &other) + : ownedArray_(NULL), bytes_(other.bytes_), + pos_(other.pos_), remainingMatchLength_(other.remainingMatchLength_) {} + + /** + * Resets this trie to its initial state. + * @return *this + * @stable ICU 4.8 + */ + BytesTrie &reset() { + pos_=bytes_; + remainingMatchLength_=-1; + return *this; + } + + /** + * Returns the state of this trie as a 64-bit integer. + * The state value is never 0. + * + * @return opaque state value + * @see resetToState64 + * @stable ICU 65 + */ + uint64_t getState64() const { + return (static_cast(remainingMatchLength_ + 2) << kState64RemainingShift) | + (uint64_t)(pos_ - bytes_); + } + + /** + * Resets this trie to the saved state. + * Unlike resetToState(State), the 64-bit state value + * must be from getState64() from the same trie object or + * from one initialized the exact same way. + * Because of no validation, this method is faster. + * + * @param state The opaque trie state value from getState64(). + * @return *this + * @see getState64 + * @see resetToState + * @see reset + * @stable ICU 65 + */ + BytesTrie &resetToState64(uint64_t state) { + remainingMatchLength_ = static_cast(state >> kState64RemainingShift) - 2; + pos_ = bytes_ + (state & kState64PosMask); + return *this; + } + + /** + * BytesTrie state object, for saving a trie's current state + * and resetting the trie back to this state later. + * @stable ICU 4.8 + */ + class State : public UMemory { + public: + /** + * Constructs an empty State. + * @stable ICU 4.8 + */ + State() { bytes=NULL; } + private: + friend class BytesTrie; + + const uint8_t *bytes; + const uint8_t *pos; + int32_t remainingMatchLength; + }; + + /** + * Saves the state of this trie. + * @param state The State object to hold the trie's state. + * @return *this + * @see resetToState + * @stable ICU 4.8 + */ + const BytesTrie &saveState(State &state) const { + state.bytes=bytes_; + state.pos=pos_; + state.remainingMatchLength=remainingMatchLength_; + return *this; + } + + /** + * Resets this trie to the saved state. + * If the state object contains no state, or the state of a different trie, + * then this trie remains unchanged. + * @param state The State object which holds a saved trie state. + * @return *this + * @see saveState + * @see reset + * @stable ICU 4.8 + */ + BytesTrie &resetToState(const State &state) { + if(bytes_==state.bytes && bytes_!=NULL) { + pos_=state.pos; + remainingMatchLength_=state.remainingMatchLength; + } + return *this; + } + + /** + * Determines whether the byte sequence so far matches, whether it has a value, + * and whether another input byte can continue a matching byte sequence. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult current() const; + + /** + * Traverses the trie from the initial state for this input byte. + * Equivalent to reset().next(inByte). + * @param inByte Input byte value. Values -0x100..-1 are treated like 0..0xff. + * Values below -0x100 and above 0xff will never match. + * @return The match/value Result. + * @stable ICU 4.8 + */ + inline UStringTrieResult first(int32_t inByte) { + remainingMatchLength_=-1; + if(inByte<0) { + inByte+=0x100; + } + return nextImpl(bytes_, inByte); + } + + /** + * Traverses the trie from the current state for this input byte. + * @param inByte Input byte value. Values -0x100..-1 are treated like 0..0xff. + * Values below -0x100 and above 0xff will never match. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult next(int32_t inByte); + + /** + * Traverses the trie from the current state for this byte sequence. + * Equivalent to + * \code + * Result result=current(); + * for(each c in s) + * if(!USTRINGTRIE_HAS_NEXT(result)) return USTRINGTRIE_NO_MATCH; + * result=next(c); + * return result; + * \endcode + * @param s A string or byte sequence. Can be NULL if length is 0. + * @param length The length of the byte sequence. Can be -1 if NUL-terminated. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult next(const char *s, int32_t length); + + /** + * Returns a matching byte sequence's value if called immediately after + * current()/first()/next() returned USTRINGTRIE_INTERMEDIATE_VALUE or USTRINGTRIE_FINAL_VALUE. + * getValue() can be called multiple times. + * + * Do not call getValue() after USTRINGTRIE_NO_MATCH or USTRINGTRIE_NO_VALUE! + * @return The value for the byte sequence so far. + * @stable ICU 4.8 + */ + inline int32_t getValue() const { + const uint8_t *pos=pos_; + int32_t leadByte=*pos++; + // U_ASSERT(leadByte>=kMinValueLead); + return readValue(pos, leadByte>>1); + } + + /** + * Determines whether all byte sequences reachable from the current state + * map to the same value. + * @param uniqueValue Receives the unique value, if this function returns true. + * (output-only) + * @return true if all byte sequences reachable from the current state + * map to the same value. + * @stable ICU 4.8 + */ + inline UBool hasUniqueValue(int32_t &uniqueValue) const { + const uint8_t *pos=pos_; + // Skip the rest of a pending linear-match node. + return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue); + } + + /** + * Finds each byte which continues the byte sequence from the current state. + * That is, each byte b for which it would be next(b)!=USTRINGTRIE_NO_MATCH now. + * @param out Each next byte is appended to this object. + * (Only uses the out.Append(s, length) method.) + * @return the number of bytes which continue the byte sequence from here + * @stable ICU 4.8 + */ + int32_t getNextBytes(ByteSink &out) const; + + /** + * Iterator for all of the (byte sequence, value) pairs in a BytesTrie. + * @stable ICU 4.8 + */ + class U_COMMON_API Iterator : public UMemory { + public: + /** + * Iterates from the root of a byte-serialized BytesTrie. + * @param trieBytes The trie bytes. + * @param maxStringLength If 0, the iterator returns full strings/byte sequences. + * Otherwise, the iterator returns strings with this maximum length. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + Iterator(const void *trieBytes, int32_t maxStringLength, UErrorCode &errorCode); + + /** + * Iterates from the current state of the specified BytesTrie. + * @param trie The trie whose state will be copied for iteration. + * @param maxStringLength If 0, the iterator returns full strings/byte sequences. + * Otherwise, the iterator returns strings with this maximum length. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + Iterator(const BytesTrie &trie, int32_t maxStringLength, UErrorCode &errorCode); + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~Iterator(); + + /** + * Resets this iterator to its initial state. + * @return *this + * @stable ICU 4.8 + */ + Iterator &reset(); + + /** + * @return true if there are more elements. + * @stable ICU 4.8 + */ + UBool hasNext() const; + + /** + * Finds the next (byte sequence, value) pair if there is one. + * + * If the byte sequence is truncated to the maximum length and does not + * have a real value, then the value is set to -1. + * In this case, this "not a real value" is indistinguishable from + * a real value of -1. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return true if there is another element. + * @stable ICU 4.8 + */ + UBool next(UErrorCode &errorCode); + + /** + * @return The NUL-terminated byte sequence for the last successful next(). + * @stable ICU 4.8 + */ + StringPiece getString() const; + /** + * @return The value for the last successful next(). + * @stable ICU 4.8 + */ + int32_t getValue() const { return value_; } + + private: + UBool truncateAndStop(); + + const uint8_t *branchNext(const uint8_t *pos, int32_t length, UErrorCode &errorCode); + + const uint8_t *bytes_; + const uint8_t *pos_; + const uint8_t *initialPos_; + int32_t remainingMatchLength_; + int32_t initialRemainingMatchLength_; + + CharString *str_; + int32_t maxLength_; + int32_t value_; + + // The stack stores pairs of integers for backtracking to another + // outbound edge of a branch node. + // The first integer is an offset from bytes_. + // The second integer has the str_->length() from before the node in bits 15..0, + // and the remaining branch length in bits 24..16. (Bits 31..25 are unused.) + // (We could store the remaining branch length minus 1 in bits 23..16 and not use bits 31..24, + // but the code looks more confusing that way.) + UVector32 *stack_; + }; + +private: + friend class BytesTrieBuilder; + friend class ::BytesTrieTest; + + /** + * Constructs a BytesTrie reader instance. + * Unlike the public constructor which just aliases an array, + * this constructor adopts the builder's array. + * This constructor is only called by the builder. + */ + BytesTrie(void *adoptBytes, const void *trieBytes) + : ownedArray_(static_cast(adoptBytes)), + bytes_(static_cast(trieBytes)), + pos_(bytes_), remainingMatchLength_(-1) {} + + // No assignment operator. + BytesTrie &operator=(const BytesTrie &other); + + inline void stop() { + pos_=NULL; + } + + // Reads a compact 32-bit integer. + // pos is already after the leadByte, and the lead byte is already shifted right by 1. + static int32_t readValue(const uint8_t *pos, int32_t leadByte); + static inline const uint8_t *skipValue(const uint8_t *pos, int32_t leadByte) { + // U_ASSERT(leadByte>=kMinValueLead); + if(leadByte>=(kMinTwoByteValueLead<<1)) { + if(leadByte<(kMinThreeByteValueLead<<1)) { + ++pos; + } else if(leadByte<(kFourByteValueLead<<1)) { + pos+=2; + } else { + pos+=3+((leadByte>>1)&1); + } + } + return pos; + } + static inline const uint8_t *skipValue(const uint8_t *pos) { + int32_t leadByte=*pos++; + return skipValue(pos, leadByte); + } + + // Reads a jump delta and jumps. + static const uint8_t *jumpByDelta(const uint8_t *pos); + + static inline const uint8_t *skipDelta(const uint8_t *pos) { + int32_t delta=*pos++; + if(delta>=kMinTwoByteDeltaLead) { + if(delta>8)+1; // 0x6c + static const int32_t kFourByteValueLead=0x7e; + + // A little more than Unicode code points. (0x11ffff) + static const int32_t kMaxThreeByteValue=((kFourByteValueLead-kMinThreeByteValueLead)<<16)-1; + + static const int32_t kFiveByteValueLead=0x7f; + + // Compact delta integers. + static const int32_t kMaxOneByteDelta=0xbf; + static const int32_t kMinTwoByteDeltaLead=kMaxOneByteDelta+1; // 0xc0 + static const int32_t kMinThreeByteDeltaLead=0xf0; + static const int32_t kFourByteDeltaLead=0xfe; + static const int32_t kFiveByteDeltaLead=0xff; + + static const int32_t kMaxTwoByteDelta=((kMinThreeByteDeltaLead-kMinTwoByteDeltaLead)<<8)-1; // 0x2fff + static const int32_t kMaxThreeByteDelta=((kFourByteDeltaLead-kMinThreeByteDeltaLead)<<16)-1; // 0xdffff + + // For getState64(): + // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2 + // so we need at least 5 bits for that. + // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength. + static constexpr int32_t kState64RemainingShift = 59; + static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1; + + uint8_t *ownedArray_; + + // Fixed value referencing the BytesTrie bytes. + const uint8_t *bytes_; + + // Iterator variables. + + // Pointer to next trie byte to read. NULL if no more matches. + const uint8_t *pos_; + // Remaining length of a linear-match node, minus 1. Negative if not in such a node. + int32_t remainingMatchLength_; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __BYTESTRIE_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/bytestriebuilder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/bytestriebuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..3cff89e443de5e26ceca429340037922ba9ae8ce --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/bytestriebuilder.h @@ -0,0 +1,193 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: bytestriebuilder.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010sep25 +* created by: Markus W. Scherer +*/ + +/** + * \file + * \brief C++ API: Builder for icu::BytesTrie + */ + +#ifndef __BYTESTRIEBUILDER_H__ +#define __BYTESTRIEBUILDER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/bytestrie.h" +#include "unicode/stringpiece.h" +#include "unicode/stringtriebuilder.h" + +class BytesTrieTest; + +U_NAMESPACE_BEGIN + +class BytesTrieElement; +class CharString; +/** + * Builder class for BytesTrie. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder { +public: + /** + * Constructs an empty builder. + * @param errorCode Standard ICU error code. + * @stable ICU 4.8 + */ + BytesTrieBuilder(UErrorCode &errorCode); + + /** + * Destructor. + * @stable ICU 4.8 + */ + virtual ~BytesTrieBuilder(); + + /** + * Adds a (byte sequence, value) pair. + * The byte sequence must be unique. + * The bytes will be copied; the builder does not keep + * a reference to the input StringPiece or its data(). + * @param s The input byte sequence. + * @param value The value associated with this byte sequence. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @stable ICU 4.8 + */ + BytesTrieBuilder &add(StringPiece s, int32_t value, UErrorCode &errorCode); + + /** + * Builds a BytesTrie for the add()ed data. + * Once built, no further data can be add()ed until clear() is called. + * + * A BytesTrie cannot be empty. At least one (byte sequence, value) pair + * must have been add()ed. + * + * This method passes ownership of the builder's internal result array to the new trie object. + * Another call to any build() variant will re-serialize the trie. + * After clear() has been called, a new array will be used as well. + * @param buildOption Build option, see UStringTrieBuildOption. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return A new BytesTrie for the add()ed data. + * @stable ICU 4.8 + */ + BytesTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + /** + * Builds a BytesTrie for the add()ed data and byte-serializes it. + * Once built, no further data can be add()ed until clear() is called. + * + * A BytesTrie cannot be empty. At least one (byte sequence, value) pair + * must have been add()ed. + * + * Multiple calls to buildStringPiece() return StringPieces referring to the + * builder's same byte array, without rebuilding. + * If buildStringPiece() is called after build(), the trie will be + * re-serialized into a new array (because build() passes on ownership). + * If build() is called after buildStringPiece(), the trie object returned + * by build() will become the owner of the underlying string for the + * previously returned StringPiece. + * After clear() has been called, a new array will be used as well. + * @param buildOption Build option, see UStringTrieBuildOption. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return A StringPiece which refers to the byte-serialized BytesTrie for the add()ed data. + * @stable ICU 4.8 + */ + StringPiece buildStringPiece(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + /** + * Removes all (byte sequence, value) pairs. + * New data can then be add()ed and a new trie can be built. + * @return *this + * @stable ICU 4.8 + */ + BytesTrieBuilder &clear(); + +private: + friend class ::BytesTrieTest; + + BytesTrieBuilder(const BytesTrieBuilder &other); // no copy constructor + BytesTrieBuilder &operator=(const BytesTrieBuilder &other); // no assignment operator + + void buildBytes(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + virtual int32_t getElementStringLength(int32_t i) const; + virtual char16_t getElementUnit(int32_t i, int32_t byteIndex) const; + virtual int32_t getElementValue(int32_t i) const; + + virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t byteIndex) const; + + virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t byteIndex) const; + virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t count) const; + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const; + + virtual UBool matchNodesCanHaveValues() const { return false; } + + virtual int32_t getMaxBranchLinearSubNodeLength() const { return BytesTrie::kMaxBranchLinearSubNodeLength; } + virtual int32_t getMinLinearMatch() const { return BytesTrie::kMinLinearMatch; } + virtual int32_t getMaxLinearMatchLength() const { return BytesTrie::kMaxLinearMatchLength; } + + /** + * @internal (private) + */ + class BTLinearMatchNode : public LinearMatchNode { + public: + BTLinearMatchNode(const char *units, int32_t len, Node *nextNode); + virtual UBool operator==(const Node &other) const; + virtual void write(StringTrieBuilder &builder); + private: + const char *s; + }; + + virtual Node *createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t length, + Node *nextNode) const; + + UBool ensureCapacity(int32_t length); + virtual int32_t write(int32_t byte); + int32_t write(const char *b, int32_t length); + virtual int32_t writeElementUnits(int32_t i, int32_t byteIndex, int32_t length); + virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal); + virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node); + virtual int32_t writeDeltaTo(int32_t jumpTarget); + static int32_t internalEncodeDelta(int32_t i, char intBytes[]); + + CharString *strings; // Pointer not object so we need not #include internal charstr.h. + BytesTrieElement *elements; + int32_t elementsCapacity; + int32_t elementsLength; + + // Byte serialization of the trie. + // Grows from the back: bytesLength measures from the end of the buffer! + char *bytes; + int32_t bytesCapacity; + int32_t bytesLength; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __BYTESTRIEBUILDER_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/caniter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/caniter.h new file mode 100644 index 0000000000000000000000000000000000000000..4ed2b74b1014c794d6f11ffc8fa84d37fd1fdb60 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/caniter.h @@ -0,0 +1,214 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 1996-2014, International Business Machines Corporation and + * others. All Rights Reserved. + ******************************************************************************* + */ + +#ifndef CANITER_H +#define CANITER_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/uobject.h" +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: Canonical Iterator + */ + +/** Should permutation skip characters with combining class zero + * Should be either true or false. This is a compile time option + * @stable ICU 2.4 + */ +#ifndef CANITER_SKIP_ZEROES +#define CANITER_SKIP_ZEROES true +#endif + +U_NAMESPACE_BEGIN + +class Hashtable; +class Normalizer2; +class Normalizer2Impl; + +/** + * This class allows one to iterate through all the strings that are canonically equivalent to a given + * string. For example, here are some sample results: +Results for: {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} +1: \\u0041\\u030A\\u0064\\u0307\\u0327 + = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} +2: \\u0041\\u030A\\u0064\\u0327\\u0307 + = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} +3: \\u0041\\u030A\\u1E0B\\u0327 + = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} +4: \\u0041\\u030A\\u1E11\\u0307 + = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} +5: \\u00C5\\u0064\\u0307\\u0327 + = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} +6: \\u00C5\\u0064\\u0327\\u0307 + = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} +7: \\u00C5\\u1E0B\\u0327 + = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} +8: \\u00C5\\u1E11\\u0307 + = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} +9: \\u212B\\u0064\\u0307\\u0327 + = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} +10: \\u212B\\u0064\\u0327\\u0307 + = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} +11: \\u212B\\u1E0B\\u0327 + = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} +12: \\u212B\\u1E11\\u0307 + = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} + *
Note: the code is intended for use with small strings, and is not suitable for larger ones, + * since it has not been optimized for that situation. + * Note, CanonicalIterator is not intended to be subclassed. + * @author M. Davis + * @author C++ port by V. Weinstein + * @stable ICU 2.4 + */ +class U_COMMON_API CanonicalIterator U_FINAL : public UObject { +public: + /** + * Construct a CanonicalIterator object + * @param source string to get results for + * @param status Fill-in parameter which receives the status of this operation. + * @stable ICU 2.4 + */ + CanonicalIterator(const UnicodeString &source, UErrorCode &status); + + /** Destructor + * Cleans pieces + * @stable ICU 2.4 + */ + virtual ~CanonicalIterator(); + + /** + * Gets the NFD form of the current source we are iterating over. + * @return gets the source: NOTE: it is the NFD form of source + * @stable ICU 2.4 + */ + UnicodeString getSource(); + + /** + * Resets the iterator so that one can start again from the beginning. + * @stable ICU 2.4 + */ + void reset(); + + /** + * Get the next canonically equivalent string. + *
Warning: The strings are not guaranteed to be in any particular order. + * @return the next string that is canonically equivalent. A bogus string is returned when + * the iteration is done. + * @stable ICU 2.4 + */ + UnicodeString next(); + + /** + * Set a new source for this iterator. Allows object reuse. + * @param newSource the source string to iterate against. This allows the same iterator to be used + * while changing the source string, saving object creation. + * @param status Fill-in parameter which receives the status of this operation. + * @stable ICU 2.4 + */ + void setSource(const UnicodeString &newSource, UErrorCode &status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Dumb recursive implementation of permutation. + * TODO: optimize + * @param source the string to find permutations for + * @param skipZeros determine if skip zeros + * @param result the results in a set. + * @param status Fill-in parameter which receives the status of this operation. + * @internal + */ + static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + +private: + // ===================== PRIVATES ============================== + // private default constructor + CanonicalIterator(); + + + /** + * Copy constructor. Private for now. + * @internal (private) + */ + CanonicalIterator(const CanonicalIterator& other); + + /** + * Assignment operator. Private for now. + * @internal (private) + */ + CanonicalIterator& operator=(const CanonicalIterator& other); + + // fields + UnicodeString source; + UBool done; + + // 2 dimensional array holds the pieces of the string with + // their different canonically equivalent representations + UnicodeString **pieces; + int32_t pieces_length; + int32_t *pieces_lengths; + + // current is used in iterating to combine pieces + int32_t *current; + int32_t current_length; + + // transient fields + UnicodeString buffer; + + const Normalizer2 &nfd; + const Normalizer2Impl &nfcImpl; + + // we have a segment, in NFD. Find all the strings that are canonically equivalent to it. + UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment) + + //Set getEquivalents2(String segment); + Hashtable *getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status); + //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status); + + /** + * See if the decomposition of cp2 is at segment starting at segmentPos + * (with canonical rearrangment!) + * If so, take the remainder, and return the equivalents + */ + //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer); + Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); + //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); + + void cleanPieces(); + +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_NORMALIZATION */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/casemap.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/casemap.h new file mode 100644 index 0000000000000000000000000000000000000000..53af84fa74d65f2d095edb3e8c314b667f219e52 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/casemap.h @@ -0,0 +1,497 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// casemap.h +// created: 2017jan12 Markus W. Scherer + +#ifndef __CASEMAP_H__ +#define __CASEMAP_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Low-level C++ case mapping functions. + */ + +U_NAMESPACE_BEGIN + +class BreakIterator; +class ByteSink; +class Edits; + +/** + * Low-level C++ case mapping functions. + * + * @stable ICU 59 + */ +class U_COMMON_API CaseMap U_FINAL : public UMemory { +public: + /** + * Lowercases a UTF-16 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strToLower + * @stable ICU 59 + */ + static int32_t toLower( + const char *locale, uint32_t options, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + + /** + * Uppercases a UTF-16 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strToUpper + * @stable ICU 59 + */ + static int32_t toUpper( + const char *locale, uint32_t options, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecases a UTF-16 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options bits.) + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param iter A break iterator to find the first characters of words that are to be titlecased. + * It is set to the source string (setText()) + * and used one or more times for iteration (first() and next()). + * If NULL, then a word break iterator for the locale is used + * (or something equivalent). + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strToTitle + * @see ucasemap_toTitle + * @stable ICU 59 + */ + static int32_t toTitle( + const char *locale, uint32_t options, BreakIterator *iter, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + + /** + * Case-folds a UTF-16 string and optionally records edits. + * + * Case folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strFoldCase + * @stable ICU 59 + */ + static int32_t fold( + uint32_t options, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + + /** + * Lowercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8ToLower + * @stable ICU 60 + */ + static void utf8ToLower( + const char *locale, uint32_t options, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + + /** + * Uppercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8ToUpper + * @stable ICU 60 + */ + static void utf8ToUpper( + const char *locale, uint32_t options, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options bits.) + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param iter A break iterator to find the first characters of words that are to be titlecased. + * It is set to the source string (setUText()) + * and used one or more times for iteration (first() and next()). + * If NULL, then a word break iterator for the locale is used + * (or something equivalent). + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8ToTitle + * @stable ICU 60 + */ + static void utf8ToTitle( + const char *locale, uint32_t options, BreakIterator *iter, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + + /** + * Case-folds a UTF-8 string and optionally records edits. + * + * Case folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8FoldCase + * @stable ICU 60 + */ + static void utf8Fold( + uint32_t options, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + + /** + * Lowercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8ToLower + * @stable ICU 59 + */ + static int32_t utf8ToLower( + const char *locale, uint32_t options, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + + /** + * Uppercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8ToUpper + * @stable ICU 59 + */ + static int32_t utf8ToUpper( + const char *locale, uint32_t options, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options bits.) + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param iter A break iterator to find the first characters of words that are to be titlecased. + * It is set to the source string (setUText()) + * and used one or more times for iteration (first() and next()). + * If NULL, then a word break iterator for the locale is used + * (or something equivalent). + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8ToTitle + * @stable ICU 59 + */ + static int32_t utf8ToTitle( + const char *locale, uint32_t options, BreakIterator *iter, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + + /** + * Case-folds a UTF-8 string and optionally records edits. + * + * Case folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8FoldCase + * @stable ICU 59 + */ + static int32_t utf8Fold( + uint32_t options, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +private: + CaseMap() = delete; + CaseMap(const CaseMap &other) = delete; + CaseMap &operator=(const CaseMap &other) = delete; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __CASEMAP_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/char16ptr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/char16ptr.h new file mode 100644 index 0000000000000000000000000000000000000000..c8a9ae6c35d646f7173d4fff6d5068914ce9408c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/char16ptr.h @@ -0,0 +1,313 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// char16ptr.h +// created: 2017feb28 Markus W. Scherer + +#ifndef __CHAR16PTR_H__ +#define __CHAR16PTR_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include + +/** + * \file + * \brief C++ API: char16_t pointer wrappers with + * implicit conversion from bit-compatible raw pointer types. + * Also conversion functions from char16_t * to UChar * and OldUChar *. + */ + +U_NAMESPACE_BEGIN + +/** + * \def U_ALIASING_BARRIER + * Barrier for pointer anti-aliasing optimizations even across function boundaries. + * @internal + */ +#ifdef U_ALIASING_BARRIER + // Use the predefined value. +#elif (defined(__clang__) || defined(__GNUC__)) && U_PLATFORM != U_PF_BROWSER_NATIVE_CLIENT +# define U_ALIASING_BARRIER(ptr) asm volatile("" : : "rm"(ptr) : "memory") +#elif defined(U_IN_DOXYGEN) +# define U_ALIASING_BARRIER(ptr) +#endif + +/** + * char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. + * @stable ICU 59 + */ +class U_COMMON_API Char16Ptr U_FINAL { +public: + /** + * Copies the pointer. + * @param p pointer + * @stable ICU 59 + */ + inline Char16Ptr(char16_t *p); +#if !U_CHAR16_IS_TYPEDEF + /** + * Converts the pointer to char16_t *. + * @param p pointer to be converted + * @stable ICU 59 + */ + inline Char16Ptr(uint16_t *p); +#endif +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * Converts the pointer to char16_t *. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * @param p pointer to be converted + * @stable ICU 59 + */ + inline Char16Ptr(wchar_t *p); +#endif + /** + * nullptr constructor. + * @param p nullptr + * @stable ICU 59 + */ + inline Char16Ptr(std::nullptr_t p); + /** + * Destructor. + * @stable ICU 59 + */ + inline ~Char16Ptr(); + + /** + * Pointer access. + * @return the wrapped pointer + * @stable ICU 59 + */ + inline char16_t *get() const; + /** + * char16_t pointer access via type conversion (e.g., static_cast). + * @return the wrapped pointer + * @stable ICU 59 + */ + inline operator char16_t *() const { return get(); } + +private: + Char16Ptr() = delete; + +#ifdef U_ALIASING_BARRIER + template static char16_t *cast(T *t) { + U_ALIASING_BARRIER(t); + return reinterpret_cast(t); + } + + char16_t *p_; +#else + union { + char16_t *cp; + uint16_t *up; + wchar_t *wp; + } u_; +#endif +}; + +/// \cond +#ifdef U_ALIASING_BARRIER + +Char16Ptr::Char16Ptr(char16_t *p) : p_(p) {} +#if !U_CHAR16_IS_TYPEDEF +Char16Ptr::Char16Ptr(uint16_t *p) : p_(cast(p)) {} +#endif +#if U_SIZEOF_WCHAR_T==2 +Char16Ptr::Char16Ptr(wchar_t *p) : p_(cast(p)) {} +#endif +Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {} +Char16Ptr::~Char16Ptr() { + U_ALIASING_BARRIER(p_); +} + +char16_t *Char16Ptr::get() const { return p_; } + +#else + +Char16Ptr::Char16Ptr(char16_t *p) { u_.cp = p; } +#if !U_CHAR16_IS_TYPEDEF +Char16Ptr::Char16Ptr(uint16_t *p) { u_.up = p; } +#endif +#if U_SIZEOF_WCHAR_T==2 +Char16Ptr::Char16Ptr(wchar_t *p) { u_.wp = p; } +#endif +Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; } +Char16Ptr::~Char16Ptr() {} + +char16_t *Char16Ptr::get() const { return u_.cp; } + +#endif +/// \endcond + +/** + * const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. + * @stable ICU 59 + */ +class U_COMMON_API ConstChar16Ptr U_FINAL { +public: + /** + * Copies the pointer. + * @param p pointer + * @stable ICU 59 + */ + inline ConstChar16Ptr(const char16_t *p); +#if !U_CHAR16_IS_TYPEDEF + /** + * Converts the pointer to char16_t *. + * @param p pointer to be converted + * @stable ICU 59 + */ + inline ConstChar16Ptr(const uint16_t *p); +#endif +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * Converts the pointer to char16_t *. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * @param p pointer to be converted + * @stable ICU 59 + */ + inline ConstChar16Ptr(const wchar_t *p); +#endif + /** + * nullptr constructor. + * @param p nullptr + * @stable ICU 59 + */ + inline ConstChar16Ptr(const std::nullptr_t p); + + /** + * Destructor. + * @stable ICU 59 + */ + inline ~ConstChar16Ptr(); + + /** + * Pointer access. + * @return the wrapped pointer + * @stable ICU 59 + */ + inline const char16_t *get() const; + /** + * char16_t pointer access via type conversion (e.g., static_cast). + * @return the wrapped pointer + * @stable ICU 59 + */ + inline operator const char16_t *() const { return get(); } + +private: + ConstChar16Ptr() = delete; + +#ifdef U_ALIASING_BARRIER + template static const char16_t *cast(const T *t) { + U_ALIASING_BARRIER(t); + return reinterpret_cast(t); + } + + const char16_t *p_; +#else + union { + const char16_t *cp; + const uint16_t *up; + const wchar_t *wp; + } u_; +#endif +}; + +/// \cond +#ifdef U_ALIASING_BARRIER + +ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) : p_(p) {} +#if !U_CHAR16_IS_TYPEDEF +ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) : p_(cast(p)) {} +#endif +#if U_SIZEOF_WCHAR_T==2 +ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p_(cast(p)) {} +#endif +ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p_(p) {} +ConstChar16Ptr::~ConstChar16Ptr() { + U_ALIASING_BARRIER(p_); +} + +const char16_t *ConstChar16Ptr::get() const { return p_; } + +#else + +ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) { u_.cp = p; } +#if !U_CHAR16_IS_TYPEDEF +ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) { u_.up = p; } +#endif +#if U_SIZEOF_WCHAR_T==2 +ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u_.wp = p; } +#endif +ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u_.cp = p; } +ConstChar16Ptr::~ConstChar16Ptr() {} + +const char16_t *ConstChar16Ptr::get() const { return u_.cp; } + +#endif +/// \endcond + +/** + * Converts from const char16_t * to const UChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as const UChar * + * @stable ICU 59 + */ +inline const UChar *toUCharPtr(const char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast(p); +} + +/** + * Converts from char16_t * to UChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as UChar * + * @stable ICU 59 + */ +inline UChar *toUCharPtr(char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast(p); +} + +/** + * Converts from const char16_t * to const OldUChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as const OldUChar * + * @stable ICU 59 + */ +inline const OldUChar *toOldUCharPtr(const char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast(p); +} + +/** + * Converts from char16_t * to OldUChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as OldUChar * + * @stable ICU 59 + */ +inline OldUChar *toOldUCharPtr(char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast(p); +} + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __CHAR16PTR_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/chariter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/chariter.h new file mode 100644 index 0000000000000000000000000000000000000000..96dc5db7c9ecbbc2f2510181860b3d30071141ab --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/chariter.h @@ -0,0 +1,734 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************** +* +* Copyright (C) 1997-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************** +*/ + +#ifndef CHARITER_H +#define CHARITER_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +/** + * \file + * \brief C++ API: Character Iterator + */ + +U_NAMESPACE_BEGIN +/** + * Abstract class that defines an API for forward-only iteration + * on text objects. + * This is a minimal interface for iteration without random access + * or backwards iteration. It is especially useful for wrapping + * streams with converters into an object for collation or + * normalization. + * + *

Characters can be accessed in two ways: as code units or as + * code points. + * Unicode code points are 21-bit integers and are the scalar values + * of Unicode characters. ICU uses the type UChar32 for them. + * Unicode code units are the storage units of a given + * Unicode/UCS Transformation Format (a character encoding scheme). + * With UTF-16, all code points can be represented with either one + * or two code units ("surrogates"). + * String storage is typically based on code units, while properties + * of characters are typically determined using code point values. + * Some processes may be designed to work with sequences of code units, + * or it may be known that all characters that are important to an + * algorithm can be represented with single code units. + * Other processes will need to use the code point access functions.

+ * + *

ForwardCharacterIterator provides nextPostInc() to access + * a code unit and advance an internal position into the text object, + * similar to a return text[position++].
+ * It provides next32PostInc() to access a code point and advance an internal + * position.

+ * + *

next32PostInc() assumes that the current position is that of + * the beginning of a code point, i.e., of its first code unit. + * After next32PostInc(), this will be true again. + * In general, access to code units and code points in the same + * iteration loop should not be mixed. In UTF-16, if the current position + * is on a second code unit (Low Surrogate), then only that code unit + * is returned even by next32PostInc().

+ * + *

For iteration with either function, there are two ways to + * check for the end of the iteration. When there are no more + * characters in the text object: + *

    + *
  • The hasNext() function returns false.
  • + *
  • nextPostInc() and next32PostInc() return DONE + * when one attempts to read beyond the end of the text object.
  • + *
+ * + * Example: + * \code + * void function1(ForwardCharacterIterator &it) { + * UChar32 c; + * while(it.hasNext()) { + * c=it.next32PostInc(); + * // use c + * } + * } + * + * void function1(ForwardCharacterIterator &it) { + * char16_t c; + * while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) { + * // use c + * } + * } + * \endcode + *

+ * + * @stable ICU 2.0 + */ +class U_COMMON_API ForwardCharacterIterator : public UObject { +public: + /** + * Value returned by most of ForwardCharacterIterator's functions + * when the iterator has reached the limits of its iteration. + * @stable ICU 2.0 + */ + enum { DONE = 0xffff }; + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~ForwardCharacterIterator(); + + /** + * Returns true when both iterators refer to the same + * character in the same character-storage object. + * @param that The ForwardCharacterIterator to be compared for equality + * @return true when both iterators refer to the same + * character in the same character-storage object + * @stable ICU 2.0 + */ + virtual UBool operator==(const ForwardCharacterIterator& that) const = 0; + + /** + * Returns true when the iterators refer to different + * text-storage objects, or to different characters in the + * same text-storage object. + * @param that The ForwardCharacterIterator to be compared for inequality + * @return true when the iterators refer to different + * text-storage objects, or to different characters in the + * same text-storage object + * @stable ICU 2.0 + */ + inline UBool operator!=(const ForwardCharacterIterator& that) const; + + /** + * Generates a hash code for this iterator. + * @return the hash code. + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const = 0; + + /** + * Returns a UClassID for this ForwardCharacterIterator ("poor man's + * RTTI").

Despite the fact that this function is public, + * DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API! + * @return a UClassID for this ForwardCharacterIterator + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const = 0; + + /** + * Gets the current code unit for returning and advances to the next code unit + * in the iteration range + * (toward endIndex()). If there are + * no more code units to return, returns DONE. + * @return the current code unit. + * @stable ICU 2.0 + */ + virtual char16_t nextPostInc(void) = 0; + + /** + * Gets the current code point for returning and advances to the next code point + * in the iteration range + * (toward endIndex()). If there are + * no more code points to return, returns DONE. + * @return the current code point. + * @stable ICU 2.0 + */ + virtual UChar32 next32PostInc(void) = 0; + + /** + * Returns false if there are no more code units or code points + * at or after the current position in the iteration range. + * This is used with nextPostInc() or next32PostInc() in forward + * iteration. + * @returns false if there are no more code units or code points + * at or after the current position in the iteration range. + * @stable ICU 2.0 + */ + virtual UBool hasNext() = 0; + +protected: + /** Default constructor to be overridden in the implementing class. @stable ICU 2.0*/ + ForwardCharacterIterator(); + + /** Copy constructor to be overridden in the implementing class. @stable ICU 2.0*/ + ForwardCharacterIterator(const ForwardCharacterIterator &other); + + /** + * Assignment operator to be overridden in the implementing class. + * @stable ICU 2.0 + */ + ForwardCharacterIterator &operator=(const ForwardCharacterIterator&) { return *this; } +}; + +/** + * Abstract class that defines an API for iteration + * on text objects. + * This is an interface for forward and backward iteration + * and random access into a text object. + * + *

The API provides backward compatibility to the Java and older ICU + * CharacterIterator classes but extends them significantly: + *

    + *
  1. CharacterIterator is now a subclass of ForwardCharacterIterator.
  2. + *
  3. While the old API functions provided forward iteration with + * "pre-increment" semantics, the new one also provides functions + * with "post-increment" semantics. They are more efficient and should + * be the preferred iterator functions for new implementations. + * The backward iteration always had "pre-decrement" semantics, which + * are efficient.
  4. + *
  5. Just like ForwardCharacterIterator, it provides access to + * both code units and code points. Code point access versions are available + * for the old and the new iteration semantics.
  6. + *
  7. There are new functions for setting and moving the current position + * without returning a character, for efficiency.
  8. + *
+ * + * See ForwardCharacterIterator for examples for using the new forward iteration + * functions. For backward iteration, there is also a hasPrevious() function + * that can be used analogously to hasNext(). + * The old functions work as before and are shown below.

+ * + *

Examples for some of the new functions:

+ * + * Forward iteration with hasNext(): + * \code + * void forward1(CharacterIterator &it) { + * UChar32 c; + * for(it.setToStart(); it.hasNext();) { + * c=it.next32PostInc(); + * // use c + * } + * } + * \endcode + * Forward iteration more similar to loops with the old forward iteration, + * showing a way to convert simple for() loops: + * \code + * void forward2(CharacterIterator &it) { + * char16_t c; + * for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) { + * // use c + * } + * } + * \endcode + * Backward iteration with setToEnd() and hasPrevious(): + * \code + * void backward1(CharacterIterator &it) { + * UChar32 c; + * for(it.setToEnd(); it.hasPrevious();) { + * c=it.previous32(); + * // use c + * } + * } + * \endcode + * Backward iteration with a more traditional for() loop: + * \code + * void backward2(CharacterIterator &it) { + * char16_t c; + * for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) { + * // use c + * } + * } + * \endcode + * + * Example for random access: + * \code + * void random(CharacterIterator &it) { + * // set to the third code point from the beginning + * it.move32(3, CharacterIterator::kStart); + * // get a code point from here without moving the position + * UChar32 c=it.current32(); + * // get the position + * int32_t pos=it.getIndex(); + * // get the previous code unit + * char16_t u=it.previous(); + * // move back one more code unit + * it.move(-1, CharacterIterator::kCurrent); + * // set the position back to where it was + * // and read the same code point c and move beyond it + * it.setIndex(pos); + * if(c!=it.next32PostInc()) { + * exit(1); // CharacterIterator inconsistent + * } + * } + * \endcode + * + *

Examples, especially for the old API:

+ * + * Function processing characters, in this example simple output + *
+ * \code
+ *  void processChar( char16_t c )
+ *  {
+ *      cout << " " << c;
+ *  }
+ * \endcode
+ * 
+ * Traverse the text from start to finish + *
 
+ * \code
+ *  void traverseForward(CharacterIterator& iter)
+ *  {
+ *      for(char16_t c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
+ *          processChar(c);
+ *      }
+ *  }
+ * \endcode
+ * 
+ * Traverse the text backwards, from end to start + *
+ * \code
+ *  void traverseBackward(CharacterIterator& iter)
+ *  {
+ *      for(char16_t c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
+ *          processChar(c);
+ *      }
+ *  }
+ * \endcode
+ * 
+ * Traverse both forward and backward from a given position in the text. + * Calls to notBoundary() in this example represents some additional stopping criteria. + *
+ * \code
+ * void traverseOut(CharacterIterator& iter, int32_t pos)
+ * {
+ *      char16_t c;
+ *      for (c = iter.setIndex(pos);
+ *      c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
+ *          c = iter.next()) {}
+ *      int32_t end = iter.getIndex();
+ *      for (c = iter.setIndex(pos);
+ *          c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
+ *          c = iter.previous()) {}
+ *      int32_t start = iter.getIndex() + 1;
+ *  
+ *      cout << "start: " << start << " end: " << end << endl;
+ *      for (c = iter.setIndex(start); iter.getIndex() < end; c = iter.next() ) {
+ *          processChar(c);
+ *     }
+ *  }
+ * \endcode
+ * 
+ * Creating a StringCharacterIterator and calling the test functions + *
+ * \code
+ *  void CharacterIterator_Example( void )
+ *   {
+ *       cout << endl << "===== CharacterIterator_Example: =====" << endl;
+ *       UnicodeString text("Ein kleiner Satz.");
+ *       StringCharacterIterator iterator(text);
+ *       cout << "----- traverseForward: -----------" << endl;
+ *       traverseForward( iterator );
+ *       cout << endl << endl << "----- traverseBackward: ----------" << endl;
+ *       traverseBackward( iterator );
+ *       cout << endl << endl << "----- traverseOut: ---------------" << endl;
+ *       traverseOut( iterator, 7 );
+ *       cout << endl << endl << "-----" << endl;
+ *   }
+ * \endcode
+ * 
+ * + * @stable ICU 2.0 + */ +class U_COMMON_API CharacterIterator : public ForwardCharacterIterator { +public: + /** + * Origin enumeration for the move() and move32() functions. + * @stable ICU 2.0 + */ + enum EOrigin { kStart, kCurrent, kEnd }; + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~CharacterIterator(); + + /** + * Returns a pointer to a new CharacterIterator of the same + * concrete class as this one, and referring to the same + * character in the same text-storage object as this one. The + * caller is responsible for deleting the new clone. + * @return a pointer to a new CharacterIterator + * @stable ICU 2.0 + */ + virtual CharacterIterator* clone() const = 0; + + /** + * Sets the iterator to refer to the first code unit in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with next(). + * @return the first code unit in its iteration range. + * @stable ICU 2.0 + */ + virtual char16_t first(void) = 0; + + /** + * Sets the iterator to refer to the first code unit in its + * iteration range, returns that code unit, and moves the position + * to the second code unit. This is an alternative to setToStart() + * for forward iteration with nextPostInc(). + * @return the first code unit in its iteration range. + * @stable ICU 2.0 + */ + virtual char16_t firstPostInc(void); + + /** + * Sets the iterator to refer to the first code point in its + * iteration range, and returns that code unit, + * This can be used to begin an iteration with next32(). + * Note that an iteration with next32PostInc(), beginning with, + * e.g., setToStart() or firstPostInc(), is more efficient. + * @return the first code point in its iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 first32(void) = 0; + + /** + * Sets the iterator to refer to the first code point in its + * iteration range, returns that code point, and moves the position + * to the second code point. This is an alternative to setToStart() + * for forward iteration with next32PostInc(). + * @return the first code point in its iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 first32PostInc(void); + + /** + * Sets the iterator to refer to the first code unit or code point in its + * iteration range. This can be used to begin a forward + * iteration with nextPostInc() or next32PostInc(). + * @return the start position of the iteration range + * @stable ICU 2.0 + */ + inline int32_t setToStart(); + + /** + * Sets the iterator to refer to the last code unit in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with previous(). + * @return the last code unit. + * @stable ICU 2.0 + */ + virtual char16_t last(void) = 0; + + /** + * Sets the iterator to refer to the last code point in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with previous32(). + * @return the last code point. + * @stable ICU 2.0 + */ + virtual UChar32 last32(void) = 0; + + /** + * Sets the iterator to the end of its iteration range, just behind + * the last code unit or code point. This can be used to begin a backward + * iteration with previous() or previous32(). + * @return the end position of the iteration range + * @stable ICU 2.0 + */ + inline int32_t setToEnd(); + + /** + * Sets the iterator to refer to the "position"-th code unit + * in the text-storage object the iterator refers to, and + * returns that code unit. + * @param position the "position"-th code unit in the text-storage object + * @return the "position"-th code unit. + * @stable ICU 2.0 + */ + virtual char16_t setIndex(int32_t position) = 0; + + /** + * Sets the iterator to refer to the beginning of the code point + * that contains the "position"-th code unit + * in the text-storage object the iterator refers to, and + * returns that code point. + * The current position is adjusted to the beginning of the code point + * (its first code unit). + * @param position the "position"-th code unit in the text-storage object + * @return the "position"-th code point. + * @stable ICU 2.0 + */ + virtual UChar32 setIndex32(int32_t position) = 0; + + /** + * Returns the code unit the iterator currently refers to. + * @return the current code unit. + * @stable ICU 2.0 + */ + virtual char16_t current(void) const = 0; + + /** + * Returns the code point the iterator currently refers to. + * @return the current code point. + * @stable ICU 2.0 + */ + virtual UChar32 current32(void) const = 0; + + /** + * Advances to the next code unit in the iteration range + * (toward endIndex()), and returns that code unit. If there are + * no more code units to return, returns DONE. + * @return the next code unit. + * @stable ICU 2.0 + */ + virtual char16_t next(void) = 0; + + /** + * Advances to the next code point in the iteration range + * (toward endIndex()), and returns that code point. If there are + * no more code points to return, returns DONE. + * Note that iteration with "pre-increment" semantics is less + * efficient than iteration with "post-increment" semantics + * that is provided by next32PostInc(). + * @return the next code point. + * @stable ICU 2.0 + */ + virtual UChar32 next32(void) = 0; + + /** + * Advances to the previous code unit in the iteration range + * (toward startIndex()), and returns that code unit. If there are + * no more code units to return, returns DONE. + * @return the previous code unit. + * @stable ICU 2.0 + */ + virtual char16_t previous(void) = 0; + + /** + * Advances to the previous code point in the iteration range + * (toward startIndex()), and returns that code point. If there are + * no more code points to return, returns DONE. + * @return the previous code point. + * @stable ICU 2.0 + */ + virtual UChar32 previous32(void) = 0; + + /** + * Returns false if there are no more code units or code points + * before the current position in the iteration range. + * This is used with previous() or previous32() in backward + * iteration. + * @return false if there are no more code units or code points + * before the current position in the iteration range, return true otherwise. + * @stable ICU 2.0 + */ + virtual UBool hasPrevious() = 0; + + /** + * Returns the numeric index in the underlying text-storage + * object of the character returned by first(). Since it's + * possible to create an iterator that iterates across only + * part of a text-storage object, this number isn't + * necessarily 0. + * @returns the numeric index in the underlying text-storage + * object of the character returned by first(). + * @stable ICU 2.0 + */ + inline int32_t startIndex(void) const; + + /** + * Returns the numeric index in the underlying text-storage + * object of the position immediately BEYOND the character + * returned by last(). + * @return the numeric index in the underlying text-storage + * object of the position immediately BEYOND the character + * returned by last(). + * @stable ICU 2.0 + */ + inline int32_t endIndex(void) const; + + /** + * Returns the numeric index in the underlying text-storage + * object of the character the iterator currently refers to + * (i.e., the character returned by current()). + * @return the numeric index in the text-storage object of + * the character the iterator currently refers to + * @stable ICU 2.0 + */ + inline int32_t getIndex(void) const; + + /** + * Returns the length of the entire text in the underlying + * text-storage object. + * @return the length of the entire text in the text-storage object + * @stable ICU 2.0 + */ + inline int32_t getLength() const; + + /** + * Moves the current position relative to the start or end of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code units forward + * or backward by specifying a positive or negative delta. + * @param delta the position relative to origin. A positive delta means forward; + * a negative delta means backward. + * @param origin Origin enumeration {kStart, kCurrent, kEnd} + * @return the new position + * @stable ICU 2.0 + */ + virtual int32_t move(int32_t delta, EOrigin origin) = 0; + + /** + * Moves the current position relative to the start or end of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code points forward + * or backward by specifying a positive or negative delta. + * @param delta the position relative to origin. A positive delta means forward; + * a negative delta means backward. + * @param origin Origin enumeration {kStart, kCurrent, kEnd} + * @return the new position + * @stable ICU 2.0 + */ +#ifdef move32 + // One of the system headers right now is sometimes defining a conflicting macro we don't use +#undef move32 +#endif + virtual int32_t move32(int32_t delta, EOrigin origin) = 0; + + /** + * Copies the text under iteration into the UnicodeString + * referred to by "result". + * @param result Receives a copy of the text under iteration. + * @stable ICU 2.0 + */ + virtual void getText(UnicodeString& result) = 0; + +protected: + /** + * Empty constructor. + * @stable ICU 2.0 + */ + CharacterIterator(); + + /** + * Constructor, just setting the length field in this base class. + * @stable ICU 2.0 + */ + CharacterIterator(int32_t length); + + /** + * Constructor, just setting the length and position fields in this base class. + * @stable ICU 2.0 + */ + CharacterIterator(int32_t length, int32_t position); + + /** + * Constructor, just setting the length, start, end, and position fields in this base class. + * @stable ICU 2.0 + */ + CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position); + + /** + * Copy constructor. + * + * @param that The CharacterIterator to be copied + * @stable ICU 2.0 + */ + CharacterIterator(const CharacterIterator &that); + + /** + * Assignment operator. Sets this CharacterIterator to have the same behavior, + * as the one passed in. + * @param that The CharacterIterator passed in. + * @return the newly set CharacterIterator. + * @stable ICU 2.0 + */ + CharacterIterator &operator=(const CharacterIterator &that); + + /** + * Base class text length field. + * Necessary this for correct getText() and hashCode(). + * @stable ICU 2.0 + */ + int32_t textLength; + + /** + * Base class field for the current position. + * @stable ICU 2.0 + */ + int32_t pos; + + /** + * Base class field for the start of the iteration range. + * @stable ICU 2.0 + */ + int32_t begin; + + /** + * Base class field for the end of the iteration range. + * @stable ICU 2.0 + */ + int32_t end; +}; + +inline UBool +ForwardCharacterIterator::operator!=(const ForwardCharacterIterator& that) const { + return !operator==(that); +} + +inline int32_t +CharacterIterator::setToStart() { + return move(0, kStart); +} + +inline int32_t +CharacterIterator::setToEnd() { + return move(0, kEnd); +} + +inline int32_t +CharacterIterator::startIndex(void) const { + return begin; +} + +inline int32_t +CharacterIterator::endIndex(void) const { + return end; +} + +inline int32_t +CharacterIterator::getIndex(void) const { + return pos; +} + +inline int32_t +CharacterIterator::getLength(void) const { + return textLength; +} + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/dbbi.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/dbbi.h new file mode 100644 index 0000000000000000000000000000000000000000..3de9cc381408c51c77f1414ea62f9f180adeda7a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/dbbi.h @@ -0,0 +1,48 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2006,2013 IBM Corp. All rights reserved. +********************************************************************** +* Date Name Description +* 12/1/99 rgillam Complete port from Java. +* 01/13/2000 helena Added UErrorCode to ctors. +********************************************************************** +*/ + +#ifndef DBBI_H +#define DBBI_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/rbbi.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +/** + * \file + * \brief C++ API: Dictionary Based Break Iterator + */ + +U_NAMESPACE_BEGIN + +#ifndef U_HIDE_DEPRECATED_API +/** + * An obsolete subclass of RuleBasedBreakIterator. Handling of dictionary- + * based break iteration has been folded into the base class. This class + * is deprecated as of ICU 3.6. + * @deprecated ICU 3.6 + */ +typedef RuleBasedBreakIterator DictionaryBasedBreakIterator; + +#endif /* U_HIDE_DEPRECATED_API */ + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/docmain.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/docmain.h new file mode 100644 index 0000000000000000000000000000000000000000..e82678c95f512e18fa81a6e5f8d4317a9691b6f8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/docmain.h @@ -0,0 +1,237 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/******************************************************************** + * COPYRIGHT: + * Copyright (c) 1997-2012, International Business Machines Corporation and + * others. All Rights Reserved. + * + * FILE NAME: DOCMAIN.h + * + * Date Name Description + * 12/11/2000 Ram Creation. + */ + +/** + * \file + * \brief (Non API- contains Doxygen definitions) + * + * This file contains documentation for Doxygen and does not have + * any significance with respect to C or C++ API + */ + +/*! \mainpage + * + * \section API API Reference Usage + * + *

C++ Programmers:

+ *

Use Class Hierarchy or Alphabetical List + * or Compound List + * to find the class you are interested in. For example, to find BreakIterator, + * you can go to the Alphabetical List, then click on + * "BreakIterator". Once you are at the class, you will find an inheritance + * chart, a list of the public members, a detailed description of the class, + * then detailed member descriptions.

+ * + *

C Programmers:

+ *

Use Module List or File Members + * to find a list of all the functions and constants. + * For example, to find BreakIterator functions you would click on + * File List, + * then find "ubrk.h" and click on it. You will find descriptions of Defines, + * Typedefs, Enumerations, and Functions, with detailed descriptions below. + * If you want to find a specific function, such as ubrk_next(), then click + * first on File Members, then use your browser + * Find dialog to search for "ubrk_next()".

+ * + * + *

API References for Previous Releases

+ *

The API References for each release of ICU are also available as + * a zip file from the ICU + * download page.

+ * + *
+ * + *

Architecture (User's Guide)

+ * + * + *
+ *\htmlonly

Module List

\endhtmlonly + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Module NameCC++
Basic Types and Constantsutypes.hutypes.h
Strings and Character Iterationustring.h, utf8.h, utf16.h, icu::StringPiece, UText, UCharIterator, icu::ByteSinkicu::UnicodeString, icu::CharacterIterator, icu::Appendable, icu::StringPiece,icu::ByteSink
Unicode Character
Properties and Names
uchar.h, uscript.hC API
Sets of Unicode Code Points and Stringsuset.hicu::UnicodeSet
Maps from Unicode Code Points to Integer Valuesucptrie.h, umutablecptrie.hC API
Maps from Strings to Integer Values(no C API)icu::BytesTrie, icu::UCharsTrie
Codepage Conversionucnv.h, ucnvsel.hC API
Codepage Detectionucsdet.hC API
Unicode Text Compressionucnv.h
(encoding name "SCSU" or "BOCU-1")
C API
Locales uloc.hicu::Locale, icu::LocaleBuilder, icu::LocaleMatcher
Resource Bundlesures.hicu::ResourceBundle
Normalizationunorm2.hicu::Normalizer2
Calendars and Time Zonesucal.hicu::Calendar, icu::TimeZone
Date and Time Formattingudat.hicu::DateFormat
Message Formattingumsg.hicu::MessageFormat
List Formattingulistformatter.hicu::ListFormatter
Number Formatting
(includes currency and unit formatting)
unumberformatter.h, unum.hicu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)
Number Range Formatting
(includes currency and unit ranges)
unumberrangeformatter.hicu::number::NumberRangeFormatter
Number Spellout
(Rule Based Number Formatting)
unum.h
(use UNUM_SPELLOUT)
icu::RuleBasedNumberFormat
Text Transformation
(Transliteration)
utrans.hicu::Transliterator
Bidirectional Algorithmubidi.h, ubiditransform.hC API
Arabic Shapingushape.hC API
Collationucol.hicu::Collator
String Searchingusearch.hicu::StringSearch
Index Characters/
Bucketing for Sorted Lists
(no C API)icu::AlphabeticIndex
Text Boundary Analysis
(Break Iteration)
ubrk.hicu::BreakIterator
Regular Expressionsuregex.hicu::RegexPattern, icu::RegexMatcher
StringPrepusprep.hC API
International Domain Names in Applications:
+ * UTS #46 in C/C++, IDNA2003 only via C API
uidna.hidna.h
Identifier Spoofing & Confusabilityuspoof.hC API
Universal Time Scaleutmscale.hC API
Paragraph Layout / Complex Text Layoutplayout.hicu::ParagraphLayout
ICU I/Oustdio.hustream.h
+ * This main page is generated from docmain.h + */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/dtintrv.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/dtintrv.h new file mode 100644 index 0000000000000000000000000000000000000000..4f4b6bf7f405587d05f56f3441d9b29f7a027ed1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/dtintrv.h @@ -0,0 +1,164 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2008-2009, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +* +* File DTINTRV.H +* +******************************************************************************* +*/ + +#ifndef __DTINTRV_H__ +#define __DTINTRV_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Date Interval data type + */ + +U_NAMESPACE_BEGIN + + +/** + * This class represents a date interval. + * It is a pair of UDate representing from UDate 1 to UDate 2. + * @stable ICU 4.0 +**/ +class U_COMMON_API DateInterval : public UObject { +public: + + /** + * Construct a DateInterval given a from date and a to date. + * @param fromDate The from date in date interval. + * @param toDate The to date in date interval. + * @stable ICU 4.0 + */ + DateInterval(UDate fromDate, UDate toDate); + + /** + * destructor + * @stable ICU 4.0 + */ + virtual ~DateInterval(); + + /** + * Get the from date. + * @return the from date in dateInterval. + * @stable ICU 4.0 + */ + inline UDate getFromDate() const; + + /** + * Get the to date. + * @return the to date in dateInterval. + * @stable ICU 4.0 + */ + inline UDate getToDate() const; + + + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *
+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 4.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 4.0 + */ + virtual UClassID getDynamicClassID(void) const; + + + /** + * Copy constructor. + * @stable ICU 4.0 + */ + DateInterval(const DateInterval& other); + + /** + * Default assignment operator + * @stable ICU 4.0 + */ + DateInterval& operator=(const DateInterval&); + + /** + * Equality operator. + * @return true if the two DateIntervals are the same + * @stable ICU 4.0 + */ + virtual UBool operator==(const DateInterval& other) const; + + /** + * Non-equality operator + * @return true if the two DateIntervals are not the same + * @stable ICU 4.0 + */ + inline UBool operator!=(const DateInterval& other) const; + + + /** + * clone this object. + * The caller owns the result and should delete it when done. + * @return a cloned DateInterval + * @stable ICU 4.0 + */ + virtual DateInterval* clone() const; + +private: + /** + * Default constructor, not implemented. + */ + DateInterval(); + + UDate fromDate; + UDate toDate; + +} ;// end class DateInterval + + +inline UDate +DateInterval::getFromDate() const { + return fromDate; +} + + +inline UDate +DateInterval::getToDate() const { + return toDate; +} + + +inline UBool +DateInterval::operator!=(const DateInterval& other) const { + return ( !operator==(other) ); +} + + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/edits.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/edits.h new file mode 100644 index 0000000000000000000000000000000000000000..bfa07fa6765b730d6143f3d9e0e41ea1d853cb01 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/edits.h @@ -0,0 +1,531 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// edits.h +// created: 2016dec30 Markus W. Scherer + +#ifndef __EDITS_H__ +#define __EDITS_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: C++ class Edits for low-level string transformations on styled text. + */ + +U_NAMESPACE_BEGIN + +class UnicodeString; + +/** + * Records lengths of string edits but not replacement text. Supports replacements, insertions, deletions + * in linear progression. Does not support moving/reordering of text. + * + * There are two types of edits: change edits and no-change edits. Add edits to + * instances of this class using {@link #addReplace(int32_t, int32_t)} (for change edits) and + * {@link #addUnchanged(int32_t)} (for no-change edits). Change edits are retained with full granularity, + * whereas adjacent no-change edits are always merged together. In no-change edits, there is a one-to-one + * mapping between code points in the source and destination strings. + * + * After all edits have been added, instances of this class should be considered immutable, and an + * {@link Edits::Iterator} can be used for queries. + * + * There are four flavors of Edits::Iterator: + * + *
    + *
  • {@link #getFineIterator()} retains full granularity of change edits. + *
  • {@link #getFineChangesIterator()} retains full granularity of change edits, and when calling + * next() on the iterator, skips over no-change edits (unchanged regions). + *
  • {@link #getCoarseIterator()} treats adjacent change edits as a single edit. (Adjacent no-change + * edits are automatically merged during the construction phase.) + *
  • {@link #getCoarseChangesIterator()} treats adjacent change edits as a single edit, and when + * calling next() on the iterator, skips over no-change edits (unchanged regions). + *
+ * + * For example, consider the string "abcßDeF", which case-folds to "abcssdef". This string has the + * following fine edits: + *
    + *
  • abc ⇨ abc (no-change) + *
  • ß ⇨ ss (change) + *
  • D ⇨ d (change) + *
  • e ⇨ e (no-change) + *
  • F ⇨ f (change) + *
+ * and the following coarse edits (note how adjacent change edits get merged together): + *
    + *
  • abc ⇨ abc (no-change) + *
  • ßD ⇨ ssd (change) + *
  • e ⇨ e (no-change) + *
  • F ⇨ f (change) + *
+ * + * The "fine changes" and "coarse changes" iterators will step through only the change edits when their + * `Edits::Iterator::next()` methods are called. They are identical to the non-change iterators when + * their `Edits::Iterator::findSourceIndex()` or `Edits::Iterator::findDestinationIndex()` + * methods are used to walk through the string. + * + * For examples of how to use this class, see the test `TestCaseMapEditsIteratorDocs` in + * UCharacterCaseTest.java. + * + * An Edits object tracks a separate UErrorCode, but ICU string transformation functions + * (e.g., case mapping functions) merge any such errors into their API's UErrorCode. + * + * @stable ICU 59 + */ +class U_COMMON_API Edits U_FINAL : public UMemory { +public: + /** + * Constructs an empty object. + * @stable ICU 59 + */ + Edits() : + array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0), + errorCode_(U_ZERO_ERROR) {} + /** + * Copy constructor. + * @param other source edits + * @stable ICU 60 + */ + Edits(const Edits &other) : + array(stackArray), capacity(STACK_CAPACITY), length(other.length), + delta(other.delta), numChanges(other.numChanges), + errorCode_(other.errorCode_) { + copyArray(other); + } + /** + * Move constructor, might leave src empty. + * This object will have the same contents that the source object had. + * @param src source edits + * @stable ICU 60 + */ + Edits(Edits &&src) U_NOEXCEPT : + array(stackArray), capacity(STACK_CAPACITY), length(src.length), + delta(src.delta), numChanges(src.numChanges), + errorCode_(src.errorCode_) { + moveArray(src); + } + + /** + * Destructor. + * @stable ICU 59 + */ + ~Edits(); + + /** + * Assignment operator. + * @param other source edits + * @return *this + * @stable ICU 60 + */ + Edits &operator=(const Edits &other); + + /** + * Move assignment operator, might leave src empty. + * This object will have the same contents that the source object had. + * The behavior is undefined if *this and src are the same object. + * @param src source edits + * @return *this + * @stable ICU 60 + */ + Edits &operator=(Edits &&src) U_NOEXCEPT; + + /** + * Resets the data but may not release memory. + * @stable ICU 59 + */ + void reset() U_NOEXCEPT; + + /** + * Adds a no-change edit: a record for an unchanged segment of text. + * Normally called from inside ICU string transformation functions, not user code. + * @stable ICU 59 + */ + void addUnchanged(int32_t unchangedLength); + /** + * Adds a change edit: a record for a text replacement/insertion/deletion. + * Normally called from inside ICU string transformation functions, not user code. + * @stable ICU 59 + */ + void addReplace(int32_t oldLength, int32_t newLength); + /** + * Sets the UErrorCode if an error occurred while recording edits. + * Preserves older error codes in the outErrorCode. + * Normally called from inside ICU string transformation functions, not user code. + * @param outErrorCode Set to an error code if it does not contain one already + * and an error occurred while recording edits. + * Otherwise unchanged. + * @return true if U_FAILURE(outErrorCode) + * @stable ICU 59 + */ + UBool copyErrorTo(UErrorCode &outErrorCode) const; + + /** + * How much longer is the new text compared with the old text? + * @return new length minus old length + * @stable ICU 59 + */ + int32_t lengthDelta() const { return delta; } + /** + * @return true if there are any change edits + * @stable ICU 59 + */ + UBool hasChanges() const { return numChanges != 0; } + + /** + * @return the number of change edits + * @stable ICU 60 + */ + int32_t numberOfChanges() const { return numChanges; } + + /** + * Access to the list of edits. + * + * At any moment in time, an instance of this class points to a single edit: a "window" into a span + * of the source string and the corresponding span of the destination string. The source string span + * starts at {@link #sourceIndex()} and runs for {@link #oldLength()} chars; the destination string + * span starts at {@link #destinationIndex()} and runs for {@link #newLength()} chars. + * + * The iterator can be moved between edits using the `next()`, `findSourceIndex(int32_t, UErrorCode &)`, + * and `findDestinationIndex(int32_t, UErrorCode &)` methods. + * Calling any of these methods mutates the iterator to make it point to the corresponding edit. + * + * For more information, see the documentation for {@link Edits}. + * + * @see getCoarseIterator + * @see getFineIterator + * @stable ICU 59 + */ + struct U_COMMON_API Iterator U_FINAL : public UMemory { + /** + * Default constructor, empty iterator. + * @stable ICU 60 + */ + Iterator() : + array(nullptr), index(0), length(0), + remaining(0), onlyChanges_(false), coarse(false), + dir(0), changed(false), oldLength_(0), newLength_(0), + srcIndex(0), replIndex(0), destIndex(0) {} + /** + * Copy constructor. + * @stable ICU 59 + */ + Iterator(const Iterator &other) = default; + /** + * Assignment operator. + * @stable ICU 59 + */ + Iterator &operator=(const Iterator &other) = default; + + /** + * Advances the iterator to the next edit. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return true if there is another edit + * @stable ICU 59 + */ + UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); } + + /** + * Moves the iterator to the edit that contains the source index. + * The source index may be found in a no-change edit + * even if normal iteration would skip no-change edits. + * Normal iteration can continue from a found edit. + * + * The iterator state before this search logically does not matter. + * (It may affect the performance of the search.) + * + * The iterator state after this search is undefined + * if the source index is out of bounds for the source string. + * + * @param i source index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return true if the edit for the source index was found + * @stable ICU 59 + */ + UBool findSourceIndex(int32_t i, UErrorCode &errorCode) { + return findIndex(i, true, errorCode) == 0; + } + + /** + * Moves the iterator to the edit that contains the destination index. + * The destination index may be found in a no-change edit + * even if normal iteration would skip no-change edits. + * Normal iteration can continue from a found edit. + * + * The iterator state before this search logically does not matter. + * (It may affect the performance of the search.) + * + * The iterator state after this search is undefined + * if the source index is out of bounds for the source string. + * + * @param i destination index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return true if the edit for the destination index was found + * @stable ICU 60 + */ + UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) { + return findIndex(i, false, errorCode) == 0; + } + + /** + * Computes the destination index corresponding to the given source index. + * If the source index is inside a change edit (not at its start), + * then the destination index at the end of that edit is returned, + * since there is no information about index mapping inside a change edit. + * + * (This means that indexes to the start and middle of an edit, + * for example around a grapheme cluster, are mapped to indexes + * encompassing the entire edit. + * The alternative, mapping an interior index to the start, + * would map such an interval to an empty one.) + * + * This operation will usually but not always modify this object. + * The iterator state after this search is undefined. + * + * @param i source index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return destination index; undefined if i is not 0..string length + * @stable ICU 60 + */ + int32_t destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode); + + /** + * Computes the source index corresponding to the given destination index. + * If the destination index is inside a change edit (not at its start), + * then the source index at the end of that edit is returned, + * since there is no information about index mapping inside a change edit. + * + * (This means that indexes to the start and middle of an edit, + * for example around a grapheme cluster, are mapped to indexes + * encompassing the entire edit. + * The alternative, mapping an interior index to the start, + * would map such an interval to an empty one.) + * + * This operation will usually but not always modify this object. + * The iterator state after this search is undefined. + * + * @param i destination index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return source index; undefined if i is not 0..string length + * @stable ICU 60 + */ + int32_t sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode); + + /** + * Returns whether the edit currently represented by the iterator is a change edit. + * + * @return true if this edit replaces oldLength() units with newLength() different ones. + * false if oldLength units remain unchanged. + * @stable ICU 59 + */ + UBool hasChange() const { return changed; } + + /** + * The length of the current span in the source string, which starts at {@link #sourceIndex}. + * + * @return the number of units in the original string which are replaced or remain unchanged. + * @stable ICU 59 + */ + int32_t oldLength() const { return oldLength_; } + + /** + * The length of the current span in the destination string, which starts at + * {@link #destinationIndex}, or in the replacement string, which starts at + * {@link #replacementIndex}. + * + * @return the number of units in the modified string, if hasChange() is true. + * Same as oldLength if hasChange() is false. + * @stable ICU 59 + */ + int32_t newLength() const { return newLength_; } + + /** + * The start index of the current span in the source string; the span has length + * {@link #oldLength}. + * + * @return the current index into the source string + * @stable ICU 59 + */ + int32_t sourceIndex() const { return srcIndex; } + + /** + * The start index of the current span in the replacement string; the span has length + * {@link #newLength}. Well-defined only if the current edit is a change edit. + * + * The *replacement string* is the concatenation of all substrings of the destination + * string corresponding to change edits. + * + * This method is intended to be used together with operations that write only replacement + * characters (e.g. operations specifying the \ref U_OMIT_UNCHANGED_TEXT option). + * The source string can then be modified in-place. + * + * @return the current index into the replacement-characters-only string, + * not counting unchanged spans + * @stable ICU 59 + */ + int32_t replacementIndex() const { + // TODO: Throw an exception if we aren't in a change edit? + return replIndex; + } + + /** + * The start index of the current span in the destination string; the span has length + * {@link #newLength}. + * + * @return the current index into the full destination string + * @stable ICU 59 + */ + int32_t destinationIndex() const { return destIndex; } + +#ifndef U_HIDE_INTERNAL_API + /** + * A string representation of the current edit represented by the iterator for debugging. You + * should not depend on the contents of the return string. + * @internal + */ + UnicodeString& toString(UnicodeString& appendTo) const; +#endif // U_HIDE_INTERNAL_API + + private: + friend class Edits; + + Iterator(const uint16_t *a, int32_t len, UBool oc, UBool crs); + + int32_t readLength(int32_t head); + void updateNextIndexes(); + void updatePreviousIndexes(); + UBool noNext(); + UBool next(UBool onlyChanges, UErrorCode &errorCode); + UBool previous(UErrorCode &errorCode); + /** @return -1: error or i<0; 0: found; 1: i>=string length */ + int32_t findIndex(int32_t i, UBool findSource, UErrorCode &errorCode); + + const uint16_t *array; + int32_t index, length; + // 0 if we are not within compressed equal-length changes. + // Otherwise the number of remaining changes, including the current one. + int32_t remaining; + UBool onlyChanges_, coarse; + + int8_t dir; // iteration direction: back(<0), initial(0), forward(>0) + UBool changed; + int32_t oldLength_, newLength_; + int32_t srcIndex, replIndex, destIndex; + }; + + /** + * Returns an Iterator for coarse-grained change edits + * (adjacent change edits are treated as one). + * Can be used to perform simple string updates. + * Skips no-change edits. + * @return an Iterator that merges adjacent changes. + * @stable ICU 59 + */ + Iterator getCoarseChangesIterator() const { + return Iterator(array, length, true, true); + } + + /** + * Returns an Iterator for coarse-grained change and no-change edits + * (adjacent change edits are treated as one). + * Can be used to perform simple string updates. + * Adjacent change edits are treated as one edit. + * @return an Iterator that merges adjacent changes. + * @stable ICU 59 + */ + Iterator getCoarseIterator() const { + return Iterator(array, length, false, true); + } + + /** + * Returns an Iterator for fine-grained change edits + * (full granularity of change edits is retained). + * Can be used for modifying styled text. + * Skips no-change edits. + * @return an Iterator that separates adjacent changes. + * @stable ICU 59 + */ + Iterator getFineChangesIterator() const { + return Iterator(array, length, true, false); + } + + /** + * Returns an Iterator for fine-grained change and no-change edits + * (full granularity of change edits is retained). + * Can be used for modifying styled text. + * @return an Iterator that separates adjacent changes. + * @stable ICU 59 + */ + Iterator getFineIterator() const { + return Iterator(array, length, false, false); + } + + /** + * Merges the two input Edits and appends the result to this object. + * + * Consider two string transformations (for example, normalization and case mapping) + * where each records Edits in addition to writing an output string.
+ * Edits ab reflect how substrings of input string a + * map to substrings of intermediate string b.
+ * Edits bc reflect how substrings of intermediate string b + * map to substrings of output string c.
+ * This function merges ab and bc such that the additional edits + * recorded in this object reflect how substrings of input string a + * map to substrings of output string c. + * + * If unrelated Edits are passed in where the output string of the first + * has a different length than the input string of the second, + * then a U_ILLEGAL_ARGUMENT_ERROR is reported. + * + * @param ab reflects how substrings of input string a + * map to substrings of intermediate string b. + * @param bc reflects how substrings of intermediate string b + * map to substrings of output string c. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return *this, with the merged edits appended + * @stable ICU 60 + */ + Edits &mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode); + +private: + void releaseArray() U_NOEXCEPT; + Edits ©Array(const Edits &other); + Edits &moveArray(Edits &src) U_NOEXCEPT; + + void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; } + int32_t lastUnit() const { return length > 0 ? array[length - 1] : 0xffff; } + + void append(int32_t r); + UBool growArray(); + + static const int32_t STACK_CAPACITY = 100; + uint16_t *array; + int32_t capacity; + int32_t length; + int32_t delta; + int32_t numChanges; + UErrorCode errorCode_; + uint16_t stackArray[STACK_CAPACITY]; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __EDITS_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/enumset.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/enumset.h new file mode 100644 index 0000000000000000000000000000000000000000..bde8c455c0dd2bd80f57101dc95d0ef094352b72 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/enumset.h @@ -0,0 +1,69 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2012,2014 International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +*/ + +/** + * \file + * \brief C++: internal template EnumSet<> + */ + +#ifndef ENUMSET_H +#define ENUMSET_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/* Can't use #ifndef U_HIDE_INTERNAL_API for the entire EnumSet class, needed in .h file declarations */ +/** + * enum bitset for boolean fields. Similar to Java EnumSet<>. + * Needs to range check. Used for private instance variables. + * @internal + * \cond + */ +template +class EnumSet { +public: + inline EnumSet() : fBools(0) {} + inline EnumSet(const EnumSet& other) : fBools(other.fBools) {} + inline ~EnumSet() {} +#ifndef U_HIDE_INTERNAL_API + inline void clear() { fBools=0; } + inline void add(T toAdd) { set(toAdd, 1); } + inline void remove(T toRemove) { set(toRemove, 0); } + inline int32_t contains(T toCheck) const { return get(toCheck); } + inline void set(T toSet, int32_t v) { fBools=(fBools&(~flag(toSet)))|(v?(flag(toSet)):0); } + inline int32_t get(T toCheck) const { return (fBools & flag(toCheck))?1:0; } + inline UBool isValidEnum(T toCheck) const { return (toCheck>=minValue&&toCheck& operator=(const EnumSet& other) { + fBools = other.fBools; + return *this; + } + + inline uint32_t getAll() const { + return fBools; + } +#endif /* U_HIDE_INTERNAL_API */ + +private: + inline uint32_t flag(T toCheck) const { return (1<<(toCheck-minValue)); } +private: + uint32_t fBools; +}; + +/** \endcond */ + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ +#endif /* ENUMSET_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/errorcode.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/errorcode.h new file mode 100644 index 0000000000000000000000000000000000000000..fe7b5183232cd149913c929a20e8ef7f879b619c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/errorcode.h @@ -0,0 +1,144 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: errorcode.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009mar10 +* created by: Markus W. Scherer +*/ + +#ifndef __ERRORCODE_H__ +#define __ERRORCODE_H__ + +/** + * \file + * \brief C++ API: ErrorCode class intended to make it easier to use + * ICU C and C++ APIs from C++ user code. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN + +/** + * Wrapper class for UErrorCode, with conversion operators for direct use + * in ICU C and C++ APIs. + * Intended to be used as a base class, where a subclass overrides + * the handleFailure() function so that it throws an exception, + * does an assert(), logs an error, etc. + * This is not an abstract base class. This class can be used and instantiated + * by itself, although it will be more useful when subclassed. + * + * Features: + * - The constructor initializes the internal UErrorCode to U_ZERO_ERROR, + * removing one common source of errors. + * - Same use in C APIs taking a UErrorCode * (pointer) + * and C++ taking UErrorCode & (reference) via conversion operators. + * - Possible automatic checking for success when it goes out of scope. + * + * Note: For automatic checking for success in the destructor, a subclass + * must implement such logic in its own destructor because the base class + * destructor cannot call a subclass function (like handleFailure()). + * The ErrorCode base class destructor does nothing. + * + * Note also: While it is possible for a destructor to throw an exception, + * it is generally unsafe to do so. This means that in a subclass the destructor + * and the handleFailure() function may need to take different actions. + * + * Sample code: + * \code + * class IcuErrorCode: public icu::ErrorCode { + * public: + * virtual ~IcuErrorCode() { // should be defined in .cpp as "key function" + * // Safe because our handleFailure() does not throw exceptions. + * if(isFailure()) { handleFailure(); } + * } + * protected: + * virtual void handleFailure() const { + * log_failure(u_errorName(errorCode)); + * exit(errorCode); + * } + * }; + * IcuErrorCode error_code; + * UConverter *cnv = ucnv_open("Shift-JIS", error_code); + * length = ucnv_fromUChars(dest, capacity, src, length, error_code); + * ucnv_close(cnv); + * // IcuErrorCode destructor checks for success. + * \endcode + * + * @stable ICU 4.2 + */ +class U_COMMON_API ErrorCode: public UMemory { +public: + /** + * Default constructor. Initializes its UErrorCode to U_ZERO_ERROR. + * @stable ICU 4.2 + */ + ErrorCode() : errorCode(U_ZERO_ERROR) {} + /** Destructor, does nothing. See class documentation for details. @stable ICU 4.2 */ + virtual ~ErrorCode(); + /** Conversion operator, returns a reference. @stable ICU 4.2 */ + operator UErrorCode & () { return errorCode; } + /** Conversion operator, returns a pointer. @stable ICU 4.2 */ + operator UErrorCode * () { return &errorCode; } + /** Tests for U_SUCCESS(). @stable ICU 4.2 */ + UBool isSuccess() const { return U_SUCCESS(errorCode); } + /** Tests for U_FAILURE(). @stable ICU 4.2 */ + UBool isFailure() const { return U_FAILURE(errorCode); } + /** Returns the UErrorCode value. @stable ICU 4.2 */ + UErrorCode get() const { return errorCode; } + /** Sets the UErrorCode value. @stable ICU 4.2 */ + void set(UErrorCode value) { errorCode=value; } + /** Returns the UErrorCode value and resets it to U_ZERO_ERROR. @stable ICU 4.2 */ + UErrorCode reset(); + /** + * Asserts isSuccess(). + * In other words, this method checks for a failure code, + * and the base class handles it like this: + * \code + * if(isFailure()) { handleFailure(); } + * \endcode + * @stable ICU 4.4 + */ + void assertSuccess() const; + /** + * Return a string for the UErrorCode value. + * The string will be the same as the name of the error code constant + * in the UErrorCode enum. + * @stable ICU 4.4 + */ + const char* errorName() const; + +protected: + /** + * Internal UErrorCode, accessible to subclasses. + * @stable ICU 4.2 + */ + UErrorCode errorCode; + /** + * Called by assertSuccess() if isFailure() is true. + * A subclass should override this function to deal with a failure code: + * Throw an exception, log an error, terminate the program, or similar. + * @stable ICU 4.2 + */ + virtual void handleFailure() const {} +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __ERRORCODE_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/filteredbrk.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/filteredbrk.h new file mode 100644 index 0000000000000000000000000000000000000000..8b07e39ae12bb61bdf56d3e5d682d84a959c92ff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/filteredbrk.h @@ -0,0 +1,152 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2015, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +*/ + +#ifndef FILTEREDBRK_H +#define FILTEREDBRK_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/brkiter.h" + +#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION + +U_NAMESPACE_BEGIN + +/** + * \file + * \brief C++ API: FilteredBreakIteratorBuilder + */ + +/** + * The BreakIteratorFilter is used to modify the behavior of a BreakIterator + * by constructing a new BreakIterator which suppresses certain segment boundaries. + * See http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions . + * For example, a typical English Sentence Break Iterator would break on the space + * in the string "Mr. Smith" (resulting in two segments), + * but with "Mr." as an exception, a filtered break iterator + * would consider the string "Mr. Smith" to be a single segment. + * + * @stable ICU 56 + */ +class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { + public: + /** + * destructor. + * @stable ICU 56 + */ + virtual ~FilteredBreakIteratorBuilder(); + + /** + * Construct a FilteredBreakIteratorBuilder based on rules in a locale. + * The rules are taken from CLDR exception data for the locale, + * see http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions + * This is the equivalent of calling createInstance(UErrorCode&) + * and then repeatedly calling addNoBreakAfter(...) with the contents + * of the CLDR exception data. + * @param where the locale. + * @param status The error code. + * @return the new builder + * @stable ICU 56 + */ + static FilteredBreakIteratorBuilder *createInstance(const Locale& where, UErrorCode& status); + +#ifndef U_HIDE_DEPRECATED_API + /** + * This function has been deprecated in favor of createEmptyInstance, which has + * identical behavior. + * @param status The error code. + * @return the new builder + * @deprecated ICU 60 use createEmptyInstance instead + * @see createEmptyInstance() + */ + static FilteredBreakIteratorBuilder *createInstance(UErrorCode &status); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Construct an empty FilteredBreakIteratorBuilder. + * In this state, it will not suppress any segment boundaries. + * @param status The error code. + * @return the new builder + * @stable ICU 60 + */ + static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status); + + /** + * Suppress a certain string from being the end of a segment. + * For example, suppressing "Mr.", then segments ending in "Mr." will not be returned + * by the iterator. + * @param string the string to suppress, such as "Mr." + * @param status error code + * @return returns true if the string was not present and now added, + * false if the call was a no-op because the string was already being suppressed. + * @stable ICU 56 + */ + virtual UBool suppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; + + /** + * Stop suppressing a certain string from being the end of the segment. + * This function does not create any new segment boundaries, but only serves to un-do + * the effect of earlier calls to suppressBreakAfter, or to un-do the effect of + * locale data which may be suppressing certain strings. + * @param string the exception to remove + * @param status error code + * @return returns true if the string was present and now removed, + * false if the call was a no-op because the string was not being suppressed. + * @stable ICU 56 + */ + virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; + +#ifndef U_FORCE_HIDE_DEPRECATED_API + /** + * This function has been deprecated in favor of wrapIteratorWithFilter() + * The behavior is identical. + * @param adoptBreakIterator the break iterator to adopt + * @param status error code + * @return the new BreakIterator, owned by the caller. + * @deprecated ICU 60 use wrapIteratorWithFilter() instead + * @see wrapBreakIteratorWithFilter() + */ + virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0; +#endif // U_FORCE_HIDE_DEPRECATED_API + + /** + * Wrap (adopt) an existing break iterator in a new filtered instance. + * The resulting BreakIterator is owned by the caller. + * The BreakIteratorFilter may be destroyed before the BreakIterator is destroyed. + * Note that the adoptBreakIterator is adopted by the new BreakIterator + * and should no longer be used by the caller. + * The FilteredBreakIteratorBuilder may be reused. + * This function is an alias for build() + * @param adoptBreakIterator the break iterator to adopt + * @param status error code + * @return the new BreakIterator, owned by the caller. + * @stable ICU 60 + */ + inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) { + return build(adoptBreakIterator, status); + } + + protected: + /** + * For subclass use + * @stable ICU 56 + */ + FilteredBreakIteratorBuilder(); +}; + + +U_NAMESPACE_END + +#endif // #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // #ifndef FILTEREDBRK_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/icudataver.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/icudataver.h new file mode 100644 index 0000000000000000000000000000000000000000..f218ed8ebccbcba8c0c5b721dd4c466ca43fa1f6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/icudataver.h @@ -0,0 +1,43 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2009-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +*/ + + +/** + * \file + * \brief C API: access to ICU Data Version number + */ + +#ifndef __ICU_DATA_VER_H__ +#define __ICU_DATA_VER_H__ + +#include "unicode/utypes.h" + +/** + * @stable ICU 49 + */ +#define U_ICU_VERSION_BUNDLE "icuver" + +/** + * @stable ICU 49 + */ +#define U_ICU_DATA_KEY "DataVersion" + +/** + * Retrieves the data version from icuver and stores it in dataVersionFillin. + * + * @param dataVersionFillin icuver data version information to be filled in if not-null + * @param status stores the error code from the calls to resource bundle + * + * @stable ICU 49 + */ +U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/icuplug.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/icuplug.h new file mode 100644 index 0000000000000000000000000000000000000000..205af360d45e9e622729a7d400df4cd5b523e44d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/icuplug.h @@ -0,0 +1,387 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2009-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : icuplug.h +* +* Date Name Description +* 10/29/2009 sl New. +****************************************************************************** +*/ + +/** + * \file + * \brief C API: ICU Plugin API + * + *

C API: ICU Plugin API

+ * + *

C API allowing run-time loadable modules that extend or modify ICU functionality.

+ * + *

Loading and Configuration

+ * + *

At ICU startup time, the environment variable "ICU_PLUGINS" will be + * queried for a directory name. If it is not set, the preprocessor symbol + * "DEFAULT_ICU_PLUGINS" will be checked for a default value.

+ * + *

Within the above-named directory, the file "icuplugins##.txt" will be + * opened, if present, where ## is the major+minor number of the currently + * running ICU (such as, 44 for ICU 4.4, thus icuplugins44.txt)

+ * + *

The configuration file has this format:

+ * + *
    + *
  • Hash (#) begins a comment line
  • + * + *
  • Non-comment lines have two or three components: + * LIBRARYNAME ENTRYPOINT [ CONFIGURATION .. ]
  • + * + *
  • Tabs or spaces separate the three items.
  • + * + *
  • LIBRARYNAME is the name of a shared library, either a short name if + * it is on the loader path, or a full pathname.
  • + * + *
  • ENTRYPOINT is the short (undecorated) symbol name of the plugin's + * entrypoint, as above.
  • + * + *
  • CONFIGURATION is the entire rest of the line . It's passed as-is to + * the plugin.
  • + *
+ * + *

An example configuration file is, in its entirety:

+ * + * \code + * # this is icuplugins44.txt + * testplug.dll myPlugin hello=world + * \endcode + *

Plugins are categorized as "high" or "low" level. Low level are those + * which must be run BEFORE high level plugins, and before any operations + * which cause ICU to be 'initialized'. If a plugin is low level but + * causes ICU to allocate memory or become initialized, that plugin is said + * to cause a 'level change'.

+ * + *

At load time, ICU first queries all plugins to determine their level, + * then loads all 'low' plugins first, and then loads all 'high' plugins. + * Plugins are otherwise loaded in the order listed in the configuration file.

+ * + *

Implementing a Plugin

+ * \code + * U_CAPI UPlugTokenReturn U_EXPORT2 + * myPlugin (UPlugData *plug, UPlugReason reason, UErrorCode *status) { + * if(reason==UPLUG_REASON_QUERY) { + * uplug_setPlugName(plug, "Simple Plugin"); + * uplug_setPlugLevel(plug, UPLUG_LEVEL_HIGH); + * } else if(reason==UPLUG_REASON_LOAD) { + * ... Set up some ICU things here.... + * } else if(reason==UPLUG_REASON_UNLOAD) { + * ... unload, clean up ... + * } + * return UPLUG_TOKEN; + * } + * \endcode + * + *

The UPlugData* is an opaque pointer to the plugin-specific data, and is + * used in all other API calls.

+ * + *

The API contract is:

+ *
  1. The plugin MUST always return UPLUG_TOKEN as a return value- to + * indicate that it is a valid plugin.
  2. + * + *
  3. When the 'reason' parameter is set to UPLUG_REASON_QUERY, the + * plugin MUST call uplug_setPlugLevel() to indicate whether it is a high + * level or low level plugin.
  4. + * + *
  5. When the 'reason' parameter is UPLUG_REASON_QUERY, the plugin + * SHOULD call uplug_setPlugName to indicate a human readable plugin name.
+ * + * + * \internal ICU 4.4 Technology Preview + */ + + +#ifndef ICUPLUG_H +#define ICUPLUG_H + +#include "unicode/utypes.h" + + +#if UCONFIG_ENABLE_PLUGINS || defined(U_IN_DOXYGEN) + + + +/* === Basic types === */ + +#ifndef U_HIDE_INTERNAL_API +struct UPlugData; +/** + * @{ + * Typedef for opaque structure passed to/from a plugin. + * Use the APIs to access it. + * @internal ICU 4.4 Technology Preview + */ +typedef struct UPlugData UPlugData; + +/** @} */ + +/** + * Random Token to identify a valid ICU plugin. Plugins must return this + * from the entrypoint. + * @internal ICU 4.4 Technology Preview + */ +#define UPLUG_TOKEN 0x54762486 + +/** + * Max width of names, symbols, and configuration strings + * @internal ICU 4.4 Technology Preview + */ +#define UPLUG_NAME_MAX 100 + + +/** + * Return value from a plugin entrypoint. + * Must always be set to UPLUG_TOKEN + * @see UPLUG_TOKEN + * @internal ICU 4.4 Technology Preview + */ +typedef uint32_t UPlugTokenReturn; + +/** + * Reason code for the entrypoint's call + * @internal ICU 4.4 Technology Preview + */ +typedef enum { + UPLUG_REASON_QUERY = 0, /**< The plugin is being queried for info. **/ + UPLUG_REASON_LOAD = 1, /**< The plugin is being loaded. **/ + UPLUG_REASON_UNLOAD = 2, /**< The plugin is being unloaded. **/ + /** + * Number of known reasons. + * @internal The numeric value may change over time, see ICU ticket #12420. + */ + UPLUG_REASON_COUNT +} UPlugReason; + + +/** + * Level of plugin loading + * INITIAL: UNKNOWN + * QUERY: INVALID -> { LOW | HIGH } + * ERR -> INVALID + * @internal ICU 4.4 Technology Preview + */ +typedef enum { + UPLUG_LEVEL_INVALID = 0, /**< The plugin is invalid, hasn't called uplug_setLevel, or can't load. **/ + UPLUG_LEVEL_UNKNOWN = 1, /**< The plugin is waiting to be installed. **/ + UPLUG_LEVEL_LOW = 2, /**< The plugin must be called before u_init completes **/ + UPLUG_LEVEL_HIGH = 3, /**< The plugin can run at any time. **/ + /** + * Number of known levels. + * @internal The numeric value may change over time, see ICU ticket #12420. + */ + UPLUG_LEVEL_COUNT +} UPlugLevel; + +/** + * Entrypoint for an ICU plugin. + * @param plug the UPlugData handle. + * @param status the plugin's extended status code. + * @return A valid plugin must return UPLUG_TOKEN + * @internal ICU 4.4 Technology Preview + */ +typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) ( + UPlugData *plug, + UPlugReason reason, + UErrorCode *status); + +/* === Needed for Implementing === */ + +/** + * Request that this plugin not be unloaded at cleanup time. + * This is appropriate for plugins which cannot be cleaned up. + * @see u_cleanup() + * @param plug plugin + * @param dontUnload set true if this plugin can't be unloaded + * @internal ICU 4.4 Technology Preview + */ +U_CAPI void U_EXPORT2 +uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload); + +/** + * Set the level of this plugin. + * @param plug plugin data handle + * @param level the level of this plugin + * @internal ICU 4.4 Technology Preview + */ +U_CAPI void U_EXPORT2 +uplug_setPlugLevel(UPlugData *plug, UPlugLevel level); + +/** + * Get the level of this plugin. + * @param plug plugin data handle + * @return the level of this plugin + * @internal ICU 4.4 Technology Preview + */ +U_CAPI UPlugLevel U_EXPORT2 +uplug_getPlugLevel(UPlugData *plug); + +/** + * Get the lowest level of plug which can currently load. + * For example, if UPLUG_LEVEL_LOW is returned, then low level plugins may load + * if UPLUG_LEVEL_HIGH is returned, then only high level plugins may load. + * @return the lowest level of plug which can currently load + * @internal ICU 4.4 Technology Preview + */ +U_CAPI UPlugLevel U_EXPORT2 +uplug_getCurrentLevel(void); + + +/** + * Get plug load status + * @return The error code of this plugin's load attempt. + * @internal ICU 4.4 Technology Preview + */ +U_CAPI UErrorCode U_EXPORT2 +uplug_getPlugLoadStatus(UPlugData *plug); + +/** + * Set the human-readable name of this plugin. + * @param plug plugin data handle + * @param name the name of this plugin. The first UPLUG_NAME_MAX characters willi be copied into a new buffer. + * @internal ICU 4.4 Technology Preview + */ +U_CAPI void U_EXPORT2 +uplug_setPlugName(UPlugData *plug, const char *name); + +/** + * Get the human-readable name of this plugin. + * @param plug plugin data handle + * @return the name of this plugin + * @internal ICU 4.4 Technology Preview + */ +U_CAPI const char * U_EXPORT2 +uplug_getPlugName(UPlugData *plug); + +/** + * Return the symbol name for this plugin, if known. + * @param plug plugin data handle + * @return the symbol name, or NULL + * @internal ICU 4.4 Technology Preview + */ +U_CAPI const char * U_EXPORT2 +uplug_getSymbolName(UPlugData *plug); + +/** + * Return the library name for this plugin, if known. + * @param plug plugin data handle + * @param status error code + * @return the library name, or NULL + * @internal ICU 4.4 Technology Preview + */ +U_CAPI const char * U_EXPORT2 +uplug_getLibraryName(UPlugData *plug, UErrorCode *status); + +/** + * Return the library used for this plugin, if known. + * Plugins could use this to load data out of their + * @param plug plugin data handle + * @return the library, or NULL + * @internal ICU 4.4 Technology Preview + */ +U_CAPI void * U_EXPORT2 +uplug_getLibrary(UPlugData *plug); + +/** + * Return the plugin-specific context data. + * @param plug plugin data handle + * @return the context, or NULL if not set + * @internal ICU 4.4 Technology Preview + */ +U_CAPI void * U_EXPORT2 +uplug_getContext(UPlugData *plug); + +/** + * Set the plugin-specific context data. + * @param plug plugin data handle + * @param context new context to set + * @internal ICU 4.4 Technology Preview + */ +U_CAPI void U_EXPORT2 +uplug_setContext(UPlugData *plug, void *context); + + +/** + * Get the configuration string, if available. + * The string is in the platform default codepage. + * @param plug plugin data handle + * @return configuration string, or else null. + * @internal ICU 4.4 Technology Preview + */ +U_CAPI const char * U_EXPORT2 +uplug_getConfiguration(UPlugData *plug); + +/** + * Return all currently installed plugins, from newest to oldest + * Usage Example: + * \code + * UPlugData *plug = NULL; + * while(plug=uplug_nextPlug(plug)) { + * ... do something with 'plug' ... + * } + * \endcode + * Not thread safe- do not call while plugs are added or removed. + * @param prior pass in 'NULL' to get the first (most recent) plug, + * otherwise pass the value returned on a prior call to uplug_nextPlug + * @return the next oldest plugin, or NULL if no more. + * @internal ICU 4.4 Technology Preview + */ +U_CAPI UPlugData* U_EXPORT2 +uplug_nextPlug(UPlugData *prior); + +/** + * Inject a plugin as if it were loaded from a library. + * This is useful for testing plugins. + * Note that it will have a 'NULL' library pointer associated + * with it, and therefore no llibrary will be closed at cleanup time. + * Low level plugins may not be able to load, as ordering can't be enforced. + * @param entrypoint entrypoint to install + * @param config user specified configuration string, if available, or NULL. + * @param status error result + * @return the new UPlugData associated with this plugin, or NULL if error. + * @internal ICU 4.4 Technology Preview + */ +U_CAPI UPlugData* U_EXPORT2 +uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status); + + +/** + * Inject a plugin from a library, as if the information came from a config file. + * Low level plugins may not be able to load, and ordering can't be enforced. + * @param libName DLL name to load + * @param sym symbol of plugin (UPlugEntrypoint function) + * @param config configuration string, or NULL + * @param status error result + * @return the new UPlugData associated with this plugin, or NULL if error. + * @internal ICU 4.4 Technology Preview + */ +U_CAPI UPlugData* U_EXPORT2 +uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status); + +/** + * Remove a plugin. + * Will request the plugin to be unloaded, and close the library if needed + * @param plug plugin handle to close + * @param status error result + * @internal ICU 4.4 Technology Preview + */ +U_CAPI void U_EXPORT2 +uplug_removePlug(UPlugData *plug, UErrorCode *status); +#endif /* U_HIDE_INTERNAL_API */ + +#endif /* UCONFIG_ENABLE_PLUGINS */ + +#endif /* _ICUPLUG */ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/idna.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/idna.h new file mode 100644 index 0000000000000000000000000000000000000000..1305dc604842eb5c131d0e0818d6da3244df9835 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/idna.h @@ -0,0 +1,330 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: idna.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010mar05 +* created by: Markus W. Scherer +*/ + +#ifndef __IDNA_H__ +#define __IDNA_H__ + +/** + * \file + * \brief C++ API: Internationalizing Domain Names in Applications (IDNA) + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_IDNA + +#include "unicode/bytestream.h" +#include "unicode/stringpiece.h" +#include "unicode/uidna.h" +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN + +class IDNAInfo; + +/** + * Abstract base class for IDNA processing. + * See http://www.unicode.org/reports/tr46/ + * and http://www.ietf.org/rfc/rfc3490.txt + * + * The IDNA class is not intended for public subclassing. + * + * This C++ API currently only implements UTS #46. + * The uidna.h C API implements both UTS #46 (functions using UIDNA service object) + * and IDNA2003 (functions that do not use a service object). + * @stable ICU 4.6 + */ +class U_COMMON_API IDNA : public UObject { +public: + /** + * Destructor. + * @stable ICU 4.6 + */ + ~IDNA(); + + /** + * Returns an IDNA instance which implements UTS #46. + * Returns an unmodifiable instance, owned by the caller. + * Cache it for multiple operations, and delete it when done. + * The instance is thread-safe, that is, it can be used concurrently. + * + * UTS #46 defines Unicode IDNA Compatibility Processing, + * updated to the latest version of Unicode and compatible with both + * IDNA2003 and IDNA2008. + * + * The worker functions use transitional processing, including deviation mappings, + * unless UIDNA_NONTRANSITIONAL_TO_ASCII or UIDNA_NONTRANSITIONAL_TO_UNICODE + * is used in which case the deviation characters are passed through without change. + * + * Disallowed characters are mapped to U+FFFD. + * + * For available options see the uidna.h header. + * Operations with the UTS #46 instance do not support the + * UIDNA_ALLOW_UNASSIGNED option. + * + * By default, the UTS #46 implementation allows all ASCII characters (as valid or mapped). + * When the UIDNA_USE_STD3_RULES option is used, ASCII characters other than + * letters, digits, hyphen (LDH) and dot/full stop are disallowed and mapped to U+FFFD. + * + * @param options Bit set to modify the processing and error checking. + * See option bit set values in uidna.h. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the UTS #46 IDNA instance, if successful + * @stable ICU 4.6 + */ + static IDNA * + createUTS46Instance(uint32_t options, UErrorCode &errorCode); + + /** + * Converts a single domain name label into its ASCII form for DNS lookup. + * If any processing step fails, then info.hasErrors() will be true and + * the result might not be an ASCII string. + * The label might be modified according to the types of errors. + * Labels with severe errors will be left in (or turned into) their Unicode form. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param label Input domain name label + * @param dest Destination string object + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual UnicodeString & + labelToASCII(const UnicodeString &label, UnicodeString &dest, + IDNAInfo &info, UErrorCode &errorCode) const = 0; + + /** + * Converts a single domain name label into its Unicode form for human-readable display. + * If any processing step fails, then info.hasErrors() will be true. + * The label might be modified according to the types of errors. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param label Input domain name label + * @param dest Destination string object + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual UnicodeString & + labelToUnicode(const UnicodeString &label, UnicodeString &dest, + IDNAInfo &info, UErrorCode &errorCode) const = 0; + + /** + * Converts a whole domain name into its ASCII form for DNS lookup. + * If any processing step fails, then info.hasErrors() will be true and + * the result might not be an ASCII string. + * The domain name might be modified according to the types of errors. + * Labels with severe errors will be left in (or turned into) their Unicode form. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param name Input domain name + * @param dest Destination string object + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual UnicodeString & + nameToASCII(const UnicodeString &name, UnicodeString &dest, + IDNAInfo &info, UErrorCode &errorCode) const = 0; + + /** + * Converts a whole domain name into its Unicode form for human-readable display. + * If any processing step fails, then info.hasErrors() will be true. + * The domain name might be modified according to the types of errors. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param name Input domain name + * @param dest Destination string object + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual UnicodeString & + nameToUnicode(const UnicodeString &name, UnicodeString &dest, + IDNAInfo &info, UErrorCode &errorCode) const = 0; + + // UTF-8 versions of the processing methods ---------------------------- *** + + /** + * Converts a single domain name label into its ASCII form for DNS lookup. + * UTF-8 version of labelToASCII(), same behavior. + * + * @param label Input domain name label + * @param dest Destination byte sink; Flush()ed if successful + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual void + labelToASCII_UTF8(StringPiece label, ByteSink &dest, + IDNAInfo &info, UErrorCode &errorCode) const; + + /** + * Converts a single domain name label into its Unicode form for human-readable display. + * UTF-8 version of labelToUnicode(), same behavior. + * + * @param label Input domain name label + * @param dest Destination byte sink; Flush()ed if successful + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual void + labelToUnicodeUTF8(StringPiece label, ByteSink &dest, + IDNAInfo &info, UErrorCode &errorCode) const; + + /** + * Converts a whole domain name into its ASCII form for DNS lookup. + * UTF-8 version of nameToASCII(), same behavior. + * + * @param name Input domain name + * @param dest Destination byte sink; Flush()ed if successful + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual void + nameToASCII_UTF8(StringPiece name, ByteSink &dest, + IDNAInfo &info, UErrorCode &errorCode) const; + + /** + * Converts a whole domain name into its Unicode form for human-readable display. + * UTF-8 version of nameToUnicode(), same behavior. + * + * @param name Input domain name + * @param dest Destination byte sink; Flush()ed if successful + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual void + nameToUnicodeUTF8(StringPiece name, ByteSink &dest, + IDNAInfo &info, UErrorCode &errorCode) const; +}; + +class UTS46; + +/** + * Output container for IDNA processing errors. + * The IDNAInfo class is not suitable for subclassing. + * @stable ICU 4.6 + */ +class U_COMMON_API IDNAInfo : public UMemory { +public: + /** + * Constructor for stack allocation. + * @stable ICU 4.6 + */ + IDNAInfo() : errors(0), labelErrors(0), isTransDiff(false), isBiDi(false), isOkBiDi(true) {} + /** + * Were there IDNA processing errors? + * @return true if there were processing errors + * @stable ICU 4.6 + */ + UBool hasErrors() const { return errors!=0; } + /** + * Returns a bit set indicating IDNA processing errors. + * See UIDNA_ERROR_... constants in uidna.h. + * @return bit set of processing errors + * @stable ICU 4.6 + */ + uint32_t getErrors() const { return errors; } + /** + * Returns true if transitional and nontransitional processing produce different results. + * This is the case when the input label or domain name contains + * one or more deviation characters outside a Punycode label (see UTS #46). + *
    + *
  • With nontransitional processing, such characters are + * copied to the destination string. + *
  • With transitional processing, such characters are + * mapped (sharp s/sigma) or removed (joiner/nonjoiner). + *
+ * @return true if transitional and nontransitional processing produce different results + * @stable ICU 4.6 + */ + UBool isTransitionalDifferent() const { return isTransDiff; } + +private: + friend class UTS46; + + IDNAInfo(const IDNAInfo &other); // no copying + IDNAInfo &operator=(const IDNAInfo &other); // no copying + + void reset() { + errors=labelErrors=0; + isTransDiff=false; + isBiDi=false; + isOkBiDi=true; + } + + uint32_t errors, labelErrors; + UBool isTransDiff; + UBool isBiDi; + UBool isOkBiDi; +}; + +U_NAMESPACE_END + +#endif // UCONFIG_NO_IDNA + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __IDNA_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/localebuilder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/localebuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..27a894de101def57621cf2976ef5b77f7ade0068 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/localebuilder.h @@ -0,0 +1,311 @@ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +#ifndef __LOCALEBUILDER_H__ +#define __LOCALEBUILDER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/locid.h" +#include "unicode/localematcher.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Builder API for Locale + */ + +U_NAMESPACE_BEGIN +class CharString; + +/** + * LocaleBuilder is used to build instances of Locale + * from values configured by the setters. Unlike the Locale + * constructors, the LocaleBuilder checks if a value configured by a + * setter satisfies the syntax requirements defined by the Locale + * class. A Locale object created by a LocaleBuilder is + * well-formed and can be transformed to a well-formed IETF BCP 47 language tag + * without losing information. + * + *

The following example shows how to create a Locale object + * with the LocaleBuilder. + *

+ *
+ *     UErrorCode status = U_ZERO_ERROR;
+ *     Locale aLocale = LocaleBuilder()
+ *                          .setLanguage("sr")
+ *                          .setScript("Latn")
+ *                          .setRegion("RS")
+ *                          .build(status);
+ *     if (U_SUCCESS(status)) {
+ *       // ...
+ *     }
+ * 
+ *
+ * + *

LocaleBuilders can be reused; clear() resets all + * fields to their default values. + * + *

LocaleBuilder tracks errors in an internal UErrorCode. For all setters, + * except setLanguageTag and setLocale, LocaleBuilder will return immediately + * if the internal UErrorCode is in error state. + * To reset internal state and error code, call clear method. + * The setLanguageTag and setLocale method will first clear the internal + * UErrorCode, then track the error of the validation of the input parameter + * into the internal UErrorCode. + * + * @stable ICU 64 + */ +class U_COMMON_API LocaleBuilder : public UObject { +public: + /** + * Constructs an empty LocaleBuilder. The default value of all + * fields, extensions, and private use information is the + * empty string. + * + * @stable ICU 64 + */ + LocaleBuilder(); + + /** + * Destructor + * @stable ICU 64 + */ + virtual ~LocaleBuilder(); + + /** + * Resets the LocaleBuilder to match the provided + * locale. Existing state is discarded. + * + *

All fields of the locale must be well-formed. + *

This method clears the internal UErrorCode. + * + * @param locale the locale + * @return This builder. + * + * @stable ICU 64 + */ + LocaleBuilder& setLocale(const Locale& locale); + + /** + * Resets the LocaleBuilder to match the provided + * [Unicode Locale Identifier](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id) . + * Discards the existing state. + * The empty string causes the builder to be reset, like {@link #clear}. + * Legacy language tags (marked as “Type: grandfathered” in BCP 47) + * are converted to their canonical form before being processed. + * Otherwise, the language tag must be well-formed, + * or else the build() method will later report an U_ILLEGAL_ARGUMENT_ERROR. + * + *

This method clears the internal UErrorCode. + * + * @param tag the language tag, defined as + * [unicode_locale_id](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id). + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setLanguageTag(StringPiece tag); + + /** + * Sets the language. If language is the empty string, the + * language in this LocaleBuilder is removed. Otherwise, the + * language must be well-formed, or else the build() method will + * later report an U_ILLEGAL_ARGUMENT_ERROR. + * + *

The syntax of language value is defined as + * [unicode_language_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_language_subtag). + * + * @param language the language + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setLanguage(StringPiece language); + + /** + * Sets the script. If script is the empty string, the script in + * this LocaleBuilder is removed. + * Otherwise, the script must be well-formed, or else the build() + * method will later report an U_ILLEGAL_ARGUMENT_ERROR. + * + *

The script value is a four-letter script code as + * [unicode_script_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_script_subtag) + * defined by ISO 15924 + * + * @param script the script + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setScript(StringPiece script); + + /** + * Sets the region. If region is the empty string, the region in this + * LocaleBuilder is removed. Otherwise, the region + * must be well-formed, or else the build() method will later report an + * U_ILLEGAL_ARGUMENT_ERROR. + * + *

The region value is defined by + * [unicode_region_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_region_subtag) + * as a two-letter ISO 3166 code or a three-digit UN M.49 area code. + * + *

The region value in the Locale created by the + * LocaleBuilder is always normalized to upper case. + * + * @param region the region + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setRegion(StringPiece region); + + /** + * Sets the variant. If variant is the empty string, the variant in this + * LocaleBuilder is removed. Otherwise, the variant + * must be well-formed, or else the build() method will later report an + * U_ILLEGAL_ARGUMENT_ERROR. + * + *

Note: This method checks if variant + * satisfies the + * [unicode_variant_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_variant_subtag) + * syntax requirements, and normalizes the value to lowercase letters. However, + * the Locale class does not impose any syntactic + * restriction on variant. To set an ill-formed variant, use a Locale constructor. + * If there are multiple unicode_variant_subtag, the caller must concatenate + * them with '-' as separator (ex: "foobar-fibar"). + * + * @param variant the variant + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setVariant(StringPiece variant); + + /** + * Sets the extension for the given key. If the value is the empty string, + * the extension is removed. Otherwise, the key and + * value must be well-formed, or else the build() method will + * later report an U_ILLEGAL_ARGUMENT_ERROR. + * + *

Note: The key ('u') is used for the Unicode locale extension. + * Setting a value for this key replaces any existing Unicode locale key/type + * pairs with those defined in the extension. + * + *

Note: The key ('x') is used for the private use code. To be + * well-formed, the value for this key needs only to have subtags of one to + * eight alphanumeric characters, not two to eight as in the general case. + * + * @param key the extension key + * @param value the extension value + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setExtension(char key, StringPiece value); + + /** + * Sets the Unicode locale keyword type for the given key. If the type + * StringPiece is constructed with a nullptr, the keyword is removed. + * If the type is the empty string, the keyword is set without type subtags. + * Otherwise, the key and type must be well-formed, or else the build() + * method will later report an U_ILLEGAL_ARGUMENT_ERROR. + * + *

Keys and types are converted to lower case. + * + *

Note:Setting the 'u' extension via {@link #setExtension} + * replaces all Unicode locale keywords with those defined in the + * extension. + * + * @param key the Unicode locale key + * @param type the Unicode locale type + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setUnicodeLocaleKeyword( + StringPiece key, StringPiece type); + + /** + * Adds a unicode locale attribute, if not already present, otherwise + * has no effect. The attribute must not be empty string and must be + * well-formed or U_ILLEGAL_ARGUMENT_ERROR will be set to status + * during the build() call. + * + * @param attribute the attribute + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& addUnicodeLocaleAttribute(StringPiece attribute); + + /** + * Removes a unicode locale attribute, if present, otherwise has no + * effect. The attribute must not be empty string and must be well-formed + * or U_ILLEGAL_ARGUMENT_ERROR will be set to status during the build() call. + * + *

Attribute comparison for removal is case-insensitive. + * + * @param attribute the attribute + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& removeUnicodeLocaleAttribute(StringPiece attribute); + + /** + * Resets the builder to its initial, empty state. + *

This method clears the internal UErrorCode. + * + * @return this builder + * @stable ICU 64 + */ + LocaleBuilder& clear(); + + /** + * Resets the extensions to their initial, empty state. + * Language, script, region and variant are unchanged. + * + * @return this builder + * @stable ICU 64 + */ + LocaleBuilder& clearExtensions(); + + /** + * Returns an instance of Locale created from the fields set + * on this builder. + * If any set methods or during the build() call require memory allocation + * but fail U_MEMORY_ALLOCATION_ERROR will be set to status. + * If any of the fields set by the setters are not well-formed, the status + * will be set to U_ILLEGAL_ARGUMENT_ERROR. The state of the builder will + * not change after the build() call and the caller is free to keep using + * the same builder to build more locales. + * + * @return a new Locale + * @stable ICU 64 + */ + Locale build(UErrorCode& status); + + /** + * Sets the UErrorCode if an error occurred while recording sets. + * Preserves older error codes in the outErrorCode. + * @param outErrorCode Set to an error code that occurred while setting subtags. + * Unchanged if there is no such error or if outErrorCode + * already contained an error. + * @return true if U_FAILURE(outErrorCode) + * @stable ICU 65 + */ + UBool copyErrorTo(UErrorCode &outErrorCode) const; + +private: + friend class LocaleMatcher::Result; + + void copyExtensionsFrom(const Locale& src, UErrorCode& errorCode); + + UErrorCode status_; + char language_[9]; + char script_[5]; + char region_[4]; + CharString *variant_; // Pointer not object so we need not #include internal charstr.h. + icu::Locale *extensions_; // Pointer not object. Storage for all other fields. + +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __LOCALEBUILDER_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/localematcher.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/localematcher.h new file mode 100644 index 0000000000000000000000000000000000000000..0cd068ef32805b630165b220a02c3fc9d8bc0d32 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/localematcher.h @@ -0,0 +1,714 @@ +// © 2019 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// localematcher.h +// created: 2019may08 Markus W. Scherer + +#ifndef __LOCALEMATCHER_H__ +#define __LOCALEMATCHER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/locid.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Locale matcher: User's desired locales vs. application's supported locales. + */ + +/** + * Builder option for whether the language subtag or the script subtag is most important. + * + * @see LocaleMatcher::Builder#setFavorSubtag(ULocMatchFavorSubtag) + * @stable ICU 65 + */ +enum ULocMatchFavorSubtag { + /** + * Language differences are most important, then script differences, then region differences. + * (This is the default behavior.) + * + * @stable ICU 65 + */ + ULOCMATCH_FAVOR_LANGUAGE, + /** + * Makes script differences matter relatively more than language differences. + * + * @stable ICU 65 + */ + ULOCMATCH_FAVOR_SCRIPT +}; +#ifndef U_IN_DOXYGEN +typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag; +#endif + +/** + * Builder option for whether all desired locales are treated equally or + * earlier ones are preferred. + * + * @see LocaleMatcher::Builder#setDemotionPerDesiredLocale(ULocMatchDemotion) + * @stable ICU 65 + */ +enum ULocMatchDemotion { + /** + * All desired locales are treated equally. + * + * @stable ICU 65 + */ + ULOCMATCH_DEMOTION_NONE, + /** + * Earlier desired locales are preferred. + * + *

From each desired locale to the next, + * the distance to any supported locale is increased by an additional amount + * which is at least as large as most region mismatches. + * A later desired locale has to have a better match with some supported locale + * due to more than merely having the same region subtag. + * + *

For example: Supported={en, sv} desired=[en-GB, sv] + * yields Result(en-GB, en) because + * with the demotion of sv its perfect match is no better than + * the region distance between the earlier desired locale en-GB and en=en-US. + * + *

Notes: + *

    + *
  • In some cases, language and/or script differences can be as small as + * the typical region difference. (Example: sr-Latn vs. sr-Cyrl) + *
  • It is possible for certain region differences to be larger than usual, + * and larger than the demotion. + * (As of CLDR 35 there is no such case, but + * this is possible in future versions of the data.) + *
+ * + * @stable ICU 65 + */ + ULOCMATCH_DEMOTION_REGION +}; +#ifndef U_IN_DOXYGEN +typedef enum ULocMatchDemotion ULocMatchDemotion; +#endif + +/** + * Builder option for whether to include or ignore one-way (fallback) match data. + * The LocaleMatcher uses CLDR languageMatch data which includes fallback (oneway=true) entries. + * Sometimes it is desirable to ignore those. + * + *

For example, consider a web application with the UI in a given language, + * with a link to another, related web app. + * The link should include the UI language, and the target server may also use + * the client’s Accept-Language header data. + * The target server has its own list of supported languages. + * One may want to favor UI language consistency, that is, + * if there is a decent match for the original UI language, we want to use it, + * but not if it is merely a fallback. + * + * @see LocaleMatcher::Builder#setDirection(ULocMatchDirection) + * @stable ICU 67 + */ +enum ULocMatchDirection { + /** + * Locale matching includes one-way matches such as Breton→French. (default) + * + * @stable ICU 67 + */ + ULOCMATCH_DIRECTION_WITH_ONE_WAY, + /** + * Locale matching limited to two-way matches including e.g. Danish↔Norwegian + * but ignoring one-way matches. + * + * @stable ICU 67 + */ + ULOCMATCH_DIRECTION_ONLY_TWO_WAY +}; +#ifndef U_IN_DOXYGEN +typedef enum ULocMatchDirection ULocMatchDirection; +#endif + +struct UHashtable; + +U_NAMESPACE_BEGIN + +struct LSR; + +class LocaleDistance; +class LocaleLsrIterator; +class UVector; +class XLikelySubtags; + +/** + * Immutable class that picks the best match between a user's desired locales and + * an application's supported locales. + * Movable but not copyable. + * + *

Example: + *

+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * LocaleMatcher matcher = LocaleMatcher::Builder().setSupportedLocales("fr, en-GB, en").build(errorCode);
+ * Locale *bestSupported = matcher.getBestLocale(Locale.US, errorCode);  // "en"
+ * 
+ * + *

A matcher takes into account when languages are close to one another, + * such as Danish and Norwegian, + * and when regional variants are close, like en-GB and en-AU as opposed to en-US. + * + *

If there are multiple supported locales with the same (language, script, region) + * likely subtags, then the current implementation returns the first of those locales. + * It ignores variant subtags (except for pseudolocale variants) and extensions. + * This may change in future versions. + * + *

For example, the current implementation does not distinguish between + * de, de-DE, de-Latn, de-1901, de-u-co-phonebk. + * + *

If you prefer one equivalent locale over another, then provide only the preferred one, + * or place it earlier in the list of supported locales. + * + *

Otherwise, the order of supported locales may have no effect on the best-match results. + * The current implementation compares each desired locale with supported locales + * in the following order: + * 1. Default locale, if supported; + * 2. CLDR "paradigm locales" like en-GB and es-419; + * 3. other supported locales. + * This may change in future versions. + * + *

Often a product will just need one matcher instance, built with the languages + * that it supports. However, it may want multiple instances with different + * default languages based on additional information, such as the domain. + * + *

This class is not intended for public subclassing. + * + * @stable ICU 65 + */ +class U_COMMON_API LocaleMatcher : public UMemory { +public: + /** + * Data for the best-matching pair of a desired and a supported locale. + * Movable but not copyable. + * + * @stable ICU 65 + */ + class U_COMMON_API Result : public UMemory { + public: + /** + * Move constructor; might modify the source. + * This object will have the same contents that the source object had. + * + * @param src Result to move contents from. + * @stable ICU 65 + */ + Result(Result &&src) U_NOEXCEPT; + + /** + * Destructor. + * + * @stable ICU 65 + */ + ~Result(); + + /** + * Move assignment; might modify the source. + * This object will have the same contents that the source object had. + * + * @param src Result to move contents from. + * @stable ICU 65 + */ + Result &operator=(Result &&src) U_NOEXCEPT; + + /** + * Returns the best-matching desired locale. + * nullptr if the list of desired locales is empty or if none matched well enough. + * + * @return the best-matching desired locale, or nullptr. + * @stable ICU 65 + */ + inline const Locale *getDesiredLocale() const { return desiredLocale; } + + /** + * Returns the best-matching supported locale. + * If none matched well enough, this is the default locale. + * The default locale is nullptr if Builder::setNoDefaultLocale() was called, + * or if the list of supported locales is empty and no explicit default locale is set. + * + * @return the best-matching supported locale, or nullptr. + * @stable ICU 65 + */ + inline const Locale *getSupportedLocale() const { return supportedLocale; } + + /** + * Returns the index of the best-matching desired locale in the input Iterable order. + * -1 if the list of desired locales is empty or if none matched well enough. + * + * @return the index of the best-matching desired locale, or -1. + * @stable ICU 65 + */ + inline int32_t getDesiredIndex() const { return desiredIndex; } + + /** + * Returns the index of the best-matching supported locale in the + * constructor’s or builder’s input order (“set” Collection plus “added” locales). + * If the matcher was built from a locale list string, then the iteration order is that + * of a LocalePriorityList built from the same string. + * -1 if the list of supported locales is empty or if none matched well enough. + * + * @return the index of the best-matching supported locale, or -1. + * @stable ICU 65 + */ + inline int32_t getSupportedIndex() const { return supportedIndex; } + + /** + * Takes the best-matching supported locale and adds relevant fields of the + * best-matching desired locale, such as the -t- and -u- extensions. + * May replace some fields of the supported locale. + * The result is the locale that should be used for date and number formatting, collation, etc. + * Returns the root locale if getSupportedLocale() returns nullptr. + * + *

Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn + * + * @return a locale combining the best-matching desired and supported locales. + * @stable ICU 65 + */ + Locale makeResolvedLocale(UErrorCode &errorCode) const; + + private: + Result(const Locale *desired, const Locale *supported, + int32_t desIndex, int32_t suppIndex, UBool owned) : + desiredLocale(desired), supportedLocale(supported), + desiredIndex(desIndex), supportedIndex(suppIndex), + desiredIsOwned(owned) {} + + Result(const Result &other) = delete; + Result &operator=(const Result &other) = delete; + + const Locale *desiredLocale; + const Locale *supportedLocale; + int32_t desiredIndex; + int32_t supportedIndex; + UBool desiredIsOwned; + + friend class LocaleMatcher; + }; + + /** + * LocaleMatcher builder. + * Movable but not copyable. + * + * @stable ICU 65 + */ + class U_COMMON_API Builder : public UMemory { + public: + /** + * Constructs a builder used in chaining parameters for building a LocaleMatcher. + * + * @return a new Builder object + * @stable ICU 65 + */ + Builder() {} + + /** + * Move constructor; might modify the source. + * This builder will have the same contents that the source builder had. + * + * @param src Builder to move contents from. + * @stable ICU 65 + */ + Builder(Builder &&src) U_NOEXCEPT; + + /** + * Destructor. + * + * @stable ICU 65 + */ + ~Builder(); + + /** + * Move assignment; might modify the source. + * This builder will have the same contents that the source builder had. + * + * @param src Builder to move contents from. + * @stable ICU 65 + */ + Builder &operator=(Builder &&src) U_NOEXCEPT; + + /** + * Parses an Accept-Language string + * (RFC 2616 Section 14.4), + * such as "af, en, fr;q=0.9", and sets the supported locales accordingly. + * Allows whitespace in more places but does not allow "*". + * Clears any previously set/added supported locales first. + * + * @param locales the Accept-Language string of locales to set + * @return this Builder object + * @stable ICU 65 + */ + Builder &setSupportedLocalesFromListString(StringPiece locales); + + /** + * Copies the supported locales, preserving iteration order. + * Clears any previously set/added supported locales first. + * Duplicates are allowed, and are not removed. + * + * @param locales the list of locale + * @return this Builder object + * @stable ICU 65 + */ + Builder &setSupportedLocales(Locale::Iterator &locales); + + /** + * Copies the supported locales from the begin/end range, preserving iteration order. + * Clears any previously set/added supported locales first. + * Duplicates are allowed, and are not removed. + * + * Each of the iterator parameter values must be an + * input iterator whose value is convertible to const Locale &. + * + * @param begin Start of range. + * @param end Exclusive end of range. + * @return this Builder object + * @stable ICU 65 + */ + template + Builder &setSupportedLocales(Iter begin, Iter end) { + if (U_FAILURE(errorCode_)) { return *this; } + clearSupportedLocales(); + while (begin != end) { + addSupportedLocale(*begin++); + } + return *this; + } + + /** + * Copies the supported locales from the begin/end range, preserving iteration order. + * Calls the converter to convert each *begin to a Locale or const Locale &. + * Clears any previously set/added supported locales first. + * Duplicates are allowed, and are not removed. + * + * Each of the iterator parameter values must be an + * input iterator whose value is convertible to const Locale &. + * + * @param begin Start of range. + * @param end Exclusive end of range. + * @param converter Converter from *begin to const Locale & or compatible. + * @return this Builder object + * @stable ICU 65 + */ + template + Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) { + if (U_FAILURE(errorCode_)) { return *this; } + clearSupportedLocales(); + while (begin != end) { + addSupportedLocale(converter(*begin++)); + } + return *this; + } + + /** + * Adds another supported locale. + * Duplicates are allowed, and are not removed. + * + * @param locale another locale + * @return this Builder object + * @stable ICU 65 + */ + Builder &addSupportedLocale(const Locale &locale); + +#ifndef U_HIDE_DRAFT_API + /** + * Sets no default locale. + * There will be no explicit or implicit default locale. + * If there is no good match, then the matcher will return nullptr for the + * best supported locale. + * + * @draft ICU 68 + */ + Builder &setNoDefaultLocale(); +#endif // U_HIDE_DRAFT_API + + /** + * Sets the default locale; if nullptr, or if it is not set explicitly, + * then the first supported locale is used as the default locale. + * There is no default locale at all (nullptr will be returned instead) + * if setNoDefaultLocale() is called. + * + * @param defaultLocale the default locale (will be copied) + * @return this Builder object + * @stable ICU 65 + */ + Builder &setDefaultLocale(const Locale *defaultLocale); + + /** + * If ULOCMATCH_FAVOR_SCRIPT, then the language differences are smaller than script + * differences. + * This is used in situations (such as maps) where + * it is better to fall back to the same script than a similar language. + * + * @param subtag the subtag to favor + * @return this Builder object + * @stable ICU 65 + */ + Builder &setFavorSubtag(ULocMatchFavorSubtag subtag); + + /** + * Option for whether all desired locales are treated equally or + * earlier ones are preferred (this is the default). + * + * @param demotion the demotion per desired locale to set. + * @return this Builder object + * @stable ICU 65 + */ + Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion); + + /** + * Option for whether to include or ignore one-way (fallback) match data. + * By default, they are included. + * + * @param direction the match direction to set. + * @return this Builder object + * @stable ICU 67 + */ + Builder &setDirection(ULocMatchDirection direction) { + if (U_SUCCESS(errorCode_)) { + direction_ = direction; + } + return *this; + } + +#ifndef U_HIDE_DRAFT_API + /** + * Sets the maximum distance for an acceptable match. + * The matcher will return a match for a pair of locales only if + * they match at least as well as the pair given here. + * + * For example, setMaxDistance(en-US, en-GB) limits matches to ones where the + * (desired, support) locales have a distance no greater than a region subtag difference. + * This is much stricter than the CLDR default. + * + * The details of locale matching are subject to changes in + * CLDR data and in the algorithm. + * Specifying a maximum distance in relative terms via a sample pair of locales + * insulates from changes that affect all distance metrics similarly, + * but some changes will necessarily affect relative distances between + * different pairs of locales. + * + * @param desired the desired locale for distance comparison. + * @param supported the supported locale for distance comparison. + * @return this Builder object + * @draft ICU 68 + */ + Builder &setMaxDistance(const Locale &desired, const Locale &supported); +#endif // U_HIDE_DRAFT_API + + /** + * Sets the UErrorCode if an error occurred while setting parameters. + * Preserves older error codes in the outErrorCode. + * + * @param outErrorCode Set to an error code if it does not contain one already + * and an error occurred while setting parameters. + * Otherwise unchanged. + * @return true if U_FAILURE(outErrorCode) + * @stable ICU 65 + */ + UBool copyErrorTo(UErrorCode &outErrorCode) const; + + /** + * Builds and returns a new locale matcher. + * This builder can continue to be used. + * + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return LocaleMatcher + * @stable ICU 65 + */ + LocaleMatcher build(UErrorCode &errorCode) const; + + private: + friend class LocaleMatcher; + + Builder(const Builder &other) = delete; + Builder &operator=(const Builder &other) = delete; + + void clearSupportedLocales(); + bool ensureSupportedLocaleVector(); + + UErrorCode errorCode_ = U_ZERO_ERROR; + UVector *supportedLocales_ = nullptr; + int32_t thresholdDistance_ = -1; + ULocMatchDemotion demotion_ = ULOCMATCH_DEMOTION_REGION; + Locale *defaultLocale_ = nullptr; + bool withDefault_ = true; + ULocMatchFavorSubtag favor_ = ULOCMATCH_FAVOR_LANGUAGE; + ULocMatchDirection direction_ = ULOCMATCH_DIRECTION_WITH_ONE_WAY; + Locale *maxDistanceDesired_ = nullptr; + Locale *maxDistanceSupported_ = nullptr; + }; + + // FYI No public LocaleMatcher constructors in C++; use the Builder. + + /** + * Move copy constructor; might modify the source. + * This matcher will have the same settings that the source matcher had. + * @param src source matcher + * @stable ICU 65 + */ + LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT; + + /** + * Destructor. + * @stable ICU 65 + */ + ~LocaleMatcher(); + + /** + * Move assignment operator; might modify the source. + * This matcher will have the same settings that the source matcher had. + * The behavior is undefined if *this and src are the same object. + * @param src source matcher + * @return *this + * @stable ICU 65 + */ + LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT; + + /** + * Returns the supported locale which best matches the desired locale. + * + * @param desiredLocale Typically a user's language. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching supported locale. + * @stable ICU 65 + */ + const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const; + + /** + * Returns the supported locale which best matches one of the desired locales. + * + * @param desiredLocales Typically a user's languages, in order of preference (descending). + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching supported locale. + * @stable ICU 65 + */ + const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; + + /** + * Parses an Accept-Language string + * (RFC 2616 Section 14.4), + * such as "af, en, fr;q=0.9", + * and returns the supported locale which best matches one of the desired locales. + * Allows whitespace in more places but does not allow "*". + * + * @param desiredLocaleList Typically a user's languages, as an Accept-Language string. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching supported locale. + * @stable ICU 65 + */ + const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const; + + /** + * Returns the best match between the desired locale and the supported locales. + * If the result's desired locale is not nullptr, then it is the address of the input locale. + * It has not been cloned. + * + * @param desiredLocale Typically a user's language. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching pair of the desired and a supported locale. + * @stable ICU 65 + */ + Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const; + + /** + * Returns the best match between the desired and supported locales. + * If the result's desired locale is not nullptr, then it is a clone of + * the best-matching desired locale. The Result object owns the clone. + * + * @param desiredLocales Typically a user's languages, in order of preference (descending). + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching pair of a desired and a supported locale. + * @stable ICU 65 + */ + Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; + +#ifndef U_HIDE_DRAFT_API + /** + * Returns true if the pair of locales matches acceptably. + * This is influenced by Builder options such as setDirection(), setFavorSubtag(), + * and setMaxDistance(). + * + * @param desired The desired locale. + * @param supported The supported locale. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return true if the pair of locales matches acceptably. + * @draft ICU 68 + */ + UBool isMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const; +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_INTERNAL_API + /** + * Returns a fraction between 0 and 1, where 1 means that the languages are a + * perfect match, and 0 means that they are completely different. + * + *

This is mostly an implementation detail, and the precise values may change over time. + * The implementation may use either the maximized forms or the others ones, or both. + * The implementation may or may not rely on the forms to be consistent with each other. + * + *

Callers should construct and use a matcher rather than match pairs of locales directly. + * + * @param desired Desired locale. + * @param supported Supported locale. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return value between 0 and 1, inclusive. + * @internal (has a known user) + */ + double internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const; +#endif // U_HIDE_INTERNAL_API + +private: + LocaleMatcher(const Builder &builder, UErrorCode &errorCode); + LocaleMatcher(const LocaleMatcher &other) = delete; + LocaleMatcher &operator=(const LocaleMatcher &other) = delete; + + int32_t putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength, UErrorCode &errorCode); + + int32_t getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter, UErrorCode &errorCode) const; + + const XLikelySubtags &likelySubtags; + const LocaleDistance &localeDistance; + int32_t thresholdDistance; + int32_t demotionPerDesiredLocale; + ULocMatchFavorSubtag favorSubtag; + ULocMatchDirection direction; + + // These are in input order. + const Locale ** supportedLocales; + LSR *lsrs; + int32_t supportedLocalesLength; + // These are in preference order: 1. Default locale 2. paradigm locales 3. others. + UHashtable *supportedLsrToIndex; // Map + // Array versions of the supportedLsrToIndex keys and values. + // The distance lookup loops over the supportedLSRs and returns the index of the best match. + const LSR **supportedLSRs; + int32_t *supportedIndexes; + int32_t supportedLSRsLength; + Locale *ownedDefaultLocale; + const Locale *defaultLocale; +}; + +U_NAMESPACE_END + +#endif // U_SHOW_CPLUSPLUS_API +#endif // __LOCALEMATCHER_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/localpointer.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/localpointer.h new file mode 100644 index 0000000000000000000000000000000000000000..2a65f2d382d2d866049dd50b32c1eb4e3cd76fe0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/localpointer.h @@ -0,0 +1,595 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: localpointer.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009nov13 +* created by: Markus W. Scherer +*/ + +#ifndef __LOCALPOINTER_H__ +#define __LOCALPOINTER_H__ + +/** + * \file + * \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code. + * + * These classes are inspired by + * - std::auto_ptr + * - boost::scoped_ptr & boost::scoped_array + * - Taligent Safe Pointers (TOnlyPointerTo) + * + * but none of those provide for all of the goals for ICU smart pointers: + * - Smart pointer owns the object and releases it when it goes out of scope. + * - No transfer of ownership via copy/assignment to reduce misuse. Simpler & more robust. + * - ICU-compatible: No exceptions. + * - Need to be able to orphan/release the pointer and its ownership. + * - Need variants for normal C++ object pointers, C++ arrays, and ICU C service objects. + * + * For details see http://site.icu-project.org/design/cpp/scoped_ptr + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include + +U_NAMESPACE_BEGIN + +/** + * "Smart pointer" base class; do not use directly: use LocalPointer etc. + * + * Base class for smart pointer classes that do not throw exceptions. + * + * Do not use this base class directly, since it does not delete its pointer. + * A subclass must implement methods that delete the pointer: + * Destructor and adoptInstead(). + * + * There is no operator T *() provided because the programmer must decide + * whether to use getAlias() (without transfer of ownership) or orphan() + * (with transfer of ownership and NULLing of the pointer). + * + * @see LocalPointer + * @see LocalArray + * @see U_DEFINE_LOCAL_OPEN_POINTER + * @stable ICU 4.4 + */ +template +class LocalPointerBase { +public: + // No heap allocation. Use only on the stack. + static void* U_EXPORT2 operator new(size_t) = delete; + static void* U_EXPORT2 operator new[](size_t) = delete; +#if U_HAVE_PLACEMENT_NEW + static void* U_EXPORT2 operator new(size_t, void*) = delete; +#endif + + /** + * Constructor takes ownership. + * @param p simple pointer to an object that is adopted + * @stable ICU 4.4 + */ + explicit LocalPointerBase(T *p=NULL) : ptr(p) {} + /** + * Destructor deletes the object it owns. + * Subclass must override: Base class does nothing. + * @stable ICU 4.4 + */ + ~LocalPointerBase() { /* delete ptr; */ } + /** + * NULL check. + * @return true if ==NULL + * @stable ICU 4.4 + */ + UBool isNull() const { return ptr==NULL; } + /** + * NULL check. + * @return true if !=NULL + * @stable ICU 4.4 + */ + UBool isValid() const { return ptr!=NULL; } + /** + * Comparison with a simple pointer, so that existing code + * with ==NULL need not be changed. + * @param other simple pointer for comparison + * @return true if this pointer value equals other + * @stable ICU 4.4 + */ + bool operator==(const T *other) const { return ptr==other; } + /** + * Comparison with a simple pointer, so that existing code + * with !=NULL need not be changed. + * @param other simple pointer for comparison + * @return true if this pointer value differs from other + * @stable ICU 4.4 + */ + bool operator!=(const T *other) const { return ptr!=other; } + /** + * Access without ownership change. + * @return the pointer value + * @stable ICU 4.4 + */ + T *getAlias() const { return ptr; } + /** + * Access without ownership change. + * @return the pointer value as a reference + * @stable ICU 4.4 + */ + T &operator*() const { return *ptr; } + /** + * Access without ownership change. + * @return the pointer value + * @stable ICU 4.4 + */ + T *operator->() const { return ptr; } + /** + * Gives up ownership; the internal pointer becomes NULL. + * @return the pointer value; + * caller becomes responsible for deleting the object + * @stable ICU 4.4 + */ + T *orphan() { + T *p=ptr; + ptr=NULL; + return p; + } + /** + * Deletes the object it owns, + * and adopts (takes ownership of) the one passed in. + * Subclass must override: Base class does not delete the object. + * @param p simple pointer to an object that is adopted + * @stable ICU 4.4 + */ + void adoptInstead(T *p) { + // delete ptr; + ptr=p; + } +protected: + /** + * Actual pointer. + * @internal + */ + T *ptr; +private: + // No comparison operators with other LocalPointerBases. + bool operator==(const LocalPointerBase &other); + bool operator!=(const LocalPointerBase &other); + // No ownership sharing: No copy constructor, no assignment operator. + LocalPointerBase(const LocalPointerBase &other); + void operator=(const LocalPointerBase &other); +}; + +/** + * "Smart pointer" class, deletes objects via the standard C++ delete operator. + * For most methods see the LocalPointerBase base class. + * + * Usage example: + * \code + * LocalPointer s(new UnicodeString((UChar32)0x50005)); + * int32_t length=s->length(); // 2 + * char16_t lead=s->charAt(0); // 0xd900 + * if(some condition) { return; } // no need to explicitly delete the pointer + * s.adoptInstead(new UnicodeString((char16_t)0xfffc)); + * length=s->length(); // 1 + * // no need to explicitly delete the pointer + * \endcode + * + * @see LocalPointerBase + * @stable ICU 4.4 + */ +template +class LocalPointer : public LocalPointerBase { +public: + using LocalPointerBase::operator*; + using LocalPointerBase::operator->; + /** + * Constructor takes ownership. + * @param p simple pointer to an object that is adopted + * @stable ICU 4.4 + */ + explicit LocalPointer(T *p=NULL) : LocalPointerBase(p) {} + /** + * Constructor takes ownership and reports an error if NULL. + * + * This constructor is intended to be used with other-class constructors + * that may report a failure UErrorCode, + * so that callers need to check only for U_FAILURE(errorCode) + * and not also separately for isNull(). + * + * @param p simple pointer to an object that is adopted + * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR + * if p==NULL and no other failure code had been set + * @stable ICU 55 + */ + LocalPointer(T *p, UErrorCode &errorCode) : LocalPointerBase(p) { + if(p==NULL && U_SUCCESS(errorCode)) { + errorCode=U_MEMORY_ALLOCATION_ERROR; + } + } + /** + * Move constructor, leaves src with isNull(). + * @param src source smart pointer + * @stable ICU 56 + */ + LocalPointer(LocalPointer &&src) U_NOEXCEPT : LocalPointerBase(src.ptr) { + src.ptr=NULL; + } + + /** + * Constructs a LocalPointer from a C++11 std::unique_ptr. + * The LocalPointer steals the object owned by the std::unique_ptr. + * + * This constructor works via move semantics. If your std::unique_ptr is + * in a local variable, you must use std::move. + * + * @param p The std::unique_ptr from which the pointer will be stolen. + * @stable ICU 64 + */ + explicit LocalPointer(std::unique_ptr &&p) + : LocalPointerBase(p.release()) {} + + /** + * Destructor deletes the object it owns. + * @stable ICU 4.4 + */ + ~LocalPointer() { + delete LocalPointerBase::ptr; + } + /** + * Move assignment operator, leaves src with isNull(). + * The behavior is undefined if *this and src are the same object. + * @param src source smart pointer + * @return *this + * @stable ICU 56 + */ + LocalPointer &operator=(LocalPointer &&src) U_NOEXCEPT { + delete LocalPointerBase::ptr; + LocalPointerBase::ptr=src.ptr; + src.ptr=NULL; + return *this; + } + + /** + * Move-assign from an std::unique_ptr to this LocalPointer. + * Steals the pointer from the std::unique_ptr. + * + * @param p The std::unique_ptr from which the pointer will be stolen. + * @return *this + * @stable ICU 64 + */ + LocalPointer &operator=(std::unique_ptr &&p) U_NOEXCEPT { + adoptInstead(p.release()); + return *this; + } + + /** + * Swap pointers. + * @param other other smart pointer + * @stable ICU 56 + */ + void swap(LocalPointer &other) U_NOEXCEPT { + T *temp=LocalPointerBase::ptr; + LocalPointerBase::ptr=other.ptr; + other.ptr=temp; + } + /** + * Non-member LocalPointer swap function. + * @param p1 will get p2's pointer + * @param p2 will get p1's pointer + * @stable ICU 56 + */ + friend inline void swap(LocalPointer &p1, LocalPointer &p2) U_NOEXCEPT { + p1.swap(p2); + } + /** + * Deletes the object it owns, + * and adopts (takes ownership of) the one passed in. + * @param p simple pointer to an object that is adopted + * @stable ICU 4.4 + */ + void adoptInstead(T *p) { + delete LocalPointerBase::ptr; + LocalPointerBase::ptr=p; + } + /** + * Deletes the object it owns, + * and adopts (takes ownership of) the one passed in. + * + * If U_FAILURE(errorCode), then the current object is retained and the new one deleted. + * + * If U_SUCCESS(errorCode) but the input pointer is NULL, + * then U_MEMORY_ALLOCATION_ERROR is set, + * the current object is deleted, and NULL is set. + * + * @param p simple pointer to an object that is adopted + * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR + * if p==NULL and no other failure code had been set + * @stable ICU 55 + */ + void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) { + if(U_SUCCESS(errorCode)) { + delete LocalPointerBase::ptr; + LocalPointerBase::ptr=p; + if(p==NULL) { + errorCode=U_MEMORY_ALLOCATION_ERROR; + } + } else { + delete p; + } + } + + /** + * Conversion operator to a C++11 std::unique_ptr. + * Disowns the object and gives it to the returned std::unique_ptr. + * + * This operator works via move semantics. If your LocalPointer is + * in a local variable, you must use std::move. + * + * @return An std::unique_ptr owning the pointer previously owned by this + * icu::LocalPointer. + * @stable ICU 64 + */ + operator std::unique_ptr () && { + return std::unique_ptr(LocalPointerBase::orphan()); + } +}; + +/** + * "Smart pointer" class, deletes objects via the C++ array delete[] operator. + * For most methods see the LocalPointerBase base class. + * Adds operator[] for array item access. + * + * Usage example: + * \code + * LocalArray a(new UnicodeString[2]); + * a[0].append((char16_t)0x61); + * if(some condition) { return; } // no need to explicitly delete the array + * a.adoptInstead(new UnicodeString[4]); + * a[3].append((char16_t)0x62).append((char16_t)0x63).reverse(); + * // no need to explicitly delete the array + * \endcode + * + * @see LocalPointerBase + * @stable ICU 4.4 + */ +template +class LocalArray : public LocalPointerBase { +public: + using LocalPointerBase::operator*; + using LocalPointerBase::operator->; + /** + * Constructor takes ownership. + * @param p simple pointer to an array of T objects that is adopted + * @stable ICU 4.4 + */ + explicit LocalArray(T *p=NULL) : LocalPointerBase(p) {} + /** + * Constructor takes ownership and reports an error if NULL. + * + * This constructor is intended to be used with other-class constructors + * that may report a failure UErrorCode, + * so that callers need to check only for U_FAILURE(errorCode) + * and not also separately for isNull(). + * + * @param p simple pointer to an array of T objects that is adopted + * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR + * if p==NULL and no other failure code had been set + * @stable ICU 56 + */ + LocalArray(T *p, UErrorCode &errorCode) : LocalPointerBase(p) { + if(p==NULL && U_SUCCESS(errorCode)) { + errorCode=U_MEMORY_ALLOCATION_ERROR; + } + } + /** + * Move constructor, leaves src with isNull(). + * @param src source smart pointer + * @stable ICU 56 + */ + LocalArray(LocalArray &&src) U_NOEXCEPT : LocalPointerBase(src.ptr) { + src.ptr=NULL; + } + + /** + * Constructs a LocalArray from a C++11 std::unique_ptr of an array type. + * The LocalPointer steals the array owned by the std::unique_ptr. + * + * This constructor works via move semantics. If your std::unique_ptr is + * in a local variable, you must use std::move. + * + * @param p The std::unique_ptr from which the array will be stolen. + * @stable ICU 64 + */ + explicit LocalArray(std::unique_ptr &&p) + : LocalPointerBase(p.release()) {} + + /** + * Destructor deletes the array it owns. + * @stable ICU 4.4 + */ + ~LocalArray() { + delete[] LocalPointerBase::ptr; + } + /** + * Move assignment operator, leaves src with isNull(). + * The behavior is undefined if *this and src are the same object. + * @param src source smart pointer + * @return *this + * @stable ICU 56 + */ + LocalArray &operator=(LocalArray &&src) U_NOEXCEPT { + delete[] LocalPointerBase::ptr; + LocalPointerBase::ptr=src.ptr; + src.ptr=NULL; + return *this; + } + + /** + * Move-assign from an std::unique_ptr to this LocalPointer. + * Steals the array from the std::unique_ptr. + * + * @param p The std::unique_ptr from which the array will be stolen. + * @return *this + * @stable ICU 64 + */ + LocalArray &operator=(std::unique_ptr &&p) U_NOEXCEPT { + adoptInstead(p.release()); + return *this; + } + + /** + * Swap pointers. + * @param other other smart pointer + * @stable ICU 56 + */ + void swap(LocalArray &other) U_NOEXCEPT { + T *temp=LocalPointerBase::ptr; + LocalPointerBase::ptr=other.ptr; + other.ptr=temp; + } + /** + * Non-member LocalArray swap function. + * @param p1 will get p2's pointer + * @param p2 will get p1's pointer + * @stable ICU 56 + */ + friend inline void swap(LocalArray &p1, LocalArray &p2) U_NOEXCEPT { + p1.swap(p2); + } + /** + * Deletes the array it owns, + * and adopts (takes ownership of) the one passed in. + * @param p simple pointer to an array of T objects that is adopted + * @stable ICU 4.4 + */ + void adoptInstead(T *p) { + delete[] LocalPointerBase::ptr; + LocalPointerBase::ptr=p; + } + /** + * Deletes the array it owns, + * and adopts (takes ownership of) the one passed in. + * + * If U_FAILURE(errorCode), then the current array is retained and the new one deleted. + * + * If U_SUCCESS(errorCode) but the input pointer is NULL, + * then U_MEMORY_ALLOCATION_ERROR is set, + * the current array is deleted, and NULL is set. + * + * @param p simple pointer to an array of T objects that is adopted + * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR + * if p==NULL and no other failure code had been set + * @stable ICU 56 + */ + void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) { + if(U_SUCCESS(errorCode)) { + delete[] LocalPointerBase::ptr; + LocalPointerBase::ptr=p; + if(p==NULL) { + errorCode=U_MEMORY_ALLOCATION_ERROR; + } + } else { + delete[] p; + } + } + /** + * Array item access (writable). + * No index bounds check. + * @param i array index + * @return reference to the array item + * @stable ICU 4.4 + */ + T &operator[](ptrdiff_t i) const { return LocalPointerBase::ptr[i]; } + + /** + * Conversion operator to a C++11 std::unique_ptr. + * Disowns the object and gives it to the returned std::unique_ptr. + * + * This operator works via move semantics. If your LocalPointer is + * in a local variable, you must use std::move. + * + * @return An std::unique_ptr owning the pointer previously owned by this + * icu::LocalPointer. + * @stable ICU 64 + */ + operator std::unique_ptr () && { + return std::unique_ptr(LocalPointerBase::orphan()); + } +}; + +/** + * \def U_DEFINE_LOCAL_OPEN_POINTER + * "Smart pointer" definition macro, deletes objects via the closeFunction. + * Defines a subclass of LocalPointerBase which works just + * like LocalPointer except that this subclass will use the closeFunction + * rather than the C++ delete operator. + * + * Usage example: + * \code + * LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode)); + * utf8OutLength=ucasemap_utf8ToLower(csm.getAlias(), + * utf8Out, (int32_t)sizeof(utf8Out), + * utf8In, utf8InLength, &errorCode); + * if(U_FAILURE(errorCode)) { return; } // no need to explicitly delete the UCaseMap + * \endcode + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \ + class LocalPointerClassName : public LocalPointerBase { \ + public: \ + using LocalPointerBase::operator*; \ + using LocalPointerBase::operator->; \ + explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase(p) {} \ + LocalPointerClassName(LocalPointerClassName &&src) U_NOEXCEPT \ + : LocalPointerBase(src.ptr) { \ + src.ptr=NULL; \ + } \ + /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \ + explicit LocalPointerClassName(std::unique_ptr &&p) \ + : LocalPointerBase(p.release()) {} \ + ~LocalPointerClassName() { if (ptr != NULL) { closeFunction(ptr); } } \ + LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \ + if (ptr != NULL) { closeFunction(ptr); } \ + LocalPointerBase::ptr=src.ptr; \ + src.ptr=NULL; \ + return *this; \ + } \ + /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \ + LocalPointerClassName &operator=(std::unique_ptr &&p) { \ + adoptInstead(p.release()); \ + return *this; \ + } \ + void swap(LocalPointerClassName &other) U_NOEXCEPT { \ + Type *temp=LocalPointerBase::ptr; \ + LocalPointerBase::ptr=other.ptr; \ + other.ptr=temp; \ + } \ + friend inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) U_NOEXCEPT { \ + p1.swap(p2); \ + } \ + void adoptInstead(Type *p) { \ + if (ptr != NULL) { closeFunction(ptr); } \ + ptr=p; \ + } \ + operator std::unique_ptr () && { \ + return std::unique_ptr(LocalPointerBase::orphan(), closeFunction); \ + } \ + } + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ +#endif /* __LOCALPOINTER_H__ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/locdspnm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/locdspnm.h new file mode 100644 index 0000000000000000000000000000000000000000..4f06f857044c6e9bf5119122394bd2458f760919 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/locdspnm.h @@ -0,0 +1,211 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2010-2016, International Business Machines Corporation and +* others. All Rights Reserved. +****************************************************************************** +*/ + +#ifndef LOCDSPNM_H +#define LOCDSPNM_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief C++ API: Provides display names of Locale and its components. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/locid.h" +#include "unicode/strenum.h" +#include "unicode/uscript.h" +#include "unicode/uldnames.h" +#include "unicode/udisplaycontext.h" + +U_NAMESPACE_BEGIN + +/** + * Returns display names of Locales and components of Locales. For + * more information on language, script, region, variant, key, and + * values, see Locale. + * @stable ICU 4.4 + */ +class U_COMMON_API LocaleDisplayNames : public UObject { +public: + /** + * Destructor. + * @stable ICU 4.4 + */ + virtual ~LocaleDisplayNames(); + + /** + * Convenience overload of + * {@link #createInstance(const Locale& locale, UDialectHandling dialectHandling)} + * that specifies STANDARD dialect handling. + * @param locale the display locale + * @return a LocaleDisplayNames instance + * @stable ICU 4.4 + */ + inline static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale); + + /** + * Returns an instance of LocaleDisplayNames that returns names + * formatted for the provided locale, using the provided + * dialectHandling. + * + * @param locale the display locale + * @param dialectHandling how to select names for locales + * @return a LocaleDisplayNames instance + * @stable ICU 4.4 + */ + static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale, + UDialectHandling dialectHandling); + + /** + * Returns an instance of LocaleDisplayNames that returns names formatted + * for the provided locale, using the provided UDisplayContext settings. + * + * @param locale the display locale + * @param contexts List of one or more context settings (e.g. for dialect + * handling, capitalization, etc. + * @param length Number of items in the contexts list + * @return a LocaleDisplayNames instance + * @stable ICU 51 + */ + static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale, + UDisplayContext *contexts, int32_t length); + + // getters for state + /** + * Returns the locale used to determine the display names. This is + * not necessarily the same locale passed to {@link #createInstance}. + * @return the display locale + * @stable ICU 4.4 + */ + virtual const Locale& getLocale() const = 0; + + /** + * Returns the dialect handling used in the display names. + * @return the dialect handling enum + * @stable ICU 4.4 + */ + virtual UDialectHandling getDialectHandling() const = 0; + + /** + * Returns the UDisplayContext value for the specified UDisplayContextType. + * @param type the UDisplayContextType whose value to return + * @return the UDisplayContext for the specified type. + * @stable ICU 51 + */ + virtual UDisplayContext getContext(UDisplayContextType type) const = 0; + + // names for entire locales + /** + * Returns the display name of the provided locale. + * @param locale the locale whose display name to return + * @param result receives the locale's display name + * @return the display name of the provided locale + * @stable ICU 4.4 + */ + virtual UnicodeString& localeDisplayName(const Locale& locale, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided locale id. + * @param localeId the id of the locale whose display name to return + * @param result receives the locale's display name + * @return the display name of the provided locale + * @stable ICU 4.4 + */ + virtual UnicodeString& localeDisplayName(const char* localeId, + UnicodeString& result) const = 0; + + // names for components of a locale id + /** + * Returns the display name of the provided language code. + * @param lang the language code + * @param result receives the language code's display name + * @return the display name of the provided language code + * @stable ICU 4.4 + */ + virtual UnicodeString& languageDisplayName(const char* lang, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided script code. + * @param script the script code + * @param result receives the script code's display name + * @return the display name of the provided script code + * @stable ICU 4.4 + */ + virtual UnicodeString& scriptDisplayName(const char* script, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided script code. + * @param scriptCode the script code number + * @param result receives the script code's display name + * @return the display name of the provided script code + * @stable ICU 4.4 + */ + virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided region code. + * @param region the region code + * @param result receives the region code's display name + * @return the display name of the provided region code + * @stable ICU 4.4 + */ + virtual UnicodeString& regionDisplayName(const char* region, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided variant. + * @param variant the variant string + * @param result receives the variant's display name + * @return the display name of the provided variant + * @stable ICU 4.4 + */ + virtual UnicodeString& variantDisplayName(const char* variant, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided locale key. + * @param key the locale key name + * @param result receives the locale key's display name + * @return the display name of the provided locale key + * @stable ICU 4.4 + */ + virtual UnicodeString& keyDisplayName(const char* key, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided value (used with the provided key). + * @param key the locale key name + * @param value the locale key's value + * @param result receives the value's display name + * @return the display name of the provided value + * @stable ICU 4.4 + */ + virtual UnicodeString& keyValueDisplayName(const char* key, const char* value, + UnicodeString& result) const = 0; +}; + +inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) { + return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES); +} + +U_NAMESPACE_END + +#endif + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/locid.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/locid.h new file mode 100644 index 0000000000000000000000000000000000000000..81f4685d65047b9623b19ce624696f8c976ea84f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/locid.h @@ -0,0 +1,1272 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1996-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* File locid.h +* +* Created by: Helena Shih +* +* Modification History: +* +* Date Name Description +* 02/11/97 aliu Changed gLocPath to fgLocPath and added methods to +* get and set it. +* 04/02/97 aliu Made operator!= inline; fixed return value of getName(). +* 04/15/97 aliu Cleanup for AIX/Win32. +* 04/24/97 aliu Numerous changes per code review. +* 08/18/98 stephen Added tokenizeString(),changed getDisplayName() +* 09/08/98 stephen Moved definition of kEmptyString for Mac Port +* 11/09/99 weiv Added const char * getName() const; +* 04/12/00 srl removing unicodestring api's and cached hash code +* 08/10/01 grhoten Change the static Locales to accessor functions +****************************************************************************** +*/ + +#ifndef LOCID_H +#define LOCID_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/bytestream.h" +#include "unicode/localpointer.h" +#include "unicode/strenum.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" +#include "unicode/putil.h" +#include "unicode/uloc.h" + +/** + * \file + * \brief C++ API: Locale ID object. + */ + +U_NAMESPACE_BEGIN + +// Forward Declarations +void U_CALLCONV locale_available_init(); /**< @internal */ + +class StringEnumeration; +class UnicodeString; + +/** + * A Locale object represents a specific geographical, political, + * or cultural region. An operation that requires a Locale to perform + * its task is called locale-sensitive and uses the Locale + * to tailor information for the user. For example, displaying a number + * is a locale-sensitive operation--the number should be formatted + * according to the customs/conventions of the user's native country, + * region, or culture. + * + * The Locale class is not suitable for subclassing. + * + *

+ * You can create a Locale object using the constructor in + * this class: + * \htmlonly

\endhtmlonly + *
+ *       Locale( const   char*  language,
+ *               const   char*  country,
+ *               const   char*  variant);
+ * 
+ * \htmlonly
\endhtmlonly + * The first argument to the constructors is a valid ISO + * Language Code. These codes are the lower-case two-letter + * codes as defined by ISO-639. + * You can find a full list of these codes at: + *
+ * http://www.loc.gov/standards/iso639-2/ + * + *

+ * The second argument to the constructors is a valid ISO Country + * Code. These codes are the upper-case two-letter codes + * as defined by ISO-3166. + * You can find a full list of these codes at a number of sites, such as: + *
+ * http://www.iso.org/iso/en/prods-services/iso3166ma/index.html + * + *

+ * The third constructor requires a third argument--the Variant. + * The Variant codes are vendor and browser-specific. + * For example, use REVISED for a language's revised script orthography, and POSIX for POSIX. + * Where there are two variants, separate them with an underscore, and + * put the most important one first. For + * example, a Traditional Spanish collation might be referenced, with + * "ES", "ES", "Traditional_POSIX". + * + *

+ * Because a Locale object is just an identifier for a region, + * no validity check is performed when you construct a Locale. + * If you want to see whether particular resources are available for the + * Locale you construct, you must query those resources. For + * example, ask the NumberFormat for the locales it supports + * using its getAvailableLocales method. + *
Note: When you ask for a resource for a particular + * locale, you get back the best available match, not necessarily + * precisely what you asked for. For more information, look at + * ResourceBundle. + * + *

+ * The Locale class provides a number of convenient constants + * that you can use to create Locale objects for commonly used + * locales. For example, the following refers to a Locale object + * for the United States: + * \htmlonly

\endhtmlonly + *
+ *       Locale::getUS()
+ * 
+ * \htmlonly
\endhtmlonly + * + *

+ * Once you've created a Locale you can query it for information about + * itself. Use getCountry to get the ISO Country Code and + * getLanguage to get the ISO Language Code. You can + * use getDisplayCountry to get the + * name of the country suitable for displaying to the user. Similarly, + * you can use getDisplayLanguage to get the name of + * the language suitable for displaying to the user. Interestingly, + * the getDisplayXXX methods are themselves locale-sensitive + * and have two versions: one that uses the default locale and one + * that takes a locale as an argument and displays the name or country in + * a language appropriate to that locale. + * + *

+ * ICU provides a number of classes that perform locale-sensitive + * operations. For example, the NumberFormat class formats + * numbers, currency, or percentages in a locale-sensitive manner. Classes + * such as NumberFormat have a number of convenience methods + * for creating a default object of that type. For example, the + * NumberFormat class provides these three convenience methods + * for creating a default NumberFormat object: + * \htmlonly

\endhtmlonly + *
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     Locale myLocale;
+ *     NumberFormat *nf;
+ *
+ *     nf = NumberFormat::createInstance( success );          delete nf;
+ *     nf = NumberFormat::createCurrencyInstance( success );  delete nf;
+ *     nf = NumberFormat::createPercentInstance( success );   delete nf;
+ * 
+ * \htmlonly
\endhtmlonly + * Each of these methods has two variants; one with an explicit locale + * and one without; the latter using the default locale. + * \htmlonly
\endhtmlonly + *
+ *     nf = NumberFormat::createInstance( myLocale, success );          delete nf;
+ *     nf = NumberFormat::createCurrencyInstance( myLocale, success );  delete nf;
+ *     nf = NumberFormat::createPercentInstance( myLocale, success );   delete nf;
+ * 
+ * \htmlonly
\endhtmlonly + * A Locale is the mechanism for identifying the kind of object + * (NumberFormat) that you would like to get. The locale is + * just a mechanism for identifying objects, + * not a container for the objects themselves. + * + *

+ * Each class that performs locale-sensitive operations allows you + * to get all the available objects of that type. You can sift + * through these objects by language, country, or variant, + * and use the display names to present a menu to the user. + * For example, you can create a menu of all the collation objects + * suitable for a given language. Such classes implement these + * three class methods: + * \htmlonly

\endhtmlonly + *
+ *       static Locale* getAvailableLocales(int32_t& numLocales)
+ *       static UnicodeString& getDisplayName(const Locale&  objectLocale,
+ *                                            const Locale&  displayLocale,
+ *                                            UnicodeString& displayName)
+ *       static UnicodeString& getDisplayName(const Locale&  objectLocale,
+ *                                            UnicodeString& displayName)
+ * 
+ * \htmlonly
\endhtmlonly + * + * @stable ICU 2.0 + * @see ResourceBundle + */ +class U_COMMON_API Locale : public UObject { +public: + /** Useful constant for the Root locale. @stable ICU 4.4 */ + static const Locale &U_EXPORT2 getRoot(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getEnglish(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getFrench(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getGerman(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getItalian(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getJapanese(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getKorean(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getChinese(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getSimplifiedChinese(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getTraditionalChinese(void); + + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getFrance(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getGermany(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getItaly(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getJapan(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getKorea(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getChina(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getPRC(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getTaiwan(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getUK(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getUS(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getCanada(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getCanadaFrench(void); + + + /** + * Construct a default locale object, a Locale for the default locale ID. + * + * @see getDefault + * @see uloc_getDefault + * @stable ICU 2.0 + */ + Locale(); + + /** + * Construct a locale from language, country, variant. + * If an error occurs, then the constructed object will be "bogus" + * (isBogus() will return true). + * + * @param language Lowercase two-letter or three-letter ISO-639 code. + * This parameter can instead be an ICU style C locale (e.g. "en_US"), + * but the other parameters must not be used. + * This parameter can be NULL; if so, + * the locale is initialized to match the current default locale. + * (This is the same as using the default constructor.) + * Please note: The Java Locale class does NOT accept the form + * 'new Locale("en_US")' but only 'new Locale("en","US")' + * + * @param country Uppercase two-letter ISO-3166 code. (optional) + * @param variant Uppercase vendor and browser specific code. See class + * description. (optional) + * @param keywordsAndValues A string consisting of keyword/values pairs, such as + * "collation=phonebook;currency=euro" + * + * @see getDefault + * @see uloc_getDefault + * @stable ICU 2.0 + */ + Locale( const char * language, + const char * country = 0, + const char * variant = 0, + const char * keywordsAndValues = 0); + + /** + * Initializes a Locale object from another Locale object. + * + * @param other The Locale object being copied in. + * @stable ICU 2.0 + */ + Locale(const Locale& other); + + /** + * Move constructor; might leave source in bogus state. + * This locale will have the same contents that the source locale had. + * + * @param other The Locale object being moved in. + * @stable ICU 63 + */ + Locale(Locale&& other) U_NOEXCEPT; + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~Locale() ; + + /** + * Replaces the entire contents of *this with the specified value. + * + * @param other The Locale object being copied in. + * @return *this + * @stable ICU 2.0 + */ + Locale& operator=(const Locale& other); + + /** + * Move assignment operator; might leave source in bogus state. + * This locale will have the same contents that the source locale had. + * The behavior is undefined if *this and the source are the same object. + * + * @param other The Locale object being moved in. + * @return *this + * @stable ICU 63 + */ + Locale& operator=(Locale&& other) U_NOEXCEPT; + + /** + * Checks if two locale keys are the same. + * + * @param other The locale key object to be compared with this. + * @return True if the two locale keys are the same, false otherwise. + * @stable ICU 2.0 + */ + UBool operator==(const Locale& other) const; + + /** + * Checks if two locale keys are not the same. + * + * @param other The locale key object to be compared with this. + * @return True if the two locale keys are not the same, false + * otherwise. + * @stable ICU 2.0 + */ + inline UBool operator!=(const Locale& other) const; + + /** + * Clone this object. + * Clones can be used concurrently in multiple threads. + * If an error occurs, then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + Locale *clone() const; + +#ifndef U_HIDE_SYSTEM_API + /** + * Common methods of getting the current default Locale. Used for the + * presentation: menus, dialogs, etc. Generally set once when your applet or + * application is initialized, then never reset. (If you do reset the + * default locale, you probably want to reload your GUI, so that the change + * is reflected in your interface.) + * + * More advanced programs will allow users to use different locales for + * different fields, e.g. in a spreadsheet. + * + * Note that the initial setting will match the host system. + * @return a reference to the Locale object for the default locale ID + * @system + * @stable ICU 2.0 + */ + static const Locale& U_EXPORT2 getDefault(void); + + /** + * Sets the default. Normally set once at the beginning of a process, + * then never reset. + * setDefault() only changes ICU's default locale ID, not + * the default locale ID of the runtime environment. + * + * @param newLocale Locale to set to. If NULL, set to the value obtained + * from the runtime environment. + * @param success The error code. + * @system + * @stable ICU 2.0 + */ + static void U_EXPORT2 setDefault(const Locale& newLocale, + UErrorCode& success); +#endif /* U_HIDE_SYSTEM_API */ + + /** + * Returns a Locale for the specified BCP47 language tag string. + * If the specified language tag contains any ill-formed subtags, + * the first such subtag and all following subtags are ignored. + *

+ * This implements the 'Language-Tag' production of BCP 47, and so + * supports legacy language tags (marked as “Type: grandfathered” in BCP 47) + * (regular and irregular) as well as private use language tags. + * + * Private use tags are represented as 'x-whatever', + * and legacy tags are converted to their canonical replacements where they exist. + * + * Note that a few legacy tags have no modern replacement; + * these will be converted using the fallback described in + * the first paragraph, so some information might be lost. + * + * @param tag the input BCP47 language tag. + * @param status error information if creating the Locale failed. + * @return the Locale for the specified BCP47 language tag. + * @stable ICU 63 + */ + static Locale U_EXPORT2 forLanguageTag(StringPiece tag, UErrorCode& status); + + /** + * Returns a well-formed language tag for this Locale. + *

+ * Note: Any locale fields which do not satisfy the BCP47 syntax + * requirement will be silently omitted from the result. + * + * If this function fails, partial output may have been written to the sink. + * + * @param sink the output sink receiving the BCP47 language + * tag for this Locale. + * @param status error information if creating the language tag failed. + * @stable ICU 63 + */ + void toLanguageTag(ByteSink& sink, UErrorCode& status) const; + + /** + * Returns a well-formed language tag for this Locale. + *

+ * Note: Any locale fields which do not satisfy the BCP47 syntax + * requirement will be silently omitted from the result. + * + * @param status error information if creating the language tag failed. + * @return the BCP47 language tag for this Locale. + * @stable ICU 63 + */ + template + inline StringClass toLanguageTag(UErrorCode& status) const; + + /** + * Creates a locale which has had minimal canonicalization + * as per uloc_getName(). + * @param name The name to create from. If name is null, + * the default Locale is used. + * @return new locale object + * @stable ICU 2.0 + * @see uloc_getName + */ + static Locale U_EXPORT2 createFromName(const char *name); + + /** + * Creates a locale from the given string after canonicalizing + * the string according to CLDR by calling uloc_canonicalize(). + * @param name the locale ID to create from. Must not be NULL. + * @return a new locale object corresponding to the given name + * @stable ICU 3.0 + * @see uloc_canonicalize + */ + static Locale U_EXPORT2 createCanonical(const char* name); + + /** + * Returns the locale's ISO-639 language code. + * @return An alias to the code + * @stable ICU 2.0 + */ + inline const char * getLanguage( ) const; + + /** + * Returns the locale's ISO-15924 abbreviation script code. + * @return An alias to the code + * @see uscript_getShortName + * @see uscript_getCode + * @stable ICU 2.8 + */ + inline const char * getScript( ) const; + + /** + * Returns the locale's ISO-3166 country code. + * @return An alias to the code + * @stable ICU 2.0 + */ + inline const char * getCountry( ) const; + + /** + * Returns the locale's variant code. + * @return An alias to the code + * @stable ICU 2.0 + */ + inline const char * getVariant( ) const; + + /** + * Returns the programmatic name of the entire locale, with the language, + * country and variant separated by underbars. If a field is missing, up + * to two leading underbars will occur. Example: "en", "de_DE", "en_US_WIN", + * "de__POSIX", "fr__MAC", "__MAC", "_MT", "_FR_EURO" + * @return A pointer to "name". + * @stable ICU 2.0 + */ + inline const char * getName() const; + + /** + * Returns the programmatic name of the entire locale as getName() would return, + * but without keywords. + * @return A pointer to "name". + * @see getName + * @stable ICU 2.8 + */ + const char * getBaseName() const; + + /** + * Add the likely subtags for this Locale, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If this Locale is already in the maximal form, or not valid, or there is + * no data available for maximization, the Locale will be unchanged. + * + * For example, "und-Zzzz" cannot be maximized, since there is no + * reasonable maximization. + * + * Examples: + * + * "en" maximizes to "en_Latn_US" + * + * "de" maximizes to "de_Latn_US" + * + * "sr" maximizes to "sr_Cyrl_RS" + * + * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.) + * + * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.) + * + * @param status error information if maximizing this Locale failed. + * If this Locale is not well-formed, the error code is + * U_ILLEGAL_ARGUMENT_ERROR. + * @stable ICU 63 + */ + void addLikelySubtags(UErrorCode& status); + + /** + * Minimize the subtags for this Locale, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If this Locale is already in the minimal form, or not valid, or there is + * no data available for minimization, the Locale will be unchanged. + * + * Since the minimization algorithm relies on proper maximization, see the + * comments for addLikelySubtags for reasons why there might not be any + * data. + * + * Examples: + * + * "en_Latn_US" minimizes to "en" + * + * "de_Latn_US" minimizes to "de" + * + * "sr_Cyrl_RS" minimizes to "sr" + * + * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the + * script, and minimizing to "zh" would imply "zh_Hans_CN".) + * + * @param status error information if maximizing this Locale failed. + * If this Locale is not well-formed, the error code is + * U_ILLEGAL_ARGUMENT_ERROR. + * @stable ICU 63 + */ + void minimizeSubtags(UErrorCode& status); + + /** + * Canonicalize the locale ID of this object according to CLDR. + * @param status the status code + * @stable ICU 67 + * @see createCanonical + */ + void canonicalize(UErrorCode& status); + + /** + * Gets the list of keywords for the specified locale. + * + * @param status the status code + * @return pointer to StringEnumeration class, or NULL if there are no keywords. + * Client must dispose of it by calling delete. + * @see getKeywords + * @stable ICU 2.8 + */ + StringEnumeration * createKeywords(UErrorCode &status) const; + + /** + * Gets the list of Unicode keywords for the specified locale. + * + * @param status the status code + * @return pointer to StringEnumeration class, or NULL if there are no keywords. + * Client must dispose of it by calling delete. + * @see getUnicodeKeywords + * @stable ICU 63 + */ + StringEnumeration * createUnicodeKeywords(UErrorCode &status) const; + + /** + * Gets the set of keywords for this Locale. + * + * A wrapper to call createKeywords() and write the resulting + * keywords as standard strings (or compatible objects) into any kind of + * container that can be written to by an STL style output iterator. + * + * @param iterator an STL style output iterator to write the keywords to. + * @param status error information if creating set of keywords failed. + * @stable ICU 63 + */ + template + inline void getKeywords(OutputIterator iterator, UErrorCode& status) const; + + /** + * Gets the set of Unicode keywords for this Locale. + * + * A wrapper to call createUnicodeKeywords() and write the resulting + * keywords as standard strings (or compatible objects) into any kind of + * container that can be written to by an STL style output iterator. + * + * @param iterator an STL style output iterator to write the keywords to. + * @param status error information if creating set of keywords failed. + * @stable ICU 63 + */ + template + inline void getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const; + + /** + * Gets the value for a keyword. + * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword for which we want the value. Case insensitive. + * @param buffer The buffer to receive the keyword value. + * @param bufferCapacity The capacity of receiving buffer + * @param status Returns any error information while performing this operation. + * @return the length of the keyword value + * + * @stable ICU 2.8 + */ + int32_t getKeywordValue(const char* keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const; + + /** + * Gets the value for a keyword. + * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword for which we want the value. + * @param sink the sink to receive the keyword value. + * @param status error information if getting the value failed. + * @stable ICU 63 + */ + void getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const; + + /** + * Gets the value for a keyword. + * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword for which we want the value. + * @param status error information if getting the value failed. + * @return the keyword value. + * @stable ICU 63 + */ + template + inline StringClass getKeywordValue(StringPiece keywordName, UErrorCode& status) const; + + /** + * Gets the Unicode value for a Unicode keyword. + * + * This uses Unicode key-value pairs, like "co-phonebk". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword for which we want the value. + * @param sink the sink to receive the keyword value. + * @param status error information if getting the value failed. + * @stable ICU 63 + */ + void getUnicodeKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const; + + /** + * Gets the Unicode value for a Unicode keyword. + * + * This uses Unicode key-value pairs, like "co-phonebk". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword for which we want the value. + * @param status error information if getting the value failed. + * @return the keyword value. + * @stable ICU 63 + */ + template + inline StringClass getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const; + + /** + * Sets or removes the value for a keyword. + * + * For removing all keywords, use getBaseName(), + * and construct a new Locale if it differs from getName(). + * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword to be set. Case insensitive. + * @param keywordValue value of the keyword to be set. If 0-length or + * NULL, will result in the keyword being removed. No error is given if + * that keyword does not exist. + * @param status Returns any error information while performing this operation. + * + * @stable ICU 49 + */ + void setKeywordValue(const char* keywordName, const char* keywordValue, UErrorCode &status); + + /** + * Sets or removes the value for a keyword. + * + * For removing all keywords, use getBaseName(), + * and construct a new Locale if it differs from getName(). + * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword to be set. + * @param keywordValue value of the keyword to be set. If 0-length or + * NULL, will result in the keyword being removed. No error is given if + * that keyword does not exist. + * @param status Returns any error information while performing this operation. + * @stable ICU 63 + */ + void setKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status); + + /** + * Sets or removes the Unicode value for a Unicode keyword. + * + * For removing all keywords, use getBaseName(), + * and construct a new Locale if it differs from getName(). + * + * This uses Unicode key-value pairs, like "co-phonebk". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword to be set. + * @param keywordValue value of the keyword to be set. If 0-length or + * NULL, will result in the keyword being removed. No error is given if + * that keyword does not exist. + * @param status Returns any error information while performing this operation. + * @stable ICU 63 + */ + void setUnicodeKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status); + + /** + * returns the locale's three-letter language code, as specified + * in ISO draft standard ISO-639-2. + * @return An alias to the code, or an empty string + * @stable ICU 2.0 + */ + const char * getISO3Language() const; + + /** + * Fills in "name" with the locale's three-letter ISO-3166 country code. + * @return An alias to the code, or an empty string + * @stable ICU 2.0 + */ + const char * getISO3Country() const; + + /** + * Returns the Windows LCID value corresponding to this locale. + * This value is stored in the resource data for the locale as a one-to-four-digit + * hexadecimal number. If the resource is missing, in the wrong format, or + * there is no Windows LCID value that corresponds to this locale, returns 0. + * @stable ICU 2.0 + */ + uint32_t getLCID(void) const; + + /** + * Returns whether this locale's script is written right-to-left. + * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). + * If no likely script is known, then false is returned. + * + * A script is right-to-left according to the CLDR script metadata + * which corresponds to whether the script's letters have Bidi_Class=R or AL. + * + * Returns true for "ar" and "en-Hebr", false for "zh" and "fa-Cyrl". + * + * @return true if the locale's script is written right-to-left + * @stable ICU 54 + */ + UBool isRightToLeft() const; + + /** + * Fills in "dispLang" with the name of this locale's language in a format suitable for + * user display in the default locale. For example, if the locale's language code is + * "fr" and the default locale's language code is "en", this function would set + * dispLang to "French". + * @param dispLang Receives the language's display name. + * @return A reference to "dispLang". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayLanguage(UnicodeString& dispLang) const; + + /** + * Fills in "dispLang" with the name of this locale's language in a format suitable for + * user display in the locale specified by "displayLocale". For example, if the locale's + * language code is "en" and displayLocale's language code is "fr", this function would set + * dispLang to "Anglais". + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * displayLocale would result in "Anglais", while passing Locale::getGerman() + * for displayLocale would result in "Englisch". + * @param dispLang Receives the language's display name. + * @return A reference to "dispLang". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayLanguage( const Locale& displayLocale, + UnicodeString& dispLang) const; + + /** + * Fills in "dispScript" with the name of this locale's script in a format suitable + * for user display in the default locale. For example, if the locale's script code + * is "LATN" and the default locale's language code is "en", this function would set + * dispScript to "Latin". + * @param dispScript Receives the scripts's display name. + * @return A reference to "dispScript". + * @stable ICU 2.8 + */ + UnicodeString& getDisplayScript( UnicodeString& dispScript) const; + + /** + * Fills in "dispScript" with the name of this locale's country in a format suitable + * for user display in the locale specified by "displayLocale". For example, if the locale's + * script code is "LATN" and displayLocale's language code is "en", this function would set + * dispScript to "Latin". + * @param displayLocale Specifies the locale to be used to display the name. In other + * words, if the locale's script code is "LATN", passing + * Locale::getFrench() for displayLocale would result in "", while + * passing Locale::getGerman() for displayLocale would result in + * "". + * @param dispScript Receives the scripts's display name. + * @return A reference to "dispScript". + * @stable ICU 2.8 + */ + UnicodeString& getDisplayScript( const Locale& displayLocale, + UnicodeString& dispScript) const; + + /** + * Fills in "dispCountry" with the name of this locale's country in a format suitable + * for user display in the default locale. For example, if the locale's country code + * is "FR" and the default locale's language code is "en", this function would set + * dispCountry to "France". + * @param dispCountry Receives the country's display name. + * @return A reference to "dispCountry". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayCountry( UnicodeString& dispCountry) const; + + /** + * Fills in "dispCountry" with the name of this locale's country in a format suitable + * for user display in the locale specified by "displayLocale". For example, if the locale's + * country code is "US" and displayLocale's language code is "fr", this function would set + * dispCountry to "États-Unis". + * @param displayLocale Specifies the locale to be used to display the name. In other + * words, if the locale's country code is "US", passing + * Locale::getFrench() for displayLocale would result in "États-Unis", while + * passing Locale::getGerman() for displayLocale would result in + * "Vereinigte Staaten". + * @param dispCountry Receives the country's display name. + * @return A reference to "dispCountry". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayCountry( const Locale& displayLocale, + UnicodeString& dispCountry) const; + + /** + * Fills in "dispVar" with the name of this locale's variant code in a format suitable + * for user display in the default locale. + * @param dispVar Receives the variant's name. + * @return A reference to "dispVar". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayVariant( UnicodeString& dispVar) const; + + /** + * Fills in "dispVar" with the name of this locale's variant code in a format + * suitable for user display in the locale specified by "displayLocale". + * @param displayLocale Specifies the locale to be used to display the name. + * @param dispVar Receives the variant's display name. + * @return A reference to "dispVar". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayVariant( const Locale& displayLocale, + UnicodeString& dispVar) const; + + /** + * Fills in "name" with the name of this locale in a format suitable for user display + * in the default locale. This function uses getDisplayLanguage(), getDisplayCountry(), + * and getDisplayVariant() to do its work, and outputs the display name in the format + * "language (country[,variant])". For example, if the default locale is en_US, then + * fr_FR's display name would be "French (France)", and es_MX_Traditional's display name + * would be "Spanish (Mexico,Traditional)". + * @param name Receives the locale's display name. + * @return A reference to "name". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayName( UnicodeString& name) const; + + /** + * Fills in "name" with the name of this locale in a format suitable for user display + * in the locale specified by "displayLocale". This function uses getDisplayLanguage(), + * getDisplayCountry(), and getDisplayVariant() to do its work, and outputs the display + * name in the format "language (country[,variant])". For example, if displayLocale is + * fr_FR, then en_US's display name would be "Anglais (États-Unis)", and no_NO_NY's + * display name would be "norvégien (Norvège,NY)". + * @param displayLocale Specifies the locale to be used to display the name. + * @param name Receives the locale's display name. + * @return A reference to "name". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayName( const Locale& displayLocale, + UnicodeString& name) const; + + /** + * Generates a hash code for the locale. + * @stable ICU 2.0 + */ + int32_t hashCode(void) const; + + /** + * Sets the locale to bogus + * A bogus locale represents a non-existing locale associated + * with services that can be instantiated from non-locale data + * in addition to locale (for example, collation can be + * instantiated from a locale and from a rule set). + * @stable ICU 2.1 + */ + void setToBogus(); + + /** + * Gets the bogus state. Locale object can be bogus if it doesn't exist + * @return false if it is a real locale, true if it is a bogus locale + * @stable ICU 2.1 + */ + inline UBool isBogus(void) const; + + /** + * Returns a list of all installed locales. + * @param count Receives the number of locales in the list. + * @return A pointer to an array of Locale objects. This array is the list + * of all locales with installed resource files. The called does NOT + * get ownership of this list, and must NOT delete it. + * @stable ICU 2.0 + */ + static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); + + /** + * Gets a list of all available 2-letter country codes defined in ISO 3166. This is a + * pointer to an array of pointers to arrays of char. All of these pointers are + * owned by ICU-- do not delete them, and do not write through them. The array is + * terminated with a null pointer. + * @return a list of all available country codes + * @stable ICU 2.0 + */ + static const char* const* U_EXPORT2 getISOCountries(); + + /** + * Gets a list of all available language codes defined in ISO 639. This is a pointer + * to an array of pointers to arrays of char. All of these pointers are owned + * by ICU-- do not delete them, and do not write through them. The array is + * terminated with a null pointer. + * @return a list of all available language codes + * @stable ICU 2.0 + */ + static const char* const* U_EXPORT2 getISOLanguages(); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * A Locale iterator interface similar to a Java Iterator. + * @stable ICU 65 + */ + class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ { + public: + /** @stable ICU 65 */ + virtual ~Iterator(); + + /** + * @return true if next() can be called again. + * @stable ICU 65 + */ + virtual UBool hasNext() const = 0; + + /** + * @return the next locale. + * @stable ICU 65 + */ + virtual const Locale &next() = 0; + }; + + /** + * A generic Locale iterator implementation over Locale input iterators. + * @stable ICU 65 + */ + template + class RangeIterator : public Iterator, public UMemory { + public: + /** + * Constructs an iterator from a begin/end range. + * Each of the iterator parameter values must be an + * input iterator whose value is convertible to const Locale &. + * + * @param begin Start of range. + * @param end Exclusive end of range. + * @stable ICU 65 + */ + RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {} + + /** + * @return true if next() can be called again. + * @stable ICU 65 + */ + UBool hasNext() const override { return it_ != end_; } + + /** + * @return the next locale. + * @stable ICU 65 + */ + const Locale &next() override { return *it_++; } + + private: + Iter it_; + const Iter end_; + }; + + /** + * A generic Locale iterator implementation over Locale input iterators. + * Calls the converter to convert each *begin to a const Locale &. + * @stable ICU 65 + */ + template + class ConvertingIterator : public Iterator, public UMemory { + public: + /** + * Constructs an iterator from a begin/end range. + * Each of the iterator parameter values must be an + * input iterator whose value the converter converts to const Locale &. + * + * @param begin Start of range. + * @param end Exclusive end of range. + * @param converter Converter from *begin to const Locale & or compatible. + * @stable ICU 65 + */ + ConvertingIterator(Iter begin, Iter end, Conv converter) : + it_(begin), end_(end), converter_(converter) {} + + /** + * @return true if next() can be called again. + * @stable ICU 65 + */ + UBool hasNext() const override { return it_ != end_; } + + /** + * @return the next locale. + * @stable ICU 65 + */ + const Locale &next() override { return converter_(*it_++); } + + private: + Iter it_; + const Iter end_; + Conv converter_; + }; + +protected: /* only protected for testing purposes. DO NOT USE. */ +#ifndef U_HIDE_INTERNAL_API + /** + * Set this from a single POSIX style locale string. + * @internal + */ + void setFromPOSIXID(const char *posixID); +#endif /* U_HIDE_INTERNAL_API */ + +private: + /** + * Initialize the locale object with a new name. + * Was deprecated - used in implementation - moved internal + * + * @param cLocaleID The new locale name. + * @param canonicalize whether to call uloc_canonicalize on cLocaleID + */ + Locale& init(const char* cLocaleID, UBool canonicalize); + + /* + * Internal constructor to allow construction of a locale object with + * NO side effects. (Default constructor tries to get + * the default locale.) + */ + enum ELocaleType { + eBOGUS + }; + Locale(ELocaleType); + + /** + * Initialize the locale cache for commonly used locales + */ + static Locale *getLocaleCache(void); + + char language[ULOC_LANG_CAPACITY]; + char script[ULOC_SCRIPT_CAPACITY]; + char country[ULOC_COUNTRY_CAPACITY]; + int32_t variantBegin; + char* fullName; + char fullNameBuffer[ULOC_FULLNAME_CAPACITY]; + // name without keywords + char* baseName; + void initBaseName(UErrorCode& status); + + UBool fIsBogus; + + static const Locale &getLocale(int locid); + + /** + * A friend to allow the default locale to be set by either the C or C++ API. + * @internal (private) + */ + friend Locale *locale_set_default_internal(const char *, UErrorCode& status); + + /** + * @internal (private) + */ + friend void U_CALLCONV locale_available_init(); +}; + +inline UBool +Locale::operator!=(const Locale& other) const +{ + return !operator==(other); +} + +template inline StringClass +Locale::toLanguageTag(UErrorCode& status) const +{ + StringClass result; + StringByteSink sink(&result); + toLanguageTag(sink, status); + return result; +} + +inline const char * +Locale::getCountry() const +{ + return country; +} + +inline const char * +Locale::getLanguage() const +{ + return language; +} + +inline const char * +Locale::getScript() const +{ + return script; +} + +inline const char * +Locale::getVariant() const +{ + return &baseName[variantBegin]; +} + +inline const char * +Locale::getName() const +{ + return fullName; +} + +template inline void +Locale::getKeywords(OutputIterator iterator, UErrorCode& status) const +{ + LocalPointer keys(createKeywords(status)); + if (U_FAILURE(status) || keys.isNull()) { + return; + } + for (;;) { + int32_t resultLength; + const char* buffer = keys->next(&resultLength, status); + if (U_FAILURE(status) || buffer == nullptr) { + return; + } + *iterator++ = StringClass(buffer, resultLength); + } +} + +template inline void +Locale::getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const +{ + LocalPointer keys(createUnicodeKeywords(status)); + if (U_FAILURE(status) || keys.isNull()) { + return; + } + for (;;) { + int32_t resultLength; + const char* buffer = keys->next(&resultLength, status); + if (U_FAILURE(status) || buffer == nullptr) { + return; + } + *iterator++ = StringClass(buffer, resultLength); + } +} + +template inline StringClass +Locale::getKeywordValue(StringPiece keywordName, UErrorCode& status) const +{ + StringClass result; + StringByteSink sink(&result); + getKeywordValue(keywordName, sink, status); + return result; +} + +template inline StringClass +Locale::getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const +{ + StringClass result; + StringByteSink sink(&result); + getUnicodeKeywordValue(keywordName, sink, status); + return result; +} + +inline UBool +Locale::isBogus(void) const { + return fIsBogus; +} + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/messagepattern.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/messagepattern.h new file mode 100644 index 0000000000000000000000000000000000000000..98e7b70b1fcc13b771d275e227db9b95c2671a40 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/messagepattern.h @@ -0,0 +1,949 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2011-2013, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: messagepattern.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2011mar14 +* created by: Markus W. Scherer +*/ + +#ifndef __MESSAGEPATTERN_H__ +#define __MESSAGEPATTERN_H__ + +/** + * \file + * \brief C++ API: MessagePattern class: Parses and represents ICU MessageFormat patterns. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/parseerr.h" +#include "unicode/unistr.h" + +/** + * Mode for when an apostrophe starts quoted literal text for MessageFormat output. + * The default is DOUBLE_OPTIONAL unless overridden via uconfig.h + * (UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE). + *

+ * A pair of adjacent apostrophes always results in a single apostrophe in the output, + * even when the pair is between two single, text-quoting apostrophes. + *

+ * The following table shows examples of desired MessageFormat.format() output + * with the pattern strings that yield that output. + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Desired outputDOUBLE_OPTIONALDOUBLE_REQUIRED
I see {many}I see '{many}'(same)
I said {'Wow!'}I said '{''Wow!''}'(same)
I don't knowI don't know OR
I don''t know
I don''t know
+ * @stable ICU 4.8 + * @see UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE + */ +enum UMessagePatternApostropheMode { + /** + * A literal apostrophe is represented by + * either a single or a double apostrophe pattern character. + * Within a MessageFormat pattern, a single apostrophe only starts quoted literal text + * if it immediately precedes a curly brace {}, + * or a pipe symbol | if inside a choice format, + * or a pound symbol # if inside a plural format. + *

+ * This is the default behavior starting with ICU 4.8. + * @stable ICU 4.8 + */ + UMSGPAT_APOS_DOUBLE_OPTIONAL, + /** + * A literal apostrophe must be represented by + * a double apostrophe pattern character. + * A single apostrophe always starts quoted literal text. + *

+ * This is the behavior of ICU 4.6 and earlier, and of the JDK. + * @stable ICU 4.8 + */ + UMSGPAT_APOS_DOUBLE_REQUIRED +}; +/** + * @stable ICU 4.8 + */ +typedef enum UMessagePatternApostropheMode UMessagePatternApostropheMode; + +/** + * MessagePattern::Part type constants. + * @stable ICU 4.8 + */ +enum UMessagePatternPartType { + /** + * Start of a message pattern (main or nested). + * The length is 0 for the top-level message + * and for a choice argument sub-message, otherwise 1 for the '{'. + * The value indicates the nesting level, starting with 0 for the main message. + *

+ * There is always a later MSG_LIMIT part. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_MSG_START, + /** + * End of a message pattern (main or nested). + * The length is 0 for the top-level message and + * the last sub-message of a choice argument, + * otherwise 1 for the '}' or (in a choice argument style) the '|'. + * The value indicates the nesting level, starting with 0 for the main message. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_MSG_LIMIT, + /** + * Indicates a substring of the pattern string which is to be skipped when formatting. + * For example, an apostrophe that begins or ends quoted text + * would be indicated with such a part. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_SKIP_SYNTAX, + /** + * Indicates that a syntax character needs to be inserted for auto-quoting. + * The length is 0. + * The value is the character code of the insertion character. (U+0027=APOSTROPHE) + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_INSERT_CHAR, + /** + * Indicates a syntactic (non-escaped) # symbol in a plural variant. + * When formatting, replace this part's substring with the + * (value-offset) for the plural argument value. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_REPLACE_NUMBER, + /** + * Start of an argument. + * The length is 1 for the '{'. + * The value is the ordinal value of the ArgType. Use getArgType(). + *

+ * This part is followed by either an ARG_NUMBER or ARG_NAME, + * followed by optional argument sub-parts (see UMessagePatternArgType constants) + * and finally an ARG_LIMIT part. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_START, + /** + * End of an argument. + * The length is 1 for the '}'. + * The value is the ordinal value of the ArgType. Use getArgType(). + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_LIMIT, + /** + * The argument number, provided by the value. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_NUMBER, + /** + * The argument name. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_NAME, + /** + * The argument type. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_TYPE, + /** + * The argument style text. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_STYLE, + /** + * A selector substring in a "complex" argument style. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_SELECTOR, + /** + * An integer value, for example the offset or an explicit selector value + * in a PluralFormat style. + * The part value is the integer value. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_INT, + /** + * A numeric value, for example the offset or an explicit selector value + * in a PluralFormat style. + * The part value is an index into an internal array of numeric values; + * use getNumericValue(). + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_DOUBLE +}; +/** + * @stable ICU 4.8 + */ +typedef enum UMessagePatternPartType UMessagePatternPartType; + +/** + * Argument type constants. + * Returned by Part.getArgType() for ARG_START and ARG_LIMIT parts. + * + * Messages nested inside an argument are each delimited by MSG_START and MSG_LIMIT, + * with a nesting level one greater than the surrounding message. + * @stable ICU 4.8 + */ +enum UMessagePatternArgType { + /** + * The argument has no specified type. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_NONE, + /** + * The argument has a "simple" type which is provided by the ARG_TYPE part. + * An ARG_STYLE part might follow that. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_SIMPLE, + /** + * The argument is a ChoiceFormat with one or more + * ((ARG_INT | ARG_DOUBLE), ARG_SELECTOR, message) tuples. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_CHOICE, + /** + * The argument is a cardinal-number PluralFormat with an optional ARG_INT or ARG_DOUBLE offset + * (e.g., offset:1) + * and one or more (ARG_SELECTOR [explicit-value] message) tuples. + * If the selector has an explicit value (e.g., =2), then + * that value is provided by the ARG_INT or ARG_DOUBLE part preceding the message. + * Otherwise the message immediately follows the ARG_SELECTOR. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_PLURAL, + /** + * The argument is a SelectFormat with one or more (ARG_SELECTOR, message) pairs. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_SELECT, + /** + * The argument is an ordinal-number PluralFormat + * with the same style parts sequence and semantics as UMSGPAT_ARG_TYPE_PLURAL. + * @stable ICU 50 + */ + UMSGPAT_ARG_TYPE_SELECTORDINAL +}; +/** + * @stable ICU 4.8 + */ +typedef enum UMessagePatternArgType UMessagePatternArgType; + +/** + * \def UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE + * Returns true if the argument type has a plural style part sequence and semantics, + * for example UMSGPAT_ARG_TYPE_PLURAL and UMSGPAT_ARG_TYPE_SELECTORDINAL. + * @stable ICU 50 + */ +#define UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE(argType) \ + ((argType)==UMSGPAT_ARG_TYPE_PLURAL || (argType)==UMSGPAT_ARG_TYPE_SELECTORDINAL) + +enum { + /** + * Return value from MessagePattern.validateArgumentName() for when + * the string is a valid "pattern identifier" but not a number. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_NAME_NOT_NUMBER=-1, + + /** + * Return value from MessagePattern.validateArgumentName() for when + * the string is invalid. + * It might not be a valid "pattern identifier", + * or it have only ASCII digits but there is a leading zero or the number is too large. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_NAME_NOT_VALID=-2 +}; + +/** + * Special value that is returned by getNumericValue(Part) when no + * numeric value is defined for a part. + * @see MessagePattern.getNumericValue() + * @stable ICU 4.8 + */ +#define UMSGPAT_NO_NUMERIC_VALUE ((double)(-123456789)) + +U_NAMESPACE_BEGIN + +class MessagePatternDoubleList; +class MessagePatternPartsList; + +/** + * Parses and represents ICU MessageFormat patterns. + * Also handles patterns for ChoiceFormat, PluralFormat and SelectFormat. + * Used in the implementations of those classes as well as in tools + * for message validation, translation and format conversion. + *

+ * The parser handles all syntax relevant for identifying message arguments. + * This includes "complex" arguments whose style strings contain + * nested MessageFormat pattern substrings. + * For "simple" arguments (with no nested MessageFormat pattern substrings), + * the argument style is not parsed any further. + *

+ * The parser handles named and numbered message arguments and allows both in one message. + *

+ * Once a pattern has been parsed successfully, iterate through the parsed data + * with countParts(), getPart() and related methods. + *

+ * The data logically represents a parse tree, but is stored and accessed + * as a list of "parts" for fast and simple parsing and to minimize object allocations. + * Arguments and nested messages are best handled via recursion. + * For every _START "part", MessagePattern.getLimitPartIndex() efficiently returns + * the index of the corresponding _LIMIT "part". + *

+ * List of "parts": + *

+ * message = MSG_START (SKIP_SYNTAX | INSERT_CHAR | REPLACE_NUMBER | argument)* MSG_LIMIT
+ * argument = noneArg | simpleArg | complexArg
+ * complexArg = choiceArg | pluralArg | selectArg
+ *
+ * noneArg = ARG_START.NONE (ARG_NAME | ARG_NUMBER) ARG_LIMIT.NONE
+ * simpleArg = ARG_START.SIMPLE (ARG_NAME | ARG_NUMBER) ARG_TYPE [ARG_STYLE] ARG_LIMIT.SIMPLE
+ * choiceArg = ARG_START.CHOICE (ARG_NAME | ARG_NUMBER) choiceStyle ARG_LIMIT.CHOICE
+ * pluralArg = ARG_START.PLURAL (ARG_NAME | ARG_NUMBER) pluralStyle ARG_LIMIT.PLURAL
+ * selectArg = ARG_START.SELECT (ARG_NAME | ARG_NUMBER) selectStyle ARG_LIMIT.SELECT
+ *
+ * choiceStyle = ((ARG_INT | ARG_DOUBLE) ARG_SELECTOR message)+
+ * pluralStyle = [ARG_INT | ARG_DOUBLE] (ARG_SELECTOR [ARG_INT | ARG_DOUBLE] message)+
+ * selectStyle = (ARG_SELECTOR message)+
+ * 
+ *
    + *
  • Literal output text is not represented directly by "parts" but accessed + * between parts of a message, from one part's getLimit() to the next part's getIndex(). + *
  • ARG_START.CHOICE stands for an ARG_START Part with ArgType CHOICE. + *
  • In the choiceStyle, the ARG_SELECTOR has the '<', the '#' or + * the less-than-or-equal-to sign (U+2264). + *
  • In the pluralStyle, the first, optional numeric Part has the "offset:" value. + * The optional numeric Part between each (ARG_SELECTOR, message) pair + * is the value of an explicit-number selector like "=2", + * otherwise the selector is a non-numeric identifier. + *
  • The REPLACE_NUMBER Part can occur only in an immediate sub-message of the pluralStyle. + *
+ *

+ * This class is not intended for public subclassing. + * + * @stable ICU 4.8 + */ +class U_COMMON_API MessagePattern : public UObject { +public: + /** + * Constructs an empty MessagePattern with default UMessagePatternApostropheMode. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + MessagePattern(UErrorCode &errorCode); + + /** + * Constructs an empty MessagePattern. + * @param mode Explicit UMessagePatternApostropheMode. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + MessagePattern(UMessagePatternApostropheMode mode, UErrorCode &errorCode); + + /** + * Constructs a MessagePattern with default UMessagePatternApostropheMode and + * parses the MessageFormat pattern string. + * @param pattern a MessageFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * TODO: turn @throws into UErrorCode specifics? + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern(const UnicodeString &pattern, UParseError *parseError, UErrorCode &errorCode); + + /** + * Copy constructor. + * @param other Object to copy. + * @stable ICU 4.8 + */ + MessagePattern(const MessagePattern &other); + + /** + * Assignment operator. + * @param other Object to copy. + * @return *this=other + * @stable ICU 4.8 + */ + MessagePattern &operator=(const MessagePattern &other); + + /** + * Destructor. + * @stable ICU 4.8 + */ + virtual ~MessagePattern(); + + /** + * Parses a MessageFormat pattern string. + * @param pattern a MessageFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern &parse(const UnicodeString &pattern, + UParseError *parseError, UErrorCode &errorCode); + + /** + * Parses a ChoiceFormat pattern string. + * @param pattern a ChoiceFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern &parseChoiceStyle(const UnicodeString &pattern, + UParseError *parseError, UErrorCode &errorCode); + + /** + * Parses a PluralFormat pattern string. + * @param pattern a PluralFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern &parsePluralStyle(const UnicodeString &pattern, + UParseError *parseError, UErrorCode &errorCode); + + /** + * Parses a SelectFormat pattern string. + * @param pattern a SelectFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern &parseSelectStyle(const UnicodeString &pattern, + UParseError *parseError, UErrorCode &errorCode); + + /** + * Clears this MessagePattern. + * countParts() will return 0. + * @stable ICU 4.8 + */ + void clear(); + + /** + * Clears this MessagePattern and sets the UMessagePatternApostropheMode. + * countParts() will return 0. + * @param mode The new UMessagePatternApostropheMode. + * @stable ICU 4.8 + */ + void clearPatternAndSetApostropheMode(UMessagePatternApostropheMode mode) { + clear(); + aposMode=mode; + } + + /** + * @param other another object to compare with. + * @return true if this object is equivalent to the other one. + * @stable ICU 4.8 + */ + UBool operator==(const MessagePattern &other) const; + + /** + * @param other another object to compare with. + * @return false if this object is equivalent to the other one. + * @stable ICU 4.8 + */ + inline UBool operator!=(const MessagePattern &other) const { + return !operator==(other); + } + + /** + * @return A hash code for this object. + * @stable ICU 4.8 + */ + int32_t hashCode() const; + + /** + * @return this instance's UMessagePatternApostropheMode. + * @stable ICU 4.8 + */ + UMessagePatternApostropheMode getApostropheMode() const { + return aposMode; + } + + // Java has package-private jdkAposMode() here. + // In C++, this is declared in the MessageImpl class. + + /** + * @return the parsed pattern string (null if none was parsed). + * @stable ICU 4.8 + */ + const UnicodeString &getPatternString() const { + return msg; + } + + /** + * Does the parsed pattern have named arguments like {first_name}? + * @return true if the parsed pattern has at least one named argument. + * @stable ICU 4.8 + */ + UBool hasNamedArguments() const { + return hasArgNames; + } + + /** + * Does the parsed pattern have numbered arguments like {2}? + * @return true if the parsed pattern has at least one numbered argument. + * @stable ICU 4.8 + */ + UBool hasNumberedArguments() const { + return hasArgNumbers; + } + + /** + * Validates and parses an argument name or argument number string. + * An argument name must be a "pattern identifier", that is, it must contain + * no Unicode Pattern_Syntax or Pattern_White_Space characters. + * If it only contains ASCII digits, then it must be a small integer with no leading zero. + * @param name Input string. + * @return >=0 if the name is a valid number, + * ARG_NAME_NOT_NUMBER (-1) if it is a "pattern identifier" but not all ASCII digits, + * ARG_NAME_NOT_VALID (-2) if it is neither. + * @stable ICU 4.8 + */ + static int32_t validateArgumentName(const UnicodeString &name); + + /** + * Returns a version of the parsed pattern string where each ASCII apostrophe + * is doubled (escaped) if it is not already, and if it is not interpreted as quoting syntax. + *

+ * For example, this turns "I don't '{know}' {gender,select,female{h''er}other{h'im}}." + * into "I don''t '{know}' {gender,select,female{h''er}other{h''im}}." + * @return the deep-auto-quoted version of the parsed pattern string. + * @see MessageFormat.autoQuoteApostrophe() + * @stable ICU 4.8 + */ + UnicodeString autoQuoteApostropheDeep() const; + + class Part; + + /** + * Returns the number of "parts" created by parsing the pattern string. + * Returns 0 if no pattern has been parsed or clear() was called. + * @return the number of pattern parts. + * @stable ICU 4.8 + */ + int32_t countParts() const { + return partsLength; + } + + /** + * Gets the i-th pattern "part". + * @param i The index of the Part data. (0..countParts()-1) + * @return the i-th pattern "part". + * @stable ICU 4.8 + */ + const Part &getPart(int32_t i) const { + return parts[i]; + } + + /** + * Returns the UMessagePatternPartType of the i-th pattern "part". + * Convenience method for getPart(i).getType(). + * @param i The index of the Part data. (0..countParts()-1) + * @return The UMessagePatternPartType of the i-th Part. + * @stable ICU 4.8 + */ + UMessagePatternPartType getPartType(int32_t i) const { + return getPart(i).type; + } + + /** + * Returns the pattern index of the specified pattern "part". + * Convenience method for getPart(partIndex).getIndex(). + * @param partIndex The index of the Part data. (0..countParts()-1) + * @return The pattern index of this Part. + * @stable ICU 4.8 + */ + int32_t getPatternIndex(int32_t partIndex) const { + return getPart(partIndex).index; + } + + /** + * Returns the substring of the pattern string indicated by the Part. + * Convenience method for getPatternString().substring(part.getIndex(), part.getLimit()). + * @param part a part of this MessagePattern. + * @return the substring associated with part. + * @stable ICU 4.8 + */ + UnicodeString getSubstring(const Part &part) const { + return msg.tempSubString(part.index, part.length); + } + + /** + * Compares the part's substring with the input string s. + * @param part a part of this MessagePattern. + * @param s a string. + * @return true if getSubstring(part).equals(s). + * @stable ICU 4.8 + */ + UBool partSubstringMatches(const Part &part, const UnicodeString &s) const { + return 0==msg.compare(part.index, part.length, s); + } + + /** + * Returns the numeric value associated with an ARG_INT or ARG_DOUBLE. + * @param part a part of this MessagePattern. + * @return the part's numeric value, or UMSGPAT_NO_NUMERIC_VALUE if this is not a numeric part. + * @stable ICU 4.8 + */ + double getNumericValue(const Part &part) const; + + /** + * Returns the "offset:" value of a PluralFormat argument, or 0 if none is specified. + * @param pluralStart the index of the first PluralFormat argument style part. (0..countParts()-1) + * @return the "offset:" value. + * @stable ICU 4.8 + */ + double getPluralOffset(int32_t pluralStart) const; + + /** + * Returns the index of the ARG|MSG_LIMIT part corresponding to the ARG|MSG_START at start. + * @param start The index of some Part data (0..countParts()-1); + * this Part should be of Type ARG_START or MSG_START. + * @return The first i>start where getPart(i).getType()==ARG|MSG_LIMIT at the same nesting level, + * or start itself if getPartType(msgStart)!=ARG|MSG_START. + * @stable ICU 4.8 + */ + int32_t getLimitPartIndex(int32_t start) const { + int32_t limit=getPart(start).limitPartIndex; + if(limit parts=new ArrayList(); + MessagePatternPartsList *partsList; + Part *parts; + int32_t partsLength; + // ArrayList numericValues; + MessagePatternDoubleList *numericValuesList; + double *numericValues; + int32_t numericValuesLength; + UBool hasArgNames; + UBool hasArgNumbers; + UBool needsAutoQuoting; +}; + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_FORMATTING + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __MESSAGEPATTERN_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/normalizer2.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/normalizer2.h new file mode 100644 index 0000000000000000000000000000000000000000..2d355250c29fde5e90d311235cda5d01306221db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/normalizer2.h @@ -0,0 +1,771 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: normalizer2.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009nov22 +* created by: Markus W. Scherer +*/ + +#ifndef __NORMALIZER2_H__ +#define __NORMALIZER2_H__ + +/** + * \file + * \brief C++ API: New API for Unicode Normalization. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/stringpiece.h" +#include "unicode/uniset.h" +#include "unicode/unistr.h" +#include "unicode/unorm2.h" + +U_NAMESPACE_BEGIN + +class ByteSink; + +/** + * Unicode normalization functionality for standard Unicode normalization or + * for using custom mapping tables. + * All instances of this class are unmodifiable/immutable. + * Instances returned by getInstance() are singletons that must not be deleted by the caller. + * The Normalizer2 class is not intended for public subclassing. + * + * The primary functions are to produce a normalized string and to detect whether + * a string is already normalized. + * The most commonly used normalization forms are those defined in + * http://www.unicode.org/unicode/reports/tr15/ + * However, this API supports additional normalization forms for specialized purposes. + * For example, NFKC_Casefold is provided via getInstance("nfkc_cf", COMPOSE) + * and can be used in implementations of UTS #46. + * + * Not only are the standard compose and decompose modes supplied, + * but additional modes are provided as documented in the Mode enum. + * + * Some of the functions in this class identify normalization boundaries. + * At a normalization boundary, the portions of the string + * before it and starting from it do not interact and can be handled independently. + * + * The spanQuickCheckYes() stops at a normalization boundary. + * When the goal is a normalized string, then the text before the boundary + * can be copied, and the remainder can be processed with normalizeSecondAndAppend(). + * + * The hasBoundaryBefore(), hasBoundaryAfter() and isInert() functions test whether + * a character is guaranteed to be at a normalization boundary, + * regardless of context. + * This is used for moving from one normalization boundary to the next + * or preceding boundary, and for performing iterative normalization. + * + * Iterative normalization is useful when only a small portion of a + * longer string needs to be processed. + * For example, in ICU, iterative normalization is used by the NormalizationTransliterator + * (to avoid replacing already-normalized text) and ucol_nextSortKeyPart() + * (to process only the substring for which sort key bytes are computed). + * + * The set of normalization boundaries returned by these functions may not be + * complete: There may be more boundaries that could be returned. + * Different functions may return different boundaries. + * @stable ICU 4.4 + */ +class U_COMMON_API Normalizer2 : public UObject { +public: + /** + * Destructor. + * @stable ICU 4.4 + */ + ~Normalizer2(); + + /** + * Returns a Normalizer2 instance for Unicode NFC normalization. + * Same as getInstance(NULL, "nfc", UNORM2_COMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFCInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance for Unicode NFD normalization. + * Same as getInstance(NULL, "nfc", UNORM2_DECOMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFDInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance for Unicode NFKC normalization. + * Same as getInstance(NULL, "nfkc", UNORM2_COMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFKCInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance for Unicode NFKD normalization. + * Same as getInstance(NULL, "nfkc", UNORM2_DECOMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFKDInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance for Unicode NFKC_Casefold normalization. + * Same as getInstance(NULL, "nfkc_cf", UNORM2_COMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFKCCasefoldInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance which uses the specified data file + * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle) + * and which composes or decomposes text according to the specified mode. + * Returns an unmodifiable singleton instance. Do not delete it. + * + * Use packageName=NULL for data files that are part of ICU's own data. + * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD. + * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD. + * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold. + * + * @param packageName NULL for ICU built-in data, otherwise application data package name + * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file + * @param mode normalization mode (compose or decompose etc.) + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 4.4 + */ + static const Normalizer2 * + getInstance(const char *packageName, + const char *name, + UNormalization2Mode mode, + UErrorCode &errorCode); + + /** + * Returns the normalized form of the source string. + * @param src source string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return normalized src + * @stable ICU 4.4 + */ + UnicodeString + normalize(const UnicodeString &src, UErrorCode &errorCode) const { + UnicodeString result; + normalize(src, result, errorCode); + return result; + } + /** + * Writes the normalized form of the source string to the destination string + * (replacing its contents) and returns the destination string. + * The source and destination strings must be different objects. + * @param src source string + * @param dest destination string; its contents is replaced with normalized src + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.4 + */ + virtual UnicodeString & + normalize(const UnicodeString &src, + UnicodeString &dest, + UErrorCode &errorCode) const = 0; + + /** + * Normalizes a UTF-8 string and optionally records how source substrings + * relate to changed and unchanged result substrings. + * + * Implemented completely for all built-in modes except for FCD. + * The base class implementation converts to & from UTF-16 and does not support edits. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src Source UTF-8 string. + * @param sink A ByteSink to which the normalized UTF-8 result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be nullptr. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 60 + */ + virtual void + normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, + Edits *edits, UErrorCode &errorCode) const; + + /** + * Appends the normalized form of the second string to the first string + * (merging them at the boundary) and returns the first string. + * The result is normalized if the first string was normalized. + * The first and second strings must be different objects. + * @param first string, should be normalized + * @param second string, will be normalized + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ + virtual UnicodeString & + normalizeSecondAndAppend(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const = 0; + /** + * Appends the second string to the first string + * (merging them at the boundary) and returns the first string. + * The result is normalized if both the strings were normalized. + * The first and second strings must be different objects. + * @param first string, should be normalized + * @param second string, should be normalized + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ + virtual UnicodeString & + append(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const = 0; + + /** + * Gets the decomposition mapping of c. + * Roughly equivalent to normalizing the String form of c + * on a UNORM2_DECOMPOSE Normalizer2 instance, but much faster, and except that this function + * returns false and does not write a string + * if c does not have a decomposition mapping in this instance's data. + * This function is independent of the mode of the Normalizer2. + * @param c code point + * @param decomposition String object which will be set to c's + * decomposition mapping, if there is one. + * @return true if c has a decomposition, otherwise false + * @stable ICU 4.6 + */ + virtual UBool + getDecomposition(UChar32 c, UnicodeString &decomposition) const = 0; + + /** + * Gets the raw decomposition mapping of c. + * + * This is similar to the getDecomposition() method but returns the + * raw decomposition mapping as specified in UnicodeData.txt or + * (for custom data) in the mapping files processed by the gennorm2 tool. + * By contrast, getDecomposition() returns the processed, + * recursively-decomposed version of this mapping. + * + * When used on a standard NFKC Normalizer2 instance, + * getRawDecomposition() returns the Unicode Decomposition_Mapping (dm) property. + * + * When used on a standard NFC Normalizer2 instance, + * it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can); + * in this case, the result contains either one or two code points (=1..4 char16_ts). + * + * This function is independent of the mode of the Normalizer2. + * The default implementation returns false. + * @param c code point + * @param decomposition String object which will be set to c's + * raw decomposition mapping, if there is one. + * @return true if c has a decomposition, otherwise false + * @stable ICU 49 + */ + virtual UBool + getRawDecomposition(UChar32 c, UnicodeString &decomposition) const; + + /** + * Performs pairwise composition of a & b and returns the composite if there is one. + * + * Returns a composite code point c only if c has a two-way mapping to a+b. + * In standard Unicode normalization, this means that + * c has a canonical decomposition to a+b + * and c does not have the Full_Composition_Exclusion property. + * + * This function is independent of the mode of the Normalizer2. + * The default implementation returns a negative value. + * @param a A (normalization starter) code point. + * @param b Another code point. + * @return The non-negative composite code point if there is one; otherwise a negative value. + * @stable ICU 49 + */ + virtual UChar32 + composePair(UChar32 a, UChar32 b) const; + + /** + * Gets the combining class of c. + * The default implementation returns 0 + * but all standard implementations return the Unicode Canonical_Combining_Class value. + * @param c code point + * @return c's combining class + * @stable ICU 49 + */ + virtual uint8_t + getCombiningClass(UChar32 c) const; + + /** + * Tests if the string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return true if s is normalized + * @stable ICU 4.4 + */ + virtual UBool + isNormalized(const UnicodeString &s, UErrorCode &errorCode) const = 0; + /** + * Tests if the UTF-8 string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * + * This works for all normalization modes. + * It is optimized for UTF-8 for all built-in modes except for FCD. + * The base class implementation converts to UTF-16 and calls isNormalized(). + * + * @param s UTF-8 input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return true if s is normalized + * @stable ICU 60 + */ + virtual UBool + isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const; + + + /** + * Tests if the string is normalized. + * For the two COMPOSE modes, the result could be "maybe" in cases that + * would take a little more work to resolve definitively. + * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster + * combination of quick check + normalization, to avoid + * re-checking the "yes" prefix. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return UNormalizationCheckResult + * @stable ICU 4.4 + */ + virtual UNormalizationCheckResult + quickCheck(const UnicodeString &s, UErrorCode &errorCode) const = 0; + + /** + * Returns the end of the normalized substring of the input string. + * In other words, with end=spanQuickCheckYes(s, ec); + * the substring UnicodeString(s, 0, end) + * will pass the quick check with a "yes" result. + * + * The returned end index is usually one or more characters before the + * "no" or "maybe" character: The end index is at a normalization boundary. + * (See the class documentation for more about normalization boundaries.) + * + * When the goal is a normalized string and most input strings are expected + * to be normalized already, then call this method, + * and if it returns a prefix shorter than the input string, + * copy that prefix and use normalizeSecondAndAppend() for the remainder. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return "yes" span end index + * @stable ICU 4.4 + */ + virtual int32_t + spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const = 0; + + /** + * Tests if the character always has a normalization boundary before it, + * regardless of context. + * If true, then the character does not normalization-interact with + * preceding characters. + * In other words, a string containing this character can be normalized + * by processing portions before this character and starting from this + * character independently. + * This is used for iterative normalization. See the class documentation for details. + * @param c character to test + * @return true if c has a normalization boundary before it + * @stable ICU 4.4 + */ + virtual UBool hasBoundaryBefore(UChar32 c) const = 0; + + /** + * Tests if the character always has a normalization boundary after it, + * regardless of context. + * If true, then the character does not normalization-interact with + * following characters. + * In other words, a string containing this character can be normalized + * by processing portions up to this character and after this + * character independently. + * This is used for iterative normalization. See the class documentation for details. + * Note that this operation may be significantly slower than hasBoundaryBefore(). + * @param c character to test + * @return true if c has a normalization boundary after it + * @stable ICU 4.4 + */ + virtual UBool hasBoundaryAfter(UChar32 c) const = 0; + + /** + * Tests if the character is normalization-inert. + * If true, then the character does not change, nor normalization-interact with + * preceding or following characters. + * In other words, a string containing this character can be normalized + * by processing portions before this character and after this + * character independently. + * This is used for iterative normalization. See the class documentation for details. + * Note that this operation may be significantly slower than hasBoundaryBefore(). + * @param c character to test + * @return true if c is normalization-inert + * @stable ICU 4.4 + */ + virtual UBool isInert(UChar32 c) const = 0; +}; + +/** + * Normalization filtered by a UnicodeSet. + * Normalizes portions of the text contained in the filter set and leaves + * portions not contained in the filter set unchanged. + * Filtering is done via UnicodeSet::span(..., USET_SPAN_SIMPLE). + * Not-in-the-filter text is treated as "is normalized" and "quick check yes". + * This class implements all of (and only) the Normalizer2 API. + * An instance of this class is unmodifiable/immutable but is constructed and + * must be destructed by the owner. + * @stable ICU 4.4 + */ +class U_COMMON_API FilteredNormalizer2 : public Normalizer2 { +public: + /** + * Constructs a filtered normalizer wrapping any Normalizer2 instance + * and a filter set. + * Both are aliased and must not be modified or deleted while this object + * is used. + * The filter set should be frozen; otherwise the performance will suffer greatly. + * @param n2 wrapped Normalizer2 instance + * @param filterSet UnicodeSet which determines the characters to be normalized + * @stable ICU 4.4 + */ + FilteredNormalizer2(const Normalizer2 &n2, const UnicodeSet &filterSet) : + norm2(n2), set(filterSet) {} + + /** + * Destructor. + * @stable ICU 4.4 + */ + ~FilteredNormalizer2(); + + /** + * Writes the normalized form of the source string to the destination string + * (replacing its contents) and returns the destination string. + * The source and destination strings must be different objects. + * @param src source string + * @param dest destination string; its contents is replaced with normalized src + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.4 + */ + virtual UnicodeString & + normalize(const UnicodeString &src, + UnicodeString &dest, + UErrorCode &errorCode) const U_OVERRIDE; + + /** + * Normalizes a UTF-8 string and optionally records how source substrings + * relate to changed and unchanged result substrings. + * + * Implemented completely for most built-in modes except for FCD. + * The base class implementation converts to & from UTF-16 and does not support edits. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src Source UTF-8 string. + * @param sink A ByteSink to which the normalized UTF-8 result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be nullptr. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 60 + */ + virtual void + normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, + Edits *edits, UErrorCode &errorCode) const U_OVERRIDE; + + /** + * Appends the normalized form of the second string to the first string + * (merging them at the boundary) and returns the first string. + * The result is normalized if the first string was normalized. + * The first and second strings must be different objects. + * @param first string, should be normalized + * @param second string, will be normalized + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ + virtual UnicodeString & + normalizeSecondAndAppend(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const U_OVERRIDE; + /** + * Appends the second string to the first string + * (merging them at the boundary) and returns the first string. + * The result is normalized if both the strings were normalized. + * The first and second strings must be different objects. + * @param first string, should be normalized + * @param second string, should be normalized + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ + virtual UnicodeString & + append(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const U_OVERRIDE; + + /** + * Gets the decomposition mapping of c. + * For details see the base class documentation. + * + * This function is independent of the mode of the Normalizer2. + * @param c code point + * @param decomposition String object which will be set to c's + * decomposition mapping, if there is one. + * @return true if c has a decomposition, otherwise false + * @stable ICU 4.6 + */ + virtual UBool + getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; + + /** + * Gets the raw decomposition mapping of c. + * For details see the base class documentation. + * + * This function is independent of the mode of the Normalizer2. + * @param c code point + * @param decomposition String object which will be set to c's + * raw decomposition mapping, if there is one. + * @return true if c has a decomposition, otherwise false + * @stable ICU 49 + */ + virtual UBool + getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; + + /** + * Performs pairwise composition of a & b and returns the composite if there is one. + * For details see the base class documentation. + * + * This function is independent of the mode of the Normalizer2. + * @param a A (normalization starter) code point. + * @param b Another code point. + * @return The non-negative composite code point if there is one; otherwise a negative value. + * @stable ICU 49 + */ + virtual UChar32 + composePair(UChar32 a, UChar32 b) const U_OVERRIDE; + + /** + * Gets the combining class of c. + * The default implementation returns 0 + * but all standard implementations return the Unicode Canonical_Combining_Class value. + * @param c code point + * @return c's combining class + * @stable ICU 49 + */ + virtual uint8_t + getCombiningClass(UChar32 c) const U_OVERRIDE; + + /** + * Tests if the string is normalized. + * For details see the Normalizer2 base class documentation. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return true if s is normalized + * @stable ICU 4.4 + */ + virtual UBool + isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; + /** + * Tests if the UTF-8 string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * + * This works for all normalization modes. + * It is optimized for UTF-8 for all built-in modes except for FCD. + * The base class implementation converts to UTF-16 and calls isNormalized(). + * + * @param s UTF-8 input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return true if s is normalized + * @stable ICU 60 + */ + virtual UBool + isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const U_OVERRIDE; + /** + * Tests if the string is normalized. + * For details see the Normalizer2 base class documentation. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return UNormalizationCheckResult + * @stable ICU 4.4 + */ + virtual UNormalizationCheckResult + quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; + /** + * Returns the end of the normalized substring of the input string. + * For details see the Normalizer2 base class documentation. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return "yes" span end index + * @stable ICU 4.4 + */ + virtual int32_t + spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; + + /** + * Tests if the character always has a normalization boundary before it, + * regardless of context. + * For details see the Normalizer2 base class documentation. + * @param c character to test + * @return true if c has a normalization boundary before it + * @stable ICU 4.4 + */ + virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE; + + /** + * Tests if the character always has a normalization boundary after it, + * regardless of context. + * For details see the Normalizer2 base class documentation. + * @param c character to test + * @return true if c has a normalization boundary after it + * @stable ICU 4.4 + */ + virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE; + + /** + * Tests if the character is normalization-inert. + * For details see the Normalizer2 base class documentation. + * @param c character to test + * @return true if c is normalization-inert + * @stable ICU 4.4 + */ + virtual UBool isInert(UChar32 c) const U_OVERRIDE; +private: + UnicodeString & + normalize(const UnicodeString &src, + UnicodeString &dest, + USetSpanCondition spanCondition, + UErrorCode &errorCode) const; + + void + normalizeUTF8(uint32_t options, const char *src, int32_t length, + ByteSink &sink, Edits *edits, + USetSpanCondition spanCondition, + UErrorCode &errorCode) const; + + UnicodeString & + normalizeSecondAndAppend(UnicodeString &first, + const UnicodeString &second, + UBool doNormalize, + UErrorCode &errorCode) const; + + const Normalizer2 &norm2; + const UnicodeSet &set; +}; + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_NORMALIZATION + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __NORMALIZER2_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/normlzr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/normlzr.h new file mode 100644 index 0000000000000000000000000000000000000000..3352983cdcc767ea103c4e16ab8eb0ecb1017c00 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/normlzr.h @@ -0,0 +1,816 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************** + * COPYRIGHT: + * Copyright (c) 1996-2015, International Business Machines Corporation and + * others. All Rights Reserved. + ******************************************************************** + */ + +#ifndef NORMLZR_H +#define NORMLZR_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief C++ API: Unicode Normalization + */ + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/chariter.h" +#include "unicode/normalizer2.h" +#include "unicode/unistr.h" +#include "unicode/unorm.h" +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN +/** + * Old Unicode normalization API. + * + * This API has been replaced by the Normalizer2 class and is only available + * for backward compatibility. This class simply delegates to the Normalizer2 class. + * There is one exception: The new API does not provide a replacement for Normalizer::compare(). + * + * The Normalizer class supports the standard normalization forms described in + * + * Unicode Standard Annex #15: Unicode Normalization Forms. + * + * The Normalizer class consists of two parts: + * - static functions that normalize strings or test if strings are normalized + * - a Normalizer object is an iterator that takes any kind of text and + * provides iteration over its normalized form + * + * The Normalizer class is not suitable for subclassing. + * + * For basic information about normalization forms and details about the C API + * please see the documentation in unorm.h. + * + * The iterator API with the Normalizer constructors and the non-static functions + * use a CharacterIterator as input. It is possible to pass a string which + * is then internally wrapped in a CharacterIterator. + * The input text is not normalized all at once, but incrementally where needed + * (providing efficient random access). + * This allows to pass in a large text but spend only a small amount of time + * normalizing a small part of that text. + * However, if the entire text is normalized, then the iterator will be + * slower than normalizing the entire text at once and iterating over the result. + * A possible use of the Normalizer iterator is also to report an index into the + * original text that is close to where the normalized characters come from. + * + * Important: The iterator API was cleaned up significantly for ICU 2.0. + * The earlier implementation reported the getIndex() inconsistently, + * and previous() could not be used after setIndex(), next(), first(), and current(). + * + * Normalizer allows to start normalizing from anywhere in the input text by + * calling setIndexOnly(), first(), or last(). + * Without calling any of these, the iterator will start at the beginning of the text. + * + * At any time, next() returns the next normalized code point (UChar32), + * with post-increment semantics (like CharacterIterator::next32PostInc()). + * previous() returns the previous normalized code point (UChar32), + * with pre-decrement semantics (like CharacterIterator::previous32()). + * + * current() returns the current code point + * (respectively the one at the newly set index) without moving + * the getIndex(). Note that if the text at the current position + * needs to be normalized, then these functions will do that. + * (This is why current() is not const.) + * It is more efficient to call setIndexOnly() instead, which does not + * normalize. + * + * getIndex() always refers to the position in the input text where the normalized + * code points are returned from. It does not always change with each returned + * code point. + * The code point that is returned from any of the functions + * corresponds to text at or after getIndex(), according to the + * function's iteration semantics (post-increment or pre-decrement). + * + * next() returns a code point from at or after the getIndex() + * from before the next() call. After the next() call, the getIndex() + * might have moved to where the next code point will be returned from + * (from a next() or current() call). + * This is semantically equivalent to array access with array[index++] + * (post-increment semantics). + * + * previous() returns a code point from at or after the getIndex() + * from after the previous() call. + * This is semantically equivalent to array access with array[--index] + * (pre-decrement semantics). + * + * Internally, the Normalizer iterator normalizes a small piece of text + * starting at the getIndex() and ending at a following "safe" index. + * The normalized results is stored in an internal string buffer, and + * the code points are iterated from there. + * With multiple iteration calls, this is repeated until the next piece + * of text needs to be normalized, and the getIndex() needs to be moved. + * + * The following "safe" index, the internal buffer, and the secondary + * iteration index into that buffer are not exposed on the API. + * This also means that it is currently not practical to return to + * a particular, arbitrary position in the text because one would need to + * know, and be able to set, in addition to the getIndex(), at least also the + * current index into the internal buffer. + * It is currently only possible to observe when getIndex() changes + * (with careful consideration of the iteration semantics), + * at which time the internal index will be 0. + * For example, if getIndex() is different after next() than before it, + * then the internal index is 0 and one can return to this getIndex() + * later with setIndexOnly(). + * + * Note: While the setIndex() and getIndex() refer to indices in the + * underlying Unicode input text, the next() and previous() methods + * iterate through characters in the normalized output. + * This means that there is not necessarily a one-to-one correspondence + * between characters returned by next() and previous() and the indices + * passed to and returned from setIndex() and getIndex(). + * It is for this reason that Normalizer does not implement the CharacterIterator interface. + * + * @author Laura Werner, Mark Davis, Markus Scherer + * @stable ICU 2.0 + */ +class U_COMMON_API Normalizer : public UObject { +public: +#ifndef U_HIDE_DEPRECATED_API + /** + * If DONE is returned from an iteration function that returns a code point, + * then there are no more normalization results available. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + enum { + DONE=0xffff + }; + + // Constructors + + /** + * Creates a new Normalizer object for iterating over the + * normalized form of a given string. + *

+ * @param str The string to be normalized. The normalization + * will start at the beginning of the string. + * + * @param mode The normalization mode. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer(const UnicodeString& str, UNormalizationMode mode); + + /** + * Creates a new Normalizer object for iterating over the + * normalized form of a given string. + *

+ * @param str The string to be normalized. The normalization + * will start at the beginning of the string. + * + * @param length Length of the string, or -1 if NUL-terminated. + * @param mode The normalization mode. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode); + + /** + * Creates a new Normalizer object for iterating over the + * normalized form of the given text. + *

+ * @param iter The input text to be normalized. The normalization + * will start at the beginning of the string. + * + * @param mode The normalization mode. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer(const CharacterIterator& iter, UNormalizationMode mode); +#endif /* U_HIDE_DEPRECATED_API */ + +#ifndef U_FORCE_HIDE_DEPRECATED_API + /** + * Copy constructor. + * @param copy The object to be copied. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer(const Normalizer& copy); + + /** + * Destructor + * @deprecated ICU 56 Use Normalizer2 instead. + */ + virtual ~Normalizer(); +#endif // U_FORCE_HIDE_DEPRECATED_API + + //------------------------------------------------------------------------- + // Static utility methods + //------------------------------------------------------------------------- + +#ifndef U_HIDE_DEPRECATED_API + /** + * Normalizes a UnicodeString according to the specified normalization mode. + * This is a wrapper for unorm_normalize(), using UnicodeString's. + * + * The options parameter specifies which optional + * Normalizer features are to be enabled for this operation. + * + * @param source the input string to be normalized. + * @param mode the normalization mode + * @param options the optional features to be enabled (0 for no options) + * @param result The normalized string (on output). + * @param status The error code. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static void U_EXPORT2 normalize(const UnicodeString& source, + UNormalizationMode mode, int32_t options, + UnicodeString& result, + UErrorCode &status); + + /** + * Compose a UnicodeString. + * This is equivalent to normalize() with mode UNORM_NFC or UNORM_NFKC. + * This is a wrapper for unorm_normalize(), using UnicodeString's. + * + * The options parameter specifies which optional + * Normalizer features are to be enabled for this operation. + * + * @param source the string to be composed. + * @param compat Perform compatibility decomposition before composition. + * If this argument is false, only canonical + * decomposition will be performed. + * @param options the optional features to be enabled (0 for no options) + * @param result The composed string (on output). + * @param status The error code. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static void U_EXPORT2 compose(const UnicodeString& source, + UBool compat, int32_t options, + UnicodeString& result, + UErrorCode &status); + + /** + * Static method to decompose a UnicodeString. + * This is equivalent to normalize() with mode UNORM_NFD or UNORM_NFKD. + * This is a wrapper for unorm_normalize(), using UnicodeString's. + * + * The options parameter specifies which optional + * Normalizer features are to be enabled for this operation. + * + * @param source the string to be decomposed. + * @param compat Perform compatibility decomposition. + * If this argument is false, only canonical + * decomposition will be performed. + * @param options the optional features to be enabled (0 for no options) + * @param result The decomposed string (on output). + * @param status The error code. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static void U_EXPORT2 decompose(const UnicodeString& source, + UBool compat, int32_t options, + UnicodeString& result, + UErrorCode &status); + + /** + * Performing quick check on a string, to quickly determine if the string is + * in a particular normalization format. + * This is a wrapper for unorm_quickCheck(), using a UnicodeString. + * + * Three types of result can be returned UNORM_YES, UNORM_NO or + * UNORM_MAYBE. Result UNORM_YES indicates that the argument + * string is in the desired normalized format, UNORM_NO determines that + * argument string is not in the desired normalized format. A + * UNORM_MAYBE result indicates that a more thorough check is required, + * the user may have to put the string in its normalized form and compare the + * results. + * @param source string for determining if it is in a normalized format + * @param mode normalization format + * @param status A reference to a UErrorCode to receive any errors + * @return UNORM_YES, UNORM_NO or UNORM_MAYBE + * + * @see isNormalized + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static inline UNormalizationCheckResult + quickCheck(const UnicodeString &source, UNormalizationMode mode, UErrorCode &status); + + /** + * Performing quick check on a string; same as the other version of quickCheck + * but takes an extra options parameter like most normalization functions. + * + * @param source string for determining if it is in a normalized format + * @param mode normalization format + * @param options the optional features to be enabled (0 for no options) + * @param status A reference to a UErrorCode to receive any errors + * @return UNORM_YES, UNORM_NO or UNORM_MAYBE + * + * @see isNormalized + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static UNormalizationCheckResult + quickCheck(const UnicodeString &source, UNormalizationMode mode, int32_t options, UErrorCode &status); + + /** + * Test if a string is in a given normalization form. + * This is semantically equivalent to source.equals(normalize(source, mode)) . + * + * Unlike unorm_quickCheck(), this function returns a definitive result, + * never a "maybe". + * For NFD, NFKD, and FCD, both functions work exactly the same. + * For NFC and NFKC where quickCheck may return "maybe", this function will + * perform further tests to arrive at a true/false result. + * + * @param src String that is to be tested if it is in a normalization format. + * @param mode Which normalization form to test for. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Boolean value indicating whether the source string is in the + * "mode" normalization form. + * + * @see quickCheck + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static inline UBool + isNormalized(const UnicodeString &src, UNormalizationMode mode, UErrorCode &errorCode); + + /** + * Test if a string is in a given normalization form; same as the other version of isNormalized + * but takes an extra options parameter like most normalization functions. + * + * @param src String that is to be tested if it is in a normalization format. + * @param mode Which normalization form to test for. + * @param options the optional features to be enabled (0 for no options) + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Boolean value indicating whether the source string is in the + * "mode" normalization form. + * + * @see quickCheck + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static UBool + isNormalized(const UnicodeString &src, UNormalizationMode mode, int32_t options, UErrorCode &errorCode); + + /** + * Concatenate normalized strings, making sure that the result is normalized as well. + * + * If both the left and the right strings are in + * the normalization form according to "mode/options", + * then the result will be + * + * \code + * dest=normalize(left+right, mode, options) + * \endcode + * + * For details see unorm_concatenate in unorm.h. + * + * @param left Left source string. + * @param right Right source string. + * @param result The output string. + * @param mode The normalization mode. + * @param options A bit set of normalization options. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return result + * + * @see unorm_concatenate + * @see normalize + * @see unorm_next + * @see unorm_previous + * + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static UnicodeString & + U_EXPORT2 concatenate(const UnicodeString &left, const UnicodeString &right, + UnicodeString &result, + UNormalizationMode mode, int32_t options, + UErrorCode &errorCode); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Compare two strings for canonical equivalence. + * Further options include case-insensitive comparison and + * code point order (as opposed to code unit order). + * + * Canonical equivalence between two strings is defined as their normalized + * forms (NFD or NFC) being identical. + * This function compares strings incrementally instead of normalizing + * (and optionally case-folding) both strings entirely, + * improving performance significantly. + * + * Bulk normalization is only necessary if the strings do not fulfill the FCD + * conditions. Only in this case, and only if the strings are relatively long, + * is memory allocated temporarily. + * For FCD strings and short non-FCD strings there is no memory allocation. + * + * Semantically, this is equivalent to + * strcmp[CodePointOrder](NFD(foldCase(s1)), NFD(foldCase(s2))) + * where code point order and foldCase are all optional. + * + * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match + * the case folding must be performed first, then the normalization. + * + * @param s1 First source string. + * @param s2 Second source string. + * + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Case-sensitive comparison in code unit order, and the input strings + * are quick-checked for FCD. + * + * - UNORM_INPUT_IS_FCD + * Set if the caller knows that both s1 and s2 fulfill the FCD conditions. + * If not set, the function will quickCheck for FCD + * and normalize if necessary. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_COMPARE_IGNORE_CASE + * Set to compare strings case-insensitively using case folding, + * instead of case-sensitively. + * If set, then the following case folding options are used. + * + * - Options as used with case-insensitive comparisons, currently: + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * (see u_strCaseCompare for details) + * + * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT + * + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return <0 or 0 or >0 as usual for string comparisons + * + * @see unorm_compare + * @see normalize + * @see UNORM_FCD + * @see u_strCompare + * @see u_strCaseCompare + * + * @stable ICU 2.2 + */ + static inline int32_t + compare(const UnicodeString &s1, const UnicodeString &s2, + uint32_t options, + UErrorCode &errorCode); + +#ifndef U_HIDE_DEPRECATED_API + //------------------------------------------------------------------------- + // Iteration API + //------------------------------------------------------------------------- + + /** + * Return the current character in the normalized text. + * current() may need to normalize some text at getIndex(). + * The getIndex() is not changed. + * + * @return the current normalized code point + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UChar32 current(void); + + /** + * Return the first character in the normalized text. + * This is equivalent to setIndexOnly(startIndex()) followed by next(). + * (Post-increment semantics.) + * + * @return the first normalized code point + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UChar32 first(void); + + /** + * Return the last character in the normalized text. + * This is equivalent to setIndexOnly(endIndex()) followed by previous(). + * (Pre-decrement semantics.) + * + * @return the last normalized code point + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UChar32 last(void); + + /** + * Return the next character in the normalized text. + * (Post-increment semantics.) + * If the end of the text has already been reached, DONE is returned. + * The DONE value could be confused with a U+FFFF non-character code point + * in the text. If this is possible, you can test getIndex()startIndex() || first()!=DONE). (Calling first() will change + * the iterator state!) + * + * The C API unorm_previous() is more efficient and does not have this ambiguity. + * + * @return the previous normalized code point + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UChar32 previous(void); + + /** + * Set the iteration position in the input text that is being normalized, + * without any immediate normalization. + * After setIndexOnly(), getIndex() will return the same index that is + * specified here. + * + * @param index the desired index in the input text. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setIndexOnly(int32_t index); + + /** + * Reset the index to the beginning of the text. + * This is equivalent to setIndexOnly(startIndex)). + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void reset(void); + + /** + * Retrieve the current iteration position in the input text that is + * being normalized. + * + * A following call to next() will return a normalized code point from + * the input text at or after this index. + * + * After a call to previous(), getIndex() will point at or before the + * position in the input text where the normalized code point + * was returned from with previous(). + * + * @return the current index in the input text + * @deprecated ICU 56 Use Normalizer2 instead. + */ + int32_t getIndex(void) const; + + /** + * Retrieve the index of the start of the input text. This is the begin index + * of the CharacterIterator or the start (i.e. index 0) of the string + * over which this Normalizer is iterating. + * + * @return the smallest index in the input text where the Normalizer operates + * @deprecated ICU 56 Use Normalizer2 instead. + */ + int32_t startIndex(void) const; + + /** + * Retrieve the index of the end of the input text. This is the end index + * of the CharacterIterator or the length of the string + * over which this Normalizer is iterating. + * This end index is exclusive, i.e., the Normalizer operates only on characters + * before this index. + * + * @return the first index in the input text where the Normalizer does not operate + * @deprecated ICU 56 Use Normalizer2 instead. + */ + int32_t endIndex(void) const; + + /** + * Returns true when both iterators refer to the same character in the same + * input text. + * + * @param that a Normalizer object to compare this one to + * @return comparison result + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UBool operator==(const Normalizer& that) const; + + /** + * Returns false when both iterators refer to the same character in the same + * input text. + * + * @param that a Normalizer object to compare this one to + * @return comparison result + * @deprecated ICU 56 Use Normalizer2 instead. + */ + inline UBool operator!=(const Normalizer& that) const; + + /** + * Returns a pointer to a new Normalizer that is a clone of this one. + * The caller is responsible for deleting the new clone. + * @return a pointer to a new Normalizer + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer* clone() const; + + /** + * Generates a hash code for this iterator. + * + * @return the hash code + * @deprecated ICU 56 Use Normalizer2 instead. + */ + int32_t hashCode(void) const; + + //------------------------------------------------------------------------- + // Property access methods + //------------------------------------------------------------------------- + + /** + * Set the normalization mode for this object. + *

+ * Note:If the normalization mode is changed while iterating + * over a string, calls to {@link #next() } and {@link #previous() } may + * return previously buffers characters in the old normalization mode + * until the iteration is able to re-sync at the next base character. + * It is safest to call {@link #setIndexOnly }, {@link #reset() }, + * {@link #setText }, {@link #first() }, + * {@link #last() }, etc. after calling setMode. + *

+ * @param newMode the new mode for this Normalizer. + * @see #getUMode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setMode(UNormalizationMode newMode); + + /** + * Return the normalization mode for this object. + * + * This is an unusual name because there used to be a getMode() that + * returned a different type. + * + * @return the mode for this Normalizer + * @see #setMode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UNormalizationMode getUMode(void) const; + + /** + * Set options that affect this Normalizer's operation. + * Options do not change the basic composition or decomposition operation + * that is being performed, but they control whether + * certain optional portions of the operation are done. + * Currently the only available option is obsolete. + * + * It is possible to specify multiple options that are all turned on or off. + * + * @param option the option(s) whose value is/are to be set. + * @param value the new setting for the option. Use true to + * turn the option(s) on and false to turn it/them off. + * + * @see #getOption + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setOption(int32_t option, + UBool value); + + /** + * Determine whether an option is turned on or off. + * If multiple options are specified, then the result is true if any + * of them are set. + *

+ * @param option the option(s) that are to be checked + * @return true if any of the option(s) are set + * @see #setOption + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UBool getOption(int32_t option) const; + + /** + * Set the input text over which this Normalizer will iterate. + * The iteration position is set to the beginning. + * + * @param newText a string that replaces the current input text + * @param status a UErrorCode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setText(const UnicodeString& newText, + UErrorCode &status); + + /** + * Set the input text over which this Normalizer will iterate. + * The iteration position is set to the beginning. + * + * @param newText a CharacterIterator object that replaces the current input text + * @param status a UErrorCode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setText(const CharacterIterator& newText, + UErrorCode &status); + + /** + * Set the input text over which this Normalizer will iterate. + * The iteration position is set to the beginning. + * + * @param newText a string that replaces the current input text + * @param length the length of the string, or -1 if NUL-terminated + * @param status a UErrorCode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setText(ConstChar16Ptr newText, + int32_t length, + UErrorCode &status); + /** + * Copies the input text into the UnicodeString argument. + * + * @param result Receives a copy of the text under iteration. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void getText(UnicodeString& result); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * @returns a UClassID for this class. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static UClassID U_EXPORT2 getStaticClassID(); +#endif /* U_HIDE_DEPRECATED_API */ + +#ifndef U_FORCE_HIDE_DEPRECATED_API + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * @return a UClassID for the actual class. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + virtual UClassID getDynamicClassID() const; +#endif // U_FORCE_HIDE_DEPRECATED_API + +private: + //------------------------------------------------------------------------- + // Private functions + //------------------------------------------------------------------------- + + Normalizer(); // default constructor not implemented + Normalizer &operator=(const Normalizer &that); // assignment operator not implemented + + // Private utility methods for iteration + // For documentation, see the source code + UBool nextNormalize(); + UBool previousNormalize(); + + void init(); + void clearBuffer(void); + + //------------------------------------------------------------------------- + // Private data + //------------------------------------------------------------------------- + + FilteredNormalizer2*fFilteredNorm2; // owned if not NULL + const Normalizer2 *fNorm2; // not owned; may be equal to fFilteredNorm2 + UNormalizationMode fUMode; // deprecated + int32_t fOptions; + + // The input text and our position in it + CharacterIterator *text; + + // The normalization buffer is the result of normalization + // of the source in [currentIndex..nextIndex[ . + int32_t currentIndex, nextIndex; + + // A buffer for holding intermediate results + UnicodeString buffer; + int32_t bufferPos; +}; + +//------------------------------------------------------------------------- +// Inline implementations +//------------------------------------------------------------------------- + +#ifndef U_HIDE_DEPRECATED_API +inline UBool +Normalizer::operator!= (const Normalizer& other) const +{ return ! operator==(other); } + +inline UNormalizationCheckResult +Normalizer::quickCheck(const UnicodeString& source, + UNormalizationMode mode, + UErrorCode &status) { + return quickCheck(source, mode, 0, status); +} + +inline UBool +Normalizer::isNormalized(const UnicodeString& source, + UNormalizationMode mode, + UErrorCode &status) { + return isNormalized(source, mode, 0, status); +} +#endif /* U_HIDE_DEPRECATED_API */ + +inline int32_t +Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2, + uint32_t options, + UErrorCode &errorCode) { + // all argument checking is done in unorm_compare + return unorm_compare(toUCharPtr(s1.getBuffer()), s1.length(), + toUCharPtr(s2.getBuffer()), s2.length(), + options, + &errorCode); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_NORMALIZATION */ + +#endif // NORMLZR_H + +#endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/parseerr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/parseerr.h new file mode 100644 index 0000000000000000000000000000000000000000..c23cc273b828ebcfd8814f4ab22c9663d53cd293 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/parseerr.h @@ -0,0 +1,94 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2005, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 03/14/00 aliu Creation. +* 06/27/00 aliu Change from C++ class to C struct +********************************************************************** +*/ +#ifndef PARSEERR_H +#define PARSEERR_H + +#include "unicode/utypes.h" + + +/** + * \file + * \brief C API: Parse Error Information + */ +/** + * The capacity of the context strings in UParseError. + * @stable ICU 2.0 + */ +enum { U_PARSE_CONTEXT_LEN = 16 }; + +/** + * A UParseError struct is used to returned detailed information about + * parsing errors. It is used by ICU parsing engines that parse long + * rules, patterns, or programs, where the text being parsed is long + * enough that more information than a UErrorCode is needed to + * localize the error. + * + *

The line, offset, and context fields are optional; parsing + * engines may choose not to use to use them. + * + *

The preContext and postContext strings include some part of the + * context surrounding the error. If the source text is "let for=7" + * and "for" is the error (e.g., because it is a reserved word), then + * some examples of what a parser might produce are the following: + * + *

+ * preContext   postContext
+ * ""           ""            The parser does not support context
+ * "let "       "=7"          Pre- and post-context only
+ * "let "       "for=7"       Pre- and post-context and error text
+ * ""           "for"         Error text only
+ * 
+ * + *

Examples of engines which use UParseError (or may use it in the + * future) are Transliterator, RuleBasedBreakIterator, and + * RegexPattern. + * + * @stable ICU 2.0 + */ +typedef struct UParseError { + + /** + * The line on which the error occurred. If the parser uses this + * field, it sets it to the line number of the source text line on + * which the error appears, which will be a value >= 1. If the + * parse does not support line numbers, the value will be <= 0. + * @stable ICU 2.0 + */ + int32_t line; + + /** + * The character offset to the error. If the line field is >= 1, + * then this is the offset from the start of the line. Otherwise, + * this is the offset from the start of the text. If the parser + * does not support this field, it will have a value < 0. + * @stable ICU 2.0 + */ + int32_t offset; + + /** + * Textual context before the error. Null-terminated. The empty + * string if not supported by parser. + * @stable ICU 2.0 + */ + UChar preContext[U_PARSE_CONTEXT_LEN]; + + /** + * The error itself and/or textual context after the error. + * Null-terminated. The empty string if not supported by parser. + * @stable ICU 2.0 + */ + UChar postContext[U_PARSE_CONTEXT_LEN]; + +} UParseError; + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/parsepos.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/parsepos.h new file mode 100644 index 0000000000000000000000000000000000000000..260ed4cbb86e5c9cbe30062127d7be75dbf53551 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/parsepos.h @@ -0,0 +1,237 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +* Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved. +******************************************************************************* +* +* File PARSEPOS.H +* +* Modification History: +* +* Date Name Description +* 07/09/97 helena Converted from java. +* 07/17/98 stephen Added errorIndex support. +* 05/11/99 stephen Cleaned up. +******************************************************************************* +*/ + +#ifndef PARSEPOS_H +#define PARSEPOS_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" + + +U_NAMESPACE_BEGIN + +/** + * \file + * \brief C++ API: Canonical Iterator + */ +/** + * ParsePosition is a simple class used by Format + * and its subclasses to keep track of the current position during parsing. + * The parseObject method in the various Format + * classes requires a ParsePosition object as an argument. + * + *

+ * By design, as you parse through a string with different formats, + * you can use the same ParsePosition, since the index parameter + * records the current position. + * + * The ParsePosition class is not suitable for subclassing. + * + * @version 1.3 10/30/97 + * @author Mark Davis, Helena Shih + * @see java.text.Format + */ + +class U_COMMON_API ParsePosition : public UObject { +public: + /** + * Default constructor, the index starts with 0 as default. + * @stable ICU 2.0 + */ + ParsePosition() + : UObject(), + index(0), + errorIndex(-1) + {} + + /** + * Create a new ParsePosition with the given initial index. + * @param newIndex the new text offset. + * @stable ICU 2.0 + */ + ParsePosition(int32_t newIndex) + : UObject(), + index(newIndex), + errorIndex(-1) + {} + + /** + * Copy constructor + * @param copy the object to be copied from. + * @stable ICU 2.0 + */ + ParsePosition(const ParsePosition& copy) + : UObject(copy), + index(copy.index), + errorIndex(copy.errorIndex) + {} + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~ParsePosition(); + + /** + * Assignment operator + * @stable ICU 2.0 + */ + inline ParsePosition& operator=(const ParsePosition& copy); + + /** + * Equality operator. + * @return true if the two parse positions are equal, false otherwise. + * @stable ICU 2.0 + */ + inline UBool operator==(const ParsePosition& that) const; + + /** + * Equality operator. + * @return true if the two parse positions are not equal, false otherwise. + * @stable ICU 2.0 + */ + inline UBool operator!=(const ParsePosition& that) const; + + /** + * Clone this object. + * Clones can be used concurrently in multiple threads. + * If an error occurs, then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + ParsePosition *clone() const; + + /** + * Retrieve the current parse position. On input to a parse method, this + * is the index of the character at which parsing will begin; on output, it + * is the index of the character following the last character parsed. + * @return the current index. + * @stable ICU 2.0 + */ + inline int32_t getIndex(void) const; + + /** + * Set the current parse position. + * @param index the new index. + * @stable ICU 2.0 + */ + inline void setIndex(int32_t index); + + /** + * Set the index at which a parse error occurred. Formatters + * should set this before returning an error code from their + * parseObject method. The default value is -1 if this is not + * set. + * @stable ICU 2.0 + */ + inline void setErrorIndex(int32_t ei); + + /** + * Retrieve the index at which an error occurred, or -1 if the + * error index has not been set. + * @stable ICU 2.0 + */ + inline int32_t getErrorIndex(void) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + +private: + /** + * Input: the place you start parsing. + *
Output: position where the parse stopped. + * This is designed to be used serially, + * with each call setting index up for the next one. + */ + int32_t index; + + /** + * The index at which a parse error occurred. + */ + int32_t errorIndex; + +}; + +inline ParsePosition& +ParsePosition::operator=(const ParsePosition& copy) +{ + index = copy.index; + errorIndex = copy.errorIndex; + return *this; +} + +inline UBool +ParsePosition::operator==(const ParsePosition& copy) const +{ + if(index != copy.index || errorIndex != copy.errorIndex) + return false; + else + return true; +} + +inline UBool +ParsePosition::operator!=(const ParsePosition& copy) const +{ + return !operator==(copy); +} + +inline int32_t +ParsePosition::getIndex() const +{ + return index; +} + +inline void +ParsePosition::setIndex(int32_t offset) +{ + this->index = offset; +} + +inline int32_t +ParsePosition::getErrorIndex() const +{ + return errorIndex; +} + +inline void +ParsePosition::setErrorIndex(int32_t ei) +{ + this->errorIndex = ei; +} +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/platform.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/platform.h new file mode 100644 index 0000000000000000000000000000000000000000..cb3a833fefc9b1dc515cf55f8fd9b80f3543ee47 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/platform.h @@ -0,0 +1,885 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : platform.h +* +* Date Name Description +* 05/13/98 nos Creation (content moved here from ptypes.h). +* 03/02/99 stephen Added AS400 support. +* 03/30/99 stephen Added Linux support. +* 04/13/99 stephen Reworked for autoconf. +****************************************************************************** +*/ + +#ifndef _PLATFORM_H +#define _PLATFORM_H + +#include "unicode/uconfig.h" +#include "unicode/uvernum.h" + +/** + * \file + * \brief Basic types for the platform. + * + * This file used to be generated by autoconf/configure. + * Starting with ICU 49, platform.h is a normal source file, + * to simplify cross-compiling and working with non-autoconf/make build systems. + * + * When a value in this file does not work on a platform, then please + * try to derive it from the U_PLATFORM value + * (for which we might need a new value constant in rare cases) + * and/or from other macros that are predefined by the compiler + * or defined in standard (POSIX or platform or compiler) headers. + * + * As a temporary workaround, you can add an explicit \#define for some macros + * before it is first tested, or add an equivalent -D macro definition + * to the compiler's command line. + * + * Note: Some compilers provide ways to show the predefined macros. + * For example, with gcc you can compile an empty .c file and have the compiler + * print the predefined macros with + * \code + * gcc -E -dM -x c /dev/null | sort + * \endcode + * (You can provide an actual empty .c file rather than /dev/null. + * -x c++ is for C++.) + */ + +/** + * Define some things so that they can be documented. + * @internal + */ +#ifdef U_IN_DOXYGEN +/* + * Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented. + * Solution: #define any defines for non @internal API here, so that they are visible in the docs. If you just set PREDEFINED in Doxyfile.in, they won't be documented. + */ + +/* None for now. */ +#endif + +/** + * \def U_PLATFORM + * The U_PLATFORM macro defines the platform we're on. + * + * We used to define one different, value-less macro per platform. + * That made it hard to know the set of relevant platforms and macros, + * and hard to deal with variants of platforms. + * + * Starting with ICU 49, we define platforms as numeric macros, + * with ranges of values for related platforms and their variants. + * The U_PLATFORM macro is set to one of these values. + * + * Historical note from the Solaris Wikipedia article: + * AT&T and Sun collaborated on a project to merge the most popular Unix variants + * on the market at that time: BSD, System V, and Xenix. + * This became Unix System V Release 4 (SVR4). + * + * @internal + */ + +/** Unknown platform. @internal */ +#define U_PF_UNKNOWN 0 +/** Windows @internal */ +#define U_PF_WINDOWS 1000 +/** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */ +#define U_PF_MINGW 1800 +/** + * Cygwin. Windows, calls to cygwin1.dll for Posix functions, + * using MSVC or GNU gcc and binutils. + * @internal + */ +#define U_PF_CYGWIN 1900 +/* Reserve 2000 for U_PF_UNIX? */ +/** HP-UX is based on UNIX System V. @internal */ +#define U_PF_HPUX 2100 +/** Solaris is a Unix operating system based on SVR4. @internal */ +#define U_PF_SOLARIS 2600 +/** BSD is a UNIX operating system derivative. @internal */ +#define U_PF_BSD 3000 +/** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */ +#define U_PF_AIX 3100 +/** IRIX is based on UNIX System V with BSD extensions. @internal */ +#define U_PF_IRIX 3200 +/** + * Darwin is a POSIX-compliant operating system, composed of code developed by Apple, + * as well as code derived from NeXTSTEP, BSD, and other projects, + * built around the Mach kernel. + * Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based. + * (Original description modified from WikiPedia.) + * @internal + */ +#define U_PF_DARWIN 3500 +/** iPhone OS (iOS) is a derivative of Mac OS X. @internal */ +#define U_PF_IPHONE 3550 +/** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */ +#define U_PF_QNX 3700 +/** Linux is a Unix-like operating system. @internal */ +#define U_PF_LINUX 4000 +/** + * Native Client is pretty close to Linux. + * See https://developer.chrome.com/native-client and + * http://www.chromium.org/nativeclient + * @internal + */ +#define U_PF_BROWSER_NATIVE_CLIENT 4020 +/** Android is based on Linux. @internal */ +#define U_PF_ANDROID 4050 +/** Fuchsia is a POSIX-ish platform. @internal */ +#define U_PF_FUCHSIA 4100 +/* Maximum value for Linux-based platform is 4499 */ +/** + * Emscripten is a C++ transpiler for the Web that can target asm.js or + * WebAssembly. It provides some POSIX-compatible wrappers and stubs and + * some Linux-like functionality, but is not fully compatible with + * either. + * @internal + */ +#define U_PF_EMSCRIPTEN 5010 +/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */ +#define U_PF_OS390 9000 +/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */ +#define U_PF_OS400 9400 + +#ifdef U_PLATFORM + /* Use the predefined value. */ +#elif defined(__MINGW32__) +# define U_PLATFORM U_PF_MINGW +#elif defined(__CYGWIN__) +# define U_PLATFORM U_PF_CYGWIN +#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) +# define U_PLATFORM U_PF_WINDOWS +#elif defined(__ANDROID__) +# define U_PLATFORM U_PF_ANDROID + /* Android wchar_t support depends on the API level. */ +# include +#elif defined(__pnacl__) || defined(__native_client__) +# define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT +#elif defined(__Fuchsia__) +# define U_PLATFORM U_PF_FUCHSIA +#elif defined(linux) || defined(__linux__) || defined(__linux) +# define U_PLATFORM U_PF_LINUX +#elif defined(__APPLE__) && defined(__MACH__) +# include +# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */ +# define U_PLATFORM U_PF_IPHONE +# else +# define U_PLATFORM U_PF_DARWIN +# endif +#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__) +# if defined(__FreeBSD__) +# include +# endif +# define U_PLATFORM U_PF_BSD +#elif defined(sun) || defined(__sun) + /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */ +# define U_PLATFORM U_PF_SOLARIS +# if defined(__GNUC__) + /* Solaris/GCC needs this header file to get the proper endianness. Normally, this + * header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h + * is included which does not include this header file. + */ +# include +# endif +#elif defined(_AIX) || defined(__TOS_AIX__) +# define U_PLATFORM U_PF_AIX +#elif defined(_hpux) || defined(hpux) || defined(__hpux) +# define U_PLATFORM U_PF_HPUX +#elif defined(sgi) || defined(__sgi) +# define U_PLATFORM U_PF_IRIX +#elif defined(__QNX__) || defined(__QNXNTO__) +# define U_PLATFORM U_PF_QNX +#elif defined(__TOS_MVS__) +# define U_PLATFORM U_PF_OS390 +#elif defined(__OS400__) || defined(__TOS_OS400__) +# define U_PLATFORM U_PF_OS400 +#elif defined(__EMSCRIPTEN__) +# define U_PLATFORM U_PF_EMSCRIPTEN +#else +# define U_PLATFORM U_PF_UNKNOWN +#endif + +/** + * \def CYGWINMSVC + * Defined if this is Windows with Cygwin, but using MSVC rather than gcc. + * Otherwise undefined. + * @internal + */ +/* Commented out because this is already set in mh-cygwin-msvc +#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER) +# define CYGWINMSVC +#endif +*/ +#ifdef U_IN_DOXYGEN +# define CYGWINMSVC +#endif + +/** + * \def U_PLATFORM_USES_ONLY_WIN32_API + * Defines whether the platform uses only the Win32 API. + * Set to 1 for Windows/MSVC and MinGW but not Cygwin. + * @internal + */ +#ifdef U_PLATFORM_USES_ONLY_WIN32_API + /* Use the predefined value. */ +#elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC) +# define U_PLATFORM_USES_ONLY_WIN32_API 1 +#else + /* Cygwin implements POSIX. */ +# define U_PLATFORM_USES_ONLY_WIN32_API 0 +#endif + +/** + * \def U_PLATFORM_HAS_WIN32_API + * Defines whether the Win32 API is available on the platform. + * Set to 1 for Windows/MSVC, MinGW and Cygwin. + * @internal + */ +#ifdef U_PLATFORM_HAS_WIN32_API + /* Use the predefined value. */ +#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +# define U_PLATFORM_HAS_WIN32_API 1 +#else +# define U_PLATFORM_HAS_WIN32_API 0 +#endif + +/** + * \def U_PLATFORM_HAS_WINUWP_API + * Defines whether target is intended for Universal Windows Platform API + * Set to 1 for Windows10 Release Solution Configuration + * @internal + */ +#ifdef U_PLATFORM_HAS_WINUWP_API + /* Use the predefined value. */ +#else +# define U_PLATFORM_HAS_WINUWP_API 0 +#endif + +/** + * \def U_PLATFORM_IMPLEMENTS_POSIX + * Defines whether the platform implements (most of) the POSIX API. + * Set to 1 for Cygwin and most other platforms. + * @internal + */ +#ifdef U_PLATFORM_IMPLEMENTS_POSIX + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API +# define U_PLATFORM_IMPLEMENTS_POSIX 0 +#else +# define U_PLATFORM_IMPLEMENTS_POSIX 1 +#endif + +/** + * \def U_PLATFORM_IS_LINUX_BASED + * Defines whether the platform is Linux or one of its derivatives. + * @internal + */ +#ifdef U_PLATFORM_IS_LINUX_BASED + /* Use the predefined value. */ +#elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= 4499 +# define U_PLATFORM_IS_LINUX_BASED 1 +#else +# define U_PLATFORM_IS_LINUX_BASED 0 +#endif + +/** + * \def U_PLATFORM_IS_DARWIN_BASED + * Defines whether the platform is Darwin or one of its derivatives. + * @internal + */ +#ifdef U_PLATFORM_IS_DARWIN_BASED + /* Use the predefined value. */ +#elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE +# define U_PLATFORM_IS_DARWIN_BASED 1 +#else +# define U_PLATFORM_IS_DARWIN_BASED 0 +#endif + +/** + * \def U_HAVE_STDINT_H + * Defines whether stdint.h is available. It is a C99 standard header. + * We used to include inttypes.h which includes stdint.h but we usually do not need + * the additional definitions from inttypes.h. + * @internal + */ +#ifdef U_HAVE_STDINT_H + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API +# if defined(__BORLANDC__) || U_PLATFORM == U_PF_MINGW || (defined(_MSC_VER) && _MSC_VER>=1600) + /* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */ +# define U_HAVE_STDINT_H 1 +# else +# define U_HAVE_STDINT_H 0 +# endif +#elif U_PLATFORM == U_PF_SOLARIS + /* Solaris has inttypes.h but not stdint.h. */ +# define U_HAVE_STDINT_H 0 +#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER) + /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */ +# define U_HAVE_STDINT_H 0 +#else +# define U_HAVE_STDINT_H 1 +#endif + +/** + * \def U_HAVE_INTTYPES_H + * Defines whether inttypes.h is available. It is a C99 standard header. + * We include inttypes.h where it is available but stdint.h is not. + * @internal + */ +#ifdef U_HAVE_INTTYPES_H + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_SOLARIS + /* Solaris has inttypes.h but not stdint.h. */ +# define U_HAVE_INTTYPES_H 1 +#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER) + /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */ +# define U_HAVE_INTTYPES_H 1 +#else + /* Most platforms have both inttypes.h and stdint.h, or neither. */ +# define U_HAVE_INTTYPES_H U_HAVE_STDINT_H +#endif + +/*===========================================================================*/ +/** @{ Compiler and environment features */ +/*===========================================================================*/ + +/** + * \def U_GCC_MAJOR_MINOR + * Indicates whether the compiler is gcc (test for != 0), + * and if so, contains its major (times 100) and minor version numbers. + * If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0. + * + * For example, for testing for whether we have gcc, and whether it's 4.6 or higher, + * use "#if U_GCC_MAJOR_MINOR >= 406". + * @internal + */ +#ifdef __GNUC__ +# define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__) +#else +# define U_GCC_MAJOR_MINOR 0 +#endif + +/** + * \def U_IS_BIG_ENDIAN + * Determines the endianness of the platform. + * @internal + */ +#ifdef U_IS_BIG_ENDIAN + /* Use the predefined value. */ +#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN) +# define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) +#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) + /* gcc */ +# define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN) +# define U_IS_BIG_ENDIAN 1 +#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN) +# define U_IS_BIG_ENDIAN 0 +#elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__) + /* These platforms do not appear to predefine any endianness macros. */ +# define U_IS_BIG_ENDIAN 1 +#elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) + /* HPPA do not appear to predefine any endianness macros. */ +# define U_IS_BIG_ENDIAN 1 +#elif defined(sparc) || defined(__sparc) || defined(__sparc__) + /* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */ +# define U_IS_BIG_ENDIAN 1 +#else +# define U_IS_BIG_ENDIAN 0 +#endif + +/** + * \def U_HAVE_PLACEMENT_NEW + * Determines whether to override placement new and delete for STL. + * @stable ICU 2.6 + */ +#ifdef U_HAVE_PLACEMENT_NEW + /* Use the predefined value. */ +#elif defined(__BORLANDC__) +# define U_HAVE_PLACEMENT_NEW 0 +#else +# define U_HAVE_PLACEMENT_NEW 1 +#endif + +/** + * \def U_HAVE_DEBUG_LOCATION_NEW + * Define this to define the MFC debug version of the operator new. + * + * @stable ICU 3.4 + */ +#ifdef U_HAVE_DEBUG_LOCATION_NEW + /* Use the predefined value. */ +#elif defined(_MSC_VER) +# define U_HAVE_DEBUG_LOCATION_NEW 1 +#else +# define U_HAVE_DEBUG_LOCATION_NEW 0 +#endif + +/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */ +#ifdef __has_attribute +# define UPRV_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define UPRV_HAS_ATTRIBUTE(x) 0 +#endif +#ifdef __has_cpp_attribute +# define UPRV_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#else +# define UPRV_HAS_CPP_ATTRIBUTE(x) 0 +#endif +#ifdef __has_declspec_attribute +# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x) +#else +# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) 0 +#endif +#ifdef __has_builtin +# define UPRV_HAS_BUILTIN(x) __has_builtin(x) +#else +# define UPRV_HAS_BUILTIN(x) 0 +#endif +#ifdef __has_feature +# define UPRV_HAS_FEATURE(x) __has_feature(x) +#else +# define UPRV_HAS_FEATURE(x) 0 +#endif +#ifdef __has_extension +# define UPRV_HAS_EXTENSION(x) __has_extension(x) +#else +# define UPRV_HAS_EXTENSION(x) 0 +#endif +#ifdef __has_warning +# define UPRV_HAS_WARNING(x) __has_warning(x) +#else +# define UPRV_HAS_WARNING(x) 0 +#endif + +/** + * \def U_MALLOC_ATTR + * Attribute to mark functions as malloc-like + * @internal + */ +#if defined(__GNUC__) && __GNUC__>=3 +# define U_MALLOC_ATTR __attribute__ ((__malloc__)) +#else +# define U_MALLOC_ATTR +#endif + +/** + * \def U_ALLOC_SIZE_ATTR + * Attribute to specify the size of the allocated buffer for malloc-like functions + * @internal + */ +#if (defined(__GNUC__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \ + UPRV_HAS_ATTRIBUTE(alloc_size) +# define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X))) +# define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y))) +#else +# define U_ALLOC_SIZE_ATTR(X) +# define U_ALLOC_SIZE_ATTR2(X,Y) +#endif + +/** + * \def U_CPLUSPLUS_VERSION + * 0 if no C++; 1, 11, 14, ... if C++. + * Support for specific features cannot always be determined by the C++ version alone. + * @internal + */ +#ifdef U_CPLUSPLUS_VERSION +# if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus) +# undef U_CPLUSPLUS_VERSION +# define U_CPLUSPLUS_VERSION 0 +# endif + /* Otherwise use the predefined value. */ +#elif !defined(__cplusplus) +# define U_CPLUSPLUS_VERSION 0 +#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +# define U_CPLUSPLUS_VERSION 14 +#elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) +# define U_CPLUSPLUS_VERSION 11 +#else + // C++98 or C++03 +# define U_CPLUSPLUS_VERSION 1 +#endif + +#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) +// add in std::nullptr_t +namespace std { + typedef decltype(nullptr) nullptr_t; +}; +#endif + +/** + * \def U_NOEXCEPT + * "noexcept" if supported, otherwise empty. + * Some code, especially STL containers, uses move semantics of objects only + * if the move constructor and the move operator are declared as not throwing exceptions. + * @internal + */ +#ifdef U_NOEXCEPT + /* Use the predefined value. */ +#else +# define U_NOEXCEPT noexcept +#endif + +/** + * \def U_FALLTHROUGH + * Annotate intentional fall-through between switch labels. + * http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough + * @internal + */ +#ifndef __cplusplus + // Not for C. +#elif defined(U_FALLTHROUGH) + // Use the predefined value. +#elif defined(__clang__) + // Test for compiler vs. feature separately. + // Other compilers might choke on the feature test. +# if UPRV_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \ + (UPRV_HAS_FEATURE(cxx_attributes) && \ + UPRV_HAS_WARNING("-Wimplicit-fallthrough")) +# define U_FALLTHROUGH [[clang::fallthrough]] +# endif +#elif defined(__GNUC__) && (__GNUC__ >= 7) +# define U_FALLTHROUGH __attribute__((fallthrough)) +#endif + +#ifndef U_FALLTHROUGH +# define U_FALLTHROUGH +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Character data types */ +/*===========================================================================*/ + +/** + * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform. + * @stable ICU 2.0 + */ +#define U_ASCII_FAMILY 0 + +/** + * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform. + * @stable ICU 2.0 + */ +#define U_EBCDIC_FAMILY 1 + +/** + * \def U_CHARSET_FAMILY + * + *

These definitions allow to specify the encoding of text + * in the char data type as defined by the platform and the compiler. + * It is enough to determine the code point values of "invariant characters", + * which are the ones shared by all encodings that are in use + * on a given platform.

+ * + *

Those "invariant characters" should be all the uppercase and lowercase + * latin letters, the digits, the space, and "basic punctuation". + * Also, '\\n', '\\r', '\\t' should be available.

+ * + *

The list of "invariant characters" is:
+ * \code + * A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _ + * \endcode + *
+ * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)

+ * + *

This matches the IBM Syntactic Character Set (CS 640).

+ * + *

In other words, all the graphic characters in 7-bit ASCII should + * be safely accessible except the following:

+ * + * \code + * '\' + * '[' + * ']' + * '{' + * '}' + * '^' + * '~' + * '!' + * '#' + * '|' + * '$' + * '@' + * '`' + * \endcode + * @stable ICU 2.0 + */ +#ifdef U_CHARSET_FAMILY + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB) +# define U_CHARSET_FAMILY U_EBCDIC_FAMILY +#elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__) +# define U_CHARSET_FAMILY U_EBCDIC_FAMILY +#else +# define U_CHARSET_FAMILY U_ASCII_FAMILY +#endif + +/** + * \def U_CHARSET_IS_UTF8 + * + * Hardcode the default charset to UTF-8. + * + * If this is set to 1, then + * - ICU will assume that all non-invariant char*, StringPiece, std::string etc. + * contain UTF-8 text, regardless of what the system API uses + * - some ICU code will use fast functions like u_strFromUTF8() + * rather than the more general and more heavy-weight conversion API (ucnv.h) + * - ucnv_getDefaultName() always returns "UTF-8" + * - ucnv_setDefaultName() is disabled and will not change the default charset + * - static builds of ICU are smaller + * - more functionality is available with the UCONFIG_NO_CONVERSION build-time + * configuration option (see unicode/uconfig.h) + * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable + * + * @stable ICU 4.2 + * @see UCONFIG_NO_CONVERSION + */ +#ifdef U_CHARSET_IS_UTF8 + /* Use the predefined value. */ +#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED || \ + U_PLATFORM == U_PF_EMSCRIPTEN +# define U_CHARSET_IS_UTF8 1 +#else +# define U_CHARSET_IS_UTF8 0 +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Information about wchar support */ +/*===========================================================================*/ + +/** + * \def U_HAVE_WCHAR_H + * Indicates whether is available (1) or not (0). Set to 1 by default. + * + * @stable ICU 2.0 + */ +#ifdef U_HAVE_WCHAR_H + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9 + /* + * Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t. + * The type and header existed, but the library functions did not work as expected. + * The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway. + */ +# define U_HAVE_WCHAR_H 0 +#else +# define U_HAVE_WCHAR_H 1 +#endif + +/** + * \def U_SIZEOF_WCHAR_T + * U_SIZEOF_WCHAR_T==sizeof(wchar_t) + * + * @stable ICU 2.0 + */ +#ifdef U_SIZEOF_WCHAR_T + /* Use the predefined value. */ +#elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9) + /* + * Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring. + * Newer Mac OS X has size 4. + */ +# define U_SIZEOF_WCHAR_T 1 +#elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN +# define U_SIZEOF_WCHAR_T 2 +#elif U_PLATFORM == U_PF_AIX + /* + * AIX 6.1 information, section "Wide character data representation": + * "... the wchar_t datatype is 32-bit in the 64-bit environment and + * 16-bit in the 32-bit environment." + * and + * "All locales use Unicode for their wide character code values (process code), + * except the IBM-eucTW codeset." + */ +# ifdef __64BIT__ +# define U_SIZEOF_WCHAR_T 4 +# else +# define U_SIZEOF_WCHAR_T 2 +# endif +#elif U_PLATFORM == U_PF_OS390 + /* + * z/OS V1R11 information center, section "LP64 | ILP32": + * "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes. + * Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes." + */ +# ifdef _LP64 +# define U_SIZEOF_WCHAR_T 4 +# else +# define U_SIZEOF_WCHAR_T 2 +# endif +#elif U_PLATFORM == U_PF_OS400 +# if defined(__UTF32__) + /* + * LOCALETYPE(*LOCALEUTF) is specified. + * Wide-character strings are in UTF-32, + * narrow-character strings are in UTF-8. + */ +# define U_SIZEOF_WCHAR_T 4 +# elif defined(__UCS2__) + /* + * LOCALETYPE(*LOCALEUCS2) is specified. + * Wide-character strings are in UCS-2, + * narrow-character strings are in EBCDIC. + */ +# define U_SIZEOF_WCHAR_T 2 +# else + /* + * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified. + * Wide-character strings are in 16-bit EBCDIC, + * narrow-character strings are in EBCDIC. + */ +# define U_SIZEOF_WCHAR_T 2 +# endif +#else +# define U_SIZEOF_WCHAR_T 4 +#endif + +#ifndef U_HAVE_WCSCPY +#define U_HAVE_WCSCPY U_HAVE_WCHAR_H +#endif + +/** @} */ + +/** + * \def U_HAVE_CHAR16_T + * Defines whether the char16_t type is available for UTF-16 + * and u"abc" UTF-16 string literals are supported. + * This is a new standard type and standard string literal syntax in C++0x + * but has been available in some compilers before. + * @internal + */ +#ifdef U_HAVE_CHAR16_T + /* Use the predefined value. */ +#else + /* + * Notes: + * Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef + * and does not support u"abc" string literals. + * Visual Studio 2015 (_MSC_VER>=1900) and above adds support for + * both char16_t and u"abc" string literals. + * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but + * does not support u"abc" string literals. + * C++11 and C11 require support for UTF-16 literals + * TODO: Fix for plain C. Doesn't work on Mac. + */ +# if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) +# define U_HAVE_CHAR16_T 1 +# else +# define U_HAVE_CHAR16_T 0 +# endif +#endif + +/** + * @{ + * \def U_DECLARE_UTF16 + * Do not use this macro because it is not defined on all platforms. + * Use the UNICODE_STRING or U_STRING_DECL macros instead. + * @internal + */ +#ifdef U_DECLARE_UTF16 + /* Use the predefined value. */ +#elif U_HAVE_CHAR16_T \ + || (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ + || (defined(__HP_aCC) && __HP_aCC >= 035000) \ + || (defined(__HP_cc) && __HP_cc >= 111106) \ + || (defined(U_IN_DOXYGEN)) +# define U_DECLARE_UTF16(string) u ## string +#elif U_SIZEOF_WCHAR_T == 2 \ + && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__))) +# define U_DECLARE_UTF16(string) L ## string +#else + /* Leave U_DECLARE_UTF16 undefined. See unistr.h. */ +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Symbol import-export control */ +/*===========================================================================*/ + +#ifdef U_EXPORT + /* Use the predefined value. */ +#elif defined(U_STATIC_IMPLEMENTATION) +# define U_EXPORT +#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \ + UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) +# define U_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) +# define U_EXPORT __attribute__((visibility("default"))) +#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ + || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) +# define U_EXPORT __global +/*#elif defined(__HP_aCC) || defined(__HP_cc) +# define U_EXPORT __declspec(dllexport)*/ +#else +# define U_EXPORT +#endif + +/* U_CALLCONV is related to U_EXPORT2 */ +#ifdef U_EXPORT2 + /* Use the predefined value. */ +#elif defined(_MSC_VER) +# define U_EXPORT2 __cdecl +#else +# define U_EXPORT2 +#endif + +#ifdef U_IMPORT + /* Use the predefined value. */ +#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \ + UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) + /* Windows needs to export/import data. */ +# define U_IMPORT __declspec(dllimport) +#else +# define U_IMPORT +#endif + +/** + * \def U_CALLCONV + * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary + * in callback function typedefs to make sure that the calling convention + * is compatible. + * + * This is only used for non-ICU-API functions. + * When a function is a public ICU API, + * you must use the U_CAPI and U_EXPORT2 qualifiers. + * + * Please note, you need to use U_CALLCONV after the *. + * + * NO : "static const char U_CALLCONV *func( . . . )" + * YES: "static const char* U_CALLCONV func( . . . )" + * + * @stable ICU 2.0 + */ +#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) +# define U_CALLCONV __cdecl +#else +# define U_CALLCONV U_EXPORT2 +#endif + +/** + * \def U_CALLCONV_FPTR + * Similar to U_CALLCONV, but only used on function pointers. + * @internal + */ +#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) +# define U_CALLCONV_FPTR U_CALLCONV +#else +# define U_CALLCONV_FPTR +#endif +/** @} */ + +#endif // _PLATFORM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ptypes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ptypes.h new file mode 100644 index 0000000000000000000000000000000000000000..70324ffee3b9c4f1d2399e2c1dfb2c14df26e652 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ptypes.h @@ -0,0 +1,130 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : ptypes.h +* +* Date Name Description +* 05/13/98 nos Creation (content moved here from ptypes.h). +* 03/02/99 stephen Added AS400 support. +* 03/30/99 stephen Added Linux support. +* 04/13/99 stephen Reworked for autoconf. +* 09/18/08 srl Moved basic types back to ptypes.h from platform.h +****************************************************************************** +*/ + +/** + * \file + * \brief C API: Definitions of integer types of various widths + */ + +#ifndef _PTYPES_H +#define _PTYPES_H + +/** + * \def __STDC_LIMIT_MACROS + * According to the Linux stdint.h, the ISO C99 standard specifies that in C++ implementations + * macros like INT32_MIN and UINTPTR_MAX should only be defined if explicitly requested. + * We need to define __STDC_LIMIT_MACROS before including stdint.h in C++ code + * that uses such limit macros. + * @internal + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS +#endif + +/* NULL, size_t, wchar_t */ +#include + +/* + * If all compilers provided all of the C99 headers and types, + * we would just unconditionally #include here + * and not need any of the stuff after including platform.h. + */ + +/* Find out if we have stdint.h etc. */ +#include "unicode/platform.h" + +/*===========================================================================*/ +/* Generic data types */ +/*===========================================================================*/ + +/* If your platform does not have the header, you may + need to edit the typedefs in the #else section below. + Use #if...#else...#endif with predefined compiler macros if possible. */ +#if U_HAVE_STDINT_H + +/* + * We mostly need (which defines the standard integer types) but not . + * includes and adds the printf/scanf helpers PRId32, SCNx16 etc. + * which we almost never use, plus stuff like imaxabs() which we never use. + */ +#include + +#if U_PLATFORM == U_PF_OS390 +/* The features header is needed to get (u)int64_t sometimes. */ +#include +/* z/OS has , but some versions are missing uint8_t (APAR PK62248). */ +#if !defined(__uint8_t) +#define __uint8_t 1 +typedef unsigned char uint8_t; +#endif +#endif /* U_PLATFORM == U_PF_OS390 */ + +#elif U_HAVE_INTTYPES_H + +# include + +#else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */ + +/// \cond +#if ! U_HAVE_INT8_T +typedef signed char int8_t; +#endif + +#if ! U_HAVE_UINT8_T +typedef unsigned char uint8_t; +#endif + +#if ! U_HAVE_INT16_T +typedef signed short int16_t; +#endif + +#if ! U_HAVE_UINT16_T +typedef unsigned short uint16_t; +#endif + +#if ! U_HAVE_INT32_T +typedef signed int int32_t; +#endif + +#if ! U_HAVE_UINT32_T +typedef unsigned int uint32_t; +#endif + +#if ! U_HAVE_INT64_T +#ifdef _MSC_VER + typedef signed __int64 int64_t; +#else + typedef signed long long int64_t; +#endif +#endif + +#if ! U_HAVE_UINT64_T +#ifdef _MSC_VER + typedef unsigned __int64 uint64_t; +#else + typedef unsigned long long uint64_t; +#endif +#endif +/// \endcond + +#endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */ + +#endif /* _PTYPES_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/putil.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/putil.h new file mode 100644 index 0000000000000000000000000000000000000000..500c21252fc2d72976e4bbcd66f67dd6c936b7bc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/putil.h @@ -0,0 +1,183 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : putil.h +* +* Date Name Description +* 05/14/98 nos Creation (content moved here from utypes.h). +* 06/17/99 erm Added IEEE_754 +* 07/22/98 stephen Added IEEEremainder, max, min, trunc +* 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity +* 08/24/98 stephen Added longBitsFromDouble +* 03/02/99 stephen Removed openFile(). Added AS400 support. +* 04/15/99 stephen Converted to C +* 11/15/99 helena Integrated S/390 changes for IEEE support. +* 01/11/00 helena Added u_getVersion. +****************************************************************************** +*/ + +#ifndef PUTIL_H +#define PUTIL_H + +#include "unicode/utypes.h" + /** + * \file + * \brief C API: Platform Utilities + */ + +/*==========================================================================*/ +/* Platform utilities */ +/*==========================================================================*/ + +/** + * Platform utilities isolates the platform dependencies of the + * library. For each platform which this code is ported to, these + * functions may have to be re-implemented. + */ + +/** + * Return the ICU data directory. + * The data directory is where common format ICU data files (.dat files) + * are loaded from. Note that normal use of the built-in ICU + * facilities does not require loading of an external data file; + * unless you are adding custom data to ICU, the data directory + * does not need to be set. + * + * The data directory is determined as follows: + * If u_setDataDirectory() has been called, that is it, otherwise + * if the ICU_DATA environment variable is set, use that, otherwise + * If a data directory was specified at ICU build time + * + * \code + * #define ICU_DATA_DIR "path" + * \endcode + * use that, + * otherwise no data directory is available. + * + * @return the data directory, or an empty string ("") if no data directory has + * been specified. + * + * @stable ICU 2.0 + */ +U_CAPI const char* U_EXPORT2 u_getDataDirectory(void); + + +/** + * Set the ICU data directory. + * The data directory is where common format ICU data files (.dat files) + * are loaded from. Note that normal use of the built-in ICU + * facilities does not require loading of an external data file; + * unless you are adding custom data to ICU, the data directory + * does not need to be set. + * + * This function should be called at most once in a process, before the + * first ICU operation (e.g., u_init()) that will require the loading of an + * ICU data file. + * This function is not thread-safe. Use it before calling ICU APIs from + * multiple threads. + * + * @param directory The directory to be set. + * + * @see u_init + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 u_setDataDirectory(const char *directory); + +#ifndef U_HIDE_INTERNAL_API +/** + * Return the time zone files override directory, or an empty string if + * no directory was specified. Certain time zone resources will be preferentially + * loaded from individual files in this directory. + * + * @return the time zone data override directory. + * @internal + */ +U_CAPI const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status); + +/** + * Set the time zone files override directory. + * This function is not thread safe; it must not be called concurrently with + * u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions. + * This function should only be called before using any ICU service that + * will access the time zone data. + * @internal + */ +U_CAPI void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status); +#endif /* U_HIDE_INTERNAL_API */ + + +/** + * @{ + * Filesystem file and path separator characters. + * Example: '/' and ':' on Unix, '\\' and ';' on Windows. + * @stable ICU 2.0 + */ +#if U_PLATFORM_USES_ONLY_WIN32_API +# define U_FILE_SEP_CHAR '\\' +# define U_FILE_ALT_SEP_CHAR '/' +# define U_PATH_SEP_CHAR ';' +# define U_FILE_SEP_STRING "\\" +# define U_FILE_ALT_SEP_STRING "/" +# define U_PATH_SEP_STRING ";" +#else +# define U_FILE_SEP_CHAR '/' +# define U_FILE_ALT_SEP_CHAR '/' +# define U_PATH_SEP_CHAR ':' +# define U_FILE_SEP_STRING "/" +# define U_FILE_ALT_SEP_STRING "/" +# define U_PATH_SEP_STRING ":" +#endif + +/** @} */ + +/** + * Convert char characters to UChar characters. + * This utility function is useful only for "invariant characters" + * that are encoded in the platform default encoding. + * They are a small, constant subset of the encoding and include + * just the latin letters, digits, and some punctuation. + * For details, see U_CHARSET_FAMILY. + * + * @param cs Input string, points to length + * character bytes from a subset of the platform encoding. + * @param us Output string, points to memory for length + * Unicode characters. + * @param length The number of characters to convert; this may + * include the terminating NUL. + * + * @see U_CHARSET_FAMILY + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +u_charsToUChars(const char *cs, UChar *us, int32_t length); + +/** + * Convert UChar characters to char characters. + * This utility function is useful only for "invariant characters" + * that can be encoded in the platform default encoding. + * They are a small, constant subset of the encoding and include + * just the latin letters, digits, and some punctuation. + * For details, see U_CHARSET_FAMILY. + * + * @param us Input string, points to length + * Unicode characters that can be encoded with the + * codepage-invariant subset of the platform encoding. + * @param cs Output string, points to memory for length + * character bytes. + * @param length The number of characters to convert; this may + * include the terminating NUL. + * + * @see U_CHARSET_FAMILY + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +u_UCharsToChars(const UChar *us, char *cs, int32_t length); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/rbbi.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/rbbi.h new file mode 100644 index 0000000000000000000000000000000000000000..65117f616cdf5b83bf3b4b95f6aa078d677982a2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/rbbi.h @@ -0,0 +1,732 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +*************************************************************************** +* Copyright (C) 1999-2016 International Business Machines Corporation * +* and others. All rights reserved. * +*************************************************************************** + +********************************************************************** +* Date Name Description +* 10/22/99 alan Creation. +* 11/11/99 rgillam Complete port from Java. +********************************************************************** +*/ + +#ifndef RBBI_H +#define RBBI_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief C++ API: Rule Based Break Iterator + */ + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/brkiter.h" +#include "unicode/udata.h" +#include "unicode/parseerr.h" +#include "unicode/schriter.h" + +struct UCPTrie; + +U_NAMESPACE_BEGIN + +/** @internal */ +class LanguageBreakEngine; +struct RBBIDataHeader; +class RBBIDataWrapper; +class UnhandledEngine; +class UStack; + +/** + * + * A subclass of BreakIterator whose behavior is specified using a list of rules. + *

Instances of this class are most commonly created by the factory methods of + * BreakIterator::createWordInstance(), BreakIterator::createLineInstance(), etc., + * and then used via the abstract API in class BreakIterator

+ * + *

See the ICU User Guide for information on Break Iterator Rules.

+ * + *

This class is not intended to be subclassed.

+ */ +class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator { + +private: + /** + * The UText through which this BreakIterator accesses the text + * @internal (private) + */ + UText fText; + +#ifndef U_HIDE_INTERNAL_API +public: +#endif /* U_HIDE_INTERNAL_API */ + /** + * The rule data for this BreakIterator instance. + * Not for general use; Public only for testing purposes. + * @internal + */ + RBBIDataWrapper *fData; +private: + + /** + * The current position of the iterator. Pinned, 0 < fPosition <= text.length. + * Never has the value UBRK_DONE (-1). + */ + int32_t fPosition; + + /** + * TODO: + */ + int32_t fRuleStatusIndex; + + /** + * Cache of previously determined boundary positions. + */ + class BreakCache; + BreakCache *fBreakCache; + + /** + * Cache of boundary positions within a region of text that has been + * sub-divided by dictionary based breaking. + */ + class DictionaryCache; + DictionaryCache *fDictionaryCache; + + /** + * + * If present, UStack of LanguageBreakEngine objects that might handle + * dictionary characters. Searched from top to bottom to find an object to + * handle a given character. + * @internal (private) + */ + UStack *fLanguageBreakEngines; + + /** + * + * If present, the special LanguageBreakEngine used for handling + * characters that are in the dictionary set, but not handled by any + * LanguageBreakEngine. + * @internal (private) + */ + UnhandledEngine *fUnhandledBreakEngine; + + /** + * Counter for the number of characters encountered with the "dictionary" + * flag set. + * @internal (private) + */ + uint32_t fDictionaryCharCount; + + /** + * A character iterator that refers to the same text as the UText, above. + * Only included for compatibility with old API, which was based on CharacterIterators. + * Value may be adopted from outside, or one of fSCharIter or fDCharIter, below. + */ + CharacterIterator *fCharIter; + + /** + * When the input text is provided by a UnicodeString, this will point to + * a characterIterator that wraps that data. Needed only for the + * implementation of getText(), a backwards compatibility issue. + */ + StringCharacterIterator fSCharIter; + + /** + * True when iteration has run off the end, and iterator functions should return UBRK_DONE. + */ + UBool fDone; + + /** + * Array of look-ahead tentative results. + */ + int32_t *fLookAheadMatches; + + //======================================================================= + // constructors + //======================================================================= + + /** + * Constructor from a flattened set of RBBI data in malloced memory. + * RulesBasedBreakIterators built from a custom set of rules + * are created via this constructor; the rules are compiled + * into memory, then the break iterator is constructed here. + * + * The break iterator adopts the memory, and will + * free it when done. + * @internal (private) + */ + RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status); + + /** @internal */ + friend class RBBIRuleBuilder; + /** @internal */ + friend class BreakIterator; + +public: + + /** Default constructor. Creates an empty shell of an iterator, with no + * rules or text to iterate over. Object can subsequently be assigned to. + * @stable ICU 2.2 + */ + RuleBasedBreakIterator(); + + /** + * Copy constructor. Will produce a break iterator with the same behavior, + * and which iterates over the same text, as the one passed in. + * @param that The RuleBasedBreakIterator passed to be copied + * @stable ICU 2.0 + */ + RuleBasedBreakIterator(const RuleBasedBreakIterator& that); + + /** + * Construct a RuleBasedBreakIterator from a set of rules supplied as a string. + * @param rules The break rules to be used. + * @param parseError In the event of a syntax error in the rules, provides the location + * within the rules of the problem. + * @param status Information on any errors encountered. + * @stable ICU 2.2 + */ + RuleBasedBreakIterator( const UnicodeString &rules, + UParseError &parseError, + UErrorCode &status); + + /** + * Construct a RuleBasedBreakIterator from a set of precompiled binary rules. + * Binary rules are obtained from RulesBasedBreakIterator::getBinaryRules(). + * Construction of a break iterator in this way is substantially faster than + * construction from source rules. + * + * Ownership of the storage containing the compiled rules remains with the + * caller of this function. The compiled rules must not be modified or + * deleted during the life of the break iterator. + * + * The compiled rules are not compatible across different major versions of ICU. + * The compiled rules are compatible only between machines with the same + * byte ordering (little or big endian) and the same base character set family + * (ASCII or EBCDIC). + * + * @see #getBinaryRules + * @param compiledRules A pointer to the compiled break rules to be used. + * @param ruleLength The length of the compiled break rules, in bytes. This + * corresponds to the length value produced by getBinaryRules(). + * @param status Information on any errors encountered, including invalid + * binary rules. + * @stable ICU 4.8 + */ + RuleBasedBreakIterator(const uint8_t *compiledRules, + uint32_t ruleLength, + UErrorCode &status); + + /** + * This constructor uses the udata interface to create a BreakIterator + * whose internal tables live in a memory-mapped file. "image" is an + * ICU UDataMemory handle for the pre-compiled break iterator tables. + * @param image handle to the memory image for the break iterator data. + * Ownership of the UDataMemory handle passes to the Break Iterator, + * which will be responsible for closing it when it is no longer needed. + * @param status Information on any errors encountered. + * @see udata_open + * @see #getBinaryRules + * @stable ICU 2.8 + */ + RuleBasedBreakIterator(UDataMemory* image, UErrorCode &status); + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~RuleBasedBreakIterator(); + + /** + * Assignment operator. Sets this iterator to have the same behavior, + * and iterate over the same text, as the one passed in. + * @param that The RuleBasedBreakItertor passed in + * @return the newly created RuleBasedBreakIterator + * @stable ICU 2.0 + */ + RuleBasedBreakIterator& operator=(const RuleBasedBreakIterator& that); + + /** + * Equality operator. Returns true if both BreakIterators are of the + * same class, have the same behavior, and iterate over the same text. + * @param that The BreakIterator to be compared for equality + * @return true if both BreakIterators are of the + * same class, have the same behavior, and iterate over the same text. + * @stable ICU 2.0 + */ + virtual UBool operator==(const BreakIterator& that) const; + + /** + * Not-equal operator. If operator== returns true, this returns false, + * and vice versa. + * @param that The BreakIterator to be compared for inequality + * @return true if both BreakIterators are not same. + * @stable ICU 2.0 + */ + inline UBool operator!=(const BreakIterator& that) const; + + /** + * Returns a newly-constructed RuleBasedBreakIterator with the same + * behavior, and iterating over the same text, as this one. + * Differs from the copy constructor in that it is polymorphic, and + * will correctly clone (copy) a derived class. + * clone() is thread safe. Multiple threads may simultaneously + * clone the same source break iterator. + * @return a newly-constructed RuleBasedBreakIterator + * @stable ICU 2.0 + */ + virtual RuleBasedBreakIterator* clone() const; + + /** + * Compute a hash code for this BreakIterator + * @return A hash code + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const; + + /** + * Returns the description used to create this iterator + * @return the description used to create this iterator + * @stable ICU 2.0 + */ + virtual const UnicodeString& getRules(void) const; + + //======================================================================= + // BreakIterator overrides + //======================================================================= + + /** + *

+ * Return a CharacterIterator over the text being analyzed. + * The returned character iterator is owned by the break iterator, and must + * not be deleted by the caller. Repeated calls to this function may + * return the same CharacterIterator. + *

+ *

+ * The returned character iterator must not be used concurrently with + * the break iterator. If concurrent operation is needed, clone the + * returned character iterator first and operate on the clone. + *

+ *

+ * When the break iterator is operating on text supplied via a UText, + * this function will fail. Lacking any way to signal failures, it + * returns an CharacterIterator containing no text. + * The function getUText() provides similar functionality, + * is reliable, and is more efficient. + *

+ * + * TODO: deprecate this function? + * + * @return An iterator over the text being analyzed. + * @stable ICU 2.0 + */ + virtual CharacterIterator& getText(void) const; + + + /** + * Get a UText for the text being analyzed. + * The returned UText is a shallow clone of the UText used internally + * by the break iterator implementation. It can safely be used to + * access the text without impacting any break iterator operations, + * but the underlying text itself must not be altered. + * + * @param fillIn A UText to be filled in. If NULL, a new UText will be + * allocated to hold the result. + * @param status receives any error codes. + * @return The current UText for this break iterator. If an input + * UText was provided, it will always be returned. + * @stable ICU 3.4 + */ + virtual UText *getUText(UText *fillIn, UErrorCode &status) const; + + /** + * Set the iterator to analyze a new piece of text. This function resets + * the current iteration position to the beginning of the text. + * @param newText An iterator over the text to analyze. The BreakIterator + * takes ownership of the character iterator. The caller MUST NOT delete it! + * @stable ICU 2.0 + */ + virtual void adoptText(CharacterIterator* newText); + + /** + * Set the iterator to analyze a new piece of text. This function resets + * the current iteration position to the beginning of the text. + * + * The BreakIterator will retain a reference to the supplied string. + * The caller must not modify or delete the text while the BreakIterator + * retains the reference. + * + * @param newText The text to analyze. + * @stable ICU 2.0 + */ + virtual void setText(const UnicodeString& newText); + + /** + * Reset the break iterator to operate over the text represented by + * the UText. The iterator position is reset to the start. + * + * This function makes a shallow clone of the supplied UText. This means + * that the caller is free to immediately close or otherwise reuse the + * Utext that was passed as a parameter, but that the underlying text itself + * must not be altered while being referenced by the break iterator. + * + * @param text The UText used to change the text. + * @param status Receives any error codes. + * @stable ICU 3.4 + */ + virtual void setText(UText *text, UErrorCode &status); + + /** + * Sets the current iteration position to the beginning of the text, position zero. + * @return The offset of the beginning of the text, zero. + * @stable ICU 2.0 + */ + virtual int32_t first(void); + + /** + * Sets the current iteration position to the end of the text. + * @return The text's past-the-end offset. + * @stable ICU 2.0 + */ + virtual int32_t last(void); + + /** + * Advances the iterator either forward or backward the specified number of steps. + * Negative values move backward, and positive values move forward. This is + * equivalent to repeatedly calling next() or previous(). + * @param n The number of steps to move. The sign indicates the direction + * (negative is backwards, and positive is forwards). + * @return The character offset of the boundary position n boundaries away from + * the current one. + * @stable ICU 2.0 + */ + virtual int32_t next(int32_t n); + + /** + * Advances the iterator to the next boundary position. + * @return The position of the first boundary after this one. + * @stable ICU 2.0 + */ + virtual int32_t next(void); + + /** + * Moves the iterator backwards, to the last boundary preceding this one. + * @return The position of the last boundary position preceding this one. + * @stable ICU 2.0 + */ + virtual int32_t previous(void); + + /** + * Sets the iterator to refer to the first boundary position following + * the specified position. + * @param offset The position from which to begin searching for a break position. + * @return The position of the first break after the current position. + * @stable ICU 2.0 + */ + virtual int32_t following(int32_t offset); + + /** + * Sets the iterator to refer to the last boundary position before the + * specified position. + * @param offset The position to begin searching for a break from. + * @return The position of the last boundary before the starting position. + * @stable ICU 2.0 + */ + virtual int32_t preceding(int32_t offset); + + /** + * Returns true if the specified position is a boundary position. As a side + * effect, leaves the iterator pointing to the first boundary position at + * or after "offset". + * @param offset the offset to check. + * @return True if "offset" is a boundary position. + * @stable ICU 2.0 + */ + virtual UBool isBoundary(int32_t offset); + + /** + * Returns the current iteration position. Note that UBRK_DONE is never + * returned from this function; if iteration has run to the end of a + * string, current() will return the length of the string while + * next() will return UBRK_DONE). + * @return The current iteration position. + * @stable ICU 2.0 + */ + virtual int32_t current(void) const; + + + /** + * Return the status tag from the break rule that determined the boundary at + * the current iteration position. For break rules that do not specify a + * status, a default value of 0 is returned. If more than one break rule + * would cause a boundary to be located at some position in the text, + * the numerically largest of the applicable status values is returned. + *

+ * Of the standard types of ICU break iterators, only word break and + * line break provide status values. The values are defined in + * the header file ubrk.h. For Word breaks, the status allows distinguishing between words + * that contain alphabetic letters, "words" that appear to be numbers, + * punctuation and spaces, words containing ideographic characters, and + * more. For Line Break, the status distinguishes between hard (mandatory) breaks + * and soft (potential) break positions. + *

+ * getRuleStatus() can be called after obtaining a boundary + * position from next(), previous(), or + * any other break iterator functions that returns a boundary position. + *

+ * Note that getRuleStatus() returns the value corresponding to + * current() index even after next() has returned DONE. + *

+ * When creating custom break rules, one is free to define whatever + * status values may be convenient for the application. + *

+ * @return the status from the break rule that determined the boundary + * at the current iteration position. + * + * @see UWordBreak + * @stable ICU 2.2 + */ + virtual int32_t getRuleStatus() const; + + /** + * Get the status (tag) values from the break rule(s) that determined the boundary + * at the current iteration position. + *

+ * The returned status value(s) are stored into an array provided by the caller. + * The values are stored in sorted (ascending) order. + * If the capacity of the output array is insufficient to hold the data, + * the output will be truncated to the available length, and a + * U_BUFFER_OVERFLOW_ERROR will be signaled. + * + * @param fillInVec an array to be filled in with the status values. + * @param capacity the length of the supplied vector. A length of zero causes + * the function to return the number of status values, in the + * normal way, without attempting to store any values. + * @param status receives error codes. + * @return The number of rule status values from the rules that determined + * the boundary at the current iteration position. + * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value + * is the total number of status values that were available, + * not the reduced number that were actually returned. + * @see getRuleStatus + * @stable ICU 3.0 + */ + virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. + * This method is to implement a simple version of RTTI, since not all + * C++ compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Returns the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + +#ifndef U_FORCE_HIDE_DEPRECATED_API + /** + * Deprecated functionality. Use clone() instead. + * + * Create a clone (copy) of this break iterator in memory provided + * by the caller. The idea is to increase performance by avoiding + * a storage allocation. Use of this function is NOT RECOMMENDED. + * Performance gains are minimal, and correct buffer management is + * tricky. Use clone() instead. + * + * @param stackBuffer The pointer to the memory into which the cloned object + * should be placed. If NULL, allocate heap memory + * for the cloned object. + * @param BufferSize The size of the buffer. If zero, return the required + * buffer size, but do not clone the object. If the + * size was too small (but not zero), allocate heap + * storage for the cloned object. + * + * @param status Error status. U_SAFECLONE_ALLOCATED_WARNING will be + * returned if the provided buffer was too small, and + * the clone was therefore put on the heap. + * + * @return Pointer to the clone object. This may differ from the stackBuffer + * address if the byte alignment of the stack buffer was not suitable + * or if the stackBuffer was too small to hold the clone. + * @deprecated ICU 52. Use clone() instead. + */ + virtual RuleBasedBreakIterator *createBufferClone(void *stackBuffer, + int32_t &BufferSize, + UErrorCode &status); +#endif // U_FORCE_HIDE_DEPRECATED_API + + /** + * Return the binary form of compiled break rules, + * which can then be used to create a new break iterator at some + * time in the future. Creating a break iterator from pre-compiled rules + * is much faster than building one from the source form of the + * break rules. + * + * The binary data can only be used with the same version of ICU + * and on the same platform type (processor endian-ness) + * + * @param length Returns the length of the binary data. (Out parameter.) + * + * @return A pointer to the binary (compiled) rule data. The storage + * belongs to the RulesBasedBreakIterator object, not the + * caller, and must not be modified or deleted. + * @stable ICU 4.8 + */ + virtual const uint8_t *getBinaryRules(uint32_t &length); + + /** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the matching state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator implementation never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized, + * system-level code. One example use case is with garbage collection that moves + * the text in memory. + * + * @param input The new (moved) text string. + * @param status Receives errors detected by this function. + * @return *this + * + * @stable ICU 49 + */ + virtual RuleBasedBreakIterator &refreshInputText(UText *input, UErrorCode &status); + + +private: + //======================================================================= + // implementation + //======================================================================= + /** + * Dumps caches and performs other actions associated with a complete change + * in text or iteration position. + * @internal (private) + */ + void reset(void); + + /** + * Common initialization function, used by constructors and bufferClone. + * @internal (private) + */ + void init(UErrorCode &status); + + /** + * Iterate backwards from an arbitrary position in the input text using the + * synthesized Safe Reverse rules. + * This locates a "Safe Position" from which the forward break rules + * will operate correctly. A Safe Position is not necessarily a boundary itself. + * + * @param fromPosition the position in the input text to begin the iteration. + * @internal (private) + */ + int32_t handleSafePrevious(int32_t fromPosition); + + /** + * Find a rule-based boundary by running the state machine. + * Input + * fPosition, the position in the text to begin from. + * Output + * fPosition: the boundary following the starting position. + * fDictionaryCharCount the number of dictionary characters encountered. + * If > 0, the segment will be further subdivided + * fRuleStatusIndex Info from the state table indicating which rules caused the boundary. + * + * @internal (private) + */ + int32_t handleNext(); + + /* + * Templatized version of handleNext() and handleSafePrevious(). + * + * There will be exactly four instantiations, two each for 8 and 16 bit tables, + * two each for 8 and 16 bit trie. + * Having separate instantiations for the table types keeps conditional tests of + * the table type out of the inner loops, at the expense of replicated code. + * + * The template parameter for the Trie access function is a value, not a type. + * Doing it this way, the compiler will inline the Trie function in the + * expanded functions. (Both the 8 and 16 bit access functions have the same type + * signature) + */ + + typedef uint16_t (*PTrieFunc)(const UCPTrie *, UChar32); + + template + int32_t handleSafePrevious(int32_t fromPosition); + + template + int32_t handleNext(); + + + /** + * This function returns the appropriate LanguageBreakEngine for a + * given character c. + * @param c A character in the dictionary set + * @internal (private) + */ + const LanguageBreakEngine *getLanguageBreakEngine(UChar32 c); + + public: +#ifndef U_HIDE_INTERNAL_API + /** + * Debugging function only. + * @internal + */ + void dumpCache(); + + /** + * Debugging function only. + * @internal + */ + void dumpTables(); +#endif /* U_HIDE_INTERNAL_API */ +}; + +//------------------------------------------------------------------------------ +// +// Inline Functions Definitions ... +// +//------------------------------------------------------------------------------ + +inline UBool RuleBasedBreakIterator::operator!=(const BreakIterator& that) const { + return !operator==(that); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/rep.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/rep.h new file mode 100644 index 0000000000000000000000000000000000000000..6dd4530647e628868c79e000a3cf3fcab4940f4f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/rep.h @@ -0,0 +1,266 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +************************************************************************** +* Copyright (C) 1999-2012, International Business Machines Corporation and +* others. All Rights Reserved. +************************************************************************** +* Date Name Description +* 11/17/99 aliu Creation. Ported from java. Modified to +* match current UnicodeString API. Forced +* to use name "handleReplaceBetween" because +* of existing methods in UnicodeString. +************************************************************************** +*/ + +#ifndef REP_H +#define REP_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Replaceable String + */ + +U_NAMESPACE_BEGIN + +class UnicodeString; + +/** + * Replaceable is an abstract base class representing a + * string of characters that supports the replacement of a range of + * itself with a new string of characters. It is used by APIs that + * change a piece of text while retaining metadata. Metadata is data + * other than the Unicode characters returned by char32At(). One + * example of metadata is style attributes; another is an edit + * history, marking each character with an author and revision number. + * + *

An implicit aspect of the Replaceable API is that + * during a replace operation, new characters take on the metadata of + * the old characters. For example, if the string "the bold + * font" has range (4, 8) replaced with "strong", then it becomes "the + * strong font". + * + *

Replaceable specifies ranges using a start + * offset and a limit offset. The range of characters thus specified + * includes the characters at offset start..limit-1. That is, the + * start offset is inclusive, and the limit offset is exclusive. + * + *

Replaceable also includes API to access characters + * in the string: length(), charAt(), + * char32At(), and extractBetween(). + * + *

For a subclass to support metadata, typical behavior of + * replace() is the following: + *

    + *
  • Set the metadata of the new text to the metadata of the first + * character replaced
  • + *
  • If no characters are replaced, use the metadata of the + * previous character
  • + *
  • If there is no previous character (i.e. start == 0), use the + * following character
  • + *
  • If there is no following character (i.e. the replaceable was + * empty), use default metadata.
    + *
  • If the code point U+FFFF is seen, it should be interpreted as + * a special marker having no metadata
  • + *
  • + *
+ * If this is not the behavior, the subclass should document any differences. + * @author Alan Liu + * @stable ICU 2.0 + */ +class U_COMMON_API Replaceable : public UObject { + +public: + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~Replaceable(); + + /** + * Returns the number of 16-bit code units in the text. + * @return number of 16-bit code units in text + * @stable ICU 1.8 + */ + inline int32_t length() const; + + /** + * Returns the 16-bit code unit at the given offset into the text. + * @param offset an integer between 0 and length()-1 + * inclusive + * @return 16-bit code unit of text at given offset + * @stable ICU 1.8 + */ + inline char16_t charAt(int32_t offset) const; + + /** + * Returns the 32-bit code point at the given 16-bit offset into + * the text. This assumes the text is stored as 16-bit code units + * with surrogate pairs intermixed. If the offset of a leading or + * trailing code unit of a surrogate pair is given, return the + * code point of the surrogate pair. + * + * @param offset an integer between 0 and length()-1 + * inclusive + * @return 32-bit code point of text at given offset + * @stable ICU 1.8 + */ + inline UChar32 char32At(int32_t offset) const; + + /** + * Copies characters in the range [start, limit) + * into the UnicodeString target. + * @param start offset of first character which will be copied + * @param limit offset immediately following the last character to + * be copied + * @param target UnicodeString into which to copy characters. + * @return A reference to target + * @stable ICU 2.1 + */ + virtual void extractBetween(int32_t start, + int32_t limit, + UnicodeString& target) const = 0; + + /** + * Replaces a substring of this object with the given text. If the + * characters being replaced have metadata, the new characters + * that replace them should be given the same metadata. + * + *

Subclasses must ensure that if the text between start and + * limit is equal to the replacement text, that replace has no + * effect. That is, any metadata + * should be unaffected. In addition, subclasses are encouraged to + * check for initial and trailing identical characters, and make a + * smaller replacement if possible. This will preserve as much + * metadata as possible. + * @param start the beginning index, inclusive; 0 <= start + * <= limit. + * @param limit the ending index, exclusive; start <= limit + * <= length(). + * @param text the text to replace characters start + * to limit - 1 + * @stable ICU 2.0 + */ + virtual void handleReplaceBetween(int32_t start, + int32_t limit, + const UnicodeString& text) = 0; + // Note: All other methods in this class take the names of + // existing UnicodeString methods. This method is the exception. + // It is named differently because all replace methods of + // UnicodeString return a UnicodeString&. The 'between' is + // required in order to conform to the UnicodeString naming + // convention; API taking start/length are named , and + // those taking start/limit are named . The + // 'handle' is added because 'replaceBetween' and + // 'doReplaceBetween' are already taken. + + /** + * Copies a substring of this object, retaining metadata. + * This method is used to duplicate or reorder substrings. + * The destination index must not overlap the source range. + * + * @param start the beginning index, inclusive; 0 <= start <= + * limit. + * @param limit the ending index, exclusive; start <= limit <= + * length(). + * @param dest the destination index. The characters from + * start..limit-1 will be copied to dest. + * Implementations of this method may assume that dest <= start || + * dest >= limit. + * @stable ICU 2.0 + */ + virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0; + + /** + * Returns true if this object contains metadata. If a + * Replaceable object has metadata, calls to the Replaceable API + * must be made so as to preserve metadata. If it does not, calls + * to the Replaceable API may be optimized to improve performance. + * The default implementation returns true. + * @return true if this object contains metadata + * @stable ICU 2.2 + */ + virtual UBool hasMetaData() const; + + /** + * Clone this object, an instance of a subclass of Replaceable. + * Clones can be used concurrently in multiple threads. + * If a subclass does not implement clone(), or if an error occurs, + * then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.6 + */ + virtual Replaceable *clone() const; + +protected: + + /** + * Default constructor. + * @stable ICU 2.4 + */ + inline Replaceable(); + + /* + * Assignment operator not declared. The compiler will provide one + * which does nothing since this class does not contain any data members. + * API/code coverage may show the assignment operator as present and + * untested - ignore. + * Subclasses need this assignment operator if they use compiler-provided + * assignment operators of their own. An alternative to not declaring one + * here would be to declare and empty-implement a protected or public one. + Replaceable &Replaceable::operator=(const Replaceable &); + */ + + /** + * Virtual version of length(). + * @stable ICU 2.4 + */ + virtual int32_t getLength() const = 0; + + /** + * Virtual version of charAt(). + * @stable ICU 2.4 + */ + virtual char16_t getCharAt(int32_t offset) const = 0; + + /** + * Virtual version of char32At(). + * @stable ICU 2.4 + */ + virtual UChar32 getChar32At(int32_t offset) const = 0; +}; + +inline Replaceable::Replaceable() {} + +inline int32_t +Replaceable::length() const { + return getLength(); +} + +inline char16_t +Replaceable::charAt(int32_t offset) const { + return getCharAt(offset); +} + +inline UChar32 +Replaceable::char32At(int32_t offset) const { + return getChar32At(offset); +} + +// There is no rep.cpp, see unistr.cpp for Replaceable function implementations. + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/resbund.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/resbund.h new file mode 100644 index 0000000000000000000000000000000000000000..37738e277b567c60b1304264299e479e63bc1501 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/resbund.h @@ -0,0 +1,498 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1996-2013, International Business Machines Corporation +* and others. All Rights Reserved. +* +****************************************************************************** +* +* File resbund.h +* +* CREATED BY +* Richard Gillam +* +* Modification History: +* +* Date Name Description +* 2/5/97 aliu Added scanForLocaleInFile. Added +* constructor which attempts to read resource bundle +* from a specific file, without searching other files. +* 2/11/97 aliu Added UErrorCode return values to constructors. Fixed +* infinite loops in scanForFile and scanForLocale. +* Modified getRawResourceData to not delete storage +* in localeData and resourceData which it doesn't own. +* Added Mac compatibility #ifdefs for tellp() and +* ios::nocreate. +* 2/18/97 helena Updated with 100% documentation coverage. +* 3/13/97 aliu Rewrote to load in entire resource bundle and store +* it as a Hashtable of ResourceBundleData objects. +* Added state table to govern parsing of files. +* Modified to load locale index out of new file +* distinct from default.txt. +* 3/25/97 aliu Modified to support 2-d arrays, needed for timezone +* data. Added support for custom file suffixes. Again, +* needed to support timezone data. +* 4/7/97 aliu Cleaned up. +* 03/02/99 stephen Removed dependency on FILE*. +* 03/29/99 helena Merged Bertrand and Stephen's changes. +* 06/11/99 stephen Removed parsing of .txt files. +* Reworked to use new binary format. +* Cleaned up. +* 06/14/99 stephen Removed methods taking a filename suffix. +* 11/09/99 weiv Added getLocale(), fRealLocale, removed fRealLocaleID +****************************************************************************** +*/ + +#ifndef RESBUND_H +#define RESBUND_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" +#include "unicode/ures.h" +#include "unicode/unistr.h" +#include "unicode/locid.h" + +/** + * \file + * \brief C++ API: Resource Bundle + */ + +U_NAMESPACE_BEGIN + +/** + * A class representing a collection of resource information pertaining to a given + * locale. A resource bundle provides a way of accessing locale- specfic information in + * a data file. You create a resource bundle that manages the resources for a given + * locale and then ask it for individual resources. + *

+ * Resource bundles in ICU4C are currently defined using text files which conform to the following + * BNF definition. + * More on resource bundle concepts and syntax can be found in the + * Users Guide. + *

+ * + * The ResourceBundle class is not suitable for subclassing. + * + * @stable ICU 2.0 + */ +class U_COMMON_API ResourceBundle : public UObject { +public: + /** + * Constructor + * + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. + * @param locale This is the locale this resource bundle is for. To get resources + * for the French locale, for example, you would create a + * ResourceBundle passing Locale::FRENCH for the "locale" parameter, + * and all subsequent calls to that resource bundle will return + * resources that pertain to the French locale. If the caller doesn't + * pass a locale parameter, the default locale for the system (as + * returned by Locale::getDefault()) will be used. + * @param err The Error Code. + * The UErrorCode& err parameter is used to return status information to the user. To + * check whether the construction succeeded or not, you should check the value of + * U_SUCCESS(err). If you wish more detailed information, you can check for + * informational error results which still indicate success. U_USING_FALLBACK_WARNING + * indicates that a fall back locale was used. For example, 'de_CH' was requested, + * but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that + * the default locale data was used; neither the requested locale nor any of its + * fall back locales could be found. + * @stable ICU 2.0 + */ + ResourceBundle(const UnicodeString& packageName, + const Locale& locale, + UErrorCode& err); + + /** + * Construct a resource bundle for the default bundle in the specified package. + * + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. + * @param err A UErrorCode value + * @stable ICU 2.0 + */ + ResourceBundle(const UnicodeString& packageName, + UErrorCode& err); + + /** + * Construct a resource bundle for the ICU default bundle. + * + * @param err A UErrorCode value + * @stable ICU 2.0 + */ + ResourceBundle(UErrorCode &err); + + /** + * Standard constructor, constructs a resource bundle for the locale-specific + * bundle in the specified package. + * + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. + * NULL is used to refer to ICU data. + * @param locale The locale for which to open a resource bundle. + * @param err A UErrorCode value + * @stable ICU 2.0 + */ + ResourceBundle(const char* packageName, + const Locale& locale, + UErrorCode& err); + + /** + * Copy constructor. + * + * @param original The resource bundle to copy. + * @stable ICU 2.0 + */ + ResourceBundle(const ResourceBundle &original); + + /** + * Constructor from a C UResourceBundle. The resource bundle is + * copied and not adopted. ures_close will still need to be used on the + * original resource bundle. + * + * @param res A pointer to the C resource bundle. + * @param status A UErrorCode value. + * @stable ICU 2.0 + */ + ResourceBundle(UResourceBundle *res, + UErrorCode &status); + + /** + * Assignment operator. + * + * @param other The resource bundle to copy. + * @stable ICU 2.0 + */ + ResourceBundle& + operator=(const ResourceBundle& other); + + /** Destructor. + * @stable ICU 2.0 + */ + virtual ~ResourceBundle(); + + /** + * Clone this object. + * Clones can be used concurrently in multiple threads. + * If an error occurs, then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + ResourceBundle *clone() const; + + /** + * Returns the size of a resource. Size for scalar types is always 1, and for vector/table types is + * the number of child resources. + * @warning Integer array is treated as a scalar type. There are no + * APIs to access individual members of an integer array. It + * is always returned as a whole. + * + * @return number of resources in a given resource. + * @stable ICU 2.0 + */ + int32_t + getSize(void) const; + + /** + * returns a string from a string resource type + * + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a zero-terminated char16_t array which lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ + UnicodeString + getString(UErrorCode& status) const; + + /** + * returns a binary data from a resource. Can be used at most primitive resource types (binaries, + * strings, ints) + * + * @param len fills in the length of resulting byte chunk + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file. + * @stable ICU 2.0 + */ + const uint8_t* + getBinary(int32_t& len, UErrorCode& status) const; + + + /** + * returns an integer vector from a resource. + * + * @param len fills in the length of resulting integer vector + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a vector of integers that lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ + const int32_t* + getIntVector(int32_t& len, UErrorCode& status) const; + + /** + * returns an unsigned integer from a resource. + * This integer is originally 28 bits. + * + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return an unsigned integer value + * @stable ICU 2.0 + */ + uint32_t + getUInt(UErrorCode& status) const; + + /** + * returns a signed integer from a resource. + * This integer is originally 28 bit and the sign gets propagated. + * + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a signed integer value + * @stable ICU 2.0 + */ + int32_t + getInt(UErrorCode& status) const; + + /** + * Checks whether the resource has another element to iterate over. + * + * @return true if there are more elements, false if there is no more elements + * @stable ICU 2.0 + */ + UBool + hasNext(void) const; + + /** + * Resets the internal context of a resource so that iteration starts from the first element. + * + * @stable ICU 2.0 + */ + void + resetIterator(void); + + /** + * Returns the key associated with this resource. Not all the resources have a key - only + * those that are members of a table. + * + * @return a key associated to this resource, or NULL if it doesn't have a key + * @stable ICU 2.0 + */ + const char* + getKey(void) const; + + /** + * Gets the locale ID of the resource bundle as a string. + * Same as getLocale().getName() . + * + * @return the locale ID of the resource bundle as a string + * @stable ICU 2.0 + */ + const char* + getName(void) const; + + + /** + * Returns the type of a resource. Available types are defined in enum UResType + * + * @return type of the given resource. + * @stable ICU 2.0 + */ + UResType + getType(void) const; + + /** + * Returns the next resource in a given resource or NULL if there are no more resources + * + * @param status fills in the outgoing error code + * @return ResourceBundle object. + * @stable ICU 2.0 + */ + ResourceBundle + getNext(UErrorCode& status); + + /** + * Returns the next string in a resource or NULL if there are no more resources + * to iterate over. + * + * @param status fills in the outgoing error code + * @return an UnicodeString object. + * @stable ICU 2.0 + */ + UnicodeString + getNextString(UErrorCode& status); + + /** + * Returns the next string in a resource or NULL if there are no more resources + * to iterate over. + * + * @param key fill in for key associated with this string + * @param status fills in the outgoing error code + * @return an UnicodeString object. + * @stable ICU 2.0 + */ + UnicodeString + getNextString(const char ** key, + UErrorCode& status); + + /** + * Returns the resource in a resource at the specified index. + * + * @param index an index to the wanted resource. + * @param status fills in the outgoing error code + * @return ResourceBundle object. If there is an error, resource is invalid. + * @stable ICU 2.0 + */ + ResourceBundle + get(int32_t index, + UErrorCode& status) const; + + /** + * Returns the string in a given resource at the specified index. + * + * @param index an index to the wanted string. + * @param status fills in the outgoing error code + * @return an UnicodeString object. If there is an error, string is bogus + * @stable ICU 2.0 + */ + UnicodeString + getStringEx(int32_t index, + UErrorCode& status) const; + + /** + * Returns a resource in a resource that has a given key. This procedure works only with table + * resources. + * + * @param key a key associated with the wanted resource + * @param status fills in the outgoing error code. + * @return ResourceBundle object. If there is an error, resource is invalid. + * @stable ICU 2.0 + */ + ResourceBundle + get(const char* key, + UErrorCode& status) const; + + /** + * Returns a string in a resource that has a given key. This procedure works only with table + * resources. + * + * @param key a key associated with the wanted string + * @param status fills in the outgoing error code + * @return an UnicodeString object. If there is an error, string is bogus + * @stable ICU 2.0 + */ + UnicodeString + getStringEx(const char* key, + UErrorCode& status) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Return the version number associated with this ResourceBundle as a string. Please + * use getVersion, as this method is going to be deprecated. + * + * @return A version number string as specified in the resource bundle or its parent. + * The caller does not own this string. + * @see getVersion + * @deprecated ICU 2.8 Use getVersion instead. + */ + const char* + getVersionNumber(void) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Return the version number associated with this ResourceBundle as a UVersionInfo array. + * + * @param versionInfo A UVersionInfo array that is filled with the version number + * as specified in the resource bundle or its parent. + * @stable ICU 2.0 + */ + void + getVersion(UVersionInfo versionInfo) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Return the Locale associated with this ResourceBundle. + * + * @return a Locale object + * @deprecated ICU 2.8 Use getLocale(ULocDataLocaleType type, UErrorCode &status) overload instead. + */ + const Locale& + getLocale(void) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Return the Locale associated with this ResourceBundle. + * @param type You can choose between requested, valid and actual + * locale. For description see the definition of + * ULocDataLocaleType in uloc.h + * @param status just for catching illegal arguments + * + * @return a Locale object + * @stable ICU 2.8 + */ + const Locale + getLocale(ULocDataLocaleType type, UErrorCode &status) const; +#ifndef U_HIDE_INTERNAL_API + /** + * This API implements multilevel fallback + * @internal + */ + ResourceBundle + getWithFallback(const char* key, UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +private: + ResourceBundle(); // default constructor not implemented + + UResourceBundle *fResource; + void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error); + Locale *fLocale; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/schriter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/schriter.h new file mode 100644 index 0000000000000000000000000000000000000000..1ca5b70fca5828de759871349bbe133b44e27a8c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/schriter.h @@ -0,0 +1,195 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1998-2005, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* File schriter.h +* +* Modification History: +* +* Date Name Description +* 05/05/99 stephen Cleaned up. +****************************************************************************** +*/ + +#ifndef SCHRITER_H +#define SCHRITER_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/chariter.h" +#include "unicode/uchriter.h" + +/** + * \file + * \brief C++ API: String Character Iterator + */ + +U_NAMESPACE_BEGIN +/** + * A concrete subclass of CharacterIterator that iterates over the + * characters (code units or code points) in a UnicodeString. + * It's possible not only to create an + * iterator that iterates over an entire UnicodeString, but also to + * create one that iterates over only a subrange of a UnicodeString + * (iterators over different subranges of the same UnicodeString don't + * compare equal). + * @see CharacterIterator + * @see ForwardCharacterIterator + * @stable ICU 2.0 + */ +class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator { +public: + /** + * Create an iterator over the UnicodeString referred to by "textStr". + * The UnicodeString object is copied. + * The iteration range is the whole string, and the starting position is 0. + * @param textStr The unicode string used to create an iterator + * @stable ICU 2.0 + */ + StringCharacterIterator(const UnicodeString& textStr); + + /** + * Create an iterator over the UnicodeString referred to by "textStr". + * The iteration range is the whole string, and the starting + * position is specified by "textPos". If "textPos" is outside the valid + * iteration range, the behavior of this object is undefined. + * @param textStr The unicode string used to create an iterator + * @param textPos The starting position of the iteration + * @stable ICU 2.0 + */ + StringCharacterIterator(const UnicodeString& textStr, + int32_t textPos); + + /** + * Create an iterator over the UnicodeString referred to by "textStr". + * The UnicodeString object is copied. + * The iteration range begins with the code unit specified by + * "textBegin" and ends with the code unit BEFORE the code unit specified + * by "textEnd". The starting position is specified by "textPos". If + * "textBegin" and "textEnd" don't form a valid range on "text" (i.e., + * textBegin >= textEnd or either is negative or greater than text.size()), + * or "textPos" is outside the range defined by "textBegin" and "textEnd", + * the behavior of this iterator is undefined. + * @param textStr The unicode string used to create the StringCharacterIterator + * @param textBegin The begin position of the iteration range + * @param textEnd The end position of the iteration range + * @param textPos The starting position of the iteration + * @stable ICU 2.0 + */ + StringCharacterIterator(const UnicodeString& textStr, + int32_t textBegin, + int32_t textEnd, + int32_t textPos); + + /** + * Copy constructor. The new iterator iterates over the same range + * of the same string as "that", and its initial position is the + * same as "that"'s current position. + * The UnicodeString object in "that" is copied. + * @param that The StringCharacterIterator to be copied + * @stable ICU 2.0 + */ + StringCharacterIterator(const StringCharacterIterator& that); + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~StringCharacterIterator(); + + /** + * Assignment operator. *this is altered to iterate over the same + * range of the same string as "that", and refers to the same + * character within that string as "that" does. + * @param that The object to be copied. + * @return the newly created object. + * @stable ICU 2.0 + */ + StringCharacterIterator& + operator=(const StringCharacterIterator& that); + + /** + * Returns true if the iterators iterate over the same range of the + * same string and are pointing at the same character. + * @param that The ForwardCharacterIterator to be compared for equality + * @return true if the iterators iterate over the same range of the + * same string and are pointing at the same character. + * @stable ICU 2.0 + */ + virtual UBool operator==(const ForwardCharacterIterator& that) const; + + /** + * Returns a new StringCharacterIterator referring to the same + * character in the same range of the same string as this one. The + * caller must delete the new iterator. + * @return the newly cloned object. + * @stable ICU 2.0 + */ + virtual StringCharacterIterator* clone() const; + + /** + * Sets the iterator to iterate over the provided string. + * @param newText The string to be iterated over + * @stable ICU 2.0 + */ + void setText(const UnicodeString& newText); + + /** + * Copies the UnicodeString under iteration into the UnicodeString + * referred to by "result". Even if this iterator iterates across + * only a part of this string, the whole string is copied. + * @param result Receives a copy of the text under iteration. + * @stable ICU 2.0 + */ + virtual void getText(UnicodeString& result); + + /** + * Return a class ID for this object (not really public) + * @return a class ID for this object. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Return a class ID for this class (not really public) + * @return a class ID for this class + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + +protected: + /** + * Default constructor, iteration over empty string. + * @stable ICU 2.0 + */ + StringCharacterIterator(); + + /** + * Sets the iterator to iterate over the provided string. + * @param newText The string to be iterated over + * @param newTextLength The length of the String + * @stable ICU 2.0 + */ + void setText(const char16_t* newText, int32_t newTextLength); + + /** + * Copy of the iterated string object. + * @stable ICU 2.0 + */ + UnicodeString text; + +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/simpleformatter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/simpleformatter.h new file mode 100644 index 0000000000000000000000000000000000000000..6d9c04ace2359a6ccaf18dfaafd5edcafc1de537 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/simpleformatter.h @@ -0,0 +1,341 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2014-2016, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* simpleformatter.h +*/ + +#ifndef __SIMPLEFORMATTER_H__ +#define __SIMPLEFORMATTER_H__ + +/** + * \file + * \brief C++ API: Simple formatter, minimal subset of MessageFormat. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN + +// Forward declaration: +namespace number { +namespace impl { +class SimpleModifier; +} +} + +/** + * Formats simple patterns like "{1} was born in {0}". + * Minimal subset of MessageFormat; fast, simple, minimal dependencies. + * Supports only numbered arguments with no type nor style parameters, + * and formats only string values. + * Quoting via ASCII apostrophe compatible with ICU MessageFormat default behavior. + * + * Factory methods set error codes for syntax errors + * and for too few or too many arguments/placeholders. + * + * SimpleFormatter objects are thread-safe except for assignment and applying new patterns. + * + * Example: + *

+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * SimpleFormatter fmt("{1} '{born}' in {0}", errorCode);
+ * UnicodeString result;
+ *
+ * // Output: "paul {born} in england"
+ * fmt.format("england", "paul", result, errorCode);
+ * 
+ * + * This class is not intended for public subclassing. + * + * @see MessageFormat + * @see UMessagePatternApostropheMode + * @stable ICU 57 + */ +class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { +public: + /** + * Default constructor. + * @stable ICU 57 + */ + SimpleFormatter() : compiledPattern((char16_t)0) {} + + /** + * Constructs a formatter from the pattern string. + * + * @param pattern The pattern string. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax. + * @stable ICU 57 + */ + SimpleFormatter(const UnicodeString& pattern, UErrorCode &errorCode) { + applyPattern(pattern, errorCode); + } + + /** + * Constructs a formatter from the pattern string. + * The number of arguments checked against the given limits is the + * highest argument number plus one, not the number of occurrences of arguments. + * + * @param pattern The pattern string. + * @param min The pattern must have at least this many arguments. + * @param max The pattern must have at most this many arguments. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and + * too few or too many arguments. + * @stable ICU 57 + */ + SimpleFormatter(const UnicodeString& pattern, int32_t min, int32_t max, + UErrorCode &errorCode) { + applyPatternMinMaxArguments(pattern, min, max, errorCode); + } + + /** + * Copy constructor. + * @stable ICU 57 + */ + SimpleFormatter(const SimpleFormatter& other) + : compiledPattern(other.compiledPattern) {} + + /** + * Assignment operator. + * @stable ICU 57 + */ + SimpleFormatter &operator=(const SimpleFormatter& other); + + /** + * Destructor. + * @stable ICU 57 + */ + ~SimpleFormatter(); + + /** + * Changes this object according to the new pattern. + * + * @param pattern The pattern string. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax. + * @return true if U_SUCCESS(errorCode). + * @stable ICU 57 + */ + UBool applyPattern(const UnicodeString &pattern, UErrorCode &errorCode) { + return applyPatternMinMaxArguments(pattern, 0, INT32_MAX, errorCode); + } + + /** + * Changes this object according to the new pattern. + * The number of arguments checked against the given limits is the + * highest argument number plus one, not the number of occurrences of arguments. + * + * @param pattern The pattern string. + * @param min The pattern must have at least this many arguments. + * @param max The pattern must have at most this many arguments. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and + * too few or too many arguments. + * @return true if U_SUCCESS(errorCode). + * @stable ICU 57 + */ + UBool applyPatternMinMaxArguments(const UnicodeString &pattern, + int32_t min, int32_t max, UErrorCode &errorCode); + + /** + * @return The max argument number + 1. + * @stable ICU 57 + */ + int32_t getArgumentLimit() const { + return getArgumentLimit(compiledPattern.getBuffer(), compiledPattern.length()); + } + + /** + * Formats the given value, appending to the appendTo builder. + * The argument value must not be the same object as appendTo. + * getArgumentLimit() must be at most 1. + * + * @param value0 Value for argument {0}. + * @param appendTo Gets the formatted pattern and value appended. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString &format( + const UnicodeString &value0, + UnicodeString &appendTo, UErrorCode &errorCode) const; + + /** + * Formats the given values, appending to the appendTo builder. + * An argument value must not be the same object as appendTo. + * getArgumentLimit() must be at most 2. + * + * @param value0 Value for argument {0}. + * @param value1 Value for argument {1}. + * @param appendTo Gets the formatted pattern and values appended. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString &format( + const UnicodeString &value0, + const UnicodeString &value1, + UnicodeString &appendTo, UErrorCode &errorCode) const; + + /** + * Formats the given values, appending to the appendTo builder. + * An argument value must not be the same object as appendTo. + * getArgumentLimit() must be at most 3. + * + * @param value0 Value for argument {0}. + * @param value1 Value for argument {1}. + * @param value2 Value for argument {2}. + * @param appendTo Gets the formatted pattern and values appended. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString &format( + const UnicodeString &value0, + const UnicodeString &value1, + const UnicodeString &value2, + UnicodeString &appendTo, UErrorCode &errorCode) const; + + /** + * Formats the given values, appending to the appendTo string. + * + * @param values The argument values. + * An argument value must not be the same object as appendTo. + * Can be NULL if valuesLength==getArgumentLimit()==0. + * @param valuesLength The length of the values array. + * Must be at least getArgumentLimit(). + * @param appendTo Gets the formatted pattern and values appended. + * @param offsets offsets[i] receives the offset of where + * values[i] replaced pattern argument {i}. + * Can be shorter or longer than values. Can be NULL if offsetsLength==0. + * If there is no {i} in the pattern, then offsets[i] is set to -1. + * @param offsetsLength The length of the offsets array. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString &formatAndAppend( + const UnicodeString *const *values, int32_t valuesLength, + UnicodeString &appendTo, + int32_t *offsets, int32_t offsetsLength, UErrorCode &errorCode) const; + + /** + * Formats the given values, replacing the contents of the result string. + * May optimize by actually appending to the result if it is the same object + * as the value corresponding to the initial argument in the pattern. + * + * @param values The argument values. + * An argument value may be the same object as result. + * Can be NULL if valuesLength==getArgumentLimit()==0. + * @param valuesLength The length of the values array. + * Must be at least getArgumentLimit(). + * @param result Gets its contents replaced by the formatted pattern and values. + * @param offsets offsets[i] receives the offset of where + * values[i] replaced pattern argument {i}. + * Can be shorter or longer than values. Can be NULL if offsetsLength==0. + * If there is no {i} in the pattern, then offsets[i] is set to -1. + * @param offsetsLength The length of the offsets array. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return result + * @stable ICU 57 + */ + UnicodeString &formatAndReplace( + const UnicodeString *const *values, int32_t valuesLength, + UnicodeString &result, + int32_t *offsets, int32_t offsetsLength, UErrorCode &errorCode) const; + + /** + * Returns the pattern text with none of the arguments. + * Like formatting with all-empty string values. + * @stable ICU 57 + */ + UnicodeString getTextWithNoArguments() const { + return getTextWithNoArguments( + compiledPattern.getBuffer(), + compiledPattern.length(), + nullptr, + 0); + } + +#ifndef U_HIDE_INTERNAL_API + /** + * Returns the pattern text with none of the arguments. + * Like formatting with all-empty string values. + * + * TODO(ICU-20406): Replace this with an Iterator interface. + * + * @param offsets offsets[i] receives the offset of where {i} was located + * before it was replaced by an empty string. + * For example, "a{0}b{1}" produces offset 1 for i=0 and 2 for i=1. + * Can be nullptr if offsetsLength==0. + * If there is no {i} in the pattern, then offsets[i] is set to -1. + * @param offsetsLength The length of the offsets array. + * + * @internal + */ + UnicodeString getTextWithNoArguments(int32_t *offsets, int32_t offsetsLength) const { + return getTextWithNoArguments( + compiledPattern.getBuffer(), + compiledPattern.length(), + offsets, + offsetsLength); + } +#endif // U_HIDE_INTERNAL_API + +private: + /** + * Binary representation of the compiled pattern. + * Index 0: One more than the highest argument number. + * Followed by zero or more arguments or literal-text segments. + * + * An argument is stored as its number, less than ARG_NUM_LIMIT. + * A literal-text segment is stored as its length (at least 1) offset by ARG_NUM_LIMIT, + * followed by that many chars. + */ + UnicodeString compiledPattern; + + static inline int32_t getArgumentLimit(const char16_t *compiledPattern, + int32_t compiledPatternLength) { + return compiledPatternLength == 0 ? 0 : compiledPattern[0]; + } + + static UnicodeString getTextWithNoArguments( + const char16_t *compiledPattern, + int32_t compiledPatternLength, + int32_t *offsets, + int32_t offsetsLength); + + static UnicodeString &format( + const char16_t *compiledPattern, int32_t compiledPatternLength, + const UnicodeString *const *values, + UnicodeString &result, const UnicodeString *resultCopy, UBool forbidResultAsValue, + int32_t *offsets, int32_t offsetsLength, + UErrorCode &errorCode); + + // Give access to internals to SimpleModifier for number formatting + friend class number::impl::SimpleModifier; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __SIMPLEFORMATTER_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/std_string.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/std_string.h new file mode 100644 index 0000000000000000000000000000000000000000..bf87230167ecf25ce98aef43a05302c165497c67 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/std_string.h @@ -0,0 +1,41 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: std_string.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009feb19 +* created by: Markus W. Scherer +*/ + +#ifndef __STD_STRING_H__ +#define __STD_STRING_H__ + +/** + * \file + * \brief C++ API: Central ICU header for including the C++ standard <string> + * header and for related definitions. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +// Workaround for a libstdc++ bug before libstdc++4.6 (2011). +// https://bugs.llvm.org/show_bug.cgi?id=13364 +#if defined(__GLIBCXX__) +namespace std { class type_info; } +#endif +#include + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __STD_STRING_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/strenum.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/strenum.h new file mode 100644 index 0000000000000000000000000000000000000000..df72b4b7e84910bab8711644d614e80bb50f19ec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/strenum.h @@ -0,0 +1,281 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +*/ + +#ifndef STRENUM_H +#define STRENUM_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: String Enumeration + */ + +U_NAMESPACE_BEGIN + +/** + * Base class for 'pure' C++ implementations of uenum api. Adds a + * method that returns the next UnicodeString since in C++ this can + * be a common storage format for strings. + * + *

The model is that the enumeration is over strings maintained by + * a 'service.' At any point, the service might change, invalidating + * the enumerator (though this is expected to be rare). The iterator + * returns an error if this has occurred. Lack of the error is no + * guarantee that the service didn't change immediately after the + * call, so the returned string still might not be 'valid' on + * subsequent use.

+ * + *

Strings may take the form of const char*, const char16_t*, or const + * UnicodeString*. The type you get is determine by the variant of + * 'next' that you call. In general the StringEnumeration is + * optimized for one of these types, but all StringEnumerations can + * return all types. Returned strings are each terminated with a NUL. + * Depending on the service data, they might also include embedded NUL + * characters, so API is provided to optionally return the true + * length, counting the embedded NULs but not counting the terminating + * NUL.

+ * + *

The pointers returned by next, unext, and snext become invalid + * upon any subsequent call to the enumeration's destructor, next, + * unext, snext, or reset.

+ * + * ICU 2.8 adds some default implementations and helper functions + * for subclasses. + * + * @stable ICU 2.4 + */ +class U_COMMON_API StringEnumeration : public UObject { +public: + /** + * Destructor. + * @stable ICU 2.4 + */ + virtual ~StringEnumeration(); + + /** + * Clone this object, an instance of a subclass of StringEnumeration. + * Clones can be used concurrently in multiple threads. + * If a subclass does not implement clone(), or if an error occurs, + * then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + virtual StringEnumeration *clone() const; + + /** + *

Return the number of elements that the iterator traverses. If + * the iterator is out of sync with its service, status is set to + * U_ENUM_OUT_OF_SYNC_ERROR, and the return value is zero.

+ * + *

The return value will not change except possibly as a result of + * a subsequent call to reset, or if the iterator becomes out of sync.

+ * + *

This is a convenience function. It can end up being very + * expensive as all the items might have to be pre-fetched + * (depending on the storage format of the data being + * traversed).

+ * + * @param status the error code. + * @return number of elements in the iterator. + * + * @stable ICU 2.4 */ + virtual int32_t count(UErrorCode& status) const = 0; + + /** + *

Returns the next element as a NUL-terminated char*. If there + * are no more elements, returns NULL. If the resultLength pointer + * is not NULL, the length of the string (not counting the + * terminating NUL) is returned at that address. If an error + * status is returned, the value at resultLength is undefined.

+ * + *

The returned pointer is owned by this iterator and must not be + * deleted by the caller. The pointer is valid until the next call + * to next, unext, snext, reset, or the enumerator's destructor.

+ * + *

If the iterator is out of sync with its service, status is set + * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

+ * + *

If the native service string is a char16_t* string, it is + * converted to char* with the invariant converter. If the + * conversion fails (because a character cannot be converted) then + * status is set to U_INVARIANT_CONVERSION_ERROR and the return + * value is undefined (though not NULL).

+ * + * Starting with ICU 2.8, the default implementation calls snext() + * and handles the conversion. + * Either next() or snext() must be implemented differently by a subclass. + * + * @param status the error code. + * @param resultLength a pointer to receive the length, can be NULL. + * @return a pointer to the string, or NULL. + * + * @stable ICU 2.4 + */ + virtual const char* next(int32_t *resultLength, UErrorCode& status); + + /** + *

Returns the next element as a NUL-terminated char16_t*. If there + * are no more elements, returns NULL. If the resultLength pointer + * is not NULL, the length of the string (not counting the + * terminating NUL) is returned at that address. If an error + * status is returned, the value at resultLength is undefined.

+ * + *

The returned pointer is owned by this iterator and must not be + * deleted by the caller. The pointer is valid until the next call + * to next, unext, snext, reset, or the enumerator's destructor.

+ * + *

If the iterator is out of sync with its service, status is set + * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

+ * + * Starting with ICU 2.8, the default implementation calls snext() + * and handles the conversion. + * + * @param status the error code. + * @param resultLength a ponter to receive the length, can be NULL. + * @return a pointer to the string, or NULL. + * + * @stable ICU 2.4 + */ + virtual const char16_t* unext(int32_t *resultLength, UErrorCode& status); + + /** + *

Returns the next element a UnicodeString*. If there are no + * more elements, returns NULL.

+ * + *

The returned pointer is owned by this iterator and must not be + * deleted by the caller. The pointer is valid until the next call + * to next, unext, snext, reset, or the enumerator's destructor.

+ * + *

If the iterator is out of sync with its service, status is set + * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

+ * + * Starting with ICU 2.8, the default implementation calls next() + * and handles the conversion. + * Either next() or snext() must be implemented differently by a subclass. + * + * @param status the error code. + * @return a pointer to the string, or NULL. + * + * @stable ICU 2.4 + */ + virtual const UnicodeString* snext(UErrorCode& status); + + /** + *

Resets the iterator. This re-establishes sync with the + * service and rewinds the iterator to start at the first + * element.

+ * + *

Previous pointers returned by next, unext, or snext become + * invalid, and the value returned by count might change.

+ * + * @param status the error code. + * + * @stable ICU 2.4 + */ + virtual void reset(UErrorCode& status) = 0; + + /** + * Compares this enumeration to other to check if both are equal + * + * @param that The other string enumeration to compare this object to + * @return true if the enumerations are equal. false if not. + * @stable ICU 3.6 + */ + virtual UBool operator==(const StringEnumeration& that)const; + /** + * Compares this enumeration to other to check if both are not equal + * + * @param that The other string enumeration to compare this object to + * @return true if the enumerations are equal. false if not. + * @stable ICU 3.6 + */ + virtual UBool operator!=(const StringEnumeration& that)const; + +protected: + /** + * UnicodeString field for use with default implementations and subclasses. + * @stable ICU 2.8 + */ + UnicodeString unistr; + /** + * char * default buffer for use with default implementations and subclasses. + * @stable ICU 2.8 + */ + char charsBuffer[32]; + /** + * char * buffer for use with default implementations and subclasses. + * Allocated in constructor and in ensureCharsCapacity(). + * @stable ICU 2.8 + */ + char *chars; + /** + * Capacity of chars, for use with default implementations and subclasses. + * @stable ICU 2.8 + */ + int32_t charsCapacity; + + /** + * Default constructor for use with default implementations and subclasses. + * @stable ICU 2.8 + */ + StringEnumeration(); + + /** + * Ensures that chars is at least as large as the requested capacity. + * For use with default implementations and subclasses. + * + * @param capacity Requested capacity. + * @param status ICU in/out error code. + * @stable ICU 2.8 + */ + void ensureCharsCapacity(int32_t capacity, UErrorCode &status); + + /** + * Converts s to Unicode and sets unistr to the result. + * For use with default implementations and subclasses, + * especially for implementations of snext() in terms of next(). + * This is provided with a helper function instead of a default implementation + * of snext() to avoid potential infinite loops between next() and snext(). + * + * For example: + * \code + * const UnicodeString* snext(UErrorCode& status) { + * int32_t resultLength=0; + * const char *s=next(&resultLength, status); + * return setChars(s, resultLength, status); + * } + * \endcode + * + * @param s String to be converted to Unicode. + * @param length Length of the string. + * @param status ICU in/out error code. + * @return A pointer to unistr. + * @stable ICU 2.8 + */ + UnicodeString *setChars(const char *s, int32_t length, UErrorCode &status); +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +/* STRENUM_H */ +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/stringoptions.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/stringoptions.h new file mode 100644 index 0000000000000000000000000000000000000000..7b9f70944f62db69997057f5f67912566cdde220 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/stringoptions.h @@ -0,0 +1,190 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// stringoptions.h +// created: 2017jun08 Markus W. Scherer + +#ifndef __STRINGOPTIONS_H__ +#define __STRINGOPTIONS_H__ + +#include "unicode/utypes.h" + +/** + * \file + * \brief C API: Bit set option bit constants for various string and character processing functions. + */ + +/** + * Option value for case folding: Use default mappings defined in CaseFolding.txt. + * + * @stable ICU 2.0 + */ +#define U_FOLD_CASE_DEFAULT 0 + +/** + * Option value for case folding: + * + * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I + * and dotless i appropriately for Turkic languages (tr, az). + * + * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that + * are to be included for default mappings and + * excluded for the Turkic-specific mappings. + * + * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that + * are to be excluded for default mappings and + * included for the Turkic-specific mappings. + * + * @stable ICU 2.0 + */ +#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1 + +/** + * Titlecase the string as a whole rather than each word. + * (Titlecase only the character at index 0, possibly adjusted.) + * Option bits value for titlecasing APIs that take an options bit set. + * + * It is an error to specify multiple titlecasing iterator options together, + * including both an options bit and an explicit BreakIterator. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @stable ICU 60 + */ +#define U_TITLECASE_WHOLE_STRING 0x20 + +/** + * Titlecase sentences rather than words. + * (Titlecase only the first character of each sentence, possibly adjusted.) + * Option bits value for titlecasing APIs that take an options bit set. + * + * It is an error to specify multiple titlecasing iterator options together, + * including both an options bit and an explicit BreakIterator. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @stable ICU 60 + */ +#define U_TITLECASE_SENTENCES 0x40 + +/** + * Do not lowercase non-initial parts of words when titlecasing. + * Option bit for titlecasing APIs that take an options bit set. + * + * By default, titlecasing will titlecase the character at each + * (possibly adjusted) BreakIterator index and + * lowercase all other characters up to the next iterator index. + * With this option, the other characters will not be modified. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @see UnicodeString::toTitle + * @see CaseMap::toTitle + * @see ucasemap_setOptions + * @see ucasemap_toTitle + * @see ucasemap_utf8ToTitle + * @stable ICU 3.8 + */ +#define U_TITLECASE_NO_LOWERCASE 0x100 + +/** + * Do not adjust the titlecasing BreakIterator indexes; + * titlecase exactly the characters at breaks from the iterator. + * Option bit for titlecasing APIs that take an options bit set. + * + * By default, titlecasing will take each break iterator index, + * adjust it to the next relevant character (see U_TITLECASE_ADJUST_TO_CASED), + * and titlecase that one. + * + * Other characters are lowercased. + * + * It is an error to specify multiple titlecasing adjustment options together. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @see U_TITLECASE_NO_LOWERCASE + * @see UnicodeString::toTitle + * @see CaseMap::toTitle + * @see ucasemap_setOptions + * @see ucasemap_toTitle + * @see ucasemap_utf8ToTitle + * @stable ICU 3.8 + */ +#define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200 + +/** + * Adjust each titlecasing BreakIterator index to the next cased character. + * (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).) + * Option bit for titlecasing APIs that take an options bit set. + * + * This used to be the default index adjustment in ICU. + * Since ICU 60, the default index adjustment is to the next character that is + * a letter, number, symbol, or private use code point. + * (Uncased modifier letters are skipped.) + * The difference in behavior is small for word titlecasing, + * but the new adjustment is much better for whole-string and sentence titlecasing: + * It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»". + * + * It is an error to specify multiple titlecasing adjustment options together. + * + * @see U_TITLECASE_NO_BREAK_ADJUSTMENT + * @stable ICU 60 + */ +#define U_TITLECASE_ADJUST_TO_CASED 0x400 + +/** + * Option for string transformation functions to not first reset the Edits object. + * Used for example in some case-mapping and normalization functions. + * + * @see CaseMap + * @see Edits + * @see Normalizer2 + * @stable ICU 60 + */ +#define U_EDITS_NO_RESET 0x2000 + +/** + * Omit unchanged text when recording how source substrings + * relate to changed and unchanged result substrings. + * Used for example in some case-mapping and normalization functions. + * + * @see CaseMap + * @see Edits + * @see Normalizer2 + * @stable ICU 60 + */ +#define U_OMIT_UNCHANGED_TEXT 0x4000 + +/** + * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: + * Compare strings in code point order instead of code unit order. + * @stable ICU 2.2 + */ +#define U_COMPARE_CODE_POINT_ORDER 0x8000 + +/** + * Option bit for unorm_compare: + * Perform case-insensitive comparison. + * @stable ICU 2.2 + */ +#define U_COMPARE_IGNORE_CASE 0x10000 + +/** + * Option bit for unorm_compare: + * Both input strings are assumed to fulfill FCD conditions. + * @stable ICU 2.2 + */ +#define UNORM_INPUT_IS_FCD 0x20000 + +// Related definitions elsewhere. +// Options that are not meaningful in the same functions +// can share the same bits. +// +// Public: +// unicode/unorm.h #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 +// +// Internal: (may change or be removed) +// ucase.h #define _STRCASECMP_OPTIONS_MASK 0xffff +// ucase.h #define _FOLD_CASE_OPTIONS_MASK 7 +// ucasemap_imp.h #define U_TITLECASE_ITERATOR_MASK 0xe0 +// ucasemap_imp.h #define U_TITLECASE_ADJUSTMENT_MASK 0x600 +// ustr_imp.h #define _STRNCMP_STYLE 0x1000 +// unormcmp.cpp #define _COMPARE_EQUIV 0x80000 + +#endif // __STRINGOPTIONS_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/stringpiece.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/stringpiece.h new file mode 100644 index 0000000000000000000000000000000000000000..8c96789e7301d2f311587e03ba13e52a8d804df5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/stringpiece.h @@ -0,0 +1,343 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// Copyright (C) 2009-2013, International Business Machines +// Corporation and others. All Rights Reserved. +// +// Copyright 2001 and onwards Google Inc. +// Author: Sanjay Ghemawat + +// This code is a contribution of Google code, and the style used here is +// a compromise between the original Google code and the ICU coding guidelines. +// For example, data types are ICU-ified (size_t,int->int32_t), +// and API comments doxygen-ified, but function names and behavior are +// as in the original, if possible. +// Assertion-style error handling, not available in ICU, was changed to +// parameter "pinning" similar to UnicodeString. +// +// In addition, this is only a partial port of the original Google code, +// limited to what was needed so far. The (nearly) complete original code +// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib +// (see ICU ticket 6765, r25517). + +#ifndef __STRINGPIECE_H__ +#define __STRINGPIECE_H__ + +/** + * \file + * \brief C++ API: StringPiece: Read-only byte string wrapper class. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include +#include + +#include "unicode/uobject.h" +#include "unicode/std_string.h" + +// Arghh! I wish C++ literals were "string". + +U_NAMESPACE_BEGIN + +/** + * A string-like object that points to a sized piece of memory. + * + * We provide non-explicit singleton constructors so users can pass + * in a "const char*" or a "string" wherever a "StringPiece" is + * expected. + * + * Functions or methods may use StringPiece parameters to accept either a + * "const char*" or a "string" value that will be implicitly converted to a + * StringPiece. + * + * Systematic usage of StringPiece is encouraged as it will reduce unnecessary + * conversions from "const char*" to "string" and back again. + * + * @stable ICU 4.2 + */ +class U_COMMON_API StringPiece : public UMemory { + private: + const char* ptr_; + int32_t length_; + + public: + /** + * Default constructor, creates an empty StringPiece. + * @stable ICU 4.2 + */ + StringPiece() : ptr_(nullptr), length_(0) { } + + /** + * Constructs from a NUL-terminated const char * pointer. + * @param str a NUL-terminated const char * pointer + * @stable ICU 4.2 + */ + StringPiece(const char* str); +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) + /** + * Constructs from a NUL-terminated const char8_t * pointer. + * @param str a NUL-terminated const char8_t * pointer + * @stable ICU 67 + */ + StringPiece(const char8_t* str) : StringPiece(reinterpret_cast(str)) {} +#endif + /** + * Constructs an empty StringPiece. + * Needed for type disambiguation from multiple other overloads. + * @param p nullptr + * @stable ICU 67 + */ + StringPiece(std::nullptr_t p) : ptr_(p), length_(0) {} + + /** + * Constructs from a std::string. + * @stable ICU 4.2 + */ + StringPiece(const std::string& str) + : ptr_(str.data()), length_(static_cast(str.size())) { } +#if defined(__cpp_lib_char8_t) || defined(U_IN_DOXYGEN) + /** + * Constructs from a std::u8string. + * @stable ICU 67 + */ + StringPiece(const std::u8string& str) + : ptr_(reinterpret_cast(str.data())), + length_(static_cast(str.size())) { } +#endif + + /** + * Constructs from some other implementation of a string piece class, from any + * C++ record type that has these two methods: + * + * \code{.cpp} + * + * struct OtherStringPieceClass { + * const char* data(); // or const char8_t* + * size_t size(); + * }; + * + * \endcode + * + * The other string piece class will typically be std::string_view from C++17 + * or absl::string_view from Abseil. + * + * Starting with C++20, data() may also return a const char8_t* pointer, + * as from std::u8string_view. + * + * @param str the other string piece + * @stable ICU 65 + */ + template ::value +#if defined(__cpp_char8_t) + || std::is_same::value +#endif + ) && + std::is_same::value>::type> + StringPiece(T str) + : ptr_(reinterpret_cast(str.data())), + length_(static_cast(str.size())) {} + + /** + * Constructs from a const char * pointer and a specified length. + * @param offset a const char * pointer (need not be terminated) + * @param len the length of the string; must be non-negative + * @stable ICU 4.2 + */ + StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { } +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) + /** + * Constructs from a const char8_t * pointer and a specified length. + * @param str a const char8_t * pointer (need not be terminated) + * @param len the length of the string; must be non-negative + * @stable ICU 67 + */ + StringPiece(const char8_t* str, int32_t len) : + StringPiece(reinterpret_cast(str), len) {} +#endif + + /** + * Substring of another StringPiece. + * @param x the other StringPiece + * @param pos start position in x; must be non-negative and <= x.length(). + * @stable ICU 4.2 + */ + StringPiece(const StringPiece& x, int32_t pos); + /** + * Substring of another StringPiece. + * @param x the other StringPiece + * @param pos start position in x; must be non-negative and <= x.length(). + * @param len length of the substring; + * must be non-negative and will be pinned to at most x.length() - pos. + * @stable ICU 4.2 + */ + StringPiece(const StringPiece& x, int32_t pos, int32_t len); + + /** + * Returns the string pointer. May be nullptr if it is empty. + * + * data() may return a pointer to a buffer with embedded NULs, and the + * returned buffer may or may not be null terminated. Therefore it is + * typically a mistake to pass data() to a routine that expects a NUL + * terminated string. + * @return the string pointer + * @stable ICU 4.2 + */ + const char* data() const { return ptr_; } + /** + * Returns the string length. Same as length(). + * @return the string length + * @stable ICU 4.2 + */ + int32_t size() const { return length_; } + /** + * Returns the string length. Same as size(). + * @return the string length + * @stable ICU 4.2 + */ + int32_t length() const { return length_; } + /** + * Returns whether the string is empty. + * @return true if the string is empty + * @stable ICU 4.2 + */ + UBool empty() const { return length_ == 0; } + + /** + * Sets to an empty string. + * @stable ICU 4.2 + */ + void clear() { ptr_ = nullptr; length_ = 0; } + + /** + * Reset the stringpiece to refer to new data. + * @param xdata pointer the new string data. Need not be nul terminated. + * @param len the length of the new data + * @stable ICU 4.8 + */ + void set(const char* xdata, int32_t len) { ptr_ = xdata; length_ = len; } + + /** + * Reset the stringpiece to refer to new data. + * @param str a pointer to a NUL-terminated string. + * @stable ICU 4.8 + */ + void set(const char* str); + +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) + /** + * Resets the stringpiece to refer to new data. + * @param xdata pointer the new string data. Need not be NUL-terminated. + * @param len the length of the new data + * @stable ICU 67 + */ + inline void set(const char8_t* xdata, int32_t len) { + set(reinterpret_cast(xdata), len); + } + + /** + * Resets the stringpiece to refer to new data. + * @param str a pointer to a NUL-terminated string. + * @stable ICU 67 + */ + inline void set(const char8_t* str) { + set(reinterpret_cast(str)); + } +#endif + + /** + * Removes the first n string units. + * @param n prefix length, must be non-negative and <=length() + * @stable ICU 4.2 + */ + void remove_prefix(int32_t n) { + if (n >= 0) { + if (n > length_) { + n = length_; + } + ptr_ += n; + length_ -= n; + } + } + + /** + * Removes the last n string units. + * @param n suffix length, must be non-negative and <=length() + * @stable ICU 4.2 + */ + void remove_suffix(int32_t n) { + if (n >= 0) { + if (n <= length_) { + length_ -= n; + } else { + length_ = 0; + } + } + } + + /** + * Searches the StringPiece for the given search string (needle); + * @param needle The string for which to search. + * @param offset Where to start searching within this string (haystack). + * @return The offset of needle in haystack, or -1 if not found. + * @stable ICU 67 + */ + int32_t find(StringPiece needle, int32_t offset); + + /** + * Compares this StringPiece with the other StringPiece, with semantics + * similar to std::string::compare(). + * @param other The string to compare to. + * @return below zero if this < other; above zero if this > other; 0 if this == other. + * @stable ICU 67 + */ + int32_t compare(StringPiece other); + + /** + * Maximum integer, used as a default value for substring methods. + * @stable ICU 4.2 + */ + static const int32_t npos; // = 0x7fffffff; + + /** + * Returns a substring of this StringPiece. + * @param pos start position; must be non-negative and <= length(). + * @param len length of the substring; + * must be non-negative and will be pinned to at most length() - pos. + * @return the substring StringPiece + * @stable ICU 4.2 + */ + StringPiece substr(int32_t pos, int32_t len = npos) const { + return StringPiece(*this, pos, len); + } +}; + +/** + * Global operator == for StringPiece + * @param x The first StringPiece to compare. + * @param y The second StringPiece to compare. + * @return true if the string data is equal + * @stable ICU 4.8 + */ +U_EXPORT UBool U_EXPORT2 +operator==(const StringPiece& x, const StringPiece& y); + +/** + * Global operator != for StringPiece + * @param x The first StringPiece to compare. + * @param y The second StringPiece to compare. + * @return true if the string data is not equal + * @stable ICU 4.8 + */ +inline UBool operator!=(const StringPiece& x, const StringPiece& y) { + return !(x == y); +} + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __STRINGPIECE_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/stringtriebuilder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/stringtriebuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..fe471bbbf9c7d4dc49abaec8c06244441bce5dae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/stringtriebuilder.h @@ -0,0 +1,426 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012,2014, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: stringtriebuilder.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010dec24 +* created by: Markus W. Scherer +*/ + +#ifndef __STRINGTRIEBUILDER_H__ +#define __STRINGTRIEBUILDER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Builder API for trie builders + */ + +// Forward declaration. +/// \cond +struct UHashtable; +typedef struct UHashtable UHashtable; +/// \endcond + +/** + * Build options for BytesTrieBuilder and CharsTrieBuilder. + * @stable ICU 4.8 + */ +enum UStringTrieBuildOption { + /** + * Builds a trie quickly. + * @stable ICU 4.8 + */ + USTRINGTRIE_BUILD_FAST, + /** + * Builds a trie more slowly, attempting to generate + * a shorter but equivalent serialization. + * This build option also uses more memory. + * + * This option can be effective when many integer values are the same + * and string/byte sequence suffixes can be shared. + * Runtime speed is not expected to improve. + * @stable ICU 4.8 + */ + USTRINGTRIE_BUILD_SMALL +}; + +U_NAMESPACE_BEGIN + +/** + * Base class for string trie builder classes. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API StringTrieBuilder : public UObject { +public: +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + static int32_t hashNode(const void *node); + /** @internal */ + static UBool equalNodes(const void *left, const void *right); +#endif /* U_HIDE_INTERNAL_API */ + +protected: + // Do not enclose the protected default constructor with #ifndef U_HIDE_INTERNAL_API + // or else the compiler will create a public default constructor. + /** @internal */ + StringTrieBuilder(); + /** @internal */ + virtual ~StringTrieBuilder(); + +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + void createCompactBuilder(int32_t sizeGuess, UErrorCode &errorCode); + /** @internal */ + void deleteCompactBuilder(); + + /** @internal */ + void build(UStringTrieBuildOption buildOption, int32_t elementsLength, UErrorCode &errorCode); + + /** @internal */ + int32_t writeNode(int32_t start, int32_t limit, int32_t unitIndex); + /** @internal */ + int32_t writeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex, int32_t length); +#endif /* U_HIDE_INTERNAL_API */ + + class Node; + +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + Node *makeNode(int32_t start, int32_t limit, int32_t unitIndex, UErrorCode &errorCode); + /** @internal */ + Node *makeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex, + int32_t length, UErrorCode &errorCode); +#endif /* U_HIDE_INTERNAL_API */ + + /** @internal */ + virtual int32_t getElementStringLength(int32_t i) const = 0; + /** @internal */ + virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const = 0; + /** @internal */ + virtual int32_t getElementValue(int32_t i) const = 0; + + // Finds the first unit index after this one where + // the first and last element have different units again. + /** @internal */ + virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const = 0; + + // Number of different units at unitIndex. + /** @internal */ + virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const = 0; + /** @internal */ + virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const = 0; + /** @internal */ + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const = 0; + + /** @internal */ + virtual UBool matchNodesCanHaveValues() const = 0; + + /** @internal */ + virtual int32_t getMaxBranchLinearSubNodeLength() const = 0; + /** @internal */ + virtual int32_t getMinLinearMatch() const = 0; + /** @internal */ + virtual int32_t getMaxLinearMatchLength() const = 0; + +#ifndef U_HIDE_INTERNAL_API + // max(BytesTrie::kMaxBranchLinearSubNodeLength, UCharsTrie::kMaxBranchLinearSubNodeLength). + /** @internal */ + static const int32_t kMaxBranchLinearSubNodeLength=5; + + // Maximum number of nested split-branch levels for a branch on all 2^16 possible char16_t units. + // log2(2^16/kMaxBranchLinearSubNodeLength) rounded up. + /** @internal */ + static const int32_t kMaxSplitBranchLevels=14; + + /** + * Makes sure that there is only one unique node registered that is + * equivalent to newNode. + * @param newNode Input node. The builder takes ownership. + * @param errorCode ICU in/out UErrorCode. + Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==NULL. + * @return newNode if it is the first of its kind, or + * an equivalent node if newNode is a duplicate. + * @internal + */ + Node *registerNode(Node *newNode, UErrorCode &errorCode); + /** + * Makes sure that there is only one unique FinalValueNode registered + * with this value. + * Avoids creating a node if the value is a duplicate. + * @param value A final value. + * @param errorCode ICU in/out UErrorCode. + Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==NULL. + * @return A FinalValueNode with the given value. + * @internal + */ + Node *registerFinalValue(int32_t value, UErrorCode &errorCode); +#endif /* U_HIDE_INTERNAL_API */ + + /* + * C++ note: + * registerNode() and registerFinalValue() take ownership of their input nodes, + * and only return owned nodes. + * If they see a failure UErrorCode, they will delete the input node. + * If they get a NULL pointer, they will record a U_MEMORY_ALLOCATION_ERROR. + * If there is a failure, they return NULL. + * + * NULL Node pointers can be safely passed into other Nodes because + * they call the static Node::hashCode() which checks for a NULL pointer first. + * + * Therefore, as long as builder functions register a new node, + * they need to check for failures only before explicitly dereferencing + * a Node pointer, or before setting a new UErrorCode. + */ + + // Hash set of nodes, maps from nodes to integer 1. + /** @internal */ + UHashtable *nodes; + + // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API, + // it is needed for layout of other objects. + /** + * @internal + * \cond + */ + class Node : public UObject { + public: + Node(int32_t initialHash) : hash(initialHash), offset(0) {} + inline int32_t hashCode() const { return hash; } + // Handles node==NULL. + static inline int32_t hashCode(const Node *node) { return node==NULL ? 0 : node->hashCode(); } + // Base class operator==() compares the actual class types. + virtual UBool operator==(const Node &other) const; + inline UBool operator!=(const Node &other) const { return !operator==(other); } + /** + * Traverses the Node graph and numbers branch edges, with rightmost edges first. + * This is to avoid writing a duplicate node twice. + * + * Branch nodes in this trie data structure are not symmetric. + * Most branch edges "jump" to other nodes but the rightmost branch edges + * just continue without a jump. + * Therefore, write() must write the rightmost branch edge last + * (trie units are written backwards), and must write it at that point even if + * it is a duplicate of a node previously written elsewhere. + * + * This function visits and marks right branch edges first. + * Edges are numbered with increasingly negative values because we share the + * offset field which gets positive values when nodes are written. + * A branch edge also remembers the first number for any of its edges. + * + * When a further-left branch edge has a number in the range of the rightmost + * edge's numbers, then it will be written as part of the required right edge + * and we can avoid writing it first. + * + * After root.markRightEdgesFirst(-1) the offsets of all nodes are negative + * edge numbers. + * + * @param edgeNumber The first edge number for this node and its sub-nodes. + * @return An edge number that is at least the maximum-negative + * of the input edge number and the numbers of this node and all of its sub-nodes. + */ + virtual int32_t markRightEdgesFirst(int32_t edgeNumber); + // write() must set the offset to a positive value. + virtual void write(StringTrieBuilder &builder) = 0; + // See markRightEdgesFirst. + inline void writeUnlessInsideRightEdge(int32_t firstRight, int32_t lastRight, + StringTrieBuilder &builder) { + // Note: Edge numbers are negative, lastRight<=firstRight. + // If offset>0 then this node and its sub-nodes have been written already + // and we need not write them again. + // If this node is part of the unwritten right branch edge, + // then we wait until that is written. + if(offset<0 && (offsetA symbol table maintains two kinds of mappings. The first is + * between symbolic names and their values. For example, if the + * variable with the name "start" is set to the value "alpha" + * (perhaps, though not necessarily, through an expression such as + * "$start=alpha"), then the call lookup("start") will return the + * char[] array ['a', 'l', 'p', 'h', 'a']. + * + *

The second kind of mapping is between character values and + * UnicodeMatcher objects. This is used by RuleBasedTransliterator, + * which uses characters in the private use area to represent objects + * such as UnicodeSets. If U+E015 is mapped to the UnicodeSet [a-z], + * then lookupMatcher(0xE015) will return the UnicodeSet [a-z]. + * + *

Finally, a symbol table defines parsing behavior for symbolic + * names. All symbolic names start with the SYMBOL_REF character. + * When a parser encounters this character, it calls parseReference() + * with the position immediately following the SYMBOL_REF. The symbol + * table parses the name, if there is one, and returns it. + * + * @stable ICU 2.8 + */ +class U_COMMON_API SymbolTable /* not : public UObject because this is an interface/mixin class */ { +public: + + /** + * The character preceding a symbol reference name. + * @stable ICU 2.8 + */ + enum { SYMBOL_REF = 0x0024 /*$*/ }; + + /** + * Destructor. + * @stable ICU 2.8 + */ + virtual ~SymbolTable(); + + /** + * Lookup the characters associated with this string and return it. + * Return NULL if no such name exists. The resultant + * string may have length zero. + * @param s the symbolic name to lookup + * @return a string containing the name's value, or NULL if + * there is no mapping for s. + * @stable ICU 2.8 + */ + virtual const UnicodeString* lookup(const UnicodeString& s) const = 0; + + /** + * Lookup the UnicodeMatcher associated with the given character, and + * return it. Return NULL if not found. + * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive. + * @return the UnicodeMatcher object represented by the given + * character, or NULL if there is no mapping for ch. + * @stable ICU 2.8 + */ + virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const = 0; + + /** + * Parse a symbol reference name from the given string, starting + * at the given position. If no valid symbol reference name is + * found, return the empty string and leave pos unchanged. That is, if the + * character at pos cannot start a name, or if pos is at or after + * text.length(), then return an empty string. This indicates an + * isolated SYMBOL_REF character. + * @param text the text to parse for the name + * @param pos on entry, the index of the first character to parse. + * This is the character following the SYMBOL_REF character. On + * exit, the index after the last parsed character. If the parse + * failed, pos is unchanged on exit. + * @param limit the index after the last character to be parsed. + * @return the parsed name, or an empty string if there is no + * valid symbolic name at the given position. + * @stable ICU 2.8 + */ + virtual UnicodeString parseReference(const UnicodeString& text, + ParsePosition& pos, int32_t limit) const = 0; +}; +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ubidi.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ubidi.h new file mode 100644 index 0000000000000000000000000000000000000000..63d0e45cb7f3c535eb37f2b46ab809ddba9aab09 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ubidi.h @@ -0,0 +1,2210 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ubidi.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999jul27 +* created by: Markus W. Scherer, updated by Matitiahu Allouche +*/ + +#ifndef UBIDI_H +#define UBIDI_H + +#include "unicode/utypes.h" +#include "unicode/uchar.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + *\file + * \brief C API: Bidi algorithm + * + *

Bidi algorithm for ICU

+ * + * This is an implementation of the Unicode Bidirectional Algorithm. + * The algorithm is defined in the + * Unicode Standard Annex #9.

+ * + * Note: Libraries that perform a bidirectional algorithm and + * reorder strings accordingly are sometimes called "Storage Layout Engines". + * ICU's Bidi and shaping (u_shapeArabic()) APIs can be used at the core of such + * "Storage Layout Engines". + * + *

General remarks about the API:

+ * + * In functions with an error code parameter, + * the pErrorCode pointer must be valid + * and the value that it points to must not indicate a failure before + * the function call. Otherwise, the function returns immediately. + * After the function call, the value indicates success or failure.

+ * + * The "limit" of a sequence of characters is the position just after their + * last character, i.e., one more than that position.

+ * + * Some of the API functions provide access to "runs". + * Such a "run" is defined as a sequence of characters + * that are at the same embedding level + * after performing the Bidi algorithm.

+ * + * @author Markus W. Scherer + * @version 1.0 + * + * + *

Sample code for the ICU Bidi API

+ * + *
Rendering a paragraph with the ICU Bidi API
+ * + * This is (hypothetical) sample code that illustrates + * how the ICU Bidi API could be used to render a paragraph of text. + * Rendering code depends highly on the graphics system, + * therefore this sample code must make a lot of assumptions, + * which may or may not match any existing graphics system's properties. + * + *

The basic assumptions are:

+ *
    + *
  • Rendering is done from left to right on a horizontal line.
  • + *
  • A run of single-style, unidirectional text can be rendered at once.
  • + *
  • Such a run of text is passed to the graphics system with + * characters (code units) in logical order.
  • + *
  • The line-breaking algorithm is very complicated + * and Locale-dependent - + * and therefore its implementation omitted from this sample code.
  • + *
+ * + *
+ * \code
+ *#include "unicode/ubidi.h"
+ *
+ *typedef enum {
+ *     styleNormal=0, styleSelected=1,
+ *     styleBold=2, styleItalics=4,
+ *     styleSuper=8, styleSub=16
+ *} Style;
+ *
+ *typedef struct { int32_t limit; Style style; } StyleRun;
+ *
+ *int getTextWidth(const UChar *text, int32_t start, int32_t limit,
+ *                  const StyleRun *styleRuns, int styleRunCount);
+ *
+ * // set *pLimit and *pStyleRunLimit for a line
+ * // from text[start] and from styleRuns[styleRunStart]
+ * // using ubidi_getLogicalRun(para, ...)
+ *void getLineBreak(const UChar *text, int32_t start, int32_t *pLimit,
+ *                  UBiDi *para,
+ *                  const StyleRun *styleRuns, int styleRunStart, int *pStyleRunLimit,
+ *                  int *pLineWidth);
+ *
+ * // render runs on a line sequentially, always from left to right
+ *
+ * // prepare rendering a new line
+ * void startLine(UBiDiDirection textDirection, int lineWidth);
+ *
+ * // render a run of text and advance to the right by the run width
+ * // the text[start..limit-1] is always in logical order
+ * void renderRun(const UChar *text, int32_t start, int32_t limit,
+ *               UBiDiDirection textDirection, Style style);
+ *
+ * // We could compute a cross-product
+ * // from the style runs with the directional runs
+ * // and then reorder it.
+ * // Instead, here we iterate over each run type
+ * // and render the intersections -
+ * // with shortcuts in simple (and common) cases.
+ * // renderParagraph() is the main function.
+ *
+ * // render a directional run with
+ * // (possibly) multiple style runs intersecting with it
+ * void renderDirectionalRun(const UChar *text,
+ *                           int32_t start, int32_t limit,
+ *                           UBiDiDirection direction,
+ *                           const StyleRun *styleRuns, int styleRunCount) {
+ *     int i;
+ *
+ *     // iterate over style runs
+ *     if(direction==UBIDI_LTR) {
+ *         int styleLimit;
+ *
+ *         for(i=0; ilimit) { styleLimit=limit; }
+ *                 renderRun(text, start, styleLimit,
+ *                           direction, styleRun[i].style);
+ *                 if(styleLimit==limit) { break; }
+ *                 start=styleLimit;
+ *             }
+ *         }
+ *     } else {
+ *         int styleStart;
+ *
+ *         for(i=styleRunCount-1; i>=0; --i) {
+ *             if(i>0) {
+ *                 styleStart=styleRun[i-1].limit;
+ *             } else {
+ *                 styleStart=0;
+ *             }
+ *             if(limit>=styleStart) {
+ *                 if(styleStart=length
+ *
+ *         width=getTextWidth(text, 0, length, styleRuns, styleRunCount);
+ *         if(width<=lineWidth) {
+ *             // everything fits onto one line
+ *
+ *            // prepare rendering a new line from either left or right
+ *             startLine(paraLevel, width);
+ *
+ *             renderLine(para, text, 0, length,
+ *                        styleRuns, styleRunCount);
+ *         } else {
+ *             UBiDi *line;
+ *
+ *             // we need to render several lines
+ *             line=ubidi_openSized(length, 0, pErrorCode);
+ *             if(line!=NULL) {
+ *                 int32_t start=0, limit;
+ *                 int styleRunStart=0, styleRunLimit;
+ *
+ *                 for(;;) {
+ *                     limit=length;
+ *                     styleRunLimit=styleRunCount;
+ *                     getLineBreak(text, start, &limit, para,
+ *                                  styleRuns, styleRunStart, &styleRunLimit,
+ *                                 &width);
+ *                     ubidi_setLine(para, start, limit, line, pErrorCode);
+ *                     if(U_SUCCESS(*pErrorCode)) {
+ *                         // prepare rendering a new line
+ *                         // from either left or right
+ *                         startLine(paraLevel, width);
+ *
+ *                         renderLine(line, text, start, limit,
+ *                                    styleRuns+styleRunStart,
+ *                                    styleRunLimit-styleRunStart);
+ *                     }
+ *                     if(limit==length) { break; }
+ *                     start=limit;
+ *                     styleRunStart=styleRunLimit-1;
+ *                     if(start>=styleRuns[styleRunStart].limit) {
+ *                         ++styleRunStart;
+ *                     }
+ *                 }
+ *
+ *                 ubidi_close(line);
+ *             }
+ *        }
+ *    }
+ *
+ *     ubidi_close(para);
+ *}
+ *\endcode
+ * 
+ */ + +/*DOCXX_TAG*/ +/*@{*/ + +/** + * UBiDiLevel is the type of the level values in this + * Bidi implementation. + * It holds an embedding level and indicates the visual direction + * by its bit 0 (even/odd value).

+ * + * It can also hold non-level values for the + * paraLevel and embeddingLevels + * arguments of ubidi_setPara(); there: + *

    + *
  • bit 7 of an embeddingLevels[] + * value indicates whether the using application is + * specifying the level of a character to override whatever the + * Bidi implementation would resolve it to.
  • + *
  • paraLevel can be set to the + * pseudo-level values UBIDI_DEFAULT_LTR + * and UBIDI_DEFAULT_RTL.
  • + *
+ * + * @see ubidi_setPara + * + *

The related constants are not real, valid level values. + * UBIDI_DEFAULT_XXX can be used to specify + * a default for the paragraph level for + * when the ubidi_setPara() function + * shall determine it but there is no + * strongly typed character in the input.

+ * + * Note that the value for UBIDI_DEFAULT_LTR is even + * and the one for UBIDI_DEFAULT_RTL is odd, + * just like with normal LTR and RTL level values - + * these special values are designed that way. Also, the implementation + * assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd. + * + * Note: The numeric values of the related constants will not change: + * They are tied to the use of 7-bit byte values (plus the override bit) + * and of the UBiDiLevel=uint8_t data type in this API. + * + * @see UBIDI_DEFAULT_LTR + * @see UBIDI_DEFAULT_RTL + * @see UBIDI_LEVEL_OVERRIDE + * @see UBIDI_MAX_EXPLICIT_LEVEL + * @stable ICU 2.0 + */ +typedef uint8_t UBiDiLevel; + +/** Paragraph level setting.

+ * + * Constant indicating that the base direction depends on the first strong + * directional character in the text according to the Unicode Bidirectional + * Algorithm. If no strong directional character is present, + * then set the paragraph level to 0 (left-to-right).

+ * + * If this value is used in conjunction with reordering modes + * UBIDI_REORDER_INVERSE_LIKE_DIRECT or + * UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the text to reorder + * is assumed to be visual LTR, and the text after reordering is required + * to be the corresponding logical string with appropriate contextual + * direction. The direction of the result string will be RTL if either + * the righmost or leftmost strong character of the source text is RTL + * or Arabic Letter, the direction will be LTR otherwise.

+ * + * If reordering option UBIDI_OPTION_INSERT_MARKS is set, an RLM may + * be added at the beginning of the result string to ensure round trip + * (that the result string, when reordered back to visual, will produce + * the original source text). + * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT + * @see UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL + * @stable ICU 2.0 + */ +#define UBIDI_DEFAULT_LTR 0xfe + +/** Paragraph level setting.

+ * + * Constant indicating that the base direction depends on the first strong + * directional character in the text according to the Unicode Bidirectional + * Algorithm. If no strong directional character is present, + * then set the paragraph level to 1 (right-to-left).

+ * + * If this value is used in conjunction with reordering modes + * UBIDI_REORDER_INVERSE_LIKE_DIRECT or + * UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the text to reorder + * is assumed to be visual LTR, and the text after reordering is required + * to be the corresponding logical string with appropriate contextual + * direction. The direction of the result string will be RTL if either + * the righmost or leftmost strong character of the source text is RTL + * or Arabic Letter, or if the text contains no strong character; + * the direction will be LTR otherwise.

+ * + * If reordering option UBIDI_OPTION_INSERT_MARKS is set, an RLM may + * be added at the beginning of the result string to ensure round trip + * (that the result string, when reordered back to visual, will produce + * the original source text). + * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT + * @see UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL + * @stable ICU 2.0 + */ +#define UBIDI_DEFAULT_RTL 0xff + +/** + * Maximum explicit embedding level. + * Same as the max_depth value in the + * Unicode Bidirectional Algorithm. + * (The maximum resolved level can be up to UBIDI_MAX_EXPLICIT_LEVEL+1). + * @stable ICU 2.0 + */ +#define UBIDI_MAX_EXPLICIT_LEVEL 125 + +/** Bit flag for level input. + * Overrides directional properties. + * @stable ICU 2.0 + */ +#define UBIDI_LEVEL_OVERRIDE 0x80 + +/** + * Special value which can be returned by the mapping functions when a logical + * index has no corresponding visual index or vice-versa. This may happen + * for the logical-to-visual mapping of a Bidi control when option + * #UBIDI_OPTION_REMOVE_CONTROLS is specified. This can also happen + * for the visual-to-logical mapping of a Bidi mark (LRM or RLM) inserted + * by option #UBIDI_OPTION_INSERT_MARKS. + * @see ubidi_getVisualIndex + * @see ubidi_getVisualMap + * @see ubidi_getLogicalIndex + * @see ubidi_getLogicalMap + * @stable ICU 3.6 + */ +#define UBIDI_MAP_NOWHERE (-1) + +/** + * UBiDiDirection values indicate the text direction. + * @stable ICU 2.0 + */ +enum UBiDiDirection { + /** Left-to-right text. This is a 0 value. + *

    + *
  • As return value for ubidi_getDirection(), it means + * that the source string contains no right-to-left characters, or + * that the source string is empty and the paragraph level is even. + *
  • As return value for ubidi_getBaseDirection(), it + * means that the first strong character of the source string has + * a left-to-right direction. + *
+ * @stable ICU 2.0 + */ + UBIDI_LTR, + /** Right-to-left text. This is a 1 value. + *
    + *
  • As return value for ubidi_getDirection(), it means + * that the source string contains no left-to-right characters, or + * that the source string is empty and the paragraph level is odd. + *
  • As return value for ubidi_getBaseDirection(), it + * means that the first strong character of the source string has + * a right-to-left direction. + *
+ * @stable ICU 2.0 + */ + UBIDI_RTL, + /** Mixed-directional text. + *

As return value for ubidi_getDirection(), it means + * that the source string contains both left-to-right and + * right-to-left characters. + * @stable ICU 2.0 + */ + UBIDI_MIXED, + /** No strongly directional text. + *

As return value for ubidi_getBaseDirection(), it means + * that the source string is missing or empty, or contains neither left-to-right + * nor right-to-left characters. + * @stable ICU 4.6 + */ + UBIDI_NEUTRAL +}; + +/** @stable ICU 2.0 */ +typedef enum UBiDiDirection UBiDiDirection; + +/** + * Forward declaration of the UBiDi structure for the declaration of + * the API functions. Its fields are implementation-specific.

+ * This structure holds information about a paragraph (or multiple paragraphs) + * of text with Bidi-algorithm-related details, or about one line of + * such a paragraph.

+ * Reordering can be done on a line, or on one or more paragraphs which are + * then interpreted each as one single line. + * @stable ICU 2.0 + */ +struct UBiDi; + +/** @stable ICU 2.0 */ +typedef struct UBiDi UBiDi; + +/** + * Allocate a UBiDi structure. + * Such an object is initially empty. It is assigned + * the Bidi properties of a piece of text containing one or more paragraphs + * by ubidi_setPara() + * or the Bidi properties of a line within a paragraph by + * ubidi_setLine().

+ * This object can be reused for as long as it is not deallocated + * by calling ubidi_close().

+ * ubidi_setPara() and ubidi_setLine() will allocate + * additional memory for internal structures as necessary. + * + * @return An empty UBiDi object. + * @stable ICU 2.0 + */ +U_CAPI UBiDi * U_EXPORT2 +ubidi_open(void); + +/** + * Allocate a UBiDi structure with preallocated memory + * for internal structures. + * This function provides a UBiDi object like ubidi_open() + * with no arguments, but it also preallocates memory for internal structures + * according to the sizings supplied by the caller.

+ * Subsequent functions will not allocate any more memory, and are thus + * guaranteed not to fail because of lack of memory.

+ * The preallocation can be limited to some of the internal memory + * by setting some values to 0 here. That means that if, e.g., + * maxRunCount cannot be reasonably predetermined and should not + * be set to maxLength (the only failproof value) to avoid + * wasting memory, then maxRunCount could be set to 0 here + * and the internal structures that are associated with it will be allocated + * on demand, just like with ubidi_open(). + * + * @param maxLength is the maximum text or line length that internal memory + * will be preallocated for. An attempt to associate this object with a + * longer text will fail, unless this value is 0, which leaves the allocation + * up to the implementation. + * + * @param maxRunCount is the maximum anticipated number of same-level runs + * that internal memory will be preallocated for. An attempt to access + * visual runs on an object that was not preallocated for as many runs + * as the text was actually resolved to will fail, + * unless this value is 0, which leaves the allocation up to the implementation.

+ * The number of runs depends on the actual text and maybe anywhere between + * 1 and maxLength. It is typically small. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return An empty UBiDi object with preallocated memory. + * @stable ICU 2.0 + */ +U_CAPI UBiDi * U_EXPORT2 +ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode); + +/** + * ubidi_close() must be called to free the memory + * associated with a UBiDi object.

+ * + * Important: + * A parent UBiDi object must not be destroyed or reused if + * it still has children. + * If a UBiDi object has become the child + * of another one (its parent) by calling + * ubidi_setLine(), then the child object must + * be destroyed (closed) or reused (by calling + * ubidi_setPara() or ubidi_setLine()) + * before the parent object. + * + * @param pBiDi is a UBiDi object. + * + * @see ubidi_setPara + * @see ubidi_setLine + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_close(UBiDi *pBiDi); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUBiDiPointer + * "Smart pointer" class, closes a UBiDi via ubidi_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiPointer, UBiDi, ubidi_close); + +U_NAMESPACE_END + +#endif + +/** + * Modify the operation of the Bidi algorithm such that it + * approximates an "inverse Bidi" algorithm. This function + * must be called before ubidi_setPara(). + * + *

The normal operation of the Bidi algorithm as described + * in the Unicode Technical Report is to take text stored in logical + * (keyboard, typing) order and to determine the reordering of it for visual + * rendering. + * Some legacy systems store text in visual order, and for operations + * with standard, Unicode-based algorithms, the text needs to be transformed + * to logical order. This is effectively the inverse algorithm of the + * described Bidi algorithm. Note that there is no standard algorithm for + * this "inverse Bidi" and that the current implementation provides only an + * approximation of "inverse Bidi".

+ * + *

With isInverse set to true, + * this function changes the behavior of some of the subsequent functions + * in a way that they can be used for the inverse Bidi algorithm. + * Specifically, runs of text with numeric characters will be treated in a + * special way and may need to be surrounded with LRM characters when they are + * written in reordered sequence.

+ * + *

Output runs should be retrieved using ubidi_getVisualRun(). + * Since the actual input for "inverse Bidi" is visually ordered text and + * ubidi_getVisualRun() gets the reordered runs, these are actually + * the runs of the logically ordered output.

+ * + *

Calling this function with argument isInverse set to + * true is equivalent to calling + * ubidi_setReorderingMode with argument + * reorderingMode + * set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L.
+ * Calling this function with argument isInverse set to + * false is equivalent to calling + * ubidi_setReorderingMode with argument + * reorderingMode + * set to #UBIDI_REORDER_DEFAULT. + * + * @param pBiDi is a UBiDi object. + * + * @param isInverse specifies "forward" or "inverse" Bidi operation. + * + * @see ubidi_setPara + * @see ubidi_writeReordered + * @see ubidi_setReorderingMode + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_setInverse(UBiDi *pBiDi, UBool isInverse); + +/** + * Is this Bidi object set to perform the inverse Bidi algorithm? + *

Note: calling this function after setting the reordering mode with + * ubidi_setReorderingMode will return true if the + * reordering mode was set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L, + * false for all other values.

+ * + * @param pBiDi is a UBiDi object. + * @return true if the Bidi object is set to perform the inverse Bidi algorithm + * by handling numbers as L. + * + * @see ubidi_setInverse + * @see ubidi_setReorderingMode + * @stable ICU 2.0 + */ + +U_CAPI UBool U_EXPORT2 +ubidi_isInverse(UBiDi *pBiDi); + +/** + * Specify whether block separators must be allocated level zero, + * so that successive paragraphs will progress from left to right. + * This function must be called before ubidi_setPara(). + * Paragraph separators (B) may appear in the text. Setting them to level zero + * means that all paragraph separators (including one possibly appearing + * in the last text position) are kept in the reordered text after the text + * that they follow in the source text. + * When this feature is not enabled, a paragraph separator at the last + * position of the text before reordering will go to the first position + * of the reordered text when the paragraph level is odd. + * + * @param pBiDi is a UBiDi object. + * + * @param orderParagraphsLTR specifies whether paragraph separators (B) must + * receive level 0, so that successive paragraphs progress from left to right. + * + * @see ubidi_setPara + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR); + +/** + * Is this Bidi object set to allocate level 0 to block separators so that + * successive paragraphs progress from left to right? + * + * @param pBiDi is a UBiDi object. + * @return true if the Bidi object is set to allocate level 0 to block + * separators. + * + * @see ubidi_orderParagraphsLTR + * @stable ICU 3.4 + */ +U_CAPI UBool U_EXPORT2 +ubidi_isOrderParagraphsLTR(UBiDi *pBiDi); + +/** + * UBiDiReorderingMode values indicate which variant of the Bidi + * algorithm to use. + * + * @see ubidi_setReorderingMode + * @stable ICU 3.6 + */ +typedef enum UBiDiReorderingMode { + /** Regular Logical to Visual Bidi algorithm according to Unicode. + * This is a 0 value. + * @stable ICU 3.6 */ + UBIDI_REORDER_DEFAULT = 0, + /** Logical to Visual algorithm which handles numbers in a way which + * mimics the behavior of Windows XP. + * @stable ICU 3.6 */ + UBIDI_REORDER_NUMBERS_SPECIAL, + /** Logical to Visual algorithm grouping numbers with adjacent R characters + * (reversible algorithm). + * @stable ICU 3.6 */ + UBIDI_REORDER_GROUP_NUMBERS_WITH_R, + /** Reorder runs only to transform a Logical LTR string to the Logical RTL + * string with the same display, or vice-versa.
+ * If this mode is set together with option + * #UBIDI_OPTION_INSERT_MARKS, some Bidi controls in the source + * text may be removed and other controls may be added to produce the + * minimum combination which has the required display. + * @stable ICU 3.6 */ + UBIDI_REORDER_RUNS_ONLY, + /** Visual to Logical algorithm which handles numbers like L + * (same algorithm as selected by ubidi_setInverse(true). + * @see ubidi_setInverse + * @stable ICU 3.6 */ + UBIDI_REORDER_INVERSE_NUMBERS_AS_L, + /** Visual to Logical algorithm equivalent to the regular Logical to Visual + * algorithm. + * @stable ICU 3.6 */ + UBIDI_REORDER_INVERSE_LIKE_DIRECT, + /** Inverse Bidi (Visual to Logical) algorithm for the + * UBIDI_REORDER_NUMBERS_SPECIAL Bidi algorithm. + * @stable ICU 3.6 */ + UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, +#ifndef U_HIDE_DEPRECATED_API + /** + * Number of values for reordering mode. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UBIDI_REORDER_COUNT +#endif // U_HIDE_DEPRECATED_API +} UBiDiReorderingMode; + +/** + * Modify the operation of the Bidi algorithm such that it implements some + * variant to the basic Bidi algorithm or approximates an "inverse Bidi" + * algorithm, depending on different values of the "reordering mode". + * This function must be called before ubidi_setPara(), and stays + * in effect until called again with a different argument. + * + *

The normal operation of the Bidi algorithm as described + * in the Unicode Standard Annex #9 is to take text stored in logical + * (keyboard, typing) order and to determine how to reorder it for visual + * rendering.

+ * + *

With the reordering mode set to a value other than + * #UBIDI_REORDER_DEFAULT, this function changes the behavior of + * some of the subsequent functions in a way such that they implement an + * inverse Bidi algorithm or some other algorithm variants.

+ * + *

Some legacy systems store text in visual order, and for operations + * with standard, Unicode-based algorithms, the text needs to be transformed + * into logical order. This is effectively the inverse algorithm of the + * described Bidi algorithm. Note that there is no standard algorithm for + * this "inverse Bidi", so a number of variants are implemented here.

+ * + *

In other cases, it may be desirable to emulate some variant of the + * Logical to Visual algorithm (e.g. one used in MS Windows), or perform a + * Logical to Logical transformation.

+ * + *
    + *
  • When the reordering mode is set to #UBIDI_REORDER_DEFAULT, + * the standard Bidi Logical to Visual algorithm is applied.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_NUMBERS_SPECIAL, + * the algorithm used to perform Bidi transformations when calling + * ubidi_setPara should approximate the algorithm used in + * Microsoft Windows XP rather than strictly conform to the Unicode Bidi + * algorithm. + *
    + * The differences between the basic algorithm and the algorithm addressed + * by this option are as follows: + *
      + *
    • Within text at an even embedding level, the sequence "123AB" + * (where AB represent R or AL letters) is transformed to "123BA" by the + * Unicode algorithm and to "BA123" by the Windows algorithm.
    • + *
    • Arabic-Indic numbers (AN) are handled by the Windows algorithm just + * like regular numbers (EN).
    • + *
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_GROUP_NUMBERS_WITH_R, + * numbers located between LTR text and RTL text are associated with the RTL + * text. For instance, an LTR paragraph with content "abc 123 DEF" (where + * upper case letters represent RTL characters) will be transformed to + * "abc FED 123" (and not "abc 123 FED"), "DEF 123 abc" will be transformed + * to "123 FED abc" and "123 FED abc" will be transformed to "DEF 123 abc". + * This makes the algorithm reversible and makes it useful when round trip + * (from visual to logical and back to visual) must be achieved without + * adding LRM characters. However, this is a variation from the standard + * Unicode Bidi algorithm.
    + * The source text should not contain Bidi control characters other than LRM + * or RLM.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_RUNS_ONLY, + * a "Logical to Logical" transformation must be performed: + *
      + *
    • If the default text level of the source text (argument paraLevel + * in ubidi_setPara) is even, the source text will be handled as + * LTR logical text and will be transformed to the RTL logical text which has + * the same LTR visual display.
    • + *
    • If the default level of the source text is odd, the source text + * will be handled as RTL logical text and will be transformed to the + * LTR logical text which has the same LTR visual display.
    • + *
    + * This mode may be needed when logical text which is basically Arabic or + * Hebrew, with possible included numbers or phrases in English, has to be + * displayed as if it had an even embedding level (this can happen if the + * displaying application treats all text as if it was basically LTR). + *
    + * This mode may also be needed in the reverse case, when logical text which is + * basically English, with possible included phrases in Arabic or Hebrew, has to + * be displayed as if it had an odd embedding level. + *
    + * Both cases could be handled by adding LRE or RLE at the head of the text, + * if the display subsystem supports these formatting controls. If it does not, + * the problem may be handled by transforming the source text in this mode + * before displaying it, so that it will be displayed properly.
    + * The source text should not contain Bidi control characters other than LRM + * or RLM.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L, an "inverse Bidi" algorithm + * is applied. + * Runs of text with numeric characters will be treated like LTR letters and + * may need to be surrounded with LRM characters when they are written in + * reordered sequence (the option #UBIDI_INSERT_LRM_FOR_NUMERIC can + * be used with function ubidi_writeReordered to this end. This + * mode is equivalent to calling ubidi_setInverse() with + * argument isInverse set to true.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_INVERSE_LIKE_DIRECT, the "direct" Logical to Visual + * Bidi algorithm is used as an approximation of an "inverse Bidi" algorithm. + * This mode is similar to mode #UBIDI_REORDER_INVERSE_NUMBERS_AS_L + * but is closer to the regular Bidi algorithm. + *
    + * For example, an LTR paragraph with the content "FED 123 456 CBA" (where + * upper case represents RTL characters) will be transformed to + * "ABC 456 123 DEF", as opposed to "DEF 123 456 ABC" + * with mode UBIDI_REORDER_INVERSE_NUMBERS_AS_L.
    + * When used in conjunction with option + * #UBIDI_OPTION_INSERT_MARKS, this mode generally + * adds Bidi marks to the output significantly more sparingly than mode + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L with option + * #UBIDI_INSERT_LRM_FOR_NUMERIC in calls to + * ubidi_writeReordered.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the Logical to Visual + * Bidi algorithm used in Windows XP is used as an approximation of an "inverse Bidi" algorithm. + *
    + * For example, an LTR paragraph with the content "abc FED123" (where + * upper case represents RTL characters) will be transformed to "abc 123DEF."
  • + *
+ * + *

In all the reordering modes specifying an "inverse Bidi" algorithm + * (i.e. those with a name starting with UBIDI_REORDER_INVERSE), + * output runs should be retrieved using + * ubidi_getVisualRun(), and the output text with + * ubidi_writeReordered(). The caller should keep in mind that in + * "inverse Bidi" modes the input is actually visually ordered text and + * reordered output returned by ubidi_getVisualRun() or + * ubidi_writeReordered() are actually runs or character string + * of logically ordered output.
+ * For all the "inverse Bidi" modes, the source text should not contain + * Bidi control characters other than LRM or RLM.

+ * + *

Note that option #UBIDI_OUTPUT_REVERSE of + * ubidi_writeReordered has no useful meaning and should not be + * used in conjunction with any value of the reordering mode specifying + * "inverse Bidi" or with value UBIDI_REORDER_RUNS_ONLY. + * + * @param pBiDi is a UBiDi object. + * @param reorderingMode specifies the required variant of the Bidi algorithm. + * + * @see UBiDiReorderingMode + * @see ubidi_setInverse + * @see ubidi_setPara + * @see ubidi_writeReordered + * @stable ICU 3.6 + */ +U_CAPI void U_EXPORT2 +ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode); + +/** + * What is the requested reordering mode for a given Bidi object? + * + * @param pBiDi is a UBiDi object. + * @return the current reordering mode of the Bidi object + * @see ubidi_setReorderingMode + * @stable ICU 3.6 + */ +U_CAPI UBiDiReorderingMode U_EXPORT2 +ubidi_getReorderingMode(UBiDi *pBiDi); + +/** + * UBiDiReorderingOption values indicate which options are + * specified to affect the Bidi algorithm. + * + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ +typedef enum UBiDiReorderingOption { + /** + * option value for ubidi_setReorderingOptions: + * disable all the options which can be set with this function + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ + UBIDI_OPTION_DEFAULT = 0, + + /** + * option bit for ubidi_setReorderingOptions: + * insert Bidi marks (LRM or RLM) when needed to ensure correct result of + * a reordering to a Logical order + * + *

This option must be set or reset before calling + * ubidi_setPara.

+ * + *

This option is significant only with reordering modes which generate + * a result with Logical order, specifically:

+ *
    + *
  • #UBIDI_REORDER_RUNS_ONLY
  • + *
  • #UBIDI_REORDER_INVERSE_NUMBERS_AS_L
  • + *
  • #UBIDI_REORDER_INVERSE_LIKE_DIRECT
  • + *
  • #UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL
  • + *
+ * + *

If this option is set in conjunction with reordering mode + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L or with calling + * ubidi_setInverse(true), it implies + * option #UBIDI_INSERT_LRM_FOR_NUMERIC + * in calls to function ubidi_writeReordered().

+ * + *

For other reordering modes, a minimum number of LRM or RLM characters + * will be added to the source text after reordering it so as to ensure + * round trip, i.e. when applying the inverse reordering mode on the + * resulting logical text with removal of Bidi marks + * (option #UBIDI_OPTION_REMOVE_CONTROLS set before calling + * ubidi_setPara() or option #UBIDI_REMOVE_BIDI_CONTROLS + * in ubidi_writeReordered), the result will be identical to the + * source text in the first transformation. + * + *

This option will be ignored if specified together with option + * #UBIDI_OPTION_REMOVE_CONTROLS. It inhibits option + * UBIDI_REMOVE_BIDI_CONTROLS in calls to function + * ubidi_writeReordered() and it implies option + * #UBIDI_INSERT_LRM_FOR_NUMERIC in calls to function + * ubidi_writeReordered() if the reordering mode is + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L.

+ * + * @see ubidi_setReorderingMode + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ + UBIDI_OPTION_INSERT_MARKS = 1, + + /** + * option bit for ubidi_setReorderingOptions: + * remove Bidi control characters + * + *

This option must be set or reset before calling + * ubidi_setPara.

+ * + *

This option nullifies option #UBIDI_OPTION_INSERT_MARKS. + * It inhibits option #UBIDI_INSERT_LRM_FOR_NUMERIC in calls + * to function ubidi_writeReordered() and it implies option + * #UBIDI_REMOVE_BIDI_CONTROLS in calls to that function.

+ * + * @see ubidi_setReorderingMode + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ + UBIDI_OPTION_REMOVE_CONTROLS = 2, + + /** + * option bit for ubidi_setReorderingOptions: + * process the output as part of a stream to be continued + * + *

This option must be set or reset before calling + * ubidi_setPara.

+ * + *

This option specifies that the caller is interested in processing large + * text object in parts. + * The results of the successive calls are expected to be concatenated by the + * caller. Only the call for the last part will have this option bit off.

+ * + *

When this option bit is on, ubidi_setPara() may process + * less than the full source text in order to truncate the text at a meaningful + * boundary. The caller should call ubidi_getProcessedLength() + * immediately after calling ubidi_setPara() in order to + * determine how much of the source text has been processed. + * Source text beyond that length should be resubmitted in following calls to + * ubidi_setPara. The processed length may be less than + * the length of the source text if a character preceding the last character of + * the source text constitutes a reasonable boundary (like a block separator) + * for text to be continued.
+ * If the last character of the source text constitutes a reasonable + * boundary, the whole text will be processed at once.
+ * If nowhere in the source text there exists + * such a reasonable boundary, the processed length will be zero.
+ * The caller should check for such an occurrence and do one of the following: + *

  • submit a larger amount of text with a better chance to include + * a reasonable boundary.
  • + *
  • resubmit the same text after turning off option + * UBIDI_OPTION_STREAMING.
+ * In all cases, this option should be turned off before processing the last + * part of the text.

+ * + *

When the UBIDI_OPTION_STREAMING option is used, + * it is recommended to call ubidi_orderParagraphsLTR() with + * argument orderParagraphsLTR set to true before + * calling ubidi_setPara so that later paragraphs may be + * concatenated to previous paragraphs on the right.

+ * + * @see ubidi_setReorderingMode + * @see ubidi_setReorderingOptions + * @see ubidi_getProcessedLength + * @see ubidi_orderParagraphsLTR + * @stable ICU 3.6 + */ + UBIDI_OPTION_STREAMING = 4 +} UBiDiReorderingOption; + +/** + * Specify which of the reordering options + * should be applied during Bidi transformations. + * + * @param pBiDi is a UBiDi object. + * @param reorderingOptions is a combination of zero or more of the following + * options: + * #UBIDI_OPTION_DEFAULT, #UBIDI_OPTION_INSERT_MARKS, + * #UBIDI_OPTION_REMOVE_CONTROLS, #UBIDI_OPTION_STREAMING. + * + * @see ubidi_getReorderingOptions + * @stable ICU 3.6 + */ +U_CAPI void U_EXPORT2 +ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions); + +/** + * What are the reordering options applied to a given Bidi object? + * + * @param pBiDi is a UBiDi object. + * @return the current reordering options of the Bidi object + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ +U_CAPI uint32_t U_EXPORT2 +ubidi_getReorderingOptions(UBiDi *pBiDi); + +/** + * Set the context before a call to ubidi_setPara().

+ * + * ubidi_setPara() computes the left-right directionality for a given piece + * of text which is supplied as one of its arguments. Sometimes this piece + * of text (the "main text") should be considered in context, because text + * appearing before ("prologue") and/or after ("epilogue") the main text + * may affect the result of this computation.

+ * + * This function specifies the prologue and/or the epilogue for the next + * call to ubidi_setPara(). The characters specified as prologue and + * epilogue should not be modified by the calling program until the call + * to ubidi_setPara() has returned. If successive calls to ubidi_setPara() + * all need specification of a context, ubidi_setContext() must be called + * before each call to ubidi_setPara(). In other words, a context is not + * "remembered" after the following successful call to ubidi_setPara().

+ * + * If a call to ubidi_setPara() specifies UBIDI_DEFAULT_LTR or + * UBIDI_DEFAULT_RTL as paraLevel and is preceded by a call to + * ubidi_setContext() which specifies a prologue, the paragraph level will + * be computed taking in consideration the text in the prologue.

+ * + * When ubidi_setPara() is called without a previous call to + * ubidi_setContext, the main text is handled as if preceded and followed + * by strong directional characters at the current paragraph level. + * Calling ubidi_setContext() with specification of a prologue will change + * this behavior by handling the main text as if preceded by the last + * strong character appearing in the prologue, if any. + * Calling ubidi_setContext() with specification of an epilogue will change + * the behavior of ubidi_setPara() by handling the main text as if followed + * by the first strong character or digit appearing in the epilogue, if any.

+ * + * Note 1: if ubidi_setContext is called repeatedly without + * calling ubidi_setPara, the earlier calls have no effect, + * only the last call will be remembered for the next call to + * ubidi_setPara.

+ * + * Note 2: calling ubidi_setContext(pBiDi, NULL, 0, NULL, 0, &errorCode) + * cancels any previous setting of non-empty prologue or epilogue. + * The next call to ubidi_setPara() will process no + * prologue or epilogue.

+ * + * Note 3: users must be aware that even after setting the context + * before a call to ubidi_setPara() to perform e.g. a logical to visual + * transformation, the resulting string may not be identical to what it + * would have been if all the text, including prologue and epilogue, had + * been processed together.
+ * Example (upper case letters represent RTL characters):
+ *   prologue = "abc DE"
+ *   epilogue = none
+ *   main text = "FGH xyz"
+ *   paraLevel = UBIDI_LTR
+ *   display without prologue = "HGF xyz" + * ("HGF" is adjacent to "xyz")
+ *   display with prologue = "abc HGFED xyz" + * ("HGF" is not adjacent to "xyz")
+ * + * @param pBiDi is a paragraph UBiDi object. + * + * @param prologue is a pointer to the text which precedes the text that + * will be specified in a coming call to ubidi_setPara(). + * If there is no prologue to consider, then proLength + * must be zero and this pointer can be NULL. + * + * @param proLength is the length of the prologue; if proLength==-1 + * then the prologue must be zero-terminated. + * Otherwise proLength must be >= 0. If proLength==0, it means + * that there is no prologue to consider. + * + * @param epilogue is a pointer to the text which follows the text that + * will be specified in a coming call to ubidi_setPara(). + * If there is no epilogue to consider, then epiLength + * must be zero and this pointer can be NULL. + * + * @param epiLength is the length of the epilogue; if epiLength==-1 + * then the epilogue must be zero-terminated. + * Otherwise epiLength must be >= 0. If epiLength==0, it means + * that there is no epilogue to consider. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_setPara + * @stable ICU 4.8 + */ +U_CAPI void U_EXPORT2 +ubidi_setContext(UBiDi *pBiDi, + const UChar *prologue, int32_t proLength, + const UChar *epilogue, int32_t epiLength, + UErrorCode *pErrorCode); + +/** + * Perform the Unicode Bidi algorithm. It is defined in the + * Unicode Standard Annex #9, + * version 13, + * also described in The Unicode Standard, Version 4.0 .

+ * + * This function takes a piece of plain text containing one or more paragraphs, + * with or without externally specified embedding levels from styled + * text and computes the left-right-directionality of each character.

+ * + * If the entire text is all of the same directionality, then + * the function may not perform all the steps described by the algorithm, + * i.e., some levels may not be the same as if all steps were performed. + * This is not relevant for unidirectional text.
+ * For example, in pure LTR text with numbers the numbers would get + * a resolved level of 2 higher than the surrounding text according to + * the algorithm. This implementation may set all resolved levels to + * the same value in such a case.

+ * + * The text can be composed of multiple paragraphs. Occurrence of a block + * separator in the text terminates a paragraph, and whatever comes next starts + * a new paragraph. The exception to this rule is when a Carriage Return (CR) + * is followed by a Line Feed (LF). Both CR and LF are block separators, but + * in that case, the pair of characters is considered as terminating the + * preceding paragraph, and a new paragraph will be started by a character + * coming after the LF. + * + * @param pBiDi A UBiDi object allocated with ubidi_open() + * which will be set to contain the reordering information, + * especially the resolved levels for all the characters in text. + * + * @param text is a pointer to the text that the Bidi algorithm will be performed on. + * This pointer is stored in the UBiDi object and can be retrieved + * with ubidi_getText().
+ * Note: the text must be (at least) length long. + * + * @param length is the length of the text; if length==-1 then + * the text must be zero-terminated. + * + * @param paraLevel specifies the default level for the text; + * it is typically 0 (LTR) or 1 (RTL). + * If the function shall determine the paragraph level from the text, + * then paraLevel can be set to + * either #UBIDI_DEFAULT_LTR + * or #UBIDI_DEFAULT_RTL; if the text contains multiple + * paragraphs, the paragraph level shall be determined separately for + * each paragraph; if a paragraph does not include any strongly typed + * character, then the desired default is used (0 for LTR or 1 for RTL). + * Any other value between 0 and #UBIDI_MAX_EXPLICIT_LEVEL + * is also valid, with odd levels indicating RTL. + * + * @param embeddingLevels (in) may be used to preset the embedding and override levels, + * ignoring characters like LRE and PDF in the text. + * A level overrides the directional property of its corresponding + * (same index) character if the level has the + * #UBIDI_LEVEL_OVERRIDE bit set.

+ * Aside from that bit, it must be + * paraLevel<=embeddingLevels[]<=UBIDI_MAX_EXPLICIT_LEVEL, + * except that level 0 is always allowed. + * Level 0 for a paragraph separator prevents reordering of paragraphs; + * this only works reliably if #UBIDI_LEVEL_OVERRIDE + * is also set for paragraph separators. + * Level 0 for other characters is treated as a wildcard + * and is lifted up to the resolved level of the surrounding paragraph.

+ * Caution: A copy of this pointer, not of the levels, + * will be stored in the UBiDi object; + * the embeddingLevels array must not be + * deallocated before the UBiDi structure is destroyed or reused, + * and the embeddingLevels + * should not be modified to avoid unexpected results on subsequent Bidi operations. + * However, the ubidi_setPara() and + * ubidi_setLine() functions may modify some or all of the levels.

+ * After the UBiDi object is reused or destroyed, the caller + * must take care of the deallocation of the embeddingLevels array.

+ * Note: the embeddingLevels array must be + * at least length long. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pErrorCode must be a valid pointer to an error code value. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, + UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels, + UErrorCode *pErrorCode); + +/** + * ubidi_setLine() sets a UBiDi to + * contain the reordering information, especially the resolved levels, + * for all the characters in a line of text. This line of text is + * specified by referring to a UBiDi object representing + * this information for a piece of text containing one or more paragraphs, + * and by specifying a range of indexes in this text.

+ * In the new line object, the indexes will range from 0 to limit-start-1.

+ * + * This is used after calling ubidi_setPara() + * for a piece of text, and after line-breaking on that text. + * It is not necessary if each paragraph is treated as a single line.

+ * + * After line-breaking, rules (L1) and (L2) for the treatment of + * trailing WS and for reordering are performed on + * a UBiDi object that represents a line.

+ * + * Important: pLineBiDi shares data with + * pParaBiDi. + * You must destroy or reuse pLineBiDi before pParaBiDi. + * In other words, you must destroy or reuse the UBiDi object for a line + * before the object for its parent paragraph.

+ * + * The text pointer that was stored in pParaBiDi is also copied, + * and start is added to it so that it points to the beginning of the + * line for this object. + * + * @param pParaBiDi is the parent paragraph object. It must have been set + * by a successful call to ubidi_setPara. + * + * @param start is the line's first index into the text. + * + * @param limit is just behind the line's last index into the text + * (its last index +1).
+ * It must be 0<=startcontaining paragraph limit. + * If the specified line crosses a paragraph boundary, the function + * will terminate with error code U_ILLEGAL_ARGUMENT_ERROR. + * + * @param pLineBiDi is the object that will now represent a line of the text. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_setPara + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_setLine(const UBiDi *pParaBiDi, + int32_t start, int32_t limit, + UBiDi *pLineBiDi, + UErrorCode *pErrorCode); + +/** + * Get the directionality of the text. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return a value of UBIDI_LTR, UBIDI_RTL + * or UBIDI_MIXED + * that indicates if the entire text + * represented by this object is unidirectional, + * and which direction, or if it is mixed-directional. + * Note - The value UBIDI_NEUTRAL is never returned from this method. + * + * @see UBiDiDirection + * @stable ICU 2.0 + */ +U_CAPI UBiDiDirection U_EXPORT2 +ubidi_getDirection(const UBiDi *pBiDi); + +/** + * Gets the base direction of the text provided according + * to the Unicode Bidirectional Algorithm. The base direction + * is derived from the first character in the string with bidirectional + * character type L, R, or AL. If the first such character has type L, + * UBIDI_LTR is returned. If the first such character has + * type R or AL, UBIDI_RTL is returned. If the string does + * not contain any character of these types, then + * UBIDI_NEUTRAL is returned. + * + * This is a lightweight function for use when only the base direction + * is needed and no further bidi processing of the text is needed. + * + * @param text is a pointer to the text whose base + * direction is needed. + * Note: the text must be (at least) @c length long. + * + * @param length is the length of the text; + * if length==-1 then the text + * must be zero-terminated. + * + * @return UBIDI_LTR, UBIDI_RTL, + * UBIDI_NEUTRAL + * + * @see UBiDiDirection + * @stable ICU 4.6 + */ +U_CAPI UBiDiDirection U_EXPORT2 +ubidi_getBaseDirection(const UChar *text, int32_t length ); + +/** + * Get the pointer to the text. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return The pointer to the text that the UBiDi object was created for. + * + * @see ubidi_setPara + * @see ubidi_setLine + * @stable ICU 2.0 + */ +U_CAPI const UChar * U_EXPORT2 +ubidi_getText(const UBiDi *pBiDi); + +/** + * Get the length of the text. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return The length of the text that the UBiDi object was created for. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_getLength(const UBiDi *pBiDi); + +/** + * Get the paragraph level of the text. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return The paragraph level. If there are multiple paragraphs, their + * level may vary if the required paraLevel is UBIDI_DEFAULT_LTR or + * UBIDI_DEFAULT_RTL. In that case, the level of the first paragraph + * is returned. + * + * @see UBiDiLevel + * @see ubidi_getParagraph + * @see ubidi_getParagraphByIndex + * @stable ICU 2.0 + */ +U_CAPI UBiDiLevel U_EXPORT2 +ubidi_getParaLevel(const UBiDi *pBiDi); + +/** + * Get the number of paragraphs. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return The number of paragraphs. + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_countParagraphs(UBiDi *pBiDi); + +/** + * Get a paragraph, given a position within the text. + * This function returns information about a paragraph.
+ * Note: if the paragraph index is known, it is more efficient to + * retrieve the paragraph information using ubidi_getParagraphByIndex().

+ * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param charIndex is the index of a character within the text, in the + * range [0..ubidi_getProcessedLength(pBiDi)-1]. + * + * @param pParaStart will receive the index of the first character of the + * paragraph in the text. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pParaLimit will receive the limit of the paragraph. + * The l-value that you point to here may be the + * same expression (variable) as the one for + * charIndex. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pParaLevel will receive the level of the paragraph. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The index of the paragraph containing the specified position. + * + * @see ubidi_getProcessedLength + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart, + int32_t *pParaLimit, UBiDiLevel *pParaLevel, + UErrorCode *pErrorCode); + +/** + * Get a paragraph, given the index of this paragraph. + * + * This function returns information about a paragraph.

+ * + * @param pBiDi is the paragraph UBiDi object. + * + * @param paraIndex is the number of the paragraph, in the + * range [0..ubidi_countParagraphs(pBiDi)-1]. + * + * @param pParaStart will receive the index of the first character of the + * paragraph in the text. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pParaLimit will receive the limit of the paragraph. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pParaLevel will receive the level of the paragraph. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, + int32_t *pParaStart, int32_t *pParaLimit, + UBiDiLevel *pParaLevel, UErrorCode *pErrorCode); + +/** + * Get the level for one character. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param charIndex the index of a character. It must be in the range + * [0..ubidi_getProcessedLength(pBiDi)]. + * + * @return The level for the character at charIndex (0 if charIndex is not + * in the valid range). + * + * @see UBiDiLevel + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_CAPI UBiDiLevel U_EXPORT2 +ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex); + +/** + * Get an array of levels for each character.

+ * + * Note that this function may allocate memory under some + * circumstances, unlike ubidi_getLevelAt(). + * + * @param pBiDi is the paragraph or line UBiDi object, whose + * text length must be strictly positive. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The levels array for the text, + * or NULL if an error occurs. + * + * @see UBiDiLevel + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_CAPI const UBiDiLevel * U_EXPORT2 +ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode); + +/** + * Get a logical run. + * This function returns information about a run and is used + * to retrieve runs in logical order.

+ * This is especially useful for line-breaking on a paragraph. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param logicalPosition is a logical position within the source text. + * + * @param pLogicalLimit will receive the limit of the corresponding run. + * The l-value that you point to here may be the + * same expression (variable) as the one for + * logicalPosition. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pLevel will receive the level of the corresponding run. + * This pointer can be NULL if this + * value is not necessary. + * + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition, + int32_t *pLogicalLimit, UBiDiLevel *pLevel); + +/** + * Get the number of runs. + * This function may invoke the actual reordering on the + * UBiDi object, after ubidi_setPara() + * may have resolved only the levels of the text. Therefore, + * ubidi_countRuns() may have to allocate memory, + * and may fail doing so. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The number of runs. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); + +/** + * Get one run's logical start, length, and directionality, + * which can be 0 for LTR or 1 for RTL. + * In an RTL run, the character at the logical start is + * visually on the right of the displayed run. + * The length is the number of characters in the run.

+ * ubidi_countRuns() should be called + * before the runs are retrieved. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param runIndex is the number of the run in visual order, in the + * range [0..ubidi_countRuns(pBiDi)-1]. + * + * @param pLogicalStart is the first logical character index in the text. + * The pointer may be NULL if this index is not needed. + * + * @param pLength is the number of characters (at least one) in the run. + * The pointer may be NULL if this is not needed. + * + * @return the directionality of the run, + * UBIDI_LTR==0 or UBIDI_RTL==1, + * never UBIDI_MIXED, + * never UBIDI_NEUTRAL. + * + * @see ubidi_countRuns + * + * Example: + *

+ * \code
+ * int32_t i, count=ubidi_countRuns(pBiDi),
+ *         logicalStart, visualIndex=0, length;
+ * for(i=0; i0);
+ *     } else {
+ *         logicalStart+=length;  // logicalLimit
+ *         do { // RTL
+ *             show_char(text[--logicalStart], visualIndex++);
+ *         } while(--length>0);
+ *     }
+ * }
+ *\endcode
+ * 
+ * + * Note that in right-to-left runs, code like this places + * second surrogates before first ones (which is generally a bad idea) + * and combining characters before base characters. + *

+ * Use of ubidi_writeReordered(), optionally with the + * #UBIDI_KEEP_BASE_COMBINING option, can be considered in order + * to avoid these issues. + * @stable ICU 2.0 + */ +U_CAPI UBiDiDirection U_EXPORT2 +ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, + int32_t *pLogicalStart, int32_t *pLength); + +/** + * Get the visual position from a logical text position. + * If such a mapping is used many times on the same + * UBiDi object, then calling + * ubidi_getLogicalMap() is more efficient.

+ * + * The value returned may be #UBIDI_MAP_NOWHERE if there is no + * visual position because the corresponding text character is a Bidi control + * removed from output by the option #UBIDI_OPTION_REMOVE_CONTROLS. + *

+ * When the visual output is altered by using options of + * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, + * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, + * UBIDI_REMOVE_BIDI_CONTROLS, the visual position returned may not + * be correct. It is advised to use, when possible, reordering options + * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. + *

+ * Note that in right-to-left runs, this mapping places + * second surrogates before first ones (which is generally a bad idea) + * and combining characters before base characters. + * Use of ubidi_writeReordered(), optionally with the + * #UBIDI_KEEP_BASE_COMBINING option can be considered instead + * of using the mapping, in order to avoid these issues. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param logicalIndex is the index of a character in the text. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The visual position of this character. + * + * @see ubidi_getLogicalMap + * @see ubidi_getLogicalIndex + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode); + +/** + * Get the logical text position from a visual position. + * If such a mapping is used many times on the same + * UBiDi object, then calling + * ubidi_getVisualMap() is more efficient.

+ * + * The value returned may be #UBIDI_MAP_NOWHERE if there is no + * logical position because the corresponding text character is a Bidi mark + * inserted in the output by option #UBIDI_OPTION_INSERT_MARKS. + *

+ * This is the inverse function to ubidi_getVisualIndex(). + *

+ * When the visual output is altered by using options of + * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, + * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, + * UBIDI_REMOVE_BIDI_CONTROLS, the logical position returned may not + * be correct. It is advised to use, when possible, reordering options + * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param visualIndex is the visual position of a character. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The index of this character in the text. + * + * @see ubidi_getVisualMap + * @see ubidi_getVisualIndex + * @see ubidi_getResultLength + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode); + +/** + * Get a logical-to-visual index map (array) for the characters in the UBiDi + * (paragraph or line) object. + *

+ * Some values in the map may be #UBIDI_MAP_NOWHERE if the + * corresponding text characters are Bidi controls removed from the visual + * output by the option #UBIDI_OPTION_REMOVE_CONTROLS. + *

+ * When the visual output is altered by using options of + * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, + * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, + * UBIDI_REMOVE_BIDI_CONTROLS, the visual positions returned may not + * be correct. It is advised to use, when possible, reordering options + * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. + *

+ * Note that in right-to-left runs, this mapping places + * second surrogates before first ones (which is generally a bad idea) + * and combining characters before base characters. + * Use of ubidi_writeReordered(), optionally with the + * #UBIDI_KEEP_BASE_COMBINING option can be considered instead + * of using the mapping, in order to avoid these issues. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param indexMap is a pointer to an array of ubidi_getProcessedLength() + * indexes which will reflect the reordering of the characters. + * If option #UBIDI_OPTION_INSERT_MARKS is set, the number + * of elements allocated in indexMap must be no less than + * ubidi_getResultLength(). + * The array does not need to be initialized.

+ * The index map will result in indexMap[logicalIndex]==visualIndex. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_getVisualMap + * @see ubidi_getVisualIndex + * @see ubidi_getProcessedLength + * @see ubidi_getResultLength + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); + +/** + * Get a visual-to-logical index map (array) for the characters in the UBiDi + * (paragraph or line) object. + *

+ * Some values in the map may be #UBIDI_MAP_NOWHERE if the + * corresponding text characters are Bidi marks inserted in the visual output + * by the option #UBIDI_OPTION_INSERT_MARKS. + *

+ * When the visual output is altered by using options of + * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, + * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, + * UBIDI_REMOVE_BIDI_CONTROLS, the logical positions returned may not + * be correct. It is advised to use, when possible, reordering options + * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param indexMap is a pointer to an array of ubidi_getResultLength() + * indexes which will reflect the reordering of the characters. + * If option #UBIDI_OPTION_REMOVE_CONTROLS is set, the number + * of elements allocated in indexMap must be no less than + * ubidi_getProcessedLength(). + * The array does not need to be initialized.

+ * The index map will result in indexMap[visualIndex]==logicalIndex. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_getLogicalMap + * @see ubidi_getLogicalIndex + * @see ubidi_getProcessedLength + * @see ubidi_getResultLength + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); + +/** + * This is a convenience function that does not use a UBiDi object. + * It is intended to be used for when an application has determined the levels + * of objects (character sequences) and just needs to have them reordered (L2). + * This is equivalent to using ubidi_getLogicalMap() on a + * UBiDi object. + * + * @param levels is an array with length levels that have been determined by + * the application. + * + * @param length is the number of levels in the array, or, semantically, + * the number of objects to be reordered. + * It must be length>0. + * + * @param indexMap is a pointer to an array of length + * indexes which will reflect the reordering of the characters. + * The array does not need to be initialized.

+ * The index map will result in indexMap[logicalIndex]==visualIndex. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); + +/** + * This is a convenience function that does not use a UBiDi object. + * It is intended to be used for when an application has determined the levels + * of objects (character sequences) and just needs to have them reordered (L2). + * This is equivalent to using ubidi_getVisualMap() on a + * UBiDi object. + * + * @param levels is an array with length levels that have been determined by + * the application. + * + * @param length is the number of levels in the array, or, semantically, + * the number of objects to be reordered. + * It must be length>0. + * + * @param indexMap is a pointer to an array of length + * indexes which will reflect the reordering of the characters. + * The array does not need to be initialized.

+ * The index map will result in indexMap[visualIndex]==logicalIndex. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); + +/** + * Invert an index map. + * The index mapping of the first map is inverted and written to + * the second one. + * + * @param srcMap is an array with length elements + * which defines the original mapping from a source array containing + * length elements to a destination array. + * Some elements of the source array may have no mapping in the + * destination array. In that case, their value will be + * the special value UBIDI_MAP_NOWHERE. + * All elements must be >=0 or equal to UBIDI_MAP_NOWHERE. + * Some elements may have a value >= length, if the + * destination array has more elements than the source array. + * There must be no duplicate indexes (two or more elements with the + * same value except UBIDI_MAP_NOWHERE). + * + * @param destMap is an array with a number of elements equal to 1 + the highest + * value in srcMap. + * destMap will be filled with the inverse mapping. + * If element with index i in srcMap has a value k different + * from UBIDI_MAP_NOWHERE, this means that element i of + * the source array maps to element k in the destination array. + * The inverse map will have value i in its k-th element. + * For all elements of the destination array which do not map to + * an element in the source array, the corresponding element in the + * inverse map will have a value equal to UBIDI_MAP_NOWHERE. + * + * @param length is the length of each array. + * @see UBIDI_MAP_NOWHERE + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length); + +/** option flags for ubidi_writeReordered() */ + +/** + * option bit for ubidi_writeReordered(): + * keep combining characters after their base characters in RTL runs + * + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_KEEP_BASE_COMBINING 1 + +/** + * option bit for ubidi_writeReordered(): + * replace characters with the "mirrored" property in RTL runs + * by their mirror-image mappings + * + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_DO_MIRRORING 2 + +/** + * option bit for ubidi_writeReordered(): + * surround the run with LRMs if necessary; + * this is part of the approximate "inverse Bidi" algorithm + * + *

This option does not imply corresponding adjustment of the index + * mappings.

+ * + * @see ubidi_setInverse + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_INSERT_LRM_FOR_NUMERIC 4 + +/** + * option bit for ubidi_writeReordered(): + * remove Bidi control characters + * (this does not affect #UBIDI_INSERT_LRM_FOR_NUMERIC) + * + *

This option does not imply corresponding adjustment of the index + * mappings.

+ * + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_REMOVE_BIDI_CONTROLS 8 + +/** + * option bit for ubidi_writeReordered(): + * write the output in reverse order + * + *

This has the same effect as calling ubidi_writeReordered() + * first without this option, and then calling + * ubidi_writeReverse() without mirroring. + * Doing this in the same step is faster and avoids a temporary buffer. + * An example for using this option is output to a character terminal that + * is designed for RTL scripts and stores text in reverse order.

+ * + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_OUTPUT_REVERSE 16 + +/** + * Get the length of the source text processed by the last call to + * ubidi_setPara(). This length may be different from the length + * of the source text if option #UBIDI_OPTION_STREAMING + * has been set. + *
+ * Note that whenever the length of the text affects the execution or the + * result of a function, it is the processed length which must be considered, + * except for ubidi_setPara (which receives unprocessed source + * text) and ubidi_getLength (which returns the original length + * of the source text).
+ * In particular, the processed length is the one to consider in the following + * cases: + *
    + *
  • maximum value of the limit argument of + * ubidi_setLine
  • + *
  • maximum value of the charIndex argument of + * ubidi_getParagraph
  • + *
  • maximum value of the charIndex argument of + * ubidi_getLevelAt
  • + *
  • number of elements in the array returned by ubidi_getLevels
  • + *
  • maximum value of the logicalStart argument of + * ubidi_getLogicalRun
  • + *
  • maximum value of the logicalIndex argument of + * ubidi_getVisualIndex
  • + *
  • number of elements filled in the *indexMap argument of + * ubidi_getLogicalMap
  • + *
  • length of text processed by ubidi_writeReordered
  • + *
+ * + * @param pBiDi is the paragraph UBiDi object. + * + * @return The length of the part of the source text processed by + * the last call to ubidi_setPara. + * @see ubidi_setPara + * @see UBIDI_OPTION_STREAMING + * @stable ICU 3.6 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_getProcessedLength(const UBiDi *pBiDi); + +/** + * Get the length of the reordered text resulting from the last call to + * ubidi_setPara(). This length may be different from the length + * of the source text if option #UBIDI_OPTION_INSERT_MARKS + * or option #UBIDI_OPTION_REMOVE_CONTROLS has been set. + *
+ * This resulting length is the one to consider in the following cases: + *
    + *
  • maximum value of the visualIndex argument of + * ubidi_getLogicalIndex
  • + *
  • number of elements of the *indexMap argument of + * ubidi_getVisualMap
  • + *
+ * Note that this length stays identical to the source text length if + * Bidi marks are inserted or removed using option bits of + * ubidi_writeReordered, or if option + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L has been set. + * + * @param pBiDi is the paragraph UBiDi object. + * + * @return The length of the reordered text resulting from + * the last call to ubidi_setPara. + * @see ubidi_setPara + * @see UBIDI_OPTION_INSERT_MARKS + * @see UBIDI_OPTION_REMOVE_CONTROLS + * @stable ICU 3.6 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_getResultLength(const UBiDi *pBiDi); + +U_CDECL_BEGIN + +#ifndef U_HIDE_DEPRECATED_API +/** + * Value returned by UBiDiClassCallback callbacks when + * there is no need to override the standard Bidi class for a given code point. + * + * This constant is deprecated; use u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1 instead. + * + * @see UBiDiClassCallback + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ +#define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT +#endif // U_HIDE_DEPRECATED_API + +/** + * Callback type declaration for overriding default Bidi class values with + * custom ones. + *

Usually, the function pointer will be propagated to a UBiDi + * object by calling the ubidi_setClassCallback() function; + * then the callback will be invoked by the UBA implementation any time the + * class of a character is to be determined.

+ * + * @param context is a pointer to the callback private data. + * + * @param c is the code point to get a Bidi class for. + * + * @return The directional property / Bidi class for the given code point + * c if the default class has been overridden, or + * u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1 + * if the standard Bidi class value for c is to be used. + * @see ubidi_setClassCallback + * @see ubidi_getClassCallback + * @stable ICU 3.6 + */ +typedef UCharDirection U_CALLCONV +UBiDiClassCallback(const void *context, UChar32 c); + +U_CDECL_END + +/** + * Retrieve the Bidi class for a given code point. + *

If a #UBiDiClassCallback callback is defined and returns a + * value other than u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1, + * that value is used; otherwise the default class determination mechanism is invoked.

+ * + * @param pBiDi is the paragraph UBiDi object. + * + * @param c is the code point whose Bidi class must be retrieved. + * + * @return The Bidi class for character c based + * on the given pBiDi instance. + * @see UBiDiClassCallback + * @stable ICU 3.6 + */ +U_CAPI UCharDirection U_EXPORT2 +ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c); + +/** + * Set the callback function and callback data used by the UBA + * implementation for Bidi class determination. + *

This may be useful for assigning Bidi classes to PUA characters, or + * for special application needs. For instance, an application may want to + * handle all spaces like L or R characters (according to the base direction) + * when creating the visual ordering of logical lines which are part of a report + * organized in columns: there should not be interaction between adjacent + * cells.

+ * + * @param pBiDi is the paragraph UBiDi object. + * + * @param newFn is the new callback function pointer. + * + * @param newContext is the new callback context pointer. This can be NULL. + * + * @param oldFn fillin: Returns the old callback function pointer. This can be + * NULL. + * + * @param oldContext fillin: Returns the old callback's context. This can be + * NULL. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_getClassCallback + * @stable ICU 3.6 + */ +U_CAPI void U_EXPORT2 +ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, + const void *newContext, UBiDiClassCallback **oldFn, + const void **oldContext, UErrorCode *pErrorCode); + +/** + * Get the current callback function used for Bidi class determination. + * + * @param pBiDi is the paragraph UBiDi object. + * + * @param fn fillin: Returns the callback function pointer. + * + * @param context fillin: Returns the callback's private context. + * + * @see ubidi_setClassCallback + * @stable ICU 3.6 + */ +U_CAPI void U_EXPORT2 +ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context); + +/** + * Take a UBiDi object containing the reordering + * information for a piece of text (one or more paragraphs) set by + * ubidi_setPara() or for a line of text set by + * ubidi_setLine() and write a reordered string to the + * destination buffer. + * + * This function preserves the integrity of characters with multiple + * code units and (optionally) combining characters. + * Characters in RTL runs can be replaced by mirror-image characters + * in the destination buffer. Note that "real" mirroring has + * to be done in a rendering engine by glyph selection + * and that for many "mirrored" characters there are no + * Unicode characters as mirror-image equivalents. + * There are also options to insert or remove Bidi control + * characters; see the description of the destSize + * and options parameters and of the option bit flags. + * + * @param pBiDi A pointer to a UBiDi object that + * is set by ubidi_setPara() or + * ubidi_setLine() and contains the reordering + * information for the text that it was defined for, + * as well as a pointer to that text.

+ * The text was aliased (only the pointer was stored + * without copying the contents) and must not have been modified + * since the ubidi_setPara() call. + * + * @param dest A pointer to where the reordered text is to be copied. + * The source text and dest[destSize] + * must not overlap. + * + * @param destSize The size of the dest buffer, + * in number of UChars. + * If the UBIDI_INSERT_LRM_FOR_NUMERIC + * option is set, then the destination length could be + * as large as + * ubidi_getLength(pBiDi)+2*ubidi_countRuns(pBiDi). + * If the UBIDI_REMOVE_BIDI_CONTROLS option + * is set, then the destination length may be less than + * ubidi_getLength(pBiDi). + * If none of these options is set, then the destination length + * will be exactly ubidi_getProcessedLength(pBiDi). + * + * @param options A bit set of options for the reordering that control + * how the reordered text is written. + * The options include mirroring the characters on a code + * point basis and inserting LRM characters, which is used + * especially for transforming visually stored text + * to logically stored text (although this is still an + * imperfect implementation of an "inverse Bidi" algorithm + * because it uses the "forward Bidi" algorithm at its core). + * The available options are: + * #UBIDI_DO_MIRRORING, + * #UBIDI_INSERT_LRM_FOR_NUMERIC, + * #UBIDI_KEEP_BASE_COMBINING, + * #UBIDI_OUTPUT_REVERSE, + * #UBIDI_REMOVE_BIDI_CONTROLS + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The length of the output string. + * + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_writeReordered(UBiDi *pBiDi, + UChar *dest, int32_t destSize, + uint16_t options, + UErrorCode *pErrorCode); + +/** + * Reverse a Right-To-Left run of Unicode text. + * + * This function preserves the integrity of characters with multiple + * code units and (optionally) combining characters. + * Characters can be replaced by mirror-image characters + * in the destination buffer. Note that "real" mirroring has + * to be done in a rendering engine by glyph selection + * and that for many "mirrored" characters there are no + * Unicode characters as mirror-image equivalents. + * There are also options to insert or remove Bidi control + * characters. + * + * This function is the implementation for reversing RTL runs as part + * of ubidi_writeReordered(). For detailed descriptions + * of the parameters, see there. + * Since no Bidi controls are inserted here, the output string length + * will never exceed srcLength. + * + * @see ubidi_writeReordered + * + * @param src A pointer to the RTL run text. + * + * @param srcLength The length of the RTL run. + * + * @param dest A pointer to where the reordered text is to be copied. + * src[srcLength] and dest[destSize] + * must not overlap. + * + * @param destSize The size of the dest buffer, + * in number of UChars. + * If the UBIDI_REMOVE_BIDI_CONTROLS option + * is set, then the destination length may be less than + * srcLength. + * If this option is not set, then the destination length + * will be exactly srcLength. + * + * @param options A bit set of options for the reordering that control + * how the reordered text is written. + * See the options parameter in ubidi_writeReordered(). + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The length of the output string. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubidi_writeReverse(const UChar *src, int32_t srcLength, + UChar *dest, int32_t destSize, + uint16_t options, + UErrorCode *pErrorCode); + +/*#define BIDI_SAMPLE_CODE*/ +/*@}*/ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ubiditransform.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ubiditransform.h new file mode 100644 index 0000000000000000000000000000000000000000..2dd7564010de17e5b773bf35bc6235a000d76b2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ubiditransform.h @@ -0,0 +1,326 @@ +/* +****************************************************************************** +* +* © 2016 and later: Unicode, Inc. and others. +* License & terms of use: http://www.unicode.org/copyright.html +* +****************************************************************************** +* file name: ubiditransform.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2016jul24 +* created by: Lina Kemmel +* +*/ + +#ifndef UBIDITRANSFORM_H +#define UBIDITRANSFORM_H + +#include "unicode/utypes.h" +#include "unicode/ubidi.h" +#include "unicode/uchar.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief Bidi Transformations + */ + +/** + * `UBiDiOrder` indicates the order of text. + * + * This bidi transformation engine supports all possible combinations (4 in + * total) of input and output text order: + * + * - : unless the output direction is RTL, this + * corresponds to a normal operation of the Bidi algorithm as described in the + * Unicode Technical Report and implemented by `UBiDi` when the + * reordering mode is set to `UBIDI_REORDER_DEFAULT`. Visual RTL + * mode is not supported by `UBiDi` and is accomplished through + * reversing a visual LTR string, + * + * - : unless the input direction is RTL, this + * corresponds to an "inverse bidi algorithm" in `UBiDi` with the + * reordering mode set to `UBIDI_REORDER_INVERSE_LIKE_DIRECT`. + * Visual RTL mode is not not supported by `UBiDi` and is + * accomplished through reversing a visual LTR string, + * + * - : if the input and output base directions + * mismatch, this corresponds to the `UBiDi` implementation with the + * reordering mode set to `UBIDI_REORDER_RUNS_ONLY`; and if the + * input and output base directions are identical, the transformation engine + * will only handle character mirroring and Arabic shaping operations without + * reordering, + * + * - : this reordering mode is not supported by + * the `UBiDi` engine; it implies character mirroring, Arabic + * shaping, and - if the input/output base directions mismatch - string + * reverse operations. + * @see ubidi_setInverse + * @see ubidi_setReorderingMode + * @see UBIDI_REORDER_DEFAULT + * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT + * @see UBIDI_REORDER_RUNS_ONLY + * @stable ICU 58 + */ +typedef enum { + /** 0: Constant indicating a logical order. + * This is the default for input text. + * @stable ICU 58 + */ + UBIDI_LOGICAL = 0, + /** 1: Constant indicating a visual order. + * This is a default for output text. + * @stable ICU 58 + */ + UBIDI_VISUAL +} UBiDiOrder; + +/** + * UBiDiMirroring indicates whether or not characters with the + * "mirrored" property in RTL runs should be replaced with their mirror-image + * counterparts. + * @see UBIDI_DO_MIRRORING + * @see ubidi_setReorderingOptions + * @see ubidi_writeReordered + * @see ubidi_writeReverse + * @stable ICU 58 + */ +typedef enum { + /** 0: Constant indicating that character mirroring should not be + * performed. + * This is the default. + * @stable ICU 58 + */ + UBIDI_MIRRORING_OFF = 0, + /** 1: Constant indicating that character mirroring should be performed. + * This corresponds to calling ubidi_writeReordered or + * ubidi_writeReverse with the + * UBIDI_DO_MIRRORING option bit set. + * @stable ICU 58 + */ + UBIDI_MIRRORING_ON +} UBiDiMirroring; + +/** + * Forward declaration of the UBiDiTransform structure that stores + * information used by the layout transformation engine. + * @stable ICU 58 + */ +typedef struct UBiDiTransform UBiDiTransform; + +/** + * Performs transformation of text from the bidi layout defined by the input + * ordering scheme to the bidi layout defined by the output ordering scheme, + * and applies character mirroring and Arabic shaping operations.

+ * In terms of UBiDi, such a transformation implies: + *

    + *
  • calling ubidi_setReorderingMode as needed (when the + * reordering mode is other than normal),
  • + *
  • calling ubidi_setInverse as needed (when text should be + * transformed from a visual to a logical form),
  • + *
  • resolving embedding levels of each character in the input text by + * calling ubidi_setPara,
  • + *
  • reordering the characters based on the computed embedding levels, also + * performing character mirroring as needed, and streaming the result to the + * output, by calling ubidi_writeReordered,
  • + *
  • performing Arabic digit and letter shaping on the output text by calling + * u_shapeArabic.
  • + *
+ * An "ordering scheme" encompasses the base direction and the order of text, + * and these characteristics must be defined by the caller for both input and + * output explicitly .

+ * There are 36 possible combinations of ordering schemes, + * which are partially supported by UBiDi already. Examples of the + * currently supported combinations: + *

    + *
  • : this is equivalent to calling + * ubidi_setPara with paraLevel == UBIDI_LTR,
  • + *
  • : this is equivalent to calling + * ubidi_setPara with paraLevel == UBIDI_RTL,
  • + *
  • : this is equivalent to + * calling ubidi_setPara with + * paraLevel == UBIDI_DEFAULT_LTR,
  • + *
  • : this is equivalent to + * calling ubidi_setPara with + * paraLevel == UBIDI_DEFAULT_RTL,
  • + *
  • : this is equivalent to + * calling ubidi_setInverse(UBiDi*, true) and then + * ubidi_setPara with paraLevel == UBIDI_LTR,
  • + *
  • : this is equivalent to + * calling ubidi_setInverse(UBiDi*, true) and then + * ubidi_setPara with paraLevel == UBIDI_RTL.
  • + *
+ * All combinations that involve the Visual RTL scheme are unsupported by + * UBiDi, for instance: + *
    + *
  • ,
  • + *
  • .
  • + *
+ *

Example of usage of the transformation engine:
+ *

+ * \code
+ * UChar text1[] = {'a', 'b', 'c', 0x0625, '1', 0};
+ * UChar text2[] = {'a', 'b', 'c', 0x0625, '1', 0};
+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * // Run a transformation.
+ * ubiditransform_transform(pBidiTransform,
+ *          text1, -1, text2, -1,
+ *          UBIDI_LTR, UBIDI_VISUAL,
+ *          UBIDI_RTL, UBIDI_LOGICAL,
+ *          UBIDI_MIRRORING_OFF,
+ *          U_SHAPE_DIGITS_AN2EN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED,
+ *          &errorCode);
+ * // Do something with text2.
+ *  text2[4] = '2';
+ * // Run a reverse transformation.
+ * ubiditransform_transform(pBidiTransform,
+ *          text2, -1, text1, -1,
+ *          UBIDI_RTL, UBIDI_LOGICAL,
+ *          UBIDI_LTR, UBIDI_VISUAL,
+ *          UBIDI_MIRRORING_OFF,
+ *          U_SHAPE_DIGITS_EN2AN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED,
+ *          &errorCode);
+ *\endcode
+ * 
+ *

+ * + * @param pBiDiTransform A pointer to a UBiDiTransform object + * allocated with ubiditransform_open() or + * NULL.

+ * This object serves for one-time setup to amortize initialization + * overheads. Use of this object is not thread-safe. All other threads + * should allocate a new UBiDiTransform object by calling + * ubiditransform_open() before using it. Alternatively, + * a caller can set this parameter to NULL, in which case + * the object will be allocated by the engine on the fly.

+ * @param src A pointer to the text that the Bidi layout transformations will + * be performed on. + *

Note: the text must be (at least) + * srcLength long.

+ * @param srcLength The length of the text, in number of UChars. If + * length == -1 then the text must be zero-terminated. + * @param dest A pointer to where the processed text is to be copied. + * @param destSize The size of the dest buffer, in number of + * UChars. If the U_SHAPE_LETTERS_UNSHAPE option is set, + * then the destination length could be as large as + * srcLength * 2. Otherwise, the destination length will + * not exceed srcLength. If the caller reserves the last + * position for zero-termination, it should be excluded from + * destSize. + *

destSize == -1 is allowed and makes sense when + * dest was holds some meaningful value, e.g. that of + * src. In this case dest must be + * zero-terminated.

+ * @param inParaLevel A base embedding level of the input as defined in + * ubidi_setPara documentation for the + * paraLevel parameter. + * @param inOrder An order of the input, which can be one of the + * UBiDiOrder values. + * @param outParaLevel A base embedding level of the output as defined in + * ubidi_setPara documentation for the + * paraLevel parameter. + * @param outOrder An order of the output, which can be one of the + * UBiDiOrder values. + * @param doMirroring Indicates whether or not to perform character mirroring, + * and can accept one of the UBiDiMirroring values. + * @param shapingOptions Arabic digit and letter shaping options defined in the + * ushape.h documentation. + *

Note: Direction indicator options are computed by + * the transformation engine based on the effective ordering schemes, so + * user-defined direction indicators will be ignored.

+ * @param pErrorCode A pointer to an error code value. + * + * @return The destination length, i.e. the number of UChars written to + * dest. If the transformation fails, the return value + * will be 0 (and the error code will be written to + * pErrorCode). + * + * @see UBiDiLevel + * @see UBiDiOrder + * @see UBiDiMirroring + * @see ubidi_setPara + * @see u_shapeArabic + * @stable ICU 58 + */ +U_CAPI uint32_t U_EXPORT2 +ubiditransform_transform(UBiDiTransform *pBiDiTransform, + const UChar *src, int32_t srcLength, + UChar *dest, int32_t destSize, + UBiDiLevel inParaLevel, UBiDiOrder inOrder, + UBiDiLevel outParaLevel, UBiDiOrder outOrder, + UBiDiMirroring doMirroring, uint32_t shapingOptions, + UErrorCode *pErrorCode); + +/** + * Allocates a UBiDiTransform object. This object can be reused, + * e.g. with different ordering schemes, mirroring or shaping options.

+ * Note:The object can only be reused in the same thread. + * All other threads should allocate a new UBiDiTransform object + * before using it.

+ * Example of usage:

+ *

+ * \code
+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * // Open a new UBiDiTransform.
+ * UBiDiTransform* transform = ubiditransform_open(&errorCode);
+ * // Run a transformation.
+ * ubiditransform_transform(transform,
+ *          text1, -1, text2, -1,
+ *          UBIDI_RTL, UBIDI_LOGICAL,
+ *          UBIDI_LTR, UBIDI_VISUAL,
+ *          UBIDI_MIRRORING_ON,
+ *          U_SHAPE_DIGITS_EN2AN,
+ *          &errorCode);
+ * // Do something with the output text and invoke another transformation using
+ * //   that text as input.
+ * ubiditransform_transform(transform,
+ *          text2, -1, text3, -1,
+ *          UBIDI_LTR, UBIDI_VISUAL,
+ *          UBIDI_RTL, UBIDI_VISUAL,
+ *          UBIDI_MIRRORING_ON,
+ *          0, &errorCode);
+ *\endcode
+ * 
+ *

+ * The UBiDiTransform object must be deallocated by calling + * ubiditransform_close(). + * + * @return An empty UBiDiTransform object. + * @stable ICU 58 + */ +U_CAPI UBiDiTransform* U_EXPORT2 +ubiditransform_open(UErrorCode *pErrorCode); + +/** + * Deallocates the given UBiDiTransform object. + * @stable ICU 58 + */ +U_CAPI void U_EXPORT2 +ubiditransform_close(UBiDiTransform *pBidiTransform); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUBiDiTransformPointer + * "Smart pointer" class, closes a UBiDiTransform via ubiditransform_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 58 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiTransformPointer, UBiDiTransform, ubiditransform_close); + +U_NAMESPACE_END + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ubrk.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ubrk.h new file mode 100644 index 0000000000000000000000000000000000000000..1249b0b160d3625aeb97bfedebfd14dd69351021 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ubrk.h @@ -0,0 +1,650 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 1996-2015, International Business Machines Corporation and others. +* All Rights Reserved. +****************************************************************************** +*/ + +#ifndef UBRK_H +#define UBRK_H + +#include "unicode/utypes.h" +#include "unicode/uloc.h" +#include "unicode/utext.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * A text-break iterator. + * For usage in C programs. + */ +#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR +# define UBRK_TYPEDEF_UBREAK_ITERATOR + /** + * Opaque type representing an ICU Break iterator object. + * @stable ICU 2.0 + */ + typedef struct UBreakIterator UBreakIterator; +#endif + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/parseerr.h" + +/** + * \file + * \brief C API: BreakIterator + * + *

BreakIterator C API

+ * + * The BreakIterator C API defines methods for finding the location + * of boundaries in text. Pointer to a UBreakIterator maintain a + * current position and scan over text returning the index of characters + * where boundaries occur. + *

+ * Line boundary analysis determines where a text string can be broken + * when line-wrapping. The mechanism correctly handles punctuation and + * hyphenated words. + *

+ * Note: The locale keyword "lb" can be used to modify line break + * behavior according to the CSS level 3 line-break options, see + * . For example: + * "ja@lb=strict", "zh@lb=loose". + *

+ * Sentence boundary analysis allows selection with correct + * interpretation of periods within numbers and abbreviations, and + * trailing punctuation marks such as quotation marks and parentheses. + *

+ * Note: The locale keyword "ss" can be used to enable use of + * segmentation suppression data (preventing breaks in English after + * abbreviations such as "Mr." or "Est.", for example), as follows: + * "en@ss=standard". + *

+ * Word boundary analysis is used by search and replace functions, as + * well as within text editing applications that allow the user to + * select words with a double click. Word selection provides correct + * interpretation of punctuation marks within and following + * words. Characters that are not part of a word, such as symbols or + * punctuation marks, have word-breaks on both sides. + *

+ * Character boundary analysis identifies the boundaries of + * "Extended Grapheme Clusters", which are groupings of codepoints + * that should be treated as character-like units for many text operations. + * Please see Unicode Standard Annex #29, Unicode Text Segmentation, + * http://www.unicode.org/reports/tr29/ for additional information + * on grapheme clusters and guidelines on their use. + *

+ * Title boundary analysis locates all positions, + * typically starts of words, that should be set to Title Case + * when title casing the text. + *

+ * The text boundary positions are found according to the rules + * described in Unicode Standard Annex #29, Text Boundaries, and + * Unicode Standard Annex #14, Line Breaking Properties. These + * are available at http://www.unicode.org/reports/tr14/ and + * http://www.unicode.org/reports/tr29/. + *

+ * In addition to the plain C API defined in this header file, an + * object oriented C++ API with equivalent functionality is defined in the + * file brkiter.h. + *

+ * Code snippets illustrating the use of the Break Iterator APIs + * are available in the ICU User Guide, + * http://icu-project.org/userguide/boundaryAnalysis.html + * and in the sample program icu/source/samples/break/break.cpp + */ + +/** The possible types of text boundaries. @stable ICU 2.0 */ +typedef enum UBreakIteratorType { + /** Character breaks @stable ICU 2.0 */ + UBRK_CHARACTER = 0, + /** Word breaks @stable ICU 2.0 */ + UBRK_WORD = 1, + /** Line breaks @stable ICU 2.0 */ + UBRK_LINE = 2, + /** Sentence breaks @stable ICU 2.0 */ + UBRK_SENTENCE = 3, + +#ifndef U_HIDE_DEPRECATED_API + /** + * Title Case breaks + * The iterator created using this type locates title boundaries as described for + * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, + * please use Word Boundary iterator. + * + * @deprecated ICU 2.8 Use the word break iterator for titlecasing for Unicode 4 and later. + */ + UBRK_TITLE = 4, + /** + * One more than the highest normal UBreakIteratorType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UBRK_COUNT = 5 +#endif // U_HIDE_DEPRECATED_API +} UBreakIteratorType; + +/** Value indicating all text boundaries have been returned. + * @stable ICU 2.0 + */ +#define UBRK_DONE ((int32_t) -1) + + +/** + * Enum constants for the word break tags returned by + * getRuleStatus(). A range of values is defined for each category of + * word, to allow for further subdivisions of a category in future releases. + * Applications should check for tag values falling within the range, rather + * than for single individual values. + * + * The numeric values of all of these constants are stable (will not change). + * + * @stable ICU 2.2 +*/ +typedef enum UWordBreak { + /** Tag value for "words" that do not fit into any of other categories. + * Includes spaces and most punctuation. */ + UBRK_WORD_NONE = 0, + /** Upper bound for tags for uncategorized words. */ + UBRK_WORD_NONE_LIMIT = 100, + /** Tag value for words that appear to be numbers, lower limit. */ + UBRK_WORD_NUMBER = 100, + /** Tag value for words that appear to be numbers, upper limit. */ + UBRK_WORD_NUMBER_LIMIT = 200, + /** Tag value for words that contain letters, excluding + * hiragana, katakana or ideographic characters, lower limit. */ + UBRK_WORD_LETTER = 200, + /** Tag value for words containing letters, upper limit */ + UBRK_WORD_LETTER_LIMIT = 300, + /** Tag value for words containing kana characters, lower limit */ + UBRK_WORD_KANA = 300, + /** Tag value for words containing kana characters, upper limit */ + UBRK_WORD_KANA_LIMIT = 400, + /** Tag value for words containing ideographic characters, lower limit */ + UBRK_WORD_IDEO = 400, + /** Tag value for words containing ideographic characters, upper limit */ + UBRK_WORD_IDEO_LIMIT = 500 +} UWordBreak; + +/** + * Enum constants for the line break tags returned by getRuleStatus(). + * A range of values is defined for each category of + * word, to allow for further subdivisions of a category in future releases. + * Applications should check for tag values falling within the range, rather + * than for single individual values. + * + * The numeric values of all of these constants are stable (will not change). + * + * @stable ICU 2.8 +*/ +typedef enum ULineBreakTag { + /** Tag value for soft line breaks, positions at which a line break + * is acceptable but not required */ + UBRK_LINE_SOFT = 0, + /** Upper bound for soft line breaks. */ + UBRK_LINE_SOFT_LIMIT = 100, + /** Tag value for a hard, or mandatory line break */ + UBRK_LINE_HARD = 100, + /** Upper bound for hard line breaks. */ + UBRK_LINE_HARD_LIMIT = 200 +} ULineBreakTag; + + + +/** + * Enum constants for the sentence break tags returned by getRuleStatus(). + * A range of values is defined for each category of + * sentence, to allow for further subdivisions of a category in future releases. + * Applications should check for tag values falling within the range, rather + * than for single individual values. + * + * The numeric values of all of these constants are stable (will not change). + * + * @stable ICU 2.8 +*/ +typedef enum USentenceBreakTag { + /** Tag value for for sentences ending with a sentence terminator + * ('.', '?', '!', etc.) character, possibly followed by a + * hard separator (CR, LF, PS, etc.) + */ + UBRK_SENTENCE_TERM = 0, + /** Upper bound for tags for sentences ended by sentence terminators. */ + UBRK_SENTENCE_TERM_LIMIT = 100, + /** Tag value for for sentences that do not contain an ending + * sentence terminator ('.', '?', '!', etc.) character, but + * are ended only by a hard separator (CR, LF, PS, etc.) or end of input. + */ + UBRK_SENTENCE_SEP = 100, + /** Upper bound for tags for sentences ended by a separator. */ + UBRK_SENTENCE_SEP_LIMIT = 200 + /** Tag value for a hard, or mandatory line break */ +} USentenceBreakTag; + + +/** + * Open a new UBreakIterator for locating text boundaries for a specified locale. + * A UBreakIterator may be used for detecting character, line, word, + * and sentence breaks in text. + * @param type The type of UBreakIterator to open: one of UBRK_CHARACTER, UBRK_WORD, + * UBRK_LINE, UBRK_SENTENCE + * @param locale The locale specifying the text-breaking conventions. Note that + * locale keys such as "lb" and "ss" may be used to modify text break behavior, + * see general discussion of BreakIterator C API. + * @param text The text to be iterated over. May be null, in which case ubrk_setText() is + * used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param status A UErrorCode to receive any errors. + * @return A UBreakIterator for the specified locale. + * @see ubrk_openRules + * @stable ICU 2.0 + */ +U_CAPI UBreakIterator* U_EXPORT2 +ubrk_open(UBreakIteratorType type, + const char *locale, + const UChar *text, + int32_t textLength, + UErrorCode *status); + +/** + * Open a new UBreakIterator for locating text boundaries using specified breaking rules. + * The rule syntax is ... (TBD) + * @param rules A set of rules specifying the text breaking conventions. + * @param rulesLength The number of characters in rules, or -1 if null-terminated. + * @param text The text to be iterated over. May be null, in which case ubrk_setText() is + * used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param parseErr Receives position and context information for any syntax errors + * detected while parsing the rules. + * @param status A UErrorCode to receive any errors. + * @return A UBreakIterator for the specified rules. + * @see ubrk_open + * @stable ICU 2.2 + */ +U_CAPI UBreakIterator* U_EXPORT2 +ubrk_openRules(const UChar *rules, + int32_t rulesLength, + const UChar *text, + int32_t textLength, + UParseError *parseErr, + UErrorCode *status); + +/** + * Open a new UBreakIterator for locating text boundaries using precompiled binary rules. + * Opening a UBreakIterator this way is substantially faster than using ubrk_openRules. + * Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not + * compatible across different major versions of ICU, nor across platforms of different + * endianness or different base character set family (ASCII vs EBCDIC). + * @param binaryRules A set of compiled binary rules specifying the text breaking + * conventions. Ownership of the storage containing the compiled + * rules remains with the caller of this function. The compiled + * rules must not be modified or deleted during the life of the + * break iterator. + * @param rulesLength The length of binaryRules in bytes; must be >= 0. + * @param text The text to be iterated over. May be null, in which case + * ubrk_setText() is used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param status Pointer to UErrorCode to receive any errors. + * @return UBreakIterator for the specified rules. + * @see ubrk_getBinaryRules + * @stable ICU 59 + */ +U_CAPI UBreakIterator* U_EXPORT2 +ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, + const UChar * text, int32_t textLength, + UErrorCode * status); + +#ifndef U_HIDE_DEPRECATED_API + +/** + * Thread safe cloning operation + * @param bi iterator to be cloned + * @param stackBuffer Deprecated functionality as of ICU 52, use NULL.
+ * user allocated space for the new clone. If NULL new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * Clients can use the U_BRK_SAFECLONE_BUFFERSIZE. + * @param pBufferSize Deprecated functionality as of ICU 52, use NULL or 1.
+ * pointer to size of allocated space. + * If *pBufferSize == 0, a sufficient size for use in cloning will + * be returned ('pre-flighting') + * If *pBufferSize is not enough for a stack-based safe clone, + * new memory will be allocated. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were necessary. + * @return pointer to the new clone + * @deprecated ICU 69 Use ubrk_clone() instead. + */ +U_CAPI UBreakIterator * U_EXPORT2 +ubrk_safeClone( + const UBreakIterator *bi, + void *stackBuffer, + int32_t *pBufferSize, + UErrorCode *status); + +#endif /* U_HIDE_DEPRECATED_API */ + +#ifndef U_HIDE_DRAFT_API + +/** + * Thread safe cloning operation. + * @param bi iterator to be cloned + * @param status to indicate whether the operation went on smoothly or there were errors + * @return pointer to the new clone + * @draft ICU 69 + */ +U_CAPI UBreakIterator * U_EXPORT2 +ubrk_clone(const UBreakIterator *bi, + UErrorCode *status); + +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_DEPRECATED_API + +/** + * A recommended size (in bytes) for the memory buffer to be passed to ubrk_saveClone(). + * @deprecated ICU 52. Do not rely on ubrk_safeClone() cloning into any provided buffer. + */ +#define U_BRK_SAFECLONE_BUFFERSIZE 1 + +#endif /* U_HIDE_DEPRECATED_API */ + +/** +* Close a UBreakIterator. +* Once closed, a UBreakIterator may no longer be used. +* @param bi The break iterator to close. + * @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +ubrk_close(UBreakIterator *bi); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUBreakIteratorPointer + * "Smart pointer" class, closes a UBreakIterator via ubrk_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close); + +U_NAMESPACE_END + +#endif + +/** + * Sets an existing iterator to point to a new piece of text. + * The break iterator retains a pointer to the supplied text. + * The caller must not modify or delete the text while the BreakIterator + * retains the reference. + * + * @param bi The iterator to use + * @param text The text to be set + * @param textLength The length of the text + * @param status The error code + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubrk_setText(UBreakIterator* bi, + const UChar* text, + int32_t textLength, + UErrorCode* status); + + +/** + * Sets an existing iterator to point to a new piece of text. + * + * All index positions returned by break iterator functions are + * native indices from the UText. For example, when breaking UTF-8 + * encoded text, the break positions returned by \ref ubrk_next, \ref ubrk_previous, etc. + * will be UTF-8 string indices, not UTF-16 positions. + * + * @param bi The iterator to use + * @param text The text to be set. + * This function makes a shallow clone of the supplied UText. This means + * that the caller is free to immediately close or otherwise reuse the + * UText that was passed as a parameter, but that the underlying text itself + * must not be altered while being referenced by the break iterator. + * @param status The error code + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +ubrk_setUText(UBreakIterator* bi, + UText* text, + UErrorCode* status); + + + +/** + * Determine the most recently-returned text boundary. + * + * @param bi The break iterator to use. + * @return The character index most recently returned by \ref ubrk_next, \ref ubrk_previous, + * \ref ubrk_first, or \ref ubrk_last. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_current(const UBreakIterator *bi); + +/** + * Advance the iterator to the boundary following the current boundary. + * + * @param bi The break iterator to use. + * @return The character index of the next text boundary, or UBRK_DONE + * if all text boundaries have been returned. + * @see ubrk_previous + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_next(UBreakIterator *bi); + +/** + * Set the iterator position to the boundary preceding the current boundary. + * + * @param bi The break iterator to use. + * @return The character index of the preceding text boundary, or UBRK_DONE + * if all text boundaries have been returned. + * @see ubrk_next + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_previous(UBreakIterator *bi); + +/** + * Set the iterator position to zero, the start of the text being scanned. + * @param bi The break iterator to use. + * @return The new iterator position (zero). + * @see ubrk_last + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_first(UBreakIterator *bi); + +/** + * Set the iterator position to the index immediately beyond the last character in the text being scanned. + * This is not the same as the last character. + * @param bi The break iterator to use. + * @return The character offset immediately beyond the last character in the + * text being scanned. + * @see ubrk_first + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_last(UBreakIterator *bi); + +/** + * Set the iterator position to the first boundary preceding the specified offset. + * The new position is always smaller than offset, or UBRK_DONE. + * @param bi The break iterator to use. + * @param offset The offset to begin scanning. + * @return The text boundary preceding offset, or UBRK_DONE. + * @see ubrk_following + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_preceding(UBreakIterator *bi, + int32_t offset); + +/** + * Advance the iterator to the first boundary following the specified offset. + * The value returned is always greater than offset, or UBRK_DONE. + * @param bi The break iterator to use. + * @param offset The offset to begin scanning. + * @return The text boundary following offset, or UBRK_DONE. + * @see ubrk_preceding + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_following(UBreakIterator *bi, + int32_t offset); + +/** +* Get a locale for which text breaking information is available. +* A UBreakIterator in a locale returned by this function will perform the correct +* text breaking for the locale. +* @param index The index of the desired locale. +* @return A locale for which number text breaking information is available, or 0 if none. +* @see ubrk_countAvailable +* @stable ICU 2.0 +*/ +U_CAPI const char* U_EXPORT2 +ubrk_getAvailable(int32_t index); + +/** +* Determine how many locales have text breaking information available. +* This function is most useful as determining the loop ending condition for +* calls to \ref ubrk_getAvailable. +* @return The number of locales for which text breaking information is available. +* @see ubrk_getAvailable +* @stable ICU 2.0 +*/ +U_CAPI int32_t U_EXPORT2 +ubrk_countAvailable(void); + + +/** +* Returns true if the specified position is a boundary position. As a side +* effect, leaves the iterator pointing to the first boundary position at +* or after "offset". +* @param bi The break iterator to use. +* @param offset the offset to check. +* @return True if "offset" is a boundary position. +* @stable ICU 2.0 +*/ +U_CAPI UBool U_EXPORT2 +ubrk_isBoundary(UBreakIterator *bi, int32_t offset); + +/** + * Return the status from the break rule that determined the most recently + * returned break position. The values appear in the rule source + * within brackets, {123}, for example. For rules that do not specify a + * status, a default value of 0 is returned. + *

+ * For word break iterators, the possible values are defined in enum UWordBreak. + * @stable ICU 2.2 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_getRuleStatus(UBreakIterator *bi); + +/** + * Get the statuses from the break rules that determined the most recently + * returned break position. The values appear in the rule source + * within brackets, {123}, for example. The default status value for rules + * that do not explicitly provide one is zero. + *

+ * For word break iterators, the possible values are defined in enum UWordBreak. + * @param bi The break iterator to use + * @param fillInVec an array to be filled in with the status values. + * @param capacity the length of the supplied vector. A length of zero causes + * the function to return the number of status values, in the + * normal way, without attempting to store any values. + * @param status receives error codes. + * @return The number of rule status values from rules that determined + * the most recent boundary returned by the break iterator. + * @stable ICU 3.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status); + +/** + * Return the locale of the break iterator. You can choose between the valid and + * the actual locale. + * @param bi break iterator + * @param type locale type (valid or actual) + * @param status error code + * @return locale string + * @stable ICU 2.8 + */ +U_CAPI const char* U_EXPORT2 +ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status); + +/** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized + * system-level code. One example use case is with garbage collection + * that moves the text in memory. + * + * @param bi The break iterator. + * @param text The new (moved) text string. + * @param status Receives errors detected by this function. + * + * @stable ICU 49 + */ +U_CAPI void U_EXPORT2 +ubrk_refreshUText(UBreakIterator *bi, + UText *text, + UErrorCode *status); + + +/** + * Get a compiled binary version of the rules specifying the behavior of a UBreakIterator. + * The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator + * more quickly than using ubrk_openRules. The compiled rules are not compatible across + * different major versions of ICU, nor across platforms of different endianness or + * different base character set family (ASCII vs EBCDIC). Supports preflighting (with + * binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to + * the binaryRules buffer. However, whether preflighting or not, if the actual length + * is greater than INT32_MAX, then the function returns 0 and sets *status to + * U_INDEX_OUTOFBOUNDS_ERROR. + + * @param bi The break iterator to use. + * @param binaryRules Buffer to receive the compiled binary rules; set to NULL for + * preflighting. + * @param rulesCapacity Capacity (in bytes) of the binaryRules buffer; set to 0 for + * preflighting. Must be >= 0. + * @param status Pointer to UErrorCode to receive any errors, such as + * U_BUFFER_OVERFLOW_ERROR, U_INDEX_OUTOFBOUNDS_ERROR, or + * U_ILLEGAL_ARGUMENT_ERROR. + * @return The actual byte length of the binary rules, if <= INT32_MAX; + * otherwise 0. If not preflighting and this is larger than + * rulesCapacity, *status will be set to an error. + * @see ubrk_openBinaryRules + * @stable ICU 59 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_getBinaryRules(UBreakIterator *bi, + uint8_t * binaryRules, int32_t rulesCapacity, + UErrorCode * status); + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucasemap.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucasemap.h new file mode 100644 index 0000000000000000000000000000000000000000..d1c1b483ab337ec83bda8855775eee45d8e940ff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucasemap.h @@ -0,0 +1,388 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2005-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: ucasemap.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2005may06 +* created by: Markus W. Scherer +* +* Case mapping service object and functions using it. +*/ + +#ifndef __UCASEMAP_H__ +#define __UCASEMAP_H__ + +#include "unicode/utypes.h" +#include "unicode/stringoptions.h" +#include "unicode/ustring.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief C API: Unicode case mapping functions using a UCaseMap service object. + * + * The service object takes care of memory allocations, data loading, and setup + * for the attributes, as usual. + * + * Currently, the functionality provided here does not overlap with uchar.h + * and ustring.h, except for ucasemap_toTitle(). + * + * ucasemap_utf8XYZ() functions operate directly on UTF-8 strings. + */ + +/** + * UCaseMap is an opaque service object for newer ICU case mapping functions. + * Older functions did not use a service object. + * @stable ICU 3.4 + */ +struct UCaseMap; +typedef struct UCaseMap UCaseMap; /**< C typedef for struct UCaseMap. @stable ICU 3.4 */ + +/** + * Open a UCaseMap service object for a locale and a set of options. + * The locale ID and options are preprocessed so that functions using the + * service object need not process them in each call. + * + * @param locale ICU locale ID, used for language-dependent + * upper-/lower-/title-casing according to the Unicode standard. + * Usual semantics: ""=root, NULL=default locale, etc. + * @param options Options bit set, used for case folding and string comparisons. + * Same flags as for u_foldCase(), u_strFoldCase(), + * u_strCaseCompare(), etc. + * Use 0 or U_FOLD_CASE_DEFAULT for default behavior. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return Pointer to a UCaseMap service object, if successful. + * + * @see U_FOLD_CASE_DEFAULT + * @see U_FOLD_CASE_EXCLUDE_SPECIAL_I + * @see U_TITLECASE_NO_LOWERCASE + * @see U_TITLECASE_NO_BREAK_ADJUSTMENT + * @stable ICU 3.4 + */ +U_CAPI UCaseMap * U_EXPORT2 +ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode); + +/** + * Close a UCaseMap service object. + * @param csm Object to be closed. + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +ucasemap_close(UCaseMap *csm); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUCaseMapPointer + * "Smart pointer" class, closes a UCaseMap via ucasemap_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUCaseMapPointer, UCaseMap, ucasemap_close); + +U_NAMESPACE_END + +#endif + +/** + * Get the locale ID that is used for language-dependent case mappings. + * @param csm UCaseMap service object. + * @return locale ID + * @stable ICU 3.4 + */ +U_CAPI const char * U_EXPORT2 +ucasemap_getLocale(const UCaseMap *csm); + +/** + * Get the options bit set that is used for case folding and string comparisons. + * @param csm UCaseMap service object. + * @return options bit set + * @stable ICU 3.4 + */ +U_CAPI uint32_t U_EXPORT2 +ucasemap_getOptions(const UCaseMap *csm); + +/** + * Set the locale ID that is used for language-dependent case mappings. + * + * @param csm UCaseMap service object. + * @param locale Locale ID, see ucasemap_open(). + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see ucasemap_open + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode); + +/** + * Set the options bit set that is used for case folding and string comparisons. + * + * @param csm UCaseMap service object. + * @param options Options bit set, see ucasemap_open(). + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see ucasemap_open + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** + * Get the break iterator that is used for titlecasing. + * Do not modify the returned break iterator. + * @param csm UCaseMap service object. + * @return titlecasing break iterator + * @stable ICU 3.8 + */ +U_CAPI const UBreakIterator * U_EXPORT2 +ucasemap_getBreakIterator(const UCaseMap *csm); + +/** + * Set the break iterator that is used for titlecasing. + * The UCaseMap service object releases a previously set break iterator + * and "adopts" this new one, taking ownership of it. + * It will be released in a subsequent call to ucasemap_setBreakIterator() + * or ucasemap_close(). + * + * Break iterator operations are not thread-safe. Therefore, titlecasing + * functions use non-const UCaseMap objects. It is not possible to titlecase + * strings concurrently using the same UCaseMap. + * + * @param csm UCaseMap service object. + * @param iterToAdopt Break iterator to be adopted for titlecasing. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see ucasemap_toTitle + * @see ucasemap_utf8ToTitle + * @stable ICU 3.8 + */ +U_CAPI void U_EXPORT2 +ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode); + +/** + * Titlecase a UTF-16 string. This function is almost a duplicate of u_strToTitle(), + * except that it takes ucasemap_setOptions() into account and has performance + * advantages from being able to use a UCaseMap object for multiple case mapping + * operations, saving setup time. + * + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with ucasemap_setOptions().) + * + * Note: This function takes a non-const UCaseMap pointer because it will + * open a default break iterator if no break iterator was set yet, + * and effectively call ucasemap_setBreakIterator(); + * also because the break iterator is stateful and will be modified during + * the iteration. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. This pointer is non-const! + * See the note above for details. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strToTitle + * @stable ICU 3.8 + */ +U_CAPI int32_t U_EXPORT2 +ucasemap_toTitle(UCaseMap *csm, + UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UErrorCode *pErrorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + +/** + * Lowercase the characters in a UTF-8 string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strToLower + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +ucasemap_utf8ToLower(const UCaseMap *csm, + char *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Uppercase the characters in a UTF-8 string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strToUpper + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +ucasemap_utf8ToUpper(const UCaseMap *csm, + char *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** + * Titlecase a UTF-8 string. + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with ucasemap_setOptions().) + * + * Note: This function takes a non-const UCaseMap pointer because it will + * open a default break iterator if no break iterator was set yet, + * and effectively call ucasemap_setBreakIterator(); + * also because the break iterator is stateful and will be modified during + * the iteration. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setUText(), first(), next() and close() methods of the + * provided break iterator. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. This pointer is non-const! + * See the note above for details. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strToTitle + * @see U_TITLECASE_NO_LOWERCASE + * @see U_TITLECASE_NO_BREAK_ADJUSTMENT + * @stable ICU 3.8 + */ +U_CAPI int32_t U_EXPORT2 +ucasemap_utf8ToTitle(UCaseMap *csm, + char *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +#endif + +/** + * Case-folds the characters in a UTF-8 string. + * + * Case-folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strFoldCase + * @see ucasemap_setOptions + * @see U_FOLD_CASE_DEFAULT + * @see U_FOLD_CASE_EXCLUDE_SPECIAL_I + * @stable ICU 3.8 + */ +U_CAPI int32_t U_EXPORT2 +ucasemap_utf8FoldCase(const UCaseMap *csm, + char *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucat.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucat.h new file mode 100644 index 0000000000000000000000000000000000000000..93850348fff318448ccaff3f451fa6ec724463a8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucat.h @@ -0,0 +1,160 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2003-2004, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: March 19 2003 +* Since: ICU 2.6 +********************************************************************** +*/ +#ifndef UCAT_H +#define UCAT_H + +#include "unicode/utypes.h" +#include "unicode/ures.h" + +/** + * \file + * \brief C API: Message Catalog Wrappers + * + * This C API provides look-alike functions that deliberately resemble + * the POSIX catopen, catclose, and catgets functions. The underlying + * implementation is in terms of ICU resource bundles, rather than + * POSIX message catalogs. + * + * The ICU resource bundles obey standard ICU inheritance policies. + * To facilitate this, sets and messages are flattened into one tier. + * This is done by creating resource bundle keys of the form + * <set_num>%<msg_num> where set_num is the set number and msg_num is + * the message number, formatted as decimal strings. + * + * Example: Consider a message catalog containing two sets: + * + * Set 1: Message 4 = "Good morning." + * Message 5 = "Good afternoon." + * Message 7 = "Good evening." + * Message 8 = "Good night." + * Set 4: Message 14 = "Please " + * Message 19 = "Thank you." + * Message 20 = "Sincerely," + * + * The ICU resource bundle source file would, assuming it is named + * "greet.txt", would look like this: + * + * greet + * { + * 1%4 { "Good morning." } + * 1%5 { "Good afternoon." } + * 1%7 { "Good evening." } + * 1%8 { "Good night." } + * + * 4%14 { "Please " } + * 4%19 { "Thank you." } + * 4%20 { "Sincerely," } + * } + * + * The catgets function is commonly used in combination with functions + * like printf and strftime. ICU components like message format can + * be used instead, although they use a different format syntax. + * There is an ICU package, icuio, that provides some of + * the POSIX-style formatting API. + */ + +U_CDECL_BEGIN + +/** + * An ICU message catalog descriptor, analogous to nl_catd. + * + * @stable ICU 2.6 + */ +typedef UResourceBundle* u_nl_catd; + +/** + * Open and return an ICU message catalog descriptor. The descriptor + * may be passed to u_catgets() to retrieve localized strings. + * + * @param name string containing the full path pointing to the + * directory where the resources reside followed by the package name + * e.g. "/usr/resource/my_app/resources/guimessages" on a Unix system. + * If NULL, ICU default data files will be used. + * + * Unlike POSIX, environment variables are not interpolated within the + * name. + * + * @param locale the locale for which we want to open the resource. If + * NULL, the default ICU locale will be used (see uloc_getDefault). If + * strlen(locale) == 0, the root locale will be used. + * + * @param ec input/output error code. Upon output, + * U_USING_FALLBACK_WARNING indicates that a fallback locale was + * used. For example, 'de_CH' was requested, but nothing was found + * there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that the + * default locale data or root locale data was used; neither the + * requested locale nor any of its fallback locales were found. + * + * @return a message catalog descriptor that may be passed to + * u_catgets(). If the ec parameter indicates success, then the caller + * is responsible for calling u_catclose() to close the message + * catalog. If the ec parameter indicates failure, then NULL will be + * returned. + * + * @stable ICU 2.6 + */ +U_CAPI u_nl_catd U_EXPORT2 +u_catopen(const char* name, const char* locale, UErrorCode* ec); + +/** + * Close an ICU message catalog, given its descriptor. + * + * @param catd a message catalog descriptor to be closed. May be NULL, + * in which case no action is taken. + * + * @stable ICU 2.6 + */ +U_CAPI void U_EXPORT2 +u_catclose(u_nl_catd catd); + +/** + * Retrieve a localized string from an ICU message catalog. + * + * @param catd a message catalog descriptor returned by u_catopen. + * + * @param set_num the message catalog set number. Sets need not be + * numbered consecutively. + * + * @param msg_num the message catalog message number within the + * set. Messages need not be numbered consecutively. + * + * @param s the default string. This is returned if the string + * specified by the set_num and msg_num is not found. It must be + * zero-terminated. + * + * @param len fill-in parameter to receive the length of the result. + * May be NULL, in which case it is ignored. + * + * @param ec input/output error code. May be U_USING_FALLBACK_WARNING + * or U_USING_DEFAULT_WARNING. U_MISSING_RESOURCE_ERROR indicates that + * the set_num/msg_num tuple does not specify a valid message string + * in this catalog. + * + * @return a pointer to a zero-terminated UChar array which lives in + * an internal buffer area, typically a memory mapped/DLL file. The + * caller must NOT delete this pointer. If the call is unsuccessful + * for any reason, then s is returned. This includes the situation in + * which ec indicates a failing error code upon entry to this + * function. + * + * @stable ICU 2.6 + */ +U_CAPI const UChar* U_EXPORT2 +u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num, + const UChar* s, + int32_t* len, UErrorCode* ec); + +U_CDECL_END + +#endif /*UCAT_H*/ +/*eof*/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uchar.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uchar.h new file mode 100644 index 0000000000000000000000000000000000000000..1e0f82e706c482f231e14151052584d8c1009f28 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uchar.h @@ -0,0 +1,4056 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File UCHAR.H +* +* Modification History: +* +* Date Name Description +* 04/02/97 aliu Creation. +* 03/29/99 helena Updated for C APIs. +* 4/15/99 Madhu Updated for C Implementation and Javadoc +* 5/20/99 Madhu Added the function u_getVersion() +* 8/19/1999 srl Upgraded scripts to Unicode 3.0 +* 8/27/1999 schererm UCharDirection constants: U_... +* 11/11/1999 weiv added u_isalnum(), cleaned comments +* 01/11/2000 helena Renamed u_getVersion to u_getUnicodeVersion(). +****************************************************************************** +*/ + +#ifndef UCHAR_H +#define UCHAR_H + +#include "unicode/utypes.h" +#include "unicode/stringoptions.h" +#include "unicode/ucpmap.h" + +#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN) + +#define USET_DEFINED + +/** + * USet is the C API type corresponding to C++ class UnicodeSet. + * It is forward-declared here to avoid including unicode/uset.h file if related + * APIs are not used. + * + * @see ucnv_getUnicodeSet + * @stable ICU 2.4 + */ +typedef struct USet USet; + +#endif + + +U_CDECL_BEGIN + +/*==========================================================================*/ +/* Unicode version number */ +/*==========================================================================*/ +/** + * Unicode version number, default for the current ICU version. + * The actual Unicode Character Database (UCD) data is stored in uprops.dat + * and may be generated from UCD files from a different Unicode version. + * Call u_getUnicodeVersion to get the actual Unicode version of the data. + * + * @see u_getUnicodeVersion + * @stable ICU 2.0 + */ +#define U_UNICODE_VERSION "13.0" + +/** + * \file + * \brief C API: Unicode Properties + * + * This C API provides low-level access to the Unicode Character Database. + * In addition to raw property values, some convenience functions calculate + * derived properties, for example for Java-style programming. + * + * Unicode assigns each code point (not just assigned character) values for + * many properties. + * Most of them are simple boolean flags, or constants from a small enumerated list. + * For some properties, values are strings or other relatively more complex types. + * + * For more information see + * "About the Unicode Character Database" (http://www.unicode.org/ucd/) + * and the ICU User Guide chapter on Properties (http://icu-project.org/userguide/properties.html). + * + * Many properties are accessible via generic functions that take a UProperty selector. + * - u_hasBinaryProperty() returns a binary value (true/false) per property and code point. + * - u_getIntPropertyValue() returns an integer value per property and code point. + * For each supported enumerated or catalog property, there is + * an enum type for all of the property's values, and + * u_getIntPropertyValue() returns the numeric values of those constants. + * - u_getBinaryPropertySet() returns a set for each ICU-supported binary property with + * all code points for which the property is true. + * - u_getIntPropertyMap() returns a map for each + * ICU-supported enumerated/catalog/int-valued property which + * maps all Unicode code points to their values for that property. + * + * Many functions are designed to match java.lang.Character functions. + * See the individual function documentation, + * and see the JDK 1.4 java.lang.Character documentation + * at http://java.sun.com/j2se/1.4/docs/api/java/lang/Character.html + * + * There are also functions that provide easy migration from C/POSIX functions + * like isblank(). Their use is generally discouraged because the C/POSIX + * standards do not define their semantics beyond the ASCII range, which means + * that different implementations exhibit very different behavior. + * Instead, Unicode properties should be used directly. + * + * There are also only a few, broad C/POSIX character classes, and they tend + * to be used for conflicting purposes. For example, the "isalpha()" class + * is sometimes used to determine word boundaries, while a more sophisticated + * approach would at least distinguish initial letters from continuation + * characters (the latter including combining marks). + * (In ICU, BreakIterator is the most sophisticated API for word boundaries.) + * Another example: There is no "istitle()" class for titlecase characters. + * + * ICU 3.4 and later provides API access for all twelve C/POSIX character classes. + * ICU implements them according to the Standard Recommendations in + * Annex C: Compatibility Properties of UTS #18 Unicode Regular Expressions + * (http://www.unicode.org/reports/tr18/#Compatibility_Properties). + * + * API access for C/POSIX character classes is as follows: + * - alpha: u_isUAlphabetic(c) or u_hasBinaryProperty(c, UCHAR_ALPHABETIC) + * - lower: u_isULowercase(c) or u_hasBinaryProperty(c, UCHAR_LOWERCASE) + * - upper: u_isUUppercase(c) or u_hasBinaryProperty(c, UCHAR_UPPERCASE) + * - punct: u_ispunct(c) + * - digit: u_isdigit(c) or u_charType(c)==U_DECIMAL_DIGIT_NUMBER + * - xdigit: u_isxdigit(c) or u_hasBinaryProperty(c, UCHAR_POSIX_XDIGIT) + * - alnum: u_hasBinaryProperty(c, UCHAR_POSIX_ALNUM) + * - space: u_isUWhiteSpace(c) or u_hasBinaryProperty(c, UCHAR_WHITE_SPACE) + * - blank: u_isblank(c) or u_hasBinaryProperty(c, UCHAR_POSIX_BLANK) + * - cntrl: u_charType(c)==U_CONTROL_CHAR + * - graph: u_hasBinaryProperty(c, UCHAR_POSIX_GRAPH) + * - print: u_hasBinaryProperty(c, UCHAR_POSIX_PRINT) + * + * Note: Some of the u_isxyz() functions in uchar.h predate, and do not match, + * the Standard Recommendations in UTS #18. Instead, they match Java + * functions according to their API documentation. + * + * \htmlonly + * The C/POSIX character classes are also available in UnicodeSet patterns, + * using patterns like [:graph:] or \p{graph}. + * \endhtmlonly + * + * Note: There are several ICU whitespace functions. + * Comparison: + * - u_isUWhiteSpace=UCHAR_WHITE_SPACE: Unicode White_Space property; + * most of general categories "Z" (separators) + most whitespace ISO controls + * (including no-break spaces, but excluding IS1..IS4) + * - u_isWhitespace: Java isWhitespace; Z + whitespace ISO controls but excluding no-break spaces + * - u_isJavaSpaceChar: Java isSpaceChar; just Z (including no-break spaces) + * - u_isspace: Z + whitespace ISO controls (including no-break spaces) + * - u_isblank: "horizontal spaces" = TAB + Zs + */ + +/** + * Constants. + */ + +/** The lowest Unicode code point value. Code points are non-negative. @stable ICU 2.0 */ +#define UCHAR_MIN_VALUE 0 + +/** + * The highest Unicode code point value (scalar value) according to + * The Unicode Standard. This is a 21-bit value (20.1 bits, rounded up). + * For a single character, UChar32 is a simple type that can hold any code point value. + * + * @see UChar32 + * @stable ICU 2.0 + */ +#define UCHAR_MAX_VALUE 0x10ffff + +/** + * Get a single-bit bit set (a flag) from a bit number 0..31. + * @stable ICU 2.1 + */ +#define U_MASK(x) ((uint32_t)1<<(x)) + +/** + * Selection constants for Unicode properties. + * These constants are used in functions like u_hasBinaryProperty to select + * one of the Unicode properties. + * + * The properties APIs are intended to reflect Unicode properties as defined + * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR). + * + * For details about the properties see + * UAX #44: Unicode Character Database (http://www.unicode.org/reports/tr44/). + * + * Important: If ICU is built with UCD files from Unicode versions below, e.g., 3.2, + * then properties marked with "new in Unicode 3.2" are not or not fully available. + * Check u_getUnicodeVersion to be sure. + * + * @see u_hasBinaryProperty + * @see u_getIntPropertyValue + * @see u_getUnicodeVersion + * @stable ICU 2.1 + */ +typedef enum UProperty { + /* + * Note: UProperty constants are parsed by preparseucd.py. + * It matches lines like + * UCHAR_=, + */ + + /* Note: Place UCHAR_ALPHABETIC before UCHAR_BINARY_START so that + debuggers display UCHAR_ALPHABETIC as the symbolic name for 0, + rather than UCHAR_BINARY_START. Likewise for other *_START + identifiers. */ + + /** Binary property Alphabetic. Same as u_isUAlphabetic, different from u_isalpha. + Lu+Ll+Lt+Lm+Lo+Nl+Other_Alphabetic @stable ICU 2.1 */ + UCHAR_ALPHABETIC=0, + /** First constant for binary Unicode properties. @stable ICU 2.1 */ + UCHAR_BINARY_START=UCHAR_ALPHABETIC, + /** Binary property ASCII_Hex_Digit. 0-9 A-F a-f @stable ICU 2.1 */ + UCHAR_ASCII_HEX_DIGIT=1, + /** Binary property Bidi_Control. + Format controls which have specific functions + in the Bidi Algorithm. @stable ICU 2.1 */ + UCHAR_BIDI_CONTROL=2, + /** Binary property Bidi_Mirrored. + Characters that may change display in RTL text. + Same as u_isMirrored. + See Bidi Algorithm, UTR 9. @stable ICU 2.1 */ + UCHAR_BIDI_MIRRORED=3, + /** Binary property Dash. Variations of dashes. @stable ICU 2.1 */ + UCHAR_DASH=4, + /** Binary property Default_Ignorable_Code_Point (new in Unicode 3.2). + Ignorable in most processing. + <2060..206F, FFF0..FFFB, E0000..E0FFF>+Other_Default_Ignorable_Code_Point+(Cf+Cc+Cs-White_Space) @stable ICU 2.1 */ + UCHAR_DEFAULT_IGNORABLE_CODE_POINT=5, + /** Binary property Deprecated (new in Unicode 3.2). + The usage of deprecated characters is strongly discouraged. @stable ICU 2.1 */ + UCHAR_DEPRECATED=6, + /** Binary property Diacritic. Characters that linguistically modify + the meaning of another character to which they apply. @stable ICU 2.1 */ + UCHAR_DIACRITIC=7, + /** Binary property Extender. + Extend the value or shape of a preceding alphabetic character, + e.g., length and iteration marks. @stable ICU 2.1 */ + UCHAR_EXTENDER=8, + /** Binary property Full_Composition_Exclusion. + CompositionExclusions.txt+Singleton Decompositions+ + Non-Starter Decompositions. @stable ICU 2.1 */ + UCHAR_FULL_COMPOSITION_EXCLUSION=9, + /** Binary property Grapheme_Base (new in Unicode 3.2). + For programmatic determination of grapheme cluster boundaries. + [0..10FFFF]-Cc-Cf-Cs-Co-Cn-Zl-Zp-Grapheme_Link-Grapheme_Extend-CGJ @stable ICU 2.1 */ + UCHAR_GRAPHEME_BASE=10, + /** Binary property Grapheme_Extend (new in Unicode 3.2). + For programmatic determination of grapheme cluster boundaries. + Me+Mn+Mc+Other_Grapheme_Extend-Grapheme_Link-CGJ @stable ICU 2.1 */ + UCHAR_GRAPHEME_EXTEND=11, + /** Binary property Grapheme_Link (new in Unicode 3.2). + For programmatic determination of grapheme cluster boundaries. @stable ICU 2.1 */ + UCHAR_GRAPHEME_LINK=12, + /** Binary property Hex_Digit. + Characters commonly used for hexadecimal numbers. @stable ICU 2.1 */ + UCHAR_HEX_DIGIT=13, + /** Binary property Hyphen. Dashes used to mark connections + between pieces of words, plus the Katakana middle dot. @stable ICU 2.1 */ + UCHAR_HYPHEN=14, + /** Binary property ID_Continue. + Characters that can continue an identifier. + DerivedCoreProperties.txt also says "NOTE: Cf characters should be filtered out." + ID_Start+Mn+Mc+Nd+Pc @stable ICU 2.1 */ + UCHAR_ID_CONTINUE=15, + /** Binary property ID_Start. + Characters that can start an identifier. + Lu+Ll+Lt+Lm+Lo+Nl @stable ICU 2.1 */ + UCHAR_ID_START=16, + /** Binary property Ideographic. + CJKV ideographs. @stable ICU 2.1 */ + UCHAR_IDEOGRAPHIC=17, + /** Binary property IDS_Binary_Operator (new in Unicode 3.2). + For programmatic determination of + Ideographic Description Sequences. @stable ICU 2.1 */ + UCHAR_IDS_BINARY_OPERATOR=18, + /** Binary property IDS_Trinary_Operator (new in Unicode 3.2). + For programmatic determination of + Ideographic Description Sequences. @stable ICU 2.1 */ + UCHAR_IDS_TRINARY_OPERATOR=19, + /** Binary property Join_Control. + Format controls for cursive joining and ligation. @stable ICU 2.1 */ + UCHAR_JOIN_CONTROL=20, + /** Binary property Logical_Order_Exception (new in Unicode 3.2). + Characters that do not use logical order and + require special handling in most processing. @stable ICU 2.1 */ + UCHAR_LOGICAL_ORDER_EXCEPTION=21, + /** Binary property Lowercase. Same as u_isULowercase, different from u_islower. + Ll+Other_Lowercase @stable ICU 2.1 */ + UCHAR_LOWERCASE=22, + /** Binary property Math. Sm+Other_Math @stable ICU 2.1 */ + UCHAR_MATH=23, + /** Binary property Noncharacter_Code_Point. + Code points that are explicitly defined as illegal + for the encoding of characters. @stable ICU 2.1 */ + UCHAR_NONCHARACTER_CODE_POINT=24, + /** Binary property Quotation_Mark. @stable ICU 2.1 */ + UCHAR_QUOTATION_MARK=25, + /** Binary property Radical (new in Unicode 3.2). + For programmatic determination of + Ideographic Description Sequences. @stable ICU 2.1 */ + UCHAR_RADICAL=26, + /** Binary property Soft_Dotted (new in Unicode 3.2). + Characters with a "soft dot", like i or j. + An accent placed on these characters causes + the dot to disappear. @stable ICU 2.1 */ + UCHAR_SOFT_DOTTED=27, + /** Binary property Terminal_Punctuation. + Punctuation characters that generally mark + the end of textual units. @stable ICU 2.1 */ + UCHAR_TERMINAL_PUNCTUATION=28, + /** Binary property Unified_Ideograph (new in Unicode 3.2). + For programmatic determination of + Ideographic Description Sequences. @stable ICU 2.1 */ + UCHAR_UNIFIED_IDEOGRAPH=29, + /** Binary property Uppercase. Same as u_isUUppercase, different from u_isupper. + Lu+Other_Uppercase @stable ICU 2.1 */ + UCHAR_UPPERCASE=30, + /** Binary property White_Space. + Same as u_isUWhiteSpace, different from u_isspace and u_isWhitespace. + Space characters+TAB+CR+LF-ZWSP-ZWNBSP @stable ICU 2.1 */ + UCHAR_WHITE_SPACE=31, + /** Binary property XID_Continue. + ID_Continue modified to allow closure under + normalization forms NFKC and NFKD. @stable ICU 2.1 */ + UCHAR_XID_CONTINUE=32, + /** Binary property XID_Start. ID_Start modified to allow + closure under normalization forms NFKC and NFKD. @stable ICU 2.1 */ + UCHAR_XID_START=33, + /** Binary property Case_Sensitive. Either the source of a case + mapping or _in_ the target of a case mapping. Not the same as + the general category Cased_Letter. @stable ICU 2.6 */ + UCHAR_CASE_SENSITIVE=34, + /** Binary property STerm (new in Unicode 4.0.1). + Sentence Terminal. Used in UAX #29: Text Boundaries + (http://www.unicode.org/reports/tr29/) + @stable ICU 3.0 */ + UCHAR_S_TERM=35, + /** Binary property Variation_Selector (new in Unicode 4.0.1). + Indicates all those characters that qualify as Variation Selectors. + For details on the behavior of these characters, + see StandardizedVariants.html and 15.6 Variation Selectors. + @stable ICU 3.0 */ + UCHAR_VARIATION_SELECTOR=36, + /** Binary property NFD_Inert. + ICU-specific property for characters that are inert under NFD, + i.e., they do not interact with adjacent characters. + See the documentation for the Normalizer2 class and the + Normalizer2::isInert() method. + @stable ICU 3.0 */ + UCHAR_NFD_INERT=37, + /** Binary property NFKD_Inert. + ICU-specific property for characters that are inert under NFKD, + i.e., they do not interact with adjacent characters. + See the documentation for the Normalizer2 class and the + Normalizer2::isInert() method. + @stable ICU 3.0 */ + UCHAR_NFKD_INERT=38, + /** Binary property NFC_Inert. + ICU-specific property for characters that are inert under NFC, + i.e., they do not interact with adjacent characters. + See the documentation for the Normalizer2 class and the + Normalizer2::isInert() method. + @stable ICU 3.0 */ + UCHAR_NFC_INERT=39, + /** Binary property NFKC_Inert. + ICU-specific property for characters that are inert under NFKC, + i.e., they do not interact with adjacent characters. + See the documentation for the Normalizer2 class and the + Normalizer2::isInert() method. + @stable ICU 3.0 */ + UCHAR_NFKC_INERT=40, + /** Binary Property Segment_Starter. + ICU-specific property for characters that are starters in terms of + Unicode normalization and combining character sequences. + They have ccc=0 and do not occur in non-initial position of the + canonical decomposition of any character + (like a-umlaut in NFD and a Jamo T in an NFD(Hangul LVT)). + ICU uses this property for segmenting a string for generating a set of + canonically equivalent strings, e.g. for canonical closure while + processing collation tailoring rules. + @stable ICU 3.0 */ + UCHAR_SEGMENT_STARTER=41, + /** Binary property Pattern_Syntax (new in Unicode 4.1). + See UAX #31 Identifier and Pattern Syntax + (http://www.unicode.org/reports/tr31/) + @stable ICU 3.4 */ + UCHAR_PATTERN_SYNTAX=42, + /** Binary property Pattern_White_Space (new in Unicode 4.1). + See UAX #31 Identifier and Pattern Syntax + (http://www.unicode.org/reports/tr31/) + @stable ICU 3.4 */ + UCHAR_PATTERN_WHITE_SPACE=43, + /** Binary property alnum (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_ALNUM=44, + /** Binary property blank (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_BLANK=45, + /** Binary property graph (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_GRAPH=46, + /** Binary property print (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_PRINT=47, + /** Binary property xdigit (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_XDIGIT=48, + /** Binary property Cased. For Lowercase, Uppercase and Titlecase characters. @stable ICU 4.4 */ + UCHAR_CASED=49, + /** Binary property Case_Ignorable. Used in context-sensitive case mappings. @stable ICU 4.4 */ + UCHAR_CASE_IGNORABLE=50, + /** Binary property Changes_When_Lowercased. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_LOWERCASED=51, + /** Binary property Changes_When_Uppercased. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_UPPERCASED=52, + /** Binary property Changes_When_Titlecased. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_TITLECASED=53, + /** Binary property Changes_When_Casefolded. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_CASEFOLDED=54, + /** Binary property Changes_When_Casemapped. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_CASEMAPPED=55, + /** Binary property Changes_When_NFKC_Casefolded. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED=56, + /** + * Binary property Emoji. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 57 + */ + UCHAR_EMOJI=57, + /** + * Binary property Emoji_Presentation. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 57 + */ + UCHAR_EMOJI_PRESENTATION=58, + /** + * Binary property Emoji_Modifier. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 57 + */ + UCHAR_EMOJI_MODIFIER=59, + /** + * Binary property Emoji_Modifier_Base. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 57 + */ + UCHAR_EMOJI_MODIFIER_BASE=60, + /** + * Binary property Emoji_Component. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 60 + */ + UCHAR_EMOJI_COMPONENT=61, + /** + * Binary property Regional_Indicator. + * @stable ICU 60 + */ + UCHAR_REGIONAL_INDICATOR=62, + /** + * Binary property Prepended_Concatenation_Mark. + * @stable ICU 60 + */ + UCHAR_PREPENDED_CONCATENATION_MARK=63, + /** + * Binary property Extended_Pictographic. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 62 + */ + UCHAR_EXTENDED_PICTOGRAPHIC=64, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for binary Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_BINARY_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + /** Enumerated property Bidi_Class. + Same as u_charDirection, returns UCharDirection values. @stable ICU 2.2 */ + UCHAR_BIDI_CLASS=0x1000, + /** First constant for enumerated/integer Unicode properties. @stable ICU 2.2 */ + UCHAR_INT_START=UCHAR_BIDI_CLASS, + /** Enumerated property Block. + Same as ublock_getCode, returns UBlockCode values. @stable ICU 2.2 */ + UCHAR_BLOCK=0x1001, + /** Enumerated property Canonical_Combining_Class. + Same as u_getCombiningClass, returns 8-bit numeric values. @stable ICU 2.2 */ + UCHAR_CANONICAL_COMBINING_CLASS=0x1002, + /** Enumerated property Decomposition_Type. + Returns UDecompositionType values. @stable ICU 2.2 */ + UCHAR_DECOMPOSITION_TYPE=0x1003, + /** Enumerated property East_Asian_Width. + See http://www.unicode.org/reports/tr11/ + Returns UEastAsianWidth values. @stable ICU 2.2 */ + UCHAR_EAST_ASIAN_WIDTH=0x1004, + /** Enumerated property General_Category. + Same as u_charType, returns UCharCategory values. @stable ICU 2.2 */ + UCHAR_GENERAL_CATEGORY=0x1005, + /** Enumerated property Joining_Group. + Returns UJoiningGroup values. @stable ICU 2.2 */ + UCHAR_JOINING_GROUP=0x1006, + /** Enumerated property Joining_Type. + Returns UJoiningType values. @stable ICU 2.2 */ + UCHAR_JOINING_TYPE=0x1007, + /** Enumerated property Line_Break. + Returns ULineBreak values. @stable ICU 2.2 */ + UCHAR_LINE_BREAK=0x1008, + /** Enumerated property Numeric_Type. + Returns UNumericType values. @stable ICU 2.2 */ + UCHAR_NUMERIC_TYPE=0x1009, + /** Enumerated property Script. + Same as uscript_getScript, returns UScriptCode values. @stable ICU 2.2 */ + UCHAR_SCRIPT=0x100A, + /** Enumerated property Hangul_Syllable_Type, new in Unicode 4. + Returns UHangulSyllableType values. @stable ICU 2.6 */ + UCHAR_HANGUL_SYLLABLE_TYPE=0x100B, + /** Enumerated property NFD_Quick_Check. + Returns UNormalizationCheckResult values. @stable ICU 3.0 */ + UCHAR_NFD_QUICK_CHECK=0x100C, + /** Enumerated property NFKD_Quick_Check. + Returns UNormalizationCheckResult values. @stable ICU 3.0 */ + UCHAR_NFKD_QUICK_CHECK=0x100D, + /** Enumerated property NFC_Quick_Check. + Returns UNormalizationCheckResult values. @stable ICU 3.0 */ + UCHAR_NFC_QUICK_CHECK=0x100E, + /** Enumerated property NFKC_Quick_Check. + Returns UNormalizationCheckResult values. @stable ICU 3.0 */ + UCHAR_NFKC_QUICK_CHECK=0x100F, + /** Enumerated property Lead_Canonical_Combining_Class. + ICU-specific property for the ccc of the first code point + of the decomposition, or lccc(c)=ccc(NFD(c)[0]). + Useful for checking for canonically ordered text; + see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD . + Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */ + UCHAR_LEAD_CANONICAL_COMBINING_CLASS=0x1010, + /** Enumerated property Trail_Canonical_Combining_Class. + ICU-specific property for the ccc of the last code point + of the decomposition, or tccc(c)=ccc(NFD(c)[last]). + Useful for checking for canonically ordered text; + see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD . + Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */ + UCHAR_TRAIL_CANONICAL_COMBINING_CLASS=0x1011, + /** Enumerated property Grapheme_Cluster_Break (new in Unicode 4.1). + Used in UAX #29: Text Boundaries + (http://www.unicode.org/reports/tr29/) + Returns UGraphemeClusterBreak values. @stable ICU 3.4 */ + UCHAR_GRAPHEME_CLUSTER_BREAK=0x1012, + /** Enumerated property Sentence_Break (new in Unicode 4.1). + Used in UAX #29: Text Boundaries + (http://www.unicode.org/reports/tr29/) + Returns USentenceBreak values. @stable ICU 3.4 */ + UCHAR_SENTENCE_BREAK=0x1013, + /** Enumerated property Word_Break (new in Unicode 4.1). + Used in UAX #29: Text Boundaries + (http://www.unicode.org/reports/tr29/) + Returns UWordBreakValues values. @stable ICU 3.4 */ + UCHAR_WORD_BREAK=0x1014, + /** Enumerated property Bidi_Paired_Bracket_Type (new in Unicode 6.3). + Used in UAX #9: Unicode Bidirectional Algorithm + (http://www.unicode.org/reports/tr9/) + Returns UBidiPairedBracketType values. @stable ICU 52 */ + UCHAR_BIDI_PAIRED_BRACKET_TYPE=0x1015, + /** + * Enumerated property Indic_Positional_Category. + * New in Unicode 6.0 as provisional property Indic_Matra_Category; + * renamed and changed to informative in Unicode 8.0. + * See http://www.unicode.org/reports/tr44/#IndicPositionalCategory.txt + * @stable ICU 63 + */ + UCHAR_INDIC_POSITIONAL_CATEGORY=0x1016, + /** + * Enumerated property Indic_Syllabic_Category. + * New in Unicode 6.0 as provisional; informative since Unicode 8.0. + * See http://www.unicode.org/reports/tr44/#IndicSyllabicCategory.txt + * @stable ICU 63 + */ + UCHAR_INDIC_SYLLABIC_CATEGORY=0x1017, + /** + * Enumerated property Vertical_Orientation. + * Used for UAX #50 Unicode Vertical Text Layout (https://www.unicode.org/reports/tr50/). + * New as a UCD property in Unicode 10.0. + * @stable ICU 63 + */ + UCHAR_VERTICAL_ORIENTATION=0x1018, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for enumerated/integer Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_INT_LIMIT=0x1019, +#endif // U_HIDE_DEPRECATED_API + + /** Bitmask property General_Category_Mask. + This is the General_Category property returned as a bit mask. + When used in u_getIntPropertyValue(c), same as U_MASK(u_charType(c)), + returns bit masks for UCharCategory values where exactly one bit is set. + When used with u_getPropertyValueName() and u_getPropertyValueEnum(), + a multi-bit mask is used for sets of categories like "Letters". + Mask values should be cast to uint32_t. + @stable ICU 2.4 */ + UCHAR_GENERAL_CATEGORY_MASK=0x2000, + /** First constant for bit-mask Unicode properties. @stable ICU 2.4 */ + UCHAR_MASK_START=UCHAR_GENERAL_CATEGORY_MASK, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for bit-mask Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_MASK_LIMIT=0x2001, +#endif // U_HIDE_DEPRECATED_API + + /** Double property Numeric_Value. + Corresponds to u_getNumericValue. @stable ICU 2.4 */ + UCHAR_NUMERIC_VALUE=0x3000, + /** First constant for double Unicode properties. @stable ICU 2.4 */ + UCHAR_DOUBLE_START=UCHAR_NUMERIC_VALUE, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for double Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_DOUBLE_LIMIT=0x3001, +#endif // U_HIDE_DEPRECATED_API + + /** String property Age. + Corresponds to u_charAge. @stable ICU 2.4 */ + UCHAR_AGE=0x4000, + /** First constant for string Unicode properties. @stable ICU 2.4 */ + UCHAR_STRING_START=UCHAR_AGE, + /** String property Bidi_Mirroring_Glyph. + Corresponds to u_charMirror. @stable ICU 2.4 */ + UCHAR_BIDI_MIRRORING_GLYPH=0x4001, + /** String property Case_Folding. + Corresponds to u_strFoldCase in ustring.h. @stable ICU 2.4 */ + UCHAR_CASE_FOLDING=0x4002, +#ifndef U_HIDE_DEPRECATED_API + /** Deprecated string property ISO_Comment. + Corresponds to u_getISOComment. @deprecated ICU 49 */ + UCHAR_ISO_COMMENT=0x4003, +#endif /* U_HIDE_DEPRECATED_API */ + /** String property Lowercase_Mapping. + Corresponds to u_strToLower in ustring.h. @stable ICU 2.4 */ + UCHAR_LOWERCASE_MAPPING=0x4004, + /** String property Name. + Corresponds to u_charName. @stable ICU 2.4 */ + UCHAR_NAME=0x4005, + /** String property Simple_Case_Folding. + Corresponds to u_foldCase. @stable ICU 2.4 */ + UCHAR_SIMPLE_CASE_FOLDING=0x4006, + /** String property Simple_Lowercase_Mapping. + Corresponds to u_tolower. @stable ICU 2.4 */ + UCHAR_SIMPLE_LOWERCASE_MAPPING=0x4007, + /** String property Simple_Titlecase_Mapping. + Corresponds to u_totitle. @stable ICU 2.4 */ + UCHAR_SIMPLE_TITLECASE_MAPPING=0x4008, + /** String property Simple_Uppercase_Mapping. + Corresponds to u_toupper. @stable ICU 2.4 */ + UCHAR_SIMPLE_UPPERCASE_MAPPING=0x4009, + /** String property Titlecase_Mapping. + Corresponds to u_strToTitle in ustring.h. @stable ICU 2.4 */ + UCHAR_TITLECASE_MAPPING=0x400A, +#ifndef U_HIDE_DEPRECATED_API + /** String property Unicode_1_Name. + This property is of little practical value. + Beginning with ICU 49, ICU APIs return an empty string for this property. + Corresponds to u_charName(U_UNICODE_10_CHAR_NAME). @deprecated ICU 49 */ + UCHAR_UNICODE_1_NAME=0x400B, +#endif /* U_HIDE_DEPRECATED_API */ + /** String property Uppercase_Mapping. + Corresponds to u_strToUpper in ustring.h. @stable ICU 2.4 */ + UCHAR_UPPERCASE_MAPPING=0x400C, + /** String property Bidi_Paired_Bracket (new in Unicode 6.3). + Corresponds to u_getBidiPairedBracket. @stable ICU 52 */ + UCHAR_BIDI_PAIRED_BRACKET=0x400D, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for string Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_STRING_LIMIT=0x400E, +#endif // U_HIDE_DEPRECATED_API + + /** Miscellaneous property Script_Extensions (new in Unicode 6.0). + Some characters are commonly used in multiple scripts. + For more information, see UAX #24: http://www.unicode.org/reports/tr24/. + Corresponds to uscript_hasScript and uscript_getScriptExtensions in uscript.h. + @stable ICU 4.6 */ + UCHAR_SCRIPT_EXTENSIONS=0x7000, + /** First constant for Unicode properties with unusual value types. @stable ICU 4.6 */ + UCHAR_OTHER_PROPERTY_START=UCHAR_SCRIPT_EXTENSIONS, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for Unicode properties with unusual value types. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_OTHER_PROPERTY_LIMIT=0x7001, +#endif // U_HIDE_DEPRECATED_API + + /** Represents a nonexistent or invalid property or property value. @stable ICU 2.4 */ + UCHAR_INVALID_CODE = -1 +} UProperty; + +/** + * Data for enumerated Unicode general category types. + * See http://www.unicode.org/Public/UNIDATA/UnicodeData.html . + * @stable ICU 2.0 + */ +typedef enum UCharCategory +{ + /* + * Note: UCharCategory constants and their API comments are parsed by preparseucd.py. + * It matches pairs of lines like + * / ** comment... * / + * U_<[A-Z_]+> = , + */ + + /** Non-category for unassigned and non-character code points. @stable ICU 2.0 */ + U_UNASSIGNED = 0, + /** Cn "Other, Not Assigned (no characters in [UnicodeData.txt] have this property)" (same as U_UNASSIGNED!) @stable ICU 2.0 */ + U_GENERAL_OTHER_TYPES = 0, + /** Lu @stable ICU 2.0 */ + U_UPPERCASE_LETTER = 1, + /** Ll @stable ICU 2.0 */ + U_LOWERCASE_LETTER = 2, + /** Lt @stable ICU 2.0 */ + U_TITLECASE_LETTER = 3, + /** Lm @stable ICU 2.0 */ + U_MODIFIER_LETTER = 4, + /** Lo @stable ICU 2.0 */ + U_OTHER_LETTER = 5, + /** Mn @stable ICU 2.0 */ + U_NON_SPACING_MARK = 6, + /** Me @stable ICU 2.0 */ + U_ENCLOSING_MARK = 7, + /** Mc @stable ICU 2.0 */ + U_COMBINING_SPACING_MARK = 8, + /** Nd @stable ICU 2.0 */ + U_DECIMAL_DIGIT_NUMBER = 9, + /** Nl @stable ICU 2.0 */ + U_LETTER_NUMBER = 10, + /** No @stable ICU 2.0 */ + U_OTHER_NUMBER = 11, + /** Zs @stable ICU 2.0 */ + U_SPACE_SEPARATOR = 12, + /** Zl @stable ICU 2.0 */ + U_LINE_SEPARATOR = 13, + /** Zp @stable ICU 2.0 */ + U_PARAGRAPH_SEPARATOR = 14, + /** Cc @stable ICU 2.0 */ + U_CONTROL_CHAR = 15, + /** Cf @stable ICU 2.0 */ + U_FORMAT_CHAR = 16, + /** Co @stable ICU 2.0 */ + U_PRIVATE_USE_CHAR = 17, + /** Cs @stable ICU 2.0 */ + U_SURROGATE = 18, + /** Pd @stable ICU 2.0 */ + U_DASH_PUNCTUATION = 19, + /** Ps @stable ICU 2.0 */ + U_START_PUNCTUATION = 20, + /** Pe @stable ICU 2.0 */ + U_END_PUNCTUATION = 21, + /** Pc @stable ICU 2.0 */ + U_CONNECTOR_PUNCTUATION = 22, + /** Po @stable ICU 2.0 */ + U_OTHER_PUNCTUATION = 23, + /** Sm @stable ICU 2.0 */ + U_MATH_SYMBOL = 24, + /** Sc @stable ICU 2.0 */ + U_CURRENCY_SYMBOL = 25, + /** Sk @stable ICU 2.0 */ + U_MODIFIER_SYMBOL = 26, + /** So @stable ICU 2.0 */ + U_OTHER_SYMBOL = 27, + /** Pi @stable ICU 2.0 */ + U_INITIAL_PUNCTUATION = 28, + /** Pf @stable ICU 2.0 */ + U_FINAL_PUNCTUATION = 29, + /** + * One higher than the last enum UCharCategory constant. + * This numeric value is stable (will not change), see + * http://www.unicode.org/policies/stability_policy.html#Property_Value + * + * @stable ICU 2.0 + */ + U_CHAR_CATEGORY_COUNT +} UCharCategory; + +/** + * U_GC_XX_MASK constants are bit flags corresponding to Unicode + * general category values. + * For each category, the nth bit is set if the numeric value of the + * corresponding UCharCategory constant is n. + * + * There are also some U_GC_Y_MASK constants for groups of general categories + * like L for all letter categories. + * + * @see u_charType + * @see U_GET_GC_MASK + * @see UCharCategory + * @stable ICU 2.1 + */ +#define U_GC_CN_MASK U_MASK(U_GENERAL_OTHER_TYPES) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LU_MASK U_MASK(U_UPPERCASE_LETTER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LL_MASK U_MASK(U_LOWERCASE_LETTER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LT_MASK U_MASK(U_TITLECASE_LETTER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LM_MASK U_MASK(U_MODIFIER_LETTER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LO_MASK U_MASK(U_OTHER_LETTER) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_MN_MASK U_MASK(U_NON_SPACING_MARK) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ME_MASK U_MASK(U_ENCLOSING_MARK) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_MC_MASK U_MASK(U_COMBINING_SPACING_MARK) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ND_MASK U_MASK(U_DECIMAL_DIGIT_NUMBER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_NL_MASK U_MASK(U_LETTER_NUMBER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_NO_MASK U_MASK(U_OTHER_NUMBER) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ZS_MASK U_MASK(U_SPACE_SEPARATOR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ZL_MASK U_MASK(U_LINE_SEPARATOR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ZP_MASK U_MASK(U_PARAGRAPH_SEPARATOR) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_CC_MASK U_MASK(U_CONTROL_CHAR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_CF_MASK U_MASK(U_FORMAT_CHAR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_CO_MASK U_MASK(U_PRIVATE_USE_CHAR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_CS_MASK U_MASK(U_SURROGATE) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PD_MASK U_MASK(U_DASH_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PS_MASK U_MASK(U_START_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PE_MASK U_MASK(U_END_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PC_MASK U_MASK(U_CONNECTOR_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PO_MASK U_MASK(U_OTHER_PUNCTUATION) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_SM_MASK U_MASK(U_MATH_SYMBOL) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_SC_MASK U_MASK(U_CURRENCY_SYMBOL) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_SK_MASK U_MASK(U_MODIFIER_SYMBOL) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_SO_MASK U_MASK(U_OTHER_SYMBOL) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PI_MASK U_MASK(U_INITIAL_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PF_MASK U_MASK(U_FINAL_PUNCTUATION) + + +/** Mask constant for multiple UCharCategory bits (L Letters). @stable ICU 2.1 */ +#define U_GC_L_MASK \ + (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK|U_GC_LM_MASK|U_GC_LO_MASK) + +/** Mask constant for multiple UCharCategory bits (LC Cased Letters). @stable ICU 2.1 */ +#define U_GC_LC_MASK \ + (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK) + +/** Mask constant for multiple UCharCategory bits (M Marks). @stable ICU 2.1 */ +#define U_GC_M_MASK (U_GC_MN_MASK|U_GC_ME_MASK|U_GC_MC_MASK) + +/** Mask constant for multiple UCharCategory bits (N Numbers). @stable ICU 2.1 */ +#define U_GC_N_MASK (U_GC_ND_MASK|U_GC_NL_MASK|U_GC_NO_MASK) + +/** Mask constant for multiple UCharCategory bits (Z Separators). @stable ICU 2.1 */ +#define U_GC_Z_MASK (U_GC_ZS_MASK|U_GC_ZL_MASK|U_GC_ZP_MASK) + +/** Mask constant for multiple UCharCategory bits (C Others). @stable ICU 2.1 */ +#define U_GC_C_MASK \ + (U_GC_CN_MASK|U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CO_MASK|U_GC_CS_MASK) + +/** Mask constant for multiple UCharCategory bits (P Punctuation). @stable ICU 2.1 */ +#define U_GC_P_MASK \ + (U_GC_PD_MASK|U_GC_PS_MASK|U_GC_PE_MASK|U_GC_PC_MASK|U_GC_PO_MASK| \ + U_GC_PI_MASK|U_GC_PF_MASK) + +/** Mask constant for multiple UCharCategory bits (S Symbols). @stable ICU 2.1 */ +#define U_GC_S_MASK (U_GC_SM_MASK|U_GC_SC_MASK|U_GC_SK_MASK|U_GC_SO_MASK) + +/** + * This specifies the language directional property of a character set. + * @stable ICU 2.0 + */ +typedef enum UCharDirection { + /* + * Note: UCharDirection constants and their API comments are parsed by preparseucd.py. + * It matches pairs of lines like + * / ** comment... * / + * U_<[A-Z_]+> = , + */ + + /** L @stable ICU 2.0 */ + U_LEFT_TO_RIGHT = 0, + /** R @stable ICU 2.0 */ + U_RIGHT_TO_LEFT = 1, + /** EN @stable ICU 2.0 */ + U_EUROPEAN_NUMBER = 2, + /** ES @stable ICU 2.0 */ + U_EUROPEAN_NUMBER_SEPARATOR = 3, + /** ET @stable ICU 2.0 */ + U_EUROPEAN_NUMBER_TERMINATOR = 4, + /** AN @stable ICU 2.0 */ + U_ARABIC_NUMBER = 5, + /** CS @stable ICU 2.0 */ + U_COMMON_NUMBER_SEPARATOR = 6, + /** B @stable ICU 2.0 */ + U_BLOCK_SEPARATOR = 7, + /** S @stable ICU 2.0 */ + U_SEGMENT_SEPARATOR = 8, + /** WS @stable ICU 2.0 */ + U_WHITE_SPACE_NEUTRAL = 9, + /** ON @stable ICU 2.0 */ + U_OTHER_NEUTRAL = 10, + /** LRE @stable ICU 2.0 */ + U_LEFT_TO_RIGHT_EMBEDDING = 11, + /** LRO @stable ICU 2.0 */ + U_LEFT_TO_RIGHT_OVERRIDE = 12, + /** AL @stable ICU 2.0 */ + U_RIGHT_TO_LEFT_ARABIC = 13, + /** RLE @stable ICU 2.0 */ + U_RIGHT_TO_LEFT_EMBEDDING = 14, + /** RLO @stable ICU 2.0 */ + U_RIGHT_TO_LEFT_OVERRIDE = 15, + /** PDF @stable ICU 2.0 */ + U_POP_DIRECTIONAL_FORMAT = 16, + /** NSM @stable ICU 2.0 */ + U_DIR_NON_SPACING_MARK = 17, + /** BN @stable ICU 2.0 */ + U_BOUNDARY_NEUTRAL = 18, + /** FSI @stable ICU 52 */ + U_FIRST_STRONG_ISOLATE = 19, + /** LRI @stable ICU 52 */ + U_LEFT_TO_RIGHT_ISOLATE = 20, + /** RLI @stable ICU 52 */ + U_RIGHT_TO_LEFT_ISOLATE = 21, + /** PDI @stable ICU 52 */ + U_POP_DIRECTIONAL_ISOLATE = 22, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest UCharDirection value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_CHAR_DIRECTION_COUNT +#endif // U_HIDE_DEPRECATED_API +} UCharDirection; + +/** + * Bidi Paired Bracket Type constants. + * + * @see UCHAR_BIDI_PAIRED_BRACKET_TYPE + * @stable ICU 52 + */ +typedef enum UBidiPairedBracketType { + /* + * Note: UBidiPairedBracketType constants are parsed by preparseucd.py. + * It matches lines like + * U_BPT_ + */ + + /** Not a paired bracket. @stable ICU 52 */ + U_BPT_NONE, + /** Open paired bracket. @stable ICU 52 */ + U_BPT_OPEN, + /** Close paired bracket. @stable ICU 52 */ + U_BPT_CLOSE, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UBidiPairedBracketType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_BIDI_PAIRED_BRACKET_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_BPT_COUNT /* 3 */ +#endif // U_HIDE_DEPRECATED_API +} UBidiPairedBracketType; + +/** + * Constants for Unicode blocks, see the Unicode Data file Blocks.txt + * @stable ICU 2.0 + */ +enum UBlockCode { + /* + * Note: UBlockCode constants are parsed by preparseucd.py. + * It matches lines like + * UBLOCK_ = , + */ + + /** New No_Block value in Unicode 4. @stable ICU 2.6 */ + UBLOCK_NO_BLOCK = 0, /*[none]*/ /* Special range indicating No_Block */ + + /** @stable ICU 2.0 */ + UBLOCK_BASIC_LATIN = 1, /*[0000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LATIN_1_SUPPLEMENT=2, /*[0080]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LATIN_EXTENDED_A =3, /*[0100]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LATIN_EXTENDED_B =4, /*[0180]*/ + + /** @stable ICU 2.0 */ + UBLOCK_IPA_EXTENSIONS =5, /*[0250]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SPACING_MODIFIER_LETTERS =6, /*[02B0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_COMBINING_DIACRITICAL_MARKS =7, /*[0300]*/ + + /** + * Unicode 3.2 renames this block to "Greek and Coptic". + * @stable ICU 2.0 + */ + UBLOCK_GREEK =8, /*[0370]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CYRILLIC =9, /*[0400]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARMENIAN =10, /*[0530]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HEBREW =11, /*[0590]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARABIC =12, /*[0600]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SYRIAC =13, /*[0700]*/ + + /** @stable ICU 2.0 */ + UBLOCK_THAANA =14, /*[0780]*/ + + /** @stable ICU 2.0 */ + UBLOCK_DEVANAGARI =15, /*[0900]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BENGALI =16, /*[0980]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GURMUKHI =17, /*[0A00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GUJARATI =18, /*[0A80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ORIYA =19, /*[0B00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_TAMIL =20, /*[0B80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_TELUGU =21, /*[0C00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KANNADA =22, /*[0C80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MALAYALAM =23, /*[0D00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SINHALA =24, /*[0D80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_THAI =25, /*[0E00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LAO =26, /*[0E80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_TIBETAN =27, /*[0F00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MYANMAR =28, /*[1000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GEORGIAN =29, /*[10A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HANGUL_JAMO =30, /*[1100]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ETHIOPIC =31, /*[1200]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CHEROKEE =32, /*[13A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS =33, /*[1400]*/ + + /** @stable ICU 2.0 */ + UBLOCK_OGHAM =34, /*[1680]*/ + + /** @stable ICU 2.0 */ + UBLOCK_RUNIC =35, /*[16A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KHMER =36, /*[1780]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MONGOLIAN =37, /*[1800]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LATIN_EXTENDED_ADDITIONAL =38, /*[1E00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GREEK_EXTENDED =39, /*[1F00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GENERAL_PUNCTUATION =40, /*[2000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SUPERSCRIPTS_AND_SUBSCRIPTS =41, /*[2070]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CURRENCY_SYMBOLS =42, /*[20A0]*/ + + /** + * Unicode 3.2 renames this block to "Combining Diacritical Marks for Symbols". + * @stable ICU 2.0 + */ + UBLOCK_COMBINING_MARKS_FOR_SYMBOLS =43, /*[20D0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LETTERLIKE_SYMBOLS =44, /*[2100]*/ + + /** @stable ICU 2.0 */ + UBLOCK_NUMBER_FORMS =45, /*[2150]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARROWS =46, /*[2190]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MATHEMATICAL_OPERATORS =47, /*[2200]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MISCELLANEOUS_TECHNICAL =48, /*[2300]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CONTROL_PICTURES =49, /*[2400]*/ + + /** @stable ICU 2.0 */ + UBLOCK_OPTICAL_CHARACTER_RECOGNITION =50, /*[2440]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ENCLOSED_ALPHANUMERICS =51, /*[2460]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BOX_DRAWING =52, /*[2500]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BLOCK_ELEMENTS =53, /*[2580]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GEOMETRIC_SHAPES =54, /*[25A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MISCELLANEOUS_SYMBOLS =55, /*[2600]*/ + + /** @stable ICU 2.0 */ + UBLOCK_DINGBATS =56, /*[2700]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BRAILLE_PATTERNS =57, /*[2800]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_RADICALS_SUPPLEMENT =58, /*[2E80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KANGXI_RADICALS =59, /*[2F00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS =60, /*[2FF0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION =61, /*[3000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HIRAGANA =62, /*[3040]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KATAKANA =63, /*[30A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BOPOMOFO =64, /*[3100]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HANGUL_COMPATIBILITY_JAMO =65, /*[3130]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KANBUN =66, /*[3190]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BOPOMOFO_EXTENDED =67, /*[31A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS =68, /*[3200]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_COMPATIBILITY =69, /*[3300]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A =70, /*[3400]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS =71, /*[4E00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_YI_SYLLABLES =72, /*[A000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_YI_RADICALS =73, /*[A490]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HANGUL_SYLLABLES =74, /*[AC00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HIGH_SURROGATES =75, /*[D800]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HIGH_PRIVATE_USE_SURROGATES =76, /*[DB80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LOW_SURROGATES =77, /*[DC00]*/ + + /** + * Same as UBLOCK_PRIVATE_USE. + * Until Unicode 3.1.1, the corresponding block name was "Private Use", + * and multiple code point ranges had this block. + * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and + * adds separate blocks for the supplementary PUAs. + * + * @stable ICU 2.0 + */ + UBLOCK_PRIVATE_USE_AREA =78, /*[E000]*/ + /** + * Same as UBLOCK_PRIVATE_USE_AREA. + * Until Unicode 3.1.1, the corresponding block name was "Private Use", + * and multiple code point ranges had this block. + * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and + * adds separate blocks for the supplementary PUAs. + * + * @stable ICU 2.0 + */ + UBLOCK_PRIVATE_USE = UBLOCK_PRIVATE_USE_AREA, + + /** @stable ICU 2.0 */ + UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS =79, /*[F900]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ALPHABETIC_PRESENTATION_FORMS =80, /*[FB00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARABIC_PRESENTATION_FORMS_A =81, /*[FB50]*/ + + /** @stable ICU 2.0 */ + UBLOCK_COMBINING_HALF_MARKS =82, /*[FE20]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_COMPATIBILITY_FORMS =83, /*[FE30]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SMALL_FORM_VARIANTS =84, /*[FE50]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARABIC_PRESENTATION_FORMS_B =85, /*[FE70]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SPECIALS =86, /*[FFF0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS =87, /*[FF00]*/ + + /* New blocks in Unicode 3.1 */ + + /** @stable ICU 2.0 */ + UBLOCK_OLD_ITALIC = 88, /*[10300]*/ + /** @stable ICU 2.0 */ + UBLOCK_GOTHIC = 89, /*[10330]*/ + /** @stable ICU 2.0 */ + UBLOCK_DESERET = 90, /*[10400]*/ + /** @stable ICU 2.0 */ + UBLOCK_BYZANTINE_MUSICAL_SYMBOLS = 91, /*[1D000]*/ + /** @stable ICU 2.0 */ + UBLOCK_MUSICAL_SYMBOLS = 92, /*[1D100]*/ + /** @stable ICU 2.0 */ + UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 93, /*[1D400]*/ + /** @stable ICU 2.0 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B = 94, /*[20000]*/ + /** @stable ICU 2.0 */ + UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = 95, /*[2F800]*/ + /** @stable ICU 2.0 */ + UBLOCK_TAGS = 96, /*[E0000]*/ + + /* New blocks in Unicode 3.2 */ + + /** @stable ICU 3.0 */ + UBLOCK_CYRILLIC_SUPPLEMENT = 97, /*[0500]*/ + /** + * Unicode 4.0.1 renames the "Cyrillic Supplementary" block to "Cyrillic Supplement". + * @stable ICU 2.2 + */ + UBLOCK_CYRILLIC_SUPPLEMENTARY = UBLOCK_CYRILLIC_SUPPLEMENT, + /** @stable ICU 2.2 */ + UBLOCK_TAGALOG = 98, /*[1700]*/ + /** @stable ICU 2.2 */ + UBLOCK_HANUNOO = 99, /*[1720]*/ + /** @stable ICU 2.2 */ + UBLOCK_BUHID = 100, /*[1740]*/ + /** @stable ICU 2.2 */ + UBLOCK_TAGBANWA = 101, /*[1760]*/ + /** @stable ICU 2.2 */ + UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = 102, /*[27C0]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTAL_ARROWS_A = 103, /*[27F0]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTAL_ARROWS_B = 104, /*[2900]*/ + /** @stable ICU 2.2 */ + UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = 105, /*[2980]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS = 106, /*[2A00]*/ + /** @stable ICU 2.2 */ + UBLOCK_KATAKANA_PHONETIC_EXTENSIONS = 107, /*[31F0]*/ + /** @stable ICU 2.2 */ + UBLOCK_VARIATION_SELECTORS = 108, /*[FE00]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_A = 109, /*[F0000]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B = 110, /*[100000]*/ + + /* New blocks in Unicode 4 */ + + /** @stable ICU 2.6 */ + UBLOCK_LIMBU = 111, /*[1900]*/ + /** @stable ICU 2.6 */ + UBLOCK_TAI_LE = 112, /*[1950]*/ + /** @stable ICU 2.6 */ + UBLOCK_KHMER_SYMBOLS = 113, /*[19E0]*/ + /** @stable ICU 2.6 */ + UBLOCK_PHONETIC_EXTENSIONS = 114, /*[1D00]*/ + /** @stable ICU 2.6 */ + UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS = 115, /*[2B00]*/ + /** @stable ICU 2.6 */ + UBLOCK_YIJING_HEXAGRAM_SYMBOLS = 116, /*[4DC0]*/ + /** @stable ICU 2.6 */ + UBLOCK_LINEAR_B_SYLLABARY = 117, /*[10000]*/ + /** @stable ICU 2.6 */ + UBLOCK_LINEAR_B_IDEOGRAMS = 118, /*[10080]*/ + /** @stable ICU 2.6 */ + UBLOCK_AEGEAN_NUMBERS = 119, /*[10100]*/ + /** @stable ICU 2.6 */ + UBLOCK_UGARITIC = 120, /*[10380]*/ + /** @stable ICU 2.6 */ + UBLOCK_SHAVIAN = 121, /*[10450]*/ + /** @stable ICU 2.6 */ + UBLOCK_OSMANYA = 122, /*[10480]*/ + /** @stable ICU 2.6 */ + UBLOCK_CYPRIOT_SYLLABARY = 123, /*[10800]*/ + /** @stable ICU 2.6 */ + UBLOCK_TAI_XUAN_JING_SYMBOLS = 124, /*[1D300]*/ + /** @stable ICU 2.6 */ + UBLOCK_VARIATION_SELECTORS_SUPPLEMENT = 125, /*[E0100]*/ + + /* New blocks in Unicode 4.1 */ + + /** @stable ICU 3.4 */ + UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION = 126, /*[1D200]*/ + /** @stable ICU 3.4 */ + UBLOCK_ANCIENT_GREEK_NUMBERS = 127, /*[10140]*/ + /** @stable ICU 3.4 */ + UBLOCK_ARABIC_SUPPLEMENT = 128, /*[0750]*/ + /** @stable ICU 3.4 */ + UBLOCK_BUGINESE = 129, /*[1A00]*/ + /** @stable ICU 3.4 */ + UBLOCK_CJK_STROKES = 130, /*[31C0]*/ + /** @stable ICU 3.4 */ + UBLOCK_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT = 131, /*[1DC0]*/ + /** @stable ICU 3.4 */ + UBLOCK_COPTIC = 132, /*[2C80]*/ + /** @stable ICU 3.4 */ + UBLOCK_ETHIOPIC_EXTENDED = 133, /*[2D80]*/ + /** @stable ICU 3.4 */ + UBLOCK_ETHIOPIC_SUPPLEMENT = 134, /*[1380]*/ + /** @stable ICU 3.4 */ + UBLOCK_GEORGIAN_SUPPLEMENT = 135, /*[2D00]*/ + /** @stable ICU 3.4 */ + UBLOCK_GLAGOLITIC = 136, /*[2C00]*/ + /** @stable ICU 3.4 */ + UBLOCK_KHAROSHTHI = 137, /*[10A00]*/ + /** @stable ICU 3.4 */ + UBLOCK_MODIFIER_TONE_LETTERS = 138, /*[A700]*/ + /** @stable ICU 3.4 */ + UBLOCK_NEW_TAI_LUE = 139, /*[1980]*/ + /** @stable ICU 3.4 */ + UBLOCK_OLD_PERSIAN = 140, /*[103A0]*/ + /** @stable ICU 3.4 */ + UBLOCK_PHONETIC_EXTENSIONS_SUPPLEMENT = 141, /*[1D80]*/ + /** @stable ICU 3.4 */ + UBLOCK_SUPPLEMENTAL_PUNCTUATION = 142, /*[2E00]*/ + /** @stable ICU 3.4 */ + UBLOCK_SYLOTI_NAGRI = 143, /*[A800]*/ + /** @stable ICU 3.4 */ + UBLOCK_TIFINAGH = 144, /*[2D30]*/ + /** @stable ICU 3.4 */ + UBLOCK_VERTICAL_FORMS = 145, /*[FE10]*/ + + /* New blocks in Unicode 5.0 */ + + /** @stable ICU 3.6 */ + UBLOCK_NKO = 146, /*[07C0]*/ + /** @stable ICU 3.6 */ + UBLOCK_BALINESE = 147, /*[1B00]*/ + /** @stable ICU 3.6 */ + UBLOCK_LATIN_EXTENDED_C = 148, /*[2C60]*/ + /** @stable ICU 3.6 */ + UBLOCK_LATIN_EXTENDED_D = 149, /*[A720]*/ + /** @stable ICU 3.6 */ + UBLOCK_PHAGS_PA = 150, /*[A840]*/ + /** @stable ICU 3.6 */ + UBLOCK_PHOENICIAN = 151, /*[10900]*/ + /** @stable ICU 3.6 */ + UBLOCK_CUNEIFORM = 152, /*[12000]*/ + /** @stable ICU 3.6 */ + UBLOCK_CUNEIFORM_NUMBERS_AND_PUNCTUATION = 153, /*[12400]*/ + /** @stable ICU 3.6 */ + UBLOCK_COUNTING_ROD_NUMERALS = 154, /*[1D360]*/ + + /* New blocks in Unicode 5.1 */ + + /** @stable ICU 4.0 */ + UBLOCK_SUNDANESE = 155, /*[1B80]*/ + /** @stable ICU 4.0 */ + UBLOCK_LEPCHA = 156, /*[1C00]*/ + /** @stable ICU 4.0 */ + UBLOCK_OL_CHIKI = 157, /*[1C50]*/ + /** @stable ICU 4.0 */ + UBLOCK_CYRILLIC_EXTENDED_A = 158, /*[2DE0]*/ + /** @stable ICU 4.0 */ + UBLOCK_VAI = 159, /*[A500]*/ + /** @stable ICU 4.0 */ + UBLOCK_CYRILLIC_EXTENDED_B = 160, /*[A640]*/ + /** @stable ICU 4.0 */ + UBLOCK_SAURASHTRA = 161, /*[A880]*/ + /** @stable ICU 4.0 */ + UBLOCK_KAYAH_LI = 162, /*[A900]*/ + /** @stable ICU 4.0 */ + UBLOCK_REJANG = 163, /*[A930]*/ + /** @stable ICU 4.0 */ + UBLOCK_CHAM = 164, /*[AA00]*/ + /** @stable ICU 4.0 */ + UBLOCK_ANCIENT_SYMBOLS = 165, /*[10190]*/ + /** @stable ICU 4.0 */ + UBLOCK_PHAISTOS_DISC = 166, /*[101D0]*/ + /** @stable ICU 4.0 */ + UBLOCK_LYCIAN = 167, /*[10280]*/ + /** @stable ICU 4.0 */ + UBLOCK_CARIAN = 168, /*[102A0]*/ + /** @stable ICU 4.0 */ + UBLOCK_LYDIAN = 169, /*[10920]*/ + /** @stable ICU 4.0 */ + UBLOCK_MAHJONG_TILES = 170, /*[1F000]*/ + /** @stable ICU 4.0 */ + UBLOCK_DOMINO_TILES = 171, /*[1F030]*/ + + /* New blocks in Unicode 5.2 */ + + /** @stable ICU 4.4 */ + UBLOCK_SAMARITAN = 172, /*[0800]*/ + /** @stable ICU 4.4 */ + UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = 173, /*[18B0]*/ + /** @stable ICU 4.4 */ + UBLOCK_TAI_THAM = 174, /*[1A20]*/ + /** @stable ICU 4.4 */ + UBLOCK_VEDIC_EXTENSIONS = 175, /*[1CD0]*/ + /** @stable ICU 4.4 */ + UBLOCK_LISU = 176, /*[A4D0]*/ + /** @stable ICU 4.4 */ + UBLOCK_BAMUM = 177, /*[A6A0]*/ + /** @stable ICU 4.4 */ + UBLOCK_COMMON_INDIC_NUMBER_FORMS = 178, /*[A830]*/ + /** @stable ICU 4.4 */ + UBLOCK_DEVANAGARI_EXTENDED = 179, /*[A8E0]*/ + /** @stable ICU 4.4 */ + UBLOCK_HANGUL_JAMO_EXTENDED_A = 180, /*[A960]*/ + /** @stable ICU 4.4 */ + UBLOCK_JAVANESE = 181, /*[A980]*/ + /** @stable ICU 4.4 */ + UBLOCK_MYANMAR_EXTENDED_A = 182, /*[AA60]*/ + /** @stable ICU 4.4 */ + UBLOCK_TAI_VIET = 183, /*[AA80]*/ + /** @stable ICU 4.4 */ + UBLOCK_MEETEI_MAYEK = 184, /*[ABC0]*/ + /** @stable ICU 4.4 */ + UBLOCK_HANGUL_JAMO_EXTENDED_B = 185, /*[D7B0]*/ + /** @stable ICU 4.4 */ + UBLOCK_IMPERIAL_ARAMAIC = 186, /*[10840]*/ + /** @stable ICU 4.4 */ + UBLOCK_OLD_SOUTH_ARABIAN = 187, /*[10A60]*/ + /** @stable ICU 4.4 */ + UBLOCK_AVESTAN = 188, /*[10B00]*/ + /** @stable ICU 4.4 */ + UBLOCK_INSCRIPTIONAL_PARTHIAN = 189, /*[10B40]*/ + /** @stable ICU 4.4 */ + UBLOCK_INSCRIPTIONAL_PAHLAVI = 190, /*[10B60]*/ + /** @stable ICU 4.4 */ + UBLOCK_OLD_TURKIC = 191, /*[10C00]*/ + /** @stable ICU 4.4 */ + UBLOCK_RUMI_NUMERAL_SYMBOLS = 192, /*[10E60]*/ + /** @stable ICU 4.4 */ + UBLOCK_KAITHI = 193, /*[11080]*/ + /** @stable ICU 4.4 */ + UBLOCK_EGYPTIAN_HIEROGLYPHS = 194, /*[13000]*/ + /** @stable ICU 4.4 */ + UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT = 195, /*[1F100]*/ + /** @stable ICU 4.4 */ + UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = 196, /*[1F200]*/ + /** @stable ICU 4.4 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = 197, /*[2A700]*/ + + /* New blocks in Unicode 6.0 */ + + /** @stable ICU 4.6 */ + UBLOCK_MANDAIC = 198, /*[0840]*/ + /** @stable ICU 4.6 */ + UBLOCK_BATAK = 199, /*[1BC0]*/ + /** @stable ICU 4.6 */ + UBLOCK_ETHIOPIC_EXTENDED_A = 200, /*[AB00]*/ + /** @stable ICU 4.6 */ + UBLOCK_BRAHMI = 201, /*[11000]*/ + /** @stable ICU 4.6 */ + UBLOCK_BAMUM_SUPPLEMENT = 202, /*[16800]*/ + /** @stable ICU 4.6 */ + UBLOCK_KANA_SUPPLEMENT = 203, /*[1B000]*/ + /** @stable ICU 4.6 */ + UBLOCK_PLAYING_CARDS = 204, /*[1F0A0]*/ + /** @stable ICU 4.6 */ + UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS = 205, /*[1F300]*/ + /** @stable ICU 4.6 */ + UBLOCK_EMOTICONS = 206, /*[1F600]*/ + /** @stable ICU 4.6 */ + UBLOCK_TRANSPORT_AND_MAP_SYMBOLS = 207, /*[1F680]*/ + /** @stable ICU 4.6 */ + UBLOCK_ALCHEMICAL_SYMBOLS = 208, /*[1F700]*/ + /** @stable ICU 4.6 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D = 209, /*[2B740]*/ + + /* New blocks in Unicode 6.1 */ + + /** @stable ICU 49 */ + UBLOCK_ARABIC_EXTENDED_A = 210, /*[08A0]*/ + /** @stable ICU 49 */ + UBLOCK_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS = 211, /*[1EE00]*/ + /** @stable ICU 49 */ + UBLOCK_CHAKMA = 212, /*[11100]*/ + /** @stable ICU 49 */ + UBLOCK_MEETEI_MAYEK_EXTENSIONS = 213, /*[AAE0]*/ + /** @stable ICU 49 */ + UBLOCK_MEROITIC_CURSIVE = 214, /*[109A0]*/ + /** @stable ICU 49 */ + UBLOCK_MEROITIC_HIEROGLYPHS = 215, /*[10980]*/ + /** @stable ICU 49 */ + UBLOCK_MIAO = 216, /*[16F00]*/ + /** @stable ICU 49 */ + UBLOCK_SHARADA = 217, /*[11180]*/ + /** @stable ICU 49 */ + UBLOCK_SORA_SOMPENG = 218, /*[110D0]*/ + /** @stable ICU 49 */ + UBLOCK_SUNDANESE_SUPPLEMENT = 219, /*[1CC0]*/ + /** @stable ICU 49 */ + UBLOCK_TAKRI = 220, /*[11680]*/ + + /* New blocks in Unicode 7.0 */ + + /** @stable ICU 54 */ + UBLOCK_BASSA_VAH = 221, /*[16AD0]*/ + /** @stable ICU 54 */ + UBLOCK_CAUCASIAN_ALBANIAN = 222, /*[10530]*/ + /** @stable ICU 54 */ + UBLOCK_COPTIC_EPACT_NUMBERS = 223, /*[102E0]*/ + /** @stable ICU 54 */ + UBLOCK_COMBINING_DIACRITICAL_MARKS_EXTENDED = 224, /*[1AB0]*/ + /** @stable ICU 54 */ + UBLOCK_DUPLOYAN = 225, /*[1BC00]*/ + /** @stable ICU 54 */ + UBLOCK_ELBASAN = 226, /*[10500]*/ + /** @stable ICU 54 */ + UBLOCK_GEOMETRIC_SHAPES_EXTENDED = 227, /*[1F780]*/ + /** @stable ICU 54 */ + UBLOCK_GRANTHA = 228, /*[11300]*/ + /** @stable ICU 54 */ + UBLOCK_KHOJKI = 229, /*[11200]*/ + /** @stable ICU 54 */ + UBLOCK_KHUDAWADI = 230, /*[112B0]*/ + /** @stable ICU 54 */ + UBLOCK_LATIN_EXTENDED_E = 231, /*[AB30]*/ + /** @stable ICU 54 */ + UBLOCK_LINEAR_A = 232, /*[10600]*/ + /** @stable ICU 54 */ + UBLOCK_MAHAJANI = 233, /*[11150]*/ + /** @stable ICU 54 */ + UBLOCK_MANICHAEAN = 234, /*[10AC0]*/ + /** @stable ICU 54 */ + UBLOCK_MENDE_KIKAKUI = 235, /*[1E800]*/ + /** @stable ICU 54 */ + UBLOCK_MODI = 236, /*[11600]*/ + /** @stable ICU 54 */ + UBLOCK_MRO = 237, /*[16A40]*/ + /** @stable ICU 54 */ + UBLOCK_MYANMAR_EXTENDED_B = 238, /*[A9E0]*/ + /** @stable ICU 54 */ + UBLOCK_NABATAEAN = 239, /*[10880]*/ + /** @stable ICU 54 */ + UBLOCK_OLD_NORTH_ARABIAN = 240, /*[10A80]*/ + /** @stable ICU 54 */ + UBLOCK_OLD_PERMIC = 241, /*[10350]*/ + /** @stable ICU 54 */ + UBLOCK_ORNAMENTAL_DINGBATS = 242, /*[1F650]*/ + /** @stable ICU 54 */ + UBLOCK_PAHAWH_HMONG = 243, /*[16B00]*/ + /** @stable ICU 54 */ + UBLOCK_PALMYRENE = 244, /*[10860]*/ + /** @stable ICU 54 */ + UBLOCK_PAU_CIN_HAU = 245, /*[11AC0]*/ + /** @stable ICU 54 */ + UBLOCK_PSALTER_PAHLAVI = 246, /*[10B80]*/ + /** @stable ICU 54 */ + UBLOCK_SHORTHAND_FORMAT_CONTROLS = 247, /*[1BCA0]*/ + /** @stable ICU 54 */ + UBLOCK_SIDDHAM = 248, /*[11580]*/ + /** @stable ICU 54 */ + UBLOCK_SINHALA_ARCHAIC_NUMBERS = 249, /*[111E0]*/ + /** @stable ICU 54 */ + UBLOCK_SUPPLEMENTAL_ARROWS_C = 250, /*[1F800]*/ + /** @stable ICU 54 */ + UBLOCK_TIRHUTA = 251, /*[11480]*/ + /** @stable ICU 54 */ + UBLOCK_WARANG_CITI = 252, /*[118A0]*/ + + /* New blocks in Unicode 8.0 */ + + /** @stable ICU 56 */ + UBLOCK_AHOM = 253, /*[11700]*/ + /** @stable ICU 56 */ + UBLOCK_ANATOLIAN_HIEROGLYPHS = 254, /*[14400]*/ + /** @stable ICU 56 */ + UBLOCK_CHEROKEE_SUPPLEMENT = 255, /*[AB70]*/ + /** @stable ICU 56 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E = 256, /*[2B820]*/ + /** @stable ICU 56 */ + UBLOCK_EARLY_DYNASTIC_CUNEIFORM = 257, /*[12480]*/ + /** @stable ICU 56 */ + UBLOCK_HATRAN = 258, /*[108E0]*/ + /** @stable ICU 56 */ + UBLOCK_MULTANI = 259, /*[11280]*/ + /** @stable ICU 56 */ + UBLOCK_OLD_HUNGARIAN = 260, /*[10C80]*/ + /** @stable ICU 56 */ + UBLOCK_SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS = 261, /*[1F900]*/ + /** @stable ICU 56 */ + UBLOCK_SUTTON_SIGNWRITING = 262, /*[1D800]*/ + + /* New blocks in Unicode 9.0 */ + + /** @stable ICU 58 */ + UBLOCK_ADLAM = 263, /*[1E900]*/ + /** @stable ICU 58 */ + UBLOCK_BHAIKSUKI = 264, /*[11C00]*/ + /** @stable ICU 58 */ + UBLOCK_CYRILLIC_EXTENDED_C = 265, /*[1C80]*/ + /** @stable ICU 58 */ + UBLOCK_GLAGOLITIC_SUPPLEMENT = 266, /*[1E000]*/ + /** @stable ICU 58 */ + UBLOCK_IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION = 267, /*[16FE0]*/ + /** @stable ICU 58 */ + UBLOCK_MARCHEN = 268, /*[11C70]*/ + /** @stable ICU 58 */ + UBLOCK_MONGOLIAN_SUPPLEMENT = 269, /*[11660]*/ + /** @stable ICU 58 */ + UBLOCK_NEWA = 270, /*[11400]*/ + /** @stable ICU 58 */ + UBLOCK_OSAGE = 271, /*[104B0]*/ + /** @stable ICU 58 */ + UBLOCK_TANGUT = 272, /*[17000]*/ + /** @stable ICU 58 */ + UBLOCK_TANGUT_COMPONENTS = 273, /*[18800]*/ + + // New blocks in Unicode 10.0 + + /** @stable ICU 60 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = 274, /*[2CEB0]*/ + /** @stable ICU 60 */ + UBLOCK_KANA_EXTENDED_A = 275, /*[1B100]*/ + /** @stable ICU 60 */ + UBLOCK_MASARAM_GONDI = 276, /*[11D00]*/ + /** @stable ICU 60 */ + UBLOCK_NUSHU = 277, /*[1B170]*/ + /** @stable ICU 60 */ + UBLOCK_SOYOMBO = 278, /*[11A50]*/ + /** @stable ICU 60 */ + UBLOCK_SYRIAC_SUPPLEMENT = 279, /*[0860]*/ + /** @stable ICU 60 */ + UBLOCK_ZANABAZAR_SQUARE = 280, /*[11A00]*/ + + // New blocks in Unicode 11.0 + + /** @stable ICU 62 */ + UBLOCK_CHESS_SYMBOLS = 281, /*[1FA00]*/ + /** @stable ICU 62 */ + UBLOCK_DOGRA = 282, /*[11800]*/ + /** @stable ICU 62 */ + UBLOCK_GEORGIAN_EXTENDED = 283, /*[1C90]*/ + /** @stable ICU 62 */ + UBLOCK_GUNJALA_GONDI = 284, /*[11D60]*/ + /** @stable ICU 62 */ + UBLOCK_HANIFI_ROHINGYA = 285, /*[10D00]*/ + /** @stable ICU 62 */ + UBLOCK_INDIC_SIYAQ_NUMBERS = 286, /*[1EC70]*/ + /** @stable ICU 62 */ + UBLOCK_MAKASAR = 287, /*[11EE0]*/ + /** @stable ICU 62 */ + UBLOCK_MAYAN_NUMERALS = 288, /*[1D2E0]*/ + /** @stable ICU 62 */ + UBLOCK_MEDEFAIDRIN = 289, /*[16E40]*/ + /** @stable ICU 62 */ + UBLOCK_OLD_SOGDIAN = 290, /*[10F00]*/ + /** @stable ICU 62 */ + UBLOCK_SOGDIAN = 291, /*[10F30]*/ + + // New blocks in Unicode 12.0 + + /** @stable ICU 64 */ + UBLOCK_EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS = 292, /*[13430]*/ + /** @stable ICU 64 */ + UBLOCK_ELYMAIC = 293, /*[10FE0]*/ + /** @stable ICU 64 */ + UBLOCK_NANDINAGARI = 294, /*[119A0]*/ + /** @stable ICU 64 */ + UBLOCK_NYIAKENG_PUACHUE_HMONG = 295, /*[1E100]*/ + /** @stable ICU 64 */ + UBLOCK_OTTOMAN_SIYAQ_NUMBERS = 296, /*[1ED00]*/ + /** @stable ICU 64 */ + UBLOCK_SMALL_KANA_EXTENSION = 297, /*[1B130]*/ + /** @stable ICU 64 */ + UBLOCK_SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A = 298, /*[1FA70]*/ + /** @stable ICU 64 */ + UBLOCK_TAMIL_SUPPLEMENT = 299, /*[11FC0]*/ + /** @stable ICU 64 */ + UBLOCK_WANCHO = 300, /*[1E2C0]*/ + + // New blocks in Unicode 13.0 + + /** @stable ICU 66 */ + UBLOCK_CHORASMIAN = 301, /*[10FB0]*/ + /** @stable ICU 66 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G = 302, /*[30000]*/ + /** @stable ICU 66 */ + UBLOCK_DIVES_AKURU = 303, /*[11900]*/ + /** @stable ICU 66 */ + UBLOCK_KHITAN_SMALL_SCRIPT = 304, /*[18B00]*/ + /** @stable ICU 66 */ + UBLOCK_LISU_SUPPLEMENT = 305, /*[11FB0]*/ + /** @stable ICU 66 */ + UBLOCK_SYMBOLS_FOR_LEGACY_COMPUTING = 306, /*[1FB00]*/ + /** @stable ICU 66 */ + UBLOCK_TANGUT_SUPPLEMENT = 307, /*[18D00]*/ + /** @stable ICU 66 */ + UBLOCK_YEZIDI = 308, /*[10E80]*/ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UBlockCode value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_BLOCK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UBLOCK_COUNT = 309, +#endif // U_HIDE_DEPRECATED_API + + /** @stable ICU 2.0 */ + UBLOCK_INVALID_CODE=-1 +}; + +/** @stable ICU 2.0 */ +typedef enum UBlockCode UBlockCode; + +/** + * East Asian Width constants. + * + * @see UCHAR_EAST_ASIAN_WIDTH + * @see u_getIntPropertyValue + * @stable ICU 2.2 + */ +typedef enum UEastAsianWidth { + /* + * Note: UEastAsianWidth constants are parsed by preparseucd.py. + * It matches lines like + * U_EA_ + */ + + U_EA_NEUTRAL, /*[N]*/ + U_EA_AMBIGUOUS, /*[A]*/ + U_EA_HALFWIDTH, /*[H]*/ + U_EA_FULLWIDTH, /*[F]*/ + U_EA_NARROW, /*[Na]*/ + U_EA_WIDE, /*[W]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UEastAsianWidth value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_EA_COUNT +#endif // U_HIDE_DEPRECATED_API +} UEastAsianWidth; + +/** + * Selector constants for u_charName(). + * u_charName() returns the "modern" name of a + * Unicode character; or the name that was defined in + * Unicode version 1.0, before the Unicode standard merged + * with ISO-10646; or an "extended" name that gives each + * Unicode code point a unique name. + * + * @see u_charName + * @stable ICU 2.0 + */ +typedef enum UCharNameChoice { + /** Unicode character name (Name property). @stable ICU 2.0 */ + U_UNICODE_CHAR_NAME, +#ifndef U_HIDE_DEPRECATED_API + /** + * The Unicode_1_Name property value which is of little practical value. + * Beginning with ICU 49, ICU APIs return an empty string for this name choice. + * @deprecated ICU 49 + */ + U_UNICODE_10_CHAR_NAME, +#endif /* U_HIDE_DEPRECATED_API */ + /** Standard or synthetic character name. @stable ICU 2.0 */ + U_EXTENDED_CHAR_NAME = U_UNICODE_CHAR_NAME+2, + /** Corrected name from NameAliases.txt. @stable ICU 4.4 */ + U_CHAR_NAME_ALIAS, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UCharNameChoice value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_CHAR_NAME_CHOICE_COUNT +#endif // U_HIDE_DEPRECATED_API +} UCharNameChoice; + +/** + * Selector constants for u_getPropertyName() and + * u_getPropertyValueName(). These selectors are used to choose which + * name is returned for a given property or value. All properties and + * values have a long name. Most have a short name, but some do not. + * Unicode allows for additional names, beyond the long and short + * name, which would be indicated by U_LONG_PROPERTY_NAME + i, where + * i=1, 2,... + * + * @see u_getPropertyName() + * @see u_getPropertyValueName() + * @stable ICU 2.4 + */ +typedef enum UPropertyNameChoice { + U_SHORT_PROPERTY_NAME, + U_LONG_PROPERTY_NAME, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UPropertyNameChoice value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_PROPERTY_NAME_CHOICE_COUNT +#endif // U_HIDE_DEPRECATED_API +} UPropertyNameChoice; + +/** + * Decomposition Type constants. + * + * @see UCHAR_DECOMPOSITION_TYPE + * @stable ICU 2.2 + */ +typedef enum UDecompositionType { + /* + * Note: UDecompositionType constants are parsed by preparseucd.py. + * It matches lines like + * U_DT_ + */ + + U_DT_NONE, /*[none]*/ + U_DT_CANONICAL, /*[can]*/ + U_DT_COMPAT, /*[com]*/ + U_DT_CIRCLE, /*[enc]*/ + U_DT_FINAL, /*[fin]*/ + U_DT_FONT, /*[font]*/ + U_DT_FRACTION, /*[fra]*/ + U_DT_INITIAL, /*[init]*/ + U_DT_ISOLATED, /*[iso]*/ + U_DT_MEDIAL, /*[med]*/ + U_DT_NARROW, /*[nar]*/ + U_DT_NOBREAK, /*[nb]*/ + U_DT_SMALL, /*[sml]*/ + U_DT_SQUARE, /*[sqr]*/ + U_DT_SUB, /*[sub]*/ + U_DT_SUPER, /*[sup]*/ + U_DT_VERTICAL, /*[vert]*/ + U_DT_WIDE, /*[wide]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UDecompositionType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_DT_COUNT /* 18 */ +#endif // U_HIDE_DEPRECATED_API +} UDecompositionType; + +/** + * Joining Type constants. + * + * @see UCHAR_JOINING_TYPE + * @stable ICU 2.2 + */ +typedef enum UJoiningType { + /* + * Note: UJoiningType constants are parsed by preparseucd.py. + * It matches lines like + * U_JT_ + */ + + U_JT_NON_JOINING, /*[U]*/ + U_JT_JOIN_CAUSING, /*[C]*/ + U_JT_DUAL_JOINING, /*[D]*/ + U_JT_LEFT_JOINING, /*[L]*/ + U_JT_RIGHT_JOINING, /*[R]*/ + U_JT_TRANSPARENT, /*[T]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UJoiningType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_JT_COUNT /* 6 */ +#endif // U_HIDE_DEPRECATED_API +} UJoiningType; + +/** + * Joining Group constants. + * + * @see UCHAR_JOINING_GROUP + * @stable ICU 2.2 + */ +typedef enum UJoiningGroup { + /* + * Note: UJoiningGroup constants are parsed by preparseucd.py. + * It matches lines like + * U_JG_ + */ + + U_JG_NO_JOINING_GROUP, + U_JG_AIN, + U_JG_ALAPH, + U_JG_ALEF, + U_JG_BEH, + U_JG_BETH, + U_JG_DAL, + U_JG_DALATH_RISH, + U_JG_E, + U_JG_FEH, + U_JG_FINAL_SEMKATH, + U_JG_GAF, + U_JG_GAMAL, + U_JG_HAH, + U_JG_TEH_MARBUTA_GOAL, /**< @stable ICU 4.6 */ + U_JG_HAMZA_ON_HEH_GOAL=U_JG_TEH_MARBUTA_GOAL, + U_JG_HE, + U_JG_HEH, + U_JG_HEH_GOAL, + U_JG_HETH, + U_JG_KAF, + U_JG_KAPH, + U_JG_KNOTTED_HEH, + U_JG_LAM, + U_JG_LAMADH, + U_JG_MEEM, + U_JG_MIM, + U_JG_NOON, + U_JG_NUN, + U_JG_PE, + U_JG_QAF, + U_JG_QAPH, + U_JG_REH, + U_JG_REVERSED_PE, + U_JG_SAD, + U_JG_SADHE, + U_JG_SEEN, + U_JG_SEMKATH, + U_JG_SHIN, + U_JG_SWASH_KAF, + U_JG_SYRIAC_WAW, + U_JG_TAH, + U_JG_TAW, + U_JG_TEH_MARBUTA, + U_JG_TETH, + U_JG_WAW, + U_JG_YEH, + U_JG_YEH_BARREE, + U_JG_YEH_WITH_TAIL, + U_JG_YUDH, + U_JG_YUDH_HE, + U_JG_ZAIN, + U_JG_FE, /**< @stable ICU 2.6 */ + U_JG_KHAPH, /**< @stable ICU 2.6 */ + U_JG_ZHAIN, /**< @stable ICU 2.6 */ + U_JG_BURUSHASKI_YEH_BARREE, /**< @stable ICU 4.0 */ + U_JG_FARSI_YEH, /**< @stable ICU 4.4 */ + U_JG_NYA, /**< @stable ICU 4.4 */ + U_JG_ROHINGYA_YEH, /**< @stable ICU 49 */ + U_JG_MANICHAEAN_ALEPH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_AYIN, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_BETH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_DALETH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_DHAMEDH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_FIVE, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_GIMEL, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_HETH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_HUNDRED, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_KAPH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_LAMEDH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_MEM, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_NUN, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_ONE, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_PE, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_QOPH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_RESH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_SADHE, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_SAMEKH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_TAW, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_TEN, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_TETH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_THAMEDH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_TWENTY, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_WAW, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_YODH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_ZAYIN, /**< @stable ICU 54 */ + U_JG_STRAIGHT_WAW, /**< @stable ICU 54 */ + U_JG_AFRICAN_FEH, /**< @stable ICU 58 */ + U_JG_AFRICAN_NOON, /**< @stable ICU 58 */ + U_JG_AFRICAN_QAF, /**< @stable ICU 58 */ + + U_JG_MALAYALAM_BHA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_JA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_LLA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_LLLA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NGA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NNA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NNNA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NYA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_RA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_SSA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_TTA, /**< @stable ICU 60 */ + + U_JG_HANIFI_ROHINGYA_KINNA_YA, /**< @stable ICU 62 */ + U_JG_HANIFI_ROHINGYA_PA, /**< @stable ICU 62 */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UJoiningGroup value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_JG_COUNT +#endif // U_HIDE_DEPRECATED_API +} UJoiningGroup; + +/** + * Grapheme Cluster Break constants. + * + * @see UCHAR_GRAPHEME_CLUSTER_BREAK + * @stable ICU 3.4 + */ +typedef enum UGraphemeClusterBreak { + /* + * Note: UGraphemeClusterBreak constants are parsed by preparseucd.py. + * It matches lines like + * U_GCB_ + */ + + U_GCB_OTHER = 0, /*[XX]*/ + U_GCB_CONTROL = 1, /*[CN]*/ + U_GCB_CR = 2, /*[CR]*/ + U_GCB_EXTEND = 3, /*[EX]*/ + U_GCB_L = 4, /*[L]*/ + U_GCB_LF = 5, /*[LF]*/ + U_GCB_LV = 6, /*[LV]*/ + U_GCB_LVT = 7, /*[LVT]*/ + U_GCB_T = 8, /*[T]*/ + U_GCB_V = 9, /*[V]*/ + /** @stable ICU 4.0 */ + U_GCB_SPACING_MARK = 10, /*[SM]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ + /** @stable ICU 4.0 */ + U_GCB_PREPEND = 11, /*[PP]*/ + /** @stable ICU 50 */ + U_GCB_REGIONAL_INDICATOR = 12, /*[RI]*/ /* new in Unicode 6.2/ICU 50 */ + /** @stable ICU 58 */ + U_GCB_E_BASE = 13, /*[EB]*/ /* from here on: new in Unicode 9.0/ICU 58 */ + /** @stable ICU 58 */ + U_GCB_E_BASE_GAZ = 14, /*[EBG]*/ + /** @stable ICU 58 */ + U_GCB_E_MODIFIER = 15, /*[EM]*/ + /** @stable ICU 58 */ + U_GCB_GLUE_AFTER_ZWJ = 16, /*[GAZ]*/ + /** @stable ICU 58 */ + U_GCB_ZWJ = 17, /*[ZWJ]*/ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UGraphemeClusterBreak value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_GRAPHEME_CLUSTER_BREAK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_GCB_COUNT = 18 +#endif // U_HIDE_DEPRECATED_API +} UGraphemeClusterBreak; + +/** + * Word Break constants. + * (UWordBreak is a pre-existing enum type in ubrk.h for word break status tags.) + * + * @see UCHAR_WORD_BREAK + * @stable ICU 3.4 + */ +typedef enum UWordBreakValues { + /* + * Note: UWordBreakValues constants are parsed by preparseucd.py. + * It matches lines like + * U_WB_ + */ + + U_WB_OTHER = 0, /*[XX]*/ + U_WB_ALETTER = 1, /*[LE]*/ + U_WB_FORMAT = 2, /*[FO]*/ + U_WB_KATAKANA = 3, /*[KA]*/ + U_WB_MIDLETTER = 4, /*[ML]*/ + U_WB_MIDNUM = 5, /*[MN]*/ + U_WB_NUMERIC = 6, /*[NU]*/ + U_WB_EXTENDNUMLET = 7, /*[EX]*/ + /** @stable ICU 4.0 */ + U_WB_CR = 8, /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ + /** @stable ICU 4.0 */ + U_WB_EXTEND = 9, /*[Extend]*/ + /** @stable ICU 4.0 */ + U_WB_LF = 10, /*[LF]*/ + /** @stable ICU 4.0 */ + U_WB_MIDNUMLET =11, /*[MB]*/ + /** @stable ICU 4.0 */ + U_WB_NEWLINE =12, /*[NL]*/ + /** @stable ICU 50 */ + U_WB_REGIONAL_INDICATOR = 13, /*[RI]*/ /* new in Unicode 6.2/ICU 50 */ + /** @stable ICU 52 */ + U_WB_HEBREW_LETTER = 14, /*[HL]*/ /* from here on: new in Unicode 6.3/ICU 52 */ + /** @stable ICU 52 */ + U_WB_SINGLE_QUOTE = 15, /*[SQ]*/ + /** @stable ICU 52 */ + U_WB_DOUBLE_QUOTE = 16, /*[DQ]*/ + /** @stable ICU 58 */ + U_WB_E_BASE = 17, /*[EB]*/ /* from here on: new in Unicode 9.0/ICU 58 */ + /** @stable ICU 58 */ + U_WB_E_BASE_GAZ = 18, /*[EBG]*/ + /** @stable ICU 58 */ + U_WB_E_MODIFIER = 19, /*[EM]*/ + /** @stable ICU 58 */ + U_WB_GLUE_AFTER_ZWJ = 20, /*[GAZ]*/ + /** @stable ICU 58 */ + U_WB_ZWJ = 21, /*[ZWJ]*/ + /** @stable ICU 62 */ + U_WB_WSEGSPACE = 22, /*[WSEGSPACE]*/ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UWordBreakValues value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_WORD_BREAK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_WB_COUNT = 23 +#endif // U_HIDE_DEPRECATED_API +} UWordBreakValues; + +/** + * Sentence Break constants. + * + * @see UCHAR_SENTENCE_BREAK + * @stable ICU 3.4 + */ +typedef enum USentenceBreak { + /* + * Note: USentenceBreak constants are parsed by preparseucd.py. + * It matches lines like + * U_SB_ + */ + + U_SB_OTHER = 0, /*[XX]*/ + U_SB_ATERM = 1, /*[AT]*/ + U_SB_CLOSE = 2, /*[CL]*/ + U_SB_FORMAT = 3, /*[FO]*/ + U_SB_LOWER = 4, /*[LO]*/ + U_SB_NUMERIC = 5, /*[NU]*/ + U_SB_OLETTER = 6, /*[LE]*/ + U_SB_SEP = 7, /*[SE]*/ + U_SB_SP = 8, /*[SP]*/ + U_SB_STERM = 9, /*[ST]*/ + U_SB_UPPER = 10, /*[UP]*/ + U_SB_CR = 11, /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ + U_SB_EXTEND = 12, /*[EX]*/ + U_SB_LF = 13, /*[LF]*/ + U_SB_SCONTINUE = 14, /*[SC]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal USentenceBreak value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_SENTENCE_BREAK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_SB_COUNT = 15 +#endif // U_HIDE_DEPRECATED_API +} USentenceBreak; + +/** + * Line Break constants. + * + * @see UCHAR_LINE_BREAK + * @stable ICU 2.2 + */ +typedef enum ULineBreak { + /* + * Note: ULineBreak constants are parsed by preparseucd.py. + * It matches lines like + * U_LB_ + */ + + U_LB_UNKNOWN = 0, /*[XX]*/ + U_LB_AMBIGUOUS = 1, /*[AI]*/ + U_LB_ALPHABETIC = 2, /*[AL]*/ + U_LB_BREAK_BOTH = 3, /*[B2]*/ + U_LB_BREAK_AFTER = 4, /*[BA]*/ + U_LB_BREAK_BEFORE = 5, /*[BB]*/ + U_LB_MANDATORY_BREAK = 6, /*[BK]*/ + U_LB_CONTINGENT_BREAK = 7, /*[CB]*/ + U_LB_CLOSE_PUNCTUATION = 8, /*[CL]*/ + U_LB_COMBINING_MARK = 9, /*[CM]*/ + U_LB_CARRIAGE_RETURN = 10, /*[CR]*/ + U_LB_EXCLAMATION = 11, /*[EX]*/ + U_LB_GLUE = 12, /*[GL]*/ + U_LB_HYPHEN = 13, /*[HY]*/ + U_LB_IDEOGRAPHIC = 14, /*[ID]*/ + /** Renamed from the misspelled "inseperable" in Unicode 4.0.1/ICU 3.0 @stable ICU 3.0 */ + U_LB_INSEPARABLE = 15, /*[IN]*/ + U_LB_INSEPERABLE = U_LB_INSEPARABLE, + U_LB_INFIX_NUMERIC = 16, /*[IS]*/ + U_LB_LINE_FEED = 17, /*[LF]*/ + U_LB_NONSTARTER = 18, /*[NS]*/ + U_LB_NUMERIC = 19, /*[NU]*/ + U_LB_OPEN_PUNCTUATION = 20, /*[OP]*/ + U_LB_POSTFIX_NUMERIC = 21, /*[PO]*/ + U_LB_PREFIX_NUMERIC = 22, /*[PR]*/ + U_LB_QUOTATION = 23, /*[QU]*/ + U_LB_COMPLEX_CONTEXT = 24, /*[SA]*/ + U_LB_SURROGATE = 25, /*[SG]*/ + U_LB_SPACE = 26, /*[SP]*/ + U_LB_BREAK_SYMBOLS = 27, /*[SY]*/ + U_LB_ZWSPACE = 28, /*[ZW]*/ + /** @stable ICU 2.6 */ + U_LB_NEXT_LINE = 29, /*[NL]*/ /* from here on: new in Unicode 4/ICU 2.6 */ + /** @stable ICU 2.6 */ + U_LB_WORD_JOINER = 30, /*[WJ]*/ + /** @stable ICU 3.4 */ + U_LB_H2 = 31, /*[H2]*/ /* from here on: new in Unicode 4.1/ICU 3.4 */ + /** @stable ICU 3.4 */ + U_LB_H3 = 32, /*[H3]*/ + /** @stable ICU 3.4 */ + U_LB_JL = 33, /*[JL]*/ + /** @stable ICU 3.4 */ + U_LB_JT = 34, /*[JT]*/ + /** @stable ICU 3.4 */ + U_LB_JV = 35, /*[JV]*/ + /** @stable ICU 4.4 */ + U_LB_CLOSE_PARENTHESIS = 36, /*[CP]*/ /* new in Unicode 5.2/ICU 4.4 */ + /** @stable ICU 49 */ + U_LB_CONDITIONAL_JAPANESE_STARTER = 37,/*[CJ]*/ /* new in Unicode 6.1/ICU 49 */ + /** @stable ICU 49 */ + U_LB_HEBREW_LETTER = 38, /*[HL]*/ /* new in Unicode 6.1/ICU 49 */ + /** @stable ICU 50 */ + U_LB_REGIONAL_INDICATOR = 39,/*[RI]*/ /* new in Unicode 6.2/ICU 50 */ + /** @stable ICU 58 */ + U_LB_E_BASE = 40, /*[EB]*/ /* from here on: new in Unicode 9.0/ICU 58 */ + /** @stable ICU 58 */ + U_LB_E_MODIFIER = 41, /*[EM]*/ + /** @stable ICU 58 */ + U_LB_ZWJ = 42, /*[ZWJ]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal ULineBreak value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_LINE_BREAK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_LB_COUNT = 43 +#endif // U_HIDE_DEPRECATED_API +} ULineBreak; + +/** + * Numeric Type constants. + * + * @see UCHAR_NUMERIC_TYPE + * @stable ICU 2.2 + */ +typedef enum UNumericType { + /* + * Note: UNumericType constants are parsed by preparseucd.py. + * It matches lines like + * U_NT_ + */ + + U_NT_NONE, /*[None]*/ + U_NT_DECIMAL, /*[de]*/ + U_NT_DIGIT, /*[di]*/ + U_NT_NUMERIC, /*[nu]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UNumericType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_NUMERIC_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_NT_COUNT +#endif // U_HIDE_DEPRECATED_API +} UNumericType; + +/** + * Hangul Syllable Type constants. + * + * @see UCHAR_HANGUL_SYLLABLE_TYPE + * @stable ICU 2.6 + */ +typedef enum UHangulSyllableType { + /* + * Note: UHangulSyllableType constants are parsed by preparseucd.py. + * It matches lines like + * U_HST_ + */ + + U_HST_NOT_APPLICABLE, /*[NA]*/ + U_HST_LEADING_JAMO, /*[L]*/ + U_HST_VOWEL_JAMO, /*[V]*/ + U_HST_TRAILING_JAMO, /*[T]*/ + U_HST_LV_SYLLABLE, /*[LV]*/ + U_HST_LVT_SYLLABLE, /*[LVT]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UHangulSyllableType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_HANGUL_SYLLABLE_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_HST_COUNT +#endif // U_HIDE_DEPRECATED_API +} UHangulSyllableType; + +/** + * Indic Positional Category constants. + * + * @see UCHAR_INDIC_POSITIONAL_CATEGORY + * @stable ICU 63 + */ +typedef enum UIndicPositionalCategory { + /* + * Note: UIndicPositionalCategory constants are parsed by preparseucd.py. + * It matches lines like + * U_INPC_ + */ + + /** @stable ICU 63 */ + U_INPC_NA, + /** @stable ICU 63 */ + U_INPC_BOTTOM, + /** @stable ICU 63 */ + U_INPC_BOTTOM_AND_LEFT, + /** @stable ICU 63 */ + U_INPC_BOTTOM_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_LEFT, + /** @stable ICU 63 */ + U_INPC_LEFT_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_OVERSTRUCK, + /** @stable ICU 63 */ + U_INPC_RIGHT, + /** @stable ICU 63 */ + U_INPC_TOP, + /** @stable ICU 63 */ + U_INPC_TOP_AND_BOTTOM, + /** @stable ICU 63 */ + U_INPC_TOP_AND_BOTTOM_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_TOP_AND_LEFT, + /** @stable ICU 63 */ + U_INPC_TOP_AND_LEFT_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_TOP_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_VISUAL_ORDER_LEFT, + /** @stable ICU 66 */ + U_INPC_TOP_AND_BOTTOM_AND_LEFT, +} UIndicPositionalCategory; + +/** + * Indic Syllabic Category constants. + * + * @see UCHAR_INDIC_SYLLABIC_CATEGORY + * @stable ICU 63 + */ +typedef enum UIndicSyllabicCategory { + /* + * Note: UIndicSyllabicCategory constants are parsed by preparseucd.py. + * It matches lines like + * U_INSC_ + */ + + /** @stable ICU 63 */ + U_INSC_OTHER, + /** @stable ICU 63 */ + U_INSC_AVAGRAHA, + /** @stable ICU 63 */ + U_INSC_BINDU, + /** @stable ICU 63 */ + U_INSC_BRAHMI_JOINING_NUMBER, + /** @stable ICU 63 */ + U_INSC_CANTILLATION_MARK, + /** @stable ICU 63 */ + U_INSC_CONSONANT, + /** @stable ICU 63 */ + U_INSC_CONSONANT_DEAD, + /** @stable ICU 63 */ + U_INSC_CONSONANT_FINAL, + /** @stable ICU 63 */ + U_INSC_CONSONANT_HEAD_LETTER, + /** @stable ICU 63 */ + U_INSC_CONSONANT_INITIAL_POSTFIXED, + /** @stable ICU 63 */ + U_INSC_CONSONANT_KILLER, + /** @stable ICU 63 */ + U_INSC_CONSONANT_MEDIAL, + /** @stable ICU 63 */ + U_INSC_CONSONANT_PLACEHOLDER, + /** @stable ICU 63 */ + U_INSC_CONSONANT_PRECEDING_REPHA, + /** @stable ICU 63 */ + U_INSC_CONSONANT_PREFIXED, + /** @stable ICU 63 */ + U_INSC_CONSONANT_SUBJOINED, + /** @stable ICU 63 */ + U_INSC_CONSONANT_SUCCEEDING_REPHA, + /** @stable ICU 63 */ + U_INSC_CONSONANT_WITH_STACKER, + /** @stable ICU 63 */ + U_INSC_GEMINATION_MARK, + /** @stable ICU 63 */ + U_INSC_INVISIBLE_STACKER, + /** @stable ICU 63 */ + U_INSC_JOINER, + /** @stable ICU 63 */ + U_INSC_MODIFYING_LETTER, + /** @stable ICU 63 */ + U_INSC_NON_JOINER, + /** @stable ICU 63 */ + U_INSC_NUKTA, + /** @stable ICU 63 */ + U_INSC_NUMBER, + /** @stable ICU 63 */ + U_INSC_NUMBER_JOINER, + /** @stable ICU 63 */ + U_INSC_PURE_KILLER, + /** @stable ICU 63 */ + U_INSC_REGISTER_SHIFTER, + /** @stable ICU 63 */ + U_INSC_SYLLABLE_MODIFIER, + /** @stable ICU 63 */ + U_INSC_TONE_LETTER, + /** @stable ICU 63 */ + U_INSC_TONE_MARK, + /** @stable ICU 63 */ + U_INSC_VIRAMA, + /** @stable ICU 63 */ + U_INSC_VISARGA, + /** @stable ICU 63 */ + U_INSC_VOWEL, + /** @stable ICU 63 */ + U_INSC_VOWEL_DEPENDENT, + /** @stable ICU 63 */ + U_INSC_VOWEL_INDEPENDENT, +} UIndicSyllabicCategory; + +/** + * Vertical Orientation constants. + * + * @see UCHAR_VERTICAL_ORIENTATION + * @stable ICU 63 + */ +typedef enum UVerticalOrientation { + /* + * Note: UVerticalOrientation constants are parsed by preparseucd.py. + * It matches lines like + * U_VO_ + */ + + /** @stable ICU 63 */ + U_VO_ROTATED, + /** @stable ICU 63 */ + U_VO_TRANSFORMED_ROTATED, + /** @stable ICU 63 */ + U_VO_TRANSFORMED_UPRIGHT, + /** @stable ICU 63 */ + U_VO_UPRIGHT, +} UVerticalOrientation; + +/** + * Check a binary Unicode property for a code point. + * + * Unicode, especially in version 3.2, defines many more properties than the + * original set in UnicodeData.txt. + * + * The properties APIs are intended to reflect Unicode properties as defined + * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR). + * For details about the properties see http://www.unicode.org/ucd/ . + * For names of Unicode properties see the UCD file PropertyAliases.txt. + * + * Important: If ICU is built with UCD files from Unicode versions below 3.2, + * then properties marked with "new in Unicode 3.2" are not or not fully available. + * + * @param c Code point to test. + * @param which UProperty selector constant, identifies which binary property to check. + * Must be UCHAR_BINARY_START<=which=0. + * True for characters with general category "Nd" (decimal digit numbers) + * as well as Latin letters a-f and A-F in both ASCII and Fullwidth ASCII. + * (That is, for letters with code points + * 0041..0046, 0061..0066, FF21..FF26, FF41..FF46.) + * + * In order to narrow the definition of hexadecimal digits to only ASCII + * characters, use (c<=0x7f && u_isxdigit(c)). + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return true if the code point is a hexadecimal digit + * + * @stable ICU 2.6 + */ +U_CAPI UBool U_EXPORT2 +u_isxdigit(UChar32 c); + +/** + * Determines whether the specified code point is a punctuation character. + * True for characters with general categories "P" (punctuation). + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return true if the code point is a punctuation character + * + * @stable ICU 2.6 + */ +U_CAPI UBool U_EXPORT2 +u_ispunct(UChar32 c); + +/** + * Determines whether the specified code point is a "graphic" character + * (printable, excluding spaces). + * true for all characters except those with general categories + * "Cc" (control codes), "Cf" (format controls), "Cs" (surrogates), + * "Cn" (unassigned), and "Z" (separators). + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return true if the code point is a "graphic" character + * + * @stable ICU 2.6 + */ +U_CAPI UBool U_EXPORT2 +u_isgraph(UChar32 c); + +/** + * Determines whether the specified code point is a "blank" or "horizontal space", + * a character that visibly separates words on a line. + * The following are equivalent definitions: + * + * true for Unicode White_Space characters except for "vertical space controls" + * where "vertical space controls" are the following characters: + * U+000A (LF) U+000B (VT) U+000C (FF) U+000D (CR) U+0085 (NEL) U+2028 (LS) U+2029 (PS) + * + * same as + * + * true for U+0009 (TAB) and characters with general category "Zs" (space separators). + * + * Note: There are several ICU whitespace functions; please see the uchar.h + * file documentation for a detailed comparison. + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return true if the code point is a "blank" + * + * @stable ICU 2.6 + */ +U_CAPI UBool U_EXPORT2 +u_isblank(UChar32 c); + +/** + * Determines whether the specified code point is "defined", + * which usually means that it is assigned a character. + * True for general categories other than "Cn" (other, not assigned), + * i.e., true for all code points mentioned in UnicodeData.txt. + * + * Note that non-character code points (e.g., U+FDD0) are not "defined" + * (they are Cn), but surrogate code points are "defined" (Cs). + * + * Same as java.lang.Character.isDefined(). + * + * @param c the code point to be tested + * @return true if the code point is assigned a character + * + * @see u_isdigit + * @see u_isalpha + * @see u_isalnum + * @see u_isupper + * @see u_islower + * @see u_istitle + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +u_isdefined(UChar32 c); + +/** + * Determines if the specified character is a space character or not. + * + * Note: There are several ICU whitespace functions; please see the uchar.h + * file documentation for a detailed comparison. + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the character to be tested + * @return true if the character is a space character; false otherwise. + * + * @see u_isJavaSpaceChar + * @see u_isWhitespace + * @see u_isUWhiteSpace + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +u_isspace(UChar32 c); + +/** + * Determine if the specified code point is a space character according to Java. + * True for characters with general categories "Z" (separators), + * which does not include control codes (e.g., TAB or Line Feed). + * + * Same as java.lang.Character.isSpaceChar(). + * + * Note: There are several ICU whitespace functions; please see the uchar.h + * file documentation for a detailed comparison. + * + * @param c the code point to be tested + * @return true if the code point is a space character according to Character.isSpaceChar() + * + * @see u_isspace + * @see u_isWhitespace + * @see u_isUWhiteSpace + * @stable ICU 2.6 + */ +U_CAPI UBool U_EXPORT2 +u_isJavaSpaceChar(UChar32 c); + +/** + * Determines if the specified code point is a whitespace character according to Java/ICU. + * A character is considered to be a Java whitespace character if and only + * if it satisfies one of the following criteria: + * + * - It is a Unicode Separator character (categories "Z" = "Zs" or "Zl" or "Zp"), but is not + * also a non-breaking space (U+00A0 NBSP or U+2007 Figure Space or U+202F Narrow NBSP). + * - It is U+0009 HORIZONTAL TABULATION. + * - It is U+000A LINE FEED. + * - It is U+000B VERTICAL TABULATION. + * - It is U+000C FORM FEED. + * - It is U+000D CARRIAGE RETURN. + * - It is U+001C FILE SEPARATOR. + * - It is U+001D GROUP SEPARATOR. + * - It is U+001E RECORD SEPARATOR. + * - It is U+001F UNIT SEPARATOR. + * + * This API tries to sync with the semantics of Java's + * java.lang.Character.isWhitespace(), but it may not return + * the exact same results because of the Unicode version + * difference. + * + * Note: Unicode 4.0.1 changed U+200B ZERO WIDTH SPACE from a Space Separator (Zs) + * to a Format Control (Cf). Since then, isWhitespace(0x200b) returns false. + * See http://www.unicode.org/versions/Unicode4.0.1/ + * + * Note: There are several ICU whitespace functions; please see the uchar.h + * file documentation for a detailed comparison. + * + * @param c the code point to be tested + * @return true if the code point is a whitespace character according to Java/ICU + * + * @see u_isspace + * @see u_isJavaSpaceChar + * @see u_isUWhiteSpace + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +u_isWhitespace(UChar32 c); + +/** + * Determines whether the specified code point is a control character + * (as defined by this function). + * A control character is one of the following: + * - ISO 8-bit control character (U+0000..U+001f and U+007f..U+009f) + * - U_CONTROL_CHAR (Cc) + * - U_FORMAT_CHAR (Cf) + * - U_LINE_SEPARATOR (Zl) + * - U_PARAGRAPH_SEPARATOR (Zp) + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return true if the code point is a control character + * + * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT + * @see u_isprint + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +u_iscntrl(UChar32 c); + +/** + * Determines whether the specified code point is an ISO control code. + * True for U+0000..U+001f and U+007f..U+009f (general category "Cc"). + * + * Same as java.lang.Character.isISOControl(). + * + * @param c the code point to be tested + * @return true if the code point is an ISO control code + * + * @see u_iscntrl + * @stable ICU 2.6 + */ +U_CAPI UBool U_EXPORT2 +u_isISOControl(UChar32 c); + +/** + * Determines whether the specified code point is a printable character. + * True for general categories other than "C" (controls). + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return true if the code point is a printable character + * + * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT + * @see u_iscntrl + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +u_isprint(UChar32 c); + +/** + * Non-standard: Determines whether the specified code point is a base character. + * True for general categories "L" (letters), "N" (numbers), + * "Mc" (spacing combining marks), and "Me" (enclosing marks). + * + * Note that this is different from the Unicode Standard definition in + * chapter 3.6, conformance clause D51 “Base character”, + * which defines base characters as the code points with general categories + * Letter (L), Number (N), Punctuation (P), Symbol (S), or Space Separator (Zs). + * + * @param c the code point to be tested + * @return true if the code point is a base character according to this function + * + * @see u_isalpha + * @see u_isdigit + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +u_isbase(UChar32 c); + +/** + * Returns the bidirectional category value for the code point, + * which is used in the Unicode bidirectional algorithm + * (UAX #9 http://www.unicode.org/reports/tr9/). + * Note that some unassigned code points have bidi values + * of R or AL because they are in blocks that are reserved + * for Right-To-Left scripts. + * + * Same as java.lang.Character.getDirectionality() + * + * @param c the code point to be tested + * @return the bidirectional category (UCharDirection) value + * + * @see UCharDirection + * @stable ICU 2.0 + */ +U_CAPI UCharDirection U_EXPORT2 +u_charDirection(UChar32 c); + +/** + * Determines whether the code point has the Bidi_Mirrored property. + * This property is set for characters that are commonly used in + * Right-To-Left contexts and need to be displayed with a "mirrored" + * glyph. + * + * Same as java.lang.Character.isMirrored(). + * Same as UCHAR_BIDI_MIRRORED + * + * @param c the code point to be tested + * @return true if the character has the Bidi_Mirrored property + * + * @see UCHAR_BIDI_MIRRORED + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +u_isMirrored(UChar32 c); + +/** + * Maps the specified character to a "mirror-image" character. + * For characters with the Bidi_Mirrored property, implementations + * sometimes need a "poor man's" mapping to another Unicode + * character (code point) such that the default glyph may serve + * as the mirror-image of the default glyph of the specified + * character. This is useful for text conversion to and from + * codepages with visual order, and for displays without glyph + * selection capabilities. + * + * @param c the code point to be mapped + * @return another Unicode code point that may serve as a mirror-image + * substitute, or c itself if there is no such mapping or c + * does not have the Bidi_Mirrored property + * + * @see UCHAR_BIDI_MIRRORED + * @see u_isMirrored + * @stable ICU 2.0 + */ +U_CAPI UChar32 U_EXPORT2 +u_charMirror(UChar32 c); + +/** + * Maps the specified character to its paired bracket character. + * For Bidi_Paired_Bracket_Type!=None, this is the same as u_charMirror(). + * Otherwise c itself is returned. + * See http://www.unicode.org/reports/tr9/ + * + * @param c the code point to be mapped + * @return the paired bracket code point, + * or c itself if there is no such mapping + * (Bidi_Paired_Bracket_Type=None) + * + * @see UCHAR_BIDI_PAIRED_BRACKET + * @see UCHAR_BIDI_PAIRED_BRACKET_TYPE + * @see u_charMirror + * @stable ICU 52 + */ +U_CAPI UChar32 U_EXPORT2 +u_getBidiPairedBracket(UChar32 c); + +/** + * Returns the general category value for the code point. + * + * Same as java.lang.Character.getType(). + * + * @param c the code point to be tested + * @return the general category (UCharCategory) value + * + * @see UCharCategory + * @stable ICU 2.0 + */ +U_CAPI int8_t U_EXPORT2 +u_charType(UChar32 c); + +/** + * Get a single-bit bit set for the general category of a character. + * This bit set can be compared bitwise with U_GC_SM_MASK, U_GC_L_MASK, etc. + * Same as U_MASK(u_charType(c)). + * + * @param c the code point to be tested + * @return a single-bit mask corresponding to the general category (UCharCategory) value + * + * @see u_charType + * @see UCharCategory + * @see U_GC_CN_MASK + * @stable ICU 2.1 + */ +#define U_GET_GC_MASK(c) U_MASK(u_charType(c)) + +/** + * Callback from u_enumCharTypes(), is called for each contiguous range + * of code points c (where start<=cnameChoice, the character name written + * into the buffer is the "modern" name or the name that was defined + * in Unicode version 1.0. + * The name contains only "invariant" characters + * like A-Z, 0-9, space, and '-'. + * Unicode 1.0 names are only retrieved if they are different from the modern + * names and if the data file contains the data for them. gennames may or may + * not be called with a command line option to include 1.0 names in unames.dat. + * + * @param code The character (code point) for which to get the name. + * It must be 0<=code<=0x10ffff. + * @param nameChoice Selector for which name to get. + * @param buffer Destination address for copying the name. + * The name will always be zero-terminated. + * If there is no name, then the buffer will be set to the empty string. + * @param bufferLength ==sizeof(buffer) + * @param pErrorCode Pointer to a UErrorCode variable; + * check for U_SUCCESS() after u_charName() + * returns. + * @return The length of the name, or 0 if there is no name for this character. + * If the bufferLength is less than or equal to the length, then the buffer + * contains the truncated name and the returned length indicates the full + * length of the name. + * The length does not include the zero-termination. + * + * @see UCharNameChoice + * @see u_charFromName + * @see u_enumCharNames + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_charName(UChar32 code, UCharNameChoice nameChoice, + char *buffer, int32_t bufferLength, + UErrorCode *pErrorCode); + +#ifndef U_HIDE_DEPRECATED_API +/** + * Returns an empty string. + * Used to return the ISO 10646 comment for a character. + * The Unicode ISO_Comment property is deprecated and has no values. + * + * @param c The character (code point) for which to get the ISO comment. + * It must be 0<=c<=0x10ffff. + * @param dest Destination address for copying the comment. + * The comment will be zero-terminated if possible. + * If there is no comment, then the buffer will be set to the empty string. + * @param destCapacity ==sizeof(dest) + * @param pErrorCode Pointer to a UErrorCode variable; + * check for U_SUCCESS() after u_getISOComment() + * returns. + * @return 0 + * + * @deprecated ICU 49 + */ +U_DEPRECATED int32_t U_EXPORT2 +u_getISOComment(UChar32 c, + char *dest, int32_t destCapacity, + UErrorCode *pErrorCode); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Find a Unicode character by its name and return its code point value. + * The name is matched exactly and completely. + * If the name does not correspond to a code point, pErrorCode + * is set to U_INVALID_CHAR_FOUND. + * A Unicode 1.0 name is matched only if it differs from the modern name. + * Unicode names are all uppercase. Extended names are lowercase followed + * by an uppercase hexadecimal number, and within angle brackets. + * + * @param nameChoice Selector for which name to match. + * @param name The name to match. + * @param pErrorCode Pointer to a UErrorCode variable + * @return The Unicode value of the code point with the given name, + * or an undefined value if there is no such code point. + * + * @see UCharNameChoice + * @see u_charName + * @see u_enumCharNames + * @stable ICU 1.7 + */ +U_CAPI UChar32 U_EXPORT2 +u_charFromName(UCharNameChoice nameChoice, + const char *name, + UErrorCode *pErrorCode); + +/** + * Type of a callback function for u_enumCharNames() that gets called + * for each Unicode character with the code point value and + * the character name. + * If such a function returns false, then the enumeration is stopped. + * + * @param context The context pointer that was passed to u_enumCharNames(). + * @param code The Unicode code point for the character with this name. + * @param nameChoice Selector for which kind of names is enumerated. + * @param name The character's name, zero-terminated. + * @param length The length of the name. + * @return true if the enumeration should continue, false to stop it. + * + * @see UCharNameChoice + * @see u_enumCharNames + * @stable ICU 1.7 + */ +typedef UBool U_CALLCONV UEnumCharNamesFn(void *context, + UChar32 code, + UCharNameChoice nameChoice, + const char *name, + int32_t length); + +/** + * Enumerate all assigned Unicode characters between the start and limit + * code points (start inclusive, limit exclusive) and call a function + * for each, passing the code point value and the character name. + * For Unicode 1.0 names, only those are enumerated that differ from the + * modern names. + * + * @param start The first code point in the enumeration range. + * @param limit One more than the last code point in the enumeration range + * (the first one after the range). + * @param fn The function that is to be called for each character name. + * @param context An arbitrary pointer that is passed to the function. + * @param nameChoice Selector for which kind of names to enumerate. + * @param pErrorCode Pointer to a UErrorCode variable + * + * @see UCharNameChoice + * @see UEnumCharNamesFn + * @see u_charName + * @see u_charFromName + * @stable ICU 1.7 + */ +U_CAPI void U_EXPORT2 +u_enumCharNames(UChar32 start, UChar32 limit, + UEnumCharNamesFn *fn, + void *context, + UCharNameChoice nameChoice, + UErrorCode *pErrorCode); + +/** + * Return the Unicode name for a given property, as given in the + * Unicode database file PropertyAliases.txt. + * + * In addition, this function maps the property + * UCHAR_GENERAL_CATEGORY_MASK to the synthetic names "gcm" / + * "General_Category_Mask". These names are not in + * PropertyAliases.txt. + * + * @param property UProperty selector other than UCHAR_INVALID_CODE. + * If out of range, NULL is returned. + * + * @param nameChoice selector for which name to get. If out of range, + * NULL is returned. All properties have a long name. Most + * have a short name, but some do not. Unicode allows for + * additional names; if present these will be returned by + * U_LONG_PROPERTY_NAME + i, where i=1, 2,... + * + * @return a pointer to the name, or NULL if either the + * property or the nameChoice is out of range. If a given + * nameChoice returns NULL, then all larger values of + * nameChoice will return NULL, with one exception: if NULL is + * returned for U_SHORT_PROPERTY_NAME, then + * U_LONG_PROPERTY_NAME (and higher) may still return a + * non-NULL value. The returned pointer is valid until + * u_cleanup() is called. + * + * @see UProperty + * @see UPropertyNameChoice + * @stable ICU 2.4 + */ +U_CAPI const char* U_EXPORT2 +u_getPropertyName(UProperty property, + UPropertyNameChoice nameChoice); + +/** + * Return the UProperty enum for a given property name, as specified + * in the Unicode database file PropertyAliases.txt. Short, long, and + * any other variants are recognized. + * + * In addition, this function maps the synthetic names "gcm" / + * "General_Category_Mask" to the property + * UCHAR_GENERAL_CATEGORY_MASK. These names are not in + * PropertyAliases.txt. + * + * @param alias the property name to be matched. The name is compared + * using "loose matching" as described in PropertyAliases.txt. + * + * @return a UProperty enum, or UCHAR_INVALID_CODE if the given name + * does not match any property. + * + * @see UProperty + * @stable ICU 2.4 + */ +U_CAPI UProperty U_EXPORT2 +u_getPropertyEnum(const char* alias); + +/** + * Return the Unicode name for a given property value, as given in the + * Unicode database file PropertyValueAliases.txt. + * + * Note: Some of the names in PropertyValueAliases.txt can only be + * retrieved using UCHAR_GENERAL_CATEGORY_MASK, not + * UCHAR_GENERAL_CATEGORY. These include: "C" / "Other", "L" / + * "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P" + * / "Punctuation", "S" / "Symbol", and "Z" / "Separator". + * + * @param property UProperty selector constant. + * Must be UCHAR_BINARY_START<=which2<=radix<=36 or if the + * value of c is not a valid digit in the specified + * radix, -1 is returned. A character is a valid digit + * if at least one of the following is true: + *

    + *
  • The character has a decimal digit value. + * Such characters have the general category "Nd" (decimal digit numbers) + * and a Numeric_Type of Decimal. + * In this case the value is the character's decimal digit value.
  • + *
  • The character is one of the uppercase Latin letters + * 'A' through 'Z'. + * In this case the value is c-'A'+10.
  • + *
  • The character is one of the lowercase Latin letters + * 'a' through 'z'. + * In this case the value is ch-'a'+10.
  • + *
  • Latin letters from both the ASCII range (0061..007A, 0041..005A) + * as well as from the Fullwidth ASCII range (FF41..FF5A, FF21..FF3A) + * are recognized.
  • + *
+ * + * Same as java.lang.Character.digit(). + * + * @param ch the code point to be tested. + * @param radix the radix. + * @return the numeric value represented by the character in the + * specified radix, + * or -1 if there is no value or if the value exceeds the radix. + * + * @see UCHAR_NUMERIC_TYPE + * @see u_forDigit + * @see u_charDigitValue + * @see u_isdigit + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_digit(UChar32 ch, int8_t radix); + +/** + * Determines the character representation for a specific digit in + * the specified radix. If the value of radix is not a + * valid radix, or the value of digit is not a valid + * digit in the specified radix, the null character + * (U+0000) is returned. + *

+ * The radix argument is valid if it is greater than or + * equal to 2 and less than or equal to 36. + * The digit argument is valid if + * 0 <= digit < radix. + *

+ * If the digit is less than 10, then + * '0' + digit is returned. Otherwise, the value + * 'a' + digit - 10 is returned. + * + * Same as java.lang.Character.forDigit(). + * + * @param digit the number to convert to a character. + * @param radix the radix. + * @return the char representation of the specified digit + * in the specified radix. + * + * @see u_digit + * @see u_charDigitValue + * @see u_isdigit + * @stable ICU 2.0 + */ +U_CAPI UChar32 U_EXPORT2 +u_forDigit(int32_t digit, int8_t radix); + +/** + * Get the "age" of the code point. + * The "age" is the Unicode version when the code point was first + * designated (as a non-character or for Private Use) + * or assigned a character. + * This can be useful to avoid emitting code points to receiving + * processes that do not accept newer characters. + * The data is from the UCD file DerivedAge.txt. + * + * @param c The code point. + * @param versionArray The Unicode version number array, to be filled in. + * + * @stable ICU 2.1 + */ +U_CAPI void U_EXPORT2 +u_charAge(UChar32 c, UVersionInfo versionArray); + +/** + * Gets the Unicode version information. + * The version array is filled in with the version information + * for the Unicode standard that is currently used by ICU. + * For example, Unicode version 3.1.1 is represented as an array with + * the values { 3, 1, 1, 0 }. + * + * @param versionArray an output array that will be filled in with + * the Unicode version number + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +u_getUnicodeVersion(UVersionInfo versionArray); + +#if !UCONFIG_NO_NORMALIZATION +/** + * Get the FC_NFKC_Closure property string for a character. + * See Unicode Standard Annex #15 for details, search for "FC_NFKC_Closure" + * or for "FNC": http://www.unicode.org/reports/tr15/ + * + * @param c The character (code point) for which to get the FC_NFKC_Closure string. + * It must be 0<=c<=0x10ffff. + * @param dest Destination address for copying the string. + * The string will be zero-terminated if possible. + * If there is no FC_NFKC_Closure string, + * then the buffer will be set to the empty string. + * @param destCapacity ==sizeof(dest) + * @param pErrorCode Pointer to a UErrorCode variable. + * @return The length of the string, or 0 if there is no FC_NFKC_Closure string for this character. + * If the destCapacity is less than or equal to the length, then the buffer + * contains the truncated name and the returned length indicates the full + * length of the name. + * The length does not include the zero-termination. + * + * @stable ICU 2.2 + */ +U_CAPI int32_t U_EXPORT2 +u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode); + +#endif + + +U_CDECL_END + +#endif /*_UCHAR*/ +/*eof*/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucharstrie.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucharstrie.h new file mode 100644 index 0000000000000000000000000000000000000000..b6f9e3e075c8face0f2c6d0377ae0b32cd593db7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucharstrie.h @@ -0,0 +1,623 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: ucharstrie.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010nov14 +* created by: Markus W. Scherer +*/ + +#ifndef __UCHARSTRIE_H__ +#define __UCHARSTRIE_H__ + +/** + * \file + * \brief C++ API: Trie for mapping Unicode strings (or 16-bit-unit sequences) + * to integer values. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/unistr.h" +#include "unicode/uobject.h" +#include "unicode/ustringtrie.h" + +U_NAMESPACE_BEGIN + +class Appendable; +class UCharsTrieBuilder; +class UVector32; + +/** + * Light-weight, non-const reader class for a UCharsTrie. + * Traverses a char16_t-serialized data structure with minimal state, + * for mapping strings (16-bit-unit sequences) to non-negative integer values. + * + * This class owns the serialized trie data only if it was constructed by + * the builder's build() method. + * The public constructor and the copy constructor only alias the data (only copy the pointer). + * There is no assignment operator. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API UCharsTrie : public UMemory { +public: + /** + * Constructs a UCharsTrie reader instance. + * + * The trieUChars must contain a copy of a char16_t sequence from the UCharsTrieBuilder, + * starting with the first char16_t of that sequence. + * The UCharsTrie object will not read more char16_ts than + * the UCharsTrieBuilder generated in the corresponding build() call. + * + * The array is not copied/cloned and must not be modified while + * the UCharsTrie object is in use. + * + * @param trieUChars The char16_t array that contains the serialized trie. + * @stable ICU 4.8 + */ + UCharsTrie(ConstChar16Ptr trieUChars) + : ownedArray_(NULL), uchars_(trieUChars), + pos_(uchars_), remainingMatchLength_(-1) {} + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~UCharsTrie(); + + /** + * Copy constructor, copies the other trie reader object and its state, + * but not the char16_t array which will be shared. (Shallow copy.) + * @param other Another UCharsTrie object. + * @stable ICU 4.8 + */ + UCharsTrie(const UCharsTrie &other) + : ownedArray_(NULL), uchars_(other.uchars_), + pos_(other.pos_), remainingMatchLength_(other.remainingMatchLength_) {} + + /** + * Resets this trie to its initial state. + * @return *this + * @stable ICU 4.8 + */ + UCharsTrie &reset() { + pos_=uchars_; + remainingMatchLength_=-1; + return *this; + } + + /** + * Returns the state of this trie as a 64-bit integer. + * The state value is never 0. + * + * @return opaque state value + * @see resetToState64 + * @stable ICU 65 + */ + uint64_t getState64() const { + return (static_cast(remainingMatchLength_ + 2) << kState64RemainingShift) | + (uint64_t)(pos_ - uchars_); + } + + /** + * Resets this trie to the saved state. + * Unlike resetToState(State), the 64-bit state value + * must be from getState64() from the same trie object or + * from one initialized the exact same way. + * Because of no validation, this method is faster. + * + * @param state The opaque trie state value from getState64(). + * @return *this + * @see getState64 + * @see resetToState + * @see reset + * @stable ICU 65 + */ + UCharsTrie &resetToState64(uint64_t state) { + remainingMatchLength_ = static_cast(state >> kState64RemainingShift) - 2; + pos_ = uchars_ + (state & kState64PosMask); + return *this; + } + + /** + * UCharsTrie state object, for saving a trie's current state + * and resetting the trie back to this state later. + * @stable ICU 4.8 + */ + class State : public UMemory { + public: + /** + * Constructs an empty State. + * @stable ICU 4.8 + */ + State() { uchars=NULL; } + private: + friend class UCharsTrie; + + const char16_t *uchars; + const char16_t *pos; + int32_t remainingMatchLength; + }; + + /** + * Saves the state of this trie. + * @param state The State object to hold the trie's state. + * @return *this + * @see resetToState + * @stable ICU 4.8 + */ + const UCharsTrie &saveState(State &state) const { + state.uchars=uchars_; + state.pos=pos_; + state.remainingMatchLength=remainingMatchLength_; + return *this; + } + + /** + * Resets this trie to the saved state. + * If the state object contains no state, or the state of a different trie, + * then this trie remains unchanged. + * @param state The State object which holds a saved trie state. + * @return *this + * @see saveState + * @see reset + * @stable ICU 4.8 + */ + UCharsTrie &resetToState(const State &state) { + if(uchars_==state.uchars && uchars_!=NULL) { + pos_=state.pos; + remainingMatchLength_=state.remainingMatchLength; + } + return *this; + } + + /** + * Determines whether the string so far matches, whether it has a value, + * and whether another input char16_t can continue a matching string. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult current() const; + + /** + * Traverses the trie from the initial state for this input char16_t. + * Equivalent to reset().next(uchar). + * @param uchar Input char value. Values below 0 and above 0xffff will never match. + * @return The match/value Result. + * @stable ICU 4.8 + */ + inline UStringTrieResult first(int32_t uchar) { + remainingMatchLength_=-1; + return nextImpl(uchars_, uchar); + } + + /** + * Traverses the trie from the initial state for the + * one or two UTF-16 code units for this input code point. + * Equivalent to reset().nextForCodePoint(cp). + * @param cp A Unicode code point 0..0x10ffff. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult firstForCodePoint(UChar32 cp); + + /** + * Traverses the trie from the current state for this input char16_t. + * @param uchar Input char value. Values below 0 and above 0xffff will never match. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult next(int32_t uchar); + + /** + * Traverses the trie from the current state for the + * one or two UTF-16 code units for this input code point. + * @param cp A Unicode code point 0..0x10ffff. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult nextForCodePoint(UChar32 cp); + + /** + * Traverses the trie from the current state for this string. + * Equivalent to + * \code + * Result result=current(); + * for(each c in s) + * if(!USTRINGTRIE_HAS_NEXT(result)) return USTRINGTRIE_NO_MATCH; + * result=next(c); + * return result; + * \endcode + * @param s A string. Can be NULL if length is 0. + * @param length The length of the string. Can be -1 if NUL-terminated. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult next(ConstChar16Ptr s, int32_t length); + + /** + * Returns a matching string's value if called immediately after + * current()/first()/next() returned USTRINGTRIE_INTERMEDIATE_VALUE or USTRINGTRIE_FINAL_VALUE. + * getValue() can be called multiple times. + * + * Do not call getValue() after USTRINGTRIE_NO_MATCH or USTRINGTRIE_NO_VALUE! + * @return The value for the string so far. + * @stable ICU 4.8 + */ + inline int32_t getValue() const { + const char16_t *pos=pos_; + int32_t leadUnit=*pos++; + // U_ASSERT(leadUnit>=kMinValueLead); + return leadUnit&kValueIsFinal ? + readValue(pos, leadUnit&0x7fff) : readNodeValue(pos, leadUnit); + } + + /** + * Determines whether all strings reachable from the current state + * map to the same value. + * @param uniqueValue Receives the unique value, if this function returns true. + * (output-only) + * @return true if all strings reachable from the current state + * map to the same value. + * @stable ICU 4.8 + */ + inline UBool hasUniqueValue(int32_t &uniqueValue) const { + const char16_t *pos=pos_; + // Skip the rest of a pending linear-match node. + return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue); + } + + /** + * Finds each char16_t which continues the string from the current state. + * That is, each char16_t c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now. + * @param out Each next char16_t is appended to this object. + * @return the number of char16_ts which continue the string from here + * @stable ICU 4.8 + */ + int32_t getNextUChars(Appendable &out) const; + + /** + * Iterator for all of the (string, value) pairs in a UCharsTrie. + * @stable ICU 4.8 + */ + class U_COMMON_API Iterator : public UMemory { + public: + /** + * Iterates from the root of a char16_t-serialized UCharsTrie. + * @param trieUChars The trie char16_ts. + * @param maxStringLength If 0, the iterator returns full strings. + * Otherwise, the iterator returns strings with this maximum length. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength, UErrorCode &errorCode); + + /** + * Iterates from the current state of the specified UCharsTrie. + * @param trie The trie whose state will be copied for iteration. + * @param maxStringLength If 0, the iterator returns full strings. + * Otherwise, the iterator returns strings with this maximum length. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + Iterator(const UCharsTrie &trie, int32_t maxStringLength, UErrorCode &errorCode); + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~Iterator(); + + /** + * Resets this iterator to its initial state. + * @return *this + * @stable ICU 4.8 + */ + Iterator &reset(); + + /** + * @return true if there are more elements. + * @stable ICU 4.8 + */ + UBool hasNext() const; + + /** + * Finds the next (string, value) pair if there is one. + * + * If the string is truncated to the maximum length and does not + * have a real value, then the value is set to -1. + * In this case, this "not a real value" is indistinguishable from + * a real value of -1. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return true if there is another element. + * @stable ICU 4.8 + */ + UBool next(UErrorCode &errorCode); + + /** + * @return The string for the last successful next(). + * @stable ICU 4.8 + */ + const UnicodeString &getString() const { return str_; } + /** + * @return The value for the last successful next(). + * @stable ICU 4.8 + */ + int32_t getValue() const { return value_; } + + private: + UBool truncateAndStop() { + pos_=NULL; + value_=-1; // no real value for str + return true; + } + + const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode); + + const char16_t *uchars_; + const char16_t *pos_; + const char16_t *initialPos_; + int32_t remainingMatchLength_; + int32_t initialRemainingMatchLength_; + UBool skipValue_; // Skip intermediate value which was already delivered. + + UnicodeString str_; + int32_t maxLength_; + int32_t value_; + + // The stack stores pairs of integers for backtracking to another + // outbound edge of a branch node. + // The first integer is an offset from uchars_. + // The second integer has the str_.length() from before the node in bits 15..0, + // and the remaining branch length in bits 31..16. + // (We could store the remaining branch length minus 1 in bits 30..16 and not use the sign bit, + // but the code looks more confusing that way.) + UVector32 *stack_; + }; + +private: + friend class UCharsTrieBuilder; + + /** + * Constructs a UCharsTrie reader instance. + * Unlike the public constructor which just aliases an array, + * this constructor adopts the builder's array. + * This constructor is only called by the builder. + */ + UCharsTrie(char16_t *adoptUChars, const char16_t *trieUChars) + : ownedArray_(adoptUChars), uchars_(trieUChars), + pos_(uchars_), remainingMatchLength_(-1) {} + + // No assignment operator. + UCharsTrie &operator=(const UCharsTrie &other); + + inline void stop() { + pos_=NULL; + } + + // Reads a compact 32-bit integer. + // pos is already after the leadUnit, and the lead unit has bit 15 reset. + static inline int32_t readValue(const char16_t *pos, int32_t leadUnit) { + int32_t value; + if(leadUnit=kMinTwoUnitValueLead) { + if(leadUnit>6)-1; + } else if(leadUnit=kMinTwoUnitNodeValueLead) { + if(leadUnit=kMinTwoUnitDeltaLead) { + if(delta==kThreeUnitDeltaLead) { + delta=(pos[0]<<16)|pos[1]; + pos+=2; + } else { + delta=((delta-kMinTwoUnitDeltaLead)<<16)|*pos++; + } + } + return pos+delta; + } + + static const char16_t *skipDelta(const char16_t *pos) { + int32_t delta=*pos++; + if(delta>=kMinTwoUnitDeltaLead) { + if(delta==kThreeUnitDeltaLead) { + pos+=2; + } else { + ++pos; + } + } + return pos; + } + + static inline UStringTrieResult valueResult(int32_t node) { + return (UStringTrieResult)(USTRINGTRIE_INTERMEDIATE_VALUE-(node>>15)); + } + + // Handles a branch node for both next(uchar) and next(string). + UStringTrieResult branchNext(const char16_t *pos, int32_t length, int32_t uchar); + + // Requires remainingLength_<0. + UStringTrieResult nextImpl(const char16_t *pos, int32_t uchar); + + // Helper functions for hasUniqueValue(). + // Recursively finds a unique value (or whether there is not a unique one) + // from a branch. + static const char16_t *findUniqueValueFromBranch(const char16_t *pos, int32_t length, + UBool haveUniqueValue, int32_t &uniqueValue); + // Recursively finds a unique value (or whether there is not a unique one) + // starting from a position on a node lead unit. + static UBool findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue); + + // Helper functions for getNextUChars(). + // getNextUChars() when pos is on a branch node. + static void getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out); + + // UCharsTrie data structure + // + // The trie consists of a series of char16_t-serialized nodes for incremental + // Unicode string/char16_t sequence matching. (char16_t=16-bit unsigned integer) + // The root node is at the beginning of the trie data. + // + // Types of nodes are distinguished by their node lead unit ranges. + // After each node, except a final-value node, another node follows to + // encode match values or continue matching further units. + // + // Node types: + // - Final-value node: Stores a 32-bit integer in a compact, variable-length format. + // The value is for the string/char16_t sequence so far. + // - Match node, optionally with an intermediate value in a different compact format. + // The value, if present, is for the string/char16_t sequence so far. + // + // Aside from the value, which uses the node lead unit's high bits: + // + // - Linear-match node: Matches a number of units. + // - Branch node: Branches to other nodes according to the current input unit. + // The node unit is the length of the branch (number of units to select from) + // minus 1. It is followed by a sub-node: + // - If the length is at most kMaxBranchLinearSubNodeLength, then + // there are length-1 (key, value) pairs and then one more comparison unit. + // If one of the key units matches, then the value is either a final value for + // the string so far, or a "jump" delta to the next node. + // If the last unit matches, then matching continues with the next node. + // (Values have the same encoding as final-value nodes.) + // - If the length is greater than kMaxBranchLinearSubNodeLength, then + // there is one unit and one "jump" delta. + // If the input unit is less than the sub-node unit, then "jump" by delta to + // the next sub-node which will have a length of length/2. + // (The delta has its own compact encoding.) + // Otherwise, skip the "jump" delta to the next sub-node + // which will have a length of length-length/2. + + // Match-node lead unit values, after masking off intermediate-value bits: + + // 0000..002f: Branch node. If node!=0 then the length is node+1, otherwise + // the length is one more than the next unit. + + // For a branch sub-node with at most this many entries, we drop down + // to a linear search. + static const int32_t kMaxBranchLinearSubNodeLength=5; + + // 0030..003f: Linear-match node, match 1..16 units and continue reading the next node. + static const int32_t kMinLinearMatch=0x30; + static const int32_t kMaxLinearMatchLength=0x10; + + // Match-node lead unit bits 14..6 for the optional intermediate value. + // If these bits are 0, then there is no intermediate value. + // Otherwise, see the *NodeValue* constants below. + static const int32_t kMinValueLead=kMinLinearMatch+kMaxLinearMatchLength; // 0x0040 + static const int32_t kNodeTypeMask=kMinValueLead-1; // 0x003f + + // A final-value node has bit 15 set. + static const int32_t kValueIsFinal=0x8000; + + // Compact value: After testing and masking off bit 15, use the following thresholds. + static const int32_t kMaxOneUnitValue=0x3fff; + + static const int32_t kMinTwoUnitValueLead=kMaxOneUnitValue+1; // 0x4000 + static const int32_t kThreeUnitValueLead=0x7fff; + + static const int32_t kMaxTwoUnitValue=((kThreeUnitValueLead-kMinTwoUnitValueLead)<<16)-1; // 0x3ffeffff + + // Compact intermediate-value integer, lead unit shared with a branch or linear-match node. + static const int32_t kMaxOneUnitNodeValue=0xff; + static const int32_t kMinTwoUnitNodeValueLead=kMinValueLead+((kMaxOneUnitNodeValue+1)<<6); // 0x4040 + static const int32_t kThreeUnitNodeValueLead=0x7fc0; + + static const int32_t kMaxTwoUnitNodeValue= + ((kThreeUnitNodeValueLead-kMinTwoUnitNodeValueLead)<<10)-1; // 0xfdffff + + // Compact delta integers. + static const int32_t kMaxOneUnitDelta=0xfbff; + static const int32_t kMinTwoUnitDeltaLead=kMaxOneUnitDelta+1; // 0xfc00 + static const int32_t kThreeUnitDeltaLead=0xffff; + + static const int32_t kMaxTwoUnitDelta=((kThreeUnitDeltaLead-kMinTwoUnitDeltaLead)<<16)-1; // 0x03feffff + + // For getState64(): + // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2 + // so we need at least 5 bits for that. + // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength. + static constexpr int32_t kState64RemainingShift = 59; + static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1; + + char16_t *ownedArray_; + + // Fixed value referencing the UCharsTrie words. + const char16_t *uchars_; + + // Iterator variables. + + // Pointer to next trie unit to read. NULL if no more matches. + const char16_t *pos_; + // Remaining length of a linear-match node, minus 1. Negative if not in such a node. + int32_t remainingMatchLength_; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __UCHARSTRIE_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucharstriebuilder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucharstriebuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..15657702f9d02455524f2c94f414a8218e6e2c21 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucharstriebuilder.h @@ -0,0 +1,193 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: ucharstriebuilder.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010nov14 +* created by: Markus W. Scherer +*/ + +#ifndef __UCHARSTRIEBUILDER_H__ +#define __UCHARSTRIEBUILDER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/stringtriebuilder.h" +#include "unicode/ucharstrie.h" +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: Builder for icu::UCharsTrie + */ + +U_NAMESPACE_BEGIN + +class UCharsTrieElement; + +/** + * Builder class for UCharsTrie. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API UCharsTrieBuilder : public StringTrieBuilder { +public: + /** + * Constructs an empty builder. + * @param errorCode Standard ICU error code. + * @stable ICU 4.8 + */ + UCharsTrieBuilder(UErrorCode &errorCode); + + /** + * Destructor. + * @stable ICU 4.8 + */ + virtual ~UCharsTrieBuilder(); + + /** + * Adds a (string, value) pair. + * The string must be unique. + * The string contents will be copied; the builder does not keep + * a reference to the input UnicodeString or its buffer. + * @param s The input string. + * @param value The value associated with this string. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @stable ICU 4.8 + */ + UCharsTrieBuilder &add(const UnicodeString &s, int32_t value, UErrorCode &errorCode); + + /** + * Builds a UCharsTrie for the add()ed data. + * Once built, no further data can be add()ed until clear() is called. + * + * A UCharsTrie cannot be empty. At least one (string, value) pair + * must have been add()ed. + * + * This method passes ownership of the builder's internal result array to the new trie object. + * Another call to any build() variant will re-serialize the trie. + * After clear() has been called, a new array will be used as well. + * @param buildOption Build option, see UStringTrieBuildOption. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return A new UCharsTrie for the add()ed data. + * @stable ICU 4.8 + */ + UCharsTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + /** + * Builds a UCharsTrie for the add()ed data and char16_t-serializes it. + * Once built, no further data can be add()ed until clear() is called. + * + * A UCharsTrie cannot be empty. At least one (string, value) pair + * must have been add()ed. + * + * Multiple calls to buildUnicodeString() set the UnicodeStrings to the + * builder's same char16_t array, without rebuilding. + * If buildUnicodeString() is called after build(), the trie will be + * re-serialized into a new array (because build() passes on ownership). + * If build() is called after buildUnicodeString(), the trie object returned + * by build() will become the owner of the underlying data for the + * previously returned UnicodeString. + * After clear() has been called, a new array will be used as well. + * @param buildOption Build option, see UStringTrieBuildOption. + * @param result A UnicodeString which will be set to the char16_t-serialized + * UCharsTrie for the add()ed data. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return result + * @stable ICU 4.8 + */ + UnicodeString &buildUnicodeString(UStringTrieBuildOption buildOption, UnicodeString &result, + UErrorCode &errorCode); + + /** + * Removes all (string, value) pairs. + * New data can then be add()ed and a new trie can be built. + * @return *this + * @stable ICU 4.8 + */ + UCharsTrieBuilder &clear() { + strings.remove(); + elementsLength=0; + ucharsLength=0; + return *this; + } + +private: + UCharsTrieBuilder(const UCharsTrieBuilder &other); // no copy constructor + UCharsTrieBuilder &operator=(const UCharsTrieBuilder &other); // no assignment operator + + void buildUChars(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + virtual int32_t getElementStringLength(int32_t i) const; + virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const; + virtual int32_t getElementValue(int32_t i) const; + + virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const; + + virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const; + virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const; + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const; + + virtual UBool matchNodesCanHaveValues() const { return true; } + + virtual int32_t getMaxBranchLinearSubNodeLength() const { return UCharsTrie::kMaxBranchLinearSubNodeLength; } + virtual int32_t getMinLinearMatch() const { return UCharsTrie::kMinLinearMatch; } + virtual int32_t getMaxLinearMatchLength() const { return UCharsTrie::kMaxLinearMatchLength; } + + class UCTLinearMatchNode : public LinearMatchNode { + public: + UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode); + virtual UBool operator==(const Node &other) const; + virtual void write(StringTrieBuilder &builder); + private: + const char16_t *s; + }; + + virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length, + Node *nextNode) const; + + UBool ensureCapacity(int32_t length); + virtual int32_t write(int32_t unit); + int32_t write(const char16_t *s, int32_t length); + virtual int32_t writeElementUnits(int32_t i, int32_t unitIndex, int32_t length); + virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal); + virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node); + virtual int32_t writeDeltaTo(int32_t jumpTarget); + + UnicodeString strings; + UCharsTrieElement *elements; + int32_t elementsCapacity; + int32_t elementsLength; + + // char16_t serialization of the trie. + // Grows from the back: ucharsLength measures from the end of the buffer! + char16_t *uchars; + int32_t ucharsCapacity; + int32_t ucharsLength; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __UCHARSTRIEBUILDER_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uchriter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uchriter.h new file mode 100644 index 0000000000000000000000000000000000000000..f5083561a8652978608c56e7bd465df3636cbed7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uchriter.h @@ -0,0 +1,393 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1998-2005, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef UCHRITER_H +#define UCHRITER_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/chariter.h" + +/** + * \file + * \brief C++ API: char16_t Character Iterator + */ + +U_NAMESPACE_BEGIN + +/** + * A concrete subclass of CharacterIterator that iterates over the + * characters (code units or code points) in a char16_t array. + * It's possible not only to create an + * iterator that iterates over an entire char16_t array, but also to + * create one that iterates over only a subrange of a char16_t array + * (iterators over different subranges of the same char16_t array don't + * compare equal). + * @see CharacterIterator + * @see ForwardCharacterIterator + * @stable ICU 2.0 + */ +class U_COMMON_API UCharCharacterIterator : public CharacterIterator { +public: + /** + * Create an iterator over the char16_t array referred to by "textPtr". + * The iteration range is 0 to length-1. + * text is only aliased, not adopted (the + * destructor will not delete it). + * @param textPtr The char16_t array to be iterated over + * @param length The length of the char16_t array + * @stable ICU 2.0 + */ + UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length); + + /** + * Create an iterator over the char16_t array referred to by "textPtr". + * The iteration range is 0 to length-1. + * text is only aliased, not adopted (the + * destructor will not delete it). + * The starting + * position is specified by "position". If "position" is outside the valid + * iteration range, the behavior of this object is undefined. + * @param textPtr The char16_t array to be iteratd over + * @param length The length of the char16_t array + * @param position The starting position of the iteration + * @stable ICU 2.0 + */ + UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, + int32_t position); + + /** + * Create an iterator over the char16_t array referred to by "textPtr". + * The iteration range is 0 to end-1. + * text is only aliased, not adopted (the + * destructor will not delete it). + * The starting + * position is specified by "position". If begin and end do not + * form a valid iteration range or "position" is outside the valid + * iteration range, the behavior of this object is undefined. + * @param textPtr The char16_t array to be iterated over + * @param length The length of the char16_t array + * @param textBegin The begin position of the iteration range + * @param textEnd The end position of the iteration range + * @param position The starting position of the iteration + * @stable ICU 2.0 + */ + UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, + int32_t textBegin, + int32_t textEnd, + int32_t position); + + /** + * Copy constructor. The new iterator iterates over the same range + * of the same string as "that", and its initial position is the + * same as "that"'s current position. + * @param that The UCharCharacterIterator to be copied + * @stable ICU 2.0 + */ + UCharCharacterIterator(const UCharCharacterIterator& that); + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~UCharCharacterIterator(); + + /** + * Assignment operator. *this is altered to iterate over the sane + * range of the same string as "that", and refers to the same + * character within that string as "that" does. + * @param that The object to be copied + * @return the newly created object + * @stable ICU 2.0 + */ + UCharCharacterIterator& + operator=(const UCharCharacterIterator& that); + + /** + * Returns true if the iterators iterate over the same range of the + * same string and are pointing at the same character. + * @param that The ForwardCharacterIterator used to be compared for equality + * @return true if the iterators iterate over the same range of the + * same string and are pointing at the same character. + * @stable ICU 2.0 + */ + virtual UBool operator==(const ForwardCharacterIterator& that) const; + + /** + * Generates a hash code for this iterator. + * @return the hash code. + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const; + + /** + * Returns a new UCharCharacterIterator referring to the same + * character in the same range of the same string as this one. The + * caller must delete the new iterator. + * @return the CharacterIterator newly created + * @stable ICU 2.0 + */ + virtual UCharCharacterIterator* clone() const; + + /** + * Sets the iterator to refer to the first code unit in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with next(). + * @return the first code unit in its iteration range. + * @stable ICU 2.0 + */ + virtual char16_t first(void); + + /** + * Sets the iterator to refer to the first code unit in its + * iteration range, returns that code unit, and moves the position + * to the second code unit. This is an alternative to setToStart() + * for forward iteration with nextPostInc(). + * @return the first code unit in its iteration range + * @stable ICU 2.0 + */ + virtual char16_t firstPostInc(void); + + /** + * Sets the iterator to refer to the first code point in its + * iteration range, and returns that code unit, + * This can be used to begin an iteration with next32(). + * Note that an iteration with next32PostInc(), beginning with, + * e.g., setToStart() or firstPostInc(), is more efficient. + * @return the first code point in its iteration range + * @stable ICU 2.0 + */ + virtual UChar32 first32(void); + + /** + * Sets the iterator to refer to the first code point in its + * iteration range, returns that code point, and moves the position + * to the second code point. This is an alternative to setToStart() + * for forward iteration with next32PostInc(). + * @return the first code point in its iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 first32PostInc(void); + + /** + * Sets the iterator to refer to the last code unit in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with previous(). + * @return the last code unit in its iteration range. + * @stable ICU 2.0 + */ + virtual char16_t last(void); + + /** + * Sets the iterator to refer to the last code point in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with previous32(). + * @return the last code point in its iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 last32(void); + + /** + * Sets the iterator to refer to the "position"-th code unit + * in the text-storage object the iterator refers to, and + * returns that code unit. + * @param position the position within the text-storage object + * @return the code unit + * @stable ICU 2.0 + */ + virtual char16_t setIndex(int32_t position); + + /** + * Sets the iterator to refer to the beginning of the code point + * that contains the "position"-th code unit + * in the text-storage object the iterator refers to, and + * returns that code point. + * The current position is adjusted to the beginning of the code point + * (its first code unit). + * @param position the position within the text-storage object + * @return the code unit + * @stable ICU 2.0 + */ + virtual UChar32 setIndex32(int32_t position); + + /** + * Returns the code unit the iterator currently refers to. + * @return the code unit the iterator currently refers to. + * @stable ICU 2.0 + */ + virtual char16_t current(void) const; + + /** + * Returns the code point the iterator currently refers to. + * @return the code point the iterator currently refers to. + * @stable ICU 2.0 + */ + virtual UChar32 current32(void) const; + + /** + * Advances to the next code unit in the iteration range (toward + * endIndex()), and returns that code unit. If there are no more + * code units to return, returns DONE. + * @return the next code unit in the iteration range. + * @stable ICU 2.0 + */ + virtual char16_t next(void); + + /** + * Gets the current code unit for returning and advances to the next code unit + * in the iteration range + * (toward endIndex()). If there are + * no more code units to return, returns DONE. + * @return the current code unit. + * @stable ICU 2.0 + */ + virtual char16_t nextPostInc(void); + + /** + * Advances to the next code point in the iteration range (toward + * endIndex()), and returns that code point. If there are no more + * code points to return, returns DONE. + * Note that iteration with "pre-increment" semantics is less + * efficient than iteration with "post-increment" semantics + * that is provided by next32PostInc(). + * @return the next code point in the iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 next32(void); + + /** + * Gets the current code point for returning and advances to the next code point + * in the iteration range + * (toward endIndex()). If there are + * no more code points to return, returns DONE. + * @return the current point. + * @stable ICU 2.0 + */ + virtual UChar32 next32PostInc(void); + + /** + * Returns false if there are no more code units or code points + * at or after the current position in the iteration range. + * This is used with nextPostInc() or next32PostInc() in forward + * iteration. + * @return false if there are no more code units or code points + * at or after the current position in the iteration range. + * @stable ICU 2.0 + */ + virtual UBool hasNext(); + + /** + * Advances to the previous code unit in the iteration range (toward + * startIndex()), and returns that code unit. If there are no more + * code units to return, returns DONE. + * @return the previous code unit in the iteration range. + * @stable ICU 2.0 + */ + virtual char16_t previous(void); + + /** + * Advances to the previous code point in the iteration range (toward + * startIndex()), and returns that code point. If there are no more + * code points to return, returns DONE. + * @return the previous code point in the iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 previous32(void); + + /** + * Returns false if there are no more code units or code points + * before the current position in the iteration range. + * This is used with previous() or previous32() in backward + * iteration. + * @return false if there are no more code units or code points + * before the current position in the iteration range. + * @stable ICU 2.0 + */ + virtual UBool hasPrevious(); + + /** + * Moves the current position relative to the start or end of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code units forward + * or backward by specifying a positive or negative delta. + * @param delta the position relative to origin. A positive delta means forward; + * a negative delta means backward. + * @param origin Origin enumeration {kStart, kCurrent, kEnd} + * @return the new position + * @stable ICU 2.0 + */ + virtual int32_t move(int32_t delta, EOrigin origin); + + /** + * Moves the current position relative to the start or end of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code points forward + * or backward by specifying a positive or negative delta. + * @param delta the position relative to origin. A positive delta means forward; + * a negative delta means backward. + * @param origin Origin enumeration {kStart, kCurrent, kEnd} + * @return the new position + * @stable ICU 2.0 + */ +#ifdef move32 + // One of the system headers right now is sometimes defining a conflicting macro we don't use +#undef move32 +#endif + virtual int32_t move32(int32_t delta, EOrigin origin); + + /** + * Sets the iterator to iterate over a new range of text + * @stable ICU 2.0 + */ + void setText(ConstChar16Ptr newText, int32_t newTextLength); + + /** + * Copies the char16_t array under iteration into the UnicodeString + * referred to by "result". Even if this iterator iterates across + * only a part of this string, the whole string is copied. + * @param result Receives a copy of the text under iteration. + * @stable ICU 2.0 + */ + virtual void getText(UnicodeString& result); + + /** + * Return a class ID for this class (not really public) + * @return a class ID for this class + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Return a class ID for this object (not really public) + * @return a class ID for this object. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + +protected: + /** + * Protected constructor + * @stable ICU 2.0 + */ + UCharCharacterIterator(); + /** + * Protected member text + * @stable ICU 2.0 + */ + const char16_t* text; + +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uclean.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uclean.h new file mode 100644 index 0000000000000000000000000000000000000000..c2d920a16ef48a73ee8063eb738dbcec1c2a17d3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uclean.h @@ -0,0 +1,262 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2001-2014, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* file name: uclean.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2001July05 +* created by: George Rhoten +*/ + +#ifndef __UCLEAN_H__ +#define __UCLEAN_H__ + +#include "unicode/utypes.h" +/** + * \file + * \brief C API: Initialize and clean up ICU + */ + +/** + * Initialize ICU. + * + * Use of this function is optional. It is OK to simply use ICU + * services and functions without first having initialized + * ICU by calling u_init(). + * + * u_init() will attempt to load some part of ICU's data, and is + * useful as a test for configuration or installation problems that + * leave the ICU data inaccessible. A successful invocation of u_init() + * does not, however, guarantee that all ICU data is accessible. + * + * Multiple calls to u_init() cause no harm, aside from the small amount + * of time required. + * + * In old versions of ICU, u_init() was required in multi-threaded applications + * to ensure the thread safety of ICU. u_init() is no longer needed for this purpose. + * + * @param status An ICU UErrorCode parameter. It must not be NULL. + * An Error will be returned if some required part of ICU data can not + * be loaded or initialized. + * The function returns immediately if the input error code indicates a + * failure, as usual. + * + * @stable ICU 2.6 + */ +U_CAPI void U_EXPORT2 +u_init(UErrorCode *status); + +#ifndef U_HIDE_SYSTEM_API +/** + * Clean up the system resources, such as allocated memory or open files, + * used in all ICU libraries. This will free/delete all memory owned by the + * ICU libraries, and return them to their original load state. All open ICU + * items (collators, resource bundles, converters, etc.) must be closed before + * calling this function, otherwise ICU may not free its allocated memory + * (e.g. close your converters and resource bundles before calling this + * function). Generally, this function should be called once just before + * an application exits. For applications that dynamically load and unload + * the ICU libraries (relatively uncommon), u_cleanup() should be called + * just before the library unload. + *

+ * u_cleanup() also clears any ICU heap functions, mutex functions or + * trace functions that may have been set for the process. + * This has the effect of restoring ICU to its initial condition, before + * any of these override functions were installed. Refer to + * u_setMemoryFunctions(), u_setMutexFunctions and + * utrace_setFunctions(). If ICU is to be reinitialized after + * calling u_cleanup(), these runtime override functions will need to + * be set up again if they are still required. + *

+ * u_cleanup() is not thread safe. All other threads should stop using ICU + * before calling this function. + *

+ * Any open ICU items will be left in an undefined state by u_cleanup(), + * and any subsequent attempt to use such an item will give unpredictable + * results. + *

+ * After calling u_cleanup(), an application may continue to use ICU by + * calling u_init(). An application must invoke u_init() first from one single + * thread before allowing other threads call u_init(). All threads existing + * at the time of the first thread's call to u_init() must also call + * u_init() themselves before continuing with other ICU operations. + *

+ * The use of u_cleanup() just before an application terminates is optional, + * but it should be called only once for performance reasons. The primary + * benefit is to eliminate reports of memory or resource leaks originating + * in ICU code from the results generated by heap analysis tools. + *

+ * Use this function with great care! + *

+ * + * @stable ICU 2.0 + * @system + */ +U_CAPI void U_EXPORT2 +u_cleanup(void); + +U_CDECL_BEGIN +/** + * Pointer type for a user supplied memory allocation function. + * @param context user supplied value, obtained from u_setMemoryFunctions(). + * @param size The number of bytes to be allocated + * @return Pointer to the newly allocated memory, or NULL if the allocation failed. + * @stable ICU 2.8 + * @system + */ +typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size); +/** + * Pointer type for a user supplied memory re-allocation function. + * @param context user supplied value, obtained from u_setMemoryFunctions(). + * @param size The number of bytes to be allocated + * @return Pointer to the newly allocated memory, or NULL if the allocation failed. + * @stable ICU 2.8 + * @system + */ +typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t size); +/** + * Pointer type for a user supplied memory free function. Behavior should be + * similar the standard C library free(). + * @param context user supplied value, obtained from u_setMemoryFunctions(). + * @param mem Pointer to the memory block to be resized + * @param size The new size for the block + * @return Pointer to the resized memory block, or NULL if the resizing failed. + * @stable ICU 2.8 + * @system + */ +typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem); + +/** + * Set the functions that ICU will use for memory allocation. + * Use of this function is optional; by default (without this function), ICU will + * use the standard C library malloc() and free() functions. + * This function can only be used when ICU is in an initial, unused state, before + * u_init() has been called. + * @param context This pointer value will be saved, and then (later) passed as + * a parameter to the memory functions each time they + * are called. + * @param a Pointer to a user-supplied malloc function. + * @param r Pointer to a user-supplied realloc function. + * @param f Pointer to a user-supplied free function. + * @param status Receives error values. + * @stable ICU 2.8 + * @system + */ +U_CAPI void U_EXPORT2 +u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f, + UErrorCode *status); + +U_CDECL_END + +#ifndef U_HIDE_DEPRECATED_API +/********************************************************************************* + * + * Deprecated Functions + * + * The following functions for user supplied mutexes are no longer supported. + * Any attempt to use them will return a U_UNSUPPORTED_ERROR. + * + **********************************************************************************/ + +/** + * An opaque pointer type that represents an ICU mutex. + * For user-implemented mutexes, the value will typically point to a + * struct or object that implements the mutex. + * @deprecated ICU 52. This type is no longer supported. + * @system + */ +typedef void *UMTX; + +U_CDECL_BEGIN +/** + * Function Pointer type for a user supplied mutex initialization function. + * The user-supplied function will be called by ICU whenever ICU needs to create a + * new mutex. The function implementation should create a mutex, and store a pointer + * to something that uniquely identifies the mutex into the UMTX that is supplied + * as a parameter. + * @param context user supplied value, obtained from u_setMutexFunctions(). + * @param mutex Receives a pointer that identifies the new mutex. + * The mutex init function must set the UMTX to a non-null value. + * Subsequent calls by ICU to lock, unlock, or destroy a mutex will + * identify the mutex by the UMTX value. + * @param status Error status. Report errors back to ICU by setting this variable + * with an error code. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCode* status); + + +/** + * Function Pointer type for a user supplied mutex functions. + * One of the user-supplied functions with this signature will be called by ICU + * whenever ICU needs to lock, unlock, or destroy a mutex. + * @param context user supplied value, obtained from u_setMutexFunctions(). + * @param mutex specify the mutex on which to operate. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex); +U_CDECL_END + +/** + * Set the functions that ICU will use for mutex operations + * Use of this function is optional; by default (without this function), ICU will + * directly access system functions for mutex operations + * This function can only be used when ICU is in an initial, unused state, before + * u_init() has been called. + * @param context This pointer value will be saved, and then (later) passed as + * a parameter to the user-supplied mutex functions each time they + * are called. + * @param init Pointer to a mutex initialization function. Must be non-null. + * @param destroy Pointer to the mutex destroy function. Must be non-null. + * @param lock pointer to the mutex lock function. Must be non-null. + * @param unlock Pointer to the mutex unlock function. Must be non-null. + * @param status Receives error values. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +U_DEPRECATED void U_EXPORT2 +u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtxFn *lock, UMtxFn *unlock, + UErrorCode *status); + + +/** + * Pointer type for a user supplied atomic increment or decrement function. + * @param context user supplied value, obtained from u_setAtomicIncDecFunctions(). + * @param p Pointer to a 32 bit int to be incremented or decremented + * @return The value of the variable after the inc or dec operation. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +typedef int32_t U_CALLCONV UMtxAtomicFn(const void *context, int32_t *p); + +/** + * Set the functions that ICU will use for atomic increment and decrement of int32_t values. + * Use of this function is optional; by default (without this function), ICU will + * use its own internal implementation of atomic increment/decrement. + * This function can only be used when ICU is in an initial, unused state, before + * u_init() has been called. + * @param context This pointer value will be saved, and then (later) passed as + * a parameter to the increment and decrement functions each time they + * are called. This function can only be called + * @param inc Pointer to a function to do an atomic increment operation. Must be non-null. + * @param dec Pointer to a function to do an atomic decrement operation. Must be non-null. + * @param status Receives error values. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +U_DEPRECATED void U_EXPORT2 +u_setAtomicIncDecFunctions(const void *context, UMtxAtomicFn *inc, UMtxAtomicFn *dec, + UErrorCode *status); + +#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_SYSTEM_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnv.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnv.h new file mode 100644 index 0000000000000000000000000000000000000000..5d784990f2cdcee34940785c34495ce5e7f80ba4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnv.h @@ -0,0 +1,2045 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** + * ucnv.h: + * External APIs for the ICU's codeset conversion library + * Bertrand A. Damiba + * + * Modification History: + * + * Date Name Description + * 04/04/99 helena Fixed internal header inclusion. + * 05/11/00 helena Added setFallback and usesFallback APIs. + * 06/29/2000 helena Major rewrite of the callback APIs. + * 12/07/2000 srl Update of documentation + */ + +/** + * \file + * \brief C API: Character conversion + * + *

Character Conversion C API

+ * + *

This API is used to convert codepage or character encoded data to and + * from UTF-16. You can open a converter with {@link ucnv_open() }. With that + * converter, you can get its properties, set options, convert your data and + * close the converter.

+ * + *

Since many software programs recognize different converter names for + * different types of converters, there are other functions in this API to + * iterate over the converter aliases. The functions {@link ucnv_getAvailableName() }, + * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the + * more frequently used alias functions to get this information.

+ * + *

When a converter encounters an illegal, irregular, invalid or unmappable character + * its default behavior is to use a substitution character to replace the + * bad byte sequence. This behavior can be changed by using {@link ucnv_setFromUCallBack() } + * or {@link ucnv_setToUCallBack() } on the converter. The header ucnv_err.h defines + * many other callback actions that can be used instead of a character substitution.

+ * + *

More information about this API can be found in our + * User's + * Guide.

+ */ + +#ifndef UCNV_H +#define UCNV_H + +#include "unicode/ucnv_err.h" +#include "unicode/uenum.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN) + +#define USET_DEFINED + +/** + * USet is the C API type corresponding to C++ class UnicodeSet. + * It is forward-declared here to avoid including unicode/uset.h file if related + * conversion APIs are not used. + * + * @see ucnv_getUnicodeSet + * @stable ICU 2.4 + */ +typedef struct USet USet; + +#endif + +#if !UCONFIG_NO_CONVERSION + +U_CDECL_BEGIN + +/** Maximum length of a converter name including the terminating NULL @stable ICU 2.0 */ +#define UCNV_MAX_CONVERTER_NAME_LENGTH 60 +/** Maximum length of a converter name including path and terminating NULL @stable ICU 2.0 */ +#define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH) + +/** Shift in for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */ +#define UCNV_SI 0x0F +/** Shift out for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */ +#define UCNV_SO 0x0E + +/** + * Enum for specifying basic types of converters + * @see ucnv_getType + * @stable ICU 2.0 + */ +typedef enum { + /** @stable ICU 2.0 */ + UCNV_UNSUPPORTED_CONVERTER = -1, + /** @stable ICU 2.0 */ + UCNV_SBCS = 0, + /** @stable ICU 2.0 */ + UCNV_DBCS = 1, + /** @stable ICU 2.0 */ + UCNV_MBCS = 2, + /** @stable ICU 2.0 */ + UCNV_LATIN_1 = 3, + /** @stable ICU 2.0 */ + UCNV_UTF8 = 4, + /** @stable ICU 2.0 */ + UCNV_UTF16_BigEndian = 5, + /** @stable ICU 2.0 */ + UCNV_UTF16_LittleEndian = 6, + /** @stable ICU 2.0 */ + UCNV_UTF32_BigEndian = 7, + /** @stable ICU 2.0 */ + UCNV_UTF32_LittleEndian = 8, + /** @stable ICU 2.0 */ + UCNV_EBCDIC_STATEFUL = 9, + /** @stable ICU 2.0 */ + UCNV_ISO_2022 = 10, + + /** @stable ICU 2.0 */ + UCNV_LMBCS_1 = 11, + /** @stable ICU 2.0 */ + UCNV_LMBCS_2, + /** @stable ICU 2.0 */ + UCNV_LMBCS_3, + /** @stable ICU 2.0 */ + UCNV_LMBCS_4, + /** @stable ICU 2.0 */ + UCNV_LMBCS_5, + /** @stable ICU 2.0 */ + UCNV_LMBCS_6, + /** @stable ICU 2.0 */ + UCNV_LMBCS_8, + /** @stable ICU 2.0 */ + UCNV_LMBCS_11, + /** @stable ICU 2.0 */ + UCNV_LMBCS_16, + /** @stable ICU 2.0 */ + UCNV_LMBCS_17, + /** @stable ICU 2.0 */ + UCNV_LMBCS_18, + /** @stable ICU 2.0 */ + UCNV_LMBCS_19, + /** @stable ICU 2.0 */ + UCNV_LMBCS_LAST = UCNV_LMBCS_19, + /** @stable ICU 2.0 */ + UCNV_HZ, + /** @stable ICU 2.0 */ + UCNV_SCSU, + /** @stable ICU 2.0 */ + UCNV_ISCII, + /** @stable ICU 2.0 */ + UCNV_US_ASCII, + /** @stable ICU 2.0 */ + UCNV_UTF7, + /** @stable ICU 2.2 */ + UCNV_BOCU1, + /** @stable ICU 2.2 */ + UCNV_UTF16, + /** @stable ICU 2.2 */ + UCNV_UTF32, + /** @stable ICU 2.2 */ + UCNV_CESU8, + /** @stable ICU 2.4 */ + UCNV_IMAP_MAILBOX, + /** @stable ICU 4.8 */ + UCNV_COMPOUND_TEXT, + + /* Number of converter types for which we have conversion routines. */ + UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES +} UConverterType; + +/** + * Enum for specifying which platform a converter ID refers to. + * The use of platform/CCSID is not recommended. See ucnv_openCCSID(). + * + * @see ucnv_getPlatform + * @see ucnv_openCCSID + * @see ucnv_getCCSID + * @stable ICU 2.0 + */ +typedef enum { + UCNV_UNKNOWN = -1, + UCNV_IBM = 0 +} UConverterPlatform; + +/** + * Function pointer for error callback in the codepage to unicode direction. + * Called when an error has occurred in conversion to unicode, or on open/close of the callback (see reason). + * @param context Pointer to the callback's private data + * @param args Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param pErrorCode ICU error code in/out parameter. + * For converter callback functions, set to a conversion error + * before the call, and the callback may reset it to U_ZERO_ERROR. + * @see ucnv_setToUCallBack + * @see UConverterToUnicodeArgs + * @stable ICU 2.0 + */ +typedef void (U_EXPORT2 *UConverterToUCallback) ( + const void* context, + UConverterToUnicodeArgs *args, + const char *codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode *pErrorCode); + +/** + * Function pointer for error callback in the unicode to codepage direction. + * Called when an error has occurred in conversion from unicode, or on open/close of the callback (see reason). + * @param context Pointer to the callback's private data + * @param args Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param pErrorCode ICU error code in/out parameter. + * For converter callback functions, set to a conversion error + * before the call, and the callback may reset it to U_ZERO_ERROR. + * @see ucnv_setFromUCallBack + * @stable ICU 2.0 + */ +typedef void (U_EXPORT2 *UConverterFromUCallback) ( + const void* context, + UConverterFromUnicodeArgs *args, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode *pErrorCode); + +U_CDECL_END + +/** + * Character that separates converter names from options and options from each other. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_OPTION_SEP_CHAR ',' + +/** + * String version of UCNV_OPTION_SEP_CHAR. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_OPTION_SEP_STRING "," + +/** + * Character that separates a converter option from its value. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_VALUE_SEP_CHAR '=' + +/** + * String version of UCNV_VALUE_SEP_CHAR. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_VALUE_SEP_STRING "=" + +/** + * Converter option for specifying a locale. + * For example, ucnv_open("SCSU,locale=ja", &errorCode); + * See convrtrs.txt. + * + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_LOCALE_OPTION_STRING ",locale=" + +/** + * Converter option for specifying a version selector (0..9) for some converters. + * For example, + * \code + * ucnv_open("UTF-7,version=1", &errorCode); + * \endcode + * See convrtrs.txt. + * + * @see ucnv_open + * @stable ICU 2.4 + */ +#define UCNV_VERSION_OPTION_STRING ",version=" + +/** + * Converter option for EBCDIC SBCS or mixed-SBCS/DBCS (stateful) codepages. + * Swaps Unicode mappings for EBCDIC LF and NL codes, as used on + * S/390 (z/OS) Unix System Services (Open Edition). + * For example, ucnv_open("ibm-1047,swaplfnl", &errorCode); + * See convrtrs.txt. + * + * @see ucnv_open + * @stable ICU 2.4 + */ +#define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl" + +/** + * Do a fuzzy compare of two converter/alias names. + * The comparison is case-insensitive, ignores leading zeroes if they are not + * followed by further digits, and ignores all but letters and digits. + * Thus the strings "UTF-8", "utf_8", "u*T@f08" and "Utf 8" are exactly equivalent. + * See section 1.4, Charset Alias Matching in Unicode Technical Standard #22 + * at http://www.unicode.org/reports/tr22/ + * + * @param name1 a converter name or alias, zero-terminated + * @param name2 a converter name or alias, zero-terminated + * @return 0 if the names match, or a negative value if the name1 + * lexically precedes name2, or a positive value if the name1 + * lexically follows name2. + * @stable ICU 2.0 + */ +U_CAPI int U_EXPORT2 +ucnv_compareNames(const char *name1, const char *name2); + + +/** + * Creates a UConverter object with the name of a coded character set specified as a C string. + * The actual name will be resolved with the alias file + * using a case-insensitive string comparison that ignores + * leading zeroes and all non-alphanumeric characters. + * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. + * (See also ucnv_compareNames().) + * If NULL is passed for the converter name, it will create one with the + * getDefaultName return value. + * + *

A converter name for ICU 1.5 and above may contain options + * like a locale specification to control the specific behavior of + * the newly instantiated converter. + * The meaning of the options depends on the particular converter. + * If an option is not defined for or recognized by a given converter, then it is ignored.

+ * + *

Options are appended to the converter name string, with a + * UCNV_OPTION_SEP_CHAR between the name and the first option and + * also between adjacent options.

+ * + *

If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.

+ * + *

The conversion behavior and names can vary between platforms. ICU may + * convert some characters differently from other platforms. Details on this topic + * are in the User's + * Guide. Aliases starting with a "cp" prefix have no specific meaning + * other than its an alias starting with the letters "cp". Please do not + * associate any meaning to these aliases.

+ * + * \snippet samples/ucnv/convsamp.cpp ucnv_open + * + * @param converterName Name of the coded character set table. + * This may have options appended to the string. + * IANA alias character set names, IBM CCSIDs starting with "ibm-", + * Windows codepage numbers starting with "windows-" are frequently + * used for this parameter. See ucnv_getAvailableName and + * ucnv_getAlias for a complete list that is available. + * If this parameter is NULL, the default converter will be used. + * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an error occurred + * @see ucnv_openU + * @see ucnv_openCCSID + * @see ucnv_getAvailableName + * @see ucnv_getAlias + * @see ucnv_getDefaultName + * @see ucnv_close + * @see ucnv_compareNames + * @stable ICU 2.0 + */ +U_CAPI UConverter* U_EXPORT2 +ucnv_open(const char *converterName, UErrorCode *err); + + +/** + * Creates a Unicode converter with the names specified as unicode string. + * The name should be limited to the ASCII-7 alphanumerics range. + * The actual name will be resolved with the alias file + * using a case-insensitive string comparison that ignores + * leading zeroes and all non-alphanumeric characters. + * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. + * (See also ucnv_compareNames().) + * If NULL is passed for the converter name, it will create + * one with the ucnv_getDefaultName() return value. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * + *

See ucnv_open for the complete details

+ * @param name Name of the UConverter table in a zero terminated + * Unicode string + * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, + * U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an + * error occurred + * @see ucnv_open + * @see ucnv_openCCSID + * @see ucnv_close + * @see ucnv_compareNames + * @stable ICU 2.0 + */ +U_CAPI UConverter* U_EXPORT2 +ucnv_openU(const UChar *name, + UErrorCode *err); + +/** + * Creates a UConverter object from a CCSID number and platform pair. + * Note that the usefulness of this function is limited to platforms with numeric + * encoding IDs. Only IBM and Microsoft platforms use numeric (16-bit) identifiers for + * encodings. + * + * In addition, IBM CCSIDs and Unicode conversion tables are not 1:1 related. + * For many IBM CCSIDs there are multiple (up to six) Unicode conversion tables, and + * for some Unicode conversion tables there are multiple CCSIDs. + * Some "alternate" Unicode conversion tables are provided by the + * IBM CDRA conversion table registry. + * The most prominent example of a systematic modification of conversion tables that is + * not provided in the form of conversion table files in the repository is + * that S/390 Unix System Services swaps the codes for Line Feed and New Line in all + * EBCDIC codepages, which requires such a swap in the Unicode conversion tables as well. + * + * Only IBM default conversion tables are accessible with ucnv_openCCSID(). + * ucnv_getCCSID() will return the same CCSID for all conversion tables that are associated + * with that CCSID. + * + * Currently, the only "platform" supported in the ICU converter API is UCNV_IBM. + * + * In summary, the use of CCSIDs and the associated API functions is not recommended. + * + * In order to open a converter with the default IBM CDRA Unicode conversion table, + * you can use this function or use the prefix "ibm-": + * \code + * char name[20]; + * sprintf(name, "ibm-%hu", ccsid); + * cnv=ucnv_open(name, &errorCode); + * \endcode + * + * In order to open a converter with the IBM S/390 Unix System Services variant + * of a Unicode/EBCDIC conversion table, + * you can use the prefix "ibm-" together with the option string UCNV_SWAP_LFNL_OPTION_STRING: + * \code + * char name[20]; + * sprintf(name, "ibm-%hu" UCNV_SWAP_LFNL_OPTION_STRING, ccsid); + * cnv=ucnv_open(name, &errorCode); + * \endcode + * + * In order to open a converter from a Microsoft codepage number, use the prefix "cp": + * \code + * char name[20]; + * sprintf(name, "cp%hu", codepageID); + * cnv=ucnv_open(name, &errorCode); + * \endcode + * + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * + * @param codepage codepage number to create + * @param platform the platform in which the codepage number exists + * @param err error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an error + * occurred. + * @see ucnv_open + * @see ucnv_openU + * @see ucnv_close + * @see ucnv_getCCSID + * @see ucnv_getPlatform + * @see UConverterPlatform + * @stable ICU 2.0 + */ +U_CAPI UConverter* U_EXPORT2 +ucnv_openCCSID(int32_t codepage, + UConverterPlatform platform, + UErrorCode * err); + +/** + *

Creates a UConverter object specified from a packageName and a converterName.

+ * + *

The packageName and converterName must point to an ICU udata object, as defined by + * udata_open( packageName, "cnv", converterName, err) or equivalent. + * Typically, packageName will refer to a (.dat) file, or to a package registered with + * udata_setAppData(). Using a full file or directory pathname for packageName is deprecated.

+ * + *

The name will NOT be looked up in the alias mechanism, nor will the converter be + * stored in the converter cache or the alias table. The only way to open further converters + * is call this function multiple times, or use the ucnv_safeClone() function to clone a + * 'primary' converter.

+ * + *

A future version of ICU may add alias table lookups and/or caching + * to this function.

+ * + *

Example Use: + * cnv = ucnv_openPackage("myapp", "myconverter", &err); + *

+ * + * @param packageName name of the package (equivalent to 'path' in udata_open() call) + * @param converterName name of the data item to be used, without suffix. + * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an error occurred + * @see udata_open + * @see ucnv_open + * @see ucnv_safeClone + * @see ucnv_close + * @stable ICU 2.2 + */ +U_CAPI UConverter* U_EXPORT2 +ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err); + +/** + * Thread safe converter cloning operation. + * For most efficient operation, pass in a stackBuffer (and a *pBufferSize) + * with at least U_CNV_SAFECLONE_BUFFERSIZE bytes of space. + * If the buffer size is sufficient, then the clone will use the stack buffer; + * otherwise, it will be allocated, and *pBufferSize will indicate + * the actual size. (This should not occur with U_CNV_SAFECLONE_BUFFERSIZE.) + * + * You must ucnv_close() the clone in any case. + * + * If *pBufferSize==0, (regardless of whether stackBuffer==NULL or not) + * then *pBufferSize will be changed to a sufficient size + * for cloning this converter, + * without actually cloning the converter ("pure pre-flighting"). + * + * If *pBufferSize is greater than zero but not large enough for a stack-based + * clone, then the converter is cloned using newly allocated memory + * and *pBufferSize is changed to the necessary size. + * + * If the converter clone fits into the stack buffer but the stack buffer is not + * sufficiently aligned for the clone, then the clone will use an + * adjusted pointer and use an accordingly smaller buffer size. + * + * @param cnv converter to be cloned + * @param stackBuffer Deprecated functionality as of ICU 52, use NULL.
+ * user allocated space for the new clone. If NULL new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations. + * @param pBufferSize Deprecated functionality as of ICU 52, use NULL or 1.
+ * pointer to size of allocated space. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_WARNING, + * is used if any allocations were necessary. + * However, it is better to check if *pBufferSize grew for checking for + * allocations because warning codes can be overridden by subsequent + * function calls. + * @return pointer to the new clone + * @stable ICU 2.0 + */ +U_CAPI UConverter * U_EXPORT2 +ucnv_safeClone(const UConverter *cnv, + void *stackBuffer, + int32_t *pBufferSize, + UErrorCode *status); + +#ifndef U_HIDE_DEPRECATED_API + +/** + * \def U_CNV_SAFECLONE_BUFFERSIZE + * Definition of a buffer size that is designed to be large enough for + * converters to be cloned with ucnv_safeClone(). + * @deprecated ICU 52. Do not rely on ucnv_safeClone() cloning into any provided buffer. + */ +#define U_CNV_SAFECLONE_BUFFERSIZE 1024 + +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Deletes the unicode converter and releases resources associated + * with just this instance. + * Does not free up shared converter tables. + * + * @param converter the converter object to be deleted + * @see ucnv_open + * @see ucnv_openU + * @see ucnv_openCCSID + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_close(UConverter * converter); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUConverterPointer + * "Smart pointer" class, closes a UConverter via ucnv_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close); + +U_NAMESPACE_END + +#endif + +/** + * Fills in the output parameter, subChars, with the substitution characters + * as multiple bytes. + * If ucnv_setSubstString() set a Unicode string because the converter is + * stateful, then subChars will be an empty string. + * + * @param converter the Unicode converter + * @param subChars the substitution characters + * @param len on input the capacity of subChars, on output the number + * of bytes copied to it + * @param err the outgoing error status code. + * If the substitution character array is too small, an + * U_INDEX_OUTOFBOUNDS_ERROR will be returned. + * @see ucnv_setSubstString + * @see ucnv_setSubstChars + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getSubstChars(const UConverter *converter, + char *subChars, + int8_t *len, + UErrorCode *err); + +/** + * Sets the substitution chars when converting from unicode to a codepage. The + * substitution is specified as a string of 1-4 bytes, and may contain + * NULL bytes. + * The subChars must represent a single character. The caller needs to know the + * byte sequence of a valid character in the converter's charset. + * For some converters, for example some ISO 2022 variants, only single-byte + * substitution characters may be supported. + * The newer ucnv_setSubstString() function relaxes these limitations. + * + * @param converter the Unicode converter + * @param subChars the substitution character byte sequence we want set + * @param len the number of bytes in subChars + * @param err the error status code. U_INDEX_OUTOFBOUNDS_ERROR if + * len is bigger than the maximum number of bytes allowed in subchars + * @see ucnv_setSubstString + * @see ucnv_getSubstChars + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_setSubstChars(UConverter *converter, + const char *subChars, + int8_t len, + UErrorCode *err); + +/** + * Set a substitution string for converting from Unicode to a charset. + * The caller need not know the charset byte sequence for each charset. + * + * Unlike ucnv_setSubstChars() which is designed to set a charset byte sequence + * for a single character, this function takes a Unicode string with + * zero, one or more characters, and immediately verifies that the string can be + * converted to the charset. + * If not, or if the result is too long (more than 32 bytes as of ICU 3.6), + * then the function returns with an error accordingly. + * + * Also unlike ucnv_setSubstChars(), this function works for stateful charsets + * by converting on the fly at the point of substitution rather than setting + * a fixed byte sequence. + * + * @param cnv The UConverter object. + * @param s The Unicode string. + * @param length The number of UChars in s, or -1 for a NUL-terminated string. + * @param err Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * + * @see ucnv_setSubstChars + * @see ucnv_getSubstChars + * @stable ICU 3.6 + */ +U_CAPI void U_EXPORT2 +ucnv_setSubstString(UConverter *cnv, + const UChar *s, + int32_t length, + UErrorCode *err); + +/** + * Fills in the output parameter, errBytes, with the error characters from the + * last failing conversion. + * + * @param converter the Unicode converter + * @param errBytes the codepage bytes which were in error + * @param len on input the capacity of errBytes, on output the number of + * bytes which were copied to it + * @param err the error status code. + * If the substitution character array is too small, an + * U_INDEX_OUTOFBOUNDS_ERROR will be returned. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getInvalidChars(const UConverter *converter, + char *errBytes, + int8_t *len, + UErrorCode *err); + +/** + * Fills in the output parameter, errChars, with the error characters from the + * last failing conversion. + * + * @param converter the Unicode converter + * @param errUChars the UChars which were in error + * @param len on input the capacity of errUChars, on output the number of + * UChars which were copied to it + * @param err the error status code. + * If the substitution character array is too small, an + * U_INDEX_OUTOFBOUNDS_ERROR will be returned. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getInvalidUChars(const UConverter *converter, + UChar *errUChars, + int8_t *len, + UErrorCode *err); + +/** + * Resets the state of a converter to the default state. This is used + * in the case of an error, to restart a conversion from a known default state. + * It will also empty the internal output buffers. + * @param converter the Unicode converter + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_reset(UConverter *converter); + +/** + * Resets the to-Unicode part of a converter state to the default state. + * This is used in the case of an error to restart a conversion to + * Unicode to a known default state. It will also empty the internal + * output buffers used for the conversion to Unicode codepoints. + * @param converter the Unicode converter + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_resetToUnicode(UConverter *converter); + +/** + * Resets the from-Unicode part of a converter state to the default state. + * This is used in the case of an error to restart a conversion from + * Unicode to a known default state. It will also empty the internal output + * buffers used for the conversion from Unicode codepoints. + * @param converter the Unicode converter + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_resetFromUnicode(UConverter *converter); + +/** + * Returns the maximum number of bytes that are output per UChar in conversion + * from Unicode using this converter. + * The returned number can be used with UCNV_GET_MAX_BYTES_FOR_STRING + * to calculate the size of a target buffer for conversion from Unicode. + * + * Note: Before ICU 2.8, this function did not return reliable numbers for + * some stateful converters (EBCDIC_STATEFUL, ISO-2022) and LMBCS. + * + * This number may not be the same as the maximum number of bytes per + * "conversion unit". In other words, it may not be the intuitively expected + * number of bytes per character that would be published for a charset, + * and may not fulfill any other purpose than the allocation of an output + * buffer of guaranteed sufficient size for a given input length and converter. + * + * Examples for special cases that are taken into account: + * - Supplementary code points may convert to more bytes than BMP code points. + * This function returns bytes per UChar (UTF-16 code unit), not per + * Unicode code point, for efficient buffer allocation. + * - State-shifting output (SI/SO, escapes, etc.) from stateful converters. + * - When m input UChars are converted to n output bytes, then the maximum m/n + * is taken into account. + * + * The number returned here does not take into account + * (see UCNV_GET_MAX_BYTES_FOR_STRING): + * - callbacks which output more than one charset character sequence per call, + * like escape callbacks + * - initial and final non-character bytes that are output by some converters + * (automatic BOMs, initial escape sequence, final SI, etc.) + * + * Examples for returned values: + * - SBCS charsets: 1 + * - Shift-JIS: 2 + * - UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted) + * - UTF-8: 3 (3 per BMP, 4 per surrogate _pair_) + * - EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS) + * - ISO-2022: 3 (always outputs UTF-8) + * - ISO-2022-JP: 6 (4-byte escape sequences + DBCS) + * - ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS) + * + * @param converter The Unicode converter. + * @return The maximum number of bytes per UChar (16 bit code unit) + * that are output by ucnv_fromUnicode(), + * to be used together with UCNV_GET_MAX_BYTES_FOR_STRING + * for buffer allocation. + * + * @see UCNV_GET_MAX_BYTES_FOR_STRING + * @see ucnv_getMinCharSize + * @stable ICU 2.0 + */ +U_CAPI int8_t U_EXPORT2 +ucnv_getMaxCharSize(const UConverter *converter); + +/** + * Calculates the size of a buffer for conversion from Unicode to a charset. + * The calculated size is guaranteed to be sufficient for this conversion. + * + * It takes into account initial and final non-character bytes that are output + * by some converters. + * It does not take into account callbacks which output more than one charset + * character sequence per call, like escape callbacks. + * The default (substitution) callback only outputs one charset character sequence. + * + * @param length Number of UChars to be converted. + * @param maxCharSize Return value from ucnv_getMaxCharSize() for the converter + * that will be used. + * @return Size of a buffer that will be large enough to hold the output bytes of + * converting length UChars with the converter that returned the maxCharSize. + * + * @see ucnv_getMaxCharSize + * @stable ICU 2.8 + */ +#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \ + (((int32_t)(length)+10)*(int32_t)(maxCharSize)) + +/** + * Returns the minimum byte length (per codepoint) for characters in this codepage. + * This is usually either 1 or 2. + * @param converter the Unicode converter + * @return the minimum number of bytes per codepoint allowed by this particular converter + * @see ucnv_getMaxCharSize + * @stable ICU 2.0 + */ +U_CAPI int8_t U_EXPORT2 +ucnv_getMinCharSize(const UConverter *converter); + +/** + * Returns the display name of the converter passed in based on the Locale + * passed in. If the locale contains no display name, the internal ASCII + * name will be filled in. + * + * @param converter the Unicode converter. + * @param displayLocale is the specific Locale we want to localized for + * @param displayName user provided buffer to be filled in + * @param displayNameCapacity size of displayName Buffer + * @param err error status code + * @return displayNameLength number of UChar needed in displayName + * @see ucnv_getName + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_getDisplayName(const UConverter *converter, + const char *displayLocale, + UChar *displayName, + int32_t displayNameCapacity, + UErrorCode *err); + +/** + * Gets the internal, canonical name of the converter (zero-terminated). + * The lifetime of the returned string will be that of the converter + * passed to this function. + * @param converter the Unicode converter + * @param err UErrorCode status + * @return the internal name of the converter + * @see ucnv_getDisplayName + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getName(const UConverter *converter, UErrorCode *err); + +/** + * Gets a codepage number associated with the converter. This is not guaranteed + * to be the one used to create the converter. Some converters do not represent + * platform registered codepages and return zero for the codepage number. + * The error code fill-in parameter indicates if the codepage number + * is available. + * Does not check if the converter is NULL or if converter's data + * table is NULL. + * + * Important: The use of CCSIDs is not recommended because it is limited + * to only two platforms in principle and only one (UCNV_IBM) in the current + * ICU converter API. + * Also, CCSIDs are insufficient to identify IBM Unicode conversion tables precisely. + * For more details see ucnv_openCCSID(). + * + * @param converter the Unicode converter + * @param err the error status code. + * @return If any error occurs, -1 will be returned otherwise, the codepage number + * will be returned + * @see ucnv_openCCSID + * @see ucnv_getPlatform + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_getCCSID(const UConverter *converter, + UErrorCode *err); + +/** + * Gets a codepage platform associated with the converter. Currently, + * only UCNV_IBM will be returned. + * Does not test if the converter is NULL or if converter's data + * table is NULL. + * @param converter the Unicode converter + * @param err the error status code. + * @return The codepage platform + * @stable ICU 2.0 + */ +U_CAPI UConverterPlatform U_EXPORT2 +ucnv_getPlatform(const UConverter *converter, + UErrorCode *err); + +/** + * Gets the type of the converter + * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022, + * EBCDIC_STATEFUL, LATIN_1 + * @param converter a valid, opened converter + * @return the type of the converter + * @stable ICU 2.0 + */ +U_CAPI UConverterType U_EXPORT2 +ucnv_getType(const UConverter * converter); + +/** + * Gets the "starter" (lead) bytes for converters of type MBCS. + * Will fill in an U_ILLEGAL_ARGUMENT_ERROR if converter passed in + * is not MBCS. Fills in an array of type UBool, with the value of the byte + * as offset to the array. For example, if (starters[0x20] == true) at return, + * it means that the byte 0x20 is a starter byte in this converter. + * Context pointers are always owned by the caller. + * + * @param converter a valid, opened converter of type MBCS + * @param starters an array of size 256 to be filled in + * @param err error status, U_ILLEGAL_ARGUMENT_ERROR if the + * converter is not a type which can return starters. + * @see ucnv_getType + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getStarters(const UConverter* converter, + UBool starters[256], + UErrorCode* err); + + +/** + * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet(). + * @see ucnv_getUnicodeSet + * @stable ICU 2.6 + */ +typedef enum UConverterUnicodeSet { + /** Select the set of roundtrippable Unicode code points. @stable ICU 2.6 */ + UCNV_ROUNDTRIP_SET, + /** Select the set of Unicode code points with roundtrip or fallback mappings. @stable ICU 4.0 */ + UCNV_ROUNDTRIP_AND_FALLBACK_SET, +#ifndef U_HIDE_DEPRECATED_API + /** + * Number of UConverterUnicodeSet selectors. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCNV_SET_COUNT +#endif // U_HIDE_DEPRECATED_API +} UConverterUnicodeSet; + + +/** + * Returns the set of Unicode code points that can be converted by an ICU converter. + * + * Returns one of several kinds of set: + * + * 1. UCNV_ROUNDTRIP_SET + * + * The set of all Unicode code points that can be roundtrip-converted + * (converted without any data loss) with the converter (ucnv_fromUnicode()). + * This set will not include code points that have fallback mappings + * or are only the result of reverse fallback mappings. + * This set will also not include PUA code points with fallbacks, although + * ucnv_fromUnicode() will always uses those mappings despite ucnv_setFallback(). + * See UTR #22 "Character Mapping Markup Language" + * at http://www.unicode.org/reports/tr22/ + * + * This is useful for example for + * - checking that a string or document can be roundtrip-converted with a converter, + * without/before actually performing the conversion + * - testing if a converter can be used for text for typical text for a certain locale, + * by comparing its roundtrip set with the set of ExemplarCharacters from + * ICU's locale data or other sources + * + * 2. UCNV_ROUNDTRIP_AND_FALLBACK_SET + * + * The set of all Unicode code points that can be converted with the converter (ucnv_fromUnicode()) + * when fallbacks are turned on (see ucnv_setFallback()). + * This set includes all code points with roundtrips and fallbacks (but not reverse fallbacks). + * + * In the future, there may be more UConverterUnicodeSet choices to select + * sets with different properties. + * + * @param cnv The converter for which a set is requested. + * @param setFillIn A valid USet *. It will be cleared by this function before + * the converter's specific set is filled into the USet. + * @param whichSet A UConverterUnicodeSet selector; + * currently UCNV_ROUNDTRIP_SET is the only supported value. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * + * @see UConverterUnicodeSet + * @see uset_open + * @see uset_close + * @stable ICU 2.6 + */ +U_CAPI void U_EXPORT2 +ucnv_getUnicodeSet(const UConverter *cnv, + USet *setFillIn, + UConverterUnicodeSet whichSet, + UErrorCode *pErrorCode); + +/** + * Gets the current calback function used by the converter when an illegal + * or invalid codepage sequence is found. + * Context pointers are always owned by the caller. + * + * @param converter the unicode converter + * @param action fillin: returns the callback function pointer + * @param context fillin: returns the callback's private void* context + * @see ucnv_setToUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getToUCallBack (const UConverter * converter, + UConverterToUCallback *action, + const void **context); + +/** + * Gets the current callback function used by the converter when illegal + * or invalid Unicode sequence is found. + * Context pointers are always owned by the caller. + * + * @param converter the unicode converter + * @param action fillin: returns the callback function pointer + * @param context fillin: returns the callback's private void* context + * @see ucnv_setFromUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getFromUCallBack (const UConverter * converter, + UConverterFromUCallback *action, + const void **context); + +/** + * Changes the callback function used by the converter when + * an illegal or invalid sequence is found. + * Context pointers are always owned by the caller. + * Predefined actions and contexts can be found in the ucnv_err.h header. + * + * @param converter the unicode converter + * @param newAction the new callback function + * @param newContext the new toUnicode callback context pointer. This can be NULL. + * @param oldAction fillin: returns the old callback function pointer. This can be NULL. + * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. + * @param err The error code status + * @see ucnv_getToUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_setToUCallBack (UConverter * converter, + UConverterToUCallback newAction, + const void* newContext, + UConverterToUCallback *oldAction, + const void** oldContext, + UErrorCode * err); + +/** + * Changes the current callback function used by the converter when + * an illegal or invalid sequence is found. + * Context pointers are always owned by the caller. + * Predefined actions and contexts can be found in the ucnv_err.h header. + * + * @param converter the unicode converter + * @param newAction the new callback function + * @param newContext the new fromUnicode callback context pointer. This can be NULL. + * @param oldAction fillin: returns the old callback function pointer. This can be NULL. + * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. + * @param err The error code status + * @see ucnv_getFromUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_setFromUCallBack (UConverter * converter, + UConverterFromUCallback newAction, + const void *newContext, + UConverterFromUCallback *oldAction, + const void **oldContext, + UErrorCode * err); + +/** + * Converts an array of unicode characters to an array of codepage + * characters. This function is optimized for converting a continuous + * stream of data in buffer-sized chunks, where the entire source and + * target does not fit in available buffers. + * + * The source pointer is an in/out parameter. It starts out pointing where the + * conversion is to begin, and ends up pointing after the last UChar consumed. + * + * Target similarly starts out pointer at the first available byte in the output + * buffer, and ends up pointing after the last byte written to the output. + * + * The converter always attempts to consume the entire source buffer, unless + * (1.) the target buffer is full, or (2.) a failing error is returned from the + * current callback function. When a successful error status has been + * returned, it means that all of the source buffer has been + * consumed. At that point, the caller should reset the source and + * sourceLimit pointers to point to the next chunk. + * + * At the end of the stream (flush==true), the input is completely consumed + * when *source==sourceLimit and no error code is set. + * The converter object is then automatically reset by this function. + * (This means that a converter need not be reset explicitly between data + * streams if it finishes the previous stream without errors.) + * + * This is a stateful conversion. Additionally, even when all source data has + * been consumed, some data may be in the converters' internal state. + * Call this function repeatedly, updating the target pointers with + * the next empty chunk of target in case of a + * U_BUFFER_OVERFLOW_ERROR, and updating the source pointers + * with the next chunk of source when a successful error status is + * returned, until there are no more chunks of source data. + * @param converter the Unicode converter + * @param target I/O parameter. Input : Points to the beginning of the buffer to copy + * codepage characters to. Output : points to after the last codepage character copied + * to target. + * @param targetLimit the pointer just after last of the target buffer + * @param source I/O parameter, pointer to pointer to the source Unicode character buffer. + * @param sourceLimit the pointer just after the last of the source buffer + * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number + * of allocated cells as target. Will fill in offsets from target to source pointer + * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] + * For output data carried across calls, and other data without a specific source character + * (such as from escape sequences or callbacks) -1 will be placed for offsets. + * @param flush set to true if the current source buffer is the last available + * chunk of the source, false otherwise. Note that if a failing status is returned, + * this function may have to be called multiple times with flush set to true until + * the source buffer is consumed. + * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the + * converter is NULL. + * U_BUFFER_OVERFLOW_ERROR will be set if the target is full and there is + * still data to be written to the target. + * @see ucnv_fromUChars + * @see ucnv_convert + * @see ucnv_getMinCharSize + * @see ucnv_setToUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_fromUnicode (UConverter * converter, + char **target, + const char *targetLimit, + const UChar ** source, + const UChar * sourceLimit, + int32_t* offsets, + UBool flush, + UErrorCode * err); + +/** + * Converts a buffer of codepage bytes into an array of unicode UChars + * characters. This function is optimized for converting a continuous + * stream of data in buffer-sized chunks, where the entire source and + * target does not fit in available buffers. + * + * The source pointer is an in/out parameter. It starts out pointing where the + * conversion is to begin, and ends up pointing after the last byte of source consumed. + * + * Target similarly starts out pointer at the first available UChar in the output + * buffer, and ends up pointing after the last UChar written to the output. + * It does NOT necessarily keep UChar sequences together. + * + * The converter always attempts to consume the entire source buffer, unless + * (1.) the target buffer is full, or (2.) a failing error is returned from the + * current callback function. When a successful error status has been + * returned, it means that all of the source buffer has been + * consumed. At that point, the caller should reset the source and + * sourceLimit pointers to point to the next chunk. + * + * At the end of the stream (flush==true), the input is completely consumed + * when *source==sourceLimit and no error code is set + * The converter object is then automatically reset by this function. + * (This means that a converter need not be reset explicitly between data + * streams if it finishes the previous stream without errors.) + * + * This is a stateful conversion. Additionally, even when all source data has + * been consumed, some data may be in the converters' internal state. + * Call this function repeatedly, updating the target pointers with + * the next empty chunk of target in case of a + * U_BUFFER_OVERFLOW_ERROR, and updating the source pointers + * with the next chunk of source when a successful error status is + * returned, until there are no more chunks of source data. + * @param converter the Unicode converter + * @param target I/O parameter. Input : Points to the beginning of the buffer to copy + * UChars into. Output : points to after the last UChar copied. + * @param targetLimit the pointer just after the end of the target buffer + * @param source I/O parameter, pointer to pointer to the source codepage buffer. + * @param sourceLimit the pointer to the byte after the end of the source buffer + * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number + * of allocated cells as target. Will fill in offsets from target to source pointer + * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] + * For output data carried across calls, and other data without a specific source character + * (such as from escape sequences or callbacks) -1 will be placed for offsets. + * @param flush set to true if the current source buffer is the last available + * chunk of the source, false otherwise. Note that if a failing status is returned, + * this function may have to be called multiple times with flush set to true until + * the source buffer is consumed. + * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the + * converter is NULL. + * U_BUFFER_OVERFLOW_ERROR will be set if the target is full and there is + * still data to be written to the target. + * @see ucnv_fromUChars + * @see ucnv_convert + * @see ucnv_getMinCharSize + * @see ucnv_setFromUCallBack + * @see ucnv_getNextUChar + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_toUnicode(UConverter *converter, + UChar **target, + const UChar *targetLimit, + const char **source, + const char *sourceLimit, + int32_t *offsets, + UBool flush, + UErrorCode *err); + +/** + * Convert the Unicode string into a codepage string using an existing UConverter. + * The output string is NUL-terminated if possible. + * + * This function is a more convenient but less powerful version of ucnv_fromUnicode(). + * It is only useful for whole strings, not for streaming conversion. + * + * The maximum output buffer capacity required (barring output from callbacks) will be + * UCNV_GET_MAX_BYTES_FOR_STRING(srcLength, ucnv_getMaxCharSize(cnv)). + * + * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called) + * @param src the input Unicode string + * @param srcLength the input string length, or -1 if NUL-terminated + * @param dest destination string buffer, can be NULL if destCapacity==0 + * @param destCapacity the number of chars available at dest + * @param pErrorCode normal ICU error code; + * common error codes that may be set by this function include + * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING, + * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors + * @return the length of the output string, not counting the terminating NUL; + * if the length is greater than destCapacity, then the string will not fit + * and a buffer of the indicated length would need to be passed in + * @see ucnv_fromUnicode + * @see ucnv_convert + * @see UCNV_GET_MAX_BYTES_FOR_STRING + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_fromUChars(UConverter *cnv, + char *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert the codepage string into a Unicode string using an existing UConverter. + * The output string is NUL-terminated if possible. + * + * This function is a more convenient but less powerful version of ucnv_toUnicode(). + * It is only useful for whole strings, not for streaming conversion. + * + * The maximum output buffer capacity required (barring output from callbacks) will be + * 2*srcLength (each char may be converted into a surrogate pair). + * + * @param cnv the converter object to be used (ucnv_resetToUnicode() will be called) + * @param src the input codepage string + * @param srcLength the input string length, or -1 if NUL-terminated + * @param dest destination string buffer, can be NULL if destCapacity==0 + * @param destCapacity the number of UChars available at dest + * @param pErrorCode normal ICU error code; + * common error codes that may be set by this function include + * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING, + * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors + * @return the length of the output string, not counting the terminating NUL; + * if the length is greater than destCapacity, then the string will not fit + * and a buffer of the indicated length would need to be passed in + * @see ucnv_toUnicode + * @see ucnv_convert + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_toUChars(UConverter *cnv, + UChar *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a codepage buffer into Unicode one character at a time. + * The input is completely consumed when the U_INDEX_OUTOFBOUNDS_ERROR is set. + * + * Advantage compared to ucnv_toUnicode() or ucnv_toUChars(): + * - Faster for small amounts of data, for most converters, e.g., + * US-ASCII, ISO-8859-1, UTF-8/16/32, and most "normal" charsets. + * (For complex converters, e.g., SCSU, UTF-7 and ISO 2022 variants, + * it uses ucnv_toUnicode() internally.) + * - Convenient. + * + * Limitations compared to ucnv_toUnicode(): + * - Always assumes flush=true. + * This makes ucnv_getNextUChar() unsuitable for "streaming" conversion, + * that is, for where the input is supplied in multiple buffers, + * because ucnv_getNextUChar() will assume the end of the input at the end + * of the first buffer. + * - Does not provide offset output. + * + * It is possible to "mix" ucnv_getNextUChar() and ucnv_toUnicode() because + * ucnv_getNextUChar() uses the current state of the converter + * (unlike ucnv_toUChars() which always resets first). + * However, if ucnv_getNextUChar() is called after ucnv_toUnicode() + * stopped in the middle of a character sequence (with flush=false), + * then ucnv_getNextUChar() will always use the slower ucnv_toUnicode() + * internally until the next character boundary. + * (This is new in ICU 2.6. In earlier releases, ucnv_getNextUChar() had to + * start at a character boundary.) + * + * Instead of using ucnv_getNextUChar(), it is recommended + * to convert using ucnv_toUnicode() or ucnv_toUChars() + * and then iterate over the text using U16_NEXT() or a UCharIterator (uiter.h) + * or a C++ CharacterIterator or similar. + * This allows streaming conversion and offset output, for example. + * + *

Handling of surrogate pairs and supplementary-plane code points:
+ * There are two different kinds of codepages that provide mappings for surrogate characters: + *

    + *
  • Codepages like UTF-8, UTF-32, and GB 18030 provide direct representations for Unicode + * code points U+10000-U+10ffff as well as for single surrogates U+d800-U+dfff. + * Each valid sequence will result in exactly one returned code point. + * If a sequence results in a single surrogate, then that will be returned + * by itself, even if a neighboring sequence encodes the matching surrogate.
  • + *
  • Codepages like SCSU and LMBCS (and UTF-16) provide direct representations only for BMP code points + * including surrogates. Code points in supplementary planes are represented with + * two sequences, each encoding a surrogate. + * For these codepages, matching pairs of surrogates will be combined into single + * code points for returning from this function. + * (Note that SCSU is actually a mix of these codepage types.)
  • + *

+ * + * @param converter an open UConverter + * @param source the address of a pointer to the codepage buffer, will be + * updated to point after the bytes consumed in the conversion call. + * @param sourceLimit points to the end of the input buffer + * @param err fills in error status (see ucnv_toUnicode) + * U_INDEX_OUTOFBOUNDS_ERROR will be set if the input + * is empty or does not convert to any output (e.g.: pure state-change + * codes SI/SO, escape sequences for ISO 2022, + * or if the callback did not output anything, ...). + * This function will not set a U_BUFFER_OVERFLOW_ERROR because + * the "buffer" is the return code. However, there might be subsequent output + * stored in the converter object + * that will be returned in following calls to this function. + * @return a UChar32 resulting from the partial conversion of source + * @see ucnv_toUnicode + * @see ucnv_toUChars + * @see ucnv_convert + * @stable ICU 2.0 + */ +U_CAPI UChar32 U_EXPORT2 +ucnv_getNextUChar(UConverter * converter, + const char **source, + const char * sourceLimit, + UErrorCode * err); + +/** + * Convert from one external charset to another using two existing UConverters. + * Internally, two conversions - ucnv_toUnicode() and ucnv_fromUnicode() - + * are used, "pivoting" through 16-bit Unicode. + * + * Important: For streaming conversion (multiple function calls for successive + * parts of a text stream), the caller must provide a pivot buffer explicitly, + * and must preserve the pivot buffer and associated pointers from one + * call to another. (The buffer may be moved if its contents and the relative + * pointer positions are preserved.) + * + * There is a similar function, ucnv_convert(), + * which has the following limitations: + * - it takes charset names, not converter objects, so that + * - two converters are opened for each call + * - only single-string conversion is possible, not streaming operation + * - it does not provide enough information to find out, + * in case of failure, whether the toUnicode or + * the fromUnicode conversion failed + * + * By contrast, ucnv_convertEx() + * - takes UConverter parameters instead of charset names + * - fully exposes the pivot buffer for streaming conversion and complete error handling + * + * ucnv_convertEx() also provides further convenience: + * - an option to reset the converters at the beginning + * (if reset==true, see parameters; + * also sets *pivotTarget=*pivotSource=pivotStart) + * - allow NUL-terminated input + * (only a single NUL byte, will not work for charsets with multi-byte NULs) + * (if sourceLimit==NULL, see parameters) + * - terminate with a NUL on output + * (only a single NUL byte, not useful for charsets with multi-byte NULs), + * or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills + * the target buffer + * - the pivot buffer can be provided internally; + * possible only for whole-string conversion, not streaming conversion; + * in this case, the caller will not be able to get details about where an + * error occurred + * (if pivotStart==NULL, see below) + * + * The function returns when one of the following is true: + * - the entire source text has been converted successfully to the target buffer + * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR) + * - a conversion error occurred + * (other U_FAILURE(), see description of pErrorCode) + * + * Limitation compared to the direct use of + * ucnv_fromUnicode() and ucnv_toUnicode(): + * ucnv_convertEx() does not provide offset information. + * + * Limitation compared to ucnv_fromUChars() and ucnv_toUChars(): + * ucnv_convertEx() does not support preflighting directly. + * + * Sample code for converting a single string from + * one external charset to UTF-8, ignoring the location of errors: + * + * \code + * int32_t + * myToUTF8(UConverter *cnv, + * const char *s, int32_t length, + * char *u8, int32_t capacity, + * UErrorCode *pErrorCode) { + * UConverter *utf8Cnv; + * char *target; + * + * if(U_FAILURE(*pErrorCode)) { + * return 0; + * } + * + * utf8Cnv=myGetCachedUTF8Converter(pErrorCode); + * if(U_FAILURE(*pErrorCode)) { + * return 0; + * } + * + * if(length<0) { + * length=strlen(s); + * } + * target=u8; + * ucnv_convertEx(utf8Cnv, cnv, + * &target, u8+capacity, + * &s, s+length, + * NULL, NULL, NULL, NULL, + * true, true, + * pErrorCode); + * + * myReleaseCachedUTF8Converter(utf8Cnv); + * + * // return the output string length, but without preflighting + * return (int32_t)(target-u8); + * } + * \endcode + * + * @param targetCnv Output converter, used to convert from the UTF-16 pivot + * to the target using ucnv_fromUnicode(). + * @param sourceCnv Input converter, used to convert from the source to + * the UTF-16 pivot using ucnv_toUnicode(). + * @param target I/O parameter, same as for ucnv_fromUChars(). + * Input: *target points to the beginning of the target buffer. + * Output: *target points to the first unit after the last char written. + * @param targetLimit Pointer to the first unit after the target buffer. + * @param source I/O parameter, same as for ucnv_toUChars(). + * Input: *source points to the beginning of the source buffer. + * Output: *source points to the first unit after the last char read. + * @param sourceLimit Pointer to the first unit after the source buffer. + * @param pivotStart Pointer to the UTF-16 pivot buffer. If pivotStart==NULL, + * then an internal buffer is used and the other pivot + * arguments are ignored and can be NULL as well. + * @param pivotSource I/O parameter, same as source in ucnv_fromUChars() for + * conversion from the pivot buffer to the target buffer. + * @param pivotTarget I/O parameter, same as target in ucnv_toUChars() for + * conversion from the source buffer to the pivot buffer. + * It must be pivotStart<=*pivotSource<=*pivotTarget<=pivotLimit + * and pivotStart[0..ucnv_countAvailable()]) + * @return a pointer a string (library owned), or NULL if the index is out of bounds. + * @see ucnv_countAvailable + * @stable ICU 2.0 + */ +U_CAPI const char* U_EXPORT2 +ucnv_getAvailableName(int32_t n); + +/** + * Returns a UEnumeration to enumerate all of the canonical converter + * names, as per the alias file, regardless of the ability to open each + * converter. + * + * @return A UEnumeration object for getting all the recognized canonical + * converter names. + * @see ucnv_getAvailableName + * @see uenum_close + * @see uenum_next + * @stable ICU 2.4 + */ +U_CAPI UEnumeration * U_EXPORT2 +ucnv_openAllNames(UErrorCode *pErrorCode); + +/** + * Gives the number of aliases for a given converter or alias name. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * This method only enumerates the listed entries in the alias file. + * @param alias alias name + * @param pErrorCode error status + * @return number of names on alias list for given alias + * @stable ICU 2.0 + */ +U_CAPI uint16_t U_EXPORT2 +ucnv_countAliases(const char *alias, UErrorCode *pErrorCode); + +/** + * Gives the name of the alias at given index of alias list. + * This method only enumerates the listed entries in the alias file. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * @param alias alias name + * @param n index in alias list + * @param pErrorCode result of operation + * @return returns the name of the alias at given index + * @see ucnv_countAliases + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode); + +/** + * Fill-up the list of alias names for the given alias. + * This method only enumerates the listed entries in the alias file. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * @param alias alias name + * @param aliases fill-in list, aliases is a pointer to an array of + * ucnv_countAliases() string-pointers + * (const char *) that will be filled in. + * The strings themselves are owned by the library. + * @param pErrorCode result of operation + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode); + +/** + * Return a new UEnumeration object for enumerating all the + * alias names for a given converter that are recognized by a standard. + * This method only enumerates the listed entries in the alias file. + * The convrtrs.txt file can be modified to change the results of + * this function. + * The first result in this list is the same result given by + * ucnv_getStandardName, which is the default alias for + * the specified standard name. The returned object must be closed with + * uenum_close when you are done with the object. + * + * @param convName original converter name + * @param standard name of the standard governing the names; MIME and IANA + * are such standards + * @param pErrorCode The error code + * @return A UEnumeration object for getting all aliases that are recognized + * by a standard. If any of the parameters are invalid, NULL + * is returned. + * @see ucnv_getStandardName + * @see uenum_close + * @see uenum_next + * @stable ICU 2.2 + */ +U_CAPI UEnumeration * U_EXPORT2 +ucnv_openStandardNames(const char *convName, + const char *standard, + UErrorCode *pErrorCode); + +/** + * Gives the number of standards associated to converter names. + * @return number of standards + * @stable ICU 2.0 + */ +U_CAPI uint16_t U_EXPORT2 +ucnv_countStandards(void); + +/** + * Gives the name of the standard at given index of standard list. + * @param n index in standard list + * @param pErrorCode result of operation + * @return returns the name of the standard at given index. Owned by the library. + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode); + +/** + * Returns a standard name for a given converter name. + *

+ * Example alias table:
+ * conv alias1 { STANDARD1 } alias2 { STANDARD1* } + *

+ * Result of ucnv_getStandardName("conv", "STANDARD1") from example + * alias table:
+ * "alias2" + * + * @param name original converter name + * @param standard name of the standard governing the names; MIME and IANA + * are such standards + * @param pErrorCode result of operation + * @return returns the standard converter name; + * if a standard converter name cannot be determined, + * then NULL is returned. Owned by the library. + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode); + +/** + * This function will return the internal canonical converter name of the + * tagged alias. This is the opposite of ucnv_openStandardNames, which + * returns the tagged alias given the canonical name. + *

+ * Example alias table:
+ * conv alias1 { STANDARD1 } alias2 { STANDARD1* } + *

+ * Result of ucnv_getStandardName("alias1", "STANDARD1") from example + * alias table:
+ * "conv" + * + * @return returns the canonical converter name; + * if a standard or alias name cannot be determined, + * then NULL is returned. The returned string is + * owned by the library. + * @see ucnv_getStandardName + * @stable ICU 2.4 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode); + +/** + * Returns the current default converter name. If you want to open + * a default converter, you do not need to use this function. + * It is faster if you pass a NULL argument to ucnv_open the + * default converter. + * + * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function + * always returns "UTF-8". + * + * @return returns the current default converter name. + * Storage owned by the library + * @see ucnv_setDefaultName + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getDefaultName(void); + +#ifndef U_HIDE_SYSTEM_API +/** + * This function is not thread safe. DO NOT call this function when ANY ICU + * function is being used from more than one thread! This function sets the + * current default converter name. If this function needs to be called, it + * should be called during application initialization. Most of the time, the + * results from ucnv_getDefaultName() or ucnv_open with a NULL string argument + * is sufficient for your application. + * + * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function + * does nothing. + * + * @param name the converter name to be the default (must be known by ICU). + * @see ucnv_getDefaultName + * @system + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_setDefaultName(const char *name); +#endif /* U_HIDE_SYSTEM_API */ + +/** + * Fixes the backslash character mismapping. For example, in SJIS, the backslash + * character in the ASCII portion is also used to represent the yen currency sign. + * When mapping from Unicode character 0x005C, it's unclear whether to map the + * character back to yen or backslash in SJIS. This function will take the input + * buffer and replace all the yen sign characters with backslash. This is necessary + * when the user tries to open a file with the input buffer on Windows. + * This function will test the converter to see whether such mapping is + * required. You can sometimes avoid using this function by using the correct version + * of Shift-JIS. + * + * @param cnv The converter representing the target codepage. + * @param source the input buffer to be fixed + * @param sourceLen the length of the input buffer + * @see ucnv_isAmbiguous + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen); + +/** + * Determines if the converter contains ambiguous mappings of the same + * character or not. + * @param cnv the converter to be tested + * @return true if the converter contains ambiguous mapping of the same + * character, false otherwise. + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +ucnv_isAmbiguous(const UConverter *cnv); + +/** + * Sets the converter to use fallback mappings or not. + * Regardless of this flag, the converter will always use + * fallbacks from Unicode Private Use code points, as well as + * reverse fallbacks (to Unicode). + * For details see ".ucm File Format" + * in the Conversion Data chapter of the ICU User Guide: + * http://www.icu-project.org/userguide/conversion-data.html#ucmformat + * + * @param cnv The converter to set the fallback mapping usage on. + * @param usesFallback true if the user wants the converter to take advantage of the fallback + * mapping, false otherwise. + * @stable ICU 2.0 + * @see ucnv_usesFallback + */ +U_CAPI void U_EXPORT2 +ucnv_setFallback(UConverter *cnv, UBool usesFallback); + +/** + * Determines if the converter uses fallback mappings or not. + * This flag has restrictions, see ucnv_setFallback(). + * + * @param cnv The converter to be tested + * @return true if the converter uses fallback, false otherwise. + * @stable ICU 2.0 + * @see ucnv_setFallback + */ +U_CAPI UBool U_EXPORT2 +ucnv_usesFallback(const UConverter *cnv); + +/** + * Detects Unicode signature byte sequences at the start of the byte stream + * and returns the charset name of the indicated Unicode charset. + * NULL is returned when no Unicode signature is recognized. + * The number of bytes in the signature is output as well. + * + * The caller can ucnv_open() a converter using the charset name. + * The first code unit (UChar) from the start of the stream will be U+FEFF + * (the Unicode BOM/signature character) and can usually be ignored. + * + * For most Unicode charsets it is also possible to ignore the indicated + * number of initial stream bytes and start converting after them. + * However, there are stateful Unicode charsets (UTF-7 and BOCU-1) for which + * this will not work. Therefore, it is best to ignore the first output UChar + * instead of the input signature bytes. + *

+ * Usage: + * \snippet samples/ucnv/convsamp.cpp ucnv_detectUnicodeSignature + * + * @param source The source string in which the signature should be detected. + * @param sourceLength Length of the input string, or -1 if terminated with a NUL byte. + * @param signatureLength A pointer to int32_t to receive the number of bytes that make up the signature + * of the detected UTF. 0 if not detected. + * Can be a NULL pointer. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return The name of the encoding detected. NULL if encoding is not detected. + * @stable ICU 2.4 + */ +U_CAPI const char* U_EXPORT2 +ucnv_detectUnicodeSignature(const char* source, + int32_t sourceLength, + int32_t *signatureLength, + UErrorCode *pErrorCode); + +/** + * Returns the number of UChars held in the converter's internal state + * because more input is needed for completing the conversion. This function is + * useful for mapping semantics of ICU's converter interface to those of iconv, + * and this information is not needed for normal conversion. + * @param cnv The converter in which the input is held + * @param status ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return The number of UChars in the state. -1 if an error is encountered. + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status); + +/** + * Returns the number of chars held in the converter's internal state + * because more input is needed for completing the conversion. This function is + * useful for mapping semantics of ICU's converter interface to those of iconv, + * and this information is not needed for normal conversion. + * @param cnv The converter in which the input is held as internal state + * @param status ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return The number of chars in the state. -1 if an error is encountered. + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status); + +/** + * Returns whether or not the charset of the converter has a fixed number of bytes + * per charset character. + * An example of this are converters that are of the type UCNV_SBCS or UCNV_DBCS. + * Another example is UTF-32 which is always 4 bytes per character. + * A Unicode code point may be represented by more than one UTF-8 or UTF-16 code unit + * but a UTF-32 converter encodes each code point with 4 bytes. + * Note: This method is not intended to be used to determine whether the charset has a + * fixed ratio of bytes to Unicode codes units for any particular Unicode encoding form. + * false is returned with the UErrorCode if error occurs or cnv is NULL. + * @param cnv The converter to be tested + * @param status ICU error code in/out paramter + * @return true if the converter is fixed-width + * @stable ICU 4.8 + */ +U_CAPI UBool U_EXPORT2 +ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status); + +#endif + +#endif +/*_UCNV*/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnv_cb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnv_cb.h new file mode 100644 index 0000000000000000000000000000000000000000..41845d1bcaeabe1a8084b9bc05dc4e93c1d8b3a8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnv_cb.h @@ -0,0 +1,164 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2000-2004, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** + * ucnv_cb.h: + * External APIs for the ICU's codeset conversion library + * Helena Shih + * + * Modification History: + * + * Date Name Description + */ + +/** + * \file + * \brief C UConverter functions to aid the writers of callbacks + * + *

Callback API for UConverter

+ * + * These functions are provided here for the convenience of the callback + * writer. If you are just looking for callback functions to use, please + * see ucnv_err.h. DO NOT call these functions directly when you are + * working with converters, unless your code has been called as a callback + * via ucnv_setFromUCallback or ucnv_setToUCallback !! + * + * A note about error codes and overflow. Unlike other ICU functions, + * these functions do not expect the error status to be U_ZERO_ERROR. + * Callbacks must be much more careful about their error codes. + * The error codes used here are in/out parameters, which should be passed + * back in the callback's error parameter. + * + * For example, if you call ucnv_cbfromUWriteBytes to write data out + * to the output codepage, it may return U_BUFFER_OVERFLOW_ERROR if + * the data did not fit in the target. But this isn't a failing error, + * in fact, ucnv_cbfromUWriteBytes may be called AGAIN with the error + * status still U_BUFFER_OVERFLOW_ERROR to attempt to write further bytes, + * which will also go into the internal overflow buffers. + * + * Concerning offsets, the 'offset' parameters here are relative to the start + * of SOURCE. For example, Suppose the string "ABCD" was being converted + * from Unicode into a codepage which doesn't have a mapping for 'B'. + * 'A' will be written out correctly, but + * The FromU Callback will be called on an unassigned character for 'B'. + * At this point, this is the state of the world: + * Target: A [..] [points after A] + * Source: A B [C] D [points to C - B has been consumed] + * 0 1 2 3 + * codePoint = "B" [the unassigned codepoint] + * + * Now, suppose a callback wants to write the substitution character '?' to + * the target. It calls ucnv_cbFromUWriteBytes() to write the ?. + * It should pass ZERO as the offset, because the offset as far as the + * callback is concerned is relative to the SOURCE pointer [which points + * before 'C'.] If the callback goes into the args and consumes 'C' also, + * it would call FromUWriteBytes with an offset of 1 (and advance the source + * pointer). + * + */ + +#ifndef UCNV_CB_H +#define UCNV_CB_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "unicode/ucnv_err.h" + +/** + * ONLY used by FromU callback functions. + * Writes out the specified byte output bytes to the target byte buffer or to converter internal buffers. + * + * @param args callback fromUnicode arguments + * @param source source bytes to write + * @param length length of bytes to write + * @param offsetIndex the relative offset index from callback. + * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must + * be returned to the user, because it means that not all data could be written into the target buffer, and some is + * in the converter error buffer. + * @see ucnv_cbFromUWriteSub + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args, + const char* source, + int32_t length, + int32_t offsetIndex, + UErrorCode * err); + +/** + * ONLY used by FromU callback functions. + * This function will write out the correct substitution character sequence + * to the target. + * + * @param args callback fromUnicode arguments + * @param offsetIndex the relative offset index from the current source pointer to be used + * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must + * be returned to the user, because it means that not all data could be written into the target buffer, and some is + * in the converter error buffer. + * @see ucnv_cbFromUWriteBytes + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args, + int32_t offsetIndex, + UErrorCode * err); + +/** + * ONLY used by fromU callback functions. + * This function will write out the error character(s) to the target UChar buffer. + * + * @param args callback fromUnicode arguments + * @param source pointer to pointer to first UChar to write [on exit: 1 after last UChar processed] + * @param sourceLimit pointer after last UChar to write + * @param offsetIndex the relative offset index from callback which will be set + * @param err error status U_BUFFER_OVERFLOW + * @see ucnv_cbToUWriteSub + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args, + const UChar** source, + const UChar* sourceLimit, + int32_t offsetIndex, + UErrorCode * err); + +/** + * ONLY used by ToU callback functions. + * This function will write out the specified characters to the target + * UChar buffer. + * + * @param args callback toUnicode arguments + * @param source source string to write + * @param length the length of source string + * @param offsetIndex the relative offset index which will be written. + * @param err error status U_BUFFER_OVERFLOW + * @see ucnv_cbToUWriteSub + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args, + const UChar* source, + int32_t length, + int32_t offsetIndex, + UErrorCode * err); + +/** + * ONLY used by ToU callback functions. + * This function will write out the Unicode substitution character (U+FFFD). + * + * @param args callback fromUnicode arguments + * @param offsetIndex the relative offset index from callback. + * @param err error status U_BUFFER_OVERFLOW + * @see ucnv_cbToUWriteUChars + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args, + int32_t offsetIndex, + UErrorCode * err); +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnv_err.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnv_err.h new file mode 100644 index 0000000000000000000000000000000000000000..7209ba5f7b85f46ec385fbe8ff00338aee957345 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnv_err.h @@ -0,0 +1,465 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2009, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** + * + * + * ucnv_err.h: + */ + +/** + * \file + * \brief C UConverter predefined error callbacks + * + *

Error Behaviour Functions

+ * Defines some error behaviour functions called by ucnv_{from,to}Unicode + * These are provided as part of ICU and many are stable, but they + * can also be considered only as an example of what can be done with + * callbacks. You may of course write your own. + * + * If you want to write your own, you may also find the functions from + * ucnv_cb.h useful when writing your own callbacks. + * + * These functions, although public, should NEVER be called directly. + * They should be used as parameters to the ucnv_setFromUCallback + * and ucnv_setToUCallback functions, to set the behaviour of a converter + * when it encounters ILLEGAL/UNMAPPED/INVALID sequences. + * + * usage example: 'STOP' doesn't need any context, but newContext + * could be set to something other than 'NULL' if needed. The available + * contexts in this header can modify the default behavior of the callback. + * + * \code + * UErrorCode err = U_ZERO_ERROR; + * UConverter *myConverter = ucnv_open("ibm-949", &err); + * const void *oldContext; + * UConverterFromUCallback oldAction; + * + * + * if (U_SUCCESS(err)) + * { + * ucnv_setFromUCallBack(myConverter, + * UCNV_FROM_U_CALLBACK_STOP, + * NULL, + * &oldAction, + * &oldContext, + * &status); + * } + * \endcode + * + * The code above tells "myConverter" to stop when it encounters an + * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from + * Unicode -> Codepage. The behavior from Codepage to Unicode is not changed, + * and ucnv_setToUCallBack would need to be called in order to change + * that behavior too. + * + * Here is an example with a context: + * + * \code + * UErrorCode err = U_ZERO_ERROR; + * UConverter *myConverter = ucnv_open("ibm-949", &err); + * const void *oldContext; + * UConverterFromUCallback oldAction; + * + * + * if (U_SUCCESS(err)) + * { + * ucnv_setToUCallBack(myConverter, + * UCNV_TO_U_CALLBACK_SUBSTITUTE, + * UCNV_SUB_STOP_ON_ILLEGAL, + * &oldAction, + * &oldContext, + * &status); + * } + * \endcode + * + * The code above tells "myConverter" to stop when it encounters an + * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from + * Codepage -> Unicode. Any unmapped and legal characters will be + * substituted to be the default substitution character. + */ + +#ifndef UCNV_ERR_H +#define UCNV_ERR_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +/** Forward declaring the UConverter structure. @stable ICU 2.0 */ +struct UConverter; + +/** @stable ICU 2.0 */ +typedef struct UConverter UConverter; + +/** + * FROM_U, TO_U context options for sub callback + * @stable ICU 2.0 + */ +#define UCNV_SUB_STOP_ON_ILLEGAL "i" + +/** + * FROM_U, TO_U context options for skip callback + * @stable ICU 2.0 + */ +#define UCNV_SKIP_STOP_ON_ILLEGAL "i" + +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_ICU NULL +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_JAVA "J" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX) + * TO_U_CALLBACK_ESCAPE option to escape the character value according to C (\\xXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_C "C" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly + * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_XML_DEC "D" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly + * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_XML_HEX "X" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to Unicode (U+XXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_UNICODE "U" + +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H, that is, + * a backslash, 1..6 hex digits, and a space) + * @stable ICU 4.0 + */ +#define UCNV_ESCAPE_CSS2 "S" + +/** + * The process condition code to be used with the callbacks. + * Codes which are greater than UCNV_IRREGULAR should be + * passed on to any chained callbacks. + * @stable ICU 2.0 + */ +typedef enum { + UCNV_UNASSIGNED = 0, /**< The code point is unassigned. + The error code U_INVALID_CHAR_FOUND will be set. */ + UCNV_ILLEGAL = 1, /**< The code point is illegal. For example, + \\x81\\x2E is illegal in SJIS because \\x2E + is not a valid trail byte for the \\x81 + lead byte. + Also, starting with Unicode 3.0.1, non-shortest byte sequences + in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061) + are also illegal, not just irregular. + The error code U_ILLEGAL_CHAR_FOUND will be set. */ + UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in + the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF + are irregular UTF-8 byte sequences for single surrogate + code points. + The error code U_INVALID_CHAR_FOUND will be set. */ + UCNV_RESET = 3, /**< The callback is called with this reason when a + 'reset' has occurred. Callback should reset all + state. */ + UCNV_CLOSE = 4, /**< Called when the converter is closed. The + callback should release any allocated memory.*/ + UCNV_CLONE = 5 /**< Called when ucnv_safeClone() is called on the + converter. the pointer available as the + 'context' is an alias to the original converters' + context pointer. If the context must be owned + by the new converter, the callback must clone + the data and call ucnv_setFromUCallback + (or setToUCallback) with the correct pointer. + @stable ICU 2.2 + */ +} UConverterCallbackReason; + + +/** + * The structure for the fromUnicode callback function parameter. + * @stable ICU 2.0 + */ +typedef struct { + uint16_t size; /**< The size of this struct. @stable ICU 2.0 */ + UBool flush; /**< The internal state of converter will be reset and data flushed if set to true. @stable ICU 2.0 */ + UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ + const UChar *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ + const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ + char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ + const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ + int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ +} UConverterFromUnicodeArgs; + + +/** + * The structure for the toUnicode callback function parameter. + * @stable ICU 2.0 + */ +typedef struct { + uint16_t size; /**< The size of this struct @stable ICU 2.0 */ + UBool flush; /**< The internal state of converter will be reset and data flushed if set to true. @stable ICU 2.0 */ + UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ + const char *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ + const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ + UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ + const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ + int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ +} UConverterToUnicodeArgs; + + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * + * @param context Pointer to the callback's private data + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err This should always be set to a failure status prior to calling. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); + + + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * + * @param context Pointer to the callback's private data + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err This should always be set to a failure status prior to calling. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback skips any ILLEGAL_SEQUENCE, or + * skips only UNASSINGED_SEQUENCE depending on the context parameter + * simply ignoring those characters. + * + * @param context The function currently recognizes the callback options: + * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Skips any ILLEGAL_SEQUENCE + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or + * UNASSIGNED_SEQUENCE depending on context parameter, with the + * current substitution string for the converter. This is the default + * callback. + * + * @param context The function currently recognizes the callback options: + * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Substitutes any ILLEGAL_SEQUENCE + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @see ucnv_setSubstChars + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the + * hexadecimal representation of the illegal codepoints + * + * @param context The function currently recognizes the callback options: + *
    + *
  • UCNV_ESCAPE_ICU: Substitues the ILLEGAL SEQUENCE with the hexadecimal + * representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE"). + * In the Event the converter doesn't support the characters {%,U}[A-F][0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * %UD84D%UDC56
  • + *
  • UCNV_ESCAPE_JAVA: Substitues the ILLEGAL SEQUENCE with the hexadecimal + * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). + * In the Event the converter doesn't support the characters {\,u}[A-F][0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * \\uD84D\\uDC56
  • + *
  • UCNV_ESCAPE_C: Substitues the ILLEGAL SEQUENCE with the hexadecimal + * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). + * In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * \\U00023456
  • + *
  • UCNV_ESCAPE_XML_DEC: Substitues the ILLEGAL SEQUENCE with the decimal + * representation in the format \htmlonly&#DDDDDDDD;, e.g. "&#65534;&#172;&#51454;")\endhtmlonly. + * In the Event the converter doesn't support the characters {&,#}[0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * &#144470; and Zero padding is ignored.
  • + *
  • UCNV_ESCAPE_XML_HEX:Substitues the ILLEGAL SEQUENCE with the decimal + * representation in the format \htmlonly&#xXXXX; e.g. "&#xFFFE;&#x00AC;&#xC8FE;")\endhtmlonly. + * In the Event the converter doesn't support the characters {&,#,x}[0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * \htmlonly&#x23456;\endhtmlonly
  • + *
+ * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); + + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback skips any ILLEGAL_SEQUENCE, or + * skips only UNASSINGED_SEQUENCE depending on the context parameter + * simply ignoring those characters. + * + * @param context The function currently recognizes the callback options: + * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Skips any ILLEGAL_SEQUENCE + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or + * UNASSIGNED_SEQUENCE depending on context parameter, with the + * Unicode substitution character, U+FFFD. + * + * @param context The function currently recognizes the callback options: + * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Substitutes any ILLEGAL_SEQUENCE + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the + * hexadecimal representation of the illegal bytes + * (in the format %XNN, e.g. "%XFF%X0A%XC8%X03"). + * + * @param context This function currently recognizes the callback options: + * UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC, + * UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE. + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ + +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); + +#endif + +#endif + +/*UCNV_ERR_H*/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnvsel.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnvsel.h new file mode 100644 index 0000000000000000000000000000000000000000..3d7d3327f7daddd94cc843cab19655a06a20353d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucnvsel.h @@ -0,0 +1,192 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2008-2011, International Business Machines +* Corporation, Google and others. All Rights Reserved. +* +******************************************************************************* +*/ +/* + * Author : eldawy@google.com (Mohamed Eldawy) + * ucnvsel.h + * + * Purpose: To generate a list of encodings capable of handling + * a given Unicode text + * + * Started 09-April-2008 + */ + +#ifndef __ICU_UCNV_SEL_H__ +#define __ICU_UCNV_SEL_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/uset.h" +#include "unicode/utf16.h" +#include "unicode/uenum.h" +#include "unicode/ucnv.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * \file + * + * A converter selector is built with a set of encoding/charset names + * and given an input string returns the set of names of the + * corresponding converters which can convert the string. + * + * A converter selector can be serialized into a buffer and reopened + * from the serialized form. + */ + +struct UConverterSelector; +/** + * @{ + * Typedef for selector data structure. + */ +typedef struct UConverterSelector UConverterSelector; +/** @} */ + +/** + * Open a selector. + * If converterListSize is 0, build for all available converters. + * If excludedCodePoints is NULL, don't exclude any code points. + * + * @param converterList a pointer to encoding names needed to be involved. + * Can be NULL if converterListSize==0. + * The list and the names will be cloned, and the caller + * retains ownership of the original. + * @param converterListSize number of encodings in above list. + * If 0, builds a selector for all available converters. + * @param excludedCodePoints a set of code points to be excluded from consideration. + * That is, excluded code points in a string do not change + * the selection result. (They might be handled by a callback.) + * Use NULL to exclude nothing. + * @param whichSet what converter set to use? Use this to determine whether + * to consider only roundtrip mappings or also fallbacks. + * @param status an in/out ICU UErrorCode + * @return the new selector + * + * @stable ICU 4.2 + */ +U_CAPI UConverterSelector* U_EXPORT2 +ucnvsel_open(const char* const* converterList, int32_t converterListSize, + const USet* excludedCodePoints, + const UConverterUnicodeSet whichSet, UErrorCode* status); + +/** + * Closes a selector. + * If any Enumerations were returned by ucnv_select*, they become invalid. + * They can be closed before or after calling ucnv_closeSelector, + * but should never be used after the selector is closed. + * + * @see ucnv_selectForString + * @see ucnv_selectForUTF8 + * + * @param sel selector to close + * + * @stable ICU 4.2 + */ +U_CAPI void U_EXPORT2 +ucnvsel_close(UConverterSelector *sel); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUConverterSelectorPointer + * "Smart pointer" class, closes a UConverterSelector via ucnvsel_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterSelectorPointer, UConverterSelector, ucnvsel_close); + +U_NAMESPACE_END + +#endif + +/** + * Open a selector from its serialized form. + * The buffer must remain valid and unchanged for the lifetime of the selector. + * This is much faster than creating a selector from scratch. + * Using a serialized form from a different machine (endianness/charset) is supported. + * + * @param buffer pointer to the serialized form of a converter selector; + * must be 32-bit-aligned + * @param length the capacity of this buffer (can be equal to or larger than + * the actual data length) + * @param status an in/out ICU UErrorCode + * @return the new selector + * + * @stable ICU 4.2 + */ +U_CAPI UConverterSelector* U_EXPORT2 +ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status); + +/** + * Serialize a selector into a linear buffer. + * The serialized form is portable to different machines. + * + * @param sel selector to consider + * @param buffer pointer to 32-bit-aligned memory to be filled with the + * serialized form of this converter selector + * @param bufferCapacity the capacity of this buffer + * @param status an in/out ICU UErrorCode + * @return the required buffer capacity to hold serialize data (even if the call fails + * with a U_BUFFER_OVERFLOW_ERROR, it will return the required capacity) + * + * @stable ICU 4.2 + */ +U_CAPI int32_t U_EXPORT2 +ucnvsel_serialize(const UConverterSelector* sel, + void* buffer, int32_t bufferCapacity, UErrorCode* status); + +/** + * Select converters that can map all characters in a UTF-16 string, + * ignoring the excluded code points. + * + * @param sel a selector + * @param s UTF-16 string + * @param length length of the string, or -1 if NUL-terminated + * @param status an in/out ICU UErrorCode + * @return an enumeration containing encoding names. + * The returned encoding names and their order will be the same as + * supplied when building the selector. + * + * @stable ICU 4.2 + */ +U_CAPI UEnumeration * U_EXPORT2 +ucnvsel_selectForString(const UConverterSelector* sel, + const UChar *s, int32_t length, UErrorCode *status); + +/** + * Select converters that can map all characters in a UTF-8 string, + * ignoring the excluded code points. + * + * @param sel a selector + * @param s UTF-8 string + * @param length length of the string, or -1 if NUL-terminated + * @param status an in/out ICU UErrorCode + * @return an enumeration containing encoding names. + * The returned encoding names and their order will be the same as + * supplied when building the selector. + * + * @stable ICU 4.2 + */ +U_CAPI UEnumeration * U_EXPORT2 +ucnvsel_selectForUTF8(const UConverterSelector* sel, + const char *s, int32_t length, UErrorCode *status); + +#endif /* !UCONFIG_NO_CONVERSION */ + +#endif /* __ICU_UCNV_SEL_H__ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uconfig.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..d16b505102983ae8d46218f1059fb9a47f288c60 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uconfig.h @@ -0,0 +1,461 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* file name: uconfig.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002sep19 +* created by: Markus W. Scherer +*/ + +#ifndef __UCONFIG_H__ +#define __UCONFIG_H__ + + +/*! + * \file + * \brief User-configurable settings + * + * Miscellaneous switches: + * + * A number of macros affect a variety of minor aspects of ICU. + * Most of them used to be defined elsewhere (e.g., in utypes.h or platform.h) + * and moved here to make them easier to find. + * + * Switches for excluding parts of ICU library code modules: + * + * Changing these macros allows building partial, smaller libraries for special purposes. + * By default, all modules are built. + * The switches are fairly coarse, controlling large modules. + * Basic services cannot be turned off. + * + * Building with any of these options does not guarantee that the + * ICU build process will completely work. It is recommended that + * the ICU libraries and data be built using the normal build. + * At that time you should remove the data used by those services. + * After building the ICU data library, you should rebuild the ICU + * libraries with these switches customized to your needs. + * + * @stable ICU 2.4 + */ + +/** + * If this switch is defined, ICU will attempt to load a header file named "uconfig_local.h" + * prior to determining default settings for uconfig variables. + * + * @internal ICU 4.0 + */ +#if defined(UCONFIG_USE_LOCAL) +#include "uconfig_local.h" +#endif + +// Tensorflow is statically linked on all platforms. +#ifndef U_STATIC_IMPLEMENTATION +#define U_STATIC_IMPLEMENTATION +#endif + +/** + * \def U_DEBUG + * Determines whether to include debugging code. + * Automatically set on Windows, but most compilers do not have + * related predefined macros. + * @internal + */ +#ifdef U_DEBUG + /* Use the predefined value. */ +#elif defined(_DEBUG) + /* + * _DEBUG is defined by Visual Studio debug compilation. + * Do *not* test for its NDEBUG macro: It is an orthogonal macro + * which disables assert(). + */ +# define U_DEBUG 1 +# else +# define U_DEBUG 0 +#endif + +/** + * Determines whether to enable auto cleanup of libraries. + * @internal + */ +#ifndef UCLN_NO_AUTO_CLEANUP +#define UCLN_NO_AUTO_CLEANUP 1 +#endif + +/** + * \def U_DISABLE_RENAMING + * Determines whether to disable renaming or not. + * @internal + */ +#ifndef U_DISABLE_RENAMING +#define U_DISABLE_RENAMING 0 +#endif + +/** + * \def U_NO_DEFAULT_INCLUDE_UTF_HEADERS + * Determines whether utypes.h includes utf.h, utf8.h, utf16.h and utf_old.h. + * utypes.h includes those headers if this macro is defined to 0. + * Otherwise, each those headers must be included explicitly when using one of their macros. + * Defaults to 0 for backward compatibility, except inside ICU. + * @stable ICU 49 + */ +#ifdef U_NO_DEFAULT_INCLUDE_UTF_HEADERS + /* Use the predefined value. */ +#elif defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || \ + defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || \ + defined(U_TOOLUTIL_IMPLEMENTATION) +# define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 1 +#else +# define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 0 +#endif + +/** + * \def U_OVERRIDE_CXX_ALLOCATION + * Determines whether to override new and delete. + * ICU is normally built such that all of its C++ classes, via their UMemory base, + * override operators new and delete to use its internal, customizable, + * non-exception-throwing memory allocation functions. (Default value 1 for this macro.) + * + * This is especially important when the application and its libraries use multiple heaps. + * For example, on Windows, this allows the ICU DLL to be used by + * applications that statically link the C Runtime library. + * + * @stable ICU 2.2 + */ +#ifndef U_OVERRIDE_CXX_ALLOCATION +#define U_OVERRIDE_CXX_ALLOCATION 1 +#endif + +/** + * \def U_ENABLE_TRACING + * Determines whether to enable tracing. + * @internal + */ +#ifndef U_ENABLE_TRACING +#define U_ENABLE_TRACING 0 +#endif + +/** + * \def UCONFIG_ENABLE_PLUGINS + * Determines whether to enable ICU plugins. + * @internal + */ +#ifndef UCONFIG_ENABLE_PLUGINS +#define UCONFIG_ENABLE_PLUGINS 0 +#endif + +/** + * \def U_ENABLE_DYLOAD + * Whether to enable Dynamic loading in ICU. + * @internal + */ +#ifndef U_ENABLE_DYLOAD +#define U_ENABLE_DYLOAD 1 +#endif + +/** + * \def U_CHECK_DYLOAD + * Whether to test Dynamic loading as an OS capability. + * @internal + */ +#ifndef U_CHECK_DYLOAD +#define U_CHECK_DYLOAD 1 +#endif + +/** + * \def U_DEFAULT_SHOW_DRAFT + * Do we allow ICU users to use the draft APIs by default? + * @internal + */ +#ifndef U_DEFAULT_SHOW_DRAFT +#define U_DEFAULT_SHOW_DRAFT 1 +#endif + +/*===========================================================================*/ +/* Custom icu entry point renaming */ +/*===========================================================================*/ + +/** + * \def U_HAVE_LIB_SUFFIX + * 1 if a custom library suffix is set. + * @internal + */ +#ifdef U_HAVE_LIB_SUFFIX + /* Use the predefined value. */ +#elif defined(U_LIB_SUFFIX_C_NAME) || defined(U_IN_DOXYGEN) +# define U_HAVE_LIB_SUFFIX 1 +#endif + +/** + * \def U_LIB_SUFFIX_C_NAME_STRING + * Defines the library suffix as a string with C syntax. + * @internal + */ +#ifdef U_LIB_SUFFIX_C_NAME_STRING + /* Use the predefined value. */ +#elif defined(U_LIB_SUFFIX_C_NAME) +# define CONVERT_TO_STRING(s) #s +# define U_LIB_SUFFIX_C_NAME_STRING CONVERT_TO_STRING(U_LIB_SUFFIX_C_NAME) +#else +# define U_LIB_SUFFIX_C_NAME_STRING "" +#endif + +/* common/i18n library switches --------------------------------------------- */ + +/** + * \def UCONFIG_ONLY_COLLATION + * This switch turns off modules that are not needed for collation. + * + * It does not turn off legacy conversion because that is necessary + * for ICU to work on EBCDIC platforms (for the default converter). + * If you want "only collation" and do not build for EBCDIC, + * then you can define UCONFIG_NO_CONVERSION or UCONFIG_NO_LEGACY_CONVERSION to 1 as well. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_ONLY_COLLATION +# define UCONFIG_ONLY_COLLATION 0 +#endif + +#if UCONFIG_ONLY_COLLATION + /* common library */ +# define UCONFIG_NO_BREAK_ITERATION 1 +# define UCONFIG_NO_IDNA 1 + + /* i18n library */ +# if UCONFIG_NO_COLLATION +# error Contradictory collation switches in uconfig.h. +# endif +# define UCONFIG_NO_FORMATTING 1 +# define UCONFIG_NO_TRANSLITERATION 1 +# define UCONFIG_NO_REGULAR_EXPRESSIONS 1 +#endif + +/* common library switches -------------------------------------------------- */ + +/** + * \def UCONFIG_NO_FILE_IO + * This switch turns off all file access in the common library + * where file access is only used for data loading. + * ICU data must then be provided in the form of a data DLL (or with an + * equivalent way to link to the data residing in an executable, + * as in building a combined library with both the common library's code and + * the data), or via udata_setCommonData(). + * Application data must be provided via udata_setAppData() or by using + * "open" functions that take pointers to data, for example ucol_openBinary(). + * + * File access is not used at all in the i18n library. + * + * File access cannot be turned off for the icuio library or for the ICU + * test suites and ICU tools. + * + * @stable ICU 3.6 + */ +#ifndef UCONFIG_NO_FILE_IO +# define UCONFIG_NO_FILE_IO 0 +#endif + +#if UCONFIG_NO_FILE_IO && defined(U_TIMEZONE_FILES_DIR) +# error Contradictory file io switches in uconfig.h. +#endif + +/** + * \def UCONFIG_NO_CONVERSION + * ICU will not completely build (compiling the tools fails) with this + * switch turned on. + * This switch turns off all converters. + * + * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1 + * in utypes.h if char* strings in your environment are always in UTF-8. + * + * @stable ICU 3.2 + * @see U_CHARSET_IS_UTF8 + */ +#ifndef UCONFIG_NO_CONVERSION +# define UCONFIG_NO_CONVERSION 0 +#endif + +#if UCONFIG_NO_CONVERSION +# define UCONFIG_NO_LEGACY_CONVERSION 1 +#endif + +/** + * \def UCONFIG_ONLY_HTML_CONVERSION + * This switch turns off all of the converters NOT listed in + * the HTML encoding standard: + * http://www.w3.org/TR/encoding/#names-and-labels + * + * This is not possible on EBCDIC platforms + * because they need ibm-37 or ibm-1047 default converters. + * + * @stable ICU 55 + */ +#ifndef UCONFIG_ONLY_HTML_CONVERSION +# define UCONFIG_ONLY_HTML_CONVERSION 0 +#endif + +/** + * \def UCONFIG_NO_LEGACY_CONVERSION + * This switch turns off all converters except for + * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1) + * - US-ASCII + * - ISO-8859-1 + * + * Turning off legacy conversion is not possible on EBCDIC platforms + * because they need ibm-37 or ibm-1047 default converters. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_LEGACY_CONVERSION +# define UCONFIG_NO_LEGACY_CONVERSION 0 +#endif + +/** + * \def UCONFIG_NO_NORMALIZATION + * This switch turns off normalization. + * It implies turning off several other services as well, for example + * collation and IDNA. + * + * @stable ICU 2.6 + */ +#ifndef UCONFIG_NO_NORMALIZATION +# define UCONFIG_NO_NORMALIZATION 0 +#endif + +#if UCONFIG_NO_NORMALIZATION + /* common library */ + /* ICU 50 CJK dictionary BreakIterator uses normalization */ +# define UCONFIG_NO_BREAK_ITERATION 1 + /* IDNA (UTS #46) is implemented via normalization */ +# define UCONFIG_NO_IDNA 1 + + /* i18n library */ +# if UCONFIG_ONLY_COLLATION +# error Contradictory collation switches in uconfig.h. +# endif +# define UCONFIG_NO_COLLATION 1 +# define UCONFIG_NO_TRANSLITERATION 1 +#endif + +/** + * \def UCONFIG_NO_BREAK_ITERATION + * This switch turns off break iteration. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_BREAK_ITERATION +# define UCONFIG_NO_BREAK_ITERATION 0 +#endif + +/** + * \def UCONFIG_NO_IDNA + * This switch turns off IDNA. + * + * @stable ICU 2.6 + */ +#ifndef UCONFIG_NO_IDNA +# define UCONFIG_NO_IDNA 0 +#endif + +/** + * \def UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE + * Determines the default UMessagePatternApostropheMode. + * See the documentation for that enum. + * + * @stable ICU 4.8 + */ +#ifndef UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE +# define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL +#endif + +/** + * \def UCONFIG_USE_WINDOWS_LCID_MAPPING_API + * On platforms where U_PLATFORM_HAS_WIN32_API is true, this switch determines + * if the Windows platform APIs are used for LCID<->Locale Name conversions. + * Otherwise, only the built-in ICU tables are used. + * + * @internal ICU 64 + */ +#ifndef UCONFIG_USE_WINDOWS_LCID_MAPPING_API +# define UCONFIG_USE_WINDOWS_LCID_MAPPING_API 1 +#endif + +/* i18n library switches ---------------------------------------------------- */ + +/** + * \def UCONFIG_NO_COLLATION + * This switch turns off collation and collation-based string search. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_COLLATION +# define UCONFIG_NO_COLLATION 0 +#endif + +/** + * \def UCONFIG_NO_FORMATTING + * This switch turns off formatting and calendar/timezone services. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_FORMATTING +# define UCONFIG_NO_FORMATTING 0 +#endif + +/** + * \def UCONFIG_NO_TRANSLITERATION + * This switch turns off transliteration. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_TRANSLITERATION +# define UCONFIG_NO_TRANSLITERATION 0 +#endif + +/** + * \def UCONFIG_NO_REGULAR_EXPRESSIONS + * This switch turns off regular expressions. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_REGULAR_EXPRESSIONS +# define UCONFIG_NO_REGULAR_EXPRESSIONS 0 +#endif + +/** + * \def UCONFIG_NO_SERVICE + * This switch turns off service registration. + * + * @stable ICU 3.2 + */ +#ifndef UCONFIG_NO_SERVICE +# define UCONFIG_NO_SERVICE 0 +#endif + +/** + * \def UCONFIG_HAVE_PARSEALLINPUT + * This switch turns on the "parse all input" attribute. Binary incompatible. + * + * @internal + */ +#ifndef UCONFIG_HAVE_PARSEALLINPUT +# define UCONFIG_HAVE_PARSEALLINPUT 1 +#endif + +/** + * \def UCONFIG_NO_FILTERED_BREAK_ITERATION + * This switch turns off filtered break iteration code. + * + * @internal + */ +#ifndef UCONFIG_NO_FILTERED_BREAK_ITERATION +# define UCONFIG_NO_FILTERED_BREAK_ITERATION 0 +#endif + +#endif // __UCONFIG_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucpmap.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucpmap.h new file mode 100644 index 0000000000000000000000000000000000000000..31e1365cac850a45709cc5aa1b1557af872a2769 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucpmap.h @@ -0,0 +1,159 @@ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// ucpmap.h +// created: 2018sep03 Markus W. Scherer + +#ifndef __UCPMAP_H__ +#define __UCPMAP_H__ + +#include "unicode/utypes.h" + +U_CDECL_BEGIN + +/** + * \file + * + * This file defines an abstract map from Unicode code points to integer values. + * + * @see UCPMap + * @see UCPTrie + * @see UMutableCPTrie + */ + +/** + * Abstract map from Unicode code points (U+0000..U+10FFFF) to integer values. + * + * @see UCPTrie + * @see UMutableCPTrie + * @stable ICU 63 + */ +typedef struct UCPMap UCPMap; + +/** + * Selectors for how ucpmap_getRange() etc. should report value ranges overlapping with surrogates. + * Most users should use UCPMAP_RANGE_NORMAL. + * + * @see ucpmap_getRange + * @see ucptrie_getRange + * @see umutablecptrie_getRange + * @stable ICU 63 + */ +enum UCPMapRangeOption { + /** + * ucpmap_getRange() enumerates all same-value ranges as stored in the map. + * Most users should use this option. + * @stable ICU 63 + */ + UCPMAP_RANGE_NORMAL, + /** + * ucpmap_getRange() enumerates all same-value ranges as stored in the map, + * except that lead surrogates (U+D800..U+DBFF) are treated as having the + * surrogateValue, which is passed to getRange() as a separate parameter. + * The surrogateValue is not transformed via filter(). + * See U_IS_LEAD(c). + * + * Most users should use UCPMAP_RANGE_NORMAL instead. + * + * This option is useful for maps that map surrogate code *units* to + * special values optimized for UTF-16 string processing + * or for special error behavior for unpaired surrogates, + * but those values are not to be associated with the lead surrogate code *points*. + * @stable ICU 63 + */ + UCPMAP_RANGE_FIXED_LEAD_SURROGATES, + /** + * ucpmap_getRange() enumerates all same-value ranges as stored in the map, + * except that all surrogates (U+D800..U+DFFF) are treated as having the + * surrogateValue, which is passed to getRange() as a separate parameter. + * The surrogateValue is not transformed via filter(). + * See U_IS_SURROGATE(c). + * + * Most users should use UCPMAP_RANGE_NORMAL instead. + * + * This option is useful for maps that map surrogate code *units* to + * special values optimized for UTF-16 string processing + * or for special error behavior for unpaired surrogates, + * but those values are not to be associated with the lead surrogate code *points*. + * @stable ICU 63 + */ + UCPMAP_RANGE_FIXED_ALL_SURROGATES +}; +#ifndef U_IN_DOXYGEN +typedef enum UCPMapRangeOption UCPMapRangeOption; +#endif + +/** + * Returns the value for a code point as stored in the map, with range checking. + * Returns an implementation-defined error value if c is not in the range 0..U+10FFFF. + * + * @param map the map + * @param c the code point + * @return the map value, + * or an implementation-defined error value if the code point is not in the range 0..U+10FFFF + * @stable ICU 63 + */ +U_CAPI uint32_t U_EXPORT2 +ucpmap_get(const UCPMap *map, UChar32 c); + +/** + * Callback function type: Modifies a map value. + * Optionally called by ucpmap_getRange()/ucptrie_getRange()/umutablecptrie_getRange(). + * The modified value will be returned by the getRange function. + * + * Can be used to ignore some of the value bits, + * make a filter for one of several values, + * return a value index computed from the map value, etc. + * + * @param context an opaque pointer, as passed into the getRange function + * @param value a value from the map + * @return the modified value + * @stable ICU 63 + */ +typedef uint32_t U_CALLCONV +UCPMapValueFilter(const void *context, uint32_t value); + +/** + * Returns the last code point such that all those from start to there have the same value. + * Can be used to efficiently iterate over all same-value ranges in a map. + * (This is normally faster than iterating over code points and get()ting each value, + * but much slower than a data structure that stores ranges directly.) + * + * If the UCPMapValueFilter function pointer is not NULL, then + * the value to be delivered is passed through that function, and the return value is the end + * of the range where all values are modified to the same actual value. + * The value is unchanged if that function pointer is NULL. + * + * Example: + * \code + * UChar32 start = 0, end; + * uint32_t value; + * while ((end = ucpmap_getRange(map, start, UCPMAP_RANGE_NORMAL, 0, + * NULL, NULL, &value)) >= 0) { + * // Work with the range start..end and its value. + * start = end + 1; + * } + * \endcode + * + * @param map the map + * @param start range start + * @param option defines whether surrogates are treated normally, + * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL + * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL + * @param filter a pointer to a function that may modify the map data value, + * or NULL if the values from the map are to be used unmodified + * @param context an opaque pointer that is passed on to the filter function + * @param pValue if not NULL, receives the value that every code point start..end has; + * may have been modified by filter(context, map value) + * if that function pointer is not NULL + * @return the range end code point, or -1 if start is not a valid code point + * @stable ICU 63 + */ +U_CAPI UChar32 U_EXPORT2 +ucpmap_getRange(const UCPMap *map, UChar32 start, + UCPMapRangeOption option, uint32_t surrogateValue, + UCPMapValueFilter *filter, const void *context, uint32_t *pValue); + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucptrie.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucptrie.h new file mode 100644 index 0000000000000000000000000000000000000000..b95491b183e9af1083f95ecb3262bafb8f18dffe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucptrie.h @@ -0,0 +1,646 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// ucptrie.h (modified from utrie2.h) +// created: 2017dec29 Markus W. Scherer + +#ifndef __UCPTRIE_H__ +#define __UCPTRIE_H__ + +#include "unicode/utypes.h" +#include "unicode/ucpmap.h" +#include "unicode/utf8.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +U_CDECL_BEGIN + +/** + * \file + * + * This file defines an immutable Unicode code point trie. + * + * @see UCPTrie + * @see UMutableCPTrie + */ + +#ifndef U_IN_DOXYGEN +/** @internal */ +typedef union UCPTrieData { + /** @internal */ + const void *ptr0; + /** @internal */ + const uint16_t *ptr16; + /** @internal */ + const uint32_t *ptr32; + /** @internal */ + const uint8_t *ptr8; +} UCPTrieData; +#endif + +/** + * Immutable Unicode code point trie structure. + * Fast, reasonably compact, map from Unicode code points (U+0000..U+10FFFF) to integer values. + * For details see http://site.icu-project.org/design/struct/utrie + * + * Do not access UCPTrie fields directly; use public functions and macros. + * Functions are easy to use: They support all trie types and value widths. + * + * When performance is really important, macros provide faster access. + * Most macros are specific to either "fast" or "small" tries, see UCPTrieType. + * There are "fast" macros for special optimized use cases. + * + * The macros will return bogus values, or may crash, if used on the wrong type or value width. + * + * @see UMutableCPTrie + * @stable ICU 63 + */ +struct UCPTrie { +#ifndef U_IN_DOXYGEN + /** @internal */ + const uint16_t *index; + /** @internal */ + UCPTrieData data; + + /** @internal */ + int32_t indexLength; + /** @internal */ + int32_t dataLength; + /** Start of the last range which ends at U+10FFFF. @internal */ + UChar32 highStart; + /** highStart>>12 @internal */ + uint16_t shifted12HighStart; + + /** @internal */ + int8_t type; // UCPTrieType + /** @internal */ + int8_t valueWidth; // UCPTrieValueWidth + + /** padding/reserved @internal */ + uint32_t reserved32; + /** padding/reserved @internal */ + uint16_t reserved16; + + /** + * Internal index-3 null block offset. + * Set to an impossibly high value (e.g., 0xffff) if there is no dedicated index-3 null block. + * @internal + */ + uint16_t index3NullOffset; + /** + * Internal data null block offset, not shifted. + * Set to an impossibly high value (e.g., 0xfffff) if there is no dedicated data null block. + * @internal + */ + int32_t dataNullOffset; + /** @internal */ + uint32_t nullValue; + +#ifdef UCPTRIE_DEBUG + /** @internal */ + const char *name; +#endif +#endif +}; +#ifndef U_IN_DOXYGEN +typedef struct UCPTrie UCPTrie; +#endif + +/** + * Selectors for the type of a UCPTrie. + * Different trade-offs for size vs. speed. + * + * @see umutablecptrie_buildImmutable + * @see ucptrie_openFromBinary + * @see ucptrie_getType + * @stable ICU 63 + */ +enum UCPTrieType { + /** + * For ucptrie_openFromBinary() to accept any type. + * ucptrie_getType() will return the actual type. + * @stable ICU 63 + */ + UCPTRIE_TYPE_ANY = -1, + /** + * Fast/simple/larger BMP data structure. Use functions and "fast" macros. + * @stable ICU 63 + */ + UCPTRIE_TYPE_FAST, + /** + * Small/slower BMP data structure. Use functions and "small" macros. + * @stable ICU 63 + */ + UCPTRIE_TYPE_SMALL +}; +#ifndef U_IN_DOXYGEN +typedef enum UCPTrieType UCPTrieType; +#endif + +/** + * Selectors for the number of bits in a UCPTrie data value. + * + * @see umutablecptrie_buildImmutable + * @see ucptrie_openFromBinary + * @see ucptrie_getValueWidth + * @stable ICU 63 + */ +enum UCPTrieValueWidth { + /** + * For ucptrie_openFromBinary() to accept any data value width. + * ucptrie_getValueWidth() will return the actual data value width. + * @stable ICU 63 + */ + UCPTRIE_VALUE_BITS_ANY = -1, + /** + * The trie stores 16 bits per data value. + * It returns them as unsigned values 0..0xffff=65535. + * @stable ICU 63 + */ + UCPTRIE_VALUE_BITS_16, + /** + * The trie stores 32 bits per data value. + * @stable ICU 63 + */ + UCPTRIE_VALUE_BITS_32, + /** + * The trie stores 8 bits per data value. + * It returns them as unsigned values 0..0xff=255. + * @stable ICU 63 + */ + UCPTRIE_VALUE_BITS_8 +}; +#ifndef U_IN_DOXYGEN +typedef enum UCPTrieValueWidth UCPTrieValueWidth; +#endif + +/** + * Opens a trie from its binary form, stored in 32-bit-aligned memory. + * Inverse of ucptrie_toBinary(). + * + * The memory must remain valid and unchanged as long as the trie is used. + * You must ucptrie_close() the trie once you are done using it. + * + * @param type selects the trie type; results in an + * U_INVALID_FORMAT_ERROR if it does not match the binary data; + * use UCPTRIE_TYPE_ANY to accept any type + * @param valueWidth selects the number of bits in a data value; results in an + * U_INVALID_FORMAT_ERROR if it does not match the binary data; + * use UCPTRIE_VALUE_BITS_ANY to accept any data value width + * @param data a pointer to 32-bit-aligned memory containing the binary data of a UCPTrie + * @param length the number of bytes available at data; + * can be more than necessary + * @param pActualLength receives the actual number of bytes at data taken up by the trie data; + * can be NULL + * @param pErrorCode an in/out ICU UErrorCode + * @return the trie + * + * @see umutablecptrie_open + * @see umutablecptrie_buildImmutable + * @see ucptrie_toBinary + * @stable ICU 63 + */ +U_CAPI UCPTrie * U_EXPORT2 +ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth, + const void *data, int32_t length, int32_t *pActualLength, + UErrorCode *pErrorCode); + +/** + * Closes a trie and releases associated memory. + * + * @param trie the trie + * @stable ICU 63 + */ +U_CAPI void U_EXPORT2 +ucptrie_close(UCPTrie *trie); + +/** + * Returns the trie type. + * + * @param trie the trie + * @return the trie type + * @see ucptrie_openFromBinary + * @see UCPTRIE_TYPE_ANY + * @stable ICU 63 + */ +U_CAPI UCPTrieType U_EXPORT2 +ucptrie_getType(const UCPTrie *trie); + +/** + * Returns the number of bits in a trie data value. + * + * @param trie the trie + * @return the number of bits in a trie data value + * @see ucptrie_openFromBinary + * @see UCPTRIE_VALUE_BITS_ANY + * @stable ICU 63 + */ +U_CAPI UCPTrieValueWidth U_EXPORT2 +ucptrie_getValueWidth(const UCPTrie *trie); + +/** + * Returns the value for a code point as stored in the trie, with range checking. + * Returns the trie error value if c is not in the range 0..U+10FFFF. + * + * Easier to use than UCPTRIE_FAST_GET() and similar macros but slower. + * Easier to use because, unlike the macros, this function works on all UCPTrie + * objects, for all types and value widths. + * + * @param trie the trie + * @param c the code point + * @return the trie value, + * or the trie error value if the code point is not in the range 0..U+10FFFF + * @stable ICU 63 + */ +U_CAPI uint32_t U_EXPORT2 +ucptrie_get(const UCPTrie *trie, UChar32 c); + +/** + * Returns the last code point such that all those from start to there have the same value. + * Can be used to efficiently iterate over all same-value ranges in a trie. + * (This is normally faster than iterating over code points and get()ting each value, + * but much slower than a data structure that stores ranges directly.) + * + * If the UCPMapValueFilter function pointer is not NULL, then + * the value to be delivered is passed through that function, and the return value is the end + * of the range where all values are modified to the same actual value. + * The value is unchanged if that function pointer is NULL. + * + * Example: + * \code + * UChar32 start = 0, end; + * uint32_t value; + * while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0, + * NULL, NULL, &value)) >= 0) { + * // Work with the range start..end and its value. + * start = end + 1; + * } + * \endcode + * + * @param trie the trie + * @param start range start + * @param option defines whether surrogates are treated normally, + * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL + * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL + * @param filter a pointer to a function that may modify the trie data value, + * or NULL if the values from the trie are to be used unmodified + * @param context an opaque pointer that is passed on to the filter function + * @param pValue if not NULL, receives the value that every code point start..end has; + * may have been modified by filter(context, trie value) + * if that function pointer is not NULL + * @return the range end code point, or -1 if start is not a valid code point + * @stable ICU 63 + */ +U_CAPI UChar32 U_EXPORT2 +ucptrie_getRange(const UCPTrie *trie, UChar32 start, + UCPMapRangeOption option, uint32_t surrogateValue, + UCPMapValueFilter *filter, const void *context, uint32_t *pValue); + +/** + * Writes a memory-mappable form of the trie into 32-bit aligned memory. + * Inverse of ucptrie_openFromBinary(). + * + * @param trie the trie + * @param data a pointer to 32-bit-aligned memory to be filled with the trie data; + * can be NULL if capacity==0 + * @param capacity the number of bytes available at data, or 0 for pure preflighting + * @param pErrorCode an in/out ICU UErrorCode; + * U_BUFFER_OVERFLOW_ERROR if the capacity is too small + * @return the number of bytes written or (if buffer overflow) needed for the trie + * + * @see ucptrie_openFromBinary() + * @stable ICU 63 + */ +U_CAPI int32_t U_EXPORT2 +ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *pErrorCode); + +/** + * Macro parameter value for a trie with 16-bit data values. + * Use the name of this macro as a "dataAccess" parameter in other macros. + * Do not use this macro in any other way. + * + * @see UCPTRIE_VALUE_BITS_16 + * @stable ICU 63 + */ +#define UCPTRIE_16(trie, i) ((trie)->data.ptr16[i]) + +/** + * Macro parameter value for a trie with 32-bit data values. + * Use the name of this macro as a "dataAccess" parameter in other macros. + * Do not use this macro in any other way. + * + * @see UCPTRIE_VALUE_BITS_32 + * @stable ICU 63 + */ +#define UCPTRIE_32(trie, i) ((trie)->data.ptr32[i]) + +/** + * Macro parameter value for a trie with 8-bit data values. + * Use the name of this macro as a "dataAccess" parameter in other macros. + * Do not use this macro in any other way. + * + * @see UCPTRIE_VALUE_BITS_8 + * @stable ICU 63 + */ +#define UCPTRIE_8(trie, i) ((trie)->data.ptr8[i]) + +/** + * Returns a trie value for a code point, with range checking. + * Returns the trie error value if c is not in the range 0..U+10FFFF. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point + * @return The code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_FAST_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_CP_INDEX(trie, 0xffff, c)) + +/** + * Returns a 16-bit trie value for a code point, with range checking. + * Returns the trie error value if c is not in the range U+0000..U+10FFFF. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_SMALL + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point + * @return The code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_SMALL_GET(trie, dataAccess, c) \ + dataAccess(trie, _UCPTRIE_CP_INDEX(trie, UCPTRIE_SMALL_MAX, c)) + +/** + * UTF-16: Reads the next code point (UChar32 c, out), post-increments src, + * and gets a value from the trie. + * Sets the trie error value if c is an unpaired surrogate. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param src (const UChar *, in/out) the source text pointer + * @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated + * @param c (UChar32, out) variable for the code point + * @param result (out) variable for the trie lookup result + * @stable ICU 63 + */ +#define UCPTRIE_FAST_U16_NEXT(trie, dataAccess, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \ + (c) = *(src)++; \ + int32_t __index; \ + if (!U16_IS_SURROGATE(c)) { \ + __index = _UCPTRIE_FAST_INDEX(trie, c); \ + } else { \ + uint16_t __c2; \ + if (U16_IS_SURROGATE_LEAD(c) && (src) != (limit) && U16_IS_TRAIL(__c2 = *(src))) { \ + ++(src); \ + (c) = U16_GET_SUPPLEMENTARY((c), __c2); \ + __index = _UCPTRIE_SMALL_INDEX(trie, c); \ + } else { \ + __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \ + } \ + } \ + (result) = dataAccess(trie, __index); \ +} UPRV_BLOCK_MACRO_END + +/** + * UTF-16: Reads the previous code point (UChar32 c, out), pre-decrements src, + * and gets a value from the trie. + * Sets the trie error value if c is an unpaired surrogate. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param start (const UChar *, in) the start pointer for the text + * @param src (const UChar *, in/out) the source text pointer + * @param c (UChar32, out) variable for the code point + * @param result (out) variable for the trie lookup result + * @stable ICU 63 + */ +#define UCPTRIE_FAST_U16_PREV(trie, dataAccess, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \ + (c) = *--(src); \ + int32_t __index; \ + if (!U16_IS_SURROGATE(c)) { \ + __index = _UCPTRIE_FAST_INDEX(trie, c); \ + } else { \ + uint16_t __c2; \ + if (U16_IS_SURROGATE_TRAIL(c) && (src) != (start) && U16_IS_LEAD(__c2 = *((src) - 1))) { \ + --(src); \ + (c) = U16_GET_SUPPLEMENTARY(__c2, (c)); \ + __index = _UCPTRIE_SMALL_INDEX(trie, c); \ + } else { \ + __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \ + } \ + } \ + (result) = dataAccess(trie, __index); \ +} UPRV_BLOCK_MACRO_END + +/** + * UTF-8: Post-increments src and gets a value from the trie. + * Sets the trie error value for an ill-formed byte sequence. + * + * Unlike UCPTRIE_FAST_U16_NEXT() this UTF-8 macro does not provide the code point + * because it would be more work to do so and is often not needed. + * If the trie value differs from the error value, then the byte sequence is well-formed, + * and the code point can be assembled without revalidation. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param src (const char *, in/out) the source text pointer + * @param limit (const char *, in) the limit pointer for the text (must not be NULL) + * @param result (out) variable for the trie lookup result + * @stable ICU 63 + */ +#define UCPTRIE_FAST_U8_NEXT(trie, dataAccess, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t __lead = (uint8_t)*(src)++; \ + if (!U8_IS_SINGLE(__lead)) { \ + uint8_t __t1, __t2, __t3; \ + if ((src) != (limit) && \ + (__lead >= 0xe0 ? \ + __lead < 0xf0 ? /* U+0800..U+FFFF except surrogates */ \ + U8_LEAD3_T1_BITS[__lead &= 0xf] & (1 << ((__t1 = *(src)) >> 5)) && \ + ++(src) != (limit) && (__t2 = *(src) - 0x80) <= 0x3f && \ + (__lead = ((int32_t)(trie)->index[(__lead << 6) + (__t1 & 0x3f)]) + __t2, 1) \ + : /* U+10000..U+10FFFF */ \ + (__lead -= 0xf0) <= 4 && \ + U8_LEAD4_T1_BITS[(__t1 = *(src)) >> 4] & (1 << __lead) && \ + (__lead = (__lead << 6) | (__t1 & 0x3f), ++(src) != (limit)) && \ + (__t2 = *(src) - 0x80) <= 0x3f && \ + ++(src) != (limit) && (__t3 = *(src) - 0x80) <= 0x3f && \ + (__lead = __lead >= (trie)->shifted12HighStart ? \ + (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \ + ucptrie_internalSmallU8Index((trie), __lead, __t2, __t3), 1) \ + : /* U+0080..U+07FF */ \ + __lead >= 0xc2 && (__t1 = *(src) - 0x80) <= 0x3f && \ + (__lead = (int32_t)(trie)->index[__lead & 0x1f] + __t1, 1))) { \ + ++(src); \ + } else { \ + __lead = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; /* ill-formed*/ \ + } \ + } \ + (result) = dataAccess(trie, __lead); \ +} UPRV_BLOCK_MACRO_END + +/** + * UTF-8: Pre-decrements src and gets a value from the trie. + * Sets the trie error value for an ill-formed byte sequence. + * + * Unlike UCPTRIE_FAST_U16_PREV() this UTF-8 macro does not provide the code point + * because it would be more work to do so and is often not needed. + * If the trie value differs from the error value, then the byte sequence is well-formed, + * and the code point can be assembled without revalidation. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param start (const char *, in) the start pointer for the text + * @param src (const char *, in/out) the source text pointer + * @param result (out) variable for the trie lookup result + * @stable ICU 63 + */ +#define UCPTRIE_FAST_U8_PREV(trie, dataAccess, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t __index = (uint8_t)*--(src); \ + if (!U8_IS_SINGLE(__index)) { \ + __index = ucptrie_internalU8PrevIndex((trie), __index, (const uint8_t *)(start), \ + (const uint8_t *)(src)); \ + (src) -= __index & 7; \ + __index >>= 3; \ + } \ + (result) = dataAccess(trie, __index); \ +} UPRV_BLOCK_MACRO_END + +/** + * Returns a trie value for an ASCII code point, without range checking. + * + * @param trie (const UCPTrie *, in) the trie (of either fast or small type) + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point; must be U+0000..U+007F + * @return The ASCII code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_ASCII_GET(trie, dataAccess, c) dataAccess(trie, c) + +/** + * Returns a trie value for a BMP code point (U+0000..U+FFFF), without range checking. + * Can be used to look up a value for a UTF-16 code unit if other parts of + * the string processing check for surrogates. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point, must be U+0000..U+FFFF + * @return The BMP code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_FAST_BMP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_FAST_INDEX(trie, c)) + +/** + * Returns a trie value for a supplementary code point (U+10000..U+10FFFF), + * without range checking. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point, must be U+10000..U+10FFFF + * @return The supplementary code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_FAST_SUPP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_SMALL_INDEX(trie, c)) + +/* Internal definitions ----------------------------------------------------- */ + +#ifndef U_IN_DOXYGEN + +/** + * Internal implementation constants. + * These are needed for the API macros, but users should not use these directly. + * @internal + */ +enum { + /** @internal */ + UCPTRIE_FAST_SHIFT = 6, + + /** Number of entries in a data block for code points below the fast limit. 64=0x40 @internal */ + UCPTRIE_FAST_DATA_BLOCK_LENGTH = 1 << UCPTRIE_FAST_SHIFT, + + /** Mask for getting the lower bits for the in-fast-data-block offset. @internal */ + UCPTRIE_FAST_DATA_MASK = UCPTRIE_FAST_DATA_BLOCK_LENGTH - 1, + + /** @internal */ + UCPTRIE_SMALL_MAX = 0xfff, + + /** + * Offset from dataLength (to be subtracted) for fetching the + * value returned for out-of-range code points and ill-formed UTF-8/16. + * @internal + */ + UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET = 1, + /** + * Offset from dataLength (to be subtracted) for fetching the + * value returned for code points highStart..U+10FFFF. + * @internal + */ + UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET = 2 +}; + +/* Internal functions and macros -------------------------------------------- */ +// Do not conditionalize with #ifndef U_HIDE_INTERNAL_API, needed for public API + +/** @internal */ +U_CAPI int32_t U_EXPORT2 +ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c); + +/** @internal */ +U_CAPI int32_t U_EXPORT2 +ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3); + +/** + * Internal function for part of the UCPTRIE_FAST_U8_PREVxx() macro implementations. + * Do not call directly. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c, + const uint8_t *start, const uint8_t *src); + +/** Internal trie getter for a code point below the fast limit. Returns the data index. @internal */ +#define _UCPTRIE_FAST_INDEX(trie, c) \ + ((int32_t)(trie)->index[(c) >> UCPTRIE_FAST_SHIFT] + ((c) & UCPTRIE_FAST_DATA_MASK)) + +/** Internal trie getter for a code point at or above the fast limit. Returns the data index. @internal */ +#define _UCPTRIE_SMALL_INDEX(trie, c) \ + ((c) >= (trie)->highStart ? \ + (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \ + ucptrie_internalSmallIndex(trie, c)) + +/** + * Internal trie getter for a code point, with checking that c is in U+0000..10FFFF. + * Returns the data index. + * @internal + */ +#define _UCPTRIE_CP_INDEX(trie, fastMax, c) \ + ((uint32_t)(c) <= (uint32_t)(fastMax) ? \ + _UCPTRIE_FAST_INDEX(trie, c) : \ + (uint32_t)(c) <= 0x10ffff ? \ + _UCPTRIE_SMALL_INDEX(trie, c) : \ + (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET) + +U_CDECL_END + +#endif // U_IN_DOXYGEN + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUCPTriePointer + * "Smart pointer" class, closes a UCPTrie via ucptrie_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 63 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUCPTriePointer, UCPTrie, ucptrie_close); + +U_NAMESPACE_END + +#endif // U_SHOW_CPLUSPLUS_API + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucurr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucurr.h new file mode 100644 index 0000000000000000000000000000000000000000..35c2a393897b055ee2cb598aae1f3ec445fff815 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ucurr.h @@ -0,0 +1,468 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ +#ifndef _UCURR_H_ +#define _UCURR_H_ + +#include "unicode/utypes.h" +#include "unicode/uenum.h" + +/** + * \file + * \brief C API: Encapsulates information about a currency. + * + * The ucurr API encapsulates information about a currency, as defined by + * ISO 4217. A currency is represented by a 3-character string + * containing its ISO 4217 code. This API can return various data + * necessary the proper display of a currency: + * + *
  • A display symbol, for a specific locale + *
  • The number of fraction digits to display + *
  • A rounding increment + *
+ * + * The DecimalFormat class uses these data to display + * currencies. + * @author Alan Liu + * @since ICU 2.2 + */ + +#if !UCONFIG_NO_FORMATTING + +/** + * Currency Usage used for Decimal Format + * @stable ICU 54 + */ +enum UCurrencyUsage { + /** + * a setting to specify currency usage which determines currency digit + * and rounding for standard usage, for example: "50.00 NT$" + * used as DEFAULT value + * @stable ICU 54 + */ + UCURR_USAGE_STANDARD=0, + /** + * a setting to specify currency usage which determines currency digit + * and rounding for cash usage, for example: "50 NT$" + * @stable ICU 54 + */ + UCURR_USAGE_CASH=1, +#ifndef U_HIDE_DEPRECATED_API + /** + * One higher than the last enum UCurrencyUsage constant. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCURR_USAGE_COUNT=2 +#endif // U_HIDE_DEPRECATED_API +}; +/** Currency Usage used for Decimal Format */ +typedef enum UCurrencyUsage UCurrencyUsage; + +/** + * Finds a currency code for the given locale. + * @param locale the locale for which to retrieve a currency code. + * Currency can be specified by the "currency" keyword + * in which case it overrides the default currency code + * @param buff fill in buffer. Can be NULL for preflighting. + * @param buffCapacity capacity of the fill in buffer. Can be 0 for + * preflighting. If it is non-zero, the buff parameter + * must not be NULL. + * @param ec error code + * @return length of the currency string. It should always be 3. If 0, + * currency couldn't be found or the input values are + * invalid. + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +ucurr_forLocale(const char* locale, + UChar* buff, + int32_t buffCapacity, + UErrorCode* ec); + +/** + * Selector constants for ucurr_getName(). + * + * @see ucurr_getName + * @stable ICU 2.6 + */ +typedef enum UCurrNameStyle { + /** + * Selector for ucurr_getName indicating a symbolic name for a + * currency, such as "$" for USD. + * @stable ICU 2.6 + */ + UCURR_SYMBOL_NAME, + + /** + * Selector for ucurr_getName indicating the long name for a + * currency, such as "US Dollar" for USD. + * @stable ICU 2.6 + */ + UCURR_LONG_NAME, + + /** + * Selector for getName() indicating the narrow currency symbol. + * The narrow currency symbol is similar to the regular currency + * symbol, but it always takes the shortest form: for example, + * "$" instead of "US$" for USD in en-CA. + * + * @stable ICU 61 + */ + UCURR_NARROW_SYMBOL_NAME, + +#ifndef U_HIDE_DRAFT_API + /** + * Selector for getName() indicating the formal currency symbol. + * The formal currency symbol is similar to the regular currency + * symbol, but it always takes the form used in formal settings + * such as banking; for example, "NT$" instead of "$" for TWD in zh-TW. + * + * @draft ICU 68 + */ + UCURR_FORMAL_SYMBOL_NAME, + + /** + * Selector for getName() indicating the variant currency symbol. + * The variant symbol for a currency is an alternative symbol + * that is not necessarily as widely used as the regular symbol. + * + * @draft ICU 68 + */ + UCURR_VARIANT_SYMBOL_NAME +#endif // U_HIDE_DRAFT_API + +} UCurrNameStyle; + +#if !UCONFIG_NO_SERVICE +/** + * @stable ICU 2.6 + */ +typedef const void* UCurrRegistryKey; + +/** + * Register an (existing) ISO 4217 currency code for the given locale. + * Only the country code and the two variants EURO and PRE_EURO are + * recognized. + * @param isoCode the three-letter ISO 4217 currency code + * @param locale the locale for which to register this currency code + * @param status the in/out status code + * @return a registry key that can be used to unregister this currency code, or NULL + * if there was an error. + * @stable ICU 2.6 + */ +U_CAPI UCurrRegistryKey U_EXPORT2 +ucurr_register(const UChar* isoCode, + const char* locale, + UErrorCode* status); +/** + * Unregister the previously-registered currency definitions using the + * URegistryKey returned from ucurr_register. Key becomes invalid after + * a successful call and should not be used again. Any currency + * that might have been hidden by the original ucurr_register call is + * restored. + * @param key the registry key returned by a previous call to ucurr_register + * @param status the in/out status code, no special meanings are assigned + * @return true if the currency for this key was successfully unregistered + * @stable ICU 2.6 + */ +U_CAPI UBool U_EXPORT2 +ucurr_unregister(UCurrRegistryKey key, UErrorCode* status); +#endif /* UCONFIG_NO_SERVICE */ + +/** + * Returns the display name for the given currency in the + * given locale. For example, the display name for the USD + * currency object in the en_US locale is "$". + * @param currency null-terminated 3-letter ISO 4217 code + * @param locale locale in which to display currency + * @param nameStyle selector for which kind of name to return + * @param isChoiceFormat always set to false, or can be NULL; + * display names are static strings; + * since ICU 4.4, ChoiceFormat patterns are no longer supported + * @param len fill-in parameter to receive length of result + * @param ec error code + * @return pointer to display string of 'len' UChars. If the resource + * data contains no entry for 'currency', then 'currency' itself is + * returned. + * @stable ICU 2.6 + */ +U_CAPI const UChar* U_EXPORT2 +ucurr_getName(const UChar* currency, + const char* locale, + UCurrNameStyle nameStyle, + UBool* isChoiceFormat, + int32_t* len, + UErrorCode* ec); + +/** + * Returns the plural name for the given currency in the + * given locale. For example, the plural name for the USD + * currency object in the en_US locale is "US dollar" or "US dollars". + * @param currency null-terminated 3-letter ISO 4217 code + * @param locale locale in which to display currency + * @param isChoiceFormat always set to false, or can be NULL; + * display names are static strings; + * since ICU 4.4, ChoiceFormat patterns are no longer supported + * @param pluralCount plural count + * @param len fill-in parameter to receive length of result + * @param ec error code + * @return pointer to display string of 'len' UChars. If the resource + * data contains no entry for 'currency', then 'currency' itself is + * returned. + * @stable ICU 4.2 + */ +U_CAPI const UChar* U_EXPORT2 +ucurr_getPluralName(const UChar* currency, + const char* locale, + UBool* isChoiceFormat, + const char* pluralCount, + int32_t* len, + UErrorCode* ec); + +/** + * Returns the number of the number of fraction digits that should + * be displayed for the given currency. + * This is equivalent to ucurr_getDefaultFractionDigitsForUsage(currency,UCURR_USAGE_STANDARD,ec); + * + * Important: The number of fraction digits for a given currency is NOT + * guaranteed to be constant across versions of ICU or CLDR. For example, + * do NOT use this value as a mechanism for deciding the magnitude used + * to store currency values in a database. You should use this value for + * display purposes only. + * + * @param currency null-terminated 3-letter ISO 4217 code + * @param ec input-output error code + * @return a non-negative number of fraction digits to be + * displayed, or 0 if there is an error + * @stable ICU 3.0 + */ +U_CAPI int32_t U_EXPORT2 +ucurr_getDefaultFractionDigits(const UChar* currency, + UErrorCode* ec); + +/** + * Returns the number of the number of fraction digits that should + * be displayed for the given currency with usage. + * + * Important: The number of fraction digits for a given currency is NOT + * guaranteed to be constant across versions of ICU or CLDR. For example, + * do NOT use this value as a mechanism for deciding the magnitude used + * to store currency values in a database. You should use this value for + * display purposes only. + * + * @param currency null-terminated 3-letter ISO 4217 code + * @param usage enum usage for the currency + * @param ec input-output error code + * @return a non-negative number of fraction digits to be + * displayed, or 0 if there is an error + * @stable ICU 54 + */ +U_CAPI int32_t U_EXPORT2 +ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, + const UCurrencyUsage usage, + UErrorCode* ec); + +/** + * Returns the rounding increment for the given currency, or 0.0 if no + * rounding is done by the currency. + * This is equivalent to ucurr_getRoundingIncrementForUsage(currency,UCURR_USAGE_STANDARD,ec); + * @param currency null-terminated 3-letter ISO 4217 code + * @param ec input-output error code + * @return the non-negative rounding increment, or 0.0 if none, + * or 0.0 if there is an error + * @stable ICU 3.0 + */ +U_CAPI double U_EXPORT2 +ucurr_getRoundingIncrement(const UChar* currency, + UErrorCode* ec); + +/** + * Returns the rounding increment for the given currency, or 0.0 if no + * rounding is done by the currency given usage. + * @param currency null-terminated 3-letter ISO 4217 code + * @param usage enum usage for the currency + * @param ec input-output error code + * @return the non-negative rounding increment, or 0.0 if none, + * or 0.0 if there is an error + * @stable ICU 54 + */ +U_CAPI double U_EXPORT2 +ucurr_getRoundingIncrementForUsage(const UChar* currency, + const UCurrencyUsage usage, + UErrorCode* ec); + +/** + * Selector constants for ucurr_openCurrencies(). + * + * @see ucurr_openCurrencies + * @stable ICU 3.2 + */ +typedef enum UCurrCurrencyType { + /** + * Select all ISO-4217 currency codes. + * @stable ICU 3.2 + */ + UCURR_ALL = INT32_MAX, + /** + * Select only ISO-4217 commonly used currency codes. + * These currencies can be found in common use, and they usually have + * bank notes or coins associated with the currency code. + * This does not include fund codes, precious metals and other + * various ISO-4217 codes limited to special financial products. + * @stable ICU 3.2 + */ + UCURR_COMMON = 1, + /** + * Select ISO-4217 uncommon currency codes. + * These codes respresent fund codes, precious metals and other + * various ISO-4217 codes limited to special financial products. + * A fund code is a monetary resource associated with a currency. + * @stable ICU 3.2 + */ + UCURR_UNCOMMON = 2, + /** + * Select only deprecated ISO-4217 codes. + * These codes are no longer in general public use. + * @stable ICU 3.2 + */ + UCURR_DEPRECATED = 4, + /** + * Select only non-deprecated ISO-4217 codes. + * These codes are in general public use. + * @stable ICU 3.2 + */ + UCURR_NON_DEPRECATED = 8 +} UCurrCurrencyType; + +/** + * Provides a UEnumeration object for listing ISO-4217 codes. + * @param currType You can use one of several UCurrCurrencyType values for this + * variable. You can also | (or) them together to get a specific list of + * currencies. Most people will want to use the (UCURR_COMMON|UCURR_NON_DEPRECATED) value to + * get a list of current currencies. + * @param pErrorCode Error code + * @stable ICU 3.2 + */ +U_CAPI UEnumeration * U_EXPORT2 +ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode); + +/** + * Queries if the given ISO 4217 3-letter code is available on the specified date range. + * + * Note: For checking availability of a currency on a specific date, specify the date on both 'from' and 'to' + * + * When 'from' is U_DATE_MIN and 'to' is U_DATE_MAX, this method checks if the specified currency is available any time. + * If 'from' and 'to' are same UDate value, this method checks if the specified currency is available on that date. + * + * @param isoCode + * The ISO 4217 3-letter code. + * + * @param from + * The lower bound of the date range, inclusive. When 'from' is U_DATE_MIN, check the availability + * of the currency any date before 'to' + * + * @param to + * The upper bound of the date range, inclusive. When 'to' is U_DATE_MAX, check the availability of + * the currency any date after 'from' + * + * @param errorCode + * ICU error code + * + * @return true if the given ISO 4217 3-letter code is supported on the specified date range. + * + * @stable ICU 4.8 + */ +U_CAPI UBool U_EXPORT2 +ucurr_isAvailable(const UChar* isoCode, + UDate from, + UDate to, + UErrorCode* errorCode); + +/** + * Finds the number of valid currency codes for the + * given locale and date. + * @param locale the locale for which to retrieve the + * currency count. + * @param date the date for which to retrieve the + * currency count for the given locale. + * @param ec error code + * @return the number of currency codes for the + * given locale and date. If 0, currency + * codes couldn't be found for the input + * values are invalid. + * @stable ICU 4.0 + */ +U_CAPI int32_t U_EXPORT2 +ucurr_countCurrencies(const char* locale, + UDate date, + UErrorCode* ec); + +/** + * Finds a currency code for the given locale and date + * @param locale the locale for which to retrieve a currency code. + * Currency can be specified by the "currency" keyword + * in which case it overrides the default currency code + * @param date the date for which to retrieve a currency code for + * the given locale. + * @param index the index within the available list of currency codes + * for the given locale on the given date. + * @param buff fill in buffer. Can be NULL for preflighting. + * @param buffCapacity capacity of the fill in buffer. Can be 0 for + * preflighting. If it is non-zero, the buff parameter + * must not be NULL. + * @param ec error code + * @return length of the currency string. It should always be 3. + * If 0, currency couldn't be found or the input values are + * invalid. + * @stable ICU 4.0 + */ +U_CAPI int32_t U_EXPORT2 +ucurr_forLocaleAndDate(const char* locale, + UDate date, + int32_t index, + UChar* buff, + int32_t buffCapacity, + UErrorCode* ec); + +/** + * Given a key and a locale, returns an array of string values in a preferred + * order that would make a difference. These are all and only those values where + * the open (creation) of the service with the locale formed from the input locale + * plus input keyword and that value has different behavior than creation with the + * input locale alone. + * @param key one of the keys supported by this service. For now, only + * "currency" is supported. + * @param locale the locale + * @param commonlyUsed if set to true it will return only commonly used values + * with the given locale in preferred order. Otherwise, + * it will return all the available values for the locale. + * @param status error status + * @return a string enumeration over keyword values for the given key and the locale. + * @stable ICU 4.2 + */ +U_CAPI UEnumeration* U_EXPORT2 +ucurr_getKeywordValuesForLocale(const char* key, + const char* locale, + UBool commonlyUsed, + UErrorCode* status); + +/** + * Returns the ISO 4217 numeric code for the currency. + *

Note: If the ISO 4217 numeric code is not assigned for the currency or + * the currency is unknown, this function returns 0. + * + * @param currency null-terminated 3-letter ISO 4217 code + * @return The ISO 4217 numeric code of the currency + * @stable ICU 49 + */ +U_CAPI int32_t U_EXPORT2 +ucurr_getNumericCode(const UChar* currency); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/udata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/udata.h new file mode 100644 index 0000000000000000000000000000000000000000..6caa849c42f5319a62bec395004b050c35e61d2c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/udata.h @@ -0,0 +1,440 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: udata.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999oct25 +* created by: Markus W. Scherer +*/ + +#ifndef __UDATA_H__ +#define __UDATA_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +U_CDECL_BEGIN + +/** + * \file + * \brief C API: Data loading interface + * + *

Information about data loading interface

+ * + * This API is used to find and efficiently load data for ICU and applications + * using ICU. It provides an abstract interface that specifies a data type and + * name to find and load the data. Normally this API is used by other ICU APIs + * to load required data out of the ICU data library, but it can be used to + * load data out of other places. + * + * See the User Guide Data Management chapter. + */ + +#ifndef U_HIDE_INTERNAL_API +/** + * Character used to separate package names from tree names + * @internal ICU 3.0 + */ +#define U_TREE_SEPARATOR '-' + +/** + * String used to separate package names from tree names + * @internal ICU 3.0 + */ +#define U_TREE_SEPARATOR_STRING "-" + +/** + * Character used to separate parts of entry names + * @internal ICU 3.0 + */ +#define U_TREE_ENTRY_SEP_CHAR '/' + +/** + * String used to separate parts of entry names + * @internal ICU 3.0 + */ +#define U_TREE_ENTRY_SEP_STRING "/" + +/** + * Alias for standard ICU data + * @internal ICU 3.0 + */ +#define U_ICUDATA_ALIAS "ICUDATA" + +#endif /* U_HIDE_INTERNAL_API */ + +/** + * UDataInfo contains the properties about the requested data. + * This is meta data. + * + *

This structure may grow in the future, indicated by the + * size field.

+ * + *

ICU data must be at least 8-aligned, and should be 16-aligned. + * The UDataInfo struct begins 4 bytes after the start of the data item, + * so it is 4-aligned. + * + *

The platform data property fields help determine if a data + * file can be efficiently used on a given machine. + * The particular fields are of importance only if the data + * is affected by the properties - if there is integer data + * with word sizes > 1 byte, char* text, or UChar* text.

+ * + *

The implementation for the udata_open[Choice]() + * functions may reject data based on the value in isBigEndian. + * No other field is used by the udata API implementation.

+ * + *

The dataFormat may be used to identify + * the kind of data, e.g. a converter table.

+ * + *

The formatVersion field should be used to + * make sure that the format can be interpreted. + * It may be a good idea to check only for the one or two highest + * of the version elements to allow the data memory to + * get more or somewhat rearranged contents, for as long + * as the using code can still interpret the older contents.

+ * + *

The dataVersion field is intended to be a + * common place to store the source version of the data; + * for data from the Unicode character database, this could + * reflect the Unicode version.

+ * + * @stable ICU 2.0 + */ +typedef struct { + /** sizeof(UDataInfo) + * @stable ICU 2.0 */ + uint16_t size; + + /** unused, set to 0 + * @stable ICU 2.0*/ + uint16_t reservedWord; + + /* platform data properties */ + /** 0 for little-endian machine, 1 for big-endian + * @stable ICU 2.0 */ + uint8_t isBigEndian; + + /** see U_CHARSET_FAMILY values in utypes.h + * @stable ICU 2.0*/ + uint8_t charsetFamily; + + /** sizeof(UChar), one of { 1, 2, 4 } + * @stable ICU 2.0*/ + uint8_t sizeofUChar; + + /** unused, set to 0 + * @stable ICU 2.0*/ + uint8_t reservedByte; + + /** data format identifier + * @stable ICU 2.0*/ + uint8_t dataFormat[4]; + + /** versions: [0] major [1] minor [2] milli [3] micro + * @stable ICU 2.0*/ + uint8_t formatVersion[4]; + + /** versions: [0] major [1] minor [2] milli [3] micro + * @stable ICU 2.0*/ + uint8_t dataVersion[4]; +} UDataInfo; + +/* API for reading data -----------------------------------------------------*/ + +/** + * Forward declaration of the data memory type. + * @stable ICU 2.0 + */ +typedef struct UDataMemory UDataMemory; + +/** + * Callback function for udata_openChoice(). + * @param context parameter passed into udata_openChoice(). + * @param type The type of the data as passed into udata_openChoice(). + * It may be NULL. + * @param name The name of the data as passed into udata_openChoice(). + * @param pInfo A pointer to the UDataInfo structure + * of data that has been loaded and will be returned + * by udata_openChoice() if this function + * returns true. + * @return true if the current data memory is acceptable + * @stable ICU 2.0 + */ +typedef UBool U_CALLCONV +UDataMemoryIsAcceptable(void *context, + const char *type, const char *name, + const UDataInfo *pInfo); + + +/** + * Convenience function. + * This function works the same as udata_openChoice + * except that any data that matches the type and name + * is assumed to be acceptable. + * @param path Specifies an absolute path and/or a basename for the + * finding of the data in the file system. + * NULL for ICU data. + * @param type A string that specifies the type of data to be loaded. + * For example, resource bundles are loaded with type "res", + * conversion tables with type "cnv". + * This may be NULL or empty. + * @param name A string that specifies the name of the data. + * @param pErrorCode An ICU UErrorCode parameter. It must not be NULL. + * @return A pointer (handle) to a data memory object, or NULL + * if an error occurs. Call udata_getMemory() + * to get a pointer to the actual data. + * + * @see udata_openChoice + * @stable ICU 2.0 + */ +U_CAPI UDataMemory * U_EXPORT2 +udata_open(const char *path, const char *type, const char *name, + UErrorCode *pErrorCode); + +/** + * Data loading function. + * This function is used to find and load efficiently data for + * ICU and applications using ICU. + * It provides an abstract interface that allows to specify a data + * type and name to find and load the data. + * + *

The implementation depends on platform properties and user preferences + * and may involve loading shared libraries (DLLs), mapping + * files into memory, or fopen()/fread() files. + * It may also involve using static memory or database queries etc. + * Several or all data items may be combined into one entity + * (DLL, memory-mappable file).

+ * + *

The data is always preceded by a header that includes + * a UDataInfo structure. + * The caller's isAcceptable() function is called to make + * sure that the data is useful. It may be called several times if it + * rejects the data and there is more than one location with data + * matching the type and name.

+ * + *

If path==NULL, then ICU data is loaded. + * Otherwise, it is separated into a basename and a basename-less directory string. + * The basename is used as the data package name, and the directory is + * logically prepended to the ICU data directory string.

+ * + *

For details about ICU data loading see the User Guide + * Data Management chapter. (http://icu-project.org/userguide/icudata.html)

+ * + * @param path Specifies an absolute path and/or a basename for the + * finding of the data in the file system. + * NULL for ICU data. + * @param type A string that specifies the type of data to be loaded. + * For example, resource bundles are loaded with type "res", + * conversion tables with type "cnv". + * This may be NULL or empty. + * @param name A string that specifies the name of the data. + * @param isAcceptable This function is called to verify that loaded data + * is useful for the client code. If it returns false + * for all data items, then udata_openChoice() + * will return with an error. + * @param context Arbitrary parameter to be passed into isAcceptable. + * @param pErrorCode An ICU UErrorCode parameter. It must not be NULL. + * @return A pointer (handle) to a data memory object, or NULL + * if an error occurs. Call udata_getMemory() + * to get a pointer to the actual data. + * @stable ICU 2.0 + */ +U_CAPI UDataMemory * U_EXPORT2 +udata_openChoice(const char *path, const char *type, const char *name, + UDataMemoryIsAcceptable *isAcceptable, void *context, + UErrorCode *pErrorCode); + +/** + * Close the data memory. + * This function must be called to allow the system to + * release resources associated with this data memory. + * @param pData The pointer to data memory object + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +udata_close(UDataMemory *pData); + +/** + * Get the pointer to the actual data inside the data memory. + * The data is read-only. + * + * ICU data must be at least 8-aligned, and should be 16-aligned. + * + * @param pData The pointer to data memory object + * @stable ICU 2.0 + */ +U_CAPI const void * U_EXPORT2 +udata_getMemory(UDataMemory *pData); + +/** + * Get the information from the data memory header. + * This allows to get access to the header containing + * platform data properties etc. which is not part of + * the data itself and can therefore not be accessed + * via the pointer that udata_getMemory() returns. + * + * @param pData pointer to the data memory object + * @param pInfo pointer to a UDataInfo object; + * its size field must be set correctly, + * typically to sizeof(UDataInfo). + * + * *pInfo will be filled with the UDataInfo structure + * in the data memory object. If this structure is smaller than + * pInfo->size, then the size will be + * adjusted and only part of the structure will be filled. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +udata_getInfo(UDataMemory *pData, UDataInfo *pInfo); + +/** + * This function bypasses the normal ICU data loading process and + * allows you to force ICU's system data to come out of a user-specified + * area in memory. + * + * ICU data must be at least 8-aligned, and should be 16-aligned. + * See https://unicode-org.github.io/icu/userguide/icudata + * + * The format of this data is that of the icu common data file, as is + * generated by the pkgdata tool with mode=common or mode=dll. + * You can read in a whole common mode file and pass the address to the start of the + * data, or (with the appropriate link options) pass in the pointer to + * the data that has been loaded from a dll by the operating system, + * as shown in this code: + * + * extern const char U_IMPORT U_ICUDATA_ENTRY_POINT []; + * // U_ICUDATA_ENTRY_POINT is same as entry point specified to pkgdata tool + * UErrorCode status = U_ZERO_ERROR; + * + * udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status); + * + * It is important that the declaration be as above. The entry point + * must not be declared as an extern void*. + * + * Starting with ICU 4.4, it is possible to set several data packages, + * one per call to this function. + * udata_open() will look for data in the multiple data packages in the order + * in which they were set. + * The position of the linked-in or default-name ICU .data package in the + * search list depends on when the first data item is loaded that is not contained + * in the already explicitly set packages. + * If data was loaded implicitly before the first call to this function + * (for example, via opening a converter, constructing a UnicodeString + * from default-codepage data, using formatting or collation APIs, etc.), + * then the default data will be first in the list. + * + * This function has no effect on application (non ICU) data. See udata_setAppData() + * for similar functionality for application data. + * + * @param data pointer to ICU common data + * @param err outgoing error status U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +udata_setCommonData(const void *data, UErrorCode *err); + + +/** + * This function bypasses the normal ICU data loading process for application-specific + * data and allows you to force the it to come out of a user-specified + * pointer. + * + * ICU data must be at least 8-aligned, and should be 16-aligned. + * See https://unicode-org.github.io/icu/userguide/icudata + * + * The format of this data is that of the icu common data file, like 'icudt26l.dat' + * or the corresponding shared library (DLL) file. + * The application must read in or otherwise construct an image of the data and then + * pass the address of it to this function. + * + * + * Warning: setAppData will set a U_USING_DEFAULT_WARNING code if + * data with the specifed path that has already been opened, or + * if setAppData with the same path has already been called. + * Any such calls to setAppData will have no effect. + * + * + * @param packageName the package name by which the application will refer + * to (open) this data + * @param data pointer to the data + * @param err outgoing error status U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR + * @see udata_setCommonData + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +udata_setAppData(const char *packageName, const void *data, UErrorCode *err); + +/** + * Possible settings for udata_setFileAccess() + * @see udata_setFileAccess + * @stable ICU 3.4 + */ +typedef enum UDataFileAccess { + /** ICU looks for data in single files first, then in packages. (default) @stable ICU 3.4 */ + UDATA_FILES_FIRST, + /** An alias for the default access mode. @stable ICU 3.4 */ + UDATA_DEFAULT_ACCESS = UDATA_FILES_FIRST, + /** ICU only loads data from packages, not from single files. @stable ICU 3.4 */ + UDATA_ONLY_PACKAGES, + /** ICU loads data from packages first, and only from single files + if the data cannot be found in a package. @stable ICU 3.4 */ + UDATA_PACKAGES_FIRST, + /** ICU does not access the file system for data loading. @stable ICU 3.4 */ + UDATA_NO_FILES, +#ifndef U_HIDE_DEPRECATED_API + /** + * Number of real UDataFileAccess values. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDATA_FILE_ACCESS_COUNT +#endif // U_HIDE_DEPRECATED_API +} UDataFileAccess; + +/** + * This function may be called to control how ICU loads data. It must be called + * before any ICU data is loaded, including application data loaded with + * ures/ResourceBundle or udata APIs. This function is not multithread safe. + * The results of calling it while other threads are loading data are undefined. + * @param access The type of file access to be used + * @param status Error code. + * @see UDataFileAccess + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +udata_setFileAccess(UDataFileAccess access, UErrorCode *status); + +U_CDECL_END + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUDataMemoryPointer + * "Smart pointer" class, closes a UDataMemory via udata_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close); + +U_NAMESPACE_END + +#endif // U_SHOW_CPLUSPLUS_API + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/udisplaycontext.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/udisplaycontext.h new file mode 100644 index 0000000000000000000000000000000000000000..6e1421798054f633bf39e4bc27077f12a241bcdf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/udisplaycontext.h @@ -0,0 +1,173 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2014-2016, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef UDISPLAYCONTEXT_H +#define UDISPLAYCONTEXT_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +/** + * \file + * \brief C API: Display context types (enum values) + */ + +/** + * Display context types, for getting values of a particular setting. + * Note, the specific numeric values are internal and may change. + * @stable ICU 51 + */ +enum UDisplayContextType { + /** + * Type to retrieve the dialect handling setting, e.g. + * UDISPCTX_STANDARD_NAMES or UDISPCTX_DIALECT_NAMES. + * @stable ICU 51 + */ + UDISPCTX_TYPE_DIALECT_HANDLING = 0, + /** + * Type to retrieve the capitalization context setting, e.g. + * UDISPCTX_CAPITALIZATION_NONE, UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, + * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, etc. + * @stable ICU 51 + */ + UDISPCTX_TYPE_CAPITALIZATION = 1, + /** + * Type to retrieve the display length setting, e.g. + * UDISPCTX_LENGTH_FULL, UDISPCTX_LENGTH_SHORT. + * @stable ICU 54 + */ + UDISPCTX_TYPE_DISPLAY_LENGTH = 2, + /** + * Type to retrieve the substitute handling setting, e.g. + * UDISPCTX_SUBSTITUTE, UDISPCTX_NO_SUBSTITUTE. + * @stable ICU 58 + */ + UDISPCTX_TYPE_SUBSTITUTE_HANDLING = 3 +}; +/** +* @stable ICU 51 +*/ +typedef enum UDisplayContextType UDisplayContextType; + +/** + * Display context settings. + * Note, the specific numeric values are internal and may change. + * @stable ICU 51 + */ +enum UDisplayContext { + /** + * ================================ + * DIALECT_HANDLING can be set to one of UDISPCTX_STANDARD_NAMES or + * UDISPCTX_DIALECT_NAMES. Use UDisplayContextType UDISPCTX_TYPE_DIALECT_HANDLING + * to get the value. + */ + /** + * A possible setting for DIALECT_HANDLING: + * use standard names when generating a locale name, + * e.g. en_GB displays as 'English (United Kingdom)'. + * @stable ICU 51 + */ + UDISPCTX_STANDARD_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 0, + /** + * A possible setting for DIALECT_HANDLING: + * use dialect names, when generating a locale name, + * e.g. en_GB displays as 'British English'. + * @stable ICU 51 + */ + UDISPCTX_DIALECT_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 1, + /** + * ================================ + * CAPITALIZATION can be set to one of UDISPCTX_CAPITALIZATION_NONE, + * UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, + * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, + * UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU, or + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. + * Use UDisplayContextType UDISPCTX_TYPE_CAPITALIZATION to get the value. + */ + /** + * The capitalization context to be used is unknown (this is the default value). + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_NONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 0, + /** + * The capitalization context if a date, date symbol or display name is to be + * formatted with capitalization appropriate for the middle of a sentence. + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 1, + /** + * The capitalization context if a date, date symbol or display name is to be + * formatted with capitalization appropriate for the beginning of a sentence. + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 2, + /** + * The capitalization context if a date, date symbol or display name is to be + * formatted with capitalization appropriate for a user-interface list or menu item. + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 3, + /** + * The capitalization context if a date, date symbol or display name is to be + * formatted with capitalization appropriate for stand-alone usage such as an + * isolated name on a calendar page. + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_FOR_STANDALONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 4, + /** + * ================================ + * DISPLAY_LENGTH can be set to one of UDISPCTX_LENGTH_FULL or + * UDISPCTX_LENGTH_SHORT. Use UDisplayContextType UDISPCTX_TYPE_DISPLAY_LENGTH + * to get the value. + */ + /** + * A possible setting for DISPLAY_LENGTH: + * use full names when generating a locale name, + * e.g. "United States" for US. + * @stable ICU 54 + */ + UDISPCTX_LENGTH_FULL = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 0, + /** + * A possible setting for DISPLAY_LENGTH: + * use short names when generating a locale name, + * e.g. "U.S." for US. + * @stable ICU 54 + */ + UDISPCTX_LENGTH_SHORT = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 1, + /** + * ================================ + * SUBSTITUTE_HANDLING can be set to one of UDISPCTX_SUBSTITUTE or + * UDISPCTX_NO_SUBSTITUTE. Use UDisplayContextType UDISPCTX_TYPE_SUBSTITUTE_HANDLING + * to get the value. + */ + /** + * A possible setting for SUBSTITUTE_HANDLING: + * Returns a fallback value (e.g., the input code) when no data is available. + * This is the default value. + * @stable ICU 58 + */ + UDISPCTX_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 0, + /** + * A possible setting for SUBSTITUTE_HANDLING: + * Returns a null value with error code set to U_ILLEGAL_ARGUMENT_ERROR when no + * data is available. + * @stable ICU 58 + */ + UDISPCTX_NO_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 1 + +}; +/** +* @stable ICU 51 +*/ +typedef enum UDisplayContext UDisplayContext; + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uenum.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uenum.h new file mode 100644 index 0000000000000000000000000000000000000000..d9c893e06d92b275b1c4ee1e9539a308abacf0b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uenum.h @@ -0,0 +1,209 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uenum.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:2 +* +* created on: 2002jul08 +* created by: Vladimir Weinstein +*/ + +#ifndef __UENUM_H +#define __UENUM_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" + +U_NAMESPACE_BEGIN +class StringEnumeration; +U_NAMESPACE_END +#endif // U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief C API: String Enumeration + */ + +/** + * An enumeration object. + * For usage in C programs. + * @stable ICU 2.2 + */ +struct UEnumeration; +/** structure representing an enumeration object instance @stable ICU 2.2 */ +typedef struct UEnumeration UEnumeration; + +/** + * Disposes of resources in use by the iterator. If en is NULL, + * does nothing. After this call, any char* or UChar* pointer + * returned by uenum_unext() or uenum_next() is invalid. + * @param en UEnumeration structure pointer + * @stable ICU 2.2 + */ +U_CAPI void U_EXPORT2 +uenum_close(UEnumeration* en); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUEnumerationPointer + * "Smart pointer" class, closes a UEnumeration via uenum_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close); + +U_NAMESPACE_END + +#endif + +/** + * Returns the number of elements that the iterator traverses. If + * the iterator is out-of-sync with its service, status is set to + * U_ENUM_OUT_OF_SYNC_ERROR. + * This is a convenience function. It can end up being very + * expensive as all the items might have to be pre-fetched (depending + * on the type of data being traversed). Use with caution and only + * when necessary. + * @param en UEnumeration structure pointer + * @param status error code, can be U_ENUM_OUT_OF_SYNC_ERROR if the + * iterator is out of sync. + * @return number of elements in the iterator + * @stable ICU 2.2 + */ +U_CAPI int32_t U_EXPORT2 +uenum_count(UEnumeration* en, UErrorCode* status); + +/** + * Returns the next element in the iterator's list. If there are + * no more elements, returns NULL. If the iterator is out-of-sync + * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and + * NULL is returned. If the native service string is a char* string, + * it is converted to UChar* with the invariant converter. + * The result is terminated by (UChar)0. + * @param en the iterator object + * @param resultLength pointer to receive the length of the result + * (not including the terminating \\0). + * If the pointer is NULL it is ignored. + * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if + * the iterator is out of sync with its service. + * @return a pointer to the string. The string will be + * zero-terminated. The return pointer is owned by this iterator + * and must not be deleted by the caller. The pointer is valid + * until the next call to any uenum_... method, including + * uenum_next() or uenum_unext(). When all strings have been + * traversed, returns NULL. + * @stable ICU 2.2 + */ +U_CAPI const UChar* U_EXPORT2 +uenum_unext(UEnumeration* en, + int32_t* resultLength, + UErrorCode* status); + +/** + * Returns the next element in the iterator's list. If there are + * no more elements, returns NULL. If the iterator is out-of-sync + * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and + * NULL is returned. If the native service string is a UChar* + * string, it is converted to char* with the invariant converter. + * The result is terminated by (char)0. If the conversion fails + * (because a character cannot be converted) then status is set to + * U_INVARIANT_CONVERSION_ERROR and the return value is undefined + * (but non-NULL). + * @param en the iterator object + * @param resultLength pointer to receive the length of the result + * (not including the terminating \\0). + * If the pointer is NULL it is ignored. + * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if + * the iterator is out of sync with its service. Set to + * U_INVARIANT_CONVERSION_ERROR if the underlying native string is + * UChar* and conversion to char* with the invariant converter + * fails. This error pertains only to current string, so iteration + * might be able to continue successfully. + * @return a pointer to the string. The string will be + * zero-terminated. The return pointer is owned by this iterator + * and must not be deleted by the caller. The pointer is valid + * until the next call to any uenum_... method, including + * uenum_next() or uenum_unext(). When all strings have been + * traversed, returns NULL. + * @stable ICU 2.2 + */ +U_CAPI const char* U_EXPORT2 +uenum_next(UEnumeration* en, + int32_t* resultLength, + UErrorCode* status); + +/** + * Resets the iterator to the current list of service IDs. This + * re-establishes sync with the service and rewinds the iterator + * to start at the first element. + * @param en the iterator object + * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if + * the iterator is out of sync with its service. + * @stable ICU 2.2 + */ +U_CAPI void U_EXPORT2 +uenum_reset(UEnumeration* en, UErrorCode* status); + +#if U_SHOW_CPLUSPLUS_API + +/** + * Given a StringEnumeration, wrap it in a UEnumeration. The + * StringEnumeration is adopted; after this call, the caller must not + * delete it (regardless of error status). + * @param adopted the C++ StringEnumeration to be wrapped in a UEnumeration. + * @param ec the error code. + * @return a UEnumeration wrapping the adopted StringEnumeration. + * @stable ICU 4.2 + */ +U_CAPI UEnumeration* U_EXPORT2 +uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec); + +#endif + +/** + * Given an array of const UChar* strings, return a UEnumeration. String pointers from 0..count-1 must not be null. + * Do not free or modify either the string array or the characters it points to until this object has been destroyed with uenum_close. + * \snippet test/cintltst/uenumtst.c uenum_openUCharStringsEnumeration + * @param strings array of const UChar* strings (each null terminated). All storage is owned by the caller. + * @param count length of the array + * @param ec error code + * @return the new UEnumeration object. Caller is responsible for calling uenum_close to free memory. + * @see uenum_close + * @stable ICU 50 + */ +U_CAPI UEnumeration* U_EXPORT2 +uenum_openUCharStringsEnumeration(const UChar* const strings[], int32_t count, + UErrorCode* ec); + +/** + * Given an array of const char* strings (invariant chars only), return a UEnumeration. String pointers from 0..count-1 must not be null. + * Do not free or modify either the string array or the characters it points to until this object has been destroyed with uenum_close. + * \snippet test/cintltst/uenumtst.c uenum_openCharStringsEnumeration + * @param strings array of char* strings (each null terminated). All storage is owned by the caller. + * @param count length of the array + * @param ec error code + * @return the new UEnumeration object. Caller is responsible for calling uenum_close to free memory + * @see uenum_close + * @stable ICU 50 + */ +U_CAPI UEnumeration* U_EXPORT2 +uenum_openCharStringsEnumeration(const char* const strings[], int32_t count, + UErrorCode* ec); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uidna.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uidna.h new file mode 100644 index 0000000000000000000000000000000000000000..24a81ceaddf58d4fb372e70a38b71a1203f4fe91 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uidna.h @@ -0,0 +1,776 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * + * Copyright (C) 2003-2014, International Business Machines + * Corporation and others. All Rights Reserved. + * + ******************************************************************************* + * file name: uidna.h + * encoding: UTF-8 + * tab size: 8 (not used) + * indentation:4 + * + * created on: 2003feb1 + * created by: Ram Viswanadha + */ + +#ifndef __UIDNA_H__ +#define __UIDNA_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_IDNA + +#include +#include "unicode/parseerr.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief C API: Internationalizing Domain Names in Applications (IDNA) + * + * IDNA2008 is implemented according to UTS #46, see the IDNA C++ class in idna.h. + * + * The C API functions which do take a UIDNA * service object pointer + * implement UTS #46 and IDNA2008. + * + * IDNA2003 is obsolete. + * The C API functions which do not take a service object pointer + * implement IDNA2003. They are all deprecated. + */ + +/* + * IDNA option bit set values. + */ +enum { + /** + * Default options value: None of the other options are set. + * For use in static worker and factory methods. + * @stable ICU 2.6 + */ + UIDNA_DEFAULT=0, +#ifndef U_HIDE_DEPRECATED_API + /** + * Option to allow unassigned code points in domain names and labels. + * For use in static worker and factory methods. + *

This option is ignored by the UTS46 implementation. + * (UTS #46 disallows unassigned code points.) + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ + UIDNA_ALLOW_UNASSIGNED=1, +#endif /* U_HIDE_DEPRECATED_API */ + /** + * Option to check whether the input conforms to the STD3 ASCII rules, + * for example the restriction of labels to LDH characters + * (ASCII Letters, Digits and Hyphen-Minus). + * For use in static worker and factory methods. + * @stable ICU 2.6 + */ + UIDNA_USE_STD3_RULES=2, + /** + * IDNA option to check for whether the input conforms to the BiDi rules. + * For use in static worker and factory methods. + *

This option is ignored by the IDNA2003 implementation. + * (IDNA2003 always performs a BiDi check.) + * @stable ICU 4.6 + */ + UIDNA_CHECK_BIDI=4, + /** + * IDNA option to check for whether the input conforms to the CONTEXTJ rules. + * For use in static worker and factory methods. + *

This option is ignored by the IDNA2003 implementation. + * (The CONTEXTJ check is new in IDNA2008.) + * @stable ICU 4.6 + */ + UIDNA_CHECK_CONTEXTJ=8, + /** + * IDNA option for nontransitional processing in ToASCII(). + * For use in static worker and factory methods. + *

By default, ToASCII() uses transitional processing. + *

This option is ignored by the IDNA2003 implementation. + * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) + * @stable ICU 4.6 + */ + UIDNA_NONTRANSITIONAL_TO_ASCII=0x10, + /** + * IDNA option for nontransitional processing in ToUnicode(). + * For use in static worker and factory methods. + *

By default, ToUnicode() uses transitional processing. + *

This option is ignored by the IDNA2003 implementation. + * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) + * @stable ICU 4.6 + */ + UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20, + /** + * IDNA option to check for whether the input conforms to the CONTEXTO rules. + * For use in static worker and factory methods. + *

This option is ignored by the IDNA2003 implementation. + * (The CONTEXTO check is new in IDNA2008.) + *

This is for use by registries for IDNA2008 conformance. + * UTS #46 does not require the CONTEXTO check. + * @stable ICU 49 + */ + UIDNA_CHECK_CONTEXTO=0x40 +}; + +/** + * Opaque C service object type for the new IDNA API. + * @stable ICU 4.6 + */ +struct UIDNA; +typedef struct UIDNA UIDNA; /**< C typedef for struct UIDNA. @stable ICU 4.6 */ + +/** + * Returns a UIDNA instance which implements UTS #46. + * Returns an unmodifiable instance, owned by the caller. + * Cache it for multiple operations, and uidna_close() it when done. + * The instance is thread-safe, that is, it can be used concurrently. + * + * For details about the UTS #46 implementation see the IDNA C++ class in idna.h. + * + * @param options Bit set to modify the processing and error checking. + * See option bit set values in uidna.h. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the UTS #46 UIDNA instance, if successful + * @stable ICU 4.6 + */ +U_CAPI UIDNA * U_EXPORT2 +uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); + +/** + * Closes a UIDNA instance. + * @param idna UIDNA instance to be closed + * @stable ICU 4.6 + */ +U_CAPI void U_EXPORT2 +uidna_close(UIDNA *idna); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUIDNAPointer + * "Smart pointer" class, closes a UIDNA via uidna_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.6 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close); + +U_NAMESPACE_END + +#endif + +/** + * Output container for IDNA processing errors. + * Initialize with UIDNA_INFO_INITIALIZER: + * \code + * UIDNAInfo info = UIDNA_INFO_INITIALIZER; + * int32_t length = uidna_nameToASCII(..., &info, &errorCode); + * if(U_SUCCESS(errorCode) && info.errors!=0) { ... } + * \endcode + * @stable ICU 4.6 + */ +typedef struct UIDNAInfo { + /** sizeof(UIDNAInfo) @stable ICU 4.6 */ + int16_t size; + /** + * Set to true if transitional and nontransitional processing produce different results. + * For details see C++ IDNAInfo::isTransitionalDifferent(). + * @stable ICU 4.6 + */ + UBool isTransitionalDifferent; + UBool reservedB3; /**< Reserved field, do not use. @internal */ + /** + * Bit set indicating IDNA processing errors. 0 if no errors. + * See UIDNA_ERROR_... constants. + * @stable ICU 4.6 + */ + uint32_t errors; + int32_t reservedI2; /**< Reserved field, do not use. @internal */ + int32_t reservedI3; /**< Reserved field, do not use. @internal */ +} UIDNAInfo; + +/** + * Static initializer for a UIDNAInfo struct. + * @stable ICU 4.6 + */ +#define UIDNA_INFO_INITIALIZER { \ + (int16_t)sizeof(UIDNAInfo), \ + false, false, \ + 0, 0, 0 } + +/** + * Converts a single domain name label into its ASCII form for DNS lookup. + * If any processing step fails, then pInfo->errors will be non-zero and + * the result might not be an ASCII string. + * The label might be modified according to the types of errors. + * Labels with severe errors will be left in (or turned into) their Unicode form. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param idna UIDNA instance + * @param label Input domain name label + * @param length Label length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_CAPI int32_t U_EXPORT2 +uidna_labelToASCII(const UIDNA *idna, + const UChar *label, int32_t length, + UChar *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a single domain name label into its Unicode form for human-readable display. + * If any processing step fails, then pInfo->errors will be non-zero. + * The label might be modified according to the types of errors. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param idna UIDNA instance + * @param label Input domain name label + * @param length Label length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_CAPI int32_t U_EXPORT2 +uidna_labelToUnicode(const UIDNA *idna, + const UChar *label, int32_t length, + UChar *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a whole domain name into its ASCII form for DNS lookup. + * If any processing step fails, then pInfo->errors will be non-zero and + * the result might not be an ASCII string. + * The domain name might be modified according to the types of errors. + * Labels with severe errors will be left in (or turned into) their Unicode form. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param idna UIDNA instance + * @param name Input domain name + * @param length Domain name length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_CAPI int32_t U_EXPORT2 +uidna_nameToASCII(const UIDNA *idna, + const UChar *name, int32_t length, + UChar *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a whole domain name into its Unicode form for human-readable display. + * If any processing step fails, then pInfo->errors will be non-zero. + * The domain name might be modified according to the types of errors. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param idna UIDNA instance + * @param name Input domain name + * @param length Domain name length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_CAPI int32_t U_EXPORT2 +uidna_nameToUnicode(const UIDNA *idna, + const UChar *name, int32_t length, + UChar *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/* UTF-8 versions of the processing methods --------------------------------- */ + +/** + * Converts a single domain name label into its ASCII form for DNS lookup. + * UTF-8 version of uidna_labelToASCII(), same behavior. + * + * @param idna UIDNA instance + * @param label Input domain name label + * @param length Label length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_CAPI int32_t U_EXPORT2 +uidna_labelToASCII_UTF8(const UIDNA *idna, + const char *label, int32_t length, + char *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a single domain name label into its Unicode form for human-readable display. + * UTF-8 version of uidna_labelToUnicode(), same behavior. + * + * @param idna UIDNA instance + * @param label Input domain name label + * @param length Label length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_CAPI int32_t U_EXPORT2 +uidna_labelToUnicodeUTF8(const UIDNA *idna, + const char *label, int32_t length, + char *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a whole domain name into its ASCII form for DNS lookup. + * UTF-8 version of uidna_nameToASCII(), same behavior. + * + * @param idna UIDNA instance + * @param name Input domain name + * @param length Domain name length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_CAPI int32_t U_EXPORT2 +uidna_nameToASCII_UTF8(const UIDNA *idna, + const char *name, int32_t length, + char *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a whole domain name into its Unicode form for human-readable display. + * UTF-8 version of uidna_nameToUnicode(), same behavior. + * + * @param idna UIDNA instance + * @param name Input domain name + * @param length Domain name length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_CAPI int32_t U_EXPORT2 +uidna_nameToUnicodeUTF8(const UIDNA *idna, + const char *name, int32_t length, + char *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/* + * IDNA error bit set values. + * When a domain name or label fails a processing step or does not meet the + * validity criteria, then one or more of these error bits are set. + */ +enum { + /** + * A non-final domain name label (or the whole domain name) is empty. + * @stable ICU 4.6 + */ + UIDNA_ERROR_EMPTY_LABEL=1, + /** + * A domain name label is longer than 63 bytes. + * (See STD13/RFC1034 3.1. Name space specifications and terminology.) + * This is only checked in ToASCII operations, and only if the output label is all-ASCII. + * @stable ICU 4.6 + */ + UIDNA_ERROR_LABEL_TOO_LONG=2, + /** + * A domain name is longer than 255 bytes in its storage form. + * (See STD13/RFC1034 3.1. Name space specifications and terminology.) + * This is only checked in ToASCII operations, and only if the output domain name is all-ASCII. + * @stable ICU 4.6 + */ + UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4, + /** + * A label starts with a hyphen-minus ('-'). + * @stable ICU 4.6 + */ + UIDNA_ERROR_LEADING_HYPHEN=8, + /** + * A label ends with a hyphen-minus ('-'). + * @stable ICU 4.6 + */ + UIDNA_ERROR_TRAILING_HYPHEN=0x10, + /** + * A label contains hyphen-minus ('-') in the third and fourth positions. + * @stable ICU 4.6 + */ + UIDNA_ERROR_HYPHEN_3_4=0x20, + /** + * A label starts with a combining mark. + * @stable ICU 4.6 + */ + UIDNA_ERROR_LEADING_COMBINING_MARK=0x40, + /** + * A label or domain name contains disallowed characters. + * @stable ICU 4.6 + */ + UIDNA_ERROR_DISALLOWED=0x80, + /** + * A label starts with "xn--" but does not contain valid Punycode. + * That is, an xn-- label failed Punycode decoding. + * @stable ICU 4.6 + */ + UIDNA_ERROR_PUNYCODE=0x100, + /** + * A label contains a dot=full stop. + * This can occur in an input string for a single-label function. + * @stable ICU 4.6 + */ + UIDNA_ERROR_LABEL_HAS_DOT=0x200, + /** + * An ACE label does not contain a valid label string. + * The label was successfully ACE (Punycode) decoded but the resulting + * string had severe validation errors. For example, + * it might contain characters that are not allowed in ACE labels, + * or it might not be normalized. + * @stable ICU 4.6 + */ + UIDNA_ERROR_INVALID_ACE_LABEL=0x400, + /** + * A label does not meet the IDNA BiDi requirements (for right-to-left characters). + * @stable ICU 4.6 + */ + UIDNA_ERROR_BIDI=0x800, + /** + * A label does not meet the IDNA CONTEXTJ requirements. + * @stable ICU 4.6 + */ + UIDNA_ERROR_CONTEXTJ=0x1000, + /** + * A label does not meet the IDNA CONTEXTO requirements for punctuation characters. + * Some punctuation characters "Would otherwise have been DISALLOWED" + * but are allowed in certain contexts. (RFC 5892) + * @stable ICU 49 + */ + UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000, + /** + * A label does not meet the IDNA CONTEXTO requirements for digits. + * Arabic-Indic Digits (U+066x) must not be mixed with Extended Arabic-Indic Digits (U+06Fx). + * @stable ICU 49 + */ + UIDNA_ERROR_CONTEXTO_DIGITS=0x4000 +}; + +#ifndef U_HIDE_DEPRECATED_API + +/* IDNA2003 API ------------------------------------------------------------- */ + +/** + * IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC. + * This operation is done on single labels before sending it to something that expects + * ASCII names. A label is an individual part of a domain name. Labels are usually + * separated by dots; e.g. "www.example.com" is composed of 3 labels "www","example", and "com". + * + * IDNA2003 API Overview: + * + * The uidna_ API implements the IDNA protocol as defined in the IDNA RFC + * (http://www.ietf.org/rfc/rfc3490.txt). + * The RFC defines 2 operations: ToASCII and ToUnicode. Domain name labels + * containing non-ASCII code points are processed by the + * ToASCII operation before passing it to resolver libraries. Domain names + * that are obtained from resolver libraries are processed by the + * ToUnicode operation before displaying the domain name to the user. + * IDNA requires that implementations process input strings with Nameprep + * (http://www.ietf.org/rfc/rfc3491.txt), + * which is a profile of Stringprep (http://www.ietf.org/rfc/rfc3454.txt), + * and then with Punycode (http://www.ietf.org/rfc/rfc3492.txt). + * Implementations of IDNA MUST fully implement Nameprep and Punycode; + * neither Nameprep nor Punycode are optional. + * The input and output of ToASCII and ToUnicode operations are Unicode + * and are designed to be chainable, i.e., applying ToASCII or ToUnicode operations + * multiple times to an input string will yield the same result as applying the operation + * once. + * ToUnicode(ToUnicode(ToUnicode...(ToUnicode(string)))) == ToUnicode(string) + * ToASCII(ToASCII(ToASCII...(ToASCII(string))) == ToASCII(string). + * + * @param src Input UChar array containing label in Unicode. + * @param srcLength Number of UChars in src, or -1 if NUL-terminated. + * @param dest Output UChar array with ASCII (ACE encoded) label. + * @param destCapacity Size of dest. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_ERROR error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_toASCII(const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status); + + +/** + * IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC. + * This operation is done on single labels before sending it to something that expects + * Unicode names. A label is an individual part of a domain name. Labels are usually + * separated by dots; for e.g. "www.example.com" is composed of 3 labels "www","example", and "com". + * + * @param src Input UChar array containing ASCII (ACE encoded) label. + * @param srcLength Number of UChars in src, or -1 if NUL-terminated. + * @param dest Output Converted UChar array containing Unicode equivalent of label. + * @param destCapacity Size of dest. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_ERROR error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. Note: This option is + * required on toUnicode operation because the RFC mandates + * verification of decoded ACE input by applying toASCII and comparing + * its output with source + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_toUnicode(const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status); + + +/** + * IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC. + * This operation is done on complete domain names, e.g: "www.example.com". + * It is important to note that this operation can fail. If it fails, then the input + * domain name cannot be used as an Internationalized Domain Name and the application + * should have methods defined to deal with the failure. + * + * Note: IDNA RFC specifies that a conformant application should divide a domain name + * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, + * and then convert. This function does not offer that level of granularity. The options once + * set will apply to all labels in the domain name + * + * @param src Input UChar array containing IDN in Unicode. + * @param srcLength Number of UChars in src, or -1 if NUL-terminated. + * @param dest Output UChar array with ASCII (ACE encoded) IDN. + * @param destCapacity Size of dest. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_CODE_POINT_FOUND error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_IDNToASCII( const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status); + +/** + * IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC. + * This operation is done on complete domain names, e.g: "www.example.com". + * + * Note: IDNA RFC specifies that a conformant application should divide a domain name + * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, + * and then convert. This function does not offer that level of granularity. The options once + * set will apply to all labels in the domain name + * + * @param src Input UChar array containing IDN in ASCII (ACE encoded) form. + * @param srcLength Number of UChars in src, or -1 if NUL-terminated. + * @param dest Output UChar array containing Unicode equivalent of source IDN. + * @param destCapacity Size of dest. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_CODE_POINT_FOUND error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_IDNToUnicode( const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status); + +/** + * IDNA2003: Compare two IDN strings for equivalence. + * This function splits the domain names into labels and compares them. + * According to IDN RFC, whenever two labels are compared, they are + * considered equal if and only if their ASCII forms (obtained by + * applying toASCII) match using an case-insensitive ASCII comparison. + * Two domain names are considered a match if and only if all labels + * match regardless of whether label separators match. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_CODE_POINT_FOUND error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param status ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return <0 or 0 or >0 as usual for string comparisons + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_compare( const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + int32_t options, + UErrorCode* status); + +#endif /* U_HIDE_DEPRECATED_API */ + +#endif /* #if !UCONFIG_NO_IDNA */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uiter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uiter.h new file mode 100644 index 0000000000000000000000000000000000000000..be232c774dc614e48fca28a002c5b95b3bd0e15c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uiter.h @@ -0,0 +1,709 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2011 International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uiter.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002jan18 +* created by: Markus W. Scherer +*/ + +#ifndef __UITER_H__ +#define __UITER_H__ + +/** + * \file + * \brief C API: Unicode Character Iteration + * + * @see UCharIterator + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + U_NAMESPACE_BEGIN + + class CharacterIterator; + class Replaceable; + + U_NAMESPACE_END +#endif + +U_CDECL_BEGIN + +struct UCharIterator; +typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @stable ICU 2.1 */ + +/** + * Origin constants for UCharIterator.getIndex() and UCharIterator.move(). + * @see UCharIteratorMove + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef enum UCharIteratorOrigin { + UITER_START, UITER_CURRENT, UITER_LIMIT, UITER_ZERO, UITER_LENGTH +} UCharIteratorOrigin; + +/** Constants for UCharIterator. @stable ICU 2.6 */ +enum { + /** + * Constant value that may be returned by UCharIteratorMove + * indicating that the final UTF-16 index is not known, but that the move succeeded. + * This can occur when moving relative to limit or length, or + * when moving relative to the current index after a setState() + * when the current UTF-16 index is not known. + * + * It would be very inefficient to have to count from the beginning of the text + * just to get the current/limit/length index after moving relative to it. + * The actual index can be determined with getIndex(UITER_CURRENT) + * which will count the UChars if necessary. + * + * @stable ICU 2.6 + */ + UITER_UNKNOWN_INDEX=-2 +}; + + +/** + * Constant for UCharIterator getState() indicating an error or + * an unknown state. + * Returned by uiter_getState()/UCharIteratorGetState + * when an error occurs. + * Also, some UCharIterator implementations may not be able to return + * a valid state for each position. This will be clearly documented + * for each such iterator (none of the public ones here). + * + * @stable ICU 2.6 + */ +#define UITER_NO_STATE ((uint32_t)0xffffffff) + +/** + * Function type declaration for UCharIterator.getIndex(). + * + * Gets the current position, or the start or limit of the + * iteration range. + * + * This function may perform slowly for UITER_CURRENT after setState() was called, + * or for UITER_LENGTH, because an iterator implementation may have to count + * UChars if the underlying storage is not UTF-16. + * + * @param iter the UCharIterator structure ("this pointer") + * @param origin get the 0, start, limit, length, or current index + * @return the requested index, or U_SENTINEL in an error condition + * + * @see UCharIteratorOrigin + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef int32_t U_CALLCONV +UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin); + +/** + * Function type declaration for UCharIterator.move(). + * + * Use iter->move(iter, index, UITER_ZERO) like CharacterIterator::setIndex(index). + * + * Moves the current position relative to the start or limit of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code units forward + * or backward by specifying a positive or negative delta. + * Out of bounds movement will be pinned to the start or limit. + * + * This function may perform slowly for moving relative to UITER_LENGTH + * because an iterator implementation may have to count the rest of the + * UChars if the native storage is not UTF-16. + * + * When moving relative to the limit or length, or + * relative to the current position after setState() was called, + * move() may return UITER_UNKNOWN_INDEX (-2) to avoid an inefficient + * determination of the actual UTF-16 index. + * The actual index can be determined with getIndex(UITER_CURRENT) + * which will count the UChars if necessary. + * See UITER_UNKNOWN_INDEX for details. + * + * @param iter the UCharIterator structure ("this pointer") + * @param delta can be positive, zero, or negative + * @param origin move relative to the 0, start, limit, length, or current index + * @return the new index, or U_SENTINEL on an error condition, + * or UITER_UNKNOWN_INDEX when the index is not known. + * + * @see UCharIteratorOrigin + * @see UCharIterator + * @see UITER_UNKNOWN_INDEX + * @stable ICU 2.1 + */ +typedef int32_t U_CALLCONV +UCharIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin); + +/** + * Function type declaration for UCharIterator.hasNext(). + * + * Check if current() and next() can still + * return another code unit. + * + * @param iter the UCharIterator structure ("this pointer") + * @return boolean value for whether current() and next() can still return another code unit + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UBool U_CALLCONV +UCharIteratorHasNext(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.hasPrevious(). + * + * Check if previous() can still return another code unit. + * + * @param iter the UCharIterator structure ("this pointer") + * @return boolean value for whether previous() can still return another code unit + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UBool U_CALLCONV +UCharIteratorHasPrevious(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.current(). + * + * Return the code unit at the current position, + * or U_SENTINEL if there is none (index is at the limit). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the current code unit + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UChar32 U_CALLCONV +UCharIteratorCurrent(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.next(). + * + * Return the code unit at the current index and increment + * the index (post-increment, like s[i++]), + * or return U_SENTINEL if there is none (index is at the limit). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the current code unit (and post-increment the current index) + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UChar32 U_CALLCONV +UCharIteratorNext(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.previous(). + * + * Decrement the index and return the code unit from there + * (pre-decrement, like s[--i]), + * or return U_SENTINEL if there is none (index is at the start). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the previous code unit (after pre-decrementing the current index) + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UChar32 U_CALLCONV +UCharIteratorPrevious(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.reservedFn(). + * Reserved for future use. + * + * @param iter the UCharIterator structure ("this pointer") + * @param something some integer argument + * @return some integer + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef int32_t U_CALLCONV +UCharIteratorReserved(UCharIterator *iter, int32_t something); + +/** + * Function type declaration for UCharIterator.getState(). + * + * Get the "state" of the iterator in the form of a single 32-bit word. + * It is recommended that the state value be calculated to be as small as + * is feasible. For strings with limited lengths, fewer than 32 bits may + * be sufficient. + * + * This is used together with setState()/UCharIteratorSetState + * to save and restore the iterator position more efficiently than with + * getIndex()/move(). + * + * The iterator state is defined as a uint32_t value because it is designed + * for use in ucol_nextSortKeyPart() which provides 32 bits to store the state + * of the character iterator. + * + * With some UCharIterator implementations (e.g., UTF-8), + * getting and setting the UTF-16 index with existing functions + * (getIndex(UITER_CURRENT) followed by move(pos, UITER_ZERO)) is possible but + * relatively slow because the iterator has to "walk" from a known index + * to the requested one. + * This takes more time the farther it needs to go. + * + * An opaque state value allows an iterator implementation to provide + * an internal index (UTF-8: the source byte array index) for + * fast, constant-time restoration. + * + * After calling setState(), a getIndex(UITER_CURRENT) may be slow because + * the UTF-16 index may not be restored as well, but the iterator can deliver + * the correct text contents and move relative to the current position + * without performance degradation. + * + * Some UCharIterator implementations may not be able to return + * a valid state for each position, in which case they return UITER_NO_STATE instead. + * This will be clearly documented for each such iterator (none of the public ones here). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the state word + * + * @see UCharIterator + * @see UCharIteratorSetState + * @see UITER_NO_STATE + * @stable ICU 2.6 + */ +typedef uint32_t U_CALLCONV +UCharIteratorGetState(const UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.setState(). + * + * Restore the "state" of the iterator using a state word from a getState() call. + * The iterator object need not be the same one as for which getState() was called, + * but it must be of the same type (set up using the same uiter_setXYZ function) + * and it must iterate over the same string + * (binary identical regardless of memory address). + * For more about the state word see UCharIteratorGetState. + * + * After calling setState(), a getIndex(UITER_CURRENT) may be slow because + * the UTF-16 index may not be restored as well, but the iterator can deliver + * the correct text contents and move relative to the current position + * without performance degradation. + * + * @param iter the UCharIterator structure ("this pointer") + * @param state the state word from a getState() call + * on a same-type, same-string iterator + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see UCharIterator + * @see UCharIteratorGetState + * @stable ICU 2.6 + */ +typedef void U_CALLCONV +UCharIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); + + +/** + * C API for code unit iteration. + * This can be used as a C wrapper around + * CharacterIterator, Replaceable, or implemented using simple strings, etc. + * + * There are two roles for using UCharIterator: + * + * A "provider" sets the necessary function pointers and controls the "protected" + * fields of the UCharIterator structure. A "provider" passes a UCharIterator + * into C APIs that need a UCharIterator as an abstract, flexible string interface. + * + * Implementations of such C APIs are "callers" of UCharIterator functions; + * they only use the "public" function pointers and never access the "protected" + * fields directly. + * + * The current() and next() functions only check the current index against the + * limit, and previous() only checks the current index against the start, + * to see if the iterator already reached the end of the iteration range. + * + * The assumption - in all iterators - is that the index is moved via the API, + * which means it won't go out of bounds, or the index is modified by + * user code that knows enough about the iterator implementation to set valid + * index values. + * + * UCharIterator functions return code unit values 0..0xffff, + * or U_SENTINEL if the iteration bounds are reached. + * + * @stable ICU 2.1 + */ +struct UCharIterator { + /** + * (protected) Pointer to string or wrapped object or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + const void *context; + + /** + * (protected) Length of string or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + int32_t length; + + /** + * (protected) Start index or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + int32_t start; + + /** + * (protected) Current index or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + int32_t index; + + /** + * (protected) Limit index or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + int32_t limit; + + /** + * (protected) Used by UTF-8 iterators and possibly others. + * @stable ICU 2.1 + */ + int32_t reservedField; + + /** + * (public) Returns the current position or the + * start or limit index of the iteration range. + * + * @see UCharIteratorGetIndex + * @stable ICU 2.1 + */ + UCharIteratorGetIndex *getIndex; + + /** + * (public) Moves the current position relative to the start or limit of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code units forward + * or backward by specifying a positive or negative delta. + * + * @see UCharIteratorMove + * @stable ICU 2.1 + */ + UCharIteratorMove *move; + + /** + * (public) Check if current() and next() can still + * return another code unit. + * + * @see UCharIteratorHasNext + * @stable ICU 2.1 + */ + UCharIteratorHasNext *hasNext; + + /** + * (public) Check if previous() can still return another code unit. + * + * @see UCharIteratorHasPrevious + * @stable ICU 2.1 + */ + UCharIteratorHasPrevious *hasPrevious; + + /** + * (public) Return the code unit at the current position, + * or U_SENTINEL if there is none (index is at the limit). + * + * @see UCharIteratorCurrent + * @stable ICU 2.1 + */ + UCharIteratorCurrent *current; + + /** + * (public) Return the code unit at the current index and increment + * the index (post-increment, like s[i++]), + * or return U_SENTINEL if there is none (index is at the limit). + * + * @see UCharIteratorNext + * @stable ICU 2.1 + */ + UCharIteratorNext *next; + + /** + * (public) Decrement the index and return the code unit from there + * (pre-decrement, like s[--i]), + * or return U_SENTINEL if there is none (index is at the start). + * + * @see UCharIteratorPrevious + * @stable ICU 2.1 + */ + UCharIteratorPrevious *previous; + + /** + * (public) Reserved for future use. Currently NULL. + * + * @see UCharIteratorReserved + * @stable ICU 2.1 + */ + UCharIteratorReserved *reservedFn; + + /** + * (public) Return the state of the iterator, to be restored later with setState(). + * This function pointer is NULL if the iterator does not implement it. + * + * @see UCharIteratorGet + * @stable ICU 2.6 + */ + UCharIteratorGetState *getState; + + /** + * (public) Restore the iterator state from the state word from a call + * to getState(). + * This function pointer is NULL if the iterator does not implement it. + * + * @see UCharIteratorSet + * @stable ICU 2.6 + */ + UCharIteratorSetState *setState; +}; + +/** + * Helper function for UCharIterator to get the code point + * at the current index. + * + * Return the code point that includes the code unit at the current position, + * or U_SENTINEL if there is none (index is at the limit). + * If the current code unit is a lead or trail surrogate, + * then the following or preceding surrogate is used to form + * the code point value. + * + * @param iter the UCharIterator structure ("this pointer") + * @return the current code point + * + * @see UCharIterator + * @see U16_GET + * @see UnicodeString::char32At() + * @stable ICU 2.1 + */ +U_CAPI UChar32 U_EXPORT2 +uiter_current32(UCharIterator *iter); + +/** + * Helper function for UCharIterator to get the next code point. + * + * Return the code point at the current index and increment + * the index (post-increment, like s[i++]), + * or return U_SENTINEL if there is none (index is at the limit). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the current code point (and post-increment the current index) + * + * @see UCharIterator + * @see U16_NEXT + * @stable ICU 2.1 + */ +U_CAPI UChar32 U_EXPORT2 +uiter_next32(UCharIterator *iter); + +/** + * Helper function for UCharIterator to get the previous code point. + * + * Decrement the index and return the code point from there + * (pre-decrement, like s[--i]), + * or return U_SENTINEL if there is none (index is at the start). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the previous code point (after pre-decrementing the current index) + * + * @see UCharIterator + * @see U16_PREV + * @stable ICU 2.1 + */ +U_CAPI UChar32 U_EXPORT2 +uiter_previous32(UCharIterator *iter); + +/** + * Get the "state" of the iterator in the form of a single 32-bit word. + * This is a convenience function that calls iter->getState(iter) + * if iter->getState is not NULL; + * if it is NULL or any other error occurs, then UITER_NO_STATE is returned. + * + * Some UCharIterator implementations may not be able to return + * a valid state for each position, in which case they return UITER_NO_STATE instead. + * This will be clearly documented for each such iterator (none of the public ones here). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the state word + * + * @see UCharIterator + * @see UCharIteratorGetState + * @see UITER_NO_STATE + * @stable ICU 2.6 + */ +U_CAPI uint32_t U_EXPORT2 +uiter_getState(const UCharIterator *iter); + +/** + * Restore the "state" of the iterator using a state word from a getState() call. + * This is a convenience function that calls iter->setState(iter, state, pErrorCode) + * if iter->setState is not NULL; if it is NULL, then U_UNSUPPORTED_ERROR is set. + * + * @param iter the UCharIterator structure ("this pointer") + * @param state the state word from a getState() call + * on a same-type, same-string iterator + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see UCharIterator + * @see UCharIteratorSetState + * @stable ICU 2.6 + */ +U_CAPI void U_EXPORT2 +uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); + +/** + * Set up a UCharIterator to iterate over a string. + * + * Sets the UCharIterator function pointers for iteration over the string s + * with iteration boundaries start=index=0 and length=limit=string length. + * The "provider" may set the start, index, and limit values at any time + * within the range 0..length. + * The length field will be ignored. + * + * The string pointer s is set into UCharIterator.context without copying + * or reallocating the string contents. + * + * getState() simply returns the current index. + * move() will always return the final index. + * + * @param iter UCharIterator structure to be set for iteration + * @param s String to iterate over + * @param length Length of s, or -1 if NUL-terminated + * + * @see UCharIterator + * @stable ICU 2.1 + */ +U_CAPI void U_EXPORT2 +uiter_setString(UCharIterator *iter, const UChar *s, int32_t length); + +/** + * Set up a UCharIterator to iterate over a UTF-16BE string + * (byte vector with a big-endian pair of bytes per UChar). + * + * Everything works just like with a normal UChar iterator (uiter_setString), + * except that UChars are assembled from byte pairs, + * and that the length argument here indicates an even number of bytes. + * + * getState() simply returns the current index. + * move() will always return the final index. + * + * @param iter UCharIterator structure to be set for iteration + * @param s UTF-16BE string to iterate over + * @param length Length of s as an even number of bytes, or -1 if NUL-terminated + * (NUL means pair of 0 bytes at even index from s) + * + * @see UCharIterator + * @see uiter_setString + * @stable ICU 2.6 + */ +U_CAPI void U_EXPORT2 +uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length); + +/** + * Set up a UCharIterator to iterate over a UTF-8 string. + * + * Sets the UCharIterator function pointers for iteration over the UTF-8 string s + * with UTF-8 iteration boundaries 0 and length. + * The implementation counts the UTF-16 index on the fly and + * lazily evaluates the UTF-16 length of the text. + * + * The start field is used as the UTF-8 offset, the limit field as the UTF-8 length. + * When the reservedField is not 0, then it contains a supplementary code point + * and the UTF-16 index is between the two corresponding surrogates. + * At that point, the UTF-8 index is behind that code point. + * + * The UTF-8 string pointer s is set into UCharIterator.context without copying + * or reallocating the string contents. + * + * getState() returns a state value consisting of + * - the current UTF-8 source byte index (bits 31..1) + * - a flag (bit 0) that indicates whether the UChar position is in the middle + * of a surrogate pair + * (from a 4-byte UTF-8 sequence for the corresponding supplementary code point) + * + * getState() cannot also encode the UTF-16 index in the state value. + * move(relative to limit or length), or + * move(relative to current) after setState(), may return UITER_UNKNOWN_INDEX. + * + * @param iter UCharIterator structure to be set for iteration + * @param s UTF-8 string to iterate over + * @param length Length of s in bytes, or -1 if NUL-terminated + * + * @see UCharIterator + * @stable ICU 2.6 + */ +U_CAPI void U_EXPORT2 +uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length); + +#if U_SHOW_CPLUSPLUS_API + +/** + * Set up a UCharIterator to wrap around a C++ CharacterIterator. + * + * Sets the UCharIterator function pointers for iteration using the + * CharacterIterator charIter. + * + * The CharacterIterator pointer charIter is set into UCharIterator.context + * without copying or cloning the CharacterIterator object. + * The other "protected" UCharIterator fields are set to 0 and will be ignored. + * The iteration index and boundaries are controlled by the CharacterIterator. + * + * getState() simply returns the current index. + * move() will always return the final index. + * + * @param iter UCharIterator structure to be set for iteration + * @param charIter CharacterIterator to wrap + * + * @see UCharIterator + * @stable ICU 2.1 + */ +U_CAPI void U_EXPORT2 +uiter_setCharacterIterator(UCharIterator *iter, icu::CharacterIterator *charIter); + +/** + * Set up a UCharIterator to iterate over a C++ Replaceable. + * + * Sets the UCharIterator function pointers for iteration over the + * Replaceable rep with iteration boundaries start=index=0 and + * length=limit=rep->length(). + * The "provider" may set the start, index, and limit values at any time + * within the range 0..length=rep->length(). + * The length field will be ignored. + * + * The Replaceable pointer rep is set into UCharIterator.context without copying + * or cloning/reallocating the Replaceable object. + * + * getState() simply returns the current index. + * move() will always return the final index. + * + * @param iter UCharIterator structure to be set for iteration + * @param rep Replaceable to iterate over + * + * @see UCharIterator + * @stable ICU 2.1 + */ +U_CAPI void U_EXPORT2 +uiter_setReplaceable(UCharIterator *iter, const icu::Replaceable *rep); + +#endif + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uldnames.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uldnames.h new file mode 100644 index 0000000000000000000000000000000000000000..47b047ece97b80fcb5a2e2629633e96b68e9b3f7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uldnames.h @@ -0,0 +1,307 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2016, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +*/ + +#ifndef __ULDNAMES_H__ +#define __ULDNAMES_H__ + +/** + * \file + * \brief C API: Provides display names of Locale ids and their components. + */ + +#include "unicode/utypes.h" +#include "unicode/uscript.h" +#include "unicode/udisplaycontext.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * Enum used in LocaleDisplayNames::createInstance. + * @stable ICU 4.4 + */ +typedef enum { + /** + * Use standard names when generating a locale name, + * e.g. en_GB displays as 'English (United Kingdom)'. + * @stable ICU 4.4 + */ + ULDN_STANDARD_NAMES = 0, + /** + * Use dialect names, when generating a locale name, + * e.g. en_GB displays as 'British English'. + * @stable ICU 4.4 + */ + ULDN_DIALECT_NAMES +} UDialectHandling; + +/** + * Opaque C service object type for the locale display names API + * @stable ICU 4.4 + */ +struct ULocaleDisplayNames; + +/** + * C typedef for struct ULocaleDisplayNames. + * @stable ICU 4.4 + */ +typedef struct ULocaleDisplayNames ULocaleDisplayNames; + +#if !UCONFIG_NO_FORMATTING + +/** + * Returns an instance of LocaleDisplayNames that returns names + * formatted for the provided locale, using the provided + * dialectHandling. The usual value for dialectHandling is + * ULOC_STANDARD_NAMES. + * + * @param locale the display locale + * @param dialectHandling how to select names for locales + * @return a ULocaleDisplayNames instance + * @param pErrorCode the status code + * @stable ICU 4.4 + */ +U_CAPI ULocaleDisplayNames * U_EXPORT2 +uldn_open(const char * locale, + UDialectHandling dialectHandling, + UErrorCode *pErrorCode); + +/** + * Closes a ULocaleDisplayNames instance obtained from uldn_open(). + * @param ldn the ULocaleDisplayNames instance to be closed + * @stable ICU 4.4 + */ +U_CAPI void U_EXPORT2 +uldn_close(ULocaleDisplayNames *ldn); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalULocaleDisplayNamesPointer + * "Smart pointer" class, closes a ULocaleDisplayNames via uldn_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDisplayNamesPointer, ULocaleDisplayNames, uldn_close); + +U_NAMESPACE_END + +#endif + +/* getters for state */ + +/** + * Returns the locale used to determine the display names. This is + * not necessarily the same locale passed to {@link #uldn_open}. + * @param ldn the LocaleDisplayNames instance + * @return the display locale + * @stable ICU 4.4 + */ +U_CAPI const char * U_EXPORT2 +uldn_getLocale(const ULocaleDisplayNames *ldn); + +/** + * Returns the dialect handling used in the display names. + * @param ldn the LocaleDisplayNames instance + * @return the dialect handling enum + * @stable ICU 4.4 + */ +U_CAPI UDialectHandling U_EXPORT2 +uldn_getDialectHandling(const ULocaleDisplayNames *ldn); + +/* names for entire locales */ + +/** + * Returns the display name of the provided locale. + * @param ldn the LocaleDisplayNames instance + * @param locale the locale whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +uldn_localeDisplayName(const ULocaleDisplayNames *ldn, + const char *locale, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/* names for components of a locale */ + +/** + * Returns the display name of the provided language code. + * @param ldn the LocaleDisplayNames instance + * @param lang the language code whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +uldn_languageDisplayName(const ULocaleDisplayNames *ldn, + const char *lang, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided script. + * @param ldn the LocaleDisplayNames instance + * @param script the script whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +uldn_scriptDisplayName(const ULocaleDisplayNames *ldn, + const char *script, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided script code. + * @param ldn the LocaleDisplayNames instance + * @param scriptCode the script code whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn, + UScriptCode scriptCode, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided region code. + * @param ldn the LocaleDisplayNames instance + * @param region the region code whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +uldn_regionDisplayName(const ULocaleDisplayNames *ldn, + const char *region, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided variant + * @param ldn the LocaleDisplayNames instance + * @param variant the variant whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +uldn_variantDisplayName(const ULocaleDisplayNames *ldn, + const char *variant, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided locale key + * @param ldn the LocaleDisplayNames instance + * @param key the locale key whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +uldn_keyDisplayName(const ULocaleDisplayNames *ldn, + const char *key, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided value (used with the provided key). + * @param ldn the LocaleDisplayNames instance + * @param key the locale key + * @param value the locale key's value + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn, + const char *key, + const char *value, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** +* Returns an instance of LocaleDisplayNames that returns names formatted +* for the provided locale, using the provided UDisplayContext settings. +* +* @param locale The display locale +* @param contexts List of one or more context settings (e.g. for dialect +* handling, capitalization, etc. +* @param length Number of items in the contexts list +* @param pErrorCode Pointer to UErrorCode input/output status. If at entry this indicates +* a failure status, the function will do nothing; otherwise this will be +* updated with any new status from the function. +* @return a ULocaleDisplayNames instance +* @stable ICU 51 +*/ +U_CAPI ULocaleDisplayNames * U_EXPORT2 +uldn_openForContext(const char * locale, UDisplayContext *contexts, + int32_t length, UErrorCode *pErrorCode); + +/** +* Returns the UDisplayContext value for the specified UDisplayContextType. +* @param ldn the ULocaleDisplayNames instance +* @param type the UDisplayContextType whose value to return +* @param pErrorCode Pointer to UErrorCode input/output status. If at entry this indicates +* a failure status, the function will do nothing; otherwise this will be +* updated with any new status from the function. +* @return the UDisplayContextValue for the specified type. +* @stable ICU 51 +*/ +U_CAPI UDisplayContext U_EXPORT2 +uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type, + UErrorCode *pErrorCode); + +#endif /* !UCONFIG_NO_FORMATTING */ +#endif /* __ULDNAMES_H__ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uloc.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uloc.h new file mode 100644 index 0000000000000000000000000000000000000000..3addb847e7fe6f822ac325314ae2214d18af035e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uloc.h @@ -0,0 +1,1393 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File ULOC.H +* +* Modification History: +* +* Date Name Description +* 04/01/97 aliu Creation. +* 08/22/98 stephen JDK 1.2 sync. +* 12/08/98 rtg New C API for Locale +* 03/30/99 damiba overhaul +* 03/31/99 helena Javadoc for uloc functions. +* 04/15/99 Madhu Updated Javadoc +******************************************************************************** +*/ + +#ifndef ULOC_H +#define ULOC_H + +#include "unicode/utypes.h" +#include "unicode/uenum.h" + +/** + * \file + * \brief C API: Locale + * + *

ULoc C API for Locale

+ * A Locale represents a specific geographical, political, + * or cultural region. An operation that requires a Locale to perform + * its task is called locale-sensitive and uses the Locale + * to tailor information for the user. For example, displaying a number + * is a locale-sensitive operation--the number should be formatted + * according to the customs/conventions of the user's native country, + * region, or culture. In the C APIs, a locales is simply a const char string. + * + *

+ * You create a Locale with one of the three options listed below. + * Each of the component is separated by '_' in the locale string. + * \htmlonly

\endhtmlonly + *
+ * \code
+ *       newLanguage
+ * 
+ *       newLanguage + newCountry
+ * 
+ *       newLanguage + newCountry + newVariant
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * The first option is a valid ISO + * Language Code. These codes are the lower-case two-letter + * codes as defined by ISO-639. + * You can find a full list of these codes at a number of sites, such as: + *
+ * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt + * + *

+ * The second option includes an additional ISO Country + * Code. These codes are the upper-case two-letter codes + * as defined by ISO-3166. + * You can find a full list of these codes at a number of sites, such as: + *
+ * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html + * + *

+ * The third option requires another additional information--the + * Variant. + * The Variant codes are vendor and browser-specific. + * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. + * Where there are two variants, separate them with an underscore, and + * put the most important one first. For + * example, a Traditional Spanish collation might be referenced, with + * "ES", "ES", "Traditional_WIN". + * + *

+ * Because a Locale is just an identifier for a region, + * no validity check is performed when you specify a Locale. + * If you want to see whether particular resources are available for the + * Locale you asked for, you must query those resources. For + * example, ask the UNumberFormat for the locales it supports + * using its getAvailable method. + *
Note: When you ask for a resource for a particular + * locale, you get back the best available match, not necessarily + * precisely what you asked for. For more information, look at + * UResourceBundle. + * + *

+ * The Locale provides a number of convenient constants + * that you can use to specify the commonly used + * locales. For example, the following refers to a locale + * for the United States: + * \htmlonly

\endhtmlonly + *
+ * \code
+ *       ULOC_US
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * + *

+ * Once you've specified a locale you can query it for information about + * itself. Use uloc_getCountry to get the ISO Country Code and + * uloc_getLanguage to get the ISO Language Code. You can + * use uloc_getDisplayCountry to get the + * name of the country suitable for displaying to the user. Similarly, + * you can use uloc_getDisplayLanguage to get the name of + * the language suitable for displaying to the user. Interestingly, + * the uloc_getDisplayXXX methods are themselves locale-sensitive + * and have two versions: one that uses the default locale and one + * that takes a locale as an argument and displays the name or country in + * a language appropriate to that locale. + * + *

+ * The ICU provides a number of services that perform locale-sensitive + * operations. For example, the unum_xxx functions format + * numbers, currency, or percentages in a locale-sensitive manner. + *

+ * \htmlonly
\endhtmlonly + *
+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     UNumberFormat *nf;
+ *     const char* myLocale = "fr_FR";
+ * 
+ *     nf = unum_open( UNUM_DEFAULT, NULL, success );          
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_CURRENCY, NULL, success );
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_PERCENT, NULL, success );   
+ *     unum_close(nf);
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * Each of these methods has two variants; one with an explicit locale + * and one without; the latter using the default locale. + * \htmlonly
\endhtmlonly + *
+ * \code 
+ * 
+ *     nf = unum_open( UNUM_DEFAULT, myLocale, success );          
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_CURRENCY, myLocale, success );
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_PERCENT, myLocale, success );   
+ *     unum_close(nf);
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * A Locale is the mechanism for identifying the kind of services + * (UNumberFormat) that you would like to get. The locale is + * just a mechanism for identifying these services. + * + *

+ * Each international service that performs locale-sensitive operations + * allows you + * to get all the available objects of that type. You can sift + * through these objects by language, country, or variant, + * and use the display names to present a menu to the user. + * For example, you can create a menu of all the collation objects + * suitable for a given language. Such classes implement these + * three class methods: + * \htmlonly

\endhtmlonly + *
+ * \code
+ *       const char* uloc_getAvailable(int32_t index);
+ *       int32_t uloc_countAvailable();
+ *       int32_t
+ *       uloc_getDisplayName(const char* localeID,
+ *                 const char* inLocaleID, 
+ *                 UChar* result,
+ *                 int32_t maxResultSize,
+ *                  UErrorCode* err);
+ * 
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + *

+ * Concerning POSIX/RFC1766 Locale IDs, + * the getLanguage/getCountry/getVariant/getName functions do understand + * the POSIX type form of language_COUNTRY.ENCODING\@VARIANT + * and if there is not an ICU-stype variant, uloc_getVariant() for example + * will return the one listed after the \@at sign. As well, the hyphen + * "-" is recognized as a country/variant separator similarly to RFC1766. + * So for example, "en-us" will be interpreted as en_US. + * As a result, uloc_getName() is far from a no-op, and will have the + * effect of converting POSIX/RFC1766 IDs into ICU form, although it does + * NOT map any of the actual codes (i.e. russian->ru) in any way. + * Applications should call uloc_getName() at the point where a locale ID + * is coming from an external source (user entry, OS, web browser) + * and pass the resulting string to other ICU functions. For example, + * don't use de-de\@EURO as an argument to resourcebundle. + * + * @see UResourceBundle + */ + +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_CHINESE "zh" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_ENGLISH "en" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_FRENCH "fr" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_GERMAN "de" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_ITALIAN "it" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_JAPANESE "ja" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_KOREAN "ko" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_SIMPLIFIED_CHINESE "zh_CN" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_TRADITIONAL_CHINESE "zh_TW" + +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_CANADA "en_CA" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_CANADA_FRENCH "fr_CA" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_CHINA "zh_CN" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_PRC "zh_CN" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_FRANCE "fr_FR" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_GERMANY "de_DE" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_ITALY "it_IT" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_JAPAN "ja_JP" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_KOREA "ko_KR" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_TAIWAN "zh_TW" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_UK "en_GB" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_US "en_US" + +/** + * Useful constant for the maximum size of the language part of a locale ID. + * (including the terminating NULL). + * @stable ICU 2.0 + */ +#define ULOC_LANG_CAPACITY 12 + +/** + * Useful constant for the maximum size of the country part of a locale ID + * (including the terminating NULL). + * @stable ICU 2.0 + */ +#define ULOC_COUNTRY_CAPACITY 4 +/** + * Useful constant for the maximum size of the whole locale ID + * (including the terminating NULL and all keywords). + * @stable ICU 2.0 + */ +#define ULOC_FULLNAME_CAPACITY 157 + +/** + * Useful constant for the maximum size of the script part of a locale ID + * (including the terminating NULL). + * @stable ICU 2.8 + */ +#define ULOC_SCRIPT_CAPACITY 6 + +/** + * Useful constant for the maximum size of keywords in a locale + * @stable ICU 2.8 + */ +#define ULOC_KEYWORDS_CAPACITY 96 + +/** + * Useful constant for the maximum total size of keywords and their values in a locale + * @stable ICU 2.8 + */ +#define ULOC_KEYWORD_AND_VALUES_CAPACITY 100 + +/** + * Invariant character separating keywords from the locale string + * @stable ICU 2.8 + */ +#define ULOC_KEYWORD_SEPARATOR '@' + +/** + * Unicode code point for '@' separating keywords from the locale string. + * @see ULOC_KEYWORD_SEPARATOR + * @stable ICU 4.6 + */ +#define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40 + +/** + * Invariant character for assigning value to a keyword + * @stable ICU 2.8 + */ +#define ULOC_KEYWORD_ASSIGN '=' + +/** + * Unicode code point for '=' for assigning value to a keyword. + * @see ULOC_KEYWORD_ASSIGN + * @stable ICU 4.6 + */ +#define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D + +/** + * Invariant character separating keywords + * @stable ICU 2.8 + */ +#define ULOC_KEYWORD_ITEM_SEPARATOR ';' + +/** + * Unicode code point for ';' separating keywords + * @see ULOC_KEYWORD_ITEM_SEPARATOR + * @stable ICU 4.6 + */ +#define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B + +/** + * Constants for *_getLocale() + * Allow user to select whether she wants information on + * requested, valid or actual locale. + * For example, a collator for "en_US_CALIFORNIA" was + * requested. In the current state of ICU (2.0), + * the requested locale is "en_US_CALIFORNIA", + * the valid locale is "en_US" (most specific locale supported by ICU) + * and the actual locale is "root" (the collation data comes unmodified + * from the UCA) + * The locale is considered supported by ICU if there is a core ICU bundle + * for that locale (although it may be empty). + * @stable ICU 2.1 + */ +typedef enum { + /** This is locale the data actually comes from + * @stable ICU 2.1 + */ + ULOC_ACTUAL_LOCALE = 0, + /** This is the most specific locale supported by ICU + * @stable ICU 2.1 + */ + ULOC_VALID_LOCALE = 1, + +#ifndef U_HIDE_DEPRECATED_API + /** This is the requested locale + * @deprecated ICU 2.8 + */ + ULOC_REQUESTED_LOCALE = 2, + + /** + * One more than the highest normal ULocDataLocaleType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + ULOC_DATA_LOCALE_TYPE_LIMIT = 3 +#endif // U_HIDE_DEPRECATED_API +} ULocDataLocaleType; + +#ifndef U_HIDE_SYSTEM_API +/** + * Gets ICU's default locale. + * The returned string is a snapshot in time, and will remain valid + * and unchanged even when uloc_setDefault() is called. + * The returned storage is owned by ICU, and must not be altered or deleted + * by the caller. + * + * @return the ICU default locale + * @system + * @stable ICU 2.0 + */ +U_CAPI const char* U_EXPORT2 +uloc_getDefault(void); + +/** + * Sets ICU's default locale. + * By default (without calling this function), ICU's default locale will be based + * on information obtained from the underlying system environment. + *

+ * Changes to ICU's default locale do not propagate back to the + * system environment. + *

+ * Changes to ICU's default locale to not affect any ICU services that + * may already be open based on the previous default locale value. + * + * @param localeID the new ICU default locale. A value of NULL will try to get + * the system's default locale. + * @param status the error information if the setting of default locale fails + * @system + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +uloc_setDefault(const char* localeID, + UErrorCode* status); +#endif /* U_HIDE_SYSTEM_API */ + +/** + * Gets the language code for the specified locale. + * + * @param localeID the locale to get the ISO language code with + * @param language the language code for localeID + * @param languageCapacity the size of the language buffer to store the + * language code with + * @param err error information if retrieving the language code failed + * @return the actual buffer size needed for the language code. If it's greater + * than languageCapacity, the returned language code will be truncated. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getLanguage(const char* localeID, + char* language, + int32_t languageCapacity, + UErrorCode* err); + +/** + * Gets the script code for the specified locale. + * + * @param localeID the locale to get the ISO language code with + * @param script the language code for localeID + * @param scriptCapacity the size of the language buffer to store the + * language code with + * @param err error information if retrieving the language code failed + * @return the actual buffer size needed for the language code. If it's greater + * than scriptCapacity, the returned language code will be truncated. + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getScript(const char* localeID, + char* script, + int32_t scriptCapacity, + UErrorCode* err); + +/** + * Gets the country code for the specified locale. + * + * @param localeID the locale to get the country code with + * @param country the country code for localeID + * @param countryCapacity the size of the country buffer to store the + * country code with + * @param err error information if retrieving the country code failed + * @return the actual buffer size needed for the country code. If it's greater + * than countryCapacity, the returned country code will be truncated. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getCountry(const char* localeID, + char* country, + int32_t countryCapacity, + UErrorCode* err); + +/** + * Gets the variant code for the specified locale. + * + * @param localeID the locale to get the variant code with + * @param variant the variant code for localeID + * @param variantCapacity the size of the variant buffer to store the + * variant code with + * @param err error information if retrieving the variant code failed + * @return the actual buffer size needed for the variant code. If it's greater + * than variantCapacity, the returned variant code will be truncated. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getVariant(const char* localeID, + char* variant, + int32_t variantCapacity, + UErrorCode* err); + + +/** + * Gets the full name for the specified locale. + * Note: This has the effect of 'canonicalizing' the ICU locale ID to + * a certain extent. Upper and lower case are set as needed. + * It does NOT map aliased names in any way. + * See the top of this header file. + * This API supports preflighting. + * + * @param localeID the locale to get the full name with + * @param name fill in buffer for the name without keywords. + * @param nameCapacity capacity of the fill in buffer. + * @param err error information if retrieving the full name failed + * @return the actual buffer size needed for the full name. If it's greater + * than nameCapacity, the returned full name will be truncated. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getName(const char* localeID, + char* name, + int32_t nameCapacity, + UErrorCode* err); + +/** + * Gets the full name for the specified locale. + * Note: This has the effect of 'canonicalizing' the string to + * a certain extent. Upper and lower case are set as needed, + * and if the components were in 'POSIX' format they are changed to + * ICU format. It does NOT map aliased names in any way. + * See the top of this header file. + * + * @param localeID the locale to get the full name with + * @param name the full name for localeID + * @param nameCapacity the size of the name buffer to store the + * full name with + * @param err error information if retrieving the full name failed + * @return the actual buffer size needed for the full name. If it's greater + * than nameCapacity, the returned full name will be truncated. + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +uloc_canonicalize(const char* localeID, + char* name, + int32_t nameCapacity, + UErrorCode* err); + +/** + * Gets the ISO language code for the specified locale. + * + * @param localeID the locale to get the ISO language code with + * @return language the ISO language code for localeID + * @stable ICU 2.0 + */ +U_CAPI const char* U_EXPORT2 +uloc_getISO3Language(const char* localeID); + + +/** + * Gets the ISO country code for the specified locale. + * + * @param localeID the locale to get the ISO country code with + * @return country the ISO country code for localeID + * @stable ICU 2.0 + */ +U_CAPI const char* U_EXPORT2 +uloc_getISO3Country(const char* localeID); + +/** + * Gets the Win32 LCID value for the specified locale. + * If the ICU locale is not recognized by Windows, 0 will be returned. + * + * LCIDs were deprecated with Windows Vista and Microsoft recommends + * that developers use BCP47 style tags instead (uloc_toLanguageTag). + * + * @param localeID the locale to get the Win32 LCID value with + * @return country the Win32 LCID for localeID + * @stable ICU 2.0 + */ +U_CAPI uint32_t U_EXPORT2 +uloc_getLCID(const char* localeID); + +/** + * Gets the language name suitable for display for the specified locale. + * + * @param locale the locale to get the ISO language code with + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "Anglais", + * while passing Locale::getGerman() for inLocale would result + * in "Englisch". + * @param language the displayable language code for localeID + * @param languageCapacity the size of the language buffer to store the + * displayable language code with. + * @param status error information if retrieving the displayable language code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * language code is placed into language as fallback. + * @return the actual buffer size needed for the displayable language code. If + * it's greater than languageCapacity, the returned language + * code will be truncated. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getDisplayLanguage(const char* locale, + const char* displayLocale, + UChar* language, + int32_t languageCapacity, + UErrorCode* status); + +/** + * Gets the script name suitable for display for the specified locale. + * + * @param locale the locale to get the displayable script code with. NULL may be + * used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "", while + * passing Locale::getGerman() for inLocale would result in "". + * NULL may be used to specify the default. + * @param script the displayable script for the localeID. + * @param scriptCapacity the size of the script buffer to store the displayable + * script code with. + * @param status error information if retrieving the displayable script code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * script code is placed into script as fallback. + * @return the actual buffer size needed for the displayable script code. If + * it's greater than scriptCapacity, the returned displayable + * script code will be truncated. + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getDisplayScript(const char* locale, + const char* displayLocale, + UChar* script, + int32_t scriptCapacity, + UErrorCode* status); + +/** + * Gets the country name suitable for display for the specified locale. + * Warning: this is for the region part of a valid locale ID; it cannot just be + * the region code (like "FR"). To get the display name for a region alone, or + * for other options, use ULocaleDisplayNames instead. + * + * @param locale the locale to get the displayable country code with. NULL may + * be used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "Anglais", + * while passing Locale::getGerman() for inLocale would result + * in "Englisch". NULL may be used to specify the default. + * @param country the displayable country code for localeID. + * @param countryCapacity the size of the country buffer to store the + * displayable country code with. + * @param status error information if retrieving the displayable country code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * country code is placed into country as fallback. + * @return the actual buffer size needed for the displayable country code. If + * it's greater than countryCapacity, the returned displayable + * country code will be truncated. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getDisplayCountry(const char* locale, + const char* displayLocale, + UChar* country, + int32_t countryCapacity, + UErrorCode* status); + + +/** + * Gets the variant name suitable for display for the specified locale. + * + * @param locale the locale to get the displayable variant code with. NULL may + * be used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "Anglais", + * while passing Locale::getGerman() for inLocale would result + * in "Englisch". NULL may be used to specify the default. + * @param variant the displayable variant code for localeID. + * @param variantCapacity the size of the variant buffer to store the + * displayable variant code with. + * @param status error information if retrieving the displayable variant code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * variant code is placed into variant as fallback. + * @return the actual buffer size needed for the displayable variant code. If + * it's greater than variantCapacity, the returned displayable + * variant code will be truncated. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getDisplayVariant(const char* locale, + const char* displayLocale, + UChar* variant, + int32_t variantCapacity, + UErrorCode* status); + +/** + * Gets the keyword name suitable for display for the specified locale. E.g: + * for the locale string de_DE\@collation=PHONEBOOK, this API gets the display + * string for the keyword collation. + * Usage: + * + * UErrorCode status = U_ZERO_ERROR; + * const char* keyword =NULL; + * int32_t keywordLen = 0; + * int32_t keywordCount = 0; + * UChar displayKeyword[256]; + * int32_t displayKeywordLen = 0; + * UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status); + * for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){ + * if(U_FAILURE(status)){ + * ...something went wrong so handle the error... + * break; + * } + * // the uenum_next returns NUL terminated string + * keyword = uenum_next(keywordEnum, &keywordLen, &status); + * displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256); + * ... do something interesting ..... + * } + * uenum_close(keywordEnum); + * + * @param keyword The keyword whose display string needs to be returned. + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "Anglais", while passing Locale::getGerman() + * for inLocale would result in "Englisch". NULL may be used to specify the default. + * @param dest the buffer to which the displayable keyword should be written. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param status error information if retrieving the displayable string failed. + * Should not be NULL and should not indicate failure on entry. + * U_USING_DEFAULT_WARNING indicates that no data was found from the locale + * resources and the keyword is placed into dest as fallback. + * @return the actual buffer size needed for the displayable variant code. + * @see #uloc_openKeywords + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getDisplayKeyword(const char* keyword, + const char* displayLocale, + UChar* dest, + int32_t destCapacity, + UErrorCode* status); +/** + * Gets the value of the keyword suitable for display for the specified locale. + * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display + * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword. + * + * @param locale The locale to get the displayable variant code with. NULL may be used to specify the default. + * @param keyword The keyword for whose value should be used. + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "Anglais", while passing Locale::getGerman() + * for inLocale would result in "Englisch". NULL may be used to specify the default. + * @param dest the buffer to which the displayable keyword should be written. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param status error information if retrieving the displayable string failed. + * Should not be NULL and must not indicate failure on entry. + * U_USING_DEFAULT_WARNING indicates that no data was found from the locale + * resources and the value of the keyword is placed into dest as fallback. + * @return the actual buffer size needed for the displayable variant code. + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getDisplayKeywordValue( const char* locale, + const char* keyword, + const char* displayLocale, + UChar* dest, + int32_t destCapacity, + UErrorCode* status); +/** + * Gets the full name suitable for display for the specified locale. + * + * @param localeID the locale to get the displayable name with. NULL may be used to specify the default. + * @param inLocaleID Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "Anglais", while passing Locale::getGerman() + * for inLocale would result in "Englisch". NULL may be used to specify the default. + * @param result the displayable name for localeID + * @param maxResultSize the size of the name buffer to store the + * displayable full name with + * @param err error information if retrieving the displayable name failed + * @return the actual buffer size needed for the displayable name. If it's greater + * than maxResultSize, the returned displayable name will be truncated. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getDisplayName(const char* localeID, + const char* inLocaleID, + UChar* result, + int32_t maxResultSize, + UErrorCode* err); + + +/** + * Gets the specified locale from a list of available locales. + * + * This method corresponds to uloc_openAvailableByType called with the + * ULOC_AVAILABLE_DEFAULT type argument. + * + * The return value is a pointer to an item of a locale name array. Both this + * array and the pointers it contains are owned by ICU and should not be + * deleted or written through by the caller. The locale name is terminated by + * a null pointer. + * + * @param n the specific locale name index of the available locale list; + * should not exceed the number returned by uloc_countAvailable. + * @return a specified locale name of all available locales + * @stable ICU 2.0 + */ +U_CAPI const char* U_EXPORT2 +uloc_getAvailable(int32_t n); + +/** + * Gets the size of the all available locale list. + * + * @return the size of the locale list + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 uloc_countAvailable(void); + +/** + * Types for uloc_getAvailableByType and uloc_countAvailableByType. + * + * @stable ICU 65 + */ +typedef enum ULocAvailableType { + /** + * Locales that return data when passed to ICU APIs, + * but not including legacy or alias locales. + * + * @stable ICU 65 + */ + ULOC_AVAILABLE_DEFAULT, + + /** + * Legacy or alias locales that return data when passed to ICU APIs. + * Examples of supported legacy or alias locales: + * + * - iw (alias to he) + * - mo (alias to ro) + * - zh_CN (alias to zh_Hans_CN) + * - sr_BA (alias to sr_Cyrl_BA) + * - ars (alias to ar_SA) + * + * The locales in this set are disjoint from the ones in + * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use + * ULOC_AVAILABLE_WITH_LEGACY_ALIASES. + * + * @stable ICU 65 + */ + ULOC_AVAILABLE_ONLY_LEGACY_ALIASES, + + /** + * The union of the locales in ULOC_AVAILABLE_DEFAULT and + * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS. + * + * @stable ICU 65 + */ + ULOC_AVAILABLE_WITH_LEGACY_ALIASES, + +#ifndef U_HIDE_INTERNAL_API + /** + * @internal + */ + ULOC_AVAILABLE_COUNT +#endif +} ULocAvailableType; + +/** + * Gets a list of available locales according to the type argument, allowing + * the user to access different sets of supported locales in ICU. + * + * The returned UEnumeration must be closed by the caller. + * + * @param type Type choice from ULocAvailableType. + * @param status Set if an error occurred. + * @return a UEnumeration owned by the caller, or nullptr on failure. + * @stable ICU 65 + */ +U_CAPI UEnumeration* U_EXPORT2 +uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status); + +/** + * + * Gets a list of all available 2-letter language codes defined in ISO 639, + * plus additional 3-letter codes determined to be useful for locale generation as + * defined by Unicode CLDR. This is a pointer + * to an array of pointers to arrays of char. All of these pointers are owned + * by ICU-- do not delete them, and do not write through them. The array is + * terminated with a null pointer. + * @return a list of all available language codes + * @stable ICU 2.0 + */ +U_CAPI const char* const* U_EXPORT2 +uloc_getISOLanguages(void); + +/** + * + * Gets a list of all available 2-letter country codes defined in ISO 639. This is a + * pointer to an array of pointers to arrays of char. All of these pointers are + * owned by ICU-- do not delete them, and do not write through them. The array is + * terminated with a null pointer. + * @return a list of all available country codes + * @stable ICU 2.0 + */ +U_CAPI const char* const* U_EXPORT2 +uloc_getISOCountries(void); + +/** + * Truncate the locale ID string to get the parent locale ID. + * Copies the part of the string before the last underscore. + * The parent locale ID will be an empty string if there is no + * underscore, or if there is only one underscore at localeID[0]. + * + * @param localeID Input locale ID string. + * @param parent Output string buffer for the parent locale ID. + * @param parentCapacity Size of the output buffer. + * @param err A UErrorCode value. + * @return The length of the parent locale ID. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getParent(const char* localeID, + char* parent, + int32_t parentCapacity, + UErrorCode* err); + + + + +/** + * Gets the full name for the specified locale, like uloc_getName(), + * but without keywords. + * + * Note: This has the effect of 'canonicalizing' the string to + * a certain extent. Upper and lower case are set as needed, + * and if the components were in 'POSIX' format they are changed to + * ICU format. It does NOT map aliased names in any way. + * See the top of this header file. + * + * This API strips off the keyword part, so "de_DE\@collation=phonebook" + * will become "de_DE". + * This API supports preflighting. + * + * @param localeID the locale to get the full name with + * @param name fill in buffer for the name without keywords. + * @param nameCapacity capacity of the fill in buffer. + * @param err error information if retrieving the full name failed + * @return the actual buffer size needed for the full name. If it's greater + * than nameCapacity, the returned full name will be truncated. + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getBaseName(const char* localeID, + char* name, + int32_t nameCapacity, + UErrorCode* err); + +/** + * Gets an enumeration of keywords for the specified locale. Enumeration + * must get disposed of by the client using uenum_close function. + * + * @param localeID the locale to get the variant code with + * @param status error information if retrieving the keywords failed + * @return enumeration of keywords or NULL if there are no keywords. + * @stable ICU 2.8 + */ +U_CAPI UEnumeration* U_EXPORT2 +uloc_openKeywords(const char* localeID, + UErrorCode* status); + +/** + * Get the value for a keyword. Locale name does not need to be normalized. + * + * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK") + * @param keywordName name of the keyword for which we want the value; must not be + * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. + * @param buffer receiving buffer + * @param bufferCapacity capacity of receiving buffer + * @param status containing error code: e.g. buffer not big enough or ill-formed localeID + * or keywordName parameters. + * @return the length of keyword value + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getKeywordValue(const char* localeID, + const char* keywordName, + char* buffer, int32_t bufferCapacity, + UErrorCode* status); + + +/** + * Sets or removes the value of the specified keyword. + * + * For removing all keywords, use uloc_getBaseName(). + * + * NOTE: Unlike almost every other ICU function which takes a + * buffer, this function will NOT truncate the output text, and will + * not update the buffer with unterminated text setting a status of + * U_STRING_NOT_TERMINATED_WARNING. If a BUFFER_OVERFLOW_ERROR is received, + * it means a terminated version of the updated locale ID would not fit + * in the buffer, and the original buffer is untouched. This is done to + * prevent incorrect or possibly even malformed locales from being generated + * and used. + * + * @param keywordName name of the keyword to be set; must not be + * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. + * @param keywordValue value of the keyword to be set. If 0-length or + * NULL, will result in the keyword being removed; no error is given if + * that keyword does not exist. Otherwise, must consist only of + * [A-Za-z0-9] and [/_+-]. + * @param buffer input buffer containing well-formed locale ID to be + * modified. + * @param bufferCapacity capacity of receiving buffer + * @param status containing error code: e.g. buffer not big enough + * or ill-formed keywordName or keywordValue parameters, or ill-formed + * locale ID in buffer on input. + * @return the length needed for the buffer + * @see uloc_getKeywordValue + * @stable ICU 3.2 + */ +U_CAPI int32_t U_EXPORT2 +uloc_setKeywordValue(const char* keywordName, + const char* keywordValue, + char* buffer, int32_t bufferCapacity, + UErrorCode* status); + +/** + * Returns whether the locale's script is written right-to-left. + * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). + * If no likely script is known, then false is returned. + * + * A script is right-to-left according to the CLDR script metadata + * which corresponds to whether the script's letters have Bidi_Class=R or AL. + * + * Returns true for "ar" and "en-Hebr", false for "zh" and "fa-Cyrl". + * + * @param locale input locale ID + * @return true if the locale's script is written right-to-left + * @stable ICU 54 + */ +U_CAPI UBool U_EXPORT2 +uloc_isRightToLeft(const char *locale); + +/** + * enums for the return value for the character and line orientation + * functions. + * @stable ICU 4.0 + */ +typedef enum { + ULOC_LAYOUT_LTR = 0, /* left-to-right. */ + ULOC_LAYOUT_RTL = 1, /* right-to-left. */ + ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */ + ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */ + ULOC_LAYOUT_UNKNOWN +} ULayoutType; + +/** + * Get the layout character orientation for the specified locale. + * + * @param localeId locale name + * @param status Error status + * @return an enum indicating the layout orientation for characters. + * @stable ICU 4.0 + */ +U_CAPI ULayoutType U_EXPORT2 +uloc_getCharacterOrientation(const char* localeId, + UErrorCode *status); + +/** + * Get the layout line orientation for the specified locale. + * + * @param localeId locale name + * @param status Error status + * @return an enum indicating the layout orientation for lines. + * @stable ICU 4.0 + */ +U_CAPI ULayoutType U_EXPORT2 +uloc_getLineOrientation(const char* localeId, + UErrorCode *status); + +/** + * Output values which uloc_acceptLanguage() writes to the 'outResult' parameter. + * + * @see uloc_acceptLanguageFromHTTP + * @see uloc_acceptLanguage + * @stable ICU 3.2 + */ +typedef enum { + /** + * No exact match was found. + * @stable ICU 3.2 + */ + ULOC_ACCEPT_FAILED = 0, + /** + * An exact match was found. + * @stable ICU 3.2 + */ + ULOC_ACCEPT_VALID = 1, + /** + * A fallback was found. For example, the Accept-Language list includes 'ja_JP' + * and is matched with available locale 'ja'. + * @stable ICU 3.2 + */ + ULOC_ACCEPT_FALLBACK = 2 /* */ +} UAcceptResult; + +/** + * Based on a HTTP header from a web browser and a list of available locales, + * determine an acceptable locale for the user. + * + * This is a thin wrapper over C++ class LocaleMatcher. + * + * @param result - buffer to accept the result locale + * @param resultAvailable the size of the result buffer. + * @param outResult - An out parameter that contains the fallback status + * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP. + * @param availableLocales - list of available locales to match + * @param status ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return length needed for the locale. + * @stable ICU 3.2 + */ +U_CAPI int32_t U_EXPORT2 +uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, + UAcceptResult *outResult, + const char *httpAcceptLanguage, + UEnumeration* availableLocales, + UErrorCode *status); + +/** + * Based on a list of available locales, + * determine an acceptable locale for the user. + * + * This is a thin wrapper over C++ class LocaleMatcher. + * + * @param result - buffer to accept the result locale + * @param resultAvailable the size of the result buffer. + * @param outResult - An out parameter that contains the fallback status + * @param acceptList - list of acceptable languages + * @param acceptListCount - count of acceptList items + * @param availableLocales - list of available locales to match + * @param status ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return length needed for the locale. + * @stable ICU 3.2 + */ +U_CAPI int32_t U_EXPORT2 +uloc_acceptLanguage(char *result, int32_t resultAvailable, + UAcceptResult *outResult, const char **acceptList, + int32_t acceptListCount, + UEnumeration* availableLocales, + UErrorCode *status); + + +/** + * Gets the ICU locale ID for the specified Win32 LCID value. + * + * @param hostID the Win32 LCID to translate + * @param locale the output buffer for the ICU locale ID, which will be NUL-terminated + * if there is room. + * @param localeCapacity the size of the output buffer + * @param status an error is returned if the LCID is unrecognized or the output buffer + * is too small + * @return actual the actual size of the locale ID, not including NUL-termination + * @stable ICU 3.8 + */ +U_CAPI int32_t U_EXPORT2 +uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, + UErrorCode *status); + + +/** + * Add the likely subtags for a provided locale ID, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If localeID is already in the maximal form, or there is no data available + * for maximization, it will be copied to the output buffer. For example, + * "und-Zzzz" cannot be maximized, since there is no reasonable maximization. + * + * Examples: + * + * "en" maximizes to "en_Latn_US" + * + * "de" maximizes to "de_Latn_US" + * + * "sr" maximizes to "sr_Cyrl_RS" + * + * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.) + * + * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.) + * + * @param localeID The locale to maximize + * @param maximizedLocaleID The maximized locale + * @param maximizedLocaleIDCapacity The capacity of the maximizedLocaleID buffer + * @param err Error information if maximizing the locale failed. If the length + * of the localeID and the null-terminator is greater than the maximum allowed size, + * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. + * @return The actual buffer size needed for the maximized locale. If it's + * greater than maximizedLocaleIDCapacity, the returned ID will be truncated. + * On error, the return value is -1. + * @stable ICU 4.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_addLikelySubtags(const char* localeID, + char* maximizedLocaleID, + int32_t maximizedLocaleIDCapacity, + UErrorCode* err); + + +/** + * Minimize the subtags for a provided locale ID, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If localeID is already in the minimal form, or there is no data available + * for minimization, it will be copied to the output buffer. Since the + * minimization algorithm relies on proper maximization, see the comments + * for uloc_addLikelySubtags for reasons why there might not be any data. + * + * Examples: + * + * "en_Latn_US" minimizes to "en" + * + * "de_Latn_US" minimizes to "de" + * + * "sr_Cyrl_RS" minimizes to "sr" + * + * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the + * script, and minimizing to "zh" would imply "zh_Hans_CN".) + * + * @param localeID The locale to minimize + * @param minimizedLocaleID The minimized locale + * @param minimizedLocaleIDCapacity The capacity of the minimizedLocaleID buffer + * @param err Error information if minimizing the locale failed. If the length + * of the localeID and the null-terminator is greater than the maximum allowed size, + * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. + * @return The actual buffer size needed for the minimized locale. If it's + * greater than minimizedLocaleIDCapacity, the returned ID will be truncated. + * On error, the return value is -1. + * @stable ICU 4.0 + */ +U_CAPI int32_t U_EXPORT2 +uloc_minimizeSubtags(const char* localeID, + char* minimizedLocaleID, + int32_t minimizedLocaleIDCapacity, + UErrorCode* err); + +/** + * Returns a locale ID for the specified BCP47 language tag string. + * If the specified language tag contains any ill-formed subtags, + * the first such subtag and all following subtags are ignored. + *

+ * This implements the 'Language-Tag' production of BCP 47, and so + * supports legacy language tags (marked as “Type: grandfathered” in BCP 47) + * (regular and irregular) as well as private use language tags. + * + * Private use tags are represented as 'x-whatever', + * and legacy tags are converted to their canonical replacements where they exist. + * + * Note that a few legacy tags have no modern replacement; + * these will be converted using the fallback described in + * the first paragraph, so some information might be lost. + * + * @param langtag the input BCP47 language tag. + * @param localeID the output buffer receiving a locale ID for the + * specified BCP47 language tag. + * @param localeIDCapacity the size of the locale ID output buffer. + * @param parsedLength if not NULL, successfully parsed length + * for the input language tag is set. + * @param err error information if receiving the locald ID + * failed. + * @return the length of the locale ID. + * @stable ICU 4.2 + */ +U_CAPI int32_t U_EXPORT2 +uloc_forLanguageTag(const char* langtag, + char* localeID, + int32_t localeIDCapacity, + int32_t* parsedLength, + UErrorCode* err); + +/** + * Returns a well-formed language tag for this locale ID. + *

+ * Note: When strict is false, any locale + * fields which do not satisfy the BCP47 syntax requirement will + * be omitted from the result. When strict is + * true, this function sets U_ILLEGAL_ARGUMENT_ERROR to the + * err if any locale fields do not satisfy the + * BCP47 syntax requirement. + * @param localeID the input locale ID + * @param langtag the output buffer receiving BCP47 language + * tag for the locale ID. + * @param langtagCapacity the size of the BCP47 language tag + * output buffer. + * @param strict boolean value indicating if the function returns + * an error for an ill-formed input locale ID. + * @param err error information if receiving the language + * tag failed. + * @return The length of the BCP47 language tag. + * @stable ICU 4.2 + */ +U_CAPI int32_t U_EXPORT2 +uloc_toLanguageTag(const char* localeID, + char* langtag, + int32_t langtagCapacity, + UBool strict, + UErrorCode* err); + +/** + * Converts the specified keyword (legacy key, or BCP 47 Unicode locale + * extension key) to the equivalent BCP 47 Unicode locale extension key. + * For example, BCP 47 Unicode locale extension key "co" is returned for + * the input keyword "collation". + *

+ * When the specified keyword is unknown, but satisfies the BCP syntax, + * then the pointer to the input keyword itself will be returned. + * For example, + * uloc_toUnicodeLocaleKey("ZZ") returns "ZZ". + * + * @param keyword the input locale keyword (either legacy key + * such as "collation" or BCP 47 Unicode locale extension + * key such as "co"). + * @return the well-formed BCP 47 Unicode locale extension key, + * or NULL if the specified locale keyword cannot be + * mapped to a well-formed BCP 47 Unicode locale extension + * key. + * @see uloc_toLegacyKey + * @stable ICU 54 + */ +U_CAPI const char* U_EXPORT2 +uloc_toUnicodeLocaleKey(const char* keyword); + +/** + * Converts the specified keyword value (legacy type, or BCP 47 + * Unicode locale extension type) to the well-formed BCP 47 Unicode locale + * extension type for the specified keyword (category). For example, BCP 47 + * Unicode locale extension type "phonebk" is returned for the input + * keyword value "phonebook", with the keyword "collation" (or "co"). + *

+ * When the specified keyword is not recognized, but the specified value + * satisfies the syntax of the BCP 47 Unicode locale extension type, + * or when the specified keyword allows 'variable' type and the specified + * value satisfies the syntax, then the pointer to the input type value itself + * will be returned. + * For example, + * uloc_toUnicodeLocaleType("Foo", "Bar") returns "Bar", + * uloc_toUnicodeLocaleType("variableTop", "00A4") returns "00A4". + * + * @param keyword the locale keyword (either legacy key such as + * "collation" or BCP 47 Unicode locale extension + * key such as "co"). + * @param value the locale keyword value (either legacy type + * such as "phonebook" or BCP 47 Unicode locale extension + * type such as "phonebk"). + * @return the well-formed BCP47 Unicode locale extension type, + * or NULL if the locale keyword value cannot be mapped to + * a well-formed BCP 47 Unicode locale extension type. + * @see uloc_toLegacyType + * @stable ICU 54 + */ +U_CAPI const char* U_EXPORT2 +uloc_toUnicodeLocaleType(const char* keyword, const char* value); + +/** + * Converts the specified keyword (BCP 47 Unicode locale extension key, or + * legacy key) to the legacy key. For example, legacy key "collation" is + * returned for the input BCP 47 Unicode locale extension key "co". + * + * @param keyword the input locale keyword (either BCP 47 Unicode locale + * extension key or legacy key). + * @return the well-formed legacy key, or NULL if the specified + * keyword cannot be mapped to a well-formed legacy key. + * @see toUnicodeLocaleKey + * @stable ICU 54 + */ +U_CAPI const char* U_EXPORT2 +uloc_toLegacyKey(const char* keyword); + +/** + * Converts the specified keyword value (BCP 47 Unicode locale extension type, + * or legacy type or type alias) to the canonical legacy type. For example, + * the legacy type "phonebook" is returned for the input BCP 47 Unicode + * locale extension type "phonebk" with the keyword "collation" (or "co"). + *

+ * When the specified keyword is not recognized, but the specified value + * satisfies the syntax of legacy key, or when the specified keyword + * allows 'variable' type and the specified value satisfies the syntax, + * then the pointer to the input type value itself will be returned. + * For example, + * uloc_toLegacyType("Foo", "Bar") returns "Bar", + * uloc_toLegacyType("vt", "00A4") returns "00A4". + * + * @param keyword the locale keyword (either legacy keyword such as + * "collation" or BCP 47 Unicode locale extension + * key such as "co"). + * @param value the locale keyword value (either BCP 47 Unicode locale + * extension type such as "phonebk" or legacy keyword value + * such as "phonebook"). + * @return the well-formed legacy type, or NULL if the specified + * keyword value cannot be mapped to a well-formed legacy + * type. + * @see toUnicodeLocaleType + * @stable ICU 54 + */ +U_CAPI const char* U_EXPORT2 +uloc_toLegacyType(const char* keyword, const char* value); + +#endif /*_ULOC*/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/umachine.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/umachine.h new file mode 100644 index 0000000000000000000000000000000000000000..09c887c80efd47b2d088129a66a7f16d9be581b5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/umachine.h @@ -0,0 +1,491 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: umachine.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999sep13 +* created by: Markus W. Scherer +* +* This file defines basic types and constants for ICU to be +* platform-independent. umachine.h and utf.h are included into +* utypes.h to provide all the general definitions for ICU. +* All of these definitions used to be in utypes.h before +* the UTF-handling macros made this unmaintainable. +*/ + +#ifndef __UMACHINE_H__ +#define __UMACHINE_H__ + + +/** + * \file + * \brief Basic types and constants for UTF + * + *

Basic types and constants for UTF

+ * This file defines basic types and constants for utf.h to be + * platform-independent. umachine.h and utf.h are included into + * utypes.h to provide all the general definitions for ICU. + * All of these definitions used to be in utypes.h before + * the UTF-handling macros made this unmaintainable. + * + */ +/*==========================================================================*/ +/* Include platform-dependent definitions */ +/* which are contained in the platform-specific file platform.h */ +/*==========================================================================*/ + +#include "unicode/ptypes.h" /* platform.h is included in ptypes.h */ + +/* + * ANSI C headers: + * stddef.h defines wchar_t + */ +#include +#include + +/*==========================================================================*/ +/* For C wrappers, we use the symbol U_CAPI. */ +/* This works properly if the includer is C or C++. */ +/* Functions are declared U_CAPI return-type U_EXPORT2 function-name()... */ +/*==========================================================================*/ + +/** + * \def U_CFUNC + * This is used in a declaration of a library private ICU C function. + * @stable ICU 2.4 + */ + +/** + * \def U_CDECL_BEGIN + * This is used to begin a declaration of a library private ICU C API. + * @stable ICU 2.4 + */ + +/** + * \def U_CDECL_END + * This is used to end a declaration of a library private ICU C API + * @stable ICU 2.4 + */ + +#ifdef __cplusplus +# define U_CFUNC extern "C" +# define U_CDECL_BEGIN extern "C" { +# define U_CDECL_END } +#else +# define U_CFUNC extern +# define U_CDECL_BEGIN +# define U_CDECL_END +#endif + +#ifndef U_ATTRIBUTE_DEPRECATED +/** + * \def U_ATTRIBUTE_DEPRECATED + * This is used for GCC specific attributes + * @internal + */ +#if U_GCC_MAJOR_MINOR >= 302 +# define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated)) +/** + * \def U_ATTRIBUTE_DEPRECATED + * This is used for Visual C++ specific attributes + * @internal + */ +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) +# define U_ATTRIBUTE_DEPRECATED __declspec(deprecated) +#else +# define U_ATTRIBUTE_DEPRECATED +#endif +#endif + +/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/ +#define U_CAPI U_CFUNC U_EXPORT +/** Obsolete/same as U_CAPI; was used to declare a function as a stable public ICU C API*/ +#define U_STABLE U_CAPI +/** Obsolete/same as U_CAPI; was used to declare a function as a draft public ICU C API */ +#define U_DRAFT U_CAPI +/** This is used to declare a function as a deprecated public ICU C API */ +#define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED +/** Obsolete/same as U_CAPI; was used to declare a function as an obsolete public ICU C API */ +#define U_OBSOLETE U_CAPI +/** Obsolete/same as U_CAPI; was used to declare a function as an internal ICU C API */ +#define U_INTERNAL U_CAPI + +/** + * \def U_OVERRIDE + * Defined to the C++11 "override" keyword if available. + * Denotes a class or member which is an override of the base class. + * May result in an error if it applied to something not an override. + * @internal + */ +#ifndef U_OVERRIDE +#define U_OVERRIDE override +#endif + +/** + * \def U_FINAL + * Defined to the C++11 "final" keyword if available. + * Denotes a class or member which may not be overridden in subclasses. + * May result in an error if subclasses attempt to override. + * @internal + */ +#if !defined(U_FINAL) || defined(U_IN_DOXYGEN) +#define U_FINAL final +#endif + +// Before ICU 65, function-like, multi-statement ICU macros were just defined as +// series of statements wrapped in { } blocks and the caller could choose to +// either treat them as if they were actual functions and end the invocation +// with a trailing ; creating an empty statement after the block or else omit +// this trailing ; using the knowledge that the macro would expand to { }. +// +// But doing so doesn't work well with macros that look like functions and +// compiler warnings about empty statements (ICU-20601) and ICU 65 therefore +// switches to the standard solution of wrapping such macros in do { } while. +// +// This will however break existing code that depends on being able to invoke +// these macros without a trailing ; so to be able to remain compatible with +// such code the wrapper is itself defined as macros so that it's possible to +// build ICU 65 and later with the old macro behaviour, like this: +// +// export CPPFLAGS='-DUPRV_BLOCK_MACRO_BEGIN="" -DUPRV_BLOCK_MACRO_END=""' +// runConfigureICU ... +// + +/** + * \def UPRV_BLOCK_MACRO_BEGIN + * Defined as the "do" keyword by default. + * @internal + */ +#ifndef UPRV_BLOCK_MACRO_BEGIN +#define UPRV_BLOCK_MACRO_BEGIN do +#endif + +/** + * \def UPRV_BLOCK_MACRO_END + * Defined as "while (false)" by default. + * @internal + */ +#ifndef UPRV_BLOCK_MACRO_END +#define UPRV_BLOCK_MACRO_END while (false) +#endif + +/*==========================================================================*/ +/* limits for int32_t etc., like in POSIX inttypes.h */ +/*==========================================================================*/ + +#ifndef INT8_MIN +/** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */ +# define INT8_MIN ((int8_t)(-128)) +#endif +#ifndef INT16_MIN +/** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */ +# define INT16_MIN ((int16_t)(-32767-1)) +#endif +#ifndef INT32_MIN +/** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */ +# define INT32_MIN ((int32_t)(-2147483647-1)) +#endif + +#ifndef INT8_MAX +/** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */ +# define INT8_MAX ((int8_t)(127)) +#endif +#ifndef INT16_MAX +/** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */ +# define INT16_MAX ((int16_t)(32767)) +#endif +#ifndef INT32_MAX +/** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */ +# define INT32_MAX ((int32_t)(2147483647)) +#endif + +#ifndef UINT8_MAX +/** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */ +# define UINT8_MAX ((uint8_t)(255U)) +#endif +#ifndef UINT16_MAX +/** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */ +# define UINT16_MAX ((uint16_t)(65535U)) +#endif +#ifndef UINT32_MAX +/** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */ +# define UINT32_MAX ((uint32_t)(4294967295U)) +#endif + +#if defined(U_INT64_T_UNAVAILABLE) +# error int64_t is required for decimal format and rule-based number format. +#else +# ifndef INT64_C +/** + * Provides a platform independent way to specify a signed 64-bit integer constant. + * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C + * @stable ICU 2.8 + */ +# define INT64_C(c) c ## LL +# endif +# ifndef UINT64_C +/** + * Provides a platform independent way to specify an unsigned 64-bit integer constant. + * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C + * @stable ICU 2.8 + */ +# define UINT64_C(c) c ## ULL +# endif +# ifndef U_INT64_MIN +/** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */ +# define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1)) +# endif +# ifndef U_INT64_MAX +/** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */ +# define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807))) +# endif +# ifndef U_UINT64_MAX +/** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */ +# define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615))) +# endif +#endif + +/*==========================================================================*/ +/* Boolean data type */ +/*==========================================================================*/ + +/** + * The ICU boolean type, a signed-byte integer. + * ICU-specific for historical reasons: The C and C++ standards used to not define type bool. + * Also provides a fixed type definition, as opposed to + * type bool whose details (e.g., sizeof) may vary by compiler and between C and C++. + * + * @stable ICU 2.0 + */ +typedef int8_t UBool; + +/** + * \def U_DEFINE_FALSE_AND_TRUE + * Normally turns off defining macros FALSE=0 & TRUE=1 in public ICU headers. + * These obsolete macros sometimes break compilation of other code that + * defines enum constants or similar with these names. + * C++ has long defined bool/false/true. + * C99 also added definitions for these, although as macros; see stdbool.h. + * + * You may transitionally define U_DEFINE_FALSE_AND_TRUE=1 if you need time to migrate code. + * + * @internal ICU 68 + */ +#ifdef U_DEFINE_FALSE_AND_TRUE + // Use the predefined value. +#elif defined(U_COMBINED_IMPLEMENTATION) || \ + defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || \ + defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || \ + defined(U_TOOLUTIL_IMPLEMENTATION) + // Inside ICU: Keep FALSE & TRUE available. +# define U_DEFINE_FALSE_AND_TRUE 1 +#else + // Outside ICU: Avoid collision with non-macro definitions of FALSE & TRUE. +# define U_DEFINE_FALSE_AND_TRUE 0 +#endif + +#if U_DEFINE_FALSE_AND_TRUE || defined(U_IN_DOXYGEN) +#ifndef TRUE +/** + * The TRUE value of a UBool. + * + * @deprecated ICU 68 Use standard "true" instead. + */ +# define TRUE 1 +#endif +#ifndef FALSE +/** + * The FALSE value of a UBool. + * + * @deprecated ICU 68 Use standard "false" instead. + */ +# define FALSE 0 +#endif +#endif // U_DEFINE_FALSE_AND_TRUE + +/*==========================================================================*/ +/* Unicode data types */ +/*==========================================================================*/ + +/* wchar_t-related definitions -------------------------------------------- */ + +/* + * \def U_WCHAR_IS_UTF16 + * Defined if wchar_t uses UTF-16. + * + * @stable ICU 2.0 + */ +/* + * \def U_WCHAR_IS_UTF32 + * Defined if wchar_t uses UTF-32. + * + * @stable ICU 2.0 + */ +#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) +# ifdef __STDC_ISO_10646__ +# if (U_SIZEOF_WCHAR_T==2) +# define U_WCHAR_IS_UTF16 +# elif (U_SIZEOF_WCHAR_T==4) +# define U_WCHAR_IS_UTF32 +# endif +# elif defined __UCS2__ +# if (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) && (U_SIZEOF_WCHAR_T==2) +# define U_WCHAR_IS_UTF16 +# endif +# elif defined(__UCS4__) || (U_PLATFORM == U_PF_OS400 && defined(__UTF32__)) +# if (U_SIZEOF_WCHAR_T==4) +# define U_WCHAR_IS_UTF32 +# endif +# elif U_PLATFORM_IS_DARWIN_BASED || (U_SIZEOF_WCHAR_T==4 && U_PLATFORM_IS_LINUX_BASED) +# define U_WCHAR_IS_UTF32 +# elif U_PLATFORM_HAS_WIN32_API +# define U_WCHAR_IS_UTF16 +# endif +#endif + +/* UChar and UChar32 definitions -------------------------------------------- */ + +/** Number of bytes in a UChar. @stable ICU 2.0 */ +#define U_SIZEOF_UCHAR 2 + +/** + * \def U_CHAR16_IS_TYPEDEF + * If 1, then char16_t is a typedef and not a real type (yet) + * @internal + */ +#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) +// for AIX, uchar.h needs to be included +# include +# define U_CHAR16_IS_TYPEDEF 1 +#elif defined(_MSC_VER) && (_MSC_VER < 1900) +// Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type, +// and instead use a typedef. https://msdn.microsoft.com/library/bb531344.aspx +# define U_CHAR16_IS_TYPEDEF 1 +#else +# define U_CHAR16_IS_TYPEDEF 0 +#endif + + +/** + * \var UChar + * + * The base type for UTF-16 code units and pointers. + * Unsigned 16-bit integer. + * Starting with ICU 59, C++ API uses char16_t directly, while C API continues to use UChar. + * + * UChar is configurable by defining the macro UCHAR_TYPE + * on the preprocessor or compiler command line: + * -DUCHAR_TYPE=uint16_t or -DUCHAR_TYPE=wchar_t (if U_SIZEOF_WCHAR_T==2) etc. + * (The UCHAR_TYPE can also be \#defined earlier in this file, for outside the ICU library code.) + * This is for transitional use from application code that uses uint16_t or wchar_t for UTF-16. + * + * The default is UChar=char16_t. + * + * C++11 defines char16_t as bit-compatible with uint16_t, but as a distinct type. + * + * In C, char16_t is a simple typedef of uint_least16_t. + * ICU requires uint_least16_t=uint16_t for data memory mapping. + * On macOS, char16_t is not available because the uchar.h standard header is missing. + * + * @stable ICU 4.4 + */ + +#if 1 + // #if 1 is normal. UChar defaults to char16_t in C++. + // For configuration testing of UChar=uint16_t temporarily change this to #if 0. + // The intltest Makefile #defines UCHAR_TYPE=char16_t, + // so we only #define it to uint16_t if it is undefined so far. +#elif !defined(UCHAR_TYPE) +# define UCHAR_TYPE uint16_t +#endif + +#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ + defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) + // Inside the ICU library code, never configurable. + typedef char16_t UChar; +#elif defined(UCHAR_TYPE) + typedef UCHAR_TYPE UChar; +#elif (U_CPLUSPLUS_VERSION >= 11) + typedef char16_t UChar; +#else + typedef uint16_t UChar; +#endif + +/** + * \var OldUChar + * Default ICU 58 definition of UChar. + * A base type for UTF-16 code units and pointers. + * Unsigned 16-bit integer. + * + * Define OldUChar to be wchar_t if that is 16 bits wide. + * If wchar_t is not 16 bits wide, then define UChar to be uint16_t. + * + * This makes the definition of OldUChar platform-dependent + * but allows direct string type compatibility with platforms with + * 16-bit wchar_t types. + * + * This is how UChar was defined in ICU 58, for transition convenience. + * Exception: ICU 58 UChar was defined to UCHAR_TYPE if that macro was defined. + * The current UChar responds to UCHAR_TYPE but OldUChar does not. + * + * @stable ICU 59 + */ +#if U_SIZEOF_WCHAR_T==2 + typedef wchar_t OldUChar; +#elif defined(__CHAR16_TYPE__) + typedef __CHAR16_TYPE__ OldUChar; +#else + typedef uint16_t OldUChar; +#endif + +/** + * Define UChar32 as a type for single Unicode code points. + * UChar32 is a signed 32-bit integer (same as int32_t). + * + * The Unicode code point range is 0..0x10ffff. + * All other values (negative or >=0x110000) are illegal as Unicode code points. + * They may be used as sentinel values to indicate "done", "error" + * or similar non-code point conditions. + * + * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined + * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned) + * or else to be uint32_t. + * That is, the definition of UChar32 was platform-dependent. + * + * @see U_SENTINEL + * @stable ICU 2.4 + */ +typedef int32_t UChar32; + +/** + * This value is intended for sentinel values for APIs that + * (take or) return single code points (UChar32). + * It is outside of the Unicode code point range 0..0x10ffff. + * + * For example, a "done" or "error" value in a new API + * could be indicated with U_SENTINEL. + * + * ICU APIs designed before ICU 2.4 usually define service-specific "done" + * values, mostly 0xffff. + * Those may need to be distinguished from + * actual U+ffff text contents by calling functions like + * CharacterIterator::hasNext() or UnicodeString::length(). + * + * @return -1 + * @see UChar32 + * @stable ICU 2.4 + */ +#define U_SENTINEL (-1) + +#include "unicode/urename.h" + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/umisc.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/umisc.h new file mode 100644 index 0000000000000000000000000000000000000000..213290b9afa33cfdbdb0605c79e550df333f5ccc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/umisc.h @@ -0,0 +1,62 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2006, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* file name: umisc.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999oct15 +* created by: Markus W. Scherer +*/ + +#ifndef UMISC_H +#define UMISC_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C API:misc definitions + * + * This file contains miscellaneous definitions for the C APIs. + */ + +U_CDECL_BEGIN + +/** A struct representing a range of text containing a specific field + * @stable ICU 2.0 + */ +typedef struct UFieldPosition { + /** + * The field + * @stable ICU 2.0 + */ + int32_t field; + /** + * The start of the text range containing field + * @stable ICU 2.0 + */ + int32_t beginIndex; + /** + * The limit of the text range containing field + * @stable ICU 2.0 + */ + int32_t endIndex; +} UFieldPosition; + +#if !UCONFIG_NO_SERVICE +/** + * Opaque type returned by registerInstance, registerFactory and unregister for service registration. + * @stable ICU 2.6 + */ +typedef const void* URegistryKey; +#endif + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/umutablecptrie.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/umutablecptrie.h new file mode 100644 index 0000000000000000000000000000000000000000..5325d58147ab1f218d6f8f34d3b514988c591000 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/umutablecptrie.h @@ -0,0 +1,241 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// umutablecptrie.h (split out of ucptrie.h) +// created: 2018jan24 Markus W. Scherer + +#ifndef __UMUTABLECPTRIE_H__ +#define __UMUTABLECPTRIE_H__ + +#include "unicode/utypes.h" + +#include "unicode/ucpmap.h" +#include "unicode/ucptrie.h" +#include "unicode/utf8.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +U_CDECL_BEGIN + +/** + * \file + * + * This file defines a mutable Unicode code point trie. + * + * @see UCPTrie + * @see UMutableCPTrie + */ + +/** + * Mutable Unicode code point trie. + * Fast map from Unicode code points (U+0000..U+10FFFF) to 32-bit integer values. + * For details see http://site.icu-project.org/design/struct/utrie + * + * Setting values (especially ranges) and lookup is fast. + * The mutable trie is only somewhat space-efficient. + * It builds a compacted, immutable UCPTrie. + * + * This trie can be modified while iterating over its contents. + * For example, it is possible to merge its values with those from another + * set of ranges (e.g., another mutable or immutable trie): + * Iterate over those source ranges; for each of them iterate over this trie; + * add the source value into the value of each trie range. + * + * @see UCPTrie + * @see umutablecptrie_buildImmutable + * @stable ICU 63 + */ +typedef struct UMutableCPTrie UMutableCPTrie; + +/** + * Creates a mutable trie that initially maps each Unicode code point to the same value. + * It uses 32-bit data values until umutablecptrie_buildImmutable() is called. + * umutablecptrie_buildImmutable() takes a valueWidth parameter which + * determines the number of bits in the data value in the resulting UCPTrie. + * You must umutablecptrie_close() the trie once you are done using it. + * + * @param initialValue the initial value that is set for all code points + * @param errorValue the value for out-of-range code points and ill-formed UTF-8/16 + * @param pErrorCode an in/out ICU UErrorCode + * @return the trie + * @stable ICU 63 + */ +U_CAPI UMutableCPTrie * U_EXPORT2 +umutablecptrie_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode); + +/** + * Clones a mutable trie. + * You must umutablecptrie_close() the clone once you are done using it. + * + * @param other the trie to clone + * @param pErrorCode an in/out ICU UErrorCode + * @return the trie clone + * @stable ICU 63 + */ +U_CAPI UMutableCPTrie * U_EXPORT2 +umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode); + +/** + * Closes a mutable trie and releases associated memory. + * + * @param trie the trie + * @stable ICU 63 + */ +U_CAPI void U_EXPORT2 +umutablecptrie_close(UMutableCPTrie *trie); + +/** + * Creates a mutable trie with the same contents as the UCPMap. + * You must umutablecptrie_close() the mutable trie once you are done using it. + * + * @param map the source map + * @param pErrorCode an in/out ICU UErrorCode + * @return the mutable trie + * @stable ICU 63 + */ +U_CAPI UMutableCPTrie * U_EXPORT2 +umutablecptrie_fromUCPMap(const UCPMap *map, UErrorCode *pErrorCode); + +/** + * Creates a mutable trie with the same contents as the immutable one. + * You must umutablecptrie_close() the mutable trie once you are done using it. + * + * @param trie the immutable trie + * @param pErrorCode an in/out ICU UErrorCode + * @return the mutable trie + * @stable ICU 63 + */ +U_CAPI UMutableCPTrie * U_EXPORT2 +umutablecptrie_fromUCPTrie(const UCPTrie *trie, UErrorCode *pErrorCode); + +/** + * Returns the value for a code point as stored in the trie. + * + * @param trie the trie + * @param c the code point + * @return the value + * @stable ICU 63 + */ +U_CAPI uint32_t U_EXPORT2 +umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c); + +/** + * Returns the last code point such that all those from start to there have the same value. + * Can be used to efficiently iterate over all same-value ranges in a trie. + * (This is normally faster than iterating over code points and get()ting each value, + * but much slower than a data structure that stores ranges directly.) + * + * The trie can be modified between calls to this function. + * + * If the UCPMapValueFilter function pointer is not NULL, then + * the value to be delivered is passed through that function, and the return value is the end + * of the range where all values are modified to the same actual value. + * The value is unchanged if that function pointer is NULL. + * + * See the same-signature ucptrie_getRange() for a code sample. + * + * @param trie the trie + * @param start range start + * @param option defines whether surrogates are treated normally, + * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL + * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL + * @param filter a pointer to a function that may modify the trie data value, + * or NULL if the values from the trie are to be used unmodified + * @param context an opaque pointer that is passed on to the filter function + * @param pValue if not NULL, receives the value that every code point start..end has; + * may have been modified by filter(context, trie value) + * if that function pointer is not NULL + * @return the range end code point, or -1 if start is not a valid code point + * @stable ICU 63 + */ +U_CAPI UChar32 U_EXPORT2 +umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start, + UCPMapRangeOption option, uint32_t surrogateValue, + UCPMapValueFilter *filter, const void *context, uint32_t *pValue); + +/** + * Sets a value for a code point. + * + * @param trie the trie + * @param c the code point + * @param value the value + * @param pErrorCode an in/out ICU UErrorCode + * @stable ICU 63 + */ +U_CAPI void U_EXPORT2 +umutablecptrie_set(UMutableCPTrie *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode); + +/** + * Sets a value for each code point [start..end]. + * Faster and more space-efficient than setting the value for each code point separately. + * + * @param trie the trie + * @param start the first code point to get the value + * @param end the last code point to get the value (inclusive) + * @param value the value + * @param pErrorCode an in/out ICU UErrorCode + * @stable ICU 63 + */ +U_CAPI void U_EXPORT2 +umutablecptrie_setRange(UMutableCPTrie *trie, + UChar32 start, UChar32 end, + uint32_t value, UErrorCode *pErrorCode); + +/** + * Compacts the data and builds an immutable UCPTrie according to the parameters. + * After this, the mutable trie will be empty. + * + * The mutable trie stores 32-bit values until buildImmutable() is called. + * If values shorter than 32 bits are to be stored in the immutable trie, + * then the upper bits are discarded. + * For example, when the mutable trie contains values 0x81, -0x7f, and 0xa581, + * and the value width is 8 bits, then each of these is stored as 0x81 + * and the immutable trie will return that as an unsigned value. + * (Some implementations may want to make productive temporary use of the upper bits + * until buildImmutable() discards them.) + * + * Not every possible set of mappings can be built into a UCPTrie, + * because of limitations resulting from speed and space optimizations. + * Every Unicode assigned character can be mapped to a unique value. + * Typical data yields data structures far smaller than the limitations. + * + * It is possible to construct extremely unusual mappings that exceed the data structure limits. + * In such a case this function will fail with a U_INDEX_OUTOFBOUNDS_ERROR. + * + * @param trie the trie trie + * @param type selects the trie type + * @param valueWidth selects the number of bits in a trie data value; if smaller than 32 bits, + * then the values stored in the trie will be truncated first + * @param pErrorCode an in/out ICU UErrorCode + * + * @see umutablecptrie_fromUCPTrie + * @stable ICU 63 + */ +U_CAPI UCPTrie * U_EXPORT2 +umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieValueWidth valueWidth, + UErrorCode *pErrorCode); + +U_CDECL_END + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUMutableCPTriePointer + * "Smart pointer" class, closes a UMutableCPTrie via umutablecptrie_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 63 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUMutableCPTriePointer, UMutableCPTrie, umutablecptrie_close); + +U_NAMESPACE_END + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unifilt.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unifilt.h new file mode 100644 index 0000000000000000000000000000000000000000..7870b5593912efc26ac0830a7b6992a5f366fef5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unifilt.h @@ -0,0 +1,136 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2010, International Business Machines Corporation and others. +* All Rights Reserved. +********************************************************************** +* Date Name Description +* 11/17/99 aliu Creation. +********************************************************************** +*/ +#ifndef UNIFILT_H +#define UNIFILT_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/unifunct.h" +#include "unicode/unimatch.h" + +/** + * \file + * \brief C++ API: Unicode Filter + */ + +U_NAMESPACE_BEGIN + +/** + * U_ETHER is used to represent character values for positions outside + * a range. For example, transliterator uses this to represent + * characters outside the range contextStart..contextLimit-1. This + * allows explicit matching by rules and UnicodeSets of text outside a + * defined range. + * @stable ICU 3.0 + */ +#define U_ETHER ((char16_t)0xFFFF) + +/** + * + * UnicodeFilter defines a protocol for selecting a + * subset of the full range (U+0000 to U+10FFFF) of Unicode characters. + * Currently, filters are used in conjunction with classes like + * {@link Transliterator} to only process selected characters through a + * transformation. + * + *

Note: UnicodeFilter currently stubs out two pure virtual methods + * of its base class, UnicodeMatcher. These methods are toPattern() + * and matchesIndexValue(). This is done so that filter classes that + * are not actually used as matchers -- specifically, those in the + * UnicodeFilterLogic component, and those in tests -- can continue to + * work without defining these methods. As long as a filter is not + * used in an RBT during real transliteration, these methods will not + * be called. However, this breaks the UnicodeMatcher base class + * protocol, and it is not a correct solution. + * + *

In the future we may revisit the UnicodeMatcher / UnicodeFilter + * hierarchy and either redesign it, or simply remove the stubs in + * UnicodeFilter and force subclasses to implement the full + * UnicodeMatcher protocol. + * + * @see UnicodeFilterLogic + * @stable ICU 2.0 + */ +class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher { + +public: + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~UnicodeFilter(); + + /** + * Clones this object polymorphically. + * The caller owns the result and should delete it when done. + * @return clone, or nullptr if an error occurred + * @stable ICU 2.4 + */ + virtual UnicodeFilter* clone() const = 0; + + /** + * Returns true for characters that are in the selected + * subset. In other words, if a character is to be + * filtered, then contains() returns + * false. + * @stable ICU 2.0 + */ + virtual UBool contains(UChar32 c) const = 0; + + /** + * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer + * and return the pointer. + * @stable ICU 2.4 + */ + virtual UnicodeMatcher* toMatcher() const; + + /** + * Implement UnicodeMatcher API. + * @stable ICU 2.4 + */ + virtual UMatchDegree matches(const Replaceable& text, + int32_t& offset, + int32_t limit, + UBool incremental); + + /** + * UnicodeFunctor API. Nothing to do. + * @stable ICU 2.4 + */ + virtual void setData(const TransliterationRuleData*); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +protected: + + /* + * Since this class has pure virtual functions, + * a constructor can't be used. + * @stable ICU 2.0 + */ +/* UnicodeFilter();*/ +}; + +/*inline UnicodeFilter::UnicodeFilter() {}*/ + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unifunct.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unifunct.h new file mode 100644 index 0000000000000000000000000000000000000000..7d31af7dafb7727170ea67cedfd1db3bb40fada1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unifunct.h @@ -0,0 +1,132 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2005, International Business Machines Corporation +* and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 01/14/2002 aliu Creation. +********************************************************************** +*/ +#ifndef UNIFUNCT_H +#define UNIFUNCT_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Unicode Functor + */ + +U_NAMESPACE_BEGIN + +class UnicodeMatcher; +class UnicodeReplacer; +class TransliterationRuleData; + +/** + * UnicodeFunctor is an abstract base class for objects + * that perform match and/or replace operations on Unicode strings. + * @author Alan Liu + * @stable ICU 2.4 + */ +class U_COMMON_API UnicodeFunctor : public UObject { + +public: + + /** + * Destructor + * @stable ICU 2.4 + */ + virtual ~UnicodeFunctor(); + + /** + * Return a copy of this object. All UnicodeFunctor objects + * have to support cloning in order to allow classes using + * UnicodeFunctor to implement cloning. + * @stable ICU 2.4 + */ + virtual UnicodeFunctor* clone() const = 0; + + /** + * Cast 'this' to a UnicodeMatcher* pointer and return the + * pointer, or null if this is not a UnicodeMatcher*. Subclasses + * that mix in UnicodeMatcher as a base class must override this. + * This protocol is required because a pointer to a UnicodeFunctor + * cannot be cast to a pointer to a UnicodeMatcher, since + * UnicodeMatcher is a mixin that does not derive from + * UnicodeFunctor. + * @stable ICU 2.4 + */ + virtual UnicodeMatcher* toMatcher() const; + + /** + * Cast 'this' to a UnicodeReplacer* pointer and return the + * pointer, or null if this is not a UnicodeReplacer*. Subclasses + * that mix in UnicodeReplacer as a base class must override this. + * This protocol is required because a pointer to a UnicodeFunctor + * cannot be cast to a pointer to a UnicodeReplacer, since + * UnicodeReplacer is a mixin that does not derive from + * UnicodeFunctor. + * @stable ICU 2.4 + */ + virtual UnicodeReplacer* toReplacer() const; + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). + * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID polymorphically. This method + * is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + *

Concrete subclasses of UnicodeFunctor should use the macro + * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to + * provide definitios getStaticClassID and getDynamicClassID. + * + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @stable ICU 2.4 + */ + virtual UClassID getDynamicClassID(void) const = 0; + + /** + * Set the data object associated with this functor. The data + * object provides context for functor-to-standin mapping. This + * method is required when assigning a functor to a different data + * object. This function MAY GO AWAY later if the architecture is + * changed to pass data object pointers through the API. + * @internal ICU 2.1 + */ + virtual void setData(const TransliterationRuleData*) = 0; + +protected: + + /** + * Since this class has pure virtual functions, + * a constructor can't be used. + * @stable ICU 2.0 + */ + /*UnicodeFunctor();*/ + +}; + +/*inline UnicodeFunctor::UnicodeFunctor() {}*/ + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unimatch.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unimatch.h new file mode 100644 index 0000000000000000000000000000000000000000..302332f4558c3e06abb2e7b1fa3d043695e54cde --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unimatch.h @@ -0,0 +1,168 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +* Copyright (C) 2001-2005, International Business Machines Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 07/18/01 aliu Creation. +********************************************************************** +*/ +#ifndef UNIMATCH_H +#define UNIMATCH_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Unicode Matcher + */ + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +class Replaceable; +class UnicodeString; +class UnicodeSet; + +/** + * Constants returned by UnicodeMatcher::matches() + * indicating the degree of match. + * @stable ICU 2.4 + */ +enum UMatchDegree { + /** + * Constant returned by matches() indicating a + * mismatch between the text and this matcher. The text contains + * a character which does not match, or the text does not contain + * all desired characters for a non-incremental match. + * @stable ICU 2.4 + */ + U_MISMATCH, + + /** + * Constant returned by matches() indicating a + * partial match between the text and this matcher. This value is + * only returned for incremental match operations. All characters + * of the text match, but more characters are required for a + * complete match. Alternatively, for variable-length matchers, + * all characters of the text match, and if more characters were + * supplied at limit, they might also match. + * @stable ICU 2.4 + */ + U_PARTIAL_MATCH, + + /** + * Constant returned by matches() indicating a + * complete match between the text and this matcher. For an + * incremental variable-length match, this value is returned if + * the given text matches, and it is known that additional + * characters would not alter the extent of the match. + * @stable ICU 2.4 + */ + U_MATCH +}; + +/** + * UnicodeMatcher defines a protocol for objects that can + * match a range of characters in a Replaceable string. + * @stable ICU 2.4 + */ +class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an interface/mixin class */ { + +public: + /** + * Destructor. + * @stable ICU 2.4 + */ + virtual ~UnicodeMatcher(); + + /** + * Return a UMatchDegree value indicating the degree of match for + * the given text at the given offset. Zero, one, or more + * characters may be matched. + * + * Matching in the forward direction is indicated by limit > + * offset. Characters from offset forwards to limit-1 will be + * considered for matching. + * + * Matching in the reverse direction is indicated by limit < + * offset. Characters from offset backwards to limit+1 will be + * considered for matching. + * + * If limit == offset then the only match possible is a zero + * character match (which subclasses may implement if desired). + * + * As a side effect, advance the offset parameter to the limit of + * the matched substring. In the forward direction, this will be + * the index of the last matched character plus one. In the + * reverse direction, this will be the index of the last matched + * character minus one. + * + *

Note: This method is not const because some classes may + * modify their state as the result of a match. + * + * @param text the text to be matched + * @param offset on input, the index into text at which to begin + * matching. On output, the limit of the matched text. The + * number of matched characters is the output value of offset + * minus the input value. Offset should always point to the + * HIGH SURROGATE (leading code unit) of a pair of surrogates, + * both on entry and upon return. + * @param limit the limit index of text to be matched. Greater + * than offset for a forward direction match, less than offset for + * a backward direction match. The last character to be + * considered for matching will be text.charAt(limit-1) in the + * forward direction or text.charAt(limit+1) in the backward + * direction. + * @param incremental if true, then assume further characters may + * be inserted at limit and check for partial matching. Otherwise + * assume the text as given is complete. + * @return a match degree value indicating a full match, a partial + * match, or a mismatch. If incremental is false then + * U_PARTIAL_MATCH should never be returned. + * @stable ICU 2.4 + */ + virtual UMatchDegree matches(const Replaceable& text, + int32_t& offset, + int32_t limit, + UBool incremental) = 0; + + /** + * Returns a string representation of this matcher. If the result of + * calling this function is passed to the appropriate parser, it + * will produce another matcher that is equal to this one. + * @param result the string to receive the pattern. Previous + * contents will be deleted. + * @param escapeUnprintable if true then convert unprintable + * character to their hex escape representations, \\uxxxx or + * \\Uxxxxxxxx. Unprintable characters are those other than + * U+000A, U+0020..U+007E. + * @stable ICU 2.4 + */ + virtual UnicodeString& toPattern(UnicodeString& result, + UBool escapeUnprintable = false) const = 0; + + /** + * Returns true if this matcher will match a character c, where c + * & 0xFF == v, at offset, in the forward direction (with limit > + * offset). This is used by RuleBasedTransliterator for + * indexing. + * @stable ICU 2.4 + */ + virtual UBool matchesIndexValue(uint8_t v) const = 0; + + /** + * Union the set of all characters that may be matched by this object + * into the given set. + * @param toUnionTo the set into which to union the source characters + * @stable ICU 2.4 + */ + virtual void addMatchSetTo(UnicodeSet& toUnionTo) const = 0; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uniset.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uniset.h new file mode 100644 index 0000000000000000000000000000000000000000..8403c4026c3218ac741eacd1d85edfbf8223323c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uniset.h @@ -0,0 +1,1760 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +*************************************************************************** +* Copyright (C) 1999-2016, International Business Machines Corporation +* and others. All Rights Reserved. +*************************************************************************** +* Date Name Description +* 10/20/99 alan Creation. +*************************************************************************** +*/ + +#ifndef UNICODESET_H +#define UNICODESET_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/ucpmap.h" +#include "unicode/unifilt.h" +#include "unicode/unistr.h" +#include "unicode/uset.h" + +/** + * \file + * \brief C++ API: Unicode Set + */ + +U_NAMESPACE_BEGIN + +// Forward Declarations. +class BMPSet; +class ParsePosition; +class RBBIRuleScanner; +class SymbolTable; +class UnicodeSetStringSpan; +class UVector; +class RuleCharacterIterator; + +/** + * A mutable set of Unicode characters and multicharacter strings. Objects of this class + * represent character classes used in regular expressions. + * A character specifies a subset of Unicode code points. Legal + * code points are U+0000 to U+10FFFF, inclusive. + * + *

The UnicodeSet class is not designed to be subclassed. + * + *

UnicodeSet supports two APIs. The first is the + * operand API that allows the caller to modify the value of + * a UnicodeSet object. It conforms to Java 2's + * java.util.Set interface, although + * UnicodeSet does not actually implement that + * interface. All methods of Set are supported, with the + * modification that they take a character range or single character + * instead of an Object, and they take a + * UnicodeSet instead of a Collection. The + * operand API may be thought of in terms of boolean logic: a boolean + * OR is implemented by add, a boolean AND is implemented + * by retain, a boolean XOR is implemented by + * complement taking an argument, and a boolean NOT is + * implemented by complement with no argument. In terms + * of traditional set theory function names, add is a + * union, retain is an intersection, remove + * is an asymmetric difference, and complement with no + * argument is a set complement with respect to the superset range + * MIN_VALUE-MAX_VALUE + * + *

The second API is the + * applyPattern()/toPattern() API from the + * java.text.Format-derived classes. Unlike the + * methods that add characters, add categories, and control the logic + * of the set, the method applyPattern() sets all + * attributes of a UnicodeSet at once, based on a + * string pattern. + * + *

Pattern syntax

+ * + * Patterns are accepted by the constructors and the + * applyPattern() methods and returned by the + * toPattern() method. These patterns follow a syntax + * similar to that employed by version 8 regular expression character + * classes. Here are some simple examples: + * + * \htmlonly
\endhtmlonly + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
[]No characters
[a]The character 'a'
[ae]The characters 'a' and 'e'
[a-e]The characters 'a' through 'e' inclusive, in Unicode code + * point order
[\\u4E01]The character U+4E01
[a{ab}{ac}]The character 'a' and the multicharacter strings "ab" and + * "ac"
[\\p{Lu}]All characters in the general category Uppercase Letter
+ * \htmlonly
\endhtmlonly + * + * Any character may be preceded by a backslash in order to remove any special + * meaning. White space characters, as defined by UCharacter.isWhitespace(), are + * ignored, unless they are escaped. + * + *

Property patterns specify a set of characters having a certain + * property as defined by the Unicode standard. Both the POSIX-like + * "[:Lu:]" and the Perl-like syntax "\\p{Lu}" are recognized. For a + * complete list of supported property patterns, see the User's Guide + * for UnicodeSet at + * + * http://icu-project.org/userguide/unicodeSet.html. + * Actual determination of property data is defined by the underlying + * Unicode database as implemented by UCharacter. + * + *

Patterns specify individual characters, ranges of characters, and + * Unicode property sets. When elements are concatenated, they + * specify their union. To complement a set, place a '^' immediately + * after the opening '['. Property patterns are inverted by modifying + * their delimiters; "[:^foo]" and "\\P{foo}". In any other location, + * '^' has no special meaning. + * + *

Ranges are indicated by placing two a '-' between two + * characters, as in "a-z". This specifies the range of all + * characters from the left to the right, in Unicode order. If the + * left character is greater than or equal to the + * right character it is a syntax error. If a '-' occurs as the first + * character after the opening '[' or '[^', or if it occurs as the + * last character before the closing ']', then it is taken as a + * literal. Thus "[a\-b]", "[-ab]", and "[ab-]" all indicate the same + * set of three characters, 'a', 'b', and '-'. + * + *

Sets may be intersected using the '&' operator or the asymmetric + * set difference may be taken using the '-' operator, for example, + * "[[:L:]&[\\u0000-\\u0FFF]]" indicates the set of all Unicode letters + * with values less than 4096. Operators ('&' and '|') have equal + * precedence and bind left-to-right. Thus + * "[[:L:]-[a-z]-[\\u0100-\\u01FF]]" is equivalent to + * "[[[:L:]-[a-z]]-[\\u0100-\\u01FF]]". This only really matters for + * difference; intersection is commutative. + * + * + *
[a]The set containing 'a' + *
[a-z]The set containing 'a' + * through 'z' and all letters in between, in Unicode order + *
[^a-z]The set containing + * all characters but 'a' through 'z', + * that is, U+0000 through 'a'-1 and 'z'+1 through U+10FFFF + *
[[pat1][pat2]] + * The union of sets specified by pat1 and pat2 + *
[[pat1]&[pat2]] + * The intersection of sets specified by pat1 and pat2 + *
[[pat1]-[pat2]] + * The asymmetric difference of sets specified by pat1 and + * pat2 + *
[:Lu:] or \\p{Lu} + * The set of characters having the specified + * Unicode property; in + * this case, Unicode uppercase letters + *
[:^Lu:] or \\P{Lu} + * The set of characters not having the given + * Unicode property + *
+ * + *

Formal syntax

+ * + * \htmlonly
\endhtmlonly + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
pattern :=  ('[' '^'? item* ']') | + * property
item :=  char | (char '-' char) | pattern-expr
+ *
pattern-expr :=  pattern | pattern-expr pattern | + * pattern-expr op pattern
+ *
op :=  '&' | '-'
+ *
special :=  '[' | ']' | '-'
+ *
char :=  any character that is not special
+ * | ('\'
any character)
+ * | ('\\u' hex hex hex hex)
+ *
hex :=  any character for which + * Character.digit(c, 16) + * returns a non-negative result
property :=  a Unicode property set pattern
+ *
+ * + * + * + * + *
Legend: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
a := b  a may be replaced by b
a?zero or one instance of a
+ *
a*one or more instances of a
+ *
a | beither a or b
+ *
'a'the literal string between the quotes
+ *
+ * \htmlonly
\endhtmlonly + * + *

Note: + * - Most UnicodeSet methods do not take a UErrorCode parameter because + * there are usually very few opportunities for failure other than a shortage + * of memory, error codes in low-level C++ string methods would be inconvenient, + * and the error code as the last parameter (ICU convention) would prevent + * the use of default parameter values. + * Instead, such methods set the UnicodeSet into a "bogus" state + * (see isBogus()) if an error occurs. + * + * @author Alan Liu + * @stable ICU 2.0 + */ +class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { +private: + /** + * Enough for sets with few ranges. + * For example, White_Space has 10 ranges, list length 21. + */ + static constexpr int32_t INITIAL_CAPACITY = 25; + // fFlags constant + static constexpr uint8_t kIsBogus = 1; // This set is bogus (i.e. not valid) + + UChar32* list = stackList; // MUST be terminated with HIGH + int32_t capacity = INITIAL_CAPACITY; // capacity of list + int32_t len = 1; // length of list used; 1 <= len <= capacity + uint8_t fFlags = 0; // Bit flag (see constants above) + + BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not NULL. + UChar32* buffer = nullptr; // internal buffer, may be NULL + int32_t bufferCapacity = 0; // capacity of buffer + + /** + * The pattern representation of this set. This may not be the + * most economical pattern. It is the pattern supplied to + * applyPattern(), with variables substituted and whitespace + * removed. For sets constructed without applyPattern(), or + * modified using the non-pattern API, this string will be empty, + * indicating that toPattern() must generate a pattern + * representation from the inversion list. + */ + char16_t *pat = nullptr; + int32_t patLen = 0; + + UVector* strings = nullptr; // maintained in sorted order + UnicodeSetStringSpan *stringSpan = nullptr; + + /** + * Initial list array. + * Avoids some heap allocations, and list is never nullptr. + * Increases the object size a bit. + */ + UChar32 stackList[INITIAL_CAPACITY]; + +public: + /** + * Determine if this object contains a valid set. + * A bogus set has no value. It is different from an empty set. + * It can be used to indicate that no set value is available. + * + * @return true if the set is bogus/invalid, false otherwise + * @see setToBogus() + * @stable ICU 4.0 + */ + inline UBool isBogus(void) const; + + /** + * Make this UnicodeSet object invalid. + * The string will test true with isBogus(). + * + * A bogus set has no value. It is different from an empty set. + * It can be used to indicate that no set value is available. + * + * This utility function is used throughout the UnicodeSet + * implementation to indicate that a UnicodeSet operation failed, + * and may be used in other functions, + * especially but not exclusively when such functions do not + * take a UErrorCode for simplicity. + * + * @see isBogus() + * @stable ICU 4.0 + */ + void setToBogus(); + +public: + + enum { + /** + * Minimum value that can be stored in a UnicodeSet. + * @stable ICU 2.4 + */ + MIN_VALUE = 0, + + /** + * Maximum value that can be stored in a UnicodeSet. + * @stable ICU 2.4 + */ + MAX_VALUE = 0x10ffff + }; + + //---------------------------------------------------------------- + // Constructors &c + //---------------------------------------------------------------- + +public: + + /** + * Constructs an empty set. + * @stable ICU 2.0 + */ + UnicodeSet(); + + /** + * Constructs a set containing the given range. If end < + * start then an empty set is created. + * + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range + * @stable ICU 2.4 + */ + UnicodeSet(UChar32 start, UChar32 end); + +#ifndef U_HIDE_INTERNAL_API + /** + * @internal + */ + enum ESerialization { + kSerialized /* result of serialize() */ + }; + + /** + * Constructs a set from the output of serialize(). + * + * @param buffer the 16 bit array + * @param bufferLen the original length returned from serialize() + * @param serialization the value 'kSerialized' + * @param status error code + * + * @internal + */ + UnicodeSet(const uint16_t buffer[], int32_t bufferLen, + ESerialization serialization, UErrorCode &status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Constructs a set from the given pattern. See the class + * description for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * @stable ICU 2.0 + */ + UnicodeSet(const UnicodeString& pattern, + UErrorCode& status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Constructs a set from the given pattern. See the class + * description for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param symbols a symbol table mapping variable names to values + * and stand-in characters to UnicodeSets; may be NULL + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * @internal + */ + UnicodeSet(const UnicodeString& pattern, + uint32_t options, + const SymbolTable* symbols, + UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Constructs a set from the given pattern. See the class description + * for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param pos on input, the position in pattern at which to start parsing. + * On output, the position after the last character parsed. + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param symbols a symbol table mapping variable names to values + * and stand-in characters to UnicodeSets; may be NULL + * @param status input-output error code + * @stable ICU 2.8 + */ + UnicodeSet(const UnicodeString& pattern, ParsePosition& pos, + uint32_t options, + const SymbolTable* symbols, + UErrorCode& status); + + /** + * Constructs a set that is identical to the given UnicodeSet. + * @stable ICU 2.0 + */ + UnicodeSet(const UnicodeSet& o); + + /** + * Destructs the set. + * @stable ICU 2.0 + */ + virtual ~UnicodeSet(); + + /** + * Assigns this object to be a copy of another. + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + UnicodeSet& operator=(const UnicodeSet& o); + + /** + * Compares the specified object with this set for equality. Returns + * true if the two sets + * have the same size, and every member of the specified set is + * contained in this set (or equivalently, every member of this set is + * contained in the specified set). + * + * @param o set to be compared for equality with this set. + * @return true if the specified set is equal to this set. + * @stable ICU 2.0 + */ + virtual UBool operator==(const UnicodeSet& o) const; + + /** + * Compares the specified object with this set for equality. Returns + * true if the specified set is not equal to this set. + * @stable ICU 2.0 + */ + inline UBool operator!=(const UnicodeSet& o) const; + + /** + * Returns a copy of this object. All UnicodeFunctor objects have + * to support cloning in order to allow classes using + * UnicodeFunctors, such as Transliterator, to implement cloning. + * If this set is frozen, then the clone will be frozen as well. + * Use cloneAsThawed() for a mutable clone of a frozen set. + * @see cloneAsThawed + * @stable ICU 2.0 + */ + virtual UnicodeSet* clone() const; + + /** + * Returns the hash code value for this set. + * + * @return the hash code value for this set. + * @see Object#hashCode() + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const; + + /** + * Get a UnicodeSet pointer from a USet + * + * @param uset a USet (the ICU plain C type for UnicodeSet) + * @return the corresponding UnicodeSet pointer. + * + * @stable ICU 4.2 + */ + inline static UnicodeSet *fromUSet(USet *uset); + + /** + * Get a UnicodeSet pointer from a const USet + * + * @param uset a const USet (the ICU plain C type for UnicodeSet) + * @return the corresponding UnicodeSet pointer. + * + * @stable ICU 4.2 + */ + inline static const UnicodeSet *fromUSet(const USet *uset); + + /** + * Produce a USet * pointer for this UnicodeSet. + * USet is the plain C type for UnicodeSet + * + * @return a USet pointer for this UnicodeSet + * @stable ICU 4.2 + */ + inline USet *toUSet(); + + + /** + * Produce a const USet * pointer for this UnicodeSet. + * USet is the plain C type for UnicodeSet + * + * @return a const USet pointer for this UnicodeSet + * @stable ICU 4.2 + */ + inline const USet * toUSet() const; + + + //---------------------------------------------------------------- + // Freezable API + //---------------------------------------------------------------- + + /** + * Determines whether the set has been frozen (made immutable) or not. + * See the ICU4J Freezable interface for details. + * @return true/false for whether the set has been frozen + * @see freeze + * @see cloneAsThawed + * @stable ICU 3.8 + */ + inline UBool isFrozen() const; + + /** + * Freeze the set (make it immutable). + * Once frozen, it cannot be unfrozen and is therefore thread-safe + * until it is deleted. + * See the ICU4J Freezable interface for details. + * Freezing the set may also make some operations faster, for example + * contains() and span(). + * A frozen set will not be modified. (It remains frozen.) + * @return this set. + * @see isFrozen + * @see cloneAsThawed + * @stable ICU 3.8 + */ + UnicodeSet *freeze(); + + /** + * Clone the set and make the clone mutable. + * See the ICU4J Freezable interface for details. + * @return the mutable clone + * @see freeze + * @see isFrozen + * @stable ICU 3.8 + */ + UnicodeSet *cloneAsThawed() const; + + //---------------------------------------------------------------- + // Public API + //---------------------------------------------------------------- + + /** + * Make this object represent the range `start - end`. + * If `start > end` then this object is set to an empty range. + * A frozen set will not be modified. + * + * @param start first character in the set, inclusive + * @param end last character in the set, inclusive + * @stable ICU 2.4 + */ + UnicodeSet& set(UChar32 start, UChar32 end); + + /** + * Return true if the given position, in the given pattern, appears + * to be the start of a UnicodeSet pattern. + * @stable ICU 2.4 + */ + static UBool resemblesPattern(const UnicodeString& pattern, + int32_t pos); + + /** + * Modifies this set to represent the set specified by the given + * pattern, ignoring Unicode Pattern_White_Space characters. + * See the class description for the syntax of the pattern language. + * A frozen set will not be modified. + * @param pattern a string specifying what characters are in the set + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * Empties the set passed before applying the pattern. + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeSet& applyPattern(const UnicodeString& pattern, + UErrorCode& status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Modifies this set to represent the set specified by the given + * pattern, optionally ignoring Unicode Pattern_White_Space characters. + * See the class description for the syntax of the pattern language. + * A frozen set will not be modified. + * @param pattern a string specifying what characters are in the set + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param symbols a symbol table mapping variable names to + * values and stand-ins to UnicodeSets; may be NULL + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * Empties the set passed before applying the pattern. + * @return a reference to this + * @internal + */ + UnicodeSet& applyPattern(const UnicodeString& pattern, + uint32_t options, + const SymbolTable* symbols, + UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Parses the given pattern, starting at the given position. The + * character at pattern.charAt(pos.getIndex()) must be '[', or the + * parse fails. Parsing continues until the corresponding closing + * ']'. If a syntax error is encountered between the opening and + * closing brace, the parse fails. Upon return from a successful + * parse, the ParsePosition is updated to point to the character + * following the closing ']', and a StringBuffer containing a + * pairs list for the parsed pattern is returned. This method calls + * itself recursively to parse embedded subpatterns. + * Empties the set passed before applying the pattern. + * A frozen set will not be modified. + * + * @param pattern the string containing the pattern to be parsed. + * The portion of the string from pos.getIndex(), which must be a + * '[', to the corresponding closing ']', is parsed. + * @param pos upon entry, the position at which to being parsing. + * The character at pattern.charAt(pos.getIndex()) must be a '['. + * Upon return from a successful parse, pos.getIndex() is either + * the character after the closing ']' of the parsed pattern, or + * pattern.length() if the closing ']' is the last character of + * the pattern string. + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param symbols a symbol table mapping variable names to + * values and stand-ins to UnicodeSets; may be NULL + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * @return a reference to this + * @stable ICU 2.8 + */ + UnicodeSet& applyPattern(const UnicodeString& pattern, + ParsePosition& pos, + uint32_t options, + const SymbolTable* symbols, + UErrorCode& status); + + /** + * Returns a string representation of this set. If the result of + * calling this function is passed to a UnicodeSet constructor, it + * will produce another set that is equal to this one. + * A frozen set will not be modified. + * @param result the string to receive the rules. Previous + * contents will be deleted. + * @param escapeUnprintable if true then convert unprintable + * character to their hex escape representations, \\uxxxx or + * \\Uxxxxxxxx. Unprintable characters are those other than + * U+000A, U+0020..U+007E. + * @stable ICU 2.0 + */ + virtual UnicodeString& toPattern(UnicodeString& result, + UBool escapeUnprintable = false) const; + + /** + * Modifies this set to contain those code points which have the given value + * for the given binary or enumerated property, as returned by + * u_getIntPropertyValue. Prior contents of this set are lost. + * A frozen set will not be modified. + * + * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1 + * or UCHAR_INT_START..UCHAR_INT_LIMIT-1 + * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1. + * + * @param value a value in the range u_getIntPropertyMinValue(prop).. + * u_getIntPropertyMaxValue(prop), with one exception. If prop is + * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but + * rather a mask value produced by U_GET_GC_MASK(). This allows grouped + * categories such as [:L:] to be represented. + * + * @param ec error code input/output parameter + * + * @return a reference to this set + * + * @stable ICU 2.4 + */ + UnicodeSet& applyIntPropertyValue(UProperty prop, + int32_t value, + UErrorCode& ec); + + /** + * Modifies this set to contain those code points which have the + * given value for the given property. Prior contents of this + * set are lost. + * A frozen set will not be modified. + * + * @param prop a property alias, either short or long. The name is matched + * loosely. See PropertyAliases.txt for names and a description of loose + * matching. If the value string is empty, then this string is interpreted + * as either a General_Category value alias, a Script value alias, a binary + * property alias, or a special ID. Special IDs are matched loosely and + * correspond to the following sets: + * + * "ANY" = [\\u0000-\\U0010FFFF], + * "ASCII" = [\\u0000-\\u007F], + * "Assigned" = [:^Cn:]. + * + * @param value a value alias, either short or long. The name is matched + * loosely. See PropertyValueAliases.txt for names and a description of + * loose matching. In addition to aliases listed, numeric values and + * canonical combining classes may be expressed numerically, e.g., ("nv", + * "0.5") or ("ccc", "220"). The value string may also be empty. + * + * @param ec error code input/output parameter + * + * @return a reference to this set + * + * @stable ICU 2.4 + */ + UnicodeSet& applyPropertyAlias(const UnicodeString& prop, + const UnicodeString& value, + UErrorCode& ec); + + /** + * Returns the number of elements in this set (its cardinality). + * Note than the elements of a set may include both individual + * codepoints and strings. + * + * @return the number of elements in this set (its cardinality). + * @stable ICU 2.0 + */ + virtual int32_t size(void) const; + + /** + * Returns true if this set contains no elements. + * + * @return true if this set contains no elements. + * @stable ICU 2.0 + */ + virtual UBool isEmpty(void) const; + + /** + * Returns true if this set contains the given character. + * This function works faster with a frozen set. + * @param c character to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.0 + */ + virtual UBool contains(UChar32 c) const; + + /** + * Returns true if this set contains every character + * of the given range. + * @param start first character, inclusive, of the range + * @param end last character, inclusive, of the range + * @return true if the test condition is met + * @stable ICU 2.0 + */ + virtual UBool contains(UChar32 start, UChar32 end) const; + + /** + * Returns true if this set contains the given + * multicharacter string. + * @param s string to be checked for containment + * @return true if this set contains the specified string + * @stable ICU 2.4 + */ + UBool contains(const UnicodeString& s) const; + + /** + * Returns true if this set contains all the characters and strings + * of the given set. + * @param c set to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.4 + */ + virtual UBool containsAll(const UnicodeSet& c) const; + + /** + * Returns true if this set contains all the characters + * of the given string. + * @param s string containing characters to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.4 + */ + UBool containsAll(const UnicodeString& s) const; + + /** + * Returns true if this set contains none of the characters + * of the given range. + * @param start first character, inclusive, of the range + * @param end last character, inclusive, of the range + * @return true if the test condition is met + * @stable ICU 2.4 + */ + UBool containsNone(UChar32 start, UChar32 end) const; + + /** + * Returns true if this set contains none of the characters and strings + * of the given set. + * @param c set to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.4 + */ + UBool containsNone(const UnicodeSet& c) const; + + /** + * Returns true if this set contains none of the characters + * of the given string. + * @param s string containing characters to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.4 + */ + UBool containsNone(const UnicodeString& s) const; + + /** + * Returns true if this set contains one or more of the characters + * in the given range. + * @param start first character, inclusive, of the range + * @param end last character, inclusive, of the range + * @return true if the condition is met + * @stable ICU 2.4 + */ + inline UBool containsSome(UChar32 start, UChar32 end) const; + + /** + * Returns true if this set contains one or more of the characters + * and strings of the given set. + * @param s The set to be checked for containment + * @return true if the condition is met + * @stable ICU 2.4 + */ + inline UBool containsSome(const UnicodeSet& s) const; + + /** + * Returns true if this set contains one or more of the characters + * of the given string. + * @param s string containing characters to be checked for containment + * @return true if the condition is met + * @stable ICU 2.4 + */ + inline UBool containsSome(const UnicodeString& s) const; + + /** + * Returns the length of the initial substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Similar to the strspn() C library function. + * Unpaired surrogates are treated according to contains() of their surrogate code points. + * This function works faster with a frozen set and with a non-negative string length argument. + * @param s start of the string + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the length of the initial substring according to the spanCondition; + * 0 if the start of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ + int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; + + /** + * Returns the end of the substring of the input string according to the USetSpanCondition. + * Same as start+span(s.getBuffer()+start, s.length()-start, spanCondition) + * after pinning start to 0<=start<=s.length(). + * @param s the string + * @param start the start index in the string for the span operation + * @param spanCondition specifies the containment condition + * @return the exclusive end of the substring according to the spanCondition; + * the substring s.tempSubStringBetween(start, end) fulfills the spanCondition + * @stable ICU 4.4 + * @see USetSpanCondition + */ + inline int32_t span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const; + + /** + * Returns the start of the trailing substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Unpaired surrogates are treated according to contains() of their surrogate code points. + * This function works faster with a frozen set and with a non-negative string length argument. + * @param s start of the string + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the start of the trailing substring according to the spanCondition; + * the string length if the end of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ + int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; + + /** + * Returns the start of the substring of the input string according to the USetSpanCondition. + * Same as spanBack(s.getBuffer(), limit, spanCondition) + * after pinning limit to 0<=end<=s.length(). + * @param s the string + * @param limit the exclusive-end index in the string for the span operation + * (use s.length() or INT32_MAX for spanning back from the end of the string) + * @param spanCondition specifies the containment condition + * @return the start of the substring according to the spanCondition; + * the substring s.tempSubStringBetween(start, limit) fulfills the spanCondition + * @stable ICU 4.4 + * @see USetSpanCondition + */ + inline int32_t spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const; + + /** + * Returns the length of the initial substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Similar to the strspn() C library function. + * Malformed byte sequences are treated according to contains(0xfffd). + * This function works faster with a frozen set and with a non-negative string length argument. + * @param s start of the string (UTF-8) + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the length of the initial substring according to the spanCondition; + * 0 if the start of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ + int32_t spanUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const; + + /** + * Returns the start of the trailing substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Malformed byte sequences are treated according to contains(0xfffd). + * This function works faster with a frozen set and with a non-negative string length argument. + * @param s start of the string (UTF-8) + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the start of the trailing substring according to the spanCondition; + * the string length if the end of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ + int32_t spanBackUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const; + + /** + * Implement UnicodeMatcher::matches() + * @stable ICU 2.4 + */ + virtual UMatchDegree matches(const Replaceable& text, + int32_t& offset, + int32_t limit, + UBool incremental); + +private: + /** + * Returns the longest match for s in text at the given position. + * If limit > start then match forward from start+1 to limit + * matching all characters except s.charAt(0). If limit < start, + * go backward starting from start-1 matching all characters + * except s.charAt(s.length()-1). This method assumes that the + * first character, text.charAt(start), matches s, so it does not + * check it. + * @param text the text to match + * @param start the first character to match. In the forward + * direction, text.charAt(start) is matched against s.charAt(0). + * In the reverse direction, it is matched against + * s.charAt(s.length()-1). + * @param limit the limit offset for matching, either last+1 in + * the forward direction, or last-1 in the reverse direction, + * where last is the index of the last character to match. + * @param s + * @return If part of s matches up to the limit, return |limit - + * start|. If all of s matches before reaching the limit, return + * s.length(). If there is a mismatch between s and text, return + * 0 + */ + static int32_t matchRest(const Replaceable& text, + int32_t start, int32_t limit, + const UnicodeString& s); + + /** + * Returns the smallest value i such that c < list[i]. Caller + * must ensure that c is a legal value or this method will enter + * an infinite loop. This method performs a binary search. + * @param c a character in the range MIN_VALUE..MAX_VALUE + * inclusive + * @return the smallest integer i in the range 0..len-1, + * inclusive, such that c < list[i] + */ + int32_t findCodePoint(UChar32 c) const; + +public: + + /** + * Implementation of UnicodeMatcher API. Union the set of all + * characters that may be matched by this object into the given + * set. + * @param toUnionTo the set into which to union the source characters + * @stable ICU 2.4 + */ + virtual void addMatchSetTo(UnicodeSet& toUnionTo) const; + + /** + * Returns the index of the given character within this set, where + * the set is ordered by ascending code point. If the character + * is not in this set, return -1. The inverse of this method is + * charAt(). + * @return an index from 0..size()-1, or -1 + * @stable ICU 2.4 + */ + int32_t indexOf(UChar32 c) const; + + /** + * Returns the character at the given index within this set, where + * the set is ordered by ascending code point. If the index is + * out of range, return (UChar32)-1. The inverse of this method is + * indexOf(). + * @param index an index from 0..size()-1 + * @return the character at the given index, or (UChar32)-1. + * @stable ICU 2.4 + */ + UChar32 charAt(int32_t index) const; + + /** + * Adds the specified range to this set if it is not already + * present. If this set already contains the specified range, + * the call leaves this set unchanged. If start > end + * then an empty range is added, leaving the set unchanged. + * This is equivalent to a boolean logic OR, or a set UNION. + * A frozen set will not be modified. + * + * @param start first character, inclusive, of range to be added + * to this set. + * @param end last character, inclusive, of range to be added + * to this set. + * @stable ICU 2.0 + */ + virtual UnicodeSet& add(UChar32 start, UChar32 end); + + /** + * Adds the specified character to this set if it is not already + * present. If this set already contains the specified character, + * the call leaves this set unchanged. + * A frozen set will not be modified. + * + * @param c the character (code point) + * @return this object, for chaining + * @stable ICU 2.0 + */ + UnicodeSet& add(UChar32 c); + + /** + * Adds the specified multicharacter to this set if it is not already + * present. If this set already contains the multicharacter, + * the call leaves this set unchanged. + * Thus "ch" => {"ch"} + * A frozen set will not be modified. + * + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& add(const UnicodeString& s); + + private: + /** + * @return a code point IF the string consists of a single one. + * otherwise returns -1. + * @param s string to test + */ + static int32_t getSingleCP(const UnicodeString& s); + + void _add(const UnicodeString& s); + + public: + /** + * Adds each of the characters in this string to the set. Note: "ch" => {"c", "h"} + * If this set already contains any particular character, it has no effect on that character. + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& addAll(const UnicodeString& s); + + /** + * Retains EACH of the characters in this string. Note: "ch" == {"c", "h"} + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& retainAll(const UnicodeString& s); + + /** + * Complement EACH of the characters in this string. Note: "ch" == {"c", "h"} + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& complementAll(const UnicodeString& s); + + /** + * Remove EACH of the characters in this string. Note: "ch" == {"c", "h"} + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& removeAll(const UnicodeString& s); + + /** + * Makes a set from a multicharacter string. Thus "ch" => {"ch"} + * + * @param s the source string + * @return a newly created set containing the given string. + * The caller owns the return object and is responsible for deleting it. + * @stable ICU 2.4 + */ + static UnicodeSet* U_EXPORT2 createFrom(const UnicodeString& s); + + + /** + * Makes a set from each of the characters in the string. Thus "ch" => {"c", "h"} + * @param s the source string + * @return a newly created set containing the given characters + * The caller owns the return object and is responsible for deleting it. + * @stable ICU 2.4 + */ + static UnicodeSet* U_EXPORT2 createFromAll(const UnicodeString& s); + + /** + * Retain only the elements in this set that are contained in the + * specified range. If start > end then an empty range is + * retained, leaving the set empty. This is equivalent to + * a boolean logic AND, or a set INTERSECTION. + * A frozen set will not be modified. + * + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range + * @stable ICU 2.0 + */ + virtual UnicodeSet& retain(UChar32 start, UChar32 end); + + + /** + * Retain the specified character from this set if it is present. + * A frozen set will not be modified. + * + * @param c the character (code point) + * @return this object, for chaining + * @stable ICU 2.0 + */ + UnicodeSet& retain(UChar32 c); + +#ifndef U_HIDE_DRAFT_API + /** + * Retains only the specified string from this set if it is present. + * Upon return this set will be empty if it did not contain s, or + * will only contain s if it did contain s. + * A frozen set will not be modified. + * + * @param s the source string + * @return this object, for chaining + * @draft ICU 69 + */ + UnicodeSet& retain(const UnicodeString &s); +#endif // U_HIDE_DRAFT_API + + /** + * Removes the specified range from this set if it is present. + * The set will not contain the specified range once the call + * returns. If start > end then an empty range is + * removed, leaving the set unchanged. + * A frozen set will not be modified. + * + * @param start first character, inclusive, of range to be removed + * from this set. + * @param end last character, inclusive, of range to be removed + * from this set. + * @stable ICU 2.0 + */ + virtual UnicodeSet& remove(UChar32 start, UChar32 end); + + /** + * Removes the specified character from this set if it is present. + * The set will not contain the specified range once the call + * returns. + * A frozen set will not be modified. + * + * @param c the character (code point) + * @return this object, for chaining + * @stable ICU 2.0 + */ + UnicodeSet& remove(UChar32 c); + + /** + * Removes the specified string from this set if it is present. + * The set will not contain the specified character once the call + * returns. + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& remove(const UnicodeString& s); + + /** + * Inverts this set. This operation modifies this set so that + * its value is its complement. This is equivalent to + * complement(MIN_VALUE, MAX_VALUE). + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + virtual UnicodeSet& complement(void); + + /** + * Complements the specified range in this set. Any character in + * the range will be removed if it is in this set, or will be + * added if it is not in this set. If start > end + * then an empty range is complemented, leaving the set unchanged. + * This is equivalent to a boolean logic XOR. + * A frozen set will not be modified. + * + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range + * @stable ICU 2.0 + */ + virtual UnicodeSet& complement(UChar32 start, UChar32 end); + + /** + * Complements the specified character in this set. The character + * will be removed if it is in this set, or will be added if it is + * not in this set. + * A frozen set will not be modified. + * + * @param c the character (code point) + * @return this object, for chaining + * @stable ICU 2.0 + */ + UnicodeSet& complement(UChar32 c); + + /** + * Complement the specified string in this set. + * The string will be removed if it is in this set, or will be added if it is not in this set. + * A frozen set will not be modified. + * + * @param s the string to complement + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& complement(const UnicodeString& s); + + /** + * Adds all of the elements in the specified set to this set if + * they're not already present. This operation effectively + * modifies this set so that its value is the union of the two + * sets. The behavior of this operation is unspecified if the specified + * collection is modified while the operation is in progress. + * A frozen set will not be modified. + * + * @param c set whose elements are to be added to this set. + * @see #add(UChar32, UChar32) + * @stable ICU 2.0 + */ + virtual UnicodeSet& addAll(const UnicodeSet& c); + + /** + * Retains only the elements in this set that are contained in the + * specified set. In other words, removes from this set all of + * its elements that are not contained in the specified set. This + * operation effectively modifies this set so that its value is + * the intersection of the two sets. + * A frozen set will not be modified. + * + * @param c set that defines which elements this set will retain. + * @stable ICU 2.0 + */ + virtual UnicodeSet& retainAll(const UnicodeSet& c); + + /** + * Removes from this set all of its elements that are contained in the + * specified set. This operation effectively modifies this + * set so that its value is the asymmetric set difference of + * the two sets. + * A frozen set will not be modified. + * + * @param c set that defines which elements will be removed from + * this set. + * @stable ICU 2.0 + */ + virtual UnicodeSet& removeAll(const UnicodeSet& c); + + /** + * Complements in this set all elements contained in the specified + * set. Any character in the other set will be removed if it is + * in this set, or will be added if it is not in this set. + * A frozen set will not be modified. + * + * @param c set that defines which elements will be xor'ed from + * this set. + * @stable ICU 2.4 + */ + virtual UnicodeSet& complementAll(const UnicodeSet& c); + + /** + * Removes all of the elements from this set. This set will be + * empty after this call returns. + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + virtual UnicodeSet& clear(void); + + /** + * Close this set over the given attribute. For the attribute + * USET_CASE, the result is to modify this set so that: + * + * 1. For each character or string 'a' in this set, all strings or + * characters 'b' such that foldCase(a) == foldCase(b) are added + * to this set. + * + * 2. For each string 'e' in the resulting set, if e != + * foldCase(e), 'e' will be removed. + * + * Example: [aq\\u00DF{Bc}{bC}{Fi}] => [aAqQ\\u00DF\\uFB01{ss}{bc}{fi}] + * + * (Here foldCase(x) refers to the operation u_strFoldCase, and a + * == b denotes that the contents are the same, not pointer + * comparison.) + * + * A frozen set will not be modified. + * + * @param attribute bitmask for attributes to close over. + * Currently only the USET_CASE bit is supported. Any undefined bits + * are ignored. + * @return a reference to this set. + * @stable ICU 4.2 + */ + UnicodeSet& closeOver(int32_t attribute); + + /** + * Remove all strings from this set. + * + * @return a reference to this set. + * @stable ICU 4.2 + */ + virtual UnicodeSet &removeAllStrings(); + + /** + * Iteration method that returns the number of ranges contained in + * this set. + * @see #getRangeStart + * @see #getRangeEnd + * @stable ICU 2.4 + */ + virtual int32_t getRangeCount(void) const; + + /** + * Iteration method that returns the first character in the + * specified range of this set. + * @see #getRangeCount + * @see #getRangeEnd + * @stable ICU 2.4 + */ + virtual UChar32 getRangeStart(int32_t index) const; + + /** + * Iteration method that returns the last character in the + * specified range of this set. + * @see #getRangeStart + * @see #getRangeEnd + * @stable ICU 2.4 + */ + virtual UChar32 getRangeEnd(int32_t index) const; + + /** + * Serializes this set into an array of 16-bit integers. Serialization + * (currently) only records the characters in the set; multicharacter + * strings are ignored. + * + * The array has following format (each line is one 16-bit + * integer): + * + * length = (n+2*m) | (m!=0?0x8000:0) + * bmpLength = n; present if m!=0 + * bmp[0] + * bmp[1] + * ... + * bmp[n-1] + * supp-high[0] + * supp-low[0] + * supp-high[1] + * supp-low[1] + * ... + * supp-high[m-1] + * supp-low[m-1] + * + * The array starts with a header. After the header are n bmp + * code points, then m supplementary code points. Either n or m + * or both may be zero. n+2*m is always <= 0x7FFF. + * + * If there are no supplementary characters (if m==0) then the + * header is one 16-bit integer, 'length', with value n. + * + * If there are supplementary characters (if m!=0) then the header + * is two 16-bit integers. The first, 'length', has value + * (n+2*m)|0x8000. The second, 'bmpLength', has value n. + * + * After the header the code points are stored in ascending order. + * Supplementary code points are stored as most significant 16 + * bits followed by least significant 16 bits. + * + * @param dest pointer to buffer of destCapacity 16-bit integers. + * May be NULL only if destCapacity is zero. + * @param destCapacity size of dest, or zero. Must not be negative. + * @param ec error code. Will be set to U_INDEX_OUTOFBOUNDS_ERROR + * if n+2*m > 0x7FFF. Will be set to U_BUFFER_OVERFLOW_ERROR if + * n+2*m+(m!=0?2:1) > destCapacity. + * @return the total length of the serialized format, including + * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other + * than U_BUFFER_OVERFLOW_ERROR. + * @stable ICU 2.4 + */ + int32_t serialize(uint16_t *dest, int32_t destCapacity, UErrorCode& ec) const; + + /** + * Reallocate this objects internal structures to take up the least + * possible space, without changing this object's value. + * A frozen set will not be modified. + * @stable ICU 2.4 + */ + virtual UnicodeSet& compact(); + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + *

+     * .      Base* polymorphic_pointer = createPolymorphicObject();
+     * .      if (polymorphic_pointer->getDynamicClassID() ==
+     * .          Derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Implement UnicodeFunctor API. + * + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @stable ICU 2.4 + */ + virtual UClassID getDynamicClassID(void) const; + +private: + + // Private API for the USet API + + friend class USetAccess; + + const UnicodeString* getString(int32_t index) const; + + //---------------------------------------------------------------- + // RuleBasedTransliterator support + //---------------------------------------------------------------- + +private: + + /** + * Returns true if this set contains any character whose low byte + * is the given value. This is used by RuleBasedTransliterator for + * indexing. + */ + virtual UBool matchesIndexValue(uint8_t v) const; + +private: + friend class RBBIRuleScanner; + + //---------------------------------------------------------------- + // Implementation: Clone as thawed (see ICU4J Freezable) + //---------------------------------------------------------------- + + UnicodeSet(const UnicodeSet& o, UBool /* asThawed */); + UnicodeSet& copyFrom(const UnicodeSet& o, UBool asThawed); + + //---------------------------------------------------------------- + // Implementation: Pattern parsing + //---------------------------------------------------------------- + + void applyPatternIgnoreSpace(const UnicodeString& pattern, + ParsePosition& pos, + const SymbolTable* symbols, + UErrorCode& status); + + void applyPattern(RuleCharacterIterator& chars, + const SymbolTable* symbols, + UnicodeString& rebuiltPat, + uint32_t options, + UnicodeSet& (UnicodeSet::*caseClosure)(int32_t attribute), + int32_t depth, + UErrorCode& ec); + + //---------------------------------------------------------------- + // Implementation: Utility methods + //---------------------------------------------------------------- + + static int32_t nextCapacity(int32_t minCapacity); + + bool ensureCapacity(int32_t newLen); + + bool ensureBufferCapacity(int32_t newLen); + + void swapBuffers(void); + + UBool allocateStrings(UErrorCode &status); + UBool hasStrings() const; + int32_t stringsSize() const; + UBool stringsContains(const UnicodeString &s) const; + + UnicodeString& _toPattern(UnicodeString& result, + UBool escapeUnprintable) const; + + UnicodeString& _generatePattern(UnicodeString& result, + UBool escapeUnprintable) const; + + static void _appendToPat(UnicodeString& buf, const UnicodeString& s, UBool escapeUnprintable); + + static void _appendToPat(UnicodeString& buf, UChar32 c, UBool escapeUnprintable); + + //---------------------------------------------------------------- + // Implementation: Fundamental operators + //---------------------------------------------------------------- + + void exclusiveOr(const UChar32* other, int32_t otherLen, int8_t polarity); + + void add(const UChar32* other, int32_t otherLen, int8_t polarity); + + void retain(const UChar32* other, int32_t otherLen, int8_t polarity); + + /** + * Return true if the given position, in the given pattern, appears + * to be the start of a property set pattern [:foo:], \\p{foo}, or + * \\P{foo}, or \\N{name}. + */ + static UBool resemblesPropertyPattern(const UnicodeString& pattern, + int32_t pos); + + static UBool resemblesPropertyPattern(RuleCharacterIterator& chars, + int32_t iterOpts); + + /** + * Parse the given property pattern at the given parse position + * and set this UnicodeSet to the result. + * + * The original design document is out of date, but still useful. + * Ignore the property and value names: + * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/unicodeset_properties.html + * + * Recognized syntax: + * + * [:foo:] [:^foo:] - white space not allowed within "[:" or ":]" + * \\p{foo} \\P{foo} - white space not allowed within "\\p" or "\\P" + * \\N{name} - white space not allowed within "\\N" + * + * Other than the above restrictions, Unicode Pattern_White_Space characters are ignored. + * Case is ignored except in "\\p" and "\\P" and "\\N". In 'name' leading + * and trailing space is deleted, and internal runs of whitespace + * are collapsed to a single space. + * + * We support binary properties, enumerated properties, and the + * following non-enumerated properties: + * + * Numeric_Value + * Name + * Unicode_1_Name + * + * @param pattern the pattern string + * @param ppos on entry, the position at which to begin parsing. + * This should be one of the locations marked '^': + * + * [:blah:] \\p{blah} \\P{blah} \\N{name} + * ^ % ^ % ^ % ^ % + * + * On return, the position after the last character parsed, that is, + * the locations marked '%'. If the parse fails, ppos is returned + * unchanged. + * @param ec status + * @return a reference to this. + */ + UnicodeSet& applyPropertyPattern(const UnicodeString& pattern, + ParsePosition& ppos, + UErrorCode &ec); + + void applyPropertyPattern(RuleCharacterIterator& chars, + UnicodeString& rebuiltPat, + UErrorCode& ec); + + static const UnicodeSet* getInclusions(int32_t src, UErrorCode &status); + + /** + * A filter that returns true if the given code point should be + * included in the UnicodeSet being constructed. + */ + typedef UBool (*Filter)(UChar32 codePoint, void* context); + + /** + * Given a filter, set this UnicodeSet to the code points + * contained by that filter. The filter MUST be + * property-conformant. That is, if it returns value v for one + * code point, then it must return v for all affiliated code + * points, as defined by the inclusions list. See + * getInclusions(). + * src is a UPropertySource value. + */ + void applyFilter(Filter filter, + void* context, + const UnicodeSet* inclusions, + UErrorCode &status); + + // UCPMap is now stable ICU 63 + void applyIntPropertyValue(const UCPMap *map, + UCPMapValueFilter *filter, const void *context, + UErrorCode &errorCode); + + /** + * Set the new pattern to cache. + */ + void setPattern(const UnicodeString& newPat) { + setPattern(newPat.getBuffer(), newPat.length()); + } + void setPattern(const char16_t *newPat, int32_t newPatLen); + /** + * Release existing cached pattern. + */ + void releasePattern(); + + friend class UnicodeSetIterator; +}; + + + +inline UBool UnicodeSet::operator!=(const UnicodeSet& o) const { + return !operator==(o); +} + +inline UBool UnicodeSet::isFrozen() const { + return (UBool)(bmpSet!=NULL || stringSpan!=NULL); +} + +inline UBool UnicodeSet::containsSome(UChar32 start, UChar32 end) const { + return !containsNone(start, end); +} + +inline UBool UnicodeSet::containsSome(const UnicodeSet& s) const { + return !containsNone(s); +} + +inline UBool UnicodeSet::containsSome(const UnicodeString& s) const { + return !containsNone(s); +} + +inline UBool UnicodeSet::isBogus() const { + return (UBool)(fFlags & kIsBogus); +} + +inline UnicodeSet *UnicodeSet::fromUSet(USet *uset) { + return reinterpret_cast(uset); +} + +inline const UnicodeSet *UnicodeSet::fromUSet(const USet *uset) { + return reinterpret_cast(uset); +} + +inline USet *UnicodeSet::toUSet() { + return reinterpret_cast(this); +} + +inline const USet *UnicodeSet::toUSet() const { + return reinterpret_cast(this); +} + +inline int32_t UnicodeSet::span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const { + int32_t sLength=s.length(); + if(start<0) { + start=0; + } else if(start>sLength) { + start=sLength; + } + return start+span(s.getBuffer()+start, sLength-start, spanCondition); +} + +inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const { + int32_t sLength=s.length(); + if(limit<0) { + limit=0; + } else if(limit>sLength) { + limit=sLength; + } + return spanBack(s.getBuffer(), limit, spanCondition); +} + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unistr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unistr.h new file mode 100644 index 0000000000000000000000000000000000000000..85bd96495150d38e26aa5d602566bcdeb5e48a56 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unistr.h @@ -0,0 +1,4757 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1998-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File unistr.h +* +* Modification History: +* +* Date Name Description +* 09/25/98 stephen Creation. +* 11/11/98 stephen Changed per 11/9 code review. +* 04/20/99 stephen Overhauled per 4/16 code review. +* 11/18/99 aliu Made to inherit from Replaceable. Added method +* handleReplaceBetween(); other methods unchanged. +* 06/25/01 grhoten Remove dependency on iostream. +****************************************************************************** +*/ + +#ifndef UNISTR_H +#define UNISTR_H + +/** + * \file + * \brief C++ API: Unicode String + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include +#include "unicode/char16ptr.h" +#include "unicode/rep.h" +#include "unicode/std_string.h" +#include "unicode/stringpiece.h" +#include "unicode/bytestream.h" + +struct UConverter; // unicode/ucnv.h + +#ifndef USTRING_H +/** + * \ingroup ustring_ustrlen + * @param s Pointer to sequence of UChars. + * @return Length of sequence. + */ +U_CAPI int32_t U_EXPORT2 u_strlen(const UChar *s); +#endif + +U_NAMESPACE_BEGIN + +#if !UCONFIG_NO_BREAK_ITERATION +class BreakIterator; // unicode/brkiter.h +#endif +class Edits; + +U_NAMESPACE_END + +// Not #ifndef U_HIDE_INTERNAL_API because UnicodeString needs the UStringCaseMapper. +/** + * Internal string case mapping function type. + * All error checking must be done. + * src and dest must not overlap. + * @internal + */ +typedef int32_t U_CALLCONV +UStringCaseMapper(int32_t caseLocale, uint32_t options, +#if !UCONFIG_NO_BREAK_ITERATION + icu::BreakIterator *iter, +#endif + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, + icu::Edits *edits, + UErrorCode &errorCode); + +U_NAMESPACE_BEGIN + +class Locale; // unicode/locid.h +class StringCharacterIterator; +class UnicodeStringAppendable; // unicode/appendable.h + +/* The include has been moved to unicode/ustream.h */ + +/** + * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor + * which constructs a Unicode string from an invariant-character char * string. + * About invariant characters see utypes.h. + * This constructor has no runtime dependency on conversion code and is + * therefore recommended over ones taking a charset name string + * (where the empty string "" indicates invariant-character conversion). + * + * @stable ICU 3.2 + */ +#define US_INV icu::UnicodeString::kInvariant + +/** + * Unicode String literals in C++. + * + * Note: these macros are not recommended for new code. + * Prior to the availability of C++11 and u"unicode string literals", + * these macros were provided for portability and efficiency when + * initializing UnicodeStrings from literals. + * + * They work only for strings that contain "invariant characters", i.e., + * only latin letters, digits, and some punctuation. + * See utypes.h for details. + * + * The string parameter must be a C string literal. + * The length of the string, not including the terminating + * `NUL`, must be specified as a constant. + * @stable ICU 2.0 + */ +#if !U_CHAR16_IS_TYPEDEF +# define UNICODE_STRING(cs, _length) icu::UnicodeString(true, u ## cs, _length) +#else +# define UNICODE_STRING(cs, _length) icu::UnicodeString(true, (const char16_t*)u ## cs, _length) +#endif + +/** + * Unicode String literals in C++. + * Dependent on the platform properties, different UnicodeString + * constructors should be used to create a UnicodeString object from + * a string literal. + * The macros are defined for improved performance. + * They work only for strings that contain "invariant characters", i.e., + * only latin letters, digits, and some punctuation. + * See utypes.h for details. + * + * The string parameter must be a C string literal. + * @stable ICU 2.0 + */ +#define UNICODE_STRING_SIMPLE(cs) UNICODE_STRING(cs, -1) + +/** + * \def UNISTR_FROM_CHAR_EXPLICIT + * This can be defined to be empty or "explicit". + * If explicit, then the UnicodeString(char16_t) and UnicodeString(UChar32) + * constructors are marked as explicit, preventing their inadvertent use. + * @stable ICU 49 + */ +#ifndef UNISTR_FROM_CHAR_EXPLICIT +# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) + // Auto-"explicit" in ICU library code. +# define UNISTR_FROM_CHAR_EXPLICIT explicit +# else + // Empty by default for source code compatibility. +# define UNISTR_FROM_CHAR_EXPLICIT +# endif +#endif + +/** + * \def UNISTR_FROM_STRING_EXPLICIT + * This can be defined to be empty or "explicit". + * If explicit, then the UnicodeString(const char *) and UnicodeString(const char16_t *) + * constructors are marked as explicit, preventing their inadvertent use. + * + * In particular, this helps prevent accidentally depending on ICU conversion code + * by passing a string literal into an API with a const UnicodeString & parameter. + * @stable ICU 49 + */ +#ifndef UNISTR_FROM_STRING_EXPLICIT +# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) + // Auto-"explicit" in ICU library code. +# define UNISTR_FROM_STRING_EXPLICIT explicit +# else + // Empty by default for source code compatibility. +# define UNISTR_FROM_STRING_EXPLICIT +# endif +#endif + +/** + * \def UNISTR_OBJECT_SIZE + * Desired sizeof(UnicodeString) in bytes. + * It should be a multiple of sizeof(pointer) to avoid unusable space for padding. + * The object size may want to be a multiple of 16 bytes, + * which is a common granularity for heap allocation. + * + * Any space inside the object beyond sizeof(vtable pointer) + 2 + * is available for storing short strings inside the object. + * The bigger the object, the longer a string that can be stored inside the object, + * without additional heap allocation. + * + * Depending on a platform's pointer size, pointer alignment requirements, + * and struct padding, the compiler will usually round up sizeof(UnicodeString) + * to 4 * sizeof(pointer) (or 3 * sizeof(pointer) for P128 data models), + * to hold the fields for heap-allocated strings. + * Such a minimum size also ensures that the object is easily large enough + * to hold at least 2 char16_ts, for one supplementary code point (U16_MAX_LENGTH). + * + * sizeof(UnicodeString) >= 48 should work for all known platforms. + * + * For example, on a 64-bit machine where sizeof(vtable pointer) is 8, + * sizeof(UnicodeString) = 64 would leave space for + * (64 - sizeof(vtable pointer) - 2) / U_SIZEOF_UCHAR = (64 - 8 - 2) / 2 = 27 + * char16_ts stored inside the object. + * + * The minimum object size on a 64-bit machine would be + * 4 * sizeof(pointer) = 4 * 8 = 32 bytes, + * and the internal buffer would hold up to 11 char16_ts in that case. + * + * @see U16_MAX_LENGTH + * @stable ICU 56 + */ +#ifndef UNISTR_OBJECT_SIZE +# define UNISTR_OBJECT_SIZE 64 +#endif + +/** + * UnicodeString is a string class that stores Unicode characters directly and provides + * similar functionality as the Java String and StringBuffer/StringBuilder classes. + * It is a concrete implementation of the abstract class Replaceable (for transliteration). + * + * The UnicodeString equivalent of std::string’s clear() is remove(). + * + * A UnicodeString may "alias" an external array of characters + * (that is, point to it, rather than own the array) + * whose lifetime must then at least match the lifetime of the aliasing object. + * This aliasing may be preserved when returning a UnicodeString by value, + * depending on the compiler and the function implementation, + * via Return Value Optimization (RVO) or the move assignment operator. + * (However, the copy assignment operator does not preserve aliasing.) + * For details see the description of storage models at the end of the class API docs + * and in the User Guide chapter linked from there. + * + * The UnicodeString class is not suitable for subclassing. + * + * For an overview of Unicode strings in C and C++ see the + * [User Guide Strings chapter](https://unicode-org.github.io/icu/userguide/strings#strings-in-cc). + * + * In ICU, a Unicode string consists of 16-bit Unicode *code units*. + * A Unicode character may be stored with either one code unit + * (the most common case) or with a matched pair of special code units + * ("surrogates"). The data type for code units is char16_t. + * For single-character handling, a Unicode character code *point* is a value + * in the range 0..0x10ffff. ICU uses the UChar32 type for code points. + * + * Indexes and offsets into and lengths of strings always count code units, not code points. + * This is the same as with multi-byte char* strings in traditional string handling. + * Operations on partial strings typically do not test for code point boundaries. + * If necessary, the user needs to take care of such boundaries by testing for the code unit + * values or by using functions like + * UnicodeString::getChar32Start() and UnicodeString::getChar32Limit() + * (or, in C, the equivalent macros U16_SET_CP_START() and U16_SET_CP_LIMIT(), see utf.h). + * + * UnicodeString methods are more lenient with regard to input parameter values + * than other ICU APIs. In particular: + * - If indexes are out of bounds for a UnicodeString object + * (< 0 or > length()) then they are "pinned" to the nearest boundary. + * - If the buffer passed to an insert/append/replace operation is owned by the + * target object, e.g., calling str.append(str), an extra copy may take place + * to ensure safety. + * - If primitive string pointer values (e.g., const char16_t * or char *) + * for input strings are NULL, then those input string parameters are treated + * as if they pointed to an empty string. + * However, this is *not* the case for char * parameters for charset names + * or other IDs. + * - Most UnicodeString methods do not take a UErrorCode parameter because + * there are usually very few opportunities for failure other than a shortage + * of memory, error codes in low-level C++ string methods would be inconvenient, + * and the error code as the last parameter (ICU convention) would prevent + * the use of default parameter values. + * Instead, such methods set the UnicodeString into a "bogus" state + * (see isBogus()) if an error occurs. + * + * In string comparisons, two UnicodeString objects that are both "bogus" + * compare equal (to be transitive and prevent endless loops in sorting), + * and a "bogus" string compares less than any non-"bogus" one. + * + * Const UnicodeString methods are thread-safe. Multiple threads can use + * const methods on the same UnicodeString object simultaneously, + * but non-const methods must not be called concurrently (in multiple threads) + * with any other (const or non-const) methods. + * + * Similarly, const UnicodeString & parameters are thread-safe. + * One object may be passed in as such a parameter concurrently in multiple threads. + * This includes the const UnicodeString & parameters for + * copy construction, assignment, and cloning. + * + * UnicodeString uses several storage methods. + * String contents can be stored inside the UnicodeString object itself, + * in an allocated and shared buffer, or in an outside buffer that is "aliased". + * Most of this is done transparently, but careful aliasing in particular provides + * significant performance improvements. + * Also, the internal buffer is accessible via special functions. + * For details see the + * [User Guide Strings chapter](https://unicode-org.github.io/icu/userguide/strings#maximizing-performance-with-the-unicodestring-storage-model). + * + * @see utf.h + * @see CharacterIterator + * @stable ICU 2.0 + */ +class U_COMMON_API UnicodeString : public Replaceable +{ +public: + + /** + * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor + * which constructs a Unicode string from an invariant-character char * string. + * Use the macro US_INV instead of the full qualification for this value. + * + * @see US_INV + * @stable ICU 3.2 + */ + enum EInvariant { + /** + * @see EInvariant + * @stable ICU 3.2 + */ + kInvariant + }; + + //======================================== + // Read-only operations + //======================================== + + /* Comparison - bitwise only - for international comparison use collation */ + + /** + * Equality operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return true if `text` contains the same characters as this one, + * false otherwise. + * @stable ICU 2.0 + */ + inline UBool operator== (const UnicodeString& text) const; + + /** + * Inequality operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return false if `text` contains the same characters as this one, + * true otherwise. + * @stable ICU 2.0 + */ + inline UBool operator!= (const UnicodeString& text) const; + + /** + * Greater than operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return true if the characters in this are bitwise + * greater than the characters in `text`, false otherwise + * @stable ICU 2.0 + */ + inline UBool operator> (const UnicodeString& text) const; + + /** + * Less than operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return true if the characters in this are bitwise + * less than the characters in `text`, false otherwise + * @stable ICU 2.0 + */ + inline UBool operator< (const UnicodeString& text) const; + + /** + * Greater than or equal operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return true if the characters in this are bitwise + * greater than or equal to the characters in `text`, false otherwise + * @stable ICU 2.0 + */ + inline UBool operator>= (const UnicodeString& text) const; + + /** + * Less than or equal operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return true if the characters in this are bitwise + * less than or equal to the characters in `text`, false otherwise + * @stable ICU 2.0 + */ + inline UBool operator<= (const UnicodeString& text) const; + + /** + * Compare the characters bitwise in this UnicodeString to + * the characters in `text`. + * @param text The UnicodeString to compare to this one. + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as `text`, -1 if the characters in + * this are bitwise less than the characters in `text`, +1 if the + * characters in this are bitwise greater than the characters + * in `text`. + * @stable ICU 2.0 + */ + inline int8_t compare(const UnicodeString& text) const; + + /** + * Compare the characters bitwise in the range + * [`start`, `start + length`) with the characters + * in the **entire string** `text`. + * (The parameters "start" and "length" are not applied to the other text "text".) + * @param start the offset at which the compare operation begins + * @param length the number of characters of text to compare. + * @param text the other text to be compared against this string. + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as `text`, -1 if the characters in + * this are bitwise less than the characters in `text`, +1 if the + * characters in this are bitwise greater than the characters + * in `text`. + * @stable ICU 2.0 + */ + inline int8_t compare(int32_t start, + int32_t length, + const UnicodeString& text) const; + + /** + * Compare the characters bitwise in the range + * [`start`, `start + length`) with the characters + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`). + * @param start the offset at which the compare operation begins + * @param length the number of characters in this to compare. + * @param srcText the text to be compared + * @param srcStart the offset into `srcText` to start comparison + * @param srcLength the number of characters in `src` to compare + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as `srcText`, -1 if the characters in + * this are bitwise less than the characters in `srcText`, +1 if the + * characters in this are bitwise greater than the characters + * in `srcText`. + * @stable ICU 2.0 + */ + inline int8_t compare(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Compare the characters bitwise in this UnicodeString with the first + * `srcLength` characters in `srcChars`. + * @param srcChars The characters to compare to this UnicodeString. + * @param srcLength the number of characters in `srcChars` to compare + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as `srcChars`, -1 if the characters in + * this are bitwise less than the characters in `srcChars`, +1 if the + * characters in this are bitwise greater than the characters + * in `srcChars`. + * @stable ICU 2.0 + */ + inline int8_t compare(ConstChar16Ptr srcChars, + int32_t srcLength) const; + + /** + * Compare the characters bitwise in the range + * [`start`, `start + length`) with the first + * `length` characters in `srcChars` + * @param start the offset at which the compare operation begins + * @param length the number of characters to compare. + * @param srcChars the characters to be compared + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as `srcChars`, -1 if the characters in + * this are bitwise less than the characters in `srcChars`, +1 if the + * characters in this are bitwise greater than the characters + * in `srcChars`. + * @stable ICU 2.0 + */ + inline int8_t compare(int32_t start, + int32_t length, + const char16_t *srcChars) const; + + /** + * Compare the characters bitwise in the range + * [`start`, `start + length`) with the characters + * in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`). + * @param start the offset at which the compare operation begins + * @param length the number of characters in this to compare + * @param srcChars the characters to be compared + * @param srcStart the offset into `srcChars` to start comparison + * @param srcLength the number of characters in `srcChars` to compare + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as `srcChars`, -1 if the characters in + * this are bitwise less than the characters in `srcChars`, +1 if the + * characters in this are bitwise greater than the characters + * in `srcChars`. + * @stable ICU 2.0 + */ + inline int8_t compare(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Compare the characters bitwise in the range + * [`start`, `limit`) with the characters + * in `srcText` in the range + * [`srcStart`, `srcLimit`). + * @param start the offset at which the compare operation begins + * @param limit the offset immediately following the compare operation + * @param srcText the text to be compared + * @param srcStart the offset into `srcText` to start comparison + * @param srcLimit the offset into `srcText` to limit comparison + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as `srcText`, -1 if the characters in + * this are bitwise less than the characters in `srcText`, +1 if the + * characters in this are bitwise greater than the characters + * in `srcText`. + * @stable ICU 2.0 + */ + inline int8_t compareBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param text Another string to compare this one to. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(const UnicodeString& text) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcText Another string to compare this one to. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(int32_t start, + int32_t length, + const UnicodeString& srcText) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcText Another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLength The number of code units from that string to compare. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param srcChars A pointer to another string to compare this one to. + * @param srcLength The number of code units from that string to compare. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(ConstChar16Ptr srcChars, + int32_t srcLength) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcChars A pointer to another string to compare this one to. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(int32_t start, + int32_t length, + const char16_t *srcChars) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcChars A pointer to another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLength The number of code units from that string to compare. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param limit The offset after the last code unit from this string to compare. + * @param srcText Another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLimit The offset after the last code unit from that string to compare. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrderBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(text.foldCase(options)). + * + * @param text Another string to compare this one to. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(const UnicodeString& text, uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcText Another string to compare this one to. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(int32_t start, + int32_t length, + const UnicodeString& srcText, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcText Another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLength The number of code units from that string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)). + * + * @param srcChars A pointer to another string to compare this one to. + * @param srcLength The number of code units from that string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(ConstChar16Ptr srcChars, + int32_t srcLength, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcChars A pointer to another string to compare this one to. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(int32_t start, + int32_t length, + const char16_t *srcChars, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcChars A pointer to another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLength The number of code units from that string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compareBetween(text.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param limit The offset after the last code unit from this string to compare. + * @param srcText Another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLimit The offset after the last code unit from that string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompareBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit, + uint32_t options) const; + + /** + * Determine if this starts with the characters in `text` + * @param text The text to match. + * @return true if this starts with the characters in `text`, + * false otherwise + * @stable ICU 2.0 + */ + inline UBool startsWith(const UnicodeString& text) const; + + /** + * Determine if this starts with the characters in `srcText` + * in the range [`srcStart`, `srcStart + srcLength`). + * @param srcText The text to match. + * @param srcStart the offset into `srcText` to start matching + * @param srcLength the number of characters in `srcText` to match + * @return true if this starts with the characters in `text`, + * false otherwise + * @stable ICU 2.0 + */ + inline UBool startsWith(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Determine if this starts with the characters in `srcChars` + * @param srcChars The characters to match. + * @param srcLength the number of characters in `srcChars` + * @return true if this starts with the characters in `srcChars`, + * false otherwise + * @stable ICU 2.0 + */ + inline UBool startsWith(ConstChar16Ptr srcChars, + int32_t srcLength) const; + + /** + * Determine if this ends with the characters in `srcChars` + * in the range [`srcStart`, `srcStart + srcLength`). + * @param srcChars The characters to match. + * @param srcStart the offset into `srcText` to start matching + * @param srcLength the number of characters in `srcChars` to match + * @return true if this ends with the characters in `srcChars`, false otherwise + * @stable ICU 2.0 + */ + inline UBool startsWith(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Determine if this ends with the characters in `text` + * @param text The text to match. + * @return true if this ends with the characters in `text`, + * false otherwise + * @stable ICU 2.0 + */ + inline UBool endsWith(const UnicodeString& text) const; + + /** + * Determine if this ends with the characters in `srcText` + * in the range [`srcStart`, `srcStart + srcLength`). + * @param srcText The text to match. + * @param srcStart the offset into `srcText` to start matching + * @param srcLength the number of characters in `srcText` to match + * @return true if this ends with the characters in `text`, + * false otherwise + * @stable ICU 2.0 + */ + inline UBool endsWith(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Determine if this ends with the characters in `srcChars` + * @param srcChars The characters to match. + * @param srcLength the number of characters in `srcChars` + * @return true if this ends with the characters in `srcChars`, + * false otherwise + * @stable ICU 2.0 + */ + inline UBool endsWith(ConstChar16Ptr srcChars, + int32_t srcLength) const; + + /** + * Determine if this ends with the characters in `srcChars` + * in the range [`srcStart`, `srcStart + srcLength`). + * @param srcChars The characters to match. + * @param srcStart the offset into `srcText` to start matching + * @param srcLength the number of characters in `srcChars` to match + * @return true if this ends with the characters in `srcChars`, + * false otherwise + * @stable ICU 2.0 + */ + inline UBool endsWith(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + + /* Searching - bitwise only */ + + /** + * Locate in this the first occurrence of the characters in `text`, + * using bitwise comparison. + * @param text The text to search for. + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const UnicodeString& text) const; + + /** + * Locate in this the first occurrence of the characters in `text` + * starting at offset `start`, using bitwise comparison. + * @param text The text to search for. + * @param start The offset at which searching will start. + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const UnicodeString& text, + int32_t start) const; + + /** + * Locate in this the first occurrence in the range + * [`start`, `start + length`) of the characters + * in `text`, using bitwise comparison. + * @param text The text to search for. + * @param start The offset at which searching will start. + * @param length The number of characters to search + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const UnicodeString& text, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence in the range + * [`start`, `start + length`) of the characters + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`), + * using bitwise comparison. + * @param srcText The text to search for. + * @param srcStart the offset into `srcText` at which + * to start matching + * @param srcLength the number of characters in `srcText` to match + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence of the characters in + * `srcChars` + * starting at offset `start`, using bitwise comparison. + * @param srcChars The text to search for. + * @param srcLength the number of characters in `srcChars` to match + * @param start the offset into this at which to start matching + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const char16_t *srcChars, + int32_t srcLength, + int32_t start) const; + + /** + * Locate in this the first occurrence in the range + * [`start`, `start + length`) of the characters + * in `srcChars`, using bitwise comparison. + * @param srcChars The text to search for. + * @param srcLength the number of characters in `srcChars` + * @param start The offset at which searching will start. + * @param length The number of characters to search + * @return The offset into this of the start of `srcChars`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(ConstChar16Ptr srcChars, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence in the range + * [`start`, `start + length`) of the characters + * in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`), + * using bitwise comparison. + * @param srcChars The text to search for. + * @param srcStart the offset into `srcChars` at which + * to start matching + * @param srcLength the number of characters in `srcChars` to match + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + int32_t indexOf(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence of the BMP code point `c`, + * using bitwise comparison. + * @param c The code unit to search for. + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(char16_t c) const; + + /** + * Locate in this the first occurrence of the code point `c`, + * using bitwise comparison. + * + * @param c The code point to search for. + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(UChar32 c) const; + + /** + * Locate in this the first occurrence of the BMP code point `c`, + * starting at offset `start`, using bitwise comparison. + * @param c The code unit to search for. + * @param start The offset at which searching will start. + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(char16_t c, + int32_t start) const; + + /** + * Locate in this the first occurrence of the code point `c` + * starting at offset `start`, using bitwise comparison. + * + * @param c The code point to search for. + * @param start The offset at which searching will start. + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(UChar32 c, + int32_t start) const; + + /** + * Locate in this the first occurrence of the BMP code point `c` + * in the range [`start`, `start + length`), + * using bitwise comparison. + * @param c The code unit to search for. + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(char16_t c, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence of the code point `c` + * in the range [`start`, `start + length`), + * using bitwise comparison. + * + * @param c The code point to search for. + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(UChar32 c, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence of the characters in `text`, + * using bitwise comparison. + * @param text The text to search for. + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const UnicodeString& text) const; + + /** + * Locate in this the last occurrence of the characters in `text` + * starting at offset `start`, using bitwise comparison. + * @param text The text to search for. + * @param start The offset at which searching will start. + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const UnicodeString& text, + int32_t start) const; + + /** + * Locate in this the last occurrence in the range + * [`start`, `start + length`) of the characters + * in `text`, using bitwise comparison. + * @param text The text to search for. + * @param start The offset at which searching will start. + * @param length The number of characters to search + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const UnicodeString& text, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence in the range + * [`start`, `start + length`) of the characters + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`), + * using bitwise comparison. + * @param srcText The text to search for. + * @param srcStart the offset into `srcText` at which + * to start matching + * @param srcLength the number of characters in `srcText` to match + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence of the characters in `srcChars` + * starting at offset `start`, using bitwise comparison. + * @param srcChars The text to search for. + * @param srcLength the number of characters in `srcChars` to match + * @param start the offset into this at which to start matching + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const char16_t *srcChars, + int32_t srcLength, + int32_t start) const; + + /** + * Locate in this the last occurrence in the range + * [`start`, `start + length`) of the characters + * in `srcChars`, using bitwise comparison. + * @param srcChars The text to search for. + * @param srcLength the number of characters in `srcChars` + * @param start The offset at which searching will start. + * @param length The number of characters to search + * @return The offset into this of the start of `srcChars`, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(ConstChar16Ptr srcChars, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence in the range + * [`start`, `start + length`) of the characters + * in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`), + * using bitwise comparison. + * @param srcChars The text to search for. + * @param srcStart the offset into `srcChars` at which + * to start matching + * @param srcLength the number of characters in `srcChars` to match + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of the start of `text`, + * or -1 if not found. + * @stable ICU 2.0 + */ + int32_t lastIndexOf(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence of the BMP code point `c`, + * using bitwise comparison. + * @param c The code unit to search for. + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(char16_t c) const; + + /** + * Locate in this the last occurrence of the code point `c`, + * using bitwise comparison. + * + * @param c The code point to search for. + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(UChar32 c) const; + + /** + * Locate in this the last occurrence of the BMP code point `c` + * starting at offset `start`, using bitwise comparison. + * @param c The code unit to search for. + * @param start The offset at which searching will start. + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(char16_t c, + int32_t start) const; + + /** + * Locate in this the last occurrence of the code point `c` + * starting at offset `start`, using bitwise comparison. + * + * @param c The code point to search for. + * @param start The offset at which searching will start. + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(UChar32 c, + int32_t start) const; + + /** + * Locate in this the last occurrence of the BMP code point `c` + * in the range [`start`, `start + length`), + * using bitwise comparison. + * @param c The code unit to search for. + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(char16_t c, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence of the code point `c` + * in the range [`start`, `start + length`), + * using bitwise comparison. + * + * @param c The code point to search for. + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of `c`, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(UChar32 c, + int32_t start, + int32_t length) const; + + + /* Character access */ + + /** + * Return the code unit at offset `offset`. + * If the offset is not valid (0..length()-1) then U+ffff is returned. + * @param offset a valid offset into the text + * @return the code unit at offset `offset` + * or 0xffff if the offset is not valid for this string + * @stable ICU 2.0 + */ + inline char16_t charAt(int32_t offset) const; + + /** + * Return the code unit at offset `offset`. + * If the offset is not valid (0..length()-1) then U+ffff is returned. + * @param offset a valid offset into the text + * @return the code unit at offset `offset` + * @stable ICU 2.0 + */ + inline char16_t operator[] (int32_t offset) const; + + /** + * Return the code point that contains the code unit + * at offset `offset`. + * If the offset is not valid (0..length()-1) then U+ffff is returned. + * @param offset a valid offset into the text + * that indicates the text offset of any of the code units + * that will be assembled into a code point (21-bit value) and returned + * @return the code point of text at `offset` + * or 0xffff if the offset is not valid for this string + * @stable ICU 2.0 + */ + UChar32 char32At(int32_t offset) const; + + /** + * Adjust a random-access offset so that + * it points to the beginning of a Unicode character. + * The offset that is passed in points to + * any code unit of a code point, + * while the returned offset will point to the first code unit + * of the same code point. + * In UTF-16, if the input offset points to a second surrogate + * of a surrogate pair, then the returned offset will point + * to the first surrogate. + * @param offset a valid offset into one code point of the text + * @return offset of the first code unit of the same code point + * @see U16_SET_CP_START + * @stable ICU 2.0 + */ + int32_t getChar32Start(int32_t offset) const; + + /** + * Adjust a random-access offset so that + * it points behind a Unicode character. + * The offset that is passed in points behind + * any code unit of a code point, + * while the returned offset will point behind the last code unit + * of the same code point. + * In UTF-16, if the input offset points behind the first surrogate + * (i.e., to the second surrogate) + * of a surrogate pair, then the returned offset will point + * behind the second surrogate (i.e., to the first surrogate). + * @param offset a valid offset after any code unit of a code point of the text + * @return offset of the first code unit after the same code point + * @see U16_SET_CP_LIMIT + * @stable ICU 2.0 + */ + int32_t getChar32Limit(int32_t offset) const; + + /** + * Move the code unit index along the string by delta code points. + * Interpret the input index as a code unit-based offset into the string, + * move the index forward or backward by delta code points, and + * return the resulting index. + * The input index should point to the first code unit of a code point, + * if there is more than one. + * + * Both input and output indexes are code unit-based as for all + * string indexes/offsets in ICU (and other libraries, like MBCS char*). + * If delta<0 then the index is moved backward (toward the start of the string). + * If delta>0 then the index is moved forward (toward the end of the string). + * + * This behaves like CharacterIterator::move32(delta, kCurrent). + * + * Behavior for out-of-bounds indexes: + * `moveIndex32` pins the input index to 0..length(), i.e., + * if the input index<0 then it is pinned to 0; + * if it is index>length() then it is pinned to length(). + * Afterwards, the index is moved by `delta` code points + * forward or backward, + * but no further backward than to 0 and no further forward than to length(). + * The resulting index return value will be in between 0 and length(), inclusively. + * + * Examples: + * \code + * // s has code points 'a' U+10000 'b' U+10ffff U+2029 + * UnicodeString s(u"a\U00010000b\U0010ffff\u2029"); + * + * // initial index: position of U+10000 + * int32_t index=1; + * + * // the following examples will all result in index==4, position of U+10ffff + * + * // skip 2 code points from some position in the string + * index=s.moveIndex32(index, 2); // skips U+10000 and 'b' + * + * // go to the 3rd code point from the start of s (0-based) + * index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b' + * + * // go to the next-to-last code point of s + * index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff + * \endcode + * + * @param index input code unit index + * @param delta (signed) code point count to move the index forward or backward + * in the string + * @return the resulting code unit index + * @stable ICU 2.0 + */ + int32_t moveIndex32(int32_t index, int32_t delta) const; + + /* Substring extraction */ + + /** + * Copy the characters in the range + * [`start`, `start + length`) into the array `dst`, + * beginning at `dstStart`. + * If the string aliases to `dst` itself as an external buffer, + * then extract() will not copy the contents. + * + * @param start offset of first character which will be copied into the array + * @param length the number of characters to extract + * @param dst array in which to copy characters. The length of `dst` + * must be at least (`dstStart + length`). + * @param dstStart the offset in `dst` where the first character + * will be extracted + * @stable ICU 2.0 + */ + inline void extract(int32_t start, + int32_t length, + Char16Ptr dst, + int32_t dstStart = 0) const; + + /** + * Copy the contents of the string into dest. + * This is a convenience function that + * checks if there is enough space in dest, + * extracts the entire string if possible, + * and NUL-terminates dest if possible. + * + * If the string fits into dest but cannot be NUL-terminated + * (length()==destCapacity) then the error code is set to U_STRING_NOT_TERMINATED_WARNING. + * If the string itself does not fit into dest + * (length()>destCapacity) then the error code is set to U_BUFFER_OVERFLOW_ERROR. + * + * If the string aliases to `dest` itself as an external buffer, + * then extract() will not copy the contents. + * + * @param dest Destination string buffer. + * @param destCapacity Number of char16_ts available at dest. + * @param errorCode ICU error code. + * @return length() + * @stable ICU 2.0 + */ + int32_t + extract(Char16Ptr dest, int32_t destCapacity, + UErrorCode &errorCode) const; + + /** + * Copy the characters in the range + * [`start`, `start + length`) into the UnicodeString + * `target`. + * @param start offset of first character which will be copied + * @param length the number of characters to extract + * @param target UnicodeString into which to copy characters. + * @stable ICU 2.0 + */ + inline void extract(int32_t start, + int32_t length, + UnicodeString& target) const; + + /** + * Copy the characters in the range [`start`, `limit`) + * into the array `dst`, beginning at `dstStart`. + * @param start offset of first character which will be copied into the array + * @param limit offset immediately following the last character to be copied + * @param dst array in which to copy characters. The length of `dst` + * must be at least (`dstStart + (limit - start)`). + * @param dstStart the offset in `dst` where the first character + * will be extracted + * @stable ICU 2.0 + */ + inline void extractBetween(int32_t start, + int32_t limit, + char16_t *dst, + int32_t dstStart = 0) const; + + /** + * Copy the characters in the range [`start`, `limit`) + * into the UnicodeString `target`. Replaceable API. + * @param start offset of first character which will be copied + * @param limit offset immediately following the last character to be copied + * @param target UnicodeString into which to copy characters. + * @stable ICU 2.0 + */ + virtual void extractBetween(int32_t start, + int32_t limit, + UnicodeString& target) const; + + /** + * Copy the characters in the range + * [`start`, `start + startLength`) into an array of characters. + * All characters must be invariant (see utypes.h). + * Use US_INV as the last, signature-distinguishing parameter. + * + * This function does not write any more than `targetCapacity` + * characters but returns the length of the entire output string + * so that one can allocate a larger buffer and call the function again + * if necessary. + * The output string is NUL-terminated if possible. + * + * @param start offset of first character which will be copied + * @param startLength the number of characters to extract + * @param target the target buffer for extraction, can be NULL + * if targetLength is 0 + * @param targetCapacity the length of the target buffer + * @param inv Signature-distinguishing paramater, use US_INV. + * @return the output string length, not including the terminating NUL + * @stable ICU 3.2 + */ + int32_t extract(int32_t start, + int32_t startLength, + char *target, + int32_t targetCapacity, + enum EInvariant inv) const; + +#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION + + /** + * Copy the characters in the range + * [`start`, `start + length`) into an array of characters + * in the platform's default codepage. + * This function does not write any more than `targetLength` + * characters but returns the length of the entire output string + * so that one can allocate a larger buffer and call the function again + * if necessary. + * The output string is NUL-terminated if possible. + * + * @param start offset of first character which will be copied + * @param startLength the number of characters to extract + * @param target the target buffer for extraction + * @param targetLength the length of the target buffer + * If `target` is NULL, then the number of bytes required for + * `target` is returned. + * @return the output string length, not including the terminating NUL + * @stable ICU 2.0 + */ + int32_t extract(int32_t start, + int32_t startLength, + char *target, + uint32_t targetLength) const; + +#endif + +#if !UCONFIG_NO_CONVERSION + + /** + * Copy the characters in the range + * [`start`, `start + length`) into an array of characters + * in a specified codepage. + * The output string is NUL-terminated. + * + * Recommendation: For invariant-character strings use + * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const + * because it avoids object code dependencies of UnicodeString on + * the conversion code. + * + * @param start offset of first character which will be copied + * @param startLength the number of characters to extract + * @param target the target buffer for extraction + * @param codepage the desired codepage for the characters. 0 has + * the special meaning of the default codepage + * If `codepage` is an empty string (`""`), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + * If `target` is NULL, then the number of bytes required for + * `target` is returned. It is assumed that the target is big enough + * to fit all of the characters. + * @return the output string length, not including the terminating NUL + * @stable ICU 2.0 + */ + inline int32_t extract(int32_t start, + int32_t startLength, + char *target, + const char *codepage = 0) const; + + /** + * Copy the characters in the range + * [`start`, `start + length`) into an array of characters + * in a specified codepage. + * This function does not write any more than `targetLength` + * characters but returns the length of the entire output string + * so that one can allocate a larger buffer and call the function again + * if necessary. + * The output string is NUL-terminated if possible. + * + * Recommendation: For invariant-character strings use + * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const + * because it avoids object code dependencies of UnicodeString on + * the conversion code. + * + * @param start offset of first character which will be copied + * @param startLength the number of characters to extract + * @param target the target buffer for extraction + * @param targetLength the length of the target buffer + * @param codepage the desired codepage for the characters. 0 has + * the special meaning of the default codepage + * If `codepage` is an empty string (`""`), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + * If `target` is NULL, then the number of bytes required for + * `target` is returned. + * @return the output string length, not including the terminating NUL + * @stable ICU 2.0 + */ + int32_t extract(int32_t start, + int32_t startLength, + char *target, + uint32_t targetLength, + const char *codepage) const; + + /** + * Convert the UnicodeString into a codepage string using an existing UConverter. + * The output string is NUL-terminated if possible. + * + * This function avoids the overhead of opening and closing a converter if + * multiple strings are extracted. + * + * @param dest destination string buffer, can be NULL if destCapacity==0 + * @param destCapacity the number of chars available at dest + * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called), + * or NULL for the default converter + * @param errorCode normal ICU error code + * @return the length of the output string, not counting the terminating NUL; + * if the length is greater than destCapacity, then the string will not fit + * and a buffer of the indicated length would need to be passed in + * @stable ICU 2.0 + */ + int32_t extract(char *dest, int32_t destCapacity, + UConverter *cnv, + UErrorCode &errorCode) const; + +#endif + + /** + * Create a temporary substring for the specified range. + * Unlike the substring constructor and setTo() functions, + * the object returned here will be a read-only alias (using getBuffer()) + * rather than copying the text. + * As a result, this substring operation is much faster but requires + * that the original string not be modified or deleted during the lifetime + * of the returned substring object. + * @param start offset of the first character visible in the substring + * @param length length of the substring + * @return a read-only alias UnicodeString object for the substring + * @stable ICU 4.4 + */ + UnicodeString tempSubString(int32_t start=0, int32_t length=INT32_MAX) const; + + /** + * Create a temporary substring for the specified range. + * Same as tempSubString(start, length) except that the substring range + * is specified as a (start, limit) pair (with an exclusive limit index) + * rather than a (start, length) pair. + * @param start offset of the first character visible in the substring + * @param limit offset immediately following the last character visible in the substring + * @return a read-only alias UnicodeString object for the substring + * @stable ICU 4.4 + */ + inline UnicodeString tempSubStringBetween(int32_t start, int32_t limit=INT32_MAX) const; + + /** + * Convert the UnicodeString to UTF-8 and write the result + * to a ByteSink. This is called by toUTF8String(). + * Unpaired surrogates are replaced with U+FFFD. + * Calls u_strToUTF8WithSub(). + * + * @param sink A ByteSink to which the UTF-8 version of the string is written. + * sink.Flush() is called at the end. + * @stable ICU 4.2 + * @see toUTF8String + */ + void toUTF8(ByteSink &sink) const; + + /** + * Convert the UnicodeString to UTF-8 and append the result + * to a standard string. + * Unpaired surrogates are replaced with U+FFFD. + * Calls toUTF8(). + * + * @param result A standard string (or a compatible object) + * to which the UTF-8 version of the string is appended. + * @return The string object. + * @stable ICU 4.2 + * @see toUTF8 + */ + template + StringClass &toUTF8String(StringClass &result) const { + StringByteSink sbs(&result, length()); + toUTF8(sbs); + return result; + } + + /** + * Convert the UnicodeString to UTF-32. + * Unpaired surrogates are replaced with U+FFFD. + * Calls u_strToUTF32WithSub(). + * + * @param utf32 destination string buffer, can be NULL if capacity==0 + * @param capacity the number of UChar32s available at utf32 + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The length of the UTF-32 string. + * @see fromUTF32 + * @stable ICU 4.2 + */ + int32_t toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode) const; + + /* Length operations */ + + /** + * Return the length of the UnicodeString object. + * The length is the number of char16_t code units are in the UnicodeString. + * If you want the number of code points, please use countChar32(). + * @return the length of the UnicodeString object + * @see countChar32 + * @stable ICU 2.0 + */ + inline int32_t length(void) const; + + /** + * Count Unicode code points in the length char16_t code units of the string. + * A code point may occupy either one or two char16_t code units. + * Counting code points involves reading all code units. + * + * This functions is basically the inverse of moveIndex32(). + * + * @param start the index of the first code unit to check + * @param length the number of char16_t code units to check + * @return the number of code points in the specified code units + * @see length + * @stable ICU 2.0 + */ + int32_t + countChar32(int32_t start=0, int32_t length=INT32_MAX) const; + + /** + * Check if the length char16_t code units of the string + * contain more Unicode code points than a certain number. + * This is more efficient than counting all code points in this part of the string + * and comparing that number with a threshold. + * This function may not need to scan the string at all if the length + * falls within a certain range, and + * never needs to count more than 'number+1' code points. + * Logically equivalent to (countChar32(start, length)>number). + * A Unicode code point may occupy either one or two char16_t code units. + * + * @param start the index of the first code unit to check (0 for the entire string) + * @param length the number of char16_t code units to check + * (use INT32_MAX for the entire string; remember that start/length + * values are pinned) + * @param number The number of code points in the (sub)string is compared against + * the 'number' parameter. + * @return Boolean value for whether the string contains more Unicode code points + * than 'number'. Same as (u_countChar32(s, length)>number). + * @see countChar32 + * @see u_strHasMoreChar32Than + * @stable ICU 2.4 + */ + UBool + hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const; + + /** + * Determine if this string is empty. + * @return true if this string contains 0 characters, false otherwise. + * @stable ICU 2.0 + */ + inline UBool isEmpty(void) const; + + /** + * Return the capacity of the internal buffer of the UnicodeString object. + * This is useful together with the getBuffer functions. + * See there for details. + * + * @return the number of char16_ts available in the internal buffer + * @see getBuffer + * @stable ICU 2.0 + */ + inline int32_t getCapacity(void) const; + + /* Other operations */ + + /** + * Generate a hash code for this object. + * @return The hash code of this UnicodeString. + * @stable ICU 2.0 + */ + inline int32_t hashCode(void) const; + + /** + * Determine if this object contains a valid string. + * A bogus string has no value. It is different from an empty string, + * although in both cases isEmpty() returns true and length() returns 0. + * setToBogus() and isBogus() can be used to indicate that no string value is available. + * For a bogus string, getBuffer() and getTerminatedBuffer() return NULL, and + * length() returns 0. + * + * @return true if the string is bogus/invalid, false otherwise + * @see setToBogus() + * @stable ICU 2.0 + */ + inline UBool isBogus(void) const; + + + //======================================== + // Write operations + //======================================== + + /* Assignment operations */ + + /** + * Assignment operator. Replace the characters in this UnicodeString + * with the characters from `srcText`. + * + * Starting with ICU 2.4, the assignment operator and the copy constructor + * allocate a new buffer and copy the buffer contents even for readonly aliases. + * By contrast, the fastCopyFrom() function implements the old, + * more efficient but less safe behavior + * of making this string also a readonly alias to the same buffer. + * + * If the source object has an "open" buffer from getBuffer(minCapacity), + * then the copy is an empty string. + * + * @param srcText The text containing the characters to replace + * @return a reference to this + * @stable ICU 2.0 + * @see fastCopyFrom + */ + UnicodeString &operator=(const UnicodeString &srcText); + + /** + * Almost the same as the assignment operator. + * Replace the characters in this UnicodeString + * with the characters from `srcText`. + * + * This function works the same as the assignment operator + * for all strings except for ones that are readonly aliases. + * + * Starting with ICU 2.4, the assignment operator and the copy constructor + * allocate a new buffer and copy the buffer contents even for readonly aliases. + * This function implements the old, more efficient but less safe behavior + * of making this string also a readonly alias to the same buffer. + * + * The fastCopyFrom function must be used only if it is known that the lifetime of + * this UnicodeString does not exceed the lifetime of the aliased buffer + * including its contents, for example for strings from resource bundles + * or aliases to string constants. + * + * If the source object has an "open" buffer from getBuffer(minCapacity), + * then the copy is an empty string. + * + * @param src The text containing the characters to replace. + * @return a reference to this + * @stable ICU 2.4 + */ + UnicodeString &fastCopyFrom(const UnicodeString &src); + + /** + * Move assignment operator; might leave src in bogus state. + * This string will have the same contents and state that the source string had. + * The behavior is undefined if *this and src are the same object. + * @param src source string + * @return *this + * @stable ICU 56 + */ + UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT; + + /** + * Swap strings. + * @param other other string + * @stable ICU 56 + */ + void swap(UnicodeString &other) U_NOEXCEPT; + + /** + * Non-member UnicodeString swap function. + * @param s1 will get s2's contents and state + * @param s2 will get s1's contents and state + * @stable ICU 56 + */ + friend inline void U_EXPORT2 + swap(UnicodeString &s1, UnicodeString &s2) U_NOEXCEPT { + s1.swap(s2); + } + + /** + * Assignment operator. Replace the characters in this UnicodeString + * with the code unit `ch`. + * @param ch the code unit to replace + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator= (char16_t ch); + + /** + * Assignment operator. Replace the characters in this UnicodeString + * with the code point `ch`. + * @param ch the code point to replace + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator= (UChar32 ch); + + /** + * Set the text in the UnicodeString object to the characters + * in `srcText` in the range + * [`srcStart`, `srcText.length()`). + * `srcText` is not modified. + * @param srcText the source for the new characters + * @param srcStart the offset into `srcText` where new characters + * will be obtained + * @return a reference to this + * @stable ICU 2.2 + */ + inline UnicodeString& setTo(const UnicodeString& srcText, + int32_t srcStart); + + /** + * Set the text in the UnicodeString object to the characters + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`). + * `srcText` is not modified. + * @param srcText the source for the new characters + * @param srcStart the offset into `srcText` where new characters + * will be obtained + * @param srcLength the number of characters in `srcText` in the + * replace string. + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& setTo(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + /** + * Set the text in the UnicodeString object to the characters in + * `srcText`. + * `srcText` is not modified. + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& setTo(const UnicodeString& srcText); + + /** + * Set the characters in the UnicodeString object to the characters + * in `srcChars`. `srcChars` is not modified. + * @param srcChars the source for the new characters + * @param srcLength the number of Unicode characters in srcChars. + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& setTo(const char16_t *srcChars, + int32_t srcLength); + + /** + * Set the characters in the UnicodeString object to the code unit + * `srcChar`. + * @param srcChar the code unit which becomes the UnicodeString's character + * content + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& setTo(char16_t srcChar); + + /** + * Set the characters in the UnicodeString object to the code point + * `srcChar`. + * @param srcChar the code point which becomes the UnicodeString's character + * content + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& setTo(UChar32 srcChar); + + /** + * Aliasing setTo() function, analogous to the readonly-aliasing char16_t* constructor. + * The text will be used for the UnicodeString object, but + * it will not be released when the UnicodeString is destroyed. + * This has copy-on-write semantics: + * When the string is modified, then the buffer is first copied into + * newly allocated memory. + * The aliased buffer is never modified. + * + * In an assignment to another UnicodeString, when using the copy constructor + * or the assignment operator, the text will be copied. + * When using fastCopyFrom(), the text will be aliased again, + * so that both strings then alias the same readonly-text. + * + * @param isTerminated specifies if `text` is `NUL`-terminated. + * This must be true if `textLength==-1`. + * @param text The characters to alias for the UnicodeString. + * @param textLength The number of Unicode characters in `text` to alias. + * If -1, then this constructor will determine the length + * by calling `u_strlen()`. + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString &setTo(UBool isTerminated, + ConstChar16Ptr text, + int32_t textLength); + + /** + * Aliasing setTo() function, analogous to the writable-aliasing char16_t* constructor. + * The text will be used for the UnicodeString object, but + * it will not be released when the UnicodeString is destroyed. + * This has write-through semantics: + * For as long as the capacity of the buffer is sufficient, write operations + * will directly affect the buffer. When more capacity is necessary, then + * a new buffer will be allocated and the contents copied as with regularly + * constructed strings. + * In an assignment to another UnicodeString, the buffer will be copied. + * The extract(Char16Ptr dst) function detects whether the dst pointer is the same + * as the string buffer itself and will in this case not copy the contents. + * + * @param buffer The characters to alias for the UnicodeString. + * @param buffLength The number of Unicode characters in `buffer` to alias. + * @param buffCapacity The size of `buffer` in char16_ts. + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString &setTo(char16_t *buffer, + int32_t buffLength, + int32_t buffCapacity); + + /** + * Make this UnicodeString object invalid. + * The string will test true with isBogus(). + * + * A bogus string has no value. It is different from an empty string. + * It can be used to indicate that no string value is available. + * getBuffer() and getTerminatedBuffer() return NULL, and + * length() returns 0. + * + * This utility function is used throughout the UnicodeString + * implementation to indicate that a UnicodeString operation failed, + * and may be used in other functions, + * especially but not exclusively when such functions do not + * take a UErrorCode for simplicity. + * + * The following methods, and no others, will clear a string object's bogus flag: + * - remove() + * - remove(0, INT32_MAX) + * - truncate(0) + * - operator=() (assignment operator) + * - setTo(...) + * + * The simplest ways to turn a bogus string into an empty one + * is to use the remove() function. + * Examples for other functions that are equivalent to "set to empty string": + * \code + * if(s.isBogus()) { + * s.remove(); // set to an empty string (remove all), or + * s.remove(0, INT32_MAX); // set to an empty string (remove all), or + * s.truncate(0); // set to an empty string (complete truncation), or + * s=UnicodeString(); // assign an empty string, or + * s.setTo((UChar32)-1); // set to a pseudo code point that is out of range, or + * s.setTo(u"", 0); // set to an empty C Unicode string + * } + * \endcode + * + * @see isBogus() + * @stable ICU 2.0 + */ + void setToBogus(); + + /** + * Set the character at the specified offset to the specified character. + * @param offset A valid offset into the text of the character to set + * @param ch The new character + * @return A reference to this + * @stable ICU 2.0 + */ + UnicodeString& setCharAt(int32_t offset, + char16_t ch); + + + /* Append operations */ + + /** + * Append operator. Append the code unit `ch` to the UnicodeString + * object. + * @param ch the code unit to be appended + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator+= (char16_t ch); + + /** + * Append operator. Append the code point `ch` to the UnicodeString + * object. + * @param ch the code point to be appended + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator+= (UChar32 ch); + + /** + * Append operator. Append the characters in `srcText` to the + * UnicodeString object. `srcText` is not modified. + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator+= (const UnicodeString& srcText); + + /** + * Append the characters + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`) to the + * UnicodeString object at offset `start`. `srcText` + * is not modified. + * @param srcText the source for the new characters + * @param srcStart the offset into `srcText` where new characters + * will be obtained + * @param srcLength the number of characters in `srcText` in + * the append string + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + /** + * Append the characters in `srcText` to the UnicodeString object. + * `srcText` is not modified. + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(const UnicodeString& srcText); + + /** + * Append the characters in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`) to the UnicodeString + * object at offset + * `start`. `srcChars` is not modified. + * @param srcChars the source for the new characters + * @param srcStart the offset into `srcChars` where new characters + * will be obtained + * @param srcLength the number of characters in `srcChars` in + * the append string; can be -1 if `srcChars` is NUL-terminated + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength); + + /** + * Append the characters in `srcChars` to the UnicodeString object + * at offset `start`. `srcChars` is not modified. + * @param srcChars the source for the new characters + * @param srcLength the number of Unicode characters in `srcChars`; + * can be -1 if `srcChars` is NUL-terminated + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(ConstChar16Ptr srcChars, + int32_t srcLength); + + /** + * Append the code unit `srcChar` to the UnicodeString object. + * @param srcChar the code unit to append + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(char16_t srcChar); + + /** + * Append the code point `srcChar` to the UnicodeString object. + * @param srcChar the code point to append + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& append(UChar32 srcChar); + + + /* Insert operations */ + + /** + * Insert the characters in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`) into the UnicodeString + * object at offset `start`. `srcText` is not modified. + * @param start the offset where the insertion begins + * @param srcText the source for the new characters + * @param srcStart the offset into `srcText` where new characters + * will be obtained + * @param srcLength the number of characters in `srcText` in + * the insert string + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + /** + * Insert the characters in `srcText` into the UnicodeString object + * at offset `start`. `srcText` is not modified. + * @param start the offset where the insertion begins + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + const UnicodeString& srcText); + + /** + * Insert the characters in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`) into the UnicodeString + * object at offset `start`. `srcChars` is not modified. + * @param start the offset at which the insertion begins + * @param srcChars the source for the new characters + * @param srcStart the offset into `srcChars` where new characters + * will be obtained + * @param srcLength the number of characters in `srcChars` + * in the insert string + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength); + + /** + * Insert the characters in `srcChars` into the UnicodeString object + * at offset `start`. `srcChars` is not modified. + * @param start the offset where the insertion begins + * @param srcChars the source for the new characters + * @param srcLength the number of Unicode characters in srcChars. + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + ConstChar16Ptr srcChars, + int32_t srcLength); + + /** + * Insert the code unit `srcChar` into the UnicodeString object at + * offset `start`. + * @param start the offset at which the insertion occurs + * @param srcChar the code unit to insert + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + char16_t srcChar); + + /** + * Insert the code point `srcChar` into the UnicodeString object at + * offset `start`. + * @param start the offset at which the insertion occurs + * @param srcChar the code point to insert + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + UChar32 srcChar); + + + /* Replace operations */ + + /** + * Replace the characters in the range + * [`start`, `start + length`) with the characters in + * `srcText` in the range + * [`srcStart`, `srcStart + srcLength`). + * `srcText` is not modified. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * `start + length` is not modified. + * @param srcText the source for the new characters + * @param srcStart the offset into `srcText` where new characters + * will be obtained + * @param srcLength the number of characters in `srcText` in + * the replace string + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replace(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + /** + * Replace the characters in the range + * [`start`, `start + length`) + * with the characters in `srcText`. `srcText` is + * not modified. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * `start + length` is not modified. + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replace(int32_t start, + int32_t length, + const UnicodeString& srcText); + + /** + * Replace the characters in the range + * [`start`, `start + length`) with the characters in + * `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`). `srcChars` + * is not modified. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * `start + length` is not modified. + * @param srcChars the source for the new characters + * @param srcStart the offset into `srcChars` where new characters + * will be obtained + * @param srcLength the number of characters in `srcChars` + * in the replace string + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replace(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength); + + /** + * Replace the characters in the range + * [`start`, `start + length`) with the characters in + * `srcChars`. `srcChars` is not modified. + * @param start the offset at which the replace operation begins + * @param length number of characters to replace. The character at + * `start + length` is not modified. + * @param srcChars the source for the new characters + * @param srcLength the number of Unicode characters in srcChars + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replace(int32_t start, + int32_t length, + ConstChar16Ptr srcChars, + int32_t srcLength); + + /** + * Replace the characters in the range + * [`start`, `start + length`) with the code unit + * `srcChar`. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * `start + length` is not modified. + * @param srcChar the new code unit + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replace(int32_t start, + int32_t length, + char16_t srcChar); + + /** + * Replace the characters in the range + * [`start`, `start + length`) with the code point + * `srcChar`. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * `start + length` is not modified. + * @param srcChar the new code point + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& replace(int32_t start, int32_t length, UChar32 srcChar); + + /** + * Replace the characters in the range [`start`, `limit`) + * with the characters in `srcText`. `srcText` is not modified. + * @param start the offset at which the replace operation begins + * @param limit the offset immediately following the replace range + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replaceBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText); + + /** + * Replace the characters in the range [`start`, `limit`) + * with the characters in `srcText` in the range + * [`srcStart`, `srcLimit`). `srcText` is not modified. + * @param start the offset at which the replace operation begins + * @param limit the offset immediately following the replace range + * @param srcText the source for the new characters + * @param srcStart the offset into `srcChars` where new characters + * will be obtained + * @param srcLimit the offset immediately following the range to copy + * in `srcText` + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replaceBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit); + + /** + * Replace a substring of this object with the given text. + * @param start the beginning index, inclusive; `0 <= start <= limit`. + * @param limit the ending index, exclusive; `start <= limit <= length()`. + * @param text the text to replace characters `start` to `limit - 1` + * @stable ICU 2.0 + */ + virtual void handleReplaceBetween(int32_t start, + int32_t limit, + const UnicodeString& text); + + /** + * Replaceable API + * @return true if it has MetaData + * @stable ICU 2.4 + */ + virtual UBool hasMetaData() const; + + /** + * Copy a substring of this object, retaining attribute (out-of-band) + * information. This method is used to duplicate or reorder substrings. + * The destination index must not overlap the source range. + * + * @param start the beginning index, inclusive; `0 <= start <= limit`. + * @param limit the ending index, exclusive; `start <= limit <= length()`. + * @param dest the destination index. The characters from + * `start..limit-1` will be copied to `dest`. + * Implementations of this method may assume that `dest <= start || + * dest >= limit`. + * @stable ICU 2.0 + */ + virtual void copy(int32_t start, int32_t limit, int32_t dest); + + /* Search and replace operations */ + + /** + * Replace all occurrences of characters in oldText with the characters + * in newText + * @param oldText the text containing the search text + * @param newText the text containing the replacement text + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& findAndReplace(const UnicodeString& oldText, + const UnicodeString& newText); + + /** + * Replace all occurrences of characters in oldText with characters + * in newText + * in the range [`start`, `start + length`). + * @param start the start of the range in which replace will performed + * @param length the length of the range in which replace will be performed + * @param oldText the text containing the search text + * @param newText the text containing the replacement text + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& findAndReplace(int32_t start, + int32_t length, + const UnicodeString& oldText, + const UnicodeString& newText); + + /** + * Replace all occurrences of characters in oldText in the range + * [`oldStart`, `oldStart + oldLength`) with the characters + * in newText in the range + * [`newStart`, `newStart + newLength`) + * in the range [`start`, `start + length`). + * @param start the start of the range in which replace will performed + * @param length the length of the range in which replace will be performed + * @param oldText the text containing the search text + * @param oldStart the start of the search range in `oldText` + * @param oldLength the length of the search range in `oldText` + * @param newText the text containing the replacement text + * @param newStart the start of the replacement range in `newText` + * @param newLength the length of the replacement range in `newText` + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& findAndReplace(int32_t start, + int32_t length, + const UnicodeString& oldText, + int32_t oldStart, + int32_t oldLength, + const UnicodeString& newText, + int32_t newStart, + int32_t newLength); + + + /* Remove operations */ + + /** + * Removes all characters from the UnicodeString object and clears the bogus flag. + * This is the UnicodeString equivalent of std::string’s clear(). + * + * @return a reference to this + * @see setToBogus + * @stable ICU 2.0 + */ + inline UnicodeString& remove(); + + /** + * Remove the characters in the range + * [`start`, `start + length`) from the UnicodeString object. + * @param start the offset of the first character to remove + * @param length the number of characters to remove + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& remove(int32_t start, + int32_t length = (int32_t)INT32_MAX); + + /** + * Remove the characters in the range + * [`start`, `limit`) from the UnicodeString object. + * @param start the offset of the first character to remove + * @param limit the offset immediately following the range to remove + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& removeBetween(int32_t start, + int32_t limit = (int32_t)INT32_MAX); + + /** + * Retain only the characters in the range + * [`start`, `limit`) from the UnicodeString object. + * Removes characters before `start` and at and after `limit`. + * @param start the offset of the first character to retain + * @param limit the offset immediately following the range to retain + * @return a reference to this + * @stable ICU 4.4 + */ + inline UnicodeString &retainBetween(int32_t start, int32_t limit = INT32_MAX); + + /* Length operations */ + + /** + * Pad the start of this UnicodeString with the character `padChar`. + * If the length of this UnicodeString is less than targetLength, + * length() - targetLength copies of padChar will be added to the + * beginning of this UnicodeString. + * @param targetLength the desired length of the string + * @param padChar the character to use for padding. Defaults to + * space (U+0020) + * @return true if the text was padded, false otherwise. + * @stable ICU 2.0 + */ + UBool padLeading(int32_t targetLength, + char16_t padChar = 0x0020); + + /** + * Pad the end of this UnicodeString with the character `padChar`. + * If the length of this UnicodeString is less than targetLength, + * length() - targetLength copies of padChar will be added to the + * end of this UnicodeString. + * @param targetLength the desired length of the string + * @param padChar the character to use for padding. Defaults to + * space (U+0020) + * @return true if the text was padded, false otherwise. + * @stable ICU 2.0 + */ + UBool padTrailing(int32_t targetLength, + char16_t padChar = 0x0020); + + /** + * Truncate this UnicodeString to the `targetLength`. + * @param targetLength the desired length of this UnicodeString. + * @return true if the text was truncated, false otherwise + * @stable ICU 2.0 + */ + inline UBool truncate(int32_t targetLength); + + /** + * Trims leading and trailing whitespace from this UnicodeString. + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& trim(void); + + + /* Miscellaneous operations */ + + /** + * Reverse this UnicodeString in place. + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& reverse(void); + + /** + * Reverse the range [`start`, `start + length`) in + * this UnicodeString. + * @param start the start of the range to reverse + * @param length the number of characters to to reverse + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& reverse(int32_t start, + int32_t length); + + /** + * Convert the characters in this to UPPER CASE following the conventions of + * the default locale. + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString& toUpper(void); + + /** + * Convert the characters in this to UPPER CASE following the conventions of + * a specific locale. + * @param locale The locale containing the conventions to use. + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString& toUpper(const Locale& locale); + + /** + * Convert the characters in this to lower case following the conventions of + * the default locale. + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString& toLower(void); + + /** + * Convert the characters in this to lower case following the conventions of + * a specific locale. + * @param locale The locale containing the conventions to use. + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString& toLower(const Locale& locale); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecase this string, convenience function using the default locale. + * + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * It may be more efficient to always provide an iterator to avoid + * opening and closing one for each string. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * @param titleIter A break iterator to find the first characters of words + * that are to be titlecased. + * If none is provided (0), then a standard titlecase + * break iterator is opened. + * Otherwise the provided iterator is set to the string's text. + * @return A reference to this. + * @stable ICU 2.1 + */ + UnicodeString &toTitle(BreakIterator *titleIter); + + /** + * Titlecase this string. + * + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * It may be more efficient to always provide an iterator to avoid + * opening and closing one for each string. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * @param titleIter A break iterator to find the first characters of words + * that are to be titlecased. + * If none is provided (0), then a standard titlecase + * break iterator is opened. + * Otherwise the provided iterator is set to the string's text. + * @param locale The locale to consider. + * @return A reference to this. + * @stable ICU 2.1 + */ + UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale); + + /** + * Titlecase this string, with options. + * + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options.) + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * It may be more efficient to always provide an iterator to avoid + * opening and closing one for each string. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * @param titleIter A break iterator to find the first characters of words + * that are to be titlecased. + * If none is provided (0), then a standard titlecase + * break iterator is opened. + * Otherwise the provided iterator is set to the string's text. + * @param locale The locale to consider. + * @param options Options bit set, usually 0. See U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @return A reference to this. + * @stable ICU 3.8 + */ + UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale, uint32_t options); + +#endif + + /** + * Case-folds the characters in this string. + * + * Case-folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * + * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString &foldCase(uint32_t options=0 /*U_FOLD_CASE_DEFAULT*/); + + //======================================== + // Access to the internal buffer + //======================================== + + /** + * Get a read/write pointer to the internal buffer. + * The buffer is guaranteed to be large enough for at least minCapacity char16_ts, + * writable, and is still owned by the UnicodeString object. + * Calls to getBuffer(minCapacity) must not be nested, and + * must be matched with calls to releaseBuffer(newLength). + * If the string buffer was read-only or shared, + * then it will be reallocated and copied. + * + * An attempted nested call will return 0, and will not further modify the + * state of the UnicodeString object. + * It also returns 0 if the string is bogus. + * + * The actual capacity of the string buffer may be larger than minCapacity. + * getCapacity() returns the actual capacity. + * For many operations, the full capacity should be used to avoid reallocations. + * + * While the buffer is "open" between getBuffer(minCapacity) + * and releaseBuffer(newLength), the following applies: + * - The string length is set to 0. + * - Any read API call on the UnicodeString object will behave like on a 0-length string. + * - Any write API call on the UnicodeString object is disallowed and will have no effect. + * - You can read from and write to the returned buffer. + * - The previous string contents will still be in the buffer; + * if you want to use it, then you need to call length() before getBuffer(minCapacity). + * If the length() was greater than minCapacity, then any contents after minCapacity + * may be lost. + * The buffer contents is not NUL-terminated by getBuffer(). + * If length() < getCapacity() then you can terminate it by writing a NUL + * at index length(). + * - You must call releaseBuffer(newLength) before and in order to + * return to normal UnicodeString operation. + * + * @param minCapacity the minimum number of char16_ts that are to be available + * in the buffer, starting at the returned pointer; + * default to the current string capacity if minCapacity==-1 + * @return a writable pointer to the internal string buffer, + * or nullptr if an error occurs (nested calls, out of memory) + * + * @see releaseBuffer + * @see getTerminatedBuffer() + * @stable ICU 2.0 + */ + char16_t *getBuffer(int32_t minCapacity); + + /** + * Release a read/write buffer on a UnicodeString object with an + * "open" getBuffer(minCapacity). + * This function must be called in a matched pair with getBuffer(minCapacity). + * releaseBuffer(newLength) must be called if and only if a getBuffer(minCapacity) is "open". + * + * It will set the string length to newLength, at most to the current capacity. + * If newLength==-1 then it will set the length according to the + * first NUL in the buffer, or to the capacity if there is no NUL. + * + * After calling releaseBuffer(newLength) the UnicodeString is back to normal operation. + * + * @param newLength the new length of the UnicodeString object; + * defaults to the current capacity if newLength is greater than that; + * if newLength==-1, it defaults to u_strlen(buffer) but not more than + * the current capacity of the string + * + * @see getBuffer(int32_t minCapacity) + * @stable ICU 2.0 + */ + void releaseBuffer(int32_t newLength=-1); + + /** + * Get a read-only pointer to the internal buffer. + * This can be called at any time on a valid UnicodeString. + * + * It returns 0 if the string is bogus, or + * during an "open" getBuffer(minCapacity). + * + * It can be called as many times as desired. + * The pointer that it returns will remain valid until the UnicodeString object is modified, + * at which time the pointer is semantically invalidated and must not be used any more. + * + * The capacity of the buffer can be determined with getCapacity(). + * The part after length() may or may not be initialized and valid, + * depending on the history of the UnicodeString object. + * + * The buffer contents is (probably) not NUL-terminated. + * You can check if it is with + * `(s.length() < s.getCapacity() && buffer[s.length()]==0)`. + * (See getTerminatedBuffer().) + * + * The buffer may reside in read-only memory. Its contents must not + * be modified. + * + * @return a read-only pointer to the internal string buffer, + * or nullptr if the string is empty or bogus + * + * @see getBuffer(int32_t minCapacity) + * @see getTerminatedBuffer() + * @stable ICU 2.0 + */ + inline const char16_t *getBuffer() const; + + /** + * Get a read-only pointer to the internal buffer, + * making sure that it is NUL-terminated. + * This can be called at any time on a valid UnicodeString. + * + * It returns 0 if the string is bogus, or + * during an "open" getBuffer(minCapacity), or if the buffer cannot + * be NUL-terminated (because memory allocation failed). + * + * It can be called as many times as desired. + * The pointer that it returns will remain valid until the UnicodeString object is modified, + * at which time the pointer is semantically invalidated and must not be used any more. + * + * The capacity of the buffer can be determined with getCapacity(). + * The part after length()+1 may or may not be initialized and valid, + * depending on the history of the UnicodeString object. + * + * The buffer contents is guaranteed to be NUL-terminated. + * getTerminatedBuffer() may reallocate the buffer if a terminating NUL + * is written. + * For this reason, this function is not const, unlike getBuffer(). + * Note that a UnicodeString may also contain NUL characters as part of its contents. + * + * The buffer may reside in read-only memory. Its contents must not + * be modified. + * + * @return a read-only pointer to the internal string buffer, + * or 0 if the string is empty or bogus + * + * @see getBuffer(int32_t minCapacity) + * @see getBuffer() + * @stable ICU 2.2 + */ + const char16_t *getTerminatedBuffer(); + + //======================================== + // Constructors + //======================================== + + /** Construct an empty UnicodeString. + * @stable ICU 2.0 + */ + inline UnicodeString(); + + /** + * Construct a UnicodeString with capacity to hold `capacity` char16_ts + * @param capacity the number of char16_ts this UnicodeString should hold + * before a resize is necessary; if count is greater than 0 and count + * code points c take up more space than capacity, then capacity is adjusted + * accordingly. + * @param c is used to initially fill the string + * @param count specifies how many code points c are to be written in the + * string + * @stable ICU 2.0 + */ + UnicodeString(int32_t capacity, UChar32 c, int32_t count); + + /** + * Single char16_t (code unit) constructor. + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param ch the character to place in the UnicodeString + * @stable ICU 2.0 + */ + UNISTR_FROM_CHAR_EXPLICIT UnicodeString(char16_t ch); + + /** + * Single UChar32 (code point) constructor. + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param ch the character to place in the UnicodeString + * @stable ICU 2.0 + */ + UNISTR_FROM_CHAR_EXPLICIT UnicodeString(UChar32 ch); + + /** + * char16_t* constructor. + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param text The characters to place in the UnicodeString. `text` + * must be NULL (U+0000) terminated. + * @stable ICU 2.0 + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text); + +#if !U_CHAR16_IS_TYPEDEF + /** + * uint16_t * constructor. + * Delegates to UnicodeString(const char16_t *). + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param text NUL-terminated UTF-16 string + * @stable ICU 59 + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const uint16_t *text) : + UnicodeString(ConstChar16Ptr(text)) {} +#endif + +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * wchar_t * constructor. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * Delegates to UnicodeString(const char16_t *). + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param text NUL-terminated UTF-16 string + * @stable ICU 59 + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const wchar_t *text) : + UnicodeString(ConstChar16Ptr(text)) {} +#endif + + /** + * nullptr_t constructor. + * Effectively the same as the default constructor, makes an empty string object. + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param text nullptr + * @stable ICU 59 + */ + UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text); + + /** + * char16_t* constructor. + * @param text The characters to place in the UnicodeString. + * @param textLength The number of Unicode characters in `text` + * to copy. + * @stable ICU 2.0 + */ + UnicodeString(const char16_t *text, + int32_t textLength); + +#if !U_CHAR16_IS_TYPEDEF + /** + * uint16_t * constructor. + * Delegates to UnicodeString(const char16_t *, int32_t). + * @param text UTF-16 string + * @param textLength string length + * @stable ICU 59 + */ + UnicodeString(const uint16_t *text, int32_t textLength) : + UnicodeString(ConstChar16Ptr(text), textLength) {} +#endif + +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * wchar_t * constructor. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * Delegates to UnicodeString(const char16_t *, int32_t). + * @param text NUL-terminated UTF-16 string + * @param textLength string length + * @stable ICU 59 + */ + UnicodeString(const wchar_t *text, int32_t textLength) : + UnicodeString(ConstChar16Ptr(text), textLength) {} +#endif + + /** + * nullptr_t constructor. + * Effectively the same as the default constructor, makes an empty string object. + * @param text nullptr + * @param textLength ignored + * @stable ICU 59 + */ + inline UnicodeString(const std::nullptr_t text, int32_t textLength); + + /** + * Readonly-aliasing char16_t* constructor. + * The text will be used for the UnicodeString object, but + * it will not be released when the UnicodeString is destroyed. + * This has copy-on-write semantics: + * When the string is modified, then the buffer is first copied into + * newly allocated memory. + * The aliased buffer is never modified. + * + * In an assignment to another UnicodeString, when using the copy constructor + * or the assignment operator, the text will be copied. + * When using fastCopyFrom(), the text will be aliased again, + * so that both strings then alias the same readonly-text. + * + * @param isTerminated specifies if `text` is `NUL`-terminated. + * This must be true if `textLength==-1`. + * @param text The characters to alias for the UnicodeString. + * @param textLength The number of Unicode characters in `text` to alias. + * If -1, then this constructor will determine the length + * by calling `u_strlen()`. + * @stable ICU 2.0 + */ + UnicodeString(UBool isTerminated, + ConstChar16Ptr text, + int32_t textLength); + + /** + * Writable-aliasing char16_t* constructor. + * The text will be used for the UnicodeString object, but + * it will not be released when the UnicodeString is destroyed. + * This has write-through semantics: + * For as long as the capacity of the buffer is sufficient, write operations + * will directly affect the buffer. When more capacity is necessary, then + * a new buffer will be allocated and the contents copied as with regularly + * constructed strings. + * In an assignment to another UnicodeString, the buffer will be copied. + * The extract(Char16Ptr dst) function detects whether the dst pointer is the same + * as the string buffer itself and will in this case not copy the contents. + * + * @param buffer The characters to alias for the UnicodeString. + * @param buffLength The number of Unicode characters in `buffer` to alias. + * @param buffCapacity The size of `buffer` in char16_ts. + * @stable ICU 2.0 + */ + UnicodeString(char16_t *buffer, int32_t buffLength, int32_t buffCapacity); + +#if !U_CHAR16_IS_TYPEDEF + /** + * Writable-aliasing uint16_t * constructor. + * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). + * @param buffer writable buffer of/for UTF-16 text + * @param buffLength length of the current buffer contents + * @param buffCapacity buffer capacity + * @stable ICU 59 + */ + UnicodeString(uint16_t *buffer, int32_t buffLength, int32_t buffCapacity) : + UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} +#endif + +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * Writable-aliasing wchar_t * constructor. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). + * @param buffer writable buffer of/for UTF-16 text + * @param buffLength length of the current buffer contents + * @param buffCapacity buffer capacity + * @stable ICU 59 + */ + UnicodeString(wchar_t *buffer, int32_t buffLength, int32_t buffCapacity) : + UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} +#endif + + /** + * Writable-aliasing nullptr_t constructor. + * Effectively the same as the default constructor, makes an empty string object. + * @param buffer nullptr + * @param buffLength ignored + * @param buffCapacity ignored + * @stable ICU 59 + */ + inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity); + +#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION + + /** + * char* constructor. + * Uses the default converter (and thus depends on the ICU conversion code) + * unless U_CHARSET_IS_UTF8 is set to 1. + * + * For ASCII (really "invariant character") strings it is more efficient to use + * the constructor that takes a US_INV (for its enum EInvariant). + * For ASCII (invariant-character) string literals, see UNICODE_STRING and + * UNICODE_STRING_SIMPLE. + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param codepageData an array of bytes, null-terminated, + * in the platform's default codepage. + * @stable ICU 2.0 + * @see UNICODE_STRING + * @see UNICODE_STRING_SIMPLE + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char *codepageData); + + /** + * char* constructor. + * Uses the default converter (and thus depends on the ICU conversion code) + * unless U_CHARSET_IS_UTF8 is set to 1. + * @param codepageData an array of bytes in the platform's default codepage. + * @param dataLength The number of bytes in `codepageData`. + * @stable ICU 2.0 + */ + UnicodeString(const char *codepageData, int32_t dataLength); + +#endif + +#if !UCONFIG_NO_CONVERSION + + /** + * char* constructor. + * @param codepageData an array of bytes, null-terminated + * @param codepage the encoding of `codepageData`. The special + * value 0 for `codepage` indicates that the text is in the + * platform's default codepage. + * + * If `codepage` is an empty string (`""`), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + * Recommendation: For invariant-character strings use the constructor + * UnicodeString(const char *src, int32_t length, enum EInvariant inv) + * because it avoids object code dependencies of UnicodeString on + * the conversion code. + * + * @stable ICU 2.0 + */ + UnicodeString(const char *codepageData, const char *codepage); + + /** + * char* constructor. + * @param codepageData an array of bytes. + * @param dataLength The number of bytes in `codepageData`. + * @param codepage the encoding of `codepageData`. The special + * value 0 for `codepage` indicates that the text is in the + * platform's default codepage. + * If `codepage` is an empty string (`""`), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + * Recommendation: For invariant-character strings use the constructor + * UnicodeString(const char *src, int32_t length, enum EInvariant inv) + * because it avoids object code dependencies of UnicodeString on + * the conversion code. + * + * @stable ICU 2.0 + */ + UnicodeString(const char *codepageData, int32_t dataLength, const char *codepage); + + /** + * char * / UConverter constructor. + * This constructor uses an existing UConverter object to + * convert the codepage string to Unicode and construct a UnicodeString + * from that. + * + * The converter is reset at first. + * If the error code indicates a failure before this constructor is called, + * or if an error occurs during conversion or construction, + * then the string will be bogus. + * + * This function avoids the overhead of opening and closing a converter if + * multiple strings are constructed. + * + * @param src input codepage string + * @param srcLength length of the input string, can be -1 for NUL-terminated strings + * @param cnv converter object (ucnv_resetToUnicode() will be called), + * can be NULL for the default converter + * @param errorCode normal ICU error code + * @stable ICU 2.0 + */ + UnicodeString( + const char *src, int32_t srcLength, + UConverter *cnv, + UErrorCode &errorCode); + +#endif + + /** + * Constructs a Unicode string from an invariant-character char * string. + * About invariant characters see utypes.h. + * This constructor has no runtime dependency on conversion code and is + * therefore recommended over ones taking a charset name string + * (where the empty string "" indicates invariant-character conversion). + * + * Use the macro US_INV as the third, signature-distinguishing parameter. + * + * For example: + * \code + * void fn(const char *s) { + * UnicodeString ustr(s, -1, US_INV); + * // use ustr ... + * } + * \endcode + * @param src String using only invariant characters. + * @param textLength Length of src, or -1 if NUL-terminated. + * @param inv Signature-distinguishing paramater, use US_INV. + * + * @see US_INV + * @stable ICU 3.2 + */ + UnicodeString(const char *src, int32_t textLength, enum EInvariant inv); + + + /** + * Copy constructor. + * + * Starting with ICU 2.4, the assignment operator and the copy constructor + * allocate a new buffer and copy the buffer contents even for readonly aliases. + * By contrast, the fastCopyFrom() function implements the old, + * more efficient but less safe behavior + * of making this string also a readonly alias to the same buffer. + * + * If the source object has an "open" buffer from getBuffer(minCapacity), + * then the copy is an empty string. + * + * @param that The UnicodeString object to copy. + * @stable ICU 2.0 + * @see fastCopyFrom + */ + UnicodeString(const UnicodeString& that); + + /** + * Move constructor; might leave src in bogus state. + * This string will have the same contents and state that the source string had. + * @param src source string + * @stable ICU 56 + */ + UnicodeString(UnicodeString &&src) U_NOEXCEPT; + + /** + * 'Substring' constructor from tail of source string. + * @param src The UnicodeString object to copy. + * @param srcStart The offset into `src` at which to start copying. + * @stable ICU 2.2 + */ + UnicodeString(const UnicodeString& src, int32_t srcStart); + + /** + * 'Substring' constructor from subrange of source string. + * @param src The UnicodeString object to copy. + * @param srcStart The offset into `src` at which to start copying. + * @param srcLength The number of characters from `src` to copy. + * @stable ICU 2.2 + */ + UnicodeString(const UnicodeString& src, int32_t srcStart, int32_t srcLength); + + /** + * Clone this object, an instance of a subclass of Replaceable. + * Clones can be used concurrently in multiple threads. + * If a subclass does not implement clone(), or if an error occurs, + * then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see Replaceable::clone + * @see getDynamicClassID + * @stable ICU 2.6 + */ + virtual UnicodeString *clone() const; + + /** Destructor. + * @stable ICU 2.0 + */ + virtual ~UnicodeString(); + + /** + * Create a UnicodeString from a UTF-8 string. + * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string. + * Calls u_strFromUTF8WithSub(). + * + * @param utf8 UTF-8 input string. + * Note that a StringPiece can be implicitly constructed + * from a std::string or a NUL-terminated const char * string. + * @return A UnicodeString with equivalent UTF-16 contents. + * @see toUTF8 + * @see toUTF8String + * @stable ICU 4.2 + */ + static UnicodeString fromUTF8(StringPiece utf8); + + /** + * Create a UnicodeString from a UTF-32 string. + * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string. + * Calls u_strFromUTF32WithSub(). + * + * @param utf32 UTF-32 input string. Must not be NULL. + * @param length Length of the input string, or -1 if NUL-terminated. + * @return A UnicodeString with equivalent UTF-16 contents. + * @see toUTF32 + * @stable ICU 4.2 + */ + static UnicodeString fromUTF32(const UChar32 *utf32, int32_t length); + + /* Miscellaneous operations */ + + /** + * Unescape a string of characters and return a string containing + * the result. The following escape sequences are recognized: + * + * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] + * \\Uhhhhhhhh 8 hex digits + * \\xhh 1-2 hex digits + * \\ooo 1-3 octal digits; o in [0-7] + * \\cX control-X; X is masked with 0x1F + * + * as well as the standard ANSI C escapes: + * + * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, + * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, + * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C + * + * Anything else following a backslash is generically escaped. For + * example, "[a\\-z]" returns "[a-z]". + * + * If an escape sequence is ill-formed, this method returns an empty + * string. An example of an ill-formed sequence is "\\u" followed by + * fewer than 4 hex digits. + * + * This function is similar to u_unescape() but not identical to it. + * The latter takes a source char*, so it does escape recognition + * and also invariant conversion. + * + * @return a string with backslash escapes interpreted, or an + * empty string on error. + * @see UnicodeString#unescapeAt() + * @see u_unescape() + * @see u_unescapeAt() + * @stable ICU 2.0 + */ + UnicodeString unescape() const; + + /** + * Unescape a single escape sequence and return the represented + * character. See unescape() for a listing of the recognized escape + * sequences. The character at offset-1 is assumed (without + * checking) to be a backslash. If the escape sequence is + * ill-formed, or the offset is out of range, U_SENTINEL=-1 is + * returned. + * + * @param offset an input output parameter. On input, it is the + * offset into this string where the escape sequence is located, + * after the initial backslash. On output, it is advanced after the + * last character parsed. On error, it is not advanced at all. + * @return the character represented by the escape sequence at + * offset, or U_SENTINEL=-1 on error. + * @see UnicodeString#unescape() + * @see u_unescape() + * @see u_unescapeAt() + * @stable ICU 2.0 + */ + UChar32 unescapeAt(int32_t &offset) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + //======================================== + // Implementation methods + //======================================== + +protected: + /** + * Implement Replaceable::getLength() (see jitterbug 1027). + * @stable ICU 2.4 + */ + virtual int32_t getLength() const; + + /** + * The change in Replaceable to use virtual getCharAt() allows + * UnicodeString::charAt() to be inline again (see jitterbug 709). + * @stable ICU 2.4 + */ + virtual char16_t getCharAt(int32_t offset) const; + + /** + * The change in Replaceable to use virtual getChar32At() allows + * UnicodeString::char32At() to be inline again (see jitterbug 709). + * @stable ICU 2.4 + */ + virtual UChar32 getChar32At(int32_t offset) const; + +private: + // For char* constructors. Could be made public. + UnicodeString &setToUTF8(StringPiece utf8); + // For extract(char*). + // We could make a toUTF8(target, capacity, errorCode) public but not + // this version: New API will be cleaner if we make callers create substrings + // rather than having start+length on every method, + // and it should take a UErrorCode&. + int32_t + toUTF8(int32_t start, int32_t len, + char *target, int32_t capacity) const; + + /** + * Internal string contents comparison, called by operator==. + * Requires: this & text not bogus and have same lengths. + */ + UBool doEquals(const UnicodeString &text, int32_t len) const; + + inline int8_t + doCompare(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + int8_t doCompare(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + inline int8_t + doCompareCodePointOrder(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + int8_t doCompareCodePointOrder(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + inline int8_t + doCaseCompare(int32_t start, + int32_t length, + const UnicodeString &srcText, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const; + + int8_t + doCaseCompare(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const; + + int32_t doIndexOf(char16_t c, + int32_t start, + int32_t length) const; + + int32_t doIndexOf(UChar32 c, + int32_t start, + int32_t length) const; + + int32_t doLastIndexOf(char16_t c, + int32_t start, + int32_t length) const; + + int32_t doLastIndexOf(UChar32 c, + int32_t start, + int32_t length) const; + + void doExtract(int32_t start, + int32_t length, + char16_t *dst, + int32_t dstStart) const; + + inline void doExtract(int32_t start, + int32_t length, + UnicodeString& target) const; + + inline char16_t doCharAt(int32_t offset) const; + + UnicodeString& doReplace(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + UnicodeString& doReplace(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength); + + UnicodeString& doAppend(const UnicodeString& src, int32_t srcStart, int32_t srcLength); + UnicodeString& doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength); + + UnicodeString& doReverse(int32_t start, + int32_t length); + + // calculate hash code + int32_t doHashCode(void) const; + + // get pointer to start of array + // these do not check for kOpenGetBuffer, unlike the public getBuffer() function + inline char16_t* getArrayStart(void); + inline const char16_t* getArrayStart(void) const; + + inline UBool hasShortLength() const; + inline int32_t getShortLength() const; + + // A UnicodeString object (not necessarily its current buffer) + // is writable unless it isBogus() or it has an "open" getBuffer(minCapacity). + inline UBool isWritable() const; + + // Is the current buffer writable? + inline UBool isBufferWritable() const; + + // None of the following does releaseArray(). + inline void setZeroLength(); + inline void setShortLength(int32_t len); + inline void setLength(int32_t len); + inline void setToEmpty(); + inline void setArray(char16_t *array, int32_t len, int32_t capacity); // sets length but not flags + + // allocate the array; result may be the stack buffer + // sets refCount to 1 if appropriate + // sets fArray, fCapacity, and flags + // sets length to 0 + // returns boolean for success or failure + UBool allocate(int32_t capacity); + + // release the array if owned + void releaseArray(void); + + // turn a bogus string into an empty one + void unBogus(); + + // implements assignment operator, copy constructor, and fastCopyFrom() + UnicodeString ©From(const UnicodeString &src, UBool fastCopy=false); + + // Copies just the fields without memory management. + void copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT; + + // Pin start and limit to acceptable values. + inline void pinIndex(int32_t& start) const; + inline void pinIndices(int32_t& start, + int32_t& length) const; + +#if !UCONFIG_NO_CONVERSION + + /* Internal extract() using UConverter. */ + int32_t doExtract(int32_t start, int32_t length, + char *dest, int32_t destCapacity, + UConverter *cnv, + UErrorCode &errorCode) const; + + /* + * Real constructor for converting from codepage data. + * It assumes that it is called with !fRefCounted. + * + * If `codepage==0`, then the default converter + * is used for the platform encoding. + * If `codepage` is an empty string (`""`), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + */ + void doCodepageCreate(const char *codepageData, + int32_t dataLength, + const char *codepage); + + /* + * Worker function for creating a UnicodeString from + * a codepage string using a UConverter. + */ + void + doCodepageCreate(const char *codepageData, + int32_t dataLength, + UConverter *converter, + UErrorCode &status); + +#endif + + /* + * This function is called when write access to the array + * is necessary. + * + * We need to make a copy of the array if + * the buffer is read-only, or + * the buffer is refCounted (shared), and refCount>1, or + * the buffer is too small. + * + * Return false if memory could not be allocated. + */ + UBool cloneArrayIfNeeded(int32_t newCapacity = -1, + int32_t growCapacity = -1, + UBool doCopyArray = true, + int32_t **pBufferToDelete = 0, + UBool forceClone = false); + + /** + * Common function for UnicodeString case mappings. + * The stringCaseMapper has the same type UStringCaseMapper + * as in ustr_imp.h for ustrcase_map(). + */ + UnicodeString & + caseMap(int32_t caseLocale, uint32_t options, +#if !UCONFIG_NO_BREAK_ITERATION + BreakIterator *iter, +#endif + UStringCaseMapper *stringCaseMapper); + + // ref counting + void addRef(void); + int32_t removeRef(void); + int32_t refCount(void) const; + + // constants + enum { + /** + * Size of stack buffer for short strings. + * Must be at least U16_MAX_LENGTH for the single-code point constructor to work. + * @see UNISTR_OBJECT_SIZE + */ + US_STACKBUF_SIZE=(int32_t)(UNISTR_OBJECT_SIZE-sizeof(void *)-2)/U_SIZEOF_UCHAR, + kInvalidUChar=0xffff, // U+FFFF returned by charAt(invalid index) + kInvalidHashCode=0, // invalid hash code + kEmptyHashCode=1, // hash code for empty string + + // bit flag values for fLengthAndFlags + kIsBogus=1, // this string is bogus, i.e., not valid or NULL + kUsingStackBuffer=2,// using fUnion.fStackFields instead of fUnion.fFields + kRefCounted=4, // there is a refCount field before the characters in fArray + kBufferIsReadonly=8,// do not write to this buffer + kOpenGetBuffer=16, // getBuffer(minCapacity) was called (is "open"), + // and releaseBuffer(newLength) must be called + kAllStorageFlags=0x1f, + + kLengthShift=5, // remaining 11 bits for non-negative short length, or negative if long + kLength1=1<127; else undefined + int32_t fCapacity; // capacity of fArray (in char16_ts) + // array pointer last to minimize padding for machines with P128 data model + // or pointer sizes that are not a power of 2 + char16_t *fArray; // the Unicode data + } fFields; + } fUnion; +}; + +/** + * Create a new UnicodeString with the concatenation of two others. + * + * @param s1 The first string to be copied to the new one. + * @param s2 The second string to be copied to the new one, after s1. + * @return UnicodeString(s1).append(s2) + * @stable ICU 2.8 + */ +U_COMMON_API UnicodeString U_EXPORT2 +operator+ (const UnicodeString &s1, const UnicodeString &s2); + +//======================================== +// Inline members +//======================================== + +//======================================== +// Privates +//======================================== + +inline void +UnicodeString::pinIndex(int32_t& start) const +{ + // pin index + if(start < 0) { + start = 0; + } else if(start > length()) { + start = length(); + } +} + +inline void +UnicodeString::pinIndices(int32_t& start, + int32_t& _length) const +{ + // pin indices + int32_t len = length(); + if(start < 0) { + start = 0; + } else if(start > len) { + start = len; + } + if(_length < 0) { + _length = 0; + } else if(_length > (len - start)) { + _length = (len - start); + } +} + +inline char16_t* +UnicodeString::getArrayStart() { + return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? + fUnion.fStackFields.fBuffer : fUnion.fFields.fArray; +} + +inline const char16_t* +UnicodeString::getArrayStart() const { + return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? + fUnion.fStackFields.fBuffer : fUnion.fFields.fArray; +} + +//======================================== +// Default constructor +//======================================== + +inline +UnicodeString::UnicodeString() { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/, int32_t /*length*/) { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +//======================================== +// Read-only implementation methods +//======================================== +inline UBool +UnicodeString::hasShortLength() const { + return fUnion.fFields.fLengthAndFlags>=0; +} + +inline int32_t +UnicodeString::getShortLength() const { + // fLengthAndFlags must be non-negative -> short length >= 0 + // and arithmetic or logical shift does not matter. + return fUnion.fFields.fLengthAndFlags>>kLengthShift; +} + +inline int32_t +UnicodeString::length() const { + return hasShortLength() ? getShortLength() : fUnion.fFields.fLength; +} + +inline int32_t +UnicodeString::getCapacity() const { + return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? + US_STACKBUF_SIZE : fUnion.fFields.fCapacity; +} + +inline int32_t +UnicodeString::hashCode() const +{ return doHashCode(); } + +inline UBool +UnicodeString::isBogus() const +{ return (UBool)(fUnion.fFields.fLengthAndFlags & kIsBogus); } + +inline UBool +UnicodeString::isWritable() const +{ return (UBool)!(fUnion.fFields.fLengthAndFlags&(kOpenGetBuffer|kIsBogus)); } + +inline UBool +UnicodeString::isBufferWritable() const +{ + return (UBool)( + !(fUnion.fFields.fLengthAndFlags&(kOpenGetBuffer|kIsBogus|kBufferIsReadonly)) && + (!(fUnion.fFields.fLengthAndFlags&kRefCounted) || refCount()==1)); +} + +inline const char16_t * +UnicodeString::getBuffer() const { + if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) { + return nullptr; + } else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) { + return fUnion.fStackFields.fBuffer; + } else { + return fUnion.fFields.fArray; + } +} + +//======================================== +// Read-only alias methods +//======================================== +inline int8_t +UnicodeString::doCompare(int32_t start, + int32_t thisLength, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ + if(srcText.isBogus()) { + return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise + } else { + srcText.pinIndices(srcStart, srcLength); + return doCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength); + } +} + +inline UBool +UnicodeString::operator== (const UnicodeString& text) const +{ + if(isBogus()) { + return text.isBogus(); + } else { + int32_t len = length(), textLength = text.length(); + return !text.isBogus() && len == textLength && doEquals(text, len); + } +} + +inline UBool +UnicodeString::operator!= (const UnicodeString& text) const +{ return (! operator==(text)); } + +inline UBool +UnicodeString::operator> (const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()) == 1; } + +inline UBool +UnicodeString::operator< (const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()) == -1; } + +inline UBool +UnicodeString::operator>= (const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()) != -1; } + +inline UBool +UnicodeString::operator<= (const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()) != 1; } + +inline int8_t +UnicodeString::compare(const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()); } + +inline int8_t +UnicodeString::compare(int32_t start, + int32_t _length, + const UnicodeString& srcText) const +{ return doCompare(start, _length, srcText, 0, srcText.length()); } + +inline int8_t +UnicodeString::compare(ConstChar16Ptr srcChars, + int32_t srcLength) const +{ return doCompare(0, length(), srcChars, 0, srcLength); } + +inline int8_t +UnicodeString::compare(int32_t start, + int32_t _length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ return doCompare(start, _length, srcText, srcStart, srcLength); } + +inline int8_t +UnicodeString::compare(int32_t start, + int32_t _length, + const char16_t *srcChars) const +{ return doCompare(start, _length, srcChars, 0, _length); } + +inline int8_t +UnicodeString::compare(int32_t start, + int32_t _length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const +{ return doCompare(start, _length, srcChars, srcStart, srcLength); } + +inline int8_t +UnicodeString::compareBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) const +{ return doCompare(start, limit - start, + srcText, srcStart, srcLimit - srcStart); } + +inline int8_t +UnicodeString::doCompareCodePointOrder(int32_t start, + int32_t thisLength, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ + if(srcText.isBogus()) { + return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise + } else { + srcText.pinIndices(srcStart, srcLength); + return doCompareCodePointOrder(start, thisLength, srcText.getArrayStart(), srcStart, srcLength); + } +} + +inline int8_t +UnicodeString::compareCodePointOrder(const UnicodeString& text) const +{ return doCompareCodePointOrder(0, length(), text, 0, text.length()); } + +inline int8_t +UnicodeString::compareCodePointOrder(int32_t start, + int32_t _length, + const UnicodeString& srcText) const +{ return doCompareCodePointOrder(start, _length, srcText, 0, srcText.length()); } + +inline int8_t +UnicodeString::compareCodePointOrder(ConstChar16Ptr srcChars, + int32_t srcLength) const +{ return doCompareCodePointOrder(0, length(), srcChars, 0, srcLength); } + +inline int8_t +UnicodeString::compareCodePointOrder(int32_t start, + int32_t _length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ return doCompareCodePointOrder(start, _length, srcText, srcStart, srcLength); } + +inline int8_t +UnicodeString::compareCodePointOrder(int32_t start, + int32_t _length, + const char16_t *srcChars) const +{ return doCompareCodePointOrder(start, _length, srcChars, 0, _length); } + +inline int8_t +UnicodeString::compareCodePointOrder(int32_t start, + int32_t _length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const +{ return doCompareCodePointOrder(start, _length, srcChars, srcStart, srcLength); } + +inline int8_t +UnicodeString::compareCodePointOrderBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) const +{ return doCompareCodePointOrder(start, limit - start, + srcText, srcStart, srcLimit - srcStart); } + +inline int8_t +UnicodeString::doCaseCompare(int32_t start, + int32_t thisLength, + const UnicodeString &srcText, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const +{ + if(srcText.isBogus()) { + return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise + } else { + srcText.pinIndices(srcStart, srcLength); + return doCaseCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength, options); + } +} + +inline int8_t +UnicodeString::caseCompare(const UnicodeString &text, uint32_t options) const { + return doCaseCompare(0, length(), text, 0, text.length(), options); +} + +inline int8_t +UnicodeString::caseCompare(int32_t start, + int32_t _length, + const UnicodeString &srcText, + uint32_t options) const { + return doCaseCompare(start, _length, srcText, 0, srcText.length(), options); +} + +inline int8_t +UnicodeString::caseCompare(ConstChar16Ptr srcChars, + int32_t srcLength, + uint32_t options) const { + return doCaseCompare(0, length(), srcChars, 0, srcLength, options); +} + +inline int8_t +UnicodeString::caseCompare(int32_t start, + int32_t _length, + const UnicodeString &srcText, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const { + return doCaseCompare(start, _length, srcText, srcStart, srcLength, options); +} + +inline int8_t +UnicodeString::caseCompare(int32_t start, + int32_t _length, + const char16_t *srcChars, + uint32_t options) const { + return doCaseCompare(start, _length, srcChars, 0, _length, options); +} + +inline int8_t +UnicodeString::caseCompare(int32_t start, + int32_t _length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const { + return doCaseCompare(start, _length, srcChars, srcStart, srcLength, options); +} + +inline int8_t +UnicodeString::caseCompareBetween(int32_t start, + int32_t limit, + const UnicodeString &srcText, + int32_t srcStart, + int32_t srcLimit, + uint32_t options) const { + return doCaseCompare(start, limit - start, srcText, srcStart, srcLimit - srcStart, options); +} + +inline int32_t +UnicodeString::indexOf(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t _length) const +{ + if(!srcText.isBogus()) { + srcText.pinIndices(srcStart, srcLength); + if(srcLength > 0) { + return indexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length); + } + } + return -1; +} + +inline int32_t +UnicodeString::indexOf(const UnicodeString& text) const +{ return indexOf(text, 0, text.length(), 0, length()); } + +inline int32_t +UnicodeString::indexOf(const UnicodeString& text, + int32_t start) const { + pinIndex(start); + return indexOf(text, 0, text.length(), start, length() - start); +} + +inline int32_t +UnicodeString::indexOf(const UnicodeString& text, + int32_t start, + int32_t _length) const +{ return indexOf(text, 0, text.length(), start, _length); } + +inline int32_t +UnicodeString::indexOf(const char16_t *srcChars, + int32_t srcLength, + int32_t start) const { + pinIndex(start); + return indexOf(srcChars, 0, srcLength, start, length() - start); +} + +inline int32_t +UnicodeString::indexOf(ConstChar16Ptr srcChars, + int32_t srcLength, + int32_t start, + int32_t _length) const +{ return indexOf(srcChars, 0, srcLength, start, _length); } + +inline int32_t +UnicodeString::indexOf(char16_t c, + int32_t start, + int32_t _length) const +{ return doIndexOf(c, start, _length); } + +inline int32_t +UnicodeString::indexOf(UChar32 c, + int32_t start, + int32_t _length) const +{ return doIndexOf(c, start, _length); } + +inline int32_t +UnicodeString::indexOf(char16_t c) const +{ return doIndexOf(c, 0, length()); } + +inline int32_t +UnicodeString::indexOf(UChar32 c) const +{ return indexOf(c, 0, length()); } + +inline int32_t +UnicodeString::indexOf(char16_t c, + int32_t start) const { + pinIndex(start); + return doIndexOf(c, start, length() - start); +} + +inline int32_t +UnicodeString::indexOf(UChar32 c, + int32_t start) const { + pinIndex(start); + return indexOf(c, start, length() - start); +} + +inline int32_t +UnicodeString::lastIndexOf(ConstChar16Ptr srcChars, + int32_t srcLength, + int32_t start, + int32_t _length) const +{ return lastIndexOf(srcChars, 0, srcLength, start, _length); } + +inline int32_t +UnicodeString::lastIndexOf(const char16_t *srcChars, + int32_t srcLength, + int32_t start) const { + pinIndex(start); + return lastIndexOf(srcChars, 0, srcLength, start, length() - start); +} + +inline int32_t +UnicodeString::lastIndexOf(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t _length) const +{ + if(!srcText.isBogus()) { + srcText.pinIndices(srcStart, srcLength); + if(srcLength > 0) { + return lastIndexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length); + } + } + return -1; +} + +inline int32_t +UnicodeString::lastIndexOf(const UnicodeString& text, + int32_t start, + int32_t _length) const +{ return lastIndexOf(text, 0, text.length(), start, _length); } + +inline int32_t +UnicodeString::lastIndexOf(const UnicodeString& text, + int32_t start) const { + pinIndex(start); + return lastIndexOf(text, 0, text.length(), start, length() - start); +} + +inline int32_t +UnicodeString::lastIndexOf(const UnicodeString& text) const +{ return lastIndexOf(text, 0, text.length(), 0, length()); } + +inline int32_t +UnicodeString::lastIndexOf(char16_t c, + int32_t start, + int32_t _length) const +{ return doLastIndexOf(c, start, _length); } + +inline int32_t +UnicodeString::lastIndexOf(UChar32 c, + int32_t start, + int32_t _length) const { + return doLastIndexOf(c, start, _length); +} + +inline int32_t +UnicodeString::lastIndexOf(char16_t c) const +{ return doLastIndexOf(c, 0, length()); } + +inline int32_t +UnicodeString::lastIndexOf(UChar32 c) const { + return lastIndexOf(c, 0, length()); +} + +inline int32_t +UnicodeString::lastIndexOf(char16_t c, + int32_t start) const { + pinIndex(start); + return doLastIndexOf(c, start, length() - start); +} + +inline int32_t +UnicodeString::lastIndexOf(UChar32 c, + int32_t start) const { + pinIndex(start); + return lastIndexOf(c, start, length() - start); +} + +inline UBool +UnicodeString::startsWith(const UnicodeString& text) const +{ return compare(0, text.length(), text, 0, text.length()) == 0; } + +inline UBool +UnicodeString::startsWith(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; } + +inline UBool +UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const { + if(srcLength < 0) { + srcLength = u_strlen(toUCharPtr(srcChars)); + } + return doCompare(0, srcLength, srcChars, 0, srcLength) == 0; +} + +inline UBool +UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { + if(srcLength < 0) { + srcLength = u_strlen(toUCharPtr(srcChars)); + } + return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0; +} + +inline UBool +UnicodeString::endsWith(const UnicodeString& text) const +{ return doCompare(length() - text.length(), text.length(), + text, 0, text.length()) == 0; } + +inline UBool +UnicodeString::endsWith(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const { + srcText.pinIndices(srcStart, srcLength); + return doCompare(length() - srcLength, srcLength, + srcText, srcStart, srcLength) == 0; +} + +inline UBool +UnicodeString::endsWith(ConstChar16Ptr srcChars, + int32_t srcLength) const { + if(srcLength < 0) { + srcLength = u_strlen(toUCharPtr(srcChars)); + } + return doCompare(length() - srcLength, srcLength, + srcChars, 0, srcLength) == 0; +} + +inline UBool +UnicodeString::endsWith(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const { + if(srcLength < 0) { + srcLength = u_strlen(toUCharPtr(srcChars + srcStart)); + } + return doCompare(length() - srcLength, srcLength, + srcChars, srcStart, srcLength) == 0; +} + +//======================================== +// replace +//======================================== +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + const UnicodeString& srcText) +{ return doReplace(start, _length, srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) +{ return doReplace(start, _length, srcText, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + ConstChar16Ptr srcChars, + int32_t srcLength) +{ return doReplace(start, _length, srcChars, 0, srcLength); } + +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) +{ return doReplace(start, _length, srcChars, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + char16_t srcChar) +{ return doReplace(start, _length, &srcChar, 0, 1); } + +inline UnicodeString& +UnicodeString::replaceBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText) +{ return doReplace(start, limit - start, srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::replaceBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) +{ return doReplace(start, limit - start, srcText, srcStart, srcLimit - srcStart); } + +inline UnicodeString& +UnicodeString::findAndReplace(const UnicodeString& oldText, + const UnicodeString& newText) +{ return findAndReplace(0, length(), oldText, 0, oldText.length(), + newText, 0, newText.length()); } + +inline UnicodeString& +UnicodeString::findAndReplace(int32_t start, + int32_t _length, + const UnicodeString& oldText, + const UnicodeString& newText) +{ return findAndReplace(start, _length, oldText, 0, oldText.length(), + newText, 0, newText.length()); } + +// ============================ +// extract +// ============================ +inline void +UnicodeString::doExtract(int32_t start, + int32_t _length, + UnicodeString& target) const +{ target.replace(0, target.length(), *this, start, _length); } + +inline void +UnicodeString::extract(int32_t start, + int32_t _length, + Char16Ptr target, + int32_t targetStart) const +{ doExtract(start, _length, target, targetStart); } + +inline void +UnicodeString::extract(int32_t start, + int32_t _length, + UnicodeString& target) const +{ doExtract(start, _length, target); } + +#if !UCONFIG_NO_CONVERSION + +inline int32_t +UnicodeString::extract(int32_t start, + int32_t _length, + char *dst, + const char *codepage) const + +{ + // This dstSize value will be checked explicitly + return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage); +} + +#endif + +inline void +UnicodeString::extractBetween(int32_t start, + int32_t limit, + char16_t *dst, + int32_t dstStart) const { + pinIndex(start); + pinIndex(limit); + doExtract(start, limit - start, dst, dstStart); +} + +inline UnicodeString +UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const { + return tempSubString(start, limit - start); +} + +inline char16_t +UnicodeString::doCharAt(int32_t offset) const +{ + if((uint32_t)offset < (uint32_t)length()) { + return getArrayStart()[offset]; + } else { + return kInvalidUChar; + } +} + +inline char16_t +UnicodeString::charAt(int32_t offset) const +{ return doCharAt(offset); } + +inline char16_t +UnicodeString::operator[] (int32_t offset) const +{ return doCharAt(offset); } + +inline UBool +UnicodeString::isEmpty() const { + // Arithmetic or logical right shift does not matter: only testing for 0. + return (fUnion.fFields.fLengthAndFlags>>kLengthShift) == 0; +} + +//======================================== +// Write implementation methods +//======================================== +inline void +UnicodeString::setZeroLength() { + fUnion.fFields.fLengthAndFlags &= kAllStorageFlags; +} + +inline void +UnicodeString::setShortLength(int32_t len) { + // requires 0 <= len <= kMaxShortLength + fUnion.fFields.fLengthAndFlags = + (int16_t)((fUnion.fFields.fLengthAndFlags & kAllStorageFlags) | (len << kLengthShift)); +} + +inline void +UnicodeString::setLength(int32_t len) { + if(len <= kMaxShortLength) { + setShortLength(len); + } else { + fUnion.fFields.fLengthAndFlags |= kLengthIsLarge; + fUnion.fFields.fLength = len; + } +} + +inline void +UnicodeString::setToEmpty() { + fUnion.fFields.fLengthAndFlags = kShortString; +} + +inline void +UnicodeString::setArray(char16_t *array, int32_t len, int32_t capacity) { + setLength(len); + fUnion.fFields.fArray = array; + fUnion.fFields.fCapacity = capacity; +} + +inline UnicodeString& +UnicodeString::operator= (char16_t ch) +{ return doReplace(0, length(), &ch, 0, 1); } + +inline UnicodeString& +UnicodeString::operator= (UChar32 ch) +{ return replace(0, length(), ch); } + +inline UnicodeString& +UnicodeString::setTo(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) +{ + unBogus(); + return doReplace(0, length(), srcText, srcStart, srcLength); +} + +inline UnicodeString& +UnicodeString::setTo(const UnicodeString& srcText, + int32_t srcStart) +{ + unBogus(); + srcText.pinIndex(srcStart); + return doReplace(0, length(), srcText, srcStart, srcText.length() - srcStart); +} + +inline UnicodeString& +UnicodeString::setTo(const UnicodeString& srcText) +{ + return copyFrom(srcText); +} + +inline UnicodeString& +UnicodeString::setTo(const char16_t *srcChars, + int32_t srcLength) +{ + unBogus(); + return doReplace(0, length(), srcChars, 0, srcLength); +} + +inline UnicodeString& +UnicodeString::setTo(char16_t srcChar) +{ + unBogus(); + return doReplace(0, length(), &srcChar, 0, 1); +} + +inline UnicodeString& +UnicodeString::setTo(UChar32 srcChar) +{ + unBogus(); + return replace(0, length(), srcChar); +} + +inline UnicodeString& +UnicodeString::append(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) +{ return doAppend(srcText, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::append(const UnicodeString& srcText) +{ return doAppend(srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::append(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) +{ return doAppend(srcChars, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::append(ConstChar16Ptr srcChars, + int32_t srcLength) +{ return doAppend(srcChars, 0, srcLength); } + +inline UnicodeString& +UnicodeString::append(char16_t srcChar) +{ return doAppend(&srcChar, 0, 1); } + +inline UnicodeString& +UnicodeString::operator+= (char16_t ch) +{ return doAppend(&ch, 0, 1); } + +inline UnicodeString& +UnicodeString::operator+= (UChar32 ch) { + return append(ch); +} + +inline UnicodeString& +UnicodeString::operator+= (const UnicodeString& srcText) +{ return doAppend(srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) +{ return doReplace(start, 0, srcText, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + const UnicodeString& srcText) +{ return doReplace(start, 0, srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) +{ return doReplace(start, 0, srcChars, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + ConstChar16Ptr srcChars, + int32_t srcLength) +{ return doReplace(start, 0, srcChars, 0, srcLength); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + char16_t srcChar) +{ return doReplace(start, 0, &srcChar, 0, 1); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + UChar32 srcChar) +{ return replace(start, 0, srcChar); } + + +inline UnicodeString& +UnicodeString::remove() +{ + // remove() of a bogus string makes the string empty and non-bogus + if(isBogus()) { + setToEmpty(); + } else { + setZeroLength(); + } + return *this; +} + +inline UnicodeString& +UnicodeString::remove(int32_t start, + int32_t _length) +{ + if(start <= 0 && _length == INT32_MAX) { + // remove(guaranteed everything) of a bogus string makes the string empty and non-bogus + return remove(); + } + return doReplace(start, _length, NULL, 0, 0); +} + +inline UnicodeString& +UnicodeString::removeBetween(int32_t start, + int32_t limit) +{ return doReplace(start, limit - start, NULL, 0, 0); } + +inline UnicodeString & +UnicodeString::retainBetween(int32_t start, int32_t limit) { + truncate(limit); + return doReplace(0, start, NULL, 0, 0); +} + +inline UBool +UnicodeString::truncate(int32_t targetLength) +{ + if(isBogus() && targetLength == 0) { + // truncate(0) of a bogus string makes the string empty and non-bogus + unBogus(); + return false; + } else if((uint32_t)targetLength < (uint32_t)length()) { + setLength(targetLength); + return true; + } else { + return false; + } +} + +inline UnicodeString& +UnicodeString::reverse() +{ return doReverse(0, length()); } + +inline UnicodeString& +UnicodeString::reverse(int32_t start, + int32_t _length) +{ return doReverse(start, _length); } + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unorm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unorm.h new file mode 100644 index 0000000000000000000000000000000000000000..c3c57582d449d567cfa887a36161d720bbc45497 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unorm.h @@ -0,0 +1,476 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (c) 1996-2016, International Business Machines Corporation +* and others. All Rights Reserved. +******************************************************************************* +* File unorm.h +* +* Created by: Vladimir Weinstein 12052000 +* +* Modification history : +* +* Date Name Description +* 02/01/01 synwee Added normalization quickcheck enum and method. +*/ +#ifndef UNORM_H +#define UNORM_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/uiter.h" +#include "unicode/unorm2.h" + +/** + * \file + * \brief C API: Unicode Normalization + * + * Old Unicode normalization API. + * + * This API has been replaced by the unorm2.h API and is only available + * for backward compatibility. The functions here simply delegate to the + * unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize(). + * There is one exception: The new API does not provide a replacement for unorm_compare(). + * Its declaration has been moved to unorm2.h. + * + * unorm_normalize transforms Unicode text into an equivalent composed or + * decomposed form, allowing for easier sorting and searching of text. + * unorm_normalize supports the standard normalization forms described in + * + * Unicode Standard Annex #15: Unicode Normalization Forms. + * + * Characters with accents or other adornments can be encoded in + * several different ways in Unicode. For example, take the character A-acute. + * In Unicode, this can be encoded as a single character (the + * "composed" form): + * + * \code + * 00C1 LATIN CAPITAL LETTER A WITH ACUTE + * \endcode + * + * or as two separate characters (the "decomposed" form): + * + * \code + * 0041 LATIN CAPITAL LETTER A + * 0301 COMBINING ACUTE ACCENT + * \endcode + * + * To a user of your program, however, both of these sequences should be + * treated as the same "user-level" character "A with acute accent". When you are searching or + * comparing text, you must ensure that these two sequences are treated + * equivalently. In addition, you must handle characters with more than one + * accent. Sometimes the order of a character's combining accents is + * significant, while in other cases accent sequences in different orders are + * really equivalent. + * + * Similarly, the string "ffi" can be encoded as three separate letters: + * + * \code + * 0066 LATIN SMALL LETTER F + * 0066 LATIN SMALL LETTER F + * 0069 LATIN SMALL LETTER I + * \endcode + * + * or as the single character + * + * \code + * FB03 LATIN SMALL LIGATURE FFI + * \endcode + * + * The ffi ligature is not a distinct semantic character, and strictly speaking + * it shouldn't be in Unicode at all, but it was included for compatibility + * with existing character sets that already provided it. The Unicode standard + * identifies such characters by giving them "compatibility" decompositions + * into the corresponding semantic characters. When sorting and searching, you + * will often want to use these mappings. + * + * unorm_normalize helps solve these problems by transforming text into the + * canonical composed and decomposed forms as shown in the first example above. + * In addition, you can have it perform compatibility decompositions so that + * you can treat compatibility characters the same as their equivalents. + * Finally, unorm_normalize rearranges accents into the proper canonical + * order, so that you do not have to worry about accent rearrangement on your + * own. + * + * Form FCD, "Fast C or D", is also designed for collation. + * It allows to work on strings that are not necessarily normalized + * with an algorithm (like in collation) that works under "canonical closure", i.e., it treats precomposed + * characters and their decomposed equivalents the same. + * + * It is not a normalization form because it does not provide for uniqueness of representation. Multiple strings + * may be canonically equivalent (their NFDs are identical) and may all conform to FCD without being identical + * themselves. + * + * The form is defined such that the "raw decomposition", the recursive canonical decomposition of each character, + * results in a string that is canonically ordered. This means that precomposed characters are allowed for as long + * as their decompositions do not need canonical reordering. + * + * Its advantage for a process like collation is that all NFD and most NFC texts - and many unnormalized texts - + * already conform to FCD and do not need to be normalized (NFD) for such a process. The FCD quick check will + * return UNORM_YES for most strings in practice. + * + * unorm_normalize(UNORM_FCD) may be implemented with UNORM_NFD. + * + * For more details on FCD see the collation design document: + * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm + * + * ICU collation performs either NFD or FCD normalization automatically if normalization + * is turned on for the collator object. + * Beyond collation and string search, normalized strings may be useful for string equivalence comparisons, + * transliteration/transcription, unique representations, etc. + * + * The W3C generally recommends to exchange texts in NFC. + * Note also that most legacy character encodings use only precomposed forms and often do not + * encode any combining marks by themselves. For conversion to such character encodings the + * Unicode text needs to be normalized to NFC. + * For more usage examples, see the Unicode Standard Annex. + */ + +// Do not conditionalize the following enum with #ifndef U_HIDE_DEPRECATED_API, +// it is needed for layout of Normalizer object. +#ifndef U_FORCE_HIDE_DEPRECATED_API + +/** + * Constants for normalization modes. + * @deprecated ICU 56 Use unorm2.h instead. + */ +typedef enum { + /** No decomposition/composition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NONE = 1, + /** Canonical decomposition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NFD = 2, + /** Compatibility decomposition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NFKD = 3, + /** Canonical decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NFC = 4, + /** Default normalization. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_DEFAULT = UNORM_NFC, + /** Compatibility decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NFKC =5, + /** "Fast C or D" form. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_FCD = 6, + + /** One more than the highest normalization mode constant. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_MODE_COUNT +} UNormalizationMode; + +#endif // U_FORCE_HIDE_DEPRECATED_API + +#ifndef U_HIDE_DEPRECATED_API + +/** + * Constants for options flags for normalization. + * Use 0 for default options, + * including normalization according to the Unicode version + * that is currently supported by ICU (see u_getUnicodeVersion). + * @deprecated ICU 56 Use unorm2.h instead. + */ +enum { + /** + * Options bit set value to select Unicode 3.2 normalization + * (except NormalizationCorrections). + * At most one Unicode version can be selected at a time. + * @deprecated ICU 56 Use unorm2.h instead. + */ + UNORM_UNICODE_3_2=0x20 +}; + +/** + * Lowest-order bit number of unorm_compare() options bits corresponding to + * normalization options bits. + * + * The options parameter for unorm_compare() uses most bits for + * itself and for various comparison and folding flags. + * The most significant bits, however, are shifted down and passed on + * to the normalization implementation. + * (That is, from unorm_compare(..., options, ...), + * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the + * internal normalization functions.) + * + * @see unorm_compare + * @deprecated ICU 56 Use unorm2.h instead. + */ +#define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 + +/** + * Normalize a string. + * The string will be normalized according the specified normalization mode + * and options. + * The source and result buffers must not be the same, nor overlap. + * + * @param source The string to normalize. + * @param sourceLength The length of source, or -1 if NUL-terminated. + * @param mode The normalization mode; one of UNORM_NONE, + * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT. + * @param options The normalization options, ORed together (0 for no options). + * @param result A pointer to a buffer to receive the result string. + * The result string is NUL-terminated if possible. + * @param resultLength The maximum size of result. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The total buffer size needed; if greater than resultLength, + * the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR. + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED int32_t U_EXPORT2 +unorm_normalize(const UChar *source, int32_t sourceLength, + UNormalizationMode mode, int32_t options, + UChar *result, int32_t resultLength, + UErrorCode *status); + +/** + * Performing quick check on a string, to quickly determine if the string is + * in a particular normalization format. + * Three types of result can be returned UNORM_YES, UNORM_NO or + * UNORM_MAYBE. Result UNORM_YES indicates that the argument + * string is in the desired normalized format, UNORM_NO determines that + * argument string is not in the desired normalized format. A + * UNORM_MAYBE result indicates that a more thorough check is required, + * the user may have to put the string in its normalized form and compare the + * results. + * + * @param source string for determining if it is in a normalized format + * @param sourcelength length of source to test, or -1 if NUL-terminated + * @param mode which normalization form to test for + * @param status a pointer to a UErrorCode to receive any errors + * @return UNORM_YES, UNORM_NO or UNORM_MAYBE + * + * @see unorm_isNormalized + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED UNormalizationCheckResult U_EXPORT2 +unorm_quickCheck(const UChar *source, int32_t sourcelength, + UNormalizationMode mode, + UErrorCode *status); + +/** + * Performing quick check on a string; same as unorm_quickCheck but + * takes an extra options parameter like most normalization functions. + * + * @param src String that is to be tested if it is in a normalization format. + * @param srcLength Length of source to test, or -1 if NUL-terminated. + * @param mode Which normalization form to test for. + * @param options The normalization options, ORed together (0 for no options). + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return UNORM_YES, UNORM_NO or UNORM_MAYBE + * + * @see unorm_quickCheck + * @see unorm_isNormalized + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED UNormalizationCheckResult U_EXPORT2 +unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, + UNormalizationMode mode, int32_t options, + UErrorCode *pErrorCode); + +/** + * Test if a string is in a given normalization form. + * This is semantically equivalent to source.equals(normalize(source, mode)) . + * + * Unlike unorm_quickCheck(), this function returns a definitive result, + * never a "maybe". + * For NFD, NFKD, and FCD, both functions work exactly the same. + * For NFC and NFKC where quickCheck may return "maybe", this function will + * perform further tests to arrive at a true/false result. + * + * @param src String that is to be tested if it is in a normalization format. + * @param srcLength Length of source to test, or -1 if NUL-terminated. + * @param mode Which normalization form to test for. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Boolean value indicating whether the source string is in the + * "mode" normalization form. + * + * @see unorm_quickCheck + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED UBool U_EXPORT2 +unorm_isNormalized(const UChar *src, int32_t srcLength, + UNormalizationMode mode, + UErrorCode *pErrorCode); + +/** + * Test if a string is in a given normalization form; same as unorm_isNormalized but + * takes an extra options parameter like most normalization functions. + * + * @param src String that is to be tested if it is in a normalization format. + * @param srcLength Length of source to test, or -1 if NUL-terminated. + * @param mode Which normalization form to test for. + * @param options The normalization options, ORed together (0 for no options). + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Boolean value indicating whether the source string is in the + * "mode/options" normalization form. + * + * @see unorm_quickCheck + * @see unorm_isNormalized + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED UBool U_EXPORT2 +unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, + UNormalizationMode mode, int32_t options, + UErrorCode *pErrorCode); + +/** + * Iterative normalization forward. + * This function (together with unorm_previous) is somewhat + * similar to the C++ Normalizer class (see its non-static functions). + * + * Iterative normalization is useful when only a small portion of a longer + * string/text needs to be processed. + * + * For example, the likelihood may be high that processing the first 10% of some + * text will be sufficient to find certain data. + * Another example: When one wants to concatenate two normalized strings and get a + * normalized result, it is much more efficient to normalize just a small part of + * the result around the concatenation place instead of re-normalizing everything. + * + * The input text is an instance of the C character iteration API UCharIterator. + * It may wrap around a simple string, a CharacterIterator, a Replaceable, or any + * other kind of text object. + * + * If a buffer overflow occurs, then the caller needs to reset the iterator to the + * old index and call the function again with a larger buffer - if the caller cares + * for the actual output. + * Regardless of the output buffer, the iterator will always be moved to the next + * normalization boundary. + * + * This function (like unorm_previous) serves two purposes: + * + * 1) To find the next boundary so that the normalization of the part of the text + * from the current position to that boundary does not affect and is not affected + * by the part of the text beyond that boundary. + * + * 2) To normalize the text up to the boundary. + * + * The second step is optional, per the doNormalize parameter. + * It is omitted for operations like string concatenation, where the two adjacent + * string ends need to be normalized together. + * In such a case, the output buffer will just contain a copy of the text up to the + * boundary. + * + * pNeededToNormalize is an output-only parameter. Its output value is only defined + * if normalization was requested (doNormalize) and successful (especially, no + * buffer overflow). + * It is useful for operations like a normalizing transliterator, where one would + * not want to replace a piece of text if it is not modified. + * + * If doNormalize==true and pNeededToNormalize!=NULL then *pNeeded... is set true + * if the normalization was necessary. + * + * If doNormalize==false then *pNeededToNormalize will be set to false. + * + * If the buffer overflows, then *pNeededToNormalize will be undefined; + * essentially, whenever U_FAILURE is true (like in buffer overflows), this result + * will be undefined. + * + * @param src The input text in the form of a C character iterator. + * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. + * @param destCapacity The number of UChars that fit into dest. + * @param mode The normalization mode. + * @param options The normalization options, ORed together (0 for no options). + * @param doNormalize Indicates if the source text up to the next boundary + * is to be normalized (true) or just copied (false). + * @param pNeededToNormalize Output flag indicating if the normalization resulted in + * different text from the input. + * Not defined if an error occurs including buffer overflow. + * Always false if !doNormalize. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Length of output (number of UChars) when successful or buffer overflow. + * + * @see unorm_previous + * @see unorm_normalize + * + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED int32_t U_EXPORT2 +unorm_next(UCharIterator *src, + UChar *dest, int32_t destCapacity, + UNormalizationMode mode, int32_t options, + UBool doNormalize, UBool *pNeededToNormalize, + UErrorCode *pErrorCode); + +/** + * Iterative normalization backward. + * This function (together with unorm_next) is somewhat + * similar to the C++ Normalizer class (see its non-static functions). + * For all details see unorm_next. + * + * @param src The input text in the form of a C character iterator. + * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. + * @param destCapacity The number of UChars that fit into dest. + * @param mode The normalization mode. + * @param options The normalization options, ORed together (0 for no options). + * @param doNormalize Indicates if the source text up to the next boundary + * is to be normalized (true) or just copied (false). + * @param pNeededToNormalize Output flag indicating if the normalization resulted in + * different text from the input. + * Not defined if an error occurs including buffer overflow. + * Always false if !doNormalize. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Length of output (number of UChars) when successful or buffer overflow. + * + * @see unorm_next + * @see unorm_normalize + * + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED int32_t U_EXPORT2 +unorm_previous(UCharIterator *src, + UChar *dest, int32_t destCapacity, + UNormalizationMode mode, int32_t options, + UBool doNormalize, UBool *pNeededToNormalize, + UErrorCode *pErrorCode); + +/** + * Concatenate normalized strings, making sure that the result is normalized as well. + * + * If both the left and the right strings are in + * the normalization form according to "mode/options", + * then the result will be + * + * \code + * dest=normalize(left+right, mode, options) + * \endcode + * + * With the input strings already being normalized, + * this function will use unorm_next() and unorm_previous() + * to find the adjacent end pieces of the input strings. + * Only the concatenation of these end pieces will be normalized and + * then concatenated with the remaining parts of the input strings. + * + * It is allowed to have dest==left to avoid copying the entire left string. + * + * @param left Left source string, may be same as dest. + * @param leftLength Length of left source string, or -1 if NUL-terminated. + * @param right Right source string. Must not be the same as dest, nor overlap. + * @param rightLength Length of right source string, or -1 if NUL-terminated. + * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. + * @param destCapacity The number of UChars that fit into dest. + * @param mode The normalization mode. + * @param options The normalization options, ORed together (0 for no options). + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Length of output (number of UChars) when successful or buffer overflow. + * + * @see unorm_normalize + * @see unorm_next + * @see unorm_previous + * + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED int32_t U_EXPORT2 +unorm_concatenate(const UChar *left, int32_t leftLength, + const UChar *right, int32_t rightLength, + UChar *dest, int32_t destCapacity, + UNormalizationMode mode, int32_t options, + UErrorCode *pErrorCode); + +#endif /* U_HIDE_DEPRECATED_API */ +#endif /* #if !UCONFIG_NO_NORMALIZATION */ +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unorm2.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unorm2.h new file mode 100644 index 0000000000000000000000000000000000000000..24417b7103c12ea8111d08ee22c5c24b5c4dee2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/unorm2.h @@ -0,0 +1,606 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: unorm2.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009dec15 +* created by: Markus W. Scherer +*/ + +#ifndef __UNORM2_H__ +#define __UNORM2_H__ + +/** + * \file + * \brief C API: New API for Unicode Normalization. + * + * Unicode normalization functionality for standard Unicode normalization or + * for using custom mapping tables. + * All instances of UNormalizer2 are unmodifiable/immutable. + * Instances returned by unorm2_getInstance() are singletons that must not be deleted by the caller. + * For more details see the Normalizer2 C++ class. + */ + +#include "unicode/utypes.h" +#include "unicode/stringoptions.h" +#include "unicode/uset.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * Constants for normalization modes. + * For details about standard Unicode normalization forms + * and about the algorithms which are also used with custom mapping tables + * see http://www.unicode.org/unicode/reports/tr15/ + * @stable ICU 4.4 + */ +typedef enum { + /** + * Decomposition followed by composition. + * Same as standard NFC when using an "nfc" instance. + * Same as standard NFKC when using an "nfkc" instance. + * For details about standard Unicode normalization forms + * see http://www.unicode.org/unicode/reports/tr15/ + * @stable ICU 4.4 + */ + UNORM2_COMPOSE, + /** + * Map, and reorder canonically. + * Same as standard NFD when using an "nfc" instance. + * Same as standard NFKD when using an "nfkc" instance. + * For details about standard Unicode normalization forms + * see http://www.unicode.org/unicode/reports/tr15/ + * @stable ICU 4.4 + */ + UNORM2_DECOMPOSE, + /** + * "Fast C or D" form. + * If a string is in this form, then further decomposition without reordering + * would yield the same form as DECOMPOSE. + * Text in "Fast C or D" form can be processed efficiently with data tables + * that are "canonically closed", that is, that provide equivalent data for + * equivalent text, without having to be fully normalized. + * Not a standard Unicode normalization form. + * Not a unique form: Different FCD strings can be canonically equivalent. + * For details see http://www.unicode.org/notes/tn5/#FCD + * @stable ICU 4.4 + */ + UNORM2_FCD, + /** + * Compose only contiguously. + * Also known as "FCC" or "Fast C Contiguous". + * The result will often but not always be in NFC. + * The result will conform to FCD which is useful for processing. + * Not a standard Unicode normalization form. + * For details see http://www.unicode.org/notes/tn5/#FCC + * @stable ICU 4.4 + */ + UNORM2_COMPOSE_CONTIGUOUS +} UNormalization2Mode; + +/** + * Result values for normalization quick check functions. + * For details see http://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms + * @stable ICU 2.0 + */ +typedef enum UNormalizationCheckResult { + /** + * The input string is not in the normalization form. + * @stable ICU 2.0 + */ + UNORM_NO, + /** + * The input string is in the normalization form. + * @stable ICU 2.0 + */ + UNORM_YES, + /** + * The input string may or may not be in the normalization form. + * This value is only returned for composition forms like NFC and FCC, + * when a backward-combining character is found for which the surrounding text + * would have to be analyzed further. + * @stable ICU 2.0 + */ + UNORM_MAYBE +} UNormalizationCheckResult; + +/** + * Opaque C service object type for the new normalization API. + * @stable ICU 4.4 + */ +struct UNormalizer2; +typedef struct UNormalizer2 UNormalizer2; /**< C typedef for struct UNormalizer2. @stable ICU 4.4 */ + +#if !UCONFIG_NO_NORMALIZATION + +/** + * Returns a UNormalizer2 instance for Unicode NFC normalization. + * Same as unorm2_getInstance(NULL, "nfc", UNORM2_COMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_CAPI const UNormalizer2 * U_EXPORT2 +unorm2_getNFCInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance for Unicode NFD normalization. + * Same as unorm2_getInstance(NULL, "nfc", UNORM2_DECOMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_CAPI const UNormalizer2 * U_EXPORT2 +unorm2_getNFDInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance for Unicode NFKC normalization. + * Same as unorm2_getInstance(NULL, "nfkc", UNORM2_COMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_CAPI const UNormalizer2 * U_EXPORT2 +unorm2_getNFKCInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance for Unicode NFKD normalization. + * Same as unorm2_getInstance(NULL, "nfkc", UNORM2_DECOMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_CAPI const UNormalizer2 * U_EXPORT2 +unorm2_getNFKDInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance for Unicode NFKC_Casefold normalization. + * Same as unorm2_getInstance(NULL, "nfkc_cf", UNORM2_COMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_CAPI const UNormalizer2 * U_EXPORT2 +unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance which uses the specified data file + * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle) + * and which composes or decomposes text according to the specified mode. + * Returns an unmodifiable singleton instance. Do not delete it. + * + * Use packageName=NULL for data files that are part of ICU's own data. + * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD. + * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD. + * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold. + * + * @param packageName NULL for ICU built-in data, otherwise application data package name + * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file + * @param mode normalization mode (compose or decompose etc.) + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested UNormalizer2, if successful + * @stable ICU 4.4 + */ +U_CAPI const UNormalizer2 * U_EXPORT2 +unorm2_getInstance(const char *packageName, + const char *name, + UNormalization2Mode mode, + UErrorCode *pErrorCode); + +/** + * Constructs a filtered normalizer wrapping any UNormalizer2 instance + * and a filter set. + * Both are aliased and must not be modified or deleted while this object + * is used. + * The filter set should be frozen; otherwise the performance will suffer greatly. + * @param norm2 wrapped UNormalizer2 instance + * @param filterSet USet which determines the characters to be normalized + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested UNormalizer2, if successful + * @stable ICU 4.4 + */ +U_CAPI UNormalizer2 * U_EXPORT2 +unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode); + +/** + * Closes a UNormalizer2 instance from unorm2_openFiltered(). + * Do not close instances from unorm2_getInstance()! + * @param norm2 UNormalizer2 instance to be closed + * @stable ICU 4.4 + */ +U_CAPI void U_EXPORT2 +unorm2_close(UNormalizer2 *norm2); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUNormalizer2Pointer + * "Smart pointer" class, closes a UNormalizer2 via unorm2_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close); + +U_NAMESPACE_END + +#endif + +/** + * Writes the normalized form of the source string to the destination string + * (replacing its contents) and returns the length of the destination string. + * The source and destination strings must be different buffers. + * @param norm2 UNormalizer2 instance + * @param src source string + * @param length length of the source string, or -1 if NUL-terminated + * @param dest destination string; its contents is replaced with normalized src + * @param capacity number of UChars that can be written to dest + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +unorm2_normalize(const UNormalizer2 *norm2, + const UChar *src, int32_t length, + UChar *dest, int32_t capacity, + UErrorCode *pErrorCode); +/** + * Appends the normalized form of the second string to the first string + * (merging them at the boundary) and returns the length of the first string. + * The result is normalized if the first string was normalized. + * The first and second strings must be different buffers. + * @param norm2 UNormalizer2 instance + * @param first string, should be normalized + * @param firstLength length of the first string, or -1 if NUL-terminated + * @param firstCapacity number of UChars that can be written to first + * @param second string, will be normalized + * @param secondLength length of the source string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2, + UChar *first, int32_t firstLength, int32_t firstCapacity, + const UChar *second, int32_t secondLength, + UErrorCode *pErrorCode); +/** + * Appends the second string to the first string + * (merging them at the boundary) and returns the length of the first string. + * The result is normalized if both the strings were normalized. + * The first and second strings must be different buffers. + * @param norm2 UNormalizer2 instance + * @param first string, should be normalized + * @param firstLength length of the first string, or -1 if NUL-terminated + * @param firstCapacity number of UChars that can be written to first + * @param second string, should be normalized + * @param secondLength length of the source string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +unorm2_append(const UNormalizer2 *norm2, + UChar *first, int32_t firstLength, int32_t firstCapacity, + const UChar *second, int32_t secondLength, + UErrorCode *pErrorCode); + +/** + * Gets the decomposition mapping of c. + * Roughly equivalent to normalizing the String form of c + * on a UNORM2_DECOMPOSE UNormalizer2 instance, but much faster, and except that this function + * returns a negative value and does not write a string + * if c does not have a decomposition mapping in this instance's data. + * This function is independent of the mode of the UNormalizer2. + * @param norm2 UNormalizer2 instance + * @param c code point + * @param decomposition String buffer which will be set to c's + * decomposition mapping, if there is one. + * @param capacity number of UChars that can be written to decomposition + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the non-negative length of c's decomposition, if there is one; otherwise a negative value + * @stable ICU 4.6 + */ +U_CAPI int32_t U_EXPORT2 +unorm2_getDecomposition(const UNormalizer2 *norm2, + UChar32 c, UChar *decomposition, int32_t capacity, + UErrorCode *pErrorCode); + +/** + * Gets the raw decomposition mapping of c. + * + * This is similar to the unorm2_getDecomposition() function but returns the + * raw decomposition mapping as specified in UnicodeData.txt or + * (for custom data) in the mapping files processed by the gennorm2 tool. + * By contrast, unorm2_getDecomposition() returns the processed, + * recursively-decomposed version of this mapping. + * + * When used on a standard NFKC Normalizer2 instance, + * unorm2_getRawDecomposition() returns the Unicode Decomposition_Mapping (dm) property. + * + * When used on a standard NFC Normalizer2 instance, + * it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can); + * in this case, the result contains either one or two code points (=1..4 UChars). + * + * This function is independent of the mode of the UNormalizer2. + * @param norm2 UNormalizer2 instance + * @param c code point + * @param decomposition String buffer which will be set to c's + * raw decomposition mapping, if there is one. + * @param capacity number of UChars that can be written to decomposition + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the non-negative length of c's raw decomposition, if there is one; otherwise a negative value + * @stable ICU 49 + */ +U_CAPI int32_t U_EXPORT2 +unorm2_getRawDecomposition(const UNormalizer2 *norm2, + UChar32 c, UChar *decomposition, int32_t capacity, + UErrorCode *pErrorCode); + +/** + * Performs pairwise composition of a & b and returns the composite if there is one. + * + * Returns a composite code point c only if c has a two-way mapping to a+b. + * In standard Unicode normalization, this means that + * c has a canonical decomposition to a+b + * and c does not have the Full_Composition_Exclusion property. + * + * This function is independent of the mode of the UNormalizer2. + * @param norm2 UNormalizer2 instance + * @param a A (normalization starter) code point. + * @param b Another code point. + * @return The non-negative composite code point if there is one; otherwise a negative value. + * @stable ICU 49 + */ +U_CAPI UChar32 U_EXPORT2 +unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b); + +/** + * Gets the combining class of c. + * The default implementation returns 0 + * but all standard implementations return the Unicode Canonical_Combining_Class value. + * @param norm2 UNormalizer2 instance + * @param c code point + * @return c's combining class + * @stable ICU 49 + */ +U_CAPI uint8_t U_EXPORT2 +unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c); + +/** + * Tests if the string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * @param norm2 UNormalizer2 instance + * @param s input string + * @param length length of the string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return true if s is normalized + * @stable ICU 4.4 + */ +U_CAPI UBool U_EXPORT2 +unorm2_isNormalized(const UNormalizer2 *norm2, + const UChar *s, int32_t length, + UErrorCode *pErrorCode); + +/** + * Tests if the string is normalized. + * For the two COMPOSE modes, the result could be "maybe" in cases that + * would take a little more work to resolve definitively. + * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster + * combination of quick check + normalization, to avoid + * re-checking the "yes" prefix. + * @param norm2 UNormalizer2 instance + * @param s input string + * @param length length of the string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return UNormalizationCheckResult + * @stable ICU 4.4 + */ +U_CAPI UNormalizationCheckResult U_EXPORT2 +unorm2_quickCheck(const UNormalizer2 *norm2, + const UChar *s, int32_t length, + UErrorCode *pErrorCode); + +/** + * Returns the end of the normalized substring of the input string. + * In other words, with end=spanQuickCheckYes(s, ec); + * the substring UnicodeString(s, 0, end) + * will pass the quick check with a "yes" result. + * + * The returned end index is usually one or more characters before the + * "no" or "maybe" character: The end index is at a normalization boundary. + * (See the class documentation for more about normalization boundaries.) + * + * When the goal is a normalized string and most input strings are expected + * to be normalized already, then call this method, + * and if it returns a prefix shorter than the input string, + * copy that prefix and use normalizeSecondAndAppend() for the remainder. + * @param norm2 UNormalizer2 instance + * @param s input string + * @param length length of the string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return "yes" span end index + * @stable ICU 4.4 + */ +U_CAPI int32_t U_EXPORT2 +unorm2_spanQuickCheckYes(const UNormalizer2 *norm2, + const UChar *s, int32_t length, + UErrorCode *pErrorCode); + +/** + * Tests if the character always has a normalization boundary before it, + * regardless of context. + * For details see the Normalizer2 base class documentation. + * @param norm2 UNormalizer2 instance + * @param c character to test + * @return true if c has a normalization boundary before it + * @stable ICU 4.4 + */ +U_CAPI UBool U_EXPORT2 +unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c); + +/** + * Tests if the character always has a normalization boundary after it, + * regardless of context. + * For details see the Normalizer2 base class documentation. + * @param norm2 UNormalizer2 instance + * @param c character to test + * @return true if c has a normalization boundary after it + * @stable ICU 4.4 + */ +U_CAPI UBool U_EXPORT2 +unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c); + +/** + * Tests if the character is normalization-inert. + * For details see the Normalizer2 base class documentation. + * @param norm2 UNormalizer2 instance + * @param c character to test + * @return true if c is normalization-inert + * @stable ICU 4.4 + */ +U_CAPI UBool U_EXPORT2 +unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); + +/** + * Compares two strings for canonical equivalence. + * Further options include case-insensitive comparison and + * code point order (as opposed to code unit order). + * + * Canonical equivalence between two strings is defined as their normalized + * forms (NFD or NFC) being identical. + * This function compares strings incrementally instead of normalizing + * (and optionally case-folding) both strings entirely, + * improving performance significantly. + * + * Bulk normalization is only necessary if the strings do not fulfill the FCD + * conditions. Only in this case, and only if the strings are relatively long, + * is memory allocated temporarily. + * For FCD strings and short non-FCD strings there is no memory allocation. + * + * Semantically, this is equivalent to + * strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2)))) + * where code point order and foldCase are all optional. + * + * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match + * the case folding must be performed first, then the normalization. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Case-sensitive comparison in code unit order, and the input strings + * are quick-checked for FCD. + * + * - UNORM_INPUT_IS_FCD + * Set if the caller knows that both s1 and s2 fulfill the FCD conditions. + * If not set, the function will quickCheck for FCD + * and normalize if necessary. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_COMPARE_IGNORE_CASE + * Set to compare strings case-insensitively using case folding, + * instead of case-sensitively. + * If set, then the following case folding options are used. + * + * - Options as used with case-insensitive comparisons, currently: + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * (see u_strCaseCompare for details) + * + * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT + * + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return <0 or 0 or >0 as usual for string comparisons + * + * @see unorm_normalize + * @see UNORM_FCD + * @see u_strCompare + * @see u_strCaseCompare + * + * @stable ICU 2.2 + */ +U_CAPI int32_t U_EXPORT2 +unorm_compare(const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + uint32_t options, + UErrorCode *pErrorCode); + +#endif /* !UCONFIG_NO_NORMALIZATION */ +#endif /* __UNORM2_H__ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uobject.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uobject.h new file mode 100644 index 0000000000000000000000000000000000000000..eeb331ce973cf040680cb0ed052847ee964ed5e3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uobject.h @@ -0,0 +1,324 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2002-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: uobject.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002jun26 +* created by: Markus W. Scherer +*/ + +#ifndef __UOBJECT_H__ +#define __UOBJECT_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/platform.h" + +/** + * \file + * \brief C++ API: Common ICU base class UObject. + */ + +/** + * \def U_NO_THROW + * Since ICU 64, use U_NOEXCEPT instead. + * + * Previously, define this to define the throw() specification so + * certain functions do not throw any exceptions + * + * UMemory operator new methods should have the throw() specification + * appended to them, so that the compiler adds the additional NULL check + * before calling constructors. Without, if operator new returns NULL the + * constructor is still called, and if the constructor references member + * data, (which it typically does), the result is a segmentation violation. + * + * @stable ICU 4.2. Since ICU 64, Use U_NOEXCEPT instead. See ICU-20422. + */ +#ifndef U_NO_THROW +#define U_NO_THROW U_NOEXCEPT +#endif + +/*===========================================================================*/ +/* UClassID-based RTTI */ +/*===========================================================================*/ + +/** + * UClassID is used to identify classes without using the compiler's RTTI. + * This was used before C++ compilers consistently supported RTTI. + * ICU 4.6 requires compiler RTTI to be turned on. + * + * Each class hierarchy which needs + * to implement polymorphic clone() or operator==() defines two methods, + * described in detail below. UClassID values can be compared using + * operator==(). Nothing else should be done with them. + * + * \par + * In class hierarchies that implement "poor man's RTTI", + * each concrete subclass implements getDynamicClassID() in the same way: + * + * \code + * class Derived { + * public: + * virtual UClassID getDynamicClassID() const + * { return Derived::getStaticClassID(); } + * } + * \endcode + * + * Each concrete class implements getStaticClassID() as well, which allows + * clients to test for a specific type. + * + * \code + * class Derived { + * public: + * static UClassID U_EXPORT2 getStaticClassID(); + * private: + * static char fgClassID; + * } + * + * // In Derived.cpp: + * UClassID Derived::getStaticClassID() + * { return (UClassID)&Derived::fgClassID; } + * char Derived::fgClassID = 0; // Value is irrelevant + * \endcode + * @stable ICU 2.0 + */ +typedef void* UClassID; + +U_NAMESPACE_BEGIN + +/** + * UMemory is the common ICU base class. + * All other ICU C++ classes are derived from UMemory (starting with ICU 2.4). + * + * This is primarily to make it possible and simple to override the + * C++ memory management by adding new/delete operators to this base class. + * + * To override ALL ICU memory management, including that from plain C code, + * replace the allocation functions declared in cmemory.h + * + * UMemory does not contain any virtual functions. + * Common "boilerplate" functions are defined in UObject. + * + * @stable ICU 2.4 + */ +class U_COMMON_API UMemory { +public: + +/* test versions for debugging shaper heap memory problems */ +#ifdef SHAPER_MEMORY_DEBUG + static void * NewArray(int size, int count); + static void * GrowArray(void * array, int newSize ); + static void FreeArray(void * array ); +#endif + +#if U_OVERRIDE_CXX_ALLOCATION + /** + * Override for ICU4C C++ memory management. + * simple, non-class types are allocated using the macros in common/cmemory.h + * (uprv_malloc(), uprv_free(), uprv_realloc()); + * they or something else could be used here to implement C++ new/delete + * for ICU4C C++ classes + * @stable ICU 2.4 + */ + static void * U_EXPORT2 operator new(size_t size) U_NOEXCEPT; + + /** + * Override for ICU4C C++ memory management. + * See new(). + * @stable ICU 2.4 + */ + static void * U_EXPORT2 operator new[](size_t size) U_NOEXCEPT; + + /** + * Override for ICU4C C++ memory management. + * simple, non-class types are allocated using the macros in common/cmemory.h + * (uprv_malloc(), uprv_free(), uprv_realloc()); + * they or something else could be used here to implement C++ new/delete + * for ICU4C C++ classes + * @stable ICU 2.4 + */ + static void U_EXPORT2 operator delete(void *p) U_NOEXCEPT; + + /** + * Override for ICU4C C++ memory management. + * See delete(). + * @stable ICU 2.4 + */ + static void U_EXPORT2 operator delete[](void *p) U_NOEXCEPT; + +#if U_HAVE_PLACEMENT_NEW + /** + * Override for ICU4C C++ memory management for STL. + * See new(). + * @stable ICU 2.6 + */ + static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NOEXCEPT { return ptr; } + + /** + * Override for ICU4C C++ memory management for STL. + * See delete(). + * @stable ICU 2.6 + */ + static inline void U_EXPORT2 operator delete(void *, void *) U_NOEXCEPT {} +#endif /* U_HAVE_PLACEMENT_NEW */ +#if U_HAVE_DEBUG_LOCATION_NEW + /** + * This method overrides the MFC debug version of the operator new + * + * @param size The requested memory size + * @param file The file where the allocation was requested + * @param line The line where the allocation was requested + */ + static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NOEXCEPT; + /** + * This method provides a matching delete for the MFC debug new + * + * @param p The pointer to the allocated memory + * @param file The file where the allocation was requested + * @param line The line where the allocation was requested + */ + static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NOEXCEPT; +#endif /* U_HAVE_DEBUG_LOCATION_NEW */ +#endif /* U_OVERRIDE_CXX_ALLOCATION */ + + /* + * Assignment operator not declared. The compiler will provide one + * which does nothing since this class does not contain any data members. + * API/code coverage may show the assignment operator as present and + * untested - ignore. + * Subclasses need this assignment operator if they use compiler-provided + * assignment operators of their own. An alternative to not declaring one + * here would be to declare and empty-implement a protected or public one. + UMemory &UMemory::operator=(const UMemory &); + */ +}; + +/** + * UObject is the common ICU "boilerplate" class. + * UObject inherits UMemory (starting with ICU 2.4), + * and all other public ICU C++ classes + * are derived from UObject (starting with ICU 2.2). + * + * UObject contains common virtual functions, in particular a virtual destructor. + * + * The clone() function is not available in UObject because it is not + * implemented by all ICU classes. + * Many ICU services provide a clone() function for their class trees, + * defined on the service's C++ base class + * (which itself is a subclass of UObject). + * + * @stable ICU 2.2 + */ +class U_COMMON_API UObject : public UMemory { +public: + /** + * Destructor. + * + * @stable ICU 2.2 + */ + virtual ~UObject(); + + /** + * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. + * The base class implementation returns a dummy value. + * + * Use compiler RTTI rather than ICU's "poor man's RTTI". + * Since ICU 4.6, new ICU C++ class hierarchies do not implement "poor man's RTTI". + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + +protected: + // the following functions are protected to prevent instantiation and + // direct use of UObject itself + + // default constructor + // inline UObject() {} + + // copy constructor + // inline UObject(const UObject &other) {} + +#if 0 + // TODO Sometime in the future. Implement operator==(). + // (This comment inserted in 2.2) + // some or all of the following "boilerplate" functions may be made public + // in a future ICU4C release when all subclasses implement them + + // assignment operator + // (not virtual, see "Taligent's Guide to Designing Programs" pp.73..74) + // commented out because the implementation is the same as a compiler's default + // UObject &operator=(const UObject &other) { return *this; } + + // comparison operators + virtual inline UBool operator==(const UObject &other) const { return this==&other; } + inline UBool operator!=(const UObject &other) const { return !operator==(other); } + + // clone() commented out from the base class: + // some compilers do not support co-variant return types + // (i.e., subclasses would have to return UObject * as well, instead of SubClass *) + // see also UObject class documentation. + // virtual UObject *clone() const; +#endif + + /* + * Assignment operator not declared. The compiler will provide one + * which does nothing since this class does not contain any data members. + * API/code coverage may show the assignment operator as present and + * untested - ignore. + * Subclasses need this assignment operator if they use compiler-provided + * assignment operators of their own. An alternative to not declaring one + * here would be to declare and empty-implement a protected or public one. + UObject &UObject::operator=(const UObject &); + */ +}; + +#ifndef U_HIDE_INTERNAL_API +/** + * This is a simple macro to add ICU RTTI to an ICU object implementation. + * This does not go into the header. This should only be used in *.cpp files. + * + * @param myClass The name of the class that needs RTTI defined. + * @internal + */ +#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass) \ + UClassID U_EXPORT2 myClass::getStaticClassID() { \ + static char classID = 0; \ + return (UClassID)&classID; \ + } \ + UClassID myClass::getDynamicClassID() const \ + { return myClass::getStaticClassID(); } + + +/** + * This macro adds ICU RTTI to an ICU abstract class implementation. + * This macro should be invoked in *.cpp files. The corresponding + * header should declare getStaticClassID. + * + * @param myClass The name of the class that needs RTTI defined. + * @internal + */ +#define UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass) \ + UClassID U_EXPORT2 myClass::getStaticClassID() { \ + static char classID = 0; \ + return (UClassID)&classID; \ + } + +#endif /* U_HIDE_INTERNAL_API */ + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/urename.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/urename.h new file mode 100644 index 0000000000000000000000000000000000000000..737f4b308ef83f93be224fb85f33515e7591afdd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/urename.h @@ -0,0 +1,1939 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* +* file name: urename.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* Created by: Perl script tools/genren.pl written by Vladimir Weinstein +* +* Contains data for renaming ICU exports. +* Gets included by umachine.h +* +* THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT +* YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! +*/ + +#ifndef URENAME_H +#define URENAME_H + +/* U_DISABLE_RENAMING can be defined in the following ways: + * - when running configure, e.g. + * runConfigureICU Linux --disable-renaming + * - by changing the default setting of U_DISABLE_RENAMING in uconfig.h + */ + +#include "unicode/uconfig.h" + +#if !U_DISABLE_RENAMING + +// Disable Renaming for Visual Studio's IntelliSense feature, so that 'Go-to-Definition' (F12) will work. +#if !(defined(_MSC_VER) && defined(__INTELLISENSE__)) + +/* We need the U_ICU_ENTRY_POINT_RENAME definition. There's a default one in unicode/uvernum.h we can use, but we will give + the platform a chance to define it first. + Normally (if utypes.h or umachine.h was included first) this will not be necessary as it will already be defined. + */ + +#ifndef U_ICU_ENTRY_POINT_RENAME +#include "unicode/umachine.h" +#endif + +/* If we still don't have U_ICU_ENTRY_POINT_RENAME use the default. */ +#ifndef U_ICU_ENTRY_POINT_RENAME +#include "unicode/uvernum.h" +#endif + +/* Error out before the following defines cause very strange and unexpected code breakage */ +#ifndef U_ICU_ENTRY_POINT_RENAME +#error U_ICU_ENTRY_POINT_RENAME is not defined - cannot continue. Consider defining U_DISABLE_RENAMING if renaming should not be used. +#endif + + +/* C exports renaming data */ + +#define T_CString_int64ToString U_ICU_ENTRY_POINT_RENAME(T_CString_int64ToString) +#define T_CString_integerToString U_ICU_ENTRY_POINT_RENAME(T_CString_integerToString) +#define T_CString_stringToInteger U_ICU_ENTRY_POINT_RENAME(T_CString_stringToInteger) +#define T_CString_toLowerCase U_ICU_ENTRY_POINT_RENAME(T_CString_toLowerCase) +#define T_CString_toUpperCase U_ICU_ENTRY_POINT_RENAME(T_CString_toUpperCase) +#define UCNV_FROM_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_ESCAPE) +#define UCNV_FROM_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SKIP) +#define UCNV_FROM_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_STOP) +#define UCNV_FROM_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SUBSTITUTE) +#define UCNV_TO_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_ESCAPE) +#define UCNV_TO_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SKIP) +#define UCNV_TO_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_STOP) +#define UCNV_TO_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SUBSTITUTE) +#define UDataMemory_createNewInstance U_ICU_ENTRY_POINT_RENAME(UDataMemory_createNewInstance) +#define UDataMemory_init U_ICU_ENTRY_POINT_RENAME(UDataMemory_init) +#define UDataMemory_isLoaded U_ICU_ENTRY_POINT_RENAME(UDataMemory_isLoaded) +#define UDataMemory_normalizeDataPointer U_ICU_ENTRY_POINT_RENAME(UDataMemory_normalizeDataPointer) +#define UDataMemory_setData U_ICU_ENTRY_POINT_RENAME(UDataMemory_setData) +#define UDatamemory_assign U_ICU_ENTRY_POINT_RENAME(UDatamemory_assign) +#define _ASCIIData U_ICU_ENTRY_POINT_RENAME(_ASCIIData) +#define _Bocu1Data U_ICU_ENTRY_POINT_RENAME(_Bocu1Data) +#define _CESU8Data U_ICU_ENTRY_POINT_RENAME(_CESU8Data) +#define _CompoundTextData U_ICU_ENTRY_POINT_RENAME(_CompoundTextData) +#define _HZData U_ICU_ENTRY_POINT_RENAME(_HZData) +#define _IMAPData U_ICU_ENTRY_POINT_RENAME(_IMAPData) +#define _ISCIIData U_ICU_ENTRY_POINT_RENAME(_ISCIIData) +#define _ISO2022Data U_ICU_ENTRY_POINT_RENAME(_ISO2022Data) +#define _LMBCSData1 U_ICU_ENTRY_POINT_RENAME(_LMBCSData1) +#define _LMBCSData11 U_ICU_ENTRY_POINT_RENAME(_LMBCSData11) +#define _LMBCSData16 U_ICU_ENTRY_POINT_RENAME(_LMBCSData16) +#define _LMBCSData17 U_ICU_ENTRY_POINT_RENAME(_LMBCSData17) +#define _LMBCSData18 U_ICU_ENTRY_POINT_RENAME(_LMBCSData18) +#define _LMBCSData19 U_ICU_ENTRY_POINT_RENAME(_LMBCSData19) +#define _LMBCSData2 U_ICU_ENTRY_POINT_RENAME(_LMBCSData2) +#define _LMBCSData3 U_ICU_ENTRY_POINT_RENAME(_LMBCSData3) +#define _LMBCSData4 U_ICU_ENTRY_POINT_RENAME(_LMBCSData4) +#define _LMBCSData5 U_ICU_ENTRY_POINT_RENAME(_LMBCSData5) +#define _LMBCSData6 U_ICU_ENTRY_POINT_RENAME(_LMBCSData6) +#define _LMBCSData8 U_ICU_ENTRY_POINT_RENAME(_LMBCSData8) +#define _Latin1Data U_ICU_ENTRY_POINT_RENAME(_Latin1Data) +#define _MBCSData U_ICU_ENTRY_POINT_RENAME(_MBCSData) +#define _SCSUData U_ICU_ENTRY_POINT_RENAME(_SCSUData) +#define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData) +#define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data) +#define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData) +#define _UTF16v2Data U_ICU_ENTRY_POINT_RENAME(_UTF16v2Data) +#define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData) +#define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data) +#define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData) +#define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data) +#define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data) +#define _isUnicodeLocaleTypeSubtag U_ICU_ENTRY_POINT_RENAME(_isUnicodeLocaleTypeSubtag) +#define allowedHourFormatsCleanup U_ICU_ENTRY_POINT_RENAME(allowedHourFormatsCleanup) +#define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup) +#define dayPeriodRulesCleanup U_ICU_ENTRY_POINT_RENAME(dayPeriodRulesCleanup) +#define deleteAllowedHourFormats U_ICU_ENTRY_POINT_RENAME(deleteAllowedHourFormats) +#define gTimeZoneFilesInitOnce U_ICU_ENTRY_POINT_RENAME(gTimeZoneFilesInitOnce) +#define initNumsysNames U_ICU_ENTRY_POINT_RENAME(initNumsysNames) +#define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone) +#define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close) +#define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals) +#define izrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(izrule_getDSTSavings) +#define izrule_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(izrule_getDynamicClassID) +#define izrule_getFinalStart U_ICU_ENTRY_POINT_RENAME(izrule_getFinalStart) +#define izrule_getFirstStart U_ICU_ENTRY_POINT_RENAME(izrule_getFirstStart) +#define izrule_getName U_ICU_ENTRY_POINT_RENAME(izrule_getName) +#define izrule_getNextStart U_ICU_ENTRY_POINT_RENAME(izrule_getNextStart) +#define izrule_getPreviousStart U_ICU_ENTRY_POINT_RENAME(izrule_getPreviousStart) +#define izrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(izrule_getRawOffset) +#define izrule_getStaticClassID U_ICU_ENTRY_POINT_RENAME(izrule_getStaticClassID) +#define izrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(izrule_isEquivalentTo) +#define izrule_open U_ICU_ENTRY_POINT_RENAME(izrule_open) +#define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart) +#define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default) +#define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default) +#define numSysCleanup U_ICU_ENTRY_POINT_RENAME(numSysCleanup) +#define rbbi_cleanup U_ICU_ENTRY_POINT_RENAME(rbbi_cleanup) +#define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun) +#define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun) +#define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun) +#define pl_close U_ICU_ENTRY_POINT_RENAME(pl_close) +#define pl_closeFontRuns U_ICU_ENTRY_POINT_RENAME(pl_closeFontRuns) +#define pl_closeLine U_ICU_ENTRY_POINT_RENAME(pl_closeLine) +#define pl_closeLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_closeLocaleRuns) +#define pl_closeValueRuns U_ICU_ENTRY_POINT_RENAME(pl_closeValueRuns) +#define pl_countLineRuns U_ICU_ENTRY_POINT_RENAME(pl_countLineRuns) +#define pl_create U_ICU_ENTRY_POINT_RENAME(pl_create) +#define pl_getAscent U_ICU_ENTRY_POINT_RENAME(pl_getAscent) +#define pl_getDescent U_ICU_ENTRY_POINT_RENAME(pl_getDescent) +#define pl_getFontRunCount U_ICU_ENTRY_POINT_RENAME(pl_getFontRunCount) +#define pl_getFontRunFont U_ICU_ENTRY_POINT_RENAME(pl_getFontRunFont) +#define pl_getFontRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLastLimit) +#define pl_getFontRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLimit) +#define pl_getLeading U_ICU_ENTRY_POINT_RENAME(pl_getLeading) +#define pl_getLineAscent U_ICU_ENTRY_POINT_RENAME(pl_getLineAscent) +#define pl_getLineDescent U_ICU_ENTRY_POINT_RENAME(pl_getLineDescent) +#define pl_getLineLeading U_ICU_ENTRY_POINT_RENAME(pl_getLineLeading) +#define pl_getLineVisualRun U_ICU_ENTRY_POINT_RENAME(pl_getLineVisualRun) +#define pl_getLineWidth U_ICU_ENTRY_POINT_RENAME(pl_getLineWidth) +#define pl_getLocaleRunCount U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunCount) +#define pl_getLocaleRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLastLimit) +#define pl_getLocaleRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLimit) +#define pl_getLocaleRunLocale U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLocale) +#define pl_getParagraphLevel U_ICU_ENTRY_POINT_RENAME(pl_getParagraphLevel) +#define pl_getTextDirection U_ICU_ENTRY_POINT_RENAME(pl_getTextDirection) +#define pl_getValueRunCount U_ICU_ENTRY_POINT_RENAME(pl_getValueRunCount) +#define pl_getValueRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLastLimit) +#define pl_getValueRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLimit) +#define pl_getValueRunValue U_ICU_ENTRY_POINT_RENAME(pl_getValueRunValue) +#define pl_getVisualRunAscent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunAscent) +#define pl_getVisualRunDescent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDescent) +#define pl_getVisualRunDirection U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDirection) +#define pl_getVisualRunFont U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunFont) +#define pl_getVisualRunGlyphCount U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphCount) +#define pl_getVisualRunGlyphToCharMap U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphToCharMap) +#define pl_getVisualRunGlyphs U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphs) +#define pl_getVisualRunLeading U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunLeading) +#define pl_getVisualRunPositions U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunPositions) +#define pl_isComplex U_ICU_ENTRY_POINT_RENAME(pl_isComplex) +#define pl_nextLine U_ICU_ENTRY_POINT_RENAME(pl_nextLine) +#define pl_openEmptyFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyFontRuns) +#define pl_openEmptyLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyLocaleRuns) +#define pl_openEmptyValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyValueRuns) +#define pl_openFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openFontRuns) +#define pl_openLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openLocaleRuns) +#define pl_openValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openValueRuns) +#define pl_reflow U_ICU_ENTRY_POINT_RENAME(pl_reflow) +#define pl_resetFontRuns U_ICU_ENTRY_POINT_RENAME(pl_resetFontRuns) +#define pl_resetLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_resetLocaleRuns) +#define pl_resetValueRuns U_ICU_ENTRY_POINT_RENAME(pl_resetValueRuns) +#define res_countArrayItems U_ICU_ENTRY_POINT_RENAME(res_countArrayItems) +#define res_findResource U_ICU_ENTRY_POINT_RENAME(res_findResource) +#define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias) +#define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem) +#define res_getBinaryNoTrace U_ICU_ENTRY_POINT_RENAME(res_getBinaryNoTrace) +#define res_getIntVectorNoTrace U_ICU_ENTRY_POINT_RENAME(res_getIntVectorNoTrace) +#define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType) +#define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource) +#define res_getStringNoTrace U_ICU_ENTRY_POINT_RENAME(res_getStringNoTrace) +#define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex) +#define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey) +#define res_load U_ICU_ENTRY_POINT_RENAME(res_load) +#define res_read U_ICU_ENTRY_POINT_RENAME(res_read) +#define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload) +#define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars) +#define u_asciiToUpper U_ICU_ENTRY_POINT_RENAME(u_asciiToUpper) +#define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy) +#define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy) +#define u_caseInsensitivePrefixMatch U_ICU_ENTRY_POINT_RENAME(u_caseInsensitivePrefixMatch) +#define u_catclose U_ICU_ENTRY_POINT_RENAME(u_catclose) +#define u_catgets U_ICU_ENTRY_POINT_RENAME(u_catgets) +#define u_catopen U_ICU_ENTRY_POINT_RENAME(u_catopen) +#define u_charAge U_ICU_ENTRY_POINT_RENAME(u_charAge) +#define u_charDigitValue U_ICU_ENTRY_POINT_RENAME(u_charDigitValue) +#define u_charDirection U_ICU_ENTRY_POINT_RENAME(u_charDirection) +#define u_charFromName U_ICU_ENTRY_POINT_RENAME(u_charFromName) +#define u_charMirror U_ICU_ENTRY_POINT_RENAME(u_charMirror) +#define u_charName U_ICU_ENTRY_POINT_RENAME(u_charName) +#define u_charType U_ICU_ENTRY_POINT_RENAME(u_charType) +#define u_charsToUChars U_ICU_ENTRY_POINT_RENAME(u_charsToUChars) +#define u_cleanup U_ICU_ENTRY_POINT_RENAME(u_cleanup) +#define u_countChar32 U_ICU_ENTRY_POINT_RENAME(u_countChar32) +#define u_digit U_ICU_ENTRY_POINT_RENAME(u_digit) +#define u_enumCharNames U_ICU_ENTRY_POINT_RENAME(u_enumCharNames) +#define u_enumCharTypes U_ICU_ENTRY_POINT_RENAME(u_enumCharTypes) +#define u_errorName U_ICU_ENTRY_POINT_RENAME(u_errorName) +#define u_fadopt U_ICU_ENTRY_POINT_RENAME(u_fadopt) +#define u_fclose U_ICU_ENTRY_POINT_RENAME(u_fclose) +#define u_feof U_ICU_ENTRY_POINT_RENAME(u_feof) +#define u_fflush U_ICU_ENTRY_POINT_RENAME(u_fflush) +#define u_fgetConverter U_ICU_ENTRY_POINT_RENAME(u_fgetConverter) +#define u_fgetNumberFormat U_ICU_ENTRY_POINT_RENAME(u_fgetNumberFormat) +#define u_fgetc U_ICU_ENTRY_POINT_RENAME(u_fgetc) +#define u_fgetcodepage U_ICU_ENTRY_POINT_RENAME(u_fgetcodepage) +#define u_fgetcx U_ICU_ENTRY_POINT_RENAME(u_fgetcx) +#define u_fgetfile U_ICU_ENTRY_POINT_RENAME(u_fgetfile) +#define u_fgetlocale U_ICU_ENTRY_POINT_RENAME(u_fgetlocale) +#define u_fgets U_ICU_ENTRY_POINT_RENAME(u_fgets) +#define u_file_read U_ICU_ENTRY_POINT_RENAME(u_file_read) +#define u_file_write U_ICU_ENTRY_POINT_RENAME(u_file_write) +#define u_file_write_flush U_ICU_ENTRY_POINT_RENAME(u_file_write_flush) +#define u_finit U_ICU_ENTRY_POINT_RENAME(u_finit) +#define u_flushDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_flushDefaultConverter) +#define u_foldCase U_ICU_ENTRY_POINT_RENAME(u_foldCase) +#define u_fopen U_ICU_ENTRY_POINT_RENAME(u_fopen) +#define u_fopen_u U_ICU_ENTRY_POINT_RENAME(u_fopen_u) +#define u_forDigit U_ICU_ENTRY_POINT_RENAME(u_forDigit) +#define u_formatMessage U_ICU_ENTRY_POINT_RENAME(u_formatMessage) +#define u_formatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_formatMessageWithError) +#define u_fprintf U_ICU_ENTRY_POINT_RENAME(u_fprintf) +#define u_fprintf_u U_ICU_ENTRY_POINT_RENAME(u_fprintf_u) +#define u_fputc U_ICU_ENTRY_POINT_RENAME(u_fputc) +#define u_fputs U_ICU_ENTRY_POINT_RENAME(u_fputs) +#define u_frewind U_ICU_ENTRY_POINT_RENAME(u_frewind) +#define u_fscanf U_ICU_ENTRY_POINT_RENAME(u_fscanf) +#define u_fscanf_u U_ICU_ENTRY_POINT_RENAME(u_fscanf_u) +#define u_fsetcodepage U_ICU_ENTRY_POINT_RENAME(u_fsetcodepage) +#define u_fsetlocale U_ICU_ENTRY_POINT_RENAME(u_fsetlocale) +#define u_fsettransliterator U_ICU_ENTRY_POINT_RENAME(u_fsettransliterator) +#define u_fstropen U_ICU_ENTRY_POINT_RENAME(u_fstropen) +#define u_fungetc U_ICU_ENTRY_POINT_RENAME(u_fungetc) +#define u_getBidiPairedBracket U_ICU_ENTRY_POINT_RENAME(u_getBidiPairedBracket) +#define u_getBinaryPropertySet U_ICU_ENTRY_POINT_RENAME(u_getBinaryPropertySet) +#define u_getCombiningClass U_ICU_ENTRY_POINT_RENAME(u_getCombiningClass) +#define u_getDataDirectory U_ICU_ENTRY_POINT_RENAME(u_getDataDirectory) +#define u_getDataVersion U_ICU_ENTRY_POINT_RENAME(u_getDataVersion) +#define u_getDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_getDefaultConverter) +#define u_getFC_NFKC_Closure U_ICU_ENTRY_POINT_RENAME(u_getFC_NFKC_Closure) +#define u_getISOComment U_ICU_ENTRY_POINT_RENAME(u_getISOComment) +#define u_getIntPropertyMap U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMap) +#define u_getIntPropertyMaxValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMaxValue) +#define u_getIntPropertyMinValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMinValue) +#define u_getIntPropertyValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyValue) +#define u_getMainProperties U_ICU_ENTRY_POINT_RENAME(u_getMainProperties) +#define u_getNumericValue U_ICU_ENTRY_POINT_RENAME(u_getNumericValue) +#define u_getPropertyEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyEnum) +#define u_getPropertyName U_ICU_ENTRY_POINT_RENAME(u_getPropertyName) +#define u_getPropertyValueEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueEnum) +#define u_getPropertyValueName U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueName) +#define u_getTimeZoneFilesDirectory U_ICU_ENTRY_POINT_RENAME(u_getTimeZoneFilesDirectory) +#define u_getUnicodeProperties U_ICU_ENTRY_POINT_RENAME(u_getUnicodeProperties) +#define u_getUnicodeVersion U_ICU_ENTRY_POINT_RENAME(u_getUnicodeVersion) +#define u_getVersion U_ICU_ENTRY_POINT_RENAME(u_getVersion) +#define u_get_stdout U_ICU_ENTRY_POINT_RENAME(u_get_stdout) +#define u_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(u_hasBinaryProperty) +#define u_init U_ICU_ENTRY_POINT_RENAME(u_init) +#define u_isIDIgnorable U_ICU_ENTRY_POINT_RENAME(u_isIDIgnorable) +#define u_isIDPart U_ICU_ENTRY_POINT_RENAME(u_isIDPart) +#define u_isIDStart U_ICU_ENTRY_POINT_RENAME(u_isIDStart) +#define u_isISOControl U_ICU_ENTRY_POINT_RENAME(u_isISOControl) +#define u_isJavaIDPart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDPart) +#define u_isJavaIDStart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDStart) +#define u_isJavaSpaceChar U_ICU_ENTRY_POINT_RENAME(u_isJavaSpaceChar) +#define u_isMirrored U_ICU_ENTRY_POINT_RENAME(u_isMirrored) +#define u_isUAlphabetic U_ICU_ENTRY_POINT_RENAME(u_isUAlphabetic) +#define u_isULowercase U_ICU_ENTRY_POINT_RENAME(u_isULowercase) +#define u_isUUppercase U_ICU_ENTRY_POINT_RENAME(u_isUUppercase) +#define u_isUWhiteSpace U_ICU_ENTRY_POINT_RENAME(u_isUWhiteSpace) +#define u_isWhitespace U_ICU_ENTRY_POINT_RENAME(u_isWhitespace) +#define u_isalnum U_ICU_ENTRY_POINT_RENAME(u_isalnum) +#define u_isalnumPOSIX U_ICU_ENTRY_POINT_RENAME(u_isalnumPOSIX) +#define u_isalpha U_ICU_ENTRY_POINT_RENAME(u_isalpha) +#define u_isbase U_ICU_ENTRY_POINT_RENAME(u_isbase) +#define u_isblank U_ICU_ENTRY_POINT_RENAME(u_isblank) +#define u_iscntrl U_ICU_ENTRY_POINT_RENAME(u_iscntrl) +#define u_isdefined U_ICU_ENTRY_POINT_RENAME(u_isdefined) +#define u_isdigit U_ICU_ENTRY_POINT_RENAME(u_isdigit) +#define u_isgraph U_ICU_ENTRY_POINT_RENAME(u_isgraph) +#define u_isgraphPOSIX U_ICU_ENTRY_POINT_RENAME(u_isgraphPOSIX) +#define u_islower U_ICU_ENTRY_POINT_RENAME(u_islower) +#define u_isprint U_ICU_ENTRY_POINT_RENAME(u_isprint) +#define u_isprintPOSIX U_ICU_ENTRY_POINT_RENAME(u_isprintPOSIX) +#define u_ispunct U_ICU_ENTRY_POINT_RENAME(u_ispunct) +#define u_isspace U_ICU_ENTRY_POINT_RENAME(u_isspace) +#define u_istitle U_ICU_ENTRY_POINT_RENAME(u_istitle) +#define u_isupper U_ICU_ENTRY_POINT_RENAME(u_isupper) +#define u_isxdigit U_ICU_ENTRY_POINT_RENAME(u_isxdigit) +#define u_locbund_close U_ICU_ENTRY_POINT_RENAME(u_locbund_close) +#define u_locbund_getNumberFormat U_ICU_ENTRY_POINT_RENAME(u_locbund_getNumberFormat) +#define u_locbund_init U_ICU_ENTRY_POINT_RENAME(u_locbund_init) +#define u_memcasecmp U_ICU_ENTRY_POINT_RENAME(u_memcasecmp) +#define u_memchr U_ICU_ENTRY_POINT_RENAME(u_memchr) +#define u_memchr32 U_ICU_ENTRY_POINT_RENAME(u_memchr32) +#define u_memcmp U_ICU_ENTRY_POINT_RENAME(u_memcmp) +#define u_memcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_memcmpCodePointOrder) +#define u_memcpy U_ICU_ENTRY_POINT_RENAME(u_memcpy) +#define u_memmove U_ICU_ENTRY_POINT_RENAME(u_memmove) +#define u_memrchr U_ICU_ENTRY_POINT_RENAME(u_memrchr) +#define u_memrchr32 U_ICU_ENTRY_POINT_RENAME(u_memrchr32) +#define u_memset U_ICU_ENTRY_POINT_RENAME(u_memset) +#define u_parseMessage U_ICU_ENTRY_POINT_RENAME(u_parseMessage) +#define u_parseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_parseMessageWithError) +#define u_printf U_ICU_ENTRY_POINT_RENAME(u_printf) +#define u_printf_parse U_ICU_ENTRY_POINT_RENAME(u_printf_parse) +#define u_printf_u U_ICU_ENTRY_POINT_RENAME(u_printf_u) +#define u_releaseDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_releaseDefaultConverter) +#define u_scanf_parse U_ICU_ENTRY_POINT_RENAME(u_scanf_parse) +#define u_setAtomicIncDecFunctions U_ICU_ENTRY_POINT_RENAME(u_setAtomicIncDecFunctions) +#define u_setDataDirectory U_ICU_ENTRY_POINT_RENAME(u_setDataDirectory) +#define u_setMemoryFunctions U_ICU_ENTRY_POINT_RENAME(u_setMemoryFunctions) +#define u_setMutexFunctions U_ICU_ENTRY_POINT_RENAME(u_setMutexFunctions) +#define u_setTimeZoneFilesDirectory U_ICU_ENTRY_POINT_RENAME(u_setTimeZoneFilesDirectory) +#define u_shapeArabic U_ICU_ENTRY_POINT_RENAME(u_shapeArabic) +#define u_snprintf U_ICU_ENTRY_POINT_RENAME(u_snprintf) +#define u_snprintf_u U_ICU_ENTRY_POINT_RENAME(u_snprintf_u) +#define u_sprintf U_ICU_ENTRY_POINT_RENAME(u_sprintf) +#define u_sprintf_u U_ICU_ENTRY_POINT_RENAME(u_sprintf_u) +#define u_sscanf U_ICU_ENTRY_POINT_RENAME(u_sscanf) +#define u_sscanf_u U_ICU_ENTRY_POINT_RENAME(u_sscanf_u) +#define u_strCaseCompare U_ICU_ENTRY_POINT_RENAME(u_strCaseCompare) +#define u_strCompare U_ICU_ENTRY_POINT_RENAME(u_strCompare) +#define u_strCompareIter U_ICU_ENTRY_POINT_RENAME(u_strCompareIter) +#define u_strFindFirst U_ICU_ENTRY_POINT_RENAME(u_strFindFirst) +#define u_strFindLast U_ICU_ENTRY_POINT_RENAME(u_strFindLast) +#define u_strFoldCase U_ICU_ENTRY_POINT_RENAME(u_strFoldCase) +#define u_strFromJavaModifiedUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromJavaModifiedUTF8WithSub) +#define u_strFromPunycode U_ICU_ENTRY_POINT_RENAME(u_strFromPunycode) +#define u_strFromUTF32 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32) +#define u_strFromUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32WithSub) +#define u_strFromUTF8 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8) +#define u_strFromUTF8Lenient U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8Lenient) +#define u_strFromUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8WithSub) +#define u_strFromWCS U_ICU_ENTRY_POINT_RENAME(u_strFromWCS) +#define u_strHasMoreChar32Than U_ICU_ENTRY_POINT_RENAME(u_strHasMoreChar32Than) +#define u_strToJavaModifiedUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToJavaModifiedUTF8) +#define u_strToLower U_ICU_ENTRY_POINT_RENAME(u_strToLower) +#define u_strToPunycode U_ICU_ENTRY_POINT_RENAME(u_strToPunycode) +#define u_strToTitle U_ICU_ENTRY_POINT_RENAME(u_strToTitle) +#define u_strToUTF32 U_ICU_ENTRY_POINT_RENAME(u_strToUTF32) +#define u_strToUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF32WithSub) +#define u_strToUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToUTF8) +#define u_strToUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF8WithSub) +#define u_strToUpper U_ICU_ENTRY_POINT_RENAME(u_strToUpper) +#define u_strToWCS U_ICU_ENTRY_POINT_RENAME(u_strToWCS) +#define u_strcasecmp U_ICU_ENTRY_POINT_RENAME(u_strcasecmp) +#define u_strcat U_ICU_ENTRY_POINT_RENAME(u_strcat) +#define u_strchr U_ICU_ENTRY_POINT_RENAME(u_strchr) +#define u_strchr32 U_ICU_ENTRY_POINT_RENAME(u_strchr32) +#define u_strcmp U_ICU_ENTRY_POINT_RENAME(u_strcmp) +#define u_strcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strcmpCodePointOrder) +#define u_strcmpFold U_ICU_ENTRY_POINT_RENAME(u_strcmpFold) +#define u_strcpy U_ICU_ENTRY_POINT_RENAME(u_strcpy) +#define u_strcspn U_ICU_ENTRY_POINT_RENAME(u_strcspn) +#define u_strlen U_ICU_ENTRY_POINT_RENAME(u_strlen) +#define u_strncasecmp U_ICU_ENTRY_POINT_RENAME(u_strncasecmp) +#define u_strncat U_ICU_ENTRY_POINT_RENAME(u_strncat) +#define u_strncmp U_ICU_ENTRY_POINT_RENAME(u_strncmp) +#define u_strncmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strncmpCodePointOrder) +#define u_strncpy U_ICU_ENTRY_POINT_RENAME(u_strncpy) +#define u_strpbrk U_ICU_ENTRY_POINT_RENAME(u_strpbrk) +#define u_strrchr U_ICU_ENTRY_POINT_RENAME(u_strrchr) +#define u_strrchr32 U_ICU_ENTRY_POINT_RENAME(u_strrchr32) +#define u_strrstr U_ICU_ENTRY_POINT_RENAME(u_strrstr) +#define u_strspn U_ICU_ENTRY_POINT_RENAME(u_strspn) +#define u_strstr U_ICU_ENTRY_POINT_RENAME(u_strstr) +#define u_strtok_r U_ICU_ENTRY_POINT_RENAME(u_strtok_r) +#define u_terminateChars U_ICU_ENTRY_POINT_RENAME(u_terminateChars) +#define u_terminateUChar32s U_ICU_ENTRY_POINT_RENAME(u_terminateUChar32s) +#define u_terminateUChars U_ICU_ENTRY_POINT_RENAME(u_terminateUChars) +#define u_terminateWChars U_ICU_ENTRY_POINT_RENAME(u_terminateWChars) +#define u_tolower U_ICU_ENTRY_POINT_RENAME(u_tolower) +#define u_totitle U_ICU_ENTRY_POINT_RENAME(u_totitle) +#define u_toupper U_ICU_ENTRY_POINT_RENAME(u_toupper) +#define u_uastrcpy U_ICU_ENTRY_POINT_RENAME(u_uastrcpy) +#define u_uastrncpy U_ICU_ENTRY_POINT_RENAME(u_uastrncpy) +#define u_unescape U_ICU_ENTRY_POINT_RENAME(u_unescape) +#define u_unescapeAt U_ICU_ENTRY_POINT_RENAME(u_unescapeAt) +#define u_versionFromString U_ICU_ENTRY_POINT_RENAME(u_versionFromString) +#define u_versionFromUString U_ICU_ENTRY_POINT_RENAME(u_versionFromUString) +#define u_versionToString U_ICU_ENTRY_POINT_RENAME(u_versionToString) +#define u_vformatMessage U_ICU_ENTRY_POINT_RENAME(u_vformatMessage) +#define u_vformatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vformatMessageWithError) +#define u_vfprintf U_ICU_ENTRY_POINT_RENAME(u_vfprintf) +#define u_vfprintf_u U_ICU_ENTRY_POINT_RENAME(u_vfprintf_u) +#define u_vfscanf U_ICU_ENTRY_POINT_RENAME(u_vfscanf) +#define u_vfscanf_u U_ICU_ENTRY_POINT_RENAME(u_vfscanf_u) +#define u_vparseMessage U_ICU_ENTRY_POINT_RENAME(u_vparseMessage) +#define u_vparseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vparseMessageWithError) +#define u_vsnprintf U_ICU_ENTRY_POINT_RENAME(u_vsnprintf) +#define u_vsnprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsnprintf_u) +#define u_vsprintf U_ICU_ENTRY_POINT_RENAME(u_vsprintf) +#define u_vsprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsprintf_u) +#define u_vsscanf U_ICU_ENTRY_POINT_RENAME(u_vsscanf) +#define u_vsscanf_u U_ICU_ENTRY_POINT_RENAME(u_vsscanf_u) +#define u_writeIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRun) +#define ubidi_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ubidi_addPropertyStarts) +#define ubidi_close U_ICU_ENTRY_POINT_RENAME(ubidi_close) +#define ubidi_countParagraphs U_ICU_ENTRY_POINT_RENAME(ubidi_countParagraphs) +#define ubidi_countRuns U_ICU_ENTRY_POINT_RENAME(ubidi_countRuns) +#define ubidi_getBaseDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getBaseDirection) +#define ubidi_getClass U_ICU_ENTRY_POINT_RENAME(ubidi_getClass) +#define ubidi_getClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_getClassCallback) +#define ubidi_getCustomizedClass U_ICU_ENTRY_POINT_RENAME(ubidi_getCustomizedClass) +#define ubidi_getDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getDirection) +#define ubidi_getJoiningGroup U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningGroup) +#define ubidi_getJoiningType U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningType) +#define ubidi_getLength U_ICU_ENTRY_POINT_RENAME(ubidi_getLength) +#define ubidi_getLevelAt U_ICU_ENTRY_POINT_RENAME(ubidi_getLevelAt) +#define ubidi_getLevels U_ICU_ENTRY_POINT_RENAME(ubidi_getLevels) +#define ubidi_getLogicalIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalIndex) +#define ubidi_getLogicalMap U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalMap) +#define ubidi_getLogicalRun U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalRun) +#define ubidi_getMaxValue U_ICU_ENTRY_POINT_RENAME(ubidi_getMaxValue) +#define ubidi_getMemory U_ICU_ENTRY_POINT_RENAME(ubidi_getMemory) +#define ubidi_getMirror U_ICU_ENTRY_POINT_RENAME(ubidi_getMirror) +#define ubidi_getPairedBracket U_ICU_ENTRY_POINT_RENAME(ubidi_getPairedBracket) +#define ubidi_getPairedBracketType U_ICU_ENTRY_POINT_RENAME(ubidi_getPairedBracketType) +#define ubidi_getParaLevel U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevel) +#define ubidi_getParaLevelAtIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevelAtIndex) +#define ubidi_getParagraph U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraph) +#define ubidi_getParagraphByIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraphByIndex) +#define ubidi_getProcessedLength U_ICU_ENTRY_POINT_RENAME(ubidi_getProcessedLength) +#define ubidi_getReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingMode) +#define ubidi_getReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingOptions) +#define ubidi_getResultLength U_ICU_ENTRY_POINT_RENAME(ubidi_getResultLength) +#define ubidi_getRuns U_ICU_ENTRY_POINT_RENAME(ubidi_getRuns) +#define ubidi_getText U_ICU_ENTRY_POINT_RENAME(ubidi_getText) +#define ubidi_getVisualIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualIndex) +#define ubidi_getVisualMap U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualMap) +#define ubidi_getVisualRun U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualRun) +#define ubidi_invertMap U_ICU_ENTRY_POINT_RENAME(ubidi_invertMap) +#define ubidi_isBidiControl U_ICU_ENTRY_POINT_RENAME(ubidi_isBidiControl) +#define ubidi_isInverse U_ICU_ENTRY_POINT_RENAME(ubidi_isInverse) +#define ubidi_isJoinControl U_ICU_ENTRY_POINT_RENAME(ubidi_isJoinControl) +#define ubidi_isMirrored U_ICU_ENTRY_POINT_RENAME(ubidi_isMirrored) +#define ubidi_isOrderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_isOrderParagraphsLTR) +#define ubidi_open U_ICU_ENTRY_POINT_RENAME(ubidi_open) +#define ubidi_openSized U_ICU_ENTRY_POINT_RENAME(ubidi_openSized) +#define ubidi_orderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_orderParagraphsLTR) +#define ubidi_reorderLogical U_ICU_ENTRY_POINT_RENAME(ubidi_reorderLogical) +#define ubidi_reorderVisual U_ICU_ENTRY_POINT_RENAME(ubidi_reorderVisual) +#define ubidi_setClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_setClassCallback) +#define ubidi_setContext U_ICU_ENTRY_POINT_RENAME(ubidi_setContext) +#define ubidi_setInverse U_ICU_ENTRY_POINT_RENAME(ubidi_setInverse) +#define ubidi_setLine U_ICU_ENTRY_POINT_RENAME(ubidi_setLine) +#define ubidi_setPara U_ICU_ENTRY_POINT_RENAME(ubidi_setPara) +#define ubidi_setReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingMode) +#define ubidi_setReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingOptions) +#define ubidi_writeReordered U_ICU_ENTRY_POINT_RENAME(ubidi_writeReordered) +#define ubidi_writeReverse U_ICU_ENTRY_POINT_RENAME(ubidi_writeReverse) +#define ubiditransform_close U_ICU_ENTRY_POINT_RENAME(ubiditransform_close) +#define ubiditransform_open U_ICU_ENTRY_POINT_RENAME(ubiditransform_open) +#define ubiditransform_transform U_ICU_ENTRY_POINT_RENAME(ubiditransform_transform) +#define ublock_getCode U_ICU_ENTRY_POINT_RENAME(ublock_getCode) +#define ubrk_clone U_ICU_ENTRY_POINT_RENAME(ubrk_clone) +#define ubrk_close U_ICU_ENTRY_POINT_RENAME(ubrk_close) +#define ubrk_countAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_countAvailable) +#define ubrk_current U_ICU_ENTRY_POINT_RENAME(ubrk_current) +#define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first) +#define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following) +#define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable) +#define ubrk_getBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_getBinaryRules) +#define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType) +#define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus) +#define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec) +#define ubrk_isBoundary U_ICU_ENTRY_POINT_RENAME(ubrk_isBoundary) +#define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last) +#define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next) +#define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open) +#define ubrk_openBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_openBinaryRules) +#define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules) +#define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding) +#define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous) +#define ubrk_refreshUText U_ICU_ENTRY_POINT_RENAME(ubrk_refreshUText) +#define ubrk_safeClone U_ICU_ENTRY_POINT_RENAME(ubrk_safeClone) +#define ubrk_setText U_ICU_ENTRY_POINT_RENAME(ubrk_setText) +#define ubrk_setUText U_ICU_ENTRY_POINT_RENAME(ubrk_setUText) +#define ubrk_swap U_ICU_ENTRY_POINT_RENAME(ubrk_swap) +#define ucache_compareKeys U_ICU_ENTRY_POINT_RENAME(ucache_compareKeys) +#define ucache_deleteKey U_ICU_ENTRY_POINT_RENAME(ucache_deleteKey) +#define ucache_hashKeys U_ICU_ENTRY_POINT_RENAME(ucache_hashKeys) +#define ucal_add U_ICU_ENTRY_POINT_RENAME(ucal_add) +#define ucal_clear U_ICU_ENTRY_POINT_RENAME(ucal_clear) +#define ucal_clearField U_ICU_ENTRY_POINT_RENAME(ucal_clearField) +#define ucal_clone U_ICU_ENTRY_POINT_RENAME(ucal_clone) +#define ucal_close U_ICU_ENTRY_POINT_RENAME(ucal_close) +#define ucal_countAvailable U_ICU_ENTRY_POINT_RENAME(ucal_countAvailable) +#define ucal_equivalentTo U_ICU_ENTRY_POINT_RENAME(ucal_equivalentTo) +#define ucal_get U_ICU_ENTRY_POINT_RENAME(ucal_get) +#define ucal_getAttribute U_ICU_ENTRY_POINT_RENAME(ucal_getAttribute) +#define ucal_getAvailable U_ICU_ENTRY_POINT_RENAME(ucal_getAvailable) +#define ucal_getCanonicalTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getCanonicalTimeZoneID) +#define ucal_getDSTSavings U_ICU_ENTRY_POINT_RENAME(ucal_getDSTSavings) +#define ucal_getDayOfWeekType U_ICU_ENTRY_POINT_RENAME(ucal_getDayOfWeekType) +#define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone) +#define ucal_getFieldDifference U_ICU_ENTRY_POINT_RENAME(ucal_getFieldDifference) +#define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange) +#define ucal_getHostTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getHostTimeZone) +#define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale) +#define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit) +#define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType) +#define ucal_getMillis U_ICU_ENTRY_POINT_RENAME(ucal_getMillis) +#define ucal_getNow U_ICU_ENTRY_POINT_RENAME(ucal_getNow) +#define ucal_getTZDataVersion U_ICU_ENTRY_POINT_RENAME(ucal_getTZDataVersion) +#define ucal_getTimeZoneDisplayName U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneDisplayName) +#define ucal_getTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneID) +#define ucal_getTimeZoneIDForWindowsID U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneIDForWindowsID) +#define ucal_getTimeZoneOffsetFromLocal U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneOffsetFromLocal) +#define ucal_getTimeZoneTransitionDate U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneTransitionDate) +#define ucal_getType U_ICU_ENTRY_POINT_RENAME(ucal_getType) +#define ucal_getWeekendTransition U_ICU_ENTRY_POINT_RENAME(ucal_getWeekendTransition) +#define ucal_getWindowsTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getWindowsTimeZoneID) +#define ucal_inDaylightTime U_ICU_ENTRY_POINT_RENAME(ucal_inDaylightTime) +#define ucal_isSet U_ICU_ENTRY_POINT_RENAME(ucal_isSet) +#define ucal_isWeekend U_ICU_ENTRY_POINT_RENAME(ucal_isWeekend) +#define ucal_open U_ICU_ENTRY_POINT_RENAME(ucal_open) +#define ucal_openCountryTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openCountryTimeZones) +#define ucal_openTimeZoneIDEnumeration U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZoneIDEnumeration) +#define ucal_openTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZones) +#define ucal_roll U_ICU_ENTRY_POINT_RENAME(ucal_roll) +#define ucal_set U_ICU_ENTRY_POINT_RENAME(ucal_set) +#define ucal_setAttribute U_ICU_ENTRY_POINT_RENAME(ucal_setAttribute) +#define ucal_setDate U_ICU_ENTRY_POINT_RENAME(ucal_setDate) +#define ucal_setDateTime U_ICU_ENTRY_POINT_RENAME(ucal_setDateTime) +#define ucal_setDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setDefaultTimeZone) +#define ucal_setGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_setGregorianChange) +#define ucal_setMillis U_ICU_ENTRY_POINT_RENAME(ucal_setMillis) +#define ucal_setTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setTimeZone) +#define ucase_addCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addCaseClosure) +#define ucase_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ucase_addPropertyStarts) +#define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure) +#define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold) +#define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale) +#define ucase_getTrie U_ICU_ENTRY_POINT_RENAME(ucase_getTrie) +#define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType) +#define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable) +#define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty) +#define ucase_isCaseSensitive U_ICU_ENTRY_POINT_RENAME(ucase_isCaseSensitive) +#define ucase_isSoftDotted U_ICU_ENTRY_POINT_RENAME(ucase_isSoftDotted) +#define ucase_toFullFolding U_ICU_ENTRY_POINT_RENAME(ucase_toFullFolding) +#define ucase_toFullLower U_ICU_ENTRY_POINT_RENAME(ucase_toFullLower) +#define ucase_toFullTitle U_ICU_ENTRY_POINT_RENAME(ucase_toFullTitle) +#define ucase_toFullUpper U_ICU_ENTRY_POINT_RENAME(ucase_toFullUpper) +#define ucase_tolower U_ICU_ENTRY_POINT_RENAME(ucase_tolower) +#define ucase_totitle U_ICU_ENTRY_POINT_RENAME(ucase_totitle) +#define ucase_toupper U_ICU_ENTRY_POINT_RENAME(ucase_toupper) +#define ucasemap_close U_ICU_ENTRY_POINT_RENAME(ucasemap_close) +#define ucasemap_getBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_getBreakIterator) +#define ucasemap_getLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_getLocale) +#define ucasemap_getOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_getOptions) +#define ucasemap_internalUTF8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_internalUTF8ToTitle) +#define ucasemap_open U_ICU_ENTRY_POINT_RENAME(ucasemap_open) +#define ucasemap_setBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_setBreakIterator) +#define ucasemap_setLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_setLocale) +#define ucasemap_setOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_setOptions) +#define ucasemap_toTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_toTitle) +#define ucasemap_utf8FoldCase U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8FoldCase) +#define ucasemap_utf8ToLower U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToLower) +#define ucasemap_utf8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToTitle) +#define ucasemap_utf8ToUpper U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToUpper) +#define ucfpos_close U_ICU_ENTRY_POINT_RENAME(ucfpos_close) +#define ucfpos_constrainCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainCategory) +#define ucfpos_constrainField U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainField) +#define ucfpos_getCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_getCategory) +#define ucfpos_getField U_ICU_ENTRY_POINT_RENAME(ucfpos_getField) +#define ucfpos_getIndexes U_ICU_ENTRY_POINT_RENAME(ucfpos_getIndexes) +#define ucfpos_getInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_getInt64IterationContext) +#define ucfpos_matchesField U_ICU_ENTRY_POINT_RENAME(ucfpos_matchesField) +#define ucfpos_open U_ICU_ENTRY_POINT_RENAME(ucfpos_open) +#define ucfpos_reset U_ICU_ENTRY_POINT_RENAME(ucfpos_reset) +#define ucfpos_setInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_setInt64IterationContext) +#define ucfpos_setState U_ICU_ENTRY_POINT_RENAME(ucfpos_setState) +#define uchar_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uchar_addPropertyStarts) +#define uchar_swapNames U_ICU_ENTRY_POINT_RENAME(uchar_swapNames) +#define ucln_cleanupOne U_ICU_ENTRY_POINT_RENAME(ucln_cleanupOne) +#define ucln_common_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_common_registerCleanup) +#define ucln_i18n_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_i18n_registerCleanup) +#define ucln_io_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_io_registerCleanup) +#define ucln_lib_cleanup U_ICU_ENTRY_POINT_RENAME(ucln_lib_cleanup) +#define ucln_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_registerCleanup) +#define ucnv_MBCSFromUChar32 U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUChar32) +#define ucnv_MBCSFromUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUnicodeWithOffsets) +#define ucnv_MBCSGetFilteredUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetFilteredUnicodeSetForUnicode) +#define ucnv_MBCSGetType U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetType) +#define ucnv_MBCSGetUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetUnicodeSetForUnicode) +#define ucnv_MBCSIsLeadByte U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSIsLeadByte) +#define ucnv_MBCSSimpleGetNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSSimpleGetNextUChar) +#define ucnv_MBCSToUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSToUnicodeWithOffsets) +#define ucnv_bld_countAvailableConverters U_ICU_ENTRY_POINT_RENAME(ucnv_bld_countAvailableConverters) +#define ucnv_bld_getAvailableConverter U_ICU_ENTRY_POINT_RENAME(ucnv_bld_getAvailableConverter) +#define ucnv_canCreateConverter U_ICU_ENTRY_POINT_RENAME(ucnv_canCreateConverter) +#define ucnv_cbFromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteBytes) +#define ucnv_cbFromUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteSub) +#define ucnv_cbFromUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteUChars) +#define ucnv_cbToUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteSub) +#define ucnv_cbToUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteUChars) +#define ucnv_close U_ICU_ENTRY_POINT_RENAME(ucnv_close) +#define ucnv_compareNames U_ICU_ENTRY_POINT_RENAME(ucnv_compareNames) +#define ucnv_convert U_ICU_ENTRY_POINT_RENAME(ucnv_convert) +#define ucnv_convertEx U_ICU_ENTRY_POINT_RENAME(ucnv_convertEx) +#define ucnv_countAliases U_ICU_ENTRY_POINT_RENAME(ucnv_countAliases) +#define ucnv_countAvailable U_ICU_ENTRY_POINT_RENAME(ucnv_countAvailable) +#define ucnv_countStandards U_ICU_ENTRY_POINT_RENAME(ucnv_countStandards) +#define ucnv_createAlgorithmicConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createAlgorithmicConverter) +#define ucnv_createConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createConverter) +#define ucnv_createConverterFromPackage U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromPackage) +#define ucnv_createConverterFromSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromSharedData) +#define ucnv_detectUnicodeSignature U_ICU_ENTRY_POINT_RENAME(ucnv_detectUnicodeSignature) +#define ucnv_enableCleanup U_ICU_ENTRY_POINT_RENAME(ucnv_enableCleanup) +#define ucnv_extContinueMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchFromU) +#define ucnv_extContinueMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchToU) +#define ucnv_extGetUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_extGetUnicodeSet) +#define ucnv_extInitialMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchFromU) +#define ucnv_extInitialMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchToU) +#define ucnv_extSimpleMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchFromU) +#define ucnv_extSimpleMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchToU) +#define ucnv_fixFileSeparator U_ICU_ENTRY_POINT_RENAME(ucnv_fixFileSeparator) +#define ucnv_flushCache U_ICU_ENTRY_POINT_RENAME(ucnv_flushCache) +#define ucnv_fromAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_fromAlgorithmic) +#define ucnv_fromUChars U_ICU_ENTRY_POINT_RENAME(ucnv_fromUChars) +#define ucnv_fromUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_fromUCountPending) +#define ucnv_fromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_fromUWriteBytes) +#define ucnv_fromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode) +#define ucnv_fromUnicode_UTF8 U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8) +#define ucnv_fromUnicode_UTF8_OFFSETS_LOGIC U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8_OFFSETS_LOGIC) +#define ucnv_getAlias U_ICU_ENTRY_POINT_RENAME(ucnv_getAlias) +#define ucnv_getAliases U_ICU_ENTRY_POINT_RENAME(ucnv_getAliases) +#define ucnv_getAvailableName U_ICU_ENTRY_POINT_RENAME(ucnv_getAvailableName) +#define ucnv_getCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_getCCSID) +#define ucnv_getCanonicalName U_ICU_ENTRY_POINT_RENAME(ucnv_getCanonicalName) +#define ucnv_getCompleteUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getCompleteUnicodeSet) +#define ucnv_getDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_getDefaultName) +#define ucnv_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucnv_getDisplayName) +#define ucnv_getFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getFromUCallBack) +#define ucnv_getInvalidChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidChars) +#define ucnv_getInvalidUChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidUChars) +#define ucnv_getMaxCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMaxCharSize) +#define ucnv_getMinCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMinCharSize) +#define ucnv_getName U_ICU_ENTRY_POINT_RENAME(ucnv_getName) +#define ucnv_getNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_getNextUChar) +#define ucnv_getNonSurrogateUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getNonSurrogateUnicodeSet) +#define ucnv_getPlatform U_ICU_ENTRY_POINT_RENAME(ucnv_getPlatform) +#define ucnv_getStandard U_ICU_ENTRY_POINT_RENAME(ucnv_getStandard) +#define ucnv_getStandardName U_ICU_ENTRY_POINT_RENAME(ucnv_getStandardName) +#define ucnv_getStarters U_ICU_ENTRY_POINT_RENAME(ucnv_getStarters) +#define ucnv_getSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_getSubstChars) +#define ucnv_getToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getToUCallBack) +#define ucnv_getType U_ICU_ENTRY_POINT_RENAME(ucnv_getType) +#define ucnv_getUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getUnicodeSet) +#define ucnv_incrementRefCount U_ICU_ENTRY_POINT_RENAME(ucnv_incrementRefCount) +#define ucnv_io_countKnownConverters U_ICU_ENTRY_POINT_RENAME(ucnv_io_countKnownConverters) +#define ucnv_io_getConverterName U_ICU_ENTRY_POINT_RENAME(ucnv_io_getConverterName) +#define ucnv_io_stripASCIIForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripASCIIForCompare) +#define ucnv_io_stripEBCDICForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripEBCDICForCompare) +#define ucnv_isAmbiguous U_ICU_ENTRY_POINT_RENAME(ucnv_isAmbiguous) +#define ucnv_isFixedWidth U_ICU_ENTRY_POINT_RENAME(ucnv_isFixedWidth) +#define ucnv_load U_ICU_ENTRY_POINT_RENAME(ucnv_load) +#define ucnv_loadSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_loadSharedData) +#define ucnv_open U_ICU_ENTRY_POINT_RENAME(ucnv_open) +#define ucnv_openAllNames U_ICU_ENTRY_POINT_RENAME(ucnv_openAllNames) +#define ucnv_openCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_openCCSID) +#define ucnv_openPackage U_ICU_ENTRY_POINT_RENAME(ucnv_openPackage) +#define ucnv_openStandardNames U_ICU_ENTRY_POINT_RENAME(ucnv_openStandardNames) +#define ucnv_openU U_ICU_ENTRY_POINT_RENAME(ucnv_openU) +#define ucnv_reset U_ICU_ENTRY_POINT_RENAME(ucnv_reset) +#define ucnv_resetFromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetFromUnicode) +#define ucnv_resetToUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetToUnicode) +#define ucnv_safeClone U_ICU_ENTRY_POINT_RENAME(ucnv_safeClone) +#define ucnv_setDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_setDefaultName) +#define ucnv_setFallback U_ICU_ENTRY_POINT_RENAME(ucnv_setFallback) +#define ucnv_setFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setFromUCallBack) +#define ucnv_setSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstChars) +#define ucnv_setSubstString U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstString) +#define ucnv_setToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setToUCallBack) +#define ucnv_swap U_ICU_ENTRY_POINT_RENAME(ucnv_swap) +#define ucnv_swapAliases U_ICU_ENTRY_POINT_RENAME(ucnv_swapAliases) +#define ucnv_toAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_toAlgorithmic) +#define ucnv_toUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUChars) +#define ucnv_toUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_toUCountPending) +#define ucnv_toUWriteCodePoint U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteCodePoint) +#define ucnv_toUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteUChars) +#define ucnv_toUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_toUnicode) +#define ucnv_unload U_ICU_ENTRY_POINT_RENAME(ucnv_unload) +#define ucnv_unloadSharedDataIfReady U_ICU_ENTRY_POINT_RENAME(ucnv_unloadSharedDataIfReady) +#define ucnv_usesFallback U_ICU_ENTRY_POINT_RENAME(ucnv_usesFallback) +#define ucnvsel_close U_ICU_ENTRY_POINT_RENAME(ucnvsel_close) +#define ucnvsel_open U_ICU_ENTRY_POINT_RENAME(ucnvsel_open) +#define ucnvsel_openFromSerialized U_ICU_ENTRY_POINT_RENAME(ucnvsel_openFromSerialized) +#define ucnvsel_selectForString U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForString) +#define ucnvsel_selectForUTF8 U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForUTF8) +#define ucnvsel_serialize U_ICU_ENTRY_POINT_RENAME(ucnvsel_serialize) +#define ucol_cloneBinary U_ICU_ENTRY_POINT_RENAME(ucol_cloneBinary) +#define ucol_close U_ICU_ENTRY_POINT_RENAME(ucol_close) +#define ucol_closeElements U_ICU_ENTRY_POINT_RENAME(ucol_closeElements) +#define ucol_countAvailable U_ICU_ENTRY_POINT_RENAME(ucol_countAvailable) +#define ucol_equal U_ICU_ENTRY_POINT_RENAME(ucol_equal) +#define ucol_equals U_ICU_ENTRY_POINT_RENAME(ucol_equals) +#define ucol_getAttribute U_ICU_ENTRY_POINT_RENAME(ucol_getAttribute) +#define ucol_getAvailable U_ICU_ENTRY_POINT_RENAME(ucol_getAvailable) +#define ucol_getBound U_ICU_ENTRY_POINT_RENAME(ucol_getBound) +#define ucol_getContractions U_ICU_ENTRY_POINT_RENAME(ucol_getContractions) +#define ucol_getContractionsAndExpansions U_ICU_ENTRY_POINT_RENAME(ucol_getContractionsAndExpansions) +#define ucol_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucol_getDisplayName) +#define ucol_getEquivalentReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getEquivalentReorderCodes) +#define ucol_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ucol_getFunctionalEquivalent) +#define ucol_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValues) +#define ucol_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValuesForLocale) +#define ucol_getKeywords U_ICU_ENTRY_POINT_RENAME(ucol_getKeywords) +#define ucol_getLocale U_ICU_ENTRY_POINT_RENAME(ucol_getLocale) +#define ucol_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucol_getLocaleByType) +#define ucol_getMaxExpansion U_ICU_ENTRY_POINT_RENAME(ucol_getMaxExpansion) +#define ucol_getMaxVariable U_ICU_ENTRY_POINT_RENAME(ucol_getMaxVariable) +#define ucol_getOffset U_ICU_ENTRY_POINT_RENAME(ucol_getOffset) +#define ucol_getReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodes) +#define ucol_getRules U_ICU_ENTRY_POINT_RENAME(ucol_getRules) +#define ucol_getRulesEx U_ICU_ENTRY_POINT_RENAME(ucol_getRulesEx) +#define ucol_getShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_getShortDefinitionString) +#define ucol_getSortKey U_ICU_ENTRY_POINT_RENAME(ucol_getSortKey) +#define ucol_getStrength U_ICU_ENTRY_POINT_RENAME(ucol_getStrength) +#define ucol_getTailoredSet U_ICU_ENTRY_POINT_RENAME(ucol_getTailoredSet) +#define ucol_getUCAVersion U_ICU_ENTRY_POINT_RENAME(ucol_getUCAVersion) +#define ucol_getUnsafeSet U_ICU_ENTRY_POINT_RENAME(ucol_getUnsafeSet) +#define ucol_getVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_getVariableTop) +#define ucol_getVersion U_ICU_ENTRY_POINT_RENAME(ucol_getVersion) +#define ucol_greater U_ICU_ENTRY_POINT_RENAME(ucol_greater) +#define ucol_greaterOrEqual U_ICU_ENTRY_POINT_RENAME(ucol_greaterOrEqual) +#define ucol_keyHashCode U_ICU_ENTRY_POINT_RENAME(ucol_keyHashCode) +#define ucol_looksLikeCollationBinary U_ICU_ENTRY_POINT_RENAME(ucol_looksLikeCollationBinary) +#define ucol_mergeSortkeys U_ICU_ENTRY_POINT_RENAME(ucol_mergeSortkeys) +#define ucol_next U_ICU_ENTRY_POINT_RENAME(ucol_next) +#define ucol_nextSortKeyPart U_ICU_ENTRY_POINT_RENAME(ucol_nextSortKeyPart) +#define ucol_normalizeShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_normalizeShortDefinitionString) +#define ucol_open U_ICU_ENTRY_POINT_RENAME(ucol_open) +#define ucol_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ucol_openAvailableLocales) +#define ucol_openBinary U_ICU_ENTRY_POINT_RENAME(ucol_openBinary) +#define ucol_openElements U_ICU_ENTRY_POINT_RENAME(ucol_openElements) +#define ucol_openFromShortString U_ICU_ENTRY_POINT_RENAME(ucol_openFromShortString) +#define ucol_openRules U_ICU_ENTRY_POINT_RENAME(ucol_openRules) +#define ucol_prepareShortStringOpen U_ICU_ENTRY_POINT_RENAME(ucol_prepareShortStringOpen) +#define ucol_previous U_ICU_ENTRY_POINT_RENAME(ucol_previous) +#define ucol_primaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_primaryOrder) +#define ucol_reset U_ICU_ENTRY_POINT_RENAME(ucol_reset) +#define ucol_restoreVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_restoreVariableTop) +#define ucol_safeClone U_ICU_ENTRY_POINT_RENAME(ucol_safeClone) +#define ucol_secondaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_secondaryOrder) +#define ucol_setAttribute U_ICU_ENTRY_POINT_RENAME(ucol_setAttribute) +#define ucol_setMaxVariable U_ICU_ENTRY_POINT_RENAME(ucol_setMaxVariable) +#define ucol_setOffset U_ICU_ENTRY_POINT_RENAME(ucol_setOffset) +#define ucol_setReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_setReorderCodes) +#define ucol_setStrength U_ICU_ENTRY_POINT_RENAME(ucol_setStrength) +#define ucol_setText U_ICU_ENTRY_POINT_RENAME(ucol_setText) +#define ucol_setVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_setVariableTop) +#define ucol_strcoll U_ICU_ENTRY_POINT_RENAME(ucol_strcoll) +#define ucol_strcollIter U_ICU_ENTRY_POINT_RENAME(ucol_strcollIter) +#define ucol_strcollUTF8 U_ICU_ENTRY_POINT_RENAME(ucol_strcollUTF8) +#define ucol_swap U_ICU_ENTRY_POINT_RENAME(ucol_swap) +#define ucol_swapInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_swapInverseUCA) +#define ucol_tertiaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_tertiaryOrder) +#define ucpmap_get U_ICU_ENTRY_POINT_RENAME(ucpmap_get) +#define ucpmap_getRange U_ICU_ENTRY_POINT_RENAME(ucpmap_getRange) +#define ucptrie_close U_ICU_ENTRY_POINT_RENAME(ucptrie_close) +#define ucptrie_get U_ICU_ENTRY_POINT_RENAME(ucptrie_get) +#define ucptrie_getRange U_ICU_ENTRY_POINT_RENAME(ucptrie_getRange) +#define ucptrie_getType U_ICU_ENTRY_POINT_RENAME(ucptrie_getType) +#define ucptrie_getValueWidth U_ICU_ENTRY_POINT_RENAME(ucptrie_getValueWidth) +#define ucptrie_internalGetRange U_ICU_ENTRY_POINT_RENAME(ucptrie_internalGetRange) +#define ucptrie_internalSmallIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallIndex) +#define ucptrie_internalSmallU8Index U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallU8Index) +#define ucptrie_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalU8PrevIndex) +#define ucptrie_openFromBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_openFromBinary) +#define ucptrie_swap U_ICU_ENTRY_POINT_RENAME(ucptrie_swap) +#define ucptrie_toBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_toBinary) +#define ucsdet_close U_ICU_ENTRY_POINT_RENAME(ucsdet_close) +#define ucsdet_detect U_ICU_ENTRY_POINT_RENAME(ucsdet_detect) +#define ucsdet_detectAll U_ICU_ENTRY_POINT_RENAME(ucsdet_detectAll) +#define ucsdet_enableInputFilter U_ICU_ENTRY_POINT_RENAME(ucsdet_enableInputFilter) +#define ucsdet_getAllDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getAllDetectableCharsets) +#define ucsdet_getConfidence U_ICU_ENTRY_POINT_RENAME(ucsdet_getConfidence) +#define ucsdet_getDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getDetectableCharsets) +#define ucsdet_getLanguage U_ICU_ENTRY_POINT_RENAME(ucsdet_getLanguage) +#define ucsdet_getName U_ICU_ENTRY_POINT_RENAME(ucsdet_getName) +#define ucsdet_getUChars U_ICU_ENTRY_POINT_RENAME(ucsdet_getUChars) +#define ucsdet_isInputFilterEnabled U_ICU_ENTRY_POINT_RENAME(ucsdet_isInputFilterEnabled) +#define ucsdet_open U_ICU_ENTRY_POINT_RENAME(ucsdet_open) +#define ucsdet_setDeclaredEncoding U_ICU_ENTRY_POINT_RENAME(ucsdet_setDeclaredEncoding) +#define ucsdet_setDetectableCharset U_ICU_ENTRY_POINT_RENAME(ucsdet_setDetectableCharset) +#define ucsdet_setText U_ICU_ENTRY_POINT_RENAME(ucsdet_setText) +#define ucurr_countCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_countCurrencies) +#define ucurr_forLocale U_ICU_ENTRY_POINT_RENAME(ucurr_forLocale) +#define ucurr_forLocaleAndDate U_ICU_ENTRY_POINT_RENAME(ucurr_forLocaleAndDate) +#define ucurr_getDefaultFractionDigits U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigits) +#define ucurr_getDefaultFractionDigitsForUsage U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigitsForUsage) +#define ucurr_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucurr_getKeywordValuesForLocale) +#define ucurr_getName U_ICU_ENTRY_POINT_RENAME(ucurr_getName) +#define ucurr_getNumericCode U_ICU_ENTRY_POINT_RENAME(ucurr_getNumericCode) +#define ucurr_getPluralName U_ICU_ENTRY_POINT_RENAME(ucurr_getPluralName) +#define ucurr_getRoundingIncrement U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrement) +#define ucurr_getRoundingIncrementForUsage U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrementForUsage) +#define ucurr_isAvailable U_ICU_ENTRY_POINT_RENAME(ucurr_isAvailable) +#define ucurr_openISOCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_openISOCurrencies) +#define ucurr_register U_ICU_ENTRY_POINT_RENAME(ucurr_register) +#define ucurr_unregister U_ICU_ENTRY_POINT_RENAME(ucurr_unregister) +#define udat_adoptNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_adoptNumberFormat) +#define udat_adoptNumberFormatForFields U_ICU_ENTRY_POINT_RENAME(udat_adoptNumberFormatForFields) +#define udat_applyPattern U_ICU_ENTRY_POINT_RENAME(udat_applyPattern) +#define udat_applyPatternRelative U_ICU_ENTRY_POINT_RENAME(udat_applyPatternRelative) +#define udat_clone U_ICU_ENTRY_POINT_RENAME(udat_clone) +#define udat_close U_ICU_ENTRY_POINT_RENAME(udat_close) +#define udat_countAvailable U_ICU_ENTRY_POINT_RENAME(udat_countAvailable) +#define udat_countSymbols U_ICU_ENTRY_POINT_RENAME(udat_countSymbols) +#define udat_format U_ICU_ENTRY_POINT_RENAME(udat_format) +#define udat_formatCalendar U_ICU_ENTRY_POINT_RENAME(udat_formatCalendar) +#define udat_formatCalendarForFields U_ICU_ENTRY_POINT_RENAME(udat_formatCalendarForFields) +#define udat_formatForFields U_ICU_ENTRY_POINT_RENAME(udat_formatForFields) +#define udat_get2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_get2DigitYearStart) +#define udat_getAvailable U_ICU_ENTRY_POINT_RENAME(udat_getAvailable) +#define udat_getBooleanAttribute U_ICU_ENTRY_POINT_RENAME(udat_getBooleanAttribute) +#define udat_getCalendar U_ICU_ENTRY_POINT_RENAME(udat_getCalendar) +#define udat_getContext U_ICU_ENTRY_POINT_RENAME(udat_getContext) +#define udat_getLocaleByType U_ICU_ENTRY_POINT_RENAME(udat_getLocaleByType) +#define udat_getNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormat) +#define udat_getNumberFormatForField U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormatForField) +#define udat_getSymbols U_ICU_ENTRY_POINT_RENAME(udat_getSymbols) +#define udat_isLenient U_ICU_ENTRY_POINT_RENAME(udat_isLenient) +#define udat_open U_ICU_ENTRY_POINT_RENAME(udat_open) +#define udat_parse U_ICU_ENTRY_POINT_RENAME(udat_parse) +#define udat_parseCalendar U_ICU_ENTRY_POINT_RENAME(udat_parseCalendar) +#define udat_registerOpener U_ICU_ENTRY_POINT_RENAME(udat_registerOpener) +#define udat_set2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_set2DigitYearStart) +#define udat_setBooleanAttribute U_ICU_ENTRY_POINT_RENAME(udat_setBooleanAttribute) +#define udat_setCalendar U_ICU_ENTRY_POINT_RENAME(udat_setCalendar) +#define udat_setContext U_ICU_ENTRY_POINT_RENAME(udat_setContext) +#define udat_setLenient U_ICU_ENTRY_POINT_RENAME(udat_setLenient) +#define udat_setNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_setNumberFormat) +#define udat_setSymbols U_ICU_ENTRY_POINT_RENAME(udat_setSymbols) +#define udat_toCalendarDateField U_ICU_ENTRY_POINT_RENAME(udat_toCalendarDateField) +#define udat_toPattern U_ICU_ENTRY_POINT_RENAME(udat_toPattern) +#define udat_toPatternRelativeDate U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeDate) +#define udat_toPatternRelativeTime U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeTime) +#define udat_unregisterOpener U_ICU_ENTRY_POINT_RENAME(udat_unregisterOpener) +#define udata_checkCommonData U_ICU_ENTRY_POINT_RENAME(udata_checkCommonData) +#define udata_close U_ICU_ENTRY_POINT_RENAME(udata_close) +#define udata_closeSwapper U_ICU_ENTRY_POINT_RENAME(udata_closeSwapper) +#define udata_getHeaderSize U_ICU_ENTRY_POINT_RENAME(udata_getHeaderSize) +#define udata_getInfo U_ICU_ENTRY_POINT_RENAME(udata_getInfo) +#define udata_getInfoSize U_ICU_ENTRY_POINT_RENAME(udata_getInfoSize) +#define udata_getLength U_ICU_ENTRY_POINT_RENAME(udata_getLength) +#define udata_getMemory U_ICU_ENTRY_POINT_RENAME(udata_getMemory) +#define udata_getRawMemory U_ICU_ENTRY_POINT_RENAME(udata_getRawMemory) +#define udata_open U_ICU_ENTRY_POINT_RENAME(udata_open) +#define udata_openChoice U_ICU_ENTRY_POINT_RENAME(udata_openChoice) +#define udata_openSwapper U_ICU_ENTRY_POINT_RENAME(udata_openSwapper) +#define udata_openSwapperForInputData U_ICU_ENTRY_POINT_RENAME(udata_openSwapperForInputData) +#define udata_printError U_ICU_ENTRY_POINT_RENAME(udata_printError) +#define udata_readInt16 U_ICU_ENTRY_POINT_RENAME(udata_readInt16) +#define udata_readInt32 U_ICU_ENTRY_POINT_RENAME(udata_readInt32) +#define udata_setAppData U_ICU_ENTRY_POINT_RENAME(udata_setAppData) +#define udata_setCommonData U_ICU_ENTRY_POINT_RENAME(udata_setCommonData) +#define udata_setFileAccess U_ICU_ENTRY_POINT_RENAME(udata_setFileAccess) +#define udata_swapDataHeader U_ICU_ENTRY_POINT_RENAME(udata_swapDataHeader) +#define udata_swapInvStringBlock U_ICU_ENTRY_POINT_RENAME(udata_swapInvStringBlock) +#define udatpg_addPattern U_ICU_ENTRY_POINT_RENAME(udatpg_addPattern) +#define udatpg_clone U_ICU_ENTRY_POINT_RENAME(udatpg_clone) +#define udatpg_close U_ICU_ENTRY_POINT_RENAME(udatpg_close) +#define udatpg_getAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemFormat) +#define udatpg_getAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemName) +#define udatpg_getBaseSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getBaseSkeleton) +#define udatpg_getBestPattern U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPattern) +#define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions) +#define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat) +#define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal) +#define udatpg_getDefaultHourCycle U_ICU_ENTRY_POINT_RENAME(udatpg_getDefaultHourCycle) +#define udatpg_getFieldDisplayName U_ICU_ENTRY_POINT_RENAME(udatpg_getFieldDisplayName) +#define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton) +#define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton) +#define udatpg_open U_ICU_ENTRY_POINT_RENAME(udatpg_open) +#define udatpg_openBaseSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openBaseSkeletons) +#define udatpg_openEmpty U_ICU_ENTRY_POINT_RENAME(udatpg_openEmpty) +#define udatpg_openSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openSkeletons) +#define udatpg_replaceFieldTypes U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypes) +#define udatpg_replaceFieldTypesWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypesWithOptions) +#define udatpg_setAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemFormat) +#define udatpg_setAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemName) +#define udatpg_setDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setDateTimeFormat) +#define udatpg_setDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_setDecimal) +#define udict_swap U_ICU_ENTRY_POINT_RENAME(udict_swap) +#define udtitvfmt_close U_ICU_ENTRY_POINT_RENAME(udtitvfmt_close) +#define udtitvfmt_closeResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_closeResult) +#define udtitvfmt_format U_ICU_ENTRY_POINT_RENAME(udtitvfmt_format) +#define udtitvfmt_formatCalendarToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatCalendarToResult) +#define udtitvfmt_formatToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatToResult) +#define udtitvfmt_getContext U_ICU_ENTRY_POINT_RENAME(udtitvfmt_getContext) +#define udtitvfmt_open U_ICU_ENTRY_POINT_RENAME(udtitvfmt_open) +#define udtitvfmt_openResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_openResult) +#define udtitvfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(udtitvfmt_resultAsValue) +#define udtitvfmt_setContext U_ICU_ENTRY_POINT_RENAME(udtitvfmt_setContext) +#define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close) +#define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count) +#define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next) +#define uenum_nextDefault U_ICU_ENTRY_POINT_RENAME(uenum_nextDefault) +#define uenum_openCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openCharStringsEnumeration) +#define uenum_openFromStringEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openFromStringEnumeration) +#define uenum_openUCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openUCharStringsEnumeration) +#define uenum_reset U_ICU_ENTRY_POINT_RENAME(uenum_reset) +#define uenum_unext U_ICU_ENTRY_POINT_RENAME(uenum_unext) +#define uenum_unextDefault U_ICU_ENTRY_POINT_RENAME(uenum_unextDefault) +#define ufieldpositer_close U_ICU_ENTRY_POINT_RENAME(ufieldpositer_close) +#define ufieldpositer_next U_ICU_ENTRY_POINT_RENAME(ufieldpositer_next) +#define ufieldpositer_open U_ICU_ENTRY_POINT_RENAME(ufieldpositer_open) +#define ufile_getch U_ICU_ENTRY_POINT_RENAME(ufile_getch) +#define ufile_getch32 U_ICU_ENTRY_POINT_RENAME(ufile_getch32) +#define ufmt_close U_ICU_ENTRY_POINT_RENAME(ufmt_close) +#define ufmt_getArrayItemByIndex U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayItemByIndex) +#define ufmt_getArrayLength U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayLength) +#define ufmt_getDate U_ICU_ENTRY_POINT_RENAME(ufmt_getDate) +#define ufmt_getDecNumChars U_ICU_ENTRY_POINT_RENAME(ufmt_getDecNumChars) +#define ufmt_getDouble U_ICU_ENTRY_POINT_RENAME(ufmt_getDouble) +#define ufmt_getInt64 U_ICU_ENTRY_POINT_RENAME(ufmt_getInt64) +#define ufmt_getLong U_ICU_ENTRY_POINT_RENAME(ufmt_getLong) +#define ufmt_getObject U_ICU_ENTRY_POINT_RENAME(ufmt_getObject) +#define ufmt_getType U_ICU_ENTRY_POINT_RENAME(ufmt_getType) +#define ufmt_getUChars U_ICU_ENTRY_POINT_RENAME(ufmt_getUChars) +#define ufmt_isNumeric U_ICU_ENTRY_POINT_RENAME(ufmt_isNumeric) +#define ufmt_open U_ICU_ENTRY_POINT_RENAME(ufmt_open) +#define ufmtval_getString U_ICU_ENTRY_POINT_RENAME(ufmtval_getString) +#define ufmtval_nextPosition U_ICU_ENTRY_POINT_RENAME(ufmtval_nextPosition) +#define ugender_getInstance U_ICU_ENTRY_POINT_RENAME(ugender_getInstance) +#define ugender_getListGender U_ICU_ENTRY_POINT_RENAME(ugender_getListGender) +#define uhash_close U_ICU_ENTRY_POINT_RENAME(uhash_close) +#define uhash_compareCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareCaselessUnicodeString) +#define uhash_compareChars U_ICU_ENTRY_POINT_RENAME(uhash_compareChars) +#define uhash_compareIChars U_ICU_ENTRY_POINT_RENAME(uhash_compareIChars) +#define uhash_compareLong U_ICU_ENTRY_POINT_RENAME(uhash_compareLong) +#define uhash_compareScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_compareScriptSet) +#define uhash_compareUChars U_ICU_ENTRY_POINT_RENAME(uhash_compareUChars) +#define uhash_compareUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareUnicodeString) +#define uhash_containsKey U_ICU_ENTRY_POINT_RENAME(uhash_containsKey) +#define uhash_count U_ICU_ENTRY_POINT_RENAME(uhash_count) +#define uhash_deleteHashtable U_ICU_ENTRY_POINT_RENAME(uhash_deleteHashtable) +#define uhash_deleteScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_deleteScriptSet) +#define uhash_equals U_ICU_ENTRY_POINT_RENAME(uhash_equals) +#define uhash_equalsScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_equalsScriptSet) +#define uhash_find U_ICU_ENTRY_POINT_RENAME(uhash_find) +#define uhash_get U_ICU_ENTRY_POINT_RENAME(uhash_get) +#define uhash_geti U_ICU_ENTRY_POINT_RENAME(uhash_geti) +#define uhash_getiAndFound U_ICU_ENTRY_POINT_RENAME(uhash_getiAndFound) +#define uhash_hashCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashCaselessUnicodeString) +#define uhash_hashChars U_ICU_ENTRY_POINT_RENAME(uhash_hashChars) +#define uhash_hashIChars U_ICU_ENTRY_POINT_RENAME(uhash_hashIChars) +#define uhash_hashLong U_ICU_ENTRY_POINT_RENAME(uhash_hashLong) +#define uhash_hashScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_hashScriptSet) +#define uhash_hashUChars U_ICU_ENTRY_POINT_RENAME(uhash_hashUChars) +#define uhash_hashUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashUnicodeString) +#define uhash_icontainsKey U_ICU_ENTRY_POINT_RENAME(uhash_icontainsKey) +#define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget) +#define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti) +#define uhash_igetiAndFound U_ICU_ENTRY_POINT_RENAME(uhash_igetiAndFound) +#define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init) +#define uhash_initSize U_ICU_ENTRY_POINT_RENAME(uhash_initSize) +#define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput) +#define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi) +#define uhash_iputiAllowZero U_ICU_ENTRY_POINT_RENAME(uhash_iputiAllowZero) +#define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove) +#define uhash_iremovei U_ICU_ENTRY_POINT_RENAME(uhash_iremovei) +#define uhash_nextElement U_ICU_ENTRY_POINT_RENAME(uhash_nextElement) +#define uhash_open U_ICU_ENTRY_POINT_RENAME(uhash_open) +#define uhash_openSize U_ICU_ENTRY_POINT_RENAME(uhash_openSize) +#define uhash_put U_ICU_ENTRY_POINT_RENAME(uhash_put) +#define uhash_puti U_ICU_ENTRY_POINT_RENAME(uhash_puti) +#define uhash_putiAllowZero U_ICU_ENTRY_POINT_RENAME(uhash_putiAllowZero) +#define uhash_remove U_ICU_ENTRY_POINT_RENAME(uhash_remove) +#define uhash_removeAll U_ICU_ENTRY_POINT_RENAME(uhash_removeAll) +#define uhash_removeElement U_ICU_ENTRY_POINT_RENAME(uhash_removeElement) +#define uhash_removei U_ICU_ENTRY_POINT_RENAME(uhash_removei) +#define uhash_setKeyComparator U_ICU_ENTRY_POINT_RENAME(uhash_setKeyComparator) +#define uhash_setKeyDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setKeyDeleter) +#define uhash_setKeyHasher U_ICU_ENTRY_POINT_RENAME(uhash_setKeyHasher) +#define uhash_setResizePolicy U_ICU_ENTRY_POINT_RENAME(uhash_setResizePolicy) +#define uhash_setValueComparator U_ICU_ENTRY_POINT_RENAME(uhash_setValueComparator) +#define uhash_setValueDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setValueDeleter) +#define uidna_IDNToASCII U_ICU_ENTRY_POINT_RENAME(uidna_IDNToASCII) +#define uidna_IDNToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_IDNToUnicode) +#define uidna_close U_ICU_ENTRY_POINT_RENAME(uidna_close) +#define uidna_compare U_ICU_ENTRY_POINT_RENAME(uidna_compare) +#define uidna_labelToASCII U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII) +#define uidna_labelToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII_UTF8) +#define uidna_labelToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicode) +#define uidna_labelToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicodeUTF8) +#define uidna_nameToASCII U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII) +#define uidna_nameToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII_UTF8) +#define uidna_nameToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicode) +#define uidna_nameToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicodeUTF8) +#define uidna_openUTS46 U_ICU_ENTRY_POINT_RENAME(uidna_openUTS46) +#define uidna_toASCII U_ICU_ENTRY_POINT_RENAME(uidna_toASCII) +#define uidna_toUnicode U_ICU_ENTRY_POINT_RENAME(uidna_toUnicode) +#define uiter_current32 U_ICU_ENTRY_POINT_RENAME(uiter_current32) +#define uiter_getState U_ICU_ENTRY_POINT_RENAME(uiter_getState) +#define uiter_next32 U_ICU_ENTRY_POINT_RENAME(uiter_next32) +#define uiter_previous32 U_ICU_ENTRY_POINT_RENAME(uiter_previous32) +#define uiter_setCharacterIterator U_ICU_ENTRY_POINT_RENAME(uiter_setCharacterIterator) +#define uiter_setReplaceable U_ICU_ENTRY_POINT_RENAME(uiter_setReplaceable) +#define uiter_setState U_ICU_ENTRY_POINT_RENAME(uiter_setState) +#define uiter_setString U_ICU_ENTRY_POINT_RENAME(uiter_setString) +#define uiter_setUTF16BE U_ICU_ENTRY_POINT_RENAME(uiter_setUTF16BE) +#define uiter_setUTF8 U_ICU_ENTRY_POINT_RENAME(uiter_setUTF8) +#define uldn_close U_ICU_ENTRY_POINT_RENAME(uldn_close) +#define uldn_getContext U_ICU_ENTRY_POINT_RENAME(uldn_getContext) +#define uldn_getDialectHandling U_ICU_ENTRY_POINT_RENAME(uldn_getDialectHandling) +#define uldn_getLocale U_ICU_ENTRY_POINT_RENAME(uldn_getLocale) +#define uldn_keyDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyDisplayName) +#define uldn_keyValueDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyValueDisplayName) +#define uldn_languageDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_languageDisplayName) +#define uldn_localeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_localeDisplayName) +#define uldn_open U_ICU_ENTRY_POINT_RENAME(uldn_open) +#define uldn_openForContext U_ICU_ENTRY_POINT_RENAME(uldn_openForContext) +#define uldn_regionDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_regionDisplayName) +#define uldn_scriptCodeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptCodeDisplayName) +#define uldn_scriptDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptDisplayName) +#define uldn_variantDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_variantDisplayName) +#define ulist_addItemBeginList U_ICU_ENTRY_POINT_RENAME(ulist_addItemBeginList) +#define ulist_addItemEndList U_ICU_ENTRY_POINT_RENAME(ulist_addItemEndList) +#define ulist_close_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_close_keyword_values_iterator) +#define ulist_containsString U_ICU_ENTRY_POINT_RENAME(ulist_containsString) +#define ulist_count_keyword_values U_ICU_ENTRY_POINT_RENAME(ulist_count_keyword_values) +#define ulist_createEmptyList U_ICU_ENTRY_POINT_RENAME(ulist_createEmptyList) +#define ulist_deleteList U_ICU_ENTRY_POINT_RENAME(ulist_deleteList) +#define ulist_getListFromEnum U_ICU_ENTRY_POINT_RENAME(ulist_getListFromEnum) +#define ulist_getListSize U_ICU_ENTRY_POINT_RENAME(ulist_getListSize) +#define ulist_getNext U_ICU_ENTRY_POINT_RENAME(ulist_getNext) +#define ulist_next_keyword_value U_ICU_ENTRY_POINT_RENAME(ulist_next_keyword_value) +#define ulist_removeString U_ICU_ENTRY_POINT_RENAME(ulist_removeString) +#define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList) +#define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator) +#define ulistfmt_close U_ICU_ENTRY_POINT_RENAME(ulistfmt_close) +#define ulistfmt_closeResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_closeResult) +#define ulistfmt_format U_ICU_ENTRY_POINT_RENAME(ulistfmt_format) +#define ulistfmt_formatStringsToResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_formatStringsToResult) +#define ulistfmt_open U_ICU_ENTRY_POINT_RENAME(ulistfmt_open) +#define ulistfmt_openForType U_ICU_ENTRY_POINT_RENAME(ulistfmt_openForType) +#define ulistfmt_openResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_openResult) +#define ulistfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ulistfmt_resultAsValue) +#define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage) +#define uloc_acceptLanguageFromHTTP U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguageFromHTTP) +#define uloc_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(uloc_addLikelySubtags) +#define uloc_canonicalize U_ICU_ENTRY_POINT_RENAME(uloc_canonicalize) +#define uloc_countAvailable U_ICU_ENTRY_POINT_RENAME(uloc_countAvailable) +#define uloc_forLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_forLanguageTag) +#define uloc_getAvailable U_ICU_ENTRY_POINT_RENAME(uloc_getAvailable) +#define uloc_getBaseName U_ICU_ENTRY_POINT_RENAME(uloc_getBaseName) +#define uloc_getCharacterOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getCharacterOrientation) +#define uloc_getCountry U_ICU_ENTRY_POINT_RENAME(uloc_getCountry) +#define uloc_getCurrentCountryID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentCountryID) +#define uloc_getCurrentLanguageID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentLanguageID) +#define uloc_getDefault U_ICU_ENTRY_POINT_RENAME(uloc_getDefault) +#define uloc_getDisplayCountry U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayCountry) +#define uloc_getDisplayKeyword U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeyword) +#define uloc_getDisplayKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeywordValue) +#define uloc_getDisplayLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayLanguage) +#define uloc_getDisplayName U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayName) +#define uloc_getDisplayScript U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScript) +#define uloc_getDisplayVariant U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayVariant) +#define uloc_getISO3Country U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Country) +#define uloc_getISO3Language U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Language) +#define uloc_getISOCountries U_ICU_ENTRY_POINT_RENAME(uloc_getISOCountries) +#define uloc_getISOLanguages U_ICU_ENTRY_POINT_RENAME(uloc_getISOLanguages) +#define uloc_getKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getKeywordValue) +#define uloc_getLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLCID) +#define uloc_getLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getLanguage) +#define uloc_getLineOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getLineOrientation) +#define uloc_getLocaleForLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLocaleForLCID) +#define uloc_getName U_ICU_ENTRY_POINT_RENAME(uloc_getName) +#define uloc_getParent U_ICU_ENTRY_POINT_RENAME(uloc_getParent) +#define uloc_getScript U_ICU_ENTRY_POINT_RENAME(uloc_getScript) +#define uloc_getTableStringWithFallback U_ICU_ENTRY_POINT_RENAME(uloc_getTableStringWithFallback) +#define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant) +#define uloc_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uloc_isRightToLeft) +#define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags) +#define uloc_openAvailableByType U_ICU_ENTRY_POINT_RENAME(uloc_openAvailableByType) +#define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList) +#define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords) +#define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault) +#define uloc_setKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_setKeywordValue) +#define uloc_toLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_toLanguageTag) +#define uloc_toLegacyKey U_ICU_ENTRY_POINT_RENAME(uloc_toLegacyKey) +#define uloc_toLegacyType U_ICU_ENTRY_POINT_RENAME(uloc_toLegacyType) +#define uloc_toUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(uloc_toUnicodeLocaleKey) +#define uloc_toUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(uloc_toUnicodeLocaleType) +#define ulocdata_close U_ICU_ENTRY_POINT_RENAME(ulocdata_close) +#define ulocdata_getCLDRVersion U_ICU_ENTRY_POINT_RENAME(ulocdata_getCLDRVersion) +#define ulocdata_getDelimiter U_ICU_ENTRY_POINT_RENAME(ulocdata_getDelimiter) +#define ulocdata_getExemplarSet U_ICU_ENTRY_POINT_RENAME(ulocdata_getExemplarSet) +#define ulocdata_getLocaleDisplayPattern U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleDisplayPattern) +#define ulocdata_getLocaleSeparator U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleSeparator) +#define ulocdata_getMeasurementSystem U_ICU_ENTRY_POINT_RENAME(ulocdata_getMeasurementSystem) +#define ulocdata_getNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_getNoSubstitute) +#define ulocdata_getPaperSize U_ICU_ENTRY_POINT_RENAME(ulocdata_getPaperSize) +#define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open) +#define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute) +#define ulocimp_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_addLikelySubtags) +#define ulocimp_canonicalize U_ICU_ENTRY_POINT_RENAME(ulocimp_canonicalize) +#define ulocimp_forLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_forLanguageTag) +#define ulocimp_getBaseName U_ICU_ENTRY_POINT_RENAME(ulocimp_getBaseName) +#define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry) +#define ulocimp_getKeywordValue U_ICU_ENTRY_POINT_RENAME(ulocimp_getKeywordValue) +#define ulocimp_getKeywords U_ICU_ENTRY_POINT_RENAME(ulocimp_getKeywords) +#define ulocimp_getKnownCanonicalizedLocaleForTest U_ICU_ENTRY_POINT_RENAME(ulocimp_getKnownCanonicalizedLocaleForTest) +#define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage) +#define ulocimp_getName U_ICU_ENTRY_POINT_RENAME(ulocimp_getName) +#define ulocimp_getRegionForSupplementalData U_ICU_ENTRY_POINT_RENAME(ulocimp_getRegionForSupplementalData) +#define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript) +#define ulocimp_isCanonicalizedLocaleForTest U_ICU_ENTRY_POINT_RENAME(ulocimp_isCanonicalizedLocaleForTest) +#define ulocimp_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_minimizeSubtags) +#define ulocimp_toBcpKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpKey) +#define ulocimp_toBcpType U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpType) +#define ulocimp_toLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_toLanguageTag) +#define ulocimp_toLegacyKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyKey) +#define ulocimp_toLegacyType U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyType) +#define ultag_getTKeyStart U_ICU_ENTRY_POINT_RENAME(ultag_getTKeyStart) +#define ultag_isExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isExtensionSubtags) +#define ultag_isLanguageSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isLanguageSubtag) +#define ultag_isPrivateuseValueSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isPrivateuseValueSubtags) +#define ultag_isRegionSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isRegionSubtag) +#define ultag_isScriptSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isScriptSubtag) +#define ultag_isTransformedExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isTransformedExtensionSubtags) +#define ultag_isUnicodeExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeExtensionSubtags) +#define ultag_isUnicodeLocaleAttribute U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttribute) +#define ultag_isUnicodeLocaleAttributes U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttributes) +#define ultag_isUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleKey) +#define ultag_isUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleType) +#define ultag_isVariantSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isVariantSubtags) +#define umeas_getPrefixBase U_ICU_ENTRY_POINT_RENAME(umeas_getPrefixBase) +#define umeas_getPrefixPower U_ICU_ENTRY_POINT_RENAME(umeas_getPrefixPower) +#define umsg_applyPattern U_ICU_ENTRY_POINT_RENAME(umsg_applyPattern) +#define umsg_autoQuoteApostrophe U_ICU_ENTRY_POINT_RENAME(umsg_autoQuoteApostrophe) +#define umsg_clone U_ICU_ENTRY_POINT_RENAME(umsg_clone) +#define umsg_close U_ICU_ENTRY_POINT_RENAME(umsg_close) +#define umsg_format U_ICU_ENTRY_POINT_RENAME(umsg_format) +#define umsg_getLocale U_ICU_ENTRY_POINT_RENAME(umsg_getLocale) +#define umsg_open U_ICU_ENTRY_POINT_RENAME(umsg_open) +#define umsg_parse U_ICU_ENTRY_POINT_RENAME(umsg_parse) +#define umsg_setLocale U_ICU_ENTRY_POINT_RENAME(umsg_setLocale) +#define umsg_toPattern U_ICU_ENTRY_POINT_RENAME(umsg_toPattern) +#define umsg_vformat U_ICU_ENTRY_POINT_RENAME(umsg_vformat) +#define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse) +#define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock) +#define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock) +#define umutablecptrie_buildImmutable U_ICU_ENTRY_POINT_RENAME(umutablecptrie_buildImmutable) +#define umutablecptrie_clone U_ICU_ENTRY_POINT_RENAME(umutablecptrie_clone) +#define umutablecptrie_close U_ICU_ENTRY_POINT_RENAME(umutablecptrie_close) +#define umutablecptrie_fromUCPMap U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPMap) +#define umutablecptrie_fromUCPTrie U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPTrie) +#define umutablecptrie_get U_ICU_ENTRY_POINT_RENAME(umutablecptrie_get) +#define umutablecptrie_getRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_getRange) +#define umutablecptrie_open U_ICU_ENTRY_POINT_RENAME(umutablecptrie_open) +#define umutablecptrie_set U_ICU_ENTRY_POINT_RENAME(umutablecptrie_set) +#define umutablecptrie_setRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_setRange) +#define uniset_getUnicode32Instance U_ICU_ENTRY_POINT_RENAME(uniset_getUnicode32Instance) +#define unorm2_append U_ICU_ENTRY_POINT_RENAME(unorm2_append) +#define unorm2_close U_ICU_ENTRY_POINT_RENAME(unorm2_close) +#define unorm2_composePair U_ICU_ENTRY_POINT_RENAME(unorm2_composePair) +#define unorm2_getCombiningClass U_ICU_ENTRY_POINT_RENAME(unorm2_getCombiningClass) +#define unorm2_getDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getDecomposition) +#define unorm2_getInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getInstance) +#define unorm2_getNFCInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFCInstance) +#define unorm2_getNFDInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFDInstance) +#define unorm2_getNFKCCasefoldInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKCCasefoldInstance) +#define unorm2_getNFKCInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKCInstance) +#define unorm2_getNFKDInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKDInstance) +#define unorm2_getRawDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getRawDecomposition) +#define unorm2_hasBoundaryAfter U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryAfter) +#define unorm2_hasBoundaryBefore U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryBefore) +#define unorm2_isInert U_ICU_ENTRY_POINT_RENAME(unorm2_isInert) +#define unorm2_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm2_isNormalized) +#define unorm2_normalize U_ICU_ENTRY_POINT_RENAME(unorm2_normalize) +#define unorm2_normalizeSecondAndAppend U_ICU_ENTRY_POINT_RENAME(unorm2_normalizeSecondAndAppend) +#define unorm2_openFiltered U_ICU_ENTRY_POINT_RENAME(unorm2_openFiltered) +#define unorm2_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm2_quickCheck) +#define unorm2_spanQuickCheckYes U_ICU_ENTRY_POINT_RENAME(unorm2_spanQuickCheckYes) +#define unorm2_swap U_ICU_ENTRY_POINT_RENAME(unorm2_swap) +#define unorm_compare U_ICU_ENTRY_POINT_RENAME(unorm_compare) +#define unorm_concatenate U_ICU_ENTRY_POINT_RENAME(unorm_concatenate) +#define unorm_getFCD16 U_ICU_ENTRY_POINT_RENAME(unorm_getFCD16) +#define unorm_getQuickCheck U_ICU_ENTRY_POINT_RENAME(unorm_getQuickCheck) +#define unorm_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm_isNormalized) +#define unorm_isNormalizedWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_isNormalizedWithOptions) +#define unorm_next U_ICU_ENTRY_POINT_RENAME(unorm_next) +#define unorm_normalize U_ICU_ENTRY_POINT_RENAME(unorm_normalize) +#define unorm_previous U_ICU_ENTRY_POINT_RENAME(unorm_previous) +#define unorm_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm_quickCheck) +#define unorm_quickCheckWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_quickCheckWithOptions) +#define unum_applyPattern U_ICU_ENTRY_POINT_RENAME(unum_applyPattern) +#define unum_clone U_ICU_ENTRY_POINT_RENAME(unum_clone) +#define unum_close U_ICU_ENTRY_POINT_RENAME(unum_close) +#define unum_countAvailable U_ICU_ENTRY_POINT_RENAME(unum_countAvailable) +#define unum_format U_ICU_ENTRY_POINT_RENAME(unum_format) +#define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal) +#define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble) +#define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency) +#define unum_formatDoubleForFields U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleForFields) +#define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64) +#define unum_formatUFormattable U_ICU_ENTRY_POINT_RENAME(unum_formatUFormattable) +#define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute) +#define unum_getAvailable U_ICU_ENTRY_POINT_RENAME(unum_getAvailable) +#define unum_getContext U_ICU_ENTRY_POINT_RENAME(unum_getContext) +#define unum_getDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_getDoubleAttribute) +#define unum_getLocaleByType U_ICU_ENTRY_POINT_RENAME(unum_getLocaleByType) +#define unum_getSymbol U_ICU_ENTRY_POINT_RENAME(unum_getSymbol) +#define unum_getTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_getTextAttribute) +#define unum_open U_ICU_ENTRY_POINT_RENAME(unum_open) +#define unum_parse U_ICU_ENTRY_POINT_RENAME(unum_parse) +#define unum_parseDecimal U_ICU_ENTRY_POINT_RENAME(unum_parseDecimal) +#define unum_parseDouble U_ICU_ENTRY_POINT_RENAME(unum_parseDouble) +#define unum_parseDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_parseDoubleCurrency) +#define unum_parseInt64 U_ICU_ENTRY_POINT_RENAME(unum_parseInt64) +#define unum_parseToUFormattable U_ICU_ENTRY_POINT_RENAME(unum_parseToUFormattable) +#define unum_setAttribute U_ICU_ENTRY_POINT_RENAME(unum_setAttribute) +#define unum_setContext U_ICU_ENTRY_POINT_RENAME(unum_setContext) +#define unum_setDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_setDoubleAttribute) +#define unum_setSymbol U_ICU_ENTRY_POINT_RENAME(unum_setSymbol) +#define unum_setTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_setTextAttribute) +#define unum_toPattern U_ICU_ENTRY_POINT_RENAME(unum_toPattern) +#define unumf_close U_ICU_ENTRY_POINT_RENAME(unumf_close) +#define unumf_closeResult U_ICU_ENTRY_POINT_RENAME(unumf_closeResult) +#define unumf_formatDecimal U_ICU_ENTRY_POINT_RENAME(unumf_formatDecimal) +#define unumf_formatDouble U_ICU_ENTRY_POINT_RENAME(unumf_formatDouble) +#define unumf_formatInt U_ICU_ENTRY_POINT_RENAME(unumf_formatInt) +#define unumf_openForSkeletonAndLocale U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocale) +#define unumf_openForSkeletonAndLocaleWithError U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocaleWithError) +#define unumf_openResult U_ICU_ENTRY_POINT_RENAME(unumf_openResult) +#define unumf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumf_resultAsValue) +#define unumf_resultGetAllFieldPositions U_ICU_ENTRY_POINT_RENAME(unumf_resultGetAllFieldPositions) +#define unumf_resultNextFieldPosition U_ICU_ENTRY_POINT_RENAME(unumf_resultNextFieldPosition) +#define unumf_resultToDecimalNumber U_ICU_ENTRY_POINT_RENAME(unumf_resultToDecimalNumber) +#define unumf_resultToString U_ICU_ENTRY_POINT_RENAME(unumf_resultToString) +#define unumrf_close U_ICU_ENTRY_POINT_RENAME(unumrf_close) +#define unumrf_closeResult U_ICU_ENTRY_POINT_RENAME(unumrf_closeResult) +#define unumrf_formatDecimalRange U_ICU_ENTRY_POINT_RENAME(unumrf_formatDecimalRange) +#define unumrf_formatDoubleRange U_ICU_ENTRY_POINT_RENAME(unumrf_formatDoubleRange) +#define unumrf_openForSkeletonWithCollapseAndIdentityFallback U_ICU_ENTRY_POINT_RENAME(unumrf_openForSkeletonWithCollapseAndIdentityFallback) +#define unumrf_openResult U_ICU_ENTRY_POINT_RENAME(unumrf_openResult) +#define unumrf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumrf_resultAsValue) +#define unumrf_resultGetFirstDecimalNumber U_ICU_ENTRY_POINT_RENAME(unumrf_resultGetFirstDecimalNumber) +#define unumrf_resultGetIdentityResult U_ICU_ENTRY_POINT_RENAME(unumrf_resultGetIdentityResult) +#define unumrf_resultGetSecondDecimalNumber U_ICU_ENTRY_POINT_RENAME(unumrf_resultGetSecondDecimalNumber) +#define unumsys_close U_ICU_ENTRY_POINT_RENAME(unumsys_close) +#define unumsys_getDescription U_ICU_ENTRY_POINT_RENAME(unumsys_getDescription) +#define unumsys_getName U_ICU_ENTRY_POINT_RENAME(unumsys_getName) +#define unumsys_getRadix U_ICU_ENTRY_POINT_RENAME(unumsys_getRadix) +#define unumsys_isAlgorithmic U_ICU_ENTRY_POINT_RENAME(unumsys_isAlgorithmic) +#define unumsys_open U_ICU_ENTRY_POINT_RENAME(unumsys_open) +#define unumsys_openAvailableNames U_ICU_ENTRY_POINT_RENAME(unumsys_openAvailableNames) +#define unumsys_openByName U_ICU_ENTRY_POINT_RENAME(unumsys_openByName) +#define uplrules_close U_ICU_ENTRY_POINT_RENAME(uplrules_close) +#define uplrules_getKeywords U_ICU_ENTRY_POINT_RENAME(uplrules_getKeywords) +#define uplrules_open U_ICU_ENTRY_POINT_RENAME(uplrules_open) +#define uplrules_openForType U_ICU_ENTRY_POINT_RENAME(uplrules_openForType) +#define uplrules_select U_ICU_ENTRY_POINT_RENAME(uplrules_select) +#define uplrules_selectForRange U_ICU_ENTRY_POINT_RENAME(uplrules_selectForRange) +#define uplrules_selectFormatted U_ICU_ENTRY_POINT_RENAME(uplrules_selectFormatted) +#define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat) +#define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary) +#define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary) +#define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration) +#define uplug_getContext U_ICU_ENTRY_POINT_RENAME(uplug_getContext) +#define uplug_getCurrentLevel U_ICU_ENTRY_POINT_RENAME(uplug_getCurrentLevel) +#define uplug_getLibrary U_ICU_ENTRY_POINT_RENAME(uplug_getLibrary) +#define uplug_getLibraryName U_ICU_ENTRY_POINT_RENAME(uplug_getLibraryName) +#define uplug_getPlugInternal U_ICU_ENTRY_POINT_RENAME(uplug_getPlugInternal) +#define uplug_getPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLevel) +#define uplug_getPlugLoadStatus U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLoadStatus) +#define uplug_getPlugName U_ICU_ENTRY_POINT_RENAME(uplug_getPlugName) +#define uplug_getPluginFile U_ICU_ENTRY_POINT_RENAME(uplug_getPluginFile) +#define uplug_getSymbolName U_ICU_ENTRY_POINT_RENAME(uplug_getSymbolName) +#define uplug_init U_ICU_ENTRY_POINT_RENAME(uplug_init) +#define uplug_loadPlugFromEntrypoint U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromEntrypoint) +#define uplug_loadPlugFromLibrary U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromLibrary) +#define uplug_nextPlug U_ICU_ENTRY_POINT_RENAME(uplug_nextPlug) +#define uplug_openLibrary U_ICU_ENTRY_POINT_RENAME(uplug_openLibrary) +#define uplug_removePlug U_ICU_ENTRY_POINT_RENAME(uplug_removePlug) +#define uplug_setContext U_ICU_ENTRY_POINT_RENAME(uplug_setContext) +#define uplug_setPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_setPlugLevel) +#define uplug_setPlugName U_ICU_ENTRY_POINT_RENAME(uplug_setPlugName) +#define uplug_setPlugNoUnload U_ICU_ENTRY_POINT_RENAME(uplug_setPlugNoUnload) +#define uprops_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uprops_addPropertyStarts) +#define uprops_getSource U_ICU_ENTRY_POINT_RENAME(uprops_getSource) +#define upropsvec_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(upropsvec_addPropertyStarts) +#define uprv_add32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_add32_overflow) +#define uprv_aestrncpy U_ICU_ENTRY_POINT_RENAME(uprv_aestrncpy) +#define uprv_asciiFromEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_asciiFromEbcdic) +#define uprv_asciitolower U_ICU_ENTRY_POINT_RENAME(uprv_asciitolower) +#define uprv_calloc U_ICU_ENTRY_POINT_RENAME(uprv_calloc) +#define uprv_ceil U_ICU_ENTRY_POINT_RENAME(uprv_ceil) +#define uprv_compareASCIIPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareASCIIPropertyNames) +#define uprv_compareEBCDICPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareEBCDICPropertyNames) +#define uprv_compareInvAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvAscii) +#define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic) +#define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii) +#define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID) +#define uprv_convertToLCIDPlatform U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCIDPlatform) +#define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix) +#define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii) +#define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic) +#define uprv_decContextClearStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextClearStatus) +#define uprv_decContextDefault U_ICU_ENTRY_POINT_RENAME(uprv_decContextDefault) +#define uprv_decContextGetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetRounding) +#define uprv_decContextGetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetStatus) +#define uprv_decContextRestoreStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextRestoreStatus) +#define uprv_decContextSaveStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSaveStatus) +#define uprv_decContextSetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetRounding) +#define uprv_decContextSetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatus) +#define uprv_decContextSetStatusFromString U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromString) +#define uprv_decContextSetStatusFromStringQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromStringQuiet) +#define uprv_decContextSetStatusQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusQuiet) +#define uprv_decContextStatusToString U_ICU_ENTRY_POINT_RENAME(uprv_decContextStatusToString) +#define uprv_decContextTestSavedStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestSavedStatus) +#define uprv_decContextTestStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestStatus) +#define uprv_decContextZeroStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextZeroStatus) +#define uprv_decNumberAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAbs) +#define uprv_decNumberAdd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAdd) +#define uprv_decNumberAnd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAnd) +#define uprv_decNumberClassToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClassToString) +#define uprv_decNumberCompare U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompare) +#define uprv_decNumberCompareSignal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareSignal) +#define uprv_decNumberCompareTotal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotal) +#define uprv_decNumberCompareTotalMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotalMag) +#define uprv_decNumberCopy U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopy) +#define uprv_decNumberCopyAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyAbs) +#define uprv_decNumberCopyNegate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyNegate) +#define uprv_decNumberCopySign U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopySign) +#define uprv_decNumberDivide U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivide) +#define uprv_decNumberDivideInteger U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivideInteger) +#define uprv_decNumberExp U_ICU_ENTRY_POINT_RENAME(uprv_decNumberExp) +#define uprv_decNumberFMA U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFMA) +#define uprv_decNumberFromInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromInt32) +#define uprv_decNumberFromString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromString) +#define uprv_decNumberFromUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromUInt32) +#define uprv_decNumberGetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberGetBCD) +#define uprv_decNumberInvert U_ICU_ENTRY_POINT_RENAME(uprv_decNumberInvert) +#define uprv_decNumberIsNormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsNormal) +#define uprv_decNumberIsSubnormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsSubnormal) +#define uprv_decNumberLn U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLn) +#define uprv_decNumberLog10 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLog10) +#define uprv_decNumberLogB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLogB) +#define uprv_decNumberMax U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMax) +#define uprv_decNumberMaxMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMaxMag) +#define uprv_decNumberMin U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMin) +#define uprv_decNumberMinMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinMag) +#define uprv_decNumberMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinus) +#define uprv_decNumberMultiply U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMultiply) +#define uprv_decNumberNextMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextMinus) +#define uprv_decNumberNextPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextPlus) +#define uprv_decNumberNextToward U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextToward) +#define uprv_decNumberNormalize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNormalize) +#define uprv_decNumberOr U_ICU_ENTRY_POINT_RENAME(uprv_decNumberOr) +#define uprv_decNumberPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPlus) +#define uprv_decNumberPower U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPower) +#define uprv_decNumberQuantize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberQuantize) +#define uprv_decNumberReduce U_ICU_ENTRY_POINT_RENAME(uprv_decNumberReduce) +#define uprv_decNumberRemainder U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainder) +#define uprv_decNumberRemainderNear U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainderNear) +#define uprv_decNumberRescale U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRescale) +#define uprv_decNumberRotate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRotate) +#define uprv_decNumberSameQuantum U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSameQuantum) +#define uprv_decNumberScaleB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberScaleB) +#define uprv_decNumberSetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSetBCD) +#define uprv_decNumberShift U_ICU_ENTRY_POINT_RENAME(uprv_decNumberShift) +#define uprv_decNumberSquareRoot U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSquareRoot) +#define uprv_decNumberSubtract U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSubtract) +#define uprv_decNumberToEngString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToEngString) +#define uprv_decNumberToInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToInt32) +#define uprv_decNumberToIntegralExact U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralExact) +#define uprv_decNumberToIntegralValue U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralValue) +#define uprv_decNumberToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToString) +#define uprv_decNumberToUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToUInt32) +#define uprv_decNumberTrim U_ICU_ENTRY_POINT_RENAME(uprv_decNumberTrim) +#define uprv_decNumberVersion U_ICU_ENTRY_POINT_RENAME(uprv_decNumberVersion) +#define uprv_decNumberXor U_ICU_ENTRY_POINT_RENAME(uprv_decNumberXor) +#define uprv_decNumberZero U_ICU_ENTRY_POINT_RENAME(uprv_decNumberZero) +#define uprv_deleteConditionalCE32 U_ICU_ENTRY_POINT_RENAME(uprv_deleteConditionalCE32) +#define uprv_deleteUObject U_ICU_ENTRY_POINT_RENAME(uprv_deleteUObject) +#define uprv_dl_close U_ICU_ENTRY_POINT_RENAME(uprv_dl_close) +#define uprv_dl_open U_ICU_ENTRY_POINT_RENAME(uprv_dl_open) +#define uprv_dlsym_func U_ICU_ENTRY_POINT_RENAME(uprv_dlsym_func) +#define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy) +#define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii) +#define uprv_ebcdicToAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToAscii) +#define uprv_ebcdicToLowercaseAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToLowercaseAscii) +#define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower) +#define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs) +#define uprv_floor U_ICU_ENTRY_POINT_RENAME(uprv_floor) +#define uprv_fmax U_ICU_ENTRY_POINT_RENAME(uprv_fmax) +#define uprv_fmin U_ICU_ENTRY_POINT_RENAME(uprv_fmin) +#define uprv_fmod U_ICU_ENTRY_POINT_RENAME(uprv_fmod) +#define uprv_free U_ICU_ENTRY_POINT_RENAME(uprv_free) +#define uprv_getCharNameCharacters U_ICU_ENTRY_POINT_RENAME(uprv_getCharNameCharacters) +#define uprv_getDefaultLocaleID U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultLocaleID) +#define uprv_getInfinity U_ICU_ENTRY_POINT_RENAME(uprv_getInfinity) +#define uprv_getMaxCharNameLength U_ICU_ENTRY_POINT_RENAME(uprv_getMaxCharNameLength) +#define uprv_getMaxValues U_ICU_ENTRY_POINT_RENAME(uprv_getMaxValues) +#define uprv_getNaN U_ICU_ENTRY_POINT_RENAME(uprv_getNaN) +#define uprv_getRawUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getRawUTCtime) +#define uprv_getStaticCurrencyName U_ICU_ENTRY_POINT_RENAME(uprv_getStaticCurrencyName) +#define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime) +#define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator) +#define uprv_isASCIILetter U_ICU_ENTRY_POINT_RENAME(uprv_isASCIILetter) +#define uprv_isEbcdicAtSign U_ICU_ENTRY_POINT_RENAME(uprv_isEbcdicAtSign) +#define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite) +#define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString) +#define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString) +#define uprv_isNaN U_ICU_ENTRY_POINT_RENAME(uprv_isNaN) +#define uprv_isNegativeInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isNegativeInfinity) +#define uprv_isPositiveInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isPositiveInfinity) +#define uprv_itou U_ICU_ENTRY_POINT_RENAME(uprv_itou) +#define uprv_log U_ICU_ENTRY_POINT_RENAME(uprv_log) +#define uprv_malloc U_ICU_ENTRY_POINT_RENAME(uprv_malloc) +#define uprv_mapFile U_ICU_ENTRY_POINT_RENAME(uprv_mapFile) +#define uprv_max U_ICU_ENTRY_POINT_RENAME(uprv_max) +#define uprv_maxMantissa U_ICU_ENTRY_POINT_RENAME(uprv_maxMantissa) +#define uprv_maximumPtr U_ICU_ENTRY_POINT_RENAME(uprv_maximumPtr) +#define uprv_min U_ICU_ENTRY_POINT_RENAME(uprv_min) +#define uprv_modf U_ICU_ENTRY_POINT_RENAME(uprv_modf) +#define uprv_mul32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_mul32_overflow) +#define uprv_parseCurrency U_ICU_ENTRY_POINT_RENAME(uprv_parseCurrency) +#define uprv_pathIsAbsolute U_ICU_ENTRY_POINT_RENAME(uprv_pathIsAbsolute) +#define uprv_pow U_ICU_ENTRY_POINT_RENAME(uprv_pow) +#define uprv_pow10 U_ICU_ENTRY_POINT_RENAME(uprv_pow10) +#define uprv_realloc U_ICU_ENTRY_POINT_RENAME(uprv_realloc) +#define uprv_round U_ICU_ENTRY_POINT_RENAME(uprv_round) +#define uprv_sortArray U_ICU_ENTRY_POINT_RENAME(uprv_sortArray) +#define uprv_stableBinarySearch U_ICU_ENTRY_POINT_RENAME(uprv_stableBinarySearch) +#define uprv_strCompare U_ICU_ENTRY_POINT_RENAME(uprv_strCompare) +#define uprv_strdup U_ICU_ENTRY_POINT_RENAME(uprv_strdup) +#define uprv_stricmp U_ICU_ENTRY_POINT_RENAME(uprv_stricmp) +#define uprv_strndup U_ICU_ENTRY_POINT_RENAME(uprv_strndup) +#define uprv_strnicmp U_ICU_ENTRY_POINT_RENAME(uprv_strnicmp) +#define uprv_syntaxError U_ICU_ENTRY_POINT_RENAME(uprv_syntaxError) +#define uprv_timezone U_ICU_ENTRY_POINT_RENAME(uprv_timezone) +#define uprv_toupper U_ICU_ENTRY_POINT_RENAME(uprv_toupper) +#define uprv_trunc U_ICU_ENTRY_POINT_RENAME(uprv_trunc) +#define uprv_tzname U_ICU_ENTRY_POINT_RENAME(uprv_tzname) +#define uprv_tzname_clear_cache U_ICU_ENTRY_POINT_RENAME(uprv_tzname_clear_cache) +#define uprv_tzset U_ICU_ENTRY_POINT_RENAME(uprv_tzset) +#define uprv_uint16Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint16Comparator) +#define uprv_uint32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint32Comparator) +#define uprv_unmapFile U_ICU_ENTRY_POINT_RENAME(uprv_unmapFile) +#define upvec_cloneArray U_ICU_ENTRY_POINT_RENAME(upvec_cloneArray) +#define upvec_close U_ICU_ENTRY_POINT_RENAME(upvec_close) +#define upvec_compact U_ICU_ENTRY_POINT_RENAME(upvec_compact) +#define upvec_compactToUTrie2Handler U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2Handler) +#define upvec_compactToUTrie2WithRowIndexes U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2WithRowIndexes) +#define upvec_getArray U_ICU_ENTRY_POINT_RENAME(upvec_getArray) +#define upvec_getRow U_ICU_ENTRY_POINT_RENAME(upvec_getRow) +#define upvec_getValue U_ICU_ENTRY_POINT_RENAME(upvec_getValue) +#define upvec_open U_ICU_ENTRY_POINT_RENAME(upvec_open) +#define upvec_setValue U_ICU_ENTRY_POINT_RENAME(upvec_setValue) +#define uregex_appendReplacement U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacement) +#define uregex_appendReplacementUText U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacementUText) +#define uregex_appendTail U_ICU_ENTRY_POINT_RENAME(uregex_appendTail) +#define uregex_appendTailUText U_ICU_ENTRY_POINT_RENAME(uregex_appendTailUText) +#define uregex_clone U_ICU_ENTRY_POINT_RENAME(uregex_clone) +#define uregex_close U_ICU_ENTRY_POINT_RENAME(uregex_close) +#define uregex_end U_ICU_ENTRY_POINT_RENAME(uregex_end) +#define uregex_end64 U_ICU_ENTRY_POINT_RENAME(uregex_end64) +#define uregex_find U_ICU_ENTRY_POINT_RENAME(uregex_find) +#define uregex_find64 U_ICU_ENTRY_POINT_RENAME(uregex_find64) +#define uregex_findNext U_ICU_ENTRY_POINT_RENAME(uregex_findNext) +#define uregex_flags U_ICU_ENTRY_POINT_RENAME(uregex_flags) +#define uregex_getFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_getFindProgressCallback) +#define uregex_getMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_getMatchCallback) +#define uregex_getStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_getStackLimit) +#define uregex_getText U_ICU_ENTRY_POINT_RENAME(uregex_getText) +#define uregex_getTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_getTimeLimit) +#define uregex_getUText U_ICU_ENTRY_POINT_RENAME(uregex_getUText) +#define uregex_group U_ICU_ENTRY_POINT_RENAME(uregex_group) +#define uregex_groupCount U_ICU_ENTRY_POINT_RENAME(uregex_groupCount) +#define uregex_groupNumberFromCName U_ICU_ENTRY_POINT_RENAME(uregex_groupNumberFromCName) +#define uregex_groupNumberFromName U_ICU_ENTRY_POINT_RENAME(uregex_groupNumberFromName) +#define uregex_groupUText U_ICU_ENTRY_POINT_RENAME(uregex_groupUText) +#define uregex_hasAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasAnchoringBounds) +#define uregex_hasTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasTransparentBounds) +#define uregex_hitEnd U_ICU_ENTRY_POINT_RENAME(uregex_hitEnd) +#define uregex_lookingAt U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt) +#define uregex_lookingAt64 U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt64) +#define uregex_matches U_ICU_ENTRY_POINT_RENAME(uregex_matches) +#define uregex_matches64 U_ICU_ENTRY_POINT_RENAME(uregex_matches64) +#define uregex_open U_ICU_ENTRY_POINT_RENAME(uregex_open) +#define uregex_openC U_ICU_ENTRY_POINT_RENAME(uregex_openC) +#define uregex_openUText U_ICU_ENTRY_POINT_RENAME(uregex_openUText) +#define uregex_pattern U_ICU_ENTRY_POINT_RENAME(uregex_pattern) +#define uregex_patternUText U_ICU_ENTRY_POINT_RENAME(uregex_patternUText) +#define uregex_refreshUText U_ICU_ENTRY_POINT_RENAME(uregex_refreshUText) +#define uregex_regionEnd U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd) +#define uregex_regionEnd64 U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd64) +#define uregex_regionStart U_ICU_ENTRY_POINT_RENAME(uregex_regionStart) +#define uregex_regionStart64 U_ICU_ENTRY_POINT_RENAME(uregex_regionStart64) +#define uregex_replaceAll U_ICU_ENTRY_POINT_RENAME(uregex_replaceAll) +#define uregex_replaceAllUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceAllUText) +#define uregex_replaceFirst U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirst) +#define uregex_replaceFirstUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirstUText) +#define uregex_requireEnd U_ICU_ENTRY_POINT_RENAME(uregex_requireEnd) +#define uregex_reset U_ICU_ENTRY_POINT_RENAME(uregex_reset) +#define uregex_reset64 U_ICU_ENTRY_POINT_RENAME(uregex_reset64) +#define uregex_setFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_setFindProgressCallback) +#define uregex_setMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_setMatchCallback) +#define uregex_setRegion U_ICU_ENTRY_POINT_RENAME(uregex_setRegion) +#define uregex_setRegion64 U_ICU_ENTRY_POINT_RENAME(uregex_setRegion64) +#define uregex_setRegionAndStart U_ICU_ENTRY_POINT_RENAME(uregex_setRegionAndStart) +#define uregex_setStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_setStackLimit) +#define uregex_setText U_ICU_ENTRY_POINT_RENAME(uregex_setText) +#define uregex_setTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_setTimeLimit) +#define uregex_setUText U_ICU_ENTRY_POINT_RENAME(uregex_setUText) +#define uregex_split U_ICU_ENTRY_POINT_RENAME(uregex_split) +#define uregex_splitUText U_ICU_ENTRY_POINT_RENAME(uregex_splitUText) +#define uregex_start U_ICU_ENTRY_POINT_RENAME(uregex_start) +#define uregex_start64 U_ICU_ENTRY_POINT_RENAME(uregex_start64) +#define uregex_ucstr_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_ucstr_unescape_charAt) +#define uregex_useAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_useAnchoringBounds) +#define uregex_useTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_useTransparentBounds) +#define uregex_utext_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_utext_unescape_charAt) +#define uregion_areEqual U_ICU_ENTRY_POINT_RENAME(uregion_areEqual) +#define uregion_contains U_ICU_ENTRY_POINT_RENAME(uregion_contains) +#define uregion_getAvailable U_ICU_ENTRY_POINT_RENAME(uregion_getAvailable) +#define uregion_getContainedRegions U_ICU_ENTRY_POINT_RENAME(uregion_getContainedRegions) +#define uregion_getContainedRegionsOfType U_ICU_ENTRY_POINT_RENAME(uregion_getContainedRegionsOfType) +#define uregion_getContainingRegion U_ICU_ENTRY_POINT_RENAME(uregion_getContainingRegion) +#define uregion_getContainingRegionOfType U_ICU_ENTRY_POINT_RENAME(uregion_getContainingRegionOfType) +#define uregion_getNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getNumericCode) +#define uregion_getPreferredValues U_ICU_ENTRY_POINT_RENAME(uregion_getPreferredValues) +#define uregion_getRegionCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionCode) +#define uregion_getRegionFromCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromCode) +#define uregion_getRegionFromNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromNumericCode) +#define uregion_getType U_ICU_ENTRY_POINT_RENAME(uregion_getType) +#define ureldatefmt_close U_ICU_ENTRY_POINT_RENAME(ureldatefmt_close) +#define ureldatefmt_closeResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_closeResult) +#define ureldatefmt_combineDateAndTime U_ICU_ENTRY_POINT_RENAME(ureldatefmt_combineDateAndTime) +#define ureldatefmt_format U_ICU_ENTRY_POINT_RENAME(ureldatefmt_format) +#define ureldatefmt_formatNumeric U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumeric) +#define ureldatefmt_formatNumericToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumericToResult) +#define ureldatefmt_formatToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatToResult) +#define ureldatefmt_open U_ICU_ENTRY_POINT_RENAME(ureldatefmt_open) +#define ureldatefmt_openResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_openResult) +#define ureldatefmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ureldatefmt_resultAsValue) +#define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close) +#define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb) +#define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems) +#define ures_findResource U_ICU_ENTRY_POINT_RENAME(ures_findResource) +#define ures_findSubResource U_ICU_ENTRY_POINT_RENAME(ures_findSubResource) +#define ures_getAllItemsWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getAllItemsWithFallback) +#define ures_getBinary U_ICU_ENTRY_POINT_RENAME(ures_getBinary) +#define ures_getByIndex U_ICU_ENTRY_POINT_RENAME(ures_getByIndex) +#define ures_getByKey U_ICU_ENTRY_POINT_RENAME(ures_getByKey) +#define ures_getByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getByKeyWithFallback) +#define ures_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ures_getFunctionalEquivalent) +#define ures_getInt U_ICU_ENTRY_POINT_RENAME(ures_getInt) +#define ures_getIntVector U_ICU_ENTRY_POINT_RENAME(ures_getIntVector) +#define ures_getKey U_ICU_ENTRY_POINT_RENAME(ures_getKey) +#define ures_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ures_getKeywordValues) +#define ures_getLocale U_ICU_ENTRY_POINT_RENAME(ures_getLocale) +#define ures_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ures_getLocaleByType) +#define ures_getLocaleInternal U_ICU_ENTRY_POINT_RENAME(ures_getLocaleInternal) +#define ures_getName U_ICU_ENTRY_POINT_RENAME(ures_getName) +#define ures_getNextResource U_ICU_ENTRY_POINT_RENAME(ures_getNextResource) +#define ures_getNextString U_ICU_ENTRY_POINT_RENAME(ures_getNextString) +#define ures_getSize U_ICU_ENTRY_POINT_RENAME(ures_getSize) +#define ures_getString U_ICU_ENTRY_POINT_RENAME(ures_getString) +#define ures_getStringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getStringByIndex) +#define ures_getStringByKey U_ICU_ENTRY_POINT_RENAME(ures_getStringByKey) +#define ures_getStringByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getStringByKeyWithFallback) +#define ures_getType U_ICU_ENTRY_POINT_RENAME(ures_getType) +#define ures_getUInt U_ICU_ENTRY_POINT_RENAME(ures_getUInt) +#define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String) +#define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex) +#define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey) +#define ures_getValueWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getValueWithFallback) +#define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion) +#define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey) +#define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber) +#define ures_getVersionNumberInternal U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumberInternal) +#define ures_hasNext U_ICU_ENTRY_POINT_RENAME(ures_hasNext) +#define ures_initStackObject U_ICU_ENTRY_POINT_RENAME(ures_initStackObject) +#define ures_open U_ICU_ENTRY_POINT_RENAME(ures_open) +#define ures_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ures_openAvailableLocales) +#define ures_openDirect U_ICU_ENTRY_POINT_RENAME(ures_openDirect) +#define ures_openDirectFillIn U_ICU_ENTRY_POINT_RENAME(ures_openDirectFillIn) +#define ures_openFillIn U_ICU_ENTRY_POINT_RENAME(ures_openFillIn) +#define ures_openNoDefault U_ICU_ENTRY_POINT_RENAME(ures_openNoDefault) +#define ures_openU U_ICU_ENTRY_POINT_RENAME(ures_openU) +#define ures_resetIterator U_ICU_ENTRY_POINT_RENAME(ures_resetIterator) +#define ures_swap U_ICU_ENTRY_POINT_RENAME(ures_swap) +#define uscript_breaksBetweenLetters U_ICU_ENTRY_POINT_RENAME(uscript_breaksBetweenLetters) +#define uscript_closeRun U_ICU_ENTRY_POINT_RENAME(uscript_closeRun) +#define uscript_getCode U_ICU_ENTRY_POINT_RENAME(uscript_getCode) +#define uscript_getName U_ICU_ENTRY_POINT_RENAME(uscript_getName) +#define uscript_getSampleString U_ICU_ENTRY_POINT_RENAME(uscript_getSampleString) +#define uscript_getSampleUnicodeString U_ICU_ENTRY_POINT_RENAME(uscript_getSampleUnicodeString) +#define uscript_getScript U_ICU_ENTRY_POINT_RENAME(uscript_getScript) +#define uscript_getScriptExtensions U_ICU_ENTRY_POINT_RENAME(uscript_getScriptExtensions) +#define uscript_getShortName U_ICU_ENTRY_POINT_RENAME(uscript_getShortName) +#define uscript_getUsage U_ICU_ENTRY_POINT_RENAME(uscript_getUsage) +#define uscript_hasScript U_ICU_ENTRY_POINT_RENAME(uscript_hasScript) +#define uscript_isCased U_ICU_ENTRY_POINT_RENAME(uscript_isCased) +#define uscript_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uscript_isRightToLeft) +#define uscript_nextRun U_ICU_ENTRY_POINT_RENAME(uscript_nextRun) +#define uscript_openRun U_ICU_ENTRY_POINT_RENAME(uscript_openRun) +#define uscript_resetRun U_ICU_ENTRY_POINT_RENAME(uscript_resetRun) +#define uscript_setRunText U_ICU_ENTRY_POINT_RENAME(uscript_setRunText) +#define usearch_close U_ICU_ENTRY_POINT_RENAME(usearch_close) +#define usearch_first U_ICU_ENTRY_POINT_RENAME(usearch_first) +#define usearch_following U_ICU_ENTRY_POINT_RENAME(usearch_following) +#define usearch_getAttribute U_ICU_ENTRY_POINT_RENAME(usearch_getAttribute) +#define usearch_getBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_getBreakIterator) +#define usearch_getCollator U_ICU_ENTRY_POINT_RENAME(usearch_getCollator) +#define usearch_getMatchedLength U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedLength) +#define usearch_getMatchedStart U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedStart) +#define usearch_getMatchedText U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedText) +#define usearch_getOffset U_ICU_ENTRY_POINT_RENAME(usearch_getOffset) +#define usearch_getPattern U_ICU_ENTRY_POINT_RENAME(usearch_getPattern) +#define usearch_getText U_ICU_ENTRY_POINT_RENAME(usearch_getText) +#define usearch_handleNextCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handleNextCanonical) +#define usearch_handleNextExact U_ICU_ENTRY_POINT_RENAME(usearch_handleNextExact) +#define usearch_handlePreviousCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousCanonical) +#define usearch_handlePreviousExact U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousExact) +#define usearch_last U_ICU_ENTRY_POINT_RENAME(usearch_last) +#define usearch_next U_ICU_ENTRY_POINT_RENAME(usearch_next) +#define usearch_open U_ICU_ENTRY_POINT_RENAME(usearch_open) +#define usearch_openFromCollator U_ICU_ENTRY_POINT_RENAME(usearch_openFromCollator) +#define usearch_preceding U_ICU_ENTRY_POINT_RENAME(usearch_preceding) +#define usearch_previous U_ICU_ENTRY_POINT_RENAME(usearch_previous) +#define usearch_reset U_ICU_ENTRY_POINT_RENAME(usearch_reset) +#define usearch_search U_ICU_ENTRY_POINT_RENAME(usearch_search) +#define usearch_searchBackwards U_ICU_ENTRY_POINT_RENAME(usearch_searchBackwards) +#define usearch_setAttribute U_ICU_ENTRY_POINT_RENAME(usearch_setAttribute) +#define usearch_setBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_setBreakIterator) +#define usearch_setCollator U_ICU_ENTRY_POINT_RENAME(usearch_setCollator) +#define usearch_setOffset U_ICU_ENTRY_POINT_RENAME(usearch_setOffset) +#define usearch_setPattern U_ICU_ENTRY_POINT_RENAME(usearch_setPattern) +#define usearch_setText U_ICU_ENTRY_POINT_RENAME(usearch_setText) +#define uset_add U_ICU_ENTRY_POINT_RENAME(uset_add) +#define uset_addAll U_ICU_ENTRY_POINT_RENAME(uset_addAll) +#define uset_addAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_addAllCodePoints) +#define uset_addRange U_ICU_ENTRY_POINT_RENAME(uset_addRange) +#define uset_addString U_ICU_ENTRY_POINT_RENAME(uset_addString) +#define uset_applyIntPropertyValue U_ICU_ENTRY_POINT_RENAME(uset_applyIntPropertyValue) +#define uset_applyPattern U_ICU_ENTRY_POINT_RENAME(uset_applyPattern) +#define uset_applyPropertyAlias U_ICU_ENTRY_POINT_RENAME(uset_applyPropertyAlias) +#define uset_charAt U_ICU_ENTRY_POINT_RENAME(uset_charAt) +#define uset_clear U_ICU_ENTRY_POINT_RENAME(uset_clear) +#define uset_clone U_ICU_ENTRY_POINT_RENAME(uset_clone) +#define uset_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(uset_cloneAsThawed) +#define uset_close U_ICU_ENTRY_POINT_RENAME(uset_close) +#define uset_closeOver U_ICU_ENTRY_POINT_RENAME(uset_closeOver) +#define uset_compact U_ICU_ENTRY_POINT_RENAME(uset_compact) +#define uset_complement U_ICU_ENTRY_POINT_RENAME(uset_complement) +#define uset_complementAll U_ICU_ENTRY_POINT_RENAME(uset_complementAll) +#define uset_complementAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_complementAllCodePoints) +#define uset_complementRange U_ICU_ENTRY_POINT_RENAME(uset_complementRange) +#define uset_complementString U_ICU_ENTRY_POINT_RENAME(uset_complementString) +#define uset_contains U_ICU_ENTRY_POINT_RENAME(uset_contains) +#define uset_containsAll U_ICU_ENTRY_POINT_RENAME(uset_containsAll) +#define uset_containsAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_containsAllCodePoints) +#define uset_containsNone U_ICU_ENTRY_POINT_RENAME(uset_containsNone) +#define uset_containsRange U_ICU_ENTRY_POINT_RENAME(uset_containsRange) +#define uset_containsSome U_ICU_ENTRY_POINT_RENAME(uset_containsSome) +#define uset_containsString U_ICU_ENTRY_POINT_RENAME(uset_containsString) +#define uset_equals U_ICU_ENTRY_POINT_RENAME(uset_equals) +#define uset_freeze U_ICU_ENTRY_POINT_RENAME(uset_freeze) +#define uset_getItem U_ICU_ENTRY_POINT_RENAME(uset_getItem) +#define uset_getItemCount U_ICU_ENTRY_POINT_RENAME(uset_getItemCount) +#define uset_getSerializedRange U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRange) +#define uset_getSerializedRangeCount U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRangeCount) +#define uset_getSerializedSet U_ICU_ENTRY_POINT_RENAME(uset_getSerializedSet) +#define uset_indexOf U_ICU_ENTRY_POINT_RENAME(uset_indexOf) +#define uset_isEmpty U_ICU_ENTRY_POINT_RENAME(uset_isEmpty) +#define uset_isFrozen U_ICU_ENTRY_POINT_RENAME(uset_isFrozen) +#define uset_open U_ICU_ENTRY_POINT_RENAME(uset_open) +#define uset_openEmpty U_ICU_ENTRY_POINT_RENAME(uset_openEmpty) +#define uset_openPattern U_ICU_ENTRY_POINT_RENAME(uset_openPattern) +#define uset_openPatternOptions U_ICU_ENTRY_POINT_RENAME(uset_openPatternOptions) +#define uset_remove U_ICU_ENTRY_POINT_RENAME(uset_remove) +#define uset_removeAll U_ICU_ENTRY_POINT_RENAME(uset_removeAll) +#define uset_removeAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_removeAllCodePoints) +#define uset_removeAllStrings U_ICU_ENTRY_POINT_RENAME(uset_removeAllStrings) +#define uset_removeRange U_ICU_ENTRY_POINT_RENAME(uset_removeRange) +#define uset_removeString U_ICU_ENTRY_POINT_RENAME(uset_removeString) +#define uset_resemblesPattern U_ICU_ENTRY_POINT_RENAME(uset_resemblesPattern) +#define uset_retain U_ICU_ENTRY_POINT_RENAME(uset_retain) +#define uset_retainAll U_ICU_ENTRY_POINT_RENAME(uset_retainAll) +#define uset_retainAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_retainAllCodePoints) +#define uset_retainString U_ICU_ENTRY_POINT_RENAME(uset_retainString) +#define uset_serialize U_ICU_ENTRY_POINT_RENAME(uset_serialize) +#define uset_serializedContains U_ICU_ENTRY_POINT_RENAME(uset_serializedContains) +#define uset_set U_ICU_ENTRY_POINT_RENAME(uset_set) +#define uset_setSerializedToOne U_ICU_ENTRY_POINT_RENAME(uset_setSerializedToOne) +#define uset_size U_ICU_ENTRY_POINT_RENAME(uset_size) +#define uset_span U_ICU_ENTRY_POINT_RENAME(uset_span) +#define uset_spanBack U_ICU_ENTRY_POINT_RENAME(uset_spanBack) +#define uset_spanBackUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanBackUTF8) +#define uset_spanUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanUTF8) +#define uset_toPattern U_ICU_ENTRY_POINT_RENAME(uset_toPattern) +#define uspoof_areConfusable U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusable) +#define uspoof_areConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUTF8) +#define uspoof_areConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUnicodeString) +#define uspoof_check U_ICU_ENTRY_POINT_RENAME(uspoof_check) +#define uspoof_check2 U_ICU_ENTRY_POINT_RENAME(uspoof_check2) +#define uspoof_check2UTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_check2UTF8) +#define uspoof_check2UnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_check2UnicodeString) +#define uspoof_checkUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_checkUTF8) +#define uspoof_checkUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_checkUnicodeString) +#define uspoof_clone U_ICU_ENTRY_POINT_RENAME(uspoof_clone) +#define uspoof_close U_ICU_ENTRY_POINT_RENAME(uspoof_close) +#define uspoof_closeCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_closeCheckResult) +#define uspoof_getAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedChars) +#define uspoof_getAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedLocales) +#define uspoof_getAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedUnicodeSet) +#define uspoof_getCheckResultChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultChecks) +#define uspoof_getCheckResultNumerics U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultNumerics) +#define uspoof_getCheckResultRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultRestrictionLevel) +#define uspoof_getChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getChecks) +#define uspoof_getInclusionSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionSet) +#define uspoof_getInclusionUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionUnicodeSet) +#define uspoof_getRecommendedSet U_ICU_ENTRY_POINT_RENAME(uspoof_getRecommendedSet) +#define uspoof_getRecommendedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getRecommendedUnicodeSet) +#define uspoof_getRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_getRestrictionLevel) +#define uspoof_getSkeleton U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeleton) +#define uspoof_getSkeletonUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUTF8) +#define uspoof_getSkeletonUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUnicodeString) +#define uspoof_internalInitStatics U_ICU_ENTRY_POINT_RENAME(uspoof_internalInitStatics) +#define uspoof_open U_ICU_ENTRY_POINT_RENAME(uspoof_open) +#define uspoof_openCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_openCheckResult) +#define uspoof_openFromSerialized U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSerialized) +#define uspoof_openFromSource U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSource) +#define uspoof_serialize U_ICU_ENTRY_POINT_RENAME(uspoof_serialize) +#define uspoof_setAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedChars) +#define uspoof_setAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedLocales) +#define uspoof_setAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedUnicodeSet) +#define uspoof_setChecks U_ICU_ENTRY_POINT_RENAME(uspoof_setChecks) +#define uspoof_setRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_setRestrictionLevel) +#define uspoof_swap U_ICU_ENTRY_POINT_RENAME(uspoof_swap) +#define usprep_close U_ICU_ENTRY_POINT_RENAME(usprep_close) +#define usprep_open U_ICU_ENTRY_POINT_RENAME(usprep_open) +#define usprep_openByType U_ICU_ENTRY_POINT_RENAME(usprep_openByType) +#define usprep_prepare U_ICU_ENTRY_POINT_RENAME(usprep_prepare) +#define usprep_swap U_ICU_ENTRY_POINT_RENAME(usprep_swap) +#define ustr_hashCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashCharsN) +#define ustr_hashICharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashICharsN) +#define ustr_hashUCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashUCharsN) +#define ustrcase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_getCaseLocale) +#define ustrcase_getTitleBreakIterator U_ICU_ENTRY_POINT_RENAME(ustrcase_getTitleBreakIterator) +#define ustrcase_internalFold U_ICU_ENTRY_POINT_RENAME(ustrcase_internalFold) +#define ustrcase_internalToLower U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToLower) +#define ustrcase_internalToTitle U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToTitle) +#define ustrcase_internalToUpper U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToUpper) +#define ustrcase_map U_ICU_ENTRY_POINT_RENAME(ustrcase_map) +#define ustrcase_mapWithOverlap U_ICU_ENTRY_POINT_RENAME(ustrcase_mapWithOverlap) +#define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At) +#define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone) +#define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close) +#define utext_copy U_ICU_ENTRY_POINT_RENAME(utext_copy) +#define utext_current32 U_ICU_ENTRY_POINT_RENAME(utext_current32) +#define utext_equals U_ICU_ENTRY_POINT_RENAME(utext_equals) +#define utext_extract U_ICU_ENTRY_POINT_RENAME(utext_extract) +#define utext_freeze U_ICU_ENTRY_POINT_RENAME(utext_freeze) +#define utext_getNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getNativeIndex) +#define utext_getPreviousNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getPreviousNativeIndex) +#define utext_hasMetaData U_ICU_ENTRY_POINT_RENAME(utext_hasMetaData) +#define utext_isLengthExpensive U_ICU_ENTRY_POINT_RENAME(utext_isLengthExpensive) +#define utext_isWritable U_ICU_ENTRY_POINT_RENAME(utext_isWritable) +#define utext_moveIndex32 U_ICU_ENTRY_POINT_RENAME(utext_moveIndex32) +#define utext_nativeLength U_ICU_ENTRY_POINT_RENAME(utext_nativeLength) +#define utext_next32 U_ICU_ENTRY_POINT_RENAME(utext_next32) +#define utext_next32From U_ICU_ENTRY_POINT_RENAME(utext_next32From) +#define utext_openCharacterIterator U_ICU_ENTRY_POINT_RENAME(utext_openCharacterIterator) +#define utext_openConstUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openConstUnicodeString) +#define utext_openReplaceable U_ICU_ENTRY_POINT_RENAME(utext_openReplaceable) +#define utext_openUChars U_ICU_ENTRY_POINT_RENAME(utext_openUChars) +#define utext_openUTF8 U_ICU_ENTRY_POINT_RENAME(utext_openUTF8) +#define utext_openUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openUnicodeString) +#define utext_previous32 U_ICU_ENTRY_POINT_RENAME(utext_previous32) +#define utext_previous32From U_ICU_ENTRY_POINT_RENAME(utext_previous32From) +#define utext_replace U_ICU_ENTRY_POINT_RENAME(utext_replace) +#define utext_setNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_setNativeIndex) +#define utext_setup U_ICU_ENTRY_POINT_RENAME(utext_setup) +#define utf8_appendCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_appendCharSafeBody) +#define utf8_back1SafeBody U_ICU_ENTRY_POINT_RENAME(utf8_back1SafeBody) +#define utf8_countTrailBytes U_ICU_ENTRY_POINT_RENAME(utf8_countTrailBytes) +#define utf8_nextCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_nextCharSafeBody) +#define utf8_prevCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_prevCharSafeBody) +#define utmscale_fromInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_fromInt64) +#define utmscale_getTimeScaleValue U_ICU_ENTRY_POINT_RENAME(utmscale_getTimeScaleValue) +#define utmscale_toInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_toInt64) +#define utrace_cleanup U_ICU_ENTRY_POINT_RENAME(utrace_cleanup) +#define utrace_data U_ICU_ENTRY_POINT_RENAME(utrace_data) +#define utrace_entry U_ICU_ENTRY_POINT_RENAME(utrace_entry) +#define utrace_exit U_ICU_ENTRY_POINT_RENAME(utrace_exit) +#define utrace_format U_ICU_ENTRY_POINT_RENAME(utrace_format) +#define utrace_functionName U_ICU_ENTRY_POINT_RENAME(utrace_functionName) +#define utrace_getFunctions U_ICU_ENTRY_POINT_RENAME(utrace_getFunctions) +#define utrace_getLevel U_ICU_ENTRY_POINT_RENAME(utrace_getLevel) +#define utrace_setFunctions U_ICU_ENTRY_POINT_RENAME(utrace_setFunctions) +#define utrace_setLevel U_ICU_ENTRY_POINT_RENAME(utrace_setLevel) +#define utrace_vformat U_ICU_ENTRY_POINT_RENAME(utrace_vformat) +#define utrans_clone U_ICU_ENTRY_POINT_RENAME(utrans_clone) +#define utrans_close U_ICU_ENTRY_POINT_RENAME(utrans_close) +#define utrans_countAvailableIDs U_ICU_ENTRY_POINT_RENAME(utrans_countAvailableIDs) +#define utrans_getAvailableID U_ICU_ENTRY_POINT_RENAME(utrans_getAvailableID) +#define utrans_getID U_ICU_ENTRY_POINT_RENAME(utrans_getID) +#define utrans_getSourceSet U_ICU_ENTRY_POINT_RENAME(utrans_getSourceSet) +#define utrans_getUnicodeID U_ICU_ENTRY_POINT_RENAME(utrans_getUnicodeID) +#define utrans_open U_ICU_ENTRY_POINT_RENAME(utrans_open) +#define utrans_openIDs U_ICU_ENTRY_POINT_RENAME(utrans_openIDs) +#define utrans_openInverse U_ICU_ENTRY_POINT_RENAME(utrans_openInverse) +#define utrans_openU U_ICU_ENTRY_POINT_RENAME(utrans_openU) +#define utrans_register U_ICU_ENTRY_POINT_RENAME(utrans_register) +#define utrans_rep_caseContextIterator U_ICU_ENTRY_POINT_RENAME(utrans_rep_caseContextIterator) +#define utrans_setFilter U_ICU_ENTRY_POINT_RENAME(utrans_setFilter) +#define utrans_stripRules U_ICU_ENTRY_POINT_RENAME(utrans_stripRules) +#define utrans_toRules U_ICU_ENTRY_POINT_RENAME(utrans_toRules) +#define utrans_trans U_ICU_ENTRY_POINT_RENAME(utrans_trans) +#define utrans_transIncremental U_ICU_ENTRY_POINT_RENAME(utrans_transIncremental) +#define utrans_transIncrementalUChars U_ICU_ENTRY_POINT_RENAME(utrans_transIncrementalUChars) +#define utrans_transUChars U_ICU_ENTRY_POINT_RENAME(utrans_transUChars) +#define utrans_transliterator_cleanup U_ICU_ENTRY_POINT_RENAME(utrans_transliterator_cleanup) +#define utrans_unregister U_ICU_ENTRY_POINT_RENAME(utrans_unregister) +#define utrans_unregisterID U_ICU_ENTRY_POINT_RENAME(utrans_unregisterID) +#define utrie2_clone U_ICU_ENTRY_POINT_RENAME(utrie2_clone) +#define utrie2_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(utrie2_cloneAsThawed) +#define utrie2_close U_ICU_ENTRY_POINT_RENAME(utrie2_close) +#define utrie2_enum U_ICU_ENTRY_POINT_RENAME(utrie2_enum) +#define utrie2_enumForLeadSurrogate U_ICU_ENTRY_POINT_RENAME(utrie2_enumForLeadSurrogate) +#define utrie2_freeze U_ICU_ENTRY_POINT_RENAME(utrie2_freeze) +#define utrie2_fromUTrie U_ICU_ENTRY_POINT_RENAME(utrie2_fromUTrie) +#define utrie2_get32 U_ICU_ENTRY_POINT_RENAME(utrie2_get32) +#define utrie2_get32FromLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_get32FromLeadSurrogateCodeUnit) +#define utrie2_internalU8NextIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8NextIndex) +#define utrie2_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8PrevIndex) +#define utrie2_isFrozen U_ICU_ENTRY_POINT_RENAME(utrie2_isFrozen) +#define utrie2_open U_ICU_ENTRY_POINT_RENAME(utrie2_open) +#define utrie2_openDummy U_ICU_ENTRY_POINT_RENAME(utrie2_openDummy) +#define utrie2_openFromSerialized U_ICU_ENTRY_POINT_RENAME(utrie2_openFromSerialized) +#define utrie2_serialize U_ICU_ENTRY_POINT_RENAME(utrie2_serialize) +#define utrie2_set32 U_ICU_ENTRY_POINT_RENAME(utrie2_set32) +#define utrie2_set32ForLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_set32ForLeadSurrogateCodeUnit) +#define utrie2_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie2_setRange32) +#define utrie2_swap U_ICU_ENTRY_POINT_RENAME(utrie2_swap) +#define utrie_clone U_ICU_ENTRY_POINT_RENAME(utrie_clone) +#define utrie_close U_ICU_ENTRY_POINT_RENAME(utrie_close) +#define utrie_defaultGetFoldingOffset U_ICU_ENTRY_POINT_RENAME(utrie_defaultGetFoldingOffset) +#define utrie_enum U_ICU_ENTRY_POINT_RENAME(utrie_enum) +#define utrie_get32 U_ICU_ENTRY_POINT_RENAME(utrie_get32) +#define utrie_getData U_ICU_ENTRY_POINT_RENAME(utrie_getData) +#define utrie_open U_ICU_ENTRY_POINT_RENAME(utrie_open) +#define utrie_serialize U_ICU_ENTRY_POINT_RENAME(utrie_serialize) +#define utrie_set32 U_ICU_ENTRY_POINT_RENAME(utrie_set32) +#define utrie_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie_setRange32) +#define utrie_swap U_ICU_ENTRY_POINT_RENAME(utrie_swap) +#define utrie_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie_swapAnyVersion) +#define utrie_unserialize U_ICU_ENTRY_POINT_RENAME(utrie_unserialize) +#define utrie_unserializeDummy U_ICU_ENTRY_POINT_RENAME(utrie_unserializeDummy) +#define vzone_clone U_ICU_ENTRY_POINT_RENAME(vzone_clone) +#define vzone_close U_ICU_ENTRY_POINT_RENAME(vzone_close) +#define vzone_countTransitionRules U_ICU_ENTRY_POINT_RENAME(vzone_countTransitionRules) +#define vzone_equals U_ICU_ENTRY_POINT_RENAME(vzone_equals) +#define vzone_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(vzone_getDynamicClassID) +#define vzone_getLastModified U_ICU_ENTRY_POINT_RENAME(vzone_getLastModified) +#define vzone_getNextTransition U_ICU_ENTRY_POINT_RENAME(vzone_getNextTransition) +#define vzone_getOffset U_ICU_ENTRY_POINT_RENAME(vzone_getOffset) +#define vzone_getOffset2 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset2) +#define vzone_getOffset3 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset3) +#define vzone_getPreviousTransition U_ICU_ENTRY_POINT_RENAME(vzone_getPreviousTransition) +#define vzone_getRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_getRawOffset) +#define vzone_getStaticClassID U_ICU_ENTRY_POINT_RENAME(vzone_getStaticClassID) +#define vzone_getTZURL U_ICU_ENTRY_POINT_RENAME(vzone_getTZURL) +#define vzone_hasSameRules U_ICU_ENTRY_POINT_RENAME(vzone_hasSameRules) +#define vzone_inDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_inDaylightTime) +#define vzone_openData U_ICU_ENTRY_POINT_RENAME(vzone_openData) +#define vzone_openID U_ICU_ENTRY_POINT_RENAME(vzone_openID) +#define vzone_setLastModified U_ICU_ENTRY_POINT_RENAME(vzone_setLastModified) +#define vzone_setRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_setRawOffset) +#define vzone_setTZURL U_ICU_ENTRY_POINT_RENAME(vzone_setTZURL) +#define vzone_useDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_useDaylightTime) +#define vzone_write U_ICU_ENTRY_POINT_RENAME(vzone_write) +#define vzone_writeFromStart U_ICU_ENTRY_POINT_RENAME(vzone_writeFromStart) +#define vzone_writeSimple U_ICU_ENTRY_POINT_RENAME(vzone_writeSimple) +#define zrule_close U_ICU_ENTRY_POINT_RENAME(zrule_close) +#define zrule_equals U_ICU_ENTRY_POINT_RENAME(zrule_equals) +#define zrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(zrule_getDSTSavings) +#define zrule_getName U_ICU_ENTRY_POINT_RENAME(zrule_getName) +#define zrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(zrule_getRawOffset) +#define zrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(zrule_isEquivalentTo) +#define ztrans_adoptFrom U_ICU_ENTRY_POINT_RENAME(ztrans_adoptFrom) +#define ztrans_adoptTo U_ICU_ENTRY_POINT_RENAME(ztrans_adoptTo) +#define ztrans_clone U_ICU_ENTRY_POINT_RENAME(ztrans_clone) +#define ztrans_close U_ICU_ENTRY_POINT_RENAME(ztrans_close) +#define ztrans_equals U_ICU_ENTRY_POINT_RENAME(ztrans_equals) +#define ztrans_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getDynamicClassID) +#define ztrans_getFrom U_ICU_ENTRY_POINT_RENAME(ztrans_getFrom) +#define ztrans_getStaticClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getStaticClassID) +#define ztrans_getTime U_ICU_ENTRY_POINT_RENAME(ztrans_getTime) +#define ztrans_getTo U_ICU_ENTRY_POINT_RENAME(ztrans_getTo) +#define ztrans_open U_ICU_ENTRY_POINT_RENAME(ztrans_open) +#define ztrans_openEmpty U_ICU_ENTRY_POINT_RENAME(ztrans_openEmpty) +#define ztrans_setFrom U_ICU_ENTRY_POINT_RENAME(ztrans_setFrom) +#define ztrans_setTime U_ICU_ENTRY_POINT_RENAME(ztrans_setTime) +#define ztrans_setTo U_ICU_ENTRY_POINT_RENAME(ztrans_setTo) + +#endif /* !(defined(_MSC_VER) && defined(__INTELLISENSE__)) */ +#endif /* U_DISABLE_RENAMING */ +#endif /* URENAME_H */ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/urep.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/urep.h new file mode 100644 index 0000000000000000000000000000000000000000..932202ddb04b1c13eff4a2a489fddadfe5e614df --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/urep.h @@ -0,0 +1,157 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 1997-2010, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* Date Name Description +* 06/23/00 aliu Creation. +****************************************************************************** +*/ + +#ifndef __UREP_H +#define __UREP_H + +#include "unicode/utypes.h" + +U_CDECL_BEGIN + +/******************************************************************** + * General Notes + ******************************************************************** + * TODO + * Add usage scenario + * Add test code + * Talk about pinning + * Talk about "can truncate result if out of memory" + */ + +/******************************************************************** + * Data Structures + ********************************************************************/ +/** + * \file + * \brief C API: Callbacks for UReplaceable + */ +/** + * An opaque replaceable text object. This will be manipulated only + * through the caller-supplied UReplaceableFunctor struct. Related + * to the C++ class Replaceable. + * This is currently only used in the Transliterator C API, see utrans.h . + * @stable ICU 2.0 + */ +typedef void* UReplaceable; + +/** + * A set of function pointers that transliterators use to manipulate a + * UReplaceable. The caller should supply the required functions to + * manipulate their text appropriately. Related to the C++ class + * Replaceable. + * @stable ICU 2.0 + */ +typedef struct UReplaceableCallbacks { + + /** + * Function pointer that returns the number of UChar code units in + * this text. + * + * @param rep A pointer to "this" UReplaceable object. + * @return The length of the text. + * @stable ICU 2.0 + */ + int32_t (*length)(const UReplaceable* rep); + + /** + * Function pointer that returns a UChar code units at the given + * offset into this text; 0 <= offset < n, where n is the value + * returned by (*length)(rep). See unistr.h for a description of + * charAt() vs. char32At(). + * + * @param rep A pointer to "this" UReplaceable object. + * @param offset The index at which to fetch the UChar (code unit). + * @return The UChar (code unit) at offset, or U+FFFF if the offset is out of bounds. + * @stable ICU 2.0 + */ + UChar (*charAt)(const UReplaceable* rep, + int32_t offset); + + /** + * Function pointer that returns a UChar32 code point at the given + * offset into this text. See unistr.h for a description of + * charAt() vs. char32At(). + * + * @param rep A pointer to "this" UReplaceable object. + * @param offset The index at which to fetch the UChar32 (code point). + * @return The UChar32 (code point) at offset, or U+FFFF if the offset is out of bounds. + * @stable ICU 2.0 + */ + UChar32 (*char32At)(const UReplaceable* rep, + int32_t offset); + + /** + * Function pointer that replaces text between start and limit in + * this text with the given text. Attributes (out of band info) + * should be retained. + * + * @param rep A pointer to "this" UReplaceable object. + * @param start the starting index of the text to be replaced, + * inclusive. + * @param limit the ending index of the text to be replaced, + * exclusive. + * @param text the new text to replace the UChars from + * start..limit-1. + * @param textLength the number of UChars at text, or -1 if text + * is null-terminated. + * @stable ICU 2.0 + */ + void (*replace)(UReplaceable* rep, + int32_t start, + int32_t limit, + const UChar* text, + int32_t textLength); + + /** + * Function pointer that copies the characters in the range + * [start, limit) into the array dst. + * + * @param rep A pointer to "this" UReplaceable object. + * @param start offset of first character which will be copied + * into the array + * @param limit offset immediately following the last character to + * be copied + * @param dst array in which to copy characters. The length of + * dst must be at least (limit - start). + * @stable ICU 2.1 + */ + void (*extract)(UReplaceable* rep, + int32_t start, + int32_t limit, + UChar* dst); + + /** + * Function pointer that copies text between start and limit in + * this text to another index in the text. Attributes (out of + * band info) should be retained. After this call, there will be + * (at least) two copies of the characters originally located at + * start..limit-1. + * + * @param rep A pointer to "this" UReplaceable object. + * @param start the starting index of the text to be copied, + * inclusive. + * @param limit the ending index of the text to be copied, + * exclusive. + * @param dest the index at which the copy of the UChars should be + * inserted. + * @stable ICU 2.0 + */ + void (*copy)(UReplaceable* rep, + int32_t start, + int32_t limit, + int32_t dest); + +} UReplaceableCallbacks; + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ures.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ures.h new file mode 100644 index 0000000000000000000000000000000000000000..fff84043e84785297e0c9bb76d043dfd55920bf0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ures.h @@ -0,0 +1,911 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File URES.H (formerly CRESBUND.H) +* +* Modification History: +* +* Date Name Description +* 04/01/97 aliu Creation. +* 02/22/99 damiba overhaul. +* 04/04/99 helena Fixed internal header inclusion. +* 04/15/99 Madhu Updated Javadoc +* 06/14/99 stephen Removed functions taking a filename suffix. +* 07/20/99 stephen Language-independent typedef to void* +* 11/09/99 weiv Added ures_getLocale() +* 06/24/02 weiv Added support for resource sharing +****************************************************************************** +*/ + +#ifndef URES_H +#define URES_H + +#include "unicode/utypes.h" +#include "unicode/uloc.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief C API: Resource Bundle + * + *

C API: Resource Bundle

+ * + * C API representing a collection of resource information pertaining to a given + * locale. A resource bundle provides a way of accessing locale- specific information in + * a data file. You create a resource bundle that manages the resources for a given + * locale and then ask it for individual resources. + *

+ * Resource bundles in ICU4C are currently defined using text files which conform to the following + * BNF definition. + * More on resource bundle concepts and syntax can be found in the + * Users Guide. + *

+ */ + +/** + * UResourceBundle is an opaque type for handles for resource bundles in C APIs. + * @stable ICU 2.0 + */ +struct UResourceBundle; + +/** + * @stable ICU 2.0 + */ +typedef struct UResourceBundle UResourceBundle; + +/** + * Numeric constants for types of resource items. + * @see ures_getType + * @stable ICU 2.0 + */ +typedef enum { + /** Resource type constant for "no resource". @stable ICU 2.6 */ + URES_NONE=-1, + + /** Resource type constant for 16-bit Unicode strings. @stable ICU 2.6 */ + URES_STRING=0, + + /** Resource type constant for binary data. @stable ICU 2.6 */ + URES_BINARY=1, + + /** Resource type constant for tables of key-value pairs. @stable ICU 2.6 */ + URES_TABLE=2, + + /** + * Resource type constant for aliases; + * internally stores a string which identifies the actual resource + * storing the data (can be in a different resource bundle). + * Resolved internally before delivering the actual resource through the API. + * @stable ICU 2.6 + */ + URES_ALIAS=3, + + /** + * Resource type constant for a single 28-bit integer, interpreted as + * signed or unsigned by the ures_getInt() or ures_getUInt() function. + * @see ures_getInt + * @see ures_getUInt + * @stable ICU 2.6 + */ + URES_INT=7, + + /** Resource type constant for arrays of resources. @stable ICU 2.6 */ + URES_ARRAY=8, + + /** + * Resource type constant for vectors of 32-bit integers. + * @see ures_getIntVector + * @stable ICU 2.6 + */ + URES_INT_VECTOR = 14, +#ifndef U_HIDE_DEPRECATED_API + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_NONE=URES_NONE, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_STRING=URES_STRING, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_BINARY=URES_BINARY, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_TABLE=URES_TABLE, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_ALIAS=URES_ALIAS, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_INT=URES_INT, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_ARRAY=URES_ARRAY, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_INT_VECTOR=URES_INT_VECTOR, + /** @deprecated ICU 2.6 Not used. */ + RES_RESERVED=15, + + /** + * One more than the highest normal UResType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + URES_LIMIT = 16 +#endif // U_HIDE_DEPRECATED_API +} UResType; + +/* + * Functions to create and destroy resource bundles. + */ + +/** + * Opens a UResourceBundle, from which users can extract strings by using + * their corresponding keys. + * Note that the caller is responsible of calling ures_close on each successfully + * opened resource bundle. + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. If NULL, ICU data will be used. + * @param locale specifies the locale for which we want to open the resource + * if NULL, the default locale will be used. If strlen(locale) == 0 + * root locale will be used. + * + * @param status fills in the outgoing error code. + * The UErrorCode err parameter is used to return status information to the user. To + * check whether the construction succeeded or not, you should check the value of + * U_SUCCESS(err). If you wish more detailed information, you can check for + * informational status results which still indicate success. U_USING_FALLBACK_WARNING + * indicates that a fall back locale was used. For example, 'de_CH' was requested, + * but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that + * the default locale data or root locale data was used; neither the requested locale + * nor any of its fall back locales could be found. Please see the users guide for more + * information on this topic. + * @return a newly allocated resource bundle. + * @see ures_close + * @stable ICU 2.0 + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_open(const char* packageName, + const char* locale, + UErrorCode* status); + + +/** This function does not care what kind of localeID is passed in. It simply opens a bundle with + * that name. Fallback mechanism is disabled for the new bundle. If the requested bundle contains + * an %%ALIAS directive, the results are undefined. + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. If NULL, ICU data will be used. + * @param locale specifies the locale for which we want to open the resource + * if NULL, the default locale will be used. If strlen(locale) == 0 + * root locale will be used. + * + * @param status fills in the outgoing error code. Either U_ZERO_ERROR or U_MISSING_RESOURCE_ERROR + * @return a newly allocated resource bundle or NULL if it doesn't exist. + * @see ures_close + * @stable ICU 2.0 + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_openDirect(const char* packageName, + const char* locale, + UErrorCode* status); + +/** + * Same as ures_open() but takes a const UChar *path. + * This path will be converted to char * using the default converter, + * then ures_open() is called. + * + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. If NULL, ICU data will be used. + * @param locale specifies the locale for which we want to open the resource + * if NULL, the default locale will be used. If strlen(locale) == 0 + * root locale will be used. + * @param status fills in the outgoing error code. + * @return a newly allocated resource bundle. + * @see ures_open + * @stable ICU 2.0 + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_openU(const UChar* packageName, + const char* locale, + UErrorCode* status); + +#ifndef U_HIDE_DEPRECATED_API +/** + * Returns the number of strings/arrays in resource bundles. + * Better to use ures_getSize, as this function will be deprecated. + * + *@param resourceBundle resource bundle containing the desired strings + *@param resourceKey key tagging the resource + *@param err fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_FALLBACK_WARNING + *@return: for Arrays: returns the number of resources in the array + * Tables: returns the number of resources in the table + * single string: returns 1 + *@see ures_getSize + * @deprecated ICU 2.8 User ures_getSize instead + */ +U_DEPRECATED int32_t U_EXPORT2 +ures_countArrayItems(const UResourceBundle* resourceBundle, + const char* resourceKey, + UErrorCode* err); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Close a resource bundle, all pointers returned from the various ures_getXXX calls + * on this particular bundle should be considered invalid henceforth. + * + * @param resourceBundle a pointer to a resourceBundle struct. Can be NULL. + * @see ures_open + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ures_close(UResourceBundle* resourceBundle); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUResourceBundlePointer + * "Smart pointer" class, closes a UResourceBundle via ures_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close); + +U_NAMESPACE_END + +#endif + +#ifndef U_HIDE_DEPRECATED_API +/** + * Return the version number associated with this ResourceBundle as a string. Please + * use ures_getVersion as this function is going to be deprecated. + * + * @param resourceBundle The resource bundle for which the version is checked. + * @return A version number string as specified in the resource bundle or its parent. + * The caller does not own this string. + * @see ures_getVersion + * @deprecated ICU 2.8 Use ures_getVersion instead. + */ +U_DEPRECATED const char* U_EXPORT2 +ures_getVersionNumber(const UResourceBundle* resourceBundle); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Return the version number associated with this ResourceBundle as an + * UVersionInfo array. + * + * @param resB The resource bundle for which the version is checked. + * @param versionInfo A UVersionInfo array that is filled with the version number + * as specified in the resource bundle or its parent. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ures_getVersion(const UResourceBundle* resB, + UVersionInfo versionInfo); + +#ifndef U_HIDE_DEPRECATED_API +/** + * Return the name of the Locale associated with this ResourceBundle. This API allows + * you to query for the real locale of the resource. For example, if you requested + * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. + * For subresources, the locale where this resource comes from will be returned. + * If fallback has occurred, getLocale will reflect this. + * + * @param resourceBundle resource bundle in question + * @param status just for catching illegal arguments + * @return A Locale name + * @deprecated ICU 2.8 Use ures_getLocaleByType instead. + */ +U_DEPRECATED const char* U_EXPORT2 +ures_getLocale(const UResourceBundle* resourceBundle, + UErrorCode* status); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Return the name of the Locale associated with this ResourceBundle. + * You can choose between requested, valid and real locale. + * + * @param resourceBundle resource bundle in question + * @param type You can choose between requested, valid and actual + * locale. For description see the definition of + * ULocDataLocaleType in uloc.h + * @param status just for catching illegal arguments + * @return A Locale name + * @stable ICU 2.8 + */ +U_CAPI const char* U_EXPORT2 +ures_getLocaleByType(const UResourceBundle* resourceBundle, + ULocDataLocaleType type, + UErrorCode* status); + + +#ifndef U_HIDE_INTERNAL_API +/** + * Same as ures_open() but uses the fill-in parameter instead of allocating a new bundle. + * + * TODO need to revisit usefulness of this function + * and usage model for fillIn parameters without knowing sizeof(UResourceBundle) + * @param r The existing UResourceBundle to fill in. If NULL then status will be + * set to U_ILLEGAL_ARGUMENT_ERROR. + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. If NULL, ICU data will be used. + * @param localeID specifies the locale for which we want to open the resource + * @param status The error code. + * @internal + */ +U_CAPI void U_EXPORT2 +ures_openFillIn(UResourceBundle *r, + const char* packageName, + const char* localeID, + UErrorCode* status); +#endif /* U_HIDE_INTERNAL_API */ + +/** + * Returns a string from a string resource type + * + * @param resourceBundle a string resource + * @param len fills in the length of resulting string + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * Always check the value of status. Don't count on returning NULL. + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. + * @see ures_getBinary + * @see ures_getIntVector + * @see ures_getInt + * @see ures_getUInt + * @stable ICU 2.0 + */ +U_CAPI const UChar* U_EXPORT2 +ures_getString(const UResourceBundle* resourceBundle, + int32_t* len, + UErrorCode* status); + +/** + * Returns a UTF-8 string from a string resource. + * The UTF-8 string may be returnable directly as a pointer, or + * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() + * or equivalent. + * + * If forceCopy==true, then the string is always written to the dest buffer + * and dest is returned. + * + * If forceCopy==false, then the string is returned as a pointer if possible, + * without needing a dest buffer (it can be NULL). If the string needs to be + * copied or transformed, then it may be placed into dest at an arbitrary offset. + * + * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. + * + * If the string is transformed from UTF-16, then a conversion error may occur + * if an unpaired surrogate is encountered. If the function is successful, then + * the output UTF-8 string is always well-formed. + * + * @param resB Resource bundle. + * @param dest Destination buffer. Can be NULL only if capacity=*length==0. + * @param length Input: Capacity of destination buffer. + * Output: Actual length of the UTF-8 string, not counting the + * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. + * Can be NULL, meaning capacity=0 and the string length is not + * returned to the caller. + * @param forceCopy If true, then the output string will always be written to + * dest, with U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING set if appropriate. + * If false, then the dest buffer may or may not contain a + * copy of the string. dest may or may not be modified. + * If a copy needs to be written, then the UErrorCode parameter + * indicates overflow etc. as usual. + * @param status Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to the UTF-8 string. It may be dest, or at some offset + * from dest (only if !forceCopy), or in unrelated memory. + * Always NUL-terminated unless the string was written to dest and + * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). + * + * @see ures_getString + * @see u_strToUTF8 + * @stable ICU 3.6 + */ +U_CAPI const char * U_EXPORT2 +ures_getUTF8String(const UResourceBundle *resB, + char *dest, int32_t *length, + UBool forceCopy, + UErrorCode *status); + +/** + * Returns a binary data from a binary resource. + * + * @param resourceBundle a string resource + * @param len fills in the length of resulting byte chunk + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * Always check the value of status. Don't count on returning NULL. + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file. + * @see ures_getString + * @see ures_getIntVector + * @see ures_getInt + * @see ures_getUInt + * @stable ICU 2.0 + */ +U_CAPI const uint8_t* U_EXPORT2 +ures_getBinary(const UResourceBundle* resourceBundle, + int32_t* len, + UErrorCode* status); + +/** + * Returns a 32 bit integer array from a resource. + * + * @param resourceBundle an int vector resource + * @param len fills in the length of resulting byte chunk + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * Always check the value of status. Don't count on returning NULL. + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a chunk of integers which live in a memory mapped/DLL file. + * @see ures_getBinary + * @see ures_getString + * @see ures_getInt + * @see ures_getUInt + * @stable ICU 2.0 + */ +U_CAPI const int32_t* U_EXPORT2 +ures_getIntVector(const UResourceBundle* resourceBundle, + int32_t* len, + UErrorCode* status); + +/** + * Returns an unsigned integer from a resource. + * This integer is originally 28 bits. + * + * @param resourceBundle a string resource + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return an integer value + * @see ures_getInt + * @see ures_getIntVector + * @see ures_getBinary + * @see ures_getString + * @stable ICU 2.0 + */ +U_CAPI uint32_t U_EXPORT2 +ures_getUInt(const UResourceBundle* resourceBundle, + UErrorCode *status); + +/** + * Returns a signed integer from a resource. + * This integer is originally 28 bit and the sign gets propagated. + * + * @param resourceBundle a string resource + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return an integer value + * @see ures_getUInt + * @see ures_getIntVector + * @see ures_getBinary + * @see ures_getString + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ures_getInt(const UResourceBundle* resourceBundle, + UErrorCode *status); + +/** + * Returns the size of a resource. Size for scalar types is always 1, + * and for vector/table types is the number of child resources. + * @warning Integer array is treated as a scalar type. There are no + * APIs to access individual members of an integer array. It + * is always returned as a whole. + * @param resourceBundle a resource + * @return number of resources in a given resource. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ures_getSize(const UResourceBundle *resourceBundle); + +/** + * Returns the type of a resource. Available types are defined in enum UResType + * + * @param resourceBundle a resource + * @return type of the given resource. + * @see UResType + * @stable ICU 2.0 + */ +U_CAPI UResType U_EXPORT2 +ures_getType(const UResourceBundle *resourceBundle); + +/** + * Returns the key associated with a given resource. Not all the resources have a key - only + * those that are members of a table. + * + * @param resourceBundle a resource + * @return a key associated to this resource, or NULL if it doesn't have a key + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ures_getKey(const UResourceBundle *resourceBundle); + +/* ITERATION API + This API provides means for iterating through a resource +*/ + +/** + * Resets the internal context of a resource so that iteration starts from the first element. + * + * @param resourceBundle a resource + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ures_resetIterator(UResourceBundle *resourceBundle); + +/** + * Checks whether the given resource has another element to iterate over. + * + * @param resourceBundle a resource + * @return true if there are more elements, false if there is no more elements + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +ures_hasNext(const UResourceBundle *resourceBundle); + +/** + * Returns the next resource in a given resource or NULL if there are no more resources + * to iterate over. Features a fill-in parameter. + * + * @param resourceBundle a resource + * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. + * Alternatively, you can supply a struct to be filled by this function. + * @param status fills in the outgoing error code. You may still get a non NULL result even if an + * error occurred. Check status instead. + * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it + * @stable ICU 2.0 + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_getNextResource(UResourceBundle *resourceBundle, + UResourceBundle *fillIn, + UErrorCode *status); + +/** + * Returns the next string in a given resource or NULL if there are no more resources + * to iterate over. + * + * @param resourceBundle a resource + * @param len fill in length of the string + * @param key fill in for key associated with this string. NULL if no key + * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't + * count on it. Check status instead! + * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ +U_CAPI const UChar* U_EXPORT2 +ures_getNextString(UResourceBundle *resourceBundle, + int32_t* len, + const char ** key, + UErrorCode *status); + +/** + * Returns the resource in a given resource at the specified index. Features a fill-in parameter. + * + * @param resourceBundle the resource bundle from which to get a sub-resource + * @param indexR an index to the wanted resource. + * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. + * Alternatively, you can supply a struct to be filled by this function. + * @param status fills in the outgoing error code. Don't count on NULL being returned if an error has + * occurred. Check status instead. + * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it + * @stable ICU 2.0 + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_getByIndex(const UResourceBundle *resourceBundle, + int32_t indexR, + UResourceBundle *fillIn, + UErrorCode *status); + +/** + * Returns the string in a given resource at the specified index. + * + * @param resourceBundle a resource + * @param indexS an index to the wanted string. + * @param len fill in length of the string + * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't + * count on it. Check status instead! + * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ +U_CAPI const UChar* U_EXPORT2 +ures_getStringByIndex(const UResourceBundle *resourceBundle, + int32_t indexS, + int32_t* len, + UErrorCode *status); + +/** + * Returns a UTF-8 string from a resource at the specified index. + * The UTF-8 string may be returnable directly as a pointer, or + * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() + * or equivalent. + * + * If forceCopy==true, then the string is always written to the dest buffer + * and dest is returned. + * + * If forceCopy==false, then the string is returned as a pointer if possible, + * without needing a dest buffer (it can be NULL). If the string needs to be + * copied or transformed, then it may be placed into dest at an arbitrary offset. + * + * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. + * + * If the string is transformed from UTF-16, then a conversion error may occur + * if an unpaired surrogate is encountered. If the function is successful, then + * the output UTF-8 string is always well-formed. + * + * @param resB Resource bundle. + * @param stringIndex An index to the wanted string. + * @param dest Destination buffer. Can be NULL only if capacity=*length==0. + * @param pLength Input: Capacity of destination buffer. + * Output: Actual length of the UTF-8 string, not counting the + * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. + * Can be NULL, meaning capacity=0 and the string length is not + * returned to the caller. + * @param forceCopy If true, then the output string will always be written to + * dest, with U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING set if appropriate. + * If false, then the dest buffer may or may not contain a + * copy of the string. dest may or may not be modified. + * If a copy needs to be written, then the UErrorCode parameter + * indicates overflow etc. as usual. + * @param status Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to the UTF-8 string. It may be dest, or at some offset + * from dest (only if !forceCopy), or in unrelated memory. + * Always NUL-terminated unless the string was written to dest and + * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). + * + * @see ures_getStringByIndex + * @see u_strToUTF8 + * @stable ICU 3.6 + */ +U_CAPI const char * U_EXPORT2 +ures_getUTF8StringByIndex(const UResourceBundle *resB, + int32_t stringIndex, + char *dest, int32_t *pLength, + UBool forceCopy, + UErrorCode *status); + +/** + * Returns a resource in a given resource that has a given key. This procedure works only with table + * resources. Features a fill-in parameter. + * + * @param resourceBundle a resource + * @param key a key associated with the wanted resource + * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. + * Alternatively, you can supply a struct to be filled by this function. + * @param status fills in the outgoing error code. + * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it + * @stable ICU 2.0 + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_getByKey(const UResourceBundle *resourceBundle, + const char* key, + UResourceBundle *fillIn, + UErrorCode *status); + +/** + * Returns a string in a given resource that has a given key. This procedure works only with table + * resources. + * + * @param resB a resource + * @param key a key associated with the wanted string + * @param len fill in length of the string + * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't + * count on it. Check status instead! + * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ +U_CAPI const UChar* U_EXPORT2 +ures_getStringByKey(const UResourceBundle *resB, + const char* key, + int32_t* len, + UErrorCode *status); + +/** + * Returns a UTF-8 string from a resource and a key. + * This function works only with table resources. + * + * The UTF-8 string may be returnable directly as a pointer, or + * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() + * or equivalent. + * + * If forceCopy==true, then the string is always written to the dest buffer + * and dest is returned. + * + * If forceCopy==false, then the string is returned as a pointer if possible, + * without needing a dest buffer (it can be NULL). If the string needs to be + * copied or transformed, then it may be placed into dest at an arbitrary offset. + * + * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. + * + * If the string is transformed from UTF-16, then a conversion error may occur + * if an unpaired surrogate is encountered. If the function is successful, then + * the output UTF-8 string is always well-formed. + * + * @param resB Resource bundle. + * @param key A key associated with the wanted resource + * @param dest Destination buffer. Can be NULL only if capacity=*length==0. + * @param pLength Input: Capacity of destination buffer. + * Output: Actual length of the UTF-8 string, not counting the + * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. + * Can be NULL, meaning capacity=0 and the string length is not + * returned to the caller. + * @param forceCopy If true, then the output string will always be written to + * dest, with U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING set if appropriate. + * If false, then the dest buffer may or may not contain a + * copy of the string. dest may or may not be modified. + * If a copy needs to be written, then the UErrorCode parameter + * indicates overflow etc. as usual. + * @param status Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to the UTF-8 string. It may be dest, or at some offset + * from dest (only if !forceCopy), or in unrelated memory. + * Always NUL-terminated unless the string was written to dest and + * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). + * + * @see ures_getStringByKey + * @see u_strToUTF8 + * @stable ICU 3.6 + */ +U_CAPI const char * U_EXPORT2 +ures_getUTF8StringByKey(const UResourceBundle *resB, + const char *key, + char *dest, int32_t *pLength, + UBool forceCopy, + UErrorCode *status); + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN +/** + * Returns the string value from a string resource bundle. + * + * @param resB a resource, should have type URES_STRING + * @param status: fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return The string value, or a bogus string if there is a failure UErrorCode. + * @stable ICU 2.0 + */ +inline UnicodeString +ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; + const UChar *r = ures_getString(resB, &len, status); + if(U_SUCCESS(*status)) { + result.setTo(true, r, len); + } else { + result.setToBogus(); + } + return result; +} + +/** + * Returns the next string in a resource, or an empty string if there are no more resources + * to iterate over. + * Use ures_getNextString() instead to distinguish between + * the end of the iteration and a real empty string value. + * + * @param resB a resource + * @param key fill in for key associated with this string + * @param status fills in the outgoing error code + * @return The string value, or a bogus string if there is a failure UErrorCode. + * @stable ICU 2.0 + */ +inline UnicodeString +ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; + const UChar* r = ures_getNextString(resB, &len, key, status); + if(U_SUCCESS(*status)) { + result.setTo(true, r, len); + } else { + result.setToBogus(); + } + return result; +} + +/** + * Returns the string in a given resource array or table at the specified index. + * + * @param resB a resource + * @param indexS an index to the wanted string. + * @param status fills in the outgoing error code + * @return The string value, or a bogus string if there is a failure UErrorCode. + * @stable ICU 2.0 + */ +inline UnicodeString +ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; + const UChar* r = ures_getStringByIndex(resB, indexS, &len, status); + if(U_SUCCESS(*status)) { + result.setTo(true, r, len); + } else { + result.setToBogus(); + } + return result; +} + +/** + * Returns a string in a resource that has a given key. + * This procedure works only with table resources. + * + * @param resB a resource + * @param key a key associated with the wanted string + * @param status fills in the outgoing error code + * @return The string value, or a bogus string if there is a failure UErrorCode. + * @stable ICU 2.0 + */ +inline UnicodeString +ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; + const UChar* r = ures_getStringByKey(resB, key, &len, status); + if(U_SUCCESS(*status)) { + result.setTo(true, r, len); + } else { + result.setToBogus(); + } + return result; +} + +U_NAMESPACE_END + +#endif + +/** + * Create a string enumerator, owned by the caller, of all locales located within + * the specified resource tree. + * @param packageName name of the tree, such as (NULL) or U_ICUDATA_ALIAS or or "ICUDATA-coll" + * This call is similar to uloc_getAvailable(). + * @param status error code + * @stable ICU 3.2 + */ +U_CAPI UEnumeration* U_EXPORT2 +ures_openAvailableLocales(const char *packageName, UErrorCode *status); + + +#endif /*_URES*/ +/*eof*/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uscript.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uscript.h new file mode 100644 index 0000000000000000000000000000000000000000..8448afda761550026b8044605cfe4da0a15d6aee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uscript.h @@ -0,0 +1,708 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ********************************************************************** + * Copyright (C) 1997-2016, International Business Machines + * Corporation and others. All Rights Reserved. + ********************************************************************** + * + * File USCRIPT.H + * + * Modification History: + * + * Date Name Description + * 07/06/2001 Ram Creation. + ****************************************************************************** + */ + +#ifndef USCRIPT_H +#define USCRIPT_H +#include "unicode/utypes.h" + +/** + * \file + * \brief C API: Unicode Script Information + */ + +/** + * Constants for ISO 15924 script codes. + * + * The current set of script code constants supports at least all scripts + * that are encoded in the version of Unicode which ICU currently supports. + * The names of the constants are usually derived from the + * Unicode script property value aliases. + * See UAX #24 Unicode Script Property (http://www.unicode.org/reports/tr24/) + * and http://www.unicode.org/Public/UCD/latest/ucd/PropertyValueAliases.txt . + * + * In addition, constants for many ISO 15924 script codes + * are included, for use with language tags, CLDR data, and similar. + * Some of those codes are not used in the Unicode Character Database (UCD). + * For example, there are no characters that have a UCD script property value of + * Hans or Hant. All Han ideographs have the Hani script property value in Unicode. + * + * Private-use codes Qaaa..Qabx are not included, except as used in the UCD or in CLDR. + * + * Starting with ICU 55, script codes are only added when their scripts + * have been or will certainly be encoded in Unicode, + * and have been assigned Unicode script property value aliases, + * to ensure that their script names are stable and match the names of the constants. + * Script codes like Latf and Aran that are not subject to separate encoding + * may be added at any time. + * + * @stable ICU 2.2 + */ +typedef enum UScriptCode { + /* + * Note: UScriptCode constants and their ISO script code comments + * are parsed by preparseucd.py. + * It matches lines like + * USCRIPT_ = , / * * / + */ + + /** @stable ICU 2.2 */ + USCRIPT_INVALID_CODE = -1, + /** @stable ICU 2.2 */ + USCRIPT_COMMON = 0, /* Zyyy */ + /** @stable ICU 2.2 */ + USCRIPT_INHERITED = 1, /* Zinh */ /* "Code for inherited script", for non-spacing combining marks; also Qaai */ + /** @stable ICU 2.2 */ + USCRIPT_ARABIC = 2, /* Arab */ + /** @stable ICU 2.2 */ + USCRIPT_ARMENIAN = 3, /* Armn */ + /** @stable ICU 2.2 */ + USCRIPT_BENGALI = 4, /* Beng */ + /** @stable ICU 2.2 */ + USCRIPT_BOPOMOFO = 5, /* Bopo */ + /** @stable ICU 2.2 */ + USCRIPT_CHEROKEE = 6, /* Cher */ + /** @stable ICU 2.2 */ + USCRIPT_COPTIC = 7, /* Copt */ + /** @stable ICU 2.2 */ + USCRIPT_CYRILLIC = 8, /* Cyrl */ + /** @stable ICU 2.2 */ + USCRIPT_DESERET = 9, /* Dsrt */ + /** @stable ICU 2.2 */ + USCRIPT_DEVANAGARI = 10, /* Deva */ + /** @stable ICU 2.2 */ + USCRIPT_ETHIOPIC = 11, /* Ethi */ + /** @stable ICU 2.2 */ + USCRIPT_GEORGIAN = 12, /* Geor */ + /** @stable ICU 2.2 */ + USCRIPT_GOTHIC = 13, /* Goth */ + /** @stable ICU 2.2 */ + USCRIPT_GREEK = 14, /* Grek */ + /** @stable ICU 2.2 */ + USCRIPT_GUJARATI = 15, /* Gujr */ + /** @stable ICU 2.2 */ + USCRIPT_GURMUKHI = 16, /* Guru */ + /** @stable ICU 2.2 */ + USCRIPT_HAN = 17, /* Hani */ + /** @stable ICU 2.2 */ + USCRIPT_HANGUL = 18, /* Hang */ + /** @stable ICU 2.2 */ + USCRIPT_HEBREW = 19, /* Hebr */ + /** @stable ICU 2.2 */ + USCRIPT_HIRAGANA = 20, /* Hira */ + /** @stable ICU 2.2 */ + USCRIPT_KANNADA = 21, /* Knda */ + /** @stable ICU 2.2 */ + USCRIPT_KATAKANA = 22, /* Kana */ + /** @stable ICU 2.2 */ + USCRIPT_KHMER = 23, /* Khmr */ + /** @stable ICU 2.2 */ + USCRIPT_LAO = 24, /* Laoo */ + /** @stable ICU 2.2 */ + USCRIPT_LATIN = 25, /* Latn */ + /** @stable ICU 2.2 */ + USCRIPT_MALAYALAM = 26, /* Mlym */ + /** @stable ICU 2.2 */ + USCRIPT_MONGOLIAN = 27, /* Mong */ + /** @stable ICU 2.2 */ + USCRIPT_MYANMAR = 28, /* Mymr */ + /** @stable ICU 2.2 */ + USCRIPT_OGHAM = 29, /* Ogam */ + /** @stable ICU 2.2 */ + USCRIPT_OLD_ITALIC = 30, /* Ital */ + /** @stable ICU 2.2 */ + USCRIPT_ORIYA = 31, /* Orya */ + /** @stable ICU 2.2 */ + USCRIPT_RUNIC = 32, /* Runr */ + /** @stable ICU 2.2 */ + USCRIPT_SINHALA = 33, /* Sinh */ + /** @stable ICU 2.2 */ + USCRIPT_SYRIAC = 34, /* Syrc */ + /** @stable ICU 2.2 */ + USCRIPT_TAMIL = 35, /* Taml */ + /** @stable ICU 2.2 */ + USCRIPT_TELUGU = 36, /* Telu */ + /** @stable ICU 2.2 */ + USCRIPT_THAANA = 37, /* Thaa */ + /** @stable ICU 2.2 */ + USCRIPT_THAI = 38, /* Thai */ + /** @stable ICU 2.2 */ + USCRIPT_TIBETAN = 39, /* Tibt */ + /** Canadian_Aboriginal script. @stable ICU 2.6 */ + USCRIPT_CANADIAN_ABORIGINAL = 40, /* Cans */ + /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */ + USCRIPT_UCAS = USCRIPT_CANADIAN_ABORIGINAL, + /** @stable ICU 2.2 */ + USCRIPT_YI = 41, /* Yiii */ + /* New scripts in Unicode 3.2 */ + /** @stable ICU 2.2 */ + USCRIPT_TAGALOG = 42, /* Tglg */ + /** @stable ICU 2.2 */ + USCRIPT_HANUNOO = 43, /* Hano */ + /** @stable ICU 2.2 */ + USCRIPT_BUHID = 44, /* Buhd */ + /** @stable ICU 2.2 */ + USCRIPT_TAGBANWA = 45, /* Tagb */ + + /* New scripts in Unicode 4 */ + /** @stable ICU 2.6 */ + USCRIPT_BRAILLE = 46, /* Brai */ + /** @stable ICU 2.6 */ + USCRIPT_CYPRIOT = 47, /* Cprt */ + /** @stable ICU 2.6 */ + USCRIPT_LIMBU = 48, /* Limb */ + /** @stable ICU 2.6 */ + USCRIPT_LINEAR_B = 49, /* Linb */ + /** @stable ICU 2.6 */ + USCRIPT_OSMANYA = 50, /* Osma */ + /** @stable ICU 2.6 */ + USCRIPT_SHAVIAN = 51, /* Shaw */ + /** @stable ICU 2.6 */ + USCRIPT_TAI_LE = 52, /* Tale */ + /** @stable ICU 2.6 */ + USCRIPT_UGARITIC = 53, /* Ugar */ + + /** New script code in Unicode 4.0.1 @stable ICU 3.0 */ + USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */ + + /* New scripts in Unicode 4.1 */ + /** @stable ICU 3.4 */ + USCRIPT_BUGINESE = 55, /* Bugi */ + /** @stable ICU 3.4 */ + USCRIPT_GLAGOLITIC = 56, /* Glag */ + /** @stable ICU 3.4 */ + USCRIPT_KHAROSHTHI = 57, /* Khar */ + /** @stable ICU 3.4 */ + USCRIPT_SYLOTI_NAGRI = 58, /* Sylo */ + /** @stable ICU 3.4 */ + USCRIPT_NEW_TAI_LUE = 59, /* Talu */ + /** @stable ICU 3.4 */ + USCRIPT_TIFINAGH = 60, /* Tfng */ + /** @stable ICU 3.4 */ + USCRIPT_OLD_PERSIAN = 61, /* Xpeo */ + + /* New script codes from Unicode and ISO 15924 */ + /** @stable ICU 3.6 */ + USCRIPT_BALINESE = 62, /* Bali */ + /** @stable ICU 3.6 */ + USCRIPT_BATAK = 63, /* Batk */ + /** @stable ICU 3.6 */ + USCRIPT_BLISSYMBOLS = 64, /* Blis */ + /** @stable ICU 3.6 */ + USCRIPT_BRAHMI = 65, /* Brah */ + /** @stable ICU 3.6 */ + USCRIPT_CHAM = 66, /* Cham */ + /** @stable ICU 3.6 */ + USCRIPT_CIRTH = 67, /* Cirt */ + /** @stable ICU 3.6 */ + USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC = 68, /* Cyrs */ + /** @stable ICU 3.6 */ + USCRIPT_DEMOTIC_EGYPTIAN = 69, /* Egyd */ + /** @stable ICU 3.6 */ + USCRIPT_HIERATIC_EGYPTIAN = 70, /* Egyh */ + /** @stable ICU 3.6 */ + USCRIPT_EGYPTIAN_HIEROGLYPHS = 71, /* Egyp */ + /** @stable ICU 3.6 */ + USCRIPT_KHUTSURI = 72, /* Geok */ + /** @stable ICU 3.6 */ + USCRIPT_SIMPLIFIED_HAN = 73, /* Hans */ + /** @stable ICU 3.6 */ + USCRIPT_TRADITIONAL_HAN = 74, /* Hant */ + /** @stable ICU 3.6 */ + USCRIPT_PAHAWH_HMONG = 75, /* Hmng */ + /** @stable ICU 3.6 */ + USCRIPT_OLD_HUNGARIAN = 76, /* Hung */ + /** @stable ICU 3.6 */ + USCRIPT_HARAPPAN_INDUS = 77, /* Inds */ + /** @stable ICU 3.6 */ + USCRIPT_JAVANESE = 78, /* Java */ + /** @stable ICU 3.6 */ + USCRIPT_KAYAH_LI = 79, /* Kali */ + /** @stable ICU 3.6 */ + USCRIPT_LATIN_FRAKTUR = 80, /* Latf */ + /** @stable ICU 3.6 */ + USCRIPT_LATIN_GAELIC = 81, /* Latg */ + /** @stable ICU 3.6 */ + USCRIPT_LEPCHA = 82, /* Lepc */ + /** @stable ICU 3.6 */ + USCRIPT_LINEAR_A = 83, /* Lina */ + /** @stable ICU 4.6 */ + USCRIPT_MANDAIC = 84, /* Mand */ + /** @stable ICU 3.6 */ + USCRIPT_MANDAEAN = USCRIPT_MANDAIC, + /** @stable ICU 3.6 */ + USCRIPT_MAYAN_HIEROGLYPHS = 85, /* Maya */ + /** @stable ICU 4.6 */ + USCRIPT_MEROITIC_HIEROGLYPHS = 86, /* Mero */ + /** @stable ICU 3.6 */ + USCRIPT_MEROITIC = USCRIPT_MEROITIC_HIEROGLYPHS, + /** @stable ICU 3.6 */ + USCRIPT_NKO = 87, /* Nkoo */ + /** @stable ICU 3.6 */ + USCRIPT_ORKHON = 88, /* Orkh */ + /** @stable ICU 3.6 */ + USCRIPT_OLD_PERMIC = 89, /* Perm */ + /** @stable ICU 3.6 */ + USCRIPT_PHAGS_PA = 90, /* Phag */ + /** @stable ICU 3.6 */ + USCRIPT_PHOENICIAN = 91, /* Phnx */ + /** @stable ICU 52 */ + USCRIPT_MIAO = 92, /* Plrd */ + /** @stable ICU 3.6 */ + USCRIPT_PHONETIC_POLLARD = USCRIPT_MIAO, + /** @stable ICU 3.6 */ + USCRIPT_RONGORONGO = 93, /* Roro */ + /** @stable ICU 3.6 */ + USCRIPT_SARATI = 94, /* Sara */ + /** @stable ICU 3.6 */ + USCRIPT_ESTRANGELO_SYRIAC = 95, /* Syre */ + /** @stable ICU 3.6 */ + USCRIPT_WESTERN_SYRIAC = 96, /* Syrj */ + /** @stable ICU 3.6 */ + USCRIPT_EASTERN_SYRIAC = 97, /* Syrn */ + /** @stable ICU 3.6 */ + USCRIPT_TENGWAR = 98, /* Teng */ + /** @stable ICU 3.6 */ + USCRIPT_VAI = 99, /* Vaii */ + /** @stable ICU 3.6 */ + USCRIPT_VISIBLE_SPEECH = 100,/* Visp */ + /** @stable ICU 3.6 */ + USCRIPT_CUNEIFORM = 101,/* Xsux */ + /** @stable ICU 3.6 */ + USCRIPT_UNWRITTEN_LANGUAGES = 102,/* Zxxx */ + /** @stable ICU 3.6 */ + USCRIPT_UNKNOWN = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */ + + /** @stable ICU 3.8 */ + USCRIPT_CARIAN = 104,/* Cari */ + /** @stable ICU 3.8 */ + USCRIPT_JAPANESE = 105,/* Jpan */ + /** @stable ICU 3.8 */ + USCRIPT_LANNA = 106,/* Lana */ + /** @stable ICU 3.8 */ + USCRIPT_LYCIAN = 107,/* Lyci */ + /** @stable ICU 3.8 */ + USCRIPT_LYDIAN = 108,/* Lydi */ + /** @stable ICU 3.8 */ + USCRIPT_OL_CHIKI = 109,/* Olck */ + /** @stable ICU 3.8 */ + USCRIPT_REJANG = 110,/* Rjng */ + /** @stable ICU 3.8 */ + USCRIPT_SAURASHTRA = 111,/* Saur */ + /** Sutton SignWriting @stable ICU 3.8 */ + USCRIPT_SIGN_WRITING = 112,/* Sgnw */ + /** @stable ICU 3.8 */ + USCRIPT_SUNDANESE = 113,/* Sund */ + /** @stable ICU 3.8 */ + USCRIPT_MOON = 114,/* Moon */ + /** @stable ICU 3.8 */ + USCRIPT_MEITEI_MAYEK = 115,/* Mtei */ + + /** @stable ICU 4.0 */ + USCRIPT_IMPERIAL_ARAMAIC = 116,/* Armi */ + /** @stable ICU 4.0 */ + USCRIPT_AVESTAN = 117,/* Avst */ + /** @stable ICU 4.0 */ + USCRIPT_CHAKMA = 118,/* Cakm */ + /** @stable ICU 4.0 */ + USCRIPT_KOREAN = 119,/* Kore */ + /** @stable ICU 4.0 */ + USCRIPT_KAITHI = 120,/* Kthi */ + /** @stable ICU 4.0 */ + USCRIPT_MANICHAEAN = 121,/* Mani */ + /** @stable ICU 4.0 */ + USCRIPT_INSCRIPTIONAL_PAHLAVI = 122,/* Phli */ + /** @stable ICU 4.0 */ + USCRIPT_PSALTER_PAHLAVI = 123,/* Phlp */ + /** @stable ICU 4.0 */ + USCRIPT_BOOK_PAHLAVI = 124,/* Phlv */ + /** @stable ICU 4.0 */ + USCRIPT_INSCRIPTIONAL_PARTHIAN = 125,/* Prti */ + /** @stable ICU 4.0 */ + USCRIPT_SAMARITAN = 126,/* Samr */ + /** @stable ICU 4.0 */ + USCRIPT_TAI_VIET = 127,/* Tavt */ + /** @stable ICU 4.0 */ + USCRIPT_MATHEMATICAL_NOTATION = 128,/* Zmth */ + /** @stable ICU 4.0 */ + USCRIPT_SYMBOLS = 129,/* Zsym */ + + /** @stable ICU 4.4 */ + USCRIPT_BAMUM = 130,/* Bamu */ + /** @stable ICU 4.4 */ + USCRIPT_LISU = 131,/* Lisu */ + /** @stable ICU 4.4 */ + USCRIPT_NAKHI_GEBA = 132,/* Nkgb */ + /** @stable ICU 4.4 */ + USCRIPT_OLD_SOUTH_ARABIAN = 133,/* Sarb */ + + /** @stable ICU 4.6 */ + USCRIPT_BASSA_VAH = 134,/* Bass */ + /** @stable ICU 54 */ + USCRIPT_DUPLOYAN = 135,/* Dupl */ +#ifndef U_HIDE_DEPRECATED_API + /** @deprecated ICU 54 Typo, use USCRIPT_DUPLOYAN */ + USCRIPT_DUPLOYAN_SHORTAND = USCRIPT_DUPLOYAN, +#endif /* U_HIDE_DEPRECATED_API */ + /** @stable ICU 4.6 */ + USCRIPT_ELBASAN = 136,/* Elba */ + /** @stable ICU 4.6 */ + USCRIPT_GRANTHA = 137,/* Gran */ + /** @stable ICU 4.6 */ + USCRIPT_KPELLE = 138,/* Kpel */ + /** @stable ICU 4.6 */ + USCRIPT_LOMA = 139,/* Loma */ + /** Mende Kikakui @stable ICU 4.6 */ + USCRIPT_MENDE = 140,/* Mend */ + /** @stable ICU 4.6 */ + USCRIPT_MEROITIC_CURSIVE = 141,/* Merc */ + /** @stable ICU 4.6 */ + USCRIPT_OLD_NORTH_ARABIAN = 142,/* Narb */ + /** @stable ICU 4.6 */ + USCRIPT_NABATAEAN = 143,/* Nbat */ + /** @stable ICU 4.6 */ + USCRIPT_PALMYRENE = 144,/* Palm */ + /** @stable ICU 54 */ + USCRIPT_KHUDAWADI = 145,/* Sind */ + /** @stable ICU 4.6 */ + USCRIPT_SINDHI = USCRIPT_KHUDAWADI, + /** @stable ICU 4.6 */ + USCRIPT_WARANG_CITI = 146,/* Wara */ + + /** @stable ICU 4.8 */ + USCRIPT_AFAKA = 147,/* Afak */ + /** @stable ICU 4.8 */ + USCRIPT_JURCHEN = 148,/* Jurc */ + /** @stable ICU 4.8 */ + USCRIPT_MRO = 149,/* Mroo */ + /** @stable ICU 4.8 */ + USCRIPT_NUSHU = 150,/* Nshu */ + /** @stable ICU 4.8 */ + USCRIPT_SHARADA = 151,/* Shrd */ + /** @stable ICU 4.8 */ + USCRIPT_SORA_SOMPENG = 152,/* Sora */ + /** @stable ICU 4.8 */ + USCRIPT_TAKRI = 153,/* Takr */ + /** @stable ICU 4.8 */ + USCRIPT_TANGUT = 154,/* Tang */ + /** @stable ICU 4.8 */ + USCRIPT_WOLEAI = 155,/* Wole */ + + /** @stable ICU 49 */ + USCRIPT_ANATOLIAN_HIEROGLYPHS = 156,/* Hluw */ + /** @stable ICU 49 */ + USCRIPT_KHOJKI = 157,/* Khoj */ + /** @stable ICU 49 */ + USCRIPT_TIRHUTA = 158,/* Tirh */ + + /** @stable ICU 52 */ + USCRIPT_CAUCASIAN_ALBANIAN = 159,/* Aghb */ + /** @stable ICU 52 */ + USCRIPT_MAHAJANI = 160,/* Mahj */ + + /** @stable ICU 54 */ + USCRIPT_AHOM = 161,/* Ahom */ + /** @stable ICU 54 */ + USCRIPT_HATRAN = 162,/* Hatr */ + /** @stable ICU 54 */ + USCRIPT_MODI = 163,/* Modi */ + /** @stable ICU 54 */ + USCRIPT_MULTANI = 164,/* Mult */ + /** @stable ICU 54 */ + USCRIPT_PAU_CIN_HAU = 165,/* Pauc */ + /** @stable ICU 54 */ + USCRIPT_SIDDHAM = 166,/* Sidd */ + + /** @stable ICU 58 */ + USCRIPT_ADLAM = 167,/* Adlm */ + /** @stable ICU 58 */ + USCRIPT_BHAIKSUKI = 168,/* Bhks */ + /** @stable ICU 58 */ + USCRIPT_MARCHEN = 169,/* Marc */ + /** @stable ICU 58 */ + USCRIPT_NEWA = 170,/* Newa */ + /** @stable ICU 58 */ + USCRIPT_OSAGE = 171,/* Osge */ + + /** @stable ICU 58 */ + USCRIPT_HAN_WITH_BOPOMOFO = 172,/* Hanb */ + /** @stable ICU 58 */ + USCRIPT_JAMO = 173,/* Jamo */ + /** @stable ICU 58 */ + USCRIPT_SYMBOLS_EMOJI = 174,/* Zsye */ + + /** @stable ICU 60 */ + USCRIPT_MASARAM_GONDI = 175,/* Gonm */ + /** @stable ICU 60 */ + USCRIPT_SOYOMBO = 176,/* Soyo */ + /** @stable ICU 60 */ + USCRIPT_ZANABAZAR_SQUARE = 177,/* Zanb */ + + /** @stable ICU 62 */ + USCRIPT_DOGRA = 178,/* Dogr */ + /** @stable ICU 62 */ + USCRIPT_GUNJALA_GONDI = 179,/* Gong */ + /** @stable ICU 62 */ + USCRIPT_MAKASAR = 180,/* Maka */ + /** @stable ICU 62 */ + USCRIPT_MEDEFAIDRIN = 181,/* Medf */ + /** @stable ICU 62 */ + USCRIPT_HANIFI_ROHINGYA = 182,/* Rohg */ + /** @stable ICU 62 */ + USCRIPT_SOGDIAN = 183,/* Sogd */ + /** @stable ICU 62 */ + USCRIPT_OLD_SOGDIAN = 184,/* Sogo */ + + /** @stable ICU 64 */ + USCRIPT_ELYMAIC = 185,/* Elym */ + /** @stable ICU 64 */ + USCRIPT_NYIAKENG_PUACHUE_HMONG = 186,/* Hmnp */ + /** @stable ICU 64 */ + USCRIPT_NANDINAGARI = 187,/* Nand */ + /** @stable ICU 64 */ + USCRIPT_WANCHO = 188,/* Wcho */ + + /** @stable ICU 66 */ + USCRIPT_CHORASMIAN = 189,/* Chrs */ + /** @stable ICU 66 */ + USCRIPT_DIVES_AKURU = 190,/* Diak */ + /** @stable ICU 66 */ + USCRIPT_KHITAN_SMALL_SCRIPT = 191,/* Kits */ + /** @stable ICU 66 */ + USCRIPT_YEZIDI = 192,/* Yezi */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UScriptCode value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_SCRIPT). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + USCRIPT_CODE_LIMIT = 193 +#endif // U_HIDE_DEPRECATED_API +} UScriptCode; + +/** + * Gets the script codes associated with the given locale or ISO 15924 abbreviation or name. + * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym". + * Fills in USCRIPT_LATIN given "en" OR "en_US" + * If the required capacity is greater than the capacity of the destination buffer, + * then the error code is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned. + * + *

Note: To search by short or long script alias only, use + * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead. That does + * a fast lookup with no access of the locale data. + * + * @param nameOrAbbrOrLocale name of the script, as given in + * PropertyValueAliases.txt, or ISO 15924 code or locale + * @param fillIn the UScriptCode buffer to fill in the script code + * @param capacity the capacity (size) of UScriptCode buffer passed in. + * @param err the error status code. + * @return The number of script codes filled in the buffer passed in + * @stable ICU 2.4 + */ +U_CAPI int32_t U_EXPORT2 +uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err); + +/** + * Returns the long Unicode script name, if there is one. + * Otherwise returns the 4-letter ISO 15924 script code. + * Returns "Malayam" given USCRIPT_MALAYALAM. + * + * @param scriptCode UScriptCode enum + * @return long script name as given in PropertyValueAliases.txt, or the 4-letter code, + * or NULL if scriptCode is invalid + * @stable ICU 2.4 + */ +U_CAPI const char* U_EXPORT2 +uscript_getName(UScriptCode scriptCode); + +/** + * Returns the 4-letter ISO 15924 script code, + * which is the same as the short Unicode script name if Unicode has names for the script. + * Returns "Mlym" given USCRIPT_MALAYALAM. + * + * @param scriptCode UScriptCode enum + * @return short script name (4-letter code), or NULL if scriptCode is invalid + * @stable ICU 2.4 + */ +U_CAPI const char* U_EXPORT2 +uscript_getShortName(UScriptCode scriptCode); + +/** + * Gets the script code associated with the given codepoint. + * Returns USCRIPT_MALAYALAM given 0x0D02 + * @param codepoint UChar32 codepoint + * @param err the error status code. + * @return The UScriptCode, or 0 if codepoint is invalid + * @stable ICU 2.4 + */ +U_CAPI UScriptCode U_EXPORT2 +uscript_getScript(UChar32 codepoint, UErrorCode *err); + +/** + * Do the Script_Extensions of code point c contain script sc? + * If c does not have explicit Script_Extensions, then this tests whether + * c has the Script property value sc. + * + * Some characters are commonly used in multiple scripts. + * For more information, see UAX #24: http://www.unicode.org/reports/tr24/. + * @param c code point + * @param sc script code + * @return true if sc is in Script_Extensions(c) + * @stable ICU 49 + */ +U_CAPI UBool U_EXPORT2 +uscript_hasScript(UChar32 c, UScriptCode sc); + +/** + * Writes code point c's Script_Extensions as a list of UScriptCode values + * to the output scripts array and returns the number of script codes. + * - If c does have Script_Extensions, then the Script property value + * (normally Common or Inherited) is not included. + * - If c does not have Script_Extensions, then the one Script code is written to the output array. + * - If c is not a valid code point, then the one USCRIPT_UNKNOWN code is written. + * In other words, if the return value is 1, + * then the output array contains exactly c's single Script code. + * If the return value is n>=2, then the output array contains c's n Script_Extensions script codes. + * + * Some characters are commonly used in multiple scripts. + * For more information, see UAX #24: http://www.unicode.org/reports/tr24/. + * + * If there are more than capacity script codes to be written, then + * U_BUFFER_OVERFLOW_ERROR is set and the number of Script_Extensions is returned. + * (Usual ICU buffer handling behavior.) + * + * @param c code point + * @param scripts output script code array + * @param capacity capacity of the scripts array + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return number of script codes in c's Script_Extensions, or 1 for the single Script value, + * written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insufficient capacity + * @stable ICU 49 + */ +U_CAPI int32_t U_EXPORT2 +uscript_getScriptExtensions(UChar32 c, + UScriptCode *scripts, int32_t capacity, + UErrorCode *errorCode); + +/** + * Script usage constants. + * See UAX #31 Unicode Identifier and Pattern Syntax. + * http://www.unicode.org/reports/tr31/#Table_Candidate_Characters_for_Exclusion_from_Identifiers + * + * @stable ICU 51 + */ +typedef enum UScriptUsage { + /** Not encoded in Unicode. @stable ICU 51 */ + USCRIPT_USAGE_NOT_ENCODED, + /** Unknown script usage. @stable ICU 51 */ + USCRIPT_USAGE_UNKNOWN, + /** Candidate for Exclusion from Identifiers. @stable ICU 51 */ + USCRIPT_USAGE_EXCLUDED, + /** Limited Use script. @stable ICU 51 */ + USCRIPT_USAGE_LIMITED_USE, + /** Aspirational Use script. @stable ICU 51 */ + USCRIPT_USAGE_ASPIRATIONAL, + /** Recommended script. @stable ICU 51 */ + USCRIPT_USAGE_RECOMMENDED +} UScriptUsage; + +/** + * Writes the script sample character string. + * This string normally consists of one code point but might be longer. + * The string is empty if the script is not encoded. + * + * @param script script code + * @param dest output string array + * @param capacity number of UChars in the dest array + * @param pErrorCode standard ICU in/out error code, must pass U_SUCCESS() on input + * @return the string length, even if U_BUFFER_OVERFLOW_ERROR + * @stable ICU 51 + */ +U_CAPI int32_t U_EXPORT2 +uscript_getSampleString(UScriptCode script, UChar *dest, int32_t capacity, UErrorCode *pErrorCode); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN +class UnicodeString; +U_NAMESPACE_END + +/** + * Returns the script sample character string. + * This string normally consists of one code point but might be longer. + * The string is empty if the script is not encoded. + * + * @param script script code + * @return the sample character string + * @stable ICU 51 + */ +U_COMMON_API icu::UnicodeString U_EXPORT2 +uscript_getSampleUnicodeString(UScriptCode script); + +#endif + +/** + * Returns the script usage according to UAX #31 Unicode Identifier and Pattern Syntax. + * Returns USCRIPT_USAGE_NOT_ENCODED if the script is not encoded in Unicode. + * + * @param script script code + * @return script usage + * @see UScriptUsage + * @stable ICU 51 + */ +U_CAPI UScriptUsage U_EXPORT2 +uscript_getUsage(UScriptCode script); + +/** + * Returns true if the script is written right-to-left. + * For example, Arab and Hebr. + * + * @param script script code + * @return true if the script is right-to-left + * @stable ICU 51 + */ +U_CAPI UBool U_EXPORT2 +uscript_isRightToLeft(UScriptCode script); + +/** + * Returns true if the script allows line breaks between letters (excluding hyphenation). + * Such a script typically requires dictionary-based line breaking. + * For example, Hani and Thai. + * + * @param script script code + * @return true if the script allows line breaks between letters + * @stable ICU 51 + */ +U_CAPI UBool U_EXPORT2 +uscript_breaksBetweenLetters(UScriptCode script); + +/** + * Returns true if in modern (or most recent) usage of the script case distinctions are customary. + * For example, Latn and Cyrl. + * + * @param script script code + * @return true if the script is cased + * @stable ICU 51 + */ +U_CAPI UBool U_EXPORT2 +uscript_isCased(UScriptCode script); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uset.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uset.h new file mode 100644 index 0000000000000000000000000000000000000000..1d0daf9d09892964b8740d45a76e3cc5287021b1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uset.h @@ -0,0 +1,1220 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uset.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002mar07 +* created by: Markus W. Scherer +* +* C version of UnicodeSet. +*/ + + +/** + * \file + * \brief C API: Unicode Set + * + *

This is a C wrapper around the C++ UnicodeSet class.

+ */ + +#ifndef __USET_H__ +#define __USET_H__ + +#include "unicode/utypes.h" +#include "unicode/uchar.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +#ifndef USET_DEFINED + +#ifndef U_IN_DOXYGEN +#define USET_DEFINED +#endif +/** + * USet is the C API type corresponding to C++ class UnicodeSet. + * Use the uset_* API to manipulate. Create with + * uset_open*, and destroy with uset_close. + * @stable ICU 2.4 + */ +typedef struct USet USet; +#endif + +/** + * Bitmask values to be passed to uset_openPatternOptions() or + * uset_applyPattern() taking an option parameter. + * @stable ICU 2.4 + */ +enum { + /** + * Ignore white space within patterns unless quoted or escaped. + * @stable ICU 2.4 + */ + USET_IGNORE_SPACE = 1, + + /** + * Enable case insensitive matching. E.g., "[ab]" with this flag + * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will + * match all except 'a', 'A', 'b', and 'B'. This performs a full + * closure over case mappings, e.g. U+017F for s. + * + * The resulting set is a superset of the input for the code points but + * not for the strings. + * It performs a case mapping closure of the code points and adds + * full case folding strings for the code points, and reduces strings of + * the original set to their full case folding equivalents. + * + * This is designed for case-insensitive matches, for example + * in regular expressions. The full code point case closure allows checking of + * an input character directly against the closure set. + * Strings are matched by comparing the case-folded form from the closure + * set with an incremental case folding of the string in question. + * + * The closure set will also contain single code points if the original + * set contained case-equivalent strings (like U+00DF for "ss" or "Ss" etc.). + * This is not necessary (that is, redundant) for the above matching method + * but results in the same closure sets regardless of whether the original + * set contained the code point or a string. + * + * @stable ICU 2.4 + */ + USET_CASE_INSENSITIVE = 2, + + /** + * Enable case insensitive matching. E.g., "[ab]" with this flag + * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will + * match all except 'a', 'A', 'b', and 'B'. This adds the lower-, + * title-, and uppercase mappings as well as the case folding + * of each existing element in the set. + * @stable ICU 3.2 + */ + USET_ADD_CASE_MAPPINGS = 4 +}; + +/** + * Argument values for whether span() and similar functions continue while + * the current character is contained vs. not contained in the set. + * + * The functionality is straightforward for sets with only single code points, + * without strings (which is the common case): + * - USET_SPAN_CONTAINED and USET_SPAN_SIMPLE work the same. + * - USET_SPAN_CONTAINED and USET_SPAN_SIMPLE are inverses of USET_SPAN_NOT_CONTAINED. + * - span() and spanBack() partition any string the same way when + * alternating between span(USET_SPAN_NOT_CONTAINED) and + * span(either "contained" condition). + * - Using a complemented (inverted) set and the opposite span conditions + * yields the same results. + * + * When a set contains multi-code point strings, then these statements may not + * be true, depending on the strings in the set (for example, whether they + * overlap with each other) and the string that is processed. + * For a set with strings: + * - The complement of the set contains the opposite set of code points, + * but the same set of strings. + * Therefore, complementing both the set and the span conditions + * may yield different results. + * - When starting spans at different positions in a string + * (span(s, ...) vs. span(s+1, ...)) the ends of the spans may be different + * because a set string may start before the later position. + * - span(USET_SPAN_SIMPLE) may be shorter than + * span(USET_SPAN_CONTAINED) because it will not recursively try + * all possible paths. + * For example, with a set which contains the three strings "xy", "xya" and "ax", + * span("xyax", USET_SPAN_CONTAINED) will return 4 but + * span("xyax", USET_SPAN_SIMPLE) will return 3. + * span(USET_SPAN_SIMPLE) will never be longer than + * span(USET_SPAN_CONTAINED). + * - With either "contained" condition, span() and spanBack() may partition + * a string in different ways. + * For example, with a set which contains the two strings "ab" and "ba", + * and when processing the string "aba", + * span() will yield contained/not-contained boundaries of { 0, 2, 3 } + * while spanBack() will yield boundaries of { 0, 1, 3 }. + * + * Note: If it is important to get the same boundaries whether iterating forward + * or backward through a string, then either only span() should be used and + * the boundaries cached for backward operation, or an ICU BreakIterator + * could be used. + * + * Note: Unpaired surrogates are treated like surrogate code points. + * Similarly, set strings match only on code point boundaries, + * never in the middle of a surrogate pair. + * Illegal UTF-8 sequences are treated like U+FFFD. + * When processing UTF-8 strings, malformed set strings + * (strings with unpaired surrogates which cannot be converted to UTF-8) + * are ignored. + * + * @stable ICU 3.8 + */ +typedef enum USetSpanCondition { + /** + * Continues a span() while there is no set element at the current position. + * Increments by one code point at a time. + * Stops before the first set element (character or string). + * (For code points only, this is like while contains(current)==false). + * + * When span() returns, the substring between where it started and the position + * it returned consists only of characters that are not in the set, + * and none of its strings overlap with the span. + * + * @stable ICU 3.8 + */ + USET_SPAN_NOT_CONTAINED = 0, + /** + * Spans the longest substring that is a concatenation of set elements (characters or strings). + * (For characters only, this is like while contains(current)==true). + * + * When span() returns, the substring between where it started and the position + * it returned consists only of set elements (characters or strings) that are in the set. + * + * If a set contains strings, then the span will be the longest substring for which there + * exists at least one non-overlapping concatenation of set elements (characters or strings). + * This is equivalent to a POSIX regular expression for (OR of each set element)*. + * (Java/ICU/Perl regex stops at the first match of an OR.) + * + * @stable ICU 3.8 + */ + USET_SPAN_CONTAINED = 1, + /** + * Continues a span() while there is a set element at the current position. + * Increments by the longest matching element at each position. + * (For characters only, this is like while contains(current)==true). + * + * When span() returns, the substring between where it started and the position + * it returned consists only of set elements (characters or strings) that are in the set. + * + * If a set only contains single characters, then this is the same + * as USET_SPAN_CONTAINED. + * + * If a set contains strings, then the span will be the longest substring + * with a match at each position with the longest single set element (character or string). + * + * Use this span condition together with other longest-match algorithms, + * such as ICU converters (ucnv_getUnicodeSet()). + * + * @stable ICU 3.8 + */ + USET_SPAN_SIMPLE = 2, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last span condition. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + USET_SPAN_CONDITION_COUNT +#endif // U_HIDE_DEPRECATED_API +} USetSpanCondition; + +enum { + /** + * Capacity of USerializedSet::staticArray. + * Enough for any single-code point set. + * Also provides padding for nice sizeof(USerializedSet). + * @stable ICU 2.4 + */ + USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8 +}; + +/** + * A serialized form of a Unicode set. Limited manipulations are + * possible directly on a serialized set. See below. + * @stable ICU 2.4 + */ +typedef struct USerializedSet { + /** + * The serialized Unicode Set. + * @stable ICU 2.4 + */ + const uint16_t *array; + /** + * The length of the array that contains BMP characters. + * @stable ICU 2.4 + */ + int32_t bmpLength; + /** + * The total length of the array. + * @stable ICU 2.4 + */ + int32_t length; + /** + * A small buffer for the array to reduce memory allocations. + * @stable ICU 2.4 + */ + uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY]; +} USerializedSet; + +/********************************************************************* + * USet API + *********************************************************************/ + +/** + * Create an empty USet object. + * Equivalent to uset_open(1, 0). + * @return a newly created USet. The caller must call uset_close() on + * it when done. + * @stable ICU 4.2 + */ +U_CAPI USet* U_EXPORT2 +uset_openEmpty(void); + +/** + * Creates a USet object that contains the range of characters + * start..end, inclusive. If start > end + * then an empty set is created (same as using uset_openEmpty()). + * @param start first character of the range, inclusive + * @param end last character of the range, inclusive + * @return a newly created USet. The caller must call uset_close() on + * it when done. + * @stable ICU 2.4 + */ +U_CAPI USet* U_EXPORT2 +uset_open(UChar32 start, UChar32 end); + +/** + * Creates a set from the given pattern. See the UnicodeSet class + * description for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param patternLength the length of the pattern, or -1 if null + * terminated + * @param ec the error code + * @stable ICU 2.4 + */ +U_CAPI USet* U_EXPORT2 +uset_openPattern(const UChar* pattern, int32_t patternLength, + UErrorCode* ec); + +/** + * Creates a set from the given pattern. See the UnicodeSet class + * description for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param patternLength the length of the pattern, or -1 if null + * terminated + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param ec the error code + * @stable ICU 2.4 + */ +U_CAPI USet* U_EXPORT2 +uset_openPatternOptions(const UChar* pattern, int32_t patternLength, + uint32_t options, + UErrorCode* ec); + +/** + * Disposes of the storage used by a USet object. This function should + * be called exactly once for objects returned by uset_open(). + * @param set the object to dispose of + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +uset_close(USet* set); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUSetPointer + * "Smart pointer" class, closes a USet via uset_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close); + +U_NAMESPACE_END + +#endif + +/** + * Returns a copy of this object. + * If this set is frozen, then the clone will be frozen as well. + * Use uset_cloneAsThawed() for a mutable clone of a frozen set. + * @param set the original set + * @return the newly allocated copy of the set + * @see uset_cloneAsThawed + * @stable ICU 3.8 + */ +U_CAPI USet * U_EXPORT2 +uset_clone(const USet *set); + +/** + * Determines whether the set has been frozen (made immutable) or not. + * See the ICU4J Freezable interface for details. + * @param set the set + * @return true/false for whether the set has been frozen + * @see uset_freeze + * @see uset_cloneAsThawed + * @stable ICU 3.8 + */ +U_CAPI UBool U_EXPORT2 +uset_isFrozen(const USet *set); + +/** + * Freeze the set (make it immutable). + * Once frozen, it cannot be unfrozen and is therefore thread-safe + * until it is deleted. + * See the ICU4J Freezable interface for details. + * Freezing the set may also make some operations faster, for example + * uset_contains() and uset_span(). + * A frozen set will not be modified. (It remains frozen.) + * @param set the set + * @return the same set, now frozen + * @see uset_isFrozen + * @see uset_cloneAsThawed + * @stable ICU 3.8 + */ +U_CAPI void U_EXPORT2 +uset_freeze(USet *set); + +/** + * Clone the set and make the clone mutable. + * See the ICU4J Freezable interface for details. + * @param set the set + * @return the mutable clone + * @see uset_freeze + * @see uset_isFrozen + * @see uset_clone + * @stable ICU 3.8 + */ +U_CAPI USet * U_EXPORT2 +uset_cloneAsThawed(const USet *set); + +/** + * Causes the USet object to represent the range start - end. + * If start > end then this USet is set to an empty range. + * A frozen set will not be modified. + * @param set the object to set to the given range + * @param start first character in the set, inclusive + * @param end last character in the set, inclusive + * @stable ICU 3.2 + */ +U_CAPI void U_EXPORT2 +uset_set(USet* set, + UChar32 start, UChar32 end); + +/** + * Modifies the set to represent the set specified by the given + * pattern. See the UnicodeSet class description for the syntax of + * the pattern language. See also the User Guide chapter about UnicodeSet. + * Empties the set passed before applying the pattern. + * A frozen set will not be modified. + * @param set The set to which the pattern is to be applied. + * @param pattern A pointer to UChar string specifying what characters are in the set. + * The character at pattern[0] must be a '['. + * @param patternLength The length of the UChar string. -1 if NUL terminated. + * @param options A bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param status Returns an error if the pattern cannot be parsed. + * @return Upon successful parse, the value is either + * the index of the character after the closing ']' + * of the parsed pattern. + * If the status code indicates failure, then the return value + * is the index of the error in the source. + * + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +uset_applyPattern(USet *set, + const UChar *pattern, int32_t patternLength, + uint32_t options, + UErrorCode *status); + +/** + * Modifies the set to contain those code points which have the given value + * for the given binary or enumerated property, as returned by + * u_getIntPropertyValue. Prior contents of this set are lost. + * A frozen set will not be modified. + * + * @param set the object to contain the code points defined by the property + * + * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1 + * or UCHAR_INT_START..UCHAR_INT_LIMIT-1 + * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1. + * + * @param value a value in the range u_getIntPropertyMinValue(prop).. + * u_getIntPropertyMaxValue(prop), with one exception. If prop is + * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but + * rather a mask value produced by U_GET_GC_MASK(). This allows grouped + * categories such as [:L:] to be represented. + * + * @param ec error code input/output parameter + * + * @stable ICU 3.2 + */ +U_CAPI void U_EXPORT2 +uset_applyIntPropertyValue(USet* set, + UProperty prop, int32_t value, UErrorCode* ec); + +/** + * Modifies the set to contain those code points which have the + * given value for the given property. Prior contents of this + * set are lost. + * A frozen set will not be modified. + * + * @param set the object to contain the code points defined by the given + * property and value alias + * + * @param prop a string specifying a property alias, either short or long. + * The name is matched loosely. See PropertyAliases.txt for names and a + * description of loose matching. If the value string is empty, then this + * string is interpreted as either a General_Category value alias, a Script + * value alias, a binary property alias, or a special ID. Special IDs are + * matched loosely and correspond to the following sets: + * + * "ANY" = [\\u0000-\\U0010FFFF], + * "ASCII" = [\\u0000-\\u007F], + * "Assigned" = [:^Cn:]. + * + * @param propLength the length of the prop, or -1 if NULL + * + * @param value a string specifying a value alias, either short or long. + * The name is matched loosely. See PropertyValueAliases.txt for names + * and a description of loose matching. In addition to aliases listed, + * numeric values and canonical combining classes may be expressed + * numerically, e.g., ("nv", "0.5") or ("ccc", "220"). The value string + * may also be empty. + * + * @param valueLength the length of the value, or -1 if NULL + * + * @param ec error code input/output parameter + * + * @stable ICU 3.2 + */ +U_CAPI void U_EXPORT2 +uset_applyPropertyAlias(USet* set, + const UChar *prop, int32_t propLength, + const UChar *value, int32_t valueLength, + UErrorCode* ec); + +/** + * Return true if the given position, in the given pattern, appears + * to be the start of a UnicodeSet pattern. + * + * @param pattern a string specifying the pattern + * @param patternLength the length of the pattern, or -1 if NULL + * @param pos the given position + * @stable ICU 3.2 + */ +U_CAPI UBool U_EXPORT2 +uset_resemblesPattern(const UChar *pattern, int32_t patternLength, + int32_t pos); + +/** + * Returns a string representation of this set. If the result of + * calling this function is passed to a uset_openPattern(), it + * will produce another set that is equal to this one. + * @param set the set + * @param result the string to receive the rules, may be NULL + * @param resultCapacity the capacity of result, may be 0 if result is NULL + * @param escapeUnprintable if true then convert unprintable + * character to their hex escape representations, \\uxxxx or + * \\Uxxxxxxxx. Unprintable characters are those other than + * U+000A, U+0020..U+007E. + * @param ec error code. + * @return length of string, possibly larger than resultCapacity + * @stable ICU 2.4 + */ +U_CAPI int32_t U_EXPORT2 +uset_toPattern(const USet* set, + UChar* result, int32_t resultCapacity, + UBool escapeUnprintable, + UErrorCode* ec); + +/** + * Adds the given character to the given USet. After this call, + * uset_contains(set, c) will return true. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param c the character to add + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +uset_add(USet* set, UChar32 c); + +/** + * Adds all of the elements in the specified set to this set if + * they're not already present. This operation effectively + * modifies this set so that its value is the union of the two + * sets. The behavior of this operation is unspecified if the specified + * collection is modified while the operation is in progress. + * A frozen set will not be modified. + * + * @param set the object to which to add the set + * @param additionalSet the source set whose elements are to be added to this set. + * @stable ICU 2.6 + */ +U_CAPI void U_EXPORT2 +uset_addAll(USet* set, const USet *additionalSet); + +/** + * Adds the given range of characters to the given USet. After this call, + * uset_contains(set, start, end) will return true. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param start the first character of the range to add, inclusive + * @param end the last character of the range to add, inclusive + * @stable ICU 2.2 + */ +U_CAPI void U_EXPORT2 +uset_addRange(USet* set, UChar32 start, UChar32 end); + +/** + * Adds the given string to the given USet. After this call, + * uset_containsString(set, str, strLen) will return true. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param str the string to add + * @param strLen the length of the string or -1 if null terminated. + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +uset_addString(USet* set, const UChar* str, int32_t strLen); + +/** + * Adds each of the characters in this string to the set. Note: "ch" => {"c", "h"} + * If this set already contains any particular character, it has no effect on that character. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param str the source string + * @param strLen the length of the string or -1 if null terminated. + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen); + +/** + * Removes the given character from the given USet. After this call, + * uset_contains(set, c) will return false. + * A frozen set will not be modified. + * @param set the object from which to remove the character + * @param c the character to remove + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +uset_remove(USet* set, UChar32 c); + +/** + * Removes the given range of characters from the given USet. After this call, + * uset_contains(set, start, end) will return false. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param start the first character of the range to remove, inclusive + * @param end the last character of the range to remove, inclusive + * @stable ICU 2.2 + */ +U_CAPI void U_EXPORT2 +uset_removeRange(USet* set, UChar32 start, UChar32 end); + +/** + * Removes the given string to the given USet. After this call, + * uset_containsString(set, str, strLen) will return false. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param str the string to remove + * @param strLen the length of the string or -1 if null terminated. + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +uset_removeString(USet* set, const UChar* str, int32_t strLen); + +#ifndef U_HIDE_DRAFT_API +/** + * Removes EACH of the characters in this string. Note: "ch" == {"c", "h"} + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @draft ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_removeAllCodePoints(USet *set, const UChar *str, int32_t length); +#endif // U_HIDE_DRAFT_API + +/** + * Removes from this set all of its elements that are contained in the + * specified set. This operation effectively modifies this + * set so that its value is the asymmetric set difference of + * the two sets. + * A frozen set will not be modified. + * @param set the object from which the elements are to be removed + * @param removeSet the object that defines which elements will be + * removed from this set + * @stable ICU 3.2 + */ +U_CAPI void U_EXPORT2 +uset_removeAll(USet* set, const USet* removeSet); + +/** + * Retain only the elements in this set that are contained in the + * specified range. If start > end then an empty range is + * retained, leaving the set empty. This is equivalent to + * a boolean logic AND, or a set INTERSECTION. + * A frozen set will not be modified. + * + * @param set the object for which to retain only the specified range + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range + * @stable ICU 3.2 + */ +U_CAPI void U_EXPORT2 +uset_retain(USet* set, UChar32 start, UChar32 end); + +#ifndef U_HIDE_DRAFT_API +/** + * Retains only the specified string from this set if it is present. + * Upon return this set will be empty if it did not contain s, or + * will only contain s if it did contain s. + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @draft ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_retainString(USet *set, const UChar *str, int32_t length); + +/** + * Retains EACH of the characters in this string. Note: "ch" == {"c", "h"} + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @draft ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_retainAllCodePoints(USet *set, const UChar *str, int32_t length); +#endif // U_HIDE_DRAFT_API + +/** + * Retains only the elements in this set that are contained in the + * specified set. In other words, removes from this set all of + * its elements that are not contained in the specified set. This + * operation effectively modifies this set so that its value is + * the intersection of the two sets. + * A frozen set will not be modified. + * + * @param set the object on which to perform the retain + * @param retain set that defines which elements this set will retain + * @stable ICU 3.2 + */ +U_CAPI void U_EXPORT2 +uset_retainAll(USet* set, const USet* retain); + +/** + * Reallocate this objects internal structures to take up the least + * possible space, without changing this object's value. + * A frozen set will not be modified. + * + * @param set the object on which to perfrom the compact + * @stable ICU 3.2 + */ +U_CAPI void U_EXPORT2 +uset_compact(USet* set); + +/** + * Inverts this set. This operation modifies this set so that + * its value is its complement. This operation does not affect + * the multicharacter strings, if any. + * A frozen set will not be modified. + * @param set the set + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +uset_complement(USet* set); + +#ifndef U_HIDE_DRAFT_API +/** + * Complements the specified range in this set. Any character in + * the range will be removed if it is in this set, or will be + * added if it is not in this set. If start > end + * then an empty range is complemented, leaving the set unchanged. + * This is equivalent to a boolean logic XOR. + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range + * @draft ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_complementRange(USet *set, UChar32 start, UChar32 end); + +/** + * Complements the specified string in this set. + * The string will be removed if it is in this set, or will be added if it is not in this set. + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @draft ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_complementString(USet *set, const UChar *str, int32_t length); + +/** + * Complements EACH of the characters in this string. Note: "ch" == {"c", "h"} + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @draft ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_complementAllCodePoints(USet *set, const UChar *str, int32_t length); +#endif // U_HIDE_DRAFT_API + +/** + * Complements in this set all elements contained in the specified + * set. Any character in the other set will be removed if it is + * in this set, or will be added if it is not in this set. + * A frozen set will not be modified. + * + * @param set the set with which to complement + * @param complement set that defines which elements will be xor'ed + * from this set. + * @stable ICU 3.2 + */ +U_CAPI void U_EXPORT2 +uset_complementAll(USet* set, const USet* complement); + +/** + * Removes all of the elements from this set. This set will be + * empty after this call returns. + * A frozen set will not be modified. + * @param set the set + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +uset_clear(USet* set); + +/** + * Close this set over the given attribute. For the attribute + * USET_CASE, the result is to modify this set so that: + * + * 1. For each character or string 'a' in this set, all strings or + * characters 'b' such that foldCase(a) == foldCase(b) are added + * to this set. + * + * 2. For each string 'e' in the resulting set, if e != + * foldCase(e), 'e' will be removed. + * + * Example: [aq\\u00DF{Bc}{bC}{Fi}] => [aAqQ\\u00DF\\uFB01{ss}{bc}{fi}] + * + * (Here foldCase(x) refers to the operation u_strFoldCase, and a + * == b denotes that the contents are the same, not pointer + * comparison.) + * + * A frozen set will not be modified. + * + * @param set the set + * + * @param attributes bitmask for attributes to close over. + * Currently only the USET_CASE bit is supported. Any undefined bits + * are ignored. + * @stable ICU 4.2 + */ +U_CAPI void U_EXPORT2 +uset_closeOver(USet* set, int32_t attributes); + +/** + * Remove all strings from this set. + * + * @param set the set + * @stable ICU 4.2 + */ +U_CAPI void U_EXPORT2 +uset_removeAllStrings(USet* set); + +/** + * Returns true if the given USet contains no characters and no + * strings. + * @param set the set + * @return true if set is empty + * @stable ICU 2.4 + */ +U_CAPI UBool U_EXPORT2 +uset_isEmpty(const USet* set); + +/** + * Returns true if the given USet contains the given character. + * This function works faster with a frozen set. + * @param set the set + * @param c The codepoint to check for within the set + * @return true if set contains c + * @stable ICU 2.4 + */ +U_CAPI UBool U_EXPORT2 +uset_contains(const USet* set, UChar32 c); + +/** + * Returns true if the given USet contains all characters c + * where start <= c && c <= end. + * @param set the set + * @param start the first character of the range to test, inclusive + * @param end the last character of the range to test, inclusive + * @return true if set contains the range + * @stable ICU 2.2 + */ +U_CAPI UBool U_EXPORT2 +uset_containsRange(const USet* set, UChar32 start, UChar32 end); + +/** + * Returns true if the given USet contains the given string. + * @param set the set + * @param str the string + * @param strLen the length of the string or -1 if null terminated. + * @return true if set contains str + * @stable ICU 2.4 + */ +U_CAPI UBool U_EXPORT2 +uset_containsString(const USet* set, const UChar* str, int32_t strLen); + +/** + * Returns the index of the given character within this set, where + * the set is ordered by ascending code point. If the character + * is not in this set, return -1. The inverse of this method is + * charAt(). + * @param set the set + * @param c the character to obtain the index for + * @return an index from 0..size()-1, or -1 + * @stable ICU 3.2 + */ +U_CAPI int32_t U_EXPORT2 +uset_indexOf(const USet* set, UChar32 c); + +/** + * Returns the character at the given index within this set, where + * the set is ordered by ascending code point. If the index is + * out of range, return (UChar32)-1. The inverse of this method is + * indexOf(). + * @param set the set + * @param charIndex an index from 0..size()-1 to obtain the char for + * @return the character at the given index, or (UChar32)-1. + * @stable ICU 3.2 + */ +U_CAPI UChar32 U_EXPORT2 +uset_charAt(const USet* set, int32_t charIndex); + +/** + * Returns the number of characters and strings contained in the given + * USet. + * @param set the set + * @return a non-negative integer counting the characters and strings + * contained in set + * @stable ICU 2.4 + */ +U_CAPI int32_t U_EXPORT2 +uset_size(const USet* set); + +/** + * Returns the number of items in this set. An item is either a range + * of characters or a single multicharacter string. + * @param set the set + * @return a non-negative integer counting the character ranges + * and/or strings contained in set + * @stable ICU 2.4 + */ +U_CAPI int32_t U_EXPORT2 +uset_getItemCount(const USet* set); + +/** + * Returns an item of this set. An item is either a range of + * characters or a single multicharacter string. + * @param set the set + * @param itemIndex a non-negative integer in the range 0.. + * uset_getItemCount(set)-1 + * @param start pointer to variable to receive first character + * in range, inclusive + * @param end pointer to variable to receive last character in range, + * inclusive + * @param str buffer to receive the string, may be NULL + * @param strCapacity capacity of str, or 0 if str is NULL + * @param ec error code + * @return the length of the string (>= 2), or 0 if the item is a + * range, in which case it is the range *start..*end, or -1 if + * itemIndex is out of range + * @stable ICU 2.4 + */ +U_CAPI int32_t U_EXPORT2 +uset_getItem(const USet* set, int32_t itemIndex, + UChar32* start, UChar32* end, + UChar* str, int32_t strCapacity, + UErrorCode* ec); + +/** + * Returns true if set1 contains all the characters and strings + * of set2. It answers the question, 'Is set1 a superset of set2?' + * @param set1 set to be checked for containment + * @param set2 set to be checked for containment + * @return true if the test condition is met + * @stable ICU 3.2 + */ +U_CAPI UBool U_EXPORT2 +uset_containsAll(const USet* set1, const USet* set2); + +/** + * Returns true if this set contains all the characters + * of the given string. This is does not check containment of grapheme + * clusters, like uset_containsString. + * @param set set of characters to be checked for containment + * @param str string containing codepoints to be checked for containment + * @param strLen the length of the string or -1 if null terminated. + * @return true if the test condition is met + * @stable ICU 3.4 + */ +U_CAPI UBool U_EXPORT2 +uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); + +/** + * Returns true if set1 contains none of the characters and strings + * of set2. It answers the question, 'Is set1 a disjoint set of set2?' + * @param set1 set to be checked for containment + * @param set2 set to be checked for containment + * @return true if the test condition is met + * @stable ICU 3.2 + */ +U_CAPI UBool U_EXPORT2 +uset_containsNone(const USet* set1, const USet* set2); + +/** + * Returns true if set1 contains some of the characters and strings + * of set2. It answers the question, 'Does set1 and set2 have an intersection?' + * @param set1 set to be checked for containment + * @param set2 set to be checked for containment + * @return true if the test condition is met + * @stable ICU 3.2 + */ +U_CAPI UBool U_EXPORT2 +uset_containsSome(const USet* set1, const USet* set2); + +/** + * Returns the length of the initial substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Similar to the strspn() C library function. + * Unpaired surrogates are treated according to contains() of their surrogate code points. + * This function works faster with a frozen set and with a non-negative string length argument. + * @param set the set + * @param s start of the string + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the length of the initial substring according to the spanCondition; + * 0 if the start of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ +U_CAPI int32_t U_EXPORT2 +uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); + +/** + * Returns the start of the trailing substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Unpaired surrogates are treated according to contains() of their surrogate code points. + * This function works faster with a frozen set and with a non-negative string length argument. + * @param set the set + * @param s start of the string + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the start of the trailing substring according to the spanCondition; + * the string length if the end of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ +U_CAPI int32_t U_EXPORT2 +uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); + +/** + * Returns the length of the initial substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Similar to the strspn() C library function. + * Malformed byte sequences are treated according to contains(0xfffd). + * This function works faster with a frozen set and with a non-negative string length argument. + * @param set the set + * @param s start of the string (UTF-8) + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the length of the initial substring according to the spanCondition; + * 0 if the start of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ +U_CAPI int32_t U_EXPORT2 +uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); + +/** + * Returns the start of the trailing substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Malformed byte sequences are treated according to contains(0xfffd). + * This function works faster with a frozen set and with a non-negative string length argument. + * @param set the set + * @param s start of the string (UTF-8) + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the start of the trailing substring according to the spanCondition; + * the string length if the end of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ +U_CAPI int32_t U_EXPORT2 +uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); + +/** + * Returns true if set1 contains all of the characters and strings + * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?' + * @param set1 set to be checked for containment + * @param set2 set to be checked for containment + * @return true if the test condition is met + * @stable ICU 3.2 + */ +U_CAPI UBool U_EXPORT2 +uset_equals(const USet* set1, const USet* set2); + +/********************************************************************* + * Serialized set API + *********************************************************************/ + +/** + * Serializes this set into an array of 16-bit integers. Serialization + * (currently) only records the characters in the set; multicharacter + * strings are ignored. + * + * The array + * has following format (each line is one 16-bit integer): + * + * length = (n+2*m) | (m!=0?0x8000:0) + * bmpLength = n; present if m!=0 + * bmp[0] + * bmp[1] + * ... + * bmp[n-1] + * supp-high[0] + * supp-low[0] + * supp-high[1] + * supp-low[1] + * ... + * supp-high[m-1] + * supp-low[m-1] + * + * The array starts with a header. After the header are n bmp + * code points, then m supplementary code points. Either n or m + * or both may be zero. n+2*m is always <= 0x7FFF. + * + * If there are no supplementary characters (if m==0) then the + * header is one 16-bit integer, 'length', with value n. + * + * If there are supplementary characters (if m!=0) then the header + * is two 16-bit integers. The first, 'length', has value + * (n+2*m)|0x8000. The second, 'bmpLength', has value n. + * + * After the header the code points are stored in ascending order. + * Supplementary code points are stored as most significant 16 + * bits followed by least significant 16 bits. + * + * @param set the set + * @param dest pointer to buffer of destCapacity 16-bit integers. + * May be NULL only if destCapacity is zero. + * @param destCapacity size of dest, or zero. Must not be negative. + * @param pErrorCode pointer to the error code. Will be set to + * U_INDEX_OUTOFBOUNDS_ERROR if n+2*m > 0x7FFF. Will be set to + * U_BUFFER_OVERFLOW_ERROR if n+2*m+(m!=0?2:1) > destCapacity. + * @return the total length of the serialized format, including + * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other + * than U_BUFFER_OVERFLOW_ERROR. + * @stable ICU 2.4 + */ +U_CAPI int32_t U_EXPORT2 +uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode); + +/** + * Given a serialized array, fill in the given serialized set object. + * @param fillSet pointer to result + * @param src pointer to start of array + * @param srcLength length of array + * @return true if the given array is valid, otherwise false + * @stable ICU 2.4 + */ +U_CAPI UBool U_EXPORT2 +uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength); + +/** + * Set the USerializedSet to contain the given character (and nothing + * else). + * @param fillSet pointer to result + * @param c The codepoint to set + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c); + +/** + * Returns true if the given USerializedSet contains the given + * character. + * @param set the serialized set + * @param c The codepoint to check for within the set + * @return true if set contains c + * @stable ICU 2.4 + */ +U_CAPI UBool U_EXPORT2 +uset_serializedContains(const USerializedSet* set, UChar32 c); + +/** + * Returns the number of disjoint ranges of characters contained in + * the given serialized set. Ignores any strings contained in the + * set. + * @param set the serialized set + * @return a non-negative integer counting the character ranges + * contained in set + * @stable ICU 2.4 + */ +U_CAPI int32_t U_EXPORT2 +uset_getSerializedRangeCount(const USerializedSet* set); + +/** + * Returns a range of characters contained in the given serialized + * set. + * @param set the serialized set + * @param rangeIndex a non-negative integer in the range 0.. + * uset_getSerializedRangeCount(set)-1 + * @param pStart pointer to variable to receive first character + * in range, inclusive + * @param pEnd pointer to variable to receive last character in range, + * inclusive + * @return true if rangeIndex is valid, otherwise false + * @stable ICU 2.4 + */ +U_CAPI UBool U_EXPORT2 +uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, + UChar32* pStart, UChar32* pEnd); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/usetiter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/usetiter.h new file mode 100644 index 0000000000000000000000000000000000000000..a817ef72b3ae5ef5108488bb39af1dd2dbb63599 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/usetiter.h @@ -0,0 +1,325 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ +#ifndef USETITER_H +#define USETITER_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: UnicodeSetIterator iterates over the contents of a UnicodeSet. + */ + +U_NAMESPACE_BEGIN + +class UnicodeSet; +class UnicodeString; + +/** + * + * UnicodeSetIterator iterates over the contents of a UnicodeSet. It + * iterates over either code points or code point ranges. After all + * code points or ranges have been returned, it returns the + * multicharacter strings of the UnicodeSet, if any. + * + * This class is not intended to be subclassed. Consider any fields + * or methods declared as "protected" to be private. The use of + * protected in this class is an artifact of history. + * + *

To iterate over code points and strings, use a loop like this: + *

+ * UnicodeSetIterator it(set);
+ * while (it.next()) {
+ *     processItem(it.getString());
+ * }
+ * 
+ *

Each item in the set is accessed as a string. Set elements + * consisting of single code points are returned as strings containing + * just the one code point. + * + *

To iterate over code point ranges, instead of individual code points, + * use a loop like this: + *

+ * UnicodeSetIterator it(set);
+ * while (it.nextRange()) {
+ *   if (it.isString()) {
+ *     processString(it.getString());
+ *   } else {
+ *     processCodepointRange(it.getCodepoint(), it.getCodepointEnd());
+ *   }
+ * }
+ * 
+ * @author M. Davis + * @stable ICU 2.4 + */ +class U_COMMON_API UnicodeSetIterator : public UObject { + + protected: + + /** + * Value of codepoint if the iterator points to a string. + * If codepoint == IS_STRING, then examine + * string for the current iteration result. + * @stable ICU 2.4 + */ + enum { IS_STRING = -1 }; + + /** + * Current code point, or the special value IS_STRING, if + * the iterator points to a string. + * @stable ICU 2.4 + */ + UChar32 codepoint; + + /** + * When iterating over ranges using nextRange(), + * codepointEnd contains the inclusive end of the + * iteration range, if codepoint != IS_STRING. If + * iterating over code points using next(), or if + * codepoint == IS_STRING, then the value of + * codepointEnd is undefined. + * @stable ICU 2.4 + */ + UChar32 codepointEnd; + + /** + * If codepoint == IS_STRING, then string points + * to the current string. If codepoint != IS_STRING, the + * value of string is undefined. + * @stable ICU 2.4 + */ + const UnicodeString* string; + + public: + + /** + * Create an iterator over the given set. The iterator is valid + * only so long as set is valid. + * @param set set to iterate over + * @stable ICU 2.4 + */ + UnicodeSetIterator(const UnicodeSet& set); + + /** + * Create an iterator over nothing. next() and + * nextRange() return false. This is a convenience + * constructor allowing the target to be set later. + * @stable ICU 2.4 + */ + UnicodeSetIterator(); + + /** + * Destructor. + * @stable ICU 2.4 + */ + virtual ~UnicodeSetIterator(); + + /** + * Returns true if the current element is a string. If so, the + * caller can retrieve it with getString(). If this + * method returns false, the current element is a code point or + * code point range, depending on whether next() or + * nextRange() was called. + * Elements of types string and codepoint can both be retrieved + * with the function getString(). + * Elements of type codepoint can also be retrieved with + * getCodepoint(). + * For ranges, getCodepoint() returns the starting codepoint + * of the range, and getCodepointEnd() returns the end + * of the range. + * @stable ICU 2.4 + */ + inline UBool isString() const; + + /** + * Returns the current code point, if isString() returned + * false. Otherwise returns an undefined result. + * @stable ICU 2.4 + */ + inline UChar32 getCodepoint() const; + + /** + * Returns the end of the current code point range, if + * isString() returned false and nextRange() was + * called. Otherwise returns an undefined result. + * @stable ICU 2.4 + */ + inline UChar32 getCodepointEnd() const; + + /** + * Returns the current string, if isString() returned + * true. If the current iteration item is a code point, a UnicodeString + * containing that single code point is returned. + * + * Ownership of the returned string remains with the iterator. + * The string is guaranteed to remain valid only until the iterator is + * advanced to the next item, or until the iterator is deleted. + * + * @stable ICU 2.4 + */ + const UnicodeString& getString(); + + /** + * Advances the iteration position to the next element in the set, + * which can be either a single code point or a string. + * If there are no more elements in the set, return false. + * + *

+ * If isString() == true, the value is a + * string, otherwise the value is a + * single code point. Elements of either type can be retrieved + * with the function getString(), while elements of + * consisting of a single code point can be retrieved with + * getCodepoint() + * + *

The order of iteration is all code points in sorted order, + * followed by all strings sorted order. Do not mix + * calls to next() and nextRange() without + * calling reset() between them. The results of doing so + * are undefined. + * + * @return true if there was another element in the set. + * @stable ICU 2.4 + */ + UBool next(); + + /** + * Returns the next element in the set, either a code point range + * or a string. If there are no more elements in the set, return + * false. If isString() == true, the value is a + * string and can be accessed with getString(). Otherwise the value is a + * range of one or more code points from getCodepoint() to + * getCodepointeEnd() inclusive. + * + *

The order of iteration is all code points ranges in sorted + * order, followed by all strings sorted order. Ranges are + * disjoint and non-contiguous. The value returned from getString() + * is undefined unless isString() == true. Do not mix calls to + * next() and nextRange() without calling + * reset() between them. The results of doing so are + * undefined. + * + * @return true if there was another element in the set. + * @stable ICU 2.4 + */ + UBool nextRange(); + + /** + * Sets this iterator to visit the elements of the given set and + * resets it to the start of that set. The iterator is valid only + * so long as set is valid. + * @param set the set to iterate over. + * @stable ICU 2.4 + */ + void reset(const UnicodeSet& set); + + /** + * Resets this iterator to the start of the set. + * @stable ICU 2.4 + */ + void reset(); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.4 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.4 + */ + virtual UClassID getDynamicClassID() const; + + // ======================= PRIVATES =========================== + + protected: + + // endElement and nextElements are really UChar32's, but we keep + // them as signed int32_t's so we can do comparisons with + // endElement set to -1. Leave them as int32_t's. + /** The set + * @stable ICU 2.4 + */ + const UnicodeSet* set; + /** End range + * @stable ICU 2.4 + */ + int32_t endRange; + /** Range + * @stable ICU 2.4 + */ + int32_t range; + /** End element + * @stable ICU 2.4 + */ + int32_t endElement; + /** Next element + * @stable ICU 2.4 + */ + int32_t nextElement; + //UBool abbreviated; + /** Next string + * @stable ICU 2.4 + */ + int32_t nextString; + /** String count + * @stable ICU 2.4 + */ + int32_t stringCount; + + /** + * Points to the string to use when the caller asks for a + * string and the current iteration item is a code point, not a string. + * @internal + */ + UnicodeString *cpString; + + /** Copy constructor. Disallowed. + * @stable ICU 2.4 + */ + UnicodeSetIterator(const UnicodeSetIterator&); // disallow + + /** Assignment operator. Disallowed. + * @stable ICU 2.4 + */ + UnicodeSetIterator& operator=(const UnicodeSetIterator&); // disallow + + /** Load range + * @stable ICU 2.4 + */ + virtual void loadRange(int32_t range); + +}; + +inline UBool UnicodeSetIterator::isString() const { + return codepoint == (UChar32)IS_STRING; +} + +inline UChar32 UnicodeSetIterator::getCodepoint() const { + return codepoint; +} + +inline UChar32 UnicodeSetIterator::getCodepointEnd() const { + return codepointEnd; +} + + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ushape.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ushape.h new file mode 100644 index 0000000000000000000000000000000000000000..14371edc8f902009bcc58749eca0847790c01be0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ushape.h @@ -0,0 +1,476 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2000-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ushape.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2000jun29 +* created by: Markus W. Scherer +*/ + +#ifndef __USHAPE_H__ +#define __USHAPE_H__ + +#include "unicode/utypes.h" + +/** + * \file + * \brief C API: Arabic shaping + * + */ + +/** + * Shape Arabic text on a character basis. + * + *

This function performs basic operations for "shaping" Arabic text. It is most + * useful for use with legacy data formats and legacy display technology + * (simple terminals). All operations are performed on Unicode characters.

+ * + *

Text-based shaping means that some character code points in the text are + * replaced by others depending on the context. It transforms one kind of text + * into another. In comparison, modern displays for Arabic text select + * appropriate, context-dependent font glyphs for each text element, which means + * that they transform text into a glyph vector.

+ * + *

Text transformations are necessary when modern display technology is not + * available or when text needs to be transformed to or from legacy formats that + * use "shaped" characters. Since the Arabic script is cursive, connecting + * adjacent letters to each other, computers select images for each letter based + * on the surrounding letters. This usually results in four images per Arabic + * letter: initial, middle, final, and isolated forms. In Unicode, on the other + * hand, letters are normally stored abstract, and a display system is expected + * to select the necessary glyphs. (This makes searching and other text + * processing easier because the same letter has only one code.) It is possible + * to mimic this with text transformations because there are characters in + * Unicode that are rendered as letters with a specific shape + * (or cursive connectivity). They were included for interoperability with + * legacy systems and codepages, and for unsophisticated display systems.

+ * + *

A second kind of text transformations is supported for Arabic digits: + * For compatibility with legacy codepages that only include European digits, + * it is possible to replace one set of digits by another, changing the + * character code points. These operations can be performed for either + * Arabic-Indic Digits (U+0660...U+0669) or Eastern (Extended) Arabic-Indic + * digits (U+06f0...U+06f9).

+ * + *

Some replacements may result in more or fewer characters (code points). + * By default, this means that the destination buffer may receive text with a + * length different from the source length. Some legacy systems rely on the + * length of the text to be constant. They expect extra spaces to be added + * or consumed either next to the affected character or at the end of the + * text.

+ * + *

For details about the available operations, see the description of the + * U_SHAPE_... options.

+ * + * @param source The input text. + * + * @param sourceLength The number of UChars in source. + * + * @param dest The destination buffer that will receive the results of the + * requested operations. It may be NULL only if + * destSize is 0. The source and destination must not + * overlap. + * + * @param destSize The size (capacity) of the destination buffer in UChars. + * If destSize is 0, then no output is produced, + * but the necessary buffer size is returned ("preflighting"). + * + * @param options This is a 32-bit set of flags that specify the operations + * that are performed on the input text. If no error occurs, + * then the result will always be written to the destination + * buffer. + * + * @param pErrorCode must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @return The number of UChars written to the destination buffer. + * If an error occurred, then no output was written, or it may be + * incomplete. If U_BUFFER_OVERFLOW_ERROR is set, then + * the return value indicates the necessary destination buffer size. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_shapeArabic(const UChar *source, int32_t sourceLength, + UChar *dest, int32_t destSize, + uint32_t options, + UErrorCode *pErrorCode); + +/** + * Memory option: allow the result to have a different length than the source. + * Affects: LamAlef options + * @stable ICU 2.0 + */ +#define U_SHAPE_LENGTH_GROW_SHRINK 0 + +/** + * Memory option: allow the result to have a different length than the source. + * Affects: LamAlef options + * This option is an alias to U_SHAPE_LENGTH_GROW_SHRINK + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_RESIZE 0 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces next to modified characters. + * @stable ICU 2.0 + */ +#define U_SHAPE_LENGTH_FIXED_SPACES_NEAR 1 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces next to modified characters. + * Affects: LamAlef options + * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_NEAR + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_NEAR 1 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces at the end of the text. + * @stable ICU 2.0 + */ +#define U_SHAPE_LENGTH_FIXED_SPACES_AT_END 2 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces at the end of the text. + * Affects: LamAlef options + * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_END + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_END 2 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces at the beginning of the text. + * @stable ICU 2.0 + */ +#define U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING 3 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces at the beginning of the text. + * Affects: LamAlef options + * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_BEGIN 3 + + +/** + * Memory option: the result must have the same length as the source. + * Shaping Mode: For each LAMALEF character found, expand LAMALEF using space at end. + * If there is no space at end, use spaces at beginning of the buffer. If there + * is no space at beginning of the buffer, use spaces at the near (i.e. the space + * after the LAMALEF character). + * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) + * will be set in pErrorCode + * + * Deshaping Mode: Perform the same function as the flag equals U_SHAPE_LAMALEF_END. + * Affects: LamAlef options + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_AUTO 0x10000 + +/** Bit mask for memory options. @stable ICU 2.0 */ +#define U_SHAPE_LENGTH_MASK 0x10003 /* Changed old value 3 */ + + +/** + * Bit mask for LamAlef memory options. + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_MASK 0x10003 /* updated */ + +/** Direction indicator: the source is in logical (keyboard) order. @stable ICU 2.0 */ +#define U_SHAPE_TEXT_DIRECTION_LOGICAL 0 + +/** + * Direction indicator: + * the source is in visual RTL order, + * the rightmost displayed character stored first. + * This option is an alias to U_SHAPE_TEXT_DIRECTION_LOGICAL + * @stable ICU 4.2 + */ +#define U_SHAPE_TEXT_DIRECTION_VISUAL_RTL 0 + +/** + * Direction indicator: + * the source is in visual LTR order, + * the leftmost displayed character stored first. + * @stable ICU 2.0 + */ +#define U_SHAPE_TEXT_DIRECTION_VISUAL_LTR 4 + +/** Bit mask for direction indicators. @stable ICU 2.0 */ +#define U_SHAPE_TEXT_DIRECTION_MASK 4 + + +/** Letter shaping option: do not perform letter shaping. @stable ICU 2.0 */ +#define U_SHAPE_LETTERS_NOOP 0 + +/** Letter shaping option: replace abstract letter characters by "shaped" ones. @stable ICU 2.0 */ +#define U_SHAPE_LETTERS_SHAPE 8 + +/** Letter shaping option: replace "shaped" letter characters by abstract ones. @stable ICU 2.0 */ +#define U_SHAPE_LETTERS_UNSHAPE 0x10 + +/** + * Letter shaping option: replace abstract letter characters by "shaped" ones. + * The only difference with U_SHAPE_LETTERS_SHAPE is that Tashkeel letters + * are always "shaped" into the isolated form instead of the medial form + * (selecting code points from the Arabic Presentation Forms-B block). + * @stable ICU 2.0 + */ +#define U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED 0x18 + + +/** Bit mask for letter shaping options. @stable ICU 2.0 */ +#define U_SHAPE_LETTERS_MASK 0x18 + + +/** Digit shaping option: do not perform digit shaping. @stable ICU 2.0 */ +#define U_SHAPE_DIGITS_NOOP 0 + +/** + * Digit shaping option: + * Replace European digits (U+0030...) by Arabic-Indic digits. + * @stable ICU 2.0 + */ +#define U_SHAPE_DIGITS_EN2AN 0x20 + +/** + * Digit shaping option: + * Replace Arabic-Indic digits by European digits (U+0030...). + * @stable ICU 2.0 + */ +#define U_SHAPE_DIGITS_AN2EN 0x40 + +/** + * Digit shaping option: + * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent + * strongly directional character is an Arabic letter + * (u_charDirection() result U_RIGHT_TO_LEFT_ARABIC [AL]).
+ * The direction of "preceding" depends on the direction indicator option. + * For the first characters, the preceding strongly directional character + * (initial state) is assumed to be not an Arabic letter + * (it is U_LEFT_TO_RIGHT [L] or U_RIGHT_TO_LEFT [R]). + * @stable ICU 2.0 + */ +#define U_SHAPE_DIGITS_ALEN2AN_INIT_LR 0x60 + +/** + * Digit shaping option: + * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent + * strongly directional character is an Arabic letter + * (u_charDirection() result U_RIGHT_TO_LEFT_ARABIC [AL]).
+ * The direction of "preceding" depends on the direction indicator option. + * For the first characters, the preceding strongly directional character + * (initial state) is assumed to be an Arabic letter. + * @stable ICU 2.0 + */ +#define U_SHAPE_DIGITS_ALEN2AN_INIT_AL 0x80 + +/** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */ +#define U_SHAPE_DIGITS_RESERVED 0xa0 + +/** Bit mask for digit shaping options. @stable ICU 2.0 */ +#define U_SHAPE_DIGITS_MASK 0xe0 + + +/** Digit type option: Use Arabic-Indic digits (U+0660...U+0669). @stable ICU 2.0 */ +#define U_SHAPE_DIGIT_TYPE_AN 0 + +/** Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9). @stable ICU 2.0 */ +#define U_SHAPE_DIGIT_TYPE_AN_EXTENDED 0x100 + +/** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */ +#define U_SHAPE_DIGIT_TYPE_RESERVED 0x200 + +/** Bit mask for digit type options. @stable ICU 2.0 */ +#define U_SHAPE_DIGIT_TYPE_MASK 0x300 /* I need to change this from 0x3f00 to 0x300 */ + +/** + * Tashkeel aggregation option: + * Replaces any combination of U+0651 with one of + * U+064C, U+064D, U+064E, U+064F, U+0650 with + * U+FC5E, U+FC5F, U+FC60, U+FC61, U+FC62 consecutively. + * @stable ICU 3.6 + */ +#define U_SHAPE_AGGREGATE_TASHKEEL 0x4000 +/** Tashkeel aggregation option: do not aggregate tashkeels. @stable ICU 3.6 */ +#define U_SHAPE_AGGREGATE_TASHKEEL_NOOP 0 +/** Bit mask for tashkeel aggregation. @stable ICU 3.6 */ +#define U_SHAPE_AGGREGATE_TASHKEEL_MASK 0x4000 + +/** + * Presentation form option: + * Don't replace Arabic Presentation Forms-A and Arabic Presentation Forms-B + * characters with 0+06xx characters, before shaping. + * @stable ICU 3.6 + */ +#define U_SHAPE_PRESERVE_PRESENTATION 0x8000 +/** Presentation form option: + * Replace Arabic Presentation Forms-A and Arabic Presentationo Forms-B with + * their unshaped correspondents in range 0+06xx, before shaping. + * @stable ICU 3.6 + */ +#define U_SHAPE_PRESERVE_PRESENTATION_NOOP 0 +/** Bit mask for preserve presentation form. @stable ICU 3.6 */ +#define U_SHAPE_PRESERVE_PRESENTATION_MASK 0x8000 + +/* Seen Tail option */ +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: The SEEN family character will expand into two characters using space near + * the SEEN family character(i.e. the space after the character). + * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) + * will be set in pErrorCode + * + * De-shaping mode: Any Seen character followed by Tail character will be + * replaced by one cell Seen and a space will replace the Tail. + * Affects: Seen options + * @stable ICU 4.2 + */ +#define U_SHAPE_SEEN_TWOCELL_NEAR 0x200000 + +/** + * Bit mask for Seen memory options. + * @stable ICU 4.2 + */ +#define U_SHAPE_SEEN_MASK 0x700000 + +/* YehHamza option */ +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: The YEHHAMZA character will expand into two characters using space near it + * (i.e. the space after the character + * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) + * will be set in pErrorCode + * + * De-shaping mode: Any Yeh (final or isolated) character followed by Hamza character will be + * replaced by one cell YehHamza and space will replace the Hamza. + * Affects: YehHamza options + * @stable ICU 4.2 + */ +#define U_SHAPE_YEHHAMZA_TWOCELL_NEAR 0x1000000 + + +/** + * Bit mask for YehHamza memory options. + * @stable ICU 4.2 + */ +#define U_SHAPE_YEHHAMZA_MASK 0x3800000 + +/* New Tashkeel options */ +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: Tashkeel characters will be replaced by spaces. + * Spaces will be placed at beginning of the buffer + * + * De-shaping mode: N/A + * Affects: Tashkeel options + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_BEGIN 0x40000 + +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: Tashkeel characters will be replaced by spaces. + * Spaces will be placed at end of the buffer + * + * De-shaping mode: N/A + * Affects: Tashkeel options + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_END 0x60000 + +/** + * Memory option: allow the result to have a different length than the source. + * Shaping mode: Tashkeel characters will be removed, buffer length will shrink. + * De-shaping mode: N/A + * + * Affect: Tashkeel options + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_RESIZE 0x80000 + +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: Tashkeel characters will be replaced by Tatweel if it is connected to adjacent + * characters (i.e. shaped on Tatweel) or replaced by space if it is not connected. + * + * De-shaping mode: N/A + * Affects: YehHamza options + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL 0xC0000 + +/** + * Bit mask for Tashkeel replacement with Space or Tatweel memory options. + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_MASK 0xE0000 + + +/* Space location Control options */ +/** + * This option affect the meaning of BEGIN and END options. if this option is not used the default + * for BEGIN and END will be as following: + * The Default (for both Visual LTR, Visual RTL and Logical Text) + * 1. BEGIN always refers to the start address of physical memory. + * 2. END always refers to the end address of physical memory. + * + * If this option is used it will swap the meaning of BEGIN and END only for Visual LTR text. + * + * The effect on BEGIN and END Memory Options will be as following: + * A. BEGIN For Visual LTR text: This will be the beginning (right side) of the visual text( + * corresponding to the physical memory address end for Visual LTR text, Same as END in + * default behavior) + * B. BEGIN For Logical text: Same as BEGIN in default behavior. + * C. END For Visual LTR text: This will be the end (left side) of the visual text (corresponding + * to the physical memory address beginning for Visual LTR text, Same as BEGIN in default behavior. + * D. END For Logical text: Same as END in default behavior). + * Affects: All LamAlef BEGIN, END and AUTO options. + * @stable ICU 4.2 + */ +#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_BEGIN_END 0x4000000 + +/** + * Bit mask for swapping BEGIN and END for Visual LTR text + * @stable ICU 4.2 + */ +#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_MASK 0x4000000 + +/** + * If this option is used, shaping will use the new Unicode code point for TAIL (i.e. 0xFE73). + * If this option is not specified (Default), old unofficial Unicode TAIL code point is used (i.e. 0x200B) + * De-shaping will not use this option as it will always search for both the new Unicode code point for the + * TAIL (i.e. 0xFE73) or the old unofficial Unicode TAIL code point (i.e. 0x200B) and de-shape the + * Seen-Family letter accordingly. + * + * Shaping Mode: Only shaping. + * De-shaping Mode: N/A. + * Affects: All Seen options + * @stable ICU 4.8 + */ +#define U_SHAPE_TAIL_NEW_UNICODE 0x8000000 + +/** + * Bit mask for new Unicode Tail option + * @stable ICU 4.8 + */ +#define U_SHAPE_TAIL_TYPE_MASK 0x8000000 + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/usprep.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/usprep.h new file mode 100644 index 0000000000000000000000000000000000000000..f8a0f58e0de27f5ac3d6857864c578f626f14deb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/usprep.h @@ -0,0 +1,274 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * + * Copyright (C) 2003-2014, International Business Machines + * Corporation and others. All Rights Reserved. + * + ******************************************************************************* + * file name: usprep.h + * encoding: UTF-8 + * tab size: 8 (not used) + * indentation:4 + * + * created on: 2003jul2 + * created by: Ram Viswanadha + */ + +#ifndef __USPREP_H__ +#define __USPREP_H__ + +/** + * \file + * \brief C API: Implements the StringPrep algorithm. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * + * StringPrep API implements the StingPrep framework as described by RFC 3454. + * StringPrep prepares Unicode strings for use in network protocols. + * Profiles of StingPrep are set of rules and data according to with the + * Unicode Strings are prepared. Each profiles contains tables which describe + * how a code point should be treated. The tables are broadly classified into + *
    + *
  • Unassigned Table: Contains code points that are unassigned + * in the Unicode Version supported by StringPrep. Currently + * RFC 3454 supports Unicode 3.2.
  • + *
  • Prohibited Table: Contains code points that are prohibited from + * the output of the StringPrep processing function.
  • + *
  • Mapping Table: Contains code points that are deleted from the output or case mapped.
  • + *
+ * + * The procedure for preparing Unicode strings: + *
    + *
  1. Map: For each character in the input, check if it has a mapping + * and, if so, replace it with its mapping.
  2. + *
  3. Normalize: Possibly normalize the result of step 1 using Unicode + * normalization.
  4. + *
  5. Prohibit: Check for any characters that are not allowed in the + * output. If any are found, return an error.
  6. + *
  7. Check bidi: Possibly check for right-to-left characters, and if + * any are found, make sure that the whole string satisfies the + * requirements for bidirectional strings. If the string does not + * satisfy the requirements for bidirectional strings, return an + * error.
  8. + *
+ * @author Ram Viswanadha + */ +#if !UCONFIG_NO_IDNA + +#include "unicode/parseerr.h" + +/** + * The StringPrep profile + * @stable ICU 2.8 + */ +typedef struct UStringPrepProfile UStringPrepProfile; + + +/** + * Option to prohibit processing of unassigned code points in the input + * + * @see usprep_prepare + * @stable ICU 2.8 + */ +#define USPREP_DEFAULT 0x0000 + +/** + * Option to allow processing of unassigned code points in the input + * + * @see usprep_prepare + * @stable ICU 2.8 + */ +#define USPREP_ALLOW_UNASSIGNED 0x0001 + +/** + * enums for the standard stringprep profile types + * supported by usprep_openByType. + * @see usprep_openByType + * @stable ICU 4.2 + */ +typedef enum UStringPrepProfileType { + /** + * RFC3491 Nameprep + * @stable ICU 4.2 + */ + USPREP_RFC3491_NAMEPREP, + /** + * RFC3530 nfs4_cs_prep + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_CS_PREP, + /** + * RFC3530 nfs4_cs_prep with case insensitive option + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_CS_PREP_CI, + /** + * RFC3530 nfs4_cis_prep + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_CIS_PREP, + /** + * RFC3530 nfs4_mixed_prep for prefix + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_MIXED_PREP_PREFIX, + /** + * RFC3530 nfs4_mixed_prep for suffix + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_MIXED_PREP_SUFFIX, + /** + * RFC3722 iSCSI + * @stable ICU 4.2 + */ + USPREP_RFC3722_ISCSI, + /** + * RFC3920 XMPP Nodeprep + * @stable ICU 4.2 + */ + USPREP_RFC3920_NODEPREP, + /** + * RFC3920 XMPP Resourceprep + * @stable ICU 4.2 + */ + USPREP_RFC3920_RESOURCEPREP, + /** + * RFC4011 Policy MIB Stringprep + * @stable ICU 4.2 + */ + USPREP_RFC4011_MIB, + /** + * RFC4013 SASLprep + * @stable ICU 4.2 + */ + USPREP_RFC4013_SASLPREP, + /** + * RFC4505 trace + * @stable ICU 4.2 + */ + USPREP_RFC4505_TRACE, + /** + * RFC4518 LDAP + * @stable ICU 4.2 + */ + USPREP_RFC4518_LDAP, + /** + * RFC4518 LDAP for case ignore, numeric and stored prefix + * matching rules + * @stable ICU 4.2 + */ + USPREP_RFC4518_LDAP_CI +} UStringPrepProfileType; + +/** + * Creates a StringPrep profile from the data file. + * + * @param path string containing the full path pointing to the directory + * where the profile reside followed by the package name + * e.g. "/usr/resource/my_app/profiles/mydata" on a Unix system. + * if NULL, ICU default data files will be used. + * @param fileName name of the profile file to be opened + * @param status ICU error code in/out parameter. Must not be NULL. + * Must fulfill U_SUCCESS before the function call. + * @return Pointer to UStringPrepProfile that is opened. Should be closed by + * calling usprep_close() + * @see usprep_close() + * @stable ICU 2.8 + */ +U_CAPI UStringPrepProfile* U_EXPORT2 +usprep_open(const char* path, + const char* fileName, + UErrorCode* status); + +/** + * Creates a StringPrep profile for the specified profile type. + * + * @param type The profile type + * @param status ICU error code in/out parameter. Must not be NULL. + * Must fulfill U_SUCCESS before the function call. + * @return Pointer to UStringPrepProfile that is opened. Should be closed by + * calling usprep_close() + * @see usprep_close() + * @stable ICU 4.2 + */ +U_CAPI UStringPrepProfile* U_EXPORT2 +usprep_openByType(UStringPrepProfileType type, + UErrorCode* status); + +/** + * Closes the profile + * @param profile The profile to close + * @stable ICU 2.8 + */ +U_CAPI void U_EXPORT2 +usprep_close(UStringPrepProfile* profile); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUStringPrepProfilePointer + * "Smart pointer" class, closes a UStringPrepProfile via usprep_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringPrepProfilePointer, UStringPrepProfile, usprep_close); + +U_NAMESPACE_END + +#endif + +/** + * Prepare the input buffer for use in applications with the given profile. This operation maps, normalizes(NFKC), + * checks for prohibited and BiDi characters in the order defined by RFC 3454 + * depending on the options specified in the profile. + * + * @param prep The profile to use + * @param src Pointer to UChar buffer containing the string to prepare + * @param srcLength Number of characters in the source string + * @param dest Pointer to the destination buffer to receive the output + * @param destCapacity The capacity of destination array + * @param options A bit set of options: + * + * - USPREP_DEFAULT Prohibit processing of unassigned code points in the input + * + * - USPREP_ALLOW_UNASSIGNED Treat the unassigned code points are in the input + * as normal Unicode code points. + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The number of UChars in the destination buffer + * @stable ICU 2.8 + */ + +U_CAPI int32_t U_EXPORT2 +usprep_prepare( const UStringPrepProfile* prep, + const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status ); + + +#endif /* #if !UCONFIG_NO_IDNA */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ustring.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ustring.h new file mode 100644 index 0000000000000000000000000000000000000000..10ea45ead1d3987f3ce02ece32cff11f39e5bc3e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ustring.h @@ -0,0 +1,1689 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1998-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File ustring.h +* +* Modification History: +* +* Date Name Description +* 12/07/98 bertrand Creation. +****************************************************************************** +*/ + +#ifndef USTRING_H +#define USTRING_H + +#include "unicode/utypes.h" +#include "unicode/putil.h" +#include "unicode/uiter.h" + +/** + * \def UBRK_TYPEDEF_UBREAK_ITERATOR + * @internal + */ + +#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR +# define UBRK_TYPEDEF_UBREAK_ITERATOR +/** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/ + typedef struct UBreakIterator UBreakIterator; +#endif + +/** + * \file + * \brief C API: Unicode string handling functions + * + * These C API functions provide general Unicode string handling. + * + * Some functions are equivalent in name, signature, and behavior to the ANSI C + * functions. (For example, they do not check for bad arguments like NULL string pointers.) + * In some cases, only the thread-safe variant of such a function is implemented here + * (see u_strtok_r()). + * + * Other functions provide more Unicode-specific functionality like locale-specific + * upper/lower-casing and string comparison in code point order. + * + * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units. + * UTF-16 encodes each Unicode code point with either one or two UChar code units. + * (This is the default form of Unicode, and a forward-compatible extension of the original, + * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0 + * in 1996.) + * + * Some APIs accept a 32-bit UChar32 value for a single code point. + * + * ICU also handles 16-bit Unicode text with unpaired surrogates. + * Such text is not well-formed UTF-16. + * Code-point-related functions treat unpaired surrogates as surrogate code points, + * i.e., as separate units. + * + * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings), + * it is much more efficient even for random access because the code unit values + * for single-unit characters vs. lead units vs. trail units are completely disjoint. + * This means that it is easy to determine character (code point) boundaries from + * random offsets in the string. + * + * Unicode (UTF-16) string processing is optimized for the single-unit case. + * Although it is important to support supplementary characters + * (which use pairs of lead/trail code units called "surrogates"), + * their occurrence is rare. Almost all characters in modern use require only + * a single UChar code unit (i.e., their code point values are <=0xffff). + * + * For more details see the User Guide Strings chapter (http://icu-project.org/userguide/strings.html). + * For a discussion of the handling of unpaired surrogates see also + * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18. + */ + +/** + * \defgroup ustring_ustrlen String Length + * \ingroup ustring_strlen + */ +/*@{*/ +/** + * Determine the length of an array of UChar. + * + * @param s The array of UChars, NULL (U+0000) terminated. + * @return The number of UChars in chars, minus the terminator. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strlen(const UChar *s); +/*@}*/ + +/** + * Count Unicode code points in the length UChar code units of the string. + * A code point may occupy either one or two UChar code units. + * Counting code points involves reading all code units. + * + * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h). + * + * @param s The input string. + * @param length The number of UChar code units to be checked, or -1 to count all + * code points before the first NUL (U+0000). + * @return The number of code points in the specified code units. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_countChar32(const UChar *s, int32_t length); + +/** + * Check if the string contains more Unicode code points than a certain number. + * This is more efficient than counting all code points in the entire string + * and comparing that number with a threshold. + * This function may not need to scan the string at all if the length is known + * (not -1 for NUL-termination) and falls within a certain range, and + * never needs to count more than 'number+1' code points. + * Logically equivalent to (u_countChar32(s, length)>number). + * A Unicode code point may occupy either one or two UChar code units. + * + * @param s The input string. + * @param length The length of the string, or -1 if it is NUL-terminated. + * @param number The number of code points in the string is compared against + * the 'number' parameter. + * @return Boolean value for whether the string contains more Unicode code points + * than 'number'. Same as (u_countChar32(s, length)>number). + * @stable ICU 2.4 + */ +U_CAPI UBool U_EXPORT2 +u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); + +/** + * Concatenate two ustrings. Appends a copy of src, + * including the null terminator, to dst. The initial copied + * character from src overwrites the null terminator in dst. + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_strcat(UChar *dst, + const UChar *src); + +/** + * Concatenate two ustrings. + * Appends at most n characters from src to dst. + * Adds a terminating NUL. + * If src is too long, then only n-1 characters will be copied + * before the terminating NUL. + * If n<=0 then dst is not modified. + * + * @param dst The destination string. + * @param src The source string (can be NULL/invalid if n<=0). + * @param n The maximum number of characters to append; no-op if <=0. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_strncat(UChar *dst, + const UChar *src, + int32_t n); + +/** + * Find the first occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search (NUL-terminated). + * @param substring The substring to find (NUL-terminated). + * @return A pointer to the first occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.0 + * + * @see u_strrstr + * @see u_strFindFirst + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strstr(const UChar *s, const UChar *substring); + +/** + * Find the first occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search. + * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. + * @param substring The substring to find (NUL-terminated). + * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. + * @return A pointer to the first occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.4 + * + * @see u_strstr + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); + +/** + * Find the first occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The BMP code point to find. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr32 + * @see u_memchr + * @see u_strstr + * @see u_strFindFirst + */ +U_CAPI UChar * U_EXPORT2 +u_strchr(const UChar *s, UChar c); + +/** + * Find the first occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The code point to find. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr + * @see u_memchr32 + * @see u_strstr + * @see u_strFindFirst + */ +U_CAPI UChar * U_EXPORT2 +u_strchr32(const UChar *s, UChar32 c); + +/** + * Find the last occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search (NUL-terminated). + * @param substring The substring to find (NUL-terminated). + * @return A pointer to the last occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.4 + * + * @see u_strstr + * @see u_strFindFirst + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strrstr(const UChar *s, const UChar *substring); + +/** + * Find the last occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search. + * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. + * @param substring The substring to find (NUL-terminated). + * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. + * @return A pointer to the last occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.4 + * + * @see u_strstr + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); + +/** + * Find the last occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The BMP code point to find. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr32 + * @see u_memrchr + * @see u_strrstr + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strrchr(const UChar *s, UChar c); + +/** + * Find the last occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The code point to find. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr + * @see u_memchr32 + * @see u_strrstr + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strrchr32(const UChar *s, UChar32 c); + +/** + * Locates the first occurrence in the string string of any of the characters + * in the string matchSet. + * Works just like C's strpbrk but with Unicode. + * + * @param string The string in which to search, NUL-terminated. + * @param matchSet A NUL-terminated string defining a set of code points + * for which to search in the text string. + * @return A pointer to the character in string that matches one of the + * characters in matchSet, or NULL if no such character is found. + * @stable ICU 2.0 + */ +U_CAPI UChar * U_EXPORT2 +u_strpbrk(const UChar *string, const UChar *matchSet); + +/** + * Returns the number of consecutive characters in string, + * beginning with the first, that do not occur somewhere in matchSet. + * Works just like C's strcspn but with Unicode. + * + * @param string The string in which to search, NUL-terminated. + * @param matchSet A NUL-terminated string defining a set of code points + * for which to search in the text string. + * @return The number of initial characters in string that do not + * occur in matchSet. + * @see u_strspn + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strcspn(const UChar *string, const UChar *matchSet); + +/** + * Returns the number of consecutive characters in string, + * beginning with the first, that occur somewhere in matchSet. + * Works just like C's strspn but with Unicode. + * + * @param string The string in which to search, NUL-terminated. + * @param matchSet A NUL-terminated string defining a set of code points + * for which to search in the text string. + * @return The number of initial characters in string that do + * occur in matchSet. + * @see u_strcspn + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strspn(const UChar *string, const UChar *matchSet); + +/** + * The string tokenizer API allows an application to break a string into + * tokens. Unlike strtok(), the saveState (the current pointer within the + * original string) is maintained in saveState. In the first call, the + * argument src is a pointer to the string. In subsequent calls to + * return successive tokens of that string, src must be specified as + * NULL. The value saveState is set by this function to maintain the + * function's position within the string, and on each subsequent call + * you must give this argument the same variable. This function does + * handle surrogate pairs. This function is similar to the strtok_r() + * the POSIX Threads Extension (1003.1c-1995) version. + * + * @param src String containing token(s). This string will be modified. + * After the first call to u_strtok_r(), this argument must + * be NULL to get to the next token. + * @param delim Set of delimiter characters (Unicode code points). + * @param saveState The current pointer within the original string, + * which is set by this function. The saveState + * parameter should the address of a local variable of type + * UChar *. (i.e. defined "UChar *myLocalSaveState" and use + * &myLocalSaveState for this parameter). + * @return A pointer to the next token found in src, or NULL + * when there are no more tokens. + * @stable ICU 2.0 + */ +U_CAPI UChar * U_EXPORT2 +u_strtok_r(UChar *src, + const UChar *delim, + UChar **saveState); + +/** + * Compare two Unicode strings for bitwise equality (code unit order). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @return 0 if s1 and s2 are bitwise equal; a negative + * value if s1 is bitwise less than s2,; a positive + * value if s1 is bitwise greater than s2. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strcmp(const UChar *s1, + const UChar *s2); + +/** + * Compare two Unicode strings in code point order. + * See u_strCompare for details. + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @return a negative/zero/positive integer corresponding to whether + * the first string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); + +/** + * Compare two Unicode strings (binary order). + * + * The comparison can be done in code unit order or in code point order. + * They differ only in UTF-16 when + * comparing supplementary code points (U+10000..U+10ffff) + * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). + * In code unit order, high BMP code points sort after supplementary code points + * because they are stored as pairs of surrogates which are at U+d800..U+dfff. + * + * This functions works with strings of different explicitly specified lengths + * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. + * NUL-terminated strings are possible with length arguments of -1. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * + * @param codePointOrder Choose between code unit order (false) + * and code point order (true). + * + * @return <0 or 0 or >0 as usual for string comparisons + * + * @stable ICU 2.2 + */ +U_CAPI int32_t U_EXPORT2 +u_strCompare(const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + UBool codePointOrder); + +/** + * Compare two Unicode strings (binary order) + * as presented by UCharIterator objects. + * Works otherwise just like u_strCompare(). + * + * Both iterators are reset to their start positions. + * When the function returns, it is undefined where the iterators + * have stopped. + * + * @param iter1 First source string iterator. + * @param iter2 Second source string iterator. + * @param codePointOrder Choose between code unit order (false) + * and code point order (true). + * + * @return <0 or 0 or >0 as usual for string comparisons + * + * @see u_strCompare + * + * @stable ICU 2.6 + */ +U_CAPI int32_t U_EXPORT2 +u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to + * u_strCompare(u_strFoldCase(s1, options), + * u_strFoldCase(s2, options), + * (options&U_COMPARE_CODE_POINT_ORDER)!=0). + * + * The comparison can be done in UTF-16 code unit order or in code point order. + * They differ only when comparing supplementary code points (U+10000..U+10ffff) + * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). + * In code unit order, high BMP code points sort after supplementary code points + * because they are stored as pairs of surrogates which are at U+d800..U+dfff. + * + * This functions works with strings of different explicitly specified lengths + * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. + * NUL-terminated strings are possible with length arguments of -1. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @return <0 or 0 or >0 as usual for string comparisons + * + * @stable ICU 2.2 + */ +U_CAPI int32_t U_EXPORT2 +u_strCaseCompare(const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + uint32_t options, + UErrorCode *pErrorCode); + +/** + * Compare two ustrings for bitwise equality. + * Compares at most n characters. + * + * @param ucs1 A string to compare (can be NULL/invalid if n<=0). + * @param ucs2 A string to compare (can be NULL/invalid if n<=0). + * @param n The maximum number of characters to compare; always returns 0 if n<=0. + * @return 0 if s1 and s2 are bitwise equal; a negative + * value if s1 is bitwise less than s2; a positive + * value if s1 is bitwise greater than s2. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strncmp(const UChar *ucs1, + const UChar *ucs2, + int32_t n); + +/** + * Compare two Unicode strings in code point order. + * This is different in UTF-16 from u_strncmp() if supplementary characters are present. + * For details, see u_strCompare(). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param n The maximum number of characters to compare. + * @return a negative/zero/positive integer corresponding to whether + * the first string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options), + * u_strFoldCase(s2, at most n, options)). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param n The maximum number of characters each string to case-fold and then compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options), + * u_strFoldCase(s2, n, options)). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param length The number of characters in each string to case-fold and then compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options); + +/** + * Copy a ustring. Adds a null terminator. + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_strcpy(UChar *dst, + const UChar *src); + +/** + * Copy a ustring. + * Copies at most n characters. The result will be null terminated + * if the length of src is less than n. + * + * @param dst The destination string. + * @param src The source string (can be NULL/invalid if n<=0). + * @param n The maximum number of characters to copy; no-op if <=0. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_strncpy(UChar *dst, + const UChar *src, + int32_t n); + +#if !UCONFIG_NO_CONVERSION + +/** + * Copy a byte string encoded in the default codepage to a ustring. + * Adds a null terminator. + * Performs a host byte to UChar conversion + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 u_uastrcpy(UChar *dst, + const char *src ); + +/** + * Copy a byte string encoded in the default codepage to a ustring. + * Copies at most n characters. The result will be null terminated + * if the length of src is less than n. + * Performs a host byte to UChar conversion + * + * @param dst The destination string. + * @param src The source string. + * @param n The maximum number of characters to copy. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 u_uastrncpy(UChar *dst, + const char *src, + int32_t n); + +/** + * Copy ustring to a byte string encoded in the default codepage. + * Adds a null terminator. + * Performs a UChar to host byte conversion + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI char* U_EXPORT2 u_austrcpy(char *dst, + const UChar *src ); + +/** + * Copy ustring to a byte string encoded in the default codepage. + * Copies at most n characters. The result will be null terminated + * if the length of src is less than n. + * Performs a UChar to host byte conversion + * + * @param dst The destination string. + * @param src The source string. + * @param n The maximum number of characters to copy. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI char* U_EXPORT2 u_austrncpy(char *dst, + const UChar *src, + int32_t n ); + +#endif + +/** + * Synonym for memcpy(), but with UChars only. + * @param dest The destination string + * @param src The source string (can be NULL/invalid if count<=0) + * @param count The number of characters to copy; no-op if <=0 + * @return A pointer to dest + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_memcpy(UChar *dest, const UChar *src, int32_t count); + +/** + * Synonym for memmove(), but with UChars only. + * @param dest The destination string + * @param src The source string (can be NULL/invalid if count<=0) + * @param count The number of characters to move; no-op if <=0 + * @return A pointer to dest + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_memmove(UChar *dest, const UChar *src, int32_t count); + +/** + * Initialize count characters of dest to c. + * + * @param dest The destination string. + * @param c The character to initialize the string. + * @param count The maximum number of characters to set. + * @return A pointer to dest. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_memset(UChar *dest, UChar c, int32_t count); + +/** + * Compare the first count UChars of each buffer. + * + * @param buf1 The first string to compare. + * @param buf2 The second string to compare. + * @param count The maximum number of UChars to compare. + * @return When buf1 < buf2, a negative number is returned. + * When buf1 == buf2, 0 is returned. + * When buf1 > buf2, a positive number is returned. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); + +/** + * Compare two Unicode strings in code point order. + * This is different in UTF-16 from u_memcmp() if supplementary characters are present. + * For details, see u_strCompare(). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param count The maximum number of characters to compare. + * @return a negative/zero/positive integer corresponding to whether + * the first string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); + +/** + * Find the first occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The BMP code point to find. + * @param count The length of the string. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr + * @see u_memchr32 + * @see u_strFindFirst + */ +U_CAPI UChar* U_EXPORT2 +u_memchr(const UChar *s, UChar c, int32_t count); + +/** + * Find the first occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The code point to find. + * @param count The length of the string. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr32 + * @see u_memchr + * @see u_strFindFirst + */ +U_CAPI UChar* U_EXPORT2 +u_memchr32(const UChar *s, UChar32 c, int32_t count); + +/** + * Find the last occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The BMP code point to find. + * @param count The length of the string. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr + * @see u_memrchr32 + * @see u_strFindLast + */ +U_CAPI UChar* U_EXPORT2 +u_memrchr(const UChar *s, UChar c, int32_t count); + +/** + * Find the last occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The code point to find. + * @param count The length of the string. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr32 + * @see u_memrchr + * @see u_strFindLast + */ +U_CAPI UChar* U_EXPORT2 +u_memrchr32(const UChar *s, UChar32 c, int32_t count); + +/** + * Unicode String literals in C. + * We need one macro to declare a variable for the string + * and to statically preinitialize it if possible, + * and a second macro to dynamically initialize such a string variable if necessary. + * + * The macros are defined for maximum performance. + * They work only for strings that contain "invariant characters", i.e., + * only latin letters, digits, and some punctuation. + * See utypes.h for details. + * + * A pair of macros for a single string must be used with the same + * parameters. + * The string parameter must be a C string literal. + * The length of the string, not including the terminating + * `NUL`, must be specified as a constant. + * The U_STRING_DECL macro should be invoked exactly once for one + * such string variable before it is used. + * + * Usage: + * + * U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11); + * U_STRING_DECL(ustringVar2, "jumps 5%", 8); + * static UBool didInit=false; + * + * int32_t function() { + * if(!didInit) { + * U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11); + * U_STRING_INIT(ustringVar2, "jumps 5%", 8); + * didInit=true; + * } + * return u_strcmp(ustringVar1, ustringVar2); + * } + * + * Note that the macros will NOT consistently work if their argument is another #`define`. + * The following will not work on all platforms, don't use it. + * + * #define GLUCK "Mr. Gluck" + * U_STRING_DECL(var, GLUCK, 9) + * U_STRING_INIT(var, GLUCK, 9) + * + * Instead, use the string literal "Mr. Gluck" as the argument to both macro + * calls. + * + * + * @stable ICU 2.0 + */ +#if defined(U_DECLARE_UTF16) +# define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs) + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) +#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16))) +# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) +#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY +# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) +#else +# define U_STRING_DECL(var, cs, length) static UChar var[(length)+1] + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1) +#endif + +/** + * Unescape a string of characters and write the resulting + * Unicode characters to the destination buffer. The following escape + * sequences are recognized: + * + * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] + * \\Uhhhhhhhh 8 hex digits + * \\xhh 1-2 hex digits + * \\x{h...} 1-8 hex digits + * \\ooo 1-3 octal digits; o in [0-7] + * \\cX control-X; X is masked with 0x1F + * + * as well as the standard ANSI C escapes: + * + * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, + * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, + * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C + * + * Anything else following a backslash is generically escaped. For + * example, "[a\\-z]" returns "[a-z]". + * + * If an escape sequence is ill-formed, this method returns an empty + * string. An example of an ill-formed sequence is "\\u" followed by + * fewer than 4 hex digits. + * + * The above characters are recognized in the compiler's codepage, + * that is, they are coded as 'u', '\\', etc. Characters that are + * not parts of escape sequences are converted using u_charsToUChars(). + * + * This function is similar to UnicodeString::unescape() but not + * identical to it. The latter takes a source UnicodeString, so it + * does escape recognition but no conversion. + * + * @param src a zero-terminated string of invariant characters + * @param dest pointer to buffer to receive converted and unescaped + * text and, if there is room, a zero terminator. May be NULL for + * preflighting, in which case no UChars will be written, but the + * return value will still be valid. On error, an empty string is + * stored here (if possible). + * @param destCapacity the number of UChars that may be written at + * dest. Ignored if dest == NULL. + * @return the length of unescaped string. + * @see u_unescapeAt + * @see UnicodeString#unescape() + * @see UnicodeString#unescapeAt() + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_unescape(const char *src, + UChar *dest, int32_t destCapacity); + +U_CDECL_BEGIN +/** + * Callback function for u_unescapeAt() that returns a character of + * the source text given an offset and a context pointer. The context + * pointer will be whatever is passed into u_unescapeAt(). + * + * @param offset pointer to the offset that will be passed to u_unescapeAt(). + * @param context an opaque pointer passed directly into u_unescapeAt() + * @return the character represented by the escape sequence at + * offset + * @see u_unescapeAt + * @stable ICU 2.0 + */ +typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context); +U_CDECL_END + +/** + * Unescape a single sequence. The character at offset-1 is assumed + * (without checking) to be a backslash. This method takes a callback + * pointer to a function that returns the UChar at a given offset. By + * varying this callback, ICU functions are able to unescape char* + * strings, UnicodeString objects, and UFILE pointers. + * + * If offset is out of range, or if the escape sequence is ill-formed, + * (UChar32)0xFFFFFFFF is returned. See documentation of u_unescape() + * for a list of recognized sequences. + * + * @param charAt callback function that returns a UChar of the source + * text given an offset and a context pointer. + * @param offset pointer to the offset that will be passed to charAt. + * The offset value will be updated upon return to point after the + * last parsed character of the escape sequence. On error the offset + * is unchanged. + * @param length the number of characters in the source text. The + * last character of the source text is considered to be at offset + * length-1. + * @param context an opaque pointer passed directly into charAt. + * @return the character represented by the escape sequence at + * offset, or (UChar32)0xFFFFFFFF on error. + * @see u_unescape() + * @see UnicodeString#unescape() + * @see UnicodeString#unescapeAt() + * @stable ICU 2.0 + */ +U_CAPI UChar32 U_EXPORT2 +u_unescapeAt(UNESCAPE_CHAR_AT charAt, + int32_t *offset, + int32_t length, + void *context); + +/** + * Uppercase the characters in a string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strToUpper(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + const char *locale, + UErrorCode *pErrorCode); + +/** + * Lowercase the characters in a string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strToLower(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + const char *locale, + UErrorCode *pErrorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** + * Titlecase a string. + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * It may be more efficient to always provide an iterator to avoid + * opening and closing one for each string. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param titleIter A break iterator to find the first characters of words + * that are to be titlecased. + * If none is provided (NULL), then a standard titlecase + * break iterator is opened. + * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.1 + */ +U_CAPI int32_t U_EXPORT2 +u_strToTitle(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UBreakIterator *titleIter, + const char *locale, + UErrorCode *pErrorCode); + +#endif + +/** + * Case-folds the characters in a string. + * + * Case-folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strFoldCase(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + uint32_t options, + UErrorCode *pErrorCode); + +#if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION +/** + * Convert a UTF-16 string to a wchar_t string. + * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then + * this function simply calls the fast, dedicated function for that. + * Otherwise, two conversions UTF-16 -> default charset -> wchar_t* are performed. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of wchar_t's). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + */ +U_CAPI wchar_t* U_EXPORT2 +u_strToWCS(wchar_t *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UErrorCode *pErrorCode); +/** + * Convert a wchar_t string to UTF-16. + * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then + * this function simply calls the fast, dedicated function for that. + * Otherwise, two conversions wchar_t* -> default charset -> UTF-16 are performed. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_strFromWCS(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const wchar_t *src, + int32_t srcLength, + UErrorCode *pErrorCode); +#endif /* defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION */ + +/** + * Convert a UTF-16 string to UTF-8. + * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of chars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + * @see u_strToUTF8WithSub + * @see u_strFromUTF8 + */ +U_CAPI char* U_EXPORT2 +u_strToUTF8(char *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-8 string to UTF-16. + * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + * @see u_strFromUTF8WithSub + * @see u_strFromUTF8Lenient + */ +U_CAPI UChar* U_EXPORT2 +u_strFromUTF8(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const char *src, + int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-16 string to UTF-8. + * + * Same as u_strToUTF8() except for the additional subchar which is output for + * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. + * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF8(). + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of chars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strToUTF8 + * @see u_strFromUTF8WithSub + * @stable ICU 3.6 + */ +U_CAPI char* U_EXPORT2 +u_strToUTF8WithSub(char *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-8 string to UTF-16. + * + * Same as u_strFromUTF8() except for the additional subchar which is output for + * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. + * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF8(). + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strFromUTF8 + * @see u_strFromUTF8Lenient + * @see u_strToUTF8WithSub + * @stable ICU 3.6 + */ +U_CAPI UChar* U_EXPORT2 +u_strFromUTF8WithSub(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const char *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-8 string to UTF-16. + * + * Same as u_strFromUTF8() except that this function is designed to be very fast, + * which it achieves by being lenient about malformed UTF-8 sequences. + * This function is intended for use in environments where UTF-8 text is + * expected to be well-formed. + * + * Its semantics are: + * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text. + * - The function will not read beyond the input string, nor write beyond + * the destCapacity. + * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not + * be well-formed UTF-16. + * The function will resynchronize to valid code point boundaries + * within a small number of code points after an illegal sequence. + * - Non-shortest forms are not detected and will result in "spoofing" output. + * + * For further performance improvement, if srcLength is given (>=0), + * then it must be destCapacity>=srcLength. + * + * There is no inverse u_strToUTF8Lenient() function because there is practically + * no performance gain from not checking that a UTF-16 string is well-formed. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * Unlike for other ICU functions, if srcLength>=0 then it + * must be destCapacity>=srcLength. + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * Unlike for other ICU functions, if srcLength>=0 but + * destCapacity=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strToUTF32 + * @see u_strFromUTF32WithSub + * @stable ICU 4.2 + */ +U_CAPI UChar32* U_EXPORT2 +u_strToUTF32WithSub(UChar32 *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-32 string to UTF-16. + * + * Same as u_strFromUTF32() except for the additional subchar which is output for + * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. + * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF32(). + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strFromUTF32 + * @see u_strToUTF32WithSub + * @stable ICU 4.2 + */ +U_CAPI UChar* U_EXPORT2 +u_strFromUTF32WithSub(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar32 *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a 16-bit Unicode string to Java Modified UTF-8. + * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8 + * + * This function behaves according to the documentation for Java DataOutput.writeUTF() + * except that it does not encode the output length in the destination buffer + * and does not have an output length restriction. + * See http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html#writeUTF(java.lang.String) + * + * The input string need not be well-formed UTF-16. + * (Therefore there is no subchar parameter.) + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of chars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @stable ICU 4.4 + * @see u_strToUTF8WithSub + * @see u_strFromJavaModifiedUTF8WithSub + */ +U_CAPI char* U_EXPORT2 +u_strToJavaModifiedUTF8( + char *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a Java Modified UTF-8 string to a 16-bit Unicode string. + * If the input string is not well-formed and no substitution char is specified, + * then the U_INVALID_CHAR_FOUND error code is set. + * + * This function behaves according to the documentation for Java DataInput.readUTF() + * except that it takes a length parameter rather than + * interpreting the first two input bytes as the length. + * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#readUTF() + * + * The output string may not be well-formed UTF-16. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strFromUTF8WithSub + * @see u_strFromUTF8Lenient + * @see u_strToJavaModifiedUTF8 + * @stable ICU 4.4 + */ +U_CAPI UChar* U_EXPORT2 +u_strFromJavaModifiedUTF8WithSub( + UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const char *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ustringtrie.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ustringtrie.h new file mode 100644 index 0000000000000000000000000000000000000000..fd85648225408c804cb3384bf871c44af7b8306a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/ustringtrie.h @@ -0,0 +1,97 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: udicttrie.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010dec17 +* created by: Markus W. Scherer +*/ + +#ifndef __USTRINGTRIE_H__ +#define __USTRINGTRIE_H__ + +/** + * \file + * \brief C API: Helper definitions for dictionary trie APIs. + */ + +#include "unicode/utypes.h" + + +/** + * Return values for BytesTrie::next(), UCharsTrie::next() and similar methods. + * @see USTRINGTRIE_MATCHES + * @see USTRINGTRIE_HAS_VALUE + * @see USTRINGTRIE_HAS_NEXT + * @stable ICU 4.8 + */ +enum UStringTrieResult { + /** + * The input unit(s) did not continue a matching string. + * Once current()/next() return USTRINGTRIE_NO_MATCH, + * all further calls to current()/next() will also return USTRINGTRIE_NO_MATCH, + * until the trie is reset to its original state or to a saved state. + * @stable ICU 4.8 + */ + USTRINGTRIE_NO_MATCH, + /** + * The input unit(s) continued a matching string + * but there is no value for the string so far. + * (It is a prefix of a longer string.) + * @stable ICU 4.8 + */ + USTRINGTRIE_NO_VALUE, + /** + * The input unit(s) continued a matching string + * and there is a value for the string so far. + * This value will be returned by getValue(). + * No further input byte/unit can continue a matching string. + * @stable ICU 4.8 + */ + USTRINGTRIE_FINAL_VALUE, + /** + * The input unit(s) continued a matching string + * and there is a value for the string so far. + * This value will be returned by getValue(). + * Another input byte/unit can continue a matching string. + * @stable ICU 4.8 + */ + USTRINGTRIE_INTERMEDIATE_VALUE +}; + +/** + * Same as (result!=USTRINGTRIE_NO_MATCH). + * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. + * @return true if the input bytes/units so far are part of a matching string/byte sequence. + * @stable ICU 4.8 + */ +#define USTRINGTRIE_MATCHES(result) ((result)!=USTRINGTRIE_NO_MATCH) + +/** + * Equivalent to (result==USTRINGTRIE_INTERMEDIATE_VALUE || result==USTRINGTRIE_FINAL_VALUE) but + * this macro evaluates result exactly once. + * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. + * @return true if there is a value for the input bytes/units so far. + * @see BytesTrie::getValue + * @see UCharsTrie::getValue + * @stable ICU 4.8 + */ +#define USTRINGTRIE_HAS_VALUE(result) ((result)>=USTRINGTRIE_FINAL_VALUE) + +/** + * Equivalent to (result==USTRINGTRIE_NO_VALUE || result==USTRINGTRIE_INTERMEDIATE_VALUE) but + * this macro evaluates result exactly once. + * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. + * @return true if another input byte/unit can continue a matching string. + * @stable ICU 4.8 + */ +#define USTRINGTRIE_HAS_NEXT(result) ((result)&1) + +#endif /* __USTRINGTRIE_H__ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utext.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utext.h new file mode 100644 index 0000000000000000000000000000000000000000..c6d1e53a8cef1097925f484370aeab427a1ff7b9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utext.h @@ -0,0 +1,1603 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2004-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: utext.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2004oct06 +* created by: Markus W. Scherer +*/ + +#ifndef __UTEXT_H__ +#define __UTEXT_H__ + +/** + * \file + * \brief C API: Abstract Unicode Text API + * + * The Text Access API provides a means to allow text that is stored in alternative + * formats to work with ICU services. ICU normally operates on text that is + * stored in UTF-16 format, in (UChar *) arrays for the C APIs or as type + * UnicodeString for C++ APIs. + * + * ICU Text Access allows other formats, such as UTF-8 or non-contiguous + * UTF-16 strings, to be placed in a UText wrapper and then passed to ICU services. + * + * There are three general classes of usage for UText: + * + * Application Level Use. This is the simplest usage - applications would + * use one of the utext_open() functions on their input text, and pass + * the resulting UText to the desired ICU service. + * + * Second is usage in ICU Services, such as break iteration, that will need to + * operate on input presented to them as a UText. These implementations + * will need to use the iteration and related UText functions to gain + * access to the actual text. + * + * The third class of UText users are "text providers." These are the + * UText implementations for the various text storage formats. An application + * or system with a unique text storage format can implement a set of + * UText provider functions for that format, which will then allow + * ICU services to operate on that format. + * + * + * Iterating over text + * + * Here is sample code for a forward iteration over the contents of a UText + * + * \code + * UChar32 c; + * UText *ut = whatever(); + * + * for (c=utext_next32From(ut, 0); c>=0; c=utext_next32(ut)) { + * // do whatever with the codepoint c here. + * } + * \endcode + * + * And here is similar code to iterate in the reverse direction, from the end + * of the text towards the beginning. + * + * \code + * UChar32 c; + * UText *ut = whatever(); + * int textLength = utext_nativeLength(ut); + * for (c=utext_previous32From(ut, textLength); c>=0; c=utext_previous32(ut)) { + * // do whatever with the codepoint c here. + * } + * \endcode + * + * Characters and Indexing + * + * Indexing into text by UText functions is nearly always in terms of the native + * indexing of the underlying text storage. The storage format could be UTF-8 + * or UTF-32, for example. When coding to the UText access API, no assumptions + * can be made regarding the size of characters, or how far an index + * may move when iterating between characters. + * + * All indices supplied to UText functions are pinned to the length of the + * text. An out-of-bounds index is not considered to be an error, but is + * adjusted to be in the range 0 <= index <= length of input text. + * + * + * When an index position is returned from a UText function, it will be + * a native index to the underlying text. In the case of multi-unit characters, + * it will always refer to the first position of the character, + * never to the interior. This is essentially the same thing as saying that + * a returned index will always point to a boundary between characters. + * + * When a native index is supplied to a UText function, all indices that + * refer to any part of a multi-unit character representation are considered + * to be equivalent. In the case of multi-unit characters, an incoming index + * will be logically normalized to refer to the start of the character. + * + * It is possible to test whether a native index is on a code point boundary + * by doing a utext_setNativeIndex() followed by a utext_getNativeIndex(). + * If the index is returned unchanged, it was on a code point boundary. If + * an adjusted index is returned, the original index referred to the + * interior of a character. + * + * Conventions for calling UText functions + * + * Most UText access functions have as their first parameter a (UText *) pointer, + * which specifies the UText to be used. Unless otherwise noted, the + * pointer must refer to a valid, open UText. Attempting to + * use a closed UText or passing a NULL pointer is a programming error and + * will produce undefined results or NULL pointer exceptions. + * + * The UText_Open family of functions can either open an existing (closed) + * UText, or heap allocate a new UText. Here is sample code for creating + * a stack-allocated UText. + * + * \code + * char *s = whatever(); // A utf-8 string + * U_ErrorCode status = U_ZERO_ERROR; + * UText ut = UTEXT_INITIALIZER; + * utext_openUTF8(ut, s, -1, &status); + * if (U_FAILURE(status)) { + * // error handling + * } else { + * // work with the UText + * } + * \endcode + * + * Any existing UText passed to an open function _must_ have been initialized, + * either by the UTEXT_INITIALIZER, or by having been originally heap-allocated + * by an open function. Passing NULL will cause the open function to + * heap-allocate and fully initialize a new UText. + * + */ + + + +#include "unicode/utypes.h" +#include "unicode/uchar.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#include "unicode/rep.h" +#include "unicode/unistr.h" +#include "unicode/chariter.h" +#endif + + +U_CDECL_BEGIN + +struct UText; +typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */ + + +/*************************************************************************************** + * + * C Functions for creating UText wrappers around various kinds of text strings. + * + ****************************************************************************************/ + + +/** + * Close function for UText instances. + * Cleans up, releases any resources being held by an open UText. + *

+ * If the UText was originally allocated by one of the utext_open functions, + * the storage associated with the utext will also be freed. + * If the UText storage originated with the application, as it would with + * a local or static instance, the storage will not be deleted. + * + * An open UText can be reset to refer to new string by using one of the utext_open() + * functions without first closing the UText. + * + * @param ut The UText to be closed. + * @return NULL if the UText struct was deleted by the close. If the UText struct + * was originally provided by the caller to the open function, it is + * returned by this function, and may be safely used again in + * a subsequent utext_open. + * + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_close(UText *ut); + +/** + * Open a read-only UText implementation for UTF-8 strings. + * + * \htmlonly + * Any invalid UTF-8 in the input will be handled in this way: + * a sequence of bytes that has the form of a truncated, but otherwise valid, + * UTF-8 sequence will be replaced by a single unicode replacement character, \uFFFD. + * Any other illegal bytes will each be replaced by a \uFFFD. + * \endhtmlonly + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified UTF-8 string. + * @param s A UTF-8 string. Must not be NULL. + * @param length The length of the UTF-8 string in bytes, or -1 if the string is + * zero terminated. + * @param status Errors are returned here. + * @return A pointer to the UText. If a pre-allocated UText was provided, it + * will always be used and returned. + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); + + +/** + * Open a read-only UText for UChar * string. + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified UChar string. + * @param s A UChar (UTF-16) string + * @param length The number of UChars in the input string, or -1 if the string is + * zero terminated. + * @param status Errors are returned here. + * @return A pointer to the UText. If a pre-allocated UText was provided, it + * will always be used and returned. + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); + + +#if U_SHOW_CPLUSPLUS_API +/** + * Open a writable UText for a non-const UnicodeString. + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified input string. + * @param s A UnicodeString. + * @param status Errors are returned here. + * @return Pointer to the UText. If a UText was supplied as input, this + * will always be used and returned. + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status); + + +/** + * Open a UText for a const UnicodeString. The resulting UText will not be writable. + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified input string. + * @param s A const UnicodeString to be wrapped. + * @param status Errors are returned here. + * @return Pointer to the UText. If a UText was supplied as input, this + * will always be used and returned. + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode *status); + + +/** + * Open a writable UText implementation for an ICU Replaceable object. + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an already existing UText, which will then + * be reset to reference the specified replaceable text. + * @param rep A Replaceable text object. + * @param status Errors are returned here. + * @return Pointer to the UText. If a UText was supplied as input, this + * will always be used and returned. + * @see Replaceable + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status); + +/** + * Open a UText implementation over an ICU CharacterIterator. + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an already existing UText, which will then + * be reset to reference the specified replaceable text. + * @param ci A Character Iterator. + * @param status Errors are returned here. + * @return Pointer to the UText. If a UText was supplied as input, this + * will always be used and returned. + * @see Replaceable + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *status); + +#endif + + +/** + * Clone a UText. This is much like opening a UText where the source text is itself + * another UText. + * + * A deep clone will copy both the UText data structures and the underlying text. + * The original and cloned UText will operate completely independently; modifications + * made to the text in one will not affect the other. Text providers are not + * required to support deep clones. The user of clone() must check the status return + * and be prepared to handle failures. + * + * The standard UText implementations for UTF8, UChar *, UnicodeString and + * Replaceable all support deep cloning. + * + * The UText returned from a deep clone will be writable, assuming that the text + * provider is able to support writing, even if the source UText had been made + * non-writable by means of UText_freeze(). + * + * A shallow clone replicates only the UText data structures; it does not make + * a copy of the underlying text. Shallow clones can be used as an efficient way to + * have multiple iterators active in a single text string that is not being + * modified. + * + * A shallow clone operation will not fail, barring truly exceptional conditions such + * as memory allocation failures. + * + * Shallow UText clones should be avoided if the UText functions that modify the + * text are expected to be used, either on the original or the cloned UText. + * Any such modifications can cause unpredictable behavior. Read Only + * shallow clones provide some protection against errors of this type by + * disabling text modification via the cloned UText. + * + * A shallow clone made with the readOnly parameter == false will preserve the + * utext_isWritable() state of the source object. Note, however, that + * write operations must be avoided while more than one UText exists that refer + * to the same underlying text. + * + * A UText and its clone may be safely concurrently accessed by separate threads. + * This is true for read access only with shallow clones, and for both read and + * write access with deep clones. + * It is the responsibility of the Text Provider to ensure that this thread safety + * constraint is met. + * + * @param dest A UText struct to be filled in with the result of the clone operation, + * or NULL if the clone function should heap-allocate a new UText struct. + * If non-NULL, must refer to an already existing UText, which will then + * be reset to become the clone. + * @param src The UText to be cloned. + * @param deep true to request a deep clone, false for a shallow clone. + * @param readOnly true to request that the cloned UText have read only access to the + * underlying text. + + * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR + * will be returned if the text provider is unable to clone the + * original text. + * @return The newly created clone, or NULL if the clone operation failed. + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status); + + +/** + * Compare two UText objects for equality. + * UTexts are equal if they are iterating over the same text, and + * have the same iteration position within the text. + * If either or both of the parameters are NULL, the comparison is false. + * + * @param a The first of the two UTexts to compare. + * @param b The other UText to be compared. + * @return true if the two UTexts are equal. + * @stable ICU 3.6 + */ +U_CAPI UBool U_EXPORT2 +utext_equals(const UText *a, const UText *b); + + +/***************************************************************************** + * + * Functions to work with the text represented by a UText wrapper + * + *****************************************************************************/ + +/** + * Get the length of the text. Depending on the characteristics + * of the underlying text representation, this may be expensive. + * @see utext_isLengthExpensive() + * + * + * @param ut the text to be accessed. + * @return the length of the text, expressed in native units. + * + * @stable ICU 3.4 + */ +U_CAPI int64_t U_EXPORT2 +utext_nativeLength(UText *ut); + +/** + * Return true if calculating the length of the text could be expensive. + * Finding the length of NUL terminated strings is considered to be expensive. + * + * Note that the value of this function may change + * as the result of other operations on a UText. + * Once the length of a string has been discovered, it will no longer + * be expensive to report it. + * + * @param ut the text to be accessed. + * @return true if determining the length of the text could be time consuming. + * @stable ICU 3.4 + */ +U_CAPI UBool U_EXPORT2 +utext_isLengthExpensive(const UText *ut); + +/** + * Returns the code point at the requested index, + * or U_SENTINEL (-1) if it is out of bounds. + * + * If the specified index points to the interior of a multi-unit + * character - one of the trail bytes of a UTF-8 sequence, for example - + * the complete code point will be returned. + * + * The iteration position will be set to the start of the returned code point. + * + * This function is roughly equivalent to the sequence + * utext_setNativeIndex(index); + * utext_current32(); + * (There is a subtle difference if the index is out of bounds by being less than zero - + * utext_setNativeIndex(negative value) sets the index to zero, after which utext_current() + * will return the char at zero. utext_char32At(negative index), on the other hand, will + * return the U_SENTINEL value of -1.) + * + * @param ut the text to be accessed + * @param nativeIndex the native index of the character to be accessed. If the index points + * to other than the first unit of a multi-unit character, it will be adjusted + * to the start of the character. + * @return the code point at the specified index. + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_char32At(UText *ut, int64_t nativeIndex); + + +/** + * + * Get the code point at the current iteration position, + * or U_SENTINEL (-1) if the iteration has reached the end of + * the input text. + * + * @param ut the text to be accessed. + * @return the Unicode code point at the current iterator position. + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_current32(UText *ut); + + +/** + * Get the code point at the current iteration position of the UText, and + * advance the position to the first index following the character. + * + * If the position is at the end of the text (the index following + * the last character, which is also the length of the text), + * return U_SENTINEL (-1) and do not advance the index. + * + * This is a post-increment operation. + * + * An inline macro version of this function, UTEXT_NEXT32(), + * is available for performance critical use. + * + * @param ut the text to be accessed. + * @return the Unicode code point at the iteration position. + * @see UTEXT_NEXT32 + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_next32(UText *ut); + + +/** + * Move the iterator position to the character (code point) whose + * index precedes the current position, and return that character. + * This is a pre-decrement operation. + * + * If the initial position is at the start of the text (index of 0) + * return U_SENTINEL (-1), and leave the position unchanged. + * + * An inline macro version of this function, UTEXT_PREVIOUS32(), + * is available for performance critical use. + * + * @param ut the text to be accessed. + * @return the previous UChar32 code point, or U_SENTINEL (-1) + * if the iteration has reached the start of the text. + * @see UTEXT_PREVIOUS32 + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_previous32(UText *ut); + + +/** + * Set the iteration index and return the code point at that index. + * Leave the iteration index at the start of the following code point. + * + * This function is the most efficient and convenient way to + * begin a forward iteration. The results are identical to the those + * from the sequence + * \code + * utext_setIndex(); + * utext_next32(); + * \endcode + * + * @param ut the text to be accessed. + * @param nativeIndex Iteration index, in the native units of the text provider. + * @return Code point which starts at or before index, + * or U_SENTINEL (-1) if it is out of bounds. + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_next32From(UText *ut, int64_t nativeIndex); + + + +/** + * Set the iteration index, and return the code point preceding the + * one specified by the initial index. Leave the iteration position + * at the start of the returned code point. + * + * This function is the most efficient and convenient way to + * begin a backwards iteration. + * + * @param ut the text to be accessed. + * @param nativeIndex Iteration index in the native units of the text provider. + * @return Code point preceding the one at the initial index, + * or U_SENTINEL (-1) if it is out of bounds. + * + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_previous32From(UText *ut, int64_t nativeIndex); + +/** + * Get the current iterator position, which can range from 0 to + * the length of the text. + * The position is a native index into the input text, in whatever format it + * may have (possibly UTF-8 for example), and may not always be the same as + * the corresponding UChar (UTF-16) index. + * The returned position will always be aligned to a code point boundary. + * + * @param ut the text to be accessed. + * @return the current index position, in the native units of the text provider. + * @stable ICU 3.4 + */ +U_CAPI int64_t U_EXPORT2 +utext_getNativeIndex(const UText *ut); + +/** + * Set the current iteration position to the nearest code point + * boundary at or preceding the specified index. + * The index is in the native units of the original input text. + * If the index is out of range, it will be pinned to be within + * the range of the input text. + *

+ * It will usually be more efficient to begin an iteration + * using the functions utext_next32From() or utext_previous32From() + * rather than setIndex(). + *

+ * Moving the index position to an adjacent character is best done + * with utext_next32(), utext_previous32() or utext_moveIndex32(). + * Attempting to do direct arithmetic on the index position is + * complicated by the fact that the size (in native units) of a + * character depends on the underlying representation of the character + * (UTF-8, UTF-16, UTF-32, arbitrary codepage), and is not + * easily knowable. + * + * @param ut the text to be accessed. + * @param nativeIndex the native unit index of the new iteration position. + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +utext_setNativeIndex(UText *ut, int64_t nativeIndex); + +/** + * Move the iterator position by delta code points. The number of code points + * is a signed number; a negative delta will move the iterator backwards, + * towards the start of the text. + *

+ * The index is moved by delta code points + * forward or backward, but no further backward than to 0 and + * no further forward than to utext_nativeLength(). + * The resulting index value will be in between 0 and length, inclusive. + * + * @param ut the text to be accessed. + * @param delta the signed number of code points to move the iteration position. + * @return true if the position could be moved the requested number of positions while + * staying within the range [0 - text length]. + * @stable ICU 3.4 + */ +U_CAPI UBool U_EXPORT2 +utext_moveIndex32(UText *ut, int32_t delta); + +/** + * Get the native index of the character preceding the current position. + * If the iteration position is already at the start of the text, zero + * is returned. + * The value returned is the same as that obtained from the following sequence, + * but without the side effect of changing the iteration position. + * + * \code + * UText *ut = whatever; + * ... + * utext_previous(ut) + * utext_getNativeIndex(ut); + * \endcode + * + * This function is most useful during forwards iteration, where it will get the + * native index of the character most recently returned from utext_next(). + * + * @param ut the text to be accessed + * @return the native index of the character preceding the current index position, + * or zero if the current position is at the start of the text. + * @stable ICU 3.6 + */ +U_CAPI int64_t U_EXPORT2 +utext_getPreviousNativeIndex(UText *ut); + + +/** + * + * Extract text from a UText into a UChar buffer. The range of text to be extracted + * is specified in the native indices of the UText provider. These may not necessarily + * be UTF-16 indices. + *

+ * The size (number of 16 bit UChars) of the data to be extracted is returned. The + * full number of UChars is returned, even when the extracted text is truncated + * because the specified buffer size is too small. + *

+ * The extracted string will (if you are a user) / must (if you are a text provider) + * be NUL-terminated if there is sufficient space in the destination buffer. This + * terminating NUL is not included in the returned length. + *

+ * The iteration index is left at the position following the last extracted character. + * + * @param ut the UText from which to extract data. + * @param nativeStart the native index of the first character to extract.\ + * If the specified index is out of range, + * it will be pinned to be within 0 <= index <= textLength + * @param nativeLimit the native string index of the position following the last + * character to extract. If the specified index is out of range, + * it will be pinned to be within 0 <= index <= textLength. + * nativeLimit must be >= nativeStart. + * @param dest the UChar (UTF-16) buffer into which the extracted text is placed + * @param destCapacity The size, in UChars, of the destination buffer. May be zero + * for precomputing the required size. + * @param status receives any error status. + * U_BUFFER_OVERFLOW_ERROR: the extracted text was truncated because the + * buffer was too small. Returns number of UChars for preflighting. + * @return Number of UChars in the data to be extracted. Does not include a trailing NUL. + * + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +utext_extract(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + UChar *dest, int32_t destCapacity, + UErrorCode *status); + + + +/************************************************************************************ + * + * #define inline versions of selected performance-critical text access functions + * Caution: do not use auto increment++ or decrement-- expressions + * as parameters to these macros. + * + * For most use, where there is no extreme performance constraint, the + * normal, non-inline functions are a better choice. The resulting code + * will be smaller, and, if the need ever arises, easier to debug. + * + * These are implemented as #defines rather than real functions + * because there is no fully portable way to do inline functions in plain C. + * + ************************************************************************************/ + +#ifndef U_HIDE_INTERNAL_API +/** + * inline version of utext_current32(), for performance-critical situations. + * + * Get the code point at the current iteration position of the UText. + * Returns U_SENTINEL (-1) if the position is at the end of the + * text. + * + * @internal ICU 4.4 technology preview + */ +#define UTEXT_CURRENT32(ut) \ + ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ + ((ut)->chunkContents)[((ut)->chunkOffset)] : utext_current32(ut)) +#endif /* U_HIDE_INTERNAL_API */ + +/** + * inline version of utext_next32(), for performance-critical situations. + * + * Get the code point at the current iteration position of the UText, and + * advance the position to the first index following the character. + * This is a post-increment operation. + * Returns U_SENTINEL (-1) if the position is at the end of the + * text. + * + * @stable ICU 3.4 + */ +#define UTEXT_NEXT32(ut) \ + ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ + ((ut)->chunkContents)[((ut)->chunkOffset)++] : utext_next32(ut)) + +/** + * inline version of utext_previous32(), for performance-critical situations. + * + * Move the iterator position to the character (code point) whose + * index precedes the current position, and return that character. + * This is a pre-decrement operation. + * Returns U_SENTINEL (-1) if the position is at the start of the text. + * + * @stable ICU 3.4 + */ +#define UTEXT_PREVIOUS32(ut) \ + ((ut)->chunkOffset > 0 && \ + (ut)->chunkContents[(ut)->chunkOffset-1] < 0xd800 ? \ + (ut)->chunkContents[--((ut)->chunkOffset)] : utext_previous32(ut)) + +/** + * inline version of utext_getNativeIndex(), for performance-critical situations. + * + * Get the current iterator position, which can range from 0 to + * the length of the text. + * The position is a native index into the input text, in whatever format it + * may have (possibly UTF-8 for example), and may not always be the same as + * the corresponding UChar (UTF-16) index. + * The returned position will always be aligned to a code point boundary. + * + * @stable ICU 3.6 + */ +#define UTEXT_GETNATIVEINDEX(ut) \ + ((ut)->chunkOffset <= (ut)->nativeIndexingLimit? \ + (ut)->chunkNativeStart+(ut)->chunkOffset : \ + (ut)->pFuncs->mapOffsetToNative(ut)) + +/** + * inline version of utext_setNativeIndex(), for performance-critical situations. + * + * Set the current iteration position to the nearest code point + * boundary at or preceding the specified index. + * The index is in the native units of the original input text. + * If the index is out of range, it will be pinned to be within + * the range of the input text. + * + * @stable ICU 3.8 + */ +#define UTEXT_SETNATIVEINDEX(ut, ix) UPRV_BLOCK_MACRO_BEGIN { \ + int64_t __offset = (ix) - (ut)->chunkNativeStart; \ + if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \ + (ut)->chunkOffset=(int32_t)__offset; \ + } else { \ + utext_setNativeIndex((ut), (ix)); \ + } \ +} UPRV_BLOCK_MACRO_END + + + +/************************************************************************************ + * + * Functions related to writing or modifying the text. + * These will work only with modifiable UTexts. Attempting to + * modify a read-only UText will return an error status. + * + ************************************************************************************/ + + +/** + * Return true if the text can be written (modified) with utext_replace() or + * utext_copy(). For the text to be writable, the text provider must + * be of a type that supports writing and the UText must not be frozen. + * + * Attempting to modify text when utext_isWriteable() is false will fail - + * the text will not be modified, and an error will be returned from the function + * that attempted the modification. + * + * @param ut the UText to be tested. + * @return true if the text is modifiable. + * + * @see utext_freeze() + * @see utext_replace() + * @see utext_copy() + * @stable ICU 3.4 + * + */ +U_CAPI UBool U_EXPORT2 +utext_isWritable(const UText *ut); + + +/** + * Test whether there is meta data associated with the text. + * @see Replaceable::hasMetaData() + * + * @param ut The UText to be tested + * @return true if the underlying text includes meta data. + * @stable ICU 3.4 + */ +U_CAPI UBool U_EXPORT2 +utext_hasMetaData(const UText *ut); + + +/** + * Replace a range of the original text with a replacement text. + * + * Leaves the current iteration position at the position following the + * newly inserted replacement text. + * + * This function is only available on UText types that support writing, + * that is, ones where utext_isWritable() returns true. + * + * When using this function, there should be only a single UText opened onto the + * underlying native text string. Behavior after a replace operation + * on a UText is undefined for any other additional UTexts that refer to the + * modified string. + * + * @param ut the UText representing the text to be operated on. + * @param nativeStart the native index of the start of the region to be replaced + * @param nativeLimit the native index of the character following the region to be replaced. + * @param replacementText pointer to the replacement text + * @param replacementLength length of the replacement text, or -1 if the text is NUL terminated. + * @param status receives any error status. Possible errors include + * U_NO_WRITE_PERMISSION + * + * @return The signed number of (native) storage units by which + * the length of the text expanded or contracted. + * + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +utext_replace(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + const UChar *replacementText, int32_t replacementLength, + UErrorCode *status); + + + +/** + * + * Copy or move a substring from one position to another within the text, + * while retaining any metadata associated with the text. + * This function is used to duplicate or reorder substrings. + * The destination index must not overlap the source range. + * + * The text to be copied or moved is inserted at destIndex; + * it does not replace or overwrite any existing text. + * + * The iteration position is left following the newly inserted text + * at the destination position. + * + * This function is only available on UText types that support writing, + * that is, ones where utext_isWritable() returns true. + * + * When using this function, there should be only a single UText opened onto the + * underlying native text string. Behavior after a copy operation + * on a UText is undefined in any other additional UTexts that refer to the + * modified string. + * + * @param ut The UText representing the text to be operated on. + * @param nativeStart The native index of the start of the region to be copied or moved + * @param nativeLimit The native index of the character position following the region + * to be copied. + * @param destIndex The native destination index to which the source substring is + * copied or moved. + * @param move If true, then the substring is moved, not copied/duplicated. + * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION + * + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +utext_copy(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + int64_t destIndex, + UBool move, + UErrorCode *status); + + +/** + *

+ * Freeze a UText. This prevents any modification to the underlying text itself + * by means of functions operating on this UText. + *

+ *

+ * Once frozen, a UText can not be unfrozen. The intent is to ensure + * that a the text underlying a frozen UText wrapper cannot be modified via that UText. + *

+ *

+ * Caution: freezing a UText will disable changes made via the specific + * frozen UText wrapper only; it will not have any effect on the ability to + * directly modify the text by bypassing the UText. Any such backdoor modifications + * are always an error while UText access is occurring because the underlying + * text can get out of sync with UText's buffering. + *

+ * + * @param ut The UText to be frozen. + * @see utext_isWritable() + * @stable ICU 3.6 + */ +U_CAPI void U_EXPORT2 +utext_freeze(UText *ut); + + +/** + * UText provider properties (bit field indexes). + * + * @see UText + * @stable ICU 3.4 + */ +enum { + /** + * It is potentially time consuming for the provider to determine the length of the text. + * @stable ICU 3.4 + */ + UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE = 1, + /** + * Text chunks remain valid and usable until the text object is modified or + * deleted, not just until the next time the access() function is called + * (which is the default). + * @stable ICU 3.4 + */ + UTEXT_PROVIDER_STABLE_CHUNKS = 2, + /** + * The provider supports modifying the text via the replace() and copy() + * functions. + * @see Replaceable + * @stable ICU 3.4 + */ + UTEXT_PROVIDER_WRITABLE = 3, + /** + * There is meta data associated with the text. + * @see Replaceable::hasMetaData() + * @stable ICU 3.4 + */ + UTEXT_PROVIDER_HAS_META_DATA = 4, + /** + * Text provider owns the text storage. + * Generally occurs as the result of a deep clone of the UText. + * When closing the UText, the associated text must + * also be closed/deleted/freed/ whatever is appropriate. + * @stable ICU 3.6 + */ + UTEXT_PROVIDER_OWNS_TEXT = 5 +}; + +/** + * Function type declaration for UText.clone(). + * + * clone a UText. Much like opening a UText where the source text is itself + * another UText. + * + * A deep clone will copy both the UText data structures and the underlying text. + * The original and cloned UText will operate completely independently; modifications + * made to the text in one will not effect the other. Text providers are not + * required to support deep clones. The user of clone() must check the status return + * and be prepared to handle failures. + * + * A shallow clone replicates only the UText data structures; it does not make + * a copy of the underlying text. Shallow clones can be used as an efficient way to + * have multiple iterators active in a single text string that is not being + * modified. + * + * A shallow clone operation must not fail except for truly exceptional conditions such + * as memory allocation failures. + * + * A UText and its clone may be safely concurrently accessed by separate threads. + * This is true for both shallow and deep clones. + * It is the responsibility of the Text Provider to ensure that this thread safety + * constraint is met. + + * + * @param dest A UText struct to be filled in with the result of the clone operation, + * or NULL if the clone function should heap-allocate a new UText struct. + * @param src The UText to be cloned. + * @param deep true to request a deep clone, false for a shallow clone. + * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR + * should be returned if the text provider is unable to clone the + * original text. + * @return The newly created clone, or NULL if the clone operation failed. + * + * @stable ICU 3.4 + */ +typedef UText * U_CALLCONV +UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status); + + +/** + * Function type declaration for UText.nativeLength(). + * + * @param ut the UText to get the length of. + * @return the length, in the native units of the original text string. + * @see UText + * @stable ICU 3.4 + */ +typedef int64_t U_CALLCONV +UTextNativeLength(UText *ut); + +/** + * Function type declaration for UText.access(). Get the description of the text chunk + * containing the text at a requested native index. The UText's iteration + * position will be left at the requested index. If the index is out + * of bounds, the iteration position will be left at the start or end + * of the string, as appropriate. + * + * Chunks must begin and end on code point boundaries. A single code point + * comprised of multiple storage units must never span a chunk boundary. + * + * + * @param ut the UText being accessed. + * @param nativeIndex Requested index of the text to be accessed. + * @param forward If true, then the returned chunk must contain text + * starting from the index, so that start<=index + * The size (number of 16 bit UChars) in the data to be extracted is returned. The + * full amount is returned, even when the specified buffer size is smaller. + *

+ * The extracted string will (if you are a user) / must (if you are a text provider) + * be NUL-terminated if there is sufficient space in the destination buffer. + * + * @param ut the UText from which to extract data. + * @param nativeStart the native index of the first character to extract. + * @param nativeLimit the native string index of the position following the last + * character to extract. + * @param dest the UChar (UTF-16) buffer into which the extracted text is placed + * @param destCapacity The size, in UChars, of the destination buffer. May be zero + * for precomputing the required size. + * @param status receives any error status. + * If U_BUFFER_OVERFLOW_ERROR: Returns number of UChars for + * preflighting. + * @return Number of UChars in the data. Does not include a trailing NUL. + * + * @stable ICU 3.4 + */ +typedef int32_t U_CALLCONV +UTextExtract(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + UChar *dest, int32_t destCapacity, + UErrorCode *status); + +/** + * Function type declaration for UText.replace(). + * + * Replace a range of the original text with a replacement text. + * + * Leaves the current iteration position at the position following the + * newly inserted replacement text. + * + * This function need only be implemented on UText types that support writing. + * + * When using this function, there should be only a single UText opened onto the + * underlying native text string. The function is responsible for updating the + * text chunk within the UText to reflect the updated iteration position, + * taking into account any changes to the underlying string's structure caused + * by the replace operation. + * + * @param ut the UText representing the text to be operated on. + * @param nativeStart the index of the start of the region to be replaced + * @param nativeLimit the index of the character following the region to be replaced. + * @param replacementText pointer to the replacement text + * @param replacmentLength length of the replacement text in UChars, or -1 if the text is NUL terminated. + * @param status receives any error status. Possible errors include + * U_NO_WRITE_PERMISSION + * + * @return The signed number of (native) storage units by which + * the length of the text expanded or contracted. + * + * @stable ICU 3.4 + */ +typedef int32_t U_CALLCONV +UTextReplace(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + const UChar *replacementText, int32_t replacmentLength, + UErrorCode *status); + +/** + * Function type declaration for UText.copy(). + * + * Copy or move a substring from one position to another within the text, + * while retaining any metadata associated with the text. + * This function is used to duplicate or reorder substrings. + * The destination index must not overlap the source range. + * + * The text to be copied or moved is inserted at destIndex; + * it does not replace or overwrite any existing text. + * + * This function need only be implemented for UText types that support writing. + * + * When using this function, there should be only a single UText opened onto the + * underlying native text string. The function is responsible for updating the + * text chunk within the UText to reflect the updated iteration position, + * taking into account any changes to the underlying string's structure caused + * by the replace operation. + * + * @param ut The UText representing the text to be operated on. + * @param nativeStart The index of the start of the region to be copied or moved + * @param nativeLimit The index of the character following the region to be replaced. + * @param nativeDest The destination index to which the source substring is copied or moved. + * @param move If true, then the substring is moved, not copied/duplicated. + * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION + * + * @stable ICU 3.4 + */ +typedef void U_CALLCONV +UTextCopy(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + int64_t nativeDest, + UBool move, + UErrorCode *status); + +/** + * Function type declaration for UText.mapOffsetToNative(). + * Map from the current UChar offset within the current text chunk to + * the corresponding native index in the original source text. + * + * This is required only for text providers that do not use native UTF-16 indexes. + * + * @param ut the UText. + * @return Absolute (native) index corresponding to chunkOffset in the current chunk. + * The returned native index should always be to a code point boundary. + * + * @stable ICU 3.4 + */ +typedef int64_t U_CALLCONV +UTextMapOffsetToNative(const UText *ut); + +/** + * Function type declaration for UText.mapIndexToUTF16(). + * Map from a native index to a UChar offset within a text chunk. + * Behavior is undefined if the native index does not fall within the + * current chunk. + * + * This function is required only for text providers that do not use native UTF-16 indexes. + * + * @param ut The UText containing the text chunk. + * @param nativeIndex Absolute (native) text index, chunk->start<=index<=chunk->limit. + * @return Chunk-relative UTF-16 offset corresponding to the specified native + * index. + * + * @stable ICU 3.4 + */ +typedef int32_t U_CALLCONV +UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex); + + +/** + * Function type declaration for UText.utextClose(). + * + * A Text Provider close function is only required for provider types that make + * allocations in their open function (or other functions) that must be + * cleaned when the UText is closed. + * + * The allocation of the UText struct itself and any "extra" storage + * associated with the UText is handled by the common UText implementation + * and does not require provider specific cleanup in a close function. + * + * Most UText provider implementations do not need to implement this function. + * + * @param ut A UText object to be closed. + * + * @stable ICU 3.4 + */ +typedef void U_CALLCONV +UTextClose(UText *ut); + + +/** + * (public) Function dispatch table for UText. + * Conceptually very much like a C++ Virtual Function Table. + * This struct defines the organization of the table. + * Each text provider implementation must provide an + * actual table that is initialized with the appropriate functions + * for the type of text being handled. + * @stable ICU 3.6 + */ +struct UTextFuncs { + /** + * (public) Function table size, sizeof(UTextFuncs) + * Intended for use should the table grow to accommodate added + * functions in the future, to allow tests for older format + * function tables that do not contain the extensions. + * + * Fields are placed for optimal alignment on + * 32/64/128-bit-pointer machines, by normally grouping together + * 4 32-bit fields, + * 4 pointers, + * 2 64-bit fields + * in sequence. + * @stable ICU 3.6 + */ + int32_t tableSize; + + /** + * (private) Alignment padding. + * Do not use, reserved for use by the UText framework only. + * @internal + */ + int32_t reserved1, /** @internal */ reserved2, /** @internal */ reserved3; + + + /** + * (public) Function pointer for UTextClone + * + * @see UTextClone + * @stable ICU 3.6 + */ + UTextClone *clone; + + /** + * (public) function pointer for UTextLength + * May be expensive to compute! + * + * @see UTextLength + * @stable ICU 3.6 + */ + UTextNativeLength *nativeLength; + + /** + * (public) Function pointer for UTextAccess. + * + * @see UTextAccess + * @stable ICU 3.6 + */ + UTextAccess *access; + + /** + * (public) Function pointer for UTextExtract. + * + * @see UTextExtract + * @stable ICU 3.6 + */ + UTextExtract *extract; + + /** + * (public) Function pointer for UTextReplace. + * + * @see UTextReplace + * @stable ICU 3.6 + */ + UTextReplace *replace; + + /** + * (public) Function pointer for UTextCopy. + * + * @see UTextCopy + * @stable ICU 3.6 + */ + UTextCopy *copy; + + /** + * (public) Function pointer for UTextMapOffsetToNative. + * + * @see UTextMapOffsetToNative + * @stable ICU 3.6 + */ + UTextMapOffsetToNative *mapOffsetToNative; + + /** + * (public) Function pointer for UTextMapNativeIndexToUTF16. + * + * @see UTextMapNativeIndexToUTF16 + * @stable ICU 3.6 + */ + UTextMapNativeIndexToUTF16 *mapNativeIndexToUTF16; + + /** + * (public) Function pointer for UTextClose. + * + * @see UTextClose + * @stable ICU 3.6 + */ + UTextClose *close; + + /** + * (private) Spare function pointer + * @internal + */ + UTextClose *spare1; + + /** + * (private) Spare function pointer + * @internal + */ + UTextClose *spare2; + + /** + * (private) Spare function pointer + * @internal + */ + UTextClose *spare3; + +}; +/** + * Function dispatch table for UText + * @see UTextFuncs + */ +typedef struct UTextFuncs UTextFuncs; + + /** + * UText struct. Provides the interface between the generic UText access code + * and the UText provider code that works on specific kinds of + * text (UTF-8, noncontiguous UTF-16, whatever.) + * + * Applications that are using predefined types of text providers + * to pass text data to ICU services will have no need to view the + * internals of the UText structs that they open. + * + * @stable ICU 3.6 + */ +struct UText { + /** + * (private) Magic. Used to help detect when UText functions are handed + * invalid or uninitialized UText structs. + * utext_openXYZ() functions take an initialized, + * but not necessarily open, UText struct as an + * optional fill-in parameter. This magic field + * is used to check for that initialization. + * Text provider close functions must NOT clear + * the magic field because that would prevent + * reuse of the UText struct. + * @internal + */ + uint32_t magic; + + + /** + * (private) Flags for managing the allocation and freeing of + * memory associated with this UText. + * @internal + */ + int32_t flags; + + + /** + * Text provider properties. This set of flags is maintained by the + * text provider implementation. + * @stable ICU 3.4 + */ + int32_t providerProperties; + + /** + * (public) sizeOfStruct=sizeof(UText) + * Allows possible backward compatible extension. + * + * @stable ICU 3.4 + */ + int32_t sizeOfStruct; + + /* ------ 16 byte alignment boundary ----------- */ + + + /** + * (protected) Native index of the first character position following + * the current chunk. + * @stable ICU 3.6 + */ + int64_t chunkNativeLimit; + + /** + * (protected) Size in bytes of the extra space (pExtra). + * @stable ICU 3.4 + */ + int32_t extraSize; + + /** + * (protected) The highest chunk offset where native indexing and + * chunk (UTF-16) indexing correspond. For UTF-16 sources, value + * will be equal to chunkLength. + * + * @stable ICU 3.6 + */ + int32_t nativeIndexingLimit; + + /* ---- 16 byte alignment boundary------ */ + + /** + * (protected) Native index of the first character in the text chunk. + * @stable ICU 3.6 + */ + int64_t chunkNativeStart; + + /** + * (protected) Current iteration position within the text chunk (UTF-16 buffer). + * This is the index to the character that will be returned by utext_next32(). + * @stable ICU 3.6 + */ + int32_t chunkOffset; + + /** + * (protected) Length the text chunk (UTF-16 buffer), in UChars. + * @stable ICU 3.6 + */ + int32_t chunkLength; + + /* ---- 16 byte alignment boundary-- */ + + + /** + * (protected) pointer to a chunk of text in UTF-16 format. + * May refer either to original storage of the source of the text, or + * if conversion was required, to a buffer owned by the UText. + * @stable ICU 3.6 + */ + const UChar *chunkContents; + + /** + * (public) Pointer to Dispatch table for accessing functions for this UText. + * @stable ICU 3.6 + */ + const UTextFuncs *pFuncs; + + /** + * (protected) Pointer to additional space requested by the + * text provider during the utext_open operation. + * @stable ICU 3.4 + */ + void *pExtra; + + /** + * (protected) Pointer to string or text-containing object or similar. + * This is the source of the text that this UText is wrapping, in a format + * that is known to the text provider functions. + * @stable ICU 3.4 + */ + const void *context; + + /* --- 16 byte alignment boundary--- */ + + /** + * (protected) Pointer fields available for use by the text provider. + * Not used by UText common code. + * @stable ICU 3.6 + */ + const void *p; + /** + * (protected) Pointer fields available for use by the text provider. + * Not used by UText common code. + * @stable ICU 3.6 + */ + const void *q; + /** + * (protected) Pointer fields available for use by the text provider. + * Not used by UText common code. + * @stable ICU 3.6 + */ + const void *r; + + /** + * Private field reserved for future use by the UText framework + * itself. This is not to be touched by the text providers. + * @internal ICU 3.4 + */ + void *privP; + + + /* --- 16 byte alignment boundary--- */ + + + /** + * (protected) Integer field reserved for use by the text provider. + * Not used by the UText framework, or by the client (user) of the UText. + * @stable ICU 3.4 + */ + int64_t a; + + /** + * (protected) Integer field reserved for use by the text provider. + * Not used by the UText framework, or by the client (user) of the UText. + * @stable ICU 3.4 + */ + int32_t b; + + /** + * (protected) Integer field reserved for use by the text provider. + * Not used by the UText framework, or by the client (user) of the UText. + * @stable ICU 3.4 + */ + int32_t c; + + /* ---- 16 byte alignment boundary---- */ + + + /** + * Private field reserved for future use by the UText framework + * itself. This is not to be touched by the text providers. + * @internal ICU 3.4 + */ + int64_t privA; + /** + * Private field reserved for future use by the UText framework + * itself. This is not to be touched by the text providers. + * @internal ICU 3.4 + */ + int32_t privB; + /** + * Private field reserved for future use by the UText framework + * itself. This is not to be touched by the text providers. + * @internal ICU 3.4 + */ + int32_t privC; +}; + + +/** + * Common function for use by Text Provider implementations to allocate and/or initialize + * a new UText struct. To be called in the implementation of utext_open() functions. + * If the supplied UText parameter is null, a new UText struct will be allocated on the heap. + * If the supplied UText is already open, the provider's close function will be called + * so that the struct can be reused by the open that is in progress. + * + * @param ut pointer to a UText struct to be re-used, or null if a new UText + * should be allocated. + * @param extraSpace The amount of additional space to be allocated as part + * of this UText, for use by types of providers that require + * additional storage. + * @param status Errors are returned here. + * @return pointer to the UText, allocated if necessary, with extra space set up if requested. + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status); + +// do not use #ifndef U_HIDE_INTERNAL_API around the following! +/** + * @internal + * Value used to help identify correctly initialized UText structs. + * Note: must be publicly visible so that UTEXT_INITIALIZER can access it. + */ +enum { + UTEXT_MAGIC = 0x345ad82c +}; + +/** + * initializer to be used with local (stack) instances of a UText + * struct. UText structs must be initialized before passing + * them to one of the utext_open functions. + * + * @stable ICU 3.6 + */ +#define UTEXT_INITIALIZER { \ + UTEXT_MAGIC, /* magic */ \ + 0, /* flags */ \ + 0, /* providerProps */ \ + sizeof(UText), /* sizeOfStruct */ \ + 0, /* chunkNativeLimit */ \ + 0, /* extraSize */ \ + 0, /* nativeIndexingLimit */ \ + 0, /* chunkNativeStart */ \ + 0, /* chunkOffset */ \ + 0, /* chunkLength */ \ + NULL, /* chunkContents */ \ + NULL, /* pFuncs */ \ + NULL, /* pExtra */ \ + NULL, /* context */ \ + NULL, NULL, NULL, /* p, q, r */ \ + NULL, /* privP */ \ + 0, 0, 0, /* a, b, c */ \ + 0, 0, 0 /* privA,B,C, */ \ + } + + +U_CDECL_END + + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUTextPointer + * "Smart pointer" class, closes a UText via utext_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close); + +U_NAMESPACE_END + +#endif + + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf.h new file mode 100644 index 0000000000000000000000000000000000000000..c9d5f5785c5a4615841be7dfc37c2ef2fbf9e5e5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf.h @@ -0,0 +1,225 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: utf.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999sep09 +* created by: Markus W. Scherer +*/ + +/** + * \file + * \brief C API: Code point macros + * + * This file defines macros for checking whether a code point is + * a surrogate or a non-character etc. + * + * If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 0 then utf.h is included by utypes.h + * and itself includes utf8.h and utf16.h after some + * common definitions. + * If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 1 then each of these headers must be + * included explicitly if their definitions are used. + * + * utf8.h and utf16.h define macros for efficiently getting code points + * in and out of UTF-8/16 strings. + * utf16.h macros have "U16_" prefixes. + * utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling. + * + * ICU mostly processes 16-bit Unicode strings. + * Most of the time, such strings are well-formed UTF-16. + * Single, unpaired surrogates must be handled as well, and are treated in ICU + * like regular code points where possible. + * (Pairs of surrogate code points are indistinguishable from supplementary + * code points encoded as pairs of supplementary code units.) + * + * In fact, almost all Unicode code points in normal text (>99%) + * are on the BMP (<=U+ffff) and even <=U+d7ff. + * ICU functions handle supplementary code points (U+10000..U+10ffff) + * but are optimized for the much more frequently occurring BMP code points. + * + * umachine.h defines UChar to be an unsigned 16-bit integer. + * Since ICU 59, ICU uses char16_t in C++, UChar only in C, + * and defines UChar=char16_t by default. See the UChar API docs for details. + * + * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit + * Unicode code point (Unicode scalar value, 0..0x10ffff) and U_SENTINEL (-1). + * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as + * the definition of UChar. For details see the documentation for UChar32 itself. + * + * utf.h defines a small number of C macros for single Unicode code points. + * These are simple checks for surrogates and non-characters. + * For actual Unicode character properties see uchar.h. + * + * By default, string operations must be done with error checking in case + * a string is not well-formed UTF-16 or UTF-8. + * + * The U16_ macros detect if a surrogate code unit is unpaired + * (lead unit without trail unit or vice versa) and just return the unit itself + * as the code point. + * + * The U8_ macros detect illegal byte sequences and return a negative value. + * Starting with ICU 60, the observable length of a single illegal byte sequence + * skipped by one of these macros follows the Unicode 6+ recommendation + * which is consistent with the W3C Encoding Standard. + * + * There are ..._OR_FFFD versions of both U16_ and U8_ macros + * that return U+FFFD for illegal code unit sequences. + * + * The regular "safe" macros require that the initial, passed-in string index + * is within bounds. They only check the index when they read more than one + * code unit. This is usually done with code similar to the following loop: + *

while(i
+ *
+ * When it is safe to assume that text is well-formed UTF-16
+ * (does not contain single, unpaired surrogates), then one can use
+ * U16_..._UNSAFE macros.
+ * These do not check for proper code unit sequences or truncated text and may
+ * yield wrong results or even cause a crash if they are used with "malformed"
+ * text.
+ * In practice, U16_..._UNSAFE macros will produce slightly less code but
+ * should not be faster because the processing is only different when a
+ * surrogate code unit is detected, which will be rare.
+ *
+ * Similarly for UTF-8, there are "safe" macros without a suffix,
+ * and U8_..._UNSAFE versions.
+ * The performance differences are much larger here because UTF-8 provides so
+ * many opportunities for malformed sequences.
+ * The unsafe UTF-8 macros are entirely implemented inside the macro definitions
+ * and are fast, while the safe UTF-8 macros call functions for some complicated cases.
+ *
+ * Unlike with UTF-16, malformed sequences cannot be expressed with distinct
+ * code point values (0..U+10ffff). They are indicated with negative values instead.
+ *
+ * For more information see the ICU User Guide Strings chapter
+ * (https://unicode-org.github.io/icu/userguide/strings).
+ *
+ * Usage:
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used  for if-else-while... 
+ * bodies and all macro statements should be terminated with semicolon.
+ *
+ * @stable ICU 2.4
+ */
+
+#ifndef __UTF_H__
+#define __UTF_H__
+
+#include "unicode/umachine.h"
+/* include the utfXX.h after the following definitions */
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Is this code point a Unicode noncharacter?
+ * @param c 32-bit code point
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U_IS_UNICODE_NONCHAR(c) \
+    ((c)>=0xfdd0 && \
+     ((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff)
+
+/**
+ * Is c a Unicode code point value (0..U+10ffff)
+ * that can be assigned a character?
+ *
+ * Code points that are not characters include:
+ * - single surrogate code points (U+d800..U+dfff, 2048 code points)
+ * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points)
+ * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points)
+ * - the highest Unicode code point value is U+10ffff
+ *
+ * This means that all code points below U+d800 are character code points,
+ * and that boundary is tested first for performance.
+ *
+ * @param c 32-bit code point
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U_IS_UNICODE_CHAR(c) \
+    ((uint32_t)(c)<0xd800 || \
+        (0xdfff<(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c)))
+
+/**
+ * Is this code point a BMP code point (U+0000..U+ffff)?
+ * @param c 32-bit code point
+ * @return true or false
+ * @stable ICU 2.8
+ */
+#define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)
+
+/**
+ * Is this code point a supplementary code point (U+10000..U+10ffff)?
+ * @param c 32-bit code point
+ * @return true or false
+ * @stable ICU 2.8
+ */
+#define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
+ 
+/**
+ * Is this code point a lead surrogate (U+d800..U+dbff)?
+ * @param c 32-bit code point
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+
+/**
+ * Is this code point a trail surrogate (U+dc00..U+dfff)?
+ * @param c 32-bit code point
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+
+/**
+ * Is this code point a surrogate (U+d800..U+dfff)?
+ * @param c 32-bit code point
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
+
+/**
+ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
+ * is it a lead surrogate?
+ * @param c 32-bit code point
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
+
+/**
+ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
+ * is it a trail surrogate?
+ * @param c 32-bit code point
+ * @return true or false
+ * @stable ICU 4.2
+ */
+#define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
+
+/* include the utfXX.h ------------------------------------------------------ */
+
+#if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS
+
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
+
+/* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
+#include "unicode/utf_old.h"
+
+#endif  /* !U_NO_DEFAULT_INCLUDE_UTF_HEADERS */
+
+#endif  /* __UTF_H__ */
diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf16.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf16.h
new file mode 100644
index 0000000000000000000000000000000000000000..3902c60e95e70dea78896d0d08df97079f89efa7
--- /dev/null
+++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf16.h
@@ -0,0 +1,734 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+*   Copyright (C) 1999-2012, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf16.h
+*   encoding:   UTF-8
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep09
+*   created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: 16-bit Unicode handling macros
+ * 
+ * This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings.
+ *
+ * For more information see utf.h and the ICU User Guide Strings chapter
+ * (https://unicode-org.github.io/icu/userguide/strings).
+ *
+ * Usage:
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used  for if-else-while... 
+ * bodies and all macro statements should be terminated with semicolon.
+ */
+
+#ifndef __UTF16_H__
+#define __UTF16_H__
+
+#include 
+#include "unicode/umachine.h"
+#ifndef __UTF_H__
+#   include "unicode/utf.h"
+#endif
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Does this code unit alone encode a code point (BMP, not a surrogate)?
+ * @param c 16-bit code unit
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
+
+/**
+ * Is this code unit a lead surrogate (U+d800..U+dbff)?
+ * @param c 16-bit code unit
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+
+/**
+ * Is this code unit a trail surrogate (U+dc00..U+dfff)?
+ * @param c 16-bit code unit
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+
+/**
+ * Is this code unit a surrogate (U+d800..U+dfff)?
+ * @param c 16-bit code unit
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
+
+/**
+ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
+ * is it a lead surrogate?
+ * @param c 16-bit code unit
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
+
+/**
+ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
+ * is it a trail surrogate?
+ * @param c 16-bit code unit
+ * @return true or false
+ * @stable ICU 4.2
+ */
+#define U16_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
+
+/**
+ * Helper constant for U16_GET_SUPPLEMENTARY.
+ * @internal
+ */
+#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
+
+/**
+ * Get a supplementary code point value (U+10000..U+10ffff)
+ * from its lead and trail surrogates.
+ * The result is undefined if the input values are not
+ * lead and trail surrogates.
+ *
+ * @param lead lead surrogate (U+d800..U+dbff)
+ * @param trail trail surrogate (U+dc00..U+dfff)
+ * @return supplementary code point (U+10000..U+10ffff)
+ * @stable ICU 2.4
+ */
+#define U16_GET_SUPPLEMENTARY(lead, trail) \
+    (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET)
+
+
+/**
+ * Get the lead surrogate (0xd800..0xdbff) for a
+ * supplementary code point (0x10000..0x10ffff).
+ * @param supplementary 32-bit code point (U+10000..U+10ffff)
+ * @return lead surrogate (U+d800..U+dbff) for supplementary
+ * @stable ICU 2.4
+ */
+#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0)
+
+/**
+ * Get the trail surrogate (0xdc00..0xdfff) for a
+ * supplementary code point (0x10000..0x10ffff).
+ * @param supplementary 32-bit code point (U+10000..U+10ffff)
+ * @return trail surrogate (U+dc00..U+dfff) for supplementary
+ * @stable ICU 2.4
+ */
+#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00)
+
+/**
+ * How many 16-bit code units are used to encode this Unicode code point? (1 or 2)
+ * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff).
+ * @param c 32-bit code point
+ * @return 1 or 2
+ * @stable ICU 2.4
+ */
+#define U16_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2)
+
+/**
+ * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff).
+ * @return 2
+ * @stable ICU 2.4
+ */
+#define U16_MAX_LENGTH 2
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ * The result is undefined if the offset points to a single, unpaired surrogate.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_GET
+ * @stable ICU 2.4
+ */
+#define U16_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+    (c)=(s)[i]; \
+    if(U16_IS_SURROGATE(c)) { \
+        if(U16_IS_SURROGATE_LEAD(c)) { \
+            (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)+1]); \
+        } else { \
+            (c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \
+        } \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * If the offset points to a single, unpaired surrogate, then
+ * c is set to that unpaired surrogate.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+                (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+            } \
+        } \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * If the offset points to a single, unpaired surrogate, then
+ * c is set to U+FFFD.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT_OR_FFFD.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+                (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+            } else { \
+                (c)=0xfffd; \
+            } \
+        } \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/* definitions with forward iteration --------------------------------------- */
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The offset may point to the lead surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the following trail surrogate as well.
+ * If the offset points to a trail surrogate, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset points to a single, unpaired lead surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_NEXT
+ * @stable ICU 2.4
+ */
+#define U16_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+    (c)=(s)[(i)++]; \
+    if(U16_IS_LEAD(c)) { \
+        (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * The offset may point to the lead surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the following trail surrogate as well.
+ * If the offset points to a trail surrogate or
+ * to a single, unpaired lead surrogate, then c is set to that unpaired surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset, must be i>10)+0xd7c0); \
+        (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Append a code point to a string, overwriting 1 or 2 code units.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Safe" macro, checks for a valid code point.
+ * If a surrogate pair is written, checks for sufficient space in the string.
+ * If the code point is not valid or a trail surrogate does not fit,
+ * then isError is set to true.
+ *
+ * @param s const UChar * string buffer
+ * @param i string offset, must be i>10)+0xd7c0); \
+        (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
+    } else /* c>0x10ffff or not enough space */ { \
+        (isError)=true; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_FWD_1
+ * @stable ICU 2.4
+ */
+#define U16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+    if(U16_IS_LEAD((s)[(i)++])) { \
+        ++(i); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const UChar * string
+ * @param i string offset, must be i0) { \
+        U16_FWD_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const UChar * string
+ * @param i int32_t string offset, must be i0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
+        U16_FWD_1(s, i, length); \
+        --__N; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to the trail surrogate of a surrogate pair,
+ * then the offset is decremented.
+ * Otherwise, it is not modified.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_SET_CP_START
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+    if(U16_IS_TRAIL((s)[i])) { \
+        --(i); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to the trail surrogate of a surrogate pair,
+ * then the offset is decremented.
+ * Otherwise, it is not modified.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i
+ * @see U16_SET_CP_START_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
+    if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
+        --(i); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/* definitions with backward iteration -------------------------------------- */
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset is behind a single, unpaired trail surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_PREV
+ * @stable ICU 2.4
+ */
+#define U16_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+    (c)=(s)[--(i)]; \
+    if(U16_IS_TRAIL(c)) { \
+        (c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate or behind a single, unpaired
+ * trail surrogate, then c is set to that unpaired surrogate.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+            --(i); \
+            (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+        } \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate or behind a single, unpaired
+ * trail surrogate, then c is set to U+FFFD.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+            --(i); \
+            (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+        } else { \
+            (c)=0xfffd; \
+        } \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_BACK_1
+ * @stable ICU 2.4
+ */
+#define U16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+    if(U16_IS_TRAIL((s)[--(i)])) { \
+        --(i); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start(start) && U16_IS_LEAD((s)[(i)-1])) { \
+        --(i); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U16_BACK_N
+ * @stable ICU 2.4
+ */
+#define U16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+    int32_t __N=(n); \
+    while(__N>0) { \
+        U16_BACK_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start start of string
+ * @param i string offset, must be start0 && (i)>(start)) { \
+        U16_BACK_1(s, start, i); \
+        --__N; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind the lead surrogate of a surrogate pair,
+ * then the offset is incremented.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_SET_CP_LIMIT
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+    if(U16_IS_LEAD((s)[(i)-1])) { \
+        ++(i); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind the lead surrogate of a surrogate pair,
+ * then the offset is incremented.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const UChar * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param i int32_t string offset, start<=i<=length
+ * @param length int32_t string length
+ * @see U16_SET_CP_LIMIT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \
+    if((start)<(i) && ((i)<(length) || (length)<0) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \
+        ++(i); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+#endif
diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf32.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf32.h
new file mode 100644
index 0000000000000000000000000000000000000000..8822c4dd0962c8ee8f62ba0f8abf448f04d5ab22
--- /dev/null
+++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf32.h
@@ -0,0 +1,25 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+*   Copyright (C) 1999-2001, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf32.h
+*   encoding:   UTF-8
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep20
+*   created by: Markus W. Scherer
+*/
+/**
+ * \file
+ * \brief C API: UTF-32 macros
+ *
+ * This file is obsolete and its contents moved to utf_old.h.
+ * See utf_old.h and Jitterbug 2150 and its discussion on the ICU mailing list
+ * in September 2002.
+ */
diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf8.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf8.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a07435fcf6096e487722afed08945423fcb4f84
--- /dev/null
+++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf8.h
@@ -0,0 +1,882 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+*   Copyright (C) 1999-2015, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf8.h
+*   encoding:   UTF-8
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep13
+*   created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: 8-bit Unicode handling macros
+ * 
+ * This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings.
+ *
+ * For more information see utf.h and the ICU User Guide Strings chapter
+ * (https://unicode-org.github.io/icu/userguide/strings).
+ *
+ * Usage:
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used  for if-else-while... 
+ * bodies and all macro statements should be terminated with semicolon.
+ */
+
+#ifndef __UTF8_H__
+#define __UTF8_H__
+
+#include 
+#include "unicode/umachine.h"
+#ifndef __UTF_H__
+#   include "unicode/utf.h"
+#endif
+
+/* internal definitions ----------------------------------------------------- */
+
+/**
+ * Counts the trail bytes for a UTF-8 lead byte.
+ * Returns 0 for 0..0xc1 as well as for 0xf5..0xff.
+ * leadByte might be evaluated multiple times.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this file and thus must remain stable.
+ *
+ * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
+ * @internal
+ */
+#define U8_COUNT_TRAIL_BYTES(leadByte) \
+    (U8_IS_LEAD(leadByte) ? \
+        ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+1 : 0)
+
+/**
+ * Counts the trail bytes for a UTF-8 lead byte of a valid UTF-8 sequence.
+ * Returns 0 for 0..0xc1. Undefined for 0xf5..0xff.
+ * leadByte might be evaluated multiple times.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this file and thus must remain stable.
+ *
+ * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
+ * @internal
+ */
+#define U8_COUNT_TRAIL_BYTES_UNSAFE(leadByte) \
+    (((uint8_t)(leadByte)>=0xc2)+((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0))
+
+/**
+ * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this file and thus must remain stable.
+ * @internal
+ */
+#define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1)
+
+/**
+ * Internal bit vector for 3-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD3_AND_T1.
+ * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
+ * Lead byte E0..EF bits 3..0 are used as byte index,
+ * first trail byte bits 7..5 are used as bit index into that byte.
+ * @see U8_IS_VALID_LEAD3_AND_T1
+ * @internal
+ */
+#define U8_LEAD3_T1_BITS "\x20\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x10\x30\x30"
+
+/**
+ * Internal 3-byte UTF-8 validity check.
+ * Non-zero if lead byte E0..EF and first trail byte 00..FF start a valid sequence.
+ * @internal
+ */
+#define U8_IS_VALID_LEAD3_AND_T1(lead, t1) (U8_LEAD3_T1_BITS[(lead)&0xf]&(1<<((uint8_t)(t1)>>5)))
+
+/**
+ * Internal bit vector for 4-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD4_AND_T1.
+ * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
+ * First trail byte bits 7..4 are used as byte index,
+ * lead byte F0..F4 bits 2..0 are used as bit index into that byte.
+ * @see U8_IS_VALID_LEAD4_AND_T1
+ * @internal
+ */
+#define U8_LEAD4_T1_BITS "\x00\x00\x00\x00\x00\x00\x00\x00\x1E\x0F\x0F\x0F\x00\x00\x00\x00"
+
+/**
+ * Internal 4-byte UTF-8 validity check.
+ * Non-zero if lead byte F0..F4 and first trail byte 00..FF start a valid sequence.
+ * @internal
+ */
+#define U8_IS_VALID_LEAD4_AND_T1(lead, t1) (U8_LEAD4_T1_BITS[(uint8_t)(t1)>>4]&(1<<((lead)&7)))
+
+/**
+ * Function for handling "next code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_CAPI UChar32 U_EXPORT2
+utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict);
+
+/**
+ * Function for handling "append code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_CAPI int32_t U_EXPORT2
+utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError);
+
+/**
+ * Function for handling "previous code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_CAPI UChar32 U_EXPORT2
+utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict);
+
+/**
+ * Function for handling "skip backward one code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_CAPI int32_t U_EXPORT2
+utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)?
+ * @param c 8-bit code unit (byte)
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U8_IS_SINGLE(c) (((c)&0x80)==0)
+
+/**
+ * Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4)
+ * @param c 8-bit code unit (byte)
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32)
+// 0x32=0xf4-0xc2
+
+/**
+ * Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF)
+ * @param c 8-bit code unit (byte)
+ * @return true or false
+ * @stable ICU 2.4
+ */
+#define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40)
+
+/**
+ * How many code units (bytes) are used for the UTF-8 encoding
+ * of this Unicode code point?
+ * @param c 32-bit code point
+ * @return 1..4, or 0 if c is a surrogate or not a Unicode code point
+ * @stable ICU 2.4
+ */
+#define U8_LENGTH(c) \
+    ((uint32_t)(c)<=0x7f ? 1 : \
+        ((uint32_t)(c)<=0x7ff ? 2 : \
+            ((uint32_t)(c)<=0xd7ff ? 3 : \
+                ((uint32_t)(c)<=0xdfff || (uint32_t)(c)>0x10ffff ? 0 : \
+                    ((uint32_t)(c)<=0xffff ? 3 : 4)\
+                ) \
+            ) \
+        ) \
+    )
+
+/**
+ * The maximum number of UTF-8 code units (bytes) per Unicode code point (U+0000..U+10ffff).
+ * @return 4
+ * @stable ICU 2.4
+ */
+#define U8_MAX_LENGTH 4
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * The offset may point to either the lead byte or one of the trail bytes
+ * for a code point, in which case the macro will read all of the bytes
+ * for the code point.
+ * The result is undefined if the offset points to an illegal UTF-8
+ * byte sequence.
+ * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_GET
+ * @stable ICU 2.4
+ */
+#define U8_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+    int32_t _u8_get_unsafe_index=(int32_t)(i); \
+    U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \
+    U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * The offset may point to either the lead byte or one of the trail bytes
+ * for a code point, in which case the macro will read all of the bytes
+ * for the code point.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * If the offset points to an illegal UTF-8 byte sequence, then
+ * c is set to a negative value.
+ * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset
+ * @param i int32_t string offset, must be start<=i=0xe0 ? \
+                ((c)<0xf0 ?  /* U+0800..U+FFFF except surrogates */ \
+                    U8_LEAD3_T1_BITS[(c)&=0xf]&(1<<((__t=(s)[i])>>5)) && \
+                    (__t&=0x3f, 1) \
+                :  /* U+10000..U+10FFFF */ \
+                    ((c)-=0xf0)<=4 && \
+                    U8_LEAD4_T1_BITS[(__t=(s)[i])>>4]&(1<<(c)) && \
+                    ((c)=((c)<<6)|(__t&0x3f), ++(i)!=(length)) && \
+                    (__t=(s)[i]-0x80)<=0x3f) && \
+                /* valid second-to-last trail byte */ \
+                ((c)=((c)<<6)|__t, ++(i)!=(length)) \
+            :  /* U+0080..U+07FF */ \
+                (c)>=0xc2 && ((c)&=0x1f, 1)) && \
+            /* last trail byte */ \
+            (__t=(s)[i]-0x80)<=0x3f && \
+            ((c)=((c)<<6)|__t, ++(i), 1)) { \
+        } else { \
+            (c)=(sub);  /* ill-formed*/ \
+        } \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Append a code point to a string, overwriting 1 to 4 bytes.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Unsafe" macro, assumes a valid code point and sufficient space in the string.
+ * Otherwise, the result is undefined.
+ *
+ * @param s const uint8_t * string buffer
+ * @param i string offset
+ * @param c code point to append
+ * @see U8_APPEND
+ * @stable ICU 2.4
+ */
+#define U8_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+    uint32_t __uc=(c); \
+    if(__uc<=0x7f) { \
+        (s)[(i)++]=(uint8_t)__uc; \
+    } else { \
+        if(__uc<=0x7ff) { \
+            (s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \
+        } else { \
+            if(__uc<=0xffff) { \
+                (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \
+            } else { \
+                (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \
+                (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \
+            } \
+            (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
+        } \
+        (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Append a code point to a string, overwriting 1 to 4 bytes.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Safe" macro, checks for a valid code point.
+ * If a non-ASCII code point is written, checks for sufficient space in the string.
+ * If the code point is not valid or trail bytes do not fit,
+ * then isError is set to true.
+ *
+ * @param s const uint8_t * string buffer
+ * @param i int32_t string offset, must be i>6)|0xc0); \
+        (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
+    } else if((__uc<=0xd7ff || (0xe000<=__uc && __uc<=0xffff)) && (i)+2<(capacity)) { \
+        (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \
+        (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
+        (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
+    } else if(0xffff<__uc && __uc<=0x10ffff && (i)+3<(capacity)) { \
+        (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \
+        (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \
+        (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
+        (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
+    } else { \
+        (isError)=true; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_FWD_1
+ * @stable ICU 2.4
+ */
+#define U8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+    (i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((s)[i]); \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const uint8_t * string
+ * @param i int32_t string offset, must be i=0xf0 */ { \
+            if(U8_IS_VALID_LEAD4_AND_T1(__b, __t1) && \
+                    ++(i)!=(length) && U8_IS_TRAIL((s)[i]) && \
+                    ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \
+                ++(i); \
+            } \
+        } \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U8_FWD_N
+ * @stable ICU 2.4
+ */
+#define U8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
+    int32_t __N=(n); \
+    while(__N>0) { \
+        U8_FWD_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const uint8_t * string
+ * @param i int32_t string offset, must be i0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
+        U8_FWD_1(s, i, length); \
+        --__N; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to a UTF-8 trail byte,
+ * then the offset is moved backward to the corresponding lead byte.
+ * Otherwise, it is not modified.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_SET_CP_START
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+    while(U8_IS_TRAIL((s)[i])) { --(i); } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to a UTF-8 trail byte,
+ * then the offset is moved backward to the corresponding lead byte.
+ * Otherwise, it is not modified.
+ *
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ * Unlike U8_TRUNCATE_IF_INCOMPLETE(), this macro always reads s[i].
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param i int32_t string offset, must be start<=i
+ * @see U8_SET_CP_START_UNSAFE
+ * @see U8_TRUNCATE_IF_INCOMPLETE
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
+    if(U8_IS_TRAIL((s)[(i)])) { \
+        (i)=utf8_back1SafeBody(s, start, (i)); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * If the string ends with a UTF-8 byte sequence that is valid so far
+ * but incomplete, then reduce the length of the string to end before
+ * the lead byte of that incomplete sequence.
+ * For example, if the string ends with E1 80, the length is reduced by 2.
+ *
+ * In all other cases (the string ends with a complete sequence, or it is not
+ * possible for any further trail byte to extend the trailing sequence)
+ * the length remains unchanged.
+ *
+ * Useful for processing text split across multiple buffers
+ * (save the incomplete sequence for later)
+ * and for optimizing iteration
+ * (check for string length only once per character).
+ *
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ * Unlike U8_SET_CP_START(), this macro never reads s[length].
+ *
+ * (In UTF-16, simply check for U16_IS_LEAD(last code unit).)
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param length int32_t string length (usually start<=length)
+ * @see U8_SET_CP_START
+ * @stable ICU 61
+ */
+#define U8_TRUNCATE_IF_INCOMPLETE(s, start, length) UPRV_BLOCK_MACRO_BEGIN { \
+    if((length)>(start)) { \
+        uint8_t __b1=s[(length)-1]; \
+        if(U8_IS_SINGLE(__b1)) { \
+            /* common ASCII character */ \
+        } else if(U8_IS_LEAD(__b1)) { \
+            --(length); \
+        } else if(U8_IS_TRAIL(__b1) && ((length)-2)>=(start)) { \
+            uint8_t __b2=s[(length)-2]; \
+            if(0xe0<=__b2 && __b2<=0xf4) { \
+                if(__b2<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(__b2, __b1) : \
+                        U8_IS_VALID_LEAD4_AND_T1(__b2, __b1)) { \
+                    (length)-=2; \
+                } \
+            } else if(U8_IS_TRAIL(__b2) && ((length)-3)>=(start)) { \
+                uint8_t __b3=s[(length)-3]; \
+                if(0xf0<=__b3 && __b3<=0xf4 && U8_IS_VALID_LEAD4_AND_T1(__b3, __b2)) { \
+                    (length)-=3; \
+                } \
+            } \
+        } \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/* definitions with backward iteration -------------------------------------- */
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a multi-byte sequence, then the macro will read
+ * the whole sequence.
+ * If the offset is behind a lead byte, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset is behind an illegal UTF-8 sequence.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_PREV
+ * @stable ICU 2.4
+ */
+#define U8_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
+    (c)=(uint8_t)(s)[--(i)]; \
+    if(U8_IS_TRAIL(c)) { \
+        uint8_t __b, __count=1, __shift=6; \
+\
+        /* c is a trail byte */ \
+        (c)&=0x3f; \
+        for(;;) { \
+            __b=(s)[--(i)]; \
+            if(__b>=0xc0) { \
+                U8_MASK_LEAD_BYTE(__b, __count); \
+                (c)|=(UChar32)__b<<__shift; \
+                break; \
+            } else { \
+                (c)|=(UChar32)(__b&0x3f)<<__shift; \
+                ++__count; \
+                __shift+=6; \
+            } \
+        } \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a multi-byte sequence, then the macro will read
+ * the whole sequence.
+ * If the offset is behind a lead byte, then that itself
+ * will be returned as the code point.
+ * If the offset is behind an illegal UTF-8 sequence, then c is set to a negative value.
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param i int32_t string offset, must be start0) { \
+        U8_BACK_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t index of the start of the string
+ * @param i int32_t string offset, must be start0 && (i)>(start)) { \
+        U8_BACK_1(s, start, i); \
+        --__N; \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind a partial multi-byte sequence,
+ * then the offset is incremented to behind the whole sequence.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_SET_CP_LIMIT
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+    U8_BACK_1_UNSAFE(s, i); \
+    U8_FWD_1_UNSAFE(s, i); \
+} UPRV_BLOCK_MACRO_END
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind a partial multi-byte sequence,
+ * then the offset is incremented to behind the whole sequence.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param i int32_t string offset, must be start<=i<=length
+ * @param length int32_t string length
+ * @see U8_SET_CP_LIMIT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \
+    if((start)<(i) && ((i)<(length) || (length)<0)) { \
+        U8_BACK_1(s, start, i); \
+        U8_FWD_1(s, i, length); \
+    } \
+} UPRV_BLOCK_MACRO_END
+
+#endif
diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf_old.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf_old.h
new file mode 100644
index 0000000000000000000000000000000000000000..160f5ad0a9f24858f392feefe6770608a013211f
--- /dev/null
+++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utf_old.h
@@ -0,0 +1,1201 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2002-2012, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf_old.h
+*   encoding:   UTF-8
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2002sep21
+*   created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: Deprecated macros for Unicode string handling
+ *
+ * The macros in utf_old.h are all deprecated and their use discouraged.
+ * Some of the design principles behind the set of UTF macros
+ * have changed or proved impractical.
+ * Almost all of the old "UTF macros" are at least renamed.
+ * If you are looking for a new equivalent to an old macro, please see the
+ * comment at the old one.
+ *
+ * Brief summary of reasons for deprecation:
+ * - Switch on UTF_SIZE (selection of UTF-8/16/32 default string processing)
+ *   was impractical.
+ * - Switch on UTF_SAFE etc. (selection of unsafe/safe/strict default string processing)
+ *   was of little use and impractical.
+ * - Whole classes of macros became obsolete outside of the UTF_SIZE/UTF_SAFE
+ *   selection framework: UTF32_ macros (all trivial)
+ *   and UTF_ default and intermediate macros (all aliases).
+ * - The selection framework also caused many macro aliases.
+ * - Change in Unicode standard: "irregular" sequences (3.0) became illegal (3.2).
+ * - Change of language in Unicode standard:
+ *   Growing distinction between internal x-bit Unicode strings and external UTF-x
+ *   forms, with the former more lenient.
+ *   Suggests renaming of UTF16_ macros to U16_.
+ * - The prefix "UTF_" without a width number confused some users.
+ * - "Safe" append macros needed the addition of an error indicator output.
+ * - "Safe" UTF-8 macros used legitimate (if rarely used) code point values
+ *   to indicate error conditions.
+ * - The use of the "_CHAR" infix for code point operations confused some users.
+ *
+ * More details:
+ *
+ * Until ICU 2.2, utf.h theoretically allowed to choose among UTF-8/16/32
+ * for string processing, and among unsafe/safe/strict default macros for that.
+ *
+ * It proved nearly impossible to write non-trivial, high-performance code
+ * that is UTF-generic.
+ * Unsafe default macros would be dangerous for default string processing,
+ * and the main reason for the "strict" versions disappeared:
+ * Between Unicode 3.0 and 3.2 all "irregular" UTF-8 sequences became illegal.
+ * The only other conditions that "strict" checked for were non-characters,
+ * which are valid during processing. Only during text input/output should they
+ * be checked, and at that time other well-formedness checks may be
+ * necessary or useful as well.
+ * This can still be done by using U16_NEXT and U_IS_UNICODE_NONCHAR
+ * or U_IS_UNICODE_CHAR.
+ *
+ * The old UTF8_..._SAFE macros also used some normal Unicode code points
+ * to indicate malformed sequences.
+ * The new UTF8_ macros without suffix use negative values instead.
+ *
+ * The entire contents of utf32.h was moved here without replacement
+ * because all those macros were trivial and
+ * were meaningful only in the framework of choosing the UTF size.
+ *
+ * See Jitterbug 2150 and its discussion on the ICU mailing list
+ * in September 2002.
+ *
+ * 
+ * + * Obsolete part of pre-ICU 2.4 utf.h file documentation: + * + *

The original concept for these files was for ICU to allow + * in principle to set which UTF (UTF-8/16/32) is used internally + * by defining UTF_SIZE to either 8, 16, or 32. utf.h would then define the UChar type + * accordingly. UTF-16 was the default.

+ * + *

This concept has been abandoned. + * A lot of the ICU source code assumes UChar strings are in UTF-16. + * This is especially true for low-level code like + * conversion, normalization, and collation. + * The utf.h header enforces the default of UTF-16. + * The UTF-8 and UTF-32 macros remain for now for completeness and backward compatibility.

+ * + *

Accordingly, utf.h defines UChar to be an unsigned 16-bit integer. If this matches wchar_t, then + * UChar is defined to be exactly wchar_t, otherwise uint16_t.

+ * + *

UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit + * Unicode code point (Unicode scalar value, 0..0x10ffff). + * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as + * the definition of UChar. For details see the documentation for UChar32 itself.

+ * + *

utf.h also defines a number of C macros for handling single Unicode code points and + * for using UTF Unicode strings. It includes utf8.h, utf16.h, and utf32.h for the actual + * implementations of those macros and then aliases one set of them (for UTF-16) for general use. + * The UTF-specific macros have the UTF size in the macro name prefixes (UTF16_...), while + * the general alias macros always begin with UTF_...

+ * + *

Many string operations can be done with or without error checking. + * Where such a distinction is useful, there are two versions of the macros, "unsafe" and "safe" + * ones with ..._UNSAFE and ..._SAFE suffixes. The unsafe macros are fast but may cause + * program failures if the strings are not well-formed. The safe macros have an additional, boolean + * parameter "strict". If strict is false, then only illegal sequences are detected. + * Otherwise, irregular sequences and non-characters are detected as well (like single surrogates). + * Safe macros return special error code points for illegal/irregular sequences: + * Typically, U+ffff, or values that would result in a code unit sequence of the same length + * as the erroneous input sequence.
+ * Note that _UNSAFE macros have fewer parameters: They do not have the strictness parameter, and + * they do not have start/length parameters for boundary checking.

+ * + *

Here, the macros are aliased in two steps: + * In the first step, the UTF-specific macros with UTF16_ prefix and _UNSAFE and _SAFE suffixes are + * aliased according to the UTF_SIZE to macros with UTF_ prefix and the same suffixes and signatures. + * Then, in a second step, the default, general alias macros are set to use either the unsafe or + * the safe/not strict (default) or the safe/strict macro; + * these general macros do not have a strictness parameter.

+ * + *

It is possible to change the default choice for the general alias macros to be unsafe, safe/not strict or safe/strict. + * The default is safe/not strict. It is not recommended to select the unsafe macros as the basis for + * Unicode string handling in ICU! To select this, define UTF_SAFE, UTF_STRICT, or UTF_UNSAFE.

+ * + *

For general use, one should use the default, general macros with UTF_ prefix and no _SAFE/_UNSAFE suffix. + * Only in some cases it may be necessary to control the choice of macro directly and use a less generic alias. + * For example, if it can be assumed that a string is well-formed and the index will stay within the bounds, + * then the _UNSAFE version may be used. + * If a UTF-8 string is to be processed, then the macros with UTF8_ prefixes need to be used.

+ * + *
+ * + * Deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead. + */ + +#ifndef __UTF_OLD_H__ +#define __UTF_OLD_H__ + +#include "unicode/utf.h" +#include "unicode/utf8.h" +#include "unicode/utf16.h" + +/** + * \def U_HIDE_OBSOLETE_UTF_OLD_H + * + * Hides the obsolete definitions in unicode/utf_old.h. + * Recommended to be set to 1 at compile time to make sure + * the long-deprecated macros are no longer used. + * + * For reasons for the deprecation see the utf_old.h file comments. + * + * @internal + */ +#ifndef U_HIDE_OBSOLETE_UTF_OLD_H +# define U_HIDE_OBSOLETE_UTF_OLD_H 0 +#endif + +#if !defined(U_HIDE_DEPRECATED_API) && !U_HIDE_OBSOLETE_UTF_OLD_H + +/* Formerly utf.h, part 1 --------------------------------------------------- */ + +#ifdef U_USE_UTF_DEPRECATES +/** + * Unicode string and array offset and index type. + * ICU always counts Unicode code units (UChars) for + * string offsets, indexes, and lengths, not Unicode code points. + * + * @obsolete ICU 2.6. Use int32_t directly instead since this API will be removed in that release. + */ +typedef int32_t UTextOffset; +#endif + +/** Number of bits in a Unicode string code unit - ICU uses 16-bit Unicode. @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF_SIZE 16 + +/** + * The default choice for general Unicode string macros is to use the ..._SAFE macro implementations + * with strict=false. + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_SAFE +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#undef UTF_UNSAFE +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#undef UTF_STRICT + +/** + * UTF8_ERROR_VALUE_1 and UTF8_ERROR_VALUE_2 are special error values for UTF-8, + * which need 1 or 2 bytes in UTF-8: + * \code + * U+0015 = NAK = Negative Acknowledge, C0 control character + * U+009f = highest C1 control character + * \endcode + * + * These are used by UTF8_..._SAFE macros so that they can return an error value + * that needs the same number of code units (bytes) as were seen by + * a macro. They should be tested with UTF_IS_ERROR() or UTF_IS_VALID(). + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF8_ERROR_VALUE_1 0x15 + +/** + * See documentation on UTF8_ERROR_VALUE_1 for details. + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF8_ERROR_VALUE_2 0x9f + +/** + * Error value for all UTFs. This code point value will be set by macros with error + * checking if an error is detected. + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_ERROR_VALUE 0xffff + +/** + * Is a given 32-bit code an error value + * as returned by one of the macros for any UTF? + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_IS_ERROR(c) \ + (((c)&0xfffe)==0xfffe || (c)==UTF8_ERROR_VALUE_1 || (c)==UTF8_ERROR_VALUE_2) + +/** + * This is a combined macro: Is c a valid Unicode value _and_ not an error code? + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_IS_VALID(c) \ + (UTF_IS_UNICODE_CHAR(c) && \ + (c)!=UTF8_ERROR_VALUE_1 && (c)!=UTF8_ERROR_VALUE_2) + +/** + * Is this code unit or code point a surrogate (U+d800..U+dfff)? + * @deprecated ICU 2.4. Renamed to U_IS_SURROGATE and U16_IS_SURROGATE, see utf_old.h. + */ +#define UTF_IS_SURROGATE(uchar) (((uchar)&0xfffff800)==0xd800) + +/** + * Is a given 32-bit code point a Unicode noncharacter? + * + * @deprecated ICU 2.4. Renamed to U_IS_UNICODE_NONCHAR, see utf_old.h. + */ +#define UTF_IS_UNICODE_NONCHAR(c) \ + ((c)>=0xfdd0 && \ + ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \ + (uint32_t)(c)<=0x10ffff) + +/** + * Is a given 32-bit value a Unicode code point value (0..U+10ffff) + * that can be assigned a character? + * + * Code points that are not characters include: + * - single surrogate code points (U+d800..U+dfff, 2048 code points) + * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points) + * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points) + * - the highest Unicode code point value is U+10ffff + * + * This means that all code points below U+d800 are character code points, + * and that boundary is tested first for performance. + * + * @deprecated ICU 2.4. Renamed to U_IS_UNICODE_CHAR, see utf_old.h. + */ +#define UTF_IS_UNICODE_CHAR(c) \ + ((uint32_t)(c)<0xd800 || \ + ((uint32_t)(c)>0xdfff && \ + (uint32_t)(c)<=0x10ffff && \ + !UTF_IS_UNICODE_NONCHAR(c))) + +/* Formerly utf8.h ---------------------------------------------------------- */ + +/** +* \var utf8_countTrailBytes +* Internal array with numbers of trail bytes for any given byte used in +* lead byte position. +* +* This is internal since it is not meant to be called directly by external clients; +* however it is called by public macros in this file and thus must remain stable, +* and should not be hidden when other internal functions are hidden (otherwise +* public macros would fail to compile). +* @internal +*/ +#ifdef U_UTF8_IMPL +// No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes. +#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) +U_CFUNC const uint8_t utf8_countTrailBytes[]; +#else +U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_IMPORT*/ +#endif + +/** + * Count the trail bytes for a UTF-8 lead byte. + * @deprecated ICU 2.4. Renamed to U8_COUNT_TRAIL_BYTES, see utf_old.h. + */ +#define UTF8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[(uint8_t)leadByte]) + +/** + * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value. + * @deprecated ICU 2.4. Renamed to U8_MASK_LEAD_BYTE, see utf_old.h. + */ +#define UTF8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1) + +/** Is this this code point a single code unit (byte)? @deprecated ICU 2.4. Renamed to U8_IS_SINGLE, see utf_old.h. */ +#define UTF8_IS_SINGLE(uchar) (((uchar)&0x80)==0) +/** Is this this code unit the lead code unit (byte) of a code point? @deprecated ICU 2.4. Renamed to U8_IS_LEAD, see utf_old.h. */ +#define UTF8_IS_LEAD(uchar) ((uint8_t)((uchar)-0xc0)<0x3e) +/** Is this this code unit a trailing code unit (byte) of a code point? @deprecated ICU 2.4. Renamed to U8_IS_TRAIL, see utf_old.h. */ +#define UTF8_IS_TRAIL(uchar) (((uchar)&0xc0)==0x80) + +/** Does this scalar Unicode value need multiple code units for storage? @deprecated ICU 2.4. Use U8_LENGTH or test ((uint32_t)(c)>0x7f) instead, see utf_old.h. */ +#define UTF8_NEED_MULTIPLE_UCHAR(c) ((uint32_t)(c)>0x7f) + +/** + * Given the lead character, how many bytes are taken by this code point. + * ICU does not deal with code points >0x10ffff + * unless necessary for advancing in the byte stream. + * + * These length macros take into account that for values >0x10ffff + * the UTF8_APPEND_CHAR_SAFE macros would write the error code point 0xffff + * with 3 bytes. + * Code point comparisons need to be in uint32_t because UChar32 + * may be a signed type, and negative values must be recognized. + * + * @deprecated ICU 2.4. Use U8_LENGTH instead, see utf.h. + */ +#if 1 +# define UTF8_CHAR_LENGTH(c) \ + ((uint32_t)(c)<=0x7f ? 1 : \ + ((uint32_t)(c)<=0x7ff ? 2 : \ + ((uint32_t)((c)-0x10000)>0xfffff ? 3 : 4) \ + ) \ + ) +#else +# define UTF8_CHAR_LENGTH(c) \ + ((uint32_t)(c)<=0x7f ? 1 : \ + ((uint32_t)(c)<=0x7ff ? 2 : \ + ((uint32_t)(c)<=0xffff ? 3 : \ + ((uint32_t)(c)<=0x10ffff ? 4 : \ + ((uint32_t)(c)<=0x3ffffff ? 5 : \ + ((uint32_t)(c)<=0x7fffffff ? 6 : 3) \ + ) \ + ) \ + ) \ + ) \ + ) +#endif + +/** The maximum number of bytes per code point. @deprecated ICU 2.4. Renamed to U8_MAX_LENGTH, see utf_old.h. */ +#define UTF8_MAX_CHAR_LENGTH 4 + +/** Average number of code units compared to UTF-16. @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF8_ARRAY_SIZE(size) ((5*(size))/2) + +/** @deprecated ICU 2.4. Renamed to U8_GET_UNSAFE, see utf_old.h. */ +#define UTF8_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t _utf8_get_char_unsafe_index=(int32_t)(i); \ + UTF8_SET_CHAR_START_UNSAFE(s, _utf8_get_char_unsafe_index); \ + UTF8_NEXT_CHAR_UNSAFE(s, _utf8_get_char_unsafe_index, c); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Use U8_GET instead, see utf_old.h. */ +#define UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t _utf8_get_char_safe_index=(int32_t)(i); \ + UTF8_SET_CHAR_START_SAFE(s, start, _utf8_get_char_safe_index); \ + UTF8_NEXT_CHAR_SAFE(s, _utf8_get_char_safe_index, length, c, strict); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_NEXT_UNSAFE, see utf_old.h. */ +#define UTF8_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[(i)++]; \ + if((uint8_t)((c)-0xc0)<0x35) { \ + uint8_t __count=UTF8_COUNT_TRAIL_BYTES(c); \ + UTF8_MASK_LEAD_BYTE(c, __count); \ + switch(__count) { \ + /* each following branch falls through to the next one */ \ + case 3: \ + (c)=((c)<<6)|((s)[(i)++]&0x3f); \ + case 2: \ + (c)=((c)<<6)|((s)[(i)++]&0x3f); \ + case 1: \ + (c)=((c)<<6)|((s)[(i)++]&0x3f); \ + /* no other branches to optimize switch() */ \ + break; \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_APPEND_UNSAFE, see utf_old.h. */ +#define UTF8_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + if((uint32_t)(c)<=0x7f) { \ + (s)[(i)++]=(uint8_t)(c); \ + } else { \ + if((uint32_t)(c)<=0x7ff) { \ + (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \ + } else { \ + if((uint32_t)(c)<=0xffff) { \ + (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \ + } else { \ + (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \ + (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \ + } \ + (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \ + } \ + (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_FWD_1_UNSAFE, see utf_old.h. */ +#define UTF8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + (i)+=1+UTF8_COUNT_TRAIL_BYTES((s)[i]); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_FWD_N_UNSAFE, see utf_old.h. */ +#define UTF8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t __N=(n); \ + while(__N>0) { \ + UTF8_FWD_1_UNSAFE(s, i); \ + --__N; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_SET_CP_START_UNSAFE, see utf_old.h. */ +#define UTF8_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + while(UTF8_IS_TRAIL((s)[i])) { --(i); } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Use U8_NEXT instead, see utf_old.h. */ +#define UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[(i)++]; \ + if((c)>=0x80) { \ + if(UTF8_IS_LEAD(c)) { \ + (c)=utf8_nextCharSafeBody(s, &(i), (int32_t)(length), c, strict); \ + } else { \ + (c)=UTF8_ERROR_VALUE_1; \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Use U8_APPEND instead, see utf_old.h. */ +#define UTF8_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ + if((uint32_t)(c)<=0x7f) { \ + (s)[(i)++]=(uint8_t)(c); \ + } else { \ + (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(length), c, NULL); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_FWD_1, see utf_old.h. */ +#define UTF8_FWD_1_SAFE(s, i, length) U8_FWD_1(s, i, length) + +/** @deprecated ICU 2.4. Renamed to U8_FWD_N, see utf_old.h. */ +#define UTF8_FWD_N_SAFE(s, i, length, n) U8_FWD_N(s, i, length, n) + +/** @deprecated ICU 2.4. Renamed to U8_SET_CP_START, see utf_old.h. */ +#define UTF8_SET_CHAR_START_SAFE(s, start, i) U8_SET_CP_START(s, start, i) + +/** @deprecated ICU 2.4. Renamed to U8_PREV_UNSAFE, see utf_old.h. */ +#define UTF8_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[--(i)]; \ + if(UTF8_IS_TRAIL(c)) { \ + uint8_t __b, __count=1, __shift=6; \ +\ + /* c is a trail byte */ \ + (c)&=0x3f; \ + for(;;) { \ + __b=(s)[--(i)]; \ + if(__b>=0xc0) { \ + UTF8_MASK_LEAD_BYTE(__b, __count); \ + (c)|=(UChar32)__b<<__shift; \ + break; \ + } else { \ + (c)|=(UChar32)(__b&0x3f)<<__shift; \ + ++__count; \ + __shift+=6; \ + } \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_BACK_1_UNSAFE, see utf_old.h. */ +#define UTF8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + while(UTF8_IS_TRAIL((s)[--(i)])) {} \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_BACK_N_UNSAFE, see utf_old.h. */ +#define UTF8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t __N=(n); \ + while(__N>0) { \ + UTF8_BACK_1_UNSAFE(s, i); \ + --__N; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ +#define UTF8_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + UTF8_BACK_1_UNSAFE(s, i); \ + UTF8_FWD_1_UNSAFE(s, i); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Use U8_PREV instead, see utf_old.h. */ +#define UTF8_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[--(i)]; \ + if((c)>=0x80) { \ + if((c)<=0xbf) { \ + (c)=utf8_prevCharSafeBody(s, start, &(i), c, strict); \ + } else { \ + (c)=UTF8_ERROR_VALUE_1; \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U8_BACK_1, see utf_old.h. */ +#define UTF8_BACK_1_SAFE(s, start, i) U8_BACK_1(s, start, i) + +/** @deprecated ICU 2.4. Renamed to U8_BACK_N, see utf_old.h. */ +#define UTF8_BACK_N_SAFE(s, start, i, n) U8_BACK_N(s, start, i, n) + +/** @deprecated ICU 2.4. Renamed to U8_SET_CP_LIMIT, see utf_old.h. */ +#define UTF8_SET_CHAR_LIMIT_SAFE(s, start, i, length) U8_SET_CP_LIMIT(s, start, i, length) + +/* Formerly utf16.h --------------------------------------------------------- */ + +/** Is uchar a first/lead surrogate? @deprecated ICU 2.4. Renamed to U_IS_LEAD and U16_IS_LEAD, see utf_old.h. */ +#define UTF_IS_FIRST_SURROGATE(uchar) (((uchar)&0xfffffc00)==0xd800) + +/** Is uchar a second/trail surrogate? @deprecated ICU 2.4. Renamed to U_IS_TRAIL and U16_IS_TRAIL, see utf_old.h. */ +#define UTF_IS_SECOND_SURROGATE(uchar) (((uchar)&0xfffffc00)==0xdc00) + +/** Assuming c is a surrogate, is it a first/lead surrogate? @deprecated ICU 2.4. Renamed to U_IS_SURROGATE_LEAD and U16_IS_SURROGATE_LEAD, see utf_old.h. */ +#define UTF_IS_SURROGATE_FIRST(c) (((c)&0x400)==0) + +/** Helper constant for UTF16_GET_PAIR_VALUE. @deprecated ICU 2.4. Renamed to U16_SURROGATE_OFFSET, see utf_old.h. */ +#define UTF_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) + +/** Get the UTF-32 value from the surrogate code units. @deprecated ICU 2.4. Renamed to U16_GET_SUPPLEMENTARY, see utf_old.h. */ +#define UTF16_GET_PAIR_VALUE(first, second) \ + (((first)<<10UL)+(second)-UTF_SURROGATE_OFFSET) + +/** @deprecated ICU 2.4. Renamed to U16_LEAD, see utf_old.h. */ +#define UTF_FIRST_SURROGATE(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) + +/** @deprecated ICU 2.4. Renamed to U16_TRAIL, see utf_old.h. */ +#define UTF_SECOND_SURROGATE(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) + +/** @deprecated ICU 2.4. Renamed to U16_LEAD, see utf_old.h. */ +#define UTF16_LEAD(supplementary) UTF_FIRST_SURROGATE(supplementary) + +/** @deprecated ICU 2.4. Renamed to U16_TRAIL, see utf_old.h. */ +#define UTF16_TRAIL(supplementary) UTF_SECOND_SURROGATE(supplementary) + +/** @deprecated ICU 2.4. Renamed to U16_IS_SINGLE, see utf_old.h. */ +#define UTF16_IS_SINGLE(uchar) !UTF_IS_SURROGATE(uchar) + +/** @deprecated ICU 2.4. Renamed to U16_IS_LEAD, see utf_old.h. */ +#define UTF16_IS_LEAD(uchar) UTF_IS_FIRST_SURROGATE(uchar) + +/** @deprecated ICU 2.4. Renamed to U16_IS_TRAIL, see utf_old.h. */ +#define UTF16_IS_TRAIL(uchar) UTF_IS_SECOND_SURROGATE(uchar) + +/** Does this scalar Unicode value need multiple code units for storage? @deprecated ICU 2.4. Use U16_LENGTH or test ((uint32_t)(c)>0xffff) instead, see utf_old.h. */ +#define UTF16_NEED_MULTIPLE_UCHAR(c) ((uint32_t)(c)>0xffff) + +/** @deprecated ICU 2.4. Renamed to U16_LENGTH, see utf_old.h. */ +#define UTF16_CHAR_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2) + +/** @deprecated ICU 2.4. Renamed to U16_MAX_LENGTH, see utf_old.h. */ +#define UTF16_MAX_CHAR_LENGTH 2 + +/** Average number of code units compared to UTF-16. @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF16_ARRAY_SIZE(size) (size) + +/** + * Get a single code point from an offset that points to any + * of the code units that belong to that code point. + * Assume 0<=i=(start) && UTF_IS_FIRST_SURROGATE(__c2=(s)[(i)-1])) { \ + (c)=UTF16_GET_PAIR_VALUE(__c2, (c)); \ + /* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \ + } else if(strict) {\ + /* unmatched second surrogate */ \ + (c)=UTF_ERROR_VALUE; \ + } \ + } \ + } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ + (c)=UTF_ERROR_VALUE; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h. */ +#define UTF16_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[(i)++]; \ + if(UTF_IS_FIRST_SURROGATE(c)) { \ + (c)=UTF16_GET_PAIR_VALUE((c), (s)[(i)++]); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h. */ +#define UTF16_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + if((uint32_t)(c)<=0xffff) { \ + (s)[(i)++]=(uint16_t)(c); \ + } else { \ + (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ + (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h. */ +#define UTF16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTF_IS_FIRST_SURROGATE((s)[(i)++])) { \ + ++(i); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h. */ +#define UTF16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t __N=(n); \ + while(__N>0) { \ + UTF16_FWD_1_UNSAFE(s, i); \ + --__N; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h. */ +#define UTF16_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTF_IS_SECOND_SURROGATE((s)[i])) { \ + --(i); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Use U16_NEXT instead, see utf_old.h. */ +#define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[(i)++]; \ + if(UTF_IS_FIRST_SURROGATE(c)) { \ + uint16_t __c2; \ + if((i)<(length) && UTF_IS_SECOND_SURROGATE(__c2=(s)[(i)])) { \ + ++(i); \ + (c)=UTF16_GET_PAIR_VALUE((c), __c2); \ + /* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \ + } else if(strict) {\ + /* unmatched first surrogate */ \ + (c)=UTF_ERROR_VALUE; \ + } \ + } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ + /* unmatched second surrogate or other non-character */ \ + (c)=UTF_ERROR_VALUE; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Use U16_APPEND instead, see utf_old.h. */ +#define UTF16_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ + if((uint32_t)(c)<=0xffff) { \ + (s)[(i)++]=(uint16_t)(c); \ + } else if((uint32_t)(c)<=0x10ffff) { \ + if((i)+1<(length)) { \ + (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ + (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ + } else /* not enough space */ { \ + (s)[(i)++]=UTF_ERROR_VALUE; \ + } \ + } else /* c>0x10ffff, write error value */ { \ + (s)[(i)++]=UTF_ERROR_VALUE; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_FWD_1, see utf_old.h. */ +#define UTF16_FWD_1_SAFE(s, i, length) U16_FWD_1(s, i, length) + +/** @deprecated ICU 2.4. Renamed to U16_FWD_N, see utf_old.h. */ +#define UTF16_FWD_N_SAFE(s, i, length, n) U16_FWD_N(s, i, length, n) + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START, see utf_old.h. */ +#define UTF16_SET_CHAR_START_SAFE(s, start, i) U16_SET_CP_START(s, start, i) + +/** @deprecated ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h. */ +#define UTF16_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[--(i)]; \ + if(UTF_IS_SECOND_SURROGATE(c)) { \ + (c)=UTF16_GET_PAIR_VALUE((s)[--(i)], (c)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h. */ +#define UTF16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTF_IS_SECOND_SURROGATE((s)[--(i)])) { \ + --(i); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h. */ +#define UTF16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t __N=(n); \ + while(__N>0) { \ + UTF16_BACK_1_UNSAFE(s, i); \ + --__N; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ +#define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTF_IS_FIRST_SURROGATE((s)[(i)-1])) { \ + ++(i); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Use U16_PREV instead, see utf_old.h. */ +#define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[--(i)]; \ + if(UTF_IS_SECOND_SURROGATE(c)) { \ + uint16_t __c2; \ + if((i)>(start) && UTF_IS_FIRST_SURROGATE(__c2=(s)[(i)-1])) { \ + --(i); \ + (c)=UTF16_GET_PAIR_VALUE(__c2, (c)); \ + /* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \ + } else if(strict) {\ + /* unmatched second surrogate */ \ + (c)=UTF_ERROR_VALUE; \ + } \ + } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ + /* unmatched first surrogate or other non-character */ \ + (c)=UTF_ERROR_VALUE; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Renamed to U16_BACK_1, see utf_old.h. */ +#define UTF16_BACK_1_SAFE(s, start, i) U16_BACK_1(s, start, i) + +/** @deprecated ICU 2.4. Renamed to U16_BACK_N, see utf_old.h. */ +#define UTF16_BACK_N_SAFE(s, start, i, n) U16_BACK_N(s, start, i, n) + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT, see utf_old.h. */ +#define UTF16_SET_CHAR_LIMIT_SAFE(s, start, i, length) U16_SET_CP_LIMIT(s, start, i, length) + +/* Formerly utf32.h --------------------------------------------------------- */ + +/* +* Old documentation: +* +* This file defines macros to deal with UTF-32 code units and code points. +* Signatures and semantics are the same as for the similarly named macros +* in utf16.h. +* utf32.h is included by utf.h after unicode/umachine.h

+* and some common definitions. +*

Usage: ICU coding guidelines for if() statements should be followed when using these macros. +* Compound statements (curly braces {}) must be used for if-else-while... +* bodies and all macro statements should be terminated with semicolon.

+*/ + +/* internal definitions ----------------------------------------------------- */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_IS_SAFE(c, strict) \ + (!(strict) ? \ + (uint32_t)(c)<=0x10ffff : \ + UTF_IS_UNICODE_CHAR(c)) + +/* + * For the semantics of all of these macros, see utf16.h. + * The UTF-32 versions are trivial because any code point is + * encoded using exactly one code unit. + */ + +/* single-code point definitions -------------------------------------------- */ + +/* classes of code unit values */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_IS_SINGLE(uchar) 1 +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_IS_LEAD(uchar) 0 +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_IS_TRAIL(uchar) 0 + +/* number of code units per code point */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_NEED_MULTIPLE_UCHAR(c) 0 +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_CHAR_LENGTH(c) 1 +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_MAX_CHAR_LENGTH 1 + +/* average number of code units compared to UTF-16 */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_ARRAY_SIZE(size) (size) + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[i]; \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[i]; \ + if(!UTF32_IS_SAFE(c, strict)) { \ + (c)=UTF_ERROR_VALUE; \ + } \ +} UPRV_BLOCK_MACRO_END + +/* definitions with forward iteration --------------------------------------- */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[(i)++]; \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + (s)[(i)++]=(c); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + ++(i); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ + (i)+=(n); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[(i)++]; \ + if(!UTF32_IS_SAFE(c, strict)) { \ + (c)=UTF_ERROR_VALUE; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ + if((uint32_t)(c)<=0x10ffff) { \ + (s)[(i)++]=(c); \ + } else /* c>0x10ffff, write 0xfffd */ { \ + (s)[(i)++]=0xfffd; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_FWD_1_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ + ++(i); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_FWD_N_SAFE(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \ + if(((i)+=(n))>(length)) { \ + (i)=(length); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_SET_CHAR_START_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ +} UPRV_BLOCK_MACRO_END + +/* definitions with backward iteration -------------------------------------- */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[--(i)]; \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + --(i); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ + (i)-=(n); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[--(i)]; \ + if(!UTF32_IS_SAFE(c, strict)) { \ + (c)=UTF_ERROR_VALUE; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_BACK_1_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ + --(i); \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_BACK_N_SAFE(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \ + (i)-=(n); \ + if((i)<(start)) { \ + (i)=(start); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ +} UPRV_BLOCK_MACRO_END + +/* Formerly utf.h, part 2 --------------------------------------------------- */ + +/** + * Estimate the number of code units for a string based on the number of UTF-16 code units. + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_ARRAY_SIZE(size) UTF16_ARRAY_SIZE(size) + +/** @deprecated ICU 2.4. Renamed to U16_GET_UNSAFE, see utf_old.h. */ +#define UTF_GET_CHAR_UNSAFE(s, i, c) UTF16_GET_CHAR_UNSAFE(s, i, c) + +/** @deprecated ICU 2.4. Use U16_GET instead, see utf_old.h. */ +#define UTF_GET_CHAR_SAFE(s, start, i, length, c, strict) UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict) + + +/** @deprecated ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h. */ +#define UTF_NEXT_CHAR_UNSAFE(s, i, c) UTF16_NEXT_CHAR_UNSAFE(s, i, c) + +/** @deprecated ICU 2.4. Use U16_NEXT instead, see utf_old.h. */ +#define UTF_NEXT_CHAR_SAFE(s, i, length, c, strict) UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) + + +/** @deprecated ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h. */ +#define UTF_APPEND_CHAR_UNSAFE(s, i, c) UTF16_APPEND_CHAR_UNSAFE(s, i, c) + +/** @deprecated ICU 2.4. Use U16_APPEND instead, see utf_old.h. */ +#define UTF_APPEND_CHAR_SAFE(s, i, length, c) UTF16_APPEND_CHAR_SAFE(s, i, length, c) + + +/** @deprecated ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h. */ +#define UTF_FWD_1_UNSAFE(s, i) UTF16_FWD_1_UNSAFE(s, i) + +/** @deprecated ICU 2.4. Renamed to U16_FWD_1, see utf_old.h. */ +#define UTF_FWD_1_SAFE(s, i, length) UTF16_FWD_1_SAFE(s, i, length) + + +/** @deprecated ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h. */ +#define UTF_FWD_N_UNSAFE(s, i, n) UTF16_FWD_N_UNSAFE(s, i, n) + +/** @deprecated ICU 2.4. Renamed to U16_FWD_N, see utf_old.h. */ +#define UTF_FWD_N_SAFE(s, i, length, n) UTF16_FWD_N_SAFE(s, i, length, n) + + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h. */ +#define UTF_SET_CHAR_START_UNSAFE(s, i) UTF16_SET_CHAR_START_UNSAFE(s, i) + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START, see utf_old.h. */ +#define UTF_SET_CHAR_START_SAFE(s, start, i) UTF16_SET_CHAR_START_SAFE(s, start, i) + + +/** @deprecated ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h. */ +#define UTF_PREV_CHAR_UNSAFE(s, i, c) UTF16_PREV_CHAR_UNSAFE(s, i, c) + +/** @deprecated ICU 2.4. Use U16_PREV instead, see utf_old.h. */ +#define UTF_PREV_CHAR_SAFE(s, start, i, c, strict) UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) + + +/** @deprecated ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h. */ +#define UTF_BACK_1_UNSAFE(s, i) UTF16_BACK_1_UNSAFE(s, i) + +/** @deprecated ICU 2.4. Renamed to U16_BACK_1, see utf_old.h. */ +#define UTF_BACK_1_SAFE(s, start, i) UTF16_BACK_1_SAFE(s, start, i) + + +/** @deprecated ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h. */ +#define UTF_BACK_N_UNSAFE(s, i, n) UTF16_BACK_N_UNSAFE(s, i, n) + +/** @deprecated ICU 2.4. Renamed to U16_BACK_N, see utf_old.h. */ +#define UTF_BACK_N_SAFE(s, start, i, n) UTF16_BACK_N_SAFE(s, start, i, n) + + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ +#define UTF_SET_CHAR_LIMIT_UNSAFE(s, i) UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT, see utf_old.h. */ +#define UTF_SET_CHAR_LIMIT_SAFE(s, start, i, length) UTF16_SET_CHAR_LIMIT_SAFE(s, start, i, length) + +/* Define default macros (UTF-16 "safe") ------------------------------------ */ + +/** + * Does this code unit alone encode a code point (BMP, not a surrogate)? + * Same as UTF16_IS_SINGLE. + * @deprecated ICU 2.4. Renamed to U_IS_SINGLE and U16_IS_SINGLE, see utf_old.h. + */ +#define UTF_IS_SINGLE(uchar) U16_IS_SINGLE(uchar) + +/** + * Is this code unit the first one of several (a lead surrogate)? + * Same as UTF16_IS_LEAD. + * @deprecated ICU 2.4. Renamed to U_IS_LEAD and U16_IS_LEAD, see utf_old.h. + */ +#define UTF_IS_LEAD(uchar) U16_IS_LEAD(uchar) + +/** + * Is this code unit one of several but not the first one (a trail surrogate)? + * Same as UTF16_IS_TRAIL. + * @deprecated ICU 2.4. Renamed to U_IS_TRAIL and U16_IS_TRAIL, see utf_old.h. + */ +#define UTF_IS_TRAIL(uchar) U16_IS_TRAIL(uchar) + +/** + * Does this code point require multiple code units (is it a supplementary code point)? + * Same as UTF16_NEED_MULTIPLE_UCHAR. + * @deprecated ICU 2.4. Use U16_LENGTH or test ((uint32_t)(c)>0xffff) instead. + */ +#define UTF_NEED_MULTIPLE_UCHAR(c) UTF16_NEED_MULTIPLE_UCHAR(c) + +/** + * How many code units are used to encode this code point (1 or 2)? + * Same as UTF16_CHAR_LENGTH. + * @deprecated ICU 2.4. Renamed to U16_LENGTH, see utf_old.h. + */ +#define UTF_CHAR_LENGTH(c) U16_LENGTH(c) + +/** + * How many code units are used at most for any Unicode code point (2)? + * Same as UTF16_MAX_CHAR_LENGTH. + * @deprecated ICU 2.4. Renamed to U16_MAX_LENGTH, see utf_old.h. + */ +#define UTF_MAX_CHAR_LENGTH U16_MAX_LENGTH + +/** + * Set c to the code point that contains the code unit i. + * i could point to the lead or the trail surrogate for the code point. + * i is not modified. + * Same as UTF16_GET_CHAR. + * \pre 0<=i +#include "unicode/utypes.h" + +/** + * \file + * \brief C API: Definitions for ICU tracing/logging. + * + * This provides API for debugging the internals of ICU without the use of + * a traditional debugger. + * + * By default, tracing is disabled in ICU. If you need to debug ICU with + * tracing, please compile ICU with the --enable-tracing configure option. + */ + +U_CDECL_BEGIN + +/** + * Trace severity levels. Higher levels increase the verbosity of the trace output. + * @see utrace_setLevel + * @stable ICU 2.8 + */ +typedef enum UTraceLevel { + /** Disable all tracing @stable ICU 2.8*/ + UTRACE_OFF=-1, + /** Trace error conditions only @stable ICU 2.8*/ + UTRACE_ERROR=0, + /** Trace errors and warnings @stable ICU 2.8*/ + UTRACE_WARNING=3, + /** Trace opens and closes of ICU services @stable ICU 2.8*/ + UTRACE_OPEN_CLOSE=5, + /** Trace an intermediate number of ICU operations @stable ICU 2.8*/ + UTRACE_INFO=7, + /** Trace the maximum number of ICU operations @stable ICU 2.8*/ + UTRACE_VERBOSE=9 +} UTraceLevel; + +/** + * These are the ICU functions that will be traced when tracing is enabled. + * @stable ICU 2.8 + */ +typedef enum UTraceFunctionNumber { + UTRACE_FUNCTION_START=0, + UTRACE_U_INIT=UTRACE_FUNCTION_START, + UTRACE_U_CLEANUP, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal collation trace location. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_FUNCTION_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + UTRACE_CONVERSION_START=0x1000, + UTRACE_UCNV_OPEN=UTRACE_CONVERSION_START, + UTRACE_UCNV_OPEN_PACKAGE, + UTRACE_UCNV_OPEN_ALGORITHMIC, + UTRACE_UCNV_CLONE, + UTRACE_UCNV_CLOSE, + UTRACE_UCNV_FLUSH_CACHE, + UTRACE_UCNV_LOAD, + UTRACE_UCNV_UNLOAD, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal collation trace location. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_CONVERSION_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + UTRACE_COLLATION_START=0x2000, + UTRACE_UCOL_OPEN=UTRACE_COLLATION_START, + UTRACE_UCOL_CLOSE, + UTRACE_UCOL_STRCOLL, + UTRACE_UCOL_GET_SORTKEY, + UTRACE_UCOL_GETLOCALE, + UTRACE_UCOL_NEXTSORTKEYPART, + UTRACE_UCOL_STRCOLLITER, + UTRACE_UCOL_OPEN_FROM_SHORT_STRING, + UTRACE_UCOL_STRCOLLUTF8, /**< @stable ICU 50 */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal collation trace location. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_COLLATION_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + /** + * The lowest resource/data location. + * @stable ICU 65 + */ + UTRACE_UDATA_START=0x3000, + + /** + * Indicates that a value was read from a resource bundle. Provides three + * C-style strings to UTraceData: type, file name, and resource path. The + * possible types are: + * + * - "string" (a string value was accessed) + * - "binary" (a binary value was accessed) + * - "intvector" (a integer vector value was accessed) + * - "int" (a signed integer value was accessed) + * - "uint" (a unsigned integer value was accessed) + * - "get" (a path was loaded, but the value was not accessed) + * - "getalias" (a path was loaded, and an alias was resolved) + * + * @stable ICU 65 + */ + UTRACE_UDATA_RESOURCE=UTRACE_UDATA_START, + + /** + * Indicates that a resource bundle was opened. + * + * Provides one C-style string to UTraceData: file name. + * @stable ICU 65 + */ + UTRACE_UDATA_BUNDLE, + + /** + * Indicates that a data file was opened, but not *.res files. + * + * Provides one C-style string to UTraceData: file name. + * + * @stable ICU 65 + */ + UTRACE_UDATA_DATA_FILE, + + /** + * Indicates that a *.res file was opened. + * + * This differs from UTRACE_UDATA_BUNDLE because a res file is typically + * opened only once per application runtime, but the bundle corresponding + * to that res file may be opened many times. + * + * Provides one C-style string to UTraceData: file name. + * + * @stable ICU 65 + */ + UTRACE_UDATA_RES_FILE, + +#ifndef U_HIDE_INTERNAL_API + /** + * One more than the highest normal resource/data trace location. + * @internal The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_RES_DATA_LIMIT, +#endif // U_HIDE_INTERNAL_API + + /** + * The lowest break iterator location. + * @stable ICU 67 + */ + UTRACE_UBRK_START=0x4000, + + /** + * Indicates that a character instance of break iterator was created. + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_CHARACTER = UTRACE_UBRK_START, + + /** + * Indicates that a word instance of break iterator was created. + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_WORD, + + /** + * Indicates that a line instance of break iterator was created. + * + * Provides one C-style string to UTraceData: the lb value ("", + * "loose", "strict", or "normal"). + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_LINE, + + /** + * Indicates that a sentence instance of break iterator was created. + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_SENTENCE, + + /** + * Indicates that a title instance of break iterator was created. + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_TITLE, + + /** + * Indicates that an internal dictionary break engine was created. + * + * Provides one C-style string to UTraceData: the script code of what + * the break engine cover ("Hani", "Khmr", "Laoo", "Mymr", or "Thai"). + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_BREAK_ENGINE, + +#ifndef U_HIDE_INTERNAL_API + /** + * One more than the highest normal break iterator trace location. + * @internal The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_UBRK_LIMIT, +#endif // U_HIDE_INTERNAL_API + +} UTraceFunctionNumber; + +/** + * Setter for the trace level. + * @param traceLevel A UTraceLevel value. + * @stable ICU 2.8 + */ +U_CAPI void U_EXPORT2 +utrace_setLevel(int32_t traceLevel); + +/** + * Getter for the trace level. + * @return The UTraceLevel value being used by ICU. + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +utrace_getLevel(void); + +/* Trace function pointers types ----------------------------- */ + +/** + * Type signature for the trace function to be called when entering a function. + * @param context value supplied at the time the trace functions are set. + * @param fnNumber Enum value indicating the ICU function being entered. + * @stable ICU 2.8 + */ +typedef void U_CALLCONV +UTraceEntry(const void *context, int32_t fnNumber); + +/** + * Type signature for the trace function to be called when exiting from a function. + * @param context value supplied at the time the trace functions are set. + * @param fnNumber Enum value indicating the ICU function being exited. + * @param fmt A formatting string that describes the number and types + * of arguments included with the variable args. The fmt + * string has the same form as the utrace_vformat format + * string. + * @param args A variable arguments list. Contents are described by + * the fmt parameter. + * @see utrace_vformat + * @stable ICU 2.8 + */ +typedef void U_CALLCONV +UTraceExit(const void *context, int32_t fnNumber, + const char *fmt, va_list args); + +/** + * Type signature for the trace function to be called from within an ICU function + * to display data or messages. + * @param context value supplied at the time the trace functions are set. + * @param fnNumber Enum value indicating the ICU function being exited. + * @param level The current tracing level + * @param fmt A format string describing the tracing data that is supplied + * as variable args + * @param args The data being traced, passed as variable args. + * @stable ICU 2.8 + */ +typedef void U_CALLCONV +UTraceData(const void *context, int32_t fnNumber, int32_t level, + const char *fmt, va_list args); + +/** + * Set ICU Tracing functions. Installs application-provided tracing + * functions into ICU. After doing this, subsequent ICU operations + * will call back to the installed functions, providing a trace + * of the use of ICU. Passing a NULL pointer for a tracing function + * is allowed, and inhibits tracing action at points where that function + * would be called. + *

+ * Tracing and Threads: Tracing functions are global to a process, and + * will be called in response to ICU operations performed by any + * thread. If tracing of an individual thread is desired, the + * tracing functions must themselves filter by checking that the + * current thread is the desired thread. + * + * @param context an uninterpreted pointer. Whatever is passed in + * here will in turn be passed to each of the tracing + * functions UTraceEntry, UTraceExit and UTraceData. + * ICU does not use or alter this pointer. + * @param e Callback function to be called on entry to a + * a traced ICU function. + * @param x Callback function to be called on exit from a + * traced ICU function. + * @param d Callback function to be called from within a + * traced ICU function, for the purpose of providing + * data to the trace. + * + * @stable ICU 2.8 + */ +U_CAPI void U_EXPORT2 +utrace_setFunctions(const void *context, + UTraceEntry *e, UTraceExit *x, UTraceData *d); + +/** + * Get the currently installed ICU tracing functions. Note that a null function + * pointer will be returned if no trace function has been set. + * + * @param context The currently installed tracing context. + * @param e The currently installed UTraceEntry function. + * @param x The currently installed UTraceExit function. + * @param d The currently installed UTraceData function. + * @stable ICU 2.8 + */ +U_CAPI void U_EXPORT2 +utrace_getFunctions(const void **context, + UTraceEntry **e, UTraceExit **x, UTraceData **d); + + + +/* + * + * ICU trace format string syntax + * + * Format Strings are passed to UTraceData functions, and define the + * number and types of the trace data being passed on each call. + * + * The UTraceData function, which is supplied by the application, + * not by ICU, can either forward the trace data (passed via + * varargs) and the format string back to ICU for formatting into + * a displayable string, or it can interpret the format itself, + * and do as it wishes with the trace data. + * + * + * Goals for the format string + * - basic data output + * - easy to use for trace programmer + * - sufficient provision for data types for trace output readability + * - well-defined types and binary portable APIs + * + * Non-goals + * - printf compatibility + * - fancy formatting + * - argument reordering and other internationalization features + * + * ICU trace format strings contain plain text with argument inserts, + * much like standard printf format strings. + * Each insert begins with a '%', then optionally contains a 'v', + * then exactly one type character. + * Two '%' in a row represent a '%' instead of an insert. + * The trace format strings need not have \n at the end. + * + * + * Types + * ----- + * + * Type characters: + * - c A char character in the default codepage. + * - s A NUL-terminated char * string in the default codepage. + * - S A UChar * string. Requires two params, (ptr, length). Length=-1 for nul term. + * - b A byte (8-bit integer). + * - h A 16-bit integer. Also a 16 bit Unicode code unit. + * - d A 32-bit integer. Also a 20 bit Unicode code point value. + * - l A 64-bit integer. + * - p A data pointer. + * + * Vectors + * ------- + * + * If the 'v' is not specified, then one item of the specified type + * is passed in. + * If the 'v' (for "vector") is specified, then a vector of items of the + * specified type is passed in, via a pointer to the first item + * and an int32_t value for the length of the vector. + * Length==-1 means zero or NUL termination. Works for vectors of all types. + * + * Note: %vS is a vector of (UChar *) strings. The strings must + * be nul terminated as there is no way to provide a + * separate length parameter for each string. The length + * parameter (required for all vectors) is the number of + * strings, not the length of the strings. + * + * Examples + * -------- + * + * These examples show the parameters that will be passed to an application's + * UTraceData() function for various formats. + * + * - the precise formatting is up to the application! + * - the examples use type casts for arguments only to _show_ the types of + * arguments without needing variable declarations in the examples; + * the type casts will not be necessary in actual code + * + * UTraceDataFunc(context, fnNumber, level, + * "There is a character %c in the string %s.", // Format String + * (char)c, (const char *)s); // varargs parameters + * -> There is a character 0x42 'B' in the string "Bravo". + * + * UTraceDataFunc(context, fnNumber, level, + * "Vector of bytes %vb vector of chars %vc", + * (const uint8_t *)bytes, (int32_t)bytesLength, + * (const char *)chars, (int32_t)charsLength); + * -> Vector of bytes + * 42 63 64 3f [4] + * vector of chars + * "Bcd?"[4] + * + * UTraceDataFunc(context, fnNumber, level, + * "An int32_t %d and a whole bunch of them %vd", + * (int32_t)-5, (const int32_t *)ints, (int32_t)intsLength); + * -> An int32_t 0xfffffffb and a whole bunch of them + * fffffffb 00000005 0000010a [3] + * + */ + + + +/** + * Trace output Formatter. An application's UTraceData tracing functions may call + * back to this function to format the trace output in a + * human readable form. Note that a UTraceData function may choose + * to not format the data; it could, for example, save it in + * in the raw form it was received (more compact), leaving + * formatting for a later trace analysis tool. + * @param outBuf pointer to a buffer to receive the formatted output. Output + * will be nul terminated if there is space in the buffer - + * if the length of the requested output < the output buffer size. + * @param capacity Length of the output buffer. + * @param indent Number of spaces to indent the output. Intended to allow + * data displayed from nested functions to be indented for readability. + * @param fmt Format specification for the data to output + * @param args Data to be formatted. + * @return Length of formatted output, including the terminating NUL. + * If buffer capacity is insufficient, the required capacity is returned. + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +utrace_vformat(char *outBuf, int32_t capacity, + int32_t indent, const char *fmt, va_list args); + +/** + * Trace output Formatter. An application's UTraceData tracing functions may call + * this function to format any additional trace data, beyond that + * provided by default, in human readable form with the same + * formatting conventions used by utrace_vformat(). + * @param outBuf pointer to a buffer to receive the formatted output. Output + * will be nul terminated if there is space in the buffer - + * if the length of the requested output < the output buffer size. + * @param capacity Length of the output buffer. + * @param indent Number of spaces to indent the output. Intended to allow + * data displayed from nested functions to be indented for readability. + * @param fmt Format specification for the data to output + * @param ... Data to be formatted. + * @return Length of formatted output, including the terminating NUL. + * If buffer capacity is insufficient, the required capacity is returned. + * @stable ICU 2.8 + */ +U_CAPI int32_t U_EXPORT2 +utrace_format(char *outBuf, int32_t capacity, + int32_t indent, const char *fmt, ...); + + + +/* Trace function numbers --------------------------------------------------- */ + +/** + * Get the name of a function from its trace function number. + * + * @param fnNumber The trace number for an ICU function. + * @return The name string for the function. + * + * @see UTraceFunctionNumber + * @stable ICU 2.8 + */ +U_CAPI const char * U_EXPORT2 +utrace_functionName(int32_t fnNumber); + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utypes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utypes.h new file mode 100644 index 0000000000000000000000000000000000000000..7c4ea7ac28dc7b959de93322b6f9d53708fc0474 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/utypes.h @@ -0,0 +1,732 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1996-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* FILE NAME : UTYPES.H (formerly ptypes.h) +* +* Date Name Description +* 12/11/96 helena Creation. +* 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32, +* uint8, uint16, and uint32. +* 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C as +* well as C++. +* Modified to use memcpy() for uprv_arrayCopy() fns. +* 04/14/97 aliu Added TPlatformUtilities. +* 05/07/97 aliu Added import/export specifiers (replacing the old +* broken EXT_CLASS). Added version number for our +* code. Cleaned up header. +* 6/20/97 helena Java class name change. +* 08/11/98 stephen UErrorCode changed from typedef to enum +* 08/12/98 erm Changed T_ANALYTIC_PACKAGE_VERSION to 3 +* 08/14/98 stephen Added uprv_arrayCopy() for int8_t, int16_t, int32_t +* 12/09/98 jfitz Added BUFFER_OVERFLOW_ERROR (bug 1100066) +* 04/20/99 stephen Cleaned up & reworked for autoconf. +* Renamed to utypes.h. +* 05/05/99 stephen Changed to use +* 12/07/99 helena Moved copyright notice string from ucnv_bld.h here. +******************************************************************************* +*/ + +#ifndef UTYPES_H +#define UTYPES_H + + +#include "unicode/umachine.h" +#include "unicode/uversion.h" +#include "unicode/uconfig.h" +#include + +#if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS +# include "unicode/utf.h" +#endif + +/*! + * \file + * \brief Basic definitions for ICU, for both C and C++ APIs + * + * This file defines basic types, constants, and enumerations directly or + * indirectly by including other header files, especially utf.h for the + * basic character and string definitions and umachine.h for consistent + * integer and other types. + */ + + +/** + * \def U_SHOW_CPLUSPLUS_API + * @internal + */ +#ifdef __cplusplus +# ifndef U_SHOW_CPLUSPLUS_API +# define U_SHOW_CPLUSPLUS_API 1 +# endif +#else +# undef U_SHOW_CPLUSPLUS_API +# define U_SHOW_CPLUSPLUS_API 0 +#endif + +/** @{ API visibility control */ + +/** + * \def U_HIDE_DRAFT_API + * Define this to 1 to request that draft API be "hidden" + * @internal + */ +/** + * \def U_HIDE_INTERNAL_API + * Define this to 1 to request that internal API be "hidden" + * @internal + */ +#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API) +#define U_HIDE_DRAFT_API 1 +#endif +#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_INTERNAL_API) +#define U_HIDE_INTERNAL_API 1 +#endif + +/** @} */ + +/*===========================================================================*/ +/* ICUDATA naming scheme */ +/*===========================================================================*/ + +/** + * \def U_ICUDATA_TYPE_LETTER + * + * This is a platform-dependent string containing one letter: + * - b for big-endian, ASCII-family platforms + * - l for little-endian, ASCII-family platforms + * - e for big-endian, EBCDIC-family platforms + * This letter is part of the common data file name. + * @stable ICU 2.0 + */ + +/** + * \def U_ICUDATA_TYPE_LITLETTER + * The non-string form of U_ICUDATA_TYPE_LETTER + * @stable ICU 2.0 + */ +#if U_CHARSET_FAMILY +# if U_IS_BIG_ENDIAN + /* EBCDIC - should always be BE */ +# define U_ICUDATA_TYPE_LETTER "e" +# define U_ICUDATA_TYPE_LITLETTER e +# else +# error "Don't know what to do with little endian EBCDIC!" +# define U_ICUDATA_TYPE_LETTER "x" +# define U_ICUDATA_TYPE_LITLETTER x +# endif +#else +# if U_IS_BIG_ENDIAN + /* Big-endian ASCII */ +# define U_ICUDATA_TYPE_LETTER "b" +# define U_ICUDATA_TYPE_LITLETTER b +# else + /* Little-endian ASCII */ +# define U_ICUDATA_TYPE_LETTER "l" +# define U_ICUDATA_TYPE_LITLETTER l +# endif +#endif + +/** + * A single string literal containing the icudata stub name. i.e. 'icudt18e' for + * ICU 1.8.x on EBCDIC, etc.. + * @stable ICU 2.0 + */ +#define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER +#ifndef U_HIDE_INTERNAL_API +#define U_USRDATA_NAME "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER /**< @internal */ +#define U_USE_USRDATA 0 /**< @internal */ +#endif /* U_HIDE_INTERNAL_API */ + +/** + * U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library. + * Defined as a literal, not a string. + * Tricky Preprocessor use - ## operator replaces macro parameters with the literal string + * from the corresponding macro invocation, _before_ other macro substitutions. + * Need a nested \#defines to get the actual version numbers rather than + * the literal text U_ICU_VERSION_MAJOR_NUM into the name. + * The net result will be something of the form + * \#define U_ICU_ENTRY_POINT icudt19_dat + * @stable ICU 2.4 + */ +#define U_ICUDATA_ENTRY_POINT U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM,U_LIB_SUFFIX_C_NAME) + +#ifndef U_HIDE_INTERNAL_API +/** + * Do not use. Note that it's OK for the 2nd argument to be undefined (literal). + * @internal + */ +#define U_DEF2_ICUDATA_ENTRY_POINT(major,suff) U_DEF_ICUDATA_ENTRY_POINT(major,suff) + +/** + * Do not use. + * @internal + */ +#ifndef U_DEF_ICUDATA_ENTRY_POINT +/* affected by symbol renaming. See platform.h */ +#ifndef U_LIB_SUFFIX_C_NAME +#define U_DEF_ICUDATA_ENTRY_POINT(major, suff) icudt##major##_dat +#else +#define U_DEF_ICUDATA_ENTRY_POINT(major, suff) icudt##suff ## major##_dat +#endif +#endif +#endif /* U_HIDE_INTERNAL_API */ + +/** + * \def NULL + * Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C. + * @stable ICU 2.0 + */ +#ifndef NULL +#ifdef __cplusplus +#define NULL nullptr +#else +#define NULL ((void *)0) +#endif +#endif + +/*===========================================================================*/ +/* Calendar/TimeZone data types */ +/*===========================================================================*/ + +/** + * Date and Time data type. + * This is a primitive data type that holds the date and time + * as the number of milliseconds since 1970-jan-01, 00:00 UTC. + * UTC leap seconds are ignored. + * @stable ICU 2.0 + */ +typedef double UDate; + +/** The number of milliseconds per second @stable ICU 2.0 */ +#define U_MILLIS_PER_SECOND (1000) +/** The number of milliseconds per minute @stable ICU 2.0 */ +#define U_MILLIS_PER_MINUTE (60000) +/** The number of milliseconds per hour @stable ICU 2.0 */ +#define U_MILLIS_PER_HOUR (3600000) +/** The number of milliseconds per day @stable ICU 2.0 */ +#define U_MILLIS_PER_DAY (86400000) + +/** + * Maximum UDate value + * @stable ICU 4.8 + */ +#define U_DATE_MAX DBL_MAX + +/** + * Minimum UDate value + * @stable ICU 4.8 + */ +#define U_DATE_MIN -U_DATE_MAX + +/*===========================================================================*/ +/* Shared library/DLL import-export API control */ +/*===========================================================================*/ + +/* + * Control of symbol import/export. + * ICU is separated into three libraries. + */ + +/** + * \def U_COMBINED_IMPLEMENTATION + * Set to export library symbols from inside the ICU library + * when all of ICU is in a single library. + * This can be set as a compiler option while building ICU, and it + * needs to be the first one tested to override U_COMMON_API, U_I18N_API, etc. + * @stable ICU 2.0 + */ + +/** + * \def U_DATA_API + * Set to export library symbols from inside the stubdata library, + * and to import them from outside. + * @stable ICU 3.0 + */ + +/** + * \def U_COMMON_API + * Set to export library symbols from inside the common library, + * and to import them from outside. + * @stable ICU 2.0 + */ + +/** + * \def U_I18N_API + * Set to export library symbols from inside the i18n library, + * and to import them from outside. + * @stable ICU 2.0 + */ + +/** + * \def U_LAYOUT_API + * Set to export library symbols from inside the layout engine library, + * and to import them from outside. + * @stable ICU 2.0 + */ + +/** + * \def U_LAYOUTEX_API + * Set to export library symbols from inside the layout extensions library, + * and to import them from outside. + * @stable ICU 2.6 + */ + +/** + * \def U_IO_API + * Set to export library symbols from inside the ustdio library, + * and to import them from outside. + * @stable ICU 2.0 + */ + +/** + * \def U_TOOLUTIL_API + * Set to export library symbols from inside the toolutil library, + * and to import them from outside. + * @stable ICU 3.4 + */ + +#ifdef U_IN_DOXYGEN +// This definition is required when generating the API docs. +#define U_COMBINED_IMPLEMENTATION 1 +#endif + +#if defined(U_COMBINED_IMPLEMENTATION) +#define U_DATA_API U_EXPORT +#define U_COMMON_API U_EXPORT +#define U_I18N_API U_EXPORT +#define U_LAYOUT_API U_EXPORT +#define U_LAYOUTEX_API U_EXPORT +#define U_IO_API U_EXPORT +#define U_TOOLUTIL_API U_EXPORT +#elif defined(U_STATIC_IMPLEMENTATION) +#define U_DATA_API +#define U_COMMON_API +#define U_I18N_API +#define U_LAYOUT_API +#define U_LAYOUTEX_API +#define U_IO_API +#define U_TOOLUTIL_API +#elif defined(U_COMMON_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_EXPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_I18N_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_EXPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_LAYOUT_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_EXPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_LAYOUTEX_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_EXPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_IO_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_EXPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_TOOLUTIL_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_EXPORT +#else +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#endif + +/** + * \def U_STANDARD_CPP_NAMESPACE + * Control of C++ Namespace + * @stable ICU 2.0 + */ +#ifdef __cplusplus +#define U_STANDARD_CPP_NAMESPACE :: +#else +#define U_STANDARD_CPP_NAMESPACE +#endif + +/*===========================================================================*/ +/* UErrorCode */ +/*===========================================================================*/ + +/** + * Standard ICU4C error code type, a substitute for exceptions. + * + * Initialize the UErrorCode with U_ZERO_ERROR, and check for success or + * failure using U_SUCCESS() or U_FAILURE(): + * + * UErrorCode errorCode = U_ZERO_ERROR; + * // call ICU API that needs an error code parameter. + * if (U_FAILURE(errorCode)) { + * // An error occurred. Handle it here. + * } + * + * C++ code should use icu::ErrorCode, available in unicode/errorcode.h, or a + * suitable subclass. + * + * For more information, see: + * http://icu-project.org/userguide/conventions + * + * Note: By convention, ICU functions that take a reference (C++) or a pointer + * (C) to a UErrorCode first test: + * + * if (U_FAILURE(errorCode)) { return immediately; } + * + * so that in a chain of such functions the first one that sets an error code + * causes the following ones to not perform any operations. + * + * @stable ICU 2.0 + */ +typedef enum UErrorCode { + /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird + * and is that way because VC++ debugger displays first encountered constant, + * which is not the what the code is used for + */ + + U_USING_FALLBACK_WARNING = -128, /**< A resource bundle lookup returned a fallback result (not an error) */ + + U_ERROR_WARNING_START = -128, /**< Start of information results (semantically successful) */ + + U_USING_DEFAULT_WARNING = -127, /**< A resource bundle lookup returned a result from the root locale (not an error) */ + + U_SAFECLONE_ALLOCATED_WARNING = -126, /**< A SafeClone operation required allocating memory (informational only) */ + + U_STATE_OLD_WARNING = -125, /**< ICU has to use compatibility layer to construct the service. Expect performance/memory usage degradation. Consider upgrading */ + + U_STRING_NOT_TERMINATED_WARNING = -124,/**< An output string could not be NUL-terminated because output length==destCapacity. */ + + U_SORT_KEY_TOO_SHORT_WARNING = -123, /**< Number of levels requested in getBound is higher than the number of levels in the sort key */ + + U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to different converter implementations */ + + U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */ + + U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UErrorCode warning value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_ERROR_WARNING_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + U_ZERO_ERROR = 0, /**< No error, no warning. */ + + U_ILLEGAL_ARGUMENT_ERROR = 1, /**< Start of codes indicating failure */ + U_MISSING_RESOURCE_ERROR = 2, /**< The requested resource cannot be found */ + U_INVALID_FORMAT_ERROR = 3, /**< Data format is not what is expected */ + U_FILE_ACCESS_ERROR = 4, /**< The requested file cannot be found */ + U_INTERNAL_PROGRAM_ERROR = 5, /**< Indicates a bug in the library code */ + U_MESSAGE_PARSE_ERROR = 6, /**< Unable to parse a message (message format) */ + U_MEMORY_ALLOCATION_ERROR = 7, /**< Memory allocation error */ + U_INDEX_OUTOFBOUNDS_ERROR = 8, /**< Trying to access the index that is out of bounds */ + U_PARSE_ERROR = 9, /**< Equivalent to Java ParseException */ + U_INVALID_CHAR_FOUND = 10, /**< Character conversion: Unmappable input sequence. In other APIs: Invalid character. */ + U_TRUNCATED_CHAR_FOUND = 11, /**< Character conversion: Incomplete input sequence. */ + U_ILLEGAL_CHAR_FOUND = 12, /**< Character conversion: Illegal input sequence/combination of input units. */ + U_INVALID_TABLE_FORMAT = 13, /**< Conversion table file found, but corrupted */ + U_INVALID_TABLE_FILE = 14, /**< Conversion table file not found */ + U_BUFFER_OVERFLOW_ERROR = 15, /**< A result would not fit in the supplied buffer */ + U_UNSUPPORTED_ERROR = 16, /**< Requested operation not supported in current context */ + U_RESOURCE_TYPE_MISMATCH = 17, /**< an operation is requested over a resource that does not support it */ + U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illegal escape sequence */ + U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */ + U_NO_SPACE_AVAILABLE = 20, /**< No space available for in-buffer expansion for Arabic shaping */ + U_CE_NOT_FOUND_ERROR = 21, /**< Currently used only while setting variable top, but can be used generally */ + U_PRIMARY_TOO_LONG_ERROR = 22, /**< User tried to set variable top to a primary that is longer than two bytes */ + U_STATE_TOO_OLD_ERROR = 23, /**< ICU cannot construct a service from this state, as it is no longer supported */ + U_TOO_MANY_ALIASES_ERROR = 24, /**< There are too many aliases in the path to the requested resource. + It is very possible that a circular alias definition has occurred */ + U_ENUM_OUT_OF_SYNC_ERROR = 25, /**< UEnumeration out of sync with underlying collection */ + U_INVARIANT_CONVERSION_ERROR = 26, /**< Unable to convert a UChar* string to char* with the invariant converter. */ + U_INVALID_STATE_ERROR = 27, /**< Requested operation can not be completed with ICU in its current state */ + U_COLLATOR_VERSION_MISMATCH = 28, /**< Collator version is not compatible with the base version */ + U_USELESS_COLLATOR_ERROR = 29, /**< Collator is options only and no base is specified */ + U_NO_WRITE_PERMISSION = 30, /**< Attempt to modify read-only or constant data. */ +#ifndef U_HIDE_DRAFT_API + /** + * The input is impractically long for an operation. + * It is rejected because it may lead to problems such as excessive + * processing time, stack depth, or heap memory requirements. + * + * @draft ICU 68 + */ + U_INPUT_TOO_LONG_ERROR = 31, +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest standard error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_STANDARD_ERROR_LIMIT = 32, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10000 0x10100 are reserved for Transliterator. + */ + U_BAD_VARIABLE_DEFINITION=0x10000,/**< Missing '$' or duplicate variable name */ + U_PARSE_ERROR_START = 0x10000, /**< Start of Transliterator errors */ + U_MALFORMED_RULE, /**< Elements of a rule are misplaced */ + U_MALFORMED_SET, /**< A UnicodeSet pattern is invalid*/ + U_MALFORMED_SYMBOL_REFERENCE, /**< UNUSED as of ICU 2.4 */ + U_MALFORMED_UNICODE_ESCAPE, /**< A Unicode escape pattern is invalid*/ + U_MALFORMED_VARIABLE_DEFINITION, /**< A variable definition is invalid */ + U_MALFORMED_VARIABLE_REFERENCE, /**< A variable reference is invalid */ + U_MISMATCHED_SEGMENT_DELIMITERS, /**< UNUSED as of ICU 2.4 */ + U_MISPLACED_ANCHOR_START, /**< A start anchor appears at an illegal position */ + U_MISPLACED_CURSOR_OFFSET, /**< A cursor offset occurs at an illegal position */ + U_MISPLACED_QUANTIFIER, /**< A quantifier appears after a segment close delimiter */ + U_MISSING_OPERATOR, /**< A rule contains no operator */ + U_MISSING_SEGMENT_CLOSE, /**< UNUSED as of ICU 2.4 */ + U_MULTIPLE_ANTE_CONTEXTS, /**< More than one ante context */ + U_MULTIPLE_CURSORS, /**< More than one cursor */ + U_MULTIPLE_POST_CONTEXTS, /**< More than one post context */ + U_TRAILING_BACKSLASH, /**< A dangling backslash */ + U_UNDEFINED_SEGMENT_REFERENCE, /**< A segment reference does not correspond to a defined segment */ + U_UNDEFINED_VARIABLE, /**< A variable reference does not correspond to a defined variable */ + U_UNQUOTED_SPECIAL, /**< A special character was not quoted or escaped */ + U_UNTERMINATED_QUOTE, /**< A closing single quote is missing */ + U_RULE_MASK_ERROR, /**< A rule is hidden by an earlier more general rule */ + U_MISPLACED_COMPOUND_FILTER, /**< A compound filter is in an invalid location */ + U_MULTIPLE_COMPOUND_FILTERS, /**< More than one compound filter */ + U_INVALID_RBT_SYNTAX, /**< A "::id" rule was passed to the RuleBasedTransliterator parser */ + U_INVALID_PROPERTY_PATTERN, /**< UNUSED as of ICU 2.4 */ + U_MALFORMED_PRAGMA, /**< A 'use' pragma is invalid */ + U_UNCLOSED_SEGMENT, /**< A closing ')' is missing */ + U_ILLEGAL_CHAR_IN_SEGMENT, /**< UNUSED as of ICU 2.4 */ + U_VARIABLE_RANGE_EXHAUSTED, /**< Too many stand-ins generated for the given variable range */ + U_VARIABLE_RANGE_OVERLAP, /**< The variable range overlaps characters used in rules */ + U_ILLEGAL_CHARACTER, /**< A special character is outside its allowed context */ + U_INTERNAL_TRANSLITERATOR_ERROR, /**< Internal transliterator system error */ + U_INVALID_ID, /**< A "::id" rule specifies an unknown transliterator */ + U_INVALID_FUNCTION, /**< A "&fn()" rule specifies an unknown transliterator */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal Transliterator error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_PARSE_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10100 0x10200 are reserved for the formatting API. + */ + U_UNEXPECTED_TOKEN=0x10100, /**< Syntax error in format pattern */ + U_FMT_PARSE_ERROR_START=0x10100, /**< Start of format library errors */ + U_MULTIPLE_DECIMAL_SEPARATORS, /**< More than one decimal separator in number pattern */ + U_MULTIPLE_DECIMAL_SEPERATORS = U_MULTIPLE_DECIMAL_SEPARATORS, /**< Typo: kept for backward compatibility. Use U_MULTIPLE_DECIMAL_SEPARATORS */ + U_MULTIPLE_EXPONENTIAL_SYMBOLS, /**< More than one exponent symbol in number pattern */ + U_MALFORMED_EXPONENTIAL_PATTERN, /**< Grouping symbol in exponent pattern */ + U_MULTIPLE_PERCENT_SYMBOLS, /**< More than one percent symbol in number pattern */ + U_MULTIPLE_PERMILL_SYMBOLS, /**< More than one permill symbol in number pattern */ + U_MULTIPLE_PAD_SPECIFIERS, /**< More than one pad symbol in number pattern */ + U_PATTERN_SYNTAX_ERROR, /**< Syntax error in format pattern */ + U_ILLEGAL_PAD_POSITION, /**< Pad symbol misplaced in number pattern */ + U_UNMATCHED_BRACES, /**< Braces do not match in message pattern */ + U_UNSUPPORTED_PROPERTY, /**< UNUSED as of ICU 2.4 */ + U_UNSUPPORTED_ATTRIBUTE, /**< UNUSED as of ICU 2.4 */ + U_ARGUMENT_TYPE_MISMATCH, /**< Argument name and argument index mismatch in MessageFormat functions */ + U_DUPLICATE_KEYWORD, /**< Duplicate keyword in PluralFormat */ + U_UNDEFINED_KEYWORD, /**< Undefined Plural keyword */ + U_DEFAULT_KEYWORD_MISSING, /**< Missing DEFAULT rule in plural rules */ + U_DECIMAL_NUMBER_SYNTAX_ERROR, /**< Decimal number syntax error */ + U_FORMAT_INEXACT_ERROR, /**< Cannot format a number exactly and rounding mode is ROUND_UNNECESSARY @stable ICU 4.8 */ + U_NUMBER_ARG_OUTOFBOUNDS_ERROR, /**< The argument to a NumberFormatter helper method was out of bounds; the bounds are usually 0 to 999. @stable ICU 61 */ + U_NUMBER_SKELETON_SYNTAX_ERROR, /**< The number skeleton passed to C++ NumberFormatter or C UNumberFormatter was invalid or contained a syntax error. @stable ICU 62 */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal formatting API error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_FMT_PARSE_ERROR_LIMIT = 0x10114, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10200 0x102ff are reserved for BreakIterator. + */ + U_BRK_INTERNAL_ERROR=0x10200, /**< An internal error (bug) was detected. */ + U_BRK_ERROR_START=0x10200, /**< Start of codes indicating Break Iterator failures */ + U_BRK_HEX_DIGITS_EXPECTED, /**< Hex digits expected as part of a escaped char in a rule. */ + U_BRK_SEMICOLON_EXPECTED, /**< Missing ';' at the end of a RBBI rule. */ + U_BRK_RULE_SYNTAX, /**< Syntax error in RBBI rule. */ + U_BRK_UNCLOSED_SET, /**< UnicodeSet writing an RBBI rule missing a closing ']'. */ + U_BRK_ASSIGN_ERROR, /**< Syntax error in RBBI rule assignment statement. */ + U_BRK_VARIABLE_REDFINITION, /**< RBBI rule $Variable redefined. */ + U_BRK_MISMATCHED_PAREN, /**< Mis-matched parentheses in an RBBI rule. */ + U_BRK_NEW_LINE_IN_QUOTED_STRING, /**< Missing closing quote in an RBBI rule. */ + U_BRK_UNDEFINED_VARIABLE, /**< Use of an undefined $Variable in an RBBI rule. */ + U_BRK_INIT_ERROR, /**< Initialization failure. Probable missing ICU Data. */ + U_BRK_RULE_EMPTY_SET, /**< Rule contains an empty Unicode Set. */ + U_BRK_UNRECOGNIZED_OPTION, /**< !!option in RBBI rules not recognized. */ + U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is malformed */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal BreakIterator error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_BRK_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10300-0x103ff are reserved for regular expression related errors. + */ + U_REGEX_INTERNAL_ERROR=0x10300, /**< An internal error (bug) was detected. */ + U_REGEX_ERROR_START=0x10300, /**< Start of codes indicating Regexp failures */ + U_REGEX_RULE_SYNTAX, /**< Syntax error in regexp pattern. */ + U_REGEX_INVALID_STATE, /**< RegexMatcher in invalid state for requested operation */ + U_REGEX_BAD_ESCAPE_SEQUENCE, /**< Unrecognized backslash escape sequence in pattern */ + U_REGEX_PROPERTY_SYNTAX, /**< Incorrect Unicode property */ + U_REGEX_UNIMPLEMENTED, /**< Use of regexp feature that is not yet implemented. */ + U_REGEX_MISMATCHED_PAREN, /**< Incorrectly nested parentheses in regexp pattern. */ + U_REGEX_NUMBER_TOO_BIG, /**< Decimal number is too large. */ + U_REGEX_BAD_INTERVAL, /**< Error in {min,max} interval */ + U_REGEX_MAX_LT_MIN, /**< In {min,max}, max is less than min. */ + U_REGEX_INVALID_BACK_REF, /**< Back-reference to a non-existent capture group. */ + U_REGEX_INVALID_FLAG, /**< Invalid value for match mode flags. */ + U_REGEX_LOOK_BEHIND_LIMIT, /**< Look-Behind pattern matches must have a bounded maximum length. */ + U_REGEX_SET_CONTAINS_STRING, /**< Regexps cannot have UnicodeSets containing strings.*/ +#ifndef U_HIDE_DEPRECATED_API + U_REGEX_OCTAL_TOO_BIG, /**< Octal character constants must be <= 0377. @deprecated ICU 54. This error cannot occur. */ +#endif /* U_HIDE_DEPRECATED_API */ + U_REGEX_MISSING_CLOSE_BRACKET=U_REGEX_SET_CONTAINS_STRING+2, /**< Missing closing bracket on a bracket expression. */ + U_REGEX_INVALID_RANGE, /**< In a character range [x-y], x is greater than y. */ + U_REGEX_STACK_OVERFLOW, /**< Regular expression backtrack stack overflow. */ + U_REGEX_TIME_OUT, /**< Maximum allowed match time exceeded */ + U_REGEX_STOPPED_BY_CALLER, /**< Matching operation aborted by user callback fn. */ + U_REGEX_PATTERN_TOO_BIG, /**< Pattern exceeds limits on size or complexity. @stable ICU 55 */ + U_REGEX_INVALID_CAPTURE_GROUP_NAME, /**< Invalid capture group name. @stable ICU 55 */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal regular expression error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_REGEX_ERROR_LIMIT=U_REGEX_STOPPED_BY_CALLER+3, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10400-0x104ff are reserved for IDNA related error codes. + */ + U_IDNA_PROHIBITED_ERROR=0x10400, + U_IDNA_ERROR_START=0x10400, + U_IDNA_UNASSIGNED_ERROR, + U_IDNA_CHECK_BIDI_ERROR, + U_IDNA_STD3_ASCII_RULES_ERROR, + U_IDNA_ACE_PREFIX_ERROR, + U_IDNA_VERIFICATION_ERROR, + U_IDNA_LABEL_TOO_LONG_ERROR, + U_IDNA_ZERO_LENGTH_LABEL_ERROR, + U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal IDNA error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_IDNA_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + /* + * Aliases for StringPrep + */ + U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR, + U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR, + U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR, + + /* + * Error codes in the range 0x10500-0x105ff are reserved for Plugin related error codes. + */ + U_PLUGIN_ERROR_START=0x10500, /**< Start of codes indicating plugin failures */ + U_PLUGIN_TOO_HIGH=0x10500, /**< The plugin's level is too high to be loaded right now. */ + U_PLUGIN_DIDNT_SET_LEVEL, /**< The plugin didn't call uplug_setPlugLevel in response to a QUERY */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal plug-in error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_PLUGIN_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT +#endif // U_HIDE_DEPRECATED_API +} UErrorCode; + +/* Use the following to determine if an UErrorCode represents */ +/* operational success or failure. */ + +#ifdef __cplusplus + /** + * Does the error code indicate success? + * @stable ICU 2.0 + */ + static + inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); } + /** + * Does the error code indicate a failure? + * @stable ICU 2.0 + */ + static + inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); } +#else + /** + * Does the error code indicate success? + * @stable ICU 2.0 + */ +# define U_SUCCESS(x) ((x)<=U_ZERO_ERROR) + /** + * Does the error code indicate a failure? + * @stable ICU 2.0 + */ +# define U_FAILURE(x) ((x)>U_ZERO_ERROR) +#endif + +/** + * Return a string for a UErrorCode value. + * The string will be the same as the name of the error code constant + * in the UErrorCode enum above. + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +u_errorName(UErrorCode code); + + +#endif /* _UTYPES */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uvernum.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uvernum.h new file mode 100644 index 0000000000000000000000000000000000000000..b09d4943c1cc98f2b7dafdf0e1952a6e2cc37bd5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uvernum.h @@ -0,0 +1,198 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2000-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* +* file name: uvernum.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* Created by: Vladimir Weinstein +* Updated by: Steven R. Loomis +* +*/ + +/** + * \file + * \brief C API: definitions of ICU version numbers + * + * This file is included by uversion.h and other files. This file contains only + * macros and definitions. The actual version numbers are defined here. + */ + + /* + * IMPORTANT: When updating version, the following things need to be done: + * source/common/unicode/uvernum.h - this file: update major, minor, + * patchlevel, suffix, version, short version constants, namespace, + * renaming macro, and copyright + * + * The following files need to be updated as well, which can be done + * by running the UNIX makefile target 'update-windows-makefiles' in icu/source. + * + * + * source/common/common_uwp.vcxproj + * source/common/common.vcxproj - update 'Output file name' on the link tab so + * that it contains the new major/minor combination + * source/i18n/i18n.vcxproj - same as for the common.vcxproj + * source/i18n/i18n_uwp.vcxproj - same as for the common_uwp.vcxproj + * source/layoutex/layoutex.vcproj - same + * source/stubdata/stubdata.vcproj - same as for the common.vcxproj + * source/io/io.vcproj - same as for the common.vcxproj + * source/data/makedata.mak - change U_ICUDATA_NAME so that it contains + * the new major/minor combination and the Unicode version. + */ + +#ifndef UVERNUM_H +#define UVERNUM_H + +/** The standard copyright notice that gets compiled into each library. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.4 + */ +#define U_COPYRIGHT_STRING \ + " Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html " + +/** The current ICU major version as an integer. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.4 + */ +#define U_ICU_VERSION_MAJOR_NUM 69 + +/** The current ICU minor version as an integer. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.6 + */ +#define U_ICU_VERSION_MINOR_NUM 1 + +/** The current ICU patchlevel version as an integer. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.4 + */ +#define U_ICU_VERSION_PATCHLEVEL_NUM 0 + +/** The current ICU build level version as an integer. + * This value is for use by ICU clients. It defaults to 0. + * @stable ICU 4.0 + */ +#ifndef U_ICU_VERSION_BUILDLEVEL_NUM +#define U_ICU_VERSION_BUILDLEVEL_NUM 0 +#endif + +/** Glued version suffix for renamers + * This value will change in the subsequent releases of ICU + * @stable ICU 2.6 + */ +#define U_ICU_VERSION_SUFFIX _69 + +/** + * \def U_DEF2_ICU_ENTRY_POINT_RENAME + * @internal + */ +/** + * \def U_DEF_ICU_ENTRY_POINT_RENAME + * @internal + */ +/** Glued version suffix function for renamers + * This value will change in the subsequent releases of ICU. + * If a custom suffix (such as matching library suffixes) is desired, this can be modified. + * Note that if present, platform.h may contain an earlier definition of this macro. + * \def U_ICU_ENTRY_POINT_RENAME + * @stable ICU 4.2 + */ +/** + * Disable the version suffix. Use the custom suffix if exists. + * \def U_DISABLE_VERSION_SUFFIX + * @internal + */ +#ifndef U_DISABLE_VERSION_SUFFIX +#define U_DISABLE_VERSION_SUFFIX 0 +#endif + +#ifndef U_ICU_ENTRY_POINT_RENAME +#ifdef U_HAVE_LIB_SUFFIX +# if !U_DISABLE_VERSION_SUFFIX +# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) x ## y ## z +# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y,z) U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) +# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX,U_LIB_SUFFIX_C_NAME) +# else +# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y +# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) +# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_LIB_SUFFIX_C_NAME) +# endif +#else +# if !U_DISABLE_VERSION_SUFFIX +# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y +# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) +# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX) +# else +# define U_ICU_ENTRY_POINT_RENAME(x) x +# endif +#endif +#endif + +/** The current ICU library version as a dotted-decimal string. The patchlevel + * only appears in this string if it non-zero. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.4 + */ +#define U_ICU_VERSION "69.1" + +/** + * The current ICU library major version number as a string, for library name suffixes. + * This value will change in subsequent releases of ICU. + * + * Until ICU 4.8, this was the combination of the single-digit major and minor ICU version numbers + * into one string without dots ("48"). + * Since ICU 49, it is the double-digit major ICU version number. + * See https://unicode-org.github.io/icu/userguide/design#version-numbers-in-icu + * + * @stable ICU 2.6 + */ +#define U_ICU_VERSION_SHORT "69" + +#ifndef U_HIDE_INTERNAL_API +/** Data version in ICU4C. + * @internal ICU 4.4 Internal Use Only + **/ +#define U_ICU_DATA_VERSION "69.1" +#endif /* U_HIDE_INTERNAL_API */ + +/*=========================================================================== + * ICU collation framework version information + * Version info that can be obtained from a collator is affected by these + * numbers in a secret and magic way. Please use collator version as whole + *=========================================================================== + */ + +/** + * Collation runtime version (sort key generator, strcoll). + * If the version is different, sort keys for the same string could be different. + * This value may change in subsequent releases of ICU. + * @stable ICU 2.4 + */ +#define UCOL_RUNTIME_VERSION 9 + +/** + * Collation builder code version. + * When this is different, the same tailoring might result + * in assigning different collation elements to code points. + * This value may change in subsequent releases of ICU. + * @stable ICU 2.4 + */ +#define UCOL_BUILDER_VERSION 9 + +#ifndef U_HIDE_DEPRECATED_API +/** + * Constant 1. + * This was intended to be the version of collation tailorings, + * but instead the tailoring data carries a version number. + * @deprecated ICU 54 + */ +#define UCOL_TAILORINGS_VERSION 1 +#endif /* U_HIDE_DEPRECATED_API */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uversion.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uversion.h new file mode 100644 index 0000000000000000000000000000000000000000..113568df8c127d39d65805a29af38de0e5cdaf08 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unicode/uversion.h @@ -0,0 +1,187 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2000-2011, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* +* file name: uversion.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* Created by: Vladimir Weinstein +* +* Gets included by utypes.h and Windows .rc files +*/ + +/** + * \file + * \brief C API: API for accessing ICU version numbers. + */ +/*===========================================================================*/ +/* Main ICU version information */ +/*===========================================================================*/ + +#ifndef UVERSION_H +#define UVERSION_H + +#include "unicode/umachine.h" + +/* Actual version info lives in uvernum.h */ +#include "unicode/uvernum.h" + +/** Maximum length of the copyright string. + * @stable ICU 2.4 + */ +#define U_COPYRIGHT_STRING_LENGTH 128 + +/** An ICU version consists of up to 4 numbers from 0..255. + * @stable ICU 2.4 + */ +#define U_MAX_VERSION_LENGTH 4 + +/** In a string, ICU version fields are delimited by dots. + * @stable ICU 2.4 + */ +#define U_VERSION_DELIMITER '.' + +/** The maximum length of an ICU version string. + * @stable ICU 2.4 + */ +#define U_MAX_VERSION_STRING_LENGTH 20 + +/** The binary form of a version on ICU APIs is an array of 4 uint8_t. + * To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)). + * @stable ICU 2.4 + */ +typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; + +/*===========================================================================*/ +/* C++ namespace if supported. Versioned unless versioning is disabled. */ +/*===========================================================================*/ + +/* Define C++ namespace symbols. */ +#ifdef __cplusplus + +/** + * \def U_NAMESPACE_BEGIN + * This is used to begin a declaration of a public ICU C++ API within + * versioned-ICU-namespace block. + * + * @stable ICU 2.4 + */ + +/** + * \def U_NAMESPACE_END + * This is used to end a declaration of a public ICU C++ API. + * It ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN. + * + * @stable ICU 2.4 + */ + +/** + * \def U_NAMESPACE_USE + * This is used to specify that the rest of the code uses the + * public ICU C++ API namespace. + * @stable ICU 2.4 + */ + +/** + * \def U_NAMESPACE_QUALIFIER + * This is used to qualify that a function or class is part of + * the public ICU C++ API namespace. + * + * This macro is unnecessary since ICU 49 requires namespace support. + * You can just use "icu::" instead. + * @stable ICU 2.4 + */ + +# if U_DISABLE_RENAMING +# define U_ICU_NAMESPACE icu + namespace U_ICU_NAMESPACE { } +# else +# define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu) + namespace U_ICU_NAMESPACE { } + namespace icu = U_ICU_NAMESPACE; +# endif + +# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE { +# define U_NAMESPACE_END } +# define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; +# define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: + +# ifndef U_USING_ICU_NAMESPACE +# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ + defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \ + defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION) +# define U_USING_ICU_NAMESPACE 0 +# else +# define U_USING_ICU_NAMESPACE 0 +# endif +# endif +# if U_USING_ICU_NAMESPACE + U_NAMESPACE_USE +# endif +#endif /* __cplusplus */ + +/*===========================================================================*/ +/* General version helper functions. Definitions in putil.c */ +/*===========================================================================*/ + +/** + * Parse a string with dotted-decimal version information and + * fill in a UVersionInfo structure with the result. + * Definition of this function lives in putil.c + * + * @param versionArray The destination structure for the version information. + * @param versionString A string with dotted-decimal version information, + * with up to four non-negative number fields with + * values of up to 255 each. + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +u_versionFromString(UVersionInfo versionArray, const char *versionString); + +/** + * Parse a Unicode string with dotted-decimal version information and + * fill in a UVersionInfo structure with the result. + * Definition of this function lives in putil.c + * + * @param versionArray The destination structure for the version information. + * @param versionString A Unicode string with dotted-decimal version + * information, with up to four non-negative number + * fields with values of up to 255 each. + * @stable ICU 4.2 + */ +U_CAPI void U_EXPORT2 +u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); + + +/** + * Write a string with dotted-decimal version information according + * to the input UVersionInfo. + * Definition of this function lives in putil.c + * + * @param versionArray The version information to be written as a string. + * @param versionString A string buffer that will be filled in with + * a string corresponding to the numeric version + * information in versionArray. + * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 +u_versionToString(const UVersionInfo versionArray, char *versionString); + +/** + * Gets the ICU release version. The version array stores the version information + * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02. + * Definition of this function lives in putil.c + * + * @param versionArray the version # information, the result will be filled in + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +u_getVersion(UVersionInfo versionArray); +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unifiedcache.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unifiedcache.h new file mode 100644 index 0000000000000000000000000000000000000000..a31998db206ae1b94aaaf5febfc735973a339c23 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unifiedcache.h @@ -0,0 +1,556 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2015, International Business Machines Corporation and +* others. All Rights Reserved. +****************************************************************************** +* +* File UNIFIEDCACHE.H - The ICU Unified cache. +****************************************************************************** +*/ + +#ifndef __UNIFIED_CACHE_H__ +#define __UNIFIED_CACHE_H__ + +#include "utypeinfo.h" // for 'typeid' to work + +#include "unicode/uobject.h" +#include "unicode/locid.h" +#include "sharedobject.h" +#include "unicode/unistr.h" +#include "cstring.h" +#include "ustr_imp.h" + +struct UHashtable; +struct UHashElement; + +U_NAMESPACE_BEGIN + +class UnifiedCache; + +/** + * A base class for all cache keys. + */ +class U_COMMON_API CacheKeyBase : public UObject { + public: + CacheKeyBase() : fCreationStatus(U_ZERO_ERROR), fIsPrimary(false) {} + + /** + * Copy constructor. Needed to support cloning. + */ + CacheKeyBase(const CacheKeyBase &other) + : UObject(other), fCreationStatus(other.fCreationStatus), fIsPrimary(false) { } + virtual ~CacheKeyBase(); + + /** + * Returns the hash code for this object. + */ + virtual int32_t hashCode() const = 0; + + /** + * Clones this object polymorphically. Caller owns returned value. + */ + virtual CacheKeyBase *clone() const = 0; + + /** + * Equality operator. + */ + virtual UBool operator == (const CacheKeyBase &other) const = 0; + + /** + * Create a new object for this key. Called by cache on cache miss. + * createObject must add a reference to the object it returns. Note + * that getting an object from the cache and returning it without calling + * removeRef on it satisfies this requirement. It can also return NULL + * and set status to an error. + * + * @param creationContext the context in which the object is being + * created. May be NULL. + * @param status Implementations can return a failure here. + * In addition, implementations may return a + * non NULL object and set a warning status. + */ + virtual const SharedObject *createObject( + const void *creationContext, UErrorCode &status) const = 0; + + /** + * Writes a description of this key to buffer and returns buffer. Written + * description is NULL terminated. + */ + virtual char *writeDescription(char *buffer, int32_t bufSize) const = 0; + + /** + * Inequality operator. + */ + UBool operator != (const CacheKeyBase &other) const { + return !(*this == other); + } + private: + mutable UErrorCode fCreationStatus; + mutable UBool fIsPrimary; + friend class UnifiedCache; +}; + + + +/** + * Templated version of CacheKeyBase. + * A key of type LocaleCacheKey maps to a value of type T. + */ +template +class CacheKey : public CacheKeyBase { + public: + virtual ~CacheKey() { } + /** + * The template parameter, T, determines the hash code returned. + */ + virtual int32_t hashCode() const { + const char *s = typeid(T).name(); + return ustr_hashCharsN(s, static_cast(uprv_strlen(s))); + } + + /** + * Use the value type, T, as the description. + */ + virtual char *writeDescription(char *buffer, int32_t bufLen) const { + const char *s = typeid(T).name(); + uprv_strncpy(buffer, s, bufLen); + buffer[bufLen - 1] = 0; + return buffer; + } + + /** + * Two objects are equal if they are of the same type. + */ + virtual UBool operator == (const CacheKeyBase &other) const { + return typeid(*this) == typeid(other); + } +}; + +/** + * Cache key based on locale. + * A key of type LocaleCacheKey maps to a value of type T. + */ +template +class LocaleCacheKey : public CacheKey { + protected: + Locale fLoc; + public: + LocaleCacheKey(const Locale &loc) : fLoc(loc) {} + LocaleCacheKey(const LocaleCacheKey &other) + : CacheKey(other), fLoc(other.fLoc) { } + virtual ~LocaleCacheKey() { } + virtual int32_t hashCode() const { + return (int32_t)(37u * (uint32_t)CacheKey::hashCode() + (uint32_t)fLoc.hashCode()); + } + virtual UBool operator == (const CacheKeyBase &other) const { + // reflexive + if (this == &other) { + return true; + } + if (!CacheKey::operator == (other)) { + return false; + } + // We know this and other are of same class because operator== on + // CacheKey returned true. + const LocaleCacheKey *fOther = + static_cast *>(&other); + return fLoc == fOther->fLoc; + } + virtual CacheKeyBase *clone() const { + return new LocaleCacheKey(*this); + } + virtual const T *createObject( + const void *creationContext, UErrorCode &status) const; + /** + * Use the locale id as the description. + */ + virtual char *writeDescription(char *buffer, int32_t bufLen) const { + const char *s = fLoc.getName(); + uprv_strncpy(buffer, s, bufLen); + buffer[bufLen - 1] = 0; + return buffer; + } + +}; + +/** + * The unified cache. A singleton type. + * Design doc here: + * https://docs.google.com/document/d/1RwGQJs4N4tawNbf809iYDRCvXoMKqDJihxzYt1ysmd8/edit?usp=sharing + */ +class U_COMMON_API UnifiedCache : public UnifiedCacheBase { + public: + /** + * @internal + * Do not call directly. Instead use UnifiedCache::getInstance() as + * there should be only one UnifiedCache in an application. + */ + UnifiedCache(UErrorCode &status); + + /** + * Return a pointer to the global cache instance. + */ + static UnifiedCache *getInstance(UErrorCode &status); + + /** + * Fetches a value from the cache by key. Equivalent to + * get(key, NULL, ptr, status); + */ + template + void get( + const CacheKey& key, + const T *&ptr, + UErrorCode &status) const { + get(key, NULL, ptr, status); + } + + /** + * Fetches value from the cache by key. + * + * @param key the cache key. + * @param creationContext passed verbatim to createObject method of key + * @param ptr On entry, ptr must be NULL or be included if + * the reference count of the object it points + * to. On exit, ptr points to the fetched object + * from the cache or is left unchanged on + * failure. Caller must call removeRef on ptr + * if set to a non NULL value. + * @param status Any error returned here. May be set to a + * warning value even if ptr is set. + */ + template + void get( + const CacheKey& key, + const void *creationContext, + const T *&ptr, + UErrorCode &status) const { + if (U_FAILURE(status)) { + return; + } + UErrorCode creationStatus = U_ZERO_ERROR; + const SharedObject *value = NULL; + _get(key, value, creationContext, creationStatus); + const T *tvalue = (const T *) value; + if (U_SUCCESS(creationStatus)) { + SharedObject::copyPtr(tvalue, ptr); + } + SharedObject::clearPtr(tvalue); + // Take care not to overwrite a warning status passed in with + // another warning or U_ZERO_ERROR. + if (status == U_ZERO_ERROR || U_FAILURE(creationStatus)) { + status = creationStatus; + } + } + +#ifdef UNIFIED_CACHE_DEBUG + /** + * Dumps the contents of this cache to standard error. Used for testing of + * cache only. + */ + void dumpContents() const; +#endif + + /** + * Convenience method to get a value of type T from cache for a + * particular locale with creationContext == NULL. + * @param loc the locale + * @param ptr On entry, must be NULL or included in the ref count + * of the object to which it points. + * On exit, fetched value stored here or is left + * unchanged on failure. Caller must call removeRef on + * ptr if set to a non NULL value. + * @param status Any error returned here. May be set to a + * warning value even if ptr is set. + */ + template + static void getByLocale( + const Locale &loc, const T *&ptr, UErrorCode &status) { + const UnifiedCache *cache = getInstance(status); + if (U_FAILURE(status)) { + return; + } + cache->get(LocaleCacheKey(loc), ptr, status); + } + +#ifdef UNIFIED_CACHE_DEBUG + /** + * Dumps the cache contents to stderr. For testing only. + */ + static void dump(); +#endif + + /** + * Returns the number of keys in this cache. For testing only. + */ + int32_t keyCount() const; + + /** + * Removes any values from cache that are not referenced outside + * the cache. + */ + void flush() const; + + /** + * Configures at what point evcition of unused entries will begin. + * Eviction is triggered whenever the number of evictable keys exeeds + * BOTH count AND (number of in-use items) * (percentageOfInUseItems / 100). + * Once the number of unused entries drops below one of these, + * eviction ceases. Because eviction happens incrementally, + * the actual unused entry count may exceed both these numbers + * from time to time. + * + * A cache entry is defined as unused if it is not essential to guarantee + * that for a given key X, the cache returns the same reference to the + * same value as long as the client already holds a reference to that + * value. + * + * If this method is never called, the default settings are 1000 and 100%. + * + * Although this method is thread-safe, it is designed to be called at + * application startup. If it is called in the middle of execution, it + * will have no immediate effect on the cache. However over time, the + * cache will perform eviction slices in an attempt to honor the new + * settings. + * + * If a client already holds references to many different unique values + * in the cache such that the number of those unique values far exeeds + * "count" then the cache may not be able to maintain this maximum. + * However, if this happens, the cache still guarantees that the number of + * unused entries will remain only a small percentage of the total cache + * size. + * + * If the parameters passed are negative, setEvctionPolicy sets status to + * U_ILLEGAL_ARGUMENT_ERROR. + */ + void setEvictionPolicy( + int32_t count, int32_t percentageOfInUseItems, UErrorCode &status); + + + /** + * Returns how many entries have been auto evicted during the lifetime + * of this cache. This only includes auto evicted entries, not + * entries evicted because of a call to flush(). + */ + int64_t autoEvictedCount() const; + + /** + * Returns the unused entry count in this cache. For testing only, + * Regular clients will not need this. + */ + int32_t unusedCount() const; + + virtual void handleUnreferencedObject() const; + virtual ~UnifiedCache(); + + private: + UHashtable *fHashtable; + mutable int32_t fEvictPos; + mutable int32_t fNumValuesTotal; + mutable int32_t fNumValuesInUse; + int32_t fMaxUnused; + int32_t fMaxPercentageOfInUse; + mutable int64_t fAutoEvictedCount; + SharedObject *fNoValue; + + UnifiedCache(const UnifiedCache &other); + UnifiedCache &operator=(const UnifiedCache &other); + + /** + * Flushes the contents of the cache. If cache values hold references to other + * cache values then _flush should be called in a loop until it returns false. + * + * On entry, gCacheMutex must be held. + * On exit, those values with are evictable are flushed. + * + * @param all if false flush evictable items only, which are those with no external + * references, plus those that can be safely recreated.
+ * if true, flush all elements. Any values (sharedObjects) with remaining + * hard (external) references are not deleted, but are detached from + * the cache, so that a subsequent removeRefs can delete them. + * _flush is not thread safe when all is true. + * @return true if any value in cache was flushed or false otherwise. + */ + UBool _flush(UBool all) const; + + /** + * Gets value out of cache. + * On entry. gCacheMutex must not be held. value must be NULL. status + * must be U_ZERO_ERROR. + * On exit. value and status set to what is in cache at key or on cache + * miss the key's createObject() is called and value and status are set to + * the result of that. In this latter case, best effort is made to add the + * value and status to the cache. If createObject() fails to create a value, + * fNoValue is stored in cache, and value is set to NULL. Caller must call + * removeRef on value if non NULL. + */ + void _get( + const CacheKeyBase &key, + const SharedObject *&value, + const void *creationContext, + UErrorCode &status) const; + + /** + * Attempts to fetch value and status for key from cache. + * On entry, gCacheMutex must not be held value must be NULL and status must + * be U_ZERO_ERROR. + * On exit, either returns false (In this + * case caller should try to create the object) or returns true with value + * pointing to the fetched value and status set to fetched status. When + * false is returned status may be set to failure if an in progress hash + * entry could not be made but value will remain unchanged. When true is + * returned, caller must call removeRef() on value. + */ + UBool _poll( + const CacheKeyBase &key, + const SharedObject *&value, + UErrorCode &status) const; + + /** + * Places a new value and creationStatus in the cache for the given key. + * On entry, gCacheMutex must be held. key must not exist in the cache. + * On exit, value and creation status placed under key. Soft reference added + * to value on successful add. On error sets status. + */ + void _putNew( + const CacheKeyBase &key, + const SharedObject *value, + const UErrorCode creationStatus, + UErrorCode &status) const; + + /** + * Places value and status at key if there is no value at key or if cache + * entry for key is in progress. Otherwise, it leaves the current value and + * status there. + * + * On entry. gCacheMutex must not be held. Value must be + * included in the reference count of the object to which it points. + * + * On exit, value and status are changed to what was already in the cache if + * something was there and not in progress. Otherwise, value and status are left + * unchanged in which case they are placed in the cache on a best-effort basis. + * Caller must call removeRef() on value. + */ + void _putIfAbsentAndGet( + const CacheKeyBase &key, + const SharedObject *&value, + UErrorCode &status) const; + + /** + * Returns the next element in the cache round robin style. + * Returns nullptr if the cache is empty. + * On entry, gCacheMutex must be held. + */ + const UHashElement *_nextElement() const; + + /** + * Return the number of cache items that would need to be evicted + * to bring usage into conformance with eviction policy. + * + * An item corresponds to an entry in the hash table, a hash table element. + * + * On entry, gCacheMutex must be held. + */ + int32_t _computeCountOfItemsToEvict() const; + + /** + * Run an eviction slice. + * On entry, gCacheMutex must be held. + * _runEvictionSlice runs a slice of the evict pipeline by examining the next + * 10 entries in the cache round robin style evicting them if they are eligible. + */ + void _runEvictionSlice() const; + + /** + * Register a primary cache entry. A primary key is the first key to create + * a given SharedObject value. Subsequent keys whose create function + * produce referneces to an already existing SharedObject are not primary - + * they can be evicted and subsequently recreated. + * + * On entry, gCacheMutex must be held. + * On exit, items in use count incremented, entry is marked as a primary + * entry, and value registered with cache so that subsequent calls to + * addRef() and removeRef() on it correctly interact with the cache. + */ + void _registerPrimary(const CacheKeyBase *theKey, const SharedObject *value) const; + + /** + * Store a value and creation error status in given hash entry. + * On entry, gCacheMutex must be held. Hash entry element must be in progress. + * value must be non NULL. + * On Exit, soft reference added to value. value and status stored in hash + * entry. Soft reference removed from previous stored value. Waiting + * threads notified. + */ + void _put( + const UHashElement *element, + const SharedObject *value, + const UErrorCode status) const; + /** + * Remove a soft reference, and delete the SharedObject if no references remain. + * To be used from within the UnifiedCache implementation only. + * gCacheMutex must be held by caller. + * @param value the SharedObject to be acted on. + */ + void removeSoftRef(const SharedObject *value) const; + + /** + * Increment the hard reference count of the given SharedObject. + * gCacheMutex must be held by the caller. + * Update numValuesEvictable on transitions between zero and one reference. + * + * @param value The SharedObject to be referenced. + * @return the hard reference count after the addition. + */ + int32_t addHardRef(const SharedObject *value) const; + + /** + * Decrement the hard reference count of the given SharedObject. + * gCacheMutex must be held by the caller. + * Update numValuesEvictable on transitions between one and zero reference. + * + * @param value The SharedObject to be referenced. + * @return the hard reference count after the removal. + */ + int32_t removeHardRef(const SharedObject *value) const; + + +#ifdef UNIFIED_CACHE_DEBUG + void _dumpContents() const; +#endif + + /** + * Fetch value and error code from a particular hash entry. + * On entry, gCacheMutex must be held. value must be either NULL or must be + * included in the ref count of the object to which it points. + * On exit, value and status set to what is in the hash entry. Caller must + * eventually call removeRef on value. + * If hash entry is in progress, value will be set to gNoValue and status will + * be set to U_ZERO_ERROR. + */ + void _fetch(const UHashElement *element, const SharedObject *&value, + UErrorCode &status) const; + + /** + * Determine if given hash entry is in progress. + * On entry, gCacheMutex must be held. + */ + UBool _inProgress(const UHashElement *element) const; + + /** + * Determine if given hash entry is in progress. + * On entry, gCacheMutex must be held. + */ + UBool _inProgress(const SharedObject *theValue, UErrorCode creationStatus) const; + + /** + * Determine if given hash entry is eligible for eviction. + * On entry, gCacheMutex must be held. + */ + UBool _isEvictable(const UHashElement *element) const; +}; + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uniquecharstr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uniquecharstr.h new file mode 100644 index 0000000000000000000000000000000000000000..10cc924f7f9eb2f6e6c80c97e3d3ccd1153b8c6f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uniquecharstr.h @@ -0,0 +1,98 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// uniquecharstr.h +// created: 2020sep01 Frank Yung-Fong Tang + +#ifndef __UNIQUECHARSTR_H__ +#define __UNIQUECHARSTR_H__ + +#include "charstr.h" +#include "uassert.h" +#include "uhash.h" + +U_NAMESPACE_BEGIN + +/** + * Stores NUL-terminated strings with duplicate elimination. + * Checks for unique UTF-16 string pointers and converts to invariant characters. + * + * Intended to be stack-allocated. Add strings, get a unique number for each, + * freeze the object, get a char * pointer for each string, + * call orphanCharStrings() to capture the string storage, and let this object go out of scope. + */ +class UniqueCharStrings { +public: + UniqueCharStrings(UErrorCode &errorCode) : strings(nullptr) { + // Note: We hash on string contents but store stable char16_t * pointers. + // If the strings are stored in resource bundles which should be built with + // duplicate elimination, then we should be able to hash on just the pointer values. + uhash_init(&map, uhash_hashUChars, uhash_compareUChars, uhash_compareLong, &errorCode); + if (U_FAILURE(errorCode)) { return; } + strings = new CharString(); + if (strings == nullptr) { + errorCode = U_MEMORY_ALLOCATION_ERROR; + } + } + ~UniqueCharStrings() { + uhash_close(&map); + delete strings; + } + + /** Returns/orphans the CharString that contains all strings. */ + CharString *orphanCharStrings() { + CharString *result = strings; + strings = nullptr; + return result; + } + + /** + * Adds a string and returns a unique number for it. + * The string's buffer contents must not change, nor move around in memory, + * while this UniqueCharStrings is in use. + * The string contents must be NUL-terminated exactly at s.length(). + * + * Best used with read-only-alias UnicodeString objects that point to + * stable storage, such as strings returned by resource bundle functions. + */ + int32_t add(const UnicodeString &s, UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return 0; } + if (isFrozen) { + errorCode = U_NO_WRITE_PERMISSION; + return 0; + } + // The string points into the resource bundle. + const char16_t *p = s.getBuffer(); + int32_t oldIndex = uhash_geti(&map, p); + if (oldIndex != 0) { // found duplicate + return oldIndex; + } + // Explicit NUL terminator for the previous string. + // The strings object is also terminated with one implicit NUL. + strings->append(0, errorCode); + int32_t newIndex = strings->length(); + strings->appendInvariantChars(s, errorCode); + uhash_puti(&map, const_cast(p), newIndex, &errorCode); + return newIndex; + } + + void freeze() { isFrozen = true; } + + /** + * Returns a string pointer for its unique number, if this object is frozen. + * Otherwise nullptr. + */ + const char *get(int32_t i) const { + U_ASSERT(isFrozen); + return isFrozen && i > 0 ? strings->data() + i : nullptr; + } + +private: + UHashtable map; + CharString *strings; + bool isFrozen = false; +}; + +U_NAMESPACE_END + +#endif // __UNIQUECHARSTR_H__ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unisetspan.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unisetspan.h new file mode 100644 index 0000000000000000000000000000000000000000..9a1307a9078aab4bc62e118ca5297ad4db943049 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unisetspan.h @@ -0,0 +1,157 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2007, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: unisetspan.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2007mar01 +* created by: Markus W. Scherer +*/ + +#ifndef __UNISETSPAN_H__ +#define __UNISETSPAN_H__ + +#include "unicode/utypes.h" +#include "unicode/uniset.h" + +U_NAMESPACE_BEGIN + +/* + * Implement span() etc. for a set with strings. + * Avoid recursion because of its exponential complexity. + * Instead, try multiple paths at once and track them with an IndexList. + */ +class UnicodeSetStringSpan : public UMemory { +public: + /* + * Which span() variant will be used? + * The object is either built for one variant and used once, + * or built for all and may be used many times. + */ + enum { + FWD = 0x20, + BACK = 0x10, + UTF16 = 8, + UTF8 = 4, + CONTAINED = 2, + NOT_CONTAINED = 1, + + ALL = 0x3f, + + FWD_UTF16_CONTAINED = FWD | UTF16 | CONTAINED, + FWD_UTF16_NOT_CONTAINED = FWD | UTF16 | NOT_CONTAINED, + FWD_UTF8_CONTAINED = FWD | UTF8 | CONTAINED, + FWD_UTF8_NOT_CONTAINED = FWD | UTF8 | NOT_CONTAINED, + BACK_UTF16_CONTAINED = BACK | UTF16 | CONTAINED, + BACK_UTF16_NOT_CONTAINED= BACK | UTF16 | NOT_CONTAINED, + BACK_UTF8_CONTAINED = BACK | UTF8 | CONTAINED, + BACK_UTF8_NOT_CONTAINED = BACK | UTF8 | NOT_CONTAINED + }; + + UnicodeSetStringSpan(const UnicodeSet &set, const UVector &setStrings, uint32_t which); + + // Copy constructor. Assumes which==ALL for a frozen set. + UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStringSpan, const UVector &newParentSetStrings); + + ~UnicodeSetStringSpan(); + + /* + * Do the strings need to be checked in span() etc.? + * @return true if strings need to be checked (call span() here), + * false if not (use a BMPSet for best performance). + */ + inline UBool needsStringSpanUTF16(); + inline UBool needsStringSpanUTF8(); + + // For fast UnicodeSet::contains(c). + inline UBool contains(UChar32 c) const; + + int32_t span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const; + + int32_t spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const; + + int32_t spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCondition) const; + + int32_t spanBackUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCondition) const; + +private: + // Special spanLength byte values. + enum { + // The spanLength is >=0xfe. + LONG_SPAN=0xfe, + // All code points in the string are contained in the parent set. + ALL_CP_CONTAINED=0xff + }; + + // Add a starting or ending string character to the spanNotSet + // so that a character span ends before any string. + void addToSpanNotSet(UChar32 c); + + int32_t spanNot(const UChar *s, int32_t length) const; + int32_t spanNotBack(const UChar *s, int32_t length) const; + int32_t spanNotUTF8(const uint8_t *s, int32_t length) const; + int32_t spanNotBackUTF8(const uint8_t *s, int32_t length) const; + + // Set for span(). Same as parent but without strings. + UnicodeSet spanSet; + + // Set for span(not contained). + // Same as spanSet, plus characters that start or end strings. + UnicodeSet *pSpanNotSet; + + // The strings of the parent set. + const UVector &strings; + + // Pointer to the UTF-8 string lengths. + // Also pointer to further allocated storage for meta data and + // UTF-8 string contents as necessary. + int32_t *utf8Lengths; + + // Pointer to the part of the (utf8Lengths) memory block that stores + // the lengths of span(), spanBack() etc. for each string. + uint8_t *spanLengths; + + // Pointer to the part of the (utf8Lengths) memory block that stores + // the UTF-8 versions of the parent set's strings. + uint8_t *utf8; + + // Number of bytes for all UTF-8 versions of strings together. + int32_t utf8Length; + + // Maximum lengths of relevant strings. + int32_t maxLength16; + int32_t maxLength8; + + // Set up for all variants of span()? + UBool all; + + // Memory for small numbers and lengths of strings. + // For example, for 8 strings: + // 8 UTF-8 lengths, 8*4 bytes span lengths, 8*2 3-byte UTF-8 characters + // = 112 bytes = int32_t[28]. + int32_t staticLengths[32]; +}; + +UBool UnicodeSetStringSpan::needsStringSpanUTF16() { + return (UBool)(maxLength16!=0); +} + +UBool UnicodeSetStringSpan::needsStringSpanUTF8() { + return (UBool)(maxLength8!=0); +} + +UBool UnicodeSetStringSpan::contains(UChar32 c) const { + return spanSet.contains(c); +} + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unistrappender.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unistrappender.h new file mode 100644 index 0000000000000000000000000000000000000000..75fcb9e775f1ebcace578d4add7ebe26267040d8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unistrappender.h @@ -0,0 +1,90 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2015, International Business Machines Corporation and +* others. All Rights Reserved. +****************************************************************************** +* +* File unistrappender.h +****************************************************************************** +*/ + +#ifndef __UNISTRAPPENDER_H__ +#define __UNISTRAPPENDER_H__ + +#include "unicode/unistr.h" +#include "unicode/uobject.h" +#include "unicode/utf16.h" +#include "unicode/utypes.h" +#include "cmemory.h" + +U_NAMESPACE_BEGIN + +/** + * An optimization for the slowness of calling UnicodeString::append() + * one character at a time in a loop. It stores appends in a buffer while + * never actually calling append on the unicode string unless the buffer + * fills up or is flushed. + * + * proper usage: + * { + * UnicodeStringAppender appender(astring); + * for (int32_t i = 0; i < 100; ++i) { + * appender.append((UChar) i); + * } + * // appender flushed automatically when it goes out of scope. + * } + */ +class UnicodeStringAppender : public UMemory { +public: + + /** + * dest is the UnicodeString being appended to. It must always + * exist while this instance exists. + */ + UnicodeStringAppender(UnicodeString &dest) : fDest(&dest), fIdx(0) { } + + inline void append(UChar x) { + if (fIdx == UPRV_LENGTHOF(fBuffer)) { + fDest->append(fBuffer, 0, fIdx); + fIdx = 0; + } + fBuffer[fIdx++] = x; + } + + inline void append(UChar32 x) { + if (fIdx >= UPRV_LENGTHOF(fBuffer) - 1) { + fDest->append(fBuffer, 0, fIdx); + fIdx = 0; + } + U16_APPEND_UNSAFE(fBuffer, fIdx, x); + } + + /** + * Ensures that all appended characters have been written out to dest. + */ + inline void flush() { + if (fIdx) { + fDest->append(fBuffer, 0, fIdx); + } + fIdx = 0; + } + + /** + * flush the buffer when we go out of scope. + */ + ~UnicodeStringAppender() { + flush(); + } +private: + UnicodeString *fDest; + int32_t fIdx; + UChar fBuffer[32]; + UnicodeStringAppender(const UnicodeStringAppender &other); + UnicodeStringAppender &operator=(const UnicodeStringAppender &other); +}; + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unormimp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unormimp.h new file mode 100644 index 0000000000000000000000000000000000000000..d2604adb4a91fa47a79e6dbe5fe01730398553e4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/unormimp.h @@ -0,0 +1,488 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2001-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: unormimp.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2001may25 +* created by: Markus W. Scherer +*/ + +#ifndef __UNORMIMP_H__ +#define __UNORMIMP_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_NORMALIZATION + +#include "udataswp.h" + +/* + * The 2001-2010 implementation of the normalization code loads its data from + * unorm.icu, which is generated with the gennorm tool. + * The format of that file is described at the end of this file. + */ + +/* norm32 value constants */ +enum { + /* quick check flags 0..3 set mean "no" for their forms */ + _NORM_QC_NFC=0x11, /* no|maybe */ + _NORM_QC_NFKC=0x22, /* no|maybe */ + _NORM_QC_NFD=4, /* no */ + _NORM_QC_NFKD=8, /* no */ + + _NORM_QC_ANY_NO=0xf, + + /* quick check flags 4..5 mean "maybe" for their forms; test flags>=_NORM_QC_MAYBE */ + _NORM_QC_MAYBE=0x10, + _NORM_QC_ANY_MAYBE=0x30, + + _NORM_QC_MASK=0x3f, + + _NORM_COMBINES_FWD=0x40, + _NORM_COMBINES_BACK=0x80, + _NORM_COMBINES_ANY=0xc0, + + _NORM_CC_SHIFT=8, /* UnicodeData.txt combining class in bits 15..8 */ + _NORM_CC_MASK=0xff00, + + _NORM_EXTRA_SHIFT=16, /* 16 bits for the index to UChars and other extra data */ + _NORM_EXTRA_INDEX_TOP=0xfc00, /* start of surrogate specials after shift */ + + _NORM_EXTRA_SURROGATE_MASK=0x3ff, + _NORM_EXTRA_SURROGATE_TOP=0x3f0, /* hangul etc. */ + + _NORM_EXTRA_HANGUL=_NORM_EXTRA_SURROGATE_TOP, + _NORM_EXTRA_JAMO_L, + _NORM_EXTRA_JAMO_V, + _NORM_EXTRA_JAMO_T +}; + +/* norm32 value constants using >16 bits */ +#define _NORM_MIN_SPECIAL 0xfc000000 +#define _NORM_SURROGATES_TOP 0xfff00000 +#define _NORM_MIN_HANGUL 0xfff00000 +#define _NORM_MIN_JAMO_V 0xfff20000 +#define _NORM_JAMO_V_TOP 0xfff30000 + +/* value constants for auxTrie */ +enum { + _NORM_AUX_COMP_EX_SHIFT=10, + _NORM_AUX_UNSAFE_SHIFT=11, + _NORM_AUX_NFC_SKIPPABLE_F_SHIFT=12 +}; + +#define _NORM_AUX_MAX_FNC ((int32_t)1<<_NORM_AUX_COMP_EX_SHIFT) + +#define _NORM_AUX_FNC_MASK (uint32_t)(_NORM_AUX_MAX_FNC-1) +#define _NORM_AUX_COMP_EX_MASK ((uint32_t)1<<_NORM_AUX_COMP_EX_SHIFT) +#define _NORM_AUX_UNSAFE_MASK ((uint32_t)1<<_NORM_AUX_UNSAFE_SHIFT) +#define _NORM_AUX_NFC_SKIP_F_MASK ((uint32_t)1<<_NORM_AUX_NFC_SKIPPABLE_F_SHIFT) + +/* canonStartSets[0..31] contains indexes for what is in the array */ +enum { + _NORM_SET_INDEX_CANON_SETS_LENGTH, /* number of uint16_t in canonical starter sets */ + _NORM_SET_INDEX_CANON_BMP_TABLE_LENGTH, /* number of uint16_t in the BMP search table (contains pairs) */ + _NORM_SET_INDEX_CANON_SUPP_TABLE_LENGTH,/* number of uint16_t in the supplementary search table (contains triplets) */ + + /* from formatVersion 2.3: */ + _NORM_SET_INDEX_NX_CJK_COMPAT_OFFSET, /* uint16_t offset from canonStartSets[0] to the + exclusion set for CJK compatibility characters */ + _NORM_SET_INDEX_NX_UNICODE32_OFFSET, /* uint16_t offset from canonStartSets[0] to the + exclusion set for Unicode 3.2 characters */ + _NORM_SET_INDEX_NX_RESERVED_OFFSET, /* uint16_t offset from canonStartSets[0] to the + end of the previous exclusion set */ + + _NORM_SET_INDEX_TOP=32 /* changing this requires a new formatVersion */ +}; + +/* more constants for canonical starter sets */ + +/* 14 bit indexes to canonical USerializedSets */ +#define _NORM_MAX_CANON_SETS 0x4000 + +/* single-code point BMP sets are encoded directly in the search table except if result=0x4000..0x7fff */ +#define _NORM_CANON_SET_BMP_MASK 0xc000 +#define _NORM_CANON_SET_BMP_IS_INDEX 0x4000 + +/* indexes[] value names */ +enum { + _NORM_INDEX_TRIE_SIZE, /* number of bytes in normalization trie */ + _NORM_INDEX_UCHAR_COUNT, /* number of UChars in extra data */ + + _NORM_INDEX_COMBINE_DATA_COUNT, /* number of uint16_t words for combining data */ + _NORM_INDEX_COMBINE_FWD_COUNT, /* number of code points that combine forward */ + _NORM_INDEX_COMBINE_BOTH_COUNT, /* number of code points that combine forward and backward */ + _NORM_INDEX_COMBINE_BACK_COUNT, /* number of code points that combine backward */ + + _NORM_INDEX_MIN_NFC_NO_MAYBE, /* first code point with quick check NFC NO/MAYBE */ + _NORM_INDEX_MIN_NFKC_NO_MAYBE, /* first code point with quick check NFKC NO/MAYBE */ + _NORM_INDEX_MIN_NFD_NO_MAYBE, /* first code point with quick check NFD NO/MAYBE */ + _NORM_INDEX_MIN_NFKD_NO_MAYBE, /* first code point with quick check NFKD NO/MAYBE */ + + _NORM_INDEX_FCD_TRIE_SIZE, /* number of bytes in FCD trie */ + + _NORM_INDEX_AUX_TRIE_SIZE, /* number of bytes in the auxiliary trie */ + _NORM_INDEX_CANON_SET_COUNT, /* number of uint16_t in the array of serialized USet */ + + _NORM_INDEX_TOP=32 /* changing this requires a new formatVersion */ +}; + +enum { + /* FCD check: everything below this code point is known to have a 0 lead combining class */ + _NORM_MIN_WITH_LEAD_CC=0x300 +}; + +enum { + /** + * Bit 7 of the length byte for a decomposition string in extra data is + * a flag indicating whether the decomposition string is + * preceded by a 16-bit word with the leading and trailing cc + * of the decomposition (like for A-umlaut); + * if not, then both cc's are zero (like for compatibility ideographs). + */ + _NORM_DECOMP_FLAG_LENGTH_HAS_CC=0x80, + /** + * Bits 6..0 of the length byte contain the actual length. + */ + _NORM_DECOMP_LENGTH_MASK=0x7f +}; + +/** Constants for options flags for normalization. */ +enum { + /** Options bit 0, do not decompose Hangul syllables. */ + UNORM_NX_HANGUL=1, + /** Options bit 1, do not decompose CJK compatibility characters. */ + UNORM_NX_CJK_COMPAT=2 +}; + +/** + * Description of the format of unorm.icu version 2.3. + * + * Main change from version 1 to version 2: + * Use of new, common UTrie instead of normalization-specific tries. + * Change to version 2.1: add third/auxiliary trie with associated data. + * Change to version 2.2: add skippable (f) flag data (_NORM_AUX_NFC_SKIP_F_MASK). + * Change to version 2.3: add serialized sets for normalization exclusions + * stored inside canonStartSets[] + * + * For more details of how to use the data structures see the code + * in unorm.cpp (runtime normalization code) and + * in gennorm.c and gennorm/store.c (build-time data generation). + * + * For the serialized format of UTrie see utrie.c/UTrieHeader. + * + * - Overall partition + * + * unorm.dat customarily begins with a UDataInfo structure, see udata.h and .c. + * After that there are the following structures: + * + * int32_t indexes[_NORM_INDEX_TOP]; -- _NORM_INDEX_TOP=32, see enum in this file + * + * UTrie normTrie; -- size in bytes=indexes[_NORM_INDEX_TRIE_SIZE] + * + * uint16_t extraData[extraDataTop]; -- extraDataTop=indexes[_NORM_INDEX_UCHAR_COUNT] + * extraData[0] contains the number of units for + * FC_NFKC_Closure (formatVersion>=2.1) + * + * uint16_t combiningTable[combiningTableTop]; -- combiningTableTop=indexes[_NORM_INDEX_COMBINE_DATA_COUNT] + * combiningTableTop may include one 16-bit padding unit + * to make sure that fcdTrie is 32-bit-aligned + * + * UTrie fcdTrie; -- size in bytes=indexes[_NORM_INDEX_FCD_TRIE_SIZE] + * + * UTrie auxTrie; -- size in bytes=indexes[_NORM_INDEX_AUX_TRIE_SIZE] + * + * uint16_t canonStartSets[canonStartSetsTop] -- canonStartSetsTop=indexes[_NORM_INDEX_CANON_SET_COUNT] + * serialized USets and binary search tables, see below + * + * + * The indexes array contains lengths and sizes of the following arrays and structures + * as well as the following values: + * indexes[_NORM_INDEX_COMBINE_FWD_COUNT]=combineFwdTop + * -- one more than the highest combining index computed for forward-only-combining characters + * indexes[_NORM_INDEX_COMBINE_BOTH_COUNT]=combineBothTop-combineFwdTop + * -- number of combining indexes computed for both-ways-combining characters + * indexes[_NORM_INDEX_COMBINE_BACK_COUNT]=combineBackTop-combineBothTop + * -- number of combining indexes computed for backward-only-combining characters + * + * indexes[_NORM_INDEX_MIN_NF*_NO_MAYBE] (where *={ C, D, KC, KD }) + * -- first code point with a quick check NF* value of NO/MAYBE + * + * + * - Tries + * + * The main structures are two UTrie tables ("compact arrays"), + * each with one index array and one data array. + * See utrie.h and utrie.c. + * + * + * - Tries in unorm.dat + * + * The first trie (normTrie above) + * provides data for the NF* quick checks and normalization. + * The second trie (fcdTrie above) provides data just for FCD checks. + * + * + * - norm32 data words from the first trie + * + * The norm32Table contains one 32-bit word "norm32" per code point. + * It contains the following bit fields: + * 31..16 extra data index, _NORM_EXTRA_SHIFT is used to shift this field down + * if this index is <_NORM_EXTRA_INDEX_TOP then it is an index into + * extraData[] where variable-length normalization data for this + * code point is found + * if this index is <_NORM_EXTRA_INDEX_TOP+_NORM_EXTRA_SURROGATE_TOP + * then this is a norm32 for a leading surrogate, and the index + * value is used together with the following trailing surrogate + * code unit in the second trie access + * if this index is >=_NORM_EXTRA_INDEX_TOP+_NORM_EXTRA_SURROGATE_TOP + * then this is a norm32 for a "special" character, + * i.e., the character is a Hangul syllable or a Jamo + * see _NORM_EXTRA_HANGUL etc. + * generally, instead of extracting this index from the norm32 and + * comparing it with the above constants, + * the normalization code compares the entire norm32 value + * with _NORM_MIN_SPECIAL, _NORM_SURROGATES_TOP, _NORM_MIN_HANGUL etc. + * + * 15..8 combining class (cc) according to UnicodeData.txt + * + * 7..6 _NORM_COMBINES_ANY flags, used in composition to see if a character + * combines with any following or preceding character(s) + * at all + * 7 _NORM_COMBINES_BACK + * 6 _NORM_COMBINES_FWD + * + * 5..0 quick check flags, set for "no" or "maybe", with separate flags for + * each normalization form + * the higher bits are "maybe" flags; for NF*D there are no such flags + * the lower bits are "no" flags for all forms, in the same order + * as the "maybe" flags, + * which is (MSB to LSB): NFKD NFD NFKC NFC + * 5..4 _NORM_QC_ANY_MAYBE + * 3..0 _NORM_QC_ANY_NO + * see further related constants + * + * + * - Extra data per code point + * + * "Extra data" is referenced by the index in norm32. + * It is variable-length data. It is only present, and only those parts + * of it are, as needed for a given character. + * The norm32 extra data index is added to the beginning of extraData[] + * to get to a vector of 16-bit words with data at the following offsets: + * + * [-1] Combining index for composition. + * Stored only if norm32&_NORM_COMBINES_ANY . + * [0] Lengths of the canonical and compatibility decomposition strings. + * Stored only if there are decompositions, i.e., + * if norm32&(_NORM_QC_NFD|_NORM_QC_NFKD) + * High byte: length of NFKD, or 0 if none + * Low byte: length of NFD, or 0 if none + * Each length byte also has another flag: + * Bit 7 of a length byte is set if there are non-zero + * combining classes (cc's) associated with the respective + * decomposition. If this flag is set, then the decomposition + * is preceded by a 16-bit word that contains the + * leading and trailing cc's. + * Bits 6..0 of a length byte are the length of the + * decomposition string, not counting the cc word. + * [1..n] NFD + * [n+1..] NFKD + * + * Each of the two decompositions consists of up to two parts: + * - The 16-bit words with the leading and trailing cc's. + * This is only stored if bit 7 of the corresponding length byte + * is set. In this case, at least one of the cc's is not zero. + * High byte: leading cc==cc of the first code point in the decomposition string + * Low byte: trailing cc==cc of the last code point in the decomposition string + * - The decomposition string in UTF-16, with length code units. + * + * + * - Combining indexes and combiningTable[] + * + * Combining indexes are stored at the [-1] offset of the extra data + * if the character combines forward or backward with any other characters. + * They are used for (re)composition in NF*C. + * Values of combining indexes are arranged according to whether a character + * combines forward, backward, or both ways: + * forward-only < both ways < backward-only + * + * The index values for forward-only and both-ways combining characters + * are indexes into the combiningTable[]. + * The index values for backward-only combining characters are simply + * incremented from the preceding index values to be unique. + * + * In the combiningTable[], a variable-length list + * of variable-length (back-index, code point) pair entries is stored + * for each forward-combining character. + * + * These back-indexes are the combining indexes of both-ways or backward-only + * combining characters that the forward-combining character combines with. + * + * Each list is sorted in ascending order of back-indexes. + * Each list is terminated with the last back-index having bit 15 set. + * + * Each pair (back-index, code point) takes up either 2 or 3 + * 16-bit words. + * The first word of a list entry is the back-index, with its bit 15 set if + * this is the last pair in the list. + * + * The second word contains flags in bits 15..13 that determine + * if there is a third word and how the combined character is encoded: + * 15 set if there is a third word in this list entry + * 14 set if the result is a supplementary character + * 13 set if the result itself combines forward + * + * According to these bits 15..14 of the second word, + * the result character is encoded as follows: + * 00 or 01 The result is <=0x1fff and stored in bits 12..0 of + * the second word. + * 10 The result is 0x2000..0xffff and stored in the third word. + * Bits 12..0 of the second word are not used. + * 11 The result is a supplementary character. + * Bits 9..0 of the leading surrogate are in bits 9..0 of + * the second word. + * Add 0xd800 to these bits to get the complete surrogate. + * Bits 12..10 of the second word are not used. + * The trailing surrogate is stored in the third word. + * + * + * - FCD trie + * + * The FCD trie is very simple. + * It is a folded trie with 16-bit data words. + * In each word, the high byte contains the leading cc of the character, + * and the low byte contains the trailing cc of the character. + * These cc's are the cc's of the first and last code points in the + * canonical decomposition of the character. + * + * Since all 16 bits are used for cc's, lead surrogates must be tested + * by checking the code unit instead of the trie data. + * This is done only if the 16-bit data word is not zero. + * If the code unit is a leading surrogate and the data word is not zero, + * then instead of cc's it contains the offset for the second trie lookup. + * + * + * - Auxiliary trie and data + * + * The auxiliary 16-bit trie contains data for additional properties. + * Bits + * 15..13 reserved + * 12 not NFC_Skippable (f) (formatVersion>=2.2) + * 11 flag: not a safe starter for canonical closure + * 10 composition exclusion + * 9.. 0 index into extraData[] to FC_NFKC_Closure string + * (not for lead surrogate), + * or lead surrogate offset (for lead surrogate, if 9..0 not zero) + * + * - FC_NFKC_Closure strings in extraData[] + * + * Strings are either stored as a single code unit or as the length + * followed by that many units. + * const UChar *s=extraData+(index from auxTrie data bits 9..0); + * int32_t length; + * if(*s<0xff00) { + * // s points to the single-unit string + * length=1; + * } else { + * length=*s&0xff; + * ++s; + * } + * + * Conditions for "NF* Skippable" from Mark Davis' com.ibm.text.UCD.NFSkippable: + * (used in NormalizerTransliterator) + * + * A skippable character is + * a) unassigned, or ALL of the following: + * b) of combining class 0. + * c) not decomposed by this normalization form. + * AND if NFC or NFKC, + * d) can never compose with a previous character. + * e) can never compose with a following character. + * f) can never change if another character is added. + * Example: a-breve might satisfy all but f, but if you + * add an ogonek it changes to a-ogonek + breve + * + * a)..e) must be tested from norm32. + * Since f) is more complicated, the (not-)NFC_Skippable flag (f) is built + * into the auxiliary trie. + * The same bit is used for NFC and NFKC; (c) differs for them. + * As usual, we build the "not skippable" flags so that unassigned + * code points get a 0 bit. + * This bit is only valid after (a)..(e) test false; test NFD_NO before (f) as well. + * Test Hangul LV syllables entirely in code. + * + * + * - structure inside canonStartSets[] + * + * This array maps from code points c to sets of code points (USerializedSet). + * The result sets are the code points whose canonical decompositions start + * with c. + * + * canonStartSets[] contains the following sub-arrays: + * + * indexes[_NORM_SET_INDEX_TOP] + * - contains lengths of sub-arrays etc. + * + * startSets[indexes[_NORM_SET_INDEX_CANON_SETS_LENGTH]-_NORM_SET_INDEX_TOP] + * - contains serialized sets (USerializedSet) of canonical starters for + * enumerating canonically equivalent strings + * indexes[_NORM_SET_INDEX_CANON_SETS_LENGTH] includes _NORM_SET_INDEX_TOP + * for details about the structure see uset.c + * + * bmpTable[indexes[_NORM_SET_INDEX_CANON_BMP_TABLE_LENGTH]] + * - a sorted search table for BMP code points whose results are + * either indexes to USerializedSets or single code points for + * single-code point sets; + * each entry is a pair of { code point, result } with result=(binary) yy xxxxxx xxxxxxxx + * if yy==01 then there is a USerializedSet at canonStartSets+x + * else build a USerializedSet with result as the single code point + * + * suppTable[indexes[_NORM_SET_INDEX_CANON_SUPP_TABLE_LENGTH]] + * - a sorted search table for supplementary code points whose results are + * either indexes to USerializedSets or single code points for + * single-code point sets; + * each entry is a triplet of { high16(cp), low16(cp), result } + * each code point's high-word may contain extra data in bits 15..5: + * if the high word has bit 15 set, then build a set with a single code point + * which is (((high16(cp)&0x1f00)<<8)|result; + * else there is a USerializedSet at canonStartSets+result + * + * FormatVersion 2.3 adds 2 serialized sets for normalization exclusions. + * They are stored in the data file so that the runtime normalization code need + * not depend on other properties and their data and implementation files. + * The _NORM_SET_INDEX_NX_..._OFFSET offsets in the canonStartSets index table + * give the location for each set. + * There is no set stored for UNORM_NX_HANGUL because it's trivial to create + * without using properties. + * + * Set contents: + * + * _NORM_SET_INDEX_NX_CJK_COMPAT_OFFSET (for UNORM_NX_CJK_COMPAT) + * [[:Ideographic:]&[:NFD_QC=No:]] + * =[CJK Ideographs]&[has canonical decomposition] + * + * _NORM_SET_INDEX_NX_UNICODE32_OFFSET (for UNORM_UNICODE_3_2) + * [:^Age=3.2:] + * =set with all code points that were not designated by the specified Unicode version + * + * _NORM_SET_INDEX_NX_RESERVED_OFFSET + * This is an offset that points to where the next, future set would start. + * Currently it indicates where the previous set ends, and thus its length. + * The name for this enum constant may in the future be applied to different + * index slots. In order to get the limit of a set, use its index slot and + * the immediately following one regardless of that one's enum name. + */ + +#endif /* #if !UCONFIG_NO_NORMALIZATION */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uposixdefs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uposixdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..23c3f6d466700c7984631205135d823d6a63faac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uposixdefs.h @@ -0,0 +1,77 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2011-2015, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: uposixdefs.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2011jul25 +* created by: Markus W. Scherer +* +* Common definitions for implementation files working with POSIX functions. +* *Important*: #include this file before any other header files! +*/ + +#ifndef __UPOSIXDEFS_H__ +#define __UPOSIXDEFS_H__ + +/* + * Define _XOPEN_SOURCE for access to POSIX functions. + * + * We cannot use U_PLATFORM from platform.h/utypes.h because + * "The Open Group Base Specifications" + * chapter "2.2 The Compilation Environment" says: + * "In the compilation of an application that #defines a feature test macro + * specified by IEEE Std 1003.1-2001, + * no header defined by IEEE Std 1003.1-2001 shall be included prior to + * the definition of the feature test macro." + */ +#ifdef _XOPEN_SOURCE + /* Use the predefined value. */ +#else + /* + * Version 6.0: + * The Open Group Base Specifications Issue 6 (IEEE Std 1003.1, 2004 Edition) + * also known as + * SUSv3 = Open Group Single UNIX Specification, Version 3 (UNIX03) + * + * Note: This definition used to be in C source code (e.g., putil.c) + * and define _XOPEN_SOURCE to different values depending on __STDC_VERSION__. + * In C++ source code (e.g., putil.cpp), __STDC_VERSION__ is not defined at all. + */ +# define _XOPEN_SOURCE 600 +#endif + +/* + * Make sure things like readlink and such functions work. + * Poorly upgraded Solaris machines can't have this defined. + * Cleanly installed Solaris can use this #define. + * + * z/OS needs this definition for timeval and to get usleep. + */ +#if !defined(_XOPEN_SOURCE_EXTENDED) && defined(__TOS_MVS__) +# define _XOPEN_SOURCE_EXTENDED 1 +#endif + +/** + * Solaris says: + * "...it is invalid to compile an XPG6 or a POSIX.1-2001 application with anything other + * than a c99 or later compiler." + * Apparently C++11 is not "or later". Work around this. + */ +#if defined(__cplusplus) && (defined(sun) || defined(__sun)) && !defined (_STDC_C99) +# define _STDC_C99 +#endif + +#if !defined _POSIX_C_SOURCE && \ + defined(__APPLE__) && defined(__MACH__) && !defined(__clang__) +// Needed to prevent EOWNERDEAD issues with GCC on Mac +#define _POSIX_C_SOURCE 200809L +#endif + +#endif /* __UPOSIXDEFS_H__ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uprops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uprops.h new file mode 100644 index 0000000000000000000000000000000000000000..09830bdeb998925dacce3b9b24ba8b6d51afcf6e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uprops.h @@ -0,0 +1,452 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uprops.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002feb24 +* created by: Markus W. Scherer +* +* Constants for mostly non-core Unicode character properties +* stored in uprops.icu. +*/ + +#ifndef __UPROPS_H__ +#define __UPROPS_H__ + +#include "unicode/utypes.h" +#include "unicode/uset.h" +#include "uset_imp.h" +#include "udataswp.h" + +/* indexes[] entries */ +enum { + UPROPS_PROPS32_INDEX, + UPROPS_EXCEPTIONS_INDEX, + UPROPS_EXCEPTIONS_TOP_INDEX, + + UPROPS_ADDITIONAL_TRIE_INDEX, + UPROPS_ADDITIONAL_VECTORS_INDEX, + UPROPS_ADDITIONAL_VECTORS_COLUMNS_INDEX, + + UPROPS_SCRIPT_EXTENSIONS_INDEX, + + UPROPS_RESERVED_INDEX_7, + UPROPS_RESERVED_INDEX_8, + + /* size of the data file (number of 32-bit units after the header) */ + UPROPS_DATA_TOP_INDEX, + + /* maximum values for code values in vector word 0 */ + UPROPS_MAX_VALUES_INDEX=10, + /* maximum values for code values in vector word 2 */ + UPROPS_MAX_VALUES_2_INDEX, + + UPROPS_INDEX_COUNT=16 +}; + +/* definitions for the main properties words */ +enum { + /* general category shift==0 0 (5 bits) */ + /* reserved 5 (1 bit) */ + UPROPS_NUMERIC_TYPE_VALUE_SHIFT=6 /* 6 (10 bits) */ +}; + +#define GET_CATEGORY(props) ((props)&0x1f) +#define CAT_MASK(props) U_MASK(GET_CATEGORY(props)) + +#define GET_NUMERIC_TYPE_VALUE(props) ((props)>>UPROPS_NUMERIC_TYPE_VALUE_SHIFT) + +/* constants for the storage form of numeric types and values */ +enum { + /** No numeric value. */ + UPROPS_NTV_NONE=0, + /** Decimal digits: nv=0..9 */ + UPROPS_NTV_DECIMAL_START=1, + /** Other digits: nv=0..9 */ + UPROPS_NTV_DIGIT_START=11, + /** Small integers: nv=0..154 */ + UPROPS_NTV_NUMERIC_START=21, + /** Fractions: ((ntv>>4)-12) / ((ntv&0xf)+1) = -1..17 / 1..16 */ + UPROPS_NTV_FRACTION_START=0xb0, + /** + * Large integers: + * ((ntv>>5)-14) * 10^((ntv&0x1f)+2) = (1..9)*(10^2..10^33) + * (only one significant decimal digit) + */ + UPROPS_NTV_LARGE_START=0x1e0, + /** + * Sexagesimal numbers: + * ((ntv>>2)-0xbf) * 60^((ntv&3)+1) = (1..9)*(60^1..60^4) + */ + UPROPS_NTV_BASE60_START=0x300, + /** + * Fraction-20 values: + * frac20 = ntv-0x324 = 0..0x17 -> 1|3|5|7 / 20|40|80|160|320|640 + * numerator: num = 2*(frac20&3)+1 + * denominator: den = 20<<(frac20>>2) + */ + UPROPS_NTV_FRACTION20_START=UPROPS_NTV_BASE60_START+36, // 0x300+9*4=0x324 + /** + * Fraction-32 values: + * frac32 = ntv-0x34c = 0..15 -> 1|3|5|7 / 32|64|128|256 + * numerator: num = 2*(frac32&3)+1 + * denominator: den = 32<<(frac32>>2) + */ + UPROPS_NTV_FRACTION32_START=UPROPS_NTV_FRACTION20_START+24, // 0x324+6*4=0x34c + /** No numeric value (yet). */ + UPROPS_NTV_RESERVED_START=UPROPS_NTV_FRACTION32_START+16, // 0x34c+4*4=0x35c + + UPROPS_NTV_MAX_SMALL_INT=UPROPS_NTV_FRACTION_START-UPROPS_NTV_NUMERIC_START-1 +}; + +#define UPROPS_NTV_GET_TYPE(ntv) \ + ((ntv==UPROPS_NTV_NONE) ? U_NT_NONE : \ + (ntv> UPROPS_SCRIPT_HIGH_SHIFT) | + (scriptX & UPROPS_SCRIPT_LOW_MASK); +} + +} // namespace + +#endif // __cplusplus + +/* + * Properties in vector word 1 + * Each bit encodes one binary property. + * The following constants represent the bit number, use 1<>28UL)) +#define RES_GET_OFFSET(res) ((res)&0x0fffffff) +#define RES_GET_POINTER(pRoot, res) ((pRoot)+RES_GET_OFFSET(res)) + +/* get signed and unsigned integer values directly from the Resource handle + * NOTE: For proper logging, please use the res_getInt() constexpr + */ +#if U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC +# define RES_GET_INT_NO_TRACE(res) (((int32_t)((res)<<4L))>>4L) +#else +# define RES_GET_INT_NO_TRACE(res) (int32_t)(((res)&0x08000000) ? (res)|0xf0000000 : (res)&0x07ffffff) +#endif + +#define RES_GET_UINT_NO_TRACE(res) ((res)&0x0fffffff) + +#define URES_IS_ARRAY(type) ((int32_t)(type)==URES_ARRAY || (int32_t)(type)==URES_ARRAY16) +#define URES_IS_TABLE(type) ((int32_t)(type)==URES_TABLE || (int32_t)(type)==URES_TABLE16 || (int32_t)(type)==URES_TABLE32) +#define URES_IS_CONTAINER(type) (URES_IS_TABLE(type) || URES_IS_ARRAY(type)) + +#define URES_MAKE_RESOURCE(type, offset) (((Resource)(type)<<28)|(Resource)(offset)) +#define URES_MAKE_EMPTY_RESOURCE(type) ((Resource)(type)<<28) + +/* indexes[] value names; indexes are generally 32-bit (Resource) indexes */ +enum { + /** + * [0] contains the length of indexes[] + * which is at most URES_INDEX_TOP of the latest format version + * + * formatVersion==1: all bits contain the length of indexes[] + * but the length is much less than 0xff; + * formatVersion>1: + * only bits 7..0 contain the length of indexes[], + * bits 31..8 are reserved and set to 0 + * formatVersion>=3: + * bits 31..8 poolStringIndexLimit bits 23..0 + */ + URES_INDEX_LENGTH, + /** + * [1] contains the top of the key strings, + * same as the bottom of resources or UTF-16 strings, rounded up + */ + URES_INDEX_KEYS_TOP, + /** [2] contains the top of all resources */ + URES_INDEX_RESOURCES_TOP, + /** + * [3] contains the top of the bundle, + * in case it were ever different from [2] + */ + URES_INDEX_BUNDLE_TOP, + /** [4] max. length of any table */ + URES_INDEX_MAX_TABLE_LENGTH, + /** + * [5] attributes bit set, see URES_ATT_* (new in formatVersion 1.2) + * + * formatVersion>=3: + * bits 31..16 poolStringIndex16Limit + * bits 15..12 poolStringIndexLimit bits 27..24 + */ + URES_INDEX_ATTRIBUTES, + /** + * [6] top of the 16-bit units (UTF-16 string v2 UChars, URES_TABLE16, URES_ARRAY16), + * rounded up (new in formatVersion 2.0, ICU 4.4) + */ + URES_INDEX_16BIT_TOP, + /** [7] checksum of the pool bundle (new in formatVersion 2.0, ICU 4.4) */ + URES_INDEX_POOL_CHECKSUM, + URES_INDEX_TOP +}; + +/* + * Nofallback attribute, attribute bit 0 in indexes[URES_INDEX_ATTRIBUTES]. + * New in formatVersion 1.2 (ICU 3.6). + * + * If set, then this resource bundle is a standalone bundle. + * If not set, then the bundle participates in locale fallback, eventually + * all the way to the root bundle. + * If indexes[] is missing or too short, then the attribute cannot be determined + * reliably. Dependency checking should ignore such bundles, and loading should + * use fallbacks. + */ +#define URES_ATT_NO_FALLBACK 1 + +/* + * Attributes for bundles that are, or use, a pool bundle. + * A pool bundle provides key strings that are shared among several other bundles + * to reduce their total size. + * New in formatVersion 2 (ICU 4.4). + */ +#define URES_ATT_IS_POOL_BUNDLE 2 +#define URES_ATT_USES_POOL_BUNDLE 4 + +/* + * File format for .res resource bundle files + * + * ICU 56: New in formatVersion 3 compared with 2: ------------- + * + * Resource bundles can optionally use shared string-v2 values + * stored in the pool bundle. + * If so, then the indexes[] contain two new values + * in previously-unused bits of existing indexes[] slots: + * - poolStringIndexLimit: + * String-v2 offsets (in 32-bit Resource words) below this limit + * point to pool bundle string-v2 values. + * - poolStringIndex16Limit: + * Resource16 string-v2 offsets below this limit + * point to pool bundle string-v2 values. + * Guarantee: poolStringIndex16Limit <= poolStringIndexLimit + * + * The local bundle's poolStringIndexLimit is greater than + * any pool bundle string index used in the local bundle. + * The poolStringIndexLimit should not be greater than + * the maximum possible pool bundle string index. + * + * The maximum possible pool bundle string index is the index to the last non-NUL + * pool string character, due to suffix sharing. + * + * In the pool bundle, there is no structure that lists the strings. + * (The root resource is an empty Table.) + * If the strings need to be enumerated (as genrb --usePoolBundle does), + * then iterate through the pool bundle's 16-bit-units array from the beginning. + * Stop at the end of the array, or when an explicit or implicit string length + * would lead beyond the end of the array, + * or when an apparent string is not NUL-terminated. + * (Future genrb version might terminate the strings with + * what looks like a large explicit string length.) + * + * ICU 4.4: New in formatVersion 2 compared with 1.3: ------------- + * + * Three new resource types -- String-v2, Table16 and Array16 -- have their + * values stored in a new array of 16-bit units between the table key strings + * and the start of the other resources. + * + * genrb eliminates duplicates among Unicode string-v2 values. + * Multiple Unicode strings may use the same offset and string data, + * or a short string may point to the suffix of a longer string. ("Suffix sharing") + * For example, one string "abc" may be reused for another string "bc" by pointing + * to the second character. (Short strings-v2 are NUL-terminated + * and not preceded by an explicit length value.) + * + * It is allowed for all resource types to share values. + * The swapper code (ures_swap()) has been modified so that it swaps each item + * exactly once. + * + * A resource bundle may use a special pool bundle. Some or all of the table key strings + * of the using-bundle are omitted, and the key string offsets for such key strings refer + * to offsets in the pool bundle. + * The using-bundle's and the pool-bundle's indexes[URES_INDEX_POOL_CHECKSUM] values + * must match. + * Two bits in indexes[URES_INDEX_ATTRIBUTES] indicate whether a resource bundle + * is or uses a pool bundle. + * + * Table key strings must be compared in ASCII order, even if they are not + * stored in ASCII. + * + * New in formatVersion 1.3 compared with 1.2: ------------- + * + * genrb eliminates duplicates among key strings. + * Multiple table items may share one key string, or one item may point + * to the suffix of another's key string. ("Suffix sharing") + * For example, one key "abc" may be reused for another key "bc" by pointing + * to the second character. (Key strings are NUL-terminated.) + * + * ------------- + * + * An ICU4C resource bundle file (.res) is a binary, memory-mappable file + * with nested, hierarchical data structures. + * It physically contains the following: + * + * Resource root; -- 32-bit Resource item, root item for this bundle's tree; + * currently, the root item must be a table or table32 resource item + * int32_t indexes[indexes[0]]; -- array of indexes for friendly + * reading and swapping; see URES_INDEX_* above + * new in formatVersion 1.1 (ICU 2.8) + * char keys[]; -- characters for key strings + * (formatVersion 1.0: up to 65k of characters; 1.1: <2G) + * (minus the space for root and indexes[]), + * which consist of invariant characters (ASCII/EBCDIC) and are NUL-terminated; + * padded to multiple of 4 bytes for 4-alignment of the following data + * uint16_t 16BitUnits[]; -- resources that are stored entirely as sequences of 16-bit units + * (new in formatVersion 2/ICU 4.4) + * data is indexed by the offset values in 16-bit resource types, + * with offset 0 pointing to the beginning of this array; + * there is a 0 at offset 0, for empty resources; + * padded to multiple of 4 bytes for 4-alignment of the following data + * data; -- data directly and indirectly indexed by the root item; + * the structure is determined by walking the tree + * + * Each resource bundle item has a 32-bit Resource handle (see typedef above) + * which contains the item type number in its upper 4 bits (31..28) and either + * an offset or a direct value in its lower 28 bits (27..0). + * The order of items is undefined and only determined by walking the tree. + * Leaves of the tree may be stored first or last or anywhere in between, + * and it is in theory possible to have unreferenced holes in the file. + * + * 16-bit-unit values: + * Starting with formatVersion 2/ICU 4.4, some resources are stored in a special + * array of 16-bit units. Each resource value is a sequence of 16-bit units, + * with no per-resource padding to a 4-byte boundary. + * 16-bit container types (Table16 and Array16) contain Resource16 values + * which are offsets to String-v2 resources in the same 16-bit-units array. + * + * Direct values: + * - Empty Unicode strings have an offset value of 0 in the Resource handle itself. + * - Starting with formatVersion 2/ICU 4.4, an offset value of 0 for + * _any_ resource type indicates an empty value. + * - Integer values are 28-bit values stored in the Resource handle itself; + * the interpretation of unsigned vs. signed integers is up to the application. + * + * All other types and values use 28-bit offsets to point to the item's data. + * The offset is an index to the first 32-bit word of the value, relative to the + * start of the resource data (i.e., the root item handle is at offset 0). + * To get byte offsets, the offset is multiplied by 4 (or shifted left by 2 bits). + * All resource item values are 4-aligned. + * + * New in formatVersion 2/ICU 4.4: Some types use offsets into the 16-bit-units array, + * indexing 16-bit units in that array. + * + * The structures (memory layouts) for the values for each item type are listed + * in the table below. + * + * Nested, hierarchical structures: ------------- + * + * Table items contain key-value pairs where the keys are offsets to char * key strings. + * The values of these pairs are either Resource handles or + * offsets into the 16-bit-units array, depending on the table type. + * + * Array items are simple vectors of Resource handles, + * or of offsets into the 16-bit-units array, depending on the array type. + * + * Table key string offsets: ------- + * + * Key string offsets are relative to the start of the resource data (of the root handle), + * i.e., the first string has an offset of 4+sizeof(indexes). + * (After the 4-byte root handle and after the indexes array.) + * + * If the resource bundle uses a pool bundle, then some key strings are stored + * in the pool bundle rather than in the local bundle itself. + * - In a Table or Table16, the 16-bit key string offset is local if it is + * less than indexes[URES_INDEX_KEYS_TOP]<<2. + * Otherwise, subtract indexes[URES_INDEX_KEYS_TOP]<<2 to get the offset into + * the pool bundle key strings. + * - In a Table32, the 32-bit key string offset is local if it is non-negative. + * Otherwise, reset bit 31 to get the pool key string offset. + * + * Unlike the local offset, the pool key offset is relative to + * the start of the key strings, not to the start of the bundle. + * + * An alias item is special (and new in ICU 2.4): -------------- + * + * Its memory layout is just like for a UnicodeString, but at runtime it resolves to + * another resource bundle's item according to the path in the string. + * This is used to share items across bundles that are in different lookup/fallback + * chains (e.g., large collation data among zh_TW and zh_HK). + * This saves space (for large items) and maintenance effort (less duplication of data). + * + * -------------------------------------------------------------------------- + * + * Resource types: + * + * Most resources have their values stored at four-byte offsets from the start + * of the resource data. These values are at least 4-aligned. + * Some resource values are stored directly in the offset field of the Resource itself. + * See UResType in unicode/ures.h for enumeration constants for Resource types. + * + * Some resources have their values stored as sequences of 16-bit units, + * at 2-byte offsets from the start of a contiguous 16-bit-unit array between + * the table key strings and the other resources. (new in formatVersion 2/ICU 4.4) + * At offset 0 of that array is a 16-bit zero value for empty 16-bit resources. + * + * Resource16 values in Table16 and Array16 are 16-bit offsets to String-v2 + * resources, with the offsets relative to the start of the 16-bit-units array. + * Starting with formatVersion 3/ICU 56, if offset(URES_NONE)), + fTraceInfo() {} + virtual ~ResourceDataValue(); + + void setData(const ResourceData *data) { + resData = *data; + } + + void setResource(Resource r, ResourceTracer&& traceInfo) { + res = r; + fTraceInfo = traceInfo; + } + + const ResourceData &getData() const { return resData; } + virtual UResType getType() const; + virtual const UChar *getString(int32_t &length, UErrorCode &errorCode) const; + virtual const UChar *getAliasString(int32_t &length, UErrorCode &errorCode) const; + virtual int32_t getInt(UErrorCode &errorCode) const; + virtual uint32_t getUInt(UErrorCode &errorCode) const; + virtual const int32_t *getIntVector(int32_t &length, UErrorCode &errorCode) const; + virtual const uint8_t *getBinary(int32_t &length, UErrorCode &errorCode) const; + virtual ResourceArray getArray(UErrorCode &errorCode) const; + virtual ResourceTable getTable(UErrorCode &errorCode) const; + virtual UBool isNoInheritanceMarker() const; + virtual int32_t getStringArray(UnicodeString *dest, int32_t capacity, + UErrorCode &errorCode) const; + virtual int32_t getStringArrayOrStringAsArray(UnicodeString *dest, int32_t capacity, + UErrorCode &errorCode) const; + virtual UnicodeString getStringOrFirstOfArray(UErrorCode &errorCode) const; + +private: + // TODO(ICU-20769): If UResourceBundle.fResData becomes a pointer, + // then remove this value field again and just store a pResData pointer. + ResourceData resData; + Resource res; + ResourceTracer fTraceInfo; +}; + +U_NAMESPACE_END + +#endif /* __cplusplus */ + +/** + * Swap an ICU resource bundle. See udataswp.h. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ures_swap(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uresimp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uresimp.h new file mode 100644 index 0000000000000000000000000000000000000000..f038dedace3676539e4ec3acf317b334743da515 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uresimp.h @@ -0,0 +1,366 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2000-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef URESIMP_H +#define URESIMP_H + +#include "unicode/ures.h" +#include "unicode/utypes.h" + +#include "uresdata.h" + +#define kRootLocaleName "root" +#define kPoolBundleName "pool" + +/* + The default minor version and the version separator must be exactly one + character long. +*/ + +#define kDefaultMinorVersion "0" +#define kVersionSeparator "." +#define kVersionTag "Version" + +#define MAGIC1 19700503 +#define MAGIC2 19641227 + +#define URES_MAX_ALIAS_LEVEL 256 +#define URES_MAX_BUFFER_SIZE 256 + +#define EMPTY_SET 0x2205 + +struct UResourceDataEntry; +typedef struct UResourceDataEntry UResourceDataEntry; + +/* + * Note: If we wanted to make this structure smaller, then we could try + * to use one UResourceDataEntry pointer for fAlias and fPool, with a separate + * flag to distinguish whether this struct is for a real bundle with a pool, + * or for an alias entry for which we won't use the pool after loading. + */ +struct UResourceDataEntry { + char *fName; /* name of the locale for bundle - still to decide whether it is original or fallback */ + char *fPath; /* path to bundle - used for distinguishing between resources with the same name */ + UResourceDataEntry *fParent; /*next resource in fallback chain*/ + UResourceDataEntry *fAlias; + UResourceDataEntry *fPool; + ResourceData fData; /* data for low level access */ + char fNameBuffer[3]; /* A small buffer of free space for fName. The free space is due to struct padding. */ + uint32_t fCountExisting; /* how much is this resource used */ + UErrorCode fBogus; + /* int32_t fHashKey;*/ /* for faster access in the hashtable */ +}; + +#define RES_BUFSIZE 64 +#define RES_PATH_SEPARATOR '/' +#define RES_PATH_SEPARATOR_S "/" + +struct UResourceBundle { + const char *fKey; /*tag*/ + UResourceDataEntry *fData; /*for low-level access*/ + char *fVersion; + UResourceDataEntry *fTopLevelData; /* for getting the valid locale */ + char *fResPath; /* full path to the resource: "zh_TW/CollationElements/Sequence" */ + // TODO(ICU-20769): Try to change the by-value fResData into a pointer, + // with the struct in only one place for each bundle. + // Also replace class ResourceDataValue.resData with a pResData pointer again. + ResourceData fResData; + char fResBuf[RES_BUFSIZE]; + int32_t fResPathLen; + Resource fRes; + UBool fHasFallback; + UBool fIsTopLevel; + uint32_t fMagic1; /* For determining if it's a stack object */ + uint32_t fMagic2; /* For determining if it's a stack object */ + int32_t fIndex; + int32_t fSize; + + /*const UResourceBundle *fParentRes;*/ /* needed to get the actual locale for a child resource */ +}; + +U_CAPI void U_EXPORT2 ures_initStackObject(UResourceBundle* resB); + +#ifdef __cplusplus + +U_NAMESPACE_BEGIN + +/** + * \class StackUResourceBundle + * "Smart pointer" like class, closes a UResourceBundle via ures_close(). + * + * This code: + * + * StackUResourceBundle bundle; + * foo(bundle.getAlias()); + * + * Is equivalent to this code: + * + * UResourceBundle bundle; + * ures_initStackObject(&bundle); + * foo(&bundle); + * ures_close(&bundle); + * + * @see LocalUResourceBundlePointer + * @internal + */ +class U_COMMON_API StackUResourceBundle { +public: + // No heap allocation. Use only on the stack. + static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete; +#if U_HAVE_PLACEMENT_NEW + static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete; +#endif + + StackUResourceBundle(); + ~StackUResourceBundle(); + + UResourceBundle* getAlias() { return &bundle; } + + UResourceBundle& ref() { return bundle; } + const UResourceBundle& ref() const { return bundle; } + + StackUResourceBundle(const StackUResourceBundle&) = delete; + StackUResourceBundle& operator=(const StackUResourceBundle&) = delete; + + StackUResourceBundle(StackUResourceBundle&&) = delete; + StackUResourceBundle& operator=(StackUResourceBundle&&) = delete; + +private: + UResourceBundle bundle; +}; + +U_NAMESPACE_END + +#endif /* __cplusplus */ + +/** + * Opens a resource bundle for the locale; + * if there is not even a base language bundle, then loads the root bundle; + * never falls back to the default locale. + * + * This is used for algorithms that have good pan-Unicode default behavior, + * such as case mappings, collation, and segmentation (BreakIterator). + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_openNoDefault(const char* path, const char* localeID, UErrorCode* status); + +/* Some getters used by the copy constructor */ +U_CFUNC const char* ures_getName(const UResourceBundle* resB); +#ifdef URES_DEBUG +U_CFUNC const char* ures_getPath(const UResourceBundle* resB); +/** + * If anything was in the RB cache, dump it to the screen. + * @return true if there was anything into the cache + */ +U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void); +#endif +/*U_CFUNC void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t lenToAdd);*/ +/*U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd);*/ +/*U_CFUNC void ures_freeResPath(UResourceBundle *resB);*/ + +/* Candidates for export */ +U_CFUNC UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *original, UErrorCode *status); + +/** + * Returns a resource that can be located using the pathToResource argument. One needs optional package, locale + * and path inside the locale, for example: "/myData/en/zoneStrings/3". Keys and indexes are supported. Keys + * need to reference data in named structures, while indexes can reference both named and anonymous resources. + * Features a fill-in parameter. + * + * Note, this function does NOT have a syntax for specifying items within a tree. May want to consider a + * syntax that delineates between package/tree and resource. + * + * @param pathToResource a path that will lead to the requested resource + * @param fillIn if NULL a new UResourceBundle struct is allocated and must be deleted by the caller. + * Alternatively, you can supply a struct to be filled by this function. + * @param status fills in the outgoing error code. + * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_findResource(const char* pathToResource, + UResourceBundle *fillIn, UErrorCode *status); + +/** + * Returns a sub resource that can be located using the pathToResource argument. One needs a path inside + * the supplied resource, for example, if you have "en_US" resource bundle opened, you might ask for + * "zoneStrings/3". Keys and indexes are supported. Keys + * need to reference data in named structures, while indexes can reference both + * named and anonymous resources. + * Features a fill-in parameter. + * + * @param resourceBundle a resource + * @param pathToResource a path that will lead to the requested resource + * @param fillIn if NULL a new UResourceBundle struct is allocated and must be deleted by the caller. + * Alternatively, you can supply a struct to be filled by this function. + * @param status fills in the outgoing error code. + * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_findSubResource(const UResourceBundle *resB, + char* pathToResource, + UResourceBundle *fillIn, UErrorCode *status); + +/** + * Returns a functionally equivalent locale (considering keywords) for the specified keyword. + * @param result fillin for the equivalent locale + * @param resultCapacity capacity of the fillin buffer + * @param path path to the tree, or NULL for ICU data + * @param resName top level resource. Example: "collations" + * @param keyword locale keyword. Example: "collation" + * @param locid The requested locale + * @param isAvailable If non-null, pointer to fillin parameter that indicates whether the + * requested locale was available. The locale is defined as 'available' if it physically + * exists within the specified tree. + * @param omitDefault if true, omit keyword and value if default. 'de_DE\@collation=standard' -> 'de_DE' + * @param status error code + * @return the actual buffer size needed for the full locale. If it's greater + * than resultCapacity, the returned full name will be truncated and an error code will be returned. + */ +U_CAPI int32_t U_EXPORT2 +ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, + const char *path, const char *resName, const char *keyword, const char *locid, + UBool *isAvailable, UBool omitDefault, UErrorCode *status); + +/** + * Given a tree path and keyword, return a string enumeration of all possible values for that keyword. + * @param path path to the tree, or NULL for ICU data + * @param keyword a particular keyword to consider, must match a top level resource name + * within the tree. + * @param status error code + */ +U_CAPI UEnumeration* U_EXPORT2 +ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status); + + +/** + * Get a resource with multi-level fallback. Normally only the top level resources will + * fallback to its parent. This performs fallback on subresources. For example, when a table + * is defined in a resource bundle and a parent resource bundle, normally no fallback occurs + * on the sub-resources because the table is defined in the current resource bundle, but this + * function can perform fallback on the sub-resources of the table. + * @param resB a resource + * @param inKey a key associated with the requested resource + * @param fillIn if NULL a new UResourceBundle struct is allocated and must be deleted by the caller. + * Alternatively, you can supply a struct to be filled by this function. + * @param status: fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it + */ +U_CAPI UResourceBundle* U_EXPORT2 +ures_getByKeyWithFallback(const UResourceBundle *resB, + const char* inKey, + UResourceBundle *fillIn, + UErrorCode *status); + + +/** + * Get a String with multi-level fallback. Normally only the top level resources will + * fallback to its parent. This performs fallback on subresources. For example, when a table + * is defined in a resource bundle and a parent resource bundle, normally no fallback occurs + * on the sub-resources because the table is defined in the current resource bundle, but this + * function can perform fallback on the sub-resources of the table. + * @param resB a resource + * @param inKey a key associated with the requested resource + * @param len if not NULL, used to return the length of the string + * @param status: fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return returns a pointer to a zero-terminated UChar array which lives in a + * memory mapped/DLL file. + */ +U_CAPI const UChar* U_EXPORT2 +ures_getStringByKeyWithFallback(const UResourceBundle *resB, + const char* inKey, + int32_t* len, + UErrorCode *status); + +#ifdef __cplusplus + +U_CAPI void U_EXPORT2 +ures_getValueWithFallback(const UResourceBundle *bundle, const char *path, + UResourceBundle *tempFillIn, + icu::ResourceDataValue &value, UErrorCode &errorCode); + +U_CAPI void U_EXPORT2 +ures_getAllItemsWithFallback(const UResourceBundle *bundle, const char *path, + icu::ResourceSink &sink, UErrorCode &errorCode); + +#endif /* __cplusplus */ + +/** + * Get a version number by key + * @param resB bundle containing version number + * @param key the key for the version number + * @param ver fillin for the version number + * @param status error code + */ +U_CAPI void U_EXPORT2 +ures_getVersionByKey(const UResourceBundle *resB, + const char *key, + UVersionInfo ver, + UErrorCode *status); + + +/** + * Internal function. + * Return the version number associated with this ResourceBundle as a string. + * + * @param resourceBundle The resource bundle for which the version is checked. + * @return A version number string as specified in the resource bundle or its parent. + * The caller does not own this string. + * @see ures_getVersion + */ +U_CAPI const char* U_EXPORT2 +ures_getVersionNumberInternal(const UResourceBundle *resourceBundle); + +/** + * Return the name of the Locale associated with this ResourceBundle. This API allows + * you to query for the real locale of the resource. For example, if you requested + * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. + * For subresources, the locale where this resource comes from will be returned. + * If fallback has occured, getLocale will reflect this. + * + * This internal version avoids deprecated-warnings in ICU code. + * + * @param resourceBundle resource bundle in question + * @param status just for catching illegal arguments + * @return A Locale name + */ +U_CAPI const char* U_EXPORT2 +ures_getLocaleInternal(const UResourceBundle* resourceBundle, + UErrorCode* status); + +/** + * Same as ures_openDirect() but uses the fill-in parameter instead of allocating a new bundle. + * + * @param r The existing UResourceBundle to fill in. If NULL then status will be + * set to U_ILLEGAL_ARGUMENT_ERROR. + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. If NULL, ICU data will be used. + * @param locale specifies the locale for which we want to open the resource + * if NULL, the default locale will be used. If strlen(locale) == 0 + * root locale will be used. + * @param status The error code. + * @see ures_openDirect + * @internal + */ +U_CAPI void U_EXPORT2 +ures_openDirectFillIn(UResourceBundle *r, + const char *packageName, + const char *locale, + UErrorCode *status); + +#endif /*URESIMP_H*/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ureslocs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ureslocs.h new file mode 100644 index 0000000000000000000000000000000000000000..f7c3344ef201a8c124cb77c838e7db1c18b61f72 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ureslocs.h @@ -0,0 +1,27 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2009-2014 International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef __URESLOCS_H__ +#define __URESLOCS_H__ + +#include "unicode/utypes.h" +#include "unicode/udata.h" + +U_CDECL_BEGIN + + +#define U_ICUDATA_LANG U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "lang" +#define U_ICUDATA_REGION U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "region" +#define U_ICUDATA_CURR U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "curr" +#define U_ICUDATA_ZONE U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "zone" +#define U_ICUDATA_UNIT U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "unit" + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/usc_impl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/usc_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..44899649d4c31516ebfbd4b6d889fff296ce6359 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/usc_impl.h @@ -0,0 +1,139 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File USC_IMPL.H +* +* Modification History: +* +* Date Name Description +* 07/08/2002 Eric Mader Creation. +****************************************************************************** +*/ + +#ifndef USC_IMPL_H +#define USC_IMPL_H +#include "unicode/utypes.h" +#include "unicode/uscript.h" + +/** + * UScriptRun is used to find runs of characters in + * the same script. It implements a simple iterator over an array + * of characters. The iterator will resolve script-neutral characters + * like punctuation into the script of the surrounding characters. + * + * The iterator will try to match paired punctuation. If it sees an + * opening punctuation character, it will remember the script that + * was assigned to that character, and assign the same script to the + * matching closing punctuation. + * + * Scripts are chosen based on the UScriptCode enumeration. + * No attempt is made to combine related scripts into a single run. In + * particular, Hiragana, Katakana, and Han characters will appear in seperate + * runs. + + * Here is an example of how to iterate over script runs: + *

+ * \code
+ * void printScriptRuns(const UChar *text, int32_t length)
+ * {
+ *     UErrorCode error = U_ZERO_ERROR;
+ *     UScriptRun *scriptRun = uscript_openRun(text, testLength, &error);
+ *     int32_t start = 0, limit = 0;
+ *     UScriptCode code = USCRIPT_INVALID_CODE;
+ *
+ *     while (uscript_nextRun(&start, &limit, &code)) {
+ *         printf("Script '%s' from %d to %d.\n", uscript_getName(code), start, limit);
+ *     }
+ *
+ *     uscript_closeRun(scriptRun);
+ *  }
+ * 
+ */ +struct UScriptRun; + +typedef struct UScriptRun UScriptRun; + +/** + * Create a UScriptRun object for iterating over the given text. This object must + * be freed using uscript_closeRun(). Note that this object does not copy the source text, + * only the pointer to it. You must make sure that the pointer remains valid until you call + * uscript_closeRun() or uscript_setRunText(). + * + * @param src is the address of the array of characters over which to iterate. + * if src == NULL and length == 0, + * an empty UScriptRun object will be returned. + * + * @param length is the number of characters over which to iterate. + * + * @param pErrorCode is a pointer to a valid UErrorCode value. If this value + * indicates a failure on entry, the function will immediately return. + * On exit the value will indicate the success of the operation. + * + * @return the address of UScriptRun object which will iterate over the text, + * or NULL if the operation failed. + */ +U_CAPI UScriptRun * U_EXPORT2 +uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode); + +/** + * Frees the given UScriptRun object and any storage associated with it. + * On return, scriptRun no longer points to a valid UScriptRun object. + * + * @param scriptRun is the UScriptRun object which will be freed. + */ +U_CAPI void U_EXPORT2 +uscript_closeRun(UScriptRun *scriptRun); + +/** + * Reset the UScriptRun object so that it will start iterating from + * the beginning. + * + * @param scriptRun is the address of the UScriptRun object to be reset. + */ +U_CAPI void U_EXPORT2 +uscript_resetRun(UScriptRun *scriptRun); + +/** + * Change the text over which the given UScriptRun object iterates. + * + * @param scriptRun is the UScriptRun object which will be changed. + * + * @param src is the address of the new array of characters over which to iterate. + * If src == NULL and length == 0, + * the UScriptRun object will become empty. + * + * @param length is the new number of characters over which to iterate + * + * @param pErrorCode is a pointer to a valid UErrorCode value. If this value + * indicates a failure on entry, the function will immediately return. + * On exit the value will indicate the success of the operation. + */ +U_CAPI void U_EXPORT2 +uscript_setRunText(UScriptRun *scriptRun, const UChar *src, int32_t length, UErrorCode *pErrorCode); + +/** + * Advance the UScriptRun object to the next script run, return the start and limit + * offsets, and the script of the run. + * + * @param scriptRun is the address of the UScriptRun object. + * + * @param pRunStart is a pointer to the variable to receive the starting offset of the next run. + * This pointer can be NULL if the value is not needed. + * + * @param pRunLimit is a pointer to the variable to receive the limit offset of the next run. + * This pointer can be NULL if the value is not needed. + * + * @param pRunScript is a pointer to the variable to receive the UScriptCode for the + * script of the current run. This pointer can be NULL if the value is not needed. + * + * @return true if there was another script run. + */ +U_CAPI UBool U_EXPORT2 +uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, UScriptCode *pRunScript); + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uset_imp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uset_imp.h new file mode 100644 index 0000000000000000000000000000000000000000..7233b9303c3a1737a508164263dd5d4f57723ea6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uset_imp.h @@ -0,0 +1,62 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2004-2007, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uset_imp.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2004sep07 +* created by: Markus W. Scherer +* +* Internal USet definitions. +*/ + +#ifndef __USET_IMP_H__ +#define __USET_IMP_H__ + +#include "unicode/utypes.h" +#include "unicode/uset.h" + +U_CDECL_BEGIN + +typedef void U_CALLCONV +USetAdd(USet *set, UChar32 c); + +typedef void U_CALLCONV +USetAddRange(USet *set, UChar32 start, UChar32 end); + +typedef void U_CALLCONV +USetAddString(USet *set, const UChar *str, int32_t length); + +typedef void U_CALLCONV +USetRemove(USet *set, UChar32 c); + +typedef void U_CALLCONV +USetRemoveRange(USet *set, UChar32 start, UChar32 end); + +/** + * Interface for adding items to a USet, to keep low-level code from + * statically depending on the USet implementation. + * Calls will look like sa->add(sa->set, c); + */ +struct USetAdder { + USet *set; + USetAdd *add; + USetAddRange *addRange; + USetAddString *addString; + USetRemove *remove; + USetRemoveRange *removeRange; +}; +typedef struct USetAdder USetAdder; + +U_CDECL_END + +#endif + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustr_cnv.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustr_cnv.h new file mode 100644 index 0000000000000000000000000000000000000000..861e3ebff0613b730f574282c2050f71487147eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustr_cnv.h @@ -0,0 +1,51 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2010, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* file name: ustr_cnv.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2004Aug27 +* created by: George Rhoten +*/ + +#ifndef USTR_CNV_IMP_H +#define USTR_CNV_IMP_H + +#include "unicode/utypes.h" +#include "unicode/ucnv.h" + +#if !UCONFIG_NO_CONVERSION + +/** + * Get the default converter. This is a commonly used converter + * that is used for the ustring and UnicodeString API. + * Remember to use the u_releaseDefaultConverter when you are done. + * @internal + */ +U_CAPI UConverter* U_EXPORT2 +u_getDefaultConverter(UErrorCode *status); + + +/** + * Release the default converter to the converter cache. + * @internal + */ +U_CAPI void U_EXPORT2 +u_releaseDefaultConverter(UConverter *converter); + +/** + * Flush the default converter, if cached. + * @internal + */ +U_CAPI void U_EXPORT2 +u_flushDefaultConverter(void); + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustr_imp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustr_imp.h new file mode 100644 index 0000000000000000000000000000000000000000..3c4b9cc2a5397a88ade670c6cc401be3f992e75d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustr_imp.h @@ -0,0 +1,155 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2015, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* file name: ustr_imp.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2001jan30 +* created by: Markus W. Scherer +*/ + +#ifndef __USTR_IMP_H__ +#define __USTR_IMP_H__ + +#include "unicode/utypes.h" +#include "unicode/utf8.h" + +/** + * Internal option for unorm_cmpEquivFold() for strncmp style. + * If set, checks for both string length and terminating NUL. + */ +#define _STRNCMP_STYLE 0x1000 + +/** + * Compare two strings in code point order or code unit order. + * Works in strcmp style (both lengths -1), + * strncmp style (lengths equal and >=0, flag true), + * and memcmp/UnicodeString style (at least one length >=0). + */ +U_CFUNC int32_t U_EXPORT2 +uprv_strCompare(const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + UBool strncmpStyle, UBool codePointOrder); + +U_CAPI int32_t U_EXPORT2 +ustr_hashUCharsN(const UChar *str, int32_t length); + +U_CAPI int32_t U_EXPORT2 +ustr_hashCharsN(const char *str, int32_t length); + +U_CAPI int32_t U_EXPORT2 +ustr_hashICharsN(const char *str, int32_t length); + +/** + * Convert an ASCII-range lowercase character to uppercase. + * + * @param c A UChar. + * @return If UChar is a lowercase ASCII character, returns the uppercase version. + * Otherwise, returns the input character. + */ +U_CAPI UChar U_EXPORT2 +u_asciiToUpper(UChar c); + +// TODO: Add u_asciiToLower if/when there is a need for it. + +/** + * NUL-terminate a UChar * string if possible. + * If length < destCapacity then NUL-terminate. + * If length == destCapacity then do not terminate but set U_STRING_NOT_TERMINATED_WARNING. + * If length > destCapacity then do not terminate but set U_BUFFER_OVERFLOW_ERROR. + * + * @param dest Destination buffer, can be NULL if destCapacity==0. + * @param destCapacity Number of UChars available at dest. + * @param length Number of UChars that were (to be) written to dest. + * @param pErrorCode ICU error code. + * @return length + */ +U_CAPI int32_t U_EXPORT2 +u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode); + +/** + * NUL-terminate a char * string if possible. + * Same as u_terminateUChars() but for a different string type. + */ +U_CAPI int32_t U_EXPORT2 +u_terminateChars(char *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode); + +/** + * NUL-terminate a UChar32 * string if possible. + * Same as u_terminateUChars() but for a different string type. + */ +U_CAPI int32_t U_EXPORT2 +u_terminateUChar32s(UChar32 *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode); + +/** + * NUL-terminate a wchar_t * string if possible. + * Same as u_terminateUChars() but for a different string type. + */ +U_CAPI int32_t U_EXPORT2 +u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode); + +/** + * Counts the bytes of any whole valid sequence for a UTF-8 lead byte. + * Returns 1 for ASCII 0..0x7f. + * Returns 0 for 0x80..0xc1 as well as for 0xf5..0xff. + * leadByte might be evaluated multiple times. + * + * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff. + * @return 0..4 + */ +#define U8_COUNT_BYTES(leadByte) \ + (U8_IS_SINGLE(leadByte) ? 1 : U8_COUNT_BYTES_NON_ASCII(leadByte)) + +/** + * Counts the bytes of any whole valid sequence for a UTF-8 lead byte. + * Returns 0 for 0x00..0xc1 as well as for 0xf5..0xff. + * leadByte might be evaluated multiple times. + * + * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff. + * @return 0 or 2..4 + */ +#define U8_COUNT_BYTES_NON_ASCII(leadByte) \ + (U8_IS_LEAD(leadByte) ? ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+2 : 0) + +#ifdef __cplusplus + +U_NAMESPACE_BEGIN + +class UTF8 { +public: + UTF8() = delete; // all static + + /** + * Is t a valid UTF-8 trail byte? + * + * @param prev Must be the preceding lead byte if i==1 and length>=3; + * otherwise ignored. + * @param t The i-th byte following the lead byte. + * @param i The index (1..3) of byte t in the byte sequence. 0 1) { + return U8_IS_TRAIL(t); + } else if (length == 3) { + return U8_IS_VALID_LEAD3_AND_T1(prev, t); + } else { // length == 4 + return U8_IS_VALID_LEAD4_AND_T1(prev, t); + } + } +}; + +U_NAMESPACE_END + +#endif // __cplusplus + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustrenum.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustrenum.h new file mode 100644 index 0000000000000000000000000000000000000000..a82162e2bde014ec5be38a5813e8e105100200fb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustrenum.h @@ -0,0 +1,87 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: November 11 2002 +* Since: ICU 2.4 +********************************************************************** +*/ +#ifndef _USTRENUM_H_ +#define _USTRENUM_H_ + +#include "unicode/uenum.h" +#include "unicode/strenum.h" + +//---------------------------------------------------------------------- +U_NAMESPACE_BEGIN + +/** + * A wrapper to make a UEnumeration into a StringEnumeration. The + * wrapper adopts the UEnumeration is wraps. + */ +class U_COMMON_API UStringEnumeration : public StringEnumeration { + +public: + /** + * Constructor. This constructor adopts its UEnumeration + * argument. + * @param uenum a UEnumeration object. This object takes + * ownership of 'uenum' and will close it in its destructor. The + * caller must not call uenum_close on 'uenum' after calling this + * constructor. + */ + UStringEnumeration(UEnumeration* uenum); + + /** + * Destructor. This closes the UEnumeration passed in to the + * constructor. + */ + virtual ~UStringEnumeration(); + + /** + * Return the number of elements that the iterator traverses. + * @param status the error code. + * @return number of elements in the iterator. + */ + virtual int32_t count(UErrorCode& status) const; + + virtual const char* next(int32_t *resultLength, UErrorCode& status); + + /** + * Returns the next element a UnicodeString*. If there are no + * more elements, returns NULL. + * @param status the error code. + * @return a pointer to the string, or NULL. + */ + virtual const UnicodeString* snext(UErrorCode& status); + + /** + * Resets the iterator. + * @param status the error code. + */ + virtual void reset(UErrorCode& status); + + /** + * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU4C "poor man's RTTI", returns a UClassID for this ICU class. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + static UStringEnumeration * U_EXPORT2 fromUEnumeration( + UEnumeration *enumToAdopt, UErrorCode &status); +private: + UEnumeration *uenum; // owned +}; + +U_NAMESPACE_END + +#endif + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustrfmt.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustrfmt.h new file mode 100644 index 0000000000000000000000000000000000000000..53eb0557e45a18d86f5d0244d568d8c4a9ba8f0d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/ustrfmt.h @@ -0,0 +1,19 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2001-2006, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef USTRFMT_H +#define USTRFMT_H + +#include "unicode/utypes.h" + +U_CAPI int32_t U_EXPORT2 +uprv_itou (UChar * buffer, int32_t capacity, uint32_t i, uint32_t radix, int32_t minwidth); + + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/util.h new file mode 100644 index 0000000000000000000000000000000000000000..b5fac383a2f68f0902b25b2770bcdec94d814a8f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/util.h @@ -0,0 +1,257 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ********************************************************************** + * Copyright (c) 2001-2011, International Business Machines + * Corporation and others. All Rights Reserved. + ********************************************************************** + * Date Name Description + * 11/19/2001 aliu Creation. + ********************************************************************** + */ + +#ifndef ICU_UTIL_H +#define ICU_UTIL_H + +#include "charstr.h" +#include "unicode/unistr.h" +#include "unicode/uobject.h" +#include "unicode/utypes.h" +//-------------------------------------------------------------------- +// class ICU_Utility +// i18n utility functions, scoped into the class ICU_Utility. +//-------------------------------------------------------------------- + +U_NAMESPACE_BEGIN + +class UnicodeMatcher; + +class U_COMMON_API ICU_Utility /* not : public UObject because all methods are static */ { + public: + + /** + * Append a number to the given UnicodeString in the given radix. + * Standard digits '0'-'9' are used and letters 'A'-'Z' for + * radices 11 through 36. + * @param result the digits of the number are appended here + * @param n the number to be converted to digits; may be negative. + * If negative, a '-' is prepended to the digits. + * @param radix a radix from 2 to 36 inclusive. + * @param minDigits the minimum number of digits, not including + * any '-', to produce. Values less than 2 have no effect. One + * digit is always emitted regardless of this parameter. + * @return a reference to result + */ + static UnicodeString& appendNumber(UnicodeString& result, int32_t n, + int32_t radix = 10, + int32_t minDigits = 1); + + /** Returns a bogus UnicodeString by value. */ + static inline UnicodeString makeBogusString() { + UnicodeString result; + result.setToBogus(); + return result; + } + + /** + * Return true if the character is NOT printable ASCII. + * + * This method should really be in UnicodeString (or similar). For + * now, we implement it here and share it with friend classes. + */ + static UBool isUnprintable(UChar32 c); + + /** + * Escape unprintable characters using \uxxxx notation for U+0000 to + * U+FFFF and \Uxxxxxxxx for U+10000 and above. If the character is + * printable ASCII, then do nothing and return false. Otherwise, + * append the escaped notation and return true. + */ + static UBool escapeUnprintable(UnicodeString& result, UChar32 c); + + /** + * Returns the index of a character, ignoring quoted text. + * For example, in the string "abc'hide'h", the 'h' in "hide" will not be + * found by a search for 'h'. + * @param text text to be searched + * @param start the beginning index, inclusive; 0 <= start + * <= limit. + * @param limit the ending index, exclusive; start <= limit + * <= text.length(). + * @param c character to search for + * @return Offset of the first instance of c, or -1 if not found. + */ +//?FOR FUTURE USE. DISABLE FOR NOW for coverage reasons. +// static int32_t quotedIndexOf(const UnicodeString& text, +// int32_t start, int32_t limit, +// UChar c); + + /** + * Skip over a sequence of zero or more white space characters at pos. + * @param advance if true, advance pos to the first non-white-space + * character at or after pos, or str.length(), if there is none. + * Otherwise leave pos unchanged. + * @return the index of the first non-white-space character at or + * after pos, or str.length(), if there is none. + */ + static int32_t skipWhitespace(const UnicodeString& str, int32_t& pos, + UBool advance = false); + + /** + * Skip over Pattern_White_Space in a Replaceable. + * Skipping may be done in the forward or + * reverse direction. In either case, the leftmost index will be + * inclusive, and the rightmost index will be exclusive. That is, + * given a range defined as [start, limit), the call + * skipWhitespace(text, start, limit) will advance start past leading + * whitespace, whereas the call skipWhitespace(text, limit, start), + * will back up limit past trailing whitespace. + * @param text the text to be analyzed + * @param pos either the start or limit of a range of 'text', to skip + * leading or trailing whitespace, respectively + * @param stop either the limit or start of a range of 'text', to skip + * leading or trailing whitespace, respectively + * @return the new start or limit, depending on what was passed in to + * 'pos' + */ +//?FOR FUTURE USE. DISABLE FOR NOW for coverage reasons. +//? static int32_t skipWhitespace(const Replaceable& text, +//? int32_t pos, int32_t stop); + + /** + * Parse a single non-whitespace character 'ch', optionally + * preceded by whitespace. + * @param id the string to be parsed + * @param pos INPUT-OUTPUT parameter. On input, pos[0] is the + * offset of the first character to be parsed. On output, pos[0] + * is the index after the last parsed character. If the parse + * fails, pos[0] will be unchanged. + * @param ch the non-whitespace character to be parsed. + * @return true if 'ch' is seen preceded by zero or more + * whitespace characters. + */ + static UBool parseChar(const UnicodeString& id, int32_t& pos, UChar ch); + + /** + * Parse a pattern string starting at offset pos. Keywords are + * matched case-insensitively. Spaces may be skipped and may be + * optional or required. Integer values may be parsed, and if + * they are, they will be returned in the given array. If + * successful, the offset of the next non-space character is + * returned. On failure, -1 is returned. + * @param pattern must only contain lowercase characters, which + * will match their uppercase equivalents as well. A space + * character matches one or more required spaces. A '~' character + * matches zero or more optional spaces. A '#' character matches + * an integer and stores it in parsedInts, which the caller must + * ensure has enough capacity. + * @param parsedInts array to receive parsed integers. Caller + * must ensure that parsedInts.length is >= the number of '#' + * signs in 'pattern'. + * @return the position after the last character parsed, or -1 if + * the parse failed + */ + static int32_t parsePattern(const UnicodeString& rule, int32_t pos, int32_t limit, + const UnicodeString& pattern, int32_t* parsedInts); + + /** + * Parse a pattern string within the given Replaceable and a parsing + * pattern. Characters are matched literally and case-sensitively + * except for the following special characters: + * + * ~ zero or more Pattern_White_Space chars + * + * If end of pattern is reached with all matches along the way, + * pos is advanced to the first unparsed index and returned. + * Otherwise -1 is returned. + * @param pat pattern that controls parsing + * @param text text to be parsed, starting at index + * @param index offset to first character to parse + * @param limit offset after last character to parse + * @return index after last parsed character, or -1 on parse failure. + */ + static int32_t parsePattern(const UnicodeString& pat, + const Replaceable& text, + int32_t index, + int32_t limit); + + /** + * Parse an integer at pos, either of the form \d+ or of the form + * 0x[0-9A-Fa-f]+ or 0[0-7]+, that is, in standard decimal, hex, + * or octal format. + * @param pos INPUT-OUTPUT parameter. On input, the index of the first + * character to parse. On output, the index of the character after the + * last parsed character. + */ + static int32_t parseInteger(const UnicodeString& rule, int32_t& pos, int32_t limit); + + /** + * Parse an integer at pos using only ASCII digits. + * Base 10 only. + * @param pos INPUT-OUTPUT parameter. On input, the index of the first + * character to parse. On output, the index of the character after the + * last parsed character. + */ + static int32_t parseAsciiInteger(const UnicodeString& str, int32_t& pos); + + /** + * Parse a Unicode identifier from the given string at the given + * position. Return the identifier, or an empty string if there + * is no identifier. + * @param str the string to parse + * @param pos INPUT-OUPUT parameter. On INPUT, pos is the + * first character to examine. It must be less than str.length(), + * and it must not point to a whitespace character. That is, must + * have pos < str.length() and + * !UCharacter::isWhitespace(str.char32At(pos)). On + * OUTPUT, the position after the last parsed character. + * @return the Unicode identifier, or an empty string if there is + * no valid identifier at pos. + */ + static UnicodeString parseUnicodeIdentifier(const UnicodeString& str, int32_t& pos); + + /** + * Parse an unsigned 31-bit integer at the given offset. Use + * UCharacter.digit() to parse individual characters into digits. + * @param text the text to be parsed + * @param pos INPUT-OUTPUT parameter. On entry, pos is the + * offset within text at which to start parsing; it should point + * to a valid digit. On exit, pos is the offset after the last + * parsed character. If the parse failed, it will be unchanged on + * exit. Must be >= 0 on entry. + * @param radix the radix in which to parse; must be >= 2 and <= + * 36. + * @return a non-negative parsed number, or -1 upon parse failure. + * Parse fails if there are no digits, that is, if pos does not + * point to a valid digit on entry, or if the number to be parsed + * does not fit into a 31-bit unsigned integer. + */ + static int32_t parseNumber(const UnicodeString& text, + int32_t& pos, int8_t radix); + + static void appendToRule(UnicodeString& rule, + UChar32 c, + UBool isLiteral, + UBool escapeUnprintable, + UnicodeString& quoteBuf); + + static void appendToRule(UnicodeString& rule, + const UnicodeString& text, + UBool isLiteral, + UBool escapeUnprintable, + UnicodeString& quoteBuf); + + static void appendToRule(UnicodeString& rule, + const UnicodeMatcher* matcher, + UBool escapeUnprintable, + UnicodeString& quoteBuf); + +private: + // do not instantiate + ICU_Utility(); +}; + +U_NAMESPACE_END + +#endif +//eof diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utracimp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utracimp.h new file mode 100644 index 0000000000000000000000000000000000000000..945540d25af992acdce210ad9156de842a3cd255 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utracimp.h @@ -0,0 +1,391 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2003-2009, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: utracimp.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2003aug06 +* created by: Markus W. Scherer +* +* Internal header for ICU tracing/logging. +* +* +* Various notes: +* - using a trace level variable to only call trace functions +* when the level is sufficient +* - using the same variable for tracing on/off to never make a function +* call when off +* - the function number is put into a local variable by the entry macro +* and used implicitly to avoid copy&paste/typing mistakes by the developer +* - the application must call utrace_setFunctions() and pass in +* implementations for the trace functions +* - ICU trace macros call ICU functions that route through the function +* pointers if they have been set; +* this avoids an indirection at the call site +* (which would cost more code for another check and for the indirection) +* +* ### TODO Issues: +* - Verify that va_list is portable among compilers for the same platform. +* va_list should be portable because printf() would fail otherwise! +* - Should enum values like UTraceLevel be passed into int32_t-type arguments, +* or should enum types be used? +*/ + +#ifndef __UTRACIMP_H__ +#define __UTRACIMP_H__ + +#include "unicode/utrace.h" +#include + +U_CDECL_BEGIN + +/** + * Traced Function Exit return types. + * Flags indicating the number and types of varargs included in a call + * to a UTraceExit function. + * Bits 0-3: The function return type. First variable param. + * Bit 4: Flag for presence of U_ErrorCode status param. + * @internal + */ +typedef enum UTraceExitVal { + /** The traced function returns no value @internal */ + UTRACE_EXITV_NONE = 0, + /** The traced function returns an int32_t, or compatible, type. @internal */ + UTRACE_EXITV_I32 = 1, + /** The traced function returns a pointer @internal */ + UTRACE_EXITV_PTR = 2, + /** The traced function returns a UBool @internal */ + UTRACE_EXITV_BOOL = 3, + /** Mask to extract the return type values from a UTraceExitVal @internal */ + UTRACE_EXITV_MASK = 0xf, + /** Bit indicating that the traced function includes a UErrorCode parameter @internal */ + UTRACE_EXITV_STATUS = 0x10 +} UTraceExitVal; + +/** + * Trace function for the entry point of a function. + * Do not use directly, use UTRACE_ENTRY instead. + * @param fnNumber The UTraceFunctionNumber for the current function. + * @internal + */ +U_CAPI void U_EXPORT2 +utrace_entry(int32_t fnNumber); + +/** + * Trace function for each exit point of a function. + * Do not use directly, use UTRACE_EXIT* instead. + * @param fnNumber The UTraceFunctionNumber for the current function. + * @param returnType The type of the value returned by the function. + * @param errorCode The UErrorCode value at function exit. See UTRACE_EXIT. + * @internal + */ +U_CAPI void U_EXPORT2 +utrace_exit(int32_t fnNumber, int32_t returnType, ...); + + +/** + * Trace function used inside functions that have a UTRACE_ENTRY() statement. + * Do not use directly, use UTRACE_DATAX() macros instead. + * + * @param utraceFnNumber The number of the current function, from the local + * variable of the same name. + * @param level The trace level for this message. + * @param fmt The trace format string. + * + * @internal + */ +U_CAPI void U_EXPORT2 +utrace_data(int32_t utraceFnNumber, int32_t level, const char *fmt, ...); + +U_CDECL_END + +#if U_ENABLE_TRACING + +/** + * Boolean expression to see if ICU tracing is turned on + * to at least the specified level. + * @internal + */ +#define UTRACE_LEVEL(level) (utrace_getLevel()>=(level)) + +/** + * Flag bit in utraceFnNumber, the local variable added to each function + * with tracing code to contains the function number. + * + * Set the flag if the function's entry is traced, which will cause the + * function's exit to also be traced. utraceFnNumber is uncoditionally + * set at entry, whether or not the entry is traced, so that it will + * always be available for error trace output. + * @internal + */ +#define UTRACE_TRACED_ENTRY 0x80000000 + +/** + * Trace statement for the entry point of a function. + * Stores the function number in a local variable. + * In C code, must be placed immediately after the last variable declaration. + * Must be matched with UTRACE_EXIT() at all function exit points. + * + * Tracing should start with UTRACE_ENTRY after checking for + * U_FAILURE at function entry, so that if a function returns immediately + * because of a pre-existing error condition, it does not show up in the trace, + * consistent with ICU's error handling model. + * + * @param fnNumber The UTraceFunctionNumber for the current function. + * @internal + */ +#define UTRACE_ENTRY(fnNumber) \ + int32_t utraceFnNumber=(fnNumber); \ +UPRV_BLOCK_MACRO_BEGIN { \ + if(utrace_getLevel()>=UTRACE_INFO) { \ + utrace_entry(fnNumber); \ + utraceFnNumber |= UTRACE_TRACED_ENTRY; \ + } \ +} UPRV_BLOCK_MACRO_END + + +/** + * Trace statement for the entry point of open and close functions. + * Produces trace output at a less verbose setting than plain UTRACE_ENTRY + * Stores the function number in a local variable. + * In C code, must be placed immediately after the last variable declaration. + * Must be matched with UTRACE_EXIT() at all function exit points. + * + * @param fnNumber The UTraceFunctionNumber for the current function. + * @internal + */ +#define UTRACE_ENTRY_OC(fnNumber) \ + int32_t utraceFnNumber=(fnNumber); \ +UPRV_BLOCK_MACRO_BEGIN { \ + if(utrace_getLevel()>=UTRACE_OPEN_CLOSE) { \ + utrace_entry(fnNumber); \ + utraceFnNumber |= UTRACE_TRACED_ENTRY; \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement for each exit point of a function that has a UTRACE_ENTRY() + * statement. + * + * @param errorCode The function's ICU UErrorCode value at function exit, + * or U_ZERO_ERROR if the function does not use a UErrorCode. + * 0==U_ZERO_ERROR indicates success, + * positive values an error (see u_errorName()), + * negative values an informational status. + * + * @internal + */ +#define UTRACE_EXIT() UPRV_BLOCK_MACRO_BEGIN { \ + if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \ + utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, UTRACE_EXITV_NONE); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement for each exit point of a function that has a UTRACE_ENTRY() + * statement, and that returns a value. + * + * @param val The function's return value, int32_t or compatible type. + * + * @internal + */ +#define UTRACE_EXIT_VALUE(val) UPRV_BLOCK_MACRO_BEGIN { \ + if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \ + utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, UTRACE_EXITV_I32, val); \ + } \ +} UPRV_BLOCK_MACRO_END + +#define UTRACE_EXIT_STATUS(status) UPRV_BLOCK_MACRO_BEGIN { \ + if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \ + utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, UTRACE_EXITV_STATUS, status); \ + } \ +} UPRV_BLOCK_MACRO_END + +#define UTRACE_EXIT_VALUE_STATUS(val, status) UPRV_BLOCK_MACRO_BEGIN { \ + if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \ + utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (UTRACE_EXITV_I32 | UTRACE_EXITV_STATUS), val, status); \ + } \ +} UPRV_BLOCK_MACRO_END + +#define UTRACE_EXIT_PTR_STATUS(ptr, status) UPRV_BLOCK_MACRO_BEGIN { \ + if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \ + utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (UTRACE_EXITV_PTR | UTRACE_EXITV_STATUS), ptr, status); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes no data arguments. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA0(level, fmt) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes one data argument. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA1(level, fmt, a) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY , (level), (fmt), (a)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes two data arguments. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA2(level, fmt, a, b) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY , (level), (fmt), (a), (b)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes three data arguments. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA3(level, fmt, a, b, c) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes four data arguments. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA4(level, fmt, a, b, c, d) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes five data arguments. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA5(level, fmt, a, b, c, d, e) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes six data arguments. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA6(level, fmt, a, b, c, d, e, f) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes seven data arguments. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA7(level, fmt, a, b, c, d, e, f, g) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f), (g)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes eight data arguments. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA8(level, fmt, a, b, c, d, e, f, g, h) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f), (g), (h)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** + * Trace statement used inside functions that have a UTRACE_ENTRY() statement. + * Takes nine data arguments. + * The number of arguments for this macro must match the number of inserts + * in the format string. Vector inserts count as two arguments. + * Calls utrace_data() if the level is high enough. + * @internal + */ +#define UTRACE_DATA9(level, fmt, a, b, c, d, e, f, g, h, i) UPRV_BLOCK_MACRO_BEGIN { \ + if(UTRACE_LEVEL(level)) { \ + utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f), (g), (h), (i)); \ + } \ +} UPRV_BLOCK_MACRO_END + +#else + +/* + * When tracing is disabled, the following macros become empty + */ + +#define UTRACE_LEVEL(level) 0 +#define UTRACE_ENTRY(fnNumber) +#define UTRACE_ENTRY_OC(fnNumber) +#define UTRACE_EXIT() +#define UTRACE_EXIT_VALUE(val) +#define UTRACE_EXIT_STATUS(status) +#define UTRACE_EXIT_VALUE_STATUS(val, status) +#define UTRACE_EXIT_PTR_STATUS(ptr, status) +#define UTRACE_DATA0(level, fmt) +#define UTRACE_DATA1(level, fmt, a) +#define UTRACE_DATA2(level, fmt, a, b) +#define UTRACE_DATA3(level, fmt, a, b, c) +#define UTRACE_DATA4(level, fmt, a, b, c, d) +#define UTRACE_DATA5(level, fmt, a, b, c, d, e) +#define UTRACE_DATA6(level, fmt, a, b, c, d, e, f) +#define UTRACE_DATA7(level, fmt, a, b, c, d, e, f, g) +#define UTRACE_DATA8(level, fmt, a, b, c, d, e, f, g, h) +#define UTRACE_DATA9(level, fmt, a, b, c, d, e, f, g, h, i) + +#endif + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utrie.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utrie.h new file mode 100644 index 0000000000000000000000000000000000000000..2fd2c461ffb250c9b52d70a1edf543b518fe1ad2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utrie.h @@ -0,0 +1,793 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2001-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: utrie.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2001nov08 +* created by: Markus W. Scherer +*/ + +#ifndef __UTRIE_H__ +#define __UTRIE_H__ + +#include "unicode/utypes.h" +#include "unicode/utf16.h" + +U_CDECL_BEGIN + +/** + * \file + * + * This is a common implementation of a "folded" trie. + * It is a kind of compressed, serializable table of 16- or 32-bit values associated with + * Unicode code points (0..0x10ffff). + * + * This implementation is optimized for getting values while walking forward + * through a UTF-16 string. + * Therefore, the simplest and fastest access macros are the + * _FROM_LEAD() and _FROM_OFFSET_TRAIL() macros. + * + * The _FROM_BMP() macros are a little more complicated; they get values + * even for lead surrogate code _points_, while the _FROM_LEAD() macros + * get special "folded" values for lead surrogate code _units_ if + * there is relevant data associated with them. + * From such a folded value, an offset needs to be extracted to supply + * to the _FROM_OFFSET_TRAIL() macros. + * + * Most of the more complex (and more convenient) functions/macros call a callback function + * to get that offset from the folded value for a lead surrogate unit. + */ + +/** + * Trie constants, defining shift widths, index array lengths, etc. + */ +enum { + /** Shift size for shifting right the input index. 1..9 */ + UTRIE_SHIFT=5, + + /** Number of data values in a stage 2 (data array) block. 2, 4, 8, .., 0x200 */ + UTRIE_DATA_BLOCK_LENGTH=1<>UTRIE_SHIFT, + + /** + * Shift size for shifting left the index array values. + * Increases possible data size with 16-bit index values at the cost + * of compactability. + * This requires blocks of stage 2 data to be aligned by UTRIE_DATA_GRANULARITY. + * 0..UTRIE_SHIFT + */ + UTRIE_INDEX_SHIFT=2, + + /** The alignment size of a stage 2 data block. Also the granularity for compaction. */ + UTRIE_DATA_GRANULARITY=1<>UTRIE_SHIFT + */ + UTRIE_SURROGATE_BLOCK_COUNT=(1<>UTRIE_SHIFT +}; + +/** + * Length of the index (stage 1) array before folding. + * Maximum number of Unicode code points (0x110000) shifted right by UTRIE_SHIFT. + */ +#define UTRIE_MAX_INDEX_LENGTH (0x110000>>UTRIE_SHIFT) + +/** + * Maximum length of the runtime data (stage 2) array. + * Limited by 16-bit index values that are left-shifted by UTRIE_INDEX_SHIFT. + */ +#define UTRIE_MAX_DATA_LENGTH (0x10000<=UTRIE_BMP_INDEX_LENGTH, or 0 if there is no data for the lead surrogate + */ +typedef int32_t U_CALLCONV +UTrieGetFoldingOffset(uint32_t data); + +/** + * Run-time Trie structure. + * + * Either the data table is 16 bits wide and accessed via the index + * pointer, with each index item increased by indexLength; + * in this case, data32==NULL. + * + * Or the data table is 32 bits wide and accessed via the data32 pointer. + */ +struct UTrie { + const uint16_t *index; + const uint32_t *data32; /* NULL if 16b data is used via index */ + + /** + * This function is not used in _FROM_LEAD, _FROM_BMP, and _FROM_OFFSET_TRAIL macros. + * If convenience macros like _GET16 or _NEXT32 are used, this function must be set. + * + * utrie_unserialize() sets a default function which simply returns + * the lead surrogate's value itself - which is the inverse of the default + * folding function used by utrie_serialize(). + * + * @see UTrieGetFoldingOffset + */ + UTrieGetFoldingOffset *getFoldingOffset; + + int32_t indexLength, dataLength; + uint32_t initialValue; + UBool isLatin1Linear; +}; + +#ifndef __UTRIE2_H__ +typedef struct UTrie UTrie; +#endif + +/** Internal trie getter from an offset (0 if c16 is a BMP/lead units) and a 16-bit unit */ +#define _UTRIE_GET_RAW(trie, data, offset, c16) \ + (trie)->data[ \ + ((int32_t)((trie)->index[(offset)+((c16)>>UTRIE_SHIFT)])<getFoldingOffset(result); \ +\ + /* get the real data from the folded lead/trail units */ \ + if(__offset>0) { \ + (result)=_UTRIE_GET_RAW((trie), data, __offset, (c2)&0x3ff); \ + } else { \ + (result)=(resultType)((trie)->initialValue); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** Internal trie getter from a BMP code point, treating a lead surrogate as a normal code point */ +#define _UTRIE_GET_FROM_BMP(trie, data, c16) \ + _UTRIE_GET_RAW(trie, data, 0xd800<=(c16) && (c16)<=0xdbff ? UTRIE_LEAD_INDEX_DISP : 0, c16) + +/** + * Internal trie getter from a code point. + * Could be faster(?) but longer with + * if((c32)<=0xd7ff) { (result)=_UTRIE_GET_RAW(trie, data, 0, c32); } + */ +#define _UTRIE_GET(trie, data, c32, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \ + if((uint32_t)(c32)<=0xffff) { \ + /* BMP code points */ \ + (result)=_UTRIE_GET_FROM_BMP(trie, data, c32); \ + } else if((uint32_t)(c32)<=0x10ffff) { \ + /* supplementary code point */ \ + UChar __lead16=U16_LEAD(c32); \ + _UTRIE_GET_FROM_PAIR(trie, data, __lead16, c32, result, resultType); \ + } else { \ + /* out of range */ \ + (result)=(resultType)((trie)->initialValue); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** Internal next-post-increment: get the next code point (c, c2) and its data */ +#define _UTRIE_NEXT(trie, data, src, limit, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=*(src)++; \ + if(!U16_IS_LEAD(c)) { \ + (c2)=0; \ + (result)=_UTRIE_GET_RAW((trie), data, 0, (c)); \ + } else if((src)!=(limit) && U16_IS_TRAIL((c2)=*(src))) { \ + ++(src); \ + _UTRIE_GET_FROM_PAIR((trie), data, (c), (c2), (result), resultType); \ + } else { \ + /* unpaired lead surrogate code point */ \ + (c2)=0; \ + (result)=_UTRIE_GET_RAW((trie), data, UTRIE_LEAD_INDEX_DISP, (c)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/** Internal previous: get the previous code point (c, c2) and its data */ +#define _UTRIE_PREVIOUS(trie, data, start, src, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=*--(src); \ + if(!U16_IS_SURROGATE(c)) { \ + (c2)=0; \ + (result)=_UTRIE_GET_RAW((trie), data, 0, (c)); \ + } else if(!U16_IS_SURROGATE_LEAD(c)) { \ + /* trail surrogate */ \ + if((start)!=(src) && U16_IS_LEAD((c2)=*((src)-1))) { \ + --(src); \ + (result)=(c); (c)=(c2); (c2)=(UChar)(result); /* swap c, c2 */ \ + _UTRIE_GET_FROM_PAIR((trie), data, (c), (c2), (result), resultType); \ + } else { \ + /* unpaired trail surrogate code point */ \ + (c2)=0; \ + (result)=_UTRIE_GET_RAW((trie), data, 0, (c)); \ + } \ + } else { \ + /* unpaired lead surrogate code point */ \ + (c2)=0; \ + (result)=_UTRIE_GET_RAW((trie), data, UTRIE_LEAD_INDEX_DISP, (c)); \ + } \ +} UPRV_BLOCK_MACRO_END + +/* Public UTrie API ---------------------------------------------------------*/ + +/** + * Get a pointer to the contiguous part of the data array + * for the Latin-1 range (U+0000..U+00ff). + * Must be used only if the Latin-1 range is in fact linear + * (trie->isLatin1Linear). + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @return (const uint16_t *) pointer to values for Latin-1 code points + */ +#define UTRIE_GET16_LATIN1(trie) ((trie)->index+(trie)->indexLength+UTRIE_DATA_BLOCK_LENGTH) + +/** + * Get a pointer to the contiguous part of the data array + * for the Latin-1 range (U+0000..U+00ff). + * Must be used only if the Latin-1 range is in fact linear + * (trie->isLatin1Linear). + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @return (const uint32_t *) pointer to values for Latin-1 code points + */ +#define UTRIE_GET32_LATIN1(trie) ((trie)->data32+UTRIE_DATA_BLOCK_LENGTH) + +/** + * Get a 16-bit trie value from a BMP code point (UChar, <=U+ffff). + * c16 may be a lead surrogate, which may have a value including a folding offset. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param c16 (UChar, in) the input BMP code point + * @return (uint16_t) trie lookup result + */ +#define UTRIE_GET16_FROM_LEAD(trie, c16) _UTRIE_GET_RAW(trie, index, 0, c16) + +/** + * Get a 32-bit trie value from a BMP code point (UChar, <=U+ffff). + * c16 may be a lead surrogate, which may have a value including a folding offset. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param c16 (UChar, in) the input BMP code point + * @return (uint32_t) trie lookup result + */ +#define UTRIE_GET32_FROM_LEAD(trie, c16) _UTRIE_GET_RAW(trie, data32, 0, c16) + +/** + * Get a 16-bit trie value from a BMP code point (UChar, <=U+ffff). + * Even lead surrogate code points are treated as normal code points, + * with unfolded values that may differ from _FROM_LEAD() macro results for them. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param c16 (UChar, in) the input BMP code point + * @return (uint16_t) trie lookup result + */ +#define UTRIE_GET16_FROM_BMP(trie, c16) _UTRIE_GET_FROM_BMP(trie, index, c16) + +/** + * Get a 32-bit trie value from a BMP code point (UChar, <=U+ffff). + * Even lead surrogate code points are treated as normal code points, + * with unfolded values that may differ from _FROM_LEAD() macro results for them. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param c16 (UChar, in) the input BMP code point + * @return (uint32_t) trie lookup result + */ +#define UTRIE_GET32_FROM_BMP(trie, c16) _UTRIE_GET_FROM_BMP(trie, data32, c16) + +/** + * Get a 16-bit trie value from a code point. + * Even lead surrogate code points are treated as normal code points, + * with unfolded values that may differ from _FROM_LEAD() macro results for them. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param c32 (UChar32, in) the input code point + * @param result (uint16_t, out) uint16_t variable for the trie lookup result + */ +#define UTRIE_GET16(trie, c32, result) _UTRIE_GET(trie, index, c32, result, uint16_t) + +/** + * Get a 32-bit trie value from a code point. + * Even lead surrogate code points are treated as normal code points, + * with unfolded values that may differ from _FROM_LEAD() macro results for them. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param c32 (UChar32, in) the input code point + * @param result (uint32_t, out) uint32_t variable for the trie lookup result + */ +#define UTRIE_GET32(trie, c32, result) _UTRIE_GET(trie, data32, c32, result, uint32_t) + +/** + * Get the next code point (c, c2), post-increment src, + * and get a 16-bit value from the trie. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param src (const UChar *, in/out) the source text pointer + * @param limit (const UChar *, in) the limit pointer for the text, or NULL + * @param c (UChar, out) variable for the BMP or lead code unit + * @param c2 (UChar, out) variable for 0 or the trail code unit + * @param result (uint16_t, out) uint16_t variable for the trie lookup result + */ +#define UTRIE_NEXT16(trie, src, limit, c, c2, result) _UTRIE_NEXT(trie, index, src, limit, c, c2, result, uint16_t) + +/** + * Get the next code point (c, c2), post-increment src, + * and get a 32-bit value from the trie. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param src (const UChar *, in/out) the source text pointer + * @param limit (const UChar *, in) the limit pointer for the text, or NULL + * @param c (UChar, out) variable for the BMP or lead code unit + * @param c2 (UChar, out) variable for 0 or the trail code unit + * @param result (uint32_t, out) uint32_t variable for the trie lookup result + */ +#define UTRIE_NEXT32(trie, src, limit, c, c2, result) _UTRIE_NEXT(trie, data32, src, limit, c, c2, result, uint32_t) + +/** + * Get the previous code point (c, c2), pre-decrement src, + * and get a 16-bit value from the trie. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param start (const UChar *, in) the start pointer for the text, or NULL + * @param src (const UChar *, in/out) the source text pointer + * @param c (UChar, out) variable for the BMP or lead code unit + * @param c2 (UChar, out) variable for 0 or the trail code unit + * @param result (uint16_t, out) uint16_t variable for the trie lookup result + */ +#define UTRIE_PREVIOUS16(trie, start, src, c, c2, result) _UTRIE_PREVIOUS(trie, index, start, src, c, c2, result, uint16_t) + +/** + * Get the previous code point (c, c2), pre-decrement src, + * and get a 32-bit value from the trie. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param start (const UChar *, in) the start pointer for the text, or NULL + * @param src (const UChar *, in/out) the source text pointer + * @param c (UChar, out) variable for the BMP or lead code unit + * @param c2 (UChar, out) variable for 0 or the trail code unit + * @param result (uint32_t, out) uint32_t variable for the trie lookup result + */ +#define UTRIE_PREVIOUS32(trie, start, src, c, c2, result) _UTRIE_PREVIOUS(trie, data32, start, src, c, c2, result, uint32_t) + +/** + * Get a 16-bit trie value from a pair of surrogates. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param c (UChar, in) a lead surrogate + * @param c2 (UChar, in) a trail surrogate + * @param result (uint16_t, out) uint16_t variable for the trie lookup result + */ +#define UTRIE_GET16_FROM_PAIR(trie, c, c2, result) _UTRIE_GET_FROM_PAIR(trie, index, c, c2, result, uint16_t) + +/** + * Get a 32-bit trie value from a pair of surrogates. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param c (UChar, in) a lead surrogate + * @param c2 (UChar, in) a trail surrogate + * @param result (uint32_t, out) uint32_t variable for the trie lookup result + */ +#define UTRIE_GET32_FROM_PAIR(trie, c, c2, result) _UTRIE_GET_FROM_PAIR(trie, data32, c, c2, result, uint32_t) + +/** + * Get a 16-bit trie value from a folding offset (from the value of a lead surrogate) + * and a trail surrogate. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param offset (int32_t, in) the folding offset from the value of a lead surrogate + * @param c2 (UChar, in) a trail surrogate (only the 10 low bits are significant) + * @return (uint16_t) trie lookup result + */ +#define UTRIE_GET16_FROM_OFFSET_TRAIL(trie, offset, c2) _UTRIE_GET_RAW(trie, index, offset, (c2)&0x3ff) + +/** + * Get a 32-bit trie value from a folding offset (from the value of a lead surrogate) + * and a trail surrogate. + * + * @param trie (const UTrie *, in) a pointer to the runtime trie structure + * @param offset (int32_t, in) the folding offset from the value of a lead surrogate + * @param c2 (UChar, in) a trail surrogate (only the 10 low bits are significant) + * @return (uint32_t) trie lookup result + */ +#define UTRIE_GET32_FROM_OFFSET_TRAIL(trie, offset, c2) _UTRIE_GET_RAW(trie, data32, offset, (c2)&0x3ff) + +/* enumeration callback types */ + +/** + * Callback from utrie_enum(), extracts a uint32_t value from a + * trie value. This value will be passed on to the UTrieEnumRange function. + * + * @param context an opaque pointer, as passed into utrie_enum() + * @param value a value from the trie + * @return the value that is to be passed on to the UTrieEnumRange function + */ +typedef uint32_t U_CALLCONV +UTrieEnumValue(const void *context, uint32_t value); + +/** + * Callback from utrie_enum(), is called for each contiguous range + * of code points with the same value as retrieved from the trie and + * transformed by the UTrieEnumValue function. + * + * The callback function can stop the enumeration by returning false. + * + * @param context an opaque pointer, as passed into utrie_enum() + * @param start the first code point in a contiguous range with value + * @param limit one past the last code point in a contiguous range with value + * @param value the value that is set for all code points in [start..limit[ + * @return false to stop the enumeration + */ +typedef UBool U_CALLCONV +UTrieEnumRange(const void *context, UChar32 start, UChar32 limit, uint32_t value); + +/** + * Enumerate efficiently all values in a trie. + * For each entry in the trie, the value to be delivered is passed through + * the UTrieEnumValue function. + * The value is unchanged if that function pointer is NULL. + * + * For each contiguous range of code points with a given value, + * the UTrieEnumRange function is called. + * + * @param trie a pointer to the runtime trie structure + * @param enumValue a pointer to a function that may transform the trie entry value, + * or NULL if the values from the trie are to be used directly + * @param enumRange a pointer to a function that is called for each contiguous range + * of code points with the same value + * @param context an opaque pointer that is passed on to the callback functions + */ +U_CAPI void U_EXPORT2 +utrie_enum(const UTrie *trie, + UTrieEnumValue *enumValue, UTrieEnumRange *enumRange, const void *context); + +/** + * Unserialize a trie from 32-bit-aligned memory. + * Inverse of utrie_serialize(). + * Fills the UTrie runtime trie structure with the settings for the trie data. + * + * @param trie a pointer to the runtime trie structure + * @param data a pointer to 32-bit-aligned memory containing trie data + * @param length the number of bytes available at data + * @param pErrorCode an in/out ICU UErrorCode + * @return the number of bytes at data taken up by the trie data + */ +U_CAPI int32_t U_EXPORT2 +utrie_unserialize(UTrie *trie, const void *data, int32_t length, UErrorCode *pErrorCode); + +/** + * "Unserialize" a dummy trie. + * A dummy trie is an empty runtime trie, used when a real data trie cannot + * be loaded. + * + * The input memory is filled so that the trie always returns the initialValue, + * or the leadUnitValue for lead surrogate code points. + * The Latin-1 part is always set up to be linear. + * + * @param trie a pointer to the runtime trie structure + * @param data a pointer to 32-bit-aligned memory to be filled with the dummy trie data + * @param length the number of bytes available at data (recommended to use UTRIE_DUMMY_SIZE) + * @param initialValue the initial value that is set for all code points + * @param leadUnitValue the value for lead surrogate code _units_ that do not + * have associated supplementary data + * @param pErrorCode an in/out ICU UErrorCode + * + * @see UTRIE_DUMMY_SIZE + * @see utrie_open + */ +U_CAPI int32_t U_EXPORT2 +utrie_unserializeDummy(UTrie *trie, + void *data, int32_t length, + uint32_t initialValue, uint32_t leadUnitValue, + UBool make16BitTrie, + UErrorCode *pErrorCode); + +/** + * Default implementation for UTrie.getFoldingOffset, set automatically by + * utrie_unserialize(). + * Simply returns the lead surrogate's value itself - which is the inverse + * of the default folding function used by utrie_serialize(). + * Exported for static const UTrie structures. + * + * @see UTrieGetFoldingOffset + */ +U_CAPI int32_t U_EXPORT2 +utrie_defaultGetFoldingOffset(uint32_t data); + +/* Building a trie ----------------------------------------------------------*/ + +/** + * Build-time trie structure. + * Opaque definition, here only to make fillIn parameters possible + * for utrie_open() and utrie_clone(). + */ +struct UNewTrie { + /** + * Index values at build-time are 32 bits wide for easier processing. + * Bit 31 is set if the data block is used by multiple index values (from utrie_setRange()). + */ + int32_t index[UTRIE_MAX_INDEX_LENGTH+UTRIE_SURROGATE_BLOCK_COUNT]; + uint32_t *data; + + uint32_t leadUnitValue; + int32_t indexLength, dataCapacity, dataLength; + UBool isAllocated, isDataAllocated; + UBool isLatin1Linear, isCompacted; + + /** + * Map of adjusted indexes, used in utrie_compact(). + * Maps from original indexes to new ones. + */ + int32_t map[UTRIE_MAX_BUILD_TIME_DATA_LENGTH>>UTRIE_SHIFT]; +}; + +typedef struct UNewTrie UNewTrie; + +/** + * Build-time trie callback function, used with utrie_serialize(). + * This function calculates a lead surrogate's value including a folding offset + * from the 1024 supplementary code points [start..start+1024[ . + * It is U+10000 <= start <= U+10fc00 and (start&0x3ff)==0. + * + * The folding offset is provided by the caller. + * It is offset=UTRIE_BMP_INDEX_LENGTH+n*UTRIE_SURROGATE_BLOCK_COUNT with n=0..1023. + * Instead of the offset itself, n can be stored in 10 bits - + * or fewer if it can be assumed that few lead surrogates have associated data. + * + * The returned value must be + * - not zero if and only if there is relevant data + * for the corresponding 1024 supplementary code points + * - such that UTrie.getFoldingOffset(UNewTrieGetFoldedValue(..., offset))==offset + * + * @return a folded value, or 0 if there is no relevant data for the lead surrogate. + */ +typedef uint32_t U_CALLCONV +UNewTrieGetFoldedValue(UNewTrie *trie, UChar32 start, int32_t offset); + +/** + * Open a build-time trie structure. + * The size of the build-time data array is specified to avoid allocating a large + * array in all cases. The array itself can also be passed in. + * + * Although the trie is never fully expanded to a linear array, especially when + * utrie_setRange32() is used, the data array could be large during build time. + * The maximum length is + * UTRIE_MAX_BUILD_TIME_DATA_LENGTH=0x110000+UTRIE_DATA_BLOCK_LENGTH+0x400. + * (Number of Unicode code points + one all-initial-value block + + * possible duplicate entries for 1024 lead surrogates.) + * (UTRIE_DATA_BLOCK_LENGTH<=0x200 in all cases.) + * + * @param fillIn a pointer to a UNewTrie structure to be initialized (will not be released), or + * NULL if one is to be allocated + * @param aliasData a pointer to a data array to be used (will not be released), or + * NULL if one is to be allocated + * @param maxDataLength the capacity of aliasData (if not NULL) or + * the length of the data array to be allocated + * @param initialValue the initial value that is set for all code points + * @param leadUnitValue the value for lead surrogate code _units_ that do not + * have associated supplementary data + * @param latin1Linear a flag indicating whether the Latin-1 range is to be allocated and + * kept in a linear, contiguous part of the data array + * @return a pointer to the initialized fillIn or the allocated and initialized new UNewTrie + */ +U_CAPI UNewTrie * U_EXPORT2 +utrie_open(UNewTrie *fillIn, + uint32_t *aliasData, int32_t maxDataLength, + uint32_t initialValue, uint32_t leadUnitValue, + UBool latin1Linear); + +/** + * Clone a build-time trie structure with all entries. + * + * @param fillIn like in utrie_open() + * @param other the build-time trie structure to clone + * @param aliasData like in utrie_open(), + * used if aliasDataLength>=(capacity of other's data array) + * @param aliasDataLength the length of aliasData + * @return a pointer to the initialized fillIn or the allocated and initialized new UNewTrie + */ +U_CAPI UNewTrie * U_EXPORT2 +utrie_clone(UNewTrie *fillIn, const UNewTrie *other, uint32_t *aliasData, int32_t aliasDataLength); + +/** + * Close a build-time trie structure, and release memory + * that was allocated by utrie_open() or utrie_clone(). + * + * @param trie the build-time trie + */ +U_CAPI void U_EXPORT2 +utrie_close(UNewTrie *trie); + +/** + * Get the data array of a build-time trie. + * The data may be modified, but entries that are equal before + * must still be equal after modification. + * + * @param trie the build-time trie + * @param pLength (out) a pointer to a variable that receives the number + * of entries in the data array + * @return the data array + */ +U_CAPI uint32_t * U_EXPORT2 +utrie_getData(UNewTrie *trie, int32_t *pLength); + +/** + * Set a value for a code point. + * + * @param trie the build-time trie + * @param c the code point + * @param value the value + * @return false if a failure occurred (illegal argument or data array overrun) + */ +U_CAPI UBool U_EXPORT2 +utrie_set32(UNewTrie *trie, UChar32 c, uint32_t value); + +/** + * Get a value from a code point as stored in the build-time trie. + * + * @param trie the build-time trie + * @param c the code point + * @param pInBlockZero if not NULL, then *pInBlockZero is set to true + * iff the value is retrieved from block 0; + * block 0 is the all-initial-value initial block + * @return the value + */ +U_CAPI uint32_t U_EXPORT2 +utrie_get32(UNewTrie *trie, UChar32 c, UBool *pInBlockZero); + +/** + * Set a value in a range of code points [start..limit[. + * All code points c with start<=c=UTRIE_DATA_BLOCK_LENGTH */ + int32_t dataLength; +} UTrieHeader; + +/** + * Constants for use with UTrieHeader.options. + * @internal + */ +enum { + /** Mask to get the UTRIE_SHIFT value from options. */ + UTRIE_OPTIONS_SHIFT_MASK=0xf, + + /** Shift options right this much to get the UTRIE_INDEX_SHIFT value. */ + UTRIE_OPTIONS_INDEX_SHIFT=4, + + /** If set, then the data (stage 2) array is 32 bits wide. */ + UTRIE_OPTIONS_DATA_IS_32_BIT=0x100, + + /** + * If set, then Latin-1 data (for U+0000..U+00ff) is stored in the data (stage 2) array + * as a simple, linear array at data+UTRIE_DATA_BLOCK_LENGTH. + */ + UTRIE_OPTIONS_LATIN1_IS_LINEAR=0x200 +}; + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utrie2.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utrie2.h new file mode 100644 index 0000000000000000000000000000000000000000..d1e1e15a6e0ca81787755f8d5e98b45974c90721 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utrie2.h @@ -0,0 +1,955 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2001-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: utrie2.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2008aug16 (starting from a copy of utrie.h) +* created by: Markus W. Scherer +*/ + +#ifndef __UTRIE2_H__ +#define __UTRIE2_H__ + +#include "unicode/utypes.h" +#include "unicode/utf8.h" +#include "putilimp.h" + +U_CDECL_BEGIN + +struct UTrie; /* forward declaration */ +#ifndef __UTRIE_H__ +typedef struct UTrie UTrie; +#endif + +/** + * \file + * + * This is a common implementation of a Unicode trie. + * It is a kind of compressed, serializable table of 16- or 32-bit values associated with + * Unicode code points (0..0x10ffff). (A map from code points to integers.) + * + * This is the second common version of a Unicode trie (hence the name UTrie2). + * Compared with UTrie version 1: + * - Still splitting BMP code points 11:5 bits for index and data table lookups. + * - Still separate data for lead surrogate code _units_ vs. code _points_, + * but the lead surrogate code unit values are not required any more + * for data lookup for supplementary code points. + * - The "folding" mechanism is removed. In UTrie version 1, this somewhat + * hard-to-explain mechanism was meant to be used for optimized UTF-16 + * processing, with application-specific encoding of indexing bits + * in the lead surrogate data for the associated supplementary code points. + * - For the last single-value code point range (ending with U+10ffff), + * the starting code point ("highStart") and the value are stored. + * - For supplementary code points U+10000..highStart-1 a three-table lookup + * (two index tables and one data table) is used. The first index + * is truncated, omitting both the BMP portion and the high range. + * - There is a special small index for 2-byte UTF-8, and the initial data + * entries are designed for fast 1/2-byte UTF-8 lookup. + * Starting with ICU 60, C0 and C1 are not recognized as UTF-8 lead bytes any more at all, + * and the associated 2-byte indexes are unused. + */ + +/** + * Trie structure. + * Use only with public API macros and functions. + */ +struct UTrie2; +typedef struct UTrie2 UTrie2; + +/* Public UTrie2 API functions: read-only access ---------------------------- */ + +/** + * Selectors for the width of a UTrie2 data value. + */ +enum UTrie2ValueBits { + /** 16 bits per UTrie2 data value. */ + UTRIE2_16_VALUE_BITS, + /** 32 bits per UTrie2 data value. */ + UTRIE2_32_VALUE_BITS, + /** Number of selectors for the width of UTrie2 data values. */ + UTRIE2_COUNT_VALUE_BITS +}; +typedef enum UTrie2ValueBits UTrie2ValueBits; + +/** + * Open a frozen trie from its serialized from, stored in 32-bit-aligned memory. + * Inverse of utrie2_serialize(). + * The memory must remain valid and unchanged as long as the trie is used. + * You must utrie2_close() the trie once you are done using it. + * + * @param valueBits selects the data entry size; results in an + * U_INVALID_FORMAT_ERROR if it does not match the serialized form + * @param data a pointer to 32-bit-aligned memory containing the serialized form of a UTrie2 + * @param length the number of bytes available at data; + * can be more than necessary + * @param pActualLength receives the actual number of bytes at data taken up by the trie data; + * can be NULL + * @param pErrorCode an in/out ICU UErrorCode + * @return the unserialized trie + * + * @see utrie2_open + * @see utrie2_serialize + */ +U_CAPI UTrie2 * U_EXPORT2 +utrie2_openFromSerialized(UTrie2ValueBits valueBits, + const void *data, int32_t length, int32_t *pActualLength, + UErrorCode *pErrorCode); + +/** + * Open a frozen, empty "dummy" trie. + * A dummy trie is an empty trie, used when a real data trie cannot + * be loaded. Equivalent to calling utrie2_open() and utrie2_freeze(), + * but without internally creating and compacting/serializing the + * builder data structure. + * + * The trie always returns the initialValue, + * or the errorValue for out-of-range code points and illegal UTF-8. + * + * You must utrie2_close() the trie once you are done using it. + * + * @param valueBits selects the data entry size + * @param initialValue the initial value that is set for all code points + * @param errorValue the value for out-of-range code points and illegal UTF-8 + * @param pErrorCode an in/out ICU UErrorCode + * @return the dummy trie + * + * @see utrie2_openFromSerialized + * @see utrie2_open + */ +U_CAPI UTrie2 * U_EXPORT2 +utrie2_openDummy(UTrie2ValueBits valueBits, + uint32_t initialValue, uint32_t errorValue, + UErrorCode *pErrorCode); + +/** + * Get a value from a code point as stored in the trie. + * Easier to use than UTRIE2_GET16() and UTRIE2_GET32() but slower. + * Easier to use because, unlike the macros, this function works on all UTrie2 + * objects, frozen or not, holding 16-bit or 32-bit data values. + * + * @param trie the trie + * @param c the code point + * @return the value + */ +U_CAPI uint32_t U_EXPORT2 +utrie2_get32(const UTrie2 *trie, UChar32 c); + +/* enumeration callback types */ + +/** + * Callback from utrie2_enum(), extracts a uint32_t value from a + * trie value. This value will be passed on to the UTrie2EnumRange function. + * + * @param context an opaque pointer, as passed into utrie2_enum() + * @param value a value from the trie + * @return the value that is to be passed on to the UTrie2EnumRange function + */ +typedef uint32_t U_CALLCONV +UTrie2EnumValue(const void *context, uint32_t value); + +/** + * Callback from utrie2_enum(), is called for each contiguous range + * of code points with the same value as retrieved from the trie and + * transformed by the UTrie2EnumValue function. + * + * The callback function can stop the enumeration by returning false. + * + * @param context an opaque pointer, as passed into utrie2_enum() + * @param start the first code point in a contiguous range with value + * @param end the last code point in a contiguous range with value (inclusive) + * @param value the value that is set for all code points in [start..end] + * @return false to stop the enumeration + */ +typedef UBool U_CALLCONV +UTrie2EnumRange(const void *context, UChar32 start, UChar32 end, uint32_t value); + +/** + * Enumerate efficiently all values in a trie. + * Do not modify the trie during the enumeration. + * + * For each entry in the trie, the value to be delivered is passed through + * the UTrie2EnumValue function. + * The value is unchanged if that function pointer is NULL. + * + * For each contiguous range of code points with a given (transformed) value, + * the UTrie2EnumRange function is called. + * + * @param trie a pointer to the trie + * @param enumValue a pointer to a function that may transform the trie entry value, + * or NULL if the values from the trie are to be used directly + * @param enumRange a pointer to a function that is called for each contiguous range + * of code points with the same (transformed) value + * @param context an opaque pointer that is passed on to the callback functions + */ +U_CAPI void U_EXPORT2 +utrie2_enum(const UTrie2 *trie, + UTrie2EnumValue *enumValue, UTrie2EnumRange *enumRange, const void *context); + +/* Building a trie ---------------------------------------------------------- */ + +/** + * Open an empty, writable trie. At build time, 32-bit data values are used. + * utrie2_freeze() takes a valueBits parameter + * which determines the data value width in the serialized and frozen forms. + * You must utrie2_close() the trie once you are done using it. + * + * @param initialValue the initial value that is set for all code points + * @param errorValue the value for out-of-range code points and illegal UTF-8 + * @param pErrorCode an in/out ICU UErrorCode + * @return a pointer to the allocated and initialized new trie + */ +U_CAPI UTrie2 * U_EXPORT2 +utrie2_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode); + +/** + * Clone a trie. + * You must utrie2_close() the clone once you are done using it. + * + * @param other the trie to clone + * @param pErrorCode an in/out ICU UErrorCode + * @return a pointer to the new trie clone + */ +U_CAPI UTrie2 * U_EXPORT2 +utrie2_clone(const UTrie2 *other, UErrorCode *pErrorCode); + +/** + * Clone a trie. The clone will be mutable/writable even if the other trie + * is frozen. (See utrie2_freeze().) + * You must utrie2_close() the clone once you are done using it. + * + * @param other the trie to clone + * @param pErrorCode an in/out ICU UErrorCode + * @return a pointer to the new trie clone + */ +U_CAPI UTrie2 * U_EXPORT2 +utrie2_cloneAsThawed(const UTrie2 *other, UErrorCode *pErrorCode); + +/** + * Close a trie and release associated memory. + * + * @param trie the trie + */ +U_CAPI void U_EXPORT2 +utrie2_close(UTrie2 *trie); + +/** + * Set a value for a code point. + * + * @param trie the unfrozen trie + * @param c the code point + * @param value the value + * @param pErrorCode an in/out ICU UErrorCode; among other possible error codes: + * - U_NO_WRITE_PERMISSION if the trie is frozen + */ +U_CAPI void U_EXPORT2 +utrie2_set32(UTrie2 *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode); + +/** + * Set a value in a range of code points [start..end]. + * All code points c with start<=c<=end will get the value if + * overwrite is true or if the old value is the initial value. + * + * @param trie the unfrozen trie + * @param start the first code point to get the value + * @param end the last code point to get the value (inclusive) + * @param value the value + * @param overwrite flag for whether old non-initial values are to be overwritten + * @param pErrorCode an in/out ICU UErrorCode; among other possible error codes: + * - U_NO_WRITE_PERMISSION if the trie is frozen + */ +U_CAPI void U_EXPORT2 +utrie2_setRange32(UTrie2 *trie, + UChar32 start, UChar32 end, + uint32_t value, UBool overwrite, + UErrorCode *pErrorCode); + +/** + * Freeze a trie. Make it immutable (read-only) and compact it, + * ready for serialization and for use with fast macros. + * Functions to set values will fail after serializing. + * + * A trie can be frozen only once. If this function is called again with different + * valueBits then it will set a U_ILLEGAL_ARGUMENT_ERROR. + * + * @param trie the trie + * @param valueBits selects the data entry size; if smaller than 32 bits, then + * the values stored in the trie will be truncated + * @param pErrorCode an in/out ICU UErrorCode; among other possible error codes: + * - U_INDEX_OUTOFBOUNDS_ERROR if the compacted index or data arrays are too long + * for serialization + * (the trie will be immutable and usable, + * but not frozen and not usable with the fast macros) + * + * @see utrie2_cloneAsThawed + */ +U_CAPI void U_EXPORT2 +utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode); + +/** + * Test if the trie is frozen. (See utrie2_freeze().) + * + * @param trie the trie + * @return true if the trie is frozen, that is, immutable, ready for serialization + * and for use with fast macros + */ +U_CAPI UBool U_EXPORT2 +utrie2_isFrozen(const UTrie2 *trie); + +/** + * Serialize a frozen trie into 32-bit aligned memory. + * If the trie is not frozen, then the function returns with a U_ILLEGAL_ARGUMENT_ERROR. + * A trie can be serialized multiple times. + * + * @param trie the frozen trie + * @param data a pointer to 32-bit-aligned memory to be filled with the trie data, + * can be NULL if capacity==0 + * @param capacity the number of bytes available at data, + * or 0 for preflighting + * @param pErrorCode an in/out ICU UErrorCode; among other possible error codes: + * - U_BUFFER_OVERFLOW_ERROR if the data storage block is too small for serialization + * - U_ILLEGAL_ARGUMENT_ERROR if the trie is not frozen or the data and capacity + * parameters are bad + * @return the number of bytes written or needed for the trie + * + * @see utrie2_openFromSerialized() + */ +U_CAPI int32_t U_EXPORT2 +utrie2_serialize(const UTrie2 *trie, + void *data, int32_t capacity, + UErrorCode *pErrorCode); + +/* Public UTrie2 API: miscellaneous functions ------------------------------- */ + +/** + * Build a UTrie2 (version 2) from a UTrie (version 1). + * Enumerates all values in the UTrie and builds a UTrie2 with the same values. + * The resulting UTrie2 will be frozen. + * + * @param trie1 the runtime UTrie structure to be enumerated + * @param errorValue the value for out-of-range code points and illegal UTF-8 + * @param pErrorCode an in/out ICU UErrorCode + * @return The frozen UTrie2 with the same values as the UTrie. + */ +U_CAPI UTrie2 * U_EXPORT2 +utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode); + +/* Public UTrie2 API macros ------------------------------------------------- */ + +/* + * These macros provide fast data lookup from a frozen trie. + * They will crash when used on an unfrozen trie. + */ + +/** + * Return a 16-bit trie value from a code point, with range checking. + * Returns trie->errorValue if c is not in the range 0..U+10ffff. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param c (UChar32, in) the input code point + * @return (uint16_t) The code point's trie value. + */ +#define UTRIE2_GET16(trie, c) _UTRIE2_GET((trie), index, (trie)->indexLength, (c)) + +/** + * Return a 32-bit trie value from a code point, with range checking. + * Returns trie->errorValue if c is not in the range 0..U+10ffff. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param c (UChar32, in) the input code point + * @return (uint32_t) The code point's trie value. + */ +#define UTRIE2_GET32(trie, c) _UTRIE2_GET((trie), data32, 0, (c)) + +/** + * UTF-16: Get the next code point (UChar32 c, out), post-increment src, + * and get a 16-bit value from the trie. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param src (const UChar *, in/out) the source text pointer + * @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated + * @param c (UChar32, out) variable for the code point + * @param result (uint16_t, out) uint16_t variable for the trie lookup result + */ +#define UTRIE2_U16_NEXT16(trie, src, limit, c, result) _UTRIE2_U16_NEXT(trie, index, src, limit, c, result) + +/** + * UTF-16: Get the next code point (UChar32 c, out), post-increment src, + * and get a 32-bit value from the trie. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param src (const UChar *, in/out) the source text pointer + * @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated + * @param c (UChar32, out) variable for the code point + * @param result (uint32_t, out) uint32_t variable for the trie lookup result + */ +#define UTRIE2_U16_NEXT32(trie, src, limit, c, result) _UTRIE2_U16_NEXT(trie, data32, src, limit, c, result) + +/** + * UTF-16: Get the previous code point (UChar32 c, out), pre-decrement src, + * and get a 16-bit value from the trie. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param start (const UChar *, in) the start pointer for the text + * @param src (const UChar *, in/out) the source text pointer + * @param c (UChar32, out) variable for the code point + * @param result (uint16_t, out) uint16_t variable for the trie lookup result + */ +#define UTRIE2_U16_PREV16(trie, start, src, c, result) _UTRIE2_U16_PREV(trie, index, start, src, c, result) + +/** + * UTF-16: Get the previous code point (UChar32 c, out), pre-decrement src, + * and get a 32-bit value from the trie. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param start (const UChar *, in) the start pointer for the text + * @param src (const UChar *, in/out) the source text pointer + * @param c (UChar32, out) variable for the code point + * @param result (uint32_t, out) uint32_t variable for the trie lookup result + */ +#define UTRIE2_U16_PREV32(trie, start, src, c, result) _UTRIE2_U16_PREV(trie, data32, start, src, c, result) + +/** + * UTF-8: Post-increment src and get a 16-bit value from the trie. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param src (const char *, in/out) the source text pointer + * @param limit (const char *, in) the limit pointer for the text (must not be NULL) + * @param result (uint16_t, out) uint16_t variable for the trie lookup result + */ +#define UTRIE2_U8_NEXT16(trie, src, limit, result)\ + _UTRIE2_U8_NEXT(trie, data16, index, src, limit, result) + +/** + * UTF-8: Post-increment src and get a 32-bit value from the trie. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param src (const char *, in/out) the source text pointer + * @param limit (const char *, in) the limit pointer for the text (must not be NULL) + * @param result (uint16_t, out) uint32_t variable for the trie lookup result + */ +#define UTRIE2_U8_NEXT32(trie, src, limit, result) \ + _UTRIE2_U8_NEXT(trie, data32, data32, src, limit, result) + +/** + * UTF-8: Pre-decrement src and get a 16-bit value from the trie. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param start (const char *, in) the start pointer for the text + * @param src (const char *, in/out) the source text pointer + * @param result (uint16_t, out) uint16_t variable for the trie lookup result + */ +#define UTRIE2_U8_PREV16(trie, start, src, result) \ + _UTRIE2_U8_PREV(trie, data16, index, start, src, result) + +/** + * UTF-8: Pre-decrement src and get a 32-bit value from the trie. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param start (const char *, in) the start pointer for the text + * @param src (const char *, in/out) the source text pointer + * @param result (uint16_t, out) uint32_t variable for the trie lookup result + */ +#define UTRIE2_U8_PREV32(trie, start, src, result) \ + _UTRIE2_U8_PREV(trie, data32, data32, start, src, result) + +/* Public UTrie2 API: optimized UTF-16 access ------------------------------- */ + +/* + * The following functions and macros are used for highly optimized UTF-16 + * text processing. The UTRIE2_U16_NEXTxy() macros do not depend on these. + * + * A UTrie2 stores separate values for lead surrogate code _units_ vs. code _points_. + * UTF-16 text processing can be optimized by detecting surrogate pairs and + * assembling supplementary code points only when there is non-trivial data + * available. + * + * At build-time, use utrie2_enumForLeadSurrogate() to see if there + * is non-trivial (non-initialValue) data for any of the supplementary + * code points associated with a lead surrogate. + * If so, then set a special (application-specific) value for the + * lead surrogate code _unit_, with utrie2_set32ForLeadSurrogateCodeUnit(). + * + * At runtime, use UTRIE2_GET16_FROM_U16_SINGLE_LEAD() or + * UTRIE2_GET32_FROM_U16_SINGLE_LEAD() per code unit. If there is non-trivial + * data and the code unit is a lead surrogate, then check if a trail surrogate + * follows. If so, assemble the supplementary code point with + * U16_GET_SUPPLEMENTARY() and look up its value with UTRIE2_GET16_FROM_SUPP() + * or UTRIE2_GET32_FROM_SUPP(); otherwise reset the lead + * surrogate's value or do a code point lookup for it. + * + * If there is only trivial data for lead and trail surrogates, then processing + * can often skip them. For example, in normalization or case mapping + * all characters that do not have any mappings are simply copied as is. + */ + +/** + * Get a value from a lead surrogate code unit as stored in the trie. + * + * @param trie the trie + * @param c the code unit (U+D800..U+DBFF) + * @return the value + */ +U_CAPI uint32_t U_EXPORT2 +utrie2_get32FromLeadSurrogateCodeUnit(const UTrie2 *trie, UChar32 c); + +/** + * Enumerate the trie values for the 1024=0x400 code points + * corresponding to a given lead surrogate. + * For example, for the lead surrogate U+D87E it will enumerate the values + * for [U+2F800..U+2FC00[. + * Used by data builder code that sets special lead surrogate code unit values + * for optimized UTF-16 string processing. + * + * Do not modify the trie during the enumeration. + * + * Except for the limited code point range, this functions just like utrie2_enum(): + * For each entry in the trie, the value to be delivered is passed through + * the UTrie2EnumValue function. + * The value is unchanged if that function pointer is NULL. + * + * For each contiguous range of code points with a given (transformed) value, + * the UTrie2EnumRange function is called. + * + * @param trie a pointer to the trie + * @param enumValue a pointer to a function that may transform the trie entry value, + * or NULL if the values from the trie are to be used directly + * @param enumRange a pointer to a function that is called for each contiguous range + * of code points with the same (transformed) value + * @param context an opaque pointer that is passed on to the callback functions + */ +U_CAPI void U_EXPORT2 +utrie2_enumForLeadSurrogate(const UTrie2 *trie, UChar32 lead, + UTrie2EnumValue *enumValue, UTrie2EnumRange *enumRange, + const void *context); + +/** + * Set a value for a lead surrogate code unit. + * + * @param trie the unfrozen trie + * @param lead the lead surrogate code unit (U+D800..U+DBFF) + * @param value the value + * @param pErrorCode an in/out ICU UErrorCode; among other possible error codes: + * - U_NO_WRITE_PERMISSION if the trie is frozen + */ +U_CAPI void U_EXPORT2 +utrie2_set32ForLeadSurrogateCodeUnit(UTrie2 *trie, + UChar32 lead, uint32_t value, + UErrorCode *pErrorCode); + +/** + * Return a 16-bit trie value from a UTF-16 single/lead code unit (<=U+ffff). + * Same as UTRIE2_GET16() if c is a BMP code point except for lead surrogates, + * but smaller and faster. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param c (UChar32, in) the input code unit, must be 0<=c<=U+ffff + * @return (uint16_t) The code unit's trie value. + */ +#define UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, c) _UTRIE2_GET_FROM_U16_SINGLE_LEAD((trie), index, c) + +/** + * Return a 32-bit trie value from a UTF-16 single/lead code unit (<=U+ffff). + * Same as UTRIE2_GET32() if c is a BMP code point except for lead surrogates, + * but smaller and faster. + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param c (UChar32, in) the input code unit, must be 0<=c<=U+ffff + * @return (uint32_t) The code unit's trie value. + */ +#define UTRIE2_GET32_FROM_U16_SINGLE_LEAD(trie, c) _UTRIE2_GET_FROM_U16_SINGLE_LEAD((trie), data32, c) + +/** + * Return a 16-bit trie value from a supplementary code point (U+10000..U+10ffff). + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param c (UChar32, in) the input code point, must be U+10000<=c<=U+10ffff + * @return (uint16_t) The code point's trie value. + */ +#define UTRIE2_GET16_FROM_SUPP(trie, c) _UTRIE2_GET_FROM_SUPP((trie), index, c) + +/** + * Return a 32-bit trie value from a supplementary code point (U+10000..U+10ffff). + * + * @param trie (const UTrie2 *, in) a frozen trie + * @param c (UChar32, in) the input code point, must be U+10000<=c<=U+10ffff + * @return (uint32_t) The code point's trie value. + */ +#define UTRIE2_GET32_FROM_SUPP(trie, c) _UTRIE2_GET_FROM_SUPP((trie), data32, c) + +U_CDECL_END + +/* C++ convenience wrappers ------------------------------------------------- */ + +#ifdef __cplusplus + +#include "unicode/utf.h" +#include "mutex.h" + +U_NAMESPACE_BEGIN + +// Use the Forward/Backward subclasses below. +class UTrie2StringIterator : public UMemory { +public: + UTrie2StringIterator(const UTrie2 *t, const UChar *p) : + trie(t), codePointStart(p), codePointLimit(p), codePoint(U_SENTINEL) {} + + const UTrie2 *trie; + const UChar *codePointStart, *codePointLimit; + UChar32 codePoint; +}; + +class BackwardUTrie2StringIterator : public UTrie2StringIterator { +public: + BackwardUTrie2StringIterator(const UTrie2 *t, const UChar *s, const UChar *p) : + UTrie2StringIterator(t, p), start(s) {} + + uint16_t previous16(); + + const UChar *start; +}; + +class ForwardUTrie2StringIterator : public UTrie2StringIterator { +public: + // Iteration limit l can be NULL. + // In that case, the caller must detect c==0 and stop. + ForwardUTrie2StringIterator(const UTrie2 *t, const UChar *p, const UChar *l) : + UTrie2StringIterator(t, p), limit(l) {} + + uint16_t next16(); + + const UChar *limit; +}; + +U_NAMESPACE_END + +#endif + +/* Internal definitions ----------------------------------------------------- */ + +U_CDECL_BEGIN + +/** Build-time trie structure. */ +struct UNewTrie2; +typedef struct UNewTrie2 UNewTrie2; + +/* + * Trie structure definition. + * + * Either the data table is 16 bits wide and accessed via the index + * pointer, with each index item increased by indexLength; + * in this case, data32==NULL, and data16 is used for direct ASCII access. + * + * Or the data table is 32 bits wide and accessed via the data32 pointer. + */ +struct UTrie2 { + /* protected: used by macros and functions for reading values */ + const uint16_t *index; + const uint16_t *data16; /* for fast UTF-8 ASCII access, if 16b data */ + const uint32_t *data32; /* NULL if 16b data is used via index */ + + int32_t indexLength, dataLength; + uint16_t index2NullOffset; /* 0xffff if there is no dedicated index-2 null block */ + uint16_t dataNullOffset; + uint32_t initialValue; + /** Value returned for out-of-range code points and illegal UTF-8. */ + uint32_t errorValue; + + /* Start of the last range which ends at U+10ffff, and its value. */ + UChar32 highStart; + int32_t highValueIndex; + + /* private: used by builder and unserialization functions */ + void *memory; /* serialized bytes; NULL if not frozen yet */ + int32_t length; /* number of serialized bytes at memory; 0 if not frozen yet */ + UBool isMemoryOwned; /* true if the trie owns the memory */ + UBool padding1; + int16_t padding2; + UNewTrie2 *newTrie; /* builder object; NULL when frozen */ + +#ifdef UTRIE2_DEBUG + const char *name; +#endif +}; + +/** + * Trie constants, defining shift widths, index array lengths, etc. + * + * These are needed for the runtime macros but users can treat these as + * implementation details and skip to the actual public API further below. + */ +enum { + /** Shift size for getting the index-1 table offset. */ + UTRIE2_SHIFT_1=6+5, + + /** Shift size for getting the index-2 table offset. */ + UTRIE2_SHIFT_2=5, + + /** + * Difference between the two shift sizes, + * for getting an index-1 offset from an index-2 offset. 6=11-5 + */ + UTRIE2_SHIFT_1_2=UTRIE2_SHIFT_1-UTRIE2_SHIFT_2, + + /** + * Number of index-1 entries for the BMP. 32=0x20 + * This part of the index-1 table is omitted from the serialized form. + */ + UTRIE2_OMITTED_BMP_INDEX_1_LENGTH=0x10000>>UTRIE2_SHIFT_1, + + /** Number of code points per index-1 table entry. 2048=0x800 */ + UTRIE2_CP_PER_INDEX_1_ENTRY=1<>UTRIE2_SHIFT_2. + */ + UTRIE2_INDEX_2_OFFSET=0, + + /** + * The part of the index-2 table for U+D800..U+DBFF stores values for + * lead surrogate code _units_ not code _points_. + * Values for lead surrogate code _points_ are indexed with this portion of the table. + * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.) + */ + UTRIE2_LSCP_INDEX_2_OFFSET=0x10000>>UTRIE2_SHIFT_2, + UTRIE2_LSCP_INDEX_2_LENGTH=0x400>>UTRIE2_SHIFT_2, + + /** Count the lengths of both BMP pieces. 2080=0x820 */ + UTRIE2_INDEX_2_BMP_LENGTH=UTRIE2_LSCP_INDEX_2_OFFSET+UTRIE2_LSCP_INDEX_2_LENGTH, + + /** + * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820. + * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2. + */ + UTRIE2_UTF8_2B_INDEX_2_OFFSET=UTRIE2_INDEX_2_BMP_LENGTH, + UTRIE2_UTF8_2B_INDEX_2_LENGTH=0x800>>6, /* U+0800 is the first code point after 2-byte UTF-8 */ + + /** + * The index-1 table, only used for supplementary code points, at offset 2112=0x840. + * Variable length, for code points up to highStart, where the last single-value range starts. + * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1. + * (For 0x100000 supplementary code points U+10000..U+10ffff.) + * + * The part of the index-2 table for supplementary code points starts + * after this index-1 table. + * + * Both the index-1 table and the following part of the index-2 table + * are omitted completely if there is only BMP data. + */ + UTRIE2_INDEX_1_OFFSET=UTRIE2_UTF8_2B_INDEX_2_OFFSET+UTRIE2_UTF8_2B_INDEX_2_LENGTH, + UTRIE2_MAX_INDEX_1_LENGTH=0x100000>>UTRIE2_SHIFT_1, + + /* + * Fixed layout of the first part of the data array. ----------------------- + * Starts with 4 blocks (128=0x80 entries) for ASCII. + */ + + /** + * The illegal-UTF-8 data block follows the ASCII block, at offset 128=0x80. + * Used with linear access for single bytes 0..0xbf for simple error handling. + * Length 64=0x40, not UTRIE2_DATA_BLOCK_LENGTH. + */ + UTRIE2_BAD_UTF8_DATA_OFFSET=0x80, + + /** The start of non-linear-ASCII data blocks, at offset 192=0xc0. */ + UTRIE2_DATA_START_OFFSET=0xc0 +}; + +/* Internal functions and macros -------------------------------------------- */ + +/** + * Internal function for part of the UTRIE2_U8_NEXTxx() macro implementations. + * Do not call directly. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +utrie2_internalU8NextIndex(const UTrie2 *trie, UChar32 c, + const uint8_t *src, const uint8_t *limit); + +/** + * Internal function for part of the UTRIE2_U8_PREVxx() macro implementations. + * Do not call directly. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c, + const uint8_t *start, const uint8_t *src); + + +/** Internal low-level trie getter. Returns a data index. */ +#define _UTRIE2_INDEX_RAW(offset, trieIndex, c) \ + (((int32_t)((trieIndex)[(offset)+((c)>>UTRIE2_SHIFT_2)]) \ + <>UTRIE2_SHIFT_2), trieIndex, c) + +/** Internal trie getter from a BMP code point. Returns the data index. */ +#define _UTRIE2_INDEX_FROM_BMP(trieIndex, c) \ + _UTRIE2_INDEX_RAW(U_IS_LEAD(c) ? UTRIE2_LSCP_INDEX_2_OFFSET-(0xd800>>UTRIE2_SHIFT_2) : 0, \ + trieIndex, c) + +/** Internal trie getter from a supplementary code point below highStart. Returns the data index. */ +#define _UTRIE2_INDEX_FROM_SUPP(trieIndex, c) \ + (((int32_t)((trieIndex)[ \ + (trieIndex)[(UTRIE2_INDEX_1_OFFSET-UTRIE2_OMITTED_BMP_INDEX_1_LENGTH)+ \ + ((c)>>UTRIE2_SHIFT_1)]+ \ + (((c)>>UTRIE2_SHIFT_2)&UTRIE2_INDEX_2_MASK)]) \ + <index, c) : \ + (uint32_t)(c)<=0xffff ? \ + _UTRIE2_INDEX_RAW( \ + (c)<=0xdbff ? UTRIE2_LSCP_INDEX_2_OFFSET-(0xd800>>UTRIE2_SHIFT_2) : 0, \ + (trie)->index, c) : \ + (uint32_t)(c)>0x10ffff ? \ + (asciiOffset)+UTRIE2_BAD_UTF8_DATA_OFFSET : \ + (c)>=(trie)->highStart ? \ + (trie)->highValueIndex : \ + _UTRIE2_INDEX_FROM_SUPP((trie)->index, c)) + +/** Internal trie getter from a UTF-16 single/lead code unit. Returns the data. */ +#define _UTRIE2_GET_FROM_U16_SINGLE_LEAD(trie, data, c) \ + (trie)->data[_UTRIE2_INDEX_FROM_U16_SINGLE_LEAD((trie)->index, c)] + +/** Internal trie getter from a supplementary code point. Returns the data. */ +#define _UTRIE2_GET_FROM_SUPP(trie, data, c) \ + (trie)->data[(c)>=(trie)->highStart ? (trie)->highValueIndex : \ + _UTRIE2_INDEX_FROM_SUPP((trie)->index, c)] + +/** + * Internal trie getter from a code point, with checking that c is in 0..10FFFF. + * Returns the data. + */ +#define _UTRIE2_GET(trie, data, asciiOffset, c) \ + (trie)->data[_UTRIE2_INDEX_FROM_CP(trie, asciiOffset, c)] + +/** Internal next-post-increment: get the next code point (c) and its data. */ +#define _UTRIE2_U16_NEXT(trie, data, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \ + { \ + uint16_t __c2; \ + (c)=*(src)++; \ + if(!U16_IS_LEAD(c)) { \ + (result)=_UTRIE2_GET_FROM_U16_SINGLE_LEAD(trie, data, c); \ + } else if((src)==(limit) || !U16_IS_TRAIL(__c2=*(src))) { \ + (result)=(trie)->data[_UTRIE2_INDEX_FROM_LSCP((trie)->index, c)]; \ + } else { \ + ++(src); \ + (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ + (result)=_UTRIE2_GET_FROM_SUPP((trie), data, (c)); \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + +/** Internal pre-decrement-previous: get the previous code point (c) and its data */ +#define _UTRIE2_U16_PREV(trie, data, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \ + { \ + uint16_t __c2; \ + (c)=*--(src); \ + if(!U16_IS_TRAIL(c) || (src)==(start) || !U16_IS_LEAD(__c2=*((src)-1))) { \ + (result)=(trie)->data[_UTRIE2_INDEX_FROM_BMP((trie)->index, c)]; \ + } else { \ + --(src); \ + (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ + (result)=_UTRIE2_GET_FROM_SUPP((trie), data, (c)); \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + +/** Internal UTF-8 next-post-increment: get the next code point's data. */ +#define _UTRIE2_U8_NEXT(trie, ascii, data, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \ + uint8_t __lead=(uint8_t)*(src)++; \ + if(U8_IS_SINGLE(__lead)) { \ + (result)=(trie)->ascii[__lead]; \ + } else { \ + uint8_t __t1, __t2; \ + if( /* handle U+0800..U+FFFF inline */ \ + 0xe0<=__lead && __lead<0xf0 && ((src)+1)<(limit) && \ + U8_IS_VALID_LEAD3_AND_T1(__lead, __t1=(uint8_t)*(src)) && \ + (__t2=(uint8_t)(*((src)+1)-0x80))<= 0x3f \ + ) { \ + (src)+=2; \ + (result)=(trie)->data[ \ + ((int32_t)((trie)->index[((__lead-0xe0)<<(12-UTRIE2_SHIFT_2))+ \ + ((__t1&0x3f)<<(6-UTRIE2_SHIFT_2))+(__t2>>UTRIE2_SHIFT_2)]) \ + <=0xc2 && (src)<(limit) && \ + (__t1=(uint8_t)(*(src)-0x80))<=0x3f \ + ) { \ + ++(src); \ + (result)=(trie)->data[ \ + (trie)->index[(UTRIE2_UTF8_2B_INDEX_2_OFFSET-0xc0)+__lead]+ \ + __t1]; \ + } else { \ + int32_t __index=utrie2_internalU8NextIndex((trie), __lead, (const uint8_t *)(src), \ + (const uint8_t *)(limit)); \ + (src)+=__index&7; \ + (result)=(trie)->data[__index>>3]; \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + +/** Internal UTF-8 pre-decrement-previous: get the previous code point's data. */ +#define _UTRIE2_U8_PREV(trie, ascii, data, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \ + uint8_t __b=(uint8_t)*--(src); \ + if(U8_IS_SINGLE(__b)) { \ + (result)=(trie)->ascii[__b]; \ + } else { \ + int32_t __index=utrie2_internalU8PrevIndex((trie), __b, (const uint8_t *)(start), \ + (const uint8_t *)(src)); \ + (src)-=__index&7; \ + (result)=(trie)->data[__index>>3]; \ + } \ +} UPRV_BLOCK_MACRO_END + +U_CDECL_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utrie2_impl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utrie2_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..2a14db3a6bdd1a5e55398830c581c85607469845 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utrie2_impl.h @@ -0,0 +1,175 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2001-2008, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: utrie2_impl.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2008sep26 (split off from utrie2.c) +* created by: Markus W. Scherer +* +* Definitions needed for both runtime and builder code for UTrie2, +* used by utrie2.c and utrie2_builder.c. +*/ + +#ifndef __UTRIE2_IMPL_H__ +#define __UTRIE2_IMPL_H__ + +#ifdef UCPTRIE_DEBUG +#include "unicode/umutablecptrie.h" +#endif +#include "utrie2.h" + +/* Public UTrie2 API implementation ----------------------------------------- */ + +/* + * These definitions are mostly needed by utrie2.cpp, + * but also by utrie2_serialize() and utrie2_swap(). + */ + +// UTrie2 signature values, in platform endianness and opposite endianness. +// The UTrie2 signature ASCII byte values spell "Tri2". +#define UTRIE2_SIG 0x54726932 +#define UTRIE2_OE_SIG 0x32697254 + +/** + * Trie data structure in serialized form: + * + * UTrie2Header header; + * uint16_t index[header.index2Length]; + * uint16_t data[header.shiftedDataLength<<2]; -- or uint32_t data[...] + * @internal + */ +typedef struct UTrie2Header { + /** "Tri2" in big-endian US-ASCII (0x54726932) */ + uint32_t signature; + + /** + * options bit field: + * 15.. 4 reserved (0) + * 3.. 0 UTrie2ValueBits valueBits + */ + uint16_t options; + + /** UTRIE2_INDEX_1_OFFSET..UTRIE2_MAX_INDEX_LENGTH */ + uint16_t indexLength; + + /** (UTRIE2_DATA_START_OFFSET..UTRIE2_MAX_DATA_LENGTH)>>UTRIE2_INDEX_SHIFT */ + uint16_t shiftedDataLength; + + /** Null index and data blocks, not shifted. */ + uint16_t index2NullOffset, dataNullOffset; + + /** + * First code point of the single-value range ending with U+10ffff, + * rounded up and then shifted right by UTRIE2_SHIFT_1. + */ + uint16_t shiftedHighStart; +} UTrie2Header; + +/** + * Constants for use with UTrie2Header.options. + * @internal + */ +enum { + /** Mask to get the UTrie2ValueBits valueBits from options. */ + UTRIE2_OPTIONS_VALUE_BITS_MASK=0xf +}; + +/* Building a trie ---------------------------------------------------------- */ + +/* + * These definitions are mostly needed by utrie2_builder.c, but also by + * utrie2_get32() and utrie2_enum(). + */ + +enum { + /** + * At build time, leave a gap in the index-2 table, + * at least as long as the maximum lengths of the 2-byte UTF-8 index-2 table + * and the supplementary index-1 table. + * Round up to UTRIE2_INDEX_2_BLOCK_LENGTH for proper compacting. + */ + UNEWTRIE2_INDEX_GAP_OFFSET=UTRIE2_INDEX_2_BMP_LENGTH, + UNEWTRIE2_INDEX_GAP_LENGTH= + ((UTRIE2_UTF8_2B_INDEX_2_LENGTH+UTRIE2_MAX_INDEX_1_LENGTH)+UTRIE2_INDEX_2_MASK)& + ~UTRIE2_INDEX_2_MASK, + + /** + * Maximum length of the build-time index-2 array. + * Maximum number of Unicode code points (0x110000) shifted right by UTRIE2_SHIFT_2, + * plus the part of the index-2 table for lead surrogate code points, + * plus the build-time index gap, + * plus the null index-2 block. + */ + UNEWTRIE2_MAX_INDEX_2_LENGTH= + (0x110000>>UTRIE2_SHIFT_2)+ + UTRIE2_LSCP_INDEX_2_LENGTH+ + UNEWTRIE2_INDEX_GAP_LENGTH+ + UTRIE2_INDEX_2_BLOCK_LENGTH, + + UNEWTRIE2_INDEX_1_LENGTH=0x110000>>UTRIE2_SHIFT_1 +}; + +/** + * Maximum length of the build-time data array. + * One entry per 0x110000 code points, plus the illegal-UTF-8 block and the null block, + * plus values for the 0x400 surrogate code units. + */ +#define UNEWTRIE2_MAX_DATA_LENGTH (0x110000+0x40+0x40+0x400) + +/* + * Build-time trie structure. + * + * Just using a boolean flag for "repeat use" could lead to data array overflow + * because we would not be able to detect when a data block becomes unused. + * It also leads to orphan data blocks that are kept through serialization. + * + * Need to use reference counting for data blocks, + * and allocDataBlock() needs to look for a free block before increasing dataLength. + * + * This scheme seems like overkill for index-2 blocks since the whole index array is + * preallocated anyway (unlike the growable data array). + * Just allocating multiple index-2 blocks as needed. + */ +struct UNewTrie2 { + int32_t index1[UNEWTRIE2_INDEX_1_LENGTH]; + int32_t index2[UNEWTRIE2_MAX_INDEX_2_LENGTH]; + uint32_t *data; +#ifdef UCPTRIE_DEBUG + UMutableCPTrie *t3; +#endif + + uint32_t initialValue, errorValue; + int32_t index2Length, dataCapacity, dataLength; + int32_t firstFreeBlock; + int32_t index2NullOffset, dataNullOffset; + UChar32 highStart; + UBool isCompacted; + + /** + * Multi-purpose per-data-block table. + * + * Before compacting: + * + * Per-data-block reference counters/free-block list. + * 0: unused + * >0: reference counter (number of index-2 entries pointing here) + * <0: next free data block in free-block list + * + * While compacting: + * + * Map of adjusted indexes, used in compactData() and compactIndex2(). + * Maps from original indexes to new ones. + */ + int32_t map[UNEWTRIE2_MAX_DATA_LENGTH>>UTRIE2_SHIFT_2]; +}; + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utypeinfo.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utypeinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..c6663734fc3dc4f2714b7dfcede2a1109784ed9b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/utypeinfo.h @@ -0,0 +1,32 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2012-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +*/ + +#ifndef __UTYPEINFO_H__ +#define __UTYPEINFO_H__ + +// Windows header does not define 'exception' in 'std' namespace. +// Therefore, a project using ICU cannot be compiled with _HAS_EXCEPTIONS +// set to 0 on Windows with Visual Studio. To work around that, we have to +// include explicitly and add using statement below. +// Whenever 'typeid' is used, this header has to be included +// instead of . +// Visual Studio 10 emits warning 4275 with this change. If you compile +// with exception disabled, you have to suppress warning 4275. +#if defined(_MSC_VER) && _HAS_EXCEPTIONS == 0 +#include +using std::exception; +#endif +#if defined(__GLIBCXX__) +namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364 +#endif +#include // for 'typeid' to work + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uvector.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uvector.h new file mode 100644 index 0000000000000000000000000000000000000000..a2bef923aff25f182b7019267f9fb6e752aedd71 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uvector.h @@ -0,0 +1,415 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 10/22/99 alan Creation. This is an internal header. +* It should not be exported. +********************************************************************** +*/ + +#ifndef UVECTOR_H +#define UVECTOR_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "cmemory.h" +#include "uarrsort.h" +#include "uelement.h" + +U_NAMESPACE_BEGIN + +/** + *

Ultralightweight C++ implementation of a void* vector + * that is (mostly) compatible with java.util.Vector. + * + *

This is a very simple implementation, written to satisfy an + * immediate porting need. As such, it is not completely fleshed out, + * and it aims for simplicity and conformity. Nonetheless, it serves + * its purpose (porting code from java that uses java.util.Vector) + * well, and it could be easily made into a more robust vector class. + * + *

Design notes + * + *

There is index bounds checking, but little is done about it. If + * indices are out of bounds, either nothing happens, or zero is + * returned. We do avoid indexing off into the weeds. + * + *

There is detection of out of memory, but the handling is very + * coarse-grained -- similar to UnicodeString's protocol, but even + * coarser. The class contains one static flag that is set + * when any call to new returns zero. This allows the caller + * to use several vectors and make just one check at the end to see if + * a memory failure occurred. This is more efficient than making a + * check after each call on each vector when doing many operations on + * multiple vectors. The single static flag works best when memory + * failures are infrequent, and when recovery options are limited or + * nonexistent. + * + *

Since we don't have garbage collection, UVector was given the + * option to ownits contents. To employ this, set a deleter + * function. The deleter is called on a void* pointer when that + * pointer is released by the vector, either when the vector itself is + * destructed, or when a call to setElementAt() overwrites an element, + * or when a call to remove() or one of its variants explicitly + * removes an element. If no deleter is set, or the deleter is set to + * zero, then it is assumed that the caller will delete elements as + * needed. + * + *

In order to implement methods such as contains() and indexOf(), + * UVector needs a way to compare objects for equality. To do so, it + * uses a comparison function, or "comparer." If the comparer is not + * set, or is set to zero, then all such methods will act as if the + * vector contains no element. That is, indexOf() will always return + * -1, contains() will always return false, etc. + * + *

To do + * + *

Improve the handling of index out of bounds errors. + * + * @author Alan Liu + */ +class U_COMMON_API UVector : public UObject { + // NOTE: UVector uses the UHashKey (union of void* and int32_t) as + // its basic storage type. It uses UElementsAreEqual as its + // comparison function. It uses UObjectDeleter as its deleter + // function. These are named for hashtables, but used here as-is + // rather than duplicating the type. This allows sharing of + // support functions. + +private: + int32_t count; + + int32_t capacity; + + UElement* elements; + + UObjectDeleter *deleter; + + UElementsAreEqual *comparer; + +public: + UVector(UErrorCode &status); + + UVector(int32_t initialCapacity, UErrorCode &status); + + UVector(UObjectDeleter *d, UElementsAreEqual *c, UErrorCode &status); + + UVector(UObjectDeleter *d, UElementsAreEqual *c, int32_t initialCapacity, UErrorCode &status); + + virtual ~UVector(); + + /** + * Assign this object to another (make this a copy of 'other'). + * Use the 'assign' function to assign each element. + */ + void assign(const UVector& other, UElementAssigner *assign, UErrorCode &ec); + + /** + * Compare this vector with another. They will be considered + * equal if they are of the same size and all elements are equal, + * as compared using this object's comparer. + */ + UBool operator==(const UVector& other); + + /** + * Equivalent to !operator==() + */ + inline UBool operator!=(const UVector& other); + + //------------------------------------------------------------ + // java.util.Vector API + //------------------------------------------------------------ + + void addElement(void* obj, UErrorCode &status); + + void addElement(int32_t elem, UErrorCode &status); + + void setElementAt(void* obj, int32_t index); + + void setElementAt(int32_t elem, int32_t index); + + void insertElementAt(void* obj, int32_t index, UErrorCode &status); + + void insertElementAt(int32_t elem, int32_t index, UErrorCode &status); + + void* elementAt(int32_t index) const; + + int32_t elementAti(int32_t index) const; + + UBool equals(const UVector &other) const; + + inline void* firstElement(void) const; + + inline void* lastElement(void) const; + + inline int32_t lastElementi(void) const; + + int32_t indexOf(void* obj, int32_t startIndex = 0) const; + + int32_t indexOf(int32_t obj, int32_t startIndex = 0) const; + + inline UBool contains(void* obj) const; + + inline UBool contains(int32_t obj) const; + + UBool containsAll(const UVector& other) const; + + UBool removeAll(const UVector& other); + + UBool retainAll(const UVector& other); + + void removeElementAt(int32_t index); + + UBool removeElement(void* obj); + + void removeAllElements(); + + inline int32_t size(void) const; + + inline UBool isEmpty(void) const; + + UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status); + + /** + * Change the size of this vector as follows: If newSize is + * smaller, then truncate the array, possibly deleting held + * elements for i >= newSize. If newSize is larger, grow the + * array, filling in new slots with NULL. + */ + void setSize(int32_t newSize, UErrorCode &status); + + /** + * Fill in the given array with all elements of this vector. + */ + void** toArray(void** result) const; + + //------------------------------------------------------------ + // New API + //------------------------------------------------------------ + + UObjectDeleter *setDeleter(UObjectDeleter *d); + + UElementsAreEqual *setComparer(UElementsAreEqual *c); + + inline void* operator[](int32_t index) const; + + /** + * Removes the element at the given index from this vector and + * transfer ownership of it to the caller. After this call, the + * caller owns the result and must delete it and the vector entry + * at 'index' is removed, shifting all subsequent entries back by + * one index and shortening the size of the vector by one. If the + * index is out of range or if there is no item at the given index + * then 0 is returned and the vector is unchanged. + */ + void* orphanElementAt(int32_t index); + + /** + * Returns true if this vector contains none of the elements + * of the given vector. + * @param other vector to be checked for containment + * @return true if the test condition is met + */ + UBool containsNone(const UVector& other) const; + + /** + * Insert the given object into this vector at its sorted position + * as defined by 'compare'. The current elements are assumed to + * be sorted already. + */ + void sortedInsert(void* obj, UElementComparator *compare, UErrorCode& ec); + + /** + * Insert the given integer into this vector at its sorted position + * as defined by 'compare'. The current elements are assumed to + * be sorted already. + */ + void sortedInsert(int32_t obj, UElementComparator *compare, UErrorCode& ec); + + /** + * Sort the contents of the vector, assuming that the contents of the + * vector are of type int32_t. + */ + void sorti(UErrorCode &ec); + + /** + * Sort the contents of this vector, using a caller-supplied function + * to do the comparisons. (It's confusing that + * UVector's UElementComparator function is different from the + * UComparator function type defined in uarrsort.h) + */ + void sort(UElementComparator *compare, UErrorCode &ec); + + /** + * Stable sort the contents of this vector using a caller-supplied function + * of type UComparator to do the comparison. Provides more flexibility + * than UVector::sort() because an additional user parameter can be passed to + * the comparison function. + */ + void sortWithUComparator(UComparator *compare, const void *context, UErrorCode &ec); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + */ + virtual UClassID getDynamicClassID() const; + +private: + void _init(int32_t initialCapacity, UErrorCode &status); + + int32_t indexOf(UElement key, int32_t startIndex = 0, int8_t hint = 0) const; + + void sortedInsert(UElement e, UElementComparator *compare, UErrorCode& ec); + + // Disallow + UVector(const UVector&); + + // Disallow + UVector& operator=(const UVector&); + +}; + + +/** + *

Ultralightweight C++ implementation of a void* stack + * that is (mostly) compatible with java.util.Stack. As in java, this + * is merely a paper thin layer around UVector. See the UVector + * documentation for further information. + * + *

Design notes + * + *

The element at index n-1 is (of course) the top of the + * stack. + * + *

The poorly named empty() method doesn't empty the + * stack; it determines if the stack is empty. + * + * @author Alan Liu + */ +class U_COMMON_API UStack : public UVector { +public: + UStack(UErrorCode &status); + + UStack(int32_t initialCapacity, UErrorCode &status); + + UStack(UObjectDeleter *d, UElementsAreEqual *c, UErrorCode &status); + + UStack(UObjectDeleter *d, UElementsAreEqual *c, int32_t initialCapacity, UErrorCode &status); + + virtual ~UStack(); + + // It's okay not to have a virtual destructor (in UVector) + // because UStack has no special cleanup to do. + + inline UBool empty(void) const; + + inline void* peek(void) const; + + inline int32_t peeki(void) const; + + void* pop(void); + + int32_t popi(void); + + inline void* push(void* obj, UErrorCode &status); + + inline int32_t push(int32_t i, UErrorCode &status); + + /* + If the object o occurs as an item in this stack, + this method returns the 1-based distance from the top of the stack. + */ + int32_t search(void* obj) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + */ + virtual UClassID getDynamicClassID() const; + +private: + // Disallow + UStack(const UStack&); + + // Disallow + UStack& operator=(const UStack&); +}; + + +// UVector inlines + +inline int32_t UVector::size(void) const { + return count; +} + +inline UBool UVector::isEmpty(void) const { + return count == 0; +} + +inline UBool UVector::contains(void* obj) const { + return indexOf(obj) >= 0; +} + +inline UBool UVector::contains(int32_t obj) const { + return indexOf(obj) >= 0; +} + +inline void* UVector::firstElement(void) const { + return elementAt(0); +} + +inline void* UVector::lastElement(void) const { + return elementAt(count-1); +} + +inline int32_t UVector::lastElementi(void) const { + return elementAti(count-1); +} + +inline void* UVector::operator[](int32_t index) const { + return elementAt(index); +} + +inline UBool UVector::operator!=(const UVector& other) { + return !operator==(other); +} + +// UStack inlines + +inline UBool UStack::empty(void) const { + return isEmpty(); +} + +inline void* UStack::peek(void) const { + return lastElement(); +} + +inline int32_t UStack::peeki(void) const { + return lastElementi(); +} + +inline void* UStack::push(void* obj, UErrorCode &status) { + addElement(obj, status); + return obj; +} + +inline int32_t UStack::push(int32_t i, UErrorCode &status) { + addElement(i, status); + return i; +} + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uvectr32.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uvectr32.h new file mode 100644 index 0000000000000000000000000000000000000000..0d81dfb5c1c56838c0a781e76fc97447a9c53a9a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uvectr32.h @@ -0,0 +1,306 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +// +// UVector32 is a class implementing a vector of 32 bit integers. +// It is similar to UVector, but holds int32_t values rather than pointers. +// Most of the code is unchanged from UVector. +// + +#ifndef UVECTOR32_H +#define UVECTOR32_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "uhash.h" +#include "uassert.h" + +U_NAMESPACE_BEGIN + + + +/** + *

Ultralightweight C++ implementation of a void* vector + * that is (mostly) compatible with java.util.Vector. + * + *

This is a very simple implementation, written to satisfy an + * immediate porting need. As such, it is not completely fleshed out, + * and it aims for simplicity and conformity. Nonetheless, it serves + * its purpose (porting code from java that uses java.util.Vector) + * well, and it could be easily made into a more robust vector class. + * + *

Design notes + * + *

There is index bounds checking, but little is done about it. If + * indices are out of bounds, either nothing happens, or zero is + * returned. We do avoid indexing off into the weeds. + * + *

There is detection of out of memory, but the handling is very + * coarse-grained -- similar to UnicodeString's protocol, but even + * coarser. The class contains one static flag that is set + * when any call to new returns zero. This allows the caller + * to use several vectors and make just one check at the end to see if + * a memory failure occurred. This is more efficient than making a + * check after each call on each vector when doing many operations on + * multiple vectors. The single static flag works best when memory + * failures are infrequent, and when recovery options are limited or + * nonexistent. + * + *

To do + * + *

Improve the handling of index out of bounds errors. + * + * @author Alan Liu + */ +class U_COMMON_API UVector32 : public UObject { +private: + int32_t count; + + int32_t capacity; + + int32_t maxCapacity; // Limit beyond which capacity is not permitted to grow. + + int32_t* elements; + +public: + UVector32(UErrorCode &status); + + UVector32(int32_t initialCapacity, UErrorCode &status); + + virtual ~UVector32(); + + /** + * Assign this object to another (make this a copy of 'other'). + * Use the 'assign' function to assign each element. + */ + void assign(const UVector32& other, UErrorCode &ec); + + /** + * Compare this vector with another. They will be considered + * equal if they are of the same size and all elements are equal, + * as compared using this object's comparer. + */ + UBool operator==(const UVector32& other); + + /** + * Equivalent to !operator==() + */ + inline UBool operator!=(const UVector32& other); + + //------------------------------------------------------------ + // java.util.Vector API + //------------------------------------------------------------ + + inline void addElement(int32_t elem, UErrorCode &status); + + void setElementAt(int32_t elem, int32_t index); + + void insertElementAt(int32_t elem, int32_t index, UErrorCode &status); + + inline int32_t elementAti(int32_t index) const; + + UBool equals(const UVector32 &other) const; + + inline int32_t lastElementi(void) const; + + int32_t indexOf(int32_t elem, int32_t startIndex = 0) const; + + inline UBool contains(int32_t elem) const; + + UBool containsAll(const UVector32& other) const; + + UBool removeAll(const UVector32& other); + + UBool retainAll(const UVector32& other); + + void removeElementAt(int32_t index); + + void removeAllElements(); + + inline int32_t size(void) const; + + inline UBool isEmpty(void) const; + + // Inline. Use this one for speedy size check. + inline UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status); + + // Out-of-line, handles actual growth. Called by ensureCapacity() when necessary. + UBool expandCapacity(int32_t minimumCapacity, UErrorCode &status); + + /** + * Change the size of this vector as follows: If newSize is + * smaller, then truncate the array, possibly deleting held + * elements for i >= newSize. If newSize is larger, grow the + * array, filling in new slows with zero. + */ + void setSize(int32_t newSize); + + //------------------------------------------------------------ + // New API + //------------------------------------------------------------ + + /** + * Returns true if this vector contains none of the elements + * of the given vector. + * @param other vector to be checked for containment + * @return true if the test condition is met + */ + UBool containsNone(const UVector32& other) const; + + + /** + * Insert the given integer into this vector at its sorted position. + * The current elements are assumed to be sorted already. + */ + void sortedInsert(int32_t elem, UErrorCode& ec); + + /** + * Returns a pointer to the internal array holding the vector. + */ + inline int32_t *getBuffer() const; + + /** + * Set the maximum allowed buffer capacity for this vector/stack. + * Default with no limit set is unlimited, go until malloc() fails. + * A Limit of zero means unlimited capacity. + * Units are vector elements (32 bits each), not bytes. + */ + void setMaxCapacity(int32_t limit); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + */ + virtual UClassID getDynamicClassID() const; + +private: + void _init(int32_t initialCapacity, UErrorCode &status); + + // Disallow + UVector32(const UVector32&); + + // Disallow + UVector32& operator=(const UVector32&); + + + // API Functions for Stack operations. + // In the original UVector, these were in a separate derived class, UStack. + // Here in UVector32, they are all together. +public: + inline UBool empty(void) const; // TODO: redundant, same as empty(). Remove it? + + inline int32_t peeki(void) const; + + inline int32_t popi(void); + + inline int32_t push(int32_t i, UErrorCode &status); + + inline int32_t *reserveBlock(int32_t size, UErrorCode &status); + inline int32_t *popFrame(int32_t size); +}; + + +// UVector32 inlines + +inline UBool UVector32::ensureCapacity(int32_t minimumCapacity, UErrorCode &status) { + if ((minimumCapacity >= 0) && (capacity >= minimumCapacity)) { + return true; + } else { + return expandCapacity(minimumCapacity, status); + } +} + +inline int32_t UVector32::elementAti(int32_t index) const { + return (index >= 0 && count > 0 && count - index > 0) ? elements[index] : 0; +} + + +inline void UVector32::addElement(int32_t elem, UErrorCode &status) { + if (ensureCapacity(count + 1, status)) { + elements[count] = elem; + count++; + } +} + +inline int32_t *UVector32::reserveBlock(int32_t size, UErrorCode &status) { + if (ensureCapacity(count+size, status) == false) { + return NULL; + } + int32_t *rp = elements+count; + count += size; + return rp; +} + +inline int32_t *UVector32::popFrame(int32_t size) { + U_ASSERT(count >= size); + count -= size; + if (count < 0) { + count = 0; + } + return elements+count-size; +} + + + +inline int32_t UVector32::size(void) const { + return count; +} + +inline UBool UVector32::isEmpty(void) const { + return count == 0; +} + +inline UBool UVector32::contains(int32_t obj) const { + return indexOf(obj) >= 0; +} + +inline int32_t UVector32::lastElementi(void) const { + return elementAti(count-1); +} + +inline UBool UVector32::operator!=(const UVector32& other) { + return !operator==(other); +} + +inline int32_t *UVector32::getBuffer() const { + return elements; +} + + +// UStack inlines + +inline UBool UVector32::empty(void) const { + return isEmpty(); +} + +inline int32_t UVector32::peeki(void) const { + return lastElementi(); +} + +inline int32_t UVector32::push(int32_t i, UErrorCode &status) { + addElement(i, status); + return i; +} + +inline int32_t UVector32::popi(void) { + int32_t result = 0; + if (count > 0) { + count--; + result = elements[count]; + } + return result; +} + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uvectr64.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uvectr64.h new file mode 100644 index 0000000000000000000000000000000000000000..15c9b3f830c9bfa105d7c9313b99c858910e9114 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/uvectr64.h @@ -0,0 +1,279 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +// +// UVector64 is a class implementing a vector of 64 bit integers. +// It is similar to UVector32, but holds int64_t values rather than int32_t. +// Most of the code is unchanged from UVector. +// + +#ifndef UVECTOR64_H +#define UVECTOR64_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "uhash.h" +#include "uassert.h" + +U_NAMESPACE_BEGIN + + + +/** + *

Ultralightweight C++ implementation of an int64_t vector + * that has a subset of methods from UVector32 + * + *

This is a very simple implementation, written to satisfy an + * immediate porting need. As such, it is not completely fleshed out, + * and it aims for simplicity and conformity. Nonetheless, it serves + * its purpose (porting code from java that uses java.util.Vector) + * well, and it could be easily made into a more robust vector class. + * + *

Design notes + * + *

There is index bounds checking, but little is done about it. If + * indices are out of bounds, either nothing happens, or zero is + * returned. We do avoid indexing off into the weeds. + * + *

There is detection of out of memory, but the handling is very + * coarse-grained -- similar to UnicodeString's protocol, but even + * coarser. The class contains one static flag that is set + * when any call to new returns zero. This allows the caller + * to use several vectors and make just one check at the end to see if + * a memory failure occurred. This is more efficient than making a + * check after each call on each vector when doing many operations on + * multiple vectors. The single static flag works best when memory + * failures are infrequent, and when recovery options are limited or + * nonexistent. + * + *

To do + * + *

Improve the handling of index out of bounds errors. + * + */ +class U_COMMON_API UVector64 : public UObject { +private: + int32_t count; + + int32_t capacity; + + int32_t maxCapacity; // Limit beyond which capacity is not permitted to grow. + + int64_t* elements; + +public: + UVector64(UErrorCode &status); + + UVector64(int32_t initialCapacity, UErrorCode &status); + + virtual ~UVector64(); + + /** + * Assign this object to another (make this a copy of 'other'). + * Use the 'assign' function to assign each element. + */ + void assign(const UVector64& other, UErrorCode &ec); + + /** + * Compare this vector with another. They will be considered + * equal if they are of the same size and all elements are equal, + * as compared using this object's comparer. + */ + UBool operator==(const UVector64& other); + + /** + * Equivalent to !operator==() + */ + inline UBool operator!=(const UVector64& other); + + //------------------------------------------------------------ + // subset of java.util.Vector API + //------------------------------------------------------------ + + inline void addElement(int64_t elem, UErrorCode &status); + + void setElementAt(int64_t elem, int32_t index); + + void insertElementAt(int64_t elem, int32_t index, UErrorCode &status); + + inline int64_t elementAti(int32_t index) const; + + //UBool equals(const UVector64 &other) const; + + inline int64_t lastElementi(void) const; + + //int32_t indexOf(int64_t elem, int32_t startIndex = 0) const; + + //UBool contains(int64_t elem) const; + + //UBool containsAll(const UVector64& other) const; + + //UBool removeAll(const UVector64& other); + + //UBool retainAll(const UVector64& other); + + //void removeElementAt(int32_t index); + + void removeAllElements(); + + inline int32_t size(void) const; + + inline UBool isEmpty(void) const { return count == 0; } + + // Inline. Use this one for speedy size check. + inline UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status); + + // Out-of-line, handles actual growth. Called by ensureCapacity() when necessary. + UBool expandCapacity(int32_t minimumCapacity, UErrorCode &status); + + /** + * Change the size of this vector as follows: If newSize is + * smaller, then truncate the array, possibly deleting held + * elements for i >= newSize. If newSize is larger, grow the + * array, filling in new slows with zero. + */ + void setSize(int32_t newSize); + + //------------------------------------------------------------ + // New API + //------------------------------------------------------------ + + //UBool containsNone(const UVector64& other) const; + + + //void sortedInsert(int64_t elem, UErrorCode& ec); + + /** + * Returns a pointer to the internal array holding the vector. + */ + inline int64_t *getBuffer() const; + + /** + * Set the maximum allowed buffer capacity for this vector/stack. + * Default with no limit set is unlimited, go until malloc() fails. + * A Limit of zero means unlimited capacity. + * Units are vector elements (64 bits each), not bytes. + */ + void setMaxCapacity(int32_t limit); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + */ + virtual UClassID getDynamicClassID() const; + +private: + void _init(int32_t initialCapacity, UErrorCode &status); + + // Disallow + UVector64(const UVector64&); + + // Disallow + UVector64& operator=(const UVector64&); + + + // API Functions for Stack operations. + // In the original UVector, these were in a separate derived class, UStack. + // Here in UVector64, they are all together. +public: + //UBool empty(void) const; // TODO: redundant, same as empty(). Remove it? + + //int64_t peeki(void) const; + + inline int64_t popi(void); + + inline int64_t push(int64_t i, UErrorCode &status); + + inline int64_t *reserveBlock(int32_t size, UErrorCode &status); + inline int64_t *popFrame(int32_t size); +}; + + +// UVector64 inlines + +inline UBool UVector64::ensureCapacity(int32_t minimumCapacity, UErrorCode &status) { + if ((minimumCapacity >= 0) && (capacity >= minimumCapacity)) { + return true; + } else { + return expandCapacity(minimumCapacity, status); + } +} + +inline int64_t UVector64::elementAti(int32_t index) const { + return (0 <= index && index < count) ? elements[index] : 0; +} + + +inline void UVector64::addElement(int64_t elem, UErrorCode &status) { + if (ensureCapacity(count + 1, status)) { + elements[count] = elem; + count++; + } +} + +inline int64_t *UVector64::reserveBlock(int32_t size, UErrorCode &status) { + if (ensureCapacity(count+size, status) == false) { + return NULL; + } + int64_t *rp = elements+count; + count += size; + return rp; +} + +inline int64_t *UVector64::popFrame(int32_t size) { + U_ASSERT(count >= size); + count -= size; + if (count < 0) { + count = 0; + } + return elements+count-size; +} + + + +inline int32_t UVector64::size(void) const { + return count; +} + +inline int64_t UVector64::lastElementi(void) const { + return elementAti(count-1); +} + +inline UBool UVector64::operator!=(const UVector64& other) { + return !operator==(other); +} + +inline int64_t *UVector64::getBuffer() const { + return elements; +} + + +// UStack inlines + +inline int64_t UVector64::push(int64_t i, UErrorCode &status) { + addElement(i, status); + return i; +} + +inline int64_t UVector64::popi(void) { + int64_t result = 0; + if (count > 0) { + count--; + result = elements[count]; + } + return result; +} + +U_NAMESPACE_END + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/wintz.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/wintz.h new file mode 100644 index 0000000000000000000000000000000000000000..ce9c1e901928d729a2a2f649dde90b590b590197 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/icu/icu4c/source/common/wintz.h @@ -0,0 +1,36 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 2005-2011, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File WINTZ.H +* +******************************************************************************** +*/ + +#ifndef __WINTZ +#define __WINTZ + +#include "unicode/utypes.h" + +#if U_PLATFORM_USES_ONLY_WIN32_API + +/** + * \file + * \brief C API: Utilities for dealing w/ Windows time zones. + */ + +U_CDECL_BEGIN +/* Forward declarations for Windows types... */ +typedef struct _TIME_ZONE_INFORMATION TIME_ZONE_INFORMATION; +U_CDECL_END + +U_CAPI const char* U_EXPORT2 +uprv_detectWindowsTimeZone(); + +#endif /* U_PLATFORM_USES_ONLY_WIN32_API */ + +#endif /* __WINTZ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/LICENSE.md b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..d753e1d76aa0ca9529f999f9158b9e6b8bf0ff01 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/LICENSE.md @@ -0,0 +1,132 @@ +libjpeg-turbo Licenses +====================== + +libjpeg-turbo is covered by three compatible BSD-style open source licenses: + +- The IJG (Independent JPEG Group) License, which is listed in + [README.ijg](README.ijg) + + This license applies to the libjpeg API library and associated programs + (any code inherited from libjpeg, and any modifications to that code.) + +- The Modified (3-clause) BSD License, which is listed below + + This license covers the TurboJPEG API library and associated programs, as + well as the build system. + +- The [zlib License](https://opensource.org/licenses/Zlib) + + This license is a subset of the other two, and it covers the libjpeg-turbo + SIMD extensions. + + +Complying with the libjpeg-turbo Licenses +========================================= + +This section provides a roll-up of the libjpeg-turbo licensing terms, to the +best of our understanding. + +1. If you are distributing a modified version of the libjpeg-turbo source, + then: + + 1. You cannot alter or remove any existing copyright or license notices + from the source. + + **Origin** + - Clause 1 of the IJG License + - Clause 1 of the Modified BSD License + - Clauses 1 and 3 of the zlib License + + 2. You must add your own copyright notice to the header of each source + file you modified, so others can tell that you modified that file (if + there is not an existing copyright header in that file, then you can + simply add a notice stating that you modified the file.) + + **Origin** + - Clause 1 of the IJG License + - Clause 2 of the zlib License + + 3. You must include the IJG README file, and you must not alter any of the + copyright or license text in that file. + + **Origin** + - Clause 1 of the IJG License + +2. If you are distributing only libjpeg-turbo binaries without the source, or + if you are distributing an application that statically links with + libjpeg-turbo, then: + + 1. Your product documentation must include a message stating: + + This software is based in part on the work of the Independent JPEG + Group. + + **Origin** + - Clause 2 of the IJG license + + 2. If your binary distribution includes or uses the TurboJPEG API, then + your product documentation must include the text of the Modified BSD + License (see below.) + + **Origin** + - Clause 2 of the Modified BSD License + +3. You cannot use the name of the IJG or The libjpeg-turbo Project or the + contributors thereof in advertising, publicity, etc. + + **Origin** + - IJG License + - Clause 3 of the Modified BSD License + +4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be + free of defects, nor do we accept any liability for undesirable + consequences resulting from your use of the software. + + **Origin** + - IJG License + - Modified BSD License + - zlib License + + +The Modified (3-clause) BSD License +=================================== + +Copyright (C)2009-2022 D. R. Commander. All Rights Reserved.
+Copyright (C)2015 Viktor Szathmáry. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + +Why Three Licenses? +=================== + +The zlib License could have been used instead of the Modified (3-clause) BSD +License, and since the IJG License effectively subsumes the distribution +conditions of the zlib License, this would have effectively placed +libjpeg-turbo binary distributions under the IJG License. However, the IJG +License specifically refers to the Independent JPEG Group and does not extend +attribution and endorsement protections to other entities. Thus, it was +desirable to choose a license that granted us the same protections for new code +that were granted to the IJG for code derived from their software. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jccolext.c b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jccolext.c new file mode 100644 index 0000000000000000000000000000000000000000..303b322ce67404f1a07d0217eda1fcac51e39644 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jccolext.c @@ -0,0 +1,144 @@ +/* + * jccolext.c + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1996, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2009-2012, 2015, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains input colorspace conversion routines. + */ + + +/* This file is included by jccolor.c */ + + +/* + * Convert some rows of samples to the JPEG colorspace. + * + * Note that we change from the application's interleaved-pixel format + * to our internal noninterleaved, one-plane-per-component format. + * The input buffer is therefore three times as wide as the output buffer. + * + * A starting row offset is provided only for the output buffer. The caller + * can easily adjust the passed input_buf value to accommodate any row + * offset required on that side. + */ + +INLINE +LOCAL(void) +rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, JDIMENSION output_row, + int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; + register int r, g, b; + register JLONG *ctab = cconvert->rgb_ycc_tab; + register JSAMPROW inptr; + register JSAMPROW outptr0, outptr1, outptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->image_width; + + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr0 = output_buf[0][output_row]; + outptr1 = output_buf[1][output_row]; + outptr2 = output_buf[2][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + r = inptr[RGB_RED]; + g = inptr[RGB_GREEN]; + b = inptr[RGB_BLUE]; + inptr += RGB_PIXELSIZE; + /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations + * must be too; we do not need an explicit range-limiting operation. + * Hence the value being shifted is never negative, and we don't + * need the general RIGHT_SHIFT macro. + */ + /* Y */ + outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] + + ctab[b + B_Y_OFF]) >> SCALEBITS); + /* Cb */ + outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] + + ctab[b + B_CB_OFF]) >> SCALEBITS); + /* Cr */ + outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] + + ctab[b + B_CR_OFF]) >> SCALEBITS); + } + } +} + + +/**************** Cases other than RGB -> YCbCr **************/ + + +/* + * Convert some rows of samples to the JPEG colorspace. + * This version handles RGB->grayscale conversion, which is the same + * as the RGB->Y portion of RGB->YCbCr. + * We assume rgb_ycc_start has been called (we only use the Y tables). + */ + +INLINE +LOCAL(void) +rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, JDIMENSION output_row, + int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; + register int r, g, b; + register JLONG *ctab = cconvert->rgb_ycc_tab; + register JSAMPROW inptr; + register JSAMPROW outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->image_width; + + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr = output_buf[0][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + r = inptr[RGB_RED]; + g = inptr[RGB_GREEN]; + b = inptr[RGB_BLUE]; + inptr += RGB_PIXELSIZE; + /* Y */ + outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] + + ctab[b + B_Y_OFF]) >> SCALEBITS); + } + } +} + + +/* + * Convert some rows of samples to the JPEG colorspace. + * This version handles extended RGB->plain RGB conversion + */ + +INLINE +LOCAL(void) +rgb_rgb_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, JDIMENSION output_row, + int num_rows) +{ + register JSAMPROW inptr; + register JSAMPROW outptr0, outptr1, outptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->image_width; + + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr0 = output_buf[0][output_row]; + outptr1 = output_buf[1][output_row]; + outptr2 = output_buf[2][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + outptr0[col] = inptr[RGB_RED]; + outptr1[col] = inptr[RGB_GREEN]; + outptr2[col] = inptr[RGB_BLUE]; + inptr += RGB_PIXELSIZE; + } + } +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jchuff.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jchuff.h new file mode 100644 index 0000000000000000000000000000000000000000..314a2325c9e55b9958dedea9d101b3dc2af221ef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jchuff.h @@ -0,0 +1,42 @@ +/* + * jchuff.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1997, Thomas G. Lane. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains declarations for Huffman entropy encoding routines + * that are shared between the sequential encoder (jchuff.c) and the + * progressive encoder (jcphuff.c). No other modules need to see these. + */ + +/* The legal range of a DCT coefficient is + * -1024 .. +1023 for 8-bit data; + * -16384 .. +16383 for 12-bit data. + * Hence the magnitude should always fit in 10 or 14 bits respectively. + */ + +#if BITS_IN_JSAMPLE == 8 +#define MAX_COEF_BITS 10 +#else +#define MAX_COEF_BITS 14 +#endif + +/* Derived data constructed for each Huffman table */ + +typedef struct { + unsigned int ehufco[256]; /* code for each symbol */ + char ehufsi[256]; /* length of code for each symbol */ + /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ +} c_derived_tbl; + +/* Expand a Huffman table definition into the derived format */ +EXTERN(void) jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC, + int tblno, c_derived_tbl **pdtbl); + +/* Generate an optimal table definition given the specified counts */ +EXTERN(void) jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl, + long freq[]); diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jconfig.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..46e0ebcf533dfd5773a0bed90904091344978c77 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jconfig.h @@ -0,0 +1,37 @@ +/* Version ID for the JPEG library. + * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". + */ +#define JPEG_LIB_VERSION 62 + +/* libjpeg-turbo version */ +#define LIBJPEG_TURBO_VERSION 2.1.4 + +/* libjpeg-turbo version in integer form */ +#define LIBJPEG_TURBO_VERSION_NUMBER 2001004 + +/* Support arithmetic encoding */ +#define C_ARITH_CODING_SUPPORTED 1 + +/* Support arithmetic decoding */ +#define D_ARITH_CODING_SUPPORTED 1 + +/* Support in-memory source/destination managers */ +#define MEM_SRCDST_SUPPORTED 1 + +/* Use accelerated SIMD routines. */ +#define WITH_SIMD 1 + +/* + * Define BITS_IN_JSAMPLE as either + * 8 for 8-bit sample values (the usual setting) + * 12 for 12-bit sample values + * Only 8 and 12 are legal data precisions for lossy JPEG according to the + * JPEG standard, and the IJG code does not support anything else! + * We do not support run-time selection of data precision, sorry. + */ + +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ + +/* Define if your (broken) compiler shifts signed values as if they were + unsigned. */ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jconfigint.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jconfigint.h new file mode 100644 index 0000000000000000000000000000000000000000..986b8937e6c4d85d963ff79fed1c4d3d56e5de18 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jconfigint.h @@ -0,0 +1,49 @@ +/* libjpeg-turbo build number */ +#define BUILD "20221022" + +/* Compiler's inline keyword */ + + +/* How to obtain function inlining. */ +#define INLINE inline __attribute__((always_inline)) + +/* How to obtain thread-local storage */ +#define THREAD_LOCAL @THREAD_LOCAL@ + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libjpeg-turbo" + +/* Version number of package */ +#define VERSION "2.1.4" + +/* The size of `size_t', as computed by sizeof. */ +#if (__WORDSIZE==64 && !defined(__native_client__)) +#define SIZEOF_SIZE_T 8 +#else +#define SIZEOF_SIZE_T 4 +#endif + + +/* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */ +#define HAVE_BUILTIN_CTZL + +/* Define to 1 if you have the header file. */ + + +#if defined(_MSC_VER) && defined(HAVE_INTRIN_H) +#if (SIZEOF_SIZE_T == 8) +#define HAVE_BITSCANFORWARD64 +#elif (SIZEOF_SIZE_T == 4) +#define HAVE_BITSCANFORWARD +#endif +#endif + +#if defined(__has_attribute) +#if __has_attribute(fallthrough) +#define FALLTHROUGH __attribute__((fallthrough)); +#else +#define FALLTHROUGH +#endif +#else +#define FALLTHROUGH +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdcoefct.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdcoefct.h new file mode 100644 index 0000000000000000000000000000000000000000..9a0e78066364733ec036b7415a41defa4455f284 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdcoefct.h @@ -0,0 +1,83 @@ +/* + * jdcoefct.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1994-1997, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright (C) 2020, Google, Inc. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + */ + +#define JPEG_INTERNALS +#include "jpeglib.h" + + +/* Block smoothing is only applicable for progressive JPEG, so: */ +#ifndef D_PROGRESSIVE_SUPPORTED +#undef BLOCK_SMOOTHING_SUPPORTED +#endif + + +/* Private buffer controller object */ + +typedef struct { + struct jpeg_d_coef_controller pub; /* public fields */ + + /* These variables keep track of the current location of the input side. */ + /* cinfo->input_iMCU_row is also used for this. */ + JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ + int MCU_vert_offset; /* counts MCU rows within iMCU row */ + int MCU_rows_per_iMCU_row; /* number of such rows needed */ + + /* The output side's location is represented by cinfo->output_iMCU_row. */ + + /* In single-pass modes, it's sufficient to buffer just one MCU. + * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks, + * and let the entropy decoder write into that workspace each time. + * In multi-pass modes, this array points to the current MCU's blocks + * within the virtual arrays; it is used only by the input side. + */ + JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU]; + + /* Temporary workspace for one MCU */ + JCOEF *workspace; + +#ifdef D_MULTISCAN_FILES_SUPPORTED + /* In multi-pass modes, we need a virtual block array for each component. */ + jvirt_barray_ptr whole_image[MAX_COMPONENTS]; +#endif + +#ifdef BLOCK_SMOOTHING_SUPPORTED + /* When doing block smoothing, we latch coefficient Al values here */ + int *coef_bits_latch; +#define SAVED_COEFS 10 /* we save coef_bits[0..9] */ +#endif +} my_coef_controller; + +typedef my_coef_controller *my_coef_ptr; + + +LOCAL(void) +start_iMCU_row(j_decompress_ptr cinfo) +/* Reset within-iMCU-row counters for a new row (input side) */ +{ + my_coef_ptr coef = (my_coef_ptr)cinfo->coef; + + /* In an interleaved scan, an MCU row is the same as an iMCU row. + * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. + * But at the bottom of the image, process only what's left. + */ + if (cinfo->comps_in_scan > 1) { + coef->MCU_rows_per_iMCU_row = 1; + } else { + if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1)) + coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; + else + coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; + } + + coef->MCU_ctr = 0; + coef->MCU_vert_offset = 0; +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdcol565.c b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdcol565.c new file mode 100644 index 0000000000000000000000000000000000000000..53c7bd9187d459de652fc7f9babafb3b5e3c6612 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdcol565.c @@ -0,0 +1,384 @@ +/* + * jdcol565.c + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1997, Thomas G. Lane. + * Modifications: + * Copyright (C) 2013, Linaro Limited. + * Copyright (C) 2014-2015, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains output colorspace conversion routines. + */ + +/* This file is included by jdcolor.c */ + + +INLINE +LOCAL(void) +ycc_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; + register int y, cb, cr; + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + /* copy these pointers into registers if possible */ + register JSAMPLE *range_limit = cinfo->sample_range_limit; + register int *Crrtab = cconvert->Cr_r_tab; + register int *Cbbtab = cconvert->Cb_b_tab; + register JLONG *Crgtab = cconvert->Cr_g_tab; + register JLONG *Cbgtab = cconvert->Cb_g_tab; + SHIFT_TEMPS + + while (--num_rows >= 0) { + JLONG rgb; + unsigned int r, g, b; + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + + if (PACK_NEED_ALIGNMENT(outptr)) { + y = *inptr0++; + cb = *inptr1++; + cr = *inptr2++; + r = range_limit[y + Crrtab[cr]]; + g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + b = range_limit[y + Cbbtab[cb]]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + y = *inptr0++; + cb = *inptr1++; + cr = *inptr2++; + r = range_limit[y + Crrtab[cr]]; + g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + b = range_limit[y + Cbbtab[cb]]; + rgb = PACK_SHORT_565(r, g, b); + + y = *inptr0++; + cb = *inptr1++; + cr = *inptr2++; + r = range_limit[y + Crrtab[cr]]; + g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + b = range_limit[y + Cbbtab[cb]]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + y = *inptr0; + cb = *inptr1; + cr = *inptr2; + r = range_limit[y + Crrtab[cr]]; + g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + b = range_limit[y + Cbbtab[cb]]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + } + } +} + + +INLINE +LOCAL(void) +ycc_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; + register int y, cb, cr; + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + /* copy these pointers into registers if possible */ + register JSAMPLE *range_limit = cinfo->sample_range_limit; + register int *Crrtab = cconvert->Cr_r_tab; + register int *Cbbtab = cconvert->Cb_b_tab; + register JLONG *Crgtab = cconvert->Cr_g_tab; + register JLONG *Cbgtab = cconvert->Cb_g_tab; + JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + SHIFT_TEMPS + + while (--num_rows >= 0) { + JLONG rgb; + unsigned int r, g, b; + + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + y = *inptr0++; + cb = *inptr1++; + cr = *inptr2++; + r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)]; + g = range_limit[DITHER_565_G(y + + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)), d0)]; + b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + y = *inptr0++; + cb = *inptr1++; + cr = *inptr2++; + r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)]; + g = range_limit[DITHER_565_G(y + + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)), d0)]; + b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_SHORT_565(r, g, b); + + y = *inptr0++; + cb = *inptr1++; + cr = *inptr2++; + r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)]; + g = range_limit[DITHER_565_G(y + + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)), d0)]; + b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + y = *inptr0; + cb = *inptr1; + cr = *inptr2; + r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)]; + g = range_limit[DITHER_565_G(y + + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)), d0)]; + b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + } + } +} + + +INLINE +LOCAL(void) +rgb_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + SHIFT_TEMPS + + while (--num_rows >= 0) { + JLONG rgb; + unsigned int r, g, b; + + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + r = *inptr0++; + g = *inptr1++; + b = *inptr2++; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + r = *inptr0++; + g = *inptr1++; + b = *inptr2++; + rgb = PACK_SHORT_565(r, g, b); + + r = *inptr0++; + g = *inptr1++; + b = *inptr2++; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + r = *inptr0; + g = *inptr1; + b = *inptr2; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + } + } +} + + +INLINE +LOCAL(void) +rgb_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + register JSAMPLE *range_limit = cinfo->sample_range_limit; + JDIMENSION num_cols = cinfo->output_width; + JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + SHIFT_TEMPS + + while (--num_rows >= 0) { + JLONG rgb; + unsigned int r, g, b; + + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + r = range_limit[DITHER_565_R(*inptr0++, d0)]; + g = range_limit[DITHER_565_G(*inptr1++, d0)]; + b = range_limit[DITHER_565_B(*inptr2++, d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + r = range_limit[DITHER_565_R(*inptr0++, d0)]; + g = range_limit[DITHER_565_G(*inptr1++, d0)]; + b = range_limit[DITHER_565_B(*inptr2++, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_SHORT_565(r, g, b); + + r = range_limit[DITHER_565_R(*inptr0++, d0)]; + g = range_limit[DITHER_565_G(*inptr1++, d0)]; + b = range_limit[DITHER_565_B(*inptr2++, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + r = range_limit[DITHER_565_R(*inptr0, d0)]; + g = range_limit[DITHER_565_G(*inptr1, d0)]; + b = range_limit[DITHER_565_B(*inptr2, d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + } + } +} + + +INLINE +LOCAL(void) +gray_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + register JSAMPROW inptr, outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + + while (--num_rows >= 0) { + JLONG rgb; + unsigned int g; + + inptr = input_buf[0][input_row++]; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + g = *inptr++; + rgb = PACK_SHORT_565(g, g, g); + *(INT16 *)outptr = (INT16)rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + g = *inptr++; + rgb = PACK_SHORT_565(g, g, g); + g = *inptr++; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(g, g, g)); + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + g = *inptr; + rgb = PACK_SHORT_565(g, g, g); + *(INT16 *)outptr = (INT16)rgb; + } + } +} + + +INLINE +LOCAL(void) +gray_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + register JSAMPROW inptr, outptr; + register JDIMENSION col; + register JSAMPLE *range_limit = cinfo->sample_range_limit; + JDIMENSION num_cols = cinfo->output_width; + JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + + while (--num_rows >= 0) { + JLONG rgb; + unsigned int g; + + inptr = input_buf[0][input_row++]; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + g = *inptr++; + g = range_limit[DITHER_565_R(g, d0)]; + rgb = PACK_SHORT_565(g, g, g); + *(INT16 *)outptr = (INT16)rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + g = *inptr++; + g = range_limit[DITHER_565_R(g, d0)]; + rgb = PACK_SHORT_565(g, g, g); + d0 = DITHER_ROTATE(d0); + + g = *inptr++; + g = range_limit[DITHER_565_R(g, d0)]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(g, g, g)); + d0 = DITHER_ROTATE(d0); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + g = *inptr; + g = range_limit[DITHER_565_R(g, d0)]; + rgb = PACK_SHORT_565(g, g, g); + *(INT16 *)outptr = (INT16)rgb; + } + } +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdcolext.c b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdcolext.c new file mode 100644 index 0000000000000000000000000000000000000000..863c7a2fbc76a9226dafd3a6167d6209adeeae92 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdcolext.c @@ -0,0 +1,141 @@ +/* + * jdcolext.c + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1997, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2009, 2011, 2015, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains output colorspace conversion routines. + */ + + +/* This file is included by jdcolor.c */ + + +/* + * Convert some rows of samples to the output colorspace. + * + * Note that we change from noninterleaved, one-plane-per-component format + * to interleaved-pixel format. The output buffer is therefore three times + * as wide as the input buffer. + * A starting row offset is provided only for the input buffer. The caller + * can easily adjust the passed output_buf value to accommodate any row + * offset required on that side. + */ + +INLINE +LOCAL(void) +ycc_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; + register int y, cb, cr; + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + /* copy these pointers into registers if possible */ + register JSAMPLE *range_limit = cinfo->sample_range_limit; + register int *Crrtab = cconvert->Cr_r_tab; + register int *Cbbtab = cconvert->Cb_b_tab; + register JLONG *Crgtab = cconvert->Cr_g_tab; + register JLONG *Cbgtab = cconvert->Cb_g_tab; + SHIFT_TEMPS + + while (--num_rows >= 0) { + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + y = inptr0[col]; + cb = inptr1[col]; + cr = inptr2[col]; + /* Range-limiting is essential due to noise introduced by DCT losses. */ + outptr[RGB_RED] = range_limit[y + Crrtab[cr]]; + outptr[RGB_GREEN] = range_limit[y + + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; + /* Set unused byte to 0xFF so it can be interpreted as an opaque */ + /* alpha channel value */ +#ifdef RGB_ALPHA + outptr[RGB_ALPHA] = 0xFF; +#endif + outptr += RGB_PIXELSIZE; + } + } +} + + +/* + * Convert grayscale to RGB: just duplicate the graylevel three times. + * This is provided to support applications that don't want to cope + * with grayscale as a separate case. + */ + +INLINE +LOCAL(void) +gray_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + register JSAMPROW inptr, outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + + while (--num_rows >= 0) { + inptr = input_buf[0][input_row++]; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; + /* Set unused byte to 0xFF so it can be interpreted as an opaque */ + /* alpha channel value */ +#ifdef RGB_ALPHA + outptr[RGB_ALPHA] = 0xFF; +#endif + outptr += RGB_PIXELSIZE; + } + } +} + + +/* + * Convert RGB to extended RGB: just swap the order of source pixels + */ + +INLINE +LOCAL(void) +rgb_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows) +{ + register JSAMPROW inptr0, inptr1, inptr2; + register JSAMPROW outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + + while (--num_rows >= 0) { + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + outptr[RGB_RED] = inptr0[col]; + outptr[RGB_GREEN] = inptr1[col]; + outptr[RGB_BLUE] = inptr2[col]; + /* Set unused byte to 0xFF so it can be interpreted as an opaque */ + /* alpha channel value */ +#ifdef RGB_ALPHA + outptr[RGB_ALPHA] = 0xFF; +#endif + outptr += RGB_PIXELSIZE; + } + } +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdct.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdct.h new file mode 100644 index 0000000000000000000000000000000000000000..66d1718b770bd7668e4c8a7b275475695f6b2e1c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdct.h @@ -0,0 +1,208 @@ +/* + * jdct.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1994-1996, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2015, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This include file contains common declarations for the forward and + * inverse DCT modules. These declarations are private to the DCT managers + * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms. + * The individual DCT algorithms are kept in separate files to ease + * machine-dependent tuning (e.g., assembly coding). + */ + + +/* + * A forward DCT routine is given a pointer to a work area of type DCTELEM[]; + * the DCT is to be performed in-place in that buffer. Type DCTELEM is int + * for 8-bit samples, JLONG for 12-bit samples. (NOTE: Floating-point DCT + * implementations use an array of type FAST_FLOAT, instead.) + * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE). + * The DCT outputs are returned scaled up by a factor of 8; they therefore + * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This + * convention improves accuracy in integer implementations and saves some + * work in floating-point ones. + * Quantization of the output coefficients is done by jcdctmgr.c. This + * step requires an unsigned type and also one with twice the bits. + */ + +#if BITS_IN_JSAMPLE == 8 +#ifndef WITH_SIMD +typedef int DCTELEM; /* 16 or 32 bits is fine */ +typedef unsigned int UDCTELEM; +typedef unsigned long long UDCTELEM2; +#else +typedef short DCTELEM; /* prefer 16 bit with SIMD for parellelism */ +typedef unsigned short UDCTELEM; +typedef unsigned int UDCTELEM2; +#endif +#else +typedef JLONG DCTELEM; /* must have 32 bits */ +typedef unsigned long long UDCTELEM2; +#endif + + +/* + * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer + * to an output sample array. The routine must dequantize the input data as + * well as perform the IDCT; for dequantization, it uses the multiplier table + * pointed to by compptr->dct_table. The output data is to be placed into the + * sample array starting at a specified column. (Any row offset needed will + * be applied to the array pointer before it is passed to the IDCT code.) + * Note that the number of samples emitted by the IDCT routine is + * DCT_scaled_size * DCT_scaled_size. + */ + +/* typedef inverse_DCT_method_ptr is declared in jpegint.h */ + +/* + * Each IDCT routine has its own ideas about the best dct_table element type. + */ + +typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */ +#if BITS_IN_JSAMPLE == 8 +typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */ +#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */ +#else +typedef JLONG IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */ +#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */ +#endif +typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ + + +/* + * Each IDCT routine is responsible for range-limiting its results and + * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could + * be quite far out of range if the input data is corrupt, so a bulletproof + * range-limiting step is required. We use a mask-and-table-lookup method + * to do the combined operations quickly. See the comments with + * prepare_range_limit_table (in jdmaster.c) for more info. + */ + +#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE) + +#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */ + + +/* Extern declarations for the forward and inverse DCT routines. */ + +EXTERN(void) jpeg_fdct_islow(DCTELEM *data); +EXTERN(void) jpeg_fdct_ifast(DCTELEM *data); +EXTERN(void) jpeg_fdct_float(FAST_FLOAT *data); + +EXTERN(void) jpeg_idct_islow(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_ifast(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_float(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_7x7(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_6x6(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_5x5(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_4x4(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_3x3(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_2x2(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_1x1(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_9x9(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_10x10(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_11x11(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_12x12(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_13x13(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_14x14(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_15x15(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jpeg_idct_16x16(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); + + +/* + * Macros for handling fixed-point arithmetic; these are used by many + * but not all of the DCT/IDCT modules. + * + * All values are expected to be of type JLONG. + * Fractional constants are scaled left by CONST_BITS bits. + * CONST_BITS is defined within each module using these macros, + * and may differ from one module to the next. + */ + +#define ONE ((JLONG)1) +#define CONST_SCALE (ONE << CONST_BITS) + +/* Convert a positive real constant to an integer scaled by CONST_SCALE. + * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, + * thus causing a lot of useless floating-point operations at run time. + */ + +#define FIX(x) ((JLONG)((x) * CONST_SCALE + 0.5)) + +/* Descale and correctly round a JLONG value that's scaled by N bits. + * We assume RIGHT_SHIFT rounds towards minus infinity, so adding + * the fudge factor is correct for either sign of X. + */ + +#define DESCALE(x, n) RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n) + +/* Multiply a JLONG variable by a JLONG constant to yield a JLONG result. + * This macro is used only when the two inputs will actually be no more than + * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a + * full 32x32 multiply. This provides a useful speedup on many machines. + * Unfortunately there is no way to specify a 16x16->32 multiply portably + * in C, but some C compilers will do the right thing if you provide the + * correct combination of casts. + */ + +#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ +#define MULTIPLY16C16(var, const) (((INT16)(var)) * ((INT16)(const))) +#endif +#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ +#define MULTIPLY16C16(var, const) (((INT16)(var)) * ((JLONG)(const))) +#endif + +#ifndef MULTIPLY16C16 /* default definition */ +#define MULTIPLY16C16(var, const) ((var) * (const)) +#endif + +/* Same except both inputs are variables. */ + +#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ +#define MULTIPLY16V16(var1, var2) (((INT16)(var1)) * ((INT16)(var2))) +#endif + +#ifndef MULTIPLY16V16 /* default definition */ +#define MULTIPLY16V16(var1, var2) ((var1) * (var2)) +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdhuff.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdhuff.h new file mode 100644 index 0000000000000000000000000000000000000000..cfa0b7f5588893d78f428bef6ad634f791540996 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdhuff.h @@ -0,0 +1,247 @@ +/* + * jdhuff.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1997, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2010-2011, 2015-2016, 2021, D. R. Commander. + * Copyright (C) 2018, Matthias Räncker. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains declarations for Huffman entropy decoding routines + * that are shared between the sequential decoder (jdhuff.c) and the + * progressive decoder (jdphuff.c). No other modules need to see these. + */ + +#include "jconfigint.h" + + +/* Derived data constructed for each Huffman table */ + +#define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ + +typedef struct { + /* Basic tables: (element [0] of each array is unused) */ + JLONG maxcode[18]; /* largest code of length k (-1 if none) */ + /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */ + JLONG valoffset[18]; /* huffval[] offset for codes of length k */ + /* valoffset[k] = huffval[] index of 1st symbol of code length k, less + * the smallest code of length k; so given a code of length k, the + * corresponding symbol is huffval[code + valoffset[k]] + */ + + /* Link to public Huffman table (needed only in jpeg_huff_decode) */ + JHUFF_TBL *pub; + + /* Lookahead table: indexed by the next HUFF_LOOKAHEAD bits of + * the input data stream. If the next Huffman code is no more + * than HUFF_LOOKAHEAD bits long, we can obtain its length and + * the corresponding symbol directly from this tables. + * + * The lower 8 bits of each table entry contain the number of + * bits in the corresponding Huffman code, or HUFF_LOOKAHEAD + 1 + * if too long. The next 8 bits of each entry contain the + * symbol. + */ + int lookup[1 << HUFF_LOOKAHEAD]; +} d_derived_tbl; + +/* Expand a Huffman table definition into the derived format */ +EXTERN(void) jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC, + int tblno, d_derived_tbl **pdtbl); + + +/* + * Fetching the next N bits from the input stream is a time-critical operation + * for the Huffman decoders. We implement it with a combination of inline + * macros and out-of-line subroutines. Note that N (the number of bits + * demanded at one time) never exceeds 15 for JPEG use. + * + * We read source bytes into get_buffer and dole out bits as needed. + * If get_buffer already contains enough bits, they are fetched in-line + * by the macros CHECK_BIT_BUFFER and GET_BITS. When there aren't enough + * bits, jpeg_fill_bit_buffer is called; it will attempt to fill get_buffer + * as full as possible (not just to the number of bits needed; this + * prefetching reduces the overhead cost of calling jpeg_fill_bit_buffer). + * Note that jpeg_fill_bit_buffer may return FALSE to indicate suspension. + * On TRUE return, jpeg_fill_bit_buffer guarantees that get_buffer contains + * at least the requested number of bits --- dummy zeroes are inserted if + * necessary. + */ + +#if !defined(_WIN32) && !defined(SIZEOF_SIZE_T) +#error Cannot determine word size +#endif + +#if SIZEOF_SIZE_T == 8 || defined(_WIN64) + +typedef size_t bit_buf_type; /* type of bit-extraction buffer */ +#define BIT_BUF_SIZE 64 /* size of buffer in bits */ + +#elif defined(__x86_64__) && defined(__ILP32__) + +typedef unsigned long long bit_buf_type; /* type of bit-extraction buffer */ +#define BIT_BUF_SIZE 64 /* size of buffer in bits */ + +#else + +typedef unsigned long bit_buf_type; /* type of bit-extraction buffer */ +#define BIT_BUF_SIZE 32 /* size of buffer in bits */ + +#endif + +/* If long is > 32 bits on your machine, and shifting/masking longs is + * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE + * appropriately should be a win. Unfortunately we can't define the size + * with something like #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8) + * because not all machines measure sizeof in 8-bit bytes. + */ + +typedef struct { /* Bitreading state saved across MCUs */ + bit_buf_type get_buffer; /* current bit-extraction buffer */ + int bits_left; /* # of unused bits in it */ +} bitread_perm_state; + +typedef struct { /* Bitreading working state within an MCU */ + /* Current data source location */ + /* We need a copy, rather than munging the original, in case of suspension */ + const JOCTET *next_input_byte; /* => next byte to read from source */ + size_t bytes_in_buffer; /* # of bytes remaining in source buffer */ + /* Bit input buffer --- note these values are kept in register variables, + * not in this struct, inside the inner loops. + */ + bit_buf_type get_buffer; /* current bit-extraction buffer */ + int bits_left; /* # of unused bits in it */ + /* Pointer needed by jpeg_fill_bit_buffer. */ + j_decompress_ptr cinfo; /* back link to decompress master record */ +} bitread_working_state; + +/* Macros to declare and load/save bitread local variables. */ +#define BITREAD_STATE_VARS \ + register bit_buf_type get_buffer; \ + register int bits_left; \ + bitread_working_state br_state + +#define BITREAD_LOAD_STATE(cinfop, permstate) \ + br_state.cinfo = cinfop; \ + br_state.next_input_byte = cinfop->src->next_input_byte; \ + br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \ + get_buffer = permstate.get_buffer; \ + bits_left = permstate.bits_left; + +#define BITREAD_SAVE_STATE(cinfop, permstate) \ + cinfop->src->next_input_byte = br_state.next_input_byte; \ + cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \ + permstate.get_buffer = get_buffer; \ + permstate.bits_left = bits_left + +/* + * These macros provide the in-line portion of bit fetching. + * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer + * before using GET_BITS, PEEK_BITS, or DROP_BITS. + * The variables get_buffer and bits_left are assumed to be locals, + * but the state struct might not be (jpeg_huff_decode needs this). + * CHECK_BIT_BUFFER(state, n, action); + * Ensure there are N bits in get_buffer; if suspend, take action. + * val = GET_BITS(n); + * Fetch next N bits. + * val = PEEK_BITS(n); + * Fetch next N bits without removing them from the buffer. + * DROP_BITS(n); + * Discard next N bits. + * The value N should be a simple variable, not an expression, because it + * is evaluated multiple times. + */ + +#define CHECK_BIT_BUFFER(state, nbits, action) { \ + if (bits_left < (nbits)) { \ + if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \ + { action; } \ + get_buffer = (state).get_buffer; bits_left = (state).bits_left; \ + } \ +} + +#define GET_BITS(nbits) \ + (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1)) + +#define PEEK_BITS(nbits) \ + (((int)(get_buffer >> (bits_left - (nbits)))) & ((1 << (nbits)) - 1)) + +#define DROP_BITS(nbits) \ + (bits_left -= (nbits)) + +/* Load up the bit buffer to a depth of at least nbits */ +EXTERN(boolean) jpeg_fill_bit_buffer(bitread_working_state *state, + register bit_buf_type get_buffer, + register int bits_left, int nbits); + + +/* + * Code for extracting next Huffman-coded symbol from input bit stream. + * Again, this is time-critical and we make the main paths be macros. + * + * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits + * without looping. Usually, more than 95% of the Huffman codes will be 8 + * or fewer bits long. The few overlength codes are handled with a loop, + * which need not be inline code. + * + * Notes about the HUFF_DECODE macro: + * 1. Near the end of the data segment, we may fail to get enough bits + * for a lookahead. In that case, we do it the hard way. + * 2. If the lookahead table contains no entry, the next code must be + * more than HUFF_LOOKAHEAD bits long. + * 3. jpeg_huff_decode returns -1 if forced to suspend. + */ + +#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \ + register int nb, look; \ + if (bits_left < HUFF_LOOKAHEAD) { \ + if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \ + { failaction; } \ + get_buffer = state.get_buffer; bits_left = state.bits_left; \ + if (bits_left < HUFF_LOOKAHEAD) { \ + nb = 1; goto slowlabel; \ + } \ + } \ + look = PEEK_BITS(HUFF_LOOKAHEAD); \ + if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \ + DROP_BITS(nb); \ + result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \ + } else { \ +slowlabel: \ + if ((result = \ + jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \ + { failaction; } \ + get_buffer = state.get_buffer; bits_left = state.bits_left; \ + } \ +} + +#define HUFF_DECODE_FAST(s, nb, htbl) \ + FILL_BIT_BUFFER_FAST; \ + s = PEEK_BITS(HUFF_LOOKAHEAD); \ + s = htbl->lookup[s]; \ + nb = s >> HUFF_LOOKAHEAD; \ + /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \ + DROP_BITS(nb); \ + s = s & ((1 << HUFF_LOOKAHEAD) - 1); \ + if (nb > HUFF_LOOKAHEAD) { \ + /* Equivalent of jpeg_huff_decode() */ \ + /* Don't use GET_BITS() here because we don't want to modify bits_left */ \ + s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \ + while (s > htbl->maxcode[nb]) { \ + s <<= 1; \ + s |= GET_BITS(1); \ + nb++; \ + } \ + if (nb > 16) \ + s = 0; \ + else \ + s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \ + } + +/* Out-of-line case for Huffman code fetching */ +EXTERN(int) jpeg_huff_decode(bitread_working_state *state, + register bit_buf_type get_buffer, + register int bits_left, d_derived_tbl *htbl, + int min_bits); diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmainct.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmainct.h new file mode 100644 index 0000000000000000000000000000000000000000..37b201ca88260543a4a7e4b8662fd94c9681a3e0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmainct.h @@ -0,0 +1,71 @@ +/* + * jdmainct.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1994-1996, Thomas G. Lane. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + */ + +#define JPEG_INTERNALS +#include "jpeglib.h" +#include "jpegcomp.h" + + +/* Private buffer controller object */ + +typedef struct { + struct jpeg_d_main_controller pub; /* public fields */ + + /* Pointer to allocated workspace (M or M+2 row groups). */ + JSAMPARRAY buffer[MAX_COMPONENTS]; + + boolean buffer_full; /* Have we gotten an iMCU row from decoder? */ + JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ + + /* Remaining fields are only used in the context case. */ + + /* These are the master pointers to the funny-order pointer lists. */ + JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */ + + int whichptr; /* indicates which pointer set is now in use */ + int context_state; /* process_data state machine status */ + JDIMENSION rowgroups_avail; /* row groups available to postprocessor */ + JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ +} my_main_controller; + +typedef my_main_controller *my_main_ptr; + + +/* context_state values: */ +#define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */ +#define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */ +#define CTX_POSTPONED_ROW 2 /* feeding postponed row group */ + + +LOCAL(void) +set_wraparound_pointers(j_decompress_ptr cinfo) +/* Set up the "wraparound" pointers at top and bottom of the pointer lists. + * This changes the pointer list state from top-of-image to the normal state. + */ +{ + my_main_ptr main_ptr = (my_main_ptr)cinfo->main; + int ci, i, rgroup; + int M = cinfo->_min_DCT_scaled_size; + jpeg_component_info *compptr; + JSAMPARRAY xbuf0, xbuf1; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / + cinfo->_min_DCT_scaled_size; /* height of a row group of component */ + xbuf0 = main_ptr->xbuffer[0][ci]; + xbuf1 = main_ptr->xbuffer[1][ci]; + for (i = 0; i < rgroup; i++) { + xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i]; + xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i]; + xbuf0[rgroup * (M + 2) + i] = xbuf0[i]; + xbuf1[rgroup * (M + 2) + i] = xbuf1[i]; + } + } +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmaster.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmaster.h new file mode 100644 index 0000000000000000000000000000000000000000..76897e2820f82b5812cb34ceb4bd7f458dc69653 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmaster.h @@ -0,0 +1,28 @@ +/* + * jdmaster.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1995, Thomas G. Lane. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains the master control structure for the JPEG decompressor. + */ + +/* Private state */ + +typedef struct { + struct jpeg_decomp_master pub; /* public fields */ + + int pass_number; /* # of passes completed */ + + boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */ + + /* Saved references to initialized quantizer modules, + * in case we need to switch modes. + */ + struct jpeg_color_quantizer *quantizer_1pass; + struct jpeg_color_quantizer *quantizer_2pass; +} my_decomp_master; + +typedef my_decomp_master *my_master_ptr; diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmerge.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmerge.h new file mode 100644 index 0000000000000000000000000000000000000000..b583396b106564d2b5afc93d5425dc42ed029a03 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmerge.h @@ -0,0 +1,47 @@ +/* + * jdmerge.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1994-1996, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2020, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + */ + +#define JPEG_INTERNALS +#include "jpeglib.h" + +#ifdef UPSAMPLE_MERGING_SUPPORTED + + +/* Private subobject */ + +typedef struct { + struct jpeg_upsampler pub; /* public fields */ + + /* Pointer to routine to do actual upsampling/conversion of one row group */ + void (*upmethod) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); + + /* Private state for YCC->RGB conversion */ + int *Cr_r_tab; /* => table for Cr to R conversion */ + int *Cb_b_tab; /* => table for Cb to B conversion */ + JLONG *Cr_g_tab; /* => table for Cr to G conversion */ + JLONG *Cb_g_tab; /* => table for Cb to G conversion */ + + /* For 2:1 vertical sampling, we produce two output rows at a time. + * We need a "spare" row buffer to hold the second output row if the + * application provides just a one-row buffer; we also use the spare + * to discard the dummy last row if the image height is odd. + */ + JSAMPROW spare_row; + boolean spare_full; /* T if spare buffer is occupied */ + + JDIMENSION out_row_width; /* samples per output row */ + JDIMENSION rows_to_go; /* counts rows remaining in image */ +} my_merged_upsampler; + +typedef my_merged_upsampler *my_merged_upsample_ptr; + +#endif /* UPSAMPLE_MERGING_SUPPORTED */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmrg565.c b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmrg565.c new file mode 100644 index 0000000000000000000000000000000000000000..980a4e216e4dd7fa9885a2949033746dfd9d8309 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmrg565.c @@ -0,0 +1,354 @@ +/* + * jdmrg565.c + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1994-1996, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2013, Linaro Limited. + * Copyright (C) 2014-2015, 2018, 2020, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains code for merged upsampling/color conversion. + */ + + +INLINE +LOCAL(void) +h2v1_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr; + JSAMPROW inptr0, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE *range_limit = cinfo->sample_range_limit; + int *Crrtab = upsample->Cr_r_tab; + int *Cbbtab = upsample->Cb_b_tab; + JLONG *Crgtab = upsample->Cr_g_tab; + JLONG *Cbgtab = upsample->Cb_g_tab; + unsigned int r, g, b; + JLONG rgb; + SHIFT_TEMPS + + inptr0 = input_buf[0][in_row_group_ctr]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr = output_buf[0]; + + /* Loop for each pair of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = *inptr1++; + cr = *inptr2++; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + /* Fetch 2 Y values and emit 2 pixels */ + y = *inptr0++; + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + + y = *inptr0++; + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr, rgb); + outptr += 4; + } + + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = *inptr1; + cr = *inptr2; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = *inptr0; + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + } +} + + +INLINE +LOCAL(void) +h2v1_merged_upsample_565D_internal(j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr; + JSAMPROW inptr0, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE *range_limit = cinfo->sample_range_limit; + int *Crrtab = upsample->Cr_r_tab; + int *Cbbtab = upsample->Cb_b_tab; + JLONG *Crgtab = upsample->Cr_g_tab; + JLONG *Cbgtab = upsample->Cb_g_tab; + JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + unsigned int r, g, b; + JLONG rgb; + SHIFT_TEMPS + + inptr0 = input_buf[0][in_row_group_ctr]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr = output_buf[0]; + + /* Loop for each pair of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = *inptr1++; + cr = *inptr2++; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + /* Fetch 2 Y values and emit 2 pixels */ + y = *inptr0++; + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_SHORT_565(r, g, b); + + y = *inptr0++; + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr, rgb); + outptr += 4; + } + + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = *inptr1; + cr = *inptr2; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = *inptr0; + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr = (INT16)rgb; + } +} + + +INLINE +LOCAL(void) +h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr0, outptr1; + JSAMPROW inptr00, inptr01, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE *range_limit = cinfo->sample_range_limit; + int *Crrtab = upsample->Cr_r_tab; + int *Cbbtab = upsample->Cb_b_tab; + JLONG *Crgtab = upsample->Cr_g_tab; + JLONG *Cbgtab = upsample->Cb_g_tab; + unsigned int r, g, b; + JLONG rgb; + SHIFT_TEMPS + + inptr00 = input_buf[0][in_row_group_ctr * 2]; + inptr01 = input_buf[0][in_row_group_ctr * 2 + 1]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr0 = output_buf[0]; + outptr1 = output_buf[1]; + + /* Loop for each group of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = *inptr1++; + cr = *inptr2++; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + /* Fetch 4 Y values and emit 4 pixels */ + y = *inptr00++; + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + + y = *inptr00++; + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr0, rgb); + outptr0 += 4; + + y = *inptr01++; + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + + y = *inptr01++; + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr1, rgb); + outptr1 += 4; + } + + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = *inptr1; + cr = *inptr2; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + y = *inptr00; + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr0 = (INT16)rgb; + + y = *inptr01; + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr1 = (INT16)rgb; + } +} + + +INLINE +LOCAL(void) +h2v2_merged_upsample_565D_internal(j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr0, outptr1; + JSAMPROW inptr00, inptr01, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE *range_limit = cinfo->sample_range_limit; + int *Crrtab = upsample->Cr_r_tab; + int *Cbbtab = upsample->Cb_b_tab; + JLONG *Crgtab = upsample->Cr_g_tab; + JLONG *Cbgtab = upsample->Cb_g_tab; + JLONG d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + JLONG d1 = dither_matrix[(cinfo->output_scanline + 1) & DITHER_MASK]; + unsigned int r, g, b; + JLONG rgb; + SHIFT_TEMPS + + inptr00 = input_buf[0][in_row_group_ctr * 2]; + inptr01 = input_buf[0][in_row_group_ctr * 2 + 1]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr0 = output_buf[0]; + outptr1 = output_buf[1]; + + /* Loop for each group of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = *inptr1++; + cr = *inptr2++; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + /* Fetch 4 Y values and emit 4 pixels */ + y = *inptr00++; + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_SHORT_565(r, g, b); + + y = *inptr00++; + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr0, rgb); + outptr0 += 4; + + y = *inptr01++; + r = range_limit[DITHER_565_R(y + cred, d1)]; + g = range_limit[DITHER_565_G(y + cgreen, d1)]; + b = range_limit[DITHER_565_B(y + cblue, d1)]; + d1 = DITHER_ROTATE(d1); + rgb = PACK_SHORT_565(r, g, b); + + y = *inptr01++; + r = range_limit[DITHER_565_R(y + cred, d1)]; + g = range_limit[DITHER_565_G(y + cgreen, d1)]; + b = range_limit[DITHER_565_B(y + cblue, d1)]; + d1 = DITHER_ROTATE(d1); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr1, rgb); + outptr1 += 4; + } + + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = *inptr1; + cr = *inptr2; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + y = *inptr00; + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr0 = (INT16)rgb; + + y = *inptr01; + r = range_limit[DITHER_565_R(y + cred, d1)]; + g = range_limit[DITHER_565_G(y + cgreen, d1)]; + b = range_limit[DITHER_565_B(y + cblue, d1)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16 *)outptr1 = (INT16)rgb; + } +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmrgext.c b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmrgext.c new file mode 100644 index 0000000000000000000000000000000000000000..9bf4f1a307f372b25318a79a056220297401650a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdmrgext.c @@ -0,0 +1,184 @@ +/* + * jdmrgext.c + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1994-1996, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2011, 2015, 2020, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains code for merged upsampling/color conversion. + */ + + +/* This file is included by jdmerge.c */ + + +/* + * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. + */ + +INLINE +LOCAL(void) +h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr; + JSAMPROW inptr0, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE *range_limit = cinfo->sample_range_limit; + int *Crrtab = upsample->Cr_r_tab; + int *Cbbtab = upsample->Cb_b_tab; + JLONG *Crgtab = upsample->Cr_g_tab; + JLONG *Cbgtab = upsample->Cb_g_tab; + SHIFT_TEMPS + + inptr0 = input_buf[0][in_row_group_ctr]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr = output_buf[0]; + /* Loop for each pair of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = *inptr1++; + cr = *inptr2++; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + /* Fetch 2 Y values and emit 2 pixels */ + y = *inptr0++; + outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_GREEN] = range_limit[y + cgreen]; + outptr[RGB_BLUE] = range_limit[y + cblue]; +#ifdef RGB_ALPHA + outptr[RGB_ALPHA] = 0xFF; +#endif + outptr += RGB_PIXELSIZE; + y = *inptr0++; + outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_GREEN] = range_limit[y + cgreen]; + outptr[RGB_BLUE] = range_limit[y + cblue]; +#ifdef RGB_ALPHA + outptr[RGB_ALPHA] = 0xFF; +#endif + outptr += RGB_PIXELSIZE; + } + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = *inptr1; + cr = *inptr2; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = *inptr0; + outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_GREEN] = range_limit[y + cgreen]; + outptr[RGB_BLUE] = range_limit[y + cblue]; +#ifdef RGB_ALPHA + outptr[RGB_ALPHA] = 0xFF; +#endif + } +} + + +/* + * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. + */ + +INLINE +LOCAL(void) +h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr0, outptr1; + JSAMPROW inptr00, inptr01, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE *range_limit = cinfo->sample_range_limit; + int *Crrtab = upsample->Cr_r_tab; + int *Cbbtab = upsample->Cb_b_tab; + JLONG *Crgtab = upsample->Cr_g_tab; + JLONG *Cbgtab = upsample->Cb_g_tab; + SHIFT_TEMPS + + inptr00 = input_buf[0][in_row_group_ctr * 2]; + inptr01 = input_buf[0][in_row_group_ctr * 2 + 1]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr0 = output_buf[0]; + outptr1 = output_buf[1]; + /* Loop for each group of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = *inptr1++; + cr = *inptr2++; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + /* Fetch 4 Y values and emit 4 pixels */ + y = *inptr00++; + outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_GREEN] = range_limit[y + cgreen]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; +#ifdef RGB_ALPHA + outptr0[RGB_ALPHA] = 0xFF; +#endif + outptr0 += RGB_PIXELSIZE; + y = *inptr00++; + outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_GREEN] = range_limit[y + cgreen]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; +#ifdef RGB_ALPHA + outptr0[RGB_ALPHA] = 0xFF; +#endif + outptr0 += RGB_PIXELSIZE; + y = *inptr01++; + outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_GREEN] = range_limit[y + cgreen]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; +#ifdef RGB_ALPHA + outptr1[RGB_ALPHA] = 0xFF; +#endif + outptr1 += RGB_PIXELSIZE; + y = *inptr01++; + outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_GREEN] = range_limit[y + cgreen]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; +#ifdef RGB_ALPHA + outptr1[RGB_ALPHA] = 0xFF; +#endif + outptr1 += RGB_PIXELSIZE; + } + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = *inptr1; + cr = *inptr2; + cred = Crrtab[cr]; + cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = *inptr00; + outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_GREEN] = range_limit[y + cgreen]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; +#ifdef RGB_ALPHA + outptr0[RGB_ALPHA] = 0xFF; +#endif + y = *inptr01; + outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_GREEN] = range_limit[y + cgreen]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; +#ifdef RGB_ALPHA + outptr1[RGB_ALPHA] = 0xFF; +#endif + } +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdsample.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdsample.h new file mode 100644 index 0000000000000000000000000000000000000000..a6bf08a032ac87e75c57d67ffbfca81dc30219db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jdsample.h @@ -0,0 +1,50 @@ +/* + * jdsample.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1996, Thomas G. Lane. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + */ + +#define JPEG_INTERNALS +#include "jpeglib.h" + + +/* Pointer to routine to upsample a single component */ +typedef void (*upsample1_ptr) (j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +/* Private subobject */ + +typedef struct { + struct jpeg_upsampler pub; /* public fields */ + + /* Color conversion buffer. When using separate upsampling and color + * conversion steps, this buffer holds one upsampled row group until it + * has been color converted and output. + * Note: we do not allocate any storage for component(s) which are full-size, + * ie do not need rescaling. The corresponding entry of color_buf[] is + * simply set to point to the input data array, thereby avoiding copying. + */ + JSAMPARRAY color_buf[MAX_COMPONENTS]; + + /* Per-component upsampling method pointers */ + upsample1_ptr methods[MAX_COMPONENTS]; + + int next_row_out; /* counts rows emitted from color_buf */ + JDIMENSION rows_to_go; /* counts rows remaining in image */ + + /* Height of an input row group for each component. */ + int rowgroup_height[MAX_COMPONENTS]; + + /* These arrays save pixel expansion factors so that int_expand need not + * recompute them each time. They are unused for other upsampling methods. + */ + UINT8 h_expand[MAX_COMPONENTS]; + UINT8 v_expand[MAX_COMPONENTS]; +} my_upsampler; + +typedef my_upsampler *my_upsample_ptr; diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jerror.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jerror.h new file mode 100644 index 0000000000000000000000000000000000000000..eb44a1140a2e2f8c9d50cfb23d95915f789024d4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jerror.h @@ -0,0 +1,331 @@ +/* + * jerror.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1994-1997, Thomas G. Lane. + * Modified 1997-2009 by Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2014, 2017, 2021-2022, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file defines the error and message codes for the JPEG library. + * Edit this file to add new codes, or to translate the message strings to + * some other language. + * A set of error-reporting macros are defined too. Some applications using + * the JPEG library may wish to include this file to get the error codes + * and/or the macros. + */ + +/* + * To define the enum list of message codes, include this file without + * defining macro JMESSAGE. To create a message string table, include it + * again with a suitable JMESSAGE definition (see jerror.c for an example). + */ +#ifndef JMESSAGE +#ifndef JERROR_H +/* First time through, define the enum list */ +#define JMAKE_ENUM_LIST +#else +/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ +#define JMESSAGE(code, string) +#endif /* JERROR_H */ +#endif /* JMESSAGE */ + +#ifdef JMAKE_ENUM_LIST + +typedef enum { + +#define JMESSAGE(code, string) code, + +#endif /* JMAKE_ENUM_LIST */ + +JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */ + +/* For maintenance convenience, list is alphabetical by message code name */ +#if JPEG_LIB_VERSION < 70 +JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, arithmetic coding is not implemented") +#endif +JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") +JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") +JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") +JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") +#if JPEG_LIB_VERSION >= 70 +JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") +#endif +JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") +JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") +#if JPEG_LIB_VERSION >= 70 +JMESSAGE(JERR_BAD_DROP_SAMPLING, + "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") +#endif +JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") +JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") +JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") +JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length") +JMESSAGE(JERR_BAD_LIB_VERSION, + "Wrong JPEG library version: library is %d, caller expects %d") +JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan") +JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d") +JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d") +JMESSAGE(JERR_BAD_PROGRESSION, + "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") +JMESSAGE(JERR_BAD_PROG_SCRIPT, + "Invalid progressive parameters at scan script entry %d") +JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors") +JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d") +JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d") +JMESSAGE(JERR_BAD_STRUCT_SIZE, + "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") +JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") +JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small") +JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here") +JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") +JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") +JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request") +JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") +JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") +JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") +JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d") +JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)") +JMESSAGE(JERR_EMS_READ, "Read from EMS failed") +JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") +JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan") +JMESSAGE(JERR_FILE_READ, "Input file read error") +JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?") +JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet") +JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") +JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") +JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels") +JMESSAGE(JERR_INPUT_EMPTY, "Empty input file") +JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") +JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, + "Cannot transcode due to multiple use of quantization table %d") +JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") +JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") +JMESSAGE(JERR_NOTIMPL, "Requested features are incompatible") +JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") +#if JPEG_LIB_VERSION >= 70 +JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") +#endif +JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") +JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") +JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") +JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined") +JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x") +JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)") +JMESSAGE(JERR_QUANT_COMPONENTS, + "Cannot quantize more than %d color components") +JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") +JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors") +JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") +JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker") +JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x") +JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") +JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF") +JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s") +JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") +JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file") +JMESSAGE(JERR_TFILE_WRITE, + "Write failed on temporary file --- out of disk space?") +JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") +JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x") +JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") +JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation") +JMESSAGE(JERR_XMS_READ, "Read from XMS failed") +JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") +JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT_SHORT) +JMESSAGE(JMSG_VERSION, JVERSION) +JMESSAGE(JTRC_16BIT_TABLES, + "Caution: quantization tables are too coarse for baseline JPEG") +JMESSAGE(JTRC_ADOBE, + "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") +JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") +JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") +JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") +JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") +JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d") +JMESSAGE(JTRC_DRI, "Define Restart Interval %u") +JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") +JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") +JMESSAGE(JTRC_EOI, "End Of Image") +JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") +JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") +JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, + "Warning: thumbnail image size does not match data length %u") +JMESSAGE(JTRC_JFIF_EXTENSION, "JFIF extension marker: type 0x%02x, length %u") +JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") +JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") +JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") +JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u") +JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") +JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") +JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") +JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") +JMESSAGE(JTRC_RST, "RST%d") +JMESSAGE(JTRC_SMOOTH_NOTIMPL, + "Smoothing not supported with nonstandard sampling ratios") +JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d") +JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d") +JMESSAGE(JTRC_SOI, "Start of Image") +JMESSAGE(JTRC_SOS, "Start Of Scan: %d components") +JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d") +JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") +JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") +JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s") +JMESSAGE(JTRC_THUMB_JPEG, + "JFIF extension marker: JPEG-compressed thumbnail image, length %u") +JMESSAGE(JTRC_THUMB_PALETTE, + "JFIF extension marker: palette thumbnail image, length %u") +JMESSAGE(JTRC_THUMB_RGB, + "JFIF extension marker: RGB thumbnail image, length %u") +JMESSAGE(JTRC_UNKNOWN_IDS, + "Unrecognized component IDs %d %d %d, assuming YCbCr") +JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") +JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") +JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") +#if JPEG_LIB_VERSION >= 70 +JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") +#endif +JMESSAGE(JWRN_BOGUS_PROGRESSION, + "Inconsistent progression sequence for component %d coefficient %d") +JMESSAGE(JWRN_EXTRANEOUS_DATA, + "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") +JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment") +JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code") +JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d") +JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file") +JMESSAGE(JWRN_MUST_RESYNC, + "Corrupt JPEG data: found marker 0x%02x instead of RST%d") +JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") +JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") +#if JPEG_LIB_VERSION < 70 +JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") +#if defined(C_ARITH_CODING_SUPPORTED) || defined(D_ARITH_CODING_SUPPORTED) +JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") +JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") +#endif +#endif +JMESSAGE(JWRN_BOGUS_ICC, "Corrupt JPEG data: bad ICC marker") +#if JPEG_LIB_VERSION < 70 +JMESSAGE(JERR_BAD_DROP_SAMPLING, + "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") +#endif + +#ifdef JMAKE_ENUM_LIST + + JMSG_LASTMSGCODE +} J_MESSAGE_CODE; + +#undef JMAKE_ENUM_LIST +#endif /* JMAKE_ENUM_LIST */ + +/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ +#undef JMESSAGE + + +#ifndef JERROR_H +#define JERROR_H + +/* Macros to simplify using the error and trace message stuff */ +/* The first parameter is either type of cinfo pointer */ + +/* Fatal errors (print message and exit) */ +#define ERREXIT(cinfo, code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT1(cinfo, code, p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT2(cinfo, code, p1, p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT3(cinfo, code, p1, p2, p3) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT4(cinfo, code, p1, p2, p3, p4) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (cinfo)->err->msg_parm.i[3] = (p4), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT6(cinfo, code, p1, p2, p3, p4, p5, p6) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (cinfo)->err->msg_parm.i[3] = (p4), \ + (cinfo)->err->msg_parm.i[4] = (p5), \ + (cinfo)->err->msg_parm.i[5] = (p6), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXITS(cinfo, code, str) \ + ((cinfo)->err->msg_code = (code), \ + strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ + (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) + +#define MAKESTMT(stuff) do { stuff } while (0) + +/* Nonfatal errors (we can keep going, but the data is probably corrupt) */ +#define WARNMS(cinfo, code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1)) +#define WARNMS1(cinfo, code, p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1)) +#define WARNMS2(cinfo, code, p1, p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1)) + +/* Informational/debugging messages */ +#define TRACEMS(cinfo, lvl, code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) +#define TRACEMS1(cinfo, lvl, code, p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) +#define TRACEMS2(cinfo, lvl, code, p1, p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) +#define TRACEMS3(cinfo, lvl, code, p1, p2, p3) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMS4(cinfo, lvl, code, p1, p2, p3, p4) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMS5(cinfo, lvl, code, p1, p2, p3, p4, p5) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMS8(cinfo, lvl, code, p1, p2, p3, p4, p5, p6, p7, p8) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMSS(cinfo, lvl, code, str) \ + ((cinfo)->err->msg_code = (code), \ + strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ + (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) + +#endif /* JERROR_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jinclude.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jinclude.h new file mode 100644 index 0000000000000000000000000000000000000000..e8d983ac171fa0e47c87f0e0593518ceddde0bdb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jinclude.h @@ -0,0 +1,145 @@ +/* + * jinclude.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1994, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2022, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file exists to provide a single place to fix any problems with + * including the wrong system include files. (Common problems are taken + * care of by the standard jconfig symbols, but on really weird systems + * you may have to edit this file.) + * + * NOTE: this file is NOT intended to be included by applications using the + * JPEG library. Most applications need only include jpeglib.h. + */ + +#ifndef __JINCLUDE_H__ +#define __JINCLUDE_H__ + +/* Include auto-config file to find out which system include files we need. */ + +#include "jconfig.h" /* auto configuration options */ +#include "jconfigint.h" +#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ + +/* + * Note that the core JPEG library does not require ; + * only the default error handler and data source/destination modules do. + * But we must pull it in because of the references to FILE in jpeglib.h. + * You can remove those references if you want to compile without . + */ + +#include +#include +#include +#include + +/* + * These macros/inline functions facilitate using Microsoft's "safe string" + * functions with Visual Studio builds without the need to scatter #ifdefs + * throughout the code base. + */ + + +#ifdef _MSC_VER + +#define SNPRINTF(str, n, format, ...) \ + _snprintf_s(str, n, _TRUNCATE, format, ##__VA_ARGS__) + +#else + +#define SNPRINTF snprintf + +#endif + + +#ifndef NO_GETENV + +#ifdef _MSC_VER + +static INLINE int GETENV_S(char *buffer, size_t buffer_size, const char *name) +{ + size_t required_size; + + return (int)getenv_s(&required_size, buffer, buffer_size, name); +} + +#else /* _MSC_VER */ + +#include + +/* This provides a similar interface to the Microsoft/C11 getenv_s() function, + * but other than parameter validation, it has no advantages over getenv(). + */ + +static INLINE int GETENV_S(char *buffer, size_t buffer_size, const char *name) +{ + char *env; + + if (!buffer) { + if (buffer_size == 0) + return 0; + else + return (errno = EINVAL); + } + if (buffer_size == 0) + return (errno = EINVAL); + if (!name) { + *buffer = 0; + return 0; + } + + env = getenv(name); + if (!env) + { + *buffer = 0; + return 0; + } + + if (strlen(env) + 1 > buffer_size) { + *buffer = 0; + return ERANGE; + } + + strncpy(buffer, env, buffer_size); + + return 0; +} + +#endif /* _MSC_VER */ + +#endif /* NO_GETENV */ + + +#ifndef NO_PUTENV + +#ifdef _WIN32 + +#define PUTENV_S(name, value) _putenv_s(name, value) + +#else + +/* This provides a similar interface to the Microsoft _putenv_s() function, but + * other than parameter validation, it has no advantages over setenv(). + */ + +static INLINE int PUTENV_S(const char *name, const char *value) +{ + if (!name || !value) + return (errno = EINVAL); + + setenv(name, value, 1); + + return errno; +} + +#endif /* _WIN32 */ + +#endif /* NO_PUTENV */ + + +#endif /* JINCLUDE_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jmemsys.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jmemsys.h new file mode 100644 index 0000000000000000000000000000000000000000..9229550afde04f815f555fe5beac5ba8013ade5b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jmemsys.h @@ -0,0 +1,178 @@ +/* + * jmemsys.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1992-1997, Thomas G. Lane. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This include file defines the interface between the system-independent + * and system-dependent portions of the JPEG memory manager. No other + * modules need include it. (The system-independent portion is jmemmgr.c; + * there are several different versions of the system-dependent portion.) + * + * This file works as-is for the system-dependent memory managers supplied + * in the IJG distribution. You may need to modify it if you write a + * custom memory manager. If system-dependent changes are needed in + * this file, the best method is to #ifdef them based on a configuration + * symbol supplied in jconfig.h. + */ + + +/* + * These two functions are used to allocate and release small chunks of + * memory. (Typically the total amount requested through jpeg_get_small is + * no more than 20K or so; this will be requested in chunks of a few K each.) + * Behavior should be the same as for the standard library functions malloc + * and free; in particular, jpeg_get_small must return NULL on failure. + * On most systems, these ARE malloc and free. jpeg_free_small is passed the + * size of the object being freed, just in case it's needed. + */ + +EXTERN(void *) jpeg_get_small(j_common_ptr cinfo, size_t sizeofobject); +EXTERN(void) jpeg_free_small(j_common_ptr cinfo, void *object, + size_t sizeofobject); + +/* + * These two functions are used to allocate and release large chunks of + * memory (up to the total free space designated by jpeg_mem_available). + * These are identical to the jpeg_get/free_small routines; but we keep them + * separate anyway, in case a different allocation strategy is desirable for + * large chunks. + */ + +EXTERN(void *) jpeg_get_large(j_common_ptr cinfo, size_t sizeofobject); +EXTERN(void) jpeg_free_large(j_common_ptr cinfo, void *object, + size_t sizeofobject); + +/* + * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may + * be requested in a single call to jpeg_get_large (and jpeg_get_small for that + * matter, but that case should never come into play). This macro was needed + * to model the 64Kb-segment-size limit of far addressing on 80x86 machines. + * On machines with flat address spaces, any large constant may be used. + * + * NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type + * size_t and will be a multiple of sizeof(align_type). + */ + +#ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */ +#define MAX_ALLOC_CHUNK 1000000000L +#endif + +/* + * This routine computes the total space still available for allocation by + * jpeg_get_large. If more space than this is needed, backing store will be + * used. NOTE: any memory already allocated must not be counted. + * + * There is a minimum space requirement, corresponding to the minimum + * feasible buffer sizes; jmemmgr.c will request that much space even if + * jpeg_mem_available returns zero. The maximum space needed, enough to hold + * all working storage in memory, is also passed in case it is useful. + * Finally, the total space already allocated is passed. If no better + * method is available, cinfo->mem->max_memory_to_use - already_allocated + * is often a suitable calculation. + * + * It is OK for jpeg_mem_available to underestimate the space available + * (that'll just lead to more backing-store access than is really necessary). + * However, an overestimate will lead to failure. Hence it's wise to subtract + * a slop factor from the true available space. 5% should be enough. + * + * On machines with lots of virtual memory, any large constant may be returned. + * Conversely, zero may be returned to always use the minimum amount of memory. + */ + +EXTERN(size_t) jpeg_mem_available(j_common_ptr cinfo, size_t min_bytes_needed, + size_t max_bytes_needed, + size_t already_allocated); + + +/* + * This structure holds whatever state is needed to access a single + * backing-store object. The read/write/close method pointers are called + * by jmemmgr.c to manipulate the backing-store object; all other fields + * are private to the system-dependent backing store routines. + */ + +#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ + + +#ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */ + +typedef unsigned short XMSH; /* type of extended-memory handles */ +typedef unsigned short EMSH; /* type of expanded-memory handles */ + +typedef union { + short file_handle; /* DOS file handle if it's a temp file */ + XMSH xms_handle; /* handle if it's a chunk of XMS */ + EMSH ems_handle; /* handle if it's a chunk of EMS */ +} handle_union; + +#endif /* USE_MSDOS_MEMMGR */ + +#ifdef USE_MAC_MEMMGR /* Mac-specific junk */ +#include +#endif /* USE_MAC_MEMMGR */ + + +typedef struct backing_store_struct *backing_store_ptr; + +typedef struct backing_store_struct { + /* Methods for reading/writing/closing this backing-store object */ + void (*read_backing_store) (j_common_ptr cinfo, backing_store_ptr info, + void *buffer_address, long file_offset, + long byte_count); + void (*write_backing_store) (j_common_ptr cinfo, backing_store_ptr info, + void *buffer_address, long file_offset, + long byte_count); + void (*close_backing_store) (j_common_ptr cinfo, backing_store_ptr info); + + /* Private fields for system-dependent backing-store management */ +#ifdef USE_MSDOS_MEMMGR + /* For the MS-DOS manager (jmemdos.c), we need: */ + handle_union handle; /* reference to backing-store storage object */ + char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ +#else +#ifdef USE_MAC_MEMMGR + /* For the Mac manager (jmemmac.c), we need: */ + short temp_file; /* file reference number to temp file */ + FSSpec tempSpec; /* the FSSpec for the temp file */ + char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ +#else + /* For a typical implementation with temp files, we need: */ + FILE *temp_file; /* stdio reference to temp file */ + char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */ +#endif +#endif +} backing_store_info; + + +/* + * Initial opening of a backing-store object. This must fill in the + * read/write/close pointers in the object. The read/write routines + * may take an error exit if the specified maximum file size is exceeded. + * (If jpeg_mem_available always returns a large value, this routine can + * just take an error exit.) + */ + +EXTERN(void) jpeg_open_backing_store(j_common_ptr cinfo, + backing_store_ptr info, + long total_bytes_needed); + + +/* + * These routines take care of any system-dependent initialization and + * cleanup required. jpeg_mem_init will be called before anything is + * allocated (and, therefore, nothing in cinfo is of use except the error + * manager pointer). It should return a suitable default value for + * max_memory_to_use; this may subsequently be overridden by the surrounding + * application. (Note that max_memory_to_use is only important if + * jpeg_mem_available chooses to consult it ... no one else will.) + * jpeg_mem_term may assume that all requested memory has been freed and that + * all opened backing-store objects have been closed. + */ + +EXTERN(long) jpeg_mem_init(j_common_ptr cinfo); +EXTERN(void) jpeg_mem_term(j_common_ptr cinfo); diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jmorecfg.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jmorecfg.h new file mode 100644 index 0000000000000000000000000000000000000000..b33a991914ee729e0f4a8664a50859f54590dff5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jmorecfg.h @@ -0,0 +1,382 @@ +/* + * jmorecfg.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1997, Thomas G. Lane. + * Modified 1997-2009 by Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2009, 2011, 2014-2015, 2018, 2020, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains additional configuration options that customize the + * JPEG software for special applications or support machine-dependent + * optimizations. Most users will not need to touch this file. + */ + + +/* + * Maximum number of components (color channels) allowed in JPEG image. + * To meet the letter of Rec. ITU-T T.81 | ISO/IEC 10918-1, set this to 255. + * However, darn few applications need more than 4 channels (maybe 5 for CMYK + + * alpha mask). We recommend 10 as a reasonable compromise; use 4 if you are + * really short on memory. (Each allowed component costs a hundred or so + * bytes of storage, whether actually used in an image or not.) + */ + +#define MAX_COMPONENTS 10 /* maximum number of image components */ + + +/* + * Basic data types. + * You may need to change these if you have a machine with unusual data + * type sizes; for example, "char" not 8 bits, "short" not 16 bits, + * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, + * but it had better be at least 16. + */ + +/* Representation of a single sample (pixel element value). + * We frequently allocate large arrays of these, so it's important to keep + * them small. But if you have memory to burn and access to char or short + * arrays is very slow on your hardware, you might want to change these. + */ + +#if BITS_IN_JSAMPLE == 8 +/* JSAMPLE should be the smallest type that will hold the values 0..255. + */ + +typedef unsigned char JSAMPLE; +#define GETJSAMPLE(value) ((int)(value)) + +#define MAXJSAMPLE 255 +#define CENTERJSAMPLE 128 + +#endif /* BITS_IN_JSAMPLE == 8 */ + + +#if BITS_IN_JSAMPLE == 12 +/* JSAMPLE should be the smallest type that will hold the values 0..4095. + * On nearly all machines "short" will do nicely. + */ + +typedef short JSAMPLE; +#define GETJSAMPLE(value) ((int)(value)) + +#define MAXJSAMPLE 4095 +#define CENTERJSAMPLE 2048 + +#endif /* BITS_IN_JSAMPLE == 12 */ + + +/* Representation of a DCT frequency coefficient. + * This should be a signed value of at least 16 bits; "short" is usually OK. + * Again, we allocate large arrays of these, but you can change to int + * if you have memory to burn and "short" is really slow. + */ + +typedef short JCOEF; + + +/* Compressed datastreams are represented as arrays of JOCTET. + * These must be EXACTLY 8 bits wide, at least once they are written to + * external storage. Note that when using the stdio data source/destination + * managers, this is also the data type passed to fread/fwrite. + */ + +typedef unsigned char JOCTET; +#define GETJOCTET(value) (value) + + +/* These typedefs are used for various table entries and so forth. + * They must be at least as wide as specified; but making them too big + * won't cost a huge amount of memory, so we don't provide special + * extraction code like we did for JSAMPLE. (In other words, these + * typedefs live at a different point on the speed/space tradeoff curve.) + */ + +/* UINT8 must hold at least the values 0..255. */ + +typedef unsigned char UINT8; + +/* UINT16 must hold at least the values 0..65535. */ + +typedef unsigned short UINT16; + +/* INT16 must hold at least the values -32768..32767. */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ +typedef short INT16; +#endif + +/* INT32 must hold at least signed 32-bit values. + * + * NOTE: The INT32 typedef dates back to libjpeg v5 (1994.) Integers were + * sometimes 16-bit back then (MS-DOS), which is why INT32 is typedef'd to + * long. It also wasn't common (or at least as common) in 1994 for INT32 to be + * defined by platform headers. Since then, however, INT32 is defined in + * several other common places: + * + * Xmd.h (X11 header) typedefs INT32 to int on 64-bit platforms and long on + * 32-bit platforms (i.e always a 32-bit signed type.) + * + * basetsd.h (Win32 header) typedefs INT32 to int (always a 32-bit signed type + * on modern platforms.) + * + * qglobal.h (Qt header) typedefs INT32 to int (always a 32-bit signed type on + * modern platforms.) + * + * This is a recipe for conflict, since "long" and "int" aren't always + * compatible types. Since the definition of INT32 has technically been part + * of the libjpeg API for more than 20 years, we can't remove it, but we do not + * use it internally any longer. We instead define a separate type (JLONG) + * for internal use, which ensures that internal behavior will always be the + * same regardless of any external headers that may be included. + */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ +#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */ +#ifndef _BASETSD_H /* MinGW is slightly different */ +#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */ +typedef long INT32; +#endif +#endif +#endif +#endif + +/* Datatype used for image dimensions. The JPEG standard only supports + * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore + * "unsigned int" is sufficient on all machines. However, if you need to + * handle larger images and you don't mind deviating from the spec, you + * can change this datatype. (Note that changing this datatype will + * potentially require modifying the SIMD code. The x86-64 SIMD extensions, + * in particular, assume a 32-bit JDIMENSION.) + */ + +typedef unsigned int JDIMENSION; + +#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ + + +/* These macros are used in all function definitions and extern declarations. + * You could modify them if you need to change function linkage conventions; + * in particular, you'll need to do that to make the library a Windows DLL. + * Another application is to make all functions global for use with debuggers + * or code profilers that require it. + */ + +/* a function called through method pointers: */ +#define METHODDEF(type) static type +/* a function used only in its module: */ +#define LOCAL(type) static type +/* a function referenced thru EXTERNs: */ +#define GLOBAL(type) type +/* a reference to a GLOBAL function: */ +#define EXTERN(type) extern type + + +/* Originally, this macro was used as a way of defining function prototypes + * for both modern compilers as well as older compilers that did not support + * prototype parameters. libjpeg-turbo has never supported these older, + * non-ANSI compilers, but the macro is still included because there is some + * software out there that uses it. + */ + +#define JMETHOD(type, methodname, arglist) type (*methodname) arglist + + +/* libjpeg-turbo no longer supports platforms that have far symbols (MS-DOS), + * but again, some software relies on this macro. + */ + +#undef FAR +#define FAR + + +/* + * On a few systems, type boolean and/or its values FALSE, TRUE may appear + * in standard header files. Or you may have conflicts with application- + * specific header files that you want to include together with these files. + * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. + */ + +#ifndef HAVE_BOOLEAN +typedef int boolean; +#endif +#ifndef FALSE /* in case these macros already exist */ +#define FALSE 0 /* values of boolean */ +#endif +#ifndef TRUE +#define TRUE 1 +#endif + + +/* + * The remaining options affect code selection within the JPEG library, + * but they don't need to be visible to most applications using the library. + * To minimize application namespace pollution, the symbols won't be + * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. + */ + +#ifdef JPEG_INTERNALS +#define JPEG_INTERNAL_OPTIONS +#endif + +#ifdef JPEG_INTERNAL_OPTIONS + + +/* + * These defines indicate whether to include various optional functions. + * Undefining some of these symbols will produce a smaller but less capable + * library. Note that you can leave certain source files out of the + * compilation/linking process if you've #undef'd the corresponding symbols. + * (You may HAVE to do that if your compiler doesn't like null source files.) + */ + +/* Capability options common to encoder and decoder: */ + +#define DCT_ISLOW_SUPPORTED /* accurate integer method */ +#define DCT_IFAST_SUPPORTED /* less accurate int method [legacy feature] */ +#define DCT_FLOAT_SUPPORTED /* floating-point method [legacy feature] */ + +/* Encoder capability options: */ + +#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ +/* Note: if you selected 12-bit data precision, it is dangerous to turn off + * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit + * precision, so jchuff.c normally uses entropy optimization to compute + * usable tables for higher precision. If you don't want to do optimization, + * you'll have to supply different default Huffman tables. + * The exact same statements apply for progressive JPEG: the default tables + * don't work for progressive mode. (This may get fixed, however.) + */ +#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ + +/* Decoder capability options: */ + +#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ +#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ +#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ +#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ +#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ +#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ +#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ + +/* more capability options later, no doubt */ + + +/* + * The RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros are a vestigial + * feature of libjpeg. The idea was that, if an application developer needed + * to compress from/decompress to a BGR/BGRX/RGBX/XBGR/XRGB buffer, they could + * change these macros, rebuild libjpeg, and link their application statically + * with it. In reality, few people ever did this, because there were some + * severe restrictions involved (cjpeg and djpeg no longer worked properly, + * compressing/decompressing RGB JPEGs no longer worked properly, and the color + * quantizer wouldn't work with pixel sizes other than 3.) Furthermore, since + * all of the O/S-supplied versions of libjpeg were built with the default + * values of RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE, many applications + * have come to regard these values as immutable. + * + * The libjpeg-turbo colorspace extensions provide a much cleaner way of + * compressing from/decompressing to buffers with arbitrary component orders + * and pixel sizes. Thus, we do not support changing the values of RGB_RED, + * RGB_GREEN, RGB_BLUE, or RGB_PIXELSIZE. In addition to the restrictions + * listed above, changing these values will also break the SIMD extensions and + * the regression tests. + */ + +#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ +#define RGB_GREEN 1 /* Offset of Green */ +#define RGB_BLUE 2 /* Offset of Blue */ +#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ + +#define JPEG_NUMCS 17 + +#define EXT_RGB_RED 0 +#define EXT_RGB_GREEN 1 +#define EXT_RGB_BLUE 2 +#define EXT_RGB_PIXELSIZE 3 + +#define EXT_RGBX_RED 0 +#define EXT_RGBX_GREEN 1 +#define EXT_RGBX_BLUE 2 +#define EXT_RGBX_PIXELSIZE 4 + +#define EXT_BGR_RED 2 +#define EXT_BGR_GREEN 1 +#define EXT_BGR_BLUE 0 +#define EXT_BGR_PIXELSIZE 3 + +#define EXT_BGRX_RED 2 +#define EXT_BGRX_GREEN 1 +#define EXT_BGRX_BLUE 0 +#define EXT_BGRX_PIXELSIZE 4 + +#define EXT_XBGR_RED 3 +#define EXT_XBGR_GREEN 2 +#define EXT_XBGR_BLUE 1 +#define EXT_XBGR_PIXELSIZE 4 + +#define EXT_XRGB_RED 1 +#define EXT_XRGB_GREEN 2 +#define EXT_XRGB_BLUE 3 +#define EXT_XRGB_PIXELSIZE 4 + +static const int rgb_red[JPEG_NUMCS] = { + -1, -1, RGB_RED, -1, -1, -1, EXT_RGB_RED, EXT_RGBX_RED, + EXT_BGR_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED, + EXT_RGBX_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED, + -1 +}; + +static const int rgb_green[JPEG_NUMCS] = { + -1, -1, RGB_GREEN, -1, -1, -1, EXT_RGB_GREEN, EXT_RGBX_GREEN, + EXT_BGR_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN, + EXT_RGBX_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN, + -1 +}; + +static const int rgb_blue[JPEG_NUMCS] = { + -1, -1, RGB_BLUE, -1, -1, -1, EXT_RGB_BLUE, EXT_RGBX_BLUE, + EXT_BGR_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE, + EXT_RGBX_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE, + -1 +}; + +static const int rgb_pixelsize[JPEG_NUMCS] = { + -1, -1, RGB_PIXELSIZE, -1, -1, -1, EXT_RGB_PIXELSIZE, EXT_RGBX_PIXELSIZE, + EXT_BGR_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE, + EXT_RGBX_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE, + -1 +}; + +/* Definitions for speed-related optimizations. */ + +/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying + * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER + * as short on such a machine. MULTIPLIER must be at least 16 bits wide. + */ + +#ifndef MULTIPLIER +#ifndef WITH_SIMD +#define MULTIPLIER int /* type for fastest integer multiply */ +#else +#define MULTIPLIER short /* prefer 16-bit with SIMD for parellelism */ +#endif +#endif + + +/* FAST_FLOAT should be either float or double, whichever is done faster + * by your compiler. (Note that this type is only used in the floating point + * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) + */ + +#ifndef FAST_FLOAT +#define FAST_FLOAT float +#endif + +#endif /* JPEG_INTERNAL_OPTIONS */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpeg_nbits_table.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpeg_nbits_table.h new file mode 100644 index 0000000000000000000000000000000000000000..fcf73878c3188a549e01d020b587106729846f2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpeg_nbits_table.h @@ -0,0 +1,4098 @@ +static const unsigned char jpeg_nbits_table[65536] = { + 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpegcomp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpegcomp.h new file mode 100644 index 0000000000000000000000000000000000000000..c4834ac0df9dfcea43bcb1cdf5c10c3331b6a6b7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpegcomp.h @@ -0,0 +1,32 @@ +/* + * jpegcomp.h + * + * Copyright (C) 2010, 2020, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * JPEG compatibility macros + * These declarations are considered internal to the JPEG library; most + * applications using the library shouldn't need to include this file. + */ + +#if JPEG_LIB_VERSION >= 70 +#define _DCT_scaled_size DCT_h_scaled_size +#define _DCT_h_scaled_size DCT_h_scaled_size +#define _DCT_v_scaled_size DCT_v_scaled_size +#define _min_DCT_scaled_size min_DCT_h_scaled_size +#define _min_DCT_h_scaled_size min_DCT_h_scaled_size +#define _min_DCT_v_scaled_size min_DCT_v_scaled_size +#define _jpeg_width jpeg_width +#define _jpeg_height jpeg_height +#define JERR_ARITH_NOTIMPL JERR_NOT_COMPILED +#else +#define _DCT_scaled_size DCT_scaled_size +#define _DCT_h_scaled_size DCT_scaled_size +#define _DCT_v_scaled_size DCT_scaled_size +#define _min_DCT_scaled_size min_DCT_scaled_size +#define _min_DCT_h_scaled_size min_DCT_scaled_size +#define _min_DCT_v_scaled_size min_DCT_scaled_size +#define _jpeg_width image_width +#define _jpeg_height image_height +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpegint.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpegint.h new file mode 100644 index 0000000000000000000000000000000000000000..6af9e2a179e898c2f6bf2439923d8e2c6709b984 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpegint.h @@ -0,0 +1,375 @@ +/* + * jpegint.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1997, Thomas G. Lane. + * Modified 1997-2009 by Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2015-2016, 2019, 2021, D. R. Commander. + * Copyright (C) 2015, Google, Inc. + * Copyright (C) 2021, Alex Richardson. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file provides common declarations for the various JPEG modules. + * These declarations are considered internal to the JPEG library; most + * applications using the library shouldn't need to include this file. + */ + + +/* Declarations for both compression & decompression */ + +typedef enum { /* Operating modes for buffer controllers */ + JBUF_PASS_THRU, /* Plain stripwise operation */ + /* Remaining modes require a full-image buffer to have been created */ + JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ + JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ + JBUF_SAVE_AND_PASS /* Run both subobjects, save output */ +} J_BUF_MODE; + +/* Values of global_state field (jdapi.c has some dependencies on ordering!) */ +#define CSTATE_START 100 /* after create_compress */ +#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */ +#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */ +#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */ +#define DSTATE_START 200 /* after create_decompress */ +#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */ +#define DSTATE_READY 202 /* found SOS, ready for start_decompress */ +#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/ +#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */ +#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */ +#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */ +#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */ +#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */ +#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */ +#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */ + + +/* JLONG must hold at least signed 32-bit values. */ +typedef long JLONG; + +/* JUINTPTR must hold pointer values. */ +#ifdef __UINTPTR_TYPE__ +/* + * __UINTPTR_TYPE__ is GNU-specific and available in GCC 4.6+ and Clang 3.0+. + * Fortunately, that is sufficient to support the few architectures for which + * sizeof(void *) != sizeof(size_t). The only other options would require C99 + * or Clang-specific builtins. + */ +typedef __UINTPTR_TYPE__ JUINTPTR; +#else +typedef size_t JUINTPTR; +#endif + +/* + * Left shift macro that handles a negative operand without causing any + * sanitizer warnings + */ + +#define LEFT_SHIFT(a, b) ((JLONG)((unsigned long)(a) << (b))) + + +/* Declarations for compression modules */ + +/* Master control module */ +struct jpeg_comp_master { + void (*prepare_for_pass) (j_compress_ptr cinfo); + void (*pass_startup) (j_compress_ptr cinfo); + void (*finish_pass) (j_compress_ptr cinfo); + + /* State variables made visible to other modules */ + boolean call_pass_startup; /* True if pass_startup must be called */ + boolean is_last_pass; /* True during last pass */ +}; + +/* Main buffer control (downsampled-data buffer) */ +struct jpeg_c_main_controller { + void (*start_pass) (j_compress_ptr cinfo, J_BUF_MODE pass_mode); + void (*process_data) (j_compress_ptr cinfo, JSAMPARRAY input_buf, + JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail); +}; + +/* Compression preprocessing (downsampling input buffer control) */ +struct jpeg_c_prep_controller { + void (*start_pass) (j_compress_ptr cinfo, J_BUF_MODE pass_mode); + void (*pre_process_data) (j_compress_ptr cinfo, JSAMPARRAY input_buf, + JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, + JSAMPIMAGE output_buf, + JDIMENSION *out_row_group_ctr, + JDIMENSION out_row_groups_avail); +}; + +/* Coefficient buffer control */ +struct jpeg_c_coef_controller { + void (*start_pass) (j_compress_ptr cinfo, J_BUF_MODE pass_mode); + boolean (*compress_data) (j_compress_ptr cinfo, JSAMPIMAGE input_buf); +}; + +/* Colorspace conversion */ +struct jpeg_color_converter { + void (*start_pass) (j_compress_ptr cinfo); + void (*color_convert) (j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, JDIMENSION output_row, + int num_rows); +}; + +/* Downsampling */ +struct jpeg_downsampler { + void (*start_pass) (j_compress_ptr cinfo); + void (*downsample) (j_compress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_index, JSAMPIMAGE output_buf, + JDIMENSION out_row_group_index); + + boolean need_context_rows; /* TRUE if need rows above & below */ +}; + +/* Forward DCT (also controls coefficient quantization) */ +struct jpeg_forward_dct { + void (*start_pass) (j_compress_ptr cinfo); + /* perhaps this should be an array??? */ + void (*forward_DCT) (j_compress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, + JDIMENSION num_blocks); +}; + +/* Entropy encoding */ +struct jpeg_entropy_encoder { + void (*start_pass) (j_compress_ptr cinfo, boolean gather_statistics); + boolean (*encode_mcu) (j_compress_ptr cinfo, JBLOCKROW *MCU_data); + void (*finish_pass) (j_compress_ptr cinfo); +}; + +/* Marker writing */ +struct jpeg_marker_writer { + void (*write_file_header) (j_compress_ptr cinfo); + void (*write_frame_header) (j_compress_ptr cinfo); + void (*write_scan_header) (j_compress_ptr cinfo); + void (*write_file_trailer) (j_compress_ptr cinfo); + void (*write_tables_only) (j_compress_ptr cinfo); + /* These routines are exported to allow insertion of extra markers */ + /* Probably only COM and APPn markers should be written this way */ + void (*write_marker_header) (j_compress_ptr cinfo, int marker, + unsigned int datalen); + void (*write_marker_byte) (j_compress_ptr cinfo, int val); +}; + + +/* Declarations for decompression modules */ + +/* Master control module */ +struct jpeg_decomp_master { + void (*prepare_for_output_pass) (j_decompress_ptr cinfo); + void (*finish_output_pass) (j_decompress_ptr cinfo); + + /* State variables made visible to other modules */ + boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ + + /* Partial decompression variables */ + JDIMENSION first_iMCU_col; + JDIMENSION last_iMCU_col; + JDIMENSION first_MCU_col[MAX_COMPONENTS]; + JDIMENSION last_MCU_col[MAX_COMPONENTS]; + boolean jinit_upsampler_no_alloc; + + /* Last iMCU row that was successfully decoded */ + JDIMENSION last_good_iMCU_row; +}; + +/* Input control module */ +struct jpeg_input_controller { + int (*consume_input) (j_decompress_ptr cinfo); + void (*reset_input_controller) (j_decompress_ptr cinfo); + void (*start_input_pass) (j_decompress_ptr cinfo); + void (*finish_input_pass) (j_decompress_ptr cinfo); + + /* State variables made visible to other modules */ + boolean has_multiple_scans; /* True if file has multiple scans */ + boolean eoi_reached; /* True when EOI has been consumed */ +}; + +/* Main buffer control (downsampled-data buffer) */ +struct jpeg_d_main_controller { + void (*start_pass) (j_decompress_ptr cinfo, J_BUF_MODE pass_mode); + void (*process_data) (j_decompress_ptr cinfo, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); +}; + +/* Coefficient buffer control */ +struct jpeg_d_coef_controller { + void (*start_input_pass) (j_decompress_ptr cinfo); + int (*consume_data) (j_decompress_ptr cinfo); + void (*start_output_pass) (j_decompress_ptr cinfo); + int (*decompress_data) (j_decompress_ptr cinfo, JSAMPIMAGE output_buf); + /* Pointer to array of coefficient virtual arrays, or NULL if none */ + jvirt_barray_ptr *coef_arrays; +}; + +/* Decompression postprocessing (color quantization buffer control) */ +struct jpeg_d_post_controller { + void (*start_pass) (j_decompress_ptr cinfo, J_BUF_MODE pass_mode); + void (*post_process_data) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail); +}; + +/* Marker reading & parsing */ +struct jpeg_marker_reader { + void (*reset_marker_reader) (j_decompress_ptr cinfo); + /* Read markers until SOS or EOI. + * Returns same codes as are defined for jpeg_consume_input: + * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. + */ + int (*read_markers) (j_decompress_ptr cinfo); + /* Read a restart marker --- exported for use by entropy decoder only */ + jpeg_marker_parser_method read_restart_marker; + + /* State of marker reader --- nominally internal, but applications + * supplying COM or APPn handlers might like to know the state. + */ + boolean saw_SOI; /* found SOI? */ + boolean saw_SOF; /* found SOF? */ + int next_restart_num; /* next restart number expected (0-7) */ + unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */ +}; + +/* Entropy decoding */ +struct jpeg_entropy_decoder { + void (*start_pass) (j_decompress_ptr cinfo); + boolean (*decode_mcu) (j_decompress_ptr cinfo, JBLOCKROW *MCU_data); + + /* This is here to share code between baseline and progressive decoders; */ + /* other modules probably should not use it */ + boolean insufficient_data; /* set TRUE after emitting warning */ +}; + +/* Inverse DCT (also performs dequantization) */ +typedef void (*inverse_DCT_method_ptr) (j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col); + +struct jpeg_inverse_dct { + void (*start_pass) (j_decompress_ptr cinfo); + /* It is useful to allow each component to have a separate IDCT method. */ + inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; +}; + +/* Upsampling (note that upsampler must also call color converter) */ +struct jpeg_upsampler { + void (*start_pass) (j_decompress_ptr cinfo); + void (*upsample) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); + + boolean need_context_rows; /* TRUE if need rows above & below */ +}; + +/* Colorspace conversion */ +struct jpeg_color_deconverter { + void (*start_pass) (j_decompress_ptr cinfo); + void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows); +}; + +/* Color quantization or color precision reduction */ +struct jpeg_color_quantizer { + void (*start_pass) (j_decompress_ptr cinfo, boolean is_pre_scan); + void (*color_quantize) (j_decompress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPARRAY output_buf, int num_rows); + void (*finish_pass) (j_decompress_ptr cinfo); + void (*new_color_map) (j_decompress_ptr cinfo); +}; + + +/* Miscellaneous useful macros */ + +#undef MAX +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#undef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + + +/* We assume that right shift corresponds to signed division by 2 with + * rounding towards minus infinity. This is correct for typical "arithmetic + * shift" instructions that shift in copies of the sign bit. But some + * C compilers implement >> with an unsigned shift. For these machines you + * must define RIGHT_SHIFT_IS_UNSIGNED. + * RIGHT_SHIFT provides a proper signed right shift of a JLONG quantity. + * It is only applied with constant shift counts. SHIFT_TEMPS must be + * included in the variables of any routine using RIGHT_SHIFT. + */ + +#ifdef RIGHT_SHIFT_IS_UNSIGNED +#define SHIFT_TEMPS JLONG shift_temp; +#define RIGHT_SHIFT(x, shft) \ + ((shift_temp = (x)) < 0 ? \ + (shift_temp >> (shft)) | ((~((JLONG)0)) << (32 - (shft))) : \ + (shift_temp >> (shft))) +#else +#define SHIFT_TEMPS +#define RIGHT_SHIFT(x, shft) ((x) >> (shft)) +#endif + + +/* Compression module initialization routines */ +EXTERN(void) jinit_compress_master(j_compress_ptr cinfo); +EXTERN(void) jinit_c_master_control(j_compress_ptr cinfo, + boolean transcode_only); +EXTERN(void) jinit_c_main_controller(j_compress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_c_prep_controller(j_compress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_c_coef_controller(j_compress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_color_converter(j_compress_ptr cinfo); +EXTERN(void) jinit_downsampler(j_compress_ptr cinfo); +EXTERN(void) jinit_forward_dct(j_compress_ptr cinfo); +EXTERN(void) jinit_huff_encoder(j_compress_ptr cinfo); +EXTERN(void) jinit_phuff_encoder(j_compress_ptr cinfo); +EXTERN(void) jinit_arith_encoder(j_compress_ptr cinfo); +EXTERN(void) jinit_marker_writer(j_compress_ptr cinfo); +/* Decompression module initialization routines */ +EXTERN(void) jinit_master_decompress(j_decompress_ptr cinfo); +EXTERN(void) jinit_d_main_controller(j_decompress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_d_coef_controller(j_decompress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_d_post_controller(j_decompress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_input_controller(j_decompress_ptr cinfo); +EXTERN(void) jinit_marker_reader(j_decompress_ptr cinfo); +EXTERN(void) jinit_huff_decoder(j_decompress_ptr cinfo); +EXTERN(void) jinit_phuff_decoder(j_decompress_ptr cinfo); +EXTERN(void) jinit_arith_decoder(j_decompress_ptr cinfo); +EXTERN(void) jinit_inverse_dct(j_decompress_ptr cinfo); +EXTERN(void) jinit_upsampler(j_decompress_ptr cinfo); +EXTERN(void) jinit_color_deconverter(j_decompress_ptr cinfo); +EXTERN(void) jinit_1pass_quantizer(j_decompress_ptr cinfo); +EXTERN(void) jinit_2pass_quantizer(j_decompress_ptr cinfo); +EXTERN(void) jinit_merged_upsampler(j_decompress_ptr cinfo); +/* Memory manager initialization */ +EXTERN(void) jinit_memory_mgr(j_common_ptr cinfo); + +/* Utility routines in jutils.c */ +EXTERN(long) jdiv_round_up(long a, long b); +EXTERN(long) jround_up(long a, long b); +EXTERN(void) jcopy_sample_rows(JSAMPARRAY input_array, int source_row, + JSAMPARRAY output_array, int dest_row, + int num_rows, JDIMENSION num_cols); +EXTERN(void) jcopy_block_row(JBLOCKROW input_row, JBLOCKROW output_row, + JDIMENSION num_blocks); +EXTERN(void) jzero_far(void *target, size_t bytestozero); +/* Constant tables in jutils.c */ +#if 0 /* This table is not actually needed in v6a */ +extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ +#endif +extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ + +/* Arithmetic coding probability estimation tables in jaricom.c */ +extern const JLONG jpeg_aritab[]; diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpeglib.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpeglib.h new file mode 100644 index 0000000000000000000000000000000000000000..d7664f063092ea2504fc128887815a7c58154d34 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jpeglib.h @@ -0,0 +1,1132 @@ +/* + * jpeglib.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1998, Thomas G. Lane. + * Modified 2002-2009 by Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2009-2011, 2013-2014, 2016-2017, 2020, D. R. Commander. + * Copyright (C) 2015, Google, Inc. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file defines the application interface for the JPEG library. + * Most applications using the library need only include this file, + * and perhaps jerror.h if they want to know the exact error codes. + */ + +#ifndef JPEGLIB_H +#define JPEGLIB_H + +/* + * First we include the configuration files that record how this + * installation of the JPEG library is set up. jconfig.h can be + * generated automatically for many systems. jmorecfg.h contains + * manual configuration options that most people need not worry about. + */ + +#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ +#include "jconfig.h" /* widely used configuration options */ +#endif +#include "jmorecfg.h" /* seldom changed options */ + + +#ifdef __cplusplus +#ifndef DONT_USE_EXTERN_C +extern "C" { +#endif +#endif + + +/* Various constants determining the sizes of things. + * All of these are specified by the JPEG standard, so don't change them + * if you want to be compatible. + */ + +#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ +#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ +#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ +#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ +#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ +#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ +#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ +/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; + * the PostScript DCT filter can emit files with many more than 10 blocks/MCU. + * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU + * to handle it. We even let you do this from the jconfig.h file. However, + * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe + * sometimes emits noncompliant files doesn't mean you should too. + */ +#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */ +#ifndef D_MAX_BLOCKS_IN_MCU +#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */ +#endif + + +/* Data structures for images (arrays of samples and of DCT coefficients). + */ + +typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples. */ +typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ +typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ + +typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ +typedef JBLOCK *JBLOCKROW; /* pointer to one row of coefficient blocks */ +typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ +typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ + +typedef JCOEF *JCOEFPTR; /* useful in a couple of places */ + + +/* Types for JPEG compression parameters and working tables. */ + + +/* DCT coefficient quantization tables. */ + +typedef struct { + /* This array gives the coefficient quantizers in natural array order + * (not the zigzag order in which they are stored in a JPEG DQT marker). + * CAUTION: IJG versions prior to v6a kept this array in zigzag order. + */ + UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JQUANT_TBL; + + +/* Huffman coding tables. */ + +typedef struct { + /* These two fields directly represent the contents of a JPEG DHT marker */ + UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ + /* length k bits; bits[0] is unused */ + UINT8 huffval[256]; /* The symbols, in order of incr code length */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JHUFF_TBL; + + +/* Basic info about one component (color channel). */ + +typedef struct { + /* These values are fixed over the whole image. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOF marker. */ + int component_id; /* identifier for this component (0..255) */ + int component_index; /* its index in SOF or cinfo->comp_info[] */ + int h_samp_factor; /* horizontal sampling factor (1..4) */ + int v_samp_factor; /* vertical sampling factor (1..4) */ + int quant_tbl_no; /* quantization table selector (0..3) */ + /* These values may vary between scans. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOS marker. */ + /* The decompressor output side may not use these variables. */ + int dc_tbl_no; /* DC entropy table selector (0..3) */ + int ac_tbl_no; /* AC entropy table selector (0..3) */ + + /* Remaining fields should be treated as private by applications. */ + + /* These values are computed during compression or decompression startup: */ + /* Component's size in DCT blocks. + * Any dummy blocks added to complete an MCU are not counted; therefore + * these values do not depend on whether a scan is interleaved or not. + */ + JDIMENSION width_in_blocks; + JDIMENSION height_in_blocks; + /* Size of a DCT block in samples. Always DCTSIZE for compression. + * For decompression this is the size of the output from one DCT block, + * reflecting any scaling we choose to apply during the IDCT step. + * Values from 1 to 16 are supported. + * Note that different components may receive different IDCT scalings. + */ +#if JPEG_LIB_VERSION >= 70 + int DCT_h_scaled_size; + int DCT_v_scaled_size; +#else + int DCT_scaled_size; +#endif + /* The downsampled dimensions are the component's actual, unpadded number + * of samples at the main buffer (preprocessing/compression interface), thus + * downsampled_width = ceil(image_width * Hi/Hmax) + * and similarly for height. For decompression, IDCT scaling is included, so + * downsampled_width = ceil(image_width * Hi/Hmax * DCT_[h_]scaled_size/DCTSIZE) + */ + JDIMENSION downsampled_width; /* actual width in samples */ + JDIMENSION downsampled_height; /* actual height in samples */ + /* This flag is used only for decompression. In cases where some of the + * components will be ignored (eg grayscale output from YCbCr image), + * we can skip most computations for the unused components. + */ + boolean component_needed; /* do we need the value of this component? */ + + /* These values are computed before starting a scan of the component. */ + /* The decompressor output side may not use these variables. */ + int MCU_width; /* number of blocks per MCU, horizontally */ + int MCU_height; /* number of blocks per MCU, vertically */ + int MCU_blocks; /* MCU_width * MCU_height */ + int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_[h_]scaled_size */ + int last_col_width; /* # of non-dummy blocks across in last MCU */ + int last_row_height; /* # of non-dummy blocks down in last MCU */ + + /* Saved quantization table for component; NULL if none yet saved. + * See jdinput.c comments about the need for this information. + * This field is currently used only for decompression. + */ + JQUANT_TBL *quant_table; + + /* Private per-component storage for DCT or IDCT subsystem. */ + void *dct_table; +} jpeg_component_info; + + +/* The script for encoding a multiple-scan file is an array of these: */ + +typedef struct { + int comps_in_scan; /* number of components encoded in this scan */ + int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ + int Ss, Se; /* progressive JPEG spectral selection parms */ + int Ah, Al; /* progressive JPEG successive approx. parms */ +} jpeg_scan_info; + +/* The decompressor can save APPn and COM markers in a list of these: */ + +typedef struct jpeg_marker_struct *jpeg_saved_marker_ptr; + +struct jpeg_marker_struct { + jpeg_saved_marker_ptr next; /* next in list, or NULL */ + UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ + unsigned int original_length; /* # bytes of data in the file */ + unsigned int data_length; /* # bytes of data saved at data[] */ + JOCTET *data; /* the data contained in the marker */ + /* the marker length word is not counted in data_length or original_length */ +}; + +/* Known color spaces. */ + +#define JCS_EXTENSIONS 1 +#define JCS_ALPHA_EXTENSIONS 1 + +typedef enum { + JCS_UNKNOWN, /* error/unspecified */ + JCS_GRAYSCALE, /* monochrome */ + JCS_RGB, /* red/green/blue as specified by the RGB_RED, + RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros */ + JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ + JCS_CMYK, /* C/M/Y/K */ + JCS_YCCK, /* Y/Cb/Cr/K */ + JCS_EXT_RGB, /* red/green/blue */ + JCS_EXT_RGBX, /* red/green/blue/x */ + JCS_EXT_BGR, /* blue/green/red */ + JCS_EXT_BGRX, /* blue/green/red/x */ + JCS_EXT_XBGR, /* x/blue/green/red */ + JCS_EXT_XRGB, /* x/red/green/blue */ + /* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX, JCS_EXT_XBGR, + or JCS_EXT_XRGB during decompression, the X byte is undefined, and in + order to ensure the best performance, libjpeg-turbo can set that byte to + whatever value it wishes. Use the following colorspace constants to + ensure that the X byte is set to 0xFF, so that it can be interpreted as an + opaque alpha channel. */ + JCS_EXT_RGBA, /* red/green/blue/alpha */ + JCS_EXT_BGRA, /* blue/green/red/alpha */ + JCS_EXT_ABGR, /* alpha/blue/green/red */ + JCS_EXT_ARGB, /* alpha/red/green/blue */ + JCS_RGB565 /* 5-bit red/6-bit green/5-bit blue */ +} J_COLOR_SPACE; + +/* DCT/IDCT algorithm options. */ + +typedef enum { + JDCT_ISLOW, /* accurate integer method */ + JDCT_IFAST, /* less accurate integer method [legacy feature] */ + JDCT_FLOAT /* floating-point method [legacy feature] */ +} J_DCT_METHOD; + +#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ +#define JDCT_DEFAULT JDCT_ISLOW +#endif +#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ +#define JDCT_FASTEST JDCT_IFAST +#endif + +/* Dithering options for decompression. */ + +typedef enum { + JDITHER_NONE, /* no dithering */ + JDITHER_ORDERED, /* simple ordered dither */ + JDITHER_FS /* Floyd-Steinberg error diffusion dither */ +} J_DITHER_MODE; + + +/* Common fields between JPEG compression and decompression master structs. */ + +#define jpeg_common_fields \ + struct jpeg_error_mgr *err; /* Error handler module */ \ + struct jpeg_memory_mgr *mem; /* Memory manager module */ \ + struct jpeg_progress_mgr *progress; /* Progress monitor, or NULL if none */ \ + void *client_data; /* Available for use by application */ \ + boolean is_decompressor; /* So common code can tell which is which */ \ + int global_state /* For checking call sequence validity */ + +/* Routines that are to be used by both halves of the library are declared + * to receive a pointer to this structure. There are no actual instances of + * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. + */ +struct jpeg_common_struct { + jpeg_common_fields; /* Fields common to both master struct types */ + /* Additional fields follow in an actual jpeg_compress_struct or + * jpeg_decompress_struct. All three structs must agree on these + * initial fields! (This would be a lot cleaner in C++.) + */ +}; + +typedef struct jpeg_common_struct *j_common_ptr; +typedef struct jpeg_compress_struct *j_compress_ptr; +typedef struct jpeg_decompress_struct *j_decompress_ptr; + + +/* Master record for a compression instance */ + +struct jpeg_compress_struct { + jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ + + /* Destination for compressed data */ + struct jpeg_destination_mgr *dest; + + /* Description of source image --- these fields must be filled in by + * outer application before starting compression. in_color_space must + * be correct before you can even call jpeg_set_defaults(). + */ + + JDIMENSION image_width; /* input image width */ + JDIMENSION image_height; /* input image height */ + int input_components; /* # of color components in input image */ + J_COLOR_SPACE in_color_space; /* colorspace of input image */ + + double input_gamma; /* image gamma of input image */ + + /* Compression parameters --- these fields must be set before calling + * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to + * initialize everything to reasonable defaults, then changing anything + * the application specifically wants to change. That way you won't get + * burnt when new parameters are added. Also note that there are several + * helper routines to simplify changing parameters. + */ + +#if JPEG_LIB_VERSION >= 70 + unsigned int scale_num, scale_denom; /* fraction by which to scale image */ + + JDIMENSION jpeg_width; /* scaled JPEG image width */ + JDIMENSION jpeg_height; /* scaled JPEG image height */ + /* Dimensions of actual JPEG image that will be written to file, + * derived from input dimensions by scaling factors above. + * These fields are computed by jpeg_start_compress(). + * You can also use jpeg_calc_jpeg_dimensions() to determine these values + * in advance of calling jpeg_start_compress(). + */ +#endif + + int data_precision; /* bits of precision in image data */ + + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + jpeg_component_info *comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + JQUANT_TBL *quant_tbl_ptrs[NUM_QUANT_TBLS]; +#if JPEG_LIB_VERSION >= 70 + int q_scale_factor[NUM_QUANT_TBLS]; +#endif + /* ptrs to coefficient quantization tables, or NULL if not defined, + * and corresponding scale factors (percentage, initialized 100). + */ + + JHUFF_TBL *dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL *ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + int num_scans; /* # of entries in scan_info array */ + const jpeg_scan_info *scan_info; /* script for multi-scan file, or NULL */ + /* The default value of scan_info is NULL, which causes a single-scan + * sequential JPEG file to be emitted. To create a multi-scan file, + * set num_scans and scan_info to point to an array of scan definitions. + */ + + boolean raw_data_in; /* TRUE=caller supplies downsampled data */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ +#if JPEG_LIB_VERSION >= 70 + boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */ +#endif + int smoothing_factor; /* 1..100, or 0 for no input smoothing */ + J_DCT_METHOD dct_method; /* DCT algorithm selector */ + + /* The restart interval can be specified in absolute MCUs by setting + * restart_interval, or in MCU rows by setting restart_in_rows + * (in which case the correct restart_interval will be figured + * for each scan). + */ + unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ + int restart_in_rows; /* if > 0, MCU rows per restart interval */ + + /* Parameters controlling emission of special markers. */ + + boolean write_JFIF_header; /* should a JFIF marker be written? */ + UINT8 JFIF_major_version; /* What to write for the JFIF version number */ + UINT8 JFIF_minor_version; + /* These three values are not used by the JPEG code, merely copied */ + /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ + /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ + /* ratio is defined by X_density/Y_density even when density_unit=0. */ + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean write_Adobe_marker; /* should an Adobe marker be written? */ + + /* State variable: index of next scanline to be written to + * jpeg_write_scanlines(). Application may use this to control its + * processing loop, e.g., "while (next_scanline < image_height)". + */ + + JDIMENSION next_scanline; /* 0 .. image_height-1 */ + + /* Remaining fields are known throughout compressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during compression startup + */ + boolean progressive_mode; /* TRUE if scan script uses progressive mode */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + +#if JPEG_LIB_VERSION >= 70 + int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ + int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ +#endif + + JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ + /* The coefficient controller receives data in units of MCU rows as defined + * for fully interleaved scans (whether the JPEG file is interleaved or not). + * There are v_samp_factor * DCTSIZE sample rows of each component in an + * "iMCU" (interleaved MCU) row. + */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info *cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[C_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + +#if JPEG_LIB_VERSION >= 80 + int block_size; /* the basic DCT block size: 1..16 */ + const int *natural_order; /* natural-order position array */ + int lim_Se; /* min( Se, DCTSIZE2-1 ) */ +#endif + + /* + * Links to compression subobjects (methods and private variables of modules) + */ + struct jpeg_comp_master *master; + struct jpeg_c_main_controller *main; + struct jpeg_c_prep_controller *prep; + struct jpeg_c_coef_controller *coef; + struct jpeg_marker_writer *marker; + struct jpeg_color_converter *cconvert; + struct jpeg_downsampler *downsample; + struct jpeg_forward_dct *fdct; + struct jpeg_entropy_encoder *entropy; + jpeg_scan_info *script_space; /* workspace for jpeg_simple_progression */ + int script_space_size; +}; + + +/* Master record for a decompression instance */ + +struct jpeg_decompress_struct { + jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ + + /* Source of compressed data */ + struct jpeg_source_mgr *src; + + /* Basic description of image --- filled in by jpeg_read_header(). */ + /* Application may inspect these values to decide how to process image. */ + + JDIMENSION image_width; /* nominal image width (from SOF marker) */ + JDIMENSION image_height; /* nominal image height */ + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + /* Decompression processing parameters --- these fields must be set before + * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes + * them to default values. + */ + + J_COLOR_SPACE out_color_space; /* colorspace for output */ + + unsigned int scale_num, scale_denom; /* fraction by which to scale image */ + + double output_gamma; /* image gamma wanted in output */ + + boolean buffered_image; /* TRUE=multiple output passes */ + boolean raw_data_out; /* TRUE=downsampled data wanted */ + + J_DCT_METHOD dct_method; /* IDCT algorithm selector */ + boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ + boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ + + boolean quantize_colors; /* TRUE=colormapped output wanted */ + /* the following are ignored if not quantize_colors: */ + J_DITHER_MODE dither_mode; /* type of color dithering to use */ + boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ + int desired_number_of_colors; /* max # colors to use in created colormap */ + /* these are significant only in buffered-image mode: */ + boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ + boolean enable_external_quant;/* enable future use of external colormap */ + boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ + + /* Description of actual output image that will be returned to application. + * These fields are computed by jpeg_start_decompress(). + * You can also use jpeg_calc_output_dimensions() to determine these values + * in advance of calling jpeg_start_decompress(). + */ + + JDIMENSION output_width; /* scaled image width */ + JDIMENSION output_height; /* scaled image height */ + int out_color_components; /* # of color components in out_color_space */ + int output_components; /* # of color components returned */ + /* output_components is 1 (a colormap index) when quantizing colors; + * otherwise it equals out_color_components. + */ + int rec_outbuf_height; /* min recommended height of scanline buffer */ + /* If the buffer passed to jpeg_read_scanlines() is less than this many rows + * high, space and time will be wasted due to unnecessary data copying. + * Usually rec_outbuf_height will be 1 or 2, at most 4. + */ + + /* When quantizing colors, the output colormap is described by these fields. + * The application can supply a colormap by setting colormap non-NULL before + * calling jpeg_start_decompress; otherwise a colormap is created during + * jpeg_start_decompress or jpeg_start_output. + * The map has out_color_components rows and actual_number_of_colors columns. + */ + int actual_number_of_colors; /* number of entries in use */ + JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ + + /* State variables: these variables indicate the progress of decompression. + * The application may examine these but must not modify them. + */ + + /* Row index of next scanline to be read from jpeg_read_scanlines(). + * Application may use this to control its processing loop, e.g., + * "while (output_scanline < output_height)". + */ + JDIMENSION output_scanline; /* 0 .. output_height-1 */ + + /* Current input scan number and number of iMCU rows completed in scan. + * These indicate the progress of the decompressor input side. + */ + int input_scan_number; /* Number of SOS markers seen so far */ + JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ + + /* The "output scan number" is the notional scan being displayed by the + * output side. The decompressor will not allow output scan/row number + * to get ahead of input scan/row, but it can fall arbitrarily far behind. + */ + int output_scan_number; /* Nominal scan number being displayed */ + JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ + + /* Current progression status. coef_bits[c][i] indicates the precision + * with which component c's DCT coefficient i (in zigzag order) is known. + * It is -1 when no data has yet been received, otherwise it is the point + * transform (shift) value for the most recent scan of the coefficient + * (thus, 0 at completion of the progression). + * This pointer is NULL when reading a non-progressive file. + */ + int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ + + /* Internal JPEG parameters --- the application usually need not look at + * these fields. Note that the decompressor output side may not use + * any parameters that can change between scans. + */ + + /* Quantization and Huffman tables are carried forward across input + * datastreams when processing abbreviated JPEG datastreams. + */ + + JQUANT_TBL *quant_tbl_ptrs[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined */ + + JHUFF_TBL *dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL *ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + /* These parameters are never carried across datastreams, since they + * are given in SOF/SOS markers or defined to be reset by SOI. + */ + + int data_precision; /* bits of precision in image data */ + + jpeg_component_info *comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + +#if JPEG_LIB_VERSION >= 80 + boolean is_baseline; /* TRUE if Baseline SOF0 encountered */ +#endif + boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ + + /* These fields record data obtained from optional markers recognized by + * the JPEG library. + */ + boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ + /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ + UINT8 JFIF_major_version; /* JFIF version number */ + UINT8 JFIF_minor_version; + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ + UINT8 Adobe_transform; /* Color transform code from Adobe marker */ + + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + + /* Aside from the specific data retained from APPn markers known to the + * library, the uninterpreted contents of any or all APPn and COM markers + * can be saved in a list for examination by the application. + */ + jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ + + /* Remaining fields are known throughout decompressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during decompression startup + */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + +#if JPEG_LIB_VERSION >= 70 + int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ + int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ +#else + int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ +#endif + + JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ + /* The coefficient controller's input and output progress is measured in + * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows + * in fully interleaved JPEG scans, but are used whether the scan is + * interleaved or not. We define an iMCU row as v_samp_factor DCT block + * rows of each component. Therefore, the IDCT output contains + * v_samp_factor*DCT_[v_]scaled_size sample rows of a component per iMCU row. + */ + + JSAMPLE *sample_range_limit; /* table for fast range-limiting */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + * Note that the decompressor output side must not use these fields. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info *cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[D_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + +#if JPEG_LIB_VERSION >= 80 + /* These fields are derived from Se of first SOS marker. + */ + int block_size; /* the basic DCT block size: 1..16 */ + const int *natural_order; /* natural-order position array for entropy decode */ + int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */ +#endif + + /* This field is shared between entropy decoder and marker parser. + * It is either zero or the code of a JPEG marker that has been + * read from the data source, but has not yet been processed. + */ + int unread_marker; + + /* + * Links to decompression subobjects (methods, private variables of modules) + */ + struct jpeg_decomp_master *master; + struct jpeg_d_main_controller *main; + struct jpeg_d_coef_controller *coef; + struct jpeg_d_post_controller *post; + struct jpeg_input_controller *inputctl; + struct jpeg_marker_reader *marker; + struct jpeg_entropy_decoder *entropy; + struct jpeg_inverse_dct *idct; + struct jpeg_upsampler *upsample; + struct jpeg_color_deconverter *cconvert; + struct jpeg_color_quantizer *cquantize; +}; + + +/* "Object" declarations for JPEG modules that may be supplied or called + * directly by the surrounding application. + * As with all objects in the JPEG library, these structs only define the + * publicly visible methods and state variables of a module. Additional + * private fields may exist after the public ones. + */ + + +/* Error handler object */ + +struct jpeg_error_mgr { + /* Error exit handler: does not return to caller */ + void (*error_exit) (j_common_ptr cinfo); + /* Conditionally emit a trace or warning message */ + void (*emit_message) (j_common_ptr cinfo, int msg_level); + /* Routine that actually outputs a trace or error message */ + void (*output_message) (j_common_ptr cinfo); + /* Format a message string for the most recent JPEG error or message */ + void (*format_message) (j_common_ptr cinfo, char *buffer); +#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ + /* Reset error state variables at start of a new image */ + void (*reset_error_mgr) (j_common_ptr cinfo); + + /* The message ID code and any parameters are saved here. + * A message can have one string parameter or up to 8 int parameters. + */ + int msg_code; +#define JMSG_STR_PARM_MAX 80 + union { + int i[8]; + char s[JMSG_STR_PARM_MAX]; + } msg_parm; + + /* Standard state variables for error facility */ + + int trace_level; /* max msg_level that will be displayed */ + + /* For recoverable corrupt-data errors, we emit a warning message, + * but keep going unless emit_message chooses to abort. emit_message + * should count warnings in num_warnings. The surrounding application + * can check for bad data by seeing if num_warnings is nonzero at the + * end of processing. + */ + long num_warnings; /* number of corrupt-data warnings */ + + /* These fields point to the table(s) of error message strings. + * An application can change the table pointer to switch to a different + * message list (typically, to change the language in which errors are + * reported). Some applications may wish to add additional error codes + * that will be handled by the JPEG library error mechanism; the second + * table pointer is used for this purpose. + * + * First table includes all errors generated by JPEG library itself. + * Error code 0 is reserved for a "no such error string" message. + */ + const char * const *jpeg_message_table; /* Library errors */ + int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ + /* Second table can be added by application (see cjpeg/djpeg for example). + * It contains strings numbered first_addon_message..last_addon_message. + */ + const char * const *addon_message_table; /* Non-library errors */ + int first_addon_message; /* code for first string in addon table */ + int last_addon_message; /* code for last string in addon table */ +}; + + +/* Progress monitor object */ + +struct jpeg_progress_mgr { + void (*progress_monitor) (j_common_ptr cinfo); + + long pass_counter; /* work units completed in this pass */ + long pass_limit; /* total number of work units in this pass */ + int completed_passes; /* passes completed so far */ + int total_passes; /* total number of passes expected */ +}; + + +/* Data destination object for compression */ + +struct jpeg_destination_mgr { + JOCTET *next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + + void (*init_destination) (j_compress_ptr cinfo); + boolean (*empty_output_buffer) (j_compress_ptr cinfo); + void (*term_destination) (j_compress_ptr cinfo); +}; + + +/* Data source object for decompression */ + +struct jpeg_source_mgr { + const JOCTET *next_input_byte; /* => next byte to read from buffer */ + size_t bytes_in_buffer; /* # of bytes remaining in buffer */ + + void (*init_source) (j_decompress_ptr cinfo); + boolean (*fill_input_buffer) (j_decompress_ptr cinfo); + void (*skip_input_data) (j_decompress_ptr cinfo, long num_bytes); + boolean (*resync_to_restart) (j_decompress_ptr cinfo, int desired); + void (*term_source) (j_decompress_ptr cinfo); +}; + + +/* Memory manager object. + * Allocates "small" objects (a few K total), "large" objects (tens of K), + * and "really big" objects (virtual arrays with backing store if needed). + * The memory manager does not allow individual objects to be freed; rather, + * each created object is assigned to a pool, and whole pools can be freed + * at once. This is faster and more convenient than remembering exactly what + * to free, especially where malloc()/free() are not too speedy. + * NB: alloc routines never return NULL. They exit to error_exit if not + * successful. + */ + +#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ +#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ +#define JPOOL_NUMPOOLS 2 + +typedef struct jvirt_sarray_control *jvirt_sarray_ptr; +typedef struct jvirt_barray_control *jvirt_barray_ptr; + + +struct jpeg_memory_mgr { + /* Method pointers */ + void *(*alloc_small) (j_common_ptr cinfo, int pool_id, size_t sizeofobject); + void *(*alloc_large) (j_common_ptr cinfo, int pool_id, + size_t sizeofobject); + JSAMPARRAY (*alloc_sarray) (j_common_ptr cinfo, int pool_id, + JDIMENSION samplesperrow, JDIMENSION numrows); + JBLOCKARRAY (*alloc_barray) (j_common_ptr cinfo, int pool_id, + JDIMENSION blocksperrow, JDIMENSION numrows); + jvirt_sarray_ptr (*request_virt_sarray) (j_common_ptr cinfo, int pool_id, + boolean pre_zero, + JDIMENSION samplesperrow, + JDIMENSION numrows, + JDIMENSION maxaccess); + jvirt_barray_ptr (*request_virt_barray) (j_common_ptr cinfo, int pool_id, + boolean pre_zero, + JDIMENSION blocksperrow, + JDIMENSION numrows, + JDIMENSION maxaccess); + void (*realize_virt_arrays) (j_common_ptr cinfo); + JSAMPARRAY (*access_virt_sarray) (j_common_ptr cinfo, jvirt_sarray_ptr ptr, + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable); + JBLOCKARRAY (*access_virt_barray) (j_common_ptr cinfo, jvirt_barray_ptr ptr, + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable); + void (*free_pool) (j_common_ptr cinfo, int pool_id); + void (*self_destruct) (j_common_ptr cinfo); + + /* Limit on memory allocation for this JPEG object. (Note that this is + * merely advisory, not a guaranteed maximum; it only affects the space + * used for virtual-array buffers.) May be changed by outer application + * after creating the JPEG object. + */ + long max_memory_to_use; + + /* Maximum allocation request accepted by alloc_large. */ + long max_alloc_chunk; +}; + + +/* Routine signature for application-supplied marker processing methods. + * Need not pass marker code since it is stored in cinfo->unread_marker. + */ +typedef boolean (*jpeg_marker_parser_method) (j_decompress_ptr cinfo); + + +/* Originally, this macro was used as a way of defining function prototypes + * for both modern compilers as well as older compilers that did not support + * prototype parameters. libjpeg-turbo has never supported these older, + * non-ANSI compilers, but the macro is still included because there is some + * software out there that uses it. + */ + +#define JPP(arglist) arglist + + +/* Default error-management setup */ +EXTERN(struct jpeg_error_mgr *) jpeg_std_error(struct jpeg_error_mgr *err); + +/* Initialization of JPEG compression objects. + * jpeg_create_compress() and jpeg_create_decompress() are the exported + * names that applications should call. These expand to calls on + * jpeg_CreateCompress and jpeg_CreateDecompress with additional information + * passed for version mismatch checking. + * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. + */ +#define jpeg_create_compress(cinfo) \ + jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ + (size_t)sizeof(struct jpeg_compress_struct)) +#define jpeg_create_decompress(cinfo) \ + jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ + (size_t)sizeof(struct jpeg_decompress_struct)) +EXTERN(void) jpeg_CreateCompress(j_compress_ptr cinfo, int version, + size_t structsize); +EXTERN(void) jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, + size_t structsize); +/* Destruction of JPEG compression objects */ +EXTERN(void) jpeg_destroy_compress(j_compress_ptr cinfo); +EXTERN(void) jpeg_destroy_decompress(j_decompress_ptr cinfo); + +/* Standard data source and destination managers: stdio streams. */ +/* Caller is responsible for opening the file before and closing after. */ +EXTERN(void) jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile); +EXTERN(void) jpeg_stdio_src(j_decompress_ptr cinfo, FILE *infile); + +#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) +/* Data source and destination managers: memory buffers. */ +EXTERN(void) jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer, + unsigned long *outsize); +EXTERN(void) jpeg_mem_src(j_decompress_ptr cinfo, + const unsigned char *inbuffer, unsigned long insize); +#endif + +/* Default parameter setup for compression */ +EXTERN(void) jpeg_set_defaults(j_compress_ptr cinfo); +/* Compression parameter setup aids */ +EXTERN(void) jpeg_set_colorspace(j_compress_ptr cinfo, + J_COLOR_SPACE colorspace); +EXTERN(void) jpeg_default_colorspace(j_compress_ptr cinfo); +EXTERN(void) jpeg_set_quality(j_compress_ptr cinfo, int quality, + boolean force_baseline); +EXTERN(void) jpeg_set_linear_quality(j_compress_ptr cinfo, int scale_factor, + boolean force_baseline); +#if JPEG_LIB_VERSION >= 70 +EXTERN(void) jpeg_default_qtables(j_compress_ptr cinfo, + boolean force_baseline); +#endif +EXTERN(void) jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl, + const unsigned int *basic_table, + int scale_factor, boolean force_baseline); +EXTERN(int) jpeg_quality_scaling(int quality); +EXTERN(void) jpeg_simple_progression(j_compress_ptr cinfo); +EXTERN(void) jpeg_suppress_tables(j_compress_ptr cinfo, boolean suppress); +EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table(j_common_ptr cinfo); +EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table(j_common_ptr cinfo); + +/* Main entry points for compression */ +EXTERN(void) jpeg_start_compress(j_compress_ptr cinfo, + boolean write_all_tables); +EXTERN(JDIMENSION) jpeg_write_scanlines(j_compress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION num_lines); +EXTERN(void) jpeg_finish_compress(j_compress_ptr cinfo); + +#if JPEG_LIB_VERSION >= 70 +/* Precalculate JPEG dimensions for current compression parameters. */ +EXTERN(void) jpeg_calc_jpeg_dimensions(j_compress_ptr cinfo); +#endif + +/* Replaces jpeg_write_scanlines when writing raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_write_raw_data(j_compress_ptr cinfo, JSAMPIMAGE data, + JDIMENSION num_lines); + +/* Write a special marker. See libjpeg.txt concerning safe usage. */ +EXTERN(void) jpeg_write_marker(j_compress_ptr cinfo, int marker, + const JOCTET *dataptr, unsigned int datalen); +/* Same, but piecemeal. */ +EXTERN(void) jpeg_write_m_header(j_compress_ptr cinfo, int marker, + unsigned int datalen); +EXTERN(void) jpeg_write_m_byte(j_compress_ptr cinfo, int val); + +/* Alternate compression function: just write an abbreviated table file */ +EXTERN(void) jpeg_write_tables(j_compress_ptr cinfo); + +/* Write ICC profile. See libjpeg.txt for usage information. */ +EXTERN(void) jpeg_write_icc_profile(j_compress_ptr cinfo, + const JOCTET *icc_data_ptr, + unsigned int icc_data_len); + + +/* Decompression startup: read start of JPEG datastream to see what's there */ +EXTERN(int) jpeg_read_header(j_decompress_ptr cinfo, boolean require_image); +/* Return value is one of: */ +#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ +#define JPEG_HEADER_OK 1 /* Found valid image datastream */ +#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ +/* If you pass require_image = TRUE (normal case), you need not check for + * a TABLES_ONLY return code; an abbreviated file will cause an error exit. + * JPEG_SUSPENDED is only possible if you use a data source module that can + * give a suspension return (the stdio source module doesn't). + */ + +/* Main entry points for decompression */ +EXTERN(boolean) jpeg_start_decompress(j_decompress_ptr cinfo); +EXTERN(JDIMENSION) jpeg_read_scanlines(j_decompress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION max_lines); +EXTERN(JDIMENSION) jpeg_skip_scanlines(j_decompress_ptr cinfo, + JDIMENSION num_lines); +EXTERN(void) jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset, + JDIMENSION *width); +EXTERN(boolean) jpeg_finish_decompress(j_decompress_ptr cinfo); + +/* Replaces jpeg_read_scanlines when reading raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_read_raw_data(j_decompress_ptr cinfo, JSAMPIMAGE data, + JDIMENSION max_lines); + +/* Additional entry points for buffered-image mode. */ +EXTERN(boolean) jpeg_has_multiple_scans(j_decompress_ptr cinfo); +EXTERN(boolean) jpeg_start_output(j_decompress_ptr cinfo, int scan_number); +EXTERN(boolean) jpeg_finish_output(j_decompress_ptr cinfo); +EXTERN(boolean) jpeg_input_complete(j_decompress_ptr cinfo); +EXTERN(void) jpeg_new_colormap(j_decompress_ptr cinfo); +EXTERN(int) jpeg_consume_input(j_decompress_ptr cinfo); +/* Return value is one of: */ +/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ +#define JPEG_REACHED_SOS 1 /* Reached start of new scan */ +#define JPEG_REACHED_EOI 2 /* Reached end of image */ +#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ +#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ + +/* Precalculate output dimensions for current decompression parameters. */ +#if JPEG_LIB_VERSION >= 80 +EXTERN(void) jpeg_core_output_dimensions(j_decompress_ptr cinfo); +#endif +EXTERN(void) jpeg_calc_output_dimensions(j_decompress_ptr cinfo); + +/* Control saving of COM and APPn markers into marker_list. */ +EXTERN(void) jpeg_save_markers(j_decompress_ptr cinfo, int marker_code, + unsigned int length_limit); + +/* Install a special processing method for COM or APPn markers. */ +EXTERN(void) jpeg_set_marker_processor(j_decompress_ptr cinfo, + int marker_code, + jpeg_marker_parser_method routine); + +/* Read or write raw DCT coefficients --- useful for lossless transcoding. */ +EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients(j_decompress_ptr cinfo); +EXTERN(void) jpeg_write_coefficients(j_compress_ptr cinfo, + jvirt_barray_ptr *coef_arrays); +EXTERN(void) jpeg_copy_critical_parameters(j_decompress_ptr srcinfo, + j_compress_ptr dstinfo); + +/* If you choose to abort compression or decompression before completing + * jpeg_finish_(de)compress, then you need to clean up to release memory, + * temporary files, etc. You can just call jpeg_destroy_(de)compress + * if you're done with the JPEG object, but if you want to clean it up and + * reuse it, call this: + */ +EXTERN(void) jpeg_abort_compress(j_compress_ptr cinfo); +EXTERN(void) jpeg_abort_decompress(j_decompress_ptr cinfo); + +/* Generic versions of jpeg_abort and jpeg_destroy that work on either + * flavor of JPEG object. These may be more convenient in some places. + */ +EXTERN(void) jpeg_abort(j_common_ptr cinfo); +EXTERN(void) jpeg_destroy(j_common_ptr cinfo); + +/* Default restart-marker-resync procedure for use by data source modules */ +EXTERN(boolean) jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired); + +/* Read ICC profile. See libjpeg.txt for usage information. */ +EXTERN(boolean) jpeg_read_icc_profile(j_decompress_ptr cinfo, + JOCTET **icc_data_ptr, + unsigned int *icc_data_len); + + +/* These marker codes are exported since applications and data source modules + * are likely to want to use them. + */ + +#define JPEG_RST0 0xD0 /* RST0 marker code */ +#define JPEG_EOI 0xD9 /* EOI marker code */ +#define JPEG_APP0 0xE0 /* APP0 marker code */ +#define JPEG_COM 0xFE /* COM marker code */ + + +/* If we have a brain-damaged compiler that emits warnings (or worse, errors) + * for structure definitions that are never filled in, keep it quiet by + * supplying dummy definitions for the various substructures. + */ + +#ifdef INCOMPLETE_TYPES_BROKEN +#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ +struct jvirt_sarray_control { long dummy; }; +struct jvirt_barray_control { long dummy; }; +struct jpeg_comp_master { long dummy; }; +struct jpeg_c_main_controller { long dummy; }; +struct jpeg_c_prep_controller { long dummy; }; +struct jpeg_c_coef_controller { long dummy; }; +struct jpeg_marker_writer { long dummy; }; +struct jpeg_color_converter { long dummy; }; +struct jpeg_downsampler { long dummy; }; +struct jpeg_forward_dct { long dummy; }; +struct jpeg_entropy_encoder { long dummy; }; +struct jpeg_decomp_master { long dummy; }; +struct jpeg_d_main_controller { long dummy; }; +struct jpeg_d_coef_controller { long dummy; }; +struct jpeg_d_post_controller { long dummy; }; +struct jpeg_input_controller { long dummy; }; +struct jpeg_marker_reader { long dummy; }; +struct jpeg_entropy_decoder { long dummy; }; +struct jpeg_inverse_dct { long dummy; }; +struct jpeg_upsampler { long dummy; }; +struct jpeg_color_deconverter { long dummy; }; +struct jpeg_color_quantizer { long dummy; }; +#endif /* JPEG_INTERNALS */ +#endif /* INCOMPLETE_TYPES_BROKEN */ + + +/* + * The JPEG library modules define JPEG_INTERNALS before including this file. + * The internal structure declarations are read only when that is true. + * Applications using the library should not include jpegint.h, but may wish + * to include jerror.h. + */ + +#ifdef JPEG_INTERNALS +#include "jpegint.h" /* fetch private declarations */ +#include "jerror.h" /* fetch error codes too */ +#endif + +#ifdef __cplusplus +#ifndef DONT_USE_EXTERN_C +} +#endif +#endif + +#endif /* JPEGLIB_H */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jsimd.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jsimd.h new file mode 100644 index 0000000000000000000000000000000000000000..6c203655ef84594a712eb1126e7e7e23bfa5652d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jsimd.h @@ -0,0 +1,123 @@ +/* + * jsimd.h + * + * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright (C) 2011, 2014, D. R. Commander. + * Copyright (C) 2015-2016, 2018, Matthieu Darbois. + * Copyright (C) 2020, Arm Limited. + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * For conditions of distribution and use, see copyright notice in jsimdext.inc + * + */ + +#include "jchuff.h" /* Declarations shared with jcphuff.c */ + +EXTERN(int) jsimd_can_rgb_ycc(void); +EXTERN(int) jsimd_can_rgb_gray(void); +EXTERN(int) jsimd_can_ycc_rgb(void); +EXTERN(int) jsimd_can_ycc_rgb565(void); +EXTERN(int) jsimd_c_can_null_convert(void); + +EXTERN(void) jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_c_null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, JDIMENSION output_row, + int num_rows); + +EXTERN(int) jsimd_can_h2v2_downsample(void); +EXTERN(int) jsimd_can_h2v1_downsample(void); + +EXTERN(void) jsimd_h2v2_downsample(j_compress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY output_data); + +EXTERN(int) jsimd_can_h2v2_smooth_downsample(void); + +EXTERN(void) jsimd_h2v2_smooth_downsample(j_compress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample(j_compress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY output_data); + +EXTERN(int) jsimd_can_h2v2_upsample(void); +EXTERN(int) jsimd_can_h2v1_upsample(void); +EXTERN(int) jsimd_can_int_upsample(void); + +EXTERN(void) jsimd_h2v2_upsample(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v1_upsample(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_int_upsample(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(int) jsimd_can_h2v2_fancy_upsample(void); +EXTERN(int) jsimd_can_h2v1_fancy_upsample(void); +EXTERN(int) jsimd_can_h1v2_fancy_upsample(void); + +EXTERN(void) jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h1v2_fancy_upsample(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(int) jsimd_can_h2v2_merged_upsample(void); +EXTERN(int) jsimd_can_h2v1_merged_upsample(void); + +EXTERN(void) jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(int) jsimd_can_huff_encode_one_block(void); + +EXTERN(JOCTET *) jsimd_huff_encode_one_block(void *state, JOCTET *buffer, + JCOEFPTR block, int last_dc_val, + c_derived_tbl *dctbl, + c_derived_tbl *actbl); + +EXTERN(int) jsimd_can_encode_mcu_AC_first_prepare(void); + +EXTERN(void) jsimd_encode_mcu_AC_first_prepare + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + JCOEF *values, size_t *zerobits); + +EXTERN(int) jsimd_can_encode_mcu_AC_refine_prepare(void); + +EXTERN(int) jsimd_encode_mcu_AC_refine_prepare + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + JCOEF *absvalues, size_t *bits); diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jsimddct.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jsimddct.h new file mode 100644 index 0000000000000000000000000000000000000000..55ee8cf67f56a03a105cf46d3e7500c77c278287 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jsimddct.h @@ -0,0 +1,70 @@ +/* + * jsimddct.h + * + * Copyright 2009 Pierre Ossman for Cendio AB + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * For conditions of distribution and use, see copyright notice in jsimdext.inc + * + */ + +EXTERN(int) jsimd_can_convsamp(void); +EXTERN(int) jsimd_can_convsamp_float(void); + +EXTERN(void) jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col, + DCTELEM *workspace); +EXTERN(void) jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col, + FAST_FLOAT *workspace); + +EXTERN(int) jsimd_can_fdct_islow(void); +EXTERN(int) jsimd_can_fdct_ifast(void); +EXTERN(int) jsimd_can_fdct_float(void); + +EXTERN(void) jsimd_fdct_islow(DCTELEM *data); +EXTERN(void) jsimd_fdct_ifast(DCTELEM *data); +EXTERN(void) jsimd_fdct_float(FAST_FLOAT *data); + +EXTERN(int) jsimd_can_quantize(void); +EXTERN(int) jsimd_can_quantize_float(void); + +EXTERN(void) jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, + DCTELEM *workspace); +EXTERN(void) jsimd_quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors, + FAST_FLOAT *workspace); + +EXTERN(int) jsimd_can_idct_2x2(void); +EXTERN(int) jsimd_can_idct_4x4(void); +EXTERN(int) jsimd_can_idct_6x6(void); +EXTERN(int) jsimd_can_idct_12x12(void); + +EXTERN(void) jsimd_idct_2x2(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jsimd_idct_6x6(j_decompress_ptr cinfo, + jpeg_component_info *compptr, JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col); +EXTERN(void) jsimd_idct_12x12(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(int) jsimd_can_idct_islow(void); +EXTERN(int) jsimd_can_idct_ifast(void); +EXTERN(int) jsimd_can_idct_float(void); + +EXTERN(void) jsimd_idct_islow(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_ifast(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_float(j_decompress_ptr cinfo, + jpeg_component_info *compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jstdhuff.c b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jstdhuff.c new file mode 100644 index 0000000000000000000000000000000000000000..345b513d4dc4b529aa82a9ee214b2ce6b43d056c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jstdhuff.c @@ -0,0 +1,144 @@ +/* + * jstdhuff.c + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1998, Thomas G. Lane. + * libjpeg-turbo Modifications: + * Copyright (C) 2013, 2022, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains routines to set the default Huffman tables, if they are + * not already set. + */ + +/* + * Huffman table setup routines + */ + +LOCAL(void) +add_huff_table(j_common_ptr cinfo, JHUFF_TBL **htblptr, const UINT8 *bits, + const UINT8 *val) +/* Define a Huffman table */ +{ + int nsymbols, len; + + if (*htblptr == NULL) + *htblptr = jpeg_alloc_huff_table(cinfo); + else + return; + + /* Copy the number-of-symbols-of-each-code-length counts */ + memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits)); + + /* Validate the counts. We do this here mainly so we can copy the right + * number of symbols from the val[] array, without risking marching off + * the end of memory. jchuff.c will do a more thorough test later. + */ + nsymbols = 0; + for (len = 1; len <= 16; len++) + nsymbols += bits[len]; + if (nsymbols < 1 || nsymbols > 256) + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + + memcpy((*htblptr)->huffval, val, nsymbols * sizeof(UINT8)); + memset(&((*htblptr)->huffval[nsymbols]), 0, + (256 - nsymbols) * sizeof(UINT8)); + + /* Initialize sent_table FALSE so table will be written to JPEG file. */ + (*htblptr)->sent_table = FALSE; +} + + +LOCAL(void) +std_huff_tables(j_common_ptr cinfo) +/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ +/* IMPORTANT: these are only valid for 8-bit data precision! */ +{ + JHUFF_TBL **dc_huff_tbl_ptrs, **ac_huff_tbl_ptrs; + + static const UINT8 bits_dc_luminance[17] = { + /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 + }; + static const UINT8 val_dc_luminance[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 + }; + + static const UINT8 bits_dc_chrominance[17] = { + /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 + }; + static const UINT8 val_dc_chrominance[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 + }; + + static const UINT8 bits_ac_luminance[17] = { + /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d + }; + static const UINT8 val_ac_luminance[] = { + 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, + 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, + 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, + 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, + 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, + 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa + }; + + static const UINT8 bits_ac_chrominance[17] = { + /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 + }; + static const UINT8 val_ac_chrominance[] = { + 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, + 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, + 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, + 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, + 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, + 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, + 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, + 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, + 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa + }; + + if (cinfo->is_decompressor) { + dc_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->dc_huff_tbl_ptrs; + ac_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->ac_huff_tbl_ptrs; + } else { + dc_huff_tbl_ptrs = ((j_compress_ptr)cinfo)->dc_huff_tbl_ptrs; + ac_huff_tbl_ptrs = ((j_compress_ptr)cinfo)->ac_huff_tbl_ptrs; + } + + add_huff_table(cinfo, &dc_huff_tbl_ptrs[0], bits_dc_luminance, + val_dc_luminance); + add_huff_table(cinfo, &ac_huff_tbl_ptrs[0], bits_ac_luminance, + val_ac_luminance); + add_huff_table(cinfo, &dc_huff_tbl_ptrs[1], bits_dc_chrominance, + val_dc_chrominance); + add_huff_table(cinfo, &ac_huff_tbl_ptrs[1], bits_ac_chrominance, + val_ac_chrominance); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jversion.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jversion.h new file mode 100644 index 0000000000000000000000000000000000000000..63db95b99b558635427603d489f584bf233b0082 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/jversion.h @@ -0,0 +1,54 @@ +/* + * jversion.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2010, 2012-2022, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains software version identification. + */ + + +#if JPEG_LIB_VERSION >= 80 + +#define JVERSION "8d 15-Jan-2012" + +#elif JPEG_LIB_VERSION >= 70 + +#define JVERSION "7 27-Jun-2009" + +#else + +#define JVERSION "6b 27-Mar-1998" + +#endif + +/* + * NOTE: It is our convention to place the authors in the following order: + * - libjpeg-turbo authors (2009-) in descending order of the date of their + * most recent contribution to the project, then in ascending order of the + * date of their first contribution to the project, then in alphabetical + * order + * - Upstream authors in descending order of the date of the first inclusion of + * their code + */ + +#define JCOPYRIGHT \ + "Copyright (C) 2009-2022 D. R. Commander\n" \ + "Copyright (C) 2015, 2020 Google, Inc.\n" \ + "Copyright (C) 2019-2020 Arm Limited\n" \ + "Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \ + "Copyright (C) 2011-2016 Siarhei Siamashka\n" \ + "Copyright (C) 2015 Intel Corporation\n" \ + "Copyright (C) 2013-2014 Linaro Limited\n" \ + "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ + "Copyright (C) 2009, 2012 Pierre Ossman for Cendio AB\n" \ + "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ + "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ + "Copyright (C) 1991-2020 Thomas G. Lane, Guido Vollbeding" + +#define JCOPYRIGHT_SHORT \ + "Copyright (C) 1991-2022 The libjpeg-turbo Project and many others" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/simd/jsimd.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/simd/jsimd.h new file mode 100644 index 0000000000000000000000000000000000000000..64747c6360c11a7f93ebb51ece50dbdc95ef6c2a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/libjpeg_turbo/simd/jsimd.h @@ -0,0 +1,1258 @@ +/* + * simd/jsimd.h + * + * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright (C) 2011, 2014-2016, 2018, 2020, D. R. Commander. + * Copyright (C) 2013-2014, MIPS Technologies, Inc., California. + * Copyright (C) 2014, Linaro Limited. + * Copyright (C) 2015-2016, 2018, Matthieu Darbois. + * Copyright (C) 2016-2018, Loongson Technology Corporation Limited, BeiJing. + * Copyright (C) 2020, Arm Limited. + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * For conditions of distribution and use, see copyright notice in jsimdext.inc + * + */ + +/* Bitmask for supported acceleration methods */ + +#define JSIMD_NONE 0x00 +#define JSIMD_MMX 0x01 +#define JSIMD_3DNOW 0x02 +#define JSIMD_SSE 0x04 +#define JSIMD_SSE2 0x08 +#define JSIMD_NEON 0x10 +#define JSIMD_DSPR2 0x20 +#define JSIMD_ALTIVEC 0x40 +#define JSIMD_AVX2 0x80 +#define JSIMD_MMI 0x100 + +/* SIMD Ext: retrieve SIMD/CPU information */ +EXTERN(unsigned int) jpeg_simd_cpu_support(void); + +/* RGB & extended RGB --> YCC Colorspace Conversion */ +EXTERN(void) jsimd_rgb_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +extern const int jconst_rgb_ycc_convert_sse2[]; +EXTERN(void) jsimd_rgb_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +extern const int jconst_rgb_ycc_convert_avx2[]; +EXTERN(void) jsimd_rgb_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +#ifndef NEON_INTRINSICS + +EXTERN(void) jsimd_extrgb_ycc_convert_neon_slowld3 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_neon_slowld3 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +#endif + +EXTERN(void) jsimd_rgb_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +/* RGB & extended RGB --> Grayscale Colorspace Conversion */ +EXTERN(void) jsimd_rgb_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +extern const int jconst_rgb_gray_convert_sse2[]; +EXTERN(void) jsimd_rgb_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_sse2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +extern const int jconst_rgb_gray_convert_avx2[]; +EXTERN(void) jsimd_rgb_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_avx2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_mmi + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_altivec + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +/* YCC --> RGB & extended RGB Colorspace Conversion */ +EXTERN(void) jsimd_ycc_rgb_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +extern const int jconst_ycc_rgb_convert_sse2[]; +EXTERN(void) jsimd_ycc_rgb_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_sse2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +extern const int jconst_ycc_rgb_convert_avx2[]; +EXTERN(void) jsimd_ycc_rgb_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_avx2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +EXTERN(void) jsimd_ycc_rgb_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_rgb565_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +#ifndef NEON_INTRINSICS + +EXTERN(void) jsimd_ycc_extrgb_convert_neon_slowst3 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_neon_slowst3 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +#endif + +EXTERN(void) jsimd_ycc_rgb_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +EXTERN(void) jsimd_ycc_rgb_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_mmi + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +EXTERN(void) jsimd_ycc_rgb_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_altivec + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); + +/* NULL Colorspace Conversion */ +EXTERN(void) jsimd_c_null_convert_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows, int num_components); + +/* h2v1 Downsampling */ +EXTERN(void) jsimd_h2v1_downsample_mmx + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_sse2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_avx2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_neon + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_dspr2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_altivec + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +/* h2v2 Downsampling */ +EXTERN(void) jsimd_h2v2_downsample_mmx + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_sse2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_avx2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_neon + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_dspr2 + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_mmi + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v2_downsample_altivec + (JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, + JDIMENSION width_in_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data); + +/* h2v2 Smooth Downsampling */ +EXTERN(void) jsimd_h2v2_smooth_downsample_dspr2 + (JSAMPARRAY input_data, JSAMPARRAY output_data, JDIMENSION v_samp_factor, + int max_v_samp_factor, int smoothing_factor, JDIMENSION width_in_blocks, + JDIMENSION image_width); + + +/* Upsampling */ +EXTERN(void) jsimd_h2v1_upsample_mmx + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_mmx + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_upsample_sse2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_sse2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_upsample_avx2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_avx2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_upsample_neon + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_neon + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_upsample_dspr2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_dspr2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_int_upsample_dspr2 + (UINT8 h_expand, UINT8 v_expand, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr, JDIMENSION output_width, + int max_v_samp_factor); + +EXTERN(void) jsimd_h2v1_upsample_altivec + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_altivec + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +/* Fancy Upsampling */ +EXTERN(void) jsimd_h2v1_fancy_upsample_mmx + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_mmx + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +extern const int jconst_fancy_upsample_sse2[]; +EXTERN(void) jsimd_h2v1_fancy_upsample_sse2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_sse2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +extern const int jconst_fancy_upsample_avx2[]; +EXTERN(void) jsimd_h2v1_fancy_upsample_avx2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_avx2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_fancy_upsample_neon + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_neon + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h1v2_fancy_upsample_neon + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_fancy_upsample_dspr2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_dspr2 + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_fancy_upsample_mmi + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_mmi + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +EXTERN(void) jsimd_h2v1_fancy_upsample_altivec + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_altivec + (int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, + JSAMPARRAY *output_data_ptr); + +/* Merged Upsampling */ +EXTERN(void) jsimd_h2v1_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +extern const int jconst_merged_upsample_sse2[]; +EXTERN(void) jsimd_h2v1_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +extern const int jconst_merged_upsample_avx2[]; +EXTERN(void) jsimd_h2v1_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_avx2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v1_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_neon + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v1_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); + +EXTERN(void) jsimd_h2v2_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf, JSAMPLE *range); + +EXTERN(void) jsimd_h2v1_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_mmi + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v1_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_altivec + (JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf); + +/* Sample Conversion */ +EXTERN(void) jsimd_convsamp_mmx + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_sse2 + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_avx2 + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_neon + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_dspr2 + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +EXTERN(void) jsimd_convsamp_altivec + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace); + +/* Floating Point Sample Conversion */ +EXTERN(void) jsimd_convsamp_float_3dnow + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_convsamp_float_sse + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_convsamp_float_sse2 + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_convsamp_float_dspr2 + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace); + +/* Accurate Integer Forward DCT */ +EXTERN(void) jsimd_fdct_islow_mmx(DCTELEM *data); + +extern const int jconst_fdct_islow_sse2[]; +EXTERN(void) jsimd_fdct_islow_sse2(DCTELEM *data); + +extern const int jconst_fdct_islow_avx2[]; +EXTERN(void) jsimd_fdct_islow_avx2(DCTELEM *data); + +EXTERN(void) jsimd_fdct_islow_neon(DCTELEM *data); + +EXTERN(void) jsimd_fdct_islow_dspr2(DCTELEM *data); + +EXTERN(void) jsimd_fdct_islow_mmi(DCTELEM *data); + +EXTERN(void) jsimd_fdct_islow_altivec(DCTELEM *data); + +/* Fast Integer Forward DCT */ +EXTERN(void) jsimd_fdct_ifast_mmx(DCTELEM *data); + +extern const int jconst_fdct_ifast_sse2[]; +EXTERN(void) jsimd_fdct_ifast_sse2(DCTELEM *data); + +EXTERN(void) jsimd_fdct_ifast_neon(DCTELEM *data); + +EXTERN(void) jsimd_fdct_ifast_dspr2(DCTELEM *data); + +EXTERN(void) jsimd_fdct_ifast_mmi(DCTELEM *data); + +EXTERN(void) jsimd_fdct_ifast_altivec(DCTELEM *data); + +/* Floating Point Forward DCT */ +EXTERN(void) jsimd_fdct_float_3dnow(FAST_FLOAT *data); + +extern const int jconst_fdct_float_sse[]; +EXTERN(void) jsimd_fdct_float_sse(FAST_FLOAT *data); + +/* Quantization */ +EXTERN(void) jsimd_quantize_mmx + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_sse2 + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_avx2 + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_neon + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_dspr2 + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_mmi + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +EXTERN(void) jsimd_quantize_altivec + (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace); + +/* Floating Point Quantization */ +EXTERN(void) jsimd_quantize_float_3dnow + (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_quantize_float_sse + (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_quantize_float_sse2 + (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace); + +EXTERN(void) jsimd_quantize_float_dspr2 + (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace); + +/* Scaled Inverse DCT */ +EXTERN(void) jsimd_idct_2x2_mmx + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_mmx + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_red_sse2[]; +EXTERN(void) jsimd_idct_2x2_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_2x2_neon + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_neon + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_2x2_dspr2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_dspr2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col, int *workspace); +EXTERN(void) jsimd_idct_6x6_dspr2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_12x12_pass1_dspr2 + (JCOEFPTR coef_block, void *dct_table, int *workspace); +EXTERN(void) jsimd_idct_12x12_pass2_dspr2 + (int *workspace, int *output); + +/* Accurate Integer Inverse DCT */ +EXTERN(void) jsimd_idct_islow_mmx + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_islow_sse2[]; +EXTERN(void) jsimd_idct_islow_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_islow_avx2[]; +EXTERN(void) jsimd_idct_islow_avx2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_islow_neon + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_islow_dspr2 + (void *dct_table, JCOEFPTR coef_block, int *output_buf, JSAMPLE *output_col); + +EXTERN(void) jsimd_idct_islow_mmi + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_islow_altivec + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +/* Fast Integer Inverse DCT */ +EXTERN(void) jsimd_idct_ifast_mmx + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_ifast_sse2[]; +EXTERN(void) jsimd_idct_ifast_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_ifast_neon + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_ifast_cols_dspr2 + (JCOEF *inptr, IFAST_MULT_TYPE *quantptr, DCTELEM *wsptr, + const int *idct_coefs); +EXTERN(void) jsimd_idct_ifast_rows_dspr2 + (DCTELEM *wsptr, JSAMPARRAY output_buf, JDIMENSION output_col, + const int *idct_coefs); + +EXTERN(void) jsimd_idct_ifast_mmi + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_ifast_altivec + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +/* Floating Point Inverse DCT */ +EXTERN(void) jsimd_idct_float_3dnow + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_float_sse[]; +EXTERN(void) jsimd_idct_float_sse + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +extern const int jconst_idct_float_sse2[]; +EXTERN(void) jsimd_idct_float_sse2 + (void *dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +/* Huffman coding */ +extern const int jconst_huff_encode_one_block[]; +EXTERN(JOCTET *) jsimd_huff_encode_one_block_sse2 + (void *state, JOCTET *buffer, JCOEFPTR block, int last_dc_val, + c_derived_tbl *dctbl, c_derived_tbl *actbl); + +EXTERN(JOCTET *) jsimd_huff_encode_one_block_neon + (void *state, JOCTET *buffer, JCOEFPTR block, int last_dc_val, + c_derived_tbl *dctbl, c_derived_tbl *actbl); + +#ifndef NEON_INTRINSICS + +EXTERN(JOCTET *) jsimd_huff_encode_one_block_neon_slowtbl + (void *state, JOCTET *buffer, JCOEFPTR block, int last_dc_val, + c_derived_tbl *dctbl, c_derived_tbl *actbl); + +#endif + +/* Progressive Huffman encoding */ +EXTERN(void) jsimd_encode_mcu_AC_first_prepare_sse2 + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + JCOEF *values, size_t *zerobits); + +EXTERN(void) jsimd_encode_mcu_AC_first_prepare_neon + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + JCOEF *values, size_t *zerobits); + +EXTERN(int) jsimd_encode_mcu_AC_refine_prepare_sse2 + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + JCOEF *absvalues, size_t *bits); + +EXTERN(int) jsimd_encode_mcu_AC_refine_prepare_neon + (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, + JCOEF *absvalues, size_t *bits); diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/LICENSE.TXT b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/LICENSE.TXT new file mode 100644 index 0000000000000000000000000000000000000000..53bb2e7fbc76434fe747bceffdfb5c19e1cca362 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/LICENSE.TXT @@ -0,0 +1,234 @@ +============================================================================== +The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: +============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +---- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + +============================================================================== +Software from third parties included in the LLVM Project: +============================================================================== +The LLVM Project contains third party software which is under different license +terms. All such code will be identified clearly using at least one of two +mechanisms: +1) It will be in a separate directory tree with its own `LICENSE.txt` or + `LICENSE` file at the top containing the specific license and restrictions + which apply to that software, or +2) It will contain specific license and restriction terms at the top of every + file. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/ArithCanonicalizationIncGen/ArithCanonicalization.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/ArithCanonicalizationIncGen/ArithCanonicalization.inc new file mode 100644 index 0000000000000000000000000000000000000000..40da1a6ebde13feb1afcfa3239a118697c47f6c0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/ArithCanonicalizationIncGen/ArithCanonicalization.inc @@ -0,0 +1,3767 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Rewriters *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArithCanonicalization.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithCanonicalization0( + ::mlir::PatternRewriter &rewriter, ::mlir::Operation *op, ::mlir::Attribute attr, + ::llvm::StringRef failureStr) { + if (!((::llvm::isa<::mlir::IntegerAttr>(attr)))) { + return rewriter.notifyMatchFailure(op, [&](::mlir::Diagnostic &diag) { + diag << failureStr << ": arbitrary integer attribute"; + }); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithCanonicalization1( + ::mlir::PatternRewriter &rewriter, ::mlir::Operation *op, ::mlir::Attribute attr, + ::llvm::StringRef failureStr) { + if (!((true))) { + return rewriter.notifyMatchFailure(op, [&](::mlir::Diagnostic &diag) { + diag << failureStr << ": any attribute"; + }); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithCanonicalization2( + ::mlir::PatternRewriter &rewriter, ::mlir::Operation *op, ::mlir::Attribute attr, + ::llvm::StringRef failureStr) { + if (!((::llvm::isa<::mlir::TypedAttr>(attr)))) { + return rewriter.notifyMatchFailure(op, [&](::mlir::Diagnostic &diag) { + diag << failureStr << ": TypedAttr instance"; + }); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithCanonicalization3( + ::mlir::PatternRewriter &rewriter, ::mlir::Operation *op, ::mlir::Attribute attr, + ::llvm::StringRef failureStr) { + if (!((attr == rewriter.getIntegerAttr(rewriter.getIntegerType(1), 1)))) { + return rewriter.notifyMatchFailure(op, [&](::mlir::Diagnostic &diag) { + diag << failureStr << ": constant attribute 1"; + }); + } + return ::mlir::success(); +} +static ::mlir::LogicalResult static_dag_matcher_0(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c0) { + (void)tblgen_ops; + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + c0 = arg1_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization0(rewriter, op0, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'arbitrary integer attribute'"))) { + return ::mlir::failure(); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_1(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c0, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::AddIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_0(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_2(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c1) { + (void)tblgen_ops; + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + c1 = arg1_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization0(rewriter, op0, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'arbitrary integer attribute'"))) { + return ::mlir::failure(); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_3(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c0) { + (void)tblgen_ops; + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + c0 = arg1_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization1(rewriter, op0, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'any attribute'"))) { + return ::mlir::failure(); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_4(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x, ::mlir::Attribute &c0) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SubIOp type"; + }); + } + { + auto *op2 = (*castedOp1.getODSOperands(0).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_0(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + x = castedOp1.getODSOperands(1); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_5(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c0, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SubIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_0(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_6(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_7(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &y) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + y = castedOp1.getODSOperands(0); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_8(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_9(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &y) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + y = castedOp1.getODSOperands(0); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_10(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::NegFOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::NegFOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::FastMathFlagsAttr>("fastmath");(void)tblgen_attr; + if (!tblgen_attr) tblgen_attr = ::mlir::arith::FastMathFlagsAttr::get(rewriter.getContext(), ::mlir::arith::FastMathFlags::none); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_11(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &y) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::NegFOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::NegFOp type"; + }); + } + y = castedOp1.getODSOperands(0); + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::FastMathFlagsAttr>("fastmath");(void)tblgen_attr; + if (!tblgen_attr) tblgen_attr = ::mlir::arith::FastMathFlagsAttr::get(rewriter.getContext(), ::mlir::arith::FastMathFlags::none); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_12(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &y, ::mlir::Operation::operand_range &x, ::mlir::Operation::operand_range &predB) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SelectOp type"; + }); + } + predB = castedOp1.getODSOperands(0); + x = castedOp1.getODSOperands(1); + y = castedOp1.getODSOperands(2); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_13(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x, ::mlir::Operation::operand_range &y, ::mlir::Operation::operand_range &predB) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SelectOp type"; + }); + } + predB = castedOp1.getODSOperands(0); + y = castedOp1.getODSOperands(1); + x = castedOp1.getODSOperands(2); + return ::mlir::success(); +} + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:37 +*/ +struct AddIAddConstant : public ::mlir::RewritePattern { + AddIAddConstant(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.addi", "arith.constant"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::AddIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_1(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = addIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::AddIOp tblgen_AddIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_AddIOp_2 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:71 +*/ +struct AddIMulNegativeOneLhs : public ::mlir::RewritePattern { + AddIMulNegativeOneLhs(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::MulIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_3(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + y = castedOp0.getODSOperands(1); + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && ((getIntOrSplatIntValue(c0)->isAllOnes())))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SubIOp tblgen_SubIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*y.begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_0 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:63 +*/ +struct AddIMulNegativeOneRhs : public ::mlir::RewritePattern { + AddIMulNegativeOneRhs(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c0; + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + x = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::MulIOp type"; + }); + } + y = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_3(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && ((getIntOrSplatIntValue(c0)->isAllOnes())))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SubIOp tblgen_SubIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_SubIOp_0 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:51 +*/ +struct AddISubConstantLHS : public ::mlir::RewritePattern { + AddISubConstantLHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::arith::AddIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_4(rewriter, op1, tblgen_ops, x, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = addIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:44 +*/ +struct AddISubConstantRHS : public ::mlir::RewritePattern { + AddISubConstantRHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.addi", "arith.constant"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::AddIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_5(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c1, c0); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::AddIOp tblgen_AddIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_AddIOp_2 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:91 +*/ +struct AddUIExtendedToAddI : public ::mlir::RewritePattern { + AddUIExtendedToAddI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addui_extended", 1, context, {"arith.addi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::AddUIExtendedOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddUIExtendedOp>(op0); (void)castedOp0; + res = castedOp0; + x = castedOp0.getODSOperands(0); + y = castedOp0.getODSOperands(1); + if (!(((*res.getODSResults(1).begin()).getUses().empty()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res__1' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::AddIOp tblgen_AddIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_AddIOp_0 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:336 +*/ +struct AndOfExtSI : public ::mlir::RewritePattern { + AndOfExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.andi", 3, context, {"arith.andi", "arith.extsi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AndIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_7(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::AndIOp tblgen_AndIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_AndIOp_0 = rewriter.create<::mlir::arith::AndIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_AndIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_1 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:330 +*/ +struct AndOfExtUI : public ::mlir::RewritePattern { + AndOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.andi", 3, context, {"arith.andi", "arith.extui"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AndIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_9(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::AndIOp tblgen_AndIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_AndIOp_0 = rewriter.create<::mlir::arith::AndIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_AndIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_1 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:314 +*/ +struct BitcastOfBitcast : public ::mlir::RewritePattern { + BitcastOfBitcast(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.bitcast", 2, context, {}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::BitcastOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::BitcastOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::BitcastOp type"; + }); + } + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:215 +*/ +struct CmpIExtSI : public ::mlir::RewritePattern { + CmpIExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.cmpi", 3, context, {"arith.cmpi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::arith::CmpIPredicateAttr pred; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::CmpIOp>(op0); (void)castedOp0; + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::CmpIPredicateAttr>("predicate");(void)tblgen_attr; + if (!(tblgen_attr)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "expected op 'arith.cmpi' to have attribute 'predicate' of type '::mlir::arith::CmpIPredicateAttr'"; + }); + } + pred = tblgen_attr; + } + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + a = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + b = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((*a.begin()).getType() == (*b.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'a, b' failed to satisfy constraint: ''"; + }); + } + if (!((pred.getValue() == arith::CmpIPredicate::eq || pred.getValue() == arith::CmpIPredicate::ne))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'pred' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::CmpIOp tblgen_CmpIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + if (auto tmpAttr = pred) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("predicate"), tmpAttr); + } + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*b.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_CmpIOp_0 = rewriter.create<::mlir::arith::CmpIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_CmpIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:226 +*/ +struct CmpIExtUI : public ::mlir::RewritePattern { + CmpIExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.cmpi", 3, context, {"arith.cmpi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::arith::CmpIPredicateAttr pred; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::CmpIOp>(op0); (void)castedOp0; + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::CmpIPredicateAttr>("predicate");(void)tblgen_attr; + if (!(tblgen_attr)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "expected op 'arith.cmpi' to have attribute 'predicate' of type '::mlir::arith::CmpIPredicateAttr'"; + }); + } + pred = tblgen_attr; + } + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + a = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + b = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((*a.begin()).getType() == (*b.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'a, b' failed to satisfy constraint: ''"; + }); + } + if (!((pred.getValue() == arith::CmpIPredicate::eq || pred.getValue() == arith::CmpIPredicate::ne))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'pred' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::CmpIOp tblgen_CmpIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + if (auto tmpAttr = pred) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("predicate"), tmpAttr); + } + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*b.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_CmpIOp_0 = rewriter.create<::mlir::arith::CmpIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_CmpIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:436 +*/ +struct DivFOfNegF : public ::mlir::RewritePattern { + DivFOfNegF(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.divf", 3, context, {"arith.divf"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::arith::FastMathFlagsAttr fmf; + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::DivFOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_10(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_11(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::FastMathFlagsAttr>("fastmath");(void)tblgen_attr; + if (!tblgen_attr) tblgen_attr = ::mlir::arith::FastMathFlagsAttr::get(rewriter.getContext(), ::mlir::arith::FastMathFlags::none); + fmf = tblgen_attr; + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::DivFOp tblgen_DivFOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + if (auto tmpAttr = fmf) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("fastmath"), tmpAttr); + } + tblgen_DivFOp_0 = rewriter.create<::mlir::arith::DivFOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_DivFOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:322 +*/ +struct ExtSIOfExtUI : public ::mlir::RewritePattern { + ExtSIOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.extsi", 2, context, {"arith.extui"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_0 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:291 +*/ +struct IndexCastOfExtSI : public ::mlir::RewritePattern { + IndexCastOfExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.index_cast", 2, context, {"arith.index_cast"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::IndexCastOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::IndexCastOp tblgen_IndexCastOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_IndexCastOp_0 = rewriter.create<::mlir::arith::IndexCastOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_IndexCastOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:285 +*/ +struct IndexCastOfIndexCast : public ::mlir::RewritePattern { + IndexCastOfIndexCast(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.index_cast", 2, context, {}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::IndexCastOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::IndexCastOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::IndexCastOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::IndexCastOp type"; + }); + } + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((*res.getODSResults(0).begin()).getType() == (*x.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res, x' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:305 +*/ +struct IndexCastUIOfExtUI : public ::mlir::RewritePattern { + IndexCastUIOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.index_castui", 2, context, {"arith.index_castui"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::IndexCastUIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::IndexCastUIOp tblgen_IndexCastUIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_IndexCastUIOp_0 = rewriter.create<::mlir::arith::IndexCastUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_IndexCastUIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:299 +*/ +struct IndexCastUIOfIndexCastUI : public ::mlir::RewritePattern { + IndexCastUIOfIndexCastUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.index_castui", 2, context, {}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::IndexCastUIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::IndexCastUIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::IndexCastUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::IndexCastUIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((*res.getODSResults(0).begin()).getType() == (*x.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res, x' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:425 +*/ +struct MulFOfNegF : public ::mlir::RewritePattern { + MulFOfNegF(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.mulf", 3, context, {"arith.mulf"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::arith::FastMathFlagsAttr fmf; + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulFOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_10(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_11(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::FastMathFlagsAttr>("fastmath");(void)tblgen_attr; + if (!tblgen_attr) tblgen_attr = ::mlir::arith::FastMathFlagsAttr::get(rewriter.getContext(), ::mlir::arith::FastMathFlags::none); + fmf = tblgen_attr; + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulFOp tblgen_MulFOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + if (auto tmpAttr = fmf) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("fastmath"), tmpAttr); + } + tblgen_MulFOp_0 = rewriter.create<::mlir::arith::MulFOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_MulFOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:79 +*/ +struct MulIMulIConstant : public ::mlir::RewritePattern { + MulIMulIConstant(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.muli", 2, context, {"arith.constant", "arith.muli"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::MulIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::MulIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_0(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = mulIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::MulIOp tblgen_MulIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_MulIOp_2 = rewriter.create<::mlir::arith::MulIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_MulIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:165 +*/ +struct MulSIExtendedRHSOne : public ::mlir::RewritePattern { + MulSIExtendedRHSOne(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.mulsi_extended", 1, context, {"arith.cmpi", "arith.constant", "arith.extsi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulSIExtendedOp>(op0); (void)castedOp0; + x = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op1->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op1->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + c1 = arg1_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization1(rewriter, op1, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'any attribute'"))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((succeeded(getIntOrSplatIntValue(c1)))) && ((*getIntOrSplatIntValue(c1) == 1)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'c1' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + auto nativeVar_0 = arith::CmpIPredicate::slt; (void)nativeVar_0; + auto nativeVar_1 = rewriter.getZeroAttr((*x.begin()).getType()); (void)nativeVar_1; + ::mlir::arith::ConstantOp tblgen_ConstantOp_2; + { + tblgen_ConstantOp_2 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_1 + ); + } + ::mlir::arith::CmpIOp tblgen_CmpIOp_3; + { + ::mlir::Value tblgen_value_0 = (*x.begin()); + ::mlir::Value tblgen_value_1 = (*tblgen_ConstantOp_2.getODSResults(0).begin()); + tblgen_CmpIOp_3 = rewriter.create<::mlir::arith::CmpIOp>(odsLoc, + /*predicate=*/nativeVar_0, + /*lhs=*/tblgen_value_0, + /*rhs=*/tblgen_value_1 + ); + } + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_4; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_CmpIOp_3.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(1)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_4 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_4.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:153 +*/ +struct MulSIExtendedToMulI : public ::mlir::RewritePattern { + MulSIExtendedToMulI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.mulsi_extended", 1, context, {"arith.muli"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::MulSIExtendedOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulSIExtendedOp>(op0); (void)castedOp0; + res = castedOp0; + x = castedOp0.getODSOperands(0); + y = castedOp0.getODSOperands(1); + if (!(((*res.getODSResults(1).begin()).getUses().empty()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res__1' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulIOp tblgen_MulIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_MulIOp_0 = rewriter.create<::mlir::arith::MulIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_MulIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:180 +*/ +struct MulUIExtendedToMulI : public ::mlir::RewritePattern { + MulUIExtendedToMulI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.mului_extended", 1, context, {"arith.muli"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::MulUIExtendedOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulUIExtendedOp>(op0); (void)castedOp0; + res = castedOp0; + x = castedOp0.getODSOperands(0); + y = castedOp0.getODSOperands(1); + if (!(((*res.getODSResults(1).begin()).getUses().empty()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res__1' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulIOp tblgen_MulIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_MulIOp_0 = rewriter.create<::mlir::arith::MulIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_MulIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:352 +*/ +struct OrOfExtSI : public ::mlir::RewritePattern { + OrOfExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.ori", 3, context, {"arith.extsi", "arith.ori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::OrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_7(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::OrIOp tblgen_OrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_OrIOp_0 = rewriter.create<::mlir::arith::OrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_OrIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_1 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:346 +*/ +struct OrOfExtUI : public ::mlir::RewritePattern { + OrOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.ori", 3, context, {"arith.extui", "arith.ori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::OrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_9(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::OrIOp tblgen_OrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_OrIOp_0 = rewriter.create<::mlir::arith::OrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_OrIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_1 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:252 +*/ +struct RedundantSelectFalse : public ::mlir::RewritePattern { + RedundantSelectFalse(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::Operation::operand_range c(op0->getOperands()); + ::mlir::Operation::operand_range pred(op0->getOperands()); + ::mlir::Operation::operand_range pred0(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + pred0 = castedOp0.getODSOperands(0); + a = castedOp0.getODSOperands(1); + { + auto *op1 = (*castedOp0.getODSOperands(2).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 2 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SelectOp type"; + }); + } + pred = castedOp1.getODSOperands(0); + b = castedOp1.getODSOperands(1); + c = castedOp1.getODSOperands(2); + tblgen_ops.push_back(op1); + } + if (!(*pred.begin() == *pred0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'pred' and 'pred0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SelectOp tblgen_SelectOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*pred.begin())); + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*c.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_0 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:247 +*/ +struct RedundantSelectTrue : public ::mlir::RewritePattern { + RedundantSelectTrue(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::Operation::operand_range c(op0->getOperands()); + ::mlir::Operation::operand_range pred(op0->getOperands()); + ::mlir::Operation::operand_range pred0(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + pred0 = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SelectOp type"; + }); + } + pred = castedOp1.getODSOperands(0); + a = castedOp1.getODSOperands(1); + b = castedOp1.getODSOperands(2); + tblgen_ops.push_back(op1); + } + c = castedOp0.getODSOperands(2); + if (!(*pred.begin() == *pred0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'pred' and 'pred0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SelectOp tblgen_SelectOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*pred.begin())); + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*c.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_0 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:257 +*/ +struct SelectAndCond : public ::mlir::RewritePattern { + SelectAndCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.andi", "arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range y0(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range predB(op0->getOperands()); + ::mlir::Operation::operand_range predA(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + predA = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_12(rewriter, op1, tblgen_ops, y0, x, predB))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + y = castedOp0.getODSOperands(2); + if (!(*y.begin() == *y0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'y' and 'y0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::AndIOp tblgen_AndIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predA.begin())); + tblgen_values.push_back((*predB.begin())); + tblgen_AndIOp_0 = rewriter.create<::mlir::arith::AndIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::SelectOp tblgen_SelectOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_AndIOp_0.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_1 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:262 +*/ +struct SelectAndNotCond : public ::mlir::RewritePattern { + SelectAndNotCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.andi", "arith.constant", "arith.select", "arith.xori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range y0(op0->getOperands()); + ::mlir::Operation::operand_range predB(op0->getOperands()); + ::mlir::Operation::operand_range predA(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + predA = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_13(rewriter, op1, tblgen_ops, x, y0, predB))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + y = castedOp0.getODSOperands(2); + if (!(*y.begin() == *y0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'y' and 'y0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ConstantOp tblgen_ConstantOp_0; + { + tblgen_ConstantOp_0 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + rewriter.getIntegerAttr(rewriter.getIntegerType(1), 1) + ); + } + ::mlir::arith::XOrIOp tblgen_XOrIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predB.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_0.getODSResults(0).begin())); + tblgen_XOrIOp_1 = rewriter.create<::mlir::arith::XOrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::AndIOp tblgen_AndIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predA.begin())); + tblgen_values.push_back((*tblgen_XOrIOp_1.getODSResults(0).begin())); + tblgen_AndIOp_2 = rewriter.create<::mlir::arith::AndIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::SelectOp tblgen_SelectOp_3; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_AndIOp_2.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_3 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_3.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:241 +*/ +struct SelectNotCond : public ::mlir::RewritePattern { + SelectNotCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::Attribute ones; + ::mlir::Operation::operand_range pred(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::XOrIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::XOrIOp type"; + }); + } + pred = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + ::mlir::Attribute arg2_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op2->getResult(0), ::mlir::m_Constant(&arg2_0)))))){ + return rewriter.notifyMatchFailure(op2, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op2->getResult(0), ::mlir::m_Constant(&arg2_0))) return ::mlir::failure"; + }); + } + ones = arg2_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization0(rewriter, op2, arg2_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'arbitrary integer attribute'"))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + a = castedOp0.getODSOperands(1); + b = castedOp0.getODSOperands(2); + if (!(((succeeded(getIntOrSplatIntValue(ones)))) && ((getIntOrSplatIntValue(ones)->isAllOnes())))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'ones' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SelectOp tblgen_SelectOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*pred.begin())); + tblgen_values.push_back((*b.begin())); + tblgen_values.push_back((*a.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_0 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:269 +*/ +struct SelectOrCond : public ::mlir::RewritePattern { + SelectOrCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.ori", "arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range predB(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range x0(op0->getOperands()); + ::mlir::Operation::operand_range predA(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + predA = castedOp0.getODSOperands(0); + x0 = castedOp0.getODSOperands(1); + { + auto *op1 = (*castedOp0.getODSOperands(2).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 2 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_12(rewriter, op1, tblgen_ops, y, x, predB))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(*x.begin() == *x0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'x' and 'x0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::OrIOp tblgen_OrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predA.begin())); + tblgen_values.push_back((*predB.begin())); + tblgen_OrIOp_0 = rewriter.create<::mlir::arith::OrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::SelectOp tblgen_SelectOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_OrIOp_0.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_1 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:274 +*/ +struct SelectOrNotCond : public ::mlir::RewritePattern { + SelectOrNotCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.constant", "arith.ori", "arith.select", "arith.xori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range predB(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range x0(op0->getOperands()); + ::mlir::Operation::operand_range predA(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + predA = castedOp0.getODSOperands(0); + x0 = castedOp0.getODSOperands(1); + { + auto *op1 = (*castedOp0.getODSOperands(2).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 2 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_13(rewriter, op1, tblgen_ops, x, y, predB))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(*x.begin() == *x0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'x' and 'x0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ConstantOp tblgen_ConstantOp_0; + { + tblgen_ConstantOp_0 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + rewriter.getIntegerAttr(rewriter.getIntegerType(1), 1) + ); + } + ::mlir::arith::XOrIOp tblgen_XOrIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predB.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_0.getODSResults(0).begin())); + tblgen_XOrIOp_1 = rewriter.create<::mlir::arith::XOrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::OrIOp tblgen_OrIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predA.begin())); + tblgen_values.push_back((*tblgen_XOrIOp_1.getODSResults(0).begin())); + tblgen_OrIOp_2 = rewriter.create<::mlir::arith::OrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::SelectOp tblgen_SelectOp_3; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_OrIOp_2.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_3 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_3.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:108 +*/ +struct SubILHSAddConstant : public ::mlir::RewritePattern { + SubILHSAddConstant(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c0; + ::mlir::Attribute c1; + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_1(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c1, c0); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:136 +*/ +struct SubILHSSubConstantLHS : public ::mlir::RewritePattern { + SubILHSSubConstantLHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.addi", "arith.constant"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c0; + ::mlir::Attribute c1; + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_4(rewriter, op1, tblgen_ops, x, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c1, c0); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::AddIOp tblgen_AddIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_AddIOp_2 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:129 +*/ +struct SubILHSSubConstantRHS : public ::mlir::RewritePattern { + SubILHSSubConstantRHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c0; + ::mlir::Attribute c1; + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_5(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = addIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:101 +*/ +struct SubIRHSAddConstant : public ::mlir::RewritePattern { + SubIRHSAddConstant(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.addi", "arith.constant"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_1(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::AddIOp tblgen_AddIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_AddIOp_2 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:122 +*/ +struct SubIRHSSubConstantLHS : public ::mlir::RewritePattern { + SubIRHSSubConstantLHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_4(rewriter, op1, tblgen_ops, x, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:115 +*/ +struct SubIRHSSubConstantRHS : public ::mlir::RewritePattern { + SubIRHSSubConstantRHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_5(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = addIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:143 +*/ +struct SubISubILHSRHSLHS : public ::mlir::RewritePattern { + SubISubILHSRHSLHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range x0(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SubIOp type"; + }); + } + x0 = castedOp1.getODSOperands(0); + y = castedOp1.getODSOperands(1); + tblgen_ops.push_back(op1); + } + x = castedOp0.getODSOperands(1); + if (!(*x.begin() == *x0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'x' and 'x0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = rewriter.getZeroAttr((*y.begin()).getType()); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*y.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:377 +*/ +struct TruncIExtSIToExtSI : public ::mlir::RewritePattern { + TruncIExtSIToExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 2, context, {"arith.extsi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::ExtSIOp ext; + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + ext = castedOp1; + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((getScalarOrElementWidth((*ext.getODSResults(0).begin())) > getScalarOrElementWidth((*tr.getODSResults(0).begin())))) && ((getScalarOrElementWidth((*tr.getODSResults(0).begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'ext, tr' failed to satisfy constraint: ''"; + }); + } + if (!(((getScalarOrElementWidth((*tr.getODSResults(0).begin())) > getScalarOrElementWidth((*x.begin())))) && ((getScalarOrElementWidth((*x.begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'tr, x' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_0 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:384 +*/ +struct TruncIExtUIToExtUI : public ::mlir::RewritePattern { + TruncIExtUIToExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 2, context, {"arith.extui"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::ExtUIOp ext; + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + ext = castedOp1; + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((getScalarOrElementWidth((*ext.getODSResults(0).begin())) > getScalarOrElementWidth((*tr.getODSResults(0).begin())))) && ((getScalarOrElementWidth((*tr.getODSResults(0).begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'ext, tr' failed to satisfy constraint: ''"; + }); + } + if (!(((getScalarOrElementWidth((*tr.getODSResults(0).begin())) > getScalarOrElementWidth((*x.begin())))) && ((getScalarOrElementWidth((*x.begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'tr, x' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_0 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:391 +*/ +struct TruncIShrSIToTrunciShrUI : public ::mlir::RewritePattern { + TruncIShrSIToTrunciShrUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 2, context, {"arith.constant", "arith.shrui", "arith.trunci"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ShRSIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ShRSIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + ::mlir::Attribute arg2_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op2->getResult(0), ::mlir::m_Constant(&arg2_0)))))){ + return rewriter.notifyMatchFailure(op2, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op2->getResult(0), ::mlir::m_Constant(&arg2_0))) return ::mlir::failure"; + }); + } + c0 = arg2_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization2(rewriter, op2, arg2_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'TypedAttr instance'"))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && (((getScalarOrElementWidth((*x.begin())) - getScalarOrElementWidth((*tr.getODSResults(0).begin()))) == *getIntOrSplatIntValue(c0))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, tr, c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = ::mlir::cast(c0); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::ShRUIOp tblgen_ShRUIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_ShRUIOp_2 = rewriter.create<::mlir::arith::ShRUIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::TruncIOp tblgen_TruncIOp_3; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ShRUIOp_2.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_TruncIOp_3 = rewriter.create<::mlir::arith::TruncIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_TruncIOp_3.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:398 +*/ +struct TruncIShrUIMulIToMulSIExtended : public ::mlir::RewritePattern { + TruncIShrUIMulIToMulSIExtended(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 5, context, {"arith.mulsi_extended"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::MulIOp mul; + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ShRUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ShRUIOp type"; + }); + } + { + auto *op2 = (*castedOp1.getODSOperands(0).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp1"; + }); + } + auto castedOp2 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op2); (void)castedOp2; + if (!(castedOp2)){ + return rewriter.notifyMatchFailure(op2, [&](::mlir::Diagnostic &diag) { + diag << "castedOp2 is not ::mlir::arith::MulIOp type"; + }); + } + mul = castedOp2; + { + auto *op3 = (*castedOp2.getODSOperands(0).begin()).getDefiningOp(); + if (!(op3)){ + return rewriter.notifyMatchFailure(castedOp2, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp2"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op3, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op3); + } + { + auto *op3 = (*castedOp2.getODSOperands(1).begin()).getDefiningOp(); + if (!(op3)){ + return rewriter.notifyMatchFailure(castedOp2, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp2"; + }); + } + if(::mlir::failed(static_dag_matcher_7(rewriter, op3, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op3); + } + tblgen_ops.push_back(op2); + } + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_3(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + if (!((llvm::all_equal({(*tr.getODSResults(0).begin()).getType(), (*x.begin()).getType(), (*y.begin()).getType()})))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'tr, x, y' failed to satisfy constraint: ''"; + }); + } + if (!(((getScalarOrElementWidth((*mul.getODSResults(0).begin())) > getScalarOrElementWidth((*x.begin())))) && ((getScalarOrElementWidth((*x.begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'mul, x' failed to satisfy constraint: ''"; + }); + } + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && (((getScalarOrElementWidth((*mul.getODSResults(0).begin())) - getScalarOrElementWidth((*x.begin()))) == *getIntOrSplatIntValue(c0))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'mul, x, c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc(), tblgen_ops[3]->getLoc(), tblgen_ops[4]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulSIExtendedOp res; + { + ::mlir::Value tblgen_value_0 = (*x.begin()); + ::mlir::Value tblgen_value_1 = (*y.begin()); + res = rewriter.create<::mlir::arith::MulSIExtendedOp>(odsLoc, + /*lhs=*/tblgen_value_0, + /*rhs=*/tblgen_value_1 + ); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ res.getODSResults(1) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:409 +*/ +struct TruncIShrUIMulIToMulUIExtended : public ::mlir::RewritePattern { + TruncIShrUIMulIToMulUIExtended(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 5, context, {"arith.mului_extended"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::MulIOp mul; + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ShRUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ShRUIOp type"; + }); + } + { + auto *op2 = (*castedOp1.getODSOperands(0).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp1"; + }); + } + auto castedOp2 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op2); (void)castedOp2; + if (!(castedOp2)){ + return rewriter.notifyMatchFailure(op2, [&](::mlir::Diagnostic &diag) { + diag << "castedOp2 is not ::mlir::arith::MulIOp type"; + }); + } + mul = castedOp2; + { + auto *op3 = (*castedOp2.getODSOperands(0).begin()).getDefiningOp(); + if (!(op3)){ + return rewriter.notifyMatchFailure(castedOp2, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp2"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op3, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op3); + } + { + auto *op3 = (*castedOp2.getODSOperands(1).begin()).getDefiningOp(); + if (!(op3)){ + return rewriter.notifyMatchFailure(castedOp2, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp2"; + }); + } + if(::mlir::failed(static_dag_matcher_9(rewriter, op3, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op3); + } + tblgen_ops.push_back(op2); + } + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_3(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + if (!((llvm::all_equal({(*tr.getODSResults(0).begin()).getType(), (*x.begin()).getType(), (*y.begin()).getType()})))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'tr, x, y' failed to satisfy constraint: ''"; + }); + } + if (!(((getScalarOrElementWidth((*mul.getODSResults(0).begin())) > getScalarOrElementWidth((*x.begin())))) && ((getScalarOrElementWidth((*x.begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'mul, x' failed to satisfy constraint: ''"; + }); + } + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && (((getScalarOrElementWidth((*mul.getODSResults(0).begin())) - getScalarOrElementWidth((*x.begin()))) == *getIntOrSplatIntValue(c0))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'mul, x, c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc(), tblgen_ops[3]->getLoc(), tblgen_ops[4]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulUIExtendedOp res; + { + ::mlir::Value tblgen_value_0 = (*x.begin()); + ::mlir::Value tblgen_value_1 = (*y.begin()); + res = rewriter.create<::mlir::arith::MulUIExtendedOp>(odsLoc, + /*lhs=*/tblgen_value_0, + /*rhs=*/tblgen_value_1 + ); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ res.getODSResults(1) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:194 +*/ +struct XOrINotCmpI : public ::mlir::RewritePattern { + XOrINotCmpI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.xori", 2, context, {"arith.cmpi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::arith::CmpIPredicateAttr pred; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::XOrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::CmpIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::CmpIOp type"; + }); + } + { + auto tblgen_attr = op1->getAttrOfType<::mlir::arith::CmpIPredicateAttr>("predicate");(void)tblgen_attr; + if (!(tblgen_attr)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "expected op 'arith.cmpi' to have attribute 'predicate' of type '::mlir::arith::CmpIPredicateAttr'"; + }); + } + pred = tblgen_attr; + } + a = castedOp1.getODSOperands(0); + b = castedOp1.getODSOperands(1); + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op1->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op1->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization3(rewriter, op1, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'constant attribute 1'"))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = invertPredicate(pred); (void)nativeVar_0; + ::mlir::arith::CmpIOp tblgen_CmpIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + if (auto tmpAttr = nativeVar_0) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("predicate"), tmpAttr); + } + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*b.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_CmpIOp_1 = rewriter.create<::mlir::arith::CmpIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_CmpIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:206 +*/ +struct XOrIOfExtSI : public ::mlir::RewritePattern { + XOrIOfExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.xori", 3, context, {"arith.extsi", "arith.xori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::XOrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_7(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::XOrIOp tblgen_XOrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_XOrIOp_0 = rewriter.create<::mlir::arith::XOrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_XOrIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_1 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:201 +*/ +struct XOrIOfExtUI : public ::mlir::RewritePattern { + XOrIOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.xori", 3, context, {"arith.extui", "arith.xori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::XOrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_9(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::XOrIOp tblgen_XOrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_XOrIOp_0 = rewriter.create<::mlir::arith::XOrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_XOrIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_1 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +void LLVM_ATTRIBUTE_UNUSED populateWithGenerated(::mlir::RewritePatternSet &patterns) { + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/AsmParserTokenKinds/TokenKinds.def b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/AsmParserTokenKinds/TokenKinds.def new file mode 100644 index 0000000000000000000000000000000000000000..297e074594530131e80ea0d0ceffb0cab0063bbe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/AsmParserTokenKinds/TokenKinds.def @@ -0,0 +1,133 @@ +//===- TokenKinds.def - MLIR Token Description ------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is intended to be #include'd multiple times to extract information +// about tokens for various clients in the lexer. +// +//===----------------------------------------------------------------------===// + +#if !defined(TOK_MARKER) && !defined(TOK_IDENTIFIER) && \ + !defined(TOK_LITERAL) && !defined(TOK_PUNCTUATION) && \ + !defined(TOK_KEYWORD) +#error Must define one of the TOK_ macros. +#endif + +#ifndef TOK_MARKER +#define TOK_MARKER(X) +#endif +#ifndef TOK_IDENTIFIER +#define TOK_IDENTIFIER(NAME) +#endif +#ifndef TOK_LITERAL +#define TOK_LITERAL(NAME) +#endif +#ifndef TOK_PUNCTUATION +#define TOK_PUNCTUATION(NAME, SPELLING) +#endif +#ifndef TOK_KEYWORD +#define TOK_KEYWORD(SPELLING) +#endif + +// Markers +TOK_MARKER(eof) +TOK_MARKER(error) +TOK_MARKER(code_complete) + +// Identifiers. +TOK_IDENTIFIER(bare_identifier) // foo +TOK_IDENTIFIER(at_identifier) // @foo +TOK_IDENTIFIER(hash_identifier) // #foo +TOK_IDENTIFIER(percent_identifier) // %foo +TOK_IDENTIFIER(caret_identifier) // ^foo +TOK_IDENTIFIER(exclamation_identifier) // !foo + +// Literals +TOK_LITERAL(floatliteral) // 2.0 +TOK_LITERAL(integer) // 42 +TOK_LITERAL(string) // "foo" +TOK_LITERAL(inttype) // i4, si8, ui16 + +// Punctuation. +TOK_PUNCTUATION(arrow, "->") +TOK_PUNCTUATION(at, "@") +TOK_PUNCTUATION(colon, ":") +TOK_PUNCTUATION(comma, ",") +TOK_PUNCTUATION(ellipsis, "...") +TOK_PUNCTUATION(equal, "=") +TOK_PUNCTUATION(greater, ">") +TOK_PUNCTUATION(l_brace, "{") +TOK_PUNCTUATION(l_paren, "(") +TOK_PUNCTUATION(l_square, "[") +TOK_PUNCTUATION(less, "<") +TOK_PUNCTUATION(minus, "-") +TOK_PUNCTUATION(plus, "+") +TOK_PUNCTUATION(question, "?") +TOK_PUNCTUATION(r_brace, "}") +TOK_PUNCTUATION(r_paren, ")") +TOK_PUNCTUATION(r_square, "]") +TOK_PUNCTUATION(star, "*") +TOK_PUNCTUATION(vertical_bar, "|") + +TOK_PUNCTUATION(file_metadata_begin, "{-#") +TOK_PUNCTUATION(file_metadata_end, "#-}") + +// Keywords. These turn "foo" into Token::kw_foo enums. + +// NOTE: Please key these alphabetized to make it easier to find something in +// this list and to cater to OCD. +TOK_KEYWORD(affine_map) +TOK_KEYWORD(affine_set) +TOK_KEYWORD(array) +TOK_KEYWORD(attributes) +TOK_KEYWORD(bf16) +TOK_KEYWORD(ceildiv) +TOK_KEYWORD(complex) +TOK_KEYWORD(dense) +TOK_KEYWORD(dense_resource) +TOK_KEYWORD(distinct) +TOK_KEYWORD(f16) +TOK_KEYWORD(f32) +TOK_KEYWORD(f64) +TOK_KEYWORD(f80) +TOK_KEYWORD(f8E5M2) +TOK_KEYWORD(f8E4M3FN) +TOK_KEYWORD(f8E5M2FNUZ) +TOK_KEYWORD(f8E4M3FNUZ) +TOK_KEYWORD(f8E4M3B11FNUZ) +TOK_KEYWORD(f128) +TOK_KEYWORD(false) +TOK_KEYWORD(floordiv) +TOK_KEYWORD(for) +TOK_KEYWORD(func) +TOK_KEYWORD(index) +TOK_KEYWORD(loc) +TOK_KEYWORD(max) +TOK_KEYWORD(memref) +TOK_KEYWORD(min) +TOK_KEYWORD(mod) +TOK_KEYWORD(none) +TOK_KEYWORD(offset) +TOK_KEYWORD(size) +TOK_KEYWORD(sparse) +TOK_KEYWORD(step) +TOK_KEYWORD(strided) +TOK_KEYWORD(symbol) +TOK_KEYWORD(tensor) +TOK_KEYWORD(tf32) +TOK_KEYWORD(to) +TOK_KEYWORD(true) +TOK_KEYWORD(tuple) +TOK_KEYWORD(type) +TOK_KEYWORD(unit) +TOK_KEYWORD(vector) + +#undef TOK_MARKER +#undef TOK_IDENTIFIER +#undef TOK_LITERAL +#undef TOK_PUNCTUATION +#undef TOK_KEYWORD diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/GPUToNVVMGen/GPUToNVVM.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/GPUToNVVMGen/GPUToNVVM.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..7689537d136ad0d4b25c3d71c7270ad6cd8c977a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/GPUToNVVMGen/GPUToNVVM.cpp.inc @@ -0,0 +1,41 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Rewriters *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: GPUToNVVM.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/* Generated from: + external/llvm-project/mlir/lib/Conversion/GPUToNVVM/GPUToNVVM.td:20 +*/ +struct GeneratedConvert0 : public ::mlir::RewritePattern { + GeneratedConvert0(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("gpu.barrier", 1, context, {"nvvm.barrier0"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::gpu::BarrierOp>(op0); (void)castedOp0; + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::mlir::NVVM::Barrier0Op tblgen_Barrier0Op_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + tblgen_Barrier0Op_0 = rewriter.create<::mlir::NVVM::Barrier0Op>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + rewriter.eraseOp(op0); + return ::mlir::success(); + }; +}; + +void LLVM_ATTRIBUTE_UNUSED populateWithGenerated(::mlir::RewritePatternSet &patterns) { + patterns.add(patterns.getContext()); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/GPUToROCDLTGen/GPUToROCDL.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/GPUToROCDLTGen/GPUToROCDL.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..605b44ca606f0b3a3419c4fd81fb2ea20467794e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/GPUToROCDLTGen/GPUToROCDL.cpp.inc @@ -0,0 +1,41 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Rewriters *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: GPUToROCDL.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/* Generated from: + external/llvm-project/mlir/lib/Conversion/GPUToROCDL/GPUToROCDL.td:20 +*/ +struct GeneratedConvert0 : public ::mlir::RewritePattern { + GeneratedConvert0(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("gpu.barrier", 1, context, {"rocdl.barrier"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::gpu::BarrierOp>(op0); (void)castedOp0; + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::mlir::ROCDL::BarrierOp tblgen_BarrierOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + tblgen_BarrierOp_0 = rewriter.create<::mlir::ROCDL::BarrierOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + rewriter.eraseOp(op0); + return ::mlir::success(); + }; +}; + +void LLVM_ATTRIBUTE_UNUSED populateWithGenerated(::mlir::RewritePatternSet &patterns) { + patterns.add(patterns.getContext()); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/MLIRShapeCanonicalizationIncGen/ShapeCanonicalization.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/MLIRShapeCanonicalizationIncGen/ShapeCanonicalization.inc new file mode 100644 index 0000000000000000000000000000000000000000..6703867d20387f58528d33d6353e9c55b462f937 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/MLIRShapeCanonicalizationIncGen/ShapeCanonicalization.inc @@ -0,0 +1,384 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Rewriters *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ShapeCanonicalization.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td:22 +*/ +struct AssumingAllOneOp : public ::mlir::RewritePattern { + AssumingAllOneOp(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("shape.assuming_all", 1, context, {}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range args(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::shape::AssumingAllOp>(op0); (void)castedOp0; + args = castedOp0.getODSOperands(0); + if (!(( + args.size() == 1 + ))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'args' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ args }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td:26 +*/ +struct CstrBroadcastableEqOps : public ::mlir::RewritePattern { + CstrBroadcastableEqOps(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("shape.cstr_broadcastable", 1, context, {"shape.const_witness"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range shapes(op0->getOperands()); + ::mlir::shape::CstrBroadcastableOp op; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::shape::CstrBroadcastableOp>(op0); (void)castedOp0; + op = castedOp0; + shapes = castedOp0.getODSOperands(0); + if (!(( + llvm::all_equal(shapes) + ))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'shapes' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::shape::ConstWitnessOp tblgen_ConstWitnessOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + if (auto tmpAttr = rewriter.getBoolAttr(true)) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("passing"), tmpAttr); + } + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ConstWitnessOp_0 = rewriter.create<::mlir::shape::ConstWitnessOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ConstWitnessOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td:30 +*/ +struct CstrEqEqOps : public ::mlir::RewritePattern { + CstrEqEqOps(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("shape.cstr_eq", 1, context, {"shape.const_witness"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range shapes(op0->getOperands()); + ::mlir::shape::CstrEqOp op; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::shape::CstrEqOp>(op0); (void)castedOp0; + op = castedOp0; + shapes = castedOp0.getODSOperands(0); + if (!(( + llvm::all_equal(shapes) + ))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'shapes' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::shape::ConstWitnessOp tblgen_ConstWitnessOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + if (auto tmpAttr = rewriter.getBoolAttr(true)) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("passing"), tmpAttr); + } + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ConstWitnessOp_0 = rewriter.create<::mlir::shape::ConstWitnessOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ConstWitnessOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td:50 +*/ +struct ExtractFromShapeOfExtentTensor : public ::mlir::RewritePattern { + ExtractFromShapeOfExtentTensor(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("tensor.extract", 2, context, {"tensor.dim"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range indices(op0->getOperands()); + ::mlir::Operation::operand_range arg(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::tensor::ExtractOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::shape::ShapeOfOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::shape::ShapeOfOp type"; + }); + } + arg = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + indices = castedOp0.getODSOperands(1); + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = indices.front(); (void)nativeVar_0; + ::mlir::tensor::DimOp tblgen_DimOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*arg.begin())); + tblgen_values.push_back(nativeVar_0); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_DimOp_1 = rewriter.create<::mlir::tensor::DimOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_DimOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td:34 +*/ +struct IndexToSizeToIndexCanonicalization : public ::mlir::RewritePattern { + IndexToSizeToIndexCanonicalization(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("shape.size_to_index", 2, context, {}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range arg(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::shape::SizeToIndexOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::shape::IndexToSizeOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::shape::IndexToSizeOp type"; + }); + } + arg = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ arg }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td:38 +*/ +struct SizeToIndexToSizeCanonicalization : public ::mlir::RewritePattern { + SizeToIndexToSizeCanonicalization(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("shape.index_to_size", 2, context, {}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range arg(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::shape::IndexToSizeOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::shape::SizeToIndexOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::shape::SizeToIndexOp type"; + }); + } + arg = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ arg }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td:44 +*/ +struct TensorCastConstShape : public ::mlir::RewritePattern { + TensorCastConstShape(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("tensor.cast", 2, context, {"shape.const_shape"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::DenseIntElementsAttr arg; + ::mlir::tensor::CastOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::tensor::CastOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::shape::ConstShapeOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::shape::ConstShapeOp type"; + }); + } + { + auto tblgen_attr = op1->getAttrOfType<::mlir::DenseIntElementsAttr>("shape");(void)tblgen_attr; + if (!(tblgen_attr)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "expected op 'shape.const_shape' to have attribute 'shape' of type '::mlir::DenseIntElementsAttr'"; + }); + } + arg = tblgen_attr; + } + tblgen_ops.push_back(op1); + } + if (!(( + ::llvm::dyn_cast((*res.getODSResults(0).begin()).getType()).hasStaticShape() + ))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::shape::ConstShapeOp tblgen_ConstShapeOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + if (auto tmpAttr = arg) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("shape"), tmpAttr); + } + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ConstShapeOp_0 = rewriter.create<::mlir::shape::ConstShapeOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ConstShapeOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +void LLVM_ATTRIBUTE_UNUSED populateWithGenerated(::mlir::RewritePatternSet &patterns) { + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/ShapeToStandardGen/ShapeToStandard.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/ShapeToStandardGen/ShapeToStandard.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..64dcfef0ba0bbe0d2d987f803a8018968f1af486 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/_virtual_includes/ShapeToStandardGen/ShapeToStandard.cpp.inc @@ -0,0 +1,127 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Rewriters *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ShapeToStandard.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/* Generated from: + external/llvm-project/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.td:23 +*/ +struct CstrBroadcastableToRequire : public ::mlir::RewritePattern { + CstrBroadcastableToRequire(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("shape.cstr_broadcastable", 1, context, {"shape.cstr_require", "shape.is_broadcastable"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range shapes(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::shape::CstrBroadcastableOp>(op0); (void)castedOp0; + shapes = castedOp0.getODSOperands(0); + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::shape::IsBroadcastableOp tblgen_IsBroadcastableOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values_0; + for (auto v: shapes) { + tblgen_values_0.push_back(v); + } + tblgen_IsBroadcastableOp_0 = rewriter.create<::mlir::shape::IsBroadcastableOp>(odsLoc, + /*shapes=*/tblgen_values_0 + ); + } + auto nativeVar_1 = + rewriter.getStringAttr("required broadcastable shapes") + ; (void)nativeVar_1; + ::mlir::shape::CstrRequireOp tblgen_CstrRequireOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_IsBroadcastableOp_0.getODSResults(0).begin())); + if (auto tmpAttr = nativeVar_1) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("msg"), tmpAttr); + } + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_CstrRequireOp_2 = rewriter.create<::mlir::shape::CstrRequireOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_CstrRequireOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.td:32 +*/ +struct CstrEqToRequire : public ::mlir::RewritePattern { + CstrEqToRequire(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("shape.cstr_eq", 1, context, {"shape.cstr_require", "shape.shape_eq"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range shapes(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::shape::CstrEqOp>(op0); (void)castedOp0; + shapes = castedOp0.getODSOperands(0); + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::shape::ShapeEqOp tblgen_ShapeEqOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values_0; + for (auto v: shapes) { + tblgen_values_0.push_back(v); + } + tblgen_ShapeEqOp_0 = rewriter.create<::mlir::shape::ShapeEqOp>(odsLoc, + /*shapes=*/tblgen_values_0 + ); + } + auto nativeVar_1 = + rewriter.getStringAttr("required equal shapes") + ; (void)nativeVar_1; + ::mlir::shape::CstrRequireOp tblgen_CstrRequireOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ShapeEqOp_0.getODSResults(0).begin())); + if (auto tmpAttr = nativeVar_1) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("msg"), tmpAttr); + } + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_CstrRequireOp_2 = rewriter.create<::mlir::shape::CstrRequireOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_CstrRequireOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +void LLVM_ATTRIBUTE_UNUSED populateWithGenerated(::mlir::RewritePatternSet &patterns) { + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/AliasAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/AliasAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..5beae79ad1a03a9cd06ff866e5ff307f2b8e3926 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/AliasAnalysis.h @@ -0,0 +1,284 @@ +//===- AliasAnalysis.h - Alias Analysis in MLIR -----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines utilities and analyses for performing alias queries +// and related memory queries in MLIR. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_ALIASANALYSIS_H_ +#define MLIR_ANALYSIS_ALIASANALYSIS_H_ + +#include "mlir/IR/Operation.h" + +namespace mlir { + +//===----------------------------------------------------------------------===// +// AliasResult +//===----------------------------------------------------------------------===// + +/// The possible results of an alias query. +class AliasResult { +public: + enum Kind { + /// The two locations do not alias at all. + /// + /// This value is arranged to convert to false, while all other values + /// convert to true. This allows a boolean context to convert the result to + /// a binary flag indicating whether there is the possibility of aliasing. + NoAlias = 0, + /// The two locations may or may not alias. This is the least precise + /// result. + MayAlias, + /// The two locations alias, but only due to a partial overlap. + PartialAlias, + /// The two locations precisely alias each other. + MustAlias, + }; + + AliasResult(Kind kind) : kind(kind) {} + bool operator==(const AliasResult &other) const { return kind == other.kind; } + bool operator!=(const AliasResult &other) const { return !(*this == other); } + + /// Allow conversion to bool to signal if there is an aliasing or not. + explicit operator bool() const { return kind != NoAlias; } + + /// Merge this alias result with `other` and return a new result that + /// represents the conservative merge of both results. If the results + /// represent a known alias, the stronger alias is chosen (i.e. + /// Partial+Must=Must). If the two results are conflicting, MayAlias is + /// returned. + AliasResult merge(AliasResult other) const; + + /// Returns if this result indicates no possibility of aliasing. + bool isNo() const { return kind == NoAlias; } + + /// Returns if this result is a may alias. + bool isMay() const { return kind == MayAlias; } + + /// Returns if this result is a must alias. + bool isMust() const { return kind == MustAlias; } + + /// Returns if this result is a partial alias. + bool isPartial() const { return kind == PartialAlias; } + + /// Print this alias result to the provided output stream. + void print(raw_ostream &os) const; + +private: + /// The internal kind of the result. + Kind kind; +}; + +inline raw_ostream &operator<<(raw_ostream &os, const AliasResult &result) { + result.print(os); + return os; +} + +//===----------------------------------------------------------------------===// +// ModRefResult +//===----------------------------------------------------------------------===// + +/// The possible results of whether a memory access modifies or references +/// a memory location. The possible results are: no access at all, a +/// modification, a reference, or both a modification and a reference. +class [[nodiscard]] ModRefResult { + /// Note: This is a simplified version of the ModRefResult in + /// `llvm/Analysis/AliasAnalysis.h`, and namely removes the `Must` concept. If + /// this becomes useful/necessary we should add it here. + enum class Kind { + /// The access neither references nor modifies the value stored in memory. + NoModRef = 0, + /// The access may reference the value stored in memory. + Ref = 1, + /// The access may modify the value stored in memory. + Mod = 2, + /// The access may reference and may modify the value stored in memory. + ModRef = Ref | Mod, + }; + +public: + bool operator==(const ModRefResult &rhs) const { return kind == rhs.kind; } + bool operator!=(const ModRefResult &rhs) const { return !(*this == rhs); } + + /// Return a new result that indicates that the memory access neither + /// references nor modifies the value stored in memory. + static ModRefResult getNoModRef() { return Kind::NoModRef; } + + /// Return a new result that indicates that the memory access may reference + /// the value stored in memory. + static ModRefResult getRef() { return Kind::Ref; } + + /// Return a new result that indicates that the memory access may modify the + /// value stored in memory. + static ModRefResult getMod() { return Kind::Mod; } + + /// Return a new result that indicates that the memory access may reference + /// and may modify the value stored in memory. + static ModRefResult getModAndRef() { return Kind::ModRef; } + + /// Returns if this result does not modify or reference memory. + [[nodiscard]] bool isNoModRef() const { return kind == Kind::NoModRef; } + + /// Returns if this result modifies memory. + [[nodiscard]] bool isMod() const { + return static_cast(kind) & static_cast(Kind::Mod); + } + + /// Returns if this result references memory. + [[nodiscard]] bool isRef() const { + return static_cast(kind) & static_cast(Kind::Ref); + } + + /// Returns if this result modifies *or* references memory. + [[nodiscard]] bool isModOrRef() const { return kind != Kind::NoModRef; } + + /// Returns if this result modifies *and* references memory. + [[nodiscard]] bool isModAndRef() const { return kind == Kind::ModRef; } + + /// Merge this ModRef result with `other` and return the result. + ModRefResult merge(const ModRefResult &other) { + return ModRefResult(static_cast(static_cast(kind) | + static_cast(other.kind))); + } + /// Intersect this ModRef result with `other` and return the result. + ModRefResult intersect(const ModRefResult &other) { + return ModRefResult(static_cast(static_cast(kind) & + static_cast(other.kind))); + } + + /// Print this ModRef result to the provided output stream. + void print(raw_ostream &os) const; + +private: + ModRefResult(Kind kind) : kind(kind) {} + + /// The internal kind of the result. + Kind kind; +}; + +inline raw_ostream &operator<<(raw_ostream &os, const ModRefResult &result) { + result.print(os); + return os; +} + +//===----------------------------------------------------------------------===// +// AliasAnalysisTraits +//===----------------------------------------------------------------------===// + +namespace detail { +/// This class contains various internal trait classes used by the main +/// AliasAnalysis class below. +struct AliasAnalysisTraits { + /// This class represents the `Concept` of an alias analysis implementation. + /// It is the abstract base class used by the AliasAnalysis class for + /// querying into derived analysis implementations. + class Concept { + public: + virtual ~Concept() = default; + + /// Given two values, return their aliasing behavior. + virtual AliasResult alias(Value lhs, Value rhs) = 0; + + /// Return the modify-reference behavior of `op` on `location`. + virtual ModRefResult getModRef(Operation *op, Value location) = 0; + }; + + /// This class represents the `Model` of an alias analysis implementation + /// `ImplT`. A model is instantiated for each alias analysis implementation + /// to implement the `Concept` without the need for the derived + /// implementation to inherit from the `Concept` class. + template + class Model final : public Concept { + public: + explicit Model(ImplT &&impl) : impl(std::forward(impl)) {} + ~Model() override = default; + + /// Given two values, return their aliasing behavior. + AliasResult alias(Value lhs, Value rhs) final { + return impl.alias(lhs, rhs); + } + + /// Return the modify-reference behavior of `op` on `location`. + ModRefResult getModRef(Operation *op, Value location) final { + return impl.getModRef(op, location); + } + + private: + ImplT impl; + }; +}; +} // namespace detail + +//===----------------------------------------------------------------------===// +// AliasAnalysis +//===----------------------------------------------------------------------===// + +/// This class represents the main alias analysis interface in MLIR. It +/// functions as an aggregate of various different alias analysis +/// implementations. This aggregation allows for utilizing the strengths of +/// different alias analysis implementations that either target or have access +/// to different aliasing information. This is especially important for MLIR +/// given the scope of different types of memory models and aliasing behaviors. +/// For users of this analysis that want to perform aliasing queries, see the +/// `Alias Queries` section below for the available methods. For users of this +/// analysis that want to add a new alias analysis implementation to the +/// aggregate, see the `Alias Implementations` section below. +class AliasAnalysis { + using Concept = detail::AliasAnalysisTraits::Concept; + template + using Model = detail::AliasAnalysisTraits::Model; + +public: + AliasAnalysis(Operation *op); + + //===--------------------------------------------------------------------===// + // Alias Implementations + //===--------------------------------------------------------------------===// + + /// Add a new alias analysis implementation `AnalysisT` to this analysis + /// aggregate. This allows for users to access this implementation when + /// performing alias queries. Implementations added here must provide the + /// following: + /// * AnalysisT(AnalysisT &&) + /// * AliasResult alias(Value lhs, Value rhs) + /// - This method returns an `AliasResult` that corresponds to the + /// aliasing behavior between `lhs` and `rhs`. The conservative "I don't + /// know" result of this method should be MayAlias. + /// * ModRefResult getModRef(Operation *op, Value location) + /// - This method returns a `ModRefResult` that corresponds to the + /// modify-reference behavior of `op` on the given `location`. The + /// conservative "I don't know" result of this method should be ModRef. + template + void addAnalysisImplementation(AnalysisT &&analysis) { + aliasImpls.push_back( + std::make_unique>(std::forward(analysis))); + } + + //===--------------------------------------------------------------------===// + // Alias Queries + //===--------------------------------------------------------------------===// + + /// Given two values, return their aliasing behavior. + AliasResult alias(Value lhs, Value rhs); + + //===--------------------------------------------------------------------===// + // ModRef Queries + //===--------------------------------------------------------------------===// + + /// Return the modify-reference behavior of `op` on `location`. + ModRefResult getModRef(Operation *op, Value location); + +private: + /// A set of internal alias analysis implementations. + SmallVector, 4> aliasImpls; +}; + +} // namespace mlir + +#endif // MLIR_ANALYSIS_ALIASANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/AliasAnalysis/LocalAliasAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/AliasAnalysis/LocalAliasAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..a9b4d5b2b66e52990dcab7f5b16faf2cf592db92 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/AliasAnalysis/LocalAliasAnalysis.h @@ -0,0 +1,40 @@ +//===- LocalAliasAnalysis.h - Local Stateless Alias Analysis ----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains the implementation of a local stateless alias analysis. +// This analysis walks from the values being compared to determine their +// potential for aliasing. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_ALIASANALYSIS_LOCALALIASANALYSIS_H_ +#define MLIR_ANALYSIS_ALIASANALYSIS_LOCALALIASANALYSIS_H_ + +#include "mlir/Analysis/AliasAnalysis.h" + +namespace mlir { +/// This class implements a local form of alias analysis that tries to identify +/// the underlying values addressed by each value and performs a few basic +/// checks to see if they alias. +class LocalAliasAnalysis { +public: + virtual ~LocalAliasAnalysis() = default; + + /// Given two values, return their aliasing behavior. + AliasResult alias(Value lhs, Value rhs); + + /// Return the modify-reference behavior of `op` on `location`. + ModRefResult getModRef(Operation *op, Value location); + +protected: + /// Given the two values, return their aliasing behavior. + virtual AliasResult aliasImpl(Value lhs, Value rhs); +}; +} // namespace mlir + +#endif // MLIR_ANALYSIS_ALIASANALYSIS_LOCALALIASANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/CFGLoopInfo.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/CFGLoopInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..41e75021942c6a4ff3f545771f146c7462cd8d8d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/CFGLoopInfo.h @@ -0,0 +1,56 @@ +//===- CFGLoopInfo.h - LoopInfo analysis for region bodies ------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the CFGLoopInfo analysis for MLIR. The CFGLoopInfo is used +// to identify natural loops and determine the loop depth of various nodes of a +// CFG. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_LOOPINFO_H +#define MLIR_ANALYSIS_LOOPINFO_H + +#include "mlir/IR/Dominance.h" +#include "mlir/IR/RegionGraphTraits.h" +#include "llvm/Support/GenericLoopInfo.h" + +namespace mlir { +class CFGLoop; +class CFGLoopInfo; +} // namespace mlir + +namespace llvm { +// Implementation in LLVM's LoopInfoImpl.h +extern template class LoopBase; +extern template class LoopInfoBase; +} // namespace llvm + +namespace mlir { + +/// Representation of a single loop formed by blocks. The inherited LoopBase +/// class provides accessors to the loop analysis. +class CFGLoop : public llvm::LoopBase { +private: + explicit CFGLoop(mlir::Block *block); + + friend class llvm::LoopBase; + friend class llvm::LoopInfoBase; +}; + +/// An LLVM LoopInfo instantiation for MLIR that provides access to CFG loops +/// found in the dominator tree. +class CFGLoopInfo : public llvm::LoopInfoBase { +public: + CFGLoopInfo(const llvm::DominatorTreeBase &domTree); +}; + +raw_ostream &operator<<(raw_ostream &os, mlir::Block &block); + +} // namespace mlir + +#endif // MLIR_ANALYSIS_LOOPINFO_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/CallGraph.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/CallGraph.h new file mode 100644 index 0000000000000000000000000000000000000000..631cdd1ad229092e5205135d00f4e59d18b717e3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/CallGraph.h @@ -0,0 +1,267 @@ +//===- CallGraph.h - CallGraph analysis for MLIR ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains an analysis for computing the multi-level callgraph from a +// given top-level operation. This nodes within this callgraph are defined by +// the `CallOpInterface` and `CallableOpInterface` operation interfaces defined +// in CallInterface.td. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_CALLGRAPH_H +#define MLIR_ANALYSIS_CALLGRAPH_H + +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/GraphTraits.h" +#include "llvm/ADT/MapVector.h" +#include "llvm/ADT/PointerIntPair.h" +#include "llvm/ADT/SetVector.h" + +namespace mlir { +class CallOpInterface; +struct CallInterfaceCallable; +class Operation; +class Region; +class SymbolTableCollection; + +//===----------------------------------------------------------------------===// +// CallGraphNode +//===----------------------------------------------------------------------===// + +/// This class represents a single callable in the callgraph. Aside from the +/// external node, each node represents a callable node in the graph and +/// contains a valid corresponding Region. The external node is a virtual node +/// used to represent external edges into, and out of, the callgraph. +class CallGraphNode { +public: + /// This class represents a directed edge between two nodes in the callgraph. + class Edge { + enum class Kind { + // An 'Abstract' edge represents an opaque, non-operation, reference + // between this node and the target. Edges of this type are only valid + // from the external node, as there is no valid connection to an operation + // in the module. + Abstract, + + // A 'Call' edge represents a direct reference to the target node via a + // call-like operation within the callable region of this node. + Call, + + // A 'Child' edge is used when the region of target node is defined inside + // of the callable region of this node. This means that the region of this + // node is an ancestor of the region for the target node. As such, this + // edge cannot be used on the 'external' node. + Child, + }; + + public: + /// Returns true if this edge represents an `Abstract` edge. + bool isAbstract() const { return targetAndKind.getInt() == Kind::Abstract; } + + /// Returns true if this edge represents a `Call` edge. + bool isCall() const { return targetAndKind.getInt() == Kind::Call; } + + /// Returns true if this edge represents a `Child` edge. + bool isChild() const { return targetAndKind.getInt() == Kind::Child; } + + /// Returns the target node for this edge. + CallGraphNode *getTarget() const { return targetAndKind.getPointer(); } + + bool operator==(const Edge &edge) const { + return targetAndKind == edge.targetAndKind; + } + + private: + Edge(CallGraphNode *node, Kind kind) : targetAndKind(node, kind) {} + explicit Edge(llvm::PointerIntPair targetAndKind) + : targetAndKind(targetAndKind) {} + + /// The target node of this edge, as well as the edge kind. + llvm::PointerIntPair targetAndKind; + + // Provide access to the constructor and Kind. + friend class CallGraphNode; + }; + + /// Returns true if this node is an external node. + bool isExternal() const; + + /// Returns the callable region this node represents. This can only be called + /// on non-external nodes. + Region *getCallableRegion() const; + + /// Adds an abstract reference edge to the given node. An abstract edge does + /// not come from any observable operations, so this is only valid on the + /// external node. + void addAbstractEdge(CallGraphNode *node); + + /// Add an outgoing call edge from this node. + void addCallEdge(CallGraphNode *node); + + /// Adds a reference edge to the given child node. + void addChildEdge(CallGraphNode *child); + + /// Iterator over the outgoing edges of this node. + using iterator = SmallVectorImpl::const_iterator; + iterator begin() const { return edges.begin(); } + iterator end() const { return edges.end(); } + + /// Returns true if this node has any child edges. + bool hasChildren() const; + +private: + /// DenseMap info for callgraph edges. + struct EdgeKeyInfo { + using BaseInfo = + DenseMapInfo>; + + static Edge getEmptyKey() { return Edge(BaseInfo::getEmptyKey()); } + static Edge getTombstoneKey() { return Edge(BaseInfo::getTombstoneKey()); } + static unsigned getHashValue(const Edge &edge) { + return BaseInfo::getHashValue(edge.targetAndKind); + } + static bool isEqual(const Edge &lhs, const Edge &rhs) { return lhs == rhs; } + }; + + CallGraphNode(Region *callableRegion) : callableRegion(callableRegion) {} + + /// Add an edge to 'node' with the given kind. + void addEdge(CallGraphNode *node, Edge::Kind kind); + + /// The callable region defines the boundary of the call graph node. This is + /// the region referenced by 'call' operations. This is at a per-region + /// boundary as operations may define multiple callable regions. + Region *callableRegion; + + /// A set of out-going edges from this node to other nodes in the graph. + SetVector, + llvm::SmallDenseSet> + edges; + + // Provide access to private methods. + friend class CallGraph; +}; + +//===----------------------------------------------------------------------===// +// CallGraph +//===----------------------------------------------------------------------===// + +class CallGraph { + using NodeMapT = llvm::MapVector>; + + /// This class represents an iterator over the internal call graph nodes. This + /// class unwraps the map iterator to access the raw node. + class NodeIterator final + : public llvm::mapped_iterator< + NodeMapT::const_iterator, + CallGraphNode *(*)(const NodeMapT::value_type &)> { + static CallGraphNode *unwrap(const NodeMapT::value_type &value) { + return value.second.get(); + } + + public: + /// Initializes the result type iterator to the specified result iterator. + NodeIterator(NodeMapT::const_iterator it) + : llvm::mapped_iterator< + NodeMapT::const_iterator, + CallGraphNode *(*)(const NodeMapT::value_type &)>(it, &unwrap) {} + }; + +public: + CallGraph(Operation *op); + + /// Get or add a call graph node for the given region. `parentNode` + /// corresponds to the direct node in the callgraph that contains the parent + /// operation of `region`, or nullptr if there is no parent node. + CallGraphNode *getOrAddNode(Region *region, CallGraphNode *parentNode); + + /// Lookup a call graph node for the given region, or nullptr if none is + /// registered. + CallGraphNode *lookupNode(Region *region) const; + + /// Return the callgraph node representing an external caller. + CallGraphNode *getExternalCallerNode() const { + return const_cast(&externalCallerNode); + } + + /// Return the callgraph node representing an indirect callee. + CallGraphNode *getUnknownCalleeNode() const { + return const_cast(&unknownCalleeNode); + } + + /// Resolve the callable for given callee to a node in the callgraph, or the + /// external node if a valid node was not resolved. The provided symbol table + /// is used when resolving calls that reference callables via a symbol + /// reference. + CallGraphNode *resolveCallable(CallOpInterface call, + SymbolTableCollection &symbolTable) const; + + /// Erase the given node from the callgraph. + void eraseNode(CallGraphNode *node); + + /// An iterator over the nodes of the graph. + using iterator = NodeIterator; + iterator begin() const { return nodes.begin(); } + iterator end() const { return nodes.end(); } + + /// Dump the graph in a human readable format. + void dump() const; + void print(raw_ostream &os) const; + +private: + /// The set of nodes within the callgraph. + NodeMapT nodes; + + /// A special node used to indicate an external caller. + CallGraphNode externalCallerNode; + + /// A special node used to indicate an unknown callee. + CallGraphNode unknownCalleeNode; +}; + +} // namespace mlir + +namespace llvm { +// Provide graph traits for traversing call graphs using standard graph +// traversals. +template <> +struct GraphTraits { + using NodeRef = mlir::CallGraphNode *; + static NodeRef getEntryNode(NodeRef node) { return node; } + + static NodeRef unwrap(const mlir::CallGraphNode::Edge &edge) { + return edge.getTarget(); + } + + // ChildIteratorType/begin/end - Allow iteration over all nodes in the graph. + using ChildIteratorType = + mapped_iterator; + static ChildIteratorType child_begin(NodeRef node) { + return {node->begin(), &unwrap}; + } + static ChildIteratorType child_end(NodeRef node) { + return {node->end(), &unwrap}; + } +}; + +template <> +struct GraphTraits + : public GraphTraits { + /// The entry node into the graph is the external node. + static NodeRef getEntryNode(const mlir::CallGraph *cg) { + return cg->getExternalCallerNode(); + } + + // nodes_iterator/begin/end - Allow iteration over all nodes in the graph + using nodes_iterator = mlir::CallGraph::iterator; + static nodes_iterator nodes_begin(mlir::CallGraph *cg) { return cg->begin(); } + static nodes_iterator nodes_end(mlir::CallGraph *cg) { return cg->end(); } +}; +} // namespace llvm + +#endif // MLIR_ANALYSIS_CALLGRAPH_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..1bf991dc193874b99b61f199ea703b7f7dc106f8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h @@ -0,0 +1,114 @@ +//===- ConstantPropagationAnalysis.h - Constant propagation analysis ------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements constant propagation analysis. In this file are defined +// the lattice value class that represents constant values in the program and +// a sparse constant propagation analysis that uses operation folders to +// speculate about constant values in the program. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_DATAFLOW_CONSTANTPROPAGATIONANALYSIS_H +#define MLIR_ANALYSIS_DATAFLOW_CONSTANTPROPAGATIONANALYSIS_H + +#include "mlir/Analysis/DataFlow/SparseAnalysis.h" +#include + +namespace mlir { +namespace dataflow { + +//===----------------------------------------------------------------------===// +// ConstantValue +//===----------------------------------------------------------------------===// + +/// This lattice value represents a known constant value of a lattice. +class ConstantValue { +public: + /// Construct a constant value as uninitialized. + explicit ConstantValue() = default; + + /// Construct a constant value with a known constant. + explicit ConstantValue(Attribute constant, Dialect *dialect) + : constant(constant), dialect(dialect) {} + + /// Get the constant value. Returns null if no value was determined. + Attribute getConstantValue() const { + assert(!isUninitialized()); + return *constant; + } + + /// Get the dialect instance that can be used to materialize the constant. + Dialect *getConstantDialect() const { + assert(!isUninitialized()); + return dialect; + } + + /// Compare the constant values. + bool operator==(const ConstantValue &rhs) const { + return constant == rhs.constant; + } + + /// Print the constant value. + void print(raw_ostream &os) const; + + /// The state where the constant value is uninitialized. This happens when the + /// state hasn't been set during the analysis. + static ConstantValue getUninitialized() { return ConstantValue{}; } + + /// Whether the state is uninitialized. + bool isUninitialized() const { return !constant.has_value(); } + + /// The state where the constant value is unknown. + static ConstantValue getUnknownConstant() { + return ConstantValue{/*constant=*/nullptr, /*dialect=*/nullptr}; + } + + /// The union with another constant value is null if they are different, and + /// the same if they are the same. + static ConstantValue join(const ConstantValue &lhs, + const ConstantValue &rhs) { + if (lhs.isUninitialized()) + return rhs; + if (rhs.isUninitialized()) + return lhs; + if (lhs == rhs) + return lhs; + return getUnknownConstant(); + } + +private: + /// The constant value. + std::optional constant; + /// A dialect instance that can be used to materialize the constant. + Dialect *dialect = nullptr; +}; + +//===----------------------------------------------------------------------===// +// SparseConstantPropagation +//===----------------------------------------------------------------------===// + +/// This analysis implements sparse constant propagation, which attempts to +/// determine constant-valued results for operations using constant-valued +/// operands, by speculatively folding operations. When combined with dead-code +/// analysis, this becomes sparse conditional constant propagation (SCCP). +class SparseConstantPropagation + : public SparseForwardDataFlowAnalysis> { +public: + using SparseForwardDataFlowAnalysis::SparseForwardDataFlowAnalysis; + + void visitOperation(Operation *op, + ArrayRef *> operands, + ArrayRef *> results) override; + + void setToEntryState(Lattice *lattice) override; +}; + +} // end namespace dataflow +} // end namespace mlir + +#endif // MLIR_ANALYSIS_DATAFLOW_CONSTANTPROPAGATIONANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..7a6fea8326a58b8b5efc2feb4acfa6ed50d3a771 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h @@ -0,0 +1,240 @@ +//===- DeadCodeAnalysis.h - Dead code analysis ----------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements dead code analysis using the data-flow analysis +// framework. This analysis uses the results of constant propagation to +// determine live blocks, control-flow edges, and control-flow predecessors. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_DATAFLOW_DEADCODEANALYSIS_H +#define MLIR_ANALYSIS_DATAFLOW_DEADCODEANALYSIS_H + +#include "mlir/Analysis/DataFlowFramework.h" +#include "mlir/IR/SymbolTable.h" +#include "llvm/ADT/SmallPtrSet.h" +#include + +namespace mlir { + +class CallOpInterface; +class CallableOpInterface; +class BranchOpInterface; +class RegionBranchOpInterface; +class RegionBranchTerminatorOpInterface; + +namespace dataflow { + +//===----------------------------------------------------------------------===// +// Executable +//===----------------------------------------------------------------------===// + +/// This is a simple analysis state that represents whether the associated +/// program point (either a block or a control-flow edge) is live. +class Executable : public AnalysisState { +public: + using AnalysisState::AnalysisState; + + /// Set the state of the program point to live. + ChangeResult setToLive(); + + /// Get whether the program point is live. + bool isLive() const { return live; } + + /// Print the liveness. + void print(raw_ostream &os) const override; + + /// When the state of the program point is changed to live, re-invoke + /// subscribed analyses on the operations in the block and on the block + /// itself. + void onUpdate(DataFlowSolver *solver) const override; + + /// Subscribe an analysis to changes to the liveness. + void blockContentSubscribe(DataFlowAnalysis *analysis) { + subscribers.insert(analysis); + } + +private: + /// Whether the program point is live. Optimistically assume that the program + /// point is dead. + bool live = false; + + /// A set of analyses that should be updated when this state changes. + SetVector, + SmallPtrSet> + subscribers; +}; + +//===----------------------------------------------------------------------===// +// PredecessorState +//===----------------------------------------------------------------------===// + +/// This analysis state represents a set of live control-flow "predecessors" of +/// a program point (either an operation or a block), which are the last +/// operations along all execution paths that pass through this point. +/// +/// For example, in dead-code analysis, an operation with region control-flow +/// can be the predecessor of a region's entry block or itself, the exiting +/// terminator of a region can be the predecessor of the parent operation or +/// another region's entry block, the callsite of a callable operation can be +/// the predecessor to its entry block, and the exiting terminator or a callable +/// operation can be the predecessor of the call operation. +/// +/// The state can optionally contain information about which values are +/// propagated from each predecessor to the successor point. +/// +/// The state can indicate that it is underdefined, meaning that not all live +/// control-flow predecessors can be known. +class PredecessorState : public AnalysisState { +public: + using AnalysisState::AnalysisState; + + /// Print the known predecessors. + void print(raw_ostream &os) const override; + + /// Returns true if all predecessors are known. + bool allPredecessorsKnown() const { return allKnown; } + + /// Indicate that there are potentially unknown predecessors. + ChangeResult setHasUnknownPredecessors() { + return std::exchange(allKnown, false) ? ChangeResult::Change + : ChangeResult::NoChange; + } + + /// Get the known predecessors. + ArrayRef getKnownPredecessors() const { + return knownPredecessors.getArrayRef(); + } + + /// Get the successor inputs from a predecessor. + ValueRange getSuccessorInputs(Operation *predecessor) const { + return successorInputs.lookup(predecessor); + } + + /// Add a known predecessor. + ChangeResult join(Operation *predecessor); + + /// Add a known predecessor with successor inputs. + ChangeResult join(Operation *predecessor, ValueRange inputs); + +private: + /// Whether all predecessors are known. Optimistically assume that we know + /// all predecessors. + bool allKnown = true; + + /// The known control-flow predecessors of this program point. + SetVector, + SmallPtrSet> + knownPredecessors; + + /// The successor inputs when branching from a given predecessor. + DenseMap successorInputs; +}; + +//===----------------------------------------------------------------------===// +// CFGEdge +//===----------------------------------------------------------------------===// + +/// This program point represents a control-flow edge between a block and one +/// of its successors. +class CFGEdge + : public GenericProgramPointBase> { +public: + using Base::Base; + + /// Get the block from which the edge originates. + Block *getFrom() const { return getValue().first; } + /// Get the target block. + Block *getTo() const { return getValue().second; } + + /// Print the blocks between the control-flow edge. + void print(raw_ostream &os) const override; + /// Get a fused location of both blocks. + Location getLoc() const override; +}; + +//===----------------------------------------------------------------------===// +// DeadCodeAnalysis +//===----------------------------------------------------------------------===// + +/// Dead code analysis analyzes control-flow, as understood by +/// `RegionBranchOpInterface` and `BranchOpInterface`, and the callgraph, as +/// understood by `CallableOpInterface` and `CallOpInterface`. +/// +/// This analysis uses known constant values of operands to determine the +/// liveness of each block and each edge between a block and its predecessors. +/// For region control-flow, this analysis determines the predecessor operations +/// for region entry blocks and region control-flow operations. For the +/// callgraph, this analysis determines the callsites and live returns of every +/// function. +class DeadCodeAnalysis : public DataFlowAnalysis { +public: + explicit DeadCodeAnalysis(DataFlowSolver &solver); + + /// Initialize the analysis by visiting every operation with potential + /// control-flow semantics. + LogicalResult initialize(Operation *top) override; + + /// Visit an operation with control-flow semantics and deduce which of its + /// successors are live. + LogicalResult visit(ProgramPoint point) override; + +private: + /// Find and mark symbol callables with potentially unknown callsites as + /// having overdefined predecessors. `top` is the top-level operation that the + /// analysis is operating on. + void initializeSymbolCallables(Operation *top); + + /// Recursively Initialize the analysis on nested regions. + LogicalResult initializeRecursively(Operation *op); + + /// Visit the given call operation and compute any necessary lattice state. + void visitCallOperation(CallOpInterface call); + + /// Visit the given branch operation with successors and try to determine + /// which are live from the current block. + void visitBranchOperation(BranchOpInterface branch); + + /// Visit the given region branch operation, which defines regions, and + /// compute any necessary lattice state. This also resolves the lattice state + /// of both the operation results and any nested regions. + void visitRegionBranchOperation(RegionBranchOpInterface branch); + + /// Visit the given terminator operation that exits a region under an + /// operation with control-flow semantics. These are terminators with no CFG + /// successors. + void visitRegionTerminator(RegionBranchTerminatorOpInterface op, + RegionBranchOpInterface branch); + + /// Visit the given terminator operation that exits a callable region. These + /// are terminators with no CFG successors. + void visitCallableTerminator(Operation *op, CallableOpInterface callable); + + /// Mark the edge between `from` and `to` as executable. + void markEdgeLive(Block *from, Block *to); + + /// Mark the entry blocks of the operation as executable. + void markEntryBlocksLive(Operation *op); + + /// Get the constant values of the operands of the operation. Returns + /// std::nullopt if any of the operand lattices are uninitialized. + std::optional> getOperandValues(Operation *op); + + /// The top-level operation the analysis is running on. This is used to detect + /// if a callable is outside the scope of the analysis and thus must be + /// considered an external callable. + Operation *analysisScope; + + /// A symbol table used for O(1) symbol lookups during simplification. + SymbolTableCollection symbolTable; +}; + +} // end namespace dataflow +} // end namespace mlir + +#endif // MLIR_ANALYSIS_DATAFLOW_DEADCODEANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..6a1335bab8bf6e93ded06f507b774feb875922a3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h @@ -0,0 +1,522 @@ +//===- DenseAnalysis.h - Dense data-flow analysis -------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements dense data-flow analysis using the data-flow analysis +// framework. The analysis is forward and conditional and uses the results of +// dead code analysis to prune dead code during the analysis. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_DENSEDATAFLOWANALYSIS_H +#define MLIR_ANALYSIS_DENSEDATAFLOWANALYSIS_H + +#include "mlir/Analysis/DataFlowFramework.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/CallInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" + +namespace mlir { +namespace dataflow { + +//===----------------------------------------------------------------------===// +// CallControlFlowAction +//===----------------------------------------------------------------------===// + +/// Indicates whether the control enters or exits the callee. +enum class CallControlFlowAction { EnterCallee, ExitCallee }; + +//===----------------------------------------------------------------------===// +// AbstractDenseLattice +//===----------------------------------------------------------------------===// + +/// This class represents a dense lattice. A dense lattice is attached to +/// operations to represent the program state after their execution or to blocks +/// to represent the program state at the beginning of the block. A dense +/// lattice is propagated through the IR by dense data-flow analysis. +class AbstractDenseLattice : public AnalysisState { +public: + /// A dense lattice can only be created for operations and blocks. + using AnalysisState::AnalysisState; + + /// Join the lattice across control-flow or callgraph edges. + virtual ChangeResult join(const AbstractDenseLattice &rhs) { + return ChangeResult::NoChange; + } + + virtual ChangeResult meet(const AbstractDenseLattice &rhs) { + return ChangeResult::NoChange; + } +}; + +//===----------------------------------------------------------------------===// +// AbstractDenseForwardDataFlowAnalysis +//===----------------------------------------------------------------------===// + +/// Base class for dense forward data-flow analyses. Dense data-flow analysis +/// attaches a lattice between the execution of operations and implements a +/// transfer function from the lattice before each operation to the lattice +/// after. The lattice contains information about the state of the program at +/// that point. +/// +/// In this implementation, a lattice attached to an operation represents the +/// state of the program after its execution, and a lattice attached to block +/// represents the state of the program right before it starts executing its +/// body. +class AbstractDenseForwardDataFlowAnalysis : public DataFlowAnalysis { +public: + using DataFlowAnalysis::DataFlowAnalysis; + + /// Initialize the analysis by visiting every program point whose execution + /// may modify the program state; that is, every operation and block. + LogicalResult initialize(Operation *top) override; + + /// Visit a program point that modifies the state of the program. If this is a + /// block, then the state is propagated from control-flow predecessors or + /// callsites. If this is a call operation or region control-flow operation, + /// then the state after the execution of the operation is set by control-flow + /// or the callgraph. Otherwise, this function invokes the operation transfer + /// function. + LogicalResult visit(ProgramPoint point) override; + +protected: + /// Propagate the dense lattice before the execution of an operation to the + /// lattice after its execution. + virtual void visitOperationImpl(Operation *op, + const AbstractDenseLattice &before, + AbstractDenseLattice *after) = 0; + + /// Get the dense lattice after the execution of the given program point. + virtual AbstractDenseLattice *getLattice(ProgramPoint point) = 0; + + /// Get the dense lattice after the execution of the given program point and + /// add it as a dependency to a program point. That is, every time the lattice + /// after point is updated, the dependent program point must be visited, and + /// the newly triggered visit might update the lattice after dependent. + const AbstractDenseLattice *getLatticeFor(ProgramPoint dependent, + ProgramPoint point); + + /// Set the dense lattice at control flow entry point and propagate an update + /// if it changed. + virtual void setToEntryState(AbstractDenseLattice *lattice) = 0; + + /// Join a lattice with another and propagate an update if it changed. + void join(AbstractDenseLattice *lhs, const AbstractDenseLattice &rhs) { + propagateIfChanged(lhs, lhs->join(rhs)); + } + + /// Visit an operation. If this is a call operation or region control-flow + /// operation, then the state after the execution of the operation is set by + /// control-flow or the callgraph. Otherwise, this function invokes the + /// operation transfer function. + virtual void processOperation(Operation *op); + + /// Propagate the dense lattice forward along the control flow edge from + /// `regionFrom` to `regionTo` regions of the `branch` operation. `nullopt` + /// values correspond to control flow branches originating at or targeting the + /// `branch` operation itself. Default implementation just joins the states, + /// meaning that operations implementing `RegionBranchOpInterface` don't have + /// any effect on the lattice that isn't already expressed by the interface + /// itself. + virtual void visitRegionBranchControlFlowTransfer( + RegionBranchOpInterface branch, std::optional regionFrom, + std::optional regionTo, const AbstractDenseLattice &before, + AbstractDenseLattice *after) { + join(after, before); + } + + /// Propagate the dense lattice forward along the call control flow edge, + /// which can be either entering or exiting the callee. Default implementation + /// just meets the states, meaning that operations implementing + /// `CallOpInterface` don't have any effect on the lattice that isn't already + /// expressed by the interface itself. + virtual void visitCallControlFlowTransfer(CallOpInterface call, + CallControlFlowAction action, + const AbstractDenseLattice &before, + AbstractDenseLattice *after) { + join(after, before); + } + + /// Visit a program point within a region branch operation with predecessors + /// in it. This can either be an entry block of one of the regions of the + /// parent operation itself. + void visitRegionBranchOperation(ProgramPoint point, + RegionBranchOpInterface branch, + AbstractDenseLattice *after); + +private: + /// Visit a block. The state at the start of the block is propagated from + /// control-flow predecessors or callsites. + void visitBlock(Block *block); + + /// Visit an operation for which the data flow is described by the + /// `CallOpInterface`. + void visitCallOperation(CallOpInterface call, AbstractDenseLattice *after); +}; + +//===----------------------------------------------------------------------===// +// DenseForwardDataFlowAnalysis +//===----------------------------------------------------------------------===// + +/// A dense forward data-flow analysis for propagating lattices before and +/// after the execution of every operation across the IR by implementing +/// transfer functions for operations. +/// +/// `LatticeT` is expected to be a subclass of `AbstractDenseLattice`. +template +class DenseForwardDataFlowAnalysis + : public AbstractDenseForwardDataFlowAnalysis { + static_assert( + std::is_base_of::value, + "analysis state class expected to subclass AbstractDenseLattice"); + +public: + using AbstractDenseForwardDataFlowAnalysis:: + AbstractDenseForwardDataFlowAnalysis; + + /// Visit an operation with the dense lattice before its execution. This + /// function is expected to set the dense lattice after its execution and + /// trigger change propagation in case of change. + virtual void visitOperation(Operation *op, const LatticeT &before, + LatticeT *after) = 0; + + /// Hook for customizing the behavior of lattice propagation along the call + /// control flow edges. Two types of (forward) propagation are possible here: + /// - `action == CallControlFlowAction::Enter` indicates that: + /// - `before` is the state before the call operation; + /// - `after` is the state at the beginning of the callee entry block; + /// - `action == CallControlFlowAction::Exit` indicates that: + /// - `before` is the state at the end of a callee exit block; + /// - `after` is the state after the call operation. + /// By default, the `after` state is simply joined with the `before` state. + /// Concrete analyses can override this behavior or delegate to the parent + /// call for the default behavior. Specifically, if the `call` op may affect + /// the lattice prior to entering the callee, the custom behavior can be added + /// for `action == CallControlFlowAction::Enter`. If the `call` op may affect + /// the lattice post exiting the callee, the custom behavior can be added for + /// `action == CallControlFlowAction::Exit`. + virtual void visitCallControlFlowTransfer(CallOpInterface call, + CallControlFlowAction action, + const LatticeT &before, + LatticeT *after) { + AbstractDenseForwardDataFlowAnalysis::visitCallControlFlowTransfer( + call, action, before, after); + } + + /// Hook for customizing the behavior of lattice propagation along the control + /// flow edges between regions and their parent op. The control flows from + /// `regionFrom` to `regionTo`, both of which may be `nullopt` to indicate the + /// parent op. The lattice is propagated forward along this edge. The lattices + /// are as follows: + /// - `before:` + /// - if `regionFrom` is a region, this is the lattice at the end of the + /// block that exits the region; note that for multi-exit regions, the + /// lattices are equal at the end of all exiting blocks, but they are + /// associated with different program points. + /// - otherwise, this is the lattice before the parent op. + /// - `after`: + /// - if `regionTo` is a region, this is the lattice at the beginning of + /// the entry block of that region; + /// - otherwise, this is the lattice after the parent op. + /// By default, the `after` state is simply joined with the `before` state. + /// Concrete analyses can override this behavior or delegate to the parent + /// call for the default behavior. Specifically, if the `branch` op may affect + /// the lattice before entering any region, the custom behavior can be added + /// for `regionFrom == nullopt`. If the `branch` op may affect the lattice + /// after all terminated, the custom behavior can be added for `regionTo == + /// nullptr`. The behavior can be further refined for specific pairs of "from" + /// and "to" regions. + virtual void visitRegionBranchControlFlowTransfer( + RegionBranchOpInterface branch, std::optional regionFrom, + std::optional regionTo, const LatticeT &before, + LatticeT *after) { + AbstractDenseForwardDataFlowAnalysis::visitRegionBranchControlFlowTransfer( + branch, regionFrom, regionTo, before, after); + } + +protected: + /// Get the dense lattice after this program point. + LatticeT *getLattice(ProgramPoint point) override { + return getOrCreate(point); + } + + /// Set the dense lattice at control flow entry point and propagate an update + /// if it changed. + virtual void setToEntryState(LatticeT *lattice) = 0; + void setToEntryState(AbstractDenseLattice *lattice) override { + setToEntryState(static_cast(lattice)); + } + + /// Type-erased wrappers that convert the abstract dense lattice to a derived + /// lattice and invoke the virtual hooks operating on the derived lattice. + void visitOperationImpl(Operation *op, const AbstractDenseLattice &before, + AbstractDenseLattice *after) final { + visitOperation(op, static_cast(before), + static_cast(after)); + } + void visitCallControlFlowTransfer(CallOpInterface call, + CallControlFlowAction action, + const AbstractDenseLattice &before, + AbstractDenseLattice *after) final { + visitCallControlFlowTransfer(call, action, + static_cast(before), + static_cast(after)); + } + void visitRegionBranchControlFlowTransfer(RegionBranchOpInterface branch, + std::optional regionFrom, + std::optional regionTo, + const AbstractDenseLattice &before, + AbstractDenseLattice *after) final { + visitRegionBranchControlFlowTransfer(branch, regionFrom, regionTo, + static_cast(before), + static_cast(after)); + } +}; + +//===----------------------------------------------------------------------===// +// AbstractDenseBackwardDataFlowAnalysis +//===----------------------------------------------------------------------===// + +/// Base class for dense backward dataflow analyses. Such analyses attach a +/// lattice between the execution of operations and implement a transfer +/// function from the lattice after the operation ot the lattice before it, thus +/// propagating backward. +/// +/// In this implementation, a lattice attached to an operation represents the +/// state of the program before its execution, and a lattice attached to a block +/// represents the state of the program before the end of the block, i.e., after +/// its terminator. +class AbstractDenseBackwardDataFlowAnalysis : public DataFlowAnalysis { +public: + /// Construct the analysis in the given solver. Takes a symbol table + /// collection that is used to cache symbol resolution in interprocedural part + /// of the analysis. The symbol table need not be prefilled. + AbstractDenseBackwardDataFlowAnalysis(DataFlowSolver &solver, + SymbolTableCollection &symbolTable) + : DataFlowAnalysis(solver), symbolTable(symbolTable) {} + + /// Initialize the analysis by visiting every program point whose execution + /// may modify the program state; that is, every operation and block. + LogicalResult initialize(Operation *top) override; + + /// Visit a program point that modifies the state of the program. The state is + /// propagated along control flow directions for branch-, region- and + /// call-based control flow using the respective interfaces. For other + /// operations, the state is propagated using the transfer function + /// (visitOperation). + /// + /// Note: the transfer function is currently *not* invoked for operations with + /// region or call interface, but *is* invoked for block terminators. + LogicalResult visit(ProgramPoint point) override; + +protected: + /// Propagate the dense lattice after the execution of an operation to the + /// lattice before its execution. + virtual void visitOperationImpl(Operation *op, + const AbstractDenseLattice &after, + AbstractDenseLattice *before) = 0; + + /// Get the dense lattice before the execution of the program point. That is, + /// before the execution of the given operation or after the execution of the + /// block. + virtual AbstractDenseLattice *getLattice(ProgramPoint point) = 0; + + /// Get the dense lattice before the execution of the program point `point` + /// and declare that the `dependent` program point must be updated every time + /// `point` is. + const AbstractDenseLattice *getLatticeFor(ProgramPoint dependent, + ProgramPoint point); + + /// Set the dense lattice before at the control flow exit point and propagate + /// the update if it changed. + virtual void setToExitState(AbstractDenseLattice *lattice) = 0; + + /// Meet a lattice with another lattice and propagate an update if it changed. + void meet(AbstractDenseLattice *lhs, const AbstractDenseLattice &rhs) { + propagateIfChanged(lhs, lhs->meet(rhs)); + } + + /// Visit an operation. Dispatches to specialized methods for call or region + /// control-flow operations. Otherwise, this function invokes the operation + /// transfer function. + virtual void processOperation(Operation *op); + + /// Propagate the dense lattice backwards along the control flow edge from + /// `regionFrom` to `regionTo` regions of the `branch` operation. `nullopt` + /// values correspond to control flow branches originating at or targeting the + /// `branch` operation itself. Default implementation just meets the states, + /// meaning that operations implementing `RegionBranchOpInterface` don't have + /// any effect on the lattice that isn't already expressed by the interface + /// itself. + virtual void visitRegionBranchControlFlowTransfer( + RegionBranchOpInterface branch, RegionBranchPoint regionFrom, + RegionBranchPoint regionTo, const AbstractDenseLattice &after, + AbstractDenseLattice *before) { + meet(before, after); + } + + /// Propagate the dense lattice backwards along the call control flow edge, + /// which can be either entering or exiting the callee. Default implementation + /// just meets the states, meaning that operations implementing + /// `CallOpInterface` don't have any effect on hte lattice that isn't already + /// expressed by the interface itself. + virtual void visitCallControlFlowTransfer(CallOpInterface call, + CallControlFlowAction action, + const AbstractDenseLattice &after, + AbstractDenseLattice *before) { + meet(before, after); + } + +private: + /// Visit a block. The state and the end of the block is propagated from + /// control-flow successors of the block or callsites. + void visitBlock(Block *block); + + /// Visit a program point within a region branch operation with successors + /// (from which the state is propagated) in or after it. `regionNo` indicates + /// the region that contains the successor, `nullopt` indicating the successor + /// of the branch operation itself. + void visitRegionBranchOperation(ProgramPoint point, + RegionBranchOpInterface branch, + RegionBranchPoint branchPoint, + AbstractDenseLattice *before); + + /// Visit an operation for which the data flow is described by the + /// `CallOpInterface`. Performs inter-procedural data flow as follows: + /// + /// - find the callable (resolve via the symbol table), + /// - get the entry block of the callable region, + /// - take the state before the first operation if present or at block end + /// otherwise, + /// - meet that state with the state before the call-like op, or use the + /// custom logic if overridden by concrete analyses. + void visitCallOperation(CallOpInterface call, AbstractDenseLattice *before); + + /// Symbol table for call-level control flow. + SymbolTableCollection &symbolTable; +}; + +//===----------------------------------------------------------------------===// +// DenseBackwardDataFlowAnalysis +//===----------------------------------------------------------------------===// + +/// A dense backward dataflow analysis propagating lattices after and before the +/// execution of every operation across the IR by implementing transfer +/// functions for opreations. +/// +/// `LatticeT` is expected to be a subclass of `AbstractDenseLattice`. +template +class DenseBackwardDataFlowAnalysis + : public AbstractDenseBackwardDataFlowAnalysis { + static_assert(std::is_base_of_v, + "analysis state expected to subclass AbstractDenseLattice"); + +public: + using AbstractDenseBackwardDataFlowAnalysis:: + AbstractDenseBackwardDataFlowAnalysis; + + /// Transfer function. Visits an operation with the dense lattice after its + /// execution. This function is expected to set the dense lattice before its + /// execution and trigger propagation in case of change. + virtual void visitOperation(Operation *op, const LatticeT &after, + LatticeT *before) = 0; + + /// Hook for customizing the behavior of lattice propagation along the call + /// control flow edges. Two types of (back) propagation are possible here: + /// - `action == CallControlFlowAction::Enter` indicates that: + /// - `after` is the state at the top of the callee entry block; + /// - `before` is the state before the call operation; + /// - `action == CallControlFlowAction::Exit` indicates that: + /// - `after` is the state after the call operation; + /// - `before` is the state of exit blocks of the callee. + /// By default, the `before` state is simply met with the `after` state. + /// Concrete analyses can override this behavior or delegate to the parent + /// call for the default behavior. Specifically, if the `call` op may affect + /// the lattice prior to entering the callee, the custom behavior can be added + /// for `action == CallControlFlowAction::Enter`. If the `call` op may affect + /// the lattice post exiting the callee, the custom behavior can be added for + /// `action == CallControlFlowAction::Exit`. + virtual void visitCallControlFlowTransfer(CallOpInterface call, + CallControlFlowAction action, + const LatticeT &after, + LatticeT *before) { + AbstractDenseBackwardDataFlowAnalysis::visitCallControlFlowTransfer( + call, action, after, before); + } + + /// Hook for customizing the behavior of lattice propagation along the control + /// flow edges between regions and their parent op. The control flows from + /// `regionFrom` to `regionTo`, both of which may be `nullopt` to indicate the + /// parent op. The lattice is propagated back along this edge. The lattices + /// are as follows: + /// - `after`: + /// - if `regionTo` is a region, this is the lattice at the beginning of + /// the entry block of that region; + /// - otherwise, this is the lattice after the parent op. + /// - `before:` + /// - if `regionFrom` is a region, this is the lattice at the end of the + /// block that exits the region; note that for multi-exit regions, the + /// lattices are equal at the end of all exiting blocks, but they are + /// associated with different program points. + /// - otherwise, this is the lattice before the parent op. + /// By default, the `before` state is simply met with the `after` state. + /// Concrete analyses can override this behavior or delegate to the parent + /// call for the default behavior. Specifically, if the `branch` op may affect + /// the lattice before entering any region, the custom behavior can be added + /// for `regionFrom == nullopt`. If the `branch` op may affect the lattice + /// after all terminated, the custom behavior can be added for `regionTo == + /// nullptr`. The behavior can be further refined for specific pairs of "from" + /// and "to" regions. + virtual void visitRegionBranchControlFlowTransfer( + RegionBranchOpInterface branch, RegionBranchPoint regionFrom, + RegionBranchPoint regionTo, const LatticeT &after, LatticeT *before) { + AbstractDenseBackwardDataFlowAnalysis::visitRegionBranchControlFlowTransfer( + branch, regionFrom, regionTo, after, before); + } + +protected: + /// Get the dense lattice at the given program point. + LatticeT *getLattice(ProgramPoint point) override { + return getOrCreate(point); + } + + /// Set the dense lattice at control flow exit point (after the terminator) + /// and propagate an update if it changed. + virtual void setToExitState(LatticeT *lattice) = 0; + void setToExitState(AbstractDenseLattice *lattice) final { + setToExitState(static_cast(lattice)); + } + + /// Type-erased wrappers that convert the abstract dense lattice to a derived + /// lattice and invoke the virtual hooks operating on the derived lattice. + void visitOperationImpl(Operation *op, const AbstractDenseLattice &after, + AbstractDenseLattice *before) final { + visitOperation(op, static_cast(after), + static_cast(before)); + } + void visitCallControlFlowTransfer(CallOpInterface call, + CallControlFlowAction action, + const AbstractDenseLattice &after, + AbstractDenseLattice *before) final { + visitCallControlFlowTransfer(call, action, + static_cast(after), + static_cast(before)); + } + void visitRegionBranchControlFlowTransfer( + RegionBranchOpInterface branch, RegionBranchPoint regionForm, + RegionBranchPoint regionTo, const AbstractDenseLattice &after, + AbstractDenseLattice *before) final { + visitRegionBranchControlFlowTransfer(branch, regionForm, regionTo, + static_cast(after), + static_cast(before)); + } +}; + +} // end namespace dataflow +} // end namespace mlir + +#endif // MLIR_ANALYSIS_DENSEDATAFLOWANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..99f620ed26a1b4b86815a0502217db8e472e2f07 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h @@ -0,0 +1,115 @@ +//===-IntegerRangeAnalysis.h - Integer range analysis -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares the dataflow analysis class for integer range inference +// so that it can be used in transformations over the `arith` dialect such as +// branch elimination or signed->unsigned rewriting +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_DATAFLOW_INTEGERANGEANALYSIS_H +#define MLIR_ANALYSIS_DATAFLOW_INTEGERANGEANALYSIS_H + +#include "mlir/Analysis/DataFlow/SparseAnalysis.h" +#include "mlir/Interfaces/InferIntRangeInterface.h" + +namespace mlir { +namespace dataflow { + +/// This lattice value represents the integer range of an SSA value. +class IntegerValueRange { +public: + /// Create a maximal range ([0, uint_max(t)] / [int_min(t), int_max(t)]) + /// range that is used to mark the value as unable to be analyzed further, + /// where `t` is the type of `value`. + static IntegerValueRange getMaxRange(Value value); + + /// Create an integer value range lattice value. + IntegerValueRange(std::optional value = std::nullopt) + : value(std::move(value)) {} + + /// Whether the range is uninitialized. This happens when the state hasn't + /// been set during the analysis. + bool isUninitialized() const { return !value.has_value(); } + + /// Get the known integer value range. + const ConstantIntRanges &getValue() const { + assert(!isUninitialized()); + return *value; + } + + /// Compare two ranges. + bool operator==(const IntegerValueRange &rhs) const { + return value == rhs.value; + } + + /// Take the union of two ranges. + static IntegerValueRange join(const IntegerValueRange &lhs, + const IntegerValueRange &rhs) { + if (lhs.isUninitialized()) + return rhs; + if (rhs.isUninitialized()) + return lhs; + return IntegerValueRange{lhs.getValue().rangeUnion(rhs.getValue())}; + } + + /// Print the integer value range. + void print(raw_ostream &os) const { os << value; } + +private: + /// The known integer value range. + std::optional value; +}; + +/// This lattice element represents the integer value range of an SSA value. +/// When this lattice is updated, it automatically updates the constant value +/// of the SSA value (if the range can be narrowed to one). +class IntegerValueRangeLattice : public Lattice { +public: + using Lattice::Lattice; + + /// If the range can be narrowed to an integer constant, update the constant + /// value of the SSA value. + void onUpdate(DataFlowSolver *solver) const override; +}; + +/// Integer range analysis determines the integer value range of SSA values +/// using operations that define `InferIntRangeInterface` and also sets the +/// range of iteration indices of loops with known bounds. +class IntegerRangeAnalysis + : public SparseForwardDataFlowAnalysis { +public: + using SparseForwardDataFlowAnalysis::SparseForwardDataFlowAnalysis; + + /// At an entry point, we cannot reason about interger value ranges. + void setToEntryState(IntegerValueRangeLattice *lattice) override { + propagateIfChanged(lattice, lattice->join(IntegerValueRange::getMaxRange( + lattice->getPoint()))); + } + + /// Visit an operation. Invoke the transfer function on each operation that + /// implements `InferIntRangeInterface`. + void visitOperation(Operation *op, + ArrayRef operands, + ArrayRef results) override; + + /// Visit block arguments or operation results of an operation with region + /// control-flow for which values are not defined by region control-flow. This + /// function calls `InferIntRangeInterface` to provide values for block + /// arguments or tries to reduce the range on loop induction variables with + /// known bounds. + void + visitNonControlFlowArguments(Operation *op, const RegionSuccessor &successor, + ArrayRef argLattices, + unsigned firstIndex) override; +}; + +} // end namespace dataflow +} // end namespace mlir + +#endif // MLIR_ANALYSIS_DATAFLOW_INTEGERANGEANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/LivenessAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/LivenessAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..caa03e26a3a42372b4feef67e0c5885034d1a634 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/LivenessAnalysis.h @@ -0,0 +1,112 @@ +//===- LivenessAnalysis.h - Liveness analysis -------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements liveness analysis using the sparse backward data-flow +// analysis framework. Theoretically, liveness analysis assigns liveness to each +// (value, program point) pair in the program and it is thus a dense analysis. +// However, since values are immutable in MLIR, a sparse analysis, which will +// assign liveness to each value in the program, suffices here. +// +// Liveness analysis has many applications. It can be used to avoid the +// computation of extraneous operations that have no effect on the memory or the +// final output of a program. It can also be used to optimize register +// allocation. Both of these applications help achieve one very important goal: +// reducing runtime. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_DATAFLOW_LIVENESSANALYSIS_H +#define MLIR_ANALYSIS_DATAFLOW_LIVENESSANALYSIS_H + +#include +#include + +namespace mlir::dataflow { + +//===----------------------------------------------------------------------===// +// Liveness +//===----------------------------------------------------------------------===// + +/// This lattice represents, for a given value, whether or not it is "live". +/// +/// A value is considered "live" iff it: +/// (1) has memory effects OR +/// (2) is returned by a public function OR +/// (3) is used to compute a value of type (1) or (2). +/// It is also to be noted that a value could be of multiple types (1/2/3) at +/// the same time. +/// +/// A value "has memory effects" iff it: +/// (1.a) is an operand of an op with memory effects OR +/// (1.b) is a non-forwarded branch operand and its branch op could take the +/// control to a block that has an op with memory effects OR +/// (1.c) is a non-forwarded call operand. +/// +/// A value `A` is said to be "used to compute" value `B` iff `B` cannot be +/// computed in the absence of `A`. Thus, in this implementation, we say that +/// value `A` is used to compute value `B` iff: +/// (3.a) `B` is a result of an op with operand `A` OR +/// (3.b) `A` is used to compute some value `C` and `C` is used to compute +/// `B`. +struct Liveness : public AbstractSparseLattice { + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(Liveness) + using AbstractSparseLattice::AbstractSparseLattice; + + void print(raw_ostream &os) const override; + + ChangeResult markLive(); + + ChangeResult meet(const AbstractSparseLattice &other) override; + + // At the beginning of the analysis, everything is marked "not live" and as + // the analysis progresses, values are marked "live" if they are found to be + // live. + bool isLive = false; +}; + +//===----------------------------------------------------------------------===// +// LivenessAnalysis +//===----------------------------------------------------------------------===// + +/// An analysis that, by going backwards along the dataflow graph, annotates +/// each value with a boolean storing true iff it is "live". +class LivenessAnalysis : public SparseBackwardDataFlowAnalysis { +public: + using SparseBackwardDataFlowAnalysis::SparseBackwardDataFlowAnalysis; + + void visitOperation(Operation *op, ArrayRef operands, + ArrayRef results) override; + + void visitBranchOperand(OpOperand &operand) override; + + void visitCallOperand(OpOperand &operand) override; + + void setToExitState(Liveness *lattice) override; +}; + +//===----------------------------------------------------------------------===// +// RunLivenessAnalysis +//===----------------------------------------------------------------------===// + +/// Runs liveness analysis on the IR defined by `op`. +struct RunLivenessAnalysis { +public: + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RunLivenessAnalysis) + + RunLivenessAnalysis(Operation *op); + + const Liveness *getLiveness(Value val); + +private: + /// Stores the result of the liveness analysis that was run. + DataFlowSolver solver; +}; + +} // end namespace mlir::dataflow + +#endif // MLIR_ANALYSIS_DATAFLOW_LIVENESSANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..5a9a36159b56c5a3c31708b1b0752566070a32d1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h @@ -0,0 +1,482 @@ +//===- SparseAnalysis.h - Sparse data-flow analysis -----------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements sparse data-flow analysis using the data-flow analysis +// framework. The analysis is forward and conditional and uses the results of +// dead code analysis to prune dead code during the analysis. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_DATAFLOW_SPARSEANALYSIS_H +#define MLIR_ANALYSIS_DATAFLOW_SPARSEANALYSIS_H + +#include "mlir/Analysis/DataFlowFramework.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "llvm/ADT/SmallPtrSet.h" + +namespace mlir { +namespace dataflow { + +//===----------------------------------------------------------------------===// +// AbstractSparseLattice +//===----------------------------------------------------------------------===// + +/// This class represents an abstract lattice. A lattice contains information +/// about an SSA value and is what's propagated across the IR by sparse +/// data-flow analysis. +class AbstractSparseLattice : public AnalysisState { +public: + /// Lattices can only be created for values. + AbstractSparseLattice(Value value) : AnalysisState(value) {} + + /// Return the program point this lattice is located at. + Value getPoint() const { return AnalysisState::getPoint().get(); } + + /// Join the information contained in 'rhs' into this lattice. Returns + /// if the value of the lattice changed. + virtual ChangeResult join(const AbstractSparseLattice &rhs) { + return ChangeResult::NoChange; + } + + /// Meet (intersect) the information in this lattice with 'rhs'. Returns + /// if the value of the lattice changed. + virtual ChangeResult meet(const AbstractSparseLattice &rhs) { + return ChangeResult::NoChange; + } + + /// When the lattice gets updated, propagate an update to users of the value + /// using its use-def chain to subscribed analyses. + void onUpdate(DataFlowSolver *solver) const override; + + /// Subscribe an analysis to updates of the lattice. When the lattice changes, + /// subscribed analyses are re-invoked on all users of the value. This is + /// more efficient than relying on the dependency map. + void useDefSubscribe(DataFlowAnalysis *analysis) { + useDefSubscribers.insert(analysis); + } + +private: + /// A set of analyses that should be updated when this lattice changes. + SetVector, + SmallPtrSet> + useDefSubscribers; +}; + +//===----------------------------------------------------------------------===// +// Lattice +//===----------------------------------------------------------------------===// + +/// This class represents a lattice holding a specific value of type `ValueT`. +/// Lattice values (`ValueT`) are required to adhere to the following: +/// +/// * static ValueT join(const ValueT &lhs, const ValueT &rhs); +/// - This method conservatively joins the information held by `lhs` +/// and `rhs` into a new value. This method is required to be monotonic. +/// * bool operator==(const ValueT &rhs) const; +/// +template +class Lattice : public AbstractSparseLattice { +public: + using AbstractSparseLattice::AbstractSparseLattice; + + /// Return the program point this lattice is located at. + Value getPoint() const { return point.get(); } + + /// Return the value held by this lattice. This requires that the value is + /// initialized. + ValueT &getValue() { return value; } + const ValueT &getValue() const { + return const_cast *>(this)->getValue(); + } + + using LatticeT = Lattice; + + /// Join the information contained in the 'rhs' lattice into this + /// lattice. Returns if the state of the current lattice changed. + ChangeResult join(const AbstractSparseLattice &rhs) override { + return join(static_cast(rhs).getValue()); + } + + /// Meet (intersect) the information contained in the 'rhs' lattice with + /// this lattice. Returns if the state of the current lattice changed. + ChangeResult meet(const AbstractSparseLattice &rhs) override { + return meet(static_cast(rhs).getValue()); + } + + /// Join the information contained in the 'rhs' value into this + /// lattice. Returns if the state of the current lattice changed. + ChangeResult join(const ValueT &rhs) { + // Otherwise, join rhs with the current optimistic value. + ValueT newValue = ValueT::join(value, rhs); + assert(ValueT::join(newValue, value) == newValue && + "expected `join` to be monotonic"); + assert(ValueT::join(newValue, rhs) == newValue && + "expected `join` to be monotonic"); + + // Update the current optimistic value if something changed. + if (newValue == value) + return ChangeResult::NoChange; + + value = newValue; + return ChangeResult::Change; + } + + /// Trait to check if `T` provides a `meet` method. Needed since for forward + /// analysis, lattices will only have a `join`, no `meet`, but we want to use + /// the same `Lattice` class for both directions. + template + using has_meet = decltype(std::declval().meet()); + template + using lattice_has_meet = llvm::is_detected; + + /// Meet (intersect) the information contained in the 'rhs' value with this + /// lattice. Returns if the state of the current lattice changed. If the + /// lattice elements don't have a `meet` method, this is a no-op (see below.) + template ::value>> + ChangeResult meet(const VT &rhs) { + ValueT newValue = ValueT::meet(value, rhs); + assert(ValueT::meet(newValue, value) == newValue && + "expected `meet` to be monotonic"); + assert(ValueT::meet(newValue, rhs) == newValue && + "expected `meet` to be monotonic"); + + // Update the current optimistic value if something changed. + if (newValue == value) + return ChangeResult::NoChange; + + value = newValue; + return ChangeResult::Change; + } + + template + ChangeResult meet(const VT &rhs) { + return ChangeResult::NoChange; + } + + /// Print the lattice element. + void print(raw_ostream &os) const override { value.print(os); } + +private: + /// The currently computed value that is optimistically assumed to be true. + ValueT value; +}; + +//===----------------------------------------------------------------------===// +// AbstractSparseForwardDataFlowAnalysis +//===----------------------------------------------------------------------===// + +/// Base class for sparse forward data-flow analyses. A sparse analysis +/// implements a transfer function on operations from the lattices of the +/// operands to the lattices of the results. This analysis will propagate +/// lattices across control-flow edges and the callgraph using liveness +/// information. +class AbstractSparseForwardDataFlowAnalysis : public DataFlowAnalysis { +public: + /// Initialize the analysis by visiting every owner of an SSA value: all + /// operations and blocks. + LogicalResult initialize(Operation *top) override; + + /// Visit a program point. If this is a block and all control-flow + /// predecessors or callsites are known, then the arguments lattices are + /// propagated from them. If this is a call operation or an operation with + /// region control-flow, then its result lattices are set accordingly. + /// Otherwise, the operation transfer function is invoked. + LogicalResult visit(ProgramPoint point) override; + +protected: + explicit AbstractSparseForwardDataFlowAnalysis(DataFlowSolver &solver); + + /// The operation transfer function. Given the operand lattices, this + /// function is expected to set the result lattices. + virtual void + visitOperationImpl(Operation *op, + ArrayRef operandLattices, + ArrayRef resultLattices) = 0; + + /// Given an operation with region control-flow, the lattices of the operands, + /// and a region successor, compute the lattice values for block arguments + /// that are not accounted for by the branching control flow (ex. the bounds + /// of loops). + virtual void visitNonControlFlowArgumentsImpl( + Operation *op, const RegionSuccessor &successor, + ArrayRef argLattices, unsigned firstIndex) = 0; + + /// Get the lattice element of a value. + virtual AbstractSparseLattice *getLatticeElement(Value value) = 0; + + /// Get a read-only lattice element for a value and add it as a dependency to + /// a program point. + const AbstractSparseLattice *getLatticeElementFor(ProgramPoint point, + Value value); + + /// Set the given lattice element(s) at control flow entry point(s). + virtual void setToEntryState(AbstractSparseLattice *lattice) = 0; + void setAllToEntryStates(ArrayRef lattices); + + /// Join the lattice element and propagate and update if it changed. + void join(AbstractSparseLattice *lhs, const AbstractSparseLattice &rhs); + +private: + /// Recursively initialize the analysis on nested operations and blocks. + LogicalResult initializeRecursively(Operation *op); + + /// Visit an operation. If this is a call operation or an operation with + /// region control-flow, then its result lattices are set accordingly. + /// Otherwise, the operation transfer function is invoked. + void visitOperation(Operation *op); + + /// Visit a block to compute the lattice values of its arguments. If this is + /// an entry block, then the argument values are determined from the block's + /// "predecessors" as set by `PredecessorState`. The predecessors can be + /// region terminators or callable callsites. Otherwise, the values are + /// determined from block predecessors. + void visitBlock(Block *block); + + /// Visit a program point `point` with predecessors within a region branch + /// operation `branch`, which can either be the entry block of one of the + /// regions or the parent operation itself, and set either the argument or + /// parent result lattices. + void visitRegionSuccessors(ProgramPoint point, RegionBranchOpInterface branch, + RegionBranchPoint successor, + ArrayRef lattices); +}; + +//===----------------------------------------------------------------------===// +// SparseForwardDataFlowAnalysis +//===----------------------------------------------------------------------===// + +/// A sparse forward data-flow analysis for propagating SSA value lattices +/// across the IR by implementing transfer functions for operations. +/// +/// `StateT` is expected to be a subclass of `AbstractSparseLattice`. +template +class SparseForwardDataFlowAnalysis + : public AbstractSparseForwardDataFlowAnalysis { + static_assert( + std::is_base_of::value, + "analysis state class expected to subclass AbstractSparseLattice"); + +public: + explicit SparseForwardDataFlowAnalysis(DataFlowSolver &solver) + : AbstractSparseForwardDataFlowAnalysis(solver) {} + + /// Visit an operation with the lattices of its operands. This function is + /// expected to set the lattices of the operation's results. + virtual void visitOperation(Operation *op, ArrayRef operands, + ArrayRef results) = 0; + + /// Given an operation with possible region control-flow, the lattices of the + /// operands, and a region successor, compute the lattice values for block + /// arguments that are not accounted for by the branching control flow (ex. + /// the bounds of loops). By default, this method marks all such lattice + /// elements as having reached a pessimistic fixpoint. `firstIndex` is the + /// index of the first element of `argLattices` that is set by control-flow. + virtual void visitNonControlFlowArguments(Operation *op, + const RegionSuccessor &successor, + ArrayRef argLattices, + unsigned firstIndex) { + setAllToEntryStates(argLattices.take_front(firstIndex)); + setAllToEntryStates(argLattices.drop_front( + firstIndex + successor.getSuccessorInputs().size())); + } + +protected: + /// Get the lattice element for a value. + StateT *getLatticeElement(Value value) override { + return getOrCreate(value); + } + + /// Get the lattice element for a value and create a dependency on the + /// provided program point. + const StateT *getLatticeElementFor(ProgramPoint point, Value value) { + return static_cast( + AbstractSparseForwardDataFlowAnalysis::getLatticeElementFor(point, + value)); + } + + /// Set the given lattice element(s) at control flow entry point(s). + virtual void setToEntryState(StateT *lattice) = 0; + void setAllToEntryStates(ArrayRef lattices) { + AbstractSparseForwardDataFlowAnalysis::setAllToEntryStates( + {reinterpret_cast(lattices.begin()), + lattices.size()}); + } + +private: + /// Type-erased wrappers that convert the abstract lattice operands to derived + /// lattices and invoke the virtual hooks operating on the derived lattices. + void visitOperationImpl( + Operation *op, ArrayRef operandLattices, + ArrayRef resultLattices) override { + visitOperation( + op, + {reinterpret_cast(operandLattices.begin()), + operandLattices.size()}, + {reinterpret_cast(resultLattices.begin()), + resultLattices.size()}); + } + void visitNonControlFlowArgumentsImpl( + Operation *op, const RegionSuccessor &successor, + ArrayRef argLattices, + unsigned firstIndex) override { + visitNonControlFlowArguments( + op, successor, + {reinterpret_cast(argLattices.begin()), + argLattices.size()}, + firstIndex); + } + void setToEntryState(AbstractSparseLattice *lattice) override { + return setToEntryState(reinterpret_cast(lattice)); + } +}; + +//===----------------------------------------------------------------------===// +// AbstractSparseBackwardDataFlowAnalysis +//===----------------------------------------------------------------------===// + +/// Base class for sparse backward data-flow analyses. Similar to +/// AbstractSparseForwardDataFlowAnalysis, but walks bottom to top. +class AbstractSparseBackwardDataFlowAnalysis : public DataFlowAnalysis { +public: + /// Initialize the analysis by visiting the operation and everything nested + /// under it. + LogicalResult initialize(Operation *top) override; + + /// Visit a program point. If this is a call operation or an operation with + /// block or region control-flow, then operand lattices are set accordingly. + /// Otherwise, invokes the operation transfer function (`visitOperationImpl`). + LogicalResult visit(ProgramPoint point) override; + +protected: + explicit AbstractSparseBackwardDataFlowAnalysis( + DataFlowSolver &solver, SymbolTableCollection &symbolTable); + + /// The operation transfer function. Given the result lattices, this + /// function is expected to set the operand lattices. + virtual void visitOperationImpl( + Operation *op, ArrayRef operandLattices, + ArrayRef resultLattices) = 0; + + // Visit operands on branch instructions that are not forwarded. + virtual void visitBranchOperand(OpOperand &operand) = 0; + + // Visit operands on call instructions that are not forwarded. + virtual void visitCallOperand(OpOperand &operand) = 0; + + /// Set the given lattice element(s) at control flow exit point(s). + virtual void setToExitState(AbstractSparseLattice *lattice) = 0; + + /// Set the given lattice element(s) at control flow exit point(s). + void setAllToExitStates(ArrayRef lattices); + + /// Get the lattice element for a value. + virtual AbstractSparseLattice *getLatticeElement(Value value) = 0; + + /// Get the lattice elements for a range of values. + SmallVector getLatticeElements(ValueRange values); + + /// Join the lattice element and propagate and update if it changed. + void meet(AbstractSparseLattice *lhs, const AbstractSparseLattice &rhs); + +private: + /// Recursively initialize the analysis on nested operations and blocks. + LogicalResult initializeRecursively(Operation *op); + + /// Visit an operation. If this is a call operation or an operation with + /// region control-flow, then its operand lattices are set accordingly. + /// Otherwise, the operation transfer function is invoked. + void visitOperation(Operation *op); + + /// Visit a block. + void visitBlock(Block *block); + + /// Visit an op with regions (like e.g. `scf.while`) + void visitRegionSuccessors(RegionBranchOpInterface branch, + ArrayRef operands); + + /// Visit a `RegionBranchTerminatorOpInterface` to compute the lattice values + /// of its operands, given its parent op `branch`. The lattice value of an + /// operand is determined based on the corresponding arguments in + /// `terminator`'s region successor(s). + void visitRegionSuccessorsFromTerminator( + RegionBranchTerminatorOpInterface terminator, + RegionBranchOpInterface branch); + + /// Get the lattice element for a value, and also set up + /// dependencies so that the analysis on the given ProgramPoint is re-invoked + /// if the value changes. + const AbstractSparseLattice *getLatticeElementFor(ProgramPoint point, + Value value); + + /// Get the lattice elements for a range of values, and also set up + /// dependencies so that the analysis on the given ProgramPoint is re-invoked + /// if any of the values change. + SmallVector + getLatticeElementsFor(ProgramPoint point, ValueRange values); + + SymbolTableCollection &symbolTable; +}; + +//===----------------------------------------------------------------------===// +// SparseBackwardDataFlowAnalysis +//===----------------------------------------------------------------------===// + +/// A sparse (backward) data-flow analysis for propagating SSA value lattices +/// backwards across the IR by implementing transfer functions for operations. +/// +/// `StateT` is expected to be a subclass of `AbstractSparseLattice`. +template +class SparseBackwardDataFlowAnalysis + : public AbstractSparseBackwardDataFlowAnalysis { +public: + explicit SparseBackwardDataFlowAnalysis(DataFlowSolver &solver, + SymbolTableCollection &symbolTable) + : AbstractSparseBackwardDataFlowAnalysis(solver, symbolTable) {} + + /// Visit an operation with the lattices of its results. This function is + /// expected to set the lattices of the operation's operands. + virtual void visitOperation(Operation *op, ArrayRef operands, + ArrayRef results) = 0; + +protected: + /// Get the lattice element for a value. + StateT *getLatticeElement(Value value) override { + return getOrCreate(value); + } + + /// Set the given lattice element(s) at control flow exit point(s). + virtual void setToExitState(StateT *lattice) = 0; + void setToExitState(AbstractSparseLattice *lattice) override { + return setToExitState(reinterpret_cast(lattice)); + } + void setAllToExitStates(ArrayRef lattices) { + AbstractSparseBackwardDataFlowAnalysis::setAllToExitStates( + {reinterpret_cast(lattices.begin()), + lattices.size()}); + } + +private: + /// Type-erased wrappers that convert the abstract lattice operands to derived + /// lattices and invoke the virtual hooks operating on the derived lattices. + void visitOperationImpl( + Operation *op, ArrayRef operandLattices, + ArrayRef resultLattices) override { + visitOperation( + op, + {reinterpret_cast(operandLattices.begin()), + operandLattices.size()}, + {reinterpret_cast(resultLattices.begin()), + resultLattices.size()}); + } +}; + +} // end namespace dataflow +} // end namespace mlir + +#endif // MLIR_ANALYSIS_DATAFLOW_SPARSEANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlowFramework.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlowFramework.h new file mode 100644 index 0000000000000000000000000000000000000000..c27615b52a12b8fd99baa24cbc0ce22c575e3e94 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataFlowFramework.h @@ -0,0 +1,490 @@ +//===- DataFlowFramework.h - A generic framework for data-flow analysis ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines a generic framework for writing data-flow analysis in MLIR. +// The framework consists of a solver, which runs the fixed-point iteration and +// manages analysis dependencies, and a data-flow analysis class used to +// implement specific analyses. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_DATAFLOWFRAMEWORK_H +#define MLIR_ANALYSIS_DATAFLOWFRAMEWORK_H + +#include "mlir/IR/Operation.h" +#include "mlir/Support/StorageUniquer.h" +#include "llvm/ADT/SetVector.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/TypeName.h" +#include + +namespace mlir { + +//===----------------------------------------------------------------------===// +// ChangeResult +//===----------------------------------------------------------------------===// + +/// A result type used to indicate if a change happened. Boolean operations on +/// ChangeResult behave as though `Change` is truthy. +enum class ChangeResult { + NoChange, + Change, +}; +inline ChangeResult operator|(ChangeResult lhs, ChangeResult rhs) { + return lhs == ChangeResult::Change ? lhs : rhs; +} +inline ChangeResult &operator|=(ChangeResult &lhs, ChangeResult rhs) { + lhs = lhs | rhs; + return lhs; +} +inline ChangeResult operator&(ChangeResult lhs, ChangeResult rhs) { + return lhs == ChangeResult::NoChange ? lhs : rhs; +} + +/// Forward declare the analysis state class. +class AnalysisState; + +//===----------------------------------------------------------------------===// +// GenericProgramPoint +//===----------------------------------------------------------------------===// + +/// Abstract class for generic program points. In classical data-flow analysis, +/// programs points represent positions in a program to which lattice elements +/// are attached. In sparse data-flow analysis, these can be SSA values, and in +/// dense data-flow analysis, these are the program points before and after +/// every operation. +/// +/// In the general MLIR data-flow analysis framework, program points are an +/// extensible concept. Program points are uniquely identifiable objects to +/// which analysis states can be attached. The semantics of program points are +/// defined by the analyses that specify their transfer functions. +/// +/// Program points are implemented using MLIR's storage uniquer framework and +/// type ID system to provide RTTI. +class GenericProgramPoint : public StorageUniquer::BaseStorage { +public: + virtual ~GenericProgramPoint(); + + /// Get the abstract program point's type identifier. + TypeID getTypeID() const { return typeID; } + + /// Get a derived source location for the program point. + virtual Location getLoc() const = 0; + + /// Print the program point. + virtual void print(raw_ostream &os) const = 0; + +protected: + /// Create an abstract program point with type identifier. + explicit GenericProgramPoint(TypeID typeID) : typeID(typeID) {} + +private: + /// The type identifier of the program point. + TypeID typeID; +}; + +//===----------------------------------------------------------------------===// +// GenericProgramPointBase +//===----------------------------------------------------------------------===// + +/// Base class for generic program points based on a concrete program point +/// type and a content key. This class defines the common methods required for +/// operability with the storage uniquer framework. +/// +/// The provided key type uniquely identifies the concrete program point +/// instance and are the data members of the class. +template +class GenericProgramPointBase : public GenericProgramPoint { +public: + /// The concrete key type used by the storage uniquer. This class is uniqued + /// by its contents. + using KeyTy = Value; + /// Alias for the base class. + using Base = GenericProgramPointBase; + + /// Construct an instance of the program point using the provided value and + /// the type ID of the concrete type. + template + explicit GenericProgramPointBase(ValueT &&value) + : GenericProgramPoint(TypeID::get()), + value(std::forward(value)) {} + + /// Get a uniqued instance of this program point class with the given + /// arguments. + template + static ConcreteT *get(StorageUniquer &uniquer, Args &&...args) { + return uniquer.get(/*initFn=*/{}, std::forward(args)...); + } + + /// Allocate space for a program point and construct it in-place. + template + static ConcreteT *construct(StorageUniquer::StorageAllocator &alloc, + ValueT &&value) { + return new (alloc.allocate()) + ConcreteT(std::forward(value)); + } + + /// Two program points are equal if their values are equal. + bool operator==(const Value &value) const { return this->value == value; } + + /// Provide LLVM-style RTTI using type IDs. + static bool classof(const GenericProgramPoint *point) { + return point->getTypeID() == TypeID::get(); + } + + /// Get the contents of the program point. + const Value &getValue() const { return value; } + +private: + /// The program point value. + Value value; +}; + +//===----------------------------------------------------------------------===// +// ProgramPoint +//===----------------------------------------------------------------------===// + +/// Fundamental IR components are supported as first-class program points. +struct ProgramPoint + : public PointerUnion { + using ParentTy = + PointerUnion; + /// Inherit constructors. + using ParentTy::PointerUnion; + /// Allow implicit conversion from the parent type. + ProgramPoint(ParentTy point = nullptr) : ParentTy(point) {} + /// Allow implicit conversions from operation wrappers. + /// TODO: For Windows only. Find a better solution. + template ::value && + !std::is_same::value>> + ProgramPoint(OpT op) : ParentTy(op) {} + + /// Print the program point. + void print(raw_ostream &os) const; + + /// Get the source location of the program point. + Location getLoc() const; +}; + +/// Forward declaration of the data-flow analysis class. +class DataFlowAnalysis; + +//===----------------------------------------------------------------------===// +// DataFlowSolver +//===----------------------------------------------------------------------===// + +/// The general data-flow analysis solver. This class is responsible for +/// orchestrating child data-flow analyses, running the fixed-point iteration +/// algorithm, managing analysis state and program point memory, and tracking +/// dependencies between analyses, program points, and analysis states. +/// +/// Steps to run a data-flow analysis: +/// +/// 1. Load and initialize children analyses. Children analyses are instantiated +/// in the solver and initialized, building their dependency relations. +/// 2. Configure and run the analysis. The solver invokes the children analyses +/// according to their dependency relations until a fixed point is reached. +/// 3. Query analysis state results from the solver. +/// +/// TODO: Optimize the internal implementation of the solver. +class DataFlowSolver { +public: + /// Load an analysis into the solver. Return the analysis instance. + template + AnalysisT *load(Args &&...args); + + /// Initialize the children analyses starting from the provided top-level + /// operation and run the analysis until fixpoint. + LogicalResult initializeAndRun(Operation *top); + + /// Lookup an analysis state for the given program point. Returns null if one + /// does not exist. + template + const StateT *lookupState(PointT point) const { + auto it = analysisStates.find({ProgramPoint(point), TypeID::get()}); + if (it == analysisStates.end()) + return nullptr; + return static_cast(it->second.get()); + } + + /// Get a uniqued program point instance. If one is not present, it is + /// created with the provided arguments. + template + PointT *getProgramPoint(Args &&...args) { + return PointT::get(uniquer, std::forward(args)...); + } + + /// A work item on the solver queue is a program point, child analysis pair. + /// Each item is processed by invoking the child analysis at the program + /// point. + using WorkItem = std::pair; + /// Push a work item onto the worklist. + void enqueue(WorkItem item) { worklist.push(std::move(item)); } + + /// Get the state associated with the given program point. If it does not + /// exist, create an uninitialized state. + template + StateT *getOrCreateState(PointT point); + + /// Propagate an update to an analysis state if it changed by pushing + /// dependent work items to the back of the queue. + void propagateIfChanged(AnalysisState *state, ChangeResult changed); + +private: + /// The solver's work queue. Work items can be inserted to the front of the + /// queue to be processed greedily, speeding up computations that otherwise + /// quickly degenerate to quadratic due to propagation of state updates. + std::queue worklist; + + /// Type-erased instances of the children analyses. + SmallVector> childAnalyses; + + /// The storage uniquer instance that owns the memory of the allocated program + /// points. + StorageUniquer uniquer; + + /// A type-erased map of program points to associated analysis states for + /// first-class program points. + DenseMap, std::unique_ptr> + analysisStates; + + /// Allow the base child analysis class to access the internals of the solver. + friend class DataFlowAnalysis; +}; + +//===----------------------------------------------------------------------===// +// AnalysisState +//===----------------------------------------------------------------------===// + +/// Base class for generic analysis states. Analysis states contain data-flow +/// information that are attached to program points and which evolve as the +/// analysis iterates. +/// +/// This class places no restrictions on the semantics of analysis states beyond +/// these requirements. +/// +/// 1. Querying the state of a program point prior to visiting that point +/// results in uninitialized state. Analyses must be aware of unintialized +/// states. +/// 2. Analysis states can reach fixpoints, where subsequent updates will never +/// trigger a change in the state. +/// 3. Analysis states that are uninitialized can be forcefully initialized to a +/// default value. +class AnalysisState { +public: + virtual ~AnalysisState(); + + /// Create the analysis state at the given program point. + AnalysisState(ProgramPoint point) : point(point) {} + + /// Returns the program point this state is located at. + ProgramPoint getPoint() const { return point; } + + /// Print the contents of the analysis state. + virtual void print(raw_ostream &os) const = 0; + LLVM_DUMP_METHOD void dump() const; + + /// Add a dependency to this analysis state on a program point and an + /// analysis. If this state is updated, the analysis will be invoked on the + /// given program point again (in onUpdate()). + void addDependency(ProgramPoint dependent, DataFlowAnalysis *analysis); + +protected: + /// This function is called by the solver when the analysis state is updated + /// to enqueue more work items. For example, if a state tracks dependents + /// through the IR (e.g. use-def chains), this function can be implemented to + /// push those dependents on the worklist. + virtual void onUpdate(DataFlowSolver *solver) const { + for (const DataFlowSolver::WorkItem &item : dependents) + solver->enqueue(item); + } + + /// The program point to which the state belongs. + ProgramPoint point; + +#if LLVM_ENABLE_ABI_BREAKING_CHECKS + /// When compiling with debugging, keep a name for the analysis state. + StringRef debugName; +#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS + +private: + /// The dependency relations originating from this analysis state. An entry + /// `state -> (analysis, point)` is created when `analysis` queries `state` + /// when updating `point`. + /// + /// When this state is updated, all dependent child analysis invocations are + /// pushed to the back of the queue. Use a `SetVector` to keep the analysis + /// deterministic. + /// + /// Store the dependents on the analysis state for efficiency. + SetVector dependents; + + /// Allow the framework to access the dependents. + friend class DataFlowSolver; +}; + +//===----------------------------------------------------------------------===// +// DataFlowAnalysis +//===----------------------------------------------------------------------===// + +/// Base class for all data-flow analyses. A child analysis is expected to build +/// an initial dependency graph (and optionally provide an initial state) when +/// initialized and define transfer functions when visiting program points. +/// +/// In classical data-flow analysis, the dependency graph is fixed and analyses +/// define explicit transfer functions between input states and output states. +/// In this framework, however, the dependency graph can change during the +/// analysis, and transfer functions are opaque such that the solver doesn't +/// know what states calling `visit` on an analysis will be updated. This allows +/// multiple analyses to plug in and provide values for the same state. +/// +/// Generally, when an analysis queries an uninitialized state, it is expected +/// to "bail out", i.e., not provide any updates. When the value is initialized, +/// the solver will re-invoke the analysis. If the solver exhausts its worklist, +/// however, and there are still uninitialized states, the solver "nudges" the +/// analyses by default-initializing those states. +class DataFlowAnalysis { +public: + virtual ~DataFlowAnalysis(); + + /// Create an analysis with a reference to the parent solver. + explicit DataFlowAnalysis(DataFlowSolver &solver); + + /// Initialize the analysis from the provided top-level operation by building + /// an initial dependency graph between all program points of interest. This + /// can be implemented by calling `visit` on all program points of interest + /// below the top-level operation. + /// + /// An analysis can optionally provide initial values to certain analysis + /// states to influence the evolution of the analysis. + virtual LogicalResult initialize(Operation *top) = 0; + + /// Visit the given program point. This function is invoked by the solver on + /// this analysis with a given program point when a dependent analysis state + /// is updated. The function is similar to a transfer function; it queries + /// certain analysis states and sets other states. + /// + /// The function is expected to create dependencies on queried states and + /// propagate updates on changed states. A dependency can be created by + /// calling `addDependency` between the input state and a program point, + /// indicating that, if the state is updated, the solver should invoke `solve` + /// on the program point. The dependent point does not have to be the same as + /// the provided point. An update to a state is propagated by calling + /// `propagateIfChange` on the state. If the state has changed, then all its + /// dependents are placed on the worklist. + /// + /// The dependency graph does not need to be static. Each invocation of + /// `visit` can add new dependencies, but these dependencies will not be + /// dynamically added to the worklist because the solver doesn't know what + /// will provide a value for then. + virtual LogicalResult visit(ProgramPoint point) = 0; + +protected: + /// Create a dependency between the given analysis state and program point + /// on this analysis. + void addDependency(AnalysisState *state, ProgramPoint point); + + /// Propagate an update to a state if it changed. + void propagateIfChanged(AnalysisState *state, ChangeResult changed); + + /// Register a custom program point class. + template + void registerPointKind() { + solver.uniquer.registerParametricStorageType(); + } + + /// Get or create a custom program point. + template + PointT *getProgramPoint(Args &&...args) { + return solver.getProgramPoint(std::forward(args)...); + } + + /// Get the analysis state associated with the program point. The returned + /// state is expected to be "write-only", and any updates need to be + /// propagated by `propagateIfChanged`. + template + StateT *getOrCreate(PointT point) { + return solver.getOrCreateState(point); + } + + /// Get a read-only analysis state for the given point and create a dependency + /// on `dependent`. If the return state is updated elsewhere, this analysis is + /// re-invoked on the dependent. + template + const StateT *getOrCreateFor(ProgramPoint dependent, PointT point) { + StateT *state = getOrCreate(point); + addDependency(state, dependent); + return state; + } + +#if LLVM_ENABLE_ABI_BREAKING_CHECKS + /// When compiling with debugging, keep a name for the analyis. + StringRef debugName; +#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS + +private: + /// The parent data-flow solver. + DataFlowSolver &solver; + + /// Allow the data-flow solver to access the internals of this class. + friend class DataFlowSolver; +}; + +template +AnalysisT *DataFlowSolver::load(Args &&...args) { + childAnalyses.emplace_back(new AnalysisT(*this, std::forward(args)...)); +#if LLVM_ENABLE_ABI_BREAKING_CHECKS + childAnalyses.back().get()->debugName = llvm::getTypeName(); +#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS + return static_cast(childAnalyses.back().get()); +} + +template +StateT *DataFlowSolver::getOrCreateState(PointT point) { + std::unique_ptr &state = + analysisStates[{ProgramPoint(point), TypeID::get()}]; + if (!state) { + state = std::unique_ptr(new StateT(point)); +#if LLVM_ENABLE_ABI_BREAKING_CHECKS + state->debugName = llvm::getTypeName(); +#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS + } + return static_cast(state.get()); +} + +inline raw_ostream &operator<<(raw_ostream &os, const AnalysisState &state) { + state.print(os); + return os; +} + +inline raw_ostream &operator<<(raw_ostream &os, ProgramPoint point) { + point.print(os); + return os; +} + +} // end namespace mlir + +namespace llvm { +/// Allow hashing of program points. +template <> +struct DenseMapInfo + : public DenseMapInfo {}; + +// Allow llvm::cast style functions. +template +struct CastInfo + : public CastInfo {}; + +template +struct CastInfo + : public CastInfo {}; + +} // end namespace llvm + +#endif // MLIR_ANALYSIS_DATAFLOWFRAMEWORK_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataLayoutAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataLayoutAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..cba7ee1b0169268d262959cb7fd6b2e587192ef7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/DataLayoutAnalysis.h @@ -0,0 +1,48 @@ +//===- DataLayoutAnalysis.h - API for Querying Nested Data Layout -*- C++ -*-=// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_DATALAYOUTANALYSIS_H +#define MLIR_ANALYSIS_DATALAYOUTANALYSIS_H + +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/DenseMap.h" + +#include + +namespace mlir { + +class Operation; +class DataLayout; + +/// Stores data layout objects for each operation that specifies the data layout +/// above and below the given operation. +class DataLayoutAnalysis { +public: + /// Constructs the data layouts. + explicit DataLayoutAnalysis(Operation *root); + + /// Returns the data layout active at the given operation, that is the + /// data layout specified by the closest ancestor that can specify one, or the + /// default layout if there is no such ancestor. + const DataLayout &getAbove(Operation *operation) const; + + /// Returns the data layout specified by the given operation or its closest + /// ancestor that can specify one. + const DataLayout &getAtOrAbove(Operation *operation) const; + +private: + /// Storage for individual data layouts. + DenseMap> layouts; + + /// Default data layout in case no operations specify one. + std::unique_ptr defaultLayout; +}; + +} // namespace mlir + +#endif // MLIR_ANALYSIS_DATALAYOUTANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h new file mode 100644 index 0000000000000000000000000000000000000000..f3c46f5efd73cb134a7d9dfdfd037be5a1920e64 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h @@ -0,0 +1,533 @@ +//===- FlatLinearValueConstraints.h - Linear Constraints --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_FLATLINEARVALUECONSTRAINTS_H +#define MLIR_ANALYSIS_FLATLINEARVALUECONSTRAINTS_H + +#include "mlir/Analysis/Presburger/IntegerRelation.h" +#include "mlir/Analysis/Presburger/Matrix.h" +#include "mlir/IR/AffineExpr.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Support/LogicalResult.h" +#include + +namespace mlir { + +class AffineMap; +class IntegerSet; +class MLIRContext; +class Value; +class MemRefType; +struct MutableAffineMap; + +namespace presburger { +class MultiAffineFunction; +} // namespace presburger + +/// FlatLinearConstraints is an extension of IntegerPolyhedron. It provides an +/// AffineExpr-based API. +class FlatLinearConstraints : public presburger::IntegerPolyhedron { +public: + /// Constructs a constraint system reserving memory for the specified number + /// of constraints and variables. `valArgs` are the optional SSA values + /// associated with each dimension/symbol. These must either be empty or match + /// the number of dimensions and symbols. + FlatLinearConstraints(unsigned numReservedInequalities, + unsigned numReservedEqualities, + unsigned numReservedCols, unsigned numDims, + unsigned numSymbols, unsigned numLocals) + : IntegerPolyhedron(numReservedInequalities, numReservedEqualities, + numReservedCols, + presburger::PresburgerSpace::getSetSpace( + numDims, numSymbols, numLocals)) { + assert(numReservedCols >= getNumVars() + 1); + } + + /// Constructs a constraint system with the specified number of dimensions + /// and symbols. `valArgs` are the optional SSA values associated with each + /// dimension/symbol. These must either be empty or match the number of + /// dimensions and symbols. + FlatLinearConstraints(unsigned numDims = 0, unsigned numSymbols = 0, + unsigned numLocals = 0) + : FlatLinearConstraints(/*numReservedInequalities=*/0, + /*numReservedEqualities=*/0, + /*numReservedCols=*/numDims + numSymbols + + numLocals + 1, + numDims, numSymbols, numLocals) {} + + FlatLinearConstraints(const IntegerPolyhedron &fac) + : IntegerPolyhedron(fac) {} + + /// Return the kind of this object. + Kind getKind() const override { return Kind::FlatLinearConstraints; } + + /// Adds a bound for the variable at the specified position with constraints + /// being drawn from the specified bound map. In case of an EQ bound, the + /// bound map is expected to have exactly one result. In case of a LB/UB, the + /// bound map may have more than one result, for each of which an inequality + /// is added. + /// + /// The bound can be added as open or closed by specifying isClosedBound. In + /// case of a LB/UB, isClosedBound = false means the bound is added internally + /// as a closed bound by +1/-1 respectively. In case of an EQ bound, it can + /// only be added as a closed bound. + /// + /// Note: The dimensions/symbols of this FlatLinearConstraints must match the + /// dimensions/symbols of the affine map. + LogicalResult addBound(presburger::BoundType type, unsigned pos, + AffineMap boundMap, bool isClosedBound); + + /// Adds a bound for the variable at the specified position with constraints + /// being drawn from the specified bound map. In case of an EQ bound, the + /// bound map is expected to have exactly one result. In case of a LB/UB, the + /// bound map may have more than one result, for each of which an inequality + /// is added. + /// Note: The dimensions/symbols of this FlatLinearConstraints must match the + /// dimensions/symbols of the affine map. By default the lower bound is closed + /// and the upper bound is open. + LogicalResult addBound(presburger::BoundType type, unsigned pos, + AffineMap boundMap); + + /// The `addBound` overload above hides the inherited overloads by default, so + /// we explicitly introduce them here. + using IntegerPolyhedron::addBound; + + /// Returns the constraint system as an integer set. Returns a null integer + /// set if the system has no constraints, or if an integer set couldn't be + /// constructed as a result of a local variable's explicit representation not + /// being known and such a local variable appearing in any of the constraints. + IntegerSet getAsIntegerSet(MLIRContext *context) const; + + /// Computes the lower and upper bounds of the first `num` dimensional + /// variables (starting at `offset`) as an affine map of the remaining + /// variables (dimensional and symbolic). This method is able to detect + /// variables as floordiv's and mod's of affine expressions of other + /// variables with respect to (positive) constants. Sets bound map to a + /// null AffineMap if such a bound can't be found (or yet unimplemented). + /// + /// By default the returned lower bounds are closed and upper bounds are open. + /// If `closedUb` is true, the upper bound is closed. + void getSliceBounds(unsigned offset, unsigned num, MLIRContext *context, + SmallVectorImpl *lbMaps, + SmallVectorImpl *ubMaps, + bool closedUB = false); + + /// Composes an affine map whose dimensions and symbols match one to one with + /// the dimensions and symbols of this FlatLinearConstraints. The results of + /// the map `other` are added as the leading dimensions of this constraint + /// system. Returns failure if `other` is a semi-affine map. + LogicalResult composeMatchingMap(AffineMap other); + + /// Gets the lower and upper bound of the `offset` + `pos`th variable + /// treating [0, offset) U [offset + num, symStartPos) as dimensions and + /// [symStartPos, getNumDimAndSymbolVars) as symbols, and `pos` lies in + /// [0, num). The multi-dimensional maps in the returned pair represent the + /// max and min of potentially multiple affine expressions. `localExprs` holds + /// pre-computed AffineExpr's for all local variables in the system. + /// + /// By default the returned lower bounds are closed and upper bounds are open. + /// If `closedUb` is true, the upper bound is closed. + std::pair + getLowerAndUpperBound(unsigned pos, unsigned offset, unsigned num, + unsigned symStartPos, ArrayRef localExprs, + MLIRContext *context, bool closedUB = false) const; + + /// Insert variables of the specified kind at position `pos`. Positions are + /// relative to the kind of variable. The coefficient columns corresponding + /// to the added variables are initialized to zero. `vals` are the Values + /// corresponding to the variables. Values should not be used with + /// VarKind::Local since values can only be attached to non-local variables. + /// Return the absolute column position (i.e., not relative to the kind of + /// variable) of the first added variable. + /// + /// Note: Empty Values are allowed in `vals`. + unsigned insertDimVar(unsigned pos, unsigned num = 1) { + return insertVar(VarKind::SetDim, pos, num); + } + unsigned insertSymbolVar(unsigned pos, unsigned num = 1) { + return insertVar(VarKind::Symbol, pos, num); + } + unsigned insertLocalVar(unsigned pos, unsigned num = 1) { + return insertVar(VarKind::Local, pos, num); + } + + /// Append variables of the specified kind after the last variable of that + /// kind. The coefficient columns corresponding to the added variables are + /// initialized to zero. `vals` are the Values corresponding to the + /// variables. Return the absolute column position (i.e., not relative to the + /// kind of variable) of the first appended variable. + /// + /// Note: Empty Values are allowed in `vals`. + unsigned appendDimVar(unsigned num = 1) { + return appendVar(VarKind::SetDim, num); + } + unsigned appendSymbolVar(unsigned num = 1) { + return appendVar(VarKind::Symbol, num); + } + unsigned appendLocalVar(unsigned num = 1) { + return appendVar(VarKind::Local, num); + } + +protected: + using VarKind = presburger::VarKind; + + /// Compute an explicit representation for local vars. For all systems coming + /// from MLIR integer sets, maps, or expressions where local vars were + /// introduced to model floordivs and mods, this always succeeds. + LogicalResult computeLocalVars(SmallVectorImpl &memo, + MLIRContext *context) const; + + /// Given an affine map that is aligned with this constraint system: + /// * Flatten the map. + /// * Add newly introduced local columns at the beginning of this constraint + /// system (local column pos 0). + /// * Add equalities that define the new local columns to this constraint + /// system. + /// * Return the flattened expressions via `flattenedExprs`. + /// + /// Note: This is a shared helper function of `addLowerOrUpperBound` and + /// `composeMatchingMap`. + LogicalResult flattenAlignedMapAndMergeLocals( + AffineMap map, std::vector> *flattenedExprs); + + /// Prints the number of constraints, dimensions, symbols and locals in the + /// FlatLinearConstraints. Also, prints for each variable whether there is + /// an SSA Value attached to it. + void printSpace(raw_ostream &os) const override; +}; + +/// FlatLinearValueConstraints represents an extension of FlatLinearConstraints +/// where each non-local variable can have an SSA Value attached to it. +class FlatLinearValueConstraints : public FlatLinearConstraints { +public: + /// Constructs a constraint system reserving memory for the specified number + /// of constraints and variables. `valArgs` are the optional SSA values + /// associated with each dimension/symbol. These must either be empty or match + /// the number of dimensions and symbols. + FlatLinearValueConstraints(unsigned numReservedInequalities, + unsigned numReservedEqualities, + unsigned numReservedCols, unsigned numDims, + unsigned numSymbols, unsigned numLocals, + ArrayRef> valArgs) + : FlatLinearConstraints(numReservedInequalities, numReservedEqualities, + numReservedCols, numDims, numSymbols, numLocals) { + assert(valArgs.empty() || valArgs.size() == getNumDimAndSymbolVars()); + values.reserve(numReservedCols); + if (valArgs.empty()) + values.resize(getNumDimAndSymbolVars(), std::nullopt); + else + values.append(valArgs.begin(), valArgs.end()); + } + + /// Constructs a constraint system reserving memory for the specified number + /// of constraints and variables. `valArgs` are the optional SSA values + /// associated with each dimension/symbol. These must either be empty or match + /// the number of dimensions and symbols. + FlatLinearValueConstraints(unsigned numReservedInequalities, + unsigned numReservedEqualities, + unsigned numReservedCols, unsigned numDims, + unsigned numSymbols, unsigned numLocals, + ArrayRef valArgs) + : FlatLinearConstraints(numReservedInequalities, numReservedEqualities, + numReservedCols, numDims, numSymbols, numLocals) { + assert(valArgs.empty() || valArgs.size() == getNumDimAndSymbolVars()); + values.reserve(numReservedCols); + if (valArgs.empty()) + values.resize(getNumDimAndSymbolVars(), std::nullopt); + else + values.append(valArgs.begin(), valArgs.end()); + } + + /// Constructs a constraint system with the specified number of dimensions + /// and symbols. `valArgs` are the optional SSA values associated with each + /// dimension/symbol. These must either be empty or match the number of + /// dimensions and symbols. + FlatLinearValueConstraints(unsigned numDims, unsigned numSymbols, + unsigned numLocals, + ArrayRef> valArgs) + : FlatLinearValueConstraints(/*numReservedInequalities=*/0, + /*numReservedEqualities=*/0, + /*numReservedCols=*/numDims + numSymbols + + numLocals + 1, + numDims, numSymbols, numLocals, valArgs) {} + + /// Constructs a constraint system with the specified number of dimensions + /// and symbols. `valArgs` are the optional SSA values associated with each + /// dimension/symbol. These must either be empty or match the number of + /// dimensions and symbols. + FlatLinearValueConstraints(unsigned numDims = 0, unsigned numSymbols = 0, + unsigned numLocals = 0, + ArrayRef valArgs = {}) + : FlatLinearValueConstraints(/*numReservedInequalities=*/0, + /*numReservedEqualities=*/0, + /*numReservedCols=*/numDims + numSymbols + + numLocals + 1, + numDims, numSymbols, numLocals, valArgs) {} + + FlatLinearValueConstraints(const IntegerPolyhedron &fac, + ArrayRef> valArgs = {}) + : FlatLinearConstraints(fac) { + assert(valArgs.empty() || valArgs.size() == getNumDimAndSymbolVars()); + if (valArgs.empty()) + values.resize(getNumDimAndSymbolVars(), std::nullopt); + else + values.append(valArgs.begin(), valArgs.end()); + } + + /// Creates an affine constraint system from an IntegerSet. + explicit FlatLinearValueConstraints(IntegerSet set, ValueRange operands = {}); + + /// Return the kind of this object. + Kind getKind() const override { return Kind::FlatLinearValueConstraints; } + + static bool classof(const IntegerRelation *cst) { + return cst->getKind() >= Kind::FlatLinearValueConstraints && + cst->getKind() <= Kind::FlatAffineRelation; + } + + /// Replaces the contents of this FlatLinearValueConstraints with `other`. + void clearAndCopyFrom(const IntegerRelation &other) override; + + /// Adds a constant bound for the variable associated with the given Value. + void addBound(presburger::BoundType type, Value val, int64_t value); + using FlatLinearConstraints::addBound; + + /// Returns the Value associated with the pos^th variable. Asserts if + /// no Value variable was associated. + inline Value getValue(unsigned pos) const { + assert(pos < getNumDimAndSymbolVars() && "Invalid position"); + assert(hasValue(pos) && "variable's Value not set"); + return *values[pos]; + } + + /// Returns the Values associated with variables in range [start, end). + /// Asserts if no Value was associated with one of these variables. + inline void getValues(unsigned start, unsigned end, + SmallVectorImpl *values) const { + assert(end <= getNumDimAndSymbolVars() && "invalid end position"); + assert(start <= end && "invalid start position"); + values->clear(); + values->reserve(end - start); + for (unsigned i = start; i < end; i++) + values->push_back(getValue(i)); + } + + inline ArrayRef> getMaybeValues() const { + return {values.data(), values.size()}; + } + + inline ArrayRef> + getMaybeValues(presburger::VarKind kind) const { + assert(kind != VarKind::Local && + "Local variables do not have any value attached to them."); + return {values.data() + getVarKindOffset(kind), getNumVarKind(kind)}; + } + + /// Returns true if the pos^th variable has an associated Value. + inline bool hasValue(unsigned pos) const { + assert(pos < getNumDimAndSymbolVars() && "Invalid position"); + return values[pos].has_value(); + } + + unsigned appendDimVar(ValueRange vals); + using FlatLinearConstraints::appendDimVar; + + unsigned appendSymbolVar(ValueRange vals); + using FlatLinearConstraints::appendSymbolVar; + + unsigned insertDimVar(unsigned pos, ValueRange vals); + using FlatLinearConstraints::insertDimVar; + + unsigned insertSymbolVar(unsigned pos, ValueRange vals); + using FlatLinearConstraints::insertSymbolVar; + + unsigned insertVar(presburger::VarKind kind, unsigned pos, + unsigned num = 1) override; + unsigned insertVar(presburger::VarKind kind, unsigned pos, ValueRange vals); + + /// Removes variables in the column range [varStart, varLimit), and copies any + /// remaining valid data into place, updates member variables, and resizes + /// arrays as needed. + void removeVarRange(presburger::VarKind kind, unsigned varStart, + unsigned varLimit) override; + using IntegerPolyhedron::removeVarRange; + + /// Sets the Value associated with the pos^th variable. + inline void setValue(unsigned pos, Value val) { + assert(pos < getNumDimAndSymbolVars() && "invalid var position"); + values[pos] = val; + } + + /// Sets the Values associated with the variables in the range [start, end). + /// The range must contain only dim and symbol variables. + void setValues(unsigned start, unsigned end, ArrayRef values) { + assert(end <= getNumVars() && "invalid end position"); + assert(start <= end && "invalid start position"); + assert(values.size() == end - start && + "value should be provided for each variable in the range."); + for (unsigned i = start; i < end; ++i) + setValue(i, values[i - start]); + } + + /// Looks up the position of the variable with the specified Value. Returns + /// true if found (false otherwise). `pos` is set to the (column) position of + /// the variable. + bool findVar(Value val, unsigned *pos) const; + + /// Returns true if a variable with the specified Value exists, false + /// otherwise. + bool containsVar(Value val) const; + + /// Projects out the variable that is associate with Value. + void projectOut(Value val); + using IntegerPolyhedron::projectOut; + + /// Swap the posA^th variable with the posB^th variable. + void swapVar(unsigned posA, unsigned posB) override; + + /// Prints the number of constraints, dimensions, symbols and locals in the + /// FlatAffineValueConstraints. Also, prints for each variable whether there + /// is an SSA Value attached to it. + void printSpace(raw_ostream &os) const override; + + /// Align `map` with this constraint system based on `operands`. Each operand + /// must already have a corresponding dim/symbol in this constraint system. + AffineMap computeAlignedMap(AffineMap map, ValueRange operands) const; + + /// Merge and align the variables of `this` and `other` starting at + /// `offset`, so that both constraint systems get the union of the contained + /// variables that is dimension-wise and symbol-wise unique; both + /// constraint systems are updated so that they have the union of all + /// variables, with `this`'s original variables appearing first followed + /// by any of `other`'s variables that didn't appear in `this`. Local + /// variables in `other` that have the same division representation as local + /// variables in `this` are merged into one. + // E.g.: Input: `this` has (%i, %j) [%M, %N] + // `other` has (%k, %j) [%P, %N, %M] + // Output: both `this`, `other` have (%i, %j, %k) [%M, %N, %P] + // + void mergeAndAlignVarsWithOther(unsigned offset, + FlatLinearValueConstraints *other); + + /// Merge and align symbols of `this` and `other` such that both get union of + /// of symbols that are unique. Symbols in `this` and `other` should be + /// unique. Symbols with Value as `None` are considered to be inequal to all + /// other symbols. + void mergeSymbolVars(FlatLinearValueConstraints &other); + + /// Returns true if this constraint system and `other` are in the same + /// space, i.e., if they are associated with the same set of variables, + /// appearing in the same order. Returns false otherwise. + bool areVarsAlignedWithOther(const FlatLinearConstraints &other); + + /// Updates the constraints to be the smallest bounding (enclosing) box that + /// contains the points of `this` set and that of `other`, with the symbols + /// being treated specially. For each of the dimensions, the min of the lower + /// bounds (symbolic) and the max of the upper bounds (symbolic) is computed + /// to determine such a bounding box. `other` is expected to have the same + /// dimensional variables as this constraint system (in the same order). + /// + /// E.g.: + /// 1) this = {0 <= d0 <= 127}, + /// other = {16 <= d0 <= 192}, + /// output = {0 <= d0 <= 192} + /// 2) this = {s0 + 5 <= d0 <= s0 + 20}, + /// other = {s0 + 1 <= d0 <= s0 + 9}, + /// output = {s0 + 1 <= d0 <= s0 + 20} + /// 3) this = {0 <= d0 <= 5, 1 <= d1 <= 9} + /// other = {2 <= d0 <= 6, 5 <= d1 <= 15}, + /// output = {0 <= d0 <= 6, 1 <= d1 <= 15} + LogicalResult unionBoundingBox(const FlatLinearValueConstraints &other); + using IntegerPolyhedron::unionBoundingBox; + +protected: + /// Eliminates the variable at the specified position using Fourier-Motzkin + /// variable elimination, but uses Gaussian elimination if there is an + /// equality involving that variable. If the result of the elimination is + /// integer exact, `*isResultIntegerExact` is set to true. If `darkShadow` is + /// set to true, a potential under approximation (subset) of the rational + /// shadow / exact integer shadow is computed. + // See implementation comments for more details. + void fourierMotzkinEliminate(unsigned pos, bool darkShadow = false, + bool *isResultIntegerExact = nullptr) override; + + /// Returns false if the fields corresponding to various variable counts, or + /// equality/inequality buffer sizes aren't consistent; true otherwise. This + /// is meant to be used within an assert internally. + bool hasConsistentState() const override; + + /// Values corresponding to the (column) non-local variables of this + /// constraint system appearing in the order the variables correspond to + /// columns. Variables that aren't associated with any Value are set to + /// std::nullopt. + SmallVector, 8> values; +}; + +/// Flattens 'expr' into 'flattenedExpr', which contains the coefficients of the +/// dimensions, symbols, and additional variables that represent floor divisions +/// of dimensions, symbols, and in turn other floor divisions. Returns failure +/// if 'expr' could not be flattened (i.e., semi-affine is not yet handled). +/// 'cst' contains constraints that connect newly introduced local variables +/// to existing dimensional and symbolic variables. See documentation for +/// AffineExprFlattener on how mod's and div's are flattened. +LogicalResult getFlattenedAffineExpr(AffineExpr expr, unsigned numDims, + unsigned numSymbols, + SmallVectorImpl *flattenedExpr, + FlatLinearConstraints *cst = nullptr); + +/// Flattens the result expressions of the map to their corresponding flattened +/// forms and set in 'flattenedExprs'. Returns failure if any expression in the +/// map could not be flattened (i.e., semi-affine is not yet handled). 'cst' +/// contains constraints that connect newly introduced local variables to +/// existing dimensional and / symbolic variables. See documentation for +/// AffineExprFlattener on how mod's and div's are flattened. For all affine +/// expressions that share the same operands (like those of an affine map), this +/// method should be used instead of repeatedly calling getFlattenedAffineExpr +/// since local variables added to deal with div's and mod's will be reused +/// across expressions. +LogicalResult +getFlattenedAffineExprs(AffineMap map, + std::vector> *flattenedExprs, + FlatLinearConstraints *cst = nullptr); +LogicalResult +getFlattenedAffineExprs(IntegerSet set, + std::vector> *flattenedExprs, + FlatLinearConstraints *cst = nullptr); + +LogicalResult +getMultiAffineFunctionFromMap(AffineMap map, + presburger::MultiAffineFunction &multiAff); + +/// Re-indexes the dimensions and symbols of an affine map with given `operands` +/// values to align with `dims` and `syms` values. +/// +/// Each dimension/symbol of the map, bound to an operand `o`, is replaced with +/// dimension `i`, where `i` is the position of `o` within `dims`. If `o` is not +/// in `dims`, replace it with symbol `i`, where `i` is the position of `o` +/// within `syms`. If `o` is not in `syms` either, replace it with a new symbol. +/// +/// Note: If a value appears multiple times as a dimension/symbol (or both), all +/// corresponding dim/sym expressions are replaced with the first dimension +/// bound to that value (or first symbol if no such dimension exists). +/// +/// The resulting affine map has `dims.size()` many dimensions and at least +/// `syms.size()` many symbols. +/// +/// The SSA values of the symbols of the resulting map are optionally returned +/// via `newSyms`. This is a concatenation of `syms` with the SSA values of the +/// newly added symbols. +/// +/// Note: As part of this re-indexing, dimensions may turn into symbols, or vice +/// versa. +AffineMap alignAffineMapWithValues(AffineMap map, ValueRange operands, + ValueRange dims, ValueRange syms, + SmallVector *newSyms = nullptr); + +} // namespace mlir + +#endif // MLIR_ANALYSIS_FLATLINEARVALUECONSTRAINTS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Liveness.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Liveness.h new file mode 100644 index 0000000000000000000000000000000000000000..ca4d8dfab3c919a837b09675c4b6f453ae3b2e86 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Liveness.h @@ -0,0 +1,158 @@ +//===- Liveness.h - Liveness analysis for MLIR ------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains an analysis for computing liveness information from a +// given top-level operation. The current version of the analysis uses a +// traditional algorithm to resolve detailed live-range information about all +// values within the specified regions. It is also possible to query liveness +// information on block level. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_LIVENESS_H +#define MLIR_ANALYSIS_LIVENESS_H + +#include + +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallPtrSet.h" + +namespace mlir { + +class Block; +class LivenessBlockInfo; +class Operation; +class Region; +class Value; + +/// Represents an analysis for computing liveness information from a +/// given top-level operation. The analysis iterates over all associated +/// regions that are attached to the given top-level operation. It +/// computes liveness information for every value and block that are +/// included in the mentioned regions. It relies on a fixpoint iteration +/// to compute all live-in and live-out values of all included blocks. +/// Sample usage: +/// Liveness liveness(topLevelOp); +/// auto &allInValues = liveness.getLiveIn(block); +/// auto &allOutValues = liveness.getLiveOut(block); +/// auto allOperationsInWhichValueIsLive = liveness.resolveLiveness(value); +/// bool isDeafAfter = liveness.isDeadAfter(value, operation); +class Liveness { +public: + using OperationListT = std::vector; + using BlockMapT = DenseMap; + using ValueSetT = SmallPtrSet; + +public: + /// Creates a new Liveness analysis that computes liveness + /// information for all associated regions. + Liveness(Operation *op); + + /// Returns the operation this analysis was constructed from. + Operation *getOperation() const { return operation; } + + /// Gets liveness info (if any) for the given value. + /// This includes all operations in which the given value is live. + /// Note that the operations in this list are not ordered and the current + /// implementation is computationally expensive (as it iterates over all + /// blocks in which the given value is live). + OperationListT resolveLiveness(Value value) const; + + /// Gets liveness info (if any) for the block. + const LivenessBlockInfo *getLiveness(Block *block) const; + + /// Returns a reference to a set containing live-in values (unordered). + const ValueSetT &getLiveIn(Block *block) const; + + /// Returns a reference to a set containing live-out values (unordered). + const ValueSetT &getLiveOut(Block *block) const; + + /// Returns true if `value` is not live after `operation`. + bool isDeadAfter(Value value, Operation *operation) const; + + /// Dumps the liveness information in a human readable format. + void dump() const; + + /// Dumps the liveness information to the given stream. + void print(raw_ostream &os) const; + +private: + /// Initializes the internal mappings. + void build(); + +private: + /// The operation this analysis was constructed from. + Operation *operation; + + /// Maps blocks to internal liveness information. + BlockMapT blockMapping; +}; + +/// This class represents liveness information on block level. +class LivenessBlockInfo { +public: + /// A typedef declaration of a value set. + using ValueSetT = Liveness::ValueSetT; + +public: + /// Returns the underlying block. + Block *getBlock() const { return block; } + + /// Returns all values that are live at the beginning + /// of the block (unordered). + const ValueSetT &in() const { return inValues; } + + /// Returns all values that are live at the end + /// of the block (unordered). + const ValueSetT &out() const { return outValues; } + + /// Returns true if the given value is in the live-in set. + bool isLiveIn(Value value) const; + + /// Returns true if the given value is in the live-out set. + bool isLiveOut(Value value) const; + + /// Gets the start operation for the given value. This is the first operation + /// the given value is considered to be live. This could either be the start + /// operation of the current block (in case the value is live-in) or the + /// operation that defines the given value (must be referenced in this block). + Operation *getStartOperation(Value value) const; + + /// Gets the end operation for the given value using the start operation + /// provided (must be referenced in this block). + Operation *getEndOperation(Value value, Operation *startOperation) const; + + /// Get the set of values that are currently live (if any) for the current op. + /// This analysis takes an expansive view of "live" in that if a value is + /// defined by or within the operation or is fully consumed (as in last user) + /// by or within the operation the value is considered "live". The values in + /// the list are not ordered. + /// + /// This check is quite expensive as it does not cache the results of the + /// computation, so the currently live values have to be recomputed for each + /// op. + ValueSetT currentlyLiveValues(Operation *op) const; + +private: + /// The underlying block. + Block *block = nullptr; + + /// The set of all live in values. + ValueSetT inValues; + + /// The set of all live out values. + ValueSetT outValues; + + friend class Liveness; +}; + +} // namespace mlir + +#endif // MLIR_ANALYSIS_LIVENESS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Fraction.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Fraction.h new file mode 100644 index 0000000000000000000000000000000000000000..a410f528e1f8001e1747b9d5b1f5ae695c1de359 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Fraction.h @@ -0,0 +1,155 @@ +//===- Fraction.h - MLIR Fraction Class -------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This is a simple class to represent fractions. It supports arithmetic, +// comparison, floor, and ceiling operations. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_FRACTION_H +#define MLIR_ANALYSIS_PRESBURGER_FRACTION_H + +#include "mlir/Analysis/Presburger/MPInt.h" +#include "mlir/Support/MathExtras.h" + +namespace mlir { +namespace presburger { + +/// A class to represent fractions. The sign of the fraction is represented +/// in the sign of the numerator; the denominator is always positive. +/// +/// Note that overflows may occur if the numerator or denominator are not +/// representable by 64-bit integers. +struct Fraction { + /// Default constructor initializes the represented rational number to zero. + Fraction() = default; + + /// Construct a Fraction from a numerator and denominator. + Fraction(const MPInt &oNum, const MPInt &oDen = MPInt(1)) + : num(oNum), den(oDen) { + if (den < 0) { + num = -num; + den = -den; + } + } + /// Overloads for passing literals. + Fraction(const MPInt &num, int64_t den = 1) : Fraction(num, MPInt(den)) {} + Fraction(int64_t num, const MPInt &den = MPInt(1)) + : Fraction(MPInt(num), den) {} + Fraction(int64_t num, int64_t den) : Fraction(MPInt(num), MPInt(den)) {} + + // Return the value of the fraction as an integer. This should only be called + // when the fraction's value is really an integer. + MPInt getAsInteger() const { + assert(num % den == 0 && "Get as integer called on non-integral fraction!"); + return num / den; + } + + llvm::raw_ostream &print(llvm::raw_ostream &os) const { + return os << "(" << num << "/" << den << ")"; + } + + /// The numerator and denominator, respectively. The denominator is always + /// positive. + MPInt num{0}, den{1}; +}; + +/// Three-way comparison between two fractions. +/// Returns +1, 0, and -1 if the first fraction is greater than, equal to, or +/// less than the second fraction, respectively. +inline int compare(const Fraction &x, const Fraction &y) { + MPInt diff = x.num * y.den - y.num * x.den; + if (diff > 0) + return +1; + if (diff < 0) + return -1; + return 0; +} + +inline MPInt floor(const Fraction &f) { return floorDiv(f.num, f.den); } + +inline MPInt ceil(const Fraction &f) { return ceilDiv(f.num, f.den); } + +inline Fraction operator-(const Fraction &x) { return Fraction(-x.num, x.den); } + +inline bool operator<(const Fraction &x, const Fraction &y) { + return compare(x, y) < 0; +} + +inline bool operator<=(const Fraction &x, const Fraction &y) { + return compare(x, y) <= 0; +} + +inline bool operator==(const Fraction &x, const Fraction &y) { + return compare(x, y) == 0; +} + +inline bool operator!=(const Fraction &x, const Fraction &y) { + return compare(x, y) != 0; +} + +inline bool operator>(const Fraction &x, const Fraction &y) { + return compare(x, y) > 0; +} + +inline bool operator>=(const Fraction &x, const Fraction &y) { + return compare(x, y) >= 0; +} + +inline Fraction reduce(const Fraction &f) { + if (f == Fraction(0)) + return Fraction(0, 1); + MPInt g = gcd(abs(f.num), abs(f.den)); + return Fraction(f.num / g, f.den / g); +} + +inline Fraction operator*(const Fraction &x, const Fraction &y) { + return reduce(Fraction(x.num * y.num, x.den * y.den)); +} + +inline Fraction operator/(const Fraction &x, const Fraction &y) { + return reduce(Fraction(x.num * y.den, x.den * y.num)); +} + +inline Fraction operator+(const Fraction &x, const Fraction &y) { + return reduce(Fraction(x.num * y.den + x.den * y.num, x.den * y.den)); +} + +inline Fraction operator-(const Fraction &x, const Fraction &y) { + return reduce(Fraction(x.num * y.den - x.den * y.num, x.den * y.den)); +} + +inline Fraction &operator+=(Fraction &x, const Fraction &y) { + x = x + y; + return x; +} + +inline Fraction &operator-=(Fraction &x, const Fraction &y) { + x = x - y; + return x; +} + +inline Fraction &operator/=(Fraction &x, const Fraction &y) { + x = x / y; + return x; +} + +inline Fraction &operator*=(Fraction &x, const Fraction &y) { + x = x * y; + return x; +} + +inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) { + x.print(os); + return os; +} + +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_FRACTION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h new file mode 100644 index 0000000000000000000000000000000000000000..56484622ec980cd7b306c9fbb73ddb764a4d3e83 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h @@ -0,0 +1,888 @@ +//===- IntegerRelation.h - MLIR IntegerRelation Class ---------*- C++ -*---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// A class to represent a relation over integer tuples. A relation is +// represented as a constraint system over a space of tuples of integer valued +// variables supporting symbolic variables and existential quantification. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_INTEGERRELATION_H +#define MLIR_ANALYSIS_PRESBURGER_INTEGERRELATION_H + +#include "mlir/Analysis/Presburger/Fraction.h" +#include "mlir/Analysis/Presburger/Matrix.h" +#include "mlir/Analysis/Presburger/PresburgerSpace.h" +#include "mlir/Analysis/Presburger/Utils.h" +#include "mlir/Support/LogicalResult.h" +#include + +namespace mlir { +namespace presburger { + +class IntegerRelation; +class IntegerPolyhedron; +class PresburgerSet; +class PresburgerRelation; +struct SymbolicLexOpt; + +/// The type of bound: equal, lower bound or upper bound. +enum class BoundType { EQ, LB, UB }; + +/// An IntegerRelation represents the set of points from a PresburgerSpace that +/// satisfy a list of affine constraints. Affine constraints can be inequalities +/// or equalities in the form: +/// +/// Inequality: c_0*x_0 + c_1*x_1 + .... + c_{n-1}*x_{n-1} + c_n >= 0 +/// Equality : c_0*x_0 + c_1*x_1 + .... + c_{n-1}*x_{n-1} + c_n == 0 +/// +/// where c_0, c_1, ..., c_n are integers and n is the total number of +/// variables in the space. +/// +/// Such a relation corresponds to the set of integer points lying in a convex +/// polyhedron. For example, consider the relation: +/// (x) -> (y) : (1 <= x <= 7, x = 2y) +/// These can be thought of as points in the polyhedron: +/// (x, y) : (1 <= x <= 7, x = 2y) +/// This relation contains the pairs (2, 1), (4, 2), and (6, 3). +/// +/// Since IntegerRelation makes a distinction between dimensions, VarKind::Range +/// and VarKind::Domain should be used to refer to dimension variables. +class IntegerRelation { +public: + /// All derived classes of IntegerRelation. + enum class Kind { + IntegerRelation, + IntegerPolyhedron, + FlatLinearConstraints, + FlatLinearValueConstraints, + FlatAffineValueConstraints, + FlatAffineRelation + }; + + /// Constructs a relation reserving memory for the specified number + /// of constraints and variables. + IntegerRelation(unsigned numReservedInequalities, + unsigned numReservedEqualities, unsigned numReservedCols, + const PresburgerSpace &space) + : space(space), equalities(0, space.getNumVars() + 1, + numReservedEqualities, numReservedCols), + inequalities(0, space.getNumVars() + 1, numReservedInequalities, + numReservedCols) { + assert(numReservedCols >= space.getNumVars() + 1); + } + + /// Constructs a relation with the specified number of dimensions and symbols. + explicit IntegerRelation(const PresburgerSpace &space) + : IntegerRelation(/*numReservedInequalities=*/0, + /*numReservedEqualities=*/0, + /*numReservedCols=*/space.getNumVars() + 1, space) {} + + virtual ~IntegerRelation() = default; + + /// Return a system with no constraints, i.e., one which is satisfied by all + /// points. + static IntegerRelation getUniverse(const PresburgerSpace &space) { + return IntegerRelation(space); + } + + /// Return the kind of this IntegerRelation. + virtual Kind getKind() const { return Kind::IntegerRelation; } + + static bool classof(const IntegerRelation *cst) { return true; } + + // Clones this object. + std::unique_ptr clone() const; + + /// Returns a reference to the underlying space. + const PresburgerSpace &getSpace() const { return space; } + + /// Set the space to `oSpace`, which should have the same number of ids as + /// the current space. + void setSpace(const PresburgerSpace &oSpace); + + /// Set the space to `oSpace`, which should not have any local ids. + /// `oSpace` can have fewer ids than the current space; in that case, the + /// the extra ids in `this` that are not accounted for by `oSpace` will be + /// considered as local ids. `oSpace` should not have more ids than the + /// current space; this will result in an assert failure. + void setSpaceExceptLocals(const PresburgerSpace &oSpace); + + /// Returns a copy of the space without locals. + PresburgerSpace getSpaceWithoutLocals() const { + return PresburgerSpace::getRelationSpace(space.getNumDomainVars(), + space.getNumRangeVars(), + space.getNumSymbolVars()); + } + + /// Appends constraints from `other` into `this`. This is equivalent to an + /// intersection with no simplification of any sort attempted. + void append(const IntegerRelation &other); + + /// Return the intersection of the two relations. + /// If there are locals, they will be merged. + IntegerRelation intersect(IntegerRelation other) const; + + /// Return whether `this` and `other` are equal. This is integer-exact + /// and somewhat expensive, since it uses the integer emptiness check + /// (see IntegerRelation::findIntegerSample()). + bool isEqual(const IntegerRelation &other) const; + + /// Perform a quick equality check on `this` and `other`. The relations are + /// equal if the check return true, but may or may not be equal if the check + /// returns false. The equality check is performed in a plain manner, by + /// comparing if all the equalities and inequalities in `this` and `other` + /// are the same. + bool isPlainEqual(const IntegerRelation &other) const; + + /// Return whether this is a subset of the given IntegerRelation. This is + /// integer-exact and somewhat expensive, since it uses the integer emptiness + /// check (see IntegerRelation::findIntegerSample()). + bool isSubsetOf(const IntegerRelation &other) const; + + /// Returns the value at the specified equality row and column. + inline MPInt atEq(unsigned i, unsigned j) const { return equalities(i, j); } + /// The same, but casts to int64_t. This is unsafe and will assert-fail if the + /// value does not fit in an int64_t. + inline int64_t atEq64(unsigned i, unsigned j) const { + return int64_t(equalities(i, j)); + } + inline MPInt &atEq(unsigned i, unsigned j) { return equalities(i, j); } + + /// Returns the value at the specified inequality row and column. + inline MPInt atIneq(unsigned i, unsigned j) const { + return inequalities(i, j); + } + /// The same, but casts to int64_t. This is unsafe and will assert-fail if the + /// value does not fit in an int64_t. + inline int64_t atIneq64(unsigned i, unsigned j) const { + return int64_t(inequalities(i, j)); + } + inline MPInt &atIneq(unsigned i, unsigned j) { return inequalities(i, j); } + + unsigned getNumConstraints() const { + return getNumInequalities() + getNumEqualities(); + } + + unsigned getNumDomainVars() const { return space.getNumDomainVars(); } + unsigned getNumRangeVars() const { return space.getNumRangeVars(); } + unsigned getNumSymbolVars() const { return space.getNumSymbolVars(); } + unsigned getNumLocalVars() const { return space.getNumLocalVars(); } + + unsigned getNumDimVars() const { return space.getNumDimVars(); } + unsigned getNumDimAndSymbolVars() const { + return space.getNumDimAndSymbolVars(); + } + unsigned getNumVars() const { return space.getNumVars(); } + + /// Returns the number of columns in the constraint system. + inline unsigned getNumCols() const { return space.getNumVars() + 1; } + + inline unsigned getNumEqualities() const { return equalities.getNumRows(); } + + inline unsigned getNumInequalities() const { + return inequalities.getNumRows(); + } + + inline unsigned getNumReservedEqualities() const { + return equalities.getNumReservedRows(); + } + + inline unsigned getNumReservedInequalities() const { + return inequalities.getNumReservedRows(); + } + + inline ArrayRef getEquality(unsigned idx) const { + return equalities.getRow(idx); + } + inline ArrayRef getInequality(unsigned idx) const { + return inequalities.getRow(idx); + } + /// The same, but casts to int64_t. This is unsafe and will assert-fail if the + /// value does not fit in an int64_t. + inline SmallVector getEquality64(unsigned idx) const { + return getInt64Vec(equalities.getRow(idx)); + } + inline SmallVector getInequality64(unsigned idx) const { + return getInt64Vec(inequalities.getRow(idx)); + } + + /// Get the number of vars of the specified kind. + unsigned getNumVarKind(VarKind kind) const { + return space.getNumVarKind(kind); + } + + /// Return the index at which the specified kind of vars starts. + unsigned getVarKindOffset(VarKind kind) const { + return space.getVarKindOffset(kind); + } + + /// Return the index at Which the specified kind of vars ends. + unsigned getVarKindEnd(VarKind kind) const { + return space.getVarKindEnd(kind); + } + + /// Get the number of elements of the specified kind in the range + /// [varStart, varLimit). + unsigned getVarKindOverlap(VarKind kind, unsigned varStart, + unsigned varLimit) const { + return space.getVarKindOverlap(kind, varStart, varLimit); + } + + /// Return the VarKind of the var at the specified position. + VarKind getVarKindAt(unsigned pos) const { return space.getVarKindAt(pos); } + + /// The struct CountsSnapshot stores the count of each VarKind, and also of + /// each constraint type. getCounts() returns a CountsSnapshot object + /// describing the current state of the IntegerRelation. truncate() truncates + /// all vars of each VarKind and all constraints of both kinds beyond the + /// counts in the specified CountsSnapshot object. This can be used to achieve + /// rudimentary rollback support. As long as none of the existing constraints + /// or vars are disturbed, and only additional vars or constraints are added, + /// this addition can be rolled back using truncate. + struct CountsSnapshot { + public: + CountsSnapshot(const PresburgerSpace &space, unsigned numIneqs, + unsigned numEqs) + : space(space), numIneqs(numIneqs), numEqs(numEqs) {} + const PresburgerSpace &getSpace() const { return space; }; + unsigned getNumIneqs() const { return numIneqs; } + unsigned getNumEqs() const { return numEqs; } + + private: + PresburgerSpace space; + unsigned numIneqs, numEqs; + }; + CountsSnapshot getCounts() const; + void truncate(const CountsSnapshot &counts); + + /// Insert `num` variables of the specified kind at position `pos`. + /// Positions are relative to the kind of variable. The coefficient columns + /// corresponding to the added variables are initialized to zero. Return the + /// absolute column position (i.e., not relative to the kind of variable) + /// of the first added variable. + virtual unsigned insertVar(VarKind kind, unsigned pos, unsigned num = 1); + + /// Append `num` variables of the specified kind after the last variable + /// of that kind. The coefficient columns corresponding to the added variables + /// are initialized to zero. Return the absolute column position (i.e., not + /// relative to the kind of variable) of the first appended variable. + unsigned appendVar(VarKind kind, unsigned num = 1); + + /// Adds an inequality (>= 0) from the coefficients specified in `inEq`. + void addInequality(ArrayRef inEq); + void addInequality(ArrayRef inEq) { + addInequality(getMPIntVec(inEq)); + } + /// Adds an equality from the coefficients specified in `eq`. + void addEquality(ArrayRef eq); + void addEquality(ArrayRef eq) { addEquality(getMPIntVec(eq)); } + + /// Eliminate the `posB^th` local variable, replacing every instance of it + /// with the `posA^th` local variable. This should be used when the two + /// local variables are known to always take the same values. + virtual void eliminateRedundantLocalVar(unsigned posA, unsigned posB); + + /// Removes variables of the specified kind with the specified pos (or + /// within the specified range) from the system. The specified location is + /// relative to the first variable of the specified kind. + void removeVar(VarKind kind, unsigned pos); + virtual void removeVarRange(VarKind kind, unsigned varStart, + unsigned varLimit); + + /// Removes the specified variable from the system. + void removeVar(unsigned pos); + + void removeEquality(unsigned pos); + void removeInequality(unsigned pos); + + /// Remove the (in)equalities at positions [start, end). + void removeEqualityRange(unsigned start, unsigned end); + void removeInequalityRange(unsigned start, unsigned end); + + /// Get the lexicographically minimum rational point satisfying the + /// constraints. Returns an empty optional if the relation is empty or if + /// the lexmin is unbounded. Symbols are not supported and will result in + /// assert-failure. Note that Domain is minimized first, then range. + MaybeOptimum> findRationalLexMin() const; + + /// Same as above, but returns lexicographically minimal integer point. + /// Note: this should be used only when the lexmin is really required. + /// For a generic integer sampling operation, findIntegerSample is more + /// robust and should be preferred. Note that Domain is minimized first, then + /// range. + MaybeOptimum> findIntegerLexMin() const; + + /// Swap the posA^th variable with the posB^th variable. + virtual void swapVar(unsigned posA, unsigned posB); + + /// Removes all equalities and inequalities. + void clearConstraints(); + + /// Sets the `values.size()` variables starting at `po`s to the specified + /// values and removes them. + void setAndEliminate(unsigned pos, ArrayRef values); + void setAndEliminate(unsigned pos, ArrayRef values) { + setAndEliminate(pos, getMPIntVec(values)); + } + + /// Replaces the contents of this IntegerRelation with `other`. + virtual void clearAndCopyFrom(const IntegerRelation &other); + + /// Gather positions of all lower and upper bounds of the variable at `pos`, + /// and optionally any equalities on it. In addition, the bounds are to be + /// independent of variables in position range [`offset`, `offset` + `num`). + void + getLowerAndUpperBoundIndices(unsigned pos, + SmallVectorImpl *lbIndices, + SmallVectorImpl *ubIndices, + SmallVectorImpl *eqIndices = nullptr, + unsigned offset = 0, unsigned num = 0) const; + + /// Checks for emptiness by performing variable elimination on all + /// variables, running the GCD test on each equality constraint, and + /// checking for invalid constraints. Returns true if the GCD test fails for + /// any equality, or if any invalid constraints are discovered on any row. + /// Returns false otherwise. + bool isEmpty() const; + + /// Runs the GCD test on all equality constraints. Returns true if this test + /// fails on any equality. Returns false otherwise. + /// This test can be used to disprove the existence of a solution. If it + /// returns true, no integer solution to the equality constraints can exist. + bool isEmptyByGCDTest() const; + + /// Returns true if the set of constraints is found to have no solution, + /// false if a solution exists. Uses the same algorithm as + /// `findIntegerSample`. + bool isIntegerEmpty() const; + + /// Returns a matrix where each row is a vector along which the polytope is + /// bounded. The span of the returned vectors is guaranteed to contain all + /// such vectors. The returned vectors are NOT guaranteed to be linearly + /// independent. This function should not be called on empty sets. + IntMatrix getBoundedDirections() const; + + /// Find an integer sample point satisfying the constraints using a + /// branch and bound algorithm with generalized basis reduction, with some + /// additional processing using Simplex for unbounded sets. + /// + /// Returns an integer sample point if one exists, or an empty Optional + /// otherwise. The returned value also includes values of local ids. + std::optional> findIntegerSample() const; + + /// Compute an overapproximation of the number of integer points in the + /// relation. Symbol vars currently not supported. If the computed + /// overapproximation is infinite, an empty optional is returned. + std::optional computeVolume() const; + + /// Returns true if the given point satisfies the constraints, or false + /// otherwise. Takes the values of all vars including locals. + bool containsPoint(ArrayRef point) const; + bool containsPoint(ArrayRef point) const { + return containsPoint(getMPIntVec(point)); + } + /// Given the values of non-local vars, return a satisfying assignment to the + /// local if one exists, or an empty optional otherwise. + std::optional> + containsPointNoLocal(ArrayRef point) const; + std::optional> + containsPointNoLocal(ArrayRef point) const { + return containsPointNoLocal(getMPIntVec(point)); + } + + /// Returns a `DivisonRepr` representing the division representation of local + /// variables in the constraint system. + /// + /// If `repr` is not `nullptr`, the equality and pairs of inequality + /// constraints identified by their position indices using which an explicit + /// representation for each local variable can be computed are set in `repr` + /// in the form of a `MaybeLocalRepr` struct. If no such inequality + /// pair/equality can be found, the kind attribute in `MaybeLocalRepr` is set + /// to None. + DivisionRepr getLocalReprs(std::vector *repr = nullptr) const; + + /// Adds a constant bound for the specified variable. + void addBound(BoundType type, unsigned pos, const MPInt &value); + void addBound(BoundType type, unsigned pos, int64_t value) { + addBound(type, pos, MPInt(value)); + } + + /// Adds a constant bound for the specified expression. + void addBound(BoundType type, ArrayRef expr, const MPInt &value); + void addBound(BoundType type, ArrayRef expr, int64_t value) { + addBound(type, getMPIntVec(expr), MPInt(value)); + } + + /// Adds a new local variable as the floordiv of an affine function of other + /// variables, the coefficients of which are provided in `dividend` and with + /// respect to a positive constant `divisor`. Two constraints are added to the + /// system to capture equivalence with the floordiv: + /// q = dividend floordiv c <=> c*q <= dividend <= c*q + c - 1. + void addLocalFloorDiv(ArrayRef dividend, const MPInt &divisor); + void addLocalFloorDiv(ArrayRef dividend, int64_t divisor) { + addLocalFloorDiv(getMPIntVec(dividend), MPInt(divisor)); + } + + /// Projects out (aka eliminates) `num` variables starting at position + /// `pos`. The resulting constraint system is the shadow along the dimensions + /// that still exist. This method may not always be integer exact. + // TODO: deal with integer exactness when necessary - can return a value to + // mark exactness for example. + void projectOut(unsigned pos, unsigned num); + inline void projectOut(unsigned pos) { return projectOut(pos, 1); } + + /// Tries to fold the specified variable to a constant using a trivial + /// equality detection; if successful, the constant is substituted for the + /// variable everywhere in the constraint system and then removed from the + /// system. + LogicalResult constantFoldVar(unsigned pos); + + /// This method calls `constantFoldVar` for the specified range of variables, + /// `num` variables starting at position `pos`. + void constantFoldVarRange(unsigned pos, unsigned num); + + /// Updates the constraints to be the smallest bounding (enclosing) box that + /// contains the points of `this` set and that of `other`, with the symbols + /// being treated specially. For each of the dimensions, the min of the lower + /// bounds (symbolic) and the max of the upper bounds (symbolic) is computed + /// to determine such a bounding box. `other` is expected to have the same + /// dimensional variables as this constraint system (in the same order). + /// + /// E.g.: + /// 1) this = {0 <= d0 <= 127}, + /// other = {16 <= d0 <= 192}, + /// output = {0 <= d0 <= 192} + /// 2) this = {s0 + 5 <= d0 <= s0 + 20}, + /// other = {s0 + 1 <= d0 <= s0 + 9}, + /// output = {s0 + 1 <= d0 <= s0 + 20} + /// 3) this = {0 <= d0 <= 5, 1 <= d1 <= 9} + /// other = {2 <= d0 <= 6, 5 <= d1 <= 15}, + /// output = {0 <= d0 <= 6, 1 <= d1 <= 15} + LogicalResult unionBoundingBox(const IntegerRelation &other); + + /// Returns the smallest known constant bound for the extent of the specified + /// variable (pos^th), i.e., the smallest known constant that is greater + /// than or equal to 'exclusive upper bound' - 'lower bound' of the + /// variable. This constant bound is guaranteed to be non-negative. Returns + /// std::nullopt if it's not a constant. This method employs trivial (low + /// complexity / cost) checks and detection. Symbolic variables are treated + /// specially, i.e., it looks for constant differences between affine + /// expressions involving only the symbolic variables. `lb` and `ub` (along + /// with the `boundFloorDivisor`) are set to represent the lower and upper + /// bound associated with the constant difference: `lb`, `ub` have the + /// coefficients, and `boundFloorDivisor`, their divisor. `minLbPos` and + /// `minUbPos` if non-null are set to the position of the constant lower bound + /// and upper bound respectively (to the same if they are from an + /// equality). Ex: if the lower bound is [(s0 + s2 - 1) floordiv 32] for a + /// system with three symbolic variables, *lb = [1, 0, 1], lbDivisor = 32. See + /// comments at function definition for examples. + std::optional getConstantBoundOnDimSize( + unsigned pos, SmallVectorImpl *lb = nullptr, + MPInt *boundFloorDivisor = nullptr, SmallVectorImpl *ub = nullptr, + unsigned *minLbPos = nullptr, unsigned *minUbPos = nullptr) const; + /// The same, but casts to int64_t. This is unsafe and will assert-fail if the + /// value does not fit in an int64_t. + std::optional getConstantBoundOnDimSize64( + unsigned pos, SmallVectorImpl *lb = nullptr, + int64_t *boundFloorDivisor = nullptr, + SmallVectorImpl *ub = nullptr, unsigned *minLbPos = nullptr, + unsigned *minUbPos = nullptr) const { + SmallVector ubMPInt, lbMPInt; + MPInt boundFloorDivisorMPInt; + std::optional result = getConstantBoundOnDimSize( + pos, &lbMPInt, &boundFloorDivisorMPInt, &ubMPInt, minLbPos, minUbPos); + if (lb) + *lb = getInt64Vec(lbMPInt); + if (ub) + *ub = getInt64Vec(ubMPInt); + if (boundFloorDivisor) + *boundFloorDivisor = static_cast(boundFloorDivisorMPInt); + return llvm::transformOptional(result, int64FromMPInt); + } + + /// Returns the constant bound for the pos^th variable if there is one; + /// std::nullopt otherwise. + std::optional getConstantBound(BoundType type, unsigned pos) const; + /// The same, but casts to int64_t. This is unsafe and will assert-fail if the + /// value does not fit in an int64_t. + std::optional getConstantBound64(BoundType type, + unsigned pos) const { + return llvm::transformOptional(getConstantBound(type, pos), int64FromMPInt); + } + + /// Removes constraints that are independent of (i.e., do not have a + /// coefficient) variables in the range [pos, pos + num). + void removeIndependentConstraints(unsigned pos, unsigned num); + + /// Returns true if the set can be trivially detected as being + /// hyper-rectangular on the specified contiguous set of variables. + bool isHyperRectangular(unsigned pos, unsigned num) const; + + /// Removes duplicate constraints, trivially true constraints, and constraints + /// that can be detected as redundant as a result of differing only in their + /// constant term part. A constraint of the form >= 0 + /// is considered trivially true. This method is a linear time method on the + /// constraints, does a single scan, and updates in place. It also normalizes + /// constraints by their GCD and performs GCD tightening on inequalities. + void removeTrivialRedundancy(); + + /// A more expensive check than `removeTrivialRedundancy` to detect redundant + /// inequalities. + void removeRedundantInequalities(); + + /// Removes redundant constraints using Simplex. Although the algorithm can + /// theoretically take exponential time in the worst case (rare), it is known + /// to perform much better in the average case. If V is the number of vertices + /// in the polytope and C is the number of constraints, the algorithm takes + /// O(VC) time. + void removeRedundantConstraints(); + + void removeDuplicateDivs(); + + /// Converts variables of kind srcKind in the range [varStart, varLimit) to + /// variables of kind dstKind. If `pos` is given, the variables are placed at + /// position `pos` of dstKind, otherwise they are placed after all the other + /// variables of kind dstKind. The internal ordering among the moved variables + /// is preserved. + void convertVarKind(VarKind srcKind, unsigned varStart, unsigned varLimit, + VarKind dstKind, unsigned pos); + void convertVarKind(VarKind srcKind, unsigned varStart, unsigned varLimit, + VarKind dstKind) { + convertVarKind(srcKind, varStart, varLimit, dstKind, + getNumVarKind(dstKind)); + } + void convertToLocal(VarKind kind, unsigned varStart, unsigned varLimit) { + convertVarKind(kind, varStart, varLimit, VarKind::Local); + } + + /// Adds additional local vars to the sets such that they both have the union + /// of the local vars in each set, without changing the set of points that + /// lie in `this` and `other`. + /// + /// While taking union, if a local var in `other` has a division + /// representation which is a duplicate of division representation, of another + /// local var, it is not added to the final union of local vars and is instead + /// merged. The new ordering of local vars is: + /// + /// [Local vars of `this`] [Non-merged local vars of `other`] + /// + /// The relative ordering of local vars is same as before. + /// + /// After merging, if the `i^th` local variable in one set has a known + /// division representation, then the `i^th` local variable in the other set + /// either has the same division representation or no known division + /// representation. + /// + /// The spaces of both relations should be compatible. + /// + /// Returns the number of non-merged local vars of `other`, i.e. the number of + /// locals that have been added to `this`. + unsigned mergeLocalVars(IntegerRelation &other); + + /// Check whether all local ids have a division representation. + bool hasOnlyDivLocals() const; + + /// Changes the partition between dimensions and symbols. Depending on the new + /// symbol count, either a chunk of dimensional variables immediately before + /// the split become symbols, or some of the symbols immediately after the + /// split become dimensions. + void setDimSymbolSeparation(unsigned newSymbolCount) { + space.setVarSymbolSeperation(newSymbolCount); + } + + /// Return a set corresponding to all points in the domain of the relation. + IntegerPolyhedron getDomainSet() const; + + /// Return a set corresponding to all points in the range of the relation. + IntegerPolyhedron getRangeSet() const; + + /// Intersect the given `poly` with the domain in-place. + /// + /// Formally, let the relation `this` be R: A -> B and poly is C, then this + /// operation modifies R to be (A intersection C) -> B. + void intersectDomain(const IntegerPolyhedron &poly); + + /// Intersect the given `poly` with the range in-place. + /// + /// Formally, let the relation `this` be R: A -> B and poly is C, then this + /// operation modifies R to be A -> (B intersection C). + void intersectRange(const IntegerPolyhedron &poly); + + /// Invert the relation i.e., swap its domain and range. + /// + /// Formally, let the relation `this` be R: A -> B, then this operation + /// modifies R to be B -> A. + void inverse(); + + /// Let the relation `this` be R1, and the relation `rel` be R2. Modifies R1 + /// to be the composition of R1 and R2: R1;R2. + /// + /// Formally, if R1: A -> B, and R2: B -> C, then this function returns a + /// relation R3: A -> C such that a point (a, c) belongs to R3 iff there + /// exists b such that (a, b) is in R1 and, (b, c) is in R2. + void compose(const IntegerRelation &rel); + + /// Given a relation `rel`, apply the relation to the domain of this relation. + /// + /// R1: i -> j : (0 <= i < 2, j = i) + /// R2: i -> k : (k = i floordiv 2) + /// R3: k -> j : (0 <= k < 1, 2k <= j <= 2k + 1) + /// + /// R1 = {(0, 0), (1, 1)}. R2 maps both 0 and 1 to 0. + /// So R3 = {(0, 0), (0, 1)}. + /// + /// Formally, R1.applyDomain(R2) = R2.inverse().compose(R1). + void applyDomain(const IntegerRelation &rel); + + /// Given a relation `rel`, apply the relation to the range of this relation. + /// + /// Formally, R1.applyRange(R2) is the same as R1.compose(R2) but we provide + /// this for uniformity with `applyDomain`. + void applyRange(const IntegerRelation &rel); + + /// Compute an equivalent representation of the same set, such that all local + /// vars in all disjuncts have division representations. This representation + /// may involve local vars that correspond to divisions, and may also be a + /// union of convex disjuncts. + PresburgerRelation computeReprWithOnlyDivLocals() const; + + /// Compute the symbolic integer lexmin of the relation. + /// + /// This finds, for every assignment to the symbols and domain, + /// the lexicographically minimum value attained by the range. + /// + /// For example, the symbolic lexmin of the set + /// + /// (x, y)[a, b, c] : (a <= x, b <= x, x <= c) + /// + /// can be written as + /// + /// x = a if b <= a, a <= c + /// x = b if a < b, b <= c + /// + /// This function is stored in the `lexopt` function in the result. + /// Some assignments to the symbols might make the set empty. + /// Such points are not part of the function's domain. + /// In the above example, this happens when max(a, b) > c. + /// + /// For some values of the symbols, the lexmin may be unbounded. + /// `SymbolicLexOpt` stores these parts of the symbolic domain in a separate + /// `PresburgerSet`, `unboundedDomain`. + SymbolicLexOpt findSymbolicIntegerLexMin() const; + + /// Same as findSymbolicIntegerLexMin but produces lexmax instead of lexmin + SymbolicLexOpt findSymbolicIntegerLexMax() const; + + /// Return the set difference of this set and the given set, i.e., + /// return `this \ set`. + PresburgerRelation subtract(const PresburgerRelation &set) const; + + void print(raw_ostream &os) const; + void dump() const; + +protected: + /// Checks all rows of equality/inequality constraints for trivial + /// contradictions (for example: 1 == 0, 0 >= 1), which may have surfaced + /// after elimination. Returns true if an invalid constraint is found; + /// false otherwise. + bool hasInvalidConstraint() const; + + /// Returns the constant lower bound if isLower is true, and the upper + /// bound if isLower is false. + template + std::optional computeConstantLowerOrUpperBound(unsigned pos); + /// The same, but casts to int64_t. This is unsafe and will assert-fail if the + /// value does not fit in an int64_t. + template + std::optional computeConstantLowerOrUpperBound64(unsigned pos) { + return computeConstantLowerOrUpperBound(pos).map(int64FromMPInt); + } + + /// Eliminates a single variable at `position` from equality and inequality + /// constraints. Returns `success` if the variable was eliminated, and + /// `failure` otherwise. + inline LogicalResult gaussianEliminateVar(unsigned position) { + return success(gaussianEliminateVars(position, position + 1) == 1); + } + + /// Removes local variables using equalities. Each equality is checked if it + /// can be reduced to the form: `e = affine-expr`, where `e` is a local + /// variable and `affine-expr` is an affine expression not containing `e`. + /// If an equality satisfies this form, the local variable is replaced in + /// each constraint and then removed. The equality used to replace this local + /// variable is also removed. + void removeRedundantLocalVars(); + + /// Eliminates variables from equality and inequality constraints + /// in column range [posStart, posLimit). + /// Returns the number of variables eliminated. + unsigned gaussianEliminateVars(unsigned posStart, unsigned posLimit); + + /// Eliminates the variable at the specified position using Fourier-Motzkin + /// variable elimination, but uses Gaussian elimination if there is an + /// equality involving that variable. If the result of the elimination is + /// integer exact, `*isResultIntegerExact` is set to true. If `darkShadow` is + /// set to true, a potential under approximation (subset) of the rational + /// shadow / exact integer shadow is computed. + // See implementation comments for more details. + virtual void fourierMotzkinEliminate(unsigned pos, bool darkShadow = false, + bool *isResultIntegerExact = nullptr); + + /// Tightens inequalities given that we are dealing with integer spaces. This + /// is similar to the GCD test but applied to inequalities. The constant term + /// can be reduced to the preceding multiple of the GCD of the coefficients, + /// i.e., + /// 64*i - 100 >= 0 => 64*i - 128 >= 0 (since 'i' is an integer). This is a + /// fast method (linear in the number of coefficients). + void gcdTightenInequalities(); + + /// Normalized each constraints by the GCD of its coefficients. + void normalizeConstraintsByGCD(); + + /// Searches for a constraint with a non-zero coefficient at `colIdx` in + /// equality (isEq=true) or inequality (isEq=false) constraints. + /// Returns true and sets row found in search in `rowIdx`, false otherwise. + bool findConstraintWithNonZeroAt(unsigned colIdx, bool isEq, + unsigned *rowIdx) const; + + /// Returns true if the pos^th column is all zero for both inequalities and + /// equalities. + bool isColZero(unsigned pos) const; + + /// Returns false if the fields corresponding to various variable counts, or + /// equality/inequality buffer sizes aren't consistent; true otherwise. This + /// is meant to be used within an assert internally. + virtual bool hasConsistentState() const; + + /// Prints the number of constraints, dimensions, symbols and locals in the + /// IntegerRelation. + virtual void printSpace(raw_ostream &os) const; + + /// Removes variables in the column range [varStart, varLimit), and copies any + /// remaining valid data into place, updates member variables, and resizes + /// arrays as needed. + void removeVarRange(unsigned varStart, unsigned varLimit); + + /// Truncate the vars of the specified kind to the specified number by + /// dropping some vars at the end. `num` must be less than the current number. + void truncateVarKind(VarKind kind, unsigned num); + + /// Truncate the vars to the number in the space of the specified + /// CountsSnapshot. + void truncateVarKind(VarKind kind, const CountsSnapshot &counts); + + /// A parameter that controls detection of an unrealistic number of + /// constraints. If the number of constraints is this many times the number of + /// variables, we consider such a system out of line with the intended use + /// case of IntegerRelation. + // The rationale for 32 is that in the typical simplest of cases, an + // variable is expected to have one lower bound and one upper bound + // constraint. With a level of tiling or a connection to another variable + // through a div or mod, an extra pair of bounds gets added. As a limit, we + // don't expect a variable to have more than 32 lower/upper/equality + // constraints. This is conservatively set low and can be raised if needed. + constexpr static unsigned kExplosionFactor = 32; + + PresburgerSpace space; + + /// Coefficients of affine equalities (in == 0 form). + IntMatrix equalities; + + /// Coefficients of affine inequalities (in >= 0 form). + IntMatrix inequalities; +}; + +/// An IntegerPolyhedron represents the set of points from a PresburgerSpace +/// that satisfy a list of affine constraints. Affine constraints can be +/// inequalities or equalities in the form: +/// +/// Inequality: c_0*x_0 + c_1*x_1 + .... + c_{n-1}*x_{n-1} + c_n >= 0 +/// Equality : c_0*x_0 + c_1*x_1 + .... + c_{n-1}*x_{n-1} + c_n == 0 +/// +/// where c_0, c_1, ..., c_n are integers and n is the total number of +/// variables in the space. +/// +/// An IntegerPolyhedron is similar to an IntegerRelation but it does not make a +/// distinction between Domain and Range variables. Internally, +/// IntegerPolyhedron is implemented as a IntegerRelation with zero domain vars. +/// +/// Since IntegerPolyhedron does not make a distinction between kinds of +/// dimensions, VarKind::SetDim should be used to refer to dimension +/// variables. +class IntegerPolyhedron : public IntegerRelation { +public: + /// Constructs a set reserving memory for the specified number + /// of constraints and variables. + IntegerPolyhedron(unsigned numReservedInequalities, + unsigned numReservedEqualities, unsigned numReservedCols, + const PresburgerSpace &space) + : IntegerRelation(numReservedInequalities, numReservedEqualities, + numReservedCols, space) { + assert(space.getNumDomainVars() == 0 && + "Number of domain vars should be zero in Set kind space."); + } + + /// Constructs a relation with the specified number of dimensions and + /// symbols. + explicit IntegerPolyhedron(const PresburgerSpace &space) + : IntegerPolyhedron(/*numReservedInequalities=*/0, + /*numReservedEqualities=*/0, + /*numReservedCols=*/space.getNumVars() + 1, space) {} + + /// Construct a set from an IntegerRelation. The relation should have + /// no domain vars. + explicit IntegerPolyhedron(const IntegerRelation &rel) + : IntegerRelation(rel) { + assert(space.getNumDomainVars() == 0 && + "Number of domain vars should be zero in Set kind space."); + } + + /// Construct a set from an IntegerRelation, but instead of creating a copy, + /// use move constructor. The relation should have no domain vars. + explicit IntegerPolyhedron(IntegerRelation &&rel) : IntegerRelation(rel) { + assert(space.getNumDomainVars() == 0 && + "Number of domain vars should be zero in Set kind space."); + } + + /// Return a system with no constraints, i.e., one which is satisfied by all + /// points. + static IntegerPolyhedron getUniverse(const PresburgerSpace &space) { + return IntegerPolyhedron(space); + } + + /// Return the kind of this IntegerRelation. + Kind getKind() const override { return Kind::IntegerPolyhedron; } + + static bool classof(const IntegerRelation *cst) { + return cst->getKind() >= Kind::IntegerPolyhedron && + cst->getKind() <= Kind::FlatAffineRelation; + } + + // Clones this object. + std::unique_ptr clone() const; + + /// Insert `num` variables of the specified kind at position `pos`. + /// Positions are relative to the kind of variable. Return the absolute + /// column position (i.e., not relative to the kind of variable) of the + /// first added variable. + unsigned insertVar(VarKind kind, unsigned pos, unsigned num = 1) override; + + /// Return the intersection of the two relations. + /// If there are locals, they will be merged. + IntegerPolyhedron intersect(const IntegerPolyhedron &other) const; + + /// Return the set difference of this set and the given set, i.e., + /// return `this \ set`. + PresburgerSet subtract(const PresburgerSet &other) const; +}; + +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_INTEGERRELATION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/LinearTransform.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/LinearTransform.h new file mode 100644 index 0000000000000000000000000000000000000000..67dc9e87facb9ad0dfbee929c186099597d12c70 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/LinearTransform.h @@ -0,0 +1,64 @@ +//===- LinearTransform.h - MLIR LinearTransform Class -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Support for linear transforms and applying them to an IntegerRelation. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_LINEARTRANSFORM_H +#define MLIR_ANALYSIS_PRESBURGER_LINEARTRANSFORM_H + +#include "mlir/Analysis/Presburger/IntegerRelation.h" +#include "mlir/Analysis/Presburger/Matrix.h" +#include "llvm/ADT/SmallVector.h" + +namespace mlir { +namespace presburger { + +class LinearTransform { +public: + explicit LinearTransform(IntMatrix &&oMatrix); + explicit LinearTransform(const IntMatrix &oMatrix); + + // Returns a linear transform T such that MT is M in column echelon form. + // Also returns the number of non-zero columns in MT. + // + // Specifically, T is such that in every column the first non-zero row is + // strictly below that of the previous column, and all columns which have only + // zeros are at the end. + static std::pair + makeTransformToColumnEchelon(const IntMatrix &m); + + // Returns an IntegerRelation having a constraint vector vT for every + // constraint vector v in rel, where T is this transform. + IntegerRelation applyTo(const IntegerRelation &rel) const; + + // The given vector is interpreted as a row vector v. Post-multiply v with + // this transform, say T, and return vT. + SmallVector preMultiplyWithRow(ArrayRef rowVec) const { + return matrix.preMultiplyWithRow(rowVec); + } + + // The given vector is interpreted as a column vector v. Pre-multiply v with + // this transform, say T, and return Tv. + SmallVector postMultiplyWithColumn(ArrayRef colVec) const { + return matrix.postMultiplyWithColumn(colVec); + } + + // Compute the determinant of the transform by converting it to row echelon + // form and then taking the product of the diagonal. + MPInt determinant(); + +private: + IntMatrix matrix; +}; + +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_LINEARTRANSFORM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/MPInt.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/MPInt.h new file mode 100644 index 0000000000000000000000000000000000000000..12ab0598d10d999650d0f0d54dfcba94f10d51ab --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/MPInt.h @@ -0,0 +1,617 @@ +//===- MPInt.h - MLIR MPInt Class -------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This is a simple class to represent arbitrary precision signed integers. +// Unlike APInt, one does not have to specify a fixed maximum size, and the +// integer can take on any arbitrary values. This is optimized for small-values +// by providing fast-paths for the cases when the value stored fits in 64-bits. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_MPINT_H +#define MLIR_ANALYSIS_PRESBURGER_MPINT_H + +#include "mlir/Analysis/Presburger/SlowMPInt.h" +#include "mlir/Support/MathExtras.h" +#include "llvm/Support/raw_ostream.h" +#include + +namespace mlir { +namespace presburger { + +/// Redefine these functions, which operate on 64-bit ints, to also be part of +/// the mlir::presburger namespace. This is useful because this file defines +/// identically-named functions that operate on MPInts, which would otherwie +/// become the only candidates of overload resolution when calling e.g. ceilDiv +/// from the mlir::presburger namespace. So to access the 64-bit overloads, an +/// explict call to mlir::ceilDiv would be required. These using declarations +/// allow overload resolution to transparently call the right function. +using ::mlir::ceilDiv; +using ::mlir::floorDiv; +using ::mlir::mod; + +namespace detail { +/// If builtin intrinsics for overflow-checked arithmetic are available, +/// use them. Otherwise, call through to LLVM's overflow-checked arithmetic +/// functionality. Those functions also have such macro-gated uses of intrinsics +/// but they are not always_inlined, which is important for us to achieve +/// high-performance; calling the functions directly would result in a slowdown +/// of 1.15x. +LLVM_ATTRIBUTE_ALWAYS_INLINE bool addOverflow(int64_t x, int64_t y, + int64_t &result) { +#if __has_builtin(__builtin_add_overflow) + return __builtin_add_overflow(x, y, &result); +#else + return llvm::AddOverflow(x, y, result); +#endif +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool subOverflow(int64_t x, int64_t y, + int64_t &result) { +#if __has_builtin(__builtin_sub_overflow) + return __builtin_sub_overflow(x, y, &result); +#else + return llvm::SubOverflow(x, y, result); +#endif +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool mulOverflow(int64_t x, int64_t y, + int64_t &result) { +#if __has_builtin(__builtin_mul_overflow) + return __builtin_mul_overflow(x, y, &result); +#else + return llvm::MulOverflow(x, y, result); +#endif +} +} // namespace detail + +/// This class provides support for multi-precision arithmetic. +/// +/// Unlike APInt, this extends the precision as necessary to prevent overflows +/// and supports operations between objects with differing internal precisions. +/// +/// This is optimized for small-values by providing fast-paths for the cases +/// when the value stored fits in 64-bits. We annotate all fastpaths by using +/// the LLVM_LIKELY/LLVM_UNLIKELY annotations. Removing these would result in +/// a 1.2x performance slowdown. +/// +/// We always_inline all operations; removing these results in a 1.5x +/// performance slowdown. +/// +/// When holdsLarge is true, a SlowMPInt is held in the union. If it is false, +/// the int64_t is held. Using std::variant instead would lead to significantly +/// worse performance. +class MPInt { +private: + union { + int64_t valSmall; + detail::SlowMPInt valLarge; + }; + unsigned holdsLarge; + + LLVM_ATTRIBUTE_ALWAYS_INLINE void initSmall(int64_t o) { + if (LLVM_UNLIKELY(isLarge())) + valLarge.detail::SlowMPInt::~SlowMPInt(); + valSmall = o; + holdsLarge = false; + } + LLVM_ATTRIBUTE_ALWAYS_INLINE void initLarge(const detail::SlowMPInt &o) { + if (LLVM_LIKELY(isSmall())) { + // The data in memory could be in an arbitrary state, not necessarily + // corresponding to any valid state of valLarge; we cannot call any member + // functions, e.g. the assignment operator on it, as they may access the + // invalid internal state. We instead construct a new object using + // placement new. + new (&valLarge) detail::SlowMPInt(o); + } else { + // In this case, we need to use the assignment operator, because if we use + // placement-new as above we would lose track of allocated memory + // and leak it. + valLarge = o; + } + holdsLarge = true; + } + + LLVM_ATTRIBUTE_ALWAYS_INLINE explicit MPInt(const detail::SlowMPInt &val) + : valLarge(val), holdsLarge(true) {} + LLVM_ATTRIBUTE_ALWAYS_INLINE bool isSmall() const { return !holdsLarge; } + LLVM_ATTRIBUTE_ALWAYS_INLINE bool isLarge() const { return holdsLarge; } + /// Get the stored value. For getSmall/Large, + /// the stored value should be small/large. + LLVM_ATTRIBUTE_ALWAYS_INLINE int64_t getSmall() const { + assert(isSmall() && + "getSmall should only be called when the value stored is small!"); + return valSmall; + } + LLVM_ATTRIBUTE_ALWAYS_INLINE int64_t &getSmall() { + assert(isSmall() && + "getSmall should only be called when the value stored is small!"); + return valSmall; + } + LLVM_ATTRIBUTE_ALWAYS_INLINE const detail::SlowMPInt &getLarge() const { + assert(isLarge() && + "getLarge should only be called when the value stored is large!"); + return valLarge; + } + LLVM_ATTRIBUTE_ALWAYS_INLINE detail::SlowMPInt &getLarge() { + assert(isLarge() && + "getLarge should only be called when the value stored is large!"); + return valLarge; + } + explicit operator detail::SlowMPInt() const { + if (isSmall()) + return detail::SlowMPInt(getSmall()); + return getLarge(); + } + +public: + LLVM_ATTRIBUTE_ALWAYS_INLINE explicit MPInt(int64_t val) + : valSmall(val), holdsLarge(false) {} + LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt() : MPInt(0) {} + LLVM_ATTRIBUTE_ALWAYS_INLINE ~MPInt() { + if (LLVM_UNLIKELY(isLarge())) + valLarge.detail::SlowMPInt::~SlowMPInt(); + } + LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt(const MPInt &o) + : valSmall(o.valSmall), holdsLarge(false) { + if (LLVM_UNLIKELY(o.isLarge())) + initLarge(o.valLarge); + } + LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &operator=(const MPInt &o) { + if (LLVM_LIKELY(o.isSmall())) { + initSmall(o.valSmall); + return *this; + } + initLarge(o.valLarge); + return *this; + } + LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &operator=(int x) { + initSmall(x); + return *this; + } + LLVM_ATTRIBUTE_ALWAYS_INLINE explicit operator int64_t() const { + if (isSmall()) + return getSmall(); + return static_cast(getLarge()); + } + + bool operator==(const MPInt &o) const; + bool operator!=(const MPInt &o) const; + bool operator>(const MPInt &o) const; + bool operator<(const MPInt &o) const; + bool operator<=(const MPInt &o) const; + bool operator>=(const MPInt &o) const; + MPInt operator+(const MPInt &o) const; + MPInt operator-(const MPInt &o) const; + MPInt operator*(const MPInt &o) const; + MPInt operator/(const MPInt &o) const; + MPInt operator%(const MPInt &o) const; + MPInt &operator+=(const MPInt &o); + MPInt &operator-=(const MPInt &o); + MPInt &operator*=(const MPInt &o); + MPInt &operator/=(const MPInt &o); + MPInt &operator%=(const MPInt &o); + MPInt operator-() const; + MPInt &operator++(); + MPInt &operator--(); + + // Divide by a number that is known to be positive. + // This is slightly more efficient because it saves an overflow check. + MPInt divByPositive(const MPInt &o) const; + MPInt &divByPositiveInPlace(const MPInt &o); + + friend MPInt abs(const MPInt &x); + friend MPInt gcdRange(ArrayRef range); + friend MPInt ceilDiv(const MPInt &lhs, const MPInt &rhs); + friend MPInt floorDiv(const MPInt &lhs, const MPInt &rhs); + // The operands must be non-negative for gcd. + friend MPInt gcd(const MPInt &a, const MPInt &b); + friend MPInt lcm(const MPInt &a, const MPInt &b); + friend MPInt mod(const MPInt &lhs, const MPInt &rhs); + + llvm::raw_ostream &print(llvm::raw_ostream &os) const; + void dump() const; + + /// --------------------------------------------------------------------------- + /// Convenience operator overloads for int64_t. + /// --------------------------------------------------------------------------- + friend MPInt &operator+=(MPInt &a, int64_t b); + friend MPInt &operator-=(MPInt &a, int64_t b); + friend MPInt &operator*=(MPInt &a, int64_t b); + friend MPInt &operator/=(MPInt &a, int64_t b); + friend MPInt &operator%=(MPInt &a, int64_t b); + + friend bool operator==(const MPInt &a, int64_t b); + friend bool operator!=(const MPInt &a, int64_t b); + friend bool operator>(const MPInt &a, int64_t b); + friend bool operator<(const MPInt &a, int64_t b); + friend bool operator<=(const MPInt &a, int64_t b); + friend bool operator>=(const MPInt &a, int64_t b); + friend MPInt operator+(const MPInt &a, int64_t b); + friend MPInt operator-(const MPInt &a, int64_t b); + friend MPInt operator*(const MPInt &a, int64_t b); + friend MPInt operator/(const MPInt &a, int64_t b); + friend MPInt operator%(const MPInt &a, int64_t b); + + friend bool operator==(int64_t a, const MPInt &b); + friend bool operator!=(int64_t a, const MPInt &b); + friend bool operator>(int64_t a, const MPInt &b); + friend bool operator<(int64_t a, const MPInt &b); + friend bool operator<=(int64_t a, const MPInt &b); + friend bool operator>=(int64_t a, const MPInt &b); + friend MPInt operator+(int64_t a, const MPInt &b); + friend MPInt operator-(int64_t a, const MPInt &b); + friend MPInt operator*(int64_t a, const MPInt &b); + friend MPInt operator/(int64_t a, const MPInt &b); + friend MPInt operator%(int64_t a, const MPInt &b); + + friend llvm::hash_code hash_value(const MPInt &x); // NOLINT +}; + +/// Redeclarations of friend declaration above to +/// make it discoverable by lookups. +llvm::hash_code hash_value(const MPInt &x); // NOLINT + +/// This just calls through to the operator int64_t, but it's useful when a +/// function pointer is required. (Although this is marked inline, it is still +/// possible to obtain and use a function pointer to this.) +static inline int64_t int64FromMPInt(const MPInt &x) { return int64_t(x); } +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt mpintFromInt64(int64_t x) { + return MPInt(x); +} + +llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const MPInt &x); + +// The RHS is always expected to be positive, and the result +/// is always non-negative. +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt mod(const MPInt &lhs, const MPInt &rhs); + +namespace detail { +// Division overflows only when trying to negate the minimal signed value. +LLVM_ATTRIBUTE_ALWAYS_INLINE bool divWouldOverflow(int64_t x, int64_t y) { + return x == std::numeric_limits::min() && y == -1; +} +} // namespace detail + +/// We define the operations here in the header to facilitate inlining. + +/// --------------------------------------------------------------------------- +/// Comparison operators. +/// --------------------------------------------------------------------------- +LLVM_ATTRIBUTE_ALWAYS_INLINE bool MPInt::operator==(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) + return getSmall() == o.getSmall(); + return detail::SlowMPInt(*this) == detail::SlowMPInt(o); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool MPInt::operator!=(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) + return getSmall() != o.getSmall(); + return detail::SlowMPInt(*this) != detail::SlowMPInt(o); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool MPInt::operator>(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) + return getSmall() > o.getSmall(); + return detail::SlowMPInt(*this) > detail::SlowMPInt(o); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool MPInt::operator<(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) + return getSmall() < o.getSmall(); + return detail::SlowMPInt(*this) < detail::SlowMPInt(o); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool MPInt::operator<=(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) + return getSmall() <= o.getSmall(); + return detail::SlowMPInt(*this) <= detail::SlowMPInt(o); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool MPInt::operator>=(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) + return getSmall() >= o.getSmall(); + return detail::SlowMPInt(*this) >= detail::SlowMPInt(o); +} + +/// --------------------------------------------------------------------------- +/// Arithmetic operators. +/// --------------------------------------------------------------------------- +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt MPInt::operator+(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) { + MPInt result; + bool overflow = + detail::addOverflow(getSmall(), o.getSmall(), result.getSmall()); + if (LLVM_LIKELY(!overflow)) + return result; + return MPInt(detail::SlowMPInt(*this) + detail::SlowMPInt(o)); + } + return MPInt(detail::SlowMPInt(*this) + detail::SlowMPInt(o)); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt MPInt::operator-(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) { + MPInt result; + bool overflow = + detail::subOverflow(getSmall(), o.getSmall(), result.getSmall()); + if (LLVM_LIKELY(!overflow)) + return result; + return MPInt(detail::SlowMPInt(*this) - detail::SlowMPInt(o)); + } + return MPInt(detail::SlowMPInt(*this) - detail::SlowMPInt(o)); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt MPInt::operator*(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) { + MPInt result; + bool overflow = + detail::mulOverflow(getSmall(), o.getSmall(), result.getSmall()); + if (LLVM_LIKELY(!overflow)) + return result; + return MPInt(detail::SlowMPInt(*this) * detail::SlowMPInt(o)); + } + return MPInt(detail::SlowMPInt(*this) * detail::SlowMPInt(o)); +} + +// Division overflows only occur when negating the minimal possible value. +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt MPInt::divByPositive(const MPInt &o) const { + assert(o > 0); + if (LLVM_LIKELY(isSmall() && o.isSmall())) + return MPInt(getSmall() / o.getSmall()); + return MPInt(detail::SlowMPInt(*this) / detail::SlowMPInt(o)); +} + +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt MPInt::operator/(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) { + // Division overflows only occur when negating the minimal possible value. + if (LLVM_UNLIKELY(detail::divWouldOverflow(getSmall(), o.getSmall()))) + return -*this; + return MPInt(getSmall() / o.getSmall()); + } + return MPInt(detail::SlowMPInt(*this) / detail::SlowMPInt(o)); +} + +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt abs(const MPInt &x) { + return MPInt(x >= 0 ? x : -x); +} +// Division overflows only occur when negating the minimal possible value. +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt ceilDiv(const MPInt &lhs, const MPInt &rhs) { + if (LLVM_LIKELY(lhs.isSmall() && rhs.isSmall())) { + if (LLVM_UNLIKELY(detail::divWouldOverflow(lhs.getSmall(), rhs.getSmall()))) + return -lhs; + return MPInt(ceilDiv(lhs.getSmall(), rhs.getSmall())); + } + return MPInt(ceilDiv(detail::SlowMPInt(lhs), detail::SlowMPInt(rhs))); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt floorDiv(const MPInt &lhs, + const MPInt &rhs) { + if (LLVM_LIKELY(lhs.isSmall() && rhs.isSmall())) { + if (LLVM_UNLIKELY(detail::divWouldOverflow(lhs.getSmall(), rhs.getSmall()))) + return -lhs; + return MPInt(floorDiv(lhs.getSmall(), rhs.getSmall())); + } + return MPInt(floorDiv(detail::SlowMPInt(lhs), detail::SlowMPInt(rhs))); +} +// The RHS is always expected to be positive, and the result +/// is always non-negative. +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt mod(const MPInt &lhs, const MPInt &rhs) { + if (LLVM_LIKELY(lhs.isSmall() && rhs.isSmall())) + return MPInt(mod(lhs.getSmall(), rhs.getSmall())); + return MPInt(mod(detail::SlowMPInt(lhs), detail::SlowMPInt(rhs))); +} + +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt gcd(const MPInt &a, const MPInt &b) { + assert(a >= 0 && b >= 0 && "operands must be non-negative!"); + if (LLVM_LIKELY(a.isSmall() && b.isSmall())) + return MPInt(std::gcd(a.getSmall(), b.getSmall())); + return MPInt(gcd(detail::SlowMPInt(a), detail::SlowMPInt(b))); +} + +/// Returns the least common multiple of 'a' and 'b'. +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt lcm(const MPInt &a, const MPInt &b) { + MPInt x = abs(a); + MPInt y = abs(b); + return (x * y) / gcd(x, y); +} + +/// This operation cannot overflow. +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt MPInt::operator%(const MPInt &o) const { + if (LLVM_LIKELY(isSmall() && o.isSmall())) + return MPInt(getSmall() % o.getSmall()); + return MPInt(detail::SlowMPInt(*this) % detail::SlowMPInt(o)); +} + +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt MPInt::operator-() const { + if (LLVM_LIKELY(isSmall())) { + if (LLVM_LIKELY(getSmall() != std::numeric_limits::min())) + return MPInt(-getSmall()); + return MPInt(-detail::SlowMPInt(*this)); + } + return MPInt(-detail::SlowMPInt(*this)); +} + +/// --------------------------------------------------------------------------- +/// Assignment operators, preincrement, predecrement. +/// --------------------------------------------------------------------------- +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &MPInt::operator+=(const MPInt &o) { + if (LLVM_LIKELY(isSmall() && o.isSmall())) { + int64_t result = getSmall(); + bool overflow = detail::addOverflow(getSmall(), o.getSmall(), result); + if (LLVM_LIKELY(!overflow)) { + getSmall() = result; + return *this; + } + // Note: this return is not strictly required but + // removing it leads to a performance regression. + return *this = MPInt(detail::SlowMPInt(*this) + detail::SlowMPInt(o)); + } + return *this = MPInt(detail::SlowMPInt(*this) + detail::SlowMPInt(o)); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &MPInt::operator-=(const MPInt &o) { + if (LLVM_LIKELY(isSmall() && o.isSmall())) { + int64_t result = getSmall(); + bool overflow = detail::subOverflow(getSmall(), o.getSmall(), result); + if (LLVM_LIKELY(!overflow)) { + getSmall() = result; + return *this; + } + // Note: this return is not strictly required but + // removing it leads to a performance regression. + return *this = MPInt(detail::SlowMPInt(*this) - detail::SlowMPInt(o)); + } + return *this = MPInt(detail::SlowMPInt(*this) - detail::SlowMPInt(o)); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &MPInt::operator*=(const MPInt &o) { + if (LLVM_LIKELY(isSmall() && o.isSmall())) { + int64_t result = getSmall(); + bool overflow = detail::mulOverflow(getSmall(), o.getSmall(), result); + if (LLVM_LIKELY(!overflow)) { + getSmall() = result; + return *this; + } + // Note: this return is not strictly required but + // removing it leads to a performance regression. + return *this = MPInt(detail::SlowMPInt(*this) * detail::SlowMPInt(o)); + } + return *this = MPInt(detail::SlowMPInt(*this) * detail::SlowMPInt(o)); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &MPInt::operator/=(const MPInt &o) { + if (LLVM_LIKELY(isSmall() && o.isSmall())) { + // Division overflows only occur when negating the minimal possible value. + if (LLVM_UNLIKELY(detail::divWouldOverflow(getSmall(), o.getSmall()))) + return *this = -*this; + getSmall() /= o.getSmall(); + return *this; + } + return *this = MPInt(detail::SlowMPInt(*this) / detail::SlowMPInt(o)); +} + +// Division overflows only occur when the divisor is -1. +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt & +MPInt::divByPositiveInPlace(const MPInt &o) { + assert(o > 0); + if (LLVM_LIKELY(isSmall() && o.isSmall())) { + getSmall() /= o.getSmall(); + return *this; + } + return *this = MPInt(detail::SlowMPInt(*this) / detail::SlowMPInt(o)); +} + +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &MPInt::operator%=(const MPInt &o) { + return *this = *this % o; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &MPInt::operator++() { return *this += 1; } +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &MPInt::operator--() { return *this -= 1; } + +/// ---------------------------------------------------------------------------- +/// Convenience operator overloads for int64_t. +/// ---------------------------------------------------------------------------- +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &operator+=(MPInt &a, int64_t b) { + return a = a + b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &operator-=(MPInt &a, int64_t b) { + return a = a - b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &operator*=(MPInt &a, int64_t b) { + return a = a * b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &operator/=(MPInt &a, int64_t b) { + return a = a / b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt &operator%=(MPInt &a, int64_t b) { + return a = a % b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator+(const MPInt &a, int64_t b) { + return a + MPInt(b); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator-(const MPInt &a, int64_t b) { + return a - MPInt(b); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator*(const MPInt &a, int64_t b) { + return a * MPInt(b); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator/(const MPInt &a, int64_t b) { + return a / MPInt(b); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator%(const MPInt &a, int64_t b) { + return a % MPInt(b); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator+(int64_t a, const MPInt &b) { + return MPInt(a) + b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator-(int64_t a, const MPInt &b) { + return MPInt(a) - b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator*(int64_t a, const MPInt &b) { + return MPInt(a) * b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator/(int64_t a, const MPInt &b) { + return MPInt(a) / b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt operator%(int64_t a, const MPInt &b) { + return MPInt(a) % b; +} + +/// We provide special implementations of the comparison operators rather than +/// calling through as above, as this would result in a 1.2x slowdown. +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator==(const MPInt &a, int64_t b) { + if (LLVM_LIKELY(a.isSmall())) + return a.getSmall() == b; + return a.getLarge() == b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator!=(const MPInt &a, int64_t b) { + if (LLVM_LIKELY(a.isSmall())) + return a.getSmall() != b; + return a.getLarge() != b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator>(const MPInt &a, int64_t b) { + if (LLVM_LIKELY(a.isSmall())) + return a.getSmall() > b; + return a.getLarge() > b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator<(const MPInt &a, int64_t b) { + if (LLVM_LIKELY(a.isSmall())) + return a.getSmall() < b; + return a.getLarge() < b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator<=(const MPInt &a, int64_t b) { + if (LLVM_LIKELY(a.isSmall())) + return a.getSmall() <= b; + return a.getLarge() <= b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator>=(const MPInt &a, int64_t b) { + if (LLVM_LIKELY(a.isSmall())) + return a.getSmall() >= b; + return a.getLarge() >= b; +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator==(int64_t a, const MPInt &b) { + if (LLVM_LIKELY(b.isSmall())) + return a == b.getSmall(); + return a == b.getLarge(); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator!=(int64_t a, const MPInt &b) { + if (LLVM_LIKELY(b.isSmall())) + return a != b.getSmall(); + return a != b.getLarge(); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator>(int64_t a, const MPInt &b) { + if (LLVM_LIKELY(b.isSmall())) + return a > b.getSmall(); + return a > b.getLarge(); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator<(int64_t a, const MPInt &b) { + if (LLVM_LIKELY(b.isSmall())) + return a < b.getSmall(); + return a < b.getLarge(); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator<=(int64_t a, const MPInt &b) { + if (LLVM_LIKELY(b.isSmall())) + return a <= b.getSmall(); + return a <= b.getLarge(); +} +LLVM_ATTRIBUTE_ALWAYS_INLINE bool operator>=(int64_t a, const MPInt &b) { + if (LLVM_LIKELY(b.isSmall())) + return a >= b.getSmall(); + return a >= b.getLarge(); +} + +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_MPINT_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Matrix.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Matrix.h new file mode 100644 index 0000000000000000000000000000000000000000..bed3a5f75e396c556bef34739cf0be1e3760318f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Matrix.h @@ -0,0 +1,249 @@ +//===- Matrix.h - MLIR Matrix Class -----------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This is a simple 2D matrix class that supports reading, writing, resizing, +// swapping rows, and swapping columns. It can hold integers (MPInt) or rational +// numbers (Fraction). +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_MATRIX_H +#define MLIR_ANALYSIS_PRESBURGER_MATRIX_H + +#include "mlir/Support/LLVM.h" +#include "mlir/Analysis/Presburger/Fraction.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/raw_ostream.h" + +#include + +namespace mlir { +namespace presburger { + +/// This is a class to represent a resizable matrix. +/// +/// More columns and rows can be reserved than are currently used. The data is +/// stored as a single 1D array, viewed as a 2D matrix with nRows rows and +/// nReservedColumns columns, stored in row major form. Thus the element at +/// (i, j) is stored at data[i*nReservedColumns + j]. The reserved but unused +/// columns always have all zero values. The reserved rows are just reserved +/// space in the underlying SmallVector's capacity. +/// This class only works for the types MPInt and Fraction, since the method +/// implementations are in the Matrix.cpp file. Only these two types have +/// been explicitly instantiated there. +template +class Matrix { +static_assert(std::is_same_v || std::is_same_v, "T must be MPInt or Fraction."); +public: + Matrix() = delete; + + /// Construct a matrix with the specified number of rows and columns. + /// The number of reserved rows and columns will be at least the number + /// specified, and will always be sufficient to accomodate the number of rows + /// and columns specified. + /// + /// Initially, the entries are initialized to ero. + Matrix(unsigned rows, unsigned columns, unsigned reservedRows = 0, + unsigned reservedColumns = 0); + + /// Return the identity matrix of the specified dimension. + static Matrix identity(unsigned dimension); + + /// Access the element at the specified row and column. + T &at(unsigned row, unsigned column) { + assert(row < nRows && "Row outside of range"); + assert(column < nColumns && "Column outside of range"); + return data[row * nReservedColumns + column]; + } + + T at(unsigned row, unsigned column) const { + assert(row < nRows && "Row outside of range"); + assert(column < nColumns && "Column outside of range"); + return data[row * nReservedColumns + column]; + } + + T &operator()(unsigned row, unsigned column) { return at(row, column); } + + T operator()(unsigned row, unsigned column) const { + return at(row, column); + } + + /// Swap the given columns. + void swapColumns(unsigned column, unsigned otherColumn); + + /// Swap the given rows. + void swapRows(unsigned row, unsigned otherRow); + + unsigned getNumRows() const { return nRows; } + + unsigned getNumColumns() const { return nColumns; } + + /// Return the maximum number of rows/columns that can be added without + /// incurring a reallocation. + unsigned getNumReservedRows() const; + unsigned getNumReservedColumns() const { return nReservedColumns; } + + /// Reserve enough space to resize to the specified number of rows without + /// reallocations. + void reserveRows(unsigned rows); + + /// Get a [Mutable]ArrayRef corresponding to the specified row. + MutableArrayRef getRow(unsigned row); + ArrayRef getRow(unsigned row) const; + + /// Set the specified row to `elems`. + void setRow(unsigned row, ArrayRef elems); + + /// Insert columns having positions pos, pos + 1, ... pos + count - 1. + /// Columns that were at positions 0 to pos - 1 will stay where they are; + /// columns that were at positions pos to nColumns - 1 will be pushed to the + /// right. pos should be at most nColumns. + void insertColumns(unsigned pos, unsigned count); + void insertColumn(unsigned pos); + + /// Insert rows having positions pos, pos + 1, ... pos + count - 1. + /// Rows that were at positions 0 to pos - 1 will stay where they are; + /// rows that were at positions pos to nColumns - 1 will be pushed to the + /// right. pos should be at most nRows. + void insertRows(unsigned pos, unsigned count); + void insertRow(unsigned pos); + + /// Remove the columns having positions pos, pos + 1, ... pos + count - 1. + /// Rows that were at positions 0 to pos - 1 will stay where they are; + /// columns that were at positions pos + count - 1 or later will be pushed to + /// the right. The columns to be deleted must be valid rows: pos + count - 1 + /// must be at most nColumns - 1. + void removeColumns(unsigned pos, unsigned count); + void removeColumn(unsigned pos); + + /// Remove the rows having positions pos, pos + 1, ... pos + count - 1. + /// Rows that were at positions 0 to pos - 1 will stay where they are; + /// rows that were at positions pos + count - 1 or later will be pushed to the + /// right. The rows to be deleted must be valid rows: pos + count - 1 must be + /// at most nRows - 1. + void removeRows(unsigned pos, unsigned count); + void removeRow(unsigned pos); + + void copyRow(unsigned sourceRow, unsigned targetRow); + + void fillRow(unsigned row, const T &value); + void fillRow(unsigned row, int64_t value) { fillRow(row, T(value)); } + + /// Add `scale` multiples of the source row to the target row. + void addToRow(unsigned sourceRow, unsigned targetRow, const T &scale); + void addToRow(unsigned sourceRow, unsigned targetRow, int64_t scale) { + addToRow(sourceRow, targetRow, T(scale)); + } + /// Add `scale` multiples of the rowVec row to the specified row. + void addToRow(unsigned row, ArrayRef rowVec, const T &scale); + + /// Add `scale` multiples of the source column to the target column. + void addToColumn(unsigned sourceColumn, unsigned targetColumn, + const T &scale); + void addToColumn(unsigned sourceColumn, unsigned targetColumn, + int64_t scale) { + addToColumn(sourceColumn, targetColumn, T(scale)); + } + + /// Negate the specified column. + void negateColumn(unsigned column); + + /// Negate the specified row. + void negateRow(unsigned row); + + /// The given vector is interpreted as a row vector v. Post-multiply v with + /// this matrix, say M, and return vM. + SmallVector preMultiplyWithRow(ArrayRef rowVec) const; + + /// The given vector is interpreted as a column vector v. Pre-multiply v with + /// this matrix, say M, and return Mv. + SmallVector postMultiplyWithColumn(ArrayRef colVec) const; + + /// Resize the matrix to the specified dimensions. If a dimension is smaller, + /// the values are truncated; if it is bigger, the new values are initialized + /// to zero. + /// + /// Due to the representation of the matrix, resizing vertically (adding rows) + /// is less expensive than increasing the number of columns beyond + /// nReservedColumns. + void resize(unsigned newNRows, unsigned newNColumns); + void resizeHorizontally(unsigned newNColumns); + void resizeVertically(unsigned newNRows); + + /// Add an extra row at the bottom of the matrix and return its position. + unsigned appendExtraRow(); + /// Same as above, but copy the given elements into the row. The length of + /// `elems` must be equal to the number of columns. + unsigned appendExtraRow(ArrayRef elems); + + /// Print the matrix. + void print(raw_ostream &os) const; + void dump() const; + + /// Return whether the Matrix is in a consistent state with all its + /// invariants satisfied. + bool hasConsistentState() const; + +private: + /// The current number of rows, columns, and reserved columns. The underlying + /// data vector is viewed as an nRows x nReservedColumns matrix, of which the + /// first nColumns columns are currently in use, and the remaining are + /// reserved columns filled with zeros. + unsigned nRows, nColumns, nReservedColumns; + + /// Stores the data. data.size() is equal to nRows * nReservedColumns. + /// data.capacity() / nReservedColumns is the number of reserved rows. + SmallVector data; +}; + +// An inherited class for integer matrices, with no new data attributes. +// This is only used for the matrix-related methods which apply only +// to integers (hermite normal form computation and row normalisation). +class IntMatrix : public Matrix +{ +public: + IntMatrix(unsigned rows, unsigned columns, unsigned reservedRows = 0, + unsigned reservedColumns = 0) : + Matrix(rows, columns, reservedRows, reservedColumns) {}; + + IntMatrix(Matrix m) : + Matrix(m.getNumRows(), m.getNumColumns(), m.getNumReservedRows(), m.getNumReservedColumns()) + { + for (unsigned i = 0; i < m.getNumRows(); i++) + for (unsigned j = 0; j < m.getNumColumns(); j++) + at(i, j) = m(i, j); + }; + + /// Return the identity matrix of the specified dimension. + static IntMatrix identity(unsigned dimension); + + /// Given the current matrix M, returns the matrices H, U such that H is the + /// column hermite normal form of M, i.e. H = M * U, where U is unimodular and + /// the matrix H has the following restrictions: + /// - H is lower triangular. + /// - The leading coefficient (the first non-zero entry from the top, called + /// the pivot) of a non-zero column is always strictly below of the leading + /// coefficient of the column before it; moreover, it is positive. + /// - The elements to the right of the pivots are zero and the elements to + /// the left of the pivots are nonnegative and strictly smaller than the + /// pivot. + std::pair computeHermiteNormalForm() const; + + /// Divide the first `nCols` of the specified row by their GCD. + /// Returns the GCD of the first `nCols` of the specified row. + MPInt normalizeRow(unsigned row, unsigned nCols); + /// Divide the columns of the specified row by their GCD. + /// Returns the GCD of the columns of the specified row. + MPInt normalizeRow(unsigned row); + +}; + +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_MATRIX_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/PWMAFunction.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/PWMAFunction.h new file mode 100644 index 0000000000000000000000000000000000000000..236cc90ad66acd3a0b6939e849c37835d472e045 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/PWMAFunction.h @@ -0,0 +1,252 @@ +//===- PWMAFunction.h - MLIR PWMAFunction Class------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Support for piece-wise multi-affine functions. These are functions that are +// defined on a domain that is a union of IntegerPolyhedrons, and on each domain +// the value of the function is a tuple of integers, with each value in the +// tuple being an affine expression in the vars of the IntegerPolyhedron. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_PWMAFUNCTION_H +#define MLIR_ANALYSIS_PRESBURGER_PWMAFUNCTION_H + +#include "mlir/Analysis/Presburger/IntegerRelation.h" +#include "mlir/Analysis/Presburger/PresburgerRelation.h" +#include + +namespace mlir { +namespace presburger { + +/// Enum representing a binary comparison operator: equal, not equal, less than, +/// less than or equal, greater than, greater than or equal. +enum class OrderingKind { EQ, NE, LT, LE, GT, GE }; + +/// This class represents a multi-affine function with the domain as Z^d, where +/// `d` is the number of domain variables of the function. For example: +/// +/// (x, y) -> (x + 2, 2*x - 3y + 5, 2*x + y). +/// +/// The output expressions are represented as a matrix with one row for every +/// output, one column for each var including division variables, and an extra +/// column at the end for the constant term. +/// +/// Checking equality of two such functions is supported, as well as finding the +/// value of the function at a specified point. +class MultiAffineFunction { +public: + MultiAffineFunction(const PresburgerSpace &space, const IntMatrix &output) + : space(space), output(output), + divs(space.getNumVars() - space.getNumRangeVars()) { + assertIsConsistent(); + } + + MultiAffineFunction(const PresburgerSpace &space, const IntMatrix &output, + const DivisionRepr &divs) + : space(space), output(output), divs(divs) { + assertIsConsistent(); + } + + unsigned getNumDomainVars() const { return space.getNumDomainVars(); } + unsigned getNumSymbolVars() const { return space.getNumSymbolVars(); } + unsigned getNumOutputs() const { return space.getNumRangeVars(); } + unsigned getNumDivs() const { return space.getNumLocalVars(); } + + /// Get the space of this function. + const PresburgerSpace &getSpace() const { return space; } + /// Get the domain/output space of the function. The returned space is a set + /// space. + PresburgerSpace getDomainSpace() const { return space.getDomainSpace(); } + PresburgerSpace getOutputSpace() const { return space.getRangeSpace(); } + + /// Get a matrix with each row representing row^th output expression. + const IntMatrix &getOutputMatrix() const { return output; } + /// Get the `i^th` output expression. + ArrayRef getOutputExpr(unsigned i) const { return output.getRow(i); } + + /// Get the divisions used in this function. + const DivisionRepr &getDivs() const { return divs; } + + /// Remove the specified range of outputs. + void removeOutputs(unsigned start, unsigned end); + + /// Given a MAF `other`, merges division variables such that both functions + /// have the union of the division vars that exist in the functions. + void mergeDivs(MultiAffineFunction &other); + + //// Return the output of the function at the given point. + SmallVector valueAt(ArrayRef point) const; + SmallVector valueAt(ArrayRef point) const { + return valueAt(getMPIntVec(point)); + } + + /// Return whether the `this` and `other` are equal when the domain is + /// restricted to `domain`. This is the case if they lie in the same space, + /// and their outputs are equal for every point in `domain`. + bool isEqual(const MultiAffineFunction &other) const; + bool isEqual(const MultiAffineFunction &other, + const IntegerPolyhedron &domain) const; + bool isEqual(const MultiAffineFunction &other, + const PresburgerSet &domain) const; + + void subtract(const MultiAffineFunction &other); + + /// Return the set of domain points where the output of `this` and `other` + /// are ordered lexicographically according to the given ordering. + /// For example, if the given comparison is `LT`, then the returned set + /// contains all points where the first output of `this` is lexicographically + /// less than `other`. + PresburgerSet getLexSet(OrderingKind comp, + const MultiAffineFunction &other) const; + + /// Get this function as a relation. + IntegerRelation getAsRelation() const; + + void print(raw_ostream &os) const; + void dump() const; + +private: + /// Assert that the MAF is consistent. + void assertIsConsistent() const; + + /// The space of this function. The domain variables are considered as the + /// input variables of the function. The range variables are considered as + /// the outputs. The symbols parametrize the function and locals are used to + /// represent divisions. Each local variable has a corressponding division + /// representation stored in `divs`. + PresburgerSpace space; + + /// The function's output is a tuple of integers, with the ith element of the + /// tuple defined by the affine expression given by the ith row of this output + /// matrix. + IntMatrix output; + + /// Storage for division representation for each local variable in space. + DivisionRepr divs; +}; + +/// This class represents a piece-wise MultiAffineFunction. This can be thought +/// of as a list of MultiAffineFunction with disjoint domains, with each having +/// their own affine expressions for their output tuples. For example, we could +/// have a function with two input variables (x, y), defined as +/// +/// f(x, y) = (2*x + y, y - 4) if x >= 0, y >= 0 +/// = (-2*x + y, y + 4) if x < 0, y < 0 +/// = (4, 1) if x < 0, y >= 0 +/// +/// Note that the domains all have to be *disjoint*. Otherwise, the behaviour of +/// this class is undefined. The domains need not cover all possible points; +/// this represents a partial function and so could be undefined at some points. +/// +/// As in PresburgerSets, the input vars are partitioned into dimension vars and +/// symbolic vars. +/// +/// Support is provided to compare equality of two such functions as well as +/// finding the value of the function at a point. +class PWMAFunction { +public: + struct Piece { + PresburgerSet domain; + MultiAffineFunction output; + + bool isConsistent() const { + return domain.getSpace().isCompatible(output.getDomainSpace()); + } + }; + + PWMAFunction(const PresburgerSpace &space) : space(space) { + assert(space.getNumLocalVars() == 0 && + "PWMAFunction cannot have local vars."); + } + + // Get the space of this function. + const PresburgerSpace &getSpace() const { return space; } + + // Add a piece ([domain, output] pair) to this function. + void addPiece(const Piece &piece); + + unsigned getNumPieces() const { return pieces.size(); } + unsigned getNumVarKind(VarKind kind) const { + return space.getNumVarKind(kind); + } + unsigned getNumDomainVars() const { return space.getNumDomainVars(); } + unsigned getNumOutputs() const { return space.getNumRangeVars(); } + unsigned getNumSymbolVars() const { return space.getNumSymbolVars(); } + + /// Remove the specified range of outputs. + void removeOutputs(unsigned start, unsigned end); + + /// Get the domain/output space of the function. The returned space is a set + /// space. + PresburgerSpace getDomainSpace() const { return space.getDomainSpace(); } + PresburgerSpace getOutputSpace() const { return space.getDomainSpace(); } + + /// Return the domain of this piece-wise MultiAffineFunction. This is the + /// union of the domains of all the pieces. + PresburgerSet getDomain() const; + + /// Return the output of the function at the given point. + std::optional> valueAt(ArrayRef point) const; + std::optional> valueAt(ArrayRef point) const { + return valueAt(getMPIntVec(point)); + } + + /// Return all the pieces of this piece-wise function. + ArrayRef getAllPieces() const { return pieces; } + + /// Return whether `this` and `other` are equal as PWMAFunctions, i.e. whether + /// they have the same dimensions, the same domain and they take the same + /// value at every point in the domain. + bool isEqual(const PWMAFunction &other) const; + + /// Return a function defined on the union of the domains of this and func, + /// such that when only one of the functions is defined, it outputs the same + /// as that function, and if both are defined, it outputs the lexmax/lexmin of + /// the two outputs. On points where neither function is defined, the returned + /// function is not defined either. + /// + /// Currently this does not support PWMAFunctions which have pieces containing + /// divisions. + /// TODO: Support division in pieces. + PWMAFunction unionLexMin(const PWMAFunction &func); + PWMAFunction unionLexMax(const PWMAFunction &func); + + void print(raw_ostream &os) const; + void dump() const; + +private: + /// Return a function defined on the union of the domains of `this` and + /// `func`, such that when only one of the functions is defined, it outputs + /// the same as that function, and if neither is defined, the returned + /// function is not defined either. + /// + /// The provided `tiebreak` function determines which of the two functions' + /// output should be used on inputs where both the functions are defined. More + /// precisely, given two `MultiAffineFunction`s `mafA` and `mafB`, `tiebreak` + /// returns the subset of the intersection of the two functions' domains where + /// the output of `mafA` should be used. + /// + /// The PresburgerSet returned by `tiebreak` should be disjoint. + /// TODO: Remove this constraint of returning disjoint set. + PWMAFunction unionFunction( + const PWMAFunction &func, + llvm::function_ref tiebreak) const; + + /// The space of this function. The domain variables are considered as the + /// input variables of the function. The range variables are considered as + /// the outputs. The symbols paramterize the function. + PresburgerSpace space; + + // The pieces of the PWMAFunction. + SmallVector pieces; +}; + +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_PWMAFUNCTION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h new file mode 100644 index 0000000000000000000000000000000000000000..0c9c5cf67b4c3c1ad85e11dc7a61e00872d0bb75 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h @@ -0,0 +1,272 @@ +//===- PresburgerRelation.h - MLIR PresburgerRelation Class -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// A class to represent unions of IntegerRelations. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_PRESBURGERRELATION_H +#define MLIR_ANALYSIS_PRESBURGER_PRESBURGERRELATION_H + +#include "mlir/Analysis/Presburger/IntegerRelation.h" +#include + +namespace mlir { +namespace presburger { + +/// The SetCoalescer class contains all functionality concerning the coalesce +/// heuristic. It is built from a `PresburgerRelation` and has the `coalesce()` +/// function as its main API. +class SetCoalescer; + +/// A PresburgerRelation represents a union of IntegerRelations that live in +/// the same PresburgerSpace with support for union, intersection, subtraction, +/// and complement operations, as well as sampling. +/// +/// The IntegerRelations (disjuncts) are stored in a vector, and the set +/// represents the union of these relations. An empty list corresponds to +/// the empty set. +/// +/// Note that there are no invariants guaranteed on the list of disjuncts +/// other than that they are all in the same PresburgerSpace. For example, the +/// relations may overlap with each other. +class PresburgerRelation { +public: + /// Return a universe set of the specified type that contains all points. + static PresburgerRelation getUniverse(const PresburgerSpace &space); + + /// Return an empty set of the specified type that contains no points. + static PresburgerRelation getEmpty(const PresburgerSpace &space); + + explicit PresburgerRelation(const IntegerRelation &disjunct); + + unsigned getNumDomainVars() const { return space.getNumDomainVars(); } + unsigned getNumRangeVars() const { return space.getNumRangeVars(); } + unsigned getNumSymbolVars() const { return space.getNumSymbolVars(); } + unsigned getNumLocalVars() const { return space.getNumLocalVars(); } + unsigned getNumVars() const { return space.getNumVars(); } + + /// Return the number of disjuncts in the union. + unsigned getNumDisjuncts() const; + + const PresburgerSpace &getSpace() const { return space; } + + /// Set the space to `oSpace`. `oSpace` should not contain any local ids. + /// `oSpace` need not have the same number of ids as the current space; + /// it could have more or less. If it has less, the extra ids become + /// locals of the disjuncts. It can also have more, in which case the + /// disjuncts will have fewer locals. If its total number of ids + /// exceeds that of some disjunct, an assert failure will occur. + void setSpace(const PresburgerSpace &oSpace); + + void insertVarInPlace(VarKind kind, unsigned pos, unsigned num = 1); + + /// Converts variables of the specified kind in the column range [srcPos, + /// srcPos + num) to variables of the specified kind at position dstPos. The + /// ranges are relative to the kind of variable. + /// + /// srcKind and dstKind must be different. + void convertVarKind(VarKind srcKind, unsigned srcPos, unsigned num, + VarKind dstKind, unsigned dstPos); + + /// Return a reference to the list of disjuncts. + ArrayRef getAllDisjuncts() const; + + /// Return the disjunct at the specified index. + const IntegerRelation &getDisjunct(unsigned index) const; + + /// Mutate this set, turning it into the union of this set and the given + /// disjunct. + void unionInPlace(const IntegerRelation &disjunct); + + /// Mutate this set, turning it into the union of this set and the given set. + void unionInPlace(const PresburgerRelation &set); + + /// Return the union of this set and the given set. + PresburgerRelation unionSet(const PresburgerRelation &set) const; + + /// Return the intersection of this set and the given set. + PresburgerRelation intersect(const PresburgerRelation &set) const; + + /// Return the range intersection of the given `set` with `this` relation. + /// + /// Formally, let the relation `this` be R: A -> B and `set` is C, then this + /// operation returns A -> (B intersection C). + PresburgerRelation intersectRange(const PresburgerSet &set) const; + + /// Return the domain intersection of the given `set` with `this` relation. + /// + /// Formally, let the relation `this` be R: A -> B and `set` is C, then this + /// operation returns (A intersection C) -> B. + PresburgerRelation intersectDomain(const PresburgerSet &set) const; + + /// Return a set corresponding to the domain of the relation. + PresburgerSet getDomainSet() const; + /// Return a set corresponding to the range of the relation. + PresburgerSet getRangeSet() const; + + /// Invert the relation, i.e. swap its domain and range. + /// + /// Formally, if `this`: A -> B then `inverse` updates `this` in-place to + /// `this`: B -> A. + void inverse(); + + /// Compose `this` relation with the given relation `rel` in-place. + /// + /// Formally, if `this`: A -> B, and `rel`: B -> C, then this function updates + /// `this` to `result`: A -> C where a point (a, c) belongs to `result` + /// iff there exists b such that (a, b) is in `this` and, (b, c) is in rel. + void compose(const PresburgerRelation &rel); + + /// Apply the domain of given relation `rel` to `this` relation. + /// + /// Formally, R1.applyDomain(R2) = R2.inverse().compose(R1). + void applyDomain(const PresburgerRelation &rel); + + /// Same as compose, provided for uniformity with applyDomain. + void applyRange(const PresburgerRelation &rel); + + /// Compute the symbolic integer lexmin of the relation, i.e. for every + /// assignment of the symbols and domain the lexicographically minimum value + /// attained by the range. + SymbolicLexOpt findSymbolicIntegerLexMin() const; + + /// Compute the symbolic integer lexmax of the relation, i.e. for every + /// assignment of the symbols and domain the lexicographically maximum value + /// attained by the range. + SymbolicLexOpt findSymbolicIntegerLexMax() const; + + /// Return true if the set contains the given point, and false otherwise. + bool containsPoint(ArrayRef point) const; + bool containsPoint(ArrayRef point) const { + return containsPoint(getMPIntVec(point)); + } + + /// Return the complement of this set. All local variables in the set must + /// correspond to floor divisions. + PresburgerRelation complement() const; + + /// Return the set difference of this set and the given set, i.e., + /// return `this \ set`. All local variables in `set` must correspond + /// to floor divisions, but local variables in `this` need not correspond to + /// divisions. + PresburgerRelation subtract(const PresburgerRelation &set) const; + + /// Return true if this set is a subset of the given set, and false otherwise. + bool isSubsetOf(const PresburgerRelation &set) const; + + /// Return true if this set is equal to the given set, and false otherwise. + /// All local variables in both sets must correspond to floor divisions. + bool isEqual(const PresburgerRelation &set) const; + + /// Return true if all the sets in the union are known to be integer empty + /// false otherwise. + bool isIntegerEmpty() const; + + /// Return true if there is no disjunct, false otherwise. + bool isPlainEmpty() const; + + /// Return true if the set is known to have one unconstrained disjunct, false + /// otherwise. + bool isPlainUniverse() const; + + /// Perform a quick equality check on `this` and `other`. The relations are + /// equal if the check return true, but may or may not be equal if the check + /// returns false. This is doing by directly comparing whether each internal + /// disjunct is the same. + bool isPlainEqual(const PresburgerRelation &set) const; + + /// Return true if the set is consist of a single disjunct, without any local + /// variables, false otherwise. + bool isConvexNoLocals() const; + + /// Find an integer sample from the given set. This should not be called if + /// any of the disjuncts in the union are unbounded. + bool findIntegerSample(SmallVectorImpl &sample); + + /// Compute an overapproximation of the number of integer points in the + /// disjunct. Symbol vars are currently not supported. If the computed + /// overapproximation is infinite, an empty optional is returned. + /// + /// This currently just sums up the overapproximations of the volumes of the + /// disjuncts, so the approximation might be far from the true volume in the + /// case when there is a lot of overlap between disjuncts. + std::optional computeVolume() const; + + /// Simplifies the representation of a PresburgerRelation. + /// + /// In particular, removes all disjuncts which are subsets of other + /// disjuncts in the union. + PresburgerRelation coalesce() const; + + /// Check whether all local ids in all disjuncts have a div representation. + bool hasOnlyDivLocals() const; + + /// Compute an equivalent representation of the same relation, such that all + /// local ids in all disjuncts have division representations. This + /// representation may involve local ids that correspond to divisions, and may + /// also be a union of convex disjuncts. + PresburgerRelation computeReprWithOnlyDivLocals() const; + + /// Print the set's internal state. + void print(raw_ostream &os) const; + void dump() const; + +protected: + /// Construct an empty PresburgerRelation with the specified number of + /// dimension and symbols. + explicit PresburgerRelation(const PresburgerSpace &space) : space(space) { + assert(space.getNumLocalVars() == 0 && + "PresburgerRelation cannot have local vars."); + } + + PresburgerSpace space; + + /// The list of disjuncts that this set is the union of. + SmallVector disjuncts; + + friend class SetCoalescer; +}; + +class PresburgerSet : public PresburgerRelation { +public: + /// Return a universe set of the specified type that contains all points. + static PresburgerSet getUniverse(const PresburgerSpace &space); + + /// Return an empty set of the specified type that contains no points. + static PresburgerSet getEmpty(const PresburgerSpace &space); + + /// Create a set from a relation. + explicit PresburgerSet(const IntegerPolyhedron &disjunct); + explicit PresburgerSet(const PresburgerRelation &set); + + /// These operations are the same as the ones in PresburgeRelation, they just + /// forward the arguement and return the result as a set instead of a + /// relation. + PresburgerSet unionSet(const PresburgerRelation &set) const; + PresburgerSet intersect(const PresburgerRelation &set) const; + PresburgerSet complement() const; + PresburgerSet subtract(const PresburgerRelation &set) const; + PresburgerSet coalesce() const; + +protected: + /// Construct an empty PresburgerRelation with the specified number of + /// dimension and symbols. + explicit PresburgerSet(const PresburgerSpace &space) + : PresburgerRelation(space) { + assert(space.getNumDomainVars() == 0 && + "Set type cannot have domain vars."); + assert(space.getNumLocalVars() == 0 && + "PresburgerRelation cannot have local vars."); + } +}; + +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_PRESBURGERRELATION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h new file mode 100644 index 0000000000000000000000000000000000000000..9fe2abafd36badbe91da8950aee2899ddb70c759 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h @@ -0,0 +1,327 @@ +//===- PresburgerSpace.h - MLIR PresburgerSpace Class -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Classes representing space information like number of variables and kind of +// variables. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_PRESBURGERSPACE_H +#define MLIR_ANALYSIS_PRESBURGER_PRESBURGERSPACE_H + +#include "mlir/Support/TypeID.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/PointerLikeTypeTraits.h" +#include "llvm/Support/raw_ostream.h" + +namespace mlir { +namespace presburger { + +/// Kind of variable. Implementation wise SetDims are treated as Range +/// vars, and spaces with no distinction between dimension vars are treated +/// as relations with zero domain vars. +enum class VarKind { Symbol, Local, Domain, Range, SetDim = Range }; + +/// An Identifier stores a pointer to an object, such as a Value or an +/// Operation. Identifiers are intended to be attached to a variable in a +/// PresburgerSpace and can be used to check if two variables correspond to the +/// same object. +/// +/// Take for example the following code: +/// +/// for i = 0 to 100 +/// for j = 0 to 100 +/// S0: A[j] = 0 +/// for k = 0 to 100 +/// S1: A[k] = 1 +/// +/// If we represent the space of iteration variables surrounding S0, S1 we have: +/// space(S0): {d0, d1} +/// space(S1): {d0, d1} +/// +/// Since the variables are in different spaces, without an identifier, there +/// is no way to distinguish if the variables in the two spaces correspond to +/// different SSA values in the program. So, we attach an Identifier +/// corresponding to the loop iteration variable to them. Now, +/// +/// space(S0) = {d0(id = i), d1(id = j)} +/// space(S1) = {d0(id = i), d1(id = k)}. +/// +/// Using the identifier, we can check that the first iteration variable in +/// both the spaces correspond to the same variable in the program, while they +/// are different for second iteration variable. +/// +/// The equality of Identifiers is checked by comparing the stored pointers. +/// Checking equality asserts that the type of the equal identifiers is same. +/// Identifiers storing null pointers are treated as having no attachment and +/// are considered unequal to any other identifier, including other identifiers +/// with no attachments. +/// +/// The type of the pointer stored must have an `llvm::PointerLikeTypeTraits` +/// specialization. +class Identifier { +public: + Identifier() = default; + + // Create an identifier from a pointer. + template + explicit Identifier(T value) + : value(llvm::PointerLikeTypeTraits::getAsVoidPointer(value)) { +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS + idType = TypeID::get(); +#endif + } + + /// Get the value of the identifier casted to type `T`. `T` here should match + /// the type of the identifier used to create it. + template + T getValue() const { +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS + assert(TypeID::get() == idType && + "Identifier was initialized with a different type than the one used " + "to retrieve it."); +#endif + return llvm::PointerLikeTypeTraits::getFromVoidPointer(value); + } + + bool hasValue() const { return value != nullptr; } + + /// Check if the two identifiers are equal. Null identifiers are considered + /// not equal. Asserts if two identifiers are equal but their types are not. + bool isEqual(const Identifier &other) const; + + bool operator==(const Identifier &other) const { return isEqual(other); } + bool operator!=(const Identifier &other) const { return !isEqual(other); } + + void print(llvm::raw_ostream &os) const; + void dump() const; + +private: + /// The value of the identifier. + void *value = nullptr; + +#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS + /// TypeID of the identifiers in space. This should be used in asserts only. + TypeID idType = TypeID::get(); +#endif +}; + +/// PresburgerSpace is the space of all possible values of a tuple of integer +/// valued variables/variables. Each variable has one of the three types: +/// +/// Dimension: Ordinary variables over which the space is represented. +/// +/// Symbol: Symbol variables correspond to fixed but unknown values. +/// Mathematically, a space with symbolic variables is like a +/// family of spaces indexed by the symbolic variables. +/// +/// Local: Local variables correspond to existentially quantified variables. +/// For example, consider the space: `(x, exists q)` where x is a dimension +/// variable and q is a local variable. Let us put the constraints: +/// `1 <= x <= 7, x = 2q` +/// on this space to get the set: +/// `(x) : (exists q : q <= x <= 7, x = 2q)`. +/// An assignment to symbolic and dimension variables is valid if there +/// exists some assignment to the local variable `q` satisfying these +/// constraints. For this example, the set is equivalent to {2, 4, 6}. +/// Mathematically, existential quantification can be thought of as the result +/// of projection. In this example, `q` is existentially quantified. This can be +/// thought of as the result of projecting out `q` from the previous example, +/// i.e. we obtained {2, 4, 6} by projecting out the second dimension from +/// {(2, 1), (4, 2), (6, 2)}. +/// +/// Dimension variables are further divided into Domain and Range variables +/// to support building relations. +/// +/// Variables are stored in the following order: +/// [Domain, Range, Symbols, Locals] +/// +/// A space with no distinction between types of dimension variables can +/// be implemented as a space with zero domain. VarKind::SetDim should be used +/// to refer to dimensions in such spaces. +/// +/// Compatibility of two spaces implies that number of variables of each kind +/// other than Locals are equal. Equality of two spaces implies that number of +/// variables of each kind are equal. +/// +/// PresburgerSpace optionally also supports attaching an Identifier with each +/// non-local variable in the space. This is disabled by default. `resetIds` is +/// used to enable/reset these identifiers. The user can identify each variable +/// in the space as corresponding to some Identifier. Some example use cases +/// are described in the `Identifier` documentation above. The type attached to +/// the Identifier can be different for different variables in the space. +class PresburgerSpace { +public: + static PresburgerSpace getRelationSpace(unsigned numDomain = 0, + unsigned numRange = 0, + unsigned numSymbols = 0, + unsigned numLocals = 0) { + return PresburgerSpace(numDomain, numRange, numSymbols, numLocals); + } + + static PresburgerSpace getSetSpace(unsigned numDims = 0, + unsigned numSymbols = 0, + unsigned numLocals = 0) { + return PresburgerSpace(/*numDomain=*/0, /*numRange=*/numDims, numSymbols, + numLocals); + } + + /// Get the domain/range space of this space. The returned space is a set + /// space. + PresburgerSpace getDomainSpace() const; + PresburgerSpace getRangeSpace() const; + + /// Get the space without local variables. + PresburgerSpace getSpaceWithoutLocals() const; + + unsigned getNumDomainVars() const { return numDomain; } + unsigned getNumRangeVars() const { return numRange; } + unsigned getNumSetDimVars() const { return numRange; } + unsigned getNumSymbolVars() const { return numSymbols; } + unsigned getNumLocalVars() const { return numLocals; } + + unsigned getNumDimVars() const { return numDomain + numRange; } + unsigned getNumDimAndSymbolVars() const { + return numDomain + numRange + numSymbols; + } + unsigned getNumVars() const { + return numDomain + numRange + numSymbols + numLocals; + } + + /// Get the number of vars of the specified kind. + unsigned getNumVarKind(VarKind kind) const; + + /// Return the index at which the specified kind of var starts. + unsigned getVarKindOffset(VarKind kind) const; + + /// Return the index at Which the specified kind of var ends. + unsigned getVarKindEnd(VarKind kind) const; + + /// Get the number of elements of the specified kind in the range + /// [varStart, varLimit). + unsigned getVarKindOverlap(VarKind kind, unsigned varStart, + unsigned varLimit) const; + + /// Return the VarKind of the var at the specified position. + VarKind getVarKindAt(unsigned pos) const; + + /// Insert `num` variables of the specified kind at position `pos`. + /// Positions are relative to the kind of variable. Return the absolute + /// column position (i.e., not relative to the kind of variable) of the + /// first added variable. + /// + /// If identifiers are being used, the newly added variables have no + /// identifiers. + unsigned insertVar(VarKind kind, unsigned pos, unsigned num = 1); + + /// Removes variables of the specified kind in the column range [varStart, + /// varLimit). The range is relative to the kind of variable. + void removeVarRange(VarKind kind, unsigned varStart, unsigned varLimit); + + /// Converts variables of the specified kind in the column range [srcPos, + /// srcPos + num) to variables of the specified kind at position dstPos. The + /// ranges are relative to the kind of variable. + /// + /// srcKind and dstKind must be different. + void convertVarKind(VarKind srcKind, unsigned srcPos, unsigned num, + VarKind dstKind, unsigned dstPos); + + /// Changes the partition between dimensions and symbols. Depending on the new + /// symbol count, either a chunk of dimensional variables immediately before + /// the split become symbols, or some of the symbols immediately after the + /// split become dimensions. + void setVarSymbolSeperation(unsigned newSymbolCount); + + /// Swaps the posA^th variable of kindA and posB^th variable of kindB. + void swapVar(VarKind kindA, VarKind kindB, unsigned posA, unsigned posB); + + /// Returns true if both the spaces are compatible i.e. if both spaces have + /// the same number of variables of each kind (excluding locals). + bool isCompatible(const PresburgerSpace &other) const; + + /// Returns true if both the spaces are equal including local variables i.e. + /// if both spaces have the same number of variables of each kind (including + /// locals). + bool isEqual(const PresburgerSpace &other) const; + + /// Get the identifier of the specified variable. + Identifier &getId(VarKind kind, unsigned pos) { + assert(kind != VarKind::Local && "Local variables have no identifiers"); + return identifiers[getVarKindOffset(kind) + pos]; + } + Identifier getId(VarKind kind, unsigned pos) const { + assert(kind != VarKind::Local && "Local variables have no identifiers"); + return identifiers[getVarKindOffset(kind) + pos]; + } + + ArrayRef getIds(VarKind kind) const { + assert(kind != VarKind::Local && "Local variables have no identifiers"); + return {identifiers.data() + getVarKindOffset(kind), getNumVarKind(kind)}; + } + + /// Returns if identifiers are being used. + bool isUsingIds() const { return usingIds; } + + /// Reset the stored identifiers in the space. Enables `usingIds` if it was + /// `false` before. + void resetIds() { + identifiers.clear(); + identifiers.resize(getNumDimAndSymbolVars()); + usingIds = true; + } + + /// Disable identifiers being stored in space. + void disableIds() { + identifiers.clear(); + usingIds = false; + } + + /// Check if the spaces are compatible, and the non-local variables having + /// same identifiers are in the same positions. If the space is not using + /// Identifiers, this check is same as isCompatible. + bool isAligned(const PresburgerSpace &other) const; + /// Same as above but only check the specified VarKind. Useful to check if + /// the symbols in two spaces are aligned. + bool isAligned(const PresburgerSpace &other, VarKind kind) const; + + void print(llvm::raw_ostream &os) const; + void dump() const; + +protected: + PresburgerSpace(unsigned numDomain, unsigned numRange, unsigned numSymbols, + unsigned numLocals) + : numDomain(numDomain), numRange(numRange), numSymbols(numSymbols), + numLocals(numLocals) {} + +private: + // Number of variables corresponding to domain variables. + unsigned numDomain; + + // Number of variables corresponding to range variables. + unsigned numRange; + + /// Number of variables corresponding to symbols (unknown but constant for + /// analysis). + unsigned numSymbols; + + /// Number of variables corresponding to locals (variables corresponding + /// to existentially quantified variables). + unsigned numLocals; + + /// Stores whether or not identifiers are being used in this space. + bool usingIds = false; + + /// Stores an identifier for each non-local variable as a `void` pointer. + SmallVector identifiers; +}; + +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_PRESBURGERSPACE_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Simplex.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Simplex.h new file mode 100644 index 0000000000000000000000000000000000000000..9482f69b31cd66687c0999ae172b7c772bf45a35 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Simplex.h @@ -0,0 +1,887 @@ +//===- Simplex.h - MLIR Simplex Class ---------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Functionality to perform analysis on an IntegerRelation. In particular, +// support for performing emptiness checks, redundancy checks and obtaining the +// lexicographically minimum rational element in a set. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_SIMPLEX_H +#define MLIR_ANALYSIS_PRESBURGER_SIMPLEX_H + +#include "mlir/Analysis/Presburger/Fraction.h" +#include "mlir/Analysis/Presburger/IntegerRelation.h" +#include "mlir/Analysis/Presburger/Matrix.h" +#include "mlir/Analysis/Presburger/PWMAFunction.h" +#include "mlir/Analysis/Presburger/Utils.h" +#include "mlir/Support/LogicalResult.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/SmallBitVector.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/Support/StringSaver.h" +#include "llvm/Support/raw_ostream.h" +#include + +namespace mlir { +namespace presburger { + +class GBRSimplex; + +/// The Simplex class implements a version of the Simplex and Generalized Basis +/// Reduction algorithms, which can perform analysis of integer sets with affine +/// inequalities and equalities. A Simplex can be constructed +/// by specifying the dimensionality of the set. It supports adding affine +/// inequalities and equalities, and can perform emptiness checks, i.e., it can +/// find a solution to the set of constraints if one exists, or say that the +/// set is empty if no solution exists. Furthermore, it can find a subset of +/// these constraints that are redundant, i.e. a subset of constraints that +/// doesn't constrain the affine set further after adding the non-redundant +/// constraints. The LexSimplex class provides support for computing the +/// lexicographic minimum of an IntegerRelation. The SymbolicLexOpt class +/// provides support for computing symbolic lexicographic minimums. All of these +/// classes can be constructed from an IntegerRelation, and all inherit common +/// functionality from SimplexBase. +/// +/// The implementations of the Simplex and SimplexBase classes, other than the +/// functionality for obtaining an integer sample, are based on the paper +/// "Simplify: A Theorem Prover for Program Checking" +/// by D. Detlefs, G. Nelson, J. B. Saxe. +/// +/// We define variables, constraints, and unknowns. Consider the example of a +/// two-dimensional set defined by 1 + 2x + 3y >= 0 and 2x - 3y >= 0. Here, +/// x, y, are variables while 1 + 2x + 3y >= 0, 2x - 3y >= 0 are constraints. +/// Unknowns are either variables or constraints, i.e., x, y, 1 + 2x + 3y >= 0, +/// 2x - 3y >= 0 are all unknowns. +/// +/// The implementation involves a matrix called a tableau, which can be thought +/// of as a 2D matrix of rational numbers having number of rows equal to the +/// number of constraints and number of columns equal to one plus the number of +/// variables. In our implementation, instead of storing rational numbers, we +/// store a common denominator for each row, so it is in fact a matrix of +/// integers with number of rows equal to number of constraints and number of +/// columns equal to _two_ plus the number of variables. For example, instead of +/// storing a row of three rationals [1/2, 2/3, 3], we would store [6, 3, 4, 18] +/// since 3/6 = 1/2, 4/6 = 2/3, and 18/6 = 3. +/// +/// Every row and column except the first and second columns is associated with +/// an unknown and every unknown is associated with a row or column. An unknown +/// associated with a row or column is said to be in row or column orientation +/// respectively. As described above, the first column is the common +/// denominator. The second column represents the constant term, explained in +/// more detail below. These two are _fixed columns_; they always retain their +/// position as the first and second columns. Additionally, LexSimplexBase +/// stores a so-call big M parameter (explained below) in the third column, so +/// LexSimplexBase has three fixed columns. Finally, SymbolicLexSimplex has +/// `nSymbol` variables designated as symbols. These occupy the next `nSymbol` +/// columns, viz. the columns [3, 3 + nSymbol). For more information on symbols, +/// see LexSimplexBase and SymbolicLexSimplex. +/// +/// LexSimplexBase does not directly support variables which can be negative, so +/// we introduce the so-called big M parameter, an artificial variable that is +/// considered to have an arbitrarily large value. We then transform the +/// variables, say x, y, z, ... to M, M + x, M + y, M + z. Since M has been +/// added to these variables, they are now known to have non-negative values. +/// For more details, see the documentation for LexSimplexBase. The big M +/// parameter is not considered a real unknown and is not stored in the `var` +/// data structure; rather the tableau just has an extra fixed column for it +/// just like the constant term. +/// +/// The vectors var and con store information about the variables and +/// constraints respectively, namely, whether they are in row or column +/// position, which row or column they are associated with, and whether they +/// correspond to a variable or a constraint. +/// +/// An unknown is addressed by its index. If the index i is non-negative, then +/// the variable var[i] is being addressed. If the index i is negative, then +/// the constraint con[~i] is being addressed. Effectively this maps +/// 0 -> var[0], 1 -> var[1], -1 -> con[0], -2 -> con[1], etc. rowUnknown[r] and +/// colUnknown[c] are the indexes of the unknowns associated with row r and +/// column c, respectively. +/// +/// The unknowns in column position are together called the basis. Initially the +/// basis is the set of variables -- in our example above, the initial basis is +/// x, y. +/// +/// The unknowns in row position are represented in terms of the basis unknowns. +/// If the basis unknowns are u_1, u_2, ... u_m, and a row in the tableau is +/// d, c, a_1, a_2, ... a_m, this represents the unknown for that row as +/// (c + a_1*u_1 + a_2*u_2 + ... + a_m*u_m)/d. In our running example, if the +/// basis is the initial basis of x, y, then the constraint 1 + 2x + 3y >= 0 +/// would be represented by the row [1, 1, 2, 3]. +/// +/// The association of unknowns to rows and columns can be changed by a process +/// called pivoting, where a row unknown and a column unknown exchange places +/// and the remaining row variables' representation is changed accordingly +/// by eliminating the old column unknown in favour of the new column unknown. +/// If we had pivoted the column for x with the row for 2x - 3y >= 0, +/// the new row for x would be [2, 1, 3] since x = (1*(2x - 3y) + 3*y)/2. +/// See the documentation for the pivot member function for details. +/// +/// The association of unknowns to rows and columns is called the _tableau +/// configuration_. The _sample value_ of an unknown in a particular tableau +/// configuration is its value if all the column unknowns were set to zero. +/// Concretely, for unknowns in column position the sample value is zero; when +/// the big M parameter is not used, for unknowns in row position the sample +/// value is the constant term divided by the common denominator. When the big M +/// parameter is used, if d is the denominator, p is the big M coefficient, and +/// c is the constant term, then the sample value is (p*M + c)/d. Since M is +/// considered to be positive infinity, this is positive (negative) infinity +/// when p is positive or negative, and c/d when p is zero. +/// +/// The tableau configuration is called _consistent_ if the sample value of all +/// restricted unknowns is non-negative. Initially there are no constraints, and +/// the tableau is consistent. When a new constraint is added, its sample value +/// in the current tableau configuration may be negative. In that case, we try +/// to find a series of pivots to bring us to a consistent tableau +/// configuration, i.e. we try to make the new constraint's sample value +/// non-negative without making that of any other constraints negative. (See +/// findPivot and findPivotRow for details.) If this is not possible, then the +/// set of constraints is mutually contradictory and the tableau is marked +/// _empty_, which means the set of constraints has no solution. +/// +/// This SimplexBase class also supports taking snapshots of the current state +/// and rolling back to prior snapshots. This works by maintaining an undo log +/// of operations. Snapshots are just pointers to a particular location in the +/// log, and rolling back to a snapshot is done by reverting each log entry's +/// operation from the end until we reach the snapshot's location. SimplexBase +/// also supports taking a snapshot including the exact set of basis unknowns; +/// if this functionality is used, then on rolling back the exact basis will +/// also be restored. This is used by LexSimplexBase because the lex algorithm, +/// unlike `Simplex`, is sensitive to the exact basis used at a point. +class SimplexBase { +public: + SimplexBase() = delete; + virtual ~SimplexBase() = default; + + /// Returns true if the tableau is empty (has conflicting constraints), + /// false otherwise. + bool isEmpty() const; + + /// Add an inequality to the tableau. If coeffs is c_0, c_1, ... c_n, where n + /// is the current number of variables, then the corresponding inequality is + /// c_n + c_0*x_0 + c_1*x_1 + ... + c_{n-1}*x_{n-1} >= 0. + virtual void addInequality(ArrayRef coeffs) = 0; + + /// Returns the number of variables in the tableau. + unsigned getNumVariables() const; + + /// Returns the number of constraints in the tableau. + unsigned getNumConstraints() const; + + /// Add an equality to the tableau. If coeffs is c_0, c_1, ... c_n, where n + /// is the current number of variables, then the corresponding equality is + /// c_n + c_0*x_0 + c_1*x_1 + ... + c_{n-1}*x_{n-1} == 0. + void addEquality(ArrayRef coeffs); + + /// Add new variables to the end of the list of variables. + void appendVariable(unsigned count = 1); + + /// Append a new variable to the simplex and constrain it such that its only + /// integer value is the floor div of `coeffs` and `denom`. + /// + /// `denom` must be positive. + void addDivisionVariable(ArrayRef coeffs, const MPInt &denom); + + /// Mark the tableau as being empty. + void markEmpty(); + + /// Get a snapshot of the current state. This is used for rolling back. + /// The same basis will not necessarily be restored on rolling back. + /// The snapshot only captures the set of variables and constraints present + /// in the Simplex. + unsigned getSnapshot() const; + + /// Get a snapshot of the current state including the basis. When rolling + /// back, the exact basis will be restored. + unsigned getSnapshotBasis(); + + /// Rollback to a snapshot. This invalidates all later snapshots. + void rollback(unsigned snapshot); + + /// Add all the constraints from the given IntegerRelation. + void intersectIntegerRelation(const IntegerRelation &rel); + + /// Print the tableau's internal state. + void print(raw_ostream &os) const; + void dump() const; + +protected: + /// Construct a SimplexBase with the specified number of variables and fixed + /// columns. The first overload should be used when there are nosymbols. + /// With the second overload, the specified range of vars will be marked + /// as symbols. With the third overload, `isSymbol` is a bitmask denoting + /// which vars are symbols. The size of `isSymbol` must be `nVar`. + /// + /// For example, Simplex uses two fixed columns: the denominator and the + /// constant term, whereas LexSimplex has an extra fixed column for the + /// so-called big M parameter. For more information see the documentation for + /// LexSimplex. + SimplexBase(unsigned nVar, bool mustUseBigM); + SimplexBase(unsigned nVar, bool mustUseBigM, + const llvm::SmallBitVector &isSymbol); + + enum class Orientation { Row, Column }; + + /// An Unknown is either a variable or a constraint. It is always associated + /// with either a row or column. Whether it's a row or a column is specified + /// by the orientation and pos identifies the specific row or column it is + /// associated with. If the unknown is restricted, then it has a + /// non-negativity constraint associated with it, i.e., its sample value must + /// always be non-negative and if it cannot be made non-negative without + /// violating other constraints, the tableau is empty. + struct Unknown { + Unknown(Orientation oOrientation, bool oRestricted, unsigned oPos, + bool oIsSymbol = false) + : pos(oPos), orientation(oOrientation), restricted(oRestricted), + isSymbol(oIsSymbol) {} + unsigned pos; + Orientation orientation; + bool restricted : 1; + bool isSymbol : 1; + + void print(raw_ostream &os) const { + os << (orientation == Orientation::Row ? "r" : "c"); + os << pos; + if (restricted) + os << " [>=0]"; + } + }; + + struct Pivot { + unsigned row, column; + }; + + /// Return any row that this column can be pivoted with, ignoring tableau + /// consistency. + /// + /// Returns an empty optional if no pivot is possible, which happens only when + /// the column unknown is a variable and no constraint has a non-zero + /// coefficient for it. + std::optional findAnyPivotRow(unsigned col); + + /// Swap the row with the column in the tableau's data structures but not the + /// tableau itself. This is used by pivot. + void swapRowWithCol(unsigned row, unsigned col); + + /// Pivot the row with the column. + void pivot(unsigned row, unsigned col); + void pivot(Pivot pair); + + /// Returns the unknown associated with index. + const Unknown &unknownFromIndex(int index) const; + /// Returns the unknown associated with col. + const Unknown &unknownFromColumn(unsigned col) const; + /// Returns the unknown associated with row. + const Unknown &unknownFromRow(unsigned row) const; + /// Returns the unknown associated with index. + Unknown &unknownFromIndex(int index); + /// Returns the unknown associated with col. + Unknown &unknownFromColumn(unsigned col); + /// Returns the unknown associated with row. + Unknown &unknownFromRow(unsigned row); + + /// Add a new row to the tableau and the associated data structures. The row + /// is initialized to zero. Returns the index of the added row. + unsigned addZeroRow(bool makeRestricted = false); + + /// Add a new row to the tableau and the associated data structures. + /// The new row is considered to be a constraint; the new Unknown lives in + /// con. + /// + /// Returns the index of the new Unknown in con. + unsigned addRow(ArrayRef coeffs, bool makeRestricted = false); + + /// Swap the two rows/columns in the tableau and associated data structures. + void swapRows(unsigned i, unsigned j); + void swapColumns(unsigned i, unsigned j); + + /// Enum to denote operations that need to be undone during rollback. + enum class UndoLogEntry { + RemoveLastConstraint, + RemoveLastVariable, + UnmarkEmpty, + UnmarkLastRedundant, + RestoreBasis + }; + + /// Undo the addition of the last constraint. This will only be called from + /// undo, when rolling back. + virtual void undoLastConstraint() = 0; + + /// Remove the last constraint, which must be in row orientation. + void removeLastConstraintRowOrientation(); + + /// Undo the operation represented by the log entry. + void undo(UndoLogEntry entry); + + /// Return the number of fixed columns, as described in the constructor above, + /// this is the number of columns beyond those for the variables in var. + unsigned getNumFixedCols() const { return usingBigM ? 3u : 2u; } + unsigned getNumRows() const { return tableau.getNumRows(); } + unsigned getNumColumns() const { return tableau.getNumColumns(); } + + /// Stores whether or not a big M column is present in the tableau. + bool usingBigM; + + /// The number of redundant rows in the tableau. These are the first + /// nRedundant rows. + unsigned nRedundant; + + /// The number of parameters. This must be consistent with the number of + /// Unknowns in `var` below that have `isSymbol` set to true. + unsigned nSymbol; + + /// The matrix representing the tableau. + IntMatrix tableau; + + /// This is true if the tableau has been detected to be empty, false + /// otherwise. + bool empty; + + /// Holds a log of operations, used for rolling back to a previous state. + SmallVector undoLog; + + /// Holds a vector of bases. The ith saved basis is the basis that should be + /// restored when processing the ith occurrance of UndoLogEntry::RestoreBasis + /// in undoLog. This is used by getSnapshotBasis. + SmallVector, 8> savedBases; + + /// These hold the indexes of the unknown at a given row or column position. + /// We keep these as signed integers since that makes it convenient to check + /// if an index corresponds to a variable or a constraint by checking the + /// sign. + /// + /// colUnknown is padded with two null indexes at the front since the first + /// two columns don't correspond to any unknowns. + SmallVector rowUnknown, colUnknown; + + /// These hold information about each unknown. + SmallVector con, var; +}; + +/// Simplex class using the lexicographic pivot rule. Used for lexicographic +/// optimization. The implementation of this class is based on the paper +/// "Parametric Integer Programming" by Paul Feautrier. +/// +/// This does not directly support negative-valued variables, so it uses the big +/// M parameter trick to make all the variables non-negative. Basically we +/// introduce an artifical variable M that is considered to have a value of +/// +infinity and instead of the variables x, y, z, we internally use variables +/// M + x, M + y, M + z, which are now guaranteed to be non-negative. See the +/// documentation for SimplexBase for more details. M is also considered to be +/// an integer that is divisible by everything. +/// +/// The whole algorithm is performed with M treated as a symbol; +/// it is just considered to be infinite throughout and it never appears in the +/// final outputs. We will deal with sample values throughout that may in +/// general be some affine expression involving M, like pM + q or aM + b. We can +/// compare these with each other. They have a total order: +/// +/// aM + b < pM + q iff a < p or (a == p and b < q). +/// In particular, aM + b < 0 iff a < 0 or (a == 0 and b < 0). +/// +/// When performing symbolic optimization, sample values will be affine +/// expressions in M and the symbols. For example, we could have sample values +/// aM + bS + c and pM + qS + r, where S is a symbol. Now we have +/// aM + bS + c < pM + qS + r iff (a < p) or (a == p and bS + c < qS + r). +/// bS + c < qS + r can be always true, always false, or neither, +/// depending on the set of values S can take. The symbols are always stored +/// in columns [3, 3 + nSymbols). For more details, see the +/// documentation for SymbolicLexSimplex. +/// +/// Initially all the constraints to be added are added as rows, with no attempt +/// to keep the tableau consistent. Pivots are only performed when some query +/// is made, such as a call to getRationalLexMin. Care is taken to always +/// maintain a lexicopositive basis transform, explained below. +/// +/// Let the variables be x = (x_1, ... x_n). +/// Let the symbols be s = (s_1, ... s_m). Let the basis unknowns at a +/// particular point be y = (y_1, ... y_n). We know that x = A*y + T*s + b for +/// some n x n matrix A, n x m matrix s, and n x 1 column vector b. We want +/// every column in A to be lexicopositive, i.e., have at least one non-zero +/// element, with the first such element being positive. This property is +/// preserved throughout the operation of LexSimplexBase. Note that on +/// construction, the basis transform A is the identity matrix and so every +/// column is lexicopositive. Note that for LexSimplexBase, for the tableau to +/// be consistent we must have non-negative sample values not only for the +/// constraints but also for the variables. So if the tableau is consistent then +/// x >= 0 and y >= 0, by which we mean every element in these vectors is +/// non-negative. (note that this is a different concept from lexicopositivity!) +class LexSimplexBase : public SimplexBase { +public: + ~LexSimplexBase() override = default; + + /// Add an inequality to the tableau. If coeffs is c_0, c_1, ... c_n, where n + /// is the current number of variables, then the corresponding inequality is + /// c_n + c_0*x_0 + c_1*x_1 + ... + c_{n-1}*x_{n-1} >= 0. + /// + /// This just adds the inequality to the tableau and does not try to create a + /// consistent tableau configuration. + void addInequality(ArrayRef coeffs) final; + + /// Get a snapshot of the current state. This is used for rolling back. + unsigned getSnapshot() { return SimplexBase::getSnapshotBasis(); } + +protected: + LexSimplexBase(unsigned nVar) : SimplexBase(nVar, /*mustUseBigM=*/true) {} + LexSimplexBase(unsigned nVar, const llvm::SmallBitVector &isSymbol) + : SimplexBase(nVar, /*mustUseBigM=*/true, isSymbol) {} + explicit LexSimplexBase(const IntegerRelation &constraints) + : LexSimplexBase(constraints.getNumVars()) { + intersectIntegerRelation(constraints); + } + explicit LexSimplexBase(const IntegerRelation &constraints, + const llvm::SmallBitVector &isSymbol) + : LexSimplexBase(constraints.getNumVars(), isSymbol) { + intersectIntegerRelation(constraints); + } + + /// Add new symbolic variables to the end of the list of variables. + void appendSymbol(); + + /// Try to move the specified row to column orientation while preserving the + /// lexicopositivity of the basis transform. The row must have a non-positive + /// sample value. If this is not possible, return failure. This occurs when + /// the constraints have no solution or the sample value is zero. + LogicalResult moveRowUnknownToColumn(unsigned row); + + /// Given a row that has a non-integer sample value, add an inequality to cut + /// away this fractional sample value from the polytope without removing any + /// integer points. The integer lexmin, if one existed, remains the same on + /// return. + /// + /// This assumes that the symbolic part of the sample is integral, + /// i.e., if the symbolic sample is (c + aM + b_1*s_1 + ... b_n*s_n)/d, + /// where s_1, ... s_n are symbols, this assumes that + /// (b_1*s_1 + ... + b_n*s_n)/s is integral. + /// + /// Return failure if the tableau became empty, and success if it didn't. + /// Failure status indicates that the polytope was integer empty. + LogicalResult addCut(unsigned row); + + /// Undo the addition of the last constraint. This is only called while + /// rolling back. + void undoLastConstraint() final; + + /// Given two potential pivot columns for a row, return the one that results + /// in the lexicographically smallest sample vector. The row's sample value + /// must be negative. If symbols are involved, the sample value must be + /// negative for all possible assignments to the symbols. + unsigned getLexMinPivotColumn(unsigned row, unsigned colA, + unsigned colB) const; +}; + +/// A class for lexicographic optimization without any symbols. This also +/// provides support for integer-exact redundancy and separateness checks. +class LexSimplex : public LexSimplexBase { +public: + explicit LexSimplex(unsigned nVar) : LexSimplexBase(nVar) {} + // Note that LexSimplex does NOT support symbolic lexmin; + // use SymbolicLexSimplex if that is required. LexSimplex ignores the VarKinds + // of the passed IntegerRelation. Symbols will be treated as ordinary vars. + explicit LexSimplex(const IntegerRelation &constraints) + : LexSimplexBase(constraints) {} + + /// Return the lexicographically minimum rational solution to the constraints. + MaybeOptimum> findRationalLexMin(); + + /// Return the lexicographically minimum integer solution to the constraints. + /// + /// Note: this should be used only when the lexmin is really needed. To obtain + /// any integer sample, use Simplex::findIntegerSample as that is more robust. + MaybeOptimum> findIntegerLexMin(); + + /// Return whether the specified inequality is redundant/separate for the + /// polytope. Redundant means every point satisfies the given inequality, and + /// separate means no point satisfies it. + /// + /// These checks are integer-exact. + bool isSeparateInequality(ArrayRef coeffs); + bool isRedundantInequality(ArrayRef coeffs); + +private: + /// Returns the current sample point, which may contain non-integer (rational) + /// coordinates. Returns an empty optimum when the tableau is empty. + /// + /// Returns an unbounded optimum when the big M parameter is used and a + /// variable has a non-zero big M coefficient, meaning its value is infinite + /// or unbounded. + MaybeOptimum> getRationalSample() const; + + /// Make the tableau configuration consistent. + LogicalResult restoreRationalConsistency(); + + /// Return whether the specified row is violated; + bool rowIsViolated(unsigned row) const; + + /// Get a constraint row that is violated, if one exists. + /// Otherwise, return an empty optional. + std::optional maybeGetViolatedRow() const; + + /// Get a row corresponding to a var that has a non-integral sample value, if + /// one exists. Otherwise, return an empty optional. + std::optional maybeGetNonIntegralVarRow() const; +}; + +/// Represents the result of a symbolic lexicographic optimization computation. +struct SymbolicLexOpt { + SymbolicLexOpt(const PresburgerSpace &space) + : lexopt(space), + unboundedDomain(PresburgerSet::getEmpty(space.getDomainSpace())) {} + + /// This maps assignments of symbols to the corresponding lexopt. + /// Takes no value when no integer sample exists for the assignment or if the + /// lexopt is unbounded. + PWMAFunction lexopt; + /// Contains all assignments to the symbols that made the lexopt unbounded. + /// Note that the symbols of the input set to the symbolic lexopt are dims + /// of this PrebsurgerSet. + PresburgerSet unboundedDomain; +}; + +/// A class to perform symbolic lexicographic optimization, +/// i.e., to find, for every assignment to the symbols the specified +/// `symbolDomain`, the lexicographically minimum value integer value attained +/// by the non-symbol variables. +/// +/// The input is a set parametrized by some symbols, i.e., the constant terms +/// of the constraints in the set are affine expressions in the symbols, and +/// every assignment to the symbols defines a non-symbolic set. +/// +/// Accordingly, the sample values of the rows in our tableau will be affine +/// expressions in the symbols, and every assignment to the symbols will define +/// a non-symbolic LexSimplex. We then run the algorithm of +/// LexSimplex::findIntegerLexMin simultaneously for every value of the symbols +/// in the domain. +/// +/// Often, the pivot to be performed is the same for all values of the symbols, +/// in which case we just do it. For example, if the symbolic sample of a row is +/// negative for all values in the symbol domain, the row needs to be pivoted +/// irrespective of the precise value of the symbols. To answer queries like +/// "Is this symbolic sample always negative in the symbol domain?", we maintain +/// a `LexSimplex domainSimplex` correponding to the symbol domain. +/// +/// In other cases, it may be that the symbolic sample is violated at some +/// values in the symbol domain and not violated at others. In this case, +/// the pivot to be performed does depend on the value of the symbols. We +/// handle this by splitting the symbol domain. We run the algorithm for the +/// case where the row isn't violated, and then come back and run the case +/// where it is. +class SymbolicLexSimplex : public LexSimplexBase { +public: + /// `constraints` is the set for which the symbolic lexopt will be computed. + /// `symbolDomain` is the set of values of the symbols for which the lexopt + /// will be computed. `symbolDomain` should have a dim var for every symbol in + /// `constraints`, and no other vars. `isSymbol` specifies which vars of + /// `constraints` should be considered as symbols. + /// + /// The resulting SymbolicLexOpt's space will be compatible with that of + /// symbolDomain. + SymbolicLexSimplex(const IntegerRelation &constraints, + const IntegerPolyhedron &symbolDomain, + const llvm::SmallBitVector &isSymbol) + : LexSimplexBase(constraints, isSymbol), domainPoly(symbolDomain), + domainSimplex(symbolDomain) { + // TODO consider supporting this case. It amounts + // to just returning the input constraints. + assert(domainPoly.getNumVars() > 0 && + "there must be some non-symbols to optimize!"); + } + + /// An overload to select some subrange of ids as symbols for lexopt. + /// The symbol ids are the range of ids with absolute index + /// [symbolOffset, symbolOffset + symbolDomain.getNumVars()) + SymbolicLexSimplex(const IntegerRelation &constraints, unsigned symbolOffset, + const IntegerPolyhedron &symbolDomain) + : SymbolicLexSimplex(constraints, symbolDomain, + getSubrangeBitVector(constraints.getNumVars(), + symbolOffset, + symbolDomain.getNumVars())) {} + + /// An overload to select the symbols of `constraints` as symbols for lexopt. + SymbolicLexSimplex(const IntegerRelation &constraints, + const IntegerPolyhedron &symbolDomain) + : SymbolicLexSimplex(constraints, + constraints.getVarKindOffset(VarKind::Symbol), + symbolDomain) { + assert(constraints.getNumSymbolVars() == symbolDomain.getNumVars() && + "symbolDomain must have as many vars as constraints has symbols!"); + } + + /// The lexmin will be stored as a function `lexopt` from symbols to + /// non-symbols in the result. + /// + /// For some values of the symbols, the lexmin may be unbounded. + /// These parts of the symbol domain will be stored in `unboundedDomain`. + /// + /// The spaces of the sets in the result are compatible with the symbolDomain + /// passed in the SymbolicLexSimplex constructor. + SymbolicLexOpt computeSymbolicIntegerLexMin(); + +private: + /// Perform all pivots that do not require branching. + /// + /// Return failure if the tableau became empty, indicating that the polytope + /// is always integer empty in the current symbol domain. + /// Return success otherwise. + LogicalResult doNonBranchingPivots(); + + /// Get a row that is always violated in the current domain, if one exists. + std::optional maybeGetAlwaysViolatedRow(); + + /// Get a row corresponding to a variable with non-integral sample value, if + /// one exists. + std::optional maybeGetNonIntegralVarRow(); + + /// Given a row that has a non-integer sample value, cut away this fractional + /// sample value witahout removing any integer points, i.e., the integer + /// lexmin, if it exists, remains the same after a call to this function. This + /// may add constraints or local variables to the tableau, as well as to the + /// domain. + /// + /// Returns whether the cut constraint could be enforced, i.e. failure if the + /// cut made the polytope empty, and success if it didn't. Failure status + /// indicates that the polytope is always integer empty in the symbol domain + /// at the time of the call. (This function may modify the symbol domain, but + /// failure statu indicates that the polytope was empty for all symbol values + /// in the initial domain.) + LogicalResult addSymbolicCut(unsigned row); + + /// Get the numerator of the symbolic sample of the specific row. + /// This is an affine expression in the symbols with integer coefficients. + /// The last element is the constant term. This ignores the big M coefficient. + SmallVector getSymbolicSampleNumerator(unsigned row) const; + + /// Get an affine inequality in the symbols with integer coefficients that + /// holds iff the symbolic sample of the specified row is non-negative. + SmallVector getSymbolicSampleIneq(unsigned row) const; + + /// Return whether all the coefficients of the symbolic sample are integers. + /// + /// This does not consult the domain to check if the specified expression + /// is always integral despite coefficients being fractional. + bool isSymbolicSampleIntegral(unsigned row) const; + + /// Record a lexmin. The tableau must be consistent with all variables + /// having symbolic samples with integer coefficients. + void recordOutput(SymbolicLexOpt &result) const; + + /// The symbol domain. + IntegerPolyhedron domainPoly; + /// Simplex corresponding to the symbol domain. + LexSimplex domainSimplex; +}; + +/// The Simplex class uses the Normal pivot rule and supports integer emptiness +/// checks as well as detecting redundancies. +/// +/// The Simplex class supports redundancy checking via detectRedundant and +/// isMarkedRedundant. A redundant constraint is one which is never violated as +/// long as the other constraints are not violated, i.e., removing a redundant +/// constraint does not change the set of solutions to the constraints. As a +/// heuristic, constraints that have been marked redundant can be ignored for +/// most operations. Therefore, these constraints are kept in rows 0 to +/// nRedundant - 1, where nRedundant is a member variable that tracks the number +/// of constraints that have been marked redundant. +/// +/// Finding an integer sample is done with the Generalized Basis Reduction +/// algorithm. See the documentation for findIntegerSample and reduceBasis. +class Simplex : public SimplexBase { +public: + enum class Direction { Up, Down }; + + Simplex() = delete; + explicit Simplex(unsigned nVar) : SimplexBase(nVar, /*mustUseBigM=*/false) {} + explicit Simplex(const IntegerRelation &constraints) + : Simplex(constraints.getNumVars()) { + intersectIntegerRelation(constraints); + } + ~Simplex() override = default; + + /// Add an inequality to the tableau. If coeffs is c_0, c_1, ... c_n, where n + /// is the current number of variables, then the corresponding inequality is + /// c_n + c_0*x_0 + c_1*x_1 + ... + c_{n-1}*x_{n-1} >= 0. + /// + /// This also tries to restore the tableau configuration to a consistent + /// state and marks the Simplex empty if this is not possible. + void addInequality(ArrayRef coeffs) final; + + /// Compute the maximum or minimum value of the given row, depending on + /// direction. The specified row is never pivoted. On return, the row may + /// have a negative sample value if the direction is down. + /// + /// Returns a Fraction denoting the optimum, or a null value if no optimum + /// exists, i.e., if the expression is unbounded in this direction. + MaybeOptimum computeRowOptimum(Direction direction, unsigned row); + + /// Compute the maximum or minimum value of the given expression, depending on + /// direction. Should not be called when the Simplex is empty. + /// + /// Returns a Fraction denoting the optimum, or a null value if no optimum + /// exists, i.e., if the expression is unbounded in this direction. + MaybeOptimum computeOptimum(Direction direction, + ArrayRef coeffs); + + /// Returns whether the perpendicular of the specified constraint is a + /// is a direction along which the polytope is bounded. + bool isBoundedAlongConstraint(unsigned constraintIndex); + + /// Returns whether the specified constraint has been marked as redundant. + /// Constraints are numbered from 0 starting at the first added inequality. + /// Equalities are added as a pair of inequalities and so correspond to two + /// inequalities with successive indices. + bool isMarkedRedundant(unsigned constraintIndex) const; + + /// Finds a subset of constraints that is redundant, i.e., such that + /// the set of solutions does not change if these constraints are removed. + /// Marks these constraints as redundant. Whether a specific constraint has + /// been marked redundant can be queried using isMarkedRedundant. + /// + /// The first overload only tries to find redundant constraints with indices + /// in the range [offset, offset + count), by scanning constraints from left + /// to right in this range. If `count` is not provided, all constraints + /// starting at `offset` are scanned, and if neither are provided, all + /// constraints are scanned, starting from 0 and going to the last constraint. + /// + /// As an example, in the set (x) : (x >= 0, x >= 0, x >= 0), calling + /// `detectRedundant` with no parameters will result in the first two + /// constraints being marked redundant. All copies cannot be marked redundant + /// because removing all the constraints changes the set. The first two are + /// the ones marked redundant because we scan from left to right. Thus, when + /// there is some preference among the constraints as to which should be + /// marked redundant with priority when there are multiple possibilities, this + /// could be accomplished by succesive calls to detectRedundant(offset, + /// count). + void detectRedundant(unsigned offset, unsigned count); + void detectRedundant(unsigned offset) { + assert(offset <= con.size() && "invalid offset!"); + detectRedundant(offset, con.size() - offset); + } + void detectRedundant() { detectRedundant(0, con.size()); } + + /// Returns a (min, max) pair denoting the minimum and maximum integer values + /// of the given expression. If no integer value exists, both results will be + /// of kind Empty. + std::pair, MaybeOptimum> + computeIntegerBounds(ArrayRef coeffs); + + /// Returns true if the polytope is unbounded, i.e., extends to infinity in + /// some direction. Otherwise, returns false. + bool isUnbounded(); + + /// Make a tableau to represent a pair of points in the given tableaus, one in + /// tableau A and one in B. + static Simplex makeProduct(const Simplex &a, const Simplex &b); + + /// Returns an integer sample point if one exists, or std::nullopt + /// otherwise. This should only be called for bounded sets. + std::optional> findIntegerSample(); + + enum class IneqType { Redundant, Cut, Separate }; + + /// Returns the type of the inequality with coefficients `coeffs`. + /// + /// Possible types are: + /// Redundant The inequality is satisfied in the polytope + /// Cut The inequality is satisfied by some points, but not by others + /// Separate The inequality is not satisfied by any point + IneqType findIneqType(ArrayRef coeffs); + + /// Check if the specified inequality already holds in the polytope. + bool isRedundantInequality(ArrayRef coeffs); + + /// Check if the specified equality already holds in the polytope. + bool isRedundantEquality(ArrayRef coeffs); + + /// Returns true if this Simplex's polytope is a rational subset of `rel`. + /// Otherwise, returns false. + bool isRationalSubsetOf(const IntegerRelation &rel); + + /// Returns the current sample point if it is integral. Otherwise, returns + /// std::nullopt. + std::optional> getSamplePointIfIntegral() const; + + /// Returns the current sample point, which may contain non-integer (rational) + /// coordinates. Returns an empty optional when the tableau is empty. + std::optional> getRationalSample() const; + +private: + friend class GBRSimplex; + + /// Restore the unknown to a non-negative sample value. + /// + /// Returns success if the unknown was successfully restored to a non-negative + /// sample value, failure otherwise. + LogicalResult restoreRow(Unknown &u); + + /// Find a pivot to change the sample value of row in the specified + /// direction while preserving tableau consistency, except that if the + /// direction is down then the pivot may make the specified row take a + /// negative value. The returned pivot row will be row if and only if the + /// unknown is unbounded in the specified direction. + /// + /// Returns a (row, col) pair denoting a pivot, or an empty Optional if + /// no valid pivot exists. + std::optional findPivot(int row, Direction direction) const; + + /// Find a row that can be used to pivot the column in the specified + /// direction. If skipRow is not null, then this row is excluded + /// from consideration. The returned pivot will maintain all constraints + /// except the column itself and skipRow, if it is set. (if these unknowns + /// are restricted). + /// + /// Returns the row to pivot to, or an empty Optional if the column + /// is unbounded in the specified direction. + std::optional findPivotRow(std::optional skipRow, + Direction direction, unsigned col) const; + + /// Undo the addition of the last constraint while preserving tableau + /// consistency. + void undoLastConstraint() final; + + /// Compute the maximum or minimum of the specified Unknown, depending on + /// direction. The specified unknown may be pivoted. If the unknown is + /// restricted, it will have a non-negative sample value on return. + /// Should not be called if the Simplex is empty. + /// + /// Returns a Fraction denoting the optimum, or a null value if no optimum + /// exists, i.e., if the expression is unbounded in this direction. + MaybeOptimum computeOptimum(Direction direction, Unknown &u); + + /// Mark the specified unknown redundant. This operation is added to the undo + /// log and will be undone by rollbacks. The specified unknown must be in row + /// orientation. + void markRowRedundant(Unknown &u); + + /// Reduce the given basis, starting at the specified level, using general + /// basis reduction. + void reduceBasis(IntMatrix &basis, unsigned level); +}; + +/// Takes a snapshot of the simplex state on construction and rolls back to the +/// snapshot on destruction. +/// +/// Useful for performing operations in a "transient context", all changes from +/// which get rolled back on scope exit. +class SimplexRollbackScopeExit { +public: + SimplexRollbackScopeExit(SimplexBase &simplex) : simplex(simplex) { + snapshot = simplex.getSnapshot(); + }; + ~SimplexRollbackScopeExit() { simplex.rollback(snapshot); } + +private: + SimplexBase &simplex; + unsigned snapshot; +}; + +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_SIMPLEX_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/SlowMPInt.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/SlowMPInt.h new file mode 100644 index 0000000000000000000000000000000000000000..c70306761c549b36ff52828fbed1931a5dd9fe82 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/SlowMPInt.h @@ -0,0 +1,136 @@ +//===- SlowMPInt.h - MLIR SlowMPInt Class -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This is a simple class to represent arbitrary precision signed integers. +// Unlike APInt, one does not have to specify a fixed maximum size, and the +// integer can take on any arbitrary values. +// +// This class is to be used as a fallback slow path for the MPInt class, and +// is not intended to be used directly. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_SLOWMPINT_H +#define MLIR_ANALYSIS_PRESBURGER_SLOWMPINT_H + +#include "mlir/Support/MathExtras.h" +#include "llvm/ADT/APInt.h" +#include "llvm/ADT/Hashing.h" +#include "llvm/Support/raw_ostream.h" + +namespace mlir { +namespace presburger { +namespace detail { + +/// A simple class providing multi-precision arithmetic. Internally, it stores +/// an APInt, whose width is doubled whenever an overflow occurs at a certain +/// width. The default constructor sets the initial width to 64. SlowMPInt is +/// primarily intended to be used as a slow fallback path for the upcoming MPInt +/// class. +class SlowMPInt { +private: + llvm::APInt val; + +public: + explicit SlowMPInt(int64_t val); + SlowMPInt(); + explicit SlowMPInt(const llvm::APInt &val); + SlowMPInt &operator=(int64_t val); + explicit operator int64_t() const; + SlowMPInt operator-() const; + bool operator==(const SlowMPInt &o) const; + bool operator!=(const SlowMPInt &o) const; + bool operator>(const SlowMPInt &o) const; + bool operator<(const SlowMPInt &o) const; + bool operator<=(const SlowMPInt &o) const; + bool operator>=(const SlowMPInt &o) const; + SlowMPInt operator+(const SlowMPInt &o) const; + SlowMPInt operator-(const SlowMPInt &o) const; + SlowMPInt operator*(const SlowMPInt &o) const; + SlowMPInt operator/(const SlowMPInt &o) const; + SlowMPInt operator%(const SlowMPInt &o) const; + SlowMPInt &operator+=(const SlowMPInt &o); + SlowMPInt &operator-=(const SlowMPInt &o); + SlowMPInt &operator*=(const SlowMPInt &o); + SlowMPInt &operator/=(const SlowMPInt &o); + SlowMPInt &operator%=(const SlowMPInt &o); + + SlowMPInt &operator++(); + SlowMPInt &operator--(); + + friend SlowMPInt abs(const SlowMPInt &x); + friend SlowMPInt ceilDiv(const SlowMPInt &lhs, const SlowMPInt &rhs); + friend SlowMPInt floorDiv(const SlowMPInt &lhs, const SlowMPInt &rhs); + /// The operands must be non-negative for gcd. + friend SlowMPInt gcd(const SlowMPInt &a, const SlowMPInt &b); + + /// Overload to compute a hash_code for a SlowMPInt value. + friend llvm::hash_code hash_value(const SlowMPInt &x); // NOLINT + + void print(llvm::raw_ostream &os) const; + void dump() const; + + unsigned getBitWidth() const { return val.getBitWidth(); } +}; + +llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const SlowMPInt &x); + +/// Returns the remainder of dividing LHS by RHS. +/// +/// The RHS is always expected to be positive, and the result +/// is always non-negative. +SlowMPInt mod(const SlowMPInt &lhs, const SlowMPInt &rhs); + +/// Returns the least common multiple of 'a' and 'b'. +SlowMPInt lcm(const SlowMPInt &a, const SlowMPInt &b); + +/// Redeclarations of friend declarations above to +/// make it discoverable by lookups. +SlowMPInt abs(const SlowMPInt &x); +SlowMPInt ceilDiv(const SlowMPInt &lhs, const SlowMPInt &rhs); +SlowMPInt floorDiv(const SlowMPInt &lhs, const SlowMPInt &rhs); +SlowMPInt gcd(const SlowMPInt &a, const SlowMPInt &b); +llvm::hash_code hash_value(const SlowMPInt &x); // NOLINT + +/// --------------------------------------------------------------------------- +/// Convenience operator overloads for int64_t. +/// --------------------------------------------------------------------------- +SlowMPInt &operator+=(SlowMPInt &a, int64_t b); +SlowMPInt &operator-=(SlowMPInt &a, int64_t b); +SlowMPInt &operator*=(SlowMPInt &a, int64_t b); +SlowMPInt &operator/=(SlowMPInt &a, int64_t b); +SlowMPInt &operator%=(SlowMPInt &a, int64_t b); + +bool operator==(const SlowMPInt &a, int64_t b); +bool operator!=(const SlowMPInt &a, int64_t b); +bool operator>(const SlowMPInt &a, int64_t b); +bool operator<(const SlowMPInt &a, int64_t b); +bool operator<=(const SlowMPInt &a, int64_t b); +bool operator>=(const SlowMPInt &a, int64_t b); +SlowMPInt operator+(const SlowMPInt &a, int64_t b); +SlowMPInt operator-(const SlowMPInt &a, int64_t b); +SlowMPInt operator*(const SlowMPInt &a, int64_t b); +SlowMPInt operator/(const SlowMPInt &a, int64_t b); +SlowMPInt operator%(const SlowMPInt &a, int64_t b); + +bool operator==(int64_t a, const SlowMPInt &b); +bool operator!=(int64_t a, const SlowMPInt &b); +bool operator>(int64_t a, const SlowMPInt &b); +bool operator<(int64_t a, const SlowMPInt &b); +bool operator<=(int64_t a, const SlowMPInt &b); +bool operator>=(int64_t a, const SlowMPInt &b); +SlowMPInt operator+(int64_t a, const SlowMPInt &b); +SlowMPInt operator-(int64_t a, const SlowMPInt &b); +SlowMPInt operator*(int64_t a, const SlowMPInt &b); +SlowMPInt operator/(int64_t a, const SlowMPInt &b); +SlowMPInt operator%(int64_t a, const SlowMPInt &b); +} // namespace detail +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_SLOWMPINT_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Utils.h new file mode 100644 index 0000000000000000000000000000000000000000..a451ae8bf55723e9d073da5f2a86daa2d7f9d285 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/Presburger/Utils.h @@ -0,0 +1,282 @@ +//===- Utils.h - General utilities for Presburger library ------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Utility functions required by the Presburger Library. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_PRESBURGER_UTILS_H +#define MLIR_ANALYSIS_PRESBURGER_UTILS_H + +#include "mlir/Analysis/Presburger/MPInt.h" +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallBitVector.h" + +#include "mlir/Analysis/Presburger/Matrix.h" +#include + +namespace mlir { +namespace presburger { + +class IntegerRelation; + +/// This class represents the result of operations optimizing something subject +/// to some constraints. If the constraints were not satisfiable the, kind will +/// be Empty. If the optimum is unbounded, the kind is Unbounded, and if the +/// optimum is bounded, the kind will be Bounded and `optimum` holds the optimal +/// value. +enum class OptimumKind { Empty, Unbounded, Bounded }; +template +class MaybeOptimum { +public: +private: + OptimumKind kind = OptimumKind::Empty; + T optimum; + +public: + MaybeOptimum() = default; + MaybeOptimum(OptimumKind kind) : kind(kind) { + assert(kind != OptimumKind::Bounded && + "Bounded optima should be constructed by specifying the optimum!"); + } + MaybeOptimum(const T &optimum) + : kind(OptimumKind::Bounded), optimum(optimum) {} + + OptimumKind getKind() const { return kind; } + bool isBounded() const { return kind == OptimumKind::Bounded; } + bool isUnbounded() const { return kind == OptimumKind::Unbounded; } + bool isEmpty() const { return kind == OptimumKind::Empty; } + + std::optional getOptimumIfBounded() const { return optimum; } + const T &getBoundedOptimum() const { + assert(kind == OptimumKind::Bounded && + "This should be called only for bounded optima"); + return optimum; + } + T &getBoundedOptimum() { + assert(kind == OptimumKind::Bounded && + "This should be called only for bounded optima"); + return optimum; + } + const T &operator*() const { return getBoundedOptimum(); } + T &operator*() { return getBoundedOptimum(); } + const T *operator->() const { return &getBoundedOptimum(); } + T *operator->() { return &getBoundedOptimum(); } + bool operator==(const MaybeOptimum &other) const { + if (kind != other.kind) + return false; + if (kind != OptimumKind::Bounded) + return true; + return optimum == other.optimum; + } + + // Given f that takes a T and returns a U, convert this `MaybeOptimum` to + // a `MaybeOptimum` by applying `f` to the bounded optimum if it exists, or + // returning a MaybeOptimum of the same kind otherwise. + template + auto map(const Function &f) const & -> MaybeOptimum { + if (kind == OptimumKind::Bounded) + return f(optimum); + return kind; + } +}; + +/// `ReprKind` enum is used to set the constraint type in `MaybeLocalRepr`. +enum class ReprKind { Inequality, Equality, None }; + +/// `MaybeLocalRepr` contains the indices of the constraints that can be +/// expressed as a floordiv of an affine function. If it's an `equality` +/// constraint, `equalityIdx` is set, in case of `inequality` the +/// `lowerBoundIdx` and `upperBoundIdx` is set. By default the kind attribute is +/// set to None. +struct MaybeLocalRepr { + ReprKind kind = ReprKind::None; + explicit operator bool() const { return kind != ReprKind::None; } + union { + unsigned equalityIdx; + struct { + unsigned lowerBoundIdx, upperBoundIdx; + } inequalityPair; + } repr; +}; + +/// Class storing division representation of local variables of a constraint +/// system. The coefficients of the dividends are stored in order: +/// [nonLocalVars, localVars, constant]. Each local variable may or may not have +/// a representation. If the local does not have a representation, the dividend +/// of the division has no meaning and the denominator is zero. If it has a +/// representation, the denominator will be positive. +/// +/// The i^th division here, represents the division representation of the +/// variable at position `divOffset + i` in the constraint system. +class DivisionRepr { +public: + DivisionRepr(unsigned numVars, unsigned numDivs) + : dividends(numDivs, numVars + 1), denoms(numDivs, MPInt(0)) {} + + DivisionRepr(unsigned numVars) : dividends(0, numVars + 1) {} + + unsigned getNumVars() const { return dividends.getNumColumns() - 1; } + unsigned getNumDivs() const { return dividends.getNumRows(); } + unsigned getNumNonDivs() const { return getNumVars() - getNumDivs(); } + // Get the offset from where division variables start. + unsigned getDivOffset() const { return getNumVars() - getNumDivs(); } + + // Check whether the `i^th` division has a division representation or not. + bool hasRepr(unsigned i) const { return denoms[i] != 0; } + // Check whether all the divisions have a division representation or not. + bool hasAllReprs() const { return !llvm::is_contained(denoms, 0); } + + // Clear the division representation of the i^th local variable. + void clearRepr(unsigned i) { denoms[i] = 0; } + + // Get the dividend of the `i^th` division. + MutableArrayRef getDividend(unsigned i) { return dividends.getRow(i); } + ArrayRef getDividend(unsigned i) const { return dividends.getRow(i); } + + // For a given point containing values for each variable other than the + // division variables, try to find the values for each division variable from + // their division representation. + SmallVector, 4> divValuesAt(ArrayRef point) const; + + // Get the `i^th` denominator. + MPInt &getDenom(unsigned i) { return denoms[i]; } + MPInt getDenom(unsigned i) const { return denoms[i]; } + + ArrayRef getDenoms() const { return denoms; } + + void setDiv(unsigned i, ArrayRef dividend, const MPInt &divisor) { + dividends.setRow(i, dividend); + denoms[i] = divisor; + } + + // Find the greatest common divisor (GCD) of the dividends and divisor for + // each valid division. Divide the dividends and divisor by the GCD to + // simplify the expression. + void normalizeDivs(); + + void insertDiv(unsigned pos, ArrayRef dividend, const MPInt &divisor); + void insertDiv(unsigned pos, unsigned num = 1); + + /// Removes duplicate divisions. On every possible duplicate division found, + /// `merge(i, j)`, where `i`, `j` are current index of the duplicate + /// divisions, is called and division at index `j` is merged into division at + /// index `i`. If `merge(i, j)` returns `true`, the divisions are merged i.e. + /// `j^th` division gets eliminated and it's each instance is replaced by + /// `i^th` division. If it returns `false`, the divisions are not merged. + /// `merge` can also do side effects, For example it can merge the local + /// variables in IntegerRelation. + void + removeDuplicateDivs(llvm::function_ref merge); + + void print(raw_ostream &os) const; + void dump() const; + +private: + /// Each row of the Matrix represents a single division dividend. The + /// `i^th` row represents the dividend of the variable at `divOffset + i` + /// in the constraint system (and the `i^th` local variable). + IntMatrix dividends; + + /// Denominators of each division. If a denominator of a division is `0`, the + /// division variable is considered to not have a division representation. + /// Otherwise, the denominator is positive. + SmallVector denoms; +}; + +/// If `q` is defined to be equal to `expr floordiv d`, this equivalent to +/// saying that `q` is an integer and `q` is subject to the inequalities +/// `0 <= expr - d*q <= c - 1` (quotient remainder theorem). +/// +/// Rearranging, we get the bounds on `q`: d*q <= expr <= d*q + d - 1. +/// +/// `getDivUpperBound` returns `d*q <= expr`, and +/// `getDivLowerBound` returns `expr <= d*q + d - 1`. +/// +/// The parameter `dividend` corresponds to `expr` above, `divisor` to `d`, and +/// `localVarIdx` to the position of `q` in the coefficient list. +/// +/// The coefficient of `q` in `dividend` must be zero, as it is not allowed for +/// local variable to be a floor division of an expression involving itself. +/// The divisor must be positive. +SmallVector getDivUpperBound(ArrayRef dividend, + const MPInt &divisor, + unsigned localVarIdx); +SmallVector getDivLowerBound(ArrayRef dividend, + const MPInt &divisor, + unsigned localVarIdx); + +llvm::SmallBitVector getSubrangeBitVector(unsigned len, unsigned setOffset, + unsigned numSet); + +/// Check if the pos^th variable can be expressed as a floordiv of an affine +/// function of other variables (where the divisor is a positive constant). +/// `foundRepr` contains a boolean for each variable indicating if the +/// explicit representation for that variable has already been computed. +/// Return the given array as an array of MPInts. +SmallVector getMPIntVec(ArrayRef range); +/// Return the given array as an array of int64_t. +SmallVector getInt64Vec(ArrayRef range); + +/// Returns the `MaybeLocalRepr` struct which contains the indices of the +/// constraints that can be expressed as a floordiv of an affine function. If +/// the representation could be computed, `dividend` and `divisor` are set, +/// in which case, denominator will be positive. If the representation could +/// not be computed, the kind attribute in `MaybeLocalRepr` is set to None. +MaybeLocalRepr computeSingleVarRepr(const IntegerRelation &cst, + ArrayRef foundRepr, unsigned pos, + MutableArrayRef dividend, + MPInt &divisor); + +/// The following overload using int64_t is required for a callsite in +/// AffineStructures.h. +MaybeLocalRepr computeSingleVarRepr(const IntegerRelation &cst, + ArrayRef foundRepr, unsigned pos, + SmallVector ÷nd, + unsigned &divisor); + +/// Given two relations, A and B, add additional local vars to the sets such +/// that both have the union of the local vars in each set, without changing +/// the set of points that lie in A and B. +/// +/// While taking union, if a local var in any set has a division representation +/// which is a duplicate of division representation, of another local var in any +/// set, it is not added to the final union of local vars and is instead merged. +/// +/// On every possible merge, `merge(i, j)` is called. `i`, `j` are position +/// of local variables in both sets which are being merged. If `merge(i, j)` +/// returns true, the divisions are merged, otherwise the divisions are not +/// merged. +void mergeLocalVars(IntegerRelation &relA, IntegerRelation &relB, + llvm::function_ref merge); + +/// Compute the gcd of the range. +MPInt gcdRange(ArrayRef range); + +/// Divide the range by its gcd and return the gcd. +MPInt normalizeRange(MutableArrayRef range); + +/// Normalize the given (numerator, denominator) pair by dividing out the +/// common factors between them. The numerator here is an affine expression +/// with integer coefficients. The denominator must be positive. +void normalizeDiv(MutableArrayRef num, MPInt &denom); + +/// Return `coeffs` with all the elements negated. +SmallVector getNegatedCoeffs(ArrayRef coeffs); + +/// Return the complement of the given inequality. +/// +/// The complement of a_1 x_1 + ... + a_n x_ + c >= 0 is +/// a_1 x_1 + ... + a_n x_ + c < 0, i.e., -a_1 x_1 - ... - a_n x_ - c - 1 >= 0, +/// since all the variables are constrained to be integers. +SmallVector getComplementIneq(ArrayRef ineq); +} // namespace presburger +} // namespace mlir + +#endif // MLIR_ANALYSIS_PRESBURGER_UTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/SliceAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/SliceAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..e64d3ac0271eb928fcb866762db714eea09d05a8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/SliceAnalysis.h @@ -0,0 +1,264 @@ +//===- SliceAnalysis.h - Analysis for Transitive UseDef chains --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_SLICEANALYSIS_H_ +#define MLIR_ANALYSIS_SLICEANALYSIS_H_ + +#include +#include + +#include "mlir/Support/LLVM.h" + +#include "llvm/ADT/SetVector.h" + +namespace mlir { +class BlockArgument; +class Operation; +class Value; + +struct SliceOptions { + /// Type of the condition to limit the propagation of transitive use-defs. + /// This can be used in particular to limit the propagation to a given Scope + /// or to avoid passing through certain types of operation in a configurable + /// manner. + using TransitiveFilter = std::function; + TransitiveFilter filter = nullptr; + + /// Include the top level op in the slice. + bool inclusive = false; + + // TODO: Remove this alias once downstream users are updated. + SliceOptions() {} + SliceOptions(TransitiveFilter filter) : filter(std::move(filter)) {} +}; + +// TODO: Remove this alias once downstream users are updated. +using TransitiveFilter = SliceOptions::TransitiveFilter; + +struct BackwardSliceOptions : public SliceOptions { + using SliceOptions::SliceOptions; + /// When omitBlockArguments is true, the backward slice computation omits + /// traversing any block arguments. When omitBlockArguments is false, the + /// backward slice computation traverses block arguments and asserts that the + /// parent op has a single region with a single block. + bool omitBlockArguments = false; +}; + +using ForwardSliceOptions = SliceOptions; + +/// Fills `forwardSlice` with the computed forward slice (i.e. all +/// the transitive uses of op), **without** including that operation. +/// +/// This additionally takes a TransitiveFilter which acts as a frontier: +/// when looking at uses transitively, an operation that does not pass the +/// filter is never propagated through. This allows in particular to carve out +/// the scope within a ForOp or the scope within an IfOp. +/// +/// The implementation traverses the use chains in postorder traversal for +/// efficiency reasons: if an operation is already in `forwardSlice`, no +/// need to traverse its uses again. Since use-def chains form a DAG, this +/// terminates. +/// +/// Upon return to the root call, `forwardSlice` is filled with a +/// postorder list of uses (i.e. a reverse topological order). To get a proper +/// topological order, we just reverse the order in `forwardSlice` before +/// returning. +/// +/// Example starting from node 0 +/// ============================ +/// +/// 0 +/// ___________|___________ +/// 1 2 3 4 +/// |_______| |______| +/// | | | +/// | 5 6 +/// |___|_____________| +/// | | +/// 7 8 +/// |_______________| +/// | +/// 9 +/// +/// Assuming all local orders match the numbering order: +/// 1. after getting back to the root getForwardSlice, `forwardSlice` may +/// contain: +/// {9, 7, 8, 5, 1, 2, 6, 3, 4} +/// 2. reversing the result of 1. gives: +/// {4, 3, 6, 2, 1, 5, 8, 7, 9} +/// +void getForwardSlice(Operation *op, SetVector *forwardSlice, + ForwardSliceOptions options = {}); + +/// Value-rooted version of `getForwardSlice`. Return the union of all forward +/// slices for the uses of the value `root`. +void getForwardSlice(Value root, SetVector *forwardSlice, + ForwardSliceOptions options = {}); + +/// Fills `backwardSlice` with the computed backward slice (i.e. +/// all the transitive defs of op), **without** including that operation. +/// +/// This additionally takes a TransitiveFilter which acts as a frontier: +/// when looking at defs transitively, an operation that does not pass the +/// filter is never propagated through. This allows in particular to carve out +/// the scope within a ForOp or the scope within an IfOp. +/// +/// The implementation traverses the def chains in postorder traversal for +/// efficiency reasons: if an operation is already in `backwardSlice`, no +/// need to traverse its definitions again. Since useuse-def chains form a DAG, +/// this terminates. +/// +/// Upon return to the root call, `backwardSlice` is filled with a +/// postorder list of defs. This happens to be a topological order, from the +/// point of view of the use-def chains. +/// +/// Example starting from node 8 +/// ============================ +/// +/// 1 2 3 4 +/// |_______| |______| +/// | | | +/// | 5 6 +/// |___|_____________| +/// | | +/// 7 8 +/// |_______________| +/// | +/// 9 +/// +/// Assuming all local orders match the numbering order: +/// {1, 2, 5, 3, 4, 6} +/// +void getBackwardSlice(Operation *op, SetVector *backwardSlice, + BackwardSliceOptions options = {}); + +/// Value-rooted version of `getBackwardSlice`. Return the union of all backward +/// slices for the op defining or owning the value `root`. +void getBackwardSlice(Value root, SetVector *backwardSlice, + BackwardSliceOptions options = {}); + +/// Iteratively computes backward slices and forward slices until +/// a fixed point is reached. Returns an `SetVector` which +/// **includes** the original operation. +/// +/// This allows building a slice (i.e. multi-root DAG where everything +/// that is reachable from an Value in forward and backward direction is +/// contained in the slice). +/// This is the abstraction we need to materialize all the operations for +/// supervectorization without worrying about orderings and Value +/// replacements. +/// +/// Example starting from any node +/// ============================== +/// +/// 1 2 3 4 +/// |_______| |______| +/// | | | | +/// | 5 6___| +/// |___|_____________| | +/// | | | +/// 7 8 | +/// |_______________| | +/// | | +/// 9 10 +/// +/// Return the whole DAG in some topological order. +/// +/// The implementation works by just filling up a worklist with iterative +/// alternate calls to `getBackwardSlice` and `getForwardSlice`. +/// +/// The following section describes some additional implementation +/// considerations for a potentially more efficient implementation but they are +/// just an intuition without proof, we still use a worklist for now. +/// +/// Additional implementation considerations +/// ======================================== +/// Consider the defs-op-uses hourglass. +/// ____ +/// \ / defs (in some topological order) +/// \/ +/// op +/// /\ +/// / \ uses (in some topological order) +/// /____\ +/// +/// We want to iteratively apply `getSlice` to construct the whole +/// list of Operation that are reachable by (use|def)+ from op. +/// We want the resulting slice in topological order. +/// Ideally we would like the ordering to be maintained in-place to avoid +/// copying Operation at each step. Keeping this ordering by construction +/// seems very unclear, so we list invariants in the hope of seeing whether +/// useful properties pop up. +/// +/// In the following: +/// we use |= for set inclusion; +/// we use << for set topological ordering (i.e. each pair is ordered). +/// +/// Assumption: +/// =========== +/// We wish to maintain the following property by a recursive argument: +/// """ +/// defs << {op} < getSlice(Operation *op, + BackwardSliceOptions backwardSliceOptions = {}, + ForwardSliceOptions forwardSliceOptions = {}); + +/// Multi-root DAG topological sort. +/// Performs a topological sort of the Operation in the `toSort` SetVector. +/// Returns a topologically sorted SetVector. +SetVector topologicalSort(const SetVector &toSort); + +/// Utility to match a generic reduction given a list of iteration-carried +/// arguments, `iterCarriedArgs` and the position of the potential reduction +/// argument within the list, `redPos`. If a reduction is matched, returns the +/// reduced value and the topologically-sorted list of combiner operations +/// involved in the reduction. Otherwise, returns a null value. +/// +/// The matching algorithm relies on the following invariants, which are subject +/// to change: +/// 1. The first combiner operation must be a binary operation with the +/// iteration-carried value and the reduced value as operands. +/// 2. The iteration-carried value and combiner operations must be side +/// effect-free, have single result and a single use. +/// 3. Combiner operations must be immediately nested in the region op +/// performing the reduction. +/// 4. Reduction def-use chain must end in a terminator op that yields the +/// next iteration/output values in the same order as the iteration-carried +/// values in `iterCarriedArgs`. +/// 5. `iterCarriedArgs` must contain all the iteration-carried/output values +/// of the region op performing the reduction. +/// +/// This utility is generic enough to detect reductions involving multiple +/// combiner operations (disabled for now) across multiple dialects, including +/// Linalg, Affine and SCF. For the sake of genericity, it does not return +/// specific enum values for the combiner operations since its goal is also +/// matching reductions without pre-defined semantics in core MLIR. It's up to +/// each client to make sense out of the list of combiner operations. It's also +/// up to each client to check for additional invariants on the expected +/// reductions not covered by this generic matching. +Value matchReduction(ArrayRef iterCarriedArgs, unsigned redPos, + SmallVectorImpl &combinerOps); + +} // namespace mlir + +#endif // MLIR_ANALYSIS_SLICEANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/SymbolTableAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/SymbolTableAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..145627e43aee1232c0972d0d8d8a15ab52552575 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Analysis/SymbolTableAnalysis.h @@ -0,0 +1,54 @@ +//===- SymbolTableAnalysis.h - Analysis for cached symbol tables --*- C++ -*-=// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ANALYSIS_SYMBOLTABLEANALYSIS_H +#define MLIR_ANALYSIS_SYMBOLTABLEANALYSIS_H + +#include "mlir/IR/SymbolTable.h" +#include "mlir/Pass/AnalysisManager.h" + +namespace mlir { +/// This is a simple analysis that contains a symbol table collection and, for +/// simplicity, a reference to the top-level symbol table. This allows symbol +/// tables to be preserved across passes. Most often, symbol tables are +/// automatically kept up-to-date via the `insert` and `erase` functions. +class SymbolTableAnalysis { +public: + /// Create the symbol table analysis at the provided top-level operation and + /// instantiate the symbol table of the top-level operation. + SymbolTableAnalysis(Operation *op) + : topLevelSymbolTable(symbolTables.getSymbolTable(op)) {} + + /// Get the symbol table collection. + SymbolTableCollection &getSymbolTables() { return symbolTables; } + + /// Get the top-level symbol table. + SymbolTable &getTopLevelSymbolTable() { return topLevelSymbolTable; } + + /// Get the top-level operation. + template + OpT getTopLevelOp() { + return cast(topLevelSymbolTable.getOp()); + } + + /// Symbol tables are kept up-to-date by passes. Assume that the analysis + /// remains valid. + bool isInvalidated(const AnalysisManager::PreservedAnalyses &pa) { + return false; + } + +private: + /// The symbol table collection containing cached symbol tables for all nested + /// symbol table operations. + SymbolTableCollection symbolTables; + /// The symbol table of the top-level operation. + SymbolTable &topLevelSymbolTable; +}; +} // namespace mlir + +#endif // MLIR_ANALYSIS_SYMBOLTABLEANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/AsmParser/AsmParser.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/AsmParser/AsmParser.h new file mode 100644 index 0000000000000000000000000000000000000000..3c1bff1fbc7f14d9706870348b53d55c99469c77 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/AsmParser/AsmParser.h @@ -0,0 +1,78 @@ +//===- AsmParser.h - MLIR AsmParser Library Interface -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is contains the interface to the MLIR assembly parser library. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ASMPARSER_ASMPARSER_H +#define MLIR_ASMPARSER_ASMPARSER_H + +#include "mlir/IR/AsmState.h" +#include + +namespace llvm { +class SourceMgr; +class StringRef; +} // namespace llvm + +namespace mlir { +class AsmParserState; +class AsmParserCodeCompleteContext; + +/// This parses the file specified by the indicated SourceMgr and appends parsed +/// operations to the given block. If the block is non-empty, the operations are +/// placed before the current terminator. If parsing is successful, success is +/// returned. Otherwise, an error message is emitted through the error handler +/// registered in the context, and failure is returned. If `sourceFileLoc` is +/// non-null, it is populated with a file location representing the start of the +/// source file that is being parsed. If `asmState` is non-null, it is populated +/// with detailed information about the parsed IR (including exact locations for +/// SSA uses and definitions). `asmState` should only be provided if this +/// detailed information is desired. If `codeCompleteContext` is non-null, it is +/// used to signal tracking of a code completion event (generally only ever +/// useful for LSP or other high level language tooling). +LogicalResult +parseAsmSourceFile(const llvm::SourceMgr &sourceMgr, Block *block, + const ParserConfig &config, + AsmParserState *asmState = nullptr, + AsmParserCodeCompleteContext *codeCompleteContext = nullptr); + +/// This parses a single MLIR attribute to an MLIR context if it was valid. If +/// not, an error diagnostic is emitted to the context and a null value is +/// returned. +/// If `numRead` is provided, it is set to the number of consumed characters on +/// succesful parse. Otherwise, parsing fails if the entire string is not +/// consumed. +/// Some internal copying can be skipped if the source string is known to be +/// null terminated. +Attribute parseAttribute(llvm::StringRef attrStr, MLIRContext *context, + Type type = {}, size_t *numRead = nullptr, + bool isKnownNullTerminated = false); + +/// This parses a single MLIR type to an MLIR context if it was valid. If not, +/// an error diagnostic is emitted to the context. +/// If `numRead` is provided, it is set to the number of consumed characters on +/// succesful parse. Otherwise, parsing fails if the entire string is not +/// consumed. +/// Some internal copying can be skipped if the source string is known to be +/// null terminated. +Type parseType(llvm::StringRef typeStr, MLIRContext *context, + size_t *numRead = nullptr, bool isKnownNullTerminated = false); + +/// This parses a single IntegerSet/AffineMap to an MLIR context if it was +/// valid. If not, an error message is emitted through a new +/// SourceMgrDiagnosticHandler constructed from a new SourceMgr with a single +/// MemoryBuffer wrapping `str`. If the passed `str` has additional tokens that +/// were not part of the IntegerSet/AffineMap, a failure is returned. +AffineMap parseAffineMap(llvm::StringRef str, MLIRContext *context); +IntegerSet parseIntegerSet(llvm::StringRef str, MLIRContext *context); + +} // namespace mlir + +#endif // MLIR_ASMPARSER_ASMPARSER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/AsmParser/AsmParserState.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/AsmParser/AsmParserState.h new file mode 100644 index 0000000000000000000000000000000000000000..98bdc4696b846bd1023e02fe0809803855e77345 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/AsmParser/AsmParserState.h @@ -0,0 +1,239 @@ +//===- AsmParserState.h -----------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ASMPARSER_ASMPARSERSTATE_H +#define MLIR_ASMPARSER_ASMPARSERSTATE_H + +#include "mlir/IR/Attributes.h" +#include "mlir/IR/Types.h" +#include "llvm/Support/SMLoc.h" +#include + +namespace mlir { +class Block; +class BlockArgument; +class FileLineColLoc; +class Operation; +class OperationName; +class SymbolRefAttr; +class Value; + +/// This class represents state from a parsed MLIR textual format string. It is +/// useful for building additional analysis and language utilities on top of +/// textual MLIR. This should generally not be used for traditional compilation. +class AsmParserState { +public: + /// This class represents a definition within the source manager, containing + /// it's defining location and locations of any uses. SMDefinitions are only + /// provided for entities that have uses within an input file, e.g. SSA + /// values, Blocks, and Symbols. + struct SMDefinition { + SMDefinition() = default; + SMDefinition(SMRange loc) : loc(loc) {} + + /// The source location of the definition. + SMRange loc; + /// The source location of all uses of the definition. + SmallVector uses; + }; + + /// This class represents the information for an operation definition within + /// an input file. + struct OperationDefinition { + struct ResultGroupDefinition { + ResultGroupDefinition(unsigned index, SMRange loc) + : startIndex(index), definition(loc) {} + + /// The result number that starts this group. + unsigned startIndex; + /// The source definition of the result group. + SMDefinition definition; + }; + + OperationDefinition(Operation *op, SMRange loc, SMLoc endLoc) + : op(op), loc(loc), scopeLoc(loc.Start, endLoc) {} + + /// The operation representing this definition. + Operation *op; + + /// The source location for the operation, i.e. the location of its name. + SMRange loc; + + /// The full source range of the operation definition, i.e. a range + /// encompassing the start and end of the full operation definition. + SMRange scopeLoc; + + /// Source definitions for any result groups of this operation. + SmallVector resultGroups; + + /// If this operation is a symbol operation, this vector contains symbol + /// uses of this operation. + SmallVector symbolUses; + }; + + /// This class represents the information for a block definition within the + /// input file. + struct BlockDefinition { + BlockDefinition(Block *block, SMRange loc = {}) + : block(block), definition(loc) {} + + /// The block representing this definition. + Block *block; + + /// The source location for the block, i.e. the location of its name, and + /// any uses it has. + SMDefinition definition; + + /// Source definitions for any arguments of this block. + SmallVector arguments; + }; + + /// This class represents the information for an attribute alias definition + /// within the input file. + struct AttributeAliasDefinition { + AttributeAliasDefinition(StringRef name, SMRange loc = {}, + Attribute value = {}) + : name(name), definition(loc), value(value) {} + + /// The name of the attribute alias. + StringRef name; + + /// The source location for the alias. + SMDefinition definition; + + /// The value of the alias. + Attribute value; + }; + + /// This class represents the information for type definition within the input + /// file. + struct TypeAliasDefinition { + TypeAliasDefinition(StringRef name, SMRange loc, Type value) + : name(name), definition(loc), value(value) {} + + /// The name of the attribute alias. + StringRef name; + + /// The source location for the alias. + SMDefinition definition; + + /// The value of the alias. + Type value; + }; + + AsmParserState(); + ~AsmParserState(); + AsmParserState &operator=(AsmParserState &&other); + + //===--------------------------------------------------------------------===// + // Access State + //===--------------------------------------------------------------------===// + + using BlockDefIterator = llvm::pointee_iterator< + ArrayRef>::iterator>; + using OperationDefIterator = llvm::pointee_iterator< + ArrayRef>::iterator>; + using AttributeDefIterator = llvm::pointee_iterator< + ArrayRef>::iterator>; + using TypeDefIterator = llvm::pointee_iterator< + ArrayRef>::iterator>; + + /// Return a range of the BlockDefinitions held by the current parser state. + iterator_range getBlockDefs() const; + + /// Return the definition for the given block, or nullptr if the given + /// block does not have a definition. + const BlockDefinition *getBlockDef(Block *block) const; + + /// Return a range of the OperationDefinitions held by the current parser + /// state. + iterator_range getOpDefs() const; + + /// Return the definition for the given operation, or nullptr if the given + /// operation does not have a definition. + const OperationDefinition *getOpDef(Operation *op) const; + + /// Return a range of the AttributeAliasDefinitions held by the current parser + /// state. + iterator_range getAttributeAliasDefs() const; + + /// Return the definition for the given attribute alias, or nullptr if the + /// given alias does not have a definition. + const AttributeAliasDefinition *getAttributeAliasDef(StringRef name) const; + + /// Return a range of the TypeAliasDefinitions held by the current parser + /// state. + iterator_range getTypeAliasDefs() const; + + /// Return the definition for the given type alias, or nullptr if the given + /// alias does not have a definition. + const TypeAliasDefinition *getTypeAliasDef(StringRef name) const; + + /// Returns (heuristically) the range of an identifier given a SMLoc + /// corresponding to the start of an identifier location. + static SMRange convertIdLocToRange(SMLoc loc); + + //===--------------------------------------------------------------------===// + // Populate State + //===--------------------------------------------------------------------===// + + /// Initialize the state in preparation for populating more parser state under + /// the given top-level operation. + void initialize(Operation *topLevelOp); + + /// Finalize any in-progress parser state under the given top-level operation. + void finalize(Operation *topLevelOp); + + /// Start a definition for an operation with the given name. + void startOperationDefinition(const OperationName &opName); + + /// Finalize the most recently started operation definition. + void finalizeOperationDefinition( + Operation *op, SMRange nameLoc, SMLoc endLoc, + ArrayRef> resultGroups = std::nullopt); + + /// Start a definition for a region nested under the current operation. + void startRegionDefinition(); + + /// Finalize the most recently started region definition. + void finalizeRegionDefinition(); + + /// Add a definition of the given entity. + void addDefinition(Block *block, SMLoc location); + void addDefinition(BlockArgument blockArg, SMLoc location); + void addAttrAliasDefinition(StringRef name, SMRange location, + Attribute value); + void addTypeAliasDefinition(StringRef name, SMRange location, Type value); + + /// Add a source uses of the given value. + void addUses(Value value, ArrayRef locations); + void addUses(Block *block, ArrayRef locations); + void addAttrAliasUses(StringRef name, SMRange locations); + void addTypeAliasUses(StringRef name, SMRange locations); + + /// Add source uses for all the references nested under `refAttr`. The + /// provided `locations` should match 1-1 with the number of references in + /// `refAttr`, i.e.: + /// nestedReferences.size() + /*leafReference=*/1 == refLocations.size() + void addUses(SymbolRefAttr refAttr, ArrayRef refLocations); + + /// Refine the `oldValue` to the `newValue`. This is used to indicate that + /// `oldValue` was a placeholder, and the uses of it should really refer to + /// `newValue`. + void refineDefinition(Value oldValue, Value newValue); + +private: + struct Impl; + + /// A pointer to the internal implementation of this class. + std::unique_ptr impl; +}; + +} // namespace mlir + +#endif // MLIR_ASMPARSER_ASMPARSERSTATE_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/AsmParser/CodeComplete.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/AsmParser/CodeComplete.h new file mode 100644 index 0000000000000000000000000000000000000000..e59fe66826b7c9ce0da58c0dad63512b549a8cd5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/AsmParser/CodeComplete.h @@ -0,0 +1,78 @@ +//===- CodeComplete.h - MLIR Asm CodeComplete Context -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_ASMPARSER_CODECOMPLETE_H +#define MLIR_ASMPARSER_CODECOMPLETE_H + +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/Support/SourceMgr.h" + +namespace mlir { +class Attribute; +class Type; + +/// This class provides an abstract interface into the parser for hooking in +/// code completion events. This class is only really useful for providing +/// language tooling for MLIR, general clients should not need to use this +/// class. +class AsmParserCodeCompleteContext { +public: + virtual ~AsmParserCodeCompleteContext(); + + /// Return the source location used to provide code completion. + SMLoc getCodeCompleteLoc() const { return codeCompleteLoc; } + + //===--------------------------------------------------------------------===// + // Completion Hooks + //===--------------------------------------------------------------------===// + + /// Signal code completion for a dialect name, with an optional prefix. + virtual void completeDialectName(StringRef prefix) = 0; + void completeDialectName() { completeDialectName(""); } + + /// Signal code completion for an operation name within the given dialect. + virtual void completeOperationName(StringRef dialectName) = 0; + + /// Append the given SSA value as a code completion result for SSA value + /// completions. + virtual void appendSSAValueCompletion(StringRef name, + std::string typeData) = 0; + + /// Append the given block as a code completion result for block name + /// completions. + virtual void appendBlockCompletion(StringRef name) = 0; + + /// Signal a completion for the given expected tokens, which are optional if + /// `optional` is set. + virtual void completeExpectedTokens(ArrayRef tokens, + bool optional) = 0; + + /// Signal a completion for an attribute. + virtual void completeAttribute(const llvm::StringMap &aliases) = 0; + virtual void completeDialectAttributeOrAlias( + const llvm::StringMap &aliases) = 0; + + /// Signal a completion for a type. + virtual void completeType(const llvm::StringMap &aliases) = 0; + virtual void + completeDialectTypeOrAlias(const llvm::StringMap &aliases) = 0; + +protected: + /// Create a new code completion context with the given code complete + /// location. + explicit AsmParserCodeCompleteContext(SMLoc codeCompleteLoc) + : codeCompleteLoc(codeCompleteLoc) {} + +private: + /// The location used to code complete. + SMLoc codeCompleteLoc; +}; +} // namespace mlir + +#endif // MLIR_ASMPARSER_CODECOMPLETE_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeImplementation.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeImplementation.h new file mode 100644 index 0000000000000000000000000000000000000000..bb1f0f717d80017889435318261a0b3ed07751ac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeImplementation.h @@ -0,0 +1,513 @@ +//===- BytecodeImplementation.h - MLIR Bytecode Implementation --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header defines various interfaces and utilities necessary for dialects +// to hook into bytecode serialization. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_BYTECODE_BYTECODEIMPLEMENTATION_H +#define MLIR_BYTECODE_BYTECODEIMPLEMENTATION_H + +#include "mlir/IR/Attributes.h" +#include "mlir/IR/Diagnostics.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/DialectInterface.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/Support/LogicalResult.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/Twine.h" + +namespace mlir { +//===--------------------------------------------------------------------===// +// Dialect Version Interface. +//===--------------------------------------------------------------------===// + +/// This class is used to represent the version of a dialect, for the purpose +/// of polymorphic destruction. +class DialectVersion { +public: + virtual ~DialectVersion() = default; +}; + +//===----------------------------------------------------------------------===// +// DialectBytecodeReader +//===----------------------------------------------------------------------===// + +/// This class defines a virtual interface for reading a bytecode stream, +/// providing hooks into the bytecode reader. As such, this class should only be +/// derived and defined by the main bytecode reader, users (i.e. dialects) +/// should generally only interact with this class via the +/// BytecodeDialectInterface below. +class DialectBytecodeReader { +public: + virtual ~DialectBytecodeReader() = default; + + /// Emit an error to the reader. + virtual InFlightDiagnostic emitError(const Twine &msg = {}) const = 0; + + /// Retrieve the dialect version by name if available. + virtual FailureOr + getDialectVersion(StringRef dialectName) const = 0; + + /// Retrieve the context associated to the reader. + virtual MLIRContext *getContext() const = 0; + + /// Return the bytecode version being read. + virtual uint64_t getBytecodeVersion() const = 0; + + /// Read out a list of elements, invoking the provided callback for each + /// element. The callback function may be in any of the following forms: + /// * LogicalResult(T &) + /// * FailureOr() + template + LogicalResult readList(SmallVectorImpl &result, CallbackFn &&callback) { + uint64_t size; + if (failed(readVarInt(size))) + return failure(); + result.reserve(size); + + for (uint64_t i = 0; i < size; ++i) { + // Check if the callback uses FailureOr, or populates the result by + // reference. + if constexpr (llvm::function_traits>::num_args) { + T element = {}; + if (failed(callback(element))) + return failure(); + result.emplace_back(std::move(element)); + } else { + FailureOr element = callback(); + if (failed(element)) + return failure(); + result.emplace_back(std::move(*element)); + } + } + return success(); + } + + //===--------------------------------------------------------------------===// + // IR + //===--------------------------------------------------------------------===// + + /// Read a reference to the given attribute. + virtual LogicalResult readAttribute(Attribute &result) = 0; + /// Read an optional reference to the given attribute. Returns success even if + /// the Attribute isn't present. + virtual LogicalResult readOptionalAttribute(Attribute &attr) = 0; + + template + LogicalResult readAttributes(SmallVectorImpl &attrs) { + return readList(attrs, [this](T &attr) { return readAttribute(attr); }); + } + template + LogicalResult readAttribute(T &result) { + Attribute baseResult; + if (failed(readAttribute(baseResult))) + return failure(); + if ((result = dyn_cast(baseResult))) + return success(); + return emitError() << "expected " << llvm::getTypeName() + << ", but got: " << baseResult; + } + template + LogicalResult readOptionalAttribute(T &result) { + Attribute baseResult; + if (failed(readOptionalAttribute(baseResult))) + return failure(); + if (!baseResult) + return success(); + if ((result = dyn_cast(baseResult))) + return success(); + return emitError() << "expected " << llvm::getTypeName() + << ", but got: " << baseResult; + } + + /// Read a reference to the given type. + virtual LogicalResult readType(Type &result) = 0; + template + LogicalResult readTypes(SmallVectorImpl &types) { + return readList(types, [this](T &type) { return readType(type); }); + } + template + LogicalResult readType(T &result) { + Type baseResult; + if (failed(readType(baseResult))) + return failure(); + if ((result = dyn_cast(baseResult))) + return success(); + return emitError() << "expected " << llvm::getTypeName() + << ", but got: " << baseResult; + } + + /// Read a handle to a dialect resource. + template + FailureOr readResourceHandle() { + FailureOr handle = readResourceHandle(); + if (failed(handle)) + return failure(); + if (auto *result = dyn_cast(&*handle)) + return std::move(*result); + return emitError() << "provided resource handle differs from the " + "expected resource type"; + } + + //===--------------------------------------------------------------------===// + // Primitives + //===--------------------------------------------------------------------===// + + /// Read a variable width integer. + virtual LogicalResult readVarInt(uint64_t &result) = 0; + + /// Read a signed variable width integer. + virtual LogicalResult readSignedVarInt(int64_t &result) = 0; + LogicalResult readSignedVarInts(SmallVectorImpl &result) { + return readList(result, + [this](int64_t &value) { return readSignedVarInt(value); }); + } + + /// Parse a variable length encoded integer whose low bit is used to encode an + /// unrelated flag, i.e: `(integerValue << 1) | (flag ? 1 : 0)`. + LogicalResult readVarIntWithFlag(uint64_t &result, bool &flag) { + if (failed(readVarInt(result))) + return failure(); + flag = result & 1; + result >>= 1; + return success(); + } + + /// Read a "small" sparse array of integer <= 32 bits elements, where + /// index/value pairs can be compressed when the array is small. + /// Note that only some position of the array will be read and the ones + /// not stored in the bytecode are gonne be left untouched. + /// If the provided array is too small for the stored indices, an error + /// will be returned. + template + LogicalResult readSparseArray(MutableArrayRef array) { + static_assert(sizeof(T) < sizeof(uint64_t), "expect integer < 64 bits"); + static_assert(std::is_integral::value, "expects integer"); + uint64_t nonZeroesCount; + bool useSparseEncoding; + if (failed(readVarIntWithFlag(nonZeroesCount, useSparseEncoding))) + return failure(); + if (nonZeroesCount == 0) + return success(); + if (!useSparseEncoding) { + // This is a simple dense array. + if (nonZeroesCount > array.size()) { + emitError("trying to read an array of ") + << nonZeroesCount << " but only " << array.size() + << " storage available."; + return failure(); + } + for (int64_t index : llvm::seq(0, nonZeroesCount)) { + uint64_t value; + if (failed(readVarInt(value))) + return failure(); + array[index] = value; + } + return success(); + } + // Read sparse encoding + // This is the number of bits used for packing the index with the value. + uint64_t indexBitSize; + if (failed(readVarInt(indexBitSize))) + return failure(); + constexpr uint64_t maxIndexBitSize = 8; + if (indexBitSize > maxIndexBitSize) { + emitError("reading sparse array with indexing above 8 bits: ") + << indexBitSize; + return failure(); + } + for (uint32_t count : llvm::seq(0, nonZeroesCount)) { + (void)count; + uint64_t indexValuePair; + if (failed(readVarInt(indexValuePair))) + return failure(); + uint64_t index = indexValuePair & ~(uint64_t(-1) << (indexBitSize)); + uint64_t value = indexValuePair >> indexBitSize; + if (index >= array.size()) { + emitError("reading a sparse array found index ") + << index << " but only " << array.size() << " storage available."; + return failure(); + } + array[index] = value; + } + return success(); + } + + /// Read an APInt that is known to have been encoded with the given width. + virtual FailureOr readAPIntWithKnownWidth(unsigned bitWidth) = 0; + + /// Read an APFloat that is known to have been encoded with the given + /// semantics. + virtual FailureOr + readAPFloatWithKnownSemantics(const llvm::fltSemantics &semantics) = 0; + + /// Read a string from the bytecode. + virtual LogicalResult readString(StringRef &result) = 0; + + /// Read a blob from the bytecode. + virtual LogicalResult readBlob(ArrayRef &result) = 0; + + /// Read a bool from the bytecode. + virtual LogicalResult readBool(bool &result) = 0; + +private: + /// Read a handle to a dialect resource. + virtual FailureOr readResourceHandle() = 0; +}; + +//===----------------------------------------------------------------------===// +// DialectBytecodeWriter +//===----------------------------------------------------------------------===// + +/// This class defines a virtual interface for writing to a bytecode stream, +/// providing hooks into the bytecode writer. As such, this class should only be +/// derived and defined by the main bytecode writer, users (i.e. dialects) +/// should generally only interact with this class via the +/// BytecodeDialectInterface below. +class DialectBytecodeWriter { +public: + virtual ~DialectBytecodeWriter() = default; + + //===--------------------------------------------------------------------===// + // IR + //===--------------------------------------------------------------------===// + + /// Write out a list of elements, invoking the provided callback for each + /// element. + template + void writeList(RangeT &&range, CallbackFn &&callback) { + writeVarInt(llvm::size(range)); + for (auto &element : range) + callback(element); + } + + /// Write a reference to the given attribute. + virtual void writeAttribute(Attribute attr) = 0; + virtual void writeOptionalAttribute(Attribute attr) = 0; + template + void writeAttributes(ArrayRef attrs) { + writeList(attrs, [this](T attr) { writeAttribute(attr); }); + } + + /// Write a reference to the given type. + virtual void writeType(Type type) = 0; + template + void writeTypes(ArrayRef types) { + writeList(types, [this](T type) { writeType(type); }); + } + + /// Write the given handle to a dialect resource. + virtual void + writeResourceHandle(const AsmDialectResourceHandle &resource) = 0; + + //===--------------------------------------------------------------------===// + // Primitives + //===--------------------------------------------------------------------===// + + /// Write a variable width integer to the output stream. This should be the + /// preferred method for emitting integers whenever possible. + virtual void writeVarInt(uint64_t value) = 0; + + /// Write a signed variable width integer to the output stream. This should be + /// the preferred method for emitting signed integers whenever possible. + virtual void writeSignedVarInt(int64_t value) = 0; + void writeSignedVarInts(ArrayRef value) { + writeList(value, [this](int64_t value) { writeSignedVarInt(value); }); + } + + /// Write a VarInt and a flag packed together. + void writeVarIntWithFlag(uint64_t value, bool flag) { + writeVarInt((value << 1) | (flag ? 1 : 0)); + } + + /// Write out a "small" sparse array of integer <= 32 bits elements, where + /// index/value pairs can be compressed when the array is small. This method + /// will scan the array multiple times and should not be used for large + /// arrays. The optional provided "zero" can be used to adjust for the + /// expected repeated value. We assume here that the array size fits in a 32 + /// bits integer. + template + void writeSparseArray(ArrayRef array) { + static_assert(sizeof(T) < sizeof(uint64_t), "expect integer < 64 bits"); + static_assert(std::is_integral::value, "expects integer"); + uint32_t size = array.size(); + uint32_t nonZeroesCount = 0, lastIndex = 0; + for (uint32_t index : llvm::seq(0, size)) { + if (!array[index]) + continue; + nonZeroesCount++; + lastIndex = index; + } + // If the last position is too large, or the array isn't at least 50% + // sparse, emit it with a dense encoding. + if (lastIndex > 256 || nonZeroesCount > size / 2) { + // Emit the array size and a flag which indicates whether it is sparse. + writeVarIntWithFlag(size, false); + for (const T &elt : array) + writeVarInt(elt); + return; + } + // Emit sparse: first the number of elements we'll write and a flag + // indicating it is a sparse encoding. + writeVarIntWithFlag(nonZeroesCount, true); + if (nonZeroesCount == 0) + return; + // This is the number of bits used for packing the index with the value. + int indexBitSize = llvm::Log2_32_Ceil(lastIndex + 1); + writeVarInt(indexBitSize); + for (uint32_t index : llvm::seq(0, lastIndex + 1)) { + T value = array[index]; + if (!value) + continue; + uint64_t indexValuePair = (value << indexBitSize) | (index); + writeVarInt(indexValuePair); + } + } + + /// Write an APInt to the bytecode stream whose bitwidth will be known + /// externally at read time. This method is useful for encoding APInt values + /// when the width is known via external means, such as via a type. This + /// method should generally only be invoked if you need an APInt, otherwise + /// use the varint methods above. APInt values are generally encoded using + /// zigzag encoding, to enable more efficient encodings for negative values. + virtual void writeAPIntWithKnownWidth(const APInt &value) = 0; + + /// Write an APFloat to the bytecode stream whose semantics will be known + /// externally at read time. This method is useful for encoding APFloat values + /// when the semantics are known via external means, such as via a type. + virtual void writeAPFloatWithKnownSemantics(const APFloat &value) = 0; + + /// Write a string to the bytecode, which is owned by the caller and is + /// guaranteed to not die before the end of the bytecode process. This should + /// only be called if such a guarantee can be made, such as when the string is + /// owned by an attribute or type. + virtual void writeOwnedString(StringRef str) = 0; + + /// Write a blob to the bytecode, which is owned by the caller and is + /// guaranteed to not die before the end of the bytecode process. The blob is + /// written as-is, with no additional compression or compaction. + virtual void writeOwnedBlob(ArrayRef blob) = 0; + + /// Write a bool to the output stream. + virtual void writeOwnedBool(bool value) = 0; + + /// Return the bytecode version being emitted for. + virtual int64_t getBytecodeVersion() const = 0; +}; + +//===----------------------------------------------------------------------===// +// BytecodeDialectInterface +//===----------------------------------------------------------------------===// + +class BytecodeDialectInterface + : public DialectInterface::Base { +public: + using Base::Base; + + //===--------------------------------------------------------------------===// + // Reading + //===--------------------------------------------------------------------===// + + /// Read an attribute belonging to this dialect from the given reader. This + /// method should return null in the case of failure. Optionally, the dialect + /// version can be accessed through the reader. + virtual Attribute readAttribute(DialectBytecodeReader &reader) const { + reader.emitError() << "dialect " << getDialect()->getNamespace() + << " does not support reading attributes from bytecode"; + return Attribute(); + } + + /// Read a type belonging to this dialect from the given reader. This method + /// should return null in the case of failure. Optionally, the dialect version + /// can be accessed thorugh the reader. + virtual Type readType(DialectBytecodeReader &reader) const { + reader.emitError() << "dialect " << getDialect()->getNamespace() + << " does not support reading types from bytecode"; + return Type(); + } + + //===--------------------------------------------------------------------===// + // Writing + //===--------------------------------------------------------------------===// + + /// Write the given attribute, which belongs to this dialect, to the given + /// writer. This method may return failure to indicate that the given + /// attribute could not be encoded, in which case the textual format will be + /// used to encode this attribute instead. + virtual LogicalResult writeAttribute(Attribute attr, + DialectBytecodeWriter &writer) const { + return failure(); + } + + /// Write the given type, which belongs to this dialect, to the given writer. + /// This method may return failure to indicate that the given type could not + /// be encoded, in which case the textual format will be used to encode this + /// type instead. + virtual LogicalResult writeType(Type type, + DialectBytecodeWriter &writer) const { + return failure(); + } + + /// Write the version of this dialect to the given writer. + virtual void writeVersion(DialectBytecodeWriter &writer) const {} + + // Read the version of this dialect from the provided reader and return it as + // a `unique_ptr` to a dialect version object. + virtual std::unique_ptr + readVersion(DialectBytecodeReader &reader) const { + reader.emitError("Dialect does not support versioning"); + return nullptr; + } + + /// Hook invoked after parsing completed, if a version directive was present + /// and included an entry for the current dialect. This hook offers the + /// opportunity to the dialect to visit the IR and upgrades constructs emitted + /// by the version of the dialect corresponding to the provided version. + virtual LogicalResult + upgradeFromVersion(Operation *topLevelOp, + const DialectVersion &version) const { + return success(); + } +}; + +/// Helper for resource handle reading that returns LogicalResult. +template +static LogicalResult readResourceHandle(DialectBytecodeReader &reader, + FailureOr &value, Ts &&...params) { + FailureOr handle = reader.readResourceHandle(); + if (failed(handle)) + return failure(); + if (auto *result = dyn_cast(&*handle)) { + value = std::move(*result); + return success(); + } + return failure(); +} + +/// Helper method that injects context only if needed, this helps unify some of +/// the attribute construction methods. +template +auto get(MLIRContext *context, Ts &&...params) { + // Prefer a direct `get` method if one exists. + if constexpr (llvm::is_detected::value) { + (void)context; + return T::get(std::forward(params)...); + } else if constexpr (llvm::is_detected::value) { + return T::get(context, std::forward(params)...); + } else { + // Otherwise, pass to the base get. + return T::Base::get(context, std::forward(params)...); + } +} + +} // namespace mlir + +#endif // MLIR_BYTECODE_BYTECODEIMPLEMENTATION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..ae8e518eece8b39f300d9f6b5a5c49e1ea7ce5f9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.cpp.inc @@ -0,0 +1,16 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Read the properties for this operation from the bytecode and populate the state. +LogicalResult mlir::BytecodeOpInterface::readProperties(::mlir::DialectBytecodeReader & reader, ::mlir::OperationState & state) { + return getImpl()->readProperties(reader, state); + } +/// Write the properties for this operation to the bytecode. +void mlir::BytecodeOpInterface::writeProperties(::mlir::DialectBytecodeWriter & writer) { + return getImpl()->writeProperties(getImpl(), getOperation(), writer); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..10f5be0737914ddd501e17503da8a269d53796db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.h @@ -0,0 +1,26 @@ +//===- BytecodeOpInterface.h - Bytecode interface for MLIR Op ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains the definitions of the BytecodeOpInterface defined in +// `BytecodeOpInterface.td`. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_BYTECODE_BYTECODEOPINTERFACE_H +#define MLIR_BYTECODE_BYTECODEOPINTERFACE_H + +#include "mlir/Bytecode/BytecodeImplementation.h" +#include "mlir/Bytecode/BytecodeReader.h" +#include "mlir/Bytecode/BytecodeWriter.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Support/LogicalResult.h" + +/// Include the generated interface declarations. +#include "mlir/Bytecode/BytecodeOpInterface.h.inc" + +#endif // MLIR_BYTECODE_BYTECODEOPINTERFACE_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..93d04e8d16e03c9968f5396c5c9b817e922ef516 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeOpInterface.h.inc @@ -0,0 +1,78 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +class BytecodeOpInterface; +namespace detail { +struct BytecodeOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + LogicalResult (*readProperties)(::mlir::DialectBytecodeReader &, ::mlir::OperationState &); + void (*writeProperties)(const Concept *impl, ::mlir::Operation *, ::mlir::DialectBytecodeWriter &); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::BytecodeOpInterface; + Model() : Concept{readProperties, writeProperties} {} + + static inline LogicalResult readProperties(::mlir::DialectBytecodeReader & reader, ::mlir::OperationState & state); + static inline void writeProperties(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::DialectBytecodeWriter & writer); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::BytecodeOpInterface; + FallbackModel() : Concept{readProperties, writeProperties} {} + + static inline LogicalResult readProperties(::mlir::DialectBytecodeReader & reader, ::mlir::OperationState & state); + static inline void writeProperties(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::DialectBytecodeWriter & writer); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + }; +};template +struct BytecodeOpInterfaceTrait; + +} // namespace detail +class BytecodeOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::BytecodeOpInterfaceTrait {}; + /// Read the properties for this operation from the bytecode and populate the state. + LogicalResult readProperties(::mlir::DialectBytecodeReader & reader, ::mlir::OperationState & state); + /// Write the properties for this operation to the bytecode. + void writeProperties(::mlir::DialectBytecodeWriter & writer); +}; +namespace detail { + template + struct BytecodeOpInterfaceTrait : public ::mlir::OpInterface::Trait { + }; +}// namespace detail +} // namespace mlir +namespace mlir { +template +LogicalResult detail::BytecodeOpInterfaceInterfaceTraits::Model::readProperties(::mlir::DialectBytecodeReader & reader, ::mlir::OperationState & state) { + return ConcreteOp::readProperties(reader, state); +} +template +void detail::BytecodeOpInterfaceInterfaceTraits::Model::writeProperties(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::DialectBytecodeWriter & writer) { + return (llvm::cast(tablegen_opaque_val)).writeProperties(writer); +} +template +LogicalResult detail::BytecodeOpInterfaceInterfaceTraits::FallbackModel::readProperties(::mlir::DialectBytecodeReader & reader, ::mlir::OperationState & state) { + return ConcreteOp::readProperties(reader, state); +} +template +void detail::BytecodeOpInterfaceInterfaceTraits::FallbackModel::writeProperties(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::DialectBytecodeWriter & writer) { + return static_cast(impl)->writeProperties(tablegen_opaque_val, writer); +} +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeReader.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeReader.h new file mode 100644 index 0000000000000000000000000000000000000000..9f26506d486eec6b2346141ce5a5f3dc1d88bf0c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeReader.h @@ -0,0 +1,97 @@ +//===- BytecodeReader.h - MLIR Bytecode Reader ------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header defines interfaces to read MLIR bytecode files/streams. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_BYTECODE_BYTECODEREADER_H +#define MLIR_BYTECODE_BYTECODEREADER_H + +#include "mlir/IR/AsmState.h" +#include "mlir/Support/LLVM.h" +#include "mlir/Support/LogicalResult.h" +#include +#include + +namespace llvm { +class MemoryBufferRef; +class SourceMgr; +} // namespace llvm + +namespace mlir { +/// The BytecodeReader allows to load MLIR bytecode files, while keeping the +/// state explicitly available in order to support lazy loading. +/// The `finalize` method must be called before destruction. +class BytecodeReader { +public: + /// Create a bytecode reader for the given buffer. If `lazyLoad` is true, + /// isolated regions aren't loaded eagerly. + explicit BytecodeReader( + llvm::MemoryBufferRef buffer, const ParserConfig &config, bool lazyLoad, + const std::shared_ptr &bufferOwnerRef = {}); + ~BytecodeReader(); + + /// Read the operations defined within the given memory buffer, containing + /// MLIR bytecode, into the provided block. If the reader was created with + /// `lazyLoad` enabled, isolated regions aren't loaded eagerly. + /// The lazyOps call back is invoked for every ops that can be lazy-loaded. + /// This let the client decide if the op should be materialized + /// immediately or delayed. + LogicalResult readTopLevel( + Block *block, llvm::function_ref lazyOps = + [](Operation *) { return false; }); + + /// Return the number of ops that haven't been materialized yet. + int64_t getNumOpsToMaterialize() const; + + /// Return true if the provided op is materializable. + bool isMaterializable(Operation *op); + + /// Materialize the provide operation. The provided operation must be + /// materializable. + /// The lazyOps call back is invoked for every ops that can be lazy-loaded. + /// This let the client decide if the op should be materialized immediately or + /// delayed. + /// !! Using this materialize withing an IR walk() can be confusing: make sure + /// to use a PreOrder traversal !! + LogicalResult materialize( + Operation *op, llvm::function_ref lazyOpsCallback = + [](Operation *) { return false; }); + + /// Finalize the lazy-loading by calling back with every op that hasn't been + /// materialized to let the client decide if the op should be deleted or + /// materialized. The op is materialized if the callback returns true, deleted + /// otherwise. The implementation of the callback must be thread-safe. + LogicalResult finalize(function_ref shouldMaterialize = + [](Operation *) { return true; }); + + class Impl; + +private: + std::unique_ptr impl; +}; + +/// Returns true if the given buffer starts with the magic bytes that signal +/// MLIR bytecode. +bool isBytecode(llvm::MemoryBufferRef buffer); + +/// Read the operations defined within the given memory buffer, containing MLIR +/// bytecode, into the provided block. +LogicalResult readBytecodeFile(llvm::MemoryBufferRef buffer, Block *block, + const ParserConfig &config); +/// An overload with a source manager whose main file buffer is used for +/// parsing. The lifetime of the source manager may be freely extended during +/// parsing such that the source manager is not destroyed before the parsed IR. +LogicalResult +readBytecodeFile(const std::shared_ptr &sourceMgr, + Block *block, const ParserConfig &config); + +} // namespace mlir + +#endif // MLIR_BYTECODE_BYTECODEREADER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeReaderConfig.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeReaderConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..d623d0da2c0c9004c86e22f641312fa052b3b13b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeReaderConfig.h @@ -0,0 +1,120 @@ +//===- BytecodeReader.h - MLIR Bytecode Reader ------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header defines interfaces to read MLIR bytecode files/streams. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_BYTECODE_BYTECODEREADERCONFIG_H +#define MLIR_BYTECODE_BYTECODEREADERCONFIG_H + +#include "mlir/Support/LLVM.h" +#include "mlir/Support/LogicalResult.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" + +namespace mlir { +class Attribute; +class DialectBytecodeReader; +class Type; + +/// A class to interact with the attributes and types parser when parsing MLIR +/// bytecode. +template +class AttrTypeBytecodeReader { +public: + AttrTypeBytecodeReader() = default; + virtual ~AttrTypeBytecodeReader() = default; + + virtual LogicalResult read(DialectBytecodeReader &reader, + StringRef dialectName, T &entry) = 0; + + /// Return an Attribute/Type printer implemented via the given callable, whose + /// form should match that of the `parse` function above. + template >, + bool> = true> + static std::unique_ptr> + fromCallable(CallableT &&readFn) { + struct Processor : public AttrTypeBytecodeReader { + Processor(CallableT &&readFn) + : AttrTypeBytecodeReader(), readFn(std::move(readFn)) {} + LogicalResult read(DialectBytecodeReader &reader, StringRef dialectName, + T &entry) override { + return readFn(reader, dialectName, entry); + } + + std::decay_t readFn; + }; + return std::make_unique(std::forward(readFn)); + } +}; + +//===----------------------------------------------------------------------===// +// BytecodeReaderConfig +//===----------------------------------------------------------------------===// + +/// A class containing bytecode-specific configurations of the `ParserConfig`. +class BytecodeReaderConfig { +public: + BytecodeReaderConfig() = default; + + /// Returns the callbacks available to the parser. + ArrayRef>> + getAttributeCallbacks() const { + return attributeBytecodeParsers; + } + ArrayRef>> + getTypeCallbacks() const { + return typeBytecodeParsers; + } + + /// Attach a custom bytecode parser callback to the configuration for parsing + /// of custom type/attributes encodings. + void attachAttributeCallback( + std::unique_ptr> parser) { + attributeBytecodeParsers.emplace_back(std::move(parser)); + } + void + attachTypeCallback(std::unique_ptr> parser) { + typeBytecodeParsers.emplace_back(std::move(parser)); + } + + /// Attach a custom bytecode parser callback to the configuration for parsing + /// of custom type/attributes encodings. + template + std::enable_if_t>> + attachAttributeCallback(CallableT &&parserFn) { + attachAttributeCallback(AttrTypeBytecodeReader::fromCallable( + std::forward(parserFn))); + } + template + std::enable_if_t>> + attachTypeCallback(CallableT &&parserFn) { + attachTypeCallback(AttrTypeBytecodeReader::fromCallable( + std::forward(parserFn))); + } + +private: + llvm::SmallVector>> + attributeBytecodeParsers; + llvm::SmallVector>> + typeBytecodeParsers; +}; + +} // namespace mlir + +#endif // MLIR_BYTECODE_BYTECODEREADERCONFIG_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeWriter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeWriter.h new file mode 100644 index 0000000000000000000000000000000000000000..e0c46c3dab27a7b6db94ebc3616b0b1da2e8c737 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/BytecodeWriter.h @@ -0,0 +1,178 @@ +//===- BytecodeWriter.h - MLIR Bytecode Writer ------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header defines interfaces to write MLIR bytecode files/streams. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_BYTECODE_BYTECODEWRITER_H +#define MLIR_BYTECODE_BYTECODEWRITER_H + +#include "mlir/IR/AsmState.h" + +namespace mlir { +class Operation; +class DialectBytecodeWriter; + +/// A class to interact with the attributes and types printer when emitting MLIR +/// bytecode. +template +class AttrTypeBytecodeWriter { +public: + AttrTypeBytecodeWriter() = default; + virtual ~AttrTypeBytecodeWriter() = default; + + /// Callback writer API used in IRNumbering, where groups are created and + /// type/attribute components are numbered. At this stage, writer is expected + /// to be a `NumberingDialectWriter`. + virtual LogicalResult write(T entry, std::optional &name, + DialectBytecodeWriter &writer) = 0; + + /// Callback writer API used in BytecodeWriter, where groups are created and + /// type/attribute components are numbered. Here, DialectBytecodeWriter is + /// expected to be an actual writer. The optional stringref specified by + /// the user is ignored, since the group was already specified when numbering + /// the IR. + LogicalResult write(T entry, DialectBytecodeWriter &writer) { + std::optional dummy; + return write(entry, dummy, writer); + } + + /// Return an Attribute/Type printer implemented via the given callable, whose + /// form should match that of the `write` function above. + template &, + DialectBytecodeWriter &)>>, + bool> = true> + static std::unique_ptr> + fromCallable(CallableT &&writeFn) { + struct Processor : public AttrTypeBytecodeWriter { + Processor(CallableT &&writeFn) + : AttrTypeBytecodeWriter(), writeFn(std::move(writeFn)) {} + LogicalResult write(T entry, std::optional &name, + DialectBytecodeWriter &writer) override { + return writeFn(entry, name, writer); + } + + std::decay_t writeFn; + }; + return std::make_unique(std::forward(writeFn)); + } +}; + +/// This class contains the configuration used for the bytecode writer. It +/// controls various aspects of bytecode generation, and contains all of the +/// various bytecode writer hooks. +class BytecodeWriterConfig { +public: + /// `producer` is an optional string that can be used to identify the producer + /// of the bytecode when reading. It has no functional effect on the bytecode + /// serialization. + BytecodeWriterConfig(StringRef producer = "MLIR" LLVM_VERSION_STRING); + /// `map` is a fallback resource map, which when provided will attach resource + /// printers for the fallback resources within the map. + BytecodeWriterConfig(FallbackAsmResourceMap &map, + StringRef producer = "MLIR" LLVM_VERSION_STRING); + ~BytecodeWriterConfig(); + + /// An internal implementation class that contains the state of the + /// configuration. + struct Impl; + + /// Return an instance of the internal implementation. + const Impl &getImpl() const { return *impl; } + + /// Set the desired bytecode version to emit. This method does not validate + /// the desired version. The bytecode writer entry point will return failure + /// if it cannot emit the desired version. + void setDesiredBytecodeVersion(int64_t bytecodeVersion); + + /// Get the set desired bytecode version to emit. + int64_t getDesiredBytecodeVersion() const; + + //===--------------------------------------------------------------------===// + // Types and Attributes encoding + //===--------------------------------------------------------------------===// + + /// Retrieve the callbacks. + ArrayRef>> + getAttributeWriterCallbacks() const; + ArrayRef>> + getTypeWriterCallbacks() const; + + /// Attach a custom bytecode printer callback to the configuration for the + /// emission of custom type/attributes encodings. + void attachAttributeCallback( + std::unique_ptr> callback); + void + attachTypeCallback(std::unique_ptr> callback); + + /// Attach a custom bytecode printer callback to the configuration for the + /// emission of custom type/attributes encodings. + template + std::enable_if_t &, + DialectBytecodeWriter &)>>> + attachAttributeCallback(CallableT &&emitFn) { + attachAttributeCallback(AttrTypeBytecodeWriter::fromCallable( + std::forward(emitFn))); + } + template + std::enable_if_t &, + DialectBytecodeWriter &)>>> + attachTypeCallback(CallableT &&emitFn) { + attachTypeCallback(AttrTypeBytecodeWriter::fromCallable( + std::forward(emitFn))); + } + + //===--------------------------------------------------------------------===// + // Resources + //===--------------------------------------------------------------------===// + + /// Attach the given resource printer to the writer configuration. + void attachResourcePrinter(std::unique_ptr printer); + + /// Attach an resource printer, in the form of a callable, to the + /// configuration. + template + std::enable_if_t>::value> + attachResourcePrinter(StringRef name, CallableT &&printFn) { + attachResourcePrinter(AsmResourcePrinter::fromCallable( + name, std::forward(printFn))); + } + + /// Attach resource printers to the AsmState for the fallback resources + /// in the given map. + void attachFallbackResourcePrinter(FallbackAsmResourceMap &map) { + for (auto &printer : map.getPrinters()) + attachResourcePrinter(std::move(printer)); + } + +private: + /// A pointer to allocated storage for the impl state. + std::unique_ptr impl; +}; + +//===----------------------------------------------------------------------===// +// Entry Points +//===----------------------------------------------------------------------===// + +/// Write the bytecode for the given operation to the provided output stream. +/// For streams where it matters, the given stream should be in "binary" mode. +/// It only ever fails if setDesiredByteCodeVersion can't be honored. +LogicalResult writeBytecodeToFile(Operation *op, raw_ostream &os, + const BytecodeWriterConfig &config = {}); + +} // namespace mlir + +#endif // MLIR_BYTECODE_BYTECODEWRITER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/Encoding.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/Encoding.h new file mode 100644 index 0000000000000000000000000000000000000000..ac3826929ce7c1c6749c820c573db657642633a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Bytecode/Encoding.h @@ -0,0 +1,141 @@ +//===- Encoding.h - MLIR binary format encoding information -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header defines enum values describing the structure of MLIR bytecode +// files. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_BYTECODE_ENCODING_H +#define MLIR_BYTECODE_ENCODING_H + +#include "mlir/IR/Value.h" +#include +#include + +namespace mlir { +namespace bytecode { +//===----------------------------------------------------------------------===// +// General constants +//===----------------------------------------------------------------------===// + +enum BytecodeVersion { + /// The minimum supported version of the bytecode. + kMinSupportedVersion = 0, + + /// Dialects versioning was added in version 1. + kDialectVersioning = 1, + + /// Support for lazy-loading of isolated region was added in version 2. + kLazyLoading = 2, + + /// Use-list ordering started to be encoded in version 3. + kUseListOrdering = 3, + + /// Avoid recording unknown locations on block arguments (compression) started + /// in version 4. + kElideUnknownBlockArgLocation = 4, + + /// Support for encoding properties natively in bytecode instead of merged + /// with the discardable attributes. + kNativePropertiesEncoding = 5, + + /// ODS emits operand/result segment_size as native properties instead of + /// an attribute. + kNativePropertiesODSSegmentSize = 6, + + /// The current bytecode version. + kVersion = 6, + + /// An arbitrary value used to fill alignment padding. + kAlignmentByte = 0xCB, +}; + +//===----------------------------------------------------------------------===// +// Sections +//===----------------------------------------------------------------------===// + +namespace Section { +enum ID : uint8_t { + /// This section contains strings referenced within the bytecode. + kString = 0, + + /// This section contains the dialects referenced within an IR module. + kDialect = 1, + + /// This section contains the attributes and types referenced within an IR + /// module. + kAttrType = 2, + + /// This section contains the offsets for the attribute and types within the + /// AttrType section. + kAttrTypeOffset = 3, + + /// This section contains the list of operations serialized into the bytecode, + /// and their nested regions/operations. + kIR = 4, + + /// This section contains the resources of the bytecode. + kResource = 5, + + /// This section contains the offsets of resources within the Resource + /// section. + kResourceOffset = 6, + + /// This section contains the versions of each dialect. + kDialectVersions = 7, + + /// This section contains the properties for the operations. + kProperties = 8, + + /// The total number of section types. + kNumSections = 9, +}; +} // namespace Section + +//===----------------------------------------------------------------------===// +// IR Section +//===----------------------------------------------------------------------===// + +/// This enum represents a mask of all of the potential components of an +/// operation. This mask is used when encoding an operation to indicate which +/// components are present in the bytecode. +namespace OpEncodingMask { +enum : uint8_t { + // clang-format off + kHasAttrs = 0b00000001, + kHasResults = 0b00000010, + kHasOperands = 0b00000100, + kHasSuccessors = 0b00001000, + kHasInlineRegions = 0b00010000, + kHasUseListOrders = 0b00100000, + kHasProperties = 0b01000000, + // clang-format on +}; +} // namespace OpEncodingMask + +/// Get the unique ID of a value use. We encode the unique ID combining an owner +/// number and the argument number such as if ownerID(op1) < ownerID(op2), then +/// useID(op1) < useID(op2). If uses have the same owner, then argNumber(op1) < +/// argNumber(op2) implies useID(op1) < useID(op2). +template +static inline uint64_t getUseID(OperandT &val, unsigned ownerID) { + uint32_t operandNumberID; + if constexpr (std::is_same_v) + operandNumberID = val.getOperandNumber(); + else if constexpr (std::is_same_v) + operandNumberID = val.getArgNumber(); + else + llvm_unreachable("unexpected operand type"); + return (static_cast(ownerID) << 32) | operandNumberID; +} + +} // namespace bytecode +} // namespace mlir + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Config/mlir-config.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Config/mlir-config.h new file mode 100644 index 0000000000000000000000000000000000000000..1b1f98ab05f9cd28f379aaa265dfa1a88371d8fb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Config/mlir-config.h @@ -0,0 +1,29 @@ +//===- mlir-config.h - MLIR configuration ------------------------*- C -*-===*// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +/* This file enumerates variables from the MLIR configuration so that they + can be in exported headers and won't override package specific directives. + This is a C header that can be included in the mlir-c headers. */ + +#ifndef MLIR_CONFIG_H +#define MLIR_CONFIG_H + +/* Enable expensive checks to detect invalid pattern API usage. Failed checks + manifest as fatal errors or invalid memory accesses (e.g., accessing + deallocated memory) that cause a crash. Running with ASAN is recommended for + easier debugging. */ +#define MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS 0 + +/* If set, greedy pattern application is randomized: ops on the worklist are + chosen at random. For testing/debugging purposes only. This feature can be + used to ensure that lowering pipelines work correctly regardless of the order + in which ops are processed by the GreedyPatternRewriteDriver. This flag is + numeric seed that is passed to the random number generator. */ +/* #undef MLIR_GREEDY_REWRITE_RANDOMIZER_SEED */ + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h new file mode 100644 index 0000000000000000000000000000000000000000..e445c58fe6c547f7e0037d67f847649302623a72 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h @@ -0,0 +1,35 @@ +//===- AMDGPUToROCDL.h - Convert AMDGPU to ROCDL dialect --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_AMDGPUTOROCDL_AMDGPUTOROCDL_H_ +#define MLIR_CONVERSION_AMDGPUTOROCDL_AMDGPUTOROCDL_H_ + +#include "mlir/Dialect/AMDGPU/Utils/Chipset.h" +#include +#include + +namespace mlir { + +class LLVMTypeConverter; +class RewritePatternSet; +class Pass; + +#define GEN_PASS_DECL_CONVERTAMDGPUTOROCDL +#include "mlir/Conversion/Passes.h.inc" + +/// Note: The ROCDL target does not support the LLVM bfloat type at this time +/// and so this function will add conversions to change all `bfloat` uses +/// to `i16`. +void populateAMDGPUToROCDLConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns, + amdgpu::Chipset chipset); + +std::unique_ptr createConvertAMDGPUToROCDLPass(); + +} // namespace mlir + +#endif // MLIR_CONVERSION_AMDGPUTOROCDL_AMDGPUTOROCDL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h new file mode 100644 index 0000000000000000000000000000000000000000..3850a0088575e7d2b9ea71f45c270ef9514e7326 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h @@ -0,0 +1,55 @@ +//===- AffineToStandard.h - Convert Affine to Standard dialect --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_AFFINETOSTANDARD_AFFINETOSTANDARD_H +#define MLIR_CONVERSION_AFFINETOSTANDARD_AFFINETOSTANDARD_H + +#include "mlir/Support/LLVM.h" + +namespace mlir { +class Location; +struct LogicalResult; +class OpBuilder; +class Pass; +class RewritePattern; +class RewritePatternSet; +class Value; +class ValueRange; + +namespace affine { +class AffineForOp; +} // namespace affine + +#define GEN_PASS_DECL_CONVERTAFFINETOSTANDARD +#include "mlir/Conversion/Passes.h.inc" + +/// Collect a set of patterns to convert from the Affine dialect to the Standard +/// dialect, in particular convert structured affine control flow into CFG +/// branch-based control flow. +void populateAffineToStdConversionPatterns(RewritePatternSet &patterns); + +/// Collect a set of patterns to convert vector-related Affine ops to the Vector +/// dialect. +void populateAffineToVectorConversionPatterns(RewritePatternSet &patterns); + +/// Emit code that computes the lower bound of the given affine loop using +/// standard arithmetic operations. +Value lowerAffineLowerBound(affine::AffineForOp op, OpBuilder &builder); + +/// Emit code that computes the upper bound of the given affine loop using +/// standard arithmetic operations. +Value lowerAffineUpperBound(affine::AffineForOp op, OpBuilder &builder); + +/// Lowers affine control flow operations (ForStmt, IfStmt and AffineApplyOp) +/// to equivalent lower-level constructs (flow of basic blocks and arithmetic +/// primitives). +std::unique_ptr createLowerAffinePass(); + +} // namespace mlir + +#endif // MLIR_CONVERSION_AFFINETOSTANDARD_AFFINETOSTANDARD_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h new file mode 100644 index 0000000000000000000000000000000000000000..eea16b4da6a69002022bf8ff9afe090b5a2d623b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h @@ -0,0 +1,58 @@ +//===- AttrToLLVMConverter.h - Arith attributes conversion ------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_ARITHCOMMON_ATTRTOLLVMCONVERTER_H +#define MLIR_CONVERSION_ARITHCOMMON_ATTRTOLLVMCONVERTER_H + +#include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" + +//===----------------------------------------------------------------------===// +// Support for converting Arith FastMathFlags to LLVM FastmathFlags +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arith { +// Map arithmetic fastmath enum values to LLVMIR enum values. +LLVM::FastmathFlags +convertArithFastMathFlagsToLLVM(arith::FastMathFlags arithFMF); + +// Create an LLVM fastmath attribute from a given arithmetic fastmath attribute. +LLVM::FastmathFlagsAttr +convertArithFastMathAttrToLLVM(arith::FastMathFlagsAttr fmfAttr); + +// Attribute converter that populates a NamedAttrList by removing the fastmath +// attribute from the source operation attributes, and replacing it with an +// equivalent LLVM fastmath attribute. +template +class AttrConvertFastMathToLLVM { +public: + AttrConvertFastMathToLLVM(SourceOp srcOp) { + // Copy the source attributes. + convertedAttr = NamedAttrList{srcOp->getAttrs()}; + // Get the name of the arith fastmath attribute. + llvm::StringRef arithFMFAttrName = SourceOp::getFastMathAttrName(); + // Remove the source fastmath attribute. + auto arithFMFAttr = dyn_cast_or_null( + convertedAttr.erase(arithFMFAttrName)); + if (arithFMFAttr) { + llvm::StringRef targetAttrName = TargetOp::getFastmathAttrName(); + convertedAttr.set(targetAttrName, + convertArithFastMathAttrToLLVM(arithFMFAttr)); + } + } + + ArrayRef getAttrs() const { return convertedAttr.getAttrs(); } + +private: + NamedAttrList convertedAttr; +}; +} // namespace arith +} // namespace mlir + +#endif // MLIR_CONVERSION_ARITHCOMMON_ATTRTOLLVMCONVERTER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h new file mode 100644 index 0000000000000000000000000000000000000000..25b82aed9c968aef55896e5f62e64376fc750dbf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h @@ -0,0 +1,32 @@ +//===- ArithToLLVM.h - Arith to LLVM dialect conversion ----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_ARITHTOLLVM_ARITHTOLLVM_H +#define MLIR_CONVERSION_ARITHTOLLVM_ARITHTOLLVM_H + +#include + +namespace mlir { + +class DialectRegistry; +class LLVMTypeConverter; +class RewritePatternSet; +class Pass; + +#define GEN_PASS_DECL_ARITHTOLLVMCONVERSIONPASS +#include "mlir/Conversion/Passes.h.inc" + +namespace arith { +void populateArithToLLVMConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +void registerConvertArithToLLVMInterface(DialectRegistry ®istry); +} // namespace arith +} // namespace mlir + +#endif // MLIR_CONVERSION_ARITHTOLLVM_ARITHTOLLVM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h new file mode 100644 index 0000000000000000000000000000000000000000..60441f9faaa60e6fd0e91cb76fa5ac2e1590bd28 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h @@ -0,0 +1,39 @@ +//===- AsyncToLLVM.h - Convert Async to LLVM dialect ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_ASYNCTOLLVM_ASYNCTOLLVM_H +#define MLIR_CONVERSION_ASYNCTOLLVM_ASYNCTOLLVM_H + +#include + +namespace mlir { + +class ConversionTarget; +class Pass; +class MLIRContext; +class TypeConverter; +class RewritePatternSet; + +#define GEN_PASS_DECL_CONVERTASYNCTOLLVMPASS +#include "mlir/Conversion/Passes.h.inc" + +/// Populates patterns for async structural type conversions. +/// +/// A "structural" type conversion is one where the underlying ops are +/// completely agnostic to the actual types involved and simply need to update +/// their types. An example of this is async.execute -- the async.execute op and +/// the corresponding async.yield ops need to update their types accordingly to +/// the TypeConverter, but otherwise don't care what type conversions are +/// happening. +void populateAsyncStructuralTypeConversionsAndLegality( + TypeConverter &typeConverter, RewritePatternSet &patterns, + ConversionTarget &target); + +} // namespace mlir + +#endif // MLIR_CONVERSION_ASYNCTOLLVM_ASYNCTOLLVM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h new file mode 100644 index 0000000000000000000000000000000000000000..c7146239f34b18d51648c716ad1977a5be346c6b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h @@ -0,0 +1,24 @@ +//===- BufferizationToMemRef.h - Bufferization to MemRef conversion -------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_BUFFERIZATIONTOMEMREF_BUFFERIZATIONTOMEMREF_H +#define MLIR_CONVERSION_BUFFERIZATIONTOMEMREF_BUFFERIZATIONTOMEMREF_H + +#include "mlir/Pass/Pass.h" +#include + +namespace mlir { +class ModuleOp; + +#define GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREF +#include "mlir/Conversion/Passes.h.inc" + +std::unique_ptr createBufferizationToMemRefPass(); +} // namespace mlir + +#endif // MLIR_CONVERSION_BUFFERIZATIONTOMEMREF_BUFFERIZATIONTOMEMREF_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h new file mode 100644 index 0000000000000000000000000000000000000000..69b01b471dd984ffa22538b1d5902566f60e7f06 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h @@ -0,0 +1,49 @@ +//===- ComplexToLLVM.h - Utils to convert from the complex dialect --------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_COMPLEXTOLLVM_COMPLEXTOLLVM_H_ +#define MLIR_CONVERSION_COMPLEXTOLLVM_COMPLEXTOLLVM_H_ + +#include "mlir/Conversion/LLVMCommon/StructBuilder.h" + +namespace mlir { +class DialectRegistry; +class LLVMTypeConverter; +class Pass; +class RewritePatternSet; + +#define GEN_PASS_DECL_CONVERTCOMPLEXTOLLVMPASS +#include "mlir/Conversion/Passes.h.inc" + +class ComplexStructBuilder : public StructBuilder { +public: + /// Construct a helper for the given complex number value. + using StructBuilder::StructBuilder; + /// Build IR creating an `undef` value of the complex number type. + static ComplexStructBuilder undef(OpBuilder &builder, Location loc, + Type type); + + // Build IR extracting the real value from the complex number struct. + Value real(OpBuilder &builder, Location loc); + // Build IR inserting the real value into the complex number struct. + void setReal(OpBuilder &builder, Location loc, Value real); + + // Build IR extracting the imaginary value from the complex number struct. + Value imaginary(OpBuilder &builder, Location loc); + // Build IR inserting the imaginary value into the complex number struct. + void setImaginary(OpBuilder &builder, Location loc, Value imaginary); +}; + +/// Populate the given list with patterns that convert from Complex to LLVM. +void populateComplexToLLVMConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +void registerConvertComplexToLLVMInterface(DialectRegistry ®istry); + +} // namespace mlir + +#endif // MLIR_CONVERSION_COMPLEXTOLLVM_COMPLEXTOLLVM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h new file mode 100644 index 0000000000000000000000000000000000000000..39c4a1ae54617b00b0db8bb9eaf4746ed455e45c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h @@ -0,0 +1,28 @@ +//===- ComplexToStandard.h - Utils to convert from the complex dialect ----===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_COMPLEXTOSTANDARD_COMPLEXTOSTANDARD_H_ +#define MLIR_CONVERSION_COMPLEXTOSTANDARD_COMPLEXTOSTANDARD_H_ + +#include + +namespace mlir { +class RewritePatternSet; +class Pass; + +#define GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARD +#include "mlir/Conversion/Passes.h.inc" + +/// Populate the given list with patterns that convert from Complex to Standard. +void populateComplexToStandardConversionPatterns(RewritePatternSet &patterns); + +/// Create a pass to convert Complex operations to the Standard dialect. +std::unique_ptr createConvertComplexToStandardPass(); + +} // namespace mlir + +#endif // MLIR_CONVERSION_COMPLEXTOSTANDARD_COMPLEXTOSTANDARD_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h new file mode 100644 index 0000000000000000000000000000000000000000..35b691b8bc44b5217fa756d082387611862051e7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h @@ -0,0 +1,47 @@ +//===- ControlFlowToLLVM.h - ControlFlow to LLVM -----------*- C++ ------*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Define conversions from the ControlFlow dialect to the LLVM IR dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_CONTROLFLOWTOLLVM_CONTROLFLOWTOLLVM_H +#define MLIR_CONVERSION_CONTROLFLOWTOLLVM_CONTROLFLOWTOLLVM_H + +#include + +namespace mlir { +class DialectRegistry; +class LLVMTypeConverter; +class RewritePatternSet; +class Pass; + +#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVMPASS +#include "mlir/Conversion/Passes.h.inc" + +namespace cf { + +/// Collect the patterns to convert from the ControlFlow dialect to LLVM. The +/// conversion patterns capture the LLVMTypeConverter by reference meaning the +/// references have to remain alive during the entire pattern lifetime. +void populateControlFlowToLLVMConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +/// Populate the cf.assert to LLVM conversion pattern. If `abortOnFailure` is +/// set to false, the program execution continues when a condition is +/// unsatisfied. +void populateAssertToLLVMConversionPattern(LLVMTypeConverter &converter, + RewritePatternSet &patterns, + bool abortOnFailure = true); + +void registerConvertControlFlowToLLVMInterface(DialectRegistry ®istry); + +} // namespace cf +} // namespace mlir + +#endif // MLIR_CONVERSION_CONTROLFLOWTOLLVM_CONTROLFLOWTOLLVM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..424ab38a13b24dba8a5fee1422d01b35814834ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h @@ -0,0 +1,56 @@ +//===- ToLLVMInterface.h - Conversion to LLVM iface ---*- C++ -*-=============// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_CONVERTTOLLVM_TOLLVMINTERFACE_H +#define MLIR_CONVERSION_CONVERTTOLLVM_TOLLVMINTERFACE_H + +#include "mlir/IR/DialectInterface.h" +#include "mlir/IR/MLIRContext.h" +#include "mlir/Support/LogicalResult.h" + +namespace mlir { +class ConversionTarget; +class LLVMTypeConverter; +class MLIRContext; +class Operation; +class RewritePatternSet; + +/// Base class for dialect interfaces providing translation to LLVM IR. +/// Dialects that can be translated should provide an implementation of this +/// interface for the supported operations. The interface may be implemented in +/// a separate library to avoid the "main" dialect library depending on LLVM IR. +/// The interface can be attached using the delayed registration mechanism +/// available in DialectRegistry. +class ConvertToLLVMPatternInterface + : public DialectInterface::Base { +public: + ConvertToLLVMPatternInterface(Dialect *dialect) : Base(dialect) {} + + /// Hook for derived dialect interface to load the dialects they + /// target. The LLVMDialect is implicitly already loaded, but this + /// method allows to load other intermediate dialects used in the + /// conversion, or target dialects like NVVM for example. + virtual void loadDependentDialects(MLIRContext *context) const {} + + /// Hook for derived dialect interface to provide conversion patterns + /// and mark dialect legal for the conversion target. + virtual void populateConvertToLLVMConversionPatterns( + ConversionTarget &target, LLVMTypeConverter &typeConverter, + RewritePatternSet &patterns) const = 0; +}; + +/// Recursively walk the IR and collect all dialects implementing the interface, +/// and populate the conversion patterns. +void populateConversionTargetFromOperation(Operation *op, + ConversionTarget &target, + LLVMTypeConverter &typeConverter, + RewritePatternSet &patterns); + +} // namespace mlir + +#endif // MLIR_CONVERSION_CONVERTTOLLVM_TOLLVMINTERFACE_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMPass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMPass.h new file mode 100644 index 0000000000000000000000000000000000000000..2eddf52d7abc5204d559791a491e20c6a2ad5167 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMPass.h @@ -0,0 +1,27 @@ +//===- ToLLVMPass.h - Conversion to LLVM pass ---*- C++ -*-===================// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_CONVERTTOLLVM_TOLLVM_PASS_H +#define MLIR_CONVERSION_CONVERTTOLLVM_TOLLVM_PASS_H + +#include + +#include "mlir/Pass/Pass.h" + +#define GEN_PASS_DECL_CONVERTTOLLVMPASS +#include "mlir/Conversion/Passes.h.inc" + +namespace mlir { + +/// Create a pass that performs dialect conversion to LLVM for all dialects +/// implementing `ConvertToLLVMPatternInterface`. +std::unique_ptr createConvertToLLVMPass(); + +} // namespace mlir + +#endif // MLIR_CONVERSION_CONVERTTOLLVM_TOLLVM_PASS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h new file mode 100644 index 0000000000000000000000000000000000000000..21bd191aa9dc8c3505fb7a2a364d5c1bbb0383a1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h @@ -0,0 +1,52 @@ +//===- ConvertFuncToLLVM.h - Convert Func to LLVM ---------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Provides a set of conversion patterns from the Func dialect to the LLVM IR +// dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVM_H +#define MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVM_H + +namespace mlir { + +class DialectRegistry; +class LLVMTypeConverter; +class RewritePatternSet; +class SymbolTable; + +/// Collect the default pattern to convert a FuncOp to the LLVM dialect. If +/// `emitCWrappers` is set, the pattern will also produce functions +/// that pass memref descriptors by pointer-to-structure in addition to the +/// default unpacked form. +void populateFuncToLLVMFuncOpConversionPattern(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +/// Collect the patterns to convert from the Func dialect to LLVM. The +/// conversion patterns capture the LLVMTypeConverter and the LowerToLLVMOptions +/// by reference meaning the references have to remain alive during the entire +/// pattern lifetime. +/// +/// The `symbolTable` parameter can be used to speed up function lookups in the +/// module. It's good to provide it, but only if we know that the patterns will +/// be applied to a single module and the symbols referenced by the symbol table +/// will not be removed and new symbols will not be added during the usage of +/// the patterns. If provided, the lookups will have O(calls) cumulative +/// runtime, otherwise O(calls * functions). The symbol table is currently not +/// needed if `converter.getOptions().useBarePtrCallConv` is `true`, but it's +/// not an error to provide it anyway. +void populateFuncToLLVMConversionPatterns( + LLVMTypeConverter &converter, RewritePatternSet &patterns, + const SymbolTable *symbolTable = nullptr); + +void registerConvertFuncToLLVMInterface(DialectRegistry ®istry); + +} // namespace mlir + +#endif // MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h new file mode 100644 index 0000000000000000000000000000000000000000..07a3d9668e6283dd6ae9adf43ed1ad1486162334 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h @@ -0,0 +1,24 @@ +//===- ConvertFuncToLLVMPass.h - Pass entrypoint ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVMPASS_H_ +#define MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVMPASS_H_ + +#include +#include + +namespace mlir { +class Pass; + +#define GEN_PASS_DECL_CONVERTFUNCTOLLVMPASS +#define GEN_PASS_DECL_SETLLVMMODULEDATALAYOUTPASS +#include "mlir/Conversion/Passes.h.inc" + +} // namespace mlir + +#endif // MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVMPASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h new file mode 100644 index 0000000000000000000000000000000000000000..48b7835ae5fca648a0e18f7b3f4a661d1a9bfa63 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h @@ -0,0 +1,83 @@ +//===- GPUCommonPass.h - MLIR GPU runtime support -------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_GPUCOMMON_GPUCOMMONPASS_H_ +#define MLIR_CONVERSION_GPUCOMMON_GPUCOMMONPASS_H_ + +#include "mlir/Dialect/GPU/Transforms/Utils.h" +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/Types.h" +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/StringRef.h" +#include +#include + +namespace llvm { +class LLVMContext; +class Module; +} // namespace llvm + +namespace mlir { + +class LLVMTypeConverter; +class Location; +struct LogicalResult; +class ModuleOp; +class Operation; +class RewritePatternSet; +class TypeConverter; + +class Pass; + +namespace gpu { +enum class AddressSpace : uint32_t; +class GPUModuleOp; +} // namespace gpu + +namespace LLVM { +class LLVMDialect; +} // namespace LLVM + +#define GEN_PASS_DECL_GPUTOLLVMCONVERSIONPASS +#include "mlir/Conversion/Passes.h.inc" + +using OwnedBlob = std::unique_ptr>; +using BlobGenerator = + std::function; +using LoweringCallback = std::function( + Operation *, llvm::LLVMContext &, StringRef)>; + +struct FunctionCallBuilder { + FunctionCallBuilder(StringRef functionName, Type returnType, + ArrayRef argumentTypes) + : functionName(functionName), + functionType(LLVM::LLVMFunctionType::get(returnType, argumentTypes)) {} + LLVM::CallOp create(Location loc, OpBuilder &builder, + ArrayRef arguments) const; + + StringRef functionName; + LLVM::LLVMFunctionType functionType; +}; + +/// Collect a set of patterns to convert from the GPU dialect to LLVM and +/// populate converter for gpu types. +void populateGpuToLLVMConversionPatterns( + LLVMTypeConverter &converter, RewritePatternSet &patterns, + StringRef gpuBinaryAnnotation = {}, bool kernelBarePtrCallConv = false, + SymbolTable *cachedModuleTable = nullptr); + +/// A function that maps a MemorySpace enum to a target-specific integer value. +using MemorySpaceMapping = std::function; + +/// Populates memory space attribute conversion rules for lowering +/// gpu.address_space to integer values. +void populateGpuMemorySpaceAttributeConversions( + TypeConverter &typeConverter, const MemorySpaceMapping &mapping); +} // namespace mlir + +#endif // MLIR_CONVERSION_GPUCOMMON_GPUCOMMONPASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h new file mode 100644 index 0000000000000000000000000000000000000000..e0f4c71051e506a79c22776cf14a3815e8e93393 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h @@ -0,0 +1,48 @@ +//===- GPUToNVVMPass.h - Convert GPU kernel to NVVM dialect -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_GPUTONVVM_GPUTONVVMPASS_H_ +#define MLIR_CONVERSION_GPUTONVVM_GPUTONVVMPASS_H_ + +#include "mlir/Conversion/LLVMCommon/LoweringOptions.h" +#include "mlir/Dialect/LLVMIR/LLVMTypes.h" +#include + +namespace mlir { +class LLVMTypeConverter; +class ConversionTarget; +class RewritePatternSet; +class Pass; + +namespace gpu { +class GPUModuleOp; +class MMAMatrixType; +} // namespace gpu + +#define GEN_PASS_DECL_CONVERTGPUOPSTONVVMOPS +#include "mlir/Conversion/Passes.h.inc" + +LLVM::LLVMStructType convertMMAToLLVMType(gpu::MMAMatrixType type); + +/// Configure target to convert from the GPU dialect to NVVM. +void configureGpuToNVVMConversionLegality(ConversionTarget &target); + +/// Collect a set of patterns to convert from the GPU dialect to NVVM. +void populateGpuToNVVMConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +/// Populate GpuSubgroupReduce pattern to NVVM. It generates a specific nvvm +/// op that is not available on every GPU. +void populateGpuSubgroupReduceOpLoweringPattern(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +/// Collect a set of patterns to convert WMMA ops from GPU dialect to NVVM. +void populateGpuWMMAToNVVMConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); +} // namespace mlir + +#endif // MLIR_CONVERSION_GPUTONVVM_GPUTONVVMPASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h new file mode 100644 index 0000000000000000000000000000000000000000..5647787712997b5b45c3995fad96c75a9682b72b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h @@ -0,0 +1,52 @@ +//===- GPUToROCDLPass.h - Convert GPU kernel to ROCDL dialect ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_GPUTOROCDL_GPUTOROCDLPASS_H_ +#define MLIR_CONVERSION_GPUTOROCDL_GPUTOROCDLPASS_H_ + +#include "mlir/Conversion/GPUToROCDL/Runtimes.h" +#include "mlir/Conversion/LLVMCommon/LoweringOptions.h" +#include + +namespace mlir { +class LLVMTypeConverter; +class ConversionTarget; +class RewritePatternSet; + +template +class OperationPass; + +namespace gpu { +class GPUModuleOp; +} // namespace gpu + +#define GEN_PASS_DECL_CONVERTGPUOPSTOROCDLOPS +#include "mlir/Conversion/Passes.h.inc" + +/// Collect a set of patterns to convert from the GPU dialect to ROCDL. +/// If `runtime` is Unknown, gpu.printf will not be lowered +/// The resulting pattern set should be run over a gpu.module op +void populateGpuToROCDLConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns, + gpu::amd::Runtime runtime); + +/// Configure target to convert from the GPU dialect to ROCDL. +void configureGpuToROCDLConversionLegality(ConversionTarget &target); + +/// Creates a pass that lowers GPU dialect operations to ROCDL counterparts. The +/// index bitwidth used for the lowering of the device side index computations +/// is configurable. +std::unique_ptr> +createLowerGpuOpsToROCDLOpsPass( + const std::string &chipset = "gfx900", + unsigned indexBitwidth = kDeriveIndexBitwidthFromDataLayout, + bool useBarePtrCallConv = false, + gpu::amd::Runtime runtime = gpu::amd::Runtime::Unknown); + +} // namespace mlir + +#endif // MLIR_CONVERSION_GPUTOROCDL_GPUTOROCDLPASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUToROCDL/Runtimes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUToROCDL/Runtimes.h new file mode 100644 index 0000000000000000000000000000000000000000..da47d4cf97e7ec1a62365174f4a3544f8fe5a2c8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/GPUToROCDL/Runtimes.h @@ -0,0 +1,24 @@ +//===- Runtimes.h - Possible runtimes for AMD GPUs ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_GPUTOROCDL_RUNTIMES_H +#define MLIR_CONVERSION_GPUTOROCDL_RUNTIMES_H + +namespace mlir { +namespace gpu { +namespace amd { +/// Potential runtimes for AMD GPU kernels +enum Runtime { + Unknown = 0, + HIP = 1, + OpenCL = 2, +}; +} // end namespace amd +} // end namespace gpu +} // end namespace mlir + +#endif // MLIR_CONVERSION_GPUTOROCDL_RUNTIMES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h new file mode 100644 index 0000000000000000000000000000000000000000..df605adae669be774896de9790f32761eeb7a869 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h @@ -0,0 +1,32 @@ +//===- IndexToLLVM.h - Index to LLVM dialect conversion ---------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_INDEXTOLLVM_INDEXTOLLVM_H +#define MLIR_CONVERSION_INDEXTOLLVM_INDEXTOLLVM_H + +#include + +namespace mlir { +class DialectRegistry; +class LLVMTypeConverter; +class RewritePatternSet; +class Pass; + +#define GEN_PASS_DECL_CONVERTINDEXTOLLVMPASS +#include "mlir/Conversion/Passes.h.inc" + +namespace index { +void populateIndexToLLVMConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +void registerConvertIndexToLLVMInterface(DialectRegistry ®istry); + +} // namespace index +} // namespace mlir + +#endif // MLIR_CONVERSION_INDEXTOLLVM_INDEXTOLLVM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/ConversionTarget.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/ConversionTarget.h new file mode 100644 index 0000000000000000000000000000000000000000..facd9f4e7e4e6051486f21df7a175f81666cdf6e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/ConversionTarget.h @@ -0,0 +1,23 @@ +//===- ConversionTarget.h - LLVM dialect conversion target ------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_LLVMCOMMON_CONVERSIONTARGET_H +#define MLIR_CONVERSION_LLVMCOMMON_CONVERSIONTARGET_H + +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { +/// Derived class that automatically populates legalization information for +/// different LLVM ops. +class LLVMConversionTarget : public ConversionTarget { +public: + explicit LLVMConversionTarget(MLIRContext &ctx); +}; +} // namespace mlir + +#endif // MLIR_CONVERSION_LLVMCOMMON_CONVERSIONTARGET_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h new file mode 100644 index 0000000000000000000000000000000000000000..cc4e17e9527f01e141baba4cb8f8953a8347d4a8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h @@ -0,0 +1,75 @@ +//===- LoweringOptions.h - Common config for lowering to LLVM ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Provides a configuration shared by several conversions targeting the LLVM +// dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_LLVMCOMMON_LOWERINGOPTIONS_H +#define MLIR_CONVERSION_LLVMCOMMON_LOWERINGOPTIONS_H + +#include "llvm/IR/DataLayout.h" + +namespace mlir { + +class DataLayout; +class MLIRContext; + +/// Value to pass as bitwidth for the index type when the converter is expected +/// to derive the bitwidth from the LLVM data layout. +static constexpr unsigned kDeriveIndexBitwidthFromDataLayout = 0; + +/// Options to control the LLVM lowering. The struct is used to share lowering +/// options between passes, patterns, and type converter. +class LowerToLLVMOptions { +public: + explicit LowerToLLVMOptions(MLIRContext *ctx); + LowerToLLVMOptions(MLIRContext *ctx, const DataLayout &dl); + + bool useBarePtrCallConv = false; + bool useOpaquePointers = true; + + enum class AllocLowering { + /// Use malloc for heap allocations. + Malloc, + + /// Use aligned_alloc for heap allocations. + AlignedAlloc, + + /// Do not lower heap allocations. Users must provide their own patterns for + /// AllocOp and DeallocOp lowering. + None + }; + + AllocLowering allocLowering = AllocLowering::Malloc; + + bool useGenericFunctions = false; + + /// The data layout of the module to produce. This must be consistent with the + /// data layout used in the upper levels of the lowering pipeline. + // TODO: this should be replaced by MLIR data layout when one exists. + llvm::DataLayout dataLayout = llvm::DataLayout(""); + + /// Set the index bitwidth to the given value. + void overrideIndexBitwidth(unsigned bitwidth) { + assert(bitwidth != kDeriveIndexBitwidthFromDataLayout && + "can only override to a concrete bitwidth"); + indexBitwidth = bitwidth; + } + + /// Get the index bitwidth. + unsigned getIndexBitwidth() const { return indexBitwidth; } + +private: + unsigned indexBitwidth; +}; + +} // namespace mlir + +#endif // MLIR_CONVERSION_LLVMCOMMON_LOWERINGOPTIONS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/MemRefBuilder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/MemRefBuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..ef8215d332c463cc86066cbc14d80c496d22938f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/MemRefBuilder.h @@ -0,0 +1,278 @@ +//===- MemRefBuilder.h - Helper for LLVM MemRef equivalents -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Provides a convenience API for emitting IR that inspects or constructs values +// of LLVM dialect structure type that correspond to ranked or unranked memref. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_LLVMCOMMON_MEMREFBUILDER_H +#define MLIR_CONVERSION_LLVMCOMMON_MEMREFBUILDER_H + +#include "mlir/Conversion/LLVMCommon/StructBuilder.h" +#include "mlir/IR/OperationSupport.h" + +namespace mlir { + +class LLVMTypeConverter; +class MemRefType; +class UnrankedMemRefType; + +namespace LLVM { +class LLVMPointerType; +} // namespace LLVM + +/// Helper class to produce LLVM dialect operations extracting or inserting +/// elements of a MemRef descriptor. Wraps a Value pointing to the descriptor. +/// The Value may be null, in which case none of the operations are valid. +class MemRefDescriptor : public StructBuilder { +public: + /// Construct a helper for the given descriptor value. + explicit MemRefDescriptor(Value descriptor); + /// Builds IR creating an `undef` value of the descriptor type. + static MemRefDescriptor undef(OpBuilder &builder, Location loc, + Type descriptorType); + /// Builds IR creating a MemRef descriptor that represents `type` and + /// populates it with static shape and stride information extracted from the + /// type. + static MemRefDescriptor + fromStaticShape(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, MemRefType type, + Value memory); + static MemRefDescriptor + fromStaticShape(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, MemRefType type, + Value memory, Value alignedMemory); + + /// Builds IR extracting the allocated pointer from the descriptor. + Value allocatedPtr(OpBuilder &builder, Location loc); + /// Builds IR inserting the allocated pointer into the descriptor. + void setAllocatedPtr(OpBuilder &builder, Location loc, Value ptr); + + /// Builds IR extracting the aligned pointer from the descriptor. + Value alignedPtr(OpBuilder &builder, Location loc); + + /// Builds IR inserting the aligned pointer into the descriptor. + void setAlignedPtr(OpBuilder &builder, Location loc, Value ptr); + + /// Builds IR extracting the offset from the descriptor. + Value offset(OpBuilder &builder, Location loc); + + /// Builds IR inserting the offset into the descriptor. + void setOffset(OpBuilder &builder, Location loc, Value offset); + void setConstantOffset(OpBuilder &builder, Location loc, uint64_t offset); + + /// Builds IR extracting the pos-th size from the descriptor. + Value size(OpBuilder &builder, Location loc, unsigned pos); + Value size(OpBuilder &builder, Location loc, Value pos, int64_t rank); + + /// Builds IR inserting the pos-th size into the descriptor + void setSize(OpBuilder &builder, Location loc, unsigned pos, Value size); + void setConstantSize(OpBuilder &builder, Location loc, unsigned pos, + uint64_t size); + + /// Builds IR extracting the pos-th size from the descriptor. + Value stride(OpBuilder &builder, Location loc, unsigned pos); + + /// Builds IR inserting the pos-th stride into the descriptor + void setStride(OpBuilder &builder, Location loc, unsigned pos, Value stride); + void setConstantStride(OpBuilder &builder, Location loc, unsigned pos, + uint64_t stride); + + /// Returns the type of array element in this descriptor. + Type getIndexType() { return indexType; }; + + /// Returns the (LLVM) pointer type this descriptor contains. + LLVM::LLVMPointerType getElementPtrType(); + + /// Builds IR for getting the start address of the buffer represented + /// by this memref: + /// `memref.alignedPtr + memref.offset * sizeof(type.getElementType())`. + /// \note there is no setter for this one since it is derived from alignedPtr + /// and offset. + Value bufferPtr(OpBuilder &builder, Location loc, + const LLVMTypeConverter &converter, MemRefType type); + + /// Builds IR populating a MemRef descriptor structure from a list of + /// individual values composing that descriptor, in the following order: + /// - allocated pointer; + /// - aligned pointer; + /// - offset; + /// - sizes; + /// - shapes; + /// where is the MemRef rank as provided in `type`. + static Value pack(OpBuilder &builder, Location loc, + const LLVMTypeConverter &converter, MemRefType type, + ValueRange values); + + /// Builds IR extracting individual elements of a MemRef descriptor structure + /// and returning them as `results` list. + static void unpack(OpBuilder &builder, Location loc, Value packed, + MemRefType type, SmallVectorImpl &results); + + /// Returns the number of non-aggregate values that would be produced by + /// `unpack`. + static unsigned getNumUnpackedValues(MemRefType type); + +private: + bool useOpaquePointers(); + + // Cached index type. + Type indexType; +}; + +/// Helper class allowing the user to access a range of Values that correspond +/// to an unpacked memref descriptor using named accessors. This does not own +/// the values. +class MemRefDescriptorView { +public: + /// Constructs the view from a range of values. Infers the rank from the size + /// of the range. + explicit MemRefDescriptorView(ValueRange range); + + /// Returns the allocated pointer Value. + Value allocatedPtr(); + + /// Returns the aligned pointer Value. + Value alignedPtr(); + + /// Returns the offset Value. + Value offset(); + + /// Returns the pos-th size Value. + Value size(unsigned pos); + + /// Returns the pos-th stride Value. + Value stride(unsigned pos); + +private: + /// Rank of the memref the descriptor is pointing to. + int rank; + /// Underlying range of Values. + ValueRange elements; +}; + +class UnrankedMemRefDescriptor : public StructBuilder { +public: + /// Construct a helper for the given descriptor value. + explicit UnrankedMemRefDescriptor(Value descriptor); + /// Builds IR creating an `undef` value of the descriptor type. + static UnrankedMemRefDescriptor undef(OpBuilder &builder, Location loc, + Type descriptorType); + + /// Builds IR extracting the rank from the descriptor + Value rank(OpBuilder &builder, Location loc) const; + /// Builds IR setting the rank in the descriptor + void setRank(OpBuilder &builder, Location loc, Value value); + /// Builds IR extracting ranked memref descriptor ptr + Value memRefDescPtr(OpBuilder &builder, Location loc) const; + /// Builds IR setting ranked memref descriptor ptr + void setMemRefDescPtr(OpBuilder &builder, Location loc, Value value); + + /// Builds IR populating an unranked MemRef descriptor structure from a list + /// of individual constituent values in the following order: + /// - rank of the memref; + /// - pointer to the memref descriptor. + static Value pack(OpBuilder &builder, Location loc, + const LLVMTypeConverter &converter, UnrankedMemRefType type, + ValueRange values); + + /// Builds IR extracting individual elements that compose an unranked memref + /// descriptor and returns them as `results` list. + static void unpack(OpBuilder &builder, Location loc, Value packed, + SmallVectorImpl &results); + + /// Returns the number of non-aggregate values that would be produced by + /// `unpack`. + static unsigned getNumUnpackedValues() { return 2; } + + /// Builds IR computing the sizes in bytes (suitable for opaque allocation) + /// and appends the corresponding values into `sizes`. `addressSpaces` + /// which must have the same length as `values`, is needed to handle layouts + /// where sizeof(ptr addrspace(N)) != sizeof(ptr addrspace(0)). + static void computeSizes(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + ArrayRef values, + ArrayRef addressSpaces, + SmallVectorImpl &sizes); + + /// TODO: The following accessors don't take alignment rules between elements + /// of the descriptor struct into account. For some architectures, it might be + /// necessary to extend them and to use `llvm::DataLayout` contained in + /// `LLVMTypeConverter`. + + /// Builds IR extracting the allocated pointer from the descriptor. + static Value allocatedPtr(OpBuilder &builder, Location loc, + Value memRefDescPtr, + LLVM::LLVMPointerType elemPtrType); + /// Builds IR inserting the allocated pointer into the descriptor. + static void setAllocatedPtr(OpBuilder &builder, Location loc, + Value memRefDescPtr, + LLVM::LLVMPointerType elemPtrType, + Value allocatedPtr); + + /// Builds IR extracting the aligned pointer from the descriptor. + static Value alignedPtr(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + Value memRefDescPtr, + LLVM::LLVMPointerType elemPtrType); + /// Builds IR inserting the aligned pointer into the descriptor. + static void setAlignedPtr(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + Value memRefDescPtr, + LLVM::LLVMPointerType elemPtrType, + Value alignedPtr); + + /// Builds IR for getting the pointer to the offset's location. + /// Returns a pointer to a convertType(index), which points to the beggining + /// of a struct {index, index[rank], index[rank]}. + static Value offsetBasePtr(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + Value memRefDescPtr, + LLVM::LLVMPointerType elemPtrType); + /// Builds IR extracting the offset from the descriptor. + static Value offset(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType); + /// Builds IR inserting the offset into the descriptor. + static void setOffset(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType, + Value offset); + + /// Builds IR extracting the pointer to the first element of the size array. + static Value sizeBasePtr(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + Value memRefDescPtr, + LLVM::LLVMPointerType elemPtrType); + /// Builds IR extracting the size[index] from the descriptor. + static Value size(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, Value sizeBasePtr, + Value index); + /// Builds IR inserting the size[index] into the descriptor. + static void setSize(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, Value sizeBasePtr, + Value index, Value size); + + /// Builds IR extracting the pointer to the first element of the stride array. + static Value strideBasePtr(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + Value sizeBasePtr, Value rank); + /// Builds IR extracting the stride[index] from the descriptor. + static Value stride(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + Value strideBasePtr, Value index, Value stride); + /// Builds IR inserting the stride[index] into the descriptor. + static void setStride(OpBuilder &builder, Location loc, + const LLVMTypeConverter &typeConverter, + Value strideBasePtr, Value index, Value stride); +}; + +} // namespace mlir + +#endif // MLIR_CONVERSION_LLVMCOMMON_MEMREFBUILDER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h new file mode 100644 index 0000000000000000000000000000000000000000..aea6c38a441d3a504ec894e5502af435e6a36903 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h @@ -0,0 +1,212 @@ +//===- Pattern.h - Pattern for conversion to the LLVM dialect ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_LLVMCOMMON_PATTERN_H +#define MLIR_CONVERSION_LLVMCOMMON_PATTERN_H + +#include "mlir/Conversion/LLVMCommon/MemRefBuilder.h" +#include "mlir/Conversion/LLVMCommon/TypeConverter.h" +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { +class CallOpInterface; + +namespace LLVM { +namespace detail { +/// Replaces the given operation "op" with a new operation of type "targetOp" +/// and given operands. +LogicalResult oneToOneRewrite(Operation *op, StringRef targetOp, + ValueRange operands, + ArrayRef targetAttrs, + const LLVMTypeConverter &typeConverter, + ConversionPatternRewriter &rewriter); + +} // namespace detail +} // namespace LLVM + +/// Base class for operation conversions targeting the LLVM IR dialect. It +/// provides the conversion patterns with access to the LLVMTypeConverter and +/// the LowerToLLVMOptions. The class captures the LLVMTypeConverter and the +/// LowerToLLVMOptions by reference meaning the references have to remain alive +/// during the entire pattern lifetime. +class ConvertToLLVMPattern : public ConversionPattern { +public: + ConvertToLLVMPattern(StringRef rootOpName, MLIRContext *context, + const LLVMTypeConverter &typeConverter, + PatternBenefit benefit = 1); + +protected: + /// Returns the LLVM dialect. + LLVM::LLVMDialect &getDialect() const; + + const LLVMTypeConverter *getTypeConverter() const; + + /// Gets the MLIR type wrapping the LLVM integer type whose bit width is + /// defined by the used type converter. + Type getIndexType() const; + + /// Gets the MLIR type wrapping the LLVM integer type whose bit width + /// corresponds to that of a LLVM pointer type. + Type getIntPtrType(unsigned addressSpace = 0) const; + + /// Gets the MLIR type wrapping the LLVM void type. + Type getVoidType() const; + + /// Get the MLIR type wrapping the LLVM i8* type. + Type getVoidPtrType() const; + + /// Create a constant Op producing a value of `resultType` from an index-typed + /// integer attribute. + static Value createIndexAttrConstant(OpBuilder &builder, Location loc, + Type resultType, int64_t value); + + // This is a strided getElementPtr variant that linearizes subscripts as: + // `base_offset + index_0 * stride_0 + ... + index_n * stride_n`. + Value getStridedElementPtr(Location loc, MemRefType type, Value memRefDesc, + ValueRange indices, + ConversionPatternRewriter &rewriter) const; + + /// Returns if the given memref has identity maps and the element type is + /// convertible to LLVM. + bool isConvertibleAndHasIdentityMaps(MemRefType type) const; + + /// Returns the type of a pointer to an element of the memref. + Type getElementPtrType(MemRefType type) const; + + /// Computes sizes, strides and buffer size of `memRefType` with identity + /// layout. Emits constant ops for the static sizes of `memRefType`, and uses + /// `dynamicSizes` for the others. Emits instructions to compute strides and + /// buffer size from these sizes. + /// + /// For example, memref<4x?xf32> with `sizeInBytes = true` emits: + /// `sizes[0]` = llvm.mlir.constant(4 : index) : i64 + /// `sizes[1]` = `dynamicSizes[0]` + /// `strides[1]` = llvm.mlir.constant(1 : index) : i64 + /// `strides[0]` = `sizes[0]` + /// %size = llvm.mul `sizes[0]`, `sizes[1]` : i64 + /// %nullptr = llvm.mlir.zero : !llvm.ptr + /// %gep = llvm.getelementptr %nullptr[%size] + /// : (!llvm.ptr, i64) -> !llvm.ptr + /// `sizeBytes` = llvm.ptrtoint %gep : !llvm.ptr to i64 + /// + /// If `sizeInBytes = false`, memref<4x?xf32> emits: + /// `sizes[0]` = llvm.mlir.constant(4 : index) : i64 + /// `sizes[1]` = `dynamicSizes[0]` + /// `strides[1]` = llvm.mlir.constant(1 : index) : i64 + /// `strides[0]` = `sizes[0]` + /// %size = llvm.mul `sizes[0]`, `sizes[1]` : i64 + void getMemRefDescriptorSizes(Location loc, MemRefType memRefType, + ValueRange dynamicSizes, + ConversionPatternRewriter &rewriter, + SmallVectorImpl &sizes, + SmallVectorImpl &strides, Value &size, + bool sizeInBytes = true) const; + + /// Computes the size of type in bytes. + Value getSizeInBytes(Location loc, Type type, + ConversionPatternRewriter &rewriter) const; + + /// Computes total number of elements for the given MemRef and dynamicSizes. + Value getNumElements(Location loc, MemRefType memRefType, + ValueRange dynamicSizes, + ConversionPatternRewriter &rewriter) const; + + /// Creates and populates a canonical memref descriptor struct. + MemRefDescriptor + createMemRefDescriptor(Location loc, MemRefType memRefType, + Value allocatedPtr, Value alignedPtr, + ArrayRef sizes, ArrayRef strides, + ConversionPatternRewriter &rewriter) const; + + /// Copies the memory descriptor for any operands that were unranked + /// descriptors originally to heap-allocated memory (if toDynamic is true) or + /// to stack-allocated memory (otherwise). Also frees the previously used + /// memory (that is assumed to be heap-allocated) if toDynamic is false. + LogicalResult copyUnrankedDescriptors(OpBuilder &builder, Location loc, + TypeRange origTypes, + SmallVectorImpl &operands, + bool toDynamic) const; +}; + +/// Utility class for operation conversions targeting the LLVM dialect that +/// match exactly one source operation. +template +class ConvertOpToLLVMPattern : public ConvertToLLVMPattern { +public: + using OpAdaptor = typename SourceOp::Adaptor; + + explicit ConvertOpToLLVMPattern(const LLVMTypeConverter &typeConverter, + PatternBenefit benefit = 1) + : ConvertToLLVMPattern(SourceOp::getOperationName(), + &typeConverter.getContext(), typeConverter, + benefit) {} + + /// Wrappers around the RewritePattern methods that pass the derived op type. + void rewrite(Operation *op, ArrayRef operands, + ConversionPatternRewriter &rewriter) const final { + rewrite(cast(op), OpAdaptor(operands, cast(op)), + rewriter); + } + LogicalResult match(Operation *op) const final { + return match(cast(op)); + } + LogicalResult + matchAndRewrite(Operation *op, ArrayRef operands, + ConversionPatternRewriter &rewriter) const final { + return matchAndRewrite(cast(op), + OpAdaptor(operands, cast(op)), rewriter); + } + + /// Rewrite and Match methods that operate on the SourceOp type. These must be + /// overridden by the derived pattern class. + virtual LogicalResult match(SourceOp op) const { + llvm_unreachable("must override match or matchAndRewrite"); + } + virtual void rewrite(SourceOp op, OpAdaptor adaptor, + ConversionPatternRewriter &rewriter) const { + llvm_unreachable("must override rewrite or matchAndRewrite"); + } + virtual LogicalResult + matchAndRewrite(SourceOp op, OpAdaptor adaptor, + ConversionPatternRewriter &rewriter) const { + if (failed(match(op))) + return failure(); + rewrite(op, adaptor, rewriter); + return success(); + } + +private: + using ConvertToLLVMPattern::match; + using ConvertToLLVMPattern::matchAndRewrite; +}; + +/// Generic implementation of one-to-one conversion from "SourceOp" to +/// "TargetOp" where the latter belongs to the LLVM dialect or an equivalent. +/// Upholds a convention that multi-result operations get converted into an +/// operation returning the LLVM IR structure type, in which case individual +/// values must be extracted from using LLVM::ExtractValueOp before being used. +template +class OneToOneConvertToLLVMPattern : public ConvertOpToLLVMPattern { +public: + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; + using Super = OneToOneConvertToLLVMPattern; + + /// Converts the type of the result to an LLVM type, pass operands as is, + /// preserve attributes. + LogicalResult + matchAndRewrite(SourceOp op, typename SourceOp::Adaptor adaptor, + ConversionPatternRewriter &rewriter) const override { + return LLVM::detail::oneToOneRewrite(op, TargetOp::getOperationName(), + adaptor.getOperands(), op->getAttrs(), + *this->getTypeConverter(), rewriter); + } +}; + +} // namespace mlir + +#endif // MLIR_CONVERSION_LLVMCOMMON_PATTERN_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/StructBuilder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/StructBuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..1a5b97eb928303d4707a6b3f672c98e551a67fff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/StructBuilder.h @@ -0,0 +1,51 @@ +//===- StructBuilder.h - Helper for building LLVM structs -------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Provides a convenience API for emitting IR that inspects or constructs values +// of LLVM dialect structure types. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_LLVMCOMMON_STRUCTBUILDER_H +#define MLIR_CONVERSION_LLVMCOMMON_STRUCTBUILDER_H + +#include "mlir/IR/Types.h" +#include "mlir/IR/Value.h" + +namespace mlir { + +class OpBuilder; + +/// Helper class to produce LLVM dialect operations extracting or inserting +/// values to a struct. +class StructBuilder { +public: + /// Construct a helper for the given value. + explicit StructBuilder(Value v); + /// Builds IR creating an `undef` value of the descriptor type. + static StructBuilder undef(OpBuilder &builder, Location loc, + Type descriptorType); + + /*implicit*/ operator Value() { return value; } + +protected: + // LLVM value + Value value; + // Cached struct type. + Type structType; + +protected: + /// Builds IR to extract a value from the struct at position pos + Value extractPtr(OpBuilder &builder, Location loc, unsigned pos) const; + /// Builds IR to set a value in the struct at position pos + void setPtr(OpBuilder &builder, Location loc, unsigned pos, Value ptr); +}; + +} // namespace mlir + +#endif // MLIR_CONVERSION_LLVMCOMMON_STRUCTBUILDER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/TypeConverter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/TypeConverter.h new file mode 100644 index 0000000000000000000000000000000000000000..2a4327535c6875016becfe8ed7698f1c4d24f298 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/TypeConverter.h @@ -0,0 +1,267 @@ +//===- TypeConverter.h - Convert builtin to LLVM dialect types --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Provides a type converter configuration for converting most builtin types to +// LLVM dialect types. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_LLVMCOMMON_TYPECONVERTER_H +#define MLIR_CONVERSION_LLVMCOMMON_TYPECONVERTER_H + +#include "mlir/Conversion/LLVMCommon/LoweringOptions.h" +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { + +class DataLayoutAnalysis; +class LowerToLLVMOptions; + +namespace LLVM { +class LLVMDialect; +class LLVMPointerType; +class LLVMFunctionType; +class LLVMStructType; +} // namespace LLVM + +/// Conversion from types to the LLVM IR dialect. +class LLVMTypeConverter : public TypeConverter { + /// Give structFuncArgTypeConverter access to memref-specific functions. + friend LogicalResult + structFuncArgTypeConverter(const LLVMTypeConverter &converter, Type type, + SmallVectorImpl &result); + +public: + using TypeConverter::convertType; + + /// Create an LLVMTypeConverter using the default LowerToLLVMOptions. + /// Optionally takes a data layout analysis to use in conversions. + LLVMTypeConverter(MLIRContext *ctx, + const DataLayoutAnalysis *analysis = nullptr); + + /// Create an LLVMTypeConverter using custom LowerToLLVMOptions. Optionally + /// takes a data layout analysis to use in conversions. + LLVMTypeConverter(MLIRContext *ctx, const LowerToLLVMOptions &options, + const DataLayoutAnalysis *analysis = nullptr); + + /// Convert a function type. The arguments and results are converted one by + /// one and results are packed into a wrapped LLVM IR structure type. `result` + /// is populated with argument mapping. + Type convertFunctionSignature(FunctionType funcTy, bool isVariadic, + bool useBarePtrCallConv, + SignatureConversion &result) const; + + /// Convert a non-empty list of types to be returned from a function into an + /// LLVM-compatible type. In particular, if more than one value is returned, + /// create an LLVM dialect structure type with elements that correspond to + /// each of the types converted with `convertCallingConventionType`. + Type packFunctionResults(TypeRange types, + bool useBarePointerCallConv = false) const; + + /// Convert a non-empty list of types of values produced by an operation into + /// an LLVM-compatible type. In particular, if more than one value is + /// produced, create a literal structure with elements that correspond to each + /// of the LLVM-compatible types converted with `convertType`. + Type packOperationResults(TypeRange types) const; + + /// Convert a type in the context of the default or bare pointer calling + /// convention. Calling convention sensitive types, such as MemRefType and + /// UnrankedMemRefType, are converted following the specific rules for the + /// calling convention. Calling convention independent types are converted + /// following the default LLVM type conversions. + Type convertCallingConventionType(Type type, + bool useBarePointerCallConv = false) const; + + /// Promote the bare pointers in 'values' that resulted from memrefs to + /// descriptors. 'stdTypes' holds the types of 'values' before the conversion + /// to the LLVM-IR dialect (i.e., MemRefType, or any other builtin type). + void promoteBarePtrsToDescriptors(ConversionPatternRewriter &rewriter, + Location loc, ArrayRef stdTypes, + SmallVectorImpl &values) const; + + /// Returns the MLIR context. + MLIRContext &getContext() const; + + /// Returns the LLVM dialect. + LLVM::LLVMDialect *getDialect() const { return llvmDialect; } + + const LowerToLLVMOptions &getOptions() const { return options; } + + /// Promote the LLVM representation of all operands including promoting MemRef + /// descriptors to stack and use pointers to struct to avoid the complexity + /// of the platform-specific C/C++ ABI lowering related to struct argument + /// passing. + SmallVector promoteOperands(Location loc, ValueRange opOperands, + ValueRange operands, OpBuilder &builder, + bool useBarePtrCallConv = false) const; + + /// Promote the LLVM struct representation of one MemRef descriptor to stack + /// and use pointer to struct to avoid the complexity of the platform-specific + /// C/C++ ABI lowering related to struct argument passing. + Value promoteOneMemRefDescriptor(Location loc, Value operand, + OpBuilder &builder) const; + + /// Converts the function type to a C-compatible format, in particular using + /// pointers to memref descriptors for arguments. Also converts the return + /// type to a pointer argument if it is a struct. Returns true if this + /// was the case. + std::pair + convertFunctionTypeCWrapper(FunctionType type) const; + + /// Returns the data layout to use during and after conversion. + const llvm::DataLayout &getDataLayout() const { return options.dataLayout; } + + /// Returns the data layout analysis to query during conversion. + const DataLayoutAnalysis *getDataLayoutAnalysis() const { + return dataLayoutAnalysis; + } + + /// Gets the LLVM representation of the index type. The returned type is an + /// integer type with the size configured for this type converter. + Type getIndexType() const; + + /// Returns true if using opaque pointers was enabled in the lowering options. + bool useOpaquePointers() const { return getOptions().useOpaquePointers; } + + /// Creates an LLVM pointer type with the given element type and address + /// space. + /// This function is meant to be used in code supporting both typed and opaque + /// pointers, as it will create an opaque pointer with the given address space + /// if opaque pointers are enabled in the lowering options. + LLVM::LLVMPointerType getPointerType(Type elementType, + unsigned addressSpace = 0) const; + + /// Gets the bitwidth of the index type when converted to LLVM. + unsigned getIndexTypeBitwidth() const { return options.getIndexBitwidth(); } + + /// Gets the pointer bitwidth. + unsigned getPointerBitwidth(unsigned addressSpace = 0) const; + + /// Returns the size of the memref descriptor object in bytes. + unsigned getMemRefDescriptorSize(MemRefType type, + const DataLayout &layout) const; + + /// Returns the size of the unranked memref descriptor object in bytes. + unsigned getUnrankedMemRefDescriptorSize(UnrankedMemRefType type, + const DataLayout &layout) const; + + /// Return the LLVM address space corresponding to the memory space of the + /// memref type `type` or failure if the memory space cannot be converted to + /// an integer. + FailureOr getMemRefAddressSpace(BaseMemRefType type) const; + + /// Check if a memref type can be converted to a bare pointer. + static bool canConvertToBarePtr(BaseMemRefType type); + +protected: + /// Pointer to the LLVM dialect. + LLVM::LLVMDialect *llvmDialect; + + // Recursive structure detection. + // We store one entry per thread here, and rely on locking. + DenseMap>> conversionCallStack; + llvm::sys::SmartRWMutex callStackMutex; + SmallVector &getCurrentThreadRecursiveStack(); + +private: + /// Convert a function type. The arguments and results are converted one by + /// one. Additionally, if the function returns more than one value, pack the + /// results into an LLVM IR structure type so that the converted function type + /// returns at most one result. + Type convertFunctionType(FunctionType type) const; + + /// Convert the index type. Uses llvmModule data layout to create an integer + /// of the pointer bitwidth. + Type convertIndexType(IndexType type) const; + + /// Convert an integer type `i*` to `!llvm<"i*">`. + Type convertIntegerType(IntegerType type) const; + + /// Convert a floating point type: `f16` to `f16`, `f32` to + /// `f32` and `f64` to `f64`. `bf16` is not supported + /// by LLVM. 8-bit float types are converted to 8-bit integers as this is how + /// all LLVM backends that support them currently represent them. + Type convertFloatType(FloatType type) const; + + /// Convert complex number type: `complex` to `!llvm<"{ half, half }">`, + /// `complex` to `!llvm<"{ float, float }">`, and `complex` to + /// `!llvm<"{ double, double }">`. `complex` is not supported. + Type convertComplexType(ComplexType type) const; + + /// Convert a memref type into an LLVM type that captures the relevant data. + Type convertMemRefType(MemRefType type) const; + + /// Convert a memref type into a list of LLVM IR types that will form the + /// memref descriptor. If `unpackAggregates` is true the `sizes` and `strides` + /// arrays in the descriptors are unpacked to individual index-typed elements, + /// else they are kept as rank-sized arrays of index type. In particular, + /// the list will contain: + /// - two pointers to the memref element type, followed by + /// - an index-typed offset, followed by + /// - (if unpackAggregates = true) + /// - one index-typed size per dimension of the memref, followed by + /// - one index-typed stride per dimension of the memref. + /// - (if unpackArrregates = false) + /// - one rank-sized array of index-type for the size of each dimension + /// - one rank-sized array of index-type for the stride of each dimension + /// + /// For example, memref is converted to the following list: + /// - `!llvm<"float*">` (allocated pointer), + /// - `!llvm<"float*">` (aligned pointer), + /// - `i64` (offset), + /// - `i64`, `i64` (sizes), + /// - `i64`, `i64` (strides). + /// These types can be recomposed to a memref descriptor struct. + SmallVector getMemRefDescriptorFields(MemRefType type, + bool unpackAggregates) const; + + /// Convert an unranked memref type into a list of non-aggregate LLVM IR types + /// that will form the unranked memref descriptor. In particular, this list + /// contains: + /// - an integer rank, followed by + /// - a pointer to the memref descriptor struct. + /// For example, memref<*xf32> is converted to the following list: + /// i64 (rank) + /// !llvm<"i8*"> (type-erased pointer). + /// These types can be recomposed to a unranked memref descriptor struct. + SmallVector getUnrankedMemRefDescriptorFields() const; + + /// Convert an unranked memref type to an LLVM type that captures the + /// runtime rank and a pointer to the static ranked memref desc + Type convertUnrankedMemRefType(UnrankedMemRefType type) const; + + /// Convert a memref type to a bare pointer to the memref element type. + Type convertMemRefToBarePtr(BaseMemRefType type) const; + + /// Convert a 1D vector type into an LLVM vector type. + FailureOr convertVectorType(VectorType type) const; + + /// Options for customizing the llvm lowering. + LowerToLLVMOptions options; + + /// Data layout analysis mapping scopes to layouts active in them. + const DataLayoutAnalysis *dataLayoutAnalysis; +}; + +/// Callback to convert function argument types. It converts a MemRef function +/// argument to a list of non-aggregate types containing descriptor +/// information, and an UnrankedmemRef function argument to a list containing +/// the rank and a pointer to a descriptor struct. +LogicalResult structFuncArgTypeConverter(const LLVMTypeConverter &converter, + Type type, + SmallVectorImpl &result); + +/// Callback to convert function argument types. It converts MemRef function +/// arguments to bare pointers to the MemRef element type. +LogicalResult barePtrFuncArgTypeConverter(const LLVMTypeConverter &converter, + Type type, + SmallVectorImpl &result); + +} // namespace mlir + +#endif // MLIR_CONVERSION_LLVMCOMMON_TYPECONVERTER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/VectorPattern.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/VectorPattern.h new file mode 100644 index 0000000000000000000000000000000000000000..279175b6128fc7b62a71edd46f1874801e82a810 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/LLVMCommon/VectorPattern.h @@ -0,0 +1,108 @@ +//===- VectorPattern.h - Conversion pattern to the LLVM dialect -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_LLVMCOMMON_VECTORPATTERN_H +#define MLIR_CONVERSION_LLVMCOMMON_VECTORPATTERN_H + +#include "mlir/Conversion/LLVMCommon/Pattern.h" +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { + +namespace LLVM { +namespace detail { +// Helper struct to "unroll" operations on n-D vectors in terms of operations on +// 1-D LLVM vectors. +struct NDVectorTypeInfo { + // LLVM array struct which encodes n-D vectors. + Type llvmNDVectorTy; + // LLVM vector type which encodes the inner 1-D vector type. + Type llvm1DVectorTy; + // Multiplicity of llvmNDVectorTy to llvm1DVectorTy. + SmallVector arraySizes; +}; + +// For >1-D vector types, extracts the necessary information to iterate over all +// 1-D subvectors in the underlying llrepresentation of the n-D vector +// Iterates on the llvm array type until we hit a non-array type (which is +// asserted to be an llvm vector type). +NDVectorTypeInfo extractNDVectorTypeInfo(VectorType vectorType, + const LLVMTypeConverter &converter); + +// Express `linearIndex` in terms of coordinates of `basis`. +// Returns the empty vector when linearIndex is out of the range [0, P] where +// P is the product of all the basis coordinates. +// +// Prerequisites: +// Basis is an array of nonnegative integers (signed type inherited from +// vector shape type). +SmallVector getCoordinates(ArrayRef basis, + unsigned linearIndex); + +// Iterate of linear index, convert to coords space and insert splatted 1-D +// vector in each position. +void nDVectorIterate(const NDVectorTypeInfo &info, OpBuilder &builder, + function_ref)> fun); + +LogicalResult handleMultidimensionalVectors( + Operation *op, ValueRange operands, const LLVMTypeConverter &typeConverter, + std::function createOperand, + ConversionPatternRewriter &rewriter); + +LogicalResult vectorOneToOneRewrite(Operation *op, StringRef targetOp, + ValueRange operands, + ArrayRef targetAttrs, + const LLVMTypeConverter &typeConverter, + ConversionPatternRewriter &rewriter); +} // namespace detail +} // namespace LLVM + +// Default attribute conversion class, which passes all source attributes +// through to the target op, unmodified. +template +class AttrConvertPassThrough { +public: + AttrConvertPassThrough(SourceOp srcOp) : srcAttrs(srcOp->getAttrs()) {} + + ArrayRef getAttrs() const { return srcAttrs; } + +private: + ArrayRef srcAttrs; +}; + +/// Basic lowering implementation to rewrite Ops with just one result to the +/// LLVM Dialect. This supports higher-dimensional vector types. +/// The AttrConvert template template parameter should be a template class +/// with SourceOp and TargetOp type parameters, a constructor that takes +/// a SourceOp instance, and a getAttrs() method that returns +/// ArrayRef. +template typename AttrConvert = + AttrConvertPassThrough> +class VectorConvertToLLVMPattern : public ConvertOpToLLVMPattern { +public: + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; + using Super = VectorConvertToLLVMPattern; + + LogicalResult + matchAndRewrite(SourceOp op, typename SourceOp::Adaptor adaptor, + ConversionPatternRewriter &rewriter) const override { + static_assert( + std::is_base_of, SourceOp>::value, + "expected single result op"); + // Determine attributes for the target op + AttrConvert attrConvert(op); + + return LLVM::detail::vectorOneToOneRewrite( + op, TargetOp::getOperationName(), adaptor.getOperands(), + attrConvert.getAttrs(), *this->getTypeConverter(), rewriter); + } +}; +} // namespace mlir + +#endif // MLIR_CONVERSION_LLVMCOMMON_VECTORPATTERN_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h new file mode 100644 index 0000000000000000000000000000000000000000..4ddc1637000fdb5e55a6b592df153512e9d64267 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h @@ -0,0 +1,32 @@ +//===- MathToLLVM.h - Math to LLVM dialect conversion -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_MATHTOLLVM_MATHTOLLVM_H +#define MLIR_CONVERSION_MATHTOLLVM_MATHTOLLVM_H + +#include + +namespace mlir { + +class DialectRegistry; +class LLVMTypeConverter; +class RewritePatternSet; +class Pass; + +#define GEN_PASS_DECL_CONVERTMATHTOLLVMPASS +#include "mlir/Conversion/Passes.h.inc" + +void populateMathToLLVMConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns, + bool approximateLog1p = true); + +void registerConvertMathToLLVMInterface(DialectRegistry ®istry); + +} // namespace mlir + +#endif // MLIR_CONVERSION_MATHTOLLVM_MATHTOLLVM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h new file mode 100644 index 0000000000000000000000000000000000000000..ab9a1cef20cab72440b43f19e92dcda644da512e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h @@ -0,0 +1,29 @@ +//===- MathToLibm.h - Utils to convert from the complex dialect --------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_MATHTOLIBM_MATHTOLIBM_H_ +#define MLIR_CONVERSION_MATHTOLIBM_MATHTOLIBM_H_ + +#include "mlir/IR/PatternMatch.h" + +namespace mlir { +template +class OperationPass; + +#define GEN_PASS_DECL_CONVERTMATHTOLIBM +#include "mlir/Conversion/Passes.h.inc" + +/// Populate the given list with patterns that convert from Math to Libm calls. +/// If log1pBenefit is present, use it instead of benefit for the Log1p op. +void populateMathToLibmConversionPatterns(RewritePatternSet &patterns); + +/// Create a pass to convert Math operations to libm calls. +std::unique_ptr> createConvertMathToLibmPass(); + +} // namespace mlir + +#endif // MLIR_CONVERSION_MATHTOLIBM_MATHTOLIBM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MemRefToLLVM/AllocLikeConversion.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MemRefToLLVM/AllocLikeConversion.h new file mode 100644 index 0000000000000000000000000000000000000000..8bf04219c759aeb6495cfca3b98394c4166630f9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MemRefToLLVM/AllocLikeConversion.h @@ -0,0 +1,153 @@ +//===- AllocLikeConversion.h - Convert allocation ops to LLVM ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_MEMREFTOLLVM_ALLOCLIKECONVERSION_H +#define MLIR_CONVERSION_MEMREFTOLLVM_ALLOCLIKECONVERSION_H + +#include "mlir/Conversion/LLVMCommon/Pattern.h" + +namespace mlir { + +/// Lowering for memory allocation ops. +struct AllocationOpLLVMLowering : public ConvertToLLVMPattern { + using ConvertToLLVMPattern::createIndexAttrConstant; + using ConvertToLLVMPattern::getIndexType; + using ConvertToLLVMPattern::getVoidPtrType; + + explicit AllocationOpLLVMLowering(StringRef opName, + const LLVMTypeConverter &converter, + PatternBenefit benefit = 1) + : ConvertToLLVMPattern(opName, &converter.getContext(), converter, + benefit) {} + +protected: + /// Computes the aligned value for 'input' as follows: + /// bumped = input + alignement - 1 + /// aligned = bumped - bumped % alignment + static Value createAligned(ConversionPatternRewriter &rewriter, Location loc, + Value input, Value alignment); + + static MemRefType getMemRefResultType(Operation *op) { + return cast(op->getResult(0).getType()); + } + + /// Computes the alignment for the given memory allocation op. + template + Value getAlignment(ConversionPatternRewriter &rewriter, Location loc, + OpType op) const { + MemRefType memRefType = op.getType(); + Value alignment; + if (auto alignmentAttr = op.getAlignment()) { + Type indexType = getIndexType(); + alignment = + createIndexAttrConstant(rewriter, loc, indexType, *alignmentAttr); + } else if (!memRefType.getElementType().isSignlessIntOrIndexOrFloat()) { + // In the case where no alignment is specified, we may want to override + // `malloc's` behavior. `malloc` typically aligns at the size of the + // biggest scalar on a target HW. For non-scalars, use the natural + // alignment of the LLVM type given by the LLVM DataLayout. + alignment = getSizeInBytes(loc, memRefType.getElementType(), rewriter); + } + return alignment; + } + + /// Computes the alignment for aligned_alloc used to allocate the buffer for + /// the memory allocation op. + /// + /// Aligned_alloc requires the allocation size to be a power of two, and the + /// allocation size to be a multiple of the alignment. + template + int64_t alignedAllocationGetAlignment(ConversionPatternRewriter &rewriter, + Location loc, OpType op, + const DataLayout *defaultLayout) const { + if (std::optional alignment = op.getAlignment()) + return *alignment; + + // Whenever we don't have alignment set, we will use an alignment + // consistent with the element type; since the allocation size has to be a + // power of two, we will bump to the next power of two if it isn't. + unsigned eltSizeBytes = + getMemRefEltSizeInBytes(op.getType(), op, defaultLayout); + return std::max(kMinAlignedAllocAlignment, + llvm::PowerOf2Ceil(eltSizeBytes)); + } + + /// Allocates a memory buffer using an allocation method that doesn't + /// guarantee alignment. Returns the pointer and its aligned value. + std::tuple + allocateBufferManuallyAlign(ConversionPatternRewriter &rewriter, Location loc, + Value sizeBytes, Operation *op, + Value alignment) const; + + /// Allocates a memory buffer using an aligned allocation method. + Value allocateBufferAutoAlign(ConversionPatternRewriter &rewriter, + Location loc, Value sizeBytes, Operation *op, + const DataLayout *defaultLayout, + int64_t alignment) const; + +private: + /// Computes the byte size for the MemRef element type. + unsigned getMemRefEltSizeInBytes(MemRefType memRefType, Operation *op, + const DataLayout *defaultLayout) const; + + /// Returns true if the memref size in bytes is known to be a multiple of + /// factor. + bool isMemRefSizeMultipleOf(MemRefType type, uint64_t factor, Operation *op, + const DataLayout *defaultLayout) const; + + /// The minimum alignment to use with aligned_alloc (has to be a power of 2). + static constexpr uint64_t kMinAlignedAllocAlignment = 16UL; +}; + +/// Lowering for AllocOp and AllocaOp. +struct AllocLikeOpLLVMLowering : public AllocationOpLLVMLowering { + explicit AllocLikeOpLLVMLowering(StringRef opName, + const LLVMTypeConverter &converter, + PatternBenefit benefit = 1) + : AllocationOpLLVMLowering(opName, converter, benefit) {} + +protected: + /// Allocates the underlying buffer. Returns the allocated pointer and the + /// aligned pointer. + virtual std::tuple + allocateBuffer(ConversionPatternRewriter &rewriter, Location loc, Value size, + Operation *op) const = 0; + + /// Sets the flag 'requiresNumElements', specifying the Op requires the number + /// of elements instead of the size in bytes. + void setRequiresNumElements(); + +private: + // An `alloc` is converted into a definition of a memref descriptor value and + // a call to `malloc` to allocate the underlying data buffer. The memref + // descriptor is of the LLVM structure type where: + // 1. the first element is a pointer to the allocated (typed) data buffer, + // 2. the second element is a pointer to the (typed) payload, aligned to the + // specified alignment, + // 3. the remaining elements serve to store all the sizes and strides of the + // memref using LLVM-converted `index` type. + // + // Alignment is performed by allocating `alignment` more bytes than + // requested and shifting the aligned pointer relative to the allocated + // memory. Note: `alignment - ` would actually be + // sufficient. If alignment is unspecified, the two pointers are equal. + + // An `alloca` is converted into a definition of a memref descriptor value and + // an llvm.alloca to allocate the underlying data buffer. + LogicalResult + matchAndRewrite(Operation *op, ArrayRef operands, + ConversionPatternRewriter &rewriter) const override; + + // Flag for specifying the Op requires the number of elements instead of the + // size in bytes. + bool requiresNumElements = false; +}; + +} // namespace mlir + +#endif // MLIR_CONVERSION_MEMREFTOLLVM_ALLOCLIKECONVERSION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h new file mode 100644 index 0000000000000000000000000000000000000000..db1c222643d571db716a2b5679c8c6b9ad96f804 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h @@ -0,0 +1,32 @@ +//===- MemRefToLLVM.h - MemRef to LLVM dialect conversion -------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_MEMREFTOLLVM_MEMREFTOLLVM_H +#define MLIR_CONVERSION_MEMREFTOLLVM_MEMREFTOLLVM_H + +#include + +namespace mlir { +class DialectRegistry; +class Pass; +class LLVMTypeConverter; +class RewritePatternSet; + +#define GEN_PASS_DECL_FINALIZEMEMREFTOLLVMCONVERSIONPASS +#include "mlir/Conversion/Passes.h.inc" + +/// Collect a set of patterns to convert memory-related operations from the +/// MemRef dialect to the LLVM dialect. +void populateFinalizeMemRefToLLVMConversionPatterns( + LLVMTypeConverter &converter, RewritePatternSet &patterns); + +void registerConvertMemRefToLLVMInterface(DialectRegistry ®istry); + +} // namespace mlir + +#endif // MLIR_CONVERSION_MEMREFTOLLVM_MEMREFTOLLVM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h new file mode 100644 index 0000000000000000000000000000000000000000..54033ff1639c7947af2a78be15a240165767a7b4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h @@ -0,0 +1,39 @@ +//===- PDLToPDLInterp.h - PDL to PDL Interpreter conversion -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file provides a pass for PDL to PDL Interpreter dialect conversion. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_PDLTOPDLINTERP_PDLTOPDLINTERP_H +#define MLIR_CONVERSION_PDLTOPDLINTERP_PDLTOPDLINTERP_H + +#include "mlir/Support/LLVM.h" + +namespace mlir { +class ModuleOp; +class Operation; +template +class OperationPass; +class PDLPatternConfigSet; + +#define GEN_PASS_DECL_CONVERTPDLTOPDLINTERP +#include "mlir/Conversion/Passes.h.inc" + +/// Creates and returns a pass to convert PDL ops to PDL interpreter ops. +std::unique_ptr> createPDLToPDLInterpPass(); + +/// Creates and returns a pass to convert PDL ops to PDL interpreter ops. +/// `configMap` holds a map of the configurations for each pattern being +/// compiled. +std::unique_ptr> createPDLToPDLInterpPass( + DenseMap &configMap); + +} // namespace mlir + +#endif // MLIR_CONVERSION_PDLTOPDLINTERP_PDLTOPDLINTERP_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/Passes.capi.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/Passes.capi.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..b685dba673b56d123e47a5479e10828ae8439ff6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/Passes.capi.cpp.inc @@ -0,0 +1,528 @@ +/* Autogenerated by mlir-tblgen; don't manually edit. */ +//===----------------------------------------------------------------------===// +// Conversion Group Registration +//===----------------------------------------------------------------------===// + +void mlirRegisterConversionPasses(void) { + registerConversionPasses(); +} + +MlirPass mlirCreateConversionArithToAMDGPUConversionPass(void) { + return wrap(createArithToAMDGPUConversionPass().release()); +} +void mlirRegisterConversionArithToAMDGPUConversionPass(void) { + registerArithToAMDGPUConversionPass(); +} + + +MlirPass mlirCreateConversionArithToLLVMConversionPass(void) { + return wrap(createArithToLLVMConversionPass().release()); +} +void mlirRegisterConversionArithToLLVMConversionPass(void) { + registerArithToLLVMConversionPass(); +} + + +MlirPass mlirCreateConversionConvertAMDGPUToROCDL(void) { + return wrap(mlir::createConvertAMDGPUToROCDLPass().release()); +} +void mlirRegisterConversionConvertAMDGPUToROCDL(void) { + registerConvertAMDGPUToROCDL(); +} + + +MlirPass mlirCreateConversionConvertAffineForToGPU(void) { + return wrap(mlir::createAffineForToGPUPass().release()); +} +void mlirRegisterConversionConvertAffineForToGPU(void) { + registerConvertAffineForToGPU(); +} + + +MlirPass mlirCreateConversionConvertAffineToStandard(void) { + return wrap(mlir::createLowerAffinePass().release()); +} +void mlirRegisterConversionConvertAffineToStandard(void) { + registerConvertAffineToStandard(); +} + + +MlirPass mlirCreateConversionConvertArithToSPIRV(void) { + return wrap(mlir::arith::createConvertArithToSPIRVPass().release()); +} +void mlirRegisterConversionConvertArithToSPIRV(void) { + registerConvertArithToSPIRV(); +} + + +MlirPass mlirCreateConversionConvertArmNeon2dToIntr(void) { + return wrap(mlir::createConvertArmNeon2dToIntrPass().release()); +} +void mlirRegisterConversionConvertArmNeon2dToIntr(void) { + registerConvertArmNeon2dToIntr(); +} + + +MlirPass mlirCreateConversionConvertArmSMEToSCF(void) { + return wrap(mlir::createConvertArmSMEToSCFPass().release()); +} +void mlirRegisterConversionConvertArmSMEToSCF(void) { + registerConvertArmSMEToSCF(); +} + + +MlirPass mlirCreateConversionConvertAsyncToLLVMPass(void) { + return wrap(createConvertAsyncToLLVMPass().release()); +} +void mlirRegisterConversionConvertAsyncToLLVMPass(void) { + registerConvertAsyncToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertBufferizationToMemRef(void) { + return wrap(mlir::createBufferizationToMemRefPass().release()); +} +void mlirRegisterConversionConvertBufferizationToMemRef(void) { + registerConvertBufferizationToMemRef(); +} + + +MlirPass mlirCreateConversionConvertComplexToLLVMPass(void) { + return wrap(createConvertComplexToLLVMPass().release()); +} +void mlirRegisterConversionConvertComplexToLLVMPass(void) { + registerConvertComplexToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertComplexToLibm(void) { + return wrap(mlir::createConvertComplexToLibmPass().release()); +} +void mlirRegisterConversionConvertComplexToLibm(void) { + registerConvertComplexToLibm(); +} + + +MlirPass mlirCreateConversionConvertComplexToSPIRVPass(void) { + return wrap(createConvertComplexToSPIRVPass().release()); +} +void mlirRegisterConversionConvertComplexToSPIRVPass(void) { + registerConvertComplexToSPIRVPass(); +} + + +MlirPass mlirCreateConversionConvertComplexToStandard(void) { + return wrap(mlir::createConvertComplexToStandardPass().release()); +} +void mlirRegisterConversionConvertComplexToStandard(void) { + registerConvertComplexToStandard(); +} + + +MlirPass mlirCreateConversionConvertControlFlowToLLVMPass(void) { + return wrap(createConvertControlFlowToLLVMPass().release()); +} +void mlirRegisterConversionConvertControlFlowToLLVMPass(void) { + registerConvertControlFlowToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertControlFlowToSPIRV(void) { + return wrap(mlir::createConvertControlFlowToSPIRVPass().release()); +} +void mlirRegisterConversionConvertControlFlowToSPIRV(void) { + registerConvertControlFlowToSPIRV(); +} + + +MlirPass mlirCreateConversionConvertFuncToLLVMPass(void) { + return wrap(createConvertFuncToLLVMPass().release()); +} +void mlirRegisterConversionConvertFuncToLLVMPass(void) { + registerConvertFuncToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertFuncToSPIRV(void) { + return wrap(mlir::createConvertFuncToSPIRVPass().release()); +} +void mlirRegisterConversionConvertFuncToSPIRV(void) { + registerConvertFuncToSPIRV(); +} + + +MlirPass mlirCreateConversionConvertGPUToSPIRV(void) { + return wrap(mlir::createConvertGPUToSPIRVPass().release()); +} +void mlirRegisterConversionConvertGPUToSPIRV(void) { + registerConvertGPUToSPIRV(); +} + + +MlirPass mlirCreateConversionConvertGpuLaunchFuncToVulkanLaunchFunc(void) { + return wrap(mlir::createConvertGpuLaunchFuncToVulkanLaunchFuncPass().release()); +} +void mlirRegisterConversionConvertGpuLaunchFuncToVulkanLaunchFunc(void) { + registerConvertGpuLaunchFuncToVulkanLaunchFunc(); +} + + +MlirPass mlirCreateConversionConvertGpuOpsToNVVMOps(void) { + return wrap(createConvertGpuOpsToNVVMOps().release()); +} +void mlirRegisterConversionConvertGpuOpsToNVVMOps(void) { + registerConvertGpuOpsToNVVMOps(); +} + + +MlirPass mlirCreateConversionConvertGpuOpsToROCDLOps(void) { + return wrap(mlir::createLowerGpuOpsToROCDLOpsPass().release()); +} +void mlirRegisterConversionConvertGpuOpsToROCDLOps(void) { + registerConvertGpuOpsToROCDLOps(); +} + + +MlirPass mlirCreateConversionConvertIndexToLLVMPass(void) { + return wrap(createConvertIndexToLLVMPass().release()); +} +void mlirRegisterConversionConvertIndexToLLVMPass(void) { + registerConvertIndexToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertLinalgToStandard(void) { + return wrap(mlir::createConvertLinalgToStandardPass().release()); +} +void mlirRegisterConversionConvertLinalgToStandard(void) { + registerConvertLinalgToStandard(); +} + + +MlirPass mlirCreateConversionConvertMathToFuncs(void) { + return wrap(createConvertMathToFuncs().release()); +} +void mlirRegisterConversionConvertMathToFuncs(void) { + registerConvertMathToFuncs(); +} + + +MlirPass mlirCreateConversionConvertMathToLLVMPass(void) { + return wrap(createConvertMathToLLVMPass().release()); +} +void mlirRegisterConversionConvertMathToLLVMPass(void) { + registerConvertMathToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertMathToLibm(void) { + return wrap(mlir::createConvertMathToLibmPass().release()); +} +void mlirRegisterConversionConvertMathToLibm(void) { + registerConvertMathToLibm(); +} + + +MlirPass mlirCreateConversionConvertMathToSPIRV(void) { + return wrap(mlir::createConvertMathToSPIRVPass().release()); +} +void mlirRegisterConversionConvertMathToSPIRV(void) { + registerConvertMathToSPIRV(); +} + + +MlirPass mlirCreateConversionConvertMemRefToSPIRV(void) { + return wrap(mlir::createConvertMemRefToSPIRVPass().release()); +} +void mlirRegisterConversionConvertMemRefToSPIRV(void) { + registerConvertMemRefToSPIRV(); +} + + +MlirPass mlirCreateConversionConvertNVGPUToNVVMPass(void) { + return wrap(createConvertNVGPUToNVVMPass().release()); +} +void mlirRegisterConversionConvertNVGPUToNVVMPass(void) { + registerConvertNVGPUToNVVMPass(); +} + + +MlirPass mlirCreateConversionConvertNVVMToLLVMPass(void) { + return wrap(createConvertNVVMToLLVMPass().release()); +} +void mlirRegisterConversionConvertNVVMToLLVMPass(void) { + registerConvertNVVMToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertOpenACCToSCF(void) { + return wrap(mlir::createConvertOpenACCToSCFPass().release()); +} +void mlirRegisterConversionConvertOpenACCToSCF(void) { + registerConvertOpenACCToSCF(); +} + + +MlirPass mlirCreateConversionConvertOpenMPToLLVMPass(void) { + return wrap(createConvertOpenMPToLLVMPass().release()); +} +void mlirRegisterConversionConvertOpenMPToLLVMPass(void) { + registerConvertOpenMPToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertPDLToPDLInterp(void) { + return wrap(mlir::createPDLToPDLInterpPass().release()); +} +void mlirRegisterConversionConvertPDLToPDLInterp(void) { + registerConvertPDLToPDLInterp(); +} + + +MlirPass mlirCreateConversionConvertParallelLoopToGpu(void) { + return wrap(mlir::createParallelLoopToGpuPass().release()); +} +void mlirRegisterConversionConvertParallelLoopToGpu(void) { + registerConvertParallelLoopToGpu(); +} + + +MlirPass mlirCreateConversionConvertSCFToOpenMPPass(void) { + return wrap(createConvertSCFToOpenMPPass().release()); +} +void mlirRegisterConversionConvertSCFToOpenMPPass(void) { + registerConvertSCFToOpenMPPass(); +} + + +MlirPass mlirCreateConversionConvertSPIRVToLLVMPass(void) { + return wrap(createConvertSPIRVToLLVMPass().release()); +} +void mlirRegisterConversionConvertSPIRVToLLVMPass(void) { + registerConvertSPIRVToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertShapeConstraints(void) { + return wrap(mlir::createConvertShapeConstraintsPass().release()); +} +void mlirRegisterConversionConvertShapeConstraints(void) { + registerConvertShapeConstraints(); +} + + +MlirPass mlirCreateConversionConvertShapeToStandard(void) { + return wrap(mlir::createConvertShapeToStandardPass().release()); +} +void mlirRegisterConversionConvertShapeToStandard(void) { + registerConvertShapeToStandard(); +} + + +MlirPass mlirCreateConversionConvertTensorToLinalg(void) { + return wrap(mlir::createConvertTensorToLinalgPass().release()); +} +void mlirRegisterConversionConvertTensorToLinalg(void) { + registerConvertTensorToLinalg(); +} + + +MlirPass mlirCreateConversionConvertTensorToSPIRV(void) { + return wrap(mlir::createConvertTensorToSPIRVPass().release()); +} +void mlirRegisterConversionConvertTensorToSPIRV(void) { + registerConvertTensorToSPIRV(); +} + + +MlirPass mlirCreateConversionConvertToLLVMPass(void) { + return wrap(mlir::createConvertToLLVMPass().release()); +} +void mlirRegisterConversionConvertToLLVMPass(void) { + registerConvertToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertVectorToArmSME(void) { + return wrap(createConvertVectorToArmSME().release()); +} +void mlirRegisterConversionConvertVectorToArmSME(void) { + registerConvertVectorToArmSME(); +} + + +MlirPass mlirCreateConversionConvertVectorToGPU(void) { + return wrap(mlir::createConvertVectorToGPUPass().release()); +} +void mlirRegisterConversionConvertVectorToGPU(void) { + registerConvertVectorToGPU(); +} + + +MlirPass mlirCreateConversionConvertVectorToLLVMPass(void) { + return wrap(createConvertVectorToLLVMPass().release()); +} +void mlirRegisterConversionConvertVectorToLLVMPass(void) { + registerConvertVectorToLLVMPass(); +} + + +MlirPass mlirCreateConversionConvertVectorToSCF(void) { + return wrap(mlir::createConvertVectorToSCFPass().release()); +} +void mlirRegisterConversionConvertVectorToSCF(void) { + registerConvertVectorToSCF(); +} + + +MlirPass mlirCreateConversionConvertVectorToSPIRV(void) { + return wrap(mlir::createConvertVectorToSPIRVPass().release()); +} +void mlirRegisterConversionConvertVectorToSPIRV(void) { + registerConvertVectorToSPIRV(); +} + + +MlirPass mlirCreateConversionConvertVulkanLaunchFuncToVulkanCallsPass(void) { + return wrap(createConvertVulkanLaunchFuncToVulkanCallsPass().release()); +} +void mlirRegisterConversionConvertVulkanLaunchFuncToVulkanCallsPass(void) { + registerConvertVulkanLaunchFuncToVulkanCallsPass(); +} + + +MlirPass mlirCreateConversionFinalizeMemRefToLLVMConversionPass(void) { + return wrap(createFinalizeMemRefToLLVMConversionPass().release()); +} +void mlirRegisterConversionFinalizeMemRefToLLVMConversionPass(void) { + registerFinalizeMemRefToLLVMConversionPass(); +} + + +MlirPass mlirCreateConversionGpuToLLVMConversionPass(void) { + return wrap(createGpuToLLVMConversionPass().release()); +} +void mlirRegisterConversionGpuToLLVMConversionPass(void) { + registerGpuToLLVMConversionPass(); +} + + +MlirPass mlirCreateConversionLiftControlFlowToSCFPass(void) { + return wrap(createLiftControlFlowToSCFPass().release()); +} +void mlirRegisterConversionLiftControlFlowToSCFPass(void) { + registerLiftControlFlowToSCFPass(); +} + + +MlirPass mlirCreateConversionLowerHostCodeToLLVMPass(void) { + return wrap(createLowerHostCodeToLLVMPass().release()); +} +void mlirRegisterConversionLowerHostCodeToLLVMPass(void) { + registerLowerHostCodeToLLVMPass(); +} + + +MlirPass mlirCreateConversionMapMemRefStorageClass(void) { + return wrap(mlir::createMapMemRefStorageClassPass().release()); +} +void mlirRegisterConversionMapMemRefStorageClass(void) { + registerMapMemRefStorageClass(); +} + + +MlirPass mlirCreateConversionReconcileUnrealizedCasts(void) { + return wrap(mlir::createReconcileUnrealizedCastsPass().release()); +} +void mlirRegisterConversionReconcileUnrealizedCasts(void) { + registerReconcileUnrealizedCasts(); +} + + +MlirPass mlirCreateConversionSCFToControlFlow(void) { + return wrap(mlir::createConvertSCFToCFPass().release()); +} +void mlirRegisterConversionSCFToControlFlow(void) { + registerSCFToControlFlow(); +} + + +MlirPass mlirCreateConversionSCFToEmitC(void) { + return wrap(createSCFToEmitC().release()); +} +void mlirRegisterConversionSCFToEmitC(void) { + registerSCFToEmitC(); +} + + +MlirPass mlirCreateConversionSCFToSPIRV(void) { + return wrap(createSCFToSPIRV().release()); +} +void mlirRegisterConversionSCFToSPIRV(void) { + registerSCFToSPIRV(); +} + + +MlirPass mlirCreateConversionSetLLVMModuleDataLayoutPass(void) { + return wrap(createSetLLVMModuleDataLayoutPass().release()); +} +void mlirRegisterConversionSetLLVMModuleDataLayoutPass(void) { + registerSetLLVMModuleDataLayoutPass(); +} + + +MlirPass mlirCreateConversionTosaToArith(void) { + return wrap(tosa::createTosaToArith().release()); +} +void mlirRegisterConversionTosaToArith(void) { + registerTosaToArith(); +} + + +MlirPass mlirCreateConversionTosaToLinalg(void) { + return wrap(tosa::createTosaToLinalg().release()); +} +void mlirRegisterConversionTosaToLinalg(void) { + registerTosaToLinalg(); +} + + +MlirPass mlirCreateConversionTosaToLinalgNamed(void) { + return wrap(tosa::createTosaToLinalgNamed().release()); +} +void mlirRegisterConversionTosaToLinalgNamed(void) { + registerTosaToLinalgNamed(); +} + + +MlirPass mlirCreateConversionTosaToSCF(void) { + return wrap(tosa::createTosaToSCF().release()); +} +void mlirRegisterConversionTosaToSCF(void) { + registerTosaToSCF(); +} + + +MlirPass mlirCreateConversionTosaToTensor(void) { + return wrap(tosa::createTosaToTensor().release()); +} +void mlirRegisterConversionTosaToTensor(void) { + registerTosaToTensor(); +} + + +MlirPass mlirCreateConversionUBToLLVMConversionPass(void) { + return wrap(createUBToLLVMConversionPass().release()); +} +void mlirRegisterConversionUBToLLVMConversionPass(void) { + registerUBToLLVMConversionPass(); +} + + +MlirPass mlirCreateConversionUBToSPIRVConversionPass(void) { + return wrap(createUBToSPIRVConversionPass().release()); +} +void mlirRegisterConversionUBToSPIRVConversionPass(void) { + registerUBToSPIRVConversionPass(); +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/Passes.capi.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/Passes.capi.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..29664c33a5c3138b701c3126bc79d32656722c14 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/Passes.capi.h.inc @@ -0,0 +1,342 @@ + +/* Autogenerated by mlir-tblgen; don't manually edit. */ + +#include "mlir-c/Pass.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Registration for the entire group +MLIR_CAPI_EXPORTED void mlirRegisterConversionPasses(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionArithToAMDGPUConversionPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionArithToAMDGPUConversionPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionArithToLLVMConversionPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionArithToLLVMConversionPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertAMDGPUToROCDL(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertAMDGPUToROCDL(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertAffineForToGPU(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertAffineForToGPU(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertAffineToStandard(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertAffineToStandard(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertArithToSPIRV(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertArithToSPIRV(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertArmNeon2dToIntr(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertArmNeon2dToIntr(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertArmSMEToSCF(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertArmSMEToSCF(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertAsyncToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertAsyncToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertBufferizationToMemRef(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertBufferizationToMemRef(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertComplexToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertComplexToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertComplexToLibm(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertComplexToLibm(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertComplexToSPIRVPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertComplexToSPIRVPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertComplexToStandard(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertComplexToStandard(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertControlFlowToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertControlFlowToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertControlFlowToSPIRV(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertControlFlowToSPIRV(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertFuncToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertFuncToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertFuncToSPIRV(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertFuncToSPIRV(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertGPUToSPIRV(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertGPUToSPIRV(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertGpuLaunchFuncToVulkanLaunchFunc(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertGpuLaunchFuncToVulkanLaunchFunc(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertGpuOpsToNVVMOps(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertGpuOpsToNVVMOps(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertGpuOpsToROCDLOps(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertGpuOpsToROCDLOps(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertIndexToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertIndexToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertLinalgToStandard(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertLinalgToStandard(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertMathToFuncs(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertMathToFuncs(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertMathToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertMathToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertMathToLibm(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertMathToLibm(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertMathToSPIRV(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertMathToSPIRV(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertMemRefToSPIRV(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertMemRefToSPIRV(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertNVGPUToNVVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertNVGPUToNVVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertNVVMToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertNVVMToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertOpenACCToSCF(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertOpenACCToSCF(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertOpenMPToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertOpenMPToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertPDLToPDLInterp(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertPDLToPDLInterp(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertParallelLoopToGpu(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertParallelLoopToGpu(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertSCFToOpenMPPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertSCFToOpenMPPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertSPIRVToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertSPIRVToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertShapeConstraints(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertShapeConstraints(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertShapeToStandard(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertShapeToStandard(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertTensorToLinalg(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertTensorToLinalg(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertTensorToSPIRV(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertTensorToSPIRV(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertVectorToArmSME(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertVectorToArmSME(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertVectorToGPU(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertVectorToGPU(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertVectorToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertVectorToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertVectorToSCF(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertVectorToSCF(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertVectorToSPIRV(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertVectorToSPIRV(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionConvertVulkanLaunchFuncToVulkanCallsPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionConvertVulkanLaunchFuncToVulkanCallsPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionFinalizeMemRefToLLVMConversionPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionFinalizeMemRefToLLVMConversionPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionGpuToLLVMConversionPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionGpuToLLVMConversionPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionLiftControlFlowToSCFPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionLiftControlFlowToSCFPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionLowerHostCodeToLLVMPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionLowerHostCodeToLLVMPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionMapMemRefStorageClass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionMapMemRefStorageClass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionReconcileUnrealizedCasts(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionReconcileUnrealizedCasts(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionSCFToControlFlow(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionSCFToControlFlow(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionSCFToEmitC(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionSCFToEmitC(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionSCFToSPIRV(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionSCFToSPIRV(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionSetLLVMModuleDataLayoutPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionSetLLVMModuleDataLayoutPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionTosaToArith(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionTosaToArith(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionTosaToLinalg(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionTosaToLinalg(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionTosaToLinalgNamed(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionTosaToLinalgNamed(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionTosaToSCF(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionTosaToSCF(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionTosaToTensor(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionTosaToTensor(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionUBToLLVMConversionPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionUBToLLVMConversionPass(void); + + +/* Create Conversion Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateConversionUBToSPIRVConversionPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterConversionUBToSPIRVConversionPass(void); + + + +#ifdef __cplusplus +} +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ed05e537c5447762469b74d72981d4576159a0f4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/Passes.h.inc @@ -0,0 +1,9360 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ARITHTOAMDGPUCONVERSIONPASS +#define GEN_PASS_DECL_ARITHTOLLVMCONVERSIONPASS +#define GEN_PASS_DECL_CONVERTAMDGPUTOROCDL +#define GEN_PASS_DECL_CONVERTAFFINEFORTOGPU +#define GEN_PASS_DECL_CONVERTAFFINETOSTANDARD +#define GEN_PASS_DECL_CONVERTARITHTOSPIRV +#define GEN_PASS_DECL_CONVERTARMNEON2DTOINTR +#define GEN_PASS_DECL_CONVERTARMSMETOSCF +#define GEN_PASS_DECL_CONVERTASYNCTOLLVMPASS +#define GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREF +#define GEN_PASS_DECL_CONVERTCOMPLEXTOLLVMPASS +#define GEN_PASS_DECL_CONVERTCOMPLEXTOLIBM +#define GEN_PASS_DECL_CONVERTCOMPLEXTOSPIRVPASS +#define GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARD +#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVMPASS +#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOSPIRV +#define GEN_PASS_DECL_CONVERTFUNCTOLLVMPASS +#define GEN_PASS_DECL_CONVERTFUNCTOSPIRV +#define GEN_PASS_DECL_CONVERTGPUTOSPIRV +#define GEN_PASS_DECL_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNC +#define GEN_PASS_DECL_CONVERTGPUOPSTONVVMOPS +#define GEN_PASS_DECL_CONVERTGPUOPSTOROCDLOPS +#define GEN_PASS_DECL_CONVERTINDEXTOLLVMPASS +#define GEN_PASS_DECL_CONVERTLINALGTOSTANDARD +#define GEN_PASS_DECL_CONVERTMATHTOFUNCS +#define GEN_PASS_DECL_CONVERTMATHTOLLVMPASS +#define GEN_PASS_DECL_CONVERTMATHTOLIBM +#define GEN_PASS_DECL_CONVERTMATHTOSPIRV +#define GEN_PASS_DECL_CONVERTMEMREFTOSPIRV +#define GEN_PASS_DECL_CONVERTNVGPUTONVVMPASS +#define GEN_PASS_DECL_CONVERTNVVMTOLLVMPASS +#define GEN_PASS_DECL_CONVERTOPENACCTOSCF +#define GEN_PASS_DECL_CONVERTOPENMPTOLLVMPASS +#define GEN_PASS_DECL_CONVERTPDLTOPDLINTERP +#define GEN_PASS_DECL_CONVERTPARALLELLOOPTOGPU +#define GEN_PASS_DECL_CONVERTSCFTOOPENMPPASS +#define GEN_PASS_DECL_CONVERTSPIRVTOLLVMPASS +#define GEN_PASS_DECL_CONVERTSHAPECONSTRAINTS +#define GEN_PASS_DECL_CONVERTSHAPETOSTANDARD +#define GEN_PASS_DECL_CONVERTTENSORTOLINALG +#define GEN_PASS_DECL_CONVERTTENSORTOSPIRV +#define GEN_PASS_DECL_CONVERTTOLLVMPASS +#define GEN_PASS_DECL_CONVERTVECTORTOARMSME +#define GEN_PASS_DECL_CONVERTVECTORTOGPU +#define GEN_PASS_DECL_CONVERTVECTORTOLLVMPASS +#define GEN_PASS_DECL_CONVERTVECTORTOSCF +#define GEN_PASS_DECL_CONVERTVECTORTOSPIRV +#define GEN_PASS_DECL_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS +#define GEN_PASS_DECL_FINALIZEMEMREFTOLLVMCONVERSIONPASS +#define GEN_PASS_DECL_GPUTOLLVMCONVERSIONPASS +#define GEN_PASS_DECL_LIFTCONTROLFLOWTOSCFPASS +#define GEN_PASS_DECL_LOWERHOSTCODETOLLVMPASS +#define GEN_PASS_DECL_MAPMEMREFSTORAGECLASS +#define GEN_PASS_DECL_RECONCILEUNREALIZEDCASTS +#define GEN_PASS_DECL_SCFTOCONTROLFLOW +#define GEN_PASS_DECL_SCFTOEMITC +#define GEN_PASS_DECL_SCFTOSPIRV +#define GEN_PASS_DECL_SETLLVMMODULEDATALAYOUTPASS +#define GEN_PASS_DECL_TOSATOARITH +#define GEN_PASS_DECL_TOSATOLINALG +#define GEN_PASS_DECL_TOSATOLINALGNAMED +#define GEN_PASS_DECL_TOSATOSCF +#define GEN_PASS_DECL_TOSATOTENSOR +#define GEN_PASS_DECL_UBTOLLVMCONVERSIONPASS +#define GEN_PASS_DECL_UBTOSPIRVCONVERSIONPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// ArithToAMDGPUConversionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ARITHTOAMDGPUCONVERSIONPASS +std::unique_ptr<::mlir::Pass> createArithToAMDGPUConversionPass(); +#undef GEN_PASS_DECL_ARITHTOAMDGPUCONVERSIONPASS +#endif // GEN_PASS_DECL_ARITHTOAMDGPUCONVERSIONPASS +#ifdef GEN_PASS_DEF_ARITHTOAMDGPUCONVERSIONPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithToAMDGPUConversionPass(); +} // namespace impl +namespace impl { + +template +class ArithToAMDGPUConversionPassBase : public ::mlir::OperationPass<> { +public: + using Base = ArithToAMDGPUConversionPassBase; + + ArithToAMDGPUConversionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithToAMDGPUConversionPassBase(const ArithToAMDGPUConversionPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-arith-to-amdgpu"); + } + ::llvm::StringRef getArgument() const override { return "convert-arith-to-amdgpu"; } + + ::llvm::StringRef getDescription() const override { return "Convert Arith operations to AMDGPU-specific implementations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithToAMDGPUConversionPass"); + } + ::llvm::StringRef getName() const override { return "ArithToAMDGPUConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithToAMDGPUConversionPassBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createArithToAMDGPUConversionPass() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createArithToAMDGPUConversionPass() { + return impl::createArithToAMDGPUConversionPass(); +} +#undef GEN_PASS_DEF_ARITHTOAMDGPUCONVERSIONPASS +#endif // GEN_PASS_DEF_ARITHTOAMDGPUCONVERSIONPASS + +//===----------------------------------------------------------------------===// +// ArithToLLVMConversionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ARITHTOLLVMCONVERSIONPASS +struct ArithToLLVMConversionPassOptions { + unsigned indexBitwidth = 0; +}; +std::unique_ptr<::mlir::Pass> createArithToLLVMConversionPass(); +std::unique_ptr<::mlir::Pass> createArithToLLVMConversionPass(const ArithToLLVMConversionPassOptions &options); +#undef GEN_PASS_DECL_ARITHTOLLVMCONVERSIONPASS +#endif // GEN_PASS_DECL_ARITHTOLLVMCONVERSIONPASS +#ifdef GEN_PASS_DEF_ARITHTOLLVMCONVERSIONPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithToLLVMConversionPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithToLLVMConversionPass(const ArithToLLVMConversionPassOptions &options); +} // namespace impl +namespace impl { + +template +class ArithToLLVMConversionPassBase : public ::mlir::OperationPass<> { +public: + using Base = ArithToLLVMConversionPassBase; + + ArithToLLVMConversionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithToLLVMConversionPassBase(const ArithToLLVMConversionPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-arith-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-arith-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Arith dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithToLLVMConversionPass"); + } + ::llvm::StringRef getName() const override { return "ArithToLLVMConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithToLLVMConversionPassBase) + + ArithToLLVMConversionPassBase(const ArithToLLVMConversionPassOptions &options) : ArithToLLVMConversionPassBase() { + indexBitwidth = options.indexBitwidth; + } +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; +private: + + friend std::unique_ptr<::mlir::Pass> createArithToLLVMConversionPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createArithToLLVMConversionPass(const ArithToLLVMConversionPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createArithToLLVMConversionPass() { + return impl::createArithToLLVMConversionPass(); +} + +std::unique_ptr<::mlir::Pass> createArithToLLVMConversionPass(const ArithToLLVMConversionPassOptions &options) { + return impl::createArithToLLVMConversionPass(options); +} +#undef GEN_PASS_DEF_ARITHTOLLVMCONVERSIONPASS +#endif // GEN_PASS_DEF_ARITHTOLLVMCONVERSIONPASS + +//===----------------------------------------------------------------------===// +// ConvertAMDGPUToROCDL +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTAMDGPUTOROCDL +struct ConvertAMDGPUToROCDLOptions { + std::string chipset = "gfx000"; +}; +#undef GEN_PASS_DECL_CONVERTAMDGPUTOROCDL +#endif // GEN_PASS_DECL_CONVERTAMDGPUTOROCDL +#ifdef GEN_PASS_DEF_CONVERTAMDGPUTOROCDL +namespace impl { + +template +class ConvertAMDGPUToROCDLBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertAMDGPUToROCDLBase; + + ConvertAMDGPUToROCDLBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertAMDGPUToROCDLBase(const ConvertAMDGPUToROCDLBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-amdgpu-to-rocdl"); + } + ::llvm::StringRef getArgument() const override { return "convert-amdgpu-to-rocdl"; } + + ::llvm::StringRef getDescription() const override { return "Convert AMDGPU dialect to ROCDL dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAMDGPUToROCDL"); + } + ::llvm::StringRef getName() const override { return "ConvertAMDGPUToROCDL"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAMDGPUToROCDLBase) + + ConvertAMDGPUToROCDLBase(const ConvertAMDGPUToROCDLOptions &options) : ConvertAMDGPUToROCDLBase() { + chipset = options.chipset; + } +protected: + ::mlir::Pass::Option chipset{*this, "chipset", ::llvm::cl::desc("Chipset that these operations will run on"), ::llvm::cl::init("gfx000")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTAMDGPUTOROCDL +#endif // GEN_PASS_DEF_CONVERTAMDGPUTOROCDL + +//===----------------------------------------------------------------------===// +// ConvertAffineForToGPU +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTAFFINEFORTOGPU +struct ConvertAffineForToGPUOptions { + unsigned numBlockDims = 1u; + unsigned numThreadDims = 1u; +}; +#undef GEN_PASS_DECL_CONVERTAFFINEFORTOGPU +#endif // GEN_PASS_DECL_CONVERTAFFINEFORTOGPU +#ifdef GEN_PASS_DEF_CONVERTAFFINEFORTOGPU +namespace impl { + +template +class ConvertAffineForToGPUBase : public ::mlir::InterfacePass { +public: + using Base = ConvertAffineForToGPUBase; + + ConvertAffineForToGPUBase() : ::mlir::InterfacePass(::mlir::TypeID::get()) {} + ConvertAffineForToGPUBase(const ConvertAffineForToGPUBase &other) : ::mlir::InterfacePass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-affine-for-to-gpu"); + } + ::llvm::StringRef getArgument() const override { return "convert-affine-for-to-gpu"; } + + ::llvm::StringRef getDescription() const override { return "Convert top-level AffineFor Ops to GPU kernels"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAffineForToGPU"); + } + ::llvm::StringRef getName() const override { return "ConvertAffineForToGPU"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAffineForToGPUBase) + + ConvertAffineForToGPUBase(const ConvertAffineForToGPUOptions &options) : ConvertAffineForToGPUBase() { + numBlockDims = options.numBlockDims; + numThreadDims = options.numThreadDims; + } +protected: + ::mlir::Pass::Option numBlockDims{*this, "gpu-block-dims", ::llvm::cl::desc("Number of GPU block dimensions for mapping"), ::llvm::cl::init(1u)}; + ::mlir::Pass::Option numThreadDims{*this, "gpu-thread-dims", ::llvm::cl::desc("Number of GPU thread dimensions for mapping"), ::llvm::cl::init(1u)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTAFFINEFORTOGPU +#endif // GEN_PASS_DEF_CONVERTAFFINEFORTOGPU + +//===----------------------------------------------------------------------===// +// ConvertAffineToStandard +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTAFFINETOSTANDARD +#undef GEN_PASS_DECL_CONVERTAFFINETOSTANDARD +#endif // GEN_PASS_DECL_CONVERTAFFINETOSTANDARD +#ifdef GEN_PASS_DEF_CONVERTAFFINETOSTANDARD +namespace impl { + +template +class ConvertAffineToStandardBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertAffineToStandardBase; + + ConvertAffineToStandardBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertAffineToStandardBase(const ConvertAffineToStandardBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lower-affine"); + } + ::llvm::StringRef getArgument() const override { return "lower-affine"; } + + ::llvm::StringRef getDescription() const override { return "Lower Affine operations to a combination of Standard and SCF operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAffineToStandard"); + } + ::llvm::StringRef getName() const override { return "ConvertAffineToStandard"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAffineToStandardBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTAFFINETOSTANDARD +#endif // GEN_PASS_DEF_CONVERTAFFINETOSTANDARD + +//===----------------------------------------------------------------------===// +// ConvertArithToSPIRV +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTARITHTOSPIRV +struct ConvertArithToSPIRVOptions { + bool emulateLT32BitScalarTypes = true; + bool enableFastMath = false; +}; +#undef GEN_PASS_DECL_CONVERTARITHTOSPIRV +#endif // GEN_PASS_DECL_CONVERTARITHTOSPIRV +#ifdef GEN_PASS_DEF_CONVERTARITHTOSPIRV +namespace impl { + +template +class ConvertArithToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertArithToSPIRVBase; + + ConvertArithToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertArithToSPIRVBase(const ConvertArithToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-arith-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-arith-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Arith dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertArithToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertArithToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertArithToSPIRVBase) + + ConvertArithToSPIRVBase(const ConvertArithToSPIRVOptions &options) : ConvertArithToSPIRVBase() { + emulateLT32BitScalarTypes = options.emulateLT32BitScalarTypes; + enableFastMath = options.enableFastMath; + } +protected: + ::mlir::Pass::Option emulateLT32BitScalarTypes{*this, "emulate-lt-32-bit-scalar-types", ::llvm::cl::desc("Emulate narrower scalar types with 32-bit ones if not supported by the target"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option enableFastMath{*this, "enable-fast-math", ::llvm::cl::desc("Enable fast math mode (assuming no NaN and infinity for floating point values) when performing conversion"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTARITHTOSPIRV +#endif // GEN_PASS_DEF_CONVERTARITHTOSPIRV + +//===----------------------------------------------------------------------===// +// ConvertArmNeon2dToIntr +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTARMNEON2DTOINTR +#undef GEN_PASS_DECL_CONVERTARMNEON2DTOINTR +#endif // GEN_PASS_DECL_CONVERTARMNEON2DTOINTR +#ifdef GEN_PASS_DEF_CONVERTARMNEON2DTOINTR +namespace impl { + +template +class ConvertArmNeon2dToIntrBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertArmNeon2dToIntrBase; + + ConvertArmNeon2dToIntrBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertArmNeon2dToIntrBase(const ConvertArmNeon2dToIntrBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arm-neon-2d-to-intr"); + } + ::llvm::StringRef getArgument() const override { return "arm-neon-2d-to-intr"; } + + ::llvm::StringRef getDescription() const override { return "Convert Arm NEON structured ops to intrinsics"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertArmNeon2dToIntr"); + } + ::llvm::StringRef getName() const override { return "ConvertArmNeon2dToIntr"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertArmNeon2dToIntrBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTARMNEON2DTOINTR +#endif // GEN_PASS_DEF_CONVERTARMNEON2DTOINTR + +//===----------------------------------------------------------------------===// +// ConvertArmSMEToSCF +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTARMSMETOSCF +#undef GEN_PASS_DECL_CONVERTARMSMETOSCF +#endif // GEN_PASS_DECL_CONVERTARMSMETOSCF +#ifdef GEN_PASS_DEF_CONVERTARMSMETOSCF +namespace impl { + +template +class ConvertArmSMEToSCFBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertArmSMEToSCFBase; + + ConvertArmSMEToSCFBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertArmSMEToSCFBase(const ConvertArmSMEToSCFBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-arm-sme-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "convert-arm-sme-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the ArmSME dialect into the SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertArmSMEToSCF"); + } + ::llvm::StringRef getName() const override { return "ConvertArmSMEToSCF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertArmSMEToSCFBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTARMSMETOSCF +#endif // GEN_PASS_DEF_CONVERTARMSMETOSCF + +//===----------------------------------------------------------------------===// +// ConvertAsyncToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTASYNCTOLLVMPASS +struct ConvertAsyncToLLVMPassOptions { + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createConvertAsyncToLLVMPass(); +std::unique_ptr<::mlir::Pass> createConvertAsyncToLLVMPass(const ConvertAsyncToLLVMPassOptions &options); +#undef GEN_PASS_DECL_CONVERTASYNCTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTASYNCTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTASYNCTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertAsyncToLLVMPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertAsyncToLLVMPass(const ConvertAsyncToLLVMPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertAsyncToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertAsyncToLLVMPassBase; + + ConvertAsyncToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertAsyncToLLVMPassBase(const ConvertAsyncToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-async-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-async-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert the operations from the async dialect into the LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAsyncToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertAsyncToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAsyncToLLVMPassBase) + + ConvertAsyncToLLVMPassBase(const ConvertAsyncToLLVMPassOptions &options) : ConvertAsyncToLLVMPassBase() { + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertAsyncToLLVMPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertAsyncToLLVMPass(const ConvertAsyncToLLVMPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertAsyncToLLVMPass() { + return impl::createConvertAsyncToLLVMPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertAsyncToLLVMPass(const ConvertAsyncToLLVMPassOptions &options) { + return impl::createConvertAsyncToLLVMPass(options); +} +#undef GEN_PASS_DEF_CONVERTASYNCTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTASYNCTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertBufferizationToMemRef +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREF +#undef GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREF +#endif // GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREF +#ifdef GEN_PASS_DEF_CONVERTBUFFERIZATIONTOMEMREF +namespace impl { + +template +class ConvertBufferizationToMemRefBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertBufferizationToMemRefBase; + + ConvertBufferizationToMemRefBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertBufferizationToMemRefBase(const ConvertBufferizationToMemRefBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-bufferization-to-memref"); + } + ::llvm::StringRef getArgument() const override { return "convert-bufferization-to-memref"; } + + ::llvm::StringRef getDescription() const override { return "Convert operations from the Bufferization dialect to the MemRef dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertBufferizationToMemRef"); + } + ::llvm::StringRef getName() const override { return "ConvertBufferizationToMemRef"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertBufferizationToMemRefBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTBUFFERIZATIONTOMEMREF +#endif // GEN_PASS_DEF_CONVERTBUFFERIZATIONTOMEMREF + +//===----------------------------------------------------------------------===// +// ConvertComplexToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTCOMPLEXTOLLVMPASS +std::unique_ptr<::mlir::Pass> createConvertComplexToLLVMPass(); +#undef GEN_PASS_DECL_CONVERTCOMPLEXTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTCOMPLEXTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTCOMPLEXTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertComplexToLLVMPass(); +} // namespace impl +namespace impl { + +template +class ConvertComplexToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertComplexToLLVMPassBase; + + ConvertComplexToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertComplexToLLVMPassBase(const ConvertComplexToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-complex-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-complex-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Complex dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertComplexToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertComplexToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertComplexToLLVMPassBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createConvertComplexToLLVMPass() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertComplexToLLVMPass() { + return impl::createConvertComplexToLLVMPass(); +} +#undef GEN_PASS_DEF_CONVERTCOMPLEXTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTCOMPLEXTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertComplexToLibm +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTCOMPLEXTOLIBM +#undef GEN_PASS_DECL_CONVERTCOMPLEXTOLIBM +#endif // GEN_PASS_DECL_CONVERTCOMPLEXTOLIBM +#ifdef GEN_PASS_DEF_CONVERTCOMPLEXTOLIBM +namespace impl { + +template +class ConvertComplexToLibmBase : public ::mlir::OperationPass { +public: + using Base = ConvertComplexToLibmBase; + + ConvertComplexToLibmBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertComplexToLibmBase(const ConvertComplexToLibmBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-complex-to-libm"); + } + ::llvm::StringRef getArgument() const override { return "convert-complex-to-libm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Complex dialect to libm calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertComplexToLibm"); + } + ::llvm::StringRef getName() const override { return "ConvertComplexToLibm"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertComplexToLibmBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTCOMPLEXTOLIBM +#endif // GEN_PASS_DEF_CONVERTCOMPLEXTOLIBM + +//===----------------------------------------------------------------------===// +// ConvertComplexToSPIRVPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTCOMPLEXTOSPIRVPASS +std::unique_ptr<::mlir::Pass> createConvertComplexToSPIRVPass(); +#undef GEN_PASS_DECL_CONVERTCOMPLEXTOSPIRVPASS +#endif // GEN_PASS_DECL_CONVERTCOMPLEXTOSPIRVPASS +#ifdef GEN_PASS_DEF_CONVERTCOMPLEXTOSPIRVPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertComplexToSPIRVPass(); +} // namespace impl +namespace impl { + +template +class ConvertComplexToSPIRVPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertComplexToSPIRVPassBase; + + ConvertComplexToSPIRVPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertComplexToSPIRVPassBase(const ConvertComplexToSPIRVPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-complex-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-complex-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Complex dialect to SPIRV dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertComplexToSPIRVPass"); + } + ::llvm::StringRef getName() const override { return "ConvertComplexToSPIRVPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertComplexToSPIRVPassBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createConvertComplexToSPIRVPass() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertComplexToSPIRVPass() { + return impl::createConvertComplexToSPIRVPass(); +} +#undef GEN_PASS_DEF_CONVERTCOMPLEXTOSPIRVPASS +#endif // GEN_PASS_DEF_CONVERTCOMPLEXTOSPIRVPASS + +//===----------------------------------------------------------------------===// +// ConvertComplexToStandard +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARD +#undef GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARD +#endif // GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARD +#ifdef GEN_PASS_DEF_CONVERTCOMPLEXTOSTANDARD +namespace impl { + +template +class ConvertComplexToStandardBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertComplexToStandardBase; + + ConvertComplexToStandardBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertComplexToStandardBase(const ConvertComplexToStandardBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-complex-to-standard"); + } + ::llvm::StringRef getArgument() const override { return "convert-complex-to-standard"; } + + ::llvm::StringRef getDescription() const override { return "Convert Complex dialect to standard dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertComplexToStandard"); + } + ::llvm::StringRef getName() const override { return "ConvertComplexToStandard"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertComplexToStandardBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTCOMPLEXTOSTANDARD +#endif // GEN_PASS_DEF_CONVERTCOMPLEXTOSTANDARD + +//===----------------------------------------------------------------------===// +// ConvertControlFlowToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVMPASS +struct ConvertControlFlowToLLVMPassOptions { + unsigned indexBitwidth = 0; + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createConvertControlFlowToLLVMPass(); +std::unique_ptr<::mlir::Pass> createConvertControlFlowToLLVMPass(const ConvertControlFlowToLLVMPassOptions &options); +#undef GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTCONTROLFLOWTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertControlFlowToLLVMPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertControlFlowToLLVMPass(const ConvertControlFlowToLLVMPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertControlFlowToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertControlFlowToLLVMPassBase; + + ConvertControlFlowToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertControlFlowToLLVMPassBase(const ConvertControlFlowToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-cf-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-cf-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert ControlFlow operations to the LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertControlFlowToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertControlFlowToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertControlFlowToLLVMPassBase) + + ConvertControlFlowToLLVMPassBase(const ConvertControlFlowToLLVMPassOptions &options) : ConvertControlFlowToLLVMPassBase() { + indexBitwidth = options.indexBitwidth; + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertControlFlowToLLVMPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertControlFlowToLLVMPass(const ConvertControlFlowToLLVMPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertControlFlowToLLVMPass() { + return impl::createConvertControlFlowToLLVMPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertControlFlowToLLVMPass(const ConvertControlFlowToLLVMPassOptions &options) { + return impl::createConvertControlFlowToLLVMPass(options); +} +#undef GEN_PASS_DEF_CONVERTCONTROLFLOWTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTCONTROLFLOWTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertControlFlowToSPIRV +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTCONTROLFLOWTOSPIRV +struct ConvertControlFlowToSPIRVOptions { + bool emulateLT32BitScalarTypes = true; +}; +#undef GEN_PASS_DECL_CONVERTCONTROLFLOWTOSPIRV +#endif // GEN_PASS_DECL_CONVERTCONTROLFLOWTOSPIRV +#ifdef GEN_PASS_DEF_CONVERTCONTROLFLOWTOSPIRV +namespace impl { + +template +class ConvertControlFlowToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertControlFlowToSPIRVBase; + + ConvertControlFlowToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertControlFlowToSPIRVBase(const ConvertControlFlowToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-cf-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-cf-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert ControlFlow dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertControlFlowToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertControlFlowToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertControlFlowToSPIRVBase) + + ConvertControlFlowToSPIRVBase(const ConvertControlFlowToSPIRVOptions &options) : ConvertControlFlowToSPIRVBase() { + emulateLT32BitScalarTypes = options.emulateLT32BitScalarTypes; + } +protected: + ::mlir::Pass::Option emulateLT32BitScalarTypes{*this, "emulate-lt-32-bit-scalar-types", ::llvm::cl::desc("Emulate narrower scalar types with 32-bit ones if not supported by the target"), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTCONTROLFLOWTOSPIRV +#endif // GEN_PASS_DEF_CONVERTCONTROLFLOWTOSPIRV + +//===----------------------------------------------------------------------===// +// ConvertFuncToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTFUNCTOLLVMPASS +struct ConvertFuncToLLVMPassOptions { + bool useBarePtrCallConv = false; + unsigned indexBitwidth = 0; + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createConvertFuncToLLVMPass(); +std::unique_ptr<::mlir::Pass> createConvertFuncToLLVMPass(const ConvertFuncToLLVMPassOptions &options); +#undef GEN_PASS_DECL_CONVERTFUNCTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTFUNCTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTFUNCTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertFuncToLLVMPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertFuncToLLVMPass(const ConvertFuncToLLVMPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertFuncToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertFuncToLLVMPassBase; + + ConvertFuncToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertFuncToLLVMPassBase(const ConvertFuncToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-func-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-func-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert from the Func dialect to the LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertFuncToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertFuncToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertFuncToLLVMPassBase) + + ConvertFuncToLLVMPassBase(const ConvertFuncToLLVMPassOptions &options) : ConvertFuncToLLVMPassBase() { + useBarePtrCallConv = options.useBarePtrCallConv; + indexBitwidth = options.indexBitwidth; + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option useBarePtrCallConv{*this, "use-bare-ptr-memref-call-conv", ::llvm::cl::desc("Replace FuncOp's MemRef arguments with bare pointers to the MemRef element types"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertFuncToLLVMPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertFuncToLLVMPass(const ConvertFuncToLLVMPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertFuncToLLVMPass() { + return impl::createConvertFuncToLLVMPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertFuncToLLVMPass(const ConvertFuncToLLVMPassOptions &options) { + return impl::createConvertFuncToLLVMPass(options); +} +#undef GEN_PASS_DEF_CONVERTFUNCTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTFUNCTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertFuncToSPIRV +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTFUNCTOSPIRV +struct ConvertFuncToSPIRVOptions { + bool emulateLT32BitScalarTypes = true; +}; +#undef GEN_PASS_DECL_CONVERTFUNCTOSPIRV +#endif // GEN_PASS_DECL_CONVERTFUNCTOSPIRV +#ifdef GEN_PASS_DEF_CONVERTFUNCTOSPIRV +namespace impl { + +template +class ConvertFuncToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertFuncToSPIRVBase; + + ConvertFuncToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertFuncToSPIRVBase(const ConvertFuncToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-func-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-func-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Func dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertFuncToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertFuncToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertFuncToSPIRVBase) + + ConvertFuncToSPIRVBase(const ConvertFuncToSPIRVOptions &options) : ConvertFuncToSPIRVBase() { + emulateLT32BitScalarTypes = options.emulateLT32BitScalarTypes; + } +protected: + ::mlir::Pass::Option emulateLT32BitScalarTypes{*this, "emulate-lt-32-bit-scalar-types", ::llvm::cl::desc("Emulate narrower scalar types with 32-bit ones if not supported by the target"), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTFUNCTOSPIRV +#endif // GEN_PASS_DEF_CONVERTFUNCTOSPIRV + +//===----------------------------------------------------------------------===// +// ConvertGPUToSPIRV +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTGPUTOSPIRV +struct ConvertGPUToSPIRVOptions { + bool use64bitIndex = false; + bool useCoopMatrixNV = false; +}; +#undef GEN_PASS_DECL_CONVERTGPUTOSPIRV +#endif // GEN_PASS_DECL_CONVERTGPUTOSPIRV +#ifdef GEN_PASS_DEF_CONVERTGPUTOSPIRV +namespace impl { + +template +class ConvertGPUToSPIRVBase : public ::mlir::OperationPass { +public: + using Base = ConvertGPUToSPIRVBase; + + ConvertGPUToSPIRVBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGPUToSPIRVBase(const ConvertGPUToSPIRVBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-gpu-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-gpu-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert GPU dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGPUToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertGPUToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGPUToSPIRVBase) + + ConvertGPUToSPIRVBase(const ConvertGPUToSPIRVOptions &options) : ConvertGPUToSPIRVBase() { + use64bitIndex = options.use64bitIndex; + useCoopMatrixNV = options.useCoopMatrixNV; + } +protected: + ::mlir::Pass::Option use64bitIndex{*this, "use-64bit-index", ::llvm::cl::desc("Use 64-bit integers to convert index types"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useCoopMatrixNV{*this, "use-coop-matrix-nv", ::llvm::cl::desc("Use the NV cooperative matrix extension insted of the KHR extension to lower GPU WMMA ops"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTGPUTOSPIRV +#endif // GEN_PASS_DEF_CONVERTGPUTOSPIRV + +//===----------------------------------------------------------------------===// +// ConvertGpuLaunchFuncToVulkanLaunchFunc +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNC +#undef GEN_PASS_DECL_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNC +#endif // GEN_PASS_DECL_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNC +#ifdef GEN_PASS_DEF_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNC +namespace impl { + +template +class ConvertGpuLaunchFuncToVulkanLaunchFuncBase : public ::mlir::OperationPass { +public: + using Base = ConvertGpuLaunchFuncToVulkanLaunchFuncBase; + + ConvertGpuLaunchFuncToVulkanLaunchFuncBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGpuLaunchFuncToVulkanLaunchFuncBase(const ConvertGpuLaunchFuncToVulkanLaunchFuncBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-gpu-launch-to-vulkan-launch"); + } + ::llvm::StringRef getArgument() const override { return "convert-gpu-launch-to-vulkan-launch"; } + + ::llvm::StringRef getDescription() const override { return "Convert gpu.launch_func to vulkanLaunch external call"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGpuLaunchFuncToVulkanLaunchFunc"); + } + ::llvm::StringRef getName() const override { return "ConvertGpuLaunchFuncToVulkanLaunchFunc"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGpuLaunchFuncToVulkanLaunchFuncBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNC +#endif // GEN_PASS_DEF_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNC + +//===----------------------------------------------------------------------===// +// ConvertGpuOpsToNVVMOps +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTGPUOPSTONVVMOPS +struct ConvertGpuOpsToNVVMOpsOptions { + unsigned indexBitwidth = 0; + bool hasRedux = false; + bool useBarePtrCallConv = false; + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createConvertGpuOpsToNVVMOps(); +std::unique_ptr<::mlir::Pass> createConvertGpuOpsToNVVMOps(const ConvertGpuOpsToNVVMOpsOptions &options); +#undef GEN_PASS_DECL_CONVERTGPUOPSTONVVMOPS +#endif // GEN_PASS_DECL_CONVERTGPUOPSTONVVMOPS +#ifdef GEN_PASS_DEF_CONVERTGPUOPSTONVVMOPS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertGpuOpsToNVVMOps(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertGpuOpsToNVVMOps(const ConvertGpuOpsToNVVMOpsOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertGpuOpsToNVVMOpsBase : public ::mlir::OperationPass { +public: + using Base = ConvertGpuOpsToNVVMOpsBase; + + ConvertGpuOpsToNVVMOpsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGpuOpsToNVVMOpsBase(const ConvertGpuOpsToNVVMOpsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-gpu-to-nvvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-gpu-to-nvvm"; } + + ::llvm::StringRef getDescription() const override { return "Generate NVVM operations for gpu operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGpuOpsToNVVMOps"); + } + ::llvm::StringRef getName() const override { return "ConvertGpuOpsToNVVMOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGpuOpsToNVVMOpsBase) + + ConvertGpuOpsToNVVMOpsBase(const ConvertGpuOpsToNVVMOpsOptions &options) : ConvertGpuOpsToNVVMOpsBase() { + indexBitwidth = options.indexBitwidth; + hasRedux = options.hasRedux; + useBarePtrCallConv = options.useBarePtrCallConv; + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option hasRedux{*this, "has-redux", ::llvm::cl::desc("Target gpu supports redux"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useBarePtrCallConv{*this, "use-bare-ptr-memref-call-conv", ::llvm::cl::desc("Replace memref arguments in GPU functions with bare pointers. All memrefs must have static shape."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertGpuOpsToNVVMOps() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertGpuOpsToNVVMOps(const ConvertGpuOpsToNVVMOpsOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertGpuOpsToNVVMOps() { + return impl::createConvertGpuOpsToNVVMOps(); +} + +std::unique_ptr<::mlir::Pass> createConvertGpuOpsToNVVMOps(const ConvertGpuOpsToNVVMOpsOptions &options) { + return impl::createConvertGpuOpsToNVVMOps(options); +} +#undef GEN_PASS_DEF_CONVERTGPUOPSTONVVMOPS +#endif // GEN_PASS_DEF_CONVERTGPUOPSTONVVMOPS + +//===----------------------------------------------------------------------===// +// ConvertGpuOpsToROCDLOps +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTGPUOPSTOROCDLOPS +struct ConvertGpuOpsToROCDLOpsOptions { + std::string chipset = "gfx000"; + unsigned indexBitwidth = 0; + bool useBarePtrCallConv = false; + ::mlir::gpu::amd::Runtime runtime = ::mlir::gpu::amd::Runtime::Unknown; + bool useOpaquePointers = true; +}; +#undef GEN_PASS_DECL_CONVERTGPUOPSTOROCDLOPS +#endif // GEN_PASS_DECL_CONVERTGPUOPSTOROCDLOPS +#ifdef GEN_PASS_DEF_CONVERTGPUOPSTOROCDLOPS +namespace impl { + +template +class ConvertGpuOpsToROCDLOpsBase : public ::mlir::OperationPass { +public: + using Base = ConvertGpuOpsToROCDLOpsBase; + + ConvertGpuOpsToROCDLOpsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGpuOpsToROCDLOpsBase(const ConvertGpuOpsToROCDLOpsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-gpu-to-rocdl"); + } + ::llvm::StringRef getArgument() const override { return "convert-gpu-to-rocdl"; } + + ::llvm::StringRef getDescription() const override { return "Generate ROCDL operations for gpu operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGpuOpsToROCDLOps"); + } + ::llvm::StringRef getName() const override { return "ConvertGpuOpsToROCDLOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGpuOpsToROCDLOpsBase) + + ConvertGpuOpsToROCDLOpsBase(const ConvertGpuOpsToROCDLOpsOptions &options) : ConvertGpuOpsToROCDLOpsBase() { + chipset = options.chipset; + indexBitwidth = options.indexBitwidth; + useBarePtrCallConv = options.useBarePtrCallConv; + runtime = options.runtime; + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option chipset{*this, "chipset", ::llvm::cl::desc("Chipset that these operations will run on"), ::llvm::cl::init("gfx000")}; + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option useBarePtrCallConv{*this, "use-bare-ptr-memref-call-conv", ::llvm::cl::desc("Replace memref arguments in GPU functions with bare pointers.All memrefs must have static shape"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option<::mlir::gpu::amd::Runtime> runtime{*this, "runtime", ::llvm::cl::desc("Runtime code will be run on (default is Unknown, can also use HIP or OpenCl)"), ::llvm::cl::init(::mlir::gpu::amd::Runtime::Unknown), ::llvm::cl::values( + clEnumValN(::mlir::gpu::amd::Runtime::Unknown, "unknown", "Unknown (default)"), + clEnumValN(::mlir::gpu::amd::Runtime::HIP, "HIP", "HIP"), + clEnumValN(::mlir::gpu::amd::Runtime::OpenCL, "OpenCL", "OpenCL") + )}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTGPUOPSTOROCDLOPS +#endif // GEN_PASS_DEF_CONVERTGPUOPSTOROCDLOPS + +//===----------------------------------------------------------------------===// +// ConvertIndexToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTINDEXTOLLVMPASS +struct ConvertIndexToLLVMPassOptions { + unsigned indexBitwidth = 0; +}; +std::unique_ptr<::mlir::Pass> createConvertIndexToLLVMPass(); +std::unique_ptr<::mlir::Pass> createConvertIndexToLLVMPass(const ConvertIndexToLLVMPassOptions &options); +#undef GEN_PASS_DECL_CONVERTINDEXTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTINDEXTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTINDEXTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertIndexToLLVMPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertIndexToLLVMPass(const ConvertIndexToLLVMPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertIndexToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertIndexToLLVMPassBase; + + ConvertIndexToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertIndexToLLVMPassBase(const ConvertIndexToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-index-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-index-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Lower the `index` dialect to the `llvm` dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertIndexToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertIndexToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertIndexToLLVMPassBase) + + ConvertIndexToLLVMPassBase(const ConvertIndexToLLVMPassOptions &options) : ConvertIndexToLLVMPassBase() { + indexBitwidth = options.indexBitwidth; + } +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertIndexToLLVMPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertIndexToLLVMPass(const ConvertIndexToLLVMPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertIndexToLLVMPass() { + return impl::createConvertIndexToLLVMPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertIndexToLLVMPass(const ConvertIndexToLLVMPassOptions &options) { + return impl::createConvertIndexToLLVMPass(options); +} +#undef GEN_PASS_DEF_CONVERTINDEXTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTINDEXTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertLinalgToStandard +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTLINALGTOSTANDARD +#undef GEN_PASS_DECL_CONVERTLINALGTOSTANDARD +#endif // GEN_PASS_DECL_CONVERTLINALGTOSTANDARD +#ifdef GEN_PASS_DEF_CONVERTLINALGTOSTANDARD +namespace impl { + +template +class ConvertLinalgToStandardBase : public ::mlir::OperationPass { +public: + using Base = ConvertLinalgToStandardBase; + + ConvertLinalgToStandardBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLinalgToStandardBase(const ConvertLinalgToStandardBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-linalg-to-std"); + } + ::llvm::StringRef getArgument() const override { return "convert-linalg-to-std"; } + + ::llvm::StringRef getDescription() const override { return "Convert the operations from the linalg dialect into the Standard dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLinalgToStandard"); + } + ::llvm::StringRef getName() const override { return "ConvertLinalgToStandard"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLinalgToStandardBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTLINALGTOSTANDARD +#endif // GEN_PASS_DEF_CONVERTLINALGTOSTANDARD + +//===----------------------------------------------------------------------===// +// ConvertMathToFuncs +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTMATHTOFUNCS +struct ConvertMathToFuncsOptions { + unsigned minWidthOfFPowIExponent = 1; + bool convertCtlz = false; +}; +std::unique_ptr<::mlir::Pass> createConvertMathToFuncs(); +std::unique_ptr<::mlir::Pass> createConvertMathToFuncs(const ConvertMathToFuncsOptions &options); +#undef GEN_PASS_DECL_CONVERTMATHTOFUNCS +#endif // GEN_PASS_DECL_CONVERTMATHTOFUNCS +#ifdef GEN_PASS_DEF_CONVERTMATHTOFUNCS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertMathToFuncs(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertMathToFuncs(const ConvertMathToFuncsOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertMathToFuncsBase : public ::mlir::OperationPass { +public: + using Base = ConvertMathToFuncsBase; + + ConvertMathToFuncsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertMathToFuncsBase(const ConvertMathToFuncsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-math-to-funcs"); + } + ::llvm::StringRef getArgument() const override { return "convert-math-to-funcs"; } + + ::llvm::StringRef getDescription() const override { return "Convert Math operations to calls of outlined implementations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMathToFuncs"); + } + ::llvm::StringRef getName() const override { return "ConvertMathToFuncs"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMathToFuncsBase) + + ConvertMathToFuncsBase(const ConvertMathToFuncsOptions &options) : ConvertMathToFuncsBase() { + minWidthOfFPowIExponent = options.minWidthOfFPowIExponent; + convertCtlz = options.convertCtlz; + } +protected: + ::mlir::Pass::Option minWidthOfFPowIExponent{*this, "min-width-of-fpowi-exponent", ::llvm::cl::desc("Convert FPowI only if the width of its exponent's integer type is greater than or equal to this value"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option convertCtlz{*this, "convert-ctlz", ::llvm::cl::desc("Convert math.ctlz to a software implementation. Enable for targets that do not natively support ctlz."), ::llvm::cl::init(false)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertMathToFuncs() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertMathToFuncs(const ConvertMathToFuncsOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertMathToFuncs() { + return impl::createConvertMathToFuncs(); +} + +std::unique_ptr<::mlir::Pass> createConvertMathToFuncs(const ConvertMathToFuncsOptions &options) { + return impl::createConvertMathToFuncs(options); +} +#undef GEN_PASS_DEF_CONVERTMATHTOFUNCS +#endif // GEN_PASS_DEF_CONVERTMATHTOFUNCS + +//===----------------------------------------------------------------------===// +// ConvertMathToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTMATHTOLLVMPASS +struct ConvertMathToLLVMPassOptions { + bool approximateLog1p = true; +}; +std::unique_ptr<::mlir::Pass> createConvertMathToLLVMPass(); +std::unique_ptr<::mlir::Pass> createConvertMathToLLVMPass(const ConvertMathToLLVMPassOptions &options); +#undef GEN_PASS_DECL_CONVERTMATHTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTMATHTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTMATHTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertMathToLLVMPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertMathToLLVMPass(const ConvertMathToLLVMPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertMathToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertMathToLLVMPassBase; + + ConvertMathToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertMathToLLVMPassBase(const ConvertMathToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-math-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-math-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Math dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMathToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertMathToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMathToLLVMPassBase) + + ConvertMathToLLVMPassBase(const ConvertMathToLLVMPassOptions &options) : ConvertMathToLLVMPassBase() { + approximateLog1p = options.approximateLog1p; + } +protected: + ::mlir::Pass::Option approximateLog1p{*this, "approximate-log1p", ::llvm::cl::desc("Enable approximation of Log1p."), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertMathToLLVMPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertMathToLLVMPass(const ConvertMathToLLVMPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertMathToLLVMPass() { + return impl::createConvertMathToLLVMPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertMathToLLVMPass(const ConvertMathToLLVMPassOptions &options) { + return impl::createConvertMathToLLVMPass(options); +} +#undef GEN_PASS_DEF_CONVERTMATHTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTMATHTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertMathToLibm +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTMATHTOLIBM +#undef GEN_PASS_DECL_CONVERTMATHTOLIBM +#endif // GEN_PASS_DECL_CONVERTMATHTOLIBM +#ifdef GEN_PASS_DEF_CONVERTMATHTOLIBM +namespace impl { + +template +class ConvertMathToLibmBase : public ::mlir::OperationPass { +public: + using Base = ConvertMathToLibmBase; + + ConvertMathToLibmBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertMathToLibmBase(const ConvertMathToLibmBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-math-to-libm"); + } + ::llvm::StringRef getArgument() const override { return "convert-math-to-libm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Math dialect to libm calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMathToLibm"); + } + ::llvm::StringRef getName() const override { return "ConvertMathToLibm"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMathToLibmBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTMATHTOLIBM +#endif // GEN_PASS_DEF_CONVERTMATHTOLIBM + +//===----------------------------------------------------------------------===// +// ConvertMathToSPIRV +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTMATHTOSPIRV +#undef GEN_PASS_DECL_CONVERTMATHTOSPIRV +#endif // GEN_PASS_DECL_CONVERTMATHTOSPIRV +#ifdef GEN_PASS_DEF_CONVERTMATHTOSPIRV +namespace impl { + +template +class ConvertMathToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertMathToSPIRVBase; + + ConvertMathToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertMathToSPIRVBase(const ConvertMathToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-math-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-math-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Math dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMathToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertMathToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMathToSPIRVBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTMATHTOSPIRV +#endif // GEN_PASS_DEF_CONVERTMATHTOSPIRV + +//===----------------------------------------------------------------------===// +// ConvertMemRefToSPIRV +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTMEMREFTOSPIRV +struct ConvertMemRefToSPIRVOptions { + int boolNumBits = 8; + bool use64bitIndex = false; +}; +#undef GEN_PASS_DECL_CONVERTMEMREFTOSPIRV +#endif // GEN_PASS_DECL_CONVERTMEMREFTOSPIRV +#ifdef GEN_PASS_DEF_CONVERTMEMREFTOSPIRV +namespace impl { + +template +class ConvertMemRefToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertMemRefToSPIRVBase; + + ConvertMemRefToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertMemRefToSPIRVBase(const ConvertMemRefToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-memref-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-memref-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert MemRef dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMemRefToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertMemRefToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMemRefToSPIRVBase) + + ConvertMemRefToSPIRVBase(const ConvertMemRefToSPIRVOptions &options) : ConvertMemRefToSPIRVBase() { + boolNumBits = options.boolNumBits; + use64bitIndex = options.use64bitIndex; + } +protected: + ::mlir::Pass::Option boolNumBits{*this, "bool-num-bits", ::llvm::cl::desc("The number of bits to store a boolean value"), ::llvm::cl::init(8)}; + ::mlir::Pass::Option use64bitIndex{*this, "use-64bit-index", ::llvm::cl::desc("Use 64-bit integers to convert index types"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTMEMREFTOSPIRV +#endif // GEN_PASS_DEF_CONVERTMEMREFTOSPIRV + +//===----------------------------------------------------------------------===// +// ConvertNVGPUToNVVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTNVGPUTONVVMPASS +struct ConvertNVGPUToNVVMPassOptions { + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createConvertNVGPUToNVVMPass(); +std::unique_ptr<::mlir::Pass> createConvertNVGPUToNVVMPass(const ConvertNVGPUToNVVMPassOptions &options); +#undef GEN_PASS_DECL_CONVERTNVGPUTONVVMPASS +#endif // GEN_PASS_DECL_CONVERTNVGPUTONVVMPASS +#ifdef GEN_PASS_DEF_CONVERTNVGPUTONVVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertNVGPUToNVVMPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertNVGPUToNVVMPass(const ConvertNVGPUToNVVMPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertNVGPUToNVVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertNVGPUToNVVMPassBase; + + ConvertNVGPUToNVVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertNVGPUToNVVMPassBase(const ConvertNVGPUToNVVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-nvgpu-to-nvvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-nvgpu-to-nvvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert NVGPU dialect to NVVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertNVGPUToNVVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertNVGPUToNVVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertNVGPUToNVVMPassBase) + + ConvertNVGPUToNVVMPassBase(const ConvertNVGPUToNVVMPassOptions &options) : ConvertNVGPUToNVVMPassBase() { + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertNVGPUToNVVMPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertNVGPUToNVVMPass(const ConvertNVGPUToNVVMPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertNVGPUToNVVMPass() { + return impl::createConvertNVGPUToNVVMPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertNVGPUToNVVMPass(const ConvertNVGPUToNVVMPassOptions &options) { + return impl::createConvertNVGPUToNVVMPass(options); +} +#undef GEN_PASS_DEF_CONVERTNVGPUTONVVMPASS +#endif // GEN_PASS_DEF_CONVERTNVGPUTONVVMPASS + +//===----------------------------------------------------------------------===// +// ConvertNVVMToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTNVVMTOLLVMPASS +std::unique_ptr<::mlir::Pass> createConvertNVVMToLLVMPass(); +#undef GEN_PASS_DECL_CONVERTNVVMTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTNVVMTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTNVVMTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertNVVMToLLVMPass(); +} // namespace impl +namespace impl { + +template +class ConvertNVVMToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertNVVMToLLVMPassBase; + + ConvertNVVMToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertNVVMToLLVMPassBase(const ConvertNVVMToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-nvvm-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-nvvm-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert NVVM dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertNVVMToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertNVVMToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertNVVMToLLVMPassBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createConvertNVVMToLLVMPass() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertNVVMToLLVMPass() { + return impl::createConvertNVVMToLLVMPass(); +} +#undef GEN_PASS_DEF_CONVERTNVVMTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTNVVMTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertOpenACCToSCF +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTOPENACCTOSCF +#undef GEN_PASS_DECL_CONVERTOPENACCTOSCF +#endif // GEN_PASS_DECL_CONVERTOPENACCTOSCF +#ifdef GEN_PASS_DEF_CONVERTOPENACCTOSCF +namespace impl { + +template +class ConvertOpenACCToSCFBase : public ::mlir::OperationPass { +public: + using Base = ConvertOpenACCToSCFBase; + + ConvertOpenACCToSCFBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertOpenACCToSCFBase(const ConvertOpenACCToSCFBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-openacc-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "convert-openacc-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Convert the OpenACC ops to OpenACC with SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertOpenACCToSCF"); + } + ::llvm::StringRef getName() const override { return "ConvertOpenACCToSCF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertOpenACCToSCFBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTOPENACCTOSCF +#endif // GEN_PASS_DEF_CONVERTOPENACCTOSCF + +//===----------------------------------------------------------------------===// +// ConvertOpenMPToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTOPENMPTOLLVMPASS +std::unique_ptr<::mlir::Pass> createConvertOpenMPToLLVMPass(); +#undef GEN_PASS_DECL_CONVERTOPENMPTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTOPENMPTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTOPENMPTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertOpenMPToLLVMPass(); +} // namespace impl +namespace impl { + +template +class ConvertOpenMPToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertOpenMPToLLVMPassBase; + + ConvertOpenMPToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertOpenMPToLLVMPassBase(const ConvertOpenMPToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-openmp-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-openmp-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert the OpenMP ops to OpenMP ops with LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertOpenMPToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertOpenMPToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertOpenMPToLLVMPassBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createConvertOpenMPToLLVMPass() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertOpenMPToLLVMPass() { + return impl::createConvertOpenMPToLLVMPass(); +} +#undef GEN_PASS_DEF_CONVERTOPENMPTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTOPENMPTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertPDLToPDLInterp +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTPDLTOPDLINTERP +#undef GEN_PASS_DECL_CONVERTPDLTOPDLINTERP +#endif // GEN_PASS_DECL_CONVERTPDLTOPDLINTERP +#ifdef GEN_PASS_DEF_CONVERTPDLTOPDLINTERP +namespace impl { + +template +class ConvertPDLToPDLInterpBase : public ::mlir::OperationPass { +public: + using Base = ConvertPDLToPDLInterpBase; + + ConvertPDLToPDLInterpBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertPDLToPDLInterpBase(const ConvertPDLToPDLInterpBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-pdl-to-pdl-interp"); + } + ::llvm::StringRef getArgument() const override { return "convert-pdl-to-pdl-interp"; } + + ::llvm::StringRef getDescription() const override { return "Convert PDL ops to PDL interpreter ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertPDLToPDLInterp"); + } + ::llvm::StringRef getName() const override { return "ConvertPDLToPDLInterp"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertPDLToPDLInterpBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTPDLTOPDLINTERP +#endif // GEN_PASS_DEF_CONVERTPDLTOPDLINTERP + +//===----------------------------------------------------------------------===// +// ConvertParallelLoopToGpu +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTPARALLELLOOPTOGPU +#undef GEN_PASS_DECL_CONVERTPARALLELLOOPTOGPU +#endif // GEN_PASS_DECL_CONVERTPARALLELLOOPTOGPU +#ifdef GEN_PASS_DEF_CONVERTPARALLELLOOPTOGPU +namespace impl { + +template +class ConvertParallelLoopToGpuBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertParallelLoopToGpuBase; + + ConvertParallelLoopToGpuBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertParallelLoopToGpuBase(const ConvertParallelLoopToGpuBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-parallel-loops-to-gpu"); + } + ::llvm::StringRef getArgument() const override { return "convert-parallel-loops-to-gpu"; } + + ::llvm::StringRef getDescription() const override { return "Convert mapped scf.parallel ops to gpu launch operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertParallelLoopToGpu"); + } + ::llvm::StringRef getName() const override { return "ConvertParallelLoopToGpu"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertParallelLoopToGpuBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTPARALLELLOOPTOGPU +#endif // GEN_PASS_DEF_CONVERTPARALLELLOOPTOGPU + +//===----------------------------------------------------------------------===// +// ConvertSCFToOpenMPPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTSCFTOOPENMPPASS +struct ConvertSCFToOpenMPPassOptions { + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createConvertSCFToOpenMPPass(); +std::unique_ptr<::mlir::Pass> createConvertSCFToOpenMPPass(const ConvertSCFToOpenMPPassOptions &options); +#undef GEN_PASS_DECL_CONVERTSCFTOOPENMPPASS +#endif // GEN_PASS_DECL_CONVERTSCFTOOPENMPPASS +#ifdef GEN_PASS_DEF_CONVERTSCFTOOPENMPPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertSCFToOpenMPPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertSCFToOpenMPPass(const ConvertSCFToOpenMPPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertSCFToOpenMPPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertSCFToOpenMPPassBase; + + ConvertSCFToOpenMPPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertSCFToOpenMPPassBase(const ConvertSCFToOpenMPPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-scf-to-openmp"); + } + ::llvm::StringRef getArgument() const override { return "convert-scf-to-openmp"; } + + ::llvm::StringRef getDescription() const override { return "Convert SCF parallel loop to OpenMP parallel + workshare constructs."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertSCFToOpenMPPass"); + } + ::llvm::StringRef getName() const override { return "ConvertSCFToOpenMPPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertSCFToOpenMPPassBase) + + ConvertSCFToOpenMPPassBase(const ConvertSCFToOpenMPPassOptions &options) : ConvertSCFToOpenMPPassBase() { + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertSCFToOpenMPPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertSCFToOpenMPPass(const ConvertSCFToOpenMPPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertSCFToOpenMPPass() { + return impl::createConvertSCFToOpenMPPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertSCFToOpenMPPass(const ConvertSCFToOpenMPPassOptions &options) { + return impl::createConvertSCFToOpenMPPass(options); +} +#undef GEN_PASS_DEF_CONVERTSCFTOOPENMPPASS +#endif // GEN_PASS_DEF_CONVERTSCFTOOPENMPPASS + +//===----------------------------------------------------------------------===// +// ConvertSPIRVToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTSPIRVTOLLVMPASS +struct ConvertSPIRVToLLVMPassOptions { + bool useOpaquePointers = true; + ::mlir::spirv::ClientAPI clientAPI = ::mlir::spirv::ClientAPI::Unknown; +}; +std::unique_ptr<::mlir::Pass> createConvertSPIRVToLLVMPass(); +std::unique_ptr<::mlir::Pass> createConvertSPIRVToLLVMPass(const ConvertSPIRVToLLVMPassOptions &options); +#undef GEN_PASS_DECL_CONVERTSPIRVTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTSPIRVTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTSPIRVTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertSPIRVToLLVMPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertSPIRVToLLVMPass(const ConvertSPIRVToLLVMPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertSPIRVToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertSPIRVToLLVMPassBase; + + ConvertSPIRVToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertSPIRVToLLVMPassBase(const ConvertSPIRVToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-spirv-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-spirv-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert SPIR-V dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertSPIRVToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertSPIRVToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertSPIRVToLLVMPassBase) + + ConvertSPIRVToLLVMPassBase(const ConvertSPIRVToLLVMPassOptions &options) : ConvertSPIRVToLLVMPassBase() { + useOpaquePointers = options.useOpaquePointers; + clientAPI = options.clientAPI; + } +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option<::mlir::spirv::ClientAPI> clientAPI{*this, "client-api", ::llvm::cl::desc("Derive StorageClass to address space mapping from the client API"), ::llvm::cl::init(::mlir::spirv::ClientAPI::Unknown), ::llvm::cl::values( + clEnumValN(::mlir::spirv::ClientAPI::Unknown, "Unknown", "Unknown (default)"), + clEnumValN(::mlir::spirv::ClientAPI::Metal, "Metal", "Metal"), + clEnumValN(::mlir::spirv::ClientAPI::OpenCL, "OpenCL", "OpenCL"), + clEnumValN(::mlir::spirv::ClientAPI::Vulkan, "Vulkan", "Vulkan"), + clEnumValN(::mlir::spirv::ClientAPI::WebGPU, "WebGPU", "WebGPU") + )}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertSPIRVToLLVMPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertSPIRVToLLVMPass(const ConvertSPIRVToLLVMPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertSPIRVToLLVMPass() { + return impl::createConvertSPIRVToLLVMPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertSPIRVToLLVMPass(const ConvertSPIRVToLLVMPassOptions &options) { + return impl::createConvertSPIRVToLLVMPass(options); +} +#undef GEN_PASS_DEF_CONVERTSPIRVTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTSPIRVTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertShapeConstraints +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTSHAPECONSTRAINTS +#undef GEN_PASS_DECL_CONVERTSHAPECONSTRAINTS +#endif // GEN_PASS_DECL_CONVERTSHAPECONSTRAINTS +#ifdef GEN_PASS_DEF_CONVERTSHAPECONSTRAINTS +namespace impl { + +template +class ConvertShapeConstraintsBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertShapeConstraintsBase; + + ConvertShapeConstraintsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertShapeConstraintsBase(const ConvertShapeConstraintsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-shape-constraints"); + } + ::llvm::StringRef getArgument() const override { return "convert-shape-constraints"; } + + ::llvm::StringRef getDescription() const override { return "Convert shape constraint operations to the standard dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertShapeConstraints"); + } + ::llvm::StringRef getName() const override { return "ConvertShapeConstraints"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertShapeConstraintsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTSHAPECONSTRAINTS +#endif // GEN_PASS_DEF_CONVERTSHAPECONSTRAINTS + +//===----------------------------------------------------------------------===// +// ConvertShapeToStandard +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTSHAPETOSTANDARD +#undef GEN_PASS_DECL_CONVERTSHAPETOSTANDARD +#endif // GEN_PASS_DECL_CONVERTSHAPETOSTANDARD +#ifdef GEN_PASS_DEF_CONVERTSHAPETOSTANDARD +namespace impl { + +template +class ConvertShapeToStandardBase : public ::mlir::OperationPass { +public: + using Base = ConvertShapeToStandardBase; + + ConvertShapeToStandardBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertShapeToStandardBase(const ConvertShapeToStandardBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-shape-to-std"); + } + ::llvm::StringRef getArgument() const override { return "convert-shape-to-std"; } + + ::llvm::StringRef getDescription() const override { return "Convert operations from the shape dialect into the standard dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertShapeToStandard"); + } + ::llvm::StringRef getName() const override { return "ConvertShapeToStandard"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertShapeToStandardBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTSHAPETOSTANDARD +#endif // GEN_PASS_DEF_CONVERTSHAPETOSTANDARD + +//===----------------------------------------------------------------------===// +// ConvertTensorToLinalg +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTTENSORTOLINALG +#undef GEN_PASS_DECL_CONVERTTENSORTOLINALG +#endif // GEN_PASS_DECL_CONVERTTENSORTOLINALG +#ifdef GEN_PASS_DEF_CONVERTTENSORTOLINALG +namespace impl { + +template +class ConvertTensorToLinalgBase : public ::mlir::OperationPass { +public: + using Base = ConvertTensorToLinalgBase; + + ConvertTensorToLinalgBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertTensorToLinalgBase(const ConvertTensorToLinalgBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-tensor-to-linalg"); + } + ::llvm::StringRef getArgument() const override { return "convert-tensor-to-linalg"; } + + ::llvm::StringRef getDescription() const override { return "Convert some Tensor dialect ops to Linalg dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTensorToLinalg"); + } + ::llvm::StringRef getName() const override { return "ConvertTensorToLinalg"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTensorToLinalgBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTTENSORTOLINALG +#endif // GEN_PASS_DEF_CONVERTTENSORTOLINALG + +//===----------------------------------------------------------------------===// +// ConvertTensorToSPIRV +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTTENSORTOSPIRV +struct ConvertTensorToSPIRVOptions { + bool emulateLT32BitScalarTypes = true; +}; +#undef GEN_PASS_DECL_CONVERTTENSORTOSPIRV +#endif // GEN_PASS_DECL_CONVERTTENSORTOSPIRV +#ifdef GEN_PASS_DEF_CONVERTTENSORTOSPIRV +namespace impl { + +template +class ConvertTensorToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertTensorToSPIRVBase; + + ConvertTensorToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertTensorToSPIRVBase(const ConvertTensorToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-tensor-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-tensor-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Tensor dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTensorToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertTensorToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTensorToSPIRVBase) + + ConvertTensorToSPIRVBase(const ConvertTensorToSPIRVOptions &options) : ConvertTensorToSPIRVBase() { + emulateLT32BitScalarTypes = options.emulateLT32BitScalarTypes; + } +protected: + ::mlir::Pass::Option emulateLT32BitScalarTypes{*this, "emulate-lt-32-bit-scalar-types", ::llvm::cl::desc("Emulate narrower scalar types with 32-bit ones if not supported by the target"), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTTENSORTOSPIRV +#endif // GEN_PASS_DEF_CONVERTTENSORTOSPIRV + +//===----------------------------------------------------------------------===// +// ConvertToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTTOLLVMPASS +struct ConvertToLLVMPassOptions { + ::llvm::ArrayRef filterDialects; +}; +#undef GEN_PASS_DECL_CONVERTTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTTOLLVMPASS +namespace impl { + +template +class ConvertToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertToLLVMPassBase; + + ConvertToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertToLLVMPassBase(const ConvertToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert to LLVM via dialect interfaces found in the input IR"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertToLLVMPassBase) + + ConvertToLLVMPassBase(const ConvertToLLVMPassOptions &options) : ConvertToLLVMPassBase() { + filterDialects = options.filterDialects; + } +protected: + ::mlir::Pass::ListOption filterDialects{*this, "filter-dialects", ::llvm::cl::desc("Test conversion patterns of only the specified dialects")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertVectorToArmSME +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTVECTORTOARMSME +std::unique_ptr<::mlir::Pass> createConvertVectorToArmSME(); +#undef GEN_PASS_DECL_CONVERTVECTORTOARMSME +#endif // GEN_PASS_DECL_CONVERTVECTORTOARMSME +#ifdef GEN_PASS_DEF_CONVERTVECTORTOARMSME + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertVectorToArmSME(); +} // namespace impl +namespace impl { + +template +class ConvertVectorToArmSMEBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToArmSMEBase; + + ConvertVectorToArmSMEBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToArmSMEBase(const ConvertVectorToArmSMEBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-arm-sme"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-arm-sme"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the vector dialect into the ArmSME dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToArmSME"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToArmSME"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToArmSMEBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createConvertVectorToArmSME() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertVectorToArmSME() { + return impl::createConvertVectorToArmSME(); +} +#undef GEN_PASS_DEF_CONVERTVECTORTOARMSME +#endif // GEN_PASS_DEF_CONVERTVECTORTOARMSME + +//===----------------------------------------------------------------------===// +// ConvertVectorToGPU +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTVECTORTOGPU +struct ConvertVectorToGPUOptions { + bool useNvGpu = false; +}; +#undef GEN_PASS_DECL_CONVERTVECTORTOGPU +#endif // GEN_PASS_DECL_CONVERTVECTORTOGPU +#ifdef GEN_PASS_DEF_CONVERTVECTORTOGPU +namespace impl { + +template +class ConvertVectorToGPUBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToGPUBase; + + ConvertVectorToGPUBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToGPUBase(const ConvertVectorToGPUBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-gpu"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-gpu"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the vector dialect into the GPU dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToGPU"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToGPU"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToGPUBase) + + ConvertVectorToGPUBase(const ConvertVectorToGPUOptions &options) : ConvertVectorToGPUBase() { + useNvGpu = options.useNvGpu; + } +protected: + ::mlir::Pass::Option useNvGpu{*this, "use-nvgpu", ::llvm::cl::desc("convert to NvGPU ops instead of GPU dialect ops"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTVECTORTOGPU +#endif // GEN_PASS_DEF_CONVERTVECTORTOGPU + +//===----------------------------------------------------------------------===// +// ConvertVectorToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTVECTORTOLLVMPASS +struct ConvertVectorToLLVMPassOptions { + bool reassociateFPReductions = false; + bool force32BitVectorIndices = true; + bool amx = false; + bool armNeon = false; + bool armSVE = false; + bool armSME = false; + bool x86Vector = false; + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createConvertVectorToLLVMPass(); +std::unique_ptr<::mlir::Pass> createConvertVectorToLLVMPass(const ConvertVectorToLLVMPassOptions &options); +#undef GEN_PASS_DECL_CONVERTVECTORTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTVECTORTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTVECTORTOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertVectorToLLVMPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertVectorToLLVMPass(const ConvertVectorToLLVMPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertVectorToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToLLVMPassBase; + + ConvertVectorToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToLLVMPassBase(const ConvertVectorToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the vector dialect into the LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToLLVMPassBase) + + ConvertVectorToLLVMPassBase(const ConvertVectorToLLVMPassOptions &options) : ConvertVectorToLLVMPassBase() { + reassociateFPReductions = options.reassociateFPReductions; + force32BitVectorIndices = options.force32BitVectorIndices; + amx = options.amx; + armNeon = options.armNeon; + armSVE = options.armSVE; + armSME = options.armSME; + x86Vector = options.x86Vector; + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option reassociateFPReductions{*this, "reassociate-fp-reductions", ::llvm::cl::desc("Allows llvm to reassociate floating-point reductions for speed"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option force32BitVectorIndices{*this, "force-32bit-vector-indices", ::llvm::cl::desc("Allows compiler to assume vector indices fit in 32-bit if that yields faster code"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option amx{*this, "enable-amx", ::llvm::cl::desc("Enables the use of AMX dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option armNeon{*this, "enable-arm-neon", ::llvm::cl::desc("Enables the use of ArmNeon dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option armSVE{*this, "enable-arm-sve", ::llvm::cl::desc("Enables the use of ArmSVE dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option armSME{*this, "enable-arm-sme", ::llvm::cl::desc("Enables the use of ArmSME dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option x86Vector{*this, "enable-x86vector", ::llvm::cl::desc("Enables the use of X86Vector dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertVectorToLLVMPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertVectorToLLVMPass(const ConvertVectorToLLVMPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertVectorToLLVMPass() { + return impl::createConvertVectorToLLVMPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertVectorToLLVMPass(const ConvertVectorToLLVMPassOptions &options) { + return impl::createConvertVectorToLLVMPass(options); +} +#undef GEN_PASS_DEF_CONVERTVECTORTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTVECTORTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertVectorToSCF +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTVECTORTOSCF +struct ConvertVectorToSCFOptions { + bool fullUnroll = false; + unsigned targetRank = 1; + bool lowerTensors = false; +}; +#undef GEN_PASS_DECL_CONVERTVECTORTOSCF +#endif // GEN_PASS_DECL_CONVERTVECTORTOSCF +#ifdef GEN_PASS_DEF_CONVERTVECTORTOSCF +namespace impl { + +template +class ConvertVectorToSCFBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToSCFBase; + + ConvertVectorToSCFBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToSCFBase(const ConvertVectorToSCFBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the vector dialect into the SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToSCF"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToSCF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToSCFBase) + + ConvertVectorToSCFBase(const ConvertVectorToSCFOptions &options) : ConvertVectorToSCFBase() { + fullUnroll = options.fullUnroll; + targetRank = options.targetRank; + lowerTensors = options.lowerTensors; + } +protected: + ::mlir::Pass::Option fullUnroll{*this, "full-unroll", ::llvm::cl::desc("Perform full unrolling when converting vector transfers to SCF"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option targetRank{*this, "target-rank", ::llvm::cl::desc("Target vector rank to which transfer ops should be lowered"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option lowerTensors{*this, "lower-tensors", ::llvm::cl::desc("Lower transfer ops that operate on tensors"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTVECTORTOSCF +#endif // GEN_PASS_DEF_CONVERTVECTORTOSCF + +//===----------------------------------------------------------------------===// +// ConvertVectorToSPIRV +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTVECTORTOSPIRV +#undef GEN_PASS_DECL_CONVERTVECTORTOSPIRV +#endif // GEN_PASS_DECL_CONVERTVECTORTOSPIRV +#ifdef GEN_PASS_DEF_CONVERTVECTORTOSPIRV +namespace impl { + +template +class ConvertVectorToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToSPIRVBase; + + ConvertVectorToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToSPIRVBase(const ConvertVectorToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Vector dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToSPIRVBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTVECTORTOSPIRV +#endif // GEN_PASS_DEF_CONVERTVECTORTOSPIRV + +//===----------------------------------------------------------------------===// +// ConvertVulkanLaunchFuncToVulkanCallsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS +struct ConvertVulkanLaunchFuncToVulkanCallsPassOptions { + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createConvertVulkanLaunchFuncToVulkanCallsPass(); +std::unique_ptr<::mlir::Pass> createConvertVulkanLaunchFuncToVulkanCallsPass(const ConvertVulkanLaunchFuncToVulkanCallsPassOptions &options); +#undef GEN_PASS_DECL_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS +#endif // GEN_PASS_DECL_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS +#ifdef GEN_PASS_DEF_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertVulkanLaunchFuncToVulkanCallsPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createConvertVulkanLaunchFuncToVulkanCallsPass(const ConvertVulkanLaunchFuncToVulkanCallsPassOptions &options); +} // namespace impl +namespace impl { + +template +class ConvertVulkanLaunchFuncToVulkanCallsPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertVulkanLaunchFuncToVulkanCallsPassBase; + + ConvertVulkanLaunchFuncToVulkanCallsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertVulkanLaunchFuncToVulkanCallsPassBase(const ConvertVulkanLaunchFuncToVulkanCallsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("launch-func-to-vulkan"); + } + ::llvm::StringRef getArgument() const override { return "launch-func-to-vulkan"; } + + ::llvm::StringRef getDescription() const override { return "Convert vulkanLaunch external call to Vulkan runtime external calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVulkanLaunchFuncToVulkanCallsPass"); + } + ::llvm::StringRef getName() const override { return "ConvertVulkanLaunchFuncToVulkanCallsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVulkanLaunchFuncToVulkanCallsPassBase) + + ConvertVulkanLaunchFuncToVulkanCallsPassBase(const ConvertVulkanLaunchFuncToVulkanCallsPassOptions &options) : ConvertVulkanLaunchFuncToVulkanCallsPassBase() { + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createConvertVulkanLaunchFuncToVulkanCallsPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createConvertVulkanLaunchFuncToVulkanCallsPass(const ConvertVulkanLaunchFuncToVulkanCallsPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createConvertVulkanLaunchFuncToVulkanCallsPass() { + return impl::createConvertVulkanLaunchFuncToVulkanCallsPass(); +} + +std::unique_ptr<::mlir::Pass> createConvertVulkanLaunchFuncToVulkanCallsPass(const ConvertVulkanLaunchFuncToVulkanCallsPassOptions &options) { + return impl::createConvertVulkanLaunchFuncToVulkanCallsPass(options); +} +#undef GEN_PASS_DEF_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS +#endif // GEN_PASS_DEF_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS + +//===----------------------------------------------------------------------===// +// FinalizeMemRefToLLVMConversionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FINALIZEMEMREFTOLLVMCONVERSIONPASS +struct FinalizeMemRefToLLVMConversionPassOptions { + bool useAlignedAlloc = false; + unsigned indexBitwidth = 0; + bool useGenericFunctions = false; + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createFinalizeMemRefToLLVMConversionPass(); +std::unique_ptr<::mlir::Pass> createFinalizeMemRefToLLVMConversionPass(const FinalizeMemRefToLLVMConversionPassOptions &options); +#undef GEN_PASS_DECL_FINALIZEMEMREFTOLLVMCONVERSIONPASS +#endif // GEN_PASS_DECL_FINALIZEMEMREFTOLLVMCONVERSIONPASS +#ifdef GEN_PASS_DEF_FINALIZEMEMREFTOLLVMCONVERSIONPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createFinalizeMemRefToLLVMConversionPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createFinalizeMemRefToLLVMConversionPass(const FinalizeMemRefToLLVMConversionPassOptions &options); +} // namespace impl +namespace impl { + +template +class FinalizeMemRefToLLVMConversionPassBase : public ::mlir::OperationPass { +public: + using Base = FinalizeMemRefToLLVMConversionPassBase; + + FinalizeMemRefToLLVMConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FinalizeMemRefToLLVMConversionPassBase(const FinalizeMemRefToLLVMConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("finalize-memref-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "finalize-memref-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Finalize MemRef dialect to LLVM dialect conversion"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FinalizeMemRefToLLVMConversionPass"); + } + ::llvm::StringRef getName() const override { return "FinalizeMemRefToLLVMConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FinalizeMemRefToLLVMConversionPassBase) + + FinalizeMemRefToLLVMConversionPassBase(const FinalizeMemRefToLLVMConversionPassOptions &options) : FinalizeMemRefToLLVMConversionPassBase() { + useAlignedAlloc = options.useAlignedAlloc; + indexBitwidth = options.indexBitwidth; + useGenericFunctions = options.useGenericFunctions; + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option useAlignedAlloc{*this, "use-aligned-alloc", ::llvm::cl::desc("Use aligned_alloc in place of malloc for heap allocations"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option useGenericFunctions{*this, "use-generic-functions", ::llvm::cl::desc("Use generic allocation and deallocation functions instead of the classic 'malloc', 'aligned_alloc' and 'free' functions"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createFinalizeMemRefToLLVMConversionPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createFinalizeMemRefToLLVMConversionPass(const FinalizeMemRefToLLVMConversionPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createFinalizeMemRefToLLVMConversionPass() { + return impl::createFinalizeMemRefToLLVMConversionPass(); +} + +std::unique_ptr<::mlir::Pass> createFinalizeMemRefToLLVMConversionPass(const FinalizeMemRefToLLVMConversionPassOptions &options) { + return impl::createFinalizeMemRefToLLVMConversionPass(options); +} +#undef GEN_PASS_DEF_FINALIZEMEMREFTOLLVMCONVERSIONPASS +#endif // GEN_PASS_DEF_FINALIZEMEMREFTOLLVMCONVERSIONPASS + +//===----------------------------------------------------------------------===// +// GpuToLLVMConversionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUTOLLVMCONVERSIONPASS +struct GpuToLLVMConversionPassOptions { + bool hostBarePtrCallConv = false; + bool kernelBarePtrCallConv = false; + std::string gpuBinaryAnnotation = gpu::getDefaultGpuBinaryAnnotation(); + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createGpuToLLVMConversionPass(); +std::unique_ptr<::mlir::Pass> createGpuToLLVMConversionPass(const GpuToLLVMConversionPassOptions &options); +#undef GEN_PASS_DECL_GPUTOLLVMCONVERSIONPASS +#endif // GEN_PASS_DECL_GPUTOLLVMCONVERSIONPASS +#ifdef GEN_PASS_DEF_GPUTOLLVMCONVERSIONPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createGpuToLLVMConversionPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createGpuToLLVMConversionPass(const GpuToLLVMConversionPassOptions &options); +} // namespace impl +namespace impl { + +template +class GpuToLLVMConversionPassBase : public ::mlir::OperationPass { +public: + using Base = GpuToLLVMConversionPassBase; + + GpuToLLVMConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuToLLVMConversionPassBase(const GpuToLLVMConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "gpu-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert GPU dialect to LLVM dialect with GPU runtime calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuToLLVMConversionPass"); + } + ::llvm::StringRef getName() const override { return "GpuToLLVMConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuToLLVMConversionPassBase) + + GpuToLLVMConversionPassBase(const GpuToLLVMConversionPassOptions &options) : GpuToLLVMConversionPassBase() { + hostBarePtrCallConv = options.hostBarePtrCallConv; + kernelBarePtrCallConv = options.kernelBarePtrCallConv; + gpuBinaryAnnotation = options.gpuBinaryAnnotation; + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option hostBarePtrCallConv{*this, "use-bare-pointers-for-host", ::llvm::cl::desc("Use bare pointers to pass memref arguments to host functions. All memrefs must have static shape."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option kernelBarePtrCallConv{*this, "use-bare-pointers-for-kernels", ::llvm::cl::desc("Use bare pointers to pass memref arguments to kernels. The kernel must use the same setting for this option."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option gpuBinaryAnnotation{*this, "gpu-binary-annotation", ::llvm::cl::desc("Annotation attribute string for GPU binary"), ::llvm::cl::init(gpu::getDefaultGpuBinaryAnnotation())}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createGpuToLLVMConversionPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createGpuToLLVMConversionPass(const GpuToLLVMConversionPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createGpuToLLVMConversionPass() { + return impl::createGpuToLLVMConversionPass(); +} + +std::unique_ptr<::mlir::Pass> createGpuToLLVMConversionPass(const GpuToLLVMConversionPassOptions &options) { + return impl::createGpuToLLVMConversionPass(options); +} +#undef GEN_PASS_DEF_GPUTOLLVMCONVERSIONPASS +#endif // GEN_PASS_DEF_GPUTOLLVMCONVERSIONPASS + +//===----------------------------------------------------------------------===// +// LiftControlFlowToSCFPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LIFTCONTROLFLOWTOSCFPASS +std::unique_ptr<::mlir::Pass> createLiftControlFlowToSCFPass(); +#undef GEN_PASS_DECL_LIFTCONTROLFLOWTOSCFPASS +#endif // GEN_PASS_DECL_LIFTCONTROLFLOWTOSCFPASS +#ifdef GEN_PASS_DEF_LIFTCONTROLFLOWTOSCFPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createLiftControlFlowToSCFPass(); +} // namespace impl +namespace impl { + +template +class LiftControlFlowToSCFPassBase : public ::mlir::OperationPass<> { +public: + using Base = LiftControlFlowToSCFPassBase; + + LiftControlFlowToSCFPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LiftControlFlowToSCFPassBase(const LiftControlFlowToSCFPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lift-cf-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "lift-cf-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lift ControlFlow dialect to SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LiftControlFlowToSCFPass"); + } + ::llvm::StringRef getName() const override { return "LiftControlFlowToSCFPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LiftControlFlowToSCFPassBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createLiftControlFlowToSCFPass() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createLiftControlFlowToSCFPass() { + return impl::createLiftControlFlowToSCFPass(); +} +#undef GEN_PASS_DEF_LIFTCONTROLFLOWTOSCFPASS +#endif // GEN_PASS_DEF_LIFTCONTROLFLOWTOSCFPASS + +//===----------------------------------------------------------------------===// +// LowerHostCodeToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LOWERHOSTCODETOLLVMPASS +struct LowerHostCodeToLLVMPassOptions { + bool useOpaquePointers = true; +}; +std::unique_ptr<::mlir::Pass> createLowerHostCodeToLLVMPass(); +std::unique_ptr<::mlir::Pass> createLowerHostCodeToLLVMPass(const LowerHostCodeToLLVMPassOptions &options); +#undef GEN_PASS_DECL_LOWERHOSTCODETOLLVMPASS +#endif // GEN_PASS_DECL_LOWERHOSTCODETOLLVMPASS +#ifdef GEN_PASS_DEF_LOWERHOSTCODETOLLVMPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createLowerHostCodeToLLVMPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createLowerHostCodeToLLVMPass(const LowerHostCodeToLLVMPassOptions &options); +} // namespace impl +namespace impl { + +template +class LowerHostCodeToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = LowerHostCodeToLLVMPassBase; + + LowerHostCodeToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerHostCodeToLLVMPassBase(const LowerHostCodeToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lower-host-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "lower-host-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Lowers the host module code and `gpu.launch_func` to LLVM"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerHostCodeToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "LowerHostCodeToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerHostCodeToLLVMPassBase) + + LowerHostCodeToLLVMPassBase(const LowerHostCodeToLLVMPassOptions &options) : LowerHostCodeToLLVMPassBase() { + useOpaquePointers = options.useOpaquePointers; + } +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +private: + + friend std::unique_ptr<::mlir::Pass> createLowerHostCodeToLLVMPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createLowerHostCodeToLLVMPass(const LowerHostCodeToLLVMPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createLowerHostCodeToLLVMPass() { + return impl::createLowerHostCodeToLLVMPass(); +} + +std::unique_ptr<::mlir::Pass> createLowerHostCodeToLLVMPass(const LowerHostCodeToLLVMPassOptions &options) { + return impl::createLowerHostCodeToLLVMPass(options); +} +#undef GEN_PASS_DEF_LOWERHOSTCODETOLLVMPASS +#endif // GEN_PASS_DEF_LOWERHOSTCODETOLLVMPASS + +//===----------------------------------------------------------------------===// +// MapMemRefStorageClass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MAPMEMREFSTORAGECLASS +struct MapMemRefStorageClassOptions { + std::string clientAPI = "vulkan"; +}; +#undef GEN_PASS_DECL_MAPMEMREFSTORAGECLASS +#endif // GEN_PASS_DECL_MAPMEMREFSTORAGECLASS +#ifdef GEN_PASS_DEF_MAPMEMREFSTORAGECLASS +namespace impl { + +template +class MapMemRefStorageClassBase : public ::mlir::OperationPass<> { +public: + using Base = MapMemRefStorageClassBase; + + MapMemRefStorageClassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + MapMemRefStorageClassBase(const MapMemRefStorageClassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("map-memref-spirv-storage-class"); + } + ::llvm::StringRef getArgument() const override { return "map-memref-spirv-storage-class"; } + + ::llvm::StringRef getDescription() const override { return "Map numeric MemRef memory spaces to SPIR-V storage classes"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MapMemRefStorageClass"); + } + ::llvm::StringRef getName() const override { return "MapMemRefStorageClass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MapMemRefStorageClassBase) + + MapMemRefStorageClassBase(const MapMemRefStorageClassOptions &options) : MapMemRefStorageClassBase() { + clientAPI = options.clientAPI; + } +protected: + ::mlir::Pass::Option clientAPI{*this, "client-api", ::llvm::cl::desc("The client API to use for populating mappings"), ::llvm::cl::init("vulkan")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_MAPMEMREFSTORAGECLASS +#endif // GEN_PASS_DEF_MAPMEMREFSTORAGECLASS + +//===----------------------------------------------------------------------===// +// ReconcileUnrealizedCasts +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_RECONCILEUNREALIZEDCASTS +#undef GEN_PASS_DECL_RECONCILEUNREALIZEDCASTS +#endif // GEN_PASS_DECL_RECONCILEUNREALIZEDCASTS +#ifdef GEN_PASS_DEF_RECONCILEUNREALIZEDCASTS +namespace impl { + +template +class ReconcileUnrealizedCastsBase : public ::mlir::OperationPass<> { +public: + using Base = ReconcileUnrealizedCastsBase; + + ReconcileUnrealizedCastsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ReconcileUnrealizedCastsBase(const ReconcileUnrealizedCastsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("reconcile-unrealized-casts"); + } + ::llvm::StringRef getArgument() const override { return "reconcile-unrealized-casts"; } + + ::llvm::StringRef getDescription() const override { return "Simplify and eliminate unrealized conversion casts"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReconcileUnrealizedCasts"); + } + ::llvm::StringRef getName() const override { return "ReconcileUnrealizedCasts"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReconcileUnrealizedCastsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_RECONCILEUNREALIZEDCASTS +#endif // GEN_PASS_DEF_RECONCILEUNREALIZEDCASTS + +//===----------------------------------------------------------------------===// +// SCFToControlFlow +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SCFTOCONTROLFLOW +#undef GEN_PASS_DECL_SCFTOCONTROLFLOW +#endif // GEN_PASS_DECL_SCFTOCONTROLFLOW +#ifdef GEN_PASS_DEF_SCFTOCONTROLFLOW +namespace impl { + +template +class SCFToControlFlowBase : public ::mlir::OperationPass<> { +public: + using Base = SCFToControlFlowBase; + + SCFToControlFlowBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + SCFToControlFlowBase(const SCFToControlFlowBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-scf-to-cf"); + } + ::llvm::StringRef getArgument() const override { return "convert-scf-to-cf"; } + + ::llvm::StringRef getDescription() const override { return "Convert SCF dialect to ControlFlow dialect, replacing structured control flow with a CFG"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SCFToControlFlow"); + } + ::llvm::StringRef getName() const override { return "SCFToControlFlow"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SCFToControlFlowBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_SCFTOCONTROLFLOW +#endif // GEN_PASS_DEF_SCFTOCONTROLFLOW + +//===----------------------------------------------------------------------===// +// SCFToEmitC +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SCFTOEMITC +std::unique_ptr<::mlir::Pass> createSCFToEmitC(); +#undef GEN_PASS_DECL_SCFTOEMITC +#endif // GEN_PASS_DECL_SCFTOEMITC +#ifdef GEN_PASS_DEF_SCFTOEMITC + +namespace impl { + std::unique_ptr<::mlir::Pass> createSCFToEmitC(); +} // namespace impl +namespace impl { + +template +class SCFToEmitCBase : public ::mlir::OperationPass<> { +public: + using Base = SCFToEmitCBase; + + SCFToEmitCBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + SCFToEmitCBase(const SCFToEmitCBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-scf-to-emitc"); + } + ::llvm::StringRef getArgument() const override { return "convert-scf-to-emitc"; } + + ::llvm::StringRef getDescription() const override { return "Convert SCF dialect to EmitC dialect, maintaining structured control flow"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SCFToEmitC"); + } + ::llvm::StringRef getName() const override { return "SCFToEmitC"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SCFToEmitCBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createSCFToEmitC() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createSCFToEmitC() { + return impl::createSCFToEmitC(); +} +#undef GEN_PASS_DEF_SCFTOEMITC +#endif // GEN_PASS_DEF_SCFTOEMITC + +//===----------------------------------------------------------------------===// +// SCFToSPIRV +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SCFTOSPIRV +std::unique_ptr<::mlir::Pass> createSCFToSPIRV(); +#undef GEN_PASS_DECL_SCFTOSPIRV +#endif // GEN_PASS_DECL_SCFTOSPIRV +#ifdef GEN_PASS_DEF_SCFTOSPIRV + +namespace impl { + std::unique_ptr<::mlir::Pass> createSCFToSPIRV(); +} // namespace impl +namespace impl { + +template +class SCFToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = SCFToSPIRVBase; + + SCFToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + SCFToSPIRVBase(const SCFToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-scf-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-scf-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert SCF dialect to SPIR-V dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SCFToSPIRV"); + } + ::llvm::StringRef getName() const override { return "SCFToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SCFToSPIRVBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createSCFToSPIRV() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createSCFToSPIRV() { + return impl::createSCFToSPIRV(); +} +#undef GEN_PASS_DEF_SCFTOSPIRV +#endif // GEN_PASS_DEF_SCFTOSPIRV + +//===----------------------------------------------------------------------===// +// SetLLVMModuleDataLayoutPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SETLLVMMODULEDATALAYOUTPASS +struct SetLLVMModuleDataLayoutPassOptions { + std::string dataLayout = ""; +}; +std::unique_ptr<::mlir::Pass> createSetLLVMModuleDataLayoutPass(); +std::unique_ptr<::mlir::Pass> createSetLLVMModuleDataLayoutPass(const SetLLVMModuleDataLayoutPassOptions &options); +#undef GEN_PASS_DECL_SETLLVMMODULEDATALAYOUTPASS +#endif // GEN_PASS_DECL_SETLLVMMODULEDATALAYOUTPASS +#ifdef GEN_PASS_DEF_SETLLVMMODULEDATALAYOUTPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createSetLLVMModuleDataLayoutPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createSetLLVMModuleDataLayoutPass(const SetLLVMModuleDataLayoutPassOptions &options); +} // namespace impl +namespace impl { + +template +class SetLLVMModuleDataLayoutPassBase : public ::mlir::OperationPass { +public: + using Base = SetLLVMModuleDataLayoutPassBase; + + SetLLVMModuleDataLayoutPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SetLLVMModuleDataLayoutPassBase(const SetLLVMModuleDataLayoutPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("set-llvm-module-datalayout"); + } + ::llvm::StringRef getArgument() const override { return "set-llvm-module-datalayout"; } + + ::llvm::StringRef getDescription() const override { return "Attach a datalayout string as a module attribute"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SetLLVMModuleDataLayoutPass"); + } + ::llvm::StringRef getName() const override { return "SetLLVMModuleDataLayoutPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SetLLVMModuleDataLayoutPassBase) + + SetLLVMModuleDataLayoutPassBase(const SetLLVMModuleDataLayoutPassOptions &options) : SetLLVMModuleDataLayoutPassBase() { + dataLayout = options.dataLayout; + } +protected: + ::mlir::Pass::Option dataLayout{*this, "data-layout", ::llvm::cl::desc("String description (LLVM format) of the data layout that is expected on the produced module"), ::llvm::cl::init("")}; +private: + + friend std::unique_ptr<::mlir::Pass> createSetLLVMModuleDataLayoutPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createSetLLVMModuleDataLayoutPass(const SetLLVMModuleDataLayoutPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createSetLLVMModuleDataLayoutPass() { + return impl::createSetLLVMModuleDataLayoutPass(); +} + +std::unique_ptr<::mlir::Pass> createSetLLVMModuleDataLayoutPass(const SetLLVMModuleDataLayoutPassOptions &options) { + return impl::createSetLLVMModuleDataLayoutPass(options); +} +#undef GEN_PASS_DEF_SETLLVMMODULEDATALAYOUTPASS +#endif // GEN_PASS_DEF_SETLLVMMODULEDATALAYOUTPASS + +//===----------------------------------------------------------------------===// +// TosaToArith +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TOSATOARITH +struct TosaToArithOptions { + bool includeApplyRescale = false; + bool use32Bit = false; +}; +#undef GEN_PASS_DECL_TOSATOARITH +#endif // GEN_PASS_DECL_TOSATOARITH +#ifdef GEN_PASS_DEF_TOSATOARITH +namespace impl { + +template +class TosaToArithBase : public ::mlir::OperationPass<> { +public: + using Base = TosaToArithBase; + + TosaToArithBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + TosaToArithBase(const TosaToArithBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-arith"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-arith"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to the Arith dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToArith"); + } + ::llvm::StringRef getName() const override { return "TosaToArith"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToArithBase) + + TosaToArithBase(const TosaToArithOptions &options) : TosaToArithBase() { + includeApplyRescale = options.includeApplyRescale; + use32Bit = options.use32Bit; + } +protected: + ::mlir::Pass::Option includeApplyRescale{*this, "include-apply-rescale", ::llvm::cl::desc("Whether to include the lowering for tosa.apply_rescale to arith"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option use32Bit{*this, "use-32-bit", ::llvm::cl::desc("Whether to prioritze lowering to 32-bit operations"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TOSATOARITH +#endif // GEN_PASS_DEF_TOSATOARITH + +//===----------------------------------------------------------------------===// +// TosaToLinalg +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TOSATOLINALG +#undef GEN_PASS_DECL_TOSATOLINALG +#endif // GEN_PASS_DECL_TOSATOLINALG +#ifdef GEN_PASS_DEF_TOSATOLINALG +namespace impl { + +template +class TosaToLinalgBase : public ::mlir::InterfacePass { +public: + using Base = TosaToLinalgBase; + + TosaToLinalgBase() : ::mlir::InterfacePass(::mlir::TypeID::get()) {} + TosaToLinalgBase(const TosaToLinalgBase &other) : ::mlir::InterfacePass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-linalg"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-linalg"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to LinAlg on tensors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToLinalg"); + } + ::llvm::StringRef getName() const override { return "TosaToLinalg"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToLinalgBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TOSATOLINALG +#endif // GEN_PASS_DEF_TOSATOLINALG + +//===----------------------------------------------------------------------===// +// TosaToLinalgNamed +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TOSATOLINALGNAMED +#undef GEN_PASS_DECL_TOSATOLINALGNAMED +#endif // GEN_PASS_DECL_TOSATOLINALGNAMED +#ifdef GEN_PASS_DEF_TOSATOLINALGNAMED +namespace impl { + +template +class TosaToLinalgNamedBase : public ::mlir::InterfacePass { +public: + using Base = TosaToLinalgNamedBase; + + TosaToLinalgNamedBase() : ::mlir::InterfacePass(::mlir::TypeID::get()) {} + TosaToLinalgNamedBase(const TosaToLinalgNamedBase &other) : ::mlir::InterfacePass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-linalg-named"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-linalg-named"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to LinAlg named operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToLinalgNamed"); + } + ::llvm::StringRef getName() const override { return "TosaToLinalgNamed"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToLinalgNamedBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TOSATOLINALGNAMED +#endif // GEN_PASS_DEF_TOSATOLINALGNAMED + +//===----------------------------------------------------------------------===// +// TosaToSCF +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TOSATOSCF +#undef GEN_PASS_DECL_TOSATOSCF +#endif // GEN_PASS_DECL_TOSATOSCF +#ifdef GEN_PASS_DEF_TOSATOSCF +namespace impl { + +template +class TosaToSCFBase : public ::mlir::OperationPass<> { +public: + using Base = TosaToSCFBase; + + TosaToSCFBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + TosaToSCFBase(const TosaToSCFBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to the SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToSCF"); + } + ::llvm::StringRef getName() const override { return "TosaToSCF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToSCFBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TOSATOSCF +#endif // GEN_PASS_DEF_TOSATOSCF + +//===----------------------------------------------------------------------===// +// TosaToTensor +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TOSATOTENSOR +#undef GEN_PASS_DECL_TOSATOTENSOR +#endif // GEN_PASS_DECL_TOSATOTENSOR +#ifdef GEN_PASS_DEF_TOSATOTENSOR +namespace impl { + +template +class TosaToTensorBase : public ::mlir::OperationPass<> { +public: + using Base = TosaToTensorBase; + + TosaToTensorBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + TosaToTensorBase(const TosaToTensorBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-tensor"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-tensor"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to the Tensor dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToTensor"); + } + ::llvm::StringRef getName() const override { return "TosaToTensor"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToTensorBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TOSATOTENSOR +#endif // GEN_PASS_DEF_TOSATOTENSOR + +//===----------------------------------------------------------------------===// +// UBToLLVMConversionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_UBTOLLVMCONVERSIONPASS +struct UBToLLVMConversionPassOptions { + unsigned indexBitwidth = 0; +}; +std::unique_ptr<::mlir::Pass> createUBToLLVMConversionPass(); +std::unique_ptr<::mlir::Pass> createUBToLLVMConversionPass(const UBToLLVMConversionPassOptions &options); +#undef GEN_PASS_DECL_UBTOLLVMCONVERSIONPASS +#endif // GEN_PASS_DECL_UBTOLLVMCONVERSIONPASS +#ifdef GEN_PASS_DEF_UBTOLLVMCONVERSIONPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createUBToLLVMConversionPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createUBToLLVMConversionPass(const UBToLLVMConversionPassOptions &options); +} // namespace impl +namespace impl { + +template +class UBToLLVMConversionPassBase : public ::mlir::OperationPass<> { +public: + using Base = UBToLLVMConversionPassBase; + + UBToLLVMConversionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + UBToLLVMConversionPassBase(const UBToLLVMConversionPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-ub-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-ub-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert UB dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("UBToLLVMConversionPass"); + } + ::llvm::StringRef getName() const override { return "UBToLLVMConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(UBToLLVMConversionPassBase) + + UBToLLVMConversionPassBase(const UBToLLVMConversionPassOptions &options) : UBToLLVMConversionPassBase() { + indexBitwidth = options.indexBitwidth; + } +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; +private: + + friend std::unique_ptr<::mlir::Pass> createUBToLLVMConversionPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createUBToLLVMConversionPass(const UBToLLVMConversionPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createUBToLLVMConversionPass() { + return impl::createUBToLLVMConversionPass(); +} + +std::unique_ptr<::mlir::Pass> createUBToLLVMConversionPass(const UBToLLVMConversionPassOptions &options) { + return impl::createUBToLLVMConversionPass(options); +} +#undef GEN_PASS_DEF_UBTOLLVMCONVERSIONPASS +#endif // GEN_PASS_DEF_UBTOLLVMCONVERSIONPASS + +//===----------------------------------------------------------------------===// +// UBToSPIRVConversionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_UBTOSPIRVCONVERSIONPASS +std::unique_ptr<::mlir::Pass> createUBToSPIRVConversionPass(); +#undef GEN_PASS_DECL_UBTOSPIRVCONVERSIONPASS +#endif // GEN_PASS_DECL_UBTOSPIRVCONVERSIONPASS +#ifdef GEN_PASS_DEF_UBTOSPIRVCONVERSIONPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createUBToSPIRVConversionPass(); +} // namespace impl +namespace impl { + +template +class UBToSPIRVConversionPassBase : public ::mlir::OperationPass<> { +public: + using Base = UBToSPIRVConversionPassBase; + + UBToSPIRVConversionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + UBToSPIRVConversionPassBase(const UBToSPIRVConversionPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-ub-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-ub-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert UB dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("UBToSPIRVConversionPass"); + } + ::llvm::StringRef getName() const override { return "UBToSPIRVConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(UBToSPIRVConversionPassBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createUBToSPIRVConversionPass() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createUBToSPIRVConversionPass() { + return impl::createUBToSPIRVConversionPass(); +} +#undef GEN_PASS_DEF_UBTOSPIRVCONVERSIONPASS +#endif // GEN_PASS_DEF_UBTOSPIRVCONVERSIONPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// ArithToAMDGPUConversionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerArithToAMDGPUConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithToAMDGPUConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerArithToAMDGPUConversionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithToAMDGPUConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ArithToLLVMConversionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerArithToLLVMConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithToLLVMConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerArithToLLVMConversionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithToLLVMConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertAMDGPUToROCDL Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertAMDGPUToROCDL() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertAMDGPUToROCDLPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertAMDGPUToROCDLPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertAMDGPUToROCDLPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertAffineForToGPU Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertAffineForToGPU() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAffineForToGPUPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertAffineForToGPUPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAffineForToGPUPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertAffineToStandard Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertAffineToStandard() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLowerAffinePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertAffineToStandardPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLowerAffinePass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertArithToSPIRV Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertArithToSPIRV() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::arith::createConvertArithToSPIRVPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertArithToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::arith::createConvertArithToSPIRVPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertArmNeon2dToIntr Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertArmNeon2dToIntr() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertArmNeon2dToIntrPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertArmNeon2dToIntrPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertArmNeon2dToIntrPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertArmSMEToSCF Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertArmSMEToSCF() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertArmSMEToSCFPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertArmSMEToSCFPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertArmSMEToSCFPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertAsyncToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertAsyncToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertAsyncToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertAsyncToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertAsyncToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertBufferizationToMemRef Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertBufferizationToMemRef() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createBufferizationToMemRefPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertBufferizationToMemRefPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createBufferizationToMemRefPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertComplexToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertComplexToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertComplexToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertComplexToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertComplexToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertComplexToLibm Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertComplexToLibm() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertComplexToLibmPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertComplexToLibmPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertComplexToLibmPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertComplexToSPIRVPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertComplexToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertComplexToSPIRVPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertComplexToSPIRVPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertComplexToSPIRVPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertComplexToStandard Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertComplexToStandard() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertComplexToStandardPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertComplexToStandardPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertComplexToStandardPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertControlFlowToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertControlFlowToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertControlFlowToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertControlFlowToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertControlFlowToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertControlFlowToSPIRV Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertControlFlowToSPIRV() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertControlFlowToSPIRVPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertControlFlowToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertControlFlowToSPIRVPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertFuncToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertFuncToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertFuncToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertFuncToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertFuncToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertFuncToSPIRV Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertFuncToSPIRV() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertFuncToSPIRVPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertFuncToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertFuncToSPIRVPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertGPUToSPIRV Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertGPUToSPIRV() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertGPUToSPIRVPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertGPUToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertGPUToSPIRVPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertGpuLaunchFuncToVulkanLaunchFunc Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertGpuLaunchFuncToVulkanLaunchFunc() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertGpuLaunchFuncToVulkanLaunchFuncPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertGpuLaunchFuncToVulkanLaunchFuncPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertGpuLaunchFuncToVulkanLaunchFuncPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertGpuOpsToNVVMOps Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertGpuOpsToNVVMOps() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertGpuOpsToNVVMOps(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertGpuOpsToNVVMOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertGpuOpsToNVVMOps(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertGpuOpsToROCDLOps Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertGpuOpsToROCDLOps() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLowerGpuOpsToROCDLOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertGpuOpsToROCDLOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLowerGpuOpsToROCDLOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertIndexToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertIndexToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertIndexToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertIndexToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertIndexToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertLinalgToStandard Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertLinalgToStandard() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertLinalgToStandardPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertLinalgToStandardPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertLinalgToStandardPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertMathToFuncs Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertMathToFuncs() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertMathToFuncs(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertMathToFuncsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertMathToFuncs(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertMathToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertMathToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertMathToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertMathToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertMathToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertMathToLibm Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertMathToLibm() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertMathToLibmPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertMathToLibmPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertMathToLibmPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertMathToSPIRV Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertMathToSPIRV() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertMathToSPIRVPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertMathToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertMathToSPIRVPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertMemRefToSPIRV Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertMemRefToSPIRV() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertMemRefToSPIRVPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertMemRefToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertMemRefToSPIRVPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertNVGPUToNVVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertNVGPUToNVVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertNVGPUToNVVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertNVGPUToNVVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertNVGPUToNVVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertNVVMToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertNVVMToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertNVVMToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertNVVMToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertNVVMToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertOpenACCToSCF Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertOpenACCToSCF() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertOpenACCToSCFPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertOpenACCToSCFPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertOpenACCToSCFPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertOpenMPToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertOpenMPToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertOpenMPToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertOpenMPToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertOpenMPToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertPDLToPDLInterp Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertPDLToPDLInterp() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createPDLToPDLInterpPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertPDLToPDLInterpPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createPDLToPDLInterpPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertParallelLoopToGpu Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertParallelLoopToGpu() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createParallelLoopToGpuPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertParallelLoopToGpuPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createParallelLoopToGpuPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertSCFToOpenMPPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertSCFToOpenMPPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertSCFToOpenMPPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertSCFToOpenMPPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertSCFToOpenMPPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertSPIRVToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertSPIRVToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertSPIRVToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertSPIRVToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertSPIRVToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertShapeConstraints Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertShapeConstraints() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertShapeConstraintsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertShapeConstraintsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertShapeConstraintsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertShapeToStandard Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertShapeToStandard() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertShapeToStandardPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertShapeToStandardPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertShapeToStandardPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertTensorToLinalg Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertTensorToLinalg() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertTensorToLinalgPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertTensorToLinalgPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertTensorToLinalgPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertTensorToSPIRV Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertTensorToSPIRV() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertTensorToSPIRVPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertTensorToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertTensorToSPIRVPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertVectorToArmSME Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertVectorToArmSME() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertVectorToArmSME(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertVectorToArmSMEPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertVectorToArmSME(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertVectorToGPU Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertVectorToGPU() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertVectorToGPUPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertVectorToGPUPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertVectorToGPUPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertVectorToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertVectorToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertVectorToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertVectorToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertVectorToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertVectorToSCF Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertVectorToSCF() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertVectorToSCFPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertVectorToSCFPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertVectorToSCFPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertVectorToSPIRV Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertVectorToSPIRV() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertVectorToSPIRVPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertVectorToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertVectorToSPIRVPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertVulkanLaunchFuncToVulkanCallsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertVulkanLaunchFuncToVulkanCallsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertVulkanLaunchFuncToVulkanCallsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertVulkanLaunchFuncToVulkanCallsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertVulkanLaunchFuncToVulkanCallsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FinalizeMemRefToLLVMConversionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFinalizeMemRefToLLVMConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createFinalizeMemRefToLLVMConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFinalizeMemRefToLLVMConversionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createFinalizeMemRefToLLVMConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuToLLVMConversionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuToLLVMConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuToLLVMConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuToLLVMConversionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuToLLVMConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LiftControlFlowToSCFPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLiftControlFlowToSCFPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLiftControlFlowToSCFPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLiftControlFlowToSCFPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLiftControlFlowToSCFPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LowerHostCodeToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLowerHostCodeToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLowerHostCodeToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLowerHostCodeToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLowerHostCodeToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MapMemRefStorageClass Registration +//===----------------------------------------------------------------------===// + +inline void registerMapMemRefStorageClass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createMapMemRefStorageClassPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMapMemRefStorageClassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createMapMemRefStorageClassPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ReconcileUnrealizedCasts Registration +//===----------------------------------------------------------------------===// + +inline void registerReconcileUnrealizedCasts() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createReconcileUnrealizedCastsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerReconcileUnrealizedCastsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createReconcileUnrealizedCastsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// SCFToControlFlow Registration +//===----------------------------------------------------------------------===// + +inline void registerSCFToControlFlow() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertSCFToCFPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerSCFToControlFlowPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertSCFToCFPass(); + }); +} + +//===----------------------------------------------------------------------===// +// SCFToEmitC Registration +//===----------------------------------------------------------------------===// + +inline void registerSCFToEmitC() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createSCFToEmitC(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerSCFToEmitCPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createSCFToEmitC(); + }); +} + +//===----------------------------------------------------------------------===// +// SCFToSPIRV Registration +//===----------------------------------------------------------------------===// + +inline void registerSCFToSPIRV() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createSCFToSPIRV(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerSCFToSPIRVPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createSCFToSPIRV(); + }); +} + +//===----------------------------------------------------------------------===// +// SetLLVMModuleDataLayoutPass Registration +//===----------------------------------------------------------------------===// + +inline void registerSetLLVMModuleDataLayoutPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createSetLLVMModuleDataLayoutPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerSetLLVMModuleDataLayoutPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createSetLLVMModuleDataLayoutPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TosaToArith Registration +//===----------------------------------------------------------------------===// + +inline void registerTosaToArith() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToArith(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTosaToArithPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToArith(); + }); +} + +//===----------------------------------------------------------------------===// +// TosaToLinalg Registration +//===----------------------------------------------------------------------===// + +inline void registerTosaToLinalg() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToLinalg(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTosaToLinalgPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToLinalg(); + }); +} + +//===----------------------------------------------------------------------===// +// TosaToLinalgNamed Registration +//===----------------------------------------------------------------------===// + +inline void registerTosaToLinalgNamed() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToLinalgNamed(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTosaToLinalgNamedPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToLinalgNamed(); + }); +} + +//===----------------------------------------------------------------------===// +// TosaToSCF Registration +//===----------------------------------------------------------------------===// + +inline void registerTosaToSCF() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToSCF(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTosaToSCFPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToSCF(); + }); +} + +//===----------------------------------------------------------------------===// +// TosaToTensor Registration +//===----------------------------------------------------------------------===// + +inline void registerTosaToTensor() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToTensor(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTosaToTensorPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tosa::createTosaToTensor(); + }); +} + +//===----------------------------------------------------------------------===// +// UBToLLVMConversionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerUBToLLVMConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createUBToLLVMConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerUBToLLVMConversionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createUBToLLVMConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// UBToSPIRVConversionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerUBToSPIRVConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createUBToSPIRVConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerUBToSPIRVConversionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createUBToSPIRVConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// Conversion Registration +//===----------------------------------------------------------------------===// + +inline void registerConversionPasses() { + registerArithToAMDGPUConversionPass(); + registerArithToLLVMConversionPass(); + registerConvertAMDGPUToROCDL(); + registerConvertAffineForToGPU(); + registerConvertAffineToStandard(); + registerConvertArithToSPIRV(); + registerConvertArmNeon2dToIntr(); + registerConvertArmSMEToSCF(); + registerConvertAsyncToLLVMPass(); + registerConvertBufferizationToMemRef(); + registerConvertComplexToLLVMPass(); + registerConvertComplexToLibm(); + registerConvertComplexToSPIRVPass(); + registerConvertComplexToStandard(); + registerConvertControlFlowToLLVMPass(); + registerConvertControlFlowToSPIRV(); + registerConvertFuncToLLVMPass(); + registerConvertFuncToSPIRV(); + registerConvertGPUToSPIRV(); + registerConvertGpuLaunchFuncToVulkanLaunchFunc(); + registerConvertGpuOpsToNVVMOps(); + registerConvertGpuOpsToROCDLOps(); + registerConvertIndexToLLVMPass(); + registerConvertLinalgToStandard(); + registerConvertMathToFuncs(); + registerConvertMathToLLVMPass(); + registerConvertMathToLibm(); + registerConvertMathToSPIRV(); + registerConvertMemRefToSPIRV(); + registerConvertNVGPUToNVVMPass(); + registerConvertNVVMToLLVMPass(); + registerConvertOpenACCToSCF(); + registerConvertOpenMPToLLVMPass(); + registerConvertPDLToPDLInterp(); + registerConvertParallelLoopToGpu(); + registerConvertSCFToOpenMPPass(); + registerConvertSPIRVToLLVMPass(); + registerConvertShapeConstraints(); + registerConvertShapeToStandard(); + registerConvertTensorToLinalg(); + registerConvertTensorToSPIRV(); + registerConvertToLLVMPass(); + registerConvertVectorToArmSME(); + registerConvertVectorToGPU(); + registerConvertVectorToLLVMPass(); + registerConvertVectorToSCF(); + registerConvertVectorToSPIRV(); + registerConvertVulkanLaunchFuncToVulkanCallsPass(); + registerFinalizeMemRefToLLVMConversionPass(); + registerGpuToLLVMConversionPass(); + registerLiftControlFlowToSCFPass(); + registerLowerHostCodeToLLVMPass(); + registerMapMemRefStorageClass(); + registerReconcileUnrealizedCasts(); + registerSCFToControlFlow(); + registerSCFToEmitC(); + registerSCFToSPIRV(); + registerSetLLVMModuleDataLayoutPass(); + registerTosaToArith(); + registerTosaToLinalg(); + registerTosaToLinalgNamed(); + registerTosaToSCF(); + registerTosaToTensor(); + registerUBToLLVMConversionPass(); + registerUBToSPIRVConversionPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class ArithToAMDGPUConversionPassBase : public ::mlir::OperationPass<> { +public: + using Base = ArithToAMDGPUConversionPassBase; + + ArithToAMDGPUConversionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithToAMDGPUConversionPassBase(const ArithToAMDGPUConversionPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-arith-to-amdgpu"); + } + ::llvm::StringRef getArgument() const override { return "convert-arith-to-amdgpu"; } + + ::llvm::StringRef getDescription() const override { return "Convert Arith operations to AMDGPU-specific implementations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithToAMDGPUConversionPass"); + } + ::llvm::StringRef getName() const override { return "ArithToAMDGPUConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithToAMDGPUConversionPassBase) + +protected: +}; + +template +class ArithToLLVMConversionPassBase : public ::mlir::OperationPass<> { +public: + using Base = ArithToLLVMConversionPassBase; + + ArithToLLVMConversionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithToLLVMConversionPassBase(const ArithToLLVMConversionPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-arith-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-arith-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Arith dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithToLLVMConversionPass"); + } + ::llvm::StringRef getName() const override { return "ArithToLLVMConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithToLLVMConversionPassBase) + +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; +}; + +template +class ConvertAMDGPUToROCDLBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertAMDGPUToROCDLBase; + + ConvertAMDGPUToROCDLBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertAMDGPUToROCDLBase(const ConvertAMDGPUToROCDLBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-amdgpu-to-rocdl"); + } + ::llvm::StringRef getArgument() const override { return "convert-amdgpu-to-rocdl"; } + + ::llvm::StringRef getDescription() const override { return "Convert AMDGPU dialect to ROCDL dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAMDGPUToROCDL"); + } + ::llvm::StringRef getName() const override { return "ConvertAMDGPUToROCDL"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAMDGPUToROCDLBase) + +protected: + ::mlir::Pass::Option chipset{*this, "chipset", ::llvm::cl::desc("Chipset that these operations will run on"), ::llvm::cl::init("gfx000")}; +}; + +template +class ConvertAffineForToGPUBase : public ::mlir::InterfacePass { +public: + using Base = ConvertAffineForToGPUBase; + + ConvertAffineForToGPUBase() : ::mlir::InterfacePass(::mlir::TypeID::get()) {} + ConvertAffineForToGPUBase(const ConvertAffineForToGPUBase &other) : ::mlir::InterfacePass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-affine-for-to-gpu"); + } + ::llvm::StringRef getArgument() const override { return "convert-affine-for-to-gpu"; } + + ::llvm::StringRef getDescription() const override { return "Convert top-level AffineFor Ops to GPU kernels"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAffineForToGPU"); + } + ::llvm::StringRef getName() const override { return "ConvertAffineForToGPU"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAffineForToGPUBase) + +protected: + ::mlir::Pass::Option numBlockDims{*this, "gpu-block-dims", ::llvm::cl::desc("Number of GPU block dimensions for mapping"), ::llvm::cl::init(1u)}; + ::mlir::Pass::Option numThreadDims{*this, "gpu-thread-dims", ::llvm::cl::desc("Number of GPU thread dimensions for mapping"), ::llvm::cl::init(1u)}; +}; + +template +class ConvertAffineToStandardBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertAffineToStandardBase; + + ConvertAffineToStandardBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertAffineToStandardBase(const ConvertAffineToStandardBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lower-affine"); + } + ::llvm::StringRef getArgument() const override { return "lower-affine"; } + + ::llvm::StringRef getDescription() const override { return "Lower Affine operations to a combination of Standard and SCF operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAffineToStandard"); + } + ::llvm::StringRef getName() const override { return "ConvertAffineToStandard"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAffineToStandardBase) + +protected: +}; + +template +class ConvertArithToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertArithToSPIRVBase; + + ConvertArithToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertArithToSPIRVBase(const ConvertArithToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-arith-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-arith-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Arith dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertArithToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertArithToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertArithToSPIRVBase) + +protected: + ::mlir::Pass::Option emulateLT32BitScalarTypes{*this, "emulate-lt-32-bit-scalar-types", ::llvm::cl::desc("Emulate narrower scalar types with 32-bit ones if not supported by the target"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option enableFastMath{*this, "enable-fast-math", ::llvm::cl::desc("Enable fast math mode (assuming no NaN and infinity for floating point values) when performing conversion"), ::llvm::cl::init(false)}; +}; + +template +class ConvertArmNeon2dToIntrBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertArmNeon2dToIntrBase; + + ConvertArmNeon2dToIntrBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertArmNeon2dToIntrBase(const ConvertArmNeon2dToIntrBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arm-neon-2d-to-intr"); + } + ::llvm::StringRef getArgument() const override { return "arm-neon-2d-to-intr"; } + + ::llvm::StringRef getDescription() const override { return "Convert Arm NEON structured ops to intrinsics"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertArmNeon2dToIntr"); + } + ::llvm::StringRef getName() const override { return "ConvertArmNeon2dToIntr"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertArmNeon2dToIntrBase) + +protected: +}; + +template +class ConvertArmSMEToSCFBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertArmSMEToSCFBase; + + ConvertArmSMEToSCFBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertArmSMEToSCFBase(const ConvertArmSMEToSCFBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-arm-sme-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "convert-arm-sme-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the ArmSME dialect into the SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertArmSMEToSCF"); + } + ::llvm::StringRef getName() const override { return "ConvertArmSMEToSCF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertArmSMEToSCFBase) + +protected: +}; + +template +class ConvertAsyncToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertAsyncToLLVMPassBase; + + ConvertAsyncToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertAsyncToLLVMPassBase(const ConvertAsyncToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-async-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-async-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert the operations from the async dialect into the LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAsyncToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertAsyncToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAsyncToLLVMPassBase) + +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class ConvertBufferizationToMemRefBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertBufferizationToMemRefBase; + + ConvertBufferizationToMemRefBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertBufferizationToMemRefBase(const ConvertBufferizationToMemRefBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-bufferization-to-memref"); + } + ::llvm::StringRef getArgument() const override { return "convert-bufferization-to-memref"; } + + ::llvm::StringRef getDescription() const override { return "Convert operations from the Bufferization dialect to the MemRef dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertBufferizationToMemRef"); + } + ::llvm::StringRef getName() const override { return "ConvertBufferizationToMemRef"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertBufferizationToMemRefBase) + +protected: +}; + +template +class ConvertComplexToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertComplexToLLVMPassBase; + + ConvertComplexToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertComplexToLLVMPassBase(const ConvertComplexToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-complex-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-complex-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Complex dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertComplexToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertComplexToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertComplexToLLVMPassBase) + +protected: +}; + +template +class ConvertComplexToLibmBase : public ::mlir::OperationPass { +public: + using Base = ConvertComplexToLibmBase; + + ConvertComplexToLibmBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertComplexToLibmBase(const ConvertComplexToLibmBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-complex-to-libm"); + } + ::llvm::StringRef getArgument() const override { return "convert-complex-to-libm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Complex dialect to libm calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertComplexToLibm"); + } + ::llvm::StringRef getName() const override { return "ConvertComplexToLibm"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertComplexToLibmBase) + +protected: +}; + +template +class ConvertComplexToSPIRVPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertComplexToSPIRVPassBase; + + ConvertComplexToSPIRVPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertComplexToSPIRVPassBase(const ConvertComplexToSPIRVPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-complex-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-complex-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Complex dialect to SPIRV dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertComplexToSPIRVPass"); + } + ::llvm::StringRef getName() const override { return "ConvertComplexToSPIRVPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertComplexToSPIRVPassBase) + +protected: +}; + +template +class ConvertComplexToStandardBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertComplexToStandardBase; + + ConvertComplexToStandardBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertComplexToStandardBase(const ConvertComplexToStandardBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-complex-to-standard"); + } + ::llvm::StringRef getArgument() const override { return "convert-complex-to-standard"; } + + ::llvm::StringRef getDescription() const override { return "Convert Complex dialect to standard dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertComplexToStandard"); + } + ::llvm::StringRef getName() const override { return "ConvertComplexToStandard"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertComplexToStandardBase) + +protected: +}; + +template +class ConvertControlFlowToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertControlFlowToLLVMPassBase; + + ConvertControlFlowToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertControlFlowToLLVMPassBase(const ConvertControlFlowToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-cf-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-cf-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert ControlFlow operations to the LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertControlFlowToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertControlFlowToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertControlFlowToLLVMPassBase) + +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class ConvertControlFlowToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertControlFlowToSPIRVBase; + + ConvertControlFlowToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertControlFlowToSPIRVBase(const ConvertControlFlowToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-cf-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-cf-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert ControlFlow dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertControlFlowToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertControlFlowToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertControlFlowToSPIRVBase) + +protected: + ::mlir::Pass::Option emulateLT32BitScalarTypes{*this, "emulate-lt-32-bit-scalar-types", ::llvm::cl::desc("Emulate narrower scalar types with 32-bit ones if not supported by the target"), ::llvm::cl::init(true)}; +}; + +template +class ConvertFuncToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertFuncToLLVMPassBase; + + ConvertFuncToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertFuncToLLVMPassBase(const ConvertFuncToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-func-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-func-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert from the Func dialect to the LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertFuncToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertFuncToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertFuncToLLVMPassBase) + +protected: + ::mlir::Pass::Option useBarePtrCallConv{*this, "use-bare-ptr-memref-call-conv", ::llvm::cl::desc("Replace FuncOp's MemRef arguments with bare pointers to the MemRef element types"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class ConvertFuncToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertFuncToSPIRVBase; + + ConvertFuncToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertFuncToSPIRVBase(const ConvertFuncToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-func-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-func-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Func dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertFuncToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertFuncToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertFuncToSPIRVBase) + +protected: + ::mlir::Pass::Option emulateLT32BitScalarTypes{*this, "emulate-lt-32-bit-scalar-types", ::llvm::cl::desc("Emulate narrower scalar types with 32-bit ones if not supported by the target"), ::llvm::cl::init(true)}; +}; + +template +class ConvertGPUToSPIRVBase : public ::mlir::OperationPass { +public: + using Base = ConvertGPUToSPIRVBase; + + ConvertGPUToSPIRVBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGPUToSPIRVBase(const ConvertGPUToSPIRVBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-gpu-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-gpu-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert GPU dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGPUToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertGPUToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGPUToSPIRVBase) + +protected: + ::mlir::Pass::Option use64bitIndex{*this, "use-64bit-index", ::llvm::cl::desc("Use 64-bit integers to convert index types"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useCoopMatrixNV{*this, "use-coop-matrix-nv", ::llvm::cl::desc("Use the NV cooperative matrix extension insted of the KHR extension to lower GPU WMMA ops"), ::llvm::cl::init(false)}; +}; + +template +class ConvertGpuLaunchFuncToVulkanLaunchFuncBase : public ::mlir::OperationPass { +public: + using Base = ConvertGpuLaunchFuncToVulkanLaunchFuncBase; + + ConvertGpuLaunchFuncToVulkanLaunchFuncBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGpuLaunchFuncToVulkanLaunchFuncBase(const ConvertGpuLaunchFuncToVulkanLaunchFuncBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-gpu-launch-to-vulkan-launch"); + } + ::llvm::StringRef getArgument() const override { return "convert-gpu-launch-to-vulkan-launch"; } + + ::llvm::StringRef getDescription() const override { return "Convert gpu.launch_func to vulkanLaunch external call"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGpuLaunchFuncToVulkanLaunchFunc"); + } + ::llvm::StringRef getName() const override { return "ConvertGpuLaunchFuncToVulkanLaunchFunc"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGpuLaunchFuncToVulkanLaunchFuncBase) + +protected: +}; + +template +class ConvertGpuOpsToNVVMOpsBase : public ::mlir::OperationPass { +public: + using Base = ConvertGpuOpsToNVVMOpsBase; + + ConvertGpuOpsToNVVMOpsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGpuOpsToNVVMOpsBase(const ConvertGpuOpsToNVVMOpsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-gpu-to-nvvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-gpu-to-nvvm"; } + + ::llvm::StringRef getDescription() const override { return "Generate NVVM operations for gpu operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGpuOpsToNVVMOps"); + } + ::llvm::StringRef getName() const override { return "ConvertGpuOpsToNVVMOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGpuOpsToNVVMOpsBase) + +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option hasRedux{*this, "has-redux", ::llvm::cl::desc("Target gpu supports redux"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useBarePtrCallConv{*this, "use-bare-ptr-memref-call-conv", ::llvm::cl::desc("Replace memref arguments in GPU functions with bare pointers. All memrefs must have static shape."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class ConvertGpuOpsToROCDLOpsBase : public ::mlir::OperationPass { +public: + using Base = ConvertGpuOpsToROCDLOpsBase; + + ConvertGpuOpsToROCDLOpsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGpuOpsToROCDLOpsBase(const ConvertGpuOpsToROCDLOpsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-gpu-to-rocdl"); + } + ::llvm::StringRef getArgument() const override { return "convert-gpu-to-rocdl"; } + + ::llvm::StringRef getDescription() const override { return "Generate ROCDL operations for gpu operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGpuOpsToROCDLOps"); + } + ::llvm::StringRef getName() const override { return "ConvertGpuOpsToROCDLOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGpuOpsToROCDLOpsBase) + +protected: + ::mlir::Pass::Option chipset{*this, "chipset", ::llvm::cl::desc("Chipset that these operations will run on"), ::llvm::cl::init("gfx000")}; + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option useBarePtrCallConv{*this, "use-bare-ptr-memref-call-conv", ::llvm::cl::desc("Replace memref arguments in GPU functions with bare pointers.All memrefs must have static shape"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option<::mlir::gpu::amd::Runtime> runtime{*this, "runtime", ::llvm::cl::desc("Runtime code will be run on (default is Unknown, can also use HIP or OpenCl)"), ::llvm::cl::init(::mlir::gpu::amd::Runtime::Unknown), ::llvm::cl::values( + clEnumValN(::mlir::gpu::amd::Runtime::Unknown, "unknown", "Unknown (default)"), + clEnumValN(::mlir::gpu::amd::Runtime::HIP, "HIP", "HIP"), + clEnumValN(::mlir::gpu::amd::Runtime::OpenCL, "OpenCL", "OpenCL") + )}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class ConvertIndexToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertIndexToLLVMPassBase; + + ConvertIndexToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertIndexToLLVMPassBase(const ConvertIndexToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-index-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-index-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Lower the `index` dialect to the `llvm` dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertIndexToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertIndexToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertIndexToLLVMPassBase) + +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; +}; + +template +class ConvertLinalgToStandardBase : public ::mlir::OperationPass { +public: + using Base = ConvertLinalgToStandardBase; + + ConvertLinalgToStandardBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLinalgToStandardBase(const ConvertLinalgToStandardBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-linalg-to-std"); + } + ::llvm::StringRef getArgument() const override { return "convert-linalg-to-std"; } + + ::llvm::StringRef getDescription() const override { return "Convert the operations from the linalg dialect into the Standard dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLinalgToStandard"); + } + ::llvm::StringRef getName() const override { return "ConvertLinalgToStandard"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLinalgToStandardBase) + +protected: +}; + +template +class ConvertMathToFuncsBase : public ::mlir::OperationPass { +public: + using Base = ConvertMathToFuncsBase; + + ConvertMathToFuncsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertMathToFuncsBase(const ConvertMathToFuncsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-math-to-funcs"); + } + ::llvm::StringRef getArgument() const override { return "convert-math-to-funcs"; } + + ::llvm::StringRef getDescription() const override { return "Convert Math operations to calls of outlined implementations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMathToFuncs"); + } + ::llvm::StringRef getName() const override { return "ConvertMathToFuncs"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMathToFuncsBase) + +protected: + ::mlir::Pass::Option minWidthOfFPowIExponent{*this, "min-width-of-fpowi-exponent", ::llvm::cl::desc("Convert FPowI only if the width of its exponent's integer type is greater than or equal to this value"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option convertCtlz{*this, "convert-ctlz", ::llvm::cl::desc("Convert math.ctlz to a software implementation. Enable for targets that do not natively support ctlz."), ::llvm::cl::init(false)}; +}; + +template +class ConvertMathToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertMathToLLVMPassBase; + + ConvertMathToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertMathToLLVMPassBase(const ConvertMathToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-math-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-math-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Math dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMathToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertMathToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMathToLLVMPassBase) + +protected: + ::mlir::Pass::Option approximateLog1p{*this, "approximate-log1p", ::llvm::cl::desc("Enable approximation of Log1p."), ::llvm::cl::init(true)}; +}; + +template +class ConvertMathToLibmBase : public ::mlir::OperationPass { +public: + using Base = ConvertMathToLibmBase; + + ConvertMathToLibmBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertMathToLibmBase(const ConvertMathToLibmBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-math-to-libm"); + } + ::llvm::StringRef getArgument() const override { return "convert-math-to-libm"; } + + ::llvm::StringRef getDescription() const override { return "Convert Math dialect to libm calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMathToLibm"); + } + ::llvm::StringRef getName() const override { return "ConvertMathToLibm"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMathToLibmBase) + +protected: +}; + +template +class ConvertMathToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertMathToSPIRVBase; + + ConvertMathToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertMathToSPIRVBase(const ConvertMathToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-math-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-math-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Math dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMathToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertMathToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMathToSPIRVBase) + +protected: +}; + +template +class ConvertMemRefToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertMemRefToSPIRVBase; + + ConvertMemRefToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertMemRefToSPIRVBase(const ConvertMemRefToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-memref-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-memref-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert MemRef dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMemRefToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertMemRefToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMemRefToSPIRVBase) + +protected: + ::mlir::Pass::Option boolNumBits{*this, "bool-num-bits", ::llvm::cl::desc("The number of bits to store a boolean value"), ::llvm::cl::init(8)}; + ::mlir::Pass::Option use64bitIndex{*this, "use-64bit-index", ::llvm::cl::desc("Use 64-bit integers to convert index types"), ::llvm::cl::init(false)}; +}; + +template +class ConvertNVGPUToNVVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertNVGPUToNVVMPassBase; + + ConvertNVGPUToNVVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertNVGPUToNVVMPassBase(const ConvertNVGPUToNVVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-nvgpu-to-nvvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-nvgpu-to-nvvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert NVGPU dialect to NVVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertNVGPUToNVVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertNVGPUToNVVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertNVGPUToNVVMPassBase) + +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class ConvertNVVMToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertNVVMToLLVMPassBase; + + ConvertNVVMToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertNVVMToLLVMPassBase(const ConvertNVVMToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-nvvm-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-nvvm-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert NVVM dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertNVVMToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertNVVMToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertNVVMToLLVMPassBase) + +protected: +}; + +template +class ConvertOpenACCToSCFBase : public ::mlir::OperationPass { +public: + using Base = ConvertOpenACCToSCFBase; + + ConvertOpenACCToSCFBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertOpenACCToSCFBase(const ConvertOpenACCToSCFBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-openacc-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "convert-openacc-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Convert the OpenACC ops to OpenACC with SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertOpenACCToSCF"); + } + ::llvm::StringRef getName() const override { return "ConvertOpenACCToSCF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertOpenACCToSCFBase) + +protected: +}; + +template +class ConvertOpenMPToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertOpenMPToLLVMPassBase; + + ConvertOpenMPToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertOpenMPToLLVMPassBase(const ConvertOpenMPToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-openmp-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-openmp-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert the OpenMP ops to OpenMP ops with LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertOpenMPToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertOpenMPToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertOpenMPToLLVMPassBase) + +protected: +}; + +template +class ConvertPDLToPDLInterpBase : public ::mlir::OperationPass { +public: + using Base = ConvertPDLToPDLInterpBase; + + ConvertPDLToPDLInterpBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertPDLToPDLInterpBase(const ConvertPDLToPDLInterpBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-pdl-to-pdl-interp"); + } + ::llvm::StringRef getArgument() const override { return "convert-pdl-to-pdl-interp"; } + + ::llvm::StringRef getDescription() const override { return "Convert PDL ops to PDL interpreter ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertPDLToPDLInterp"); + } + ::llvm::StringRef getName() const override { return "ConvertPDLToPDLInterp"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertPDLToPDLInterpBase) + +protected: +}; + +template +class ConvertParallelLoopToGpuBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertParallelLoopToGpuBase; + + ConvertParallelLoopToGpuBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertParallelLoopToGpuBase(const ConvertParallelLoopToGpuBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-parallel-loops-to-gpu"); + } + ::llvm::StringRef getArgument() const override { return "convert-parallel-loops-to-gpu"; } + + ::llvm::StringRef getDescription() const override { return "Convert mapped scf.parallel ops to gpu launch operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertParallelLoopToGpu"); + } + ::llvm::StringRef getName() const override { return "ConvertParallelLoopToGpu"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertParallelLoopToGpuBase) + +protected: +}; + +template +class ConvertSCFToOpenMPPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertSCFToOpenMPPassBase; + + ConvertSCFToOpenMPPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertSCFToOpenMPPassBase(const ConvertSCFToOpenMPPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-scf-to-openmp"); + } + ::llvm::StringRef getArgument() const override { return "convert-scf-to-openmp"; } + + ::llvm::StringRef getDescription() const override { return "Convert SCF parallel loop to OpenMP parallel + workshare constructs."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertSCFToOpenMPPass"); + } + ::llvm::StringRef getName() const override { return "ConvertSCFToOpenMPPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertSCFToOpenMPPassBase) + +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class ConvertSPIRVToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertSPIRVToLLVMPassBase; + + ConvertSPIRVToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertSPIRVToLLVMPassBase(const ConvertSPIRVToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-spirv-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-spirv-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert SPIR-V dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertSPIRVToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertSPIRVToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertSPIRVToLLVMPassBase) + +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option<::mlir::spirv::ClientAPI> clientAPI{*this, "client-api", ::llvm::cl::desc("Derive StorageClass to address space mapping from the client API"), ::llvm::cl::init(::mlir::spirv::ClientAPI::Unknown), ::llvm::cl::values( + clEnumValN(::mlir::spirv::ClientAPI::Unknown, "Unknown", "Unknown (default)"), + clEnumValN(::mlir::spirv::ClientAPI::Metal, "Metal", "Metal"), + clEnumValN(::mlir::spirv::ClientAPI::OpenCL, "OpenCL", "OpenCL"), + clEnumValN(::mlir::spirv::ClientAPI::Vulkan, "Vulkan", "Vulkan"), + clEnumValN(::mlir::spirv::ClientAPI::WebGPU, "WebGPU", "WebGPU") + )}; +}; + +template +class ConvertShapeConstraintsBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertShapeConstraintsBase; + + ConvertShapeConstraintsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertShapeConstraintsBase(const ConvertShapeConstraintsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-shape-constraints"); + } + ::llvm::StringRef getArgument() const override { return "convert-shape-constraints"; } + + ::llvm::StringRef getDescription() const override { return "Convert shape constraint operations to the standard dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertShapeConstraints"); + } + ::llvm::StringRef getName() const override { return "ConvertShapeConstraints"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertShapeConstraintsBase) + +protected: +}; + +template +class ConvertShapeToStandardBase : public ::mlir::OperationPass { +public: + using Base = ConvertShapeToStandardBase; + + ConvertShapeToStandardBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertShapeToStandardBase(const ConvertShapeToStandardBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-shape-to-std"); + } + ::llvm::StringRef getArgument() const override { return "convert-shape-to-std"; } + + ::llvm::StringRef getDescription() const override { return "Convert operations from the shape dialect into the standard dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertShapeToStandard"); + } + ::llvm::StringRef getName() const override { return "ConvertShapeToStandard"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertShapeToStandardBase) + +protected: +}; + +template +class ConvertTensorToLinalgBase : public ::mlir::OperationPass { +public: + using Base = ConvertTensorToLinalgBase; + + ConvertTensorToLinalgBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertTensorToLinalgBase(const ConvertTensorToLinalgBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-tensor-to-linalg"); + } + ::llvm::StringRef getArgument() const override { return "convert-tensor-to-linalg"; } + + ::llvm::StringRef getDescription() const override { return "Convert some Tensor dialect ops to Linalg dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTensorToLinalg"); + } + ::llvm::StringRef getName() const override { return "ConvertTensorToLinalg"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTensorToLinalgBase) + +protected: +}; + +template +class ConvertTensorToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertTensorToSPIRVBase; + + ConvertTensorToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertTensorToSPIRVBase(const ConvertTensorToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-tensor-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-tensor-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Tensor dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTensorToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertTensorToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTensorToSPIRVBase) + +protected: + ::mlir::Pass::Option emulateLT32BitScalarTypes{*this, "emulate-lt-32-bit-scalar-types", ::llvm::cl::desc("Emulate narrower scalar types with 32-bit ones if not supported by the target"), ::llvm::cl::init(true)}; +}; + +template +class ConvertToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertToLLVMPassBase; + + ConvertToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertToLLVMPassBase(const ConvertToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert to LLVM via dialect interfaces found in the input IR"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertToLLVMPassBase) + +protected: + ::mlir::Pass::ListOption filterDialects{*this, "filter-dialects", ::llvm::cl::desc("Test conversion patterns of only the specified dialects")}; +}; + +template +class ConvertVectorToArmSMEBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToArmSMEBase; + + ConvertVectorToArmSMEBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToArmSMEBase(const ConvertVectorToArmSMEBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-arm-sme"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-arm-sme"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the vector dialect into the ArmSME dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToArmSME"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToArmSME"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToArmSMEBase) + +protected: +}; + +template +class ConvertVectorToGPUBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToGPUBase; + + ConvertVectorToGPUBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToGPUBase(const ConvertVectorToGPUBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-gpu"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-gpu"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the vector dialect into the GPU dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToGPU"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToGPU"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToGPUBase) + +protected: + ::mlir::Pass::Option useNvGpu{*this, "use-nvgpu", ::llvm::cl::desc("convert to NvGPU ops instead of GPU dialect ops"), ::llvm::cl::init(false)}; +}; + +template +class ConvertVectorToLLVMPassBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToLLVMPassBase; + + ConvertVectorToLLVMPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToLLVMPassBase(const ConvertVectorToLLVMPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the vector dialect into the LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToLLVMPassBase) + +protected: + ::mlir::Pass::Option reassociateFPReductions{*this, "reassociate-fp-reductions", ::llvm::cl::desc("Allows llvm to reassociate floating-point reductions for speed"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option force32BitVectorIndices{*this, "force-32bit-vector-indices", ::llvm::cl::desc("Allows compiler to assume vector indices fit in 32-bit if that yields faster code"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option amx{*this, "enable-amx", ::llvm::cl::desc("Enables the use of AMX dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option armNeon{*this, "enable-arm-neon", ::llvm::cl::desc("Enables the use of ArmNeon dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option armSVE{*this, "enable-arm-sve", ::llvm::cl::desc("Enables the use of ArmSVE dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option armSME{*this, "enable-arm-sme", ::llvm::cl::desc("Enables the use of ArmSME dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option x86Vector{*this, "enable-x86vector", ::llvm::cl::desc("Enables the use of X86Vector dialect while lowering the vector dialect."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class ConvertVectorToSCFBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToSCFBase; + + ConvertVectorToSCFBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToSCFBase(const ConvertVectorToSCFBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the vector dialect into the SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToSCF"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToSCF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToSCFBase) + +protected: + ::mlir::Pass::Option fullUnroll{*this, "full-unroll", ::llvm::cl::desc("Perform full unrolling when converting vector transfers to SCF"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option targetRank{*this, "target-rank", ::llvm::cl::desc("Target vector rank to which transfer ops should be lowered"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option lowerTensors{*this, "lower-tensors", ::llvm::cl::desc("Lower transfer ops that operate on tensors"), ::llvm::cl::init(false)}; +}; + +template +class ConvertVectorToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertVectorToSPIRVBase; + + ConvertVectorToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertVectorToSPIRVBase(const ConvertVectorToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-vector-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-vector-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert Vector dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVectorToSPIRV"); + } + ::llvm::StringRef getName() const override { return "ConvertVectorToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVectorToSPIRVBase) + +protected: +}; + +template +class ConvertVulkanLaunchFuncToVulkanCallsPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertVulkanLaunchFuncToVulkanCallsPassBase; + + ConvertVulkanLaunchFuncToVulkanCallsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertVulkanLaunchFuncToVulkanCallsPassBase(const ConvertVulkanLaunchFuncToVulkanCallsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("launch-func-to-vulkan"); + } + ::llvm::StringRef getArgument() const override { return "launch-func-to-vulkan"; } + + ::llvm::StringRef getDescription() const override { return "Convert vulkanLaunch external call to Vulkan runtime external calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertVulkanLaunchFuncToVulkanCallsPass"); + } + ::llvm::StringRef getName() const override { return "ConvertVulkanLaunchFuncToVulkanCallsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertVulkanLaunchFuncToVulkanCallsPassBase) + +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class FinalizeMemRefToLLVMConversionPassBase : public ::mlir::OperationPass { +public: + using Base = FinalizeMemRefToLLVMConversionPassBase; + + FinalizeMemRefToLLVMConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FinalizeMemRefToLLVMConversionPassBase(const FinalizeMemRefToLLVMConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("finalize-memref-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "finalize-memref-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Finalize MemRef dialect to LLVM dialect conversion"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FinalizeMemRefToLLVMConversionPass"); + } + ::llvm::StringRef getName() const override { return "FinalizeMemRefToLLVMConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FinalizeMemRefToLLVMConversionPassBase) + +protected: + ::mlir::Pass::Option useAlignedAlloc{*this, "use-aligned-alloc", ::llvm::cl::desc("Use aligned_alloc in place of malloc for heap allocations"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option useGenericFunctions{*this, "use-generic-functions", ::llvm::cl::desc("Use generic allocation and deallocation functions instead of the classic 'malloc', 'aligned_alloc' and 'free' functions"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class GpuToLLVMConversionPassBase : public ::mlir::OperationPass { +public: + using Base = GpuToLLVMConversionPassBase; + + GpuToLLVMConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuToLLVMConversionPassBase(const GpuToLLVMConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "gpu-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert GPU dialect to LLVM dialect with GPU runtime calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuToLLVMConversionPass"); + } + ::llvm::StringRef getName() const override { return "GpuToLLVMConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuToLLVMConversionPassBase) + +protected: + ::mlir::Pass::Option hostBarePtrCallConv{*this, "use-bare-pointers-for-host", ::llvm::cl::desc("Use bare pointers to pass memref arguments to host functions. All memrefs must have static shape."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option kernelBarePtrCallConv{*this, "use-bare-pointers-for-kernels", ::llvm::cl::desc("Use bare pointers to pass memref arguments to kernels. The kernel must use the same setting for this option."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option gpuBinaryAnnotation{*this, "gpu-binary-annotation", ::llvm::cl::desc("Annotation attribute string for GPU binary"), ::llvm::cl::init(gpu::getDefaultGpuBinaryAnnotation())}; + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class LiftControlFlowToSCFPassBase : public ::mlir::OperationPass<> { +public: + using Base = LiftControlFlowToSCFPassBase; + + LiftControlFlowToSCFPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LiftControlFlowToSCFPassBase(const LiftControlFlowToSCFPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lift-cf-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "lift-cf-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lift ControlFlow dialect to SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LiftControlFlowToSCFPass"); + } + ::llvm::StringRef getName() const override { return "LiftControlFlowToSCFPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LiftControlFlowToSCFPassBase) + +protected: +}; + +template +class LowerHostCodeToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = LowerHostCodeToLLVMPassBase; + + LowerHostCodeToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerHostCodeToLLVMPassBase(const LowerHostCodeToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lower-host-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "lower-host-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Lowers the host module code and `gpu.launch_func` to LLVM"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerHostCodeToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "LowerHostCodeToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerHostCodeToLLVMPassBase) + +protected: + ::mlir::Pass::Option useOpaquePointers{*this, "use-opaque-pointers", ::llvm::cl::desc("Generate LLVM IR using opaque pointers instead of typed pointers"), ::llvm::cl::init(true)}; +}; + +template +class MapMemRefStorageClassBase : public ::mlir::OperationPass<> { +public: + using Base = MapMemRefStorageClassBase; + + MapMemRefStorageClassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + MapMemRefStorageClassBase(const MapMemRefStorageClassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("map-memref-spirv-storage-class"); + } + ::llvm::StringRef getArgument() const override { return "map-memref-spirv-storage-class"; } + + ::llvm::StringRef getDescription() const override { return "Map numeric MemRef memory spaces to SPIR-V storage classes"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MapMemRefStorageClass"); + } + ::llvm::StringRef getName() const override { return "MapMemRefStorageClass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MapMemRefStorageClassBase) + +protected: + ::mlir::Pass::Option clientAPI{*this, "client-api", ::llvm::cl::desc("The client API to use for populating mappings"), ::llvm::cl::init("vulkan")}; +}; + +template +class ReconcileUnrealizedCastsBase : public ::mlir::OperationPass<> { +public: + using Base = ReconcileUnrealizedCastsBase; + + ReconcileUnrealizedCastsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ReconcileUnrealizedCastsBase(const ReconcileUnrealizedCastsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("reconcile-unrealized-casts"); + } + ::llvm::StringRef getArgument() const override { return "reconcile-unrealized-casts"; } + + ::llvm::StringRef getDescription() const override { return "Simplify and eliminate unrealized conversion casts"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReconcileUnrealizedCasts"); + } + ::llvm::StringRef getName() const override { return "ReconcileUnrealizedCasts"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReconcileUnrealizedCastsBase) + +protected: +}; + +template +class SCFToControlFlowBase : public ::mlir::OperationPass<> { +public: + using Base = SCFToControlFlowBase; + + SCFToControlFlowBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + SCFToControlFlowBase(const SCFToControlFlowBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-scf-to-cf"); + } + ::llvm::StringRef getArgument() const override { return "convert-scf-to-cf"; } + + ::llvm::StringRef getDescription() const override { return "Convert SCF dialect to ControlFlow dialect, replacing structured control flow with a CFG"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SCFToControlFlow"); + } + ::llvm::StringRef getName() const override { return "SCFToControlFlow"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SCFToControlFlowBase) + +protected: +}; + +template +class SCFToEmitCBase : public ::mlir::OperationPass<> { +public: + using Base = SCFToEmitCBase; + + SCFToEmitCBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + SCFToEmitCBase(const SCFToEmitCBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-scf-to-emitc"); + } + ::llvm::StringRef getArgument() const override { return "convert-scf-to-emitc"; } + + ::llvm::StringRef getDescription() const override { return "Convert SCF dialect to EmitC dialect, maintaining structured control flow"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SCFToEmitC"); + } + ::llvm::StringRef getName() const override { return "SCFToEmitC"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SCFToEmitCBase) + +protected: +}; + +template +class SCFToSPIRVBase : public ::mlir::OperationPass<> { +public: + using Base = SCFToSPIRVBase; + + SCFToSPIRVBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + SCFToSPIRVBase(const SCFToSPIRVBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-scf-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-scf-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert SCF dialect to SPIR-V dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SCFToSPIRV"); + } + ::llvm::StringRef getName() const override { return "SCFToSPIRV"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SCFToSPIRVBase) + +protected: +}; + +template +class SetLLVMModuleDataLayoutPassBase : public ::mlir::OperationPass { +public: + using Base = SetLLVMModuleDataLayoutPassBase; + + SetLLVMModuleDataLayoutPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SetLLVMModuleDataLayoutPassBase(const SetLLVMModuleDataLayoutPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("set-llvm-module-datalayout"); + } + ::llvm::StringRef getArgument() const override { return "set-llvm-module-datalayout"; } + + ::llvm::StringRef getDescription() const override { return "Attach a datalayout string as a module attribute"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SetLLVMModuleDataLayoutPass"); + } + ::llvm::StringRef getName() const override { return "SetLLVMModuleDataLayoutPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SetLLVMModuleDataLayoutPassBase) + +protected: + ::mlir::Pass::Option dataLayout{*this, "data-layout", ::llvm::cl::desc("String description (LLVM format) of the data layout that is expected on the produced module"), ::llvm::cl::init("")}; +}; + +template +class TosaToArithBase : public ::mlir::OperationPass<> { +public: + using Base = TosaToArithBase; + + TosaToArithBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + TosaToArithBase(const TosaToArithBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-arith"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-arith"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to the Arith dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToArith"); + } + ::llvm::StringRef getName() const override { return "TosaToArith"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToArithBase) + +protected: + ::mlir::Pass::Option includeApplyRescale{*this, "include-apply-rescale", ::llvm::cl::desc("Whether to include the lowering for tosa.apply_rescale to arith"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option use32Bit{*this, "use-32-bit", ::llvm::cl::desc("Whether to prioritze lowering to 32-bit operations"), ::llvm::cl::init(false)}; +}; + +template +class TosaToLinalgBase : public ::mlir::InterfacePass { +public: + using Base = TosaToLinalgBase; + + TosaToLinalgBase() : ::mlir::InterfacePass(::mlir::TypeID::get()) {} + TosaToLinalgBase(const TosaToLinalgBase &other) : ::mlir::InterfacePass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-linalg"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-linalg"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to LinAlg on tensors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToLinalg"); + } + ::llvm::StringRef getName() const override { return "TosaToLinalg"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToLinalgBase) + +protected: +}; + +template +class TosaToLinalgNamedBase : public ::mlir::InterfacePass { +public: + using Base = TosaToLinalgNamedBase; + + TosaToLinalgNamedBase() : ::mlir::InterfacePass(::mlir::TypeID::get()) {} + TosaToLinalgNamedBase(const TosaToLinalgNamedBase &other) : ::mlir::InterfacePass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-linalg-named"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-linalg-named"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to LinAlg named operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToLinalgNamed"); + } + ::llvm::StringRef getName() const override { return "TosaToLinalgNamed"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToLinalgNamedBase) + +protected: +}; + +template +class TosaToSCFBase : public ::mlir::OperationPass<> { +public: + using Base = TosaToSCFBase; + + TosaToSCFBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + TosaToSCFBase(const TosaToSCFBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to the SCF dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToSCF"); + } + ::llvm::StringRef getName() const override { return "TosaToSCF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToSCFBase) + +protected: +}; + +template +class TosaToTensorBase : public ::mlir::OperationPass<> { +public: + using Base = TosaToTensorBase; + + TosaToTensorBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + TosaToTensorBase(const TosaToTensorBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tosa-to-tensor"); + } + ::llvm::StringRef getArgument() const override { return "tosa-to-tensor"; } + + ::llvm::StringRef getDescription() const override { return "Lower TOSA to the Tensor dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TosaToTensor"); + } + ::llvm::StringRef getName() const override { return "TosaToTensor"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TosaToTensorBase) + +protected: +}; + +template +class UBToLLVMConversionPassBase : public ::mlir::OperationPass<> { +public: + using Base = UBToLLVMConversionPassBase; + + UBToLLVMConversionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + UBToLLVMConversionPassBase(const UBToLLVMConversionPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-ub-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "convert-ub-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert UB dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("UBToLLVMConversionPass"); + } + ::llvm::StringRef getName() const override { return "UBToLLVMConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(UBToLLVMConversionPassBase) + +protected: + ::mlir::Pass::Option indexBitwidth{*this, "index-bitwidth", ::llvm::cl::desc("Bitwidth of the index type, 0 to use size of machine word"), ::llvm::cl::init(0)}; +}; + +template +class UBToSPIRVConversionPassBase : public ::mlir::OperationPass<> { +public: + using Base = UBToSPIRVConversionPassBase; + + UBToSPIRVConversionPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + UBToSPIRVConversionPassBase(const UBToSPIRVConversionPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-ub-to-spirv"); + } + ::llvm::StringRef getArgument() const override { return "convert-ub-to-spirv"; } + + ::llvm::StringRef getDescription() const override { return "Convert UB dialect to SPIR-V dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("UBToSPIRVConversionPass"); + } + ::llvm::StringRef getName() const override { return "UBToSPIRVConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(UBToSPIRVConversionPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h new file mode 100644 index 0000000000000000000000000000000000000000..9df117709c82f698bba038864f5e8572da03249e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h @@ -0,0 +1,30 @@ +//===- ReconcileUnrealizedCasts.h - Pass entrypoint -------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_RECONCILEUNREALIZEDCASTS_RECONCILEUNREALIZEDCASTS_H_ +#define MLIR_CONVERSION_RECONCILEUNREALIZEDCASTS_RECONCILEUNREALIZEDCASTS_H_ + +#include + +namespace mlir { +class Pass; +class RewritePatternSet; + +#define GEN_PASS_DECL_RECONCILEUNREALIZEDCASTS +#include "mlir/Conversion/Passes.h.inc" + +/// Creates a pass that eliminates noop `unrealized_conversion_cast` operation +/// sequences. +std::unique_ptr createReconcileUnrealizedCastsPass(); + +/// Populates `patterns` with rewrite patterns that eliminate noop +/// `unrealized_conversion_cast` operation sequences. +void populateReconcileUnrealizedCastsPatterns(RewritePatternSet &patterns); +} // namespace mlir + +#endif // MLIR_CONVERSION_RECONCILEUNREALIZEDCASTS_RECONCILEUNREALIZEDCASTS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h new file mode 100644 index 0000000000000000000000000000000000000000..b4cb16aecd862e038c4ab333db15e61ed5d6b006 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h @@ -0,0 +1,31 @@ +//===- SCFToControlFlow.h - SCF to ControlFlow Pass entrypoint --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_SCFTOCONTROLFLOW_SCFTOCONTROLFLOW_H_ +#define MLIR_CONVERSION_SCFTOCONTROLFLOW_SCFTOCONTROLFLOW_H_ + +#include + +namespace mlir { +class Pass; +class RewritePatternSet; + +#define GEN_PASS_DECL_SCFTOCONTROLFLOW +#include "mlir/Conversion/Passes.h.inc" + +/// Collect a set of patterns to convert SCF operations to CFG branch-based +/// operations within the ControlFlow dialect. +void populateSCFToControlFlowConversionPatterns(RewritePatternSet &patterns); + +/// Creates a pass to convert SCF operations to CFG branch-based operation in +/// the ControlFlow dialect. +std::unique_ptr createConvertSCFToCFPass(); + +} // namespace mlir + +#endif // MLIR_CONVERSION_SCFTOCONTROLFLOW_SCFTOCONTROLFLOW_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h new file mode 100644 index 0000000000000000000000000000000000000000..a180a12cad2311973ab735adafb8a69ceebd7427 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h @@ -0,0 +1,60 @@ +//===- SCFToGPU.h - Convert loop nests to GPU kernels -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_SCFTOGPU_SCFTOGPU_H_ +#define MLIR_CONVERSION_SCFTOGPU_SCFTOGPU_H_ + +#include "mlir/Support/LLVM.h" + +namespace mlir { +class ConversionTarget; +struct LogicalResult; +class MLIRContext; +class Value; +class Operation; +class RewritePatternSet; + +namespace affine { +class AffineForOp; +} // namespace affine + +namespace scf { +class ForOp; +} // namespace scf + +/// Convert a perfect affine loop nest with the outermost loop identified by +/// `forOp` into a gpu::Launch operation. Map `numBlockDims` outer loops to +/// GPU blocks and `numThreadDims` to GPU threads. The bounds of the loops that +/// are mapped should be independent of the induction variables of the other +/// mapped loops. +/// +/// No check on the size of the block or grid, or on the validity of +/// parallelization is performed, it is under the responsibility of the caller +/// to strip-mine the loops and to perform the dependence analysis before +/// calling the conversion. + +// TODO: Consider removing this in favor of affine.for -> affine.parallel +// detection followed by an affine.parallel -> scf.parallel -> gpu.launch +// conversion +LogicalResult convertAffineLoopNestToGPULaunch(affine::AffineForOp forOp, + unsigned numBlockDims, + unsigned numThreadDims); + +/// Adds the conversion pattern from `scf.parallel` to `gpu.launch` to the +/// provided pattern list. +void populateParallelLoopToGPUPatterns(RewritePatternSet &patterns); + +/// Configures the rewrite target such that only `scf.parallel` operations that +/// are not rewritten by the provided patterns are legal. +void configureParallelLoopToGPULegality(ConversionTarget &target); + +/// Clean up after applyPartialConversion/applyFullConversion call. +void finalizeParallelLoopToGPUConversion(Operation *op); + +} // namespace mlir + +#endif // MLIR_CONVERSION_SCFTOGPU_SCFTOGPU_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h new file mode 100644 index 0000000000000000000000000000000000000000..b4c843c01e370b31bac74e787e56f43a608d9336 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h @@ -0,0 +1,45 @@ +//===- SCFToGPUPass.h - Pass converting loops to GPU kernels ----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_SCFTOGPU_SCFTOGPUPASS_H_ +#define MLIR_CONVERSION_SCFTOGPU_SCFTOGPUPASS_H_ + +#include "mlir/Interfaces/FunctionInterfaces.h" +#include "mlir/Support/LLVM.h" + +#include + +namespace mlir { +template +class InterfacePass; +class Pass; + +#define GEN_PASS_DECL_CONVERTAFFINEFORTOGPU +#define GEN_PASS_DECL_CONVERTPARALLELLOOPTOGPU +#include "mlir/Conversion/Passes.h.inc" + +/// Create a pass that converts loop nests into GPU kernels. It considers +/// top-level affine.for operations as roots of loop nests and converts them to +/// the gpu.launch operations if possible. +/// +/// No check on the size of the block or grid, or on the validity of +/// parallelization is performed, it is under the responsibility of the caller +/// to strip-mine the loops and to perform the dependence analysis before +/// calling the conversion. +std::unique_ptr> +createAffineForToGPUPass(unsigned numBlockDims, unsigned numThreadDims); +std::unique_ptr> createAffineForToGPUPass(); + +/// Creates a pass that converts scf.parallel operations into a gpu.launch +/// operation. The mapping of loop dimensions to launch dimensions is derived +/// from mapping attributes. See ParallelToGpuLaunchLowering::matchAndRewrite +/// for a description of the used attributes. +std::unique_ptr createParallelLoopToGpuPass(); + +} // namespace mlir + +#endif // MLIR_CONVERSION_SCFTOGPU_SCFTOGPUPASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h new file mode 100644 index 0000000000000000000000000000000000000000..2b35bb7320df799fd80e842782d485100bd37278 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h @@ -0,0 +1,37 @@ +//===- ShapeToStandard.h - Conversion utils from shape to std dialect -----===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_SHAPETOSTANDARD_SHAPETOSTANDARD_H_ +#define MLIR_CONVERSION_SHAPETOSTANDARD_SHAPETOSTANDARD_H_ + +#include + +namespace mlir { + +class ModuleOp; +class Pass; +template +class OperationPass; +class RewritePatternSet; + +#define GEN_PASS_DECL_CONVERTSHAPECONSTRAINTS +#define GEN_PASS_DECL_CONVERTSHAPETOSTANDARD +#include "mlir/Conversion/Passes.h.inc" + +void populateShapeToStandardConversionPatterns(RewritePatternSet &patterns); + +std::unique_ptr> createConvertShapeToStandardPass(); + +void populateConvertShapeConstraintsConversionPatterns( + RewritePatternSet &patterns); + +std::unique_ptr createConvertShapeConstraintsPass(); + +} // namespace mlir + +#endif // MLIR_CONVERSION_SHAPETOSTANDARD_SHAPETOSTANDARD_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalg.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalg.h new file mode 100644 index 0000000000000000000000000000000000000000..dd5191f078968da94cac170b7f6ef6ae61898290 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalg.h @@ -0,0 +1,26 @@ +//===- TensorToLinalg.h - Tensor to Linalg Patterns -------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Provides patterns to convert Tensor dialect to Linalg dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_TENSORTOLINALG_TENSORTOLINALG_H +#define MLIR_CONVERSION_TENSORTOLINALG_TENSORTOLINALG_H + +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { + +/// Appends to a pattern list additional patterns for translating tensor ops +/// to Linalg ops. +void populateTensorToLinalgPatterns(RewritePatternSet &patterns); + +} // namespace mlir + +#endif // MLIR_CONVERSION_TENSORTOLINALG_TENSORTOLINALG_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h new file mode 100644 index 0000000000000000000000000000000000000000..af3eed1a9b5f94b4c420bdd3c0ca462b9e7b61ba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h @@ -0,0 +1,29 @@ +//===- TensorToLinalgPass.h - Tensor to Linalg Passes --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Provides passes to convert Tensor dialect to Linalg dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_TENSORTOLINALG_TENSORTOLINALGPASS_H +#define MLIR_CONVERSION_TENSORTOLINALG_TENSORTOLINALGPASS_H + +#include "mlir/Pass/Pass.h" + +namespace mlir { +class ModuleOp; + +#define GEN_PASS_DECL_CONVERTTENSORTOLINALG +#include "mlir/Conversion/Passes.h.inc" + +/// Creates a pass to convert Tensor ops to Linalg ops. +std::unique_ptr> createConvertTensorToLinalgPass(); + +} // namespace mlir + +#endif // MLIR_CONVERSION_TENSORTOLINALG_TENSORTOLINALGPASS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h new file mode 100644 index 0000000000000000000000000000000000000000..ecd33779236cc34d7e8f7db78d586682d5ddfcb4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h @@ -0,0 +1,29 @@ +//===- ConvertVectorToLLVM.h - Utils to convert from the vector dialect ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVM_H_ +#define MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVM_H_ + +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { +class LLVMTypeConverter; + +/// Collect a set of patterns to convert from Vector contractions to LLVM Matrix +/// Intrinsics. To lower to assembly, the LLVM flag -lower-matrix-intrinsics +/// will be needed when invoking LLVM. +void populateVectorToLLVMMatrixConversionPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +/// Collect a set of patterns to convert from the Vector dialect to LLVM. +void populateVectorToLLVMConversionPatterns( + LLVMTypeConverter &converter, RewritePatternSet &patterns, + bool reassociateFPReductions = false, bool force32BitVectorIndices = false); + +} // namespace mlir + +#endif // MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h new file mode 100644 index 0000000000000000000000000000000000000000..4661d31b6364d563637ce17509c9277a404dfb73 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h @@ -0,0 +1,19 @@ +//===- ConvertVectorToLLVMPass.h - Pass to check Vector->LLVM --- --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVMPASS_H_ +#define MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVMPASS_H_ + +#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h" + +namespace mlir { +class Pass; + +#define GEN_PASS_DECL_CONVERTVECTORTOLLVMPASS +#include "mlir/Conversion/Passes.h.inc" +} // namespace mlir +#endif // MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVMPASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h new file mode 100644 index 0000000000000000000000000000000000000000..1c834b6c690830f1e230d2b95543a798b10c7614 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h @@ -0,0 +1,85 @@ +//===- VectorToSCF.h - Convert vector to SCF dialect ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_CONVERSION_VECTORTOSCF_VECTORTOSCF_H_ +#define MLIR_CONVERSION_VECTORTOSCF_VECTORTOSCF_H_ + +#include "mlir/IR/PatternMatch.h" + +namespace mlir { +class MLIRContext; +class Pass; +class RewritePatternSet; + +#define GEN_PASS_DECL_CONVERTVECTORTOSCF +#include "mlir/Conversion/Passes.h.inc" + +/// When lowering an N-d vector transfer op to an (N-1)-d vector transfer op, +/// a temporary buffer is created through which individual (N-1)-d vector are +/// staged. This pattern can be applied multiple time, until the transfer op +/// is 1-d. +/// This is consistent with the lack of an LLVM instruction to dynamically +/// index into an aggregate (see the Vector dialect lowering to LLVM deep dive). +/// +/// An instruction such as: +/// ``` +/// vector.transfer_write %vec, %A[%a, %b, %c] : +/// vector<9x17x15xf32>, memref +/// ``` +/// Lowers to pseudo-IR resembling (unpacking one dimension): +/// ``` +/// %0 = alloca() : memref> +/// store %vec, %0[] : memref> +/// %1 = vector.type_cast %0 : +/// memref> to memref<9xvector<17x15xf32>> +/// affine.for %I = 0 to 9 { +/// %dim = dim %A, 0 : memref +/// %add = affine.apply %I + %a +/// %cmp = arith.cmpi "slt", %add, %dim : index +/// scf.if %cmp { +/// %vec_2d = load %1[%I] : memref<9xvector<17x15xf32>> +/// vector.transfer_write %vec_2d, %A[%add, %b, %c] : +/// vector<17x15xf32>, memref +/// ``` +/// +/// When applying the pattern a second time, the existing alloca() operation +/// is reused and only a second vector.type_cast is added. +struct VectorTransferToSCFOptions { + /// Minimal rank to which vector transfer are lowered. + unsigned targetRank = 1; + VectorTransferToSCFOptions &setTargetRank(unsigned r) { + targetRank = r; + return *this; + } + /// Allows vector transfers that operated on tensors to be lowered (this is an + /// uncommon alternative). + bool lowerTensors = false; + VectorTransferToSCFOptions &enableLowerTensors(bool l = true) { + lowerTensors = l; + return *this; + } + /// Triggers full unrolling (vs iterating with a loop) during transfer to scf. + bool unroll = false; + VectorTransferToSCFOptions &enableFullUnroll(bool u = true) { + unroll = u; + return *this; + } +}; + +/// Collect a set of patterns to convert from the Vector dialect to SCF + func. +void populateVectorToSCFConversionPatterns( + RewritePatternSet &patterns, + const VectorTransferToSCFOptions &options = VectorTransferToSCFOptions()); + +/// Create a pass to convert a subset of vector ops to SCF. +std::unique_ptr createConvertVectorToSCFPass( + const VectorTransferToSCFOptions &options = VectorTransferToSCFOptions()); + +} // namespace mlir + +#endif // MLIR_CONVERSION_VECTORTOSCF_VECTORTOSCF_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..25ed109beadbc473a7c3c6556da4000dc36386d0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.cpp.inc @@ -0,0 +1,8593 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMDGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::amdgpu::ExtPackedFp8Op, +::mlir::amdgpu::LDSBarrierOp, +::mlir::amdgpu::MFMAOp, +::mlir::amdgpu::PackedStochRoundFp8Op, +::mlir::amdgpu::PackedTrunc2xFp8Op, +::mlir::amdgpu::RawBufferAtomicCmpswapOp, +::mlir::amdgpu::RawBufferAtomicFaddOp, +::mlir::amdgpu::RawBufferAtomicFmaxOp, +::mlir::amdgpu::RawBufferAtomicSmaxOp, +::mlir::amdgpu::RawBufferAtomicUminOp, +::mlir::amdgpu::RawBufferLoadOp, +::mlir::amdgpu::RawBufferStoreOp, +::mlir::amdgpu::WMMAOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace amdgpu { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isFloat8E5M2FNUZ())) || ((type.isFloat8E4M3FNUZ())) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isFloat8E5M2FNUZ())) || ((elementType.isFloat8E4M3FNUZ())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 1)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be f8E5M2FNUZ type or f8E4M3FNUZ type or vector of f8E5M2FNUZ type or f8E4M3FNUZ type values of length 1/2/3/4, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isF32()))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit float, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isF32())) || ((type.isF64())) || ((type.isSignlessInteger(32))) || ((type.isSignlessInteger(64))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isBF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isFloat8E5M2FNUZ())) || ((elementType.isFloat8E4M3FNUZ())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit float or 64-bit float or 32-bit signless integer or 64-bit signless integer or vector of 32-bit float values of length 2 or vector of 16-bit float values of length 4 or vector of bfloat16 type values of length 2/4 or vector of 8-bit signless integer values of length 4/8 or vector of f8E5M2FNUZ type or f8E4M3FNUZ type values of length 8, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isF64())) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF64()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 64-bit float or vector of 32-bit float values of length 4/16/32 or vector of 32-bit signless integer values of length 4/16/32 or vector of 64-bit float values of length 4, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(32)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + !::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return ((elementType.isFloat8E4M3FNUZ())) || ((elementType.isFloat8E5M2FNUZ())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + !::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be fixed-length vector of f8E4M3FNUZ type or f8E5M2FNUZ type values of length 4, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessInteger(32))) || ((type.isSignlessInteger(64))) || ((type.isF32())) || ((type.isF64())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit signless integer or 64-bit signless integer or 32-bit float or 64-bit float, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isF32())) || ((type.isF64())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit float or 64-bit float, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isBF16())) || ((type.isF16())) || ((type.isF32())) || ((type.isSignlessInteger(32))) || ((type.isSignlessInteger(8))) || ((type.isFloat8E5M2FNUZ())) || ((type.isFloat8E4M3FNUZ())) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF32())) || ((elementType.isSignlessInteger(32))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isBF16())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isFloat8E5M2FNUZ())) || ((elementType.isFloat8E4M3FNUZ())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be bfloat16 type or 16-bit float or 32-bit float or 32-bit signless integer or 8-bit signless integer or f8E5M2FNUZ type or f8E4M3FNUZ type or vector of 32-bit float or 32-bit signless integer values of length 2/4 or vector of 16-bit float or bfloat16 type values of length 2/4/8 or vector of 8-bit signless integer or f8E5M2FNUZ type or f8E4M3FNUZ type values of length 2/4/8/16, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU11( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isBF16())) || ((elementType.isSignlessInteger(8))) || ((elementType.isSignedInteger(8))) || ((elementType.isUnsignedInteger(8))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of 16-bit float or bfloat16 type or 8-bit signless integer or 8-bit signed integer or 8-bit unsigned integer values of length 16, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMDGPU12( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF32())) || ((elementType.isSignlessInteger(32))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((elementType.isBF16())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of 32-bit float or 32-bit signless integer values of length 4/8 or vector of 16-bit float or bfloat16 type values of length 8/16, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() <= 3)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 3"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AMDGPU0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AMDGPU1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::amdgpu::MFMAPermBAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: The possible permutations of the lanes storing B available in an MFMA"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AMDGPU2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AMDGPU3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() <= 1)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 1"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AMDGPU4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: bool attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AMDGPU5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() >= 0)) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() <= 1)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 1"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AMDGPU6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::ExtPackedFp8Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExtPackedFp8OpGenericAdaptorBase::ExtPackedFp8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.ext_packed_fp8", odsAttrs.getContext()); +} + +ExtPackedFp8OpGenericAdaptorBase::ExtPackedFp8OpGenericAdaptorBase(ExtPackedFp8Op op) : ExtPackedFp8OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExtPackedFp8OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExtPackedFp8OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr ExtPackedFp8OpGenericAdaptorBase::getIndexAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); + return attr; +} + +uint32_t ExtPackedFp8OpGenericAdaptorBase::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +ExtPackedFp8OpAdaptor::ExtPackedFp8OpAdaptor(ExtPackedFp8Op op) : ExtPackedFp8OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExtPackedFp8OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitError(loc, "'amdgpu.ext_packed_fp8' op ""requires attribute 'index'"); + + if (tblgen_index && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getInt() <= 3)))) + return emitError(loc, "'amdgpu.ext_packed_fp8' op ""attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 3"); + return ::mlir::success(); +} + +std::pair ExtPackedFp8Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExtPackedFp8Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtPackedFp8Op::getSource() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExtPackedFp8Op::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExtPackedFp8Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExtPackedFp8Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> ExtPackedFp8Op::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ExtPackedFp8Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.index; + auto attr = dict.get("index"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for index in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `index` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ExtPackedFp8Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.index; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("index", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExtPackedFp8Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.index.getAsOpaquePointer())); +} + +std::optional ExtPackedFp8Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "index") + return prop.index; + return std::nullopt; +} + +void ExtPackedFp8Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "index") { + prop.index = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ExtPackedFp8Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.index) attrs.append("index", prop.index); +} + +::mlir::LogicalResult ExtPackedFp8Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU0(attr, "index", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtPackedFp8Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.index))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtPackedFp8Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.index); +} + +::mlir::IntegerAttr ExtPackedFp8Op::getIndexAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); +} + +uint32_t ExtPackedFp8Op::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +void ExtPackedFp8Op::setIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexAttrName(), attr); +} + +void ExtPackedFp8Op::setIndex(uint32_t attrValue) { + (*this)->setAttr(getIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void ExtPackedFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::IntegerAttr index) { + odsState.addOperands(source); + odsState.getOrAddProperties().index = index; + odsState.addTypes(res); +} + +void ExtPackedFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::IntegerAttr index) { + odsState.addOperands(source); + odsState.getOrAddProperties().index = index; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtPackedFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, uint32_t index) { + odsState.addOperands(source); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + odsState.addTypes(res); +} + +void ExtPackedFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, uint32_t index) { + odsState.addOperands(source); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtPackedFp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ExtPackedFp8Op::verifyInvariantsImpl() { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitOpError("requires attribute 'index'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU0(*this, tblgen_index, "index"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtPackedFp8Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ExtPackedFp8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::IntegerAttr indexAttr; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(indexAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (indexAttr) result.getOrAddProperties().index = indexAttr; + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::FloatType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtPackedFp8Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("index"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << "["; + _odsPrinter.printAttributeWithoutType(getIndexAttr()); + _odsPrinter << "]"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::FloatType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExtPackedFp8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::ExtPackedFp8Op) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::LDSBarrierOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LDSBarrierOpGenericAdaptorBase::LDSBarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.lds_barrier", odsAttrs.getContext()); +} + +LDSBarrierOpGenericAdaptorBase::LDSBarrierOpGenericAdaptorBase(LDSBarrierOp op) : LDSBarrierOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LDSBarrierOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LDSBarrierOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +LDSBarrierOpAdaptor::LDSBarrierOpAdaptor(LDSBarrierOp op) : LDSBarrierOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LDSBarrierOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LDSBarrierOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LDSBarrierOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair LDSBarrierOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LDSBarrierOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void LDSBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void LDSBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LDSBarrierOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LDSBarrierOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult LDSBarrierOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult LDSBarrierOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void LDSBarrierOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::LDSBarrierOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::MFMAOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MFMAOpGenericAdaptorBase::MFMAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.mfma", odsAttrs.getContext()); +} + +MFMAOpGenericAdaptorBase::MFMAOpGenericAdaptorBase(MFMAOp op) : MFMAOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MFMAOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MFMAOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MFMAOpGenericAdaptorBase::getMAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().m); + return attr; +} + +uint32_t MFMAOpGenericAdaptorBase::getM() { + auto attr = getMAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOpGenericAdaptorBase::getNAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); + return attr; +} + +uint32_t MFMAOpGenericAdaptorBase::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOpGenericAdaptorBase::getKAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().k); + return attr; +} + +uint32_t MFMAOpGenericAdaptorBase::getK() { + auto attr = getKAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOpGenericAdaptorBase::getBlocksAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().blocks); + return attr; +} + +uint32_t MFMAOpGenericAdaptorBase::getBlocks() { + auto attr = getBlocksAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOpGenericAdaptorBase::getCbszAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().cbsz); + return attr; +} + +uint32_t MFMAOpGenericAdaptorBase::getCbsz() { + auto attr = getCbszAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOpGenericAdaptorBase::getAbidAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().abid); + return attr; +} + +uint32_t MFMAOpGenericAdaptorBase::getAbid() { + auto attr = getAbidAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::amdgpu::MFMAPermBAttr MFMAOpGenericAdaptorBase::getBlgpAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::amdgpu::MFMAPermBAttr>(getProperties().blgp); + return attr; +} + +::mlir::amdgpu::MFMAPermB MFMAOpGenericAdaptorBase::getBlgp() { + auto attr = getBlgpAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr MFMAOpGenericAdaptorBase::getReducePrecisionAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().reducePrecision); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool MFMAOpGenericAdaptorBase::getReducePrecision() { + auto attr = getReducePrecisionAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr MFMAOpGenericAdaptorBase::getNegateAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().negateA); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool MFMAOpGenericAdaptorBase::getNegateA() { + auto attr = getNegateAAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr MFMAOpGenericAdaptorBase::getNegateBAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().negateB); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool MFMAOpGenericAdaptorBase::getNegateB() { + auto attr = getNegateBAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr MFMAOpGenericAdaptorBase::getNegateCAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().negateC); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool MFMAOpGenericAdaptorBase::getNegateC() { + auto attr = getNegateCAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +MFMAOpAdaptor::MFMAOpAdaptor(MFMAOp op) : MFMAOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MFMAOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_abid = getProperties().abid; (void)tblgen_abid; + auto tblgen_blgp = getProperties().blgp; (void)tblgen_blgp; + auto tblgen_blocks = getProperties().blocks; (void)tblgen_blocks; + if (!tblgen_blocks) return emitError(loc, "'amdgpu.mfma' op ""requires attribute 'blocks'"); + auto tblgen_cbsz = getProperties().cbsz; (void)tblgen_cbsz; + auto tblgen_k = getProperties().k; (void)tblgen_k; + if (!tblgen_k) return emitError(loc, "'amdgpu.mfma' op ""requires attribute 'k'"); + auto tblgen_m = getProperties().m; (void)tblgen_m; + if (!tblgen_m) return emitError(loc, "'amdgpu.mfma' op ""requires attribute 'm'"); + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitError(loc, "'amdgpu.mfma' op ""requires attribute 'n'"); + auto tblgen_negateA = getProperties().negateA; (void)tblgen_negateA; + auto tblgen_negateB = getProperties().negateB; (void)tblgen_negateB; + auto tblgen_negateC = getProperties().negateC; (void)tblgen_negateC; + auto tblgen_reducePrecision = getProperties().reducePrecision; (void)tblgen_reducePrecision; + + if (tblgen_m && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_n && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_k && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_blocks && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_blocks))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_blocks).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'blocks' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_cbsz && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_cbsz))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_cbsz).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'cbsz' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_abid && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_abid))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_abid).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'abid' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_blgp && !((::llvm::isa<::mlir::amdgpu::MFMAPermBAttr>(tblgen_blgp)))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'blgp' failed to satisfy constraint: The possible permutations of the lanes storing B available in an MFMA"); + + if (tblgen_reducePrecision && !((::llvm::isa<::mlir::UnitAttr>(tblgen_reducePrecision)))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'reducePrecision' failed to satisfy constraint: unit attribute"); + + if (tblgen_negateA && !((::llvm::isa<::mlir::UnitAttr>(tblgen_negateA)))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'negateA' failed to satisfy constraint: unit attribute"); + + if (tblgen_negateB && !((::llvm::isa<::mlir::UnitAttr>(tblgen_negateB)))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'negateB' failed to satisfy constraint: unit attribute"); + + if (tblgen_negateC && !((::llvm::isa<::mlir::UnitAttr>(tblgen_negateC)))) + return emitError(loc, "'amdgpu.mfma' op ""attribute 'negateC' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair MFMAOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MFMAOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MFMAOp::getSourceA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MFMAOp::getSourceB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value MFMAOp::getDestC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MFMAOp::getSourceAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MFMAOp::getSourceBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MFMAOp::getDestCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MFMAOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MFMAOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MFMAOp::getDestD() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MFMAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.abid; + auto attr = dict.get("abid"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for abid in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `abid` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.blgp; + auto attr = dict.get("blgp"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for blgp in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `blgp` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.blocks; + auto attr = dict.get("blocks"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for blocks in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `blocks` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.cbsz; + auto attr = dict.get("cbsz"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for cbsz in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cbsz` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.k; + auto attr = dict.get("k"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for k in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `k` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.m; + auto attr = dict.get("m"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for m in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `m` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.n; + auto attr = dict.get("n"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for n in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `n` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.negateA; + auto attr = dict.get("negateA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for negateA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `negateA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.negateB; + auto attr = dict.get("negateB"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for negateB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `negateB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.negateC; + auto attr = dict.get("negateC"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for negateC in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `negateC` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.reducePrecision; + auto attr = dict.get("reducePrecision"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for reducePrecision in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reducePrecision` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MFMAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.abid; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("abid", + propStorage)); + } + + { + const auto &propStorage = prop.blgp; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("blgp", + propStorage)); + } + + { + const auto &propStorage = prop.blocks; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("blocks", + propStorage)); + } + + { + const auto &propStorage = prop.cbsz; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cbsz", + propStorage)); + } + + { + const auto &propStorage = prop.k; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("k", + propStorage)); + } + + { + const auto &propStorage = prop.m; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("m", + propStorage)); + } + + { + const auto &propStorage = prop.n; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("n", + propStorage)); + } + + { + const auto &propStorage = prop.negateA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("negateA", + propStorage)); + } + + { + const auto &propStorage = prop.negateB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("negateB", + propStorage)); + } + + { + const auto &propStorage = prop.negateC; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("negateC", + propStorage)); + } + + { + const auto &propStorage = prop.reducePrecision; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reducePrecision", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MFMAOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.abid.getAsOpaquePointer()), + llvm::hash_value(prop.blgp.getAsOpaquePointer()), + llvm::hash_value(prop.blocks.getAsOpaquePointer()), + llvm::hash_value(prop.cbsz.getAsOpaquePointer()), + llvm::hash_value(prop.k.getAsOpaquePointer()), + llvm::hash_value(prop.m.getAsOpaquePointer()), + llvm::hash_value(prop.n.getAsOpaquePointer()), + llvm::hash_value(prop.negateA.getAsOpaquePointer()), + llvm::hash_value(prop.negateB.getAsOpaquePointer()), + llvm::hash_value(prop.negateC.getAsOpaquePointer()), + llvm::hash_value(prop.reducePrecision.getAsOpaquePointer())); +} + +std::optional MFMAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "abid") + return prop.abid; + + if (name == "blgp") + return prop.blgp; + + if (name == "blocks") + return prop.blocks; + + if (name == "cbsz") + return prop.cbsz; + + if (name == "k") + return prop.k; + + if (name == "m") + return prop.m; + + if (name == "n") + return prop.n; + + if (name == "negateA") + return prop.negateA; + + if (name == "negateB") + return prop.negateB; + + if (name == "negateC") + return prop.negateC; + + if (name == "reducePrecision") + return prop.reducePrecision; + return std::nullopt; +} + +void MFMAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "abid") { + prop.abid = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "blgp") { + prop.blgp = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "blocks") { + prop.blocks = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "cbsz") { + prop.cbsz = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "k") { + prop.k = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "m") { + prop.m = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "n") { + prop.n = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "negateA") { + prop.negateA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "negateB") { + prop.negateB = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "negateC") { + prop.negateC = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "reducePrecision") { + prop.reducePrecision = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MFMAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.abid) attrs.append("abid", prop.abid); + + if (prop.blgp) attrs.append("blgp", prop.blgp); + + if (prop.blocks) attrs.append("blocks", prop.blocks); + + if (prop.cbsz) attrs.append("cbsz", prop.cbsz); + + if (prop.k) attrs.append("k", prop.k); + + if (prop.m) attrs.append("m", prop.m); + + if (prop.n) attrs.append("n", prop.n); + + if (prop.negateA) attrs.append("negateA", prop.negateA); + + if (prop.negateB) attrs.append("negateB", prop.negateB); + + if (prop.negateC) attrs.append("negateC", prop.negateC); + + if (prop.reducePrecision) attrs.append("reducePrecision", prop.reducePrecision); +} + +::mlir::LogicalResult MFMAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAbidAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "abid", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getBlgpAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU2(attr, "blgp", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getBlocksAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "blocks", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCbszAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "cbsz", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getKAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "k", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "m", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "n", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNegateAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "negateA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNegateBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "negateB", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNegateCAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "negateC", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReducePrecisionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "reducePrecision", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MFMAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.abid))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.blgp))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.blocks))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.cbsz))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.k))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.m))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.n))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.negateA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.negateB))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.negateC))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.reducePrecision))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MFMAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.abid); + + writer.writeOptionalAttribute(prop.blgp); + writer.writeAttribute(prop.blocks); + + writer.writeOptionalAttribute(prop.cbsz); + writer.writeAttribute(prop.k); + writer.writeAttribute(prop.m); + writer.writeAttribute(prop.n); + + writer.writeOptionalAttribute(prop.negateA); + + writer.writeOptionalAttribute(prop.negateB); + + writer.writeOptionalAttribute(prop.negateC); + + writer.writeOptionalAttribute(prop.reducePrecision); +} + +::mlir::IntegerAttr MFMAOp::getMAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().m); +} + +uint32_t MFMAOp::getM() { + auto attr = getMAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOp::getNAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); +} + +uint32_t MFMAOp::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOp::getKAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().k); +} + +uint32_t MFMAOp::getK() { + auto attr = getKAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOp::getBlocksAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().blocks); +} + +uint32_t MFMAOp::getBlocks() { + auto attr = getBlocksAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOp::getCbszAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().cbsz); +} + +uint32_t MFMAOp::getCbsz() { + auto attr = getCbszAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MFMAOp::getAbidAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().abid); +} + +uint32_t MFMAOp::getAbid() { + auto attr = getAbidAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::amdgpu::MFMAPermBAttr MFMAOp::getBlgpAttr() { + return ::llvm::dyn_cast_or_null<::mlir::amdgpu::MFMAPermBAttr>(getProperties().blgp); +} + +::mlir::amdgpu::MFMAPermB MFMAOp::getBlgp() { + auto attr = getBlgpAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr MFMAOp::getReducePrecisionAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().reducePrecision); +} + +bool MFMAOp::getReducePrecision() { + auto attr = getReducePrecisionAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr MFMAOp::getNegateAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().negateA); +} + +bool MFMAOp::getNegateA() { + auto attr = getNegateAAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr MFMAOp::getNegateBAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().negateB); +} + +bool MFMAOp::getNegateB() { + auto attr = getNegateBAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr MFMAOp::getNegateCAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().negateC); +} + +bool MFMAOp::getNegateC() { + auto attr = getNegateCAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void MFMAOp::setMAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getMAttrName(), attr); +} + +void MFMAOp::setM(uint32_t attrValue) { + (*this)->setAttr(getMAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MFMAOp::setNAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getNAttrName(), attr); +} + +void MFMAOp::setN(uint32_t attrValue) { + (*this)->setAttr(getNAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MFMAOp::setKAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getKAttrName(), attr); +} + +void MFMAOp::setK(uint32_t attrValue) { + (*this)->setAttr(getKAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MFMAOp::setBlocksAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getBlocksAttrName(), attr); +} + +void MFMAOp::setBlocks(uint32_t attrValue) { + (*this)->setAttr(getBlocksAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MFMAOp::setCbszAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getCbszAttrName(), attr); +} + +void MFMAOp::setCbsz(uint32_t attrValue) { + (*this)->setAttr(getCbszAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MFMAOp::setAbidAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAbidAttrName(), attr); +} + +void MFMAOp::setAbid(uint32_t attrValue) { + (*this)->setAttr(getAbidAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MFMAOp::setBlgpAttr(::mlir::amdgpu::MFMAPermBAttr attr) { + (*this)->setAttr(getBlgpAttrName(), attr); +} + +void MFMAOp::setBlgp(::mlir::amdgpu::MFMAPermB attrValue) { + (*this)->setAttr(getBlgpAttrName(), ::mlir::amdgpu::MFMAPermBAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MFMAOp::setReducePrecisionAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getReducePrecisionAttrName(), attr); +} + +void MFMAOp::setReducePrecision(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getReducePrecisionAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getReducePrecisionAttrName()); +} + +void MFMAOp::setNegateAAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNegateAAttrName(), attr); +} + +void MFMAOp::setNegateA(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNegateAAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNegateAAttrName()); +} + +void MFMAOp::setNegateBAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNegateBAttrName(), attr); +} + +void MFMAOp::setNegateB(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNegateBAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNegateBAttrName()); +} + +void MFMAOp::setNegateCAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNegateCAttrName(), attr); +} + +void MFMAOp::setNegateC(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNegateCAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNegateCAttrName()); +} + +::mlir::Attribute MFMAOp::removeReducePrecisionAttr() { + auto &attr = getProperties().reducePrecision; + attr = {}; + return attr; +} + +::mlir::Attribute MFMAOp::removeNegateAAttr() { + auto &attr = getProperties().negateA; + attr = {}; + return attr; +} + +::mlir::Attribute MFMAOp::removeNegateBAttr() { + auto &attr = getProperties().negateB; + attr = {}; + return attr; +} + +::mlir::Attribute MFMAOp::removeNegateCAttr() { + auto &attr = getProperties().negateC; + attr = {}; + return attr; +} + +void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::amdgpu::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) { + odsState.addOperands(sourceA); + odsState.addOperands(sourceB); + odsState.addOperands(destC); + odsState.getOrAddProperties().m = m; + odsState.getOrAddProperties().n = n; + odsState.getOrAddProperties().k = k; + odsState.getOrAddProperties().blocks = blocks; + if (cbsz) { + odsState.getOrAddProperties().cbsz = cbsz; + } + if (abid) { + odsState.getOrAddProperties().abid = abid; + } + if (blgp) { + odsState.getOrAddProperties().blgp = blgp; + } + if (reducePrecision) { + odsState.getOrAddProperties().reducePrecision = reducePrecision; + } + if (negateA) { + odsState.getOrAddProperties().negateA = negateA; + } + if (negateB) { + odsState.getOrAddProperties().negateB = negateB; + } + if (negateC) { + odsState.getOrAddProperties().negateC = negateC; + } + odsState.addTypes(destD); +} + +void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::amdgpu::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) { + odsState.addOperands(sourceA); + odsState.addOperands(sourceB); + odsState.addOperands(destC); + odsState.getOrAddProperties().m = m; + odsState.getOrAddProperties().n = n; + odsState.getOrAddProperties().k = k; + odsState.getOrAddProperties().blocks = blocks; + if (cbsz) { + odsState.getOrAddProperties().cbsz = cbsz; + } + if (abid) { + odsState.getOrAddProperties().abid = abid; + } + if (blgp) { + odsState.getOrAddProperties().blgp = blgp; + } + if (reducePrecision) { + odsState.getOrAddProperties().reducePrecision = reducePrecision; + } + if (negateA) { + odsState.getOrAddProperties().negateA = negateA; + } + if (negateB) { + odsState.getOrAddProperties().negateB = negateB; + } + if (negateC) { + odsState.getOrAddProperties().negateC = negateC; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::amdgpu::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) { + odsState.addOperands(sourceA); + odsState.addOperands(sourceB); + odsState.addOperands(destC); + odsState.getOrAddProperties().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m); + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); + odsState.getOrAddProperties().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k); + odsState.getOrAddProperties().blocks = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), blocks); + odsState.getOrAddProperties().cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cbsz); + odsState.getOrAddProperties().abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), abid); + odsState.getOrAddProperties().blgp = ::mlir::amdgpu::MFMAPermBAttr::get(odsBuilder.getContext(), blgp); + if (reducePrecision) { + odsState.getOrAddProperties().reducePrecision = ((reducePrecision) ? odsBuilder.getUnitAttr() : nullptr); + } + if (negateA) { + odsState.getOrAddProperties().negateA = ((negateA) ? odsBuilder.getUnitAttr() : nullptr); + } + if (negateB) { + odsState.getOrAddProperties().negateB = ((negateB) ? odsBuilder.getUnitAttr() : nullptr); + } + if (negateC) { + odsState.getOrAddProperties().negateC = ((negateC) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(destD); +} + +void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::amdgpu::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) { + odsState.addOperands(sourceA); + odsState.addOperands(sourceB); + odsState.addOperands(destC); + odsState.getOrAddProperties().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m); + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); + odsState.getOrAddProperties().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k); + odsState.getOrAddProperties().blocks = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), blocks); + odsState.getOrAddProperties().cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cbsz); + odsState.getOrAddProperties().abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), abid); + odsState.getOrAddProperties().blgp = ::mlir::amdgpu::MFMAPermBAttr::get(odsBuilder.getContext(), blgp); + if (reducePrecision) { + odsState.getOrAddProperties().reducePrecision = ((reducePrecision) ? odsBuilder.getUnitAttr() : nullptr); + } + if (negateA) { + odsState.getOrAddProperties().negateA = ((negateA) ? odsBuilder.getUnitAttr() : nullptr); + } + if (negateB) { + odsState.getOrAddProperties().negateB = ((negateB) ? odsBuilder.getUnitAttr() : nullptr); + } + if (negateC) { + odsState.getOrAddProperties().negateC = ((negateC) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MFMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MFMAOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.cbsz) + properties.cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0); + if (!properties.abid) + properties.abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0); + if (!properties.blgp) + properties.blgp = ::mlir::amdgpu::MFMAPermBAttr::get(odsBuilder.getContext(), ::mlir::amdgpu::MFMAPermB::none); +} + +::mlir::LogicalResult MFMAOp::verifyInvariantsImpl() { + auto tblgen_abid = getProperties().abid; (void)tblgen_abid; + auto tblgen_blgp = getProperties().blgp; (void)tblgen_blgp; + auto tblgen_blocks = getProperties().blocks; (void)tblgen_blocks; + if (!tblgen_blocks) return emitOpError("requires attribute 'blocks'"); + auto tblgen_cbsz = getProperties().cbsz; (void)tblgen_cbsz; + auto tblgen_k = getProperties().k; (void)tblgen_k; + if (!tblgen_k) return emitOpError("requires attribute 'k'"); + auto tblgen_m = getProperties().m; (void)tblgen_m; + if (!tblgen_m) return emitOpError("requires attribute 'm'"); + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitOpError("requires attribute 'n'"); + auto tblgen_negateA = getProperties().negateA; (void)tblgen_negateA; + auto tblgen_negateB = getProperties().negateB; (void)tblgen_negateB; + auto tblgen_negateC = getProperties().negateC; (void)tblgen_negateC; + auto tblgen_reducePrecision = getProperties().reducePrecision; (void)tblgen_reducePrecision; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_m, "m"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_n, "n"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_k, "k"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_blocks, "blocks"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_cbsz, "cbsz"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_abid, "abid"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU2(*this, tblgen_blgp, "blgp"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_reducePrecision, "reducePrecision"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_negateA, "negateA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_negateB, "negateB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_negateC, "negateC"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType())))) + return emitOpError("failed to verify that all of {destC, destD} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult MFMAOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult MFMAOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(sourceARawOperands); ::llvm::SMLoc sourceAOperandsLoc; + (void)sourceAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand sourceBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceBOperands(sourceBRawOperands); ::llvm::SMLoc sourceBOperandsLoc; + (void)sourceBOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand destCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destCOperands(destCRawOperands); ::llvm::SMLoc destCOperandsLoc; + (void)destCOperandsLoc; + ::mlir::amdgpu::MFMAPermBAttr blgpAttr; + ::mlir::Type sourceARawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceATypes(sourceARawTypes); + ::mlir::Type sourceBRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceBTypes(sourceBRawTypes); + ::mlir::Type destCRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> destCTypes(destCRawTypes); + + sourceAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceARawOperands[0])) + return ::mlir::failure(); + if (parser.parseStar()) + return ::mlir::failure(); + + sourceBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceBRawOperands[0])) + return ::mlir::failure(); + if (parser.parsePlus()) + return ::mlir::failure(); + + destCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(destCRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseKeyword("blgp")) + return ::mlir::failure(); + if (parser.parseEqual()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(blgpAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (blgpAttr) result.getOrAddProperties().blgp = blgpAttr; + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceARawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceBRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + destCRawTypes[0] = type; + } + result.addTypes(destCTypes[0]); + if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sourceBOperands, sourceBTypes, sourceBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(destCOperands, destCTypes, destCOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MFMAOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSourceA(); + _odsPrinter << ' ' << "*"; + _odsPrinter << ' '; + _odsPrinter << getSourceB(); + _odsPrinter << ' ' << "+"; + _odsPrinter << ' '; + _odsPrinter << getDestC(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("blgp"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getCbszAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0))) + elidedAttrs.push_back("cbsz"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAbidAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0))) + elidedAttrs.push_back("abid"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getBlgpAttr(); + if(attr && (attr == ::mlir::amdgpu::MFMAPermBAttr::get(odsBuilder.getContext(), ::mlir::amdgpu::MFMAPermB::none))) + elidedAttrs.push_back("blgp"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getReducePrecisionAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("reducePrecision"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNegateAAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("negateA"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNegateBAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("negateB"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNegateCAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("negateC"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "blgp"; + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getBlgpAttr()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSourceA().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getSourceB().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getDestC().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MFMAOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MFMAOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::PackedStochRoundFp8Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PackedStochRoundFp8OpGenericAdaptorBase::PackedStochRoundFp8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.packed_stoch_round_fp8", odsAttrs.getContext()); +} + +PackedStochRoundFp8OpGenericAdaptorBase::PackedStochRoundFp8OpGenericAdaptorBase(PackedStochRoundFp8Op op) : PackedStochRoundFp8OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PackedStochRoundFp8OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr PackedStochRoundFp8OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr PackedStochRoundFp8OpGenericAdaptorBase::getStoreIndexAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().storeIndex); + return attr; +} + +uint32_t PackedStochRoundFp8OpGenericAdaptorBase::getStoreIndex() { + auto attr = getStoreIndexAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +PackedStochRoundFp8OpAdaptor::PackedStochRoundFp8OpAdaptor(PackedStochRoundFp8Op op) : PackedStochRoundFp8OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PackedStochRoundFp8OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_storeIndex = getProperties().storeIndex; (void)tblgen_storeIndex; + if (!tblgen_storeIndex) return emitError(loc, "'amdgpu.packed_stoch_round_fp8' op ""requires attribute 'storeIndex'"); + + if (tblgen_storeIndex && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_storeIndex))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_storeIndex).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_storeIndex).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_storeIndex).getInt() <= 3)))) + return emitError(loc, "'amdgpu.packed_stoch_round_fp8' op ""attribute 'storeIndex' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 3"); + return ::mlir::success(); +} + +std::pair PackedStochRoundFp8Op::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range PackedStochRoundFp8Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> PackedStochRoundFp8Op::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> PackedStochRoundFp8Op::getStochiasticParam() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> PackedStochRoundFp8Op::getExisting() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::TypedValue<::mlir::VectorType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*operands.begin()); +} + +::mlir::OpOperand &PackedStochRoundFp8Op::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &PackedStochRoundFp8Op::getStochiasticParamMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange PackedStochRoundFp8Op::getExistingMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair PackedStochRoundFp8Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PackedStochRoundFp8Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> PackedStochRoundFp8Op::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult PackedStochRoundFp8Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.storeIndex; + auto attr = dict.get("storeIndex"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for storeIndex in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `storeIndex` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute PackedStochRoundFp8Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.storeIndex; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("storeIndex", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PackedStochRoundFp8Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.storeIndex.getAsOpaquePointer())); +} + +std::optional PackedStochRoundFp8Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "storeIndex") + return prop.storeIndex; + return std::nullopt; +} + +void PackedStochRoundFp8Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "storeIndex") { + prop.storeIndex = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void PackedStochRoundFp8Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.storeIndex) attrs.append("storeIndex", prop.storeIndex); +} + +::mlir::LogicalResult PackedStochRoundFp8Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getStoreIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU0(attr, "storeIndex", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PackedStochRoundFp8Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.storeIndex))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PackedStochRoundFp8Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.storeIndex); +} + +::mlir::IntegerAttr PackedStochRoundFp8Op::getStoreIndexAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().storeIndex); +} + +uint32_t PackedStochRoundFp8Op::getStoreIndex() { + auto attr = getStoreIndexAttr(); + return attr.getValue().getZExtValue(); +} + +void PackedStochRoundFp8Op::setStoreIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getStoreIndexAttrName(), attr); +} + +void PackedStochRoundFp8Op::setStoreIndex(uint32_t attrValue) { + (*this)->setAttr(getStoreIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void PackedStochRoundFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing) { + odsState.addOperands(source); + odsState.addOperands(stochiasticParam); + if (existing) + odsState.addOperands(existing); + odsState.getOrAddProperties().storeIndex = storeIndex; + odsState.addTypes(res); +} + +void PackedStochRoundFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing) { + odsState.addOperands(source); + odsState.addOperands(stochiasticParam); + if (existing) + odsState.addOperands(existing); + odsState.getOrAddProperties().storeIndex = storeIndex; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PackedStochRoundFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing) { + odsState.addOperands(source); + odsState.addOperands(stochiasticParam); + if (existing) + odsState.addOperands(existing); + odsState.getOrAddProperties().storeIndex = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), storeIndex); + odsState.addTypes(res); +} + +void PackedStochRoundFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing) { + odsState.addOperands(source); + odsState.addOperands(stochiasticParam); + if (existing) + odsState.addOperands(existing); + odsState.getOrAddProperties().storeIndex = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), storeIndex); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PackedStochRoundFp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult PackedStochRoundFp8Op::verifyInvariantsImpl() { + auto tblgen_storeIndex = getProperties().storeIndex; (void)tblgen_storeIndex; + if (!tblgen_storeIndex) return emitOpError("requires attribute 'storeIndex'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU0(*this, tblgen_storeIndex, "storeIndex"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PackedStochRoundFp8Op::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult PackedStochRoundFp8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand stochiasticParamRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> stochiasticParamOperands(stochiasticParamRawOperands); ::llvm::SMLoc stochiasticParamOperandsLoc; + (void)stochiasticParamOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> existingOperands; + ::llvm::SMLoc existingOperandsLoc; + (void)existingOperandsLoc; + ::mlir::IntegerAttr storeIndexAttr; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> existingTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parsePlus()) + return ::mlir::failure(); + + stochiasticParamOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(stochiasticParamRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + existingOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + existingOperands.push_back(operand); + } + } + if (!existingOperands.empty()) { + } else { + if (parser.parseKeyword("undef")) + return ::mlir::failure(); + } + if (parser.parseLSquare()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(storeIndexAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (storeIndexAttr) result.getOrAddProperties().storeIndex = storeIndexAttr; + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::FloatType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + if (::mlir::succeeded(parser.parseOptionalKeyword("into"))) { + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + existingTypes.push_back(optionalType); + } + } + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(stochiasticParamOperands, odsBuildableType0, stochiasticParamOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(existingOperands, existingTypes, existingOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PackedStochRoundFp8Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("storeIndex"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << ' ' << "+"; + _odsPrinter << ' '; + _odsPrinter << getStochiasticParam(); + _odsPrinter << ' ' << "into"; + if (getExisting()) { + _odsPrinter << ' '; + if (::mlir::Value value = getExisting()) + _odsPrinter << value; + } else { + _odsPrinter << ' ' << "undef"; + } + _odsPrinter << "["; + _odsPrinter.printAttributeWithoutType(getStoreIndexAttr()); + _odsPrinter << "]"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::FloatType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + if (getExisting()) { + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter << (getExisting() ? ::llvm::ArrayRef<::mlir::Type>(getExisting().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + } +} + +void PackedStochRoundFp8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::PackedStochRoundFp8Op) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::PackedTrunc2xFp8Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PackedTrunc2xFp8OpGenericAdaptorBase::PackedTrunc2xFp8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.packed_trunc_2xfp8", odsAttrs.getContext()); +} + +PackedTrunc2xFp8OpGenericAdaptorBase::PackedTrunc2xFp8OpGenericAdaptorBase(PackedTrunc2xFp8Op op) : PackedTrunc2xFp8OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PackedTrunc2xFp8OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PackedTrunc2xFp8OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr PackedTrunc2xFp8OpGenericAdaptorBase::getWordIndexAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().wordIndex); + return attr; +} + +uint32_t PackedTrunc2xFp8OpGenericAdaptorBase::getWordIndex() { + auto attr = getWordIndexAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +PackedTrunc2xFp8OpAdaptor::PackedTrunc2xFp8OpAdaptor(PackedTrunc2xFp8Op op) : PackedTrunc2xFp8OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PackedTrunc2xFp8OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_wordIndex = getProperties().wordIndex; (void)tblgen_wordIndex; + if (!tblgen_wordIndex) return emitError(loc, "'amdgpu.packed_trunc_2xfp8' op ""requires attribute 'wordIndex'"); + + if (tblgen_wordIndex && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_wordIndex))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_wordIndex).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_wordIndex).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_wordIndex).getInt() <= 1)))) + return emitError(loc, "'amdgpu.packed_trunc_2xfp8' op ""attribute 'wordIndex' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 1"); + return ::mlir::success(); +} + +std::pair PackedTrunc2xFp8Op::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PackedTrunc2xFp8Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> PackedTrunc2xFp8Op::getSourceA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::FloatType> PackedTrunc2xFp8Op::getSourceB() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::FloatType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::VectorType> PackedTrunc2xFp8Op::getExisting() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::TypedValue<::mlir::VectorType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*operands.begin()); +} + +::mlir::OpOperand &PackedTrunc2xFp8Op::getSourceAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange PackedTrunc2xFp8Op::getSourceBMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PackedTrunc2xFp8Op::getExistingMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PackedTrunc2xFp8Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PackedTrunc2xFp8Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> PackedTrunc2xFp8Op::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult PackedTrunc2xFp8Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.wordIndex; + auto attr = dict.get("wordIndex"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for wordIndex in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `wordIndex` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PackedTrunc2xFp8Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.wordIndex; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("wordIndex", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PackedTrunc2xFp8Op::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.wordIndex.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PackedTrunc2xFp8Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "wordIndex") + return prop.wordIndex; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PackedTrunc2xFp8Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "wordIndex") { + prop.wordIndex = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PackedTrunc2xFp8Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.wordIndex) attrs.append("wordIndex", prop.wordIndex); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PackedTrunc2xFp8Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getWordIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "wordIndex", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PackedTrunc2xFp8Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.wordIndex))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PackedTrunc2xFp8Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.wordIndex); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::IntegerAttr PackedTrunc2xFp8Op::getWordIndexAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().wordIndex); +} + +uint32_t PackedTrunc2xFp8Op::getWordIndex() { + auto attr = getWordIndexAttr(); + return attr.getValue().getZExtValue(); +} + +void PackedTrunc2xFp8Op::setWordIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getWordIndexAttrName(), attr); +} + +void PackedTrunc2xFp8Op::setWordIndex(uint32_t attrValue) { + (*this)->setAttr(getWordIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing) { + odsState.addOperands(sourceA); + if (sourceB) + odsState.addOperands(sourceB); + if (existing) + odsState.addOperands(existing); + ::llvm::copy(::llvm::ArrayRef({1, (sourceB ? 1 : 0), (existing ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().wordIndex = wordIndex; + odsState.addTypes(res); +} + +void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing) { + odsState.addOperands(sourceA); + if (sourceB) + odsState.addOperands(sourceB); + if (existing) + odsState.addOperands(existing); + ::llvm::copy(::llvm::ArrayRef({1, (sourceB ? 1 : 0), (existing ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().wordIndex = wordIndex; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing) { + odsState.addOperands(sourceA); + if (sourceB) + odsState.addOperands(sourceB); + if (existing) + odsState.addOperands(existing); + ::llvm::copy(::llvm::ArrayRef({1, (sourceB ? 1 : 0), (existing ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().wordIndex = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), wordIndex); + odsState.addTypes(res); +} + +void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing) { + odsState.addOperands(sourceA); + if (sourceB) + odsState.addOperands(sourceB); + if (existing) + odsState.addOperands(existing); + ::llvm::copy(::llvm::ArrayRef({1, (sourceB ? 1 : 0), (existing ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().wordIndex = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), wordIndex); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult PackedTrunc2xFp8Op::verifyInvariantsImpl() { + auto tblgen_wordIndex = getProperties().wordIndex; (void)tblgen_wordIndex; + if (!tblgen_wordIndex) return emitOpError("requires attribute 'wordIndex'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_wordIndex, "wordIndex"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PackedTrunc2xFp8Op::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult PackedTrunc2xFp8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(sourceARawOperands); ::llvm::SMLoc sourceAOperandsLoc; + (void)sourceAOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sourceBOperands; + ::llvm::SMLoc sourceBOperandsLoc; + (void)sourceBOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> existingOperands; + ::llvm::SMLoc existingOperandsLoc; + (void)existingOperandsLoc; + ::mlir::IntegerAttr wordIndexAttr; + ::mlir::Type sourceARawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceATypes(sourceARawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> existingTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + sourceAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + { + sourceBOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + sourceBOperands.push_back(operand); + } + } + if (!sourceBOperands.empty()) { + } else { + if (parser.parseKeyword("undef")) + return ::mlir::failure(); + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + existingOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + existingOperands.push_back(operand); + } + } + if (!existingOperands.empty()) { + } else { + if (parser.parseKeyword("undef")) + return ::mlir::failure(); + } + if (parser.parseLSquare()) + return ::mlir::failure(); + if (parser.parseKeyword("word")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(wordIndexAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (wordIndexAttr) result.getOrAddProperties().wordIndex = wordIndexAttr; + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::FloatType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceARawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + if (::mlir::succeeded(parser.parseOptionalKeyword("into"))) { + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + existingTypes.push_back(optionalType); + } + } + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(sourceBOperands.size()), static_cast(existingOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getF32Type(); + result.addTypes(resTypes); + if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sourceBOperands, odsBuildableType0, sourceBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(existingOperands, existingTypes, existingOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PackedTrunc2xFp8Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("wordIndex"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSourceA(); + _odsPrinter << ","; + if (getSourceB()) { + _odsPrinter << ' '; + if (::mlir::Value value = getSourceB()) + _odsPrinter << value; + } else { + _odsPrinter << ' ' << "undef"; + } + _odsPrinter << ' ' << "into"; + if (getExisting()) { + _odsPrinter << ' '; + if (::mlir::Value value = getExisting()) + _odsPrinter << value; + } else { + _odsPrinter << ' ' << "undef"; + } + _odsPrinter << "["; + _odsPrinter << "word"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getWordIndexAttr()); + _odsPrinter << "]"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSourceA().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::FloatType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + if (getExisting()) { + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter << (getExisting() ? ::llvm::ArrayRef<::mlir::Type>(getExisting().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + } +} + +void PackedTrunc2xFp8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::PackedTrunc2xFp8Op) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicCmpswapOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicCmpswapOpGenericAdaptorBase::RawBufferAtomicCmpswapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.raw_buffer_atomic_cmpswap", odsAttrs.getContext()); +} + +RawBufferAtomicCmpswapOpGenericAdaptorBase::RawBufferAtomicCmpswapOpGenericAdaptorBase(RawBufferAtomicCmpswapOp op) : RawBufferAtomicCmpswapOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicCmpswapOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr RawBufferAtomicCmpswapOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr RawBufferAtomicCmpswapOpGenericAdaptorBase::getBoundsCheckAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); + return attr; +} + +bool RawBufferAtomicCmpswapOpGenericAdaptorBase::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicCmpswapOpGenericAdaptorBase::getIndexOffsetAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); + return attr; +} + +::std::optional RawBufferAtomicCmpswapOpGenericAdaptorBase::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +RawBufferAtomicCmpswapOpAdaptor::RawBufferAtomicCmpswapOpAdaptor(RawBufferAtomicCmpswapOp op) : RawBufferAtomicCmpswapOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicCmpswapOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck)))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_cmpswap' op ""attribute 'boundsCheck' failed to satisfy constraint: bool attribute"); + + if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_cmpswap' op ""attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair RawBufferAtomicCmpswapOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range RawBufferAtomicCmpswapOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferAtomicCmpswapOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RawBufferAtomicCmpswapOp::getCmp() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> RawBufferAtomicCmpswapOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(2).begin()); +} + +::mlir::Operation::operand_range RawBufferAtomicCmpswapOp::getIndices() { + return getODSOperands(3); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicCmpswapOp::getSgprOffset() { + auto operands = getODSOperands(4); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::OpOperand &RawBufferAtomicCmpswapOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicCmpswapOp::getCmpMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicCmpswapOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange RawBufferAtomicCmpswapOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange RawBufferAtomicCmpswapOp::getSgprOffsetMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair RawBufferAtomicCmpswapOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicCmpswapOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferAtomicCmpswapOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RawBufferAtomicCmpswapOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.boundsCheck; + auto attr = dict.get("boundsCheck"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for boundsCheck in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.indexOffset; + auto attr = dict.get("indexOffset"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for indexOffset in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute RawBufferAtomicCmpswapOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.boundsCheck; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("boundsCheck", + propStorage)); + } + + { + const auto &propStorage = prop.indexOffset; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("indexOffset", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawBufferAtomicCmpswapOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()), + llvm::hash_value(prop.indexOffset.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional RawBufferAtomicCmpswapOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "boundsCheck") + return prop.boundsCheck; + + if (name == "indexOffset") + return prop.indexOffset; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void RawBufferAtomicCmpswapOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "boundsCheck") { + prop.boundsCheck = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "indexOffset") { + prop.indexOffset = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void RawBufferAtomicCmpswapOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck); + + if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult RawBufferAtomicCmpswapOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "boundsCheck", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "indexOffset", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicCmpswapOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RawBufferAtomicCmpswapOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.boundsCheck); + + writer.writeOptionalAttribute(prop.indexOffset); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::BoolAttr RawBufferAtomicCmpswapOp::getBoundsCheckAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); +} + +bool RawBufferAtomicCmpswapOp::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicCmpswapOp::getIndexOffsetAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); +} + +::std::optional RawBufferAtomicCmpswapOp::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void RawBufferAtomicCmpswapOp::setBoundsCheckAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getBoundsCheckAttrName(), attr); +} + +void RawBufferAtomicCmpswapOp::setBoundsCheck(bool attrValue) { + (*this)->setAttr(getBoundsCheckAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void RawBufferAtomicCmpswapOp::setIndexOffsetAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexOffsetAttrName(), attr); +} + +void RawBufferAtomicCmpswapOp::setIndexOffset(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexOffsetAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexOffsetAttrName()); +} + +::mlir::Attribute RawBufferAtomicCmpswapOp::removeIndexOffsetAttr() { + auto &attr = getProperties().indexOffset; + attr = {}; + return attr; +} + +void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(src); + odsState.addOperands(cmp); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + odsState.addTypes(value); +} + +void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(src); + odsState.addOperands(cmp); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(src); + odsState.addOperands(cmp); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + odsState.addTypes(value); +} + +void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(src); + odsState.addOperands(cmp); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicCmpswapOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.boundsCheck) + properties.boundsCheck = odsBuilder.getBoolAttr(true); +} + +::mlir::LogicalResult RawBufferAtomicCmpswapOp::verifyInvariantsImpl() { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_boundsCheck, "boundsCheck"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_indexOffset, "indexOffset"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + if (valueGroup4.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup4.size(); + } + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {src, cmp, value} have same type"); + if (!(((getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin())))))) + return emitOpError("failed to verify that all of {value, memref} have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicCmpswapOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult RawBufferAtomicCmpswapOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(srcRawOperands); ::llvm::SMLoc srcOperandsLoc; + (void)srcOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand cmpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> cmpOperands(cmpRawOperands); ::llvm::SMLoc cmpOperandsLoc; + (void)cmpOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands; + ::llvm::SMLoc sgprOffsetOperandsLoc; + (void)sgprOffsetOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + srcOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + cmpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(cmpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) { + + { + sgprOffsetOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + sgprOffsetOperands.push_back(operand); + } + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseTypeList(indicesTypes)) + return ::mlir::failure(); +::llvm::copy(::llvm::ArrayRef({1, 1, 1, static_cast(indicesOperands.size()), static_cast(sgprOffsetOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + result.addTypes(valueTypes); + if (parser.resolveOperands(srcOperands, valueTypes[0], srcOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(cmpOperands, valueTypes[0], cmpOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawBufferAtomicCmpswapOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getBoundsCheckAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("boundsCheck"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSrc(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCmp(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getSgprOffset()) { + _odsPrinter << ' ' << "sgprOffset"; + _odsPrinter << ' '; + if (::mlir::Value value = getSgprOffset()) + _odsPrinter << value; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIndices().getTypes(); +} + +void RawBufferAtomicCmpswapOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(2)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(2)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicCmpswapOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicFaddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicFaddOpGenericAdaptorBase::RawBufferAtomicFaddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.raw_buffer_atomic_fadd", odsAttrs.getContext()); +} + +RawBufferAtomicFaddOpGenericAdaptorBase::RawBufferAtomicFaddOpGenericAdaptorBase(RawBufferAtomicFaddOp op) : RawBufferAtomicFaddOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicFaddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr RawBufferAtomicFaddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr RawBufferAtomicFaddOpGenericAdaptorBase::getBoundsCheckAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); + return attr; +} + +bool RawBufferAtomicFaddOpGenericAdaptorBase::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicFaddOpGenericAdaptorBase::getIndexOffsetAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); + return attr; +} + +::std::optional RawBufferAtomicFaddOpGenericAdaptorBase::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +RawBufferAtomicFaddOpAdaptor::RawBufferAtomicFaddOpAdaptor(RawBufferAtomicFaddOp op) : RawBufferAtomicFaddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicFaddOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck)))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_fadd' op ""attribute 'boundsCheck' failed to satisfy constraint: bool attribute"); + + if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_fadd' op ""attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair RawBufferAtomicFaddOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range RawBufferAtomicFaddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> RawBufferAtomicFaddOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> RawBufferAtomicFaddOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range RawBufferAtomicFaddOp::getIndices() { + return getODSOperands(2); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicFaddOp::getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::OpOperand &RawBufferAtomicFaddOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFaddOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange RawBufferAtomicFaddOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange RawBufferAtomicFaddOp::getSgprOffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair RawBufferAtomicFaddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicFaddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawBufferAtomicFaddOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.boundsCheck; + auto attr = dict.get("boundsCheck"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for boundsCheck in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.indexOffset; + auto attr = dict.get("indexOffset"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for indexOffset in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute RawBufferAtomicFaddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.boundsCheck; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("boundsCheck", + propStorage)); + } + + { + const auto &propStorage = prop.indexOffset; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("indexOffset", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawBufferAtomicFaddOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()), + llvm::hash_value(prop.indexOffset.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional RawBufferAtomicFaddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "boundsCheck") + return prop.boundsCheck; + + if (name == "indexOffset") + return prop.indexOffset; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void RawBufferAtomicFaddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "boundsCheck") { + prop.boundsCheck = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "indexOffset") { + prop.indexOffset = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void RawBufferAtomicFaddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck); + + if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult RawBufferAtomicFaddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "boundsCheck", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "indexOffset", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicFaddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RawBufferAtomicFaddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.boundsCheck); + + writer.writeOptionalAttribute(prop.indexOffset); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::BoolAttr RawBufferAtomicFaddOp::getBoundsCheckAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); +} + +bool RawBufferAtomicFaddOp::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicFaddOp::getIndexOffsetAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); +} + +::std::optional RawBufferAtomicFaddOp::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void RawBufferAtomicFaddOp::setBoundsCheckAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getBoundsCheckAttrName(), attr); +} + +void RawBufferAtomicFaddOp::setBoundsCheck(bool attrValue) { + (*this)->setAttr(getBoundsCheckAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void RawBufferAtomicFaddOp::setIndexOffsetAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexOffsetAttrName(), attr); +} + +void RawBufferAtomicFaddOp::setIndexOffset(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexOffsetAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexOffsetAttrName()); +} + +::mlir::Attribute RawBufferAtomicFaddOp::removeIndexOffsetAttr() { + auto &attr = getProperties().indexOffset; + attr = {}; + return attr; +} + +void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicFaddOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.boundsCheck) + properties.boundsCheck = odsBuilder.getBoolAttr(true); +} + +::mlir::LogicalResult RawBufferAtomicFaddOp::verifyInvariantsImpl() { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_boundsCheck, "boundsCheck"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_indexOffset, "indexOffset"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) + return emitOpError("failed to verify that all of {value, memref} have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicFaddOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult RawBufferAtomicFaddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands; + ::llvm::SMLoc sgprOffsetOperandsLoc; + (void)sgprOffsetOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) { + + { + sgprOffsetOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + sgprOffsetOperands.push_back(operand); + } + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::FloatType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseTypeList(indicesTypes)) + return ::mlir::failure(); +::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indicesOperands.size()), static_cast(sgprOffsetOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawBufferAtomicFaddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getBoundsCheckAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("boundsCheck"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getSgprOffset()) { + _odsPrinter << ' ' << "sgprOffset"; + _odsPrinter << ' '; + if (::mlir::Value value = getSgprOffset()) + _odsPrinter << value; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::FloatType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIndices().getTypes(); +} + +void RawBufferAtomicFaddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicFaddOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicFmaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicFmaxOpGenericAdaptorBase::RawBufferAtomicFmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.raw_buffer_atomic_fmax", odsAttrs.getContext()); +} + +RawBufferAtomicFmaxOpGenericAdaptorBase::RawBufferAtomicFmaxOpGenericAdaptorBase(RawBufferAtomicFmaxOp op) : RawBufferAtomicFmaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicFmaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr RawBufferAtomicFmaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr RawBufferAtomicFmaxOpGenericAdaptorBase::getBoundsCheckAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); + return attr; +} + +bool RawBufferAtomicFmaxOpGenericAdaptorBase::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicFmaxOpGenericAdaptorBase::getIndexOffsetAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); + return attr; +} + +::std::optional RawBufferAtomicFmaxOpGenericAdaptorBase::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +RawBufferAtomicFmaxOpAdaptor::RawBufferAtomicFmaxOpAdaptor(RawBufferAtomicFmaxOp op) : RawBufferAtomicFmaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicFmaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck)))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_fmax' op ""attribute 'boundsCheck' failed to satisfy constraint: bool attribute"); + + if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_fmax' op ""attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair RawBufferAtomicFmaxOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range RawBufferAtomicFmaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferAtomicFmaxOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> RawBufferAtomicFmaxOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range RawBufferAtomicFmaxOp::getIndices() { + return getODSOperands(2); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicFmaxOp::getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::OpOperand &RawBufferAtomicFmaxOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFmaxOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange RawBufferAtomicFmaxOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange RawBufferAtomicFmaxOp::getSgprOffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair RawBufferAtomicFmaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicFmaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawBufferAtomicFmaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.boundsCheck; + auto attr = dict.get("boundsCheck"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for boundsCheck in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.indexOffset; + auto attr = dict.get("indexOffset"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for indexOffset in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute RawBufferAtomicFmaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.boundsCheck; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("boundsCheck", + propStorage)); + } + + { + const auto &propStorage = prop.indexOffset; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("indexOffset", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawBufferAtomicFmaxOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()), + llvm::hash_value(prop.indexOffset.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional RawBufferAtomicFmaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "boundsCheck") + return prop.boundsCheck; + + if (name == "indexOffset") + return prop.indexOffset; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void RawBufferAtomicFmaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "boundsCheck") { + prop.boundsCheck = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "indexOffset") { + prop.indexOffset = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void RawBufferAtomicFmaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck); + + if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult RawBufferAtomicFmaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "boundsCheck", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "indexOffset", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicFmaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RawBufferAtomicFmaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.boundsCheck); + + writer.writeOptionalAttribute(prop.indexOffset); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::BoolAttr RawBufferAtomicFmaxOp::getBoundsCheckAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); +} + +bool RawBufferAtomicFmaxOp::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicFmaxOp::getIndexOffsetAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); +} + +::std::optional RawBufferAtomicFmaxOp::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void RawBufferAtomicFmaxOp::setBoundsCheckAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getBoundsCheckAttrName(), attr); +} + +void RawBufferAtomicFmaxOp::setBoundsCheck(bool attrValue) { + (*this)->setAttr(getBoundsCheckAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void RawBufferAtomicFmaxOp::setIndexOffsetAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexOffsetAttrName(), attr); +} + +void RawBufferAtomicFmaxOp::setIndexOffset(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexOffsetAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexOffsetAttrName()); +} + +::mlir::Attribute RawBufferAtomicFmaxOp::removeIndexOffsetAttr() { + auto &attr = getProperties().indexOffset; + attr = {}; + return attr; +} + +void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicFmaxOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.boundsCheck) + properties.boundsCheck = odsBuilder.getBoolAttr(true); +} + +::mlir::LogicalResult RawBufferAtomicFmaxOp::verifyInvariantsImpl() { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_boundsCheck, "boundsCheck"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_indexOffset, "indexOffset"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) + return emitOpError("failed to verify that all of {value, memref} have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicFmaxOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult RawBufferAtomicFmaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands; + ::llvm::SMLoc sgprOffsetOperandsLoc; + (void)sgprOffsetOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) { + + { + sgprOffsetOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + sgprOffsetOperands.push_back(operand); + } + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseTypeList(indicesTypes)) + return ::mlir::failure(); +::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indicesOperands.size()), static_cast(sgprOffsetOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawBufferAtomicFmaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getBoundsCheckAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("boundsCheck"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getSgprOffset()) { + _odsPrinter << ' ' << "sgprOffset"; + _odsPrinter << ' '; + if (::mlir::Value value = getSgprOffset()) + _odsPrinter << value; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIndices().getTypes(); +} + +void RawBufferAtomicFmaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicFmaxOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicSmaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicSmaxOpGenericAdaptorBase::RawBufferAtomicSmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.raw_buffer_atomic_smax", odsAttrs.getContext()); +} + +RawBufferAtomicSmaxOpGenericAdaptorBase::RawBufferAtomicSmaxOpGenericAdaptorBase(RawBufferAtomicSmaxOp op) : RawBufferAtomicSmaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicSmaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr RawBufferAtomicSmaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr RawBufferAtomicSmaxOpGenericAdaptorBase::getBoundsCheckAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); + return attr; +} + +bool RawBufferAtomicSmaxOpGenericAdaptorBase::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicSmaxOpGenericAdaptorBase::getIndexOffsetAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); + return attr; +} + +::std::optional RawBufferAtomicSmaxOpGenericAdaptorBase::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +RawBufferAtomicSmaxOpAdaptor::RawBufferAtomicSmaxOpAdaptor(RawBufferAtomicSmaxOp op) : RawBufferAtomicSmaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicSmaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck)))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_smax' op ""attribute 'boundsCheck' failed to satisfy constraint: bool attribute"); + + if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_smax' op ""attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair RawBufferAtomicSmaxOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range RawBufferAtomicSmaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicSmaxOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> RawBufferAtomicSmaxOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range RawBufferAtomicSmaxOp::getIndices() { + return getODSOperands(2); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicSmaxOp::getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::OpOperand &RawBufferAtomicSmaxOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicSmaxOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange RawBufferAtomicSmaxOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange RawBufferAtomicSmaxOp::getSgprOffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair RawBufferAtomicSmaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicSmaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawBufferAtomicSmaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.boundsCheck; + auto attr = dict.get("boundsCheck"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for boundsCheck in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.indexOffset; + auto attr = dict.get("indexOffset"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for indexOffset in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute RawBufferAtomicSmaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.boundsCheck; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("boundsCheck", + propStorage)); + } + + { + const auto &propStorage = prop.indexOffset; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("indexOffset", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawBufferAtomicSmaxOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()), + llvm::hash_value(prop.indexOffset.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional RawBufferAtomicSmaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "boundsCheck") + return prop.boundsCheck; + + if (name == "indexOffset") + return prop.indexOffset; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void RawBufferAtomicSmaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "boundsCheck") { + prop.boundsCheck = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "indexOffset") { + prop.indexOffset = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void RawBufferAtomicSmaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck); + + if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult RawBufferAtomicSmaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "boundsCheck", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "indexOffset", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicSmaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RawBufferAtomicSmaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.boundsCheck); + + writer.writeOptionalAttribute(prop.indexOffset); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::BoolAttr RawBufferAtomicSmaxOp::getBoundsCheckAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); +} + +bool RawBufferAtomicSmaxOp::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicSmaxOp::getIndexOffsetAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); +} + +::std::optional RawBufferAtomicSmaxOp::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void RawBufferAtomicSmaxOp::setBoundsCheckAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getBoundsCheckAttrName(), attr); +} + +void RawBufferAtomicSmaxOp::setBoundsCheck(bool attrValue) { + (*this)->setAttr(getBoundsCheckAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void RawBufferAtomicSmaxOp::setIndexOffsetAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexOffsetAttrName(), attr); +} + +void RawBufferAtomicSmaxOp::setIndexOffset(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexOffsetAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexOffsetAttrName()); +} + +::mlir::Attribute RawBufferAtomicSmaxOp::removeIndexOffsetAttr() { + auto &attr = getProperties().indexOffset; + attr = {}; + return attr; +} + +void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicSmaxOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.boundsCheck) + properties.boundsCheck = odsBuilder.getBoolAttr(true); +} + +::mlir::LogicalResult RawBufferAtomicSmaxOp::verifyInvariantsImpl() { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_boundsCheck, "boundsCheck"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_indexOffset, "indexOffset"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicSmaxOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult RawBufferAtomicSmaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands; + ::llvm::SMLoc sgprOffsetOperandsLoc; + (void)sgprOffsetOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) { + + { + sgprOffsetOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + sgprOffsetOperands.push_back(operand); + } + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseTypeList(indicesTypes)) + return ::mlir::failure(); +::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indicesOperands.size()), static_cast(sgprOffsetOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawBufferAtomicSmaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getBoundsCheckAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("boundsCheck"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getSgprOffset()) { + _odsPrinter << ' ' << "sgprOffset"; + _odsPrinter << ' '; + if (::mlir::Value value = getSgprOffset()) + _odsPrinter << value; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIndices().getTypes(); +} + +void RawBufferAtomicSmaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicSmaxOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicUminOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicUminOpGenericAdaptorBase::RawBufferAtomicUminOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.raw_buffer_atomic_umin", odsAttrs.getContext()); +} + +RawBufferAtomicUminOpGenericAdaptorBase::RawBufferAtomicUminOpGenericAdaptorBase(RawBufferAtomicUminOp op) : RawBufferAtomicUminOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicUminOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr RawBufferAtomicUminOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr RawBufferAtomicUminOpGenericAdaptorBase::getBoundsCheckAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); + return attr; +} + +bool RawBufferAtomicUminOpGenericAdaptorBase::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicUminOpGenericAdaptorBase::getIndexOffsetAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); + return attr; +} + +::std::optional RawBufferAtomicUminOpGenericAdaptorBase::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +RawBufferAtomicUminOpAdaptor::RawBufferAtomicUminOpAdaptor(RawBufferAtomicUminOp op) : RawBufferAtomicUminOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicUminOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck)))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_umin' op ""attribute 'boundsCheck' failed to satisfy constraint: bool attribute"); + + if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.raw_buffer_atomic_umin' op ""attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair RawBufferAtomicUminOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range RawBufferAtomicUminOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicUminOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> RawBufferAtomicUminOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range RawBufferAtomicUminOp::getIndices() { + return getODSOperands(2); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicUminOp::getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::OpOperand &RawBufferAtomicUminOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicUminOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange RawBufferAtomicUminOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange RawBufferAtomicUminOp::getSgprOffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair RawBufferAtomicUminOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicUminOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawBufferAtomicUminOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.boundsCheck; + auto attr = dict.get("boundsCheck"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for boundsCheck in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.indexOffset; + auto attr = dict.get("indexOffset"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for indexOffset in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute RawBufferAtomicUminOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.boundsCheck; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("boundsCheck", + propStorage)); + } + + { + const auto &propStorage = prop.indexOffset; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("indexOffset", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawBufferAtomicUminOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()), + llvm::hash_value(prop.indexOffset.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional RawBufferAtomicUminOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "boundsCheck") + return prop.boundsCheck; + + if (name == "indexOffset") + return prop.indexOffset; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void RawBufferAtomicUminOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "boundsCheck") { + prop.boundsCheck = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "indexOffset") { + prop.indexOffset = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void RawBufferAtomicUminOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck); + + if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult RawBufferAtomicUminOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "boundsCheck", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "indexOffset", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicUminOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RawBufferAtomicUminOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.boundsCheck); + + writer.writeOptionalAttribute(prop.indexOffset); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::BoolAttr RawBufferAtomicUminOp::getBoundsCheckAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); +} + +bool RawBufferAtomicUminOp::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferAtomicUminOp::getIndexOffsetAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); +} + +::std::optional RawBufferAtomicUminOp::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void RawBufferAtomicUminOp::setBoundsCheckAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getBoundsCheckAttrName(), attr); +} + +void RawBufferAtomicUminOp::setBoundsCheck(bool attrValue) { + (*this)->setAttr(getBoundsCheckAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void RawBufferAtomicUminOp::setIndexOffsetAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexOffsetAttrName(), attr); +} + +void RawBufferAtomicUminOp::setIndexOffset(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexOffsetAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexOffsetAttrName()); +} + +::mlir::Attribute RawBufferAtomicUminOp::removeIndexOffsetAttr() { + auto &attr = getProperties().indexOffset; + attr = {}; + return attr; +} + +void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicUminOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicUminOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.boundsCheck) + properties.boundsCheck = odsBuilder.getBoolAttr(true); +} + +::mlir::LogicalResult RawBufferAtomicUminOp::verifyInvariantsImpl() { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_boundsCheck, "boundsCheck"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_indexOffset, "indexOffset"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicUminOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult RawBufferAtomicUminOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands; + ::llvm::SMLoc sgprOffsetOperandsLoc; + (void)sgprOffsetOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) { + + { + sgprOffsetOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + sgprOffsetOperands.push_back(operand); + } + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseTypeList(indicesTypes)) + return ::mlir::failure(); +::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indicesOperands.size()), static_cast(sgprOffsetOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawBufferAtomicUminOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getBoundsCheckAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("boundsCheck"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getSgprOffset()) { + _odsPrinter << ' ' << "sgprOffset"; + _odsPrinter << ' '; + if (::mlir::Value value = getSgprOffset()) + _odsPrinter << value; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIndices().getTypes(); +} + +void RawBufferAtomicUminOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicUminOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferLoadOpGenericAdaptorBase::RawBufferLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.raw_buffer_load", odsAttrs.getContext()); +} + +RawBufferLoadOpGenericAdaptorBase::RawBufferLoadOpGenericAdaptorBase(RawBufferLoadOp op) : RawBufferLoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr RawBufferLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr RawBufferLoadOpGenericAdaptorBase::getBoundsCheckAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); + return attr; +} + +bool RawBufferLoadOpGenericAdaptorBase::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferLoadOpGenericAdaptorBase::getIndexOffsetAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); + return attr; +} + +::std::optional RawBufferLoadOpGenericAdaptorBase::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +RawBufferLoadOpAdaptor::RawBufferLoadOpAdaptor(RawBufferLoadOp op) : RawBufferLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferLoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck)))) + return emitError(loc, "'amdgpu.raw_buffer_load' op ""attribute 'boundsCheck' failed to satisfy constraint: bool attribute"); + + if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.raw_buffer_load' op ""attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair RawBufferLoadOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range RawBufferLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> RawBufferLoadOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range RawBufferLoadOp::getIndices() { + return getODSOperands(1); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferLoadOp::getSgprOffset() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::OpOperand &RawBufferLoadOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange RawBufferLoadOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange RawBufferLoadOp::getSgprOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair RawBufferLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferLoadOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RawBufferLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.boundsCheck; + auto attr = dict.get("boundsCheck"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for boundsCheck in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.indexOffset; + auto attr = dict.get("indexOffset"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for indexOffset in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute RawBufferLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.boundsCheck; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("boundsCheck", + propStorage)); + } + + { + const auto &propStorage = prop.indexOffset; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("indexOffset", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawBufferLoadOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()), + llvm::hash_value(prop.indexOffset.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional RawBufferLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "boundsCheck") + return prop.boundsCheck; + + if (name == "indexOffset") + return prop.indexOffset; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void RawBufferLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "boundsCheck") { + prop.boundsCheck = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "indexOffset") { + prop.indexOffset = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void RawBufferLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck); + + if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult RawBufferLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "boundsCheck", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "indexOffset", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RawBufferLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.boundsCheck); + + writer.writeOptionalAttribute(prop.indexOffset); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::BoolAttr RawBufferLoadOp::getBoundsCheckAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); +} + +bool RawBufferLoadOp::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferLoadOp::getIndexOffsetAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); +} + +::std::optional RawBufferLoadOp::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void RawBufferLoadOp::setBoundsCheckAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getBoundsCheckAttrName(), attr); +} + +void RawBufferLoadOp::setBoundsCheck(bool attrValue) { + (*this)->setAttr(getBoundsCheckAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void RawBufferLoadOp::setIndexOffsetAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexOffsetAttrName(), attr); +} + +void RawBufferLoadOp::setIndexOffset(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexOffsetAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexOffsetAttrName()); +} + +::mlir::Attribute RawBufferLoadOp::removeIndexOffsetAttr() { + auto &attr = getProperties().indexOffset; + attr = {}; + return attr; +} + +void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + odsState.addTypes(value); +} + +void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + odsState.addTypes(value); +} + +void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RawBufferLoadOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.boundsCheck) + properties.boundsCheck = odsBuilder.getBoolAttr(true); +} + +::mlir::LogicalResult RawBufferLoadOp::verifyInvariantsImpl() { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_boundsCheck, "boundsCheck"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_indexOffset, "indexOffset"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!(((getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin())))))) + return emitOpError("failed to verify that all of {value, memref} have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferLoadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult RawBufferLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands; + ::llvm::SMLoc sgprOffsetOperandsLoc; + (void)sgprOffsetOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) { + + { + sgprOffsetOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + sgprOffsetOperands.push_back(operand); + } + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (::mlir::succeeded(parser.parseOptionalComma())) { + + if (parser.parseTypeList(indicesTypes)) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(indicesOperands.size()), static_cast(sgprOffsetOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + result.addTypes(valueTypes); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawBufferLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getBoundsCheckAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("boundsCheck"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getSgprOffset()) { + _odsPrinter << ' ' << "sgprOffset"; + _odsPrinter << ' '; + if (::mlir::Value value = getSgprOffset()) + _odsPrinter << value; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + if (!getIndices().empty()) { + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIndices().getTypes(); + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RawBufferLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferLoadOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferStoreOpGenericAdaptorBase::RawBufferStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.raw_buffer_store", odsAttrs.getContext()); +} + +RawBufferStoreOpGenericAdaptorBase::RawBufferStoreOpGenericAdaptorBase(RawBufferStoreOp op) : RawBufferStoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr RawBufferStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr RawBufferStoreOpGenericAdaptorBase::getBoundsCheckAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); + return attr; +} + +bool RawBufferStoreOpGenericAdaptorBase::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferStoreOpGenericAdaptorBase::getIndexOffsetAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); + return attr; +} + +::std::optional RawBufferStoreOpGenericAdaptorBase::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +RawBufferStoreOpAdaptor::RawBufferStoreOpAdaptor(RawBufferStoreOp op) : RawBufferStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferStoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck)))) + return emitError(loc, "'amdgpu.raw_buffer_store' op ""attribute 'boundsCheck' failed to satisfy constraint: bool attribute"); + + if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32))))) + return emitError(loc, "'amdgpu.raw_buffer_store' op ""attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair RawBufferStoreOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range RawBufferStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferStoreOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> RawBufferStoreOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range RawBufferStoreOp::getIndices() { + return getODSOperands(2); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferStoreOp::getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::OpOperand &RawBufferStoreOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferStoreOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange RawBufferStoreOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange RawBufferStoreOp::getSgprOffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair RawBufferStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawBufferStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.boundsCheck; + auto attr = dict.get("boundsCheck"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for boundsCheck in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.indexOffset; + auto attr = dict.get("indexOffset"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for indexOffset in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute RawBufferStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.boundsCheck; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("boundsCheck", + propStorage)); + } + + { + const auto &propStorage = prop.indexOffset; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("indexOffset", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawBufferStoreOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()), + llvm::hash_value(prop.indexOffset.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional RawBufferStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "boundsCheck") + return prop.boundsCheck; + + if (name == "indexOffset") + return prop.indexOffset; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void RawBufferStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "boundsCheck") { + prop.boundsCheck = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "indexOffset") { + prop.indexOffset = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void RawBufferStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck); + + if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult RawBufferStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "boundsCheck", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "indexOffset", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RawBufferStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.boundsCheck); + + writer.writeOptionalAttribute(prop.indexOffset); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::BoolAttr RawBufferStoreOp::getBoundsCheckAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck); +} + +bool RawBufferStoreOp::getBoundsCheck() { + auto attr = getBoundsCheckAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr RawBufferStoreOp::getIndexOffsetAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().indexOffset); +} + +::std::optional RawBufferStoreOp::getIndexOffset() { + auto attr = getIndexOffsetAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void RawBufferStoreOp::setBoundsCheckAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getBoundsCheckAttrName(), attr); +} + +void RawBufferStoreOp::setBoundsCheck(bool attrValue) { + (*this)->setAttr(getBoundsCheckAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void RawBufferStoreOp::setIndexOffsetAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexOffsetAttrName(), attr); +} + +void RawBufferStoreOp::setIndexOffset(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexOffsetAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexOffsetAttrName()); +} + +::mlir::Attribute RawBufferStoreOp::removeIndexOffsetAttr() { + auto &attr = getProperties().indexOffset; + attr = {}; + return attr; +} + +void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (boundsCheck) { + odsState.getOrAddProperties().boundsCheck = boundsCheck; + } + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } +} + +void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (sgprOffset) + odsState.addOperands(sgprOffset); + ::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().boundsCheck = odsBuilder.getBoolAttr(boundsCheck); + if (indexOffset) { + odsState.getOrAddProperties().indexOffset = indexOffset; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RawBufferStoreOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.boundsCheck) + properties.boundsCheck = odsBuilder.getBoolAttr(true); +} + +::mlir::LogicalResult RawBufferStoreOp::verifyInvariantsImpl() { + auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck; + auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_boundsCheck, "boundsCheck"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_indexOffset, "indexOffset"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) + return emitOpError("failed to verify that all of {value, memref} have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferStoreOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult RawBufferStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands; + ::llvm::SMLoc sgprOffsetOperandsLoc; + (void)sgprOffsetOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> indicesTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) { + + { + sgprOffsetOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + sgprOffsetOperands.push_back(operand); + } + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (::mlir::succeeded(parser.parseOptionalComma())) { + + if (parser.parseTypeList(indicesTypes)) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, 1, static_cast(indicesOperands.size()), static_cast(sgprOffsetOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawBufferStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getBoundsCheckAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("boundsCheck"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getSgprOffset()) { + _odsPrinter << ' ' << "sgprOffset"; + _odsPrinter << ' '; + if (::mlir::Value value = getSgprOffset()) + _odsPrinter << value; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + if (!getIndices().empty()) { + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIndices().getTypes(); + } +} + +void RawBufferStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferStoreOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::WMMAOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WMMAOpGenericAdaptorBase::WMMAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amdgpu.wmma", odsAttrs.getContext()); +} + +WMMAOpGenericAdaptorBase::WMMAOpGenericAdaptorBase(WMMAOp op) : WMMAOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WMMAOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr WMMAOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr WMMAOpGenericAdaptorBase::getSubwordOffsetAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().subwordOffset); + return attr; +} + +uint32_t WMMAOpGenericAdaptorBase::getSubwordOffset() { + auto attr = getSubwordOffsetAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr WMMAOpGenericAdaptorBase::getUnsignedAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedA); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool WMMAOpGenericAdaptorBase::getUnsignedA() { + auto attr = getUnsignedAAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr WMMAOpGenericAdaptorBase::getUnsignedBAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedB); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool WMMAOpGenericAdaptorBase::getUnsignedB() { + auto attr = getUnsignedBAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr WMMAOpGenericAdaptorBase::getClampAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().clamp); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool WMMAOpGenericAdaptorBase::getClamp() { + auto attr = getClampAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +WMMAOpAdaptor::WMMAOpAdaptor(WMMAOp op) : WMMAOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WMMAOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_clamp = getProperties().clamp; (void)tblgen_clamp; + auto tblgen_subwordOffset = getProperties().subwordOffset; (void)tblgen_subwordOffset; + auto tblgen_unsignedA = getProperties().unsignedA; (void)tblgen_unsignedA; + auto tblgen_unsignedB = getProperties().unsignedB; (void)tblgen_unsignedB; + + if (tblgen_subwordOffset && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_subwordOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_subwordOffset).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_subwordOffset).getInt() >= 0)) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_subwordOffset).getInt() <= 1)))) + return emitError(loc, "'amdgpu.wmma' op ""attribute 'subwordOffset' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 1"); + + if (tblgen_unsignedA && !((::llvm::isa<::mlir::UnitAttr>(tblgen_unsignedA)))) + return emitError(loc, "'amdgpu.wmma' op ""attribute 'unsignedA' failed to satisfy constraint: unit attribute"); + + if (tblgen_unsignedB && !((::llvm::isa<::mlir::UnitAttr>(tblgen_unsignedB)))) + return emitError(loc, "'amdgpu.wmma' op ""attribute 'unsignedB' failed to satisfy constraint: unit attribute"); + + if (tblgen_clamp && !((::llvm::isa<::mlir::UnitAttr>(tblgen_clamp)))) + return emitError(loc, "'amdgpu.wmma' op ""attribute 'clamp' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair WMMAOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range WMMAOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value WMMAOp::getSourceA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value WMMAOp::getSourceB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value WMMAOp::getDestC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &WMMAOp::getSourceAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &WMMAOp::getSourceBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &WMMAOp::getDestCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair WMMAOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WMMAOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value WMMAOp::getDestD() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult WMMAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.clamp; + auto attr = dict.get("clamp"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for clamp in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `clamp` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.subwordOffset; + auto attr = dict.get("subwordOffset"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for subwordOffset in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `subwordOffset` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.unsignedA; + auto attr = dict.get("unsignedA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for unsignedA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `unsignedA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.unsignedB; + auto attr = dict.get("unsignedB"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for unsignedB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `unsignedB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute WMMAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.clamp; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("clamp", + propStorage)); + } + + { + const auto &propStorage = prop.subwordOffset; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("subwordOffset", + propStorage)); + } + + { + const auto &propStorage = prop.unsignedA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("unsignedA", + propStorage)); + } + + { + const auto &propStorage = prop.unsignedB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("unsignedB", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code WMMAOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.clamp.getAsOpaquePointer()), + llvm::hash_value(prop.subwordOffset.getAsOpaquePointer()), + llvm::hash_value(prop.unsignedA.getAsOpaquePointer()), + llvm::hash_value(prop.unsignedB.getAsOpaquePointer())); +} + +std::optional WMMAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "clamp") + return prop.clamp; + + if (name == "subwordOffset") + return prop.subwordOffset; + + if (name == "unsignedA") + return prop.unsignedA; + + if (name == "unsignedB") + return prop.unsignedB; + return std::nullopt; +} + +void WMMAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "clamp") { + prop.clamp = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "subwordOffset") { + prop.subwordOffset = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "unsignedA") { + prop.unsignedA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "unsignedB") { + prop.unsignedB = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void WMMAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.clamp) attrs.append("clamp", prop.clamp); + + if (prop.subwordOffset) attrs.append("subwordOffset", prop.subwordOffset); + + if (prop.unsignedA) attrs.append("unsignedA", prop.unsignedA); + + if (prop.unsignedB) attrs.append("unsignedB", prop.unsignedB); +} + +::mlir::LogicalResult WMMAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getClampAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "clamp", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSubwordOffsetAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(attr, "subwordOffset", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUnsignedAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "unsignedA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUnsignedBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "unsignedB", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WMMAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.clamp))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.subwordOffset))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.unsignedA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.unsignedB))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WMMAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.clamp); + + writer.writeOptionalAttribute(prop.subwordOffset); + + writer.writeOptionalAttribute(prop.unsignedA); + + writer.writeOptionalAttribute(prop.unsignedB); +} + +::mlir::IntegerAttr WMMAOp::getSubwordOffsetAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().subwordOffset); +} + +uint32_t WMMAOp::getSubwordOffset() { + auto attr = getSubwordOffsetAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr WMMAOp::getUnsignedAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedA); +} + +bool WMMAOp::getUnsignedA() { + auto attr = getUnsignedAAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr WMMAOp::getUnsignedBAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedB); +} + +bool WMMAOp::getUnsignedB() { + auto attr = getUnsignedBAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr WMMAOp::getClampAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().clamp); +} + +bool WMMAOp::getClamp() { + auto attr = getClampAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void WMMAOp::setSubwordOffsetAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getSubwordOffsetAttrName(), attr); +} + +void WMMAOp::setSubwordOffset(uint32_t attrValue) { + (*this)->setAttr(getSubwordOffsetAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMAOp::setUnsignedAAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getUnsignedAAttrName(), attr); +} + +void WMMAOp::setUnsignedA(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getUnsignedAAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getUnsignedAAttrName()); +} + +void WMMAOp::setUnsignedBAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getUnsignedBAttrName(), attr); +} + +void WMMAOp::setUnsignedB(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getUnsignedBAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getUnsignedBAttrName()); +} + +void WMMAOp::setClampAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getClampAttrName(), attr); +} + +void WMMAOp::setClamp(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getClampAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getClampAttrName()); +} + +::mlir::Attribute WMMAOp::removeUnsignedAAttr() { + auto &attr = getProperties().unsignedA; + attr = {}; + return attr; +} + +::mlir::Attribute WMMAOp::removeUnsignedBAttr() { + auto &attr = getProperties().unsignedB; + attr = {}; + return attr; +} + +::mlir::Attribute WMMAOp::removeClampAttr() { + auto &attr = getProperties().clamp; + attr = {}; + return attr; +} + +void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) { + odsState.addOperands(sourceA); + odsState.addOperands(sourceB); + odsState.addOperands(destC); + if (subwordOffset) { + odsState.getOrAddProperties().subwordOffset = subwordOffset; + } + if (unsignedA) { + odsState.getOrAddProperties().unsignedA = unsignedA; + } + if (unsignedB) { + odsState.getOrAddProperties().unsignedB = unsignedB; + } + if (clamp) { + odsState.getOrAddProperties().clamp = clamp; + } + odsState.addTypes(destD); +} + +void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) { + odsState.addOperands(sourceA); + odsState.addOperands(sourceB); + odsState.addOperands(destC); + if (subwordOffset) { + odsState.getOrAddProperties().subwordOffset = subwordOffset; + } + if (unsignedA) { + odsState.getOrAddProperties().unsignedA = unsignedA; + } + if (unsignedB) { + odsState.getOrAddProperties().unsignedB = unsignedB; + } + if (clamp) { + odsState.getOrAddProperties().clamp = clamp; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) { + odsState.addOperands(sourceA); + odsState.addOperands(sourceB); + odsState.addOperands(destC); + odsState.getOrAddProperties().subwordOffset = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), subwordOffset); + if (unsignedA) { + odsState.getOrAddProperties().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr); + } + if (unsignedB) { + odsState.getOrAddProperties().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr); + } + if (clamp) { + odsState.getOrAddProperties().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(destD); +} + +void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) { + odsState.addOperands(sourceA); + odsState.addOperands(sourceB); + odsState.addOperands(destC); + odsState.getOrAddProperties().subwordOffset = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), subwordOffset); + if (unsignedA) { + odsState.getOrAddProperties().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr); + } + if (unsignedB) { + odsState.getOrAddProperties().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr); + } + if (clamp) { + odsState.getOrAddProperties().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WMMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void WMMAOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.subwordOffset) + properties.subwordOffset = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0); +} + +::mlir::LogicalResult WMMAOp::verifyInvariantsImpl() { + auto tblgen_clamp = getProperties().clamp; (void)tblgen_clamp; + auto tblgen_subwordOffset = getProperties().subwordOffset; (void)tblgen_subwordOffset; + auto tblgen_unsignedA = getProperties().unsignedA; (void)tblgen_unsignedA; + auto tblgen_unsignedB = getProperties().unsignedB; (void)tblgen_unsignedB; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(*this, tblgen_subwordOffset, "subwordOffset"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_unsignedA, "unsignedA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_unsignedB, "unsignedB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_clamp, "clamp"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU12(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType())))) + return emitOpError("failed to verify that all of {destC, destD} have same type"); + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {sourceA, sourceB} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult WMMAOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WMMAOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(sourceARawOperands); ::llvm::SMLoc sourceAOperandsLoc; + (void)sourceAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand sourceBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceBOperands(sourceBRawOperands); ::llvm::SMLoc sourceBOperandsLoc; + (void)sourceBOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand destCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destCOperands(destCRawOperands); ::llvm::SMLoc destCOperandsLoc; + (void)destCOperandsLoc; + ::mlir::Type sourceARawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceATypes(sourceARawTypes); + ::mlir::Type sourceBRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceBTypes(sourceBRawTypes); + ::mlir::Type destCRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> destCTypes(destCRawTypes); + + sourceAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceARawOperands[0])) + return ::mlir::failure(); + if (parser.parseStar()) + return ::mlir::failure(); + + sourceBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceBRawOperands[0])) + return ::mlir::failure(); + if (parser.parsePlus()) + return ::mlir::failure(); + + destCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(destCRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceARawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceBRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + destCRawTypes[0] = type; + } + result.addTypes(destCTypes[0]); + if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sourceBOperands, sourceBTypes, sourceBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(destCOperands, destCTypes, destCOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WMMAOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSourceA(); + _odsPrinter << ' ' << "*"; + _odsPrinter << ' '; + _odsPrinter << getSourceB(); + _odsPrinter << ' ' << "+"; + _odsPrinter << ' '; + _odsPrinter << getDestC(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getSubwordOffsetAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0))) + elidedAttrs.push_back("subwordOffset"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getUnsignedAAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("unsignedA"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getUnsignedBAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("unsignedB"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getClampAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("clamp"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSourceA().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getSourceB().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getDestC().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void WMMAOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::WMMAOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..788542f2df44ecdb5e07145aedd53a4b09bd2b70 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.h.inc @@ -0,0 +1,3009 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMDGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace amdgpu { +class ExtPackedFp8Op; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class LDSBarrierOp; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class MFMAOp; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class PackedStochRoundFp8Op; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class PackedTrunc2xFp8Op; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class RawBufferAtomicCmpswapOp; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class RawBufferAtomicFaddOp; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class RawBufferAtomicFmaxOp; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class RawBufferAtomicSmaxOp; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class RawBufferAtomicUminOp; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class RawBufferLoadOp; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class RawBufferStoreOp; +} // namespace amdgpu +} // namespace mlir +namespace mlir { +namespace amdgpu { +class WMMAOp; +} // namespace amdgpu +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::ExtPackedFp8Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtPackedFp8OpGenericAdaptorBase { +public: + struct Properties { + using indexTy = ::mlir::IntegerAttr; + indexTy index; + + auto getIndex() { + auto &propStorage = this->index; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIndex(const ::mlir::IntegerAttr &propValue) { + this->index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.index == this->index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExtPackedFp8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtPackedFp8OpGenericAdaptorBase(ExtPackedFp8Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); +}; +} // namespace detail +template +class ExtPackedFp8OpGenericAdaptor : public detail::ExtPackedFp8OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtPackedFp8OpGenericAdaptorBase; +public: + ExtPackedFp8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtPackedFp8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtPackedFp8OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExtPackedFp8OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtPackedFp8OpAdaptor : public ExtPackedFp8OpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtPackedFp8OpGenericAdaptor::ExtPackedFp8OpGenericAdaptor; + ExtPackedFp8OpAdaptor(ExtPackedFp8Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtPackedFp8Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtPackedFp8OpAdaptor; + template + using GenericAdaptor = ExtPackedFp8OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.ext_packed_fp8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSource(); + ::mlir::OpOperand &getSourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, uint32_t index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, uint32_t index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::ExtPackedFp8Op) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::LDSBarrierOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LDSBarrierOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LDSBarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LDSBarrierOpGenericAdaptorBase(LDSBarrierOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LDSBarrierOpGenericAdaptor : public detail::LDSBarrierOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LDSBarrierOpGenericAdaptorBase; +public: + LDSBarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LDSBarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LDSBarrierOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LDSBarrierOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LDSBarrierOpAdaptor : public LDSBarrierOpGenericAdaptor<::mlir::ValueRange> { +public: + using LDSBarrierOpGenericAdaptor::LDSBarrierOpGenericAdaptor; + LDSBarrierOpAdaptor(LDSBarrierOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LDSBarrierOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LDSBarrierOpAdaptor; + template + using GenericAdaptor = LDSBarrierOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.lds_barrier"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::LDSBarrierOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::MFMAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MFMAOpGenericAdaptorBase { +public: + struct Properties { + using abidTy = ::mlir::IntegerAttr; + abidTy abid; + + auto getAbid() { + auto &propStorage = this->abid; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAbid(const ::mlir::IntegerAttr &propValue) { + this->abid = propValue; + } + using blgpTy = ::mlir::amdgpu::MFMAPermBAttr; + blgpTy blgp; + + auto getBlgp() { + auto &propStorage = this->blgp; + return ::llvm::dyn_cast_or_null<::mlir::amdgpu::MFMAPermBAttr>(propStorage); + } + void setBlgp(const ::mlir::amdgpu::MFMAPermBAttr &propValue) { + this->blgp = propValue; + } + using blocksTy = ::mlir::IntegerAttr; + blocksTy blocks; + + auto getBlocks() { + auto &propStorage = this->blocks; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setBlocks(const ::mlir::IntegerAttr &propValue) { + this->blocks = propValue; + } + using cbszTy = ::mlir::IntegerAttr; + cbszTy cbsz; + + auto getCbsz() { + auto &propStorage = this->cbsz; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setCbsz(const ::mlir::IntegerAttr &propValue) { + this->cbsz = propValue; + } + using kTy = ::mlir::IntegerAttr; + kTy k; + + auto getK() { + auto &propStorage = this->k; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setK(const ::mlir::IntegerAttr &propValue) { + this->k = propValue; + } + using mTy = ::mlir::IntegerAttr; + mTy m; + + auto getM() { + auto &propStorage = this->m; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setM(const ::mlir::IntegerAttr &propValue) { + this->m = propValue; + } + using nTy = ::mlir::IntegerAttr; + nTy n; + + auto getN() { + auto &propStorage = this->n; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setN(const ::mlir::IntegerAttr &propValue) { + this->n = propValue; + } + using negateATy = ::mlir::UnitAttr; + negateATy negateA; + + auto getNegateA() { + auto &propStorage = this->negateA; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNegateA(const ::mlir::UnitAttr &propValue) { + this->negateA = propValue; + } + using negateBTy = ::mlir::UnitAttr; + negateBTy negateB; + + auto getNegateB() { + auto &propStorage = this->negateB; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNegateB(const ::mlir::UnitAttr &propValue) { + this->negateB = propValue; + } + using negateCTy = ::mlir::UnitAttr; + negateCTy negateC; + + auto getNegateC() { + auto &propStorage = this->negateC; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNegateC(const ::mlir::UnitAttr &propValue) { + this->negateC = propValue; + } + using reducePrecisionTy = ::mlir::UnitAttr; + reducePrecisionTy reducePrecision; + + auto getReducePrecision() { + auto &propStorage = this->reducePrecision; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setReducePrecision(const ::mlir::UnitAttr &propValue) { + this->reducePrecision = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.abid == this->abid && + rhs.blgp == this->blgp && + rhs.blocks == this->blocks && + rhs.cbsz == this->cbsz && + rhs.k == this->k && + rhs.m == this->m && + rhs.n == this->n && + rhs.negateA == this->negateA && + rhs.negateB == this->negateB && + rhs.negateC == this->negateC && + rhs.reducePrecision == this->reducePrecision && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MFMAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MFMAOpGenericAdaptorBase(MFMAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMAttr(); + uint32_t getM(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::IntegerAttr getKAttr(); + uint32_t getK(); + ::mlir::IntegerAttr getBlocksAttr(); + uint32_t getBlocks(); + ::mlir::IntegerAttr getCbszAttr(); + uint32_t getCbsz(); + ::mlir::IntegerAttr getAbidAttr(); + uint32_t getAbid(); + ::mlir::amdgpu::MFMAPermBAttr getBlgpAttr(); + ::mlir::amdgpu::MFMAPermB getBlgp(); + ::mlir::UnitAttr getReducePrecisionAttr(); + bool getReducePrecision(); + ::mlir::UnitAttr getNegateAAttr(); + bool getNegateA(); + ::mlir::UnitAttr getNegateBAttr(); + bool getNegateB(); + ::mlir::UnitAttr getNegateCAttr(); + bool getNegateC(); +}; +} // namespace detail +template +class MFMAOpGenericAdaptor : public detail::MFMAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MFMAOpGenericAdaptorBase; +public: + MFMAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MFMAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MFMAOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MFMAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSourceA() { + return (*getODSOperands(0).begin()); + } + + ValueT getSourceB() { + return (*getODSOperands(1).begin()); + } + + ValueT getDestC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MFMAOpAdaptor : public MFMAOpGenericAdaptor<::mlir::ValueRange> { +public: + using MFMAOpGenericAdaptor::MFMAOpGenericAdaptor; + MFMAOpAdaptor(MFMAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MFMAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MFMAOpAdaptor; + template + using GenericAdaptor = MFMAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("abid"), ::llvm::StringRef("blgp"), ::llvm::StringRef("blocks"), ::llvm::StringRef("cbsz"), ::llvm::StringRef("k"), ::llvm::StringRef("m"), ::llvm::StringRef("n"), ::llvm::StringRef("negateA"), ::llvm::StringRef("negateB"), ::llvm::StringRef("negateC"), ::llvm::StringRef("reducePrecision")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAbidAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAbidAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBlgpAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBlgpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBlocksAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBlocksAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getCbszAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getCbszAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getMAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getMAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getNegateAAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getNegateAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getNegateBAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getNegateBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getNegateCAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getNegateCAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getReducePrecisionAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getReducePrecisionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.mfma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSourceA(); + ::mlir::Value getSourceB(); + ::mlir::Value getDestC(); + ::mlir::OpOperand &getSourceAMutable(); + ::mlir::OpOperand &getSourceBMutable(); + ::mlir::OpOperand &getDestCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getDestD(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getMAttr(); + uint32_t getM(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::IntegerAttr getKAttr(); + uint32_t getK(); + ::mlir::IntegerAttr getBlocksAttr(); + uint32_t getBlocks(); + ::mlir::IntegerAttr getCbszAttr(); + uint32_t getCbsz(); + ::mlir::IntegerAttr getAbidAttr(); + uint32_t getAbid(); + ::mlir::amdgpu::MFMAPermBAttr getBlgpAttr(); + ::mlir::amdgpu::MFMAPermB getBlgp(); + ::mlir::UnitAttr getReducePrecisionAttr(); + bool getReducePrecision(); + ::mlir::UnitAttr getNegateAAttr(); + bool getNegateA(); + ::mlir::UnitAttr getNegateBAttr(); + bool getNegateB(); + ::mlir::UnitAttr getNegateCAttr(); + bool getNegateC(); + void setMAttr(::mlir::IntegerAttr attr); + void setM(uint32_t attrValue); + void setNAttr(::mlir::IntegerAttr attr); + void setN(uint32_t attrValue); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint32_t attrValue); + void setBlocksAttr(::mlir::IntegerAttr attr); + void setBlocks(uint32_t attrValue); + void setCbszAttr(::mlir::IntegerAttr attr); + void setCbsz(uint32_t attrValue); + void setAbidAttr(::mlir::IntegerAttr attr); + void setAbid(uint32_t attrValue); + void setBlgpAttr(::mlir::amdgpu::MFMAPermBAttr attr); + void setBlgp(::mlir::amdgpu::MFMAPermB attrValue); + void setReducePrecisionAttr(::mlir::UnitAttr attr); + void setReducePrecision(bool attrValue); + void setNegateAAttr(::mlir::UnitAttr attr); + void setNegateA(bool attrValue); + void setNegateBAttr(::mlir::UnitAttr attr); + void setNegateB(bool attrValue); + void setNegateCAttr(::mlir::UnitAttr attr); + void setNegateC(bool attrValue); + ::mlir::Attribute removeReducePrecisionAttr(); + ::mlir::Attribute removeNegateAAttr(); + ::mlir::Attribute removeNegateBAttr(); + ::mlir::Attribute removeNegateCAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::amdgpu::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::amdgpu::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz = 0, uint32_t abid = 0, ::mlir::amdgpu::MFMAPermB blgp = ::mlir::amdgpu::MFMAPermB::none, /*optional*/bool reducePrecision = false, /*optional*/bool negateA = false, /*optional*/bool negateB = false, /*optional*/bool negateC = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz = 0, uint32_t abid = 0, ::mlir::amdgpu::MFMAPermB blgp = ::mlir::amdgpu::MFMAPermB::none, /*optional*/bool reducePrecision = false, /*optional*/bool negateA = false, /*optional*/bool negateB = false, /*optional*/bool negateC = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 11 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MFMAOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::PackedStochRoundFp8Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PackedStochRoundFp8OpGenericAdaptorBase { +public: + struct Properties { + using storeIndexTy = ::mlir::IntegerAttr; + storeIndexTy storeIndex; + + auto getStoreIndex() { + auto &propStorage = this->storeIndex; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setStoreIndex(const ::mlir::IntegerAttr &propValue) { + this->storeIndex = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.storeIndex == this->storeIndex && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PackedStochRoundFp8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PackedStochRoundFp8OpGenericAdaptorBase(PackedStochRoundFp8Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getStoreIndexAttr(); + uint32_t getStoreIndex(); +}; +} // namespace detail +template +class PackedStochRoundFp8OpGenericAdaptor : public detail::PackedStochRoundFp8OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PackedStochRoundFp8OpGenericAdaptorBase; +public: + PackedStochRoundFp8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PackedStochRoundFp8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PackedStochRoundFp8OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PackedStochRoundFp8OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + ValueT getStochiasticParam() { + return (*getODSOperands(1).begin()); + } + + ValueT getExisting() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PackedStochRoundFp8OpAdaptor : public PackedStochRoundFp8OpGenericAdaptor<::mlir::ValueRange> { +public: + using PackedStochRoundFp8OpGenericAdaptor::PackedStochRoundFp8OpGenericAdaptor; + PackedStochRoundFp8OpAdaptor(PackedStochRoundFp8Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PackedStochRoundFp8Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PackedStochRoundFp8OpAdaptor; + template + using GenericAdaptor = PackedStochRoundFp8OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("storeIndex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getStoreIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getStoreIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.packed_stoch_round_fp8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSource(); + ::mlir::TypedValue<::mlir::IntegerType> getStochiasticParam(); + ::mlir::TypedValue<::mlir::VectorType> getExisting(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getStochiasticParamMutable(); + ::mlir::MutableOperandRange getExistingMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getStoreIndexAttr(); + uint32_t getStoreIndex(); + void setStoreIndexAttr(::mlir::IntegerAttr attr); + void setStoreIndex(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::PackedStochRoundFp8Op) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::PackedTrunc2xFp8Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PackedTrunc2xFp8OpGenericAdaptorBase { +public: + struct Properties { + using wordIndexTy = ::mlir::IntegerAttr; + wordIndexTy wordIndex; + + auto getWordIndex() { + auto &propStorage = this->wordIndex; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setWordIndex(const ::mlir::IntegerAttr &propValue) { + this->wordIndex = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.wordIndex == this->wordIndex && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PackedTrunc2xFp8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PackedTrunc2xFp8OpGenericAdaptorBase(PackedTrunc2xFp8Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getWordIndexAttr(); + uint32_t getWordIndex(); +}; +} // namespace detail +template +class PackedTrunc2xFp8OpGenericAdaptor : public detail::PackedTrunc2xFp8OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PackedTrunc2xFp8OpGenericAdaptorBase; +public: + PackedTrunc2xFp8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PackedTrunc2xFp8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PackedTrunc2xFp8OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PackedTrunc2xFp8OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSourceA() { + return (*getODSOperands(0).begin()); + } + + ValueT getSourceB() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getExisting() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PackedTrunc2xFp8OpAdaptor : public PackedTrunc2xFp8OpGenericAdaptor<::mlir::ValueRange> { +public: + using PackedTrunc2xFp8OpGenericAdaptor::PackedTrunc2xFp8OpGenericAdaptor; + PackedTrunc2xFp8OpAdaptor(PackedTrunc2xFp8Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PackedTrunc2xFp8Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PackedTrunc2xFp8OpAdaptor; + template + using GenericAdaptor = PackedTrunc2xFp8OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("wordIndex"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getWordIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getWordIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.packed_trunc_2xfp8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSourceA(); + ::mlir::TypedValue<::mlir::FloatType> getSourceB(); + ::mlir::TypedValue<::mlir::VectorType> getExisting(); + ::mlir::OpOperand &getSourceAMutable(); + ::mlir::MutableOperandRange getSourceBMutable(); + ::mlir::MutableOperandRange getExistingMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getWordIndexAttr(); + uint32_t getWordIndex(); + void setWordIndexAttr(::mlir::IntegerAttr attr); + void setWordIndex(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::PackedTrunc2xFp8Op) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicCmpswapOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicCmpswapOpGenericAdaptorBase { +public: + struct Properties { + using boundsCheckTy = ::mlir::BoolAttr; + boundsCheckTy boundsCheck; + + auto getBoundsCheck() { + auto &propStorage = this->boundsCheck; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setBoundsCheck(const ::mlir::BoolAttr &propValue) { + this->boundsCheck = propValue; + } + using indexOffsetTy = ::mlir::IntegerAttr; + indexOffsetTy indexOffset; + + auto getIndexOffset() { + auto &propStorage = this->indexOffset; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndexOffset(const ::mlir::IntegerAttr &propValue) { + this->indexOffset = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.boundsCheck == this->boundsCheck && + rhs.indexOffset == this->indexOffset && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicCmpswapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicCmpswapOpGenericAdaptorBase(RawBufferAtomicCmpswapOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); +}; +} // namespace detail +template +class RawBufferAtomicCmpswapOpGenericAdaptor : public detail::RawBufferAtomicCmpswapOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicCmpswapOpGenericAdaptorBase; +public: + RawBufferAtomicCmpswapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicCmpswapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicCmpswapOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawBufferAtomicCmpswapOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getCmp() { + return (*getODSOperands(1).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(2).begin()); + } + + RangeT getIndices() { + return getODSOperands(3); + } + + ValueT getSgprOffset() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicCmpswapOpAdaptor : public RawBufferAtomicCmpswapOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicCmpswapOpGenericAdaptor::RawBufferAtomicCmpswapOpGenericAdaptor; + RawBufferAtomicCmpswapOpAdaptor(RawBufferAtomicCmpswapOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicCmpswapOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<3>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicCmpswapOpAdaptor; + template + using GenericAdaptor = RawBufferAtomicCmpswapOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("boundsCheck"), ::llvm::StringRef("indexOffset"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBoundsCheckAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBoundsCheckAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexOffsetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.raw_buffer_atomic_cmpswap"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getCmp(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::TypedValue<::mlir::IntegerType> getSgprOffset(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getCmpMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getSgprOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getValue(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); + void setBoundsCheckAttr(::mlir::BoolAttr attr); + void setBoundsCheck(bool attrValue); + void setIndexOffsetAttr(::mlir::IntegerAttr attr); + void setIndexOffset(::std::optional attrValue); + ::mlir::Attribute removeIndexOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicCmpswapOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicFaddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicFaddOpGenericAdaptorBase { +public: + struct Properties { + using boundsCheckTy = ::mlir::BoolAttr; + boundsCheckTy boundsCheck; + + auto getBoundsCheck() { + auto &propStorage = this->boundsCheck; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setBoundsCheck(const ::mlir::BoolAttr &propValue) { + this->boundsCheck = propValue; + } + using indexOffsetTy = ::mlir::IntegerAttr; + indexOffsetTy indexOffset; + + auto getIndexOffset() { + auto &propStorage = this->indexOffset; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndexOffset(const ::mlir::IntegerAttr &propValue) { + this->indexOffset = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.boundsCheck == this->boundsCheck && + rhs.indexOffset == this->indexOffset && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicFaddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicFaddOpGenericAdaptorBase(RawBufferAtomicFaddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); +}; +} // namespace detail +template +class RawBufferAtomicFaddOpGenericAdaptor : public detail::RawBufferAtomicFaddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicFaddOpGenericAdaptorBase; +public: + RawBufferAtomicFaddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicFaddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicFaddOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawBufferAtomicFaddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + ValueT getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicFaddOpAdaptor : public RawBufferAtomicFaddOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicFaddOpGenericAdaptor::RawBufferAtomicFaddOpGenericAdaptor; + RawBufferAtomicFaddOpAdaptor(RawBufferAtomicFaddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicFaddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicFaddOpAdaptor; + template + using GenericAdaptor = RawBufferAtomicFaddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("boundsCheck"), ::llvm::StringRef("indexOffset"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBoundsCheckAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBoundsCheckAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexOffsetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.raw_buffer_atomic_fadd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getValue(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::TypedValue<::mlir::IntegerType> getSgprOffset(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getSgprOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); + void setBoundsCheckAttr(::mlir::BoolAttr attr); + void setBoundsCheck(bool attrValue); + void setIndexOffsetAttr(::mlir::IntegerAttr attr); + void setIndexOffset(::std::optional attrValue); + ::mlir::Attribute removeIndexOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicFaddOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicFmaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicFmaxOpGenericAdaptorBase { +public: + struct Properties { + using boundsCheckTy = ::mlir::BoolAttr; + boundsCheckTy boundsCheck; + + auto getBoundsCheck() { + auto &propStorage = this->boundsCheck; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setBoundsCheck(const ::mlir::BoolAttr &propValue) { + this->boundsCheck = propValue; + } + using indexOffsetTy = ::mlir::IntegerAttr; + indexOffsetTy indexOffset; + + auto getIndexOffset() { + auto &propStorage = this->indexOffset; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndexOffset(const ::mlir::IntegerAttr &propValue) { + this->indexOffset = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.boundsCheck == this->boundsCheck && + rhs.indexOffset == this->indexOffset && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicFmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicFmaxOpGenericAdaptorBase(RawBufferAtomicFmaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); +}; +} // namespace detail +template +class RawBufferAtomicFmaxOpGenericAdaptor : public detail::RawBufferAtomicFmaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicFmaxOpGenericAdaptorBase; +public: + RawBufferAtomicFmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicFmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicFmaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawBufferAtomicFmaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + ValueT getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicFmaxOpAdaptor : public RawBufferAtomicFmaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicFmaxOpGenericAdaptor::RawBufferAtomicFmaxOpGenericAdaptor; + RawBufferAtomicFmaxOpAdaptor(RawBufferAtomicFmaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicFmaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicFmaxOpAdaptor; + template + using GenericAdaptor = RawBufferAtomicFmaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("boundsCheck"), ::llvm::StringRef("indexOffset"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBoundsCheckAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBoundsCheckAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexOffsetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.raw_buffer_atomic_fmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::TypedValue<::mlir::IntegerType> getSgprOffset(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getSgprOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); + void setBoundsCheckAttr(::mlir::BoolAttr attr); + void setBoundsCheck(bool attrValue); + void setIndexOffsetAttr(::mlir::IntegerAttr attr); + void setIndexOffset(::std::optional attrValue); + ::mlir::Attribute removeIndexOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicFmaxOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicSmaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicSmaxOpGenericAdaptorBase { +public: + struct Properties { + using boundsCheckTy = ::mlir::BoolAttr; + boundsCheckTy boundsCheck; + + auto getBoundsCheck() { + auto &propStorage = this->boundsCheck; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setBoundsCheck(const ::mlir::BoolAttr &propValue) { + this->boundsCheck = propValue; + } + using indexOffsetTy = ::mlir::IntegerAttr; + indexOffsetTy indexOffset; + + auto getIndexOffset() { + auto &propStorage = this->indexOffset; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndexOffset(const ::mlir::IntegerAttr &propValue) { + this->indexOffset = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.boundsCheck == this->boundsCheck && + rhs.indexOffset == this->indexOffset && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicSmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicSmaxOpGenericAdaptorBase(RawBufferAtomicSmaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); +}; +} // namespace detail +template +class RawBufferAtomicSmaxOpGenericAdaptor : public detail::RawBufferAtomicSmaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicSmaxOpGenericAdaptorBase; +public: + RawBufferAtomicSmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicSmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicSmaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawBufferAtomicSmaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + ValueT getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicSmaxOpAdaptor : public RawBufferAtomicSmaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicSmaxOpGenericAdaptor::RawBufferAtomicSmaxOpGenericAdaptor; + RawBufferAtomicSmaxOpAdaptor(RawBufferAtomicSmaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicSmaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicSmaxOpAdaptor; + template + using GenericAdaptor = RawBufferAtomicSmaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("boundsCheck"), ::llvm::StringRef("indexOffset"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBoundsCheckAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBoundsCheckAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexOffsetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.raw_buffer_atomic_smax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getValue(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::TypedValue<::mlir::IntegerType> getSgprOffset(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getSgprOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); + void setBoundsCheckAttr(::mlir::BoolAttr attr); + void setBoundsCheck(bool attrValue); + void setIndexOffsetAttr(::mlir::IntegerAttr attr); + void setIndexOffset(::std::optional attrValue); + ::mlir::Attribute removeIndexOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicSmaxOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferAtomicUminOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicUminOpGenericAdaptorBase { +public: + struct Properties { + using boundsCheckTy = ::mlir::BoolAttr; + boundsCheckTy boundsCheck; + + auto getBoundsCheck() { + auto &propStorage = this->boundsCheck; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setBoundsCheck(const ::mlir::BoolAttr &propValue) { + this->boundsCheck = propValue; + } + using indexOffsetTy = ::mlir::IntegerAttr; + indexOffsetTy indexOffset; + + auto getIndexOffset() { + auto &propStorage = this->indexOffset; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndexOffset(const ::mlir::IntegerAttr &propValue) { + this->indexOffset = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.boundsCheck == this->boundsCheck && + rhs.indexOffset == this->indexOffset && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicUminOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicUminOpGenericAdaptorBase(RawBufferAtomicUminOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); +}; +} // namespace detail +template +class RawBufferAtomicUminOpGenericAdaptor : public detail::RawBufferAtomicUminOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicUminOpGenericAdaptorBase; +public: + RawBufferAtomicUminOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicUminOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicUminOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawBufferAtomicUminOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + ValueT getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicUminOpAdaptor : public RawBufferAtomicUminOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicUminOpGenericAdaptor::RawBufferAtomicUminOpGenericAdaptor; + RawBufferAtomicUminOpAdaptor(RawBufferAtomicUminOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicUminOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicUminOpAdaptor; + template + using GenericAdaptor = RawBufferAtomicUminOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("boundsCheck"), ::llvm::StringRef("indexOffset"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBoundsCheckAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBoundsCheckAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexOffsetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.raw_buffer_atomic_umin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getValue(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::TypedValue<::mlir::IntegerType> getSgprOffset(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getSgprOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); + void setBoundsCheckAttr(::mlir::BoolAttr attr); + void setBoundsCheck(bool attrValue); + void setIndexOffsetAttr(::mlir::IntegerAttr attr); + void setIndexOffset(::std::optional attrValue); + ::mlir::Attribute removeIndexOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicUminOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferLoadOpGenericAdaptorBase { +public: + struct Properties { + using boundsCheckTy = ::mlir::BoolAttr; + boundsCheckTy boundsCheck; + + auto getBoundsCheck() { + auto &propStorage = this->boundsCheck; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setBoundsCheck(const ::mlir::BoolAttr &propValue) { + this->boundsCheck = propValue; + } + using indexOffsetTy = ::mlir::IntegerAttr; + indexOffsetTy indexOffset; + + auto getIndexOffset() { + auto &propStorage = this->indexOffset; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndexOffset(const ::mlir::IntegerAttr &propValue) { + this->indexOffset = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.boundsCheck == this->boundsCheck && + rhs.indexOffset == this->indexOffset && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawBufferLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferLoadOpGenericAdaptorBase(RawBufferLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); +}; +} // namespace detail +template +class RawBufferLoadOpGenericAdaptor : public detail::RawBufferLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferLoadOpGenericAdaptorBase; +public: + RawBufferLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawBufferLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + ValueT getSgprOffset() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferLoadOpAdaptor : public RawBufferLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferLoadOpGenericAdaptor::RawBufferLoadOpGenericAdaptor; + RawBufferLoadOpAdaptor(RawBufferLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferLoadOpAdaptor; + template + using GenericAdaptor = RawBufferLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("boundsCheck"), ::llvm::StringRef("indexOffset"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBoundsCheckAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBoundsCheckAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexOffsetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.raw_buffer_load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::TypedValue<::mlir::IntegerType> getSgprOffset(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getSgprOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getValue(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); + void setBoundsCheckAttr(::mlir::BoolAttr attr); + void setBoundsCheck(bool attrValue); + void setIndexOffsetAttr(::mlir::IntegerAttr attr); + void setIndexOffset(::std::optional attrValue); + ::mlir::Attribute removeIndexOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferLoadOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::RawBufferStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferStoreOpGenericAdaptorBase { +public: + struct Properties { + using boundsCheckTy = ::mlir::BoolAttr; + boundsCheckTy boundsCheck; + + auto getBoundsCheck() { + auto &propStorage = this->boundsCheck; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setBoundsCheck(const ::mlir::BoolAttr &propValue) { + this->boundsCheck = propValue; + } + using indexOffsetTy = ::mlir::IntegerAttr; + indexOffsetTy indexOffset; + + auto getIndexOffset() { + auto &propStorage = this->indexOffset; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndexOffset(const ::mlir::IntegerAttr &propValue) { + this->indexOffset = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.boundsCheck == this->boundsCheck && + rhs.indexOffset == this->indexOffset && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawBufferStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferStoreOpGenericAdaptorBase(RawBufferStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); +}; +} // namespace detail +template +class RawBufferStoreOpGenericAdaptor : public detail::RawBufferStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferStoreOpGenericAdaptorBase; +public: + RawBufferStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawBufferStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + ValueT getSgprOffset() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferStoreOpAdaptor : public RawBufferStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferStoreOpGenericAdaptor::RawBufferStoreOpGenericAdaptor; + RawBufferStoreOpAdaptor(RawBufferStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferStoreOpAdaptor; + template + using GenericAdaptor = RawBufferStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("boundsCheck"), ::llvm::StringRef("indexOffset"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBoundsCheckAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBoundsCheckAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexOffsetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.raw_buffer_store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::TypedValue<::mlir::IntegerType> getSgprOffset(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getSgprOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getBoundsCheckAttr(); + bool getBoundsCheck(); + ::mlir::IntegerAttr getIndexOffsetAttr(); + ::std::optional getIndexOffset(); + void setBoundsCheckAttr(::mlir::BoolAttr attr); + void setBoundsCheck(bool attrValue); + void setIndexOffsetAttr(::mlir::IntegerAttr attr); + void setIndexOffset(::std::optional attrValue); + ::mlir::Attribute removeIndexOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferStoreOp) + +namespace mlir { +namespace amdgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::amdgpu::WMMAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WMMAOpGenericAdaptorBase { +public: + struct Properties { + using clampTy = ::mlir::UnitAttr; + clampTy clamp; + + auto getClamp() { + auto &propStorage = this->clamp; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setClamp(const ::mlir::UnitAttr &propValue) { + this->clamp = propValue; + } + using subwordOffsetTy = ::mlir::IntegerAttr; + subwordOffsetTy subwordOffset; + + auto getSubwordOffset() { + auto &propStorage = this->subwordOffset; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setSubwordOffset(const ::mlir::IntegerAttr &propValue) { + this->subwordOffset = propValue; + } + using unsignedATy = ::mlir::UnitAttr; + unsignedATy unsignedA; + + auto getUnsignedA() { + auto &propStorage = this->unsignedA; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setUnsignedA(const ::mlir::UnitAttr &propValue) { + this->unsignedA = propValue; + } + using unsignedBTy = ::mlir::UnitAttr; + unsignedBTy unsignedB; + + auto getUnsignedB() { + auto &propStorage = this->unsignedB; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setUnsignedB(const ::mlir::UnitAttr &propValue) { + this->unsignedB = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.clamp == this->clamp && + rhs.subwordOffset == this->subwordOffset && + rhs.unsignedA == this->unsignedA && + rhs.unsignedB == this->unsignedB && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + WMMAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + WMMAOpGenericAdaptorBase(WMMAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSubwordOffsetAttr(); + uint32_t getSubwordOffset(); + ::mlir::UnitAttr getUnsignedAAttr(); + bool getUnsignedA(); + ::mlir::UnitAttr getUnsignedBAttr(); + bool getUnsignedB(); + ::mlir::UnitAttr getClampAttr(); + bool getClamp(); +}; +} // namespace detail +template +class WMMAOpGenericAdaptor : public detail::WMMAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WMMAOpGenericAdaptorBase; +public: + WMMAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WMMAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WMMAOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + WMMAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSourceA() { + return (*getODSOperands(0).begin()); + } + + ValueT getSourceB() { + return (*getODSOperands(1).begin()); + } + + ValueT getDestC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WMMAOpAdaptor : public WMMAOpGenericAdaptor<::mlir::ValueRange> { +public: + using WMMAOpGenericAdaptor::WMMAOpGenericAdaptor; + WMMAOpAdaptor(WMMAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WMMAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WMMAOpAdaptor; + template + using GenericAdaptor = WMMAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("clamp"), ::llvm::StringRef("subwordOffset"), ::llvm::StringRef("unsignedA"), ::llvm::StringRef("unsignedB")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getClampAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getClampAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSubwordOffsetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSubwordOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUnsignedAAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUnsignedAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUnsignedBAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUnsignedBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amdgpu.wmma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSourceA(); + ::mlir::Value getSourceB(); + ::mlir::Value getDestC(); + ::mlir::OpOperand &getSourceAMutable(); + ::mlir::OpOperand &getSourceBMutable(); + ::mlir::OpOperand &getDestCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getDestD(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getSubwordOffsetAttr(); + uint32_t getSubwordOffset(); + ::mlir::UnitAttr getUnsignedAAttr(); + bool getUnsignedA(); + ::mlir::UnitAttr getUnsignedBAttr(); + bool getUnsignedB(); + ::mlir::UnitAttr getClampAttr(); + bool getClamp(); + void setSubwordOffsetAttr(::mlir::IntegerAttr attr); + void setSubwordOffset(uint32_t attrValue); + void setUnsignedAAttr(::mlir::UnitAttr attr); + void setUnsignedA(bool attrValue); + void setUnsignedBAttr(::mlir::UnitAttr attr); + void setUnsignedB(bool attrValue); + void setClampAttr(::mlir::UnitAttr attr); + void setClamp(bool attrValue); + ::mlir::Attribute removeUnsignedAAttr(); + ::mlir::Attribute removeUnsignedBAttr(); + ::mlir::Attribute removeClampAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset = 0, /*optional*/bool unsignedA = false, /*optional*/bool unsignedB = false, /*optional*/bool clamp = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset = 0, /*optional*/bool unsignedA = false, /*optional*/bool unsignedB = false, /*optional*/bool clamp = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::WMMAOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..2858b172915e8cee02e09075f001c0e8ecfbfe19 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.cpp.inc @@ -0,0 +1,140 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::amdgpu::MFMAPermBAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::amdgpu::MFMAPermBAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::amdgpu::MFMAPermBAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::amdgpu::MFMAPermBAttr>([&](auto t) { + printer << ::mlir::amdgpu::MFMAPermBAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace amdgpu { +namespace detail { +struct MFMAPermBAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::amdgpu::MFMAPermB>; + MFMAPermBAttrStorage(::mlir::amdgpu::MFMAPermB value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static MFMAPermBAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) MFMAPermBAttrStorage(std::move(value)); + } + + ::mlir::amdgpu::MFMAPermB value; +}; +} // namespace detail +MFMAPermBAttr MFMAPermBAttr::get(::mlir::MLIRContext *context, ::mlir::amdgpu::MFMAPermB value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute MFMAPermBAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::amdgpu::MFMAPermB> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::amdgpu::MFMAPermB> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::amdgpu::symbolizeMFMAPermB(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::amdgpu::MFMAPermB" << " to be one of: " << "none" << ", " << "bcast_first_32" << ", " << "bcast_second_32" << ", " << "rotate_16_right" << ", " << "bcast_first_16" << ", " << "bcast_second_16" << ", " << "bcast_third_16" << ", " << "bcast_fourth_16")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse AMDGPU_MFMAPermBAttr parameter 'value' which is to be a `::mlir::amdgpu::MFMAPermB`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return MFMAPermBAttr::get(odsParser.getContext(), + ::mlir::amdgpu::MFMAPermB((*_result_value))); +} + +void MFMAPermBAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyMFMAPermB(getValue()); +} + +::mlir::amdgpu::MFMAPermB MFMAPermBAttr::getValue() const { + return getImpl()->value; +} + +} // namespace amdgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MFMAPermBAttr) +namespace mlir { +namespace amdgpu { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute AMDGPUDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void AMDGPUDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace amdgpu +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..bf94465db80edec9d2f321b95b9b2078cddd6808 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.h.inc @@ -0,0 +1,40 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace amdgpu { +class MFMAPermBAttr; +namespace detail { +struct MFMAPermBAttrStorage; +} // namespace detail +class MFMAPermBAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static MFMAPermBAttr get(::mlir::MLIRContext *context, ::mlir::amdgpu::MFMAPermB value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mfma_perm_b"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::amdgpu::MFMAPermB getValue() const; +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MFMAPermBAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..f8a4459cd8143903a0e50aee5c6eeb4be31287c9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.cpp.inc @@ -0,0 +1,27 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMDGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::AMDGPUDialect) +namespace mlir { +namespace amdgpu { + +AMDGPUDialect::AMDGPUDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + initialize(); +} + +AMDGPUDialect::~AMDGPUDialect() = default; + +} // namespace amdgpu +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..0a2e6bb5e9fe49454f5c4f8199d95d2af88375d0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h @@ -0,0 +1,33 @@ +//===- AMDGPUDialect.h - MLIR Dialect for AMDGPU ---------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares a dialect for MLIR wrappers around AMDGPU-specific +// intrinssics and for other AMD GPU-specific functionality. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AMDGPU_IR_AMDGPUDIALECT_H_ +#define MLIR_DIALECT_AMDGPU_IR_AMDGPUDIALECT_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#include "mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h.inc" + +#include "mlir/Dialect/AMDGPU/IR/AMDGPUEnums.h.inc" + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/AMDGPU/IR/AMDGPU.h.inc" + +#endif // MLIR_DIALECT_AMDGPU_IR_AMDGPUDIALECT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..360eb1f86d696191ff1e8dfe1cc05aad17d28391 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h.inc @@ -0,0 +1,34 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMDGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace amdgpu { + +class AMDGPUDialect : public ::mlir::Dialect { + explicit AMDGPUDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~AMDGPUDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("amdgpu"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; +}; +} // namespace amdgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amdgpu::AMDGPUDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..6d3dc772914014c6cff76992b2ca1b794c384301 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.cpp.inc @@ -0,0 +1,54 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMDGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace amdgpu { +::llvm::StringRef stringifyMFMAPermB(MFMAPermB val) { + switch (val) { + case MFMAPermB::none: return "none"; + case MFMAPermB::bcast_first_32: return "bcast_first_32"; + case MFMAPermB::bcast_second_32: return "bcast_second_32"; + case MFMAPermB::rotate_16_right: return "rotate_16_right"; + case MFMAPermB::bcast_first_16: return "bcast_first_16"; + case MFMAPermB::bcast_second_16: return "bcast_second_16"; + case MFMAPermB::bcast_third_16: return "bcast_third_16"; + case MFMAPermB::bcast_fourth_16: return "bcast_fourth_16"; + } + return ""; +} + +::std::optional symbolizeMFMAPermB(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("none", MFMAPermB::none) + .Case("bcast_first_32", MFMAPermB::bcast_first_32) + .Case("bcast_second_32", MFMAPermB::bcast_second_32) + .Case("rotate_16_right", MFMAPermB::rotate_16_right) + .Case("bcast_first_16", MFMAPermB::bcast_first_16) + .Case("bcast_second_16", MFMAPermB::bcast_second_16) + .Case("bcast_third_16", MFMAPermB::bcast_third_16) + .Case("bcast_fourth_16", MFMAPermB::bcast_fourth_16) + .Default(::std::nullopt); +} +::std::optional symbolizeMFMAPermB(uint32_t value) { + switch (value) { + case 0: return MFMAPermB::none; + case 1: return MFMAPermB::bcast_first_32; + case 2: return MFMAPermB::bcast_second_32; + case 3: return MFMAPermB::rotate_16_right; + case 4: return MFMAPermB::bcast_first_16; + case 5: return MFMAPermB::bcast_second_16; + case 6: return MFMAPermB::bcast_third_16; + case 7: return MFMAPermB::bcast_fourth_16; + default: return ::std::nullopt; + } +} + +} // namespace amdgpu +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..269d1eeef4a7487e48f675c32c637b686ab83118 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.h.inc @@ -0,0 +1,96 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMDGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace amdgpu { +// The possible permutations of the lanes storing B available in an MFMA +enum class MFMAPermB : uint32_t { + none = 0, + bcast_first_32 = 1, + bcast_second_32 = 2, + rotate_16_right = 3, + bcast_first_16 = 4, + bcast_second_16 = 5, + bcast_third_16 = 6, + bcast_fourth_16 = 7, +}; + +::std::optional symbolizeMFMAPermB(uint32_t); +::llvm::StringRef stringifyMFMAPermB(MFMAPermB); +::std::optional symbolizeMFMAPermB(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForMFMAPermB() { + return 7; +} + + +inline ::llvm::StringRef stringifyEnum(MFMAPermB enumValue) { + return stringifyMFMAPermB(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeMFMAPermB(str); +} +} // namespace amdgpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::amdgpu::MFMAPermB, ::mlir::amdgpu::MFMAPermB> { + template + static FailureOr<::mlir::amdgpu::MFMAPermB> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for The possible permutations of the lanes storing B available in an MFMA"); + + // Symbolize the keyword. + if (::std::optional<::mlir::amdgpu::MFMAPermB> attr = ::mlir::amdgpu::symbolizeEnum<::mlir::amdgpu::MFMAPermB>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid The possible permutations of the lanes storing B available in an MFMA specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::amdgpu::MFMAPermB value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::amdgpu::MFMAPermB> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::amdgpu::MFMAPermB getEmptyKey() { + return static_cast<::mlir::amdgpu::MFMAPermB>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::amdgpu::MFMAPermB getTombstoneKey() { + return static_cast<::mlir::amdgpu::MFMAPermB>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::amdgpu::MFMAPermB &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::amdgpu::MFMAPermB &lhs, const ::mlir::amdgpu::MFMAPermB &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/Utils/Chipset.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/Utils/Chipset.h new file mode 100644 index 0000000000000000000000000000000000000000..5031dc48561736673177c956ebe338b275334bbd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMDGPU/Utils/Chipset.h @@ -0,0 +1,27 @@ +//===- Chipset.h - AMDGPU Chipset version struct ----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_DIALECT_AMDGPU_UTILS_CHIPSET_H_ +#define MLIR_DIALECT_AMDGPU_UTILS_CHIPSET_H_ + +#include "mlir/Support/LogicalResult.h" + +namespace mlir { +namespace amdgpu { +struct Chipset { + Chipset() = default; + Chipset(unsigned majorVersion, unsigned minorVersion) + : majorVersion(majorVersion), minorVersion(minorVersion){}; + static FailureOr parse(StringRef name); + + unsigned majorVersion = 0; + unsigned minorVersion = 0; +}; +} // end namespace amdgpu +} // end namespace mlir + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMX.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMX.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..795714ed2ffaa734defef53b79e94001a373c77f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMX.cpp.inc @@ -0,0 +1,2679 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMX.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::amx::x86_amx_tdpbf16ps, +::mlir::amx::x86_amx_tdpbssd, +::mlir::amx::x86_amx_tdpbsud, +::mlir::amx::x86_amx_tdpbusd, +::mlir::amx::x86_amx_tdpbuud, +::mlir::amx::x86_amx_tileloadd64, +::mlir::amx::x86_amx_tilestored64, +::mlir::amx::x86_amx_tilezero, +::mlir::amx::TileLoadOp, +::mlir::amx::TileMulFOp, +::mlir::amx::TileMulIOp, +::mlir::amx::TileStoreOp, +::mlir::amx::TileZeroOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace amx { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMX0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IntegerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMX1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleOuterType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMX2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMX3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMX4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMX5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF32())) || ((elementType.isBF16())) || ((elementType.isSignlessInteger(32))) || ((elementType.isSignlessInteger(8))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of 32-bit float or bfloat16 type or 32-bit signless integer or 8-bit signless integer values of ranks 2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMX6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF32())) || ((elementType.isBF16())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of 32-bit float or bfloat16 type values of ranks 2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AMX7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(32))) || ((elementType.isSignlessInteger(8))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of 32-bit signless integer or 8-bit signless integer values of ranks 2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMX0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AMX0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AMX0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbf16ps definitions +//===----------------------------------------------------------------------===// + +namespace detail { +x86_amx_tdpbf16psGenericAdaptorBase::x86_amx_tdpbf16psGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tdpbf16ps", odsAttrs.getContext()); +} + +x86_amx_tdpbf16psGenericAdaptorBase::x86_amx_tdpbf16psGenericAdaptorBase(x86_amx_tdpbf16ps op) : x86_amx_tdpbf16psGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair x86_amx_tdpbf16psGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr x86_amx_tdpbf16psGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +x86_amx_tdpbf16psAdaptor::x86_amx_tdpbf16psAdaptor(x86_amx_tdpbf16ps op) : x86_amx_tdpbf16psGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult x86_amx_tdpbf16psAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair x86_amx_tdpbf16ps::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range x86_amx_tdpbf16ps::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair x86_amx_tdpbf16ps::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range x86_amx_tdpbf16ps::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value x86_amx_tdpbf16ps::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void x86_amx_tdpbf16ps::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + odsState.addTypes(res); +} + +void x86_amx_tdpbf16ps::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void x86_amx_tdpbf16ps::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult x86_amx_tdpbf16ps::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult x86_amx_tdpbf16ps::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbf16ps) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbssd definitions +//===----------------------------------------------------------------------===// + +namespace detail { +x86_amx_tdpbssdGenericAdaptorBase::x86_amx_tdpbssdGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tdpbssd", odsAttrs.getContext()); +} + +x86_amx_tdpbssdGenericAdaptorBase::x86_amx_tdpbssdGenericAdaptorBase(x86_amx_tdpbssd op) : x86_amx_tdpbssdGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair x86_amx_tdpbssdGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr x86_amx_tdpbssdGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +x86_amx_tdpbssdAdaptor::x86_amx_tdpbssdAdaptor(x86_amx_tdpbssd op) : x86_amx_tdpbssdGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult x86_amx_tdpbssdAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair x86_amx_tdpbssd::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range x86_amx_tdpbssd::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair x86_amx_tdpbssd::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range x86_amx_tdpbssd::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value x86_amx_tdpbssd::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void x86_amx_tdpbssd::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + odsState.addTypes(res); +} + +void x86_amx_tdpbssd::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void x86_amx_tdpbssd::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult x86_amx_tdpbssd::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult x86_amx_tdpbssd::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbssd) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbsud definitions +//===----------------------------------------------------------------------===// + +namespace detail { +x86_amx_tdpbsudGenericAdaptorBase::x86_amx_tdpbsudGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tdpbsud", odsAttrs.getContext()); +} + +x86_amx_tdpbsudGenericAdaptorBase::x86_amx_tdpbsudGenericAdaptorBase(x86_amx_tdpbsud op) : x86_amx_tdpbsudGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair x86_amx_tdpbsudGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr x86_amx_tdpbsudGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +x86_amx_tdpbsudAdaptor::x86_amx_tdpbsudAdaptor(x86_amx_tdpbsud op) : x86_amx_tdpbsudGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult x86_amx_tdpbsudAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair x86_amx_tdpbsud::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range x86_amx_tdpbsud::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair x86_amx_tdpbsud::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range x86_amx_tdpbsud::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value x86_amx_tdpbsud::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void x86_amx_tdpbsud::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + odsState.addTypes(res); +} + +void x86_amx_tdpbsud::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void x86_amx_tdpbsud::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult x86_amx_tdpbsud::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult x86_amx_tdpbsud::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbsud) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbusd definitions +//===----------------------------------------------------------------------===// + +namespace detail { +x86_amx_tdpbusdGenericAdaptorBase::x86_amx_tdpbusdGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tdpbusd", odsAttrs.getContext()); +} + +x86_amx_tdpbusdGenericAdaptorBase::x86_amx_tdpbusdGenericAdaptorBase(x86_amx_tdpbusd op) : x86_amx_tdpbusdGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair x86_amx_tdpbusdGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr x86_amx_tdpbusdGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +x86_amx_tdpbusdAdaptor::x86_amx_tdpbusdAdaptor(x86_amx_tdpbusd op) : x86_amx_tdpbusdGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult x86_amx_tdpbusdAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair x86_amx_tdpbusd::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range x86_amx_tdpbusd::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair x86_amx_tdpbusd::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range x86_amx_tdpbusd::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value x86_amx_tdpbusd::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void x86_amx_tdpbusd::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + odsState.addTypes(res); +} + +void x86_amx_tdpbusd::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void x86_amx_tdpbusd::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult x86_amx_tdpbusd::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult x86_amx_tdpbusd::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbusd) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbuud definitions +//===----------------------------------------------------------------------===// + +namespace detail { +x86_amx_tdpbuudGenericAdaptorBase::x86_amx_tdpbuudGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tdpbuud", odsAttrs.getContext()); +} + +x86_amx_tdpbuudGenericAdaptorBase::x86_amx_tdpbuudGenericAdaptorBase(x86_amx_tdpbuud op) : x86_amx_tdpbuudGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair x86_amx_tdpbuudGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr x86_amx_tdpbuudGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +x86_amx_tdpbuudAdaptor::x86_amx_tdpbuudAdaptor(x86_amx_tdpbuud op) : x86_amx_tdpbuudGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult x86_amx_tdpbuudAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair x86_amx_tdpbuud::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range x86_amx_tdpbuud::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair x86_amx_tdpbuud::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range x86_amx_tdpbuud::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value x86_amx_tdpbuud::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void x86_amx_tdpbuud::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + odsState.addTypes(res); +} + +void x86_amx_tdpbuud::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + odsState.addOperands(odsArg_5); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void x86_amx_tdpbuud::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult x86_amx_tdpbuud::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult x86_amx_tdpbuud::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbuud) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tileloadd64 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +x86_amx_tileloadd64GenericAdaptorBase::x86_amx_tileloadd64GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tileloadd64", odsAttrs.getContext()); +} + +x86_amx_tileloadd64GenericAdaptorBase::x86_amx_tileloadd64GenericAdaptorBase(x86_amx_tileloadd64 op) : x86_amx_tileloadd64GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair x86_amx_tileloadd64GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr x86_amx_tileloadd64GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +x86_amx_tileloadd64Adaptor::x86_amx_tileloadd64Adaptor(x86_amx_tileloadd64 op) : x86_amx_tileloadd64GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult x86_amx_tileloadd64Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair x86_amx_tileloadd64::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range x86_amx_tileloadd64::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair x86_amx_tileloadd64::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range x86_amx_tileloadd64::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value x86_amx_tileloadd64::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void x86_amx_tileloadd64::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addTypes(res); +} + +void x86_amx_tileloadd64::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void x86_amx_tileloadd64::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult x86_amx_tileloadd64::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult x86_amx_tileloadd64::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tileloadd64) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tilestored64 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +x86_amx_tilestored64GenericAdaptorBase::x86_amx_tilestored64GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tilestored64", odsAttrs.getContext()); +} + +x86_amx_tilestored64GenericAdaptorBase::x86_amx_tilestored64GenericAdaptorBase(x86_amx_tilestored64 op) : x86_amx_tilestored64GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair x86_amx_tilestored64GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr x86_amx_tilestored64GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +x86_amx_tilestored64Adaptor::x86_amx_tilestored64Adaptor(x86_amx_tilestored64 op) : x86_amx_tilestored64GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult x86_amx_tilestored64Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair x86_amx_tilestored64::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range x86_amx_tilestored64::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair x86_amx_tilestored64::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range x86_amx_tilestored64::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void x86_amx_tilestored64::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void x86_amx_tilestored64::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void x86_amx_tilestored64::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult x86_amx_tilestored64::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult x86_amx_tilestored64::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tilestored64) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tilezero definitions +//===----------------------------------------------------------------------===// + +namespace detail { +x86_amx_tilezeroGenericAdaptorBase::x86_amx_tilezeroGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tilezero", odsAttrs.getContext()); +} + +x86_amx_tilezeroGenericAdaptorBase::x86_amx_tilezeroGenericAdaptorBase(x86_amx_tilezero op) : x86_amx_tilezeroGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair x86_amx_tilezeroGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr x86_amx_tilezeroGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +x86_amx_tilezeroAdaptor::x86_amx_tilezeroAdaptor(x86_amx_tilezero op) : x86_amx_tilezeroGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult x86_amx_tilezeroAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair x86_amx_tilezero::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range x86_amx_tilezero::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair x86_amx_tilezero::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range x86_amx_tilezero::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value x86_amx_tilezero::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void x86_amx_tilezero::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addTypes(res); +} + +void x86_amx_tilezero::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void x86_amx_tilezero::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult x86_amx_tilezero::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult x86_amx_tilezero::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tilezero) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TileLoadOpGenericAdaptorBase::TileLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tile_load", odsAttrs.getContext()); +} + +TileLoadOpGenericAdaptorBase::TileLoadOpGenericAdaptorBase(TileLoadOp op) : TileLoadOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TileLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr TileLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TileLoadOpAdaptor::TileLoadOpAdaptor(TileLoadOp op) : TileLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TileLoadOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TileLoadOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range TileLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> TileLoadOp::getBase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range TileLoadOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &TileLoadOp::getBaseMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange TileLoadOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair TileLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TileLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> TileLoadOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void TileLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value base, ::mlir::ValueRange indices) { + odsState.addOperands(base); + odsState.addOperands(indices); + odsState.addTypes(res); +} + +void TileLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices) { + odsState.addOperands(base); + odsState.addOperands(indices); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TileLoadOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TileLoadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TileLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand baseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(baseRawOperands); ::llvm::SMLoc baseOperandsLoc; + (void)baseOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::Type baseRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> baseTypes(baseRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + baseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(baseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + baseRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resTypes); + if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TileLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBase(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBase().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TileLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::TileLoadOp) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileMulFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TileMulFOpGenericAdaptorBase::TileMulFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tile_mulf", odsAttrs.getContext()); +} + +TileMulFOpGenericAdaptorBase::TileMulFOpGenericAdaptorBase(TileMulFOp op) : TileMulFOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TileMulFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TileMulFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TileMulFOpAdaptor::TileMulFOpAdaptor(TileMulFOp op) : TileMulFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TileMulFOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TileMulFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TileMulFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> TileMulFOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> TileMulFOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> TileMulFOp::getAcc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &TileMulFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &TileMulFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &TileMulFOp::getAccMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair TileMulFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TileMulFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> TileMulFOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void TileMulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(acc); + odsState.addTypes(res); +} + +void TileMulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(acc); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileMulFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TileMulFOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType())))) + return emitOpError("failed to verify that all of {acc, res} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult TileMulFOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TileMulFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand accRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accOperands(accRawOperands); ::llvm::SMLoc accOperandsLoc; + (void)accOperandsLoc; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + ::mlir::Type rhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> rhsTypes(rhsRawTypes); + ::mlir::Type accRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accTypes(accRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + accOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + rhsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accRawTypes[0] = type; + } + result.addTypes(accTypes[0]); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(accOperands, accTypes, accOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TileMulFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getAcc(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getAcc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TileMulFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::TileMulFOp) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileMulIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TileMulIOpGenericAdaptorBase::TileMulIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tile_muli", odsAttrs.getContext()); +} + +TileMulIOpGenericAdaptorBase::TileMulIOpGenericAdaptorBase(TileMulIOp op) : TileMulIOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TileMulIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TileMulIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr TileMulIOpGenericAdaptorBase::getIsZextLhsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().isZextLhs); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool TileMulIOpGenericAdaptorBase::getIsZextLhs() { + auto attr = getIsZextLhsAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr TileMulIOpGenericAdaptorBase::getIsZextRhsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().isZextRhs); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool TileMulIOpGenericAdaptorBase::getIsZextRhs() { + auto attr = getIsZextRhsAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +TileMulIOpAdaptor::TileMulIOpAdaptor(TileMulIOp op) : TileMulIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TileMulIOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_isZextLhs = getProperties().isZextLhs; (void)tblgen_isZextLhs; + auto tblgen_isZextRhs = getProperties().isZextRhs; (void)tblgen_isZextRhs; + + if (tblgen_isZextLhs && !((::llvm::isa<::mlir::UnitAttr>(tblgen_isZextLhs)))) + return emitError(loc, "'amx.tile_muli' op ""attribute 'isZextLhs' failed to satisfy constraint: unit attribute"); + + if (tblgen_isZextRhs && !((::llvm::isa<::mlir::UnitAttr>(tblgen_isZextRhs)))) + return emitError(loc, "'amx.tile_muli' op ""attribute 'isZextRhs' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair TileMulIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TileMulIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> TileMulIOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> TileMulIOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> TileMulIOp::getAcc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &TileMulIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &TileMulIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &TileMulIOp::getAccMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair TileMulIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TileMulIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> TileMulIOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult TileMulIOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.isZextLhs; + auto attr = dict.get("isZextLhs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for isZextLhs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isZextLhs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.isZextRhs; + auto attr = dict.get("isZextRhs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for isZextRhs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isZextRhs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TileMulIOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.isZextLhs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isZextLhs", + propStorage)); + } + + { + const auto &propStorage = prop.isZextRhs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isZextRhs", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TileMulIOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.isZextLhs.getAsOpaquePointer()), + llvm::hash_value(prop.isZextRhs.getAsOpaquePointer())); +} + +std::optional TileMulIOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "isZextLhs") + return prop.isZextLhs; + + if (name == "isZextRhs") + return prop.isZextRhs; + return std::nullopt; +} + +void TileMulIOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "isZextLhs") { + prop.isZextLhs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "isZextRhs") { + prop.isZextRhs = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TileMulIOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.isZextLhs) attrs.append("isZextLhs", prop.isZextLhs); + + if (prop.isZextRhs) attrs.append("isZextRhs", prop.isZextRhs); +} + +::mlir::LogicalResult TileMulIOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIsZextLhsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMX0(attr, "isZextLhs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsZextRhsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMX0(attr, "isZextRhs", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TileMulIOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.isZextLhs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.isZextRhs))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TileMulIOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.isZextLhs); + + writer.writeOptionalAttribute(prop.isZextRhs); +} + +::mlir::UnitAttr TileMulIOp::getIsZextLhsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().isZextLhs); +} + +bool TileMulIOp::getIsZextLhs() { + auto attr = getIsZextLhsAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr TileMulIOp::getIsZextRhsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().isZextRhs); +} + +bool TileMulIOp::getIsZextRhs() { + auto attr = getIsZextRhsAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void TileMulIOp::setIsZextLhsAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getIsZextLhsAttrName(), attr); +} + +void TileMulIOp::setIsZextLhs(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getIsZextLhsAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getIsZextLhsAttrName()); +} + +void TileMulIOp::setIsZextRhsAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getIsZextRhsAttrName(), attr); +} + +void TileMulIOp::setIsZextRhs(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getIsZextRhsAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getIsZextRhsAttrName()); +} + +::mlir::Attribute TileMulIOp::removeIsZextLhsAttr() { + auto &attr = getProperties().isZextLhs; + attr = {}; + return attr; +} + +::mlir::Attribute TileMulIOp::removeIsZextRhsAttr() { + auto &attr = getProperties().isZextRhs; + attr = {}; + return attr; +} + +void TileMulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc, /*optional*/::mlir::UnitAttr isZextLhs, /*optional*/::mlir::UnitAttr isZextRhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(acc); + if (isZextLhs) { + odsState.getOrAddProperties().isZextLhs = isZextLhs; + } + if (isZextRhs) { + odsState.getOrAddProperties().isZextRhs = isZextRhs; + } + odsState.addTypes(res); +} + +void TileMulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc, /*optional*/::mlir::UnitAttr isZextLhs, /*optional*/::mlir::UnitAttr isZextRhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(acc); + if (isZextLhs) { + odsState.getOrAddProperties().isZextLhs = isZextLhs; + } + if (isZextRhs) { + odsState.getOrAddProperties().isZextRhs = isZextRhs; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileMulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc, /*optional*/bool isZextLhs, /*optional*/bool isZextRhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(acc); + if (isZextLhs) { + odsState.getOrAddProperties().isZextLhs = ((isZextLhs) ? odsBuilder.getUnitAttr() : nullptr); + } + if (isZextRhs) { + odsState.getOrAddProperties().isZextRhs = ((isZextRhs) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(res); +} + +void TileMulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc, /*optional*/bool isZextLhs, /*optional*/bool isZextRhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(acc); + if (isZextLhs) { + odsState.getOrAddProperties().isZextLhs = ((isZextLhs) ? odsBuilder.getUnitAttr() : nullptr); + } + if (isZextRhs) { + odsState.getOrAddProperties().isZextRhs = ((isZextRhs) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileMulIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TileMulIOp::verifyInvariantsImpl() { + auto tblgen_isZextLhs = getProperties().isZextLhs; (void)tblgen_isZextLhs; + auto tblgen_isZextRhs = getProperties().isZextRhs; (void)tblgen_isZextRhs; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMX0(*this, tblgen_isZextLhs, "isZextLhs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AMX0(*this, tblgen_isZextRhs, "isZextRhs"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType())))) + return emitOpError("failed to verify that all of {acc, res} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult TileMulIOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TileMulIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand accRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accOperands(accRawOperands); ::llvm::SMLoc accOperandsLoc; + (void)accOperandsLoc; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + ::mlir::Type rhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> rhsTypes(rhsRawTypes); + ::mlir::Type accRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accTypes(accRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("zext"))) { + result.getOrAddProperties().isZextLhs = parser.getBuilder().getUnitAttr(); } + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("zext"))) { + result.getOrAddProperties().isZextRhs = parser.getBuilder().getUnitAttr(); } + if (parser.parseComma()) + return ::mlir::failure(); + + accOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + rhsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accRawTypes[0] = type; + } + result.addTypes(accTypes[0]); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(accOperands, accTypes, accOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TileMulIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + if (getIsZextLhsAttr()) { + _odsPrinter << ' ' << "zext"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getIsZextRhsAttr()) { + _odsPrinter << ' ' << "zext"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getAcc(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("isZextLhs"); + elidedAttrs.push_back("isZextRhs"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getIsZextLhsAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("isZextLhs"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getIsZextRhsAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("isZextRhs"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getAcc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TileMulIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::TileMulIOp) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TileStoreOpGenericAdaptorBase::TileStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tile_store", odsAttrs.getContext()); +} + +TileStoreOpGenericAdaptorBase::TileStoreOpGenericAdaptorBase(TileStoreOp op) : TileStoreOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TileStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr TileStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TileStoreOpAdaptor::TileStoreOpAdaptor(TileStoreOp op) : TileStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TileStoreOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TileStoreOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range TileStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> TileStoreOp::getBase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range TileStoreOp::getIndices() { + return getODSOperands(1); +} + +::mlir::TypedValue<::mlir::VectorType> TileStoreOp::getVal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &TileStoreOp::getBaseMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange TileStoreOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &TileStoreOp::getValMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair TileStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TileStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void TileStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value val) { + odsState.addOperands(base); + odsState.addOperands(indices); + odsState.addOperands(val); +} + +void TileStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value val) { + odsState.addOperands(base); + odsState.addOperands(indices); + odsState.addOperands(val); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TileStoreOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TileStoreOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TileStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand baseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(baseRawOperands); ::llvm::SMLoc baseOperandsLoc; + (void)baseOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(valRawOperands); ::llvm::SMLoc valOperandsLoc; + (void)valOperandsLoc; + ::mlir::Type baseRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> baseTypes(baseRawTypes); + ::mlir::Type valRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes); + + baseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(baseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + baseRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TileStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBase(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getVal(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBase().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getVal().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TileStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::TileStoreOp) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileZeroOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TileZeroOpGenericAdaptorBase::TileZeroOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("amx.tile_zero", odsAttrs.getContext()); +} + +TileZeroOpGenericAdaptorBase::TileZeroOpGenericAdaptorBase(TileZeroOp op) : TileZeroOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TileZeroOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TileZeroOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TileZeroOpAdaptor::TileZeroOpAdaptor(TileZeroOp op) : TileZeroOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TileZeroOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TileZeroOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TileZeroOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair TileZeroOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TileZeroOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> TileZeroOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void TileZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void TileZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileZeroOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TileZeroOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AMX5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TileZeroOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TileZeroOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void TileZeroOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TileZeroOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace amx +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::TileZeroOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMX.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMX.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..40d08e3ba71a2f1b9eeea05b8044e9a9564632f7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMX.h.inc @@ -0,0 +1,1479 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMX.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace amx { +class x86_amx_tdpbf16ps; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class x86_amx_tdpbssd; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class x86_amx_tdpbsud; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class x86_amx_tdpbusd; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class x86_amx_tdpbuud; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class x86_amx_tileloadd64; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class x86_amx_tilestored64; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class x86_amx_tilezero; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class TileLoadOp; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class TileMulFOp; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class TileMulIOp; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class TileStoreOp; +} // namespace amx +} // namespace mlir +namespace mlir { +namespace amx { +class TileZeroOp; +} // namespace amx +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbf16ps declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class x86_amx_tdpbf16psGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + x86_amx_tdpbf16psGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + x86_amx_tdpbf16psGenericAdaptorBase(x86_amx_tdpbf16ps op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class x86_amx_tdpbf16psGenericAdaptor : public detail::x86_amx_tdpbf16psGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::x86_amx_tdpbf16psGenericAdaptorBase; +public: + x86_amx_tdpbf16psGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + x86_amx_tdpbf16psGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : x86_amx_tdpbf16psGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + x86_amx_tdpbf16psGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class x86_amx_tdpbf16psAdaptor : public x86_amx_tdpbf16psGenericAdaptor<::mlir::ValueRange> { +public: + using x86_amx_tdpbf16psGenericAdaptor::x86_amx_tdpbf16psGenericAdaptor; + x86_amx_tdpbf16psAdaptor(x86_amx_tdpbf16ps op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class x86_amx_tdpbf16ps : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = x86_amx_tdpbf16psAdaptor; + template + using GenericAdaptor = x86_amx_tdpbf16psGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tdpbf16ps"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbf16ps) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbssd declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class x86_amx_tdpbssdGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + x86_amx_tdpbssdGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + x86_amx_tdpbssdGenericAdaptorBase(x86_amx_tdpbssd op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class x86_amx_tdpbssdGenericAdaptor : public detail::x86_amx_tdpbssdGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::x86_amx_tdpbssdGenericAdaptorBase; +public: + x86_amx_tdpbssdGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + x86_amx_tdpbssdGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : x86_amx_tdpbssdGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + x86_amx_tdpbssdGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class x86_amx_tdpbssdAdaptor : public x86_amx_tdpbssdGenericAdaptor<::mlir::ValueRange> { +public: + using x86_amx_tdpbssdGenericAdaptor::x86_amx_tdpbssdGenericAdaptor; + x86_amx_tdpbssdAdaptor(x86_amx_tdpbssd op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class x86_amx_tdpbssd : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = x86_amx_tdpbssdAdaptor; + template + using GenericAdaptor = x86_amx_tdpbssdGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tdpbssd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbssd) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbsud declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class x86_amx_tdpbsudGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + x86_amx_tdpbsudGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + x86_amx_tdpbsudGenericAdaptorBase(x86_amx_tdpbsud op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class x86_amx_tdpbsudGenericAdaptor : public detail::x86_amx_tdpbsudGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::x86_amx_tdpbsudGenericAdaptorBase; +public: + x86_amx_tdpbsudGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + x86_amx_tdpbsudGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : x86_amx_tdpbsudGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + x86_amx_tdpbsudGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class x86_amx_tdpbsudAdaptor : public x86_amx_tdpbsudGenericAdaptor<::mlir::ValueRange> { +public: + using x86_amx_tdpbsudGenericAdaptor::x86_amx_tdpbsudGenericAdaptor; + x86_amx_tdpbsudAdaptor(x86_amx_tdpbsud op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class x86_amx_tdpbsud : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = x86_amx_tdpbsudAdaptor; + template + using GenericAdaptor = x86_amx_tdpbsudGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tdpbsud"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbsud) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbusd declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class x86_amx_tdpbusdGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + x86_amx_tdpbusdGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + x86_amx_tdpbusdGenericAdaptorBase(x86_amx_tdpbusd op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class x86_amx_tdpbusdGenericAdaptor : public detail::x86_amx_tdpbusdGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::x86_amx_tdpbusdGenericAdaptorBase; +public: + x86_amx_tdpbusdGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + x86_amx_tdpbusdGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : x86_amx_tdpbusdGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + x86_amx_tdpbusdGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class x86_amx_tdpbusdAdaptor : public x86_amx_tdpbusdGenericAdaptor<::mlir::ValueRange> { +public: + using x86_amx_tdpbusdGenericAdaptor::x86_amx_tdpbusdGenericAdaptor; + x86_amx_tdpbusdAdaptor(x86_amx_tdpbusd op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class x86_amx_tdpbusd : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = x86_amx_tdpbusdAdaptor; + template + using GenericAdaptor = x86_amx_tdpbusdGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tdpbusd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbusd) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tdpbuud declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class x86_amx_tdpbuudGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + x86_amx_tdpbuudGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + x86_amx_tdpbuudGenericAdaptorBase(x86_amx_tdpbuud op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class x86_amx_tdpbuudGenericAdaptor : public detail::x86_amx_tdpbuudGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::x86_amx_tdpbuudGenericAdaptorBase; +public: + x86_amx_tdpbuudGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + x86_amx_tdpbuudGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : x86_amx_tdpbuudGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + x86_amx_tdpbuudGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class x86_amx_tdpbuudAdaptor : public x86_amx_tdpbuudGenericAdaptor<::mlir::ValueRange> { +public: + using x86_amx_tdpbuudGenericAdaptor::x86_amx_tdpbuudGenericAdaptor; + x86_amx_tdpbuudAdaptor(x86_amx_tdpbuud op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class x86_amx_tdpbuud : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = x86_amx_tdpbuudAdaptor; + template + using GenericAdaptor = x86_amx_tdpbuudGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tdpbuud"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4, ::mlir::Value odsArg_5); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tdpbuud) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tileloadd64 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class x86_amx_tileloadd64GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + x86_amx_tileloadd64GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + x86_amx_tileloadd64GenericAdaptorBase(x86_amx_tileloadd64 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class x86_amx_tileloadd64GenericAdaptor : public detail::x86_amx_tileloadd64GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::x86_amx_tileloadd64GenericAdaptorBase; +public: + x86_amx_tileloadd64GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + x86_amx_tileloadd64GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : x86_amx_tileloadd64GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + x86_amx_tileloadd64GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class x86_amx_tileloadd64Adaptor : public x86_amx_tileloadd64GenericAdaptor<::mlir::ValueRange> { +public: + using x86_amx_tileloadd64GenericAdaptor::x86_amx_tileloadd64GenericAdaptor; + x86_amx_tileloadd64Adaptor(x86_amx_tileloadd64 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class x86_amx_tileloadd64 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = x86_amx_tileloadd64Adaptor; + template + using GenericAdaptor = x86_amx_tileloadd64GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tileloadd64"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tileloadd64) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tilestored64 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class x86_amx_tilestored64GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + x86_amx_tilestored64GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + x86_amx_tilestored64GenericAdaptorBase(x86_amx_tilestored64 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class x86_amx_tilestored64GenericAdaptor : public detail::x86_amx_tilestored64GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::x86_amx_tilestored64GenericAdaptorBase; +public: + x86_amx_tilestored64GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + x86_amx_tilestored64GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : x86_amx_tilestored64GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + x86_amx_tilestored64GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class x86_amx_tilestored64Adaptor : public x86_amx_tilestored64GenericAdaptor<::mlir::ValueRange> { +public: + using x86_amx_tilestored64GenericAdaptor::x86_amx_tilestored64GenericAdaptor; + x86_amx_tilestored64Adaptor(x86_amx_tilestored64 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class x86_amx_tilestored64 : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = x86_amx_tilestored64Adaptor; + template + using GenericAdaptor = x86_amx_tilestored64GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tilestored64"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tilestored64) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::x86_amx_tilezero declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class x86_amx_tilezeroGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + x86_amx_tilezeroGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + x86_amx_tilezeroGenericAdaptorBase(x86_amx_tilezero op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class x86_amx_tilezeroGenericAdaptor : public detail::x86_amx_tilezeroGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::x86_amx_tilezeroGenericAdaptorBase; +public: + x86_amx_tilezeroGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + x86_amx_tilezeroGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : x86_amx_tilezeroGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + x86_amx_tilezeroGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class x86_amx_tilezeroAdaptor : public x86_amx_tilezeroGenericAdaptor<::mlir::ValueRange> { +public: + using x86_amx_tilezeroGenericAdaptor::x86_amx_tilezeroGenericAdaptor; + x86_amx_tilezeroAdaptor(x86_amx_tilezero op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class x86_amx_tilezero : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = x86_amx_tilezeroAdaptor; + template + using GenericAdaptor = x86_amx_tilezeroGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tilezero"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::x86_amx_tilezero) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TileLoadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TileLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TileLoadOpGenericAdaptorBase(TileLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TileLoadOpGenericAdaptor : public detail::TileLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TileLoadOpGenericAdaptorBase; +public: + TileLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TileLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TileLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TileLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBase() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TileLoadOpAdaptor : public TileLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using TileLoadOpGenericAdaptor::TileLoadOpGenericAdaptor; + TileLoadOpAdaptor(TileLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TileLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TileLoadOpAdaptor; + template + using GenericAdaptor = TileLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tile_load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getBase(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getBaseMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value base, ::mlir::ValueRange indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + MemRefType getMemRefType() { + return ::llvm::cast(getBase().getType()); + } + VectorType getVectorType() { + return ::llvm::cast(getRes().getType()); + } +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::TileLoadOp) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileMulFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TileMulFOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TileMulFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TileMulFOpGenericAdaptorBase(TileMulFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TileMulFOpGenericAdaptor : public detail::TileMulFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TileMulFOpGenericAdaptorBase; +public: + TileMulFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TileMulFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TileMulFOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TileMulFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getAcc() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TileMulFOpAdaptor : public TileMulFOpGenericAdaptor<::mlir::ValueRange> { +public: + using TileMulFOpGenericAdaptor::TileMulFOpGenericAdaptor; + TileMulFOpAdaptor(TileMulFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TileMulFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TileMulFOpAdaptor; + template + using GenericAdaptor = TileMulFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tile_mulf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getLhs(); + ::mlir::TypedValue<::mlir::VectorType> getRhs(); + ::mlir::TypedValue<::mlir::VectorType> getAcc(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getAccMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + VectorType getLhsVectorType() { + return ::llvm::cast(getLhs().getType()); + } + VectorType getRhsVectorType() { + return ::llvm::cast(getRhs().getType()); + } + VectorType getVectorType() { + return ::llvm::cast(getRes().getType()); + } +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::TileMulFOp) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileMulIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TileMulIOpGenericAdaptorBase { +public: + struct Properties { + using isZextLhsTy = ::mlir::UnitAttr; + isZextLhsTy isZextLhs; + + auto getIsZextLhs() { + auto &propStorage = this->isZextLhs; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setIsZextLhs(const ::mlir::UnitAttr &propValue) { + this->isZextLhs = propValue; + } + using isZextRhsTy = ::mlir::UnitAttr; + isZextRhsTy isZextRhs; + + auto getIsZextRhs() { + auto &propStorage = this->isZextRhs; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setIsZextRhs(const ::mlir::UnitAttr &propValue) { + this->isZextRhs = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.isZextLhs == this->isZextLhs && + rhs.isZextRhs == this->isZextRhs && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TileMulIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TileMulIOpGenericAdaptorBase(TileMulIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getIsZextLhsAttr(); + bool getIsZextLhs(); + ::mlir::UnitAttr getIsZextRhsAttr(); + bool getIsZextRhs(); +}; +} // namespace detail +template +class TileMulIOpGenericAdaptor : public detail::TileMulIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TileMulIOpGenericAdaptorBase; +public: + TileMulIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TileMulIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TileMulIOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TileMulIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getAcc() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TileMulIOpAdaptor : public TileMulIOpGenericAdaptor<::mlir::ValueRange> { +public: + using TileMulIOpGenericAdaptor::TileMulIOpGenericAdaptor; + TileMulIOpAdaptor(TileMulIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TileMulIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TileMulIOpAdaptor; + template + using GenericAdaptor = TileMulIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("isZextLhs"), ::llvm::StringRef("isZextRhs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsZextLhsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsZextLhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsZextRhsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsZextRhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tile_muli"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getLhs(); + ::mlir::TypedValue<::mlir::VectorType> getRhs(); + ::mlir::TypedValue<::mlir::VectorType> getAcc(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getAccMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getIsZextLhsAttr(); + bool getIsZextLhs(); + ::mlir::UnitAttr getIsZextRhsAttr(); + bool getIsZextRhs(); + void setIsZextLhsAttr(::mlir::UnitAttr attr); + void setIsZextLhs(bool attrValue); + void setIsZextRhsAttr(::mlir::UnitAttr attr); + void setIsZextRhs(bool attrValue); + ::mlir::Attribute removeIsZextLhsAttr(); + ::mlir::Attribute removeIsZextRhsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc, /*optional*/::mlir::UnitAttr isZextLhs, /*optional*/::mlir::UnitAttr isZextRhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc, /*optional*/::mlir::UnitAttr isZextLhs, /*optional*/::mlir::UnitAttr isZextRhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc, /*optional*/bool isZextLhs = false, /*optional*/bool isZextRhs = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value acc, /*optional*/bool isZextLhs = false, /*optional*/bool isZextRhs = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + VectorType getLhsVectorType() { + return ::llvm::cast(getLhs().getType()); + } + VectorType getRhsVectorType() { + return ::llvm::cast(getRhs().getType()); + } + VectorType getVectorType() { + return ::llvm::cast(getRes().getType()); + } +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::TileMulIOp) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TileStoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TileStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TileStoreOpGenericAdaptorBase(TileStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TileStoreOpGenericAdaptor : public detail::TileStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TileStoreOpGenericAdaptorBase; +public: + TileStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TileStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TileStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TileStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBase() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + ValueT getVal() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TileStoreOpAdaptor : public TileStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using TileStoreOpGenericAdaptor::TileStoreOpGenericAdaptor; + TileStoreOpAdaptor(TileStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TileStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TileStoreOpAdaptor; + template + using GenericAdaptor = TileStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tile_store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getBase(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::TypedValue<::mlir::VectorType> getVal(); + ::mlir::OpOperand &getBaseMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::OpOperand &getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + MemRefType getMemRefType() { + return ::llvm::cast(getBase().getType()); + } + VectorType getVectorType() { + return ::llvm::cast(getVal().getType()); + } +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::TileStoreOp) + +namespace mlir { +namespace amx { + +//===----------------------------------------------------------------------===// +// ::mlir::amx::TileZeroOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TileZeroOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TileZeroOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TileZeroOpGenericAdaptorBase(TileZeroOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TileZeroOpGenericAdaptor : public detail::TileZeroOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TileZeroOpGenericAdaptorBase; +public: + TileZeroOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TileZeroOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TileZeroOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TileZeroOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TileZeroOpAdaptor : public TileZeroOpGenericAdaptor<::mlir::ValueRange> { +public: + using TileZeroOpGenericAdaptor::TileZeroOpGenericAdaptor; + TileZeroOpAdaptor(TileZeroOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TileZeroOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TileZeroOpAdaptor; + template + using GenericAdaptor = TileZeroOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("amx.tile_zero"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + VectorType getVectorType() { + return ::llvm::cast(getRes().getType()); + } +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::TileZeroOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..ae63166a36167f8af86c05b35dc2a8415ce3711d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXConversions.inc @@ -0,0 +1,104 @@ +if (auto op = dyn_cast<::mlir::amx::x86_amx_tdpbf16ps>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::x86_tdpbf16ps_internal, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::amx::x86_amx_tdpbssd>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::x86_tdpbssd_internal, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::amx::x86_amx_tdpbsud>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::x86_tdpbsud_internal, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::amx::x86_amx_tdpbusd>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::x86_tdpbusd_internal, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::amx::x86_amx_tdpbuud>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::x86_tdpbuud_internal, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::amx::x86_amx_tileloadd64>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::x86_tileloadd64_internal, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::amx::x86_amx_tilestored64>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::x86_tilestored64_internal, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::amx::x86_amx_tilezero>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::x86_tilezero_internal, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..704a1c236d5de22c712f6331c8c1e5d5e5158427 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMX.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amx::AMXDialect) +namespace mlir { +namespace amx { + +AMXDialect::AMXDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +AMXDialect::~AMXDialect() = default; + +} // namespace amx +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..47c92479814dea8c13d088cea77e2ce2a7041f2e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXDialect.h @@ -0,0 +1,27 @@ +//===- AMXDialect.h - MLIR Dialect for AMX ----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares the Target dialect for AMX in MLIR. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AMX_AMXDIALECT_H_ +#define MLIR_DIALECT_AMX_AMXDIALECT_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#include "mlir/Dialect/AMX/AMXDialect.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/AMX/AMX.h.inc" + +#endif // MLIR_DIALECT_AMX_AMXDIALECT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..0528abde330ebeb45794f3b3779d9d737d6c7fe6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/AMXDialect.h.inc @@ -0,0 +1,26 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AMX.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace amx { + +class AMXDialect : public ::mlir::Dialect { + explicit AMXDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~AMXDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("amx"); + } +}; +} // namespace amx +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::amx::AMXDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/Transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/Transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..19608dff6f160fb88086b31e05bd74a9385c10f2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/AMX/Transforms.h @@ -0,0 +1,29 @@ +//===- Transforms.h - AMX Dialect Transformation Entrypoints ----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AMX_TRANSFORMS_H +#define MLIR_DIALECT_AMX_TRANSFORMS_H + +namespace mlir { + +class LLVMConversionTarget; +class LLVMTypeConverter; +class RewritePatternSet; + +/// Collect a set of patterns to lower AMX ops to ops that map to LLVM +/// intrinsics. +void populateAMXLegalizeForLLVMExportPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +/// Configure the target to support lowering AMX ops to ops that map to LLVM +/// intrinsics. +void configureAMXLegalizeForExportTarget(LLVMConversionTarget &target); + +} // namespace mlir + +#endif // MLIR_DIALECT_AMX_TRANSFORMS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..a27583877b603ce3ddc38dc6d56176880f7e436c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h @@ -0,0 +1,198 @@ +//===- AffineAnalysis.h - analyses for affine structures --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes for methods that perform analysis +// involving affine structures (AffineExprStorage, AffineMap, IntegerSet, etc.) +// and other IR structures that in turn use these. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H +#define MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H + +#include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/IR/Value.h" +#include "llvm/ADT/SmallVector.h" +#include + +namespace mlir { +class Operation; + +namespace affine { +class AffineApplyOp; +class AffineForOp; +class AffineValueMap; +class FlatAffineRelation; +class FlatAffineValueConstraints; + +/// A description of a (parallelizable) reduction in an affine loop. +struct LoopReduction { + /// Reduction kind. + arith::AtomicRMWKind kind; + + /// Position of the iteration argument that acts as accumulator. + unsigned iterArgPosition; + + /// The value being reduced. + Value value; +}; + +/// Populate `supportedReductions` with descriptors of the supported reductions. +void getSupportedReductions( + AffineForOp forOp, SmallVectorImpl &supportedReductions); + +/// Returns true if `forOp' is a parallel loop. If `parallelReductions` is +/// provided, populates it with descriptors of the parallelizable reductions and +/// treats them as not preventing parallelization. +bool isLoopParallel( + AffineForOp forOp, + SmallVectorImpl *parallelReductions = nullptr); + +/// Returns true if `forOp' doesn't have memory dependences preventing +/// parallelization. Memrefs that are allocated inside `forOp` do not impact its +/// dependences and parallelism. This function does not check iter_args (for +/// values other than memref types) and should be used only as a building block +/// for complete parallelism-checking functions. +bool isLoopMemoryParallel(AffineForOp forOp); + +/// Returns in `affineApplyOps`, the sequence of those AffineApplyOp +/// Operations that are reachable via a search starting from `operands` and +/// ending at those operands that are not the result of an AffineApplyOp. +void getReachableAffineApplyOps(ArrayRef operands, + SmallVectorImpl &affineApplyOps); + +/// Builds a system of constraints with dimensional variables corresponding to +/// the loop IVs of the forOps and AffineIfOp's operands appearing in +/// that order. Bounds of the loop are used to add appropriate inequalities. +/// Constraints from the index sets of AffineIfOp are also added. Any symbols +/// founds in the bound operands are added as symbols in the system. Returns +/// failure for the yet unimplemented cases. `ops` accepts both AffineForOp and +/// AffineIfOp. +// TODO: handle non-unit strides. +LogicalResult getIndexSet(MutableArrayRef ops, + FlatAffineValueConstraints *domain); + +/// Encapsulates a memref load or store access information. +struct MemRefAccess { + Value memref; + Operation *opInst; + SmallVector indices; + + /// Constructs a MemRefAccess from a load or store operation. + // TODO: add accessors to standard op's load, store, DMA op's to return + // MemRefAccess, i.e., loadOp->getAccess(), dmaOp->getRead/WriteAccess. + explicit MemRefAccess(Operation *opInst); + + // Returns the rank of the memref associated with this access. + unsigned getRank() const; + // Returns true if this access is of a store op. + bool isStore() const; + + /// Creates an access relation for the access. An access relation maps + /// elements of an iteration domain to the element(s) of an array domain + /// accessed by that iteration of the associated statement through some array + /// reference. For example, given the MLIR code: + /// + /// affine.for %i0 = 0 to 10 { + /// affine.for %i1 = 0 to 10 { + /// %a = affine.load %arr[%i0 + %i1, %i0 + 2 * %i1] : memref<100x100xf32> + /// } + /// } + /// + /// The access relation, assuming that the memory locations for %arr are + /// represented as %m0, %m1 would be: + /// + /// (%i0, %i1) -> (%m0, %m1) + /// %m0 = %i0 + %i1 + /// %m1 = %i0 + 2 * %i1 + /// 0 <= %i0 < 10 + /// 0 <= %i1 < 10 + /// + /// Returns failure for yet unimplemented/unsupported cases (see docs of + /// mlir::getIndexSet and mlir::getRelationFromMap for these cases). + LogicalResult getAccessRelation(FlatAffineRelation &accessRel) const; + + /// Populates 'accessMap' with composition of AffineApplyOps reachable from + /// 'indices'. + void getAccessMap(AffineValueMap *accessMap) const; + + /// Equal if both affine accesses can be proved to be equivalent at compile + /// time (considering the memrefs, their respective affine access maps and + /// operands). The equality of access functions + operands is checked by + /// subtracting fully composed value maps, and then simplifying the difference + /// using the expression flattener. + /// TODO: this does not account for aliasing of memrefs. + bool operator==(const MemRefAccess &rhs) const; + bool operator!=(const MemRefAccess &rhs) const { return !(*this == rhs); } +}; + +// DependenceComponent contains state about the direction of a dependence as an +// interval [lb, ub] for an AffineForOp. +// Distance vectors components are represented by the interval [lb, ub] with +// lb == ub. +// Direction vectors components are represented by the interval [lb, ub] with +// lb < ub. Note that ub/lb == None means unbounded. +struct DependenceComponent { + // The AffineForOp Operation associated with this dependence component. + Operation *op = nullptr; + // The lower bound of the dependence distance. + std::optional lb; + // The upper bound of the dependence distance (inclusive). + std::optional ub; + DependenceComponent() : lb(std::nullopt), ub(std::nullopt) {} +}; + +/// Checks whether two accesses to the same memref access the same element. +/// Each access is specified using the MemRefAccess structure, which contains +/// the operation, indices and memref associated with the access. Returns +/// 'NoDependence' if it can be determined conclusively that the accesses do not +/// access the same memref element. If 'allowRAR' is true, will consider +/// read-after-read dependences (typically used by applications trying to +/// optimize input reuse). +// TODO: Wrap 'dependenceConstraints' and 'dependenceComponents' into a single +// struct. +// TODO: Make 'dependenceConstraints' optional arg. +struct DependenceResult { + enum ResultEnum { + HasDependence, // A dependence exists between 'srcAccess' and 'dstAccess'. + NoDependence, // No dependence exists between 'srcAccess' and 'dstAccess'. + Failure, // Dependence check failed due to unsupported cases. + } value; + DependenceResult(ResultEnum v) : value(v) {} +}; + +DependenceResult checkMemrefAccessDependence( + const MemRefAccess &srcAccess, const MemRefAccess &dstAccess, + unsigned loopDepth, + FlatAffineValueConstraints *dependenceConstraints = nullptr, + SmallVector *dependenceComponents = nullptr, + bool allowRAR = false); + +/// Utility function that returns true if the provided DependenceResult +/// corresponds to a dependence result. +inline bool hasDependence(DependenceResult result) { + return result.value == DependenceResult::HasDependence; +} + +/// Returns true if the provided DependenceResult corresponds to the absence of +/// a dependence. +inline bool noDependence(DependenceResult result) { + return result.value == DependenceResult::NoDependence; +} + +/// Returns in 'depCompsVec', dependence components for dependences between all +/// load and store ops in loop nest rooted at 'forOp', at loop depths in range +/// [1, maxLoopDepth]. +void getDependenceComponents( + AffineForOp forOp, unsigned maxLoopDepth, + std::vector> *depCompsVec); + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h new file mode 100644 index 0000000000000000000000000000000000000000..7c500f13895af146cc3f686f52f05d626cc3c7bb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h @@ -0,0 +1,261 @@ +//===- AffineStructures.h - MLIR Affine Structures Class --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Structures for affine/polyhedral analysis of ML functions. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_AFFINESTRUCTURES_H +#define MLIR_DIALECT_AFFINE_ANALYSIS_AFFINESTRUCTURES_H + +#include "mlir/Analysis/FlatLinearValueConstraints.h" +#include "mlir/Analysis/Presburger/IntegerRelation.h" +#include "mlir/Analysis/Presburger/Matrix.h" +#include "mlir/IR/AffineExpr.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Support/LogicalResult.h" +#include + +namespace mlir { +class AffineMap; +class IntegerSet; +class MemRefType; +class MLIRContext; +struct MutableAffineMap; +class Value; + +namespace presburger { +class MultiAffineFunction; +} // namespace presburger + +namespace affine { +class AffineCondition; +class AffineForOp; +class AffineIfOp; +class AffineParallelOp; +class AffineValueMap; + +/// FlatAffineValueConstraints is an extension of FlatLinearValueConstraints +/// with helper functions for Affine dialect ops. +class FlatAffineValueConstraints : public FlatLinearValueConstraints { +public: + using FlatLinearValueConstraints::FlatLinearValueConstraints; + + /// Return the kind of this object. + Kind getKind() const override { return Kind::FlatAffineValueConstraints; } + + static bool classof(const IntegerRelation *cst) { + return cst->getKind() >= Kind::FlatAffineValueConstraints && + cst->getKind() <= Kind::FlatAffineRelation; + } + + /// Adds constraints (lower and upper bounds) for the specified 'affine.for' + /// operation's Value using IR information stored in its bound maps. The + /// right variable is first looked up using `forOp`'s Value. Asserts if the + /// Value corresponding to the 'affine.for' operation isn't found in the + /// constraint system. Returns failure for the yet unimplemented/unsupported + /// cases. Any new variables that are found in the bound operands of the + /// 'affine.for' operation are added as trailing variables (either + /// dimensional or symbolic depending on whether the operand is a valid + /// symbol). + LogicalResult addAffineForOpDomain(AffineForOp forOp); + + /// Add constraints (lower and upper bounds) for the specified + /// 'affine.parallel' operation's Value using IR information stored in its + /// bound maps. Returns failure for the yet unimplemented/unsupported cases. + /// Asserts if the Value corresponding to the 'affine.parallel' operation + /// isn't found in the constraint system. + LogicalResult addAffineParallelOpDomain(AffineParallelOp parallelOp); + + /// Adds constraints (lower and upper bounds) for each loop in the loop nest + /// described by the bound maps `lbMaps` and `ubMaps` of a computation slice. + /// Every pair (`lbMaps[i]`, `ubMaps[i]`) describes the bounds of a loop in + /// the nest, sorted outer-to-inner. `operands` contains the bound operands + /// for a single bound map. All the bound maps will use the same bound + /// operands. Note that some loops described by a computation slice might not + /// exist yet in the IR so the Value attached to those dimension variables + /// might be empty. For that reason, this method doesn't perform Value + /// look-ups to retrieve the dimension variable positions. Instead, it + /// assumes the position of the dim variables in the constraint system is + /// the same as the position of the loop in the loop nest. + LogicalResult addDomainFromSliceMaps(ArrayRef lbMaps, + ArrayRef ubMaps, + ArrayRef operands); + + /// Adds constraints imposed by the `affine.if` operation. These constraints + /// are collected from the IntegerSet attached to the given `affine.if` + /// instance argument (`ifOp`). It is asserted that: + /// 1) The IntegerSet of the given `affine.if` instance should not contain + /// semi-affine expressions, + /// 2) The columns of the constraint system created from `ifOp` should match + /// the columns in the current one regarding numbers and values. + void addAffineIfOpDomain(AffineIfOp ifOp); + + /// Adds a bound for the variable at the specified position with constraints + /// being drawn from the specified bound map and operands. In case of an + /// EQ bound, the bound map is expected to have exactly one result. In case + /// of a LB/UB, the bound map may have more than one result, for each of which + /// an inequality is added. + LogicalResult addBound(presburger::BoundType type, unsigned pos, + AffineMap boundMap, ValueRange operands); + using FlatLinearValueConstraints::addBound; + + /// Add the specified values as a dim or symbol var depending on its nature, + /// if it already doesn't exist in the system. `val` has to be either a + /// terminal symbol or a loop IV, i.e., it cannot be the result affine.apply + /// of any symbols or loop IVs. The variable is added to the end of the + /// existing dims or symbols. Additional information on the variable is + /// extracted from the IR and added to the constraint system. + void addInductionVarOrTerminalSymbol(Value val); + + /// Adds slice lower bounds represented by lower bounds in `lbMaps` and upper + /// bounds in `ubMaps` to each variable in the constraint system which has + /// a value in `values`. Note that both lower/upper bounds share the same + /// operand list `operands`. + /// This function assumes `values.size` == `lbMaps.size` == `ubMaps.size`. + /// Note that both lower/upper bounds use operands from `operands`. + LogicalResult addSliceBounds(ArrayRef values, + ArrayRef lbMaps, + ArrayRef ubMaps, + ArrayRef operands); + + /// Changes all symbol variables which are loop IVs to dim variables. + void convertLoopIVSymbolsToDims(); + + /// Returns the bound for the variable at `pos` from the inequality at + /// `ineqPos` as a 1-d affine value map (affine map + operands). The returned + /// affine value map can either be a lower bound or an upper bound depending + /// on the sign of atIneq(ineqPos, pos). Asserts if the row at `ineqPos` does + /// not involve the `pos`th variable. + void getIneqAsAffineValueMap(unsigned pos, unsigned ineqPos, + AffineValueMap &vmap, + MLIRContext *context) const; + + /// Composes the affine value map with this FlatAffineValueConstrains, adding + /// the results of the map as dimensions at the front + /// [0, vMap->getNumResults()) and with the dimensions set to the equalities + /// specified by the value map. + /// + /// Returns failure if the composition fails (when vMap is a semi-affine map). + /// The vMap's operand Value's are used to look up the right positions in + /// the FlatAffineValueConstraints with which to associate. Every operand of + /// vMap should have a matching dim/symbol column in this constraint system + /// (with the same associated Value). + LogicalResult composeMap(const AffineValueMap *vMap); +}; + +/// A FlatAffineRelation represents a set of ordered pairs (domain -> range) +/// where "domain" and "range" are tuples of variables. The relation is +/// represented as a FlatAffineValueConstraints with separation of dimension +/// variables into domain and range. The variables are stored as: +/// [domainVars, rangeVars, symbolVars, localVars, constant]. +class FlatAffineRelation : public FlatAffineValueConstraints { +public: + FlatAffineRelation(unsigned numReservedInequalities, + unsigned numReservedEqualities, unsigned numReservedCols, + unsigned numDomainDims, unsigned numRangeDims, + unsigned numSymbols, unsigned numLocals, + ArrayRef> valArgs = {}) + : FlatAffineValueConstraints( + numReservedInequalities, numReservedEqualities, numReservedCols, + numDomainDims + numRangeDims, numSymbols, numLocals, valArgs), + numDomainDims(numDomainDims), numRangeDims(numRangeDims) {} + + FlatAffineRelation(unsigned numDomainDims = 0, unsigned numRangeDims = 0, + unsigned numSymbols = 0, unsigned numLocals = 0) + : FlatAffineValueConstraints(numDomainDims + numRangeDims, numSymbols, + numLocals), + numDomainDims(numDomainDims), numRangeDims(numRangeDims) {} + + FlatAffineRelation(unsigned numDomainDims, unsigned numRangeDims, + FlatAffineValueConstraints &fac) + : FlatAffineValueConstraints(fac), numDomainDims(numDomainDims), + numRangeDims(numRangeDims) {} + + FlatAffineRelation(unsigned numDomainDims, unsigned numRangeDims, + IntegerPolyhedron &fac) + : FlatAffineValueConstraints(fac), numDomainDims(numDomainDims), + numRangeDims(numRangeDims) {} + + /// Return the kind of this object. + Kind getKind() const override { return Kind::FlatAffineRelation; } + + static bool classof(const IntegerRelation *cst) { + return cst->getKind() == Kind::FlatAffineRelation; + } + + /// Returns a set corresponding to the domain/range of the affine relation. + FlatAffineValueConstraints getDomainSet() const; + FlatAffineValueConstraints getRangeSet() const; + + /// Returns the number of variables corresponding to domain/range of + /// relation. + inline unsigned getNumDomainDims() const { return numDomainDims; } + inline unsigned getNumRangeDims() const { return numRangeDims; } + + /// Given affine relation `other: (domainOther -> rangeOther)`, this operation + /// takes the composition of `other` on `this: (domainThis -> rangeThis)`. + /// The resulting relation represents tuples of the form: `domainOther -> + /// rangeThis`. + void compose(const FlatAffineRelation &other); + + /// Swap domain and range of the relation. + /// `(domain -> range)` is converted to `(range -> domain)`. + void inverse(); + + /// Insert `num` variables of the specified kind after the `pos` variable + /// of that kind. The coefficient columns corresponding to the added + /// variables are initialized to zero. + void insertDomainVar(unsigned pos, unsigned num = 1); + void insertRangeVar(unsigned pos, unsigned num = 1); + + /// Append `num` variables of the specified kind after the last variable + /// of that kind. The coefficient columns corresponding to the added + /// variables are initialized to zero. + void appendDomainVar(unsigned num = 1); + void appendRangeVar(unsigned num = 1); + + /// Removes variables in the column range [varStart, varLimit), and copies any + /// remaining valid data into place, updates member variables, and resizes + /// arrays as needed. + void removeVarRange(VarKind kind, unsigned varStart, + unsigned varLimit) override; + using IntegerRelation::removeVarRange; + +protected: + // Number of dimension variables corresponding to domain variables. + unsigned numDomainDims; + + // Number of dimension variables corresponding to range variables. + unsigned numRangeDims; +}; + +/// Builds a relation from the given AffineMap/AffineValueMap `map`, containing +/// all pairs of the form `operands -> result` that satisfy `map`. `rel` is set +/// to the relation built. For example, give the AffineMap: +/// +/// (d0, d1)[s0] -> (d0 + s0, d0 - s0) +/// +/// the resulting relation formed is: +/// +/// (d0, d1) -> (r1, r2) +/// [d0 d1 r1 r2 s0 const] +/// 1 0 -1 0 1 0 = 0 +/// 0 1 0 -1 -1 0 = 0 +/// +/// For AffineValueMap, the domain and symbols have Value set corresponding to +/// the Value in `map`. Returns failure if the AffineMap could not be flattened +/// (i.e., semi-affine is not yet handled). +LogicalResult getRelationFromMap(AffineMap &map, FlatAffineRelation &rel); +LogicalResult getRelationFromMap(const AffineValueMap &map, + FlatAffineRelation &rel); + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_ANALYSIS_AFFINESTRUCTURES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/LoopAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/LoopAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..92f3d5a2c4925b19b48b462d7e1620e7ae880a65 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/LoopAnalysis.h @@ -0,0 +1,90 @@ +//===- LoopAnalysis.h - loop analysis methods -------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes for methods to analyze loops. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_LOOPANALYSIS_H +#define MLIR_DIALECT_AFFINE_ANALYSIS_LOOPANALYSIS_H + +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/ArrayRef.h" +#include + +namespace mlir { +class AffineExpr; +class AffineMap; +class BlockArgument; +class MemRefType; +class Operation; +class Value; + +namespace affine { +class AffineForOp; +class NestedPattern; + +/// Returns the trip count of the loop as an affine map with its corresponding +/// operands if the latter is expressible as an affine expression, and nullptr +/// otherwise. This method always succeeds as long as the lower bound is not a +/// multi-result map. The trip count expression is simplified before returning. +/// This method only utilizes map composition to construct lower and upper +/// bounds before computing the trip count expressions +void getTripCountMapAndOperands(AffineForOp forOp, AffineMap *map, + SmallVectorImpl *operands); + +/// Returns the trip count of the loop if it's a constant, std::nullopt +/// otherwise. This uses affine expression analysis and is able to determine +/// constant trip count in non-trivial cases. +std::optional getConstantTripCount(AffineForOp forOp); + +/// Returns the greatest known integral divisor of the trip count. Affine +/// expression analysis is used (indirectly through getTripCount), and +/// this method is thus able to determine non-trivial divisors. +uint64_t getLargestDivisorOfTripCount(AffineForOp forOp); + +/// Given an induction variable `iv` of type AffineForOp and `indices` of type +/// IndexType, returns the set of `indices` that are independent of `iv`. +/// +/// Prerequisites (inherited from `isAccessInvariant` above): +/// 1. `iv` and `indices` of the proper type; +/// 2. at most one affine.apply is reachable from each index in `indices`; +/// +/// Emits a note if it encounters a chain of affine.apply and conservatively +/// those cases. +DenseSet> +getInvariantAccesses(Value iv, ArrayRef indices); + +using VectorizableLoopFun = std::function; + +/// Checks whether the loop is structurally vectorizable; i.e.: +/// 1. no conditionals are nested under the loop; +/// 2. all nested load/stores are to scalar MemRefs. +/// TODO: relax the no-conditionals restriction +bool isVectorizableLoopBody(AffineForOp loop, + NestedPattern &vectorTransferMatcher); + +/// Checks whether the loop is structurally vectorizable and that all the LoadOp +/// and StoreOp matched have access indexing functions that are either: +/// 1. invariant along the loop induction variable created by 'loop'; +/// 2. varying along at most one memory dimension. If such a unique dimension +/// is found, it is written into `memRefDim`. +bool isVectorizableLoopBody(AffineForOp loop, int *memRefDim, + NestedPattern &vectorTransferMatcher); + +/// Checks where SSA dominance would be violated if a for op's body +/// operations are shifted by the specified shifts. This method checks if a +/// 'def' and all its uses have the same shift factor. +// TODO: extend this to check for memory-based dependence violation when we have +// the support. +bool isOpwiseShiftValid(AffineForOp forOp, ArrayRef shifts); + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_ANALYSIS_LOOPANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/NestedMatcher.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/NestedMatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..108f86226646ab21d92e86ebe03d0a45895d21a2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/NestedMatcher.h @@ -0,0 +1,198 @@ +//===- NestedMacher.h - Nested matcher for Function -------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H +#define MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H + +#include "mlir/IR/BuiltinOps.h" +#include "mlir/IR/Operation.h" +#include "llvm/Support/Allocator.h" + +namespace mlir { +class Operation; + +namespace affine { +class NestedPattern; + +/// An NestedPattern captures nested patterns in the IR. +/// It is used in conjunction with a scoped NestedPatternContext which is an +/// llvm::BumpPtrAllocator that handles memory allocations efficiently and +/// avoids ownership issues. +/// +/// In order to use NestedPatterns, first create a scoped context. +/// When the context goes out of scope, everything is freed. +/// This design simplifies the API by avoiding references to the context and +/// makes it clear that references to matchers must not escape. +/// +/// Example: +/// { +/// NestedPatternContext context; +/// auto gemmLike = Doall(Doall(Red(LoadStores()))); +/// auto matches = gemmLike.match(f); +/// // do work on matches +/// } // everything is freed +/// +/// +/// Nested abstraction for matching results. +/// Provides access to the nested Operation* captured by a Matcher. +/// +/// A NestedMatch contains an Operation* and the children NestedMatch and is +/// thus cheap to copy. NestedMatch is stored in a scoped bumper allocator whose +/// lifetime is managed by an RAII NestedPatternContext. +class NestedMatch { +public: + static NestedMatch build(Operation *operation, + ArrayRef nestedMatches); + NestedMatch(const NestedMatch &) = default; + NestedMatch &operator=(const NestedMatch &) = default; + + explicit operator bool() { return matchedOperation != nullptr; } + + Operation *getMatchedOperation() const { return matchedOperation; } + ArrayRef getMatchedChildren() { return matchedChildren; } + +private: + friend class NestedPattern; + friend class NestedPatternContext; + + /// Underlying global bump allocator managed by a NestedPatternContext. + static llvm::BumpPtrAllocator *&allocator(); + + NestedMatch() = default; + + /// Payload, holds a NestedMatch and all its children along this branch. + Operation *matchedOperation = nullptr; + ArrayRef matchedChildren; +}; + +/// A NestedPattern is a nested operation walker that: +/// 1. recursively matches a substructure in the tree; +/// 2. uses a filter function to refine matches with extra semantic +/// constraints (passed via a lambda of type FilterFunctionType); +/// 3. TODO: optionally applies actions (lambda). +/// +/// Nested patterns are meant to capture imperfectly nested loops while matching +/// properties over the whole loop nest. For instance, in vectorization we are +/// interested in capturing all the imperfectly nested loops of a certain type +/// and such that all the load and stores have certain access patterns along the +/// loops' induction variables). Such NestedMatches are first captured using the +/// `match` function and are later processed to analyze properties and apply +/// transformations in a non-greedy way. +/// +/// The NestedMatches captured in the IR can grow large, especially after +/// aggressive unrolling. As experience has shown, it is generally better to use +/// a plain walk over operations to match flat patterns but the current +/// implementation is competitive nonetheless. +using FilterFunctionType = std::function; +inline bool defaultFilterFunction(Operation &) { return true; } +class NestedPattern { +public: + NestedPattern(ArrayRef nested, + FilterFunctionType filter = defaultFilterFunction); + NestedPattern(const NestedPattern &other); + NestedPattern &operator=(const NestedPattern &other); + + ~NestedPattern() { + // Call destructors manually, ArrayRef is non-owning so it wouldn't call + // them, but we should free the memory allocated by std::function outside of + // the arena allocator. + freeNested(); + } + + /// Returns all the top-level matches in `op`. + void match(Operation *op, SmallVectorImpl *matches) { + op->walk([&](Operation *child) { matchOne(child, matches); }); + } + + /// Returns the depth of the pattern. + unsigned getDepth() const; + +private: + friend class NestedPatternContext; + friend class NestedMatch; + friend struct State; + + /// Copies the list of nested patterns to the arena allocator associated with + /// this pattern. + void copyNestedToThis(ArrayRef nested); + + /// Calls destructors on nested patterns. + void freeNested(); + + /// Underlying global bump allocator managed by a NestedPatternContext. + static llvm::BumpPtrAllocator *&allocator(); + + /// Matches this pattern against a single `op` and fills matches with the + /// result. + void matchOne(Operation *op, SmallVectorImpl *matches); + + /// Nested patterns to be matched. + ArrayRef nestedPatterns; + + /// Extra filter function to apply to prune patterns as the IR is walked. + FilterFunctionType filter; + + /// skip is an implementation detail needed so that we can implement match + /// without switching on the type of the Operation. The idea is that a + /// NestedPattern first checks if it matches locally and then recursively + /// applies its nested matchers to its elem->nested. Since we want to rely on + /// the existing operation walking functionality rather than duplicate + /// it, we allow an off-by-one traversal to account for the fact that we + /// write: + /// + /// void match(Operation *elem) { + /// for (auto &c : getNestedPatterns()) { + /// NestedPattern childPattern(...); + /// ^~~~ Needs off-by-one skip. + /// + Operation *skip; +}; + +/// RAII structure to transparently manage the bump allocator for +/// NestedPattern and NestedMatch classes. This avoids passing a context to +/// all the API functions. +class NestedPatternContext { +public: + NestedPatternContext() { + assert(NestedMatch::allocator() == nullptr && + "Only a single NestedPatternContext is supported"); + assert(NestedPattern::allocator() == nullptr && + "Only a single NestedPatternContext is supported"); + NestedMatch::allocator() = &allocator; + NestedPattern::allocator() = &allocator; + } + ~NestedPatternContext() { + NestedMatch::allocator() = nullptr; + NestedPattern::allocator() = nullptr; + } + llvm::BumpPtrAllocator allocator; +}; + +namespace matcher { +// Syntactic sugar NestedPattern builder functions. +NestedPattern Op(FilterFunctionType filter = defaultFilterFunction); +NestedPattern If(const NestedPattern &child); +NestedPattern If(const FilterFunctionType &filter, const NestedPattern &child); +NestedPattern If(ArrayRef nested = {}); +NestedPattern If(const FilterFunctionType &filter, + ArrayRef nested = {}); +NestedPattern For(const NestedPattern &child); +NestedPattern For(const FilterFunctionType &filter, const NestedPattern &child); +NestedPattern For(ArrayRef nested = {}); +NestedPattern For(const FilterFunctionType &filter, + ArrayRef nested = {}); + +bool isParallelLoop(Operation &op); +bool isReductionLoop(Operation &op); +bool isLoadOrStore(Operation &op); + +} // namespace matcher +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h new file mode 100644 index 0000000000000000000000000000000000000000..7376d9b992a044228d67cef164b026c8b56a13f0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h @@ -0,0 +1,583 @@ +//===- Utils.h - General analysis utilities ---------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes for various transformation utilities for +// memref's and non-loop IR structures. These are not passes by themselves but +// are used either by passes, optimization sequences, or in turn by other +// transformation utilities. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_UTILS_H +#define MLIR_DIALECT_AFFINE_ANALYSIS_UTILS_H + +#include "mlir/Dialect/Affine/Analysis/AffineStructures.h" +#include "mlir/Dialect/Affine/IR/AffineOps.h" +#include +#include + +namespace mlir { +class Block; +class Location; +class Operation; +class Value; + +namespace affine { +class AffineForOp; +class AffineValueMap; +struct MemRefAccess; + +// LoopNestStateCollector walks loop nests and collects load and store +// operations, and whether or not a region holding op other than ForOp and IfOp +// was encountered in the loop nest. +struct LoopNestStateCollector { + SmallVector forOps; + SmallVector loadOpInsts; + SmallVector storeOpInsts; + bool hasNonAffineRegionOp = false; + + // Collects load and store operations, and whether or not a region holding op + // other than ForOp and IfOp was encountered in the loop nest. + void collect(Operation *opToWalk); +}; + +// MemRefDependenceGraph is a graph data structure where graph nodes are +// top-level operations in a `Block` which contain load/store ops, and edges +// are memref dependences between the nodes. +// TODO: Add a more flexible dependence graph representation. +// TODO: Add a depth parameter to dependence graph construction. +struct MemRefDependenceGraph { +public: + // Node represents a node in the graph. A Node is either an entire loop nest + // rooted at the top level which contains loads/stores, or a top level + // load/store. + struct Node { + // The unique identifier of this node in the graph. + unsigned id; + // The top-level statement which is (or contains) a load/store. + Operation *op; + // List of load operations. + SmallVector loads; + // List of store op insts. + SmallVector stores; + + Node(unsigned id, Operation *op) : id(id), op(op) {} + + // Returns the load op count for 'memref'. + unsigned getLoadOpCount(Value memref) const; + + // Returns the store op count for 'memref'. + unsigned getStoreOpCount(Value memref) const; + + // Returns all store ops in 'storeOps' which access 'memref'. + void getStoreOpsForMemref(Value memref, + SmallVectorImpl *storeOps) const; + + // Returns all load ops in 'loadOps' which access 'memref'. + void getLoadOpsForMemref(Value memref, + SmallVectorImpl *loadOps) const; + + // Returns all memrefs in 'loadAndStoreMemrefSet' for which this node + // has at least one load and store operation. + void getLoadAndStoreMemrefSet(DenseSet *loadAndStoreMemrefSet) const; + }; + + // Edge represents a data dependence between nodes in the graph. + struct Edge { + // The id of the node at the other end of the edge. + // If this edge is stored in Edge = Node.inEdges[i], then + // 'Node.inEdges[i].id' is the identifier of the source node of the edge. + // If this edge is stored in Edge = Node.outEdges[i], then + // 'Node.outEdges[i].id' is the identifier of the dest node of the edge. + unsigned id; + // The SSA value on which this edge represents a dependence. + // If the value is a memref, then the dependence is between graph nodes + // which contain accesses to the same memref 'value'. If the value is a + // non-memref value, then the dependence is between a graph node which + // defines an SSA value and another graph node which uses the SSA value + // (e.g. a constant or load operation defining a value which is used inside + // a loop nest). + Value value; + }; + + // Map from node id to Node. + DenseMap nodes; + // Map from node id to list of input edges. + DenseMap> inEdges; + // Map from node id to list of output edges. + DenseMap> outEdges; + // Map from memref to a count on the dependence edges associated with that + // memref. + DenseMap memrefEdgeCount; + // The next unique identifier to use for newly created graph nodes. + unsigned nextNodeId = 0; + + MemRefDependenceGraph(Block &block) : block(block) {} + + // Initializes the dependence graph based on operations in `block'. + // Returns true on success, false otherwise. + bool init(); + + // Returns the graph node for 'id'. + Node *getNode(unsigned id); + + // Returns the graph node for 'forOp'. + Node *getForOpNode(AffineForOp forOp); + + // Adds a node with 'op' to the graph and returns its unique identifier. + unsigned addNode(Operation *op); + + // Remove node 'id' (and its associated edges) from graph. + void removeNode(unsigned id); + + // Returns true if node 'id' writes to any memref which escapes (or is an + // argument to) the block. Returns false otherwise. + bool writesToLiveInOrEscapingMemrefs(unsigned id); + + // Returns true iff there is an edge from node 'srcId' to node 'dstId' which + // is for 'value' if non-null, or for any value otherwise. Returns false + // otherwise. + bool hasEdge(unsigned srcId, unsigned dstId, Value value = nullptr); + + // Adds an edge from node 'srcId' to node 'dstId' for 'value'. + void addEdge(unsigned srcId, unsigned dstId, Value value); + + // Removes an edge from node 'srcId' to node 'dstId' for 'value'. + void removeEdge(unsigned srcId, unsigned dstId, Value value); + + // Returns true if there is a path in the dependence graph from node 'srcId' + // to node 'dstId'. Returns false otherwise. `srcId`, `dstId`, and the + // operations that the edges connected are expected to be from the same block. + bool hasDependencePath(unsigned srcId, unsigned dstId); + + // Returns the input edge count for node 'id' and 'memref' from src nodes + // which access 'memref' with a store operation. + unsigned getIncomingMemRefAccesses(unsigned id, Value memref); + + // Returns the output edge count for node 'id' and 'memref' (if non-null), + // otherwise returns the total output edge count from node 'id'. + unsigned getOutEdgeCount(unsigned id, Value memref = nullptr); + + /// Return all nodes which define SSA values used in node 'id'. + void gatherDefiningNodes(unsigned id, DenseSet &definingNodes); + + // Computes and returns an insertion point operation, before which the + // the fused loop nest can be inserted while preserving + // dependences. Returns nullptr if no such insertion point is found. + Operation *getFusedLoopNestInsertionPoint(unsigned srcId, unsigned dstId); + + // Updates edge mappings from node 'srcId' to node 'dstId' after fusing them, + // taking into account that: + // *) if 'removeSrcId' is true, 'srcId' will be removed after fusion, + // *) memrefs in 'privateMemRefs' has been replaced in node at 'dstId' by a + // private memref. + void updateEdges(unsigned srcId, unsigned dstId, + const DenseSet &privateMemRefs, bool removeSrcId); + + // Update edge mappings for nodes 'sibId' and 'dstId' to reflect fusion + // of sibling node 'sibId' into node 'dstId'. + void updateEdges(unsigned sibId, unsigned dstId); + + // Adds ops in 'loads' and 'stores' to node at 'id'. + void addToNode(unsigned id, const SmallVectorImpl &loads, + const SmallVectorImpl &stores); + + void clearNodeLoadAndStores(unsigned id); + + // Calls 'callback' for each input edge incident to node 'id' which carries a + // memref dependence. + void forEachMemRefInputEdge(unsigned id, + const std::function &callback); + + // Calls 'callback' for each output edge from node 'id' which carries a + // memref dependence. + void forEachMemRefOutputEdge(unsigned id, + const std::function &callback); + + // Calls 'callback' for each edge in 'edges' which carries a memref + // dependence. + void forEachMemRefEdge(ArrayRef edges, + const std::function &callback); + + void print(raw_ostream &os) const; + + void dump() const { print(llvm::errs()); } + + /// The block for which this graph is created to perform fusion. + Block █ +}; + +/// Populates 'loops' with IVs of the affine.for ops surrounding 'op' ordered +/// from the outermost 'affine.for' operation to the innermost one. +void getAffineForIVs(Operation &op, SmallVectorImpl *loops); + +/// Populates 'ivs' with IVs of the surrounding affine.for and affine.parallel +/// ops ordered from the outermost one to the innermost. +void getAffineIVs(Operation &op, SmallVectorImpl &ivs); + +/// Populates 'ops' with affine operations enclosing `op` ordered from outermost +/// to innermost. affine.for, affine.if, or affine.parallel ops comprise such +/// surrounding affine ops. +/// TODO: Change this to return a list of enclosing ops up until the op that +/// starts an `AffineScope`. In such a case, `ops` is guaranteed by design to +/// have a successive chain of affine parent ops, and this is primarily what is +/// needed for most analyses. +void getEnclosingAffineOps(Operation &op, SmallVectorImpl *ops); + +/// Returns the nesting depth of this operation, i.e., the number of loops +/// surrounding this operation. +unsigned getNestingDepth(Operation *op); + +/// Returns whether a loop is a parallel loop and contains a reduction loop. +bool isLoopParallelAndContainsReduction(AffineForOp forOp); + +/// Returns in 'sequentialLoops' all sequential loops in loop nest rooted +/// at 'forOp'. +void getSequentialLoops(AffineForOp forOp, + llvm::SmallDenseSet *sequentialLoops); + +/// Enumerates different result statuses of slice computation by +/// `computeSliceUnion` +// TODO: Identify and add different kinds of failures during slice computation. +struct SliceComputationResult { + enum ResultEnum { + Success, + IncorrectSliceFailure, // Slice is computed, but it is incorrect. + GenericFailure, // Unable to compute src loop computation slice. + } value; + SliceComputationResult(ResultEnum v) : value(v) {} +}; + +/// ComputationSliceState aggregates loop IVs, loop bound AffineMaps and their +/// associated operands for a set of loops within a loop nest (typically the +/// set of loops surrounding a store operation). Loop bound AffineMaps which +/// are non-null represent slices of that loop's iteration space. +struct ComputationSliceState { + // List of sliced loop IVs (ordered from outermost to innermost). + // EX: 'ivs[i]' has lower bound 'lbs[i]' and upper bound 'ubs[i]'. + SmallVector ivs; + // List of lower bound AffineMaps. + SmallVector lbs; + // List of upper bound AffineMaps. + SmallVector ubs; + // List of lower bound operands (lbOperands[i] are used by 'lbs[i]'). + std::vector> lbOperands; + // List of upper bound operands (ubOperands[i] are used by 'ubs[i]'). + std::vector> ubOperands; + // Slice loop nest insertion point in target loop nest. + Block::iterator insertPoint; + // Adds to 'cst' with constraints which represent the slice bounds on 'ivs' + // in 'this'. Specifically, the values in 'ivs' are added to 'cst' as dim + // variables and the values in 'lb/ubOperands' are added as symbols. + // Constraints are added for all loop IV bounds (dim or symbol), and + // constraints are added for slice bounds in 'lbs'/'ubs'. + // Returns failure if we cannot add loop bounds because of unsupported cases. + LogicalResult getAsConstraints(FlatAffineValueConstraints *cst) const; + + /// Adds to 'cst' constraints which represent the original loop bounds on + /// 'ivs' in 'this'. This corresponds to the original domain of the loop nest + /// from which the slice is being computed. Returns failure if we cannot add + /// loop bounds because of unsupported cases. + LogicalResult getSourceAsConstraints(FlatAffineValueConstraints &cst) const; + + // Clears all bounds and operands in slice state. + void clearBounds(); + + /// Returns true if the computation slice is empty. + bool isEmpty() const { return ivs.empty(); } + + /// Returns true if the computation slice encloses all the iterations of the + /// sliced loop nest. Returns false if it does not. Returns std::nullopt if it + /// cannot determine if the slice is maximal or not. + // TODO: Cache 'isMaximal' so that we don't recompute it when the slice + // information hasn't changed. + std::optional isMaximal() const; + + /// Checks the validity of the slice computed. This is done using the + /// following steps: + /// 1. Get the new domain of the slice that would be created if fusion + /// succeeds. This domain gets constructed with source loop IVS and + /// destination loop IVS as dimensions. + /// 2. Project out the dimensions of the destination loop from the domain + /// above calculated in step(1) to express it purely in terms of the source + /// loop IVs. + /// 3. Calculate a set difference between the iterations of the new domain and + /// the original domain of the source loop. + /// If this difference is empty, the slice is declared to be valid. Otherwise, + /// return false as it implies that the effective fusion results in at least + /// one iteration of the slice that was not originally in the source's domain. + /// If the validity cannot be determined, returns std::nullopt. + std::optional isSliceValid() const; + + void dump() const; + +private: + /// Fast check to determine if the computation slice is maximal. Returns true + /// if each slice dimension maps to an existing dst dimension and both the src + /// and the dst loops for those dimensions have the same bounds. Returns false + /// if both the src and the dst loops don't have the same bounds. Returns + /// std::nullopt if none of the above can be proven. + std::optional isSliceMaximalFastCheck() const; +}; + +/// Computes the computation slice loop bounds for one loop nest as affine maps +/// of the other loop nest's IVs and symbols, using 'dependenceConstraints' +/// computed between 'depSourceAccess' and 'depSinkAccess'. +/// If 'isBackwardSlice' is true, a backwards slice is computed in which the +/// slice bounds of loop nest surrounding 'depSourceAccess' are computed in +/// terms of loop IVs and symbols of the loop nest surrounding 'depSinkAccess' +/// at 'loopDepth'. +/// If 'isBackwardSlice' is false, a forward slice is computed in which the +/// slice bounds of loop nest surrounding 'depSinkAccess' are computed in terms +/// of loop IVs and symbols of the loop nest surrounding 'depSourceAccess' at +/// 'loopDepth'. +/// The slice loop bounds and associated operands are returned in 'sliceState'. +// +// Backward slice example: +// +// affine.for %i0 = 0 to 10 { +// affine.store %cst, %0[%i0] : memref<100xf32> // 'depSourceAccess' +// } +// affine.for %i1 = 0 to 10 { +// %v = affine.load %0[%i1] : memref<100xf32> // 'depSinkAccess' +// } +// +// // Backward computation slice of loop nest '%i0'. +// affine.for %i0 = (d0) -> (d0)(%i1) to (d0) -> (d0 + 1)(%i1) { +// affine.store %cst, %0[%i0] : memref<100xf32> // 'depSourceAccess' +// } +// +// Forward slice example: +// +// affine.for %i0 = 0 to 10 { +// affine.store %cst, %0[%i0] : memref<100xf32> // 'depSourceAccess' +// } +// affine.for %i1 = 0 to 10 { +// %v = affine.load %0[%i1] : memref<100xf32> // 'depSinkAccess' +// } +// +// // Forward computation slice of loop nest '%i1'. +// affine.for %i1 = (d0) -> (d0)(%i0) to (d0) -> (d0 + 1)(%i0) { +// %v = affine.load %0[%i1] : memref<100xf32> // 'depSinkAccess' +// } +// +void getComputationSliceState(Operation *depSourceOp, Operation *depSinkOp, + FlatAffineValueConstraints *dependenceConstraints, + unsigned loopDepth, bool isBackwardSlice, + ComputationSliceState *sliceState); + +/// Return the number of iterations for the `slicetripCountMap` provided. +uint64_t getSliceIterationCount( + const llvm::SmallDenseMap &sliceTripCountMap); + +/// Builds a map 'tripCountMap' from AffineForOp to constant trip count for +/// loop nest surrounding represented by slice loop bounds in 'slice'. Returns +/// true on success, false otherwise (if a non-constant trip count was +/// encountered). +bool buildSliceTripCountMap( + const ComputationSliceState &slice, + llvm::SmallDenseMap *tripCountMap); + +/// Computes in 'sliceUnion' the union of all slice bounds computed at +/// 'loopDepth' between all dependent pairs of ops in 'opsA' and 'opsB', and +/// then verifies if it is valid. The parameter 'numCommonLoops' is the number +/// of loops common to the operations in 'opsA' and 'opsB'. If 'isBackwardSlice' +/// is true, computes slice bounds for loop nest surrounding ops in 'opsA', as a +/// function of IVs and symbols of loop nest surrounding ops in 'opsB' at +/// 'loopDepth'. If 'isBackwardSlice' is false, computes slice bounds for loop +/// nest surrounding ops in 'opsB', as a function of IVs and symbols of loop +/// nest surrounding ops in 'opsA' at 'loopDepth'. Returns +/// 'SliceComputationResult::Success' if union was computed correctly, an +/// appropriate 'failure' otherwise. +// TODO: Change this API to take 'forOpA'/'forOpB'. +SliceComputationResult +computeSliceUnion(ArrayRef opsA, ArrayRef opsB, + unsigned loopDepth, unsigned numCommonLoops, + bool isBackwardSlice, ComputationSliceState *sliceUnion); + +/// Creates a clone of the computation contained in the loop nest surrounding +/// 'srcOpInst', slices the iteration space of src loop based on slice bounds +/// in 'sliceState', and inserts the computation slice at the beginning of the +/// operation block of the loop at 'dstLoopDepth' in the loop nest surrounding +/// 'dstOpInst'. Returns the top-level loop of the computation slice on +/// success, returns nullptr otherwise. +// Loop depth is a crucial optimization choice that determines where to +// materialize the results of the backward slice - presenting a trade-off b/w +// storage and redundant computation in several cases. +// TODO: Support computation slices with common surrounding loops. +AffineForOp insertBackwardComputationSlice(Operation *srcOpInst, + Operation *dstOpInst, + unsigned dstLoopDepth, + ComputationSliceState *sliceState); + +/// A region of a memref's data space; this is typically constructed by +/// analyzing load/store op's on this memref and the index space of loops +/// surrounding such op's. +// For example, the memref region for a load operation at loop depth = 1: +// +// affine.for %i = 0 to 32 { +// affine.for %ii = %i to (d0) -> (d0 + 8) (%i) { +// affine.load %A[%ii] +// } +// } +// +// Region: {memref = %A, write = false, {%i <= m0 <= %i + 7} } +// The last field is a 2-d FlatAffineValueConstraints symbolic in %i. +// +struct MemRefRegion { + explicit MemRefRegion(Location loc) : loc(loc) {} + + /// Computes the memory region accessed by this memref with the region + /// represented as constraints symbolic/parametric in 'loopDepth' loops + /// surrounding opInst. The computed region's 'cst' field has exactly as many + /// dimensional variables as the rank of the memref, and *potentially* + /// additional symbolic variables which could include any of the loop IVs + /// surrounding opInst up until 'loopDepth' and another additional Function + /// symbols involved with the access (for eg., those appear in affine.apply's, + /// loop bounds, etc.). If 'sliceState' is non-null, operands from + /// 'sliceState' are added as symbols, and the following constraints are added + /// to the system: + /// *) Inequality constraints which represent loop bounds for 'sliceState' + /// operands which are loop IVS (these represent the destination loop IVs + /// of the slice, and are added as symbols to MemRefRegion's constraint + /// system). + /// *) Inequality constraints for the slice bounds in 'sliceState', which + /// represent the bounds on the loop IVs in this constraint system w.r.t + /// to slice operands (which correspond to symbols). + /// If 'addMemRefDimBounds' is true, constant upper/lower bounds + /// [0, memref.getDimSize(i)) are added for each MemRef dimension 'i'. + /// + /// For example, the memref region for this operation at loopDepth = 1 will + /// be: + /// + /// affine.for %i = 0 to 32 { + /// affine.for %ii = %i to (d0) -> (d0 + 8) (%i) { + /// load %A[%ii] + /// } + /// } + /// + /// {memref = %A, write = false, {%i <= m0 <= %i + 7} } + /// The last field is a 2-d FlatAffineValueConstraints symbolic in %i. + /// + LogicalResult compute(Operation *op, unsigned loopDepth, + const ComputationSliceState *sliceState = nullptr, + bool addMemRefDimBounds = true); + + FlatAffineValueConstraints *getConstraints() { return &cst; } + const FlatAffineValueConstraints *getConstraints() const { return &cst; } + bool isWrite() const { return write; } + void setWrite(bool flag) { write = flag; } + + /// Returns a constant upper bound on the number of elements in this region if + /// bounded by a known constant (always possible for static shapes), + /// std::nullopt otherwise. Note that the symbols of the region are treated + /// specially, i.e., the returned bounding constant holds for *any given* + /// value of the symbol variables. The 'shape' vector is set to the + /// corresponding dimension-wise bounds major to minor. The number of elements + /// and all the dimension-wise bounds are guaranteed to be non-negative. We + /// use int64_t instead of uint64_t since index types can be at most + /// int64_t. `lbs` are set to the lower bounds for each of the rank + /// dimensions, and lbDivisors contains the corresponding denominators for + /// floorDivs. + std::optional getConstantBoundingSizeAndShape( + SmallVectorImpl *shape = nullptr, + std::vector> *lbs = nullptr, + SmallVectorImpl *lbDivisors = nullptr) const; + + /// Gets the lower and upper bound map for the dimensional variable at + /// `pos`. + void getLowerAndUpperBound(unsigned pos, AffineMap &lbMap, + AffineMap &ubMap) const; + + /// A wrapper around FlatAffineValueConstraints::getConstantBoundOnDimSize(). + /// 'pos' corresponds to the position of the memref shape's dimension (major + /// to minor) which matches 1:1 with the dimensional variable positions in + /// 'cst'. + std::optional + getConstantBoundOnDimSize(unsigned pos, + SmallVectorImpl *lb = nullptr, + int64_t *lbFloorDivisor = nullptr) const { + assert(pos < getRank() && "invalid position"); + return cst.getConstantBoundOnDimSize64(pos, lb); + } + + /// Returns the size of this MemRefRegion in bytes. + std::optional getRegionSize(); + + // Wrapper around FlatAffineValueConstraints::unionBoundingBox. + LogicalResult unionBoundingBox(const MemRefRegion &other); + + /// Returns the rank of the memref that this region corresponds to. + unsigned getRank() const; + + /// Memref that this region corresponds to. + Value memref; + + /// Read or write. + bool write = false; + + /// If there is more than one load/store op associated with the region, the + /// location information would correspond to one of those op's. + Location loc; + + /// Region (data space) of the memref accessed. This set will thus have at + /// least as many dimensional variables as the shape dimensionality of the + /// memref, and these are the leading dimensions of the set appearing in that + /// order (major to minor / outermost to innermost). There may be additional + /// variables since getMemRefRegion() is called with a specific loop depth, + /// and thus the region is symbolic in the outer surrounding loops at that + /// depth. + // TODO: Replace this to exploit HyperRectangularSet. + FlatAffineValueConstraints cst; +}; + +/// Returns the size of a memref with element type int or float in bytes if it's +/// statically shaped, std::nullopt otherwise. +std::optional getIntOrFloatMemRefSizeInBytes(MemRefType memRefType); + +/// Checks a load or store op for an out of bound access; returns failure if the +/// access is out of bounds along any of the dimensions, success otherwise. +/// Emits a diagnostic error (with location information) if emitError is true. +template +LogicalResult boundCheckLoadOrStoreOp(LoadOrStoreOpPointer loadOrStoreOp, + bool emitError = true); + +/// Returns the number of surrounding loops common to both A and B. +unsigned getNumCommonSurroundingLoops(Operation &a, Operation &b); + +/// Gets the memory footprint of all data touched in the specified memory space +/// in bytes; if the memory space is unspecified, considers all memory spaces. +std::optional getMemoryFootprintBytes(AffineForOp forOp, + int memorySpace = -1); + +/// Returns the memref's element type's size in bytes where the elemental type +/// is an int or float or a vector of such types. +std::optional getMemRefIntOrFloatEltSizeInBytes(MemRefType memRefType); + +/// Simplify the integer set by simplifying the underlying affine expressions by +/// flattening and some simple inference. Also, drop any duplicate constraints. +/// Returns the simplified integer set. This method runs in time linear in the +/// number of constraints. +IntegerSet simplifyIntegerSet(IntegerSet set); + +/// Returns the innermost common loop depth for the set of operations in 'ops'. +unsigned getInnermostCommonLoopDepth( + ArrayRef ops, + SmallVectorImpl *surroundingLoops = nullptr); + +/// Try to simplify the given affine.min or affine.max op to an affine map with +/// a single result and operands, taking into account the specified constraint +/// set. Return failure if no simplified version could be found. +FailureOr +simplifyConstrainedMinMaxOp(Operation *op, + FlatAffineValueConstraints constraints); + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_ANALYSIS_UTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..ece224ad5eddfcf27f4b1899b5a721de6cac030f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp.inc @@ -0,0 +1,52 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Returns the AffineMapAttr associated with 'memref'. +::mlir::NamedAttribute mlir::affine::AffineMapAccessInterface::getAffineMapAttrForMemRef(::mlir::Value memref) { + return getImpl()->getAffineMapAttrForMemRef(getImpl(), getOperation(), memref); + } +/// Returns the memref operand to read from. +::mlir::Value mlir::affine::AffineReadOpInterface::getMemRef() { + return getImpl()->getMemRef(getImpl(), getOperation()); + } +/// Returns the type of the memref operand. +::mlir::MemRefType mlir::affine::AffineReadOpInterface::getMemRefType() { + return getImpl()->getMemRefType(getImpl(), getOperation()); + } +/// Returns affine map operands. +::mlir::Operation::operand_range mlir::affine::AffineReadOpInterface::getMapOperands() { + return getImpl()->getMapOperands(getImpl(), getOperation()); + } +/// Returns the affine map used to index the memref for this operation. +::mlir::AffineMap mlir::affine::AffineReadOpInterface::getAffineMap() { + return getImpl()->getAffineMap(getImpl(), getOperation()); + } +/// Returns the value read by this operation. +::mlir::Value mlir::affine::AffineReadOpInterface::getValue() { + return getImpl()->getValue(getImpl(), getOperation()); + } +/// Returns the memref operand to write to. +::mlir::Value mlir::affine::AffineWriteOpInterface::getMemRef() { + return getImpl()->getMemRef(getImpl(), getOperation()); + } +/// Returns the type of the memref operand. +::mlir::MemRefType mlir::affine::AffineWriteOpInterface::getMemRefType() { + return getImpl()->getMemRefType(getImpl(), getOperation()); + } +/// Returns affine map operands. +::mlir::Operation::operand_range mlir::affine::AffineWriteOpInterface::getMapOperands() { + return getImpl()->getMapOperands(getImpl(), getOperation()); + } +/// Returns the affine map used to index the memref for this operation. +::mlir::AffineMap mlir::affine::AffineWriteOpInterface::getAffineMap() { + return getImpl()->getAffineMap(getImpl(), getOperation()); + } +/// Returns the value to store. +::mlir::Value mlir::affine::AffineWriteOpInterface::getValueToStore() { + return getImpl()->getValueToStore(getImpl(), getOperation()); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h new file mode 100644 index 0000000000000000000000000000000000000000..b9208ef937cf0c79fc9741fa002d27c56333c15f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h @@ -0,0 +1,22 @@ +//===- AffineMemoryOpInterfaces.h -------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains a set of interfaces for affine memory ops. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPINTERFACES_H +#define MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPINTERFACES_H + +#include "mlir/IR/AffineMap.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/OpDefinition.h" + +#include "mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc" + +#endif // MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPINTERFACES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..31fbe7b33e53001b8197ec94d7ddf43a17737092 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc @@ -0,0 +1,402 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace affine { +class AffineReadOpInterface; +namespace detail { +struct AffineReadOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::Value (*getMemRef)(const Concept *impl, ::mlir::Operation *); + ::mlir::MemRefType (*getMemRefType)(const Concept *impl, ::mlir::Operation *); + ::mlir::Operation::operand_range (*getMapOperands)(const Concept *impl, ::mlir::Operation *); + ::mlir::AffineMap (*getAffineMap)(const Concept *impl, ::mlir::Operation *); + ::mlir::Value (*getValue)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::affine::AffineReadOpInterface; + Model() : Concept{getMemRef, getMemRefType, getMapOperands, getAffineMap, getValue} {} + + static inline ::mlir::Value getMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::MemRefType getMemRefType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Operation::operand_range getMapOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::AffineMap getAffineMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getValue(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::affine::AffineReadOpInterface; + FallbackModel() : Concept{getMemRef, getMemRefType, getMapOperands, getAffineMap, getValue} {} + + static inline ::mlir::Value getMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::MemRefType getMemRefType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Operation::operand_range getMapOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::AffineMap getAffineMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getValue(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::Value getMemRef(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::MemRefType getMemRefType(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::Operation::operand_range getMapOperands(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::AffineMap getAffineMap(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::Value getValue(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct AffineReadOpInterfaceTrait; + +} // namespace detail +class AffineReadOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AffineReadOpInterfaceTrait {}; + /// Returns the memref operand to read from. + ::mlir::Value getMemRef(); + /// Returns the type of the memref operand. + ::mlir::MemRefType getMemRefType(); + /// Returns affine map operands. + ::mlir::Operation::operand_range getMapOperands(); + /// Returns the affine map used to index the memref for this operation. + ::mlir::AffineMap getAffineMap(); + /// Returns the value read by this operation. + ::mlir::Value getValue(); +}; +namespace detail { + template + struct AffineReadOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns the memref operand to read from. + ::mlir::Value getMemRef() { + return (*static_cast(this)).getOperand((*static_cast(this)).getMemRefOperandIndex()); + } + /// Returns the type of the memref operand. + ::mlir::MemRefType getMemRefType() { + return ::llvm::cast<::mlir::MemRefType>((*static_cast(this)).getMemRef().getType()); + } + /// Returns affine map operands. + ::mlir::Operation::operand_range getMapOperands() { + return llvm::drop_begin((*static_cast(this)).getOperands(), 1); + } + /// Returns the affine map used to index the memref for this operation. + ::mlir::AffineMap getAffineMap() { + return (*static_cast(this)).getAffineMapAttr().getValue(); + } + /// Returns the value read by this operation. + ::mlir::Value getValue() { + return (*static_cast(this)); + } + }; +}// namespace detail +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineWriteOpInterface; +namespace detail { +struct AffineWriteOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::Value (*getMemRef)(const Concept *impl, ::mlir::Operation *); + ::mlir::MemRefType (*getMemRefType)(const Concept *impl, ::mlir::Operation *); + ::mlir::Operation::operand_range (*getMapOperands)(const Concept *impl, ::mlir::Operation *); + ::mlir::AffineMap (*getAffineMap)(const Concept *impl, ::mlir::Operation *); + ::mlir::Value (*getValueToStore)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::affine::AffineWriteOpInterface; + Model() : Concept{getMemRef, getMemRefType, getMapOperands, getAffineMap, getValueToStore} {} + + static inline ::mlir::Value getMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::MemRefType getMemRefType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Operation::operand_range getMapOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::AffineMap getAffineMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getValueToStore(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::affine::AffineWriteOpInterface; + FallbackModel() : Concept{getMemRef, getMemRefType, getMapOperands, getAffineMap, getValueToStore} {} + + static inline ::mlir::Value getMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::MemRefType getMemRefType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Operation::operand_range getMapOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::AffineMap getAffineMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getValueToStore(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::Value getMemRef(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::MemRefType getMemRefType(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::Operation::operand_range getMapOperands(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::AffineMap getAffineMap(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::Value getValueToStore(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct AffineWriteOpInterfaceTrait; + +} // namespace detail +class AffineWriteOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AffineWriteOpInterfaceTrait {}; + /// Returns the memref operand to write to. + ::mlir::Value getMemRef(); + /// Returns the type of the memref operand. + ::mlir::MemRefType getMemRefType(); + /// Returns affine map operands. + ::mlir::Operation::operand_range getMapOperands(); + /// Returns the affine map used to index the memref for this operation. + ::mlir::AffineMap getAffineMap(); + /// Returns the value to store. + ::mlir::Value getValueToStore(); +}; +namespace detail { + template + struct AffineWriteOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns the memref operand to write to. + ::mlir::Value getMemRef() { + return (*static_cast(this)).getOperand((*static_cast(this)).getMemRefOperandIndex()); + } + /// Returns the type of the memref operand. + ::mlir::MemRefType getMemRefType() { + return ::llvm::cast<::mlir::MemRefType>((*static_cast(this)).getMemRef().getType()); + } + /// Returns affine map operands. + ::mlir::Operation::operand_range getMapOperands() { + return llvm::drop_begin((*static_cast(this)).getOperands(), 2); + } + /// Returns the affine map used to index the memref for this operation. + ::mlir::AffineMap getAffineMap() { + return (*static_cast(this)).getAffineMapAttr().getValue(); + } + /// Returns the value to store. + ::mlir::Value getValueToStore() { + return (*static_cast(this)).getOperand((*static_cast(this)).getStoredValOperandIndex()); + } + }; +}// namespace detail +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineMapAccessInterface; +namespace detail { +struct AffineMapAccessInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::NamedAttribute (*getAffineMapAttrForMemRef)(const Concept *impl, ::mlir::Operation *, ::mlir::Value); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::affine::AffineMapAccessInterface; + Model() : Concept{getAffineMapAttrForMemRef} {} + + static inline ::mlir::NamedAttribute getAffineMapAttrForMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value memref); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::affine::AffineMapAccessInterface; + FallbackModel() : Concept{getAffineMapAttrForMemRef} {} + + static inline ::mlir::NamedAttribute getAffineMapAttrForMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value memref); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::NamedAttribute getAffineMapAttrForMemRef(::mlir::Operation *tablegen_opaque_val, ::mlir::Value memref) const; + }; +};template +struct AffineMapAccessInterfaceTrait; + +} // namespace detail +class AffineMapAccessInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AffineMapAccessInterfaceTrait {}; + /// Returns the AffineMapAttr associated with 'memref'. + ::mlir::NamedAttribute getAffineMapAttrForMemRef(::mlir::Value memref); +}; +namespace detail { + template + struct AffineMapAccessInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns the AffineMapAttr associated with 'memref'. + ::mlir::NamedAttribute getAffineMapAttrForMemRef(::mlir::Value memref) { + assert(memref == (*static_cast(this)).getMemRef() && + "Expected memref argument to match memref operand"); + return {::mlir::StringAttr::get( + (*static_cast(this)).getContext(), (*static_cast(this)).getMapAttrStrName()), + (*static_cast(this)).getAffineMapAttr()}; + } + }; +}// namespace detail +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +template +::mlir::Value detail::AffineReadOpInterfaceInterfaceTraits::Model::getMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getMemRef(); +} +template +::mlir::MemRefType detail::AffineReadOpInterfaceInterfaceTraits::Model::getMemRefType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getMemRefType(); +} +template +::mlir::Operation::operand_range detail::AffineReadOpInterfaceInterfaceTraits::Model::getMapOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getMapOperands(); +} +template +::mlir::AffineMap detail::AffineReadOpInterfaceInterfaceTraits::Model::getAffineMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getAffineMap(); +} +template +::mlir::Value detail::AffineReadOpInterfaceInterfaceTraits::Model::getValue(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getValue(); +} +template +::mlir::Value detail::AffineReadOpInterfaceInterfaceTraits::FallbackModel::getMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getMemRef(tablegen_opaque_val); +} +template +::mlir::MemRefType detail::AffineReadOpInterfaceInterfaceTraits::FallbackModel::getMemRefType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getMemRefType(tablegen_opaque_val); +} +template +::mlir::Operation::operand_range detail::AffineReadOpInterfaceInterfaceTraits::FallbackModel::getMapOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getMapOperands(tablegen_opaque_val); +} +template +::mlir::AffineMap detail::AffineReadOpInterfaceInterfaceTraits::FallbackModel::getAffineMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getAffineMap(tablegen_opaque_val); +} +template +::mlir::Value detail::AffineReadOpInterfaceInterfaceTraits::FallbackModel::getValue(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getValue(tablegen_opaque_val); +} +template +::mlir::Value detail::AffineReadOpInterfaceInterfaceTraits::ExternalModel::getMemRef(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getOperand((llvm::cast(tablegen_opaque_val)).getMemRefOperandIndex()); +} +template +::mlir::MemRefType detail::AffineReadOpInterfaceInterfaceTraits::ExternalModel::getMemRefType(::mlir::Operation *tablegen_opaque_val) const { +return ::llvm::cast<::mlir::MemRefType>((llvm::cast(tablegen_opaque_val)).getMemRef().getType()); +} +template +::mlir::Operation::operand_range detail::AffineReadOpInterfaceInterfaceTraits::ExternalModel::getMapOperands(::mlir::Operation *tablegen_opaque_val) const { +return llvm::drop_begin((llvm::cast(tablegen_opaque_val)).getOperands(), 1); +} +template +::mlir::AffineMap detail::AffineReadOpInterfaceInterfaceTraits::ExternalModel::getAffineMap(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getAffineMapAttr().getValue(); +} +template +::mlir::Value detail::AffineReadOpInterfaceInterfaceTraits::ExternalModel::getValue(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)); +} +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +template +::mlir::Value detail::AffineWriteOpInterfaceInterfaceTraits::Model::getMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getMemRef(); +} +template +::mlir::MemRefType detail::AffineWriteOpInterfaceInterfaceTraits::Model::getMemRefType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getMemRefType(); +} +template +::mlir::Operation::operand_range detail::AffineWriteOpInterfaceInterfaceTraits::Model::getMapOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getMapOperands(); +} +template +::mlir::AffineMap detail::AffineWriteOpInterfaceInterfaceTraits::Model::getAffineMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getAffineMap(); +} +template +::mlir::Value detail::AffineWriteOpInterfaceInterfaceTraits::Model::getValueToStore(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getValueToStore(); +} +template +::mlir::Value detail::AffineWriteOpInterfaceInterfaceTraits::FallbackModel::getMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getMemRef(tablegen_opaque_val); +} +template +::mlir::MemRefType detail::AffineWriteOpInterfaceInterfaceTraits::FallbackModel::getMemRefType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getMemRefType(tablegen_opaque_val); +} +template +::mlir::Operation::operand_range detail::AffineWriteOpInterfaceInterfaceTraits::FallbackModel::getMapOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getMapOperands(tablegen_opaque_val); +} +template +::mlir::AffineMap detail::AffineWriteOpInterfaceInterfaceTraits::FallbackModel::getAffineMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getAffineMap(tablegen_opaque_val); +} +template +::mlir::Value detail::AffineWriteOpInterfaceInterfaceTraits::FallbackModel::getValueToStore(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getValueToStore(tablegen_opaque_val); +} +template +::mlir::Value detail::AffineWriteOpInterfaceInterfaceTraits::ExternalModel::getMemRef(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getOperand((llvm::cast(tablegen_opaque_val)).getMemRefOperandIndex()); +} +template +::mlir::MemRefType detail::AffineWriteOpInterfaceInterfaceTraits::ExternalModel::getMemRefType(::mlir::Operation *tablegen_opaque_val) const { +return ::llvm::cast<::mlir::MemRefType>((llvm::cast(tablegen_opaque_val)).getMemRef().getType()); +} +template +::mlir::Operation::operand_range detail::AffineWriteOpInterfaceInterfaceTraits::ExternalModel::getMapOperands(::mlir::Operation *tablegen_opaque_val) const { +return llvm::drop_begin((llvm::cast(tablegen_opaque_val)).getOperands(), 2); +} +template +::mlir::AffineMap detail::AffineWriteOpInterfaceInterfaceTraits::ExternalModel::getAffineMap(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getAffineMapAttr().getValue(); +} +template +::mlir::Value detail::AffineWriteOpInterfaceInterfaceTraits::ExternalModel::getValueToStore(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getOperand((llvm::cast(tablegen_opaque_val)).getStoredValOperandIndex()); +} +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +template +::mlir::NamedAttribute detail::AffineMapAccessInterfaceInterfaceTraits::Model::getAffineMapAttrForMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value memref) { + return (llvm::cast(tablegen_opaque_val)).getAffineMapAttrForMemRef(memref); +} +template +::mlir::NamedAttribute detail::AffineMapAccessInterfaceInterfaceTraits::FallbackModel::getAffineMapAttrForMemRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value memref) { + return static_cast(impl)->getAffineMapAttrForMemRef(tablegen_opaque_val, memref); +} +template +::mlir::NamedAttribute detail::AffineMapAccessInterfaceInterfaceTraits::ExternalModel::getAffineMapAttrForMemRef(::mlir::Operation *tablegen_opaque_val, ::mlir::Value memref) const { +assert(memref == (llvm::cast(tablegen_opaque_val)).getMemRef() && + "Expected memref argument to match memref operand"); + return {::mlir::StringAttr::get( + (llvm::cast(tablegen_opaque_val)).getContext(), (llvm::cast(tablegen_opaque_val)).getMapAttrStrName()), + (llvm::cast(tablegen_opaque_val)).getAffineMapAttr()}; +} +} // namespace affine +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..cf636d7a844bb10970067c912adf8ef91eab4df4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOps.cpp.inc @@ -0,0 +1,4577 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AffineOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::affine::AffineApplyOp, +::mlir::affine::AffineDelinearizeIndexOp, +::mlir::affine::AffineForOp, +::mlir::affine::AffineIfOp, +::mlir::affine::AffineLoadOp, +::mlir::affine::AffineMaxOp, +::mlir::affine::AffineMinOp, +::mlir::affine::AffineParallelOp, +::mlir::affine::AffinePrefetchOp, +::mlir::affine::AffineStoreOp, +::mlir::affine::AffineVectorLoadOp, +::mlir::affine::AffineVectorStoreOp, +::mlir::affine::AffineYieldOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace affine { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AffineOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AffineOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AffineOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AffineOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::AffineMapAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: AffineMap attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AffineOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(attr).getType()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: index attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AffineOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::arith::AtomicRMWKindAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Reduction ops"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AffineOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer elements attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AffineOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit integer array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AffineOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: bool attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AffineOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() >= 0)) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() <= 3)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 3"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AffineOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AffineOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_AffineOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItems(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with 1 blocks"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_AffineOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineApplyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineApplyOpGenericAdaptorBase::AffineApplyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.apply", odsAttrs.getContext()); +} + +AffineApplyOpGenericAdaptorBase::AffineApplyOpGenericAdaptorBase(AffineApplyOp op) : AffineApplyOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineApplyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineApplyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::AffineMapAttr AffineApplyOpGenericAdaptorBase::getMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); + return attr; +} + +::mlir::AffineMap AffineApplyOpGenericAdaptorBase::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +} // namespace detail +AffineApplyOpAdaptor::AffineApplyOpAdaptor(AffineApplyOp op) : AffineApplyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineApplyOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitError(loc, "'affine.apply' op ""requires attribute 'map'"); + + if (tblgen_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_map)))) + return emitError(loc, "'affine.apply' op ""attribute 'map' failed to satisfy constraint: AffineMap attribute"); + return ::mlir::success(); +} + +std::pair AffineApplyOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineApplyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AffineApplyOp::getMapOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange AffineApplyOp::getMapOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineApplyOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AffineApplyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AffineApplyOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.map; + auto attr = dict.get("map"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for map in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AffineApplyOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.map; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffineApplyOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.map.getAsOpaquePointer())); +} + +std::optional AffineApplyOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "map") + return prop.map; + return std::nullopt; +} + +void AffineApplyOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "map") { + prop.map = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AffineApplyOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.map) attrs.append("map", prop.map); +} + +::mlir::LogicalResult AffineApplyOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "map", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineApplyOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.map))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineApplyOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.map); +} + +::mlir::AffineMapAttr AffineApplyOp::getMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); +} + +::mlir::AffineMap AffineApplyOp::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +void AffineApplyOp::setMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getMapAttrName(), attr); +} + +void AffineApplyOp::setMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffineApplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, AffineMap map, ValueRange mapOperands) { + build(odsBuilder, odsState, odsBuilder.getIndexType(), map, mapOperands); + +} + +void AffineApplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef exprList, ValueRange mapOperands) { + build(odsBuilder, odsState, odsBuilder.getIndexType(), + AffineMap::inferFromExprList(exprList).front(), mapOperands); + +} + +void AffineApplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMapAttr map, ::mlir::ValueRange mapOperands) { + odsState.addOperands(mapOperands); + odsState.getOrAddProperties().map = map; + odsState.addTypes(resultType0); +} + +void AffineApplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMapAttr map, ::mlir::ValueRange mapOperands) { + odsState.addOperands(mapOperands); + odsState.getOrAddProperties().map = map; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineApplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMap map, ::mlir::ValueRange mapOperands) { + odsState.addOperands(mapOperands); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + odsState.addTypes(resultType0); +} + +void AffineApplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMap map, ::mlir::ValueRange mapOperands) { + odsState.addOperands(mapOperands); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineApplyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AffineApplyOp::verifyInvariantsImpl() { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitOpError("requires attribute 'map'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_map, "map"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineApplyOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AffineApplyOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineApplyOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineDelinearizeIndexOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineDelinearizeIndexOpGenericAdaptorBase::AffineDelinearizeIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.delinearize_index", odsAttrs.getContext()); +} + +AffineDelinearizeIndexOpGenericAdaptorBase::AffineDelinearizeIndexOpGenericAdaptorBase(AffineDelinearizeIndexOp op) : AffineDelinearizeIndexOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineDelinearizeIndexOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineDelinearizeIndexOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AffineDelinearizeIndexOpAdaptor::AffineDelinearizeIndexOpAdaptor(AffineDelinearizeIndexOp op) : AffineDelinearizeIndexOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineDelinearizeIndexOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AffineDelinearizeIndexOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineDelinearizeIndexOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> AffineDelinearizeIndexOp::getLinearIndex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range AffineDelinearizeIndexOp::getBasis() { + return getODSOperands(1); +} + +::mlir::OpOperand &AffineDelinearizeIndexOp::getLinearIndexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange AffineDelinearizeIndexOp::getBasisMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineDelinearizeIndexOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range AffineDelinearizeIndexOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range AffineDelinearizeIndexOp::getMultiIndex() { + return getODSResults(0); +} + +void AffineDelinearizeIndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange multi_index, ::mlir::Value linear_index, ::mlir::ValueRange basis) { + odsState.addOperands(linear_index); + odsState.addOperands(basis); + odsState.addTypes(multi_index); +} + +void AffineDelinearizeIndexOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AffineDelinearizeIndexOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineDelinearizeIndexOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AffineDelinearizeIndexOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand linear_indexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> linear_indexOperands(linear_indexRawOperands); ::llvm::SMLoc linear_indexOperandsLoc; + (void)linear_indexOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> basisOperands; + ::llvm::SMLoc basisOperandsLoc; + (void)basisOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> multi_indexTypes; + + linear_indexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(linear_indexRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("into")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + basisOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(basisOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(multi_indexTypes)) + return ::mlir::failure(); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(multi_indexTypes); + if (parser.resolveOperands(linear_indexOperands, odsBuildableType0, linear_indexOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(basisOperands, odsBuildableType0, basisOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineDelinearizeIndexOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLinearIndex(); + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter << "("; + _odsPrinter << getBasis(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getMultiIndex().getTypes(); +} + +void AffineDelinearizeIndexOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineDelinearizeIndexOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineForOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineForOpGenericAdaptorBase::AffineForOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.for", odsAttrs.getContext()); +} + +AffineForOpGenericAdaptorBase::AffineForOpGenericAdaptorBase(AffineForOp op) : AffineForOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineForOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr AffineForOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::AffineMapAttr AffineForOpGenericAdaptorBase::getLowerBoundMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().lowerBoundMap); + return attr; +} + +::mlir::AffineMap AffineForOpGenericAdaptorBase::getLowerBoundMap() { + auto attr = getLowerBoundMapAttr(); + return attr.getValue(); +} + +::mlir::AffineMapAttr AffineForOpGenericAdaptorBase::getUpperBoundMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().upperBoundMap); + return attr; +} + +::mlir::AffineMap AffineForOpGenericAdaptorBase::getUpperBoundMap() { + auto attr = getUpperBoundMapAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr AffineForOpGenericAdaptorBase::getStepAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().step); + return attr; +} + +::llvm::APInt AffineForOpGenericAdaptorBase::getStep() { + auto attr = getStepAttr(); + return attr.getValue(); +} + +::mlir::Region &AffineForOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange AffineForOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AffineForOpAdaptor::AffineForOpAdaptor(AffineForOp op) : AffineForOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineForOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_lowerBoundMap = getProperties().lowerBoundMap; (void)tblgen_lowerBoundMap; + if (!tblgen_lowerBoundMap) return emitError(loc, "'affine.for' op ""requires attribute 'lowerBoundMap'"); + auto tblgen_step = getProperties().step; (void)tblgen_step; + if (!tblgen_step) return emitError(loc, "'affine.for' op ""requires attribute 'step'"); + auto tblgen_upperBoundMap = getProperties().upperBoundMap; (void)tblgen_upperBoundMap; + if (!tblgen_upperBoundMap) return emitError(loc, "'affine.for' op ""requires attribute 'upperBoundMap'"); + + if (tblgen_lowerBoundMap && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_lowerBoundMap)))) + return emitError(loc, "'affine.for' op ""attribute 'lowerBoundMap' failed to satisfy constraint: AffineMap attribute"); + + if (tblgen_upperBoundMap && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_upperBoundMap)))) + return emitError(loc, "'affine.for' op ""attribute 'upperBoundMap' failed to satisfy constraint: AffineMap attribute"); + + if (tblgen_step && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_step))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(tblgen_step).getType()))))) + return emitError(loc, "'affine.for' op ""attribute 'step' failed to satisfy constraint: index attribute"); + return ::mlir::success(); +} + +std::pair AffineForOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range AffineForOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AffineForOp::getLowerBoundOperands() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range AffineForOp::getUpperBoundOperands() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range AffineForOp::getInits() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange AffineForOp::getLowerBoundOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AffineForOp::getUpperBoundOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AffineForOp::getInitsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair AffineForOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range AffineForOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range AffineForOp::getResults() { + return getODSResults(0); +} + +::mlir::Region &AffineForOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult AffineForOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.lowerBoundMap; + auto attr = dict.get("lowerBoundMap"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for lowerBoundMap in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `lowerBoundMap` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.step; + auto attr = dict.get("step"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for step in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `step` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.upperBoundMap; + auto attr = dict.get("upperBoundMap"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for upperBoundMap in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `upperBoundMap` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute AffineForOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.lowerBoundMap; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("lowerBoundMap", + propStorage)); + } + + { + const auto &propStorage = prop.step; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("step", + propStorage)); + } + + { + const auto &propStorage = prop.upperBoundMap; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("upperBoundMap", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffineForOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.lowerBoundMap.getAsOpaquePointer()), + llvm::hash_value(prop.step.getAsOpaquePointer()), + llvm::hash_value(prop.upperBoundMap.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional AffineForOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "lowerBoundMap") + return prop.lowerBoundMap; + + if (name == "step") + return prop.step; + + if (name == "upperBoundMap") + return prop.upperBoundMap; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void AffineForOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "lowerBoundMap") { + prop.lowerBoundMap = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "step") { + prop.step = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "upperBoundMap") { + prop.upperBoundMap = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void AffineForOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.lowerBoundMap) attrs.append("lowerBoundMap", prop.lowerBoundMap); + + if (prop.step) attrs.append("step", prop.step); + + if (prop.upperBoundMap) attrs.append("upperBoundMap", prop.upperBoundMap); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult AffineForOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLowerBoundMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "lowerBoundMap", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStepAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps1(attr, "step", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUpperBoundMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "upperBoundMap", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineForOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.lowerBoundMap))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.step))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.upperBoundMap))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void AffineForOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.lowerBoundMap); + writer.writeAttribute(prop.step); + writer.writeAttribute(prop.upperBoundMap); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::AffineMapAttr AffineForOp::getLowerBoundMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().lowerBoundMap); +} + +::mlir::AffineMap AffineForOp::getLowerBoundMap() { + auto attr = getLowerBoundMapAttr(); + return attr.getValue(); +} + +::mlir::AffineMapAttr AffineForOp::getUpperBoundMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().upperBoundMap); +} + +::mlir::AffineMap AffineForOp::getUpperBoundMap() { + auto attr = getUpperBoundMapAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr AffineForOp::getStepAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().step); +} + +::llvm::APInt AffineForOp::getStep() { + auto attr = getStepAttr(); + return attr.getValue(); +} + +void AffineForOp::setLowerBoundMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getLowerBoundMapAttrName(), attr); +} + +void AffineForOp::setLowerBoundMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getLowerBoundMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffineForOp::setUpperBoundMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getUpperBoundMapAttrName(), attr); +} + +void AffineForOp::setUpperBoundMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getUpperBoundMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffineForOp::setStepAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getStepAttrName(), attr); +} + +void AffineForOp::setStep(::llvm::APInt attrValue) { + (*this)->setAttr(getStepAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIndexType(), attrValue)); +} + +::mlir::LogicalResult AffineForOp::verifyInvariantsImpl() { + auto tblgen_lowerBoundMap = getProperties().lowerBoundMap; (void)tblgen_lowerBoundMap; + if (!tblgen_lowerBoundMap) return emitOpError("requires attribute 'lowerBoundMap'"); + auto tblgen_step = getProperties().step; (void)tblgen_step; + if (!tblgen_step) return emitOpError("requires attribute 'step'"); + auto tblgen_upperBoundMap = getProperties().upperBoundMap; (void)tblgen_upperBoundMap; + if (!tblgen_upperBoundMap) return emitOpError("requires attribute 'upperBoundMap'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_lowerBoundMap, "lowerBoundMap"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_upperBoundMap, "upperBoundMap"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps1(*this, tblgen_step, "step"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_AffineOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineForOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineForOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineIfOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineIfOpGenericAdaptorBase::AffineIfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.if", odsAttrs.getContext()); +} + +AffineIfOpGenericAdaptorBase::AffineIfOpGenericAdaptorBase(AffineIfOp op) : AffineIfOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineIfOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineIfOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &AffineIfOpGenericAdaptorBase::getThenRegion() { + return *odsRegions[0]; +} + +::mlir::Region &AffineIfOpGenericAdaptorBase::getElseRegion() { + return *odsRegions[1]; +} + +::mlir::RegionRange AffineIfOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AffineIfOpAdaptor::AffineIfOpAdaptor(AffineIfOp op) : AffineIfOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineIfOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AffineIfOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineIfOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair AffineIfOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range AffineIfOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range AffineIfOp::getResults() { + return getODSResults(0); +} + +::mlir::Region &AffineIfOp::getThenRegion() { + return (*this)->getRegion(0); +} + +::mlir::Region &AffineIfOp::getElseRegion() { + return (*this)->getRegion(1); +} + +::mlir::LogicalResult AffineIfOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_AffineOps0(*this, region, "thenRegion", index++))) + return ::mlir::failure(); + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(1))) + if (::mlir::failed(__mlir_ods_local_region_constraint_AffineOps1(*this, region, "elseRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineIfOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineIfOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineLoadOpGenericAdaptorBase::AffineLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.load", odsAttrs.getContext()); +} + +AffineLoadOpGenericAdaptorBase::AffineLoadOpGenericAdaptorBase(AffineLoadOp op) : AffineLoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::AffineMapAttr AffineLoadOpGenericAdaptorBase::getMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); + return attr; +} + +::mlir::AffineMap AffineLoadOpGenericAdaptorBase::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +} // namespace detail +AffineLoadOpAdaptor::AffineLoadOpAdaptor(AffineLoadOp op) : AffineLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineLoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitError(loc, "'affine.load' op ""requires attribute 'map'"); + + if (tblgen_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_map)))) + return emitError(loc, "'affine.load' op ""attribute 'map' failed to satisfy constraint: AffineMap attribute"); + return ::mlir::success(); +} + +std::pair AffineLoadOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> AffineLoadOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range AffineLoadOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &AffineLoadOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange AffineLoadOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AffineLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AffineLoadOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AffineLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.map; + auto attr = dict.get("map"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for map in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AffineLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.map; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffineLoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.map.getAsOpaquePointer())); +} + +std::optional AffineLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "map") + return prop.map; + return std::nullopt; +} + +void AffineLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "map") { + prop.map = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AffineLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.map) attrs.append("map", prop.map); +} + +::mlir::LogicalResult AffineLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "map", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.map))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.map); +} + +::mlir::AffineMapAttr AffineLoadOp::getMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); +} + +::mlir::AffineMap AffineLoadOp::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +void AffineLoadOp::setMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getMapAttrName(), attr); +} + +void AffineLoadOp::setMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffineLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMapAttr map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().map = map; + odsState.addTypes(result); +} + +void AffineLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMapAttr map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().map = map; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMap map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + odsState.addTypes(result); +} + +void AffineLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMap map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AffineLoadOp::verifyInvariantsImpl() { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitOpError("requires attribute 'map'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_map, "map"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineLoadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AffineLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineLoadOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineMaxOpGenericAdaptorBase::AffineMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.max", odsAttrs.getContext()); +} + +AffineMaxOpGenericAdaptorBase::AffineMaxOpGenericAdaptorBase(AffineMaxOp op) : AffineMaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::AffineMapAttr AffineMaxOpGenericAdaptorBase::getMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); + return attr; +} + +::mlir::AffineMap AffineMaxOpGenericAdaptorBase::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +} // namespace detail +AffineMaxOpAdaptor::AffineMaxOpAdaptor(AffineMaxOp op) : AffineMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineMaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitError(loc, "'affine.max' op ""requires attribute 'map'"); + + if (tblgen_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_map)))) + return emitError(loc, "'affine.max' op ""attribute 'map' failed to satisfy constraint: AffineMap attribute"); + return ::mlir::success(); +} + +std::pair AffineMaxOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AffineMaxOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange AffineMaxOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineMaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AffineMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AffineMaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.map; + auto attr = dict.get("map"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for map in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AffineMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.map; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffineMaxOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.map.getAsOpaquePointer())); +} + +std::optional AffineMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "map") + return prop.map; + return std::nullopt; +} + +void AffineMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "map") { + prop.map = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AffineMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.map) attrs.append("map", prop.map); +} + +::mlir::LogicalResult AffineMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "map", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.map))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.map); +} + +::mlir::AffineMapAttr AffineMaxOp::getMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); +} + +::mlir::AffineMap AffineMaxOp::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +void AffineMaxOp::setMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getMapAttrName(), attr); +} + +void AffineMaxOp::setMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffineMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, AffineMap affineMap, ValueRange mapOperands) { + build(odsBuilder, odsState, odsBuilder.getIndexType(), affineMap, mapOperands); + +} + +void AffineMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMapAttr map, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().map = map; + odsState.addTypes(resultType0); +} + +void AffineMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMapAttr map, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().map = map; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMap map, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + odsState.addTypes(resultType0); +} + +void AffineMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMap map, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineMaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AffineMaxOp::verifyInvariantsImpl() { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitOpError("requires attribute 'map'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_map, "map"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineMaxOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AffineMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineMaxOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineMinOpGenericAdaptorBase::AffineMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.min", odsAttrs.getContext()); +} + +AffineMinOpGenericAdaptorBase::AffineMinOpGenericAdaptorBase(AffineMinOp op) : AffineMinOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::AffineMapAttr AffineMinOpGenericAdaptorBase::getMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); + return attr; +} + +::mlir::AffineMap AffineMinOpGenericAdaptorBase::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +} // namespace detail +AffineMinOpAdaptor::AffineMinOpAdaptor(AffineMinOp op) : AffineMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineMinOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitError(loc, "'affine.min' op ""requires attribute 'map'"); + + if (tblgen_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_map)))) + return emitError(loc, "'affine.min' op ""attribute 'map' failed to satisfy constraint: AffineMap attribute"); + return ::mlir::success(); +} + +std::pair AffineMinOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AffineMinOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange AffineMinOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineMinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AffineMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AffineMinOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.map; + auto attr = dict.get("map"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for map in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AffineMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.map; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffineMinOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.map.getAsOpaquePointer())); +} + +std::optional AffineMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "map") + return prop.map; + return std::nullopt; +} + +void AffineMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "map") { + prop.map = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AffineMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.map) attrs.append("map", prop.map); +} + +::mlir::LogicalResult AffineMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "map", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.map))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.map); +} + +::mlir::AffineMapAttr AffineMinOp::getMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); +} + +::mlir::AffineMap AffineMinOp::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +void AffineMinOp::setMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getMapAttrName(), attr); +} + +void AffineMinOp::setMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffineMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, AffineMap affineMap, ValueRange mapOperands) { + build(odsBuilder, odsState, odsBuilder.getIndexType(), affineMap, mapOperands); + +} + +void AffineMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMapAttr map, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().map = map; + odsState.addTypes(resultType0); +} + +void AffineMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMapAttr map, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().map = map; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMap map, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + odsState.addTypes(resultType0); +} + +void AffineMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMap map, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineMinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AffineMinOp::verifyInvariantsImpl() { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitOpError("requires attribute 'map'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_map, "map"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineMinOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AffineMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineMinOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineParallelOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineParallelOpGenericAdaptorBase::AffineParallelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.parallel", odsAttrs.getContext()); +} + +AffineParallelOpGenericAdaptorBase::AffineParallelOpGenericAdaptorBase(AffineParallelOp op) : AffineParallelOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineParallelOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineParallelOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr AffineParallelOpGenericAdaptorBase::getReductionsAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().reductions); + return attr; +} + +::mlir::ArrayAttr AffineParallelOpGenericAdaptorBase::getReductions() { + auto attr = getReductionsAttr(); + return attr; +} + +::mlir::AffineMapAttr AffineParallelOpGenericAdaptorBase::getLowerBoundsMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().lowerBoundsMap); + return attr; +} + +::mlir::AffineMap AffineParallelOpGenericAdaptorBase::getLowerBoundsMap() { + auto attr = getLowerBoundsMapAttr(); + return attr.getValue(); +} + +::mlir::DenseIntElementsAttr AffineParallelOpGenericAdaptorBase::getLowerBoundsGroupsAttr() { + auto attr = ::llvm::cast<::mlir::DenseIntElementsAttr>(getProperties().lowerBoundsGroups); + return attr; +} + +::mlir::DenseIntElementsAttr AffineParallelOpGenericAdaptorBase::getLowerBoundsGroups() { + auto attr = getLowerBoundsGroupsAttr(); + return attr; +} + +::mlir::AffineMapAttr AffineParallelOpGenericAdaptorBase::getUpperBoundsMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().upperBoundsMap); + return attr; +} + +::mlir::AffineMap AffineParallelOpGenericAdaptorBase::getUpperBoundsMap() { + auto attr = getUpperBoundsMapAttr(); + return attr.getValue(); +} + +::mlir::DenseIntElementsAttr AffineParallelOpGenericAdaptorBase::getUpperBoundsGroupsAttr() { + auto attr = ::llvm::cast<::mlir::DenseIntElementsAttr>(getProperties().upperBoundsGroups); + return attr; +} + +::mlir::DenseIntElementsAttr AffineParallelOpGenericAdaptorBase::getUpperBoundsGroups() { + auto attr = getUpperBoundsGroupsAttr(); + return attr; +} + +::mlir::ArrayAttr AffineParallelOpGenericAdaptorBase::getStepsAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().steps); + return attr; +} + +::llvm::SmallVector AffineParallelOpGenericAdaptorBase::getSteps() { + auto attr = getStepsAttr(); + return llvm::to_vector<4>( + llvm::map_range(attr.getAsRange(), + [](mlir::IntegerAttr attr) { return attr.getInt(); }));; +} + +::mlir::Region &AffineParallelOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange AffineParallelOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AffineParallelOpAdaptor::AffineParallelOpAdaptor(AffineParallelOp op) : AffineParallelOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineParallelOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_lowerBoundsGroups = getProperties().lowerBoundsGroups; (void)tblgen_lowerBoundsGroups; + if (!tblgen_lowerBoundsGroups) return emitError(loc, "'affine.parallel' op ""requires attribute 'lowerBoundsGroups'"); + auto tblgen_lowerBoundsMap = getProperties().lowerBoundsMap; (void)tblgen_lowerBoundsMap; + if (!tblgen_lowerBoundsMap) return emitError(loc, "'affine.parallel' op ""requires attribute 'lowerBoundsMap'"); + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + if (!tblgen_reductions) return emitError(loc, "'affine.parallel' op ""requires attribute 'reductions'"); + auto tblgen_steps = getProperties().steps; (void)tblgen_steps; + if (!tblgen_steps) return emitError(loc, "'affine.parallel' op ""requires attribute 'steps'"); + auto tblgen_upperBoundsGroups = getProperties().upperBoundsGroups; (void)tblgen_upperBoundsGroups; + if (!tblgen_upperBoundsGroups) return emitError(loc, "'affine.parallel' op ""requires attribute 'upperBoundsGroups'"); + auto tblgen_upperBoundsMap = getProperties().upperBoundsMap; (void)tblgen_upperBoundsMap; + if (!tblgen_upperBoundsMap) return emitError(loc, "'affine.parallel' op ""requires attribute 'upperBoundsMap'"); + + if (tblgen_reductions && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reductions))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reductions), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::arith::AtomicRMWKindAttr>(attr))); })))) + return emitError(loc, "'affine.parallel' op ""attribute 'reductions' failed to satisfy constraint: Reduction ops"); + + if (tblgen_lowerBoundsMap && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_lowerBoundsMap)))) + return emitError(loc, "'affine.parallel' op ""attribute 'lowerBoundsMap' failed to satisfy constraint: AffineMap attribute"); + + if (tblgen_lowerBoundsGroups && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_lowerBoundsGroups))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_lowerBoundsGroups).getType().getElementType().isSignlessInteger(32))))) + return emitError(loc, "'affine.parallel' op ""attribute 'lowerBoundsGroups' failed to satisfy constraint: 32-bit signless integer elements attribute"); + + if (tblgen_upperBoundsMap && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_upperBoundsMap)))) + return emitError(loc, "'affine.parallel' op ""attribute 'upperBoundsMap' failed to satisfy constraint: AffineMap attribute"); + + if (tblgen_upperBoundsGroups && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_upperBoundsGroups))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_upperBoundsGroups).getType().getElementType().isSignlessInteger(32))))) + return emitError(loc, "'affine.parallel' op ""attribute 'upperBoundsGroups' failed to satisfy constraint: 32-bit signless integer elements attribute"); + + if (tblgen_steps && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_steps))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_steps), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); })))) + return emitError(loc, "'affine.parallel' op ""attribute 'steps' failed to satisfy constraint: 64-bit integer array attribute"); + return ::mlir::success(); +} + +std::pair AffineParallelOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineParallelOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AffineParallelOp::getMapOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange AffineParallelOp::getMapOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineParallelOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range AffineParallelOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range AffineParallelOp::getResults() { + return getODSResults(0); +} + +::mlir::Region &AffineParallelOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult AffineParallelOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.lowerBoundsGroups; + auto attr = dict.get("lowerBoundsGroups"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for lowerBoundsGroups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `lowerBoundsGroups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.lowerBoundsMap; + auto attr = dict.get("lowerBoundsMap"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for lowerBoundsMap in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `lowerBoundsMap` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.reductions; + auto attr = dict.get("reductions"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for reductions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.steps; + auto attr = dict.get("steps"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for steps in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `steps` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.upperBoundsGroups; + auto attr = dict.get("upperBoundsGroups"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for upperBoundsGroups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `upperBoundsGroups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.upperBoundsMap; + auto attr = dict.get("upperBoundsMap"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for upperBoundsMap in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `upperBoundsMap` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AffineParallelOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.lowerBoundsGroups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("lowerBoundsGroups", + propStorage)); + } + + { + const auto &propStorage = prop.lowerBoundsMap; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("lowerBoundsMap", + propStorage)); + } + + { + const auto &propStorage = prop.reductions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductions", + propStorage)); + } + + { + const auto &propStorage = prop.steps; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("steps", + propStorage)); + } + + { + const auto &propStorage = prop.upperBoundsGroups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("upperBoundsGroups", + propStorage)); + } + + { + const auto &propStorage = prop.upperBoundsMap; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("upperBoundsMap", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffineParallelOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.lowerBoundsGroups.getAsOpaquePointer()), + llvm::hash_value(prop.lowerBoundsMap.getAsOpaquePointer()), + llvm::hash_value(prop.reductions.getAsOpaquePointer()), + llvm::hash_value(prop.steps.getAsOpaquePointer()), + llvm::hash_value(prop.upperBoundsGroups.getAsOpaquePointer()), + llvm::hash_value(prop.upperBoundsMap.getAsOpaquePointer())); +} + +std::optional AffineParallelOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "lowerBoundsGroups") + return prop.lowerBoundsGroups; + + if (name == "lowerBoundsMap") + return prop.lowerBoundsMap; + + if (name == "reductions") + return prop.reductions; + + if (name == "steps") + return prop.steps; + + if (name == "upperBoundsGroups") + return prop.upperBoundsGroups; + + if (name == "upperBoundsMap") + return prop.upperBoundsMap; + return std::nullopt; +} + +void AffineParallelOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "lowerBoundsGroups") { + prop.lowerBoundsGroups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "lowerBoundsMap") { + prop.lowerBoundsMap = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "reductions") { + prop.reductions = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "steps") { + prop.steps = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "upperBoundsGroups") { + prop.upperBoundsGroups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "upperBoundsMap") { + prop.upperBoundsMap = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AffineParallelOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.lowerBoundsGroups) attrs.append("lowerBoundsGroups", prop.lowerBoundsGroups); + + if (prop.lowerBoundsMap) attrs.append("lowerBoundsMap", prop.lowerBoundsMap); + + if (prop.reductions) attrs.append("reductions", prop.reductions); + + if (prop.steps) attrs.append("steps", prop.steps); + + if (prop.upperBoundsGroups) attrs.append("upperBoundsGroups", prop.upperBoundsGroups); + + if (prop.upperBoundsMap) attrs.append("upperBoundsMap", prop.upperBoundsMap); +} + +::mlir::LogicalResult AffineParallelOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLowerBoundsGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps3(attr, "lowerBoundsGroups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLowerBoundsMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "lowerBoundsMap", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReductionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps2(attr, "reductions", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStepsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps4(attr, "steps", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUpperBoundsGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps3(attr, "upperBoundsGroups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUpperBoundsMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "upperBoundsMap", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineParallelOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.lowerBoundsGroups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.lowerBoundsMap))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.reductions))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.steps))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.upperBoundsGroups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.upperBoundsMap))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineParallelOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.lowerBoundsGroups); + writer.writeAttribute(prop.lowerBoundsMap); + writer.writeAttribute(prop.reductions); + writer.writeAttribute(prop.steps); + writer.writeAttribute(prop.upperBoundsGroups); + writer.writeAttribute(prop.upperBoundsMap); +} + +::mlir::ArrayAttr AffineParallelOp::getReductionsAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().reductions); +} + +::mlir::ArrayAttr AffineParallelOp::getReductions() { + auto attr = getReductionsAttr(); + return attr; +} + +::mlir::AffineMapAttr AffineParallelOp::getLowerBoundsMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().lowerBoundsMap); +} + +::mlir::AffineMap AffineParallelOp::getLowerBoundsMap() { + auto attr = getLowerBoundsMapAttr(); + return attr.getValue(); +} + +::mlir::DenseIntElementsAttr AffineParallelOp::getLowerBoundsGroupsAttr() { + return ::llvm::cast<::mlir::DenseIntElementsAttr>(getProperties().lowerBoundsGroups); +} + +::mlir::DenseIntElementsAttr AffineParallelOp::getLowerBoundsGroups() { + auto attr = getLowerBoundsGroupsAttr(); + return attr; +} + +::mlir::AffineMapAttr AffineParallelOp::getUpperBoundsMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().upperBoundsMap); +} + +::mlir::AffineMap AffineParallelOp::getUpperBoundsMap() { + auto attr = getUpperBoundsMapAttr(); + return attr.getValue(); +} + +::mlir::DenseIntElementsAttr AffineParallelOp::getUpperBoundsGroupsAttr() { + return ::llvm::cast<::mlir::DenseIntElementsAttr>(getProperties().upperBoundsGroups); +} + +::mlir::DenseIntElementsAttr AffineParallelOp::getUpperBoundsGroups() { + auto attr = getUpperBoundsGroupsAttr(); + return attr; +} + +::mlir::ArrayAttr AffineParallelOp::getStepsAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().steps); +} + +::llvm::SmallVector AffineParallelOp::getSteps() { + auto attr = getStepsAttr(); + return llvm::to_vector<4>( + llvm::map_range(attr.getAsRange(), + [](mlir::IntegerAttr attr) { return attr.getInt(); }));; +} + +void AffineParallelOp::setReductionsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReductionsAttrName(), attr); +} + +void AffineParallelOp::setLowerBoundsMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getLowerBoundsMapAttrName(), attr); +} + +void AffineParallelOp::setLowerBoundsMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getLowerBoundsMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffineParallelOp::setLowerBoundsGroupsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getLowerBoundsGroupsAttrName(), attr); +} + +void AffineParallelOp::setUpperBoundsMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getUpperBoundsMapAttrName(), attr); +} + +void AffineParallelOp::setUpperBoundsMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getUpperBoundsMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffineParallelOp::setUpperBoundsGroupsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getUpperBoundsGroupsAttrName(), attr); +} + +void AffineParallelOp::setStepsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getStepsAttrName(), attr); +} + +void AffineParallelOp::setSteps(::llvm::SmallVector attrValue) { + (*this)->setAttr(getStepsAttrName(), ::mlir::Builder((*this)->getContext()).getI64ArrayAttr(attrValue)); +} + +void AffineParallelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ArrayAttr reductions, ::mlir::AffineMapAttr lowerBoundsMap, ::mlir::DenseIntElementsAttr lowerBoundsGroups, ::mlir::AffineMapAttr upperBoundsMap, ::mlir::DenseIntElementsAttr upperBoundsGroups, ::mlir::ArrayAttr steps, ::mlir::ValueRange mapOperands) { + odsState.addOperands(mapOperands); + odsState.getOrAddProperties().reductions = reductions; + odsState.getOrAddProperties().lowerBoundsMap = lowerBoundsMap; + odsState.getOrAddProperties().lowerBoundsGroups = lowerBoundsGroups; + odsState.getOrAddProperties().upperBoundsMap = upperBoundsMap; + odsState.getOrAddProperties().upperBoundsGroups = upperBoundsGroups; + odsState.getOrAddProperties().steps = steps; + (void)odsState.addRegion(); + odsState.addTypes(results); +} + +void AffineParallelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ArrayAttr reductions, ::mlir::AffineMap lowerBoundsMap, ::mlir::DenseIntElementsAttr lowerBoundsGroups, ::mlir::AffineMap upperBoundsMap, ::mlir::DenseIntElementsAttr upperBoundsGroups, ::llvm::SmallVector steps, ::mlir::ValueRange mapOperands) { + odsState.addOperands(mapOperands); + odsState.getOrAddProperties().reductions = reductions; + odsState.getOrAddProperties().lowerBoundsMap = ::mlir::AffineMapAttr::get(lowerBoundsMap); + odsState.getOrAddProperties().lowerBoundsGroups = lowerBoundsGroups; + odsState.getOrAddProperties().upperBoundsMap = ::mlir::AffineMapAttr::get(upperBoundsMap); + odsState.getOrAddProperties().upperBoundsGroups = upperBoundsGroups; + odsState.getOrAddProperties().steps = odsBuilder.getI64ArrayAttr(steps); + (void)odsState.addRegion(); + odsState.addTypes(results); +} + +void AffineParallelOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AffineParallelOp::verifyInvariantsImpl() { + auto tblgen_lowerBoundsGroups = getProperties().lowerBoundsGroups; (void)tblgen_lowerBoundsGroups; + if (!tblgen_lowerBoundsGroups) return emitOpError("requires attribute 'lowerBoundsGroups'"); + auto tblgen_lowerBoundsMap = getProperties().lowerBoundsMap; (void)tblgen_lowerBoundsMap; + if (!tblgen_lowerBoundsMap) return emitOpError("requires attribute 'lowerBoundsMap'"); + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + if (!tblgen_reductions) return emitOpError("requires attribute 'reductions'"); + auto tblgen_steps = getProperties().steps; (void)tblgen_steps; + if (!tblgen_steps) return emitOpError("requires attribute 'steps'"); + auto tblgen_upperBoundsGroups = getProperties().upperBoundsGroups; (void)tblgen_upperBoundsGroups; + if (!tblgen_upperBoundsGroups) return emitOpError("requires attribute 'upperBoundsGroups'"); + auto tblgen_upperBoundsMap = getProperties().upperBoundsMap; (void)tblgen_upperBoundsMap; + if (!tblgen_upperBoundsMap) return emitOpError("requires attribute 'upperBoundsMap'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps2(*this, tblgen_reductions, "reductions"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_lowerBoundsMap, "lowerBoundsMap"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps3(*this, tblgen_lowerBoundsGroups, "lowerBoundsGroups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_upperBoundsMap, "upperBoundsMap"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps3(*this, tblgen_upperBoundsGroups, "upperBoundsGroups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps4(*this, tblgen_steps, "steps"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_AffineOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineParallelOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineParallelOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffinePrefetchOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffinePrefetchOpGenericAdaptorBase::AffinePrefetchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.prefetch", odsAttrs.getContext()); +} + +AffinePrefetchOpGenericAdaptorBase::AffinePrefetchOpGenericAdaptorBase(AffinePrefetchOp op) : AffinePrefetchOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffinePrefetchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffinePrefetchOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr AffinePrefetchOpGenericAdaptorBase::getIsWriteAttr() { + auto attr = ::llvm::cast<::mlir::BoolAttr>(getProperties().isWrite); + return attr; +} + +bool AffinePrefetchOpGenericAdaptorBase::getIsWrite() { + auto attr = getIsWriteAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr AffinePrefetchOpGenericAdaptorBase::getLocalityHintAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().localityHint); + return attr; +} + +uint32_t AffinePrefetchOpGenericAdaptorBase::getLocalityHint() { + auto attr = getLocalityHintAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::BoolAttr AffinePrefetchOpGenericAdaptorBase::getIsDataCacheAttr() { + auto attr = ::llvm::cast<::mlir::BoolAttr>(getProperties().isDataCache); + return attr; +} + +bool AffinePrefetchOpGenericAdaptorBase::getIsDataCache() { + auto attr = getIsDataCacheAttr(); + return attr.getValue(); +} + +::mlir::AffineMapAttr AffinePrefetchOpGenericAdaptorBase::getMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); + return attr; +} + +::mlir::AffineMap AffinePrefetchOpGenericAdaptorBase::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +} // namespace detail +AffinePrefetchOpAdaptor::AffinePrefetchOpAdaptor(AffinePrefetchOp op) : AffinePrefetchOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffinePrefetchOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_isDataCache = getProperties().isDataCache; (void)tblgen_isDataCache; + if (!tblgen_isDataCache) return emitError(loc, "'affine.prefetch' op ""requires attribute 'isDataCache'"); + auto tblgen_isWrite = getProperties().isWrite; (void)tblgen_isWrite; + if (!tblgen_isWrite) return emitError(loc, "'affine.prefetch' op ""requires attribute 'isWrite'"); + auto tblgen_localityHint = getProperties().localityHint; (void)tblgen_localityHint; + if (!tblgen_localityHint) return emitError(loc, "'affine.prefetch' op ""requires attribute 'localityHint'"); + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitError(loc, "'affine.prefetch' op ""requires attribute 'map'"); + + if (tblgen_isWrite && !((::llvm::isa<::mlir::BoolAttr>(tblgen_isWrite)))) + return emitError(loc, "'affine.prefetch' op ""attribute 'isWrite' failed to satisfy constraint: bool attribute"); + + if (tblgen_localityHint && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_localityHint))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_localityHint).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_localityHint).getInt() >= 0)) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_localityHint).getInt() <= 3)))) + return emitError(loc, "'affine.prefetch' op ""attribute 'localityHint' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 3"); + + if (tblgen_isDataCache && !((::llvm::isa<::mlir::BoolAttr>(tblgen_isDataCache)))) + return emitError(loc, "'affine.prefetch' op ""attribute 'isDataCache' failed to satisfy constraint: bool attribute"); + + if (tblgen_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_map)))) + return emitError(loc, "'affine.prefetch' op ""attribute 'map' failed to satisfy constraint: AffineMap attribute"); + return ::mlir::success(); +} + +std::pair AffinePrefetchOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffinePrefetchOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> AffinePrefetchOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range AffinePrefetchOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &AffinePrefetchOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange AffinePrefetchOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffinePrefetchOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AffinePrefetchOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AffinePrefetchOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.isDataCache; + auto attr = dict.get("isDataCache"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isDataCache in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isDataCache` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.isWrite; + auto attr = dict.get("isWrite"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isWrite in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isWrite` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.localityHint; + auto attr = dict.get("localityHint"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for localityHint in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `localityHint` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.map; + auto attr = dict.get("map"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for map in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AffinePrefetchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.isDataCache; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isDataCache", + propStorage)); + } + + { + const auto &propStorage = prop.isWrite; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isWrite", + propStorage)); + } + + { + const auto &propStorage = prop.localityHint; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("localityHint", + propStorage)); + } + + { + const auto &propStorage = prop.map; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffinePrefetchOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.isDataCache.getAsOpaquePointer()), + llvm::hash_value(prop.isWrite.getAsOpaquePointer()), + llvm::hash_value(prop.localityHint.getAsOpaquePointer()), + llvm::hash_value(prop.map.getAsOpaquePointer())); +} + +std::optional AffinePrefetchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "isDataCache") + return prop.isDataCache; + + if (name == "isWrite") + return prop.isWrite; + + if (name == "localityHint") + return prop.localityHint; + + if (name == "map") + return prop.map; + return std::nullopt; +} + +void AffinePrefetchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "isDataCache") { + prop.isDataCache = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "isWrite") { + prop.isWrite = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "localityHint") { + prop.localityHint = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "map") { + prop.map = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AffinePrefetchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.isDataCache) attrs.append("isDataCache", prop.isDataCache); + + if (prop.isWrite) attrs.append("isWrite", prop.isWrite); + + if (prop.localityHint) attrs.append("localityHint", prop.localityHint); + + if (prop.map) attrs.append("map", prop.map); +} + +::mlir::LogicalResult AffinePrefetchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIsDataCacheAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps5(attr, "isDataCache", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsWriteAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps5(attr, "isWrite", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLocalityHintAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps6(attr, "localityHint", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "map", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffinePrefetchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.isDataCache))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.isWrite))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.localityHint))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.map))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffinePrefetchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.isDataCache); + writer.writeAttribute(prop.isWrite); + writer.writeAttribute(prop.localityHint); + writer.writeAttribute(prop.map); +} + +::mlir::BoolAttr AffinePrefetchOp::getIsWriteAttr() { + return ::llvm::cast<::mlir::BoolAttr>(getProperties().isWrite); +} + +bool AffinePrefetchOp::getIsWrite() { + auto attr = getIsWriteAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr AffinePrefetchOp::getLocalityHintAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().localityHint); +} + +uint32_t AffinePrefetchOp::getLocalityHint() { + auto attr = getLocalityHintAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::BoolAttr AffinePrefetchOp::getIsDataCacheAttr() { + return ::llvm::cast<::mlir::BoolAttr>(getProperties().isDataCache); +} + +bool AffinePrefetchOp::getIsDataCache() { + auto attr = getIsDataCacheAttr(); + return attr.getValue(); +} + +::mlir::AffineMapAttr AffinePrefetchOp::getMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); +} + +::mlir::AffineMap AffinePrefetchOp::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +void AffinePrefetchOp::setIsWriteAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getIsWriteAttrName(), attr); +} + +void AffinePrefetchOp::setIsWrite(bool attrValue) { + (*this)->setAttr(getIsWriteAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void AffinePrefetchOp::setLocalityHintAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getLocalityHintAttrName(), attr); +} + +void AffinePrefetchOp::setLocalityHint(uint32_t attrValue) { + (*this)->setAttr(getLocalityHintAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void AffinePrefetchOp::setIsDataCacheAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getIsDataCacheAttrName(), attr); +} + +void AffinePrefetchOp::setIsDataCache(bool attrValue) { + (*this)->setAttr(getIsDataCacheAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void AffinePrefetchOp::setMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getMapAttrName(), attr); +} + +void AffinePrefetchOp::setMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffinePrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value memref, AffineMap map, ArrayRef mapOperands, bool isWrite, unsigned localityHint, bool isDataCache) { + assert(map.getNumInputs() == mapOperands.size() + && "inconsistent index info"); + auto localityHintAttr = odsBuilder.getI32IntegerAttr(localityHint); + auto isWriteAttr = odsBuilder.getBoolAttr(isWrite); + auto isDataCacheAttr = odsBuilder.getBoolAttr(isDataCache); + odsState.addOperands(memref); + odsState.addOperands(mapOperands); + Properties &prop = odsState.getOrAddProperties(); + prop.map = AffineMapAttr::get(map); + prop.localityHint = localityHintAttr; + prop.isWrite = isWriteAttr; + prop.isDataCache = isDataCacheAttr; + +} + +void AffinePrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr isWrite, ::mlir::IntegerAttr localityHint, ::mlir::BoolAttr isDataCache, ::mlir::AffineMapAttr map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().isWrite = isWrite; + odsState.getOrAddProperties().localityHint = localityHint; + odsState.getOrAddProperties().isDataCache = isDataCache; + odsState.getOrAddProperties().map = map; +} + +void AffinePrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr isWrite, ::mlir::IntegerAttr localityHint, ::mlir::BoolAttr isDataCache, ::mlir::AffineMapAttr map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().isWrite = isWrite; + odsState.getOrAddProperties().localityHint = localityHint; + odsState.getOrAddProperties().isDataCache = isDataCache; + odsState.getOrAddProperties().map = map; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffinePrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, bool isWrite, uint32_t localityHint, bool isDataCache, ::mlir::AffineMap map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().isWrite = odsBuilder.getBoolAttr(isWrite); + odsState.getOrAddProperties().localityHint = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), localityHint); + odsState.getOrAddProperties().isDataCache = odsBuilder.getBoolAttr(isDataCache); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); +} + +void AffinePrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, bool isWrite, uint32_t localityHint, bool isDataCache, ::mlir::AffineMap map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().isWrite = odsBuilder.getBoolAttr(isWrite); + odsState.getOrAddProperties().localityHint = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), localityHint); + odsState.getOrAddProperties().isDataCache = odsBuilder.getBoolAttr(isDataCache); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffinePrefetchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AffinePrefetchOp::verifyInvariantsImpl() { + auto tblgen_isDataCache = getProperties().isDataCache; (void)tblgen_isDataCache; + if (!tblgen_isDataCache) return emitOpError("requires attribute 'isDataCache'"); + auto tblgen_isWrite = getProperties().isWrite; (void)tblgen_isWrite; + if (!tblgen_isWrite) return emitOpError("requires attribute 'isWrite'"); + auto tblgen_localityHint = getProperties().localityHint; (void)tblgen_localityHint; + if (!tblgen_localityHint) return emitOpError("requires attribute 'localityHint'"); + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitOpError("requires attribute 'map'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps5(*this, tblgen_isWrite, "isWrite"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps6(*this, tblgen_localityHint, "localityHint"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps5(*this, tblgen_isDataCache, "isDataCache"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_map, "map"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffinePrefetchOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffinePrefetchOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineStoreOpGenericAdaptorBase::AffineStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.store", odsAttrs.getContext()); +} + +AffineStoreOpGenericAdaptorBase::AffineStoreOpGenericAdaptorBase(AffineStoreOp op) : AffineStoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::AffineMapAttr AffineStoreOpGenericAdaptorBase::getMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); + return attr; +} + +::mlir::AffineMap AffineStoreOpGenericAdaptorBase::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +} // namespace detail +AffineStoreOpAdaptor::AffineStoreOpAdaptor(AffineStoreOp op) : AffineStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineStoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitError(loc, "'affine.store' op ""requires attribute 'map'"); + + if (tblgen_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_map)))) + return emitError(loc, "'affine.store' op ""attribute 'map' failed to satisfy constraint: AffineMap attribute"); + return ::mlir::success(); +} + +std::pair AffineStoreOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AffineStoreOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> AffineStoreOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range AffineStoreOp::getIndices() { + return getODSOperands(2); +} + +::mlir::OpOperand &AffineStoreOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AffineStoreOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange AffineStoreOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AffineStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AffineStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.map; + auto attr = dict.get("map"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for map in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AffineStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.map; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffineStoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.map.getAsOpaquePointer())); +} + +std::optional AffineStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "map") + return prop.map; + return std::nullopt; +} + +void AffineStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "map") { + prop.map = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AffineStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.map) attrs.append("map", prop.map); +} + +::mlir::LogicalResult AffineStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "map", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.map))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.map); +} + +::mlir::AffineMapAttr AffineStoreOp::getMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); +} + +::mlir::AffineMap AffineStoreOp::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +void AffineStoreOp::setMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getMapAttrName(), attr); +} + +void AffineStoreOp::setMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +::mlir::LogicalResult AffineStoreOp::verifyInvariantsImpl() { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitOpError("requires attribute 'map'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_map, "map"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineStoreOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AffineStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineStoreOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineVectorLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineVectorLoadOpGenericAdaptorBase::AffineVectorLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.vector_load", odsAttrs.getContext()); +} + +AffineVectorLoadOpGenericAdaptorBase::AffineVectorLoadOpGenericAdaptorBase(AffineVectorLoadOp op) : AffineVectorLoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineVectorLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineVectorLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::AffineMapAttr AffineVectorLoadOpGenericAdaptorBase::getMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); + return attr; +} + +::mlir::AffineMap AffineVectorLoadOpGenericAdaptorBase::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +} // namespace detail +AffineVectorLoadOpAdaptor::AffineVectorLoadOpAdaptor(AffineVectorLoadOp op) : AffineVectorLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineVectorLoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitError(loc, "'affine.vector_load' op ""requires attribute 'map'"); + + if (tblgen_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_map)))) + return emitError(loc, "'affine.vector_load' op ""attribute 'map' failed to satisfy constraint: AffineMap attribute"); + return ::mlir::success(); +} + +std::pair AffineVectorLoadOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineVectorLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> AffineVectorLoadOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range AffineVectorLoadOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &AffineVectorLoadOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange AffineVectorLoadOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineVectorLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AffineVectorLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> AffineVectorLoadOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AffineVectorLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.map; + auto attr = dict.get("map"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for map in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AffineVectorLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.map; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffineVectorLoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.map.getAsOpaquePointer())); +} + +std::optional AffineVectorLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "map") + return prop.map; + return std::nullopt; +} + +void AffineVectorLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "map") { + prop.map = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AffineVectorLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.map) attrs.append("map", prop.map); +} + +::mlir::LogicalResult AffineVectorLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "map", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineVectorLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.map))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineVectorLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.map); +} + +::mlir::AffineMapAttr AffineVectorLoadOp::getMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); +} + +::mlir::AffineMap AffineVectorLoadOp::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +void AffineVectorLoadOp::setMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getMapAttrName(), attr); +} + +void AffineVectorLoadOp::setMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void AffineVectorLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMapAttr map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().map = map; + odsState.addTypes(result); +} + +void AffineVectorLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMapAttr map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().map = map; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineVectorLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMap map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + odsState.addTypes(result); +} + +void AffineVectorLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMap map) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().map = ::mlir::AffineMapAttr::get(map); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AffineVectorLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AffineVectorLoadOp::verifyInvariantsImpl() { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitOpError("requires attribute 'map'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_map, "map"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineVectorLoadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AffineVectorLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineVectorLoadOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineVectorStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineVectorStoreOpGenericAdaptorBase::AffineVectorStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.vector_store", odsAttrs.getContext()); +} + +AffineVectorStoreOpGenericAdaptorBase::AffineVectorStoreOpGenericAdaptorBase(AffineVectorStoreOp op) : AffineVectorStoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineVectorStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineVectorStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::AffineMapAttr AffineVectorStoreOpGenericAdaptorBase::getMapAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); + return attr; +} + +::mlir::AffineMap AffineVectorStoreOpGenericAdaptorBase::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +} // namespace detail +AffineVectorStoreOpAdaptor::AffineVectorStoreOpAdaptor(AffineVectorStoreOp op) : AffineVectorStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineVectorStoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitError(loc, "'affine.vector_store' op ""requires attribute 'map'"); + + if (tblgen_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_map)))) + return emitError(loc, "'affine.vector_store' op ""attribute 'map' failed to satisfy constraint: AffineMap attribute"); + return ::mlir::success(); +} + +std::pair AffineVectorStoreOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineVectorStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> AffineVectorStoreOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> AffineVectorStoreOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range AffineVectorStoreOp::getIndices() { + return getODSOperands(2); +} + +::mlir::OpOperand &AffineVectorStoreOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AffineVectorStoreOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange AffineVectorStoreOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineVectorStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AffineVectorStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AffineVectorStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.map; + auto attr = dict.get("map"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for map in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AffineVectorStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.map; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AffineVectorStoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.map.getAsOpaquePointer())); +} + +std::optional AffineVectorStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "map") + return prop.map; + return std::nullopt; +} + +void AffineVectorStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "map") { + prop.map = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AffineVectorStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.map) attrs.append("map", prop.map); +} + +::mlir::LogicalResult AffineVectorStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMapAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(attr, "map", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineVectorStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.map))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineVectorStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.map); +} + +::mlir::AffineMapAttr AffineVectorStoreOp::getMapAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().map); +} + +::mlir::AffineMap AffineVectorStoreOp::getMap() { + auto attr = getMapAttr(); + return attr.getValue(); +} + +void AffineVectorStoreOp::setMapAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getMapAttrName(), attr); +} + +void AffineVectorStoreOp::setMap(::mlir::AffineMap attrValue) { + (*this)->setAttr(getMapAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +::mlir::LogicalResult AffineVectorStoreOp::verifyInvariantsImpl() { + auto tblgen_map = getProperties().map; (void)tblgen_map; + if (!tblgen_map) return emitOpError("requires attribute 'map'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AffineOps0(*this, tblgen_map, "map"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineVectorStoreOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AffineVectorStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineVectorStoreOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineYieldOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AffineYieldOpGenericAdaptorBase::AffineYieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("affine.yield", odsAttrs.getContext()); +} + +AffineYieldOpGenericAdaptorBase::AffineYieldOpGenericAdaptorBase(AffineYieldOp op) : AffineYieldOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AffineYieldOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AffineYieldOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AffineYieldOpAdaptor::AffineYieldOpAdaptor(AffineYieldOp op) : AffineYieldOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AffineYieldOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AffineYieldOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AffineYieldOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AffineYieldOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange AffineYieldOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AffineYieldOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AffineYieldOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void AffineYieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + build(odsBuilder, odsState, std::nullopt); +} + +void AffineYieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { + odsState.addOperands(operands); +} + +void AffineYieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AffineYieldOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AffineOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AffineYieldOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AffineYieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> operandsTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (!operandsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(operandsTypes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AffineYieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (!getOperands().empty()) { + _odsPrinter << ' '; + _odsPrinter << getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperands().getTypes(); + } +} + +void AffineYieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange AffineYieldOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace affine +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineYieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h new file mode 100644 index 0000000000000000000000000000000000000000..f070d04886190635a89b445c89bf671e1c8d464c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h @@ -0,0 +1,531 @@ +//===- AffineOps.h - MLIR Affine Operations -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines convenience types for working with Affine operations +// in the MLIR operation set. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_IR_AFFINEOPS_H +#define MLIR_DIALECT_AFFINE_IR_AFFINEOPS_H + +#include "mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h" +#include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/IR/AffineMap.h" +#include "mlir/IR/Builders.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/LoopLikeInterface.h" + +namespace mlir { +namespace affine { + +class AffineApplyOp; +class AffineBound; +class AffineMaxOp; +class AffineMinOp; +class AffineValueMap; + +/// A utility function to check if a value is defined at the top level of an +/// op with trait `AffineScope` or is a region argument for such an op. A value +/// of index type defined at the top level is always a valid symbol for all its +/// uses. +bool isTopLevelValue(Value value); + +/// A utility function to check if a value is defined at the top level of +/// `region` or is an argument of `region`. A value of index type defined at the +/// top level of a `AffineScope` region is always a valid symbol for all +/// uses in that region. +bool isTopLevelValue(Value value, Region *region); + +/// Returns the closest region enclosing `op` that is held by an operation with +/// trait `AffineScope`; `nullptr` if there is no such region. +Region *getAffineScope(Operation *op); + +/// AffineDmaStartOp starts a non-blocking DMA operation that transfers data +/// from a source memref to a destination memref. The source and destination +/// memref need not be of the same dimensionality, but need to have the same +/// elemental type. The operands include the source and destination memref's +/// each followed by its indices, size of the data transfer in terms of the +/// number of elements (of the elemental type of the memref), a tag memref with +/// its indices, and optionally at the end, a stride and a +/// number_of_elements_per_stride arguments. The tag location is used by an +/// AffineDmaWaitOp to check for completion. The indices of the source memref, +/// destination memref, and the tag memref have the same restrictions as any +/// affine.load/store. In particular, index for each memref dimension must be an +/// affine expression of loop induction variables and symbols. +/// The optional stride arguments should be of 'index' type, and specify a +/// stride for the slower memory space (memory space with a lower memory space +/// id), transferring chunks of number_of_elements_per_stride every stride until +/// %num_elements are transferred. Either both or no stride arguments should be +/// specified. The value of 'num_elements' must be a multiple of +/// 'number_of_elements_per_stride'. If the source and destination locations +/// overlap the behavior of this operation is not defined. +// +// For example, an AffineDmaStartOp operation that transfers 256 elements of a +// memref '%src' in memory space 0 at indices [%i + 3, %j] to memref '%dst' in +// memory space 1 at indices [%k + 7, %l], would be specified as follows: +// +// %num_elements = arith.constant 256 +// %idx = arith.constant 0 : index +// %tag = memref.alloc() : memref<1xi32, 4> +// affine.dma_start %src[%i + 3, %j], %dst[%k + 7, %l], %tag[%idx], +// %num_elements : +// memref<40x128xf32, 0>, memref<2x1024xf32, 1>, memref<1xi32, 2> +// +// If %stride and %num_elt_per_stride are specified, the DMA is expected to +// transfer %num_elt_per_stride elements every %stride elements apart from +// memory space 0 until %num_elements are transferred. +// +// affine.dma_start %src[%i, %j], %dst[%k, %l], %tag[%idx], %num_elements, +// %stride, %num_elt_per_stride : ... +// +// TODO: add additional operands to allow source and destination striding, and +// multiple stride levels (possibly using AffineMaps to specify multiple levels +// of striding). +class AffineDmaStartOp + : public Op { +public: + using Op::Op; + static ArrayRef getAttributeNames() { return {}; } + + static void build(OpBuilder &builder, OperationState &result, Value srcMemRef, + AffineMap srcMap, ValueRange srcIndices, Value destMemRef, + AffineMap dstMap, ValueRange destIndices, Value tagMemRef, + AffineMap tagMap, ValueRange tagIndices, Value numElements, + Value stride = nullptr, Value elementsPerStride = nullptr); + + /// Returns the operand index of the source memref. + unsigned getSrcMemRefOperandIndex() { return 0; } + + /// Returns the source MemRefType for this DMA operation. + Value getSrcMemRef() { return getOperand(getSrcMemRefOperandIndex()); } + MemRefType getSrcMemRefType() { + return cast(getSrcMemRef().getType()); + } + + /// Returns the rank (number of indices) of the source MemRefType. + unsigned getSrcMemRefRank() { return getSrcMemRefType().getRank(); } + + /// Returns the affine map used to access the source memref. + AffineMap getSrcMap() { return getSrcMapAttr().getValue(); } + AffineMapAttr getSrcMapAttr() { + return cast(*(*this)->getInherentAttr(getSrcMapAttrStrName())); + } + + /// Returns the source memref affine map indices for this DMA operation. + operand_range getSrcIndices() { + return {operand_begin() + getSrcMemRefOperandIndex() + 1, + operand_begin() + getSrcMemRefOperandIndex() + 1 + + getSrcMap().getNumInputs()}; + } + + /// Returns the memory space of the source memref. + unsigned getSrcMemorySpace() { + return cast(getSrcMemRef().getType()).getMemorySpaceAsInt(); + } + + /// Returns the operand index of the destination memref. + unsigned getDstMemRefOperandIndex() { + return getSrcMemRefOperandIndex() + 1 + getSrcMap().getNumInputs(); + } + + /// Returns the destination MemRefType for this DMA operation. + Value getDstMemRef() { return getOperand(getDstMemRefOperandIndex()); } + MemRefType getDstMemRefType() { + return cast(getDstMemRef().getType()); + } + + /// Returns the rank (number of indices) of the destination MemRefType. + unsigned getDstMemRefRank() { + return cast(getDstMemRef().getType()).getRank(); + } + + /// Returns the memory space of the source memref. + unsigned getDstMemorySpace() { + return cast(getDstMemRef().getType()).getMemorySpaceAsInt(); + } + + /// Returns the affine map used to access the destination memref. + AffineMap getDstMap() { return getDstMapAttr().getValue(); } + AffineMapAttr getDstMapAttr() { + return cast(*(*this)->getInherentAttr(getDstMapAttrStrName())); + } + + /// Returns the destination memref indices for this DMA operation. + operand_range getDstIndices() { + return {operand_begin() + getDstMemRefOperandIndex() + 1, + operand_begin() + getDstMemRefOperandIndex() + 1 + + getDstMap().getNumInputs()}; + } + + /// Returns the operand index of the tag memref. + unsigned getTagMemRefOperandIndex() { + return getDstMemRefOperandIndex() + 1 + getDstMap().getNumInputs(); + } + + /// Returns the Tag MemRef for this DMA operation. + Value getTagMemRef() { return getOperand(getTagMemRefOperandIndex()); } + MemRefType getTagMemRefType() { + return cast(getTagMemRef().getType()); + } + + /// Returns the rank (number of indices) of the tag MemRefType. + unsigned getTagMemRefRank() { + return cast(getTagMemRef().getType()).getRank(); + } + + /// Returns the affine map used to access the tag memref. + AffineMap getTagMap() { return getTagMapAttr().getValue(); } + AffineMapAttr getTagMapAttr() { + return cast(*(*this)->getInherentAttr(getTagMapAttrStrName())); + } + + /// Returns the tag memref indices for this DMA operation. + operand_range getTagIndices() { + return {operand_begin() + getTagMemRefOperandIndex() + 1, + operand_begin() + getTagMemRefOperandIndex() + 1 + + getTagMap().getNumInputs()}; + } + + /// Returns the number of elements being transferred by this DMA operation. + Value getNumElements() { + return getOperand(getTagMemRefOperandIndex() + 1 + + getTagMap().getNumInputs()); + } + + /// Impelements the AffineMapAccessInterface. + /// Returns the AffineMapAttr associated with 'memref'. + NamedAttribute getAffineMapAttrForMemRef(Value memref) { + if (memref == getSrcMemRef()) + return {StringAttr::get(getContext(), getSrcMapAttrStrName()), + getSrcMapAttr()}; + if (memref == getDstMemRef()) + return {StringAttr::get(getContext(), getDstMapAttrStrName()), + getDstMapAttr()}; + assert(memref == getTagMemRef() && + "DmaStartOp expected source, destination or tag memref"); + return {StringAttr::get(getContext(), getTagMapAttrStrName()), + getTagMapAttr()}; + } + + /// Returns true if this is a DMA from a faster memory space to a slower one. + bool isDestMemorySpaceFaster() { + return (getSrcMemorySpace() < getDstMemorySpace()); + } + + /// Returns true if this is a DMA from a slower memory space to a faster one. + bool isSrcMemorySpaceFaster() { + // Assumes that a lower number is for a slower memory space. + return (getDstMemorySpace() < getSrcMemorySpace()); + } + + /// Given a DMA start operation, returns the operand position of either the + /// source or destination memref depending on the one that is at the higher + /// level of the memory hierarchy. Asserts failure if neither is true. + unsigned getFasterMemPos() { + assert(isSrcMemorySpaceFaster() || isDestMemorySpaceFaster()); + return isSrcMemorySpaceFaster() ? 0 : getDstMemRefOperandIndex(); + } + + void + getEffects(SmallVectorImpl> + &effects); + + static StringRef getSrcMapAttrStrName() { return "src_map"; } + static StringRef getDstMapAttrStrName() { return "dst_map"; } + static StringRef getTagMapAttrStrName() { return "tag_map"; } + + static StringRef getOperationName() { return "affine.dma_start"; } + static ParseResult parse(OpAsmParser &parser, OperationState &result); + void print(OpAsmPrinter &p); + LogicalResult verifyInvariantsImpl(); + LogicalResult verifyInvariants() { return verifyInvariantsImpl(); } + LogicalResult fold(ArrayRef cstOperands, + SmallVectorImpl &results); + + /// Returns true if this DMA operation is strided, returns false otherwise. + bool isStrided() { + return getNumOperands() != + getTagMemRefOperandIndex() + 1 + getTagMap().getNumInputs() + 1; + } + + /// Returns the stride value for this DMA operation. + Value getStride() { + if (!isStrided()) + return nullptr; + return getOperand(getNumOperands() - 1 - 1); + } + + /// Returns the number of elements to transfer per stride for this DMA op. + Value getNumElementsPerStride() { + if (!isStrided()) + return nullptr; + return getOperand(getNumOperands() - 1); + } +}; + +/// AffineDmaWaitOp blocks until the completion of a DMA operation associated +/// with the tag element '%tag[%index]'. %tag is a memref, and %index has to be +/// an index with the same restrictions as any load/store index. In particular, +/// index for each memref dimension must be an affine expression of loop +/// induction variables and symbols. %num_elements is the number of elements +/// associated with the DMA operation. For example: +// +// affine.dma_start %src[%i, %j], %dst[%k, %l], %tag[%index], %num_elements : +// memref<2048xf32, 0>, memref<256xf32, 1>, memref<1xi32, 2> +// ... +// ... +// affine.dma_wait %tag[%index], %num_elements : memref<1xi32, 2> +// +class AffineDmaWaitOp + : public Op { +public: + using Op::Op; + static ArrayRef getAttributeNames() { return {}; } + + static void build(OpBuilder &builder, OperationState &result, Value tagMemRef, + AffineMap tagMap, ValueRange tagIndices, Value numElements); + + static StringRef getOperationName() { return "affine.dma_wait"; } + + /// Returns the Tag MemRef associated with the DMA operation being waited on. + Value getTagMemRef() { return getOperand(0); } + MemRefType getTagMemRefType() { + return cast(getTagMemRef().getType()); + } + + /// Returns the affine map used to access the tag memref. + AffineMap getTagMap() { return getTagMapAttr().getValue(); } + AffineMapAttr getTagMapAttr() { + return cast(*(*this)->getInherentAttr(getTagMapAttrStrName())); + } + + /// Returns the tag memref index for this DMA operation. + operand_range getTagIndices() { + return {operand_begin() + 1, + operand_begin() + 1 + getTagMap().getNumInputs()}; + } + + /// Returns the rank (number of indices) of the tag memref. + unsigned getTagMemRefRank() { + return cast(getTagMemRef().getType()).getRank(); + } + + /// Impelements the AffineMapAccessInterface. Returns the AffineMapAttr + /// associated with 'memref'. + NamedAttribute getAffineMapAttrForMemRef(Value memref) { + assert(memref == getTagMemRef()); + return {StringAttr::get(getContext(), getTagMapAttrStrName()), + getTagMapAttr()}; + } + + /// Returns the number of elements transferred by the associated DMA op. + Value getNumElements() { return getOperand(1 + getTagMap().getNumInputs()); } + + static StringRef getTagMapAttrStrName() { return "tag_map"; } + static ParseResult parse(OpAsmParser &parser, OperationState &result); + void print(OpAsmPrinter &p); + LogicalResult verifyInvariantsImpl(); + LogicalResult verifyInvariants() { return verifyInvariantsImpl(); } + LogicalResult fold(ArrayRef cstOperands, + SmallVectorImpl &results); + void + getEffects(SmallVectorImpl> + &effects); +}; + +/// Returns true if the given Value can be used as a dimension id in the region +/// of the closest surrounding op that has the trait `AffineScope`. +bool isValidDim(Value value); + +/// Returns true if the given Value can be used as a dimension id in `region`, +/// i.e., for all its uses in `region`. +bool isValidDim(Value value, Region *region); + +/// Returns true if the given value can be used as a symbol in the region of the +/// closest surrounding op that has the trait `AffineScope`. +bool isValidSymbol(Value value); + +/// Returns true if the given Value can be used as a symbol for `region`, i.e., +/// for all its uses in `region`. +bool isValidSymbol(Value value, Region *region); + +/// Parses dimension and symbol list. `numDims` is set to the number of +/// dimensions in the list parsed. +ParseResult parseDimAndSymbolList(OpAsmParser &parser, + SmallVectorImpl &operands, + unsigned &numDims); + +/// Modifies both `map` and `operands` in-place so as to: +/// 1. drop duplicate operands +/// 2. drop unused dims and symbols from map +/// 3. promote valid symbols to symbolic operands in case they appeared as +/// dimensional operands +/// 4. propagate constant operands and drop them +void canonicalizeMapAndOperands(AffineMap *map, + SmallVectorImpl *operands); + +/// Canonicalizes an integer set the same way canonicalizeMapAndOperands does +/// for affine maps. +void canonicalizeSetAndOperands(IntegerSet *set, + SmallVectorImpl *operands); + +/// Returns a composed AffineApplyOp by composing `map` and `operands` with +/// other AffineApplyOps supplying those operands. The operands of the resulting +/// AffineApplyOp do not change the length of AffineApplyOp chains. +AffineApplyOp makeComposedAffineApply(OpBuilder &b, Location loc, AffineMap map, + ArrayRef operands); +AffineApplyOp makeComposedAffineApply(OpBuilder &b, Location loc, AffineExpr e, + ArrayRef operands); + +/// Constructs an AffineApplyOp that applies `map` to `operands` after composing +/// the map with the maps of any other AffineApplyOp supplying the operands, +/// then immediately attempts to fold it. If folding results in a constant +/// value, no ops are actually created. The `map` must be a single-result affine +/// map. +OpFoldResult makeComposedFoldedAffineApply(OpBuilder &b, Location loc, + AffineMap map, + ArrayRef operands); +/// Variant of `makeComposedFoldedAffineApply` that applies to an expression. +OpFoldResult makeComposedFoldedAffineApply(OpBuilder &b, Location loc, + AffineExpr expr, + ArrayRef operands); +/// Variant of `makeComposedFoldedAffineApply` suitable for multi-result maps. +/// Note that this may create as many affine.apply operations as the map has +/// results given that affine.apply must be single-result. +SmallVector makeComposedFoldedMultiResultAffineApply( + OpBuilder &b, Location loc, AffineMap map, ArrayRef operands); + +/// Returns an AffineMinOp obtained by composing `map` and `operands` with +/// AffineApplyOps supplying those operands. +AffineMinOp makeComposedAffineMin(OpBuilder &b, Location loc, AffineMap map, + ArrayRef operands); + +/// Constructs an AffineMinOp that computes a minimum across the results of +/// applying `map` to `operands`, then immediately attempts to fold it. If +/// folding results in a constant value, no ops are actually created. +OpFoldResult makeComposedFoldedAffineMin(OpBuilder &b, Location loc, + AffineMap map, + ArrayRef operands); + +/// Constructs an AffineMinOp that computes a maximum across the results of +/// applying `map` to `operands`, then immediately attempts to fold it. If +/// folding results in a constant value, no ops are actually created. +OpFoldResult makeComposedFoldedAffineMax(OpBuilder &b, Location loc, + AffineMap map, + ArrayRef operands); + +/// Given an affine map `map` and its input `operands`, this method composes +/// into `map`, maps of AffineApplyOps whose results are the values in +/// `operands`, iteratively until no more of `operands` are the result of an +/// AffineApplyOp. When this function returns, `map` becomes the composed affine +/// map, and each Value in `operands` is guaranteed to be either a loop IV or a +/// terminal symbol, i.e., a symbol defined at the top level or a block/function +/// argument. +void fullyComposeAffineMapAndOperands(AffineMap *map, + SmallVectorImpl *operands); + +} // namespace affine +} // namespace mlir + +#include "mlir/Dialect/Affine/IR/AffineOpsDialect.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/Affine/IR/AffineOps.h.inc" + +namespace mlir { +namespace affine { + +/// Returns true if the provided value is the induction variable of an +/// AffineForOp. +bool isAffineForInductionVar(Value val); + +/// Returns true if `val` is the induction variable of an AffineParallelOp. +bool isAffineParallelInductionVar(Value val); + +/// Returns true if the provided value is the induction variable of an +/// AffineForOp or AffineParallelOp. +bool isAffineInductionVar(Value val); + +/// Returns the loop parent of an induction variable. If the provided value is +/// not an induction variable, then return nullptr. +AffineForOp getForInductionVarOwner(Value val); + +/// Returns true if the provided value is among the induction variables of an +/// AffineParallelOp. +AffineParallelOp getAffineParallelInductionVarOwner(Value val); + +/// Extracts the induction variables from a list of AffineForOps and places them +/// in the output argument `ivs`. +void extractForInductionVars(ArrayRef forInsts, + SmallVectorImpl *ivs); + +/// Extracts the induction variables from a list of either AffineForOp or +/// AffineParallelOp and places them in the output argument `ivs`. +void extractInductionVars(ArrayRef affineOps, + SmallVectorImpl &ivs); + +/// Builds a perfect nest of affine.for loops, i.e., each loop except the +/// innermost one contains only another loop and a terminator. The loops iterate +/// from "lbs" to "ubs" with "steps". The body of the innermost loop is +/// populated by calling "bodyBuilderFn" and providing it with an OpBuilder, a +/// Location and a list of loop induction variables. +void buildAffineLoopNest(OpBuilder &builder, Location loc, + ArrayRef lbs, ArrayRef ubs, + ArrayRef steps, + function_ref + bodyBuilderFn = nullptr); +void buildAffineLoopNest(OpBuilder &builder, Location loc, ValueRange lbs, + ValueRange ubs, ArrayRef steps, + function_ref + bodyBuilderFn = nullptr); + +/// AffineBound represents a lower or upper bound in the for operation. +/// This class does not own the underlying operands. Instead, it refers +/// to the operands stored in the AffineForOp. Its life span should not exceed +/// that of the for operation it refers to. +class AffineBound { +public: + AffineForOp getAffineForOp() { return op; } + AffineMap getMap() { return map; } + + unsigned getNumOperands() { return operands.size(); } + Value getOperand(unsigned idx) { + return op.getOperand(operands.getBeginOperandIndex() + idx); + } + + using operand_iterator = AffineForOp::operand_iterator; + using operand_range = AffineForOp::operand_range; + + operand_iterator operandBegin() { return operands.begin(); } + operand_iterator operandEnd() { return operands.end(); } + operand_range getOperands() { return {operandBegin(), operandEnd()}; } + +private: + // 'affine.for' operation that contains this bound. + AffineForOp op; + // Operands of the affine map. + OperandRange operands; + // Affine map for this bound. + AffineMap map; + + AffineBound(AffineForOp op, OperandRange operands, AffineMap map) + : op(op), operands(operands), map(map) {} + + friend class AffineForOp; +}; + +} // namespace affine +} // namespace mlir + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..f1989728b46d71fcb93c8434ddae2636dd64e908 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h.inc @@ -0,0 +1,2664 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AffineOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace affine { +class AffineApplyOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineDelinearizeIndexOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineForOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineIfOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineLoadOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineMaxOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineMinOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineParallelOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffinePrefetchOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineStoreOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineVectorLoadOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineVectorStoreOp; +} // namespace affine +} // namespace mlir +namespace mlir { +namespace affine { +class AffineYieldOp; +} // namespace affine +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineApplyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineApplyOpGenericAdaptorBase { +public: + struct Properties { + using mapTy = ::mlir::AffineMapAttr; + mapTy map; + + auto getMap() { + auto &propStorage = this->map; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setMap(const ::mlir::AffineMapAttr &propValue) { + this->map = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.map == this->map && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffineApplyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineApplyOpGenericAdaptorBase(AffineApplyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); +}; +} // namespace detail +template +class AffineApplyOpGenericAdaptor : public detail::AffineApplyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineApplyOpGenericAdaptorBase; +public: + AffineApplyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineApplyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineApplyOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffineApplyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getMapOperands() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffineApplyOpAdaptor : public AffineApplyOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineApplyOpGenericAdaptor::AffineApplyOpGenericAdaptor; + AffineApplyOpAdaptor(AffineApplyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineApplyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineApplyOpAdaptor; + template + using GenericAdaptor = AffineApplyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("map")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMapAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.apply"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getMapOperands(); + ::mlir::MutableOperandRange getMapOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); + void setMapAttr(::mlir::AffineMapAttr attr); + void setMap(::mlir::AffineMap attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, AffineMap map, ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef exprList, ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMapAttr map, ::mlir::ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMapAttr map, ::mlir::ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMap map, ::mlir::ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMap map, ::mlir::ValueRange mapOperands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the affine map to be applied by this operation. + AffineMap getAffineMap() { return getMap(); } + + /// Returns the affine value map computed from this operation. + AffineValueMap getAffineValueMap(); + + /// Returns true if the result of this operation can be used as dimension id + /// in the region of the closest surrounding op with trait AffineScope. + bool isValidDim(); + + /// Returns true if the result of this operation can be used as dimension id + /// within 'region', i.e., for all its uses with `region`. + bool isValidDim(Region *region); + + /// Returns true if the result of this operation is a symbol in the region + /// of the closest surrounding op that has the trait AffineScope. + bool isValidSymbol(); + + /// Returns true if the result of this operation is a symbol for all its + /// uses in `region`. + bool isValidSymbol(Region *region); + + /// Returns all dimension operands. + ValueRange getDimOperands() { + return OperandRange{getOperands().begin(), + getOperands().begin() + getMap().getNumDims()}; + } + + /// Returns all symbol operands. + ValueRange getSymbolOperands() { + return OperandRange{getOperands().begin() + getMap().getNumDims(), + getOperands().end()}; + } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineApplyOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineDelinearizeIndexOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineDelinearizeIndexOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AffineDelinearizeIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineDelinearizeIndexOpGenericAdaptorBase(AffineDelinearizeIndexOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AffineDelinearizeIndexOpGenericAdaptor : public detail::AffineDelinearizeIndexOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineDelinearizeIndexOpGenericAdaptorBase; +public: + AffineDelinearizeIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineDelinearizeIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineDelinearizeIndexOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AffineDelinearizeIndexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLinearIndex() { + return (*getODSOperands(0).begin()); + } + + RangeT getBasis() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffineDelinearizeIndexOpAdaptor : public AffineDelinearizeIndexOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineDelinearizeIndexOpGenericAdaptor::AffineDelinearizeIndexOpGenericAdaptor; + AffineDelinearizeIndexOpAdaptor(AffineDelinearizeIndexOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineDelinearizeIndexOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineDelinearizeIndexOpAdaptor; + template + using GenericAdaptor = AffineDelinearizeIndexOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.delinearize_index"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLinearIndex(); + ::mlir::Operation::operand_range getBasis(); + ::mlir::OpOperand &getLinearIndexMutable(); + ::mlir::MutableOperandRange getBasisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getMultiIndex(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value linear_index, ArrayRef basis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange multi_index, ::mlir::Value linear_index, ::mlir::ValueRange basis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineDelinearizeIndexOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineForOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineForOpGenericAdaptorBase { +public: + struct Properties { + using lowerBoundMapTy = ::mlir::AffineMapAttr; + lowerBoundMapTy lowerBoundMap; + + auto getLowerBoundMap() { + auto &propStorage = this->lowerBoundMap; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setLowerBoundMap(const ::mlir::AffineMapAttr &propValue) { + this->lowerBoundMap = propValue; + } + using stepTy = ::mlir::IntegerAttr; + stepTy step; + + auto getStep() { + auto &propStorage = this->step; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setStep(const ::mlir::IntegerAttr &propValue) { + this->step = propValue; + } + using upperBoundMapTy = ::mlir::AffineMapAttr; + upperBoundMapTy upperBoundMap; + + auto getUpperBoundMap() { + auto &propStorage = this->upperBoundMap; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setUpperBoundMap(const ::mlir::AffineMapAttr &propValue) { + this->upperBoundMap = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.lowerBoundMap == this->lowerBoundMap && + rhs.step == this->step && + rhs.upperBoundMap == this->upperBoundMap && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffineForOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineForOpGenericAdaptorBase(AffineForOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::AffineMapAttr getLowerBoundMapAttr(); + ::mlir::AffineMap getLowerBoundMap(); + ::mlir::AffineMapAttr getUpperBoundMapAttr(); + ::mlir::AffineMap getUpperBoundMap(); + ::mlir::IntegerAttr getStepAttr(); + ::llvm::APInt getStep(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AffineForOpGenericAdaptor : public detail::AffineForOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineForOpGenericAdaptorBase; +public: + AffineForOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineForOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineForOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffineForOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getLowerBoundOperands() { + return getODSOperands(0); + } + + RangeT getUpperBoundOperands() { + return getODSOperands(1); + } + + RangeT getInits() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffineForOpAdaptor : public AffineForOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineForOpGenericAdaptor::AffineForOpGenericAdaptor; + AffineForOpAdaptor(AffineForOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineForOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::LoopLikeOpInterface::Trait, ::mlir::RegionBranchOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineForOpAdaptor; + template + using GenericAdaptor = AffineForOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("lowerBoundMap"), ::llvm::StringRef("step"), ::llvm::StringRef("upperBoundMap"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLowerBoundMapAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLowerBoundMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStepAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStepAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUpperBoundMapAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUpperBoundMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.for"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getLowerBoundOperands(); + ::mlir::Operation::operand_range getUpperBoundOperands(); + ::mlir::Operation::operand_range getInits(); + ::mlir::MutableOperandRange getLowerBoundOperandsMutable(); + ::mlir::MutableOperandRange getUpperBoundOperandsMutable(); + ::mlir::MutableOperandRange getInitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::AffineMapAttr getLowerBoundMapAttr(); + ::mlir::AffineMap getLowerBoundMap(); + ::mlir::AffineMapAttr getUpperBoundMapAttr(); + ::mlir::AffineMap getUpperBoundMap(); + ::mlir::IntegerAttr getStepAttr(); + ::llvm::APInt getStep(); + void setLowerBoundMapAttr(::mlir::AffineMapAttr attr); + void setLowerBoundMap(::mlir::AffineMap attrValue); + void setUpperBoundMapAttr(::mlir::AffineMapAttr attr); + void setUpperBoundMap(::mlir::AffineMap attrValue); + void setStepAttr(::mlir::IntegerAttr attr); + void setStep(::llvm::APInt attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, int64_t lowerBound, int64_t upperBound, int64_t step = 1, ValueRange iterArgs = std::nullopt, function_ref bodyBuilder = nullptr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange lbOperands, AffineMap lbMap, ValueRange ubOperands, AffineMap ubMap, int64_t step = 1, ValueRange iterArgs = std::nullopt, function_ref bodyBuilder = nullptr); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + ::llvm::SmallVector<::mlir::Region *> getLoopRegions(); + ::std::optional<::mlir::Value> getSingleInductionVar(); + ::std::optional<::mlir::OpFoldResult> getSingleLowerBound(); + ::std::optional<::mlir::OpFoldResult> getSingleStep(); + ::std::optional<::mlir::OpFoldResult> getSingleUpperBound(); + ::mlir::FailureOr<::mlir::LoopLikeOpInterface> replaceWithAdditionalYields(::mlir::RewriterBase &rewriter, ::mlir::ValueRange newInitOperands, bool replaceInitOperandUsesInLoop, const ::mlir::NewYieldValuesFn &newYieldValuesFn); + ::mlir::OperandRange getEntrySuccessorOperands(::mlir::RegionBranchPoint point); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Defining the function type we use for building the body of affine.for. + using BodyBuilderFn = + function_ref; + + BlockArgument getInductionVar() { return getBody()->getArgument(0); } + Block::BlockArgListType getRegionIterArgs() { + return getBody()->getArguments().drop_front(); + } + + /// Returns operands for the lower and upper bound maps with the operands + /// for the lower bound map in front of those for the upper bound map. + operand_range getControlOperands(); + + /// Returns information about the lower bound as a single object. + AffineBound getLowerBound(); + + /// Returns information about the upper bound as a single object. + AffineBound getUpperBound(); + + /// Returns loop step. + int64_t getStepAsInt() { return getStep().getSExtValue(); } + + /// Set lower bound. The new bound must have the same number of operands as + /// the current bound map. Otherwise, 'replaceForLowerBound' should be used. + void setLowerBound(ValueRange operands, AffineMap map); + /// Set upper bound. The new bound must not have more operands than the + /// current bound map. Otherwise, 'replaceForUpperBound' should be used. + void setUpperBound(ValueRange operands, AffineMap map); + + /// Set loop step. + void setStep(int64_t step) { + assert(step > 0 && "step has to be a positive integer constant"); + setStep(APInt(/*numBits=*/64, step, /*isSigned=*/true)); + } + + /// Returns number of region arguments for loop-carried values. + unsigned getNumRegionIterArgs() { + return getBody()->getNumArguments() - 1; + } + + /// Number of operands controlling the loop: lb and ub. + unsigned getNumControlOperands() { + return getOperation()->getNumOperands() - getNumIterOperands(); + } + + /// Get the number of loop-carried values. + unsigned getNumIterOperands(); + + /// Returns true if the lower bound is constant. + bool hasConstantLowerBound(); + /// Returns true if the upper bound is constant. + bool hasConstantUpperBound(); + /// Returns true if both bounds are constant. + bool hasConstantBounds() { + return hasConstantLowerBound() && hasConstantUpperBound(); + } + /// Returns the value of the constant lower bound. + /// Fails assertion if the bound is non-constant. + int64_t getConstantLowerBound(); + /// Returns the value of the constant upper bound. The upper bound is + /// exclusive. Fails assertion if the bound is non-constant. + int64_t getConstantUpperBound(); + /// Sets the lower bound to the given constant value. + void setConstantLowerBound(int64_t value); + /// Sets the upper bound to the given constant value. + void setConstantUpperBound(int64_t value); + + /// Returns true if both the lower and upper bound have the same operand + /// lists (same operands in the same order). + bool matchingBoundOperandList(); + + /// Interface method for ConditionallySpeculatable. + Speculation::Speculatability getSpeculatability(); +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineForOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineIfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineIfOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AffineIfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineIfOpGenericAdaptorBase(AffineIfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getThenRegion(); + ::mlir::Region &getElseRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AffineIfOpGenericAdaptor : public detail::AffineIfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineIfOpGenericAdaptorBase; +public: + AffineIfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineIfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineIfOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AffineIfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffineIfOpAdaptor : public AffineIfOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineIfOpGenericAdaptor::AffineIfOpGenericAdaptor; + AffineIfOpAdaptor(AffineIfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineIfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::RecursivelySpeculatableImplTrait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::RegionBranchOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineIfOpAdaptor; + template + using GenericAdaptor = AffineIfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.if"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getThenRegion(); + ::mlir::Region &getElseRegion(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, IntegerSet set, ValueRange args, bool withElseRegion); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTypes, IntegerSet set, ValueRange args, bool withElseRegion); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); +public: + static StringRef getConditionAttrStrName() { return "condition"; } + + IntegerSet getIntegerSet(); + void setIntegerSet(IntegerSet newSet); + + /// Sets the integer set with its operands. + void setConditional(IntegerSet set, ValueRange operands); + + /// Returns true if an else block exists. + bool hasElse() { return !getElseRegion().empty(); } + + Block *getThenBlock() { + assert(!getThenRegion().empty() && "Unexpected empty 'then' region."); + return &getThenRegion().front(); + } + + Block *getElseBlock() { + assert(hasElse() && "Empty 'else' region."); + return &getElseRegion().front(); + } + + OpBuilder getThenBodyBuilder() { + assert(!getThenRegion().empty() && "Unexpected empty 'then' region."); + Block &body = getThenRegion().front(); + return OpBuilder(&body, std::prev(body.end())); + } + OpBuilder getElseBodyBuilder() { + assert(hasElse() && "No 'else' block"); + Block &body = getElseRegion().front(); + return OpBuilder(&body, std::prev(body.end())); + } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineIfOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineLoadOpGenericAdaptorBase { +public: + struct Properties { + using mapTy = ::mlir::AffineMapAttr; + mapTy map; + + auto getMap() { + auto &propStorage = this->map; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setMap(const ::mlir::AffineMapAttr &propValue) { + this->map = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.map == this->map && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffineLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineLoadOpGenericAdaptorBase(AffineLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); +}; +} // namespace detail +template +class AffineLoadOpGenericAdaptor : public detail::AffineLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineLoadOpGenericAdaptorBase; +public: + AffineLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffineLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffineLoadOpAdaptor : public AffineLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineLoadOpGenericAdaptor::AffineLoadOpGenericAdaptor; + AffineLoadOpAdaptor(AffineLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::affine::AffineReadOpInterface::Trait, ::mlir::affine::AffineMapAccessInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineLoadOpAdaptor; + template + using GenericAdaptor = AffineLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("map")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMapAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); + void setMapAttr(::mlir::AffineMapAttr attr); + void setMap(::mlir::AffineMap attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, AffineMap map, ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value memref, ValueRange indices = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value memref, AffineMap map, ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMapAttr map); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMapAttr map); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMap map); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMap map); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the operand index of the memref. + unsigned getMemRefOperandIndex() { return 0; } + + void setMemRef(Value value) { setOperand(getMemRefOperandIndex(), value); } + + /// Returns the affine map used to index the memref for this operation. + AffineMapAttr getAffineMapAttr() { + return getProperties().map; + } + + static StringRef getMapAttrStrName() { return "map"; } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineLoadOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineMaxOpGenericAdaptorBase { +public: + struct Properties { + using mapTy = ::mlir::AffineMapAttr; + mapTy map; + + auto getMap() { + auto &propStorage = this->map; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setMap(const ::mlir::AffineMapAttr &propValue) { + this->map = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.map == this->map && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffineMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineMaxOpGenericAdaptorBase(AffineMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); +}; +} // namespace detail +template +class AffineMaxOpGenericAdaptor : public detail::AffineMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineMaxOpGenericAdaptorBase; +public: + AffineMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffineMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class AffineMaxOpAdaptor : public AffineMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineMaxOpGenericAdaptor::AffineMaxOpGenericAdaptor; + AffineMaxOpAdaptor(AffineMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineMaxOpAdaptor; + template + using GenericAdaptor = AffineMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("map")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMapAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.max"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); + void setMapAttr(::mlir::AffineMapAttr attr); + void setMap(::mlir::AffineMap attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, AffineMap affineMap, ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMapAttr map, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMapAttr map, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMap map, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMap map, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static StringRef getMapAttrStrName() { return "map"; } + AffineMap getAffineMap() { return getMap(); } + ValueRange getMapOperands() { return getOperands(); } + ValueRange getDimOperands() { + return OperandRange{getOperands().begin(), + getOperands().begin() + getMap().getNumDims()}; + } + ValueRange getSymbolOperands() { + return OperandRange{getOperands().begin() + getMap().getNumDims(), + getOperands().end()}; + } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineMaxOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineMinOpGenericAdaptorBase { +public: + struct Properties { + using mapTy = ::mlir::AffineMapAttr; + mapTy map; + + auto getMap() { + auto &propStorage = this->map; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setMap(const ::mlir::AffineMapAttr &propValue) { + this->map = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.map == this->map && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffineMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineMinOpGenericAdaptorBase(AffineMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); +}; +} // namespace detail +template +class AffineMinOpGenericAdaptor : public detail::AffineMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineMinOpGenericAdaptorBase; +public: + AffineMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineMinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffineMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class AffineMinOpAdaptor : public AffineMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineMinOpGenericAdaptor::AffineMinOpGenericAdaptor; + AffineMinOpAdaptor(AffineMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineMinOpAdaptor; + template + using GenericAdaptor = AffineMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("map")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMapAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.min"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); + void setMapAttr(::mlir::AffineMapAttr attr); + void setMap(::mlir::AffineMap attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, AffineMap affineMap, ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMapAttr map, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMapAttr map, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::AffineMap map, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::AffineMap map, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static StringRef getMapAttrStrName() { return "map"; } + AffineMap getAffineMap() { return getMap(); } + ValueRange getMapOperands() { return getOperands(); } + ValueRange getDimOperands() { + return OperandRange{getOperands().begin(), + getOperands().begin() + getMap().getNumDims()}; + } + ValueRange getSymbolOperands() { + return OperandRange{getOperands().begin() + getMap().getNumDims(), + getOperands().end()}; + } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineMinOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineParallelOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineParallelOpGenericAdaptorBase { +public: + struct Properties { + using lowerBoundsGroupsTy = ::mlir::DenseIntElementsAttr; + lowerBoundsGroupsTy lowerBoundsGroups; + + auto getLowerBoundsGroups() { + auto &propStorage = this->lowerBoundsGroups; + return ::llvm::cast<::mlir::DenseIntElementsAttr>(propStorage); + } + void setLowerBoundsGroups(const ::mlir::DenseIntElementsAttr &propValue) { + this->lowerBoundsGroups = propValue; + } + using lowerBoundsMapTy = ::mlir::AffineMapAttr; + lowerBoundsMapTy lowerBoundsMap; + + auto getLowerBoundsMap() { + auto &propStorage = this->lowerBoundsMap; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setLowerBoundsMap(const ::mlir::AffineMapAttr &propValue) { + this->lowerBoundsMap = propValue; + } + using reductionsTy = ::mlir::ArrayAttr; + reductionsTy reductions; + + auto getReductions() { + auto &propStorage = this->reductions; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setReductions(const ::mlir::ArrayAttr &propValue) { + this->reductions = propValue; + } + using stepsTy = ::mlir::ArrayAttr; + stepsTy steps; + + auto getSteps() { + auto &propStorage = this->steps; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setSteps(const ::mlir::ArrayAttr &propValue) { + this->steps = propValue; + } + using upperBoundsGroupsTy = ::mlir::DenseIntElementsAttr; + upperBoundsGroupsTy upperBoundsGroups; + + auto getUpperBoundsGroups() { + auto &propStorage = this->upperBoundsGroups; + return ::llvm::cast<::mlir::DenseIntElementsAttr>(propStorage); + } + void setUpperBoundsGroups(const ::mlir::DenseIntElementsAttr &propValue) { + this->upperBoundsGroups = propValue; + } + using upperBoundsMapTy = ::mlir::AffineMapAttr; + upperBoundsMapTy upperBoundsMap; + + auto getUpperBoundsMap() { + auto &propStorage = this->upperBoundsMap; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setUpperBoundsMap(const ::mlir::AffineMapAttr &propValue) { + this->upperBoundsMap = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.lowerBoundsGroups == this->lowerBoundsGroups && + rhs.lowerBoundsMap == this->lowerBoundsMap && + rhs.reductions == this->reductions && + rhs.steps == this->steps && + rhs.upperBoundsGroups == this->upperBoundsGroups && + rhs.upperBoundsMap == this->upperBoundsMap && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffineParallelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineParallelOpGenericAdaptorBase(AffineParallelOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getReductionsAttr(); + ::mlir::ArrayAttr getReductions(); + ::mlir::AffineMapAttr getLowerBoundsMapAttr(); + ::mlir::AffineMap getLowerBoundsMap(); + ::mlir::DenseIntElementsAttr getLowerBoundsGroupsAttr(); + ::mlir::DenseIntElementsAttr getLowerBoundsGroups(); + ::mlir::AffineMapAttr getUpperBoundsMapAttr(); + ::mlir::AffineMap getUpperBoundsMap(); + ::mlir::DenseIntElementsAttr getUpperBoundsGroupsAttr(); + ::mlir::DenseIntElementsAttr getUpperBoundsGroups(); + ::mlir::ArrayAttr getStepsAttr(); + ::llvm::SmallVector getSteps(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AffineParallelOpGenericAdaptor : public detail::AffineParallelOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineParallelOpGenericAdaptorBase; +public: + AffineParallelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineParallelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineParallelOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffineParallelOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getMapOperands() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffineParallelOpAdaptor : public AffineParallelOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineParallelOpGenericAdaptor::AffineParallelOpGenericAdaptor; + AffineParallelOpAdaptor(AffineParallelOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineParallelOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::RecursivelySpeculatableImplTrait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::LoopLikeOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineParallelOpAdaptor; + template + using GenericAdaptor = AffineParallelOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("lowerBoundsGroups"), ::llvm::StringRef("lowerBoundsMap"), ::llvm::StringRef("reductions"), ::llvm::StringRef("steps"), ::llvm::StringRef("upperBoundsGroups"), ::llvm::StringRef("upperBoundsMap")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLowerBoundsGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLowerBoundsGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLowerBoundsMapAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLowerBoundsMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReductionsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReductionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStepsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStepsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getUpperBoundsGroupsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getUpperBoundsGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUpperBoundsMapAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUpperBoundsMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.parallel"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getMapOperands(); + ::mlir::MutableOperandRange getMapOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getReductionsAttr(); + ::mlir::ArrayAttr getReductions(); + ::mlir::AffineMapAttr getLowerBoundsMapAttr(); + ::mlir::AffineMap getLowerBoundsMap(); + ::mlir::DenseIntElementsAttr getLowerBoundsGroupsAttr(); + ::mlir::DenseIntElementsAttr getLowerBoundsGroups(); + ::mlir::AffineMapAttr getUpperBoundsMapAttr(); + ::mlir::AffineMap getUpperBoundsMap(); + ::mlir::DenseIntElementsAttr getUpperBoundsGroupsAttr(); + ::mlir::DenseIntElementsAttr getUpperBoundsGroups(); + ::mlir::ArrayAttr getStepsAttr(); + ::llvm::SmallVector getSteps(); + void setReductionsAttr(::mlir::ArrayAttr attr); + void setLowerBoundsMapAttr(::mlir::AffineMapAttr attr); + void setLowerBoundsMap(::mlir::AffineMap attrValue); + void setLowerBoundsGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setUpperBoundsMapAttr(::mlir::AffineMapAttr attr); + void setUpperBoundsMap(::mlir::AffineMap attrValue); + void setUpperBoundsGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setStepsAttr(::mlir::ArrayAttr attr); + void setSteps(::llvm::SmallVector attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTypes, ArrayRef reductions, ArrayRef ranges); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTypes, ArrayRef reductions, ArrayRef lbMaps, ValueRange lbArgs, ArrayRef ubMaps, ValueRange ubArgs, ArrayRef steps); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ArrayAttr reductions, ::mlir::AffineMapAttr lowerBoundsMap, ::mlir::DenseIntElementsAttr lowerBoundsGroups, ::mlir::AffineMapAttr upperBoundsMap, ::mlir::DenseIntElementsAttr upperBoundsGroups, ::mlir::ArrayAttr steps, ::mlir::ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ArrayAttr reductions, ::mlir::AffineMap lowerBoundsMap, ::mlir::DenseIntElementsAttr lowerBoundsGroups, ::mlir::AffineMap upperBoundsMap, ::mlir::DenseIntElementsAttr upperBoundsGroups, ::llvm::SmallVector steps, ::mlir::ValueRange mapOperands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + ::llvm::SmallVector<::mlir::Region *> getLoopRegions(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Get the number of dimensions. + unsigned getNumDims(); + + /// Get ranges as constants, may fail in dynamic case. + std::optional> getConstantRanges(); + + Block *getBody(); + OpBuilder getBodyBuilder(); + MutableArrayRef getIVs() { + return getBody()->getArguments(); + } + + /// Returns elements of the loop lower bound. + AffineMap getLowerBoundMap(unsigned pos); + operand_range getLowerBoundsOperands(); + AffineValueMap getLowerBoundsValueMap(); + + /// Sets elements of the loop lower bound. + void setLowerBounds(ValueRange operands, AffineMap map); + + /// Returns elements of the loop upper bound. + AffineMap getUpperBoundMap(unsigned pos); + operand_range getUpperBoundsOperands(); + AffineValueMap getUpperBoundsValueMap(); + + /// Sets elements fo the loop upper bound. + void setUpperBounds(ValueRange operands, AffineMap map); + + void setSteps(ArrayRef newSteps); + + /// Returns attribute names to use in op construction. Not expected to be + /// used directly. + static StringRef getReductionsAttrStrName() { return "reductions"; } + static StringRef getLowerBoundsMapAttrStrName() { return "lowerBoundsMap"; } + static StringRef getLowerBoundsGroupsAttrStrName() { + return "lowerBoundsGroups"; + } + static StringRef getUpperBoundsMapAttrStrName() { return "upperBoundsMap"; } + static StringRef getUpperBoundsGroupsAttrStrName() { + return "upperBoundsGroups"; + } + static StringRef getStepsAttrStrName() { return "steps"; } + + /// Returns `true` if the loop bounds have min/max expressions. + bool hasMinMaxBounds() { + return getLowerBoundsMap().getNumResults() != getNumDims() || + getUpperBoundsMap().getNumResults() != getNumDims(); + } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineParallelOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffinePrefetchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffinePrefetchOpGenericAdaptorBase { +public: + struct Properties { + using isDataCacheTy = ::mlir::BoolAttr; + isDataCacheTy isDataCache; + + auto getIsDataCache() { + auto &propStorage = this->isDataCache; + return ::llvm::cast<::mlir::BoolAttr>(propStorage); + } + void setIsDataCache(const ::mlir::BoolAttr &propValue) { + this->isDataCache = propValue; + } + using isWriteTy = ::mlir::BoolAttr; + isWriteTy isWrite; + + auto getIsWrite() { + auto &propStorage = this->isWrite; + return ::llvm::cast<::mlir::BoolAttr>(propStorage); + } + void setIsWrite(const ::mlir::BoolAttr &propValue) { + this->isWrite = propValue; + } + using localityHintTy = ::mlir::IntegerAttr; + localityHintTy localityHint; + + auto getLocalityHint() { + auto &propStorage = this->localityHint; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setLocalityHint(const ::mlir::IntegerAttr &propValue) { + this->localityHint = propValue; + } + using mapTy = ::mlir::AffineMapAttr; + mapTy map; + + auto getMap() { + auto &propStorage = this->map; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setMap(const ::mlir::AffineMapAttr &propValue) { + this->map = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.isDataCache == this->isDataCache && + rhs.isWrite == this->isWrite && + rhs.localityHint == this->localityHint && + rhs.map == this->map && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffinePrefetchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffinePrefetchOpGenericAdaptorBase(AffinePrefetchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsWriteAttr(); + bool getIsWrite(); + ::mlir::IntegerAttr getLocalityHintAttr(); + uint32_t getLocalityHint(); + ::mlir::BoolAttr getIsDataCacheAttr(); + bool getIsDataCache(); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); +}; +} // namespace detail +template +class AffinePrefetchOpGenericAdaptor : public detail::AffinePrefetchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffinePrefetchOpGenericAdaptorBase; +public: + AffinePrefetchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffinePrefetchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffinePrefetchOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffinePrefetchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffinePrefetchOpAdaptor : public AffinePrefetchOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffinePrefetchOpGenericAdaptor::AffinePrefetchOpGenericAdaptor; + AffinePrefetchOpAdaptor(AffinePrefetchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffinePrefetchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::affine::AffineMapAccessInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffinePrefetchOpAdaptor; + template + using GenericAdaptor = AffinePrefetchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("isDataCache"), ::llvm::StringRef("isWrite"), ::llvm::StringRef("localityHint"), ::llvm::StringRef("map")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsDataCacheAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsDataCacheAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsWriteAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsWriteAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLocalityHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLocalityHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMapAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.prefetch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getIsWriteAttr(); + bool getIsWrite(); + ::mlir::IntegerAttr getLocalityHintAttr(); + uint32_t getLocalityHint(); + ::mlir::BoolAttr getIsDataCacheAttr(); + bool getIsDataCache(); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); + void setIsWriteAttr(::mlir::BoolAttr attr); + void setIsWrite(bool attrValue); + void setLocalityHintAttr(::mlir::IntegerAttr attr); + void setLocalityHint(uint32_t attrValue); + void setIsDataCacheAttr(::mlir::BoolAttr attr); + void setIsDataCache(bool attrValue); + void setMapAttr(::mlir::AffineMapAttr attr); + void setMap(::mlir::AffineMap attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value memref, AffineMap map, ArrayRef mapOperands, bool isWrite, unsigned localityHint, bool isDataCache); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr isWrite, ::mlir::IntegerAttr localityHint, ::mlir::BoolAttr isDataCache, ::mlir::AffineMapAttr map); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr isWrite, ::mlir::IntegerAttr localityHint, ::mlir::BoolAttr isDataCache, ::mlir::AffineMapAttr map); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, bool isWrite, uint32_t localityHint, bool isDataCache, ::mlir::AffineMap map); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, bool isWrite, uint32_t localityHint, bool isDataCache, ::mlir::AffineMap map); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + MemRefType getMemRefType() { + return ::llvm::cast(getMemref().getType()); + } + + /// Returns the affine map used to index the memref for this operation. + AffineMap getAffineMap() { return getAffineMapAttr().getValue(); } + AffineMapAttr getAffineMapAttr() { + return getProperties().map; + } + + /// Implements the AffineMapAccessInterface. + /// Returns the AffineMapAttr associated with 'memref'. + NamedAttribute getAffineMapAttrForMemRef(Value mref) { + assert(mref == getMemref() && + "Expected mref argument to match memref operand"); + return {StringAttr::get(getContext(), getMapAttrStrName()), + getAffineMapAttr()}; + } + + /// Get affine map operands. + operand_range getMapOperands() { + return {operand_begin() + 1, operand_end()}; + } + + static StringRef getMapAttrStrName() { return "map"; } + static StringRef getLocalityHintAttrStrName() { return "localityHint"; } + static StringRef getIsWriteAttrStrName() { return "isWrite"; } + static StringRef getIsDataCacheAttrStrName() { return "isDataCache"; } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffinePrefetchOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineStoreOpGenericAdaptorBase { +public: + struct Properties { + using mapTy = ::mlir::AffineMapAttr; + mapTy map; + + auto getMap() { + auto &propStorage = this->map; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setMap(const ::mlir::AffineMapAttr &propValue) { + this->map = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.map == this->map && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffineStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineStoreOpGenericAdaptorBase(AffineStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); +}; +} // namespace detail +template +class AffineStoreOpGenericAdaptor : public detail::AffineStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineStoreOpGenericAdaptorBase; +public: + AffineStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffineStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffineStoreOpAdaptor : public AffineStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineStoreOpGenericAdaptor::AffineStoreOpGenericAdaptor; + AffineStoreOpAdaptor(AffineStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::affine::AffineWriteOpInterface::Trait, ::mlir::affine::AffineMapAccessInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineStoreOpAdaptor; + template + using GenericAdaptor = AffineStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("map")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMapAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); + void setMapAttr(::mlir::AffineMapAttr attr); + void setMap(::mlir::AffineMap attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value valueToStore, Value memref, ValueRange indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value valueToStore, Value memref, AffineMap map, ValueRange mapOperands); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the operand index of the value to be stored. + unsigned getStoredValOperandIndex() { return 0; } + + /// Returns the operand index of the memref. + unsigned getMemRefOperandIndex() { return 1; } + + void setMemRef(Value value) { setOperand(getMemRefOperandIndex(), value); } + + /// Returns the affine map used to index the memref for this operation. + AffineMapAttr getAffineMapAttr() { + return getProperties().map; + } + + static StringRef getMapAttrStrName() { return "map"; } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineStoreOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineVectorLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineVectorLoadOpGenericAdaptorBase { +public: + struct Properties { + using mapTy = ::mlir::AffineMapAttr; + mapTy map; + + auto getMap() { + auto &propStorage = this->map; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setMap(const ::mlir::AffineMapAttr &propValue) { + this->map = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.map == this->map && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffineVectorLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineVectorLoadOpGenericAdaptorBase(AffineVectorLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); +}; +} // namespace detail +template +class AffineVectorLoadOpGenericAdaptor : public detail::AffineVectorLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineVectorLoadOpGenericAdaptorBase; +public: + AffineVectorLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineVectorLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineVectorLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffineVectorLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffineVectorLoadOpAdaptor : public AffineVectorLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineVectorLoadOpGenericAdaptor::AffineVectorLoadOpGenericAdaptor; + AffineVectorLoadOpAdaptor(AffineVectorLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineVectorLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::affine::AffineReadOpInterface::Trait, ::mlir::affine::AffineMapAccessInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineVectorLoadOpAdaptor; + template + using GenericAdaptor = AffineVectorLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("map")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMapAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.vector_load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); + void setMapAttr(::mlir::AffineMapAttr attr); + void setMap(::mlir::AffineMap attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, VectorType resultType, AffineMap map, ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, VectorType resultType, Value memref, ValueRange indices = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, VectorType resultType, Value memref, AffineMap map, ValueRange mapOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMapAttr map); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMapAttr map); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMap map); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::AffineMap map); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the operand index of the memref. + unsigned getMemRefOperandIndex() { return 0; } + + void setMemRef(Value value) { setOperand(getMemRefOperandIndex(), value); } + + /// Returns the affine map used to index the memref for this operation. + AffineMapAttr getAffineMapAttr() { + return getProperties().map; + } + + static StringRef getMapAttrStrName() { return "map"; } + + VectorType getVectorType() { + return ::llvm::cast(getResult().getType()); + } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineVectorLoadOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineVectorStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineVectorStoreOpGenericAdaptorBase { +public: + struct Properties { + using mapTy = ::mlir::AffineMapAttr; + mapTy map; + + auto getMap() { + auto &propStorage = this->map; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setMap(const ::mlir::AffineMapAttr &propValue) { + this->map = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.map == this->map && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AffineVectorStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineVectorStoreOpGenericAdaptorBase(AffineVectorStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); +}; +} // namespace detail +template +class AffineVectorStoreOpGenericAdaptor : public detail::AffineVectorStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineVectorStoreOpGenericAdaptorBase; +public: + AffineVectorStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineVectorStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineVectorStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AffineVectorStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AffineVectorStoreOpAdaptor : public AffineVectorStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineVectorStoreOpGenericAdaptor::AffineVectorStoreOpGenericAdaptor; + AffineVectorStoreOpAdaptor(AffineVectorStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineVectorStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::affine::AffineWriteOpInterface::Trait, ::mlir::affine::AffineMapAccessInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineVectorStoreOpAdaptor; + template + using GenericAdaptor = AffineVectorStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("map")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMapAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.vector_store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getValue(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::AffineMapAttr getMapAttr(); + ::mlir::AffineMap getMap(); + void setMapAttr(::mlir::AffineMapAttr attr); + void setMap(::mlir::AffineMap attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value valueToStore, Value memref, ValueRange indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value valueToStore, Value memref, AffineMap map, ValueRange mapOperands); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the operand index of the value to be stored. + unsigned getStoredValOperandIndex() { return 0; } + + /// Returns the operand index of the memref. + unsigned getMemRefOperandIndex() { return 1; } + + void setMemRef(Value value) { setOperand(getMemRefOperandIndex(), value); } + + /// Returns the affine map used to index the memref for this operation. + AffineMapAttr getAffineMapAttr() { + return getProperties().map; + } + + static StringRef getMapAttrStrName() { return "map"; } + + VectorType getVectorType() { + return ::llvm::cast(getValue().getType()); + } +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineVectorStoreOp) + +namespace mlir { +namespace affine { + +//===----------------------------------------------------------------------===// +// ::mlir::affine::AffineYieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AffineYieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AffineYieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AffineYieldOpGenericAdaptorBase(AffineYieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AffineYieldOpGenericAdaptor : public detail::AffineYieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AffineYieldOpGenericAdaptorBase; +public: + AffineYieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AffineYieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AffineYieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AffineYieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class AffineYieldOpAdaptor : public AffineYieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using AffineYieldOpGenericAdaptor::AffineYieldOpGenericAdaptor; + AffineYieldOpAdaptor(AffineYieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AffineYieldOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AffineYieldOpAdaptor; + template + using GenericAdaptor = AffineYieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("affine.yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineYieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..1ff9a57078cf6d68b9596ad60592968ecf4708c7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AffineOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::affine::AffineDialect) +namespace mlir { +namespace affine { + +AffineDialect::AffineDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + initialize(); +} + +AffineDialect::~AffineDialect() = default; + +} // namespace affine +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..19e2ed93070c574c4720b99d2a9b7e23012e2631 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineOpsDialect.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AffineOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace affine { + +class AffineDialect : public ::mlir::Dialect { + explicit AffineDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~AffineDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("affine"); + } + + /// Materialize a single constant operation from a given attribute value with + /// the desired resultant type. + ::mlir::Operation *materializeConstant(::mlir::OpBuilder &builder, + ::mlir::Attribute value, + ::mlir::Type type, + ::mlir::Location loc) override; +}; +} // namespace affine +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::affine::AffineDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineValueMap.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineValueMap.h new file mode 100644 index 0000000000000000000000000000000000000000..8439930a87467cc23b981fa0b6bf3af3ceb7788d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/AffineValueMap.h @@ -0,0 +1,96 @@ +//===- AffineValueMap.h - MLIR Affine Value Map Class -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// An AffineValueMap is an affine map plus its ML value operands and results for +// analysis purposes. +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_IR_AFFINEVALUEMAP_H +#define MLIR_DIALECT_AFFINE_IR_AFFINEVALUEMAP_H + +#include "mlir/IR/AffineMap.h" +#include "mlir/IR/OperationSupport.h" +#include "mlir/IR/Value.h" + +namespace mlir { +namespace affine { + +/// An AffineValueMap is an affine map plus its ML value operands and +/// results for analysis purposes. The structure is still a tree form that is +/// same as that of an affine map or an AffineApplyOp. However, its operands, +/// results, and its map can themselves change as a result of +/// substitutions, simplifications, and other analysis. +// An affine value map can readily be constructed from an AffineApplyOp, or an +// AffineBound of a AffineForOp. It can be further transformed, substituted +// into, or simplified. Unlike AffineMap's, AffineValueMap's are created and +// destroyed during analysis. Only the AffineMap expressions that are pointed by +// them are unique'd. An affine value map, and the operations on it, maintain +// the invariant that operands are always positionally aligned with the +// AffineDimExpr and AffineSymbolExpr in the underlying AffineMap. +class AffineValueMap { +public: + // Creates an empty AffineValueMap (users should call 'reset' to reset map + // and operands). + AffineValueMap() = default; + AffineValueMap(AffineMap map, ValueRange operands, ValueRange results = {}); + + ~AffineValueMap(); + + // Resets this AffineValueMap with 'map', 'operands', and 'results'. + void reset(AffineMap map, ValueRange operands, ValueRange results = {}); + + /// Return the value map that is the difference of value maps 'a' and 'b', + /// represented as an affine map and its operands. The output map + operands + /// are canonicalized and simplified. + static void difference(const AffineValueMap &a, const AffineValueMap &b, + AffineValueMap *res); + + /// Return true if the idx^th result can be proved to be a multiple of + /// 'factor', false otherwise. + inline bool isMultipleOf(unsigned idx, int64_t factor) const; + + /// Return true if the idx^th result depends on 'value', false otherwise. + bool isFunctionOf(unsigned idx, Value value) const; + + /// Return true if the result at 'idx' is a constant, false + /// otherwise. + bool isConstant(unsigned idx) const; + + /// Return true if this is an identity map. + bool isIdentity() const; + + void setResult(unsigned i, AffineExpr e) { map.setResult(i, e); } + AffineExpr getResult(unsigned i) { return map.getResult(i); } + inline unsigned getNumOperands() const { return operands.size(); } + inline unsigned getNumDims() const { return map.getNumDims(); } + inline unsigned getNumSymbols() const { return map.getNumSymbols(); } + inline unsigned getNumResults() const { return map.getNumResults(); } + + Value getOperand(unsigned i) const; + ArrayRef getOperands() const; + AffineMap getAffineMap() const; + + /// Attempts to canonicalize the map and operands. Return success if the map + /// and/or operands have been modified. + LogicalResult canonicalize(); + +private: + // A mutable affine map. + MutableAffineMap map; + + // TODO: make these trailing objects? + /// The SSA operands binding to the dim's and symbols of 'map'. + SmallVector operands; + /// The SSA results binding to the results of 'map'. + SmallVector results; +}; + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_IR_AFFINEVALUEMAP_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..2abbabc5bb2868c40b93628ef1b571a5c32b1ec3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h @@ -0,0 +1,20 @@ +//===- ValueBoundsOpInterfaceImpl.h - Impl. of ValueBoundsOpInterface -----===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H +#define MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H + +namespace mlir { +class DialectRegistry; + +namespace affine { +void registerValueBoundsOpInterfaceExternalModels(DialectRegistry ®istry); +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/LoopFusionUtils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/LoopFusionUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..284d394ddceffef0e969f1478c284604b068701a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/LoopFusionUtils.h @@ -0,0 +1,174 @@ +//===- LoopFusionUtils.h - Loop fusion utilities ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes for various loop fusion utility +// methods: these are not passes by themselves but are used either by passes, +// optimization sequences, or in turn by other transformation utilities. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_LOOPFUSIONUTILS_H +#define MLIR_DIALECT_AFFINE_LOOPFUSIONUTILS_H + +#include "mlir/IR/Value.h" +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" + +namespace mlir { +class Operation; + +namespace affine { +class AffineForOp; +struct ComputationSliceState; + +// TODO: Extend this module to include utility functions for querying fusion +// cost/storage reduction, and for performing the loop fusion transformation. + +struct FusionResult { + enum ResultEnum { + Success, + FailPrecondition, // Failed precondition for fusion. (e.g. same block). + FailBlockDependence, // Fusion would violate another dependence in block. + FailFusionDependence, // Fusion would reverse dependences between loops. + FailComputationSlice, // Unable to compute src loop computation slice. + FailIncorrectSlice, // Slice is computed, but it is incorrect. + } value; + FusionResult(ResultEnum v) : value(v) {} +}; + +/// Describes the fusion strategy to be used in the Affine loop fusion +/// utilities. Currently, it is used to specialized the loop fusion utilities +/// with the assumptions made in the AffineLoopFusion pass for producer-consumer +/// and sibling fusion, while sharing a single implementation. The latter +/// strategies are also limited to scenarios where a single memref is involved +/// in the producer-consume or sibling relationship between the candidate +/// loops. We use 'memref' to keep track of such a memref. +// TODO: Remove 'memref' when we support more generic scenarios. +// TODO: Generalize utilities so that producer-consumer and sibling fusion +// strategies can be used without the assumptions made in the AffineLoopFusion +// pass. +class FusionStrategy { +public: + enum StrategyEnum { + // Generic loop fusion: Arbitrary loops are considered for fusion. No + // assumptions about a specific fusion strategy from AffineLoopFusion pass + // are made. + // TODO: Generic fusion is not fully implemented by fusion utilities yet. + // It should only be used for testing. + Generic, + // Producer-consumer fusion: Only loops with a producer-consumer + // memref dependence are considered for fusion. Currently, assumptions from + // the producer-consumer fusion implementation in AffineLoopFusion pass are + // made. See pass for specific details. + ProducerConsumer, + // Sibling fusion: Only sibling loops with no producer-consumer memref + // dependences are considered for fusion. Memref reuse is taken into account + // for profitability. Currently, assumptions from the sibling fusion + // implementation in AffineLoopFusion pass are made. See pass for specific + // details. + Sibling + }; + + /// Construct a generic or producer-consumer fusion strategy. + FusionStrategy(StrategyEnum strategy) : strategy(strategy) { + assert(strategy != Sibling && + "Sibling fusion strategy requires a specific memref"); + } + + /// Construct a sibling fusion strategy targeting 'memref'. This construct + /// should only be used for sibling fusion. + FusionStrategy(Value memref) : strategy(Sibling), memref(memref) {} + + /// Returns the fusion strategy. + StrategyEnum getStrategy() const { return strategy; }; + + /// Returns the memref attached to this sibling fusion strategy. + Value getSiblingFusionMemRef() const { + assert(strategy == Sibling && "Memref is only valid for sibling fusion"); + return memref; + } + +private: + /// Fusion strategy. + StrategyEnum strategy; + + /// Target memref for this fusion transformation. Only used for sibling + /// fusion. + Value memref; +}; + +/// Checks the feasibility of fusing the loop nest rooted at 'srcForOp' into the +/// loop nest rooted at 'dstForOp' at 'dstLoopDepth'. Returns FusionResult +/// 'Success' if fusion of the src/dst loop nests is feasible (i.e. they are +/// in the same block and dependences would not be violated). Otherwise +/// returns a FusionResult explaining why fusion is not feasible. +/// NOTE: This function is not feature complete and should only be used in +/// testing. +/// TODO: Update comments when this function is fully implemented. +FusionResult +canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp, unsigned dstLoopDepth, + ComputationSliceState *srcSlice, + FusionStrategy fusionStrategy = FusionStrategy::Generic); + +/// Fuses 'srcForOp' into 'dstForOp' with destination loop block insertion +/// point and source slice loop bounds specified in 'srcSlice'. +/// `isInnermostSiblingInsertionFusion` enables cleanup of `srcForOp that is a +/// single-iteration reduction loop being sibling-fused into a 'dstForOp'. +void fuseLoops(AffineForOp srcForOp, AffineForOp dstForOp, + const ComputationSliceState &srcSlice, + bool isInnermostSiblingInsertionFusion = false); + +/// LoopNestStats aggregates various per-loop statistics (eg. loop trip count +/// and operation count) for a loop nest up until (and including) the innermost +/// loop body. +struct LoopNestStats { + /// Map from AffineForOp to immediate child AffineForOps in its loop body. + DenseMap> loopMap; + /// Map from AffineForOp to count of operations in its loop body. + DenseMap opCountMap; + /// Map from AffineForOp to its constant trip count. + DenseMap tripCountMap; +}; + +/// Collect loop nest statistics (eg. loop trip count and operation count) +/// in 'stats' for loop nest rooted at 'forOp'. Returns true on success, +/// returns false otherwise. +// TODO: Consider moving this to LoopUtils. +bool getLoopNestStats(AffineForOp forOp, LoopNestStats *stats); + +/// Computes the total cost of the loop nest rooted at 'forOp' using 'stats'. +/// Currently, the total cost is computed by counting the total operation +/// instance count (i.e. total number of operations in the loop body * loop +/// trip count) for the entire loop nest. +// TODO: Improve this cost model. +int64_t getComputeCost(AffineForOp forOp, LoopNestStats &stats); + +/// Computes and returns in 'computeCost', the total compute cost of fusing the +/// 'slice' of the loop nest rooted at 'srcForOp' into 'dstForOp'. Currently, +/// the total cost is computed by counting the total operation instance count +/// (i.e. total number of operations in the loop body * loop trip count) for +/// the entire loop nest. +/// Returns true on success, failure otherwise (e.g. non-constant trip counts). +// TODO: Improve this cost model. +bool getFusionComputeCost(AffineForOp srcForOp, LoopNestStats &srcStats, + AffineForOp dstForOp, LoopNestStats &dstStats, + const ComputationSliceState &slice, + int64_t *computeCost); + +/// Returns in 'producerConsumerMemrefs' the memrefs involved in a +/// producer-consumer dependence between write ops in 'srcOps' and read ops in +/// 'dstOps'. +void gatherProducerConsumerMemrefs(ArrayRef srcOps, + ArrayRef dstOps, + DenseSet &producerConsumerMemrefs); + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_LOOPFUSIONUTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/LoopUtils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/LoopUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..723a262f24acc51f74f124e563dbfc50700b4c7b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/LoopUtils.h @@ -0,0 +1,353 @@ +//===- LoopUtils.h - Loop transformation utilities --------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes for various loop transformation utility +// methods: these are not passes by themselves but are used either by passes, +// optimization sequences, or in turn by other transformation utilities. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_LOOPUTILS_H +#define MLIR_DIALECT_AFFINE_LOOPUTILS_H + +#include "mlir/IR/Block.h" +#include "mlir/Support/LLVM.h" +#include "mlir/Support/LogicalResult.h" +#include "mlir/Transforms/RegionUtils.h" +#include + +namespace mlir { +class AffineMap; +class LoopLikeOpInterface; +class OpBuilder; +class Value; +class ValueRange; + +namespace func { +class FuncOp; +} // namespace func + +namespace scf { +class ForOp; +class ParallelOp; +} // namespace scf + +namespace affine { +class AffineForOp; +struct MemRefRegion; + +/// Unrolls this for operation completely if the trip count is known to be +/// constant. Returns failure otherwise. +LogicalResult loopUnrollFull(AffineForOp forOp); + +/// Unrolls this for operation by the specified unroll factor. Returns failure +/// if the loop cannot be unrolled either due to restrictions or due to invalid +/// unroll factors. Requires positive loop bounds and step. If specified, +/// annotates the Ops in each unrolled iteration by applying `annotateFn`. +/// When `cleanUpUnroll` is true, we can ensure the cleanup loop is unrolled +/// regardless of the unroll factor. +LogicalResult loopUnrollByFactor( + AffineForOp forOp, uint64_t unrollFactor, + function_ref annotateFn = nullptr, + bool cleanUpUnroll = false); + +/// Unrolls this loop by the specified unroll factor or its trip count, +/// whichever is lower. +LogicalResult loopUnrollUpToFactor(AffineForOp forOp, uint64_t unrollFactor); + +/// Returns true if `loops` is a perfectly nested loop nest, where loops appear +/// in it from outermost to innermost. +bool LLVM_ATTRIBUTE_UNUSED isPerfectlyNested(ArrayRef loops); + +/// Get perfectly nested sequence of loops starting at root of loop nest +/// (the first op being another AffineFor, and the second op - a terminator). +/// A loop is perfectly nested iff: the first op in the loop's body is another +/// AffineForOp, and the second op is a terminator). +void getPerfectlyNestedLoops(SmallVectorImpl &nestedLoops, + AffineForOp root); + +/// Unrolls and jams this loop by the specified factor. `forOp` can be a loop +/// with iteration arguments performing supported reductions and its inner loops +/// can have iteration arguments. Returns success if the loop is successfully +/// unroll-jammed. +LogicalResult loopUnrollJamByFactor(AffineForOp forOp, + uint64_t unrollJamFactor); + +/// Unrolls and jams this loop by the specified factor or by the trip count (if +/// constant), whichever is lower. +LogicalResult loopUnrollJamUpToFactor(AffineForOp forOp, + uint64_t unrollJamFactor); + +/// Promotes the loop body of a AffineForOp to its containing block if the loop +/// was known to have a single iteration. +LogicalResult promoteIfSingleIteration(AffineForOp forOp); + +/// Promotes all single iteration AffineForOp's in the Function, i.e., moves +/// their body into the containing Block. +void promoteSingleIterationLoops(func::FuncOp f); + +/// Skew the operations in an affine.for's body with the specified +/// operation-wise shifts. The shifts are with respect to the original execution +/// order, and are multiplied by the loop 'step' before being applied. If +/// `unrollPrologueEpilogue` is set, fully unroll the prologue and epilogue +/// loops when possible. +LogicalResult affineForOpBodySkew(AffineForOp forOp, ArrayRef shifts, + bool unrollPrologueEpilogue = false); + +/// Identify valid and profitable bands of loops to tile. This is currently just +/// a temporary placeholder to test the mechanics of tiled code generation. +/// Returns all maximal outermost perfect loop nests to tile. +void getTileableBands(func::FuncOp f, + std::vector> *bands); + +/// Tiles the specified band of perfectly nested loops creating tile-space loops +/// and intra-tile loops. A band is a contiguous set of loops. This utility +/// doesn't check for the validity of tiling itself, but just performs it. +LogicalResult +tilePerfectlyNested(MutableArrayRef input, + ArrayRef tileSizes, + SmallVectorImpl *tiledNest = nullptr); + +/// Tiles the specified band of perfectly nested loops creating tile-space +/// loops and intra-tile loops, using SSA values as tiling parameters. A band +/// is a contiguous set of loops. +LogicalResult tilePerfectlyNestedParametric( + MutableArrayRef input, ArrayRef tileSizes, + SmallVectorImpl *tiledNest = nullptr); + +/// Performs loop interchange on 'forOpA' and 'forOpB'. Requires that 'forOpA' +/// and 'forOpB' are part of a perfectly nested sequence of loops. +void interchangeLoops(AffineForOp forOpA, AffineForOp forOpB); + +/// Checks if the loop interchange permutation 'loopPermMap', of the perfectly +/// nested sequence of loops in 'loops', would violate dependences (loop 'i' in +/// 'loops' is mapped to location 'j = 'loopPermMap[i]' in the interchange). +bool isValidLoopInterchangePermutation(ArrayRef loops, + ArrayRef loopPermMap); + +/// Performs a loop permutation on a perfectly nested loop nest `inputNest` +/// (where the contained loops appear from outer to inner) as specified by the +/// permutation `permMap`: loop 'i' in `inputNest` is mapped to location +/// 'loopPermMap[i]', where positions 0, 1, ... are from the outermost position +/// to inner. Returns the position in `inputNest` of the AffineForOp that +/// becomes the new outermost loop of this nest. This method always succeeds, +/// asserts out on invalid input / specifications. +unsigned permuteLoops(MutableArrayRef inputNest, + ArrayRef permMap); + +// Sinks all sequential loops to the innermost levels (while preserving +// relative order among them) and moves all parallel loops to the +// outermost (while again preserving relative order among them). +// Returns AffineForOp of the root of the new loop nest after loop interchanges. +AffineForOp sinkSequentialLoops(AffineForOp forOp); + +/// Performs tiling fo imperfectly nested loops (with interchange) by +/// strip-mining the `forOps` by `sizes` and sinking them, in their order of +/// occurrence in `forOps`, under each of the `targets`. +/// Returns the new AffineForOps, one per each of (`forOps`, `targets`) pair, +/// nested immediately under each of `targets`. +SmallVector, 8> tile(ArrayRef forOps, + ArrayRef sizes, + ArrayRef targets); + +/// Performs tiling (with interchange) by strip-mining the `forOps` by `sizes` +/// and sinking them, in their order of occurrence in `forOps`, under `target`. +/// Returns the new AffineForOps, one per `forOps`, nested immediately under +/// `target`. +SmallVector tile(ArrayRef forOps, + ArrayRef sizes, AffineForOp target); + +/// Explicit copy / DMA generation options for mlir::affineDataCopyGenerate. +struct AffineCopyOptions { + // True if DMAs should be generated instead of point-wise copies. + bool generateDma; + // The slower memory space from which data is to be moved. + unsigned slowMemorySpace; + // Memory space of the faster one (typically a scratchpad). + unsigned fastMemorySpace; + // Memory space to place tags in: only meaningful for DMAs. + unsigned tagMemorySpace; + // Capacity of the fast memory space in bytes. + uint64_t fastMemCapacityBytes; +}; + +/// Performs explicit copying for the contiguous sequence of operations in the +/// block iterator range [`begin', `end'), where `end' can't be past the +/// terminator of the block (since additional operations are potentially +/// inserted right before `end`. `copyOptions` provides various parameters, and +/// the output argument `copyNests` is the set of all copy nests inserted, each +/// represented by its root affine.for. Since we generate alloc's and dealloc's +/// for all fast buffers (before and after the range of operations resp. or at a +/// hoisted position), all of the fast memory capacity is assumed to be +/// available for processing this block range. When 'filterMemRef' is specified, +/// copies are only generated for the provided MemRef. Returns success if the +/// explicit copying succeeded for all memrefs on which affine load/stores were +/// encountered. For memrefs for whose element types a size in bytes can't be +/// computed (`index` type), their capacity is not accounted for and the +/// `fastMemCapacityBytes` copy option would be non-functional in such cases. +LogicalResult affineDataCopyGenerate(Block::iterator begin, Block::iterator end, + const AffineCopyOptions ©Options, + std::optional filterMemRef, + DenseSet ©Nests); + +/// A convenience version of affineDataCopyGenerate for all ops in the body of +/// an AffineForOp. +LogicalResult affineDataCopyGenerate(AffineForOp forOp, + const AffineCopyOptions ©Options, + std::optional filterMemRef, + DenseSet ©Nests); + +/// Result for calling generateCopyForMemRegion. +struct CopyGenerateResult { + // Number of bytes used by alloc. + uint64_t sizeInBytes; + + // The newly created buffer allocation. + Operation *alloc; + + // Generated loop nest for copying data between the allocated buffer and the + // original memref. + Operation *copyNest; +}; + +/// generateCopyForMemRegion is similar to affineDataCopyGenerate, but works +/// with a single memref region. `memrefRegion` is supposed to contain analysis +/// information within analyzedOp. The generated prologue and epilogue always +/// surround `analyzedOp`. +/// +/// Note that `analyzedOp` is a single op for API convenience, and the +/// [begin, end) version can be added as needed. +/// +/// Also note that certain options in `copyOptions` aren't looked at anymore, +/// like slowMemorySpace. +LogicalResult generateCopyForMemRegion(const MemRefRegion &memrefRegion, + Operation *analyzedOp, + const AffineCopyOptions ©Options, + CopyGenerateResult &result); + +/// Replace a perfect nest of "for" loops with a single linearized loop. Assumes +/// `loops` contains a list of perfectly nested loops outermost to innermost +/// that are normalized (step one and lower bound of zero) and with bounds and +/// steps independent of any loop induction variable involved in the nest. +/// Coalescing affine.for loops is not always possible, i.e., the result may not +/// be representable using affine.for. +LogicalResult coalesceLoops(MutableArrayRef loops); + +/// Maps `forOp` for execution on a parallel grid of virtual `processorIds` of +/// size given by `numProcessors`. This is achieved by embedding the SSA values +/// corresponding to `processorIds` and `numProcessors` into the bounds and step +/// of the `forOp`. No check is performed on the legality of the rewrite, it is +/// the caller's responsibility to ensure legality. +/// +/// Requires that `processorIds` and `numProcessors` have the same size and that +/// for each idx, `processorIds`[idx] takes, at runtime, all values between 0 +/// and `numProcessors`[idx] - 1. This corresponds to traditional use cases for: +/// 1. GPU (threadIdx, get_local_id(), ...) +/// 2. MPI (MPI_Comm_rank) +/// 3. OpenMP (omp_get_thread_num) +/// +/// Example: +/// Assuming a 2-d grid with processorIds = [blockIdx.x, threadIdx.x] and +/// numProcessors = [gridDim.x, blockDim.x], the loop: +/// +/// ``` +/// scf.for %i = %lb to %ub step %step { +/// ... +/// } +/// ``` +/// +/// is rewritten into a version resembling the following pseudo-IR: +/// +/// ``` +/// scf.for %i = %lb + %step * (threadIdx.x + blockIdx.x * blockDim.x) +/// to %ub step %gridDim.x * blockDim.x * %step { +/// ... +/// } +/// ``` +void mapLoopToProcessorIds(scf::ForOp forOp, ArrayRef processorId, + ArrayRef numProcessors); + +/// Gathers all AffineForOps in 'func.func' grouped by loop depth. +void gatherLoops(func::FuncOp func, + std::vector> &depthToLoops); + +/// Creates an AffineForOp while ensuring that the lower and upper bounds are +/// canonicalized, i.e., unused and duplicate operands are removed, any constant +/// operands propagated/folded in, and duplicate bound maps dropped. +AffineForOp createCanonicalizedAffineForOp(OpBuilder b, Location loc, + ValueRange lbOperands, + AffineMap lbMap, + ValueRange ubOperands, + AffineMap ubMap, int64_t step = 1); + +/// Separates full tiles from partial tiles for a perfect nest `nest` by +/// generating a conditional guard that selects between the full tile version +/// and the partial tile version using an AffineIfOp. The original loop nest +/// is replaced by this guarded two version form. +/// +/// affine.if (cond) +/// // full_tile +/// else +/// // partial tile +/// +LogicalResult +separateFullTiles(MutableArrayRef nest, + SmallVectorImpl *fullTileNest = nullptr); + +/// Walk either an scf.for or an affine.for to find a band to coalesce. +template +LogicalResult coalescePerfectlyNestedLoops(LoopOpTy op) { + LogicalResult result(failure()); + SmallVector loops; + getPerfectlyNestedLoops(loops, op); + + // Look for a band of loops that can be coalesced, i.e. perfectly nested + // loops with bounds defined above some loop. + // 1. For each loop, find above which parent loop its operands are + // defined. + SmallVector operandsDefinedAbove(loops.size()); + for (unsigned i = 0, e = loops.size(); i < e; ++i) { + operandsDefinedAbove[i] = i; + for (unsigned j = 0; j < i; ++j) { + if (areValuesDefinedAbove(loops[i].getOperands(), loops[j].getRegion())) { + operandsDefinedAbove[i] = j; + break; + } + } + } + + // 2. Identify bands of loops such that the operands of all of them are + // defined above the first loop in the band. Traverse the nest bottom-up + // so that modifications don't invalidate the inner loops. + for (unsigned end = loops.size(); end > 0; --end) { + unsigned start = 0; + for (; start < end - 1; ++start) { + auto maxPos = + *std::max_element(std::next(operandsDefinedAbove.begin(), start), + std::next(operandsDefinedAbove.begin(), end)); + if (maxPos > start) + continue; + assert(maxPos == start && + "expected loop bounds to be known at the start of the band"); + auto band = llvm::MutableArrayRef(loops.data() + start, end - start); + if (succeeded(coalesceLoops(band))) + result = success(); + break; + } + // If a band was found and transformed, keep looking at the loops above + // the outermost transformed loop. + if (start != end - 1) + end = start + 1; + } + return result; +} + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_LOOPUTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..61f24255f305f73bbdaaa77ed12598326da1a512 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Passes.h @@ -0,0 +1,130 @@ +//===- Passes.h - Pass Entrypoints ------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines a set of transforms specific for the AffineOps +// dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_PASSES_H +#define MLIR_DIALECT_AFFINE_PASSES_H + +#include "mlir/Pass/Pass.h" +#include + +namespace mlir { + +namespace func { +class FuncOp; +} // namespace func + +namespace affine { +class AffineForOp; + +/// Fusion mode to attempt. The default mode `Greedy` does both +/// producer-consumer and sibling fusion. +enum FusionMode { Greedy, ProducerConsumer, Sibling }; + +#define GEN_PASS_DECL +#include "mlir/Dialect/Affine/Passes.h.inc" + +/// Creates a simplification pass for affine structures (maps and sets). In +/// addition, this pass also normalizes memrefs to have the trivial (identity) +/// layout map. +std::unique_ptr> +createSimplifyAffineStructuresPass(); + +/// Creates a loop invariant code motion pass that hoists loop invariant +/// operations out of affine loops. +std::unique_ptr> +createAffineLoopInvariantCodeMotionPass(); + +/// Creates a pass to convert all parallel affine.for's into 1-d affine.parallel +/// ops. +std::unique_ptr> createAffineParallelizePass(); + +/// Apply normalization transformations to affine loop-like ops. If +/// `promoteSingleIter` is true, single iteration loops are promoted (i.e., the +/// loop is replaced by its loop body). +std::unique_ptr> +createAffineLoopNormalizePass(bool promoteSingleIter = false); + +/// Performs packing (or explicit copying) of accessed memref regions into +/// buffers in the specified faster memory space through either pointwise copies +/// or DMA operations. +std::unique_ptr> createAffineDataCopyGenerationPass( + unsigned slowMemorySpace, unsigned fastMemorySpace, + unsigned tagMemorySpace = 0, int minDmaTransferSize = 1024, + uint64_t fastMemCapacityBytes = std::numeric_limits::max()); +/// Overload relying on pass options for initialization. +std::unique_ptr> +createAffineDataCopyGenerationPass(); + +/// Creates a pass to replace affine memref accesses by scalars using store to +/// load forwarding and redundant load elimination; consequently also eliminate +/// dead allocs. +std::unique_ptr> +createAffineScalarReplacementPass(); + +/// Creates a pass that transforms perfectly nested loops with independent +/// bounds into a single loop. +std::unique_ptr> createLoopCoalescingPass(); + +/// Creates a loop fusion pass which fuses affine loop nests at the top-level of +/// the operation the pass is created on according to the type of fusion +/// specified in `fusionMode`. Buffers of size less than or equal to +/// `localBufSizeThreshold` are promoted to memory space `fastMemorySpace`. +std::unique_ptr +createLoopFusionPass(unsigned fastMemorySpace = 0, + uint64_t localBufSizeThreshold = 0, + bool maximalFusion = false, + enum FusionMode fusionMode = FusionMode::Greedy); + +/// Creates a pass to perform tiling on loop nests. +std::unique_ptr> +createLoopTilingPass(uint64_t cacheSizeBytes); +/// Overload relying on pass options for initialization. +std::unique_ptr> createLoopTilingPass(); + +/// Creates a loop unrolling pass with the provided parameters. +/// 'getUnrollFactor' is a function callback for clients to supply a function +/// that computes an unroll factor - the callback takes precedence over unroll +/// factors supplied through other means. If -1 is passed as the unrollFactor +/// and no callback is provided, anything passed from the command-line (if at +/// all) or the default unroll factor is used (LoopUnroll:kDefaultUnrollFactor). +std::unique_ptr> createLoopUnrollPass( + int unrollFactor = -1, bool unrollUpToFactor = false, + bool unrollFull = false, + const std::function &getUnrollFactor = nullptr); + +/// Creates a loop unroll jam pass to unroll jam by the specified factor. A +/// factor of -1 lets the pass use the default factor or the one on the command +/// line if provided. +std::unique_ptr> +createLoopUnrollAndJamPass(int unrollJamFactor = -1); + +/// Creates a pass to pipeline explicit movement of data across levels of the +/// memory hierarchy. +std::unique_ptr> createPipelineDataTransferPass(); + +/// Creates a pass to expand affine index operations into more fundamental +/// operations (not necessarily restricted to Affine dialect). +std::unique_ptr createAffineExpandIndexOpsPass(); + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/Affine/Passes.h.inc" + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..be351739ebd96803d47d7654c91c446dbb5e52a8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Passes.h.inc @@ -0,0 +1,1918 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_AFFINEDATACOPYGENERATION +#define GEN_PASS_DECL_AFFINEEXPANDINDEXOPS +#define GEN_PASS_DECL_AFFINELOOPFUSION +#define GEN_PASS_DECL_AFFINELOOPINVARIANTCODEMOTION +#define GEN_PASS_DECL_AFFINELOOPNORMALIZE +#define GEN_PASS_DECL_AFFINELOOPTILING +#define GEN_PASS_DECL_AFFINELOOPUNROLL +#define GEN_PASS_DECL_AFFINELOOPUNROLLANDJAM +#define GEN_PASS_DECL_AFFINEPARALLELIZE +#define GEN_PASS_DECL_AFFINEPIPELINEDATATRANSFER +#define GEN_PASS_DECL_AFFINESCALARREPLACEMENT +#define GEN_PASS_DECL_AFFINEVECTORIZE +#define GEN_PASS_DECL_LOOPCOALESCING +#define GEN_PASS_DECL_SIMPLIFYAFFINESTRUCTURES +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// AffineDataCopyGeneration +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINEDATACOPYGENERATION +struct AffineDataCopyGenerationOptions { + uint64_t fastMemoryCapacity = std::numeric_limits::max(); + unsigned fastMemorySpace = 1; + bool generateDma = true; + int minDmaTransferSize = 1024; + unsigned slowMemorySpace = 0; + bool skipNonUnitStrideLoops = false; + unsigned tagMemorySpace = 0; +}; +#undef GEN_PASS_DECL_AFFINEDATACOPYGENERATION +#endif // GEN_PASS_DECL_AFFINEDATACOPYGENERATION +#ifdef GEN_PASS_DEF_AFFINEDATACOPYGENERATION +namespace impl { + +template +class AffineDataCopyGenerationBase : public ::mlir::OperationPass { +public: + using Base = AffineDataCopyGenerationBase; + + AffineDataCopyGenerationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineDataCopyGenerationBase(const AffineDataCopyGenerationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-data-copy-generate"); + } + ::llvm::StringRef getArgument() const override { return "affine-data-copy-generate"; } + + ::llvm::StringRef getDescription() const override { return "Generate explicit copying for affine memory operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineDataCopyGeneration"); + } + ::llvm::StringRef getName() const override { return "AffineDataCopyGeneration"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineDataCopyGenerationBase) + + AffineDataCopyGenerationBase(const AffineDataCopyGenerationOptions &options) : AffineDataCopyGenerationBase() { + fastMemoryCapacity = options.fastMemoryCapacity; + fastMemorySpace = options.fastMemorySpace; + generateDma = options.generateDma; + minDmaTransferSize = options.minDmaTransferSize; + slowMemorySpace = options.slowMemorySpace; + skipNonUnitStrideLoops = options.skipNonUnitStrideLoops; + tagMemorySpace = options.tagMemorySpace; + } +protected: + ::mlir::Pass::Option fastMemoryCapacity{*this, "fast-mem-capacity", ::llvm::cl::desc("Set fast memory space capacity in KiB (default: unlimited)"), ::llvm::cl::init(std::numeric_limits::max())}; + ::mlir::Pass::Option fastMemorySpace{*this, "fast-mem-space", ::llvm::cl::desc("Fast memory space identifier for copy generation (default: 1)"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option generateDma{*this, "generate-dma", ::llvm::cl::desc("Generate DMA instead of point-wise copy"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option minDmaTransferSize{*this, "min-dma-transfer", ::llvm::cl::desc("Minimum DMA transfer size supported by the target in bytes"), ::llvm::cl::init(1024)}; + ::mlir::Pass::Option slowMemorySpace{*this, "slow-mem-space", ::llvm::cl::desc("Slow memory space identifier for copy generation (default: 0)"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option skipNonUnitStrideLoops{*this, "skip-non-unit-stride-loops", ::llvm::cl::desc("Testing purposes: avoid non-unit stride loop choice depths for copy placement"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option tagMemorySpace{*this, "tag-mem-space", ::llvm::cl::desc("Tag memory space identifier for copy generation (default: 0)"), ::llvm::cl::init(0)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINEDATACOPYGENERATION +#endif // GEN_PASS_DEF_AFFINEDATACOPYGENERATION + +//===----------------------------------------------------------------------===// +// AffineExpandIndexOps +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINEEXPANDINDEXOPS +#undef GEN_PASS_DECL_AFFINEEXPANDINDEXOPS +#endif // GEN_PASS_DECL_AFFINEEXPANDINDEXOPS +#ifdef GEN_PASS_DEF_AFFINEEXPANDINDEXOPS +namespace impl { + +template +class AffineExpandIndexOpsBase : public ::mlir::OperationPass<> { +public: + using Base = AffineExpandIndexOpsBase; + + AffineExpandIndexOpsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AffineExpandIndexOpsBase(const AffineExpandIndexOpsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-expand-index-ops"); + } + ::llvm::StringRef getArgument() const override { return "affine-expand-index-ops"; } + + ::llvm::StringRef getDescription() const override { return "Lower affine operations operating on indices into more fundamental operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineExpandIndexOps"); + } + ::llvm::StringRef getName() const override { return "AffineExpandIndexOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineExpandIndexOpsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINEEXPANDINDEXOPS +#endif // GEN_PASS_DEF_AFFINEEXPANDINDEXOPS + +//===----------------------------------------------------------------------===// +// AffineLoopFusion +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINELOOPFUSION +struct AffineLoopFusionOptions { + double computeToleranceThreshold = 0.30f; + unsigned fastMemorySpace = 0; + uint64_t localBufSizeThreshold = 0; + bool maximalFusion = false; + enum FusionMode affineFusionMode = mlir::affine::FusionMode::Greedy; +}; +#undef GEN_PASS_DECL_AFFINELOOPFUSION +#endif // GEN_PASS_DECL_AFFINELOOPFUSION +#ifdef GEN_PASS_DEF_AFFINELOOPFUSION +namespace impl { + +template +class AffineLoopFusionBase : public ::mlir::OperationPass<> { +public: + using Base = AffineLoopFusionBase; + + AffineLoopFusionBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AffineLoopFusionBase(const AffineLoopFusionBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-fusion"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-fusion"; } + + ::llvm::StringRef getDescription() const override { return "Fuse affine loop nests"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopFusion"); + } + ::llvm::StringRef getName() const override { return "AffineLoopFusion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopFusionBase) + + AffineLoopFusionBase(const AffineLoopFusionOptions &options) : AffineLoopFusionBase() { + computeToleranceThreshold = options.computeToleranceThreshold; + fastMemorySpace = options.fastMemorySpace; + localBufSizeThreshold = options.localBufSizeThreshold; + maximalFusion = options.maximalFusion; + affineFusionMode = options.affineFusionMode; + } +protected: + ::mlir::Pass::Option computeToleranceThreshold{*this, "fusion-compute-tolerance", ::llvm::cl::desc("Fractional increase in additional computation tolerated while fusing"), ::llvm::cl::init(0.30f)}; + ::mlir::Pass::Option fastMemorySpace{*this, "fusion-fast-mem-space", ::llvm::cl::desc("Faster memory space number to promote fusion buffers to"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option localBufSizeThreshold{*this, "fusion-local-buf-threshold", ::llvm::cl::desc("Threshold size (KiB) for promoting local buffers to fast memory space"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option maximalFusion{*this, "fusion-maximal", ::llvm::cl::desc("Enables maximal loop fusion"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option affineFusionMode{*this, "mode", ::llvm::cl::desc("fusion mode to attempt"), ::llvm::cl::init(mlir::affine::FusionMode::Greedy), llvm::cl::values(clEnumValN(mlir::affine::FusionMode::Greedy, "greedy", "Perform greedy (both producer-consumer and sibling) fusion"), clEnumValN( mlir::affine::FusionMode::ProducerConsumer, "producer", "Perform only producer-consumer fusion"), clEnumValN( mlir::affine::FusionMode::Sibling, "sibling", "Perform only sibling fusion"))}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINELOOPFUSION +#endif // GEN_PASS_DEF_AFFINELOOPFUSION + +//===----------------------------------------------------------------------===// +// AffineLoopInvariantCodeMotion +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINELOOPINVARIANTCODEMOTION +#undef GEN_PASS_DECL_AFFINELOOPINVARIANTCODEMOTION +#endif // GEN_PASS_DECL_AFFINELOOPINVARIANTCODEMOTION +#ifdef GEN_PASS_DEF_AFFINELOOPINVARIANTCODEMOTION +namespace impl { + +template +class AffineLoopInvariantCodeMotionBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopInvariantCodeMotionBase; + + AffineLoopInvariantCodeMotionBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopInvariantCodeMotionBase(const AffineLoopInvariantCodeMotionBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-invariant-code-motion"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-invariant-code-motion"; } + + ::llvm::StringRef getDescription() const override { return "Hoist loop invariant instructions outside of affine loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopInvariantCodeMotion"); + } + ::llvm::StringRef getName() const override { return "AffineLoopInvariantCodeMotion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopInvariantCodeMotionBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINELOOPINVARIANTCODEMOTION +#endif // GEN_PASS_DEF_AFFINELOOPINVARIANTCODEMOTION + +//===----------------------------------------------------------------------===// +// AffineLoopNormalize +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINELOOPNORMALIZE +struct AffineLoopNormalizeOptions { + bool promoteSingleIter = true; +}; +#undef GEN_PASS_DECL_AFFINELOOPNORMALIZE +#endif // GEN_PASS_DECL_AFFINELOOPNORMALIZE +#ifdef GEN_PASS_DEF_AFFINELOOPNORMALIZE +namespace impl { + +template +class AffineLoopNormalizeBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopNormalizeBase; + + AffineLoopNormalizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopNormalizeBase(const AffineLoopNormalizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-normalize"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-normalize"; } + + ::llvm::StringRef getDescription() const override { return "Apply normalization transformations to affine loop-like ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopNormalize"); + } + ::llvm::StringRef getName() const override { return "AffineLoopNormalize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopNormalizeBase) + + AffineLoopNormalizeBase(const AffineLoopNormalizeOptions &options) : AffineLoopNormalizeBase() { + promoteSingleIter = options.promoteSingleIter; + } +protected: + ::mlir::Pass::Option promoteSingleIter{*this, "promote-single-iter", ::llvm::cl::desc("Promote single iteration loops"), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINELOOPNORMALIZE +#endif // GEN_PASS_DEF_AFFINELOOPNORMALIZE + +//===----------------------------------------------------------------------===// +// AffineLoopTiling +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINELOOPTILING +struct AffineLoopTilingOptions { + uint64_t cacheSizeInKiB = 512; + bool separate = false; + unsigned tileSize; + ::llvm::ArrayRef tileSizes; +}; +#undef GEN_PASS_DECL_AFFINELOOPTILING +#endif // GEN_PASS_DECL_AFFINELOOPTILING +#ifdef GEN_PASS_DEF_AFFINELOOPTILING +namespace impl { + +template +class AffineLoopTilingBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopTilingBase; + + AffineLoopTilingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopTilingBase(const AffineLoopTilingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-tile"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-tile"; } + + ::llvm::StringRef getDescription() const override { return "Tile affine loop nests"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopTiling"); + } + ::llvm::StringRef getName() const override { return "AffineLoopTiling"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopTilingBase) + + AffineLoopTilingBase(const AffineLoopTilingOptions &options) : AffineLoopTilingBase() { + cacheSizeInKiB = options.cacheSizeInKiB; + separate = options.separate; + tileSize = options.tileSize; + tileSizes = options.tileSizes; + } +protected: + ::mlir::Pass::Option cacheSizeInKiB{*this, "cache-size", ::llvm::cl::desc("Set size of cache to tile for in KiB (default: 512)"), ::llvm::cl::init(512)}; + ::mlir::Pass::Option separate{*this, "separate", ::llvm::cl::desc("Separate full and partial tiles (default: false)"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option tileSize{*this, "tile-size", ::llvm::cl::desc("Use this tile size for all loops")}; + ::mlir::Pass::ListOption tileSizes{*this, "tile-sizes", ::llvm::cl::desc("List of tile sizes for each perfect nest (overridden by -tile-size)")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINELOOPTILING +#endif // GEN_PASS_DEF_AFFINELOOPTILING + +//===----------------------------------------------------------------------===// +// AffineLoopUnroll +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINELOOPUNROLL +struct AffineLoopUnrollOptions { + unsigned unrollFactor = 4; + bool unrollUpToFactor = false; + bool unrollFull = false; + unsigned numRepetitions = 1; + unsigned unrollFullThreshold = 1; + bool cleanUpUnroll = false; +}; +#undef GEN_PASS_DECL_AFFINELOOPUNROLL +#endif // GEN_PASS_DECL_AFFINELOOPUNROLL +#ifdef GEN_PASS_DEF_AFFINELOOPUNROLL +namespace impl { + +template +class AffineLoopUnrollBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopUnrollBase; + + AffineLoopUnrollBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopUnrollBase(const AffineLoopUnrollBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-unroll"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-unroll"; } + + ::llvm::StringRef getDescription() const override { return "Unroll affine loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopUnroll"); + } + ::llvm::StringRef getName() const override { return "AffineLoopUnroll"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopUnrollBase) + + AffineLoopUnrollBase(const AffineLoopUnrollOptions &options) : AffineLoopUnrollBase() { + unrollFactor = options.unrollFactor; + unrollUpToFactor = options.unrollUpToFactor; + unrollFull = options.unrollFull; + numRepetitions = options.numRepetitions; + unrollFullThreshold = options.unrollFullThreshold; + cleanUpUnroll = options.cleanUpUnroll; + } +protected: + ::mlir::Pass::Option unrollFactor{*this, "unroll-factor", ::llvm::cl::desc("Use this unroll factor for all loops being unrolled"), ::llvm::cl::init(4)}; + ::mlir::Pass::Option unrollUpToFactor{*this, "unroll-up-to-factor", ::llvm::cl::desc("Allow unrolling up to the factor specified"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option unrollFull{*this, "unroll-full", ::llvm::cl::desc("Fully unroll loops"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option numRepetitions{*this, "unroll-num-reps", ::llvm::cl::desc("Unroll innermost loops repeatedly this many times"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option unrollFullThreshold{*this, "unroll-full-threshold", ::llvm::cl::desc("Unroll all loops with trip count less than or equal to this"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option cleanUpUnroll{*this, "cleanup-unroll", ::llvm::cl::desc("Fully unroll the cleanup loop when possible."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINELOOPUNROLL +#endif // GEN_PASS_DEF_AFFINELOOPUNROLL + +//===----------------------------------------------------------------------===// +// AffineLoopUnrollAndJam +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINELOOPUNROLLANDJAM +struct AffineLoopUnrollAndJamOptions { + unsigned unrollJamFactor = 4; +}; +#undef GEN_PASS_DECL_AFFINELOOPUNROLLANDJAM +#endif // GEN_PASS_DECL_AFFINELOOPUNROLLANDJAM +#ifdef GEN_PASS_DEF_AFFINELOOPUNROLLANDJAM +namespace impl { + +template +class AffineLoopUnrollAndJamBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopUnrollAndJamBase; + + AffineLoopUnrollAndJamBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopUnrollAndJamBase(const AffineLoopUnrollAndJamBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-unroll-jam"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-unroll-jam"; } + + ::llvm::StringRef getDescription() const override { return "Unroll and jam affine loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopUnrollAndJam"); + } + ::llvm::StringRef getName() const override { return "AffineLoopUnrollAndJam"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopUnrollAndJamBase) + + AffineLoopUnrollAndJamBase(const AffineLoopUnrollAndJamOptions &options) : AffineLoopUnrollAndJamBase() { + unrollJamFactor = options.unrollJamFactor; + } +protected: + ::mlir::Pass::Option unrollJamFactor{*this, "unroll-jam-factor", ::llvm::cl::desc("Use this unroll jam factor for all loops (default 4)"), ::llvm::cl::init(4)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINELOOPUNROLLANDJAM +#endif // GEN_PASS_DEF_AFFINELOOPUNROLLANDJAM + +//===----------------------------------------------------------------------===// +// AffineParallelize +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINEPARALLELIZE +struct AffineParallelizeOptions { + unsigned maxNested = -1u; + bool parallelReductions = false; +}; +#undef GEN_PASS_DECL_AFFINEPARALLELIZE +#endif // GEN_PASS_DECL_AFFINEPARALLELIZE +#ifdef GEN_PASS_DEF_AFFINEPARALLELIZE +namespace impl { + +template +class AffineParallelizeBase : public ::mlir::OperationPass { +public: + using Base = AffineParallelizeBase; + + AffineParallelizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineParallelizeBase(const AffineParallelizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-parallelize"); + } + ::llvm::StringRef getArgument() const override { return "affine-parallelize"; } + + ::llvm::StringRef getDescription() const override { return "Convert affine.for ops into 1-D affine.parallel"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineParallelize"); + } + ::llvm::StringRef getName() const override { return "AffineParallelize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineParallelizeBase) + + AffineParallelizeBase(const AffineParallelizeOptions &options) : AffineParallelizeBase() { + maxNested = options.maxNested; + parallelReductions = options.parallelReductions; + } +protected: + ::mlir::Pass::Option maxNested{*this, "max-nested", ::llvm::cl::desc("Maximum number of nested parallel loops to produce. Defaults to unlimited (UINT_MAX)."), ::llvm::cl::init(-1u)}; + ::mlir::Pass::Option parallelReductions{*this, "parallel-reductions", ::llvm::cl::desc("Whether to parallelize reduction loops. Defaults to false."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINEPARALLELIZE +#endif // GEN_PASS_DEF_AFFINEPARALLELIZE + +//===----------------------------------------------------------------------===// +// AffinePipelineDataTransfer +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINEPIPELINEDATATRANSFER +#undef GEN_PASS_DECL_AFFINEPIPELINEDATATRANSFER +#endif // GEN_PASS_DECL_AFFINEPIPELINEDATATRANSFER +#ifdef GEN_PASS_DEF_AFFINEPIPELINEDATATRANSFER +namespace impl { + +template +class AffinePipelineDataTransferBase : public ::mlir::OperationPass { +public: + using Base = AffinePipelineDataTransferBase; + + AffinePipelineDataTransferBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffinePipelineDataTransferBase(const AffinePipelineDataTransferBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-pipeline-data-transfer"); + } + ::llvm::StringRef getArgument() const override { return "affine-pipeline-data-transfer"; } + + ::llvm::StringRef getDescription() const override { return "Pipeline non-blocking data transfers between explicitly managed levels of the memory hierarchy"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffinePipelineDataTransfer"); + } + ::llvm::StringRef getName() const override { return "AffinePipelineDataTransfer"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffinePipelineDataTransferBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINEPIPELINEDATATRANSFER +#endif // GEN_PASS_DEF_AFFINEPIPELINEDATATRANSFER + +//===----------------------------------------------------------------------===// +// AffineScalarReplacement +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINESCALARREPLACEMENT +#undef GEN_PASS_DECL_AFFINESCALARREPLACEMENT +#endif // GEN_PASS_DECL_AFFINESCALARREPLACEMENT +#ifdef GEN_PASS_DEF_AFFINESCALARREPLACEMENT +namespace impl { + +template +class AffineScalarReplacementBase : public ::mlir::OperationPass { +public: + using Base = AffineScalarReplacementBase; + + AffineScalarReplacementBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineScalarReplacementBase(const AffineScalarReplacementBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-scalrep"); + } + ::llvm::StringRef getArgument() const override { return "affine-scalrep"; } + + ::llvm::StringRef getDescription() const override { return "Replace affine memref accesses by scalars by forwarding stores to loads and eliminating redundant loads"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineScalarReplacement"); + } + ::llvm::StringRef getName() const override { return "AffineScalarReplacement"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineScalarReplacementBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_AFFINESCALARREPLACEMENT +#endif // GEN_PASS_DEF_AFFINESCALARREPLACEMENT + +//===----------------------------------------------------------------------===// +// AffineVectorize +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_AFFINEVECTORIZE +struct AffineVectorizeOptions { + ::llvm::ArrayRef vectorSizes; + ::llvm::ArrayRef fastestVaryingPattern; + bool vectorizeReductions = false; +}; +std::unique_ptr<::mlir::Pass> createAffineVectorize(); +std::unique_ptr<::mlir::Pass> createAffineVectorize(const AffineVectorizeOptions &options); +#undef GEN_PASS_DECL_AFFINEVECTORIZE +#endif // GEN_PASS_DECL_AFFINEVECTORIZE +#ifdef GEN_PASS_DEF_AFFINEVECTORIZE + +namespace impl { + std::unique_ptr<::mlir::Pass> createAffineVectorize(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createAffineVectorize(const AffineVectorizeOptions &options); +} // namespace impl +namespace impl { + +template +class AffineVectorizeBase : public ::mlir::OperationPass { +public: + using Base = AffineVectorizeBase; + + AffineVectorizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineVectorizeBase(const AffineVectorizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-super-vectorize"); + } + ::llvm::StringRef getArgument() const override { return "affine-super-vectorize"; } + + ::llvm::StringRef getDescription() const override { return "Vectorize to a target independent n-D vector abstraction"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineVectorize"); + } + ::llvm::StringRef getName() const override { return "AffineVectorize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineVectorizeBase) + + AffineVectorizeBase(const AffineVectorizeOptions &options) : AffineVectorizeBase() { + vectorSizes = options.vectorSizes; + fastestVaryingPattern = options.fastestVaryingPattern; + vectorizeReductions = options.vectorizeReductions; + } +protected: + ::mlir::Pass::ListOption vectorSizes{*this, "virtual-vector-size", ::llvm::cl::desc("Specify an n-D virtual vector size for vectorization. This must be greater than zero.")}; + ::mlir::Pass::ListOption fastestVaryingPattern{*this, "test-fastest-varying", ::llvm::cl::desc("Specify a 1-D, 2-D or 3-D pattern of fastest varying memory dimensions to match. See defaultPatterns in Vectorize.cpp for a description and examples. This is used for testing purposes")}; + ::mlir::Pass::Option vectorizeReductions{*this, "vectorize-reductions", ::llvm::cl::desc("Vectorize known reductions expressed via iter_args. Switched off by default."), ::llvm::cl::init(false)}; +private: + + friend std::unique_ptr<::mlir::Pass> createAffineVectorize() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createAffineVectorize(const AffineVectorizeOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createAffineVectorize() { + return impl::createAffineVectorize(); +} + +std::unique_ptr<::mlir::Pass> createAffineVectorize(const AffineVectorizeOptions &options) { + return impl::createAffineVectorize(options); +} +#undef GEN_PASS_DEF_AFFINEVECTORIZE +#endif // GEN_PASS_DEF_AFFINEVECTORIZE + +//===----------------------------------------------------------------------===// +// LoopCoalescing +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LOOPCOALESCING +#undef GEN_PASS_DECL_LOOPCOALESCING +#endif // GEN_PASS_DECL_LOOPCOALESCING +#ifdef GEN_PASS_DEF_LOOPCOALESCING +namespace impl { + +template +class LoopCoalescingBase : public ::mlir::OperationPass { +public: + using Base = LoopCoalescingBase; + + LoopCoalescingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LoopCoalescingBase(const LoopCoalescingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-coalescing"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-coalescing"; } + + ::llvm::StringRef getDescription() const override { return "Coalesce nested loops with independent bounds into a single loop"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LoopCoalescing"); + } + ::llvm::StringRef getName() const override { return "LoopCoalescing"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LoopCoalescingBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LOOPCOALESCING +#endif // GEN_PASS_DEF_LOOPCOALESCING + +//===----------------------------------------------------------------------===// +// SimplifyAffineStructures +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SIMPLIFYAFFINESTRUCTURES +#undef GEN_PASS_DECL_SIMPLIFYAFFINESTRUCTURES +#endif // GEN_PASS_DECL_SIMPLIFYAFFINESTRUCTURES +#ifdef GEN_PASS_DEF_SIMPLIFYAFFINESTRUCTURES +namespace impl { + +template +class SimplifyAffineStructuresBase : public ::mlir::OperationPass { +public: + using Base = SimplifyAffineStructuresBase; + + SimplifyAffineStructuresBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SimplifyAffineStructuresBase(const SimplifyAffineStructuresBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-simplify-structures"); + } + ::llvm::StringRef getArgument() const override { return "affine-simplify-structures"; } + + ::llvm::StringRef getDescription() const override { return "Simplify affine expressions in maps/sets and normalize memrefs"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SimplifyAffineStructures"); + } + ::llvm::StringRef getName() const override { return "SimplifyAffineStructures"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SimplifyAffineStructuresBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_SIMPLIFYAFFINESTRUCTURES +#endif // GEN_PASS_DEF_SIMPLIFYAFFINESTRUCTURES +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// AffineDataCopyGeneration Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineDataCopyGeneration() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineDataCopyGenerationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineDataCopyGenerationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineDataCopyGenerationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineExpandIndexOps Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineExpandIndexOps() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineExpandIndexOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineExpandIndexOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineExpandIndexOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineLoopFusion Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineLoopFusion() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopFusionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineLoopFusionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopFusionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineLoopInvariantCodeMotion Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineLoopInvariantCodeMotion() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineLoopInvariantCodeMotionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineLoopInvariantCodeMotionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineLoopInvariantCodeMotionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineLoopNormalize Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineLoopNormalize() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineLoopNormalizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineLoopNormalizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineLoopNormalizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineLoopTiling Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineLoopTiling() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopTilingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineLoopTilingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopTilingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineLoopUnroll Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineLoopUnroll() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopUnrollPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineLoopUnrollPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopUnrollPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineLoopUnrollAndJam Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineLoopUnrollAndJam() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopUnrollAndJamPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineLoopUnrollAndJamPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopUnrollAndJamPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineParallelize Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineParallelize() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineParallelizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineParallelizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineParallelizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffinePipelineDataTransfer Registration +//===----------------------------------------------------------------------===// + +inline void registerAffinePipelineDataTransfer() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createPipelineDataTransferPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffinePipelineDataTransferPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createPipelineDataTransferPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineScalarReplacement Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineScalarReplacement() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineScalarReplacementPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineScalarReplacementPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createAffineScalarReplacementPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AffineVectorize Registration +//===----------------------------------------------------------------------===// + +inline void registerAffineVectorize() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createAffineVectorize(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAffineVectorizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createAffineVectorize(); + }); +} + +//===----------------------------------------------------------------------===// +// LoopCoalescing Registration +//===----------------------------------------------------------------------===// + +inline void registerLoopCoalescing() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopCoalescingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLoopCoalescingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createLoopCoalescingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// SimplifyAffineStructures Registration +//===----------------------------------------------------------------------===// + +inline void registerSimplifyAffineStructures() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createSimplifyAffineStructuresPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerSimplifyAffineStructuresPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::affine::createSimplifyAffineStructuresPass(); + }); +} + +//===----------------------------------------------------------------------===// +// Affine Registration +//===----------------------------------------------------------------------===// + +inline void registerAffinePasses() { + registerAffineDataCopyGeneration(); + registerAffineExpandIndexOps(); + registerAffineLoopFusion(); + registerAffineLoopInvariantCodeMotion(); + registerAffineLoopNormalize(); + registerAffineLoopTiling(); + registerAffineLoopUnroll(); + registerAffineLoopUnrollAndJam(); + registerAffineParallelize(); + registerAffinePipelineDataTransfer(); + registerAffineScalarReplacement(); + registerAffineVectorize(); + registerLoopCoalescing(); + registerSimplifyAffineStructures(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class AffineDataCopyGenerationBase : public ::mlir::OperationPass { +public: + using Base = AffineDataCopyGenerationBase; + + AffineDataCopyGenerationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineDataCopyGenerationBase(const AffineDataCopyGenerationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-data-copy-generate"); + } + ::llvm::StringRef getArgument() const override { return "affine-data-copy-generate"; } + + ::llvm::StringRef getDescription() const override { return "Generate explicit copying for affine memory operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineDataCopyGeneration"); + } + ::llvm::StringRef getName() const override { return "AffineDataCopyGeneration"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineDataCopyGenerationBase) + +protected: + ::mlir::Pass::Option fastMemoryCapacity{*this, "fast-mem-capacity", ::llvm::cl::desc("Set fast memory space capacity in KiB (default: unlimited)"), ::llvm::cl::init(std::numeric_limits::max())}; + ::mlir::Pass::Option fastMemorySpace{*this, "fast-mem-space", ::llvm::cl::desc("Fast memory space identifier for copy generation (default: 1)"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option generateDma{*this, "generate-dma", ::llvm::cl::desc("Generate DMA instead of point-wise copy"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option minDmaTransferSize{*this, "min-dma-transfer", ::llvm::cl::desc("Minimum DMA transfer size supported by the target in bytes"), ::llvm::cl::init(1024)}; + ::mlir::Pass::Option slowMemorySpace{*this, "slow-mem-space", ::llvm::cl::desc("Slow memory space identifier for copy generation (default: 0)"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option skipNonUnitStrideLoops{*this, "skip-non-unit-stride-loops", ::llvm::cl::desc("Testing purposes: avoid non-unit stride loop choice depths for copy placement"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option tagMemorySpace{*this, "tag-mem-space", ::llvm::cl::desc("Tag memory space identifier for copy generation (default: 0)"), ::llvm::cl::init(0)}; +}; + +template +class AffineExpandIndexOpsBase : public ::mlir::OperationPass<> { +public: + using Base = AffineExpandIndexOpsBase; + + AffineExpandIndexOpsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AffineExpandIndexOpsBase(const AffineExpandIndexOpsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-expand-index-ops"); + } + ::llvm::StringRef getArgument() const override { return "affine-expand-index-ops"; } + + ::llvm::StringRef getDescription() const override { return "Lower affine operations operating on indices into more fundamental operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineExpandIndexOps"); + } + ::llvm::StringRef getName() const override { return "AffineExpandIndexOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineExpandIndexOpsBase) + +protected: +}; + +template +class AffineLoopFusionBase : public ::mlir::OperationPass<> { +public: + using Base = AffineLoopFusionBase; + + AffineLoopFusionBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AffineLoopFusionBase(const AffineLoopFusionBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-fusion"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-fusion"; } + + ::llvm::StringRef getDescription() const override { return "Fuse affine loop nests"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopFusion"); + } + ::llvm::StringRef getName() const override { return "AffineLoopFusion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopFusionBase) + +protected: + ::mlir::Pass::Option computeToleranceThreshold{*this, "fusion-compute-tolerance", ::llvm::cl::desc("Fractional increase in additional computation tolerated while fusing"), ::llvm::cl::init(0.30f)}; + ::mlir::Pass::Option fastMemorySpace{*this, "fusion-fast-mem-space", ::llvm::cl::desc("Faster memory space number to promote fusion buffers to"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option localBufSizeThreshold{*this, "fusion-local-buf-threshold", ::llvm::cl::desc("Threshold size (KiB) for promoting local buffers to fast memory space"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option maximalFusion{*this, "fusion-maximal", ::llvm::cl::desc("Enables maximal loop fusion"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option affineFusionMode{*this, "mode", ::llvm::cl::desc("fusion mode to attempt"), ::llvm::cl::init(mlir::affine::FusionMode::Greedy), llvm::cl::values(clEnumValN(mlir::affine::FusionMode::Greedy, "greedy", "Perform greedy (both producer-consumer and sibling) fusion"), clEnumValN( mlir::affine::FusionMode::ProducerConsumer, "producer", "Perform only producer-consumer fusion"), clEnumValN( mlir::affine::FusionMode::Sibling, "sibling", "Perform only sibling fusion"))}; +}; + +template +class AffineLoopInvariantCodeMotionBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopInvariantCodeMotionBase; + + AffineLoopInvariantCodeMotionBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopInvariantCodeMotionBase(const AffineLoopInvariantCodeMotionBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-invariant-code-motion"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-invariant-code-motion"; } + + ::llvm::StringRef getDescription() const override { return "Hoist loop invariant instructions outside of affine loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopInvariantCodeMotion"); + } + ::llvm::StringRef getName() const override { return "AffineLoopInvariantCodeMotion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopInvariantCodeMotionBase) + +protected: +}; + +template +class AffineLoopNormalizeBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopNormalizeBase; + + AffineLoopNormalizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopNormalizeBase(const AffineLoopNormalizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-normalize"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-normalize"; } + + ::llvm::StringRef getDescription() const override { return "Apply normalization transformations to affine loop-like ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopNormalize"); + } + ::llvm::StringRef getName() const override { return "AffineLoopNormalize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopNormalizeBase) + +protected: + ::mlir::Pass::Option promoteSingleIter{*this, "promote-single-iter", ::llvm::cl::desc("Promote single iteration loops"), ::llvm::cl::init(true)}; +}; + +template +class AffineLoopTilingBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopTilingBase; + + AffineLoopTilingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopTilingBase(const AffineLoopTilingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-tile"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-tile"; } + + ::llvm::StringRef getDescription() const override { return "Tile affine loop nests"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopTiling"); + } + ::llvm::StringRef getName() const override { return "AffineLoopTiling"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopTilingBase) + +protected: + ::mlir::Pass::Option cacheSizeInKiB{*this, "cache-size", ::llvm::cl::desc("Set size of cache to tile for in KiB (default: 512)"), ::llvm::cl::init(512)}; + ::mlir::Pass::Option separate{*this, "separate", ::llvm::cl::desc("Separate full and partial tiles (default: false)"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option tileSize{*this, "tile-size", ::llvm::cl::desc("Use this tile size for all loops")}; + ::mlir::Pass::ListOption tileSizes{*this, "tile-sizes", ::llvm::cl::desc("List of tile sizes for each perfect nest (overridden by -tile-size)")}; +}; + +template +class AffineLoopUnrollBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopUnrollBase; + + AffineLoopUnrollBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopUnrollBase(const AffineLoopUnrollBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-unroll"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-unroll"; } + + ::llvm::StringRef getDescription() const override { return "Unroll affine loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopUnroll"); + } + ::llvm::StringRef getName() const override { return "AffineLoopUnroll"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopUnrollBase) + +protected: + ::mlir::Pass::Option unrollFactor{*this, "unroll-factor", ::llvm::cl::desc("Use this unroll factor for all loops being unrolled"), ::llvm::cl::init(4)}; + ::mlir::Pass::Option unrollUpToFactor{*this, "unroll-up-to-factor", ::llvm::cl::desc("Allow unrolling up to the factor specified"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option unrollFull{*this, "unroll-full", ::llvm::cl::desc("Fully unroll loops"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option numRepetitions{*this, "unroll-num-reps", ::llvm::cl::desc("Unroll innermost loops repeatedly this many times"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option unrollFullThreshold{*this, "unroll-full-threshold", ::llvm::cl::desc("Unroll all loops with trip count less than or equal to this"), ::llvm::cl::init(1)}; + ::mlir::Pass::Option cleanUpUnroll{*this, "cleanup-unroll", ::llvm::cl::desc("Fully unroll the cleanup loop when possible."), ::llvm::cl::init(false)}; +}; + +template +class AffineLoopUnrollAndJamBase : public ::mlir::OperationPass { +public: + using Base = AffineLoopUnrollAndJamBase; + + AffineLoopUnrollAndJamBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineLoopUnrollAndJamBase(const AffineLoopUnrollAndJamBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-unroll-jam"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-unroll-jam"; } + + ::llvm::StringRef getDescription() const override { return "Unroll and jam affine loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineLoopUnrollAndJam"); + } + ::llvm::StringRef getName() const override { return "AffineLoopUnrollAndJam"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineLoopUnrollAndJamBase) + +protected: + ::mlir::Pass::Option unrollJamFactor{*this, "unroll-jam-factor", ::llvm::cl::desc("Use this unroll jam factor for all loops (default 4)"), ::llvm::cl::init(4)}; +}; + +template +class AffineParallelizeBase : public ::mlir::OperationPass { +public: + using Base = AffineParallelizeBase; + + AffineParallelizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineParallelizeBase(const AffineParallelizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-parallelize"); + } + ::llvm::StringRef getArgument() const override { return "affine-parallelize"; } + + ::llvm::StringRef getDescription() const override { return "Convert affine.for ops into 1-D affine.parallel"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineParallelize"); + } + ::llvm::StringRef getName() const override { return "AffineParallelize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineParallelizeBase) + +protected: + ::mlir::Pass::Option maxNested{*this, "max-nested", ::llvm::cl::desc("Maximum number of nested parallel loops to produce. Defaults to unlimited (UINT_MAX)."), ::llvm::cl::init(-1u)}; + ::mlir::Pass::Option parallelReductions{*this, "parallel-reductions", ::llvm::cl::desc("Whether to parallelize reduction loops. Defaults to false."), ::llvm::cl::init(false)}; +}; + +template +class AffinePipelineDataTransferBase : public ::mlir::OperationPass { +public: + using Base = AffinePipelineDataTransferBase; + + AffinePipelineDataTransferBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffinePipelineDataTransferBase(const AffinePipelineDataTransferBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-pipeline-data-transfer"); + } + ::llvm::StringRef getArgument() const override { return "affine-pipeline-data-transfer"; } + + ::llvm::StringRef getDescription() const override { return "Pipeline non-blocking data transfers between explicitly managed levels of the memory hierarchy"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffinePipelineDataTransfer"); + } + ::llvm::StringRef getName() const override { return "AffinePipelineDataTransfer"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffinePipelineDataTransferBase) + +protected: +}; + +template +class AffineScalarReplacementBase : public ::mlir::OperationPass { +public: + using Base = AffineScalarReplacementBase; + + AffineScalarReplacementBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineScalarReplacementBase(const AffineScalarReplacementBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-scalrep"); + } + ::llvm::StringRef getArgument() const override { return "affine-scalrep"; } + + ::llvm::StringRef getDescription() const override { return "Replace affine memref accesses by scalars by forwarding stores to loads and eliminating redundant loads"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineScalarReplacement"); + } + ::llvm::StringRef getName() const override { return "AffineScalarReplacement"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineScalarReplacementBase) + +protected: +}; + +template +class AffineVectorizeBase : public ::mlir::OperationPass { +public: + using Base = AffineVectorizeBase; + + AffineVectorizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AffineVectorizeBase(const AffineVectorizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-super-vectorize"); + } + ::llvm::StringRef getArgument() const override { return "affine-super-vectorize"; } + + ::llvm::StringRef getDescription() const override { return "Vectorize to a target independent n-D vector abstraction"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AffineVectorize"); + } + ::llvm::StringRef getName() const override { return "AffineVectorize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AffineVectorizeBase) + +protected: + ::mlir::Pass::ListOption vectorSizes{*this, "virtual-vector-size", ::llvm::cl::desc("Specify an n-D virtual vector size for vectorization. This must be greater than zero.")}; + ::mlir::Pass::ListOption fastestVaryingPattern{*this, "test-fastest-varying", ::llvm::cl::desc("Specify a 1-D, 2-D or 3-D pattern of fastest varying memory dimensions to match. See defaultPatterns in Vectorize.cpp for a description and examples. This is used for testing purposes")}; + ::mlir::Pass::Option vectorizeReductions{*this, "vectorize-reductions", ::llvm::cl::desc("Vectorize known reductions expressed via iter_args. Switched off by default."), ::llvm::cl::init(false)}; +}; + +template +class LoopCoalescingBase : public ::mlir::OperationPass { +public: + using Base = LoopCoalescingBase; + + LoopCoalescingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LoopCoalescingBase(const LoopCoalescingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-loop-coalescing"); + } + ::llvm::StringRef getArgument() const override { return "affine-loop-coalescing"; } + + ::llvm::StringRef getDescription() const override { return "Coalesce nested loops with independent bounds into a single loop"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LoopCoalescing"); + } + ::llvm::StringRef getName() const override { return "LoopCoalescing"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LoopCoalescingBase) + +protected: +}; + +template +class SimplifyAffineStructuresBase : public ::mlir::OperationPass { +public: + using Base = SimplifyAffineStructuresBase; + + SimplifyAffineStructuresBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SimplifyAffineStructuresBase(const SimplifyAffineStructuresBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("affine-simplify-structures"); + } + ::llvm::StringRef getArgument() const override { return "affine-simplify-structures"; } + + ::llvm::StringRef getDescription() const override { return "Simplify affine expressions in maps/sets and normalize memrefs"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SimplifyAffineStructures"); + } + ::llvm::StringRef getName() const override { return "SimplifyAffineStructures"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SimplifyAffineStructuresBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Transforms/Transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Transforms/Transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..8e840e744064d5481bd9941a3e676d482e0e55db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Transforms/Transforms.h @@ -0,0 +1,105 @@ +//===- Transforms.h - Transforms Entrypoints --------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines a set of transforms specific for the AffineOps +// dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_TRANSFORMS_TRANSFORMS_H +#define MLIR_DIALECT_AFFINE_TRANSFORMS_TRANSFORMS_H + +#include "mlir/Interfaces/ValueBoundsOpInterface.h" +#include "mlir/Support/LLVM.h" +#include "mlir/Support/LogicalResult.h" + +namespace mlir { +class AffineMap; +class Location; +class OpBuilder; +class OpFoldResult; +class RewritePatternSet; +class RewriterBase; +class Value; + +namespace presburger { +enum class BoundType; +} // namespace presburger + +namespace affine { +class AffineApplyOp; + +/// Populate patterns that expand affine index operations into more fundamental +/// operations (not necessarily restricted to Affine dialect). +void populateAffineExpandIndexOpsPatterns(RewritePatternSet &patterns); + +/// Helper function to rewrite `op`'s affine map and reorder its operands such +/// that they are in increasing order of hoistability (i.e. the least hoistable) +/// operands come first in the operand list. +void reorderOperandsByHoistability(RewriterBase &rewriter, AffineApplyOp op); + +/// Split an "affine.apply" operation into smaller ops. +/// This reassociates a large AffineApplyOp into an ordered list of smaller +/// AffineApplyOps. This can be used right before lowering affine ops to arith +/// to exhibit more opportunities for CSE and LICM. +/// Return the sink AffineApplyOp on success or failure if `op` does not +/// decompose into smaller AffineApplyOps. +/// Note that this can be undone by canonicalization which tries to +/// maximally compose chains of AffineApplyOps. +FailureOr decompose(RewriterBase &rewriter, AffineApplyOp op); + +/// Reify a bound for the given index-typed value in terms of SSA values for +/// which `stopCondition` is met. If no stop condition is specified, reify in +/// terms of the operands of the owner op. +/// +/// By default, lower/equal bounds are closed and upper bounds are open. If +/// `closedUB` is set to "true", upper bounds are also closed. +/// +/// Example: +/// %0 = arith.addi %a, %b : index +/// %1 = arith.addi %0, %c : index +/// +/// * If `stopCondition` evaluates to "true" for %0 and %c, "%0 + %c" is an EQ +/// bound for %1. +/// * If `stopCondition` evaluates to "true" for %a, %b and %c, "%a + %b + %c" +/// is an EQ bound for %1. +/// * Otherwise, if the owners of %a, %b or %c do not implement the +/// ValueBoundsOpInterface, no bound can be computed. +FailureOr reifyIndexValueBound( + OpBuilder &b, Location loc, presburger::BoundType type, Value value, + ValueBoundsConstraintSet::StopConditionFn stopCondition = nullptr, + bool closedUB = false); + +/// Reify a bound for the specified dimension of the given shaped value in terms +/// of SSA values for which `stopCondition` is met. If no stop condition is +/// specified, reify in terms of the operands of the owner op. +/// +/// By default, lower/equal bounds are closed and upper bounds are open. If +/// `closedUB` is set to "true", upper bounds are also closed. +FailureOr reifyShapedValueDimBound( + OpBuilder &b, Location loc, presburger::BoundType type, Value value, + int64_t dim, + ValueBoundsConstraintSet::StopConditionFn stopCondition = nullptr, + bool closedUB = false); + +/// Materialize an already computed bound with Affine dialect ops. +/// +/// * `ValueBoundsOpInterface::computeBound` computes bounds but does not +/// create IR. It is dialect independent. +/// * `materializeComputedBound` materializes computed bounds with Affine +/// dialect ops. +/// * `reifyIndexValueBound`/`reifyShapedValueDimBound` are a combination of +/// the two functions mentioned above. +OpFoldResult materializeComputedBound( + OpBuilder &b, Location loc, AffineMap boundMap, + ArrayRef>> mapOperands); + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_TRANSFORMS_TRANSFORMS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Utils.h new file mode 100644 index 0000000000000000000000000000000000000000..b3ccbff3002fb1f85e78446ae7fd48a22d12f5e3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/Utils.h @@ -0,0 +1,379 @@ +//===- Utils.h - Affine dialect utilities -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file declares a set of utilities for the affine dialect ops. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_UTILS_H +#define MLIR_DIALECT_AFFINE_UTILS_H + +#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h" +#include "mlir/Dialect/Affine/IR/AffineOps.h" +#include + +namespace mlir { +class DominanceInfo; +class Operation; +class PostDominanceInfo; + +namespace func { +class FuncOp; +} // namespace func + +namespace memref { +class AllocOp; +} // namespace memref + +struct LogicalResult; + +namespace affine { +class AffineForOp; +class AffineIfOp; +class AffineParallelOp; + +using ReductionLoopMap = DenseMap>; + +/// Replaces a parallel affine.for op with a 1-d affine.parallel op. `forOp`'s +/// body is taken by the affine.parallel op and the former is erased. +/// (mlir::isLoopParallel can be used to detect a parallel affine.for op.) The +/// reductions specified in `parallelReductions` are also parallelized. +/// Parallelization will fail in the presence of loop iteration arguments that +/// are not listed in `parallelReductions`. `resOp` if non-null is set to the +/// newly created affine.parallel op. +LogicalResult affineParallelize(AffineForOp forOp, + ArrayRef parallelReductions = {}, + AffineParallelOp *resOp = nullptr); + +/// Hoists out affine.if/else to as high as possible, i.e., past all invariant +/// affine.fors/parallel's. Returns success if any hoisting happened; folded` is +/// set to true if the op was folded or erased. This hoisting could lead to +/// significant code expansion in some cases. +LogicalResult hoistAffineIfOp(AffineIfOp ifOp, bool *folded = nullptr); + +/// Holds parameters to perform n-D vectorization on a single loop nest. +/// For example, for the following loop nest: +/// +/// func @vec2d(%in: memref<64x128x512xf32>, %out: memref<64x128x512xf32>) { +/// affine.for %i0 = 0 to 64 { +/// affine.for %i1 = 0 to 128 { +/// affine.for %i2 = 0 to 512 { +/// %ld = affine.load %in[%i0, %i1, %i2] : memref<64x128x512xf32> +/// affine.store %ld, %out[%i0, %i1, %i2] : memref<64x128x512xf32> +/// } +/// } +/// } +/// return +/// } +/// +/// and VectorizationStrategy = 'vectorSizes = {8, 4}', 'loopToVectorDim = +/// {{i1->0}, {i2->1}}', SuperVectorizer will generate: +/// +/// func @vec2d(%arg0: memref<64x128x512xf32>, %arg1: memref<64x128x512xf32>) { +/// affine.for %arg2 = 0 to 64 { +/// affine.for %arg3 = 0 to 128 step 8 { +/// affine.for %arg4 = 0 to 512 step 4 { +/// %cst = arith.constant 0.000000e+00 : f32 +/// %0 = vector.transfer_read %arg0[%arg2, %arg3, %arg4], %cst : ... +/// vector.transfer_write %0, %arg1[%arg2, %arg3, %arg4] : ... +/// } +/// } +/// } +/// return +/// } +// TODO: Hoist to a VectorizationStrategy.cpp when appropriate. +struct VectorizationStrategy { + // Vectorization factors to apply to each target vector dimension. + // Each factor will be applied to a different loop. + SmallVector vectorSizes; + // Maps each AffineForOp vectorization candidate with its vector dimension. + // The candidate will be vectorized using the vectorization factor in + // 'vectorSizes' for that dimension. + DenseMap loopToVectorDim; + // Maps loops that implement vectorizable reductions to the corresponding + // reduction descriptors. + ReductionLoopMap reductionLoops; +}; + +/// Replace affine store and load accesses by scalars by forwarding stores to +/// loads and eliminate invariant affine loads; consequently, eliminate dead +/// allocs. +void affineScalarReplace(func::FuncOp f, DominanceInfo &domInfo, + PostDominanceInfo &postDomInfo); + +/// Vectorizes affine loops in 'loops' using the n-D vectorization factors in +/// 'vectorSizes'. By default, each vectorization factor is applied +/// inner-to-outer to the loops of each loop nest. 'fastestVaryingPattern' can +/// be optionally used to provide a different loop vectorization order. +/// If `reductionLoops` is not empty, the given reduction loops may be +/// vectorized along the reduction dimension. +/// TODO: Vectorizing reductions is supported only for 1-D vectorization. +void vectorizeAffineLoops( + Operation *parentOp, + llvm::DenseSet> &loops, + ArrayRef vectorSizes, ArrayRef fastestVaryingPattern, + const ReductionLoopMap &reductionLoops = ReductionLoopMap()); + +/// External utility to vectorize affine loops from a single loop nest using an +/// n-D vectorization strategy (see doc in VectorizationStrategy definition). +/// Loops are provided in a 2D vector container. The first dimension represents +/// the nesting level relative to the loops to be vectorized. The second +/// dimension contains the loops. This means that: +/// a) every loop in 'loops[i]' must have a parent loop in 'loops[i-1]', +/// b) a loop in 'loops[i]' may or may not have a child loop in 'loops[i+1]'. +/// +/// For example, for the following loop nest: +/// +/// func @vec2d(%in0: memref<64x128x512xf32>, %in1: memref<64x128x128xf32>, +/// %out0: memref<64x128x512xf32>, +/// %out1: memref<64x128x128xf32>) { +/// affine.for %i0 = 0 to 64 { +/// affine.for %i1 = 0 to 128 { +/// affine.for %i2 = 0 to 512 { +/// %ld = affine.load %in0[%i0, %i1, %i2] : memref<64x128x512xf32> +/// affine.store %ld, %out0[%i0, %i1, %i2] : memref<64x128x512xf32> +/// } +/// affine.for %i3 = 0 to 128 { +/// %ld = affine.load %in1[%i0, %i1, %i3] : memref<64x128x128xf32> +/// affine.store %ld, %out1[%i0, %i1, %i3] : memref<64x128x128xf32> +/// } +/// } +/// } +/// return +/// } +/// +/// loops = {{%i0}, {%i2, %i3}}, to vectorize the outermost and the two +/// innermost loops; +/// loops = {{%i1}, {%i2, %i3}}, to vectorize the middle and the two innermost +/// loops; +/// loops = {{%i2}}, to vectorize only the first innermost loop; +/// loops = {{%i3}}, to vectorize only the second innermost loop; +/// loops = {{%i1}}, to vectorize only the middle loop. +LogicalResult +vectorizeAffineLoopNest(std::vector> &loops, + const VectorizationStrategy &strategy); + +/// Normalize a affine.parallel op so that lower bounds are 0 and steps are 1. +/// As currently implemented, this transformation cannot fail and will return +/// early if the op is already in a normalized form. +void normalizeAffineParallel(AffineParallelOp op); + +/// Normalize an affine.for op. An affine.for op is normalized by converting the +/// lower bound to zero and loop step to one. The upper bound is set to the trip +/// count of the loop. Original loops must have a lower bound with only a single +/// result. There is no such restriction on upper bounds. Returns success if the +/// loop has been normalized (or is already in the normal form). If +/// `promoteSingleIter` is true, the loop is simply promoted if it has a single +/// iteration. +LogicalResult normalizeAffineFor(AffineForOp op, + bool promoteSingleIter = false); + +/// Traverse `e` and return an AffineExpr where all occurrences of `dim` have +/// been replaced by either: +/// - `min` if `positivePath` is true when we reach an occurrence of `dim` +/// - `max` if `positivePath` is true when we reach an occurrence of `dim` +/// `positivePath` is negated each time we hit a multiplicative or divisive +/// binary op with a constant negative coefficient. +AffineExpr substWithMin(AffineExpr e, AffineExpr dim, AffineExpr min, + AffineExpr max, bool positivePath = true); + +/// Replaces all "dereferencing" uses of `oldMemRef` with `newMemRef` while +/// optionally remapping the old memref's indices using the supplied affine map, +/// `indexRemap`. The new memref could be of a different shape or rank. +/// `extraIndices` provides any additional access indices to be added to the +/// start. +/// +/// `indexRemap` remaps indices of the old memref access to a new set of indices +/// that are used to index the memref. Additional input operands to indexRemap +/// can be optionally provided in `extraOperands`, and they occupy the start +/// of its input list. `indexRemap`'s dimensional inputs are expected to +/// correspond to memref's indices, and its symbolic inputs if any should be +/// provided in `symbolOperands`. +/// +/// `domOpFilter`, if non-null, restricts the replacement to only those +/// operations that are dominated by the former; similarly, `postDomOpFilter` +/// restricts replacement to only those operations that are postdominated by it. +/// +/// 'allowNonDereferencingOps', if set, allows replacement of non-dereferencing +/// uses of a memref without any requirement for access index rewrites as long +/// as the user operation has the MemRefsNormalizable trait. The default value +/// of this flag is false. +/// +/// 'replaceInDeallocOp', if set, lets DeallocOp, a non-dereferencing user, to +/// also be a candidate for replacement. The default value of this flag is +/// false. +/// +/// Returns true on success and false if the replacement is not possible, +/// whenever a memref is used as an operand in a non-dereferencing context and +/// 'allowNonDereferencingOps' is false, except for dealloc's on the memref +/// which are left untouched. See comments at function definition for an +/// example. +// +// Ex: to replace load %A[%i, %j] with load %Abuf[%t mod 2, %ii - %i, %j]: +// The SSA value corresponding to '%t mod 2' should be in 'extraIndices', and +// index remap will perform (%i, %j) -> (%ii - %i, %j), i.e., indexRemap = (d0, +// d1, d2) -> (d0 - d1, d2), and %ii will be the extra operand. Without any +// extra operands, note that 'indexRemap' would just be applied to existing +// indices (%i, %j). +// TODO: allow extraIndices to be added at any position. +LogicalResult replaceAllMemRefUsesWith( + Value oldMemRef, Value newMemRef, ArrayRef extraIndices = {}, + AffineMap indexRemap = AffineMap(), ArrayRef extraOperands = {}, + ArrayRef symbolOperands = {}, Operation *domOpFilter = nullptr, + Operation *postDomOpFilter = nullptr, bool allowNonDereferencingOps = false, + bool replaceInDeallocOp = false); + +/// Performs the same replacement as the other version above but only for the +/// dereferencing uses of `oldMemRef` in `op`, except in cases where +/// 'allowNonDereferencingOps' is set to true where we replace the +/// non-dereferencing uses as well. +LogicalResult replaceAllMemRefUsesWith(Value oldMemRef, Value newMemRef, + Operation *op, + ArrayRef extraIndices = {}, + AffineMap indexRemap = AffineMap(), + ArrayRef extraOperands = {}, + ArrayRef symbolOperands = {}, + bool allowNonDereferencingOps = false); + +/// Rewrites the memref defined by this alloc op to have an identity layout map +/// and updates all its indexing uses. Returns failure if any of its uses +/// escape (while leaving the IR in a valid state). +LogicalResult normalizeMemRef(memref::AllocOp *op); + +/// Normalizes `memrefType` so that the affine layout map of the memref is +/// transformed to an identity map with a new shape being computed for the +/// normalized memref type and returns it. The old memref type is simplify +/// returned if the normalization failed. +MemRefType normalizeMemRefType(MemRefType memrefType); + +/// Given an operation, inserts one or more single result affine apply +/// operations, results of which are exclusively used by this operation. +/// The operands of these newly created affine apply ops are +/// guaranteed to be loop iterators or terminal symbols of a function. +/// +/// Before +/// +/// affine.for %i = 0 to #map(%N) +/// %idx = affine.apply (d0) -> (d0 mod 2) (%i) +/// send %A[%idx], ... +/// %v = "compute"(%idx, ...) +/// +/// After +/// +/// affine.for %i = 0 to #map(%N) +/// %idx = affine.apply (d0) -> (d0 mod 2) (%i) +/// send %A[%idx], ... +/// %idx_ = affine.apply (d0) -> (d0 mod 2) (%i) +/// %v = "compute"(%idx_, ...) + +/// This allows the application of different transformations on send and +/// compute (for eg. different shifts/delays) +/// +/// Fills `sliceOps` with the list of affine.apply operations. +/// In the following cases, `sliceOps` remains empty: +/// 1. If none of opInst's operands were the result of an affine.apply +/// (i.e., there was no affine computation slice to create). +/// 2. If all the affine.apply op's supplying operands to this opInst did not +/// have any uses other than those in this opInst. +void createAffineComputationSlice(Operation *opInst, + SmallVectorImpl *sliceOps); + +/// Emit code that computes the given affine expression using standard +/// arithmetic operations applied to the provided dimension and symbol values. +Value expandAffineExpr(OpBuilder &builder, Location loc, AffineExpr expr, + ValueRange dimValues, ValueRange symbolValues); + +/// Create a sequence of operations that implement the `affineMap` applied to +/// the given `operands` (as it it were an AffineApplyOp). +std::optional> expandAffineMap(OpBuilder &builder, + Location loc, + AffineMap affineMap, + ValueRange operands); + +/// Holds the result of (div a, b) and (mod a, b). +struct DivModValue { + Value quotient; + Value remainder; +}; + +/// Create IR to calculate (div lhs, rhs) and (mod lhs, rhs). +DivModValue getDivMod(OpBuilder &b, Location loc, Value lhs, Value rhs); + +/// Generate the IR to delinearize `linearIndex` given the `basis` and return +/// the multi-index. +FailureOr> delinearizeIndex(OpBuilder &b, Location loc, + Value linearIndex, + ArrayRef basis); + +/// Ensure that all operations that could be executed after `start` +/// (noninclusive) and prior to `memOp` (e.g. on a control flow/op path +/// between the operations) do not have the potential memory effect +/// `EffectType` on `memOp`. `memOp` is an operation that reads or writes to +/// a memref. For example, if `EffectType` is MemoryEffects::Write, this method +/// will check if there is no write to the memory between `start` and `memOp` +/// that would change the read within `memOp`. +template +bool hasNoInterveningEffect(Operation *start, T memOp); + +struct AffineValueExpr { + explicit AffineValueExpr(AffineExpr e) : e(e) {} + AffineValueExpr bind(Value v) { + this->v = v; + return *this; + } + AffineValueExpr bind(OpFoldResult v) { + this->v = v; + return *this; + } + operator AffineExpr() const { return e; } + operator OpFoldResult() const { return v; } + AffineExpr e; + OpFoldResult v; +}; + +/// Helper struct to build simple AffineValueExprs with minimal type inference +/// support. +struct AffineBuilder { + AffineBuilder(OpBuilder &b, Location loc) : b(b), loc(loc) {} + OpFoldResult add(AffineValueExpr lhs, AffineValueExpr rhs) { + return makeComposedFoldedAffineApply(b, loc, {lhs.e + rhs.e}, {lhs, rhs}); + } + OpFoldResult sub(AffineValueExpr lhs, AffineValueExpr rhs) { + return makeComposedFoldedAffineApply(b, loc, {lhs.e - rhs.e}, {lhs, rhs}); + } + OpFoldResult mul(AffineValueExpr lhs, AffineValueExpr rhs) { + return makeComposedFoldedAffineApply(b, loc, {lhs.e * rhs.e}, {lhs, rhs}); + } + OpFoldResult floor(AffineValueExpr lhs, AffineValueExpr rhs) { + return makeComposedFoldedAffineApply(b, loc, {lhs.e.floorDiv(rhs.e)}, + {lhs, rhs}); + } + OpFoldResult ceil(AffineValueExpr lhs, AffineValueExpr rhs) { + return makeComposedFoldedAffineApply(b, loc, {lhs.e.ceilDiv(rhs.e)}, + {lhs, rhs}); + } + OpFoldResult min(ArrayRef vals) { + return makeComposedFoldedAffineMin( + b, loc, AffineMap::getMultiDimIdentityMap(vals.size(), b.getContext()), + vals); + } + OpFoldResult max(ArrayRef vals) { + return makeComposedFoldedAffineMax( + b, loc, AffineMap::getMultiDimIdentityMap(vals.size(), b.getContext()), + vals); + } + +private: + OpBuilder &b; + Location loc; +}; + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_UTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/ViewLikeInterfaceUtils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/ViewLikeInterfaceUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..a4ec4cec08873ae859d2f819596023ec538d605c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Affine/ViewLikeInterfaceUtils.h @@ -0,0 +1,107 @@ +//===- ViewLikeInterfaceUtils.h ---------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_AFFINE_VIEWLIKEINTERFACEUTILS_H +#define MLIR_DIALECT_AFFINE_VIEWLIKEINTERFACEUTILS_H + +#include "mlir/Dialect/Utils/StaticValueUtils.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/ViewLikeInterface.h" + +namespace mlir { +class RewriterBase; + +namespace affine { + +/// Fills the `combinedOffsets`, `combinedSizes` and `combinedStrides` to use +/// when combining a producer slice **into** a consumer slice. +/// +/// This function performs the following computation: +/// - Combined offsets = producer_offsets * consumer_strides + consumer_offsets +/// - Combined sizes = consumer_sizes +/// - Combined strides = producer_strides * consumer_strides +// TODO: unify this API with resolveIndicesIntoOpWithOffsetsAndStrides or +// deprecate. +LogicalResult +mergeOffsetsSizesAndStrides(OpBuilder &builder, Location loc, + ArrayRef producerOffsets, + ArrayRef producerSizes, + ArrayRef producerStrides, + const llvm::SmallBitVector &droppedProducerDims, + ArrayRef consumerOffsets, + ArrayRef consumerSizes, + ArrayRef consumerStrides, + SmallVector &combinedOffsets, + SmallVector &combinedSizes, + SmallVector &combinedStrides); + +/// Fills the `combinedOffsets`, `combinedSizes` and `combinedStrides` to use +/// when combining a `producer` slice op **into** a `consumer` slice op. +// TODO: unify this API with resolveIndicesIntoOpWithOffsetsAndStrides or +// deprecate. +LogicalResult +mergeOffsetsSizesAndStrides(OpBuilder &builder, Location loc, + OffsetSizeAndStrideOpInterface producer, + OffsetSizeAndStrideOpInterface consumer, + const llvm::SmallBitVector &droppedProducerDims, + SmallVector &combinedOffsets, + SmallVector &combinedSizes, + SmallVector &combinedStrides); + +/// Given the 'consumerIndices' of a load/store operation operating on an op +/// with offsets and strides, return the combined indices. +/// +/// For example, using `memref.load` and `memref.subview` as an illustration: +/// +/// ``` +/// %0 = ... : memref<12x42xf32> +/// %1 = memref.subview %0[%arg0, %arg1][...][%stride1, %stride2] : +/// memref<12x42xf32> to memref<4x4xf32, offset=?, strides=[?, ?]> +/// %2 = load %1[%i1, %i2] : memref<4x4xf32, offset=?, strides=[?, ?]> +/// ``` +/// +/// could be folded into: +/// +/// ``` +/// %2 = load %0[%arg0 + %i1 * %stride1][%arg1 + %i2 * %stride2] : +/// memref<12x42xf32>å +/// ``` +void resolveIndicesIntoOpWithOffsetsAndStrides( + RewriterBase &rewriter, Location loc, + ArrayRef mixedSourceOffsets, + ArrayRef mixedSourceStrides, + const llvm::SmallBitVector &rankReducedDims, + ArrayRef consumerIndices, + SmallVectorImpl &resolvedIndices); + +inline void resolveIndicesIntoOpWithOffsetsAndStrides( + RewriterBase &rewriter, Location loc, + ArrayRef mixedSourceOffsets, + ArrayRef mixedSourceStrides, + const llvm::SmallBitVector &rankReducedDims, ValueRange consumerIndices, + SmallVectorImpl &resolvedIndices) { + return resolveIndicesIntoOpWithOffsetsAndStrides( + rewriter, loc, mixedSourceOffsets, mixedSourceStrides, rankReducedDims, + getAsOpFoldResult(consumerIndices), resolvedIndices); +} + +/// Given `sourceSizes`, `destSizes` and information about which dimensions are +/// dropped by the source: `rankReducedSourceDims`, compute the resolved sizes +/// that correspond to dest_op(source_op). +/// In practice, this amounts to filtering by `rankReducedSourceDims` and taking +/// from `sourceSizes` if a dimension is dropped, otherwise taking from +/// `destSizes`. +void resolveSizesIntoOpWithSizes( + ArrayRef sourceSizes, ArrayRef destSizes, + const llvm::SmallBitVector &rankReducedSourceDims, + SmallVectorImpl &resolvedSizes); + +} // namespace affine +} // namespace mlir + +#endif // MLIR_DIALECT_AFFINE_VIEWLIKEINTERFACEUTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/Arith.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/Arith.h new file mode 100644 index 0000000000000000000000000000000000000000..971c78f4a86a75aa7f491315b9d54af017d65da9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/Arith.h @@ -0,0 +1,157 @@ +//===- Arith.h - Arith dialect ------------------------------------*- C++-*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARITH_IR_ARITH_H_ +#define MLIR_DIALECT_ARITH_IR_ARITH_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/Interfaces/CastInterfaces.h" +#include "mlir/Interfaces/InferIntRangeInterface.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" +#include "mlir/Interfaces/VectorInterfaces.h" +#include "llvm/ADT/StringExtras.h" + +//===----------------------------------------------------------------------===// +// ArithDialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Arith/IR/ArithOpsDialect.h.inc" + +//===----------------------------------------------------------------------===// +// Arith Dialect Enum Attributes +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc" +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/Arith/IR/ArithOpsAttributes.h.inc" + +//===----------------------------------------------------------------------===// +// Arith Interfaces +//===----------------------------------------------------------------------===// +#include "mlir/Dialect/Arith/IR/ArithOpsInterfaces.h.inc" + +//===----------------------------------------------------------------------===// +// Arith Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/Arith/IR/ArithOps.h.inc" + +namespace mlir { +namespace arith { + +/// Specialization of `arith.constant` op that returns an integer value. +class ConstantIntOp : public arith::ConstantOp { +public: + using arith::ConstantOp::ConstantOp; + + /// Build a constant int op that produces an integer of the specified width. + static void build(OpBuilder &builder, OperationState &result, int64_t value, + unsigned width); + + /// Build a constant int op that produces an integer of the specified type, + /// which must be an integer type. + static void build(OpBuilder &builder, OperationState &result, int64_t value, + Type type); + + inline int64_t value() { + return cast(arith::ConstantOp::getValue()).getInt(); + } + + static bool classof(Operation *op); +}; + +/// Specialization of `arith.constant` op that returns a floating point value. +class ConstantFloatOp : public arith::ConstantOp { +public: + using arith::ConstantOp::ConstantOp; + + /// Build a constant float op that produces a float of the specified type. + static void build(OpBuilder &builder, OperationState &result, + const APFloat &value, FloatType type); + + inline APFloat value() { + return cast(arith::ConstantOp::getValue()).getValue(); + } + + static bool classof(Operation *op); +}; + +/// Specialization of `arith.constant` op that returns an integer of index type. +class ConstantIndexOp : public arith::ConstantOp { +public: + using arith::ConstantOp::ConstantOp; + + /// Build a constant int op that produces an index. + static void build(OpBuilder &builder, OperationState &result, int64_t value); + + inline int64_t value() { + return cast(arith::ConstantOp::getValue()).getInt(); + } + + static bool classof(Operation *op); +}; + +} // namespace arith +} // namespace mlir + +//===----------------------------------------------------------------------===// +// Utility Functions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arith { + +/// Compute `lhs` `pred` `rhs`, where `pred` is one of the known integer +/// comparison predicates. +bool applyCmpPredicate(arith::CmpIPredicate predicate, const APInt &lhs, + const APInt &rhs); + +/// Compute `lhs` `pred` `rhs`, where `pred` is one of the known floating point +/// comparison predicates. +bool applyCmpPredicate(arith::CmpFPredicate predicate, const APFloat &lhs, + const APFloat &rhs); + +/// Returns the identity value attribute associated with an AtomicRMWKind op. +/// `useOnlyFiniteValue` defines whether the identity value should steer away +/// from infinity representations or anything that is not a proper finite +/// number. +/// E.g., The identity value for maxf is in theory `-Inf`, but if we want to +/// stay in the finite range, it would be `BiggestRepresentableNegativeFloat`. +/// The purpose of this boolean is to offer constants that will play nice +/// with fast math related optimizations. +TypedAttr getIdentityValueAttr(AtomicRMWKind kind, Type resultType, + OpBuilder &builder, Location loc, + bool useOnlyFiniteValue = false); + +/// Return the identity numeric value associated to the give op. Return +/// std::nullopt if there is no known neutral element. +/// If `op` has `FastMathFlags::ninf`, only finite values will be used +/// as neutral element. +std::optional getNeutralElement(Operation *op); + +/// Returns the identity value associated with an AtomicRMWKind op. +/// \see getIdentityValueAttr for a description of what `useOnlyFiniteValue` +/// does. +Value getIdentityValue(AtomicRMWKind op, Type resultType, OpBuilder &builder, + Location loc, bool useOnlyFiniteValue = false); + +/// Returns the value obtained by applying the reduction operation kind +/// associated with a binary AtomicRMWKind op to `lhs` and `rhs`. +Value getReductionOp(AtomicRMWKind op, OpBuilder &builder, Location loc, + Value lhs, Value rhs); + +arith::CmpIPredicate invertPredicate(arith::CmpIPredicate pred); +} // namespace arith +} // namespace mlir + +#endif // MLIR_DIALECT_ARITH_IR_ARITH_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithCanonicalization.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithCanonicalization.inc new file mode 100644 index 0000000000000000000000000000000000000000..40da1a6ebde13feb1afcfa3239a118697c47f6c0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithCanonicalization.inc @@ -0,0 +1,3767 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Rewriters *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArithCanonicalization.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithCanonicalization0( + ::mlir::PatternRewriter &rewriter, ::mlir::Operation *op, ::mlir::Attribute attr, + ::llvm::StringRef failureStr) { + if (!((::llvm::isa<::mlir::IntegerAttr>(attr)))) { + return rewriter.notifyMatchFailure(op, [&](::mlir::Diagnostic &diag) { + diag << failureStr << ": arbitrary integer attribute"; + }); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithCanonicalization1( + ::mlir::PatternRewriter &rewriter, ::mlir::Operation *op, ::mlir::Attribute attr, + ::llvm::StringRef failureStr) { + if (!((true))) { + return rewriter.notifyMatchFailure(op, [&](::mlir::Diagnostic &diag) { + diag << failureStr << ": any attribute"; + }); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithCanonicalization2( + ::mlir::PatternRewriter &rewriter, ::mlir::Operation *op, ::mlir::Attribute attr, + ::llvm::StringRef failureStr) { + if (!((::llvm::isa<::mlir::TypedAttr>(attr)))) { + return rewriter.notifyMatchFailure(op, [&](::mlir::Diagnostic &diag) { + diag << failureStr << ": TypedAttr instance"; + }); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithCanonicalization3( + ::mlir::PatternRewriter &rewriter, ::mlir::Operation *op, ::mlir::Attribute attr, + ::llvm::StringRef failureStr) { + if (!((attr == rewriter.getIntegerAttr(rewriter.getIntegerType(1), 1)))) { + return rewriter.notifyMatchFailure(op, [&](::mlir::Diagnostic &diag) { + diag << failureStr << ": constant attribute 1"; + }); + } + return ::mlir::success(); +} +static ::mlir::LogicalResult static_dag_matcher_0(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c0) { + (void)tblgen_ops; + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + c0 = arg1_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization0(rewriter, op0, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'arbitrary integer attribute'"))) { + return ::mlir::failure(); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_1(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c0, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::AddIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_0(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_2(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c1) { + (void)tblgen_ops; + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + c1 = arg1_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization0(rewriter, op0, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'arbitrary integer attribute'"))) { + return ::mlir::failure(); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_3(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c0) { + (void)tblgen_ops; + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op0->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + c0 = arg1_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization1(rewriter, op0, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'any attribute'"))) { + return ::mlir::failure(); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_4(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x, ::mlir::Attribute &c0) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SubIOp type"; + }); + } + { + auto *op2 = (*castedOp1.getODSOperands(0).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_0(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + x = castedOp1.getODSOperands(1); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_5(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Attribute &c0, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SubIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_0(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_6(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_7(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &y) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + y = castedOp1.getODSOperands(0); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_8(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_9(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &y) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + y = castedOp1.getODSOperands(0); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_10(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::NegFOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::NegFOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::FastMathFlagsAttr>("fastmath");(void)tblgen_attr; + if (!tblgen_attr) tblgen_attr = ::mlir::arith::FastMathFlagsAttr::get(rewriter.getContext(), ::mlir::arith::FastMathFlags::none); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_11(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &y) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::NegFOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::NegFOp type"; + }); + } + y = castedOp1.getODSOperands(0); + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::FastMathFlagsAttr>("fastmath");(void)tblgen_attr; + if (!tblgen_attr) tblgen_attr = ::mlir::arith::FastMathFlagsAttr::get(rewriter.getContext(), ::mlir::arith::FastMathFlags::none); + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_12(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &y, ::mlir::Operation::operand_range &x, ::mlir::Operation::operand_range &predB) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SelectOp type"; + }); + } + predB = castedOp1.getODSOperands(0); + x = castedOp1.getODSOperands(1); + y = castedOp1.getODSOperands(2); + return ::mlir::success(); +} + +static ::mlir::LogicalResult static_dag_matcher_13(::mlir::PatternRewriter &rewriter, ::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation *, 4> &tblgen_ops, ::mlir::Operation::operand_range &x, ::mlir::Operation::operand_range &y, ::mlir::Operation::operand_range &predB) { + (void)tblgen_ops; + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SelectOp type"; + }); + } + predB = castedOp1.getODSOperands(0); + y = castedOp1.getODSOperands(1); + x = castedOp1.getODSOperands(2); + return ::mlir::success(); +} + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:37 +*/ +struct AddIAddConstant : public ::mlir::RewritePattern { + AddIAddConstant(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.addi", "arith.constant"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::AddIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_1(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = addIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::AddIOp tblgen_AddIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_AddIOp_2 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:71 +*/ +struct AddIMulNegativeOneLhs : public ::mlir::RewritePattern { + AddIMulNegativeOneLhs(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::MulIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_3(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + y = castedOp0.getODSOperands(1); + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && ((getIntOrSplatIntValue(c0)->isAllOnes())))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SubIOp tblgen_SubIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*y.begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_0 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:63 +*/ +struct AddIMulNegativeOneRhs : public ::mlir::RewritePattern { + AddIMulNegativeOneRhs(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c0; + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + x = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::MulIOp type"; + }); + } + y = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_3(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && ((getIntOrSplatIntValue(c0)->isAllOnes())))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SubIOp tblgen_SubIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_SubIOp_0 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:51 +*/ +struct AddISubConstantLHS : public ::mlir::RewritePattern { + AddISubConstantLHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::arith::AddIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_4(rewriter, op1, tblgen_ops, x, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = addIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:44 +*/ +struct AddISubConstantRHS : public ::mlir::RewritePattern { + AddISubConstantRHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addi", 2, context, {"arith.addi", "arith.constant"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::AddIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_5(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c1, c0); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::AddIOp tblgen_AddIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_AddIOp_2 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:91 +*/ +struct AddUIExtendedToAddI : public ::mlir::RewritePattern { + AddUIExtendedToAddI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.addui_extended", 1, context, {"arith.addi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::AddUIExtendedOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AddUIExtendedOp>(op0); (void)castedOp0; + res = castedOp0; + x = castedOp0.getODSOperands(0); + y = castedOp0.getODSOperands(1); + if (!(((*res.getODSResults(1).begin()).getUses().empty()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res__1' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::AddIOp tblgen_AddIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_AddIOp_0 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:336 +*/ +struct AndOfExtSI : public ::mlir::RewritePattern { + AndOfExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.andi", 3, context, {"arith.andi", "arith.extsi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AndIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_7(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::AndIOp tblgen_AndIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_AndIOp_0 = rewriter.create<::mlir::arith::AndIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_AndIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_1 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:330 +*/ +struct AndOfExtUI : public ::mlir::RewritePattern { + AndOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.andi", 3, context, {"arith.andi", "arith.extui"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::AndIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_9(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::AndIOp tblgen_AndIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_AndIOp_0 = rewriter.create<::mlir::arith::AndIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_AndIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_1 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:314 +*/ +struct BitcastOfBitcast : public ::mlir::RewritePattern { + BitcastOfBitcast(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.bitcast", 2, context, {}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::BitcastOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::BitcastOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::BitcastOp type"; + }); + } + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:215 +*/ +struct CmpIExtSI : public ::mlir::RewritePattern { + CmpIExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.cmpi", 3, context, {"arith.cmpi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::arith::CmpIPredicateAttr pred; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::CmpIOp>(op0); (void)castedOp0; + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::CmpIPredicateAttr>("predicate");(void)tblgen_attr; + if (!(tblgen_attr)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "expected op 'arith.cmpi' to have attribute 'predicate' of type '::mlir::arith::CmpIPredicateAttr'"; + }); + } + pred = tblgen_attr; + } + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + a = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + b = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((*a.begin()).getType() == (*b.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'a, b' failed to satisfy constraint: ''"; + }); + } + if (!((pred.getValue() == arith::CmpIPredicate::eq || pred.getValue() == arith::CmpIPredicate::ne))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'pred' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::CmpIOp tblgen_CmpIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + if (auto tmpAttr = pred) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("predicate"), tmpAttr); + } + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*b.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_CmpIOp_0 = rewriter.create<::mlir::arith::CmpIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_CmpIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:226 +*/ +struct CmpIExtUI : public ::mlir::RewritePattern { + CmpIExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.cmpi", 3, context, {"arith.cmpi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::arith::CmpIPredicateAttr pred; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::CmpIOp>(op0); (void)castedOp0; + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::CmpIPredicateAttr>("predicate");(void)tblgen_attr; + if (!(tblgen_attr)){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "expected op 'arith.cmpi' to have attribute 'predicate' of type '::mlir::arith::CmpIPredicateAttr'"; + }); + } + pred = tblgen_attr; + } + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + a = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + b = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((*a.begin()).getType() == (*b.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'a, b' failed to satisfy constraint: ''"; + }); + } + if (!((pred.getValue() == arith::CmpIPredicate::eq || pred.getValue() == arith::CmpIPredicate::ne))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'pred' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::CmpIOp tblgen_CmpIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + if (auto tmpAttr = pred) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("predicate"), tmpAttr); + } + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*b.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_CmpIOp_0 = rewriter.create<::mlir::arith::CmpIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_CmpIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:436 +*/ +struct DivFOfNegF : public ::mlir::RewritePattern { + DivFOfNegF(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.divf", 3, context, {"arith.divf"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::arith::FastMathFlagsAttr fmf; + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::DivFOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_10(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_11(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::FastMathFlagsAttr>("fastmath");(void)tblgen_attr; + if (!tblgen_attr) tblgen_attr = ::mlir::arith::FastMathFlagsAttr::get(rewriter.getContext(), ::mlir::arith::FastMathFlags::none); + fmf = tblgen_attr; + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::DivFOp tblgen_DivFOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + if (auto tmpAttr = fmf) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("fastmath"), tmpAttr); + } + tblgen_DivFOp_0 = rewriter.create<::mlir::arith::DivFOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_DivFOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:322 +*/ +struct ExtSIOfExtUI : public ::mlir::RewritePattern { + ExtSIOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.extsi", 2, context, {"arith.extui"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_0 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:291 +*/ +struct IndexCastOfExtSI : public ::mlir::RewritePattern { + IndexCastOfExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.index_cast", 2, context, {"arith.index_cast"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::IndexCastOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::IndexCastOp tblgen_IndexCastOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_IndexCastOp_0 = rewriter.create<::mlir::arith::IndexCastOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_IndexCastOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:285 +*/ +struct IndexCastOfIndexCast : public ::mlir::RewritePattern { + IndexCastOfIndexCast(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.index_cast", 2, context, {}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::IndexCastOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::IndexCastOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::IndexCastOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::IndexCastOp type"; + }); + } + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((*res.getODSResults(0).begin()).getType() == (*x.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res, x' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:305 +*/ +struct IndexCastUIOfExtUI : public ::mlir::RewritePattern { + IndexCastUIOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.index_castui", 2, context, {"arith.index_castui"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::IndexCastUIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::IndexCastUIOp tblgen_IndexCastUIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_IndexCastUIOp_0 = rewriter.create<::mlir::arith::IndexCastUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_IndexCastUIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:299 +*/ +struct IndexCastUIOfIndexCastUI : public ::mlir::RewritePattern { + IndexCastUIOfIndexCastUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.index_castui", 2, context, {}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::IndexCastUIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::IndexCastUIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::IndexCastUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::IndexCastUIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((*res.getODSResults(0).begin()).getType() == (*x.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res, x' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:425 +*/ +struct MulFOfNegF : public ::mlir::RewritePattern { + MulFOfNegF(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.mulf", 3, context, {"arith.mulf"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::arith::FastMathFlagsAttr fmf; + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulFOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_10(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_11(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto tblgen_attr = op0->getAttrOfType<::mlir::arith::FastMathFlagsAttr>("fastmath");(void)tblgen_attr; + if (!tblgen_attr) tblgen_attr = ::mlir::arith::FastMathFlagsAttr::get(rewriter.getContext(), ::mlir::arith::FastMathFlags::none); + fmf = tblgen_attr; + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulFOp tblgen_MulFOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + if (auto tmpAttr = fmf) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("fastmath"), tmpAttr); + } + tblgen_MulFOp_0 = rewriter.create<::mlir::arith::MulFOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_MulFOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:79 +*/ +struct MulIMulIConstant : public ::mlir::RewritePattern { + MulIMulIConstant(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.muli", 2, context, {"arith.constant", "arith.muli"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::MulIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::MulIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_0(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = mulIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::MulIOp tblgen_MulIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_MulIOp_2 = rewriter.create<::mlir::arith::MulIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_MulIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:165 +*/ +struct MulSIExtendedRHSOne : public ::mlir::RewritePattern { + MulSIExtendedRHSOne(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.mulsi_extended", 1, context, {"arith.cmpi", "arith.constant", "arith.extsi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulSIExtendedOp>(op0); (void)castedOp0; + x = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op1->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op1->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + c1 = arg1_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization1(rewriter, op1, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'any attribute'"))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((succeeded(getIntOrSplatIntValue(c1)))) && ((*getIntOrSplatIntValue(c1) == 1)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'c1' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + auto nativeVar_0 = arith::CmpIPredicate::slt; (void)nativeVar_0; + auto nativeVar_1 = rewriter.getZeroAttr((*x.begin()).getType()); (void)nativeVar_1; + ::mlir::arith::ConstantOp tblgen_ConstantOp_2; + { + tblgen_ConstantOp_2 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_1 + ); + } + ::mlir::arith::CmpIOp tblgen_CmpIOp_3; + { + ::mlir::Value tblgen_value_0 = (*x.begin()); + ::mlir::Value tblgen_value_1 = (*tblgen_ConstantOp_2.getODSResults(0).begin()); + tblgen_CmpIOp_3 = rewriter.create<::mlir::arith::CmpIOp>(odsLoc, + /*predicate=*/nativeVar_0, + /*lhs=*/tblgen_value_0, + /*rhs=*/tblgen_value_1 + ); + } + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_4; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_CmpIOp_3.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(1)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_4 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_4.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:153 +*/ +struct MulSIExtendedToMulI : public ::mlir::RewritePattern { + MulSIExtendedToMulI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.mulsi_extended", 1, context, {"arith.muli"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::MulSIExtendedOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulSIExtendedOp>(op0); (void)castedOp0; + res = castedOp0; + x = castedOp0.getODSOperands(0); + y = castedOp0.getODSOperands(1); + if (!(((*res.getODSResults(1).begin()).getUses().empty()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res__1' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulIOp tblgen_MulIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_MulIOp_0 = rewriter.create<::mlir::arith::MulIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_MulIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:180 +*/ +struct MulUIExtendedToMulI : public ::mlir::RewritePattern { + MulUIExtendedToMulI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.mului_extended", 1, context, {"arith.muli"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::MulUIExtendedOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::MulUIExtendedOp>(op0); (void)castedOp0; + res = castedOp0; + x = castedOp0.getODSOperands(0); + y = castedOp0.getODSOperands(1); + if (!(((*res.getODSResults(1).begin()).getUses().empty()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'res__1' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulIOp tblgen_MulIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_MulIOp_0 = rewriter.create<::mlir::arith::MulIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_MulIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ x }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:352 +*/ +struct OrOfExtSI : public ::mlir::RewritePattern { + OrOfExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.ori", 3, context, {"arith.extsi", "arith.ori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::OrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_7(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::OrIOp tblgen_OrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_OrIOp_0 = rewriter.create<::mlir::arith::OrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_OrIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_1 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:346 +*/ +struct OrOfExtUI : public ::mlir::RewritePattern { + OrOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.ori", 3, context, {"arith.extui", "arith.ori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::OrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_9(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::OrIOp tblgen_OrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_OrIOp_0 = rewriter.create<::mlir::arith::OrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_OrIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_1 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:252 +*/ +struct RedundantSelectFalse : public ::mlir::RewritePattern { + RedundantSelectFalse(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::Operation::operand_range c(op0->getOperands()); + ::mlir::Operation::operand_range pred(op0->getOperands()); + ::mlir::Operation::operand_range pred0(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + pred0 = castedOp0.getODSOperands(0); + a = castedOp0.getODSOperands(1); + { + auto *op1 = (*castedOp0.getODSOperands(2).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 2 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SelectOp type"; + }); + } + pred = castedOp1.getODSOperands(0); + b = castedOp1.getODSOperands(1); + c = castedOp1.getODSOperands(2); + tblgen_ops.push_back(op1); + } + if (!(*pred.begin() == *pred0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'pred' and 'pred0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SelectOp tblgen_SelectOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*pred.begin())); + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*c.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_0 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:247 +*/ +struct RedundantSelectTrue : public ::mlir::RewritePattern { + RedundantSelectTrue(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::Operation::operand_range c(op0->getOperands()); + ::mlir::Operation::operand_range pred(op0->getOperands()); + ::mlir::Operation::operand_range pred0(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + pred0 = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SelectOp type"; + }); + } + pred = castedOp1.getODSOperands(0); + a = castedOp1.getODSOperands(1); + b = castedOp1.getODSOperands(2); + tblgen_ops.push_back(op1); + } + c = castedOp0.getODSOperands(2); + if (!(*pred.begin() == *pred0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'pred' and 'pred0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SelectOp tblgen_SelectOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*pred.begin())); + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*c.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_0 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:257 +*/ +struct SelectAndCond : public ::mlir::RewritePattern { + SelectAndCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.andi", "arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range y0(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range predB(op0->getOperands()); + ::mlir::Operation::operand_range predA(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + predA = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_12(rewriter, op1, tblgen_ops, y0, x, predB))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + y = castedOp0.getODSOperands(2); + if (!(*y.begin() == *y0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'y' and 'y0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::AndIOp tblgen_AndIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predA.begin())); + tblgen_values.push_back((*predB.begin())); + tblgen_AndIOp_0 = rewriter.create<::mlir::arith::AndIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::SelectOp tblgen_SelectOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_AndIOp_0.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_1 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:262 +*/ +struct SelectAndNotCond : public ::mlir::RewritePattern { + SelectAndNotCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.andi", "arith.constant", "arith.select", "arith.xori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range y0(op0->getOperands()); + ::mlir::Operation::operand_range predB(op0->getOperands()); + ::mlir::Operation::operand_range predA(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + predA = castedOp0.getODSOperands(0); + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_13(rewriter, op1, tblgen_ops, x, y0, predB))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + y = castedOp0.getODSOperands(2); + if (!(*y.begin() == *y0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'y' and 'y0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ConstantOp tblgen_ConstantOp_0; + { + tblgen_ConstantOp_0 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + rewriter.getIntegerAttr(rewriter.getIntegerType(1), 1) + ); + } + ::mlir::arith::XOrIOp tblgen_XOrIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predB.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_0.getODSResults(0).begin())); + tblgen_XOrIOp_1 = rewriter.create<::mlir::arith::XOrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::AndIOp tblgen_AndIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predA.begin())); + tblgen_values.push_back((*tblgen_XOrIOp_1.getODSResults(0).begin())); + tblgen_AndIOp_2 = rewriter.create<::mlir::arith::AndIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::SelectOp tblgen_SelectOp_3; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_AndIOp_2.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_3 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_3.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:241 +*/ +struct SelectNotCond : public ::mlir::RewritePattern { + SelectNotCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::Attribute ones; + ::mlir::Operation::operand_range pred(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::XOrIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::XOrIOp type"; + }); + } + pred = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + ::mlir::Attribute arg2_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op2->getResult(0), ::mlir::m_Constant(&arg2_0)))))){ + return rewriter.notifyMatchFailure(op2, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op2->getResult(0), ::mlir::m_Constant(&arg2_0))) return ::mlir::failure"; + }); + } + ones = arg2_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization0(rewriter, op2, arg2_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'arbitrary integer attribute'"))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + a = castedOp0.getODSOperands(1); + b = castedOp0.getODSOperands(2); + if (!(((succeeded(getIntOrSplatIntValue(ones)))) && ((getIntOrSplatIntValue(ones)->isAllOnes())))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'ones' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::SelectOp tblgen_SelectOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*pred.begin())); + tblgen_values.push_back((*b.begin())); + tblgen_values.push_back((*a.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_0 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:269 +*/ +struct SelectOrCond : public ::mlir::RewritePattern { + SelectOrCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.ori", "arith.select"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range predB(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range x0(op0->getOperands()); + ::mlir::Operation::operand_range predA(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + predA = castedOp0.getODSOperands(0); + x0 = castedOp0.getODSOperands(1); + { + auto *op1 = (*castedOp0.getODSOperands(2).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 2 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_12(rewriter, op1, tblgen_ops, y, x, predB))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(*x.begin() == *x0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'x' and 'x0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::OrIOp tblgen_OrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predA.begin())); + tblgen_values.push_back((*predB.begin())); + tblgen_OrIOp_0 = rewriter.create<::mlir::arith::OrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::SelectOp tblgen_SelectOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_OrIOp_0.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_1 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:274 +*/ +struct SelectOrNotCond : public ::mlir::RewritePattern { + SelectOrNotCond(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.select", 2, context, {"arith.constant", "arith.ori", "arith.select", "arith.xori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range predB(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range x0(op0->getOperands()); + ::mlir::Operation::operand_range predA(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SelectOp>(op0); (void)castedOp0; + predA = castedOp0.getODSOperands(0); + x0 = castedOp0.getODSOperands(1); + { + auto *op1 = (*castedOp0.getODSOperands(2).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 2 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_13(rewriter, op1, tblgen_ops, x, y, predB))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(*x.begin() == *x0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'x' and 'x0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ConstantOp tblgen_ConstantOp_0; + { + tblgen_ConstantOp_0 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + rewriter.getIntegerAttr(rewriter.getIntegerType(1), 1) + ); + } + ::mlir::arith::XOrIOp tblgen_XOrIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predB.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_0.getODSResults(0).begin())); + tblgen_XOrIOp_1 = rewriter.create<::mlir::arith::XOrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::OrIOp tblgen_OrIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*predA.begin())); + tblgen_values.push_back((*tblgen_XOrIOp_1.getODSResults(0).begin())); + tblgen_OrIOp_2 = rewriter.create<::mlir::arith::OrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::SelectOp tblgen_SelectOp_3; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_OrIOp_2.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_SelectOp_3 = rewriter.create<::mlir::arith::SelectOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SelectOp_3.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:108 +*/ +struct SubILHSAddConstant : public ::mlir::RewritePattern { + SubILHSAddConstant(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c0; + ::mlir::Attribute c1; + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_1(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c1, c0); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:136 +*/ +struct SubILHSSubConstantLHS : public ::mlir::RewritePattern { + SubILHSSubConstantLHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.addi", "arith.constant"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c0; + ::mlir::Attribute c1; + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_4(rewriter, op1, tblgen_ops, x, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c1, c0); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::AddIOp tblgen_AddIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_AddIOp_2 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:129 +*/ +struct SubILHSSubConstantRHS : public ::mlir::RewritePattern { + SubILHSSubConstantRHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c0; + ::mlir::Attribute c1; + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_5(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = addIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:101 +*/ +struct SubIRHSAddConstant : public ::mlir::RewritePattern { + SubIRHSAddConstant(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.addi", "arith.constant"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_1(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::AddIOp tblgen_AddIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_AddIOp_2 = rewriter.create<::mlir::arith::AddIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_AddIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:122 +*/ +struct SubIRHSSubConstantLHS : public ::mlir::RewritePattern { + SubIRHSSubConstantLHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_4(rewriter, op1, tblgen_ops, x, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = subIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*x.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:115 +*/ +struct SubIRHSSubConstantRHS : public ::mlir::RewritePattern { + SubIRHSSubConstantRHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c1; + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_5(rewriter, op1, tblgen_ops, c0, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_2(rewriter, op1, tblgen_ops, c1))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = addIntegerAttrs(rewriter, (*res.getODSResults(0).begin()), c0, c1); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:143 +*/ +struct SubISubILHSRHSLHS : public ::mlir::RewritePattern { + SubISubILHSRHSLHS(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.subi", 2, context, {"arith.constant", "arith.subi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range x0(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::SubIOp res; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op0); (void)castedOp0; + res = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::SubIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::SubIOp type"; + }); + } + x0 = castedOp1.getODSOperands(0); + y = castedOp1.getODSOperands(1); + tblgen_ops.push_back(op1); + } + x = castedOp0.getODSOperands(1); + if (!(*x.begin() == *x0.begin())){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "Operands 'x' and 'x0' must be equal"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = rewriter.getZeroAttr((*y.begin()).getType()); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::SubIOp tblgen_SubIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_values.push_back((*y.begin())); + tblgen_SubIOp_2 = rewriter.create<::mlir::arith::SubIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_SubIOp_2.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:377 +*/ +struct TruncIExtSIToExtSI : public ::mlir::RewritePattern { + TruncIExtSIToExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 2, context, {"arith.extsi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::ExtSIOp ext; + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtSIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtSIOp type"; + }); + } + ext = castedOp1; + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((getScalarOrElementWidth((*ext.getODSResults(0).begin())) > getScalarOrElementWidth((*tr.getODSResults(0).begin())))) && ((getScalarOrElementWidth((*tr.getODSResults(0).begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'ext, tr' failed to satisfy constraint: ''"; + }); + } + if (!(((getScalarOrElementWidth((*tr.getODSResults(0).begin())) > getScalarOrElementWidth((*x.begin())))) && ((getScalarOrElementWidth((*x.begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'tr, x' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_0 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:384 +*/ +struct TruncIExtUIToExtUI : public ::mlir::RewritePattern { + TruncIExtUIToExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 2, context, {"arith.extui"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::ExtUIOp ext; + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ExtUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ExtUIOp type"; + }); + } + ext = castedOp1; + x = castedOp1.getODSOperands(0); + tblgen_ops.push_back(op1); + } + if (!(((getScalarOrElementWidth((*ext.getODSResults(0).begin())) > getScalarOrElementWidth((*tr.getODSResults(0).begin())))) && ((getScalarOrElementWidth((*tr.getODSResults(0).begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'ext, tr' failed to satisfy constraint: ''"; + }); + } + if (!(((getScalarOrElementWidth((*tr.getODSResults(0).begin())) > getScalarOrElementWidth((*x.begin())))) && ((getScalarOrElementWidth((*x.begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'tr, x' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_0 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_0.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:391 +*/ +struct TruncIShrSIToTrunciShrUI : public ::mlir::RewritePattern { + TruncIShrSIToTrunciShrUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 2, context, {"arith.constant", "arith.shrui", "arith.trunci"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ShRSIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ShRSIOp type"; + }); + } + x = castedOp1.getODSOperands(0); + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + ::mlir::Attribute arg2_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op2->getResult(0), ::mlir::m_Constant(&arg2_0)))))){ + return rewriter.notifyMatchFailure(op2, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op2->getResult(0), ::mlir::m_Constant(&arg2_0))) return ::mlir::failure"; + }); + } + c0 = arg2_0; + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization2(rewriter, op2, arg2_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'TypedAttr instance'"))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && (((getScalarOrElementWidth((*x.begin())) - getScalarOrElementWidth((*tr.getODSResults(0).begin()))) == *getIntOrSplatIntValue(c0))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, tr, c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = ::mlir::cast(c0); (void)nativeVar_0; + ::mlir::arith::ConstantOp tblgen_ConstantOp_1; + { + tblgen_ConstantOp_1 = rewriter.create<::mlir::arith::ConstantOp>(odsLoc, + /*value=*/nativeVar_0 + ); + } + ::mlir::arith::ShRUIOp tblgen_ShRUIOp_2; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*tblgen_ConstantOp_1.getODSResults(0).begin())); + tblgen_ShRUIOp_2 = rewriter.create<::mlir::arith::ShRUIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::TruncIOp tblgen_TruncIOp_3; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_ShRUIOp_2.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_TruncIOp_3 = rewriter.create<::mlir::arith::TruncIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_TruncIOp_3.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:398 +*/ +struct TruncIShrUIMulIToMulSIExtended : public ::mlir::RewritePattern { + TruncIShrUIMulIToMulSIExtended(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 5, context, {"arith.mulsi_extended"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::MulIOp mul; + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ShRUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ShRUIOp type"; + }); + } + { + auto *op2 = (*castedOp1.getODSOperands(0).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp1"; + }); + } + auto castedOp2 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op2); (void)castedOp2; + if (!(castedOp2)){ + return rewriter.notifyMatchFailure(op2, [&](::mlir::Diagnostic &diag) { + diag << "castedOp2 is not ::mlir::arith::MulIOp type"; + }); + } + mul = castedOp2; + { + auto *op3 = (*castedOp2.getODSOperands(0).begin()).getDefiningOp(); + if (!(op3)){ + return rewriter.notifyMatchFailure(castedOp2, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp2"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op3, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op3); + } + { + auto *op3 = (*castedOp2.getODSOperands(1).begin()).getDefiningOp(); + if (!(op3)){ + return rewriter.notifyMatchFailure(castedOp2, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp2"; + }); + } + if(::mlir::failed(static_dag_matcher_7(rewriter, op3, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op3); + } + tblgen_ops.push_back(op2); + } + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_3(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + if (!((llvm::all_equal({(*tr.getODSResults(0).begin()).getType(), (*x.begin()).getType(), (*y.begin()).getType()})))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'tr, x, y' failed to satisfy constraint: ''"; + }); + } + if (!(((getScalarOrElementWidth((*mul.getODSResults(0).begin())) > getScalarOrElementWidth((*x.begin())))) && ((getScalarOrElementWidth((*x.begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'mul, x' failed to satisfy constraint: ''"; + }); + } + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && (((getScalarOrElementWidth((*mul.getODSResults(0).begin())) - getScalarOrElementWidth((*x.begin()))) == *getIntOrSplatIntValue(c0))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'mul, x, c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc(), tblgen_ops[3]->getLoc(), tblgen_ops[4]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulSIExtendedOp res; + { + ::mlir::Value tblgen_value_0 = (*x.begin()); + ::mlir::Value tblgen_value_1 = (*y.begin()); + res = rewriter.create<::mlir::arith::MulSIExtendedOp>(odsLoc, + /*lhs=*/tblgen_value_0, + /*rhs=*/tblgen_value_1 + ); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ res.getODSResults(1) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:409 +*/ +struct TruncIShrUIMulIToMulUIExtended : public ::mlir::RewritePattern { + TruncIShrUIMulIToMulUIExtended(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.trunci", 5, context, {"arith.mului_extended"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Attribute c0; + ::mlir::Operation::operand_range x(op0->getOperands()); + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::arith::MulIOp mul; + ::mlir::arith::TruncIOp tr; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::TruncIOp>(op0); (void)castedOp0; + tr = castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::ShRUIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::ShRUIOp type"; + }); + } + { + auto *op2 = (*castedOp1.getODSOperands(0).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp1"; + }); + } + auto castedOp2 = ::llvm::dyn_cast<::mlir::arith::MulIOp>(op2); (void)castedOp2; + if (!(castedOp2)){ + return rewriter.notifyMatchFailure(op2, [&](::mlir::Diagnostic &diag) { + diag << "castedOp2 is not ::mlir::arith::MulIOp type"; + }); + } + mul = castedOp2; + { + auto *op3 = (*castedOp2.getODSOperands(0).begin()).getDefiningOp(); + if (!(op3)){ + return rewriter.notifyMatchFailure(castedOp2, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp2"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op3, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op3); + } + { + auto *op3 = (*castedOp2.getODSOperands(1).begin()).getDefiningOp(); + if (!(op3)){ + return rewriter.notifyMatchFailure(castedOp2, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp2"; + }); + } + if(::mlir::failed(static_dag_matcher_9(rewriter, op3, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op3); + } + tblgen_ops.push_back(op2); + } + { + auto *op2 = (*castedOp1.getODSOperands(1).begin()).getDefiningOp(); + if (!(op2)){ + return rewriter.notifyMatchFailure(castedOp1, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp1"; + }); + } + if(::mlir::failed(static_dag_matcher_3(rewriter, op2, tblgen_ops, c0))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op2); + } + tblgen_ops.push_back(op1); + } + if (!((llvm::all_equal({(*tr.getODSResults(0).begin()).getType(), (*x.begin()).getType(), (*y.begin()).getType()})))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'tr, x, y' failed to satisfy constraint: ''"; + }); + } + if (!(((getScalarOrElementWidth((*mul.getODSResults(0).begin())) > getScalarOrElementWidth((*x.begin())))) && ((getScalarOrElementWidth((*x.begin())) > 0)))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'mul, x' failed to satisfy constraint: ''"; + }); + } + if (!(((succeeded(getIntOrSplatIntValue(c0)))) && (((getScalarOrElementWidth((*mul.getODSResults(0).begin())) - getScalarOrElementWidth((*x.begin()))) == *getIntOrSplatIntValue(c0))))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'mul, x, c0' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc(), tblgen_ops[3]->getLoc(), tblgen_ops[4]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::MulUIExtendedOp res; + { + ::mlir::Value tblgen_value_0 = (*x.begin()); + ::mlir::Value tblgen_value_1 = (*y.begin()); + res = rewriter.create<::mlir::arith::MulUIExtendedOp>(odsLoc, + /*lhs=*/tblgen_value_0, + /*rhs=*/tblgen_value_1 + ); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ res.getODSResults(1) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:194 +*/ +struct XOrINotCmpI : public ::mlir::RewritePattern { + XOrINotCmpI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.xori", 2, context, {"arith.cmpi"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range b(op0->getOperands()); + ::mlir::Operation::operand_range a(op0->getOperands()); + ::mlir::arith::CmpIPredicateAttr pred; + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::XOrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + auto castedOp1 = ::llvm::dyn_cast<::mlir::arith::CmpIOp>(op1); (void)castedOp1; + if (!(castedOp1)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "castedOp1 is not ::mlir::arith::CmpIOp type"; + }); + } + { + auto tblgen_attr = op1->getAttrOfType<::mlir::arith::CmpIPredicateAttr>("predicate");(void)tblgen_attr; + if (!(tblgen_attr)){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "expected op 'arith.cmpi' to have attribute 'predicate' of type '::mlir::arith::CmpIPredicateAttr'"; + }); + } + pred = tblgen_attr; + } + a = castedOp1.getODSOperands(0); + b = castedOp1.getODSOperands(1); + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + ::mlir::Attribute arg1_0; + if (!(!::mlir::failed(::mlir::success(::mlir::matchPattern(op1->getResult(0), ::mlir::m_Constant(&arg1_0)))))){ + return rewriter.notifyMatchFailure(op1, [&](::mlir::Diagnostic &diag) { + diag << "::mlir::success(::mlir::matchPattern(op1->getResult(0), ::mlir::m_Constant(&arg1_0))) return ::mlir::failure"; + }); + } + if(::mlir::failed(__mlir_ods_local_attr_constraint_ArithCanonicalization3(rewriter, op1, arg1_0, "operand 0 of native code call '::mlir::success(::mlir::matchPattern($_self->getResult(0), ::mlir::m_Constant(&$0)))' failed to satisfy constraint: 'constant attribute 1'"))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + auto nativeVar_0 = invertPredicate(pred); (void)nativeVar_0; + ::mlir::arith::CmpIOp tblgen_CmpIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + if (auto tmpAttr = nativeVar_0) { + tblgen_attrs.emplace_back(rewriter.getStringAttr("predicate"), tmpAttr); + } + tblgen_values.push_back((*a.begin())); + tblgen_values.push_back((*b.begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_CmpIOp_1 = rewriter.create<::mlir::arith::CmpIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_CmpIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:206 +*/ +struct XOrIOfExtSI : public ::mlir::RewritePattern { + XOrIOfExtSI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.xori", 3, context, {"arith.extsi", "arith.xori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::XOrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_6(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_7(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::XOrIOp tblgen_XOrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_XOrIOp_0 = rewriter.create<::mlir::arith::XOrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtSIOp tblgen_ExtSIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_XOrIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtSIOp_1 = rewriter.create<::mlir::arith::ExtSIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtSIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +/* Generated from: + external/llvm-project/mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td:201 +*/ +struct XOrIOfExtUI : public ::mlir::RewritePattern { + XOrIOfExtUI(::mlir::MLIRContext *context) + : ::mlir::RewritePattern("arith.xori", 3, context, {"arith.extui", "arith.xori"}) {} + ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0, + ::mlir::PatternRewriter &rewriter) const override { + // Variables for capturing values and attributes used while creating ops + ::mlir::Operation::operand_range y(op0->getOperands()); + ::mlir::Operation::operand_range x(op0->getOperands()); + ::llvm::SmallVector<::mlir::Operation *, 4> tblgen_ops; + + // Match + tblgen_ops.push_back(op0); + auto castedOp0 = ::llvm::dyn_cast<::mlir::arith::XOrIOp>(op0); (void)castedOp0; + { + auto *op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 0 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_8(rewriter, op1, tblgen_ops, x))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + { + auto *op1 = (*castedOp0.getODSOperands(1).begin()).getDefiningOp(); + if (!(op1)){ + return rewriter.notifyMatchFailure(castedOp0, [&](::mlir::Diagnostic &diag) { + diag << "There's no operation that defines operand 1 of castedOp0"; + }); + } + if(::mlir::failed(static_dag_matcher_9(rewriter, op1, tblgen_ops, y))) { + return ::mlir::failure(); + } + tblgen_ops.push_back(op1); + } + if (!(((*x.begin()).getType() == (*y.begin()).getType()))){ + return rewriter.notifyMatchFailure(op0, [&](::mlir::Diagnostic &diag) { + diag << "entities 'x, y' failed to satisfy constraint: ''"; + }); + } + + // Rewrite + auto odsLoc = rewriter.getFusedLoc({tblgen_ops[0]->getLoc(), tblgen_ops[1]->getLoc(), tblgen_ops[2]->getLoc()}); (void)odsLoc; + ::llvm::SmallVector<::mlir::Value, 4> tblgen_repl_values; + ::mlir::arith::XOrIOp tblgen_XOrIOp_0; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*x.begin())); + tblgen_values.push_back((*y.begin())); + tblgen_XOrIOp_0 = rewriter.create<::mlir::arith::XOrIOp>(odsLoc, tblgen_values, tblgen_attrs); + } + ::mlir::arith::ExtUIOp tblgen_ExtUIOp_1; + { + ::llvm::SmallVector<::mlir::Value, 4> tblgen_values; (void)tblgen_values; + ::llvm::SmallVector<::mlir::NamedAttribute, 4> tblgen_attrs; (void)tblgen_attrs; + tblgen_values.push_back((*tblgen_XOrIOp_0.getODSResults(0).begin())); + ::llvm::SmallVector<::mlir::Type, 4> tblgen_types; (void)tblgen_types; + for (auto v: castedOp0.getODSResults(0)) { + tblgen_types.push_back(v.getType()); + } + tblgen_ExtUIOp_1 = rewriter.create<::mlir::arith::ExtUIOp>(odsLoc, tblgen_types, tblgen_values, tblgen_attrs); + } + + for (auto v: ::llvm::SmallVector<::mlir::Value, 4>{ tblgen_ExtUIOp_1.getODSResults(0) }) { + tblgen_repl_values.push_back(v); + } + + rewriter.replaceOp(op0, tblgen_repl_values); + return ::mlir::success(); + }; +}; + +void LLVM_ATTRIBUTE_UNUSED populateWithGenerated(::mlir::RewritePatternSet &patterns) { + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); + patterns.add(patterns.getContext()); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..0623ad4d52fb3fd54cd1367344ef2d3297417bd6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOps.cpp.inc @@ -0,0 +1,13365 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArithOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::arith::AddFOp, +::mlir::arith::AddIOp, +::mlir::arith::AddUIExtendedOp, +::mlir::arith::AndIOp, +::mlir::arith::BitcastOp, +::mlir::arith::CeilDivSIOp, +::mlir::arith::CeilDivUIOp, +::mlir::arith::CmpFOp, +::mlir::arith::CmpIOp, +::mlir::arith::ConstantOp, +::mlir::arith::DivFOp, +::mlir::arith::DivSIOp, +::mlir::arith::DivUIOp, +::mlir::arith::ExtFOp, +::mlir::arith::ExtSIOp, +::mlir::arith::ExtUIOp, +::mlir::arith::FPToSIOp, +::mlir::arith::FPToUIOp, +::mlir::arith::FloorDivSIOp, +::mlir::arith::IndexCastOp, +::mlir::arith::IndexCastUIOp, +::mlir::arith::MaxNumFOp, +::mlir::arith::MaxSIOp, +::mlir::arith::MaxUIOp, +::mlir::arith::MaximumFOp, +::mlir::arith::MinNumFOp, +::mlir::arith::MinSIOp, +::mlir::arith::MinUIOp, +::mlir::arith::MinimumFOp, +::mlir::arith::MulFOp, +::mlir::arith::MulIOp, +::mlir::arith::MulSIExtendedOp, +::mlir::arith::MulUIExtendedOp, +::mlir::arith::NegFOp, +::mlir::arith::OrIOp, +::mlir::arith::RemFOp, +::mlir::arith::RemSIOp, +::mlir::arith::RemUIOp, +::mlir::arith::SIToFPOp, +::mlir::arith::ShLIOp, +::mlir::arith::ShRSIOp, +::mlir::arith::ShRUIOp, +::mlir::arith::SubFOp, +::mlir::arith::SubIOp, +::mlir::arith::TruncFOp, +::mlir::arith::TruncIOp, +::mlir::arith::UIToFPOp, +::mlir::arith::XOrIOp, +::mlir::arith::SelectOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arith { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::FloatType>(type))) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::FloatType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::FloatType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be floating-point-like, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessIntOrIndex())) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be signless-integer-like, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessInteger(1))) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be bool-like, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((type.isSignlessIntOrIndex())) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) || (((::llvm::isa<::mlir::FloatType>(type))) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::FloatType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::FloatType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) || (((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger())) || ((::llvm::isa<::mlir::IndexType>(elementType))) || ((::llvm::isa<::mlir::FloatType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be signless-integer-or-float-like or memref of signless-integer or float, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessIntOrIndex())) || (((::llvm::isa<::mlir::VectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be signless-integer-like, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessInteger(1))) || (((::llvm::isa<::mlir::VectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be bool-like, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessInteger())) || (((::llvm::isa<::mlir::VectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be signless-fixed-width-integer-like, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithOps8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((type.isSignlessIntOrIndex())) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) || (((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger())) || ((::llvm::isa<::mlir::IndexType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be signless-integer-like or memref of signless-integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Floating point fast math flags"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ArithOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::arith::CmpFPredicateAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ArithOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::arith::CmpIPredicateAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ArithOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::TypedAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: TypedAttr instance"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ArithOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::AddFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddFOpGenericAdaptorBase::AddFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.addf", odsAttrs.getContext()); +} + +AddFOpGenericAdaptorBase::AddFOpGenericAdaptorBase(AddFOp op) : AddFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AddFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr AddFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags AddFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +AddFOpAdaptor::AddFOpAdaptor(AddFOp op) : AddFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.addf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair AddFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AddFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value AddFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AddFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AddFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AddFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AddFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AddFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AddFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AddFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional AddFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void AddFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AddFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult AddFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr AddFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags AddFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void AddFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void AddFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void AddFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult AddFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AddFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AddFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AddFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::AddFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::AddIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddIOpGenericAdaptorBase::AddIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.addi", odsAttrs.getContext()); +} + +AddIOpGenericAdaptorBase::AddIOpGenericAdaptorBase(AddIOp op) : AddIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AddIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AddIOpAdaptor::AddIOpAdaptor(AddIOp op) : AddIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AddIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AddIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value AddIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AddIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AddIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AddIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AddIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void AddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void AddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AddIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AddIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AddIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AddIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::AddIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::AddUIExtendedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddUIExtendedOpGenericAdaptorBase::AddUIExtendedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.addui_extended", odsAttrs.getContext()); +} + +AddUIExtendedOpGenericAdaptorBase::AddUIExtendedOpGenericAdaptorBase(AddUIExtendedOp op) : AddUIExtendedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddUIExtendedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AddUIExtendedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AddUIExtendedOpAdaptor::AddUIExtendedOpAdaptor(AddUIExtendedOp op) : AddUIExtendedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddUIExtendedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void AddUIExtendedOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "sum"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "overflow"); +} + +std::pair AddUIExtendedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AddUIExtendedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddUIExtendedOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value AddUIExtendedOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AddUIExtendedOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AddUIExtendedOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AddUIExtendedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AddUIExtendedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddUIExtendedOp::getSum() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value AddUIExtendedOp::getOverflow() { + return ::llvm::cast<::mlir::Value>(*getODSResults(1).begin()); +} + +void AddUIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value lhs, Value rhs) { + build(odsBuilder, odsState, lhs.getType(), ::getI1SameShape(lhs.getType()), + lhs, rhs); + +} + +void AddUIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sum, ::mlir::Type overflow, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(sum); + odsState.addTypes(overflow); +} + +void AddUIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 2u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddUIExtendedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 2u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AddUIExtendedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {lhs, rhs, sum} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult AddUIExtendedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult AddUIExtendedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type sumRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sumTypes(sumRawTypes); + ::mlir::Type overflowRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> overflowTypes(overflowRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sumRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + overflowRawTypes[0] = type; + } + result.addTypes(sumTypes); + result.addTypes(overflowTypes); + if (parser.resolveOperands(lhsOperands, sumTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, sumTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddUIExtendedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSum().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getOverflow().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AddUIExtendedOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::AddUIExtendedOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::AndIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AndIOpGenericAdaptorBase::AndIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.andi", odsAttrs.getContext()); +} + +AndIOpGenericAdaptorBase::AndIOpGenericAdaptorBase(AndIOp op) : AndIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AndIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AndIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AndIOpAdaptor::AndIOpAdaptor(AndIOp op) : AndIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AndIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AndIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AndIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AndIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value AndIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AndIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AndIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AndIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AndIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AndIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void AndIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void AndIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AndIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AndIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AndIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AndIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AndIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AndIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AndIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AndIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AndIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AndIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AndIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::AndIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::BitcastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BitcastOpGenericAdaptorBase::BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.bitcast", odsAttrs.getContext()); +} + +BitcastOpGenericAdaptorBase::BitcastOpGenericAdaptorBase(BitcastOp op) : BitcastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BitcastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BitcastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BitcastOpAdaptor::BitcastOpAdaptor(BitcastOp op) : BitcastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BitcastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BitcastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BitcastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BitcastOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &BitcastOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair BitcastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BitcastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BitcastOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BitcastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BitcastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BitcastOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BitcastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BitcastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BitcastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::BitcastOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::CeilDivSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CeilDivSIOpGenericAdaptorBase::CeilDivSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.ceildivsi", odsAttrs.getContext()); +} + +CeilDivSIOpGenericAdaptorBase::CeilDivSIOpGenericAdaptorBase(CeilDivSIOp op) : CeilDivSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CeilDivSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CeilDivSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CeilDivSIOpAdaptor::CeilDivSIOpAdaptor(CeilDivSIOp op) : CeilDivSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CeilDivSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CeilDivSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CeilDivSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CeilDivSIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CeilDivSIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CeilDivSIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CeilDivSIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CeilDivSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CeilDivSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CeilDivSIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CeilDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void CeilDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilDivSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CeilDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CeilDivSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CeilDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilDivSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CeilDivSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CeilDivSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CeilDivSIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CeilDivSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CeilDivSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CeilDivSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::CeilDivSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::CeilDivUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CeilDivUIOpGenericAdaptorBase::CeilDivUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.ceildivui", odsAttrs.getContext()); +} + +CeilDivUIOpGenericAdaptorBase::CeilDivUIOpGenericAdaptorBase(CeilDivUIOp op) : CeilDivUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CeilDivUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CeilDivUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CeilDivUIOpAdaptor::CeilDivUIOpAdaptor(CeilDivUIOp op) : CeilDivUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CeilDivUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CeilDivUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CeilDivUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CeilDivUIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CeilDivUIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CeilDivUIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CeilDivUIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CeilDivUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CeilDivUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CeilDivUIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CeilDivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void CeilDivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilDivUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CeilDivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CeilDivUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CeilDivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilDivUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CeilDivUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CeilDivUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CeilDivUIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CeilDivUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CeilDivUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CeilDivUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::CeilDivUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::CmpFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CmpFOpGenericAdaptorBase::CmpFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.cmpf", odsAttrs.getContext()); +} + +CmpFOpGenericAdaptorBase::CmpFOpGenericAdaptorBase(CmpFOp op) : CmpFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CmpFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CmpFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::CmpFPredicateAttr CmpFOpGenericAdaptorBase::getPredicateAttr() { + auto attr = ::llvm::cast<::mlir::arith::CmpFPredicateAttr>(getProperties().predicate); + return attr; +} + +::mlir::arith::CmpFPredicate CmpFOpGenericAdaptorBase::getPredicate() { + auto attr = getPredicateAttr(); + return attr.getValue(); +} + +} // namespace detail +CmpFOpAdaptor::CmpFOpAdaptor(CmpFOp op) : CmpFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CmpFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate; + if (!tblgen_predicate) return emitError(loc, "'arith.cmpf' op ""requires attribute 'predicate'"); + + if (tblgen_predicate && !((::llvm::isa<::mlir::arith::CmpFPredicateAttr>(tblgen_predicate)))) + return emitError(loc, "'arith.cmpf' op ""attribute 'predicate' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15"); + return ::mlir::success(); +} + +std::pair CmpFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CmpFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CmpFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CmpFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CmpFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CmpFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CmpFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CmpFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CmpFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CmpFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.predicate; + auto attr = dict.get("predicate"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for predicate in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `predicate` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CmpFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.predicate; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("predicate", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CmpFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.predicate.getAsOpaquePointer())); +} + +std::optional CmpFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "predicate") + return prop.predicate; + return std::nullopt; +} + +void CmpFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "predicate") { + prop.predicate = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CmpFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.predicate) attrs.append("predicate", prop.predicate); +} + +::mlir::LogicalResult CmpFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPredicateAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps1(attr, "predicate", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CmpFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.predicate))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CmpFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.predicate); +} + +::mlir::arith::CmpFPredicateAttr CmpFOp::getPredicateAttr() { + return ::llvm::cast<::mlir::arith::CmpFPredicateAttr>(getProperties().predicate); +} + +::mlir::arith::CmpFPredicate CmpFOp::getPredicate() { + auto attr = getPredicateAttr(); + return attr.getValue(); +} + +void CmpFOp::setPredicateAttr(::mlir::arith::CmpFPredicateAttr attr) { + (*this)->setAttr(getPredicateAttrName(), attr); +} + +void CmpFOp::setPredicate(::mlir::arith::CmpFPredicate attrValue) { + (*this)->setAttr(getPredicateAttrName(), ::mlir::arith::CmpFPredicateAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpFPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + odsState.addTypes(result); +} + +void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::CmpFPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CmpFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpFPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpFPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::arith::CmpFPredicateAttr::get(odsBuilder.getContext(), predicate); + odsState.addTypes(result); +} + +void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::CmpFPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::arith::CmpFPredicateAttr::get(odsBuilder.getContext(), predicate); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CmpFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpFPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::arith::CmpFPredicateAttr::get(odsBuilder.getContext(), predicate); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CmpFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CmpFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CmpFOp::verifyInvariantsImpl() { + auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate; + if (!tblgen_predicate) return emitOpError("requires attribute 'predicate'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps1(*this, tblgen_predicate, "predicate"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::getI1SameShape((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result type has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult CmpFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CmpFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::getI1SameShape(operands[0].getType()); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CmpFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::arith::CmpFPredicateAttr predicateAttr; + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"false","oeq","ogt","oge","olt","ole","one","ord","ueq","ugt","uge","ult","ule","une","uno","true"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "predicate", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'predicate' [false, oeq, ogt, oge, olt, ole, one, ord, ueq, ugt, uge, ult, ule, une, uno, true]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::arith::symbolizeCmpFPredicate(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "predicate attribute specification: \"" << attrStr << '"';; + + predicateAttr = ::mlir::arith::CmpFPredicateAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().predicate = predicateAttr; + } + } + if (parser.parseComma()) + return ::mlir::failure(); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + for (::mlir::Type type : lhsTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::FloatType>(type))) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::FloatType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::FloatType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return parser.emitError(parser.getNameLoc()) << "'lhs' must be floating-point-like, but got " << type; + } + } + result.addTypes(::getI1SameShape(lhsTypes[0])); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, lhsTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CmpFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + + { + auto caseValue = getPredicate(); + auto caseValueStr = stringifyCmpFPredicate(caseValue); + _odsPrinter << caseValueStr; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("predicate"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CmpFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::CmpFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::CmpIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CmpIOpGenericAdaptorBase::CmpIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.cmpi", odsAttrs.getContext()); +} + +CmpIOpGenericAdaptorBase::CmpIOpGenericAdaptorBase(CmpIOp op) : CmpIOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CmpIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CmpIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::CmpIPredicateAttr CmpIOpGenericAdaptorBase::getPredicateAttr() { + auto attr = ::llvm::cast<::mlir::arith::CmpIPredicateAttr>(getProperties().predicate); + return attr; +} + +::mlir::arith::CmpIPredicate CmpIOpGenericAdaptorBase::getPredicate() { + auto attr = getPredicateAttr(); + return attr.getValue(); +} + +} // namespace detail +CmpIOpAdaptor::CmpIOpAdaptor(CmpIOp op) : CmpIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CmpIOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate; + if (!tblgen_predicate) return emitError(loc, "'arith.cmpi' op ""requires attribute 'predicate'"); + + if (tblgen_predicate && !((::llvm::isa<::mlir::arith::CmpIPredicateAttr>(tblgen_predicate)))) + return emitError(loc, "'arith.cmpi' op ""attribute 'predicate' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9"); + return ::mlir::success(); +} + +std::pair CmpIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CmpIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CmpIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CmpIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CmpIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CmpIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CmpIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CmpIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CmpIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CmpIOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.predicate; + auto attr = dict.get("predicate"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for predicate in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `predicate` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CmpIOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.predicate; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("predicate", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CmpIOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.predicate.getAsOpaquePointer())); +} + +std::optional CmpIOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "predicate") + return prop.predicate; + return std::nullopt; +} + +void CmpIOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "predicate") { + prop.predicate = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CmpIOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.predicate) attrs.append("predicate", prop.predicate); +} + +::mlir::LogicalResult CmpIOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPredicateAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps2(attr, "predicate", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CmpIOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.predicate))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CmpIOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.predicate); +} + +::mlir::arith::CmpIPredicateAttr CmpIOp::getPredicateAttr() { + return ::llvm::cast<::mlir::arith::CmpIPredicateAttr>(getProperties().predicate); +} + +::mlir::arith::CmpIPredicate CmpIOp::getPredicate() { + auto attr = getPredicateAttr(); + return attr.getValue(); +} + +void CmpIOp::setPredicateAttr(::mlir::arith::CmpIPredicateAttr attr) { + (*this)->setAttr(getPredicateAttrName(), attr); +} + +void CmpIOp::setPredicate(::mlir::arith::CmpIPredicate attrValue) { + (*this)->setAttr(getPredicateAttrName(), ::mlir::arith::CmpIPredicateAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpIPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + odsState.addTypes(result); +} + +void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::CmpIPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CmpIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpIPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpIPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::arith::CmpIPredicateAttr::get(odsBuilder.getContext(), predicate); + odsState.addTypes(result); +} + +void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::CmpIPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::arith::CmpIPredicateAttr::get(odsBuilder.getContext(), predicate); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CmpIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpIPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::arith::CmpIPredicateAttr::get(odsBuilder.getContext(), predicate); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CmpIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CmpIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CmpIOp::verifyInvariantsImpl() { + auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate; + if (!tblgen_predicate) return emitOpError("requires attribute 'predicate'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps2(*this, tblgen_predicate, "predicate"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::getI1SameShape((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result type has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult CmpIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CmpIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::getI1SameShape(operands[0].getType()); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CmpIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::arith::CmpIPredicateAttr predicateAttr; + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"eq","ne","slt","sle","sgt","sge","ult","ule","ugt","uge"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "predicate", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'predicate' [eq, ne, slt, sle, sgt, sge, ult, ule, ugt, uge]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::arith::symbolizeCmpIPredicate(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "predicate attribute specification: \"" << attrStr << '"';; + + predicateAttr = ::mlir::arith::CmpIPredicateAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().predicate = predicateAttr; + } + } + if (parser.parseComma()) + return ::mlir::failure(); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + for (::mlir::Type type : lhsTypes) { + (void)type; + if (!(((type.isSignlessIntOrIndex())) || (((::llvm::isa<::mlir::VectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return parser.emitError(parser.getNameLoc()) << "'lhs' must be signless-integer-like, but got " << type; + } + } + result.addTypes(::getI1SameShape(lhsTypes[0])); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, lhsTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CmpIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + + { + auto caseValue = getPredicate(); + auto caseValueStr = stringifyCmpIPredicate(caseValue); + _odsPrinter << caseValueStr; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("predicate"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CmpIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::CmpIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ConstantOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.constant", odsAttrs.getContext()); +} + +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(ConstantOp op) : ConstantOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ConstantOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ConstantOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypedAttr ConstantOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::cast<::mlir::TypedAttr>(getProperties().value); + return attr; +} + +::mlir::TypedAttr ConstantOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr; +} + +} // namespace detail +ConstantOpAdaptor::ConstantOpAdaptor(ConstantOp op) : ConstantOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ConstantOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitError(loc, "'arith.constant' op ""requires attribute 'value'"); + + if (tblgen_value && !((::llvm::isa<::mlir::TypedAttr>(tblgen_value)))) + return emitError(loc, "'arith.constant' op ""attribute 'value' failed to satisfy constraint: TypedAttr instance"); + return ::mlir::success(); +} + +std::pair ConstantOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ConstantOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ConstantOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ConstantOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ConstantOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ConstantOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ConstantOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional ConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void ConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult ConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps3(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.value); +} + +::mlir::TypedAttr ConstantOp::getValueAttr() { + return ::llvm::cast<::mlir::TypedAttr>(getProperties().value); +} + +::mlir::TypedAttr ConstantOp::getValue() { + auto attr = getValueAttr(); + return attr; +} + +void ConstantOp::setValueAttr(::mlir::TypedAttr attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::TypedAttr value) { + odsState.getOrAddProperties().value = value; + odsState.addTypes(result); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypedAttr value) { + odsState.getOrAddProperties().value = value; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypedAttr value) { + odsState.getOrAddProperties().value = value; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ConstantOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitOpError("requires attribute 'value'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps3(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!(((getValue().getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == (getValue().getType())))) + return emitOpError("failed to verify that all of {value, result} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult ConstantOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::TypedAttr odsInferredTypeAttr0 = (properties ? properties.as()->value : ::llvm::dyn_cast_or_null<::mlir::TypedAttr>(attributes.get("value"))); + if (!odsInferredTypeAttr0) return ::mlir::failure(); + ::mlir::Type odsInferredType0 = odsInferredTypeAttr0.getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ConstantOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::TypedAttr valueAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + if (parser.parseCustomAttributeWithFallback(valueAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (valueAttr) result.getOrAddProperties().value = valueAttr; + result.addTypes(valueAttr.getType()); + return ::mlir::success(); +} + +void ConstantOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getValueAttr()); +} + +void ConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ConstantOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::DivFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DivFOpGenericAdaptorBase::DivFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.divf", odsAttrs.getContext()); +} + +DivFOpGenericAdaptorBase::DivFOpGenericAdaptorBase(DivFOp op) : DivFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DivFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DivFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr DivFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags DivFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +DivFOpAdaptor::DivFOpAdaptor(DivFOp op) : DivFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DivFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.divf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair DivFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DivFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DivFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value DivFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &DivFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &DivFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DivFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DivFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DivFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult DivFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute DivFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DivFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional DivFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void DivFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void DivFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult DivFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DivFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr DivFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags DivFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void DivFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void DivFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DivFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void DivFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult DivFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult DivFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult DivFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DivFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void DivFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::DivFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::DivSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DivSIOpGenericAdaptorBase::DivSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.divsi", odsAttrs.getContext()); +} + +DivSIOpGenericAdaptorBase::DivSIOpGenericAdaptorBase(DivSIOp op) : DivSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DivSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DivSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DivSIOpAdaptor::DivSIOpAdaptor(DivSIOp op) : DivSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DivSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DivSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DivSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DivSIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value DivSIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &DivSIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &DivSIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DivSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DivSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DivSIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void DivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void DivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DivSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult DivSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult DivSIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult DivSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DivSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void DivSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::DivSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::DivUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DivUIOpGenericAdaptorBase::DivUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.divui", odsAttrs.getContext()); +} + +DivUIOpGenericAdaptorBase::DivUIOpGenericAdaptorBase(DivUIOp op) : DivUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DivUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DivUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DivUIOpAdaptor::DivUIOpAdaptor(DivUIOp op) : DivUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DivUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DivUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DivUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DivUIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value DivUIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &DivUIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &DivUIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DivUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DivUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DivUIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void DivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void DivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DivUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult DivUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult DivUIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult DivUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DivUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void DivUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::DivUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ExtFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExtFOpGenericAdaptorBase::ExtFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.extf", odsAttrs.getContext()); +} + +ExtFOpGenericAdaptorBase::ExtFOpGenericAdaptorBase(ExtFOp op) : ExtFOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExtFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExtFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ExtFOpAdaptor::ExtFOpAdaptor(ExtFOp op) : ExtFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExtFOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ExtFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExtFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtFOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExtFOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExtFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExtFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtFOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ExtFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void ExtFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ExtFOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtFOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ExtFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExtFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ExtFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ExtSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExtSIOpGenericAdaptorBase::ExtSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.extsi", odsAttrs.getContext()); +} + +ExtSIOpGenericAdaptorBase::ExtSIOpGenericAdaptorBase(ExtSIOp op) : ExtSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExtSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExtSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ExtSIOpAdaptor::ExtSIOpAdaptor(ExtSIOp op) : ExtSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExtSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ExtSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExtSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtSIOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExtSIOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExtSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExtSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtSIOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ExtSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void ExtSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ExtSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtSIOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ExtSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExtSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ExtSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ExtUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExtUIOpGenericAdaptorBase::ExtUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.extui", odsAttrs.getContext()); +} + +ExtUIOpGenericAdaptorBase::ExtUIOpGenericAdaptorBase(ExtUIOp op) : ExtUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExtUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExtUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ExtUIOpAdaptor::ExtUIOpAdaptor(ExtUIOp op) : ExtUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExtUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ExtUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExtUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtUIOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExtUIOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExtUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExtUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtUIOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ExtUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void ExtUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ExtUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtUIOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ExtUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExtUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ExtUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::FPToSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FPToSIOpGenericAdaptorBase::FPToSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.fptosi", odsAttrs.getContext()); +} + +FPToSIOpGenericAdaptorBase::FPToSIOpGenericAdaptorBase(FPToSIOp op) : FPToSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FPToSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FPToSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FPToSIOpAdaptor::FPToSIOpAdaptor(FPToSIOp op) : FPToSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FPToSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FPToSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FPToSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPToSIOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FPToSIOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FPToSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FPToSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPToSIOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FPToSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FPToSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FPToSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FPToSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FPToSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FPToSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::FPToSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::FPToUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FPToUIOpGenericAdaptorBase::FPToUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.fptoui", odsAttrs.getContext()); +} + +FPToUIOpGenericAdaptorBase::FPToUIOpGenericAdaptorBase(FPToUIOp op) : FPToUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FPToUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FPToUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FPToUIOpAdaptor::FPToUIOpAdaptor(FPToUIOp op) : FPToUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FPToUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FPToUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FPToUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPToUIOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FPToUIOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FPToUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FPToUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPToUIOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FPToUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FPToUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FPToUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FPToUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FPToUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FPToUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::FPToUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::FloorDivSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FloorDivSIOpGenericAdaptorBase::FloorDivSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.floordivsi", odsAttrs.getContext()); +} + +FloorDivSIOpGenericAdaptorBase::FloorDivSIOpGenericAdaptorBase(FloorDivSIOp op) : FloorDivSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FloorDivSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FloorDivSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FloorDivSIOpAdaptor::FloorDivSIOpAdaptor(FloorDivSIOp op) : FloorDivSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FloorDivSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FloorDivSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FloorDivSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FloorDivSIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FloorDivSIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &FloorDivSIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FloorDivSIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair FloorDivSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FloorDivSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FloorDivSIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FloorDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void FloorDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FloorDivSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FloorDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FloorDivSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FloorDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FloorDivSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult FloorDivSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FloorDivSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FloorDivSIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FloorDivSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FloorDivSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FloorDivSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::FloorDivSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::IndexCastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +IndexCastOpGenericAdaptorBase::IndexCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.index_cast", odsAttrs.getContext()); +} + +IndexCastOpGenericAdaptorBase::IndexCastOpGenericAdaptorBase(IndexCastOp op) : IndexCastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair IndexCastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr IndexCastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +IndexCastOpAdaptor::IndexCastOpAdaptor(IndexCastOp op) : IndexCastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult IndexCastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair IndexCastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range IndexCastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IndexCastOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &IndexCastOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair IndexCastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range IndexCastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IndexCastOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void IndexCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void IndexCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IndexCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult IndexCastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps8(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult IndexCastOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult IndexCastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void IndexCastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void IndexCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::IndexCastOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::IndexCastUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +IndexCastUIOpGenericAdaptorBase::IndexCastUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.index_castui", odsAttrs.getContext()); +} + +IndexCastUIOpGenericAdaptorBase::IndexCastUIOpGenericAdaptorBase(IndexCastUIOp op) : IndexCastUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair IndexCastUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr IndexCastUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +IndexCastUIOpAdaptor::IndexCastUIOpAdaptor(IndexCastUIOp op) : IndexCastUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult IndexCastUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair IndexCastUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range IndexCastUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IndexCastUIOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &IndexCastUIOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair IndexCastUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range IndexCastUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IndexCastUIOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void IndexCastUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void IndexCastUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IndexCastUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult IndexCastUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps8(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult IndexCastUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult IndexCastUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void IndexCastUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void IndexCastUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::IndexCastUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MaxNumFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaxNumFOpGenericAdaptorBase::MaxNumFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.maxnumf", odsAttrs.getContext()); +} + +MaxNumFOpGenericAdaptorBase::MaxNumFOpGenericAdaptorBase(MaxNumFOp op) : MaxNumFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaxNumFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaxNumFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr MaxNumFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags MaxNumFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +MaxNumFOpAdaptor::MaxNumFOpAdaptor(MaxNumFOp op) : MaxNumFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaxNumFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.maxnumf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair MaxNumFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaxNumFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaxNumFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MaxNumFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MaxNumFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaxNumFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaxNumFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaxNumFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaxNumFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MaxNumFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MaxNumFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MaxNumFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional MaxNumFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void MaxNumFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MaxNumFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult MaxNumFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaxNumFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaxNumFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr MaxNumFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags MaxNumFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void MaxNumFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void MaxNumFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MaxNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void MaxNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxNumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaxNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaxNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void MaxNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxNumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaxNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaxNumFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MaxNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxNumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MaxNumFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult MaxNumFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaxNumFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MaxNumFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MaxNumFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaxNumFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MaxNumFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MaxNumFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MaxSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaxSIOpGenericAdaptorBase::MaxSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.maxsi", odsAttrs.getContext()); +} + +MaxSIOpGenericAdaptorBase::MaxSIOpGenericAdaptorBase(MaxSIOp op) : MaxSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaxSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaxSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MaxSIOpAdaptor::MaxSIOpAdaptor(MaxSIOp op) : MaxSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaxSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MaxSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaxSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaxSIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MaxSIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MaxSIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaxSIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaxSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaxSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaxSIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MaxSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MaxSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaxSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaxSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MaxSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MaxSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaxSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MaxSIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MaxSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaxSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MaxSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MaxSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MaxUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaxUIOpGenericAdaptorBase::MaxUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.maxui", odsAttrs.getContext()); +} + +MaxUIOpGenericAdaptorBase::MaxUIOpGenericAdaptorBase(MaxUIOp op) : MaxUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaxUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaxUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MaxUIOpAdaptor::MaxUIOpAdaptor(MaxUIOp op) : MaxUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaxUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MaxUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaxUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaxUIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MaxUIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MaxUIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaxUIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaxUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaxUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaxUIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MaxUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MaxUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaxUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaxUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MaxUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MaxUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaxUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MaxUIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MaxUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaxUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MaxUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MaxUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MaximumFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaximumFOpGenericAdaptorBase::MaximumFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.maximumf", odsAttrs.getContext()); +} + +MaximumFOpGenericAdaptorBase::MaximumFOpGenericAdaptorBase(MaximumFOp op) : MaximumFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaximumFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaximumFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr MaximumFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags MaximumFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +MaximumFOpAdaptor::MaximumFOpAdaptor(MaximumFOp op) : MaximumFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaximumFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.maximumf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair MaximumFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaximumFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaximumFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MaximumFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MaximumFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaximumFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaximumFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaximumFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaximumFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MaximumFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MaximumFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MaximumFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional MaximumFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void MaximumFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MaximumFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult MaximumFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaximumFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaximumFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr MaximumFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags MaximumFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void MaximumFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void MaximumFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MaximumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void MaximumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaximumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaximumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaximumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void MaximumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaximumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaximumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaximumFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MaximumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaximumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MaximumFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult MaximumFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaximumFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MaximumFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MaximumFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaximumFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MaximumFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MaximumFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MinNumFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MinNumFOpGenericAdaptorBase::MinNumFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.minnumf", odsAttrs.getContext()); +} + +MinNumFOpGenericAdaptorBase::MinNumFOpGenericAdaptorBase(MinNumFOp op) : MinNumFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MinNumFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MinNumFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr MinNumFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags MinNumFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +MinNumFOpAdaptor::MinNumFOpAdaptor(MinNumFOp op) : MinNumFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MinNumFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.minnumf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair MinNumFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MinNumFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinNumFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MinNumFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MinNumFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MinNumFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MinNumFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MinNumFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinNumFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MinNumFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MinNumFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MinNumFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional MinNumFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void MinNumFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MinNumFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult MinNumFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinNumFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinNumFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr MinNumFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags MinNumFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void MinNumFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void MinNumFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MinNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void MinNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinNumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void MinNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinNumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinNumFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MinNumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinNumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MinNumFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult MinNumFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinNumFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MinNumFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MinNumFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinNumFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MinNumFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MinNumFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MinSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MinSIOpGenericAdaptorBase::MinSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.minsi", odsAttrs.getContext()); +} + +MinSIOpGenericAdaptorBase::MinSIOpGenericAdaptorBase(MinSIOp op) : MinSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MinSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MinSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MinSIOpAdaptor::MinSIOpAdaptor(MinSIOp op) : MinSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MinSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MinSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MinSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinSIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MinSIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MinSIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MinSIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MinSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MinSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinSIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MinSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MinSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MinSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MinSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MinSIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MinSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MinSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MinSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MinUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MinUIOpGenericAdaptorBase::MinUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.minui", odsAttrs.getContext()); +} + +MinUIOpGenericAdaptorBase::MinUIOpGenericAdaptorBase(MinUIOp op) : MinUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MinUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MinUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MinUIOpAdaptor::MinUIOpAdaptor(MinUIOp op) : MinUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MinUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MinUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MinUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinUIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MinUIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MinUIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MinUIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MinUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MinUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinUIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MinUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MinUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MinUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MinUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MinUIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MinUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MinUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MinUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MinimumFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MinimumFOpGenericAdaptorBase::MinimumFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.minimumf", odsAttrs.getContext()); +} + +MinimumFOpGenericAdaptorBase::MinimumFOpGenericAdaptorBase(MinimumFOp op) : MinimumFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MinimumFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MinimumFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr MinimumFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags MinimumFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +MinimumFOpAdaptor::MinimumFOpAdaptor(MinimumFOp op) : MinimumFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MinimumFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.minimumf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair MinimumFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MinimumFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinimumFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MinimumFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MinimumFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MinimumFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MinimumFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MinimumFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinimumFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MinimumFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MinimumFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MinimumFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional MinimumFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void MinimumFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MinimumFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult MinimumFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinimumFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinimumFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr MinimumFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags MinimumFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void MinimumFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void MinimumFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MinimumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void MinimumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinimumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinimumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinimumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void MinimumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinimumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinimumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinimumFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MinimumFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinimumFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MinimumFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult MinimumFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinimumFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MinimumFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MinimumFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinimumFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MinimumFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MinimumFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MulFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MulFOpGenericAdaptorBase::MulFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.mulf", odsAttrs.getContext()); +} + +MulFOpGenericAdaptorBase::MulFOpGenericAdaptorBase(MulFOp op) : MulFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MulFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MulFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr MulFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags MulFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +MulFOpAdaptor::MulFOpAdaptor(MulFOp op) : MulFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MulFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.mulf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair MulFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MulFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MulFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MulFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MulFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MulFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MulFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MulFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MulFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MulFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional MulFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void MulFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MulFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult MulFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MulFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MulFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr MulFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags MulFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void MulFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void MulFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MulFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MulFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult MulFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MulFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MulFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MulFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MulFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MulFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MulFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MulIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MulIOpGenericAdaptorBase::MulIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.muli", odsAttrs.getContext()); +} + +MulIOpGenericAdaptorBase::MulIOpGenericAdaptorBase(MulIOp op) : MulIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MulIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MulIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MulIOpAdaptor::MulIOpAdaptor(MulIOp op) : MulIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MulIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MulIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MulIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MulIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MulIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MulIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MulIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MulIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MulIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MulIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MulIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MulIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MulIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MulIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MulIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MulIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MulSIExtendedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MulSIExtendedOpGenericAdaptorBase::MulSIExtendedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.mulsi_extended", odsAttrs.getContext()); +} + +MulSIExtendedOpGenericAdaptorBase::MulSIExtendedOpGenericAdaptorBase(MulSIExtendedOp op) : MulSIExtendedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MulSIExtendedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MulSIExtendedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MulSIExtendedOpAdaptor::MulSIExtendedOpAdaptor(MulSIExtendedOp op) : MulSIExtendedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MulSIExtendedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void MulSIExtendedOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "low"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "high"); +} + +std::pair MulSIExtendedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MulSIExtendedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulSIExtendedOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MulSIExtendedOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MulSIExtendedOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MulSIExtendedOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MulSIExtendedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MulSIExtendedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulSIExtendedOp::getLow() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value MulSIExtendedOp::getHigh() { + return ::llvm::cast<::mlir::Value>(*getODSResults(1).begin()); +} + +void MulSIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type low, ::mlir::Type high, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(low); + odsState.addTypes(high); +} + +void MulSIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulSIExtendedOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MulSIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 2u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MulSIExtendedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 2u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MulSIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulSIExtendedOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 2u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MulSIExtendedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSResults(1).begin()).getType()) && ((*this->getODSResults(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {lhs, rhs, low, high} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult MulSIExtendedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MulSIExtendedOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(2); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[1].getType(); + ::mlir::Type odsInferredType1 = operands[1].getType(); + inferredReturnTypes[0] = odsInferredType0; + inferredReturnTypes[1] = odsInferredType1; + return ::mlir::success(); +} + +::mlir::ParseResult MulSIExtendedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + result.addTypes(lhsTypes[0]); + result.addTypes(lhsTypes[0]); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, lhsTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MulSIExtendedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MulSIExtendedOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MulSIExtendedOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MulUIExtendedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MulUIExtendedOpGenericAdaptorBase::MulUIExtendedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.mului_extended", odsAttrs.getContext()); +} + +MulUIExtendedOpGenericAdaptorBase::MulUIExtendedOpGenericAdaptorBase(MulUIExtendedOp op) : MulUIExtendedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MulUIExtendedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MulUIExtendedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MulUIExtendedOpAdaptor::MulUIExtendedOpAdaptor(MulUIExtendedOp op) : MulUIExtendedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MulUIExtendedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void MulUIExtendedOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "low"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "high"); +} + +std::pair MulUIExtendedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MulUIExtendedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulUIExtendedOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MulUIExtendedOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MulUIExtendedOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MulUIExtendedOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MulUIExtendedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MulUIExtendedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulUIExtendedOp::getLow() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value MulUIExtendedOp::getHigh() { + return ::llvm::cast<::mlir::Value>(*getODSResults(1).begin()); +} + +void MulUIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type low, ::mlir::Type high, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(low); + odsState.addTypes(high); +} + +void MulUIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulUIExtendedOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MulUIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 2u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MulUIExtendedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 2u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MulUIExtendedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulUIExtendedOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 2u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MulUIExtendedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSResults(1).begin()).getType()) && ((*this->getODSResults(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {lhs, rhs, low, high} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult MulUIExtendedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MulUIExtendedOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(2); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[1].getType(); + ::mlir::Type odsInferredType1 = operands[1].getType(); + inferredReturnTypes[0] = odsInferredType0; + inferredReturnTypes[1] = odsInferredType1; + return ::mlir::success(); +} + +::mlir::ParseResult MulUIExtendedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + result.addTypes(lhsTypes[0]); + result.addTypes(lhsTypes[0]); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, lhsTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MulUIExtendedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MulUIExtendedOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MulUIExtendedOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::NegFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +NegFOpGenericAdaptorBase::NegFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.negf", odsAttrs.getContext()); +} + +NegFOpGenericAdaptorBase::NegFOpGenericAdaptorBase(NegFOp op) : NegFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair NegFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr NegFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr NegFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags NegFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +NegFOpAdaptor::NegFOpAdaptor(NegFOp op) : NegFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult NegFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.negf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair NegFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range NegFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value NegFOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &NegFOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair NegFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range NegFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value NegFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult NegFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute NegFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code NegFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional NegFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void NegFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void NegFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult NegFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult NegFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void NegFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr NegFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags NegFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void NegFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void NegFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NegFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NegFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NegFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NegFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void NegFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult NegFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult NegFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult NegFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult NegFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void NegFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void NegFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::NegFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::OrIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +OrIOpGenericAdaptorBase::OrIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.ori", odsAttrs.getContext()); +} + +OrIOpGenericAdaptorBase::OrIOpGenericAdaptorBase(OrIOp op) : OrIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair OrIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr OrIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +OrIOpAdaptor::OrIOpAdaptor(OrIOp op) : OrIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult OrIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair OrIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range OrIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value OrIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value OrIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &OrIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &OrIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair OrIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range OrIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value OrIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void OrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void OrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(OrIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void OrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void OrIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void OrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(OrIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult OrIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult OrIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult OrIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult OrIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OrIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void OrIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::OrIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::RemFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RemFOpGenericAdaptorBase::RemFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.remf", odsAttrs.getContext()); +} + +RemFOpGenericAdaptorBase::RemFOpGenericAdaptorBase(RemFOp op) : RemFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RemFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RemFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr RemFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags RemFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +RemFOpAdaptor::RemFOpAdaptor(RemFOp op) : RemFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RemFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.remf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair RemFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RemFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RemFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RemFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &RemFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RemFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair RemFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RemFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RemFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RemFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RemFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RemFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional RemFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void RemFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RemFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult RemFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RemFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RemFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr RemFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags RemFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void RemFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void RemFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RemFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void RemFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult RemFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RemFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RemFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RemFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RemFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RemFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::RemFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::RemSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RemSIOpGenericAdaptorBase::RemSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.remsi", odsAttrs.getContext()); +} + +RemSIOpGenericAdaptorBase::RemSIOpGenericAdaptorBase(RemSIOp op) : RemSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RemSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RemSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RemSIOpAdaptor::RemSIOpAdaptor(RemSIOp op) : RemSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RemSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RemSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RemSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RemSIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RemSIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &RemSIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RemSIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair RemSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RemSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RemSIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void RemSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void RemSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RemSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RemSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RemSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RemSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RemSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RemSIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RemSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RemSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RemSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::RemSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::RemUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RemUIOpGenericAdaptorBase::RemUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.remui", odsAttrs.getContext()); +} + +RemUIOpGenericAdaptorBase::RemUIOpGenericAdaptorBase(RemUIOp op) : RemUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RemUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RemUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RemUIOpAdaptor::RemUIOpAdaptor(RemUIOp op) : RemUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RemUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RemUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RemUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RemUIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RemUIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &RemUIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RemUIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair RemUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RemUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RemUIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void RemUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void RemUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RemUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RemUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RemUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RemUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RemUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RemUIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RemUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RemUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RemUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::RemUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::SIToFPOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SIToFPOpGenericAdaptorBase::SIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.sitofp", odsAttrs.getContext()); +} + +SIToFPOpGenericAdaptorBase::SIToFPOpGenericAdaptorBase(SIToFPOp op) : SIToFPOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SIToFPOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SIToFPOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SIToFPOpAdaptor::SIToFPOpAdaptor(SIToFPOp op) : SIToFPOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SIToFPOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SIToFPOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SIToFPOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SIToFPOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SIToFPOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SIToFPOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SIToFPOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SIToFPOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SIToFPOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SIToFPOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SIToFPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SIToFPOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SIToFPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::SIToFPOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ShLIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShLIOpGenericAdaptorBase::ShLIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.shli", odsAttrs.getContext()); +} + +ShLIOpGenericAdaptorBase::ShLIOpGenericAdaptorBase(ShLIOp op) : ShLIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShLIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShLIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ShLIOpAdaptor::ShLIOpAdaptor(ShLIOp op) : ShLIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShLIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ShLIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShLIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShLIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value ShLIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ShLIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShLIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShLIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShLIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShLIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ShLIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void ShLIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShLIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ShLIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShLIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ShLIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShLIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ShLIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShLIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ShLIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ShLIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShLIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ShLIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ShLIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ShRSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShRSIOpGenericAdaptorBase::ShRSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.shrsi", odsAttrs.getContext()); +} + +ShRSIOpGenericAdaptorBase::ShRSIOpGenericAdaptorBase(ShRSIOp op) : ShRSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShRSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShRSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ShRSIOpAdaptor::ShRSIOpAdaptor(ShRSIOp op) : ShRSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShRSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ShRSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShRSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShRSIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value ShRSIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ShRSIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShRSIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShRSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShRSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShRSIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ShRSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void ShRSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShRSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ShRSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShRSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ShRSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShRSIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ShRSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShRSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ShRSIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ShRSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShRSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ShRSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ShRSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ShRUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShRUIOpGenericAdaptorBase::ShRUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.shrui", odsAttrs.getContext()); +} + +ShRUIOpGenericAdaptorBase::ShRUIOpGenericAdaptorBase(ShRUIOp op) : ShRUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShRUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShRUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ShRUIOpAdaptor::ShRUIOpAdaptor(ShRUIOp op) : ShRUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShRUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ShRUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShRUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShRUIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value ShRUIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ShRUIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShRUIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShRUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShRUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShRUIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ShRUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void ShRUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShRUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ShRUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShRUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ShRUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShRUIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ShRUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShRUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ShRUIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ShRUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShRUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ShRUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ShRUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::SubFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubFOpGenericAdaptorBase::SubFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.subf", odsAttrs.getContext()); +} + +SubFOpGenericAdaptorBase::SubFOpGenericAdaptorBase(SubFOp op) : SubFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr SubFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags SubFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +SubFOpAdaptor::SubFOpAdaptor(SubFOp op) : SubFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'arith.subf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair SubFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SubFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SubFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SubFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SubFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SubFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SubFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional SubFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void SubFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SubFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult SubFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr SubFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags SubFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void SubFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void SubFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SubFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult SubFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SubFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SubFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::SubFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::SubIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubIOpGenericAdaptorBase::SubIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.subi", odsAttrs.getContext()); +} + +SubIOpGenericAdaptorBase::SubIOpGenericAdaptorBase(SubIOp op) : SubIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SubIOpAdaptor::SubIOpAdaptor(SubIOp op) : SubIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SubIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SubIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SubIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SubIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SubIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void SubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SubIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SubIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SubIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::SubIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::TruncFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TruncFOpGenericAdaptorBase::TruncFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.truncf", odsAttrs.getContext()); +} + +TruncFOpGenericAdaptorBase::TruncFOpGenericAdaptorBase(TruncFOp op) : TruncFOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TruncFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TruncFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TruncFOpAdaptor::TruncFOpAdaptor(TruncFOp op) : TruncFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TruncFOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TruncFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TruncFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TruncFOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &TruncFOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair TruncFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TruncFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TruncFOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void TruncFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void TruncFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TruncFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TruncFOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TruncFOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TruncFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TruncFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TruncFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::TruncFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::TruncIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TruncIOpGenericAdaptorBase::TruncIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.trunci", odsAttrs.getContext()); +} + +TruncIOpGenericAdaptorBase::TruncIOpGenericAdaptorBase(TruncIOp op) : TruncIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TruncIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TruncIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TruncIOpAdaptor::TruncIOpAdaptor(TruncIOp op) : TruncIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TruncIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TruncIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TruncIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TruncIOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &TruncIOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair TruncIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TruncIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TruncIOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void TruncIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void TruncIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TruncIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TruncIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TruncIOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TruncIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TruncIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TruncIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::TruncIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::UIToFPOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UIToFPOpGenericAdaptorBase::UIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.uitofp", odsAttrs.getContext()); +} + +UIToFPOpGenericAdaptorBase::UIToFPOpGenericAdaptorBase(UIToFPOp op) : UIToFPOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UIToFPOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UIToFPOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UIToFPOpAdaptor::UIToFPOpAdaptor(UIToFPOp op) : UIToFPOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UIToFPOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UIToFPOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UIToFPOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UIToFPOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &UIToFPOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair UIToFPOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UIToFPOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UIToFPOp::getOut() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(out); +} + +void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UIToFPOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UIToFPOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult UIToFPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc; + (void)inOperandsLoc; + ::mlir::Type inRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes); + ::mlir::Type outRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes); + + inOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outRawTypes[0] = type; + } + result.addTypes(outTypes); + if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UIToFPOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIn().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOut().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void UIToFPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::UIToFPOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::XOrIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +XOrIOpGenericAdaptorBase::XOrIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.xori", odsAttrs.getContext()); +} + +XOrIOpGenericAdaptorBase::XOrIOpGenericAdaptorBase(XOrIOp op) : XOrIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair XOrIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr XOrIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +XOrIOpAdaptor::XOrIOpAdaptor(XOrIOp op) : XOrIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult XOrIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair XOrIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range XOrIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value XOrIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value XOrIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &XOrIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &XOrIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair XOrIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range XOrIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value XOrIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void XOrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void XOrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(XOrIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void XOrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void XOrIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void XOrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(XOrIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult XOrIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult XOrIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult XOrIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult XOrIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void XOrIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void XOrIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::XOrIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::SelectOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SelectOpGenericAdaptorBase::SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arith.select", odsAttrs.getContext()); +} + +SelectOpGenericAdaptorBase::SelectOpGenericAdaptorBase(SelectOp op) : SelectOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SelectOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SelectOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SelectOpAdaptor::SelectOpAdaptor(SelectOp op) : SelectOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SelectOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SelectOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SelectOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SelectOp::getCondition() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SelectOp::getTrueValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SelectOp::getFalseValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &SelectOp::getConditionMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SelectOp::getTrueValueMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SelectOp::getFalseValueMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair SelectOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SelectOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SelectOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { + odsState.addOperands(condition); + odsState.addOperands(true_value); + odsState.addOperands(false_value); + odsState.addTypes(result); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { + odsState.addOperands(condition); + odsState.addOperands(true_value); + odsState.addOperands(false_value); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) { + odsState.addOperands(condition); + odsState.addOperands(true_value); + odsState.addOperands(false_value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SelectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SelectOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArithOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {true_value, false_value, result} have same type"); + if (!(((((*this->getODSOperands(0).begin()).getType().isSignlessInteger(1)))) || (((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()))))) + return emitOpError("failed to verify that condition is scalar or has matching shape"); + return ::mlir::success(); +} + +::mlir::LogicalResult SelectOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult SelectOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[2].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +void SelectOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::SelectOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e5ed87ccc531be21e2f57051e58637dc881024c2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOps.h.inc @@ -0,0 +1,6469 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArithOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace arith { +class AddFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class AddIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class AddUIExtendedOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class AndIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class BitcastOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class CeilDivSIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class CeilDivUIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class CmpFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class CmpIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class ConstantOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class DivFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class DivSIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class DivUIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class ExtFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class ExtSIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class ExtUIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class FPToSIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class FPToUIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class FloorDivSIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class IndexCastOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class IndexCastUIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MaxNumFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MaxSIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MaxUIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MaximumFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MinNumFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MinSIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MinUIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MinimumFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MulFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MulIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MulSIExtendedOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class MulUIExtendedOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class NegFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class OrIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class RemFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class RemSIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class RemUIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class SIToFPOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class ShLIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class ShRSIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class ShRUIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class SubFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class SubIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class TruncFOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class TruncIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class UIToFPOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class XOrIOp; +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +class SelectOp; +} // namespace arith +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::AddFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AddFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AddFOpGenericAdaptorBase(AddFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class AddFOpGenericAdaptor : public detail::AddFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddFOpGenericAdaptorBase; +public: + AddFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AddFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddFOpAdaptor : public AddFOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddFOpGenericAdaptor::AddFOpGenericAdaptor; + AddFOpAdaptor(AddFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddFOpAdaptor; + template + using GenericAdaptor = AddFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.addf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::AddFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::AddIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddIOpGenericAdaptorBase(AddIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddIOpGenericAdaptor : public detail::AddIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddIOpGenericAdaptorBase; +public: + AddIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddIOpAdaptor : public AddIOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddIOpGenericAdaptor::AddIOpGenericAdaptor; + AddIOpAdaptor(AddIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddIOpAdaptor; + template + using GenericAdaptor = AddIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.addi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::AddIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::AddUIExtendedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddUIExtendedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddUIExtendedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddUIExtendedOpGenericAdaptorBase(AddUIExtendedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddUIExtendedOpGenericAdaptor : public detail::AddUIExtendedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddUIExtendedOpGenericAdaptorBase; +public: + AddUIExtendedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddUIExtendedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddUIExtendedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddUIExtendedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddUIExtendedOpAdaptor : public AddUIExtendedOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddUIExtendedOpGenericAdaptor::AddUIExtendedOpGenericAdaptor; + AddUIExtendedOpAdaptor(AddUIExtendedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddUIExtendedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddUIExtendedOpAdaptor; + template + using GenericAdaptor = AddUIExtendedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.addui_extended"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getSum(); + ::mlir::Value getOverflow(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value lhs, Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sum, ::mlir::Type overflow, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + std::optional> getShapeForUnroll(); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::AddUIExtendedOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::AndIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AndIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AndIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AndIOpGenericAdaptorBase(AndIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AndIOpGenericAdaptor : public detail::AndIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AndIOpGenericAdaptorBase; +public: + AndIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AndIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AndIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AndIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AndIOpAdaptor : public AndIOpGenericAdaptor<::mlir::ValueRange> { +public: + using AndIOpGenericAdaptor::AndIOpGenericAdaptor; + AndIOpAdaptor(AndIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AndIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::IsIdempotent, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AndIOpAdaptor; + template + using GenericAdaptor = AndIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.andi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::AndIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::BitcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitcastOpGenericAdaptorBase(BitcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitcastOpGenericAdaptor : public detail::BitcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitcastOpGenericAdaptorBase; +public: + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitcastOpAdaptor : public BitcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitcastOpGenericAdaptor::BitcastOpGenericAdaptor; + BitcastOpAdaptor(BitcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitcastOpAdaptor; + template + using GenericAdaptor = BitcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.bitcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::BitcastOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::CeilDivSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilDivSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CeilDivSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilDivSIOpGenericAdaptorBase(CeilDivSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CeilDivSIOpGenericAdaptor : public detail::CeilDivSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilDivSIOpGenericAdaptorBase; +public: + CeilDivSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilDivSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilDivSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CeilDivSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilDivSIOpAdaptor : public CeilDivSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilDivSIOpGenericAdaptor::CeilDivSIOpGenericAdaptor; + CeilDivSIOpAdaptor(CeilDivSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilDivSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilDivSIOpAdaptor; + template + using GenericAdaptor = CeilDivSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.ceildivsi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + /// Interface method for ConditionallySpeculatable. + Speculation::Speculatability getSpeculatability(); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::CeilDivSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::CeilDivUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilDivUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CeilDivUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilDivUIOpGenericAdaptorBase(CeilDivUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CeilDivUIOpGenericAdaptor : public detail::CeilDivUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilDivUIOpGenericAdaptorBase; +public: + CeilDivUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilDivUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilDivUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CeilDivUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilDivUIOpAdaptor : public CeilDivUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilDivUIOpGenericAdaptor::CeilDivUIOpGenericAdaptor; + CeilDivUIOpAdaptor(CeilDivUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilDivUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilDivUIOpAdaptor; + template + using GenericAdaptor = CeilDivUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.ceildivui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + /// Interface method for ConditionallySpeculatable. + Speculation::Speculatability getSpeculatability(); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::CeilDivUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::CmpFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CmpFOpGenericAdaptorBase { +public: + struct Properties { + using predicateTy = ::mlir::arith::CmpFPredicateAttr; + predicateTy predicate; + + auto getPredicate() { + auto &propStorage = this->predicate; + return ::llvm::cast<::mlir::arith::CmpFPredicateAttr>(propStorage); + } + void setPredicate(const ::mlir::arith::CmpFPredicateAttr &propValue) { + this->predicate = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.predicate == this->predicate && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CmpFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CmpFOpGenericAdaptorBase(CmpFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::CmpFPredicateAttr getPredicateAttr(); + ::mlir::arith::CmpFPredicate getPredicate(); +}; +} // namespace detail +template +class CmpFOpGenericAdaptor : public detail::CmpFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CmpFOpGenericAdaptorBase; +public: + CmpFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CmpFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CmpFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CmpFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CmpFOpAdaptor : public CmpFOpGenericAdaptor<::mlir::ValueRange> { +public: + using CmpFOpGenericAdaptor::CmpFOpGenericAdaptor; + CmpFOpAdaptor(CmpFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CmpFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CmpFOpAdaptor; + template + using GenericAdaptor = CmpFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("predicate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPredicateAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPredicateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.cmpf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::CmpFPredicateAttr getPredicateAttr(); + ::mlir::arith::CmpFPredicate getPredicate(); + void setPredicateAttr(::mlir::arith::CmpFPredicateAttr attr); + void setPredicate(::mlir::arith::CmpFPredicate attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpFPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::CmpFPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpFPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpFPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::CmpFPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpFPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static arith::CmpFPredicate getPredicateByName(StringRef name); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::CmpFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::CmpIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CmpIOpGenericAdaptorBase { +public: + struct Properties { + using predicateTy = ::mlir::arith::CmpIPredicateAttr; + predicateTy predicate; + + auto getPredicate() { + auto &propStorage = this->predicate; + return ::llvm::cast<::mlir::arith::CmpIPredicateAttr>(propStorage); + } + void setPredicate(const ::mlir::arith::CmpIPredicateAttr &propValue) { + this->predicate = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.predicate == this->predicate && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CmpIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CmpIOpGenericAdaptorBase(CmpIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::CmpIPredicateAttr getPredicateAttr(); + ::mlir::arith::CmpIPredicate getPredicate(); +}; +} // namespace detail +template +class CmpIOpGenericAdaptor : public detail::CmpIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CmpIOpGenericAdaptorBase; +public: + CmpIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CmpIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CmpIOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CmpIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CmpIOpAdaptor : public CmpIOpGenericAdaptor<::mlir::ValueRange> { +public: + using CmpIOpGenericAdaptor::CmpIOpGenericAdaptor; + CmpIOpAdaptor(CmpIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CmpIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CmpIOpAdaptor; + template + using GenericAdaptor = CmpIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("predicate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPredicateAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPredicateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.cmpi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::CmpIPredicateAttr getPredicateAttr(); + ::mlir::arith::CmpIPredicate getPredicate(); + void setPredicateAttr(::mlir::arith::CmpIPredicateAttr attr); + void setPredicate(::mlir::arith::CmpIPredicate attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpIPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::CmpIPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpIPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpIPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::CmpIPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpIPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static arith::CmpIPredicate getPredicateByName(StringRef name); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::CmpIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ConstantOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstantOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::TypedAttr; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::cast<::mlir::TypedAttr>(propStorage); + } + void setValue(const ::mlir::TypedAttr &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstantOpGenericAdaptorBase(ConstantOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypedAttr getValueAttr(); + ::mlir::TypedAttr getValue(); +}; +} // namespace detail +template +class ConstantOpGenericAdaptor : public detail::ConstantOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstantOpGenericAdaptorBase; +public: + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstantOpAdaptor : public ConstantOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstantOpGenericAdaptor::ConstantOpGenericAdaptor; + ConstantOpAdaptor(ConstantOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstantOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstantOpAdaptor; + template + using GenericAdaptor = ConstantOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypedAttr getValueAttr(); + ::mlir::TypedAttr getValue(); + void setValueAttr(::mlir::TypedAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::TypedAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypedAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypedAttr value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Whether the constant op can be constructed with a particular value and + /// type. + static bool isBuildableWith(Attribute value, Type type); + + /// Build the constant op with `value` and `type` if possible, otherwise + /// returns null. + static ConstantOp materialize(OpBuilder &builder, Attribute value, + Type type, Location loc); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::ConstantOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::DivFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DivFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DivFOpGenericAdaptorBase(DivFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class DivFOpGenericAdaptor : public detail::DivFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivFOpGenericAdaptorBase; +public: + DivFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DivFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivFOpAdaptor : public DivFOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivFOpGenericAdaptor::DivFOpGenericAdaptor; + DivFOpAdaptor(DivFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivFOpAdaptor; + template + using GenericAdaptor = DivFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.divf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::DivFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::DivSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivSIOpGenericAdaptorBase(DivSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DivSIOpGenericAdaptor : public detail::DivSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivSIOpGenericAdaptorBase; +public: + DivSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivSIOpAdaptor : public DivSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivSIOpGenericAdaptor::DivSIOpGenericAdaptor; + DivSIOpAdaptor(DivSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivSIOpAdaptor; + template + using GenericAdaptor = DivSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.divsi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + /// Interface method for ConditionallySpeculatable. + Speculation::Speculatability getSpeculatability(); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::DivSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::DivUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivUIOpGenericAdaptorBase(DivUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DivUIOpGenericAdaptor : public detail::DivUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivUIOpGenericAdaptorBase; +public: + DivUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivUIOpAdaptor : public DivUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivUIOpGenericAdaptor::DivUIOpGenericAdaptor; + DivUIOpAdaptor(DivUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivUIOpAdaptor; + template + using GenericAdaptor = DivUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.divui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + /// Interface method for ConditionallySpeculatable. + Speculation::Speculatability getSpeculatability(); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::DivUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ExtFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtFOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExtFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtFOpGenericAdaptorBase(ExtFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExtFOpGenericAdaptor : public detail::ExtFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtFOpGenericAdaptorBase; +public: + ExtFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtFOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExtFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtFOpAdaptor : public ExtFOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtFOpGenericAdaptor::ExtFOpGenericAdaptor; + ExtFOpAdaptor(ExtFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtFOpAdaptor; + template + using GenericAdaptor = ExtFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.extf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::ExtFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ExtSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExtSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtSIOpGenericAdaptorBase(ExtSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExtSIOpGenericAdaptor : public detail::ExtSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtSIOpGenericAdaptorBase; +public: + ExtSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExtSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtSIOpAdaptor : public ExtSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtSIOpGenericAdaptor::ExtSIOpGenericAdaptor; + ExtSIOpAdaptor(ExtSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtSIOpAdaptor; + template + using GenericAdaptor = ExtSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.extsi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::ExtSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ExtUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExtUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtUIOpGenericAdaptorBase(ExtUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExtUIOpGenericAdaptor : public detail::ExtUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtUIOpGenericAdaptorBase; +public: + ExtUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExtUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtUIOpAdaptor : public ExtUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtUIOpGenericAdaptor::ExtUIOpGenericAdaptor; + ExtUIOpAdaptor(ExtUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtUIOpAdaptor; + template + using GenericAdaptor = ExtUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.extui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::ExtUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::FPToSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FPToSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FPToSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FPToSIOpGenericAdaptorBase(FPToSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FPToSIOpGenericAdaptor : public detail::FPToSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FPToSIOpGenericAdaptorBase; +public: + FPToSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FPToSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FPToSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FPToSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FPToSIOpAdaptor : public FPToSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using FPToSIOpGenericAdaptor::FPToSIOpGenericAdaptor; + FPToSIOpAdaptor(FPToSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FPToSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = FPToSIOpAdaptor; + template + using GenericAdaptor = FPToSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.fptosi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::FPToSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::FPToUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FPToUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FPToUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FPToUIOpGenericAdaptorBase(FPToUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FPToUIOpGenericAdaptor : public detail::FPToUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FPToUIOpGenericAdaptorBase; +public: + FPToUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FPToUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FPToUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FPToUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FPToUIOpAdaptor : public FPToUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using FPToUIOpGenericAdaptor::FPToUIOpGenericAdaptor; + FPToUIOpAdaptor(FPToUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FPToUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = FPToUIOpAdaptor; + template + using GenericAdaptor = FPToUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.fptoui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::FPToUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::FloorDivSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorDivSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorDivSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorDivSIOpGenericAdaptorBase(FloorDivSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorDivSIOpGenericAdaptor : public detail::FloorDivSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorDivSIOpGenericAdaptorBase; +public: + FloorDivSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorDivSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorDivSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorDivSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorDivSIOpAdaptor : public FloorDivSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorDivSIOpGenericAdaptor::FloorDivSIOpGenericAdaptor; + FloorDivSIOpAdaptor(FloorDivSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorDivSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorDivSIOpAdaptor; + template + using GenericAdaptor = FloorDivSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.floordivsi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::FloorDivSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::IndexCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IndexCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IndexCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IndexCastOpGenericAdaptorBase(IndexCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IndexCastOpGenericAdaptor : public detail::IndexCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IndexCastOpGenericAdaptorBase; +public: + IndexCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IndexCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IndexCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IndexCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IndexCastOpAdaptor : public IndexCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using IndexCastOpGenericAdaptor::IndexCastOpGenericAdaptor; + IndexCastOpAdaptor(IndexCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IndexCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = IndexCastOpAdaptor; + template + using GenericAdaptor = IndexCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.index_cast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::IndexCastOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::IndexCastUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IndexCastUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IndexCastUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IndexCastUIOpGenericAdaptorBase(IndexCastUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IndexCastUIOpGenericAdaptor : public detail::IndexCastUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IndexCastUIOpGenericAdaptorBase; +public: + IndexCastUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IndexCastUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IndexCastUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IndexCastUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IndexCastUIOpAdaptor : public IndexCastUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using IndexCastUIOpGenericAdaptor::IndexCastUIOpGenericAdaptor; + IndexCastUIOpAdaptor(IndexCastUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IndexCastUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = IndexCastUIOpAdaptor; + template + using GenericAdaptor = IndexCastUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.index_castui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::IndexCastUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MaxNumFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxNumFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MaxNumFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxNumFOpGenericAdaptorBase(MaxNumFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class MaxNumFOpGenericAdaptor : public detail::MaxNumFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxNumFOpGenericAdaptorBase; +public: + MaxNumFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxNumFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxNumFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MaxNumFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxNumFOpAdaptor : public MaxNumFOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxNumFOpGenericAdaptor::MaxNumFOpGenericAdaptor; + MaxNumFOpAdaptor(MaxNumFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxNumFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxNumFOpAdaptor; + template + using GenericAdaptor = MaxNumFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.maxnumf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MaxNumFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MaxSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxSIOpGenericAdaptorBase(MaxSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MaxSIOpGenericAdaptor : public detail::MaxSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxSIOpGenericAdaptorBase; +public: + MaxSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxSIOpAdaptor : public MaxSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxSIOpGenericAdaptor::MaxSIOpGenericAdaptor; + MaxSIOpAdaptor(MaxSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxSIOpAdaptor; + template + using GenericAdaptor = MaxSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.maxsi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MaxSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MaxUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxUIOpGenericAdaptorBase(MaxUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MaxUIOpGenericAdaptor : public detail::MaxUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxUIOpGenericAdaptorBase; +public: + MaxUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxUIOpAdaptor : public MaxUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxUIOpGenericAdaptor::MaxUIOpGenericAdaptor; + MaxUIOpAdaptor(MaxUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxUIOpAdaptor; + template + using GenericAdaptor = MaxUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.maxui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MaxUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MaximumFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaximumFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MaximumFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MaximumFOpGenericAdaptorBase(MaximumFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class MaximumFOpGenericAdaptor : public detail::MaximumFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaximumFOpGenericAdaptorBase; +public: + MaximumFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaximumFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaximumFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MaximumFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaximumFOpAdaptor : public MaximumFOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaximumFOpGenericAdaptor::MaximumFOpGenericAdaptor; + MaximumFOpAdaptor(MaximumFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaximumFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaximumFOpAdaptor; + template + using GenericAdaptor = MaximumFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.maximumf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MaximumFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MinNumFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinNumFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MinNumFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MinNumFOpGenericAdaptorBase(MinNumFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class MinNumFOpGenericAdaptor : public detail::MinNumFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinNumFOpGenericAdaptorBase; +public: + MinNumFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinNumFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinNumFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MinNumFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinNumFOpAdaptor : public MinNumFOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinNumFOpGenericAdaptor::MinNumFOpGenericAdaptor; + MinNumFOpAdaptor(MinNumFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinNumFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinNumFOpAdaptor; + template + using GenericAdaptor = MinNumFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.minnumf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MinNumFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MinSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinSIOpGenericAdaptorBase(MinSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MinSIOpGenericAdaptor : public detail::MinSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinSIOpGenericAdaptorBase; +public: + MinSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinSIOpAdaptor : public MinSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinSIOpGenericAdaptor::MinSIOpGenericAdaptor; + MinSIOpAdaptor(MinSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinSIOpAdaptor; + template + using GenericAdaptor = MinSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.minsi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MinSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MinUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinUIOpGenericAdaptorBase(MinUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MinUIOpGenericAdaptor : public detail::MinUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinUIOpGenericAdaptorBase; +public: + MinUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinUIOpAdaptor : public MinUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinUIOpGenericAdaptor::MinUIOpGenericAdaptor; + MinUIOpAdaptor(MinUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinUIOpAdaptor; + template + using GenericAdaptor = MinUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.minui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MinUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MinimumFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinimumFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MinimumFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MinimumFOpGenericAdaptorBase(MinimumFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class MinimumFOpGenericAdaptor : public detail::MinimumFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinimumFOpGenericAdaptorBase; +public: + MinimumFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinimumFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinimumFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MinimumFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinimumFOpAdaptor : public MinimumFOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinimumFOpGenericAdaptor::MinimumFOpGenericAdaptor; + MinimumFOpAdaptor(MinimumFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinimumFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinimumFOpAdaptor; + template + using GenericAdaptor = MinimumFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.minimumf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MinimumFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MulFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MulFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MulFOpGenericAdaptorBase(MulFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class MulFOpGenericAdaptor : public detail::MulFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulFOpGenericAdaptorBase; +public: + MulFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MulFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulFOpAdaptor : public MulFOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulFOpGenericAdaptor::MulFOpGenericAdaptor; + MulFOpAdaptor(MulFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulFOpAdaptor; + template + using GenericAdaptor = MulFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.mulf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MulFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MulIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulIOpGenericAdaptorBase(MulIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulIOpGenericAdaptor : public detail::MulIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulIOpGenericAdaptorBase; +public: + MulIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulIOpAdaptor : public MulIOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulIOpGenericAdaptor::MulIOpGenericAdaptor; + MulIOpAdaptor(MulIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulIOpAdaptor; + template + using GenericAdaptor = MulIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.muli"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MulIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MulSIExtendedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulSIExtendedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulSIExtendedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulSIExtendedOpGenericAdaptorBase(MulSIExtendedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulSIExtendedOpGenericAdaptor : public detail::MulSIExtendedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulSIExtendedOpGenericAdaptorBase; +public: + MulSIExtendedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulSIExtendedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulSIExtendedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulSIExtendedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulSIExtendedOpAdaptor : public MulSIExtendedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulSIExtendedOpGenericAdaptor::MulSIExtendedOpGenericAdaptor; + MulSIExtendedOpAdaptor(MulSIExtendedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulSIExtendedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulSIExtendedOpAdaptor; + template + using GenericAdaptor = MulSIExtendedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.mulsi_extended"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getLow(); + ::mlir::Value getHigh(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type low, ::mlir::Type high, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + std::optional> getShapeForUnroll(); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MulSIExtendedOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::MulUIExtendedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulUIExtendedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulUIExtendedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulUIExtendedOpGenericAdaptorBase(MulUIExtendedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulUIExtendedOpGenericAdaptor : public detail::MulUIExtendedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulUIExtendedOpGenericAdaptorBase; +public: + MulUIExtendedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulUIExtendedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulUIExtendedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulUIExtendedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulUIExtendedOpAdaptor : public MulUIExtendedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulUIExtendedOpGenericAdaptor::MulUIExtendedOpGenericAdaptor; + MulUIExtendedOpAdaptor(MulUIExtendedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulUIExtendedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulUIExtendedOpAdaptor; + template + using GenericAdaptor = MulUIExtendedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.mului_extended"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getLow(); + ::mlir::Value getHigh(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type low, ::mlir::Type high, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + std::optional> getShapeForUnroll(); +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::MulUIExtendedOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::NegFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NegFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + NegFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + NegFOpGenericAdaptorBase(NegFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class NegFOpGenericAdaptor : public detail::NegFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NegFOpGenericAdaptorBase; +public: + NegFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NegFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NegFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + NegFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NegFOpAdaptor : public NegFOpGenericAdaptor<::mlir::ValueRange> { +public: + using NegFOpGenericAdaptor::NegFOpGenericAdaptor; + NegFOpAdaptor(NegFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NegFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NegFOpAdaptor; + template + using GenericAdaptor = NegFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.negf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::NegFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::OrIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OrIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OrIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OrIOpGenericAdaptorBase(OrIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OrIOpGenericAdaptor : public detail::OrIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OrIOpGenericAdaptorBase; +public: + OrIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OrIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OrIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OrIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OrIOpAdaptor : public OrIOpGenericAdaptor<::mlir::ValueRange> { +public: + using OrIOpGenericAdaptor::OrIOpGenericAdaptor; + OrIOpAdaptor(OrIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OrIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::IsIdempotent, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OrIOpAdaptor; + template + using GenericAdaptor = OrIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.ori"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::OrIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::RemFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RemFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RemFOpGenericAdaptorBase(RemFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class RemFOpGenericAdaptor : public detail::RemFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemFOpGenericAdaptorBase; +public: + RemFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RemFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemFOpAdaptor : public RemFOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemFOpGenericAdaptor::RemFOpGenericAdaptor; + RemFOpAdaptor(RemFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemFOpAdaptor; + template + using GenericAdaptor = RemFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.remf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::RemFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::RemSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RemSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RemSIOpGenericAdaptorBase(RemSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RemSIOpGenericAdaptor : public detail::RemSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemSIOpGenericAdaptorBase; +public: + RemSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RemSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemSIOpAdaptor : public RemSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemSIOpGenericAdaptor::RemSIOpGenericAdaptor; + RemSIOpAdaptor(RemSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemSIOpAdaptor; + template + using GenericAdaptor = RemSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.remsi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::RemSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::RemUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RemUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RemUIOpGenericAdaptorBase(RemUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RemUIOpGenericAdaptor : public detail::RemUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemUIOpGenericAdaptorBase; +public: + RemUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RemUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemUIOpAdaptor : public RemUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemUIOpGenericAdaptor::RemUIOpGenericAdaptor; + RemUIOpAdaptor(RemUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemUIOpAdaptor; + template + using GenericAdaptor = RemUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.remui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::RemUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::SIToFPOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SIToFPOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SIToFPOpGenericAdaptorBase(SIToFPOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SIToFPOpGenericAdaptor : public detail::SIToFPOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SIToFPOpGenericAdaptorBase; +public: + SIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SIToFPOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SIToFPOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SIToFPOpAdaptor : public SIToFPOpGenericAdaptor<::mlir::ValueRange> { +public: + using SIToFPOpGenericAdaptor::SIToFPOpGenericAdaptor; + SIToFPOpAdaptor(SIToFPOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SIToFPOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = SIToFPOpAdaptor; + template + using GenericAdaptor = SIToFPOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.sitofp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::SIToFPOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ShLIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShLIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShLIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShLIOpGenericAdaptorBase(ShLIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShLIOpGenericAdaptor : public detail::ShLIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShLIOpGenericAdaptorBase; +public: + ShLIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShLIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShLIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShLIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShLIOpAdaptor : public ShLIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShLIOpGenericAdaptor::ShLIOpGenericAdaptor; + ShLIOpAdaptor(ShLIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShLIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShLIOpAdaptor; + template + using GenericAdaptor = ShLIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.shli"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::ShLIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ShRSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShRSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShRSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShRSIOpGenericAdaptorBase(ShRSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShRSIOpGenericAdaptor : public detail::ShRSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShRSIOpGenericAdaptorBase; +public: + ShRSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShRSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShRSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShRSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShRSIOpAdaptor : public ShRSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShRSIOpGenericAdaptor::ShRSIOpGenericAdaptor; + ShRSIOpAdaptor(ShRSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShRSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShRSIOpAdaptor; + template + using GenericAdaptor = ShRSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.shrsi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::ShRSIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::ShRUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShRUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShRUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShRUIOpGenericAdaptorBase(ShRUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShRUIOpGenericAdaptor : public detail::ShRUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShRUIOpGenericAdaptorBase; +public: + ShRUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShRUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShRUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShRUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShRUIOpAdaptor : public ShRUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShRUIOpGenericAdaptor::ShRUIOpGenericAdaptor; + ShRUIOpAdaptor(ShRUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShRUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShRUIOpAdaptor; + template + using GenericAdaptor = ShRUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.shrui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::ShRUIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::SubFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubFOpGenericAdaptorBase(SubFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class SubFOpGenericAdaptor : public detail::SubFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubFOpGenericAdaptorBase; +public: + SubFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubFOpAdaptor : public SubFOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubFOpGenericAdaptor::SubFOpGenericAdaptor; + SubFOpAdaptor(SubFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubFOpAdaptor; + template + using GenericAdaptor = SubFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.subf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::SubFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::SubIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubIOpGenericAdaptorBase(SubIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SubIOpGenericAdaptor : public detail::SubIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubIOpGenericAdaptorBase; +public: + SubIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubIOpAdaptor : public SubIOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubIOpGenericAdaptor::SubIOpGenericAdaptor; + SubIOpAdaptor(SubIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubIOpAdaptor; + template + using GenericAdaptor = SubIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.subi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::SubIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::TruncFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncFOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TruncFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncFOpGenericAdaptorBase(TruncFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TruncFOpGenericAdaptor : public detail::TruncFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncFOpGenericAdaptorBase; +public: + TruncFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncFOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TruncFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncFOpAdaptor : public TruncFOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncFOpGenericAdaptor::TruncFOpGenericAdaptor; + TruncFOpAdaptor(TruncFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncFOpAdaptor; + template + using GenericAdaptor = TruncFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.truncf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::TruncFOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::TruncIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TruncIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncIOpGenericAdaptorBase(TruncIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TruncIOpGenericAdaptor : public detail::TruncIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncIOpGenericAdaptorBase; +public: + TruncIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TruncIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncIOpAdaptor : public TruncIOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncIOpGenericAdaptor::TruncIOpGenericAdaptor; + TruncIOpAdaptor(TruncIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncIOpAdaptor; + template + using GenericAdaptor = TruncIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.trunci"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::TruncIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::UIToFPOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UIToFPOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UIToFPOpGenericAdaptorBase(UIToFPOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UIToFPOpGenericAdaptor : public detail::UIToFPOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UIToFPOpGenericAdaptorBase; +public: + UIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UIToFPOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UIToFPOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UIToFPOpAdaptor : public UIToFPOpGenericAdaptor<::mlir::ValueRange> { +public: + using UIToFPOpGenericAdaptor::UIToFPOpGenericAdaptor; + UIToFPOpAdaptor(UIToFPOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UIToFPOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::CastOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable> { +public: + using Op::Op; + using Op::print; + using Adaptor = UIToFPOpAdaptor; + template + using GenericAdaptor = UIToFPOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.uitofp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::UIToFPOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::XOrIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XOrIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XOrIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XOrIOpGenericAdaptorBase(XOrIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XOrIOpGenericAdaptor : public detail::XOrIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XOrIOpGenericAdaptorBase; +public: + XOrIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XOrIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XOrIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XOrIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XOrIOpAdaptor : public XOrIOpGenericAdaptor<::mlir::ValueRange> { +public: + using XOrIOpGenericAdaptor::XOrIOpGenericAdaptor; + XOrIOpAdaptor(XOrIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XOrIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XOrIOpAdaptor; + template + using GenericAdaptor = XOrIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.xori"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::XOrIOp) + +namespace mlir { +namespace arith { + +//===----------------------------------------------------------------------===// +// ::mlir::arith::SelectOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectOpGenericAdaptorBase(SelectOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SelectOpGenericAdaptor : public detail::SelectOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectOpGenericAdaptorBase; +public: + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + ValueT getTrueValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getFalseValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectOpAdaptor : public SelectOpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectOpGenericAdaptor::SelectOpGenericAdaptor; + SelectOpAdaptor(SelectOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectOpAdaptor; + template + using GenericAdaptor = SelectOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arith.select"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCondition(); + ::mlir::Value getTrueValue(); + ::mlir::Value getFalseValue(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::OpOperand &getTrueValueMutable(); + ::mlir::OpOperand &getFalseValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::SelectOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsAttributes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsAttributes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..3e293b27f71125b34dcc60f79bfa72f0e3e0f6c7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsAttributes.cpp.inc @@ -0,0 +1,150 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::arith::FastMathFlagsAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::arith::FastMathFlagsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::arith::FastMathFlagsAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::arith::FastMathFlagsAttr>([&](auto t) { + printer << ::mlir::arith::FastMathFlagsAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace arith { +namespace detail { +struct FastMathFlagsAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::arith::FastMathFlags>; + FastMathFlagsAttrStorage(::mlir::arith::FastMathFlags value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static FastMathFlagsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) FastMathFlagsAttrStorage(std::move(value)); + } + + ::mlir::arith::FastMathFlags value; +}; +} // namespace detail +FastMathFlagsAttr FastMathFlagsAttr::get(::mlir::MLIRContext *context, ::mlir::arith::FastMathFlags value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute FastMathFlagsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::arith::FastMathFlags> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::arith::FastMathFlags> { + ::mlir::arith::FastMathFlags flags = {}; + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + do { + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::arith::symbolizeFastMathFlags(enumKeyword); + if (!maybeEnum) { + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::arith::FastMathFlags" << " to be one of: " << "none" << ", " << "reassoc" << ", " << "nnan" << ", " << "ninf" << ", " << "nsz" << ", " << "arcp" << ", " << "contract" << ", " << "afn" << ", " << "fast")}; + } + flags = flags | *maybeEnum; + } while(::mlir::succeeded(odsParser.parseOptionalComma())); + return flags; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse Arith_FastMathAttr parameter 'value' which is to be a `::mlir::arith::FastMathFlags`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return FastMathFlagsAttr::get(odsParser.getContext(), + ::mlir::arith::FastMathFlags((*_result_value))); +} + +void FastMathFlagsAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyFastMathFlags(getValue()); + odsPrinter << ">"; +} + +::mlir::arith::FastMathFlags FastMathFlagsAttr::getValue() const { + return getImpl()->value; +} + +} // namespace arith +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::FastMathFlagsAttr) +namespace mlir { +namespace arith { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute ArithDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void ArithDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace arith +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsAttributes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsAttributes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..8bb4984c126ad907378dbf11a9ded0ed06ea7d6f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsAttributes.h.inc @@ -0,0 +1,40 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace arith { +class FastMathFlagsAttr; +namespace detail { +struct FastMathFlagsAttrStorage; +} // namespace detail +class FastMathFlagsAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static FastMathFlagsAttr get(::mlir::MLIRContext *context, ::mlir::arith::FastMathFlags value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"fastmath"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::arith::FastMathFlags getValue() const; +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::FastMathFlagsAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..7fba274404970ae4189e318362a602841beb0ebb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArithBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ArithDialect) +namespace mlir { +namespace arith { + +ArithDialect::ArithDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +ArithDialect::~ArithDialect() = default; + +} // namespace arith +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..8379e7e119737806405e7751064a7b6ec866f94d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsDialect.h.inc @@ -0,0 +1,41 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArithBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace arith { + +class ArithDialect : public ::mlir::Dialect { + explicit ArithDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~ArithDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("arith"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Materialize a single constant operation from a given attribute value with + /// the desired resultant type. + ::mlir::Operation *materializeConstant(::mlir::OpBuilder &builder, + ::mlir::Attribute value, + ::mlir::Type type, + ::mlir::Location loc) override; +}; +} // namespace arith +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arith::ArithDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..ef78e5b336d7c72f07c532f3427fe945e8176b6b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsEnums.cpp.inc @@ -0,0 +1,301 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArithBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace arith { +::llvm::StringRef stringifyCmpFPredicate(CmpFPredicate val) { + switch (val) { + case CmpFPredicate::AlwaysFalse: return "false"; + case CmpFPredicate::OEQ: return "oeq"; + case CmpFPredicate::OGT: return "ogt"; + case CmpFPredicate::OGE: return "oge"; + case CmpFPredicate::OLT: return "olt"; + case CmpFPredicate::OLE: return "ole"; + case CmpFPredicate::ONE: return "one"; + case CmpFPredicate::ORD: return "ord"; + case CmpFPredicate::UEQ: return "ueq"; + case CmpFPredicate::UGT: return "ugt"; + case CmpFPredicate::UGE: return "uge"; + case CmpFPredicate::ULT: return "ult"; + case CmpFPredicate::ULE: return "ule"; + case CmpFPredicate::UNE: return "une"; + case CmpFPredicate::UNO: return "uno"; + case CmpFPredicate::AlwaysTrue: return "true"; + } + return ""; +} + +::std::optional symbolizeCmpFPredicate(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("false", CmpFPredicate::AlwaysFalse) + .Case("oeq", CmpFPredicate::OEQ) + .Case("ogt", CmpFPredicate::OGT) + .Case("oge", CmpFPredicate::OGE) + .Case("olt", CmpFPredicate::OLT) + .Case("ole", CmpFPredicate::OLE) + .Case("one", CmpFPredicate::ONE) + .Case("ord", CmpFPredicate::ORD) + .Case("ueq", CmpFPredicate::UEQ) + .Case("ugt", CmpFPredicate::UGT) + .Case("uge", CmpFPredicate::UGE) + .Case("ult", CmpFPredicate::ULT) + .Case("ule", CmpFPredicate::ULE) + .Case("une", CmpFPredicate::UNE) + .Case("uno", CmpFPredicate::UNO) + .Case("true", CmpFPredicate::AlwaysTrue) + .Default(::std::nullopt); +} +::std::optional symbolizeCmpFPredicate(uint64_t value) { + switch (value) { + case 0: return CmpFPredicate::AlwaysFalse; + case 1: return CmpFPredicate::OEQ; + case 2: return CmpFPredicate::OGT; + case 3: return CmpFPredicate::OGE; + case 4: return CmpFPredicate::OLT; + case 5: return CmpFPredicate::OLE; + case 6: return CmpFPredicate::ONE; + case 7: return CmpFPredicate::ORD; + case 8: return CmpFPredicate::UEQ; + case 9: return CmpFPredicate::UGT; + case 10: return CmpFPredicate::UGE; + case 11: return CmpFPredicate::ULT; + case 12: return CmpFPredicate::ULE; + case 13: return CmpFPredicate::UNE; + case 14: return CmpFPredicate::UNO; + case 15: return CmpFPredicate::AlwaysTrue; + default: return ::std::nullopt; + } +} + +bool CmpFPredicateAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 7)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 8)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 9)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 10)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 11)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 12)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 13)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 14)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 15))); +} +CmpFPredicateAttr CmpFPredicateAttr::get(::mlir::MLIRContext *context, CmpFPredicate val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +CmpFPredicate CmpFPredicateAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace arith +} // namespace mlir + +namespace mlir { +namespace arith { +::llvm::StringRef stringifyCmpIPredicate(CmpIPredicate val) { + switch (val) { + case CmpIPredicate::eq: return "eq"; + case CmpIPredicate::ne: return "ne"; + case CmpIPredicate::slt: return "slt"; + case CmpIPredicate::sle: return "sle"; + case CmpIPredicate::sgt: return "sgt"; + case CmpIPredicate::sge: return "sge"; + case CmpIPredicate::ult: return "ult"; + case CmpIPredicate::ule: return "ule"; + case CmpIPredicate::ugt: return "ugt"; + case CmpIPredicate::uge: return "uge"; + } + return ""; +} + +::std::optional symbolizeCmpIPredicate(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("eq", CmpIPredicate::eq) + .Case("ne", CmpIPredicate::ne) + .Case("slt", CmpIPredicate::slt) + .Case("sle", CmpIPredicate::sle) + .Case("sgt", CmpIPredicate::sgt) + .Case("sge", CmpIPredicate::sge) + .Case("ult", CmpIPredicate::ult) + .Case("ule", CmpIPredicate::ule) + .Case("ugt", CmpIPredicate::ugt) + .Case("uge", CmpIPredicate::uge) + .Default(::std::nullopt); +} +::std::optional symbolizeCmpIPredicate(uint64_t value) { + switch (value) { + case 0: return CmpIPredicate::eq; + case 1: return CmpIPredicate::ne; + case 2: return CmpIPredicate::slt; + case 3: return CmpIPredicate::sle; + case 4: return CmpIPredicate::sgt; + case 5: return CmpIPredicate::sge; + case 6: return CmpIPredicate::ult; + case 7: return CmpIPredicate::ule; + case 8: return CmpIPredicate::ugt; + case 9: return CmpIPredicate::uge; + default: return ::std::nullopt; + } +} + +bool CmpIPredicateAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 7)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 8)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 9))); +} +CmpIPredicateAttr CmpIPredicateAttr::get(::mlir::MLIRContext *context, CmpIPredicate val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +CmpIPredicate CmpIPredicateAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace arith +} // namespace mlir + +namespace mlir { +namespace arith { +::llvm::StringRef stringifyAtomicRMWKind(AtomicRMWKind val) { + switch (val) { + case AtomicRMWKind::addf: return "addf"; + case AtomicRMWKind::addi: return "addi"; + case AtomicRMWKind::assign: return "assign"; + case AtomicRMWKind::maximumf: return "maximumf"; + case AtomicRMWKind::maxs: return "maxs"; + case AtomicRMWKind::maxu: return "maxu"; + case AtomicRMWKind::minimumf: return "minimumf"; + case AtomicRMWKind::mins: return "mins"; + case AtomicRMWKind::minu: return "minu"; + case AtomicRMWKind::mulf: return "mulf"; + case AtomicRMWKind::muli: return "muli"; + case AtomicRMWKind::ori: return "ori"; + case AtomicRMWKind::andi: return "andi"; + case AtomicRMWKind::maxnumf: return "maxnumf"; + case AtomicRMWKind::minnumf: return "minnumf"; + } + return ""; +} + +::std::optional symbolizeAtomicRMWKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("addf", AtomicRMWKind::addf) + .Case("addi", AtomicRMWKind::addi) + .Case("assign", AtomicRMWKind::assign) + .Case("maximumf", AtomicRMWKind::maximumf) + .Case("maxs", AtomicRMWKind::maxs) + .Case("maxu", AtomicRMWKind::maxu) + .Case("minimumf", AtomicRMWKind::minimumf) + .Case("mins", AtomicRMWKind::mins) + .Case("minu", AtomicRMWKind::minu) + .Case("mulf", AtomicRMWKind::mulf) + .Case("muli", AtomicRMWKind::muli) + .Case("ori", AtomicRMWKind::ori) + .Case("andi", AtomicRMWKind::andi) + .Case("maxnumf", AtomicRMWKind::maxnumf) + .Case("minnumf", AtomicRMWKind::minnumf) + .Default(::std::nullopt); +} +::std::optional symbolizeAtomicRMWKind(uint64_t value) { + switch (value) { + case 0: return AtomicRMWKind::addf; + case 1: return AtomicRMWKind::addi; + case 2: return AtomicRMWKind::assign; + case 3: return AtomicRMWKind::maximumf; + case 4: return AtomicRMWKind::maxs; + case 5: return AtomicRMWKind::maxu; + case 6: return AtomicRMWKind::minimumf; + case 7: return AtomicRMWKind::mins; + case 8: return AtomicRMWKind::minu; + case 9: return AtomicRMWKind::mulf; + case 10: return AtomicRMWKind::muli; + case 11: return AtomicRMWKind::ori; + case 12: return AtomicRMWKind::andi; + case 13: return AtomicRMWKind::maxnumf; + case 14: return AtomicRMWKind::minnumf; + default: return ::std::nullopt; + } +} + +bool AtomicRMWKindAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 7)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 8)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 9)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 10)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 11)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 12)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 13)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 14))); +} +AtomicRMWKindAttr AtomicRMWKindAttr::get(::mlir::MLIRContext *context, AtomicRMWKind val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +AtomicRMWKind AtomicRMWKindAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace arith +} // namespace mlir + +namespace mlir { +namespace arith { +std::string stringifyFastMathFlags(FastMathFlags symbol) { + auto val = static_cast(symbol); + assert(127u == (127u | val) && "invalid bits set in bit enum"); + // Special case for all bits unset. + if (val == 0) return "none"; + + ::llvm::SmallVector<::llvm::StringRef, 2> strs; + // Print bit enum groups before individual bits + + if (127u == (127u & val)) { + strs.push_back("fast"); + val &= ~static_cast(127); + } + + if (1u == (1u & val)) + strs.push_back("reassoc"); + + if (2u == (2u & val)) + strs.push_back("nnan"); + + if (4u == (4u & val)) + strs.push_back("ninf"); + + if (8u == (8u & val)) + strs.push_back("nsz"); + + if (16u == (16u & val)) + strs.push_back("arcp"); + + if (32u == (32u & val)) + strs.push_back("contract"); + + if (64u == (64u & val)) + strs.push_back("afn"); + return ::llvm::join(strs, ","); +} + +::std::optional symbolizeFastMathFlags(::llvm::StringRef str) { + // Special case for all bits unset. + if (str == "none") return FastMathFlags::none; + + ::llvm::SmallVector<::llvm::StringRef, 2> symbols; + str.split(symbols, ","); + + uint32_t val = 0; + for (auto symbol : symbols) { + auto bit = llvm::StringSwitch<::std::optional>(symbol.trim()) + .Case("reassoc", 1) + .Case("nnan", 2) + .Case("ninf", 4) + .Case("nsz", 8) + .Case("arcp", 16) + .Case("contract", 32) + .Case("afn", 64) + .Case("fast", 127) + .Default(::std::nullopt); + if (bit) { val |= *bit; } else { return ::std::nullopt; } + } + return static_cast(val); +} + +::std::optional symbolizeFastMathFlags(uint32_t value) { + // Special case for all bits unset. + if (value == 0) return FastMathFlags::none; + + if (value & ~static_cast(127u)) return std::nullopt; + return static_cast(value); +} +} // namespace arith +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..cb2a3ee777328f39c99ccfd82b6edfcc3ee4206b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc @@ -0,0 +1,433 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArithBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace arith { +// allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 +enum class CmpFPredicate : uint64_t { + AlwaysFalse = 0, + OEQ = 1, + OGT = 2, + OGE = 3, + OLT = 4, + OLE = 5, + ONE = 6, + ORD = 7, + UEQ = 8, + UGT = 9, + UGE = 10, + ULT = 11, + ULE = 12, + UNE = 13, + UNO = 14, + AlwaysTrue = 15, +}; + +::std::optional symbolizeCmpFPredicate(uint64_t); +::llvm::StringRef stringifyCmpFPredicate(CmpFPredicate); +::std::optional symbolizeCmpFPredicate(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForCmpFPredicate() { + return 15; +} + + +inline ::llvm::StringRef stringifyEnum(CmpFPredicate enumValue) { + return stringifyCmpFPredicate(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeCmpFPredicate(str); +} + +class CmpFPredicateAttr : public ::mlir::IntegerAttr { +public: + using ValueType = CmpFPredicate; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static CmpFPredicateAttr get(::mlir::MLIRContext *context, CmpFPredicate val); + CmpFPredicate getValue() const; +}; +} // namespace arith +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::arith::CmpFPredicate, ::mlir::arith::CmpFPredicate> { + template + static FailureOr<::mlir::arith::CmpFPredicate> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15"); + + // Symbolize the keyword. + if (::std::optional<::mlir::arith::CmpFPredicate> attr = ::mlir::arith::symbolizeEnum<::mlir::arith::CmpFPredicate>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::arith::CmpFPredicate value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::arith::CmpFPredicate> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::arith::CmpFPredicate getEmptyKey() { + return static_cast<::mlir::arith::CmpFPredicate>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::arith::CmpFPredicate getTombstoneKey() { + return static_cast<::mlir::arith::CmpFPredicate>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::arith::CmpFPredicate &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::arith::CmpFPredicate &lhs, const ::mlir::arith::CmpFPredicate &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace arith { +// allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 +enum class CmpIPredicate : uint64_t { + eq = 0, + ne = 1, + slt = 2, + sle = 3, + sgt = 4, + sge = 5, + ult = 6, + ule = 7, + ugt = 8, + uge = 9, +}; + +::std::optional symbolizeCmpIPredicate(uint64_t); +::llvm::StringRef stringifyCmpIPredicate(CmpIPredicate); +::std::optional symbolizeCmpIPredicate(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForCmpIPredicate() { + return 9; +} + + +inline ::llvm::StringRef stringifyEnum(CmpIPredicate enumValue) { + return stringifyCmpIPredicate(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeCmpIPredicate(str); +} + +class CmpIPredicateAttr : public ::mlir::IntegerAttr { +public: + using ValueType = CmpIPredicate; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static CmpIPredicateAttr get(::mlir::MLIRContext *context, CmpIPredicate val); + CmpIPredicate getValue() const; +}; +} // namespace arith +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::arith::CmpIPredicate, ::mlir::arith::CmpIPredicate> { + template + static FailureOr<::mlir::arith::CmpIPredicate> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9"); + + // Symbolize the keyword. + if (::std::optional<::mlir::arith::CmpIPredicate> attr = ::mlir::arith::symbolizeEnum<::mlir::arith::CmpIPredicate>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::arith::CmpIPredicate value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::arith::CmpIPredicate> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::arith::CmpIPredicate getEmptyKey() { + return static_cast<::mlir::arith::CmpIPredicate>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::arith::CmpIPredicate getTombstoneKey() { + return static_cast<::mlir::arith::CmpIPredicate>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::arith::CmpIPredicate &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::arith::CmpIPredicate &lhs, const ::mlir::arith::CmpIPredicate &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace arith { +// allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 +enum class AtomicRMWKind : uint64_t { + addf = 0, + addi = 1, + assign = 2, + maximumf = 3, + maxs = 4, + maxu = 5, + minimumf = 6, + mins = 7, + minu = 8, + mulf = 9, + muli = 10, + ori = 11, + andi = 12, + maxnumf = 13, + minnumf = 14, +}; + +::std::optional symbolizeAtomicRMWKind(uint64_t); +::llvm::StringRef stringifyAtomicRMWKind(AtomicRMWKind); +::std::optional symbolizeAtomicRMWKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForAtomicRMWKind() { + return 14; +} + + +inline ::llvm::StringRef stringifyEnum(AtomicRMWKind enumValue) { + return stringifyAtomicRMWKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeAtomicRMWKind(str); +} + +class AtomicRMWKindAttr : public ::mlir::IntegerAttr { +public: + using ValueType = AtomicRMWKind; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static AtomicRMWKindAttr get(::mlir::MLIRContext *context, AtomicRMWKind val); + AtomicRMWKind getValue() const; +}; +} // namespace arith +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::arith::AtomicRMWKind, ::mlir::arith::AtomicRMWKind> { + template + static FailureOr<::mlir::arith::AtomicRMWKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14"); + + // Symbolize the keyword. + if (::std::optional<::mlir::arith::AtomicRMWKind> attr = ::mlir::arith::symbolizeEnum<::mlir::arith::AtomicRMWKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::arith::AtomicRMWKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::arith::AtomicRMWKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::arith::AtomicRMWKind getEmptyKey() { + return static_cast<::mlir::arith::AtomicRMWKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::arith::AtomicRMWKind getTombstoneKey() { + return static_cast<::mlir::arith::AtomicRMWKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::arith::AtomicRMWKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::arith::AtomicRMWKind &lhs, const ::mlir::arith::AtomicRMWKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace arith { +// Floating point fast math flags +enum class FastMathFlags : uint32_t { + none = 0, + reassoc = 1, + nnan = 2, + ninf = 4, + nsz = 8, + arcp = 16, + contract = 32, + afn = 64, + fast = 127, +}; + +::std::optional symbolizeFastMathFlags(uint32_t); +std::string stringifyFastMathFlags(FastMathFlags); +::std::optional symbolizeFastMathFlags(::llvm::StringRef); + +inline constexpr FastMathFlags operator|(FastMathFlags a, FastMathFlags b) { + return static_cast(static_cast(a) | static_cast(b)); +} +inline constexpr FastMathFlags operator&(FastMathFlags a, FastMathFlags b) { + return static_cast(static_cast(a) & static_cast(b)); +} +inline constexpr FastMathFlags operator^(FastMathFlags a, FastMathFlags b) { + return static_cast(static_cast(a) ^ static_cast(b)); +} +inline constexpr FastMathFlags operator~(FastMathFlags bits) { + // Ensure only bits that can be present in the enum are set + return static_cast(~static_cast(bits) & static_cast(127u)); +} +inline constexpr bool bitEnumContainsAll(FastMathFlags bits, FastMathFlags bit) { + return (bits & bit) == bit; +} +inline constexpr bool bitEnumContainsAny(FastMathFlags bits, FastMathFlags bit) { + return (static_cast(bits) & static_cast(bit)) != 0; +} +inline constexpr FastMathFlags bitEnumClear(FastMathFlags bits, FastMathFlags bit) { + return bits & ~bit; +} +inline constexpr FastMathFlags bitEnumSet(FastMathFlags bits, FastMathFlags bit, /*optional*/bool value=true) { + return value ? (bits | bit) : bitEnumClear(bits, bit); +} + +inline std::string stringifyEnum(FastMathFlags enumValue) { + return stringifyFastMathFlags(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeFastMathFlags(str); +} +} // namespace arith +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::arith::FastMathFlags, ::mlir::arith::FastMathFlags> { + template + static FailureOr<::mlir::arith::FastMathFlags> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Floating point fast math flags"); + + // Symbolize the keyword. + if (::std::optional<::mlir::arith::FastMathFlags> attr = ::mlir::arith::symbolizeEnum<::mlir::arith::FastMathFlags>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Floating point fast math flags specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::arith::FastMathFlags value) { + auto valueStr = stringifyEnum(value); + switch (value) { + case ::mlir::arith::FastMathFlags::fast: + return p << valueStr; + default: + break; + } + auto underlyingValue = static_cast>(value); + if (underlyingValue && !llvm::has_single_bit(underlyingValue)) + return p << '"' << valueStr << '"'; + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::arith::FastMathFlags> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::arith::FastMathFlags getEmptyKey() { + return static_cast<::mlir::arith::FastMathFlags>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::arith::FastMathFlags getTombstoneKey() { + return static_cast<::mlir::arith::FastMathFlags>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::arith::FastMathFlags &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::arith::FastMathFlags &lhs, const ::mlir::arith::FastMathFlags &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..ce938a408310fded88f6efcc457312399bbb69aa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.cpp.inc @@ -0,0 +1,17 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Returns a FastMathFlagsAttr attribute for the operation +FastMathFlagsAttr mlir::arith::ArithFastMathInterface::getFastMathFlagsAttr() { + return getImpl()->getFastMathFlagsAttr(getImpl(), getOperation()); + } +/// Returns the name of the FastMathFlagsAttr attribute +/// for the operation +StringRef mlir::arith::ArithFastMathInterface::getFastMathAttrName() { + return getImpl()->getFastMathAttrName(); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..72391e8f27ee2cbd8d8f6e289aa64cb7b4479bfc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.h.inc @@ -0,0 +1,104 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace arith { +class ArithFastMathInterface; +namespace detail { +struct ArithFastMathInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + FastMathFlagsAttr (*getFastMathFlagsAttr)(const Concept *impl, ::mlir::Operation *); + StringRef (*getFastMathAttrName)(); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::arith::ArithFastMathInterface; + Model() : Concept{getFastMathFlagsAttr, getFastMathAttrName} {} + + static inline FastMathFlagsAttr getFastMathFlagsAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline StringRef getFastMathAttrName(); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::arith::ArithFastMathInterface; + FallbackModel() : Concept{getFastMathFlagsAttr, getFastMathAttrName} {} + + static inline FastMathFlagsAttr getFastMathFlagsAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline StringRef getFastMathAttrName(); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + FastMathFlagsAttr getFastMathFlagsAttr(::mlir::Operation *tablegen_opaque_val) const; + static StringRef getFastMathAttrName(); + }; +};template +struct ArithFastMathInterfaceTrait; + +} // namespace detail +class ArithFastMathInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::ArithFastMathInterfaceTrait {}; + /// Returns a FastMathFlagsAttr attribute for the operation + FastMathFlagsAttr getFastMathFlagsAttr(); + /// Returns the name of the FastMathFlagsAttr attribute + /// for the operation + StringRef getFastMathAttrName(); +}; +namespace detail { + template + struct ArithFastMathInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns a FastMathFlagsAttr attribute for the operation + FastMathFlagsAttr getFastMathFlagsAttr() { + ConcreteOp op = cast(this->getOperation()); + return op.getFastmathAttr(); + } + /// Returns the name of the FastMathFlagsAttr attribute + /// for the operation + static StringRef getFastMathAttrName() { + return "fastmath"; + } + }; +}// namespace detail +} // namespace arith +} // namespace mlir +namespace mlir { +namespace arith { +template +FastMathFlagsAttr detail::ArithFastMathInterfaceInterfaceTraits::Model::getFastMathFlagsAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getFastMathFlagsAttr(); +} +template +StringRef detail::ArithFastMathInterfaceInterfaceTraits::Model::getFastMathAttrName() { + return ConcreteOp::getFastMathAttrName(); +} +template +FastMathFlagsAttr detail::ArithFastMathInterfaceInterfaceTraits::FallbackModel::getFastMathFlagsAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getFastMathFlagsAttr(tablegen_opaque_val); +} +template +StringRef detail::ArithFastMathInterfaceInterfaceTraits::FallbackModel::getFastMathAttrName() { + return ConcreteOp::getFastMathAttrName(); +} +template +FastMathFlagsAttr detail::ArithFastMathInterfaceInterfaceTraits::ExternalModel::getFastMathFlagsAttr(::mlir::Operation *tablegen_opaque_val) const { +ConcreteOp op = cast(this->getOperation()); + return op.getFastmathAttr(); +} +template +StringRef detail::ArithFastMathInterfaceInterfaceTraits::ExternalModel::getFastMathAttrName() { +return "fastmath"; +} +} // namespace arith +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/BufferDeallocationOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/BufferDeallocationOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..16cec1a82b5c86c01bf0863008634aac86f2bdbe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/BufferDeallocationOpInterfaceImpl.h @@ -0,0 +1,22 @@ +//===- BufferDeallocationOpInterfaceImpl.h ----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARITH_TRANSFORMS_BUFFERDEALLOCATIONOPINTERFACEIMPL_H +#define MLIR_DIALECT_ARITH_TRANSFORMS_BUFFERDEALLOCATIONOPINTERFACEIMPL_H + +namespace mlir { + +class DialectRegistry; + +namespace arith { +void registerBufferDeallocationOpInterfaceExternalModels( + DialectRegistry ®istry); +} // namespace arith +} // namespace mlir + +#endif // MLIR_DIALECT_ARITH_TRANSFORMS_BUFFERDEALLOCATIONOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/BufferizableOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/BufferizableOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..241f3f7aa2799cefa1f17839064e4254e1d6ee74 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/BufferizableOpInterfaceImpl.h @@ -0,0 +1,21 @@ +//===- BufferizableOpInterfaceImpl.h - Impl. of BufferizableOpInterface ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARITH_BUFFERIZABLEOPINTERFACEIMPL_H +#define MLIR_DIALECT_ARITH_BUFFERIZABLEOPINTERFACEIMPL_H + +namespace mlir { + +class DialectRegistry; + +namespace arith { +void registerBufferizableOpInterfaceExternalModels(DialectRegistry ®istry); +} // namespace arith +} // namespace mlir + +#endif // MLIR_DIALECT_ARITH_BUFFERIZABLEOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/NarrowTypeEmulationConverter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/NarrowTypeEmulationConverter.h new file mode 100644 index 0000000000000000000000000000000000000000..528bb51b214a57e0e106127e0499329d7beed69d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/NarrowTypeEmulationConverter.h @@ -0,0 +1,31 @@ +//===- NarrowTypeEmulationConverter.h - Type Converter for NTE -----*- C++ +//-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARITH_NARROW_TYPE_EMULATION_CONVERTER_H_ +#define MLIR_DIALECT_ARITH_NARROW_TYPE_EMULATION_CONVERTER_H_ + +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir::arith { +/// Converts narrow integer or float types that are not supported +/// by the target hardware to wider types. Currently, we only +/// handle power-of-two integer types and convert them to wider +/// integers that are equal or larger than 8 bits. +class NarrowTypeEmulationConverter : public TypeConverter { +public: + explicit NarrowTypeEmulationConverter(unsigned targetBitwidth); + + unsigned getLoadStoreBitwidth() const { return loadStoreBitwidth; } + +private: + unsigned loadStoreBitwidth; +}; +} // namespace mlir::arith + +#endif // MLIR_DIALECT_ARITH_NARROW_TYPE_EMULATION_CONVERTER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..cbc6147cb81e224bcf8aba0efe621e87128f4c91 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h @@ -0,0 +1,92 @@ +//===- Passes.h - Pass Entrypoints ------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARITH_TRANSFORMS_PASSES_H_ +#define MLIR_DIALECT_ARITH_TRANSFORMS_PASSES_H_ + +#include "mlir/Pass/Pass.h" + +namespace mlir { +class DataFlowSolver; +class ConversionTarget; +class TypeConverter; + +namespace arith { + +#define GEN_PASS_DECL +#include "mlir/Dialect/Arith/Transforms/Passes.h.inc" + +class WideIntEmulationConverter; +class NarrowTypeEmulationConverter; + +/// Create a pass to bufferize arith.constant ops. +std::unique_ptr createConstantBufferizePass(uint64_t alignment = 0); + +/// Adds patterns to emulate wide Arith and Function ops over integer +/// types into supported ones. This is done by splitting original power-of-two +/// i2N integer types into two iN halves. +void populateArithWideIntEmulationPatterns( + WideIntEmulationConverter &typeConverter, RewritePatternSet &patterns); + +/// Adds patterns to emulate narrow Arith and Function ops into wide +/// supported types. Users need to add conversions about the computation +/// domain of narrow types. +void populateArithNarrowTypeEmulationPatterns( + NarrowTypeEmulationConverter &typeConverter, RewritePatternSet &patterns); + +/// Populate the type conversions needed to emulate the unsupported +/// `sourceTypes` with `destType` +void populateEmulateUnsupportedFloatsConversions(TypeConverter &converter, + ArrayRef sourceTypes, + Type targetType); + +/// Add rewrite patterns for converting operations that use illegal float types +/// to ones that use legal ones. +void populateEmulateUnsupportedFloatsPatterns(RewritePatternSet &patterns, + TypeConverter &converter); + +/// Set up a dialect conversion to reject arithmetic operations on unsupported +/// float types. +void populateEmulateUnsupportedFloatsLegality(ConversionTarget &target, + TypeConverter &converter); +/// Add patterns to expand Arith ceil/floor division ops. +void populateCeilFloorDivExpandOpsPatterns(RewritePatternSet &patterns); + +/// Add patterns to expand Arith bf16 patterns to lower level bitcasts/shifts. +void populateExpandBFloat16Patterns(RewritePatternSet &patterns); + +/// Add patterns to expand Arith ops. +void populateArithExpandOpsPatterns(RewritePatternSet &patterns); + +/// Create a pass to replace signed ops with unsigned ones where they are proven +/// equivalent. +std::unique_ptr createArithUnsignedWhenEquivalentPass(); + +/// Add patterns for int range based optimizations. +void populateIntRangeOptimizationsPatterns(RewritePatternSet &patterns, + DataFlowSolver &solver); + +/// Create a pass which do optimizations based on integer range analysis. +std::unique_ptr createIntRangeOptimizationsPass(); + +/// Add patterns for integer bitwidth narrowing. +void populateArithIntNarrowingPatterns(RewritePatternSet &patterns, + const ArithIntNarrowingOptions &options); + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/Arith/Transforms/Passes.h.inc" + +} // namespace arith +} // namespace mlir + +#endif // MLIR_DIALECT_ARITH_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..afb60bf5da19879dbbf7d2cd9cc1a54ad199028c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h.inc @@ -0,0 +1,1077 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ARITHBUFFERIZEPASS +#define GEN_PASS_DECL_ARITHEMULATEUNSUPPORTEDFLOATS +#define GEN_PASS_DECL_ARITHEMULATEWIDEINT +#define GEN_PASS_DECL_ARITHEXPANDOPSPASS +#define GEN_PASS_DECL_ARITHINTNARROWING +#define GEN_PASS_DECL_ARITHINTRANGEOPTS +#define GEN_PASS_DECL_ARITHUNSIGNEDWHENEQUIVALENT +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// ArithBufferizePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ARITHBUFFERIZEPASS +struct ArithBufferizePassOptions { + unsigned alignment = 0; +}; +std::unique_ptr<::mlir::Pass> createArithBufferizePass(); +std::unique_ptr<::mlir::Pass> createArithBufferizePass(const ArithBufferizePassOptions &options); +#undef GEN_PASS_DECL_ARITHBUFFERIZEPASS +#endif // GEN_PASS_DECL_ARITHBUFFERIZEPASS +#ifdef GEN_PASS_DEF_ARITHBUFFERIZEPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithBufferizePass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithBufferizePass(const ArithBufferizePassOptions &options); +} // namespace impl +namespace impl { + +template +class ArithBufferizePassBase : public ::mlir::OperationPass { +public: + using Base = ArithBufferizePassBase; + + ArithBufferizePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ArithBufferizePassBase(const ArithBufferizePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "arith-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Bufferize Arith dialect ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithBufferizePass"); + } + ::llvm::StringRef getName() const override { return "ArithBufferizePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithBufferizePassBase) + + ArithBufferizePassBase(const ArithBufferizePassOptions &options) : ArithBufferizePassBase() { + alignment = options.alignment; + } +protected: + ::mlir::Pass::Option alignment{*this, "alignment", ::llvm::cl::desc("Create global memrefs with a specified alignment"), ::llvm::cl::init(0)}; +private: + + friend std::unique_ptr<::mlir::Pass> createArithBufferizePass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createArithBufferizePass(const ArithBufferizePassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createArithBufferizePass() { + return impl::createArithBufferizePass(); +} + +std::unique_ptr<::mlir::Pass> createArithBufferizePass(const ArithBufferizePassOptions &options) { + return impl::createArithBufferizePass(options); +} +#undef GEN_PASS_DEF_ARITHBUFFERIZEPASS +#endif // GEN_PASS_DEF_ARITHBUFFERIZEPASS + +//===----------------------------------------------------------------------===// +// ArithEmulateUnsupportedFloats +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ARITHEMULATEUNSUPPORTEDFLOATS +struct ArithEmulateUnsupportedFloatsOptions { + ::llvm::ArrayRef sourceTypeStrs; + std::string targetTypeStr = "f32"; +}; +std::unique_ptr<::mlir::Pass> createArithEmulateUnsupportedFloats(); +std::unique_ptr<::mlir::Pass> createArithEmulateUnsupportedFloats(const ArithEmulateUnsupportedFloatsOptions &options); +#undef GEN_PASS_DECL_ARITHEMULATEUNSUPPORTEDFLOATS +#endif // GEN_PASS_DECL_ARITHEMULATEUNSUPPORTEDFLOATS +#ifdef GEN_PASS_DEF_ARITHEMULATEUNSUPPORTEDFLOATS + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithEmulateUnsupportedFloats(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithEmulateUnsupportedFloats(const ArithEmulateUnsupportedFloatsOptions &options); +} // namespace impl +namespace impl { + +template +class ArithEmulateUnsupportedFloatsBase : public ::mlir::OperationPass<> { +public: + using Base = ArithEmulateUnsupportedFloatsBase; + + ArithEmulateUnsupportedFloatsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithEmulateUnsupportedFloatsBase(const ArithEmulateUnsupportedFloatsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-emulate-unsupported-floats"); + } + ::llvm::StringRef getArgument() const override { return "arith-emulate-unsupported-floats"; } + + ::llvm::StringRef getDescription() const override { return "Emulate operations on unsupported floats with extf/truncf"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithEmulateUnsupportedFloats"); + } + ::llvm::StringRef getName() const override { return "ArithEmulateUnsupportedFloats"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithEmulateUnsupportedFloatsBase) + + ArithEmulateUnsupportedFloatsBase(const ArithEmulateUnsupportedFloatsOptions &options) : ArithEmulateUnsupportedFloatsBase() { + sourceTypeStrs = options.sourceTypeStrs; + targetTypeStr = options.targetTypeStr; + } +protected: + ::mlir::Pass::ListOption sourceTypeStrs{*this, "source-types", ::llvm::cl::desc("MLIR types without arithmetic support on a given target")}; + ::mlir::Pass::Option targetTypeStr{*this, "target-type", ::llvm::cl::desc("MLIR type to convert the unsupported source types to"), ::llvm::cl::init("f32")}; +private: + + friend std::unique_ptr<::mlir::Pass> createArithEmulateUnsupportedFloats() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createArithEmulateUnsupportedFloats(const ArithEmulateUnsupportedFloatsOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createArithEmulateUnsupportedFloats() { + return impl::createArithEmulateUnsupportedFloats(); +} + +std::unique_ptr<::mlir::Pass> createArithEmulateUnsupportedFloats(const ArithEmulateUnsupportedFloatsOptions &options) { + return impl::createArithEmulateUnsupportedFloats(options); +} +#undef GEN_PASS_DEF_ARITHEMULATEUNSUPPORTEDFLOATS +#endif // GEN_PASS_DEF_ARITHEMULATEUNSUPPORTEDFLOATS + +//===----------------------------------------------------------------------===// +// ArithEmulateWideInt +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ARITHEMULATEWIDEINT +struct ArithEmulateWideIntOptions { + unsigned widestIntSupported = 32; +}; +std::unique_ptr<::mlir::Pass> createArithEmulateWideInt(); +std::unique_ptr<::mlir::Pass> createArithEmulateWideInt(const ArithEmulateWideIntOptions &options); +#undef GEN_PASS_DECL_ARITHEMULATEWIDEINT +#endif // GEN_PASS_DECL_ARITHEMULATEWIDEINT +#ifdef GEN_PASS_DEF_ARITHEMULATEWIDEINT + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithEmulateWideInt(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithEmulateWideInt(const ArithEmulateWideIntOptions &options); +} // namespace impl +namespace impl { + +template +class ArithEmulateWideIntBase : public ::mlir::OperationPass<> { +public: + using Base = ArithEmulateWideIntBase; + + ArithEmulateWideIntBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithEmulateWideIntBase(const ArithEmulateWideIntBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-emulate-wide-int"); + } + ::llvm::StringRef getArgument() const override { return "arith-emulate-wide-int"; } + + ::llvm::StringRef getDescription() const override { return "Emulate 2*N-bit integer operations using N-bit operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithEmulateWideInt"); + } + ::llvm::StringRef getName() const override { return "ArithEmulateWideInt"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithEmulateWideIntBase) + + ArithEmulateWideIntBase(const ArithEmulateWideIntOptions &options) : ArithEmulateWideIntBase() { + widestIntSupported = options.widestIntSupported; + } +protected: + ::mlir::Pass::Option widestIntSupported{*this, "widest-int-supported", ::llvm::cl::desc("Widest integer type supported by the target"), ::llvm::cl::init(32)}; +private: + + friend std::unique_ptr<::mlir::Pass> createArithEmulateWideInt() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createArithEmulateWideInt(const ArithEmulateWideIntOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createArithEmulateWideInt() { + return impl::createArithEmulateWideInt(); +} + +std::unique_ptr<::mlir::Pass> createArithEmulateWideInt(const ArithEmulateWideIntOptions &options) { + return impl::createArithEmulateWideInt(options); +} +#undef GEN_PASS_DEF_ARITHEMULATEWIDEINT +#endif // GEN_PASS_DEF_ARITHEMULATEWIDEINT + +//===----------------------------------------------------------------------===// +// ArithExpandOpsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ARITHEXPANDOPSPASS +struct ArithExpandOpsPassOptions { + bool includeBf16 = false; +}; +std::unique_ptr<::mlir::Pass> createArithExpandOpsPass(); +std::unique_ptr<::mlir::Pass> createArithExpandOpsPass(const ArithExpandOpsPassOptions &options); +#undef GEN_PASS_DECL_ARITHEXPANDOPSPASS +#endif // GEN_PASS_DECL_ARITHEXPANDOPSPASS +#ifdef GEN_PASS_DEF_ARITHEXPANDOPSPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithExpandOpsPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithExpandOpsPass(const ArithExpandOpsPassOptions &options); +} // namespace impl +namespace impl { + +template +class ArithExpandOpsPassBase : public ::mlir::OperationPass<> { +public: + using Base = ArithExpandOpsPassBase; + + ArithExpandOpsPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithExpandOpsPassBase(const ArithExpandOpsPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-expand"); + } + ::llvm::StringRef getArgument() const override { return "arith-expand"; } + + ::llvm::StringRef getDescription() const override { return "Legalize Arith ops to be convertible to LLVM."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithExpandOpsPass"); + } + ::llvm::StringRef getName() const override { return "ArithExpandOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithExpandOpsPassBase) + + ArithExpandOpsPassBase(const ArithExpandOpsPassOptions &options) : ArithExpandOpsPassBase() { + includeBf16 = options.includeBf16; + } +protected: + ::mlir::Pass::Option includeBf16{*this, "include-bf16", ::llvm::cl::desc("Enable the BF16 expansion patterns"), ::llvm::cl::init(false)}; +private: + + friend std::unique_ptr<::mlir::Pass> createArithExpandOpsPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createArithExpandOpsPass(const ArithExpandOpsPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createArithExpandOpsPass() { + return impl::createArithExpandOpsPass(); +} + +std::unique_ptr<::mlir::Pass> createArithExpandOpsPass(const ArithExpandOpsPassOptions &options) { + return impl::createArithExpandOpsPass(options); +} +#undef GEN_PASS_DEF_ARITHEXPANDOPSPASS +#endif // GEN_PASS_DEF_ARITHEXPANDOPSPASS + +//===----------------------------------------------------------------------===// +// ArithIntNarrowing +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ARITHINTNARROWING +struct ArithIntNarrowingOptions { + ::llvm::ArrayRef bitwidthsSupported; +}; +std::unique_ptr<::mlir::Pass> createArithIntNarrowing(); +std::unique_ptr<::mlir::Pass> createArithIntNarrowing(const ArithIntNarrowingOptions &options); +#undef GEN_PASS_DECL_ARITHINTNARROWING +#endif // GEN_PASS_DECL_ARITHINTNARROWING +#ifdef GEN_PASS_DEF_ARITHINTNARROWING + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithIntNarrowing(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithIntNarrowing(const ArithIntNarrowingOptions &options); +} // namespace impl +namespace impl { + +template +class ArithIntNarrowingBase : public ::mlir::OperationPass<> { +public: + using Base = ArithIntNarrowingBase; + + ArithIntNarrowingBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithIntNarrowingBase(const ArithIntNarrowingBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-int-narrowing"); + } + ::llvm::StringRef getArgument() const override { return "arith-int-narrowing"; } + + ::llvm::StringRef getDescription() const override { return "Reduce integer operation bitwidth"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithIntNarrowing"); + } + ::llvm::StringRef getName() const override { return "ArithIntNarrowing"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithIntNarrowingBase) + + ArithIntNarrowingBase(const ArithIntNarrowingOptions &options) : ArithIntNarrowingBase() { + bitwidthsSupported = options.bitwidthsSupported; + } +protected: + ::mlir::Pass::ListOption bitwidthsSupported{*this, "int-bitwidths-supported", ::llvm::cl::desc("Integer bitwidths supported")}; +private: + + friend std::unique_ptr<::mlir::Pass> createArithIntNarrowing() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createArithIntNarrowing(const ArithIntNarrowingOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createArithIntNarrowing() { + return impl::createArithIntNarrowing(); +} + +std::unique_ptr<::mlir::Pass> createArithIntNarrowing(const ArithIntNarrowingOptions &options) { + return impl::createArithIntNarrowing(options); +} +#undef GEN_PASS_DEF_ARITHINTNARROWING +#endif // GEN_PASS_DEF_ARITHINTNARROWING + +//===----------------------------------------------------------------------===// +// ArithIntRangeOpts +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ARITHINTRANGEOPTS +std::unique_ptr<::mlir::Pass> createArithIntRangeOpts(); +#undef GEN_PASS_DECL_ARITHINTRANGEOPTS +#endif // GEN_PASS_DECL_ARITHINTRANGEOPTS +#ifdef GEN_PASS_DEF_ARITHINTRANGEOPTS + +namespace impl { + std::unique_ptr<::mlir::Pass> createArithIntRangeOpts(); +} // namespace impl +namespace impl { + +template +class ArithIntRangeOptsBase : public ::mlir::OperationPass<> { +public: + using Base = ArithIntRangeOptsBase; + + ArithIntRangeOptsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithIntRangeOptsBase(const ArithIntRangeOptsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("int-range-optimizations"); + } + ::llvm::StringRef getArgument() const override { return "int-range-optimizations"; } + + ::llvm::StringRef getDescription() const override { return "Do optimizations based on integer range analysis"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithIntRangeOpts"); + } + ::llvm::StringRef getName() const override { return "ArithIntRangeOpts"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithIntRangeOptsBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createArithIntRangeOpts() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createArithIntRangeOpts() { + return impl::createArithIntRangeOpts(); +} +#undef GEN_PASS_DEF_ARITHINTRANGEOPTS +#endif // GEN_PASS_DEF_ARITHINTRANGEOPTS + +//===----------------------------------------------------------------------===// +// ArithUnsignedWhenEquivalent +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ARITHUNSIGNEDWHENEQUIVALENT +#undef GEN_PASS_DECL_ARITHUNSIGNEDWHENEQUIVALENT +#endif // GEN_PASS_DECL_ARITHUNSIGNEDWHENEQUIVALENT +#ifdef GEN_PASS_DEF_ARITHUNSIGNEDWHENEQUIVALENT +namespace impl { + +template +class ArithUnsignedWhenEquivalentBase : public ::mlir::OperationPass<> { +public: + using Base = ArithUnsignedWhenEquivalentBase; + + ArithUnsignedWhenEquivalentBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithUnsignedWhenEquivalentBase(const ArithUnsignedWhenEquivalentBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-unsigned-when-equivalent"); + } + ::llvm::StringRef getArgument() const override { return "arith-unsigned-when-equivalent"; } + + ::llvm::StringRef getDescription() const override { return "Replace signed ops with unsigned ones where they are proven equivalent"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithUnsignedWhenEquivalent"); + } + ::llvm::StringRef getName() const override { return "ArithUnsignedWhenEquivalent"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithUnsignedWhenEquivalentBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ARITHUNSIGNEDWHENEQUIVALENT +#endif // GEN_PASS_DEF_ARITHUNSIGNEDWHENEQUIVALENT +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// ArithBufferizePass Registration +//===----------------------------------------------------------------------===// + +inline void registerArithBufferizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithBufferizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerArithBufferizePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithBufferizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// ArithEmulateUnsupportedFloats Registration +//===----------------------------------------------------------------------===// + +inline void registerArithEmulateUnsupportedFloats() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithEmulateUnsupportedFloats(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerArithEmulateUnsupportedFloatsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithEmulateUnsupportedFloats(); + }); +} + +//===----------------------------------------------------------------------===// +// ArithEmulateWideInt Registration +//===----------------------------------------------------------------------===// + +inline void registerArithEmulateWideInt() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithEmulateWideInt(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerArithEmulateWideIntPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithEmulateWideInt(); + }); +} + +//===----------------------------------------------------------------------===// +// ArithExpandOpsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerArithExpandOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithExpandOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerArithExpandOpsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithExpandOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ArithIntNarrowing Registration +//===----------------------------------------------------------------------===// + +inline void registerArithIntNarrowing() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithIntNarrowing(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerArithIntNarrowingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithIntNarrowing(); + }); +} + +//===----------------------------------------------------------------------===// +// ArithIntRangeOpts Registration +//===----------------------------------------------------------------------===// + +inline void registerArithIntRangeOpts() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithIntRangeOpts(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerArithIntRangeOptsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createArithIntRangeOpts(); + }); +} + +//===----------------------------------------------------------------------===// +// ArithUnsignedWhenEquivalent Registration +//===----------------------------------------------------------------------===// + +inline void registerArithUnsignedWhenEquivalent() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::arith::createArithUnsignedWhenEquivalentPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerArithUnsignedWhenEquivalentPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::arith::createArithUnsignedWhenEquivalentPass(); + }); +} + +//===----------------------------------------------------------------------===// +// Arith Registration +//===----------------------------------------------------------------------===// + +inline void registerArithPasses() { + registerArithBufferizePass(); + registerArithEmulateUnsupportedFloats(); + registerArithEmulateWideInt(); + registerArithExpandOpsPass(); + registerArithIntNarrowing(); + registerArithIntRangeOpts(); + registerArithUnsignedWhenEquivalent(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class ArithBufferizePassBase : public ::mlir::OperationPass { +public: + using Base = ArithBufferizePassBase; + + ArithBufferizePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ArithBufferizePassBase(const ArithBufferizePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "arith-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Bufferize Arith dialect ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithBufferizePass"); + } + ::llvm::StringRef getName() const override { return "ArithBufferizePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithBufferizePassBase) + +protected: + ::mlir::Pass::Option alignment{*this, "alignment", ::llvm::cl::desc("Create global memrefs with a specified alignment"), ::llvm::cl::init(0)}; +}; + +template +class ArithEmulateUnsupportedFloatsBase : public ::mlir::OperationPass<> { +public: + using Base = ArithEmulateUnsupportedFloatsBase; + + ArithEmulateUnsupportedFloatsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithEmulateUnsupportedFloatsBase(const ArithEmulateUnsupportedFloatsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-emulate-unsupported-floats"); + } + ::llvm::StringRef getArgument() const override { return "arith-emulate-unsupported-floats"; } + + ::llvm::StringRef getDescription() const override { return "Emulate operations on unsupported floats with extf/truncf"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithEmulateUnsupportedFloats"); + } + ::llvm::StringRef getName() const override { return "ArithEmulateUnsupportedFloats"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithEmulateUnsupportedFloatsBase) + +protected: + ::mlir::Pass::ListOption sourceTypeStrs{*this, "source-types", ::llvm::cl::desc("MLIR types without arithmetic support on a given target")}; + ::mlir::Pass::Option targetTypeStr{*this, "target-type", ::llvm::cl::desc("MLIR type to convert the unsupported source types to"), ::llvm::cl::init("f32")}; +}; + +template +class ArithEmulateWideIntBase : public ::mlir::OperationPass<> { +public: + using Base = ArithEmulateWideIntBase; + + ArithEmulateWideIntBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithEmulateWideIntBase(const ArithEmulateWideIntBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-emulate-wide-int"); + } + ::llvm::StringRef getArgument() const override { return "arith-emulate-wide-int"; } + + ::llvm::StringRef getDescription() const override { return "Emulate 2*N-bit integer operations using N-bit operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithEmulateWideInt"); + } + ::llvm::StringRef getName() const override { return "ArithEmulateWideInt"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithEmulateWideIntBase) + +protected: + ::mlir::Pass::Option widestIntSupported{*this, "widest-int-supported", ::llvm::cl::desc("Widest integer type supported by the target"), ::llvm::cl::init(32)}; +}; + +template +class ArithExpandOpsPassBase : public ::mlir::OperationPass<> { +public: + using Base = ArithExpandOpsPassBase; + + ArithExpandOpsPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithExpandOpsPassBase(const ArithExpandOpsPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-expand"); + } + ::llvm::StringRef getArgument() const override { return "arith-expand"; } + + ::llvm::StringRef getDescription() const override { return "Legalize Arith ops to be convertible to LLVM."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithExpandOpsPass"); + } + ::llvm::StringRef getName() const override { return "ArithExpandOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithExpandOpsPassBase) + +protected: + ::mlir::Pass::Option includeBf16{*this, "include-bf16", ::llvm::cl::desc("Enable the BF16 expansion patterns"), ::llvm::cl::init(false)}; +}; + +template +class ArithIntNarrowingBase : public ::mlir::OperationPass<> { +public: + using Base = ArithIntNarrowingBase; + + ArithIntNarrowingBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithIntNarrowingBase(const ArithIntNarrowingBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-int-narrowing"); + } + ::llvm::StringRef getArgument() const override { return "arith-int-narrowing"; } + + ::llvm::StringRef getDescription() const override { return "Reduce integer operation bitwidth"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithIntNarrowing"); + } + ::llvm::StringRef getName() const override { return "ArithIntNarrowing"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithIntNarrowingBase) + +protected: + ::mlir::Pass::ListOption bitwidthsSupported{*this, "int-bitwidths-supported", ::llvm::cl::desc("Integer bitwidths supported")}; +}; + +template +class ArithIntRangeOptsBase : public ::mlir::OperationPass<> { +public: + using Base = ArithIntRangeOptsBase; + + ArithIntRangeOptsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithIntRangeOptsBase(const ArithIntRangeOptsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("int-range-optimizations"); + } + ::llvm::StringRef getArgument() const override { return "int-range-optimizations"; } + + ::llvm::StringRef getDescription() const override { return "Do optimizations based on integer range analysis"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithIntRangeOpts"); + } + ::llvm::StringRef getName() const override { return "ArithIntRangeOpts"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithIntRangeOptsBase) + +protected: +}; + +template +class ArithUnsignedWhenEquivalentBase : public ::mlir::OperationPass<> { +public: + using Base = ArithUnsignedWhenEquivalentBase; + + ArithUnsignedWhenEquivalentBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ArithUnsignedWhenEquivalentBase(const ArithUnsignedWhenEquivalentBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("arith-unsigned-when-equivalent"); + } + ::llvm::StringRef getArgument() const override { return "arith-unsigned-when-equivalent"; } + + ::llvm::StringRef getDescription() const override { return "Replace signed ops with unsigned ones where they are proven equivalent"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ArithUnsignedWhenEquivalent"); + } + ::llvm::StringRef getName() const override { return "ArithUnsignedWhenEquivalent"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ArithUnsignedWhenEquivalentBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/Transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/Transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..970a52a06a11a2bcc8c5ac9377e792376a31025a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/Transforms.h @@ -0,0 +1,64 @@ +//===- Transforms.h - Arith Transforms --------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARITH_TRANSFORMS_TRANSFORMS_H +#define MLIR_DIALECT_ARITH_TRANSFORMS_TRANSFORMS_H + +#include "mlir/Interfaces/ValueBoundsOpInterface.h" +#include "mlir/Support/LogicalResult.h" + +namespace mlir { +class Location; +class OpBuilder; +class OpFoldResult; +class Value; + +namespace presburger { +enum class BoundType; +} // namespace presburger + +namespace arith { + +/// Reify a bound for the given index-typed value in terms of SSA values for +/// which `stopCondition` is met. If no stop condition is specified, reify in +/// terms of the operands of the owner op. +/// +/// By default, lower/equal bounds are closed and upper bounds are open. If +/// `closedUB` is set to "true", upper bounds are also closed. +/// +/// Example: +/// %0 = arith.addi %a, %b : index +/// %1 = arith.addi %0, %c : index +/// +/// * If `stopCondition` evaluates to "true" for %0 and %c, "%0 + %c" is an EQ +/// bound for %1. +/// * If `stopCondition` evaluates to "true" for %a, %b and %c, "%a + %b + %c" +/// is an EQ bound for %1. +/// * Otherwise, if the owners of %a, %b or %c do not implement the +/// ValueBoundsOpInterface, no bound can be computed. +FailureOr reifyIndexValueBound( + OpBuilder &b, Location loc, presburger::BoundType type, Value value, + ValueBoundsConstraintSet::StopConditionFn stopCondition = nullptr, + bool closedUB = false); + +/// Reify a bound for the specified dimension of the given shaped value in terms +/// of SSA values for which `stopCondition` is met. If no stop condition is +/// specified, reify in terms of the operands of the owner op. +/// +/// By default, lower/equal bounds are closed and upper bounds are open. If +/// `closedUB` is set to "true", upper bounds are also closed. +FailureOr reifyShapedValueDimBound( + OpBuilder &b, Location loc, presburger::BoundType type, Value value, + int64_t dim, + ValueBoundsConstraintSet::StopConditionFn stopCondition = nullptr, + bool closedUB = false); + +} // namespace arith +} // namespace mlir + +#endif // MLIR_DIALECT_ARITH_TRANSFORMS_TRANSFORMS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/WideIntEmulationConverter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/WideIntEmulationConverter.h new file mode 100644 index 0000000000000000000000000000000000000000..5dbbfedcc70eee9cc3d87f538597420693a5dc53 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Transforms/WideIntEmulationConverter.h @@ -0,0 +1,34 @@ +//===- WideIntEmulationConverter.h - Type Converter for WIE -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARITH_WIDE_INT_EMULATION_CONVERTER_H_ +#define MLIR_DIALECT_ARITH_WIDE_INT_EMULATION_CONVERTER_H_ + +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir::arith { +/// Converts integer types that are too wide for the target by splitting them in +/// two halves and thus turning into supported ones, i.e., i2*N --> iN, where N +/// is the widest integer bitwidth supported by the target. +/// Currently, we only handle power-of-two integer types and support conversions +/// of integers twice as wide as the maximum supported by the target. Wide +/// integers are represented as vectors, e.g., i64 --> vector<2xi32>, where the +/// first element is the low half of the original integer, and the second +/// element the high half. +class WideIntEmulationConverter : public TypeConverter { +public: + explicit WideIntEmulationConverter(unsigned widestIntSupportedByTarget); + + unsigned getMaxTargetIntBitWidth() const { return maxIntWidth; } + +private: + unsigned maxIntWidth; +}; +} // namespace mlir::arith + +#endif // MLIR_DIALECT_ARITH_WIDE_INT_EMULATION_CONVERTER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Utils/Utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Utils/Utils.h new file mode 100644 index 0000000000000000000000000000000000000000..62a84ee7903d76ee71c396ea83c8ac32ca46b319 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Arith/Utils/Utils.h @@ -0,0 +1,75 @@ +//===- Utils.h - General Arith transformation utilities ----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes for various transformation utilities for +// the Arith dialect. These are not passes by themselves but are used +// either by passes, optimization sequences, or in turn by other transformation +// utilities. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARITH_UTILS_UTILS_H +#define MLIR_DIALECT_ARITH_UTILS_UTILS_H + +#include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/IR/Matchers.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/IR/Value.h" + +namespace mlir { + +/// Matches a ConstantIndexOp. +detail::op_matcher matchConstantIndex(); + +llvm::SmallBitVector getPositionsOfShapeOne(unsigned rank, + ArrayRef shape); + +/// Converts an OpFoldResult to a Value. Returns the fold result if it casts to +/// a Value or creates a ConstantIndexOp if it casts to an IntegerAttribute. +/// Other attribute types are not supported. +Value getValueOrCreateConstantIndexOp(OpBuilder &b, Location loc, + OpFoldResult ofr); + +/// Similar to the other overload, but converts multiple OpFoldResults into +/// Values. +SmallVector +getValueOrCreateConstantIndexOp(OpBuilder &b, Location loc, + ArrayRef valueOrAttrVec); + +/// Create a cast from an index-like value (index or integer) to another +/// index-like value. If the value type and the target type are the same, it +/// returns the original value. +Value getValueOrCreateCastToIndexLike(OpBuilder &b, Location loc, + Type targetType, Value value); + +/// Converts a scalar value `operand` to type `toType`. If the value doesn't +/// convert, a warning will be issued and the operand is returned as is (which +/// will presumably yield a verification issue downstream). +Value convertScalarToDtype(OpBuilder &b, Location loc, Value operand, + Type toType, bool isUnsignedCast); + +/// Helper struct to build simple arithmetic quantities with minimal type +/// inference support. +struct ArithBuilder { + ArithBuilder(OpBuilder &b, Location loc) : b(b), loc(loc) {} + + Value _and(Value lhs, Value rhs); + Value add(Value lhs, Value rhs); + Value sub(Value lhs, Value rhs); + Value mul(Value lhs, Value rhs); + Value select(Value cmp, Value lhs, Value rhs); + Value sgt(Value lhs, Value rhs); + Value slt(Value lhs, Value rhs); + +private: + OpBuilder &b; + Location loc; +}; +} // namespace mlir + +#endif // MLIR_DIALECT_ARITH_UTILS_UTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..3beb9b1e2c154ba31c6ed138d8128ceea72a96d0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.cpp.inc @@ -0,0 +1,839 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmNeon.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::arm_neon::SMullOp, +::mlir::arm_neon::Sdot2dOp, +::mlir::arm_neon::SdotOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arm_neon { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmNeon0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignlessInteger(16))) || ((elementType.isSignlessInteger(32))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of 8-bit signless integer or 16-bit signless integer or 32-bit signless integer values of length 8/4/2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmNeon1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(16))) || ((elementType.isSignlessInteger(32))) || ((elementType.isSignlessInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of 16-bit signless integer or 32-bit signless integer or 64-bit signless integer values of length 8/4/2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmNeon2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of 32-bit signless integer values of length 4/2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmNeon3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of 8-bit signless integer values of length 16/8, but got " << type; + } + return ::mlir::success(); +} +} // namespace arm_neon +} // namespace mlir +namespace mlir { +namespace arm_neon { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_neon::SMullOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SMullOpGenericAdaptorBase::SMullOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_neon.intr.smull", odsAttrs.getContext()); +} + +SMullOpGenericAdaptorBase::SMullOpGenericAdaptorBase(SMullOp op) : SMullOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SMullOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SMullOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SMullOpAdaptor::SMullOpAdaptor(SMullOp op) : SMullOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SMullOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SMullOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SMullOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> SMullOp::getA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> SMullOp::getB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SMullOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SMullOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SMullOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SMullOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> SMullOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void SMullOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void SMullOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SMullOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SMullOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {a, b} have same type"); + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).scaleElementBitwidth(2), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that res has same vector shape and element bitwidth scaled by 2 as a"); + return ::mlir::success(); +} + +::mlir::LogicalResult SMullOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SMullOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand aRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> aOperands(aRawOperands); ::llvm::SMLoc aOperandsLoc; + (void)aOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bOperands(bRawOperands); ::llvm::SMLoc bOperandsLoc; + (void)bOperandsLoc; + ::mlir::Type aRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> aTypes(aRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + aOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(aRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + aRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(aOperands, aTypes, aOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bOperands, aTypes[0], bOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SMullOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getB(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getA().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SMullOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_neon +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_neon::SMullOp) + +namespace mlir { +namespace arm_neon { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_neon::Sdot2dOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Sdot2dOpGenericAdaptorBase::Sdot2dOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_neon.2d.sdot", odsAttrs.getContext()); +} + +Sdot2dOpGenericAdaptorBase::Sdot2dOpGenericAdaptorBase(Sdot2dOp op) : Sdot2dOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Sdot2dOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Sdot2dOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +Sdot2dOpAdaptor::Sdot2dOpAdaptor(Sdot2dOp op) : Sdot2dOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Sdot2dOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair Sdot2dOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Sdot2dOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> Sdot2dOp::getA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> Sdot2dOp::getB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> Sdot2dOp::getC() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &Sdot2dOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &Sdot2dOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &Sdot2dOp::getCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair Sdot2dOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Sdot2dOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> Sdot2dOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void Sdot2dOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.addTypes(res); +} + +void Sdot2dOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Sdot2dOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult Sdot2dOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {b, c} have same type"); + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {a, res} have same type"); + if (!((::llvm::cast(getA().getType()).getShape().size() == 1))) + return emitOpError("failed to verify that operand `a` should be 1-dimensional"); + if (!((::llvm::cast(getB().getType()).getShape().size() == 2))) + return emitOpError("failed to verify that operand `b` should be 2-dimensional"); + if (!((::llvm::cast(getB().getType()).getShape()[1] == 4))) + return emitOpError("failed to verify that operand `b` should have 4 columns"); + if (!((::llvm::cast(getB().getType()).getShape()[0] == ::llvm::cast(getA().getType()).getShape()[0]))) + return emitOpError("failed to verify that operand `b` should have as many rows as the size of operand `a`"); + return ::mlir::success(); +} + +::mlir::LogicalResult Sdot2dOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult Sdot2dOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand aRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> aOperands(aRawOperands); ::llvm::SMLoc aOperandsLoc; + (void)aOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bOperands(bRawOperands); ::llvm::SMLoc bOperandsLoc; + (void)bOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand cRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> cOperands(cRawOperands); ::llvm::SMLoc cOperandsLoc; + (void)cOperandsLoc; + ::mlir::Type bRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> bTypes(bRawTypes); + ::mlir::Type cRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> cTypes(cRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + aOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(aRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + cOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(cRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + bRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + cRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(aOperands, resTypes[0], aOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bOperands, bTypes, bOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(cOperands, cTypes, cOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Sdot2dOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getB(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getC(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getB().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getC().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void Sdot2dOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_neon +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_neon::Sdot2dOp) + +namespace mlir { +namespace arm_neon { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_neon::SdotOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SdotOpGenericAdaptorBase::SdotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_neon.intr.sdot", odsAttrs.getContext()); +} + +SdotOpGenericAdaptorBase::SdotOpGenericAdaptorBase(SdotOp op) : SdotOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SdotOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SdotOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SdotOpAdaptor::SdotOpAdaptor(SdotOp op) : SdotOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SdotOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SdotOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SdotOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> SdotOp::getA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> SdotOp::getB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> SdotOp::getC() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &SdotOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SdotOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SdotOp::getCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair SdotOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SdotOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> SdotOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void SdotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.addTypes(res); +} + +void SdotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SdotOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SdotOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmNeon2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {b, c} have same type"); + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {a, res} have same type"); + if (!((std::equal_to<>()(VectorType::get({::llvm::cast((*this->getODSOperands(1).begin()).getType()).getShape()[0] / 4},IntegerType::get((*this->getODSOperands(1).begin()).getType().getContext(), 32)), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that res has the same number of elements as operand b"); + return ::mlir::success(); +} + +::mlir::LogicalResult SdotOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SdotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand aRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> aOperands(aRawOperands); ::llvm::SMLoc aOperandsLoc; + (void)aOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bOperands(bRawOperands); ::llvm::SMLoc bOperandsLoc; + (void)bOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand cRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> cOperands(cRawOperands); ::llvm::SMLoc cOperandsLoc; + (void)cOperandsLoc; + ::mlir::Type bRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> bTypes(bRawTypes); + ::mlir::Type cRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> cTypes(cRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + aOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(aRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + cOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(cRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + bRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + cRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(aOperands, resTypes[0], aOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bOperands, bTypes, bOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(cOperands, cTypes, cOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SdotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getB(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getC(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getB().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getC().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SdotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_neon +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_neon::SdotOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..d81db3ae0ccf0da80549d92a0eeba49e169d915c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.h.inc @@ -0,0 +1,370 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmNeon.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace arm_neon { +class SMullOp; +} // namespace arm_neon +} // namespace mlir +namespace mlir { +namespace arm_neon { +class Sdot2dOp; +} // namespace arm_neon +} // namespace mlir +namespace mlir { +namespace arm_neon { +class SdotOp; +} // namespace arm_neon +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arm_neon { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_neon::SMullOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SMullOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SMullOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SMullOpGenericAdaptorBase(SMullOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SMullOpGenericAdaptor : public detail::SMullOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SMullOpGenericAdaptorBase; +public: + SMullOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SMullOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SMullOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SMullOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SMullOpAdaptor : public SMullOpGenericAdaptor<::mlir::ValueRange> { +public: + using SMullOpGenericAdaptor::SMullOpGenericAdaptor; + SMullOpAdaptor(SMullOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SMullOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SMullOpAdaptor; + template + using GenericAdaptor = SMullOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_neon.intr.smull"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getA(); + ::mlir::TypedValue<::mlir::VectorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_neon +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_neon::SMullOp) + +namespace mlir { +namespace arm_neon { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_neon::Sdot2dOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Sdot2dOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Sdot2dOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Sdot2dOpGenericAdaptorBase(Sdot2dOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Sdot2dOpGenericAdaptor : public detail::Sdot2dOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Sdot2dOpGenericAdaptorBase; +public: + Sdot2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Sdot2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Sdot2dOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Sdot2dOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Sdot2dOpAdaptor : public Sdot2dOpGenericAdaptor<::mlir::ValueRange> { +public: + using Sdot2dOpGenericAdaptor::Sdot2dOpGenericAdaptor; + Sdot2dOpAdaptor(Sdot2dOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Sdot2dOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Sdot2dOpAdaptor; + template + using GenericAdaptor = Sdot2dOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_neon.2d.sdot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getA(); + ::mlir::TypedValue<::mlir::VectorType> getB(); + ::mlir::TypedValue<::mlir::VectorType> getC(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static constexpr int kReductionSize = 4; +}; +} // namespace arm_neon +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_neon::Sdot2dOp) + +namespace mlir { +namespace arm_neon { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_neon::SdotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SdotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SdotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SdotOpGenericAdaptorBase(SdotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SdotOpGenericAdaptor : public detail::SdotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SdotOpGenericAdaptorBase; +public: + SdotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SdotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SdotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SdotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SdotOpAdaptor : public SdotOpGenericAdaptor<::mlir::ValueRange> { +public: + using SdotOpGenericAdaptor::SdotOpGenericAdaptor; + SdotOpAdaptor(SdotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SdotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SdotOpAdaptor; + template + using GenericAdaptor = SdotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_neon.intr.sdot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getA(); + ::mlir::TypedValue<::mlir::VectorType> getB(); + ::mlir::TypedValue<::mlir::VectorType> getC(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_neon +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_neon::SdotOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..8653293e3a286b03eefccb084ed9b97bf350fdcc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonConversions.inc @@ -0,0 +1,26 @@ +if (auto op = dyn_cast<::mlir::arm_neon::SMullOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_neon_smull, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_neon::SdotOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_neon_sdot, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..033e98e22187876ae4fc9f1f165896bb3c7f8454 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmNeon.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_neon::ArmNeonDialect) +namespace mlir { +namespace arm_neon { + +ArmNeonDialect::ArmNeonDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +ArmNeonDialect::~ArmNeonDialect() = default; + +} // namespace arm_neon +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..923d04e82f97939ead0af00d732f8c79a5960c35 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonDialect.h @@ -0,0 +1,27 @@ +//===- ArmNeonDialect.h - MLIR Dialect forArmNeon ---------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares the Target dialect for ArmNeon in MLIR. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARMNEON_ARMNEONDIALECT_H_ +#define MLIR_DIALECT_ARMNEON_ARMNEONDIALECT_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#include "mlir/Dialect/ArmNeon/ArmNeonDialect.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/ArmNeon/ArmNeon.h.inc" + +#endif // MLIR_DIALECT_ARMNEON_ARMNEONDIALECT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..f86272b0809ea9cc4a1567f1ac28ba3526d00cf0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmNeon/ArmNeonDialect.h.inc @@ -0,0 +1,26 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmNeon.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace arm_neon { + +class ArmNeonDialect : public ::mlir::Dialect { + explicit ArmNeonDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~ArmNeonDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("arm_neon"); + } +}; +} // namespace arm_neon +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_neon::ArmNeonDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..5b727032d490b5d6f3a45b09593625377d208590 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.cpp.inc @@ -0,0 +1,21 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSME.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + + +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.h new file mode 100644 index 0000000000000000000000000000000000000000..b27ceca215dad427ae2ba185afb2881a4c13e986 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.h @@ -0,0 +1,37 @@ +//===- ArmSMEDialect.h - MLIR Dialect for Arm SME ---------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares the Target dialect for ArmSME in MLIR. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARMSME_IR_ARMSME_H +#define MLIR_DIALECT_ARMSME_IR_ARMSME_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/Dialect/Vector/IR/VectorOps.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#include "mlir/Dialect/ArmSME/IR/ArmSMEEnums.h.inc" + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.h.inc" + +#include "mlir/Dialect/ArmSME/IR/ArmSMEDialect.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/ArmSME/IR/ArmSMEOps.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.h.inc" + +#endif // MLIR_DIALECT_ARMSME_IR_ARMSME_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..6d151850f32e0189b205398ca75ba81d0f252b2f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.h.inc @@ -0,0 +1,19 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSME.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..f4c73b84cef550b92e442184cc50da4a8f7377b8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.cpp.inc @@ -0,0 +1,145 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::arm_sme::TileSliceLayoutAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::arm_sme::TileSliceLayoutAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::arm_sme::TileSliceLayoutAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::arm_sme::TileSliceLayoutAttr>([&](auto t) { + printer << ::mlir::arm_sme::TileSliceLayoutAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace arm_sme { +namespace detail { +struct TileSliceLayoutAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::arm_sme::TileSliceLayout>; + TileSliceLayoutAttrStorage(::mlir::arm_sme::TileSliceLayout value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static TileSliceLayoutAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) TileSliceLayoutAttrStorage(std::move(value)); + } + + ::mlir::arm_sme::TileSliceLayout value; +}; +} // namespace detail +TileSliceLayoutAttr TileSliceLayoutAttr::get(::mlir::MLIRContext *context, ::mlir::arm_sme::TileSliceLayout value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute TileSliceLayoutAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::arm_sme::TileSliceLayout> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::arm_sme::TileSliceLayout> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::arm_sme::symbolizeTileSliceLayout(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::arm_sme::TileSliceLayout" << " to be one of: " << "horizontal" << ", " << "vertical")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ArmSME_TileSliceLayoutAttr parameter 'value' which is to be a `::mlir::arm_sme::TileSliceLayout`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return TileSliceLayoutAttr::get(odsParser.getContext(), + ::mlir::arm_sme::TileSliceLayout((*_result_value))); +} + +void TileSliceLayoutAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyTileSliceLayout(getValue()); + odsPrinter << ">"; +} + +::mlir::arm_sme::TileSliceLayout TileSliceLayoutAttr::getValue() const { + return getImpl()->value; +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::TileSliceLayoutAttr) +namespace mlir { +namespace arm_sme { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute ArmSMEDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void ArmSMEDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace arm_sme +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..0e04e2c8156f022ad1e876410adf2aa4e76143b0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.h.inc @@ -0,0 +1,40 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace arm_sme { +class TileSliceLayoutAttr; +namespace detail { +struct TileSliceLayoutAttrStorage; +} // namespace detail +class TileSliceLayoutAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TileSliceLayoutAttr get(::mlir::MLIRContext *context, ::mlir::arm_sme::TileSliceLayout value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"layout"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::arm_sme::TileSliceLayout getValue() const; +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::TileSliceLayoutAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..a237462a527460e1c48258330c37eb57892f0a5f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.cpp.inc @@ -0,0 +1,29 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSME.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::ArmSMEDialect) +namespace mlir { +namespace arm_sme { + +ArmSMEDialect::ArmSMEDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + initialize(); +} + +ArmSMEDialect::~ArmSMEDialect() = default; + +} // namespace arm_sme +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..580c51a0bb5542d96b773503e127db7db8b0600d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.h.inc @@ -0,0 +1,34 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSME.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace arm_sme { + +class ArmSMEDialect : public ::mlir::Dialect { + explicit ArmSMEDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~ArmSMEDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("arm_sme"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::ArmSMEDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..d59f11d68d91accb169577293f709719b866fa24 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.cpp.inc @@ -0,0 +1,36 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSMEOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace arm_sme { +::llvm::StringRef stringifyTileSliceLayout(TileSliceLayout val) { + switch (val) { + case TileSliceLayout::Horizontal: return "horizontal"; + case TileSliceLayout::Vertical: return "vertical"; + } + return ""; +} + +::std::optional symbolizeTileSliceLayout(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("horizontal", TileSliceLayout::Horizontal) + .Case("vertical", TileSliceLayout::Vertical) + .Default(::std::nullopt); +} +::std::optional symbolizeTileSliceLayout(uint32_t value) { + switch (value) { + case 0: return TileSliceLayout::Horizontal; + case 1: return TileSliceLayout::Vertical; + default: return ::std::nullopt; + } +} + +} // namespace arm_sme +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..5828c652ddddac65e243240d3946308e8166bf3a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.h.inc @@ -0,0 +1,90 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSMEOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace arm_sme { +// Layout of a tile slice +enum class TileSliceLayout : uint32_t { + Horizontal = 0, + Vertical = 1, +}; + +::std::optional symbolizeTileSliceLayout(uint32_t); +::llvm::StringRef stringifyTileSliceLayout(TileSliceLayout); +::std::optional symbolizeTileSliceLayout(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForTileSliceLayout() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(TileSliceLayout enumValue) { + return stringifyTileSliceLayout(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeTileSliceLayout(str); +} +} // namespace arm_sme +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::arm_sme::TileSliceLayout, ::mlir::arm_sme::TileSliceLayout> { + template + static FailureOr<::mlir::arm_sme::TileSliceLayout> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Layout of a tile slice"); + + // Symbolize the keyword. + if (::std::optional<::mlir::arm_sme::TileSliceLayout> attr = ::mlir::arm_sme::symbolizeEnum<::mlir::arm_sme::TileSliceLayout>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Layout of a tile slice specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::arm_sme::TileSliceLayout value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::arm_sme::TileSliceLayout> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::arm_sme::TileSliceLayout getEmptyKey() { + return static_cast<::mlir::arm_sme::TileSliceLayout>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::arm_sme::TileSliceLayout getTombstoneKey() { + return static_cast<::mlir::arm_sme::TileSliceLayout>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::arm_sme::TileSliceLayout &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::arm_sme::TileSliceLayout &lhs, const ::mlir::arm_sme::TileSliceLayout &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..454d1fda57b3e370e498bb3d9bdd8577b59ad823 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicConversions.inc @@ -0,0 +1,520 @@ +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1b_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1b_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1b_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1b_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1d_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1d_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1d_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1d_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1h_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1h_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1h_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1h_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1q_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1q_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1q_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1q_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1w_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1w_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_ld1w_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_ld1w_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_mopa>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_mopa, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_mopa_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_mopa_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_mops>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_mops, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_mops_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_mops_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_read_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_read_horiz, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_read_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_read_vert, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_smopa_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_smopa_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_smops_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_smops_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1b_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1b_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1b_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1b_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1d_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1d_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1d_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1d_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1h_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1h_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1h_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1h_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1q_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1q_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1q_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1q_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1w_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1w_horiz, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_st1w_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_st1w_vert, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_str>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_str, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_sumopa_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_sumopa_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_sumops_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_sumops_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_umopa_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_umopa_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_umops_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_umops_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_usmopa_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_usmopa_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_usmops_wide>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_usmops_wide, { moduleTranslation.convertType(opInst.getOperand(4).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_write_horiz>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_write_horiz, { moduleTranslation.convertType(opInst.getOperand(3).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_write_vert>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_write_vert, { moduleTranslation.convertType(opInst.getOperand(3).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_za_disable>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_za_disable, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_za_enable>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_za_enable, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sme::aarch64_sme_zero>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sme_zero, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..853049a02c7b61c6f3014daf4601eeed12c70451 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.cpp.inc @@ -0,0 +1,4819 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSMEIntrinsicOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::arm_sme::aarch64_sme_ld1b_horiz, +::mlir::arm_sme::aarch64_sme_ld1b_vert, +::mlir::arm_sme::aarch64_sme_ld1d_horiz, +::mlir::arm_sme::aarch64_sme_ld1d_vert, +::mlir::arm_sme::aarch64_sme_ld1h_horiz, +::mlir::arm_sme::aarch64_sme_ld1h_vert, +::mlir::arm_sme::aarch64_sme_ld1q_horiz, +::mlir::arm_sme::aarch64_sme_ld1q_vert, +::mlir::arm_sme::aarch64_sme_ld1w_horiz, +::mlir::arm_sme::aarch64_sme_ld1w_vert, +::mlir::arm_sme::aarch64_sme_mopa, +::mlir::arm_sme::aarch64_sme_mopa_wide, +::mlir::arm_sme::aarch64_sme_mops, +::mlir::arm_sme::aarch64_sme_mops_wide, +::mlir::arm_sme::aarch64_sme_read_horiz, +::mlir::arm_sme::aarch64_sme_read_vert, +::mlir::arm_sme::aarch64_sme_smopa_wide, +::mlir::arm_sme::aarch64_sme_smops_wide, +::mlir::arm_sme::aarch64_sme_st1b_horiz, +::mlir::arm_sme::aarch64_sme_st1b_vert, +::mlir::arm_sme::aarch64_sme_st1d_horiz, +::mlir::arm_sme::aarch64_sme_st1d_vert, +::mlir::arm_sme::aarch64_sme_st1h_horiz, +::mlir::arm_sme::aarch64_sme_st1h_vert, +::mlir::arm_sme::aarch64_sme_st1q_horiz, +::mlir::arm_sme::aarch64_sme_st1q_vert, +::mlir::arm_sme::aarch64_sme_st1w_horiz, +::mlir::arm_sme::aarch64_sme_st1w_vert, +::mlir::arm_sme::aarch64_sme_str, +::mlir::arm_sme::aarch64_sme_sumopa_wide, +::mlir::arm_sme::aarch64_sme_sumops_wide, +::mlir::arm_sme::aarch64_sme_umopa_wide, +::mlir::arm_sme::aarch64_sme_umops_wide, +::mlir::arm_sme::aarch64_sme_usmopa_wide, +::mlir::arm_sme::aarch64_sme_usmops_wide, +::mlir::arm_sme::aarch64_sme_write_horiz, +::mlir::arm_sme::aarch64_sme_write_vert, +::mlir::arm_sme::aarch64_sme_za_disable, +::mlir::arm_sme::aarch64_sme_za_enable, +::mlir::arm_sme::aarch64_sme_zero +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arm_sme { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 1)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of 1-bit signless integer values of length 16/8/4/2/1, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(32)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of 1-bit signless integer values of length 16/8/4/2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignlessInteger(16))) || ((elementType.isBF16())) || ((elementType.isF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of 8-bit signless integer or 16-bit signless integer or bfloat16 type or 16-bit float or 32-bit float or 64-bit float values of length 16/8/4/2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEIntrinsicOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 1))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignlessInteger(16))) || ((elementType.isSignlessInteger(32))) || ((elementType.isSignlessInteger(64))) || ((elementType.isSignlessInteger(128))) || ((elementType.isF16())) || ((elementType.isBF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 1)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be of ranks 1scalable vector of 8-bit signless integer or 16-bit signless integer or 32-bit signless integer or 64-bit signless integer or 128-bit signless integer or 16-bit float or bfloat16 type or 32-bit float or 64-bit float values of length 16/8/4/2/1, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEIntrinsicOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 1))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 1)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be of ranks 1scalable vector of 1-bit signless integer values of length 16/8/4/2/1, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEIntrinsicOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleOuterType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible type, but got " << type; + } + return ::mlir::success(); +} +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1b_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1b_horizGenericAdaptorBase::aarch64_sme_ld1b_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1b.horiz", odsAttrs.getContext()); +} + +aarch64_sme_ld1b_horizGenericAdaptorBase::aarch64_sme_ld1b_horizGenericAdaptorBase(aarch64_sme_ld1b_horiz op) : aarch64_sme_ld1b_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1b_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1b_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1b_horizAdaptor::aarch64_sme_ld1b_horizAdaptor(aarch64_sme_ld1b_horiz op) : aarch64_sme_ld1b_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1b_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1b_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1b_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1b_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1b_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1b_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1b_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1b_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1b_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1b_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1b_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1b_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1b_vertGenericAdaptorBase::aarch64_sme_ld1b_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1b.vert", odsAttrs.getContext()); +} + +aarch64_sme_ld1b_vertGenericAdaptorBase::aarch64_sme_ld1b_vertGenericAdaptorBase(aarch64_sme_ld1b_vert op) : aarch64_sme_ld1b_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1b_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1b_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1b_vertAdaptor::aarch64_sme_ld1b_vertAdaptor(aarch64_sme_ld1b_vert op) : aarch64_sme_ld1b_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1b_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1b_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1b_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1b_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1b_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1b_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1b_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1b_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1b_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1b_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1b_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1d_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1d_horizGenericAdaptorBase::aarch64_sme_ld1d_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1d.horiz", odsAttrs.getContext()); +} + +aarch64_sme_ld1d_horizGenericAdaptorBase::aarch64_sme_ld1d_horizGenericAdaptorBase(aarch64_sme_ld1d_horiz op) : aarch64_sme_ld1d_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1d_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1d_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1d_horizAdaptor::aarch64_sme_ld1d_horizAdaptor(aarch64_sme_ld1d_horiz op) : aarch64_sme_ld1d_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1d_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1d_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1d_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1d_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1d_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1d_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1d_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1d_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1d_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1d_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1d_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1d_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1d_vertGenericAdaptorBase::aarch64_sme_ld1d_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1d.vert", odsAttrs.getContext()); +} + +aarch64_sme_ld1d_vertGenericAdaptorBase::aarch64_sme_ld1d_vertGenericAdaptorBase(aarch64_sme_ld1d_vert op) : aarch64_sme_ld1d_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1d_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1d_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1d_vertAdaptor::aarch64_sme_ld1d_vertAdaptor(aarch64_sme_ld1d_vert op) : aarch64_sme_ld1d_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1d_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1d_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1d_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1d_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1d_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1d_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1d_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1d_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1d_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1d_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1d_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1h_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1h_horizGenericAdaptorBase::aarch64_sme_ld1h_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1h.horiz", odsAttrs.getContext()); +} + +aarch64_sme_ld1h_horizGenericAdaptorBase::aarch64_sme_ld1h_horizGenericAdaptorBase(aarch64_sme_ld1h_horiz op) : aarch64_sme_ld1h_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1h_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1h_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1h_horizAdaptor::aarch64_sme_ld1h_horizAdaptor(aarch64_sme_ld1h_horiz op) : aarch64_sme_ld1h_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1h_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1h_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1h_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1h_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1h_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1h_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1h_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1h_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1h_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1h_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1h_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1h_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1h_vertGenericAdaptorBase::aarch64_sme_ld1h_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1h.vert", odsAttrs.getContext()); +} + +aarch64_sme_ld1h_vertGenericAdaptorBase::aarch64_sme_ld1h_vertGenericAdaptorBase(aarch64_sme_ld1h_vert op) : aarch64_sme_ld1h_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1h_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1h_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1h_vertAdaptor::aarch64_sme_ld1h_vertAdaptor(aarch64_sme_ld1h_vert op) : aarch64_sme_ld1h_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1h_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1h_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1h_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1h_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1h_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1h_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1h_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1h_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1h_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1h_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1h_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1q_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1q_horizGenericAdaptorBase::aarch64_sme_ld1q_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1q.horiz", odsAttrs.getContext()); +} + +aarch64_sme_ld1q_horizGenericAdaptorBase::aarch64_sme_ld1q_horizGenericAdaptorBase(aarch64_sme_ld1q_horiz op) : aarch64_sme_ld1q_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1q_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1q_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1q_horizAdaptor::aarch64_sme_ld1q_horizAdaptor(aarch64_sme_ld1q_horiz op) : aarch64_sme_ld1q_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1q_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1q_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1q_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1q_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1q_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1q_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1q_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1q_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1q_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1q_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1q_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1q_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1q_vertGenericAdaptorBase::aarch64_sme_ld1q_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1q.vert", odsAttrs.getContext()); +} + +aarch64_sme_ld1q_vertGenericAdaptorBase::aarch64_sme_ld1q_vertGenericAdaptorBase(aarch64_sme_ld1q_vert op) : aarch64_sme_ld1q_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1q_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1q_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1q_vertAdaptor::aarch64_sme_ld1q_vertAdaptor(aarch64_sme_ld1q_vert op) : aarch64_sme_ld1q_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1q_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1q_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1q_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1q_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1q_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1q_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1q_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1q_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1q_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1q_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1q_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1w_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1w_horizGenericAdaptorBase::aarch64_sme_ld1w_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1w.horiz", odsAttrs.getContext()); +} + +aarch64_sme_ld1w_horizGenericAdaptorBase::aarch64_sme_ld1w_horizGenericAdaptorBase(aarch64_sme_ld1w_horiz op) : aarch64_sme_ld1w_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1w_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1w_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1w_horizAdaptor::aarch64_sme_ld1w_horizAdaptor(aarch64_sme_ld1w_horiz op) : aarch64_sme_ld1w_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1w_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1w_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1w_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1w_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1w_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1w_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1w_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1w_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1w_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1w_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1w_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1w_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_ld1w_vertGenericAdaptorBase::aarch64_sme_ld1w_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.ld1w.vert", odsAttrs.getContext()); +} + +aarch64_sme_ld1w_vertGenericAdaptorBase::aarch64_sme_ld1w_vertGenericAdaptorBase(aarch64_sme_ld1w_vert op) : aarch64_sme_ld1w_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_ld1w_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_ld1w_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_ld1w_vertAdaptor::aarch64_sme_ld1w_vertAdaptor(aarch64_sme_ld1w_vert op) : aarch64_sme_ld1w_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_ld1w_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_ld1w_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_ld1w_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_ld1w_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_ld1w_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_ld1w_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_ld1w_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_ld1w_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_ld1w_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_ld1w_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1w_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_mopa definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_mopaGenericAdaptorBase::aarch64_sme_mopaGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.mopa", odsAttrs.getContext()); +} + +aarch64_sme_mopaGenericAdaptorBase::aarch64_sme_mopaGenericAdaptorBase(aarch64_sme_mopa op) : aarch64_sme_mopaGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_mopaGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_mopaGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_mopaAdaptor::aarch64_sme_mopaAdaptor(aarch64_sme_mopa op) : aarch64_sme_mopaGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_mopaAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_mopa::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_mopa::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_mopa::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_mopa::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_mopa::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_mopa::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_mopa::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_mopa::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_mopa::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_mopa) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_mopa_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_mopa_wideGenericAdaptorBase::aarch64_sme_mopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.mopa.wide", odsAttrs.getContext()); +} + +aarch64_sme_mopa_wideGenericAdaptorBase::aarch64_sme_mopa_wideGenericAdaptorBase(aarch64_sme_mopa_wide op) : aarch64_sme_mopa_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_mopa_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_mopa_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_mopa_wideAdaptor::aarch64_sme_mopa_wideAdaptor(aarch64_sme_mopa_wide op) : aarch64_sme_mopa_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_mopa_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_mopa_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_mopa_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_mopa_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_mopa_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_mopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_mopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_mopa_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_mopa_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_mopa_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_mopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_mops definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_mopsGenericAdaptorBase::aarch64_sme_mopsGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.mops", odsAttrs.getContext()); +} + +aarch64_sme_mopsGenericAdaptorBase::aarch64_sme_mopsGenericAdaptorBase(aarch64_sme_mops op) : aarch64_sme_mopsGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_mopsGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_mopsGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_mopsAdaptor::aarch64_sme_mopsAdaptor(aarch64_sme_mops op) : aarch64_sme_mopsGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_mopsAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_mops::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_mops::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_mops::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_mops::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_mops::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_mops::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_mops::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_mops::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_mops::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_mops) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_mops_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_mops_wideGenericAdaptorBase::aarch64_sme_mops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.mops.wide", odsAttrs.getContext()); +} + +aarch64_sme_mops_wideGenericAdaptorBase::aarch64_sme_mops_wideGenericAdaptorBase(aarch64_sme_mops_wide op) : aarch64_sme_mops_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_mops_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_mops_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_mops_wideAdaptor::aarch64_sme_mops_wideAdaptor(aarch64_sme_mops_wide op) : aarch64_sme_mops_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_mops_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_mops_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_mops_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_mops_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_mops_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_mops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_mops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_mops_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_mops_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_mops_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_mops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_read_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_read_horizGenericAdaptorBase::aarch64_sme_read_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.read.horiz", odsAttrs.getContext()); +} + +aarch64_sme_read_horizGenericAdaptorBase::aarch64_sme_read_horizGenericAdaptorBase(aarch64_sme_read_horiz op) : aarch64_sme_read_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_read_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_read_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_read_horizAdaptor::aarch64_sme_read_horizAdaptor(aarch64_sme_read_horiz op) : aarch64_sme_read_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_read_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_read_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_read_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> aarch64_sme_read_horiz::getVector() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> aarch64_sme_read_horiz::getPg() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &aarch64_sme_read_horiz::getVectorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &aarch64_sme_read_horiz::getPgMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair aarch64_sme_read_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_read_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value aarch64_sme_read_horiz::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void aarch64_sme_read_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value pg, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(vector); + odsState.addOperands(pg); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addTypes(res); +} + +void aarch64_sme_read_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value pg, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(vector); + odsState.addOperands(pg); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_read_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_read_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape())))) + return emitOpError("failed to verify that all of {vector, pg, res} have same shape"); + if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) + return emitOpError("failed to verify that all of {vector, res} have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_read_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_read_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_read_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_read_vertGenericAdaptorBase::aarch64_sme_read_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.read.vert", odsAttrs.getContext()); +} + +aarch64_sme_read_vertGenericAdaptorBase::aarch64_sme_read_vertGenericAdaptorBase(aarch64_sme_read_vert op) : aarch64_sme_read_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_read_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_read_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_read_vertAdaptor::aarch64_sme_read_vertAdaptor(aarch64_sme_read_vert op) : aarch64_sme_read_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_read_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_read_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_read_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> aarch64_sme_read_vert::getVector() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> aarch64_sme_read_vert::getPg() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &aarch64_sme_read_vert::getVectorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &aarch64_sme_read_vert::getPgMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair aarch64_sme_read_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_read_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value aarch64_sme_read_vert::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void aarch64_sme_read_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value pg, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(vector); + odsState.addOperands(pg); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addTypes(res); +} + +void aarch64_sme_read_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value pg, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(vector); + odsState.addOperands(pg); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_read_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_read_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape())))) + return emitOpError("failed to verify that all of {vector, pg, res} have same shape"); + if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))) && (getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) + return emitOpError("failed to verify that all of {vector, res} have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_read_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_read_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_smopa_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_smopa_wideGenericAdaptorBase::aarch64_sme_smopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.smopa.wide", odsAttrs.getContext()); +} + +aarch64_sme_smopa_wideGenericAdaptorBase::aarch64_sme_smopa_wideGenericAdaptorBase(aarch64_sme_smopa_wide op) : aarch64_sme_smopa_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_smopa_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_smopa_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_smopa_wideAdaptor::aarch64_sme_smopa_wideAdaptor(aarch64_sme_smopa_wide op) : aarch64_sme_smopa_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_smopa_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_smopa_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_smopa_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_smopa_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_smopa_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_smopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_smopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_smopa_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_smopa_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_smopa_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_smopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_smops_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_smops_wideGenericAdaptorBase::aarch64_sme_smops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.smops.wide", odsAttrs.getContext()); +} + +aarch64_sme_smops_wideGenericAdaptorBase::aarch64_sme_smops_wideGenericAdaptorBase(aarch64_sme_smops_wide op) : aarch64_sme_smops_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_smops_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_smops_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_smops_wideAdaptor::aarch64_sme_smops_wideAdaptor(aarch64_sme_smops_wide op) : aarch64_sme_smops_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_smops_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_smops_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_smops_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_smops_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_smops_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_smops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_smops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_smops_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_smops_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_smops_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_smops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1b_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1b_horizGenericAdaptorBase::aarch64_sme_st1b_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1b.horiz", odsAttrs.getContext()); +} + +aarch64_sme_st1b_horizGenericAdaptorBase::aarch64_sme_st1b_horizGenericAdaptorBase(aarch64_sme_st1b_horiz op) : aarch64_sme_st1b_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1b_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1b_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1b_horizAdaptor::aarch64_sme_st1b_horizAdaptor(aarch64_sme_st1b_horiz op) : aarch64_sme_st1b_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1b_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1b_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1b_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1b_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1b_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1b_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1b_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1b_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1b_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1b_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1b_horiz::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1b_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1b_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1b_vertGenericAdaptorBase::aarch64_sme_st1b_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1b.vert", odsAttrs.getContext()); +} + +aarch64_sme_st1b_vertGenericAdaptorBase::aarch64_sme_st1b_vertGenericAdaptorBase(aarch64_sme_st1b_vert op) : aarch64_sme_st1b_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1b_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1b_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1b_vertAdaptor::aarch64_sme_st1b_vertAdaptor(aarch64_sme_st1b_vert op) : aarch64_sme_st1b_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1b_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1b_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1b_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1b_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1b_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1b_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1b_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1b_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1b_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1b_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1b_vert::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1b_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1d_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1d_horizGenericAdaptorBase::aarch64_sme_st1d_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1d.horiz", odsAttrs.getContext()); +} + +aarch64_sme_st1d_horizGenericAdaptorBase::aarch64_sme_st1d_horizGenericAdaptorBase(aarch64_sme_st1d_horiz op) : aarch64_sme_st1d_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1d_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1d_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1d_horizAdaptor::aarch64_sme_st1d_horizAdaptor(aarch64_sme_st1d_horiz op) : aarch64_sme_st1d_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1d_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1d_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1d_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1d_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1d_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1d_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1d_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1d_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1d_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1d_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1d_horiz::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1d_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1d_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1d_vertGenericAdaptorBase::aarch64_sme_st1d_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1d.vert", odsAttrs.getContext()); +} + +aarch64_sme_st1d_vertGenericAdaptorBase::aarch64_sme_st1d_vertGenericAdaptorBase(aarch64_sme_st1d_vert op) : aarch64_sme_st1d_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1d_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1d_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1d_vertAdaptor::aarch64_sme_st1d_vertAdaptor(aarch64_sme_st1d_vert op) : aarch64_sme_st1d_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1d_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1d_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1d_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1d_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1d_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1d_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1d_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1d_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1d_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1d_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1d_vert::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1d_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1h_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1h_horizGenericAdaptorBase::aarch64_sme_st1h_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1h.horiz", odsAttrs.getContext()); +} + +aarch64_sme_st1h_horizGenericAdaptorBase::aarch64_sme_st1h_horizGenericAdaptorBase(aarch64_sme_st1h_horiz op) : aarch64_sme_st1h_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1h_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1h_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1h_horizAdaptor::aarch64_sme_st1h_horizAdaptor(aarch64_sme_st1h_horiz op) : aarch64_sme_st1h_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1h_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1h_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1h_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1h_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1h_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1h_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1h_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1h_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1h_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1h_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1h_horiz::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1h_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1h_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1h_vertGenericAdaptorBase::aarch64_sme_st1h_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1h.vert", odsAttrs.getContext()); +} + +aarch64_sme_st1h_vertGenericAdaptorBase::aarch64_sme_st1h_vertGenericAdaptorBase(aarch64_sme_st1h_vert op) : aarch64_sme_st1h_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1h_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1h_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1h_vertAdaptor::aarch64_sme_st1h_vertAdaptor(aarch64_sme_st1h_vert op) : aarch64_sme_st1h_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1h_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1h_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1h_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1h_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1h_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1h_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1h_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1h_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1h_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1h_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1h_vert::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1h_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1q_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1q_horizGenericAdaptorBase::aarch64_sme_st1q_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1q.horiz", odsAttrs.getContext()); +} + +aarch64_sme_st1q_horizGenericAdaptorBase::aarch64_sme_st1q_horizGenericAdaptorBase(aarch64_sme_st1q_horiz op) : aarch64_sme_st1q_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1q_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1q_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1q_horizAdaptor::aarch64_sme_st1q_horizAdaptor(aarch64_sme_st1q_horiz op) : aarch64_sme_st1q_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1q_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1q_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1q_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1q_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1q_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1q_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1q_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1q_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1q_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1q_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1q_horiz::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1q_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1q_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1q_vertGenericAdaptorBase::aarch64_sme_st1q_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1q.vert", odsAttrs.getContext()); +} + +aarch64_sme_st1q_vertGenericAdaptorBase::aarch64_sme_st1q_vertGenericAdaptorBase(aarch64_sme_st1q_vert op) : aarch64_sme_st1q_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1q_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1q_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1q_vertAdaptor::aarch64_sme_st1q_vertAdaptor(aarch64_sme_st1q_vert op) : aarch64_sme_st1q_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1q_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1q_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1q_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1q_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1q_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1q_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1q_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1q_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1q_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1q_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1q_vert::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1q_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1w_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1w_horizGenericAdaptorBase::aarch64_sme_st1w_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1w.horiz", odsAttrs.getContext()); +} + +aarch64_sme_st1w_horizGenericAdaptorBase::aarch64_sme_st1w_horizGenericAdaptorBase(aarch64_sme_st1w_horiz op) : aarch64_sme_st1w_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1w_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1w_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1w_horizAdaptor::aarch64_sme_st1w_horizAdaptor(aarch64_sme_st1w_horiz op) : aarch64_sme_st1w_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1w_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1w_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1w_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1w_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1w_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1w_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1w_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1w_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1w_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1w_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1w_horiz::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1w_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1w_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_st1w_vertGenericAdaptorBase::aarch64_sme_st1w_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.st1w.vert", odsAttrs.getContext()); +} + +aarch64_sme_st1w_vertGenericAdaptorBase::aarch64_sme_st1w_vertGenericAdaptorBase(aarch64_sme_st1w_vert op) : aarch64_sme_st1w_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_st1w_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_st1w_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_st1w_vertAdaptor::aarch64_sme_st1w_vertAdaptor(aarch64_sme_st1w_vert op) : aarch64_sme_st1w_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_st1w_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_st1w_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_st1w_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_st1w_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_st1w_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_st1w_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); +} + +void aarch64_sme_st1w_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_st1w_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_st1w_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_st1w_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_st1w_vert::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1w_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_str definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_strGenericAdaptorBase::aarch64_sme_strGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.str", odsAttrs.getContext()); +} + +aarch64_sme_strGenericAdaptorBase::aarch64_sme_strGenericAdaptorBase(aarch64_sme_str op) : aarch64_sme_strGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_strGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_strGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_strAdaptor::aarch64_sme_strAdaptor(aarch64_sme_str op) : aarch64_sme_strGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_strAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_str::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_str::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_str::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_str::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_str::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); +} + +void aarch64_sme_str::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_str::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_str::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_str::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void aarch64_sme_str::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_str) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_sumopa_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_sumopa_wideGenericAdaptorBase::aarch64_sme_sumopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.sumopa.wide", odsAttrs.getContext()); +} + +aarch64_sme_sumopa_wideGenericAdaptorBase::aarch64_sme_sumopa_wideGenericAdaptorBase(aarch64_sme_sumopa_wide op) : aarch64_sme_sumopa_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_sumopa_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_sumopa_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_sumopa_wideAdaptor::aarch64_sme_sumopa_wideAdaptor(aarch64_sme_sumopa_wide op) : aarch64_sme_sumopa_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_sumopa_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_sumopa_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_sumopa_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_sumopa_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_sumopa_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_sumopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_sumopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_sumopa_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_sumopa_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_sumopa_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_sumopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_sumops_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_sumops_wideGenericAdaptorBase::aarch64_sme_sumops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.sumops.wide", odsAttrs.getContext()); +} + +aarch64_sme_sumops_wideGenericAdaptorBase::aarch64_sme_sumops_wideGenericAdaptorBase(aarch64_sme_sumops_wide op) : aarch64_sme_sumops_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_sumops_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_sumops_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_sumops_wideAdaptor::aarch64_sme_sumops_wideAdaptor(aarch64_sme_sumops_wide op) : aarch64_sme_sumops_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_sumops_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_sumops_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_sumops_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_sumops_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_sumops_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_sumops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_sumops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_sumops_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_sumops_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_sumops_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_sumops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_umopa_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_umopa_wideGenericAdaptorBase::aarch64_sme_umopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.umopa.wide", odsAttrs.getContext()); +} + +aarch64_sme_umopa_wideGenericAdaptorBase::aarch64_sme_umopa_wideGenericAdaptorBase(aarch64_sme_umopa_wide op) : aarch64_sme_umopa_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_umopa_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_umopa_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_umopa_wideAdaptor::aarch64_sme_umopa_wideAdaptor(aarch64_sme_umopa_wide op) : aarch64_sme_umopa_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_umopa_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_umopa_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_umopa_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_umopa_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_umopa_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_umopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_umopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_umopa_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_umopa_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_umopa_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_umopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_umops_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_umops_wideGenericAdaptorBase::aarch64_sme_umops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.umops.wide", odsAttrs.getContext()); +} + +aarch64_sme_umops_wideGenericAdaptorBase::aarch64_sme_umops_wideGenericAdaptorBase(aarch64_sme_umops_wide op) : aarch64_sme_umops_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_umops_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_umops_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_umops_wideAdaptor::aarch64_sme_umops_wideAdaptor(aarch64_sme_umops_wide op) : aarch64_sme_umops_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_umops_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_umops_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_umops_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_umops_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_umops_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_umops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_umops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_umops_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_umops_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_umops_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_umops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_usmopa_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_usmopa_wideGenericAdaptorBase::aarch64_sme_usmopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.usmopa.wide", odsAttrs.getContext()); +} + +aarch64_sme_usmopa_wideGenericAdaptorBase::aarch64_sme_usmopa_wideGenericAdaptorBase(aarch64_sme_usmopa_wide op) : aarch64_sme_usmopa_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_usmopa_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_usmopa_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_usmopa_wideAdaptor::aarch64_sme_usmopa_wideAdaptor(aarch64_sme_usmopa_wide op) : aarch64_sme_usmopa_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_usmopa_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_usmopa_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_usmopa_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_usmopa_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_usmopa_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_usmopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_usmopa_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_usmopa_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_usmopa_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_usmopa_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_usmopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_usmops_wide definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_usmops_wideGenericAdaptorBase::aarch64_sme_usmops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.usmops.wide", odsAttrs.getContext()); +} + +aarch64_sme_usmops_wideGenericAdaptorBase::aarch64_sme_usmops_wideGenericAdaptorBase(aarch64_sme_usmops_wide op) : aarch64_sme_usmops_wideGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_usmops_wideGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_usmops_wideGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_usmops_wideAdaptor::aarch64_sme_usmops_wideAdaptor(aarch64_sme_usmops_wide op) : aarch64_sme_usmops_wideGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_usmops_wideAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_usmops_wide::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_usmops_wide::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_usmops_wide::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_usmops_wide::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_usmops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); +} + +void aarch64_sme_usmops_wide::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addOperands(odsArg_3); + odsState.addOperands(odsArg_4); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_usmops_wide::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_usmops_wide::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_usmops_wide::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_usmops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_write_horiz definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_write_horizGenericAdaptorBase::aarch64_sme_write_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.write.horiz", odsAttrs.getContext()); +} + +aarch64_sme_write_horizGenericAdaptorBase::aarch64_sme_write_horizGenericAdaptorBase(aarch64_sme_write_horiz op) : aarch64_sme_write_horizGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_write_horizGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_write_horizGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_write_horizAdaptor::aarch64_sme_write_horizAdaptor(aarch64_sme_write_horiz op) : aarch64_sme_write_horizGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_write_horizAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_write_horiz::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_write_horiz::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> aarch64_sme_write_horiz::getPg() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> aarch64_sme_write_horiz::getVector() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &aarch64_sme_write_horiz::getPgMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &aarch64_sme_write_horiz::getVectorMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair aarch64_sme_write_horiz::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_write_horiz::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_write_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value pg, ::mlir::Value vector) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(pg); + odsState.addOperands(vector); +} + +void aarch64_sme_write_horiz::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value pg, ::mlir::Value vector) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(pg); + odsState.addOperands(vector); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_write_horiz::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_write_horiz::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(3).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(3).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getShape())))) + return emitOpError("failed to verify that all of {pg, vector} have same shape"); + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_write_horiz::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_write_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_write_vert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_write_vertGenericAdaptorBase::aarch64_sme_write_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.write.vert", odsAttrs.getContext()); +} + +aarch64_sme_write_vertGenericAdaptorBase::aarch64_sme_write_vertGenericAdaptorBase(aarch64_sme_write_vert op) : aarch64_sme_write_vertGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_write_vertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_write_vertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_write_vertAdaptor::aarch64_sme_write_vertAdaptor(aarch64_sme_write_vert op) : aarch64_sme_write_vertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_write_vertAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_write_vert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_write_vert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> aarch64_sme_write_vert::getPg() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> aarch64_sme_write_vert::getVector() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &aarch64_sme_write_vert::getPgMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &aarch64_sme_write_vert::getVectorMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair aarch64_sme_write_vert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_write_vert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_write_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value pg, ::mlir::Value vector) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(pg); + odsState.addOperands(vector); +} + +void aarch64_sme_write_vert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value pg, ::mlir::Value vector) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(pg); + odsState.addOperands(vector); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_write_vert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_write_vert::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(3).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(3).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(2).begin()).getType()).getShape())))) + return emitOpError("failed to verify that all of {pg, vector} have same shape"); + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_write_vert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_write_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_za_disable definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_za_disableGenericAdaptorBase::aarch64_sme_za_disableGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.za.disable", odsAttrs.getContext()); +} + +aarch64_sme_za_disableGenericAdaptorBase::aarch64_sme_za_disableGenericAdaptorBase(aarch64_sme_za_disable op) : aarch64_sme_za_disableGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_za_disableGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_za_disableGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_za_disableAdaptor::aarch64_sme_za_disableAdaptor(aarch64_sme_za_disable op) : aarch64_sme_za_disableGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_za_disableAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_za_disable::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_za_disable::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_za_disable::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_za_disable::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_za_disable::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void aarch64_sme_za_disable::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_za_disable::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_za_disable::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_za_disable::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_za_disable) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_za_enable definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_za_enableGenericAdaptorBase::aarch64_sme_za_enableGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.za.enable", odsAttrs.getContext()); +} + +aarch64_sme_za_enableGenericAdaptorBase::aarch64_sme_za_enableGenericAdaptorBase(aarch64_sme_za_enable op) : aarch64_sme_za_enableGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_za_enableGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_za_enableGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_za_enableAdaptor::aarch64_sme_za_enableAdaptor(aarch64_sme_za_enable op) : aarch64_sme_za_enableGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_za_enableAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_za_enable::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_za_enable::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_za_enable::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_za_enable::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_za_enable::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void aarch64_sme_za_enable::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_za_enable::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_za_enable::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_za_enable::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_za_enable) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_zero definitions +//===----------------------------------------------------------------------===// + +namespace detail { +aarch64_sme_zeroGenericAdaptorBase::aarch64_sme_zeroGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.intr.zero", odsAttrs.getContext()); +} + +aarch64_sme_zeroGenericAdaptorBase::aarch64_sme_zeroGenericAdaptorBase(aarch64_sme_zero op) : aarch64_sme_zeroGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair aarch64_sme_zeroGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr aarch64_sme_zeroGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +aarch64_sme_zeroAdaptor::aarch64_sme_zeroAdaptor(aarch64_sme_zero op) : aarch64_sme_zeroGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult aarch64_sme_zeroAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair aarch64_sme_zero::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range aarch64_sme_zero::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair aarch64_sme_zero::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range aarch64_sme_zero::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void aarch64_sme_zero::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0) { + odsState.addOperands(odsArg_0); +} + +void aarch64_sme_zero::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) { + odsState.addOperands(odsArg_0); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void aarch64_sme_zero::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult aarch64_sme_zero::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult aarch64_sme_zero::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_zero) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..4ae795ee1029dddb6360eb65903d4f94e24c31f6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.h.inc @@ -0,0 +1,3885 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSMEIntrinsicOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1b_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1b_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1d_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1d_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1h_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1h_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1q_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1q_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1w_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_ld1w_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_mopa; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_mopa_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_mops; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_mops_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_read_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_read_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_smopa_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_smops_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1b_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1b_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1d_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1d_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1h_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1h_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1q_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1q_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1w_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_st1w_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_str; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_sumopa_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_sumops_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_umopa_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_umops_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_usmopa_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_usmops_wide; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_write_horiz; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_write_vert; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_za_disable; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_za_enable; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class aarch64_sme_zero; +} // namespace arm_sme +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1b_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1b_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1b_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1b_horizGenericAdaptorBase(aarch64_sme_ld1b_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1b_horizGenericAdaptor : public detail::aarch64_sme_ld1b_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1b_horizGenericAdaptorBase; +public: + aarch64_sme_ld1b_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1b_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1b_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1b_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1b_horizAdaptor : public aarch64_sme_ld1b_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1b_horizGenericAdaptor::aarch64_sme_ld1b_horizGenericAdaptor; + aarch64_sme_ld1b_horizAdaptor(aarch64_sme_ld1b_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1b_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1b_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1b_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1b.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1b_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1b_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1b_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1b_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1b_vertGenericAdaptorBase(aarch64_sme_ld1b_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1b_vertGenericAdaptor : public detail::aarch64_sme_ld1b_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1b_vertGenericAdaptorBase; +public: + aarch64_sme_ld1b_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1b_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1b_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1b_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1b_vertAdaptor : public aarch64_sme_ld1b_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1b_vertGenericAdaptor::aarch64_sme_ld1b_vertGenericAdaptor; + aarch64_sme_ld1b_vertAdaptor(aarch64_sme_ld1b_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1b_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1b_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1b_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1b.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1b_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1d_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1d_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1d_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1d_horizGenericAdaptorBase(aarch64_sme_ld1d_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1d_horizGenericAdaptor : public detail::aarch64_sme_ld1d_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1d_horizGenericAdaptorBase; +public: + aarch64_sme_ld1d_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1d_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1d_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1d_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1d_horizAdaptor : public aarch64_sme_ld1d_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1d_horizGenericAdaptor::aarch64_sme_ld1d_horizGenericAdaptor; + aarch64_sme_ld1d_horizAdaptor(aarch64_sme_ld1d_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1d_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1d_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1d_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1d.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1d_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1d_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1d_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1d_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1d_vertGenericAdaptorBase(aarch64_sme_ld1d_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1d_vertGenericAdaptor : public detail::aarch64_sme_ld1d_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1d_vertGenericAdaptorBase; +public: + aarch64_sme_ld1d_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1d_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1d_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1d_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1d_vertAdaptor : public aarch64_sme_ld1d_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1d_vertGenericAdaptor::aarch64_sme_ld1d_vertGenericAdaptor; + aarch64_sme_ld1d_vertAdaptor(aarch64_sme_ld1d_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1d_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1d_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1d_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1d.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1d_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1h_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1h_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1h_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1h_horizGenericAdaptorBase(aarch64_sme_ld1h_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1h_horizGenericAdaptor : public detail::aarch64_sme_ld1h_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1h_horizGenericAdaptorBase; +public: + aarch64_sme_ld1h_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1h_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1h_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1h_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1h_horizAdaptor : public aarch64_sme_ld1h_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1h_horizGenericAdaptor::aarch64_sme_ld1h_horizGenericAdaptor; + aarch64_sme_ld1h_horizAdaptor(aarch64_sme_ld1h_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1h_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1h_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1h_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1h.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1h_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1h_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1h_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1h_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1h_vertGenericAdaptorBase(aarch64_sme_ld1h_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1h_vertGenericAdaptor : public detail::aarch64_sme_ld1h_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1h_vertGenericAdaptorBase; +public: + aarch64_sme_ld1h_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1h_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1h_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1h_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1h_vertAdaptor : public aarch64_sme_ld1h_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1h_vertGenericAdaptor::aarch64_sme_ld1h_vertGenericAdaptor; + aarch64_sme_ld1h_vertAdaptor(aarch64_sme_ld1h_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1h_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1h_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1h_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1h.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1h_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1q_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1q_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1q_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1q_horizGenericAdaptorBase(aarch64_sme_ld1q_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1q_horizGenericAdaptor : public detail::aarch64_sme_ld1q_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1q_horizGenericAdaptorBase; +public: + aarch64_sme_ld1q_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1q_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1q_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1q_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1q_horizAdaptor : public aarch64_sme_ld1q_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1q_horizGenericAdaptor::aarch64_sme_ld1q_horizGenericAdaptor; + aarch64_sme_ld1q_horizAdaptor(aarch64_sme_ld1q_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1q_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1q_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1q_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1q.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1q_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1q_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1q_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1q_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1q_vertGenericAdaptorBase(aarch64_sme_ld1q_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1q_vertGenericAdaptor : public detail::aarch64_sme_ld1q_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1q_vertGenericAdaptorBase; +public: + aarch64_sme_ld1q_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1q_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1q_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1q_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1q_vertAdaptor : public aarch64_sme_ld1q_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1q_vertGenericAdaptor::aarch64_sme_ld1q_vertGenericAdaptor; + aarch64_sme_ld1q_vertAdaptor(aarch64_sme_ld1q_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1q_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1q_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1q_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1q.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1q_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1w_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1w_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1w_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1w_horizGenericAdaptorBase(aarch64_sme_ld1w_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1w_horizGenericAdaptor : public detail::aarch64_sme_ld1w_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1w_horizGenericAdaptorBase; +public: + aarch64_sme_ld1w_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1w_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1w_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1w_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1w_horizAdaptor : public aarch64_sme_ld1w_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1w_horizGenericAdaptor::aarch64_sme_ld1w_horizGenericAdaptor; + aarch64_sme_ld1w_horizAdaptor(aarch64_sme_ld1w_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1w_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1w_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1w_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1w.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1w_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_ld1w_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_ld1w_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_ld1w_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_ld1w_vertGenericAdaptorBase(aarch64_sme_ld1w_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_ld1w_vertGenericAdaptor : public detail::aarch64_sme_ld1w_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_ld1w_vertGenericAdaptorBase; +public: + aarch64_sme_ld1w_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_ld1w_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_ld1w_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_ld1w_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_ld1w_vertAdaptor : public aarch64_sme_ld1w_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_ld1w_vertGenericAdaptor::aarch64_sme_ld1w_vertGenericAdaptor; + aarch64_sme_ld1w_vertAdaptor(aarch64_sme_ld1w_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_ld1w_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_ld1w_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_ld1w_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.ld1w.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_ld1w_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_mopa declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_mopaGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_mopaGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_mopaGenericAdaptorBase(aarch64_sme_mopa op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_mopaGenericAdaptor : public detail::aarch64_sme_mopaGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_mopaGenericAdaptorBase; +public: + aarch64_sme_mopaGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_mopaGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_mopaGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_mopaGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_mopaAdaptor : public aarch64_sme_mopaGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_mopaGenericAdaptor::aarch64_sme_mopaGenericAdaptor; + aarch64_sme_mopaAdaptor(aarch64_sme_mopa op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_mopa : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_mopaAdaptor; + template + using GenericAdaptor = aarch64_sme_mopaGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.mopa"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_mopa) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_mopa_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_mopa_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_mopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_mopa_wideGenericAdaptorBase(aarch64_sme_mopa_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_mopa_wideGenericAdaptor : public detail::aarch64_sme_mopa_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_mopa_wideGenericAdaptorBase; +public: + aarch64_sme_mopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_mopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_mopa_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_mopa_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_mopa_wideAdaptor : public aarch64_sme_mopa_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_mopa_wideGenericAdaptor::aarch64_sme_mopa_wideGenericAdaptor; + aarch64_sme_mopa_wideAdaptor(aarch64_sme_mopa_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_mopa_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_mopa_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_mopa_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.mopa.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_mopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_mops declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_mopsGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_mopsGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_mopsGenericAdaptorBase(aarch64_sme_mops op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_mopsGenericAdaptor : public detail::aarch64_sme_mopsGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_mopsGenericAdaptorBase; +public: + aarch64_sme_mopsGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_mopsGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_mopsGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_mopsGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_mopsAdaptor : public aarch64_sme_mopsGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_mopsGenericAdaptor::aarch64_sme_mopsGenericAdaptor; + aarch64_sme_mopsAdaptor(aarch64_sme_mops op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_mops : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_mopsAdaptor; + template + using GenericAdaptor = aarch64_sme_mopsGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.mops"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_mops) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_mops_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_mops_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_mops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_mops_wideGenericAdaptorBase(aarch64_sme_mops_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_mops_wideGenericAdaptor : public detail::aarch64_sme_mops_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_mops_wideGenericAdaptorBase; +public: + aarch64_sme_mops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_mops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_mops_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_mops_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_mops_wideAdaptor : public aarch64_sme_mops_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_mops_wideGenericAdaptor::aarch64_sme_mops_wideGenericAdaptor; + aarch64_sme_mops_wideAdaptor(aarch64_sme_mops_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_mops_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_mops_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_mops_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.mops.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_mops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_read_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_read_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_read_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_read_horizGenericAdaptorBase(aarch64_sme_read_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_read_horizGenericAdaptor : public detail::aarch64_sme_read_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_read_horizGenericAdaptorBase; +public: + aarch64_sme_read_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_read_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_read_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_read_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVector() { + return (*getODSOperands(0).begin()); + } + + ValueT getPg() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_read_horizAdaptor : public aarch64_sme_read_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_read_horizGenericAdaptor::aarch64_sme_read_horizGenericAdaptor; + aarch64_sme_read_horizAdaptor(aarch64_sme_read_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_read_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_read_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_read_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.read.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getVector(); + ::mlir::TypedValue<::mlir::VectorType> getPg(); + ::mlir::OpOperand &getVectorMutable(); + ::mlir::OpOperand &getPgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value pg, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value pg, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_read_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_read_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_read_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_read_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_read_vertGenericAdaptorBase(aarch64_sme_read_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_read_vertGenericAdaptor : public detail::aarch64_sme_read_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_read_vertGenericAdaptorBase; +public: + aarch64_sme_read_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_read_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_read_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_read_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVector() { + return (*getODSOperands(0).begin()); + } + + ValueT getPg() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_read_vertAdaptor : public aarch64_sme_read_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_read_vertGenericAdaptor::aarch64_sme_read_vertGenericAdaptor; + aarch64_sme_read_vertAdaptor(aarch64_sme_read_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_read_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_read_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_read_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.read.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getVector(); + ::mlir::TypedValue<::mlir::VectorType> getPg(); + ::mlir::OpOperand &getVectorMutable(); + ::mlir::OpOperand &getPgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value pg, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value pg, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_read_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_smopa_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_smopa_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_smopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_smopa_wideGenericAdaptorBase(aarch64_sme_smopa_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_smopa_wideGenericAdaptor : public detail::aarch64_sme_smopa_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_smopa_wideGenericAdaptorBase; +public: + aarch64_sme_smopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_smopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_smopa_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_smopa_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_smopa_wideAdaptor : public aarch64_sme_smopa_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_smopa_wideGenericAdaptor::aarch64_sme_smopa_wideGenericAdaptor; + aarch64_sme_smopa_wideAdaptor(aarch64_sme_smopa_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_smopa_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_smopa_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_smopa_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.smopa.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_smopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_smops_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_smops_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_smops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_smops_wideGenericAdaptorBase(aarch64_sme_smops_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_smops_wideGenericAdaptor : public detail::aarch64_sme_smops_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_smops_wideGenericAdaptorBase; +public: + aarch64_sme_smops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_smops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_smops_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_smops_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_smops_wideAdaptor : public aarch64_sme_smops_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_smops_wideGenericAdaptor::aarch64_sme_smops_wideGenericAdaptor; + aarch64_sme_smops_wideAdaptor(aarch64_sme_smops_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_smops_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_smops_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_smops_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.smops.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_smops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1b_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1b_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1b_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1b_horizGenericAdaptorBase(aarch64_sme_st1b_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1b_horizGenericAdaptor : public detail::aarch64_sme_st1b_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1b_horizGenericAdaptorBase; +public: + aarch64_sme_st1b_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1b_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1b_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1b_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1b_horizAdaptor : public aarch64_sme_st1b_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1b_horizGenericAdaptor::aarch64_sme_st1b_horizGenericAdaptor; + aarch64_sme_st1b_horizAdaptor(aarch64_sme_st1b_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1b_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1b_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_st1b_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1b.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1b_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1b_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1b_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1b_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1b_vertGenericAdaptorBase(aarch64_sme_st1b_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1b_vertGenericAdaptor : public detail::aarch64_sme_st1b_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1b_vertGenericAdaptorBase; +public: + aarch64_sme_st1b_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1b_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1b_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1b_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1b_vertAdaptor : public aarch64_sme_st1b_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1b_vertGenericAdaptor::aarch64_sme_st1b_vertGenericAdaptor; + aarch64_sme_st1b_vertAdaptor(aarch64_sme_st1b_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1b_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1b_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_st1b_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1b.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1b_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1d_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1d_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1d_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1d_horizGenericAdaptorBase(aarch64_sme_st1d_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1d_horizGenericAdaptor : public detail::aarch64_sme_st1d_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1d_horizGenericAdaptorBase; +public: + aarch64_sme_st1d_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1d_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1d_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1d_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1d_horizAdaptor : public aarch64_sme_st1d_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1d_horizGenericAdaptor::aarch64_sme_st1d_horizGenericAdaptor; + aarch64_sme_st1d_horizAdaptor(aarch64_sme_st1d_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1d_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1d_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_st1d_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1d.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1d_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1d_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1d_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1d_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1d_vertGenericAdaptorBase(aarch64_sme_st1d_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1d_vertGenericAdaptor : public detail::aarch64_sme_st1d_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1d_vertGenericAdaptorBase; +public: + aarch64_sme_st1d_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1d_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1d_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1d_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1d_vertAdaptor : public aarch64_sme_st1d_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1d_vertGenericAdaptor::aarch64_sme_st1d_vertGenericAdaptor; + aarch64_sme_st1d_vertAdaptor(aarch64_sme_st1d_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1d_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1d_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_st1d_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1d.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1d_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1h_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1h_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1h_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1h_horizGenericAdaptorBase(aarch64_sme_st1h_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1h_horizGenericAdaptor : public detail::aarch64_sme_st1h_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1h_horizGenericAdaptorBase; +public: + aarch64_sme_st1h_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1h_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1h_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1h_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1h_horizAdaptor : public aarch64_sme_st1h_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1h_horizGenericAdaptor::aarch64_sme_st1h_horizGenericAdaptor; + aarch64_sme_st1h_horizAdaptor(aarch64_sme_st1h_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1h_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1h_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_st1h_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1h.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1h_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1h_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1h_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1h_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1h_vertGenericAdaptorBase(aarch64_sme_st1h_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1h_vertGenericAdaptor : public detail::aarch64_sme_st1h_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1h_vertGenericAdaptorBase; +public: + aarch64_sme_st1h_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1h_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1h_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1h_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1h_vertAdaptor : public aarch64_sme_st1h_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1h_vertGenericAdaptor::aarch64_sme_st1h_vertGenericAdaptor; + aarch64_sme_st1h_vertAdaptor(aarch64_sme_st1h_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1h_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1h_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_st1h_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1h.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1h_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1q_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1q_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1q_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1q_horizGenericAdaptorBase(aarch64_sme_st1q_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1q_horizGenericAdaptor : public detail::aarch64_sme_st1q_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1q_horizGenericAdaptorBase; +public: + aarch64_sme_st1q_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1q_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1q_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1q_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1q_horizAdaptor : public aarch64_sme_st1q_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1q_horizGenericAdaptor::aarch64_sme_st1q_horizGenericAdaptor; + aarch64_sme_st1q_horizAdaptor(aarch64_sme_st1q_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1q_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1q_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_st1q_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1q.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1q_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1q_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1q_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1q_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1q_vertGenericAdaptorBase(aarch64_sme_st1q_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1q_vertGenericAdaptor : public detail::aarch64_sme_st1q_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1q_vertGenericAdaptorBase; +public: + aarch64_sme_st1q_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1q_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1q_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1q_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1q_vertAdaptor : public aarch64_sme_st1q_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1q_vertGenericAdaptor::aarch64_sme_st1q_vertGenericAdaptor; + aarch64_sme_st1q_vertAdaptor(aarch64_sme_st1q_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1q_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1q_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_st1q_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1q.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1q_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1w_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1w_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1w_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1w_horizGenericAdaptorBase(aarch64_sme_st1w_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1w_horizGenericAdaptor : public detail::aarch64_sme_st1w_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1w_horizGenericAdaptorBase; +public: + aarch64_sme_st1w_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1w_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1w_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1w_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1w_horizAdaptor : public aarch64_sme_st1w_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1w_horizGenericAdaptor::aarch64_sme_st1w_horizGenericAdaptor; + aarch64_sme_st1w_horizAdaptor(aarch64_sme_st1w_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1w_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1w_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_st1w_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1w.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1w_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_st1w_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_st1w_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_st1w_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_st1w_vertGenericAdaptorBase(aarch64_sme_st1w_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_st1w_vertGenericAdaptor : public detail::aarch64_sme_st1w_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_st1w_vertGenericAdaptorBase; +public: + aarch64_sme_st1w_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_st1w_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_st1w_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_st1w_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_st1w_vertAdaptor : public aarch64_sme_st1w_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_st1w_vertGenericAdaptor::aarch64_sme_st1w_vertGenericAdaptor; + aarch64_sme_st1w_vertAdaptor(aarch64_sme_st1w_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_st1w_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_st1w_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_st1w_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.st1w.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_st1w_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_str declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_strGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_strGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_strGenericAdaptorBase(aarch64_sme_str op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_strGenericAdaptor : public detail::aarch64_sme_strGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_strGenericAdaptorBase; +public: + aarch64_sme_strGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_strGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_strGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_strGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_strAdaptor : public aarch64_sme_strGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_strGenericAdaptor::aarch64_sme_strGenericAdaptor; + aarch64_sme_strAdaptor(aarch64_sme_str op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_str : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_strAdaptor; + template + using GenericAdaptor = aarch64_sme_strGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.str"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_str) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_sumopa_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_sumopa_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_sumopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_sumopa_wideGenericAdaptorBase(aarch64_sme_sumopa_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_sumopa_wideGenericAdaptor : public detail::aarch64_sme_sumopa_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_sumopa_wideGenericAdaptorBase; +public: + aarch64_sme_sumopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_sumopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_sumopa_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_sumopa_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_sumopa_wideAdaptor : public aarch64_sme_sumopa_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_sumopa_wideGenericAdaptor::aarch64_sme_sumopa_wideGenericAdaptor; + aarch64_sme_sumopa_wideAdaptor(aarch64_sme_sumopa_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_sumopa_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_sumopa_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_sumopa_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.sumopa.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_sumopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_sumops_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_sumops_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_sumops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_sumops_wideGenericAdaptorBase(aarch64_sme_sumops_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_sumops_wideGenericAdaptor : public detail::aarch64_sme_sumops_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_sumops_wideGenericAdaptorBase; +public: + aarch64_sme_sumops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_sumops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_sumops_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_sumops_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_sumops_wideAdaptor : public aarch64_sme_sumops_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_sumops_wideGenericAdaptor::aarch64_sme_sumops_wideGenericAdaptor; + aarch64_sme_sumops_wideAdaptor(aarch64_sme_sumops_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_sumops_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_sumops_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_sumops_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.sumops.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_sumops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_umopa_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_umopa_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_umopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_umopa_wideGenericAdaptorBase(aarch64_sme_umopa_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_umopa_wideGenericAdaptor : public detail::aarch64_sme_umopa_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_umopa_wideGenericAdaptorBase; +public: + aarch64_sme_umopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_umopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_umopa_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_umopa_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_umopa_wideAdaptor : public aarch64_sme_umopa_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_umopa_wideGenericAdaptor::aarch64_sme_umopa_wideGenericAdaptor; + aarch64_sme_umopa_wideAdaptor(aarch64_sme_umopa_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_umopa_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_umopa_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_umopa_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.umopa.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_umopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_umops_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_umops_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_umops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_umops_wideGenericAdaptorBase(aarch64_sme_umops_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_umops_wideGenericAdaptor : public detail::aarch64_sme_umops_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_umops_wideGenericAdaptorBase; +public: + aarch64_sme_umops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_umops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_umops_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_umops_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_umops_wideAdaptor : public aarch64_sme_umops_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_umops_wideGenericAdaptor::aarch64_sme_umops_wideGenericAdaptor; + aarch64_sme_umops_wideAdaptor(aarch64_sme_umops_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_umops_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_umops_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_umops_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.umops.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_umops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_usmopa_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_usmopa_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_usmopa_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_usmopa_wideGenericAdaptorBase(aarch64_sme_usmopa_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_usmopa_wideGenericAdaptor : public detail::aarch64_sme_usmopa_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_usmopa_wideGenericAdaptorBase; +public: + aarch64_sme_usmopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_usmopa_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_usmopa_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_usmopa_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_usmopa_wideAdaptor : public aarch64_sme_usmopa_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_usmopa_wideGenericAdaptor::aarch64_sme_usmopa_wideGenericAdaptor; + aarch64_sme_usmopa_wideAdaptor(aarch64_sme_usmopa_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_usmopa_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_usmopa_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_usmopa_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.usmopa.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_usmopa_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_usmops_wide declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_usmops_wideGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_usmops_wideGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_usmops_wideGenericAdaptorBase(aarch64_sme_usmops_wide op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_usmops_wideGenericAdaptor : public detail::aarch64_sme_usmops_wideGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_usmops_wideGenericAdaptorBase; +public: + aarch64_sme_usmops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_usmops_wideGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_usmops_wideGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_usmops_wideGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_usmops_wideAdaptor : public aarch64_sme_usmops_wideGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_usmops_wideGenericAdaptor::aarch64_sme_usmops_wideGenericAdaptor; + aarch64_sme_usmops_wideAdaptor(aarch64_sme_usmops_wide op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_usmops_wide : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_usmops_wideAdaptor; + template + using GenericAdaptor = aarch64_sme_usmops_wideGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.usmops.wide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2, ::mlir::Value odsArg_3, ::mlir::Value odsArg_4); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_usmops_wide) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_write_horiz declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_write_horizGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_write_horizGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_write_horizGenericAdaptorBase(aarch64_sme_write_horiz op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_write_horizGenericAdaptor : public detail::aarch64_sme_write_horizGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_write_horizGenericAdaptorBase; +public: + aarch64_sme_write_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_write_horizGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_write_horizGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_write_horizGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPg() { + return (*getODSOperands(2).begin()); + } + + ValueT getVector() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_write_horizAdaptor : public aarch64_sme_write_horizGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_write_horizGenericAdaptor::aarch64_sme_write_horizGenericAdaptor; + aarch64_sme_write_horizAdaptor(aarch64_sme_write_horiz op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_write_horiz : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_write_horizAdaptor; + template + using GenericAdaptor = aarch64_sme_write_horizGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.write.horiz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getPg(); + ::mlir::TypedValue<::mlir::VectorType> getVector(); + ::mlir::OpOperand &getPgMutable(); + ::mlir::OpOperand &getVectorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value pg, ::mlir::Value vector); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value pg, ::mlir::Value vector); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_write_horiz) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_write_vert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_write_vertGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_write_vertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_write_vertGenericAdaptorBase(aarch64_sme_write_vert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_write_vertGenericAdaptor : public detail::aarch64_sme_write_vertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_write_vertGenericAdaptorBase; +public: + aarch64_sme_write_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_write_vertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_write_vertGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_write_vertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPg() { + return (*getODSOperands(2).begin()); + } + + ValueT getVector() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_write_vertAdaptor : public aarch64_sme_write_vertGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_write_vertGenericAdaptor::aarch64_sme_write_vertGenericAdaptor; + aarch64_sme_write_vertAdaptor(aarch64_sme_write_vert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_write_vert : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_write_vertAdaptor; + template + using GenericAdaptor = aarch64_sme_write_vertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.write.vert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getPg(); + ::mlir::TypedValue<::mlir::VectorType> getVector(); + ::mlir::OpOperand &getPgMutable(); + ::mlir::OpOperand &getVectorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value pg, ::mlir::Value vector); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value pg, ::mlir::Value vector); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_write_vert) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_za_disable declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_za_disableGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_za_disableGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_za_disableGenericAdaptorBase(aarch64_sme_za_disable op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_za_disableGenericAdaptor : public detail::aarch64_sme_za_disableGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_za_disableGenericAdaptorBase; +public: + aarch64_sme_za_disableGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_za_disableGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_za_disableGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_za_disableGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_za_disableAdaptor : public aarch64_sme_za_disableGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_za_disableGenericAdaptor::aarch64_sme_za_disableGenericAdaptor; + aarch64_sme_za_disableAdaptor(aarch64_sme_za_disable op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_za_disable : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_za_disableAdaptor; + template + using GenericAdaptor = aarch64_sme_za_disableGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.za.disable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_za_disable) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_za_enable declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_za_enableGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_za_enableGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_za_enableGenericAdaptorBase(aarch64_sme_za_enable op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_za_enableGenericAdaptor : public detail::aarch64_sme_za_enableGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_za_enableGenericAdaptorBase; +public: + aarch64_sme_za_enableGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_za_enableGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_za_enableGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_za_enableGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_za_enableAdaptor : public aarch64_sme_za_enableGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_za_enableGenericAdaptor::aarch64_sme_za_enableGenericAdaptor; + aarch64_sme_za_enableAdaptor(aarch64_sme_za_enable op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_za_enable : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_za_enableAdaptor; + template + using GenericAdaptor = aarch64_sme_za_enableGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.za.enable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_za_enable) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::aarch64_sme_zero declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class aarch64_sme_zeroGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + aarch64_sme_zeroGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + aarch64_sme_zeroGenericAdaptorBase(aarch64_sme_zero op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class aarch64_sme_zeroGenericAdaptor : public detail::aarch64_sme_zeroGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::aarch64_sme_zeroGenericAdaptorBase; +public: + aarch64_sme_zeroGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + aarch64_sme_zeroGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : aarch64_sme_zeroGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + aarch64_sme_zeroGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class aarch64_sme_zeroAdaptor : public aarch64_sme_zeroGenericAdaptor<::mlir::ValueRange> { +public: + using aarch64_sme_zeroGenericAdaptor::aarch64_sme_zeroGenericAdaptor; + aarch64_sme_zeroAdaptor(aarch64_sme_zero op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class aarch64_sme_zero : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = aarch64_sme_zeroAdaptor; + template + using GenericAdaptor = aarch64_sme_zeroGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.intr.zero"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::aarch64_sme_zero) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..a6e47f7806b3cfe3704a14c5fe988580eafda3d8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.cpp.inc @@ -0,0 +1,3201 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSMEOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::arm_sme::CastTileToVector, +::mlir::arm_sme::CastVectorToTile, +::mlir::arm_sme::GetTileID, +::mlir::arm_sme::LoadTileSliceOp, +::mlir::arm_sme::MoveTileSliceToVectorOp, +::mlir::arm_sme::MoveVectorToTileSliceOp, +::mlir::arm_sme::StoreTileSliceOp, +::mlir::arm_sme::TileLoadOp, +::mlir::arm_sme::TileStoreOp, +::mlir::arm_sme::ZeroOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arm_sme { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessInteger(8))) || ((type.isSignlessInteger(16))) || ((type.isSignlessInteger(32))) || ((type.isSignlessInteger(64))) || ((type.isSignlessInteger(128))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 8-bit signless integer or 16-bit signless integer or 32-bit signless integer or 64-bit signless integer or 128-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).allDimsScalable()))) && ((::llvm::cast<::mlir::VectorType>(type).getShape() == ArrayRef({16, 16})))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).allDimsScalable()))) && ((::llvm::cast<::mlir::VectorType>(type).getShape() == ArrayRef({8, 8})))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(16)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).allDimsScalable()))) && ((::llvm::cast<::mlir::VectorType>(type).getShape() == ArrayRef({4, 4})))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).allDimsScalable()))) && ((::llvm::cast<::mlir::VectorType>(type).getShape() == ArrayRef({2, 2})))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(64)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).allDimsScalable()))) && ((::llvm::cast<::mlir::VectorType>(type).getShape() == ArrayRef({1, 1})))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(128)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).allDimsScalable()))) && ((::llvm::cast<::mlir::VectorType>(type).getShape() == ArrayRef({8, 8})))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).allDimsScalable()))) && ((::llvm::cast<::mlir::VectorType>(type).getShape() == ArrayRef({8, 8})))) && ([](::mlir::Type elementType) { return (elementType.isBF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).allDimsScalable()))) && ((::llvm::cast<::mlir::VectorType>(type).getShape() == ArrayRef({4, 4})))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 2))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).allDimsScalable()))) && ((::llvm::cast<::mlir::VectorType>(type).getShape() == ArrayRef({2, 2})))) && ([](::mlir::Type elementType) { return (elementType.isF64()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector<[16]x[16]xi8> of 8-bit signless integer values or vector<[8]x[8]xi16> of 16-bit signless integer values or vector<[4]x[4]xi32> of 32-bit signless integer values or vector<[2]x[2]xi64> of 64-bit signless integer values or vector<[1]x[1]xi128> of 128-bit signless integer values or vector<[8]x[8]xf16> of 16-bit float values or vector<[8]x[8]xbf16> of bfloat16 type values or vector<[4]x[4]xf32> of 32-bit float values or vector<[2]x[2]xf64> of 64-bit float values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSMEOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 1))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignlessInteger(16))) || ((elementType.isSignlessInteger(32))) || ((elementType.isSignlessInteger(64))) || ((elementType.isSignlessInteger(128))) || ((elementType.isF16())) || ((elementType.isBF16())) || ((elementType.isF32())) || ((elementType.isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 1)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be of ranks 1scalable vector of 8-bit signless integer or 16-bit signless integer or 32-bit signless integer or 64-bit signless integer or 128-bit signless integer or 16-bit float or bfloat16 type or 32-bit float or 64-bit float values of length 16/8/4/2/1, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArmSMEOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::arm_sme::TileSliceLayoutAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Layout of a tile slice"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArmSMEOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ArmSMEOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::CastTileToVector definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CastTileToVectorGenericAdaptorBase::CastTileToVectorGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.cast_tile_to_vector", odsAttrs.getContext()); +} + +CastTileToVectorGenericAdaptorBase::CastTileToVectorGenericAdaptorBase(CastTileToVector op) : CastTileToVectorGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CastTileToVectorGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CastTileToVectorGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CastTileToVectorAdaptor::CastTileToVectorAdaptor(CastTileToVector op) : CastTileToVectorGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CastTileToVectorAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CastTileToVector::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CastTileToVector::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CastTileToVector::getTileId() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CastTileToVector::getTileIdMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CastTileToVector::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CastTileToVector::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CastTileToVector::getVector() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CastTileToVector::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type vector, ::mlir::Value tile_id) { + odsState.addOperands(tile_id); + odsState.addTypes(vector); +} + +void CastTileToVector::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tile_id) { + odsState.addOperands(tile_id); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CastTileToVector::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CastTileToVector::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(IntegerType::get((*this->getODSResults(0).begin()).getType().getContext(),::llvm::isa(::llvm::cast((*this->getODSResults(0).begin()).getType()).getElementType())? ::llvm::cast(::llvm::cast((*this->getODSResults(0).begin()).getType()).getElementType()).getWidth(): ::llvm::cast(::llvm::cast((*this->getODSResults(0).begin()).getType()).getElementType()).getWidth()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that `tile_id` has the same number of bits as elements in `vector`"); + return ::mlir::success(); +} + +::mlir::LogicalResult CastTileToVector::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void CastTileToVector::getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context) { + results.add(canonicalize); +} + +::mlir::ParseResult CastTileToVector::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tile_idRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tile_idOperands(tile_idRawOperands); ::llvm::SMLoc tile_idOperandsLoc; + (void)tile_idOperandsLoc; + ::mlir::Type tile_idRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tile_idTypes(tile_idRawTypes); + ::mlir::Type vectorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vectorTypes(vectorRawTypes); + + tile_idOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tile_idRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tile_idRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vectorRawTypes[0] = type; + } + result.addTypes(vectorTypes); + if (parser.resolveOperands(tile_idOperands, tile_idTypes, tile_idOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CastTileToVector::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTileId(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getTileId().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getVector().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CastTileToVector::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::CastTileToVector) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::CastVectorToTile definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CastVectorToTileGenericAdaptorBase::CastVectorToTileGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.cast_vector_to_tile", odsAttrs.getContext()); +} + +CastVectorToTileGenericAdaptorBase::CastVectorToTileGenericAdaptorBase(CastVectorToTile op) : CastVectorToTileGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CastVectorToTileGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CastVectorToTileGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CastVectorToTileAdaptor::CastVectorToTileAdaptor(CastVectorToTile op) : CastVectorToTileGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CastVectorToTileAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CastVectorToTile::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CastVectorToTile::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CastVectorToTile::getVector() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CastVectorToTile::getVectorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CastVectorToTile::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CastVectorToTile::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CastVectorToTile::getTileId() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CastVectorToTile::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tile_id, ::mlir::Value vector) { + odsState.addOperands(vector); + odsState.addTypes(tile_id); +} + +void CastVectorToTile::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector) { + odsState.addOperands(vector); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CastVectorToTile::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CastVectorToTile::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector) { + odsState.addOperands(vector); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CastVectorToTile::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CastVectorToTile::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CastVectorToTile::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CastVectorToTile::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(IntegerType::get((*this->getODSOperands(0).begin()).getType().getContext(),::llvm::isa(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType())? ::llvm::cast(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType()).getWidth(): ::llvm::cast(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType()).getWidth()), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that `tile_id` has the same number of bits as elements in `vector`"); + return ::mlir::success(); +} + +::mlir::LogicalResult CastVectorToTile::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void CastVectorToTile::getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context) { + results.add(canonicalize); +} + +::mlir::LogicalResult CastVectorToTile::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = IntegerType::get(operands[0].getType().getContext(),::llvm::isa(::llvm::cast(operands[0].getType()).getElementType())? ::llvm::cast(::llvm::cast(operands[0].getType()).getElementType()).getWidth(): ::llvm::cast(::llvm::cast(operands[0].getType()).getElementType()).getWidth()); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CastVectorToTile::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand vectorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(vectorRawOperands); ::llvm::SMLoc vectorOperandsLoc; + (void)vectorOperandsLoc; + ::mlir::Type vectorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vectorTypes(vectorRawTypes); + ::mlir::Type tile_idRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tile_idTypes(tile_idRawTypes); + + vectorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(vectorRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vectorRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tile_idRawTypes[0] = type; + } + result.addTypes(tile_idTypes); + if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CastVectorToTile::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getVector(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVector().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getTileId().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CastVectorToTile::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::CastVectorToTile) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::GetTileID definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetTileIDGenericAdaptorBase::GetTileIDGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.get_tile_id", odsAttrs.getContext()); +} + +GetTileIDGenericAdaptorBase::GetTileIDGenericAdaptorBase(GetTileID op) : GetTileIDGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetTileIDGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetTileIDGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GetTileIDAdaptor::GetTileIDAdaptor(GetTileID op) : GetTileIDGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetTileIDAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GetTileID::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetTileID::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GetTileID::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetTileID::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GetTileID::getTileId() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GetTileID::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tile_id) { + odsState.addTypes(tile_id); +} + +void GetTileID::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetTileID::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetTileID::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetTileID::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetTileID::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type tile_idRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tile_idTypes(tile_idRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tile_idRawTypes[0] = type; + } + result.addTypes(tile_idTypes); + return ::mlir::success(); +} + +void GetTileID::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getTileId().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::GetTileID) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::LoadTileSliceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LoadTileSliceOpGenericAdaptorBase::LoadTileSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.load_tile_slice", odsAttrs.getContext()); +} + +LoadTileSliceOpGenericAdaptorBase::LoadTileSliceOpGenericAdaptorBase(LoadTileSliceOp op) : LoadTileSliceOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LoadTileSliceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr LoadTileSliceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arm_sme::TileSliceLayoutAttr LoadTileSliceOpGenericAdaptorBase::getLayoutAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(getProperties().layout); + return attr; +} + +::mlir::arm_sme::TileSliceLayout LoadTileSliceOpGenericAdaptorBase::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +} // namespace detail +LoadTileSliceOpAdaptor::LoadTileSliceOpAdaptor(LoadTileSliceOp op) : LoadTileSliceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LoadTileSliceOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + + if (tblgen_layout && !((::llvm::isa<::mlir::arm_sme::TileSliceLayoutAttr>(tblgen_layout)))) + return emitError(loc, "'arm_sme.load_tile_slice' op ""attribute 'layout' failed to satisfy constraint: Layout of a tile slice"); + return ::mlir::success(); +} + +std::pair LoadTileSliceOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range LoadTileSliceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> LoadTileSliceOp::getBase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Value LoadTileSliceOp::getTile() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range LoadTileSliceOp::getIndices() { + return getODSOperands(2); +} + +::mlir::TypedValue<::mlir::IndexType> LoadTileSliceOp::getTileSliceIndex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &LoadTileSliceOp::getBaseMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LoadTileSliceOp::getTileMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange LoadTileSliceOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &LoadTileSliceOp::getTileSliceIndexMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair LoadTileSliceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LoadTileSliceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LoadTileSliceOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult LoadTileSliceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.layout; + auto attr = dict.get("layout"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for layout in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layout` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LoadTileSliceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.layout; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layout", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LoadTileSliceOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.layout.getAsOpaquePointer())); +} + +std::optional LoadTileSliceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "layout") + return prop.layout; + return std::nullopt; +} + +void LoadTileSliceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "layout") { + prop.layout = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LoadTileSliceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.layout) attrs.append("layout", prop.layout); +} + +::mlir::LogicalResult LoadTileSliceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLayoutAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArmSMEOps0(attr, "layout", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LoadTileSliceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.layout))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LoadTileSliceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.layout); +} + +::mlir::arm_sme::TileSliceLayoutAttr LoadTileSliceOp::getLayoutAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(getProperties().layout); +} + +::mlir::arm_sme::TileSliceLayout LoadTileSliceOp::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +void LoadTileSliceOp::setLayoutAttr(::mlir::arm_sme::TileSliceLayoutAttr attr) { + (*this)->setAttr(getLayoutAttrName(), attr); +} + +void LoadTileSliceOp::setLayout(::mlir::arm_sme::TileSliceLayout attrValue) { + (*this)->setAttr(getLayoutAttrName(), ::mlir::arm_sme::TileSliceLayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void LoadTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayoutAttr layout) { + odsState.addOperands(base); + odsState.addOperands(tile); + odsState.addOperands(indices); + odsState.addOperands(tile_slice_index); + if (layout) { + odsState.getOrAddProperties().layout = layout; + } + odsState.addTypes(result); +} + +void LoadTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayoutAttr layout) { + odsState.addOperands(base); + odsState.addOperands(tile); + odsState.addOperands(indices); + odsState.addOperands(tile_slice_index); + if (layout) { + odsState.getOrAddProperties().layout = layout; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LoadTileSliceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LoadTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayoutAttr layout) { + odsState.addOperands(base); + odsState.addOperands(tile); + odsState.addOperands(indices); + odsState.addOperands(tile_slice_index); + if (layout) { + odsState.getOrAddProperties().layout = layout; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LoadTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayout layout) { + odsState.addOperands(base); + odsState.addOperands(tile); + odsState.addOperands(indices); + odsState.addOperands(tile_slice_index); + odsState.getOrAddProperties().layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), layout); + odsState.addTypes(result); +} + +void LoadTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayout layout) { + odsState.addOperands(base); + odsState.addOperands(tile); + odsState.addOperands(indices); + odsState.addOperands(tile_slice_index); + odsState.getOrAddProperties().layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), layout); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LoadTileSliceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LoadTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayout layout) { + odsState.addOperands(base); + odsState.addOperands(tile); + odsState.addOperands(indices); + odsState.addOperands(tile_slice_index); + odsState.getOrAddProperties().layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), layout); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LoadTileSliceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void LoadTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LoadTileSliceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void LoadTileSliceOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.layout) + properties.layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal); +} + +::mlir::LogicalResult LoadTileSliceOp::verifyInvariantsImpl() { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArmSMEOps0(*this, tblgen_layout, "layout"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {tile, result} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult LoadTileSliceOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult LoadTileSliceOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[1].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult LoadTileSliceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand baseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(baseRawOperands); ::llvm::SMLoc baseOperandsLoc; + (void)baseOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand tileRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tileOperands(tileRawOperands); ::llvm::SMLoc tileOperandsLoc; + (void)tileOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand tile_slice_indexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tile_slice_indexOperands(tile_slice_indexRawOperands); ::llvm::SMLoc tile_slice_indexOperandsLoc; + (void)tile_slice_indexOperandsLoc; + ::mlir::arm_sme::TileSliceLayoutAttr layoutAttr; + ::mlir::Type baseRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> baseTypes(baseRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + baseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(baseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + tileOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tileRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + tile_slice_indexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tile_slice_indexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalComma())) { + + if (parser.parseCustomAttributeWithFallback(layoutAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (layoutAttr) result.getOrAddProperties().layout = layoutAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + baseRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resultTypes); + if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tileOperands, resultTypes[0], tileOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tile_slice_indexOperands, odsBuildableType0, tile_slice_indexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LoadTileSliceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBase(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTile(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTileSliceIndex(); + if (getLayoutAttr() && getLayoutAttr() != ::mlir::arm_sme::TileSliceLayoutAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal)) { + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printStrippedAttrOrType(getLayoutAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("layout"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getLayoutAttr(); + if(attr && (attr == ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal))) + elidedAttrs.push_back("layout"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBase().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::LoadTileSliceOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::MoveTileSliceToVectorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MoveTileSliceToVectorOpGenericAdaptorBase::MoveTileSliceToVectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.move_tile_slice_to_vector", odsAttrs.getContext()); +} + +MoveTileSliceToVectorOpGenericAdaptorBase::MoveTileSliceToVectorOpGenericAdaptorBase(MoveTileSliceToVectorOp op) : MoveTileSliceToVectorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MoveTileSliceToVectorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MoveTileSliceToVectorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MoveTileSliceToVectorOpAdaptor::MoveTileSliceToVectorOpAdaptor(MoveTileSliceToVectorOp op) : MoveTileSliceToVectorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MoveTileSliceToVectorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MoveTileSliceToVectorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MoveTileSliceToVectorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MoveTileSliceToVectorOp::getTile() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MoveTileSliceToVectorOp::getTileSliceIndex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MoveTileSliceToVectorOp::getTileMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MoveTileSliceToVectorOp::getTileSliceIndexMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MoveTileSliceToVectorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MoveTileSliceToVectorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> MoveTileSliceToVectorOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void MoveTileSliceToVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value tile, ::mlir::Value tile_slice_index) { + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + odsState.addTypes(result); +} + +void MoveTileSliceToVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tile, ::mlir::Value tile_slice_index) { + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MoveTileSliceToVectorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MoveTileSliceToVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tile, ::mlir::Value tile_slice_index) { + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MoveTileSliceToVectorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MoveTileSliceToVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MoveTileSliceToVectorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MoveTileSliceToVectorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(VectorType(VectorType::Builder(::llvm::cast((*this->getODSOperands(0).begin()).getType())).dropDim(0)), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that type of 'result' matches type of 'tile' slice"); + return ::mlir::success(); +} + +::mlir::LogicalResult MoveTileSliceToVectorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MoveTileSliceToVectorOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = VectorType(VectorType::Builder(::llvm::cast(operands[0].getType())).dropDim(0)); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MoveTileSliceToVectorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tileRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tileOperands(tileRawOperands); ::llvm::SMLoc tileOperandsLoc; + (void)tileOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand tile_slice_indexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tile_slice_indexOperands(tile_slice_indexRawOperands); ::llvm::SMLoc tile_slice_indexOperandsLoc; + (void)tile_slice_indexOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + ::mlir::Type tileRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tileTypes(tileRawTypes); + + tileOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tileRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + tile_slice_indexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tile_slice_indexRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + if (parser.parseKeyword("from")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tileRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resultTypes); + if (parser.resolveOperands(tileOperands, tileTypes, tileOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tile_slice_indexOperands, odsBuildableType0, tile_slice_indexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MoveTileSliceToVectorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTile(); + _odsPrinter << "["; + _odsPrinter << getTileSliceIndex(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "from"; + _odsPrinter << ' '; + { + auto type = getTile().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MoveTileSliceToVectorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::MoveTileSliceToVectorOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::MoveVectorToTileSliceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MoveVectorToTileSliceOpGenericAdaptorBase::MoveVectorToTileSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.move_vector_to_tile_slice", odsAttrs.getContext()); +} + +MoveVectorToTileSliceOpGenericAdaptorBase::MoveVectorToTileSliceOpGenericAdaptorBase(MoveVectorToTileSliceOp op) : MoveVectorToTileSliceOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MoveVectorToTileSliceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MoveVectorToTileSliceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MoveVectorToTileSliceOpAdaptor::MoveVectorToTileSliceOpAdaptor(MoveVectorToTileSliceOp op) : MoveVectorToTileSliceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MoveVectorToTileSliceOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MoveVectorToTileSliceOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MoveVectorToTileSliceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> MoveVectorToTileSliceOp::getVector() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::Value MoveVectorToTileSliceOp::getTile() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MoveVectorToTileSliceOp::getTileSliceIndex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MoveVectorToTileSliceOp::getVectorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MoveVectorToTileSliceOp::getTileMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MoveVectorToTileSliceOp::getTileSliceIndexMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MoveVectorToTileSliceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MoveVectorToTileSliceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MoveVectorToTileSliceOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MoveVectorToTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value tile, ::mlir::Value tile_slice_index) { + odsState.addOperands(vector); + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + odsState.addTypes(result); +} + +void MoveVectorToTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value tile, ::mlir::Value tile_slice_index) { + odsState.addOperands(vector); + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MoveVectorToTileSliceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MoveVectorToTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value tile, ::mlir::Value tile_slice_index) { + odsState.addOperands(vector); + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MoveVectorToTileSliceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MoveVectorToTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MoveVectorToTileSliceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MoveVectorToTileSliceOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {tile, result} have same type"); + if (!((std::equal_to<>()(VectorType::get(::llvm::cast((*this->getODSOperands(1).begin()).getType()).getShape().drop_front(),::llvm::cast((*this->getODSOperands(1).begin()).getType()).getElementType(),/*scalableDims=*/{true}), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that type of 'vector' matches type of 'tile' slice"); + return ::mlir::success(); +} + +::mlir::LogicalResult MoveVectorToTileSliceOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MoveVectorToTileSliceOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[1].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MoveVectorToTileSliceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand vectorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(vectorRawOperands); ::llvm::SMLoc vectorOperandsLoc; + (void)vectorOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand tileRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tileOperands(tileRawOperands); ::llvm::SMLoc tileOperandsLoc; + (void)tileOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand tile_slice_indexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tile_slice_indexOperands(tile_slice_indexRawOperands); ::llvm::SMLoc tile_slice_indexOperandsLoc; + (void)tile_slice_indexOperandsLoc; + ::mlir::Type vectorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vectorTypes(vectorRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + vectorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(vectorRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + tileOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tileRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + tile_slice_indexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tile_slice_indexRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vectorRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resultTypes); + if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tileOperands, resultTypes[0], tileOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tile_slice_indexOperands, odsBuildableType0, tile_slice_indexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MoveVectorToTileSliceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getVector(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTile(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTileSliceIndex(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVector().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::MoveVectorToTileSliceOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::StoreTileSliceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +StoreTileSliceOpGenericAdaptorBase::StoreTileSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.store_tile_slice", odsAttrs.getContext()); +} + +StoreTileSliceOpGenericAdaptorBase::StoreTileSliceOpGenericAdaptorBase(StoreTileSliceOp op) : StoreTileSliceOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair StoreTileSliceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr StoreTileSliceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arm_sme::TileSliceLayoutAttr StoreTileSliceOpGenericAdaptorBase::getLayoutAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(getProperties().layout); + return attr; +} + +::mlir::arm_sme::TileSliceLayout StoreTileSliceOpGenericAdaptorBase::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +} // namespace detail +StoreTileSliceOpAdaptor::StoreTileSliceOpAdaptor(StoreTileSliceOp op) : StoreTileSliceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult StoreTileSliceOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + + if (tblgen_layout && !((::llvm::isa<::mlir::arm_sme::TileSliceLayoutAttr>(tblgen_layout)))) + return emitError(loc, "'arm_sme.store_tile_slice' op ""attribute 'layout' failed to satisfy constraint: Layout of a tile slice"); + return ::mlir::success(); +} + +std::pair StoreTileSliceOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range StoreTileSliceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value StoreTileSliceOp::getTile() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> StoreTileSliceOp::getTileSliceIndex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> StoreTileSliceOp::getBase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(2).begin()); +} + +::mlir::Operation::operand_range StoreTileSliceOp::getIndices() { + return getODSOperands(3); +} + +::mlir::OpOperand &StoreTileSliceOp::getTileMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &StoreTileSliceOp::getTileSliceIndexMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &StoreTileSliceOp::getBaseMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange StoreTileSliceOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair StoreTileSliceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range StoreTileSliceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult StoreTileSliceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.layout; + auto attr = dict.get("layout"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for layout in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layout` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute StoreTileSliceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.layout; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layout", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code StoreTileSliceOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.layout.getAsOpaquePointer())); +} + +std::optional StoreTileSliceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "layout") + return prop.layout; + return std::nullopt; +} + +void StoreTileSliceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "layout") { + prop.layout = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void StoreTileSliceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.layout) attrs.append("layout", prop.layout); +} + +::mlir::LogicalResult StoreTileSliceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLayoutAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArmSMEOps0(attr, "layout", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult StoreTileSliceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.layout))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void StoreTileSliceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.layout); +} + +::mlir::arm_sme::TileSliceLayoutAttr StoreTileSliceOp::getLayoutAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(getProperties().layout); +} + +::mlir::arm_sme::TileSliceLayout StoreTileSliceOp::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +void StoreTileSliceOp::setLayoutAttr(::mlir::arm_sme::TileSliceLayoutAttr attr) { + (*this)->setAttr(getLayoutAttrName(), attr); +} + +void StoreTileSliceOp::setLayout(::mlir::arm_sme::TileSliceLayout attrValue) { + (*this)->setAttr(getLayoutAttrName(), ::mlir::arm_sme::TileSliceLayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void StoreTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tile, ::mlir::Value tile_slice_index, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout) { + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + odsState.addOperands(base); + odsState.addOperands(indices); + if (layout) { + odsState.getOrAddProperties().layout = layout; + } +} + +void StoreTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tile, ::mlir::Value tile_slice_index, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout) { + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + odsState.addOperands(base); + odsState.addOperands(indices); + if (layout) { + odsState.getOrAddProperties().layout = layout; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StoreTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tile, ::mlir::Value tile_slice_index, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout) { + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + odsState.addOperands(base); + odsState.addOperands(indices); + odsState.getOrAddProperties().layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), layout); +} + +void StoreTileSliceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tile, ::mlir::Value tile_slice_index, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout) { + odsState.addOperands(tile); + odsState.addOperands(tile_slice_index); + odsState.addOperands(base); + odsState.addOperands(indices); + odsState.getOrAddProperties().layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), layout); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StoreTileSliceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void StoreTileSliceOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.layout) + properties.layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal); +} + +::mlir::LogicalResult StoreTileSliceOp::verifyInvariantsImpl() { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArmSMEOps0(*this, tblgen_layout, "layout"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult StoreTileSliceOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult StoreTileSliceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tileRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tileOperands(tileRawOperands); ::llvm::SMLoc tileOperandsLoc; + (void)tileOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand tile_slice_indexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tile_slice_indexOperands(tile_slice_indexRawOperands); ::llvm::SMLoc tile_slice_indexOperandsLoc; + (void)tile_slice_indexOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand baseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(baseRawOperands); ::llvm::SMLoc baseOperandsLoc; + (void)baseOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::arm_sme::TileSliceLayoutAttr layoutAttr; + ::mlir::Type baseRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> baseTypes(baseRawTypes); + ::mlir::Type tileRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tileTypes(tileRawTypes); + + tileOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tileRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + tile_slice_indexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tile_slice_indexRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + baseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(baseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalComma())) { + + if (parser.parseCustomAttributeWithFallback(layoutAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (layoutAttr) result.getOrAddProperties().layout = layoutAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + baseRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tileRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(tileOperands, tileTypes, tileOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tile_slice_indexOperands, odsBuildableType0, tile_slice_indexOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void StoreTileSliceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTile(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTileSliceIndex(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBase(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getLayoutAttr() && getLayoutAttr() != ::mlir::arm_sme::TileSliceLayoutAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal)) { + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printStrippedAttrOrType(getLayoutAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("layout"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getLayoutAttr(); + if(attr && (attr == ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal))) + elidedAttrs.push_back("layout"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBase().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getTile().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void StoreTileSliceOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(2)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::StoreTileSliceOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::TileLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TileLoadOpGenericAdaptorBase::TileLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.tile_load", odsAttrs.getContext()); +} + +TileLoadOpGenericAdaptorBase::TileLoadOpGenericAdaptorBase(TileLoadOp op) : TileLoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TileLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr TileLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arm_sme::TileSliceLayoutAttr TileLoadOpGenericAdaptorBase::getLayoutAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(getProperties().layout); + return attr; +} + +::mlir::arm_sme::TileSliceLayout TileLoadOpGenericAdaptorBase::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +} // namespace detail +TileLoadOpAdaptor::TileLoadOpAdaptor(TileLoadOp op) : TileLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TileLoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + + if (tblgen_layout && !((::llvm::isa<::mlir::arm_sme::TileSliceLayoutAttr>(tblgen_layout)))) + return emitError(loc, "'arm_sme.tile_load' op ""attribute 'layout' failed to satisfy constraint: Layout of a tile slice"); + return ::mlir::success(); +} + +std::pair TileLoadOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range TileLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> TileLoadOp::getBase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range TileLoadOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &TileLoadOp::getBaseMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange TileLoadOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair TileLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TileLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TileLoadOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult TileLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.layout; + auto attr = dict.get("layout"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for layout in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layout` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TileLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.layout; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layout", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TileLoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.layout.getAsOpaquePointer())); +} + +std::optional TileLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "layout") + return prop.layout; + return std::nullopt; +} + +void TileLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "layout") { + prop.layout = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TileLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.layout) attrs.append("layout", prop.layout); +} + +::mlir::LogicalResult TileLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLayoutAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArmSMEOps0(attr, "layout", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TileLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.layout))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TileLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.layout); +} + +::mlir::arm_sme::TileSliceLayoutAttr TileLoadOp::getLayoutAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(getProperties().layout); +} + +::mlir::arm_sme::TileSliceLayout TileLoadOp::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +void TileLoadOp::setLayoutAttr(::mlir::arm_sme::TileSliceLayoutAttr attr) { + (*this)->setAttr(getLayoutAttrName(), attr); +} + +void TileLoadOp::setLayout(::mlir::arm_sme::TileSliceLayout attrValue) { + (*this)->setAttr(getLayoutAttrName(), ::mlir::arm_sme::TileSliceLayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void TileLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout) { + odsState.addOperands(base); + odsState.addOperands(indices); + if (layout) { + odsState.getOrAddProperties().layout = layout; + } + odsState.addTypes(result); +} + +void TileLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout) { + odsState.addOperands(base); + odsState.addOperands(indices); + if (layout) { + odsState.getOrAddProperties().layout = layout; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout) { + odsState.addOperands(base); + odsState.addOperands(indices); + odsState.getOrAddProperties().layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), layout); + odsState.addTypes(result); +} + +void TileLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout) { + odsState.addOperands(base); + odsState.addOperands(indices); + odsState.getOrAddProperties().layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), layout); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void TileLoadOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.layout) + properties.layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal); +} + +::mlir::LogicalResult TileLoadOp::verifyInvariantsImpl() { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArmSMEOps0(*this, tblgen_layout, "layout"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TileLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TileLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand baseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(baseRawOperands); ::llvm::SMLoc baseOperandsLoc; + (void)baseOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::arm_sme::TileSliceLayoutAttr layoutAttr; + ::mlir::Type baseRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> baseTypes(baseRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + baseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(baseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalComma())) { + + if (parser.parseCustomAttributeWithFallback(layoutAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (layoutAttr) result.getOrAddProperties().layout = layoutAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + baseRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resultTypes); + if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TileLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBase(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getLayoutAttr() && getLayoutAttr() != ::mlir::arm_sme::TileSliceLayoutAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal)) { + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printStrippedAttrOrType(getLayoutAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("layout"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getLayoutAttr(); + if(attr && (attr == ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal))) + elidedAttrs.push_back("layout"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBase().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TileLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::TileLoadOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::TileStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TileStoreOpGenericAdaptorBase::TileStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.tile_store", odsAttrs.getContext()); +} + +TileStoreOpGenericAdaptorBase::TileStoreOpGenericAdaptorBase(TileStoreOp op) : TileStoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TileStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr TileStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arm_sme::TileSliceLayoutAttr TileStoreOpGenericAdaptorBase::getLayoutAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(getProperties().layout); + return attr; +} + +::mlir::arm_sme::TileSliceLayout TileStoreOpGenericAdaptorBase::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +} // namespace detail +TileStoreOpAdaptor::TileStoreOpAdaptor(TileStoreOp op) : TileStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TileStoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + + if (tblgen_layout && !((::llvm::isa<::mlir::arm_sme::TileSliceLayoutAttr>(tblgen_layout)))) + return emitError(loc, "'arm_sme.tile_store' op ""attribute 'layout' failed to satisfy constraint: Layout of a tile slice"); + return ::mlir::success(); +} + +std::pair TileStoreOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range TileStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TileStoreOp::getValueToStore() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> TileStoreOp::getBase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range TileStoreOp::getIndices() { + return getODSOperands(2); +} + +::mlir::OpOperand &TileStoreOp::getValueToStoreMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &TileStoreOp::getBaseMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange TileStoreOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair TileStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TileStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult TileStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.layout; + auto attr = dict.get("layout"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for layout in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layout` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TileStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.layout; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layout", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TileStoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.layout.getAsOpaquePointer())); +} + +std::optional TileStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "layout") + return prop.layout; + return std::nullopt; +} + +void TileStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "layout") { + prop.layout = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TileStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.layout) attrs.append("layout", prop.layout); +} + +::mlir::LogicalResult TileStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLayoutAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ArmSMEOps0(attr, "layout", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TileStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.layout))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TileStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.layout); +} + +::mlir::arm_sme::TileSliceLayoutAttr TileStoreOp::getLayoutAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(getProperties().layout); +} + +::mlir::arm_sme::TileSliceLayout TileStoreOp::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +void TileStoreOp::setLayoutAttr(::mlir::arm_sme::TileSliceLayoutAttr attr) { + (*this)->setAttr(getLayoutAttrName(), attr); +} + +void TileStoreOp::setLayout(::mlir::arm_sme::TileSliceLayout attrValue) { + (*this)->setAttr(getLayoutAttrName(), ::mlir::arm_sme::TileSliceLayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void TileStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value valueToStore, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout) { + odsState.addOperands(valueToStore); + odsState.addOperands(base); + odsState.addOperands(indices); + if (layout) { + odsState.getOrAddProperties().layout = layout; + } +} + +void TileStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value valueToStore, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout) { + odsState.addOperands(valueToStore); + odsState.addOperands(base); + odsState.addOperands(indices); + if (layout) { + odsState.getOrAddProperties().layout = layout; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value valueToStore, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout) { + odsState.addOperands(valueToStore); + odsState.addOperands(base); + odsState.addOperands(indices); + odsState.getOrAddProperties().layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), layout); +} + +void TileStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value valueToStore, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout) { + odsState.addOperands(valueToStore); + odsState.addOperands(base); + odsState.addOperands(indices); + odsState.getOrAddProperties().layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), layout); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TileStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void TileStoreOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.layout) + properties.layout = ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal); +} + +::mlir::LogicalResult TileStoreOp::verifyInvariantsImpl() { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ArmSMEOps0(*this, tblgen_layout, "layout"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TileStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TileStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueToStoreRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueToStoreOperands(valueToStoreRawOperands); ::llvm::SMLoc valueToStoreOperandsLoc; + (void)valueToStoreOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand baseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(baseRawOperands); ::llvm::SMLoc baseOperandsLoc; + (void)baseOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::arm_sme::TileSliceLayoutAttr layoutAttr; + ::mlir::Type baseRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> baseTypes(baseRawTypes); + ::mlir::Type valueToStoreRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueToStoreTypes(valueToStoreRawTypes); + + valueToStoreOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueToStoreRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + baseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(baseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalComma())) { + + if (parser.parseCustomAttributeWithFallback(layoutAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (layoutAttr) result.getOrAddProperties().layout = layoutAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + baseRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueToStoreRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(valueToStoreOperands, valueToStoreTypes, valueToStoreOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TileStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValueToStore(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBase(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + if (getLayoutAttr() && getLayoutAttr() != ::mlir::arm_sme::TileSliceLayoutAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal)) { + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printStrippedAttrOrType(getLayoutAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("layout"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getLayoutAttr(); + if(attr && (attr == ::mlir::arm_sme::TileSliceLayoutAttr::get(odsBuilder.getContext(), ::mlir::arm_sme::TileSliceLayout::Horizontal))) + elidedAttrs.push_back("layout"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBase().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getValueToStore().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TileStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::TileStoreOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::ZeroOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ZeroOpGenericAdaptorBase::ZeroOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sme.zero", odsAttrs.getContext()); +} + +ZeroOpGenericAdaptorBase::ZeroOpGenericAdaptorBase(ZeroOp op) : ZeroOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ZeroOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ZeroOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ZeroOpAdaptor::ZeroOpAdaptor(ZeroOp op) : ZeroOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ZeroOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ZeroOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ZeroOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ZeroOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ZeroOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ZeroOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ZeroOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ZeroOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSMEOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ZeroOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ZeroOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ZeroOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ZeroOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_sme +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sme::ZeroOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..d3ad4183c9440768d0f1a4a52fa8a31ca649b7c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOps.h.inc @@ -0,0 +1,1433 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSMEOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace arm_sme { +class CastTileToVector; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class CastVectorToTile; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class GetTileID; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class LoadTileSliceOp; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class MoveTileSliceToVectorOp; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class MoveVectorToTileSliceOp; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class StoreTileSliceOp; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class TileLoadOp; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class TileStoreOp; +} // namespace arm_sme +} // namespace mlir +namespace mlir { +namespace arm_sme { +class ZeroOp; +} // namespace arm_sme +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::CastTileToVector declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CastTileToVectorGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CastTileToVectorGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CastTileToVectorGenericAdaptorBase(CastTileToVector op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CastTileToVectorGenericAdaptor : public detail::CastTileToVectorGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CastTileToVectorGenericAdaptorBase; +public: + CastTileToVectorGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CastTileToVectorGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CastTileToVectorGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CastTileToVectorGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTileId() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CastTileToVectorAdaptor : public CastTileToVectorGenericAdaptor<::mlir::ValueRange> { +public: + using CastTileToVectorGenericAdaptor::CastTileToVectorGenericAdaptor; + CastTileToVectorAdaptor(CastTileToVector op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CastTileToVector : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CastTileToVectorAdaptor; + template + using GenericAdaptor = CastTileToVectorGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.cast_tile_to_vector"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getTileId(); + ::mlir::OpOperand &getTileIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getVector(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type vector, ::mlir::Value tile_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tile_id); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult canonicalize(CastTileToVector op, ::mlir::PatternRewriter &rewriter); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::CastTileToVector) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::CastVectorToTile declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CastVectorToTileGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CastVectorToTileGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CastVectorToTileGenericAdaptorBase(CastVectorToTile op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CastVectorToTileGenericAdaptor : public detail::CastVectorToTileGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CastVectorToTileGenericAdaptorBase; +public: + CastVectorToTileGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CastVectorToTileGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CastVectorToTileGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CastVectorToTileGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVector() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CastVectorToTileAdaptor : public CastVectorToTileGenericAdaptor<::mlir::ValueRange> { +public: + using CastVectorToTileGenericAdaptor::CastVectorToTileGenericAdaptor; + CastVectorToTileAdaptor(CastVectorToTile op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CastVectorToTile : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CastVectorToTileAdaptor; + template + using GenericAdaptor = CastVectorToTileGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.cast_vector_to_tile"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVector(); + ::mlir::OpOperand &getVectorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getTileId(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tile_id, ::mlir::Value vector); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult canonicalize(CastVectorToTile op, ::mlir::PatternRewriter &rewriter); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::CastVectorToTile) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::GetTileID declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetTileIDGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetTileIDGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetTileIDGenericAdaptorBase(GetTileID op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetTileIDGenericAdaptor : public detail::GetTileIDGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetTileIDGenericAdaptorBase; +public: + GetTileIDGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetTileIDGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetTileIDGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetTileIDGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetTileIDAdaptor : public GetTileIDGenericAdaptor<::mlir::ValueRange> { +public: + using GetTileIDGenericAdaptor::GetTileIDGenericAdaptor; + GetTileIDAdaptor(GetTileID op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetTileID : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetTileIDAdaptor; + template + using GenericAdaptor = GetTileIDGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.get_tile_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getTileId(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tile_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::GetTileID) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::LoadTileSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTileSliceOpGenericAdaptorBase { +public: + struct Properties { + using layoutTy = ::mlir::arm_sme::TileSliceLayoutAttr; + layoutTy layout; + + auto getLayout() { + auto &propStorage = this->layout; + return ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(propStorage); + } + void setLayout(const ::mlir::arm_sme::TileSliceLayoutAttr &propValue) { + this->layout = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.layout == this->layout && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LoadTileSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTileSliceOpGenericAdaptorBase(LoadTileSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arm_sme::TileSliceLayoutAttr getLayoutAttr(); + ::mlir::arm_sme::TileSliceLayout getLayout(); +}; +} // namespace detail +template +class LoadTileSliceOpGenericAdaptor : public detail::LoadTileSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTileSliceOpGenericAdaptorBase; +public: + LoadTileSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTileSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTileSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LoadTileSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBase() { + return (*getODSOperands(0).begin()); + } + + ValueT getTile() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + ValueT getTileSliceIndex() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTileSliceOpAdaptor : public LoadTileSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTileSliceOpGenericAdaptor::LoadTileSliceOpGenericAdaptor; + LoadTileSliceOpAdaptor(LoadTileSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTileSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTileSliceOpAdaptor; + template + using GenericAdaptor = LoadTileSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("layout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLayoutAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.load_tile_slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getBase(); + ::mlir::Value getTile(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::TypedValue<::mlir::IndexType> getTileSliceIndex(); + ::mlir::OpOperand &getBaseMutable(); + ::mlir::OpOperand &getTileMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::OpOperand &getTileSliceIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arm_sme::TileSliceLayoutAttr getLayoutAttr(); + ::mlir::arm_sme::TileSliceLayout getLayout(); + void setLayoutAttr(::mlir::arm_sme::TileSliceLayoutAttr attr); + void setLayout(::mlir::arm_sme::TileSliceLayout attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayout layout = ::mlir::arm_sme::TileSliceLayout::Horizontal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayout layout = ::mlir::arm_sme::TileSliceLayout::Horizontal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value tile, ::mlir::ValueRange indices, ::mlir::Value tile_slice_index, ::mlir::arm_sme::TileSliceLayout layout = ::mlir::arm_sme::TileSliceLayout::Horizontal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + MemRefType getMemRefType() { + return ::llvm::cast(getBase().getType()); + } + VectorType getVectorType() { + return ::llvm::cast(getResult().getType()); + } +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::LoadTileSliceOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::MoveTileSliceToVectorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MoveTileSliceToVectorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MoveTileSliceToVectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MoveTileSliceToVectorOpGenericAdaptorBase(MoveTileSliceToVectorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MoveTileSliceToVectorOpGenericAdaptor : public detail::MoveTileSliceToVectorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MoveTileSliceToVectorOpGenericAdaptorBase; +public: + MoveTileSliceToVectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MoveTileSliceToVectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MoveTileSliceToVectorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MoveTileSliceToVectorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTile() { + return (*getODSOperands(0).begin()); + } + + ValueT getTileSliceIndex() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MoveTileSliceToVectorOpAdaptor : public MoveTileSliceToVectorOpGenericAdaptor<::mlir::ValueRange> { +public: + using MoveTileSliceToVectorOpGenericAdaptor::MoveTileSliceToVectorOpGenericAdaptor; + MoveTileSliceToVectorOpAdaptor(MoveTileSliceToVectorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MoveTileSliceToVectorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MoveTileSliceToVectorOpAdaptor; + template + using GenericAdaptor = MoveTileSliceToVectorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.move_tile_slice_to_vector"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getTile(); + ::mlir::TypedValue<::mlir::IndexType> getTileSliceIndex(); + ::mlir::OpOperand &getTileMutable(); + ::mlir::OpOperand &getTileSliceIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value tile, ::mlir::Value tile_slice_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tile, ::mlir::Value tile_slice_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tile, ::mlir::Value tile_slice_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + VectorType getSliceType() { return getResult().getType(); } +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::MoveTileSliceToVectorOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::MoveVectorToTileSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MoveVectorToTileSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MoveVectorToTileSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MoveVectorToTileSliceOpGenericAdaptorBase(MoveVectorToTileSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MoveVectorToTileSliceOpGenericAdaptor : public detail::MoveVectorToTileSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MoveVectorToTileSliceOpGenericAdaptorBase; +public: + MoveVectorToTileSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MoveVectorToTileSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MoveVectorToTileSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MoveVectorToTileSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVector() { + return (*getODSOperands(0).begin()); + } + + ValueT getTile() { + return (*getODSOperands(1).begin()); + } + + ValueT getTileSliceIndex() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MoveVectorToTileSliceOpAdaptor : public MoveVectorToTileSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using MoveVectorToTileSliceOpGenericAdaptor::MoveVectorToTileSliceOpGenericAdaptor; + MoveVectorToTileSliceOpAdaptor(MoveVectorToTileSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MoveVectorToTileSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MoveVectorToTileSliceOpAdaptor; + template + using GenericAdaptor = MoveVectorToTileSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.move_vector_to_tile_slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getVector(); + ::mlir::Value getTile(); + ::mlir::TypedValue<::mlir::IndexType> getTileSliceIndex(); + ::mlir::OpOperand &getVectorMutable(); + ::mlir::OpOperand &getTileMutable(); + ::mlir::OpOperand &getTileSliceIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value vector, ::mlir::Value tile, ::mlir::Value tile_slice_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value tile, ::mlir::Value tile_slice_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value tile, ::mlir::Value tile_slice_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + VectorType getTileType() { + return ::llvm::cast(getTile().getType()); + } +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::MoveVectorToTileSliceOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::StoreTileSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StoreTileSliceOpGenericAdaptorBase { +public: + struct Properties { + using layoutTy = ::mlir::arm_sme::TileSliceLayoutAttr; + layoutTy layout; + + auto getLayout() { + auto &propStorage = this->layout; + return ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(propStorage); + } + void setLayout(const ::mlir::arm_sme::TileSliceLayoutAttr &propValue) { + this->layout = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.layout == this->layout && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + StoreTileSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + StoreTileSliceOpGenericAdaptorBase(StoreTileSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arm_sme::TileSliceLayoutAttr getLayoutAttr(); + ::mlir::arm_sme::TileSliceLayout getLayout(); +}; +} // namespace detail +template +class StoreTileSliceOpGenericAdaptor : public detail::StoreTileSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StoreTileSliceOpGenericAdaptorBase; +public: + StoreTileSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StoreTileSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StoreTileSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + StoreTileSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTile() { + return (*getODSOperands(0).begin()); + } + + ValueT getTileSliceIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getBase() { + return (*getODSOperands(2).begin()); + } + + RangeT getIndices() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StoreTileSliceOpAdaptor : public StoreTileSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using StoreTileSliceOpGenericAdaptor::StoreTileSliceOpGenericAdaptor; + StoreTileSliceOpAdaptor(StoreTileSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StoreTileSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StoreTileSliceOpAdaptor; + template + using GenericAdaptor = StoreTileSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("layout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLayoutAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.store_tile_slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getTile(); + ::mlir::TypedValue<::mlir::IndexType> getTileSliceIndex(); + ::mlir::TypedValue<::mlir::MemRefType> getBase(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getTileMutable(); + ::mlir::OpOperand &getTileSliceIndexMutable(); + ::mlir::OpOperand &getBaseMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arm_sme::TileSliceLayoutAttr getLayoutAttr(); + ::mlir::arm_sme::TileSliceLayout getLayout(); + void setLayoutAttr(::mlir::arm_sme::TileSliceLayoutAttr attr); + void setLayout(::mlir::arm_sme::TileSliceLayout attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tile, ::mlir::Value tile_slice_index, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tile, ::mlir::Value tile_slice_index, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tile, ::mlir::Value tile_slice_index, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout = ::mlir::arm_sme::TileSliceLayout::Horizontal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tile, ::mlir::Value tile_slice_index, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout = ::mlir::arm_sme::TileSliceLayout::Horizontal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + MemRefType getMemRefType() { + return ::llvm::cast(getBase().getType()); + } + VectorType getVectorType() { + return ::llvm::cast(getTile().getType()); + } +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::StoreTileSliceOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::TileLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TileLoadOpGenericAdaptorBase { +public: + struct Properties { + using layoutTy = ::mlir::arm_sme::TileSliceLayoutAttr; + layoutTy layout; + + auto getLayout() { + auto &propStorage = this->layout; + return ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(propStorage); + } + void setLayout(const ::mlir::arm_sme::TileSliceLayoutAttr &propValue) { + this->layout = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.layout == this->layout && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TileLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TileLoadOpGenericAdaptorBase(TileLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arm_sme::TileSliceLayoutAttr getLayoutAttr(); + ::mlir::arm_sme::TileSliceLayout getLayout(); +}; +} // namespace detail +template +class TileLoadOpGenericAdaptor : public detail::TileLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TileLoadOpGenericAdaptorBase; +public: + TileLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TileLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TileLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TileLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBase() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TileLoadOpAdaptor : public TileLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using TileLoadOpGenericAdaptor::TileLoadOpGenericAdaptor; + TileLoadOpAdaptor(TileLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TileLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TileLoadOpAdaptor; + template + using GenericAdaptor = TileLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("layout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLayoutAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.tile_load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getBase(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getBaseMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arm_sme::TileSliceLayoutAttr getLayoutAttr(); + ::mlir::arm_sme::TileSliceLayout getLayout(); + void setLayoutAttr(::mlir::arm_sme::TileSliceLayoutAttr attr); + void setLayout(::mlir::arm_sme::TileSliceLayout attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout = ::mlir::arm_sme::TileSliceLayout::Horizontal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout = ::mlir::arm_sme::TileSliceLayout::Horizontal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + MemRefType getMemRefType() { + return ::llvm::cast(getBase().getType()); + } + VectorType getVectorType() { + return ::llvm::cast(getResult().getType()); + } +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::TileLoadOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::TileStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TileStoreOpGenericAdaptorBase { +public: + struct Properties { + using layoutTy = ::mlir::arm_sme::TileSliceLayoutAttr; + layoutTy layout; + + auto getLayout() { + auto &propStorage = this->layout; + return ::llvm::dyn_cast_or_null<::mlir::arm_sme::TileSliceLayoutAttr>(propStorage); + } + void setLayout(const ::mlir::arm_sme::TileSliceLayoutAttr &propValue) { + this->layout = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.layout == this->layout && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TileStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TileStoreOpGenericAdaptorBase(TileStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arm_sme::TileSliceLayoutAttr getLayoutAttr(); + ::mlir::arm_sme::TileSliceLayout getLayout(); +}; +} // namespace detail +template +class TileStoreOpGenericAdaptor : public detail::TileStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TileStoreOpGenericAdaptorBase; +public: + TileStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TileStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TileStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TileStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValueToStore() { + return (*getODSOperands(0).begin()); + } + + ValueT getBase() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TileStoreOpAdaptor : public TileStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using TileStoreOpGenericAdaptor::TileStoreOpGenericAdaptor; + TileStoreOpAdaptor(TileStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TileStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TileStoreOpAdaptor; + template + using GenericAdaptor = TileStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("layout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLayoutAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.tile_store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValueToStore(); + ::mlir::TypedValue<::mlir::MemRefType> getBase(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getValueToStoreMutable(); + ::mlir::OpOperand &getBaseMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arm_sme::TileSliceLayoutAttr getLayoutAttr(); + ::mlir::arm_sme::TileSliceLayout getLayout(); + void setLayoutAttr(::mlir::arm_sme::TileSliceLayoutAttr attr); + void setLayout(::mlir::arm_sme::TileSliceLayout attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value valueToStore, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value valueToStore, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value valueToStore, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout = ::mlir::arm_sme::TileSliceLayout::Horizontal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value valueToStore, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::arm_sme::TileSliceLayout layout = ::mlir::arm_sme::TileSliceLayout::Horizontal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + MemRefType getMemRefType() { + return ::llvm::cast(getBase().getType()); + } + VectorType getVectorType() { + return ::llvm::cast(getValueToStore().getType()); + } +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::TileStoreOp) + +namespace mlir { +namespace arm_sme { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sme::ZeroOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ZeroOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ZeroOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ZeroOpGenericAdaptorBase(ZeroOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ZeroOpGenericAdaptor : public detail::ZeroOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ZeroOpGenericAdaptorBase; +public: + ZeroOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ZeroOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ZeroOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ZeroOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ZeroOpAdaptor : public ZeroOpGenericAdaptor<::mlir::ValueRange> { +public: + using ZeroOpGenericAdaptor::ZeroOpGenericAdaptor; + ZeroOpAdaptor(ZeroOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ZeroOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ZeroOpAdaptor; + template + using GenericAdaptor = ZeroOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sme.zero"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + VectorType getVectorType() { + return ::llvm::cast(getRes().getType()); + } +}; +} // namespace arm_sme +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sme::ZeroOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpsConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpsConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMETypes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMETypes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..dd8594b65636287fbbd7f58bdcf62a66e200f258 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMETypes.cpp.inc @@ -0,0 +1,8 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMETypes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMETypes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..1f2b1696791068cde3d3cc54fc19e78997a74cdb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMETypes.h.inc @@ -0,0 +1,19 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Transforms/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Transforms/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..ab5c179f2dd77901ac47c0d9eaa3fdb3d31d1e32 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Transforms/Passes.h @@ -0,0 +1,59 @@ +//===- Passes.h - Pass Entrypoints ------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARMSME_TRANSFORMS_PASSES_H +#define MLIR_DIALECT_ARMSME_TRANSFORMS_PASSES_H + +#include "mlir/Conversion/LLVMCommon/TypeConverter.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { + +class RewritePatternSet; + +namespace arm_sme { +//===----------------------------------------------------------------------===// +// The EnableArmStreaming pass. +//===----------------------------------------------------------------------===// +// Options for Armv9 Streaming SVE mode. By default, streaming-mode is part of +// the function interface (ABI) and the caller manages PSTATE.SM on entry/exit. +// In a locally streaming function PSTATE.SM is kept internal and the callee +// manages it on entry/exit. +enum class ArmStreaming { Default = 0, Locally = 1 }; + +#define GEN_PASS_DECL +#include "mlir/Dialect/ArmSME/Transforms/Passes.h.inc" + +/// Pass to enable Armv9 Streaming SVE mode. +std::unique_ptr +createEnableArmStreamingPass(const ArmStreaming mode = ArmStreaming::Default, + const bool enableZA = false); + +/// Pass that replaces 'arm_sme.get_tile_id' ops with actual tiles. +std::unique_ptr createTileAllocationPass(); + +//===----------------------------------------------------------------------===// +// Type ArmSMETypeConverter pass. +//===----------------------------------------------------------------------===// +class ArmSMETypeConverter : public LLVMTypeConverter { +public: + ArmSMETypeConverter(MLIRContext *ctx, const LowerToLLVMOptions &options); +}; + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/ArmSME/Transforms/Passes.h.inc" + +} // namespace arm_sme +} // namespace mlir + +#endif // MLIR_DIALECT_ARMSME_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Transforms/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Transforms/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..466d445256ea7c18b782225a39904f5a070c33b9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Transforms/Passes.h.inc @@ -0,0 +1,298 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ENABLEARMSTREAMING +#define GEN_PASS_DECL_TILEALLOCATION +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// EnableArmStreaming +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ENABLEARMSTREAMING +struct EnableArmStreamingOptions { + mlir::arm_sme::ArmStreaming mode = mlir::arm_sme::ArmStreaming::Default; + bool enableZA = false; +}; +#undef GEN_PASS_DECL_ENABLEARMSTREAMING +#endif // GEN_PASS_DECL_ENABLEARMSTREAMING +#ifdef GEN_PASS_DEF_ENABLEARMSTREAMING +namespace impl { + +template +class EnableArmStreamingBase : public ::mlir::OperationPass { +public: + using Base = EnableArmStreamingBase; + + EnableArmStreamingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EnableArmStreamingBase(const EnableArmStreamingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("enable-arm-streaming"); + } + ::llvm::StringRef getArgument() const override { return "enable-arm-streaming"; } + + ::llvm::StringRef getDescription() const override { return "Enable Armv9 Streaming SVE mode"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EnableArmStreaming"); + } + ::llvm::StringRef getName() const override { return "EnableArmStreaming"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EnableArmStreamingBase) + + EnableArmStreamingBase(const EnableArmStreamingOptions &options) : EnableArmStreamingBase() { + mode = options.mode; + enableZA = options.enableZA; + } +protected: + ::mlir::Pass::Option mode{*this, "mode", ::llvm::cl::desc("Select how streaming-mode is managed at the function-level."), ::llvm::cl::init(mlir::arm_sme::ArmStreaming::Default), ::llvm::cl::values( + clEnumValN(mlir::arm_sme::ArmStreaming::Default, "default", + "Streaming mode is part of the function interface " + "(ABI), caller manages PSTATE.SM on entry/exit."), + clEnumValN(mlir::arm_sme::ArmStreaming::Locally, "locally", + "Streaming mode is internal to the function, callee " + "manages PSTATE.SM on entry/exit.") + )}; + ::mlir::Pass::Option enableZA{*this, "enable-za", ::llvm::cl::desc("Enable ZA storage array."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ENABLEARMSTREAMING +#endif // GEN_PASS_DEF_ENABLEARMSTREAMING + +//===----------------------------------------------------------------------===// +// TileAllocation +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TILEALLOCATION +#undef GEN_PASS_DECL_TILEALLOCATION +#endif // GEN_PASS_DECL_TILEALLOCATION +#ifdef GEN_PASS_DEF_TILEALLOCATION +namespace impl { + +template +class TileAllocationBase : public ::mlir::OperationPass { +public: + using Base = TileAllocationBase; + + TileAllocationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TileAllocationBase(const TileAllocationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("allocate-arm-sme-tiles"); + } + ::llvm::StringRef getArgument() const override { return "allocate-arm-sme-tiles"; } + + ::llvm::StringRef getDescription() const override { return "Allocate SME tiles"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TileAllocation"); + } + ::llvm::StringRef getName() const override { return "TileAllocation"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TileAllocationBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TILEALLOCATION +#endif // GEN_PASS_DEF_TILEALLOCATION +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// EnableArmStreaming Registration +//===----------------------------------------------------------------------===// + +inline void registerEnableArmStreaming() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::arm_sme::createEnableArmStreamingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerEnableArmStreamingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::arm_sme::createEnableArmStreamingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TileAllocation Registration +//===----------------------------------------------------------------------===// + +inline void registerTileAllocation() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::arm_sme::createTileAllocationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTileAllocationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::arm_sme::createTileAllocationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ArmSME Registration +//===----------------------------------------------------------------------===// + +inline void registerArmSMEPasses() { + registerEnableArmStreaming(); + registerTileAllocation(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class EnableArmStreamingBase : public ::mlir::OperationPass { +public: + using Base = EnableArmStreamingBase; + + EnableArmStreamingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EnableArmStreamingBase(const EnableArmStreamingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("enable-arm-streaming"); + } + ::llvm::StringRef getArgument() const override { return "enable-arm-streaming"; } + + ::llvm::StringRef getDescription() const override { return "Enable Armv9 Streaming SVE mode"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EnableArmStreaming"); + } + ::llvm::StringRef getName() const override { return "EnableArmStreaming"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EnableArmStreamingBase) + +protected: + ::mlir::Pass::Option mode{*this, "mode", ::llvm::cl::desc("Select how streaming-mode is managed at the function-level."), ::llvm::cl::init(mlir::arm_sme::ArmStreaming::Default), ::llvm::cl::values( + clEnumValN(mlir::arm_sme::ArmStreaming::Default, "default", + "Streaming mode is part of the function interface " + "(ABI), caller manages PSTATE.SM on entry/exit."), + clEnumValN(mlir::arm_sme::ArmStreaming::Locally, "locally", + "Streaming mode is internal to the function, callee " + "manages PSTATE.SM on entry/exit.") + )}; + ::mlir::Pass::Option enableZA{*this, "enable-za", ::llvm::cl::desc("Enable ZA storage array."), ::llvm::cl::init(false)}; +}; + +template +class TileAllocationBase : public ::mlir::OperationPass { +public: + using Base = TileAllocationBase; + + TileAllocationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TileAllocationBase(const TileAllocationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("allocate-arm-sme-tiles"); + } + ::llvm::StringRef getArgument() const override { return "allocate-arm-sme-tiles"; } + + ::llvm::StringRef getDescription() const override { return "Allocate SME tiles"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TileAllocation"); + } + ::llvm::StringRef getName() const override { return "TileAllocation"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TileAllocationBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Transforms/Transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Transforms/Transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..fae04513859938bcafbf779ef85a9dd118462421 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Transforms/Transforms.h @@ -0,0 +1,34 @@ +//===- Transforms.h - ArmSME Dialect Transformation Entrypoints -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARMSME_TRANSFORMS_H +#define MLIR_DIALECT_ARMSME_TRANSFORMS_H + +namespace mlir { + +class LLVMConversionTarget; +class LLVMTypeConverter; +class RewritePatternSet; + +namespace arm_sme { +void populateVectorTransferLoweringPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); +} // namespace arm_sme + +/// Collect a set of patterns to lower ArmSME ops to ops that map to LLVM +/// intrinsics. +void populateArmSMELegalizeForLLVMExportPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +/// Configure the target to support lowering ArmSME ops to ops that map to LLVM +/// intrinsics. +void configureArmSMELegalizeForExportTarget(LLVMConversionTarget &target); + +} // namespace mlir + +#endif // MLIR_DIALECT_ARMSME_TRANSFORMS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Utils/Utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Utils/Utils.h new file mode 100644 index 0000000000000000000000000000000000000000..0941592497beaae05b1e751be5f772b53e7aaa3b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSME/Utils/Utils.h @@ -0,0 +1,46 @@ +//===- Utils.h - General ArmSME transformation utilities --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes for various utilities for the ArmSME +// dialect. These are not passes by themselves but are used either by passes, +// optimization sequences, or in turn by other transformation utilities. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARMSME_UTILS_UTILS_H_ +#define MLIR_DIALECT_ARMSME_UTILS_UTILS_H_ + +#include "mlir/Dialect/ArmSME/IR/ArmSME.h" + +namespace mlir { +namespace arm_sme { + +constexpr unsigned MinStreamingVectorLengthInBits = 128; + +/// Return minimum number of elements for the given element `type` in +/// a vector of SVL bits. +unsigned getSMETileSliceMinNumElts(Type type); + +/// Returns true if `type` is a valid element type for an SME tile or false +/// otherwise. +bool isValidSMETileElementType(Type type); + +/// Returns true if `vType` is a valid vector type for an SME tile or false +/// otherwise. +bool isValidSMETileVectorType(VectorType vType); + +/// Extends or truncates `tile`, which should be an `arm_sme::GetTileID` or +/// `arm_sme::CastVectorToTile` op returning an 8/16/32/64/128-bit scalar +/// integer, to an i32 that can be passed as the `tile` parameter to the SME +/// intrinsics. Or returns `tile` if already i32. +Value castTileIDToI32(Value tile, Location loc, RewriterBase &rewriter); + +} // namespace arm_sme +} // namespace mlir + +#endif // MLIR_DIALECT_ARMSME_UTILS_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..7b017d821c0b4e8a5235125937936671bbccafc7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc @@ -0,0 +1,5144 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSVE.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::arm_sve::ConvertFromSvboolIntrOp, +::mlir::arm_sve::ConvertToSvboolIntrOp, +::mlir::arm_sve::ScalableMaskedAddFIntrOp, +::mlir::arm_sve::ScalableMaskedAddFOp, +::mlir::arm_sve::ScalableMaskedAddIIntrOp, +::mlir::arm_sve::ScalableMaskedAddIOp, +::mlir::arm_sve::ScalableMaskedDivFIntrOp, +::mlir::arm_sve::ScalableMaskedDivFOp, +::mlir::arm_sve::ScalableMaskedMulFIntrOp, +::mlir::arm_sve::ScalableMaskedMulFOp, +::mlir::arm_sve::ScalableMaskedMulIIntrOp, +::mlir::arm_sve::ScalableMaskedMulIOp, +::mlir::arm_sve::ScalableMaskedSDivIIntrOp, +::mlir::arm_sve::ScalableMaskedSDivIOp, +::mlir::arm_sve::ScalableMaskedSubFIntrOp, +::mlir::arm_sve::ScalableMaskedSubFOp, +::mlir::arm_sve::ScalableMaskedSubIIntrOp, +::mlir::arm_sve::ScalableMaskedSubIOp, +::mlir::arm_sve::ScalableMaskedUDivIIntrOp, +::mlir::arm_sve::ScalableMaskedUDivIOp, +::mlir::arm_sve::SdotIntrOp, +::mlir::arm_sve::SdotOp, +::mlir::arm_sve::SmmlaIntrOp, +::mlir::arm_sve::SmmlaOp, +::mlir::arm_sve::UdotIntrOp, +::mlir::arm_sve::UdotOp, +::mlir::arm_sve::UmmlaIntrOp, +::mlir::arm_sve::UmmlaOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arm_sve { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 1))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be of ranks 1scalable vector of 1-bit signless integer values of length 16, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleOuterType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getRank() + == 1))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 1)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be of ranks 1scalable vector of 1-bit signless integer values of length 16/8/4/2/1, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of 1-bit signless integer values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::FloatType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of floating-point values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignlessInteger(16))) || ((elementType.isSignlessInteger(32))) || ((elementType.isSignlessInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of 8-bit signless integer or 16-bit signless integer or 32-bit signless integer or 64-bit signless integer values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(32))) || ((elementType.isSignlessInteger(64))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of 32-bit signless integer or 64-bit signless integer values of length 4/2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignlessInteger(16))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 8)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of 8-bit signless integer or 16-bit signless integer values of length 16/8, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 4))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of 32-bit signless integer values of length 4, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArmSVE10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + ::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 16))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be scalable vector of 8-bit signless integer values of length 16, but got " << type; + } + return ::mlir::success(); +} +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ConvertFromSvboolIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ConvertFromSvboolIntrOpGenericAdaptorBase::ConvertFromSvboolIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.convert.from.svbool", odsAttrs.getContext()); +} + +ConvertFromSvboolIntrOpGenericAdaptorBase::ConvertFromSvboolIntrOpGenericAdaptorBase(ConvertFromSvboolIntrOp op) : ConvertFromSvboolIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ConvertFromSvboolIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ConvertFromSvboolIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ConvertFromSvboolIntrOpAdaptor::ConvertFromSvboolIntrOpAdaptor(ConvertFromSvboolIntrOp op) : ConvertFromSvboolIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ConvertFromSvboolIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ConvertFromSvboolIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ConvertFromSvboolIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ConvertFromSvboolIntrOp::getSvbool() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ConvertFromSvboolIntrOp::getSvboolMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ConvertFromSvboolIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ConvertFromSvboolIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ConvertFromSvboolIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ConvertFromSvboolIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value svbool) { + odsState.addOperands(svbool); + odsState.addTypes(res); +} + +void ConvertFromSvboolIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value svbool) { + odsState.addOperands(svbool); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConvertFromSvboolIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ConvertFromSvboolIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((::llvm::isa<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()) && + ::llvm::cast((*this->getODSResults(0).begin()).getType()).isScalable())) && ((::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getRank() + == 1))) && (((::llvm::isa<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()) && + ::llvm::cast((*this->getODSResults(0).begin()).getType()).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getElementType()))) && (((::llvm::isa<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()) && + ::llvm::cast((*this->getODSResults(0).begin()).getType()).isScalable())) && (((::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getNumElements() + == 16)) || ((::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getNumElements() + == 8)) || ((::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getNumElements() + == 4)) || ((::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getNumElements() + == 2)) || ((::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getNumElements() + == 1)))))) + return emitOpError("failed to verify that 'res' is of ranks 1scalable vector of 1-bit signless integer values of length 16/8/4/2/1"); + return ::mlir::success(); +} + +::mlir::LogicalResult ConvertFromSvboolIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ConvertFromSvboolIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ConvertToSvboolIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ConvertToSvboolIntrOpGenericAdaptorBase::ConvertToSvboolIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.convert.to.svbool", odsAttrs.getContext()); +} + +ConvertToSvboolIntrOpGenericAdaptorBase::ConvertToSvboolIntrOpGenericAdaptorBase(ConvertToSvboolIntrOp op) : ConvertToSvboolIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ConvertToSvboolIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ConvertToSvboolIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ConvertToSvboolIntrOpAdaptor::ConvertToSvboolIntrOpAdaptor(ConvertToSvboolIntrOp op) : ConvertToSvboolIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ConvertToSvboolIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ConvertToSvboolIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ConvertToSvboolIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ConvertToSvboolIntrOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ConvertToSvboolIntrOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ConvertToSvboolIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ConvertToSvboolIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ConvertToSvboolIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ConvertToSvboolIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask) { + odsState.addOperands(mask); + odsState.addTypes(res); +} + +void ConvertToSvboolIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask) { + odsState.addOperands(mask); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConvertToSvboolIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ConvertToSvboolIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((::llvm::isa<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()) && + ::llvm::cast((*this->getODSResults(0).begin()).getType()).isScalable())) && ((::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getRank() + == 1))) && (((::llvm::isa<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()) && + ::llvm::cast((*this->getODSResults(0).begin()).getType()).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getElementType()))) && (((::llvm::isa<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()) && + ::llvm::cast((*this->getODSResults(0).begin()).getType()).isScalable())) && ((::llvm::cast<::mlir::VectorType>((*this->getODSResults(0).begin()).getType()).getNumElements() + == 16))))) + return emitOpError("failed to verify that 'res' is of ranks 1scalable vector of 1-bit signless integer values of length 16"); + return ::mlir::success(); +} + +::mlir::LogicalResult ConvertToSvboolIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ConvertToSvboolIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedAddFIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedAddFIntrOpGenericAdaptorBase::ScalableMaskedAddFIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.fadd", odsAttrs.getContext()); +} + +ScalableMaskedAddFIntrOpGenericAdaptorBase::ScalableMaskedAddFIntrOpGenericAdaptorBase(ScalableMaskedAddFIntrOp op) : ScalableMaskedAddFIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedAddFIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedAddFIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedAddFIntrOpAdaptor::ScalableMaskedAddFIntrOpAdaptor(ScalableMaskedAddFIntrOp op) : ScalableMaskedAddFIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedAddFIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedAddFIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedAddFIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ScalableMaskedAddFIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedAddFIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ScalableMaskedAddFIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ScalableMaskedAddFIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void ScalableMaskedAddFIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedAddFIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedAddFIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedAddFIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedAddFIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedAddFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedAddFOpGenericAdaptorBase::ScalableMaskedAddFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.masked.addf", odsAttrs.getContext()); +} + +ScalableMaskedAddFOpGenericAdaptorBase::ScalableMaskedAddFOpGenericAdaptorBase(ScalableMaskedAddFOp op) : ScalableMaskedAddFOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedAddFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedAddFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedAddFOpAdaptor::ScalableMaskedAddFOpAdaptor(ScalableMaskedAddFOp op) : ScalableMaskedAddFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedAddFOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedAddFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedAddFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedAddFOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedAddFOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedAddFOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ScalableMaskedAddFOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedAddFOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedAddFOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ScalableMaskedAddFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedAddFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedAddFOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void ScalableMaskedAddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(res); +} + +void ScalableMaskedAddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedAddFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedAddFOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2, res} have same type"); + if (!((std::equal_to<>()(getI1SameShape((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that mask has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedAddFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ScalableMaskedAddFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, resTypes[0], src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, resTypes[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ScalableMaskedAddFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedAddFOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedAddIIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedAddIIntrOpGenericAdaptorBase::ScalableMaskedAddIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.add", odsAttrs.getContext()); +} + +ScalableMaskedAddIIntrOpGenericAdaptorBase::ScalableMaskedAddIIntrOpGenericAdaptorBase(ScalableMaskedAddIIntrOp op) : ScalableMaskedAddIIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedAddIIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedAddIIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedAddIIntrOpAdaptor::ScalableMaskedAddIIntrOpAdaptor(ScalableMaskedAddIIntrOp op) : ScalableMaskedAddIIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedAddIIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedAddIIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedAddIIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ScalableMaskedAddIIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedAddIIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ScalableMaskedAddIIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ScalableMaskedAddIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void ScalableMaskedAddIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedAddIIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedAddIIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedAddIIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedAddIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedAddIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedAddIOpGenericAdaptorBase::ScalableMaskedAddIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.masked.addi", odsAttrs.getContext()); +} + +ScalableMaskedAddIOpGenericAdaptorBase::ScalableMaskedAddIOpGenericAdaptorBase(ScalableMaskedAddIOp op) : ScalableMaskedAddIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedAddIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedAddIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedAddIOpAdaptor::ScalableMaskedAddIOpAdaptor(ScalableMaskedAddIOp op) : ScalableMaskedAddIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedAddIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedAddIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedAddIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedAddIOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedAddIOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedAddIOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ScalableMaskedAddIOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedAddIOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedAddIOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ScalableMaskedAddIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedAddIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedAddIOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void ScalableMaskedAddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(res); +} + +void ScalableMaskedAddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedAddIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedAddIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2, res} have same type"); + if (!((std::equal_to<>()(getI1SameShape((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that mask has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedAddIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ScalableMaskedAddIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, resTypes[0], src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, resTypes[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ScalableMaskedAddIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedAddIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedDivFIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedDivFIntrOpGenericAdaptorBase::ScalableMaskedDivFIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.fdiv", odsAttrs.getContext()); +} + +ScalableMaskedDivFIntrOpGenericAdaptorBase::ScalableMaskedDivFIntrOpGenericAdaptorBase(ScalableMaskedDivFIntrOp op) : ScalableMaskedDivFIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedDivFIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedDivFIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedDivFIntrOpAdaptor::ScalableMaskedDivFIntrOpAdaptor(ScalableMaskedDivFIntrOp op) : ScalableMaskedDivFIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedDivFIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedDivFIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedDivFIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ScalableMaskedDivFIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedDivFIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ScalableMaskedDivFIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ScalableMaskedDivFIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void ScalableMaskedDivFIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedDivFIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedDivFIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedDivFIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedDivFIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedDivFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedDivFOpGenericAdaptorBase::ScalableMaskedDivFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.masked.divf", odsAttrs.getContext()); +} + +ScalableMaskedDivFOpGenericAdaptorBase::ScalableMaskedDivFOpGenericAdaptorBase(ScalableMaskedDivFOp op) : ScalableMaskedDivFOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedDivFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedDivFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedDivFOpAdaptor::ScalableMaskedDivFOpAdaptor(ScalableMaskedDivFOp op) : ScalableMaskedDivFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedDivFOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedDivFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedDivFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedDivFOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedDivFOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedDivFOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ScalableMaskedDivFOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedDivFOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedDivFOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ScalableMaskedDivFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedDivFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedDivFOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void ScalableMaskedDivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(res); +} + +void ScalableMaskedDivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedDivFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedDivFOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2, res} have same type"); + if (!((std::equal_to<>()(getI1SameShape((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that mask has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedDivFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ScalableMaskedDivFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, resTypes[0], src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, resTypes[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ScalableMaskedDivFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedDivFOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedMulFIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedMulFIntrOpGenericAdaptorBase::ScalableMaskedMulFIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.fmul", odsAttrs.getContext()); +} + +ScalableMaskedMulFIntrOpGenericAdaptorBase::ScalableMaskedMulFIntrOpGenericAdaptorBase(ScalableMaskedMulFIntrOp op) : ScalableMaskedMulFIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedMulFIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedMulFIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedMulFIntrOpAdaptor::ScalableMaskedMulFIntrOpAdaptor(ScalableMaskedMulFIntrOp op) : ScalableMaskedMulFIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedMulFIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedMulFIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedMulFIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ScalableMaskedMulFIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedMulFIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ScalableMaskedMulFIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ScalableMaskedMulFIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void ScalableMaskedMulFIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedMulFIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedMulFIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedMulFIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedMulFIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedMulFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedMulFOpGenericAdaptorBase::ScalableMaskedMulFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.masked.mulf", odsAttrs.getContext()); +} + +ScalableMaskedMulFOpGenericAdaptorBase::ScalableMaskedMulFOpGenericAdaptorBase(ScalableMaskedMulFOp op) : ScalableMaskedMulFOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedMulFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedMulFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedMulFOpAdaptor::ScalableMaskedMulFOpAdaptor(ScalableMaskedMulFOp op) : ScalableMaskedMulFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedMulFOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedMulFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedMulFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedMulFOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedMulFOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedMulFOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ScalableMaskedMulFOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedMulFOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedMulFOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ScalableMaskedMulFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedMulFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedMulFOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void ScalableMaskedMulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(res); +} + +void ScalableMaskedMulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedMulFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedMulFOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2, res} have same type"); + if (!((std::equal_to<>()(getI1SameShape((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that mask has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedMulFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ScalableMaskedMulFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, resTypes[0], src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, resTypes[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ScalableMaskedMulFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedMulFOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedMulIIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedMulIIntrOpGenericAdaptorBase::ScalableMaskedMulIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.mul", odsAttrs.getContext()); +} + +ScalableMaskedMulIIntrOpGenericAdaptorBase::ScalableMaskedMulIIntrOpGenericAdaptorBase(ScalableMaskedMulIIntrOp op) : ScalableMaskedMulIIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedMulIIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedMulIIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedMulIIntrOpAdaptor::ScalableMaskedMulIIntrOpAdaptor(ScalableMaskedMulIIntrOp op) : ScalableMaskedMulIIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedMulIIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedMulIIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedMulIIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ScalableMaskedMulIIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedMulIIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ScalableMaskedMulIIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ScalableMaskedMulIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void ScalableMaskedMulIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedMulIIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedMulIIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedMulIIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedMulIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedMulIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedMulIOpGenericAdaptorBase::ScalableMaskedMulIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.masked.muli", odsAttrs.getContext()); +} + +ScalableMaskedMulIOpGenericAdaptorBase::ScalableMaskedMulIOpGenericAdaptorBase(ScalableMaskedMulIOp op) : ScalableMaskedMulIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedMulIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedMulIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedMulIOpAdaptor::ScalableMaskedMulIOpAdaptor(ScalableMaskedMulIOp op) : ScalableMaskedMulIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedMulIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedMulIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedMulIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedMulIOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedMulIOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedMulIOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ScalableMaskedMulIOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedMulIOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedMulIOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ScalableMaskedMulIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedMulIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedMulIOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void ScalableMaskedMulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(res); +} + +void ScalableMaskedMulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedMulIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedMulIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2, res} have same type"); + if (!((std::equal_to<>()(getI1SameShape((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that mask has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedMulIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ScalableMaskedMulIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, resTypes[0], src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, resTypes[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ScalableMaskedMulIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedMulIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSDivIIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedSDivIIntrOpGenericAdaptorBase::ScalableMaskedSDivIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.sdiv", odsAttrs.getContext()); +} + +ScalableMaskedSDivIIntrOpGenericAdaptorBase::ScalableMaskedSDivIIntrOpGenericAdaptorBase(ScalableMaskedSDivIIntrOp op) : ScalableMaskedSDivIIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedSDivIIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedSDivIIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedSDivIIntrOpAdaptor::ScalableMaskedSDivIIntrOpAdaptor(ScalableMaskedSDivIIntrOp op) : ScalableMaskedSDivIIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedSDivIIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedSDivIIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedSDivIIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ScalableMaskedSDivIIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedSDivIIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ScalableMaskedSDivIIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ScalableMaskedSDivIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void ScalableMaskedSDivIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedSDivIIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedSDivIIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedSDivIIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSDivIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSDivIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedSDivIOpGenericAdaptorBase::ScalableMaskedSDivIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.masked.divi_signed", odsAttrs.getContext()); +} + +ScalableMaskedSDivIOpGenericAdaptorBase::ScalableMaskedSDivIOpGenericAdaptorBase(ScalableMaskedSDivIOp op) : ScalableMaskedSDivIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedSDivIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedSDivIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedSDivIOpAdaptor::ScalableMaskedSDivIOpAdaptor(ScalableMaskedSDivIOp op) : ScalableMaskedSDivIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedSDivIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedSDivIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedSDivIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSDivIOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSDivIOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSDivIOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ScalableMaskedSDivIOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedSDivIOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedSDivIOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ScalableMaskedSDivIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedSDivIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSDivIOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void ScalableMaskedSDivIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(res); +} + +void ScalableMaskedSDivIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedSDivIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedSDivIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2, res} have same type"); + if (!((std::equal_to<>()(getI1SameShape((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that mask has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedSDivIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ScalableMaskedSDivIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, resTypes[0], src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, resTypes[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ScalableMaskedSDivIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSDivIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSubFIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedSubFIntrOpGenericAdaptorBase::ScalableMaskedSubFIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.fsub", odsAttrs.getContext()); +} + +ScalableMaskedSubFIntrOpGenericAdaptorBase::ScalableMaskedSubFIntrOpGenericAdaptorBase(ScalableMaskedSubFIntrOp op) : ScalableMaskedSubFIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedSubFIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedSubFIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedSubFIntrOpAdaptor::ScalableMaskedSubFIntrOpAdaptor(ScalableMaskedSubFIntrOp op) : ScalableMaskedSubFIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedSubFIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedSubFIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedSubFIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ScalableMaskedSubFIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedSubFIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ScalableMaskedSubFIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ScalableMaskedSubFIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void ScalableMaskedSubFIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedSubFIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedSubFIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedSubFIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSubFIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSubFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedSubFOpGenericAdaptorBase::ScalableMaskedSubFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.masked.subf", odsAttrs.getContext()); +} + +ScalableMaskedSubFOpGenericAdaptorBase::ScalableMaskedSubFOpGenericAdaptorBase(ScalableMaskedSubFOp op) : ScalableMaskedSubFOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedSubFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedSubFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedSubFOpAdaptor::ScalableMaskedSubFOpAdaptor(ScalableMaskedSubFOp op) : ScalableMaskedSubFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedSubFOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedSubFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedSubFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSubFOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSubFOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSubFOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ScalableMaskedSubFOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedSubFOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedSubFOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ScalableMaskedSubFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedSubFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSubFOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void ScalableMaskedSubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(res); +} + +void ScalableMaskedSubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedSubFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedSubFOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2, res} have same type"); + if (!((std::equal_to<>()(getI1SameShape((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that mask has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedSubFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ScalableMaskedSubFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, resTypes[0], src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, resTypes[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ScalableMaskedSubFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSubFOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSubIIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedSubIIntrOpGenericAdaptorBase::ScalableMaskedSubIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.sub", odsAttrs.getContext()); +} + +ScalableMaskedSubIIntrOpGenericAdaptorBase::ScalableMaskedSubIIntrOpGenericAdaptorBase(ScalableMaskedSubIIntrOp op) : ScalableMaskedSubIIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedSubIIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedSubIIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedSubIIntrOpAdaptor::ScalableMaskedSubIIntrOpAdaptor(ScalableMaskedSubIIntrOp op) : ScalableMaskedSubIIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedSubIIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedSubIIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedSubIIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ScalableMaskedSubIIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedSubIIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ScalableMaskedSubIIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ScalableMaskedSubIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void ScalableMaskedSubIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedSubIIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedSubIIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedSubIIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSubIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSubIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedSubIOpGenericAdaptorBase::ScalableMaskedSubIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.masked.subi", odsAttrs.getContext()); +} + +ScalableMaskedSubIOpGenericAdaptorBase::ScalableMaskedSubIOpGenericAdaptorBase(ScalableMaskedSubIOp op) : ScalableMaskedSubIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedSubIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedSubIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedSubIOpAdaptor::ScalableMaskedSubIOpAdaptor(ScalableMaskedSubIOp op) : ScalableMaskedSubIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedSubIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedSubIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedSubIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSubIOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSubIOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSubIOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ScalableMaskedSubIOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedSubIOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedSubIOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ScalableMaskedSubIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedSubIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedSubIOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void ScalableMaskedSubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(res); +} + +void ScalableMaskedSubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedSubIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedSubIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2, res} have same type"); + if (!((std::equal_to<>()(getI1SameShape((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that mask has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedSubIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ScalableMaskedSubIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, resTypes[0], src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, resTypes[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ScalableMaskedSubIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSubIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedUDivIIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedUDivIIntrOpGenericAdaptorBase::ScalableMaskedUDivIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.udiv", odsAttrs.getContext()); +} + +ScalableMaskedUDivIIntrOpGenericAdaptorBase::ScalableMaskedUDivIIntrOpGenericAdaptorBase(ScalableMaskedUDivIIntrOp op) : ScalableMaskedUDivIIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedUDivIIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedUDivIIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedUDivIIntrOpAdaptor::ScalableMaskedUDivIIntrOpAdaptor(ScalableMaskedUDivIIntrOp op) : ScalableMaskedUDivIIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedUDivIIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedUDivIIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedUDivIIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ScalableMaskedUDivIIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedUDivIIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ScalableMaskedUDivIIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ScalableMaskedUDivIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void ScalableMaskedUDivIIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedUDivIIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedUDivIIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedUDivIIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedUDivIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedUDivIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ScalableMaskedUDivIOpGenericAdaptorBase::ScalableMaskedUDivIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.masked.divi_unsigned", odsAttrs.getContext()); +} + +ScalableMaskedUDivIOpGenericAdaptorBase::ScalableMaskedUDivIOpGenericAdaptorBase(ScalableMaskedUDivIOp op) : ScalableMaskedUDivIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ScalableMaskedUDivIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ScalableMaskedUDivIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ScalableMaskedUDivIOpAdaptor::ScalableMaskedUDivIOpAdaptor(ScalableMaskedUDivIOp op) : ScalableMaskedUDivIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ScalableMaskedUDivIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ScalableMaskedUDivIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ScalableMaskedUDivIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedUDivIOp::getMask() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedUDivIOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedUDivIOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ScalableMaskedUDivIOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedUDivIOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ScalableMaskedUDivIOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ScalableMaskedUDivIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ScalableMaskedUDivIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> ScalableMaskedUDivIOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void ScalableMaskedUDivIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(res); +} + +void ScalableMaskedUDivIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(mask); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ScalableMaskedUDivIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ScalableMaskedUDivIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2, res} have same type"); + if (!((std::equal_to<>()(getI1SameShape((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that mask has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ScalableMaskedUDivIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ScalableMaskedUDivIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, resTypes[0], src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, resTypes[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ScalableMaskedUDivIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedUDivIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::SdotIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SdotIntrOpGenericAdaptorBase::SdotIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.sdot", odsAttrs.getContext()); +} + +SdotIntrOpGenericAdaptorBase::SdotIntrOpGenericAdaptorBase(SdotIntrOp op) : SdotIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SdotIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SdotIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SdotIntrOpAdaptor::SdotIntrOpAdaptor(SdotIntrOp op) : SdotIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SdotIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SdotIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SdotIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SdotIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SdotIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SdotIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SdotIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void SdotIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SdotIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SdotIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SdotIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::SdotIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::SdotOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SdotOpGenericAdaptorBase::SdotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.sdot", odsAttrs.getContext()); +} + +SdotOpGenericAdaptorBase::SdotOpGenericAdaptorBase(SdotOp op) : SdotOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SdotOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SdotOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SdotOpAdaptor::SdotOpAdaptor(SdotOp op) : SdotOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SdotOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SdotOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SdotOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> SdotOp::getAcc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> SdotOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> SdotOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &SdotOp::getAccMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SdotOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SdotOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair SdotOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SdotOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> SdotOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void SdotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dst, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(acc); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(dst); +} + +void SdotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(acc); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SdotOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SdotOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2} have same type"); + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {acc, dst} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult SdotOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SdotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand accRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accOperands(accRawOperands); ::llvm::SMLoc accOperandsLoc; + (void)accOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type src1RawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> src1Types(src1RawTypes); + ::mlir::Type dstRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstTypes(dstRawTypes); + + accOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + src1RawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstRawTypes[0] = type; + } + result.addTypes(dstTypes); + if (parser.resolveOperands(accOperands, dstTypes[0], accOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, src1Types, src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, src1Types[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SdotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAcc(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrc1().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getDst().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SdotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::SdotOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::SmmlaIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SmmlaIntrOpGenericAdaptorBase::SmmlaIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.smmla", odsAttrs.getContext()); +} + +SmmlaIntrOpGenericAdaptorBase::SmmlaIntrOpGenericAdaptorBase(SmmlaIntrOp op) : SmmlaIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SmmlaIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SmmlaIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SmmlaIntrOpAdaptor::SmmlaIntrOpAdaptor(SmmlaIntrOp op) : SmmlaIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SmmlaIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SmmlaIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SmmlaIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SmmlaIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SmmlaIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SmmlaIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SmmlaIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void SmmlaIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SmmlaIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SmmlaIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SmmlaIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::SmmlaIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::SmmlaOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SmmlaOpGenericAdaptorBase::SmmlaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.smmla", odsAttrs.getContext()); +} + +SmmlaOpGenericAdaptorBase::SmmlaOpGenericAdaptorBase(SmmlaOp op) : SmmlaOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SmmlaOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SmmlaOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SmmlaOpAdaptor::SmmlaOpAdaptor(SmmlaOp op) : SmmlaOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SmmlaOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SmmlaOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SmmlaOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> SmmlaOp::getAcc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> SmmlaOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> SmmlaOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &SmmlaOp::getAccMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SmmlaOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SmmlaOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair SmmlaOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SmmlaOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> SmmlaOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void SmmlaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dst, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(acc); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(dst); +} + +void SmmlaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(acc); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SmmlaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SmmlaOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2} have same type"); + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {acc, dst} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult SmmlaOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SmmlaOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand accRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accOperands(accRawOperands); ::llvm::SMLoc accOperandsLoc; + (void)accOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type src1RawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> src1Types(src1RawTypes); + ::mlir::Type dstRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstTypes(dstRawTypes); + + accOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + src1RawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstRawTypes[0] = type; + } + result.addTypes(dstTypes); + if (parser.resolveOperands(accOperands, dstTypes[0], accOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, src1Types, src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, src1Types[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SmmlaOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAcc(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrc1().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getDst().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SmmlaOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::SmmlaOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::UdotIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UdotIntrOpGenericAdaptorBase::UdotIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.udot", odsAttrs.getContext()); +} + +UdotIntrOpGenericAdaptorBase::UdotIntrOpGenericAdaptorBase(UdotIntrOp op) : UdotIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UdotIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UdotIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UdotIntrOpAdaptor::UdotIntrOpAdaptor(UdotIntrOp op) : UdotIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UdotIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UdotIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UdotIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair UdotIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UdotIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UdotIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UdotIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void UdotIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UdotIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UdotIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UdotIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::UdotIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::UdotOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UdotOpGenericAdaptorBase::UdotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.udot", odsAttrs.getContext()); +} + +UdotOpGenericAdaptorBase::UdotOpGenericAdaptorBase(UdotOp op) : UdotOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UdotOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UdotOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UdotOpAdaptor::UdotOpAdaptor(UdotOp op) : UdotOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UdotOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UdotOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UdotOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> UdotOp::getAcc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> UdotOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> UdotOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &UdotOp::getAccMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &UdotOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &UdotOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair UdotOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UdotOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> UdotOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void UdotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dst, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(acc); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(dst); +} + +void UdotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(acc); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UdotOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UdotOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2} have same type"); + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {acc, dst} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult UdotOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult UdotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand accRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accOperands(accRawOperands); ::llvm::SMLoc accOperandsLoc; + (void)accOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type src1RawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> src1Types(src1RawTypes); + ::mlir::Type dstRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstTypes(dstRawTypes); + + accOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + src1RawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstRawTypes[0] = type; + } + result.addTypes(dstTypes); + if (parser.resolveOperands(accOperands, dstTypes[0], accOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, src1Types, src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, src1Types[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UdotOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAcc(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrc1().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getDst().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void UdotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::UdotOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::UmmlaIntrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UmmlaIntrOpGenericAdaptorBase::UmmlaIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.intr.ummla", odsAttrs.getContext()); +} + +UmmlaIntrOpGenericAdaptorBase::UmmlaIntrOpGenericAdaptorBase(UmmlaIntrOp op) : UmmlaIntrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UmmlaIntrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UmmlaIntrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UmmlaIntrOpAdaptor::UmmlaIntrOpAdaptor(UmmlaIntrOp op) : UmmlaIntrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UmmlaIntrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UmmlaIntrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UmmlaIntrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair UmmlaIntrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UmmlaIntrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UmmlaIntrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UmmlaIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void UmmlaIntrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UmmlaIntrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UmmlaIntrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UmmlaIntrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::UmmlaIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::UmmlaOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UmmlaOpGenericAdaptorBase::UmmlaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("arm_sve.ummla", odsAttrs.getContext()); +} + +UmmlaOpGenericAdaptorBase::UmmlaOpGenericAdaptorBase(UmmlaOp op) : UmmlaOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UmmlaOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UmmlaOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UmmlaOpAdaptor::UmmlaOpAdaptor(UmmlaOp op) : UmmlaOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UmmlaOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UmmlaOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UmmlaOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> UmmlaOp::getAcc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> UmmlaOp::getSrc1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> UmmlaOp::getSrc2() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &UmmlaOp::getAccMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &UmmlaOp::getSrc1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &UmmlaOp::getSrc2Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair UmmlaOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UmmlaOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> UmmlaOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +void UmmlaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dst, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(acc); + odsState.addOperands(src1); + odsState.addOperands(src2); + odsState.addTypes(dst); +} + +void UmmlaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2) { + odsState.addOperands(acc); + odsState.addOperands(src1); + odsState.addOperands(src2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UmmlaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UmmlaOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ArmSVE9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {src1, src2} have same type"); + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {acc, dst} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult UmmlaOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult UmmlaOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand accRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accOperands(accRawOperands); ::llvm::SMLoc accOperandsLoc; + (void)accOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src1Operands(src1RawOperands); ::llvm::SMLoc src1OperandsLoc; + (void)src1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand src2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src2Operands(src2RawOperands); ::llvm::SMLoc src2OperandsLoc; + (void)src2OperandsLoc; + ::mlir::Type src1RawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> src1Types(src1RawTypes); + ::mlir::Type dstRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstTypes(dstRawTypes); + + accOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + src2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src2RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + src1RawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstRawTypes[0] = type; + } + result.addTypes(dstTypes); + if (parser.resolveOperands(accOperands, dstTypes[0], accOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src1Operands, src1Types, src1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(src2Operands, src1Types[0], src2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UmmlaOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAcc(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc2(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrc1().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getDst().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void UmmlaOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace arm_sve +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::UmmlaOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ae424ac5536bec479208ea750e67b1aa612dd9fe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVE.h.inc @@ -0,0 +1,2988 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSVE.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace arm_sve { +class ConvertFromSvboolIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ConvertToSvboolIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedAddFIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedAddFOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedAddIIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedAddIOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedDivFIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedDivFOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedMulFIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedMulFOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedMulIIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedMulIOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedSDivIIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedSDivIOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedSubFIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedSubFOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedSubIIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedSubIOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedUDivIIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class ScalableMaskedUDivIOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class SdotIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class SdotOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class SmmlaIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class SmmlaOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class UdotIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class UdotOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class UmmlaIntrOp; +} // namespace arm_sve +} // namespace mlir +namespace mlir { +namespace arm_sve { +class UmmlaOp; +} // namespace arm_sve +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ConvertFromSvboolIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvertFromSvboolIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvertFromSvboolIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvertFromSvboolIntrOpGenericAdaptorBase(ConvertFromSvboolIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConvertFromSvboolIntrOpGenericAdaptor : public detail::ConvertFromSvboolIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvertFromSvboolIntrOpGenericAdaptorBase; +public: + ConvertFromSvboolIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvertFromSvboolIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvertFromSvboolIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvertFromSvboolIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSvbool() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvertFromSvboolIntrOpAdaptor : public ConvertFromSvboolIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvertFromSvboolIntrOpGenericAdaptor::ConvertFromSvboolIntrOpGenericAdaptor; + ConvertFromSvboolIntrOpAdaptor(ConvertFromSvboolIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvertFromSvboolIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvertFromSvboolIntrOpAdaptor; + template + using GenericAdaptor = ConvertFromSvboolIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.convert.from.svbool"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getSvbool(); + ::mlir::OpOperand &getSvboolMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value svbool); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value svbool); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ConvertFromSvboolIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ConvertToSvboolIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvertToSvboolIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvertToSvboolIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvertToSvboolIntrOpGenericAdaptorBase(ConvertToSvboolIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConvertToSvboolIntrOpGenericAdaptor : public detail::ConvertToSvboolIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvertToSvboolIntrOpGenericAdaptorBase; +public: + ConvertToSvboolIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvertToSvboolIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvertToSvboolIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvertToSvboolIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvertToSvboolIntrOpAdaptor : public ConvertToSvboolIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvertToSvboolIntrOpGenericAdaptor::ConvertToSvboolIntrOpGenericAdaptor; + ConvertToSvboolIntrOpAdaptor(ConvertToSvboolIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvertToSvboolIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvertToSvboolIntrOpAdaptor; + template + using GenericAdaptor = ConvertToSvboolIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.convert.to.svbool"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::OpOperand &getMaskMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ConvertToSvboolIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedAddFIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedAddFIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedAddFIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedAddFIntrOpGenericAdaptorBase(ScalableMaskedAddFIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedAddFIntrOpGenericAdaptor : public detail::ScalableMaskedAddFIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedAddFIntrOpGenericAdaptorBase; +public: + ScalableMaskedAddFIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedAddFIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedAddFIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedAddFIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedAddFIntrOpAdaptor : public ScalableMaskedAddFIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedAddFIntrOpGenericAdaptor::ScalableMaskedAddFIntrOpGenericAdaptor; + ScalableMaskedAddFIntrOpAdaptor(ScalableMaskedAddFIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedAddFIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedAddFIntrOpAdaptor; + template + using GenericAdaptor = ScalableMaskedAddFIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.fadd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedAddFIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedAddFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedAddFOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedAddFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedAddFOpGenericAdaptorBase(ScalableMaskedAddFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedAddFOpGenericAdaptor : public detail::ScalableMaskedAddFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedAddFOpGenericAdaptorBase; +public: + ScalableMaskedAddFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedAddFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedAddFOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedAddFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedAddFOpAdaptor : public ScalableMaskedAddFOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedAddFOpGenericAdaptor::ScalableMaskedAddFOpGenericAdaptor; + ScalableMaskedAddFOpAdaptor(ScalableMaskedAddFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedAddFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedAddFOpAdaptor; + template + using GenericAdaptor = ScalableMaskedAddFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.masked.addf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedAddFOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedAddIIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedAddIIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedAddIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedAddIIntrOpGenericAdaptorBase(ScalableMaskedAddIIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedAddIIntrOpGenericAdaptor : public detail::ScalableMaskedAddIIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedAddIIntrOpGenericAdaptorBase; +public: + ScalableMaskedAddIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedAddIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedAddIIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedAddIIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedAddIIntrOpAdaptor : public ScalableMaskedAddIIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedAddIIntrOpGenericAdaptor::ScalableMaskedAddIIntrOpGenericAdaptor; + ScalableMaskedAddIIntrOpAdaptor(ScalableMaskedAddIIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedAddIIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedAddIIntrOpAdaptor; + template + using GenericAdaptor = ScalableMaskedAddIIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedAddIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedAddIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedAddIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedAddIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedAddIOpGenericAdaptorBase(ScalableMaskedAddIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedAddIOpGenericAdaptor : public detail::ScalableMaskedAddIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedAddIOpGenericAdaptorBase; +public: + ScalableMaskedAddIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedAddIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedAddIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedAddIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedAddIOpAdaptor : public ScalableMaskedAddIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedAddIOpGenericAdaptor::ScalableMaskedAddIOpGenericAdaptor; + ScalableMaskedAddIOpAdaptor(ScalableMaskedAddIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedAddIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedAddIOpAdaptor; + template + using GenericAdaptor = ScalableMaskedAddIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.masked.addi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedAddIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedDivFIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedDivFIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedDivFIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedDivFIntrOpGenericAdaptorBase(ScalableMaskedDivFIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedDivFIntrOpGenericAdaptor : public detail::ScalableMaskedDivFIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedDivFIntrOpGenericAdaptorBase; +public: + ScalableMaskedDivFIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedDivFIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedDivFIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedDivFIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedDivFIntrOpAdaptor : public ScalableMaskedDivFIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedDivFIntrOpGenericAdaptor::ScalableMaskedDivFIntrOpGenericAdaptor; + ScalableMaskedDivFIntrOpAdaptor(ScalableMaskedDivFIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedDivFIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedDivFIntrOpAdaptor; + template + using GenericAdaptor = ScalableMaskedDivFIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.fdiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedDivFIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedDivFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedDivFOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedDivFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedDivFOpGenericAdaptorBase(ScalableMaskedDivFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedDivFOpGenericAdaptor : public detail::ScalableMaskedDivFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedDivFOpGenericAdaptorBase; +public: + ScalableMaskedDivFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedDivFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedDivFOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedDivFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedDivFOpAdaptor : public ScalableMaskedDivFOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedDivFOpGenericAdaptor::ScalableMaskedDivFOpGenericAdaptor; + ScalableMaskedDivFOpAdaptor(ScalableMaskedDivFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedDivFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedDivFOpAdaptor; + template + using GenericAdaptor = ScalableMaskedDivFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.masked.divf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedDivFOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedMulFIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedMulFIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedMulFIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedMulFIntrOpGenericAdaptorBase(ScalableMaskedMulFIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedMulFIntrOpGenericAdaptor : public detail::ScalableMaskedMulFIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedMulFIntrOpGenericAdaptorBase; +public: + ScalableMaskedMulFIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedMulFIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedMulFIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedMulFIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedMulFIntrOpAdaptor : public ScalableMaskedMulFIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedMulFIntrOpGenericAdaptor::ScalableMaskedMulFIntrOpGenericAdaptor; + ScalableMaskedMulFIntrOpAdaptor(ScalableMaskedMulFIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedMulFIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedMulFIntrOpAdaptor; + template + using GenericAdaptor = ScalableMaskedMulFIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.fmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedMulFIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedMulFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedMulFOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedMulFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedMulFOpGenericAdaptorBase(ScalableMaskedMulFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedMulFOpGenericAdaptor : public detail::ScalableMaskedMulFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedMulFOpGenericAdaptorBase; +public: + ScalableMaskedMulFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedMulFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedMulFOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedMulFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedMulFOpAdaptor : public ScalableMaskedMulFOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedMulFOpGenericAdaptor::ScalableMaskedMulFOpGenericAdaptor; + ScalableMaskedMulFOpAdaptor(ScalableMaskedMulFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedMulFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedMulFOpAdaptor; + template + using GenericAdaptor = ScalableMaskedMulFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.masked.mulf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedMulFOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedMulIIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedMulIIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedMulIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedMulIIntrOpGenericAdaptorBase(ScalableMaskedMulIIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedMulIIntrOpGenericAdaptor : public detail::ScalableMaskedMulIIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedMulIIntrOpGenericAdaptorBase; +public: + ScalableMaskedMulIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedMulIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedMulIIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedMulIIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedMulIIntrOpAdaptor : public ScalableMaskedMulIIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedMulIIntrOpGenericAdaptor::ScalableMaskedMulIIntrOpGenericAdaptor; + ScalableMaskedMulIIntrOpAdaptor(ScalableMaskedMulIIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedMulIIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedMulIIntrOpAdaptor; + template + using GenericAdaptor = ScalableMaskedMulIIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedMulIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedMulIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedMulIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedMulIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedMulIOpGenericAdaptorBase(ScalableMaskedMulIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedMulIOpGenericAdaptor : public detail::ScalableMaskedMulIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedMulIOpGenericAdaptorBase; +public: + ScalableMaskedMulIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedMulIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedMulIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedMulIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedMulIOpAdaptor : public ScalableMaskedMulIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedMulIOpGenericAdaptor::ScalableMaskedMulIOpGenericAdaptor; + ScalableMaskedMulIOpAdaptor(ScalableMaskedMulIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedMulIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedMulIOpAdaptor; + template + using GenericAdaptor = ScalableMaskedMulIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.masked.muli"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedMulIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSDivIIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedSDivIIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedSDivIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedSDivIIntrOpGenericAdaptorBase(ScalableMaskedSDivIIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedSDivIIntrOpGenericAdaptor : public detail::ScalableMaskedSDivIIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedSDivIIntrOpGenericAdaptorBase; +public: + ScalableMaskedSDivIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedSDivIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedSDivIIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedSDivIIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedSDivIIntrOpAdaptor : public ScalableMaskedSDivIIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedSDivIIntrOpGenericAdaptor::ScalableMaskedSDivIIntrOpGenericAdaptor; + ScalableMaskedSDivIIntrOpAdaptor(ScalableMaskedSDivIIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedSDivIIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedSDivIIntrOpAdaptor; + template + using GenericAdaptor = ScalableMaskedSDivIIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.sdiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSDivIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSDivIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedSDivIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedSDivIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedSDivIOpGenericAdaptorBase(ScalableMaskedSDivIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedSDivIOpGenericAdaptor : public detail::ScalableMaskedSDivIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedSDivIOpGenericAdaptorBase; +public: + ScalableMaskedSDivIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedSDivIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedSDivIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedSDivIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedSDivIOpAdaptor : public ScalableMaskedSDivIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedSDivIOpGenericAdaptor::ScalableMaskedSDivIOpGenericAdaptor; + ScalableMaskedSDivIOpAdaptor(ScalableMaskedSDivIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedSDivIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedSDivIOpAdaptor; + template + using GenericAdaptor = ScalableMaskedSDivIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.masked.divi_signed"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSDivIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSubFIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedSubFIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedSubFIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedSubFIntrOpGenericAdaptorBase(ScalableMaskedSubFIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedSubFIntrOpGenericAdaptor : public detail::ScalableMaskedSubFIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedSubFIntrOpGenericAdaptorBase; +public: + ScalableMaskedSubFIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedSubFIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedSubFIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedSubFIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedSubFIntrOpAdaptor : public ScalableMaskedSubFIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedSubFIntrOpGenericAdaptor::ScalableMaskedSubFIntrOpGenericAdaptor; + ScalableMaskedSubFIntrOpAdaptor(ScalableMaskedSubFIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedSubFIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedSubFIntrOpAdaptor; + template + using GenericAdaptor = ScalableMaskedSubFIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.fsub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSubFIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSubFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedSubFOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedSubFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedSubFOpGenericAdaptorBase(ScalableMaskedSubFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedSubFOpGenericAdaptor : public detail::ScalableMaskedSubFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedSubFOpGenericAdaptorBase; +public: + ScalableMaskedSubFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedSubFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedSubFOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedSubFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedSubFOpAdaptor : public ScalableMaskedSubFOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedSubFOpGenericAdaptor::ScalableMaskedSubFOpGenericAdaptor; + ScalableMaskedSubFOpAdaptor(ScalableMaskedSubFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedSubFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedSubFOpAdaptor; + template + using GenericAdaptor = ScalableMaskedSubFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.masked.subf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSubFOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSubIIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedSubIIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedSubIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedSubIIntrOpGenericAdaptorBase(ScalableMaskedSubIIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedSubIIntrOpGenericAdaptor : public detail::ScalableMaskedSubIIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedSubIIntrOpGenericAdaptorBase; +public: + ScalableMaskedSubIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedSubIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedSubIIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedSubIIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedSubIIntrOpAdaptor : public ScalableMaskedSubIIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedSubIIntrOpGenericAdaptor::ScalableMaskedSubIIntrOpGenericAdaptor; + ScalableMaskedSubIIntrOpAdaptor(ScalableMaskedSubIIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedSubIIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedSubIIntrOpAdaptor; + template + using GenericAdaptor = ScalableMaskedSubIIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.sub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSubIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedSubIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedSubIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedSubIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedSubIOpGenericAdaptorBase(ScalableMaskedSubIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedSubIOpGenericAdaptor : public detail::ScalableMaskedSubIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedSubIOpGenericAdaptorBase; +public: + ScalableMaskedSubIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedSubIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedSubIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedSubIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedSubIOpAdaptor : public ScalableMaskedSubIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedSubIOpGenericAdaptor::ScalableMaskedSubIOpGenericAdaptor; + ScalableMaskedSubIOpAdaptor(ScalableMaskedSubIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedSubIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedSubIOpAdaptor; + template + using GenericAdaptor = ScalableMaskedSubIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.masked.subi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedSubIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedUDivIIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedUDivIIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedUDivIIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedUDivIIntrOpGenericAdaptorBase(ScalableMaskedUDivIIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedUDivIIntrOpGenericAdaptor : public detail::ScalableMaskedUDivIIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedUDivIIntrOpGenericAdaptorBase; +public: + ScalableMaskedUDivIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedUDivIIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedUDivIIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedUDivIIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedUDivIIntrOpAdaptor : public ScalableMaskedUDivIIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedUDivIIntrOpGenericAdaptor::ScalableMaskedUDivIIntrOpGenericAdaptor; + ScalableMaskedUDivIIntrOpAdaptor(ScalableMaskedUDivIIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedUDivIIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedUDivIIntrOpAdaptor; + template + using GenericAdaptor = ScalableMaskedUDivIIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.udiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedUDivIIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::ScalableMaskedUDivIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScalableMaskedUDivIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScalableMaskedUDivIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScalableMaskedUDivIOpGenericAdaptorBase(ScalableMaskedUDivIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScalableMaskedUDivIOpGenericAdaptor : public detail::ScalableMaskedUDivIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScalableMaskedUDivIOpGenericAdaptorBase; +public: + ScalableMaskedUDivIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScalableMaskedUDivIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScalableMaskedUDivIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScalableMaskedUDivIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScalableMaskedUDivIOpAdaptor : public ScalableMaskedUDivIOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScalableMaskedUDivIOpGenericAdaptor::ScalableMaskedUDivIOpGenericAdaptor; + ScalableMaskedUDivIOpAdaptor(ScalableMaskedUDivIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScalableMaskedUDivIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScalableMaskedUDivIOpAdaptor; + template + using GenericAdaptor = ScalableMaskedUDivIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.masked.divi_unsigned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMask(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ScalableMaskedUDivIOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::SdotIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SdotIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SdotIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SdotIntrOpGenericAdaptorBase(SdotIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SdotIntrOpGenericAdaptor : public detail::SdotIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SdotIntrOpGenericAdaptorBase; +public: + SdotIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SdotIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SdotIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SdotIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SdotIntrOpAdaptor : public SdotIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using SdotIntrOpGenericAdaptor::SdotIntrOpGenericAdaptor; + SdotIntrOpAdaptor(SdotIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SdotIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = SdotIntrOpAdaptor; + template + using GenericAdaptor = SdotIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.sdot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::SdotIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::SdotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SdotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SdotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SdotOpGenericAdaptorBase(SdotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SdotOpGenericAdaptor : public detail::SdotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SdotOpGenericAdaptorBase; +public: + SdotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SdotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SdotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SdotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAcc() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SdotOpAdaptor : public SdotOpGenericAdaptor<::mlir::ValueRange> { +public: + using SdotOpGenericAdaptor::SdotOpGenericAdaptor; + SdotOpAdaptor(SdotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SdotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SdotOpAdaptor; + template + using GenericAdaptor = SdotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.sdot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getAcc(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getAccMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getDst(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dst, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::SdotOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::SmmlaIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SmmlaIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SmmlaIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SmmlaIntrOpGenericAdaptorBase(SmmlaIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SmmlaIntrOpGenericAdaptor : public detail::SmmlaIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SmmlaIntrOpGenericAdaptorBase; +public: + SmmlaIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SmmlaIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SmmlaIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SmmlaIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SmmlaIntrOpAdaptor : public SmmlaIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using SmmlaIntrOpGenericAdaptor::SmmlaIntrOpGenericAdaptor; + SmmlaIntrOpAdaptor(SmmlaIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SmmlaIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = SmmlaIntrOpAdaptor; + template + using GenericAdaptor = SmmlaIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.smmla"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::SmmlaIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::SmmlaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SmmlaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SmmlaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SmmlaOpGenericAdaptorBase(SmmlaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SmmlaOpGenericAdaptor : public detail::SmmlaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SmmlaOpGenericAdaptorBase; +public: + SmmlaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SmmlaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SmmlaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SmmlaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAcc() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SmmlaOpAdaptor : public SmmlaOpGenericAdaptor<::mlir::ValueRange> { +public: + using SmmlaOpGenericAdaptor::SmmlaOpGenericAdaptor; + SmmlaOpAdaptor(SmmlaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SmmlaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SmmlaOpAdaptor; + template + using GenericAdaptor = SmmlaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.smmla"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getAcc(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getAccMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getDst(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dst, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::SmmlaOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::UdotIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UdotIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UdotIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UdotIntrOpGenericAdaptorBase(UdotIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UdotIntrOpGenericAdaptor : public detail::UdotIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UdotIntrOpGenericAdaptorBase; +public: + UdotIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UdotIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UdotIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UdotIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UdotIntrOpAdaptor : public UdotIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using UdotIntrOpGenericAdaptor::UdotIntrOpGenericAdaptor; + UdotIntrOpAdaptor(UdotIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UdotIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = UdotIntrOpAdaptor; + template + using GenericAdaptor = UdotIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.udot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::UdotIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::UdotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UdotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UdotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UdotOpGenericAdaptorBase(UdotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UdotOpGenericAdaptor : public detail::UdotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UdotOpGenericAdaptorBase; +public: + UdotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UdotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UdotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UdotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAcc() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UdotOpAdaptor : public UdotOpGenericAdaptor<::mlir::ValueRange> { +public: + using UdotOpGenericAdaptor::UdotOpGenericAdaptor; + UdotOpAdaptor(UdotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UdotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UdotOpAdaptor; + template + using GenericAdaptor = UdotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.udot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getAcc(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getAccMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getDst(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dst, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::UdotOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::UmmlaIntrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UmmlaIntrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UmmlaIntrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UmmlaIntrOpGenericAdaptorBase(UmmlaIntrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UmmlaIntrOpGenericAdaptor : public detail::UmmlaIntrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UmmlaIntrOpGenericAdaptorBase; +public: + UmmlaIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UmmlaIntrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UmmlaIntrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UmmlaIntrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UmmlaIntrOpAdaptor : public UmmlaIntrOpGenericAdaptor<::mlir::ValueRange> { +public: + using UmmlaIntrOpGenericAdaptor::UmmlaIntrOpGenericAdaptor; + UmmlaIntrOpAdaptor(UmmlaIntrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UmmlaIntrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = UmmlaIntrOpAdaptor; + template + using GenericAdaptor = UmmlaIntrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.intr.ummla"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::UmmlaIntrOp) + +namespace mlir { +namespace arm_sve { + +//===----------------------------------------------------------------------===// +// ::mlir::arm_sve::UmmlaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UmmlaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UmmlaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UmmlaOpGenericAdaptorBase(UmmlaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UmmlaOpGenericAdaptor : public detail::UmmlaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UmmlaOpGenericAdaptorBase; +public: + UmmlaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UmmlaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UmmlaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UmmlaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAcc() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc1() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc2() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UmmlaOpAdaptor : public UmmlaOpGenericAdaptor<::mlir::ValueRange> { +public: + using UmmlaOpGenericAdaptor::UmmlaOpGenericAdaptor; + UmmlaOpAdaptor(UmmlaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UmmlaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UmmlaOpAdaptor; + template + using GenericAdaptor = UmmlaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("arm_sve.ummla"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getAcc(); + ::mlir::TypedValue<::mlir::VectorType> getSrc1(); + ::mlir::TypedValue<::mlir::VectorType> getSrc2(); + ::mlir::OpOperand &getAccMutable(); + ::mlir::OpOperand &getSrc1Mutable(); + ::mlir::OpOperand &getSrc2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getDst(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dst, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value acc, ::mlir::Value src1, ::mlir::Value src2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::UmmlaOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..5ee2ed79079502d2238b47e38ecf17f6bce243a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEConversions.inc @@ -0,0 +1,195 @@ +if (auto op = dyn_cast<::mlir::arm_sve::ConvertFromSvboolIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_convert_from_svbool, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ConvertToSvboolIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_convert_to_svbool, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ScalableMaskedAddFIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_fadd, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ScalableMaskedAddIIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_add, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ScalableMaskedDivFIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_fdiv, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ScalableMaskedMulFIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_fmul, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ScalableMaskedMulIIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_mul, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ScalableMaskedSDivIIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_sdiv, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ScalableMaskedSubFIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_fsub, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ScalableMaskedSubIIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_sub, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::ScalableMaskedUDivIIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_udiv, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::SdotIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_sdot, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::SmmlaIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_smmla, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::UdotIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_udot, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::arm_sve::UmmlaIntrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::aarch64_sve_ummla, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..8740049942d5faaf64718c2d4f1ae7d50dd8c418 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSVE.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ArmSVEDialect) +namespace mlir { +namespace arm_sve { + +ArmSVEDialect::ArmSVEDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +ArmSVEDialect::~ArmSVEDialect() = default; + +} // namespace arm_sve +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..a424e109b06d3e85dbf218389cf51cb0695040d2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h @@ -0,0 +1,27 @@ +//===- ArmSVEDialect.h - MLIR Dialect for Arm SVE ---------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares the Target dialect for ArmSVE in MLIR. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARMSVE_ARMSVEDIALECT_H +#define MLIR_DIALECT_ARMSVE_ARMSVEDIALECT_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#include "mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/ArmSVE/IR/ArmSVE.h.inc" + +#endif // MLIR_DIALECT_ARMSVE_ARMSVEDIALECT_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..2ef6740f3d9a06c94bd92e7c99a32d705a39c751 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h.inc @@ -0,0 +1,26 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ArmSVE.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace arm_sve { + +class ArmSVEDialect : public ::mlir::Dialect { + explicit ArmSVEDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~ArmSVEDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("arm_sve"); + } +}; +} // namespace arm_sve +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::arm_sve::ArmSVEDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..dd8594b65636287fbbd7f58bdcf62a66e200f258 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.cpp.inc @@ -0,0 +1,8 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..1f2b1696791068cde3d3cc54fc19e78997a74cdb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.h.inc @@ -0,0 +1,19 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/Transforms/Transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/Transforms/Transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..dcc485789875d3ac08b637cbffcdf37a957f9825 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ArmSVE/Transforms/Transforms.h @@ -0,0 +1,29 @@ +//===- Transforms.h - ArmSVE Dialect Transformation Entrypoints -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ARMSVE_TRANSFORMS_H +#define MLIR_DIALECT_ARMSVE_TRANSFORMS_H + +namespace mlir { + +class LLVMConversionTarget; +class LLVMTypeConverter; +class RewritePatternSet; + +/// Collect a set of patterns to lower ArmSVE ops to ops that map to LLVM +/// intrinsics. +void populateArmSVELegalizeForLLVMExportPatterns(LLVMTypeConverter &converter, + RewritePatternSet &patterns); + +/// Configure the target to support lowering ArmSVE ops to ops that map to LLVM +/// intrinsics. +void configureArmSVELegalizeForExportTarget(LLVMConversionTarget &target); + +} // namespace mlir + +#endif // MLIR_DIALECT_ARMSVE_TRANSFORMS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/Async.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/Async.h new file mode 100644 index 0000000000000000000000000000000000000000..015d97357144be2da5d8dd25751d75e8a1b49ff3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/Async.h @@ -0,0 +1,74 @@ +//===- Async.h - MLIR Async dialect -----------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the async dialect that is used for modeling asynchronous +// execution. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ASYNC_IR_ASYNC_H +#define MLIR_DIALECT_ASYNC_IR_ASYNC_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/Async/IR/AsyncTypes.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/CallInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/FunctionInterfaces.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +//===----------------------------------------------------------------------===// +// Async Dialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc" + +//===----------------------------------------------------------------------===// +// Async Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/Async/IR/AsyncOps.h.inc" + +//===----------------------------------------------------------------------===// +// Helper functions of Async dialect transformations. +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace async { + +/// Returns true if the type is reference counted at runtime. +inline bool isRefCounted(Type type) { + return isa(type); +} + +} // namespace async +} // namespace mlir + +namespace llvm { + +/// Allow stealing the low bits of async::FuncOp. +template <> +struct PointerLikeTypeTraits { + static inline void *getAsVoidPointer(mlir::async::FuncOp val) { + return const_cast(val.getAsOpaquePointer()); + } + static inline mlir::async::FuncOp getFromVoidPointer(void *p) { + return mlir::async::FuncOp::getFromOpaquePointer(p); + } + static constexpr int numLowBitsAvailable = 3; +}; +} // namespace llvm + +#endif // MLIR_DIALECT_ASYNC_IR_ASYNC_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..945a8a176fee7375af62ac0c0b0cefae3b80a602 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOps.cpp.inc @@ -0,0 +1,6121 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AsyncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::async::AddToGroupOp, +::mlir::async::AwaitAllOp, +::mlir::async::AwaitOp, +::mlir::async::CallOp, +::mlir::async::CoroBeginOp, +::mlir::async::CoroEndOp, +::mlir::async::CoroFreeOp, +::mlir::async::CoroIdOp, +::mlir::async::CoroSaveOp, +::mlir::async::CoroSuspendOp, +::mlir::async::CreateGroupOp, +::mlir::async::ExecuteOp, +::mlir::async::FuncOp, +::mlir::async::ReturnOp, +::mlir::async::RuntimeAddRefOp, +::mlir::async::RuntimeAddToGroupOp, +::mlir::async::RuntimeAwaitAndResumeOp, +::mlir::async::RuntimeAwaitOp, +::mlir::async::RuntimeCreateGroupOp, +::mlir::async::RuntimeCreateOp, +::mlir::async::RuntimeDropRefOp, +::mlir::async::RuntimeIsErrorOp, +::mlir::async::RuntimeLoadOp, +::mlir::async::RuntimeNumWorkerThreadsOp, +::mlir::async::RuntimeResumeOp, +::mlir::async::RuntimeSetAvailableOp, +::mlir::async::RuntimeSetErrorOp, +::mlir::async::RuntimeStoreOp, +::mlir::async::YieldOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace async { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::async::ValueType>(type))) || ((::llvm::isa<::mlir::async::TokenType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be async value type or async token type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::async::GroupType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be async group type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::async::CoroIdType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be switched-resume coroutine identifier, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::async::CoroHandleType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be coroutine handle, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::async::CoroStateType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be saved coroutine state, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::async::TokenType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be async token type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::async::ValueType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be async value type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::async::ValueType>(type))) || ((::llvm::isa<::mlir::async::TokenType>(type))) || ((::llvm::isa<::mlir::async::GroupType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be async value type or async token type or async group type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_AsyncOps10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: flat symbol reference attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AsyncOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AsyncOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: type attribute of function type"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AsyncOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Array of dictionary attributes"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AsyncOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isStrictlyPositive())))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_AsyncOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_AsyncOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_AsyncOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItems(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with 1 blocks"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_AsyncOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::AddToGroupOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddToGroupOpGenericAdaptorBase::AddToGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.add_to_group", odsAttrs.getContext()); +} + +AddToGroupOpGenericAdaptorBase::AddToGroupOpGenericAdaptorBase(AddToGroupOp op) : AddToGroupOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddToGroupOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AddToGroupOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AddToGroupOpAdaptor::AddToGroupOpAdaptor(AddToGroupOp op) : AddToGroupOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddToGroupOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AddToGroupOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AddToGroupOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddToGroupOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::async::GroupType> AddToGroupOp::getGroup() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::GroupType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AddToGroupOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AddToGroupOp::getGroupMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AddToGroupOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AddToGroupOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> AddToGroupOp::getRank() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void AddToGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rank, ::mlir::Value operand, ::mlir::Value group) { + odsState.addOperands(operand); + odsState.addOperands(group); + odsState.addTypes(rank); +} + +void AddToGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value group) { + odsState.addOperands(operand); + odsState.addOperands(group); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddToGroupOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AddToGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value group) { + odsState.addOperands(operand); + odsState.addOperands(group); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddToGroupOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AddToGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddToGroupOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AddToGroupOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddToGroupOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AddToGroupOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AddToGroupOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand groupRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> groupOperands(groupRawOperands); ::llvm::SMLoc groupOperandsLoc; + (void)groupOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + groupOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(groupRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::async::GroupType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(groupOperands, odsBuildableType1, groupOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddToGroupOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getGroup(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::AddToGroupOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::AwaitAllOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AwaitAllOpGenericAdaptorBase::AwaitAllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.await_all", odsAttrs.getContext()); +} + +AwaitAllOpGenericAdaptorBase::AwaitAllOpGenericAdaptorBase(AwaitAllOp op) : AwaitAllOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AwaitAllOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AwaitAllOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AwaitAllOpAdaptor::AwaitAllOpAdaptor(AwaitAllOp op) : AwaitAllOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AwaitAllOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AwaitAllOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AwaitAllOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::GroupType> AwaitAllOp::getOperand() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::GroupType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AwaitAllOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AwaitAllOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AwaitAllOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void AwaitAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); +} + +void AwaitAllOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AwaitAllOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AwaitAllOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AwaitAllOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult AwaitAllOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::async::GroupType>(); + if (parser.resolveOperands(operandOperands, odsBuildableType0, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AwaitAllOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::AwaitAllOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::AwaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AwaitOpGenericAdaptorBase::AwaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.await", odsAttrs.getContext()); +} + +AwaitOpGenericAdaptorBase::AwaitOpGenericAdaptorBase(AwaitOp op) : AwaitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AwaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AwaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AwaitOpAdaptor::AwaitOpAdaptor(AwaitOp op) : AwaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AwaitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AwaitOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AwaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AwaitOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AwaitOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AwaitOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range AwaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AwaitOp::getResult() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult AwaitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AwaitOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AwaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> resultTypes; + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + { + ::mlir::Type resultType; + auto odsResult = parseAwaitResultType(parser, operandRawTypes[0], resultType); + if (odsResult) return ::mlir::failure(); + if (resultType) + resultTypes.push_back(resultType); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AwaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + printAwaitResultType(_odsPrinter, *this, getOperand().getType(), (getResult() ? getResult().getType() : ::mlir::Type())); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::AwaitOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CallOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.call", odsAttrs.getContext()); +} + +CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(CallOp op) : CallOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CallOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CallOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::FlatSymbolRefAttr CallOpGenericAdaptorBase::getCalleeAttr() { + auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().callee); + return attr; +} + +::llvm::StringRef CallOpGenericAdaptorBase::getCallee() { + auto attr = getCalleeAttr(); + return attr.getValue(); +} + +} // namespace detail +CallOpAdaptor::CallOpAdaptor(CallOp op) : CallOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CallOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_callee = getProperties().callee; (void)tblgen_callee; + if (!tblgen_callee) return emitError(loc, "'async.call' op ""requires attribute 'callee'"); + + if (tblgen_callee && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_callee)))) + return emitError(loc, "'async.call' op ""attribute 'callee' failed to satisfy constraint: flat symbol reference attribute"); + return ::mlir::success(); +} + +std::pair CallOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CallOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CallOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange CallOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CallOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CallOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult CallOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.callee; + auto attr = dict.get("callee"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for callee in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `callee` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CallOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.callee; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("callee", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CallOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.callee.getAsOpaquePointer())); +} + +std::optional CallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "callee") + return prop.callee; + return std::nullopt; +} + +void CallOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "callee") { + prop.callee = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.callee) attrs.append("callee", prop.callee); +} + +::mlir::LogicalResult CallOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps0(attr, "callee", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CallOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.callee))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.callee); +} + +::mlir::FlatSymbolRefAttr CallOp::getCalleeAttr() { + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().callee); +} + +::llvm::StringRef CallOp::getCallee() { + auto attr = getCalleeAttr(); + return attr.getValue(); +} + +void CallOp::setCalleeAttr(::mlir::FlatSymbolRefAttr attr) { + (*this)->setAttr(getCalleeAttrName(), attr); +} + +void CallOp::setCallee(::llvm::StringRef attrValue) { + (*this)->setAttr(getCalleeAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, FuncOp callee, ValueRange operands) { + odsState.addOperands(operands); + odsState.addAttribute("callee", SymbolRefAttr::get(callee)); + odsState.addTypes(callee.getFunctionType().getResults()); + +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, SymbolRefAttr callee, TypeRange results, ValueRange operands) { + odsState.addOperands(operands); + odsState.addAttribute("callee", callee); + odsState.addTypes(results); + +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr callee, TypeRange results, ValueRange operands) { + build(odsBuilder, odsState, SymbolRefAttr::get(callee), results, operands); + +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef callee, TypeRange results, ValueRange operands) { + build(odsBuilder, odsState, StringAttr::get(odsBuilder.getContext(), callee), + results, operands); + +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().callee = callee; + odsState.addTypes(resultType0); +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().callee = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), callee); + odsState.addTypes(resultType0); +} + +void CallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CallOp::verifyInvariantsImpl() { + auto tblgen_callee = getProperties().callee; (void)tblgen_callee; + if (!tblgen_callee) return emitOpError("requires attribute 'callee'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps0(*this, tblgen_callee, "callee"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CallOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CallOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::FlatSymbolRefAttr calleeAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> operandsTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + if (parser.parseCustomAttributeWithFallback(calleeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (calleeAttr) result.getOrAddProperties().callee = calleeAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType operands__allResult_functionType; + if (parser.parseType(operands__allResult_functionType)) + return ::mlir::failure(); + operandsTypes = operands__allResult_functionType.getInputs(); + allResultTypes = operands__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CallOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getCalleeAttr()); + _odsPrinter << "("; + _odsPrinter << getOperands(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("callee"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperands().getTypes(), getOperation()->getResultTypes()); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CallOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroBeginOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroBeginOpGenericAdaptorBase::CoroBeginOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.coro.begin", odsAttrs.getContext()); +} + +CoroBeginOpGenericAdaptorBase::CoroBeginOpGenericAdaptorBase(CoroBeginOp op) : CoroBeginOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroBeginOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroBeginOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroBeginOpAdaptor::CoroBeginOpAdaptor(CoroBeginOp op) : CoroBeginOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroBeginOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroBeginOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroBeginOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::CoroIdType> CoroBeginOp::getId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroIdType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CoroBeginOp::getIdMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroBeginOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroBeginOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::CoroHandleType> CoroBeginOp::getHandle() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroHandleType>>(*getODSResults(0).begin()); +} + +void CoroBeginOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value id) { + odsState.addOperands(id); + odsState.addTypes(handle); +} + +void CoroBeginOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value id) { + odsState.addOperands(id); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CoroBeginOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CoroBeginOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value id) { + odsState.addOperands(id); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroBeginOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CoroBeginOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CoroBeginOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CoroBeginOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroBeginOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CoroBeginOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::async::CoroHandleType>(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CoroBeginOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand idRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> idOperands(idRawOperands); ::llvm::SMLoc idOperandsLoc; + (void)idOperandsLoc; + + idOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(idRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::async::CoroHandleType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::async::CoroIdType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(idOperands, odsBuildableType1, idOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroBeginOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getId(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CoroBeginOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroEndOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroEndOpGenericAdaptorBase::CoroEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.coro.end", odsAttrs.getContext()); +} + +CoroEndOpGenericAdaptorBase::CoroEndOpGenericAdaptorBase(CoroEndOp op) : CoroEndOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroEndOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroEndOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroEndOpAdaptor::CoroEndOpAdaptor(CoroEndOp op) : CoroEndOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroEndOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroEndOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroEndOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::CoroHandleType> CoroEndOp::getHandle() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroHandleType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CoroEndOp::getHandleMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroEndOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroEndOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void CoroEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle) { + odsState.addOperands(handle); +} + +void CoroEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle) { + odsState.addOperands(handle); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroEndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroEndOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroEndOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroEndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand handleRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> handleOperands(handleRawOperands); ::llvm::SMLoc handleOperandsLoc; + (void)handleOperandsLoc; + + handleOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(handleRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::async::CoroHandleType>(); + if (parser.resolveOperands(handleOperands, odsBuildableType0, handleOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroEndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getHandle(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CoroEndOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroFreeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroFreeOpGenericAdaptorBase::CoroFreeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.coro.free", odsAttrs.getContext()); +} + +CoroFreeOpGenericAdaptorBase::CoroFreeOpGenericAdaptorBase(CoroFreeOp op) : CoroFreeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroFreeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroFreeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroFreeOpAdaptor::CoroFreeOpAdaptor(CoroFreeOp op) : CoroFreeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroFreeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroFreeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroFreeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::CoroIdType> CoroFreeOp::getId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroIdType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::async::CoroHandleType> CoroFreeOp::getHandle() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroHandleType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CoroFreeOp::getIdMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CoroFreeOp::getHandleMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroFreeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroFreeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void CoroFreeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value id, ::mlir::Value handle) { + odsState.addOperands(id); + odsState.addOperands(handle); +} + +void CoroFreeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value id, ::mlir::Value handle) { + odsState.addOperands(id); + odsState.addOperands(handle); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroFreeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroFreeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroFreeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroFreeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand idRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> idOperands(idRawOperands); ::llvm::SMLoc idOperandsLoc; + (void)idOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand handleRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> handleOperands(handleRawOperands); ::llvm::SMLoc handleOperandsLoc; + (void)handleOperandsLoc; + + idOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(idRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + handleOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(handleRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::async::CoroIdType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::async::CoroHandleType>(); + if (parser.resolveOperands(idOperands, odsBuildableType0, idOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(handleOperands, odsBuildableType1, handleOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroFreeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getId(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getHandle(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CoroFreeOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroIdOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroIdOpGenericAdaptorBase::CoroIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.coro.id", odsAttrs.getContext()); +} + +CoroIdOpGenericAdaptorBase::CoroIdOpGenericAdaptorBase(CoroIdOp op) : CoroIdOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroIdOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroIdOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroIdOpAdaptor::CoroIdOpAdaptor(CoroIdOp op) : CoroIdOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroIdOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroIdOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroIdOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CoroIdOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroIdOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::CoroIdType> CoroIdOp::getId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroIdType>>(*getODSResults(0).begin()); +} + +void CoroIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type id) { + odsState.addTypes(id); +} + +void CoroIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CoroIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CoroIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroIdOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CoroIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CoroIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CoroIdOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroIdOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CoroIdOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::async::CoroIdType>(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CoroIdOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::async::CoroIdType>(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void CoroIdOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CoroIdOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroSaveOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroSaveOpGenericAdaptorBase::CoroSaveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.coro.save", odsAttrs.getContext()); +} + +CoroSaveOpGenericAdaptorBase::CoroSaveOpGenericAdaptorBase(CoroSaveOp op) : CoroSaveOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroSaveOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroSaveOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroSaveOpAdaptor::CoroSaveOpAdaptor(CoroSaveOp op) : CoroSaveOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroSaveOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroSaveOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroSaveOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::CoroHandleType> CoroSaveOp::getHandle() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroHandleType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CoroSaveOp::getHandleMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroSaveOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroSaveOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::CoroStateType> CoroSaveOp::getState() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroStateType>>(*getODSResults(0).begin()); +} + +void CoroSaveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type state, ::mlir::Value handle) { + odsState.addOperands(handle); + odsState.addTypes(state); +} + +void CoroSaveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle) { + odsState.addOperands(handle); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CoroSaveOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CoroSaveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle) { + odsState.addOperands(handle); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroSaveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CoroSaveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CoroSaveOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CoroSaveOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroSaveOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CoroSaveOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::async::CoroStateType>(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CoroSaveOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand handleRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> handleOperands(handleRawOperands); ::llvm::SMLoc handleOperandsLoc; + (void)handleOperandsLoc; + + handleOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(handleRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::async::CoroStateType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::async::CoroHandleType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(handleOperands, odsBuildableType1, handleOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroSaveOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getHandle(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CoroSaveOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroSuspendOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroSuspendOpGenericAdaptorBase::CoroSuspendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.coro.suspend", odsAttrs.getContext()); +} + +CoroSuspendOpGenericAdaptorBase::CoroSuspendOpGenericAdaptorBase(CoroSuspendOp op) : CoroSuspendOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroSuspendOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroSuspendOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroSuspendOpAdaptor::CoroSuspendOpAdaptor(CoroSuspendOp op) : CoroSuspendOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroSuspendOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroSuspendOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroSuspendOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::CoroStateType> CoroSuspendOp::getState() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroStateType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CoroSuspendOp::getStateMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroSuspendOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroSuspendOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *CoroSuspendOp::getSuspendDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *CoroSuspendOp::getResumeDest() { + return (*this)->getSuccessor(1); +} + +::mlir::Block *CoroSuspendOp::getCleanupDest() { + return (*this)->getSuccessor(2); +} + +void CoroSuspendOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value state, ::mlir::Block *suspendDest, ::mlir::Block *resumeDest, ::mlir::Block *cleanupDest) { + odsState.addOperands(state); + odsState.addSuccessors(suspendDest); + odsState.addSuccessors(resumeDest); + odsState.addSuccessors(cleanupDest); +} + +void CoroSuspendOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value state, ::mlir::Block *suspendDest, ::mlir::Block *resumeDest, ::mlir::Block *cleanupDest) { + odsState.addOperands(state); + odsState.addSuccessors(suspendDest); + odsState.addSuccessors(resumeDest); + odsState.addSuccessors(cleanupDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroSuspendOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroSuspendOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroSuspendOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroSuspendOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand stateRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> stateOperands(stateRawOperands); ::llvm::SMLoc stateOperandsLoc; + (void)stateOperandsLoc; + ::mlir::Block *suspendDestSuccessor = nullptr; + ::mlir::Block *resumeDestSuccessor = nullptr; + ::mlir::Block *cleanupDestSuccessor = nullptr; + + stateOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(stateRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseSuccessor(suspendDestSuccessor)) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseSuccessor(resumeDestSuccessor)) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseSuccessor(cleanupDestSuccessor)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addSuccessors(suspendDestSuccessor); + result.addSuccessors(resumeDestSuccessor); + result.addSuccessors(cleanupDestSuccessor); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::async::CoroStateType>(); + if (parser.resolveOperands(stateOperands, odsBuildableType0, stateOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroSuspendOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getState(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSuspendDest(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getResumeDest(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCleanupDest(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CoroSuspendOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CreateGroupOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateGroupOpGenericAdaptorBase::CreateGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.create_group", odsAttrs.getContext()); +} + +CreateGroupOpGenericAdaptorBase::CreateGroupOpGenericAdaptorBase(CreateGroupOp op) : CreateGroupOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateGroupOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CreateGroupOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CreateGroupOpAdaptor::CreateGroupOpAdaptor(CreateGroupOp op) : CreateGroupOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateGroupOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CreateGroupOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CreateGroupOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> CreateGroupOp::getSize() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CreateGroupOp::getSizeMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CreateGroupOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CreateGroupOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::GroupType> CreateGroupOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::GroupType>>(*getODSResults(0).begin()); +} + +void CreateGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value size) { + odsState.addOperands(size); + odsState.addTypes(result); +} + +void CreateGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value size) { + odsState.addOperands(size); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CreateGroupOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CreateGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value size) { + odsState.addOperands(size); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateGroupOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CreateGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CreateGroupOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CreateGroupOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateGroupOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void CreateGroupOp::getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context) { + results.add(canonicalize); +} + +::mlir::LogicalResult CreateGroupOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::async::GroupType>(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CreateGroupOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sizeRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sizeOperands(sizeRawOperands); ::llvm::SMLoc sizeOperandsLoc; + (void)sizeOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + sizeOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sizeRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::async::GroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resultTypes); + if (parser.resolveOperands(sizeOperands, odsBuildableType0, sizeOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateGroupOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSize(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::async::GroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void CreateGroupOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CreateGroupOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::ExecuteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExecuteOpGenericAdaptorBase::ExecuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.execute", odsAttrs.getContext()); +} + +ExecuteOpGenericAdaptorBase::ExecuteOpGenericAdaptorBase(ExecuteOp op) : ExecuteOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExecuteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ExecuteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &ExecuteOpGenericAdaptorBase::getBodyRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange ExecuteOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ExecuteOpAdaptor::ExecuteOpAdaptor(ExecuteOp op) : ExecuteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExecuteOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void ExecuteOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "token"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "bodyResults"); +} + +std::pair ExecuteOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ExecuteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ExecuteOp::getDependencies() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range ExecuteOp::getBodyOperands() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange ExecuteOp::getDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ExecuteOp::getBodyOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ExecuteOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range ExecuteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::TokenType> ExecuteOp::getToken() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::TokenType>>(*getODSResults(0).begin()); +} + +::mlir::Operation::result_range ExecuteOp::getBodyResults() { + return getODSResults(1); +} + +::mlir::Region &ExecuteOp::getBodyRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult ExecuteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ExecuteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExecuteOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ExecuteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ExecuteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ExecuteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ExecuteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult ExecuteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ExecuteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::LogicalResult ExecuteOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps8(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_AsyncOps0(*this, region, "bodyRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExecuteOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::ExecuteOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::FuncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.func", odsAttrs.getContext()); +} + +FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(FuncOp op) : FuncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FuncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FuncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr FuncOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef FuncOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FuncOpGenericAdaptorBase::getFunctionTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); + return attr; +} + +::mlir::FunctionType FuncOpGenericAdaptorBase::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::StringAttr FuncOpGenericAdaptorBase::getSymVisibilityAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); + return attr; +} + +::std::optional< ::llvm::StringRef > FuncOpGenericAdaptorBase::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOpGenericAdaptorBase::getArgAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOpGenericAdaptorBase::getResAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::Region &FuncOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange FuncOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +FuncOpAdaptor::FuncOpAdaptor(FuncOp op) : FuncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FuncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitError(loc, "'async.func' op ""requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'async.func' op ""requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'async.func' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))))) + return emitError(loc, "'async.func' op ""attribute 'function_type' failed to satisfy constraint: type attribute of function type"); + + if (tblgen_sym_visibility && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_visibility)))) + return emitError(loc, "'async.func' op ""attribute 'sym_visibility' failed to satisfy constraint: string attribute"); + + if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'async.func' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'async.func' op ""attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); + return ::mlir::success(); +} + +std::pair FuncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FuncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair FuncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FuncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &FuncOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult FuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.arg_attrs; + auto attr = dict.get("arg_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for arg_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.function_type; + auto attr = dict.get("function_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for function_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `function_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.res_attrs; + auto attr = dict.get("res_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for res_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_visibility; + auto attr = dict.get("sym_visibility"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for sym_visibility in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.arg_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.function_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("function_type", + propStorage)); + } + + { + const auto &propStorage = prop.res_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("res_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.sym_visibility; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_visibility", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FuncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.function_type.getAsOpaquePointer()), + llvm::hash_value(prop.res_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.sym_visibility.getAsOpaquePointer())); +} + +std::optional FuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "arg_attrs") + return prop.arg_attrs; + + if (name == "function_type") + return prop.function_type; + + if (name == "res_attrs") + return prop.res_attrs; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "sym_visibility") + return prop.sym_visibility; + return std::nullopt; +} + +void FuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "arg_attrs") { + prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "function_type") { + prop.function_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "res_attrs") { + prop.res_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_visibility") { + prop.sym_visibility = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); + + if (prop.function_type) attrs.append("function_type", prop.function_type); + + if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.sym_visibility) attrs.append("sym_visibility", prop.sym_visibility); +} + +::mlir::LogicalResult FuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps3(attr, "arg_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps2(attr, "function_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps3(attr, "res_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps1(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymVisibilityAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps1(attr, "sym_visibility", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.function_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.sym_visibility))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.arg_attrs); + writer.writeAttribute(prop.function_type); + + writer.writeOptionalAttribute(prop.res_attrs); + writer.writeAttribute(prop.sym_name); + + writer.writeOptionalAttribute(prop.sym_visibility); +} + +::mlir::StringAttr FuncOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef FuncOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FuncOp::getFunctionTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); +} + +::mlir::FunctionType FuncOp::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::StringAttr FuncOp::getSymVisibilityAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); +} + +::std::optional< ::llvm::StringRef > FuncOp::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOp::getArgAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); +} + +::std::optional< ::mlir::ArrayAttr > FuncOp::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOp::getResAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); +} + +::std::optional< ::mlir::ArrayAttr > FuncOp::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void FuncOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void FuncOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void FuncOp::setFunctionTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getFunctionTypeAttrName(), attr); +} + +void FuncOp::setFunctionType(::mlir::FunctionType attrValue) { + (*this)->setAttr(getFunctionTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void FuncOp::setSymVisibilityAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymVisibilityAttrName(), attr); +} + +void FuncOp::setSymVisibility(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSymVisibilityAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSymVisibilityAttrName()); +} + +void FuncOp::setArgAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getArgAttrsAttrName(), attr); +} + +void FuncOp::setResAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getResAttrsAttrName(), attr); +} + +::mlir::Attribute FuncOp::removeSymVisibilityAttr() { + auto &attr = getProperties().sym_visibility; + attr = {}; + return attr; +} + +::mlir::Attribute FuncOp::removeArgAttrsAttr() { + auto &attr = getProperties().arg_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute FuncOp::removeResAttrsAttr() { + auto &attr = getProperties().res_attrs; + attr = {}; + return attr; +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().function_type = function_type; + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + (void)odsState.addRegion(); +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().function_type = function_type; + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + (void)odsState.addRegion(); +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FuncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FuncOp::verifyInvariantsImpl() { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps1(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps2(*this, tblgen_function_type, "function_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps1(*this, tblgen_sym_visibility, "sym_visibility"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps3(*this, tblgen_arg_attrs, "arg_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps3(*this, tblgen_res_attrs, "res_attrs"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_AsyncOps1(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FuncOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::FuncOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::ReturnOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.return", odsAttrs.getContext()); +} + +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(ReturnOp op) : ReturnOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReturnOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ReturnOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ReturnOpAdaptor::ReturnOpAdaptor(ReturnOp op) : ReturnOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReturnOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ReturnOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ReturnOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ReturnOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange ReturnOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ReturnOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReturnOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +build(odsBuilder, odsState, std::nullopt); +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { + odsState.addOperands(operands); +} + +void ReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReturnOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReturnOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReturnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> operandsTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (!operandsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(operandsTypes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (!getOperands().empty()) { + _odsPrinter << ' '; + _odsPrinter << getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperands().getTypes(); + } +} + +void ReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange ReturnOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::ReturnOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeAddRefOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeAddRefOpGenericAdaptorBase::RuntimeAddRefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.add_ref", odsAttrs.getContext()); +} + +RuntimeAddRefOpGenericAdaptorBase::RuntimeAddRefOpGenericAdaptorBase(RuntimeAddRefOp op) : RuntimeAddRefOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeAddRefOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeAddRefOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr RuntimeAddRefOpGenericAdaptorBase::getCountAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().count); + return attr; +} + +uint64_t RuntimeAddRefOpGenericAdaptorBase::getCount() { + auto attr = getCountAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +RuntimeAddRefOpAdaptor::RuntimeAddRefOpAdaptor(RuntimeAddRefOp op) : RuntimeAddRefOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeAddRefOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_count = getProperties().count; (void)tblgen_count; + if (!tblgen_count) return emitError(loc, "'async.runtime.add_ref' op ""requires attribute 'count'"); + + if (tblgen_count && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_count))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_count).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_count).getValue().isStrictlyPositive())))) + return emitError(loc, "'async.runtime.add_ref' op ""attribute 'count' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive"); + return ::mlir::success(); +} + +std::pair RuntimeAddRefOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeAddRefOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeAddRefOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RuntimeAddRefOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeAddRefOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeAddRefOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RuntimeAddRefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.count; + auto attr = dict.get("count"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for count in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `count` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RuntimeAddRefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.count; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("count", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RuntimeAddRefOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.count.getAsOpaquePointer())); +} + +std::optional RuntimeAddRefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "count") + return prop.count; + return std::nullopt; +} + +void RuntimeAddRefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "count") { + prop.count = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RuntimeAddRefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.count) attrs.append("count", prop.count); +} + +::mlir::LogicalResult RuntimeAddRefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCountAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps4(attr, "count", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeAddRefOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.count))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeAddRefOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.count); +} + +::mlir::IntegerAttr RuntimeAddRefOp::getCountAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().count); +} + +uint64_t RuntimeAddRefOp::getCount() { + auto attr = getCountAttr(); + return attr.getValue().getZExtValue(); +} + +void RuntimeAddRefOp::setCountAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getCountAttrName(), attr); +} + +void RuntimeAddRefOp::setCount(uint64_t attrValue) { + (*this)->setAttr(getCountAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue)); +} + +void RuntimeAddRefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::IntegerAttr count) { + odsState.addOperands(operand); + odsState.getOrAddProperties().count = count; +} + +void RuntimeAddRefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr count) { + odsState.addOperands(operand); + odsState.getOrAddProperties().count = count; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeAddRefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, uint64_t count) { + odsState.addOperands(operand); + odsState.getOrAddProperties().count = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), count); +} + +void RuntimeAddRefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t count) { + odsState.addOperands(operand); + odsState.getOrAddProperties().count = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), count); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeAddRefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RuntimeAddRefOp::verifyInvariantsImpl() { + auto tblgen_count = getProperties().count; (void)tblgen_count; + if (!tblgen_count) return emitOpError("requires attribute 'count'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps4(*this, tblgen_count, "count"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeAddRefOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RuntimeAddRefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeAddRefOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeAddRefOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeAddToGroupOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeAddToGroupOpGenericAdaptorBase::RuntimeAddToGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.add_to_group", odsAttrs.getContext()); +} + +RuntimeAddToGroupOpGenericAdaptorBase::RuntimeAddToGroupOpGenericAdaptorBase(RuntimeAddToGroupOp op) : RuntimeAddToGroupOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeAddToGroupOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeAddToGroupOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeAddToGroupOpAdaptor::RuntimeAddToGroupOpAdaptor(RuntimeAddToGroupOp op) : RuntimeAddToGroupOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeAddToGroupOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeAddToGroupOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeAddToGroupOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeAddToGroupOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::async::GroupType> RuntimeAddToGroupOp::getGroup() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::GroupType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &RuntimeAddToGroupOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RuntimeAddToGroupOp::getGroupMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeAddToGroupOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeAddToGroupOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> RuntimeAddToGroupOp::getRank() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void RuntimeAddToGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rank, ::mlir::Value operand, ::mlir::Value group) { + odsState.addOperands(operand); + odsState.addOperands(group); + odsState.addTypes(rank); +} + +void RuntimeAddToGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value group) { + odsState.addOperands(operand); + odsState.addOperands(group); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeAddToGroupOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RuntimeAddToGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value group) { + odsState.addOperands(operand); + odsState.addOperands(group); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeAddToGroupOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RuntimeAddToGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeAddToGroupOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RuntimeAddToGroupOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeAddToGroupOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RuntimeAddToGroupOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RuntimeAddToGroupOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand groupRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> groupOperands(groupRawOperands); ::llvm::SMLoc groupOperandsLoc; + (void)groupOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + groupOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(groupRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::async::GroupType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(groupOperands, odsBuildableType1, groupOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeAddToGroupOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getGroup(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeAddToGroupOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeAwaitAndResumeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeAwaitAndResumeOpGenericAdaptorBase::RuntimeAwaitAndResumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.await_and_resume", odsAttrs.getContext()); +} + +RuntimeAwaitAndResumeOpGenericAdaptorBase::RuntimeAwaitAndResumeOpGenericAdaptorBase(RuntimeAwaitAndResumeOp op) : RuntimeAwaitAndResumeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeAwaitAndResumeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeAwaitAndResumeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeAwaitAndResumeOpAdaptor::RuntimeAwaitAndResumeOpAdaptor(RuntimeAwaitAndResumeOp op) : RuntimeAwaitAndResumeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeAwaitAndResumeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeAwaitAndResumeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeAwaitAndResumeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeAwaitAndResumeOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::async::CoroHandleType> RuntimeAwaitAndResumeOp::getHandle() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroHandleType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &RuntimeAwaitAndResumeOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RuntimeAwaitAndResumeOp::getHandleMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeAwaitAndResumeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeAwaitAndResumeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RuntimeAwaitAndResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value handle) { + odsState.addOperands(operand); + odsState.addOperands(handle); +} + +void RuntimeAwaitAndResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value handle) { + odsState.addOperands(operand); + odsState.addOperands(handle); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeAwaitAndResumeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RuntimeAwaitAndResumeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeAwaitAndResumeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RuntimeAwaitAndResumeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand handleRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> handleOperands(handleRawOperands); ::llvm::SMLoc handleOperandsLoc; + (void)handleOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + handleOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(handleRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::async::CoroHandleType>(); + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(handleOperands, odsBuildableType0, handleOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeAwaitAndResumeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getHandle(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeAwaitAndResumeOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeAwaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeAwaitOpGenericAdaptorBase::RuntimeAwaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.await", odsAttrs.getContext()); +} + +RuntimeAwaitOpGenericAdaptorBase::RuntimeAwaitOpGenericAdaptorBase(RuntimeAwaitOp op) : RuntimeAwaitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeAwaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeAwaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeAwaitOpAdaptor::RuntimeAwaitOpAdaptor(RuntimeAwaitOp op) : RuntimeAwaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeAwaitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeAwaitOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeAwaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeAwaitOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RuntimeAwaitOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeAwaitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeAwaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RuntimeAwaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); +} + +void RuntimeAwaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeAwaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RuntimeAwaitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeAwaitOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RuntimeAwaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeAwaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeAwaitOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeCreateGroupOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeCreateGroupOpGenericAdaptorBase::RuntimeCreateGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.create_group", odsAttrs.getContext()); +} + +RuntimeCreateGroupOpGenericAdaptorBase::RuntimeCreateGroupOpGenericAdaptorBase(RuntimeCreateGroupOp op) : RuntimeCreateGroupOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeCreateGroupOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeCreateGroupOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeCreateGroupOpAdaptor::RuntimeCreateGroupOpAdaptor(RuntimeCreateGroupOp op) : RuntimeCreateGroupOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeCreateGroupOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeCreateGroupOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeCreateGroupOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> RuntimeCreateGroupOp::getSize() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RuntimeCreateGroupOp::getSizeMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeCreateGroupOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeCreateGroupOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::GroupType> RuntimeCreateGroupOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::GroupType>>(*getODSResults(0).begin()); +} + +void RuntimeCreateGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value size) { + odsState.addOperands(size); + odsState.addTypes(result); +} + +void RuntimeCreateGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value size) { + odsState.addOperands(size); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeCreateGroupOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RuntimeCreateGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value size) { + odsState.addOperands(size); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeCreateGroupOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RuntimeCreateGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeCreateGroupOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RuntimeCreateGroupOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeCreateGroupOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RuntimeCreateGroupOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::async::GroupType>(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RuntimeCreateGroupOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sizeRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sizeOperands(sizeRawOperands); ::llvm::SMLoc sizeOperandsLoc; + (void)sizeOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + sizeOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sizeRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::async::GroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resultTypes); + if (parser.resolveOperands(sizeOperands, odsBuildableType0, sizeOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeCreateGroupOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSize(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::async::GroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeCreateGroupOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeCreateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeCreateOpGenericAdaptorBase::RuntimeCreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.create", odsAttrs.getContext()); +} + +RuntimeCreateOpGenericAdaptorBase::RuntimeCreateOpGenericAdaptorBase(RuntimeCreateOp op) : RuntimeCreateOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeCreateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeCreateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeCreateOpAdaptor::RuntimeCreateOpAdaptor(RuntimeCreateOp op) : RuntimeCreateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeCreateOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeCreateOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeCreateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair RuntimeCreateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeCreateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeCreateOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void RuntimeCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) { + odsState.addTypes(result); +} + +void RuntimeCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeCreateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RuntimeCreateOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeCreateOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RuntimeCreateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + return ::mlir::success(); +} + +void RuntimeCreateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeCreateOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeDropRefOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeDropRefOpGenericAdaptorBase::RuntimeDropRefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.drop_ref", odsAttrs.getContext()); +} + +RuntimeDropRefOpGenericAdaptorBase::RuntimeDropRefOpGenericAdaptorBase(RuntimeDropRefOp op) : RuntimeDropRefOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeDropRefOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeDropRefOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr RuntimeDropRefOpGenericAdaptorBase::getCountAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().count); + return attr; +} + +uint64_t RuntimeDropRefOpGenericAdaptorBase::getCount() { + auto attr = getCountAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +RuntimeDropRefOpAdaptor::RuntimeDropRefOpAdaptor(RuntimeDropRefOp op) : RuntimeDropRefOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeDropRefOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_count = getProperties().count; (void)tblgen_count; + if (!tblgen_count) return emitError(loc, "'async.runtime.drop_ref' op ""requires attribute 'count'"); + + if (tblgen_count && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_count))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_count).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_count).getValue().isStrictlyPositive())))) + return emitError(loc, "'async.runtime.drop_ref' op ""attribute 'count' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive"); + return ::mlir::success(); +} + +std::pair RuntimeDropRefOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeDropRefOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeDropRefOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RuntimeDropRefOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeDropRefOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeDropRefOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RuntimeDropRefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.count; + auto attr = dict.get("count"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for count in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `count` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RuntimeDropRefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.count; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("count", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RuntimeDropRefOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.count.getAsOpaquePointer())); +} + +std::optional RuntimeDropRefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "count") + return prop.count; + return std::nullopt; +} + +void RuntimeDropRefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "count") { + prop.count = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RuntimeDropRefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.count) attrs.append("count", prop.count); +} + +::mlir::LogicalResult RuntimeDropRefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCountAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps4(attr, "count", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeDropRefOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.count))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeDropRefOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.count); +} + +::mlir::IntegerAttr RuntimeDropRefOp::getCountAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().count); +} + +uint64_t RuntimeDropRefOp::getCount() { + auto attr = getCountAttr(); + return attr.getValue().getZExtValue(); +} + +void RuntimeDropRefOp::setCountAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getCountAttrName(), attr); +} + +void RuntimeDropRefOp::setCount(uint64_t attrValue) { + (*this)->setAttr(getCountAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue)); +} + +void RuntimeDropRefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::IntegerAttr count) { + odsState.addOperands(operand); + odsState.getOrAddProperties().count = count; +} + +void RuntimeDropRefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr count) { + odsState.addOperands(operand); + odsState.getOrAddProperties().count = count; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeDropRefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, uint64_t count) { + odsState.addOperands(operand); + odsState.getOrAddProperties().count = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), count); +} + +void RuntimeDropRefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t count) { + odsState.addOperands(operand); + odsState.getOrAddProperties().count = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), count); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeDropRefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RuntimeDropRefOp::verifyInvariantsImpl() { + auto tblgen_count = getProperties().count; (void)tblgen_count; + if (!tblgen_count) return emitOpError("requires attribute 'count'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_AsyncOps4(*this, tblgen_count, "count"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeDropRefOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RuntimeDropRefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeDropRefOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeDropRefOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeIsErrorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeIsErrorOpGenericAdaptorBase::RuntimeIsErrorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.is_error", odsAttrs.getContext()); +} + +RuntimeIsErrorOpGenericAdaptorBase::RuntimeIsErrorOpGenericAdaptorBase(RuntimeIsErrorOp op) : RuntimeIsErrorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeIsErrorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeIsErrorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeIsErrorOpAdaptor::RuntimeIsErrorOpAdaptor(RuntimeIsErrorOp op) : RuntimeIsErrorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeIsErrorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeIsErrorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeIsErrorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeIsErrorOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RuntimeIsErrorOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeIsErrorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeIsErrorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> RuntimeIsErrorOp::getIsError() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +void RuntimeIsErrorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type is_error, ::mlir::Value operand) { + odsState.addOperands(operand); + odsState.addTypes(is_error); +} + +void RuntimeIsErrorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeIsErrorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RuntimeIsErrorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeIsErrorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RuntimeIsErrorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeIsErrorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RuntimeIsErrorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeIsErrorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RuntimeIsErrorOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(1); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RuntimeIsErrorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeIsErrorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeIsErrorOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeLoadOpGenericAdaptorBase::RuntimeLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.load", odsAttrs.getContext()); +} + +RuntimeLoadOpGenericAdaptorBase::RuntimeLoadOpGenericAdaptorBase(RuntimeLoadOp op) : RuntimeLoadOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeLoadOpAdaptor::RuntimeLoadOpAdaptor(RuntimeLoadOp op) : RuntimeLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeLoadOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeLoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::ValueType> RuntimeLoadOp::getStorage() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::ValueType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RuntimeLoadOp::getStorageMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeLoadOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void RuntimeLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value storage) { + odsState.addOperands(storage); + odsState.addTypes(result); +} + +void RuntimeLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value storage) { + odsState.addOperands(storage); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeLoadOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RuntimeLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value storage) { + odsState.addOperands(storage); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RuntimeLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeLoadOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RuntimeLoadOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getValueType(), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that type of 'value' matches element type of 'storage'"); + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RuntimeLoadOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::llvm::cast(operands[0].getType()).getValueType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RuntimeLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand storageRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> storageOperands(storageRawOperands); ::llvm::SMLoc storageOperandsLoc; + (void)storageOperandsLoc; + ::mlir::Type storageRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> storageTypes(storageRawTypes); + + storageOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(storageRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::async::ValueType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + storageRawTypes[0] = type; + } + for (::mlir::Type type : storageTypes) { + (void)type; + if (!((::llvm::isa<::mlir::async::ValueType>(type)))) { + return parser.emitError(parser.getNameLoc()) << "'storage' must be async value type, but got " << type; + } + } + result.addTypes(::llvm::cast(storageTypes[0]).getValueType()); + if (parser.resolveOperands(storageOperands, storageTypes, storageOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getStorage(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getStorage().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::async::ValueType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeLoadOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeNumWorkerThreadsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeNumWorkerThreadsOpGenericAdaptorBase::RuntimeNumWorkerThreadsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.num_worker_threads", odsAttrs.getContext()); +} + +RuntimeNumWorkerThreadsOpGenericAdaptorBase::RuntimeNumWorkerThreadsOpGenericAdaptorBase(RuntimeNumWorkerThreadsOp op) : RuntimeNumWorkerThreadsOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeNumWorkerThreadsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeNumWorkerThreadsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeNumWorkerThreadsOpAdaptor::RuntimeNumWorkerThreadsOpAdaptor(RuntimeNumWorkerThreadsOp op) : RuntimeNumWorkerThreadsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeNumWorkerThreadsOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeNumWorkerThreadsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeNumWorkerThreadsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair RuntimeNumWorkerThreadsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeNumWorkerThreadsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> RuntimeNumWorkerThreadsOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void RuntimeNumWorkerThreadsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) { + odsState.addTypes(result); +} + +void RuntimeNumWorkerThreadsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeNumWorkerThreadsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RuntimeNumWorkerThreadsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeNumWorkerThreadsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RuntimeNumWorkerThreadsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RuntimeNumWorkerThreadsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RuntimeNumWorkerThreadsOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeNumWorkerThreadsOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RuntimeNumWorkerThreadsOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RuntimeNumWorkerThreadsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IndexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + return ::mlir::success(); +} + +void RuntimeNumWorkerThreadsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IndexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeNumWorkerThreadsOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeResumeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeResumeOpGenericAdaptorBase::RuntimeResumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.resume", odsAttrs.getContext()); +} + +RuntimeResumeOpGenericAdaptorBase::RuntimeResumeOpGenericAdaptorBase(RuntimeResumeOp op) : RuntimeResumeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeResumeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeResumeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeResumeOpAdaptor::RuntimeResumeOpAdaptor(RuntimeResumeOp op) : RuntimeResumeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeResumeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeResumeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeResumeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::async::CoroHandleType> RuntimeResumeOp::getHandle() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::CoroHandleType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RuntimeResumeOp::getHandleMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeResumeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeResumeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RuntimeResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle) { + odsState.addOperands(handle); +} + +void RuntimeResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle) { + odsState.addOperands(handle); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeResumeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RuntimeResumeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeResumeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RuntimeResumeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand handleRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> handleOperands(handleRawOperands); ::llvm::SMLoc handleOperandsLoc; + (void)handleOperandsLoc; + + handleOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(handleRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::async::CoroHandleType>(); + if (parser.resolveOperands(handleOperands, odsBuildableType0, handleOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeResumeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getHandle(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeResumeOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeSetAvailableOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeSetAvailableOpGenericAdaptorBase::RuntimeSetAvailableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.set_available", odsAttrs.getContext()); +} + +RuntimeSetAvailableOpGenericAdaptorBase::RuntimeSetAvailableOpGenericAdaptorBase(RuntimeSetAvailableOp op) : RuntimeSetAvailableOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeSetAvailableOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeSetAvailableOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeSetAvailableOpAdaptor::RuntimeSetAvailableOpAdaptor(RuntimeSetAvailableOp op) : RuntimeSetAvailableOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeSetAvailableOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeSetAvailableOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeSetAvailableOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeSetAvailableOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RuntimeSetAvailableOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeSetAvailableOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeSetAvailableOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RuntimeSetAvailableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); +} + +void RuntimeSetAvailableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeSetAvailableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RuntimeSetAvailableOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeSetAvailableOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RuntimeSetAvailableOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeSetAvailableOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeSetAvailableOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeSetErrorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeSetErrorOpGenericAdaptorBase::RuntimeSetErrorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.set_error", odsAttrs.getContext()); +} + +RuntimeSetErrorOpGenericAdaptorBase::RuntimeSetErrorOpGenericAdaptorBase(RuntimeSetErrorOp op) : RuntimeSetErrorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeSetErrorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeSetErrorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeSetErrorOpAdaptor::RuntimeSetErrorOpAdaptor(RuntimeSetErrorOp op) : RuntimeSetErrorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeSetErrorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeSetErrorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeSetErrorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeSetErrorOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RuntimeSetErrorOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeSetErrorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeSetErrorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RuntimeSetErrorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); +} + +void RuntimeSetErrorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeSetErrorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RuntimeSetErrorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeSetErrorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RuntimeSetErrorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeSetErrorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeSetErrorOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RuntimeStoreOpGenericAdaptorBase::RuntimeStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.runtime.store", odsAttrs.getContext()); +} + +RuntimeStoreOpGenericAdaptorBase::RuntimeStoreOpGenericAdaptorBase(RuntimeStoreOp op) : RuntimeStoreOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RuntimeStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RuntimeStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RuntimeStoreOpAdaptor::RuntimeStoreOpAdaptor(RuntimeStoreOp op) : RuntimeStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RuntimeStoreOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RuntimeStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RuntimeStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RuntimeStoreOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::async::ValueType> RuntimeStoreOp::getStorage() { + return ::llvm::cast<::mlir::TypedValue<::mlir::async::ValueType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &RuntimeStoreOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RuntimeStoreOp::getStorageMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair RuntimeStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RuntimeStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RuntimeStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value storage) { + odsState.addOperands(value); + odsState.addOperands(storage); +} + +void RuntimeStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value storage) { + odsState.addOperands(value); + odsState.addOperands(storage); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RuntimeStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RuntimeStoreOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(1).begin()).getType()).getValueType(), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that type of 'value' matches element type of 'storage'"); + return ::mlir::success(); +} + +::mlir::LogicalResult RuntimeStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RuntimeStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand storageRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> storageOperands(storageRawOperands); ::llvm::SMLoc storageOperandsLoc; + (void)storageOperandsLoc; + ::mlir::Type storageRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> storageTypes(storageRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + storageOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(storageRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::async::ValueType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + storageRawTypes[0] = type; + } + for (::mlir::Type type : storageTypes) { + (void)type; + if (!((::llvm::isa<::mlir::async::ValueType>(type)))) { + return parser.emitError(parser.getNameLoc()) << "'storage' must be async value type, but got " << type; + } + } + if (parser.resolveOperands(valueOperands, ::llvm::cast(storageTypes[0]).getValueType(), valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(storageOperands, storageTypes, storageOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RuntimeStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getStorage(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getStorage().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::async::ValueType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeStoreOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::YieldOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("async.yield", odsAttrs.getContext()); +} + +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(YieldOp op) : YieldOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair YieldOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr YieldOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +YieldOpAdaptor::YieldOpAdaptor(YieldOp op) : YieldOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult YieldOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair YieldOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range YieldOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range YieldOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange YieldOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair YieldOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range YieldOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { + odsState.addOperands(operands); +} + +void YieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult YieldOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_AsyncOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult YieldOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult YieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> operandsTypes; + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (!operandsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(operandsTypes)) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void YieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (!getOperands().empty()) { + _odsPrinter << ' '; + _odsPrinter << getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperands().getTypes(); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void YieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange YieldOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..0eaf391b91e26e41f1dd113507b0e734f630fced --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOps.h.inc @@ -0,0 +1,3548 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AsyncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace async { +class AddToGroupOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class AwaitAllOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class AwaitOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class CallOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class CoroBeginOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class CoroEndOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class CoroFreeOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class CoroIdOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class CoroSaveOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class CoroSuspendOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class CreateGroupOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class ExecuteOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class FuncOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class ReturnOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeAddRefOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeAddToGroupOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeAwaitAndResumeOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeAwaitOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeCreateGroupOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeCreateOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeDropRefOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeIsErrorOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeLoadOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeNumWorkerThreadsOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeResumeOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeSetAvailableOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeSetErrorOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class RuntimeStoreOp; +} // namespace async +} // namespace mlir +namespace mlir { +namespace async { +class YieldOp; +} // namespace async +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::AddToGroupOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddToGroupOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddToGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddToGroupOpGenericAdaptorBase(AddToGroupOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddToGroupOpGenericAdaptor : public detail::AddToGroupOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddToGroupOpGenericAdaptorBase; +public: + AddToGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddToGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddToGroupOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddToGroupOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroup() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddToGroupOpAdaptor : public AddToGroupOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddToGroupOpGenericAdaptor::AddToGroupOpGenericAdaptor; + AddToGroupOpAdaptor(AddToGroupOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddToGroupOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddToGroupOpAdaptor; + template + using GenericAdaptor = AddToGroupOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.add_to_group"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::TypedValue<::mlir::async::GroupType> getGroup(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getGroupMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getRank(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rank, ::mlir::Value operand, ::mlir::Value group); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value group); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value group); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::AddToGroupOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::AwaitAllOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AwaitAllOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AwaitAllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AwaitAllOpGenericAdaptorBase(AwaitAllOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AwaitAllOpGenericAdaptor : public detail::AwaitAllOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AwaitAllOpGenericAdaptorBase; +public: + AwaitAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AwaitAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AwaitAllOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AwaitAllOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AwaitAllOpAdaptor : public AwaitAllOpGenericAdaptor<::mlir::ValueRange> { +public: + using AwaitAllOpGenericAdaptor::AwaitAllOpGenericAdaptor; + AwaitAllOpAdaptor(AwaitAllOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AwaitAllOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AwaitAllOpAdaptor; + template + using GenericAdaptor = AwaitAllOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.await_all"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::async::GroupType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::AwaitAllOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::AwaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AwaitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AwaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AwaitOpGenericAdaptorBase(AwaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AwaitOpGenericAdaptor : public detail::AwaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AwaitOpGenericAdaptorBase; +public: + AwaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AwaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AwaitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AwaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AwaitOpAdaptor : public AwaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using AwaitOpGenericAdaptor::AwaitOpGenericAdaptor; + AwaitOpAdaptor(AwaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AwaitOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AwaitOpAdaptor; + template + using GenericAdaptor = AwaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.await"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value operand, ArrayRef attrs = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + std::optional getResultType() { + if (getResultTypes().empty()) return std::nullopt; + return getResultTypes()[0]; + } +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::AwaitOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CallOpGenericAdaptorBase { +public: + struct Properties { + using calleeTy = ::mlir::FlatSymbolRefAttr; + calleeTy callee; + + auto getCallee() { + auto &propStorage = this->callee; + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setCallee(const ::mlir::FlatSymbolRefAttr &propValue) { + this->callee = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.callee == this->callee && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CallOpGenericAdaptorBase(CallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); +}; +} // namespace detail +template +class CallOpGenericAdaptor : public detail::CallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CallOpGenericAdaptorBase; +public: + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CallOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class CallOpAdaptor : public CallOpGenericAdaptor<::mlir::ValueRange> { +public: + using CallOpGenericAdaptor::CallOpGenericAdaptor; + CallOpAdaptor(CallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CallOpAdaptor; + template + using GenericAdaptor = CallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("callee")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCalleeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.call"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); + void setCalleeAttr(::mlir::FlatSymbolRefAttr attr); + void setCallee(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, FuncOp callee, ValueRange operands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, SymbolRefAttr callee, TypeRange results, ValueRange operands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr callee, TypeRange results, ValueRange operands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef callee, TypeRange results, ValueRange operands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + FunctionType getCalleeType(); + + /// Get the argument operands to the called function. + operand_range getArgOperands() { + return {arg_operand_begin(), arg_operand_end()}; + } + + MutableOperandRange getArgOperandsMutable() { + return getOperandsMutable(); + } + + operand_iterator arg_operand_begin() { return operand_begin(); } + operand_iterator arg_operand_end() { return operand_end(); } + + /// Return the callee of this operation. + CallInterfaceCallable getCallableForCallee() { + return (*this)->getAttrOfType("callee"); + } + + /// Set the callee for this operation. + void setCalleeFromCallable(CallInterfaceCallable callee) { + (*this)->setAttr("callee", callee.get()); + } +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CallOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroBeginOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroBeginOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroBeginOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroBeginOpGenericAdaptorBase(CoroBeginOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroBeginOpGenericAdaptor : public detail::CoroBeginOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroBeginOpGenericAdaptorBase; +public: + CoroBeginOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroBeginOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroBeginOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroBeginOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getId() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroBeginOpAdaptor : public CoroBeginOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroBeginOpGenericAdaptor::CoroBeginOpGenericAdaptor; + CoroBeginOpAdaptor(CoroBeginOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroBeginOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroBeginOpAdaptor; + template + using GenericAdaptor = CoroBeginOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.coro.begin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::async::CoroIdType> getId(); + ::mlir::OpOperand &getIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::async::CoroHandleType> getHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value id); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CoroBeginOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroEndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroEndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroEndOpGenericAdaptorBase(CoroEndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroEndOpGenericAdaptor : public detail::CoroEndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroEndOpGenericAdaptorBase; +public: + CoroEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroEndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroEndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroEndOpAdaptor : public CoroEndOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroEndOpGenericAdaptor::CoroEndOpGenericAdaptor; + CoroEndOpAdaptor(CoroEndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroEndOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroEndOpAdaptor; + template + using GenericAdaptor = CoroEndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.coro.end"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::async::CoroHandleType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CoroEndOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroFreeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroFreeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroFreeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroFreeOpGenericAdaptorBase(CoroFreeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroFreeOpGenericAdaptor : public detail::CoroFreeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroFreeOpGenericAdaptorBase; +public: + CoroFreeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroFreeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroFreeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroFreeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getId() { + return (*getODSOperands(0).begin()); + } + + ValueT getHandle() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroFreeOpAdaptor : public CoroFreeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroFreeOpGenericAdaptor::CoroFreeOpGenericAdaptor; + CoroFreeOpAdaptor(CoroFreeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroFreeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroFreeOpAdaptor; + template + using GenericAdaptor = CoroFreeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.coro.free"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::async::CoroIdType> getId(); + ::mlir::TypedValue<::mlir::async::CoroHandleType> getHandle(); + ::mlir::OpOperand &getIdMutable(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value id, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value id, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CoroFreeOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroIdOpGenericAdaptorBase(CoroIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroIdOpGenericAdaptor : public detail::CoroIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroIdOpGenericAdaptorBase; +public: + CoroIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroIdOpAdaptor : public CoroIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroIdOpGenericAdaptor::CoroIdOpGenericAdaptor; + CoroIdOpAdaptor(CoroIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroIdOpAdaptor; + template + using GenericAdaptor = CoroIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.coro.id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::async::CoroIdType> getId(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CoroIdOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroSaveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroSaveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroSaveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroSaveOpGenericAdaptorBase(CoroSaveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroSaveOpGenericAdaptor : public detail::CoroSaveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroSaveOpGenericAdaptorBase; +public: + CoroSaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroSaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroSaveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroSaveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroSaveOpAdaptor : public CoroSaveOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroSaveOpGenericAdaptor::CoroSaveOpGenericAdaptor; + CoroSaveOpAdaptor(CoroSaveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroSaveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroSaveOpAdaptor; + template + using GenericAdaptor = CoroSaveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.coro.save"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::async::CoroHandleType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::async::CoroStateType> getState(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type state, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CoroSaveOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CoroSuspendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroSuspendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroSuspendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroSuspendOpGenericAdaptorBase(CoroSuspendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroSuspendOpGenericAdaptor : public detail::CoroSuspendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroSuspendOpGenericAdaptorBase; +public: + CoroSuspendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroSuspendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroSuspendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroSuspendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getState() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroSuspendOpAdaptor : public CoroSuspendOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroSuspendOpGenericAdaptor::CoroSuspendOpGenericAdaptor; + CoroSuspendOpAdaptor(CoroSuspendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroSuspendOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroSuspendOpAdaptor; + template + using GenericAdaptor = CoroSuspendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.coro.suspend"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::async::CoroStateType> getState(); + ::mlir::OpOperand &getStateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getSuspendDest(); + ::mlir::Block *getResumeDest(); + ::mlir::Block *getCleanupDest(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value state, ::mlir::Block *suspendDest, ::mlir::Block *resumeDest, ::mlir::Block *cleanupDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value state, ::mlir::Block *suspendDest, ::mlir::Block *resumeDest, ::mlir::Block *cleanupDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CoroSuspendOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::CreateGroupOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateGroupOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateGroupOpGenericAdaptorBase(CreateGroupOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateGroupOpGenericAdaptor : public detail::CreateGroupOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateGroupOpGenericAdaptorBase; +public: + CreateGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateGroupOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateGroupOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSize() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateGroupOpAdaptor : public CreateGroupOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateGroupOpGenericAdaptor::CreateGroupOpGenericAdaptor; + CreateGroupOpAdaptor(CreateGroupOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateGroupOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateGroupOpAdaptor; + template + using GenericAdaptor = CreateGroupOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.create_group"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getSize(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::async::GroupType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult canonicalize(CreateGroupOp op, ::mlir::PatternRewriter &rewriter); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CreateGroupOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::ExecuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExecuteOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExecuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExecuteOpGenericAdaptorBase(ExecuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getBodyRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ExecuteOpGenericAdaptor : public detail::ExecuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExecuteOpGenericAdaptorBase; +public: + ExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExecuteOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExecuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDependencies() { + return getODSOperands(0); + } + + RangeT getBodyOperands() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExecuteOpAdaptor : public ExecuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExecuteOpGenericAdaptor::ExecuteOpGenericAdaptor; + ExecuteOpAdaptor(ExecuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExecuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExecuteOpAdaptor; + template + using GenericAdaptor = ExecuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.execute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDependencies(); + ::mlir::Operation::operand_range getBodyOperands(); + ::mlir::MutableOperandRange getDependenciesMutable(); + ::mlir::MutableOperandRange getBodyOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::async::TokenType> getToken(); + ::mlir::Operation::result_range getBodyResults(); + ::mlir::Region &getBodyRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTypes, ValueRange dependencies, ValueRange operands, function_ref bodyBuilder = nullptr); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + ::mlir::OperandRange getEntrySuccessorOperands(::mlir::RegionBranchPoint point); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); + bool areTypesCompatible(::mlir::Type lhs, ::mlir::Type rhs); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + using BodyBuilderFn = + function_ref; + +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::ExecuteOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::FuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FuncOpGenericAdaptorBase { +public: + struct Properties { + using arg_attrsTy = ::mlir::ArrayAttr; + arg_attrsTy arg_attrs; + + auto getArgAttrs() { + auto &propStorage = this->arg_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setArgAttrs(const ::mlir::ArrayAttr &propValue) { + this->arg_attrs = propValue; + } + using function_typeTy = ::mlir::TypeAttr; + function_typeTy function_type; + + auto getFunctionType() { + auto &propStorage = this->function_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setFunctionType(const ::mlir::TypeAttr &propValue) { + this->function_type = propValue; + } + using res_attrsTy = ::mlir::ArrayAttr; + res_attrsTy res_attrs; + + auto getResAttrs() { + auto &propStorage = this->res_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setResAttrs(const ::mlir::ArrayAttr &propValue) { + this->res_attrs = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using sym_visibilityTy = ::mlir::StringAttr; + sym_visibilityTy sym_visibility; + + auto getSymVisibility() { + auto &propStorage = this->sym_visibility; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSymVisibility(const ::mlir::StringAttr &propValue) { + this->sym_visibility = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.arg_attrs == this->arg_attrs && + rhs.function_type == this->function_type && + rhs.res_attrs == this->res_attrs && + rhs.sym_name == this->sym_name && + rhs.sym_visibility == this->sym_visibility && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FuncOpGenericAdaptorBase(FuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FuncOpGenericAdaptor : public detail::FuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FuncOpGenericAdaptorBase; +public: + FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FuncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FuncOpAdaptor : public FuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using FuncOpGenericAdaptor::FuncOpGenericAdaptor; + FuncOpAdaptor(FuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FuncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FuncOpAdaptor; + template + using GenericAdaptor = FuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("function_type"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("sym_visibility")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getArgAttrsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFunctionTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getResAttrsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSymVisibilityAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setFunctionTypeAttr(::mlir::TypeAttr attr); + void setFunctionType(::mlir::FunctionType attrValue); + void setSymVisibilityAttr(::mlir::StringAttr attr); + void setSymVisibility(::std::optional<::llvm::StringRef> attrValue); + void setArgAttrsAttr(::mlir::ArrayAttr attr); + void setResAttrsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeSymVisibilityAttr(); + ::mlir::Attribute removeArgAttrsAttr(); + ::mlir::Attribute removeResAttrsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, FunctionType type, ArrayRef attrs = {}, ArrayRef argAttrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + //===------------------------------------------------------------------===// + // FunctionOpInterface Methods + //===------------------------------------------------------------------===// + + /// Returns the region on the current operation that is callable. This may + /// return null in the case of an external callable object, e.g. an external + /// function. + ::mlir::Region *getCallableRegion() { return isExternal() ? nullptr + : &getBody(); } + + /// Returns the argument types of this async function. + ArrayRef getArgumentTypes() { return getFunctionType().getInputs(); } + + /// Returns the result types of this async function. + ArrayRef getResultTypes() { return getFunctionType().getResults(); } + + /// Returns the number of results of this async function + unsigned getNumResults() {return getResultTypes().size();} + + /// Is the async func stateful + bool isStateful() { return isa(getFunctionType().getResult(0));} + + //===------------------------------------------------------------------===// + // OpAsmOpInterface Methods + //===------------------------------------------------------------------===// + + /// Allow the dialect prefix to be omitted. + static StringRef getDefaultDialect() { return "async"; } + + //===------------------------------------------------------------------===// + // SymbolOpInterface Methods + //===------------------------------------------------------------------===// + + bool isDeclaration() { return isExternal(); } +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::FuncOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::ReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReturnOpGenericAdaptorBase(ReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReturnOpGenericAdaptorBase; +public: + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor; + ReturnOpAdaptor(ReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReturnOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReturnOpAdaptor; + template + using GenericAdaptor = ReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::ReturnOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeAddRefOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeAddRefOpGenericAdaptorBase { +public: + struct Properties { + using countTy = ::mlir::IntegerAttr; + countTy count; + + auto getCount() { + auto &propStorage = this->count; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setCount(const ::mlir::IntegerAttr &propValue) { + this->count = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.count == this->count && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RuntimeAddRefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeAddRefOpGenericAdaptorBase(RuntimeAddRefOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getCountAttr(); + uint64_t getCount(); +}; +} // namespace detail +template +class RuntimeAddRefOpGenericAdaptor : public detail::RuntimeAddRefOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeAddRefOpGenericAdaptorBase; +public: + RuntimeAddRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeAddRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeAddRefOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RuntimeAddRefOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeAddRefOpAdaptor : public RuntimeAddRefOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeAddRefOpGenericAdaptor::RuntimeAddRefOpGenericAdaptor; + RuntimeAddRefOpAdaptor(RuntimeAddRefOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeAddRefOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeAddRefOpAdaptor; + template + using GenericAdaptor = RuntimeAddRefOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("count")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCountAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.add_ref"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getCountAttr(); + uint64_t getCount(); + void setCountAttr(::mlir::IntegerAttr attr); + void setCount(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::IntegerAttr count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, uint64_t count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeAddRefOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeAddToGroupOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeAddToGroupOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeAddToGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeAddToGroupOpGenericAdaptorBase(RuntimeAddToGroupOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeAddToGroupOpGenericAdaptor : public detail::RuntimeAddToGroupOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeAddToGroupOpGenericAdaptorBase; +public: + RuntimeAddToGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeAddToGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeAddToGroupOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeAddToGroupOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroup() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeAddToGroupOpAdaptor : public RuntimeAddToGroupOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeAddToGroupOpGenericAdaptor::RuntimeAddToGroupOpGenericAdaptor; + RuntimeAddToGroupOpAdaptor(RuntimeAddToGroupOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeAddToGroupOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeAddToGroupOpAdaptor; + template + using GenericAdaptor = RuntimeAddToGroupOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.add_to_group"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::TypedValue<::mlir::async::GroupType> getGroup(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getGroupMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getRank(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rank, ::mlir::Value operand, ::mlir::Value group); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value group); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value group); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeAddToGroupOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeAwaitAndResumeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeAwaitAndResumeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeAwaitAndResumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeAwaitAndResumeOpGenericAdaptorBase(RuntimeAwaitAndResumeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeAwaitAndResumeOpGenericAdaptor : public detail::RuntimeAwaitAndResumeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeAwaitAndResumeOpGenericAdaptorBase; +public: + RuntimeAwaitAndResumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeAwaitAndResumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeAwaitAndResumeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeAwaitAndResumeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getHandle() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeAwaitAndResumeOpAdaptor : public RuntimeAwaitAndResumeOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeAwaitAndResumeOpGenericAdaptor::RuntimeAwaitAndResumeOpGenericAdaptor; + RuntimeAwaitAndResumeOpAdaptor(RuntimeAwaitAndResumeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeAwaitAndResumeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeAwaitAndResumeOpAdaptor; + template + using GenericAdaptor = RuntimeAwaitAndResumeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.await_and_resume"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::TypedValue<::mlir::async::CoroHandleType> getHandle(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeAwaitAndResumeOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeAwaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeAwaitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeAwaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeAwaitOpGenericAdaptorBase(RuntimeAwaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeAwaitOpGenericAdaptor : public detail::RuntimeAwaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeAwaitOpGenericAdaptorBase; +public: + RuntimeAwaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeAwaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeAwaitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeAwaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeAwaitOpAdaptor : public RuntimeAwaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeAwaitOpGenericAdaptor::RuntimeAwaitOpGenericAdaptor; + RuntimeAwaitOpAdaptor(RuntimeAwaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeAwaitOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeAwaitOpAdaptor; + template + using GenericAdaptor = RuntimeAwaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.await"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeAwaitOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeCreateGroupOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeCreateGroupOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeCreateGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeCreateGroupOpGenericAdaptorBase(RuntimeCreateGroupOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeCreateGroupOpGenericAdaptor : public detail::RuntimeCreateGroupOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeCreateGroupOpGenericAdaptorBase; +public: + RuntimeCreateGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeCreateGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeCreateGroupOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeCreateGroupOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSize() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeCreateGroupOpAdaptor : public RuntimeCreateGroupOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeCreateGroupOpGenericAdaptor::RuntimeCreateGroupOpGenericAdaptor; + RuntimeCreateGroupOpAdaptor(RuntimeCreateGroupOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeCreateGroupOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeCreateGroupOpAdaptor; + template + using GenericAdaptor = RuntimeCreateGroupOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.create_group"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getSize(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::async::GroupType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeCreateGroupOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeCreateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeCreateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeCreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeCreateOpGenericAdaptorBase(RuntimeCreateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeCreateOpGenericAdaptor : public detail::RuntimeCreateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeCreateOpGenericAdaptorBase; +public: + RuntimeCreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeCreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeCreateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeCreateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeCreateOpAdaptor : public RuntimeCreateOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeCreateOpGenericAdaptor::RuntimeCreateOpGenericAdaptor; + RuntimeCreateOpAdaptor(RuntimeCreateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeCreateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeCreateOpAdaptor; + template + using GenericAdaptor = RuntimeCreateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.create"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeCreateOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeDropRefOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeDropRefOpGenericAdaptorBase { +public: + struct Properties { + using countTy = ::mlir::IntegerAttr; + countTy count; + + auto getCount() { + auto &propStorage = this->count; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setCount(const ::mlir::IntegerAttr &propValue) { + this->count = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.count == this->count && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RuntimeDropRefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeDropRefOpGenericAdaptorBase(RuntimeDropRefOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getCountAttr(); + uint64_t getCount(); +}; +} // namespace detail +template +class RuntimeDropRefOpGenericAdaptor : public detail::RuntimeDropRefOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeDropRefOpGenericAdaptorBase; +public: + RuntimeDropRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeDropRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeDropRefOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RuntimeDropRefOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeDropRefOpAdaptor : public RuntimeDropRefOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeDropRefOpGenericAdaptor::RuntimeDropRefOpGenericAdaptor; + RuntimeDropRefOpAdaptor(RuntimeDropRefOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeDropRefOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeDropRefOpAdaptor; + template + using GenericAdaptor = RuntimeDropRefOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("count")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCountAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.drop_ref"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getCountAttr(); + uint64_t getCount(); + void setCountAttr(::mlir::IntegerAttr attr); + void setCount(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::IntegerAttr count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, uint64_t count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeDropRefOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeIsErrorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeIsErrorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeIsErrorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeIsErrorOpGenericAdaptorBase(RuntimeIsErrorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeIsErrorOpGenericAdaptor : public detail::RuntimeIsErrorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeIsErrorOpGenericAdaptorBase; +public: + RuntimeIsErrorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeIsErrorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeIsErrorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeIsErrorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeIsErrorOpAdaptor : public RuntimeIsErrorOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeIsErrorOpGenericAdaptor::RuntimeIsErrorOpGenericAdaptor; + RuntimeIsErrorOpAdaptor(RuntimeIsErrorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeIsErrorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeIsErrorOpAdaptor; + template + using GenericAdaptor = RuntimeIsErrorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.is_error"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIsError(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type is_error, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeIsErrorOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeLoadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeLoadOpGenericAdaptorBase(RuntimeLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeLoadOpGenericAdaptor : public detail::RuntimeLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeLoadOpGenericAdaptorBase; +public: + RuntimeLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStorage() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeLoadOpAdaptor : public RuntimeLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeLoadOpGenericAdaptor::RuntimeLoadOpGenericAdaptor; + RuntimeLoadOpAdaptor(RuntimeLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeLoadOpAdaptor; + template + using GenericAdaptor = RuntimeLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::async::ValueType> getStorage(); + ::mlir::OpOperand &getStorageMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value storage); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value storage); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value storage); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeLoadOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeNumWorkerThreadsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeNumWorkerThreadsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeNumWorkerThreadsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeNumWorkerThreadsOpGenericAdaptorBase(RuntimeNumWorkerThreadsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeNumWorkerThreadsOpGenericAdaptor : public detail::RuntimeNumWorkerThreadsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeNumWorkerThreadsOpGenericAdaptorBase; +public: + RuntimeNumWorkerThreadsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeNumWorkerThreadsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeNumWorkerThreadsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeNumWorkerThreadsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeNumWorkerThreadsOpAdaptor : public RuntimeNumWorkerThreadsOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeNumWorkerThreadsOpGenericAdaptor::RuntimeNumWorkerThreadsOpGenericAdaptor; + RuntimeNumWorkerThreadsOpAdaptor(RuntimeNumWorkerThreadsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeNumWorkerThreadsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeNumWorkerThreadsOpAdaptor; + template + using GenericAdaptor = RuntimeNumWorkerThreadsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.num_worker_threads"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeNumWorkerThreadsOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeResumeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeResumeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeResumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeResumeOpGenericAdaptorBase(RuntimeResumeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeResumeOpGenericAdaptor : public detail::RuntimeResumeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeResumeOpGenericAdaptorBase; +public: + RuntimeResumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeResumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeResumeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeResumeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeResumeOpAdaptor : public RuntimeResumeOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeResumeOpGenericAdaptor::RuntimeResumeOpGenericAdaptor; + RuntimeResumeOpAdaptor(RuntimeResumeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeResumeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeResumeOpAdaptor; + template + using GenericAdaptor = RuntimeResumeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.resume"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::async::CoroHandleType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeResumeOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeSetAvailableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeSetAvailableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeSetAvailableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeSetAvailableOpGenericAdaptorBase(RuntimeSetAvailableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeSetAvailableOpGenericAdaptor : public detail::RuntimeSetAvailableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeSetAvailableOpGenericAdaptorBase; +public: + RuntimeSetAvailableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeSetAvailableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeSetAvailableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeSetAvailableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeSetAvailableOpAdaptor : public RuntimeSetAvailableOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeSetAvailableOpGenericAdaptor::RuntimeSetAvailableOpGenericAdaptor; + RuntimeSetAvailableOpAdaptor(RuntimeSetAvailableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeSetAvailableOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeSetAvailableOpAdaptor; + template + using GenericAdaptor = RuntimeSetAvailableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.set_available"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeSetAvailableOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeSetErrorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeSetErrorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeSetErrorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeSetErrorOpGenericAdaptorBase(RuntimeSetErrorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeSetErrorOpGenericAdaptor : public detail::RuntimeSetErrorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeSetErrorOpGenericAdaptorBase; +public: + RuntimeSetErrorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeSetErrorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeSetErrorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeSetErrorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeSetErrorOpAdaptor : public RuntimeSetErrorOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeSetErrorOpGenericAdaptor::RuntimeSetErrorOpGenericAdaptor; + RuntimeSetErrorOpAdaptor(RuntimeSetErrorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeSetErrorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeSetErrorOpAdaptor; + template + using GenericAdaptor = RuntimeSetErrorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.set_error"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeSetErrorOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::RuntimeStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RuntimeStoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RuntimeStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RuntimeStoreOpGenericAdaptorBase(RuntimeStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RuntimeStoreOpGenericAdaptor : public detail::RuntimeStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RuntimeStoreOpGenericAdaptorBase; +public: + RuntimeStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RuntimeStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RuntimeStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RuntimeStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getStorage() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RuntimeStoreOpAdaptor : public RuntimeStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using RuntimeStoreOpGenericAdaptor::RuntimeStoreOpGenericAdaptor; + RuntimeStoreOpAdaptor(RuntimeStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RuntimeStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RuntimeStoreOpAdaptor; + template + using GenericAdaptor = RuntimeStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.runtime.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::async::ValueType> getStorage(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getStorageMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value storage); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value storage); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::RuntimeStoreOp) + +namespace mlir { +namespace async { + +//===----------------------------------------------------------------------===// +// ::mlir::async::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike> { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("async.yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..a26556421c16f584d969e4853436a164f8bf2b2b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AsyncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::AsyncDialect) +namespace mlir { +namespace async { + +AsyncDialect::AsyncDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +AsyncDialect::~AsyncDialect() = default; + +} // namespace async +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..2c51f53883c29160c790da691edaa5267a93532d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc @@ -0,0 +1,39 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: AsyncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace async { + +class AsyncDialect : public ::mlir::Dialect { + explicit AsyncDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~AsyncDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("async"); + } + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; + + /// The name of a unit attribute on funcs that are allowed to have a + /// blocking async.runtime.await ops. In absence of this attribute the + /// asyncification pass might convert a func to a coroutine. + static constexpr StringRef kAllowedToBlockAttrName = + "async.allowed_to_block"; + }; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::AsyncDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsTypes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsTypes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..01e4af4555acb11112a8fe61a85362ebb5cc9256 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsTypes.cpp.inc @@ -0,0 +1,175 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_LIST +#undef GET_TYPEDEF_LIST + +::mlir::async::CoroHandleType, +::mlir::async::CoroIdType, +::mlir::async::CoroStateType, +::mlir::async::GroupType, +::mlir::async::TokenType, +::mlir::async::ValueType + +#endif // GET_TYPEDEF_LIST + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + +static ::mlir::OptionalParseResult generatedTypeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::async::CoroHandleType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::async::CoroHandleType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::async::CoroIdType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::async::CoroIdType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::async::CoroStateType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::async::CoroStateType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::async::GroupType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::async::GroupType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::async::TokenType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::async::TokenType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::async::ValueType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::async::ValueType::parse(parser); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedTypePrinter(::mlir::Type def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Type, ::mlir::LogicalResult>(def) .Case<::mlir::async::CoroHandleType>([&](auto t) { + printer << ::mlir::async::CoroHandleType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::async::CoroIdType>([&](auto t) { + printer << ::mlir::async::CoroIdType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::async::CoroStateType>([&](auto t) { + printer << ::mlir::async::CoroStateType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::async::GroupType>([&](auto t) { + printer << ::mlir::async::GroupType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::async::TokenType>([&](auto t) { + printer << ::mlir::async::TokenType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::async::ValueType>([&](auto t) { + printer << ::mlir::async::ValueType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace async { +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CoroHandleType) +namespace mlir { +namespace async { +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CoroIdType) +namespace mlir { +namespace async { +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::CoroStateType) +namespace mlir { +namespace async { +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::GroupType) +namespace mlir { +namespace async { +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::TokenType) +namespace mlir { +namespace async { +namespace detail { +struct ValueTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + ValueTypeStorage(Type valueType) : valueType(std::move(valueType)) {} + + KeyTy getAsKey() const { + return KeyTy(valueType); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (valueType == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ValueTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto valueType = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ValueTypeStorage(std::move(valueType)); + } + + Type valueType; +}; +} // namespace detail +ValueType ValueType::get(Type valueType) { + return Base::get(valueType.getContext(), valueType); +} + +Type ValueType::getValueType() const { + return getImpl()->valueType; +} + +} // namespace async +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::async::ValueType) +namespace mlir { +namespace async { + +/// Parse a type registered to this dialect. +::mlir::Type AsyncDialect::parseType(::mlir::DialectAsmParser &parser) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef mnemonic; + ::mlir::Type genType; + auto parseResult = generatedTypeParser(parser, &mnemonic, genType); + if (parseResult.has_value()) + return genType; + + parser.emitError(typeLoc) << "unknown type `" + << mnemonic << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print a type registered to this dialect. +void AsyncDialect::printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedTypePrinter(type, printer))) + return; + +} +} // namespace async +} // namespace mlir + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsTypes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsTypes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..3a70356e089ac4970103999e370d3464e009d940 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncOpsTypes.h.inc @@ -0,0 +1,90 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace async { +class CoroHandleType; +class CoroIdType; +class CoroStateType; +class GroupType; +class TokenType; +class ValueType; +class CoroHandleType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"coro.handle"}; + } + +}; +class CoroIdType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"coro.id"}; + } + +}; +class CoroStateType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"coro.state"}; + } + +}; +class GroupType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"group"}; + } + +}; +class TokenType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"token"}; + } + +}; +namespace detail { +struct ValueTypeStorage; +} // namespace detail +class ValueType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static ValueType get(Type valueType); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"value"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + Type getValueType() const; +}; +} // namespace async +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CoroHandleType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CoroIdType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::CoroStateType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::GroupType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::TokenType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::async::ValueType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncTypes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..ace182cc3d5a7ef5e238bdaa81a0d2497c8142af --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/IR/AsyncTypes.h @@ -0,0 +1,25 @@ +//===- AsyncTypes.h - Async Dialect Types -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the types for the Async dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ASYNC_IR_ASYNCTYPES_H_ +#define MLIR_DIALECT_ASYNC_IR_ASYNCTYPES_H_ + +#include "mlir/IR/Types.h" + +//===----------------------------------------------------------------------===// +// Async Dialect Types +//===----------------------------------------------------------------------===// + +#define GET_TYPEDEF_CLASSES +#include "mlir/Dialect/Async/IR/AsyncOpsTypes.h.inc" + +#endif // MLIR_DIALECT_ASYNC_IR_ASYNCTYPES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.capi.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.capi.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..eb1b86410cc41a1a93127a38f19878bc8eaee610 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.capi.cpp.inc @@ -0,0 +1,56 @@ +/* Autogenerated by mlir-tblgen; don't manually edit. */ +//===----------------------------------------------------------------------===// +// Async Group Registration +//===----------------------------------------------------------------------===// + +void mlirRegisterAsyncPasses(void) { + registerAsyncPasses(); +} + +MlirPass mlirCreateAsyncAsyncFuncToAsyncRuntime(void) { + return wrap(mlir::createAsyncFuncToAsyncRuntimePass().release()); +} +void mlirRegisterAsyncAsyncFuncToAsyncRuntime(void) { + registerAsyncFuncToAsyncRuntime(); +} + + +MlirPass mlirCreateAsyncAsyncParallelFor(void) { + return wrap(mlir::createAsyncParallelForPass().release()); +} +void mlirRegisterAsyncAsyncParallelFor(void) { + registerAsyncParallelFor(); +} + + +MlirPass mlirCreateAsyncAsyncRuntimePolicyBasedRefCounting(void) { + return wrap(mlir::createAsyncRuntimePolicyBasedRefCountingPass().release()); +} +void mlirRegisterAsyncAsyncRuntimePolicyBasedRefCounting(void) { + registerAsyncRuntimePolicyBasedRefCounting(); +} + + +MlirPass mlirCreateAsyncAsyncRuntimeRefCounting(void) { + return wrap(mlir::createAsyncRuntimeRefCountingPass().release()); +} +void mlirRegisterAsyncAsyncRuntimeRefCounting(void) { + registerAsyncRuntimeRefCounting(); +} + + +MlirPass mlirCreateAsyncAsyncRuntimeRefCountingOpt(void) { + return wrap(mlir::createAsyncRuntimeRefCountingOptPass().release()); +} +void mlirRegisterAsyncAsyncRuntimeRefCountingOpt(void) { + registerAsyncRuntimeRefCountingOpt(); +} + + +MlirPass mlirCreateAsyncAsyncToAsyncRuntime(void) { + return wrap(mlir::createAsyncToAsyncRuntimePass().release()); +} +void mlirRegisterAsyncAsyncToAsyncRuntime(void) { + registerAsyncToAsyncRuntime(); +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.capi.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.capi.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ad5f1193d26c2dec8c597d005fce2932c61df278 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.capi.h.inc @@ -0,0 +1,47 @@ + +/* Autogenerated by mlir-tblgen; don't manually edit. */ + +#include "mlir-c/Pass.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Registration for the entire group +MLIR_CAPI_EXPORTED void mlirRegisterAsyncPasses(void); + + +/* Create Async Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateAsyncAsyncFuncToAsyncRuntime(void); +MLIR_CAPI_EXPORTED void mlirRegisterAsyncAsyncFuncToAsyncRuntime(void); + + +/* Create Async Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateAsyncAsyncParallelFor(void); +MLIR_CAPI_EXPORTED void mlirRegisterAsyncAsyncParallelFor(void); + + +/* Create Async Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateAsyncAsyncRuntimePolicyBasedRefCounting(void); +MLIR_CAPI_EXPORTED void mlirRegisterAsyncAsyncRuntimePolicyBasedRefCounting(void); + + +/* Create Async Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateAsyncAsyncRuntimeRefCounting(void); +MLIR_CAPI_EXPORTED void mlirRegisterAsyncAsyncRuntimeRefCounting(void); + + +/* Create Async Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateAsyncAsyncRuntimeRefCountingOpt(void); +MLIR_CAPI_EXPORTED void mlirRegisterAsyncAsyncRuntimeRefCountingOpt(void); + + +/* Create Async Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateAsyncAsyncToAsyncRuntime(void); +MLIR_CAPI_EXPORTED void mlirRegisterAsyncAsyncToAsyncRuntime(void); + + + +#ifdef __cplusplus +} +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..090768cd0209c7b6101157b803edb9afceed8dbb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.h @@ -0,0 +1,54 @@ +//===- Passes.h - Async pass entry points -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes that expose pass constructors. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ASYNC_PASSES_H_ +#define MLIR_DIALECT_ASYNC_PASSES_H_ + +#include "mlir/Pass/Pass.h" + +namespace mlir { +class ModuleOp; +class ConversionTarget; + +#define GEN_PASS_DECL +#include "mlir/Dialect/Async/Passes.h.inc" + +std::unique_ptr createAsyncParallelForPass(); + +std::unique_ptr createAsyncParallelForPass(bool asyncDispatch, + int32_t numWorkerThreads, + int32_t minTaskSize); + +void populateAsyncFuncToAsyncRuntimeConversionPatterns( + RewritePatternSet &patterns, ConversionTarget &target); + +std::unique_ptr> createAsyncFuncToAsyncRuntimePass(); + +std::unique_ptr> createAsyncToAsyncRuntimePass(); + +std::unique_ptr createAsyncRuntimeRefCountingPass(); + +std::unique_ptr createAsyncRuntimeRefCountingOptPass(); + +std::unique_ptr createAsyncRuntimePolicyBasedRefCountingPass(); + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/Async/Passes.h.inc" + +} // namespace mlir + +#endif // MLIR_DIALECT_ASYNC_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..5c9325c8953918258170dad7d914232449671a8c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Passes.h.inc @@ -0,0 +1,812 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ASYNCFUNCTOASYNCRUNTIME +#define GEN_PASS_DECL_ASYNCPARALLELFOR +#define GEN_PASS_DECL_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING +#define GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTING +#define GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTINGOPT +#define GEN_PASS_DECL_ASYNCTOASYNCRUNTIME +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// AsyncFuncToAsyncRuntime +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ASYNCFUNCTOASYNCRUNTIME +#undef GEN_PASS_DECL_ASYNCFUNCTOASYNCRUNTIME +#endif // GEN_PASS_DECL_ASYNCFUNCTOASYNCRUNTIME +#ifdef GEN_PASS_DEF_ASYNCFUNCTOASYNCRUNTIME +namespace impl { + +template +class AsyncFuncToAsyncRuntimeBase : public ::mlir::OperationPass { +public: + using Base = AsyncFuncToAsyncRuntimeBase; + + AsyncFuncToAsyncRuntimeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AsyncFuncToAsyncRuntimeBase(const AsyncFuncToAsyncRuntimeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-func-to-async-runtime"); + } + ::llvm::StringRef getArgument() const override { return "async-func-to-async-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Lower async.func operations to the explicit async.runtime andasync.coro operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncFuncToAsyncRuntime"); + } + ::llvm::StringRef getName() const override { return "AsyncFuncToAsyncRuntime"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncFuncToAsyncRuntimeBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ASYNCFUNCTOASYNCRUNTIME +#endif // GEN_PASS_DEF_ASYNCFUNCTOASYNCRUNTIME + +//===----------------------------------------------------------------------===// +// AsyncParallelFor +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ASYNCPARALLELFOR +struct AsyncParallelForOptions { + bool asyncDispatch = true; + int32_t numWorkerThreads = 8; + int32_t minTaskSize = 1000; +}; +#undef GEN_PASS_DECL_ASYNCPARALLELFOR +#endif // GEN_PASS_DECL_ASYNCPARALLELFOR +#ifdef GEN_PASS_DEF_ASYNCPARALLELFOR +namespace impl { + +template +class AsyncParallelForBase : public ::mlir::OperationPass { +public: + using Base = AsyncParallelForBase; + + AsyncParallelForBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AsyncParallelForBase(const AsyncParallelForBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-parallel-for"); + } + ::llvm::StringRef getArgument() const override { return "async-parallel-for"; } + + ::llvm::StringRef getDescription() const override { return "Convert scf.parallel operations to multiple async compute ops executed concurrently for non-overlapping iteration ranges"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncParallelFor"); + } + ::llvm::StringRef getName() const override { return "AsyncParallelFor"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncParallelForBase) + + AsyncParallelForBase(const AsyncParallelForOptions &options) : AsyncParallelForBase() { + asyncDispatch = options.asyncDispatch; + numWorkerThreads = options.numWorkerThreads; + minTaskSize = options.minTaskSize; + } +protected: + ::mlir::Pass::Option asyncDispatch{*this, "async-dispatch", ::llvm::cl::desc("Dispatch async compute tasks using recursive work splitting. If `false` async compute tasks will be launched using simple for loop in the caller thread."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option numWorkerThreads{*this, "num-workers", ::llvm::cl::desc("The number of available workers to execute async operations. If `-1` the value will be retrieved from the runtime."), ::llvm::cl::init(8)}; + ::mlir::Pass::Option minTaskSize{*this, "min-task-size", ::llvm::cl::desc("The minimum task size for sharding parallel operation."), ::llvm::cl::init(1000)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ASYNCPARALLELFOR +#endif // GEN_PASS_DEF_ASYNCPARALLELFOR + +//===----------------------------------------------------------------------===// +// AsyncRuntimePolicyBasedRefCounting +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING +#undef GEN_PASS_DECL_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING +#endif // GEN_PASS_DECL_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING +#ifdef GEN_PASS_DEF_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING +namespace impl { + +template +class AsyncRuntimePolicyBasedRefCountingBase : public ::mlir::OperationPass<> { +public: + using Base = AsyncRuntimePolicyBasedRefCountingBase; + + AsyncRuntimePolicyBasedRefCountingBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AsyncRuntimePolicyBasedRefCountingBase(const AsyncRuntimePolicyBasedRefCountingBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-runtime-policy-based-ref-counting"); + } + ::llvm::StringRef getArgument() const override { return "async-runtime-policy-based-ref-counting"; } + + ::llvm::StringRef getDescription() const override { return "Policy based reference counting for Async runtime operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncRuntimePolicyBasedRefCounting"); + } + ::llvm::StringRef getName() const override { return "AsyncRuntimePolicyBasedRefCounting"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncRuntimePolicyBasedRefCountingBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING +#endif // GEN_PASS_DEF_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING + +//===----------------------------------------------------------------------===// +// AsyncRuntimeRefCounting +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTING +#undef GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTING +#endif // GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTING +#ifdef GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTING +namespace impl { + +template +class AsyncRuntimeRefCountingBase : public ::mlir::OperationPass<> { +public: + using Base = AsyncRuntimeRefCountingBase; + + AsyncRuntimeRefCountingBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AsyncRuntimeRefCountingBase(const AsyncRuntimeRefCountingBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-runtime-ref-counting"); + } + ::llvm::StringRef getArgument() const override { return "async-runtime-ref-counting"; } + + ::llvm::StringRef getDescription() const override { return "Automatic reference counting for Async runtime operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncRuntimeRefCounting"); + } + ::llvm::StringRef getName() const override { return "AsyncRuntimeRefCounting"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncRuntimeRefCountingBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTING +#endif // GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTING + +//===----------------------------------------------------------------------===// +// AsyncRuntimeRefCountingOpt +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTINGOPT +#undef GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTINGOPT +#endif // GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTINGOPT +#ifdef GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGOPT +namespace impl { + +template +class AsyncRuntimeRefCountingOptBase : public ::mlir::OperationPass<> { +public: + using Base = AsyncRuntimeRefCountingOptBase; + + AsyncRuntimeRefCountingOptBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AsyncRuntimeRefCountingOptBase(const AsyncRuntimeRefCountingOptBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-runtime-ref-counting-opt"); + } + ::llvm::StringRef getArgument() const override { return "async-runtime-ref-counting-opt"; } + + ::llvm::StringRef getDescription() const override { return "Optimize automatic reference counting operations for theAsync runtime by removing redundant operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncRuntimeRefCountingOpt"); + } + ::llvm::StringRef getName() const override { return "AsyncRuntimeRefCountingOpt"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncRuntimeRefCountingOptBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGOPT +#endif // GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGOPT + +//===----------------------------------------------------------------------===// +// AsyncToAsyncRuntime +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ASYNCTOASYNCRUNTIME +#undef GEN_PASS_DECL_ASYNCTOASYNCRUNTIME +#endif // GEN_PASS_DECL_ASYNCTOASYNCRUNTIME +#ifdef GEN_PASS_DEF_ASYNCTOASYNCRUNTIME +namespace impl { + +template +class AsyncToAsyncRuntimeBase : public ::mlir::OperationPass { +public: + using Base = AsyncToAsyncRuntimeBase; + + AsyncToAsyncRuntimeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AsyncToAsyncRuntimeBase(const AsyncToAsyncRuntimeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-to-async-runtime"); + } + ::llvm::StringRef getArgument() const override { return "async-to-async-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Lower all high level async operations (e.g. async.execute) tothe explicit async.runtime and async.coro operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncToAsyncRuntime"); + } + ::llvm::StringRef getName() const override { return "AsyncToAsyncRuntime"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncToAsyncRuntimeBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ASYNCTOASYNCRUNTIME +#endif // GEN_PASS_DEF_ASYNCTOASYNCRUNTIME +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// AsyncFuncToAsyncRuntime Registration +//===----------------------------------------------------------------------===// + +inline void registerAsyncFuncToAsyncRuntime() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncFuncToAsyncRuntimePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAsyncFuncToAsyncRuntimePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncFuncToAsyncRuntimePass(); + }); +} + +//===----------------------------------------------------------------------===// +// AsyncParallelFor Registration +//===----------------------------------------------------------------------===// + +inline void registerAsyncParallelFor() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncParallelForPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAsyncParallelForPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncParallelForPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AsyncRuntimePolicyBasedRefCounting Registration +//===----------------------------------------------------------------------===// + +inline void registerAsyncRuntimePolicyBasedRefCounting() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncRuntimePolicyBasedRefCountingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAsyncRuntimePolicyBasedRefCountingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncRuntimePolicyBasedRefCountingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AsyncRuntimeRefCounting Registration +//===----------------------------------------------------------------------===// + +inline void registerAsyncRuntimeRefCounting() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncRuntimeRefCountingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAsyncRuntimeRefCountingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncRuntimeRefCountingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AsyncRuntimeRefCountingOpt Registration +//===----------------------------------------------------------------------===// + +inline void registerAsyncRuntimeRefCountingOpt() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncRuntimeRefCountingOptPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAsyncRuntimeRefCountingOptPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncRuntimeRefCountingOptPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AsyncToAsyncRuntime Registration +//===----------------------------------------------------------------------===// + +inline void registerAsyncToAsyncRuntime() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncToAsyncRuntimePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAsyncToAsyncRuntimePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createAsyncToAsyncRuntimePass(); + }); +} + +//===----------------------------------------------------------------------===// +// Async Registration +//===----------------------------------------------------------------------===// + +inline void registerAsyncPasses() { + registerAsyncFuncToAsyncRuntime(); + registerAsyncParallelFor(); + registerAsyncRuntimePolicyBasedRefCounting(); + registerAsyncRuntimeRefCounting(); + registerAsyncRuntimeRefCountingOpt(); + registerAsyncToAsyncRuntime(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class AsyncFuncToAsyncRuntimeBase : public ::mlir::OperationPass { +public: + using Base = AsyncFuncToAsyncRuntimeBase; + + AsyncFuncToAsyncRuntimeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AsyncFuncToAsyncRuntimeBase(const AsyncFuncToAsyncRuntimeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-func-to-async-runtime"); + } + ::llvm::StringRef getArgument() const override { return "async-func-to-async-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Lower async.func operations to the explicit async.runtime andasync.coro operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncFuncToAsyncRuntime"); + } + ::llvm::StringRef getName() const override { return "AsyncFuncToAsyncRuntime"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncFuncToAsyncRuntimeBase) + +protected: +}; + +template +class AsyncParallelForBase : public ::mlir::OperationPass { +public: + using Base = AsyncParallelForBase; + + AsyncParallelForBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AsyncParallelForBase(const AsyncParallelForBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-parallel-for"); + } + ::llvm::StringRef getArgument() const override { return "async-parallel-for"; } + + ::llvm::StringRef getDescription() const override { return "Convert scf.parallel operations to multiple async compute ops executed concurrently for non-overlapping iteration ranges"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncParallelFor"); + } + ::llvm::StringRef getName() const override { return "AsyncParallelFor"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncParallelForBase) + +protected: + ::mlir::Pass::Option asyncDispatch{*this, "async-dispatch", ::llvm::cl::desc("Dispatch async compute tasks using recursive work splitting. If `false` async compute tasks will be launched using simple for loop in the caller thread."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option numWorkerThreads{*this, "num-workers", ::llvm::cl::desc("The number of available workers to execute async operations. If `-1` the value will be retrieved from the runtime."), ::llvm::cl::init(8)}; + ::mlir::Pass::Option minTaskSize{*this, "min-task-size", ::llvm::cl::desc("The minimum task size for sharding parallel operation."), ::llvm::cl::init(1000)}; +}; + +template +class AsyncRuntimePolicyBasedRefCountingBase : public ::mlir::OperationPass<> { +public: + using Base = AsyncRuntimePolicyBasedRefCountingBase; + + AsyncRuntimePolicyBasedRefCountingBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AsyncRuntimePolicyBasedRefCountingBase(const AsyncRuntimePolicyBasedRefCountingBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-runtime-policy-based-ref-counting"); + } + ::llvm::StringRef getArgument() const override { return "async-runtime-policy-based-ref-counting"; } + + ::llvm::StringRef getDescription() const override { return "Policy based reference counting for Async runtime operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncRuntimePolicyBasedRefCounting"); + } + ::llvm::StringRef getName() const override { return "AsyncRuntimePolicyBasedRefCounting"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncRuntimePolicyBasedRefCountingBase) + +protected: +}; + +template +class AsyncRuntimeRefCountingBase : public ::mlir::OperationPass<> { +public: + using Base = AsyncRuntimeRefCountingBase; + + AsyncRuntimeRefCountingBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AsyncRuntimeRefCountingBase(const AsyncRuntimeRefCountingBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-runtime-ref-counting"); + } + ::llvm::StringRef getArgument() const override { return "async-runtime-ref-counting"; } + + ::llvm::StringRef getDescription() const override { return "Automatic reference counting for Async runtime operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncRuntimeRefCounting"); + } + ::llvm::StringRef getName() const override { return "AsyncRuntimeRefCounting"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncRuntimeRefCountingBase) + +protected: +}; + +template +class AsyncRuntimeRefCountingOptBase : public ::mlir::OperationPass<> { +public: + using Base = AsyncRuntimeRefCountingOptBase; + + AsyncRuntimeRefCountingOptBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + AsyncRuntimeRefCountingOptBase(const AsyncRuntimeRefCountingOptBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-runtime-ref-counting-opt"); + } + ::llvm::StringRef getArgument() const override { return "async-runtime-ref-counting-opt"; } + + ::llvm::StringRef getDescription() const override { return "Optimize automatic reference counting operations for theAsync runtime by removing redundant operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncRuntimeRefCountingOpt"); + } + ::llvm::StringRef getName() const override { return "AsyncRuntimeRefCountingOpt"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncRuntimeRefCountingOptBase) + +protected: +}; + +template +class AsyncToAsyncRuntimeBase : public ::mlir::OperationPass { +public: + using Base = AsyncToAsyncRuntimeBase; + + AsyncToAsyncRuntimeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AsyncToAsyncRuntimeBase(const AsyncToAsyncRuntimeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("async-to-async-runtime"); + } + ::llvm::StringRef getArgument() const override { return "async-to-async-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Lower all high level async operations (e.g. async.execute) tothe explicit async.runtime and async.coro operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AsyncToAsyncRuntime"); + } + ::llvm::StringRef getName() const override { return "AsyncToAsyncRuntime"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AsyncToAsyncRuntimeBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..7e72762815463133ab3856984f86089e91d32054 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Async/Transforms.h @@ -0,0 +1,40 @@ +//===- Transforms.h - Async dialect transformation utilities ----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines transformations on Async operations. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_ASYNC_TRANSFORMS_H_ +#define MLIR_DIALECT_ASYNC_TRANSFORMS_H_ + +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/IR/ImplicitLocOpBuilder.h" + +namespace mlir { +namespace async { + +/// Emit the IR to compute the minimum number of iterations of scf.parallel body +/// that would be viable for a single parallel task. Allows the user to avoid +/// incurring the overheads of spawning costly parallel tasks in absence of +/// sufficient amount of parallelizable work. +/// +/// Must return an index type. +using AsyncMinTaskSizeComputationFunction = + std::function; + +/// Add a pattern to the given pattern list to lower scf.parallel to async +/// operations. +void populateAsyncParallelForPatterns( + RewritePatternSet &patterns, bool asyncDispatch, int32_t numWorkerThreads, + const AsyncMinTaskSizeComputationFunction &computeMinTaskSize); + +} // namespace async +} // namespace mlir + +#endif // MLIR_DIALECT_ASYNC_TRANSFORMS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..c42ab2c639762aea99cb45c0b860377b8cb49ffb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.cpp.inc @@ -0,0 +1,37 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Builds a deallocation operation using the provided builder and the +/// current allocation value (which refers to the current Op implementing +/// this interface). The allocation value is a result of the current +/// operation implementing this interface. If there is no compatible +/// deallocation operation, this method can return ::std::nullopt. +::std::optional<::mlir::Operation*> mlir::bufferization::AllocationOpInterface::buildDealloc(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return getImpl()->buildDealloc(builder, alloc); + } +/// Builds a clone operation using the provided builder and the current +/// allocation value (which refers to the current Op implementing this +/// interface). The allocation value is a result of the current operation +/// implementing this interface. If there is no compatible clone operation, +/// this method can return ::std::nullopt. +::std::optional<::mlir::Value> mlir::bufferization::AllocationOpInterface::buildClone(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return getImpl()->buildClone(builder, alloc); + } +/// Returns the kind of hoisting supported for the buffer allocated by this +/// operation. +::mlir::HoistingKind mlir::bufferization::AllocationOpInterface::getHoistingKind() { + return getImpl()->getHoistingKind(); + } +/// Builds a stack allocation operation using the provided builder and the +/// current allocation value (which refers to the current Op implementing this +/// interface). The allocation value is a result of the current +/// operation implementing this interface. If there is no compatible +/// stack allocation operation, this method can return ::std::nullopt. +::std::optional<::mlir::Operation*> mlir::bufferization::AllocationOpInterface::buildPromotedAlloc(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return getImpl()->buildPromotedAlloc(builder, alloc); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..5e0d3ca244c79693b4bfed936b4a6c6a3bbc894c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h @@ -0,0 +1,31 @@ +//===- AllocationOpInterface.h - Allocation op interface ------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements the operation interface for allocation ops. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_IR_ALLOCATIONOPINTERFACE_H_ +#define MLIR_DIALECT_BUFFERIZATION_IR_ALLOCATIONOPINTERFACE_H_ + +#include "mlir/IR/Builders.h" + +namespace mlir { +// Enum class representing different hoisting kinds for the allocation +// operation +enum class HoistingKind : uint8_t { + None = 0, // No hoisting kind selected + Loop = 1 << 0, // Indicates loop hoisting kind + Block = 1 << 1, // Indicates dominated block hoisting kind + LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ Block) +}; +} // namespace mlir + +#include "mlir/Dialect/Bufferization/IR/AllocationOpInterface.h.inc" + +#endif // MLIR_DIALECT_BUFFERIZATION_IR_ALLOCATIONOPINTERFACE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..b1212cbc7d3cba1c0c2d61decf626dc23a9592ca --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h.inc @@ -0,0 +1,170 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace bufferization { +class AllocationOpInterface; +namespace detail { +struct AllocationOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::std::optional<::mlir::Operation*> (*buildDealloc)(::mlir::OpBuilder&, ::mlir::Value); + ::std::optional<::mlir::Value> (*buildClone)(::mlir::OpBuilder&, ::mlir::Value); + ::mlir::HoistingKind (*getHoistingKind)(); + ::std::optional<::mlir::Operation*> (*buildPromotedAlloc)(::mlir::OpBuilder&, ::mlir::Value); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::bufferization::AllocationOpInterface; + Model() : Concept{buildDealloc, buildClone, getHoistingKind, buildPromotedAlloc} {} + + static inline ::std::optional<::mlir::Operation*> buildDealloc(::mlir::OpBuilder& builder, ::mlir::Value alloc); + static inline ::std::optional<::mlir::Value> buildClone(::mlir::OpBuilder& builder, ::mlir::Value alloc); + static inline ::mlir::HoistingKind getHoistingKind(); + static inline ::std::optional<::mlir::Operation*> buildPromotedAlloc(::mlir::OpBuilder& builder, ::mlir::Value alloc); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::bufferization::AllocationOpInterface; + FallbackModel() : Concept{buildDealloc, buildClone, getHoistingKind, buildPromotedAlloc} {} + + static inline ::std::optional<::mlir::Operation*> buildDealloc(::mlir::OpBuilder& builder, ::mlir::Value alloc); + static inline ::std::optional<::mlir::Value> buildClone(::mlir::OpBuilder& builder, ::mlir::Value alloc); + static inline ::mlir::HoistingKind getHoistingKind(); + static inline ::std::optional<::mlir::Operation*> buildPromotedAlloc(::mlir::OpBuilder& builder, ::mlir::Value alloc); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + static ::std::optional<::mlir::Operation*> buildDealloc(::mlir::OpBuilder&builder, ::mlir::Value alloc); + static ::std::optional<::mlir::Value> buildClone(::mlir::OpBuilder&builder, ::mlir::Value alloc); + static ::mlir::HoistingKind getHoistingKind(); + static ::std::optional<::mlir::Operation*> buildPromotedAlloc(::mlir::OpBuilder&builder, ::mlir::Value alloc); + }; +};template +struct AllocationOpInterfaceTrait; + +} // namespace detail +class AllocationOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AllocationOpInterfaceTrait {}; + /// Builds a deallocation operation using the provided builder and the + /// current allocation value (which refers to the current Op implementing + /// this interface). The allocation value is a result of the current + /// operation implementing this interface. If there is no compatible + /// deallocation operation, this method can return ::std::nullopt. + ::std::optional<::mlir::Operation*> buildDealloc(::mlir::OpBuilder& builder, ::mlir::Value alloc); + /// Builds a clone operation using the provided builder and the current + /// allocation value (which refers to the current Op implementing this + /// interface). The allocation value is a result of the current operation + /// implementing this interface. If there is no compatible clone operation, + /// this method can return ::std::nullopt. + ::std::optional<::mlir::Value> buildClone(::mlir::OpBuilder& builder, ::mlir::Value alloc); + /// Returns the kind of hoisting supported for the buffer allocated by this + /// operation. + ::mlir::HoistingKind getHoistingKind(); + /// Builds a stack allocation operation using the provided builder and the + /// current allocation value (which refers to the current Op implementing this + /// interface). The allocation value is a result of the current + /// operation implementing this interface. If there is no compatible + /// stack allocation operation, this method can return ::std::nullopt. + ::std::optional<::mlir::Operation*> buildPromotedAlloc(::mlir::OpBuilder& builder, ::mlir::Value alloc); +}; +namespace detail { + template + struct AllocationOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Builds a deallocation operation using the provided builder and the + /// current allocation value (which refers to the current Op implementing + /// this interface). The allocation value is a result of the current + /// operation implementing this interface. If there is no compatible + /// deallocation operation, this method can return ::std::nullopt. + static ::std::optional<::mlir::Operation*> buildDealloc(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return std::nullopt; + } + /// Builds a clone operation using the provided builder and the current + /// allocation value (which refers to the current Op implementing this + /// interface). The allocation value is a result of the current operation + /// implementing this interface. If there is no compatible clone operation, + /// this method can return ::std::nullopt. + static ::std::optional<::mlir::Value> buildClone(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return std::nullopt; + } + /// Returns the kind of hoisting supported for the buffer allocated by this + /// operation. + static ::mlir::HoistingKind getHoistingKind() { + return HoistingKind::None; + } + /// Builds a stack allocation operation using the provided builder and the + /// current allocation value (which refers to the current Op implementing this + /// interface). The allocation value is a result of the current + /// operation implementing this interface. If there is no compatible + /// stack allocation operation, this method can return ::std::nullopt. + static ::std::optional<::mlir::Operation*> buildPromotedAlloc(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return std::nullopt; + } + }; +}// namespace detail +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +template +::std::optional<::mlir::Operation*> detail::AllocationOpInterfaceInterfaceTraits::Model::buildDealloc(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return ConcreteOp::buildDealloc(builder, alloc); +} +template +::std::optional<::mlir::Value> detail::AllocationOpInterfaceInterfaceTraits::Model::buildClone(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return ConcreteOp::buildClone(builder, alloc); +} +template +::mlir::HoistingKind detail::AllocationOpInterfaceInterfaceTraits::Model::getHoistingKind() { + return ConcreteOp::getHoistingKind(); +} +template +::std::optional<::mlir::Operation*> detail::AllocationOpInterfaceInterfaceTraits::Model::buildPromotedAlloc(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return ConcreteOp::buildPromotedAlloc(builder, alloc); +} +template +::std::optional<::mlir::Operation*> detail::AllocationOpInterfaceInterfaceTraits::FallbackModel::buildDealloc(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return ConcreteOp::buildDealloc(builder, alloc); +} +template +::std::optional<::mlir::Value> detail::AllocationOpInterfaceInterfaceTraits::FallbackModel::buildClone(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return ConcreteOp::buildClone(builder, alloc); +} +template +::mlir::HoistingKind detail::AllocationOpInterfaceInterfaceTraits::FallbackModel::getHoistingKind() { + return ConcreteOp::getHoistingKind(); +} +template +::std::optional<::mlir::Operation*> detail::AllocationOpInterfaceInterfaceTraits::FallbackModel::buildPromotedAlloc(::mlir::OpBuilder& builder, ::mlir::Value alloc) { + return ConcreteOp::buildPromotedAlloc(builder, alloc); +} +template +::std::optional<::mlir::Operation*> detail::AllocationOpInterfaceInterfaceTraits::ExternalModel::buildDealloc(::mlir::OpBuilder&builder, ::mlir::Value alloc) { +return std::nullopt; +} +template +::std::optional<::mlir::Value> detail::AllocationOpInterfaceInterfaceTraits::ExternalModel::buildClone(::mlir::OpBuilder&builder, ::mlir::Value alloc) { +return std::nullopt; +} +template +::mlir::HoistingKind detail::AllocationOpInterfaceInterfaceTraits::ExternalModel::getHoistingKind() { +return HoistingKind::None; +} +template +::std::optional<::mlir::Operation*> detail::AllocationOpInterfaceInterfaceTraits::ExternalModel::buildPromotedAlloc(::mlir::OpBuilder&builder, ::mlir::Value alloc) { +return std::nullopt; +} +} // namespace bufferization +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..ca06aef560b787d18affb6a41688576fb479c950 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.cpp.inc @@ -0,0 +1,39 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// This method takes the current deallocation state and transformation +/// options and updates the deallocation state as necessary for the +/// operation implementing this interface. It may also insert +/// `bufferization.dealloc` operations and rebuild itself with different +/// result types. For operations implementing this interface all other +/// interface handlers (e.g., default handlers for interfaces like +/// RegionBranchOpInterface, CallOpInterface, etc.) are skipped by the +/// deallocation pass. On success, either the current operation or one of +/// the newly inserted operations is returned from which on the driver +/// should continue the processing. On failure, the deallocation pass +/// will terminate. It is recommended to emit a useful error message in +/// that case. +FailureOr mlir::bufferization::BufferDeallocationOpInterface::process(DeallocationState & state, const DeallocationOptions & options) { + return getImpl()->process(getImpl(), getOperation(), state, options); + } +/// This method allows the implementing operation to specify custom logic +/// to materialize an ownership indicator value for the given MemRef typed +/// value it defines (including block arguments of nested regions). Since +/// the operation itself has more information about its semantics the +/// materialized IR can be more efficient compared to the default +/// implementation and avoid cloning MemRefs and/or doing alias checking +/// at runtime. +/// Note that the same logic could also be implemented in the 'process' +/// method above, however, the IR is always materialized then. If +/// it's desirable to only materialize the IR to compute an updated +/// ownership indicator when needed, it should be implemented using this +/// method (which is especially important if operations are created that +/// cannot be easily canonicalized away anymore). +std::pair mlir::bufferization::BufferDeallocationOpInterface::materializeUniqueOwnershipForMemref(DeallocationState & state, const DeallocationOptions & options, OpBuilder & builder, Value memref) { + return getImpl()->materializeUniqueOwnershipForMemref(getImpl(), getOperation(), state, options, builder, memref); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..752a4a2c6f42a2fc18cf1d916ccee48aa7f4acbd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h @@ -0,0 +1,234 @@ +//===- BufferDeallocationOpInterface.h --------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_IR_BUFFERDEALLOCATIONOPINTERFACE_H_ +#define MLIR_DIALECT_BUFFERIZATION_IR_BUFFERDEALLOCATIONOPINTERFACE_H_ + +#include "mlir/Analysis/Liveness.h" +#include "mlir/IR/Operation.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Support/LLVM.h" + +namespace mlir { +namespace bufferization { + +/// Compare two SSA values in a deterministic manner. Two block arguments are +/// ordered by argument number, block arguments are always less than operation +/// results, and operation results are ordered by the `isBeforeInBlock` order of +/// their defining operation. +struct ValueComparator { + bool operator()(const Value &lhs, const Value &rhs) const; +}; + +/// This class is used to track the ownership of values. The ownership can +/// either be not initialized yet ('Uninitialized' state), set to a unique SSA +/// value which indicates the ownership at runtime (or statically if it is a +/// constant value) ('Unique' state), or it cannot be represented in a single +/// SSA value ('Unknown' state). An artificial example of a case where ownership +/// cannot be represented in a single i1 SSA value could be the following: +/// `%0 = test.non_deterministic_select %arg0, %arg1 : i32` +/// Since the operation does not provide us a separate boolean indicator on +/// which of the two operands was selected, we would need to either insert an +/// alias check at runtime to determine if `%0` aliases with `%arg0` or `%arg1`, +/// or insert a `bufferization.clone` operation to get a fresh buffer which we +/// could assign ownership to. +/// +/// The three states this class can represent form a lattice on a partial order: +/// forall X in SSA values. uninitialized < unique(X) < unknown +/// forall X, Y in SSA values. +/// unique(X) == unique(Y) iff X and Y always evaluate to the same value +/// unique(X) != unique(Y) otherwise +class Ownership { +public: + /// Constructor that creates an 'Uninitialized' ownership. This is needed for + /// default-construction when used in DenseMap. + Ownership() = default; + + /// Constructor that creates an 'Unique' ownership. This is a non-explicit + /// constructor to allow implicit conversion from 'Value'. + Ownership(Value indicator); + + /// Get an ownership value in 'Unknown' state. + static Ownership getUnknown(); + /// Get an ownership value in 'Unique' state with 'indicator' as parameter. + static Ownership getUnique(Value indicator); + /// Get an ownership value in 'Uninitialized' state. + static Ownership getUninitialized(); + + /// Check if this ownership value is in the 'Uninitialized' state. + bool isUninitialized() const; + /// Check if this ownership value is in the 'Unique' state. + bool isUnique() const; + /// Check if this ownership value is in the 'Unknown' state. + bool isUnknown() const; + + /// If this ownership value is in 'Unique' state, this function can be used to + /// get the indicator parameter. Using this function in any other state is UB. + Value getIndicator() const; + + /// Get the join of the two-element subset {this,other}. Does not modify + /// 'this'. + Ownership getCombined(Ownership other) const; + + /// Modify 'this' ownership to be the join of the current 'this' and 'other'. + void combine(Ownership other); + +private: + enum class State { + Uninitialized, + Unique, + Unknown, + }; + + // The indicator value is only relevant in the 'Unique' state. + Value indicator; + State state = State::Uninitialized; +}; + +/// Options for BufferDeallocationOpInterface-based buffer deallocation. +struct DeallocationOptions { + // A pass option indicating whether private functions should be modified to + // pass the ownership of MemRef values instead of adhering to the function + // boundary ABI. + bool privateFuncDynamicOwnership = false; +}; + +/// This class collects all the state that we need to perform the buffer +/// deallocation pass with associated helper functions such that we have easy +/// access to it in the BufferDeallocationOpInterface implementations and the +/// BufferDeallocation pass. +class DeallocationState { +public: + DeallocationState(Operation *op); + + // The state should always be passed by reference. + DeallocationState(const DeallocationState &) = delete; + + /// Small helper function to update the ownership map by taking the current + /// ownership ('Uninitialized' state if not yet present), computing the join + /// with the passed ownership and storing this new value in the map. By + /// default, it will be performed for the block where 'owned' is defined. If + /// the ownership of the given value should be updated for another block, the + /// 'block' argument can be explicitly passed. + void updateOwnership(Value memref, Ownership ownership, + Block *block = nullptr); + + /// Removes ownerships associated with all values in the passed range for + /// 'block'. + void resetOwnerships(ValueRange memrefs, Block *block); + + /// Returns the ownership of 'memref' for the given basic block. + Ownership getOwnership(Value memref, Block *block) const; + + /// Remember the given 'memref' to deallocate it at the end of the 'block'. + void addMemrefToDeallocate(Value memref, Block *block); + + /// Forget about a MemRef that we originally wanted to deallocate at the end + /// of 'block', possibly because it already gets deallocated before the end of + /// the block. + void dropMemrefToDeallocate(Value memref, Block *block); + + /// Return a sorted list of MemRef values which are live at the start of the + /// given block. + void getLiveMemrefsIn(Block *block, SmallVectorImpl &memrefs); + + /// Given an SSA value of MemRef type, this function queries the ownership and + /// if it is not already in the 'Unique' state, potentially inserts IR to get + /// a new SSA value, returned as the first element of the pair, which has + /// 'Unique' ownership and can be used instead of the passed Value with the + /// the ownership indicator returned as the second element of the pair. + std::pair + getMemrefWithUniqueOwnership(OpBuilder &builder, Value memref, Block *block); + + /// Given two basic blocks and the values passed via block arguments to the + /// destination block, compute the list of MemRefs that have to be retained in + /// the 'fromBlock' to not run into a use-after-free situation. + /// This list consists of the MemRefs in the successor operand list of the + /// terminator and the MemRefs in the 'out' set of the liveness analysis + /// intersected with the 'in' set of the destination block. + /// + /// toRetain = filter(successorOperands + (liveOut(fromBlock) insersect + /// liveIn(toBlock)), isMemRef) + void getMemrefsToRetain(Block *fromBlock, Block *toBlock, + ValueRange destOperands, + SmallVectorImpl &toRetain) const; + + /// For a given block, computes the list of MemRefs that potentially need to + /// be deallocated at the end of that block. This list also contains values + /// that have to be retained (and are thus part of the list returned by + /// `getMemrefsToRetain`) and is computed by taking the MemRefs in the 'in' + /// set of the liveness analysis of 'block' appended by the set of MemRefs + /// allocated in 'block' itself and subtracted by the set of MemRefs + /// deallocated in 'block'. + /// Note that we don't have to take the intersection of the liveness 'in' set + /// with the 'out' set of the predecessor block because a value that is in the + /// 'in' set must be defined in an ancestor block that dominates all direct + /// predecessors and thus the 'in' set of this block is a subset of the 'out' + /// sets of each predecessor. + /// + /// memrefs = filter((liveIn(block) U + /// allocated(block) U arguments(block)) \ deallocated(block), isMemRef) + /// + /// The list of conditions is then populated by querying the internal + /// datastructures for the ownership value of that MemRef. + LogicalResult + getMemrefsAndConditionsToDeallocate(OpBuilder &builder, Location loc, + Block *block, + SmallVectorImpl &memrefs, + SmallVectorImpl &conditions) const; + + /// Returns the symbol cache to lookup functions from call operations to check + /// attributes on the function operation. + SymbolTableCollection *getSymbolTable() { return &symbolTable; } + +private: + // Symbol cache to lookup functions from call operations to check attributes + // on the function operation. + SymbolTableCollection symbolTable; + + // Mapping from each SSA value with MemRef type to the associated ownership in + // each block. + DenseMap, Ownership> ownershipMap; + + // Collects the list of MemRef values that potentially need to be deallocated + // per block. It is also fine (albeit not efficient) to add MemRef values that + // don't have to be deallocated, but only when the ownership is not 'Unknown'. + DenseMap> memrefsToDeallocatePerBlock; + + // The underlying liveness analysis to compute fine grained information about + // alloc and dealloc positions. + Liveness liveness; +}; + +namespace deallocation_impl { +/// Insert a `bufferization.dealloc` operation right before `op` which has to be +/// a terminator without any successors. Note that it is not required to have +/// the ReturnLike trait attached. The MemRef values in the `operands` argument +/// will be added to the list of retained values and their updated ownership +/// values will be appended to the `updatedOperandOwnerships` list. `op` is not +/// modified in any way. Returns failure if at least one of the MemRefs to +/// deallocate does not have 'Unique' ownership (likely as a result of an +/// incorrect implementation of the `process` or +/// `materializeUniqueOwnershipForMemref` interface method) or the original +/// `op`. +FailureOr +insertDeallocOpForReturnLike(DeallocationState &state, Operation *op, + ValueRange operands, + SmallVectorImpl &updatedOperandOwnerships); +} // namespace deallocation_impl + +} // namespace bufferization +} // namespace mlir + +//===----------------------------------------------------------------------===// +// Buffer Deallocation Interface +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h.inc" + +#endif // MLIR_DIALECT_BUFFERIZATION_IR_BUFFERDEALLOCATIONOPINTERFACE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..60b5b130b14b9d68f369a1c7d3ed4c92fdc17711 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h.inc @@ -0,0 +1,128 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace bufferization { +class BufferDeallocationOpInterface; +namespace detail { +struct BufferDeallocationOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + FailureOr (*process)(const Concept *impl, ::mlir::Operation *, DeallocationState &, const DeallocationOptions &); + std::pair (*materializeUniqueOwnershipForMemref)(const Concept *impl, ::mlir::Operation *, DeallocationState &, const DeallocationOptions &, OpBuilder &, Value); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::bufferization::BufferDeallocationOpInterface; + Model() : Concept{process, materializeUniqueOwnershipForMemref} {} + + static inline FailureOr process(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DeallocationState & state, const DeallocationOptions & options); + static inline std::pair materializeUniqueOwnershipForMemref(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DeallocationState & state, const DeallocationOptions & options, OpBuilder & builder, Value memref); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::bufferization::BufferDeallocationOpInterface; + FallbackModel() : Concept{process, materializeUniqueOwnershipForMemref} {} + + static inline FailureOr process(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DeallocationState & state, const DeallocationOptions & options); + static inline std::pair materializeUniqueOwnershipForMemref(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DeallocationState & state, const DeallocationOptions & options, OpBuilder & builder, Value memref); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + std::pair materializeUniqueOwnershipForMemref(::mlir::Operation *tablegen_opaque_val, DeallocationState &state, const DeallocationOptions &options, OpBuilder &builder, Value memref) const; + }; +};template +struct BufferDeallocationOpInterfaceTrait; + +} // namespace detail +class BufferDeallocationOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::BufferDeallocationOpInterfaceTrait {}; + /// This method takes the current deallocation state and transformation + /// options and updates the deallocation state as necessary for the + /// operation implementing this interface. It may also insert + /// `bufferization.dealloc` operations and rebuild itself with different + /// result types. For operations implementing this interface all other + /// interface handlers (e.g., default handlers for interfaces like + /// RegionBranchOpInterface, CallOpInterface, etc.) are skipped by the + /// deallocation pass. On success, either the current operation or one of + /// the newly inserted operations is returned from which on the driver + /// should continue the processing. On failure, the deallocation pass + /// will terminate. It is recommended to emit a useful error message in + /// that case. + FailureOr process(DeallocationState & state, const DeallocationOptions & options); + /// This method allows the implementing operation to specify custom logic + /// to materialize an ownership indicator value for the given MemRef typed + /// value it defines (including block arguments of nested regions). Since + /// the operation itself has more information about its semantics the + /// materialized IR can be more efficient compared to the default + /// implementation and avoid cloning MemRefs and/or doing alias checking + /// at runtime. + /// Note that the same logic could also be implemented in the 'process' + /// method above, however, the IR is always materialized then. If + /// it's desirable to only materialize the IR to compute an updated + /// ownership indicator when needed, it should be implemented using this + /// method (which is especially important if operations are created that + /// cannot be easily canonicalized away anymore). + std::pair materializeUniqueOwnershipForMemref(DeallocationState & state, const DeallocationOptions & options, OpBuilder & builder, Value memref); +}; +namespace detail { + template + struct BufferDeallocationOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// This method allows the implementing operation to specify custom logic + /// to materialize an ownership indicator value for the given MemRef typed + /// value it defines (including block arguments of nested regions). Since + /// the operation itself has more information about its semantics the + /// materialized IR can be more efficient compared to the default + /// implementation and avoid cloning MemRefs and/or doing alias checking + /// at runtime. + /// Note that the same logic could also be implemented in the 'process' + /// method above, however, the IR is always materialized then. If + /// it's desirable to only materialize the IR to compute an updated + /// ownership indicator when needed, it should be implemented using this + /// method (which is especially important if operations are created that + /// cannot be easily canonicalized away anymore). + std::pair materializeUniqueOwnershipForMemref(DeallocationState & state, const DeallocationOptions & options, OpBuilder & builder, Value memref) { + return state.getMemrefWithUniqueOwnership( + builder, memref, memref.getParentBlock()); + } + }; +}// namespace detail +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +template +FailureOr detail::BufferDeallocationOpInterfaceInterfaceTraits::Model::process(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DeallocationState & state, const DeallocationOptions & options) { + return (llvm::cast(tablegen_opaque_val)).process(state, options); +} +template +std::pair detail::BufferDeallocationOpInterfaceInterfaceTraits::Model::materializeUniqueOwnershipForMemref(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DeallocationState & state, const DeallocationOptions & options, OpBuilder & builder, Value memref) { + return (llvm::cast(tablegen_opaque_val)).materializeUniqueOwnershipForMemref(state, options, builder, memref); +} +template +FailureOr detail::BufferDeallocationOpInterfaceInterfaceTraits::FallbackModel::process(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DeallocationState & state, const DeallocationOptions & options) { + return static_cast(impl)->process(tablegen_opaque_val, state, options); +} +template +std::pair detail::BufferDeallocationOpInterfaceInterfaceTraits::FallbackModel::materializeUniqueOwnershipForMemref(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DeallocationState & state, const DeallocationOptions & options, OpBuilder & builder, Value memref) { + return static_cast(impl)->materializeUniqueOwnershipForMemref(tablegen_opaque_val, state, options, builder, memref); +} +template +std::pair detail::BufferDeallocationOpInterfaceInterfaceTraits::ExternalModel::materializeUniqueOwnershipForMemref(::mlir::Operation *tablegen_opaque_val, DeallocationState &state, const DeallocationOptions &options, OpBuilder &builder, Value memref) const { +return state.getMemrefWithUniqueOwnership( + builder, memref, memref.getParentBlock()); +} +} // namespace bufferization +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..3354c1f23a45866857378a86942af226484d7a22 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.cpp.inc @@ -0,0 +1,399 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Return `true` if the given Value may bufferize to a new buffer +/// allocation. If it is statically unknown that the given Value +/// bufferizes to a buffer allocation, `true` should be returned. +bool mlir::bufferization::BufferizableOpInterface::bufferizesToAllocation(::mlir::Value value) { + return getImpl()->bufferizesToAllocation(getImpl(), getOperation(), value); + } +/// Return `true` if the given OpOperand bufferizes to a memory read. This +/// method will never be called on OpOperands that do not have a tensor +/// type. +/// +/// Note: It is always safe to consider an OpOperand as a memory read, +/// even if it does actually not read; however, this can introduce +/// unnecessary out-of-place bufferization decisions. One-Shot Analysis +/// considers OpOperands of unknown ops (that do not implement this +/// interface) as reading OpOperands. +bool mlir::bufferization::BufferizableOpInterface::bufferizesToMemoryRead(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->bufferizesToMemoryRead(getImpl(), getOperation(), opOperand, state); + } +/// Return `true` if the given OpOperand bufferizes to a memory write. +/// +/// This method will never be called on OpOperands that do not have a +/// tensor type. +/// +/// This method will never be called on OpOperands that do not have an +/// aliasing Value. Intuitively, it does not make sense for an OpOperand +/// to bufferize to a memory write without returning an aliasing tensor, +/// because the write would have no visible effect outside of the op. +/// +/// Note: It is always safe to consider an OpOperand as a memory write, +/// even if it does actually not write; however, this can introduce +/// unnecessary out-of-place bufferization decisions. One-Shot Analysis +/// considers OpOperands of unknown ops (that do not implement this +/// interface) as writing OpOperands. +bool mlir::bufferization::BufferizableOpInterface::bufferizesToMemoryWrite(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->bufferizesToMemoryWrite(getImpl(), getOperation(), opOperand, state); + } +/// Return `true` if the operation bufferizes to IR that performs only +/// element-wise accesses on the specified tensor operands. (The operands +/// must have the same shape.) The `bufferize` method must be implemented +/// in such a way that it is free of loop-carried dependences. I.e., all +/// loads at a position appear before all stores at the same position. +/// +/// Example: Consider a hypothetical op element-wise op, where the "ins" +/// bufferize to a memory read and the "outs" bufferize to a memory write. +/// ``` +/// test.element_wise ins(%0), outs(%1) : tensor<3xf32> +/// ``` +/// +/// The following is a valid access pattern: +/// ``` +/// load(%0[1]) +/// store(%1[1]) +/// load(%0[2]) +/// store(%1[2]) +/// load(%0[0]) +/// store(%1[0]) +/// ``` +/// +/// The following would be an invalid (not element-wise) access pattern: +/// ``` +/// load(%0[1]) +/// store(%0[1]) +/// load(%0[1]) +/// ... +/// ``` +/// +/// Element-wise ops can sometimes bufferize more efficiently: a RaW +/// conflict between two operands of the same op can be avoided if it is +/// guaranteed that an original element value is no longer needed after +/// writing a computed element value at the same location. E.g., such an +/// optimization is possible in the above example if %0 and %1 are +/// equivalent tensors. (It is not possible, if %0 and %1 are merely +/// aliasing. It is not necessary if %0 and %1 are not aliasing at all, +/// because there would be no conflict anyway.) +/// +/// Note: Tensor operands that are not included in `opOperands` can be +/// ignored. A conservative implementation of this interface method may +/// always return "false". +bool mlir::bufferization::BufferizableOpInterface::bufferizesToElementwiseAccess(const ::mlir::bufferization::AnalysisState & state, ArrayRef opOperands) { + return getImpl()->bufferizesToElementwiseAccess(getImpl(), getOperation(), state, opOperands); + } +/// Return `true` if the given OpResult bufferizes to a memory write. +/// This is the same property as `bufferizesToMemoryWrite`, but from The +/// perspective of OpResults. +/// +/// This method will never be called on OpResults that do not have a +/// tensor type. +/// +/// This method has a default implementation. By default, it returns +/// `true` if any of the following three cases applies. +/// +/// 1. There is no corresponding aliasing OpOperand. +/// +/// Example: `tensor.generate ... : tensor<10xf32>` +/// The op fills a newly allocated buffer and bufferizes to a memory +/// write. +/// +/// Counter-example: bufferization.alloc_tensor +/// The op just allocates and does not specifiy the data of the tensor, +/// so resultBufferizesToMemoryWrite is overridden to return false. +/// +/// 2. At least one aliasing OpOperand bufferizes to a memory write. +/// +/// Example: `tensor.insert %f into %t[...] : tensor` +/// The destination OpOperand bufferizes to a memory write, so the +/// result also bufferizes to a memory write. +/// +/// 3. At least one aliasing OpOperand's value is defined inside the +/// defining op of the given OpResult and it is a memory write. +/// +/// According to this rule, an aliasing OpOperand value that is defined +/// inside this op and is bufferizing to a memory write makes the given +/// OpResult bufferize to a memory write. +/// +/// Example: +/// ``` +/// %r = scf.if ... -> tensor { +/// %1 = tensor.insert %f into %t[...] : tensor +/// scf.yield %1 : tensor +/// } else { ... } +/// ``` +/// The scf.if result bufferizes to a memory write because %1 (an +/// OpResult defined inside the scf.if op) bufferizes to a memory +/// write. +bool mlir::bufferization::BufferizableOpInterface::resultBufferizesToMemoryWrite(::mlir::OpResult opResult, const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->resultBufferizesToMemoryWrite(getImpl(), getOperation(), opResult, state); + } +/// Return `true` if the given OpOperand must bufferize in-place. Alias +/// sets and inplace attributes will be set up accordingly before making +/// any other bufferization decisions. This method will never be called on +/// OpOperands that do not have a tensor type. +/// +/// Note: Unranked tensor OpOperands always bufferize in-place. This could +/// be extended in the future. Unranked tensors are used with external +/// functions only. +bool mlir::bufferization::BufferizableOpInterface::mustBufferizeInPlace(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->mustBufferizeInPlace(getImpl(), getOperation(), opOperand, state); + } +/// Return the Values that may alias with a given OpOperand when +/// bufferized in-place. This method will never be called on OpOperands +/// that do not have a tensor type. +/// +/// This method can return multiple Values, indicating that a given +/// OpOperand may at runtime alias with any (or multiple) of the returned +/// Values. +/// +/// Each alias is specified with a degree of certainty: +/// +/// * MAYBE (`isDefinite = false`): At runtime, buffer(opOperand) may +/// alias with the specified Value. +/// * DEFINITE (`isDefinite = true`, default): At runtime, +/// buffer(opOperand) is guaranteed to alias the buffer of the specified +/// Value. This is a stronger property than MAYBE and allows for more +/// precise analyses. DEFINITE properties should be used when possible. +/// +/// Furthermore, each alias is specified with a buffer relation: +/// +/// * `BufferRelation::Equivalent`: Both aliases are the exact same +/// buffer. I.e., same size, no offset, same strides. +/// * `BufferRelation::Unknown`: There is no further information apart +/// from the fact that both buffers alias. +/// +/// False positives are allowed in the list of Values, but they can +/// adversely affect the accuracy of the anlysis. On the contrary, +/// omitting potential aliases is incorrect. +/// +/// One possible (conservative) implementation of this interface method, +/// that is always safe, is to return all tensor Values with +/// BufferRelation::Unknown and MAYBE. +/// +/// Examples: +/// +/// ``` +/// // aliasingValues(%t) = DEFINITE {Equivalent %r} +/// %r = tensor.insert_slice %f into %t : tensor<10xf32> +/// +/// // aliasingValues(%t) = DEFINITE {Unknown %r} +/// // Note: "Buffer is subset of buffer" relationship are not yet +/// // supported, so "Unknown" is the best we can do for now. +/// %r = tensor.extract_slice %t[0]][5][1] +/// : tensor<10xf32> to tensor<5xf32> +/// +/// // aliasingValues(%t1) = MAYBE {Equivalent %r} +/// // aliasingValues(%t2) = MAYBE {Equivalent %r} +/// %r = arith.select %c, %t1, %t2 : tensor<10xf32> +/// +/// // A hypothetical op that bufferizes to rolling a dice and based on +/// // the result to either return buffer(%t) or a newly allocated copy +/// // thereof. +/// // aliasingValues(%t) = MAYBE {Equivalent %r} +/// %r = "dummy.alias_or_copy(%t) : (tensor<10xf32>) -> (tensor<10xf32>)" +/// ``` +::mlir::bufferization::AliasingValueList mlir::bufferization::BufferizableOpInterface::getAliasingValues(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->getAliasingValues(getImpl(), getOperation(), opOperand, state); + } +/// Return the OpOperands that alias with a given Value when bufferized +/// in-place. This method will never be called on Values that do not +/// have a tensor type. +/// +/// By default, this method is the inverse of `getAliasingValues`. Ops +/// with a region that yield values may want to override this method to +/// return the OpOperands that are yielded by the terminator. +/// +/// This method can return multiple OpOperands, indicating that a given +/// Value may at runtime alias with any (or multiple) of the returned +/// OpOperands. +/// +/// This property is specified with a degree of certainty: +/// +/// * MAYBE (`isDefinite = false`): At runtime, buffer(value) may alias +/// with the specified OpOperand. +/// * DEFINITE (`isDefinite = true`, default): At runtime, +/// buffer(value) is guaranteed to alias the buffer of the specified +/// OpOperand. This is a stronger property than MAYBE and allows for +/// more precise analyses. DEFINITE properties should be used when +/// possible. +/// +/// For each alias, a BufferRelation can be specified: +/// +/// * `BufferRelation::Equivalent`: Both aliases are the exact same +/// buffer. I.e., same size, no offset, same strides. +/// * `BufferRelation::Unknown`: There is no further information apart +/// from the fact that both buffers alias. +/// +/// False positives are allowed in the list of OpOperands, but they can +/// adversely affect the accuracy of the anlysis. On the contrary, +/// omitting potential aliases is incorrect. +/// +/// One possible (conservative) implementation of this interface method, +/// that is always safe, is to return all tensor OpOperands with +/// BufferRelation::Unknown and MAYBE. +/// +/// Note: If the returned list of OpOperands is empty, this op definitely +/// bufferizes to a new allocation. In that case `bufferizesToAllocation` +/// must return `true`. +/// +/// Examples: +/// +/// ``` +/// // aliasingOpOperands(%r) = DEFINITE {Equivalent %t} +/// %r = tensor.insert_slice %f into %t : tensor<10xf32> +/// +/// // aliasingOpOperands(%r) = DEFINITE {Unknown %t} +/// %r = tensor.extract_slice %t[0]][5][1] +/// : tensor<10xf32> to tensor<5xf32> +/// +/// // aliasingOpOperands(%r) = DEFINITE {Equivalent %t1, Equivalent %t2} +/// %r = arith.select %c, %t1, %t2 : tensor<10xf32> +/// +/// // aliasingOpOperands(%r) = MAYBE {} +/// %r = tensor.empty() : tensor<10xf32> +/// ``` +::mlir::bufferization::AliasingOpOperandList mlir::bufferization::BufferizableOpInterface::getAliasingOpOperands(::mlir::Value value, const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->getAliasingOpOperands(getImpl(), getOperation(), value, state); + } +/// Resolve all inplacability conflicts by inserting explicit +/// `bufferization.alloc_tensor` ops. Examples of inplacability conflicts +/// are read-after-write conflicts or writes into non-writable buffers. +/// +/// This method should rewrite the IR in such a way that for each tensor +/// OpOperand t, buffer(t) can be directly used when during bufferization. +/// The bufferization does no longer have to care about inplacability +/// conflicts. +/// +/// This method can query analysis information from the given analysis +/// state. +::mlir::LogicalResult mlir::bufferization::BufferizableOpInterface::resolveConflicts(::mlir::RewriterBase & rewriter, const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->resolveConflicts(getImpl(), getOperation(), rewriter, state); + } +/// Bufferize this op, i.e., rewrite it into a memref-based equivalent. +/// Buffers of tensor SSA values can be retrieved via `getBuffer`. +/// Uses of tensor results of the existing tensor op can be replaced with +/// `replaceOpWithBufferizedValues` or `replaceOpWithNewBufferizedOp`. +/// These two functions automatically handle the tensor-to-memref type +/// conversion. +/// +/// The implementation of this method must be consistent with the +/// remaining methods, in particular `getAliasingOpOperands`. I.e., a +/// tensor result `r` may only be replaced with: +/// +/// a) One of the buffers in getAliasingOpOperands(r). +/// b) Or: A newly allocated buffer (only if `bufferizesToAllocation`). +/// +/// This method will never be called on ops that do not have at least one +/// tensor operand/result. +/// +/// The return value of this method indicates whether there was an error +/// while bufferizing this op (such as failing to create a new buffer +/// allocation op). The bufferization driver immediately stops bufferizing +/// the input IR and returns `failure` in that case. If this op is +/// expected to survive bufferization, `success` should be returned +/// (together with `allow-unknown-ops` enabled). +/// +/// Note: If this op supports unstructured control flow in its regions, +/// then this function should also bufferize all block signatures that +/// belong to this op. Branch ops (that branch to a block) are typically +/// bufferized together with the block signature (this is just a +/// suggestion to make sure IR is valid at every point in time and could +/// be done differently). +::mlir::LogicalResult mlir::bufferization::BufferizableOpInterface::bufferize(::mlir::RewriterBase & rewriter, const ::mlir::bufferization::BufferizationOptions & options) { + return getImpl()->bufferize(getImpl(), getOperation(), rewriter, options); + } +/// Return `true` if the given Value can be written to in-place. Value is +/// either an OpResult of this operation or a BlockArgument of a block of +/// this operation. +/// +/// Most OpResult buffers can be written to, but some ops such as +/// ConstantOp may bufferize to non-writable (read-only) memory locations. +/// Therefore, by default, this method returns `true` for OpResults. This +/// method will never be called on OpResults that do not have a tensor +/// type. +/// +/// Whether a BlockArgument can be written to or not depends on the +/// operation. This method conservatively returns `false`. This method +/// will never be called on BlockArguments that do not have a tensor type. +bool mlir::bufferization::BufferizableOpInterface::isWritable(::mlir::Value value, const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->isWritable(getImpl(), getOperation(), value, state); + } +/// Return `true` if the `uRead` and `uWrite` do not constitute a RaW +/// conflict. If they are conflicting or if it is unknown whether they are +/// conflicting, return `false`. This method will never be called with +/// OpOperands that do not have a tensor type. At least one of the two +/// given OpOperands belongs to this operation. +/// +/// This method can be implemented to specify custom RaW analysis rules. +/// If this method returns `true` the given OpOperands are not considered +/// to be conflicting and do not force out-of-place bufferization. (There +/// may still be other conflicts that do.) +bool mlir::bufferization::BufferizableOpInterface::isNotConflicting(::mlir::OpOperand * uRead, ::mlir::OpOperand * uWrite, const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->isNotConflicting(getImpl(), getOperation(), uRead, uWrite, state); + } +/// Return `failure` if this op does not pass the analysis. This method +/// is run during One-Shot Bufferize (after all post-analysis steps). If +/// the op does not pass the analysis, bufferization is aborted. +/// +/// This method can be used to check expected invariants and limitations +/// of the current bufferization implementation. +::mlir::LogicalResult mlir::bufferization::BufferizableOpInterface::verifyAnalysis(const ::mlir::bufferization::AnalysisState & state) { + return getImpl()->verifyAnalysis(getImpl(), getOperation(), state); + } +/// Return the bufferized type of the given tensor value (without +/// bufferizing the IR). The value is either a BlockArgument of a block +/// that belongs to this op or an OpResult of the given op. +/// +/// This method is useful when the bufferized type of value must be +/// predicted before modifying any IR. +/// +/// Implementations may call `bufferization::getBufferType` to compute the +/// bufferized type of another SSA value. The same (unmodified) +/// `invocationStack` must be passed to that function. The stack contains +/// all SSA values for which a buffer type computation is currently in +/// progress. Implementations may inspect the stack to detect repetitive +/// computations for the same SSA value. (E.g., when bufferized types of a +/// loop.) +/// +/// Note: This interface method should never be called directly from user +/// code. Always use `bufferization::getBufferType`. +::mlir::FailureOr<::mlir::BaseMemRefType> mlir::bufferization::BufferizableOpInterface::getBufferType(::mlir::Value value, const ::mlir::bufferization::BufferizationOptions & options, ::llvm::SmallVector<::mlir::Value> & invocationStack) { + return getImpl()->getBufferType(getImpl(), getOperation(), value, options, invocationStack); + } +/// Return `true` if the given region of this op is repetitive. By default +/// this information is queried from the `RegionBranchOpInterface`. Ops +/// that do not implement this inferface can override this method to +/// declare regions as repetitive. +/// +/// The RaW conflict detection of One-Shot Analysis is more strict inside +/// repetitive regions: Op dominance cannot always be used to rule out +/// certain potential conflicts (e.g., a conflicting write happening after +/// a read), because there may not be a meaningful ordering of certain ops +/// that are executed multiple times. This is described in more detail in +/// documentation of One-Shot Analysis. +bool mlir::bufferization::BufferizableOpInterface::isRepetitiveRegion(unsigned index) { + return getImpl()->isRepetitiveRegion(getImpl(), getOperation(), index); + } +/// Return `true` if the given region of this op is parallel, i.e., +/// multiple instances of the region may be executing at the same time. +/// If a region is parallel, it must also be marked as "repetitive". +/// +/// The RaW conflict detection of One-Shot Analysis is more strict inside +/// parallel regions: Buffer may have to be privatized. +/// +/// By default, regions are assumed to be sequential. +bool mlir::bufferization::BufferizableOpInterface::isParallelRegion(unsigned index) { + return getImpl()->isParallelRegion(getImpl(), getOperation(), index); + } +/// Return `true` if the op and this interface implementation supports +/// unstructured control flow. I.e., regions with multiple blocks. This is +/// not supported in most ops, so the default answer is `false`. +bool mlir::bufferization::BufferizableOpInterface::supportsUnstructuredControlFlow() { + return getImpl()->supportsUnstructuredControlFlow(); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..7c09a43f96397b7e7ac935981381c7ec39d8b868 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h @@ -0,0 +1,710 @@ +//===- BufferizableOpInterface.h - Bufferizable Ops -------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_IR_BUFFERIZABLEOPINTERFACE_H_ +#define MLIR_DIALECT_BUFFERIZATION_IR_BUFFERIZABLEOPINTERFACE_H_ + +#include "mlir/IR/Operation.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/DenseMapInfoVariant.h" +#include "llvm/ADT/SetVector.h" +#include + +#include "mlir/Dialect/Bufferization/IR/BufferizationEnums.h.inc" + +namespace mlir { +class OpBuilder; +namespace func { +class FuncOp; +} + +namespace bufferization { + +class AnalysisState; +class BufferizableOpInterface; + +/// Specifies a fine-grain relationship between buffers to enable more analysis. +enum class BufferRelation { + Unknown, + // TODO: ResultContainsOperand, + // TODO: OperandContainsResult, + Equivalent +}; + +/// A maybe aliasing OpOperand. If `isDefinite` is `true`, the OpOperand is +/// guaranteed to alias at runtime. +struct AliasingOpOperand { + AliasingOpOperand(OpOperand *opOperand, BufferRelation relation, + bool isDefinite = true) + : opOperand(opOperand), relation(relation), isDefinite(isDefinite) {} + + OpOperand *opOperand; + BufferRelation relation; + bool isDefinite; +}; + +/// A maybe aliasing Value. If `isDefinite` is `true`, the Value is guaranteed +/// to alias at runtime. +struct AliasingValue { + AliasingValue(Value value, BufferRelation relation, bool isDefinite = true) + : value(value), relation(relation), isDefinite(isDefinite) {} + + Value value; + BufferRelation relation; + bool isDefinite; +}; + +template class AliasList { +public: + /// Create an empty list of aliases. + AliasList() = default; + + /// Create a list of aliases. + AliasList(std::initializer_list elems) { + for (T alias : elems) + addAlias(alias); + } + + /// Create a list of aliases. + AliasList(SmallVector &&aliases) : aliases(std::move(aliases)) {} + + ArrayRef getAliases() const { return aliases; } + + size_t getNumAliases() const { return aliases.size(); } + + void addAlias(T alias) { aliases.push_back(alias); } + + auto begin() const { return aliases.begin(); } + auto end() const { return aliases.end(); } + +private: + /// The list of aliases. + SmallVector aliases; +}; + +/// A list of possible aliasing OpOperands. This list models the runtime +/// aliasing relationship for a Value. +using AliasingOpOperandList = AliasList; + +/// A list of possible aliasing Values. This list models the runtime aliasing +/// relationship for an OpOperand. +using AliasingValueList = AliasList; + +class OpFilter { +public: + /// An op filter entry. Filters can be used to specify which ops should be + /// processed by the bufferization. + struct Entry { + /// If the filter function evaluates to `true`, the filter matches. + using FilterFn = std::function; + + /// Filter type: A filter can either be a DENY filter or an ALLOW filter. + enum FilterType : int8_t { DENY = 0, ALLOW = 1 }; + + FilterFn fn; + FilterType type; + }; + + /// Return whether the op is allowed or not. + /// + /// If the filter does not have an ALLOW rule, ops are allowed by default, + /// unless they are explicitly marked as DENY. If the filter has at least one + /// ALLOW rule, ops are denied by default and only allowed if they match + /// an ALLOW rule and no DENY rule. + bool isOpAllowed(Operation *op) const; + + /// Allow the given dialects. + /// + /// This function adds one or multiple ALLOW entries. + template + void allowDialect() { + // The following expands a call to allowDialectImpl for each dialect + // in 'DialectTs'. + (allowDialectImpl(), ...); + } + + /// Deny the given dialects. + /// + /// This function adds one or multiple DENY entries. + template + void denyDialect() { + (denyDialectImpl(), ...); + } + + /// Allow the given dialect. + /// + /// This function adds an ALLOW entry. + void allowDialect(StringRef dialectNamespace) { + Entry::FilterFn filterFn = [=](Operation *op) { + return op->getDialect()->getNamespace() == dialectNamespace; + }; + entries.push_back(Entry{filterFn, Entry::FilterType::ALLOW}); + } + + /// Allow the given ops. + /// + /// This function adds one or multiple ALLOW entries. + template + void allowOperation() { + (allowOperationImpl(), ...); + } + + /// Deny the given ops. + /// + /// This function adds one or multiple DENY entries. + template + void denyOperation() { + (denyOperationImpl(), ...); + } + + /// Allow the given op. + /// + /// This function adds an ALLOW entry. + void allowOperation(StringRef opName) { + Entry::FilterFn filterFn = [=](Operation *op) { + return op->getName().getStringRef() == opName; + }; + allowOperation(filterFn); + } + + /// Deny the given op. + /// + /// This function adds a DENY entry. + void denyOperation(StringRef opName) { + Entry::FilterFn filterFn = [=](Operation *op) { + return op->getName().getStringRef() == opName; + }; + denyOperation(filterFn); + } + + /// Allow ops that are matched by `fn`. + /// + /// This function adds an ALLOW entry. + void allowOperation(Entry::FilterFn fn) { + entries.push_back(Entry{fn, Entry::FilterType::ALLOW}); + } + + /// Deny ops that are matched by `fn`. + /// + /// This function adds a DENY entry. + void denyOperation(Entry::FilterFn fn) { + entries.push_back(Entry{fn, Entry::FilterType::DENY}); + } + +private: + /// Return `true` if the filter has at least one ALLOW rule. + bool hasAllowRule() const { + for (const Entry &e : entries) + if (e.type == Entry::FilterType::ALLOW) + return true; + return false; + } + + /// Allow a dialect. + template + void allowDialectImpl() { + allowDialect(DialectT::getDialectNamespace()); + } + + /// Deny a dialect. + template + void denyDialectImpl() { + denyDialect(DialectT::getDialectNamespace()); + } + + /// Allow an op. + template + void allowOperationImpl() { + allowOperation(OpTy::getOperationName()); + } + + /// Deny an op. + template + void denyOperationImpl() { + denyOperation(OpTy::getOperationName()); + } + + /// A list of filter entries that determine whether an op should be allowed or + /// denied. If the filter has an ALLOW rule, only ops that are allowed and not + /// denied are allowed. If the filter does not have an ALLOW rule, only ops + /// that are not denied are allowed. + SmallVector entries; +}; + +/// Options for BufferizableOpInterface-based bufferization. +struct BufferizationOptions { + /// Allocator function: Generate a memref allocation with the given type, + /// dynamic extents and alignment. + using AllocationFn = std::function( + OpBuilder &, Location, MemRefType, ValueRange, unsigned int)>; + /// Memcpy function: Generate a memcpy between two buffers. + using MemCpyFn = + std::function; + /// Initializer function for analysis state. + using AnalysisStateInitFn = std::function; + /// Tensor -> MemRef type converter. + /// Parameters: Value, memory space, func op, bufferization options + using FunctionArgTypeConverterFn = + std::function; + /// Tensor -> MemRef type converter. + /// Parameters: Value, memory space, bufferization options + using UnknownTypeConverterFn = std::function; + + BufferizationOptions(); + + /// Try to cast the given op to BufferizableOpInterface if the op is allow + /// listed. + BufferizableOpInterface dynCastBufferizableOp(Operation *op) const; + + /// Try to cast the given value to BufferizableOpInterface if the op is allow + /// listed. + BufferizableOpInterface dynCastBufferizableOp(Value value) const; + + /// A filter that specifies which ops should be bufferized and which ops + /// should be ignored. + OpFilter opFilter; + + /// Return `true` if the given op should be bufferized. + bool isOpAllowed(Operation *op) const; + + /// Helper functions for allocation and memory copying. + std::optional allocationFn; + std::optional memCpyFn; + + /// Create a memref allocation with the given type and dynamic extents. + FailureOr createAlloc(OpBuilder &b, Location loc, MemRefType type, + ValueRange dynShape) const; + + /// Creates a memcpy between two given buffers. + LogicalResult createMemCpy(OpBuilder &b, Location loc, Value from, + Value to) const; + + /// Specifies whether not bufferizable ops are allowed in the input. If so, + /// bufferization.to_memref and bufferization.to_tensor ops are inserted at + /// the boundaries. + bool allowUnknownOps = false; + + /// Specifies whether function boundaries (ops in the func dialect) should be + /// bufferized or not. + bool bufferizeFunctionBoundaries = false; + + /// The default memory space that should be used when it cannot be inferred + /// from the context. If case of std::nullopt, bufferization fails when the + /// memory space cannot be inferred at any point. + std::optional defaultMemorySpace = Attribute(); + + /// Certain ops have aliasing OpOperand/OpResult invariants (e.g., scf.for). + /// If this flag is set to `false`, those invariants are no longer enforced + /// with buffer copies. + /// + /// Note: Deactivating this flag can lead to incorrect bufferization results + /// when used incorrectly. This flag is useful with + /// `AlwaysCopyAnalysisState` which bufferizes all writing tensor + /// OpOperands out-of-place. + bool enforceAliasingInvariants = true; + + /// This function controls buffer types on function signatures. Sets + /// `functionArgTypeConverterFn` and `inferFunctionResultLayout` accordingly. + /// + /// * InferLayoutMap: All function parameter types have a fully dynamic layout + /// map, but function result types are inferred from the body of the + /// function. + /// * FullyDynamicLayoutMap: All function parameter types and result types + /// have a fully dynamic layout map. This option is most efficient because + /// any layout map can be casted to a fully dynamic one. + /// * IdentityLayoutMap: All function parameter types and result types have a + /// static identity layout (i.e., no layout map). This option may introduce + /// additional buffer allocs and copies because layout maps cannot be casted + /// away. + /// + /// Note: Inferred layout maps may not be desireable when interacting with + /// external functions, because the generated function signatures will be less + /// predictable. + void setFunctionBoundaryTypeConversion(LayoutMapOption layoutMapOption); + + /// Type converter from tensors to memrefs. This type converter is used to + /// determine bufferized function argument types. By default, a type + /// converter that returns a memref type with a fully dynamic layout map is + /// used. + /// + /// If `bufferizeFunctionBoundaries` is not set, this function isn't used. + FunctionArgTypeConverterFn functionArgTypeConverterFn = nullptr; + + /// If true, function result types are inferred from the body of the function. + /// Otherwise, function result type is determined by + /// `functionArgTypeConverterFn`. + /// + /// If `bufferizeFunctionBoundaries` is not set, this flag has no effect. + bool inferFunctionResultLayout = true; + + /// Type converter from tensors to memrefs. This type converter is used if no + /// memref type could be inferred during bufferization. By default, a type + /// converter that returns a memref type with a fully dynamic layout map is + /// used. + UnknownTypeConverterFn unknownTypeConverterFn = nullptr; + + /// Seed for the analysis fuzzer. If set to `0`, the fuzzer is deactivated. + /// Should be used only with `testAnalysisOnly = true`. + unsigned analysisFuzzerSeed = 0; + + /// If set to `true`, the analysis is skipped. A buffer is copied before every + /// write. This flag cannot be used together with `testAnalysisOnly = true`. + bool copyBeforeWrite = false; + + /// If set to `true`, does not modify the IR apart from adding attributes (for + /// checking the results of the analysis) and post analysis steps. + bool testAnalysisOnly = false; + + /// If set to `true`, the IR is annotated with details about RaW conflicts. + /// For debugging only. Should be used together with `testAnalysisOnly`. + bool printConflicts = false; + + /// Buffer alignment for new memory allocations. + unsigned int bufferAlignment = 64; + + /// Initializer functions for analysis state. These can be used to + /// initialize dialect-specific analysis state. + SmallVector stateInitializers; +}; + +/// Return `true` if the given value is a BlockArgument of a func::FuncOp. +bool isFunctionArgument(Value value); + +/// Traversal parameters for `findValueInReverseUseDefChain`. +struct TraversalConfig { + /// Specifies if leaves (that do not have further OpOperands to follow) + /// should be returned even if they do not match the specified filter. + bool alwaysIncludeLeaves = true; + + /// Specifies whether out-of-place/undecided OpOperands should be followed. + bool followInPlaceOnly = false; + + /// Specifies whether non-equivalent OpOperands should be followed. + bool followEquivalentOnly = false; + + /// Specifies whether unknown/non-bufferizable/ops not included in the + /// OpFilter of BufferizationOptions should be followed. + bool followUnknownOps = false; + + /// Specifies whether OpOperands with a different type that are not the result + /// of a CastOpInterface op should be followed. + bool followSameTypeOrCastsOnly = false; + + /// Specifies whether already visited values should be visited again. + /// (Note: This can result in infinite looping.) + bool revisitAlreadyVisitedValues = false; +}; + +/// AnalysisState provides a variety of helper functions for dealing with +/// tensor values. +class AnalysisState { +public: + /// Determine which OpOperand* will alias with `value` if the op is + /// bufferized in place. Return all tensor OpOperand* if the op is not + /// bufferizable. + AliasingOpOperandList getAliasingOpOperands(Value value) const; + + /// Determine which Value will alias with `opOperand` if the op is bufferized + /// in place. Return all tensor Values if the op is not bufferizable. + AliasingValueList getAliasingValues(OpOperand &opOperand) const; + + /// Return true if `opOperand` bufferizes to a memory read. Return `true` if + /// the op is not bufferizable. + bool bufferizesToMemoryRead(OpOperand &opOperand) const; + + /// Return true if `opOperand` bufferizes to a memory write. Return true` if + /// the op is not bufferizable. + bool bufferizesToMemoryWrite(OpOperand &opOperand) const; + + /// Return true if the given `value` bufferizes to a memory write. Return + /// true if the value is a block argument. Return `true` if the defining op is + /// not bufferizable. Otherwise, consult the BufferizableOpInterface. + bool bufferizesToMemoryWrite(Value value) const; + + /// Return true if `opOperand` does neither read nor write but bufferizes to + /// an alias. Return false if the op is not bufferizable. + bool bufferizesToAliasOnly(OpOperand &opOperand) const; + + /// Return true if a copy can always be avoided when allocating a new tensor + /// for the given OpOperand. + bool canOmitTensorCopy(OpOperand &opOperand) const; + + /// Return true if the given value is read by an op that bufferizes to a + /// memory read. Also takes into account ops that create an alias but do not + /// read by themselves (e.g., ExtractSliceOp). + bool isValueRead(Value value) const; + + /// Starting from `value`, follow the use-def chain in reverse, always + /// selecting the aliasing OpOperands. Find and return Values for which + /// `condition` evaluates to true. OpOperands of such matching Values are not + /// traversed any further. + /// + /// When reaching the end of a chain, also return the last Value of that + /// chain if `config.alwaysIncludeLeaves` is set. + /// + /// Example: + /// + /// 8 + /// | + /// 6* 7* +-----+----+ + /// | | | | + /// 2* 3 4* 5 + /// | | | | + /// +----------+----------+----------+ + /// | + /// 1 + /// + /// In the above example, Values with a star satisfy the condition. When + /// starting the traversal from Value 1, the resulting SetVector is: + /// { 2, 7, 8, 5 } + /// + /// Additional stopping conditions for the traversal can be specified in + /// `config`. + SetVector findValueInReverseUseDefChain( + Value value, llvm::function_ref condition, + TraversalConfig config = TraversalConfig()) const; + + /// Find the values that may define the contents of the given value at + /// runtime. A block argument is always a definition. An OpResult is a + /// definition if it bufferizes to memory write. If it does not bufferize to + /// a memory write but has aliasing operands, we continue the lookup on these + /// values. + /// + /// Example: %r = tensor.insert %f into %t[%c0] : tensor + /// findDefinitions(%r) = {%r} because %r bufferizes to memory write. + /// + /// Example: %r = tensor.empty() : tensor<10xf32> + /// findDefinitions(%r) = {} because tensor.empty does not the define the + /// contents of its result (i.e., it does not bufferize to a memory write) + /// and it has no aliasing OpOperands. + /// + /// Example: + /// %a = arith.constant ... : tensor<10xf32> + /// %b1 = tensor.insert %f into %t : tensor<50xf32> + /// %b2 = tensor.extract_slice %b1[0][10][1] : tensor<50xf32> tensor<10xf32> + /// %r = arith.select %cond, %a, %b : tensor<10xf32> + /// findDefinitions(%r) = {%a, %b1}. %r and %b2 are skipped (lookup continues + /// in the operands) because their defining ops do not define the contents of + /// the tensor. + /// + /// Example: + /// %a = tensor.empty() : tensor<10xf32> + /// %b = arith.constant ... : tensor<10xf32> + /// %r = arith.select %cond, %a, %b : tensor<10xf32> + /// findDefinitions(%r) = {%b}. %a is excluded because it does not define the + /// contents of the tensor. + /// + /// Note: OpResults of unknown ops are handled conservatively and assumed to + /// be definitions. + SetVector findDefinitions(Value value) const; + + /// Return `true` if the given OpResult has been decided to bufferize inplace. + virtual bool isInPlace(OpOperand &opOperand) const; + + /// Return true if `v1` and `v2` bufferize to equivalent buffers. + virtual bool areEquivalentBufferizedValues(Value v1, Value v2) const; + + /// Return true if `v1` and `v2` may bufferize to aliasing buffers. + virtual bool areAliasingBufferizedValues(Value v1, Value v2) const; + + /// Return `true` if the given tensor has undefined contents. + virtual bool hasUndefinedContents(OpOperand *opOperand) const; + + /// Return a reference to the BufferizationOptions. + const BufferizationOptions &getOptions() const { return options; } + + AnalysisState(const BufferizationOptions &options); + + // AnalysisState should be passed as a reference. + AnalysisState(const AnalysisState &) = delete; + + virtual ~AnalysisState() = default; + + static bool classof(const AnalysisState *base) { return true; } + + TypeID getType() const { return type; } + + /// Return the closest enclosing repetitive region around the given op. + Region *getEnclosingRepetitiveRegion(Operation *op, + const BufferizationOptions &options); + + /// Return the closest enclosing repetitive region around the place where the + /// given value is defined. + Region *getEnclosingRepetitiveRegion(Value value, + const BufferizationOptions &options); + + /// Return the closest enclosing repetitive region around the given block. + Region *getEnclosingRepetitiveRegion(Block *block, + const BufferizationOptions &options); + + virtual void resetCache(); + +protected: + AnalysisState(const BufferizationOptions &options, TypeID type); + +private: + /// A reference to current bufferization options. + const BufferizationOptions &options; + + /// The type of analysis. + TypeID type; + + /// Cache containing closest ancestor repetitive Region. + DenseMap, Region *> + enclosingRepetitiveRegionCache; +}; + +/// Create an AllocTensorOp for the given shaped value (memref or tensor). +/// If `copy` is set, the shaped value is copied. Otherwise, a tensor with +/// undefined contents is allocated. +FailureOr +allocateTensorForShapedValue(OpBuilder &b, Location loc, Value shapedValue, + const BufferizationOptions &options, + bool copy = true); + +/// Lookup the buffer for the given value. If the value was not bufferized +/// yet, wrap it in a ToMemrefOp. Otherwise, it is the result of a ToTensorOp, +/// from which the memref operand is returned. +FailureOr getBuffer(RewriterBase &rewriter, Value value, + const BufferizationOptions &options); + +/// Return the buffer type for a given Value (tensor) after bufferization +/// without bufferizing any IR. +/// +/// Note: It should be sufficient to call `getBuffer()->getType()` in most +/// cases. However, when a buffer type should be predicted without modifying any +/// IR, this function can be used. +/// +/// This function is a wrapper around BufferizableOpInterface::getBufferType. +FailureOr getBufferType(Value value, + const BufferizationOptions &options); + +/// Return the buffer type for a given Value (tensor) after bufferization +/// without bufferizing any IR. This function (and not the other overload +/// without `invocationStack`) can be used from `getBufferType` implementations +/// of the `BufferizableOpInterface`. +/// +/// Note: It should be sufficient to call `getBuffer()->getType()` in most +/// cases. However, when a buffer type should be predicted without modifying any +/// IR, this function can be used. +/// +/// This function is a wrapper around `BufferizableOpInterface::getBufferType`. +FailureOr getBufferType(Value value, + const BufferizationOptions &options, + SmallVector &invocationStack); + +/// Replace an op with replacement values. The op is deleted. Tensor OpResults +/// must be replaced with memref values. +void replaceOpWithBufferizedValues(RewriterBase &rewriter, Operation *op, + ValueRange values); + +/// Replace an op with a new op. The new op must have the same number of +/// results as the replaced op. The new op may not return any tensor values. +template +OpTy replaceOpWithNewBufferizedOp(RewriterBase &rewriter, Operation *op, + Args &&...args) { + auto newOp = rewriter.create(op->getLoc(), std::forward(args)...); + replaceOpWithBufferizedValues(rewriter, op, newOp->getResults()); + return newOp; +} + +/// Return a MemRefType to which the type of the given value can be bufferized. +/// +/// If possible, op bufferization implementations should not use this function +/// and instead infer precise memref types for tensor results by themselves. +/// +/// Unless a layout map was specified, `options.unknownTypeConverterFn` +/// determines what kind of layout map will be used. For best composability +/// (without copies), the fully dynamic layout map is used by default. +/// +/// Note: Canonicalization patterns could clean up layout maps and infer more +/// precise layout maps after bufferization. However, many possible +/// canonicalizations are currently not implemented. +BaseMemRefType getMemRefType(Value value, const BufferizationOptions &options, + MemRefLayoutAttrInterface layout = {}, + Attribute memorySpace = nullptr); + +/// Return a MemRef type with fully dynamic layout. If the given tensor type +/// is unranked, return an unranked MemRef type. +BaseMemRefType +getMemRefTypeWithFullyDynamicLayout(TensorType tensorType, + Attribute memorySpace = nullptr); + +/// Return a MemRef type with a static identity layout (i.e., no layout map). If +/// the given tensor type is unranked, return an unranked MemRef type. +BaseMemRefType +getMemRefTypeWithStaticIdentityLayout(TensorType tensorType, + Attribute memorySpace = nullptr); + +/// Return the owner of the given value. In case of a BlockArgument that is the +/// owner of the block. In case of an OpResult that is the defining op. +Operation *getOwnerOfValue(Value value); + +/// Assuming that the given region is repetitive, find the next enclosing +/// repetitive region. +Region *getNextEnclosingRepetitiveRegion(Region *region, + const BufferizationOptions &options); + +/// If `region` is a parallel region, return `region`. Otherwise, find the first +/// enclosing parallel region of `region`. If there is no such region, return +/// "nullptr". +/// +/// Note: Whether a region is parallel or sequential is queried from the +/// `BufferizableOpInterface`. +Region *getParallelRegion(Region *region, const BufferizationOptions &options); + +namespace detail { +/// This is the default implementation of +/// BufferizableOpInterface::getAliasingOpOperands. Should not be called from +/// other places. +AliasingOpOperandList defaultGetAliasingOpOperands(Value value, + const AnalysisState &state); + +/// This is the default implementation of +/// BufferizableOpInterface::getBufferType. Should not be called from other +/// places. +FailureOr +defaultGetBufferType(Value value, const BufferizationOptions &options, + SmallVector &invocationStack); + +/// This is the default implementation of +/// BufferizableOpInterface::resultBufferizesToMemoryWrite. Should not be called +/// from other places. +bool defaultResultBufferizesToMemoryWrite(OpResult opResult, + const AnalysisState &state); + +/// This is the default implementation of +/// BufferizableOpInterface::isRepetitiveRegion. Should not be called from other +/// places. +bool defaultIsRepetitiveRegion(BufferizableOpInterface bufferizableOp, + unsigned index); + +/// This is the default implementation of getAliasingOpOperands in case the +/// defining op does not implement the BufferizableOpInterface. +AliasingOpOperandList unknownGetAliasingOpOperands(Value value); + +/// This is the default implementation of getAliasingValues in case the owner +/// op does not implement the BufferizableOpInterface. +AliasingValueList unknownGetAliasingValues(OpOperand &opOperand); +} // namespace detail + +} // namespace bufferization +} // namespace mlir + +MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::bufferization::AnalysisState) + +//===----------------------------------------------------------------------===// +// Bufferization Interfaces +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h.inc" + +#endif // MLIR_DIALECT_BUFFERIZATION_IR_BUFFERIZABLEOPINTERFACE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..682e765caab45c91d280bc27731908e72877890d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h.inc @@ -0,0 +1,1147 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace bufferization { +class BufferizableOpInterface; +namespace detail { +struct BufferizableOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + bool (*bufferizesToAllocation)(const Concept *impl, ::mlir::Operation *, ::mlir::Value); + bool (*bufferizesToMemoryRead)(const Concept *impl, ::mlir::Operation *, ::mlir::OpOperand &, const ::mlir::bufferization::AnalysisState &); + bool (*bufferizesToMemoryWrite)(const Concept *impl, ::mlir::Operation *, ::mlir::OpOperand &, const ::mlir::bufferization::AnalysisState &); + bool (*bufferizesToElementwiseAccess)(const Concept *impl, ::mlir::Operation *, const ::mlir::bufferization::AnalysisState &, ArrayRef); + bool (*resultBufferizesToMemoryWrite)(const Concept *impl, ::mlir::Operation *, ::mlir::OpResult, const ::mlir::bufferization::AnalysisState &); + bool (*mustBufferizeInPlace)(const Concept *impl, ::mlir::Operation *, ::mlir::OpOperand &, const ::mlir::bufferization::AnalysisState &); + ::mlir::bufferization::AliasingValueList (*getAliasingValues)(const Concept *impl, ::mlir::Operation *, ::mlir::OpOperand &, const ::mlir::bufferization::AnalysisState &); + ::mlir::bufferization::AliasingOpOperandList (*getAliasingOpOperands)(const Concept *impl, ::mlir::Operation *, ::mlir::Value, const ::mlir::bufferization::AnalysisState &); + ::mlir::LogicalResult (*resolveConflicts)(const Concept *impl, ::mlir::Operation *, ::mlir::RewriterBase &, const ::mlir::bufferization::AnalysisState &); + ::mlir::LogicalResult (*bufferize)(const Concept *impl, ::mlir::Operation *, ::mlir::RewriterBase &, const ::mlir::bufferization::BufferizationOptions &); + bool (*isWritable)(const Concept *impl, ::mlir::Operation *, ::mlir::Value, const ::mlir::bufferization::AnalysisState &); + bool (*isNotConflicting)(const Concept *impl, ::mlir::Operation *, ::mlir::OpOperand *, ::mlir::OpOperand *, const ::mlir::bufferization::AnalysisState &); + ::mlir::LogicalResult (*verifyAnalysis)(const Concept *impl, ::mlir::Operation *, const ::mlir::bufferization::AnalysisState &); + ::mlir::FailureOr<::mlir::BaseMemRefType> (*getBufferType)(const Concept *impl, ::mlir::Operation *, ::mlir::Value, const ::mlir::bufferization::BufferizationOptions &, ::llvm::SmallVector<::mlir::Value> &); + bool (*isRepetitiveRegion)(const Concept *impl, ::mlir::Operation *, unsigned); + bool (*isParallelRegion)(const Concept *impl, ::mlir::Operation *, unsigned); + bool (*supportsUnstructuredControlFlow)(); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::bufferization::BufferizableOpInterface; + Model() : Concept{bufferizesToAllocation, bufferizesToMemoryRead, bufferizesToMemoryWrite, bufferizesToElementwiseAccess, resultBufferizesToMemoryWrite, mustBufferizeInPlace, getAliasingValues, getAliasingOpOperands, resolveConflicts, bufferize, isWritable, isNotConflicting, verifyAnalysis, getBufferType, isRepetitiveRegion, isParallelRegion, supportsUnstructuredControlFlow} {} + + static inline bool bufferizesToAllocation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value); + static inline bool bufferizesToMemoryRead(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + static inline bool bufferizesToMemoryWrite(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + static inline bool bufferizesToElementwiseAccess(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState & state, ArrayRef opOperands); + static inline bool resultBufferizesToMemoryWrite(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpResult opResult, const ::mlir::bufferization::AnalysisState & state); + static inline bool mustBufferizeInPlace(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::bufferization::AliasingValueList getAliasingValues(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::bufferization::AliasingOpOperandList getAliasingOpOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::LogicalResult resolveConflicts(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::LogicalResult bufferize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, const ::mlir::bufferization::BufferizationOptions & options); + static inline bool isWritable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState & state); + static inline bool isNotConflicting(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand * uRead, ::mlir::OpOperand * uWrite, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::LogicalResult verifyAnalysis(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::FailureOr<::mlir::BaseMemRefType> getBufferType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::BufferizationOptions & options, ::llvm::SmallVector<::mlir::Value> & invocationStack); + static inline bool isRepetitiveRegion(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned index); + static inline bool isParallelRegion(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned index); + static inline bool supportsUnstructuredControlFlow(); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::bufferization::BufferizableOpInterface; + FallbackModel() : Concept{bufferizesToAllocation, bufferizesToMemoryRead, bufferizesToMemoryWrite, bufferizesToElementwiseAccess, resultBufferizesToMemoryWrite, mustBufferizeInPlace, getAliasingValues, getAliasingOpOperands, resolveConflicts, bufferize, isWritable, isNotConflicting, verifyAnalysis, getBufferType, isRepetitiveRegion, isParallelRegion, supportsUnstructuredControlFlow} {} + + static inline bool bufferizesToAllocation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value); + static inline bool bufferizesToMemoryRead(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + static inline bool bufferizesToMemoryWrite(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + static inline bool bufferizesToElementwiseAccess(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState & state, ArrayRef opOperands); + static inline bool resultBufferizesToMemoryWrite(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpResult opResult, const ::mlir::bufferization::AnalysisState & state); + static inline bool mustBufferizeInPlace(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::bufferization::AliasingValueList getAliasingValues(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::bufferization::AliasingOpOperandList getAliasingOpOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::LogicalResult resolveConflicts(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::LogicalResult bufferize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, const ::mlir::bufferization::BufferizationOptions & options); + static inline bool isWritable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState & state); + static inline bool isNotConflicting(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand * uRead, ::mlir::OpOperand * uWrite, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::LogicalResult verifyAnalysis(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState & state); + static inline ::mlir::FailureOr<::mlir::BaseMemRefType> getBufferType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::BufferizationOptions & options, ::llvm::SmallVector<::mlir::Value> & invocationStack); + static inline bool isRepetitiveRegion(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned index); + static inline bool isParallelRegion(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned index); + static inline bool supportsUnstructuredControlFlow(); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + bool bufferizesToAllocation(::mlir::Operation *tablegen_opaque_val, ::mlir::Value value) const; + bool bufferizesToMemoryRead(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand &opOperand, const ::mlir::bufferization::AnalysisState &state) const; + bool bufferizesToMemoryWrite(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand &opOperand, const ::mlir::bufferization::AnalysisState &state) const; + bool bufferizesToElementwiseAccess(::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState &state, ArrayRef opOperands) const; + bool resultBufferizesToMemoryWrite(::mlir::Operation *tablegen_opaque_val, ::mlir::OpResult opResult, const ::mlir::bufferization::AnalysisState &state) const; + bool mustBufferizeInPlace(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand &opOperand, const ::mlir::bufferization::AnalysisState &state) const; + ::mlir::bufferization::AliasingValueList getAliasingValues(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand &opOperand, const ::mlir::bufferization::AnalysisState &state) const; + ::mlir::bufferization::AliasingOpOperandList getAliasingOpOperands(::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState &state) const; + ::mlir::LogicalResult resolveConflicts(::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase &rewriter, const ::mlir::bufferization::AnalysisState &state) const; + ::mlir::LogicalResult bufferize(::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase &rewriter, const ::mlir::bufferization::BufferizationOptions &options) const; + bool isWritable(::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState &state) const; + bool isNotConflicting(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand *uRead, ::mlir::OpOperand *uWrite, const ::mlir::bufferization::AnalysisState &state) const; + ::mlir::LogicalResult verifyAnalysis(::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState &state) const; + ::mlir::FailureOr<::mlir::BaseMemRefType> getBufferType(::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::BufferizationOptions &options, ::llvm::SmallVector<::mlir::Value> &invocationStack) const; + bool isRepetitiveRegion(::mlir::Operation *tablegen_opaque_val, unsigned index) const; + bool isParallelRegion(::mlir::Operation *tablegen_opaque_val, unsigned index) const; + static bool supportsUnstructuredControlFlow(); + }; +};template +struct BufferizableOpInterfaceTrait; + +} // namespace detail +class BufferizableOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::BufferizableOpInterfaceTrait {}; + /// Return `true` if the given Value may bufferize to a new buffer + /// allocation. If it is statically unknown that the given Value + /// bufferizes to a buffer allocation, `true` should be returned. + bool bufferizesToAllocation(::mlir::Value value); + /// Return `true` if the given OpOperand bufferizes to a memory read. This + /// method will never be called on OpOperands that do not have a tensor + /// type. + /// + /// Note: It is always safe to consider an OpOperand as a memory read, + /// even if it does actually not read; however, this can introduce + /// unnecessary out-of-place bufferization decisions. One-Shot Analysis + /// considers OpOperands of unknown ops (that do not implement this + /// interface) as reading OpOperands. + bool bufferizesToMemoryRead(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + /// Return `true` if the given OpOperand bufferizes to a memory write. + /// + /// This method will never be called on OpOperands that do not have a + /// tensor type. + /// + /// This method will never be called on OpOperands that do not have an + /// aliasing Value. Intuitively, it does not make sense for an OpOperand + /// to bufferize to a memory write without returning an aliasing tensor, + /// because the write would have no visible effect outside of the op. + /// + /// Note: It is always safe to consider an OpOperand as a memory write, + /// even if it does actually not write; however, this can introduce + /// unnecessary out-of-place bufferization decisions. One-Shot Analysis + /// considers OpOperands of unknown ops (that do not implement this + /// interface) as writing OpOperands. + bool bufferizesToMemoryWrite(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + /// Return `true` if the operation bufferizes to IR that performs only + /// element-wise accesses on the specified tensor operands. (The operands + /// must have the same shape.) The `bufferize` method must be implemented + /// in such a way that it is free of loop-carried dependences. I.e., all + /// loads at a position appear before all stores at the same position. + /// + /// Example: Consider a hypothetical op element-wise op, where the "ins" + /// bufferize to a memory read and the "outs" bufferize to a memory write. + /// ``` + /// test.element_wise ins(%0), outs(%1) : tensor<3xf32> + /// ``` + /// + /// The following is a valid access pattern: + /// ``` + /// load(%0[1]) + /// store(%1[1]) + /// load(%0[2]) + /// store(%1[2]) + /// load(%0[0]) + /// store(%1[0]) + /// ``` + /// + /// The following would be an invalid (not element-wise) access pattern: + /// ``` + /// load(%0[1]) + /// store(%0[1]) + /// load(%0[1]) + /// ... + /// ``` + /// + /// Element-wise ops can sometimes bufferize more efficiently: a RaW + /// conflict between two operands of the same op can be avoided if it is + /// guaranteed that an original element value is no longer needed after + /// writing a computed element value at the same location. E.g., such an + /// optimization is possible in the above example if %0 and %1 are + /// equivalent tensors. (It is not possible, if %0 and %1 are merely + /// aliasing. It is not necessary if %0 and %1 are not aliasing at all, + /// because there would be no conflict anyway.) + /// + /// Note: Tensor operands that are not included in `opOperands` can be + /// ignored. A conservative implementation of this interface method may + /// always return "false". + bool bufferizesToElementwiseAccess(const ::mlir::bufferization::AnalysisState & state, ArrayRef opOperands); + /// Return `true` if the given OpResult bufferizes to a memory write. + /// This is the same property as `bufferizesToMemoryWrite`, but from The + /// perspective of OpResults. + /// + /// This method will never be called on OpResults that do not have a + /// tensor type. + /// + /// This method has a default implementation. By default, it returns + /// `true` if any of the following three cases applies. + /// + /// 1. There is no corresponding aliasing OpOperand. + /// + /// Example: `tensor.generate ... : tensor<10xf32>` + /// The op fills a newly allocated buffer and bufferizes to a memory + /// write. + /// + /// Counter-example: bufferization.alloc_tensor + /// The op just allocates and does not specifiy the data of the tensor, + /// so resultBufferizesToMemoryWrite is overridden to return false. + /// + /// 2. At least one aliasing OpOperand bufferizes to a memory write. + /// + /// Example: `tensor.insert %f into %t[...] : tensor` + /// The destination OpOperand bufferizes to a memory write, so the + /// result also bufferizes to a memory write. + /// + /// 3. At least one aliasing OpOperand's value is defined inside the + /// defining op of the given OpResult and it is a memory write. + /// + /// According to this rule, an aliasing OpOperand value that is defined + /// inside this op and is bufferizing to a memory write makes the given + /// OpResult bufferize to a memory write. + /// + /// Example: + /// ``` + /// %r = scf.if ... -> tensor { + /// %1 = tensor.insert %f into %t[...] : tensor + /// scf.yield %1 : tensor + /// } else { ... } + /// ``` + /// The scf.if result bufferizes to a memory write because %1 (an + /// OpResult defined inside the scf.if op) bufferizes to a memory + /// write. + bool resultBufferizesToMemoryWrite(::mlir::OpResult opResult, const ::mlir::bufferization::AnalysisState & state); + /// Return `true` if the given OpOperand must bufferize in-place. Alias + /// sets and inplace attributes will be set up accordingly before making + /// any other bufferization decisions. This method will never be called on + /// OpOperands that do not have a tensor type. + /// + /// Note: Unranked tensor OpOperands always bufferize in-place. This could + /// be extended in the future. Unranked tensors are used with external + /// functions only. + bool mustBufferizeInPlace(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + /// Return the Values that may alias with a given OpOperand when + /// bufferized in-place. This method will never be called on OpOperands + /// that do not have a tensor type. + /// + /// This method can return multiple Values, indicating that a given + /// OpOperand may at runtime alias with any (or multiple) of the returned + /// Values. + /// + /// Each alias is specified with a degree of certainty: + /// + /// * MAYBE (`isDefinite = false`): At runtime, buffer(opOperand) may + /// alias with the specified Value. + /// * DEFINITE (`isDefinite = true`, default): At runtime, + /// buffer(opOperand) is guaranteed to alias the buffer of the specified + /// Value. This is a stronger property than MAYBE and allows for more + /// precise analyses. DEFINITE properties should be used when possible. + /// + /// Furthermore, each alias is specified with a buffer relation: + /// + /// * `BufferRelation::Equivalent`: Both aliases are the exact same + /// buffer. I.e., same size, no offset, same strides. + /// * `BufferRelation::Unknown`: There is no further information apart + /// from the fact that both buffers alias. + /// + /// False positives are allowed in the list of Values, but they can + /// adversely affect the accuracy of the anlysis. On the contrary, + /// omitting potential aliases is incorrect. + /// + /// One possible (conservative) implementation of this interface method, + /// that is always safe, is to return all tensor Values with + /// BufferRelation::Unknown and MAYBE. + /// + /// Examples: + /// + /// ``` + /// // aliasingValues(%t) = DEFINITE {Equivalent %r} + /// %r = tensor.insert_slice %f into %t : tensor<10xf32> + /// + /// // aliasingValues(%t) = DEFINITE {Unknown %r} + /// // Note: "Buffer is subset of buffer" relationship are not yet + /// // supported, so "Unknown" is the best we can do for now. + /// %r = tensor.extract_slice %t[0]][5][1] + /// : tensor<10xf32> to tensor<5xf32> + /// + /// // aliasingValues(%t1) = MAYBE {Equivalent %r} + /// // aliasingValues(%t2) = MAYBE {Equivalent %r} + /// %r = arith.select %c, %t1, %t2 : tensor<10xf32> + /// + /// // A hypothetical op that bufferizes to rolling a dice and based on + /// // the result to either return buffer(%t) or a newly allocated copy + /// // thereof. + /// // aliasingValues(%t) = MAYBE {Equivalent %r} + /// %r = "dummy.alias_or_copy(%t) : (tensor<10xf32>) -> (tensor<10xf32>)" + /// ``` + ::mlir::bufferization::AliasingValueList getAliasingValues(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state); + /// Return the OpOperands that alias with a given Value when bufferized + /// in-place. This method will never be called on Values that do not + /// have a tensor type. + /// + /// By default, this method is the inverse of `getAliasingValues`. Ops + /// with a region that yield values may want to override this method to + /// return the OpOperands that are yielded by the terminator. + /// + /// This method can return multiple OpOperands, indicating that a given + /// Value may at runtime alias with any (or multiple) of the returned + /// OpOperands. + /// + /// This property is specified with a degree of certainty: + /// + /// * MAYBE (`isDefinite = false`): At runtime, buffer(value) may alias + /// with the specified OpOperand. + /// * DEFINITE (`isDefinite = true`, default): At runtime, + /// buffer(value) is guaranteed to alias the buffer of the specified + /// OpOperand. This is a stronger property than MAYBE and allows for + /// more precise analyses. DEFINITE properties should be used when + /// possible. + /// + /// For each alias, a BufferRelation can be specified: + /// + /// * `BufferRelation::Equivalent`: Both aliases are the exact same + /// buffer. I.e., same size, no offset, same strides. + /// * `BufferRelation::Unknown`: There is no further information apart + /// from the fact that both buffers alias. + /// + /// False positives are allowed in the list of OpOperands, but they can + /// adversely affect the accuracy of the anlysis. On the contrary, + /// omitting potential aliases is incorrect. + /// + /// One possible (conservative) implementation of this interface method, + /// that is always safe, is to return all tensor OpOperands with + /// BufferRelation::Unknown and MAYBE. + /// + /// Note: If the returned list of OpOperands is empty, this op definitely + /// bufferizes to a new allocation. In that case `bufferizesToAllocation` + /// must return `true`. + /// + /// Examples: + /// + /// ``` + /// // aliasingOpOperands(%r) = DEFINITE {Equivalent %t} + /// %r = tensor.insert_slice %f into %t : tensor<10xf32> + /// + /// // aliasingOpOperands(%r) = DEFINITE {Unknown %t} + /// %r = tensor.extract_slice %t[0]][5][1] + /// : tensor<10xf32> to tensor<5xf32> + /// + /// // aliasingOpOperands(%r) = DEFINITE {Equivalent %t1, Equivalent %t2} + /// %r = arith.select %c, %t1, %t2 : tensor<10xf32> + /// + /// // aliasingOpOperands(%r) = MAYBE {} + /// %r = tensor.empty() : tensor<10xf32> + /// ``` + ::mlir::bufferization::AliasingOpOperandList getAliasingOpOperands(::mlir::Value value, const ::mlir::bufferization::AnalysisState & state); + /// Resolve all inplacability conflicts by inserting explicit + /// `bufferization.alloc_tensor` ops. Examples of inplacability conflicts + /// are read-after-write conflicts or writes into non-writable buffers. + /// + /// This method should rewrite the IR in such a way that for each tensor + /// OpOperand t, buffer(t) can be directly used when during bufferization. + /// The bufferization does no longer have to care about inplacability + /// conflicts. + /// + /// This method can query analysis information from the given analysis + /// state. + ::mlir::LogicalResult resolveConflicts(::mlir::RewriterBase & rewriter, const ::mlir::bufferization::AnalysisState & state); + /// Bufferize this op, i.e., rewrite it into a memref-based equivalent. + /// Buffers of tensor SSA values can be retrieved via `getBuffer`. + /// Uses of tensor results of the existing tensor op can be replaced with + /// `replaceOpWithBufferizedValues` or `replaceOpWithNewBufferizedOp`. + /// These two functions automatically handle the tensor-to-memref type + /// conversion. + /// + /// The implementation of this method must be consistent with the + /// remaining methods, in particular `getAliasingOpOperands`. I.e., a + /// tensor result `r` may only be replaced with: + /// + /// a) One of the buffers in getAliasingOpOperands(r). + /// b) Or: A newly allocated buffer (only if `bufferizesToAllocation`). + /// + /// This method will never be called on ops that do not have at least one + /// tensor operand/result. + /// + /// The return value of this method indicates whether there was an error + /// while bufferizing this op (such as failing to create a new buffer + /// allocation op). The bufferization driver immediately stops bufferizing + /// the input IR and returns `failure` in that case. If this op is + /// expected to survive bufferization, `success` should be returned + /// (together with `allow-unknown-ops` enabled). + /// + /// Note: If this op supports unstructured control flow in its regions, + /// then this function should also bufferize all block signatures that + /// belong to this op. Branch ops (that branch to a block) are typically + /// bufferized together with the block signature (this is just a + /// suggestion to make sure IR is valid at every point in time and could + /// be done differently). + ::mlir::LogicalResult bufferize(::mlir::RewriterBase & rewriter, const ::mlir::bufferization::BufferizationOptions & options); + /// Return `true` if the given Value can be written to in-place. Value is + /// either an OpResult of this operation or a BlockArgument of a block of + /// this operation. + /// + /// Most OpResult buffers can be written to, but some ops such as + /// ConstantOp may bufferize to non-writable (read-only) memory locations. + /// Therefore, by default, this method returns `true` for OpResults. This + /// method will never be called on OpResults that do not have a tensor + /// type. + /// + /// Whether a BlockArgument can be written to or not depends on the + /// operation. This method conservatively returns `false`. This method + /// will never be called on BlockArguments that do not have a tensor type. + bool isWritable(::mlir::Value value, const ::mlir::bufferization::AnalysisState & state); + /// Return `true` if the `uRead` and `uWrite` do not constitute a RaW + /// conflict. If they are conflicting or if it is unknown whether they are + /// conflicting, return `false`. This method will never be called with + /// OpOperands that do not have a tensor type. At least one of the two + /// given OpOperands belongs to this operation. + /// + /// This method can be implemented to specify custom RaW analysis rules. + /// If this method returns `true` the given OpOperands are not considered + /// to be conflicting and do not force out-of-place bufferization. (There + /// may still be other conflicts that do.) + bool isNotConflicting(::mlir::OpOperand * uRead, ::mlir::OpOperand * uWrite, const ::mlir::bufferization::AnalysisState & state); + /// Return `failure` if this op does not pass the analysis. This method + /// is run during One-Shot Bufferize (after all post-analysis steps). If + /// the op does not pass the analysis, bufferization is aborted. + /// + /// This method can be used to check expected invariants and limitations + /// of the current bufferization implementation. + ::mlir::LogicalResult verifyAnalysis(const ::mlir::bufferization::AnalysisState & state); + /// Return the bufferized type of the given tensor value (without + /// bufferizing the IR). The value is either a BlockArgument of a block + /// that belongs to this op or an OpResult of the given op. + /// + /// This method is useful when the bufferized type of value must be + /// predicted before modifying any IR. + /// + /// Implementations may call `bufferization::getBufferType` to compute the + /// bufferized type of another SSA value. The same (unmodified) + /// `invocationStack` must be passed to that function. The stack contains + /// all SSA values for which a buffer type computation is currently in + /// progress. Implementations may inspect the stack to detect repetitive + /// computations for the same SSA value. (E.g., when bufferized types of a + /// loop.) + /// + /// Note: This interface method should never be called directly from user + /// code. Always use `bufferization::getBufferType`. + ::mlir::FailureOr<::mlir::BaseMemRefType> getBufferType(::mlir::Value value, const ::mlir::bufferization::BufferizationOptions & options, ::llvm::SmallVector<::mlir::Value> & invocationStack); + /// Return `true` if the given region of this op is repetitive. By default + /// this information is queried from the `RegionBranchOpInterface`. Ops + /// that do not implement this inferface can override this method to + /// declare regions as repetitive. + /// + /// The RaW conflict detection of One-Shot Analysis is more strict inside + /// repetitive regions: Op dominance cannot always be used to rule out + /// certain potential conflicts (e.g., a conflicting write happening after + /// a read), because there may not be a meaningful ordering of certain ops + /// that are executed multiple times. This is described in more detail in + /// documentation of One-Shot Analysis. + bool isRepetitiveRegion(unsigned index); + /// Return `true` if the given region of this op is parallel, i.e., + /// multiple instances of the region may be executing at the same time. + /// If a region is parallel, it must also be marked as "repetitive". + /// + /// The RaW conflict detection of One-Shot Analysis is more strict inside + /// parallel regions: Buffer may have to be privatized. + /// + /// By default, regions are assumed to be sequential. + bool isParallelRegion(unsigned index); + /// Return `true` if the op and this interface implementation supports + /// unstructured control flow. I.e., regions with multiple blocks. This is + /// not supported in most ops, so the default answer is `false`. + bool supportsUnstructuredControlFlow(); + + /// Resolve out-of-place tensor OpOperands with explicit allocations in the + /// form of `bufferization.alloc_tensor` ops. + ::mlir::LogicalResult resolveTensorOpOperandConflicts( + ::mlir::RewriterBase &rewriter, + const ::mlir::bufferization::AnalysisState &state); + + /// Return `true` if the given OpOperand creates an alias but does neither + /// read nor write. This implies that `bufferizesToMemoryRead` and + /// `bufferizesToMemoryWrite` must return `false`. This method will never + /// be called on OpOperands that do not have a tensor type. + /// + /// Examples of such ops are `tensor.extract_slice` and `tensor.cast`. + bool bufferizesToAliasOnly( + ::mlir::OpOperand &opOperand, + const ::mlir::bufferization::AnalysisState &state) { + auto bufferizableOp = + ::llvm::cast<::mlir::bufferization::BufferizableOpInterface>(getOperation()); + return !bufferizableOp.bufferizesToMemoryRead(opOperand, state) + && !bufferizableOp.bufferizesToMemoryWrite(opOperand, state) + && bufferizableOp.getAliasingValues(opOperand, state) + .getNumAliases() != 0; + } +}; +namespace detail { + template + struct BufferizableOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Return `true` if the given Value may bufferize to a new buffer + /// allocation. If it is statically unknown that the given Value + /// bufferizes to a buffer allocation, `true` should be returned. + bool bufferizesToAllocation(::mlir::Value value) { + return false; + } + /// Return `true` if the given OpOperand bufferizes to a memory read. This + /// method will never be called on OpOperands that do not have a tensor + /// type. + /// + /// Note: It is always safe to consider an OpOperand as a memory read, + /// even if it does actually not read; however, this can introduce + /// unnecessary out-of-place bufferization decisions. One-Shot Analysis + /// considers OpOperands of unknown ops (that do not implement this + /// interface) as reading OpOperands. + bool bufferizesToMemoryRead(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + // Does not have to be implemented for ops without tensor OpOperands. + llvm_unreachable("bufferizesToMemoryRead not implemented"); + } + /// Return `true` if the given OpOperand bufferizes to a memory write. + /// + /// This method will never be called on OpOperands that do not have a + /// tensor type. + /// + /// This method will never be called on OpOperands that do not have an + /// aliasing Value. Intuitively, it does not make sense for an OpOperand + /// to bufferize to a memory write without returning an aliasing tensor, + /// because the write would have no visible effect outside of the op. + /// + /// Note: It is always safe to consider an OpOperand as a memory write, + /// even if it does actually not write; however, this can introduce + /// unnecessary out-of-place bufferization decisions. One-Shot Analysis + /// considers OpOperands of unknown ops (that do not implement this + /// interface) as writing OpOperands. + bool bufferizesToMemoryWrite(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + // Does not have to be implemented for ops without tensor OpOperands. + // Does not have to be implemented for OpOperands that do not have an + // aliasing Value. + llvm_unreachable("bufferizesToMemoryWrite not implemented"); + } + /// Return `true` if the operation bufferizes to IR that performs only + /// element-wise accesses on the specified tensor operands. (The operands + /// must have the same shape.) The `bufferize` method must be implemented + /// in such a way that it is free of loop-carried dependences. I.e., all + /// loads at a position appear before all stores at the same position. + /// + /// Example: Consider a hypothetical op element-wise op, where the "ins" + /// bufferize to a memory read and the "outs" bufferize to a memory write. + /// ``` + /// test.element_wise ins(%0), outs(%1) : tensor<3xf32> + /// ``` + /// + /// The following is a valid access pattern: + /// ``` + /// load(%0[1]) + /// store(%1[1]) + /// load(%0[2]) + /// store(%1[2]) + /// load(%0[0]) + /// store(%1[0]) + /// ``` + /// + /// The following would be an invalid (not element-wise) access pattern: + /// ``` + /// load(%0[1]) + /// store(%0[1]) + /// load(%0[1]) + /// ... + /// ``` + /// + /// Element-wise ops can sometimes bufferize more efficiently: a RaW + /// conflict between two operands of the same op can be avoided if it is + /// guaranteed that an original element value is no longer needed after + /// writing a computed element value at the same location. E.g., such an + /// optimization is possible in the above example if %0 and %1 are + /// equivalent tensors. (It is not possible, if %0 and %1 are merely + /// aliasing. It is not necessary if %0 and %1 are not aliasing at all, + /// because there would be no conflict anyway.) + /// + /// Note: Tensor operands that are not included in `opOperands` can be + /// ignored. A conservative implementation of this interface method may + /// always return "false". + bool bufferizesToElementwiseAccess(const ::mlir::bufferization::AnalysisState & state, ArrayRef opOperands) { + // It is always safe to assume that the op is not element-wise. + return false; + } + /// Return `true` if the given OpResult bufferizes to a memory write. + /// This is the same property as `bufferizesToMemoryWrite`, but from The + /// perspective of OpResults. + /// + /// This method will never be called on OpResults that do not have a + /// tensor type. + /// + /// This method has a default implementation. By default, it returns + /// `true` if any of the following three cases applies. + /// + /// 1. There is no corresponding aliasing OpOperand. + /// + /// Example: `tensor.generate ... : tensor<10xf32>` + /// The op fills a newly allocated buffer and bufferizes to a memory + /// write. + /// + /// Counter-example: bufferization.alloc_tensor + /// The op just allocates and does not specifiy the data of the tensor, + /// so resultBufferizesToMemoryWrite is overridden to return false. + /// + /// 2. At least one aliasing OpOperand bufferizes to a memory write. + /// + /// Example: `tensor.insert %f into %t[...] : tensor` + /// The destination OpOperand bufferizes to a memory write, so the + /// result also bufferizes to a memory write. + /// + /// 3. At least one aliasing OpOperand's value is defined inside the + /// defining op of the given OpResult and it is a memory write. + /// + /// According to this rule, an aliasing OpOperand value that is defined + /// inside this op and is bufferizing to a memory write makes the given + /// OpResult bufferize to a memory write. + /// + /// Example: + /// ``` + /// %r = scf.if ... -> tensor { + /// %1 = tensor.insert %f into %t[...] : tensor + /// scf.yield %1 : tensor + /// } else { ... } + /// ``` + /// The scf.if result bufferizes to a memory write because %1 (an + /// OpResult defined inside the scf.if op) bufferizes to a memory + /// write. + bool resultBufferizesToMemoryWrite(::mlir::OpResult opResult, const ::mlir::bufferization::AnalysisState & state) { + assert(opResult.getDefiningOp() == (*static_cast(this)).getOperation() && + "invalid OpResult"); + return ::mlir::bufferization::detail::defaultResultBufferizesToMemoryWrite( + opResult, state); + } + /// Return `true` if the given OpOperand must bufferize in-place. Alias + /// sets and inplace attributes will be set up accordingly before making + /// any other bufferization decisions. This method will never be called on + /// OpOperands that do not have a tensor type. + /// + /// Note: Unranked tensor OpOperands always bufferize in-place. This could + /// be extended in the future. Unranked tensors are used with external + /// functions only. + bool mustBufferizeInPlace(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return ::llvm::isa<::mlir::UnrankedTensorType>(opOperand.get().getType()); + } + /// Return the Values that may alias with a given OpOperand when + /// bufferized in-place. This method will never be called on OpOperands + /// that do not have a tensor type. + /// + /// This method can return multiple Values, indicating that a given + /// OpOperand may at runtime alias with any (or multiple) of the returned + /// Values. + /// + /// Each alias is specified with a degree of certainty: + /// + /// * MAYBE (`isDefinite = false`): At runtime, buffer(opOperand) may + /// alias with the specified Value. + /// * DEFINITE (`isDefinite = true`, default): At runtime, + /// buffer(opOperand) is guaranteed to alias the buffer of the specified + /// Value. This is a stronger property than MAYBE and allows for more + /// precise analyses. DEFINITE properties should be used when possible. + /// + /// Furthermore, each alias is specified with a buffer relation: + /// + /// * `BufferRelation::Equivalent`: Both aliases are the exact same + /// buffer. I.e., same size, no offset, same strides. + /// * `BufferRelation::Unknown`: There is no further information apart + /// from the fact that both buffers alias. + /// + /// False positives are allowed in the list of Values, but they can + /// adversely affect the accuracy of the anlysis. On the contrary, + /// omitting potential aliases is incorrect. + /// + /// One possible (conservative) implementation of this interface method, + /// that is always safe, is to return all tensor Values with + /// BufferRelation::Unknown and MAYBE. + /// + /// Examples: + /// + /// ``` + /// // aliasingValues(%t) = DEFINITE {Equivalent %r} + /// %r = tensor.insert_slice %f into %t : tensor<10xf32> + /// + /// // aliasingValues(%t) = DEFINITE {Unknown %r} + /// // Note: "Buffer is subset of buffer" relationship are not yet + /// // supported, so "Unknown" is the best we can do for now. + /// %r = tensor.extract_slice %t[0]][5][1] + /// : tensor<10xf32> to tensor<5xf32> + /// + /// // aliasingValues(%t1) = MAYBE {Equivalent %r} + /// // aliasingValues(%t2) = MAYBE {Equivalent %r} + /// %r = arith.select %c, %t1, %t2 : tensor<10xf32> + /// + /// // A hypothetical op that bufferizes to rolling a dice and based on + /// // the result to either return buffer(%t) or a newly allocated copy + /// // thereof. + /// // aliasingValues(%t) = MAYBE {Equivalent %r} + /// %r = "dummy.alias_or_copy(%t) : (tensor<10xf32>) -> (tensor<10xf32>)" + /// ``` + ::mlir::bufferization::AliasingValueList getAliasingValues(::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + // Does not have to be implemented for ops without tensor OpOperands. + assert(::llvm::isa<::mlir::TensorType>(opOperand.get().getType()) && + "expected OpOperand with tensor type"); + llvm_unreachable("getAliasingValues not implemented"); + } + /// Return the OpOperands that alias with a given Value when bufferized + /// in-place. This method will never be called on Values that do not + /// have a tensor type. + /// + /// By default, this method is the inverse of `getAliasingValues`. Ops + /// with a region that yield values may want to override this method to + /// return the OpOperands that are yielded by the terminator. + /// + /// This method can return multiple OpOperands, indicating that a given + /// Value may at runtime alias with any (or multiple) of the returned + /// OpOperands. + /// + /// This property is specified with a degree of certainty: + /// + /// * MAYBE (`isDefinite = false`): At runtime, buffer(value) may alias + /// with the specified OpOperand. + /// * DEFINITE (`isDefinite = true`, default): At runtime, + /// buffer(value) is guaranteed to alias the buffer of the specified + /// OpOperand. This is a stronger property than MAYBE and allows for + /// more precise analyses. DEFINITE properties should be used when + /// possible. + /// + /// For each alias, a BufferRelation can be specified: + /// + /// * `BufferRelation::Equivalent`: Both aliases are the exact same + /// buffer. I.e., same size, no offset, same strides. + /// * `BufferRelation::Unknown`: There is no further information apart + /// from the fact that both buffers alias. + /// + /// False positives are allowed in the list of OpOperands, but they can + /// adversely affect the accuracy of the anlysis. On the contrary, + /// omitting potential aliases is incorrect. + /// + /// One possible (conservative) implementation of this interface method, + /// that is always safe, is to return all tensor OpOperands with + /// BufferRelation::Unknown and MAYBE. + /// + /// Note: If the returned list of OpOperands is empty, this op definitely + /// bufferizes to a new allocation. In that case `bufferizesToAllocation` + /// must return `true`. + /// + /// Examples: + /// + /// ``` + /// // aliasingOpOperands(%r) = DEFINITE {Equivalent %t} + /// %r = tensor.insert_slice %f into %t : tensor<10xf32> + /// + /// // aliasingOpOperands(%r) = DEFINITE {Unknown %t} + /// %r = tensor.extract_slice %t[0]][5][1] + /// : tensor<10xf32> to tensor<5xf32> + /// + /// // aliasingOpOperands(%r) = DEFINITE {Equivalent %t1, Equivalent %t2} + /// %r = arith.select %c, %t1, %t2 : tensor<10xf32> + /// + /// // aliasingOpOperands(%r) = MAYBE {} + /// %r = tensor.empty() : tensor<10xf32> + /// ``` + ::mlir::bufferization::AliasingOpOperandList getAliasingOpOperands(::mlir::Value value, const ::mlir::bufferization::AnalysisState & state) { + assert(isa<::mlir::TensorType>(value.getType()) && + "expected tensor type"); + return ::mlir::bufferization::detail::defaultGetAliasingOpOperands( + value, state); + } + /// Resolve all inplacability conflicts by inserting explicit + /// `bufferization.alloc_tensor` ops. Examples of inplacability conflicts + /// are read-after-write conflicts or writes into non-writable buffers. + /// + /// This method should rewrite the IR in such a way that for each tensor + /// OpOperand t, buffer(t) can be directly used when during bufferization. + /// The bufferization does no longer have to care about inplacability + /// conflicts. + /// + /// This method can query analysis information from the given analysis + /// state. + ::mlir::LogicalResult resolveConflicts(::mlir::RewriterBase & rewriter, const ::mlir::bufferization::AnalysisState & state) { + auto bufferizableOp = + ::llvm::cast((*static_cast(this)).getOperation()); + return bufferizableOp.resolveTensorOpOperandConflicts( + rewriter, state); + } + /// Bufferize this op, i.e., rewrite it into a memref-based equivalent. + /// Buffers of tensor SSA values can be retrieved via `getBuffer`. + /// Uses of tensor results of the existing tensor op can be replaced with + /// `replaceOpWithBufferizedValues` or `replaceOpWithNewBufferizedOp`. + /// These two functions automatically handle the tensor-to-memref type + /// conversion. + /// + /// The implementation of this method must be consistent with the + /// remaining methods, in particular `getAliasingOpOperands`. I.e., a + /// tensor result `r` may only be replaced with: + /// + /// a) One of the buffers in getAliasingOpOperands(r). + /// b) Or: A newly allocated buffer (only if `bufferizesToAllocation`). + /// + /// This method will never be called on ops that do not have at least one + /// tensor operand/result. + /// + /// The return value of this method indicates whether there was an error + /// while bufferizing this op (such as failing to create a new buffer + /// allocation op). The bufferization driver immediately stops bufferizing + /// the input IR and returns `failure` in that case. If this op is + /// expected to survive bufferization, `success` should be returned + /// (together with `allow-unknown-ops` enabled). + /// + /// Note: If this op supports unstructured control flow in its regions, + /// then this function should also bufferize all block signatures that + /// belong to this op. Branch ops (that branch to a block) are typically + /// bufferized together with the block signature (this is just a + /// suggestion to make sure IR is valid at every point in time and could + /// be done differently). + ::mlir::LogicalResult bufferize(::mlir::RewriterBase & rewriter, const ::mlir::bufferization::BufferizationOptions & options) { + llvm_unreachable("bufferize not implemented"); + return ::mlir::failure(); + } + /// Return `true` if the given Value can be written to in-place. Value is + /// either an OpResult of this operation or a BlockArgument of a block of + /// this operation. + /// + /// Most OpResult buffers can be written to, but some ops such as + /// ConstantOp may bufferize to non-writable (read-only) memory locations. + /// Therefore, by default, this method returns `true` for OpResults. This + /// method will never be called on OpResults that do not have a tensor + /// type. + /// + /// Whether a BlockArgument can be written to or not depends on the + /// operation. This method conservatively returns `false`. This method + /// will never be called on BlockArguments that do not have a tensor type. + bool isWritable(::mlir::Value value, const ::mlir::bufferization::AnalysisState & state) { + return ::llvm::isa<::mlir::OpResult>(value); + } + /// Return `true` if the `uRead` and `uWrite` do not constitute a RaW + /// conflict. If they are conflicting or if it is unknown whether they are + /// conflicting, return `false`. This method will never be called with + /// OpOperands that do not have a tensor type. At least one of the two + /// given OpOperands belongs to this operation. + /// + /// This method can be implemented to specify custom RaW analysis rules. + /// If this method returns `true` the given OpOperands are not considered + /// to be conflicting and do not force out-of-place bufferization. (There + /// may still be other conflicts that do.) + bool isNotConflicting(::mlir::OpOperand * uRead, ::mlir::OpOperand * uWrite, const ::mlir::bufferization::AnalysisState & state) { + return false; + } + /// Return `failure` if this op does not pass the analysis. This method + /// is run during One-Shot Bufferize (after all post-analysis steps). If + /// the op does not pass the analysis, bufferization is aborted. + /// + /// This method can be used to check expected invariants and limitations + /// of the current bufferization implementation. + ::mlir::LogicalResult verifyAnalysis(const ::mlir::bufferization::AnalysisState & state) { + return ::mlir::success(); + } + /// Return the bufferized type of the given tensor value (without + /// bufferizing the IR). The value is either a BlockArgument of a block + /// that belongs to this op or an OpResult of the given op. + /// + /// This method is useful when the bufferized type of value must be + /// predicted before modifying any IR. + /// + /// Implementations may call `bufferization::getBufferType` to compute the + /// bufferized type of another SSA value. The same (unmodified) + /// `invocationStack` must be passed to that function. The stack contains + /// all SSA values for which a buffer type computation is currently in + /// progress. Implementations may inspect the stack to detect repetitive + /// computations for the same SSA value. (E.g., when bufferized types of a + /// loop.) + /// + /// Note: This interface method should never be called directly from user + /// code. Always use `bufferization::getBufferType`. + ::mlir::FailureOr<::mlir::BaseMemRefType> getBufferType(::mlir::Value value, const ::mlir::bufferization::BufferizationOptions & options, ::llvm::SmallVector<::mlir::Value> & invocationStack) { + assert(getOwnerOfValue(value) == (*static_cast(this)).getOperation() && + "expected that value belongs to this op"); + assert(invocationStack.back() == value && + "inconsistant invocation stack"); + return ::mlir::bufferization::detail::defaultGetBufferType( + value, options, invocationStack); + } + /// Return `true` if the given region of this op is repetitive. By default + /// this information is queried from the `RegionBranchOpInterface`. Ops + /// that do not implement this inferface can override this method to + /// declare regions as repetitive. + /// + /// The RaW conflict detection of One-Shot Analysis is more strict inside + /// repetitive regions: Op dominance cannot always be used to rule out + /// certain potential conflicts (e.g., a conflicting write happening after + /// a read), because there may not be a meaningful ordering of certain ops + /// that are executed multiple times. This is described in more detail in + /// documentation of One-Shot Analysis. + bool isRepetitiveRegion(unsigned index) { + return ::mlir::bufferization::detail::defaultIsRepetitiveRegion( + ::llvm::cast((*static_cast(this)).getOperation()), index); + } + /// Return `true` if the given region of this op is parallel, i.e., + /// multiple instances of the region may be executing at the same time. + /// If a region is parallel, it must also be marked as "repetitive". + /// + /// The RaW conflict detection of One-Shot Analysis is more strict inside + /// parallel regions: Buffer may have to be privatized. + /// + /// By default, regions are assumed to be sequential. + bool isParallelRegion(unsigned index) { + return false; + } + /// Return `true` if the op and this interface implementation supports + /// unstructured control flow. I.e., regions with multiple blocks. This is + /// not supported in most ops, so the default answer is `false`. + static bool supportsUnstructuredControlFlow() { + return false; + } + }; +}// namespace detail +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::bufferizesToAllocation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value) { + return (llvm::cast(tablegen_opaque_val)).bufferizesToAllocation(value); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::bufferizesToMemoryRead(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).bufferizesToMemoryRead(opOperand, state); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::bufferizesToMemoryWrite(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).bufferizesToMemoryWrite(opOperand, state); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::bufferizesToElementwiseAccess(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState & state, ArrayRef opOperands) { + return (llvm::cast(tablegen_opaque_val)).bufferizesToElementwiseAccess(state, opOperands); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::resultBufferizesToMemoryWrite(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpResult opResult, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).resultBufferizesToMemoryWrite(opResult, state); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::mustBufferizeInPlace(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).mustBufferizeInPlace(opOperand, state); +} +template +::mlir::bufferization::AliasingValueList detail::BufferizableOpInterfaceInterfaceTraits::Model::getAliasingValues(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).getAliasingValues(opOperand, state); +} +template +::mlir::bufferization::AliasingOpOperandList detail::BufferizableOpInterfaceInterfaceTraits::Model::getAliasingOpOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).getAliasingOpOperands(value, state); +} +template +::mlir::LogicalResult detail::BufferizableOpInterfaceInterfaceTraits::Model::resolveConflicts(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).resolveConflicts(rewriter, state); +} +template +::mlir::LogicalResult detail::BufferizableOpInterfaceInterfaceTraits::Model::bufferize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, const ::mlir::bufferization::BufferizationOptions & options) { + return (llvm::cast(tablegen_opaque_val)).bufferize(rewriter, options); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::isWritable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).isWritable(value, state); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::isNotConflicting(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand * uRead, ::mlir::OpOperand * uWrite, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).isNotConflicting(uRead, uWrite, state); +} +template +::mlir::LogicalResult detail::BufferizableOpInterfaceInterfaceTraits::Model::verifyAnalysis(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState & state) { + return (llvm::cast(tablegen_opaque_val)).verifyAnalysis(state); +} +template +::mlir::FailureOr<::mlir::BaseMemRefType> detail::BufferizableOpInterfaceInterfaceTraits::Model::getBufferType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::BufferizationOptions & options, ::llvm::SmallVector<::mlir::Value> & invocationStack) { + return (llvm::cast(tablegen_opaque_val)).getBufferType(value, options, invocationStack); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::isRepetitiveRegion(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned index) { + return (llvm::cast(tablegen_opaque_val)).isRepetitiveRegion(index); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::isParallelRegion(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned index) { + return (llvm::cast(tablegen_opaque_val)).isParallelRegion(index); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::Model::supportsUnstructuredControlFlow() { + return ConcreteOp::supportsUnstructuredControlFlow(); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::bufferizesToAllocation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value) { + return static_cast(impl)->bufferizesToAllocation(tablegen_opaque_val, value); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::bufferizesToMemoryRead(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->bufferizesToMemoryRead(tablegen_opaque_val, opOperand, state); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::bufferizesToMemoryWrite(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->bufferizesToMemoryWrite(tablegen_opaque_val, opOperand, state); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::bufferizesToElementwiseAccess(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState & state, ArrayRef opOperands) { + return static_cast(impl)->bufferizesToElementwiseAccess(tablegen_opaque_val, state, opOperands); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::resultBufferizesToMemoryWrite(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpResult opResult, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->resultBufferizesToMemoryWrite(tablegen_opaque_val, opResult, state); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::mustBufferizeInPlace(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->mustBufferizeInPlace(tablegen_opaque_val, opOperand, state); +} +template +::mlir::bufferization::AliasingValueList detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::getAliasingValues(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand & opOperand, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->getAliasingValues(tablegen_opaque_val, opOperand, state); +} +template +::mlir::bufferization::AliasingOpOperandList detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::getAliasingOpOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->getAliasingOpOperands(tablegen_opaque_val, value, state); +} +template +::mlir::LogicalResult detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::resolveConflicts(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->resolveConflicts(tablegen_opaque_val, rewriter, state); +} +template +::mlir::LogicalResult detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::bufferize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, const ::mlir::bufferization::BufferizationOptions & options) { + return static_cast(impl)->bufferize(tablegen_opaque_val, rewriter, options); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::isWritable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->isWritable(tablegen_opaque_val, value, state); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::isNotConflicting(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand * uRead, ::mlir::OpOperand * uWrite, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->isNotConflicting(tablegen_opaque_val, uRead, uWrite, state); +} +template +::mlir::LogicalResult detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::verifyAnalysis(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState & state) { + return static_cast(impl)->verifyAnalysis(tablegen_opaque_val, state); +} +template +::mlir::FailureOr<::mlir::BaseMemRefType> detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::getBufferType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::BufferizationOptions & options, ::llvm::SmallVector<::mlir::Value> & invocationStack) { + return static_cast(impl)->getBufferType(tablegen_opaque_val, value, options, invocationStack); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::isRepetitiveRegion(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned index) { + return static_cast(impl)->isRepetitiveRegion(tablegen_opaque_val, index); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::isParallelRegion(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned index) { + return static_cast(impl)->isParallelRegion(tablegen_opaque_val, index); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel::supportsUnstructuredControlFlow() { + return ConcreteOp::supportsUnstructuredControlFlow(); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::bufferizesToAllocation(::mlir::Operation *tablegen_opaque_val, ::mlir::Value value) const { +return false; +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::bufferizesToMemoryRead(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand &opOperand, const ::mlir::bufferization::AnalysisState &state) const { +// Does not have to be implemented for ops without tensor OpOperands. + llvm_unreachable("bufferizesToMemoryRead not implemented"); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::bufferizesToMemoryWrite(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand &opOperand, const ::mlir::bufferization::AnalysisState &state) const { +// Does not have to be implemented for ops without tensor OpOperands. + // Does not have to be implemented for OpOperands that do not have an + // aliasing Value. + llvm_unreachable("bufferizesToMemoryWrite not implemented"); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::bufferizesToElementwiseAccess(::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState &state, ArrayRef opOperands) const { +// It is always safe to assume that the op is not element-wise. + return false; +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::resultBufferizesToMemoryWrite(::mlir::Operation *tablegen_opaque_val, ::mlir::OpResult opResult, const ::mlir::bufferization::AnalysisState &state) const { +assert(opResult.getDefiningOp() == (llvm::cast(tablegen_opaque_val)).getOperation() && + "invalid OpResult"); + return ::mlir::bufferization::detail::defaultResultBufferizesToMemoryWrite( + opResult, state); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::mustBufferizeInPlace(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand &opOperand, const ::mlir::bufferization::AnalysisState &state) const { +return ::llvm::isa<::mlir::UnrankedTensorType>(opOperand.get().getType()); +} +template +::mlir::bufferization::AliasingValueList detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::getAliasingValues(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand &opOperand, const ::mlir::bufferization::AnalysisState &state) const { +// Does not have to be implemented for ops without tensor OpOperands. + assert(::llvm::isa<::mlir::TensorType>(opOperand.get().getType()) && + "expected OpOperand with tensor type"); + llvm_unreachable("getAliasingValues not implemented"); +} +template +::mlir::bufferization::AliasingOpOperandList detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::getAliasingOpOperands(::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState &state) const { +assert(isa<::mlir::TensorType>(value.getType()) && + "expected tensor type"); + return ::mlir::bufferization::detail::defaultGetAliasingOpOperands( + value, state); +} +template +::mlir::LogicalResult detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::resolveConflicts(::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase &rewriter, const ::mlir::bufferization::AnalysisState &state) const { +auto bufferizableOp = + ::llvm::cast((llvm::cast(tablegen_opaque_val)).getOperation()); + return bufferizableOp.resolveTensorOpOperandConflicts( + rewriter, state); +} +template +::mlir::LogicalResult detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::bufferize(::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase &rewriter, const ::mlir::bufferization::BufferizationOptions &options) const { +llvm_unreachable("bufferize not implemented"); + return ::mlir::failure(); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::isWritable(::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::AnalysisState &state) const { +return ::llvm::isa<::mlir::OpResult>(value); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::isNotConflicting(::mlir::Operation *tablegen_opaque_val, ::mlir::OpOperand *uRead, ::mlir::OpOperand *uWrite, const ::mlir::bufferization::AnalysisState &state) const { +return false; +} +template +::mlir::LogicalResult detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::verifyAnalysis(::mlir::Operation *tablegen_opaque_val, const ::mlir::bufferization::AnalysisState &state) const { +return ::mlir::success(); +} +template +::mlir::FailureOr<::mlir::BaseMemRefType> detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::getBufferType(::mlir::Operation *tablegen_opaque_val, ::mlir::Value value, const ::mlir::bufferization::BufferizationOptions &options, ::llvm::SmallVector<::mlir::Value> &invocationStack) const { +assert(getOwnerOfValue(value) == (llvm::cast(tablegen_opaque_val)).getOperation() && + "expected that value belongs to this op"); + assert(invocationStack.back() == value && + "inconsistant invocation stack"); + return ::mlir::bufferization::detail::defaultGetBufferType( + value, options, invocationStack); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::isRepetitiveRegion(::mlir::Operation *tablegen_opaque_val, unsigned index) const { +return ::mlir::bufferization::detail::defaultIsRepetitiveRegion( + ::llvm::cast((llvm::cast(tablegen_opaque_val)).getOperation()), index); +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::isParallelRegion(::mlir::Operation *tablegen_opaque_val, unsigned index) const { +return false; +} +template +bool detail::BufferizableOpInterfaceInterfaceTraits::ExternalModel::supportsUnstructuredControlFlow() { +return false; +} +} // namespace bufferization +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h new file mode 100644 index 0000000000000000000000000000000000000000..16bb0d87fb6fe797611ef346379d26cbb5e838d3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h @@ -0,0 +1,72 @@ +//===- Bufferization.h - Bufferization dialect ------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_IR_BUFFERIZATION_H_ +#define MLIR_DIALECT_BUFFERIZATION_IR_BUFFERIZATION_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/Bufferization/IR/AllocationOpInterface.h" +#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h" +#include "mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.h" +#include "mlir/Interfaces/CopyOpInterface.h" +#include "mlir/Interfaces/DestinationStyleOpInterface.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" + +//===----------------------------------------------------------------------===// +// Bufferization Dialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.h.inc" + +//===----------------------------------------------------------------------===// +// Bufferization Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/Bufferization/IR/BufferizationOps.h.inc" + +//===----------------------------------------------------------------------===// +// Helper functions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace bufferization { +/// Populate `dynamicDims` with tensor::DimOp / memref::DimOp results for all +/// dynamic dimensions of the given shaped value. +void populateDynamicDimSizes(OpBuilder &b, Location loc, Value shapedValue, + SmallVector &dynamicDims); + +/// Try to cast the given ranked MemRef-typed value to the given ranked MemRef +/// type. Insert a reallocation + copy if it cannot be statically guaranteed +/// that a direct cast would be valid. +/// +/// E.g., when casting from a ranked MemRef type with dynamic layout to a ranked +/// MemRef type with static layout, it is not statically known whether the cast +/// will succeed or not. Such `memref.cast` ops may fail at runtime. This +/// function never generates such casts and conservatively inserts a copy. +/// +/// This function returns `failure()` in case of unsupported casts. E.g., casts +/// with differing element types or memory spaces. +FailureOr castOrReallocMemRefValue(OpBuilder &b, Value value, + MemRefType type); + +/// Try to fold to_memref(to_tensor(x)). If x's type and the result type of the +/// to_memref op are different, a memref.cast is needed. +LogicalResult foldToMemrefToTensorPair(RewriterBase &rewriter, + ToMemrefOp toMemref); + +/// Add the canonicalization patterns for bufferization.dealloc to the given +/// pattern set to make them available to other passes (such as +/// BufferDeallocationSimplification). +void populateDeallocOpCanonicalizationPatterns(RewritePatternSet &patterns, + MLIRContext *context); + +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_IR_BUFFERIZATION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..55a74362cb9d0d9ff4becfa36cc890704df52d17 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationEnums.cpp.inc @@ -0,0 +1,50 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: BufferizationEnums.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace bufferization { +::llvm::StringRef stringifyLayoutMapOption(LayoutMapOption val) { + switch (val) { + case LayoutMapOption::InferLayoutMap: return "InferLayoutMap"; + case LayoutMapOption::IdentityLayoutMap: return "IdentityLayoutMap"; + case LayoutMapOption::FullyDynamicLayoutMap: return "FullyDynamicLayoutMap"; + } + return ""; +} + +::std::optional symbolizeLayoutMapOption(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("InferLayoutMap", LayoutMapOption::InferLayoutMap) + .Case("IdentityLayoutMap", LayoutMapOption::IdentityLayoutMap) + .Case("FullyDynamicLayoutMap", LayoutMapOption::FullyDynamicLayoutMap) + .Default(::std::nullopt); +} +::std::optional symbolizeLayoutMapOption(uint32_t value) { + switch (value) { + case 0: return LayoutMapOption::InferLayoutMap; + case 1: return LayoutMapOption::IdentityLayoutMap; + case 2: return LayoutMapOption::FullyDynamicLayoutMap; + default: return ::std::nullopt; + } +} + +bool LayoutMapOptionAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2))); +} +LayoutMapOptionAttr LayoutMapOptionAttr::get(::mlir::MLIRContext *context, LayoutMapOption val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 32); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +LayoutMapOption LayoutMapOptionAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace bufferization +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..56c23ef54e20abafb97900d670b21dc5bb3c9814 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationEnums.h.inc @@ -0,0 +1,100 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: BufferizationEnums.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace bufferization { +// option for map layout +enum class LayoutMapOption : uint32_t { + InferLayoutMap = 0, + IdentityLayoutMap = 1, + FullyDynamicLayoutMap = 2, +}; + +::std::optional symbolizeLayoutMapOption(uint32_t); +::llvm::StringRef stringifyLayoutMapOption(LayoutMapOption); +::std::optional symbolizeLayoutMapOption(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForLayoutMapOption() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(LayoutMapOption enumValue) { + return stringifyLayoutMapOption(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeLayoutMapOption(str); +} + +class LayoutMapOptionAttr : public ::mlir::IntegerAttr { +public: + using ValueType = LayoutMapOption; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static LayoutMapOptionAttr get(::mlir::MLIRContext *context, LayoutMapOption val); + LayoutMapOption getValue() const; +}; +} // namespace bufferization +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::bufferization::LayoutMapOption, ::mlir::bufferization::LayoutMapOption> { + template + static FailureOr<::mlir::bufferization::LayoutMapOption> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for option for map layout"); + + // Symbolize the keyword. + if (::std::optional<::mlir::bufferization::LayoutMapOption> attr = ::mlir::bufferization::symbolizeEnum<::mlir::bufferization::LayoutMapOption>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid option for map layout specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::bufferization::LayoutMapOption value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::bufferization::LayoutMapOption> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::bufferization::LayoutMapOption getEmptyKey() { + return static_cast<::mlir::bufferization::LayoutMapOption>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::bufferization::LayoutMapOption getTombstoneKey() { + return static_cast<::mlir::bufferization::LayoutMapOption>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::bufferization::LayoutMapOption &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::bufferization::LayoutMapOption &lhs, const ::mlir::bufferization::LayoutMapOption &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..7de2fe00c1cea5867d71fc9f154960c825b03d59 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc @@ -0,0 +1,2616 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: BufferizationOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::bufferization::AllocTensorOp, +::mlir::bufferization::CloneOp, +::mlir::bufferization::DeallocOp, +::mlir::bufferization::DeallocTensorOp, +::mlir::bufferization::MaterializeInDestinationOp, +::mlir::bufferization::ToMemrefOp, +::mlir::bufferization::ToTensorOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace bufferization { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_BufferizationOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_BufferizationOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be tensor of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_BufferizationOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::BaseMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be ranked or unranked memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_BufferizationOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_BufferizationOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::ShapedType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be shaped of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_BufferizationOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((true))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_BufferizationOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_BufferizationOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_BufferizationOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_BufferizationOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_BufferizationOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::AllocTensorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AllocTensorOpGenericAdaptorBase::AllocTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("bufferization.alloc_tensor", odsAttrs.getContext()); +} + +AllocTensorOpGenericAdaptorBase::AllocTensorOpGenericAdaptorBase(AllocTensorOp op) : AllocTensorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AllocTensorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr AllocTensorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Attribute AllocTensorOpGenericAdaptorBase::getMemorySpaceAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().memory_space); + return attr; +} + +::std::optional<::mlir::Attribute> AllocTensorOpGenericAdaptorBase::getMemorySpace() { + auto attr = getMemorySpaceAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +} // namespace detail +AllocTensorOpAdaptor::AllocTensorOpAdaptor(AllocTensorOp op) : AllocTensorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AllocTensorOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_memory_space = getProperties().memory_space; (void)tblgen_memory_space; + + if (tblgen_memory_space && !((true))) + return emitError(loc, "'bufferization.alloc_tensor' op ""attribute 'memory_space' failed to satisfy constraint: any attribute"); + return ::mlir::success(); +} + +std::pair AllocTensorOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range AllocTensorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AllocTensorOp::getDynamicSizes() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::TensorType> AllocTensorOp::getCopy() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::TensorType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IndexType> AllocTensorOp::getSizeHint() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::TypedValue<::mlir::IndexType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*operands.begin()); +} + +::mlir::MutableOperandRange AllocTensorOp::getDynamicSizesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AllocTensorOp::getCopyMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AllocTensorOp::getSizeHintMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair AllocTensorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AllocTensorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::TensorType> AllocTensorOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AllocTensorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.memory_space; + auto attr = dict.get("memory_space"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for memory_space in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `memory_space` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute AllocTensorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.memory_space; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("memory_space", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AllocTensorOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.memory_space.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional AllocTensorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "memory_space") + return prop.memory_space; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void AllocTensorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "memory_space") { + prop.memory_space = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void AllocTensorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.memory_space) attrs.append("memory_space", prop.memory_space); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult AllocTensorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMemorySpaceAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps0(attr, "memory_space", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocTensorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.memory_space))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void AllocTensorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.memory_space); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::Attribute AllocTensorOp::getMemorySpaceAttr() { + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().memory_space); +} + +::std::optional<::mlir::Attribute> AllocTensorOp::getMemorySpace() { + auto attr = getMemorySpaceAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +void AllocTensorOp::setMemorySpaceAttr(::mlir::Attribute attr) { + (*this)->setAttr(getMemorySpaceAttrName(), attr); +} + +::mlir::Attribute AllocTensorOp::removeMemorySpaceAttr() { + auto &attr = getProperties().memory_space; + attr = {}; + return attr; +} + +void AllocTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange dynamic_sizes, /*optional*/::mlir::Value copy, /*optional*/::mlir::Value size_hint, /*optional*/::mlir::Attribute memory_space) { + odsState.addOperands(dynamic_sizes); + if (copy) + odsState.addOperands(copy); + if (size_hint) + odsState.addOperands(size_hint); + ::llvm::copy(::llvm::ArrayRef({static_cast(dynamic_sizes.size()), (copy ? 1 : 0), (size_hint ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (memory_space) { + odsState.getOrAddProperties().memory_space = memory_space; + } + odsState.addTypes(result); +} + +void AllocTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamic_sizes, /*optional*/::mlir::Value copy, /*optional*/::mlir::Value size_hint, /*optional*/::mlir::Attribute memory_space) { + odsState.addOperands(dynamic_sizes); + if (copy) + odsState.addOperands(copy); + if (size_hint) + odsState.addOperands(size_hint); + ::llvm::copy(::llvm::ArrayRef({static_cast(dynamic_sizes.size()), (copy ? 1 : 0), (size_hint ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (memory_space) { + odsState.getOrAddProperties().memory_space = memory_space; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AllocTensorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AllocTensorOp::verifyInvariantsImpl() { + auto tblgen_memory_space = getProperties().memory_space; (void)tblgen_memory_space; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps0(*this, tblgen_memory_space, "memory_space"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocTensorOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace bufferization +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::bufferization::AllocTensorOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::CloneOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CloneOpGenericAdaptorBase::CloneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("bufferization.clone", odsAttrs.getContext()); +} + +CloneOpGenericAdaptorBase::CloneOpGenericAdaptorBase(CloneOp op) : CloneOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CloneOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CloneOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CloneOpAdaptor::CloneOpAdaptor(CloneOp op) : CloneOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CloneOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CloneOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CloneOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> CloneOp::getInput() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CloneOp::getInputMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CloneOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CloneOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> CloneOp::getOutput() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSResults(0).begin()); +} + +void CloneOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value) { + return build(odsBuilder, odsState, value.getType(), value); + +} + +void CloneOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input) { + odsState.addOperands(input); + odsState.addTypes(output); +} + +void CloneOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) { + odsState.addOperands(input); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CloneOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CloneOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CloneOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CloneOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(inputRawOperands); ::llvm::SMLoc inputOperandsLoc; + (void)inputOperandsLoc; + ::mlir::Type inputRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inputTypes(inputRawTypes); + ::mlir::Type outputRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outputTypes(outputRawTypes); + + inputOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inputRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outputRawTypes[0] = type; + } + result.addTypes(outputTypes); + if (parser.resolveOperands(inputOperands, inputTypes, inputOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CloneOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getInput(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getInput().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOutput().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CloneOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSResults(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSResults(0)) + effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace bufferization +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::bufferization::CloneOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::DeallocOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeallocOpGenericAdaptorBase::DeallocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("bufferization.dealloc", odsAttrs.getContext()); +} + +DeallocOpGenericAdaptorBase::DeallocOpGenericAdaptorBase(DeallocOp op) : DeallocOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeallocOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DeallocOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DeallocOpAdaptor::DeallocOpAdaptor(DeallocOp op) : DeallocOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeallocOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DeallocOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DeallocOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DeallocOp::getMemrefs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DeallocOp::getConditions() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range DeallocOp::getRetained() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange DeallocOp::getMemrefsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DeallocOp::getConditionsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DeallocOp::getRetainedMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DeallocOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DeallocOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DeallocOp::getUpdatedConditions() { + return getODSResults(0); +} + +::mlir::LogicalResult DeallocOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DeallocOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DeallocOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DeallocOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DeallocOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DeallocOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DeallocOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult DeallocOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DeallocOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void DeallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange updatedConditions, ::mlir::ValueRange memrefs, ::mlir::ValueRange conditions, ::mlir::ValueRange retained) { + odsState.addOperands(memrefs); + odsState.addOperands(conditions); + odsState.addOperands(retained); + ::llvm::copy(::llvm::ArrayRef({static_cast(memrefs.size()), static_cast(conditions.size()), static_cast(retained.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.addTypes(updatedConditions); +} + +void DeallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange memrefs, ::mlir::ValueRange conditions, ::mlir::ValueRange retained) { + odsState.addOperands(memrefs); + odsState.addOperands(conditions); + odsState.addOperands(retained); + ::llvm::copy(::llvm::ArrayRef({static_cast(memrefs.size()), static_cast(conditions.size()), static_cast(retained.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DeallocOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DeallocOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +void DeallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DeallocOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult DeallocOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeallocOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DeallocOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> memrefsOperands; + ::llvm::SMLoc memrefsOperandsLoc; + (void)memrefsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> memrefsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> conditionsOperands; + ::llvm::SMLoc conditionsOperandsLoc; + (void)conditionsOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> retainedOperands; + ::llvm::SMLoc retainedOperandsLoc; + (void)retainedOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> retainedTypes; + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + memrefsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(memrefsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(memrefsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseKeyword("if")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + conditionsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(conditionsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + if (::mlir::succeeded(parser.parseOptionalKeyword("retain"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + retainedOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(retainedOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(retainedTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(memrefsOperands.size()), static_cast(conditionsOperands.size()), static_cast(retainedOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(memrefsOperands, memrefsTypes, memrefsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(conditionsOperands, odsBuildableType0, conditionsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(retainedOperands, retainedTypes, retainedOperandsLoc, result.operands)) + return ::mlir::failure(); + + ::llvm::SmallVector<::mlir::Type> inferredReturnTypes; + if (::mlir::failed(DeallocOp::inferReturnTypes(parser.getContext(), + result.location, result.operands, + result.attributes.getDictionary(parser.getContext()), + result.getRawProperties(), + result.regions, inferredReturnTypes))) + return ::mlir::failure(); + result.addTypes(inferredReturnTypes); + return ::mlir::success(); +} + +void DeallocOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (!getMemrefs().empty()) { + _odsPrinter << ' '; + _odsPrinter << "("; + _odsPrinter << getMemrefs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getMemrefs().getTypes(); + _odsPrinter << ")"; + _odsPrinter << ' ' << "if"; + _odsPrinter << ' '; + _odsPrinter << "("; + _odsPrinter << getConditions(); + _odsPrinter << ")"; + } + if (!getRetained().empty()) { + _odsPrinter << ' ' << "retain"; + _odsPrinter << ' '; + _odsPrinter << "("; + _odsPrinter << getRetained(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getRetained().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace bufferization +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::bufferization::DeallocOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::DeallocTensorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeallocTensorOpGenericAdaptorBase::DeallocTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("bufferization.dealloc_tensor", odsAttrs.getContext()); +} + +DeallocTensorOpGenericAdaptorBase::DeallocTensorOpGenericAdaptorBase(DeallocTensorOp op) : DeallocTensorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeallocTensorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DeallocTensorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DeallocTensorOpAdaptor::DeallocTensorOpAdaptor(DeallocTensorOp op) : DeallocTensorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeallocTensorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DeallocTensorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DeallocTensorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::TensorType> DeallocTensorOp::getTensor() { + return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &DeallocTensorOp::getTensorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair DeallocTensorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeallocTensorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void DeallocTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor) { + odsState.addOperands(tensor); +} + +void DeallocTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor) { + odsState.addOperands(tensor); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeallocTensorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DeallocTensorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeallocTensorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DeallocTensorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tensorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tensorOperands(tensorRawOperands); ::llvm::SMLoc tensorOperandsLoc; + (void)tensorOperandsLoc; + ::mlir::Type tensorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tensorTypes(tensorRawTypes); + + tensorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tensorRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::TensorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tensorRawTypes[0] = type; + } + if (parser.resolveOperands(tensorOperands, tensorTypes, tensorOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeallocTensorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTensor(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getTensor().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::TensorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace bufferization +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::bufferization::DeallocTensorOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::MaterializeInDestinationOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaterializeInDestinationOpGenericAdaptorBase::MaterializeInDestinationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("bufferization.materialize_in_destination", odsAttrs.getContext()); +} + +MaterializeInDestinationOpGenericAdaptorBase::MaterializeInDestinationOpGenericAdaptorBase(MaterializeInDestinationOp op) : MaterializeInDestinationOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaterializeInDestinationOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaterializeInDestinationOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr MaterializeInDestinationOpGenericAdaptorBase::getRestrictAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().restrict); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool MaterializeInDestinationOpGenericAdaptorBase::getRestrict() { + auto attr = getRestrictAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr MaterializeInDestinationOpGenericAdaptorBase::getWritableAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().writable); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool MaterializeInDestinationOpGenericAdaptorBase::getWritable() { + auto attr = getWritableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +MaterializeInDestinationOpAdaptor::MaterializeInDestinationOpAdaptor(MaterializeInDestinationOp op) : MaterializeInDestinationOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaterializeInDestinationOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_restrict = getProperties().restrict; (void)tblgen_restrict; + auto tblgen_writable = getProperties().writable; (void)tblgen_writable; + + if (tblgen_restrict && !((::llvm::isa<::mlir::UnitAttr>(tblgen_restrict)))) + return emitError(loc, "'bufferization.materialize_in_destination' op ""attribute 'restrict' failed to satisfy constraint: unit attribute"); + + if (tblgen_writable && !((::llvm::isa<::mlir::UnitAttr>(tblgen_writable)))) + return emitError(loc, "'bufferization.materialize_in_destination' op ""attribute 'writable' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair MaterializeInDestinationOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaterializeInDestinationOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::TensorType> MaterializeInDestinationOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ShapedType> MaterializeInDestinationOp::getDest() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MaterializeInDestinationOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaterializeInDestinationOp::getDestMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaterializeInDestinationOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MaterializeInDestinationOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::TensorType> MaterializeInDestinationOp::getResult() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::TypedValue<::mlir::TensorType>() : ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(*results.begin()); +} + +::mlir::LogicalResult MaterializeInDestinationOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.restrict; + auto attr = dict.get("restrict"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for restrict in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `restrict` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.writable; + auto attr = dict.get("writable"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for writable in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `writable` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MaterializeInDestinationOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.restrict; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("restrict", + propStorage)); + } + + { + const auto &propStorage = prop.writable; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("writable", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MaterializeInDestinationOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.restrict.getAsOpaquePointer()), + llvm::hash_value(prop.writable.getAsOpaquePointer())); +} + +std::optional MaterializeInDestinationOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "restrict") + return prop.restrict; + + if (name == "writable") + return prop.writable; + return std::nullopt; +} + +void MaterializeInDestinationOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "restrict") { + prop.restrict = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "writable") { + prop.writable = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MaterializeInDestinationOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.restrict) attrs.append("restrict", prop.restrict); + + if (prop.writable) attrs.append("writable", prop.writable); +} + +::mlir::LogicalResult MaterializeInDestinationOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getRestrictAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(attr, "restrict", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWritableAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(attr, "writable", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaterializeInDestinationOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.restrict))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.writable))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaterializeInDestinationOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.restrict); + + writer.writeOptionalAttribute(prop.writable); +} + +::mlir::UnitAttr MaterializeInDestinationOp::getRestrictAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().restrict); +} + +bool MaterializeInDestinationOp::getRestrict() { + auto attr = getRestrictAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr MaterializeInDestinationOp::getWritableAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().writable); +} + +bool MaterializeInDestinationOp::getWritable() { + auto attr = getWritableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void MaterializeInDestinationOp::setRestrictAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getRestrictAttrName(), attr); +} + +void MaterializeInDestinationOp::setRestrict(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getRestrictAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getRestrictAttrName()); +} + +void MaterializeInDestinationOp::setWritableAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWritableAttrName(), attr); +} + +void MaterializeInDestinationOp::setWritable(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWritableAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWritableAttrName()); +} + +::mlir::Attribute MaterializeInDestinationOp::removeRestrictAttr() { + auto &attr = getProperties().restrict; + attr = {}; + return attr; +} + +::mlir::Attribute MaterializeInDestinationOp::removeWritableAttr() { + auto &attr = getProperties().writable; + attr = {}; + return attr; +} + +void MaterializeInDestinationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, ::mlir::Value source, ::mlir::Value dest, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable) { + odsState.addOperands(source); + odsState.addOperands(dest); + if (restrict) { + odsState.getOrAddProperties().restrict = restrict; + } + if (writable) { + odsState.getOrAddProperties().writable = writable; + } + if (result) + odsState.addTypes(result); +} + +void MaterializeInDestinationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value dest, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable) { + odsState.addOperands(source); + odsState.addOperands(dest); + if (restrict) { + odsState.getOrAddProperties().restrict = restrict; + } + if (writable) { + odsState.getOrAddProperties().writable = writable; + } + odsState.addTypes(resultTypes); +} + +void MaterializeInDestinationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, ::mlir::Value source, ::mlir::Value dest, /*optional*/bool restrict, /*optional*/bool writable) { + odsState.addOperands(source); + odsState.addOperands(dest); + if (restrict) { + odsState.getOrAddProperties().restrict = ((restrict) ? odsBuilder.getUnitAttr() : nullptr); + } + if (writable) { + odsState.getOrAddProperties().writable = ((writable) ? odsBuilder.getUnitAttr() : nullptr); + } + if (result) + odsState.addTypes(result); +} + +void MaterializeInDestinationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value dest, /*optional*/bool restrict, /*optional*/bool writable) { + odsState.addOperands(source); + odsState.addOperands(dest); + if (restrict) { + odsState.getOrAddProperties().restrict = ((restrict) ? odsBuilder.getUnitAttr() : nullptr); + } + if (writable) { + odsState.getOrAddProperties().writable = ((writable) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(resultTypes); +} + +void MaterializeInDestinationOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MaterializeInDestinationOp::verifyInvariantsImpl() { + auto tblgen_restrict = getProperties().restrict; (void)tblgen_restrict; + auto tblgen_writable = getProperties().writable; (void)tblgen_writable; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(*this, tblgen_restrict, "restrict"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(*this, tblgen_writable, "writable"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape())))) + return emitOpError("failed to verify that all of {source, dest} have same shape"); + if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin())))))) + return emitOpError("failed to verify that all of {source, dest} have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult MaterializeInDestinationOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult MaterializeInDestinationOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand destRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destOperands(destRawOperands); ::llvm::SMLoc destOperandsLoc; + (void)destOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("in")) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("restrict"))) { + result.getOrAddProperties().restrict = parser.getBuilder().getUnitAttr(); } + if (::mlir::succeeded(parser.parseOptionalKeyword("writable"))) { + result.getOrAddProperties().writable = parser.getBuilder().getUnitAttr(); } + + destOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(destRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(::llvm::concat(sourceOperands, destOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaterializeInDestinationOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << ' ' << "in"; + if (getRestrictAttr()) { + _odsPrinter << ' ' << "restrict"; + } + if (getWritableAttr()) { + _odsPrinter << ' ' << "writable"; + } + _odsPrinter << ' '; + _odsPrinter << getDest(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("restrict"); + elidedAttrs.push_back("writable"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getRestrictAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("restrict"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWritableAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("writable"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace bufferization +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::bufferization::MaterializeInDestinationOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::ToMemrefOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ToMemrefOpGenericAdaptorBase::ToMemrefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("bufferization.to_memref", odsAttrs.getContext()); +} + +ToMemrefOpGenericAdaptorBase::ToMemrefOpGenericAdaptorBase(ToMemrefOp op) : ToMemrefOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ToMemrefOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ToMemrefOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr ToMemrefOpGenericAdaptorBase::getReadOnlyAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().read_only); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ToMemrefOpGenericAdaptorBase::getReadOnly() { + auto attr = getReadOnlyAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +ToMemrefOpAdaptor::ToMemrefOpAdaptor(ToMemrefOp op) : ToMemrefOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ToMemrefOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_read_only = getProperties().read_only; (void)tblgen_read_only; + + if (tblgen_read_only && !((::llvm::isa<::mlir::UnitAttr>(tblgen_read_only)))) + return emitError(loc, "'bufferization.to_memref' op ""attribute 'read_only' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair ToMemrefOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ToMemrefOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::TensorType> ToMemrefOp::getTensor() { + return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ToMemrefOp::getTensorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ToMemrefOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ToMemrefOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> ToMemrefOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ToMemrefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.read_only; + auto attr = dict.get("read_only"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for read_only in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `read_only` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ToMemrefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.read_only; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("read_only", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ToMemrefOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.read_only.getAsOpaquePointer())); +} + +std::optional ToMemrefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "read_only") + return prop.read_only; + return std::nullopt; +} + +void ToMemrefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "read_only") { + prop.read_only = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ToMemrefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.read_only) attrs.append("read_only", prop.read_only); +} + +::mlir::LogicalResult ToMemrefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getReadOnlyAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(attr, "read_only", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ToMemrefOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.read_only))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ToMemrefOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.read_only); +} + +::mlir::UnitAttr ToMemrefOp::getReadOnlyAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().read_only); +} + +bool ToMemrefOp::getReadOnly() { + auto attr = getReadOnlyAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void ToMemrefOp::setReadOnlyAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getReadOnlyAttrName(), attr); +} + +void ToMemrefOp::setReadOnly(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getReadOnlyAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getReadOnlyAttrName()); +} + +::mlir::Attribute ToMemrefOp::removeReadOnlyAttr() { + auto &attr = getProperties().read_only; + attr = {}; + return attr; +} + +void ToMemrefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, ::mlir::Value tensor, /*optional*/::mlir::UnitAttr read_only) { + odsState.addOperands(tensor); + if (read_only) { + odsState.getOrAddProperties().read_only = read_only; + } + odsState.addTypes(memref); +} + +void ToMemrefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, /*optional*/::mlir::UnitAttr read_only) { + odsState.addOperands(tensor); + if (read_only) { + odsState.getOrAddProperties().read_only = read_only; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ToMemrefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, ::mlir::Value tensor, /*optional*/bool read_only) { + odsState.addOperands(tensor); + if (read_only) { + odsState.getOrAddProperties().read_only = ((read_only) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(memref); +} + +void ToMemrefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, /*optional*/bool read_only) { + odsState.addOperands(tensor); + if (read_only) { + odsState.getOrAddProperties().read_only = ((read_only) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ToMemrefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ToMemrefOp::verifyInvariantsImpl() { + auto tblgen_read_only = getProperties().read_only; (void)tblgen_read_only; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(*this, tblgen_read_only, "read_only"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(memref::getTensorTypeFromMemRefType((*this->getODSResults(0).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that type of 'tensor' is the tensor equivalent of 'memref'"); + return ::mlir::success(); +} + +::mlir::LogicalResult ToMemrefOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ToMemrefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tensorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tensorOperands(tensorRawOperands); ::llvm::SMLoc tensorOperandsLoc; + (void)tensorOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + + tensorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tensorRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("read_only"))) { + result.getOrAddProperties().read_only = parser.getBuilder().getUnitAttr(); } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + for (::mlir::Type type : memrefTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::BaseMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return parser.emitError(parser.getNameLoc()) << "'memref' must be ranked or unranked memref of any type values, but got " << type; + } + } + result.addTypes(memrefTypes); + if (parser.resolveOperands(tensorOperands, memref::getTensorTypeFromMemRefType(memrefTypes[0]), tensorOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ToMemrefOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTensor(); + if (getReadOnlyAttr()) { + _odsPrinter << ' ' << "read_only"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("read_only"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getReadOnlyAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("read_only"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ToMemrefOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace bufferization +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::bufferization::ToMemrefOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::ToTensorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ToTensorOpGenericAdaptorBase::ToTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("bufferization.to_tensor", odsAttrs.getContext()); +} + +ToTensorOpGenericAdaptorBase::ToTensorOpGenericAdaptorBase(ToTensorOp op) : ToTensorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ToTensorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ToTensorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr ToTensorOpGenericAdaptorBase::getRestrictAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().restrict); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ToTensorOpGenericAdaptorBase::getRestrict() { + auto attr = getRestrictAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ToTensorOpGenericAdaptorBase::getWritableAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().writable); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ToTensorOpGenericAdaptorBase::getWritable() { + auto attr = getWritableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +ToTensorOpAdaptor::ToTensorOpAdaptor(ToTensorOp op) : ToTensorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ToTensorOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_restrict = getProperties().restrict; (void)tblgen_restrict; + auto tblgen_writable = getProperties().writable; (void)tblgen_writable; + + if (tblgen_restrict && !((::llvm::isa<::mlir::UnitAttr>(tblgen_restrict)))) + return emitError(loc, "'bufferization.to_tensor' op ""attribute 'restrict' failed to satisfy constraint: unit attribute"); + + if (tblgen_writable && !((::llvm::isa<::mlir::UnitAttr>(tblgen_writable)))) + return emitError(loc, "'bufferization.to_tensor' op ""attribute 'writable' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair ToTensorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ToTensorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> ToTensorOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ToTensorOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ToTensorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ToTensorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::TensorType> ToTensorOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ToTensorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.restrict; + auto attr = dict.get("restrict"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for restrict in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `restrict` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.writable; + auto attr = dict.get("writable"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for writable in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `writable` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ToTensorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.restrict; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("restrict", + propStorage)); + } + + { + const auto &propStorage = prop.writable; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("writable", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ToTensorOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.restrict.getAsOpaquePointer()), + llvm::hash_value(prop.writable.getAsOpaquePointer())); +} + +std::optional ToTensorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "restrict") + return prop.restrict; + + if (name == "writable") + return prop.writable; + return std::nullopt; +} + +void ToTensorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "restrict") { + prop.restrict = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "writable") { + prop.writable = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ToTensorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.restrict) attrs.append("restrict", prop.restrict); + + if (prop.writable) attrs.append("writable", prop.writable); +} + +::mlir::LogicalResult ToTensorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getRestrictAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(attr, "restrict", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWritableAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(attr, "writable", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ToTensorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.restrict))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.writable))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ToTensorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.restrict); + + writer.writeOptionalAttribute(prop.writable); +} + +::mlir::UnitAttr ToTensorOp::getRestrictAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().restrict); +} + +bool ToTensorOp::getRestrict() { + auto attr = getRestrictAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ToTensorOp::getWritableAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().writable); +} + +bool ToTensorOp::getWritable() { + auto attr = getWritableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void ToTensorOp::setRestrictAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getRestrictAttrName(), attr); +} + +void ToTensorOp::setRestrict(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getRestrictAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getRestrictAttrName()); +} + +void ToTensorOp::setWritableAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWritableAttrName(), attr); +} + +void ToTensorOp::setWritable(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWritableAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWritableAttrName()); +} + +::mlir::Attribute ToTensorOp::removeRestrictAttr() { + auto &attr = getProperties().restrict; + attr = {}; + return attr; +} + +::mlir::Attribute ToTensorOp::removeWritableAttr() { + auto &attr = getProperties().writable; + attr = {}; + return attr; +} + +void ToTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable) { + odsState.addOperands(memref); + if (restrict) { + odsState.getOrAddProperties().restrict = restrict; + } + if (writable) { + odsState.getOrAddProperties().writable = writable; + } + odsState.addTypes(result); +} + +void ToTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable) { + odsState.addOperands(memref); + if (restrict) { + odsState.getOrAddProperties().restrict = restrict; + } + if (writable) { + odsState.getOrAddProperties().writable = writable; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ToTensorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ToTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable) { + odsState.addOperands(memref); + if (restrict) { + odsState.getOrAddProperties().restrict = restrict; + } + if (writable) { + odsState.getOrAddProperties().writable = writable; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ToTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, /*optional*/bool restrict, /*optional*/bool writable) { + odsState.addOperands(memref); + if (restrict) { + odsState.getOrAddProperties().restrict = ((restrict) ? odsBuilder.getUnitAttr() : nullptr); + } + if (writable) { + odsState.getOrAddProperties().writable = ((writable) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(result); +} + +void ToTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, /*optional*/bool restrict, /*optional*/bool writable) { + odsState.addOperands(memref); + if (restrict) { + odsState.getOrAddProperties().restrict = ((restrict) ? odsBuilder.getUnitAttr() : nullptr); + } + if (writable) { + odsState.getOrAddProperties().writable = ((writable) ? odsBuilder.getUnitAttr() : nullptr); + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ToTensorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ToTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, /*optional*/bool restrict, /*optional*/bool writable) { + odsState.addOperands(memref); + if (restrict) { + odsState.getOrAddProperties().restrict = ((restrict) ? odsBuilder.getUnitAttr() : nullptr); + } + if (writable) { + odsState.getOrAddProperties().writable = ((writable) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ToTensorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ToTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ToTensorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ToTensorOp::verifyInvariantsImpl() { + auto tblgen_restrict = getProperties().restrict; (void)tblgen_restrict; + auto tblgen_writable = getProperties().writable; (void)tblgen_writable; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(*this, tblgen_restrict, "restrict"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_BufferizationOps1(*this, tblgen_writable, "writable"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_BufferizationOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(memref::getTensorTypeFromMemRefType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result type matches tensor equivalent of 'memref'"); + return ::mlir::success(); +} + +::mlir::LogicalResult ToTensorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ToTensorOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = memref::getTensorTypeFromMemRefType(operands[0].getType()); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ToTensorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("restrict"))) { + result.getOrAddProperties().restrict = parser.getBuilder().getUnitAttr(); } + if (::mlir::succeeded(parser.parseOptionalKeyword("writable"))) { + result.getOrAddProperties().writable = parser.getBuilder().getUnitAttr(); } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + for (::mlir::Type type : memrefTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::BaseMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return parser.emitError(parser.getNameLoc()) << "'memref' must be ranked or unranked memref of any type values, but got " << type; + } + } + result.addTypes(memref::getTensorTypeFromMemRefType(memrefTypes[0])); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ToTensorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMemref(); + if (getRestrictAttr()) { + _odsPrinter << ' ' << "restrict"; + } + if (getWritableAttr()) { + _odsPrinter << ' ' << "writable"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("restrict"); + elidedAttrs.push_back("writable"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getRestrictAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("restrict"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWritableAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("writable"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ToTensorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace bufferization +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::bufferization::ToTensorOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..231579dc2a6d25b60704b96ac1115639441e7669 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.h.inc @@ -0,0 +1,1343 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: BufferizationOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace bufferization { +class AllocTensorOp; +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +class CloneOp; +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +class DeallocOp; +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +class DeallocTensorOp; +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +class MaterializeInDestinationOp; +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +class ToMemrefOp; +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +class ToTensorOp; +} // namespace bufferization +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::AllocTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllocTensorOpGenericAdaptorBase { +public: + struct Properties { + using memory_spaceTy = ::mlir::Attribute; + memory_spaceTy memory_space; + + auto getMemorySpace() { + auto &propStorage = this->memory_space; + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(propStorage); + } + void setMemorySpace(const ::mlir::Attribute &propValue) { + this->memory_space = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.memory_space == this->memory_space && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AllocTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AllocTensorOpGenericAdaptorBase(AllocTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getMemorySpaceAttr(); + ::std::optional<::mlir::Attribute> getMemorySpace(); +}; +} // namespace detail +template +class AllocTensorOpGenericAdaptor : public detail::AllocTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllocTensorOpGenericAdaptorBase; +public: + AllocTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllocTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllocTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AllocTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDynamicSizes() { + return getODSOperands(0); + } + + ValueT getCopy() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getSizeHint() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllocTensorOpAdaptor : public AllocTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllocTensorOpGenericAdaptor::AllocTensorOpGenericAdaptor; + AllocTensorOpAdaptor(AllocTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllocTensorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::bufferization::BufferizableOpInterface::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllocTensorOpAdaptor; + template + using GenericAdaptor = AllocTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("memory_space"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMemorySpaceAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMemorySpaceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("bufferization.alloc_tensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDynamicSizes(); + ::mlir::TypedValue<::mlir::TensorType> getCopy(); + ::mlir::TypedValue<::mlir::IndexType> getSizeHint(); + ::mlir::MutableOperandRange getDynamicSizesMutable(); + ::mlir::MutableOperandRange getCopyMutable(); + ::mlir::MutableOperandRange getSizeHintMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::Attribute getMemorySpaceAttr(); + ::std::optional<::mlir::Attribute> getMemorySpace(); + void setMemorySpaceAttr(::mlir::Attribute attr); + ::mlir::Attribute removeMemorySpaceAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, RankedTensorType type, ValueRange dynamicSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, RankedTensorType type, ValueRange dynamicSizes, Value copy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TensorType type, ValueRange dynamicSizes, Value copy, IntegerAttr memory_space); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange dynamic_sizes, /*optional*/::mlir::Value copy, /*optional*/::mlir::Value size_hint, /*optional*/::mlir::Attribute memory_space); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamic_sizes, /*optional*/::mlir::Value copy, /*optional*/::mlir::Value size_hint, /*optional*/::mlir::Attribute memory_space); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult reifyResultShapes(::mlir::OpBuilder &builder, ::mlir::ReifiedRankedShapedTypeDims &reifiedReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + LogicalResult bufferize(RewriterBase &rewriter, + const BufferizationOptions &options); + + bool resultBufferizesToMemoryWrite(OpResult opResult, + const AnalysisState &state); + + bool bufferizesToAllocation(Value value) { return true; } + + bool bufferizesToMemoryRead(OpOperand &opOperand, + const AnalysisState &state); + + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const AnalysisState &state); + + AliasingValueList getAliasingValues( + OpOperand &opOperand, const AnalysisState &state); + + FailureOr getBufferType( + Value value, const BufferizationOptions &options, + SmallVector &invocationStack); + + RankedTensorType getType() { + return ::llvm::cast(getResult().getType()); + } + + // Return true if the size of the tensor is dynamic at `idx` + bool isDynamicDim(unsigned idx) { + return getType().isDynamicDim(idx); + } + + // Return the argument position that contains the dynamic size of + // the tensor at dimension `idx`. Asserts that the shape is + // dynamic at that `idx`. + unsigned getIndexOfDynamicSize(unsigned idx) { + assert(!getCopy() && "no dim sizes specified when copying a tensor"); + assert(isDynamicDim(idx) && "expected dynamic size"); + ArrayRef shape = getType().getShape(); + return std::count_if( + shape.begin(), shape.begin() + idx, + [&](int64_t size) { return ShapedType::isDynamic(size); }); + } + + // Return the Value of the dynamic size of the tensor at dimension + // `idx`. Asserts that the shape is dynamic at that `idx. + Value getDynamicSize(OpBuilder &b, unsigned idx); + + // Assert that the size of the result tensor is static at `idx` + // and return the shape. + int64_t getStaticSize(unsigned idx) { + assert(!isDynamicDim(idx) && "expected static size"); + return getType().getShape()[idx]; + } +}; +} // namespace bufferization +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::bufferization::AllocTensorOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::CloneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CloneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CloneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CloneOpGenericAdaptorBase(CloneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CloneOpGenericAdaptor : public detail::CloneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CloneOpGenericAdaptorBase; +public: + CloneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CloneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CloneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CloneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CloneOpAdaptor : public CloneOpGenericAdaptor<::mlir::ValueRange> { +public: + using CloneOpGenericAdaptor::CloneOpGenericAdaptor; + CloneOpAdaptor(CloneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CloneOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::CopyOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::bufferization::AllocationOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CloneOpAdaptor; + template + using GenericAdaptor = CloneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("bufferization.clone"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::std::optional<::mlir::Operation*> buildDealloc(::mlir::OpBuilder&builder, ::mlir::Value alloc); + static ::std::optional<::mlir::Value> buildClone(::mlir::OpBuilder&builder, ::mlir::Value alloc); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + Value getSource() { return getInput(); } + Value getTarget() { return getOutput(); } +}; +} // namespace bufferization +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::bufferization::CloneOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::DeallocOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeallocOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DeallocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DeallocOpGenericAdaptorBase(DeallocOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeallocOpGenericAdaptor : public detail::DeallocOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeallocOpGenericAdaptorBase; +public: + DeallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeallocOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DeallocOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getMemrefs() { + return getODSOperands(0); + } + + RangeT getConditions() { + return getODSOperands(1); + } + + RangeT getRetained() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeallocOpAdaptor : public DeallocOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeallocOpGenericAdaptor::DeallocOpGenericAdaptor; + DeallocOpAdaptor(DeallocOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeallocOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DeallocOpAdaptor; + template + using GenericAdaptor = DeallocOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("bufferization.dealloc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getMemrefs(); + ::mlir::Operation::operand_range getConditions(); + ::mlir::Operation::operand_range getRetained(); + ::mlir::MutableOperandRange getMemrefsMutable(); + ::mlir::MutableOperandRange getConditionsMutable(); + ::mlir::MutableOperandRange getRetainedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getUpdatedConditions(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange updatedConditions, ::mlir::ValueRange memrefs, ::mlir::ValueRange conditions, ::mlir::ValueRange retained); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange memrefs, ::mlir::ValueRange conditions, ::mlir::ValueRange retained); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: +}; +} // namespace bufferization +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::bufferization::DeallocOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::DeallocTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeallocTensorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeallocTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeallocTensorOpGenericAdaptorBase(DeallocTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeallocTensorOpGenericAdaptor : public detail::DeallocTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeallocTensorOpGenericAdaptorBase; +public: + DeallocTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeallocTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeallocTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeallocTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeallocTensorOpAdaptor : public DeallocTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeallocTensorOpGenericAdaptor::DeallocTensorOpGenericAdaptor; + DeallocTensorOpAdaptor(DeallocTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeallocTensorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DeallocTensorOpAdaptor; + template + using GenericAdaptor = DeallocTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("bufferization.dealloc_tensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const AnalysisState &state) const { + return false; + } + + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const AnalysisState &state) const { + return false; + } + + AliasingValueList getAliasingValues( + OpOperand &opOperand, const AnalysisState &state) const { + return {}; + } + + LogicalResult bufferize(RewriterBase &rewriter, + const BufferizationOptions &options); +}; +} // namespace bufferization +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::bufferization::DeallocTensorOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::MaterializeInDestinationOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaterializeInDestinationOpGenericAdaptorBase { +public: + struct Properties { + using restrictTy = ::mlir::UnitAttr; + restrictTy restrict; + + auto getRestrict() { + auto &propStorage = this->restrict; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setRestrict(const ::mlir::UnitAttr &propValue) { + this->restrict = propValue; + } + using writableTy = ::mlir::UnitAttr; + writableTy writable; + + auto getWritable() { + auto &propStorage = this->writable; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWritable(const ::mlir::UnitAttr &propValue) { + this->writable = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.restrict == this->restrict && + rhs.writable == this->writable && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MaterializeInDestinationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MaterializeInDestinationOpGenericAdaptorBase(MaterializeInDestinationOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getRestrictAttr(); + bool getRestrict(); + ::mlir::UnitAttr getWritableAttr(); + bool getWritable(); +}; +} // namespace detail +template +class MaterializeInDestinationOpGenericAdaptor : public detail::MaterializeInDestinationOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaterializeInDestinationOpGenericAdaptorBase; +public: + MaterializeInDestinationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaterializeInDestinationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaterializeInDestinationOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MaterializeInDestinationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + ValueT getDest() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaterializeInDestinationOpAdaptor : public MaterializeInDestinationOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaterializeInDestinationOpGenericAdaptor::MaterializeInDestinationOpGenericAdaptor; + MaterializeInDestinationOpAdaptor(MaterializeInDestinationOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaterializeInDestinationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::bufferization::BufferizableOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::bufferization::SubsetInsertionOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaterializeInDestinationOpAdaptor; + template + using GenericAdaptor = MaterializeInDestinationOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("restrict"), ::llvm::StringRef("writable")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getRestrictAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getRestrictAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getWritableAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getWritableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("bufferization.materialize_in_destination"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSource(); + ::mlir::TypedValue<::mlir::ShapedType> getDest(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getDestMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getRestrictAttr(); + bool getRestrict(); + ::mlir::UnitAttr getWritableAttr(); + bool getWritable(); + void setRestrictAttr(::mlir::UnitAttr attr); + void setRestrict(bool attrValue); + void setWritableAttr(::mlir::UnitAttr attr); + void setWritable(bool attrValue); + ::mlir::Attribute removeRestrictAttr(); + ::mlir::Attribute removeWritableAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value source, Value dest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, ::mlir::Value source, ::mlir::Value dest, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value dest, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, ::mlir::Value source, ::mlir::Value dest, /*optional*/bool restrict = false, /*optional*/bool writable = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value dest, /*optional*/bool restrict = false, /*optional*/bool writable = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult reifyResultShapes(::mlir::OpBuilder &builder, ::mlir::ReifiedRankedShapedTypeDims &reifiedReturnShapes); + ::mlir::OpOperand &getSourceOperand(); + bool isEquivalentSubset(::mlir::Value candidate, ::llvm::function_ref equivalenceFn); + ::mlir::Value buildSubsetExtraction(::mlir::OpBuilder &builder, Location loc); + ::llvm::SmallVector<::mlir::Value> getValuesNeededToBuildSubsetExtraction(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + LogicalResult bufferize(RewriterBase &rewriter, + const BufferizationOptions &options); + + bool bufferizesToMemoryRead(OpOperand &opOperand, + const AnalysisState &state); + + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const AnalysisState &state); + + bool bufferizesToElementwiseAccess(const AnalysisState &state, + ArrayRef opOperands); + + bool mustBufferizeInPlace(OpOperand &opOperand, + const AnalysisState &state); + + AliasingValueList getAliasingValues( + OpOperand &opOperand, const AnalysisState &state); + + RankedTensorType getType() { + return ::llvm::cast(getResult().getType()); + } + + MutableOperandRange getDpsInitsMutable(); + + bool isWritable(Value value, const AnalysisState &state); +}; +} // namespace bufferization +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::bufferization::MaterializeInDestinationOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::ToMemrefOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ToMemrefOpGenericAdaptorBase { +public: + struct Properties { + using read_onlyTy = ::mlir::UnitAttr; + read_onlyTy read_only; + + auto getReadOnly() { + auto &propStorage = this->read_only; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setReadOnly(const ::mlir::UnitAttr &propValue) { + this->read_only = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.read_only == this->read_only && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ToMemrefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ToMemrefOpGenericAdaptorBase(ToMemrefOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getReadOnlyAttr(); + bool getReadOnly(); +}; +} // namespace detail +template +class ToMemrefOpGenericAdaptor : public detail::ToMemrefOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ToMemrefOpGenericAdaptorBase; +public: + ToMemrefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ToMemrefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ToMemrefOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ToMemrefOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ToMemrefOpAdaptor : public ToMemrefOpGenericAdaptor<::mlir::ValueRange> { +public: + using ToMemrefOpGenericAdaptor::ToMemrefOpGenericAdaptor; + ToMemrefOpAdaptor(ToMemrefOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ToMemrefOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::bufferization::BufferizableOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ToMemrefOpAdaptor; + template + using GenericAdaptor = ToMemrefOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("read_only")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getReadOnlyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getReadOnlyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("bufferization.to_memref"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getMemref(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getReadOnlyAttr(); + bool getReadOnly(); + void setReadOnlyAttr(::mlir::UnitAttr attr); + void setReadOnly(bool attrValue); + ::mlir::Attribute removeReadOnlyAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, ::mlir::Value tensor, /*optional*/::mlir::UnitAttr read_only); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, /*optional*/::mlir::UnitAttr read_only); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, ::mlir::Value tensor, /*optional*/bool read_only = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, /*optional*/bool read_only = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + //===------------------------------------------------------------------===// + // BufferizableOpInterface implementation + //===------------------------------------------------------------------===// + + // Note: ToMemrefOp / ToTensorOp are temporary ops that are inserted at the + // bufferization boundary. When One-Shot bufferization is complete, there + // should be no such ops left over. If `allowUnknownOps` (or after running a + // partial bufferization pass), such ops may be part of the resulting IR, + // but such IR may no longer be analyzable by One-Shot analysis. + + bool bufferizesToMemoryRead(OpOperand &opOperand, + const AnalysisState &state) const { + // It is unknown whether the resulting memref will be read or not. + return true; + } + + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const AnalysisState &state) { + return !getReadOnly(); + } + + AliasingValueList getAliasingValues( + OpOperand &opOperand, const AnalysisState &state) const { + return {}; + } + + LogicalResult bufferize(RewriterBase &rewriter, + const BufferizationOptions &options); +}; +} // namespace bufferization +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::bufferization::ToMemrefOp) + +namespace mlir { +namespace bufferization { + +//===----------------------------------------------------------------------===// +// ::mlir::bufferization::ToTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ToTensorOpGenericAdaptorBase { +public: + struct Properties { + using restrictTy = ::mlir::UnitAttr; + restrictTy restrict; + + auto getRestrict() { + auto &propStorage = this->restrict; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setRestrict(const ::mlir::UnitAttr &propValue) { + this->restrict = propValue; + } + using writableTy = ::mlir::UnitAttr; + writableTy writable; + + auto getWritable() { + auto &propStorage = this->writable; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWritable(const ::mlir::UnitAttr &propValue) { + this->writable = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.restrict == this->restrict && + rhs.writable == this->writable && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ToTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ToTensorOpGenericAdaptorBase(ToTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getRestrictAttr(); + bool getRestrict(); + ::mlir::UnitAttr getWritableAttr(); + bool getWritable(); +}; +} // namespace detail +template +class ToTensorOpGenericAdaptor : public detail::ToTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ToTensorOpGenericAdaptorBase; +public: + ToTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ToTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ToTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ToTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ToTensorOpAdaptor : public ToTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using ToTensorOpGenericAdaptor::ToTensorOpGenericAdaptor; + ToTensorOpAdaptor(ToTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ToTensorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::bufferization::BufferizableOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferTypeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ToTensorOpAdaptor; + template + using GenericAdaptor = ToTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("restrict"), ::llvm::StringRef("writable")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getRestrictAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getRestrictAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getWritableAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getWritableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("bufferization.to_tensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getMemref(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getRestrictAttr(); + bool getRestrict(); + ::mlir::UnitAttr getWritableAttr(); + bool getWritable(); + void setRestrictAttr(::mlir::UnitAttr attr); + void setRestrict(bool attrValue); + void setWritableAttr(::mlir::UnitAttr attr); + void setWritable(bool attrValue); + ::mlir::Attribute removeRestrictAttr(); + ::mlir::Attribute removeWritableAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, /*optional*/::mlir::UnitAttr restrict, /*optional*/::mlir::UnitAttr writable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, /*optional*/bool restrict = false, /*optional*/bool writable = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, /*optional*/bool restrict = false, /*optional*/bool writable = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, /*optional*/bool restrict = false, /*optional*/bool writable = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The result of a to_tensor is always a tensor. + TensorType getType() { + Type resultType = getResult().getType(); + if (::llvm::isa(resultType)) + return ::llvm::cast(resultType); + return {}; + } + + //===------------------------------------------------------------------===// + // BufferizableOpInterface implementation + //===------------------------------------------------------------------===// + + LogicalResult bufferize(RewriterBase &rewriter, + const BufferizationOptions &options) const { + // to_tensor/to_memref pairs fold away after bufferization. + return success(); + } + + bool isWritable(Value value, const AnalysisState &state); + + FailureOr getBufferType( + Value value, const BufferizationOptions &options, + SmallVector &invocationStack) { + return ::llvm::cast(getMemref().getType()); + } +}; +} // namespace bufferization +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::bufferization::ToTensorOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..3832fbdec29f56662d0648272d85faa760e86356 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.cpp.inc @@ -0,0 +1,31 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: BufferizationBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::bufferization::BufferizationDialect) +namespace mlir { +namespace bufferization { + +BufferizationDialect::BufferizationDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + initialize(); +} + +BufferizationDialect::~BufferizationDialect() = default; + +} // namespace bufferization +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..a8375f28c1469d8b8f8edf73b84d18edb867d383 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.h.inc @@ -0,0 +1,59 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: BufferizationBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace bufferization { + +class BufferizationDialect : public ::mlir::Dialect { + explicit BufferizationDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~BufferizationDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("bufferization"); + } + + /// Provides a hook for verifying dialect attributes attached to the given + /// op. + ::mlir::LogicalResult verifyOperationAttribute( + ::mlir::Operation *op, ::mlir::NamedAttribute attribute) override; + + /// Verify an attribute from this dialect on the argument at 'argIndex' for + /// the region at 'regionIndex' on the given operation. Returns failure if + /// the verification failed, success otherwise. This hook may optionally be + /// invoked from any operation containing a region. + LogicalResult verifyRegionArgAttribute(Operation *, + unsigned regionIndex, + unsigned argIndex, + NamedAttribute) override; + + /// An attribute that can override writability of buffers of tensor function + /// arguments during One-Shot Module Bufferize. + constexpr const static ::llvm::StringLiteral + kWritableAttrName = "bufferization.writable"; + + /// An attribute for function arguments that describes how the function + /// accesses the buffer. Can be one "none", "read", "write" or "read-write". + /// + /// When no attribute is specified, the analysis tries to infer the access + /// behavior from its body. In case of external functions, for which no + /// function body is available, "read-write" is assumed by default. + constexpr const static ::llvm::StringLiteral + kBufferAccessAttrName = "bufferization.access"; + + /// Attribute name used to mark the bufferization layout for region + /// arguments during One-Shot Module Bufferize. + constexpr const static ::llvm::StringLiteral + kBufferLayoutAttrName = "bufferization.buffer_layout"; + }; +} // namespace bufferization +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::bufferization::BufferizationDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/DstBufferizableOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/DstBufferizableOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..bd0d1c9939795746c6f0817609fde881556a83ca --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/DstBufferizableOpInterfaceImpl.h @@ -0,0 +1,52 @@ +//===- DstBufferizableOpInterfaceImpl.h - Dst Op Bufferization --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_IR_DSTBUFFERIZABLEOPINTERFACEIMPL_H_ +#define MLIR_DIALECT_BUFFERIZATION_IR_DSTBUFFERIZABLEOPINTERFACEIMPL_H_ + +#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h" +#include "mlir/Interfaces/DestinationStyleOpInterface.h" + +namespace mlir { +namespace bufferization { + +/// Bufferizable ops that implement the DestinationStyleOpInterface can use this +/// external model base class. It provides default implementations for various +/// required interface methods. +template +struct DstBufferizableOpInterfaceExternalModel + : public BufferizableOpInterface::ExternalModel { + bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, + const AnalysisState &state) const { + // All inputs and outputs bufferize to a memory read. + assert(isa(op) && + "expected that op implements DestinationStyleOpInterface"); + return true; + } + + bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, + const AnalysisState &state) const { + // Only outputs bufferize to a memory write. + auto dstOp = cast(op); + return dstOp.isDpsInit(&opOperand); + } + + AliasingValueList getAliasingValues(Operation *op, OpOperand &opOperand, + const AnalysisState &state) const { + // Output operands alias with their respective tied OpResults. + auto dstOp = cast(op); + if (dstOp.isDpsInit(&opOperand)) + return {{dstOp.getTiedOpResult(&opOperand), BufferRelation::Equivalent}}; + return {}; + } +}; + +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_IR_DSTBUFFERIZABLEOPINTERFACEIMPL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..05de79df4eefa36c6374b49aa1e40f09e5349fae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.cpp.inc @@ -0,0 +1,72 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Return the source tensor operand. +::mlir::OpOperand &mlir::bufferization::SubsetInsertionOpInterface::getSourceOperand() { + return getImpl()->getSourceOperand(getImpl(), getOperation()); + } +/// Return the destination tensor operand. +::mlir::OpOperand &mlir::bufferization::SubsetInsertionOpInterface::getDestinationOperand() { + return getImpl()->getDestinationOperand(getImpl(), getOperation()); + } +/// Return "true" if this operation inserts into a subset that is +/// equivalent to the subset defined by `candidate`. +/// +/// Two subsets are "equivalent" and "same" if they can bufferize to the +/// same buffer views/aliases. If they are "equivalent", the tensor IR +/// may be expressed in terms of different SSA values (but they could +/// bufferize to MemRef SSA values that can CSE without breaking +/// correctness). `equivalenceFn` should return "true" if the two given +/// values are equivalent. +/// +/// Example: +/// ``` +/// // The subset of the SubsetInsertionOpInterface op %1 is equivalent to +/// // the subset defined by %2 (but not "same"): +/// %0 = arith.select %c, %t, %t : tensor +/// %1 = tensor.insert_slice %x into %0[0][5][1] +/// : tensor<5xf32> into tensor +/// %2 = tensor.extract_slice %t[0][5][1] : tensor to tensor<5xf32> +/// +/// // The subset of the SubsetInsertionOpInterface op %1 is equivalent to +/// // and "same" as the subset defined by %2. +/// %1 = tensor.insert_slice %x into %t[0][5][1] +/// : tensor<5xf32> into tensor +/// %2 = tensor.extract_slice %t[0][5][1] : tensor to tensor<5xf32> +/// ``` +bool mlir::bufferization::SubsetInsertionOpInterface::isEquivalentSubset(::mlir::Value candidate, ::llvm::function_ref equivalenceFn) { + return getImpl()->isEquivalentSubset(getImpl(), getOperation(), candidate, equivalenceFn); + } +/// Return the subset of the destination tensor that this operation +/// inserts into. +/// +/// Example: +/// ``` +/// // SubsetOpInterface op: +/// %0 = tensor.insert_slice %t0 into %t1[%pos][5][1] +/// : tensor<5xf32> into tensor +/// // Subset (built by this function): +/// %1 = tensor.extract_slice %t1[%pos][5][1] +/// : tensor to tensor<5xf32> +/// ``` +/// +/// Note: Implementations do not necessarily have to build new IR. They +/// may return existing SSA values. +::mlir::Value mlir::bufferization::SubsetInsertionOpInterface::buildSubsetExtraction(::mlir::OpBuilder & builder, Location loc) { + return getImpl()->buildSubsetExtraction(getImpl(), getOperation(), builder, loc); + } +/// Return all SSA values that are needed (i.e., must be in scope) at the +/// insertion of the builder when calling `buildSubsetExtraction`. Users +/// of `buildSubsetExtraction` can use this helper method to find a +/// suitable insertion point. +/// +/// Example: The SSA values needed to build the subset in the example of +/// `buildSubsetExtraction` are %t1 and %pos. +::llvm::SmallVector<::mlir::Value> mlir::bufferization::SubsetInsertionOpInterface::getValuesNeededToBuildSubsetExtraction() { + return getImpl()->getValuesNeededToBuildSubsetExtraction(getImpl(), getOperation()); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..e5b06d746e74bfdc29763416a09d0014945cc5d7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.h @@ -0,0 +1,29 @@ +//===- SubsetInsertionOpInterface.h - Tensor Subsets ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_IR_SUBSETINSERTIONOPINTERFACE_H_ +#define MLIR_DIALECT_BUFFERIZATION_IR_SUBSETINSERTIONOPINTERFACE_H_ + +#include "mlir/IR/OpDefinition.h" + +namespace mlir { +namespace bufferization { +namespace detail { + +/// Return the destination/"init" operand of the op if it implements the +/// `DestinationStyleOpInterface` and has exactly one "init" operand. Asserts +/// otherwise. +OpOperand &defaultGetDestinationOperand(Operation *op); + +} // namespace detail +} // namespace bufferization +} // namespace mlir + +#include "mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.h.inc" + +#endif // MLIR_DIALECT_BUFFERIZATION_IR_SUBSETINSERTIONOPINTERFACE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..1cd13256abe262ec465c926187dd6b0bd4aa4414 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/SubsetInsertionOpInterface.h.inc @@ -0,0 +1,188 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace bufferization { +class SubsetInsertionOpInterface; +namespace detail { +struct SubsetInsertionOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::OpOperand &(*getSourceOperand)(const Concept *impl, ::mlir::Operation *); + ::mlir::OpOperand &(*getDestinationOperand)(const Concept *impl, ::mlir::Operation *); + bool (*isEquivalentSubset)(const Concept *impl, ::mlir::Operation *, ::mlir::Value, ::llvm::function_ref); + ::mlir::Value (*buildSubsetExtraction)(const Concept *impl, ::mlir::Operation *, ::mlir::OpBuilder &, Location); + ::llvm::SmallVector<::mlir::Value> (*getValuesNeededToBuildSubsetExtraction)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::bufferization::SubsetInsertionOpInterface; + Model() : Concept{getSourceOperand, getDestinationOperand, isEquivalentSubset, buildSubsetExtraction, getValuesNeededToBuildSubsetExtraction} {} + + static inline ::mlir::OpOperand &getSourceOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::OpOperand &getDestinationOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isEquivalentSubset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value candidate, ::llvm::function_ref equivalenceFn); + static inline ::mlir::Value buildSubsetExtraction(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpBuilder & builder, Location loc); + static inline ::llvm::SmallVector<::mlir::Value> getValuesNeededToBuildSubsetExtraction(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::bufferization::SubsetInsertionOpInterface; + FallbackModel() : Concept{getSourceOperand, getDestinationOperand, isEquivalentSubset, buildSubsetExtraction, getValuesNeededToBuildSubsetExtraction} {} + + static inline ::mlir::OpOperand &getSourceOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::OpOperand &getDestinationOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isEquivalentSubset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value candidate, ::llvm::function_ref equivalenceFn); + static inline ::mlir::Value buildSubsetExtraction(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpBuilder & builder, Location loc); + static inline ::llvm::SmallVector<::mlir::Value> getValuesNeededToBuildSubsetExtraction(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::OpOperand &getDestinationOperand(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct SubsetInsertionOpInterfaceTrait; + +} // namespace detail +class SubsetInsertionOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::SubsetInsertionOpInterfaceTrait {}; + /// Return the source tensor operand. + ::mlir::OpOperand &getSourceOperand(); + /// Return the destination tensor operand. + ::mlir::OpOperand &getDestinationOperand(); + /// Return "true" if this operation inserts into a subset that is + /// equivalent to the subset defined by `candidate`. + /// + /// Two subsets are "equivalent" and "same" if they can bufferize to the + /// same buffer views/aliases. If they are "equivalent", the tensor IR + /// may be expressed in terms of different SSA values (but they could + /// bufferize to MemRef SSA values that can CSE without breaking + /// correctness). `equivalenceFn` should return "true" if the two given + /// values are equivalent. + /// + /// Example: + /// ``` + /// // The subset of the SubsetInsertionOpInterface op %1 is equivalent to + /// // the subset defined by %2 (but not "same"): + /// %0 = arith.select %c, %t, %t : tensor + /// %1 = tensor.insert_slice %x into %0[0][5][1] + /// : tensor<5xf32> into tensor + /// %2 = tensor.extract_slice %t[0][5][1] : tensor to tensor<5xf32> + /// + /// // The subset of the SubsetInsertionOpInterface op %1 is equivalent to + /// // and "same" as the subset defined by %2. + /// %1 = tensor.insert_slice %x into %t[0][5][1] + /// : tensor<5xf32> into tensor + /// %2 = tensor.extract_slice %t[0][5][1] : tensor to tensor<5xf32> + /// ``` + bool isEquivalentSubset(::mlir::Value candidate, ::llvm::function_ref equivalenceFn); + /// Return the subset of the destination tensor that this operation + /// inserts into. + /// + /// Example: + /// ``` + /// // SubsetOpInterface op: + /// %0 = tensor.insert_slice %t0 into %t1[%pos][5][1] + /// : tensor<5xf32> into tensor + /// // Subset (built by this function): + /// %1 = tensor.extract_slice %t1[%pos][5][1] + /// : tensor to tensor<5xf32> + /// ``` + /// + /// Note: Implementations do not necessarily have to build new IR. They + /// may return existing SSA values. + ::mlir::Value buildSubsetExtraction(::mlir::OpBuilder & builder, Location loc); + /// Return all SSA values that are needed (i.e., must be in scope) at the + /// insertion of the builder when calling `buildSubsetExtraction`. Users + /// of `buildSubsetExtraction` can use this helper method to find a + /// suitable insertion point. + /// + /// Example: The SSA values needed to build the subset in the example of + /// `buildSubsetExtraction` are %t1 and %pos. + ::llvm::SmallVector<::mlir::Value> getValuesNeededToBuildSubsetExtraction(); + + /// Return "true" if this operation inserts into the same subset as defined + /// by `candidate`. + /// + /// Note: This function is useful outside of bufferization, where no tensor + /// equivalence information is available. + bool isSameSubset(OpResult candidate) { + auto subsetOp = cast<::mlir::bufferization::SubsetInsertionOpInterface>( + getOperation()); + return subsetOp.isEquivalentSubset( + candidate, [](Value v1, Value v2) { return v1 == v2; }); + } +}; +namespace detail { + template + struct SubsetInsertionOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Return the destination tensor operand. + ::mlir::OpOperand &getDestinationOperand() { + return ::mlir::bufferization::detail::defaultGetDestinationOperand( + (*static_cast(this)).getOperation()); + } + }; +}// namespace detail +} // namespace bufferization +} // namespace mlir +namespace mlir { +namespace bufferization { +template +::mlir::OpOperand &detail::SubsetInsertionOpInterfaceInterfaceTraits::Model::getSourceOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getSourceOperand(); +} +template +::mlir::OpOperand &detail::SubsetInsertionOpInterfaceInterfaceTraits::Model::getDestinationOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getDestinationOperand(); +} +template +bool detail::SubsetInsertionOpInterfaceInterfaceTraits::Model::isEquivalentSubset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value candidate, ::llvm::function_ref equivalenceFn) { + return (llvm::cast(tablegen_opaque_val)).isEquivalentSubset(candidate, equivalenceFn); +} +template +::mlir::Value detail::SubsetInsertionOpInterfaceInterfaceTraits::Model::buildSubsetExtraction(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpBuilder & builder, Location loc) { + return (llvm::cast(tablegen_opaque_val)).buildSubsetExtraction(builder, loc); +} +template +::llvm::SmallVector<::mlir::Value> detail::SubsetInsertionOpInterfaceInterfaceTraits::Model::getValuesNeededToBuildSubsetExtraction(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getValuesNeededToBuildSubsetExtraction(); +} +template +::mlir::OpOperand &detail::SubsetInsertionOpInterfaceInterfaceTraits::FallbackModel::getSourceOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getSourceOperand(tablegen_opaque_val); +} +template +::mlir::OpOperand &detail::SubsetInsertionOpInterfaceInterfaceTraits::FallbackModel::getDestinationOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getDestinationOperand(tablegen_opaque_val); +} +template +bool detail::SubsetInsertionOpInterfaceInterfaceTraits::FallbackModel::isEquivalentSubset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Value candidate, ::llvm::function_ref equivalenceFn) { + return static_cast(impl)->isEquivalentSubset(tablegen_opaque_val, candidate, equivalenceFn); +} +template +::mlir::Value detail::SubsetInsertionOpInterfaceInterfaceTraits::FallbackModel::buildSubsetExtraction(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpBuilder & builder, Location loc) { + return static_cast(impl)->buildSubsetExtraction(tablegen_opaque_val, builder, loc); +} +template +::llvm::SmallVector<::mlir::Value> detail::SubsetInsertionOpInterfaceInterfaceTraits::FallbackModel::getValuesNeededToBuildSubsetExtraction(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getValuesNeededToBuildSubsetExtraction(tablegen_opaque_val); +} +template +::mlir::OpOperand &detail::SubsetInsertionOpInterfaceInterfaceTraits::ExternalModel::getDestinationOperand(::mlir::Operation *tablegen_opaque_val) const { +return ::mlir::bufferization::detail::defaultGetDestinationOperand( + (llvm::cast(tablegen_opaque_val)).getOperation()); +} +} // namespace bufferization +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h new file mode 100644 index 0000000000000000000000000000000000000000..78109770efab7ae80eaf4d4363cc3b60a97c311f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h @@ -0,0 +1,179 @@ +//===- UnstructuredControlFlow.h - Op Interface Helpers ---------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_IR_UNSTRUCTUREDCONTROLFLOW_H_ +#define MLIR_DIALECT_BUFFERIZATION_IR_UNSTRUCTUREDCONTROLFLOW_H_ + +#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" + +//===----------------------------------------------------------------------===// +// Helpers for Unstructured Control Flow +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace bufferization { + +namespace detail { +/// Return a list of operands that are forwarded to the given block argument. +/// I.e., find all predecessors of the block argument's owner and gather the +/// operands that are equivalent to the block argument. +SmallVector getCallerOpOperands(BlockArgument bbArg); +} // namespace detail + +/// A template that provides a default implementation of `getAliasingOpOperands` +/// for ops that support unstructured control flow within their regions. +template +struct OpWithUnstructuredControlFlowBufferizableOpInterfaceExternalModel + : public BufferizableOpInterface::ExternalModel { + + FailureOr + getBufferType(Operation *op, Value value, const BufferizationOptions &options, + SmallVector &invocationStack) const { + // Note: The user may want to override this function for OpResults in + // case the bufferized result type is different from the bufferized type of + // the aliasing OpOperand (if any). + if (isa(value)) + return bufferization::detail::defaultGetBufferType(value, options, + invocationStack); + + // Compute the buffer type of the block argument by computing the bufferized + // operand types of all forwarded values. If these are all the same type, + // take that type. Otherwise, take only the memory space and fall back to a + // buffer type with a fully dynamic layout map. + BaseMemRefType bufferType; + auto tensorType = cast(value.getType()); + for (OpOperand *opOperand : + detail::getCallerOpOperands(cast(value))) { + + // If the forwarded operand is already on the invocation stack, we ran + // into a loop and this operand cannot be used to compute the bufferized + // type. + if (llvm::find(invocationStack, opOperand->get()) != + invocationStack.end()) + continue; + + // Compute the bufferized type of the forwarded operand. + BaseMemRefType callerType; + if (auto memrefType = + dyn_cast(opOperand->get().getType())) { + // The operand was already bufferized. Take its type directly. + callerType = memrefType; + } else { + FailureOr maybeCallerType = + bufferization::getBufferType(opOperand->get(), options, + invocationStack); + if (failed(maybeCallerType)) + return failure(); + callerType = *maybeCallerType; + } + + if (!bufferType) { + // This is the first buffer type that we computed. + bufferType = callerType; + continue; + } + + if (bufferType == callerType) + continue; + + // If the computed buffer type does not match the computed buffer type + // of the earlier forwarded operands, fall back to a buffer type with a + // fully dynamic layout map. +#ifndef NDEBUG + if (auto rankedTensorType = dyn_cast(tensorType)) { + assert(bufferType.hasRank() && callerType.hasRank() && + "expected ranked memrefs"); + assert(llvm::all_equal({bufferType.getShape(), callerType.getShape(), + rankedTensorType.getShape()}) && + "expected same shape"); + } else { + assert(!bufferType.hasRank() && !callerType.hasRank() && + "expected unranked memrefs"); + } +#endif // NDEBUG + + if (bufferType.getMemorySpace() != callerType.getMemorySpace()) + return op->emitOpError("incoming operands of block argument have " + "inconsistent memory spaces"); + + bufferType = getMemRefTypeWithFullyDynamicLayout( + tensorType, bufferType.getMemorySpace()); + } + + if (!bufferType) + return op->emitOpError("could not infer buffer type of block argument"); + + return bufferType; + } + +protected: + /// Assuming that `bbArg` is a block argument of a block that belongs to the + /// given `op`, return all OpOperands of users of this block that are + /// aliasing with the given block argument. + AliasingOpOperandList + getAliasingBranchOpOperands(Operation *op, BlockArgument bbArg, + const AnalysisState &state) const { + assert(bbArg.getOwner()->getParentOp() == op && "invalid bbArg"); + + // Gather aliasing OpOperands of all operations (callers) that link to + // this block. + AliasingOpOperandList result; + for (OpOperand *opOperand : detail::getCallerOpOperands(bbArg)) + result.addAlias( + {opOperand, BufferRelation::Equivalent, /*isDefinite=*/false}); + + return result; + } +}; + +/// A template that provides a default implementation of `getAliasingValues` +/// for ops that implement the `BranchOpInterface`. +template +struct BranchOpBufferizableOpInterfaceExternalModel + : public BufferizableOpInterface::ExternalModel { + AliasingValueList getAliasingValues(Operation *op, OpOperand &opOperand, + const AnalysisState &state) const { + AliasingValueList result; + auto branchOp = cast(op); + auto operandNumber = opOperand.getOperandNumber(); + + // Gather aliasing block arguments of blocks to which this op may branch to. + for (const auto &it : llvm::enumerate(op->getSuccessors())) { + Block *block = it.value(); + SuccessorOperands operands = branchOp.getSuccessorOperands(it.index()); + assert(operands.getProducedOperandCount() == 0 && + "produced operands not supported"); + if (operands.getForwardedOperands().empty()) + continue; + // The first and last operands that are forwarded to this successor. + int64_t firstOperandIndex = + operands.getForwardedOperands().getBeginOperandIndex(); + int64_t lastOperandIndex = + firstOperandIndex + operands.getForwardedOperands().size(); + bool matchingDestination = operandNumber >= firstOperandIndex && + operandNumber < lastOperandIndex; + // A branch op may have multiple successors. Find the ones that correspond + // to this OpOperand. (There is usually only one.) + if (!matchingDestination) + continue; + // Compute the matching block argument of the destination block. + BlockArgument bbArg = + block->getArgument(operandNumber - firstOperandIndex); + result.addAlias( + {bbArg, BufferRelation::Equivalent, /*isDefinite=*/false}); + } + + return result; + } +}; + +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_IR_UNSTRUCTUREDCONTROLFLOW_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferUtils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..85e9c47ad5302cbd930101aae6cc956d9dcb49ed --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferUtils.h @@ -0,0 +1,134 @@ +//===- BufferUtils.h - Buffer optimization utilities ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file provides utilities for passes optimizing code that has already +// been converted to buffers. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERUTILS_H +#define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERUTILS_H + +#include "mlir/Analysis/Liveness.h" +#include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinOps.h" +#include "mlir/IR/Dominance.h" +#include "mlir/IR/Operation.h" +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { +namespace memref { +class GlobalOp; +} // namespace memref + +namespace bufferization { + +/// A simple analysis that detects allocation operations. +class BufferPlacementAllocs { +public: + /// Represents a tuple of allocValue and deallocOperation. + using AllocEntry = std::tuple; + + /// Represents a list containing all alloc entries. + using AllocEntryList = SmallVector; + + /// Get the start operation to place the given alloc value within the + /// specified placement block. + static Operation *getStartOperation(Value allocValue, Block *placementBlock, + const Liveness &liveness); + +public: + /// Initializes the internal list by discovering all supported allocation + /// nodes. + BufferPlacementAllocs(Operation *op); + + /// Returns the begin iterator to iterate over all allocations. + AllocEntryList::const_iterator begin() const { return allocs.begin(); } + + /// Returns the end iterator that can be used in combination with begin. + AllocEntryList::const_iterator end() const { return allocs.end(); } + + /// Returns the begin iterator to iterate over all allocations. + AllocEntryList::iterator begin() { return allocs.begin(); } + + /// Returns the end iterator that can be used in combination with begin. + AllocEntryList::iterator end() { return allocs.end(); } + + /// Registers a new allocation entry. + void registerAlloc(const AllocEntry &entry) { allocs.push_back(entry); } + +private: + /// Searches for and registers all supported allocation entries. + void build(Operation *op); + +private: + /// Maps allocation nodes to their associated blocks. + AllocEntryList allocs; +}; + +/// The base class for all BufferPlacement transformations. +class BufferPlacementTransformationBase { +public: + using ValueSetT = BufferViewFlowAnalysis::ValueSetT; + + /// Finds a common dominator for the given value while taking the positions + /// of the values in the value set into account. It supports dominator and + /// post-dominator analyses via template arguments. + template + static Block *findCommonDominator(Value value, const ValueSetT &values, + const DominatorT &doms) { + // Start with the current block the value is defined in. + Block *dom = value.getParentBlock(); + // Iterate over all aliases and their uses to find a safe placement block + // according to the given dominator information. + for (Value childValue : values) { + for (Operation *user : childValue.getUsers()) { + // Move upwards in the dominator tree to find an appropriate + // dominator block that takes the current use into account. + dom = doms.findNearestCommonDominator(dom, user->getBlock()); + } + // Take values without any users into account. + dom = doms.findNearestCommonDominator(dom, childValue.getParentBlock()); + } + return dom; + } + + /// Returns true if the given operation represents a loop by testing whether + /// it implements the `LoopLikeOpInterface` or the `RegionBranchOpInterface`. + /// In the case of a `RegionBranchOpInterface`, it checks all region-based + /// control-flow edges for cycles. + static bool isLoop(Operation *op); + + /// Constructs a new operation base using the given root operation. + BufferPlacementTransformationBase(Operation *op); + +protected: + /// Alias information that can be updated during the insertion of copies. + BufferViewFlowAnalysis aliases; + + /// Stores all internally managed allocations. + BufferPlacementAllocs allocs; + + /// The underlying liveness analysis to compute fine grained information + /// about alloc and dealloc positions. + Liveness liveness; +}; + +// Create a global op for the given tensor-valued constant in the program. +// Globals are created lazily at the top of the enclosing ModuleOp with pretty +// names. Duplicates are avoided. +FailureOr getGlobalFor(arith::ConstantOp constantOp, + uint64_t alignment, + Attribute memorySpace = {}); + +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERUTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..24825db69f90c505ff83f561bc47e1f1132334c6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h @@ -0,0 +1,77 @@ +//===- BufferViewFlowAnalysis.h - Buffer dependency analysis ---*- C++ -*-====// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERVIEWFLOWANALYSIS_H +#define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERVIEWFLOWANALYSIS_H + +#include "mlir/IR/Operation.h" +#include "llvm/ADT/SmallPtrSet.h" + +namespace mlir { + +/// A straight-forward alias analysis which ensures that all dependencies of all +/// values will be determined. This is a requirement for the BufferPlacement +/// class since you need to determine safe positions to place alloc and +/// deallocs. This alias analysis only finds aliases that might have been +/// created on top of the specified view. To find all aliases, resolve the +/// intial alloc/argument value. +class BufferViewFlowAnalysis { +public: + using ValueSetT = SmallPtrSet; + using ValueMapT = llvm::DenseMap; + + /// Constructs a new alias analysis using the op provided. + BufferViewFlowAnalysis(Operation *op); + + /// Find all immediate dependencies this value could potentially have. + ValueMapT::const_iterator find(Value value) const { + return dependencies.find(value); + } + + /// Returns the begin iterator to iterate over all dependencies. + ValueMapT::const_iterator begin() const { return dependencies.begin(); } + + /// Returns the end iterator that can be used in combination with find. + ValueMapT::const_iterator end() const { return dependencies.end(); } + + /// Find all immediate and indirect views upon this value. This will find all + /// dependencies on this value that can potentially be later in the execution + /// of the program, but will not return values that this alias might have been + /// created from (such as if the value is created by a subview, this will not + /// return the parent view if there is no cyclic behavior). Note that the + /// resulting set will also contain the value provided as it is an alias of + /// itself. + /// + /// A = * + /// B = subview(A) + /// C = B + /// + /// Results in resolve(B) returning {B, C} + ValueSetT resolve(Value value) const; + + /// Removes the given values from all alias sets. + void remove(const SetVector &aliasValues); + + /// Replaces all occurrences of 'from' in the internal datastructures with + /// 'to'. This is useful when the defining operation of a value has to be + /// re-built because additional results have to be added or the types of + /// results have to be changed. + void rename(Value from, Value to); + +private: + /// This function constructs a mapping from values to its immediate + /// dependencies. + void build(Operation *op); + + /// Maps values to all immediate dependencies this value can have. + ValueMapT dependencies; +}; + +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERVIEWFLOWANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Bufferize.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Bufferize.h new file mode 100644 index 0000000000000000000000000000000000000000..cab997e1aff2977b10c06a7ca67c83200fdf2f74 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Bufferize.h @@ -0,0 +1,98 @@ +//===- Bufferize.h - Bufferization Utilities --------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// We use the term "bufferize" to mean conversion from tensor types to +// memref types. +// +// Generally speaking, for each op that operates on tensor types, the +// `BufferizableOpInterface` needs to be implemented. This file contains the +// bufferization driver that is responsible for bufferizing the ops in the right +// order, etc. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERIZE_H +#define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERIZE_H + +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { +namespace bufferization { + +class AnalysisState; +struct BufferizationOptions; +class OpFilter; + +/// Bufferization statistics for debugging. These can be printed after running +/// the OneShotBufferizePass with `-mlir-pass-statistics`. See the pass +/// definition for more details. +struct BufferizationStatistics { + int64_t numBufferAlloc = 0; + int64_t numBufferDealloc = 0; + int64_t numTensorInPlace = 0; + int64_t numTensorOutOfPlace = 0; +}; + +/// A helper type converter class that automatically populates the relevant +/// materializations and type conversions for bufferization. +class BufferizeTypeConverter : public TypeConverter { +public: + BufferizeTypeConverter(); +}; + +/// Marks ops used by bufferization for type conversion materializations as +/// "legal" in the given ConversionTarget. +/// +/// This function should be called by all bufferization passes using +/// BufferizeTypeConverter so that materializations work properly. One exception +/// is bufferization passes doing "full" conversions, where it can be desirable +/// for even the materializations to remain illegal so that they are eliminated, +/// such as via the patterns in +/// populateEliminateBufferizeMaterializationsPatterns. +void populateBufferizeMaterializationLegality(ConversionTarget &target); + +/// Populate patterns to eliminate bufferize materializations. +/// +/// In particular, these are the tensor_load/buffer_cast ops. +void populateEliminateBufferizeMaterializationsPatterns( + BufferizeTypeConverter &typeConverter, RewritePatternSet &patterns); + +/// Bufferize `op` and its nested ops that implement `BufferizableOpInterface`. +/// +/// Note: This function does not resolve read-after-write conflicts. Use this +/// function only if it is guaranteed that the input IR can bufferize without +/// additional buffer copies or set "options.copyBeforeWrite = true". The +/// general bufferization entry point is `runOneShotBufferize`. +LogicalResult bufferizeOp(Operation *op, const BufferizationOptions &options, + BufferizationStatistics *statistics = nullptr); + +/// Bufferize the signature of `block` and its callers (i.e., ops that have the +/// given block as a successor). All block argument types are changed to memref +/// types. All corresponding operands of all callers are wrapped in +/// bufferization.to_memref ops. All uses of bufferized tensor block arguments +/// are wrapped in bufferization.to_tensor ops. +/// +/// It is expected that all callers implement the `BranchOpInterface`. +/// Otherwise, this function will fail. The `BranchOpInterface` is used to query +/// the range of operands that are forwarded to this block. +/// +/// It is expected that the parent op of this block implements the +/// `BufferizableOpInterface`. The buffer types of tensor block arguments are +/// computed with `BufferizableOpIntercace::getBufferType`. +LogicalResult bufferizeBlockSignature(Block *block, RewriterBase &rewriter, + const BufferizationOptions &options); + +/// Return `BufferizationOptions` such that the `bufferizeOp` behaves like the +/// old (deprecated) partial, dialect conversion-based bufferization passes. A +/// copy will be inserted before every buffer write. +BufferizationOptions getPartialBufferizationOptions(); + +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_BUFFERIZE_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..0b91d3d675b7c93d2d8fa2b70729c5c897d7b61f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.h @@ -0,0 +1,78 @@ +//===- BufferizableOpInterfaceImpl.h - Impl. of BufferizableOpInterface ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_BUFFERIZATION_TRANSFORMS_FUNCBUFFERIZABLEOPINTERFACEIMPL_H +#define MLIR_BUFFERIZATION_TRANSFORMS_FUNCBUFFERIZABLEOPINTERFACEIMPL_H + +#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h" +#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" + +namespace mlir { +class DialectRegistry; + +namespace func { +class FuncOp; +} // namespace func + +namespace bufferization { +namespace func_ext { +/// The state of analysis of a FuncOp. +enum class FuncOpAnalysisState { NotAnalyzed, InProgress, Analyzed }; + +using func::FuncOp; + +/// Extra analysis state that is required for bufferization of function +/// boundaries. +struct FuncAnalysisState : public OneShotAnalysisState::Extension { + FuncAnalysisState(OneShotAnalysisState &state) + : OneShotAnalysisState::Extension(state) {} + + // Note: Function arguments and/or function return values may disappear during + // bufferization. Functions and their CallOps are analyzed and bufferized + // separately. To ensure that a CallOp analysis/bufferization can access an + // already bufferized function's analysis results, we store bbArg/return value + // indices instead of BlockArguments/OpOperand pointers. + + /// A set of block argument indices. + using BbArgIndexSet = DenseSet; + + /// A mapping of indices to indices. + using IndexMapping = DenseMap; + + /// A mapping of indices to a list of indices. + using IndexToIndexListMapping = DenseMap>; + + /// A mapping of ReturnOp OpOperand indices to equivalent FuncOp BBArg + /// indices. + DenseMap equivalentFuncArgs; + + /// A mapping of FuncOp BBArg indices to aliasing ReturnOp OpOperand indices. + DenseMap aliasingReturnVals; + + /// A set of all read BlockArguments of FuncOps. + DenseMap readBbArgs; + + /// A set of all written-to BlockArguments of FuncOps. + DenseMap writtenBbArgs; + + /// Keep track of which FuncOps are fully analyzed or currently being + /// analyzed. + DenseMap analyzedFuncOps; + + /// This function is called right before analyzing the given FuncOp. It + /// initializes the data structures for the FuncOp in this state object. + void startFunctionAnalysis(FuncOp funcOp); +}; + +void registerBufferizableOpInterfaceExternalModels(DialectRegistry ®istry); +} // namespace func_ext +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_BUFFERIZATION_TRANSFORMS_FUNCBUFFERIZABLEOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..a29af853eb21ba664c8e15bb90432059628949ec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h @@ -0,0 +1,279 @@ +//===- OneShotAnalysis.h - One-Shot (Single Pass) Analysis ------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTANALYSIS_H +#define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTANALYSIS_H + +#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h" +#include "llvm/ADT/EquivalenceClasses.h" +#include + +namespace mlir { +class DominanceInfo; + +namespace bufferization { + +struct OneShotBufferizationOptions; +struct BufferizationStatistics; +class OneShotAnalysisState; + +/// Options for analysis-enabled bufferization. +struct OneShotBufferizationOptions : public BufferizationOptions { + enum class AnalysisHeuristic { BottomUp, TopDown }; + + OneShotBufferizationOptions() = default; + + /// Specifies whether returning newly allocated memrefs from loops should be + /// allowed. Otherwise, a pass failure is triggered. + bool allowReturnAllocsFromLoops = false; + + /// Specifies whether the tensor IR should be annotated with alias sets. + bool dumpAliasSets = false; + + /// The heuristic controls the order in which ops are traversed during the + /// analysis. + AnalysisHeuristic analysisHeuristic = AnalysisHeuristic::BottomUp; + + /// Specify the functions that should not be analyzed. copyBeforeWrite will be + /// set to true when bufferizing them. + llvm::ArrayRef noAnalysisFuncFilter; +}; + +/// State for analysis-enabled bufferization. This class keeps track of alias +/// sets, equivalence sets, in-place OpOperands and other things. +/// +/// Note: Modifying the IR generally invalidates the result of the analysis. +/// Adding new operations is safe if they are analyzed subsequently. +class OneShotAnalysisState : public AnalysisState { +public: + OneShotAnalysisState(Operation *op, + const OneShotBufferizationOptions &options); + + OneShotAnalysisState(const OneShotAnalysisState &) = delete; + + ~OneShotAnalysisState() override = default; + + static bool classof(const AnalysisState *base) { + return base->getType() == TypeID::get(); + } + + /// Return a reference to the BufferizationOptions. + const OneShotBufferizationOptions &getOptions() const { + return static_cast( + AnalysisState::getOptions()); + } + + /// Analyze the given op and its nested ops. + LogicalResult analyzeOp(Operation *op, const DominanceInfo &domInfo); + + /// Analyze a single op (without nested ops). + LogicalResult analyzeSingleOp(Operation *op, const DominanceInfo &domInfo); + + /// Apply `fun` to all the members of the equivalence class of `v`. + void applyOnEquivalenceClass(Value v, function_ref fun) const; + + /// Apply `fun` to all aliases of `v`. + void applyOnAliases(Value v, function_ref fun) const; + + /// Return true if `v1` and `v2` bufferize to equivalent buffers. + bool areEquivalentBufferizedValues(Value v1, Value v2) const override; + + /// Return true if `v1` and `v2` may bufferize to aliasing buffers. + bool areAliasingBufferizedValues(Value v1, Value v2) const override; + + /// Mark the given OpOperand as in-place and merge the results' and operand's + /// aliasing sets. + void bufferizeInPlace(OpOperand &operand); + + /// Mark the given OpOperand as out-of-place. + void bufferizeOutOfPlace(OpOperand &operand); + + /// Add a new entry for `v` in the `aliasInfo` and `equivalentInfo`. In the + /// beginning the alias and equivalence sets only contain `v` itself. + void createAliasInfoEntry(Value v); + + /// Find all tensor values in the given operation that have undefined contents + /// and store them in `undefinedTensorUses`. + void gatherUndefinedTensorUses(Operation *op); + + int64_t getStatNumTensorOutOfPlace() const { return statNumTensorOutOfPlace; } + int64_t getStatNumTensorInPlace() const { return statNumTensorInPlace; } + + /// Return `true` if the given tensor has undefined contents. + bool hasUndefinedContents(OpOperand *opOperand) const override; + + /// Return `true` if the given OpResult has been decided to bufferize inplace. + bool isInPlace(OpOperand &opOperand) const override; + + /// Return true if the buffer of the given tensor value is written to. Must + /// not be called for values inside not yet analyzed functions. + bool isValueWritten(Value value) const; + + /// Return true if the buffer of the given tensor value is writable. + bool isWritable(Value value) const; + + /// Find the definitions of the given tensor value or retrieve them from the + /// cache. + const SetVector &findDefinitionsCached(Value value); + + /// Reset cached data structures. + void resetCache() override; + + /// Union the alias sets of `v1` and `v2`. + void unionAliasSets(Value v1, Value v2); + + /// Union the equivalence classes of `v1` and `v2`. + void unionEquivalenceClasses(Value v1, Value v2); + + /// Base class for OneShotAnalysisState extensions that allow + /// OneShotAnalysisState to contain user-specified information in the state + /// object. Clients are expected to derive this class, add the desired fields, + /// and make the derived class compatible with the MLIR TypeID mechanism. + /// + /// ```mlir + /// class MyExtension final : public OneShotAnalysisState::Extension { + /// public: + /// MyExtension(OneShotAnalysisState &state, int myData) + /// : Extension(state) {...} + /// private: + /// int mySupplementaryData; + /// }; + /// ``` + /// + /// Instances of this and derived classes are not expected to be created by + /// the user, instead they are directly constructed within a + /// OneShotAnalysisState. A OneShotAnalysisState can only contain one + /// extension with the given TypeID. Extensions can be obtained from a + /// OneShotAnalysisState instance. + /// + /// ```mlir + /// state.addExtension(/*myData=*/42); + /// MyExtension *ext = state.getExtension(); + /// ext->doSomething(); + /// ``` + class Extension { + // Allow OneShotAnalysisState to allocate Extensions. + friend class OneShotAnalysisState; + + public: + /// Base virtual destructor. + // Out-of-line definition ensures symbols are emitted in a single object + // file. + virtual ~Extension(); + + protected: + /// Constructs an extension of the given state object. + Extension(OneShotAnalysisState &state) : state(state) {} + + /// Provides read-only access to the parent OneShotAnalysisState object. + const OneShotAnalysisState &getAnalysisState() const { return state; } + + private: + /// Back-reference to the state that is being extended. + OneShotAnalysisState &state; + }; + + /// Adds a new Extension of the type specified as template parameter, + /// constructing it with the arguments provided. The extension is owned by the + /// OneShotAnalysisState. It is expected that the state does not already have + /// an extension of the same type. Extension constructors are expected to take + /// a reference to OneShotAnalysisState as first argument, automatically + /// supplied by this call. + template + Ty &addExtension(Args &&...args) { + static_assert( + std::is_base_of::value, + "only a class derived from OneShotAnalysisState::Extension is allowed"); + auto ptr = std::make_unique(*this, std::forward(args)...); + auto result = extensions.try_emplace(TypeID::get(), std::move(ptr)); + assert(result.second && "extension already added"); + return *static_cast(result.first->second.get()); + } + + /// Returns the extension of the specified type. + template + Ty *getExtension() { + static_assert( + std::is_base_of::value, + "only a class derived from OneShotAnalysisState::Extension is allowed"); + auto iter = extensions.find(TypeID::get()); + if (iter == extensions.end()) + return nullptr; + return static_cast(iter->second.get()); + } + + /// Returns the extension of the specified type. + template + const Ty *getExtension() const { + return const_cast(this)->getExtension(); + } + +private: + /// llvm::EquivalenceClasses wants comparable elements. This comparator uses + /// pointer comparison on the defining op. This is a poor man's comparison + /// but it's not like UnionFind needs ordering anyway. + struct ValueComparator { + bool operator()(const Value &lhs, const Value &rhs) const { + return lhs.getImpl() < rhs.getImpl(); + } + }; + + using EquivalenceClassRangeType = llvm::iterator_range< + llvm::EquivalenceClasses::member_iterator>; + /// Check that aliasInfo for `v` exists and return a reference to it. + EquivalenceClassRangeType getAliases(Value v) const; + + /// Cache definitions of tensor values. + DenseMap> cachedDefinitions; + + /// Set of all OpResults that were decided to bufferize in-place. + llvm::DenseSet inplaceBufferized; + + /// Auxiliary structure to store all the values a given value may alias with. + /// Alias information is "may be" conservative: In the presence of branches, a + /// value may alias with one of multiple other values. The concrete aliasing + /// value may not even be known at compile time. All such values are + /// considered to be aliases. + llvm::EquivalenceClasses aliasInfo; + + /// Auxiliary structure to store all the equivalent buffer classes. Equivalent + /// buffer information is "must be" conservative: Only if two values are + /// guaranteed to be equivalent at runtime, they said to be equivalent. It is + /// possible that, in the presence of branches, it cannot be determined + /// statically if two values are equivalent. In that case, the values are + /// considered to be not equivalent. + llvm::EquivalenceClasses equivalentInfo; + + // Bufferization statistics. + int64_t statNumTensorOutOfPlace = 0; + int64_t statNumTensorInPlace = 0; + + /// A set of uses of tensors that have undefined contents. + DenseSet undefinedTensorUses; + + /// Extensions attached to the state, identified by the TypeID of their type. + /// Only one extension of any given type is allowed. + DenseMap> extensions; +}; + +/// Analyze `op` and its nested ops. Bufferization decisions are stored in +/// `state`. +LogicalResult analyzeOp(Operation *op, OneShotAnalysisState &state, + BufferizationStatistics *statistics = nullptr); + +/// Run One-Shot Bufferize on the given op: Analysis + Bufferization +LogicalResult +runOneShotBufferize(Operation *op, const OneShotBufferizationOptions &options, + BufferizationStatistics *statistics = nullptr); + +} // namespace bufferization +} // namespace mlir + +MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::bufferization::OneShotAnalysisState) + +#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h new file mode 100644 index 0000000000000000000000000000000000000000..cd4c009a05bc9fed0367f87899a594283c90bfd5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h @@ -0,0 +1,55 @@ +//===- OneShotModuleBufferize.h - Bufferization across Func. Boundaries ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H +#define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H + +namespace mlir { + +struct LogicalResult; +class ModuleOp; + +namespace bufferization { +struct BufferizationStatistics; +class OneShotAnalysisState; +struct OneShotBufferizationOptions; + +/// Analyze `moduleOp` and its nested ops. Bufferization decisions are stored in +/// `state`. +LogicalResult analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state, + BufferizationStatistics *statistics = nullptr); + +/// Bufferize `op` and its nested ops that implement `BufferizableOpInterface`. +/// +/// Note: This function does not run One-Shot Analysis. No buffer copies are +/// inserted except two cases: +/// - `options.copyBeforeWrite` is set, in which case buffers are copied before +/// every write. +/// - `options.copyBeforeWrite` is not set and `options.noAnalysisFuncFilter` +/// is not empty. The FuncOps it contains were not analyzed. Buffer copies +/// will be inserted only to these FuncOps. +LogicalResult bufferizeModuleOp(ModuleOp moduleOp, + const OneShotBufferizationOptions &options, + BufferizationStatistics *statistics = nullptr); + +/// Remove bufferization attributes on every FuncOp arguments in the ModuleOp. +void removeBufferizationAttributesInModule(ModuleOp moduleOp); + +/// Run One-Shot Module Bufferization on the given module. Performs a simple +/// function call analysis to determine which function arguments are +/// inplaceable. Then analyzes and bufferizes FuncOps one-by-one with One-Shot +/// Bufferize. +LogicalResult runOneShotModuleBufferize( + ModuleOp moduleOp, + const bufferization::OneShotBufferizationOptions &options, + BufferizationStatistics *statistics = nullptr); + +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..a6f668b26aa10e43754ea19ec6301ef556a7bd6a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h @@ -0,0 +1,221 @@ +#ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_PASSES_H +#define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_PASSES_H + +#include "mlir/Pass/Pass.h" + +namespace mlir { +class FunctionOpInterface; +class ModuleOp; +class RewritePatternSet; +class OpBuilder; +class SymbolTable; + +namespace func { +class FuncOp; +} // namespace func + +namespace bufferization { +struct OneShotBufferizationOptions; + +//===----------------------------------------------------------------------===// +// Passes +//===----------------------------------------------------------------------===// + +#define GEN_PASS_DECL +#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc" + +/// Creates an instance of the BufferDeallocation pass to free all allocated +/// buffers. +std::unique_ptr createBufferDeallocationPass(); + +/// Creates an instance of the OwnershipBasedBufferDeallocation pass to free all +/// allocated buffers. +std::unique_ptr createOwnershipBasedBufferDeallocationPass( + bool privateFuncDynamicOwnership = false); + +/// Creates a pass that optimizes `bufferization.dealloc` operations. For +/// example, it reduces the number of alias checks needed at runtime using +/// static alias analysis. +std::unique_ptr createBufferDeallocationSimplificationPass(); + +/// Creates an instance of the LowerDeallocations pass to lower +/// `bufferization.dealloc` operations to the `memref` dialect. +std::unique_ptr createLowerDeallocationsPass(); + +/// Adds the conversion pattern of the `bufferization.dealloc` operation to the +/// given pattern set for use in other transformation passes. +void populateBufferizationDeallocLoweringPattern( + RewritePatternSet &patterns, func::FuncOp deallocLibraryFunc); + +/// Construct the library function needed for the fully generic +/// `bufferization.dealloc` lowering implemented in the LowerDeallocations pass. +/// The function can then be called at bufferization dealloc sites to determine +/// aliasing and ownership. +/// +/// The generated function takes two memrefs of indices and three memrefs of +/// booleans as arguments: +/// * The first argument A should contain the result of the +/// extract_aligned_pointer_as_index operation applied to the memrefs to be +/// deallocated +/// * The second argument B should contain the result of the +/// extract_aligned_pointer_as_index operation applied to the memrefs to be +/// retained +/// * The third argument C should contain the conditions as passed directly +/// to the deallocation operation. +/// * The fourth argument D is used to pass results to the caller. Those +/// represent the condition under which the memref at the corresponding +/// position in A should be deallocated. +/// * The fifth argument E is used to pass results to the caller. It +/// provides the ownership value corresponding the the memref at the same +/// position in B +/// +/// This helper function is supposed to be called once for each +/// `bufferization.dealloc` operation to determine the deallocation need and new +/// ownership indicator for the retained values, but does not perform the +/// deallocation itself. +/// +/// Generated code: +/// ``` +/// func.func @dealloc_helper( +/// %dyn_dealloc_base_pointer_list: memref, +/// %dyn_retain_base_pointer_list: memref, +/// %dyn_cond_list: memref, +/// %dyn_dealloc_cond_out: memref, +/// %dyn_ownership_out: memref) { +/// %c0 = arith.constant 0 : index +/// %c1 = arith.constant 1 : index +/// %true = arith.constant true +/// %false = arith.constant false +/// %num_dealloc_memrefs = memref.dim %dyn_dealloc_base_pointer_list, %c0 +/// %num_retain_memrefs = memref.dim %dyn_retain_base_pointer_list, %c0 +/// // Zero initialize result buffer. +/// scf.for %i = %c0 to %num_retain_memrefs step %c1 { +/// memref.store %false, %dyn_ownership_out[%i] : memref +/// } +/// scf.for %i = %c0 to %num_dealloc_memrefs step %c1 { +/// %dealloc_bp = memref.load %dyn_dealloc_base_pointer_list[%i] +/// %cond = memref.load %dyn_cond_list[%i] +/// // Check for aliasing with retained memrefs. +/// %does_not_alias_retained = scf.for %j = %c0 to %num_retain_memrefs +/// step %c1 iter_args(%does_not_alias_aggregated = %true) -> (i1) { +/// %retain_bp = memref.load %dyn_retain_base_pointer_list[%j] +/// %does_alias = arith.cmpi eq, %retain_bp, %dealloc_bp : index +/// scf.if %does_alias { +/// %curr_ownership = memref.load %dyn_ownership_out[%j] +/// %updated_ownership = arith.ori %curr_ownership, %cond : i1 +/// memref.store %updated_ownership, %dyn_ownership_out[%j] +/// } +/// %does_not_alias = arith.cmpi ne, %retain_bp, %dealloc_bp : index +/// %updated_aggregate = arith.andi %does_not_alias_aggregated, +/// %does_not_alias : i1 +/// scf.yield %updated_aggregate : i1 +/// } +/// // Check for aliasing with dealloc memrefs in the list before the +/// // current one, i.e., +/// // `fix i, forall j < i: check_aliasing(%dyn_dealloc_base_pointer[j], +/// // %dyn_dealloc_base_pointer[i])` +/// %does_not_alias_any = scf.for %j = %c0 to %i step %c1 +/// iter_args(%does_not_alias_agg = %does_not_alias_retained) -> (i1) { +/// %prev_dealloc_bp = memref.load %dyn_dealloc_base_pointer_list[%j] +/// %does_not_alias = arith.cmpi ne, %prev_dealloc_bp, %dealloc_bp +/// %updated_alias_agg = arith.andi %does_not_alias_agg, %does_not_alias +/// scf.yield %updated_alias_agg : i1 +/// } +/// %dealloc_cond = arith.andi %does_not_alias_any, %cond : i1 +/// memref.store %dealloc_cond, %dyn_dealloc_cond_out[%i] : memref +/// } +/// return +/// } +/// ``` +func::FuncOp buildDeallocationLibraryFunction(OpBuilder &builder, Location loc, + SymbolTable &symbolTable); + +/// Run buffer deallocation. +LogicalResult deallocateBuffers(Operation *op); + +/// Run ownership basedbuffer deallocation. +LogicalResult deallocateBuffersOwnershipBased(FunctionOpInterface op, + bool privateFuncDynamicOwnership); + +/// Creates a pass that moves allocations upwards to reduce the number of +/// required copies that are inserted during the BufferDeallocation pass. +std::unique_ptr createBufferHoistingPass(); + +/// Creates a pass that moves allocations upwards out of loops. This avoids +/// reallocations inside of loops. +std::unique_ptr createBufferLoopHoistingPass(); + +// Options struct for BufferResultsToOutParams pass. +// Note: defined only here, not in tablegen. +struct BufferResultsToOutParamsOptions { + // Filter function; returns true if the function should be converted. + // Defaults to true, i.e. all functions are converted. + llvm::function_ref filterFn = [](func::FuncOp *func) { + return true; + }; +}; + +/// Creates a pass that converts memref function results to out-params. +std::unique_ptr createBufferResultsToOutParamsPass( + const BufferResultsToOutParamsOptions &options = {}); + +/// Replace buffers that are returned from a function with an out parameter. +/// Also update all call sites. +LogicalResult +promoteBufferResultsToOutParams(ModuleOp module, + const BufferResultsToOutParamsOptions &options); + +/// Creates a pass that drops memref function results that are equivalent to a +/// function argument. +std::unique_ptr createDropEquivalentBufferResultsPass(); + +/// Create a pass that rewrites tensor.empty to bufferization.alloc_tensor. +std::unique_ptr createEmptyTensorToAllocTensorPass(); + +/// Drop all memref function results that are equivalent to a function argument. +LogicalResult dropEquivalentBufferResults(ModuleOp module); + +/// Creates a pass that finalizes a partial bufferization by removing remaining +/// bufferization.to_tensor and bufferization.to_memref operations. +std::unique_ptr> createFinalizingBufferizePass(); + +/// Create a pass that bufferizes all ops that implement BufferizableOpInterface +/// with One-Shot Bufferize. +std::unique_ptr createOneShotBufferizePass(); + +/// Create a pass that bufferizes all ops that implement BufferizableOpInterface +/// with One-Shot Bufferize and the specified bufferization options. +std::unique_ptr +createOneShotBufferizePass(const OneShotBufferizationOptions &options); + +/// Creates a pass that promotes heap-based allocations to stack-based ones. +/// Only buffers smaller than the provided size are promoted. +/// Dynamic shaped buffers are promoted up to the given rank. +std::unique_ptr +createPromoteBuffersToStackPass(unsigned maxAllocSizeInBytes = 1024, + unsigned maxRankOfAllocatedMemRef = 1); + +/// Creates a pass that promotes heap-based allocations to stack-based ones. +/// Only buffers smaller with `isSmallAlloc(alloc) == true` are promoted. +std::unique_ptr +createPromoteBuffersToStackPass(std::function isSmallAlloc); + +/// Create a pass that tries to eliminate tensor.empty ops that are anchored on +/// insert_slice ops. +std::unique_ptr createEmptyTensorEliminationPass(); + +/// Create a pass that bufferizes ops from the bufferization dialect. +std::unique_ptr createBufferizationBufferizePass(); + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc" + +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..d07eaf220b36d6c36b6334839395e749105bc342 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h.inc @@ -0,0 +1,1870 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_BUFFERDEALLOCATION +#define GEN_PASS_DECL_BUFFERDEALLOCATIONSIMPLIFICATION +#define GEN_PASS_DECL_BUFFERHOISTING +#define GEN_PASS_DECL_BUFFERLOOPHOISTING +#define GEN_PASS_DECL_BUFFERRESULTSTOOUTPARAMS +#define GEN_PASS_DECL_BUFFERIZATIONBUFFERIZE +#define GEN_PASS_DECL_DROPEQUIVALENTBUFFERRESULTS +#define GEN_PASS_DECL_EMPTYTENSORELIMINATION +#define GEN_PASS_DECL_EMPTYTENSORTOALLOCTENSOR +#define GEN_PASS_DECL_FINALIZINGBUFFERIZE +#define GEN_PASS_DECL_LOWERDEALLOCATIONS +#define GEN_PASS_DECL_ONESHOTBUFFERIZE +#define GEN_PASS_DECL_OWNERSHIPBASEDBUFFERDEALLOCATION +#define GEN_PASS_DECL_PROMOTEBUFFERSTOSTACK +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// BufferDeallocation +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BUFFERDEALLOCATION +#undef GEN_PASS_DECL_BUFFERDEALLOCATION +#endif // GEN_PASS_DECL_BUFFERDEALLOCATION +#ifdef GEN_PASS_DEF_BUFFERDEALLOCATION +namespace impl { + +template +class BufferDeallocationBase : public ::mlir::OperationPass { +public: + using Base = BufferDeallocationBase; + + BufferDeallocationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferDeallocationBase(const BufferDeallocationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-deallocation"); + } + ::llvm::StringRef getArgument() const override { return "buffer-deallocation"; } + + ::llvm::StringRef getDescription() const override { return "Adds all required dealloc operations for all allocations in the input program"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferDeallocation"); + } + ::llvm::StringRef getName() const override { return "BufferDeallocation"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferDeallocationBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BUFFERDEALLOCATION +#endif // GEN_PASS_DEF_BUFFERDEALLOCATION + +//===----------------------------------------------------------------------===// +// BufferDeallocationSimplification +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BUFFERDEALLOCATIONSIMPLIFICATION +#undef GEN_PASS_DECL_BUFFERDEALLOCATIONSIMPLIFICATION +#endif // GEN_PASS_DECL_BUFFERDEALLOCATIONSIMPLIFICATION +#ifdef GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATION +namespace impl { + +template +class BufferDeallocationSimplificationBase : public ::mlir::OperationPass<> { +public: + using Base = BufferDeallocationSimplificationBase; + + BufferDeallocationSimplificationBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + BufferDeallocationSimplificationBase(const BufferDeallocationSimplificationBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-deallocation-simplification"); + } + ::llvm::StringRef getArgument() const override { return "buffer-deallocation-simplification"; } + + ::llvm::StringRef getDescription() const override { return "Optimizes `bufferization.dealloc` operation for more efficient codegen"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferDeallocationSimplification"); + } + ::llvm::StringRef getName() const override { return "BufferDeallocationSimplification"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferDeallocationSimplificationBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATION +#endif // GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATION + +//===----------------------------------------------------------------------===// +// BufferHoisting +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BUFFERHOISTING +#undef GEN_PASS_DECL_BUFFERHOISTING +#endif // GEN_PASS_DECL_BUFFERHOISTING +#ifdef GEN_PASS_DEF_BUFFERHOISTING +namespace impl { + +template +class BufferHoistingBase : public ::mlir::OperationPass { +public: + using Base = BufferHoistingBase; + + BufferHoistingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferHoistingBase(const BufferHoistingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-hoisting"); + } + ::llvm::StringRef getArgument() const override { return "buffer-hoisting"; } + + ::llvm::StringRef getDescription() const override { return "Optimizes placement of allocation operations by moving them into common dominators and out of nested regions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferHoisting"); + } + ::llvm::StringRef getName() const override { return "BufferHoisting"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferHoistingBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BUFFERHOISTING +#endif // GEN_PASS_DEF_BUFFERHOISTING + +//===----------------------------------------------------------------------===// +// BufferLoopHoisting +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BUFFERLOOPHOISTING +#undef GEN_PASS_DECL_BUFFERLOOPHOISTING +#endif // GEN_PASS_DECL_BUFFERLOOPHOISTING +#ifdef GEN_PASS_DEF_BUFFERLOOPHOISTING +namespace impl { + +template +class BufferLoopHoistingBase : public ::mlir::OperationPass { +public: + using Base = BufferLoopHoistingBase; + + BufferLoopHoistingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferLoopHoistingBase(const BufferLoopHoistingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-loop-hoisting"); + } + ::llvm::StringRef getArgument() const override { return "buffer-loop-hoisting"; } + + ::llvm::StringRef getDescription() const override { return "Optimizes placement of allocation operations by moving them out of loop nests"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferLoopHoisting"); + } + ::llvm::StringRef getName() const override { return "BufferLoopHoisting"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferLoopHoistingBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BUFFERLOOPHOISTING +#endif // GEN_PASS_DEF_BUFFERLOOPHOISTING + +//===----------------------------------------------------------------------===// +// BufferResultsToOutParams +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BUFFERRESULTSTOOUTPARAMS +#undef GEN_PASS_DECL_BUFFERRESULTSTOOUTPARAMS +#endif // GEN_PASS_DECL_BUFFERRESULTSTOOUTPARAMS +#ifdef GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMS +namespace impl { + +template +class BufferResultsToOutParamsBase : public ::mlir::OperationPass { +public: + using Base = BufferResultsToOutParamsBase; + + BufferResultsToOutParamsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferResultsToOutParamsBase(const BufferResultsToOutParamsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-results-to-out-params"); + } + ::llvm::StringRef getArgument() const override { return "buffer-results-to-out-params"; } + + ::llvm::StringRef getDescription() const override { return "Converts memref-typed function results to out-params"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferResultsToOutParams"); + } + ::llvm::StringRef getName() const override { return "BufferResultsToOutParams"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferResultsToOutParamsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMS +#endif // GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMS + +//===----------------------------------------------------------------------===// +// BufferizationBufferize +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BUFFERIZATIONBUFFERIZE +#undef GEN_PASS_DECL_BUFFERIZATIONBUFFERIZE +#endif // GEN_PASS_DECL_BUFFERIZATIONBUFFERIZE +#ifdef GEN_PASS_DEF_BUFFERIZATIONBUFFERIZE +namespace impl { + +template +class BufferizationBufferizeBase : public ::mlir::OperationPass { +public: + using Base = BufferizationBufferizeBase; + + BufferizationBufferizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferizationBufferizeBase(const BufferizationBufferizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("bufferization-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "bufferization-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Bufferize the `bufferization` dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferizationBufferize"); + } + ::llvm::StringRef getName() const override { return "BufferizationBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferizationBufferizeBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BUFFERIZATIONBUFFERIZE +#endif // GEN_PASS_DEF_BUFFERIZATIONBUFFERIZE + +//===----------------------------------------------------------------------===// +// DropEquivalentBufferResults +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DROPEQUIVALENTBUFFERRESULTS +#undef GEN_PASS_DECL_DROPEQUIVALENTBUFFERRESULTS +#endif // GEN_PASS_DECL_DROPEQUIVALENTBUFFERRESULTS +#ifdef GEN_PASS_DEF_DROPEQUIVALENTBUFFERRESULTS +namespace impl { + +template +class DropEquivalentBufferResultsBase : public ::mlir::OperationPass { +public: + using Base = DropEquivalentBufferResultsBase; + + DropEquivalentBufferResultsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DropEquivalentBufferResultsBase(const DropEquivalentBufferResultsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("drop-equivalent-buffer-results"); + } + ::llvm::StringRef getArgument() const override { return "drop-equivalent-buffer-results"; } + + ::llvm::StringRef getDescription() const override { return "Remove MemRef return values that are equivalent to a bbArg"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DropEquivalentBufferResults"); + } + ::llvm::StringRef getName() const override { return "DropEquivalentBufferResults"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DropEquivalentBufferResultsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DROPEQUIVALENTBUFFERRESULTS +#endif // GEN_PASS_DEF_DROPEQUIVALENTBUFFERRESULTS + +//===----------------------------------------------------------------------===// +// EmptyTensorElimination +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EMPTYTENSORELIMINATION +#undef GEN_PASS_DECL_EMPTYTENSORELIMINATION +#endif // GEN_PASS_DECL_EMPTYTENSORELIMINATION +#ifdef GEN_PASS_DEF_EMPTYTENSORELIMINATION +namespace impl { + +template +class EmptyTensorEliminationBase : public ::mlir::OperationPass<> { +public: + using Base = EmptyTensorEliminationBase; + + EmptyTensorEliminationBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + EmptyTensorEliminationBase(const EmptyTensorEliminationBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("eliminate-empty-tensors"); + } + ::llvm::StringRef getArgument() const override { return "eliminate-empty-tensors"; } + + ::llvm::StringRef getDescription() const override { return "Try to eliminate all tensor.empty ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmptyTensorElimination"); + } + ::llvm::StringRef getName() const override { return "EmptyTensorElimination"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmptyTensorEliminationBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EMPTYTENSORELIMINATION +#endif // GEN_PASS_DEF_EMPTYTENSORELIMINATION + +//===----------------------------------------------------------------------===// +// EmptyTensorToAllocTensor +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EMPTYTENSORTOALLOCTENSOR +#undef GEN_PASS_DECL_EMPTYTENSORTOALLOCTENSOR +#endif // GEN_PASS_DECL_EMPTYTENSORTOALLOCTENSOR +#ifdef GEN_PASS_DEF_EMPTYTENSORTOALLOCTENSOR +namespace impl { + +template +class EmptyTensorToAllocTensorBase : public ::mlir::OperationPass<> { +public: + using Base = EmptyTensorToAllocTensorBase; + + EmptyTensorToAllocTensorBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + EmptyTensorToAllocTensorBase(const EmptyTensorToAllocTensorBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("empty-tensor-to-alloc-tensor"); + } + ::llvm::StringRef getArgument() const override { return "empty-tensor-to-alloc-tensor"; } + + ::llvm::StringRef getDescription() const override { return "Replace all empty ops by alloc_tensor ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmptyTensorToAllocTensor"); + } + ::llvm::StringRef getName() const override { return "EmptyTensorToAllocTensor"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmptyTensorToAllocTensorBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EMPTYTENSORTOALLOCTENSOR +#endif // GEN_PASS_DEF_EMPTYTENSORTOALLOCTENSOR + +//===----------------------------------------------------------------------===// +// FinalizingBufferize +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FINALIZINGBUFFERIZE +#undef GEN_PASS_DECL_FINALIZINGBUFFERIZE +#endif // GEN_PASS_DECL_FINALIZINGBUFFERIZE +#ifdef GEN_PASS_DEF_FINALIZINGBUFFERIZE +namespace impl { + +template +class FinalizingBufferizeBase : public ::mlir::OperationPass { +public: + using Base = FinalizingBufferizeBase; + + FinalizingBufferizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FinalizingBufferizeBase(const FinalizingBufferizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("finalizing-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "finalizing-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Finalize a partial bufferization"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FinalizingBufferize"); + } + ::llvm::StringRef getName() const override { return "FinalizingBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FinalizingBufferizeBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FINALIZINGBUFFERIZE +#endif // GEN_PASS_DEF_FINALIZINGBUFFERIZE + +//===----------------------------------------------------------------------===// +// LowerDeallocations +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LOWERDEALLOCATIONS +#undef GEN_PASS_DECL_LOWERDEALLOCATIONS +#endif // GEN_PASS_DECL_LOWERDEALLOCATIONS +#ifdef GEN_PASS_DEF_LOWERDEALLOCATIONS +namespace impl { + +template +class LowerDeallocationsBase : public ::mlir::OperationPass<> { +public: + using Base = LowerDeallocationsBase; + + LowerDeallocationsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LowerDeallocationsBase(const LowerDeallocationsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("bufferization-lower-deallocations"); + } + ::llvm::StringRef getArgument() const override { return "bufferization-lower-deallocations"; } + + ::llvm::StringRef getDescription() const override { return "Lowers `bufferization.dealloc` operations to `memref.dealloc`operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerDeallocations"); + } + ::llvm::StringRef getName() const override { return "LowerDeallocations"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerDeallocationsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LOWERDEALLOCATIONS +#endif // GEN_PASS_DEF_LOWERDEALLOCATIONS + +//===----------------------------------------------------------------------===// +// OneShotBufferize +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ONESHOTBUFFERIZE +struct OneShotBufferizeOptions { + bool allowReturnAllocsFromLoops = false; + bool allowUnknownOps = false; + unsigned analysisFuzzerSeed = 0; + std::string analysisHeuristic = "bottom-up"; + bool bufferizeFunctionBoundaries = 0; + bool copyBeforeWrite = false; + ::llvm::ArrayRef dialectFilter; + bool dumpAliasSets = false; + ::llvm::ArrayRef noAnalysisFuncFilter; + std::string functionBoundaryTypeConversion = "infer-layout-map"; + bool mustInferMemorySpace = false; + bool testAnalysisOnly = false; + bool printConflicts = false; + std::string unknownTypeConversion = "fully-dynamic-layout-map"; +}; +#undef GEN_PASS_DECL_ONESHOTBUFFERIZE +#endif // GEN_PASS_DECL_ONESHOTBUFFERIZE +#ifdef GEN_PASS_DEF_ONESHOTBUFFERIZE +namespace impl { + +template +class OneShotBufferizeBase : public ::mlir::OperationPass { +public: + using Base = OneShotBufferizeBase; + + OneShotBufferizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OneShotBufferizeBase(const OneShotBufferizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("one-shot-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "one-shot-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "One-Shot Bufferize"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OneShotBufferize"); + } + ::llvm::StringRef getName() const override { return "OneShotBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OneShotBufferizeBase) + + OneShotBufferizeBase(const OneShotBufferizeOptions &options) : OneShotBufferizeBase() { + allowReturnAllocsFromLoops = options.allowReturnAllocsFromLoops; + allowUnknownOps = options.allowUnknownOps; + analysisFuzzerSeed = options.analysisFuzzerSeed; + analysisHeuristic = options.analysisHeuristic; + bufferizeFunctionBoundaries = options.bufferizeFunctionBoundaries; + copyBeforeWrite = options.copyBeforeWrite; + dialectFilter = options.dialectFilter; + dumpAliasSets = options.dumpAliasSets; + noAnalysisFuncFilter = options.noAnalysisFuncFilter; + functionBoundaryTypeConversion = options.functionBoundaryTypeConversion; + mustInferMemorySpace = options.mustInferMemorySpace; + testAnalysisOnly = options.testAnalysisOnly; + printConflicts = options.printConflicts; + unknownTypeConversion = options.unknownTypeConversion; + } +protected: + ::mlir::Pass::Option allowReturnAllocsFromLoops{*this, "allow-return-allocs-from-loops", ::llvm::cl::desc("Allows returning/yielding new allocations from a loop."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option allowUnknownOps{*this, "allow-unknown-ops", ::llvm::cl::desc("Allows unknown (not bufferizable) ops in the input IR."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option analysisFuzzerSeed{*this, "analysis-fuzzer-seed", ::llvm::cl::desc("Test only: Analyze ops in random order with a given seed (fuzzer)"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option analysisHeuristic{*this, "analysis-heuristic", ::llvm::cl::desc("Heuristic that control the IR traversal during analysis"), ::llvm::cl::init("bottom-up")}; + ::mlir::Pass::Option bufferizeFunctionBoundaries{*this, "bufferize-function-boundaries", ::llvm::cl::desc("Bufferize function boundaries (experimental)."), ::llvm::cl::init(0)}; + ::mlir::Pass::Option copyBeforeWrite{*this, "copy-before-write", ::llvm::cl::desc("Skip the analysis. Make a buffer copy on every write."), ::llvm::cl::init(false)}; + ::mlir::Pass::ListOption dialectFilter{*this, "dialect-filter", ::llvm::cl::desc("Restrict bufferization to ops from these dialects.")}; + ::mlir::Pass::Option dumpAliasSets{*this, "dump-alias-sets", ::llvm::cl::desc("Test only: Annotate tensor IR with alias sets"), ::llvm::cl::init(false)}; + ::mlir::Pass::ListOption noAnalysisFuncFilter{*this, "no-analysis-func-filter", ::llvm::cl::desc("Skip analysis of functions with these symbol names.Set copyBeforeWrite to true when bufferizing them.")}; + ::mlir::Pass::Option functionBoundaryTypeConversion{*this, "function-boundary-type-conversion", ::llvm::cl::desc("Controls layout maps when bufferizing function signatures."), ::llvm::cl::init("infer-layout-map")}; + ::mlir::Pass::Option mustInferMemorySpace{*this, "must-infer-memory-space", ::llvm::cl::desc("The memory space of an memref types must always be inferred. If unset, a default memory space of 0 is used otherwise."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option testAnalysisOnly{*this, "test-analysis-only", ::llvm::cl::desc("Test only: Only run inplaceability analysis and annotate IR"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option printConflicts{*this, "print-conflicts", ::llvm::cl::desc("Test only: Annotate IR with RaW conflicts. Requires test-analysis-only."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option unknownTypeConversion{*this, "unknown-type-conversion", ::llvm::cl::desc("Controls layout maps for non-inferrable memref types."), ::llvm::cl::init("fully-dynamic-layout-map")}; + ::mlir::Pass::Statistic numBufferAlloc{this, "num-buffer-alloc", "Number of buffer allocations"}; + ::mlir::Pass::Statistic numTensorInPlace{this, "num-tensor-in-place", "Number of in-place tensor OpOperands"}; + ::mlir::Pass::Statistic numTensorOutOfPlace{this, "num-tensor-out-of-place", "Number of out-of-place tensor OpOperands"}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ONESHOTBUFFERIZE +#endif // GEN_PASS_DEF_ONESHOTBUFFERIZE + +//===----------------------------------------------------------------------===// +// OwnershipBasedBufferDeallocation +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_OWNERSHIPBASEDBUFFERDEALLOCATION +struct OwnershipBasedBufferDeallocationOptions { + bool privateFuncDynamicOwnership = false; +}; +#undef GEN_PASS_DECL_OWNERSHIPBASEDBUFFERDEALLOCATION +#endif // GEN_PASS_DECL_OWNERSHIPBASEDBUFFERDEALLOCATION +#ifdef GEN_PASS_DEF_OWNERSHIPBASEDBUFFERDEALLOCATION +namespace impl { + +template +class OwnershipBasedBufferDeallocationBase : public ::mlir::OperationPass<> { +public: + using Base = OwnershipBasedBufferDeallocationBase; + + OwnershipBasedBufferDeallocationBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + OwnershipBasedBufferDeallocationBase(const OwnershipBasedBufferDeallocationBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("ownership-based-buffer-deallocation"); + } + ::llvm::StringRef getArgument() const override { return "ownership-based-buffer-deallocation"; } + + ::llvm::StringRef getDescription() const override { return "Adds all required dealloc operations for all allocations in the input program"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OwnershipBasedBufferDeallocation"); + } + ::llvm::StringRef getName() const override { return "OwnershipBasedBufferDeallocation"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OwnershipBasedBufferDeallocationBase) + + OwnershipBasedBufferDeallocationBase(const OwnershipBasedBufferDeallocationOptions &options) : OwnershipBasedBufferDeallocationBase() { + privateFuncDynamicOwnership = options.privateFuncDynamicOwnership; + } +protected: + ::mlir::Pass::Option privateFuncDynamicOwnership{*this, "private-function-dynamic-ownership", ::llvm::cl::desc("Allows to add additional arguments to private functions to dynamically pass ownership of memrefs to callees. This can enable earlier deallocations."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_OWNERSHIPBASEDBUFFERDEALLOCATION +#endif // GEN_PASS_DEF_OWNERSHIPBASEDBUFFERDEALLOCATION + +//===----------------------------------------------------------------------===// +// PromoteBuffersToStack +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_PROMOTEBUFFERSTOSTACK +struct PromoteBuffersToStackOptions { + unsigned maxAllocSizeInBytes = 1024; + unsigned maxRankOfAllocatedMemRef = 1; +}; +#undef GEN_PASS_DECL_PROMOTEBUFFERSTOSTACK +#endif // GEN_PASS_DECL_PROMOTEBUFFERSTOSTACK +#ifdef GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK +namespace impl { + +template +class PromoteBuffersToStackBase : public ::mlir::OperationPass { +public: + using Base = PromoteBuffersToStackBase; + + PromoteBuffersToStackBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PromoteBuffersToStackBase(const PromoteBuffersToStackBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("promote-buffers-to-stack"); + } + ::llvm::StringRef getArgument() const override { return "promote-buffers-to-stack"; } + + ::llvm::StringRef getDescription() const override { return "Promotes heap-based allocations to automatically managed stack-based allocations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PromoteBuffersToStack"); + } + ::llvm::StringRef getName() const override { return "PromoteBuffersToStack"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PromoteBuffersToStackBase) + + PromoteBuffersToStackBase(const PromoteBuffersToStackOptions &options) : PromoteBuffersToStackBase() { + maxAllocSizeInBytes = options.maxAllocSizeInBytes; + maxRankOfAllocatedMemRef = options.maxRankOfAllocatedMemRef; + } +protected: + ::mlir::Pass::Option maxAllocSizeInBytes{*this, "max-alloc-size-in-bytes", ::llvm::cl::desc("Maximal size in bytes to promote allocations to stack."), ::llvm::cl::init(1024)}; + ::mlir::Pass::Option maxRankOfAllocatedMemRef{*this, "max-rank-of-allocated-memref", ::llvm::cl::desc("Maximal memref rank to promote dynamic buffers."), ::llvm::cl::init(1)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK +#endif // GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// BufferDeallocation Registration +//===----------------------------------------------------------------------===// + +inline void registerBufferDeallocation() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferDeallocationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBufferDeallocationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferDeallocationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// BufferDeallocationSimplification Registration +//===----------------------------------------------------------------------===// + +inline void registerBufferDeallocationSimplification() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferDeallocationSimplificationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBufferDeallocationSimplificationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferDeallocationSimplificationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// BufferHoisting Registration +//===----------------------------------------------------------------------===// + +inline void registerBufferHoisting() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferHoistingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBufferHoistingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferHoistingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// BufferLoopHoisting Registration +//===----------------------------------------------------------------------===// + +inline void registerBufferLoopHoisting() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferLoopHoistingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBufferLoopHoistingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferLoopHoistingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// BufferResultsToOutParams Registration +//===----------------------------------------------------------------------===// + +inline void registerBufferResultsToOutParams() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferResultsToOutParamsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBufferResultsToOutParamsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferResultsToOutParamsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// BufferizationBufferize Registration +//===----------------------------------------------------------------------===// + +inline void registerBufferizationBufferize() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferizationBufferizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBufferizationBufferizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createBufferizationBufferizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// DropEquivalentBufferResults Registration +//===----------------------------------------------------------------------===// + +inline void registerDropEquivalentBufferResults() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createDropEquivalentBufferResultsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDropEquivalentBufferResultsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createDropEquivalentBufferResultsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// EmptyTensorElimination Registration +//===----------------------------------------------------------------------===// + +inline void registerEmptyTensorElimination() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createEmptyTensorEliminationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerEmptyTensorEliminationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createEmptyTensorEliminationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// EmptyTensorToAllocTensor Registration +//===----------------------------------------------------------------------===// + +inline void registerEmptyTensorToAllocTensor() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createEmptyTensorToAllocTensorPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerEmptyTensorToAllocTensorPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createEmptyTensorToAllocTensorPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FinalizingBufferize Registration +//===----------------------------------------------------------------------===// + +inline void registerFinalizingBufferize() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createFinalizingBufferizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFinalizingBufferizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createFinalizingBufferizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// LowerDeallocations Registration +//===----------------------------------------------------------------------===// + +inline void registerLowerDeallocations() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createLowerDeallocationsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLowerDeallocationsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createLowerDeallocationsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// OneShotBufferize Registration +//===----------------------------------------------------------------------===// + +inline void registerOneShotBufferize() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createOneShotBufferizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerOneShotBufferizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createOneShotBufferizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// OwnershipBasedBufferDeallocation Registration +//===----------------------------------------------------------------------===// + +inline void registerOwnershipBasedBufferDeallocation() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createOwnershipBasedBufferDeallocationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerOwnershipBasedBufferDeallocationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createOwnershipBasedBufferDeallocationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// PromoteBuffersToStack Registration +//===----------------------------------------------------------------------===// + +inline void registerPromoteBuffersToStack() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createPromoteBuffersToStackPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerPromoteBuffersToStackPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::bufferization::createPromoteBuffersToStackPass(); + }); +} + +//===----------------------------------------------------------------------===// +// Bufferization Registration +//===----------------------------------------------------------------------===// + +inline void registerBufferizationPasses() { + registerBufferDeallocation(); + registerBufferDeallocationSimplification(); + registerBufferHoisting(); + registerBufferLoopHoisting(); + registerBufferResultsToOutParams(); + registerBufferizationBufferize(); + registerDropEquivalentBufferResults(); + registerEmptyTensorElimination(); + registerEmptyTensorToAllocTensor(); + registerFinalizingBufferize(); + registerLowerDeallocations(); + registerOneShotBufferize(); + registerOwnershipBasedBufferDeallocation(); + registerPromoteBuffersToStack(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class BufferDeallocationBase : public ::mlir::OperationPass { +public: + using Base = BufferDeallocationBase; + + BufferDeallocationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferDeallocationBase(const BufferDeallocationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-deallocation"); + } + ::llvm::StringRef getArgument() const override { return "buffer-deallocation"; } + + ::llvm::StringRef getDescription() const override { return "Adds all required dealloc operations for all allocations in the input program"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferDeallocation"); + } + ::llvm::StringRef getName() const override { return "BufferDeallocation"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferDeallocationBase) + +protected: +}; + +template +class BufferDeallocationSimplificationBase : public ::mlir::OperationPass<> { +public: + using Base = BufferDeallocationSimplificationBase; + + BufferDeallocationSimplificationBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + BufferDeallocationSimplificationBase(const BufferDeallocationSimplificationBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-deallocation-simplification"); + } + ::llvm::StringRef getArgument() const override { return "buffer-deallocation-simplification"; } + + ::llvm::StringRef getDescription() const override { return "Optimizes `bufferization.dealloc` operation for more efficient codegen"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferDeallocationSimplification"); + } + ::llvm::StringRef getName() const override { return "BufferDeallocationSimplification"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferDeallocationSimplificationBase) + +protected: +}; + +template +class BufferHoistingBase : public ::mlir::OperationPass { +public: + using Base = BufferHoistingBase; + + BufferHoistingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferHoistingBase(const BufferHoistingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-hoisting"); + } + ::llvm::StringRef getArgument() const override { return "buffer-hoisting"; } + + ::llvm::StringRef getDescription() const override { return "Optimizes placement of allocation operations by moving them into common dominators and out of nested regions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferHoisting"); + } + ::llvm::StringRef getName() const override { return "BufferHoisting"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferHoistingBase) + +protected: +}; + +template +class BufferLoopHoistingBase : public ::mlir::OperationPass { +public: + using Base = BufferLoopHoistingBase; + + BufferLoopHoistingBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferLoopHoistingBase(const BufferLoopHoistingBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-loop-hoisting"); + } + ::llvm::StringRef getArgument() const override { return "buffer-loop-hoisting"; } + + ::llvm::StringRef getDescription() const override { return "Optimizes placement of allocation operations by moving them out of loop nests"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferLoopHoisting"); + } + ::llvm::StringRef getName() const override { return "BufferLoopHoisting"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferLoopHoistingBase) + +protected: +}; + +template +class BufferResultsToOutParamsBase : public ::mlir::OperationPass { +public: + using Base = BufferResultsToOutParamsBase; + + BufferResultsToOutParamsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferResultsToOutParamsBase(const BufferResultsToOutParamsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-results-to-out-params"); + } + ::llvm::StringRef getArgument() const override { return "buffer-results-to-out-params"; } + + ::llvm::StringRef getDescription() const override { return "Converts memref-typed function results to out-params"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferResultsToOutParams"); + } + ::llvm::StringRef getName() const override { return "BufferResultsToOutParams"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferResultsToOutParamsBase) + +protected: +}; + +template +class BufferizationBufferizeBase : public ::mlir::OperationPass { +public: + using Base = BufferizationBufferizeBase; + + BufferizationBufferizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferizationBufferizeBase(const BufferizationBufferizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("bufferization-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "bufferization-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Bufferize the `bufferization` dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferizationBufferize"); + } + ::llvm::StringRef getName() const override { return "BufferizationBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferizationBufferizeBase) + +protected: +}; + +template +class DropEquivalentBufferResultsBase : public ::mlir::OperationPass { +public: + using Base = DropEquivalentBufferResultsBase; + + DropEquivalentBufferResultsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DropEquivalentBufferResultsBase(const DropEquivalentBufferResultsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("drop-equivalent-buffer-results"); + } + ::llvm::StringRef getArgument() const override { return "drop-equivalent-buffer-results"; } + + ::llvm::StringRef getDescription() const override { return "Remove MemRef return values that are equivalent to a bbArg"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DropEquivalentBufferResults"); + } + ::llvm::StringRef getName() const override { return "DropEquivalentBufferResults"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DropEquivalentBufferResultsBase) + +protected: +}; + +template +class EmptyTensorEliminationBase : public ::mlir::OperationPass<> { +public: + using Base = EmptyTensorEliminationBase; + + EmptyTensorEliminationBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + EmptyTensorEliminationBase(const EmptyTensorEliminationBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("eliminate-empty-tensors"); + } + ::llvm::StringRef getArgument() const override { return "eliminate-empty-tensors"; } + + ::llvm::StringRef getDescription() const override { return "Try to eliminate all tensor.empty ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmptyTensorElimination"); + } + ::llvm::StringRef getName() const override { return "EmptyTensorElimination"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmptyTensorEliminationBase) + +protected: +}; + +template +class EmptyTensorToAllocTensorBase : public ::mlir::OperationPass<> { +public: + using Base = EmptyTensorToAllocTensorBase; + + EmptyTensorToAllocTensorBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + EmptyTensorToAllocTensorBase(const EmptyTensorToAllocTensorBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("empty-tensor-to-alloc-tensor"); + } + ::llvm::StringRef getArgument() const override { return "empty-tensor-to-alloc-tensor"; } + + ::llvm::StringRef getDescription() const override { return "Replace all empty ops by alloc_tensor ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmptyTensorToAllocTensor"); + } + ::llvm::StringRef getName() const override { return "EmptyTensorToAllocTensor"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmptyTensorToAllocTensorBase) + +protected: +}; + +template +class FinalizingBufferizeBase : public ::mlir::OperationPass { +public: + using Base = FinalizingBufferizeBase; + + FinalizingBufferizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FinalizingBufferizeBase(const FinalizingBufferizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("finalizing-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "finalizing-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Finalize a partial bufferization"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FinalizingBufferize"); + } + ::llvm::StringRef getName() const override { return "FinalizingBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FinalizingBufferizeBase) + +protected: +}; + +template +class LowerDeallocationsBase : public ::mlir::OperationPass<> { +public: + using Base = LowerDeallocationsBase; + + LowerDeallocationsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LowerDeallocationsBase(const LowerDeallocationsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("bufferization-lower-deallocations"); + } + ::llvm::StringRef getArgument() const override { return "bufferization-lower-deallocations"; } + + ::llvm::StringRef getDescription() const override { return "Lowers `bufferization.dealloc` operations to `memref.dealloc`operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerDeallocations"); + } + ::llvm::StringRef getName() const override { return "LowerDeallocations"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerDeallocationsBase) + +protected: +}; + +template +class OneShotBufferizeBase : public ::mlir::OperationPass { +public: + using Base = OneShotBufferizeBase; + + OneShotBufferizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OneShotBufferizeBase(const OneShotBufferizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("one-shot-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "one-shot-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "One-Shot Bufferize"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OneShotBufferize"); + } + ::llvm::StringRef getName() const override { return "OneShotBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OneShotBufferizeBase) + +protected: + ::mlir::Pass::Option allowReturnAllocsFromLoops{*this, "allow-return-allocs-from-loops", ::llvm::cl::desc("Allows returning/yielding new allocations from a loop."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option allowUnknownOps{*this, "allow-unknown-ops", ::llvm::cl::desc("Allows unknown (not bufferizable) ops in the input IR."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option analysisFuzzerSeed{*this, "analysis-fuzzer-seed", ::llvm::cl::desc("Test only: Analyze ops in random order with a given seed (fuzzer)"), ::llvm::cl::init(0)}; + ::mlir::Pass::Option analysisHeuristic{*this, "analysis-heuristic", ::llvm::cl::desc("Heuristic that control the IR traversal during analysis"), ::llvm::cl::init("bottom-up")}; + ::mlir::Pass::Option bufferizeFunctionBoundaries{*this, "bufferize-function-boundaries", ::llvm::cl::desc("Bufferize function boundaries (experimental)."), ::llvm::cl::init(0)}; + ::mlir::Pass::Option copyBeforeWrite{*this, "copy-before-write", ::llvm::cl::desc("Skip the analysis. Make a buffer copy on every write."), ::llvm::cl::init(false)}; + ::mlir::Pass::ListOption dialectFilter{*this, "dialect-filter", ::llvm::cl::desc("Restrict bufferization to ops from these dialects.")}; + ::mlir::Pass::Option dumpAliasSets{*this, "dump-alias-sets", ::llvm::cl::desc("Test only: Annotate tensor IR with alias sets"), ::llvm::cl::init(false)}; + ::mlir::Pass::ListOption noAnalysisFuncFilter{*this, "no-analysis-func-filter", ::llvm::cl::desc("Skip analysis of functions with these symbol names.Set copyBeforeWrite to true when bufferizing them.")}; + ::mlir::Pass::Option functionBoundaryTypeConversion{*this, "function-boundary-type-conversion", ::llvm::cl::desc("Controls layout maps when bufferizing function signatures."), ::llvm::cl::init("infer-layout-map")}; + ::mlir::Pass::Option mustInferMemorySpace{*this, "must-infer-memory-space", ::llvm::cl::desc("The memory space of an memref types must always be inferred. If unset, a default memory space of 0 is used otherwise."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option testAnalysisOnly{*this, "test-analysis-only", ::llvm::cl::desc("Test only: Only run inplaceability analysis and annotate IR"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option printConflicts{*this, "print-conflicts", ::llvm::cl::desc("Test only: Annotate IR with RaW conflicts. Requires test-analysis-only."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option unknownTypeConversion{*this, "unknown-type-conversion", ::llvm::cl::desc("Controls layout maps for non-inferrable memref types."), ::llvm::cl::init("fully-dynamic-layout-map")}; + ::mlir::Pass::Statistic numBufferAlloc{this, "num-buffer-alloc", "Number of buffer allocations"}; + ::mlir::Pass::Statistic numTensorInPlace{this, "num-tensor-in-place", "Number of in-place tensor OpOperands"}; + ::mlir::Pass::Statistic numTensorOutOfPlace{this, "num-tensor-out-of-place", "Number of out-of-place tensor OpOperands"}; +}; + +template +class OwnershipBasedBufferDeallocationBase : public ::mlir::OperationPass<> { +public: + using Base = OwnershipBasedBufferDeallocationBase; + + OwnershipBasedBufferDeallocationBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + OwnershipBasedBufferDeallocationBase(const OwnershipBasedBufferDeallocationBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("ownership-based-buffer-deallocation"); + } + ::llvm::StringRef getArgument() const override { return "ownership-based-buffer-deallocation"; } + + ::llvm::StringRef getDescription() const override { return "Adds all required dealloc operations for all allocations in the input program"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OwnershipBasedBufferDeallocation"); + } + ::llvm::StringRef getName() const override { return "OwnershipBasedBufferDeallocation"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OwnershipBasedBufferDeallocationBase) + +protected: + ::mlir::Pass::Option privateFuncDynamicOwnership{*this, "private-function-dynamic-ownership", ::llvm::cl::desc("Allows to add additional arguments to private functions to dynamically pass ownership of memrefs to callees. This can enable earlier deallocations."), ::llvm::cl::init(false)}; +}; + +template +class PromoteBuffersToStackBase : public ::mlir::OperationPass { +public: + using Base = PromoteBuffersToStackBase; + + PromoteBuffersToStackBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PromoteBuffersToStackBase(const PromoteBuffersToStackBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("promote-buffers-to-stack"); + } + ::llvm::StringRef getArgument() const override { return "promote-buffers-to-stack"; } + + ::llvm::StringRef getDescription() const override { return "Promotes heap-based allocations to automatically managed stack-based allocations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PromoteBuffersToStack"); + } + ::llvm::StringRef getName() const override { return "PromoteBuffersToStack"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PromoteBuffersToStackBase) + +protected: + ::mlir::Pass::Option maxAllocSizeInBytes{*this, "max-alloc-size-in-bytes", ::llvm::cl::desc("Maximal size in bytes to promote allocations to stack."), ::llvm::cl::init(1024)}; + ::mlir::Pass::Option maxRankOfAllocatedMemRef{*this, "max-rank-of-allocated-memref", ::llvm::cl::desc("Maximal memref rank to promote dynamic buffers."), ::llvm::cl::init(1)}; +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..892675954493b994a97b1be1a360a47b5965f76f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Bufferization/Transforms/Transforms.h @@ -0,0 +1,68 @@ +//===- Transforms.h - Bufferization and related transforms ------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_TRANSFORMS_H +#define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_TRANSFORMS_H + +#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h" +#include "mlir/IR/Operation.h" + +namespace mlir { +namespace bufferization { +class AnalysisState; +struct BufferizationStatistics; +class OneShotAnalysisState; +struct OneShotBufferizationOptions; + +/// Try to eliminate "tensor.empty" ops inside `op`. This transformation looks +/// for subset ops that insert a tensor that originates from a "tensor.empty" +/// (as per the reverse use-def chain). Such "tensor.empty" ops are replaced +/// with the destination subset. +/// +/// E.g.: +/// %0 = tensor.empty() : tensor<10xf32> +/// %1 = linalg.fill ... outs(%0 : tensor<10xf32>) +/// %2 = tensor.insert_slice %0 into %t ... +/// +/// In the above example, the subset op is "tensor.insert_slice". When tracing +/// back the reverse use-def chain of a the source, we end up at a +/// "tensor.empty" op. +LogicalResult eliminateEmptyTensors(RewriterBase &rewriter, Operation *op); + +/// Try to eliminate "tensor.empty" ops inside `op`. +/// +/// This function overload accepts an existing `OneShotAnalysisState`, which +/// contains in-place bufferization decisions. This overload is useful if an +/// existing analysis should be reused for empty tensor elimination. +LogicalResult eliminateEmptyTensors(RewriterBase &rewriter, Operation *op, + OneShotAnalysisState &state); + +/// Within the given operation, hoist buffers from loops where possible. See +/// "BufferLoopHoistingPass" for more information. +void hoistBuffersFromLoops(Operation *op); + +/// Resolve RaW and other conflicts by inserting bufferization.alloc_tensor ops. +/// After applying this transform, the IR can be bufferized without inserting +/// additional buffer allocations. +LogicalResult insertTensorCopies(Operation *op, + const OneShotBufferizationOptions &options, + BufferizationStatistics *statistics = nullptr); + +/// Resolve RaW and other conflicts by inserting bufferization.alloc_tensor ops. +/// After applying this transform, the IR can be bufferized without inserting +/// additional buffer allocations. +LogicalResult insertTensorCopies(Operation *op, const AnalysisState &state); + +/// Populate patterns to lower tensor.empty ops to bufferization.alloc_tensor +/// ops. +void populateEmptyTensorToAllocTensorPattern(RewritePatternSet &patterns); + +} // namespace bufferization +} // namespace mlir + +#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_TRANSFORMS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/CommonFolders.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/CommonFolders.h new file mode 100644 index 0000000000000000000000000000000000000000..7dabc781cd59526fd0c7248bb9486ee12914ba05 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/CommonFolders.h @@ -0,0 +1,326 @@ +//===- CommonFolders.h - Common Operation Folders----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file declares various common operation folders. These folders +// are intended to be used by dialects to support common folding behavior +// without requiring each dialect to provide its own implementation. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_COMMONFOLDERS_H +#define MLIR_DIALECT_COMMONFOLDERS_H + +#include "mlir/IR/BuiltinAttributes.h" +#include "mlir/IR/BuiltinTypes.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/STLExtras.h" +#include + +namespace mlir { +namespace ub { +class PoisonAttr; +} +/// Performs constant folding `calculate` with element-wise behavior on the two +/// attributes in `operands` and returns the result if possible. +/// Uses `resultType` for the type of the returned attribute. +/// Optional PoisonAttr template argument allows to specify 'poison' attribute +/// which will be directly propagated to result. +template (ElementValueT, ElementValueT)>> +Attribute constFoldBinaryOpConditional(ArrayRef operands, + Type resultType, + CalculationT &&calculate) { + assert(operands.size() == 2 && "binary op takes two operands"); + static_assert( + std::is_void_v || !llvm::is_incomplete_v, + "PoisonAttr is undefined, either add a dependency on UB dialect or pass " + "void as template argument to opt-out from poison semantics."); + if constexpr (!std::is_void_v) { + if (isa_and_nonnull(operands[0])) + return operands[0]; + + if (isa_and_nonnull(operands[1])) + return operands[1]; + } + + if (!resultType || !operands[0] || !operands[1]) + return {}; + + if (isa(operands[0]) && isa(operands[1])) { + auto lhs = cast(operands[0]); + auto rhs = cast(operands[1]); + if (lhs.getType() != rhs.getType()) + return {}; + + auto calRes = calculate(lhs.getValue(), rhs.getValue()); + + if (!calRes) + return {}; + + return AttrElementT::get(resultType, *calRes); + } + + if (isa(operands[0]) && + isa(operands[1])) { + // Both operands are splats so we can avoid expanding the values out and + // just fold based on the splat value. + auto lhs = cast(operands[0]); + auto rhs = cast(operands[1]); + if (lhs.getType() != rhs.getType()) + return {}; + + auto elementResult = calculate(lhs.getSplatValue(), + rhs.getSplatValue()); + if (!elementResult) + return {}; + + return DenseElementsAttr::get(cast(resultType), *elementResult); + } + + if (isa(operands[0]) && isa(operands[1])) { + // Operands are ElementsAttr-derived; perform an element-wise fold by + // expanding the values. + auto lhs = cast(operands[0]); + auto rhs = cast(operands[1]); + if (lhs.getType() != rhs.getType()) + return {}; + + auto maybeLhsIt = lhs.try_value_begin(); + auto maybeRhsIt = rhs.try_value_begin(); + if (!maybeLhsIt || !maybeRhsIt) + return {}; + auto lhsIt = *maybeLhsIt; + auto rhsIt = *maybeRhsIt; + SmallVector elementResults; + elementResults.reserve(lhs.getNumElements()); + for (size_t i = 0, e = lhs.getNumElements(); i < e; ++i, ++lhsIt, ++rhsIt) { + auto elementResult = calculate(*lhsIt, *rhsIt); + if (!elementResult) + return {}; + elementResults.push_back(*elementResult); + } + + return DenseElementsAttr::get(cast(resultType), elementResults); + } + return {}; +} + +/// Performs constant folding `calculate` with element-wise behavior on the two +/// attributes in `operands` and returns the result if possible. +/// Uses the operand element type for the element type of the returned +/// attribute. +/// Optional PoisonAttr template argument allows to specify 'poison' attribute +/// which will be directly propagated to result. +template (ElementValueT, ElementValueT)>> +Attribute constFoldBinaryOpConditional(ArrayRef operands, + CalculationT &&calculate) { + assert(operands.size() == 2 && "binary op takes two operands"); + static_assert( + std::is_void_v || !llvm::is_incomplete_v, + "PoisonAttr is undefined, either add a dependency on UB dialect or pass " + "void as template argument to opt-out from poison semantics."); + if constexpr (!std::is_void_v) { + if (isa_and_nonnull(operands[0])) + return operands[0]; + + if (isa_and_nonnull(operands[1])) + return operands[1]; + } + + auto getResultType = [](Attribute attr) -> Type { + if (auto typed = dyn_cast_or_null(attr)) + return typed.getType(); + return {}; + }; + + Type lhsType = getResultType(operands[0]); + Type rhsType = getResultType(operands[1]); + if (!lhsType || !rhsType) + return {}; + if (lhsType != rhsType) + return {}; + + return constFoldBinaryOpConditional( + operands, lhsType, std::forward(calculate)); +} + +template > +Attribute constFoldBinaryOp(ArrayRef operands, Type resultType, + CalculationT &&calculate) { + return constFoldBinaryOpConditional( + operands, resultType, + [&](ElementValueT a, ElementValueT b) -> std::optional { + return calculate(a, b); + }); +} + +template > +Attribute constFoldBinaryOp(ArrayRef operands, + CalculationT &&calculate) { + return constFoldBinaryOpConditional( + operands, + [&](ElementValueT a, ElementValueT b) -> std::optional { + return calculate(a, b); + }); +} + +/// Performs constant folding `calculate` with element-wise behavior on the one +/// attributes in `operands` and returns the result if possible. +/// Optional PoisonAttr template argument allows to specify 'poison' attribute +/// which will be directly propagated to result. +template (ElementValueT)>> +Attribute constFoldUnaryOpConditional(ArrayRef operands, + CalculationT &&calculate) { + assert(operands.size() == 1 && "unary op takes one operands"); + if (!operands[0]) + return {}; + + static_assert( + std::is_void_v || !llvm::is_incomplete_v, + "PoisonAttr is undefined, either add a dependency on UB dialect or pass " + "void as template argument to opt-out from poison semantics."); + if constexpr (!std::is_void_v) { + if (isa(operands[0])) + return operands[0]; + } + + if (isa(operands[0])) { + auto op = cast(operands[0]); + + auto res = calculate(op.getValue()); + if (!res) + return {}; + return AttrElementT::get(op.getType(), *res); + } + if (isa(operands[0])) { + // Both operands are splats so we can avoid expanding the values out and + // just fold based on the splat value. + auto op = cast(operands[0]); + + auto elementResult = calculate(op.getSplatValue()); + if (!elementResult) + return {}; + return DenseElementsAttr::get(op.getType(), *elementResult); + } else if (isa(operands[0])) { + // Operands are ElementsAttr-derived; perform an element-wise fold by + // expanding the values. + auto op = cast(operands[0]); + + auto maybeOpIt = op.try_value_begin(); + if (!maybeOpIt) + return {}; + auto opIt = *maybeOpIt; + SmallVector elementResults; + elementResults.reserve(op.getNumElements()); + for (size_t i = 0, e = op.getNumElements(); i < e; ++i, ++opIt) { + auto elementResult = calculate(*opIt); + if (!elementResult) + return {}; + elementResults.push_back(*elementResult); + } + return DenseElementsAttr::get(op.getShapedType(), elementResults); + } + return {}; +} + +template > +Attribute constFoldUnaryOp(ArrayRef operands, + CalculationT &&calculate) { + return constFoldUnaryOpConditional( + operands, [&](ElementValueT a) -> std::optional { + return calculate(a); + }); +} + +template < + class AttrElementT, class TargetAttrElementT, + class ElementValueT = typename AttrElementT::ValueType, + class TargetElementValueT = typename TargetAttrElementT::ValueType, + class PoisonAttr = ub::PoisonAttr, + class CalculationT = function_ref> +Attribute constFoldCastOp(ArrayRef operands, Type resType, + CalculationT &&calculate) { + assert(operands.size() == 1 && "Cast op takes one operand"); + if (!operands[0]) + return {}; + + static_assert( + std::is_void_v || !llvm::is_incomplete_v, + "PoisonAttr is undefined, either add a dependency on UB dialect or pass " + "void as template argument to opt-out from poison semantics."); + if constexpr (!std::is_void_v) { + if (isa(operands[0])) + return operands[0]; + } + + if (isa(operands[0])) { + auto op = cast(operands[0]); + bool castStatus = true; + auto res = calculate(op.getValue(), castStatus); + if (!castStatus) + return {}; + return TargetAttrElementT::get(resType, res); + } + if (isa(operands[0])) { + // The operand is a splat so we can avoid expanding the values out and + // just fold based on the splat value. + auto op = cast(operands[0]); + bool castStatus = true; + auto elementResult = + calculate(op.getSplatValue(), castStatus); + if (!castStatus) + return {}; + return DenseElementsAttr::get(cast(resType), elementResult); + } + if (auto op = dyn_cast(operands[0])) { + // Operand is ElementsAttr-derived; perform an element-wise fold by + // expanding the value. + bool castStatus = true; + auto maybeOpIt = op.try_value_begin(); + if (!maybeOpIt) + return {}; + auto opIt = *maybeOpIt; + SmallVector elementResults; + elementResults.reserve(op.getNumElements()); + for (size_t i = 0, e = op.getNumElements(); i < e; ++i, ++opIt) { + auto elt = calculate(*opIt, castStatus); + if (!castStatus) + return {}; + elementResults.push_back(elt); + } + + return DenseElementsAttr::get(cast(resType), elementResults); + } + return {}; +} +} // namespace mlir + +#endif // MLIR_DIALECT_COMMONFOLDERS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/Complex.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/Complex.h new file mode 100644 index 0000000000000000000000000000000000000000..fb024fa2e951ea91c149303b0715c0a9c77c4af2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/Complex.h @@ -0,0 +1,35 @@ +//===- Complex.h - Complex dialect --------------------------------*- C++-*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_COMPLEX_IR_COMPLEX_H_ +#define MLIR_DIALECT_COMPLEX_IR_COMPLEX_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +//===----------------------------------------------------------------------===// +// Complex Dialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Complex/IR/ComplexOpsDialect.h.inc" + +//===----------------------------------------------------------------------===// +// Complex Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/Complex/IR/ComplexOps.h.inc" + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/Complex/IR/ComplexAttributes.h.inc" + +#endif // MLIR_DIALECT_COMPLEX_IR_COMPLEX_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..70b728ea9c33a19232c3b16ecd07e6e6d9621174 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.cpp.inc @@ -0,0 +1,140 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::complex::NumberAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::complex::NumberAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::complex::NumberAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::complex::NumberAttr>([&](auto t) { + printer << ::mlir::complex::NumberAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace complex { +namespace detail { +struct NumberAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::llvm::APFloat, ::llvm::APFloat, ::mlir::Type>; + NumberAttrStorage(::llvm::APFloat real, ::llvm::APFloat imag, ::mlir::Type type) : real(std::move(real)), imag(std::move(imag)), type(std::move(type)) {} + + KeyTy getAsKey() const { + return KeyTy(real, imag, type); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (real.bitwiseIsEqual(std::get<0>(tblgenKey))) && (imag.bitwiseIsEqual(std::get<1>(tblgenKey))) && (type == std::get<2>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); + } + + static NumberAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto real = std::move(std::get<0>(tblgenKey)); + auto imag = std::move(std::get<1>(tblgenKey)); + auto type = std::move(std::get<2>(tblgenKey)); + return new (allocator.allocate()) NumberAttrStorage(std::move(real), std::move(imag), std::move(type)); + } + + ::llvm::APFloat real; + ::llvm::APFloat imag; + ::mlir::Type type; +}; +} // namespace detail +NumberAttr NumberAttr::get(mlir::ComplexType type, double real, double imag) { + auto elementType = ::llvm::cast(type.getElementType()); + APFloat realFloat(real); + bool unused; + realFloat.convert(elementType.getFloatSemantics(), + APFloat::rmNearestTiesToEven, &unused); + APFloat imagFloat(imag); + imagFloat.convert(elementType.getFloatSemantics(), + APFloat::rmNearestTiesToEven, &unused); + return Base::get(type.getContext(), realFloat, imagFloat, type); +} + +NumberAttr NumberAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, mlir::ComplexType type, double real, double imag) { + auto elementType = ::llvm::cast(type.getElementType()); + APFloat realFloat(real); + bool unused; + realFloat.convert(elementType.getFloatSemantics(), + APFloat::rmNearestTiesToEven, &unused); + APFloat imagFloat(imag); + imagFloat.convert(elementType.getFloatSemantics(), + APFloat::rmNearestTiesToEven, &unused); + return Base::getChecked(emitError, type.getContext(), realFloat, imagFloat, type); +} + +::llvm::APFloat NumberAttr::getReal() const { + return getImpl()->real; +} + +::llvm::APFloat NumberAttr::getImag() const { + return getImpl()->imag; +} + +::mlir::Type NumberAttr::getType() const { + return getImpl()->type; +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::NumberAttr) +namespace mlir { +namespace complex { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute ComplexDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void ComplexDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace complex +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..f433551b9db1b6be6ff6d31d6e1777a18cc5f871 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.h.inc @@ -0,0 +1,48 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace complex { +class NumberAttr; +namespace detail { +struct NumberAttrStorage; +} // namespace detail +class NumberAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + std::complex getValue() { + return std::complex(getReal(), getImag()); + } + using Base::getChecked; + static NumberAttr get(mlir::ComplexType type, double real, double imag); + static NumberAttr getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, mlir::ComplexType type, double real, double imag); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::APFloat real, ::llvm::APFloat imag, ::mlir::Type type); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"number"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::APFloat getReal() const; + ::llvm::APFloat getImag() const; + ::mlir::Type getType() const; +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::NumberAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..73a014173ad06d96b740608e498e3fe4f7837800 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.cpp.inc @@ -0,0 +1,10435 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ComplexOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::complex::AbsOp, +::mlir::complex::AddOp, +::mlir::complex::AngleOp, +::mlir::complex::Atan2Op, +::mlir::complex::BitcastOp, +::mlir::complex::ConjOp, +::mlir::complex::ConstantOp, +::mlir::complex::CosOp, +::mlir::complex::CreateOp, +::mlir::complex::DivOp, +::mlir::complex::EqualOp, +::mlir::complex::ExpOp, +::mlir::complex::Expm1Op, +::mlir::complex::ImOp, +::mlir::complex::Log1pOp, +::mlir::complex::LogOp, +::mlir::complex::MulOp, +::mlir::complex::NegOp, +::mlir::complex::NotEqualOp, +::mlir::complex::PowOp, +::mlir::complex::ReOp, +::mlir::complex::RsqrtOp, +::mlir::complex::SignOp, +::mlir::complex::SinOp, +::mlir::complex::SqrtOp, +::mlir::complex::SubOp, +::mlir::complex::TanOp, +::mlir::complex::TanhOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace complex { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ComplexOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::ComplexType>(type))) && ((::llvm::isa<::mlir::FloatType>(::llvm::cast<::mlir::ComplexType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be complex type with floating-point elements, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ComplexOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::FloatType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be floating-point, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ComplexOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ComplexOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ComplexOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Floating point fast math flags"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ComplexOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ComplexOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ComplexOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::ArrayAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ComplexOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ComplexOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::AbsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AbsOpGenericAdaptorBase::AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.abs", odsAttrs.getContext()); +} + +AbsOpGenericAdaptorBase::AbsOpGenericAdaptorBase(AbsOp op) : AbsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AbsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AbsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr AbsOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags AbsOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +AbsOpAdaptor::AbsOpAdaptor(AbsOp op) : AbsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AbsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.abs' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair AbsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AbsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> AbsOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AbsOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AbsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AbsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> AbsOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AbsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AbsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AbsOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional AbsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void AbsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AbsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult AbsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AbsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AbsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr AbsOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags AbsOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void AbsOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void AbsOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AbsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AbsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AbsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AbsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void AbsOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult AbsOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that complex element type matches result type"); + return ::mlir::success(); +} + +::mlir::LogicalResult AbsOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AbsOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::llvm::cast(operands[0].getType()).getElementType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AbsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + for (::mlir::Type type : complexTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::ComplexType>(type))) && ((::llvm::isa<::mlir::FloatType>(::llvm::cast<::mlir::ComplexType>(type).getElementType()))))) { + return parser.emitError(parser.getNameLoc()) << "'complex' must be complex type with floating-point elements, but got " << type; + } + } + result.addTypes(::llvm::cast(complexTypes[0]).getElementType()); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AbsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AbsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::AbsOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::AddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.add", odsAttrs.getContext()); +} + +AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(AddOp op) : AddOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr AddOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags AddOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +AddOpAdaptor::AddOpAdaptor(AddOp op) : AddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.add' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair AddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> AddOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ComplexType> AddOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AddOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AddOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> AddOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AddOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AddOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional AddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void AddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult AddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr AddOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags AddOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void AddOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void AddOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void AddOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult AddOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AddOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::AddOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::AngleOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AngleOpGenericAdaptorBase::AngleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.angle", odsAttrs.getContext()); +} + +AngleOpGenericAdaptorBase::AngleOpGenericAdaptorBase(AngleOp op) : AngleOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AngleOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AngleOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr AngleOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags AngleOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +AngleOpAdaptor::AngleOpAdaptor(AngleOp op) : AngleOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AngleOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.angle' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair AngleOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AngleOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> AngleOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AngleOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AngleOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AngleOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> AngleOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AngleOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AngleOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AngleOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional AngleOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void AngleOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AngleOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult AngleOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AngleOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AngleOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr AngleOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags AngleOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void AngleOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void AngleOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AngleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void AngleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AngleOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AngleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AngleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void AngleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AngleOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AngleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AngleOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AngleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AngleOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void AngleOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult AngleOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that complex element type matches result type"); + return ::mlir::success(); +} + +::mlir::LogicalResult AngleOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AngleOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::llvm::cast(operands[0].getType()).getElementType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AngleOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + for (::mlir::Type type : complexTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::ComplexType>(type))) && ((::llvm::isa<::mlir::FloatType>(::llvm::cast<::mlir::ComplexType>(type).getElementType()))))) { + return parser.emitError(parser.getNameLoc()) << "'complex' must be complex type with floating-point elements, but got " << type; + } + } + result.addTypes(::llvm::cast(complexTypes[0]).getElementType()); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AngleOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AngleOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::AngleOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::Atan2Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Atan2OpGenericAdaptorBase::Atan2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.atan2", odsAttrs.getContext()); +} + +Atan2OpGenericAdaptorBase::Atan2OpGenericAdaptorBase(Atan2Op op) : Atan2OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Atan2OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Atan2OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr Atan2OpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags Atan2OpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +Atan2OpAdaptor::Atan2OpAdaptor(Atan2Op op) : Atan2OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Atan2OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.atan2' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair Atan2Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Atan2Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> Atan2Op::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ComplexType> Atan2Op::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &Atan2Op::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &Atan2Op::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair Atan2Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Atan2Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> Atan2Op::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Atan2Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Atan2Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Atan2Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional Atan2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void Atan2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Atan2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult Atan2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Atan2Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Atan2Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr Atan2Op::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags Atan2Op::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void Atan2Op::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void Atan2Op::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Atan2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Atan2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Atan2Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Atan2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Atan2Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult Atan2Op::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Atan2Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Atan2Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Atan2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Atan2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void Atan2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::Atan2Op) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::BitcastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BitcastOpGenericAdaptorBase::BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.bitcast", odsAttrs.getContext()); +} + +BitcastOpGenericAdaptorBase::BitcastOpGenericAdaptorBase(BitcastOp op) : BitcastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BitcastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BitcastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BitcastOpAdaptor::BitcastOpAdaptor(BitcastOp op) : BitcastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BitcastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BitcastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BitcastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BitcastOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &BitcastOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair BitcastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BitcastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BitcastOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { + odsState.addOperands(operand); + odsState.addTypes(result); +} + +void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BitcastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BitcastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BitcastOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult BitcastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BitcastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BitcastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::BitcastOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ConjOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ConjOpGenericAdaptorBase::ConjOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.conj", odsAttrs.getContext()); +} + +ConjOpGenericAdaptorBase::ConjOpGenericAdaptorBase(ConjOp op) : ConjOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ConjOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ConjOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr ConjOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags ConjOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +ConjOpAdaptor::ConjOpAdaptor(ConjOp op) : ConjOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ConjOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.conj' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair ConjOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ConjOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> ConjOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ConjOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ConjOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ConjOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> ConjOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ConjOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ConjOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ConjOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional ConjOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void ConjOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ConjOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult ConjOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConjOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ConjOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr ConjOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags ConjOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void ConjOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void ConjOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ConjOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void ConjOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ConjOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ConjOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConjOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void ConjOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ConjOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ConjOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConjOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ConjOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ConjOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void ConjOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult ConjOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConjOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ConjOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ConjOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ConjOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ConjOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::ConjOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ConstantOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.constant", odsAttrs.getContext()); +} + +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(ConstantOp op) : ConstantOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ConstantOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ConstantOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr ConstantOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().value); + return attr; +} + +::mlir::ArrayAttr ConstantOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr; +} + +} // namespace detail +ConstantOpAdaptor::ConstantOpAdaptor(ConstantOp op) : ConstantOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ConstantOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitError(loc, "'complex.constant' op ""requires attribute 'value'"); + + if (tblgen_value && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_value)))) + return emitError(loc, "'complex.constant' op ""attribute 'value' failed to satisfy constraint: array attribute"); + return ::mlir::success(); +} + +std::pair ConstantOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ConstantOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ConstantOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ConstantOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> ConstantOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ConstantOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ConstantOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional ConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void ConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult ConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps1(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.value); +} + +::mlir::ArrayAttr ConstantOp::getValueAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().value); +} + +::mlir::ArrayAttr ConstantOp::getValue() { + auto attr = getValueAttr(); + return attr; +} + +void ConstantOp::setValueAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type complex, ::mlir::ArrayAttr value) { + odsState.getOrAddProperties().value = value; + odsState.addTypes(complex); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr value) { + odsState.getOrAddProperties().value = value; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ConstantOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitOpError("requires attribute 'value'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps1(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ConstantOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::ArrayAttr valueAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + if (parser.parseCustomAttributeWithFallback(valueAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (valueAttr) result.getOrAddProperties().value = valueAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes); + return ::mlir::success(); +} + +void ConstantOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getValueAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::ConstantOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::CosOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CosOpGenericAdaptorBase::CosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.cos", odsAttrs.getContext()); +} + +CosOpGenericAdaptorBase::CosOpGenericAdaptorBase(CosOp op) : CosOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CosOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CosOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr CosOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags CosOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +CosOpAdaptor::CosOpAdaptor(CosOp op) : CosOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CosOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.cos' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair CosOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CosOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> CosOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CosOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CosOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CosOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> CosOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CosOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CosOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CosOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional CosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void CosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult CosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CosOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CosOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr CosOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags CosOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void CosOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void CosOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CosOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void CosOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult CosOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CosOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CosOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::CosOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::CreateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateOpGenericAdaptorBase::CreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.create", odsAttrs.getContext()); +} + +CreateOpGenericAdaptorBase::CreateOpGenericAdaptorBase(CreateOp op) : CreateOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CreateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CreateOpAdaptor::CreateOpAdaptor(CreateOp op) : CreateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CreateOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CreateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> CreateOp::getReal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::FloatType> CreateOp::getImaginary() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CreateOp::getRealMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateOp::getImaginaryMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CreateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CreateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> CreateOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +void CreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type complex, ::mlir::Value real, ::mlir::Value imaginary) { + odsState.addOperands(real); + odsState.addOperands(imaginary); + odsState.addTypes(complex); +} + +void CreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value real, ::mlir::Value imaginary) { + odsState.addOperands(real); + odsState.addOperands(imaginary); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {real, imaginary} have same type"); + if (!((std::equal_to<>()(::llvm::cast((*this->getODSResults(0).begin()).getType()).getElementType(), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that complex element type matches real operand type"); + if (!((std::equal_to<>()(::llvm::cast((*this->getODSResults(0).begin()).getType()).getElementType(), (*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that complex element type matches imaginary operand type"); + return ::mlir::success(); +} + +::mlir::LogicalResult CreateOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand realRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> realOperands(realRawOperands); ::llvm::SMLoc realOperandsLoc; + (void)realOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand imaginaryRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> imaginaryOperands(imaginaryRawOperands); ::llvm::SMLoc imaginaryOperandsLoc; + (void)imaginaryOperandsLoc; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + realOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(realRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + imaginaryOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(imaginaryRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + for (::mlir::Type type : complexTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::ComplexType>(type))) && ((::llvm::isa<::mlir::FloatType>(::llvm::cast<::mlir::ComplexType>(type).getElementType()))))) { + return parser.emitError(parser.getNameLoc()) << "'complex' must be complex type with floating-point elements, but got " << type; + } + } + result.addTypes(complexTypes); + if (parser.resolveOperands(realOperands, ::llvm::cast(complexTypes[0]).getElementType(), realOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(imaginaryOperands, ::llvm::cast(complexTypes[0]).getElementType(), imaginaryOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getReal(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getImaginary(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CreateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::CreateOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::DivOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DivOpGenericAdaptorBase::DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.div", odsAttrs.getContext()); +} + +DivOpGenericAdaptorBase::DivOpGenericAdaptorBase(DivOp op) : DivOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DivOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DivOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr DivOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags DivOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +DivOpAdaptor::DivOpAdaptor(DivOp op) : DivOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DivOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.div' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair DivOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DivOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> DivOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ComplexType> DivOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &DivOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &DivOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DivOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DivOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> DivOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult DivOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute DivOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DivOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional DivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void DivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void DivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult DivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DivOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr DivOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags DivOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void DivOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void DivOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void DivOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult DivOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult DivOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult DivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DivOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void DivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::DivOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::EqualOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +EqualOpGenericAdaptorBase::EqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.eq", odsAttrs.getContext()); +} + +EqualOpGenericAdaptorBase::EqualOpGenericAdaptorBase(EqualOp op) : EqualOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair EqualOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr EqualOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +EqualOpAdaptor::EqualOpAdaptor(EqualOp op) : EqualOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult EqualOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair EqualOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range EqualOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> EqualOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ComplexType> EqualOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &EqualOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &EqualOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair EqualOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range EqualOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> EqualOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +void EqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void EqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(EqualOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void EqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void EqualOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void EqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(EqualOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult EqualOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {lhs, rhs} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult EqualOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult EqualOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(1); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult EqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, lhsTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void EqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void EqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::EqualOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ExpOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExpOpGenericAdaptorBase::ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.exp", odsAttrs.getContext()); +} + +ExpOpGenericAdaptorBase::ExpOpGenericAdaptorBase(ExpOp op) : ExpOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExpOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExpOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr ExpOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags ExpOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +ExpOpAdaptor::ExpOpAdaptor(ExpOp op) : ExpOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExpOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.exp' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair ExpOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExpOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> ExpOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExpOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExpOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExpOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> ExpOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ExpOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ExpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExpOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional ExpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void ExpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ExpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult ExpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr ExpOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags ExpOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void ExpOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void ExpOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void ExpOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult ExpOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ExpOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ExpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::ExpOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::Expm1Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Expm1OpGenericAdaptorBase::Expm1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.expm1", odsAttrs.getContext()); +} + +Expm1OpGenericAdaptorBase::Expm1OpGenericAdaptorBase(Expm1Op op) : Expm1OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Expm1OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Expm1OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr Expm1OpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags Expm1OpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +Expm1OpAdaptor::Expm1OpAdaptor(Expm1Op op) : Expm1OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Expm1OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.expm1' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair Expm1Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Expm1Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> Expm1Op::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Expm1Op::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Expm1Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Expm1Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> Expm1Op::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Expm1Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Expm1Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Expm1Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional Expm1Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void Expm1Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Expm1Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult Expm1Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Expm1Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Expm1Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr Expm1Op::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags Expm1Op::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void Expm1Op::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void Expm1Op::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Expm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void Expm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Expm1Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Expm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Expm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void Expm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Expm1Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Expm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Expm1Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Expm1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Expm1Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Expm1Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult Expm1Op::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Expm1Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Expm1Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Expm1Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Expm1Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void Expm1Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::Expm1Op) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ImOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ImOpGenericAdaptorBase::ImOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.im", odsAttrs.getContext()); +} + +ImOpGenericAdaptorBase::ImOpGenericAdaptorBase(ImOp op) : ImOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ImOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ImOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr ImOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags ImOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +ImOpAdaptor::ImOpAdaptor(ImOp op) : ImOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ImOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.im' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair ImOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ImOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> ImOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ImOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ImOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ImOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> ImOp::getImaginary() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ImOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ImOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ImOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional ImOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void ImOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ImOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult ImOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ImOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ImOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr ImOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags ImOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void ImOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void ImOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ImOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type imaginary, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(imaginary); +} + +void ImOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ImOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ImOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ImOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type imaginary, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(imaginary); +} + +void ImOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ImOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ImOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ImOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ImOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ImOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void ImOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult ImOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that complex element type matches result type"); + return ::mlir::success(); +} + +::mlir::LogicalResult ImOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ImOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::llvm::cast(operands[0].getType()).getElementType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ImOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + for (::mlir::Type type : complexTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::ComplexType>(type))) && ((::llvm::isa<::mlir::FloatType>(::llvm::cast<::mlir::ComplexType>(type).getElementType()))))) { + return parser.emitError(parser.getNameLoc()) << "'complex' must be complex type with floating-point elements, but got " << type; + } + } + result.addTypes(::llvm::cast(complexTypes[0]).getElementType()); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ImOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ImOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::ImOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::Log1pOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Log1pOpGenericAdaptorBase::Log1pOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.log1p", odsAttrs.getContext()); +} + +Log1pOpGenericAdaptorBase::Log1pOpGenericAdaptorBase(Log1pOp op) : Log1pOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Log1pOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Log1pOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr Log1pOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags Log1pOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +Log1pOpAdaptor::Log1pOpAdaptor(Log1pOp op) : Log1pOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Log1pOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.log1p' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair Log1pOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Log1pOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> Log1pOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Log1pOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Log1pOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Log1pOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> Log1pOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Log1pOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Log1pOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Log1pOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional Log1pOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void Log1pOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Log1pOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult Log1pOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log1pOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log1pOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr Log1pOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags Log1pOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void Log1pOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void Log1pOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log1pOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log1pOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log1pOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log1pOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Log1pOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult Log1pOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log1pOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Log1pOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Log1pOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log1pOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void Log1pOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::Log1pOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::LogOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LogOpGenericAdaptorBase::LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.log", odsAttrs.getContext()); +} + +LogOpGenericAdaptorBase::LogOpGenericAdaptorBase(LogOp op) : LogOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LogOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LogOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr LogOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags LogOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +LogOpAdaptor::LogOpAdaptor(LogOp op) : LogOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LogOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.log' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair LogOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LogOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> LogOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LogOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LogOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LogOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> LogOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult LogOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LogOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LogOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional LogOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void LogOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LogOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult LogOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LogOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LogOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr LogOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags LogOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void LogOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void LogOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LogOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LogOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LogOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LogOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void LogOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult LogOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LogOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult LogOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult LogOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LogOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void LogOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::LogOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::MulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.mul", odsAttrs.getContext()); +} + +MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(MulOp op) : MulOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr MulOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags MulOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +MulOpAdaptor::MulOpAdaptor(MulOp op) : MulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MulOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.mul' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair MulOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> MulOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ComplexType> MulOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MulOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MulOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MulOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> MulOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MulOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional MulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void MulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult MulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr MulOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags MulOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void MulOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void MulOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MulOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult MulOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MulOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::MulOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::NegOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +NegOpGenericAdaptorBase::NegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.neg", odsAttrs.getContext()); +} + +NegOpGenericAdaptorBase::NegOpGenericAdaptorBase(NegOp op) : NegOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair NegOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr NegOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr NegOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags NegOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +NegOpAdaptor::NegOpAdaptor(NegOp op) : NegOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult NegOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.neg' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair NegOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range NegOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> NegOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &NegOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair NegOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range NegOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> NegOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult NegOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute NegOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code NegOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional NegOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void NegOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void NegOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult NegOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult NegOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void NegOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr NegOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags NegOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void NegOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void NegOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void NegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void NegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NegOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void NegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void NegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NegOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void NegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NegOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void NegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NegOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void NegOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult NegOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult NegOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult NegOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult NegOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void NegOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void NegOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::NegOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::NotEqualOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +NotEqualOpGenericAdaptorBase::NotEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.neq", odsAttrs.getContext()); +} + +NotEqualOpGenericAdaptorBase::NotEqualOpGenericAdaptorBase(NotEqualOp op) : NotEqualOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair NotEqualOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr NotEqualOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +NotEqualOpAdaptor::NotEqualOpAdaptor(NotEqualOp op) : NotEqualOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult NotEqualOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair NotEqualOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range NotEqualOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> NotEqualOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ComplexType> NotEqualOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &NotEqualOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &NotEqualOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair NotEqualOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range NotEqualOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> NotEqualOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +void NotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void NotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NotEqualOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void NotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NotEqualOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void NotEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NotEqualOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult NotEqualOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {lhs, rhs} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult NotEqualOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult NotEqualOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(1); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult NotEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, lhsTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void NotEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void NotEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::NotEqualOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::PowOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PowOpGenericAdaptorBase::PowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.pow", odsAttrs.getContext()); +} + +PowOpGenericAdaptorBase::PowOpGenericAdaptorBase(PowOp op) : PowOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PowOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PowOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr PowOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags PowOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +PowOpAdaptor::PowOpAdaptor(PowOp op) : PowOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PowOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.pow' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair PowOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range PowOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> PowOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ComplexType> PowOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &PowOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &PowOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair PowOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PowOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> PowOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult PowOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute PowOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PowOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional PowOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void PowOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void PowOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult PowOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PowOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PowOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr PowOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags PowOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void PowOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void PowOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PowOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PowOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PowOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PowOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void PowOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult PowOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PowOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult PowOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult PowOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PowOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void PowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::PowOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ReOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReOpGenericAdaptorBase::ReOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.re", odsAttrs.getContext()); +} + +ReOpGenericAdaptorBase::ReOpGenericAdaptorBase(ReOp op) : ReOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ReOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr ReOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags ReOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +ReOpAdaptor::ReOpAdaptor(ReOp op) : ReOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.re' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair ReOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ReOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> ReOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ReOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ReOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> ReOp::getReal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ReOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ReOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ReOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional ReOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void ReOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ReOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult ReOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr ReOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags ReOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void ReOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void ReOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ReOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type real, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(real); +} + +void ReOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ReOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ReOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type real, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(real); +} + +void ReOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ReOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ReOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ReOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ReOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void ReOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult ReOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that complex element type matches result type"); + return ::mlir::success(); +} + +::mlir::LogicalResult ReOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ReOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::llvm::cast(operands[0].getType()).getElementType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ReOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + for (::mlir::Type type : complexTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::ComplexType>(type))) && ((::llvm::isa<::mlir::FloatType>(::llvm::cast<::mlir::ComplexType>(type).getElementType()))))) { + return parser.emitError(parser.getNameLoc()) << "'complex' must be complex type with floating-point elements, but got " << type; + } + } + result.addTypes(::llvm::cast(complexTypes[0]).getElementType()); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ReOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::ReOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::RsqrtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RsqrtOpGenericAdaptorBase::RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.rsqrt", odsAttrs.getContext()); +} + +RsqrtOpGenericAdaptorBase::RsqrtOpGenericAdaptorBase(RsqrtOp op) : RsqrtOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RsqrtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RsqrtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr RsqrtOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags RsqrtOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +RsqrtOpAdaptor::RsqrtOpAdaptor(RsqrtOp op) : RsqrtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RsqrtOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.rsqrt' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair RsqrtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RsqrtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> RsqrtOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RsqrtOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RsqrtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RsqrtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> RsqrtOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RsqrtOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RsqrtOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RsqrtOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional RsqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void RsqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RsqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult RsqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RsqrtOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RsqrtOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr RsqrtOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags RsqrtOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void RsqrtOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void RsqrtOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RsqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RsqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RsqrtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RsqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void RsqrtOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult RsqrtOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RsqrtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RsqrtOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RsqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RsqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RsqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::RsqrtOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::SignOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SignOpGenericAdaptorBase::SignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.sign", odsAttrs.getContext()); +} + +SignOpGenericAdaptorBase::SignOpGenericAdaptorBase(SignOp op) : SignOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SignOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SignOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr SignOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags SignOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +SignOpAdaptor::SignOpAdaptor(SignOp op) : SignOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SignOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.sign' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair SignOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SignOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> SignOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SignOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SignOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SignOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> SignOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SignOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SignOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SignOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional SignOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void SignOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SignOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult SignOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SignOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SignOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr SignOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags SignOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void SignOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void SignOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void SignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SignOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void SignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SignOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SignOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SignOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SignOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult SignOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SignOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SignOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SignOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SignOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SignOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::SignOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::SinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SinOpGenericAdaptorBase::SinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.sin", odsAttrs.getContext()); +} + +SinOpGenericAdaptorBase::SinOpGenericAdaptorBase(SinOp op) : SinOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr SinOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags SinOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +SinOpAdaptor::SinOpAdaptor(SinOp op) : SinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SinOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.sin' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair SinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> SinOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SinOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> SinOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SinOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SinOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional SinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void SinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult SinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr SinOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags SinOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void SinOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void SinOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SinOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult SinOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SinOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::SinOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::SqrtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SqrtOpGenericAdaptorBase::SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.sqrt", odsAttrs.getContext()); +} + +SqrtOpGenericAdaptorBase::SqrtOpGenericAdaptorBase(SqrtOp op) : SqrtOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SqrtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SqrtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr SqrtOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags SqrtOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +SqrtOpAdaptor::SqrtOpAdaptor(SqrtOp op) : SqrtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SqrtOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.sqrt' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair SqrtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SqrtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> SqrtOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SqrtOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SqrtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SqrtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> SqrtOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SqrtOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SqrtOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SqrtOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional SqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void SqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult SqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SqrtOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SqrtOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr SqrtOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags SqrtOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void SqrtOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void SqrtOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SqrtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SqrtOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult SqrtOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SqrtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SqrtOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::SqrtOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::SubOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.sub", odsAttrs.getContext()); +} + +SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(SubOp op) : SubOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr SubOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags SubOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +SubOpAdaptor::SubOpAdaptor(SubOp op) : SubOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.sub' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair SubOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> SubOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ComplexType> SubOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SubOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SubOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SubOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> SubOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SubOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SubOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional SubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void SubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult SubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr SubOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags SubOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void SubOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void SubOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SubOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult SubOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SubOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::SubOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::TanOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TanOpGenericAdaptorBase::TanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.tan", odsAttrs.getContext()); +} + +TanOpGenericAdaptorBase::TanOpGenericAdaptorBase(TanOp op) : TanOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TanOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TanOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr TanOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags TanOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +TanOpAdaptor::TanOpAdaptor(TanOp op) : TanOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TanOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.tan' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair TanOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TanOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> TanOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &TanOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair TanOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TanOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> TanOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult TanOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TanOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TanOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional TanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void TanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult TanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TanOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TanOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr TanOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags TanOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void TanOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void TanOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TanOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void TanOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult TanOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TanOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult TanOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult TanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::TanOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::TanhOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TanhOpGenericAdaptorBase::TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("complex.tanh", odsAttrs.getContext()); +} + +TanhOpGenericAdaptorBase::TanhOpGenericAdaptorBase(TanhOp op) : TanhOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TanhOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TanhOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr TanhOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags TanhOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +TanhOpAdaptor::TanhOpAdaptor(TanhOp op) : TanhOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TanhOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'complex.tanh' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair TanhOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TanhOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> TanhOp::getComplex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &TanhOp::getComplexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair TanhOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TanhOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ComplexType> TanhOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ComplexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult TanhOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TanhOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TanhOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional TanhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void TanhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TanhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult TanhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TanhOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TanhOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr TanhOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags TanhOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void TanhOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void TanhOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanhOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(complex); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanhOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(complex); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TanhOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanhOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void TanhOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult TanhOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ComplexOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ComplexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TanhOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult TanhOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult TanhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand complexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> complexOperands(complexRawOperands); ::llvm::SMLoc complexOperandsLoc; + (void)complexOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type complexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> complexTypes(complexRawTypes); + + complexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(complexRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ComplexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + complexRawTypes[0] = type; + } + result.addTypes(complexTypes[0]); + if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TanhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getComplex(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getComplex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ComplexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TanhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace complex +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::TanhOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e4d0331a7ad3582b0b6f1995886dceef6bda50fc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.h.inc @@ -0,0 +1,4663 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ComplexOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace complex { +class AbsOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class AddOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class AngleOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class Atan2Op; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class BitcastOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class ConjOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class ConstantOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class CosOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class CreateOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class DivOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class EqualOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class ExpOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class Expm1Op; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class ImOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class Log1pOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class LogOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class MulOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class NegOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class NotEqualOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class PowOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class ReOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class RsqrtOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class SignOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class SinOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class SqrtOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class SubOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class TanOp; +} // namespace complex +} // namespace mlir +namespace mlir { +namespace complex { +class TanhOp; +} // namespace complex +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::AbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AbsOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AbsOpGenericAdaptorBase(AbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class AbsOpGenericAdaptor : public detail::AbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AbsOpGenericAdaptorBase; +public: + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AbsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AbsOpAdaptor : public AbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using AbsOpGenericAdaptor::AbsOpGenericAdaptor; + AbsOpAdaptor(AbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AbsOpAdaptor; + template + using GenericAdaptor = AbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.abs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::AbsOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::AddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AddOpGenericAdaptorBase(AddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddOpGenericAdaptorBase; +public: + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddOpGenericAdaptor::AddOpGenericAdaptor; + AddOpAdaptor(AddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddOpAdaptor; + template + using GenericAdaptor = AddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getLhs(); + ::mlir::TypedValue<::mlir::ComplexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::AddOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::AngleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AngleOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AngleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AngleOpGenericAdaptorBase(AngleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class AngleOpGenericAdaptor : public detail::AngleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AngleOpGenericAdaptorBase; +public: + AngleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AngleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AngleOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AngleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AngleOpAdaptor : public AngleOpGenericAdaptor<::mlir::ValueRange> { +public: + using AngleOpGenericAdaptor::AngleOpGenericAdaptor; + AngleOpAdaptor(AngleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AngleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AngleOpAdaptor; + template + using GenericAdaptor = AngleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.angle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::AngleOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::Atan2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Atan2OpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Atan2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Atan2OpGenericAdaptorBase(Atan2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class Atan2OpGenericAdaptor : public detail::Atan2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Atan2OpGenericAdaptorBase; +public: + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Atan2OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Atan2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Atan2OpAdaptor : public Atan2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Atan2OpGenericAdaptor::Atan2OpGenericAdaptor; + Atan2OpAdaptor(Atan2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Atan2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Atan2OpAdaptor; + template + using GenericAdaptor = Atan2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.atan2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getLhs(); + ::mlir::TypedValue<::mlir::ComplexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::Atan2Op) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::BitcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitcastOpGenericAdaptorBase(BitcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitcastOpGenericAdaptor : public detail::BitcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitcastOpGenericAdaptorBase; +public: + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitcastOpAdaptor : public BitcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitcastOpGenericAdaptor::BitcastOpGenericAdaptor; + BitcastOpAdaptor(BitcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitcastOpAdaptor; + template + using GenericAdaptor = BitcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.bitcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::BitcastOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ConjOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConjOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ConjOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ConjOpGenericAdaptorBase(ConjOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class ConjOpGenericAdaptor : public detail::ConjOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConjOpGenericAdaptorBase; +public: + ConjOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConjOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConjOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ConjOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConjOpAdaptor : public ConjOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConjOpGenericAdaptor::ConjOpGenericAdaptor; + ConjOpAdaptor(ConjOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConjOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConjOpAdaptor; + template + using GenericAdaptor = ConjOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.conj"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::ConjOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ConstantOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstantOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::ArrayAttr; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setValue(const ::mlir::ArrayAttr &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstantOpGenericAdaptorBase(ConstantOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getValueAttr(); + ::mlir::ArrayAttr getValue(); +}; +} // namespace detail +template +class ConstantOpGenericAdaptor : public detail::ConstantOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstantOpGenericAdaptorBase; +public: + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstantOpAdaptor : public ConstantOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstantOpGenericAdaptor::ConstantOpGenericAdaptor; + ConstantOpAdaptor(ConstantOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstantOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstantOpAdaptor; + template + using GenericAdaptor = ConstantOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getValueAttr(); + ::mlir::ArrayAttr getValue(); + void setValueAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type complex, ::mlir::ArrayAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns true if a constant operation can be built with the given value + /// and result type. + static bool isBuildableWith(Attribute value, Type type); +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::ConstantOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::CosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CosOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CosOpGenericAdaptorBase(CosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class CosOpGenericAdaptor : public detail::CosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CosOpGenericAdaptorBase; +public: + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CosOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CosOpAdaptor : public CosOpGenericAdaptor<::mlir::ValueRange> { +public: + using CosOpGenericAdaptor::CosOpGenericAdaptor; + CosOpAdaptor(CosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CosOpAdaptor; + template + using GenericAdaptor = CosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.cos"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::CosOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::CreateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateOpGenericAdaptorBase(CreateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateOpGenericAdaptor : public detail::CreateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateOpGenericAdaptorBase; +public: + CreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getReal() { + return (*getODSOperands(0).begin()); + } + + ValueT getImaginary() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateOpAdaptor : public CreateOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateOpGenericAdaptor::CreateOpGenericAdaptor; + CreateOpAdaptor(CreateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateOpAdaptor; + template + using GenericAdaptor = CreateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.create"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getReal(); + ::mlir::TypedValue<::mlir::FloatType> getImaginary(); + ::mlir::OpOperand &getRealMutable(); + ::mlir::OpOperand &getImaginaryMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type complex, ::mlir::Value real, ::mlir::Value imaginary); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value real, ::mlir::Value imaginary); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::CreateOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::DivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DivOpGenericAdaptorBase(DivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class DivOpGenericAdaptor : public detail::DivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivOpGenericAdaptorBase; +public: + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivOpAdaptor : public DivOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivOpGenericAdaptor::DivOpGenericAdaptor; + DivOpAdaptor(DivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivOpAdaptor; + template + using GenericAdaptor = DivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.div"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getLhs(); + ::mlir::TypedValue<::mlir::ComplexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::DivOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::EqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EqualOpGenericAdaptorBase(EqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EqualOpGenericAdaptor : public detail::EqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EqualOpGenericAdaptorBase; +public: + EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EqualOpAdaptor : public EqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using EqualOpGenericAdaptor::EqualOpGenericAdaptor; + EqualOpAdaptor(EqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EqualOpAdaptor; + template + using GenericAdaptor = EqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.eq"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getLhs(); + ::mlir::TypedValue<::mlir::ComplexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::EqualOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ExpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpOpGenericAdaptorBase(ExpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpOpGenericAdaptorBase; +public: + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpOpGenericAdaptor::ExpOpGenericAdaptor; + ExpOpAdaptor(ExpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpOpAdaptor; + template + using GenericAdaptor = ExpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.exp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::ExpOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::Expm1Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Expm1OpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Expm1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Expm1OpGenericAdaptorBase(Expm1Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class Expm1OpGenericAdaptor : public detail::Expm1OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Expm1OpGenericAdaptorBase; +public: + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Expm1OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Expm1OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Expm1OpAdaptor : public Expm1OpGenericAdaptor<::mlir::ValueRange> { +public: + using Expm1OpGenericAdaptor::Expm1OpGenericAdaptor; + Expm1OpAdaptor(Expm1Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Expm1Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Expm1OpAdaptor; + template + using GenericAdaptor = Expm1OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.expm1"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::Expm1Op) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ImOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ImOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ImOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ImOpGenericAdaptorBase(ImOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class ImOpGenericAdaptor : public detail::ImOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ImOpGenericAdaptorBase; +public: + ImOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ImOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ImOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ImOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ImOpAdaptor : public ImOpGenericAdaptor<::mlir::ValueRange> { +public: + using ImOpGenericAdaptor::ImOpGenericAdaptor; + ImOpAdaptor(ImOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ImOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ImOpAdaptor; + template + using GenericAdaptor = ImOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.im"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getImaginary(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type imaginary, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type imaginary, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::ImOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::Log1pOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log1pOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Log1pOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Log1pOpGenericAdaptorBase(Log1pOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class Log1pOpGenericAdaptor : public detail::Log1pOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log1pOpGenericAdaptorBase; +public: + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log1pOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Log1pOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log1pOpAdaptor : public Log1pOpGenericAdaptor<::mlir::ValueRange> { +public: + using Log1pOpGenericAdaptor::Log1pOpGenericAdaptor; + Log1pOpAdaptor(Log1pOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log1pOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log1pOpAdaptor; + template + using GenericAdaptor = Log1pOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.log1p"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::Log1pOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::LogOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LogOpGenericAdaptorBase(LogOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogOpGenericAdaptorBase; +public: + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogOpGenericAdaptor::LogOpGenericAdaptor; + LogOpAdaptor(LogOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogOpAdaptor; + template + using GenericAdaptor = LogOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.log"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::LogOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::MulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MulOpGenericAdaptorBase(MulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulOpGenericAdaptorBase; +public: + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulOpGenericAdaptor::MulOpGenericAdaptor; + MulOpAdaptor(MulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulOpAdaptor; + template + using GenericAdaptor = MulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getLhs(); + ::mlir::TypedValue<::mlir::ComplexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::MulOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::NegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NegOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + NegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + NegOpGenericAdaptorBase(NegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class NegOpGenericAdaptor : public detail::NegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NegOpGenericAdaptorBase; +public: + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NegOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + NegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NegOpAdaptor : public NegOpGenericAdaptor<::mlir::ValueRange> { +public: + using NegOpGenericAdaptor::NegOpGenericAdaptor; + NegOpAdaptor(NegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NegOpAdaptor; + template + using GenericAdaptor = NegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.neg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::NegOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::NotEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NotEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NotEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NotEqualOpGenericAdaptorBase(NotEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NotEqualOpGenericAdaptor : public detail::NotEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NotEqualOpGenericAdaptorBase; +public: + NotEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NotEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NotEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NotEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NotEqualOpAdaptor : public NotEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using NotEqualOpGenericAdaptor::NotEqualOpGenericAdaptor; + NotEqualOpAdaptor(NotEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NotEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NotEqualOpAdaptor; + template + using GenericAdaptor = NotEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.neq"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getLhs(); + ::mlir::TypedValue<::mlir::ComplexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::NotEqualOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::PowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PowOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PowOpGenericAdaptorBase(PowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class PowOpGenericAdaptor : public detail::PowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PowOpGenericAdaptorBase; +public: + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PowOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PowOpAdaptor : public PowOpGenericAdaptor<::mlir::ValueRange> { +public: + using PowOpGenericAdaptor::PowOpGenericAdaptor; + PowOpAdaptor(PowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PowOpAdaptor; + template + using GenericAdaptor = PowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.pow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getLhs(); + ::mlir::TypedValue<::mlir::ComplexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::PowOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::ReOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReOpGenericAdaptorBase(ReOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class ReOpGenericAdaptor : public detail::ReOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReOpGenericAdaptorBase; +public: + ReOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReOpAdaptor : public ReOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReOpGenericAdaptor::ReOpGenericAdaptor; + ReOpAdaptor(ReOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReOpAdaptor; + template + using GenericAdaptor = ReOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.re"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getReal(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type real, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type real, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::ReOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::RsqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RsqrtOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RsqrtOpGenericAdaptorBase(RsqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class RsqrtOpGenericAdaptor : public detail::RsqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RsqrtOpGenericAdaptorBase; +public: + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RsqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RsqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RsqrtOpAdaptor : public RsqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using RsqrtOpGenericAdaptor::RsqrtOpGenericAdaptor; + RsqrtOpAdaptor(RsqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RsqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RsqrtOpAdaptor; + template + using GenericAdaptor = RsqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.rsqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::RsqrtOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::SignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SignOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SignOpGenericAdaptorBase(SignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class SignOpGenericAdaptor : public detail::SignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SignOpGenericAdaptorBase; +public: + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SignOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SignOpAdaptor : public SignOpGenericAdaptor<::mlir::ValueRange> { +public: + using SignOpGenericAdaptor::SignOpGenericAdaptor; + SignOpAdaptor(SignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SignOpAdaptor; + template + using GenericAdaptor = SignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.sign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::SignOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::SinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SinOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SinOpGenericAdaptorBase(SinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class SinOpGenericAdaptor : public detail::SinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SinOpGenericAdaptorBase; +public: + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SinOpAdaptor : public SinOpGenericAdaptor<::mlir::ValueRange> { +public: + using SinOpGenericAdaptor::SinOpGenericAdaptor; + SinOpAdaptor(SinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SinOpAdaptor; + template + using GenericAdaptor = SinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.sin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::SinOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::SqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqrtOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SqrtOpGenericAdaptorBase(SqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class SqrtOpGenericAdaptor : public detail::SqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqrtOpGenericAdaptorBase; +public: + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqrtOpAdaptor : public SqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqrtOpGenericAdaptor::SqrtOpGenericAdaptor; + SqrtOpAdaptor(SqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqrtOpAdaptor; + template + using GenericAdaptor = SqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.sqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::SqrtOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::SubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubOpGenericAdaptorBase(SubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class SubOpGenericAdaptor : public detail::SubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubOpGenericAdaptorBase; +public: + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubOpAdaptor : public SubOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubOpGenericAdaptor::SubOpGenericAdaptor; + SubOpAdaptor(SubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubOpAdaptor; + template + using GenericAdaptor = SubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.sub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getLhs(); + ::mlir::TypedValue<::mlir::ComplexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::SubOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::TanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TanOpGenericAdaptorBase(TanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class TanOpGenericAdaptor : public detail::TanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanOpGenericAdaptorBase; +public: + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanOpAdaptor : public TanOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanOpGenericAdaptor::TanOpGenericAdaptor; + TanOpAdaptor(TanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanOpAdaptor; + template + using GenericAdaptor = TanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.tan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::TanOp) + +namespace mlir { +namespace complex { + +//===----------------------------------------------------------------------===// +// ::mlir::complex::TanhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanhOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TanhOpGenericAdaptorBase(TanhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class TanhOpGenericAdaptor : public detail::TanhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanhOpGenericAdaptorBase; +public: + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanhOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getComplex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanhOpAdaptor : public TanhOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanhOpGenericAdaptor::TanhOpGenericAdaptor; + TanhOpAdaptor(TanhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanhOpAdaptor; + template + using GenericAdaptor = TanhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("complex.tanh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getComplex(); + ::mlir::OpOperand &getComplexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ComplexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value complex, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::TanhOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..64c29b55f3df5c2d396315d6eb89b161d41be601 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ComplexBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::complex::ComplexDialect) +namespace mlir { +namespace complex { + +ComplexDialect::ComplexDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + initialize(); +} + +ComplexDialect::~ComplexDialect() = default; + +} // namespace complex +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..5f51710ab99d9adcf7e85a432709370274d17c50 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ComplexOpsDialect.h.inc @@ -0,0 +1,41 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ComplexBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace complex { + +class ComplexDialect : public ::mlir::Dialect { + explicit ComplexDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~ComplexDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("complex"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Materialize a single constant operation from a given attribute value with + /// the desired resultant type. + ::mlir::Operation *materializeConstant(::mlir::OpBuilder &builder, + ::mlir::Attribute value, + ::mlir::Type type, + ::mlir::Location loc) override; +}; +} // namespace complex +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::complex::ComplexDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlow.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlow.h new file mode 100644 index 0000000000000000000000000000000000000000..0ae076120018f21a3142c1a899d2de2a4e48f3cb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlow.h @@ -0,0 +1,21 @@ +//===- ControlFlow.h - ControlFlow Dialect ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the ControlFlow dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_CONTROLFLOW_IR_CONTROLFLOW_H +#define MLIR_DIALECT_CONTROLFLOW_IR_CONTROLFLOW_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/Dialect.h" + +#include "mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.h.inc" + +#endif // MLIR_DIALECT_CONTROLFLOW_IR_CONTROLFLOW_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..83ff18332baa6aaf4cea49c1be623498e303c9e7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.cpp.inc @@ -0,0 +1,1531 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ControlFlowOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::cf::AssertOp, +::mlir::cf::BranchOp, +::mlir::cf::CondBranchOp, +::mlir::cf::SwitchOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace cf { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ControlFlowOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ControlFlowOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ControlFlowOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IntegerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ControlFlowOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ControlFlowOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ControlFlowOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ControlFlowOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: integer elements attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ControlFlowOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ControlFlowOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ControlFlowOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: i32 dense array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ControlFlowOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ControlFlowOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace cf +} // namespace mlir +namespace mlir { +namespace cf { + +//===----------------------------------------------------------------------===// +// ::mlir::cf::AssertOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AssertOpGenericAdaptorBase::AssertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("cf.assert", odsAttrs.getContext()); +} + +AssertOpGenericAdaptorBase::AssertOpGenericAdaptorBase(AssertOp op) : AssertOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AssertOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AssertOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr AssertOpGenericAdaptorBase::getMsgAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().msg); + return attr; +} + +::llvm::StringRef AssertOpGenericAdaptorBase::getMsg() { + auto attr = getMsgAttr(); + return attr.getValue(); +} + +} // namespace detail +AssertOpAdaptor::AssertOpAdaptor(AssertOp op) : AssertOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AssertOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_msg = getProperties().msg; (void)tblgen_msg; + if (!tblgen_msg) return emitError(loc, "'cf.assert' op ""requires attribute 'msg'"); + + if (tblgen_msg && !((::llvm::isa<::mlir::StringAttr>(tblgen_msg)))) + return emitError(loc, "'cf.assert' op ""attribute 'msg' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair AssertOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AssertOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> AssertOp::getArg() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AssertOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AssertOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AssertOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AssertOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.msg; + auto attr = dict.get("msg"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for msg in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `msg` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AssertOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.msg; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("msg", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AssertOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.msg.getAsOpaquePointer())); +} + +std::optional AssertOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "msg") + return prop.msg; + return std::nullopt; +} + +void AssertOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "msg") { + prop.msg = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AssertOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.msg) attrs.append("msg", prop.msg); +} + +::mlir::LogicalResult AssertOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMsgAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ControlFlowOps0(attr, "msg", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AssertOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.msg))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AssertOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.msg); +} + +::mlir::StringAttr AssertOp::getMsgAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().msg); +} + +::llvm::StringRef AssertOp::getMsg() { + auto attr = getMsgAttr(); + return attr.getValue(); +} + +void AssertOp::setMsgAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getMsgAttrName(), attr); +} + +void AssertOp::setMsg(::llvm::StringRef attrValue) { + (*this)->setAttr(getMsgAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void AssertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::mlir::StringAttr msg) { + odsState.addOperands(arg); + odsState.getOrAddProperties().msg = msg; +} + +void AssertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::StringAttr msg) { + odsState.addOperands(arg); + odsState.getOrAddProperties().msg = msg; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AssertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::llvm::StringRef msg) { + odsState.addOperands(arg); + odsState.getOrAddProperties().msg = odsBuilder.getStringAttr(msg); +} + +void AssertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::StringRef msg) { + odsState.addOperands(arg); + odsState.getOrAddProperties().msg = odsBuilder.getStringAttr(msg); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AssertOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AssertOp::verifyInvariantsImpl() { + auto tblgen_msg = getProperties().msg; (void)tblgen_msg; + if (!tblgen_msg) return emitOpError("requires attribute 'msg'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ControlFlowOps0(*this, tblgen_msg, "msg"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ControlFlowOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AssertOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void AssertOp::getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context) { + results.add(canonicalize); +} + +::mlir::ParseResult AssertOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::StringAttr msgAttr; + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(msgAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (msgAttr) result.getOrAddProperties().msg = msgAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(argOperands, odsBuildableType0, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AssertOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getMsgAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("msg"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace cf +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::cf::AssertOp) + +namespace mlir { +namespace cf { + +//===----------------------------------------------------------------------===// +// ::mlir::cf::BranchOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BranchOpGenericAdaptorBase::BranchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("cf.br", odsAttrs.getContext()); +} + +BranchOpGenericAdaptorBase::BranchOpGenericAdaptorBase(BranchOp op) : BranchOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BranchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr BranchOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BranchOpAdaptor::BranchOpAdaptor(BranchOp op) : BranchOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BranchOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BranchOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range BranchOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range BranchOp::getDestOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange BranchOp::getDestOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair BranchOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BranchOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *BranchOp::getDest() { + return (*this)->getSuccessor(0); +} + +void BranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Block *dest, ValueRange destOperands) { + odsState.addSuccessors(dest); + odsState.addOperands(destOperands); + +} + +void BranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange destOperands, ::mlir::Block *dest) { + odsState.addOperands(destOperands); + odsState.addSuccessors(dest); +} + +void BranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange destOperands, ::mlir::Block *dest) { + odsState.addOperands(destOperands); + odsState.addSuccessors(dest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BranchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BranchOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ControlFlowOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult BranchOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void BranchOp::getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context) { + results.add(canonicalize); +} + +::mlir::ParseResult BranchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Block *destSuccessor = nullptr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> destOperandsOperands; + ::llvm::SMLoc destOperandsOperandsLoc; + (void)destOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> destOperandsTypes; + + if (parser.parseSuccessor(destSuccessor)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + destOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(destOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(destOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addSuccessors(destSuccessor); + if (parser.resolveOperands(destOperandsOperands, destOperandsTypes, destOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BranchOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getDest(); + if (!getDestOperands().empty()) { + _odsPrinter << "("; + _odsPrinter << getDestOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDestOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void BranchOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace cf +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::cf::BranchOp) + +namespace mlir { +namespace cf { + +//===----------------------------------------------------------------------===// +// ::mlir::cf::CondBranchOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CondBranchOpGenericAdaptorBase::CondBranchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("cf.cond_br", odsAttrs.getContext()); +} + +CondBranchOpGenericAdaptorBase::CondBranchOpGenericAdaptorBase(CondBranchOp op) : CondBranchOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CondBranchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CondBranchOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CondBranchOpAdaptor::CondBranchOpAdaptor(CondBranchOp op) : CondBranchOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CondBranchOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CondBranchOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CondBranchOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> CondBranchOp::getCondition() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range CondBranchOp::getTrueDestOperands() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range CondBranchOp::getFalseDestOperands() { + return getODSOperands(2); +} + +::mlir::OpOperand &CondBranchOp::getConditionMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CondBranchOp::getTrueDestOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CondBranchOp::getFalseDestOperandsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CondBranchOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CondBranchOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *CondBranchOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *CondBranchOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult CondBranchOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CondBranchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CondBranchOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CondBranchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CondBranchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CondBranchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CondBranchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult CondBranchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CondBranchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void CondBranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Block *trueDest, ValueRange trueOperands, Block *falseDest, ValueRange falseOperands) { + build(odsBuilder, odsState, condition, trueOperands, falseOperands, trueDest, + falseDest); + +} + +void CondBranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Block *trueDest, Block *falseDest, ValueRange falseOperands) { + build(odsBuilder, odsState, condition, trueDest, ValueRange(), falseDest, + falseOperands); + +} + +void CondBranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(condition); + odsState.addOperands(trueDestOperands); + odsState.addOperands(falseDestOperands); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(trueDestOperands.size()), static_cast(falseDestOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CondBranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(condition); + odsState.addOperands(trueDestOperands); + odsState.addOperands(falseDestOperands); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(trueDestOperands.size()), static_cast(falseDestOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CondBranchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CondBranchOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ControlFlowOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ControlFlowOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ControlFlowOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult CondBranchOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CondBranchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand conditionRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(conditionRawOperands); ::llvm::SMLoc conditionOperandsLoc; + (void)conditionOperandsLoc; + ::mlir::Block *trueDestSuccessor = nullptr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> trueDestOperandsOperands; + ::llvm::SMLoc trueDestOperandsOperandsLoc; + (void)trueDestOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> trueDestOperandsTypes; + ::mlir::Block *falseDestSuccessor = nullptr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> falseDestOperandsOperands; + ::llvm::SMLoc falseDestOperandsOperandsLoc; + (void)falseDestOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> falseDestOperandsTypes; + + conditionOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(conditionRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseSuccessor(trueDestSuccessor)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + trueDestOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(trueDestOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(trueDestOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseSuccessor(falseDestSuccessor)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + falseDestOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(falseDestOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(falseDestOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addSuccessors(trueDestSuccessor); + result.addSuccessors(falseDestSuccessor); +::llvm::copy(::llvm::ArrayRef({1, static_cast(trueDestOperandsOperands.size()), static_cast(falseDestOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(conditionOperands, odsBuildableType0, conditionOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(trueDestOperandsOperands, trueDestOperandsTypes, trueDestOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(falseDestOperandsOperands, falseDestOperandsTypes, falseDestOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CondBranchOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getCondition(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTrueDest(); + if (!getTrueDestOperands().empty()) { + _odsPrinter << "("; + _odsPrinter << getTrueDestOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getTrueDestOperands().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getFalseDest(); + if (!getFalseDestOperands().empty()) { + _odsPrinter << "("; + _odsPrinter << getFalseDestOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getFalseDestOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void CondBranchOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace cf +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::cf::CondBranchOp) + +namespace mlir { +namespace cf { + +//===----------------------------------------------------------------------===// +// ::mlir::cf::SwitchOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SwitchOpGenericAdaptorBase::SwitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("cf.switch", odsAttrs.getContext()); +} + +SwitchOpGenericAdaptorBase::SwitchOpGenericAdaptorBase(SwitchOp op) : SwitchOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SwitchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SwitchOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr SwitchOpGenericAdaptorBase::getCaseValuesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().case_values); + return attr; +} + +::std::optional< ::mlir::DenseIntElementsAttr > SwitchOpGenericAdaptorBase::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr ? ::std::optional< ::mlir::DenseIntElementsAttr >(attr) : (::std::nullopt); +} + +::mlir::DenseI32ArrayAttr SwitchOpGenericAdaptorBase::getCaseOperandSegmentsAttr() { + auto attr = ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().case_operand_segments); + return attr; +} + +::llvm::ArrayRef SwitchOpGenericAdaptorBase::getCaseOperandSegments() { + auto attr = getCaseOperandSegmentsAttr(); + return attr; +} + +} // namespace detail +SwitchOpAdaptor::SwitchOpAdaptor(SwitchOp op) : SwitchOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SwitchOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_case_operand_segments = getProperties().case_operand_segments; (void)tblgen_case_operand_segments; + if (!tblgen_case_operand_segments) return emitError(loc, "'cf.switch' op ""requires attribute 'case_operand_segments'"); + auto tblgen_case_values = getProperties().case_values; (void)tblgen_case_values; + + if (tblgen_case_values && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_case_values))) && ((true)))) + return emitError(loc, "'cf.switch' op ""attribute 'case_values' failed to satisfy constraint: integer elements attribute"); + + if (tblgen_case_operand_segments && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_case_operand_segments)))) + return emitError(loc, "'cf.switch' op ""attribute 'case_operand_segments' failed to satisfy constraint: i32 dense array attribute"); + return ::mlir::success(); +} + +std::pair SwitchOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SwitchOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> SwitchOp::getFlag() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range SwitchOp::getDefaultOperands() { + return getODSOperands(1); +} + +::mlir::OperandRangeRange SwitchOp::getCaseOperands() { + return getODSOperands(2).split(getCaseOperandSegmentsAttr()); +} + +::mlir::OpOperand &SwitchOp::getFlagMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange SwitchOp::getDefaultOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRangeRange SwitchOp::getCaseOperandsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getCaseOperandSegmentsAttrName())); +} + +std::pair SwitchOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SwitchOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *SwitchOp::getDefaultDestination() { + return (*this)->getSuccessor(0); +} + +::mlir::SuccessorRange SwitchOp::getCaseDestinations() { + return {std::next((*this)->successor_begin(), 1), (*this)->successor_end()}; +} + +::mlir::LogicalResult SwitchOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.case_operand_segments; + auto attr = dict.get("case_operand_segments"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for case_operand_segments in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `case_operand_segments` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.case_values; + auto attr = dict.get("case_values"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for case_values in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `case_values` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SwitchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.case_operand_segments; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("case_operand_segments", + propStorage)); + } + + { + const auto &propStorage = prop.case_values; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("case_values", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SwitchOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.case_operand_segments.getAsOpaquePointer()), + llvm::hash_value(prop.case_values.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SwitchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "case_operand_segments") + return prop.case_operand_segments; + + if (name == "case_values") + return prop.case_values; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SwitchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "case_operand_segments") { + prop.case_operand_segments = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "case_values") { + prop.case_values = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SwitchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.case_operand_segments) attrs.append("case_operand_segments", prop.case_operand_segments); + + if (prop.case_values) attrs.append("case_values", prop.case_values); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SwitchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCaseOperandSegmentsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ControlFlowOps2(attr, "case_operand_segments", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCaseValuesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ControlFlowOps1(attr, "case_values", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.case_operand_segments))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.case_values))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SwitchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.case_operand_segments); + + writer.writeOptionalAttribute(prop.case_values); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr SwitchOp::getCaseValuesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().case_values); +} + +::std::optional< ::mlir::DenseIntElementsAttr > SwitchOp::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr ? ::std::optional< ::mlir::DenseIntElementsAttr >(attr) : (::std::nullopt); +} + +::mlir::DenseI32ArrayAttr SwitchOp::getCaseOperandSegmentsAttr() { + return ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().case_operand_segments); +} + +::llvm::ArrayRef SwitchOp::getCaseOperandSegments() { + auto attr = getCaseOperandSegmentsAttr(); + return attr; +} + +void SwitchOp::setCaseValuesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getCaseValuesAttrName(), attr); +} + +void SwitchOp::setCaseOperandSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { + (*this)->setAttr(getCaseOperandSegmentsAttrName(), attr); +} + +void SwitchOp::setCaseOperandSegments(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getCaseOperandSegmentsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue)); +} + +::mlir::Attribute SwitchOp::removeCaseValuesAttr() { + auto &attr = getProperties().case_values; + attr = {}; + return attr; +} + +void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value flag, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) { + odsState.addOperands(flag); + odsState.addOperands(defaultOperands); + for (::mlir::ValueRange range : caseOperands) + odsState.addOperands(range); + { + ::llvm::SmallVector rangeSegments; + for (::mlir::ValueRange range : caseOperands) + rangeSegments.push_back(range.size()); + auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments); + odsState.getOrAddProperties().case_operand_segments = rangeAttr; } + ::llvm::copy(::llvm::ArrayRef({1, static_cast(defaultOperands.size()), static_cast(std::accumulate(caseOperands.begin(), caseOperands.end(), 0, [](int32_t curSum, ::mlir::ValueRange range) { return curSum + range.size(); }))}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (case_values) { + odsState.getOrAddProperties().case_values = case_values; + } + odsState.addSuccessors(defaultDestination); + odsState.addSuccessors(caseDestinations); +} + +void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value flag, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) { + odsState.addOperands(flag); + odsState.addOperands(defaultOperands); + for (::mlir::ValueRange range : caseOperands) + odsState.addOperands(range); + { + ::llvm::SmallVector rangeSegments; + for (::mlir::ValueRange range : caseOperands) + rangeSegments.push_back(range.size()); + auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments); + odsState.getOrAddProperties().case_operand_segments = rangeAttr; } + ::llvm::copy(::llvm::ArrayRef({1, static_cast(defaultOperands.size()), static_cast(std::accumulate(caseOperands.begin(), caseOperands.end(), 0, [](int32_t curSum, ::mlir::ValueRange range) { return curSum + range.size(); }))}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (case_values) { + odsState.getOrAddProperties().case_values = case_values; + } + odsState.addSuccessors(defaultDestination); + odsState.addSuccessors(caseDestinations); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SwitchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SwitchOp::verifyInvariantsImpl() { + auto tblgen_case_operand_segments = getProperties().case_operand_segments; (void)tblgen_case_operand_segments; + if (!tblgen_case_operand_segments) return emitOpError("requires attribute 'case_operand_segments'"); + auto tblgen_case_values = getProperties().case_values; (void)tblgen_case_values; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ControlFlowOps1(*this, tblgen_case_values, "case_values"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ControlFlowOps2(*this, tblgen_case_operand_segments, "case_operand_segments"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ControlFlowOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ControlFlowOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "case_operand_segments", "caseOperands", valueGroup2.size()))) + return ::mlir::failure(); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ControlFlowOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SwitchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand flagRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> flagOperands(flagRawOperands); ::llvm::SMLoc flagOperandsLoc; + (void)flagOperandsLoc; + ::mlir::Type flagRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> flagTypes(flagRawTypes); + ::mlir::Block *defaultDestinationSuccessor = nullptr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> defaultOperandsOperands; + ::llvm::SMLoc defaultOperandsOperandsLoc; + (void)defaultOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> defaultOperandsTypes; + ::mlir::DenseIntElementsAttr case_valuesAttr; + ::llvm::SmallVector<::mlir::Block *, 2> caseDestinationsSuccessors; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> caseOperandsOperands; + llvm::SmallVector caseOperandsOperandGroupSizes; + ::llvm::SMLoc caseOperandsOperandsLoc; + (void)caseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> caseOperandsTypes; + + flagOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(flagRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + flagRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + { + defaultOperandsOperandsLoc = parser.getCurrentLocation(); + caseOperandsOperandsLoc = parser.getCurrentLocation(); + ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> caseOperandsOperandGroups; + ::llvm::SmallVector> caseOperandsTypeGroups; + auto odsResult = parseSwitchOpCases(parser, flagRawTypes[0], defaultDestinationSuccessor, defaultOperandsOperands, defaultOperandsTypes, case_valuesAttr, caseDestinationsSuccessors, caseOperandsOperandGroups, caseOperandsTypeGroups); + if (odsResult) return ::mlir::failure(); + if (case_valuesAttr) + result.getOrAddProperties().case_values = case_valuesAttr; + for (const auto &subRange : caseOperandsOperandGroups) { + caseOperandsOperands.append(subRange.begin(), subRange.end()); + caseOperandsOperandGroupSizes.push_back(subRange.size()); + } + for (const auto &subRange : caseOperandsTypeGroups) + caseOperandsTypes.append(subRange.begin(), subRange.end()); + } + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addSuccessors(defaultDestinationSuccessor); + result.addSuccessors(caseDestinationsSuccessors); +::llvm::copy(::llvm::ArrayRef({1, static_cast(defaultOperandsOperands.size()), static_cast(caseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + result.getOrAddProperties().case_operand_segments = parser.getBuilder().getDenseI32ArrayAttr(caseOperandsOperandGroupSizes); + if (parser.resolveOperands(flagOperands, flagTypes, flagOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(defaultOperandsOperands, defaultOperandsTypes, defaultOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(caseOperandsOperands, caseOperandsTypes, caseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getFlag(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getFlag().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' ' << "["; + _odsPrinter.printNewline(); + printSwitchOpCases(_odsPrinter, *this, getFlag().getType(), getDefaultDestination(), getDefaultOperands(), getDefaultOperands().getTypes(), getCaseValuesAttr(), getCaseDestinations(), getCaseOperands(), getCaseOperands().getTypes()); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("case_operand_segments"); + elidedAttrs.push_back("case_values"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void SwitchOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace cf +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::cf::SwitchOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h new file mode 100644 index 0000000000000000000000000000000000000000..adbc2db59d013c712ee1df16a42a713503c690c3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h @@ -0,0 +1,31 @@ +//===- ControlFlowOps.h - ControlFlow Operations ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the operations of the ControlFlow dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_CONTROLFLOW_IR_CONTROLFLOWOPS_H +#define MLIR_DIALECT_CONTROLFLOW_IR_CONTROLFLOWOPS_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +namespace mlir { +class PatternRewriter; +} // namespace mlir + +#define GET_OP_CLASSES +#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h.inc" + +#endif // MLIR_DIALECT_CONTROLFLOW_IR_CONTROLFLOWOPS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..5284f44381a8976b6c7110538407ebf022a15052 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h.inc @@ -0,0 +1,779 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ControlFlowOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace cf { +class AssertOp; +} // namespace cf +} // namespace mlir +namespace mlir { +namespace cf { +class BranchOp; +} // namespace cf +} // namespace mlir +namespace mlir { +namespace cf { +class CondBranchOp; +} // namespace cf +} // namespace mlir +namespace mlir { +namespace cf { +class SwitchOp; +} // namespace cf +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace cf { + +//===----------------------------------------------------------------------===// +// ::mlir::cf::AssertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssertOpGenericAdaptorBase { +public: + struct Properties { + using msgTy = ::mlir::StringAttr; + msgTy msg; + + auto getMsg() { + auto &propStorage = this->msg; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setMsg(const ::mlir::StringAttr &propValue) { + this->msg = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.msg == this->msg && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AssertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AssertOpGenericAdaptorBase(AssertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMsgAttr(); + ::llvm::StringRef getMsg(); +}; +} // namespace detail +template +class AssertOpGenericAdaptor : public detail::AssertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssertOpGenericAdaptorBase; +public: + AssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssertOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AssertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssertOpAdaptor : public AssertOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssertOpGenericAdaptor::AssertOpGenericAdaptor; + AssertOpAdaptor(AssertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssertOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AssertOpAdaptor; + template + using GenericAdaptor = AssertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("msg")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMsgAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMsgAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("cf.assert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getMsgAttr(); + ::llvm::StringRef getMsg(); + void setMsgAttr(::mlir::StringAttr attr); + void setMsg(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::mlir::StringAttr msg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::StringAttr msg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::llvm::StringRef msg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::StringRef msg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult canonicalize(AssertOp op, ::mlir::PatternRewriter &rewriter); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace cf +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::cf::AssertOp) + +namespace mlir { +namespace cf { + +//===----------------------------------------------------------------------===// +// ::mlir::cf::BranchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BranchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BranchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BranchOpGenericAdaptorBase(BranchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BranchOpGenericAdaptor : public detail::BranchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BranchOpGenericAdaptorBase; +public: + BranchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BranchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BranchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BranchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDestOperands() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BranchOpAdaptor : public BranchOpGenericAdaptor<::mlir::ValueRange> { +public: + using BranchOpGenericAdaptor::BranchOpGenericAdaptor; + BranchOpAdaptor(BranchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BranchOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BranchOpAdaptor; + template + using GenericAdaptor = BranchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("cf.br"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDestOperands(); + ::mlir::MutableOperandRange getDestOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDest(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Block *dest, ValueRange destOperands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange destOperands, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange destOperands, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult canonicalize(BranchOp op, ::mlir::PatternRewriter &rewriter); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::SuccessorOperands getSuccessorOperands(unsigned index); + ::mlir::Block *getSuccessorForOperands(::llvm::ArrayRef<::mlir::Attribute> operands); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + void setDest(Block *block); + + /// Erase the operand at 'index' from the operand list. + void eraseOperand(unsigned index); +}; +} // namespace cf +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::cf::BranchOp) + +namespace mlir { +namespace cf { + +//===----------------------------------------------------------------------===// +// ::mlir::cf::CondBranchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CondBranchOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CondBranchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CondBranchOpGenericAdaptorBase(CondBranchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CondBranchOpGenericAdaptor : public detail::CondBranchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CondBranchOpGenericAdaptorBase; +public: + CondBranchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CondBranchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CondBranchOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CondBranchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + RangeT getTrueDestOperands() { + return getODSOperands(1); + } + + RangeT getFalseDestOperands() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CondBranchOpAdaptor : public CondBranchOpGenericAdaptor<::mlir::ValueRange> { +public: + using CondBranchOpGenericAdaptor::CondBranchOpGenericAdaptor; + CondBranchOpAdaptor(CondBranchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CondBranchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::BranchOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = CondBranchOpAdaptor; + template + using GenericAdaptor = CondBranchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("cf.cond_br"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getCondition(); + ::mlir::Operation::operand_range getTrueDestOperands(); + ::mlir::Operation::operand_range getFalseDestOperands(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::MutableOperandRange getTrueDestOperandsMutable(); + ::mlir::MutableOperandRange getFalseDestOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Block *trueDest, ValueRange trueOperands, Block *falseDest, ValueRange falseOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Block *trueDest, Block *falseDest, ValueRange falseOperands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::SuccessorOperands getSuccessorOperands(unsigned index); + ::mlir::Block *getSuccessorForOperands(::llvm::ArrayRef<::mlir::Attribute> operands); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // These are the indices into the dests list. + enum { trueIndex = 0, falseIndex = 1 }; + + // Accessors for operands to the 'true' destination. + Value getTrueOperand(unsigned idx) { + assert(idx < getNumTrueOperands()); + return getOperand(getTrueDestOperandIndex() + idx); + } + + void setTrueOperand(unsigned idx, Value value) { + assert(idx < getNumTrueOperands()); + setOperand(getTrueDestOperandIndex() + idx, value); + } + + unsigned getNumTrueOperands() { return getTrueOperands().size(); } + + /// Erase the operand at 'index' from the true operand list. + void eraseTrueOperand(unsigned index) { + getTrueDestOperandsMutable().erase(index); + } + + // Accessors for operands to the 'false' destination. + Value getFalseOperand(unsigned idx) { + assert(idx < getNumFalseOperands()); + return getOperand(getFalseDestOperandIndex() + idx); + } + void setFalseOperand(unsigned idx, Value value) { + assert(idx < getNumFalseOperands()); + setOperand(getFalseDestOperandIndex() + idx, value); + } + + operand_range getTrueOperands() { return getTrueDestOperands(); } + operand_range getFalseOperands() { return getFalseDestOperands(); } + + unsigned getNumFalseOperands() { return getFalseOperands().size(); } + + /// Erase the operand at 'index' from the false operand list. + void eraseFalseOperand(unsigned index) { + getFalseDestOperandsMutable().erase(index); + } + + private: + /// Get the index of the first true destination operand. + unsigned getTrueDestOperandIndex() { return 1; } + + /// Get the index of the first false destination operand. + unsigned getFalseDestOperandIndex() { + return getTrueDestOperandIndex() + getNumTrueOperands(); + } +}; +} // namespace cf +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::cf::CondBranchOp) + +namespace mlir { +namespace cf { + +//===----------------------------------------------------------------------===// +// ::mlir::cf::SwitchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchOpGenericAdaptorBase { +public: + struct Properties { + using case_operand_segmentsTy = ::mlir::DenseI32ArrayAttr; + case_operand_segmentsTy case_operand_segments; + + auto getCaseOperandSegments() { + auto &propStorage = this->case_operand_segments; + return ::llvm::cast<::mlir::DenseI32ArrayAttr>(propStorage); + } + void setCaseOperandSegments(const ::mlir::DenseI32ArrayAttr &propValue) { + this->case_operand_segments = propValue; + } + using case_valuesTy = ::mlir::DenseIntElementsAttr; + case_valuesTy case_values; + + auto getCaseValues() { + auto &propStorage = this->case_values; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setCaseValues(const ::mlir::DenseIntElementsAttr &propValue) { + this->case_values = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.case_operand_segments == this->case_operand_segments && + rhs.case_values == this->case_values && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SwitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchOpGenericAdaptorBase(SwitchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getCaseValuesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getCaseValues(); + ::mlir::DenseI32ArrayAttr getCaseOperandSegmentsAttr(); + ::llvm::ArrayRef getCaseOperandSegments(); +}; +} // namespace detail +template +class SwitchOpGenericAdaptor : public detail::SwitchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchOpGenericAdaptorBase; +public: + SwitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SwitchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFlag() { + return (*getODSOperands(0).begin()); + } + + RangeT getDefaultOperands() { + return getODSOperands(1); + } + + ::llvm::SmallVector getCaseOperands() { + auto tblgenTmpOperands = getODSOperands(2); + auto sizes = getCaseOperandSegments(); + + ::llvm::SmallVector tblgenTmpOperandGroups; + for (int i = 0, e = sizes.size(); i < e; ++i) { + tblgenTmpOperandGroups.push_back(tblgenTmpOperands.take_front(sizes[i])); + tblgenTmpOperands = tblgenTmpOperands.drop_front(sizes[i]); + } + return tblgenTmpOperandGroups; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchOpAdaptor : public SwitchOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchOpGenericAdaptor::SwitchOpGenericAdaptor; + SwitchOpAdaptor(SwitchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::BranchOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchOpAdaptor; + template + using GenericAdaptor = SwitchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("case_operand_segments"), ::llvm::StringRef("case_values"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCaseOperandSegmentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCaseOperandSegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCaseValuesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCaseValuesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("cf.switch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getFlag(); + ::mlir::Operation::operand_range getDefaultOperands(); + ::mlir::OperandRangeRange getCaseOperands(); + ::mlir::OpOperand &getFlagMutable(); + ::mlir::MutableOperandRange getDefaultOperandsMutable(); + ::mlir::MutableOperandRangeRange getCaseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDefaultDestination(); + ::mlir::SuccessorRange getCaseDestinations(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getCaseValuesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getCaseValues(); + ::mlir::DenseI32ArrayAttr getCaseOperandSegmentsAttr(); + ::llvm::ArrayRef getCaseOperandSegments(); + void setCaseValuesAttr(::mlir::DenseIntElementsAttr attr); + void setCaseOperandSegmentsAttr(::mlir::DenseI32ArrayAttr attr); + void setCaseOperandSegments(::llvm::ArrayRef attrValue); + ::mlir::Attribute removeCaseValuesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value flag, Block *defaultDestination, ValueRange defaultOperands, ArrayRef caseValues = {}, BlockRange caseDestinations = {}, ArrayRef caseOperands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value flag, Block *defaultDestination, ValueRange defaultOperands, ArrayRef caseValues = {}, BlockRange caseDestinations = {}, ArrayRef caseOperands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value flag, Block *defaultDestination, ValueRange defaultOperands, DenseIntElementsAttr caseValues = {}, BlockRange caseDestinations = {}, ArrayRef caseOperands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value flag, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value flag, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::SuccessorOperands getSuccessorOperands(unsigned index); + ::mlir::Block *getSuccessorForOperands(::llvm::ArrayRef<::mlir::Attribute> operands); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Return the operands for the case destination block at the given index. + OperandRange getCaseOperands(unsigned index) { + return getCaseOperands()[index]; + } + + /// Return a mutable range of operands for the case destination block at the + /// given index. + MutableOperandRange getCaseOperandsMutable(unsigned index) { + return getCaseOperandsMutable()[index]; + } +}; +} // namespace cf +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::cf::SwitchOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..d7a78d41427c072e31fc6a00c57e96916fb82b79 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ControlFlowOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::cf::ControlFlowDialect) +namespace mlir { +namespace cf { + +ControlFlowDialect::ControlFlowDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + initialize(); +} + +ControlFlowDialect::~ControlFlowDialect() = default; + +} // namespace cf +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..172e55f2e06ba70e76c89479447be4c9cbfd8d62 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.h.inc @@ -0,0 +1,26 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ControlFlowOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace cf { + +class ControlFlowDialect : public ::mlir::Dialect { + explicit ControlFlowDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~ControlFlowDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("cf"); + } +}; +} // namespace cf +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::cf::ControlFlowDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..4f2cad4514171bf52e4075d57124fa073be146a3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.cpp.inc @@ -0,0 +1,9 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ControlFlowOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..798bbbfca837e9c802a0e90d9dce0c95e569c57f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.h.inc @@ -0,0 +1,9 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ControlFlowOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/DLTI.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/DLTI.h new file mode 100644 index 0000000000000000000000000000000000000000..cf78b2312c2460912358be49f9f5cc9458fb955b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/DLTI.h @@ -0,0 +1,118 @@ +//===- DLTI.h - Data Layout and Target Info MLIR Dialect --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Defines the dialect containing the objects pertaining to target information. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_DLTI_DLTI_H +#define MLIR_DIALECT_DLTI_DLTI_H + +#include "mlir/IR/Attributes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/Interfaces/DataLayoutInterfaces.h" + +namespace mlir { +namespace impl { +class DataLayoutEntryStorage; +class DataLayoutSpecStorage; +} // namespace impl + +//===----------------------------------------------------------------------===// +// DataLayoutEntryAttr +//===----------------------------------------------------------------------===// + +/// A data layout entry attribute is a key-value pair where the key is a type or +/// an identifier and the value is another attribute. These entries form a data +/// layout specification. +class DataLayoutEntryAttr + : public Attribute::AttrBase { +public: + using Base::Base; + + /// The keyword used for this attribute in custom syntax. + constexpr const static llvm::StringLiteral kAttrKeyword = "dl_entry"; + + /// Returns the entry with the given key and value. + static DataLayoutEntryAttr get(StringAttr key, Attribute value); + static DataLayoutEntryAttr get(Type key, Attribute value); + + /// Returns the key of this entry. + DataLayoutEntryKey getKey() const; + + /// Returns the value of this entry. + Attribute getValue() const; + + /// Parses an instance of this attribute. + static DataLayoutEntryAttr parse(AsmParser &parser); + + /// Prints this attribute. + void print(AsmPrinter &os) const; +}; + +//===----------------------------------------------------------------------===// +// DataLayoutSpecAttr +//===----------------------------------------------------------------------===// + +/// A data layout specification is a list of entries that specify (partial) data +/// layout information. It is expected to be attached to operations that serve +/// as scopes for data layout requests. +class DataLayoutSpecAttr + : public Attribute::AttrBase { +public: + using Base::Base; + + /// The keyword used for this attribute in custom syntax. + constexpr const static StringLiteral kAttrKeyword = "dl_spec"; + + /// Returns the specification containing the given list of keys. + static DataLayoutSpecAttr get(MLIRContext *ctx, + ArrayRef entries); + + /// Returns the specification containing the given list of keys. If the list + /// contains duplicate keys or is otherwise invalid, reports errors using the + /// given callback and returns null. + static DataLayoutSpecAttr + getChecked(function_ref emitError, MLIRContext *context, + ArrayRef entries); + + /// Checks that the given list of entries does not contain duplicate keys. + static LogicalResult verify(function_ref emitError, + ArrayRef entries); + + /// Combines this specification with `specs`, enclosing specifications listed + /// from outermost to innermost. This overwrites the older entries with the + /// same key as the newer entries if the entries are compatible. Returns null + /// if the specifications are not compatible. + DataLayoutSpecAttr combineWith(ArrayRef specs) const; + + /// Returns the list of entries. + DataLayoutEntryListRef getEntries() const; + + /// Returns the alloca memory space identifier. + StringAttr getAllocaMemorySpaceIdentifier(MLIRContext *context) const; + + /// Returns the stack alignment identifier. + StringAttr getStackAlignmentIdentifier(MLIRContext *context) const; + + /// Parses an instance of this attribute. + static DataLayoutSpecAttr parse(AsmParser &parser); + + /// Prints this attribute. + void print(AsmPrinter &os) const; +}; + +} // namespace mlir + +#include "mlir/Dialect/DLTI/DLTIDialect.h.inc" + +#endif // MLIR_DIALECT_DLTI_DLTI_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/DLTIDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/DLTIDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..0be81dfcc357f3ae58543d3b0c3999085fc14876 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/DLTIDialect.cpp.inc @@ -0,0 +1,21 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: DLTIBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::DLTIDialect) +namespace mlir { + +DLTIDialect::DLTIDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +DLTIDialect::~DLTIDialect() = default; + +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/DLTIDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/DLTIDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..32ab5832d951b9a26a231cc20385a71b06a2ae13 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/DLTIDialect.h.inc @@ -0,0 +1,57 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: DLTIBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { + +class DLTIDialect : public ::mlir::Dialect { + explicit DLTIDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~DLTIDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("dlti"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Provides a hook for verifying dialect attributes attached to the given + /// op. + ::mlir::LogicalResult verifyOperationAttribute( + ::mlir::Operation *op, ::mlir::NamedAttribute attribute) override; + + // Top level attribute name. + constexpr const static ::llvm::StringLiteral + kDataLayoutAttrName = "dlti.dl_spec"; + + // Constants used in entries. + constexpr const static ::llvm::StringLiteral + kDataLayoutEndiannessKey = "dlti.endianness"; + + constexpr const static ::llvm::StringLiteral + kDataLayoutEndiannessBig = "big"; + + constexpr const static ::llvm::StringLiteral + kDataLayoutEndiannessLittle = "little"; + + constexpr const static ::llvm::StringLiteral + kDataLayoutAllocaMemorySpaceKey = "dlti.alloca_memory_space"; + + constexpr const static ::llvm::StringLiteral + kDataLayoutStackAlignmentKey = "dlti.stack_alignment"; + }; +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::DLTIDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/Traits.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/Traits.h new file mode 100644 index 0000000000000000000000000000000000000000..5d86195305a95739337943637175e4bb757d0f7d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/DLTI/Traits.h @@ -0,0 +1,43 @@ +//===- Traits.h - Trait Declaration for MLIR DLTI dialect -------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_DLTI_TRAITS_H +#define MLIR_DIALECT_DLTI_TRAITS_H + +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/DataLayoutInterfaces.h" + +namespace mlir { +class DataLayoutSpecAttr; + +namespace impl { +LogicalResult verifyHasDefaultDLTIDataLayoutTrait(Operation *op); +DataLayoutSpecInterface getDataLayoutSpec(Operation *op); +} // namespace impl + +/// Trait to be used by operations willing to use the implementation of the +/// data layout interfaces provided by the Target dialect. +template +class HasDefaultDLTIDataLayout + : public OpTrait::TraitBase { +public: + /// Verifies that the operation to which this trait is attached is valid for + /// the trait, i.e., that it implements the data layout operation interface. + static LogicalResult verifyTrait(Operation *op) { + return impl::verifyHasDefaultDLTIDataLayoutTrait(op); + } + + /// Returns the data layout specification as provided by the Target dialect + /// specification attribute. + DataLayoutSpecInterface getDataLayoutSpec() { + return impl::getDataLayoutSpec(this->getOperation()); + } +}; +} // namespace mlir + +#endif // MLIR_DIALECT_DLTI_TRAITS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Extensions/AllExtensions.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Extensions/AllExtensions.h new file mode 100644 index 0000000000000000000000000000000000000000..4ecd11d34a8cee012eb5d210f0db4e830d699716 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Extensions/AllExtensions.h @@ -0,0 +1,30 @@ +//===- AllExtensions.h - All Func Extensions --------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines a common entry point for registering all extensions to the +// func dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_FUNC_EXTENSIONS_ALLEXTENSIONS_H +#define MLIR_DIALECT_FUNC_EXTENSIONS_ALLEXTENSIONS_H + +namespace mlir { +class DialectRegistry; + +namespace func { +/// Register all extensions of the func dialect. This should generally only be +/// used by tools, or other use cases that really do want *all* extensions of +/// the dialect. All other cases should prefer to instead register the specific +/// extensions they intend to take advantage of. +void registerAllExtensions(DialectRegistry ®istry); +} // namespace func + +} // namespace mlir + +#endif // MLIR_DIALECT_FUNC_EXTENSIONS_ALLEXTENSIONS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Extensions/InlinerExtension.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Extensions/InlinerExtension.h new file mode 100644 index 0000000000000000000000000000000000000000..4f9f307bb877d6fc9fcf84e75466fac327ad95da --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Extensions/InlinerExtension.h @@ -0,0 +1,27 @@ +//===- InlinerExtension.h - Func Inliner Extension 0000----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines an extension for the func dialect that implements the +// interfaces necessary to support inlining. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_FUNC_EXTENSIONS_INLINEREXTENSION_H +#define MLIR_DIALECT_FUNC_EXTENSIONS_INLINEREXTENSION_H + +namespace mlir { +class DialectRegistry; + +namespace func { +/// Register the extension used to support inlining the func dialect. +void registerInlinerExtension(DialectRegistry ®istry); +} // namespace func + +} // namespace mlir + +#endif // MLIR_DIALECT_FUNC_EXTENSIONS_INLINEREXTENSION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..c7d95e9c5e6a483bb5d9a3b79fb1db94204535bd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.cpp.inc @@ -0,0 +1,1783 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: FuncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::func::CallIndirectOp, +::mlir::func::CallOp, +::mlir::func::ConstantOp, +::mlir::func::FuncOp, +::mlir::func::ReturnOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace func { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_FuncOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::FunctionType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be function type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_FuncOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_FuncOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: flat symbol reference attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_FuncOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_FuncOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_FuncOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_FuncOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_FuncOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_FuncOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: type attribute of function type"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_FuncOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_FuncOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_FuncOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Array of dictionary attributes"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_FuncOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_FuncOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_FuncOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} +} // namespace func +} // namespace mlir +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::CallIndirectOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CallIndirectOpGenericAdaptorBase::CallIndirectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("func.call_indirect", odsAttrs.getContext()); +} + +CallIndirectOpGenericAdaptorBase::CallIndirectOpGenericAdaptorBase(CallIndirectOp op) : CallIndirectOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CallIndirectOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CallIndirectOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CallIndirectOpAdaptor::CallIndirectOpAdaptor(CallIndirectOp op) : CallIndirectOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CallIndirectOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CallIndirectOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CallIndirectOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FunctionType> CallIndirectOp::getCallee() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FunctionType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range CallIndirectOp::getCalleeOperands() { + return getODSOperands(1); +} + +::mlir::OpOperand &CallIndirectOp::getCalleeMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CallIndirectOp::getCalleeOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CallIndirectOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CallIndirectOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range CallIndirectOp::getResults() { + return getODSResults(0); +} + +void CallIndirectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value callee, ValueRange operands) { + odsState.operands.push_back(callee); + odsState.addOperands(operands); + odsState.addTypes(::llvm::cast(callee.getType()).getResults()); + +} + +void CallIndirectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::Value callee, ::mlir::ValueRange callee_operands) { + odsState.addOperands(callee); + odsState.addOperands(callee_operands); + odsState.addTypes(results); +} + +void CallIndirectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CallIndirectOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_FuncOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_FuncOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_FuncOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getInputs(), this->getODSOperands(1).getType())))) + return emitOpError("failed to verify that callee input types match argument types"); + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getResults(), this->getODSResults(0).getType())))) + return emitOpError("failed to verify that callee result types match result types"); + return ::mlir::success(); +} + +::mlir::LogicalResult CallIndirectOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void CallIndirectOp::getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context) { + results.add(canonicalize); +} + +::mlir::ParseResult CallIndirectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand calleeRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> calleeOperands(calleeRawOperands); ::llvm::SMLoc calleeOperandsLoc; + (void)calleeOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> callee_operandsOperands; + ::llvm::SMLoc callee_operandsOperandsLoc; + (void)callee_operandsOperandsLoc; + ::mlir::Type calleeRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> calleeTypes(calleeRawTypes); + + calleeOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(calleeRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + callee_operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(callee_operandsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::FunctionType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + calleeRawTypes[0] = type; + } + for (::mlir::Type type : calleeTypes) { + (void)type; + if (!((::llvm::isa<::mlir::FunctionType>(type)))) { + return parser.emitError(parser.getNameLoc()) << "'callee' must be function type, but got " << type; + } + } + result.addTypes(::llvm::cast(calleeTypes[0]).getResults()); + if (parser.resolveOperands(calleeOperands, calleeTypes, calleeOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(callee_operandsOperands, ::llvm::cast(calleeTypes[0]).getInputs(), callee_operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CallIndirectOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getCallee(); + _odsPrinter << "("; + _odsPrinter << getCalleeOperands(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getCallee().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::FunctionType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace func +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::func::CallIndirectOp) + +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::CallOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("func.call", odsAttrs.getContext()); +} + +CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(CallOp op) : CallOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CallOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CallOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::FlatSymbolRefAttr CallOpGenericAdaptorBase::getCalleeAttr() { + auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().callee); + return attr; +} + +::llvm::StringRef CallOpGenericAdaptorBase::getCallee() { + auto attr = getCalleeAttr(); + return attr.getValue(); +} + +} // namespace detail +CallOpAdaptor::CallOpAdaptor(CallOp op) : CallOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CallOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_callee = getProperties().callee; (void)tblgen_callee; + if (!tblgen_callee) return emitError(loc, "'func.call' op ""requires attribute 'callee'"); + + if (tblgen_callee && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_callee)))) + return emitError(loc, "'func.call' op ""attribute 'callee' failed to satisfy constraint: flat symbol reference attribute"); + return ::mlir::success(); +} + +std::pair CallOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CallOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CallOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange CallOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CallOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CallOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult CallOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.callee; + auto attr = dict.get("callee"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for callee in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `callee` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CallOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.callee; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("callee", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CallOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.callee.getAsOpaquePointer())); +} + +std::optional CallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "callee") + return prop.callee; + return std::nullopt; +} + +void CallOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "callee") { + prop.callee = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.callee) attrs.append("callee", prop.callee); +} + +::mlir::LogicalResult CallOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps0(attr, "callee", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CallOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.callee))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.callee); +} + +::mlir::FlatSymbolRefAttr CallOp::getCalleeAttr() { + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().callee); +} + +::llvm::StringRef CallOp::getCallee() { + auto attr = getCalleeAttr(); + return attr.getValue(); +} + +void CallOp::setCalleeAttr(::mlir::FlatSymbolRefAttr attr) { + (*this)->setAttr(getCalleeAttrName(), attr); +} + +void CallOp::setCallee(::llvm::StringRef attrValue) { + (*this)->setAttr(getCalleeAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, FuncOp callee, ValueRange operands) { + odsState.addOperands(operands); + odsState.addAttribute("callee", SymbolRefAttr::get(callee)); + odsState.addTypes(callee.getFunctionType().getResults()); + +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, SymbolRefAttr callee, TypeRange results, ValueRange operands) { + odsState.addOperands(operands); + odsState.addAttribute("callee", callee); + odsState.addTypes(results); + +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr callee, TypeRange results, ValueRange operands) { + build(odsBuilder, odsState, SymbolRefAttr::get(callee), results, operands); + +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef callee, TypeRange results, ValueRange operands) { + build(odsBuilder, odsState, StringAttr::get(odsBuilder.getContext(), callee), + results, operands); + +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().callee = callee; + odsState.addTypes(resultType0); +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands) { + odsState.addOperands(operands); + odsState.getOrAddProperties().callee = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), callee); + odsState.addTypes(resultType0); +} + +void CallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CallOp::verifyInvariantsImpl() { + auto tblgen_callee = getProperties().callee; (void)tblgen_callee; + if (!tblgen_callee) return emitOpError("requires attribute 'callee'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps0(*this, tblgen_callee, "callee"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_FuncOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_FuncOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CallOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CallOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::FlatSymbolRefAttr calleeAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> operandsTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + if (parser.parseCustomAttributeWithFallback(calleeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (calleeAttr) result.getOrAddProperties().callee = calleeAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType operands__allResult_functionType; + if (parser.parseType(operands__allResult_functionType)) + return ::mlir::failure(); + operandsTypes = operands__allResult_functionType.getInputs(); + allResultTypes = operands__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CallOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getCalleeAttr()); + _odsPrinter << "("; + _odsPrinter << getOperands(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("callee"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperands().getTypes(), getOperation()->getResultTypes()); +} + +} // namespace func +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::func::CallOp) + +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::ConstantOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("func.constant", odsAttrs.getContext()); +} + +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(ConstantOp op) : ConstantOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ConstantOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ConstantOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::FlatSymbolRefAttr ConstantOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().value); + return attr; +} + +::llvm::StringRef ConstantOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr.getValue(); +} + +} // namespace detail +ConstantOpAdaptor::ConstantOpAdaptor(ConstantOp op) : ConstantOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ConstantOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitError(loc, "'func.constant' op ""requires attribute 'value'"); + + if (tblgen_value && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_value)))) + return emitError(loc, "'func.constant' op ""attribute 'value' failed to satisfy constraint: flat symbol reference attribute"); + return ::mlir::success(); +} + +std::pair ConstantOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ConstantOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ConstantOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ConstantOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult ConstantOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ConstantOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional ConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void ConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult ConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps0(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.value); +} + +::mlir::FlatSymbolRefAttr ConstantOp::getValueAttr() { + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().value); +} + +::llvm::StringRef ConstantOp::getValue() { + auto attr = getValueAttr(); + return attr.getValue(); +} + +void ConstantOp::setValueAttr(::mlir::FlatSymbolRefAttr attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void ConstantOp::setValue(::llvm::StringRef attrValue) { + (*this)->setAttr(getValueAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::FlatSymbolRefAttr value) { + odsState.getOrAddProperties().value = value; + odsState.addTypes(resultType0); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr value) { + odsState.getOrAddProperties().value = value; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::llvm::StringRef value) { + odsState.getOrAddProperties().value = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), value); + odsState.addTypes(resultType0); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef value) { + odsState.getOrAddProperties().value = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ConstantOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitOpError("requires attribute 'value'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps0(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_FuncOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ConstantOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::FlatSymbolRefAttr valueAttr; + ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + if (parser.parseCustomAttributeWithFallback(valueAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (valueAttr) result.getOrAddProperties().value = valueAttr; + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allResultTypes)) + return ::mlir::failure(); + result.addTypes(allResultTypes); + return ::mlir::success(); +} + +void ConstantOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getValueAttr()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getResultTypes(); +} + +void ConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace func +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::func::ConstantOp) + +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::FuncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("func.func", odsAttrs.getContext()); +} + +FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(FuncOp op) : FuncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FuncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FuncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr FuncOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef FuncOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FuncOpGenericAdaptorBase::getFunctionTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); + return attr; +} + +::mlir::FunctionType FuncOpGenericAdaptorBase::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::StringAttr FuncOpGenericAdaptorBase::getSymVisibilityAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); + return attr; +} + +::std::optional< ::llvm::StringRef > FuncOpGenericAdaptorBase::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOpGenericAdaptorBase::getArgAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOpGenericAdaptorBase::getResAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::Region &FuncOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange FuncOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +FuncOpAdaptor::FuncOpAdaptor(FuncOp op) : FuncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FuncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitError(loc, "'func.func' op ""requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'func.func' op ""requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'func.func' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))))) + return emitError(loc, "'func.func' op ""attribute 'function_type' failed to satisfy constraint: type attribute of function type"); + + if (tblgen_sym_visibility && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_visibility)))) + return emitError(loc, "'func.func' op ""attribute 'sym_visibility' failed to satisfy constraint: string attribute"); + + if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'func.func' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'func.func' op ""attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); + return ::mlir::success(); +} + +std::pair FuncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FuncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair FuncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FuncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &FuncOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult FuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.arg_attrs; + auto attr = dict.get("arg_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for arg_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.function_type; + auto attr = dict.get("function_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for function_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `function_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.res_attrs; + auto attr = dict.get("res_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for res_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_visibility; + auto attr = dict.get("sym_visibility"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for sym_visibility in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.arg_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.function_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("function_type", + propStorage)); + } + + { + const auto &propStorage = prop.res_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("res_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.sym_visibility; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_visibility", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FuncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.function_type.getAsOpaquePointer()), + llvm::hash_value(prop.res_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.sym_visibility.getAsOpaquePointer())); +} + +std::optional FuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "arg_attrs") + return prop.arg_attrs; + + if (name == "function_type") + return prop.function_type; + + if (name == "res_attrs") + return prop.res_attrs; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "sym_visibility") + return prop.sym_visibility; + return std::nullopt; +} + +void FuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "arg_attrs") { + prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "function_type") { + prop.function_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "res_attrs") { + prop.res_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_visibility") { + prop.sym_visibility = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); + + if (prop.function_type) attrs.append("function_type", prop.function_type); + + if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.sym_visibility) attrs.append("sym_visibility", prop.sym_visibility); +} + +::mlir::LogicalResult FuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps3(attr, "arg_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps2(attr, "function_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps3(attr, "res_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps1(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymVisibilityAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps1(attr, "sym_visibility", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.function_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.sym_visibility))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.arg_attrs); + writer.writeAttribute(prop.function_type); + + writer.writeOptionalAttribute(prop.res_attrs); + writer.writeAttribute(prop.sym_name); + + writer.writeOptionalAttribute(prop.sym_visibility); +} + +::mlir::StringAttr FuncOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef FuncOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FuncOp::getFunctionTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); +} + +::mlir::FunctionType FuncOp::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::StringAttr FuncOp::getSymVisibilityAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); +} + +::std::optional< ::llvm::StringRef > FuncOp::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOp::getArgAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); +} + +::std::optional< ::mlir::ArrayAttr > FuncOp::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOp::getResAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); +} + +::std::optional< ::mlir::ArrayAttr > FuncOp::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void FuncOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void FuncOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void FuncOp::setFunctionTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getFunctionTypeAttrName(), attr); +} + +void FuncOp::setFunctionType(::mlir::FunctionType attrValue) { + (*this)->setAttr(getFunctionTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void FuncOp::setSymVisibilityAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymVisibilityAttrName(), attr); +} + +void FuncOp::setSymVisibility(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSymVisibilityAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSymVisibilityAttrName()); +} + +void FuncOp::setArgAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getArgAttrsAttrName(), attr); +} + +void FuncOp::setResAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getResAttrsAttrName(), attr); +} + +::mlir::Attribute FuncOp::removeSymVisibilityAttr() { + auto &attr = getProperties().sym_visibility; + attr = {}; + return attr; +} + +::mlir::Attribute FuncOp::removeArgAttrsAttr() { + auto &attr = getProperties().arg_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute FuncOp::removeResAttrsAttr() { + auto &attr = getProperties().res_attrs; + attr = {}; + return attr; +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().function_type = function_type; + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + (void)odsState.addRegion(); +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().function_type = function_type; + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + (void)odsState.addRegion(); +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FuncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FuncOp::verifyInvariantsImpl() { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps1(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps2(*this, tblgen_function_type, "function_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps1(*this, tblgen_sym_visibility, "sym_visibility"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps3(*this, tblgen_arg_attrs, "arg_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_FuncOps3(*this, tblgen_res_attrs, "res_attrs"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_FuncOps0(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FuncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace func +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::func::FuncOp) + +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::ReturnOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("func.return", odsAttrs.getContext()); +} + +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(ReturnOp op) : ReturnOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReturnOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ReturnOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ReturnOpAdaptor::ReturnOpAdaptor(ReturnOp op) : ReturnOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReturnOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ReturnOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ReturnOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ReturnOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange ReturnOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ReturnOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReturnOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + build(odsBuilder, odsState, std::nullopt); + +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { + odsState.addOperands(operands); +} + +void ReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReturnOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_FuncOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReturnOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReturnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> operandsTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (!operandsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(operandsTypes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (!getOperands().empty()) { + _odsPrinter << ' '; + _odsPrinter << getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperands().getTypes(); + } +} + +void ReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange ReturnOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace func +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::func::ReturnOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.h new file mode 100644 index 0000000000000000000000000000000000000000..5e10a9f50b774e30496c872a27fafc5894766e16 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.h @@ -0,0 +1,48 @@ +//===- FuncOps.h - Func Dialect Operations ----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_FUNC_IR_OPS_H +#define MLIR_DIALECT_FUNC_IR_OPS_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/CallInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/FunctionInterfaces.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +namespace mlir { +class PatternRewriter; +} // namespace mlir + +#define GET_OP_CLASSES +#include "mlir/Dialect/Func/IR/FuncOps.h.inc" + +#include "mlir/Dialect/Func/IR/FuncOpsDialect.h.inc" + +namespace llvm { + +/// Allow stealing the low bits of FuncOp. +template <> +struct PointerLikeTypeTraits { + static inline void *getAsVoidPointer(mlir::func::FuncOp val) { + return const_cast(val.getAsOpaquePointer()); + } + static inline mlir::func::FuncOp getFromVoidPointer(void *p) { + return mlir::func::FuncOp::getFromOpaquePointer(p); + } + static constexpr int numLowBitsAvailable = 3; +}; +} // namespace llvm + +#endif // MLIR_DIALECT_FUNC_IR_OPS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..4eeb4f7fb5648529f33a9be9da44a75db23f4d76 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOps.h.inc @@ -0,0 +1,931 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: FuncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace func { +class CallIndirectOp; +} // namespace func +} // namespace mlir +namespace mlir { +namespace func { +class CallOp; +} // namespace func +} // namespace mlir +namespace mlir { +namespace func { +class ConstantOp; +} // namespace func +} // namespace mlir +namespace mlir { +namespace func { +class FuncOp; +} // namespace func +} // namespace mlir +namespace mlir { +namespace func { +class ReturnOp; +} // namespace func +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::CallIndirectOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CallIndirectOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CallIndirectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CallIndirectOpGenericAdaptorBase(CallIndirectOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CallIndirectOpGenericAdaptor : public detail::CallIndirectOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CallIndirectOpGenericAdaptorBase; +public: + CallIndirectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CallIndirectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CallIndirectOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CallIndirectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCallee() { + return (*getODSOperands(0).begin()); + } + + RangeT getCalleeOperands() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CallIndirectOpAdaptor : public CallIndirectOpGenericAdaptor<::mlir::ValueRange> { +public: + using CallIndirectOpGenericAdaptor::CallIndirectOpGenericAdaptor; + CallIndirectOpAdaptor(CallIndirectOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CallIndirectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::CallOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CallIndirectOpAdaptor; + template + using GenericAdaptor = CallIndirectOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("func.call_indirect"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FunctionType> getCallee(); + ::mlir::Operation::operand_range getCalleeOperands(); + ::mlir::OpOperand &getCalleeMutable(); + ::mlir::MutableOperandRange getCalleeOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value callee, ValueRange operands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::Value callee, ::mlir::ValueRange callee_operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult canonicalize(CallIndirectOp op, ::mlir::PatternRewriter &rewriter); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + // TODO: Remove once migrated callers. + ValueRange operands() { return getCalleeOperands(); } + + /// Get the argument operands to the called function. + operand_range getArgOperands() { + return {arg_operand_begin(), arg_operand_end()}; + } + + MutableOperandRange getArgOperandsMutable() { + return getCalleeOperandsMutable(); + } + + operand_iterator arg_operand_begin() { return ++operand_begin(); } + operand_iterator arg_operand_end() { return operand_end(); } + + /// Return the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getCallee(); } + + /// Set the callee for this operation. + void setCalleeFromCallable(CallInterfaceCallable callee) { + setOperand(0, callee.get()); + } +}; +} // namespace func +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::CallIndirectOp) + +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::CallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CallOpGenericAdaptorBase { +public: + struct Properties { + using calleeTy = ::mlir::FlatSymbolRefAttr; + calleeTy callee; + + auto getCallee() { + auto &propStorage = this->callee; + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setCallee(const ::mlir::FlatSymbolRefAttr &propValue) { + this->callee = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.callee == this->callee && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CallOpGenericAdaptorBase(CallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); +}; +} // namespace detail +template +class CallOpGenericAdaptor : public detail::CallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CallOpGenericAdaptorBase; +public: + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CallOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class CallOpAdaptor : public CallOpGenericAdaptor<::mlir::ValueRange> { +public: + using CallOpGenericAdaptor::CallOpGenericAdaptor; + CallOpAdaptor(CallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CallOpAdaptor; + template + using GenericAdaptor = CallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("callee")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCalleeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("func.call"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); + void setCalleeAttr(::mlir::FlatSymbolRefAttr attr); + void setCallee(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, FuncOp callee, ValueRange operands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, SymbolRefAttr callee, TypeRange results, ValueRange operands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr callee, TypeRange results, ValueRange operands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef callee, TypeRange results, ValueRange operands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + FunctionType getCalleeType(); + + /// Get the argument operands to the called function. + operand_range getArgOperands() { + return {arg_operand_begin(), arg_operand_end()}; + } + + MutableOperandRange getArgOperandsMutable() { + return getOperandsMutable(); + } + + operand_iterator arg_operand_begin() { return operand_begin(); } + operand_iterator arg_operand_end() { return operand_end(); } + + /// Return the callee of this operation. + CallInterfaceCallable getCallableForCallee() { + return (*this)->getAttrOfType("callee"); + } + + /// Set the callee for this operation. + void setCalleeFromCallable(CallInterfaceCallable callee) { + (*this)->setAttr("callee", callee.get()); + } +}; +} // namespace func +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::CallOp) + +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::ConstantOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstantOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::FlatSymbolRefAttr; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setValue(const ::mlir::FlatSymbolRefAttr &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstantOpGenericAdaptorBase(ConstantOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getValueAttr(); + ::llvm::StringRef getValue(); +}; +} // namespace detail +template +class ConstantOpGenericAdaptor : public detail::ConstantOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstantOpGenericAdaptorBase; +public: + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstantOpAdaptor : public ConstantOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstantOpGenericAdaptor::ConstantOpGenericAdaptor; + ConstantOpAdaptor(ConstantOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstantOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstantOpAdaptor; + template + using GenericAdaptor = ConstantOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("func.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::FlatSymbolRefAttr getValueAttr(); + ::llvm::StringRef getValue(); + void setValueAttr(::mlir::FlatSymbolRefAttr attr); + void setValue(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::FlatSymbolRefAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::llvm::StringRef value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns true if a constant operation can be built with the given value + /// and result type. + static bool isBuildableWith(Attribute value, Type type); +}; +} // namespace func +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::ConstantOp) + +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::FuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FuncOpGenericAdaptorBase { +public: + struct Properties { + using arg_attrsTy = ::mlir::ArrayAttr; + arg_attrsTy arg_attrs; + + auto getArgAttrs() { + auto &propStorage = this->arg_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setArgAttrs(const ::mlir::ArrayAttr &propValue) { + this->arg_attrs = propValue; + } + using function_typeTy = ::mlir::TypeAttr; + function_typeTy function_type; + + auto getFunctionType() { + auto &propStorage = this->function_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setFunctionType(const ::mlir::TypeAttr &propValue) { + this->function_type = propValue; + } + using res_attrsTy = ::mlir::ArrayAttr; + res_attrsTy res_attrs; + + auto getResAttrs() { + auto &propStorage = this->res_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setResAttrs(const ::mlir::ArrayAttr &propValue) { + this->res_attrs = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using sym_visibilityTy = ::mlir::StringAttr; + sym_visibilityTy sym_visibility; + + auto getSymVisibility() { + auto &propStorage = this->sym_visibility; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSymVisibility(const ::mlir::StringAttr &propValue) { + this->sym_visibility = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.arg_attrs == this->arg_attrs && + rhs.function_type == this->function_type && + rhs.res_attrs == this->res_attrs && + rhs.sym_name == this->sym_name && + rhs.sym_visibility == this->sym_visibility && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FuncOpGenericAdaptorBase(FuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FuncOpGenericAdaptor : public detail::FuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FuncOpGenericAdaptorBase; +public: + FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FuncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FuncOpAdaptor : public FuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using FuncOpGenericAdaptor::FuncOpGenericAdaptor; + FuncOpAdaptor(FuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FuncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FuncOpAdaptor; + template + using GenericAdaptor = FuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("function_type"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("sym_visibility")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getArgAttrsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFunctionTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getResAttrsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSymVisibilityAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("func.func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setFunctionTypeAttr(::mlir::TypeAttr attr); + void setFunctionType(::mlir::FunctionType attrValue); + void setSymVisibilityAttr(::mlir::StringAttr attr); + void setSymVisibility(::std::optional<::llvm::StringRef> attrValue); + void setArgAttrsAttr(::mlir::ArrayAttr attr); + void setResAttrsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeSymVisibilityAttr(); + ::mlir::Attribute removeArgAttrsAttr(); + ::mlir::Attribute removeResAttrsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, FunctionType type, ArrayRef attrs = {}, ArrayRef argAttrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::StringAttr sym_visibility, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static FuncOp create(Location location, StringRef name, FunctionType type, + ArrayRef attrs = {}); + static FuncOp create(Location location, StringRef name, FunctionType type, + Operation::dialect_attr_range attrs); + static FuncOp create(Location location, StringRef name, FunctionType type, + ArrayRef attrs, + ArrayRef argAttrs); + + /// Create a deep copy of this function and all of its blocks, remapping any + /// operands that use values outside of the function using the map that is + /// provided (leaving them alone if no entry is present). If the mapper + /// contains entries for function arguments, these arguments are not + /// included in the new function. Replaces references to cloned sub-values + /// with the corresponding value that is copied, and adds those mappings to + /// the mapper. + FuncOp clone(IRMapping &mapper); + FuncOp clone(); + + /// Clone the internal blocks and attributes from this function into dest. + /// Any cloned blocks are appended to the back of dest. This function + /// asserts that the attributes of the current function and dest are + /// compatible. + void cloneInto(FuncOp dest, IRMapping &mapper); + + //===------------------------------------------------------------------===// + // FunctionOpInterface Methods + //===------------------------------------------------------------------===// + + /// Returns the region on the current operation that is callable. This may + /// return null in the case of an external callable object, e.g. an external + /// function. + ::mlir::Region *getCallableRegion() { return isExternal() ? nullptr : &getBody(); } + + /// Returns the argument types of this function. + ArrayRef getArgumentTypes() { return getFunctionType().getInputs(); } + + /// Returns the result types of this function. + ArrayRef getResultTypes() { return getFunctionType().getResults(); } + + //===------------------------------------------------------------------===// + // OpAsmOpInterface Methods + //===------------------------------------------------------------------===// + + /// Allow the dialect prefix to be omitted. + static StringRef getDefaultDialect() { return "func"; } + + //===------------------------------------------------------------------===// + // SymbolOpInterface Methods + //===------------------------------------------------------------------===// + + bool isDeclaration() { return isExternal(); } +}; +} // namespace func +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::FuncOp) + +namespace mlir { +namespace func { + +//===----------------------------------------------------------------------===// +// ::mlir::func::ReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReturnOpGenericAdaptorBase(ReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReturnOpGenericAdaptorBase; +public: + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor; + ReturnOpAdaptor(ReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReturnOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReturnOpAdaptor; + template + using GenericAdaptor = ReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("func.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace func +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::ReturnOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..ffdf0332d09578135a32b35dca6967dd5eab1d2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: FuncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::func::FuncDialect) +namespace mlir { +namespace func { + +FuncDialect::FuncDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +FuncDialect::~FuncDialect() = default; + +} // namespace func +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..077c0db566f95e5bb665655c0418da80cf1db7cd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsDialect.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: FuncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace func { + +class FuncDialect : public ::mlir::Dialect { + explicit FuncDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~FuncDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("func"); + } + + /// Materialize a single constant operation from a given attribute value with + /// the desired resultant type. + ::mlir::Operation *materializeConstant(::mlir::OpBuilder &builder, + ::mlir::Attribute value, + ::mlir::Type type, + ::mlir::Location loc) override; +}; +} // namespace func +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::func::FuncDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..90b2a7cc99fb190d9648ac062e0621aa2eb8d8b3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsEnums.cpp.inc @@ -0,0 +1,9 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: FuncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..8bb0773580b0688693c9a7fb887265198ededb16 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/IR/FuncOpsEnums.h.inc @@ -0,0 +1,9 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: FuncOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..4af4c65148da3d94e8973eaf5e366f989c085269 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h @@ -0,0 +1,94 @@ +//===- DecomposeCallGraphTypes.h - CG type decompositions -------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Conversion patterns for decomposing types along call graph edges. That is, +// decomposing types for calls, returns, and function args. +// +// TODO: Make this handle dialect-defined functions, calls, and returns. +// Currently, the generic interfaces aren't sophisticated enough for the +// types of mutations that we are doing here. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_FUNC_TRANSFORMS_DECOMPOSECALLGRAPHTYPES_H +#define MLIR_DIALECT_FUNC_TRANSFORMS_DECOMPOSECALLGRAPHTYPES_H + +#include "mlir/Transforms/DialectConversion.h" +#include + +namespace mlir { + +/// This class provides a hook that expands one Value into multiple Value's, +/// with a TypeConverter-inspired callback registration mechanism. +/// +/// For folks that are familiar with the dialect conversion framework / +/// TypeConverter, this is effectively the inverse of a source/argument +/// materialization. A target materialization is not what we want here because +/// it always produces a single Value, but in this case the whole point is to +/// decompose a Value into multiple Value's. +/// +/// The reason we need this inverse is easily understood by looking at what we +/// need to do for decomposing types for a return op. When converting a return +/// op, the dialect conversion framework will give the list of converted +/// operands, and will ensure that each converted operand, even if it expanded +/// into multiple types, is materialized as a single result. We then need to +/// undo that materialization to a single result, which we do with the +/// decomposeValue hooks registered on this object. +/// +/// TODO: Eventually, the type conversion infra should have this hook built-in. +/// See +/// https://llvm.discourse.group/t/extending-type-conversion-infrastructure/779/2 +class ValueDecomposer { +public: + /// This method tries to decompose a value of a certain type using provided + /// decompose callback functions. If it is unable to do so, the original value + /// is returned. + void decomposeValue(OpBuilder &, Location, Type, Value, + SmallVectorImpl &); + + /// This method registers a callback function that will be called to decompose + /// a value of a certain type into 0, 1, or multiple values. + template >::template arg_t<2>> + void addDecomposeValueConversion(FnT &&callback) { + decomposeValueConversions.emplace_back( + wrapDecomposeValueConversionCallback(std::forward(callback))); + } + +private: + using DecomposeValueConversionCallFn = + std::function( + OpBuilder &, Location, Type, Value, SmallVectorImpl &)>; + + /// Generate a wrapper for the given decompose value conversion callback. + template + DecomposeValueConversionCallFn + wrapDecomposeValueConversionCallback(FnT &&callback) { + return + [callback = std::forward(callback)]( + OpBuilder &builder, Location loc, Type type, Value value, + SmallVectorImpl &newValues) -> std::optional { + if (T derivedType = dyn_cast(type)) + return callback(builder, loc, derivedType, value, newValues); + return std::nullopt; + }; + } + + SmallVector decomposeValueConversions; +}; + +/// Populates the patterns needed to drive the conversion process for +/// decomposing call graph types with the given `ValueDecomposer`. +void populateDecomposeCallGraphTypesPatterns(MLIRContext *context, + TypeConverter &typeConverter, + ValueDecomposer &decomposer, + RewritePatternSet &patterns); + +} // namespace mlir + +#endif // MLIR_DIALECT_FUNC_TRANSFORMS_DECOMPOSECALLGRAPHTYPES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h new file mode 100644 index 0000000000000000000000000000000000000000..adcd3087b7e2fd217b44ebc4fee545a091906bb8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h @@ -0,0 +1,73 @@ +//===- FuncConversions.h - Patterns for converting func.func ----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This files contains patterns for converting functions. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_FUNC_TRANSFORMS_FUNCCONVERSIONS_H_ +#define MLIR_DIALECT_FUNC_TRANSFORMS_FUNCCONVERSIONS_H_ + +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/STLExtras.h" + +namespace mlir { + +// Forward declarations. +class BranchOpInterface; +class ConversionTarget; +class MLIRContext; +class Operation; +class TypeConverter; +class RewritePatternSet; + +/// Add a pattern to the given pattern list to convert the operand and result +/// types of a CallOp with the given type converter. +void populateCallOpTypeConversionPattern(RewritePatternSet &patterns, + TypeConverter &converter); + +/// Add a pattern to the given pattern list to rewrite branch operations to use +/// operands that have been legalized by the conversion framework. This can only +/// be done if the branch operation implements the BranchOpInterface. Only +/// needed for partial conversions. +/// +/// If for some branch ops, we need to convert/legalize only a sub-set of the +/// op's operands, such filtering behavior can be specified in +/// shouldConvertBranchOperand. This callback should return true if branchOp's +/// operand at index idx should be converted. +void populateBranchOpInterfaceTypeConversionPattern( + RewritePatternSet &patterns, TypeConverter &converter, + function_ref + shouldConvertBranchOperand = nullptr); + +/// Return true if op is a BranchOpInterface op whose operands are all legal +/// according to converter. +bool isLegalForBranchOpInterfaceTypeConversionPattern(Operation *op, + TypeConverter &converter); + +/// Add a pattern to the given pattern list to rewrite `return` ops to use +/// operands that have been legalized by the conversion framework. +void populateReturnOpTypeConversionPattern(RewritePatternSet &patterns, + TypeConverter &converter); + +/// For ReturnLike ops (except `return`), return True. If op is a `return` && +/// returnOpAlwaysLegal is false, legalize op according to converter. Otherwise, +/// return false. +bool isLegalForReturnOpTypeConversionPattern(Operation *op, + TypeConverter &converter, + bool returnOpAlwaysLegal = false); + +/// Return true if op is neither BranchOpInterface nor ReturnLike. +/// +/// TODO Try to get rid of this function and invert the meaning of +/// `isLegalForBranchOpInterfaceTypeConversionPattern` and +/// `isLegalForReturnOpTypeConversionPattern`. +bool isNotBranchOpInterfaceOrReturnLikeOp(Operation *op); +} // namespace mlir + +#endif // MLIR_DIALECT_FUNC_TRANSFORMS_FUNCCONVERSIONS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/OneToNFuncConversions.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/OneToNFuncConversions.h new file mode 100644 index 0000000000000000000000000000000000000000..2fba342ea80e71da5b45f745ba5258b6932fa09c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/OneToNFuncConversions.h @@ -0,0 +1,26 @@ +//===- OneToNTypeFuncConversions.h - 1:N type conv. for Func ----*- C++ -*-===// +// +// Licensed under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_FUNC_TRANSFORMS_ONETONTYPEFUNCCONVERSIONS_H +#define MLIR_DIALECT_FUNC_TRANSFORMS_ONETONTYPEFUNCCONVERSIONS_H + +namespace mlir { +class TypeConverter; +class RewritePatternSet; +} // namespace mlir + +namespace mlir { + +// Populates the provided pattern set with patterns that do 1:N type conversions +// on func ops. This is intended to be used with `applyPartialOneToNConversion`. +void populateFuncTypeConversionPatterns(TypeConverter &typeConverter, + RewritePatternSet &patterns); + +} // namespace mlir + +#endif // MLIR_DIALECT_FUNC_TRANSFORMS_ONETONTYPEFUNCCONVERSIONS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..011ad3e3d0be4d6b1e4f397e8da2a0360788cf75 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/Passes.h @@ -0,0 +1,49 @@ +//===- Passes.h - Pass Entrypoints ------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes that expose pass constructors in the Func +// transformation library. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_H +#define MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_H + +#include "mlir/IR/BuiltinOps.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { +namespace bufferization { +class BufferizeTypeConverter; +} // namespace bufferization + +class RewritePatternSet; + +namespace func { + +#define GEN_PASS_DECL +#include "mlir/Dialect/Func/Transforms/Passes.h.inc" + +/// Creates an instance of func bufferization pass. +std::unique_ptr createFuncBufferizePass(); + +/// Pass to deduplicate functions. +std::unique_ptr createDuplicateFunctionEliminationPass(); + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/Func/Transforms/Passes.h.inc" + +} // namespace func +} // namespace mlir + +#endif // MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..4dbceb4235c2c063f62f18ddc9d53ddef2056701 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Func/Transforms/Passes.h.inc @@ -0,0 +1,272 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_DUPLICATEFUNCTIONELIMINATIONPASS +#define GEN_PASS_DECL_FUNCBUFFERIZE +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// DuplicateFunctionEliminationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DUPLICATEFUNCTIONELIMINATIONPASS +#undef GEN_PASS_DECL_DUPLICATEFUNCTIONELIMINATIONPASS +#endif // GEN_PASS_DECL_DUPLICATEFUNCTIONELIMINATIONPASS +#ifdef GEN_PASS_DEF_DUPLICATEFUNCTIONELIMINATIONPASS +namespace impl { + +template +class DuplicateFunctionEliminationPassBase : public ::mlir::OperationPass { +public: + using Base = DuplicateFunctionEliminationPassBase; + + DuplicateFunctionEliminationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DuplicateFunctionEliminationPassBase(const DuplicateFunctionEliminationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("duplicate-function-elimination"); + } + ::llvm::StringRef getArgument() const override { return "duplicate-function-elimination"; } + + ::llvm::StringRef getDescription() const override { return "Deduplicate functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DuplicateFunctionEliminationPass"); + } + ::llvm::StringRef getName() const override { return "DuplicateFunctionEliminationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DuplicateFunctionEliminationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DUPLICATEFUNCTIONELIMINATIONPASS +#endif // GEN_PASS_DEF_DUPLICATEFUNCTIONELIMINATIONPASS + +//===----------------------------------------------------------------------===// +// FuncBufferize +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FUNCBUFFERIZE +#undef GEN_PASS_DECL_FUNCBUFFERIZE +#endif // GEN_PASS_DECL_FUNCBUFFERIZE +#ifdef GEN_PASS_DEF_FUNCBUFFERIZE +namespace impl { + +template +class FuncBufferizeBase : public ::mlir::OperationPass { +public: + using Base = FuncBufferizeBase; + + FuncBufferizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FuncBufferizeBase(const FuncBufferizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("func-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "func-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Bufferize func/call/return ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FuncBufferize"); + } + ::llvm::StringRef getName() const override { return "FuncBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FuncBufferizeBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FUNCBUFFERIZE +#endif // GEN_PASS_DEF_FUNCBUFFERIZE +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// DuplicateFunctionEliminationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDuplicateFunctionEliminationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::func::createDuplicateFunctionEliminationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDuplicateFunctionEliminationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::func::createDuplicateFunctionEliminationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FuncBufferize Registration +//===----------------------------------------------------------------------===// + +inline void registerFuncBufferize() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::func::createFuncBufferizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFuncBufferizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::func::createFuncBufferizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// Func Registration +//===----------------------------------------------------------------------===// + +inline void registerFuncPasses() { + registerDuplicateFunctionEliminationPass(); + registerFuncBufferize(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class DuplicateFunctionEliminationPassBase : public ::mlir::OperationPass { +public: + using Base = DuplicateFunctionEliminationPassBase; + + DuplicateFunctionEliminationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DuplicateFunctionEliminationPassBase(const DuplicateFunctionEliminationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("duplicate-function-elimination"); + } + ::llvm::StringRef getArgument() const override { return "duplicate-function-elimination"; } + + ::llvm::StringRef getDescription() const override { return "Deduplicate functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DuplicateFunctionEliminationPass"); + } + ::llvm::StringRef getName() const override { return "DuplicateFunctionEliminationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DuplicateFunctionEliminationPassBase) + +protected: +}; + +template +class FuncBufferizeBase : public ::mlir::OperationPass { +public: + using Base = FuncBufferizeBase; + + FuncBufferizeBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FuncBufferizeBase(const FuncBufferizeBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("func-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "func-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Bufferize func/call/return ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FuncBufferize"); + } + ::llvm::StringRef getName() const override { return "FuncBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FuncBufferizeBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..ca98c8e566e4488745021f311c5d0692127c687b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.cpp.inc @@ -0,0 +1,51 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Serializes a GPU module to a string containing a representation of the +/// module. +/// +/// If serialization fails then the method should return `std::nullopt`. +/// +/// The `module` parameter must be a GPU Module Op. The `options` parameter +/// is meant to be used for passing additional options that are not in the +/// attribute. +std::optional> mlir::gpu::TargetAttrInterface::serializeToObject(Operation* module, const gpu::TargetOptions& options) const { + return getImpl()->serializeToObject(getImpl(), *this, module, options); + } +/// Creates a GPU object attribute from a binary string. +/// +/// The `object` parameter is a binary string. The `options` parameter is +/// meant to be used for passing additional options that are not in the +/// attribute. +Attribute mlir::gpu::TargetAttrInterface::createObject(const SmallVector& object, const gpu::TargetOptions& options) const { + return getImpl()->createObject(getImpl(), *this, object, options); + } +/// Translates a `gpu.binary` Op into a sequence of LLVM IR target-specific +/// instructions, embedding the binary into a host LLVM module. +/// +/// The LLVM translation mechanism invokes this function when translating a +/// `gpu.binary`. +/// +/// The first argument has to be a GPU binary operation. +/// If the function fails at any point, it must return `failure`. +LogicalResult mlir::gpu::OffloadingLLVMTranslationAttrInterface::embedBinary(Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation) const { + return getImpl()->embedBinary(getImpl(), *this, binaryOp, hostBuilder, hostModuleTranslation); + } +/// Translates a `gpu.launch_func` op into a sequence of LLVM IR +/// target-specific instructions, resulting in a kernel launch on host IR. +/// +/// The LLVM translation mechanism invokes this function when translating a +/// `gpu.launch_func` operation; it searches the appropriate binary and uses +/// its offloading handler. +/// +/// The first two arguments must be GPU launch and binary operations, +/// respectively. If the function fails at any point, it must return +/// `failure`. +LogicalResult mlir::gpu::OffloadingLLVMTranslationAttrInterface::launchKernel(Operation* launchFunc, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation) const { + return getImpl()->launchKernel(getImpl(), *this, launchFunc, binaryOp, hostBuilder, hostModuleTranslation); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..0d320c12dfe012f5de5413ca56b0304e4ac2f284 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc @@ -0,0 +1,183 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace gpu { +class TargetAttrInterface; +namespace detail { +struct TargetAttrInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + std::optional> (*serializeToObject)(const Concept *impl, ::mlir::Attribute , Operation*, const gpu::TargetOptions&); + Attribute (*createObject)(const Concept *impl, ::mlir::Attribute , const SmallVector&, const gpu::TargetOptions&); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::gpu::TargetAttrInterface; + Model() : Concept{serializeToObject, createObject} {} + + static inline std::optional> serializeToObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* module, const gpu::TargetOptions& options); + static inline Attribute createObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, const SmallVector& object, const gpu::TargetOptions& options); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::gpu::TargetAttrInterface; + FallbackModel() : Concept{serializeToObject, createObject} {} + + static inline std::optional> serializeToObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* module, const gpu::TargetOptions& options); + static inline Attribute createObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, const SmallVector& object, const gpu::TargetOptions& options); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteAttr; + }; +};template +struct TargetAttrInterfaceTrait; + +} // namespace detail +class TargetAttrInterface : public ::mlir::AttributeInterface { +public: + using ::mlir::AttributeInterface::AttributeInterface; + template + struct Trait : public detail::TargetAttrInterfaceTrait {}; + /// Serializes a GPU module to a string containing a representation of the + /// module. + /// + /// If serialization fails then the method should return `std::nullopt`. + /// + /// The `module` parameter must be a GPU Module Op. The `options` parameter + /// is meant to be used for passing additional options that are not in the + /// attribute. + std::optional> serializeToObject(Operation* module, const gpu::TargetOptions& options) const; + /// Creates a GPU object attribute from a binary string. + /// + /// The `object` parameter is a binary string. The `options` parameter is + /// meant to be used for passing additional options that are not in the + /// attribute. + Attribute createObject(const SmallVector& object, const gpu::TargetOptions& options) const; +}; +namespace detail { + template + struct TargetAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { + }; +}// namespace detail +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class OffloadingLLVMTranslationAttrInterface; +namespace detail { +struct OffloadingLLVMTranslationAttrInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + LogicalResult (*embedBinary)(const Concept *impl, ::mlir::Attribute , Operation*, llvm::IRBuilderBase&, LLVM::ModuleTranslation&); + LogicalResult (*launchKernel)(const Concept *impl, ::mlir::Attribute , Operation*, Operation*, llvm::IRBuilderBase&, LLVM::ModuleTranslation&); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::gpu::OffloadingLLVMTranslationAttrInterface; + Model() : Concept{embedBinary, launchKernel} {} + + static inline LogicalResult embedBinary(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation); + static inline LogicalResult launchKernel(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* launchFunc, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::gpu::OffloadingLLVMTranslationAttrInterface; + FallbackModel() : Concept{embedBinary, launchKernel} {} + + static inline LogicalResult embedBinary(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation); + static inline LogicalResult launchKernel(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* launchFunc, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteAttr; + }; +};template +struct OffloadingLLVMTranslationAttrInterfaceTrait; + +} // namespace detail +class OffloadingLLVMTranslationAttrInterface : public ::mlir::AttributeInterface { +public: + using ::mlir::AttributeInterface::AttributeInterface; + template + struct Trait : public detail::OffloadingLLVMTranslationAttrInterfaceTrait {}; + /// Translates a `gpu.binary` Op into a sequence of LLVM IR target-specific + /// instructions, embedding the binary into a host LLVM module. + /// + /// The LLVM translation mechanism invokes this function when translating a + /// `gpu.binary`. + /// + /// The first argument has to be a GPU binary operation. + /// If the function fails at any point, it must return `failure`. + LogicalResult embedBinary(Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation) const; + /// Translates a `gpu.launch_func` op into a sequence of LLVM IR + /// target-specific instructions, resulting in a kernel launch on host IR. + /// + /// The LLVM translation mechanism invokes this function when translating a + /// `gpu.launch_func` operation; it searches the appropriate binary and uses + /// its offloading handler. + /// + /// The first two arguments must be GPU launch and binary operations, + /// respectively. If the function fails at any point, it must return + /// `failure`. + LogicalResult launchKernel(Operation* launchFunc, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation) const; +}; +namespace detail { + template + struct OffloadingLLVMTranslationAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { + }; +}// namespace detail +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +template +std::optional> detail::TargetAttrInterfaceInterfaceTraits::Model::serializeToObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* module, const gpu::TargetOptions& options) { + return (::llvm::cast(tablegen_opaque_val)).serializeToObject(module, options); +} +template +Attribute detail::TargetAttrInterfaceInterfaceTraits::Model::createObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, const SmallVector& object, const gpu::TargetOptions& options) { + return (::llvm::cast(tablegen_opaque_val)).createObject(object, options); +} +template +std::optional> detail::TargetAttrInterfaceInterfaceTraits::FallbackModel::serializeToObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* module, const gpu::TargetOptions& options) { + return static_cast(impl)->serializeToObject(tablegen_opaque_val, module, options); +} +template +Attribute detail::TargetAttrInterfaceInterfaceTraits::FallbackModel::createObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, const SmallVector& object, const gpu::TargetOptions& options) { + return static_cast(impl)->createObject(tablegen_opaque_val, object, options); +} +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +template +LogicalResult detail::OffloadingLLVMTranslationAttrInterfaceInterfaceTraits::Model::embedBinary(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation) { + return (::llvm::cast(tablegen_opaque_val)).embedBinary(binaryOp, hostBuilder, hostModuleTranslation); +} +template +LogicalResult detail::OffloadingLLVMTranslationAttrInterfaceInterfaceTraits::Model::launchKernel(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* launchFunc, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation) { + return (::llvm::cast(tablegen_opaque_val)).launchKernel(launchFunc, binaryOp, hostBuilder, hostModuleTranslation); +} +template +LogicalResult detail::OffloadingLLVMTranslationAttrInterfaceInterfaceTraits::FallbackModel::embedBinary(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation) { + return static_cast(impl)->embedBinary(tablegen_opaque_val, binaryOp, hostBuilder, hostModuleTranslation); +} +template +LogicalResult detail::OffloadingLLVMTranslationAttrInterfaceInterfaceTraits::FallbackModel::launchKernel(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, Operation* launchFunc, Operation* binaryOp, llvm::IRBuilderBase& hostBuilder, LLVM::ModuleTranslation& hostModuleTranslation) { + return static_cast(impl)->launchKernel(tablegen_opaque_val, launchFunc, binaryOp, hostBuilder, hostModuleTranslation); +} +} // namespace gpu +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationInterfaces.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationInterfaces.h new file mode 100644 index 0000000000000000000000000000000000000000..6d7cb5ca7a7f81f7489e8915ecea48e43703e5ce --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/CompilationInterfaces.h @@ -0,0 +1,122 @@ +//===-- CompilationInterfaces.h - GPU compilation interfaces ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines interfaces for GPU compilation. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_GPU_IR_COMPILATIONINTERFACES_H +#define MLIR_DIALECT_GPU_IR_COMPILATIONINTERFACES_H + +#include "mlir/IR/Attributes.h" + +namespace llvm { +class IRBuilderBase; +} + +namespace mlir { +class SymbolTable; +namespace LLVM { +class ModuleTranslation; +} +namespace gpu { +enum class CompilationTarget : uint32_t; + +/// This class indicates that the attribute associated with this trait is a GPU +/// offloading translation attribute. These kinds of attributes must implement +/// an interface for handling the translation of GPU offloading operations like +/// `gpu.binary` & `gpu.launch_func`. +template +class OffloadingTranslationAttrTrait + : public AttributeTrait::TraitBase { + // TODO: Verify the attribute promises or implements the interface. +}; + +/// This class serves as an opaque interface for passing options to the +/// `TargetAttrInterface` methods. Users of this class must implement the +/// `classof` method as well as using the macros `MLIR_*_EXPLICIT_TYPE_ID` to +/// ensure type safeness. Targets are free to ignore these options. +class TargetOptions { +public: + /// Constructor initializing the toolkit path, the list of files to link to, + /// extra command line options, the compilation target and a callback for + /// obtaining the parent symbol table. The default compilation target is + /// `Fatbin`. + TargetOptions( + StringRef toolkitPath = {}, ArrayRef linkFiles = {}, + StringRef cmdOptions = {}, + CompilationTarget compilationTarget = getDefaultCompilationTarget(), + function_ref getSymbolTableCallback = {}); + + /// Returns the typeID. + TypeID getTypeID() const; + + /// Returns the toolkit path. + StringRef getToolkitPath() const; + + /// Returns the files to link to. + ArrayRef getLinkFiles() const; + + /// Returns the command line options. + StringRef getCmdOptions() const; + + /// Returns a tokenization of the command line options. + std::pair> + tokenizeCmdOptions() const; + + /// Returns the compilation target. + CompilationTarget getCompilationTarget() const; + + /// Returns the result of the `getSymbolTableCallback` callback or a nullptr + /// if no callback was provided. + /// Note: The callback itself can return nullptr. It is up to the target how + /// to react to getting a nullptr, e.g., emitting an error or constructing the + /// table. + SymbolTable *getSymbolTable() const; + + /// Returns the default compilation target: `CompilationTarget::Fatbin`. + static CompilationTarget getDefaultCompilationTarget(); + +protected: + /// Derived classes must use this constructor to initialize `typeID` to the + /// appropiate value: ie. `TargetOptions(TypeID::get())`. + TargetOptions( + TypeID typeID, StringRef toolkitPath = {}, + ArrayRef linkFiles = {}, StringRef cmdOptions = {}, + CompilationTarget compilationTarget = getDefaultCompilationTarget(), + function_ref getSymbolTableCallback = {}); + + /// Path to the target toolkit. + std::string toolkitPath; + + /// List of files to link with the LLVM module. + SmallVector linkFiles; + + /// An optional set of command line options to be used by the compilation + /// process. + std::string cmdOptions; + + /// Compilation process target format. + CompilationTarget compilationTarget; + + /// Callback for obtaining the parent symbol table of all the GPU modules + /// being serialized. + function_ref getSymbolTableCallback; + +private: + TypeID typeID; +}; +} // namespace gpu +} // namespace mlir + +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::TargetOptions) + +#include "mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc" + +#endif // MLIR_DIALECT_GPU_IR_COMPILATIONINTERFACES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..14a1fac5fd255f35400aef7ab06b7b40ce44772c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUDialect.h @@ -0,0 +1,201 @@ +//===- GPUDialect.h - MLIR Dialect for GPU Kernels --------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the GPU kernel-related operations and puts them in the +// corresponding dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_GPU_IR_GPUDIALECT_H +#define MLIR_DIALECT_GPU_IR_GPUDIALECT_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/DLTI/Traits.h" +#include "mlir/Dialect/GPU/IR/CompilationInterfaces.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/FunctionInterfaces.h" +#include "mlir/Interfaces/InferIntRangeInterface.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" +#include "llvm/ADT/STLExtras.h" + +namespace mlir { +namespace gpu { + +/// Utility class for the GPU dialect to represent triples of `Value`s +/// accessible through `.x`, `.y`, and `.z` similarly to CUDA notation. +struct KernelDim3 { + Value x; + Value y; + Value z; +}; + +class AsyncTokenType + : public Type::TypeBase { +public: + // Used for generic hooks in TypeBase. + using Base::Base; +}; + +/// MMAMatrixType storage and uniquing. Array is uniqued based on its shape +/// and type. +struct MMAMatrixStorageType : public TypeStorage { + MMAMatrixStorageType(unsigned numDims, const int64_t *dimShapes, + Type elementType, StringRef operand) + : dimShapes(dimShapes), numDims(numDims), elementType(elementType), + operand(operand) {} + + /// The hash key for uniquing. + using KeyTy = std::tuple, Type, StringRef>; + bool operator==(const KeyTy &key) const { + return key == KeyTy(getShape(), elementType, operand); + } + + /// Construction. + static MMAMatrixStorageType *construct(TypeStorageAllocator &allocator, + const KeyTy &key) { + ArrayRef shape = allocator.copyInto(std::get<0>(key)); + StringRef operand = allocator.copyInto(std::get<2>(key)); + + return new (allocator.allocate()) + MMAMatrixStorageType(shape.size(), shape.data(), std::get<1>(key), + operand); + } + + ArrayRef getShape() const { + return ArrayRef(dimShapes, numDims); + } + + StringRef getOperand() const { return operand; } + + /// Reference to the shape of the MMA matrix. + const int64_t *dimShapes; + + /// Number of dimensions in the MMA matrix. + unsigned numDims; + + /// Element type of elements held in the MMA matrix. + Type elementType; + + /// MMA operand that this MMAMatrix holds. The general form of operation this + /// type supports is given by the equation C += A*B. This field specifies + /// which operand in the given equation is held by this type. The valid values + /// are "AOp", "BOp" and "COp". + StringRef operand; +}; + +/// MMAMatrix represents a matrix held by a subgroup for matrix-matrix multiply +/// accumulate operations. MMAMatrices are taken as direct operands by these +/// operations and are also produced as results. These matrices are meant to +/// reside in the registers. A limited number of pointwise operations can be +/// performed on these matrices, i.e., operations which operate uniformly on +/// all the elements in the matrix and do not change the order of matrix +/// elements. The above conditions exist because the layout of matrix elements +/// inside the matrix is opaque i.e., the elements may be present in the +/// matrix in any order. The general usage of this type is shown as follows:- +/// +/// %0 = gpu.subgroup_mma_load_matrix %arg0[%c0, %c0] {leadDimension = 16 : +/// index} : memref<16x16xf16> -> !gpu.mma_matrix<16x16xf16, "AOp"> +/// +/// The MMAMatrixType describes the shape of the matrix being loaded and the +/// operand being loaded too. The operand needs to be specified to aid the +/// lowering of this type to dialects such as NVVM where each workitem may +/// hold different amount of elements depending on the elementType of the +/// matrix. For e.g., Each workitem holds 4 vector<2xf16>s for f16 data type +/// and 8 f32s for f32 data type of MMAMatrix. Some other instances of usage +/// are:- +/// +/// %3 = gpu.subgroup_mma_compute %0, %1, %2 : +/// !gpu.mma_matrix<16x16xf16, "AOp">, !gpu.mma_matrix<16x16xf16, "BOp"> +/// -> !gpu.mma_matrix<16x16xf32, "COp"> +/// +/// +/// gpu.subgroup_mma_store_matrix %3, %arg22[%c0, %c0] {leadDimension = 16 +/// : index}: !gpu.mma_matrix<16x16xf32, "COp">, memref<16x16xf32> +// TODO: consider moving this to ODS. +class MMAMatrixType + : public Type::TypeBase { +public: + using Base::Base; + + /// Get MMAMatrixType and verify construction Invariants. + static MMAMatrixType get(ArrayRef shape, Type elementType, + StringRef operand); + + /// Get MMAMatrixType at a particular location and verify construction + /// Invariants. + static MMAMatrixType getChecked(function_ref emitError, + ArrayRef shape, Type elementType, + StringRef operand); + + /// Check if a type is valid a MMAMatrixType elementType. + static bool isValidElementType(Type elementType); + + /// Verify that shape and elementType are actually allowed for the + /// MMAMatrixType. + static LogicalResult verify(function_ref emitError, + ArrayRef shape, Type elementType, + StringRef operand); + + /// Get number of dims. + unsigned getNumDims() const; + + /// Get shape of the matrix. + ArrayRef getShape() const; + + /// Get elementType of a single element. + Type getElementType() const; + + /// The general form of operation this type supports is given by the equation + /// C += A*B. This function returns which operand in the given equation is + /// held by this type. String returned can be one of"AOp", "BOp" and "COp". + StringRef getOperand() const; +}; + +// Adds a `gpu.async.token` to the front of the argument list. +void addAsyncDependency(Operation *op, Value token); + +// Handle types for sparse. +enum class SparseHandleKind { SpMat, DnTensor, SpGEMMOp }; + +template +class SparseHandleType + : public Type::TypeBase, Type, TypeStorage> { +public: + using Base = + typename Type::TypeBase, Type, TypeStorage>::Base; + using Base::Base; +}; + +using SparseDnTensorHandleType = SparseHandleType; +using SparseSpMatHandleType = SparseHandleType; +using SparseSpGEMMOpHandleType = SparseHandleType; + +} // namespace gpu +} // namespace mlir + +#include "mlir/Dialect/GPU/IR/GPUOpsEnums.h.inc" + +#include "mlir/Dialect/GPU/IR/GPUOpsDialect.h.inc" + +#include "mlir/Dialect/GPU/IR/GPUOpInterfaces.h.inc" + +#include "mlir/Dialect/SCF/IR/DeviceMappingInterface.h" + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/GPU/IR/GPUOpsAttributes.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/GPU/IR/GPUOps.h.inc" + +#endif // MLIR_DIALECT_GPU_IR_GPUDIALECT_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..88e64b4b3d45e9a46cd268d4de567e8969c7e55d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpInterfaces.cpp.inc @@ -0,0 +1,20 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Query the operands that represent async dependency tokens. +OperandRange mlir::gpu::AsyncOpInterface::getAsyncDependencies() { + return getImpl()->getAsyncDependencies(getImpl(), getOperation()); + } +/// Adds a new token to the list of async dependencies if it is not already there. +void mlir::gpu::AsyncOpInterface::addAsyncDependency(Value token) { + return getImpl()->addAsyncDependency(getImpl(), getOperation(), token); + } +/// Query the result that represents the async token to depend on. +Value mlir::gpu::AsyncOpInterface::getAsyncToken() { + return getImpl()->getAsyncToken(getImpl(), getOperation()); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ddc404a8ee184d0c0aecd67ee07f70f19dbbc25f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpInterfaces.h.inc @@ -0,0 +1,117 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace gpu { +class AsyncOpInterface; +namespace detail { +struct AsyncOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + OperandRange (*getAsyncDependencies)(const Concept *impl, ::mlir::Operation *); + void (*addAsyncDependency)(const Concept *impl, ::mlir::Operation *, Value); + Value (*getAsyncToken)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::gpu::AsyncOpInterface; + Model() : Concept{getAsyncDependencies, addAsyncDependency, getAsyncToken} {} + + static inline OperandRange getAsyncDependencies(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void addAsyncDependency(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, Value token); + static inline Value getAsyncToken(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::gpu::AsyncOpInterface; + FallbackModel() : Concept{getAsyncDependencies, addAsyncDependency, getAsyncToken} {} + + static inline OperandRange getAsyncDependencies(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void addAsyncDependency(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, Value token); + static inline Value getAsyncToken(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + OperandRange getAsyncDependencies(::mlir::Operation *tablegen_opaque_val) const; + void addAsyncDependency(::mlir::Operation *tablegen_opaque_val, Value token) const; + }; +};template +struct AsyncOpInterfaceTrait; + +} // namespace detail +class AsyncOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AsyncOpInterfaceTrait {}; + /// Query the operands that represent async dependency tokens. + OperandRange getAsyncDependencies(); + /// Adds a new token to the list of async dependencies if it is not already there. + void addAsyncDependency(Value token); + /// Query the result that represents the async token to depend on. + Value getAsyncToken(); +}; +namespace detail { + template + struct AsyncOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Query the operands that represent async dependency tokens. + OperandRange getAsyncDependencies() { + ConcreteOp op = cast(this->getOperation()); + return op.getAsyncDependencies(); + } + /// Adds a new token to the list of async dependencies if it is not already there. + void addAsyncDependency(Value token) { + if (!::llvm::is_contained(this->getAsyncDependencies(), token)) + ::mlir::gpu::addAsyncDependency(this->getOperation(), token); + } + }; +}// namespace detail +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +template +OperandRange detail::AsyncOpInterfaceInterfaceTraits::Model::getAsyncDependencies(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getAsyncDependencies(); +} +template +void detail::AsyncOpInterfaceInterfaceTraits::Model::addAsyncDependency(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, Value token) { + return (llvm::cast(tablegen_opaque_val)).addAsyncDependency(token); +} +template +Value detail::AsyncOpInterfaceInterfaceTraits::Model::getAsyncToken(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getAsyncToken(); +} +template +OperandRange detail::AsyncOpInterfaceInterfaceTraits::FallbackModel::getAsyncDependencies(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getAsyncDependencies(tablegen_opaque_val); +} +template +void detail::AsyncOpInterfaceInterfaceTraits::FallbackModel::addAsyncDependency(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, Value token) { + return static_cast(impl)->addAsyncDependency(tablegen_opaque_val, token); +} +template +Value detail::AsyncOpInterfaceInterfaceTraits::FallbackModel::getAsyncToken(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getAsyncToken(tablegen_opaque_val); +} +template +OperandRange detail::AsyncOpInterfaceInterfaceTraits::ExternalModel::getAsyncDependencies(::mlir::Operation *tablegen_opaque_val) const { +ConcreteOp op = cast(this->getOperation()); + return op.getAsyncDependencies(); +} +template +void detail::AsyncOpInterfaceInterfaceTraits::ExternalModel::addAsyncDependency(::mlir::Operation *tablegen_opaque_val, Value token) const { +if (!::llvm::is_contained(this->getAsyncDependencies(), token)) + ::mlir::gpu::addAsyncDependency(this->getOperation(), token); +} +} // namespace gpu +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..b693946cddd9b33d925c8ec1fcca5004bdff8851 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOps.cpp.inc @@ -0,0 +1,21975 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: GPUOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::gpu::AllReduceOp, +::mlir::gpu::AllocOp, +::mlir::gpu::BarrierOp, +::mlir::gpu::BinaryOp, +::mlir::gpu::BlockDimOp, +::mlir::gpu::BlockIdOp, +::mlir::gpu::Create2To4SpMatOp, +::mlir::gpu::CreateBsrOp, +::mlir::gpu::CreateCooAoSOp, +::mlir::gpu::CreateCooOp, +::mlir::gpu::CreateCscOp, +::mlir::gpu::CreateCsrOp, +::mlir::gpu::CreateDnTensorOp, +::mlir::gpu::DeallocOp, +::mlir::gpu::DestroyDnTensorOp, +::mlir::gpu::DestroySpMatOp, +::mlir::gpu::GPUFuncOp, +::mlir::gpu::GPUModuleOp, +::mlir::gpu::GlobalIdOp, +::mlir::gpu::GridDimOp, +::mlir::gpu::HostRegisterOp, +::mlir::gpu::HostUnregisterOp, +::mlir::gpu::LaneIdOp, +::mlir::gpu::LaunchFuncOp, +::mlir::gpu::LaunchOp, +::mlir::gpu::MemcpyOp, +::mlir::gpu::MemsetOp, +::mlir::gpu::ModuleEndOp, +::mlir::gpu::NumSubgroupsOp, +::mlir::gpu::PrintfOp, +::mlir::gpu::ReturnOp, +::mlir::gpu::SDDMMBufferSizeOp, +::mlir::gpu::SDDMMOp, +::mlir::gpu::SetCsrPointersOp, +::mlir::gpu::SetDefaultDeviceOp, +::mlir::gpu::ShuffleOp, +::mlir::gpu::SpGEMMCopyOp, +::mlir::gpu::SpGEMMCreateDescrOp, +::mlir::gpu::SpGEMMDestroyDescrOp, +::mlir::gpu::SpGEMMWorkEstimationOrComputeOp, +::mlir::gpu::SpMMBufferSizeOp, +::mlir::gpu::SpMMOp, +::mlir::gpu::SpMVBufferSizeOp, +::mlir::gpu::SpMVOp, +::mlir::gpu::SpMatGetSizeOp, +::mlir::gpu::SubgroupIdOp, +::mlir::gpu::SubgroupMmaComputeOp, +::mlir::gpu::SubgroupMmaConstantMatrixOp, +::mlir::gpu::SubgroupMmaElementwiseOp, +::mlir::gpu::SubgroupMmaLoadMatrixOp, +::mlir::gpu::SubgroupMmaStoreMatrixOp, +::mlir::gpu::SubgroupReduceOp, +::mlir::gpu::SubgroupSizeOp, +::mlir::gpu::TerminatorOp, +::mlir::gpu::ThreadIdOp, +::mlir::gpu::WaitOp, +::mlir::gpu::YieldOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace gpu { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::gpu::AsyncTokenType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be async token type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((llvm::isa<::mlir::gpu::SparseSpMatHandleType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be sparse matrix handle type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((llvm::isa<::mlir::gpu::SparseDnTensorHandleType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be dense tensor handle type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::UnrankedMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be unranked.memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::IndexType>(type))) || ((type.isSignlessInteger(32))) || ((type.isSignlessInteger(64))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index or 32-bit signless integer or 64-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(32)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::IntegerType>(type))) || ((::llvm::isa<::mlir::IndexType>(type))) || ((::llvm::isa<::mlir::FloatType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer or index or floating-point, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessInteger(32))) || ((type.isSignlessInteger(64))) || ((type.isF32())) || ((type.isF64())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be i32, i64, f32 or f64, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps11( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps12( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((llvm::isa<::mlir::gpu::SparseSpGEMMOpHandleType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be SpGEMM operation handle type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps13( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::gpu::MMAMatrixType>(type))) && (((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isSignedInteger(8))) || ((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isUnsignedInteger(8))) || ((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isF32()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be gpu.mma_matrix of 8-bit signed integer or 8-bit unsigned integer or 16-bit float or 32-bit float values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps14( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::gpu::MMAMatrixType>(type))) && (((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isSignlessInteger(32))) || ((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isF32()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be gpu.mma_matrix of 32-bit signless integer or 16-bit float or 32-bit float values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps15( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::gpu::MMAMatrixType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be MMAMatrix type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps16( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignedInteger(8))) || ((type.isUnsignedInteger(8))) || ((type.isSignlessInteger(32))) || ((type.isF16())) || ((type.isF32())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 8-bit signed integer or 8-bit unsigned integer or 32-bit signless integer or 16-bit float or 32-bit float, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps17( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignlessInteger(32))) || ((elementType.isF16())) || ((elementType.isF32())) || (((((::llvm::isa<::mlir::VectorType>(elementType))) && ((::llvm::cast<::mlir::VectorType>(elementType).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignlessInteger(32))) || ((elementType.isF16())) || ((elementType.isF32())); }(::llvm::cast<::mlir::ShapedType>(elementType).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(elementType))) && ((::llvm::cast<::mlir::VectorType>(elementType).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(elementType).getRank() + == 1)))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of 8-bit signless integer or 32-bit signless integer or 16-bit float or 32-bit float or vector of 8-bit signless integer or 32-bit signless integer or 16-bit float or 32-bit float values of ranks 1 values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_GPUOps18( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::gpu::MMAMatrixType>(type))) && (((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isSignedInteger(8))) || ((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isUnsignedInteger(8))) || ((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isSignlessInteger(32))) || ((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isF16())) || ((::llvm::cast<::mlir::gpu::MMAMatrixType>(type).getElementType().isF32()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be gpu.mma_matrix of 8-bit signed integer or 8-bit unsigned integer or 32-bit signless integer or 16-bit float or 32-bit float values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::gpu::AllReduceOperationAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: built-in reduction operations supported by gpu.allreduce."; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((true)) && ((attr.hasTrait<::mlir::gpu::OffloadingTranslationAttrTrait>())))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any attribute with the `OffloadingTranslationAttrTrait` trait."; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::gpu::ObjectAttr>(attr))); }))) && ((::llvm::cast<::mlir::ArrayAttr>(attr).size() >= 1)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: an array of GPU object attributes with at least 1 elements"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::gpu::DimensionAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: a dimension, either 'x', 'y', or 'z'"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::gpu::Prune2To4SpMatFlagAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: pruning strategy for 2:4 sparse matrix"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: type attribute of function type"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps8( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Array of dictionary attributes"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps8( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps8(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps9( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((true)) && ((attr.hasPromiseOrImplementsInterface<::mlir::gpu::TargetAttrInterface>()))); }))) && ((::llvm::cast<::mlir::ArrayAttr>(attr).size() >= 1)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: array of GPU target attributes with at least 1 elements"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps9( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps9(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps10( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: symbol reference attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps10( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps10(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps11( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps11( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps11(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps12( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any type attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps12( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps12(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps13( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::gpu::ShuffleModeAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Indexing modes supported by gpu.shuffle."; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps13( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps13(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps14( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: choose whether spgemm_work_estimation_or_compute does work estimation or compute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps14( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps14(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps15( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::gpu::MMAElementwiseOpAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: elementwise operation to apply to mma matrix"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps15( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps15(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps16( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(attr).getType()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: index attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_GPUOps16( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_GPUOps16(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_GPUOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_GPUOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItems(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with 1 blocks"; + } + return ::mlir::success(); +} +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::AllReduceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AllReduceOpGenericAdaptorBase::AllReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.all_reduce", odsAttrs.getContext()); +} + +AllReduceOpGenericAdaptorBase::AllReduceOpGenericAdaptorBase(AllReduceOp op) : AllReduceOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AllReduceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AllReduceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::AllReduceOperationAttr AllReduceOpGenericAdaptorBase::getOpAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::AllReduceOperationAttr>(getProperties().op); + return attr; +} + +::std::optional<::mlir::gpu::AllReduceOperation> AllReduceOpGenericAdaptorBase::getOp() { + auto attr = getOpAttr(); + return attr ? ::std::optional<::mlir::gpu::AllReduceOperation>(attr.getValue()) : (::std::nullopt); +} + +::mlir::UnitAttr AllReduceOpGenericAdaptorBase::getUniformAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().uniform); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool AllReduceOpGenericAdaptorBase::getUniform() { + auto attr = getUniformAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Region &AllReduceOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange AllReduceOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AllReduceOpAdaptor::AllReduceOpAdaptor(AllReduceOp op) : AllReduceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AllReduceOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_op = getProperties().op; (void)tblgen_op; + auto tblgen_uniform = getProperties().uniform; (void)tblgen_uniform; + + if (tblgen_op && !((::llvm::isa<::mlir::gpu::AllReduceOperationAttr>(tblgen_op)))) + return emitError(loc, "'gpu.all_reduce' op ""attribute 'op' failed to satisfy constraint: built-in reduction operations supported by gpu.allreduce."); + + if (tblgen_uniform && !((::llvm::isa<::mlir::UnitAttr>(tblgen_uniform)))) + return emitError(loc, "'gpu.all_reduce' op ""attribute 'uniform' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair AllReduceOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AllReduceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AllReduceOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AllReduceOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AllReduceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AllReduceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &AllReduceOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult AllReduceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.op; + auto attr = dict.get("op"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for op in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `op` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.uniform; + auto attr = dict.get("uniform"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for uniform in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `uniform` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AllReduceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.op; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("op", + propStorage)); + } + + { + const auto &propStorage = prop.uniform; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("uniform", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AllReduceOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.op.getAsOpaquePointer()), + llvm::hash_value(prop.uniform.getAsOpaquePointer())); +} + +std::optional AllReduceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "op") + return prop.op; + + if (name == "uniform") + return prop.uniform; + return std::nullopt; +} + +void AllReduceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "op") { + prop.op = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "uniform") { + prop.uniform = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AllReduceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.op) attrs.append("op", prop.op); + + if (prop.uniform) attrs.append("uniform", prop.uniform); +} + +::mlir::LogicalResult AllReduceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getOpAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps0(attr, "op", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUniformAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(attr, "uniform", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllReduceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.op))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.uniform))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AllReduceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.op); + + writer.writeOptionalAttribute(prop.uniform); +} + +::mlir::gpu::AllReduceOperationAttr AllReduceOp::getOpAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::AllReduceOperationAttr>(getProperties().op); +} + +::std::optional<::mlir::gpu::AllReduceOperation> AllReduceOp::getOp() { + auto attr = getOpAttr(); + return attr ? ::std::optional<::mlir::gpu::AllReduceOperation>(attr.getValue()) : (::std::nullopt); +} + +::mlir::UnitAttr AllReduceOp::getUniformAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().uniform); +} + +bool AllReduceOp::getUniform() { + auto attr = getUniformAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void AllReduceOp::setOpAttr(::mlir::gpu::AllReduceOperationAttr attr) { + (*this)->setAttr(getOpAttrName(), attr); +} + +void AllReduceOp::setOp(::std::optional<::mlir::gpu::AllReduceOperation> attrValue) { + if (attrValue) + return (*this)->setAttr(getOpAttrName(), ::mlir::gpu::AllReduceOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getOpAttrName()); +} + +void AllReduceOp::setUniformAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getUniformAttrName(), attr); +} + +void AllReduceOp::setUniform(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getUniformAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getUniformAttrName()); +} + +::mlir::Attribute AllReduceOp::removeOpAttr() { + auto &attr = getProperties().op; + attr = {}; + return attr; +} + +::mlir::Attribute AllReduceOp::removeUniformAttr() { + auto &attr = getProperties().uniform; + attr = {}; + return attr; +} + +void AllReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform) { + odsState.addOperands(value); + if (op) { + odsState.getOrAddProperties().op = op; + } + if (uniform) { + odsState.getOrAddProperties().uniform = uniform; + } + (void)odsState.addRegion(); + odsState.addTypes(resultType0); +} + +void AllReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform) { + odsState.addOperands(value); + if (op) { + odsState.getOrAddProperties().op = op; + } + if (uniform) { + odsState.getOrAddProperties().uniform = uniform; + } + (void)odsState.addRegion(); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AllReduceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AllReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform) { + odsState.addOperands(value); + if (op) { + odsState.getOrAddProperties().op = op; + } + if (uniform) { + odsState.getOrAddProperties().uniform = uniform; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AllReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/bool uniform) { + odsState.addOperands(value); + if (op) { + odsState.getOrAddProperties().op = op; + } + if (uniform) { + odsState.getOrAddProperties().uniform = ((uniform) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + odsState.addTypes(resultType0); +} + +void AllReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/bool uniform) { + odsState.addOperands(value); + if (op) { + odsState.getOrAddProperties().op = op; + } + if (uniform) { + odsState.getOrAddProperties().uniform = ((uniform) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AllReduceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AllReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/bool uniform) { + odsState.addOperands(value); + if (op) { + odsState.getOrAddProperties().op = op; + } + if (uniform) { + odsState.getOrAddProperties().uniform = ((uniform) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AllReduceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AllReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AllReduceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AllReduceOp::verifyInvariantsImpl() { + auto tblgen_op = getProperties().op; (void)tblgen_op; + auto tblgen_uniform = getProperties().uniform; (void)tblgen_uniform; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps0(*this, tblgen_op, "op"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(*this, tblgen_uniform, "uniform"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_GPUOps0(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllReduceOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AllReduceOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AllReduceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::gpu::AllReduceOperationAttr opAttr; + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + std::unique_ptr<::mlir::Region> bodyRegion = std::make_unique<::mlir::Region>(); + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + { + auto odsResult = parseAllReduceOperation(parser, opAttr); + if (odsResult) return ::mlir::failure(); + if (opAttr) + result.getOrAddProperties().op = opAttr; + } + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("uniform"))) { + result.getOrAddProperties().uniform = parser.getBuilder().getUnitAttr(); } + + if (parser.parseRegion(*bodyRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addRegion(std::move(bodyRegion)); + result.addTypes(allResultTypes); + if (parser.resolveOperands(valueOperands, allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AllReduceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAllReduceOperation(_odsPrinter, *this, getOpAttr()); + _odsPrinter << ' '; + _odsPrinter << getValue(); + if (getUniformAttr()) { + _odsPrinter << ' ' << "uniform"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getBody()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("op"); + elidedAttrs.push_back("uniform"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getUniformAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("uniform"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::AllReduceOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::AllocOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AllocOpGenericAdaptorBase::AllocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.alloc", odsAttrs.getContext()); +} + +AllocOpGenericAdaptorBase::AllocOpGenericAdaptorBase(AllocOp op) : AllocOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AllocOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr AllocOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr AllocOpGenericAdaptorBase::getHostSharedAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hostShared); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool AllocOpGenericAdaptorBase::getHostShared() { + auto attr = getHostSharedAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +AllocOpAdaptor::AllocOpAdaptor(AllocOp op) : AllocOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AllocOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_hostShared = getProperties().hostShared; (void)tblgen_hostShared; + + if (tblgen_hostShared && !((::llvm::isa<::mlir::UnitAttr>(tblgen_hostShared)))) + return emitError(loc, "'gpu.alloc' op ""attribute 'hostShared' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +void AllocOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "memref"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair AllocOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range AllocOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AllocOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range AllocOp::getDynamicSizes() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range AllocOp::getSymbolOperands() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange AllocOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AllocOp::getDynamicSizesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AllocOp::getSymbolOperandsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair AllocOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range AllocOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> AllocOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSResults(0).begin()); +} + +::mlir::Value AllocOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult AllocOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.hostShared; + auto attr = dict.get("hostShared"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for hostShared in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hostShared` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute AllocOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.hostShared; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hostShared", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AllocOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.hostShared.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional AllocOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "hostShared") + return prop.hostShared; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void AllocOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "hostShared") { + prop.hostShared = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void AllocOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.hostShared) attrs.append("hostShared", prop.hostShared); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult AllocOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getHostSharedAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(attr, "hostShared", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.hostShared))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void AllocOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.hostShared); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr AllocOp::getHostSharedAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hostShared); +} + +bool AllocOp::getHostShared() { + auto attr = getHostSharedAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void AllocOp::setHostSharedAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getHostSharedAttrName(), attr); +} + +void AllocOp::setHostShared(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getHostSharedAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getHostSharedAttrName()); +} + +::mlir::Attribute AllocOp::removeHostSharedAttr() { + auto &attr = getProperties().hostShared; + attr = {}; + return attr; +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::UnitAttr hostShared) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), static_cast(dynamicSizes.size()), static_cast(symbolOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (hostShared) { + odsState.getOrAddProperties().hostShared = hostShared; + } + odsState.addTypes(memref); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::UnitAttr hostShared) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), static_cast(dynamicSizes.size()), static_cast(symbolOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (hostShared) { + odsState.getOrAddProperties().hostShared = hostShared; + } + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/bool hostShared) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), static_cast(dynamicSizes.size()), static_cast(symbolOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (hostShared) { + odsState.getOrAddProperties().hostShared = ((hostShared) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(memref); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/bool hostShared) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), static_cast(dynamicSizes.size()), static_cast(symbolOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (hostShared) { + odsState.getOrAddProperties().hostShared = ((hostShared) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AllocOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AllocOp::verifyInvariantsImpl() { + auto tblgen_hostShared = getProperties().hostShared; (void)tblgen_hostShared; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(*this, tblgen_hostShared, "hostShared"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AllocOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dynamicSizesOperands; + ::llvm::SMLoc dynamicSizesOperandsLoc; + (void)dynamicSizesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> symbolOperandsOperands; + ::llvm::SMLoc symbolOperandsOperandsLoc; + (void)symbolOperandsOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + if (::mlir::succeeded(parser.parseOptionalKeyword("host_shared"))) { + result.getOrAddProperties().hostShared = parser.getBuilder().getUnitAttr(); } + if (parser.parseLParen()) + return ::mlir::failure(); + + dynamicSizesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dynamicSizesOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLSquare())) { + + symbolOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(symbolOperandsOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } +::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependenciesOperands.size()), static_cast(dynamicSizesOperands.size()), static_cast(symbolOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIndexType(); + result.addTypes(memrefTypes); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dynamicSizesOperands, odsBuildableType1, dynamicSizesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(symbolOperandsOperands, odsBuildableType1, symbolOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AllocOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + if (getHostSharedAttr()) { + _odsPrinter << ' '; + _odsPrinter << "host_shared"; + } + _odsPrinter << ' '; + _odsPrinter << "("; + _odsPrinter << getDynamicSizes(); + _odsPrinter << ")"; + if (!getSymbolOperands().empty()) { + _odsPrinter << "["; + _odsPrinter << getSymbolOperands(); + _odsPrinter << "]"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("hostShared"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHostSharedAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("hostShared"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AllocOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSResults(0)) + effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::AllocOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::BarrierOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BarrierOpGenericAdaptorBase::BarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.barrier", odsAttrs.getContext()); +} + +BarrierOpGenericAdaptorBase::BarrierOpGenericAdaptorBase(BarrierOp op) : BarrierOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BarrierOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BarrierOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BarrierOpAdaptor::BarrierOpAdaptor(BarrierOp op) : BarrierOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BarrierOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BarrierOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BarrierOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BarrierOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BarrierOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void BarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void BarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BarrierOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BarrierOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult BarrierOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BarrierOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void BarrierOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::BarrierOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::BinaryOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BinaryOpGenericAdaptorBase::BinaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.binary", odsAttrs.getContext()); +} + +BinaryOpGenericAdaptorBase::BinaryOpGenericAdaptorBase(BinaryOp op) : BinaryOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BinaryOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BinaryOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr BinaryOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef BinaryOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::Attribute BinaryOpGenericAdaptorBase::getOffloadingHandlerAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().offloadingHandler); + return attr; +} + +::std::optional<::mlir::Attribute> BinaryOpGenericAdaptorBase::getOffloadingHandler() { + auto attr = getOffloadingHandlerAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr BinaryOpGenericAdaptorBase::getObjectsAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().objects); + return attr; +} + +::mlir::ArrayAttr BinaryOpGenericAdaptorBase::getObjects() { + auto attr = getObjectsAttr(); + return attr; +} + +} // namespace detail +BinaryOpAdaptor::BinaryOpAdaptor(BinaryOp op) : BinaryOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BinaryOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_objects = getProperties().objects; (void)tblgen_objects; + if (!tblgen_objects) return emitError(loc, "'gpu.binary' op ""requires attribute 'objects'"); + auto tblgen_offloadingHandler = getProperties().offloadingHandler; (void)tblgen_offloadingHandler; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'gpu.binary' op ""requires attribute 'sym_name'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'gpu.binary' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_offloadingHandler && !(((true)) && ((tblgen_offloadingHandler.hasTrait<::mlir::gpu::OffloadingTranslationAttrTrait>())))) + return emitError(loc, "'gpu.binary' op ""attribute 'offloadingHandler' failed to satisfy constraint: any attribute with the `OffloadingTranslationAttrTrait` trait."); + + if (tblgen_objects && !((((::llvm::isa<::mlir::ArrayAttr>(tblgen_objects))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_objects), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::gpu::ObjectAttr>(attr))); }))) && ((::llvm::cast<::mlir::ArrayAttr>(tblgen_objects).size() >= 1)))) + return emitError(loc, "'gpu.binary' op ""attribute 'objects' failed to satisfy constraint: an array of GPU object attributes with at least 1 elements"); + return ::mlir::success(); +} + +std::pair BinaryOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BinaryOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BinaryOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BinaryOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult BinaryOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.objects; + auto attr = dict.get("objects"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for objects in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `objects` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.offloadingHandler; + auto attr = dict.get("offloadingHandler"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for offloadingHandler in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `offloadingHandler` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute BinaryOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.objects; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("objects", + propStorage)); + } + + { + const auto &propStorage = prop.offloadingHandler; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("offloadingHandler", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BinaryOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.objects.getAsOpaquePointer()), + llvm::hash_value(prop.offloadingHandler.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer())); +} + +std::optional BinaryOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "objects") + return prop.objects; + + if (name == "offloadingHandler") + return prop.offloadingHandler; + + if (name == "sym_name") + return prop.sym_name; + return std::nullopt; +} + +void BinaryOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "objects") { + prop.objects = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "offloadingHandler") { + prop.offloadingHandler = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void BinaryOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.objects) attrs.append("objects", prop.objects); + + if (prop.offloadingHandler) attrs.append("offloadingHandler", prop.offloadingHandler); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); +} + +::mlir::LogicalResult BinaryOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getObjectsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps4(attr, "objects", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getOffloadingHandlerAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps3(attr, "offloadingHandler", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps2(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BinaryOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.objects))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.offloadingHandler))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BinaryOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.objects); + + writer.writeOptionalAttribute(prop.offloadingHandler); + writer.writeAttribute(prop.sym_name); +} + +::mlir::StringAttr BinaryOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef BinaryOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::Attribute BinaryOp::getOffloadingHandlerAttr() { + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().offloadingHandler); +} + +::std::optional<::mlir::Attribute> BinaryOp::getOffloadingHandler() { + auto attr = getOffloadingHandlerAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr BinaryOp::getObjectsAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().objects); +} + +::mlir::ArrayAttr BinaryOp::getObjects() { + auto attr = getObjectsAttr(); + return attr; +} + +void BinaryOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void BinaryOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void BinaryOp::setOffloadingHandlerAttr(::mlir::Attribute attr) { + (*this)->setAttr(getOffloadingHandlerAttrName(), attr); +} + +void BinaryOp::setObjectsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getObjectsAttrName(), attr); +} + +::mlir::Attribute BinaryOp::removeOffloadingHandlerAttr() { + auto &attr = getProperties().offloadingHandler; + attr = {}; + return attr; +} + +::mlir::LogicalResult BinaryOp::verifyInvariantsImpl() { + auto tblgen_objects = getProperties().objects; (void)tblgen_objects; + if (!tblgen_objects) return emitOpError("requires attribute 'objects'"); + auto tblgen_offloadingHandler = getProperties().offloadingHandler; (void)tblgen_offloadingHandler; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps2(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps3(*this, tblgen_offloadingHandler, "offloadingHandler"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps4(*this, tblgen_objects, "objects"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult BinaryOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BinaryOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + ::mlir::Attribute offloadingHandlerAttr; + ::mlir::ArrayAttr objectsAttr; + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + { + auto odsResult = parseOffloadingHandler(parser, offloadingHandlerAttr); + if (odsResult) return ::mlir::failure(); + if (offloadingHandlerAttr) + result.getOrAddProperties().offloadingHandler = offloadingHandlerAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + if (parser.parseCustomAttributeWithFallback(objectsAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (objectsAttr) result.getOrAddProperties().objects = objectsAttr; + return ::mlir::success(); +} + +void BinaryOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' '; + printOffloadingHandler(_odsPrinter, *this, getOffloadingHandlerAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("offloadingHandler"); + elidedAttrs.push_back("objects"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getObjectsAttr()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::BinaryOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::BlockDimOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockDimOpGenericAdaptorBase::BlockDimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.block_dim", odsAttrs.getContext()); +} + +BlockDimOpGenericAdaptorBase::BlockDimOpGenericAdaptorBase(BlockDimOp op) : BlockDimOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockDimOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockDimOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::DimensionAttr BlockDimOpGenericAdaptorBase::getDimensionAttr() { + auto attr = ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); + return attr; +} + +::mlir::gpu::Dimension BlockDimOpGenericAdaptorBase::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +} // namespace detail +BlockDimOpAdaptor::BlockDimOpAdaptor(BlockDimOp op) : BlockDimOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockDimOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitError(loc, "'gpu.block_dim' op ""requires attribute 'dimension'"); + + if (tblgen_dimension && !((::llvm::isa<::mlir::gpu::DimensionAttr>(tblgen_dimension)))) + return emitError(loc, "'gpu.block_dim' op ""attribute 'dimension' failed to satisfy constraint: a dimension, either 'x', 'y', or 'z'"); + return ::mlir::success(); +} + +std::pair BlockDimOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockDimOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockDimOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockDimOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult BlockDimOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dimension; + auto attr = dict.get("dimension"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dimension in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dimension` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute BlockDimOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dimension; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dimension", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BlockDimOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dimension.getAsOpaquePointer())); +} + +std::optional BlockDimOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dimension") + return prop.dimension; + return std::nullopt; +} + +void BlockDimOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dimension") { + prop.dimension = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void BlockDimOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dimension) attrs.append("dimension", prop.dimension); +} + +::mlir::LogicalResult BlockDimOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDimensionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(attr, "dimension", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockDimOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dimension))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BlockDimOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dimension); +} + +::mlir::gpu::DimensionAttr BlockDimOp::getDimensionAttr() { + return ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); +} + +::mlir::gpu::Dimension BlockDimOp::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +void BlockDimOp::setDimensionAttr(::mlir::gpu::DimensionAttr attr) { + (*this)->setAttr(getDimensionAttrName(), attr); +} + +void BlockDimOp::setDimension(::mlir::gpu::Dimension attrValue) { + (*this)->setAttr(getDimensionAttrName(), ::mlir::gpu::DimensionAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void BlockDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + odsState.addTypes(resultType0); +} + +void BlockDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BlockDimOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void BlockDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + odsState.addTypes(resultType0); +} + +void BlockDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BlockDimOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void BlockDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockDimOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void BlockDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BlockDimOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult BlockDimOp::verifyInvariantsImpl() { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitOpError("requires attribute 'dimension'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(*this, tblgen_dimension, "dimension"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockDimOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult BlockDimOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult BlockDimOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::gpu::DimensionAttr dimensionAttr; + + if (parser.parseCustomAttributeWithFallback(dimensionAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (dimensionAttr) result.getOrAddProperties().dimension = dimensionAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void BlockDimOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getDimensionAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("dimension"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void BlockDimOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::BlockDimOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::BlockIdOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockIdOpGenericAdaptorBase::BlockIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.block_id", odsAttrs.getContext()); +} + +BlockIdOpGenericAdaptorBase::BlockIdOpGenericAdaptorBase(BlockIdOp op) : BlockIdOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockIdOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockIdOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::DimensionAttr BlockIdOpGenericAdaptorBase::getDimensionAttr() { + auto attr = ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); + return attr; +} + +::mlir::gpu::Dimension BlockIdOpGenericAdaptorBase::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +} // namespace detail +BlockIdOpAdaptor::BlockIdOpAdaptor(BlockIdOp op) : BlockIdOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockIdOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitError(loc, "'gpu.block_id' op ""requires attribute 'dimension'"); + + if (tblgen_dimension && !((::llvm::isa<::mlir::gpu::DimensionAttr>(tblgen_dimension)))) + return emitError(loc, "'gpu.block_id' op ""attribute 'dimension' failed to satisfy constraint: a dimension, either 'x', 'y', or 'z'"); + return ::mlir::success(); +} + +std::pair BlockIdOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockIdOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockIdOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockIdOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult BlockIdOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dimension; + auto attr = dict.get("dimension"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dimension in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dimension` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute BlockIdOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dimension; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dimension", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BlockIdOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dimension.getAsOpaquePointer())); +} + +std::optional BlockIdOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dimension") + return prop.dimension; + return std::nullopt; +} + +void BlockIdOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dimension") { + prop.dimension = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void BlockIdOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dimension) attrs.append("dimension", prop.dimension); +} + +::mlir::LogicalResult BlockIdOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDimensionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(attr, "dimension", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockIdOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dimension))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BlockIdOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dimension); +} + +::mlir::gpu::DimensionAttr BlockIdOp::getDimensionAttr() { + return ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); +} + +::mlir::gpu::Dimension BlockIdOp::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +void BlockIdOp::setDimensionAttr(::mlir::gpu::DimensionAttr attr) { + (*this)->setAttr(getDimensionAttrName(), attr); +} + +void BlockIdOp::setDimension(::mlir::gpu::Dimension attrValue) { + (*this)->setAttr(getDimensionAttrName(), ::mlir::gpu::DimensionAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void BlockIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + odsState.addTypes(resultType0); +} + +void BlockIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BlockIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void BlockIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + odsState.addTypes(resultType0); +} + +void BlockIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BlockIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void BlockIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockIdOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void BlockIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BlockIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult BlockIdOp::verifyInvariantsImpl() { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitOpError("requires attribute 'dimension'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(*this, tblgen_dimension, "dimension"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockIdOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult BlockIdOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult BlockIdOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::gpu::DimensionAttr dimensionAttr; + + if (parser.parseCustomAttributeWithFallback(dimensionAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (dimensionAttr) result.getOrAddProperties().dimension = dimensionAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void BlockIdOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getDimensionAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("dimension"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void BlockIdOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::BlockIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::Create2To4SpMatOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Create2To4SpMatOpGenericAdaptorBase::Create2To4SpMatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.create_2to4_spmat", odsAttrs.getContext()); +} + +Create2To4SpMatOpGenericAdaptorBase::Create2To4SpMatOpGenericAdaptorBase(Create2To4SpMatOp op) : Create2To4SpMatOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Create2To4SpMatOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr Create2To4SpMatOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::Prune2To4SpMatFlagAttr Create2To4SpMatOpGenericAdaptorBase::getPruneFlagAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::Prune2To4SpMatFlagAttr>(getProperties().pruneFlag); + return attr; +} + +::mlir::gpu::Prune2To4SpMatFlag Create2To4SpMatOpGenericAdaptorBase::getPruneFlag() { + auto attr = getPruneFlagAttr(); + return attr.getValue(); +} + +} // namespace detail +Create2To4SpMatOpAdaptor::Create2To4SpMatOpAdaptor(Create2To4SpMatOp op) : Create2To4SpMatOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Create2To4SpMatOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_pruneFlag = getProperties().pruneFlag; (void)tblgen_pruneFlag; + + if (tblgen_pruneFlag && !((::llvm::isa<::mlir::gpu::Prune2To4SpMatFlagAttr>(tblgen_pruneFlag)))) + return emitError(loc, "'gpu.create_2to4_spmat' op ""attribute 'pruneFlag' failed to satisfy constraint: pruning strategy for 2:4 sparse matrix"); + return ::mlir::success(); +} + +void Create2To4SpMatOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "spMat"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair Create2To4SpMatOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range Create2To4SpMatOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Create2To4SpMatOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::IndexType> Create2To4SpMatOp::getRows() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> Create2To4SpMatOp::getCols() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> Create2To4SpMatOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(3).begin()); +} + +::mlir::MutableOperandRange Create2To4SpMatOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &Create2To4SpMatOp::getRowsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &Create2To4SpMatOp::getColsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &Create2To4SpMatOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair Create2To4SpMatOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Create2To4SpMatOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Create2To4SpMatOp::getSpMat() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value Create2To4SpMatOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult Create2To4SpMatOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.pruneFlag; + auto attr = dict.get("pruneFlag"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for pruneFlag in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `pruneFlag` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Create2To4SpMatOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.pruneFlag; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("pruneFlag", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Create2To4SpMatOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.pruneFlag.getAsOpaquePointer())); +} + +std::optional Create2To4SpMatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "pruneFlag") + return prop.pruneFlag; + return std::nullopt; +} + +void Create2To4SpMatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "pruneFlag") { + prop.pruneFlag = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Create2To4SpMatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.pruneFlag) attrs.append("pruneFlag", prop.pruneFlag); +} + +::mlir::LogicalResult Create2To4SpMatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPruneFlagAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps6(attr, "pruneFlag", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Create2To4SpMatOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.pruneFlag))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Create2To4SpMatOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.pruneFlag); +} + +::mlir::gpu::Prune2To4SpMatFlagAttr Create2To4SpMatOp::getPruneFlagAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::Prune2To4SpMatFlagAttr>(getProperties().pruneFlag); +} + +::mlir::gpu::Prune2To4SpMatFlag Create2To4SpMatOp::getPruneFlag() { + auto attr = getPruneFlagAttr(); + return attr.getValue(); +} + +void Create2To4SpMatOp::setPruneFlagAttr(::mlir::gpu::Prune2To4SpMatFlagAttr attr) { + (*this)->setAttr(getPruneFlagAttrName(), attr); +} + +void Create2To4SpMatOp::setPruneFlag(::mlir::gpu::Prune2To4SpMatFlag attrValue) { + (*this)->setAttr(getPruneFlagAttrName(), ::mlir::gpu::Prune2To4SpMatFlagAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Create2To4SpMatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spMat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::gpu::Prune2To4SpMatFlagAttr pruneFlag, ::mlir::Value memref) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(memref); + if (pruneFlag) { + odsState.getOrAddProperties().pruneFlag = pruneFlag; + } + odsState.addTypes(spMat); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void Create2To4SpMatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::gpu::Prune2To4SpMatFlagAttr pruneFlag, ::mlir::Value memref) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(memref); + if (pruneFlag) { + odsState.getOrAddProperties().pruneFlag = pruneFlag; + } + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Create2To4SpMatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spMat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::gpu::Prune2To4SpMatFlag pruneFlag, ::mlir::Value memref) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(memref); + odsState.getOrAddProperties().pruneFlag = ::mlir::gpu::Prune2To4SpMatFlagAttr::get(odsBuilder.getContext(), pruneFlag); + odsState.addTypes(spMat); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void Create2To4SpMatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::gpu::Prune2To4SpMatFlag pruneFlag, ::mlir::Value memref) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(memref); + odsState.getOrAddProperties().pruneFlag = ::mlir::gpu::Prune2To4SpMatFlagAttr::get(odsBuilder.getContext(), pruneFlag); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Create2To4SpMatOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Create2To4SpMatOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.pruneFlag) + properties.pruneFlag = ::mlir::gpu::Prune2To4SpMatFlagAttr::get(odsBuilder.getContext(), Prune2To4SpMatFlag::PRUNE_AND_CHECK); +} + +::mlir::LogicalResult Create2To4SpMatOp::verifyInvariantsImpl() { + auto tblgen_pruneFlag = getProperties().pruneFlag; (void)tblgen_pruneFlag; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps6(*this, tblgen_pruneFlag, "pruneFlag"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Create2To4SpMatOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult Create2To4SpMatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::gpu::Prune2To4SpMatFlagAttr pruneFlagAttr; + ::mlir::OpAsmParser::UnresolvedOperand rowsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rowsOperands(rowsRawOperands); ::llvm::SMLoc rowsOperandsLoc; + (void)rowsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand colsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> colsOperands(colsRawOperands); ::llvm::SMLoc colsOperandsLoc; + (void)colsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + if (parser.parseLBrace()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(pruneFlagAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (pruneFlagAttr) result.getOrAddProperties().pruneFlag = pruneFlagAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + + rowsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rowsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + colsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(colsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rowsOperands, odsBuildableType2, rowsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(colsOperands, odsBuildableType2, colsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Create2To4SpMatOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << "{"; +_odsPrinter.printStrippedAttrOrType(getPruneFlagAttr()); + _odsPrinter << "}"; + _odsPrinter << ' '; + _odsPrinter << getRows(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCols(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("pruneFlag"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getPruneFlagAttr(); + if(attr && (attr == ::mlir::gpu::Prune2To4SpMatFlagAttr::get(odsBuilder.getContext(), Prune2To4SpMatFlag::PRUNE_AND_CHECK))) + elidedAttrs.push_back("pruneFlag"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::Create2To4SpMatOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateBsrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateBsrOpGenericAdaptorBase::CreateBsrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.create_bsr", odsAttrs.getContext()); +} + +CreateBsrOpGenericAdaptorBase::CreateBsrOpGenericAdaptorBase(CreateBsrOp op) : CreateBsrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateBsrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 8) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CreateBsrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CreateBsrOpAdaptor::CreateBsrOpAdaptor(CreateBsrOp op) : CreateBsrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateBsrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void CreateBsrOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "spmat"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair CreateBsrOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 8) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CreateBsrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CreateBsrOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::IndexType> CreateBsrOp::getBrows() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateBsrOp::getBcols() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateBsrOp::getBnnz() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateBsrOp::getRBlockSize() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(4).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateBsrOp::getCBlockSize() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(5).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateBsrOp::getBRowPos() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(6).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateBsrOp::getBColIdxs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(7).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateBsrOp::getValues() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(8).begin()); +} + +::mlir::MutableOperandRange CreateBsrOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &CreateBsrOp::getBrowsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateBsrOp::getBcolsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateBsrOp::getBnnzMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateBsrOp::getRBlockSizeMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateBsrOp::getCBlockSizeMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateBsrOp::getBRowPosMutable() { + auto range = getODSOperandIndexAndLength(6); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateBsrOp::getBColIdxsMutable() { + auto range = getODSOperandIndexAndLength(7); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateBsrOp::getValuesMutable() { + auto range = getODSOperandIndexAndLength(8); + return getOperation()->getOpOperand(range.first); +} + +std::pair CreateBsrOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CreateBsrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CreateBsrOp::getSpmat() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value CreateBsrOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void CreateBsrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value brows, ::mlir::Value bcols, ::mlir::Value bnnz, ::mlir::Value rBlockSize, ::mlir::Value cBlockSize, ::mlir::Value bRowPos, ::mlir::Value bColIdxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(brows); + odsState.addOperands(bcols); + odsState.addOperands(bnnz); + odsState.addOperands(rBlockSize); + odsState.addOperands(cBlockSize); + odsState.addOperands(bRowPos); + odsState.addOperands(bColIdxs); + odsState.addOperands(values); + odsState.addTypes(spmat); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void CreateBsrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value brows, ::mlir::Value bcols, ::mlir::Value bnnz, ::mlir::Value rBlockSize, ::mlir::Value cBlockSize, ::mlir::Value bRowPos, ::mlir::Value bColIdxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(brows); + odsState.addOperands(bcols); + odsState.addOperands(bnnz); + odsState.addOperands(rBlockSize); + odsState.addOperands(cBlockSize); + odsState.addOperands(bRowPos); + odsState.addOperands(bColIdxs); + odsState.addOperands(values); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateBsrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 8u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateBsrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup7 = getODSOperands(7); + + for (auto v : valueGroup7) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup8 = getODSOperands(8); + + for (auto v : valueGroup8) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateBsrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateBsrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand browsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> browsOperands(browsRawOperands); ::llvm::SMLoc browsOperandsLoc; + (void)browsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bcolsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bcolsOperands(bcolsRawOperands); ::llvm::SMLoc bcolsOperandsLoc; + (void)bcolsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bnnzRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bnnzOperands(bnnzRawOperands); ::llvm::SMLoc bnnzOperandsLoc; + (void)bnnzOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rBlockSizeRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rBlockSizeOperands(rBlockSizeRawOperands); ::llvm::SMLoc rBlockSizeOperandsLoc; + (void)rBlockSizeOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand cBlockSizeRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> cBlockSizeOperands(cBlockSizeRawOperands); ::llvm::SMLoc cBlockSizeOperandsLoc; + (void)cBlockSizeOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bRowPosRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bRowPosOperands(bRowPosRawOperands); ::llvm::SMLoc bRowPosOperandsLoc; + (void)bRowPosOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bColIdxsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bColIdxsOperands(bColIdxsRawOperands); ::llvm::SMLoc bColIdxsOperandsLoc; + (void)bColIdxsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valuesRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valuesOperands(valuesRawOperands); ::llvm::SMLoc valuesOperandsLoc; + (void)valuesOperandsLoc; + ::mlir::Type bRowPosRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> bRowPosTypes(bRowPosRawTypes); + ::mlir::Type bColIdxsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> bColIdxsTypes(bColIdxsRawTypes); + ::mlir::Type valuesRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valuesTypes(valuesRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + browsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(browsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bcolsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bcolsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bnnzOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bnnzRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rBlockSizeOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rBlockSizeRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + cBlockSizeOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(cBlockSizeRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bRowPosOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bRowPosRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bColIdxsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bColIdxsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valuesRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + bRowPosRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + bColIdxsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valuesRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(browsOperands, odsBuildableType2, browsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bcolsOperands, odsBuildableType2, bcolsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bnnzOperands, odsBuildableType2, bnnzOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rBlockSizeOperands, odsBuildableType2, rBlockSizeOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(cBlockSizeOperands, odsBuildableType2, cBlockSizeOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bRowPosOperands, bRowPosTypes, bRowPosOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bColIdxsOperands, bColIdxsTypes, bColIdxsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valuesOperands, valuesTypes, valuesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateBsrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getBrows(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBcols(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBnnz(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRBlockSize(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCBlockSize(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBRowPos(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBColIdxs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getValues(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBRowPos().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getBColIdxs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getValues().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateBsrOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateCooAoSOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateCooAoSOpGenericAdaptorBase::CreateCooAoSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.create_coo_aos", odsAttrs.getContext()); +} + +CreateCooAoSOpGenericAdaptorBase::CreateCooAoSOpGenericAdaptorBase(CreateCooAoSOp op) : CreateCooAoSOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateCooAoSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 5) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CreateCooAoSOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CreateCooAoSOpAdaptor::CreateCooAoSOpAdaptor(CreateCooAoSOp op) : CreateCooAoSOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateCooAoSOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void CreateCooAoSOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "spmat"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair CreateCooAoSOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 5) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CreateCooAoSOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CreateCooAoSOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCooAoSOp::getRows() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCooAoSOp::getCols() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCooAoSOp::getNnz() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCooAoSOp::getIdxs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(4).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCooAoSOp::getValues() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(5).begin()); +} + +::mlir::MutableOperandRange CreateCooAoSOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &CreateCooAoSOp::getRowsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCooAoSOp::getColsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCooAoSOp::getNnzMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCooAoSOp::getIdxsMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCooAoSOp::getValuesMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +std::pair CreateCooAoSOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CreateCooAoSOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CreateCooAoSOp::getSpmat() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value CreateCooAoSOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void CreateCooAoSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value idxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(nnz); + odsState.addOperands(idxs); + odsState.addOperands(values); + odsState.addTypes(spmat); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void CreateCooAoSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value idxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(nnz); + odsState.addOperands(idxs); + odsState.addOperands(values); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateCooAoSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateCooAoSOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateCooAoSOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateCooAoSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rowsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rowsOperands(rowsRawOperands); ::llvm::SMLoc rowsOperandsLoc; + (void)rowsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand colsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> colsOperands(colsRawOperands); ::llvm::SMLoc colsOperandsLoc; + (void)colsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand nnzRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> nnzOperands(nnzRawOperands); ::llvm::SMLoc nnzOperandsLoc; + (void)nnzOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand idxsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> idxsOperands(idxsRawOperands); ::llvm::SMLoc idxsOperandsLoc; + (void)idxsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valuesRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valuesOperands(valuesRawOperands); ::llvm::SMLoc valuesOperandsLoc; + (void)valuesOperandsLoc; + ::mlir::Type idxsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> idxsTypes(idxsRawTypes); + ::mlir::Type valuesRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valuesTypes(valuesRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + rowsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rowsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + colsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(colsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + nnzOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(nnzRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + idxsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(idxsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valuesRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + idxsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valuesRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rowsOperands, odsBuildableType2, rowsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(colsOperands, odsBuildableType2, colsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(nnzOperands, odsBuildableType2, nnzOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(idxsOperands, idxsTypes, idxsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valuesOperands, valuesTypes, valuesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateCooAoSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getRows(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCols(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getNnz(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIdxs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getValues(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getIdxs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getValues().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateCooAoSOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateCooOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateCooOpGenericAdaptorBase::CreateCooOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.create_coo", odsAttrs.getContext()); +} + +CreateCooOpGenericAdaptorBase::CreateCooOpGenericAdaptorBase(CreateCooOp op) : CreateCooOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateCooOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 6) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CreateCooOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CreateCooOpAdaptor::CreateCooOpAdaptor(CreateCooOp op) : CreateCooOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateCooOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void CreateCooOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "spmat"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair CreateCooOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 6) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CreateCooOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CreateCooOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCooOp::getRows() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCooOp::getCols() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCooOp::getNnz() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCooOp::getRowIdxs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(4).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCooOp::getColIdxs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(5).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCooOp::getValues() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(6).begin()); +} + +::mlir::MutableOperandRange CreateCooOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &CreateCooOp::getRowsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCooOp::getColsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCooOp::getNnzMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCooOp::getRowIdxsMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCooOp::getColIdxsMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCooOp::getValuesMutable() { + auto range = getODSOperandIndexAndLength(6); + return getOperation()->getOpOperand(range.first); +} + +std::pair CreateCooOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CreateCooOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CreateCooOp::getSpmat() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value CreateCooOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void CreateCooOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value rowIdxs, ::mlir::Value colIdxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(nnz); + odsState.addOperands(rowIdxs); + odsState.addOperands(colIdxs); + odsState.addOperands(values); + odsState.addTypes(spmat); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void CreateCooOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value rowIdxs, ::mlir::Value colIdxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(nnz); + odsState.addOperands(rowIdxs); + odsState.addOperands(colIdxs); + odsState.addOperands(values); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateCooOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateCooOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateCooOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateCooOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rowsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rowsOperands(rowsRawOperands); ::llvm::SMLoc rowsOperandsLoc; + (void)rowsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand colsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> colsOperands(colsRawOperands); ::llvm::SMLoc colsOperandsLoc; + (void)colsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand nnzRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> nnzOperands(nnzRawOperands); ::llvm::SMLoc nnzOperandsLoc; + (void)nnzOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rowIdxsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rowIdxsOperands(rowIdxsRawOperands); ::llvm::SMLoc rowIdxsOperandsLoc; + (void)rowIdxsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand colIdxsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> colIdxsOperands(colIdxsRawOperands); ::llvm::SMLoc colIdxsOperandsLoc; + (void)colIdxsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valuesRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valuesOperands(valuesRawOperands); ::llvm::SMLoc valuesOperandsLoc; + (void)valuesOperandsLoc; + ::mlir::Type rowIdxsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> rowIdxsTypes(rowIdxsRawTypes); + ::mlir::Type colIdxsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> colIdxsTypes(colIdxsRawTypes); + ::mlir::Type valuesRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valuesTypes(valuesRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + rowsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rowsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + colsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(colsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + nnzOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(nnzRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rowIdxsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rowIdxsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + colIdxsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(colIdxsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valuesRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + rowIdxsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + colIdxsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valuesRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rowsOperands, odsBuildableType2, rowsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(colsOperands, odsBuildableType2, colsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(nnzOperands, odsBuildableType2, nnzOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rowIdxsOperands, rowIdxsTypes, rowIdxsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(colIdxsOperands, colIdxsTypes, colIdxsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valuesOperands, valuesTypes, valuesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateCooOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getRows(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCols(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getNnz(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRowIdxs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getColIdxs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getValues(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRowIdxs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getColIdxs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getValues().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateCooOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateCscOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateCscOpGenericAdaptorBase::CreateCscOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.create_csc", odsAttrs.getContext()); +} + +CreateCscOpGenericAdaptorBase::CreateCscOpGenericAdaptorBase(CreateCscOp op) : CreateCscOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateCscOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 6) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CreateCscOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CreateCscOpAdaptor::CreateCscOpAdaptor(CreateCscOp op) : CreateCscOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateCscOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void CreateCscOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "spmat"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair CreateCscOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 6) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CreateCscOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CreateCscOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCscOp::getRows() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCscOp::getCols() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCscOp::getNnz() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCscOp::getColPos() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(4).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCscOp::getRowIdxs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(5).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCscOp::getValues() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(6).begin()); +} + +::mlir::MutableOperandRange CreateCscOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &CreateCscOp::getRowsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCscOp::getColsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCscOp::getNnzMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCscOp::getColPosMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCscOp::getRowIdxsMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCscOp::getValuesMutable() { + auto range = getODSOperandIndexAndLength(6); + return getOperation()->getOpOperand(range.first); +} + +std::pair CreateCscOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CreateCscOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CreateCscOp::getSpmat() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value CreateCscOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void CreateCscOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value colPos, ::mlir::Value rowIdxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(nnz); + odsState.addOperands(colPos); + odsState.addOperands(rowIdxs); + odsState.addOperands(values); + odsState.addTypes(spmat); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void CreateCscOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value colPos, ::mlir::Value rowIdxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(nnz); + odsState.addOperands(colPos); + odsState.addOperands(rowIdxs); + odsState.addOperands(values); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateCscOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateCscOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateCscOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateCscOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rowsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rowsOperands(rowsRawOperands); ::llvm::SMLoc rowsOperandsLoc; + (void)rowsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand colsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> colsOperands(colsRawOperands); ::llvm::SMLoc colsOperandsLoc; + (void)colsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand nnzRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> nnzOperands(nnzRawOperands); ::llvm::SMLoc nnzOperandsLoc; + (void)nnzOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand colPosRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> colPosOperands(colPosRawOperands); ::llvm::SMLoc colPosOperandsLoc; + (void)colPosOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rowIdxsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rowIdxsOperands(rowIdxsRawOperands); ::llvm::SMLoc rowIdxsOperandsLoc; + (void)rowIdxsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valuesRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valuesOperands(valuesRawOperands); ::llvm::SMLoc valuesOperandsLoc; + (void)valuesOperandsLoc; + ::mlir::Type colPosRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> colPosTypes(colPosRawTypes); + ::mlir::Type rowIdxsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> rowIdxsTypes(rowIdxsRawTypes); + ::mlir::Type valuesRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valuesTypes(valuesRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + rowsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rowsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + colsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(colsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + nnzOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(nnzRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + colPosOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(colPosRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rowIdxsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rowIdxsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valuesRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + colPosRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + rowIdxsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valuesRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rowsOperands, odsBuildableType2, rowsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(colsOperands, odsBuildableType2, colsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(nnzOperands, odsBuildableType2, nnzOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(colPosOperands, colPosTypes, colPosOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rowIdxsOperands, rowIdxsTypes, rowIdxsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valuesOperands, valuesTypes, valuesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateCscOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getRows(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCols(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getNnz(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getColPos(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRowIdxs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getValues(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getColPos().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRowIdxs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getValues().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateCscOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateCsrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateCsrOpGenericAdaptorBase::CreateCsrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.create_csr", odsAttrs.getContext()); +} + +CreateCsrOpGenericAdaptorBase::CreateCsrOpGenericAdaptorBase(CreateCsrOp op) : CreateCsrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateCsrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 6) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CreateCsrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CreateCsrOpAdaptor::CreateCsrOpAdaptor(CreateCsrOp op) : CreateCsrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateCsrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void CreateCsrOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "spmat"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair CreateCsrOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 6) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CreateCsrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CreateCsrOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCsrOp::getRows() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCsrOp::getCols() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CreateCsrOp::getNnz() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCsrOp::getRowPos() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(4).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCsrOp::getColIdxs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(5).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateCsrOp::getValues() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(6).begin()); +} + +::mlir::MutableOperandRange CreateCsrOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &CreateCsrOp::getRowsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCsrOp::getColsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCsrOp::getNnzMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCsrOp::getRowPosMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCsrOp::getColIdxsMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CreateCsrOp::getValuesMutable() { + auto range = getODSOperandIndexAndLength(6); + return getOperation()->getOpOperand(range.first); +} + +std::pair CreateCsrOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CreateCsrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CreateCsrOp::getSpmat() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value CreateCsrOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void CreateCsrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value rowPos, ::mlir::Value colIdxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(nnz); + odsState.addOperands(rowPos); + odsState.addOperands(colIdxs); + odsState.addOperands(values); + odsState.addTypes(spmat); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void CreateCsrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value rowPos, ::mlir::Value colIdxs, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(rows); + odsState.addOperands(cols); + odsState.addOperands(nnz); + odsState.addOperands(rowPos); + odsState.addOperands(colIdxs); + odsState.addOperands(values); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateCsrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateCsrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateCsrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateCsrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rowsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rowsOperands(rowsRawOperands); ::llvm::SMLoc rowsOperandsLoc; + (void)rowsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand colsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> colsOperands(colsRawOperands); ::llvm::SMLoc colsOperandsLoc; + (void)colsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand nnzRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> nnzOperands(nnzRawOperands); ::llvm::SMLoc nnzOperandsLoc; + (void)nnzOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rowPosRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rowPosOperands(rowPosRawOperands); ::llvm::SMLoc rowPosOperandsLoc; + (void)rowPosOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand colIdxsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> colIdxsOperands(colIdxsRawOperands); ::llvm::SMLoc colIdxsOperandsLoc; + (void)colIdxsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valuesRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valuesOperands(valuesRawOperands); ::llvm::SMLoc valuesOperandsLoc; + (void)valuesOperandsLoc; + ::mlir::Type rowPosRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> rowPosTypes(rowPosRawTypes); + ::mlir::Type colIdxsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> colIdxsTypes(colIdxsRawTypes); + ::mlir::Type valuesRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valuesTypes(valuesRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + rowsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rowsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + colsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(colsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + nnzOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(nnzRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rowPosOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rowPosRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + colIdxsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(colIdxsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valuesRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + rowPosRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + colIdxsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valuesRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rowsOperands, odsBuildableType2, rowsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(colsOperands, odsBuildableType2, colsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(nnzOperands, odsBuildableType2, nnzOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rowPosOperands, rowPosTypes, rowPosOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(colIdxsOperands, colIdxsTypes, colIdxsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valuesOperands, valuesTypes, valuesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateCsrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getRows(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCols(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getNnz(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRowPos(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getColIdxs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getValues(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRowPos().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getColIdxs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getValues().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateCsrOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateDnTensorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateDnTensorOpGenericAdaptorBase::CreateDnTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.create_dn_tensor", odsAttrs.getContext()); +} + +CreateDnTensorOpGenericAdaptorBase::CreateDnTensorOpGenericAdaptorBase(CreateDnTensorOp op) : CreateDnTensorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateDnTensorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CreateDnTensorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CreateDnTensorOpAdaptor::CreateDnTensorOpAdaptor(CreateDnTensorOp op) : CreateDnTensorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateDnTensorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void CreateDnTensorOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "dnTensor"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair CreateDnTensorOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CreateDnTensorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CreateDnTensorOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::MemRefType> CreateDnTensorOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range CreateDnTensorOp::getDims() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange CreateDnTensorOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::OpOperand &CreateDnTensorOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CreateDnTensorOp::getDimsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CreateDnTensorOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CreateDnTensorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CreateDnTensorOp::getDnTensor() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value CreateDnTensorOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult CreateDnTensorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CreateDnTensorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CreateDnTensorOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CreateDnTensorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CreateDnTensorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CreateDnTensorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CreateDnTensorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult CreateDnTensorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CreateDnTensorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void CreateDnTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dnTensor, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value memref, ::mlir::ValueRange dims) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(memref); + odsState.addOperands(dims); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), 1, static_cast(dims.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.addTypes(dnTensor); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void CreateDnTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value memref, ::mlir::ValueRange dims) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(memref); + odsState.addOperands(dims); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), 1, static_cast(dims.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateDnTensorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateDnTensorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateDnTensorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateDnTensorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dimsOperands; + ::llvm::SMLoc dimsOperandsLoc; + (void)dimsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dimsTypes; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + dimsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dimsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dimsTypes)) + return ::mlir::failure(); + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } +::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependenciesOperands.size()), 1, static_cast(dimsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = mlir::gpu::SparseDnTensorHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dimsOperands, dimsTypes, dimsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateDnTensorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDims(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDims().getTypes(); + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateDnTensorOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::DeallocOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeallocOpGenericAdaptorBase::DeallocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.dealloc", odsAttrs.getContext()); +} + +DeallocOpGenericAdaptorBase::DeallocOpGenericAdaptorBase(DeallocOp op) : DeallocOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeallocOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr DeallocOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DeallocOpAdaptor::DeallocOpAdaptor(DeallocOp op) : DeallocOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeallocOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DeallocOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range DeallocOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DeallocOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::MemRefType> DeallocOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::MutableOperandRange DeallocOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &DeallocOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DeallocOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DeallocOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DeallocOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void DeallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value memref) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(memref); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void DeallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value memref) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(memref); + odsState.addTypes(resultTypes); +} + +void DeallocOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DeallocOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeallocOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DeallocOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeallocOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getMemref(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void DeallocOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Free::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::DeallocOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::DestroyDnTensorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DestroyDnTensorOpGenericAdaptorBase::DestroyDnTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.destroy_dn_tensor", odsAttrs.getContext()); +} + +DestroyDnTensorOpGenericAdaptorBase::DestroyDnTensorOpGenericAdaptorBase(DestroyDnTensorOp op) : DestroyDnTensorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DestroyDnTensorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr DestroyDnTensorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DestroyDnTensorOpAdaptor::DestroyDnTensorOpAdaptor(DestroyDnTensorOp op) : DestroyDnTensorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DestroyDnTensorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DestroyDnTensorOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range DestroyDnTensorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DestroyDnTensorOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value DestroyDnTensorOp::getDnTensor() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::MutableOperandRange DestroyDnTensorOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &DestroyDnTensorOp::getDnTensorMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DestroyDnTensorOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DestroyDnTensorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DestroyDnTensorOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void DestroyDnTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value dnTensor) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnTensor); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void DestroyDnTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value dnTensor) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnTensor); + odsState.addTypes(resultTypes); +} + +void DestroyDnTensorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DestroyDnTensorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DestroyDnTensorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DestroyDnTensorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dnTensorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnTensorOperands(dnTensorRawOperands); ::llvm::SMLoc dnTensorOperandsLoc; + (void)dnTensorOperandsLoc; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + dnTensorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnTensorRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::SparseDnTensorHandleType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnTensorOperands, odsBuildableType1, dnTensorOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DestroyDnTensorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getDnTensor(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::DestroyDnTensorOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::DestroySpMatOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DestroySpMatOpGenericAdaptorBase::DestroySpMatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.destroy_sp_mat", odsAttrs.getContext()); +} + +DestroySpMatOpGenericAdaptorBase::DestroySpMatOpGenericAdaptorBase(DestroySpMatOp op) : DestroySpMatOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DestroySpMatOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr DestroySpMatOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DestroySpMatOpAdaptor::DestroySpMatOpAdaptor(DestroySpMatOp op) : DestroySpMatOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DestroySpMatOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DestroySpMatOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range DestroySpMatOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DestroySpMatOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value DestroySpMatOp::getSpmat() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::MutableOperandRange DestroySpMatOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &DestroySpMatOp::getSpmatMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DestroySpMatOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DestroySpMatOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DestroySpMatOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void DestroySpMatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmat); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void DestroySpMatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmat); + odsState.addTypes(resultTypes); +} + +void DestroySpMatOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DestroySpMatOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DestroySpMatOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DestroySpMatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand spmatRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatOperands(spmatRawOperands); ::llvm::SMLoc spmatOperandsLoc; + (void)spmatOperandsLoc; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + spmatOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatOperands, odsBuildableType1, spmatOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DestroySpMatOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getSpmat(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::DestroySpMatOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::GPUFuncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GPUFuncOpGenericAdaptorBase::GPUFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.func", odsAttrs.getContext()); +} + +GPUFuncOpGenericAdaptorBase::GPUFuncOpGenericAdaptorBase(GPUFuncOp op) : GPUFuncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GPUFuncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GPUFuncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypeAttr GPUFuncOpGenericAdaptorBase::getFunctionTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); + return attr; +} + +::mlir::FunctionType GPUFuncOpGenericAdaptorBase::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::ArrayAttr GPUFuncOpGenericAdaptorBase::getArgAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > GPUFuncOpGenericAdaptorBase::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr GPUFuncOpGenericAdaptorBase::getResAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > GPUFuncOpGenericAdaptorBase::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr GPUFuncOpGenericAdaptorBase::getWorkgroupAttribAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().workgroup_attrib_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > GPUFuncOpGenericAdaptorBase::getWorkgroupAttribAttrs() { + auto attr = getWorkgroupAttribAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr GPUFuncOpGenericAdaptorBase::getPrivateAttribAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().private_attrib_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > GPUFuncOpGenericAdaptorBase::getPrivateAttribAttrs() { + auto attr = getPrivateAttribAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::Region &GPUFuncOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange GPUFuncOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +GPUFuncOpAdaptor::GPUFuncOpAdaptor(GPUFuncOp op) : GPUFuncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GPUFuncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitError(loc, "'gpu.func' op ""requires attribute 'function_type'"); + auto tblgen_private_attrib_attrs = getProperties().private_attrib_attrs; (void)tblgen_private_attrib_attrs; + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_workgroup_attrib_attrs = getProperties().workgroup_attrib_attrs; (void)tblgen_workgroup_attrib_attrs; + + if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))))) + return emitError(loc, "'gpu.func' op ""attribute 'function_type' failed to satisfy constraint: type attribute of function type"); + + if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'gpu.func' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'gpu.func' op ""attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_workgroup_attrib_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_workgroup_attrib_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_workgroup_attrib_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'gpu.func' op ""attribute 'workgroup_attrib_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_private_attrib_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_private_attrib_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_private_attrib_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'gpu.func' op ""attribute 'private_attrib_attrs' failed to satisfy constraint: Array of dictionary attributes"); + return ::mlir::success(); +} + +std::pair GPUFuncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GPUFuncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GPUFuncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GPUFuncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &GPUFuncOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult GPUFuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.arg_attrs; + auto attr = dict.get("arg_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for arg_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.function_type; + auto attr = dict.get("function_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for function_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `function_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.private_attrib_attrs; + auto attr = dict.get("private_attrib_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for private_attrib_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `private_attrib_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.res_attrs; + auto attr = dict.get("res_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for res_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.workgroup_attrib_attrs; + auto attr = dict.get("workgroup_attrib_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for workgroup_attrib_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `workgroup_attrib_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GPUFuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.arg_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.function_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("function_type", + propStorage)); + } + + { + const auto &propStorage = prop.private_attrib_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("private_attrib_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.res_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("res_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.workgroup_attrib_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("workgroup_attrib_attrs", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GPUFuncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.function_type.getAsOpaquePointer()), + llvm::hash_value(prop.private_attrib_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.res_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.workgroup_attrib_attrs.getAsOpaquePointer())); +} + +std::optional GPUFuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "arg_attrs") + return prop.arg_attrs; + + if (name == "function_type") + return prop.function_type; + + if (name == "private_attrib_attrs") + return prop.private_attrib_attrs; + + if (name == "res_attrs") + return prop.res_attrs; + + if (name == "workgroup_attrib_attrs") + return prop.workgroup_attrib_attrs; + return std::nullopt; +} + +void GPUFuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "arg_attrs") { + prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "function_type") { + prop.function_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "private_attrib_attrs") { + prop.private_attrib_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "res_attrs") { + prop.res_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "workgroup_attrib_attrs") { + prop.workgroup_attrib_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GPUFuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); + + if (prop.function_type) attrs.append("function_type", prop.function_type); + + if (prop.private_attrib_attrs) attrs.append("private_attrib_attrs", prop.private_attrib_attrs); + + if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); + + if (prop.workgroup_attrib_attrs) attrs.append("workgroup_attrib_attrs", prop.workgroup_attrib_attrs); +} + +::mlir::LogicalResult GPUFuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps8(attr, "arg_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps7(attr, "function_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getPrivateAttribAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps8(attr, "private_attrib_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps8(attr, "res_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWorkgroupAttribAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps8(attr, "workgroup_attrib_attrs", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GPUFuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.function_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.private_attrib_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.workgroup_attrib_attrs))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GPUFuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.arg_attrs); + writer.writeAttribute(prop.function_type); + + writer.writeOptionalAttribute(prop.private_attrib_attrs); + + writer.writeOptionalAttribute(prop.res_attrs); + + writer.writeOptionalAttribute(prop.workgroup_attrib_attrs); +} + +::mlir::TypeAttr GPUFuncOp::getFunctionTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); +} + +::mlir::FunctionType GPUFuncOp::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::ArrayAttr GPUFuncOp::getArgAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); +} + +::std::optional< ::mlir::ArrayAttr > GPUFuncOp::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr GPUFuncOp::getResAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); +} + +::std::optional< ::mlir::ArrayAttr > GPUFuncOp::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr GPUFuncOp::getWorkgroupAttribAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().workgroup_attrib_attrs); +} + +::std::optional< ::mlir::ArrayAttr > GPUFuncOp::getWorkgroupAttribAttrs() { + auto attr = getWorkgroupAttribAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr GPUFuncOp::getPrivateAttribAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().private_attrib_attrs); +} + +::std::optional< ::mlir::ArrayAttr > GPUFuncOp::getPrivateAttribAttrs() { + auto attr = getPrivateAttribAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void GPUFuncOp::setFunctionTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getFunctionTypeAttrName(), attr); +} + +void GPUFuncOp::setFunctionType(::mlir::FunctionType attrValue) { + (*this)->setAttr(getFunctionTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void GPUFuncOp::setArgAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getArgAttrsAttrName(), attr); +} + +void GPUFuncOp::setResAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getResAttrsAttrName(), attr); +} + +void GPUFuncOp::setWorkgroupAttribAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getWorkgroupAttribAttrsAttrName(), attr); +} + +void GPUFuncOp::setPrivateAttribAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getPrivateAttribAttrsAttrName(), attr); +} + +::mlir::Attribute GPUFuncOp::removeArgAttrsAttr() { + auto &attr = getProperties().arg_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute GPUFuncOp::removeResAttrsAttr() { + auto &attr = getProperties().res_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute GPUFuncOp::removeWorkgroupAttribAttrsAttr() { + auto &attr = getProperties().workgroup_attrib_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute GPUFuncOp::removePrivateAttribAttrsAttr() { + auto &attr = getProperties().private_attrib_attrs; + attr = {}; + return attr; +} + +::mlir::LogicalResult GPUFuncOp::verifyInvariantsImpl() { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'"); + auto tblgen_private_attrib_attrs = getProperties().private_attrib_attrs; (void)tblgen_private_attrib_attrs; + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_workgroup_attrib_attrs = getProperties().workgroup_attrib_attrs; (void)tblgen_workgroup_attrib_attrs; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps7(*this, tblgen_function_type, "function_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps8(*this, tblgen_arg_attrs, "arg_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps8(*this, tblgen_res_attrs, "res_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps8(*this, tblgen_workgroup_attrib_attrs, "workgroup_attrib_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps8(*this, tblgen_private_attrib_attrs, "private_attrib_attrs"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_GPUOps0(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GPUFuncOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUFuncOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::GPUModuleOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GPUModuleOpGenericAdaptorBase::GPUModuleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.module", odsAttrs.getContext()); +} + +GPUModuleOpGenericAdaptorBase::GPUModuleOpGenericAdaptorBase(GPUModuleOp op) : GPUModuleOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GPUModuleOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GPUModuleOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr GPUModuleOpGenericAdaptorBase::getTargetsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().targets); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > GPUModuleOpGenericAdaptorBase::getTargets() { + auto attr = getTargetsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::Region &GPUModuleOpGenericAdaptorBase::getBodyRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange GPUModuleOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +GPUModuleOpAdaptor::GPUModuleOpAdaptor(GPUModuleOp op) : GPUModuleOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GPUModuleOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_targets = getProperties().targets; (void)tblgen_targets; + + if (tblgen_targets && !((((::llvm::isa<::mlir::ArrayAttr>(tblgen_targets))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_targets), [&](::mlir::Attribute attr) { return attr && (((true)) && ((attr.hasPromiseOrImplementsInterface<::mlir::gpu::TargetAttrInterface>()))); }))) && ((::llvm::cast<::mlir::ArrayAttr>(tblgen_targets).size() >= 1)))) + return emitError(loc, "'gpu.module' op ""attribute 'targets' failed to satisfy constraint: array of GPU target attributes with at least 1 elements"); + return ::mlir::success(); +} + +std::pair GPUModuleOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GPUModuleOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GPUModuleOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GPUModuleOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &GPUModuleOp::getBodyRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult GPUModuleOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.targets; + auto attr = dict.get("targets"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for targets in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `targets` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GPUModuleOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.targets; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("targets", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GPUModuleOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.targets.getAsOpaquePointer())); +} + +std::optional GPUModuleOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "targets") + return prop.targets; + return std::nullopt; +} + +void GPUModuleOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "targets") { + prop.targets = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GPUModuleOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.targets) attrs.append("targets", prop.targets); +} + +::mlir::LogicalResult GPUModuleOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getTargetsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps9(attr, "targets", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GPUModuleOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.targets))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GPUModuleOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.targets); +} + +::mlir::ArrayAttr GPUModuleOp::getTargetsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().targets); +} + +::std::optional< ::mlir::ArrayAttr > GPUModuleOp::getTargets() { + auto attr = getTargetsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void GPUModuleOp::setTargetsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTargetsAttrName(), attr); +} + +::mlir::Attribute GPUModuleOp::removeTargetsAttr() { + auto &attr = getProperties().targets; + attr = {}; + return attr; +} + +::mlir::LogicalResult GPUModuleOp::verifyInvariantsImpl() { + auto tblgen_targets = getProperties().targets; (void)tblgen_targets; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps9(*this, tblgen_targets, "targets"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_GPUOps1(*this, region, "bodyRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GPUModuleOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUModuleOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::GlobalIdOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalIdOpGenericAdaptorBase::GlobalIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.global_id", odsAttrs.getContext()); +} + +GlobalIdOpGenericAdaptorBase::GlobalIdOpGenericAdaptorBase(GlobalIdOp op) : GlobalIdOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalIdOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalIdOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::DimensionAttr GlobalIdOpGenericAdaptorBase::getDimensionAttr() { + auto attr = ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); + return attr; +} + +::mlir::gpu::Dimension GlobalIdOpGenericAdaptorBase::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +} // namespace detail +GlobalIdOpAdaptor::GlobalIdOpAdaptor(GlobalIdOp op) : GlobalIdOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalIdOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitError(loc, "'gpu.global_id' op ""requires attribute 'dimension'"); + + if (tblgen_dimension && !((::llvm::isa<::mlir::gpu::DimensionAttr>(tblgen_dimension)))) + return emitError(loc, "'gpu.global_id' op ""attribute 'dimension' failed to satisfy constraint: a dimension, either 'x', 'y', or 'z'"); + return ::mlir::success(); +} + +std::pair GlobalIdOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalIdOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalIdOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalIdOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult GlobalIdOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dimension; + auto attr = dict.get("dimension"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dimension in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dimension` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalIdOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dimension; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dimension", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalIdOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dimension.getAsOpaquePointer())); +} + +std::optional GlobalIdOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dimension") + return prop.dimension; + return std::nullopt; +} + +void GlobalIdOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dimension") { + prop.dimension = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalIdOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dimension) attrs.append("dimension", prop.dimension); +} + +::mlir::LogicalResult GlobalIdOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDimensionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(attr, "dimension", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalIdOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dimension))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalIdOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dimension); +} + +::mlir::gpu::DimensionAttr GlobalIdOp::getDimensionAttr() { + return ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); +} + +::mlir::gpu::Dimension GlobalIdOp::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +void GlobalIdOp::setDimensionAttr(::mlir::gpu::DimensionAttr attr) { + (*this)->setAttr(getDimensionAttrName(), attr); +} + +void GlobalIdOp::setDimension(::mlir::gpu::Dimension attrValue) { + (*this)->setAttr(getDimensionAttrName(), ::mlir::gpu::DimensionAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void GlobalIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + odsState.addTypes(resultType0); +} + +void GlobalIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(GlobalIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void GlobalIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + odsState.addTypes(resultType0); +} + +void GlobalIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(GlobalIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void GlobalIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalIdOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void GlobalIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(GlobalIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult GlobalIdOp::verifyInvariantsImpl() { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitOpError("requires attribute 'dimension'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(*this, tblgen_dimension, "dimension"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalIdOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult GlobalIdOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult GlobalIdOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::gpu::DimensionAttr dimensionAttr; + + if (parser.parseCustomAttributeWithFallback(dimensionAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (dimensionAttr) result.getOrAddProperties().dimension = dimensionAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void GlobalIdOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getDimensionAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("dimension"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GlobalIdOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GlobalIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::GridDimOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridDimOpGenericAdaptorBase::GridDimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.grid_dim", odsAttrs.getContext()); +} + +GridDimOpGenericAdaptorBase::GridDimOpGenericAdaptorBase(GridDimOp op) : GridDimOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridDimOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridDimOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::DimensionAttr GridDimOpGenericAdaptorBase::getDimensionAttr() { + auto attr = ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); + return attr; +} + +::mlir::gpu::Dimension GridDimOpGenericAdaptorBase::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +} // namespace detail +GridDimOpAdaptor::GridDimOpAdaptor(GridDimOp op) : GridDimOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridDimOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitError(loc, "'gpu.grid_dim' op ""requires attribute 'dimension'"); + + if (tblgen_dimension && !((::llvm::isa<::mlir::gpu::DimensionAttr>(tblgen_dimension)))) + return emitError(loc, "'gpu.grid_dim' op ""attribute 'dimension' failed to satisfy constraint: a dimension, either 'x', 'y', or 'z'"); + return ::mlir::success(); +} + +std::pair GridDimOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridDimOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridDimOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridDimOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult GridDimOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dimension; + auto attr = dict.get("dimension"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dimension in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dimension` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GridDimOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dimension; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dimension", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GridDimOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dimension.getAsOpaquePointer())); +} + +std::optional GridDimOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dimension") + return prop.dimension; + return std::nullopt; +} + +void GridDimOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dimension") { + prop.dimension = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GridDimOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dimension) attrs.append("dimension", prop.dimension); +} + +::mlir::LogicalResult GridDimOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDimensionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(attr, "dimension", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridDimOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dimension))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GridDimOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dimension); +} + +::mlir::gpu::DimensionAttr GridDimOp::getDimensionAttr() { + return ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); +} + +::mlir::gpu::Dimension GridDimOp::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +void GridDimOp::setDimensionAttr(::mlir::gpu::DimensionAttr attr) { + (*this)->setAttr(getDimensionAttrName(), attr); +} + +void GridDimOp::setDimension(::mlir::gpu::Dimension attrValue) { + (*this)->setAttr(getDimensionAttrName(), ::mlir::gpu::DimensionAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void GridDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + odsState.addTypes(resultType0); +} + +void GridDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(GridDimOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void GridDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + odsState.addTypes(resultType0); +} + +void GridDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(GridDimOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void GridDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridDimOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void GridDimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(GridDimOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult GridDimOp::verifyInvariantsImpl() { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitOpError("requires attribute 'dimension'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(*this, tblgen_dimension, "dimension"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridDimOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult GridDimOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult GridDimOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::gpu::DimensionAttr dimensionAttr; + + if (parser.parseCustomAttributeWithFallback(dimensionAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (dimensionAttr) result.getOrAddProperties().dimension = dimensionAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void GridDimOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getDimensionAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("dimension"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GridDimOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GridDimOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::HostRegisterOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +HostRegisterOpGenericAdaptorBase::HostRegisterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.host_register", odsAttrs.getContext()); +} + +HostRegisterOpGenericAdaptorBase::HostRegisterOpGenericAdaptorBase(HostRegisterOp op) : HostRegisterOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair HostRegisterOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr HostRegisterOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +HostRegisterOpAdaptor::HostRegisterOpAdaptor(HostRegisterOp op) : HostRegisterOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult HostRegisterOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair HostRegisterOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range HostRegisterOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::UnrankedMemRefType> HostRegisterOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::UnrankedMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &HostRegisterOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair HostRegisterOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range HostRegisterOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void HostRegisterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value) { + odsState.addOperands(value); +} + +void HostRegisterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) { + odsState.addOperands(value); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void HostRegisterOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult HostRegisterOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult HostRegisterOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult HostRegisterOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::UnrankedMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void HostRegisterOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::UnrankedMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::HostRegisterOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::HostUnregisterOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +HostUnregisterOpGenericAdaptorBase::HostUnregisterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.host_unregister", odsAttrs.getContext()); +} + +HostUnregisterOpGenericAdaptorBase::HostUnregisterOpGenericAdaptorBase(HostUnregisterOp op) : HostUnregisterOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair HostUnregisterOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr HostUnregisterOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +HostUnregisterOpAdaptor::HostUnregisterOpAdaptor(HostUnregisterOp op) : HostUnregisterOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult HostUnregisterOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair HostUnregisterOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range HostUnregisterOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::UnrankedMemRefType> HostUnregisterOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::UnrankedMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &HostUnregisterOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair HostUnregisterOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range HostUnregisterOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void HostUnregisterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value) { + odsState.addOperands(value); +} + +void HostUnregisterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) { + odsState.addOperands(value); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void HostUnregisterOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult HostUnregisterOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult HostUnregisterOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult HostUnregisterOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::UnrankedMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void HostUnregisterOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::UnrankedMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::HostUnregisterOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::LaneIdOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LaneIdOpGenericAdaptorBase::LaneIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.lane_id", odsAttrs.getContext()); +} + +LaneIdOpGenericAdaptorBase::LaneIdOpGenericAdaptorBase(LaneIdOp op) : LaneIdOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LaneIdOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LaneIdOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +LaneIdOpAdaptor::LaneIdOpAdaptor(LaneIdOp op) : LaneIdOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LaneIdOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LaneIdOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LaneIdOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair LaneIdOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LaneIdOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> LaneIdOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void LaneIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) { + odsState.addTypes(result); +} + +void LaneIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LaneIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LaneIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LaneIdOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void LaneIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LaneIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult LaneIdOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LaneIdOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult LaneIdOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult LaneIdOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void LaneIdOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void LaneIdOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::LaneIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::LaunchFuncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LaunchFuncOpGenericAdaptorBase::LaunchFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.launch_func", odsAttrs.getContext()); +} + +LaunchFuncOpGenericAdaptorBase::LaunchFuncOpGenericAdaptorBase(LaunchFuncOp op) : LaunchFuncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LaunchFuncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr LaunchFuncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::SymbolRefAttr LaunchFuncOpGenericAdaptorBase::getKernelAttr() { + auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().kernel); + return attr; +} + +::mlir::SymbolRefAttr LaunchFuncOpGenericAdaptorBase::getKernel() { + auto attr = getKernelAttr(); + return attr; +} + +} // namespace detail +LaunchFuncOpAdaptor::LaunchFuncOpAdaptor(LaunchFuncOp op) : LaunchFuncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LaunchFuncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_kernel = getProperties().kernel; (void)tblgen_kernel; + if (!tblgen_kernel) return emitError(loc, "'gpu.launch_func' op ""requires attribute 'kernel'"); + + if (tblgen_kernel && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_kernel)))) + return emitError(loc, "'gpu.launch_func' op ""attribute 'kernel' failed to satisfy constraint: symbol reference attribute"); + return ::mlir::success(); +} + +std::pair LaunchFuncOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range LaunchFuncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range LaunchFuncOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value LaunchFuncOp::getGridSizeX() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value LaunchFuncOp::getGridSizeY() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value LaunchFuncOp::getGridSizeZ() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value LaunchFuncOp::getBlockSizeX() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::Value LaunchFuncOp::getBlockSizeY() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(5).begin()); +} + +::mlir::Value LaunchFuncOp::getBlockSizeZ() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(6).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> LaunchFuncOp::getDynamicSharedMemorySize() { + auto operands = getODSOperands(7); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range LaunchFuncOp::getKernelOperands() { + return getODSOperands(8); +} + +::mlir::Value LaunchFuncOp::getAsyncObject() { + auto operands = getODSOperands(9); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::MutableOperandRange LaunchFuncOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::OpOperand &LaunchFuncOp::getGridSizeXMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchFuncOp::getGridSizeYMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchFuncOp::getGridSizeZMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchFuncOp::getBlockSizeXMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchFuncOp::getBlockSizeYMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchFuncOp::getBlockSizeZMutable() { + auto range = getODSOperandIndexAndLength(6); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange LaunchFuncOp::getDynamicSharedMemorySizeMutable() { + auto range = getODSOperandIndexAndLength(7); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(7u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LaunchFuncOp::getKernelOperandsMutable() { + auto range = getODSOperandIndexAndLength(8); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(8u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LaunchFuncOp::getAsyncObjectMutable() { + auto range = getODSOperandIndexAndLength(9); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(9u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair LaunchFuncOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range LaunchFuncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LaunchFuncOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult LaunchFuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.kernel; + auto attr = dict.get("kernel"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for kernel in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `kernel` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute LaunchFuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.kernel; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("kernel", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LaunchFuncOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.kernel.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional LaunchFuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "kernel") + return prop.kernel; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void LaunchFuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "kernel") { + prop.kernel = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void LaunchFuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.kernel) attrs.append("kernel", prop.kernel); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult LaunchFuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getKernelAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps10(attr, "kernel", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LaunchFuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.kernel))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void LaunchFuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.kernel); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::SymbolRefAttr LaunchFuncOp::getKernelAttr() { + return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().kernel); +} + +::mlir::SymbolRefAttr LaunchFuncOp::getKernel() { + auto attr = getKernelAttr(); + return attr; +} + +void LaunchFuncOp::setKernelAttr(::mlir::SymbolRefAttr attr) { + (*this)->setAttr(getKernelAttrName(), attr); +} + +::mlir::LogicalResult LaunchFuncOp::verifyInvariantsImpl() { + auto tblgen_kernel = getProperties().kernel; (void)tblgen_kernel; + if (!tblgen_kernel) return emitOpError("requires attribute 'kernel'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps10(*this, tblgen_kernel, "kernel"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup7 = getODSOperands(7); + + if (valueGroup7.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup7.size(); + } + + for (auto v : valueGroup7) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup8 = getODSOperands(8); + + for (auto v : valueGroup8) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup9 = getODSOperands(9); + + if (valueGroup9.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup9.size(); + } + + for (auto v : valueGroup9) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(3).begin()).getType()) && ((*this->getODSOperands(3).begin()).getType()) == ((*this->getODSOperands(4).begin()).getType()) && ((*this->getODSOperands(4).begin()).getType()) == ((*this->getODSOperands(5).begin()).getType()) && ((*this->getODSOperands(5).begin()).getType()) == ((*this->getODSOperands(6).begin()).getType()) && ((*this->getODSOperands(6).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {gridSizeX, gridSizeY, gridSizeZ, blockSizeX, blockSizeY, blockSizeZ} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult LaunchFuncOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult LaunchFuncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncObjectOperands; + ::llvm::SMLoc asyncObjectOperandsLoc; + (void)asyncObjectOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> asyncObjectTypes; + ::mlir::SymbolRefAttr kernelAttr; + ::mlir::OpAsmParser::UnresolvedOperand gridSizeXRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> gridSizeXOperands(gridSizeXRawOperands); ::llvm::SMLoc gridSizeXOperandsLoc; + (void)gridSizeXOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand gridSizeYRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> gridSizeYOperands(gridSizeYRawOperands); ::llvm::SMLoc gridSizeYOperandsLoc; + (void)gridSizeYOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand gridSizeZRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> gridSizeZOperands(gridSizeZRawOperands); ::llvm::SMLoc gridSizeZOperandsLoc; + (void)gridSizeZOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand blockSizeXRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> blockSizeXOperands(blockSizeXRawOperands); ::llvm::SMLoc blockSizeXOperandsLoc; + (void)blockSizeXOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand blockSizeYRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> blockSizeYOperands(blockSizeYRawOperands); ::llvm::SMLoc blockSizeYOperandsLoc; + (void)blockSizeYOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand blockSizeZRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> blockSizeZOperands(blockSizeZRawOperands); ::llvm::SMLoc blockSizeZOperandsLoc; + (void)blockSizeZOperandsLoc; + ::mlir::Type gridSizeXRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> gridSizeXTypes(gridSizeXRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dynamicSharedMemorySizeOperands; + ::llvm::SMLoc dynamicSharedMemorySizeOperandsLoc; + (void)dynamicSharedMemorySizeOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> kernelOperandsOperands; + ::llvm::SMLoc kernelOperandsOperandsLoc; + (void)kernelOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> kernelOperandsTypes; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + if (::mlir::succeeded(parser.parseOptionalLess())) { + + { + asyncObjectOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncObjectOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncObjectTypes.push_back(optionalType); + } + } + if (parser.parseGreater()) + return ::mlir::failure(); + } + + if (parser.parseCustomAttributeWithFallback(kernelAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (kernelAttr) result.getOrAddProperties().kernel = kernelAttr; + if (parser.parseKeyword("blocks")) + return ::mlir::failure(); + if (parser.parseKeyword("in")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + gridSizeXOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(gridSizeXRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + gridSizeYOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(gridSizeYRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + gridSizeZOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(gridSizeZRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseKeyword("threads")) + return ::mlir::failure(); + if (parser.parseKeyword("in")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + blockSizeXOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(blockSizeXRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + blockSizeYOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(blockSizeYRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + blockSizeZOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(blockSizeZRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLaunchDimType(parser, gridSizeXRawTypes[0]); + if (odsResult) return ::mlir::failure(); + } + if (::mlir::succeeded(parser.parseOptionalKeyword("dynamic_shared_memory_size"))) { + + { + dynamicSharedMemorySizeOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + dynamicSharedMemorySizeOperands.push_back(operand); + } + } + } + { + kernelOperandsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseLaunchFuncOperands(parser, kernelOperandsOperands, kernelOperandsTypes); + if (odsResult) return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependenciesOperands.size()), 1, 1, 1, 1, 1, 1, static_cast(dynamicSharedMemorySizeOperands.size()), static_cast(kernelOperandsOperands.size()), static_cast(asyncObjectOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(gridSizeXOperands, gridSizeXTypes, gridSizeXOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(gridSizeYOperands, gridSizeXTypes[0], gridSizeYOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(gridSizeZOperands, gridSizeXTypes[0], gridSizeZOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(blockSizeXOperands, gridSizeXTypes[0], blockSizeXOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(blockSizeYOperands, gridSizeXTypes[0], blockSizeYOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(blockSizeZOperands, gridSizeXTypes[0], blockSizeZOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dynamicSharedMemorySizeOperands, odsBuildableType1, dynamicSharedMemorySizeOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(kernelOperandsOperands, kernelOperandsTypes, kernelOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(asyncObjectOperands, asyncObjectTypes, asyncObjectOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LaunchFuncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + if (getAsyncObject()) { + _odsPrinter << "<"; + if (::mlir::Value value = getAsyncObject()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getAsyncObject() ? ::llvm::ArrayRef<::mlir::Type>(getAsyncObject().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ">"; + } + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getKernelAttr()); + _odsPrinter << ' ' << "blocks"; + _odsPrinter << ' ' << "in"; + _odsPrinter << ' '; + _odsPrinter << "("; + _odsPrinter << getGridSizeX(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getGridSizeY(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getGridSizeZ(); + _odsPrinter << ")"; + _odsPrinter << ' ' << "threads"; + _odsPrinter << ' ' << "in"; + _odsPrinter << ' '; + _odsPrinter << "("; + _odsPrinter << getBlockSizeX(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBlockSizeY(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBlockSizeZ(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLaunchDimType(_odsPrinter, *this, getGridSizeX().getType()); + if (getDynamicSharedMemorySize()) { + _odsPrinter << ' ' << "dynamic_shared_memory_size"; + _odsPrinter << ' '; + if (::mlir::Value value = getDynamicSharedMemorySize()) + _odsPrinter << value; + } + _odsPrinter << ' '; + printLaunchFuncOperands(_odsPrinter, *this, getKernelOperands(), getKernelOperands().getTypes()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("kernel"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::LaunchFuncOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::LaunchOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LaunchOpGenericAdaptorBase::LaunchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.launch", odsAttrs.getContext()); +} + +LaunchOpGenericAdaptorBase::LaunchOpGenericAdaptorBase(LaunchOp op) : LaunchOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LaunchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr LaunchOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &LaunchOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange LaunchOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +LaunchOpAdaptor::LaunchOpAdaptor(LaunchOp op) : LaunchOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LaunchOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LaunchOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range LaunchOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range LaunchOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::IndexType> LaunchOp::getGridSizeX() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> LaunchOp::getGridSizeY() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> LaunchOp::getGridSizeZ() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> LaunchOp::getBlockSizeX() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(4).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> LaunchOp::getBlockSizeY() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(5).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> LaunchOp::getBlockSizeZ() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(6).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> LaunchOp::getDynamicSharedMemorySize() { + auto operands = getODSOperands(7); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::MutableOperandRange LaunchOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::OpOperand &LaunchOp::getGridSizeXMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchOp::getGridSizeYMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchOp::getGridSizeZMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchOp::getBlockSizeXMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchOp::getBlockSizeYMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LaunchOp::getBlockSizeZMutable() { + auto range = getODSOperandIndexAndLength(6); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange LaunchOp::getDynamicSharedMemorySizeMutable() { + auto range = getODSOperandIndexAndLength(7); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(7u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair LaunchOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range LaunchOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LaunchOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::Region &LaunchOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult LaunchOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute LaunchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LaunchOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional LaunchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void LaunchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void LaunchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult LaunchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult LaunchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void LaunchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::LogicalResult LaunchOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup7 = getODSOperands(7); + + if (valueGroup7.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup7.size(); + } + + for (auto v : valueGroup7) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_GPUOps0(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LaunchOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::LaunchOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::MemcpyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MemcpyOpGenericAdaptorBase::MemcpyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.memcpy", odsAttrs.getContext()); +} + +MemcpyOpGenericAdaptorBase::MemcpyOpGenericAdaptorBase(MemcpyOp op) : MemcpyOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MemcpyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr MemcpyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MemcpyOpAdaptor::MemcpyOpAdaptor(MemcpyOp op) : MemcpyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MemcpyOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MemcpyOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range MemcpyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MemcpyOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::MemRefType> MemcpyOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> MemcpyOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(2).begin()); +} + +::mlir::MutableOperandRange MemcpyOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &MemcpyOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MemcpyOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MemcpyOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MemcpyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MemcpyOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void MemcpyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value dst, ::mlir::Value src) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dst); + odsState.addOperands(src); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void MemcpyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value dst, ::mlir::Value src) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.addTypes(resultTypes); +} + +void MemcpyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MemcpyOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemcpyOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult MemcpyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dstRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstOperands(dstRawOperands); ::llvm::SMLoc dstOperandsLoc; + (void)dstOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand srcRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(srcRawOperands); ::llvm::SMLoc srcOperandsLoc; + (void)srcOperandsLoc; + ::mlir::Type dstRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstTypes(dstRawTypes); + ::mlir::Type srcRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcTypes(srcRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + dstOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + srcOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dstOperands, dstTypes, dstOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MemcpyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getDst(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getDst().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getSrc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void MemcpyOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(2)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::MemcpyOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::MemsetOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MemsetOpGenericAdaptorBase::MemsetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.memset", odsAttrs.getContext()); +} + +MemsetOpGenericAdaptorBase::MemsetOpGenericAdaptorBase(MemsetOp op) : MemsetOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MemsetOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr MemsetOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MemsetOpAdaptor::MemsetOpAdaptor(MemsetOp op) : MemsetOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MemsetOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MemsetOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range MemsetOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MemsetOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::MemRefType> MemsetOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Value MemsetOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::MutableOperandRange MemsetOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &MemsetOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MemsetOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MemsetOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MemsetOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MemsetOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void MemsetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value dst, ::mlir::Value value) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dst); + odsState.addOperands(value); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void MemsetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value dst, ::mlir::Value value) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dst); + odsState.addOperands(value); + odsState.addTypes(resultTypes); +} + +void MemsetOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MemsetOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!(((getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin())))))) + return emitOpError("failed to verify that all of {dst, value} have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult MemsetOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MemsetOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dstRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstOperands(dstRawOperands); ::llvm::SMLoc dstOperandsLoc; + (void)dstOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type dstRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstTypes(dstRawTypes); + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + dstOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dstOperands, dstTypes, dstOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MemsetOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getDst(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getDst().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void MemsetOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::MemsetOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::ModuleEndOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ModuleEndOpGenericAdaptorBase::ModuleEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.module_end", odsAttrs.getContext()); +} + +ModuleEndOpGenericAdaptorBase::ModuleEndOpGenericAdaptorBase(ModuleEndOp op) : ModuleEndOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ModuleEndOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ModuleEndOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ModuleEndOpAdaptor::ModuleEndOpAdaptor(ModuleEndOp op) : ModuleEndOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ModuleEndOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ModuleEndOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ModuleEndOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ModuleEndOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ModuleEndOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ModuleEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void ModuleEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ModuleEndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ModuleEndOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult ModuleEndOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ModuleEndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ModuleEndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::ModuleEndOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::NumSubgroupsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +NumSubgroupsOpGenericAdaptorBase::NumSubgroupsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.num_subgroups", odsAttrs.getContext()); +} + +NumSubgroupsOpGenericAdaptorBase::NumSubgroupsOpGenericAdaptorBase(NumSubgroupsOp op) : NumSubgroupsOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair NumSubgroupsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr NumSubgroupsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +NumSubgroupsOpAdaptor::NumSubgroupsOpAdaptor(NumSubgroupsOp op) : NumSubgroupsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult NumSubgroupsOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair NumSubgroupsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range NumSubgroupsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair NumSubgroupsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range NumSubgroupsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> NumSubgroupsOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void NumSubgroupsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) { + odsState.addTypes(result); +} + +void NumSubgroupsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NumSubgroupsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void NumSubgroupsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NumSubgroupsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void NumSubgroupsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NumSubgroupsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult NumSubgroupsOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult NumSubgroupsOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult NumSubgroupsOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult NumSubgroupsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IndexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + return ::mlir::success(); +} + +void NumSubgroupsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IndexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void NumSubgroupsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::NumSubgroupsOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::PrintfOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PrintfOpGenericAdaptorBase::PrintfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.printf", odsAttrs.getContext()); +} + +PrintfOpGenericAdaptorBase::PrintfOpGenericAdaptorBase(PrintfOp op) : PrintfOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PrintfOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr PrintfOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr PrintfOpGenericAdaptorBase::getFormatAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().format); + return attr; +} + +::llvm::StringRef PrintfOpGenericAdaptorBase::getFormat() { + auto attr = getFormatAttr(); + return attr.getValue(); +} + +} // namespace detail +PrintfOpAdaptor::PrintfOpAdaptor(PrintfOp op) : PrintfOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PrintfOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_format = getProperties().format; (void)tblgen_format; + if (!tblgen_format) return emitError(loc, "'gpu.printf' op ""requires attribute 'format'"); + + if (tblgen_format && !((::llvm::isa<::mlir::StringAttr>(tblgen_format)))) + return emitError(loc, "'gpu.printf' op ""attribute 'format' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair PrintfOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range PrintfOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PrintfOp::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange PrintfOp::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair PrintfOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PrintfOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult PrintfOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.format; + auto attr = dict.get("format"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for format in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `format` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute PrintfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.format; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("format", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PrintfOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.format.getAsOpaquePointer())); +} + +std::optional PrintfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "format") + return prop.format; + return std::nullopt; +} + +void PrintfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "format") { + prop.format = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void PrintfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.format) attrs.append("format", prop.format); +} + +::mlir::LogicalResult PrintfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFormatAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps2(attr, "format", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PrintfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.format))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PrintfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.format); +} + +::mlir::StringAttr PrintfOp::getFormatAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().format); +} + +::llvm::StringRef PrintfOp::getFormat() { + auto attr = getFormatAttr(); + return attr.getValue(); +} + +void PrintfOp::setFormatAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getFormatAttrName(), attr); +} + +void PrintfOp::setFormat(::llvm::StringRef attrValue) { + (*this)->setAttr(getFormatAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void PrintfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr format, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().format = format; +} + +void PrintfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr format, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().format = format; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PrintfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef format, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().format = odsBuilder.getStringAttr(format); +} + +void PrintfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef format, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().format = odsBuilder.getStringAttr(format); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PrintfOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult PrintfOp::verifyInvariantsImpl() { + auto tblgen_format = getProperties().format; (void)tblgen_format; + if (!tblgen_format) return emitOpError("requires attribute 'format'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps2(*this, tblgen_format, "format"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PrintfOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult PrintfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr formatAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> argsTypes; + + if (parser.parseCustomAttributeWithFallback(formatAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (formatAttr) result.getOrAddProperties().format = formatAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + if (!argsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(argsTypes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PrintfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getFormatAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("format"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (!getArgs().empty()) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getArgs().getTypes(); + } +} + +void PrintfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::PrintfOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::ReturnOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.return", odsAttrs.getContext()); +} + +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(ReturnOp op) : ReturnOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReturnOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ReturnOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ReturnOpAdaptor::ReturnOpAdaptor(ReturnOp op) : ReturnOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReturnOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ReturnOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ReturnOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ReturnOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange ReturnOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ReturnOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReturnOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + // empty +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { + odsState.addOperands(operands); +} + +void ReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReturnOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReturnOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReturnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> operandsTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (!operandsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(operandsTypes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (!getOperands().empty()) { + _odsPrinter << ' '; + _odsPrinter << getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperands().getTypes(); + } +} + +void ReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::ReturnOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SDDMMBufferSizeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SDDMMBufferSizeOpGenericAdaptorBase::SDDMMBufferSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.sddmm_buffer_size", odsAttrs.getContext()); +} + +SDDMMBufferSizeOpGenericAdaptorBase::SDDMMBufferSizeOpGenericAdaptorBase(SDDMMBufferSizeOp op) : SDDMMBufferSizeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SDDMMBufferSizeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SDDMMBufferSizeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::TransposeModeAttr SDDMMBufferSizeOpGenericAdaptorBase::getModeAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); + return attr; +} + +::mlir::gpu::TransposeMode SDDMMBufferSizeOpGenericAdaptorBase::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SDDMMBufferSizeOpGenericAdaptorBase::getModeBAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); + return attr; +} + +::mlir::gpu::TransposeMode SDDMMBufferSizeOpGenericAdaptorBase::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SDDMMBufferSizeOpGenericAdaptorBase::getComputeTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); + return attr; +} + +::mlir::Type SDDMMBufferSizeOpGenericAdaptorBase::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +SDDMMBufferSizeOpAdaptor::SDDMMBufferSizeOpAdaptor(SDDMMBufferSizeOp op) : SDDMMBufferSizeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SDDMMBufferSizeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitError(loc, "'gpu.sddmm_buffer_size' op ""requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (tblgen_modeA && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeA)))) + return emitError(loc, "'gpu.sddmm_buffer_size' op ""attribute 'modeA' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_modeB && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeB)))) + return emitError(loc, "'gpu.sddmm_buffer_size' op ""attribute 'modeB' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_computeType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_computeType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_computeType).getValue()))) && ((true)))) + return emitError(loc, "'gpu.sddmm_buffer_size' op ""attribute 'computeType' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +void SDDMMBufferSizeOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "bufferSz"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair SDDMMBufferSizeOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SDDMMBufferSizeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SDDMMBufferSizeOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SDDMMBufferSizeOp::getDnmatA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SDDMMBufferSizeOp::getDnmatB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value SDDMMBufferSizeOp::getSpmatC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::MutableOperandRange SDDMMBufferSizeOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SDDMMBufferSizeOp::getDnmatAMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SDDMMBufferSizeOp::getDnmatBMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SDDMMBufferSizeOp::getSpmatCMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair SDDMMBufferSizeOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SDDMMBufferSizeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> SDDMMBufferSizeOp::getBufferSz() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +::mlir::Value SDDMMBufferSizeOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult SDDMMBufferSizeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.computeType; + auto attr = dict.get("computeType"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for computeType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `computeType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeA; + auto attr = dict.get("modeA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeB; + auto attr = dict.get("modeB"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SDDMMBufferSizeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.computeType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("computeType", + propStorage)); + } + + { + const auto &propStorage = prop.modeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeA", + propStorage)); + } + + { + const auto &propStorage = prop.modeB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeB", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SDDMMBufferSizeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.computeType.getAsOpaquePointer()), + llvm::hash_value(prop.modeA.getAsOpaquePointer()), + llvm::hash_value(prop.modeB.getAsOpaquePointer())); +} + +std::optional SDDMMBufferSizeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "computeType") + return prop.computeType; + + if (name == "modeA") + return prop.modeA; + + if (name == "modeB") + return prop.modeB; + return std::nullopt; +} + +void SDDMMBufferSizeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "computeType") { + prop.computeType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeA") { + prop.modeA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeB") { + prop.modeB = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SDDMMBufferSizeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.computeType) attrs.append("computeType", prop.computeType); + + if (prop.modeA) attrs.append("modeA", prop.modeA); + + if (prop.modeB) attrs.append("modeB", prop.modeB); +} + +::mlir::LogicalResult SDDMMBufferSizeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getComputeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(attr, "computeType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeB", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SDDMMBufferSizeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.computeType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeB))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SDDMMBufferSizeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.computeType); + + writer.writeOptionalAttribute(prop.modeA); + + writer.writeOptionalAttribute(prop.modeB); +} + +::mlir::gpu::TransposeModeAttr SDDMMBufferSizeOp::getModeAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); +} + +::mlir::gpu::TransposeMode SDDMMBufferSizeOp::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SDDMMBufferSizeOp::getModeBAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); +} + +::mlir::gpu::TransposeMode SDDMMBufferSizeOp::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SDDMMBufferSizeOp::getComputeTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); +} + +::mlir::Type SDDMMBufferSizeOp::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void SDDMMBufferSizeOp::setModeAAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeAAttrName(), attr); +} + +void SDDMMBufferSizeOp::setModeA(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeAAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SDDMMBufferSizeOp::setModeBAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeBAttrName(), attr); +} + +void SDDMMBufferSizeOp::setModeB(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeBAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SDDMMBufferSizeOp::setComputeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getComputeTypeAttrName(), attr); +} + +void SDDMMBufferSizeOp::setComputeType(::mlir::Type attrValue) { + (*this)->setAttr(getComputeTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void SDDMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type bufferSz, Type asyncToken, ValueRange asyncDependencies, Value dnmatA, Value dnmatB, Value spmatC, Type computeType) { + auto modeA = gpu::TransposeMode::NON_TRANSPOSE; + auto modeB = gpu::TransposeMode::NON_TRANSPOSE; + return build(odsBuilder, odsState, bufferSz, asyncToken, asyncDependencies, + modeA, modeB, dnmatA, dnmatB, spmatC, computeType); +} + +void SDDMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(spmatC); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.addTypes(bufferSz); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SDDMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(spmatC); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SDDMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::Type computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(spmatC); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.addTypes(bufferSz); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SDDMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::Type computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(spmatC); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SDDMMBufferSizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SDDMMBufferSizeOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.modeA) + properties.modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); + if (!properties.modeB) + properties.modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); +} + +::mlir::LogicalResult SDDMMBufferSizeOp::verifyInvariantsImpl() { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitOpError("requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeA, "modeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeB, "modeB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(*this, tblgen_computeType, "computeType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SDDMMBufferSizeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SDDMMBufferSizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dnmatARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnmatAOperands(dnmatARawOperands); ::llvm::SMLoc dnmatAOperandsLoc; + (void)dnmatAOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeAAttr; + ::mlir::OpAsmParser::UnresolvedOperand dnmatBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnmatBOperands(dnmatBRawOperands); ::llvm::SMLoc dnmatBOperandsLoc; + (void)dnmatBOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeBAttr; + ::mlir::OpAsmParser::UnresolvedOperand spmatCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatCOperands(spmatCRawOperands); ::llvm::SMLoc spmatCOperandsLoc; + (void)spmatCOperandsLoc; + ::mlir::TypeAttr computeTypeAttr; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + dnmatAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnmatARawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeAAttr) result.getOrAddProperties().modeA = modeAAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + dnmatBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnmatBRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeBAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeBAttr) result.getOrAddProperties().modeB = modeBAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + spmatCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatCRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(computeTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (computeTypeAttr) result.getOrAddProperties().computeType = computeTypeAttr; + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = mlir::gpu::SparseDnTensorHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType3 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnmatAOperands, odsBuildableType2, dnmatAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnmatBOperands, odsBuildableType2, dnmatBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatCOperands, odsBuildableType3, spmatCOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SDDMMBufferSizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getDnmatA(); + if (getModeAAttr() && getModeAAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeAAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnmatB(); + if (getModeBAttr() && getModeBAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeBAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSpmatC(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("modeA"); + elidedAttrs.push_back("modeB"); + elidedAttrs.push_back("computeType"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeAAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeA"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeBAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeB"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getComputeTypeAttr()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SDDMMBufferSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SDDMMOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SDDMMOpGenericAdaptorBase::SDDMMOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.sddmm", odsAttrs.getContext()); +} + +SDDMMOpGenericAdaptorBase::SDDMMOpGenericAdaptorBase(SDDMMOp op) : SDDMMOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SDDMMOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SDDMMOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::TransposeModeAttr SDDMMOpGenericAdaptorBase::getModeAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); + return attr; +} + +::mlir::gpu::TransposeMode SDDMMOpGenericAdaptorBase::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SDDMMOpGenericAdaptorBase::getModeBAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); + return attr; +} + +::mlir::gpu::TransposeMode SDDMMOpGenericAdaptorBase::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SDDMMOpGenericAdaptorBase::getComputeTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); + return attr; +} + +::mlir::Type SDDMMOpGenericAdaptorBase::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +SDDMMOpAdaptor::SDDMMOpAdaptor(SDDMMOp op) : SDDMMOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SDDMMOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitError(loc, "'gpu.sddmm' op ""requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (tblgen_modeA && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeA)))) + return emitError(loc, "'gpu.sddmm' op ""attribute 'modeA' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_modeB && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeB)))) + return emitError(loc, "'gpu.sddmm' op ""attribute 'modeB' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_computeType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_computeType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_computeType).getValue()))) && ((true)))) + return emitError(loc, "'gpu.sddmm' op ""attribute 'computeType' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair SDDMMOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SDDMMOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SDDMMOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SDDMMOp::getDnmatA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SDDMMOp::getDnmatB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value SDDMMOp::getSpmatC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> SDDMMOp::getBuffer() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(4).begin()); +} + +::mlir::MutableOperandRange SDDMMOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SDDMMOp::getDnmatAMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SDDMMOp::getDnmatBMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SDDMMOp::getSpmatCMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SDDMMOp::getBufferMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair SDDMMOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SDDMMOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SDDMMOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult SDDMMOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.computeType; + auto attr = dict.get("computeType"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for computeType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `computeType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeA; + auto attr = dict.get("modeA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeB; + auto attr = dict.get("modeB"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SDDMMOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.computeType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("computeType", + propStorage)); + } + + { + const auto &propStorage = prop.modeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeA", + propStorage)); + } + + { + const auto &propStorage = prop.modeB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeB", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SDDMMOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.computeType.getAsOpaquePointer()), + llvm::hash_value(prop.modeA.getAsOpaquePointer()), + llvm::hash_value(prop.modeB.getAsOpaquePointer())); +} + +std::optional SDDMMOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "computeType") + return prop.computeType; + + if (name == "modeA") + return prop.modeA; + + if (name == "modeB") + return prop.modeB; + return std::nullopt; +} + +void SDDMMOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "computeType") { + prop.computeType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeA") { + prop.modeA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeB") { + prop.modeB = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SDDMMOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.computeType) attrs.append("computeType", prop.computeType); + + if (prop.modeA) attrs.append("modeA", prop.modeA); + + if (prop.modeB) attrs.append("modeB", prop.modeB); +} + +::mlir::LogicalResult SDDMMOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getComputeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(attr, "computeType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeB", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SDDMMOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.computeType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeB))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SDDMMOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.computeType); + + writer.writeOptionalAttribute(prop.modeA); + + writer.writeOptionalAttribute(prop.modeB); +} + +::mlir::gpu::TransposeModeAttr SDDMMOp::getModeAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); +} + +::mlir::gpu::TransposeMode SDDMMOp::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SDDMMOp::getModeBAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); +} + +::mlir::gpu::TransposeMode SDDMMOp::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SDDMMOp::getComputeTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); +} + +::mlir::Type SDDMMOp::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void SDDMMOp::setModeAAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeAAttrName(), attr); +} + +void SDDMMOp::setModeA(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeAAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SDDMMOp::setModeBAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeBAttrName(), attr); +} + +void SDDMMOp::setModeB(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeBAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SDDMMOp::setComputeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getComputeTypeAttrName(), attr); +} + +void SDDMMOp::setComputeType(::mlir::Type attrValue) { + (*this)->setAttr(getComputeTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void SDDMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type asyncToken, ValueRange asyncDependencies, Value dnmatA, Value dnmatB, Value spmatC, Type computeType, Value buffer) { + auto modeA = gpu::TransposeMode::NON_TRANSPOSE; + auto modeB = gpu::TransposeMode::NON_TRANSPOSE; + return build(odsBuilder, odsState, asyncToken, asyncDependencies, modeA, + modeB, dnmatA, dnmatB, spmatC, computeType, buffer); +} + +void SDDMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType, ::mlir::Value buffer) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(spmatC); + odsState.addOperands(buffer); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SDDMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType, ::mlir::Value buffer) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(spmatC); + odsState.addOperands(buffer); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.addTypes(resultTypes); +} + +void SDDMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::Type computeType, ::mlir::Value buffer) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(spmatC); + odsState.addOperands(buffer); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SDDMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::Type computeType, ::mlir::Value buffer) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(dnmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(spmatC); + odsState.addOperands(buffer); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.addTypes(resultTypes); +} + +void SDDMMOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +void SDDMMOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.modeA) + properties.modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); + if (!properties.modeB) + properties.modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); +} + +::mlir::LogicalResult SDDMMOp::verifyInvariantsImpl() { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitOpError("requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeA, "modeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeB, "modeB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(*this, tblgen_computeType, "computeType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SDDMMOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SDDMMOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dnmatARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnmatAOperands(dnmatARawOperands); ::llvm::SMLoc dnmatAOperandsLoc; + (void)dnmatAOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeAAttr; + ::mlir::OpAsmParser::UnresolvedOperand dnmatBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnmatBOperands(dnmatBRawOperands); ::llvm::SMLoc dnmatBOperandsLoc; + (void)dnmatBOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeBAttr; + ::mlir::OpAsmParser::UnresolvedOperand spmatCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatCOperands(spmatCRawOperands); ::llvm::SMLoc spmatCOperandsLoc; + (void)spmatCOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bufferRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bufferOperands(bufferRawOperands); ::llvm::SMLoc bufferOperandsLoc; + (void)bufferOperandsLoc; + ::mlir::Type bufferRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> bufferTypes(bufferRawTypes); + ::mlir::TypeAttr computeTypeAttr; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + dnmatAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnmatARawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeAAttr) result.getOrAddProperties().modeA = modeAAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + dnmatBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnmatBRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeBAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeBAttr) result.getOrAddProperties().modeB = modeBAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + spmatCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatCRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bufferOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bufferRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + bufferRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(computeTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (computeTypeAttr) result.getOrAddProperties().computeType = computeTypeAttr; + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::SparseDnTensorHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnmatAOperands, odsBuildableType1, dnmatAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnmatBOperands, odsBuildableType1, dnmatBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatCOperands, odsBuildableType2, spmatCOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bufferOperands, bufferTypes, bufferOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SDDMMOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getDnmatA(); + if (getModeAAttr() && getModeAAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeAAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnmatB(); + if (getModeBAttr() && getModeBAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeBAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSpmatC(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBuffer(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("modeA"); + elidedAttrs.push_back("modeB"); + elidedAttrs.push_back("computeType"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeAAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeA"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeBAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeB"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBuffer().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getComputeTypeAttr()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SDDMMOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SetCsrPointersOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SetCsrPointersOpGenericAdaptorBase::SetCsrPointersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.set_csr_pointers", odsAttrs.getContext()); +} + +SetCsrPointersOpGenericAdaptorBase::SetCsrPointersOpGenericAdaptorBase(SetCsrPointersOp op) : SetCsrPointersOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SetCsrPointersOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SetCsrPointersOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SetCsrPointersOpAdaptor::SetCsrPointersOpAdaptor(SetCsrPointersOp op) : SetCsrPointersOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SetCsrPointersOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SetCsrPointersOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SetCsrPointersOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SetCsrPointersOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SetCsrPointersOp::getSpmat() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> SetCsrPointersOp::getPositions() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> SetCsrPointersOp::getCoordinates() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> SetCsrPointersOp::getValues() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(4).begin()); +} + +::mlir::MutableOperandRange SetCsrPointersOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SetCsrPointersOp::getSpmatMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SetCsrPointersOp::getPositionsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SetCsrPointersOp::getCoordinatesMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SetCsrPointersOp::getValuesMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair SetCsrPointersOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SetCsrPointersOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SetCsrPointersOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void SetCsrPointersOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat, ::mlir::Value positions, ::mlir::Value coordinates, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmat); + odsState.addOperands(positions); + odsState.addOperands(coordinates); + odsState.addOperands(values); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SetCsrPointersOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat, ::mlir::Value positions, ::mlir::Value coordinates, ::mlir::Value values) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmat); + odsState.addOperands(positions); + odsState.addOperands(coordinates); + odsState.addOperands(values); + odsState.addTypes(resultTypes); +} + +void SetCsrPointersOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SetCsrPointersOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SetCsrPointersOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SetCsrPointersOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand spmatRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatOperands(spmatRawOperands); ::llvm::SMLoc spmatOperandsLoc; + (void)spmatOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand positionsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> positionsOperands(positionsRawOperands); ::llvm::SMLoc positionsOperandsLoc; + (void)positionsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand coordinatesRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> coordinatesOperands(coordinatesRawOperands); ::llvm::SMLoc coordinatesOperandsLoc; + (void)coordinatesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valuesRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valuesOperands(valuesRawOperands); ::llvm::SMLoc valuesOperandsLoc; + (void)valuesOperandsLoc; + ::mlir::Type positionsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> positionsTypes(positionsRawTypes); + ::mlir::Type coordinatesRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> coordinatesTypes(coordinatesRawTypes); + ::mlir::Type valuesRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valuesTypes(valuesRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + spmatOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + positionsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(positionsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + coordinatesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(coordinatesRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valuesRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + positionsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + coordinatesRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valuesRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatOperands, odsBuildableType1, spmatOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(positionsOperands, positionsTypes, positionsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(coordinatesOperands, coordinatesTypes, coordinatesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valuesOperands, valuesTypes, valuesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SetCsrPointersOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getSpmat(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getPositions(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCoordinates(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getValues(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getPositions().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getCoordinates().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getValues().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SetCsrPointersOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SetDefaultDeviceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SetDefaultDeviceOpGenericAdaptorBase::SetDefaultDeviceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.set_default_device", odsAttrs.getContext()); +} + +SetDefaultDeviceOpGenericAdaptorBase::SetDefaultDeviceOpGenericAdaptorBase(SetDefaultDeviceOp op) : SetDefaultDeviceOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SetDefaultDeviceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SetDefaultDeviceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SetDefaultDeviceOpAdaptor::SetDefaultDeviceOpAdaptor(SetDefaultDeviceOp op) : SetDefaultDeviceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SetDefaultDeviceOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SetDefaultDeviceOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SetDefaultDeviceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> SetDefaultDeviceOp::getDevIndex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SetDefaultDeviceOp::getDevIndexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SetDefaultDeviceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SetDefaultDeviceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void SetDefaultDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value devIndex) { + odsState.addOperands(devIndex); +} + +void SetDefaultDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value devIndex) { + odsState.addOperands(devIndex); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SetDefaultDeviceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SetDefaultDeviceOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SetDefaultDeviceOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SetDefaultDeviceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand devIndexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> devIndexOperands(devIndexRawOperands); ::llvm::SMLoc devIndexOperandsLoc; + (void)devIndexOperandsLoc; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + devIndexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(devIndexRawOperands[0])) + return ::mlir::failure(); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(devIndexOperands, odsBuildableType0, devIndexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SetDefaultDeviceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getDevIndex(); +} + +void SetDefaultDeviceOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SetDefaultDeviceOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::ShuffleOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShuffleOpGenericAdaptorBase::ShuffleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.shuffle", odsAttrs.getContext()); +} + +ShuffleOpGenericAdaptorBase::ShuffleOpGenericAdaptorBase(ShuffleOp op) : ShuffleOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShuffleOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShuffleOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::ShuffleModeAttr ShuffleOpGenericAdaptorBase::getModeAttr() { + auto attr = ::llvm::cast<::mlir::gpu::ShuffleModeAttr>(getProperties().mode); + return attr; +} + +::mlir::gpu::ShuffleMode ShuffleOpGenericAdaptorBase::getMode() { + auto attr = getModeAttr(); + return attr.getValue(); +} + +} // namespace detail +ShuffleOpAdaptor::ShuffleOpAdaptor(ShuffleOp op) : ShuffleOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShuffleOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_mode = getProperties().mode; (void)tblgen_mode; + if (!tblgen_mode) return emitError(loc, "'gpu.shuffle' op ""requires attribute 'mode'"); + + if (tblgen_mode && !((::llvm::isa<::mlir::gpu::ShuffleModeAttr>(tblgen_mode)))) + return emitError(loc, "'gpu.shuffle' op ""attribute 'mode' failed to satisfy constraint: Indexing modes supported by gpu.shuffle."); + return ::mlir::success(); +} + +void ShuffleOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "shuffleResult"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "valid"); +} + +std::pair ShuffleOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShuffleOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShuffleOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ShuffleOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ShuffleOp::getWidth() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &ShuffleOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShuffleOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShuffleOp::getWidthMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShuffleOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShuffleOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShuffleOp::getShuffleResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ShuffleOp::getValid() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(1).begin()); +} + +::mlir::LogicalResult ShuffleOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.mode; + auto attr = dict.get("mode"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for mode in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `mode` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ShuffleOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.mode; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("mode", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ShuffleOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.mode.getAsOpaquePointer())); +} + +std::optional ShuffleOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "mode") + return prop.mode; + return std::nullopt; +} + +void ShuffleOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "mode") { + prop.mode = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ShuffleOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.mode) attrs.append("mode", prop.mode); +} + +::mlir::LogicalResult ShuffleOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getModeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps13(attr, "mode", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShuffleOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.mode))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShuffleOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.mode); +} + +::mlir::gpu::ShuffleModeAttr ShuffleOp::getModeAttr() { + return ::llvm::cast<::mlir::gpu::ShuffleModeAttr>(getProperties().mode); +} + +::mlir::gpu::ShuffleMode ShuffleOp::getMode() { + auto attr = getModeAttr(); + return attr.getValue(); +} + +void ShuffleOp::setModeAttr(::mlir::gpu::ShuffleModeAttr attr) { + (*this)->setAttr(getModeAttrName(), attr); +} + +void ShuffleOp::setMode(::mlir::gpu::ShuffleMode attrValue) { + (*this)->setAttr(getModeAttrName(), ::mlir::gpu::ShuffleModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type shuffleResult, ::mlir::Type valid, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleModeAttr mode) { + odsState.addOperands(value); + odsState.addOperands(offset); + odsState.addOperands(width); + odsState.getOrAddProperties().mode = mode; + odsState.addTypes(shuffleResult); + odsState.addTypes(valid); +} + +void ShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleModeAttr mode) { + odsState.addOperands(value); + odsState.addOperands(offset); + odsState.addOperands(width); + odsState.getOrAddProperties().mode = mode; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShuffleOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleModeAttr mode) { + odsState.addOperands(value); + odsState.addOperands(offset); + odsState.addOperands(width); + odsState.getOrAddProperties().mode = mode; + assert(resultTypes.size() == 2u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type shuffleResult, ::mlir::Type valid, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleMode mode) { + odsState.addOperands(value); + odsState.addOperands(offset); + odsState.addOperands(width); + odsState.getOrAddProperties().mode = ::mlir::gpu::ShuffleModeAttr::get(odsBuilder.getContext(), mode); + odsState.addTypes(shuffleResult); + odsState.addTypes(valid); +} + +void ShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleMode mode) { + odsState.addOperands(value); + odsState.addOperands(offset); + odsState.addOperands(width); + odsState.getOrAddProperties().mode = ::mlir::gpu::ShuffleModeAttr::get(odsBuilder.getContext(), mode); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShuffleOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleMode mode) { + odsState.addOperands(value); + odsState.addOperands(offset); + odsState.addOperands(width); + odsState.getOrAddProperties().mode = ::mlir::gpu::ShuffleModeAttr::get(odsBuilder.getContext(), mode); + assert(resultTypes.size() == 2u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShuffleOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 2u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ShuffleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShuffleOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 2u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ShuffleOp::verifyInvariantsImpl() { + auto tblgen_mode = getProperties().mode; (void)tblgen_mode; + if (!tblgen_mode) return emitOpError("requires attribute 'mode'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps13(*this, tblgen_mode, "mode"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps11(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {value, shuffleResult} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult ShuffleOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ShuffleOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(2); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + ::mlir::Type odsInferredType1 = odsBuilder.getIntegerType(1); + inferredReturnTypes[0] = odsInferredType0; + inferredReturnTypes[1] = odsInferredType1; + return ::mlir::success(); +} + +::mlir::ParseResult ShuffleOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::gpu::ShuffleModeAttr modeAttr; + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand offsetRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> offsetOperands(offsetRawOperands); ::llvm::SMLoc offsetOperandsLoc; + (void)offsetOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand widthRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> widthOperands(widthRawOperands); ::llvm::SMLoc widthOperandsLoc; + (void)widthOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + if (parser.parseCustomAttributeWithFallback(modeAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeAttr) result.getOrAddProperties().mode = modeAttr; + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + offsetOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(offsetRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + widthOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(widthRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + result.addTypes(valueTypes[0]); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(offsetOperands, odsBuildableType1, offsetOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(widthOperands, odsBuildableType1, widthOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShuffleOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getModeAttr()); + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getOffset(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getWidth(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("mode"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ShuffleOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::ShuffleOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpGEMMCopyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SpGEMMCopyOpGenericAdaptorBase::SpGEMMCopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.spgemm_copy", odsAttrs.getContext()); +} + +SpGEMMCopyOpGenericAdaptorBase::SpGEMMCopyOpGenericAdaptorBase(SpGEMMCopyOp op) : SpGEMMCopyOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SpGEMMCopyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SpGEMMCopyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::TransposeModeAttr SpGEMMCopyOpGenericAdaptorBase::getModeAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); + return attr; +} + +::mlir::gpu::TransposeMode SpGEMMCopyOpGenericAdaptorBase::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SpGEMMCopyOpGenericAdaptorBase::getModeBAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); + return attr; +} + +::mlir::gpu::TransposeMode SpGEMMCopyOpGenericAdaptorBase::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpGEMMCopyOpGenericAdaptorBase::getComputeTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); + return attr; +} + +::mlir::Type SpGEMMCopyOpGenericAdaptorBase::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +SpGEMMCopyOpAdaptor::SpGEMMCopyOpAdaptor(SpGEMMCopyOp op) : SpGEMMCopyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SpGEMMCopyOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitError(loc, "'gpu.spgemm_copy' op ""requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (tblgen_modeA && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeA)))) + return emitError(loc, "'gpu.spgemm_copy' op ""attribute 'modeA' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_modeB && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeB)))) + return emitError(loc, "'gpu.spgemm_copy' op ""attribute 'modeB' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_computeType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_computeType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_computeType).getValue()))) && ((true)))) + return emitError(loc, "'gpu.spgemm_copy' op ""attribute 'computeType' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair SpGEMMCopyOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SpGEMMCopyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SpGEMMCopyOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SpGEMMCopyOp::getDesc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SpGEMMCopyOp::getSpmatA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value SpGEMMCopyOp::getSpmatB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value SpGEMMCopyOp::getSpmatC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::MutableOperandRange SpGEMMCopyOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SpGEMMCopyOp::getDescMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpGEMMCopyOp::getSpmatAMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpGEMMCopyOp::getSpmatBMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpGEMMCopyOp::getSpmatCMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair SpGEMMCopyOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SpGEMMCopyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SpGEMMCopyOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult SpGEMMCopyOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.computeType; + auto attr = dict.get("computeType"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for computeType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `computeType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeA; + auto attr = dict.get("modeA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeB; + auto attr = dict.get("modeB"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SpGEMMCopyOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.computeType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("computeType", + propStorage)); + } + + { + const auto &propStorage = prop.modeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeA", + propStorage)); + } + + { + const auto &propStorage = prop.modeB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeB", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SpGEMMCopyOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.computeType.getAsOpaquePointer()), + llvm::hash_value(prop.modeA.getAsOpaquePointer()), + llvm::hash_value(prop.modeB.getAsOpaquePointer())); +} + +std::optional SpGEMMCopyOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "computeType") + return prop.computeType; + + if (name == "modeA") + return prop.modeA; + + if (name == "modeB") + return prop.modeB; + return std::nullopt; +} + +void SpGEMMCopyOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "computeType") { + prop.computeType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeA") { + prop.modeA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeB") { + prop.modeB = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SpGEMMCopyOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.computeType) attrs.append("computeType", prop.computeType); + + if (prop.modeA) attrs.append("modeA", prop.modeA); + + if (prop.modeB) attrs.append("modeB", prop.modeB); +} + +::mlir::LogicalResult SpGEMMCopyOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getComputeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(attr, "computeType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeB", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpGEMMCopyOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.computeType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeB))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpGEMMCopyOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.computeType); + + writer.writeOptionalAttribute(prop.modeA); + + writer.writeOptionalAttribute(prop.modeB); +} + +::mlir::gpu::TransposeModeAttr SpGEMMCopyOp::getModeAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); +} + +::mlir::gpu::TransposeMode SpGEMMCopyOp::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SpGEMMCopyOp::getModeBAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); +} + +::mlir::gpu::TransposeMode SpGEMMCopyOp::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpGEMMCopyOp::getComputeTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); +} + +::mlir::Type SpGEMMCopyOp::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void SpGEMMCopyOp::setModeAAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeAAttrName(), attr); +} + +void SpGEMMCopyOp::setModeA(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeAAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpGEMMCopyOp::setModeBAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeBAttrName(), attr); +} + +void SpGEMMCopyOp::setModeB(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeBAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpGEMMCopyOp::setComputeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getComputeTypeAttrName(), attr); +} + +void SpGEMMCopyOp::setComputeType(::mlir::Type attrValue) { + (*this)->setAttr(getComputeTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void SpGEMMCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type asyncToken, ValueRange asyncDependencies, Value desc, Value spmatA, Value spmatB, Value spmatC, Type computeType) { + auto modeA = gpu::TransposeMode::NON_TRANSPOSE; + auto modeB = gpu::TransposeMode::NON_TRANSPOSE; + return build(odsBuilder, odsState, asyncToken, asyncDependencies, desc, + modeA, modeB, spmatA, spmatB, spmatC, computeType); +} + +void SpGEMMCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + odsState.addOperands(spmatA); + odsState.addOperands(spmatB); + odsState.addOperands(spmatC); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpGEMMCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + odsState.addOperands(spmatA); + odsState.addOperands(spmatB); + odsState.addOperands(spmatC); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.addTypes(resultTypes); +} + +void SpGEMMCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::Type computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + odsState.addOperands(spmatA); + odsState.addOperands(spmatB); + odsState.addOperands(spmatC); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpGEMMCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::Type computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + odsState.addOperands(spmatA); + odsState.addOperands(spmatB); + odsState.addOperands(spmatC); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.addTypes(resultTypes); +} + +void SpGEMMCopyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +void SpGEMMCopyOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.modeA) + properties.modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); + if (!properties.modeB) + properties.modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); +} + +::mlir::LogicalResult SpGEMMCopyOp::verifyInvariantsImpl() { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitOpError("requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeA, "modeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeB, "modeB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(*this, tblgen_computeType, "computeType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpGEMMCopyOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SpGEMMCopyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand spmatARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatAOperands(spmatARawOperands); ::llvm::SMLoc spmatAOperandsLoc; + (void)spmatAOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeAAttr; + ::mlir::OpAsmParser::UnresolvedOperand spmatBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatBOperands(spmatBRawOperands); ::llvm::SMLoc spmatBOperandsLoc; + (void)spmatBOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeBAttr; + ::mlir::OpAsmParser::UnresolvedOperand spmatCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatCOperands(spmatCRawOperands); ::llvm::SMLoc spmatCOperandsLoc; + (void)spmatCOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand descRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> descOperands(descRawOperands); ::llvm::SMLoc descOperandsLoc; + (void)descOperandsLoc; + ::mlir::TypeAttr computeTypeAttr; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + spmatAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatARawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeAAttr) result.getOrAddProperties().modeA = modeAAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + spmatBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatBRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeBAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeBAttr) result.getOrAddProperties().modeB = modeBAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + spmatCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatCRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + descOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(descRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(computeTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (computeTypeAttr) result.getOrAddProperties().computeType = computeTypeAttr; + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::SparseSpGEMMOpHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(descOperands, odsBuildableType1, descOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatAOperands, odsBuildableType2, spmatAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatBOperands, odsBuildableType2, spmatBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatCOperands, odsBuildableType2, spmatCOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpGEMMCopyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getSpmatA(); + if (getModeAAttr() && getModeAAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeAAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSpmatB(); + if (getModeBAttr() && getModeBAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeBAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSpmatC(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDesc(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("modeA"); + elidedAttrs.push_back("modeB"); + elidedAttrs.push_back("computeType"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeAAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeA"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeBAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeB"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getComputeTypeAttr()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMCopyOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpGEMMCreateDescrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SpGEMMCreateDescrOpGenericAdaptorBase::SpGEMMCreateDescrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.spgemm_create_descr", odsAttrs.getContext()); +} + +SpGEMMCreateDescrOpGenericAdaptorBase::SpGEMMCreateDescrOpGenericAdaptorBase(SpGEMMCreateDescrOp op) : SpGEMMCreateDescrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SpGEMMCreateDescrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SpGEMMCreateDescrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SpGEMMCreateDescrOpAdaptor::SpGEMMCreateDescrOpAdaptor(SpGEMMCreateDescrOp op) : SpGEMMCreateDescrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SpGEMMCreateDescrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void SpGEMMCreateDescrOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "desc"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair SpGEMMCreateDescrOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SpGEMMCreateDescrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SpGEMMCreateDescrOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange SpGEMMCreateDescrOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair SpGEMMCreateDescrOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SpGEMMCreateDescrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SpGEMMCreateDescrOp::getDesc() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Value SpGEMMCreateDescrOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void SpGEMMCreateDescrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type desc, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies) { + odsState.addOperands(asyncDependencies); + odsState.addTypes(desc); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpGEMMCreateDescrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SpGEMMCreateDescrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps12(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpGEMMCreateDescrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SpGEMMCreateDescrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = mlir::gpu::SparseSpGEMMOpHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpGEMMCreateDescrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMCreateDescrOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpGEMMDestroyDescrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SpGEMMDestroyDescrOpGenericAdaptorBase::SpGEMMDestroyDescrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.spgemm_destroy_descr", odsAttrs.getContext()); +} + +SpGEMMDestroyDescrOpGenericAdaptorBase::SpGEMMDestroyDescrOpGenericAdaptorBase(SpGEMMDestroyDescrOp op) : SpGEMMDestroyDescrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SpGEMMDestroyDescrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SpGEMMDestroyDescrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SpGEMMDestroyDescrOpAdaptor::SpGEMMDestroyDescrOpAdaptor(SpGEMMDestroyDescrOp op) : SpGEMMDestroyDescrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SpGEMMDestroyDescrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SpGEMMDestroyDescrOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SpGEMMDestroyDescrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SpGEMMDestroyDescrOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SpGEMMDestroyDescrOp::getDesc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::MutableOperandRange SpGEMMDestroyDescrOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SpGEMMDestroyDescrOp::getDescMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SpGEMMDestroyDescrOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SpGEMMDestroyDescrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SpGEMMDestroyDescrOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void SpGEMMDestroyDescrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpGEMMDestroyDescrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + odsState.addTypes(resultTypes); +} + +void SpGEMMDestroyDescrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SpGEMMDestroyDescrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpGEMMDestroyDescrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SpGEMMDestroyDescrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand descRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> descOperands(descRawOperands); ::llvm::SMLoc descOperandsLoc; + (void)descOperandsLoc; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + descOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(descRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::SparseSpGEMMOpHandleType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(descOperands, odsBuildableType1, descOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpGEMMDestroyDescrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getDesc(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMDestroyDescrOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpGEMMWorkEstimationOrComputeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.spgemm_work_estimation_or_compute", odsAttrs.getContext()); +} + +SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase(SpGEMMWorkEstimationOrComputeOp op) : SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 6) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::TransposeModeAttr SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getModeAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); + return attr; +} + +::mlir::gpu::TransposeMode SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getModeBAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); + return attr; +} + +::mlir::gpu::TransposeMode SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getComputeTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); + return attr; +} + +::mlir::Type SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getKindAttr() { + auto attr = ::llvm::cast<::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr>(getProperties().kind); + return attr; +} + +::mlir::gpu::SpGEMMWorkEstimationOrComputeKind SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase::getKind() { + auto attr = getKindAttr(); + return attr.getValue(); +} + +} // namespace detail +SpGEMMWorkEstimationOrComputeOpAdaptor::SpGEMMWorkEstimationOrComputeOpAdaptor(SpGEMMWorkEstimationOrComputeOp op) : SpGEMMWorkEstimationOrComputeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SpGEMMWorkEstimationOrComputeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitError(loc, "'gpu.spgemm_work_estimation_or_compute' op ""requires attribute 'computeType'"); + auto tblgen_kind = getProperties().kind; (void)tblgen_kind; + if (!tblgen_kind) return emitError(loc, "'gpu.spgemm_work_estimation_or_compute' op ""requires attribute 'kind'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (tblgen_modeA && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeA)))) + return emitError(loc, "'gpu.spgemm_work_estimation_or_compute' op ""attribute 'modeA' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_modeB && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeB)))) + return emitError(loc, "'gpu.spgemm_work_estimation_or_compute' op ""attribute 'modeB' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_computeType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_computeType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_computeType).getValue()))) && ((true)))) + return emitError(loc, "'gpu.spgemm_work_estimation_or_compute' op ""attribute 'computeType' failed to satisfy constraint: any type attribute"); + + if (tblgen_kind && !((::llvm::isa<::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr>(tblgen_kind)))) + return emitError(loc, "'gpu.spgemm_work_estimation_or_compute' op ""attribute 'kind' failed to satisfy constraint: choose whether spgemm_work_estimation_or_compute does work estimation or compute"); + return ::mlir::success(); +} + +void SpGEMMWorkEstimationOrComputeOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "bufferSzNew"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair SpGEMMWorkEstimationOrComputeOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 6) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SpGEMMWorkEstimationOrComputeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SpGEMMWorkEstimationOrComputeOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SpGEMMWorkEstimationOrComputeOp::getDesc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SpGEMMWorkEstimationOrComputeOp::getSpmatA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value SpGEMMWorkEstimationOrComputeOp::getSpmatB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value SpGEMMWorkEstimationOrComputeOp::getSpmatC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> SpGEMMWorkEstimationOrComputeOp::getBufferSz() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(5).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> SpGEMMWorkEstimationOrComputeOp::getBuffer() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(6).begin()); +} + +::mlir::MutableOperandRange SpGEMMWorkEstimationOrComputeOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SpGEMMWorkEstimationOrComputeOp::getDescMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpGEMMWorkEstimationOrComputeOp::getSpmatAMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpGEMMWorkEstimationOrComputeOp::getSpmatBMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpGEMMWorkEstimationOrComputeOp::getSpmatCMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpGEMMWorkEstimationOrComputeOp::getBufferSzMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpGEMMWorkEstimationOrComputeOp::getBufferMutable() { + auto range = getODSOperandIndexAndLength(6); + return getOperation()->getOpOperand(range.first); +} + +std::pair SpGEMMWorkEstimationOrComputeOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SpGEMMWorkEstimationOrComputeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> SpGEMMWorkEstimationOrComputeOp::getBufferSzNew() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +::mlir::Value SpGEMMWorkEstimationOrComputeOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult SpGEMMWorkEstimationOrComputeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.computeType; + auto attr = dict.get("computeType"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for computeType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `computeType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.kind; + auto attr = dict.get("kind"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for kind in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `kind` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeA; + auto attr = dict.get("modeA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeB; + auto attr = dict.get("modeB"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SpGEMMWorkEstimationOrComputeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.computeType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("computeType", + propStorage)); + } + + { + const auto &propStorage = prop.kind; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("kind", + propStorage)); + } + + { + const auto &propStorage = prop.modeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeA", + propStorage)); + } + + { + const auto &propStorage = prop.modeB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeB", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SpGEMMWorkEstimationOrComputeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.computeType.getAsOpaquePointer()), + llvm::hash_value(prop.kind.getAsOpaquePointer()), + llvm::hash_value(prop.modeA.getAsOpaquePointer()), + llvm::hash_value(prop.modeB.getAsOpaquePointer())); +} + +std::optional SpGEMMWorkEstimationOrComputeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "computeType") + return prop.computeType; + + if (name == "kind") + return prop.kind; + + if (name == "modeA") + return prop.modeA; + + if (name == "modeB") + return prop.modeB; + return std::nullopt; +} + +void SpGEMMWorkEstimationOrComputeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "computeType") { + prop.computeType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "kind") { + prop.kind = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeA") { + prop.modeA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeB") { + prop.modeB = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SpGEMMWorkEstimationOrComputeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.computeType) attrs.append("computeType", prop.computeType); + + if (prop.kind) attrs.append("kind", prop.kind); + + if (prop.modeA) attrs.append("modeA", prop.modeA); + + if (prop.modeB) attrs.append("modeB", prop.modeB); +} + +::mlir::LogicalResult SpGEMMWorkEstimationOrComputeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getComputeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(attr, "computeType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getKindAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps14(attr, "kind", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeB", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpGEMMWorkEstimationOrComputeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.computeType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.kind))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeB))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpGEMMWorkEstimationOrComputeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.computeType); + writer.writeAttribute(prop.kind); + + writer.writeOptionalAttribute(prop.modeA); + + writer.writeOptionalAttribute(prop.modeB); +} + +::mlir::gpu::TransposeModeAttr SpGEMMWorkEstimationOrComputeOp::getModeAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); +} + +::mlir::gpu::TransposeMode SpGEMMWorkEstimationOrComputeOp::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SpGEMMWorkEstimationOrComputeOp::getModeBAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); +} + +::mlir::gpu::TransposeMode SpGEMMWorkEstimationOrComputeOp::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpGEMMWorkEstimationOrComputeOp::getComputeTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); +} + +::mlir::Type SpGEMMWorkEstimationOrComputeOp::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr SpGEMMWorkEstimationOrComputeOp::getKindAttr() { + return ::llvm::cast<::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr>(getProperties().kind); +} + +::mlir::gpu::SpGEMMWorkEstimationOrComputeKind SpGEMMWorkEstimationOrComputeOp::getKind() { + auto attr = getKindAttr(); + return attr.getValue(); +} + +void SpGEMMWorkEstimationOrComputeOp::setModeAAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeAAttrName(), attr); +} + +void SpGEMMWorkEstimationOrComputeOp::setModeA(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeAAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpGEMMWorkEstimationOrComputeOp::setModeBAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeBAttrName(), attr); +} + +void SpGEMMWorkEstimationOrComputeOp::setModeB(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeBAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpGEMMWorkEstimationOrComputeOp::setComputeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getComputeTypeAttrName(), attr); +} + +void SpGEMMWorkEstimationOrComputeOp::setComputeType(::mlir::Type attrValue) { + (*this)->setAttr(getComputeTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void SpGEMMWorkEstimationOrComputeOp::setKindAttr(::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr attr) { + (*this)->setAttr(getKindAttrName(), attr); +} + +void SpGEMMWorkEstimationOrComputeOp::setKind(::mlir::gpu::SpGEMMWorkEstimationOrComputeKind attrValue) { + (*this)->setAttr(getKindAttrName(), ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpGEMMWorkEstimationOrComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type bufferSzNew, Type asyncToken, ValueRange asyncDependencies, Value desc, Value spmatA, Value spmatB, Value spmatC, Type computeType, Value bufferSz, Value buffer) { + auto modeA = gpu::TransposeMode::NON_TRANSPOSE; + auto modeB = gpu::TransposeMode::NON_TRANSPOSE; + auto kind = gpu::SpGEMMWorkEstimationOrComputeKind::WORK_ESTIMATION; + return build(odsBuilder, odsState, bufferSzNew, asyncToken, asyncDependencies, desc, + modeA, modeB, spmatA, spmatB, spmatC, computeType, bufferSz, buffer, kind); +} + +void SpGEMMWorkEstimationOrComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSzNew, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType, ::mlir::Value bufferSz, ::mlir::Value buffer, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr kind) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + odsState.addOperands(spmatA); + odsState.addOperands(spmatB); + odsState.addOperands(spmatC); + odsState.addOperands(bufferSz); + odsState.addOperands(buffer); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.getOrAddProperties().kind = kind; + odsState.addTypes(bufferSzNew); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpGEMMWorkEstimationOrComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType, ::mlir::Value bufferSz, ::mlir::Value buffer, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr kind) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + odsState.addOperands(spmatA); + odsState.addOperands(spmatB); + odsState.addOperands(spmatC); + odsState.addOperands(bufferSz); + odsState.addOperands(buffer); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.getOrAddProperties().kind = kind; + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SpGEMMWorkEstimationOrComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSzNew, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::Type computeType, ::mlir::Value bufferSz, ::mlir::Value buffer, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind kind) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + odsState.addOperands(spmatA); + odsState.addOperands(spmatB); + odsState.addOperands(spmatC); + odsState.addOperands(bufferSz); + odsState.addOperands(buffer); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.getOrAddProperties().kind = ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr::get(odsBuilder.getContext(), kind); + odsState.addTypes(bufferSzNew); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpGEMMWorkEstimationOrComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::Type computeType, ::mlir::Value bufferSz, ::mlir::Value buffer, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind kind) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(desc); + odsState.addOperands(spmatA); + odsState.addOperands(spmatB); + odsState.addOperands(spmatC); + odsState.addOperands(bufferSz); + odsState.addOperands(buffer); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.getOrAddProperties().kind = ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr::get(odsBuilder.getContext(), kind); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SpGEMMWorkEstimationOrComputeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SpGEMMWorkEstimationOrComputeOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.modeA) + properties.modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); + if (!properties.modeB) + properties.modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); +} + +::mlir::LogicalResult SpGEMMWorkEstimationOrComputeOp::verifyInvariantsImpl() { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitOpError("requires attribute 'computeType'"); + auto tblgen_kind = getProperties().kind; (void)tblgen_kind; + if (!tblgen_kind) return emitOpError("requires attribute 'kind'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeA, "modeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeB, "modeB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(*this, tblgen_computeType, "computeType"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps14(*this, tblgen_kind, "kind"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpGEMMWorkEstimationOrComputeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SpGEMMWorkEstimationOrComputeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr kindAttr; + ::mlir::OpAsmParser::UnresolvedOperand spmatARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatAOperands(spmatARawOperands); ::llvm::SMLoc spmatAOperandsLoc; + (void)spmatAOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeAAttr; + ::mlir::OpAsmParser::UnresolvedOperand spmatBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatBOperands(spmatBRawOperands); ::llvm::SMLoc spmatBOperandsLoc; + (void)spmatBOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeBAttr; + ::mlir::OpAsmParser::UnresolvedOperand spmatCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatCOperands(spmatCRawOperands); ::llvm::SMLoc spmatCOperandsLoc; + (void)spmatCOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand descRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> descOperands(descRawOperands); ::llvm::SMLoc descOperandsLoc; + (void)descOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bufferSzRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bufferSzOperands(bufferSzRawOperands); ::llvm::SMLoc bufferSzOperandsLoc; + (void)bufferSzOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bufferRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bufferOperands(bufferRawOperands); ::llvm::SMLoc bufferOperandsLoc; + (void)bufferOperandsLoc; + ::mlir::TypeAttr computeTypeAttr; + ::mlir::Type bufferRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> bufferTypes(bufferRawTypes); + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + if (parser.parseLBrace()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(kindAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (kindAttr) result.getOrAddProperties().kind = kindAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + + spmatAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatARawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeAAttr) result.getOrAddProperties().modeA = modeAAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + spmatBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatBRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeBAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeBAttr) result.getOrAddProperties().modeB = modeBAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + spmatCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatCRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + descOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(descRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bufferSzOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bufferSzRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bufferOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bufferRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(computeTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (computeTypeAttr) result.getOrAddProperties().computeType = computeTypeAttr; + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + bufferRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = mlir::gpu::SparseSpGEMMOpHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType3 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(descOperands, odsBuildableType2, descOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatAOperands, odsBuildableType3, spmatAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatBOperands, odsBuildableType3, spmatBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatCOperands, odsBuildableType3, spmatCOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bufferSzOperands, odsBuildableType0, bufferSzOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bufferOperands, bufferTypes, bufferOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpGEMMWorkEstimationOrComputeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << "{"; +_odsPrinter.printStrippedAttrOrType(getKindAttr()); + _odsPrinter << "}"; + _odsPrinter << ' '; + _odsPrinter << getSpmatA(); + if (getModeAAttr() && getModeAAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeAAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSpmatB(); + if (getModeBAttr() && getModeBAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeBAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSpmatC(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDesc(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBufferSz(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBuffer(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("kind"); + elidedAttrs.push_back("modeA"); + elidedAttrs.push_back("modeB"); + elidedAttrs.push_back("computeType"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeAAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeA"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeBAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeB"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getComputeTypeAttr()); + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + { + auto type = getBuffer().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMWorkEstimationOrComputeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMMBufferSizeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SpMMBufferSizeOpGenericAdaptorBase::SpMMBufferSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.spmm_buffer_size", odsAttrs.getContext()); +} + +SpMMBufferSizeOpGenericAdaptorBase::SpMMBufferSizeOpGenericAdaptorBase(SpMMBufferSizeOp op) : SpMMBufferSizeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SpMMBufferSizeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SpMMBufferSizeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::TransposeModeAttr SpMMBufferSizeOpGenericAdaptorBase::getModeAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); + return attr; +} + +::mlir::gpu::TransposeMode SpMMBufferSizeOpGenericAdaptorBase::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SpMMBufferSizeOpGenericAdaptorBase::getModeBAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); + return attr; +} + +::mlir::gpu::TransposeMode SpMMBufferSizeOpGenericAdaptorBase::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpMMBufferSizeOpGenericAdaptorBase::getComputeTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); + return attr; +} + +::mlir::Type SpMMBufferSizeOpGenericAdaptorBase::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +SpMMBufferSizeOpAdaptor::SpMMBufferSizeOpAdaptor(SpMMBufferSizeOp op) : SpMMBufferSizeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SpMMBufferSizeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitError(loc, "'gpu.spmm_buffer_size' op ""requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (tblgen_modeA && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeA)))) + return emitError(loc, "'gpu.spmm_buffer_size' op ""attribute 'modeA' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_modeB && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeB)))) + return emitError(loc, "'gpu.spmm_buffer_size' op ""attribute 'modeB' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_computeType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_computeType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_computeType).getValue()))) && ((true)))) + return emitError(loc, "'gpu.spmm_buffer_size' op ""attribute 'computeType' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +void SpMMBufferSizeOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "bufferSzs"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair SpMMBufferSizeOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SpMMBufferSizeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SpMMBufferSizeOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SpMMBufferSizeOp::getSpmatA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SpMMBufferSizeOp::getDnmatB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value SpMMBufferSizeOp::getDnmatC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::MutableOperandRange SpMMBufferSizeOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SpMMBufferSizeOp::getSpmatAMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpMMBufferSizeOp::getDnmatBMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpMMBufferSizeOp::getDnmatCMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair SpMMBufferSizeOp::getODSResultIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().resultSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::result_range SpMMBufferSizeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range SpMMBufferSizeOp::getBufferSzs() { + return getODSResults(0); +} + +::mlir::Value SpMMBufferSizeOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult SpMMBufferSizeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.computeType; + auto attr = dict.get("computeType"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for computeType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `computeType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeA; + auto attr = dict.get("modeA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeB; + auto attr = dict.get("modeB"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("resultSegmentSizes"); if (!attr) attr = dict.get("result_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for resultSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.resultSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SpMMBufferSizeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.computeType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("computeType", + propStorage)); + } + + { + const auto &propStorage = prop.modeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeA", + propStorage)); + } + + { + const auto &propStorage = prop.modeB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeB", + propStorage)); + } + + { + const auto &propStorage = prop.resultSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("resultSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SpMMBufferSizeOp::computePropertiesHash(const Properties &prop) { + auto hash_resultSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.computeType.getAsOpaquePointer()), + llvm::hash_value(prop.modeA.getAsOpaquePointer()), + llvm::hash_value(prop.modeB.getAsOpaquePointer()), + hash_resultSegmentSizes(prop.resultSegmentSizes)); +} + +std::optional SpMMBufferSizeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "computeType") + return prop.computeType; + + if (name == "modeA") + return prop.modeA; + + if (name == "modeB") + return prop.modeB; + if (name == "result_segment_sizes" || name == "resultSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.resultSegmentSizes); + return std::nullopt; +} + +void SpMMBufferSizeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "computeType") { + prop.computeType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeA") { + prop.modeA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeB") { + prop.modeB = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "result_segment_sizes" || name == "resultSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.resultSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.resultSegmentSizes.begin()); + return; + } +} + +void SpMMBufferSizeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.computeType) attrs.append("computeType", prop.computeType); + + if (prop.modeA) attrs.append("modeA", prop.modeA); + + if (prop.modeB) attrs.append("modeB", prop.modeB); + attrs.append("resultSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.resultSegmentSizes)); +} + +::mlir::LogicalResult SpMMBufferSizeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getComputeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(attr, "computeType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeB", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpMMBufferSizeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.computeType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeB))) + return ::mlir::failure(); + + { + auto &propStorage = prop.resultSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SpMMBufferSizeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.computeType); + + writer.writeOptionalAttribute(prop.modeA); + + writer.writeOptionalAttribute(prop.modeB); + + { + auto &propStorage = prop.resultSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::gpu::TransposeModeAttr SpMMBufferSizeOp::getModeAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); +} + +::mlir::gpu::TransposeMode SpMMBufferSizeOp::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SpMMBufferSizeOp::getModeBAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); +} + +::mlir::gpu::TransposeMode SpMMBufferSizeOp::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpMMBufferSizeOp::getComputeTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); +} + +::mlir::Type SpMMBufferSizeOp::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void SpMMBufferSizeOp::setModeAAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeAAttrName(), attr); +} + +void SpMMBufferSizeOp::setModeA(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeAAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpMMBufferSizeOp::setModeBAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeBAttrName(), attr); +} + +void SpMMBufferSizeOp::setModeB(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeBAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpMMBufferSizeOp::setComputeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getComputeTypeAttrName(), attr); +} + +void SpMMBufferSizeOp::setComputeType(::mlir::Type attrValue) { + (*this)->setAttr(getComputeTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void SpMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type bufferSzs, Type asyncToken, ValueRange asyncDependencies, Value spmatA, Value dnmatB, Value dnmatC, Type computeType) { + auto modeA = gpu::TransposeMode::NON_TRANSPOSE; + auto modeB = gpu::TransposeMode::NON_TRANSPOSE; + return build(odsBuilder, odsState, bufferSzs, asyncToken, asyncDependencies, + modeA, modeB, spmatA, dnmatB, dnmatC, computeType); +} + +void SpMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange bufferSzs, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::TypeAttr computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(dnmatC); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.addTypes(bufferSzs); + if (asyncToken) + odsState.addTypes(asyncToken); + ::llvm::copy(::llvm::ArrayRef({static_cast(bufferSzs.size()), (asyncToken ? 1 : 0)}), odsState.getOrAddProperties().resultSegmentSizes.begin()); +} + +void SpMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::TypeAttr computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(dnmatC); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.addTypes(resultTypes); +} + +void SpMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange bufferSzs, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::Type computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(dnmatC); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.addTypes(bufferSzs); + if (asyncToken) + odsState.addTypes(asyncToken); + ::llvm::copy(::llvm::ArrayRef({static_cast(bufferSzs.size()), (asyncToken ? 1 : 0)}), odsState.getOrAddProperties().resultSegmentSizes.begin()); +} + +void SpMMBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::Type computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(dnmatC); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.addTypes(resultTypes); +} + +void SpMMBufferSizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +void SpMMBufferSizeOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.modeA) + properties.modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); + if (!properties.modeB) + properties.modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); +} + +::mlir::LogicalResult SpMMBufferSizeOp::verifyInvariantsImpl() { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitOpError("requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeA, "modeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeB, "modeB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(*this, tblgen_computeType, "computeType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpMMBufferSizeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SpMMBufferSizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand spmatARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatAOperands(spmatARawOperands); ::llvm::SMLoc spmatAOperandsLoc; + (void)spmatAOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeAAttr; + ::mlir::OpAsmParser::UnresolvedOperand dnmatBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnmatBOperands(dnmatBRawOperands); ::llvm::SMLoc dnmatBOperandsLoc; + (void)dnmatBOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeBAttr; + ::mlir::OpAsmParser::UnresolvedOperand dnmatCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnmatCOperands(dnmatCRawOperands); ::llvm::SMLoc dnmatCOperandsLoc; + (void)dnmatCOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> bufferSzsTypes; + ::mlir::TypeAttr computeTypeAttr; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + spmatAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatARawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeAAttr) result.getOrAddProperties().modeA = modeAAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + dnmatBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnmatBRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeBAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeBAttr) result.getOrAddProperties().modeB = modeBAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + dnmatCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnmatCRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(bufferSzsTypes)) + return ::mlir::failure(); + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(computeTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (computeTypeAttr) result.getOrAddProperties().computeType = computeTypeAttr; +::llvm::copy(::llvm::ArrayRef({static_cast(bufferSzsTypes.size()), static_cast(asyncTokenTypes.size())}), result.getOrAddProperties().resultSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = mlir::gpu::SparseDnTensorHandleType::get(parser.getBuilder().getContext()); + result.addTypes(bufferSzsTypes); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatAOperands, odsBuildableType1, spmatAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnmatBOperands, odsBuildableType2, dnmatBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnmatCOperands, odsBuildableType2, dnmatCOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpMMBufferSizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getSpmatA(); + if (getModeAAttr() && getModeAAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeAAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnmatB(); + if (getModeBAttr() && getModeBAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeBAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnmatC(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("resultSegmentSizes"); + elidedAttrs.push_back("modeA"); + elidedAttrs.push_back("modeB"); + elidedAttrs.push_back("computeType"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeAAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeA"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeBAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeB"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getBufferSzs().getTypes(); + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getComputeTypeAttr()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMMBufferSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMMOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SpMMOpGenericAdaptorBase::SpMMOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.spmm", odsAttrs.getContext()); +} + +SpMMOpGenericAdaptorBase::SpMMOpGenericAdaptorBase(SpMMOp op) : SpMMOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SpMMOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SpMMOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::TransposeModeAttr SpMMOpGenericAdaptorBase::getModeAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); + return attr; +} + +::mlir::gpu::TransposeMode SpMMOpGenericAdaptorBase::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SpMMOpGenericAdaptorBase::getModeBAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); + return attr; +} + +::mlir::gpu::TransposeMode SpMMOpGenericAdaptorBase::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpMMOpGenericAdaptorBase::getComputeTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); + return attr; +} + +::mlir::Type SpMMOpGenericAdaptorBase::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +SpMMOpAdaptor::SpMMOpAdaptor(SpMMOp op) : SpMMOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SpMMOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitError(loc, "'gpu.spmm' op ""requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (tblgen_modeA && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeA)))) + return emitError(loc, "'gpu.spmm' op ""attribute 'modeA' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_modeB && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeB)))) + return emitError(loc, "'gpu.spmm' op ""attribute 'modeB' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_computeType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_computeType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_computeType).getValue()))) && ((true)))) + return emitError(loc, "'gpu.spmm' op ""attribute 'computeType' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair SpMMOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SpMMOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SpMMOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SpMMOp::getSpmatA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SpMMOp::getDnmatB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value SpMMOp::getDnmatC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Operation::operand_range SpMMOp::getBuffers() { + return getODSOperands(4); +} + +::mlir::MutableOperandRange SpMMOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::OpOperand &SpMMOp::getSpmatAMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpMMOp::getDnmatBMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpMMOp::getDnmatCMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange SpMMOp::getBuffersMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair SpMMOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SpMMOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SpMMOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult SpMMOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.computeType; + auto attr = dict.get("computeType"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for computeType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `computeType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeA; + auto attr = dict.get("modeA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeB; + auto attr = dict.get("modeB"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SpMMOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.computeType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("computeType", + propStorage)); + } + + { + const auto &propStorage = prop.modeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeA", + propStorage)); + } + + { + const auto &propStorage = prop.modeB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeB", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SpMMOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.computeType.getAsOpaquePointer()), + llvm::hash_value(prop.modeA.getAsOpaquePointer()), + llvm::hash_value(prop.modeB.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SpMMOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "computeType") + return prop.computeType; + + if (name == "modeA") + return prop.modeA; + + if (name == "modeB") + return prop.modeB; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SpMMOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "computeType") { + prop.computeType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeA") { + prop.modeA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeB") { + prop.modeB = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SpMMOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.computeType) attrs.append("computeType", prop.computeType); + + if (prop.modeA) attrs.append("modeA", prop.modeA); + + if (prop.modeB) attrs.append("modeB", prop.modeB); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SpMMOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getComputeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(attr, "computeType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeB", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpMMOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.computeType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeB))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SpMMOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.computeType); + + writer.writeOptionalAttribute(prop.modeA); + + writer.writeOptionalAttribute(prop.modeB); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::gpu::TransposeModeAttr SpMMOp::getModeAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); +} + +::mlir::gpu::TransposeMode SpMMOp::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::gpu::TransposeModeAttr SpMMOp::getModeBAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeB); +} + +::mlir::gpu::TransposeMode SpMMOp::getModeB() { + auto attr = getModeBAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpMMOp::getComputeTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); +} + +::mlir::Type SpMMOp::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void SpMMOp::setModeAAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeAAttrName(), attr); +} + +void SpMMOp::setModeA(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeAAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpMMOp::setModeBAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeBAttrName(), attr); +} + +void SpMMOp::setModeB(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeBAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpMMOp::setComputeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getComputeTypeAttrName(), attr); +} + +void SpMMOp::setComputeType(::mlir::Type attrValue) { + (*this)->setAttr(getComputeTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void SpMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type asyncToken, ValueRange asyncDependencies, Value spmatA, Value dnmatB, Value dnmatC, Type computeType, ValueRange buffers) { + auto modeA = gpu::TransposeMode::NON_TRANSPOSE; + auto modeB = gpu::TransposeMode::NON_TRANSPOSE; + return build(odsBuilder, odsState, asyncToken, asyncDependencies, modeA, + modeB, spmatA, dnmatB, dnmatC, computeType, buffers); +} + +void SpMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::TypeAttr computeType, ::mlir::ValueRange buffers) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(dnmatC); + odsState.addOperands(buffers); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), 1, 1, 1, static_cast(buffers.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::TypeAttr computeType, ::mlir::ValueRange buffers) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(dnmatC); + odsState.addOperands(buffers); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), 1, 1, 1, static_cast(buffers.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + if (modeB) { + odsState.getOrAddProperties().modeB = modeB; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.addTypes(resultTypes); +} + +void SpMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::Type computeType, ::mlir::ValueRange buffers) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(dnmatC); + odsState.addOperands(buffers); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), 1, 1, 1, static_cast(buffers.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpMMOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::Type computeType, ::mlir::ValueRange buffers) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnmatB); + odsState.addOperands(dnmatC); + odsState.addOperands(buffers); + ::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependencies.size()), 1, 1, 1, static_cast(buffers.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeB); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.addTypes(resultTypes); +} + +void SpMMOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +void SpMMOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.modeA) + properties.modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); + if (!properties.modeB) + properties.modeB = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); +} + +::mlir::LogicalResult SpMMOp::verifyInvariantsImpl() { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitOpError("requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + auto tblgen_modeB = getProperties().modeB; (void)tblgen_modeB; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeA, "modeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeB, "modeB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(*this, tblgen_computeType, "computeType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpMMOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SpMMOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand spmatARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatAOperands(spmatARawOperands); ::llvm::SMLoc spmatAOperandsLoc; + (void)spmatAOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeAAttr; + ::mlir::OpAsmParser::UnresolvedOperand dnmatBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnmatBOperands(dnmatBRawOperands); ::llvm::SMLoc dnmatBOperandsLoc; + (void)dnmatBOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeBAttr; + ::mlir::OpAsmParser::UnresolvedOperand dnmatCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnmatCOperands(dnmatCRawOperands); ::llvm::SMLoc dnmatCOperandsLoc; + (void)dnmatCOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> buffersOperands; + ::llvm::SMLoc buffersOperandsLoc; + (void)buffersOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> buffersTypes; + ::mlir::TypeAttr computeTypeAttr; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + spmatAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatARawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeAAttr) result.getOrAddProperties().modeA = modeAAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + dnmatBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnmatBRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeBAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeBAttr) result.getOrAddProperties().modeB = modeBAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + dnmatCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnmatCRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + buffersOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(buffersOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(buffersTypes)) + return ::mlir::failure(); + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(computeTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (computeTypeAttr) result.getOrAddProperties().computeType = computeTypeAttr; +::llvm::copy(::llvm::ArrayRef({static_cast(asyncDependenciesOperands.size()), 1, 1, 1, static_cast(buffersOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = mlir::gpu::SparseDnTensorHandleType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatAOperands, odsBuildableType1, spmatAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnmatBOperands, odsBuildableType2, dnmatBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnmatCOperands, odsBuildableType2, dnmatCOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(buffersOperands, buffersTypes, buffersOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpMMOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getSpmatA(); + if (getModeAAttr() && getModeAAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeAAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnmatB(); + if (getModeBAttr() && getModeBAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeBAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnmatC(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBuffers(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("modeA"); + elidedAttrs.push_back("modeB"); + elidedAttrs.push_back("computeType"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeAAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeA"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeBAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeB"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getBuffers().getTypes(); + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getComputeTypeAttr()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMMOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMVBufferSizeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SpMVBufferSizeOpGenericAdaptorBase::SpMVBufferSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.spmv_buffer_size", odsAttrs.getContext()); +} + +SpMVBufferSizeOpGenericAdaptorBase::SpMVBufferSizeOpGenericAdaptorBase(SpMVBufferSizeOp op) : SpMVBufferSizeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SpMVBufferSizeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SpMVBufferSizeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::TransposeModeAttr SpMVBufferSizeOpGenericAdaptorBase::getModeAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); + return attr; +} + +::mlir::gpu::TransposeMode SpMVBufferSizeOpGenericAdaptorBase::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpMVBufferSizeOpGenericAdaptorBase::getComputeTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); + return attr; +} + +::mlir::Type SpMVBufferSizeOpGenericAdaptorBase::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +SpMVBufferSizeOpAdaptor::SpMVBufferSizeOpAdaptor(SpMVBufferSizeOp op) : SpMVBufferSizeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SpMVBufferSizeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitError(loc, "'gpu.spmv_buffer_size' op ""requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + + if (tblgen_modeA && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeA)))) + return emitError(loc, "'gpu.spmv_buffer_size' op ""attribute 'modeA' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_computeType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_computeType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_computeType).getValue()))) && ((true)))) + return emitError(loc, "'gpu.spmv_buffer_size' op ""attribute 'computeType' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +void SpMVBufferSizeOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "bufferSz"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "asyncToken"); +} + +std::pair SpMVBufferSizeOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SpMVBufferSizeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SpMVBufferSizeOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SpMVBufferSizeOp::getSpmatA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SpMVBufferSizeOp::getDnX() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value SpMVBufferSizeOp::getDnY() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::MutableOperandRange SpMVBufferSizeOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SpMVBufferSizeOp::getSpmatAMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpMVBufferSizeOp::getDnXMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpMVBufferSizeOp::getDnYMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair SpMVBufferSizeOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SpMVBufferSizeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> SpMVBufferSizeOp::getBufferSz() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +::mlir::Value SpMVBufferSizeOp::getAsyncToken() { + auto results = getODSResults(1); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult SpMVBufferSizeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.computeType; + auto attr = dict.get("computeType"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for computeType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `computeType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeA; + auto attr = dict.get("modeA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SpMVBufferSizeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.computeType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("computeType", + propStorage)); + } + + { + const auto &propStorage = prop.modeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeA", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SpMVBufferSizeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.computeType.getAsOpaquePointer()), + llvm::hash_value(prop.modeA.getAsOpaquePointer())); +} + +std::optional SpMVBufferSizeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "computeType") + return prop.computeType; + + if (name == "modeA") + return prop.modeA; + return std::nullopt; +} + +void SpMVBufferSizeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "computeType") { + prop.computeType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeA") { + prop.modeA = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SpMVBufferSizeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.computeType) attrs.append("computeType", prop.computeType); + + if (prop.modeA) attrs.append("modeA", prop.modeA); +} + +::mlir::LogicalResult SpMVBufferSizeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getComputeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(attr, "computeType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeA", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpMVBufferSizeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.computeType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeA))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpMVBufferSizeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.computeType); + + writer.writeOptionalAttribute(prop.modeA); +} + +::mlir::gpu::TransposeModeAttr SpMVBufferSizeOp::getModeAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); +} + +::mlir::gpu::TransposeMode SpMVBufferSizeOp::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpMVBufferSizeOp::getComputeTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); +} + +::mlir::Type SpMVBufferSizeOp::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void SpMVBufferSizeOp::setModeAAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeAAttrName(), attr); +} + +void SpMVBufferSizeOp::setModeA(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeAAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpMVBufferSizeOp::setComputeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getComputeTypeAttrName(), attr); +} + +void SpMVBufferSizeOp::setComputeType(::mlir::Type attrValue) { + (*this)->setAttr(getComputeTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void SpMVBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type bufferSz, Type asyncToken, ValueRange asyncDependencies, Value spmatA, Value dnX, Value dnY, Type computeType) { + auto modeA = gpu::TransposeMode::NON_TRANSPOSE; + return build(odsBuilder, odsState, bufferSz, asyncToken, asyncDependencies, + modeA, spmatA, dnX, dnY, computeType); +} + +void SpMVBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::TypeAttr computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnX); + odsState.addOperands(dnY); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.addTypes(bufferSz); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpMVBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::TypeAttr computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnX); + odsState.addOperands(dnY); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + odsState.getOrAddProperties().computeType = computeType; + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SpMVBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::Type computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnX); + odsState.addOperands(dnY); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.addTypes(bufferSz); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpMVBufferSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::Type computeType) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnX); + odsState.addOperands(dnY); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + assert(resultTypes.size() >= 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SpMVBufferSizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SpMVBufferSizeOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.modeA) + properties.modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); +} + +::mlir::LogicalResult SpMVBufferSizeOp::verifyInvariantsImpl() { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitOpError("requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeA, "modeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(*this, tblgen_computeType, "computeType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + if (valueGroup1.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpMVBufferSizeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SpMVBufferSizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand spmatARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatAOperands(spmatARawOperands); ::llvm::SMLoc spmatAOperandsLoc; + (void)spmatAOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeAAttr; + ::mlir::OpAsmParser::UnresolvedOperand dnXRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnXOperands(dnXRawOperands); ::llvm::SMLoc dnXOperandsLoc; + (void)dnXOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dnYRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnYOperands(dnYRawOperands); ::llvm::SMLoc dnYOperandsLoc; + (void)dnYOperandsLoc; + ::mlir::TypeAttr computeTypeAttr; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + spmatAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatARawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeAAttr) result.getOrAddProperties().modeA = modeAAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + dnXOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnXRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + dnYOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnYRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(computeTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (computeTypeAttr) result.getOrAddProperties().computeType = computeTypeAttr; + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType3 = mlir::gpu::SparseDnTensorHandleType::get(parser.getBuilder().getContext()); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatAOperands, odsBuildableType2, spmatAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnXOperands, odsBuildableType3, dnXOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnYOperands, odsBuildableType3, dnYOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpMVBufferSizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getSpmatA(); + if (getModeAAttr() && getModeAAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeAAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnX(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnY(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("modeA"); + elidedAttrs.push_back("computeType"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeAAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeA"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getComputeTypeAttr()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMVBufferSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMVOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SpMVOpGenericAdaptorBase::SpMVOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.spmv", odsAttrs.getContext()); +} + +SpMVOpGenericAdaptorBase::SpMVOpGenericAdaptorBase(SpMVOp op) : SpMVOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SpMVOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SpMVOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::TransposeModeAttr SpMVOpGenericAdaptorBase::getModeAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); + return attr; +} + +::mlir::gpu::TransposeMode SpMVOpGenericAdaptorBase::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpMVOpGenericAdaptorBase::getComputeTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); + return attr; +} + +::mlir::Type SpMVOpGenericAdaptorBase::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +SpMVOpAdaptor::SpMVOpAdaptor(SpMVOp op) : SpMVOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SpMVOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitError(loc, "'gpu.spmv' op ""requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + + if (tblgen_modeA && !((::llvm::isa<::mlir::gpu::TransposeModeAttr>(tblgen_modeA)))) + return emitError(loc, "'gpu.spmv' op ""attribute 'modeA' failed to satisfy constraint: transpose mode of sparse matrix supported by sparse tensor ops"); + + if (tblgen_computeType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_computeType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_computeType).getValue()))) && ((true)))) + return emitError(loc, "'gpu.spmv' op ""attribute 'computeType' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair SpMVOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false, false, false, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SpMVOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SpMVOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SpMVOp::getSpmatA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SpMVOp::getDnX() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value SpMVOp::getDnY() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> SpMVOp::getBuffer() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(4).begin()); +} + +::mlir::MutableOperandRange SpMVOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SpMVOp::getSpmatAMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpMVOp::getDnXMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpMVOp::getDnYMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SpMVOp::getBufferMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair SpMVOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SpMVOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SpMVOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult SpMVOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.computeType; + auto attr = dict.get("computeType"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for computeType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `computeType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.modeA; + auto attr = dict.get("modeA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for modeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SpMVOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.computeType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("computeType", + propStorage)); + } + + { + const auto &propStorage = prop.modeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modeA", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SpMVOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.computeType.getAsOpaquePointer()), + llvm::hash_value(prop.modeA.getAsOpaquePointer())); +} + +std::optional SpMVOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "computeType") + return prop.computeType; + + if (name == "modeA") + return prop.modeA; + return std::nullopt; +} + +void SpMVOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "computeType") { + prop.computeType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "modeA") { + prop.modeA = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SpMVOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.computeType) attrs.append("computeType", prop.computeType); + + if (prop.modeA) attrs.append("modeA", prop.modeA); +} + +::mlir::LogicalResult SpMVOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getComputeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(attr, "computeType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getModeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(attr, "modeA", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpMVOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.computeType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.modeA))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpMVOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.computeType); + + writer.writeOptionalAttribute(prop.modeA); +} + +::mlir::gpu::TransposeModeAttr SpMVOp::getModeAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(getProperties().modeA); +} + +::mlir::gpu::TransposeMode SpMVOp::getModeA() { + auto attr = getModeAAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SpMVOp::getComputeTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().computeType); +} + +::mlir::Type SpMVOp::getComputeType() { + auto attr = getComputeTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void SpMVOp::setModeAAttr(::mlir::gpu::TransposeModeAttr attr) { + (*this)->setAttr(getModeAAttrName(), attr); +} + +void SpMVOp::setModeA(::mlir::gpu::TransposeMode attrValue) { + (*this)->setAttr(getModeAAttrName(), ::mlir::gpu::TransposeModeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SpMVOp::setComputeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getComputeTypeAttrName(), attr); +} + +void SpMVOp::setComputeType(::mlir::Type attrValue) { + (*this)->setAttr(getComputeTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void SpMVOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type asyncToken, ValueRange asyncDependencies, Value spmatA, Value dnX, Value dnY, Type computeType, Value buffer) { + auto modeA = gpu::TransposeMode::NON_TRANSPOSE; + return build(odsBuilder, odsState, asyncToken, asyncDependencies, modeA, + spmatA, dnX, dnY, computeType, buffer); +} + +void SpMVOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::TypeAttr computeType, ::mlir::Value buffer) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnX); + odsState.addOperands(dnY); + odsState.addOperands(buffer); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + odsState.getOrAddProperties().computeType = computeType; + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpMVOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::TypeAttr computeType, ::mlir::Value buffer) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnX); + odsState.addOperands(dnY); + odsState.addOperands(buffer); + if (modeA) { + odsState.getOrAddProperties().modeA = modeA; + } + odsState.getOrAddProperties().computeType = computeType; + odsState.addTypes(resultTypes); +} + +void SpMVOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::Type computeType, ::mlir::Value buffer) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnX); + odsState.addOperands(dnY); + odsState.addOperands(buffer); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpMVOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::Type computeType, ::mlir::Value buffer) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmatA); + odsState.addOperands(dnX); + odsState.addOperands(dnY); + odsState.addOperands(buffer); + odsState.getOrAddProperties().modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), modeA); + odsState.getOrAddProperties().computeType = ::mlir::TypeAttr::get(computeType); + odsState.addTypes(resultTypes); +} + +void SpMVOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +void SpMVOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.modeA) + properties.modeA = ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE); +} + +::mlir::LogicalResult SpMVOp::verifyInvariantsImpl() { + auto tblgen_computeType = getProperties().computeType; (void)tblgen_computeType; + if (!tblgen_computeType) return emitOpError("requires attribute 'computeType'"); + auto tblgen_modeA = getProperties().modeA; (void)tblgen_modeA; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps11(*this, tblgen_modeA, "modeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps12(*this, tblgen_computeType, "computeType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpMVOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SpMVOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand spmatARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatAOperands(spmatARawOperands); ::llvm::SMLoc spmatAOperandsLoc; + (void)spmatAOperandsLoc; + ::mlir::gpu::TransposeModeAttr modeAAttr; + ::mlir::OpAsmParser::UnresolvedOperand dnXRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnXOperands(dnXRawOperands); ::llvm::SMLoc dnXOperandsLoc; + (void)dnXOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dnYRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dnYOperands(dnYRawOperands); ::llvm::SMLoc dnYOperandsLoc; + (void)dnYOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bufferRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bufferOperands(bufferRawOperands); ::llvm::SMLoc bufferOperandsLoc; + (void)bufferOperandsLoc; + ::mlir::Type bufferRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> bufferTypes(bufferRawTypes); + ::mlir::TypeAttr computeTypeAttr; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + spmatAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatARawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLBrace())) { + + if (parser.parseCustomAttributeWithFallback(modeAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modeAAttr) result.getOrAddProperties().modeA = modeAAttr; + if (parser.parseRBrace()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + dnXOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnXRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + dnYOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dnYRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bufferOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bufferRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + bufferRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(computeTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (computeTypeAttr) result.getOrAddProperties().computeType = computeTypeAttr; + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = mlir::gpu::SparseDnTensorHandleType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatAOperands, odsBuildableType1, spmatAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnXOperands, odsBuildableType2, dnXOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dnYOperands, odsBuildableType2, dnYOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bufferOperands, bufferTypes, bufferOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpMVOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getSpmatA(); + if (getModeAAttr() && getModeAAttr() != ::mlir::gpu::TransposeModeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), TransposeMode::NON_TRANSPOSE)) { + _odsPrinter << "{"; + _odsPrinter.printStrippedAttrOrType(getModeAAttr()); + _odsPrinter << "}"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnX(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDnY(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBuffer(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("modeA"); + elidedAttrs.push_back("computeType"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getModeAAttr(); + if(attr && (attr == ::mlir::gpu::TransposeModeAttr::get(odsBuilder.getContext(), TransposeMode::NON_TRANSPOSE))) + elidedAttrs.push_back("modeA"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBuffer().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getComputeTypeAttr()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMVOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMatGetSizeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SpMatGetSizeOpGenericAdaptorBase::SpMatGetSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.spmat_get_size", odsAttrs.getContext()); +} + +SpMatGetSizeOpGenericAdaptorBase::SpMatGetSizeOpGenericAdaptorBase(SpMatGetSizeOp op) : SpMatGetSizeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SpMatGetSizeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SpMatGetSizeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SpMatGetSizeOpAdaptor::SpMatGetSizeOpAdaptor(SpMatGetSizeOp op) : SpMatGetSizeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SpMatGetSizeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +void SpMatGetSizeOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "rows"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "cols"); + auto resultGroup2 = getODSResults(2); + if (!resultGroup2.empty()) + setNameFn(*resultGroup2.begin(), "nnz"); + auto resultGroup3 = getODSResults(3); + if (!resultGroup3.empty()) + setNameFn(*resultGroup3.begin(), "asyncToken"); +} + +std::pair SpMatGetSizeOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SpMatGetSizeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SpMatGetSizeOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::Value SpMatGetSizeOp::getSpmat() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::MutableOperandRange SpMatGetSizeOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &SpMatGetSizeOp::getSpmatMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SpMatGetSizeOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SpMatGetSizeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> SpMatGetSizeOp::getRows() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> SpMatGetSizeOp::getCols() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> SpMatGetSizeOp::getNnz() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(2).begin()); +} + +::mlir::Value SpMatGetSizeOp::getAsyncToken() { + auto results = getODSResults(3); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void SpMatGetSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rows, ::mlir::Type cols, ::mlir::Type nnz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmat); + odsState.addTypes(rows); + odsState.addTypes(cols); + odsState.addTypes(nnz); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void SpMatGetSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat) { + odsState.addOperands(asyncDependencies); + odsState.addOperands(spmat); + assert(resultTypes.size() >= 3u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SpMatGetSizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 3u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SpMatGetSizeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSResults(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSResults(3); + + if (valueGroup3.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SpMatGetSizeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SpMatGetSizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand spmatRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> spmatOperands(spmatRawOperands); ::llvm::SMLoc spmatOperandsLoc; + (void)spmatOperandsLoc; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + + spmatOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(spmatRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + ::mlir::Type odsBuildableType1 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType2 = mlir::gpu::SparseSpMatHandleType::get(parser.getBuilder().getContext()); + result.addTypes(odsBuildableType0); + result.addTypes(odsBuildableType0); + result.addTypes(odsBuildableType0); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType1, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(spmatOperands, odsBuildableType2, spmatOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SpMatGetSizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + _odsPrinter << ' '; + _odsPrinter << getSpmat(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMatGetSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupIdOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubgroupIdOpGenericAdaptorBase::SubgroupIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.subgroup_id", odsAttrs.getContext()); +} + +SubgroupIdOpGenericAdaptorBase::SubgroupIdOpGenericAdaptorBase(SubgroupIdOp op) : SubgroupIdOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubgroupIdOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubgroupIdOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SubgroupIdOpAdaptor::SubgroupIdOpAdaptor(SubgroupIdOp op) : SubgroupIdOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubgroupIdOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SubgroupIdOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubgroupIdOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SubgroupIdOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubgroupIdOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> SubgroupIdOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void SubgroupIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) { + odsState.addTypes(result); +} + +void SubgroupIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubgroupIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubgroupIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupIdOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SubgroupIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubgroupIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SubgroupIdOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupIdOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SubgroupIdOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SubgroupIdOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IndexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + return ::mlir::success(); +} + +void SubgroupIdOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IndexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubgroupIdOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaComputeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubgroupMmaComputeOpGenericAdaptorBase::SubgroupMmaComputeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.subgroup_mma_compute", odsAttrs.getContext()); +} + +SubgroupMmaComputeOpGenericAdaptorBase::SubgroupMmaComputeOpGenericAdaptorBase(SubgroupMmaComputeOp op) : SubgroupMmaComputeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubgroupMmaComputeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubgroupMmaComputeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr SubgroupMmaComputeOpGenericAdaptorBase::getATransposeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().a_transpose); + return attr; +} + +::std::optional SubgroupMmaComputeOpGenericAdaptorBase::getATranspose() { + auto attr = getATransposeAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +::mlir::UnitAttr SubgroupMmaComputeOpGenericAdaptorBase::getBTransposeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().b_transpose); + return attr; +} + +::std::optional SubgroupMmaComputeOpGenericAdaptorBase::getBTranspose() { + auto attr = getBTransposeAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +} // namespace detail +SubgroupMmaComputeOpAdaptor::SubgroupMmaComputeOpAdaptor(SubgroupMmaComputeOp op) : SubgroupMmaComputeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubgroupMmaComputeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_a_transpose = getProperties().a_transpose; (void)tblgen_a_transpose; + auto tblgen_b_transpose = getProperties().b_transpose; (void)tblgen_b_transpose; + + if (tblgen_a_transpose && !((::llvm::isa<::mlir::UnitAttr>(tblgen_a_transpose)))) + return emitError(loc, "'gpu.subgroup_mma_compute' op ""attribute 'a_transpose' failed to satisfy constraint: unit attribute"); + + if (tblgen_b_transpose && !((::llvm::isa<::mlir::UnitAttr>(tblgen_b_transpose)))) + return emitError(loc, "'gpu.subgroup_mma_compute' op ""attribute 'b_transpose' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair SubgroupMmaComputeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubgroupMmaComputeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::gpu::MMAMatrixType> SubgroupMmaComputeOp::getOpA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::gpu::MMAMatrixType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::gpu::MMAMatrixType> SubgroupMmaComputeOp::getOpB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::gpu::MMAMatrixType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::gpu::MMAMatrixType> SubgroupMmaComputeOp::getOpC() { + return ::llvm::cast<::mlir::TypedValue<::mlir::gpu::MMAMatrixType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &SubgroupMmaComputeOp::getOpAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SubgroupMmaComputeOp::getOpBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SubgroupMmaComputeOp::getOpCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair SubgroupMmaComputeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubgroupMmaComputeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubgroupMmaComputeOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SubgroupMmaComputeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.a_transpose; + auto attr = dict.get("a_transpose"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for a_transpose in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `a_transpose` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.b_transpose; + auto attr = dict.get("b_transpose"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for b_transpose in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `b_transpose` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SubgroupMmaComputeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.a_transpose; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("a_transpose", + propStorage)); + } + + { + const auto &propStorage = prop.b_transpose; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("b_transpose", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubgroupMmaComputeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.a_transpose.getAsOpaquePointer()), + llvm::hash_value(prop.b_transpose.getAsOpaquePointer())); +} + +std::optional SubgroupMmaComputeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "a_transpose") + return prop.a_transpose; + + if (name == "b_transpose") + return prop.b_transpose; + return std::nullopt; +} + +void SubgroupMmaComputeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "a_transpose") { + prop.a_transpose = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "b_transpose") { + prop.b_transpose = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SubgroupMmaComputeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.a_transpose) attrs.append("a_transpose", prop.a_transpose); + + if (prop.b_transpose) attrs.append("b_transpose", prop.b_transpose); +} + +::mlir::LogicalResult SubgroupMmaComputeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getATransposeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(attr, "a_transpose", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getBTransposeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(attr, "b_transpose", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupMmaComputeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.a_transpose))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.b_transpose))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupMmaComputeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.a_transpose); + + writer.writeOptionalAttribute(prop.b_transpose); +} + +::mlir::UnitAttr SubgroupMmaComputeOp::getATransposeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().a_transpose); +} + +::std::optional SubgroupMmaComputeOp::getATranspose() { + auto attr = getATransposeAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +::mlir::UnitAttr SubgroupMmaComputeOp::getBTransposeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().b_transpose); +} + +::std::optional SubgroupMmaComputeOp::getBTranspose() { + auto attr = getBTransposeAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +void SubgroupMmaComputeOp::setATransposeAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getATransposeAttrName(), attr); +} + +void SubgroupMmaComputeOp::setATranspose(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getATransposeAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getATransposeAttrName()); +} + +void SubgroupMmaComputeOp::setBTransposeAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getBTransposeAttrName(), attr); +} + +void SubgroupMmaComputeOp::setBTranspose(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getBTransposeAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getBTransposeAttrName()); +} + +::mlir::Attribute SubgroupMmaComputeOp::removeATransposeAttr() { + auto &attr = getProperties().a_transpose; + attr = {}; + return attr; +} + +::mlir::Attribute SubgroupMmaComputeOp::removeBTransposeAttr() { + auto &attr = getProperties().b_transpose; + attr = {}; + return attr; +} + +void SubgroupMmaComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value opA, ::mlir::Value opB, ::mlir::Value opC, /*optional*/::mlir::UnitAttr a_transpose, /*optional*/::mlir::UnitAttr b_transpose) { + odsState.addOperands(opA); + odsState.addOperands(opB); + odsState.addOperands(opC); + if (a_transpose) { + odsState.getOrAddProperties().a_transpose = a_transpose; + } + if (b_transpose) { + odsState.getOrAddProperties().b_transpose = b_transpose; + } + odsState.addTypes(res); +} + +void SubgroupMmaComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value opA, ::mlir::Value opB, ::mlir::Value opC, /*optional*/::mlir::UnitAttr a_transpose, /*optional*/::mlir::UnitAttr b_transpose) { + odsState.addOperands(opA); + odsState.addOperands(opB); + odsState.addOperands(opC); + if (a_transpose) { + odsState.getOrAddProperties().a_transpose = a_transpose; + } + if (b_transpose) { + odsState.getOrAddProperties().b_transpose = b_transpose; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubgroupMmaComputeOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubgroupMmaComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value opA, ::mlir::Value opB, ::mlir::Value opC, /*optional*/::mlir::UnitAttr a_transpose, /*optional*/::mlir::UnitAttr b_transpose) { + odsState.addOperands(opA); + odsState.addOperands(opB); + odsState.addOperands(opC); + if (a_transpose) { + odsState.getOrAddProperties().a_transpose = a_transpose; + } + if (b_transpose) { + odsState.getOrAddProperties().b_transpose = b_transpose; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupMmaComputeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SubgroupMmaComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubgroupMmaComputeOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SubgroupMmaComputeOp::verifyInvariantsImpl() { + auto tblgen_a_transpose = getProperties().a_transpose; (void)tblgen_a_transpose; + auto tblgen_b_transpose = getProperties().b_transpose; (void)tblgen_b_transpose; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(*this, tblgen_a_transpose, "a_transpose"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(*this, tblgen_b_transpose, "b_transpose"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps13(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps13(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps15(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType())))) + return emitOpError("failed to verify that all of {opC, res} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupMmaComputeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult SubgroupMmaComputeOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[2].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SubgroupMmaComputeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand opARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> opAOperands(opARawOperands); ::llvm::SMLoc opAOperandsLoc; + (void)opAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand opBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> opBOperands(opBRawOperands); ::llvm::SMLoc opBOperandsLoc; + (void)opBOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand opCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> opCOperands(opCRawOperands); ::llvm::SMLoc opCOperandsLoc; + (void)opCOperandsLoc; + ::mlir::Type opARawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> opATypes(opARawTypes); + ::mlir::Type opBRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> opBTypes(opBRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + opAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(opARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + opBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(opBRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + opCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(opCRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::gpu::MMAMatrixType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + opARawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::gpu::MMAMatrixType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + opBRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(opAOperands, opATypes, opAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(opBOperands, opBTypes, opBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(opCOperands, resTypes[0], opCOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupMmaComputeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOpA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getOpB(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getOpC(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOpA().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::gpu::MMAMatrixType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getOpB().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::gpu::MMAMatrixType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubgroupMmaComputeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaComputeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaConstantMatrixOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubgroupMmaConstantMatrixOpGenericAdaptorBase::SubgroupMmaConstantMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.subgroup_mma_constant_matrix", odsAttrs.getContext()); +} + +SubgroupMmaConstantMatrixOpGenericAdaptorBase::SubgroupMmaConstantMatrixOpGenericAdaptorBase(SubgroupMmaConstantMatrixOp op) : SubgroupMmaConstantMatrixOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubgroupMmaConstantMatrixOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubgroupMmaConstantMatrixOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SubgroupMmaConstantMatrixOpAdaptor::SubgroupMmaConstantMatrixOpAdaptor(SubgroupMmaConstantMatrixOp op) : SubgroupMmaConstantMatrixOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubgroupMmaConstantMatrixOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SubgroupMmaConstantMatrixOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubgroupMmaConstantMatrixOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubgroupMmaConstantMatrixOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SubgroupMmaConstantMatrixOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SubgroupMmaConstantMatrixOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubgroupMmaConstantMatrixOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubgroupMmaConstantMatrixOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SubgroupMmaConstantMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value value) { + odsState.addOperands(value); + odsState.addTypes(res); +} + +void SubgroupMmaConstantMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) { + odsState.addOperands(value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupMmaConstantMatrixOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SubgroupMmaConstantMatrixOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps15(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSResults(0).begin()).getType()).getElementType(), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that value type matches element type of mma_matrix"); + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupMmaConstantMatrixOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SubgroupMmaConstantMatrixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + for (::mlir::Type type : resTypes) { + (void)type; + if (!((::llvm::isa<::mlir::gpu::MMAMatrixType>(type)))) { + return parser.emitError(parser.getNameLoc()) << "'res' must be MMAMatrix type, but got " << type; + } + } + result.addTypes(resTypes); + if (parser.resolveOperands(valueOperands, ::llvm::cast(resTypes[0]).getElementType(), valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupMmaConstantMatrixOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubgroupMmaConstantMatrixOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaConstantMatrixOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaElementwiseOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubgroupMmaElementwiseOpGenericAdaptorBase::SubgroupMmaElementwiseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.subgroup_mma_elementwise", odsAttrs.getContext()); +} + +SubgroupMmaElementwiseOpGenericAdaptorBase::SubgroupMmaElementwiseOpGenericAdaptorBase(SubgroupMmaElementwiseOp op) : SubgroupMmaElementwiseOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubgroupMmaElementwiseOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SubgroupMmaElementwiseOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::MMAElementwiseOpAttr SubgroupMmaElementwiseOpGenericAdaptorBase::getOpTypeAttr() { + auto attr = ::llvm::cast<::mlir::gpu::MMAElementwiseOpAttr>(getProperties().opType); + return attr; +} + +::mlir::gpu::MMAElementwiseOp SubgroupMmaElementwiseOpGenericAdaptorBase::getOpType() { + auto attr = getOpTypeAttr(); + return attr.getValue(); +} + +} // namespace detail +SubgroupMmaElementwiseOpAdaptor::SubgroupMmaElementwiseOpAdaptor(SubgroupMmaElementwiseOp op) : SubgroupMmaElementwiseOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubgroupMmaElementwiseOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_opType = getProperties().opType; (void)tblgen_opType; + if (!tblgen_opType) return emitError(loc, "'gpu.subgroup_mma_elementwise' op ""requires attribute 'opType'"); + + if (tblgen_opType && !((::llvm::isa<::mlir::gpu::MMAElementwiseOpAttr>(tblgen_opType)))) + return emitError(loc, "'gpu.subgroup_mma_elementwise' op ""attribute 'opType' failed to satisfy constraint: elementwise operation to apply to mma matrix"); + return ::mlir::success(); +} + +std::pair SubgroupMmaElementwiseOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SubgroupMmaElementwiseOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SubgroupMmaElementwiseOp::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange SubgroupMmaElementwiseOp::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair SubgroupMmaElementwiseOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubgroupMmaElementwiseOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubgroupMmaElementwiseOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SubgroupMmaElementwiseOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.opType; + auto attr = dict.get("opType"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for opType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `opType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SubgroupMmaElementwiseOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.opType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("opType", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubgroupMmaElementwiseOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.opType.getAsOpaquePointer())); +} + +std::optional SubgroupMmaElementwiseOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "opType") + return prop.opType; + return std::nullopt; +} + +void SubgroupMmaElementwiseOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "opType") { + prop.opType = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SubgroupMmaElementwiseOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.opType) attrs.append("opType", prop.opType); +} + +::mlir::LogicalResult SubgroupMmaElementwiseOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getOpTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps15(attr, "opType", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupMmaElementwiseOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.opType))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupMmaElementwiseOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.opType); +} + +::mlir::gpu::MMAElementwiseOpAttr SubgroupMmaElementwiseOp::getOpTypeAttr() { + return ::llvm::cast<::mlir::gpu::MMAElementwiseOpAttr>(getProperties().opType); +} + +::mlir::gpu::MMAElementwiseOp SubgroupMmaElementwiseOp::getOpType() { + auto attr = getOpTypeAttr(); + return attr.getValue(); +} + +void SubgroupMmaElementwiseOp::setOpTypeAttr(::mlir::gpu::MMAElementwiseOpAttr attr) { + (*this)->setAttr(getOpTypeAttrName(), attr); +} + +void SubgroupMmaElementwiseOp::setOpType(::mlir::gpu::MMAElementwiseOp attrValue) { + (*this)->setAttr(getOpTypeAttrName(), ::mlir::gpu::MMAElementwiseOpAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SubgroupMmaElementwiseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args, ::mlir::gpu::MMAElementwiseOpAttr opType) { + odsState.addOperands(args); + odsState.getOrAddProperties().opType = opType; + odsState.addTypes(res); +} + +void SubgroupMmaElementwiseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::gpu::MMAElementwiseOpAttr opType) { + odsState.addOperands(args); + odsState.getOrAddProperties().opType = opType; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupMmaElementwiseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args, ::mlir::gpu::MMAElementwiseOp opType) { + odsState.addOperands(args); + odsState.getOrAddProperties().opType = ::mlir::gpu::MMAElementwiseOpAttr::get(odsBuilder.getContext(), opType); + odsState.addTypes(res); +} + +void SubgroupMmaElementwiseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::gpu::MMAElementwiseOp opType) { + odsState.addOperands(args); + odsState.getOrAddProperties().opType = ::mlir::gpu::MMAElementwiseOpAttr::get(odsBuilder.getContext(), opType); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupMmaElementwiseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SubgroupMmaElementwiseOp::verifyInvariantsImpl() { + auto tblgen_opType = getProperties().opType; (void)tblgen_opType; + if (!tblgen_opType) return emitOpError("requires attribute 'opType'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps15(*this, tblgen_opType, "opType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps15(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((true))) + return emitOpError("failed to verify that all of {args} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupMmaElementwiseOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SubgroupMmaElementwiseOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::gpu::MMAElementwiseOpAttr opTypeAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + if (parser.parseCustomAttributeWithFallback(opTypeAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (opTypeAttr) result.getOrAddProperties().opType = opTypeAttr; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupMmaElementwiseOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getOpTypeAttr()); + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("opType"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +void SubgroupMmaElementwiseOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaElementwiseOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaLoadMatrixOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubgroupMmaLoadMatrixOpGenericAdaptorBase::SubgroupMmaLoadMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.subgroup_mma_load_matrix", odsAttrs.getContext()); +} + +SubgroupMmaLoadMatrixOpGenericAdaptorBase::SubgroupMmaLoadMatrixOpGenericAdaptorBase(SubgroupMmaLoadMatrixOp op) : SubgroupMmaLoadMatrixOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubgroupMmaLoadMatrixOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SubgroupMmaLoadMatrixOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr SubgroupMmaLoadMatrixOpGenericAdaptorBase::getLeadDimensionAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().leadDimension); + return attr; +} + +::llvm::APInt SubgroupMmaLoadMatrixOpGenericAdaptorBase::getLeadDimension() { + auto attr = getLeadDimensionAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr SubgroupMmaLoadMatrixOpGenericAdaptorBase::getTransposeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().transpose); + return attr; +} + +::std::optional SubgroupMmaLoadMatrixOpGenericAdaptorBase::getTranspose() { + auto attr = getTransposeAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +} // namespace detail +SubgroupMmaLoadMatrixOpAdaptor::SubgroupMmaLoadMatrixOpAdaptor(SubgroupMmaLoadMatrixOp op) : SubgroupMmaLoadMatrixOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubgroupMmaLoadMatrixOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_leadDimension = getProperties().leadDimension; (void)tblgen_leadDimension; + if (!tblgen_leadDimension) return emitError(loc, "'gpu.subgroup_mma_load_matrix' op ""requires attribute 'leadDimension'"); + auto tblgen_transpose = getProperties().transpose; (void)tblgen_transpose; + + if (tblgen_leadDimension && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_leadDimension))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(tblgen_leadDimension).getType()))))) + return emitError(loc, "'gpu.subgroup_mma_load_matrix' op ""attribute 'leadDimension' failed to satisfy constraint: index attribute"); + + if (tblgen_transpose && !((::llvm::isa<::mlir::UnitAttr>(tblgen_transpose)))) + return emitError(loc, "'gpu.subgroup_mma_load_matrix' op ""attribute 'transpose' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair SubgroupMmaLoadMatrixOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SubgroupMmaLoadMatrixOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> SubgroupMmaLoadMatrixOp::getSrcMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range SubgroupMmaLoadMatrixOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &SubgroupMmaLoadMatrixOp::getSrcMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange SubgroupMmaLoadMatrixOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair SubgroupMmaLoadMatrixOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubgroupMmaLoadMatrixOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubgroupMmaLoadMatrixOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SubgroupMmaLoadMatrixOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.leadDimension; + auto attr = dict.get("leadDimension"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for leadDimension in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `leadDimension` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.transpose; + auto attr = dict.get("transpose"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for transpose in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `transpose` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SubgroupMmaLoadMatrixOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.leadDimension; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("leadDimension", + propStorage)); + } + + { + const auto &propStorage = prop.transpose; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("transpose", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubgroupMmaLoadMatrixOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.leadDimension.getAsOpaquePointer()), + llvm::hash_value(prop.transpose.getAsOpaquePointer())); +} + +std::optional SubgroupMmaLoadMatrixOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "leadDimension") + return prop.leadDimension; + + if (name == "transpose") + return prop.transpose; + return std::nullopt; +} + +void SubgroupMmaLoadMatrixOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "leadDimension") { + prop.leadDimension = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "transpose") { + prop.transpose = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SubgroupMmaLoadMatrixOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.leadDimension) attrs.append("leadDimension", prop.leadDimension); + + if (prop.transpose) attrs.append("transpose", prop.transpose); +} + +::mlir::LogicalResult SubgroupMmaLoadMatrixOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLeadDimensionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps16(attr, "leadDimension", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTransposeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(attr, "transpose", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupMmaLoadMatrixOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.leadDimension))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.transpose))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupMmaLoadMatrixOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.leadDimension); + + writer.writeOptionalAttribute(prop.transpose); +} + +::mlir::IntegerAttr SubgroupMmaLoadMatrixOp::getLeadDimensionAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().leadDimension); +} + +::llvm::APInt SubgroupMmaLoadMatrixOp::getLeadDimension() { + auto attr = getLeadDimensionAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr SubgroupMmaLoadMatrixOp::getTransposeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().transpose); +} + +::std::optional SubgroupMmaLoadMatrixOp::getTranspose() { + auto attr = getTransposeAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +void SubgroupMmaLoadMatrixOp::setLeadDimensionAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getLeadDimensionAttrName(), attr); +} + +void SubgroupMmaLoadMatrixOp::setLeadDimension(::llvm::APInt attrValue) { + (*this)->setAttr(getLeadDimensionAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIndexType(), attrValue)); +} + +void SubgroupMmaLoadMatrixOp::setTransposeAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getTransposeAttrName(), attr); +} + +void SubgroupMmaLoadMatrixOp::setTranspose(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getTransposeAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getTransposeAttrName()); +} + +::mlir::Attribute SubgroupMmaLoadMatrixOp::removeTransposeAttr() { + auto &attr = getProperties().transpose; + attr = {}; + return attr; +} + +void SubgroupMmaLoadMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::mlir::IntegerAttr leadDimension, /*optional*/::mlir::UnitAttr transpose) { + odsState.addOperands(srcMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().leadDimension = leadDimension; + if (transpose) { + odsState.getOrAddProperties().transpose = transpose; + } + odsState.addTypes(res); +} + +void SubgroupMmaLoadMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::mlir::IntegerAttr leadDimension, /*optional*/::mlir::UnitAttr transpose) { + odsState.addOperands(srcMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().leadDimension = leadDimension; + if (transpose) { + odsState.getOrAddProperties().transpose = transpose; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupMmaLoadMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::llvm::APInt leadDimension, /*optional*/::mlir::UnitAttr transpose) { + odsState.addOperands(srcMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().leadDimension = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), leadDimension); + if (transpose) { + odsState.getOrAddProperties().transpose = transpose; + } + odsState.addTypes(res); +} + +void SubgroupMmaLoadMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::llvm::APInt leadDimension, /*optional*/::mlir::UnitAttr transpose) { + odsState.addOperands(srcMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().leadDimension = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), leadDimension); + if (transpose) { + odsState.getOrAddProperties().transpose = transpose; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupMmaLoadMatrixOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SubgroupMmaLoadMatrixOp::verifyInvariantsImpl() { + auto tblgen_leadDimension = getProperties().leadDimension; (void)tblgen_leadDimension; + if (!tblgen_leadDimension) return emitOpError("requires attribute 'leadDimension'"); + auto tblgen_transpose = getProperties().transpose; (void)tblgen_transpose; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps16(*this, tblgen_leadDimension, "leadDimension"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(*this, tblgen_transpose, "transpose"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps17(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps15(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupMmaLoadMatrixOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SubgroupMmaLoadMatrixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcMemrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcMemrefOperands(srcMemrefRawOperands); ::llvm::SMLoc srcMemrefOperandsLoc; + (void)srcMemrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::Type srcMemrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcMemrefTypes(srcMemrefRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + srcMemrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcMemrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcMemrefRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resTypes); + if (parser.resolveOperands(srcMemrefOperands, srcMemrefTypes, srcMemrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupMmaLoadMatrixOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrcMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrcMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubgroupMmaLoadMatrixOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaLoadMatrixOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaStoreMatrixOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubgroupMmaStoreMatrixOpGenericAdaptorBase::SubgroupMmaStoreMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.subgroup_mma_store_matrix", odsAttrs.getContext()); +} + +SubgroupMmaStoreMatrixOpGenericAdaptorBase::SubgroupMmaStoreMatrixOpGenericAdaptorBase(SubgroupMmaStoreMatrixOp op) : SubgroupMmaStoreMatrixOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubgroupMmaStoreMatrixOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr SubgroupMmaStoreMatrixOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr SubgroupMmaStoreMatrixOpGenericAdaptorBase::getLeadDimensionAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().leadDimension); + return attr; +} + +::llvm::APInt SubgroupMmaStoreMatrixOpGenericAdaptorBase::getLeadDimension() { + auto attr = getLeadDimensionAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr SubgroupMmaStoreMatrixOpGenericAdaptorBase::getTransposeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().transpose); + return attr; +} + +::std::optional SubgroupMmaStoreMatrixOpGenericAdaptorBase::getTranspose() { + auto attr = getTransposeAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +} // namespace detail +SubgroupMmaStoreMatrixOpAdaptor::SubgroupMmaStoreMatrixOpAdaptor(SubgroupMmaStoreMatrixOp op) : SubgroupMmaStoreMatrixOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubgroupMmaStoreMatrixOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_leadDimension = getProperties().leadDimension; (void)tblgen_leadDimension; + if (!tblgen_leadDimension) return emitError(loc, "'gpu.subgroup_mma_store_matrix' op ""requires attribute 'leadDimension'"); + auto tblgen_transpose = getProperties().transpose; (void)tblgen_transpose; + + if (tblgen_leadDimension && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_leadDimension))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(tblgen_leadDimension).getType()))))) + return emitError(loc, "'gpu.subgroup_mma_store_matrix' op ""attribute 'leadDimension' failed to satisfy constraint: index attribute"); + + if (tblgen_transpose && !((::llvm::isa<::mlir::UnitAttr>(tblgen_transpose)))) + return emitError(loc, "'gpu.subgroup_mma_store_matrix' op ""attribute 'transpose' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair SubgroupMmaStoreMatrixOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range SubgroupMmaStoreMatrixOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::gpu::MMAMatrixType> SubgroupMmaStoreMatrixOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::gpu::MMAMatrixType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> SubgroupMmaStoreMatrixOp::getDstMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range SubgroupMmaStoreMatrixOp::getIndices() { + return getODSOperands(2); +} + +::mlir::OpOperand &SubgroupMmaStoreMatrixOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SubgroupMmaStoreMatrixOp::getDstMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange SubgroupMmaStoreMatrixOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair SubgroupMmaStoreMatrixOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubgroupMmaStoreMatrixOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult SubgroupMmaStoreMatrixOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.leadDimension; + auto attr = dict.get("leadDimension"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for leadDimension in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `leadDimension` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.transpose; + auto attr = dict.get("transpose"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for transpose in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `transpose` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SubgroupMmaStoreMatrixOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.leadDimension; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("leadDimension", + propStorage)); + } + + { + const auto &propStorage = prop.transpose; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("transpose", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubgroupMmaStoreMatrixOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.leadDimension.getAsOpaquePointer()), + llvm::hash_value(prop.transpose.getAsOpaquePointer())); +} + +std::optional SubgroupMmaStoreMatrixOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "leadDimension") + return prop.leadDimension; + + if (name == "transpose") + return prop.transpose; + return std::nullopt; +} + +void SubgroupMmaStoreMatrixOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "leadDimension") { + prop.leadDimension = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "transpose") { + prop.transpose = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SubgroupMmaStoreMatrixOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.leadDimension) attrs.append("leadDimension", prop.leadDimension); + + if (prop.transpose) attrs.append("transpose", prop.transpose); +} + +::mlir::LogicalResult SubgroupMmaStoreMatrixOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLeadDimensionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps16(attr, "leadDimension", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTransposeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(attr, "transpose", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupMmaStoreMatrixOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.leadDimension))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.transpose))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupMmaStoreMatrixOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.leadDimension); + + writer.writeOptionalAttribute(prop.transpose); +} + +::mlir::IntegerAttr SubgroupMmaStoreMatrixOp::getLeadDimensionAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().leadDimension); +} + +::llvm::APInt SubgroupMmaStoreMatrixOp::getLeadDimension() { + auto attr = getLeadDimensionAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr SubgroupMmaStoreMatrixOp::getTransposeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().transpose); +} + +::std::optional SubgroupMmaStoreMatrixOp::getTranspose() { + auto attr = getTransposeAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +void SubgroupMmaStoreMatrixOp::setLeadDimensionAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getLeadDimensionAttrName(), attr); +} + +void SubgroupMmaStoreMatrixOp::setLeadDimension(::llvm::APInt attrValue) { + (*this)->setAttr(getLeadDimensionAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIndexType(), attrValue)); +} + +void SubgroupMmaStoreMatrixOp::setTransposeAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getTransposeAttrName(), attr); +} + +void SubgroupMmaStoreMatrixOp::setTranspose(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getTransposeAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getTransposeAttrName()); +} + +::mlir::Attribute SubgroupMmaStoreMatrixOp::removeTransposeAttr() { + auto &attr = getProperties().transpose; + attr = {}; + return attr; +} + +void SubgroupMmaStoreMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::Value dstMemref, ::mlir::ValueRange indices, ::mlir::IntegerAttr leadDimension, /*optional*/::mlir::UnitAttr transpose) { + odsState.addOperands(src); + odsState.addOperands(dstMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().leadDimension = leadDimension; + if (transpose) { + odsState.getOrAddProperties().transpose = transpose; + } +} + +void SubgroupMmaStoreMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value dstMemref, ::mlir::ValueRange indices, ::mlir::IntegerAttr leadDimension, /*optional*/::mlir::UnitAttr transpose) { + odsState.addOperands(src); + odsState.addOperands(dstMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().leadDimension = leadDimension; + if (transpose) { + odsState.getOrAddProperties().transpose = transpose; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupMmaStoreMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::Value dstMemref, ::mlir::ValueRange indices, ::llvm::APInt leadDimension, /*optional*/::mlir::UnitAttr transpose) { + odsState.addOperands(src); + odsState.addOperands(dstMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().leadDimension = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), leadDimension); + if (transpose) { + odsState.getOrAddProperties().transpose = transpose; + } +} + +void SubgroupMmaStoreMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value dstMemref, ::mlir::ValueRange indices, ::llvm::APInt leadDimension, /*optional*/::mlir::UnitAttr transpose) { + odsState.addOperands(src); + odsState.addOperands(dstMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().leadDimension = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), leadDimension); + if (transpose) { + odsState.getOrAddProperties().transpose = transpose; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupMmaStoreMatrixOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SubgroupMmaStoreMatrixOp::verifyInvariantsImpl() { + auto tblgen_leadDimension = getProperties().leadDimension; (void)tblgen_leadDimension; + if (!tblgen_leadDimension) return emitOpError("requires attribute 'leadDimension'"); + auto tblgen_transpose = getProperties().transpose; (void)tblgen_transpose; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps16(*this, tblgen_leadDimension, "leadDimension"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(*this, tblgen_transpose, "transpose"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps18(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps17(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupMmaStoreMatrixOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SubgroupMmaStoreMatrixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(srcRawOperands); ::llvm::SMLoc srcOperandsLoc; + (void)srcOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dstMemrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstMemrefOperands(dstMemrefRawOperands); ::llvm::SMLoc dstMemrefOperandsLoc; + (void)dstMemrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::Type srcRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcTypes(srcRawTypes); + ::mlir::Type dstMemrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstMemrefTypes(dstMemrefRawTypes); + + srcOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + dstMemrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstMemrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::gpu::MMAMatrixType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstMemrefRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dstMemrefOperands, dstMemrefTypes, dstMemrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupMmaStoreMatrixOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrc(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDstMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::gpu::MMAMatrixType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getDstMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubgroupMmaStoreMatrixOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaStoreMatrixOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupReduceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubgroupReduceOpGenericAdaptorBase::SubgroupReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.subgroup_reduce", odsAttrs.getContext()); +} + +SubgroupReduceOpGenericAdaptorBase::SubgroupReduceOpGenericAdaptorBase(SubgroupReduceOp op) : SubgroupReduceOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubgroupReduceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubgroupReduceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::AllReduceOperationAttr SubgroupReduceOpGenericAdaptorBase::getOpAttr() { + auto attr = ::llvm::cast<::mlir::gpu::AllReduceOperationAttr>(getProperties().op); + return attr; +} + +::mlir::gpu::AllReduceOperation SubgroupReduceOpGenericAdaptorBase::getOp() { + auto attr = getOpAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr SubgroupReduceOpGenericAdaptorBase::getUniformAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().uniform); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool SubgroupReduceOpGenericAdaptorBase::getUniform() { + auto attr = getUniformAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +SubgroupReduceOpAdaptor::SubgroupReduceOpAdaptor(SubgroupReduceOp op) : SubgroupReduceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubgroupReduceOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_op = getProperties().op; (void)tblgen_op; + if (!tblgen_op) return emitError(loc, "'gpu.subgroup_reduce' op ""requires attribute 'op'"); + auto tblgen_uniform = getProperties().uniform; (void)tblgen_uniform; + + if (tblgen_op && !((::llvm::isa<::mlir::gpu::AllReduceOperationAttr>(tblgen_op)))) + return emitError(loc, "'gpu.subgroup_reduce' op ""attribute 'op' failed to satisfy constraint: built-in reduction operations supported by gpu.allreduce."); + + if (tblgen_uniform && !((::llvm::isa<::mlir::UnitAttr>(tblgen_uniform)))) + return emitError(loc, "'gpu.subgroup_reduce' op ""attribute 'uniform' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair SubgroupReduceOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubgroupReduceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubgroupReduceOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SubgroupReduceOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SubgroupReduceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubgroupReduceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult SubgroupReduceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.op; + auto attr = dict.get("op"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for op in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `op` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.uniform; + auto attr = dict.get("uniform"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for uniform in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `uniform` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SubgroupReduceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.op; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("op", + propStorage)); + } + + { + const auto &propStorage = prop.uniform; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("uniform", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubgroupReduceOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.op.getAsOpaquePointer()), + llvm::hash_value(prop.uniform.getAsOpaquePointer())); +} + +std::optional SubgroupReduceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "op") + return prop.op; + + if (name == "uniform") + return prop.uniform; + return std::nullopt; +} + +void SubgroupReduceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "op") { + prop.op = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "uniform") { + prop.uniform = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SubgroupReduceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.op) attrs.append("op", prop.op); + + if (prop.uniform) attrs.append("uniform", prop.uniform); +} + +::mlir::LogicalResult SubgroupReduceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getOpAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps0(attr, "op", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUniformAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(attr, "uniform", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupReduceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.op))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.uniform))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupReduceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.op); + + writer.writeOptionalAttribute(prop.uniform); +} + +::mlir::gpu::AllReduceOperationAttr SubgroupReduceOp::getOpAttr() { + return ::llvm::cast<::mlir::gpu::AllReduceOperationAttr>(getProperties().op); +} + +::mlir::gpu::AllReduceOperation SubgroupReduceOp::getOp() { + auto attr = getOpAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr SubgroupReduceOp::getUniformAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().uniform); +} + +bool SubgroupReduceOp::getUniform() { + auto attr = getUniformAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void SubgroupReduceOp::setOpAttr(::mlir::gpu::AllReduceOperationAttr attr) { + (*this)->setAttr(getOpAttrName(), attr); +} + +void SubgroupReduceOp::setOp(::mlir::gpu::AllReduceOperation attrValue) { + (*this)->setAttr(getOpAttrName(), ::mlir::gpu::AllReduceOperationAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SubgroupReduceOp::setUniformAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getUniformAttrName(), attr); +} + +void SubgroupReduceOp::setUniform(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getUniformAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getUniformAttrName()); +} + +::mlir::Attribute SubgroupReduceOp::removeUniformAttr() { + auto &attr = getProperties().uniform; + attr = {}; + return attr; +} + +void SubgroupReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value value, ::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform) { + odsState.addOperands(value); + odsState.getOrAddProperties().op = op; + if (uniform) { + odsState.getOrAddProperties().uniform = uniform; + } + odsState.addTypes(resultType0); +} + +void SubgroupReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform) { + odsState.addOperands(value); + odsState.getOrAddProperties().op = op; + if (uniform) { + odsState.getOrAddProperties().uniform = uniform; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubgroupReduceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubgroupReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform) { + odsState.addOperands(value); + odsState.getOrAddProperties().op = op; + if (uniform) { + odsState.getOrAddProperties().uniform = uniform; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value value, ::mlir::gpu::AllReduceOperation op, /*optional*/bool uniform) { + odsState.addOperands(value); + odsState.getOrAddProperties().op = ::mlir::gpu::AllReduceOperationAttr::get(odsBuilder.getContext(), op); + if (uniform) { + odsState.getOrAddProperties().uniform = ((uniform) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(resultType0); +} + +void SubgroupReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::gpu::AllReduceOperation op, /*optional*/bool uniform) { + odsState.addOperands(value); + odsState.getOrAddProperties().op = ::mlir::gpu::AllReduceOperationAttr::get(odsBuilder.getContext(), op); + if (uniform) { + odsState.getOrAddProperties().uniform = ((uniform) ? odsBuilder.getUnitAttr() : nullptr); + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubgroupReduceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubgroupReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::gpu::AllReduceOperation op, /*optional*/bool uniform) { + odsState.addOperands(value); + odsState.getOrAddProperties().op = ::mlir::gpu::AllReduceOperationAttr::get(odsBuilder.getContext(), op); + if (uniform) { + odsState.getOrAddProperties().uniform = ((uniform) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupReduceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SubgroupReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubgroupReduceOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SubgroupReduceOp::verifyInvariantsImpl() { + auto tblgen_op = getProperties().op; (void)tblgen_op; + if (!tblgen_op) return emitOpError("requires attribute 'op'"); + auto tblgen_uniform = getProperties().uniform; (void)tblgen_uniform; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps0(*this, tblgen_op, "op"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps1(*this, tblgen_uniform, "uniform"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupReduceOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult SubgroupReduceOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SubgroupReduceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::gpu::AllReduceOperationAttr opAttr; + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + { + auto odsResult = parseAllReduceOperation(parser, opAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().op = opAttr; + } + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("uniform"))) { + result.getOrAddProperties().uniform = parser.getBuilder().getUnitAttr(); } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(valueOperands, allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgroupReduceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAllReduceOperation(_odsPrinter, *this, getOpAttr()); + _odsPrinter << ' '; + _odsPrinter << getValue(); + if (getUniformAttr()) { + _odsPrinter << ' ' << "uniform"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("op"); + elidedAttrs.push_back("uniform"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getUniformAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("uniform"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupReduceOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupSizeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubgroupSizeOpGenericAdaptorBase::SubgroupSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.subgroup_size", odsAttrs.getContext()); +} + +SubgroupSizeOpGenericAdaptorBase::SubgroupSizeOpGenericAdaptorBase(SubgroupSizeOp op) : SubgroupSizeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubgroupSizeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubgroupSizeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SubgroupSizeOpAdaptor::SubgroupSizeOpAdaptor(SubgroupSizeOp op) : SubgroupSizeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubgroupSizeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SubgroupSizeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubgroupSizeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SubgroupSizeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubgroupSizeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> SubgroupSizeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void SubgroupSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) { + odsState.addTypes(result); +} + +void SubgroupSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubgroupSizeOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubgroupSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgroupSizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SubgroupSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubgroupSizeOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SubgroupSizeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgroupSizeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SubgroupSizeOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SubgroupSizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IndexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + return ::mlir::success(); +} + +void SubgroupSizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IndexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubgroupSizeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::TerminatorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TerminatorOpGenericAdaptorBase::TerminatorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.terminator", odsAttrs.getContext()); +} + +TerminatorOpGenericAdaptorBase::TerminatorOpGenericAdaptorBase(TerminatorOp op) : TerminatorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TerminatorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TerminatorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TerminatorOpAdaptor::TerminatorOpAdaptor(TerminatorOp op) : TerminatorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TerminatorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TerminatorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TerminatorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair TerminatorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TerminatorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void TerminatorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void TerminatorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TerminatorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TerminatorOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult TerminatorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TerminatorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TerminatorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void TerminatorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::TerminatorOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::ThreadIdOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ThreadIdOpGenericAdaptorBase::ThreadIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.thread_id", odsAttrs.getContext()); +} + +ThreadIdOpGenericAdaptorBase::ThreadIdOpGenericAdaptorBase(ThreadIdOp op) : ThreadIdOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ThreadIdOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ThreadIdOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::gpu::DimensionAttr ThreadIdOpGenericAdaptorBase::getDimensionAttr() { + auto attr = ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); + return attr; +} + +::mlir::gpu::Dimension ThreadIdOpGenericAdaptorBase::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +} // namespace detail +ThreadIdOpAdaptor::ThreadIdOpAdaptor(ThreadIdOp op) : ThreadIdOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ThreadIdOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitError(loc, "'gpu.thread_id' op ""requires attribute 'dimension'"); + + if (tblgen_dimension && !((::llvm::isa<::mlir::gpu::DimensionAttr>(tblgen_dimension)))) + return emitError(loc, "'gpu.thread_id' op ""attribute 'dimension' failed to satisfy constraint: a dimension, either 'x', 'y', or 'z'"); + return ::mlir::success(); +} + +std::pair ThreadIdOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ThreadIdOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ThreadIdOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ThreadIdOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult ThreadIdOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dimension; + auto attr = dict.get("dimension"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dimension in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dimension` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ThreadIdOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dimension; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dimension", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ThreadIdOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dimension.getAsOpaquePointer())); +} + +std::optional ThreadIdOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dimension") + return prop.dimension; + return std::nullopt; +} + +void ThreadIdOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dimension") { + prop.dimension = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ThreadIdOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dimension) attrs.append("dimension", prop.dimension); +} + +::mlir::LogicalResult ThreadIdOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDimensionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(attr, "dimension", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadIdOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dimension))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ThreadIdOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dimension); +} + +::mlir::gpu::DimensionAttr ThreadIdOp::getDimensionAttr() { + return ::llvm::cast<::mlir::gpu::DimensionAttr>(getProperties().dimension); +} + +::mlir::gpu::Dimension ThreadIdOp::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue(); +} + +void ThreadIdOp::setDimensionAttr(::mlir::gpu::DimensionAttr attr) { + (*this)->setAttr(getDimensionAttrName(), attr); +} + +void ThreadIdOp::setDimension(::mlir::gpu::Dimension attrValue) { + (*this)->setAttr(getDimensionAttrName(), ::mlir::gpu::DimensionAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ThreadIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + odsState.addTypes(resultType0); +} + +void ThreadIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ThreadIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ThreadIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension) { + odsState.getOrAddProperties().dimension = dimension; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + odsState.addTypes(resultType0); +} + +void ThreadIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ThreadIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ThreadIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension) { + odsState.getOrAddProperties().dimension = ::mlir::gpu::DimensionAttr::get(odsBuilder.getContext(), dimension); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadIdOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ThreadIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ThreadIdOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ThreadIdOp::verifyInvariantsImpl() { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitOpError("requires attribute 'dimension'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUOps5(*this, tblgen_dimension, "dimension"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadIdOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ThreadIdOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ThreadIdOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::gpu::DimensionAttr dimensionAttr; + + if (parser.parseCustomAttributeWithFallback(dimensionAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (dimensionAttr) result.getOrAddProperties().dimension = dimensionAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void ThreadIdOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getDimensionAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("dimension"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ThreadIdOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::ThreadIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::WaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WaitOpGenericAdaptorBase::WaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.wait", odsAttrs.getContext()); +} + +WaitOpGenericAdaptorBase::WaitOpGenericAdaptorBase(WaitOp op) : WaitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr WaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +WaitOpAdaptor::WaitOpAdaptor(WaitOp op) : WaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WaitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair WaitOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range WaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range WaitOp::getAsyncDependencies() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange WaitOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair WaitOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range WaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value WaitOp::getAsyncToken() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +void WaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies) { + odsState.addOperands(asyncDependencies); + if (asyncToken) + odsState.addTypes(asyncToken); +} + +void WaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WaitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult WaitOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult WaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> asyncTokenTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncDependenciesOperands; + ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + { + ::mlir::Type asyncTokenType; + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAsyncDependencies(parser, asyncTokenType, asyncDependenciesOperands); + if (odsResult) return ::mlir::failure(); + if (asyncTokenType) + asyncTokenTypes.push_back(asyncTokenType); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = mlir::gpu::AsyncTokenType::get(parser.getBuilder().getContext()); + result.addTypes(asyncTokenTypes); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printAsyncDependencies(_odsPrinter, *this, (getAsyncToken() ? getAsyncToken().getType() : ::mlir::Type()), getAsyncDependencies()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::WaitOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::YieldOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("gpu.yield", odsAttrs.getContext()); +} + +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(YieldOp op) : YieldOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair YieldOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr YieldOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +YieldOpAdaptor::YieldOpAdaptor(YieldOp op) : YieldOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult YieldOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair YieldOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range YieldOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range YieldOp::getValues() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange YieldOp::getValuesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair YieldOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range YieldOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange values) { + odsState.addOperands(values); +} + +void YieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult YieldOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_GPUOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult YieldOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void YieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..be2f538f7aad0634768928418b4add269be60e61 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOps.h.inc @@ -0,0 +1,9412 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: GPUOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace gpu { +class AllReduceOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class AllocOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class BarrierOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class BinaryOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class BlockDimOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class BlockIdOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class Create2To4SpMatOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class CreateBsrOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class CreateCooAoSOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class CreateCooOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class CreateCscOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class CreateCsrOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class CreateDnTensorOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class DeallocOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class DestroyDnTensorOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class DestroySpMatOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class GPUFuncOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class GPUModuleOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class GlobalIdOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class GridDimOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class HostRegisterOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class HostUnregisterOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class LaneIdOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class LaunchFuncOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class LaunchOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class MemcpyOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class MemsetOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class ModuleEndOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class NumSubgroupsOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class PrintfOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class ReturnOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SDDMMBufferSizeOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SDDMMOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SetCsrPointersOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SetDefaultDeviceOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class ShuffleOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SpGEMMCopyOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SpGEMMCreateDescrOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SpGEMMDestroyDescrOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SpGEMMWorkEstimationOrComputeOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SpMMBufferSizeOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SpMMOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SpMVBufferSizeOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SpMVOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SpMatGetSizeOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SubgroupIdOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SubgroupMmaComputeOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SubgroupMmaConstantMatrixOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SubgroupMmaElementwiseOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SubgroupMmaLoadMatrixOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SubgroupMmaStoreMatrixOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SubgroupReduceOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class SubgroupSizeOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class TerminatorOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class ThreadIdOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class WaitOp; +} // namespace gpu +} // namespace mlir +namespace mlir { +namespace gpu { +class YieldOp; +} // namespace gpu +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::AllReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllReduceOpGenericAdaptorBase { +public: + struct Properties { + using opTy = ::mlir::gpu::AllReduceOperationAttr; + opTy op; + + auto getOp() { + auto &propStorage = this->op; + return ::llvm::dyn_cast_or_null<::mlir::gpu::AllReduceOperationAttr>(propStorage); + } + void setOp(const ::mlir::gpu::AllReduceOperationAttr &propValue) { + this->op = propValue; + } + using uniformTy = ::mlir::UnitAttr; + uniformTy uniform; + + auto getUniform() { + auto &propStorage = this->uniform; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setUniform(const ::mlir::UnitAttr &propValue) { + this->uniform = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.op == this->op && + rhs.uniform == this->uniform && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AllReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AllReduceOpGenericAdaptorBase(AllReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::AllReduceOperationAttr getOpAttr(); + ::std::optional<::mlir::gpu::AllReduceOperation> getOp(); + ::mlir::UnitAttr getUniformAttr(); + bool getUniform(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AllReduceOpGenericAdaptor : public detail::AllReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllReduceOpGenericAdaptorBase; +public: + AllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AllReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllReduceOpAdaptor : public AllReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllReduceOpGenericAdaptor::AllReduceOpGenericAdaptor; + AllReduceOpAdaptor(AllReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllReduceOpAdaptor; + template + using GenericAdaptor = AllReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("op"), ::llvm::StringRef("uniform")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOpAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUniformAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUniformAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.all_reduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::AllReduceOperationAttr getOpAttr(); + ::std::optional<::mlir::gpu::AllReduceOperation> getOp(); + ::mlir::UnitAttr getUniformAttr(); + bool getUniform(); + void setOpAttr(::mlir::gpu::AllReduceOperationAttr attr); + void setOp(::std::optional<::mlir::gpu::AllReduceOperation> attrValue); + void setUniformAttr(::mlir::UnitAttr attr); + void setUniform(bool attrValue); + ::mlir::Attribute removeOpAttr(); + ::mlir::Attribute removeUniformAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/bool uniform = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/bool uniform = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, /*optional*/::mlir::gpu::AllReduceOperationAttr op, /*optional*/bool uniform = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::AllReduceOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::AllocOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllocOpGenericAdaptorBase { +public: + struct Properties { + using hostSharedTy = ::mlir::UnitAttr; + hostSharedTy hostShared; + + auto getHostShared() { + auto &propStorage = this->hostShared; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setHostShared(const ::mlir::UnitAttr &propValue) { + this->hostShared = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.hostShared == this->hostShared && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AllocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AllocOpGenericAdaptorBase(AllocOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getHostSharedAttr(); + bool getHostShared(); +}; +} // namespace detail +template +class AllocOpGenericAdaptor : public detail::AllocOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllocOpGenericAdaptorBase; +public: + AllocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllocOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AllocOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + RangeT getDynamicSizes() { + return getODSOperands(1); + } + + RangeT getSymbolOperands() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllocOpAdaptor : public AllocOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllocOpGenericAdaptor::AllocOpGenericAdaptor; + AllocOpAdaptor(AllocOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllocOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllocOpAdaptor; + template + using GenericAdaptor = AllocOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("hostShared"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getHostSharedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getHostSharedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.alloc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Operation::operand_range getDynamicSizes(); + ::mlir::Operation::operand_range getSymbolOperands(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::MutableOperandRange getDynamicSizesMutable(); + ::mlir::MutableOperandRange getSymbolOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getHostSharedAttr(); + bool getHostShared(); + void setHostSharedAttr(::mlir::UnitAttr attr); + void setHostShared(bool attrValue); + ::mlir::Attribute removeHostSharedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::UnitAttr hostShared); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::UnitAttr hostShared); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/bool hostShared = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/bool hostShared = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + MemRefType getType() { return ::llvm::cast(getMemref().getType()); } +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::AllocOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::BarrierOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BarrierOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BarrierOpGenericAdaptorBase(BarrierOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BarrierOpGenericAdaptor : public detail::BarrierOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BarrierOpGenericAdaptorBase; +public: + BarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BarrierOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BarrierOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BarrierOpAdaptor : public BarrierOpGenericAdaptor<::mlir::ValueRange> { +public: + using BarrierOpGenericAdaptor::BarrierOpGenericAdaptor; + BarrierOpAdaptor(BarrierOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BarrierOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BarrierOpAdaptor; + template + using GenericAdaptor = BarrierOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.barrier"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::BarrierOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::BinaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BinaryOpGenericAdaptorBase { +public: + struct Properties { + using objectsTy = ::mlir::ArrayAttr; + objectsTy objects; + + auto getObjects() { + auto &propStorage = this->objects; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setObjects(const ::mlir::ArrayAttr &propValue) { + this->objects = propValue; + } + using offloadingHandlerTy = ::mlir::Attribute; + offloadingHandlerTy offloadingHandler; + + auto getOffloadingHandler() { + auto &propStorage = this->offloadingHandler; + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(propStorage); + } + void setOffloadingHandler(const ::mlir::Attribute &propValue) { + this->offloadingHandler = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.objects == this->objects && + rhs.offloadingHandler == this->offloadingHandler && + rhs.sym_name == this->sym_name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BinaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BinaryOpGenericAdaptorBase(BinaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::Attribute getOffloadingHandlerAttr(); + ::std::optional<::mlir::Attribute> getOffloadingHandler(); + ::mlir::ArrayAttr getObjectsAttr(); + ::mlir::ArrayAttr getObjects(); +}; +} // namespace detail +template +class BinaryOpGenericAdaptor : public detail::BinaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BinaryOpGenericAdaptorBase; +public: + BinaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BinaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BinaryOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BinaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BinaryOpAdaptor : public BinaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using BinaryOpGenericAdaptor::BinaryOpGenericAdaptor; + BinaryOpAdaptor(BinaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BinaryOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BinaryOpAdaptor; + template + using GenericAdaptor = BinaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("objects"), ::llvm::StringRef("offloadingHandler"), ::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getObjectsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getObjectsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOffloadingHandlerAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOffloadingHandlerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.binary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::Attribute getOffloadingHandlerAttr(); + ::std::optional<::mlir::Attribute> getOffloadingHandler(); + ::mlir::ArrayAttr getObjectsAttr(); + ::mlir::ArrayAttr getObjects(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setOffloadingHandlerAttr(::mlir::Attribute attr); + void setObjectsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOffloadingHandlerAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, Attribute offloadingHandler, ArrayAttr objects); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, Attribute offloadingHandler, ArrayRef objects); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::BinaryOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::BlockDimOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockDimOpGenericAdaptorBase { +public: + struct Properties { + using dimensionTy = ::mlir::gpu::DimensionAttr; + dimensionTy dimension; + + auto getDimension() { + auto &propStorage = this->dimension; + return ::llvm::cast<::mlir::gpu::DimensionAttr>(propStorage); + } + void setDimension(const ::mlir::gpu::DimensionAttr &propValue) { + this->dimension = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dimension == this->dimension && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BlockDimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockDimOpGenericAdaptorBase(BlockDimOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); +}; +} // namespace detail +template +class BlockDimOpGenericAdaptor : public detail::BlockDimOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockDimOpGenericAdaptorBase; +public: + BlockDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockDimOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BlockDimOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockDimOpAdaptor : public BlockDimOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockDimOpGenericAdaptor::BlockDimOpGenericAdaptor; + BlockDimOpAdaptor(BlockDimOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockDimOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockDimOpAdaptor; + template + using GenericAdaptor = BlockDimOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.block_dim"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); + void setDimensionAttr(::mlir::gpu::DimensionAttr attr); + void setDimension(::mlir::gpu::Dimension attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::BlockDimOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::BlockIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockIdOpGenericAdaptorBase { +public: + struct Properties { + using dimensionTy = ::mlir::gpu::DimensionAttr; + dimensionTy dimension; + + auto getDimension() { + auto &propStorage = this->dimension; + return ::llvm::cast<::mlir::gpu::DimensionAttr>(propStorage); + } + void setDimension(const ::mlir::gpu::DimensionAttr &propValue) { + this->dimension = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dimension == this->dimension && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BlockIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockIdOpGenericAdaptorBase(BlockIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); +}; +} // namespace detail +template +class BlockIdOpGenericAdaptor : public detail::BlockIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockIdOpGenericAdaptorBase; +public: + BlockIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockIdOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BlockIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockIdOpAdaptor : public BlockIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockIdOpGenericAdaptor::BlockIdOpGenericAdaptor; + BlockIdOpAdaptor(BlockIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockIdOpAdaptor; + template + using GenericAdaptor = BlockIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.block_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); + void setDimensionAttr(::mlir::gpu::DimensionAttr attr); + void setDimension(::mlir::gpu::Dimension attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::BlockIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::Create2To4SpMatOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Create2To4SpMatOpGenericAdaptorBase { +public: + struct Properties { + using pruneFlagTy = ::mlir::gpu::Prune2To4SpMatFlagAttr; + pruneFlagTy pruneFlag; + + auto getPruneFlag() { + auto &propStorage = this->pruneFlag; + return ::llvm::dyn_cast_or_null<::mlir::gpu::Prune2To4SpMatFlagAttr>(propStorage); + } + void setPruneFlag(const ::mlir::gpu::Prune2To4SpMatFlagAttr &propValue) { + this->pruneFlag = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.pruneFlag == this->pruneFlag && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Create2To4SpMatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Create2To4SpMatOpGenericAdaptorBase(Create2To4SpMatOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::Prune2To4SpMatFlagAttr getPruneFlagAttr(); + ::mlir::gpu::Prune2To4SpMatFlag getPruneFlag(); +}; +} // namespace detail +template +class Create2To4SpMatOpGenericAdaptor : public detail::Create2To4SpMatOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Create2To4SpMatOpGenericAdaptorBase; +public: + Create2To4SpMatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Create2To4SpMatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Create2To4SpMatOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Create2To4SpMatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getRows() { + return (*getODSOperands(1).begin()); + } + + ValueT getCols() { + return (*getODSOperands(2).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Create2To4SpMatOpAdaptor : public Create2To4SpMatOpGenericAdaptor<::mlir::ValueRange> { +public: + using Create2To4SpMatOpGenericAdaptor::Create2To4SpMatOpGenericAdaptor; + Create2To4SpMatOpAdaptor(Create2To4SpMatOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Create2To4SpMatOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Create2To4SpMatOpAdaptor; + template + using GenericAdaptor = Create2To4SpMatOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("pruneFlag")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPruneFlagAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPruneFlagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.create_2to4_spmat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::IndexType> getRows(); + ::mlir::TypedValue<::mlir::IndexType> getCols(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getRowsMutable(); + ::mlir::OpOperand &getColsMutable(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getSpMat(); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::Prune2To4SpMatFlagAttr getPruneFlagAttr(); + ::mlir::gpu::Prune2To4SpMatFlag getPruneFlag(); + void setPruneFlagAttr(::mlir::gpu::Prune2To4SpMatFlagAttr attr); + void setPruneFlag(::mlir::gpu::Prune2To4SpMatFlag attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spMat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::gpu::Prune2To4SpMatFlagAttr pruneFlag, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::gpu::Prune2To4SpMatFlagAttr pruneFlag, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spMat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::gpu::Prune2To4SpMatFlag pruneFlag, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::gpu::Prune2To4SpMatFlag pruneFlag, ::mlir::Value memref); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::Create2To4SpMatOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateBsrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateBsrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateBsrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateBsrOpGenericAdaptorBase(CreateBsrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateBsrOpGenericAdaptor : public detail::CreateBsrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateBsrOpGenericAdaptorBase; +public: + CreateBsrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateBsrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateBsrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateBsrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getBrows() { + return (*getODSOperands(1).begin()); + } + + ValueT getBcols() { + return (*getODSOperands(2).begin()); + } + + ValueT getBnnz() { + return (*getODSOperands(3).begin()); + } + + ValueT getRBlockSize() { + return (*getODSOperands(4).begin()); + } + + ValueT getCBlockSize() { + return (*getODSOperands(5).begin()); + } + + ValueT getBRowPos() { + return (*getODSOperands(6).begin()); + } + + ValueT getBColIdxs() { + return (*getODSOperands(7).begin()); + } + + ValueT getValues() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateBsrOpAdaptor : public CreateBsrOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateBsrOpGenericAdaptor::CreateBsrOpGenericAdaptor; + CreateBsrOpAdaptor(CreateBsrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateBsrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateBsrOpAdaptor; + template + using GenericAdaptor = CreateBsrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.create_bsr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::IndexType> getBrows(); + ::mlir::TypedValue<::mlir::IndexType> getBcols(); + ::mlir::TypedValue<::mlir::IndexType> getBnnz(); + ::mlir::TypedValue<::mlir::IndexType> getRBlockSize(); + ::mlir::TypedValue<::mlir::IndexType> getCBlockSize(); + ::mlir::TypedValue<::mlir::MemRefType> getBRowPos(); + ::mlir::TypedValue<::mlir::MemRefType> getBColIdxs(); + ::mlir::TypedValue<::mlir::MemRefType> getValues(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getBrowsMutable(); + ::mlir::OpOperand &getBcolsMutable(); + ::mlir::OpOperand &getBnnzMutable(); + ::mlir::OpOperand &getRBlockSizeMutable(); + ::mlir::OpOperand &getCBlockSizeMutable(); + ::mlir::OpOperand &getBRowPosMutable(); + ::mlir::OpOperand &getBColIdxsMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getSpmat(); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value brows, ::mlir::Value bcols, ::mlir::Value bnnz, ::mlir::Value rBlockSize, ::mlir::Value cBlockSize, ::mlir::Value bRowPos, ::mlir::Value bColIdxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value brows, ::mlir::Value bcols, ::mlir::Value bnnz, ::mlir::Value rBlockSize, ::mlir::Value cBlockSize, ::mlir::Value bRowPos, ::mlir::Value bColIdxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateBsrOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateCooAoSOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateCooAoSOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateCooAoSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateCooAoSOpGenericAdaptorBase(CreateCooAoSOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateCooAoSOpGenericAdaptor : public detail::CreateCooAoSOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateCooAoSOpGenericAdaptorBase; +public: + CreateCooAoSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateCooAoSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateCooAoSOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateCooAoSOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getRows() { + return (*getODSOperands(1).begin()); + } + + ValueT getCols() { + return (*getODSOperands(2).begin()); + } + + ValueT getNnz() { + return (*getODSOperands(3).begin()); + } + + ValueT getIdxs() { + return (*getODSOperands(4).begin()); + } + + ValueT getValues() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateCooAoSOpAdaptor : public CreateCooAoSOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateCooAoSOpGenericAdaptor::CreateCooAoSOpGenericAdaptor; + CreateCooAoSOpAdaptor(CreateCooAoSOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateCooAoSOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateCooAoSOpAdaptor; + template + using GenericAdaptor = CreateCooAoSOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.create_coo_aos"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::IndexType> getRows(); + ::mlir::TypedValue<::mlir::IndexType> getCols(); + ::mlir::TypedValue<::mlir::IndexType> getNnz(); + ::mlir::TypedValue<::mlir::MemRefType> getIdxs(); + ::mlir::TypedValue<::mlir::MemRefType> getValues(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getRowsMutable(); + ::mlir::OpOperand &getColsMutable(); + ::mlir::OpOperand &getNnzMutable(); + ::mlir::OpOperand &getIdxsMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getSpmat(); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value idxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value idxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateCooAoSOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateCooOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateCooOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateCooOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateCooOpGenericAdaptorBase(CreateCooOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateCooOpGenericAdaptor : public detail::CreateCooOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateCooOpGenericAdaptorBase; +public: + CreateCooOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateCooOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateCooOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateCooOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getRows() { + return (*getODSOperands(1).begin()); + } + + ValueT getCols() { + return (*getODSOperands(2).begin()); + } + + ValueT getNnz() { + return (*getODSOperands(3).begin()); + } + + ValueT getRowIdxs() { + return (*getODSOperands(4).begin()); + } + + ValueT getColIdxs() { + return (*getODSOperands(5).begin()); + } + + ValueT getValues() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateCooOpAdaptor : public CreateCooOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateCooOpGenericAdaptor::CreateCooOpGenericAdaptor; + CreateCooOpAdaptor(CreateCooOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateCooOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateCooOpAdaptor; + template + using GenericAdaptor = CreateCooOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.create_coo"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::IndexType> getRows(); + ::mlir::TypedValue<::mlir::IndexType> getCols(); + ::mlir::TypedValue<::mlir::IndexType> getNnz(); + ::mlir::TypedValue<::mlir::MemRefType> getRowIdxs(); + ::mlir::TypedValue<::mlir::MemRefType> getColIdxs(); + ::mlir::TypedValue<::mlir::MemRefType> getValues(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getRowsMutable(); + ::mlir::OpOperand &getColsMutable(); + ::mlir::OpOperand &getNnzMutable(); + ::mlir::OpOperand &getRowIdxsMutable(); + ::mlir::OpOperand &getColIdxsMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getSpmat(); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value rowIdxs, ::mlir::Value colIdxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value rowIdxs, ::mlir::Value colIdxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateCooOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateCscOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateCscOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateCscOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateCscOpGenericAdaptorBase(CreateCscOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateCscOpGenericAdaptor : public detail::CreateCscOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateCscOpGenericAdaptorBase; +public: + CreateCscOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateCscOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateCscOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateCscOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getRows() { + return (*getODSOperands(1).begin()); + } + + ValueT getCols() { + return (*getODSOperands(2).begin()); + } + + ValueT getNnz() { + return (*getODSOperands(3).begin()); + } + + ValueT getColPos() { + return (*getODSOperands(4).begin()); + } + + ValueT getRowIdxs() { + return (*getODSOperands(5).begin()); + } + + ValueT getValues() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateCscOpAdaptor : public CreateCscOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateCscOpGenericAdaptor::CreateCscOpGenericAdaptor; + CreateCscOpAdaptor(CreateCscOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateCscOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateCscOpAdaptor; + template + using GenericAdaptor = CreateCscOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.create_csc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::IndexType> getRows(); + ::mlir::TypedValue<::mlir::IndexType> getCols(); + ::mlir::TypedValue<::mlir::IndexType> getNnz(); + ::mlir::TypedValue<::mlir::MemRefType> getColPos(); + ::mlir::TypedValue<::mlir::MemRefType> getRowIdxs(); + ::mlir::TypedValue<::mlir::MemRefType> getValues(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getRowsMutable(); + ::mlir::OpOperand &getColsMutable(); + ::mlir::OpOperand &getNnzMutable(); + ::mlir::OpOperand &getColPosMutable(); + ::mlir::OpOperand &getRowIdxsMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getSpmat(); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value colPos, ::mlir::Value rowIdxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value colPos, ::mlir::Value rowIdxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateCscOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateCsrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateCsrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateCsrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateCsrOpGenericAdaptorBase(CreateCsrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateCsrOpGenericAdaptor : public detail::CreateCsrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateCsrOpGenericAdaptorBase; +public: + CreateCsrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateCsrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateCsrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateCsrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getRows() { + return (*getODSOperands(1).begin()); + } + + ValueT getCols() { + return (*getODSOperands(2).begin()); + } + + ValueT getNnz() { + return (*getODSOperands(3).begin()); + } + + ValueT getRowPos() { + return (*getODSOperands(4).begin()); + } + + ValueT getColIdxs() { + return (*getODSOperands(5).begin()); + } + + ValueT getValues() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateCsrOpAdaptor : public CreateCsrOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateCsrOpGenericAdaptor::CreateCsrOpGenericAdaptor; + CreateCsrOpAdaptor(CreateCsrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateCsrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateCsrOpAdaptor; + template + using GenericAdaptor = CreateCsrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.create_csr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::IndexType> getRows(); + ::mlir::TypedValue<::mlir::IndexType> getCols(); + ::mlir::TypedValue<::mlir::IndexType> getNnz(); + ::mlir::TypedValue<::mlir::MemRefType> getRowPos(); + ::mlir::TypedValue<::mlir::MemRefType> getColIdxs(); + ::mlir::TypedValue<::mlir::MemRefType> getValues(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getRowsMutable(); + ::mlir::OpOperand &getColsMutable(); + ::mlir::OpOperand &getNnzMutable(); + ::mlir::OpOperand &getRowPosMutable(); + ::mlir::OpOperand &getColIdxsMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getSpmat(); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type spmat, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value rowPos, ::mlir::Value colIdxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value rows, ::mlir::Value cols, ::mlir::Value nnz, ::mlir::Value rowPos, ::mlir::Value colIdxs, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateCsrOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::CreateDnTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateDnTensorOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CreateDnTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateDnTensorOpGenericAdaptorBase(CreateDnTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateDnTensorOpGenericAdaptor : public detail::CreateDnTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateDnTensorOpGenericAdaptorBase; +public: + CreateDnTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateDnTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateDnTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CreateDnTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getDims() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateDnTensorOpAdaptor : public CreateDnTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateDnTensorOpGenericAdaptor::CreateDnTensorOpGenericAdaptor; + CreateDnTensorOpAdaptor(CreateDnTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateDnTensorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateDnTensorOpAdaptor; + template + using GenericAdaptor = CreateDnTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.create_dn_tensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getDims(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getDimsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getDnTensor(); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dnTensor, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value memref, ::mlir::ValueRange dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value memref, ::mlir::ValueRange dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::CreateDnTensorOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::DeallocOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeallocOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeallocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeallocOpGenericAdaptorBase(DeallocOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeallocOpGenericAdaptor : public detail::DeallocOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeallocOpGenericAdaptorBase; +public: + DeallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeallocOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeallocOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeallocOpAdaptor : public DeallocOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeallocOpGenericAdaptor::DeallocOpGenericAdaptor; + DeallocOpAdaptor(DeallocOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeallocOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeallocOpAdaptor; + template + using GenericAdaptor = DeallocOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.dealloc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value memref); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::DeallocOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::DestroyDnTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DestroyDnTensorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DestroyDnTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DestroyDnTensorOpGenericAdaptorBase(DestroyDnTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DestroyDnTensorOpGenericAdaptor : public detail::DestroyDnTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DestroyDnTensorOpGenericAdaptorBase; +public: + DestroyDnTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DestroyDnTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DestroyDnTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DestroyDnTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getDnTensor() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DestroyDnTensorOpAdaptor : public DestroyDnTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DestroyDnTensorOpGenericAdaptor::DestroyDnTensorOpGenericAdaptor; + DestroyDnTensorOpAdaptor(DestroyDnTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DestroyDnTensorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DestroyDnTensorOpAdaptor; + template + using GenericAdaptor = DestroyDnTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.destroy_dn_tensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getDnTensor(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getDnTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value dnTensor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value dnTensor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::DestroyDnTensorOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::DestroySpMatOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DestroySpMatOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DestroySpMatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DestroySpMatOpGenericAdaptorBase(DestroySpMatOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DestroySpMatOpGenericAdaptor : public detail::DestroySpMatOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DestroySpMatOpGenericAdaptorBase; +public: + DestroySpMatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DestroySpMatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DestroySpMatOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DestroySpMatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getSpmat() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DestroySpMatOpAdaptor : public DestroySpMatOpGenericAdaptor<::mlir::ValueRange> { +public: + using DestroySpMatOpGenericAdaptor::DestroySpMatOpGenericAdaptor; + DestroySpMatOpAdaptor(DestroySpMatOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DestroySpMatOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DestroySpMatOpAdaptor; + template + using GenericAdaptor = DestroySpMatOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.destroy_sp_mat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getSpmat(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getSpmatMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::DestroySpMatOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::GPUFuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GPUFuncOpGenericAdaptorBase { +public: + struct Properties { + using arg_attrsTy = ::mlir::ArrayAttr; + arg_attrsTy arg_attrs; + + auto getArgAttrs() { + auto &propStorage = this->arg_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setArgAttrs(const ::mlir::ArrayAttr &propValue) { + this->arg_attrs = propValue; + } + using function_typeTy = ::mlir::TypeAttr; + function_typeTy function_type; + + auto getFunctionType() { + auto &propStorage = this->function_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setFunctionType(const ::mlir::TypeAttr &propValue) { + this->function_type = propValue; + } + using private_attrib_attrsTy = ::mlir::ArrayAttr; + private_attrib_attrsTy private_attrib_attrs; + + auto getPrivateAttribAttrs() { + auto &propStorage = this->private_attrib_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setPrivateAttribAttrs(const ::mlir::ArrayAttr &propValue) { + this->private_attrib_attrs = propValue; + } + using res_attrsTy = ::mlir::ArrayAttr; + res_attrsTy res_attrs; + + auto getResAttrs() { + auto &propStorage = this->res_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setResAttrs(const ::mlir::ArrayAttr &propValue) { + this->res_attrs = propValue; + } + using workgroup_attrib_attrsTy = ::mlir::ArrayAttr; + workgroup_attrib_attrsTy workgroup_attrib_attrs; + + auto getWorkgroupAttribAttrs() { + auto &propStorage = this->workgroup_attrib_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setWorkgroupAttribAttrs(const ::mlir::ArrayAttr &propValue) { + this->workgroup_attrib_attrs = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.arg_attrs == this->arg_attrs && + rhs.function_type == this->function_type && + rhs.private_attrib_attrs == this->private_attrib_attrs && + rhs.res_attrs == this->res_attrs && + rhs.workgroup_attrib_attrs == this->workgroup_attrib_attrs && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GPUFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GPUFuncOpGenericAdaptorBase(GPUFuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::ArrayAttr getWorkgroupAttribAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getWorkgroupAttribAttrs(); + ::mlir::ArrayAttr getPrivateAttribAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrivateAttribAttrs(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class GPUFuncOpGenericAdaptor : public detail::GPUFuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GPUFuncOpGenericAdaptorBase; +public: + GPUFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GPUFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GPUFuncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GPUFuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GPUFuncOpAdaptor : public GPUFuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using GPUFuncOpGenericAdaptor::GPUFuncOpGenericAdaptor; + GPUFuncOpAdaptor(GPUFuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GPUFuncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::SymbolOpInterface::Trait, ::mlir::CallableOpInterface::Trait, ::mlir::FunctionOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove> { +public: + using Op::Op; + using Op::print; + using Adaptor = GPUFuncOpAdaptor; + template + using GenericAdaptor = GPUFuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("function_type"), ::llvm::StringRef("private_attrib_attrs"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("workgroup_attrib_attrs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getArgAttrsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFunctionTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPrivateAttribAttrsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPrivateAttribAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getResAttrsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getWorkgroupAttribAttrsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getWorkgroupAttribAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::ArrayAttr getWorkgroupAttribAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getWorkgroupAttribAttrs(); + ::mlir::ArrayAttr getPrivateAttribAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrivateAttribAttrs(); + void setFunctionTypeAttr(::mlir::TypeAttr attr); + void setFunctionType(::mlir::FunctionType attrValue); + void setArgAttrsAttr(::mlir::ArrayAttr attr); + void setResAttrsAttr(::mlir::ArrayAttr attr); + void setWorkgroupAttribAttrsAttr(::mlir::ArrayAttr attr); + void setPrivateAttribAttrsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeArgAttrsAttr(); + ::mlir::Attribute removeResAttrsAttr(); + ::mlir::Attribute removeWorkgroupAttribAttrsAttr(); + ::mlir::Attribute removePrivateAttribAttrsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, FunctionType type, TypeRange workgroupAttributions = {}, TypeRange privateAttributions = {}, ArrayRef attrs = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns `true` if the GPU function defined by this Op is a kernel, i.e. + /// it is intended to be launched from host. + bool isKernel() { + return (*this)->getAttrOfType( + GPUDialect::getKernelFuncAttrName()) != nullptr; + } + + /// Returns the number of buffers located in the workgroup memory. + unsigned getNumWorkgroupAttributions() { + auto attr = (*this)->getAttrOfType( + getNumWorkgroupAttributionsAttrName()); + return attr ? attr.getInt() : 0; + } + + /// Return the index of the first workgroup attribution in the block argument + /// list. + unsigned getFirstWorkgroupAttributionIndex() { + return getFunctionType().getNumInputs(); + } + + /// Returns a list of block arguments that correspond to buffers located in + /// the workgroup memory + ArrayRef getWorkgroupAttributions() { + auto begin = + std::next(getBody().args_begin(), getFirstWorkgroupAttributionIndex()); + auto end = std::next(begin, getNumWorkgroupAttributions()); + return {begin, end}; + } + + /// Adds a new block argument that corresponds to buffers located in + /// workgroup memory. + BlockArgument addWorkgroupAttribution(Type type, Location loc); + + /// Get the workgroup attribution attribute dictionary for the attribution + /// at index `index`, counted from the start of the workgroup attributions. + DictionaryAttr getworkgroupAttributionAttrs(unsigned index); + + /// Set the workgroup attribution attribute dictionary for the attribution + /// at index `index`, counted from the start of the workgroup attributions. + void setworkgroupAttributionAttrs(unsigned index, DictionaryAttr value); + + /// Get an attribute for a workgroup attribution. `index` is counted + /// from the start of the workgroup attributions, not the start of the block. + Attribute getWorkgroupAttributionAttr(unsigned index, StringAttr name); + Attribute getWorkgroupAttributionAttr(unsigned index, StringRef name) { + return getWorkgroupAttributionAttr(index, StringAttr::get((*this)->getContext(), name)); + } + + /// Set an attribute for a workgroup attribution. `index` is counted + /// from the start of the workgroup attributions, not the start of the block. + /// A null `value` removes an attributino attribute. + void setWorkgroupAttributionAttr(unsigned index, StringAttr name, Attribute value); + void setWorkgroupAttributionAttr(unsigned index, StringRef name, Attribute value) { + return setWorkgroupAttributionAttr(index, StringAttr::get((*this)->getContext(), name), value); + } + + /// Returns the number of buffers located in the private memory. + unsigned getNumPrivateAttributions() { + return getBody().getNumArguments() - getFunctionType().getNumInputs() - + getNumWorkgroupAttributions(); + } + + /// Returns the index of the first private buffer in the block argument list. + unsigned getFirstPrivateAttributionIndex() { + // Buffers on the private memory always come after buffers on the workgroup + // memory. + return getFunctionType().getNumInputs() + getNumWorkgroupAttributions(); + } + + /// Returns a list of block arguments that correspond to buffers located in + /// the private memory. + ArrayRef getPrivateAttributions() { + auto begin = + std::next(getBody().args_begin(), getFirstPrivateAttributionIndex()); + return {begin, getBody().args_end()}; + } + + /// Adds a new block argument that corresponds to buffers located in + /// private memory. + BlockArgument addPrivateAttribution(Type type, Location loc); + + /// Get the private attribution attribute dictionary for the attribution + /// at index `index`, counted from the start of the private attributions. + DictionaryAttr getPrivateAttributionAttrs(unsigned index); + + /// Set the private attribution attribute dictionary for the attribution + /// at index `index`, counted from the start of the private attributions. + void setPrivateAttributionAttrs(unsigned index, DictionaryAttr value); + + /// Get an attribute for a private attribution. `index` is counted + /// from the start of the private attributions, not the start of the block. + Attribute getPrivateAttributionAttr(unsigned index, StringAttr name); + Attribute getPrivateAttributionAttr(unsigned index, StringRef name) { + return getPrivateAttributionAttr(index, StringAttr::get((*this)->getContext(), name)); + } + + /// Set an attribute for a private attribution. `index` is counted + /// from the start of the private attributions, not the start of the block. + /// A null `value` removes an attribute. + void setPrivateAttributionAttr(unsigned index, StringAttr name, Attribute value); + void setPrivateAttributionAttr(unsigned index, StringRef name, Attribute value) { + return setPrivateAttributionAttr(index, StringAttr::get((*this)->getContext(), name), value); + } + + /// Returns the name of the attribute containing the number of buffers + /// located in the workgroup memory. + static StringRef getNumWorkgroupAttributionsAttrName() { + return "workgroup_attributions"; + } + + static constexpr StringLiteral getKnownBlockSizeAttrName() { + return StringLiteral("gpu.known_block_size"); + } + + static constexpr StringLiteral getKnownGridSizeAttrName() { + return StringLiteral("gpu.known_grid_size"); + } + + /// Returns the block size this kernel will be launched with along + /// dimension `dim` if known. The value of gpu.thread_id dim will be strictly + /// less than this size. + std::optional getKnownBlockSize(gpu::Dimension dim) { + if (auto array = + (*this)->getAttrOfType(getKnownBlockSizeAttrName())) { + return array[static_cast(dim)]; + } + return std::nullopt; + } + + /// Returns the grid size this kernel will be launched with along + /// dimension `dim` if known. The value of gpu.block_id dim will be strictly + /// less than this size. + std::optional getKnownGridSize(gpu::Dimension dim) { + if (auto array = + (*this)->getAttrOfType(getKnownGridSizeAttrName())) { + return array[static_cast(dim)]; + } + return std::nullopt; + } + + /// Returns the argument types of this function. + ArrayRef getArgumentTypes() { return getFunctionType().getInputs(); } + + /// Returns the result types of this function. + ArrayRef getResultTypes() { return getFunctionType().getResults(); } + + Region *getCallableRegion() { return &getBody(); } + + /// Returns the keywords used in the custom syntax for this Op. + static StringRef getWorkgroupKeyword() { return "workgroup"; } + static StringRef getPrivateKeyword() { return "private"; } + static StringRef getKernelKeyword() { return "kernel"; } + + /// Hook for FunctionOpInterface verifier. + LogicalResult verifyType(); + + /// Verifies the body of the function. + LogicalResult verifyBody(); +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUFuncOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::GPUModuleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GPUModuleOpGenericAdaptorBase { +public: + struct Properties { + using targetsTy = ::mlir::ArrayAttr; + targetsTy targets; + + auto getTargets() { + auto &propStorage = this->targets; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTargets(const ::mlir::ArrayAttr &propValue) { + this->targets = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.targets == this->targets && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GPUModuleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GPUModuleOpGenericAdaptorBase(GPUModuleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getTargetsAttr(); + ::std::optional< ::mlir::ArrayAttr > getTargets(); + ::mlir::Region &getBodyRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class GPUModuleOpGenericAdaptor : public detail::GPUModuleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GPUModuleOpGenericAdaptorBase; +public: + GPUModuleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GPUModuleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GPUModuleOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GPUModuleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GPUModuleOpAdaptor : public GPUModuleOpGenericAdaptor<::mlir::ValueRange> { +public: + using GPUModuleOpGenericAdaptor::GPUModuleOpGenericAdaptor; + GPUModuleOpAdaptor(GPUModuleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GPUModuleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::DataLayoutOpInterface::Trait, ::mlir::HasDefaultDLTIDataLayout, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::OpTrait::SymbolTable, ::mlir::SymbolOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GPUModuleOpAdaptor; + template + using GenericAdaptor = GPUModuleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("targets")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargetsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargetsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.module"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBodyRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getTargetsAttr(); + ::std::optional< ::mlir::ArrayAttr > getTargets(); + void setTargetsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeTargetsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, ArrayAttr targets = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, ArrayRef targets); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Checks if `target` is in the `targets` list. + bool hasTarget(Attribute target); + + /// Sets the targets of the module. + void setTargets(ArrayRef targets); +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUModuleOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::GlobalIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalIdOpGenericAdaptorBase { +public: + struct Properties { + using dimensionTy = ::mlir::gpu::DimensionAttr; + dimensionTy dimension; + + auto getDimension() { + auto &propStorage = this->dimension; + return ::llvm::cast<::mlir::gpu::DimensionAttr>(propStorage); + } + void setDimension(const ::mlir::gpu::DimensionAttr &propValue) { + this->dimension = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dimension == this->dimension && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalIdOpGenericAdaptorBase(GlobalIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); +}; +} // namespace detail +template +class GlobalIdOpGenericAdaptor : public detail::GlobalIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalIdOpGenericAdaptorBase; +public: + GlobalIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalIdOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalIdOpAdaptor : public GlobalIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalIdOpGenericAdaptor::GlobalIdOpGenericAdaptor; + GlobalIdOpAdaptor(GlobalIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalIdOpAdaptor; + template + using GenericAdaptor = GlobalIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.global_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); + void setDimensionAttr(::mlir::gpu::DimensionAttr attr); + void setDimension(::mlir::gpu::Dimension attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GlobalIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::GridDimOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridDimOpGenericAdaptorBase { +public: + struct Properties { + using dimensionTy = ::mlir::gpu::DimensionAttr; + dimensionTy dimension; + + auto getDimension() { + auto &propStorage = this->dimension; + return ::llvm::cast<::mlir::gpu::DimensionAttr>(propStorage); + } + void setDimension(const ::mlir::gpu::DimensionAttr &propValue) { + this->dimension = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dimension == this->dimension && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GridDimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GridDimOpGenericAdaptorBase(GridDimOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); +}; +} // namespace detail +template +class GridDimOpGenericAdaptor : public detail::GridDimOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridDimOpGenericAdaptorBase; +public: + GridDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridDimOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GridDimOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridDimOpAdaptor : public GridDimOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridDimOpGenericAdaptor::GridDimOpGenericAdaptor; + GridDimOpAdaptor(GridDimOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridDimOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridDimOpAdaptor; + template + using GenericAdaptor = GridDimOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.grid_dim"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); + void setDimensionAttr(::mlir::gpu::DimensionAttr attr); + void setDimension(::mlir::gpu::Dimension attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GridDimOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::HostRegisterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class HostRegisterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + HostRegisterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + HostRegisterOpGenericAdaptorBase(HostRegisterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class HostRegisterOpGenericAdaptor : public detail::HostRegisterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::HostRegisterOpGenericAdaptorBase; +public: + HostRegisterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + HostRegisterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : HostRegisterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + HostRegisterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class HostRegisterOpAdaptor : public HostRegisterOpGenericAdaptor<::mlir::ValueRange> { +public: + using HostRegisterOpGenericAdaptor::HostRegisterOpGenericAdaptor; + HostRegisterOpAdaptor(HostRegisterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class HostRegisterOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = HostRegisterOpAdaptor; + template + using GenericAdaptor = HostRegisterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.host_register"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::UnrankedMemRefType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::HostRegisterOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::HostUnregisterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class HostUnregisterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + HostUnregisterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + HostUnregisterOpGenericAdaptorBase(HostUnregisterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class HostUnregisterOpGenericAdaptor : public detail::HostUnregisterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::HostUnregisterOpGenericAdaptorBase; +public: + HostUnregisterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + HostUnregisterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : HostUnregisterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + HostUnregisterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class HostUnregisterOpAdaptor : public HostUnregisterOpGenericAdaptor<::mlir::ValueRange> { +public: + using HostUnregisterOpGenericAdaptor::HostUnregisterOpGenericAdaptor; + HostUnregisterOpAdaptor(HostUnregisterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class HostUnregisterOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = HostUnregisterOpAdaptor; + template + using GenericAdaptor = HostUnregisterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.host_unregister"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::UnrankedMemRefType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::HostUnregisterOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::LaneIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LaneIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LaneIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LaneIdOpGenericAdaptorBase(LaneIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LaneIdOpGenericAdaptor : public detail::LaneIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LaneIdOpGenericAdaptorBase; +public: + LaneIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LaneIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LaneIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LaneIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LaneIdOpAdaptor : public LaneIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using LaneIdOpGenericAdaptor::LaneIdOpGenericAdaptor; + LaneIdOpAdaptor(LaneIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LaneIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LaneIdOpAdaptor; + template + using GenericAdaptor = LaneIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.lane_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::LaneIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::LaunchFuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LaunchFuncOpGenericAdaptorBase { +public: + struct Properties { + using kernelTy = ::mlir::SymbolRefAttr; + kernelTy kernel; + + auto getKernel() { + auto &propStorage = this->kernel; + return ::llvm::cast<::mlir::SymbolRefAttr>(propStorage); + } + void setKernel(const ::mlir::SymbolRefAttr &propValue) { + this->kernel = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.kernel == this->kernel && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LaunchFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LaunchFuncOpGenericAdaptorBase(LaunchFuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getKernelAttr(); + ::mlir::SymbolRefAttr getKernel(); +}; +} // namespace detail +template +class LaunchFuncOpGenericAdaptor : public detail::LaunchFuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LaunchFuncOpGenericAdaptorBase; +public: + LaunchFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LaunchFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LaunchFuncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LaunchFuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getGridSizeX() { + return (*getODSOperands(1).begin()); + } + + ValueT getGridSizeY() { + return (*getODSOperands(2).begin()); + } + + ValueT getGridSizeZ() { + return (*getODSOperands(3).begin()); + } + + ValueT getBlockSizeX() { + return (*getODSOperands(4).begin()); + } + + ValueT getBlockSizeY() { + return (*getODSOperands(5).begin()); + } + + ValueT getBlockSizeZ() { + return (*getODSOperands(6).begin()); + } + + ValueT getDynamicSharedMemorySize() { + auto operands = getODSOperands(7); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getKernelOperands() { + return getODSOperands(8); + } + + ValueT getAsyncObject() { + auto operands = getODSOperands(9); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LaunchFuncOpAdaptor : public LaunchFuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using LaunchFuncOpGenericAdaptor::LaunchFuncOpGenericAdaptor; + LaunchFuncOpAdaptor(LaunchFuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LaunchFuncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LaunchFuncOpAdaptor; + template + using GenericAdaptor = LaunchFuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("kernel"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKernelAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKernelAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.launch_func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getGridSizeX(); + ::mlir::Value getGridSizeY(); + ::mlir::Value getGridSizeZ(); + ::mlir::Value getBlockSizeX(); + ::mlir::Value getBlockSizeY(); + ::mlir::Value getBlockSizeZ(); + ::mlir::TypedValue<::mlir::IntegerType> getDynamicSharedMemorySize(); + ::mlir::Operation::operand_range getKernelOperands(); + ::mlir::Value getAsyncObject(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getGridSizeXMutable(); + ::mlir::OpOperand &getGridSizeYMutable(); + ::mlir::OpOperand &getGridSizeZMutable(); + ::mlir::OpOperand &getBlockSizeXMutable(); + ::mlir::OpOperand &getBlockSizeYMutable(); + ::mlir::OpOperand &getBlockSizeZMutable(); + ::mlir::MutableOperandRange getDynamicSharedMemorySizeMutable(); + ::mlir::MutableOperandRange getKernelOperandsMutable(); + ::mlir::MutableOperandRange getAsyncObjectMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::SymbolRefAttr getKernelAttr(); + ::mlir::SymbolRefAttr getKernel(); + void setKernelAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, GPUFuncOp kernelFunc, KernelDim3 gridSize, KernelDim3 blockSize, Value dynamicSharedMemorySize, ValueRange kernelOperands, Type asyncTokenType = nullptr, ValueRange asyncDependencies = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, SymbolRefAttr kernel, KernelDim3 gridSize, KernelDim3 blockSize, Value dynamicSharedMemorySize, ValueRange kernelOperands, Value asyncObject = nullptr); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The name of the kernel's containing module. + StringAttr getKernelModuleName(); + + /// The name of the kernel. + StringAttr getKernelName(); + + /// The number of operands passed to the kernel function. + unsigned getNumKernelOperands(); + + /// The i-th operand passed to the kernel function. + Value getKernelOperand(unsigned i); + + /// Get the SSA values passed as operands to specify the grid size. + KernelDim3 getGridSizeOperandValues(); + + /// Get the SSA values passed as operands to specify the block size. + KernelDim3 getBlockSizeOperandValues(); + + // This needs to quietly verify if attributes with names defined below are + // present since it is run before the verifier of this op. + friend LogicalResult GPUDialect::verifyOperationAttribute(Operation *, + NamedAttribute); +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::LaunchFuncOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::LaunchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LaunchOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LaunchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LaunchOpGenericAdaptorBase(LaunchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class LaunchOpGenericAdaptor : public detail::LaunchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LaunchOpGenericAdaptorBase; +public: + LaunchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LaunchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LaunchOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LaunchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getGridSizeX() { + return (*getODSOperands(1).begin()); + } + + ValueT getGridSizeY() { + return (*getODSOperands(2).begin()); + } + + ValueT getGridSizeZ() { + return (*getODSOperands(3).begin()); + } + + ValueT getBlockSizeX() { + return (*getODSOperands(4).begin()); + } + + ValueT getBlockSizeY() { + return (*getODSOperands(5).begin()); + } + + ValueT getBlockSizeZ() { + return (*getODSOperands(6).begin()); + } + + ValueT getDynamicSharedMemorySize() { + auto operands = getODSOperands(7); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LaunchOpAdaptor : public LaunchOpGenericAdaptor<::mlir::ValueRange> { +public: + using LaunchOpGenericAdaptor::LaunchOpGenericAdaptor; + LaunchOpAdaptor(LaunchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LaunchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LaunchOpAdaptor; + template + using GenericAdaptor = LaunchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.launch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::IndexType> getGridSizeX(); + ::mlir::TypedValue<::mlir::IndexType> getGridSizeY(); + ::mlir::TypedValue<::mlir::IndexType> getGridSizeZ(); + ::mlir::TypedValue<::mlir::IndexType> getBlockSizeX(); + ::mlir::TypedValue<::mlir::IndexType> getBlockSizeY(); + ::mlir::TypedValue<::mlir::IndexType> getBlockSizeZ(); + ::mlir::TypedValue<::mlir::IntegerType> getDynamicSharedMemorySize(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getGridSizeXMutable(); + ::mlir::OpOperand &getGridSizeYMutable(); + ::mlir::OpOperand &getGridSizeZMutable(); + ::mlir::OpOperand &getBlockSizeXMutable(); + ::mlir::OpOperand &getBlockSizeYMutable(); + ::mlir::OpOperand &getBlockSizeZMutable(); + ::mlir::MutableOperandRange getDynamicSharedMemorySizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value gridSizeX, Value gridSizeY, Value gridSizeZ, Value blockSizeX, Value blockSizeY, Value blockSizeZ, Value dynamicSharedMemorySize = nullptr, Type asyncTokenType = nullptr, ValueRange asyncDependencies = {}, TypeRange workgroupAttributions = {}, TypeRange privateAttributions = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + /// Get the SSA values corresponding to kernel block identifiers. + KernelDim3 getBlockIds(); + /// Get the SSA values corresponding to kernel thread identifiers. + KernelDim3 getThreadIds(); + /// Get the SSA values corresponding to kernel grid size. + KernelDim3 getGridSize(); + /// Get the SSA values corresponding to kernel block size. + KernelDim3 getBlockSize(); + + /// Get the SSA values passed as operands to specify the grid size. + KernelDim3 getGridSizeOperandValues(); + /// Get the SSA values passed as operands to specify the block size. + KernelDim3 getBlockSizeOperandValues(); + + static StringRef getBlocksKeyword() { return "blocks"; } + static StringRef getThreadsKeyword() { return "threads"; } + static StringRef getDynamicSharedMemorySizeKeyword() { + return "dynamic_shared_memory_size"; + } + + /// The number of launch configuration operands, placed at the leading + /// positions of the operand list. + static constexpr unsigned kNumConfigOperands = 6; + + /// The number of region attributes containing the launch configuration, + /// placed in the leading positions of the argument list. + static constexpr unsigned kNumConfigRegionAttributes = 12; + + /// Returns the keywords used in the custom syntax for this Op. + static StringRef getWorkgroupKeyword() { return "workgroup"; } + static StringRef getPrivateKeyword() { return "private"; } + + /// Returns the number of buffers located in the workgroup memory. + unsigned getNumWorkgroupAttributions() { + auto attr = (*this)->getAttrOfType( + getNumWorkgroupAttributionsAttrName()); + return attr ? attr.getInt() : 0; + } + + /// Returns a list of block arguments that correspond to buffers located in + /// the workgroup memory + ArrayRef getWorkgroupAttributions() { + auto begin = + std::next(getBody().args_begin(), kNumConfigRegionAttributes); + auto end = std::next(begin, getNumWorkgroupAttributions()); + return {begin, end}; + } + + /// Adds a new block argument that corresponds to buffers located in + /// workgroup memory. + BlockArgument addWorkgroupAttribution(Type type, Location loc); + + /// Returns the number of buffers located in the private memory. + unsigned getNumPrivateAttributions() { + return getBody().getNumArguments() - kNumConfigRegionAttributes - + getNumWorkgroupAttributions(); + } + + /// Returns a list of block arguments that correspond to buffers located in + /// the private memory. + ArrayRef getPrivateAttributions() { + // Buffers on the private memory always come after buffers on the workgroup + // memory. + auto begin = + std::next(getBody().args_begin(), + kNumConfigRegionAttributes + getNumWorkgroupAttributions()); + return {begin, getBody().args_end()}; + } + + /// Adds a new block argument that corresponds to buffers located in + /// private memory. + BlockArgument addPrivateAttribution(Type type, Location loc); + + /// Returns the name of the attribute containing the number of buffers + /// located in the workgroup memory. + static StringRef getNumWorkgroupAttributionsAttrName() { + return "workgroup_attributions"; + } +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::LaunchOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::MemcpyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MemcpyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MemcpyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MemcpyOpGenericAdaptorBase(MemcpyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MemcpyOpGenericAdaptor : public detail::MemcpyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MemcpyOpGenericAdaptorBase; +public: + MemcpyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MemcpyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MemcpyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MemcpyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getDst() { + return (*getODSOperands(1).begin()); + } + + ValueT getSrc() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MemcpyOpAdaptor : public MemcpyOpGenericAdaptor<::mlir::ValueRange> { +public: + using MemcpyOpGenericAdaptor::MemcpyOpGenericAdaptor; + MemcpyOpAdaptor(MemcpyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MemcpyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MemcpyOpAdaptor; + template + using GenericAdaptor = MemcpyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.memcpy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::MemRefType> getDst(); + ::mlir::TypedValue<::mlir::MemRefType> getSrc(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::OpOperand &getSrcMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value dst, ::mlir::Value src); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value dst, ::mlir::Value src); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::MemcpyOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::MemsetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MemsetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MemsetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MemsetOpGenericAdaptorBase(MemsetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MemsetOpGenericAdaptor : public detail::MemsetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MemsetOpGenericAdaptorBase; +public: + MemsetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MemsetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MemsetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MemsetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getDst() { + return (*getODSOperands(1).begin()); + } + + ValueT getValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MemsetOpAdaptor : public MemsetOpGenericAdaptor<::mlir::ValueRange> { +public: + using MemsetOpGenericAdaptor::MemsetOpGenericAdaptor; + MemsetOpAdaptor(MemsetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MemsetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MemsetOpAdaptor; + template + using GenericAdaptor = MemsetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.memset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::TypedValue<::mlir::MemRefType> getDst(); + ::mlir::Value getValue(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value dst, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value dst, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::MemsetOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::ModuleEndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ModuleEndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ModuleEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ModuleEndOpGenericAdaptorBase(ModuleEndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ModuleEndOpGenericAdaptor : public detail::ModuleEndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ModuleEndOpGenericAdaptorBase; +public: + ModuleEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ModuleEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ModuleEndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ModuleEndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ModuleEndOpAdaptor : public ModuleEndOpGenericAdaptor<::mlir::ValueRange> { +public: + using ModuleEndOpGenericAdaptor::ModuleEndOpGenericAdaptor; + ModuleEndOpAdaptor(ModuleEndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ModuleEndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = ModuleEndOpAdaptor; + template + using GenericAdaptor = ModuleEndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.module_end"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::ModuleEndOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::NumSubgroupsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NumSubgroupsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NumSubgroupsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NumSubgroupsOpGenericAdaptorBase(NumSubgroupsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NumSubgroupsOpGenericAdaptor : public detail::NumSubgroupsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NumSubgroupsOpGenericAdaptorBase; +public: + NumSubgroupsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NumSubgroupsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NumSubgroupsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NumSubgroupsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NumSubgroupsOpAdaptor : public NumSubgroupsOpGenericAdaptor<::mlir::ValueRange> { +public: + using NumSubgroupsOpGenericAdaptor::NumSubgroupsOpGenericAdaptor; + NumSubgroupsOpAdaptor(NumSubgroupsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NumSubgroupsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NumSubgroupsOpAdaptor; + template + using GenericAdaptor = NumSubgroupsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.num_subgroups"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::NumSubgroupsOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::PrintfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrintfOpGenericAdaptorBase { +public: + struct Properties { + using formatTy = ::mlir::StringAttr; + formatTy format; + + auto getFormat() { + auto &propStorage = this->format; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setFormat(const ::mlir::StringAttr &propValue) { + this->format = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.format == this->format && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PrintfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PrintfOpGenericAdaptorBase(PrintfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getFormatAttr(); + ::llvm::StringRef getFormat(); +}; +} // namespace detail +template +class PrintfOpGenericAdaptor : public detail::PrintfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrintfOpGenericAdaptorBase; +public: + PrintfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrintfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrintfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PrintfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrintfOpAdaptor : public PrintfOpGenericAdaptor<::mlir::ValueRange> { +public: + using PrintfOpGenericAdaptor::PrintfOpGenericAdaptor; + PrintfOpAdaptor(PrintfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrintfOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = PrintfOpAdaptor; + template + using GenericAdaptor = PrintfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFormatAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.printf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getFormatAttr(); + ::llvm::StringRef getFormat(); + void setFormatAttr(::mlir::StringAttr attr); + void setFormat(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr format, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr format, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef format, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef format, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::PrintfOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::ReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReturnOpGenericAdaptorBase(ReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReturnOpGenericAdaptorBase; +public: + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor; + ReturnOpAdaptor(ReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReturnOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReturnOpAdaptor; + template + using GenericAdaptor = ReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::ReturnOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SDDMMBufferSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SDDMMBufferSizeOpGenericAdaptorBase { +public: + struct Properties { + using computeTypeTy = ::mlir::TypeAttr; + computeTypeTy computeType; + + auto getComputeType() { + auto &propStorage = this->computeType; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setComputeType(const ::mlir::TypeAttr &propValue) { + this->computeType = propValue; + } + using modeATy = ::mlir::gpu::TransposeModeAttr; + modeATy modeA; + + auto getModeA() { + auto &propStorage = this->modeA; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeA(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeA = propValue; + } + using modeBTy = ::mlir::gpu::TransposeModeAttr; + modeBTy modeB; + + auto getModeB() { + auto &propStorage = this->modeB; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeB(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeB = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.computeType == this->computeType && + rhs.modeA == this->modeA && + rhs.modeB == this->modeB && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SDDMMBufferSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SDDMMBufferSizeOpGenericAdaptorBase(SDDMMBufferSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); +}; +} // namespace detail +template +class SDDMMBufferSizeOpGenericAdaptor : public detail::SDDMMBufferSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SDDMMBufferSizeOpGenericAdaptorBase; +public: + SDDMMBufferSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SDDMMBufferSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SDDMMBufferSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SDDMMBufferSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getDnmatA() { + return (*getODSOperands(1).begin()); + } + + ValueT getDnmatB() { + return (*getODSOperands(2).begin()); + } + + ValueT getSpmatC() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SDDMMBufferSizeOpAdaptor : public SDDMMBufferSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SDDMMBufferSizeOpGenericAdaptor::SDDMMBufferSizeOpGenericAdaptor; + SDDMMBufferSizeOpAdaptor(SDDMMBufferSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SDDMMBufferSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SDDMMBufferSizeOpAdaptor; + template + using GenericAdaptor = SDDMMBufferSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("computeType"), ::llvm::StringRef("modeA"), ::llvm::StringRef("modeB")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComputeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComputeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getModeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getModeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeBAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.sddmm_buffer_size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getDnmatA(); + ::mlir::Value getDnmatB(); + ::mlir::Value getSpmatC(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getDnmatAMutable(); + ::mlir::OpOperand &getDnmatBMutable(); + ::mlir::OpOperand &getSpmatCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getBufferSz(); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); + void setModeAAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeA(::mlir::gpu::TransposeMode attrValue); + void setModeBAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeB(::mlir::gpu::TransposeMode attrValue); + void setComputeTypeAttr(::mlir::TypeAttr attr); + void setComputeType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type bufferSz, Type asyncToken, ValueRange asyncDependencies, Value dnmatA, Value dnmatB, Value spmatC, Type computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::Type computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::Type computeType); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SDDMMBufferSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SDDMMOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SDDMMOpGenericAdaptorBase { +public: + struct Properties { + using computeTypeTy = ::mlir::TypeAttr; + computeTypeTy computeType; + + auto getComputeType() { + auto &propStorage = this->computeType; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setComputeType(const ::mlir::TypeAttr &propValue) { + this->computeType = propValue; + } + using modeATy = ::mlir::gpu::TransposeModeAttr; + modeATy modeA; + + auto getModeA() { + auto &propStorage = this->modeA; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeA(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeA = propValue; + } + using modeBTy = ::mlir::gpu::TransposeModeAttr; + modeBTy modeB; + + auto getModeB() { + auto &propStorage = this->modeB; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeB(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeB = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.computeType == this->computeType && + rhs.modeA == this->modeA && + rhs.modeB == this->modeB && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SDDMMOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SDDMMOpGenericAdaptorBase(SDDMMOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); +}; +} // namespace detail +template +class SDDMMOpGenericAdaptor : public detail::SDDMMOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SDDMMOpGenericAdaptorBase; +public: + SDDMMOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SDDMMOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SDDMMOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SDDMMOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getDnmatA() { + return (*getODSOperands(1).begin()); + } + + ValueT getDnmatB() { + return (*getODSOperands(2).begin()); + } + + ValueT getSpmatC() { + return (*getODSOperands(3).begin()); + } + + ValueT getBuffer() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SDDMMOpAdaptor : public SDDMMOpGenericAdaptor<::mlir::ValueRange> { +public: + using SDDMMOpGenericAdaptor::SDDMMOpGenericAdaptor; + SDDMMOpAdaptor(SDDMMOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SDDMMOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SDDMMOpAdaptor; + template + using GenericAdaptor = SDDMMOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("computeType"), ::llvm::StringRef("modeA"), ::llvm::StringRef("modeB")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComputeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComputeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getModeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getModeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeBAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.sddmm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getDnmatA(); + ::mlir::Value getDnmatB(); + ::mlir::Value getSpmatC(); + ::mlir::TypedValue<::mlir::MemRefType> getBuffer(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getDnmatAMutable(); + ::mlir::OpOperand &getDnmatBMutable(); + ::mlir::OpOperand &getSpmatCMutable(); + ::mlir::OpOperand &getBufferMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); + void setModeAAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeA(::mlir::gpu::TransposeMode attrValue); + void setModeBAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeB(::mlir::gpu::TransposeMode attrValue); + void setComputeTypeAttr(::mlir::TypeAttr attr); + void setComputeType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type asyncToken, ValueRange asyncDependencies, Value dnmatA, Value dnmatB, Value spmatC, Type computeType, Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::Type computeType, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value dnmatA, ::mlir::Value dnmatB, ::mlir::Value spmatC, ::mlir::Type computeType, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SDDMMOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SetCsrPointersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SetCsrPointersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SetCsrPointersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SetCsrPointersOpGenericAdaptorBase(SetCsrPointersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SetCsrPointersOpGenericAdaptor : public detail::SetCsrPointersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SetCsrPointersOpGenericAdaptorBase; +public: + SetCsrPointersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SetCsrPointersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SetCsrPointersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SetCsrPointersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getSpmat() { + return (*getODSOperands(1).begin()); + } + + ValueT getPositions() { + return (*getODSOperands(2).begin()); + } + + ValueT getCoordinates() { + return (*getODSOperands(3).begin()); + } + + ValueT getValues() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SetCsrPointersOpAdaptor : public SetCsrPointersOpGenericAdaptor<::mlir::ValueRange> { +public: + using SetCsrPointersOpGenericAdaptor::SetCsrPointersOpGenericAdaptor; + SetCsrPointersOpAdaptor(SetCsrPointersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SetCsrPointersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SetCsrPointersOpAdaptor; + template + using GenericAdaptor = SetCsrPointersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.set_csr_pointers"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getSpmat(); + ::mlir::TypedValue<::mlir::MemRefType> getPositions(); + ::mlir::TypedValue<::mlir::MemRefType> getCoordinates(); + ::mlir::TypedValue<::mlir::MemRefType> getValues(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getSpmatMutable(); + ::mlir::OpOperand &getPositionsMutable(); + ::mlir::OpOperand &getCoordinatesMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat, ::mlir::Value positions, ::mlir::Value coordinates, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat, ::mlir::Value positions, ::mlir::Value coordinates, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SetCsrPointersOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SetDefaultDeviceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SetDefaultDeviceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SetDefaultDeviceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SetDefaultDeviceOpGenericAdaptorBase(SetDefaultDeviceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SetDefaultDeviceOpGenericAdaptor : public detail::SetDefaultDeviceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SetDefaultDeviceOpGenericAdaptorBase; +public: + SetDefaultDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SetDefaultDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SetDefaultDeviceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SetDefaultDeviceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDevIndex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SetDefaultDeviceOpAdaptor : public SetDefaultDeviceOpGenericAdaptor<::mlir::ValueRange> { +public: + using SetDefaultDeviceOpGenericAdaptor::SetDefaultDeviceOpGenericAdaptor; + SetDefaultDeviceOpAdaptor(SetDefaultDeviceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SetDefaultDeviceOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SetDefaultDeviceOpAdaptor; + template + using GenericAdaptor = SetDefaultDeviceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.set_default_device"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getDevIndex(); + ::mlir::OpOperand &getDevIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value devIndex); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value devIndex); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SetDefaultDeviceOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::ShuffleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShuffleOpGenericAdaptorBase { +public: + struct Properties { + using modeTy = ::mlir::gpu::ShuffleModeAttr; + modeTy mode; + + auto getMode() { + auto &propStorage = this->mode; + return ::llvm::cast<::mlir::gpu::ShuffleModeAttr>(propStorage); + } + void setMode(const ::mlir::gpu::ShuffleModeAttr &propValue) { + this->mode = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.mode == this->mode && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ShuffleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ShuffleOpGenericAdaptorBase(ShuffleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::ShuffleModeAttr getModeAttr(); + ::mlir::gpu::ShuffleMode getMode(); +}; +} // namespace detail +template +class ShuffleOpGenericAdaptor : public detail::ShuffleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShuffleOpGenericAdaptorBase; +public: + ShuffleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShuffleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShuffleOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ShuffleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(1).begin()); + } + + ValueT getWidth() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShuffleOpAdaptor : public ShuffleOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShuffleOpGenericAdaptor::ShuffleOpGenericAdaptor; + ShuffleOpAdaptor(ShuffleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShuffleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShuffleOpAdaptor; + template + using GenericAdaptor = ShuffleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("mode")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.shuffle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getWidth(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getWidthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getShuffleResult(); + ::mlir::TypedValue<::mlir::IntegerType> getValid(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::ShuffleModeAttr getModeAttr(); + ::mlir::gpu::ShuffleMode getMode(); + void setModeAttr(::mlir::gpu::ShuffleModeAttr attr); + void setMode(::mlir::gpu::ShuffleMode attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value, int32_t offset, int32_t width, ShuffleMode mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type shuffleResult, ::mlir::Type valid, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleModeAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleModeAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleModeAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type shuffleResult, ::mlir::Type valid, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleMode mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleMode mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value offset, ::mlir::Value width, ::mlir::gpu::ShuffleMode mode); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::ShuffleOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpGEMMCopyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpGEMMCopyOpGenericAdaptorBase { +public: + struct Properties { + using computeTypeTy = ::mlir::TypeAttr; + computeTypeTy computeType; + + auto getComputeType() { + auto &propStorage = this->computeType; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setComputeType(const ::mlir::TypeAttr &propValue) { + this->computeType = propValue; + } + using modeATy = ::mlir::gpu::TransposeModeAttr; + modeATy modeA; + + auto getModeA() { + auto &propStorage = this->modeA; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeA(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeA = propValue; + } + using modeBTy = ::mlir::gpu::TransposeModeAttr; + modeBTy modeB; + + auto getModeB() { + auto &propStorage = this->modeB; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeB(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeB = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.computeType == this->computeType && + rhs.modeA == this->modeA && + rhs.modeB == this->modeB && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SpGEMMCopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SpGEMMCopyOpGenericAdaptorBase(SpGEMMCopyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); +}; +} // namespace detail +template +class SpGEMMCopyOpGenericAdaptor : public detail::SpGEMMCopyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpGEMMCopyOpGenericAdaptorBase; +public: + SpGEMMCopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpGEMMCopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpGEMMCopyOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SpGEMMCopyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getDesc() { + return (*getODSOperands(1).begin()); + } + + ValueT getSpmatA() { + return (*getODSOperands(2).begin()); + } + + ValueT getSpmatB() { + return (*getODSOperands(3).begin()); + } + + ValueT getSpmatC() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpGEMMCopyOpAdaptor : public SpGEMMCopyOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpGEMMCopyOpGenericAdaptor::SpGEMMCopyOpGenericAdaptor; + SpGEMMCopyOpAdaptor(SpGEMMCopyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpGEMMCopyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpGEMMCopyOpAdaptor; + template + using GenericAdaptor = SpGEMMCopyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("computeType"), ::llvm::StringRef("modeA"), ::llvm::StringRef("modeB")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComputeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComputeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getModeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getModeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeBAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.spgemm_copy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getDesc(); + ::mlir::Value getSpmatA(); + ::mlir::Value getSpmatB(); + ::mlir::Value getSpmatC(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getDescMutable(); + ::mlir::OpOperand &getSpmatAMutable(); + ::mlir::OpOperand &getSpmatBMutable(); + ::mlir::OpOperand &getSpmatCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); + void setModeAAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeA(::mlir::gpu::TransposeMode attrValue); + void setModeBAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeB(::mlir::gpu::TransposeMode attrValue); + void setComputeTypeAttr(::mlir::TypeAttr attr); + void setComputeType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type asyncToken, ValueRange asyncDependencies, Value desc, Value spmatA, Value spmatB, Value spmatC, Type computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::Type computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::Type computeType); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMCopyOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpGEMMCreateDescrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpGEMMCreateDescrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SpGEMMCreateDescrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SpGEMMCreateDescrOpGenericAdaptorBase(SpGEMMCreateDescrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SpGEMMCreateDescrOpGenericAdaptor : public detail::SpGEMMCreateDescrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpGEMMCreateDescrOpGenericAdaptorBase; +public: + SpGEMMCreateDescrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpGEMMCreateDescrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpGEMMCreateDescrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SpGEMMCreateDescrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpGEMMCreateDescrOpAdaptor : public SpGEMMCreateDescrOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpGEMMCreateDescrOpGenericAdaptor::SpGEMMCreateDescrOpGenericAdaptor; + SpGEMMCreateDescrOpAdaptor(SpGEMMCreateDescrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpGEMMCreateDescrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpGEMMCreateDescrOpAdaptor; + template + using GenericAdaptor = SpGEMMCreateDescrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.spgemm_create_descr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getDesc(); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type desc, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMCreateDescrOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpGEMMDestroyDescrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpGEMMDestroyDescrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SpGEMMDestroyDescrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SpGEMMDestroyDescrOpGenericAdaptorBase(SpGEMMDestroyDescrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SpGEMMDestroyDescrOpGenericAdaptor : public detail::SpGEMMDestroyDescrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpGEMMDestroyDescrOpGenericAdaptorBase; +public: + SpGEMMDestroyDescrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpGEMMDestroyDescrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpGEMMDestroyDescrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SpGEMMDestroyDescrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getDesc() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpGEMMDestroyDescrOpAdaptor : public SpGEMMDestroyDescrOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpGEMMDestroyDescrOpGenericAdaptor::SpGEMMDestroyDescrOpGenericAdaptor; + SpGEMMDestroyDescrOpAdaptor(SpGEMMDestroyDescrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpGEMMDestroyDescrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpGEMMDestroyDescrOpAdaptor; + template + using GenericAdaptor = SpGEMMDestroyDescrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.spgemm_destroy_descr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getDesc(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getDescMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMDestroyDescrOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpGEMMWorkEstimationOrComputeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase { +public: + struct Properties { + using computeTypeTy = ::mlir::TypeAttr; + computeTypeTy computeType; + + auto getComputeType() { + auto &propStorage = this->computeType; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setComputeType(const ::mlir::TypeAttr &propValue) { + this->computeType = propValue; + } + using kindTy = ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr; + kindTy kind; + + auto getKind() { + auto &propStorage = this->kind; + return ::llvm::cast<::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr>(propStorage); + } + void setKind(const ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr &propValue) { + this->kind = propValue; + } + using modeATy = ::mlir::gpu::TransposeModeAttr; + modeATy modeA; + + auto getModeA() { + auto &propStorage = this->modeA; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeA(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeA = propValue; + } + using modeBTy = ::mlir::gpu::TransposeModeAttr; + modeBTy modeB; + + auto getModeB() { + auto &propStorage = this->modeB; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeB(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeB = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.computeType == this->computeType && + rhs.kind == this->kind && + rhs.modeA == this->modeA && + rhs.modeB == this->modeB && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase(SpGEMMWorkEstimationOrComputeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); + ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr getKindAttr(); + ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind getKind(); +}; +} // namespace detail +template +class SpGEMMWorkEstimationOrComputeOpGenericAdaptor : public detail::SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpGEMMWorkEstimationOrComputeOpGenericAdaptorBase; +public: + SpGEMMWorkEstimationOrComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpGEMMWorkEstimationOrComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpGEMMWorkEstimationOrComputeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SpGEMMWorkEstimationOrComputeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getDesc() { + return (*getODSOperands(1).begin()); + } + + ValueT getSpmatA() { + return (*getODSOperands(2).begin()); + } + + ValueT getSpmatB() { + return (*getODSOperands(3).begin()); + } + + ValueT getSpmatC() { + return (*getODSOperands(4).begin()); + } + + ValueT getBufferSz() { + return (*getODSOperands(5).begin()); + } + + ValueT getBuffer() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpGEMMWorkEstimationOrComputeOpAdaptor : public SpGEMMWorkEstimationOrComputeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpGEMMWorkEstimationOrComputeOpGenericAdaptor::SpGEMMWorkEstimationOrComputeOpGenericAdaptor; + SpGEMMWorkEstimationOrComputeOpAdaptor(SpGEMMWorkEstimationOrComputeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpGEMMWorkEstimationOrComputeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpGEMMWorkEstimationOrComputeOpAdaptor; + template + using GenericAdaptor = SpGEMMWorkEstimationOrComputeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("computeType"), ::llvm::StringRef("kind"), ::llvm::StringRef("modeA"), ::llvm::StringRef("modeB")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComputeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComputeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKindAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKindAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeAAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getModeBAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getModeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.spgemm_work_estimation_or_compute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getDesc(); + ::mlir::Value getSpmatA(); + ::mlir::Value getSpmatB(); + ::mlir::Value getSpmatC(); + ::mlir::TypedValue<::mlir::IndexType> getBufferSz(); + ::mlir::TypedValue<::mlir::MemRefType> getBuffer(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getDescMutable(); + ::mlir::OpOperand &getSpmatAMutable(); + ::mlir::OpOperand &getSpmatBMutable(); + ::mlir::OpOperand &getSpmatCMutable(); + ::mlir::OpOperand &getBufferSzMutable(); + ::mlir::OpOperand &getBufferMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getBufferSzNew(); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); + ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr getKindAttr(); + ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind getKind(); + void setModeAAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeA(::mlir::gpu::TransposeMode attrValue); + void setModeBAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeB(::mlir::gpu::TransposeMode attrValue); + void setComputeTypeAttr(::mlir::TypeAttr attr); + void setComputeType(::mlir::Type attrValue); + void setKindAttr(::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr attr); + void setKind(::mlir::gpu::SpGEMMWorkEstimationOrComputeKind attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type bufferSzNew, Type asyncToken, ValueRange asyncDependencies, Value desc, Value spmatA, Value spmatB, Value spmatC, Type computeType, Value bufferSz, Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSzNew, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType, ::mlir::Value bufferSz, ::mlir::Value buffer, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr kind); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::TypeAttr computeType, ::mlir::Value bufferSz, ::mlir::Value buffer, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr kind); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSzNew, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::Type computeType, ::mlir::Value bufferSz, ::mlir::Value buffer, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind kind); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value desc, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value spmatB, ::mlir::Value spmatC, ::mlir::Type computeType, ::mlir::Value bufferSz, ::mlir::Value buffer, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind kind); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMWorkEstimationOrComputeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMMBufferSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpMMBufferSizeOpGenericAdaptorBase { +public: + struct Properties { + using computeTypeTy = ::mlir::TypeAttr; + computeTypeTy computeType; + + auto getComputeType() { + auto &propStorage = this->computeType; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setComputeType(const ::mlir::TypeAttr &propValue) { + this->computeType = propValue; + } + using modeATy = ::mlir::gpu::TransposeModeAttr; + modeATy modeA; + + auto getModeA() { + auto &propStorage = this->modeA; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeA(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeA = propValue; + } + using modeBTy = ::mlir::gpu::TransposeModeAttr; + modeBTy modeB; + + auto getModeB() { + auto &propStorage = this->modeB; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeB(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeB = propValue; + } + using resultSegmentSizesTy = std::array; + resultSegmentSizesTy resultSegmentSizes; + ::llvm::ArrayRef getResultSegmentSizes() { + auto &propStorage = this->resultSegmentSizes; + return propStorage; + } + void setResultSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->resultSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.computeType == this->computeType && + rhs.modeA == this->modeA && + rhs.modeB == this->modeB && + rhs.resultSegmentSizes == this->resultSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SpMMBufferSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SpMMBufferSizeOpGenericAdaptorBase(SpMMBufferSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); +}; +} // namespace detail +template +class SpMMBufferSizeOpGenericAdaptor : public detail::SpMMBufferSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpMMBufferSizeOpGenericAdaptorBase; +public: + SpMMBufferSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpMMBufferSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpMMBufferSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SpMMBufferSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getSpmatA() { + return (*getODSOperands(1).begin()); + } + + ValueT getDnmatB() { + return (*getODSOperands(2).begin()); + } + + ValueT getDnmatC() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpMMBufferSizeOpAdaptor : public SpMMBufferSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpMMBufferSizeOpGenericAdaptor::SpMMBufferSizeOpGenericAdaptor; + SpMMBufferSizeOpAdaptor(SpMMBufferSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpMMBufferSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedResultSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpMMBufferSizeOpAdaptor; + template + using GenericAdaptor = SpMMBufferSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("computeType"), ::llvm::StringRef("modeA"), ::llvm::StringRef("modeB")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComputeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComputeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getModeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getModeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeBAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.spmm_buffer_size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getSpmatA(); + ::mlir::Value getDnmatB(); + ::mlir::Value getDnmatC(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getSpmatAMutable(); + ::mlir::OpOperand &getDnmatBMutable(); + ::mlir::OpOperand &getDnmatCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getBufferSzs(); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); + void setModeAAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeA(::mlir::gpu::TransposeMode attrValue); + void setModeBAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeB(::mlir::gpu::TransposeMode attrValue); + void setComputeTypeAttr(::mlir::TypeAttr attr); + void setComputeType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type bufferSzs, Type asyncToken, ValueRange asyncDependencies, Value spmatA, Value dnmatB, Value dnmatC, Type computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange bufferSzs, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::TypeAttr computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::TypeAttr computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange bufferSzs, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::Type computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::Type computeType); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMMBufferSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMMOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpMMOpGenericAdaptorBase { +public: + struct Properties { + using computeTypeTy = ::mlir::TypeAttr; + computeTypeTy computeType; + + auto getComputeType() { + auto &propStorage = this->computeType; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setComputeType(const ::mlir::TypeAttr &propValue) { + this->computeType = propValue; + } + using modeATy = ::mlir::gpu::TransposeModeAttr; + modeATy modeA; + + auto getModeA() { + auto &propStorage = this->modeA; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeA(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeA = propValue; + } + using modeBTy = ::mlir::gpu::TransposeModeAttr; + modeBTy modeB; + + auto getModeB() { + auto &propStorage = this->modeB; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeB(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeB = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.computeType == this->computeType && + rhs.modeA == this->modeA && + rhs.modeB == this->modeB && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SpMMOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SpMMOpGenericAdaptorBase(SpMMOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); +}; +} // namespace detail +template +class SpMMOpGenericAdaptor : public detail::SpMMOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpMMOpGenericAdaptorBase; +public: + SpMMOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpMMOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpMMOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SpMMOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getSpmatA() { + return (*getODSOperands(1).begin()); + } + + ValueT getDnmatB() { + return (*getODSOperands(2).begin()); + } + + ValueT getDnmatC() { + return (*getODSOperands(3).begin()); + } + + RangeT getBuffers() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpMMOpAdaptor : public SpMMOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpMMOpGenericAdaptor::SpMMOpGenericAdaptor; + SpMMOpAdaptor(SpMMOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpMMOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpMMOpAdaptor; + template + using GenericAdaptor = SpMMOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("computeType"), ::llvm::StringRef("modeA"), ::llvm::StringRef("modeB"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComputeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComputeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getModeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getModeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeBAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.spmm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getSpmatA(); + ::mlir::Value getDnmatB(); + ::mlir::Value getDnmatC(); + ::mlir::Operation::operand_range getBuffers(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getSpmatAMutable(); + ::mlir::OpOperand &getDnmatBMutable(); + ::mlir::OpOperand &getDnmatCMutable(); + ::mlir::MutableOperandRange getBuffersMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::gpu::TransposeModeAttr getModeBAttr(); + ::mlir::gpu::TransposeMode getModeB(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); + void setModeAAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeA(::mlir::gpu::TransposeMode attrValue); + void setModeBAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeB(::mlir::gpu::TransposeMode attrValue); + void setComputeTypeAttr(::mlir::TypeAttr attr); + void setComputeType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type asyncToken, ValueRange asyncDependencies, Value spmatA, Value dnmatB, Value dnmatC, Type computeType, ValueRange buffers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::TypeAttr computeType, ::mlir::ValueRange buffers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::gpu::TransposeModeAttr modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::TypeAttr computeType, ::mlir::ValueRange buffers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::Type computeType, ::mlir::ValueRange buffers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::gpu::TransposeMode modeB, ::mlir::Value spmatA, ::mlir::Value dnmatB, ::mlir::Value dnmatC, ::mlir::Type computeType, ::mlir::ValueRange buffers); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMMOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMVBufferSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpMVBufferSizeOpGenericAdaptorBase { +public: + struct Properties { + using computeTypeTy = ::mlir::TypeAttr; + computeTypeTy computeType; + + auto getComputeType() { + auto &propStorage = this->computeType; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setComputeType(const ::mlir::TypeAttr &propValue) { + this->computeType = propValue; + } + using modeATy = ::mlir::gpu::TransposeModeAttr; + modeATy modeA; + + auto getModeA() { + auto &propStorage = this->modeA; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeA(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeA = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.computeType == this->computeType && + rhs.modeA == this->modeA && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SpMVBufferSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SpMVBufferSizeOpGenericAdaptorBase(SpMVBufferSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); +}; +} // namespace detail +template +class SpMVBufferSizeOpGenericAdaptor : public detail::SpMVBufferSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpMVBufferSizeOpGenericAdaptorBase; +public: + SpMVBufferSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpMVBufferSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpMVBufferSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SpMVBufferSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getSpmatA() { + return (*getODSOperands(1).begin()); + } + + ValueT getDnX() { + return (*getODSOperands(2).begin()); + } + + ValueT getDnY() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpMVBufferSizeOpAdaptor : public SpMVBufferSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpMVBufferSizeOpGenericAdaptor::SpMVBufferSizeOpGenericAdaptor; + SpMVBufferSizeOpAdaptor(SpMVBufferSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpMVBufferSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpMVBufferSizeOpAdaptor; + template + using GenericAdaptor = SpMVBufferSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("computeType"), ::llvm::StringRef("modeA")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComputeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComputeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getModeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getModeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.spmv_buffer_size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getSpmatA(); + ::mlir::Value getDnX(); + ::mlir::Value getDnY(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getSpmatAMutable(); + ::mlir::OpOperand &getDnXMutable(); + ::mlir::OpOperand &getDnYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getBufferSz(); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); + void setModeAAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeA(::mlir::gpu::TransposeMode attrValue); + void setComputeTypeAttr(::mlir::TypeAttr attr); + void setComputeType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type bufferSz, Type asyncToken, ValueRange asyncDependencies, Value spmatA, Value dnX, Value dnY, Type computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::TypeAttr computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::TypeAttr computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bufferSz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::Type computeType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::Type computeType); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMVBufferSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMVOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpMVOpGenericAdaptorBase { +public: + struct Properties { + using computeTypeTy = ::mlir::TypeAttr; + computeTypeTy computeType; + + auto getComputeType() { + auto &propStorage = this->computeType; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setComputeType(const ::mlir::TypeAttr &propValue) { + this->computeType = propValue; + } + using modeATy = ::mlir::gpu::TransposeModeAttr; + modeATy modeA; + + auto getModeA() { + auto &propStorage = this->modeA; + return ::llvm::dyn_cast_or_null<::mlir::gpu::TransposeModeAttr>(propStorage); + } + void setModeA(const ::mlir::gpu::TransposeModeAttr &propValue) { + this->modeA = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.computeType == this->computeType && + rhs.modeA == this->modeA && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SpMVOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SpMVOpGenericAdaptorBase(SpMVOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); +}; +} // namespace detail +template +class SpMVOpGenericAdaptor : public detail::SpMVOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpMVOpGenericAdaptorBase; +public: + SpMVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpMVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpMVOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SpMVOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getSpmatA() { + return (*getODSOperands(1).begin()); + } + + ValueT getDnX() { + return (*getODSOperands(2).begin()); + } + + ValueT getDnY() { + return (*getODSOperands(3).begin()); + } + + ValueT getBuffer() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpMVOpAdaptor : public SpMVOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpMVOpGenericAdaptor::SpMVOpGenericAdaptor; + SpMVOpAdaptor(SpMVOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpMVOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::gpu::AsyncOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpMVOpAdaptor; + template + using GenericAdaptor = SpMVOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("computeType"), ::llvm::StringRef("modeA")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComputeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComputeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getModeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getModeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.spmv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getSpmatA(); + ::mlir::Value getDnX(); + ::mlir::Value getDnY(); + ::mlir::TypedValue<::mlir::MemRefType> getBuffer(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getSpmatAMutable(); + ::mlir::OpOperand &getDnXMutable(); + ::mlir::OpOperand &getDnYMutable(); + ::mlir::OpOperand &getBufferMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::TransposeModeAttr getModeAAttr(); + ::mlir::gpu::TransposeMode getModeA(); + ::mlir::TypeAttr getComputeTypeAttr(); + ::mlir::Type getComputeType(); + void setModeAAttr(::mlir::gpu::TransposeModeAttr attr); + void setModeA(::mlir::gpu::TransposeMode attrValue); + void setComputeTypeAttr(::mlir::TypeAttr attr); + void setComputeType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type asyncToken, ValueRange asyncDependencies, Value spmatA, Value dnX, Value dnY, Type computeType, Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::TypeAttr computeType, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeModeAttr modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::TypeAttr computeType, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::Type computeType, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::gpu::TransposeMode modeA, ::mlir::Value spmatA, ::mlir::Value dnX, ::mlir::Value dnY, ::mlir::Type computeType, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMVOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SpMatGetSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpMatGetSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SpMatGetSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SpMatGetSizeOpGenericAdaptorBase(SpMatGetSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SpMatGetSizeOpGenericAdaptor : public detail::SpMatGetSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpMatGetSizeOpGenericAdaptorBase; +public: + SpMatGetSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpMatGetSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpMatGetSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SpMatGetSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + ValueT getSpmat() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpMatGetSizeOpAdaptor : public SpMatGetSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpMatGetSizeOpGenericAdaptor::SpMatGetSizeOpGenericAdaptor; + SpMatGetSizeOpAdaptor(SpMatGetSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpMatGetSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::gpu::AsyncOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpMatGetSizeOpAdaptor; + template + using GenericAdaptor = SpMatGetSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.spmat_get_size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::Value getSpmat(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + ::mlir::OpOperand &getSpmatMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getRows(); + ::mlir::TypedValue<::mlir::IndexType> getCols(); + ::mlir::TypedValue<::mlir::IndexType> getNnz(); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rows, ::mlir::Type cols, ::mlir::Type nnz, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncDependencies, ::mlir::Value spmat); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpMatGetSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubgroupIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubgroupIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubgroupIdOpGenericAdaptorBase(SubgroupIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SubgroupIdOpGenericAdaptor : public detail::SubgroupIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubgroupIdOpGenericAdaptorBase; +public: + SubgroupIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubgroupIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubgroupIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubgroupIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubgroupIdOpAdaptor : public SubgroupIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubgroupIdOpGenericAdaptor::SubgroupIdOpGenericAdaptor; + SubgroupIdOpAdaptor(SubgroupIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubgroupIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubgroupIdOpAdaptor; + template + using GenericAdaptor = SubgroupIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.subgroup_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaComputeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubgroupMmaComputeOpGenericAdaptorBase { +public: + struct Properties { + using a_transposeTy = ::mlir::UnitAttr; + a_transposeTy a_transpose; + + auto getATranspose() { + auto &propStorage = this->a_transpose; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setATranspose(const ::mlir::UnitAttr &propValue) { + this->a_transpose = propValue; + } + using b_transposeTy = ::mlir::UnitAttr; + b_transposeTy b_transpose; + + auto getBTranspose() { + auto &propStorage = this->b_transpose; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setBTranspose(const ::mlir::UnitAttr &propValue) { + this->b_transpose = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.a_transpose == this->a_transpose && + rhs.b_transpose == this->b_transpose && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubgroupMmaComputeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubgroupMmaComputeOpGenericAdaptorBase(SubgroupMmaComputeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getATransposeAttr(); + ::std::optional getATranspose(); + ::mlir::UnitAttr getBTransposeAttr(); + ::std::optional getBTranspose(); +}; +} // namespace detail +template +class SubgroupMmaComputeOpGenericAdaptor : public detail::SubgroupMmaComputeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubgroupMmaComputeOpGenericAdaptorBase; +public: + SubgroupMmaComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubgroupMmaComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubgroupMmaComputeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubgroupMmaComputeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOpA() { + return (*getODSOperands(0).begin()); + } + + ValueT getOpB() { + return (*getODSOperands(1).begin()); + } + + ValueT getOpC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubgroupMmaComputeOpAdaptor : public SubgroupMmaComputeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubgroupMmaComputeOpGenericAdaptor::SubgroupMmaComputeOpGenericAdaptor; + SubgroupMmaComputeOpAdaptor(SubgroupMmaComputeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubgroupMmaComputeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubgroupMmaComputeOpAdaptor; + template + using GenericAdaptor = SubgroupMmaComputeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("a_transpose"), ::llvm::StringRef("b_transpose")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getATransposeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getATransposeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBTransposeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBTransposeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.subgroup_mma_compute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::gpu::MMAMatrixType> getOpA(); + ::mlir::TypedValue<::mlir::gpu::MMAMatrixType> getOpB(); + ::mlir::TypedValue<::mlir::gpu::MMAMatrixType> getOpC(); + ::mlir::OpOperand &getOpAMutable(); + ::mlir::OpOperand &getOpBMutable(); + ::mlir::OpOperand &getOpCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getATransposeAttr(); + ::std::optional getATranspose(); + ::mlir::UnitAttr getBTransposeAttr(); + ::std::optional getBTranspose(); + void setATransposeAttr(::mlir::UnitAttr attr); + void setATranspose(bool attrValue); + void setBTransposeAttr(::mlir::UnitAttr attr); + void setBTranspose(bool attrValue); + ::mlir::Attribute removeATransposeAttr(); + ::mlir::Attribute removeBTransposeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value opA, ::mlir::Value opB, ::mlir::Value opC, /*optional*/::mlir::UnitAttr a_transpose, /*optional*/::mlir::UnitAttr b_transpose); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value opA, ::mlir::Value opB, ::mlir::Value opC, /*optional*/::mlir::UnitAttr a_transpose, /*optional*/::mlir::UnitAttr b_transpose); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value opA, ::mlir::Value opB, ::mlir::Value opC, /*optional*/::mlir::UnitAttr a_transpose, /*optional*/::mlir::UnitAttr b_transpose); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaComputeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaConstantMatrixOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubgroupMmaConstantMatrixOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubgroupMmaConstantMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubgroupMmaConstantMatrixOpGenericAdaptorBase(SubgroupMmaConstantMatrixOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SubgroupMmaConstantMatrixOpGenericAdaptor : public detail::SubgroupMmaConstantMatrixOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubgroupMmaConstantMatrixOpGenericAdaptorBase; +public: + SubgroupMmaConstantMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubgroupMmaConstantMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubgroupMmaConstantMatrixOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubgroupMmaConstantMatrixOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubgroupMmaConstantMatrixOpAdaptor : public SubgroupMmaConstantMatrixOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubgroupMmaConstantMatrixOpGenericAdaptor::SubgroupMmaConstantMatrixOpGenericAdaptor; + SubgroupMmaConstantMatrixOpAdaptor(SubgroupMmaConstantMatrixOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubgroupMmaConstantMatrixOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubgroupMmaConstantMatrixOpAdaptor; + template + using GenericAdaptor = SubgroupMmaConstantMatrixOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.subgroup_mma_constant_matrix"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + gpu::MMAMatrixType getType() { + return ::llvm::cast(getRes().getType()); + } +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaConstantMatrixOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaElementwiseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubgroupMmaElementwiseOpGenericAdaptorBase { +public: + struct Properties { + using opTypeTy = ::mlir::gpu::MMAElementwiseOpAttr; + opTypeTy opType; + + auto getOpType() { + auto &propStorage = this->opType; + return ::llvm::cast<::mlir::gpu::MMAElementwiseOpAttr>(propStorage); + } + void setOpType(const ::mlir::gpu::MMAElementwiseOpAttr &propValue) { + this->opType = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.opType == this->opType && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubgroupMmaElementwiseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubgroupMmaElementwiseOpGenericAdaptorBase(SubgroupMmaElementwiseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::MMAElementwiseOpAttr getOpTypeAttr(); + ::mlir::gpu::MMAElementwiseOp getOpType(); +}; +} // namespace detail +template +class SubgroupMmaElementwiseOpGenericAdaptor : public detail::SubgroupMmaElementwiseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubgroupMmaElementwiseOpGenericAdaptorBase; +public: + SubgroupMmaElementwiseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubgroupMmaElementwiseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubgroupMmaElementwiseOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubgroupMmaElementwiseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubgroupMmaElementwiseOpAdaptor : public SubgroupMmaElementwiseOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubgroupMmaElementwiseOpGenericAdaptor::SubgroupMmaElementwiseOpGenericAdaptor; + SubgroupMmaElementwiseOpAdaptor(SubgroupMmaElementwiseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubgroupMmaElementwiseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubgroupMmaElementwiseOpAdaptor; + template + using GenericAdaptor = SubgroupMmaElementwiseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("opType")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOpTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOpTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.subgroup_mma_elementwise"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::MMAElementwiseOpAttr getOpTypeAttr(); + ::mlir::gpu::MMAElementwiseOp getOpType(); + void setOpTypeAttr(::mlir::gpu::MMAElementwiseOpAttr attr); + void setOpType(::mlir::gpu::MMAElementwiseOp attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args, ::mlir::gpu::MMAElementwiseOpAttr opType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::gpu::MMAElementwiseOpAttr opType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args, ::mlir::gpu::MMAElementwiseOp opType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::gpu::MMAElementwiseOp opType); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + gpu::MMAMatrixType getType() { + return ::llvm::cast(getRes().getType()); + } +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaElementwiseOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaLoadMatrixOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubgroupMmaLoadMatrixOpGenericAdaptorBase { +public: + struct Properties { + using leadDimensionTy = ::mlir::IntegerAttr; + leadDimensionTy leadDimension; + + auto getLeadDimension() { + auto &propStorage = this->leadDimension; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setLeadDimension(const ::mlir::IntegerAttr &propValue) { + this->leadDimension = propValue; + } + using transposeTy = ::mlir::UnitAttr; + transposeTy transpose; + + auto getTranspose() { + auto &propStorage = this->transpose; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setTranspose(const ::mlir::UnitAttr &propValue) { + this->transpose = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.leadDimension == this->leadDimension && + rhs.transpose == this->transpose && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubgroupMmaLoadMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubgroupMmaLoadMatrixOpGenericAdaptorBase(SubgroupMmaLoadMatrixOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLeadDimensionAttr(); + ::llvm::APInt getLeadDimension(); + ::mlir::UnitAttr getTransposeAttr(); + ::std::optional getTranspose(); +}; +} // namespace detail +template +class SubgroupMmaLoadMatrixOpGenericAdaptor : public detail::SubgroupMmaLoadMatrixOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubgroupMmaLoadMatrixOpGenericAdaptorBase; +public: + SubgroupMmaLoadMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubgroupMmaLoadMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubgroupMmaLoadMatrixOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubgroupMmaLoadMatrixOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubgroupMmaLoadMatrixOpAdaptor : public SubgroupMmaLoadMatrixOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubgroupMmaLoadMatrixOpGenericAdaptor::SubgroupMmaLoadMatrixOpGenericAdaptor; + SubgroupMmaLoadMatrixOpAdaptor(SubgroupMmaLoadMatrixOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubgroupMmaLoadMatrixOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubgroupMmaLoadMatrixOpAdaptor; + template + using GenericAdaptor = SubgroupMmaLoadMatrixOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("leadDimension"), ::llvm::StringRef("transpose")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLeadDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLeadDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTransposeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTransposeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.subgroup_mma_load_matrix"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSrcMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getSrcMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getLeadDimensionAttr(); + ::llvm::APInt getLeadDimension(); + ::mlir::UnitAttr getTransposeAttr(); + ::std::optional getTranspose(); + void setLeadDimensionAttr(::mlir::IntegerAttr attr); + void setLeadDimension(::llvm::APInt attrValue); + void setTransposeAttr(::mlir::UnitAttr attr); + void setTranspose(bool attrValue); + ::mlir::Attribute removeTransposeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::mlir::IntegerAttr leadDimension, /*optional*/::mlir::UnitAttr transpose); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::mlir::IntegerAttr leadDimension, /*optional*/::mlir::UnitAttr transpose); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::llvm::APInt leadDimension, /*optional*/::mlir::UnitAttr transpose); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::llvm::APInt leadDimension, /*optional*/::mlir::UnitAttr transpose); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaLoadMatrixOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupMmaStoreMatrixOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubgroupMmaStoreMatrixOpGenericAdaptorBase { +public: + struct Properties { + using leadDimensionTy = ::mlir::IntegerAttr; + leadDimensionTy leadDimension; + + auto getLeadDimension() { + auto &propStorage = this->leadDimension; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setLeadDimension(const ::mlir::IntegerAttr &propValue) { + this->leadDimension = propValue; + } + using transposeTy = ::mlir::UnitAttr; + transposeTy transpose; + + auto getTranspose() { + auto &propStorage = this->transpose; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setTranspose(const ::mlir::UnitAttr &propValue) { + this->transpose = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.leadDimension == this->leadDimension && + rhs.transpose == this->transpose && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubgroupMmaStoreMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubgroupMmaStoreMatrixOpGenericAdaptorBase(SubgroupMmaStoreMatrixOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLeadDimensionAttr(); + ::llvm::APInt getLeadDimension(); + ::mlir::UnitAttr getTransposeAttr(); + ::std::optional getTranspose(); +}; +} // namespace detail +template +class SubgroupMmaStoreMatrixOpGenericAdaptor : public detail::SubgroupMmaStoreMatrixOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubgroupMmaStoreMatrixOpGenericAdaptorBase; +public: + SubgroupMmaStoreMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubgroupMmaStoreMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubgroupMmaStoreMatrixOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubgroupMmaStoreMatrixOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getDstMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubgroupMmaStoreMatrixOpAdaptor : public SubgroupMmaStoreMatrixOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubgroupMmaStoreMatrixOpGenericAdaptor::SubgroupMmaStoreMatrixOpGenericAdaptor; + SubgroupMmaStoreMatrixOpAdaptor(SubgroupMmaStoreMatrixOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubgroupMmaStoreMatrixOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubgroupMmaStoreMatrixOpAdaptor; + template + using GenericAdaptor = SubgroupMmaStoreMatrixOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("leadDimension"), ::llvm::StringRef("transpose")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLeadDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLeadDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTransposeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTransposeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.subgroup_mma_store_matrix"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::gpu::MMAMatrixType> getSrc(); + ::mlir::TypedValue<::mlir::MemRefType> getDstMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getDstMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getLeadDimensionAttr(); + ::llvm::APInt getLeadDimension(); + ::mlir::UnitAttr getTransposeAttr(); + ::std::optional getTranspose(); + void setLeadDimensionAttr(::mlir::IntegerAttr attr); + void setLeadDimension(::llvm::APInt attrValue); + void setTransposeAttr(::mlir::UnitAttr attr); + void setTranspose(bool attrValue); + ::mlir::Attribute removeTransposeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::Value dstMemref, ::mlir::ValueRange indices, ::mlir::IntegerAttr leadDimension, /*optional*/::mlir::UnitAttr transpose); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value dstMemref, ::mlir::ValueRange indices, ::mlir::IntegerAttr leadDimension, /*optional*/::mlir::UnitAttr transpose); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::Value dstMemref, ::mlir::ValueRange indices, ::llvm::APInt leadDimension, /*optional*/::mlir::UnitAttr transpose); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value dstMemref, ::mlir::ValueRange indices, ::llvm::APInt leadDimension, /*optional*/::mlir::UnitAttr transpose); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupMmaStoreMatrixOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubgroupReduceOpGenericAdaptorBase { +public: + struct Properties { + using opTy = ::mlir::gpu::AllReduceOperationAttr; + opTy op; + + auto getOp() { + auto &propStorage = this->op; + return ::llvm::cast<::mlir::gpu::AllReduceOperationAttr>(propStorage); + } + void setOp(const ::mlir::gpu::AllReduceOperationAttr &propValue) { + this->op = propValue; + } + using uniformTy = ::mlir::UnitAttr; + uniformTy uniform; + + auto getUniform() { + auto &propStorage = this->uniform; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setUniform(const ::mlir::UnitAttr &propValue) { + this->uniform = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.op == this->op && + rhs.uniform == this->uniform && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubgroupReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubgroupReduceOpGenericAdaptorBase(SubgroupReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::AllReduceOperationAttr getOpAttr(); + ::mlir::gpu::AllReduceOperation getOp(); + ::mlir::UnitAttr getUniformAttr(); + bool getUniform(); +}; +} // namespace detail +template +class SubgroupReduceOpGenericAdaptor : public detail::SubgroupReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubgroupReduceOpGenericAdaptorBase; +public: + SubgroupReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubgroupReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubgroupReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubgroupReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubgroupReduceOpAdaptor : public SubgroupReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubgroupReduceOpGenericAdaptor::SubgroupReduceOpGenericAdaptor; + SubgroupReduceOpAdaptor(SubgroupReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubgroupReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubgroupReduceOpAdaptor; + template + using GenericAdaptor = SubgroupReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("op"), ::llvm::StringRef("uniform")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOpAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUniformAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUniformAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.subgroup_reduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::AllReduceOperationAttr getOpAttr(); + ::mlir::gpu::AllReduceOperation getOp(); + ::mlir::UnitAttr getUniformAttr(); + bool getUniform(); + void setOpAttr(::mlir::gpu::AllReduceOperationAttr attr); + void setOp(::mlir::gpu::AllReduceOperation attrValue); + void setUniformAttr(::mlir::UnitAttr attr); + void setUniform(bool attrValue); + ::mlir::Attribute removeUniformAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value value, ::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::gpu::AllReduceOperationAttr op, /*optional*/::mlir::UnitAttr uniform); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value value, ::mlir::gpu::AllReduceOperation op, /*optional*/bool uniform = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::gpu::AllReduceOperation op, /*optional*/bool uniform = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::gpu::AllReduceOperation op, /*optional*/bool uniform = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupReduceOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::SubgroupSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubgroupSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubgroupSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubgroupSizeOpGenericAdaptorBase(SubgroupSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SubgroupSizeOpGenericAdaptor : public detail::SubgroupSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubgroupSizeOpGenericAdaptorBase; +public: + SubgroupSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubgroupSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubgroupSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubgroupSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubgroupSizeOpAdaptor : public SubgroupSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubgroupSizeOpGenericAdaptor::SubgroupSizeOpGenericAdaptor; + SubgroupSizeOpAdaptor(SubgroupSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubgroupSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubgroupSizeOpAdaptor; + template + using GenericAdaptor = SubgroupSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.subgroup_size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SubgroupSizeOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::TerminatorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TerminatorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TerminatorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TerminatorOpGenericAdaptorBase(TerminatorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TerminatorOpGenericAdaptor : public detail::TerminatorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TerminatorOpGenericAdaptorBase; +public: + TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TerminatorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TerminatorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TerminatorOpAdaptor : public TerminatorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TerminatorOpGenericAdaptor::TerminatorOpGenericAdaptor; + TerminatorOpAdaptor(TerminatorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TerminatorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = TerminatorOpAdaptor; + template + using GenericAdaptor = TerminatorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.terminator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::TerminatorOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::ThreadIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ThreadIdOpGenericAdaptorBase { +public: + struct Properties { + using dimensionTy = ::mlir::gpu::DimensionAttr; + dimensionTy dimension; + + auto getDimension() { + auto &propStorage = this->dimension; + return ::llvm::cast<::mlir::gpu::DimensionAttr>(propStorage); + } + void setDimension(const ::mlir::gpu::DimensionAttr &propValue) { + this->dimension = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dimension == this->dimension && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ThreadIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ThreadIdOpGenericAdaptorBase(ThreadIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); +}; +} // namespace detail +template +class ThreadIdOpGenericAdaptor : public detail::ThreadIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ThreadIdOpGenericAdaptorBase; +public: + ThreadIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ThreadIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ThreadIdOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ThreadIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ThreadIdOpAdaptor : public ThreadIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ThreadIdOpGenericAdaptor::ThreadIdOpGenericAdaptor; + ThreadIdOpAdaptor(ThreadIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ThreadIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ThreadIdOpAdaptor; + template + using GenericAdaptor = ThreadIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.thread_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::gpu::DimensionAttr getDimensionAttr(); + ::mlir::gpu::Dimension getDimension(); + void setDimensionAttr(::mlir::gpu::DimensionAttr attr); + void setDimension(::mlir::gpu::Dimension attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::DimensionAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::gpu::Dimension dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::ThreadIdOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::WaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WaitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WaitOpGenericAdaptorBase(WaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WaitOpGenericAdaptor : public detail::WaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WaitOpGenericAdaptorBase; +public: + WaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WaitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAsyncDependencies() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WaitOpAdaptor : public WaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using WaitOpGenericAdaptor::WaitOpGenericAdaptor; + WaitOpAdaptor(WaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WaitOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = WaitOpAdaptor; + template + using GenericAdaptor = WaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.wait"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAsyncDependencies(); + ::mlir::MutableOperandRange getAsyncDependenciesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type asyncToken, ::mlir::ValueRange asyncDependencies); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::WaitOp) + +namespace mlir { +namespace gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::gpu::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getValues() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gpu.yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getValues(); + ::mlir::MutableOperandRange getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsAttributes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsAttributes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..c6378df886918e2cfa5cbbbcd9a33c91fa6a5a12 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsAttributes.cpp.inc @@ -0,0 +1,1558 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::gpu::GPUBlockMappingAttr, +::mlir::gpu::GPUMemorySpaceMappingAttr, +::mlir::gpu::GPUThreadMappingAttr, +::mlir::gpu::GPUWarpMappingAttr, +::mlir::gpu::GPUWarpgroupMappingAttr, +::mlir::gpu::AddressSpaceAttr, +::mlir::gpu::AllReduceOperationAttr, +::mlir::gpu::DimensionAttr, +::mlir::gpu::ObjectAttr, +::mlir::gpu::Prune2To4SpMatFlagAttr, +::mlir::gpu::SelectObjectAttr, +::mlir::gpu::ShuffleModeAttr, +::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr, +::mlir::gpu::TransposeModeAttr, +::mlir::gpu::MMAElementwiseOpAttr, +::mlir::gpu::ParallelLoopDimMappingAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::gpu::GPUBlockMappingAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::GPUBlockMappingAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::GPUMemorySpaceMappingAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::GPUMemorySpaceMappingAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::GPUThreadMappingAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::GPUThreadMappingAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::GPUWarpMappingAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::GPUWarpMappingAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::GPUWarpgroupMappingAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::GPUWarpgroupMappingAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::AddressSpaceAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::AddressSpaceAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::AllReduceOperationAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::AllReduceOperationAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::DimensionAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::DimensionAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::ObjectAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::ObjectAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::Prune2To4SpMatFlagAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::Prune2To4SpMatFlagAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::SelectObjectAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::SelectObjectAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::ShuffleModeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::ShuffleModeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::TransposeModeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::TransposeModeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::MMAElementwiseOpAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::MMAElementwiseOpAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::gpu::ParallelLoopDimMappingAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::gpu::ParallelLoopDimMappingAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::gpu::GPUBlockMappingAttr>([&](auto t) { + printer << ::mlir::gpu::GPUBlockMappingAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::GPUMemorySpaceMappingAttr>([&](auto t) { + printer << ::mlir::gpu::GPUMemorySpaceMappingAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::GPUThreadMappingAttr>([&](auto t) { + printer << ::mlir::gpu::GPUThreadMappingAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::GPUWarpMappingAttr>([&](auto t) { + printer << ::mlir::gpu::GPUWarpMappingAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::GPUWarpgroupMappingAttr>([&](auto t) { + printer << ::mlir::gpu::GPUWarpgroupMappingAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::AddressSpaceAttr>([&](auto t) { + printer << ::mlir::gpu::AddressSpaceAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::AllReduceOperationAttr>([&](auto t) { + printer << ::mlir::gpu::AllReduceOperationAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::DimensionAttr>([&](auto t) { + printer << ::mlir::gpu::DimensionAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::ObjectAttr>([&](auto t) { + printer << ::mlir::gpu::ObjectAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::Prune2To4SpMatFlagAttr>([&](auto t) { + printer << ::mlir::gpu::Prune2To4SpMatFlagAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::SelectObjectAttr>([&](auto t) { + printer << ::mlir::gpu::SelectObjectAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::ShuffleModeAttr>([&](auto t) { + printer << ::mlir::gpu::ShuffleModeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr>([&](auto t) { + printer << ::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::TransposeModeAttr>([&](auto t) { + printer << ::mlir::gpu::TransposeModeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::MMAElementwiseOpAttr>([&](auto t) { + printer << ::mlir::gpu::MMAElementwiseOpAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::gpu::ParallelLoopDimMappingAttr>([&](auto t) { + printer << ::mlir::gpu::ParallelLoopDimMappingAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace gpu { +namespace detail { +struct GPUBlockMappingAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::MappingId>; + GPUBlockMappingAttrStorage(::mlir::gpu::MappingId block) : block(std::move(block)) {} + + KeyTy getAsKey() const { + return KeyTy(block); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (block == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static GPUBlockMappingAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto block = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) GPUBlockMappingAttrStorage(std::move(block)); + } + + ::mlir::gpu::MappingId block; +}; +} // namespace detail +GPUBlockMappingAttr GPUBlockMappingAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::MappingId block) { + return Base::get(context, std::move(block)); +} + +::mlir::Attribute GPUBlockMappingAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::MappingId> _result_block; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter list + + // Parse variable 'block' + _result_block = [&]() -> ::mlir::FailureOr<::mlir::gpu::MappingId> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeMappingId(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::MappingId" << " to be one of: " << "x" << ", " << "y" << ", " << "z" << ", " << "linear_dim_0" << ", " << "linear_dim_1" << ", " << "linear_dim_2" << ", " << "linear_dim_3" << ", " << "linear_dim_4" << ", " << "linear_dim_5" << ", " << "linear_dim_6" << ", " << "linear_dim_7" << ", " << "linear_dim_8" << ", " << "linear_dim_9")}; + }(); + if (::mlir::failed(_result_block)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPUBlockMappingAttr parameter 'block' which is to be a `::mlir::gpu::MappingId`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_block)); + return GPUBlockMappingAttr::get(odsParser.getContext(), + ::mlir::gpu::MappingId((*_result_block))); +} + +void GPUBlockMappingAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << stringifyMappingId(getBlock()); + } + odsPrinter << ">"; +} + +::mlir::gpu::MappingId GPUBlockMappingAttr::getBlock() const { + return getImpl()->block; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUBlockMappingAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct GPUMemorySpaceMappingAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::AddressSpace>; + GPUMemorySpaceMappingAttrStorage(::mlir::gpu::AddressSpace address_space) : address_space(std::move(address_space)) {} + + KeyTy getAsKey() const { + return KeyTy(address_space); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (address_space == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static GPUMemorySpaceMappingAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto address_space = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) GPUMemorySpaceMappingAttrStorage(std::move(address_space)); + } + + ::mlir::gpu::AddressSpace address_space; +}; +} // namespace detail +GPUMemorySpaceMappingAttr GPUMemorySpaceMappingAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::AddressSpace address_space) { + return Base::get(context, std::move(address_space)); +} + +::mlir::Attribute GPUMemorySpaceMappingAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::AddressSpace> _result_address_space; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter list + + // Parse variable 'address_space' + _result_address_space = [&]() -> ::mlir::FailureOr<::mlir::gpu::AddressSpace> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeAddressSpace(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::AddressSpace" << " to be one of: " << "global" << ", " << "workgroup" << ", " << "private")}; + }(); + if (::mlir::failed(_result_address_space)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPUMemorySpaceMappingAttr parameter 'address_space' which is to be a `::mlir::gpu::AddressSpace`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_address_space)); + return GPUMemorySpaceMappingAttr::get(odsParser.getContext(), + ::mlir::gpu::AddressSpace((*_result_address_space))); +} + +void GPUMemorySpaceMappingAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << stringifyAddressSpace(getAddressSpace()); + } + odsPrinter << ">"; +} + +::mlir::gpu::AddressSpace GPUMemorySpaceMappingAttr::getAddressSpace() const { + return getImpl()->address_space; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUMemorySpaceMappingAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct GPUThreadMappingAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::MappingId>; + GPUThreadMappingAttrStorage(::mlir::gpu::MappingId thread) : thread(std::move(thread)) {} + + KeyTy getAsKey() const { + return KeyTy(thread); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (thread == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static GPUThreadMappingAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto thread = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) GPUThreadMappingAttrStorage(std::move(thread)); + } + + ::mlir::gpu::MappingId thread; +}; +} // namespace detail +GPUThreadMappingAttr GPUThreadMappingAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::MappingId thread) { + return Base::get(context, std::move(thread)); +} + +::mlir::Attribute GPUThreadMappingAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::MappingId> _result_thread; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter list + + // Parse variable 'thread' + _result_thread = [&]() -> ::mlir::FailureOr<::mlir::gpu::MappingId> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeMappingId(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::MappingId" << " to be one of: " << "x" << ", " << "y" << ", " << "z" << ", " << "linear_dim_0" << ", " << "linear_dim_1" << ", " << "linear_dim_2" << ", " << "linear_dim_3" << ", " << "linear_dim_4" << ", " << "linear_dim_5" << ", " << "linear_dim_6" << ", " << "linear_dim_7" << ", " << "linear_dim_8" << ", " << "linear_dim_9")}; + }(); + if (::mlir::failed(_result_thread)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPUThreadMappingAttr parameter 'thread' which is to be a `::mlir::gpu::MappingId`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_thread)); + return GPUThreadMappingAttr::get(odsParser.getContext(), + ::mlir::gpu::MappingId((*_result_thread))); +} + +void GPUThreadMappingAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << stringifyMappingId(getThread()); + } + odsPrinter << ">"; +} + +::mlir::gpu::MappingId GPUThreadMappingAttr::getThread() const { + return getImpl()->thread; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUThreadMappingAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct GPUWarpMappingAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::MappingId>; + GPUWarpMappingAttrStorage(::mlir::gpu::MappingId warp) : warp(std::move(warp)) {} + + KeyTy getAsKey() const { + return KeyTy(warp); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (warp == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static GPUWarpMappingAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto warp = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) GPUWarpMappingAttrStorage(std::move(warp)); + } + + ::mlir::gpu::MappingId warp; +}; +} // namespace detail +GPUWarpMappingAttr GPUWarpMappingAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::MappingId warp) { + return Base::get(context, std::move(warp)); +} + +::mlir::Attribute GPUWarpMappingAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::MappingId> _result_warp; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter list + + // Parse variable 'warp' + _result_warp = [&]() -> ::mlir::FailureOr<::mlir::gpu::MappingId> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeMappingId(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::MappingId" << " to be one of: " << "x" << ", " << "y" << ", " << "z" << ", " << "linear_dim_0" << ", " << "linear_dim_1" << ", " << "linear_dim_2" << ", " << "linear_dim_3" << ", " << "linear_dim_4" << ", " << "linear_dim_5" << ", " << "linear_dim_6" << ", " << "linear_dim_7" << ", " << "linear_dim_8" << ", " << "linear_dim_9")}; + }(); + if (::mlir::failed(_result_warp)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPUWarpMappingAttr parameter 'warp' which is to be a `::mlir::gpu::MappingId`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_warp)); + return GPUWarpMappingAttr::get(odsParser.getContext(), + ::mlir::gpu::MappingId((*_result_warp))); +} + +void GPUWarpMappingAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << stringifyMappingId(getWarp()); + } + odsPrinter << ">"; +} + +::mlir::gpu::MappingId GPUWarpMappingAttr::getWarp() const { + return getImpl()->warp; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUWarpMappingAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct GPUWarpgroupMappingAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::MappingId>; + GPUWarpgroupMappingAttrStorage(::mlir::gpu::MappingId warpgroup) : warpgroup(std::move(warpgroup)) {} + + KeyTy getAsKey() const { + return KeyTy(warpgroup); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (warpgroup == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static GPUWarpgroupMappingAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto warpgroup = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) GPUWarpgroupMappingAttrStorage(std::move(warpgroup)); + } + + ::mlir::gpu::MappingId warpgroup; +}; +} // namespace detail +GPUWarpgroupMappingAttr GPUWarpgroupMappingAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::MappingId warpgroup) { + return Base::get(context, std::move(warpgroup)); +} + +::mlir::Attribute GPUWarpgroupMappingAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::MappingId> _result_warpgroup; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter list + + // Parse variable 'warpgroup' + _result_warpgroup = [&]() -> ::mlir::FailureOr<::mlir::gpu::MappingId> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeMappingId(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::MappingId" << " to be one of: " << "x" << ", " << "y" << ", " << "z" << ", " << "linear_dim_0" << ", " << "linear_dim_1" << ", " << "linear_dim_2" << ", " << "linear_dim_3" << ", " << "linear_dim_4" << ", " << "linear_dim_5" << ", " << "linear_dim_6" << ", " << "linear_dim_7" << ", " << "linear_dim_8" << ", " << "linear_dim_9")}; + }(); + if (::mlir::failed(_result_warpgroup)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPUWarpgroupMappingAttr parameter 'warpgroup' which is to be a `::mlir::gpu::MappingId`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_warpgroup)); + return GPUWarpgroupMappingAttr::get(odsParser.getContext(), + ::mlir::gpu::MappingId((*_result_warpgroup))); +} + +void GPUWarpgroupMappingAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << stringifyMappingId(getWarpgroup()); + } + odsPrinter << ">"; +} + +::mlir::gpu::MappingId GPUWarpgroupMappingAttr::getWarpgroup() const { + return getImpl()->warpgroup; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUWarpgroupMappingAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct AddressSpaceAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::AddressSpace>; + AddressSpaceAttrStorage(::mlir::gpu::AddressSpace value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static AddressSpaceAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) AddressSpaceAttrStorage(std::move(value)); + } + + ::mlir::gpu::AddressSpace value; +}; +} // namespace detail +AddressSpaceAttr AddressSpaceAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::AddressSpace value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute AddressSpaceAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::AddressSpace> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::gpu::AddressSpace> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeAddressSpace(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::AddressSpace" << " to be one of: " << "global" << ", " << "workgroup" << ", " << "private")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_AddressSpaceAttr parameter 'value' which is to be a `::mlir::gpu::AddressSpace`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return AddressSpaceAttr::get(odsParser.getContext(), + ::mlir::gpu::AddressSpace((*_result_value))); +} + +void AddressSpaceAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyAddressSpace(getValue()); + odsPrinter << ">"; +} + +::mlir::gpu::AddressSpace AddressSpaceAttr::getValue() const { + return getImpl()->value; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::AddressSpaceAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct AllReduceOperationAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::AllReduceOperation>; + AllReduceOperationAttrStorage(::mlir::gpu::AllReduceOperation value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static AllReduceOperationAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) AllReduceOperationAttrStorage(std::move(value)); + } + + ::mlir::gpu::AllReduceOperation value; +}; +} // namespace detail +AllReduceOperationAttr AllReduceOperationAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::AllReduceOperation value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute AllReduceOperationAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::AllReduceOperation> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::gpu::AllReduceOperation> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeAllReduceOperation(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::AllReduceOperation" << " to be one of: " << "add" << ", " << "and" << ", " << "max" << ", " << "min" << ", " << "mul" << ", " << "or" << ", " << "xor")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_AllReduceOperationAttr parameter 'value' which is to be a `::mlir::gpu::AllReduceOperation`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return AllReduceOperationAttr::get(odsParser.getContext(), + ::mlir::gpu::AllReduceOperation((*_result_value))); +} + +void AllReduceOperationAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyAllReduceOperation(getValue()); +} + +::mlir::gpu::AllReduceOperation AllReduceOperationAttr::getValue() const { + return getImpl()->value; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::AllReduceOperationAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct DimensionAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::Dimension>; + DimensionAttrStorage(::mlir::gpu::Dimension value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static DimensionAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) DimensionAttrStorage(std::move(value)); + } + + ::mlir::gpu::Dimension value; +}; +} // namespace detail +DimensionAttr DimensionAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::Dimension value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute DimensionAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::Dimension> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::gpu::Dimension> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeDimension(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::Dimension" << " to be one of: " << "x" << ", " << "y" << ", " << "z")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_DimensionAttr parameter 'value' which is to be a `::mlir::gpu::Dimension`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return DimensionAttr::get(odsParser.getContext(), + ::mlir::gpu::Dimension((*_result_value))); +} + +void DimensionAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyDimension(getValue()); +} + +::mlir::gpu::Dimension DimensionAttr::getValue() const { + return getImpl()->value; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::DimensionAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct ObjectAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + ObjectAttrStorage(Attribute target, CompilationTarget format, StringAttr object, DictionaryAttr properties) : target(std::move(target)), format(std::move(format)), object(std::move(object)), properties(std::move(properties)) {} + + KeyTy getAsKey() const { + return KeyTy(target, format, object, properties); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (target == std::get<0>(tblgenKey)) && (format == std::get<1>(tblgenKey)) && (object == std::get<2>(tblgenKey)) && (properties == std::get<3>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); + } + + static ObjectAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto target = std::move(std::get<0>(tblgenKey)); + auto format = std::move(std::get<1>(tblgenKey)); + auto object = std::move(std::get<2>(tblgenKey)); + auto properties = std::move(std::get<3>(tblgenKey)); + return new (allocator.allocate()) ObjectAttrStorage(std::move(target), std::move(format), std::move(object), std::move(properties)); + } + + Attribute target; + CompilationTarget format; + StringAttr object; + DictionaryAttr properties; +}; +} // namespace detail +ObjectAttr ObjectAttr::get(::mlir::MLIRContext *context, Attribute target, CompilationTarget format, StringAttr object, DictionaryAttr properties) { + return Base::get(context, std::move(target), std::move(format), std::move(object), std::move(properties)); +} + +ObjectAttr ObjectAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Attribute target, CompilationTarget format, StringAttr object, DictionaryAttr properties) { + return Base::getChecked(emitError, context, target, format, object, properties); +} + +::mlir::Attribute ObjectAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_target; + ::mlir::FailureOr _result_format; + ::mlir::FailureOr _result_object; + ::mlir::FailureOr _result_properties; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'target' + _result_target = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_target)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_ObjectAttr parameter 'target' which is to be a `Attribute`"); + return {}; + } + // Parse literal ',' + if (odsParser.parseComma()) return {}; + // Parse literal 'properties' + if (odsParser.parseOptionalKeyword("properties")) { + } else { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + + // Parse variable 'properties' + _result_properties = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_properties)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_ObjectAttr parameter 'properties' which is to be a `DictionaryAttr`"); + return {}; + } + // Parse literal ',' + if (odsParser.parseComma()) return {}; + } + { + auto odsCustomLoc = odsParser.getCurrentLocation(); + (void)odsCustomLoc; + auto odsCustomResult = parseObject(odsParser, + ::mlir::detail::unwrapForCustomParse(_result_format), + ::mlir::detail::unwrapForCustomParse(_result_object)); + if (::mlir::failed(odsCustomResult)) return {}; + if (::mlir::failed(_result_object)) { + odsParser.emitError(odsCustomLoc, "custom parser failed to parse parameter 'object'"); + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_target)); + assert(::mlir::succeeded(_result_object)); + return odsParser.getChecked(odsLoc, odsParser.getContext(), + Attribute((*_result_target)), + CompilationTarget((_result_format.value_or(CompilationTarget::Fatbin))), + StringAttr((*_result_object)), + DictionaryAttr((_result_properties.value_or(DictionaryAttr())))); +} + +void ObjectAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter.printStrippedAttrOrType(getTarget()); + odsPrinter << ","; + if (!(getProperties() == DictionaryAttr())) { + odsPrinter << ' ' << "properties"; + odsPrinter << ' ' << "="; + if (!(getProperties() == DictionaryAttr())) { + odsPrinter << ' '; + odsPrinter.printStrippedAttrOrType(getProperties()); + } + odsPrinter << ","; + } else { + } + odsPrinter << ' '; + printObject(odsPrinter, + getFormat(), + getObject()); + odsPrinter << ">"; +} + +Attribute ObjectAttr::getTarget() const { + return getImpl()->target; +} + +CompilationTarget ObjectAttr::getFormat() const { + return getImpl()->format; +} + +StringAttr ObjectAttr::getObject() const { + return getImpl()->object; +} + +DictionaryAttr ObjectAttr::getProperties() const { + return getImpl()->properties; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::ObjectAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct Prune2To4SpMatFlagAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::Prune2To4SpMatFlag>; + Prune2To4SpMatFlagAttrStorage(::mlir::gpu::Prune2To4SpMatFlag value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static Prune2To4SpMatFlagAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) Prune2To4SpMatFlagAttrStorage(std::move(value)); + } + + ::mlir::gpu::Prune2To4SpMatFlag value; +}; +} // namespace detail +Prune2To4SpMatFlagAttr Prune2To4SpMatFlagAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::Prune2To4SpMatFlag value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute Prune2To4SpMatFlagAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::Prune2To4SpMatFlag> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::gpu::Prune2To4SpMatFlag> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizePrune2To4SpMatFlag(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::Prune2To4SpMatFlag" << " to be one of: " << "NONE" << ", " << "PRUNE_ONLY" << ", " << "PRUNE_AND_CHECK")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_Prune2To4SpMatFlagAttr parameter 'value' which is to be a `::mlir::gpu::Prune2To4SpMatFlag`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return Prune2To4SpMatFlagAttr::get(odsParser.getContext(), + ::mlir::gpu::Prune2To4SpMatFlag((*_result_value))); +} + +void Prune2To4SpMatFlagAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyPrune2To4SpMatFlag(getValue()); +} + +::mlir::gpu::Prune2To4SpMatFlag Prune2To4SpMatFlagAttr::getValue() const { + return getImpl()->value; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::Prune2To4SpMatFlagAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct SelectObjectAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + SelectObjectAttrStorage(Attribute target) : target(std::move(target)) {} + + KeyTy getAsKey() const { + return KeyTy(target); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (target == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static SelectObjectAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto target = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) SelectObjectAttrStorage(std::move(target)); + } + + Attribute target; +}; +} // namespace detail +SelectObjectAttr SelectObjectAttr::get(::mlir::MLIRContext *context, Attribute target) { + return Base::get(context, std::move(target)); +} + +SelectObjectAttr SelectObjectAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Attribute target) { + return Base::getChecked(emitError, context, target); +} + +::mlir::Attribute SelectObjectAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_target; + // Parse literal '<' + if (odsParser.parseOptionalLess()) { + } else { + + // Parse variable 'target' + _result_target = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_target)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_SelectObjectAttr parameter 'target' which is to be a `Attribute`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + } + return odsParser.getChecked(odsLoc, odsParser.getContext(), + Attribute((_result_target.value_or(Attribute())))); +} + +void SelectObjectAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + if (!(getTarget() == Attribute())) { + odsPrinter << "<"; + if (!(getTarget() == Attribute())) { + odsPrinter.printStrippedAttrOrType(getTarget()); + } + odsPrinter << ">"; + } else { + } +} + +Attribute SelectObjectAttr::getTarget() const { + return getImpl()->target; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SelectObjectAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct ShuffleModeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::ShuffleMode>; + ShuffleModeAttrStorage(::mlir::gpu::ShuffleMode value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ShuffleModeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ShuffleModeAttrStorage(std::move(value)); + } + + ::mlir::gpu::ShuffleMode value; +}; +} // namespace detail +ShuffleModeAttr ShuffleModeAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::ShuffleMode value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ShuffleModeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::ShuffleMode> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::gpu::ShuffleMode> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeShuffleMode(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::ShuffleMode" << " to be one of: " << "xor" << ", " << "up" << ", " << "down" << ", " << "idx")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_ShuffleModeAttr parameter 'value' which is to be a `::mlir::gpu::ShuffleMode`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ShuffleModeAttr::get(odsParser.getContext(), + ::mlir::gpu::ShuffleMode((*_result_value))); +} + +void ShuffleModeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyShuffleMode(getValue()); +} + +::mlir::gpu::ShuffleMode ShuffleModeAttr::getValue() const { + return getImpl()->value; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::ShuffleModeAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct SpGEMMWorkEstimationOrComputeKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind>; + SpGEMMWorkEstimationOrComputeKindAttrStorage(::mlir::gpu::SpGEMMWorkEstimationOrComputeKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static SpGEMMWorkEstimationOrComputeKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) SpGEMMWorkEstimationOrComputeKindAttrStorage(std::move(value)); + } + + ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind value; +}; +} // namespace detail +SpGEMMWorkEstimationOrComputeKindAttr SpGEMMWorkEstimationOrComputeKindAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute SpGEMMWorkEstimationOrComputeKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeSpGEMMWorkEstimationOrComputeKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::SpGEMMWorkEstimationOrComputeKind" << " to be one of: " << "WORK_ESTIMATION" << ", " << "COMPUTE")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_SpGEMMWorkEstimationOrComputeKindAttr parameter 'value' which is to be a `::mlir::gpu::SpGEMMWorkEstimationOrComputeKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return SpGEMMWorkEstimationOrComputeKindAttr::get(odsParser.getContext(), + ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind((*_result_value))); +} + +void SpGEMMWorkEstimationOrComputeKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifySpGEMMWorkEstimationOrComputeKind(getValue()); +} + +::mlir::gpu::SpGEMMWorkEstimationOrComputeKind SpGEMMWorkEstimationOrComputeKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct TransposeModeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::TransposeMode>; + TransposeModeAttrStorage(::mlir::gpu::TransposeMode value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static TransposeModeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) TransposeModeAttrStorage(std::move(value)); + } + + ::mlir::gpu::TransposeMode value; +}; +} // namespace detail +TransposeModeAttr TransposeModeAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::TransposeMode value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute TransposeModeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::TransposeMode> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::gpu::TransposeMode> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeTransposeMode(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::TransposeMode" << " to be one of: " << "NON_TRANSPOSE" << ", " << "TRANSPOSE" << ", " << "CONJUGATE_TRANSPOSE")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GPU_TransposeModeAttr parameter 'value' which is to be a `::mlir::gpu::TransposeMode`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return TransposeModeAttr::get(odsParser.getContext(), + ::mlir::gpu::TransposeMode((*_result_value))); +} + +void TransposeModeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyTransposeMode(getValue()); +} + +::mlir::gpu::TransposeMode TransposeModeAttr::getValue() const { + return getImpl()->value; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::TransposeModeAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct MMAElementwiseOpAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::MMAElementwiseOp>; + MMAElementwiseOpAttrStorage(::mlir::gpu::MMAElementwiseOp value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static MMAElementwiseOpAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) MMAElementwiseOpAttrStorage(std::move(value)); + } + + ::mlir::gpu::MMAElementwiseOp value; +}; +} // namespace detail +MMAElementwiseOpAttr MMAElementwiseOpAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::MMAElementwiseOp value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute MMAElementwiseOpAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::MMAElementwiseOp> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::gpu::MMAElementwiseOp> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeMMAElementwiseOp(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::MMAElementwiseOp" << " to be one of: " << "addf" << ", " << "mulf" << ", " << "subf" << ", " << "maxf" << ", " << "minf" << ", " << "divf" << ", " << "addi" << ", " << "muli" << ", " << "subi" << ", " << "divs" << ", " << "divu" << ", " << "negatef" << ", " << "negates" << ", " << "extf")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse MMAElementWiseAttr parameter 'value' which is to be a `::mlir::gpu::MMAElementwiseOp`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return MMAElementwiseOpAttr::get(odsParser.getContext(), + ::mlir::gpu::MMAElementwiseOp((*_result_value))); +} + +void MMAElementwiseOpAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyMMAElementwiseOp(getValue()); +} + +::mlir::gpu::MMAElementwiseOp MMAElementwiseOpAttr::getValue() const { + return getImpl()->value; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::MMAElementwiseOpAttr) +namespace mlir { +namespace gpu { +namespace detail { +struct ParallelLoopDimMappingAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::gpu::Processor, AffineMap, AffineMap>; + ParallelLoopDimMappingAttrStorage(::mlir::gpu::Processor processor, AffineMap map, AffineMap bound) : processor(std::move(processor)), map(std::move(map)), bound(std::move(bound)) {} + + KeyTy getAsKey() const { + return KeyTy(processor, map, bound); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (processor == std::get<0>(tblgenKey)) && (map == std::get<1>(tblgenKey)) && (bound == std::get<2>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); + } + + static ParallelLoopDimMappingAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto processor = std::move(std::get<0>(tblgenKey)); + auto map = std::move(std::get<1>(tblgenKey)); + auto bound = std::move(std::get<2>(tblgenKey)); + return new (allocator.allocate()) ParallelLoopDimMappingAttrStorage(std::move(processor), std::move(map), std::move(bound)); + } + + ::mlir::gpu::Processor processor; + AffineMap map; + AffineMap bound; +}; +} // namespace detail +ParallelLoopDimMappingAttr ParallelLoopDimMappingAttr::get(::mlir::MLIRContext *context, ::mlir::gpu::Processor processor, AffineMap map, AffineMap bound) { + return Base::get(context, std::move(processor), std::move(map), std::move(bound)); +} + +::mlir::Attribute ParallelLoopDimMappingAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::gpu::Processor> _result_processor; + ::mlir::FailureOr _result_map; + ::mlir::FailureOr _result_bound; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_processor = false; + bool _seen_map = false; + bool _seen_bound = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_processor && _paramKey == "processor") { + _seen_processor = true; + + // Parse variable 'processor' + _result_processor = [&]() -> ::mlir::FailureOr<::mlir::gpu::Processor> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::gpu::symbolizeProcessor(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::gpu::Processor" << " to be one of: " << "block_x" << ", " << "block_y" << ", " << "block_z" << ", " << "thread_x" << ", " << "thread_y" << ", " << "thread_z" << ", " << "sequential")}; + }(); + if (::mlir::failed(_result_processor)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ParallelLoopDimMappingAttr parameter 'processor' which is to be a `::mlir::gpu::Processor`"); + return {}; + } + } else if (!_seen_map && _paramKey == "map") { + _seen_map = true; + + // Parse variable 'map' + _result_map = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_map)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ParallelLoopDimMappingAttr parameter 'map' which is to be a `AffineMap`"); + return {}; + } + } else if (!_seen_bound && _paramKey == "bound") { + _seen_bound = true; + + // Parse variable 'bound' + _result_bound = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_bound)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ParallelLoopDimMappingAttr parameter 'bound' which is to be a `AffineMap`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 3; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 3 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_processor)); + assert(::mlir::succeeded(_result_map)); + assert(::mlir::succeeded(_result_bound)); + return ParallelLoopDimMappingAttr::get(odsParser.getContext(), + ::mlir::gpu::Processor((*_result_processor)), + AffineMap((*_result_map)), + AffineMap((*_result_bound))); +} + +void ParallelLoopDimMappingAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "processor = "; + odsPrinter << stringifyProcessor(getProcessor()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "map = "; + odsPrinter.printStrippedAttrOrType(getMap()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "bound = "; + odsPrinter.printStrippedAttrOrType(getBound()); + } + odsPrinter << ">"; +} + +::mlir::gpu::Processor ParallelLoopDimMappingAttr::getProcessor() const { + return getImpl()->processor; +} + +AffineMap ParallelLoopDimMappingAttr::getMap() const { + return getImpl()->map; +} + +AffineMap ParallelLoopDimMappingAttr::getBound() const { + return getImpl()->bound; +} + +} // namespace gpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::ParallelLoopDimMappingAttr) +namespace mlir { +namespace gpu { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute GPUDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void GPUDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace gpu +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsAttributes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsAttributes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..b096c0bafa78170e1f0182fc59f1f7d04ab35b12 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsAttributes.h.inc @@ -0,0 +1,321 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace gpu { +class GPUBlockMappingAttr; +class GPUMemorySpaceMappingAttr; +class GPUThreadMappingAttr; +class GPUWarpMappingAttr; +class GPUWarpgroupMappingAttr; +class AddressSpaceAttr; +class AllReduceOperationAttr; +class DimensionAttr; +class ObjectAttr; +class Prune2To4SpMatFlagAttr; +class SelectObjectAttr; +class ShuffleModeAttr; +class SpGEMMWorkEstimationOrComputeKindAttr; +class TransposeModeAttr; +class MMAElementwiseOpAttr; +class ParallelLoopDimMappingAttr; +namespace detail { +struct GPUBlockMappingAttrStorage; +} // namespace detail +class GPUBlockMappingAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static GPUBlockMappingAttr get(::mlir::MLIRContext *context, ::mlir::gpu::MappingId block); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"block"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::MappingId getBlock() const; + int64_t getMappingId() const; + bool isLinearMapping() const; + int64_t getRelativeIndex() const; +}; +namespace detail { +struct GPUMemorySpaceMappingAttrStorage; +} // namespace detail +class GPUMemorySpaceMappingAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static GPUMemorySpaceMappingAttr get(::mlir::MLIRContext *context, ::mlir::gpu::AddressSpace address_space); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"memory_space"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::AddressSpace getAddressSpace() const; + int64_t getMappingId() const; + bool isLinearMapping() const; + int64_t getRelativeIndex() const; +}; +namespace detail { +struct GPUThreadMappingAttrStorage; +} // namespace detail +class GPUThreadMappingAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static GPUThreadMappingAttr get(::mlir::MLIRContext *context, ::mlir::gpu::MappingId thread); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"thread"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::MappingId getThread() const; + int64_t getMappingId() const; + bool isLinearMapping() const; + int64_t getRelativeIndex() const; +}; +namespace detail { +struct GPUWarpMappingAttrStorage; +} // namespace detail +class GPUWarpMappingAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static GPUWarpMappingAttr get(::mlir::MLIRContext *context, ::mlir::gpu::MappingId warp); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"warp"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::MappingId getWarp() const; + int64_t getMappingId() const; + bool isLinearMapping() const; + int64_t getRelativeIndex() const; +}; +namespace detail { +struct GPUWarpgroupMappingAttrStorage; +} // namespace detail +class GPUWarpgroupMappingAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static GPUWarpgroupMappingAttr get(::mlir::MLIRContext *context, ::mlir::gpu::MappingId warpgroup); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"warpgroup"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::MappingId getWarpgroup() const; + int64_t getMappingId() const; + bool isLinearMapping() const; + int64_t getRelativeIndex() const; +}; +namespace detail { +struct AddressSpaceAttrStorage; +} // namespace detail +class AddressSpaceAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static AddressSpaceAttr get(::mlir::MLIRContext *context, ::mlir::gpu::AddressSpace value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"address_space"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::AddressSpace getValue() const; +}; +namespace detail { +struct AllReduceOperationAttrStorage; +} // namespace detail +class AllReduceOperationAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static AllReduceOperationAttr get(::mlir::MLIRContext *context, ::mlir::gpu::AllReduceOperation value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"all_reduce_op"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::AllReduceOperation getValue() const; +}; +namespace detail { +struct DimensionAttrStorage; +} // namespace detail +class DimensionAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DimensionAttr get(::mlir::MLIRContext *context, ::mlir::gpu::Dimension value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"dim"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::Dimension getValue() const; +}; +namespace detail { +struct ObjectAttrStorage; +} // namespace detail +class ObjectAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + using Base::getChecked; + static ObjectAttr get(::mlir::MLIRContext *context, Attribute target, CompilationTarget format, StringAttr object, DictionaryAttr properties); + static ObjectAttr getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Attribute target, CompilationTarget format, StringAttr object, DictionaryAttr properties); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Attribute target, CompilationTarget format, StringAttr object, DictionaryAttr properties); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"object"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + Attribute getTarget() const; + CompilationTarget getFormat() const; + StringAttr getObject() const; + DictionaryAttr getProperties() const; +}; +namespace detail { +struct Prune2To4SpMatFlagAttrStorage; +} // namespace detail +class Prune2To4SpMatFlagAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static Prune2To4SpMatFlagAttr get(::mlir::MLIRContext *context, ::mlir::gpu::Prune2To4SpMatFlag value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"prune_2to4_spmat_flag"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::Prune2To4SpMatFlag getValue() const; +}; +namespace detail { +struct SelectObjectAttrStorage; +} // namespace detail +class SelectObjectAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + using Base::getChecked; + static SelectObjectAttr get(::mlir::MLIRContext *context, Attribute target); + static SelectObjectAttr getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Attribute target); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Attribute target); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"select_object"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + Attribute getTarget() const; +}; +namespace detail { +struct ShuffleModeAttrStorage; +} // namespace detail +class ShuffleModeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ShuffleModeAttr get(::mlir::MLIRContext *context, ::mlir::gpu::ShuffleMode value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"shuffle_mode"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::ShuffleMode getValue() const; +}; +namespace detail { +struct SpGEMMWorkEstimationOrComputeKindAttrStorage; +} // namespace detail +class SpGEMMWorkEstimationOrComputeKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static SpGEMMWorkEstimationOrComputeKindAttr get(::mlir::MLIRContext *context, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"spgemm_work_estimation_or_compute_kind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind getValue() const; +}; +namespace detail { +struct TransposeModeAttrStorage; +} // namespace detail +class TransposeModeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TransposeModeAttr get(::mlir::MLIRContext *context, ::mlir::gpu::TransposeMode value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mat_transpose_mode"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::TransposeMode getValue() const; +}; +namespace detail { +struct MMAElementwiseOpAttrStorage; +} // namespace detail +class MMAElementwiseOpAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static MMAElementwiseOpAttr get(::mlir::MLIRContext *context, ::mlir::gpu::MMAElementwiseOp value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mma_element_wise"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::MMAElementwiseOp getValue() const; +}; +namespace detail { +struct ParallelLoopDimMappingAttrStorage; +} // namespace detail +class ParallelLoopDimMappingAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ParallelLoopDimMappingAttr get(::mlir::MLIRContext *context, ::mlir::gpu::Processor processor, AffineMap map, AffineMap bound); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_dim_map"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::gpu::Processor getProcessor() const; + AffineMap getMap() const; + AffineMap getBound() const; +}; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUBlockMappingAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUMemorySpaceMappingAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUThreadMappingAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUWarpMappingAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUWarpgroupMappingAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::AddressSpaceAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::AllReduceOperationAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::DimensionAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::ObjectAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::Prune2To4SpMatFlagAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SelectObjectAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::ShuffleModeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::SpGEMMWorkEstimationOrComputeKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::TransposeModeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::MMAElementwiseOpAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::ParallelLoopDimMappingAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..2039ec9d58cc8342f4cb895c9e7e6ac877042318 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: GPUOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUDialect) +namespace mlir { +namespace gpu { + +GPUDialect::GPUDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + initialize(); +} + +GPUDialect::~GPUDialect() = default; + +} // namespace gpu +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e128ca8813ae4b84660f775bfae921f6583ab5e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsDialect.h.inc @@ -0,0 +1,72 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: GPUOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace gpu { + +class GPUDialect : public ::mlir::Dialect { + explicit GPUDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~GPUDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("gpu"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; + + /// Provides a hook for verifying dialect attributes attached to the given + /// op. + ::mlir::LogicalResult verifyOperationAttribute( + ::mlir::Operation *op, ::mlir::NamedAttribute attribute) override; + + /// Get the name of the attribute used to annotate the modules that contain + /// kernel modules. + static StringRef getContainerModuleAttrName() { + return "gpu.container_module"; + } + /// Get the name of the attribute used to annotate external kernel + /// functions. + static StringRef getKernelFuncAttrName() { return "gpu.kernel"; } + + /// Returns whether the given function is a kernel function, i.e., has the + /// 'gpu.kernel' attribute. + static bool isKernel(Operation *op); + + /// Returns the number of workgroup (thread, block) dimensions supported in + /// the GPU dialect. + // TODO: consider generalizing this. + static unsigned getNumWorkgroupDimensions() { return 3; } + + /// Returns the numeric value used to identify the workgroup memory address + /// space. + static AddressSpace getWorkgroupAddressSpace() { return AddressSpace::Workgroup; } + + /// Returns the numeric value used to identify the private memory address + /// space. + static AddressSpace getPrivateAddressSpace() { return AddressSpace::Private; } + }; +} // namespace gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gpu::GPUDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..3e29005e6be372afcd7c85bf6657684fee943fe4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsEnums.cpp.inc @@ -0,0 +1,451 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: GPUOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyAddressSpace(AddressSpace val) { + switch (val) { + case AddressSpace::Global: return "global"; + case AddressSpace::Workgroup: return "workgroup"; + case AddressSpace::Private: return "private"; + } + return ""; +} + +::std::optional symbolizeAddressSpace(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("global", AddressSpace::Global) + .Case("workgroup", AddressSpace::Workgroup) + .Case("private", AddressSpace::Private) + .Default(::std::nullopt); +} +::std::optional symbolizeAddressSpace(uint32_t value) { + switch (value) { + case 1: return AddressSpace::Global; + case 2: return AddressSpace::Workgroup; + case 3: return AddressSpace::Private; + default: return ::std::nullopt; + } +} + +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyAllReduceOperation(AllReduceOperation val) { + switch (val) { + case AllReduceOperation::ADD: return "add"; + case AllReduceOperation::AND: return "and"; + case AllReduceOperation::MAX: return "max"; + case AllReduceOperation::MIN: return "min"; + case AllReduceOperation::MUL: return "mul"; + case AllReduceOperation::OR: return "or"; + case AllReduceOperation::XOR: return "xor"; + } + return ""; +} + +::std::optional symbolizeAllReduceOperation(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("add", AllReduceOperation::ADD) + .Case("and", AllReduceOperation::AND) + .Case("max", AllReduceOperation::MAX) + .Case("min", AllReduceOperation::MIN) + .Case("mul", AllReduceOperation::MUL) + .Case("or", AllReduceOperation::OR) + .Case("xor", AllReduceOperation::XOR) + .Default(::std::nullopt); +} +::std::optional symbolizeAllReduceOperation(uint32_t value) { + switch (value) { + case 0: return AllReduceOperation::ADD; + case 1: return AllReduceOperation::AND; + case 2: return AllReduceOperation::MAX; + case 3: return AllReduceOperation::MIN; + case 4: return AllReduceOperation::MUL; + case 5: return AllReduceOperation::OR; + case 6: return AllReduceOperation::XOR; + default: return ::std::nullopt; + } +} + +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyCompilationTarget(CompilationTarget val) { + switch (val) { + case CompilationTarget::Offload: return "offload"; + case CompilationTarget::Assembly: return "assembly"; + case CompilationTarget::Binary: return "bin"; + case CompilationTarget::Fatbin: return "fatbin"; + } + return ""; +} + +::std::optional symbolizeCompilationTarget(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("offload", CompilationTarget::Offload) + .Case("assembly", CompilationTarget::Assembly) + .Case("bin", CompilationTarget::Binary) + .Case("fatbin", CompilationTarget::Fatbin) + .Default(::std::nullopt); +} +::std::optional symbolizeCompilationTarget(uint32_t value) { + switch (value) { + case 1: return CompilationTarget::Offload; + case 2: return CompilationTarget::Assembly; + case 3: return CompilationTarget::Binary; + case 4: return CompilationTarget::Fatbin; + default: return ::std::nullopt; + } +} + +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyDimension(Dimension val) { + switch (val) { + case Dimension::x: return "x"; + case Dimension::y: return "y"; + case Dimension::z: return "z"; + } + return ""; +} + +::std::optional symbolizeDimension(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("x", Dimension::x) + .Case("y", Dimension::y) + .Case("z", Dimension::z) + .Default(::std::nullopt); +} +::std::optional symbolizeDimension(uint32_t value) { + switch (value) { + case 0: return Dimension::x; + case 1: return Dimension::y; + case 2: return Dimension::z; + default: return ::std::nullopt; + } +} + +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyPrune2To4SpMatFlag(Prune2To4SpMatFlag val) { + switch (val) { + case Prune2To4SpMatFlag::NONE: return "NONE"; + case Prune2To4SpMatFlag::PRUNE_ONLY: return "PRUNE_ONLY"; + case Prune2To4SpMatFlag::PRUNE_AND_CHECK: return "PRUNE_AND_CHECK"; + } + return ""; +} + +::std::optional symbolizePrune2To4SpMatFlag(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("NONE", Prune2To4SpMatFlag::NONE) + .Case("PRUNE_ONLY", Prune2To4SpMatFlag::PRUNE_ONLY) + .Case("PRUNE_AND_CHECK", Prune2To4SpMatFlag::PRUNE_AND_CHECK) + .Default(::std::nullopt); +} +::std::optional symbolizePrune2To4SpMatFlag(uint32_t value) { + switch (value) { + case 0: return Prune2To4SpMatFlag::NONE; + case 1: return Prune2To4SpMatFlag::PRUNE_ONLY; + case 2: return Prune2To4SpMatFlag::PRUNE_AND_CHECK; + default: return ::std::nullopt; + } +} + +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyShuffleMode(ShuffleMode val) { + switch (val) { + case ShuffleMode::XOR: return "xor"; + case ShuffleMode::UP: return "up"; + case ShuffleMode::DOWN: return "down"; + case ShuffleMode::IDX: return "idx"; + } + return ""; +} + +::std::optional symbolizeShuffleMode(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("xor", ShuffleMode::XOR) + .Case("up", ShuffleMode::UP) + .Case("down", ShuffleMode::DOWN) + .Case("idx", ShuffleMode::IDX) + .Default(::std::nullopt); +} +::std::optional symbolizeShuffleMode(uint32_t value) { + switch (value) { + case 0: return ShuffleMode::XOR; + case 2: return ShuffleMode::UP; + case 1: return ShuffleMode::DOWN; + case 3: return ShuffleMode::IDX; + default: return ::std::nullopt; + } +} + +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifySpGEMMWorkEstimationOrComputeKind(SpGEMMWorkEstimationOrComputeKind val) { + switch (val) { + case SpGEMMWorkEstimationOrComputeKind::WORK_ESTIMATION: return "WORK_ESTIMATION"; + case SpGEMMWorkEstimationOrComputeKind::COMPUTE: return "COMPUTE"; + } + return ""; +} + +::std::optional symbolizeSpGEMMWorkEstimationOrComputeKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("WORK_ESTIMATION", SpGEMMWorkEstimationOrComputeKind::WORK_ESTIMATION) + .Case("COMPUTE", SpGEMMWorkEstimationOrComputeKind::COMPUTE) + .Default(::std::nullopt); +} +::std::optional symbolizeSpGEMMWorkEstimationOrComputeKind(uint32_t value) { + switch (value) { + case 0: return SpGEMMWorkEstimationOrComputeKind::WORK_ESTIMATION; + case 1: return SpGEMMWorkEstimationOrComputeKind::COMPUTE; + default: return ::std::nullopt; + } +} + +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyTransposeMode(TransposeMode val) { + switch (val) { + case TransposeMode::NON_TRANSPOSE: return "NON_TRANSPOSE"; + case TransposeMode::TRANSPOSE: return "TRANSPOSE"; + case TransposeMode::CONJUGATE_TRANSPOSE: return "CONJUGATE_TRANSPOSE"; + } + return ""; +} + +::std::optional symbolizeTransposeMode(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("NON_TRANSPOSE", TransposeMode::NON_TRANSPOSE) + .Case("TRANSPOSE", TransposeMode::TRANSPOSE) + .Case("CONJUGATE_TRANSPOSE", TransposeMode::CONJUGATE_TRANSPOSE) + .Default(::std::nullopt); +} +::std::optional symbolizeTransposeMode(uint32_t value) { + switch (value) { + case 0: return TransposeMode::NON_TRANSPOSE; + case 1: return TransposeMode::TRANSPOSE; + case 2: return TransposeMode::CONJUGATE_TRANSPOSE; + default: return ::std::nullopt; + } +} + +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyMMAElementwiseOp(MMAElementwiseOp val) { + switch (val) { + case MMAElementwiseOp::ADDF: return "addf"; + case MMAElementwiseOp::MULF: return "mulf"; + case MMAElementwiseOp::SUBF: return "subf"; + case MMAElementwiseOp::MAXF: return "maxf"; + case MMAElementwiseOp::MINF: return "minf"; + case MMAElementwiseOp::DIVF: return "divf"; + case MMAElementwiseOp::ADDI: return "addi"; + case MMAElementwiseOp::MULI: return "muli"; + case MMAElementwiseOp::SUBI: return "subi"; + case MMAElementwiseOp::DIVS: return "divs"; + case MMAElementwiseOp::DIVU: return "divu"; + case MMAElementwiseOp::NEGATEF: return "negatef"; + case MMAElementwiseOp::NEGATES: return "negates"; + case MMAElementwiseOp::EXTF: return "extf"; + } + return ""; +} + +::std::optional symbolizeMMAElementwiseOp(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("addf", MMAElementwiseOp::ADDF) + .Case("mulf", MMAElementwiseOp::MULF) + .Case("subf", MMAElementwiseOp::SUBF) + .Case("maxf", MMAElementwiseOp::MAXF) + .Case("minf", MMAElementwiseOp::MINF) + .Case("divf", MMAElementwiseOp::DIVF) + .Case("addi", MMAElementwiseOp::ADDI) + .Case("muli", MMAElementwiseOp::MULI) + .Case("subi", MMAElementwiseOp::SUBI) + .Case("divs", MMAElementwiseOp::DIVS) + .Case("divu", MMAElementwiseOp::DIVU) + .Case("negatef", MMAElementwiseOp::NEGATEF) + .Case("negates", MMAElementwiseOp::NEGATES) + .Case("extf", MMAElementwiseOp::EXTF) + .Default(::std::nullopt); +} +::std::optional symbolizeMMAElementwiseOp(uint32_t value) { + switch (value) { + case 0: return MMAElementwiseOp::ADDF; + case 1: return MMAElementwiseOp::MULF; + case 2: return MMAElementwiseOp::SUBF; + case 3: return MMAElementwiseOp::MAXF; + case 4: return MMAElementwiseOp::MINF; + case 5: return MMAElementwiseOp::DIVF; + case 6: return MMAElementwiseOp::ADDI; + case 7: return MMAElementwiseOp::MULI; + case 8: return MMAElementwiseOp::SUBI; + case 9: return MMAElementwiseOp::DIVS; + case 10: return MMAElementwiseOp::DIVU; + case 11: return MMAElementwiseOp::NEGATEF; + case 12: return MMAElementwiseOp::NEGATES; + case 13: return MMAElementwiseOp::EXTF; + default: return ::std::nullopt; + } +} + +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyMappingId(MappingId val) { + switch (val) { + case MappingId::DimX: return "x"; + case MappingId::DimY: return "y"; + case MappingId::DimZ: return "z"; + case MappingId::LinearDim0: return "linear_dim_0"; + case MappingId::LinearDim1: return "linear_dim_1"; + case MappingId::LinearDim2: return "linear_dim_2"; + case MappingId::LinearDim3: return "linear_dim_3"; + case MappingId::LinearDim4: return "linear_dim_4"; + case MappingId::LinearDim5: return "linear_dim_5"; + case MappingId::LinearDim6: return "linear_dim_6"; + case MappingId::LinearDim7: return "linear_dim_7"; + case MappingId::LinearDim8: return "linear_dim_8"; + case MappingId::LinearDim9: return "linear_dim_9"; + } + return ""; +} + +::std::optional symbolizeMappingId(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("x", MappingId::DimX) + .Case("y", MappingId::DimY) + .Case("z", MappingId::DimZ) + .Case("linear_dim_0", MappingId::LinearDim0) + .Case("linear_dim_1", MappingId::LinearDim1) + .Case("linear_dim_2", MappingId::LinearDim2) + .Case("linear_dim_3", MappingId::LinearDim3) + .Case("linear_dim_4", MappingId::LinearDim4) + .Case("linear_dim_5", MappingId::LinearDim5) + .Case("linear_dim_6", MappingId::LinearDim6) + .Case("linear_dim_7", MappingId::LinearDim7) + .Case("linear_dim_8", MappingId::LinearDim8) + .Case("linear_dim_9", MappingId::LinearDim9) + .Default(::std::nullopt); +} +::std::optional symbolizeMappingId(uint64_t value) { + switch (value) { + case 0: return MappingId::DimX; + case 1: return MappingId::DimY; + case 2: return MappingId::DimZ; + case 3: return MappingId::LinearDim0; + case 4: return MappingId::LinearDim1; + case 5: return MappingId::LinearDim2; + case 6: return MappingId::LinearDim3; + case 7: return MappingId::LinearDim4; + case 8: return MappingId::LinearDim5; + case 9: return MappingId::LinearDim6; + case 10: return MappingId::LinearDim7; + case 11: return MappingId::LinearDim8; + case 12: return MappingId::LinearDim9; + default: return ::std::nullopt; + } +} + +bool MappingIdAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 7)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 8)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 9)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 10)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 11)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 12))); +} +MappingIdAttr MappingIdAttr::get(::mlir::MLIRContext *context, MappingId val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +MappingId MappingIdAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +namespace gpu { +::llvm::StringRef stringifyProcessor(Processor val) { + switch (val) { + case Processor::BlockX: return "block_x"; + case Processor::BlockY: return "block_y"; + case Processor::BlockZ: return "block_z"; + case Processor::ThreadX: return "thread_x"; + case Processor::ThreadY: return "thread_y"; + case Processor::ThreadZ: return "thread_z"; + case Processor::Sequential: return "sequential"; + } + return ""; +} + +::std::optional symbolizeProcessor(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("block_x", Processor::BlockX) + .Case("block_y", Processor::BlockY) + .Case("block_z", Processor::BlockZ) + .Case("thread_x", Processor::ThreadX) + .Case("thread_y", Processor::ThreadY) + .Case("thread_z", Processor::ThreadZ) + .Case("sequential", Processor::Sequential) + .Default(::std::nullopt); +} +::std::optional symbolizeProcessor(uint64_t value) { + switch (value) { + case 0: return Processor::BlockX; + case 1: return Processor::BlockY; + case 2: return Processor::BlockZ; + case 3: return Processor::ThreadX; + case 4: return Processor::ThreadY; + case 5: return Processor::ThreadZ; + case 6: return Processor::Sequential; + default: return ::std::nullopt; + } +} + +bool ProcessorAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6))); +} +ProcessorAttr ProcessorAttr::get(::mlir::MLIRContext *context, Processor val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +Processor ProcessorAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace gpu +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..c67ae621fd0021c6a669560662136c397aca92a2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/IR/GPUOpsEnums.h.inc @@ -0,0 +1,959 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: GPUOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace gpu { +// GPU address space +enum class AddressSpace : uint32_t { + Global = 1, + Workgroup = 2, + Private = 3, +}; + +::std::optional symbolizeAddressSpace(uint32_t); +::llvm::StringRef stringifyAddressSpace(AddressSpace); +::std::optional symbolizeAddressSpace(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForAddressSpace() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(AddressSpace enumValue) { + return stringifyAddressSpace(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeAddressSpace(str); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::AddressSpace, ::mlir::gpu::AddressSpace> { + template + static FailureOr<::mlir::gpu::AddressSpace> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for GPU address space"); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::AddressSpace> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::AddressSpace>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid GPU address space specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::AddressSpace value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::AddressSpace> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::AddressSpace getEmptyKey() { + return static_cast<::mlir::gpu::AddressSpace>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::AddressSpace getTombstoneKey() { + return static_cast<::mlir::gpu::AddressSpace>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::AddressSpace &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::AddressSpace &lhs, const ::mlir::gpu::AddressSpace &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// built-in reduction operations supported by gpu.allreduce. +enum class AllReduceOperation : uint32_t { + ADD = 0, + AND = 1, + MAX = 2, + MIN = 3, + MUL = 4, + OR = 5, + XOR = 6, +}; + +::std::optional symbolizeAllReduceOperation(uint32_t); +::llvm::StringRef stringifyAllReduceOperation(AllReduceOperation); +::std::optional symbolizeAllReduceOperation(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForAllReduceOperation() { + return 6; +} + + +inline ::llvm::StringRef stringifyEnum(AllReduceOperation enumValue) { + return stringifyAllReduceOperation(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeAllReduceOperation(str); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::AllReduceOperation, ::mlir::gpu::AllReduceOperation> { + template + static FailureOr<::mlir::gpu::AllReduceOperation> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for built-in reduction operations supported by gpu.allreduce."); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::AllReduceOperation> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::AllReduceOperation>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid built-in reduction operations supported by gpu.allreduce. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::AllReduceOperation value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::AllReduceOperation> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::AllReduceOperation getEmptyKey() { + return static_cast<::mlir::gpu::AllReduceOperation>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::AllReduceOperation getTombstoneKey() { + return static_cast<::mlir::gpu::AllReduceOperation>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::AllReduceOperation &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::AllReduceOperation &lhs, const ::mlir::gpu::AllReduceOperation &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// GPU compilation format +enum class CompilationTarget : uint32_t { + Offload = 1, + Assembly = 2, + Binary = 3, + Fatbin = 4, +}; + +::std::optional symbolizeCompilationTarget(uint32_t); +::llvm::StringRef stringifyCompilationTarget(CompilationTarget); +::std::optional symbolizeCompilationTarget(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForCompilationTarget() { + return 4; +} + + +inline ::llvm::StringRef stringifyEnum(CompilationTarget enumValue) { + return stringifyCompilationTarget(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeCompilationTarget(str); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::CompilationTarget, ::mlir::gpu::CompilationTarget> { + template + static FailureOr<::mlir::gpu::CompilationTarget> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for GPU compilation format"); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::CompilationTarget> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::CompilationTarget>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid GPU compilation format specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::CompilationTarget value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::CompilationTarget> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::CompilationTarget getEmptyKey() { + return static_cast<::mlir::gpu::CompilationTarget>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::CompilationTarget getTombstoneKey() { + return static_cast<::mlir::gpu::CompilationTarget>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::CompilationTarget &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::CompilationTarget &lhs, const ::mlir::gpu::CompilationTarget &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// a dimension, either 'x', 'y', or 'z' +enum class Dimension : uint32_t { + x = 0, + y = 1, + z = 2, +}; + +::std::optional symbolizeDimension(uint32_t); +::llvm::StringRef stringifyDimension(Dimension); +::std::optional symbolizeDimension(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForDimension() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(Dimension enumValue) { + return stringifyDimension(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeDimension(str); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::Dimension, ::mlir::gpu::Dimension> { + template + static FailureOr<::mlir::gpu::Dimension> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for a dimension, either 'x', 'y', or 'z'"); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::Dimension> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::Dimension>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid a dimension, either 'x', 'y', or 'z' specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::Dimension value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::Dimension> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::Dimension getEmptyKey() { + return static_cast<::mlir::gpu::Dimension>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::Dimension getTombstoneKey() { + return static_cast<::mlir::gpu::Dimension>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::Dimension &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::Dimension &lhs, const ::mlir::gpu::Dimension &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// pruning strategy for 2:4 sparse matrix +enum class Prune2To4SpMatFlag : uint32_t { + NONE = 0, + PRUNE_ONLY = 1, + PRUNE_AND_CHECK = 2, +}; + +::std::optional symbolizePrune2To4SpMatFlag(uint32_t); +::llvm::StringRef stringifyPrune2To4SpMatFlag(Prune2To4SpMatFlag); +::std::optional symbolizePrune2To4SpMatFlag(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForPrune2To4SpMatFlag() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(Prune2To4SpMatFlag enumValue) { + return stringifyPrune2To4SpMatFlag(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizePrune2To4SpMatFlag(str); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::Prune2To4SpMatFlag, ::mlir::gpu::Prune2To4SpMatFlag> { + template + static FailureOr<::mlir::gpu::Prune2To4SpMatFlag> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for pruning strategy for 2:4 sparse matrix"); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::Prune2To4SpMatFlag> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::Prune2To4SpMatFlag>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid pruning strategy for 2:4 sparse matrix specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::Prune2To4SpMatFlag value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::Prune2To4SpMatFlag> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::Prune2To4SpMatFlag getEmptyKey() { + return static_cast<::mlir::gpu::Prune2To4SpMatFlag>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::Prune2To4SpMatFlag getTombstoneKey() { + return static_cast<::mlir::gpu::Prune2To4SpMatFlag>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::Prune2To4SpMatFlag &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::Prune2To4SpMatFlag &lhs, const ::mlir::gpu::Prune2To4SpMatFlag &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// Indexing modes supported by gpu.shuffle. +enum class ShuffleMode : uint32_t { + XOR = 0, + UP = 2, + DOWN = 1, + IDX = 3, +}; + +::std::optional symbolizeShuffleMode(uint32_t); +::llvm::StringRef stringifyShuffleMode(ShuffleMode); +::std::optional symbolizeShuffleMode(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForShuffleMode() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(ShuffleMode enumValue) { + return stringifyShuffleMode(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeShuffleMode(str); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::ShuffleMode, ::mlir::gpu::ShuffleMode> { + template + static FailureOr<::mlir::gpu::ShuffleMode> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Indexing modes supported by gpu.shuffle."); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::ShuffleMode> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::ShuffleMode>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Indexing modes supported by gpu.shuffle. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::ShuffleMode value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::ShuffleMode> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::ShuffleMode getEmptyKey() { + return static_cast<::mlir::gpu::ShuffleMode>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::ShuffleMode getTombstoneKey() { + return static_cast<::mlir::gpu::ShuffleMode>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::ShuffleMode &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::ShuffleMode &lhs, const ::mlir::gpu::ShuffleMode &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// choose whether spgemm_work_estimation_or_compute does work estimation or compute +enum class SpGEMMWorkEstimationOrComputeKind : uint32_t { + WORK_ESTIMATION = 0, + COMPUTE = 1, +}; + +::std::optional symbolizeSpGEMMWorkEstimationOrComputeKind(uint32_t); +::llvm::StringRef stringifySpGEMMWorkEstimationOrComputeKind(SpGEMMWorkEstimationOrComputeKind); +::std::optional symbolizeSpGEMMWorkEstimationOrComputeKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForSpGEMMWorkEstimationOrComputeKind() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(SpGEMMWorkEstimationOrComputeKind enumValue) { + return stringifySpGEMMWorkEstimationOrComputeKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeSpGEMMWorkEstimationOrComputeKind(str); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind> { + template + static FailureOr<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for choose whether spgemm_work_estimation_or_compute does work estimation or compute"); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid choose whether spgemm_work_estimation_or_compute does work estimation or compute specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind getEmptyKey() { + return static_cast<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind getTombstoneKey() { + return static_cast<::mlir::gpu::SpGEMMWorkEstimationOrComputeKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind &lhs, const ::mlir::gpu::SpGEMMWorkEstimationOrComputeKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// transpose mode of sparse matrix supported by sparse tensor ops +enum class TransposeMode : uint32_t { + NON_TRANSPOSE = 0, + TRANSPOSE = 1, + CONJUGATE_TRANSPOSE = 2, +}; + +::std::optional symbolizeTransposeMode(uint32_t); +::llvm::StringRef stringifyTransposeMode(TransposeMode); +::std::optional symbolizeTransposeMode(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForTransposeMode() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(TransposeMode enumValue) { + return stringifyTransposeMode(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeTransposeMode(str); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::TransposeMode, ::mlir::gpu::TransposeMode> { + template + static FailureOr<::mlir::gpu::TransposeMode> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for transpose mode of sparse matrix supported by sparse tensor ops"); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::TransposeMode> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::TransposeMode>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid transpose mode of sparse matrix supported by sparse tensor ops specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::TransposeMode value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::TransposeMode> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::TransposeMode getEmptyKey() { + return static_cast<::mlir::gpu::TransposeMode>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::TransposeMode getTombstoneKey() { + return static_cast<::mlir::gpu::TransposeMode>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::TransposeMode &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::TransposeMode &lhs, const ::mlir::gpu::TransposeMode &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// elementwise operation to apply to mma matrix +enum class MMAElementwiseOp : uint32_t { + ADDF = 0, + MULF = 1, + SUBF = 2, + MAXF = 3, + MINF = 4, + DIVF = 5, + ADDI = 6, + MULI = 7, + SUBI = 8, + DIVS = 9, + DIVU = 10, + NEGATEF = 11, + NEGATES = 12, + EXTF = 13, +}; + +::std::optional symbolizeMMAElementwiseOp(uint32_t); +::llvm::StringRef stringifyMMAElementwiseOp(MMAElementwiseOp); +::std::optional symbolizeMMAElementwiseOp(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForMMAElementwiseOp() { + return 13; +} + + +inline ::llvm::StringRef stringifyEnum(MMAElementwiseOp enumValue) { + return stringifyMMAElementwiseOp(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeMMAElementwiseOp(str); +} +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::MMAElementwiseOp, ::mlir::gpu::MMAElementwiseOp> { + template + static FailureOr<::mlir::gpu::MMAElementwiseOp> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for elementwise operation to apply to mma matrix"); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::MMAElementwiseOp> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::MMAElementwiseOp>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid elementwise operation to apply to mma matrix specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::MMAElementwiseOp value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::MMAElementwiseOp> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::MMAElementwiseOp getEmptyKey() { + return static_cast<::mlir::gpu::MMAElementwiseOp>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::MMAElementwiseOp getTombstoneKey() { + return static_cast<::mlir::gpu::MMAElementwiseOp>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::MMAElementwiseOp &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::MMAElementwiseOp &lhs, const ::mlir::gpu::MMAElementwiseOp &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// Mapping ids for loop mapping +enum class MappingId : uint64_t { + DimX = 0, + DimY = 1, + DimZ = 2, + LinearDim0 = 3, + LinearDim1 = 4, + LinearDim2 = 5, + LinearDim3 = 6, + LinearDim4 = 7, + LinearDim5 = 8, + LinearDim6 = 9, + LinearDim7 = 10, + LinearDim8 = 11, + LinearDim9 = 12, +}; + +::std::optional symbolizeMappingId(uint64_t); +::llvm::StringRef stringifyMappingId(MappingId); +::std::optional symbolizeMappingId(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForMappingId() { + return 12; +} + + +inline ::llvm::StringRef stringifyEnum(MappingId enumValue) { + return stringifyMappingId(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeMappingId(str); +} + +class MappingIdAttr : public ::mlir::IntegerAttr { +public: + using ValueType = MappingId; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static MappingIdAttr get(::mlir::MLIRContext *context, MappingId val); + MappingId getValue() const; +}; +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::MappingId, ::mlir::gpu::MappingId> { + template + static FailureOr<::mlir::gpu::MappingId> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Mapping ids for loop mapping"); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::MappingId> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::MappingId>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Mapping ids for loop mapping specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::MappingId value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::MappingId> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::MappingId getEmptyKey() { + return static_cast<::mlir::gpu::MappingId>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::MappingId getTombstoneKey() { + return static_cast<::mlir::gpu::MappingId>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::MappingId &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::MappingId &lhs, const ::mlir::gpu::MappingId &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace gpu { +// processor for loop mapping +enum class Processor : uint64_t { + BlockX = 0, + BlockY = 1, + BlockZ = 2, + ThreadX = 3, + ThreadY = 4, + ThreadZ = 5, + Sequential = 6, +}; + +::std::optional symbolizeProcessor(uint64_t); +::llvm::StringRef stringifyProcessor(Processor); +::std::optional symbolizeProcessor(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForProcessor() { + return 6; +} + + +inline ::llvm::StringRef stringifyEnum(Processor enumValue) { + return stringifyProcessor(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeProcessor(str); +} + +class ProcessorAttr : public ::mlir::IntegerAttr { +public: + using ValueType = Processor; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static ProcessorAttr get(::mlir::MLIRContext *context, Processor val); + Processor getValue() const; +}; +} // namespace gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::gpu::Processor, ::mlir::gpu::Processor> { + template + static FailureOr<::mlir::gpu::Processor> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for processor for loop mapping"); + + // Symbolize the keyword. + if (::std::optional<::mlir::gpu::Processor> attr = ::mlir::gpu::symbolizeEnum<::mlir::gpu::Processor>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid processor for loop mapping specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::gpu::Processor value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::gpu::Processor> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::gpu::Processor getEmptyKey() { + return static_cast<::mlir::gpu::Processor>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::gpu::Processor getTombstoneKey() { + return static_cast<::mlir::gpu::Processor>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::gpu::Processor &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::gpu::Processor &lhs, const ::mlir::gpu::Processor &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/BufferDeallocationOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/BufferDeallocationOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..16cf96980de136de04d683948b25f4871b11c7d7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/BufferDeallocationOpInterfaceImpl.h @@ -0,0 +1,22 @@ +//===- BufferDeallocationOpInterfaceImpl.h ----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_GPU_TRANSFORMS_BUFFERDEALLOCATIONOPINTERFACEIMPL_H +#define MLIR_DIALECT_GPU_TRANSFORMS_BUFFERDEALLOCATIONOPINTERFACEIMPL_H + +namespace mlir { + +class DialectRegistry; + +namespace gpu { +void registerBufferDeallocationOpInterfaceExternalModels( + DialectRegistry ®istry); +} // namespace gpu +} // namespace mlir + +#endif // MLIR_DIALECT_GPU_TRANSFORMS_BUFFERDEALLOCATIONOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/MemoryPromotion.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/MemoryPromotion.h new file mode 100644 index 0000000000000000000000000000000000000000..bf26286058ebd71502e4ed182a70c5250a74fbdf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/MemoryPromotion.h @@ -0,0 +1,29 @@ +//===- MemoryPromotion.h - Utilities for moving data across GPU -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file declares the utility functions that generate IR copying +// the data between different levels of memory hierarchy. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_GPU_TRANSFORMS_MEMORYPROMOTION_H +#define MLIR_DIALECT_GPU_TRANSFORMS_MEMORYPROMOTION_H + +namespace mlir { + +namespace gpu { +class GPUFuncOp; +} // namespace gpu + +/// Promotes a function argument to workgroup memory in the given function. The +/// copies will be inserted in the beginning and in the end of the function. +void promoteToWorkgroupMemory(gpu::GPUFuncOp op, unsigned arg); + +} // namespace mlir + +#endif // MLIR_DIALECT_GPU_TRANSFORMS_MEMORYPROMOTION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h new file mode 100644 index 0000000000000000000000000000000000000000..74b78f96649ec2e4961389d4b3d412c7f602d0d7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h @@ -0,0 +1,49 @@ +//===- ParallelLoopMapper.h - Utilities for mapping parallel loops to GPU ====// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file declares the utilities to generate mappings for parallel +// loops to GPU devices. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_GPU_TRANSFORMS_PARALLELLOOPMAPPER_H +#define MLIR_DIALECT_GPU_TRANSFORMS_PARALLELLOOPMAPPER_H + +#include "mlir/Dialect/GPU/IR/GPUDialect.h" +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/StringRef.h" + +namespace mlir { + +class AffineMap; +struct LogicalResult; +class Operation; +class Region; + +} // namespace mlir + +namespace mlir { +namespace scf { +class ParallelOp; +} // namespace scf + +namespace gpu { + +/// Name of the mapping attribute produced by loop mappers. +StringRef getMappingAttrName(); + +/// Sets the mapping attribute of a scf.parallel operation. Verifies that the +/// mapping passed is valid. +/// - the number of DimMapperAttr provided is same as the number of loops of +/// the `ploopOp`. +/// - the mapping does not map multiple loops to the same processor. +LogicalResult setMappingAttr(scf::ParallelOp ploopOp, + ArrayRef mapping); +} // namespace gpu +} // namespace mlir +#endif // MLIR_DIALECT_GPU_TRANSFORMS_PARALLELLOOPMAPPER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.capi.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.capi.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..b834f0728cff4cb2c096f7d2677c9188034f08b0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.capi.cpp.inc @@ -0,0 +1,72 @@ +/* Autogenerated by mlir-tblgen; don't manually edit. */ +//===----------------------------------------------------------------------===// +// GPU Group Registration +//===----------------------------------------------------------------------===// + +void mlirRegisterGPUPasses(void) { + registerGPUPasses(); +} + +MlirPass mlirCreateGPUGpuAsyncRegionPass(void) { + return wrap(mlir::createGpuAsyncRegionPass().release()); +} +void mlirRegisterGPUGpuAsyncRegionPass(void) { + registerGpuAsyncRegionPass(); +} + + +MlirPass mlirCreateGPUGpuDecomposeMemrefsPass(void) { + return wrap(mlir::createGpuDecomposeMemrefsPass().release()); +} +void mlirRegisterGPUGpuDecomposeMemrefsPass(void) { + registerGpuDecomposeMemrefsPass(); +} + + +MlirPass mlirCreateGPUGpuKernelOutlining(void) { + return wrap(mlir::createGpuKernelOutliningPass().release()); +} +void mlirRegisterGPUGpuKernelOutlining(void) { + registerGpuKernelOutlining(); +} + + +MlirPass mlirCreateGPUGpuLaunchSinkIndexComputations(void) { + return wrap(mlir::createGpuLauchSinkIndexComputationsPass().release()); +} +void mlirRegisterGPUGpuLaunchSinkIndexComputations(void) { + registerGpuLaunchSinkIndexComputations(); +} + + +MlirPass mlirCreateGPUGpuMapParallelLoopsPass(void) { + return wrap(mlir::createGpuMapParallelLoopsPass().release()); +} +void mlirRegisterGPUGpuMapParallelLoopsPass(void) { + registerGpuMapParallelLoopsPass(); +} + + +MlirPass mlirCreateGPUGpuModuleToBinaryPass(void) { + return wrap(createGpuModuleToBinaryPass().release()); +} +void mlirRegisterGPUGpuModuleToBinaryPass(void) { + registerGpuModuleToBinaryPass(); +} + + +MlirPass mlirCreateGPUGpuNVVMAttachTarget(void) { + return wrap(createGpuNVVMAttachTarget().release()); +} +void mlirRegisterGPUGpuNVVMAttachTarget(void) { + registerGpuNVVMAttachTarget(); +} + + +MlirPass mlirCreateGPUGpuROCDLAttachTarget(void) { + return wrap(createGpuROCDLAttachTarget().release()); +} +void mlirRegisterGPUGpuROCDLAttachTarget(void) { + registerGpuROCDLAttachTarget(); +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.capi.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.capi.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..52fccedd7425afefcc7fb7cbcabc2e5d8580b5f9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.capi.h.inc @@ -0,0 +1,57 @@ + +/* Autogenerated by mlir-tblgen; don't manually edit. */ + +#include "mlir-c/Pass.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Registration for the entire group +MLIR_CAPI_EXPORTED void mlirRegisterGPUPasses(void); + + +/* Create GPU Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateGPUGpuAsyncRegionPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterGPUGpuAsyncRegionPass(void); + + +/* Create GPU Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateGPUGpuDecomposeMemrefsPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterGPUGpuDecomposeMemrefsPass(void); + + +/* Create GPU Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateGPUGpuKernelOutlining(void); +MLIR_CAPI_EXPORTED void mlirRegisterGPUGpuKernelOutlining(void); + + +/* Create GPU Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateGPUGpuLaunchSinkIndexComputations(void); +MLIR_CAPI_EXPORTED void mlirRegisterGPUGpuLaunchSinkIndexComputations(void); + + +/* Create GPU Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateGPUGpuMapParallelLoopsPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterGPUGpuMapParallelLoopsPass(void); + + +/* Create GPU Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateGPUGpuModuleToBinaryPass(void); +MLIR_CAPI_EXPORTED void mlirRegisterGPUGpuModuleToBinaryPass(void); + + +/* Create GPU Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateGPUGpuNVVMAttachTarget(void); +MLIR_CAPI_EXPORTED void mlirRegisterGPUGpuNVVMAttachTarget(void); + + +/* Create GPU Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateGPUGpuROCDLAttachTarget(void); +MLIR_CAPI_EXPORTED void mlirRegisterGPUGpuROCDLAttachTarget(void); + + + +#ifdef __cplusplus +} +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..2a891a7d24f809a2ae6ce93a7feacb4e6fa4e91a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h @@ -0,0 +1,174 @@ +//===- Passes.h - Pass Entrypoints ------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes that expose pass constructors. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_GPU_TRANSFORMS_PASSES_H_ +#define MLIR_DIALECT_GPU_TRANSFORMS_PASSES_H_ + +#include "Utils.h" +#include "mlir/Dialect/GPU/IR/GPUDialect.h" +#include "mlir/Pass/Pass.h" +#include + +namespace llvm { +class TargetMachine; +class LLVMContext; +class Module; +} // namespace llvm + +namespace mlir { +class TypeConverter; +class ConversionTarget; +namespace func { +class FuncOp; +} // namespace func + +#define GEN_PASS_DECL +#include "mlir/Dialect/GPU/Transforms/Passes.h.inc" + +/// Pass that moves ops which are likely an index computation into gpu.launch +/// body. +std::unique_ptr createGpuLauchSinkIndexComputationsPass(); + +/// Replaces `gpu.launch` with `gpu.launch_func` by moving the region into +/// a separate kernel function. +std::unique_ptr> +createGpuKernelOutliningPass(StringRef dataLayoutStr = StringRef()); + +/// Rewrites a function region so that GPU ops execute asynchronously. +std::unique_ptr> createGpuAsyncRegionPass(); + +/// Maps the parallel loops found in the given function to workgroups. The first +/// loop encountered will be mapped to the global workgroup and the second loop +/// encountered to the local workgroup. Within each mapping, the first three +/// dimensions are mapped to x/y/z hardware ids and all following dimensions are +/// mapped to sequential loops. +std::unique_ptr> createGpuMapParallelLoopsPass(); + +/// Collect a set of patterns to rewrite GlobalIdOp op within the GPU dialect. +void populateGpuGlobalIdPatterns(RewritePatternSet &patterns); + +/// Collect a set of patterns to rewrite shuffle ops within the GPU dialect. +void populateGpuShufflePatterns(RewritePatternSet &patterns); + +/// Collect a set of patterns to rewrite all-reduce ops within the GPU dialect. +void populateGpuAllReducePatterns(RewritePatternSet &patterns); + +/// Collect all patterns to rewrite ops within the GPU dialect. +inline void populateGpuRewritePatterns(RewritePatternSet &patterns) { + populateGpuAllReducePatterns(patterns); + populateGpuGlobalIdPatterns(patterns); + populateGpuShufflePatterns(patterns); +} + +namespace gpu { +/// Searches for all GPU modules in `op` and transforms them into GPU binary +/// operations. The resulting `gpu.binary` has `handler` as its offloading +/// handler attribute. +LogicalResult transformGpuModulesToBinaries( + Operation *op, OffloadingLLVMTranslationAttrInterface handler = nullptr, + const gpu::TargetOptions &options = {}); + +/// Base pass class to serialize kernel functions through LLVM into +/// user-specified IR and add the resulting blob as module attribute. +class SerializeToBlobPass : public OperationPass { +public: + SerializeToBlobPass(TypeID passID); + SerializeToBlobPass(const SerializeToBlobPass &other); + + void runOnOperation() final; + +protected: + /// Hook allowing the application of optimizations before codegen + /// By default, does nothing + virtual LogicalResult optimizeLlvm(llvm::Module &llvmModule, + llvm::TargetMachine &targetMachine); + + /// Translates the 'getOperation()' result to an LLVM module. + virtual std::unique_ptr + translateToLLVMIR(llvm::LLVMContext &llvmContext); + +private: + /// Creates the LLVM target machine to generate the ISA. + std::unique_ptr createTargetMachine(); + + /// Translates the module to ISA + std::optional translateToISA(llvm::Module &llvmModule, + llvm::TargetMachine &targetMachine); + + /// Serializes the target ISA to binary form. + virtual std::unique_ptr> + serializeISA(const std::string &isa) = 0; + +protected: + Option triple{*this, "triple", + ::llvm::cl::desc("Target triple")}; + Option chip{*this, "chip", + ::llvm::cl::desc("Target architecture")}; + Option features{*this, "features", + ::llvm::cl::desc("Target features")}; + Option optLevel{*this, "opt-level", + llvm::cl::desc("Optimization level for compilation"), + llvm::cl::init(2)}; + Option gpuBinaryAnnotation{ + *this, "gpu-binary-annotation", + llvm::cl::desc("Annotation attribute string for GPU binary"), + llvm::cl::init(getDefaultGpuBinaryAnnotation())}; + Option dumpPtx{*this, "dump-ptx", + ::llvm::cl::desc("Dump generated PTX"), + llvm::cl::init(false)}; +}; +} // namespace gpu + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Register pass to serialize GPU kernel functions to a CUBIN binary +/// annotation. +LLVM_DEPRECATED("use Target attributes instead", "") +void registerGpuSerializeToCubinPass(); + +/// Register pass to serialize GPU kernel functions to a HSAco binary +/// annotation. +LLVM_DEPRECATED("use Target attributes instead", "") +void registerGpuSerializeToHsacoPass(); + +/// Create an instance of the GPU kernel function to CUBIN binary serialization +/// pass with optLevel (default level 2). +LLVM_DEPRECATED("use Target attributes instead", "") +std::unique_ptr createGpuSerializeToCubinPass(StringRef triple, + StringRef chip, + StringRef features, + int optLevel = 2, + bool dumpPtx = false); + +/// Create an instance of the GPU kernel function to HSAco binary serialization +/// pass. +LLVM_DEPRECATED("use Target attributes instead", "") +std::unique_ptr createGpuSerializeToHsacoPass(StringRef triple, + StringRef arch, + StringRef features, + int optLevel); + +/// Collect a set of patterns to decompose memrefs ops. +void populateGpuDecomposeMemrefsPatterns(RewritePatternSet &patterns); + +/// Pass decomposes memref ops inside `gpu.launch` body. +std::unique_ptr createGpuDecomposeMemrefsPass(); + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/GPU/Transforms/Passes.h.inc" + +} // namespace mlir + +#endif // MLIR_DIALECT_GPU_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..6b24642f584e0fff07805103caebebca5e416c0d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h.inc @@ -0,0 +1,1222 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_GPUASYNCREGIONPASS +#define GEN_PASS_DECL_GPUDECOMPOSEMEMREFSPASS +#define GEN_PASS_DECL_GPUKERNELOUTLINING +#define GEN_PASS_DECL_GPULAUNCHSINKINDEXCOMPUTATIONS +#define GEN_PASS_DECL_GPUMAPPARALLELLOOPSPASS +#define GEN_PASS_DECL_GPUMODULETOBINARYPASS +#define GEN_PASS_DECL_GPUNVVMATTACHTARGET +#define GEN_PASS_DECL_GPUROCDLATTACHTARGET +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// GpuAsyncRegionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUASYNCREGIONPASS +#undef GEN_PASS_DECL_GPUASYNCREGIONPASS +#endif // GEN_PASS_DECL_GPUASYNCREGIONPASS +#ifdef GEN_PASS_DEF_GPUASYNCREGIONPASS +namespace impl { + +template +class GpuAsyncRegionPassBase : public ::mlir::OperationPass { +public: + using Base = GpuAsyncRegionPassBase; + + GpuAsyncRegionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuAsyncRegionPassBase(const GpuAsyncRegionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-async-region"); + } + ::llvm::StringRef getArgument() const override { return "gpu-async-region"; } + + ::llvm::StringRef getDescription() const override { return "Make GPU ops async"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuAsyncRegionPass"); + } + ::llvm::StringRef getName() const override { return "GpuAsyncRegionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuAsyncRegionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GPUASYNCREGIONPASS +#endif // GEN_PASS_DEF_GPUASYNCREGIONPASS + +//===----------------------------------------------------------------------===// +// GpuDecomposeMemrefsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUDECOMPOSEMEMREFSPASS +#undef GEN_PASS_DECL_GPUDECOMPOSEMEMREFSPASS +#endif // GEN_PASS_DECL_GPUDECOMPOSEMEMREFSPASS +#ifdef GEN_PASS_DEF_GPUDECOMPOSEMEMREFSPASS +namespace impl { + +template +class GpuDecomposeMemrefsPassBase : public ::mlir::OperationPass<> { +public: + using Base = GpuDecomposeMemrefsPassBase; + + GpuDecomposeMemrefsPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuDecomposeMemrefsPassBase(const GpuDecomposeMemrefsPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-decompose-memrefs"); + } + ::llvm::StringRef getArgument() const override { return "gpu-decompose-memrefs"; } + + ::llvm::StringRef getDescription() const override { return "Decomposes memref index computation into explicit ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuDecomposeMemrefsPass"); + } + ::llvm::StringRef getName() const override { return "GpuDecomposeMemrefsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuDecomposeMemrefsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GPUDECOMPOSEMEMREFSPASS +#endif // GEN_PASS_DEF_GPUDECOMPOSEMEMREFSPASS + +//===----------------------------------------------------------------------===// +// GpuKernelOutlining +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUKERNELOUTLINING +#undef GEN_PASS_DECL_GPUKERNELOUTLINING +#endif // GEN_PASS_DECL_GPUKERNELOUTLINING +#ifdef GEN_PASS_DEF_GPUKERNELOUTLINING +namespace impl { + +template +class GpuKernelOutliningBase : public ::mlir::OperationPass { +public: + using Base = GpuKernelOutliningBase; + + GpuKernelOutliningBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuKernelOutliningBase(const GpuKernelOutliningBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-kernel-outlining"); + } + ::llvm::StringRef getArgument() const override { return "gpu-kernel-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Outline gpu.launch bodies to kernel functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuKernelOutlining"); + } + ::llvm::StringRef getName() const override { return "GpuKernelOutlining"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuKernelOutliningBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GPUKERNELOUTLINING +#endif // GEN_PASS_DEF_GPUKERNELOUTLINING + +//===----------------------------------------------------------------------===// +// GpuLaunchSinkIndexComputations +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPULAUNCHSINKINDEXCOMPUTATIONS +#undef GEN_PASS_DECL_GPULAUNCHSINKINDEXCOMPUTATIONS +#endif // GEN_PASS_DECL_GPULAUNCHSINKINDEXCOMPUTATIONS +#ifdef GEN_PASS_DEF_GPULAUNCHSINKINDEXCOMPUTATIONS +namespace impl { + +template +class GpuLaunchSinkIndexComputationsBase : public ::mlir::OperationPass<> { +public: + using Base = GpuLaunchSinkIndexComputationsBase; + + GpuLaunchSinkIndexComputationsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuLaunchSinkIndexComputationsBase(const GpuLaunchSinkIndexComputationsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-launch-sink-index-computations"); + } + ::llvm::StringRef getArgument() const override { return "gpu-launch-sink-index-computations"; } + + ::llvm::StringRef getDescription() const override { return "Sink index computations into gpu.launch body"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuLaunchSinkIndexComputations"); + } + ::llvm::StringRef getName() const override { return "GpuLaunchSinkIndexComputations"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuLaunchSinkIndexComputationsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GPULAUNCHSINKINDEXCOMPUTATIONS +#endif // GEN_PASS_DEF_GPULAUNCHSINKINDEXCOMPUTATIONS + +//===----------------------------------------------------------------------===// +// GpuMapParallelLoopsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUMAPPARALLELLOOPSPASS +#undef GEN_PASS_DECL_GPUMAPPARALLELLOOPSPASS +#endif // GEN_PASS_DECL_GPUMAPPARALLELLOOPSPASS +#ifdef GEN_PASS_DEF_GPUMAPPARALLELLOOPSPASS +namespace impl { + +template +class GpuMapParallelLoopsPassBase : public ::mlir::OperationPass { +public: + using Base = GpuMapParallelLoopsPassBase; + + GpuMapParallelLoopsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuMapParallelLoopsPassBase(const GpuMapParallelLoopsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-map-parallel-loops"); + } + ::llvm::StringRef getArgument() const override { return "gpu-map-parallel-loops"; } + + ::llvm::StringRef getDescription() const override { return "Greedily maps loops to GPU hardware dimensions."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuMapParallelLoopsPass"); + } + ::llvm::StringRef getName() const override { return "GpuMapParallelLoopsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuMapParallelLoopsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GPUMAPPARALLELLOOPSPASS +#endif // GEN_PASS_DEF_GPUMAPPARALLELLOOPSPASS + +//===----------------------------------------------------------------------===// +// GpuModuleToBinaryPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUMODULETOBINARYPASS +struct GpuModuleToBinaryPassOptions { + Attribute offloadingHandler = nullptr; + std::string toolkitPath = ""; + ::llvm::ArrayRef linkFiles; + std::string cmdOptions = ""; + std::string compilationTarget = "fatbin"; +}; +std::unique_ptr<::mlir::Pass> createGpuModuleToBinaryPass(); +std::unique_ptr<::mlir::Pass> createGpuModuleToBinaryPass(const GpuModuleToBinaryPassOptions &options); +#undef GEN_PASS_DECL_GPUMODULETOBINARYPASS +#endif // GEN_PASS_DECL_GPUMODULETOBINARYPASS +#ifdef GEN_PASS_DEF_GPUMODULETOBINARYPASS + +namespace impl { + std::unique_ptr<::mlir::Pass> createGpuModuleToBinaryPass(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createGpuModuleToBinaryPass(const GpuModuleToBinaryPassOptions &options); +} // namespace impl +namespace impl { + +template +class GpuModuleToBinaryPassBase : public ::mlir::OperationPass<> { +public: + using Base = GpuModuleToBinaryPassBase; + + GpuModuleToBinaryPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuModuleToBinaryPassBase(const GpuModuleToBinaryPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-module-to-binary"); + } + ::llvm::StringRef getArgument() const override { return "gpu-module-to-binary"; } + + ::llvm::StringRef getDescription() const override { return "Transforms a GPU module into a GPU binary."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuModuleToBinaryPass"); + } + ::llvm::StringRef getName() const override { return "GpuModuleToBinaryPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuModuleToBinaryPassBase) + + GpuModuleToBinaryPassBase(const GpuModuleToBinaryPassOptions &options) : GpuModuleToBinaryPassBase() { + offloadingHandler = options.offloadingHandler; + toolkitPath = options.toolkitPath; + linkFiles = options.linkFiles; + cmdOptions = options.cmdOptions; + compilationTarget = options.compilationTarget; + } +protected: + ::mlir::Pass::Option offloadingHandler{*this, "handler", ::llvm::cl::desc("Offloading handler to be attached to the resulting binary op."), ::llvm::cl::init(nullptr)}; + ::mlir::Pass::Option toolkitPath{*this, "toolkit", ::llvm::cl::desc("Toolkit path."), ::llvm::cl::init("")}; + ::mlir::Pass::ListOption linkFiles{*this, "l", ::llvm::cl::desc("Extra files to link to.")}; + ::mlir::Pass::Option cmdOptions{*this, "opts", ::llvm::cl::desc("Command line options to pass to the tools."), ::llvm::cl::init("")}; + ::mlir::Pass::Option compilationTarget{*this, "format", ::llvm::cl::desc("The target representation of the compilation process."), ::llvm::cl::init("fatbin")}; +private: + + friend std::unique_ptr<::mlir::Pass> createGpuModuleToBinaryPass() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createGpuModuleToBinaryPass(const GpuModuleToBinaryPassOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createGpuModuleToBinaryPass() { + return impl::createGpuModuleToBinaryPass(); +} + +std::unique_ptr<::mlir::Pass> createGpuModuleToBinaryPass(const GpuModuleToBinaryPassOptions &options) { + return impl::createGpuModuleToBinaryPass(options); +} +#undef GEN_PASS_DEF_GPUMODULETOBINARYPASS +#endif // GEN_PASS_DEF_GPUMODULETOBINARYPASS + +//===----------------------------------------------------------------------===// +// GpuNVVMAttachTarget +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUNVVMATTACHTARGET +struct GpuNVVMAttachTargetOptions { + std::string moduleMatcher = ""; + std::string triple = "nvptx64-nvidia-cuda"; + std::string chip = "sm_50"; + std::string features = "+ptx60"; + unsigned optLevel = 2; + bool fastFlag = false; + bool ftzFlag = false; + ::llvm::ArrayRef linkLibs; +}; +std::unique_ptr<::mlir::Pass> createGpuNVVMAttachTarget(); +std::unique_ptr<::mlir::Pass> createGpuNVVMAttachTarget(const GpuNVVMAttachTargetOptions &options); +#undef GEN_PASS_DECL_GPUNVVMATTACHTARGET +#endif // GEN_PASS_DECL_GPUNVVMATTACHTARGET +#ifdef GEN_PASS_DEF_GPUNVVMATTACHTARGET + +namespace impl { + std::unique_ptr<::mlir::Pass> createGpuNVVMAttachTarget(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createGpuNVVMAttachTarget(const GpuNVVMAttachTargetOptions &options); +} // namespace impl +namespace impl { + +template +class GpuNVVMAttachTargetBase : public ::mlir::OperationPass<> { +public: + using Base = GpuNVVMAttachTargetBase; + + GpuNVVMAttachTargetBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuNVVMAttachTargetBase(const GpuNVVMAttachTargetBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("nvvm-attach-target"); + } + ::llvm::StringRef getArgument() const override { return "nvvm-attach-target"; } + + ::llvm::StringRef getDescription() const override { return "Attaches an NVVM target attribute to a GPU Module."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuNVVMAttachTarget"); + } + ::llvm::StringRef getName() const override { return "GpuNVVMAttachTarget"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuNVVMAttachTargetBase) + + GpuNVVMAttachTargetBase(const GpuNVVMAttachTargetOptions &options) : GpuNVVMAttachTargetBase() { + moduleMatcher = options.moduleMatcher; + triple = options.triple; + chip = options.chip; + features = options.features; + optLevel = options.optLevel; + fastFlag = options.fastFlag; + ftzFlag = options.ftzFlag; + linkLibs = options.linkLibs; + } +protected: + ::mlir::Pass::Option moduleMatcher{*this, "module", ::llvm::cl::desc("Regex used to identify the modules to attach the target to."), ::llvm::cl::init("")}; + ::mlir::Pass::Option triple{*this, "triple", ::llvm::cl::desc("Target triple."), ::llvm::cl::init("nvptx64-nvidia-cuda")}; + ::mlir::Pass::Option chip{*this, "chip", ::llvm::cl::desc("Target chip."), ::llvm::cl::init("sm_50")}; + ::mlir::Pass::Option features{*this, "features", ::llvm::cl::desc("Target features."), ::llvm::cl::init("+ptx60")}; + ::mlir::Pass::Option optLevel{*this, "O", ::llvm::cl::desc("Optimization level."), ::llvm::cl::init(2)}; + ::mlir::Pass::Option fastFlag{*this, "fast", ::llvm::cl::desc("Enable fast math mode."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option ftzFlag{*this, "ftz", ::llvm::cl::desc("Enable flush to zero for denormals."), ::llvm::cl::init(false)}; + ::mlir::Pass::ListOption linkLibs{*this, "l", ::llvm::cl::desc("Extra bitcode libraries paths to link to.")}; +private: + + friend std::unique_ptr<::mlir::Pass> createGpuNVVMAttachTarget() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createGpuNVVMAttachTarget(const GpuNVVMAttachTargetOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createGpuNVVMAttachTarget() { + return impl::createGpuNVVMAttachTarget(); +} + +std::unique_ptr<::mlir::Pass> createGpuNVVMAttachTarget(const GpuNVVMAttachTargetOptions &options) { + return impl::createGpuNVVMAttachTarget(options); +} +#undef GEN_PASS_DEF_GPUNVVMATTACHTARGET +#endif // GEN_PASS_DEF_GPUNVVMATTACHTARGET + +//===----------------------------------------------------------------------===// +// GpuROCDLAttachTarget +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUROCDLATTACHTARGET +struct GpuROCDLAttachTargetOptions { + std::string moduleMatcher = ""; + std::string triple = "amdgcn-amd-amdhsa"; + std::string chip = "gfx900"; + std::string features = ""; + std::string abiVersion = "400"; + unsigned optLevel = 2; + bool wave64Flag = true; + bool fastFlag = false; + bool dazFlag = false; + bool finiteOnlyFlag = false; + bool unsafeMathFlag = false; + bool correctSqrtFlag = true; + ::llvm::ArrayRef linkLibs; +}; +std::unique_ptr<::mlir::Pass> createGpuROCDLAttachTarget(); +std::unique_ptr<::mlir::Pass> createGpuROCDLAttachTarget(const GpuROCDLAttachTargetOptions &options); +#undef GEN_PASS_DECL_GPUROCDLATTACHTARGET +#endif // GEN_PASS_DECL_GPUROCDLATTACHTARGET +#ifdef GEN_PASS_DEF_GPUROCDLATTACHTARGET + +namespace impl { + std::unique_ptr<::mlir::Pass> createGpuROCDLAttachTarget(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createGpuROCDLAttachTarget(const GpuROCDLAttachTargetOptions &options); +} // namespace impl +namespace impl { + +template +class GpuROCDLAttachTargetBase : public ::mlir::OperationPass<> { +public: + using Base = GpuROCDLAttachTargetBase; + + GpuROCDLAttachTargetBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuROCDLAttachTargetBase(const GpuROCDLAttachTargetBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("rocdl-attach-target"); + } + ::llvm::StringRef getArgument() const override { return "rocdl-attach-target"; } + + ::llvm::StringRef getDescription() const override { return "Attaches a ROCDL target attribute to a GPU Module."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuROCDLAttachTarget"); + } + ::llvm::StringRef getName() const override { return "GpuROCDLAttachTarget"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuROCDLAttachTargetBase) + + GpuROCDLAttachTargetBase(const GpuROCDLAttachTargetOptions &options) : GpuROCDLAttachTargetBase() { + moduleMatcher = options.moduleMatcher; + triple = options.triple; + chip = options.chip; + features = options.features; + abiVersion = options.abiVersion; + optLevel = options.optLevel; + wave64Flag = options.wave64Flag; + fastFlag = options.fastFlag; + dazFlag = options.dazFlag; + finiteOnlyFlag = options.finiteOnlyFlag; + unsafeMathFlag = options.unsafeMathFlag; + correctSqrtFlag = options.correctSqrtFlag; + linkLibs = options.linkLibs; + } +protected: + ::mlir::Pass::Option moduleMatcher{*this, "module", ::llvm::cl::desc("Regex used to identify the modules to attach the target to."), ::llvm::cl::init("")}; + ::mlir::Pass::Option triple{*this, "triple", ::llvm::cl::desc("Target triple."), ::llvm::cl::init("amdgcn-amd-amdhsa")}; + ::mlir::Pass::Option chip{*this, "chip", ::llvm::cl::desc("Target chip."), ::llvm::cl::init("gfx900")}; + ::mlir::Pass::Option features{*this, "features", ::llvm::cl::desc("Target features."), ::llvm::cl::init("")}; + ::mlir::Pass::Option abiVersion{*this, "abi", ::llvm::cl::desc("Optimization level."), ::llvm::cl::init("400")}; + ::mlir::Pass::Option optLevel{*this, "O", ::llvm::cl::desc("Optimization level."), ::llvm::cl::init(2)}; + ::mlir::Pass::Option wave64Flag{*this, "wave64", ::llvm::cl::desc("Use Wave64 mode."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option fastFlag{*this, "fast", ::llvm::cl::desc("Enable fast relaxed math opt."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option dazFlag{*this, "daz", ::llvm::cl::desc("Enable denormals are zero opt."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option finiteOnlyFlag{*this, "finite-only", ::llvm::cl::desc("Enable finite only opt."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option unsafeMathFlag{*this, "unsafe-math", ::llvm::cl::desc("Enable unsafe math opt."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option correctSqrtFlag{*this, "correct-sqrt", ::llvm::cl::desc("Enable correct rounded sqrt."), ::llvm::cl::init(true)}; + ::mlir::Pass::ListOption linkLibs{*this, "l", ::llvm::cl::desc("Extra bitcode libraries paths to link to.")}; +private: + + friend std::unique_ptr<::mlir::Pass> createGpuROCDLAttachTarget() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createGpuROCDLAttachTarget(const GpuROCDLAttachTargetOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createGpuROCDLAttachTarget() { + return impl::createGpuROCDLAttachTarget(); +} + +std::unique_ptr<::mlir::Pass> createGpuROCDLAttachTarget(const GpuROCDLAttachTargetOptions &options) { + return impl::createGpuROCDLAttachTarget(options); +} +#undef GEN_PASS_DEF_GPUROCDLATTACHTARGET +#endif // GEN_PASS_DEF_GPUROCDLATTACHTARGET +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// GpuAsyncRegionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuAsyncRegionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuAsyncRegionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuAsyncRegionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuAsyncRegionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuDecomposeMemrefsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuDecomposeMemrefsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuDecomposeMemrefsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuDecomposeMemrefsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuDecomposeMemrefsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuKernelOutlining Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuKernelOutlining() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuKernelOutliningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuKernelOutliningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuKernelOutliningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuLaunchSinkIndexComputations Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuLaunchSinkIndexComputations() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuLauchSinkIndexComputationsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuLaunchSinkIndexComputationsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuLauchSinkIndexComputationsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuMapParallelLoopsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuMapParallelLoopsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuMapParallelLoopsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuMapParallelLoopsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createGpuMapParallelLoopsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuModuleToBinaryPass Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuModuleToBinaryPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuModuleToBinaryPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuModuleToBinaryPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuModuleToBinaryPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuNVVMAttachTarget Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuNVVMAttachTarget() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuNVVMAttachTarget(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuNVVMAttachTargetPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuNVVMAttachTarget(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuROCDLAttachTarget Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuROCDLAttachTarget() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuROCDLAttachTarget(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuROCDLAttachTargetPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuROCDLAttachTarget(); + }); +} + +//===----------------------------------------------------------------------===// +// GPU Registration +//===----------------------------------------------------------------------===// + +inline void registerGPUPasses() { + registerGpuAsyncRegionPass(); + registerGpuDecomposeMemrefsPass(); + registerGpuKernelOutlining(); + registerGpuLaunchSinkIndexComputations(); + registerGpuMapParallelLoopsPass(); + registerGpuModuleToBinaryPass(); + registerGpuNVVMAttachTarget(); + registerGpuROCDLAttachTarget(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class GpuAsyncRegionPassBase : public ::mlir::OperationPass { +public: + using Base = GpuAsyncRegionPassBase; + + GpuAsyncRegionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuAsyncRegionPassBase(const GpuAsyncRegionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-async-region"); + } + ::llvm::StringRef getArgument() const override { return "gpu-async-region"; } + + ::llvm::StringRef getDescription() const override { return "Make GPU ops async"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuAsyncRegionPass"); + } + ::llvm::StringRef getName() const override { return "GpuAsyncRegionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuAsyncRegionPassBase) + +protected: +}; + +template +class GpuDecomposeMemrefsPassBase : public ::mlir::OperationPass<> { +public: + using Base = GpuDecomposeMemrefsPassBase; + + GpuDecomposeMemrefsPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuDecomposeMemrefsPassBase(const GpuDecomposeMemrefsPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-decompose-memrefs"); + } + ::llvm::StringRef getArgument() const override { return "gpu-decompose-memrefs"; } + + ::llvm::StringRef getDescription() const override { return "Decomposes memref index computation into explicit ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuDecomposeMemrefsPass"); + } + ::llvm::StringRef getName() const override { return "GpuDecomposeMemrefsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuDecomposeMemrefsPassBase) + +protected: +}; + +template +class GpuKernelOutliningBase : public ::mlir::OperationPass { +public: + using Base = GpuKernelOutliningBase; + + GpuKernelOutliningBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuKernelOutliningBase(const GpuKernelOutliningBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-kernel-outlining"); + } + ::llvm::StringRef getArgument() const override { return "gpu-kernel-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Outline gpu.launch bodies to kernel functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuKernelOutlining"); + } + ::llvm::StringRef getName() const override { return "GpuKernelOutlining"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuKernelOutliningBase) + +protected: +}; + +template +class GpuLaunchSinkIndexComputationsBase : public ::mlir::OperationPass<> { +public: + using Base = GpuLaunchSinkIndexComputationsBase; + + GpuLaunchSinkIndexComputationsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuLaunchSinkIndexComputationsBase(const GpuLaunchSinkIndexComputationsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-launch-sink-index-computations"); + } + ::llvm::StringRef getArgument() const override { return "gpu-launch-sink-index-computations"; } + + ::llvm::StringRef getDescription() const override { return "Sink index computations into gpu.launch body"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuLaunchSinkIndexComputations"); + } + ::llvm::StringRef getName() const override { return "GpuLaunchSinkIndexComputations"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuLaunchSinkIndexComputationsBase) + +protected: +}; + +template +class GpuMapParallelLoopsPassBase : public ::mlir::OperationPass { +public: + using Base = GpuMapParallelLoopsPassBase; + + GpuMapParallelLoopsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuMapParallelLoopsPassBase(const GpuMapParallelLoopsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-map-parallel-loops"); + } + ::llvm::StringRef getArgument() const override { return "gpu-map-parallel-loops"; } + + ::llvm::StringRef getDescription() const override { return "Greedily maps loops to GPU hardware dimensions."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuMapParallelLoopsPass"); + } + ::llvm::StringRef getName() const override { return "GpuMapParallelLoopsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuMapParallelLoopsPassBase) + +protected: +}; + +template +class GpuModuleToBinaryPassBase : public ::mlir::OperationPass<> { +public: + using Base = GpuModuleToBinaryPassBase; + + GpuModuleToBinaryPassBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuModuleToBinaryPassBase(const GpuModuleToBinaryPassBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-module-to-binary"); + } + ::llvm::StringRef getArgument() const override { return "gpu-module-to-binary"; } + + ::llvm::StringRef getDescription() const override { return "Transforms a GPU module into a GPU binary."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuModuleToBinaryPass"); + } + ::llvm::StringRef getName() const override { return "GpuModuleToBinaryPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuModuleToBinaryPassBase) + +protected: + ::mlir::Pass::Option offloadingHandler{*this, "handler", ::llvm::cl::desc("Offloading handler to be attached to the resulting binary op."), ::llvm::cl::init(nullptr)}; + ::mlir::Pass::Option toolkitPath{*this, "toolkit", ::llvm::cl::desc("Toolkit path."), ::llvm::cl::init("")}; + ::mlir::Pass::ListOption linkFiles{*this, "l", ::llvm::cl::desc("Extra files to link to.")}; + ::mlir::Pass::Option cmdOptions{*this, "opts", ::llvm::cl::desc("Command line options to pass to the tools."), ::llvm::cl::init("")}; + ::mlir::Pass::Option compilationTarget{*this, "format", ::llvm::cl::desc("The target representation of the compilation process."), ::llvm::cl::init("fatbin")}; +}; + +template +class GpuNVVMAttachTargetBase : public ::mlir::OperationPass<> { +public: + using Base = GpuNVVMAttachTargetBase; + + GpuNVVMAttachTargetBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuNVVMAttachTargetBase(const GpuNVVMAttachTargetBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("nvvm-attach-target"); + } + ::llvm::StringRef getArgument() const override { return "nvvm-attach-target"; } + + ::llvm::StringRef getDescription() const override { return "Attaches an NVVM target attribute to a GPU Module."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuNVVMAttachTarget"); + } + ::llvm::StringRef getName() const override { return "GpuNVVMAttachTarget"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuNVVMAttachTargetBase) + +protected: + ::mlir::Pass::Option moduleMatcher{*this, "module", ::llvm::cl::desc("Regex used to identify the modules to attach the target to."), ::llvm::cl::init("")}; + ::mlir::Pass::Option triple{*this, "triple", ::llvm::cl::desc("Target triple."), ::llvm::cl::init("nvptx64-nvidia-cuda")}; + ::mlir::Pass::Option chip{*this, "chip", ::llvm::cl::desc("Target chip."), ::llvm::cl::init("sm_50")}; + ::mlir::Pass::Option features{*this, "features", ::llvm::cl::desc("Target features."), ::llvm::cl::init("+ptx60")}; + ::mlir::Pass::Option optLevel{*this, "O", ::llvm::cl::desc("Optimization level."), ::llvm::cl::init(2)}; + ::mlir::Pass::Option fastFlag{*this, "fast", ::llvm::cl::desc("Enable fast math mode."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option ftzFlag{*this, "ftz", ::llvm::cl::desc("Enable flush to zero for denormals."), ::llvm::cl::init(false)}; + ::mlir::Pass::ListOption linkLibs{*this, "l", ::llvm::cl::desc("Extra bitcode libraries paths to link to.")}; +}; + +template +class GpuROCDLAttachTargetBase : public ::mlir::OperationPass<> { +public: + using Base = GpuROCDLAttachTargetBase; + + GpuROCDLAttachTargetBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + GpuROCDLAttachTargetBase(const GpuROCDLAttachTargetBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("rocdl-attach-target"); + } + ::llvm::StringRef getArgument() const override { return "rocdl-attach-target"; } + + ::llvm::StringRef getDescription() const override { return "Attaches a ROCDL target attribute to a GPU Module."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuROCDLAttachTarget"); + } + ::llvm::StringRef getName() const override { return "GpuROCDLAttachTarget"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuROCDLAttachTargetBase) + +protected: + ::mlir::Pass::Option moduleMatcher{*this, "module", ::llvm::cl::desc("Regex used to identify the modules to attach the target to."), ::llvm::cl::init("")}; + ::mlir::Pass::Option triple{*this, "triple", ::llvm::cl::desc("Target triple."), ::llvm::cl::init("amdgcn-amd-amdhsa")}; + ::mlir::Pass::Option chip{*this, "chip", ::llvm::cl::desc("Target chip."), ::llvm::cl::init("gfx900")}; + ::mlir::Pass::Option features{*this, "features", ::llvm::cl::desc("Target features."), ::llvm::cl::init("")}; + ::mlir::Pass::Option abiVersion{*this, "abi", ::llvm::cl::desc("Optimization level."), ::llvm::cl::init("400")}; + ::mlir::Pass::Option optLevel{*this, "O", ::llvm::cl::desc("Optimization level."), ::llvm::cl::init(2)}; + ::mlir::Pass::Option wave64Flag{*this, "wave64", ::llvm::cl::desc("Use Wave64 mode."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option fastFlag{*this, "fast", ::llvm::cl::desc("Enable fast relaxed math opt."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option dazFlag{*this, "daz", ::llvm::cl::desc("Enable denormals are zero opt."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option finiteOnlyFlag{*this, "finite-only", ::llvm::cl::desc("Enable finite only opt."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option unsafeMathFlag{*this, "unsafe-math", ::llvm::cl::desc("Enable unsafe math opt."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option correctSqrtFlag{*this, "correct-sqrt", ::llvm::cl::desc("Enable correct rounded sqrt."), ::llvm::cl::init(true)}; + ::mlir::Pass::ListOption linkLibs{*this, "l", ::llvm::cl::desc("Extra bitcode libraries paths to link to.")}; +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Utils.h new file mode 100644 index 0000000000000000000000000000000000000000..a426bee7686dbc01f0c669fd165b010d48e8e632 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/GPU/Transforms/Utils.h @@ -0,0 +1,52 @@ +//===- Passes.h - Pass Entrypoints ------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines utility functions exposed by the GPU dialect +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_GPU_TRANSFORMS_UTILS_H_ +#define MLIR_DIALECT_GPU_TRANSFORMS_UTILS_H_ + +#include "mlir/Support/LLVM.h" + +#include + +namespace mlir { +struct LogicalResult; +class Operation; +class Value; + +namespace gpu { +class GPUFuncOp; +class LaunchOp; + +/// Returns the default annotation name for GPU binary blobs. +std::string getDefaultGpuBinaryAnnotation(); +} // namespace gpu + +/// Get a gpu.func created from outlining the region of a gpu.launch op with the +/// given `kernelFnName`. The region of the `launchOp` can use values from +/// above. These need to be captured and passed as arguments to the generated +/// gpu.func. The generated function has arguments +/// - corresponding to the values passed in as `operands`, in that order. +/// - any additional values that might be used within the region of the +/// `launchOp` and defined above it. These captured values are appended to the +/// `operands` list. +gpu::GPUFuncOp outlineKernelFunc(gpu::LaunchOp launchOp, StringRef kernelFnName, + SmallVectorImpl &operands); + +/// Sink operations into the `launchOp` to reduce the number of values that are +/// used within the region of the operation, but defined outside of the +/// region. +LogicalResult sinkOperationsIntoLaunchOp( + gpu::LaunchOp launchOp, + llvm::function_ref isSinkingBeneficiary); + +} // namespace mlir +#endif // MLIR_DIALECT_GPU_TRANSFORMS_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexAttrs.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexAttrs.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..77c66cc52e884319f0cd2427bfbbf02c2a04a5f2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexAttrs.cpp.inc @@ -0,0 +1,140 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::index::IndexCmpPredicateAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::index::IndexCmpPredicateAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::index::IndexCmpPredicateAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::index::IndexCmpPredicateAttr>([&](auto t) { + printer << ::mlir::index::IndexCmpPredicateAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace index { +namespace detail { +struct IndexCmpPredicateAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::index::IndexCmpPredicate>; + IndexCmpPredicateAttrStorage(::mlir::index::IndexCmpPredicate value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static IndexCmpPredicateAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) IndexCmpPredicateAttrStorage(std::move(value)); + } + + ::mlir::index::IndexCmpPredicate value; +}; +} // namespace detail +IndexCmpPredicateAttr IndexCmpPredicateAttr::get(::mlir::MLIRContext *context, ::mlir::index::IndexCmpPredicate value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute IndexCmpPredicateAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::index::IndexCmpPredicate> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::index::IndexCmpPredicate> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::index::symbolizeIndexCmpPredicate(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::index::IndexCmpPredicate" << " to be one of: " << "eq" << ", " << "ne" << ", " << "slt" << ", " << "sle" << ", " << "sgt" << ", " << "sge" << ", " << "ult" << ", " << "ule" << ", " << "ugt" << ", " << "uge")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse IndexCmpPredicateAttr parameter 'value' which is to be a `::mlir::index::IndexCmpPredicate`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return IndexCmpPredicateAttr::get(odsParser.getContext(), + ::mlir::index::IndexCmpPredicate((*_result_value))); +} + +void IndexCmpPredicateAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyIndexCmpPredicate(getValue()); +} + +::mlir::index::IndexCmpPredicate IndexCmpPredicateAttr::getValue() const { + return getImpl()->value; +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::IndexCmpPredicateAttr) +namespace mlir { +namespace index { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute IndexDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void IndexDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace index +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexAttrs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexAttrs.h new file mode 100644 index 0000000000000000000000000000000000000000..25ee50dc191e53fd0299ded452fed3808dd9f147 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexAttrs.h @@ -0,0 +1,23 @@ +//===- IndexAttrs.h - Index attribute declarations ----------------*- C++-*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_INDEX_IR_INDEXATTRS_H +#define MLIR_DIALECT_INDEX_IR_INDEXATTRS_H + +#include "mlir/IR/Attributes.h" + +//===----------------------------------------------------------------------===// +// ODS-Generated Declarations +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Index/IR/IndexEnums.h.inc" + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/Index/IR/IndexAttrs.h.inc" + +#endif // MLIR_DIALECT_INDEX_IR_INDEXATTRS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexAttrs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexAttrs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..2840fb1b4179ddee53d02c33aa1a8232596f33ae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexAttrs.h.inc @@ -0,0 +1,40 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace index { +class IndexCmpPredicateAttr; +namespace detail { +struct IndexCmpPredicateAttrStorage; +} // namespace detail +class IndexCmpPredicateAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static IndexCmpPredicateAttr get(::mlir::MLIRContext *context, ::mlir::index::IndexCmpPredicate value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"cmp_predicate"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::index::IndexCmpPredicate getValue() const; +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::IndexCmpPredicateAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..fb8aebfb240b21797606651accb5713c7307bc34 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexDialect.h @@ -0,0 +1,20 @@ +//===- IndexDialect.h - Index dialect declaration -----------------*- C++-*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_INDEX_IR_INDEXDIALECT_H +#define MLIR_DIALECT_INDEX_IR_INDEXDIALECT_H + +#include "mlir/IR/Dialect.h" + +//===----------------------------------------------------------------------===// +// ODS-Generated Declarations +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Index/IR/IndexOpsDialect.h.inc" + +#endif // MLIR_DIALECT_INDEX_IR_INDEXDIALECT_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..c109d09e4d99470be9cad41b508f63599d776068 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexEnums.cpp.inc @@ -0,0 +1,60 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: IndexEnums.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace index { +::llvm::StringRef stringifyIndexCmpPredicate(IndexCmpPredicate val) { + switch (val) { + case IndexCmpPredicate::EQ: return "eq"; + case IndexCmpPredicate::NE: return "ne"; + case IndexCmpPredicate::SLT: return "slt"; + case IndexCmpPredicate::SLE: return "sle"; + case IndexCmpPredicate::SGT: return "sgt"; + case IndexCmpPredicate::SGE: return "sge"; + case IndexCmpPredicate::ULT: return "ult"; + case IndexCmpPredicate::ULE: return "ule"; + case IndexCmpPredicate::UGT: return "ugt"; + case IndexCmpPredicate::UGE: return "uge"; + } + return ""; +} + +::std::optional symbolizeIndexCmpPredicate(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("eq", IndexCmpPredicate::EQ) + .Case("ne", IndexCmpPredicate::NE) + .Case("slt", IndexCmpPredicate::SLT) + .Case("sle", IndexCmpPredicate::SLE) + .Case("sgt", IndexCmpPredicate::SGT) + .Case("sge", IndexCmpPredicate::SGE) + .Case("ult", IndexCmpPredicate::ULT) + .Case("ule", IndexCmpPredicate::ULE) + .Case("ugt", IndexCmpPredicate::UGT) + .Case("uge", IndexCmpPredicate::UGE) + .Default(::std::nullopt); +} +::std::optional symbolizeIndexCmpPredicate(uint32_t value) { + switch (value) { + case 0: return IndexCmpPredicate::EQ; + case 1: return IndexCmpPredicate::NE; + case 2: return IndexCmpPredicate::SLT; + case 3: return IndexCmpPredicate::SLE; + case 4: return IndexCmpPredicate::SGT; + case 5: return IndexCmpPredicate::SGE; + case 6: return IndexCmpPredicate::ULT; + case 7: return IndexCmpPredicate::ULE; + case 8: return IndexCmpPredicate::UGT; + case 9: return IndexCmpPredicate::UGE; + default: return ::std::nullopt; + } +} + +} // namespace index +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..5c4ac5ca2f472a255ad9619acae158ef50472ac6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexEnums.h.inc @@ -0,0 +1,98 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: IndexEnums.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace index { +// index comparison predicate kind +enum class IndexCmpPredicate : uint32_t { + EQ = 0, + NE = 1, + SLT = 2, + SLE = 3, + SGT = 4, + SGE = 5, + ULT = 6, + ULE = 7, + UGT = 8, + UGE = 9, +}; + +::std::optional symbolizeIndexCmpPredicate(uint32_t); +::llvm::StringRef stringifyIndexCmpPredicate(IndexCmpPredicate); +::std::optional symbolizeIndexCmpPredicate(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForIndexCmpPredicate() { + return 9; +} + + +inline ::llvm::StringRef stringifyEnum(IndexCmpPredicate enumValue) { + return stringifyIndexCmpPredicate(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeIndexCmpPredicate(str); +} +} // namespace index +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::index::IndexCmpPredicate, ::mlir::index::IndexCmpPredicate> { + template + static FailureOr<::mlir::index::IndexCmpPredicate> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for index comparison predicate kind"); + + // Symbolize the keyword. + if (::std::optional<::mlir::index::IndexCmpPredicate> attr = ::mlir::index::symbolizeEnum<::mlir::index::IndexCmpPredicate>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid index comparison predicate kind specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::index::IndexCmpPredicate value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::index::IndexCmpPredicate> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::index::IndexCmpPredicate getEmptyKey() { + return static_cast<::mlir::index::IndexCmpPredicate>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::index::IndexCmpPredicate getTombstoneKey() { + return static_cast<::mlir::index::IndexCmpPredicate>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::index::IndexCmpPredicate &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::index::IndexCmpPredicate &lhs, const ::mlir::index::IndexCmpPredicate &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..5c170b4279fea35b3def3b63e49a51dbedf36591 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOps.cpp.inc @@ -0,0 +1,5916 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: IndexOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::index::AddOp, +::mlir::index::AndOp, +::mlir::index::BoolConstantOp, +::mlir::index::CastSOp, +::mlir::index::CastUOp, +::mlir::index::CeilDivSOp, +::mlir::index::CeilDivUOp, +::mlir::index::CmpOp, +::mlir::index::ConstantOp, +::mlir::index::DivSOp, +::mlir::index::DivUOp, +::mlir::index::FloorDivSOp, +::mlir::index::MaxSOp, +::mlir::index::MaxUOp, +::mlir::index::MinSOp, +::mlir::index::MinUOp, +::mlir::index::MulOp, +::mlir::index::OrOp, +::mlir::index::RemSOp, +::mlir::index::RemUOp, +::mlir::index::ShlOp, +::mlir::index::ShrSOp, +::mlir::index::ShrUOp, +::mlir::index::SizeOfOp, +::mlir::index::SubOp, +::mlir::index::XOrOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace index { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_IndexOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_IndexOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_IndexOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::IntegerType>(type))) || ((::llvm::isa<::mlir::IndexType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer or index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_IndexOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: bool attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_IndexOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_IndexOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_IndexOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::index::IndexCmpPredicateAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: index comparison predicate kind"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_IndexOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_IndexOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_IndexOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(attr).getType()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: index attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_IndexOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_IndexOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::AddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.add", odsAttrs.getContext()); +} + +AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(AddOp op) : AddOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AddOpAdaptor::AddOpAdaptor(AddOp op) : AddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> AddOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> AddOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AddOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AddOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> AddOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AddOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AddOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void AddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::AddOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::AndOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AndOpGenericAdaptorBase::AndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.and", odsAttrs.getContext()); +} + +AndOpGenericAdaptorBase::AndOpGenericAdaptorBase(AndOp op) : AndOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AndOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AndOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AndOpAdaptor::AndOpAdaptor(AndOp op) : AndOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AndOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AndOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AndOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> AndOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> AndOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AndOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AndOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AndOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AndOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> AndOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AndOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AndOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AndOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AndOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AndOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void AndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::AndOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::BoolConstantOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BoolConstantOpGenericAdaptorBase::BoolConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.bool.constant", odsAttrs.getContext()); +} + +BoolConstantOpGenericAdaptorBase::BoolConstantOpGenericAdaptorBase(BoolConstantOp op) : BoolConstantOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BoolConstantOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BoolConstantOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr BoolConstantOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::cast<::mlir::BoolAttr>(getProperties().value); + return attr; +} + +bool BoolConstantOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr.getValue(); +} + +} // namespace detail +BoolConstantOpAdaptor::BoolConstantOpAdaptor(BoolConstantOp op) : BoolConstantOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BoolConstantOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitError(loc, "'index.bool.constant' op ""requires attribute 'value'"); + + if (tblgen_value && !((::llvm::isa<::mlir::BoolAttr>(tblgen_value)))) + return emitError(loc, "'index.bool.constant' op ""attribute 'value' failed to satisfy constraint: bool attribute"); + return ::mlir::success(); +} + +std::pair BoolConstantOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BoolConstantOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BoolConstantOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BoolConstantOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> BoolConstantOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult BoolConstantOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute BoolConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BoolConstantOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional BoolConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void BoolConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void BoolConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult BoolConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_IndexOps0(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BoolConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BoolConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.value); +} + +::mlir::BoolAttr BoolConstantOp::getValueAttr() { + return ::llvm::cast<::mlir::BoolAttr>(getProperties().value); +} + +bool BoolConstantOp::getValue() { + auto attr = getValueAttr(); + return attr.getValue(); +} + +void BoolConstantOp::setValueAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void BoolConstantOp::setValue(bool attrValue) { + (*this)->setAttr(getValueAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void BoolConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::BoolAttr value) { + odsState.getOrAddProperties().value = value; + odsState.addTypes(result); +} + +void BoolConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::BoolAttr value) { + odsState.getOrAddProperties().value = value; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BoolConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void BoolConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr value) { + odsState.getOrAddProperties().value = value; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BoolConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, bool value) { + odsState.getOrAddProperties().value = odsBuilder.getBoolAttr(value); + odsState.addTypes(result); +} + +void BoolConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, bool value) { + odsState.getOrAddProperties().value = odsBuilder.getBoolAttr(value); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BoolConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void BoolConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, bool value) { + odsState.getOrAddProperties().value = odsBuilder.getBoolAttr(value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BoolConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void BoolConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BoolConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult BoolConstantOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitOpError("requires attribute 'value'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_IndexOps0(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BoolConstantOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult BoolConstantOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(1); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult BoolConstantOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::BoolAttr valueAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + if (parser.parseCustomAttributeWithFallback(valueAttr, parser.getBuilder().getIntegerType(1))) { + return ::mlir::failure(); + } + if (valueAttr) result.getOrAddProperties().value = valueAttr; + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void BoolConstantOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getValueAttr()); +} + +void BoolConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::BoolConstantOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CastSOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CastSOpGenericAdaptorBase::CastSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.casts", odsAttrs.getContext()); +} + +CastSOpGenericAdaptorBase::CastSOpGenericAdaptorBase(CastSOp op) : CastSOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CastSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CastSOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CastSOpAdaptor::CastSOpAdaptor(CastSOp op) : CastSOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CastSOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CastSOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CastSOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CastSOp::getInput() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CastSOp::getInputMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CastSOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CastSOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CastSOp::getOutput() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CastSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input) { + odsState.addOperands(input); + odsState.addTypes(output); +} + +void CastSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) { + odsState.addOperands(input); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CastSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CastSOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CastSOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CastSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(inputRawOperands); ::llvm::SMLoc inputOperandsLoc; + (void)inputOperandsLoc; + ::mlir::Type inputRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inputTypes(inputRawTypes); + ::mlir::Type outputRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outputTypes(outputRawTypes); + + inputOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inputRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outputRawTypes[0] = type; + } + result.addTypes(outputTypes); + if (parser.resolveOperands(inputOperands, inputTypes, inputOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CastSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getInput(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getInput().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOutput().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CastSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::CastSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CastUOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CastUOpGenericAdaptorBase::CastUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.castu", odsAttrs.getContext()); +} + +CastUOpGenericAdaptorBase::CastUOpGenericAdaptorBase(CastUOp op) : CastUOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CastUOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CastUOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CastUOpAdaptor::CastUOpAdaptor(CastUOp op) : CastUOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CastUOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CastUOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CastUOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CastUOp::getInput() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CastUOp::getInputMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CastUOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CastUOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CastUOp::getOutput() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CastUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input) { + odsState.addOperands(input); + odsState.addTypes(output); +} + +void CastUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) { + odsState.addOperands(input); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CastUOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CastUOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CastUOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CastUOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(inputRawOperands); ::llvm::SMLoc inputOperandsLoc; + (void)inputOperandsLoc; + ::mlir::Type inputRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inputTypes(inputRawTypes); + ::mlir::Type outputRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outputTypes(outputRawTypes); + + inputOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inputRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outputRawTypes[0] = type; + } + result.addTypes(outputTypes); + if (parser.resolveOperands(inputOperands, inputTypes, inputOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CastUOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getInput(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getInput().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getOutput().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CastUOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::CastUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CeilDivSOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CeilDivSOpGenericAdaptorBase::CeilDivSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.ceildivs", odsAttrs.getContext()); +} + +CeilDivSOpGenericAdaptorBase::CeilDivSOpGenericAdaptorBase(CeilDivSOp op) : CeilDivSOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CeilDivSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CeilDivSOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CeilDivSOpAdaptor::CeilDivSOpAdaptor(CeilDivSOp op) : CeilDivSOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CeilDivSOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CeilDivSOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CeilDivSOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> CeilDivSOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CeilDivSOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CeilDivSOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CeilDivSOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CeilDivSOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CeilDivSOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> CeilDivSOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void CeilDivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void CeilDivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilDivSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CeilDivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CeilDivSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CeilDivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilDivSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CeilDivSOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CeilDivSOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CeilDivSOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CeilDivSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CeilDivSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void CeilDivSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::CeilDivSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CeilDivUOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CeilDivUOpGenericAdaptorBase::CeilDivUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.ceildivu", odsAttrs.getContext()); +} + +CeilDivUOpGenericAdaptorBase::CeilDivUOpGenericAdaptorBase(CeilDivUOp op) : CeilDivUOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CeilDivUOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CeilDivUOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CeilDivUOpAdaptor::CeilDivUOpAdaptor(CeilDivUOp op) : CeilDivUOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CeilDivUOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CeilDivUOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CeilDivUOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> CeilDivUOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CeilDivUOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CeilDivUOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CeilDivUOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CeilDivUOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CeilDivUOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> CeilDivUOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void CeilDivUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void CeilDivUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilDivUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CeilDivUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CeilDivUOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CeilDivUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilDivUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CeilDivUOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CeilDivUOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CeilDivUOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CeilDivUOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CeilDivUOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void CeilDivUOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::CeilDivUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CmpOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CmpOpGenericAdaptorBase::CmpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.cmp", odsAttrs.getContext()); +} + +CmpOpGenericAdaptorBase::CmpOpGenericAdaptorBase(CmpOp op) : CmpOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CmpOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CmpOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::index::IndexCmpPredicateAttr CmpOpGenericAdaptorBase::getPredAttr() { + auto attr = ::llvm::cast<::mlir::index::IndexCmpPredicateAttr>(getProperties().pred); + return attr; +} + +::mlir::index::IndexCmpPredicate CmpOpGenericAdaptorBase::getPred() { + auto attr = getPredAttr(); + return attr.getValue(); +} + +} // namespace detail +CmpOpAdaptor::CmpOpAdaptor(CmpOp op) : CmpOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CmpOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_pred = getProperties().pred; (void)tblgen_pred; + if (!tblgen_pred) return emitError(loc, "'index.cmp' op ""requires attribute 'pred'"); + + if (tblgen_pred && !((::llvm::isa<::mlir::index::IndexCmpPredicateAttr>(tblgen_pred)))) + return emitError(loc, "'index.cmp' op ""attribute 'pred' failed to satisfy constraint: index comparison predicate kind"); + return ::mlir::success(); +} + +std::pair CmpOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CmpOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> CmpOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> CmpOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CmpOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CmpOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CmpOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CmpOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> CmpOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CmpOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.pred; + auto attr = dict.get("pred"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for pred in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `pred` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CmpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.pred; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("pred", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CmpOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.pred.getAsOpaquePointer())); +} + +std::optional CmpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "pred") + return prop.pred; + return std::nullopt; +} + +void CmpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "pred") { + prop.pred = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CmpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.pred) attrs.append("pred", prop.pred); +} + +::mlir::LogicalResult CmpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_IndexOps1(attr, "pred", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CmpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.pred))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CmpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.pred); +} + +::mlir::index::IndexCmpPredicateAttr CmpOp::getPredAttr() { + return ::llvm::cast<::mlir::index::IndexCmpPredicateAttr>(getProperties().pred); +} + +::mlir::index::IndexCmpPredicate CmpOp::getPred() { + auto attr = getPredAttr(); + return attr.getValue(); +} + +void CmpOp::setPredAttr(::mlir::index::IndexCmpPredicateAttr attr) { + (*this)->setAttr(getPredAttrName(), attr); +} + +void CmpOp::setPred(::mlir::index::IndexCmpPredicate attrValue) { + (*this)->setAttr(getPredAttrName(), ::mlir::index::IndexCmpPredicateAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::index::IndexCmpPredicateAttr pred, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().pred = pred; + odsState.addTypes(result); +} + +void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::index::IndexCmpPredicateAttr pred, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().pred = pred; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CmpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::index::IndexCmpPredicateAttr pred, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().pred = pred; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::index::IndexCmpPredicate pred, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().pred = ::mlir::index::IndexCmpPredicateAttr::get(odsBuilder.getContext(), pred); + odsState.addTypes(result); +} + +void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::index::IndexCmpPredicate pred, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().pred = ::mlir::index::IndexCmpPredicateAttr::get(odsBuilder.getContext(), pred); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CmpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::index::IndexCmpPredicate pred, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().pred = ::mlir::index::IndexCmpPredicateAttr::get(odsBuilder.getContext(), pred); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CmpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CmpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CmpOp::verifyInvariantsImpl() { + auto tblgen_pred = getProperties().pred; (void)tblgen_pred; + if (!tblgen_pred) return emitOpError("requires attribute 'pred'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_IndexOps1(*this, tblgen_pred, "pred"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CmpOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void CmpOp::getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context) { + results.add(canonicalize); +} + +::mlir::LogicalResult CmpOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(1); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CmpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::index::IndexCmpPredicateAttr predAttr; + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + if (parser.parseCustomAttributeWithFallback(predAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (predAttr) result.getOrAddProperties().pred = predAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType1, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType1, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CmpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { +_odsPrinter.printStrippedAttrOrType(getPredAttr()); + _odsPrinter << "("; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("pred"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void CmpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::CmpOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::ConstantOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.constant", odsAttrs.getContext()); +} + +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(ConstantOp op) : ConstantOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ConstantOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ConstantOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr ConstantOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().value); + return attr; +} + +::llvm::APInt ConstantOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr.getValue(); +} + +} // namespace detail +ConstantOpAdaptor::ConstantOpAdaptor(ConstantOp op) : ConstantOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ConstantOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitError(loc, "'index.constant' op ""requires attribute 'value'"); + + if (tblgen_value && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_value))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(tblgen_value).getType()))))) + return emitError(loc, "'index.constant' op ""attribute 'value' failed to satisfy constraint: index attribute"); + return ::mlir::success(); +} + +std::pair ConstantOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ConstantOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ConstantOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ConstantOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> ConstantOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ConstantOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ConstantOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional ConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void ConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult ConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_IndexOps2(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.value); +} + +::mlir::IntegerAttr ConstantOp::getValueAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().value); +} + +::llvm::APInt ConstantOp::getValue() { + auto attr = getValueAttr(); + return attr.getValue(); +} + +void ConstantOp::setValueAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void ConstantOp::setValue(::llvm::APInt attrValue) { + (*this)->setAttr(getValueAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIndexType(), attrValue)); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::IntegerAttr value) { + odsState.getOrAddProperties().value = value; + odsState.addTypes(result); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr value) { + odsState.getOrAddProperties().value = value; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr value) { + odsState.getOrAddProperties().value = value; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::APInt value) { + odsState.getOrAddProperties().value = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), value); + odsState.addTypes(result); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::APInt value) { + odsState.getOrAddProperties().value = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), value); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::APInt value) { + odsState.getOrAddProperties().value = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ConstantOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitOpError("requires attribute 'value'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_IndexOps2(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ConstantOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ConstantOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr valueAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + if (parser.parseCustomAttributeWithFallback(valueAttr, parser.getBuilder().getIndexType())) { + return ::mlir::failure(); + } + if (valueAttr) result.getOrAddProperties().value = valueAttr; + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void ConstantOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getValueAttr()); +} + +void ConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::ConstantOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::DivSOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DivSOpGenericAdaptorBase::DivSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.divs", odsAttrs.getContext()); +} + +DivSOpGenericAdaptorBase::DivSOpGenericAdaptorBase(DivSOp op) : DivSOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DivSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DivSOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DivSOpAdaptor::DivSOpAdaptor(DivSOp op) : DivSOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DivSOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DivSOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DivSOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> DivSOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> DivSOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &DivSOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &DivSOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DivSOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DivSOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> DivSOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void DivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void DivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DivSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult DivSOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivSOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult DivSOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult DivSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DivSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void DivSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::DivSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::DivUOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DivUOpGenericAdaptorBase::DivUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.divu", odsAttrs.getContext()); +} + +DivUOpGenericAdaptorBase::DivUOpGenericAdaptorBase(DivUOp op) : DivUOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DivUOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DivUOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DivUOpAdaptor::DivUOpAdaptor(DivUOp op) : DivUOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DivUOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DivUOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DivUOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> DivUOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> DivUOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &DivUOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &DivUOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DivUOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DivUOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> DivUOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void DivUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void DivUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DivUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DivUOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DivUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DivUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult DivUOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivUOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult DivUOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult DivUOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DivUOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void DivUOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::DivUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::FloorDivSOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FloorDivSOpGenericAdaptorBase::FloorDivSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.floordivs", odsAttrs.getContext()); +} + +FloorDivSOpGenericAdaptorBase::FloorDivSOpGenericAdaptorBase(FloorDivSOp op) : FloorDivSOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FloorDivSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FloorDivSOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FloorDivSOpAdaptor::FloorDivSOpAdaptor(FloorDivSOp op) : FloorDivSOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FloorDivSOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FloorDivSOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FloorDivSOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> FloorDivSOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> FloorDivSOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &FloorDivSOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FloorDivSOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair FloorDivSOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FloorDivSOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> FloorDivSOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void FloorDivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void FloorDivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FloorDivSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FloorDivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FloorDivSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FloorDivSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FloorDivSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult FloorDivSOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FloorDivSOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FloorDivSOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FloorDivSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FloorDivSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void FloorDivSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::FloorDivSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MaxSOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaxSOpGenericAdaptorBase::MaxSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.maxs", odsAttrs.getContext()); +} + +MaxSOpGenericAdaptorBase::MaxSOpGenericAdaptorBase(MaxSOp op) : MaxSOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaxSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaxSOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MaxSOpAdaptor::MaxSOpAdaptor(MaxSOp op) : MaxSOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaxSOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MaxSOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaxSOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MaxSOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MaxSOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MaxSOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaxSOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaxSOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaxSOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MaxSOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void MaxSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MaxSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaxSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaxSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MaxSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MaxSOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaxSOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MaxSOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MaxSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaxSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void MaxSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::MaxSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MaxUOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaxUOpGenericAdaptorBase::MaxUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.maxu", odsAttrs.getContext()); +} + +MaxUOpGenericAdaptorBase::MaxUOpGenericAdaptorBase(MaxUOp op) : MaxUOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaxUOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaxUOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MaxUOpAdaptor::MaxUOpAdaptor(MaxUOp op) : MaxUOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaxUOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MaxUOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaxUOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MaxUOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MaxUOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MaxUOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaxUOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaxUOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaxUOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MaxUOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void MaxUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MaxUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaxUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaxUOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MaxUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MaxUOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaxUOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MaxUOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MaxUOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaxUOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void MaxUOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::MaxUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MinSOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MinSOpGenericAdaptorBase::MinSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.mins", odsAttrs.getContext()); +} + +MinSOpGenericAdaptorBase::MinSOpGenericAdaptorBase(MinSOp op) : MinSOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MinSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MinSOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MinSOpAdaptor::MinSOpAdaptor(MinSOp op) : MinSOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MinSOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MinSOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MinSOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MinSOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MinSOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MinSOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MinSOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MinSOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MinSOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MinSOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void MinSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MinSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MinSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MinSOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinSOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MinSOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MinSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void MinSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::MinSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MinUOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MinUOpGenericAdaptorBase::MinUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.minu", odsAttrs.getContext()); +} + +MinUOpGenericAdaptorBase::MinUOpGenericAdaptorBase(MinUOp op) : MinUOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MinUOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MinUOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MinUOpAdaptor::MinUOpAdaptor(MinUOp op) : MinUOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MinUOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MinUOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MinUOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MinUOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MinUOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MinUOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MinUOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MinUOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MinUOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MinUOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void MinUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MinUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinUOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MinUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MinUOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinUOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MinUOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MinUOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinUOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void MinUOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::MinUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.mul", odsAttrs.getContext()); +} + +MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(MulOp op) : MulOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MulOpAdaptor::MulOpAdaptor(MulOp op) : MulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MulOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MulOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MulOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MulOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MulOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MulOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> MulOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MulOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void MulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::MulOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::OrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +OrOpGenericAdaptorBase::OrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.or", odsAttrs.getContext()); +} + +OrOpGenericAdaptorBase::OrOpGenericAdaptorBase(OrOp op) : OrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair OrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr OrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +OrOpAdaptor::OrOpAdaptor(OrOp op) : OrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult OrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair OrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range OrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> OrOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> OrOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &OrOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &OrOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair OrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range OrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> OrOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(OrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void OrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(OrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult OrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult OrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult OrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult OrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void OrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::OrOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::RemSOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RemSOpGenericAdaptorBase::RemSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.rems", odsAttrs.getContext()); +} + +RemSOpGenericAdaptorBase::RemSOpGenericAdaptorBase(RemSOp op) : RemSOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RemSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RemSOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RemSOpAdaptor::RemSOpAdaptor(RemSOp op) : RemSOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RemSOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RemSOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RemSOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> RemSOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> RemSOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &RemSOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RemSOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair RemSOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RemSOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> RemSOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void RemSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void RemSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RemSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RemSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RemSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RemSOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RemSOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RemSOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RemSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RemSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void RemSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::RemSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::RemUOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RemUOpGenericAdaptorBase::RemUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.remu", odsAttrs.getContext()); +} + +RemUOpGenericAdaptorBase::RemUOpGenericAdaptorBase(RemUOp op) : RemUOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RemUOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RemUOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RemUOpAdaptor::RemUOpAdaptor(RemUOp op) : RemUOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RemUOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RemUOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RemUOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> RemUOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> RemUOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &RemUOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RemUOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair RemUOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RemUOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> RemUOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void RemUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void RemUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RemUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RemUOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RemUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RemUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RemUOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RemUOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RemUOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RemUOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RemUOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void RemUOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::RemUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::ShlOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShlOpGenericAdaptorBase::ShlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.shl", odsAttrs.getContext()); +} + +ShlOpGenericAdaptorBase::ShlOpGenericAdaptorBase(ShlOp op) : ShlOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShlOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShlOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ShlOpAdaptor::ShlOpAdaptor(ShlOp op) : ShlOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShlOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ShlOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShlOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> ShlOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> ShlOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ShlOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShlOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShlOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShlOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> ShlOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShlOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShlOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShlOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ShlOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShlOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ShlOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ShlOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShlOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ShlOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::ShlOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::ShrSOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShrSOpGenericAdaptorBase::ShrSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.shrs", odsAttrs.getContext()); +} + +ShrSOpGenericAdaptorBase::ShrSOpGenericAdaptorBase(ShrSOp op) : ShrSOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShrSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShrSOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ShrSOpAdaptor::ShrSOpAdaptor(ShrSOp op) : ShrSOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShrSOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ShrSOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShrSOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> ShrSOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> ShrSOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ShrSOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShrSOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShrSOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShrSOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> ShrSOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void ShrSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void ShrSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShrSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ShrSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShrSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ShrSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShrSOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ShrSOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShrSOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ShrSOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ShrSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShrSOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ShrSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::ShrSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::ShrUOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShrUOpGenericAdaptorBase::ShrUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.shru", odsAttrs.getContext()); +} + +ShrUOpGenericAdaptorBase::ShrUOpGenericAdaptorBase(ShrUOp op) : ShrUOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShrUOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShrUOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ShrUOpAdaptor::ShrUOpAdaptor(ShrUOp op) : ShrUOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShrUOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ShrUOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShrUOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> ShrUOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> ShrUOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ShrUOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShrUOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShrUOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShrUOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> ShrUOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void ShrUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void ShrUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShrUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ShrUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShrUOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ShrUOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShrUOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ShrUOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShrUOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ShrUOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ShrUOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShrUOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ShrUOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::ShrUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::SizeOfOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SizeOfOpGenericAdaptorBase::SizeOfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.sizeof", odsAttrs.getContext()); +} + +SizeOfOpGenericAdaptorBase::SizeOfOpGenericAdaptorBase(SizeOfOp op) : SizeOfOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SizeOfOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SizeOfOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SizeOfOpAdaptor::SizeOfOpAdaptor(SizeOfOp op) : SizeOfOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SizeOfOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SizeOfOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SizeOfOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SizeOfOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SizeOfOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> SizeOfOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void SizeOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) { + odsState.addTypes(result); +} + +void SizeOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SizeOfOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SizeOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SizeOfOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SizeOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SizeOfOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SizeOfOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SizeOfOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SizeOfOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SizeOfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void SizeOfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void SizeOfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::SizeOfOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::SubOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.sub", odsAttrs.getContext()); +} + +SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(SubOp op) : SubOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SubOpAdaptor::SubOpAdaptor(SubOp op) : SubOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SubOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> SubOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> SubOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SubOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SubOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SubOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> SubOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SubOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SubOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void SubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::SubOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::XOrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +XOrOpGenericAdaptorBase::XOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("index.xor", odsAttrs.getContext()); +} + +XOrOpGenericAdaptorBase::XOrOpGenericAdaptorBase(XOrOp op) : XOrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair XOrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr XOrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +XOrOpAdaptor::XOrOpAdaptor(XOrOp op) : XOrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult XOrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair XOrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range XOrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> XOrOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> XOrOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &XOrOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &XOrOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair XOrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range XOrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> XOrOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(XOrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void XOrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(XOrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult XOrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_IndexOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult XOrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult XOrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult XOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void XOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void XOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::XOrOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOps.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOps.h new file mode 100644 index 0000000000000000000000000000000000000000..8984f979c1fee9438f27457b6ffa98759467aa4f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOps.h @@ -0,0 +1,41 @@ +//===- IndexOps.h - Index operation declarations ------------------*- C++-*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_INDEX_IR_INDEXOPS_H +#define MLIR_DIALECT_INDEX_IR_INDEXOPS_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/Index/IR/IndexAttrs.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/Interfaces/CastInterfaces.h" +#include "mlir/Interfaces/InferIntRangeInterface.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +//===----------------------------------------------------------------------===// +// Forward Declarations +//===----------------------------------------------------------------------===// + +namespace mlir { +class PatternRewriter; +namespace index { +enum class IndexCmpPredicate : uint32_t; +class IndexCmpPredicateAttr; +} // namespace index +} // namespace mlir + +//===----------------------------------------------------------------------===// +// ODS-Generated Declarations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/Index/IR/IndexOps.h.inc" + +#endif // MLIR_DIALECT_INDEX_IR_INDEXOPS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e0b3241a4af59271353df117e3c3fbad30e691e3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOps.h.inc @@ -0,0 +1,3184 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: IndexOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace index { +class AddOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class AndOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class BoolConstantOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class CastSOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class CastUOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class CeilDivSOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class CeilDivUOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class CmpOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class ConstantOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class DivSOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class DivUOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class FloorDivSOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class MaxSOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class MaxUOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class MinSOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class MinUOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class MulOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class OrOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class RemSOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class RemUOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class ShlOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class ShrSOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class ShrUOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class SizeOfOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class SubOp; +} // namespace index +} // namespace mlir +namespace mlir { +namespace index { +class XOrOp; +} // namespace index +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::AddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddOpGenericAdaptorBase(AddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddOpGenericAdaptorBase; +public: + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddOpGenericAdaptor::AddOpGenericAdaptor; + AddOpAdaptor(AddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddOpAdaptor; + template + using GenericAdaptor = AddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::AddOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::AndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AndOpGenericAdaptorBase(AndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AndOpGenericAdaptor : public detail::AndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AndOpGenericAdaptorBase; +public: + AndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AndOpAdaptor : public AndOpGenericAdaptor<::mlir::ValueRange> { +public: + using AndOpGenericAdaptor::AndOpGenericAdaptor; + AndOpAdaptor(AndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AndOpAdaptor; + template + using GenericAdaptor = AndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.and"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::AndOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::BoolConstantOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BoolConstantOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::BoolAttr; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::cast<::mlir::BoolAttr>(propStorage); + } + void setValue(const ::mlir::BoolAttr &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BoolConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BoolConstantOpGenericAdaptorBase(BoolConstantOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getValueAttr(); + bool getValue(); +}; +} // namespace detail +template +class BoolConstantOpGenericAdaptor : public detail::BoolConstantOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BoolConstantOpGenericAdaptorBase; +public: + BoolConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BoolConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BoolConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BoolConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BoolConstantOpAdaptor : public BoolConstantOpGenericAdaptor<::mlir::ValueRange> { +public: + using BoolConstantOpGenericAdaptor::BoolConstantOpGenericAdaptor; + BoolConstantOpAdaptor(BoolConstantOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BoolConstantOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BoolConstantOpAdaptor; + template + using GenericAdaptor = BoolConstantOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.bool.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getValueAttr(); + bool getValue(); + void setValueAttr(::mlir::BoolAttr attr); + void setValue(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::BoolAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::BoolAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::BoolAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, bool value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, bool value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, bool value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::BoolConstantOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CastSOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CastSOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CastSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CastSOpGenericAdaptorBase(CastSOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CastSOpGenericAdaptor : public detail::CastSOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CastSOpGenericAdaptorBase; +public: + CastSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CastSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CastSOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CastSOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CastSOpAdaptor : public CastSOpGenericAdaptor<::mlir::ValueRange> { +public: + using CastSOpGenericAdaptor::CastSOpGenericAdaptor; + CastSOpAdaptor(CastSOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CastSOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::CastOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CastSOpAdaptor; + template + using GenericAdaptor = CastSOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.casts"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::CastSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CastUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CastUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CastUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CastUOpGenericAdaptorBase(CastUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CastUOpGenericAdaptor : public detail::CastUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CastUOpGenericAdaptorBase; +public: + CastUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CastUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CastUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CastUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CastUOpAdaptor : public CastUOpGenericAdaptor<::mlir::ValueRange> { +public: + using CastUOpGenericAdaptor::CastUOpGenericAdaptor; + CastUOpAdaptor(CastUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CastUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::CastOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CastUOpAdaptor; + template + using GenericAdaptor = CastUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.castu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::CastUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CeilDivSOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilDivSOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CeilDivSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilDivSOpGenericAdaptorBase(CeilDivSOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CeilDivSOpGenericAdaptor : public detail::CeilDivSOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilDivSOpGenericAdaptorBase; +public: + CeilDivSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilDivSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilDivSOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CeilDivSOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilDivSOpAdaptor : public CeilDivSOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilDivSOpGenericAdaptor::CeilDivSOpGenericAdaptor; + CeilDivSOpAdaptor(CeilDivSOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilDivSOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilDivSOpAdaptor; + template + using GenericAdaptor = CeilDivSOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.ceildivs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::CeilDivSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CeilDivUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilDivUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CeilDivUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilDivUOpGenericAdaptorBase(CeilDivUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CeilDivUOpGenericAdaptor : public detail::CeilDivUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilDivUOpGenericAdaptorBase; +public: + CeilDivUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilDivUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilDivUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CeilDivUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilDivUOpAdaptor : public CeilDivUOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilDivUOpGenericAdaptor::CeilDivUOpGenericAdaptor; + CeilDivUOpAdaptor(CeilDivUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilDivUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilDivUOpAdaptor; + template + using GenericAdaptor = CeilDivUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.ceildivu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::CeilDivUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::CmpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CmpOpGenericAdaptorBase { +public: + struct Properties { + using predTy = ::mlir::index::IndexCmpPredicateAttr; + predTy pred; + + auto getPred() { + auto &propStorage = this->pred; + return ::llvm::cast<::mlir::index::IndexCmpPredicateAttr>(propStorage); + } + void setPred(const ::mlir::index::IndexCmpPredicateAttr &propValue) { + this->pred = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.pred == this->pred && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CmpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CmpOpGenericAdaptorBase(CmpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::index::IndexCmpPredicateAttr getPredAttr(); + ::mlir::index::IndexCmpPredicate getPred(); +}; +} // namespace detail +template +class CmpOpGenericAdaptor : public detail::CmpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CmpOpGenericAdaptorBase; +public: + CmpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CmpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CmpOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CmpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CmpOpAdaptor : public CmpOpGenericAdaptor<::mlir::ValueRange> { +public: + using CmpOpGenericAdaptor::CmpOpGenericAdaptor; + CmpOpAdaptor(CmpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CmpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CmpOpAdaptor; + template + using GenericAdaptor = CmpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("pred")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPredAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.cmp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::index::IndexCmpPredicateAttr getPredAttr(); + ::mlir::index::IndexCmpPredicate getPred(); + void setPredAttr(::mlir::index::IndexCmpPredicateAttr attr); + void setPred(::mlir::index::IndexCmpPredicate attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::index::IndexCmpPredicateAttr pred, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::index::IndexCmpPredicateAttr pred, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::index::IndexCmpPredicateAttr pred, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::index::IndexCmpPredicate pred, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::index::IndexCmpPredicate pred, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::index::IndexCmpPredicate pred, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult canonicalize(CmpOp op, ::mlir::PatternRewriter &rewriter); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::CmpOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::ConstantOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstantOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::IntegerAttr; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setValue(const ::mlir::IntegerAttr &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstantOpGenericAdaptorBase(ConstantOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getValueAttr(); + ::llvm::APInt getValue(); +}; +} // namespace detail +template +class ConstantOpGenericAdaptor : public detail::ConstantOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstantOpGenericAdaptorBase; +public: + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstantOpAdaptor : public ConstantOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstantOpGenericAdaptor::ConstantOpGenericAdaptor; + ConstantOpAdaptor(ConstantOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstantOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstantOpAdaptor; + template + using GenericAdaptor = ConstantOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getValueAttr(); + ::llvm::APInt getValue(); + void setValueAttr(::mlir::IntegerAttr attr); + void setValue(::llvm::APInt attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, int64_t value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::IntegerAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::APInt value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::APInt value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::APInt value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::ConstantOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::DivSOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivSOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivSOpGenericAdaptorBase(DivSOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DivSOpGenericAdaptor : public detail::DivSOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivSOpGenericAdaptorBase; +public: + DivSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivSOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivSOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivSOpAdaptor : public DivSOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivSOpGenericAdaptor::DivSOpGenericAdaptor; + DivSOpAdaptor(DivSOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivSOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivSOpAdaptor; + template + using GenericAdaptor = DivSOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.divs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::DivSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::DivUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivUOpGenericAdaptorBase(DivUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DivUOpGenericAdaptor : public detail::DivUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivUOpGenericAdaptorBase; +public: + DivUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivUOpAdaptor : public DivUOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivUOpGenericAdaptor::DivUOpGenericAdaptor; + DivUOpAdaptor(DivUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivUOpAdaptor; + template + using GenericAdaptor = DivUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.divu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::DivUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::FloorDivSOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorDivSOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorDivSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorDivSOpGenericAdaptorBase(FloorDivSOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorDivSOpGenericAdaptor : public detail::FloorDivSOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorDivSOpGenericAdaptorBase; +public: + FloorDivSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorDivSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorDivSOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorDivSOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorDivSOpAdaptor : public FloorDivSOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorDivSOpGenericAdaptor::FloorDivSOpGenericAdaptor; + FloorDivSOpAdaptor(FloorDivSOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorDivSOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorDivSOpAdaptor; + template + using GenericAdaptor = FloorDivSOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.floordivs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::FloorDivSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MaxSOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxSOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxSOpGenericAdaptorBase(MaxSOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MaxSOpGenericAdaptor : public detail::MaxSOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxSOpGenericAdaptorBase; +public: + MaxSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxSOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxSOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxSOpAdaptor : public MaxSOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxSOpGenericAdaptor::MaxSOpGenericAdaptor; + MaxSOpAdaptor(MaxSOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxSOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxSOpAdaptor; + template + using GenericAdaptor = MaxSOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.maxs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::MaxSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MaxUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxUOpGenericAdaptorBase(MaxUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MaxUOpGenericAdaptor : public detail::MaxUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxUOpGenericAdaptorBase; +public: + MaxUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxUOpAdaptor : public MaxUOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxUOpGenericAdaptor::MaxUOpGenericAdaptor; + MaxUOpAdaptor(MaxUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxUOpAdaptor; + template + using GenericAdaptor = MaxUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.maxu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::MaxUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MinSOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinSOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinSOpGenericAdaptorBase(MinSOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MinSOpGenericAdaptor : public detail::MinSOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinSOpGenericAdaptorBase; +public: + MinSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinSOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinSOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinSOpAdaptor : public MinSOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinSOpGenericAdaptor::MinSOpGenericAdaptor; + MinSOpAdaptor(MinSOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinSOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinSOpAdaptor; + template + using GenericAdaptor = MinSOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.mins"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::MinSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MinUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinUOpGenericAdaptorBase(MinUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MinUOpGenericAdaptor : public detail::MinUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinUOpGenericAdaptorBase; +public: + MinUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinUOpAdaptor : public MinUOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinUOpGenericAdaptor::MinUOpGenericAdaptor; + MinUOpAdaptor(MinUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinUOpAdaptor; + template + using GenericAdaptor = MinUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.minu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::MinUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::MulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulOpGenericAdaptorBase(MulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulOpGenericAdaptorBase; +public: + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulOpGenericAdaptor::MulOpGenericAdaptor; + MulOpAdaptor(MulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulOpAdaptor; + template + using GenericAdaptor = MulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::MulOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::OrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OrOpGenericAdaptorBase(OrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OrOpGenericAdaptor : public detail::OrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OrOpGenericAdaptorBase; +public: + OrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OrOpAdaptor : public OrOpGenericAdaptor<::mlir::ValueRange> { +public: + using OrOpGenericAdaptor::OrOpGenericAdaptor; + OrOpAdaptor(OrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OrOpAdaptor; + template + using GenericAdaptor = OrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.or"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::OrOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::RemSOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemSOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RemSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RemSOpGenericAdaptorBase(RemSOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RemSOpGenericAdaptor : public detail::RemSOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemSOpGenericAdaptorBase; +public: + RemSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemSOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RemSOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemSOpAdaptor : public RemSOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemSOpGenericAdaptor::RemSOpGenericAdaptor; + RemSOpAdaptor(RemSOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemSOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemSOpAdaptor; + template + using GenericAdaptor = RemSOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.rems"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::RemSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::RemUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RemUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RemUOpGenericAdaptorBase(RemUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RemUOpGenericAdaptor : public detail::RemUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemUOpGenericAdaptorBase; +public: + RemUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RemUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemUOpAdaptor : public RemUOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemUOpGenericAdaptor::RemUOpGenericAdaptor; + RemUOpAdaptor(RemUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemUOpAdaptor; + template + using GenericAdaptor = RemUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.remu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::RemUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::ShlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShlOpGenericAdaptorBase(ShlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShlOpGenericAdaptor : public detail::ShlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShlOpGenericAdaptorBase; +public: + ShlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShlOpAdaptor : public ShlOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShlOpGenericAdaptor::ShlOpGenericAdaptor; + ShlOpAdaptor(ShlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShlOpAdaptor; + template + using GenericAdaptor = ShlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.shl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::ShlOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::ShrSOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShrSOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShrSOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShrSOpGenericAdaptorBase(ShrSOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShrSOpGenericAdaptor : public detail::ShrSOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShrSOpGenericAdaptorBase; +public: + ShrSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShrSOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShrSOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShrSOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShrSOpAdaptor : public ShrSOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShrSOpGenericAdaptor::ShrSOpGenericAdaptor; + ShrSOpAdaptor(ShrSOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShrSOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShrSOpAdaptor; + template + using GenericAdaptor = ShrSOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.shrs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::ShrSOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::ShrUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShrUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShrUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShrUOpGenericAdaptorBase(ShrUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShrUOpGenericAdaptor : public detail::ShrUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShrUOpGenericAdaptorBase; +public: + ShrUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShrUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShrUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShrUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShrUOpAdaptor : public ShrUOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShrUOpGenericAdaptor::ShrUOpGenericAdaptor; + ShrUOpAdaptor(ShrUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShrUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShrUOpAdaptor; + template + using GenericAdaptor = ShrUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.shru"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::ShrUOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::SizeOfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SizeOfOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SizeOfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SizeOfOpGenericAdaptorBase(SizeOfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SizeOfOpGenericAdaptor : public detail::SizeOfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SizeOfOpGenericAdaptorBase; +public: + SizeOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SizeOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SizeOfOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SizeOfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SizeOfOpAdaptor : public SizeOfOpGenericAdaptor<::mlir::ValueRange> { +public: + using SizeOfOpGenericAdaptor::SizeOfOpGenericAdaptor; + SizeOfOpAdaptor(SizeOfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SizeOfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SizeOfOpAdaptor; + template + using GenericAdaptor = SizeOfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.sizeof"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::SizeOfOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::SubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubOpGenericAdaptorBase(SubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SubOpGenericAdaptor : public detail::SubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubOpGenericAdaptorBase; +public: + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubOpAdaptor : public SubOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubOpGenericAdaptor::SubOpGenericAdaptor; + SubOpAdaptor(SubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubOpAdaptor; + template + using GenericAdaptor = SubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.sub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::SubOp) + +namespace mlir { +namespace index { + +//===----------------------------------------------------------------------===// +// ::mlir::index::XOrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XOrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XOrOpGenericAdaptorBase(XOrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XOrOpGenericAdaptor : public detail::XOrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XOrOpGenericAdaptorBase; +public: + XOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XOrOpAdaptor : public XOrOpGenericAdaptor<::mlir::ValueRange> { +public: + using XOrOpGenericAdaptor::XOrOpGenericAdaptor; + XOrOpAdaptor(XOrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferIntRangeInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XOrOpAdaptor; + template + using GenericAdaptor = XOrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("index.xor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getLhs(); + ::mlir::TypedValue<::mlir::IndexType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void inferResultRanges(::llvm::ArrayRef<::mlir::ConstantIntRanges> argRanges, ::mlir::SetIntRangeFn setResultRanges); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::XOrOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..77c66cc52e884319f0cd2427bfbbf02c2a04a5f2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.cpp.inc @@ -0,0 +1,140 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::index::IndexCmpPredicateAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::index::IndexCmpPredicateAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::index::IndexCmpPredicateAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::index::IndexCmpPredicateAttr>([&](auto t) { + printer << ::mlir::index::IndexCmpPredicateAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace index { +namespace detail { +struct IndexCmpPredicateAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::index::IndexCmpPredicate>; + IndexCmpPredicateAttrStorage(::mlir::index::IndexCmpPredicate value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static IndexCmpPredicateAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) IndexCmpPredicateAttrStorage(std::move(value)); + } + + ::mlir::index::IndexCmpPredicate value; +}; +} // namespace detail +IndexCmpPredicateAttr IndexCmpPredicateAttr::get(::mlir::MLIRContext *context, ::mlir::index::IndexCmpPredicate value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute IndexCmpPredicateAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::index::IndexCmpPredicate> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::index::IndexCmpPredicate> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::index::symbolizeIndexCmpPredicate(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::index::IndexCmpPredicate" << " to be one of: " << "eq" << ", " << "ne" << ", " << "slt" << ", " << "sle" << ", " << "sgt" << ", " << "sge" << ", " << "ult" << ", " << "ule" << ", " << "ugt" << ", " << "uge")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse IndexCmpPredicateAttr parameter 'value' which is to be a `::mlir::index::IndexCmpPredicate`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return IndexCmpPredicateAttr::get(odsParser.getContext(), + ::mlir::index::IndexCmpPredicate((*_result_value))); +} + +void IndexCmpPredicateAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyIndexCmpPredicate(getValue()); +} + +::mlir::index::IndexCmpPredicate IndexCmpPredicateAttr::getValue() const { + return getImpl()->value; +} + +} // namespace index +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::IndexCmpPredicateAttr) +namespace mlir { +namespace index { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute IndexDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void IndexDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace index +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..2840fb1b4179ddee53d02c33aa1a8232596f33ae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.h.inc @@ -0,0 +1,40 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace index { +class IndexCmpPredicateAttr; +namespace detail { +struct IndexCmpPredicateAttrStorage; +} // namespace detail +class IndexCmpPredicateAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static IndexCmpPredicateAttr get(::mlir::MLIRContext *context, ::mlir::index::IndexCmpPredicate value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"cmp_predicate"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::index::IndexCmpPredicate getValue() const; +}; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::IndexCmpPredicateAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..e9d7b970bf0150e2a72fa9db73530ce57547a488 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: IndexOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::index::IndexDialect) +namespace mlir { +namespace index { + +IndexDialect::IndexDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +IndexDialect::~IndexDialect() = default; + +} // namespace index +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..7911923f20b6aa77514a49b92585ad3f90f6a0dc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Index/IR/IndexOpsDialect.h.inc @@ -0,0 +1,46 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: IndexOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace index { + +class IndexDialect : public ::mlir::Dialect { + explicit IndexDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~IndexDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("index"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Materialize a single constant operation from a given attribute value with + /// the desired resultant type. + ::mlir::Operation *materializeConstant(::mlir::OpBuilder &builder, + ::mlir::Attribute value, + ::mlir::Type type, + ::mlir::Location loc) override; + + /// Register all dialect attributes. + void registerAttributes(); + /// Register all dialect operations. + void registerOperations(); + }; +} // namespace index +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::index::IndexDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..17aa9a3c831c2e0ef2b92b520fc33727d0582010 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h @@ -0,0 +1,70 @@ +//===- FunctionCallUtils.h - Utilities for C function calls -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares helper functions to call common simple C functions in +// LLVMIR (e.g. among others to support printing and debugging). +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_FUNCTIONCALLUTILS_H_ +#define MLIR_DIALECT_LLVMIR_FUNCTIONCALLUTILS_H_ + +#include "mlir/IR/Operation.h" +#include "mlir/Support/LLVM.h" + +namespace mlir { +class Location; +class ModuleOp; +class OpBuilder; +class Operation; +class Type; +class ValueRange; + +namespace LLVM { +class LLVMFuncOp; + +/// Helper functions to lookup or create the declaration for commonly used +/// external C function calls. The list of functions provided here must be +/// implemented separately (e.g. as part of a support runtime library or as part +/// of the libc). +LLVM::LLVMFuncOp lookupOrCreatePrintI64Fn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreatePrintU64Fn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreatePrintF16Fn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreatePrintBF16Fn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreatePrintF32Fn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreatePrintF64Fn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreatePrintStrFn(ModuleOp moduleOp, + bool opaquePointers); +LLVM::LLVMFuncOp lookupOrCreatePrintOpenFn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreatePrintCloseFn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreatePrintCommaFn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreatePrintNewlineFn(ModuleOp moduleOp); +LLVM::LLVMFuncOp lookupOrCreateMallocFn(ModuleOp moduleOp, Type indexType, + bool opaquePointers); +LLVM::LLVMFuncOp lookupOrCreateAlignedAllocFn(ModuleOp moduleOp, Type indexType, + bool opaquePointers); +LLVM::LLVMFuncOp lookupOrCreateFreeFn(ModuleOp moduleOp, bool opaquePointers); +LLVM::LLVMFuncOp lookupOrCreateGenericAllocFn(ModuleOp moduleOp, Type indexType, + bool opaquePointers); +LLVM::LLVMFuncOp lookupOrCreateGenericAlignedAllocFn(ModuleOp moduleOp, + Type indexType, + bool opaquePointers); +LLVM::LLVMFuncOp lookupOrCreateGenericFreeFn(ModuleOp moduleOp, + bool opaquePointers); +LLVM::LLVMFuncOp lookupOrCreateMemRefCopyFn(ModuleOp moduleOp, Type indexType, + Type unrankedDescriptorType); + +/// Create a FuncOp with signature `resultType`(`paramTypes`)` and name `name`. +LLVM::LLVMFuncOp lookupOrCreateFn(ModuleOp moduleOp, StringRef name, + ArrayRef paramTypes = {}, + Type resultType = {}, bool isVarArg = false); + +} // namespace LLVM +} // namespace mlir + +#endif // MLIR_DIALECT_LLVMIR_FUNCTIONCALLUTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h new file mode 100644 index 0000000000000000000000000000000000000000..c370bfa2b733d65f3387a1c5ea24350951b11ce7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h @@ -0,0 +1,90 @@ +//===- LLVMDialect.h - MLIR LLVM IR dialect ---------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the LLVM IR dialect in MLIR, containing LLVM operations and +// LLVM type system. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_LLVMATTRS_H_ +#define MLIR_DIALECT_LLVMIR_LLVMATTRS_H_ + +#include "mlir/Dialect/LLVMIR/LLVMTypes.h" +#include "mlir/IR/OpImplementation.h" +#include + +#include "mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc" + +namespace mlir { +namespace LLVM { + +/// This class represents the base attribute for all debug info attributes. +class DINodeAttr : public Attribute { +public: + using Attribute::Attribute; + + // Support LLVM type casting. + static bool classof(Attribute attr); +}; + +/// This class represents a LLVM attribute that describes a debug info scope. +class DIScopeAttr : public DINodeAttr { +public: + using DINodeAttr::DINodeAttr; + + /// Support LLVM type casting. + static bool classof(Attribute attr); +}; + +/// This class represents a LLVM attribute that describes a local debug info +/// scope. +class DILocalScopeAttr : public DIScopeAttr { +public: + using DIScopeAttr::DIScopeAttr; + + /// Support LLVM type casting. + static bool classof(Attribute attr); +}; + +/// This class represents a LLVM attribute that describes a debug info type. +class DITypeAttr : public DINodeAttr { +public: + using DINodeAttr::DINodeAttr; + + /// Support LLVM type casting. + static bool classof(Attribute attr); +}; + +/// Base class for LLVM attributes participating in the TBAA graph. +class TBAANodeAttr : public Attribute { +public: + using Attribute::Attribute; + + /// Support LLVM type casting. + static bool classof(Attribute attr); + + /// Required by DenseMapInfo to create empty and tombstone key. + static TBAANodeAttr getFromOpaquePointer(const void *pointer) { + return TBAANodeAttr(reinterpret_cast(pointer)); + } +}; + +// Inline the LLVM generated Linkage enum and utility. +// This is only necessary to isolate the "enum generated code" from the +// attribute definition itself. +// TODO: this shouldn't be needed after we unify the attribute generation, i.e. +// --gen-attr-* and --gen-attrdef-*. +using cconv::CConv; +using linkage::Linkage; +} // namespace LLVM +} // namespace mlir + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc" + +#endif // MLIR_DIALECT_LLVMIR_LLVMATTRS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConversionEnumsFromLLVM.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConversionEnumsFromLLVM.inc new file mode 100644 index 0000000000000000000000000000000000000000..ba2ee9d415b48f4174bf9bd28061affd147ad197 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConversionEnumsFromLLVM.inc @@ -0,0 +1,369 @@ +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::AsmDialect convertAsmDialectFromLLVM(::llvm::InlineAsm::AsmDialect value) { + switch (value) { + case ::llvm::InlineAsm::AsmDialect::AD_ATT: + return ::mlir::LLVM::AsmDialect::AD_ATT; + case ::llvm::InlineAsm::AsmDialect::AD_Intel: + return ::mlir::LLVM::AsmDialect::AD_Intel; + } + llvm_unreachable("unknown ::llvm::InlineAsm::AsmDialect type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::AtomicBinOp convertAtomicBinOpFromLLVM(::llvm::AtomicRMWInst::BinOp value) { + switch (value) { + case ::llvm::AtomicRMWInst::BinOp::Xchg: + return ::mlir::LLVM::AtomicBinOp::xchg; + case ::llvm::AtomicRMWInst::BinOp::Add: + return ::mlir::LLVM::AtomicBinOp::add; + case ::llvm::AtomicRMWInst::BinOp::Sub: + return ::mlir::LLVM::AtomicBinOp::sub; + case ::llvm::AtomicRMWInst::BinOp::And: + return ::mlir::LLVM::AtomicBinOp::_and; + case ::llvm::AtomicRMWInst::BinOp::Nand: + return ::mlir::LLVM::AtomicBinOp::nand; + case ::llvm::AtomicRMWInst::BinOp::Or: + return ::mlir::LLVM::AtomicBinOp::_or; + case ::llvm::AtomicRMWInst::BinOp::Xor: + return ::mlir::LLVM::AtomicBinOp::_xor; + case ::llvm::AtomicRMWInst::BinOp::Max: + return ::mlir::LLVM::AtomicBinOp::max; + case ::llvm::AtomicRMWInst::BinOp::Min: + return ::mlir::LLVM::AtomicBinOp::min; + case ::llvm::AtomicRMWInst::BinOp::UMax: + return ::mlir::LLVM::AtomicBinOp::umax; + case ::llvm::AtomicRMWInst::BinOp::UMin: + return ::mlir::LLVM::AtomicBinOp::umin; + case ::llvm::AtomicRMWInst::BinOp::FAdd: + return ::mlir::LLVM::AtomicBinOp::fadd; + case ::llvm::AtomicRMWInst::BinOp::FSub: + return ::mlir::LLVM::AtomicBinOp::fsub; + case ::llvm::AtomicRMWInst::BinOp::FMax: + return ::mlir::LLVM::AtomicBinOp::fmax; + case ::llvm::AtomicRMWInst::BinOp::FMin: + return ::mlir::LLVM::AtomicBinOp::fmin; + case ::llvm::AtomicRMWInst::BinOp::UIncWrap: + return ::mlir::LLVM::AtomicBinOp::uinc_wrap; + case ::llvm::AtomicRMWInst::BinOp::UDecWrap: + return ::mlir::LLVM::AtomicBinOp::udec_wrap; + case ::llvm::AtomicRMWInst::BinOp::BAD_BINOP: + llvm_unreachable("unsupported case ::llvm::AtomicRMWInst::BinOp::BAD_BINOP"); + } + llvm_unreachable("unknown ::llvm::AtomicRMWInst::BinOp type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::AtomicOrdering convertAtomicOrderingFromLLVM(::llvm::AtomicOrdering value) { + switch (value) { + case ::llvm::AtomicOrdering::NotAtomic: + return ::mlir::LLVM::AtomicOrdering::not_atomic; + case ::llvm::AtomicOrdering::Unordered: + return ::mlir::LLVM::AtomicOrdering::unordered; + case ::llvm::AtomicOrdering::Monotonic: + return ::mlir::LLVM::AtomicOrdering::monotonic; + case ::llvm::AtomicOrdering::Acquire: + return ::mlir::LLVM::AtomicOrdering::acquire; + case ::llvm::AtomicOrdering::Release: + return ::mlir::LLVM::AtomicOrdering::release; + case ::llvm::AtomicOrdering::AcquireRelease: + return ::mlir::LLVM::AtomicOrdering::acq_rel; + case ::llvm::AtomicOrdering::SequentiallyConsistent: + return ::mlir::LLVM::AtomicOrdering::seq_cst; + } + llvm_unreachable("unknown ::llvm::AtomicOrdering type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::comdat::Comdat convertComdatFromLLVM(::llvm::Comdat::SelectionKind value) { + switch (value) { + case ::llvm::Comdat::SelectionKind::Any: + return ::mlir::LLVM::comdat::Comdat::Any; + case ::llvm::Comdat::SelectionKind::ExactMatch: + return ::mlir::LLVM::comdat::Comdat::ExactMatch; + case ::llvm::Comdat::SelectionKind::Largest: + return ::mlir::LLVM::comdat::Comdat::Largest; + case ::llvm::Comdat::SelectionKind::NoDeduplicate: + return ::mlir::LLVM::comdat::Comdat::NoDeduplicate; + case ::llvm::Comdat::SelectionKind::SameSize: + return ::mlir::LLVM::comdat::Comdat::SameSize; + } + llvm_unreachable("unknown ::llvm::Comdat::SelectionKind type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::FCmpPredicate convertFCmpPredicateFromLLVM(::llvm::CmpInst::Predicate value) { + switch (value) { + case ::llvm::CmpInst::Predicate::FCMP_FALSE: + return ::mlir::LLVM::FCmpPredicate::_false; + case ::llvm::CmpInst::Predicate::FCMP_OEQ: + return ::mlir::LLVM::FCmpPredicate::oeq; + case ::llvm::CmpInst::Predicate::FCMP_OGT: + return ::mlir::LLVM::FCmpPredicate::ogt; + case ::llvm::CmpInst::Predicate::FCMP_OGE: + return ::mlir::LLVM::FCmpPredicate::oge; + case ::llvm::CmpInst::Predicate::FCMP_OLT: + return ::mlir::LLVM::FCmpPredicate::olt; + case ::llvm::CmpInst::Predicate::FCMP_OLE: + return ::mlir::LLVM::FCmpPredicate::ole; + case ::llvm::CmpInst::Predicate::FCMP_ONE: + return ::mlir::LLVM::FCmpPredicate::one; + case ::llvm::CmpInst::Predicate::FCMP_ORD: + return ::mlir::LLVM::FCmpPredicate::ord; + case ::llvm::CmpInst::Predicate::FCMP_UEQ: + return ::mlir::LLVM::FCmpPredicate::ueq; + case ::llvm::CmpInst::Predicate::FCMP_UGT: + return ::mlir::LLVM::FCmpPredicate::ugt; + case ::llvm::CmpInst::Predicate::FCMP_UGE: + return ::mlir::LLVM::FCmpPredicate::uge; + case ::llvm::CmpInst::Predicate::FCMP_ULT: + return ::mlir::LLVM::FCmpPredicate::ult; + case ::llvm::CmpInst::Predicate::FCMP_ULE: + return ::mlir::LLVM::FCmpPredicate::ule; + case ::llvm::CmpInst::Predicate::FCMP_UNE: + return ::mlir::LLVM::FCmpPredicate::une; + case ::llvm::CmpInst::Predicate::FCMP_UNO: + return ::mlir::LLVM::FCmpPredicate::uno; + case ::llvm::CmpInst::Predicate::FCMP_TRUE: + return ::mlir::LLVM::FCmpPredicate::_true; + case ::llvm::CmpInst::Predicate::ICMP_EQ: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_EQ"); + case ::llvm::CmpInst::Predicate::ICMP_NE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_NE"); + case ::llvm::CmpInst::Predicate::ICMP_SLT: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_SLT"); + case ::llvm::CmpInst::Predicate::ICMP_SLE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_SLE"); + case ::llvm::CmpInst::Predicate::ICMP_SGT: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_SGT"); + case ::llvm::CmpInst::Predicate::ICMP_SGE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_SGE"); + case ::llvm::CmpInst::Predicate::ICMP_ULT: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_ULT"); + case ::llvm::CmpInst::Predicate::ICMP_ULE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_ULE"); + case ::llvm::CmpInst::Predicate::ICMP_UGT: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_UGT"); + case ::llvm::CmpInst::Predicate::ICMP_UGE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::ICMP_UGE"); + case ::llvm::CmpInst::Predicate::BAD_FCMP_PREDICATE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::BAD_FCMP_PREDICATE"); + case ::llvm::CmpInst::Predicate::BAD_ICMP_PREDICATE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::BAD_ICMP_PREDICATE"); + } + llvm_unreachable("unknown ::llvm::CmpInst::Predicate type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::ICmpPredicate convertICmpPredicateFromLLVM(::llvm::CmpInst::Predicate value) { + switch (value) { + case ::llvm::CmpInst::Predicate::ICMP_EQ: + return ::mlir::LLVM::ICmpPredicate::eq; + case ::llvm::CmpInst::Predicate::ICMP_NE: + return ::mlir::LLVM::ICmpPredicate::ne; + case ::llvm::CmpInst::Predicate::ICMP_SLT: + return ::mlir::LLVM::ICmpPredicate::slt; + case ::llvm::CmpInst::Predicate::ICMP_SLE: + return ::mlir::LLVM::ICmpPredicate::sle; + case ::llvm::CmpInst::Predicate::ICMP_SGT: + return ::mlir::LLVM::ICmpPredicate::sgt; + case ::llvm::CmpInst::Predicate::ICMP_SGE: + return ::mlir::LLVM::ICmpPredicate::sge; + case ::llvm::CmpInst::Predicate::ICMP_ULT: + return ::mlir::LLVM::ICmpPredicate::ult; + case ::llvm::CmpInst::Predicate::ICMP_ULE: + return ::mlir::LLVM::ICmpPredicate::ule; + case ::llvm::CmpInst::Predicate::ICMP_UGT: + return ::mlir::LLVM::ICmpPredicate::ugt; + case ::llvm::CmpInst::Predicate::ICMP_UGE: + return ::mlir::LLVM::ICmpPredicate::uge; + case ::llvm::CmpInst::Predicate::FCMP_FALSE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_FALSE"); + case ::llvm::CmpInst::Predicate::FCMP_OEQ: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_OEQ"); + case ::llvm::CmpInst::Predicate::FCMP_OGT: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_OGT"); + case ::llvm::CmpInst::Predicate::FCMP_OGE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_OGE"); + case ::llvm::CmpInst::Predicate::FCMP_OLT: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_OLT"); + case ::llvm::CmpInst::Predicate::FCMP_OLE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_OLE"); + case ::llvm::CmpInst::Predicate::FCMP_ONE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_ONE"); + case ::llvm::CmpInst::Predicate::FCMP_ORD: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_ORD"); + case ::llvm::CmpInst::Predicate::FCMP_UEQ: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_UEQ"); + case ::llvm::CmpInst::Predicate::FCMP_UGT: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_UGT"); + case ::llvm::CmpInst::Predicate::FCMP_UGE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_UGE"); + case ::llvm::CmpInst::Predicate::FCMP_ULT: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_ULT"); + case ::llvm::CmpInst::Predicate::FCMP_ULE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_ULE"); + case ::llvm::CmpInst::Predicate::FCMP_UNE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_UNE"); + case ::llvm::CmpInst::Predicate::FCMP_UNO: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_UNO"); + case ::llvm::CmpInst::Predicate::FCMP_TRUE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::FCMP_TRUE"); + case ::llvm::CmpInst::Predicate::BAD_FCMP_PREDICATE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::BAD_FCMP_PREDICATE"); + case ::llvm::CmpInst::Predicate::BAD_ICMP_PREDICATE: + llvm_unreachable("unsupported case ::llvm::CmpInst::Predicate::BAD_ICMP_PREDICATE"); + } + llvm_unreachable("unknown ::llvm::CmpInst::Predicate type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::linkage::Linkage convertLinkageFromLLVM(::llvm::GlobalValue::LinkageTypes value) { + switch (value) { + case ::llvm::GlobalValue::LinkageTypes::PrivateLinkage: + return ::mlir::LLVM::linkage::Linkage::Private; + case ::llvm::GlobalValue::LinkageTypes::InternalLinkage: + return ::mlir::LLVM::linkage::Linkage::Internal; + case ::llvm::GlobalValue::LinkageTypes::AvailableExternallyLinkage: + return ::mlir::LLVM::linkage::Linkage::AvailableExternally; + case ::llvm::GlobalValue::LinkageTypes::LinkOnceAnyLinkage: + return ::mlir::LLVM::linkage::Linkage::Linkonce; + case ::llvm::GlobalValue::LinkageTypes::WeakAnyLinkage: + return ::mlir::LLVM::linkage::Linkage::Weak; + case ::llvm::GlobalValue::LinkageTypes::CommonLinkage: + return ::mlir::LLVM::linkage::Linkage::Common; + case ::llvm::GlobalValue::LinkageTypes::AppendingLinkage: + return ::mlir::LLVM::linkage::Linkage::Appending; + case ::llvm::GlobalValue::LinkageTypes::ExternalWeakLinkage: + return ::mlir::LLVM::linkage::Linkage::ExternWeak; + case ::llvm::GlobalValue::LinkageTypes::LinkOnceODRLinkage: + return ::mlir::LLVM::linkage::Linkage::LinkonceODR; + case ::llvm::GlobalValue::LinkageTypes::WeakODRLinkage: + return ::mlir::LLVM::linkage::Linkage::WeakODR; + case ::llvm::GlobalValue::LinkageTypes::ExternalLinkage: + return ::mlir::LLVM::linkage::Linkage::External; + } + llvm_unreachable("unknown ::llvm::GlobalValue::LinkageTypes type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::ModRefInfo convertModRefInfoFromLLVM(::llvm::ModRefInfo value) { + switch (value) { + case ::llvm::ModRefInfo::NoModRef: + return ::mlir::LLVM::ModRefInfo::NoModRef; + case ::llvm::ModRefInfo::Ref: + return ::mlir::LLVM::ModRefInfo::Ref; + case ::llvm::ModRefInfo::Mod: + return ::mlir::LLVM::ModRefInfo::Mod; + case ::llvm::ModRefInfo::ModRef: + return ::mlir::LLVM::ModRefInfo::ModRef; + } + llvm_unreachable("unknown ::llvm::ModRefInfo type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::UnnamedAddr convertUnnamedAddrFromLLVM(::llvm::GlobalValue::UnnamedAddr value) { + switch (value) { + case ::llvm::GlobalValue::UnnamedAddr::None: + return ::mlir::LLVM::UnnamedAddr::None; + case ::llvm::GlobalValue::UnnamedAddr::Local: + return ::mlir::LLVM::UnnamedAddr::Local; + case ::llvm::GlobalValue::UnnamedAddr::Global: + return ::mlir::LLVM::UnnamedAddr::Global; + } + llvm_unreachable("unknown ::llvm::GlobalValue::UnnamedAddr type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::Visibility convertVisibilityFromLLVM(::llvm::GlobalValue::VisibilityTypes value) { + switch (value) { + case ::llvm::GlobalValue::VisibilityTypes::DefaultVisibility: + return ::mlir::LLVM::Visibility::Default; + case ::llvm::GlobalValue::VisibilityTypes::HiddenVisibility: + return ::mlir::LLVM::Visibility::Hidden; + case ::llvm::GlobalValue::VisibilityTypes::ProtectedVisibility: + return ::mlir::LLVM::Visibility::Protected; + } + llvm_unreachable("unknown ::llvm::GlobalValue::VisibilityTypes type");} + +inline LLVM_ATTRIBUTE_UNUSED ::mlir::LLVM::cconv::CConv convertCConvFromLLVM(int64_t value) { + switch (value) { + case static_cast(::llvm::CallingConv::C): + return ::mlir::LLVM::cconv::CConv::C; + case static_cast(::llvm::CallingConv::Fast): + return ::mlir::LLVM::cconv::CConv::Fast; + case static_cast(::llvm::CallingConv::Cold): + return ::mlir::LLVM::cconv::CConv::Cold; + case static_cast(::llvm::CallingConv::GHC): + return ::mlir::LLVM::cconv::CConv::GHC; + case static_cast(::llvm::CallingConv::HiPE): + return ::mlir::LLVM::cconv::CConv::HiPE; + case static_cast(::llvm::CallingConv::WebKit_JS): + return ::mlir::LLVM::cconv::CConv::WebKit_JS; + case static_cast(::llvm::CallingConv::AnyReg): + return ::mlir::LLVM::cconv::CConv::AnyReg; + case static_cast(::llvm::CallingConv::PreserveMost): + return ::mlir::LLVM::cconv::CConv::PreserveMost; + case static_cast(::llvm::CallingConv::PreserveAll): + return ::mlir::LLVM::cconv::CConv::PreserveAll; + case static_cast(::llvm::CallingConv::Swift): + return ::mlir::LLVM::cconv::CConv::Swift; + case static_cast(::llvm::CallingConv::CXX_FAST_TLS): + return ::mlir::LLVM::cconv::CConv::CXX_FAST_TLS; + case static_cast(::llvm::CallingConv::Tail): + return ::mlir::LLVM::cconv::CConv::Tail; + case static_cast(::llvm::CallingConv::CFGuard_Check): + return ::mlir::LLVM::cconv::CConv::CFGuard_Check; + case static_cast(::llvm::CallingConv::SwiftTail): + return ::mlir::LLVM::cconv::CConv::SwiftTail; + case static_cast(::llvm::CallingConv::X86_StdCall): + return ::mlir::LLVM::cconv::CConv::X86_StdCall; + case static_cast(::llvm::CallingConv::X86_FastCall): + return ::mlir::LLVM::cconv::CConv::X86_FastCall; + case static_cast(::llvm::CallingConv::ARM_APCS): + return ::mlir::LLVM::cconv::CConv::ARM_APCS; + case static_cast(::llvm::CallingConv::ARM_AAPCS): + return ::mlir::LLVM::cconv::CConv::ARM_AAPCS; + case static_cast(::llvm::CallingConv::ARM_AAPCS_VFP): + return ::mlir::LLVM::cconv::CConv::ARM_AAPCS_VFP; + case static_cast(::llvm::CallingConv::MSP430_INTR): + return ::mlir::LLVM::cconv::CConv::MSP430_INTR; + case static_cast(::llvm::CallingConv::X86_ThisCall): + return ::mlir::LLVM::cconv::CConv::X86_ThisCall; + case static_cast(::llvm::CallingConv::PTX_Kernel): + return ::mlir::LLVM::cconv::CConv::PTX_Kernel; + case static_cast(::llvm::CallingConv::PTX_Device): + return ::mlir::LLVM::cconv::CConv::PTX_Device; + case static_cast(::llvm::CallingConv::SPIR_FUNC): + return ::mlir::LLVM::cconv::CConv::SPIR_FUNC; + case static_cast(::llvm::CallingConv::SPIR_KERNEL): + return ::mlir::LLVM::cconv::CConv::SPIR_KERNEL; + case static_cast(::llvm::CallingConv::Intel_OCL_BI): + return ::mlir::LLVM::cconv::CConv::Intel_OCL_BI; + case static_cast(::llvm::CallingConv::X86_64_SysV): + return ::mlir::LLVM::cconv::CConv::X86_64_SysV; + case static_cast(::llvm::CallingConv::Win64): + return ::mlir::LLVM::cconv::CConv::Win64; + case static_cast(::llvm::CallingConv::X86_VectorCall): + return ::mlir::LLVM::cconv::CConv::X86_VectorCall; + case static_cast(::llvm::CallingConv::DUMMY_HHVM): + return ::mlir::LLVM::cconv::CConv::DUMMY_HHVM; + case static_cast(::llvm::CallingConv::DUMMY_HHVM_C): + return ::mlir::LLVM::cconv::CConv::DUMMY_HHVM_C; + case static_cast(::llvm::CallingConv::X86_INTR): + return ::mlir::LLVM::cconv::CConv::X86_INTR; + case static_cast(::llvm::CallingConv::AVR_INTR): + return ::mlir::LLVM::cconv::CConv::AVR_INTR; + case static_cast(::llvm::CallingConv::AVR_BUILTIN): + return ::mlir::LLVM::cconv::CConv::AVR_BUILTIN; + case static_cast(::llvm::CallingConv::AMDGPU_VS): + return ::mlir::LLVM::cconv::CConv::AMDGPU_VS; + case static_cast(::llvm::CallingConv::AMDGPU_GS): + return ::mlir::LLVM::cconv::CConv::AMDGPU_GS; + case static_cast(::llvm::CallingConv::AMDGPU_CS): + return ::mlir::LLVM::cconv::CConv::AMDGPU_CS; + case static_cast(::llvm::CallingConv::AMDGPU_KERNEL): + return ::mlir::LLVM::cconv::CConv::AMDGPU_KERNEL; + case static_cast(::llvm::CallingConv::X86_RegCall): + return ::mlir::LLVM::cconv::CConv::X86_RegCall; + case static_cast(::llvm::CallingConv::AMDGPU_HS): + return ::mlir::LLVM::cconv::CConv::AMDGPU_HS; + case static_cast(::llvm::CallingConv::MSP430_BUILTIN): + return ::mlir::LLVM::cconv::CConv::MSP430_BUILTIN; + case static_cast(::llvm::CallingConv::AMDGPU_LS): + return ::mlir::LLVM::cconv::CConv::AMDGPU_LS; + case static_cast(::llvm::CallingConv::AMDGPU_ES): + return ::mlir::LLVM::cconv::CConv::AMDGPU_ES; + case static_cast(::llvm::CallingConv::AArch64_VectorCall): + return ::mlir::LLVM::cconv::CConv::AArch64_VectorCall; + case static_cast(::llvm::CallingConv::AArch64_SVE_VectorCall): + return ::mlir::LLVM::cconv::CConv::AArch64_SVE_VectorCall; + case static_cast(::llvm::CallingConv::WASM_EmscriptenInvoke): + return ::mlir::LLVM::cconv::CConv::WASM_EmscriptenInvoke; + case static_cast(::llvm::CallingConv::AMDGPU_Gfx): + return ::mlir::LLVM::cconv::CConv::AMDGPU_Gfx; + case static_cast(::llvm::CallingConv::M68k_INTR): + return ::mlir::LLVM::cconv::CConv::M68k_INTR; + } + llvm_unreachable("unknown ::llvm::CallingConv type");} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConversionEnumsToLLVM.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConversionEnumsToLLVM.inc new file mode 100644 index 0000000000000000000000000000000000000000..a4264508674a89331c11270613ea09d74731aaad --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConversionEnumsToLLVM.inc @@ -0,0 +1,318 @@ +static LLVM_ATTRIBUTE_UNUSED ::llvm::InlineAsm::AsmDialect convertAsmDialectToLLVM(::mlir::LLVM::AsmDialect value) { + switch (value) { + case ::mlir::LLVM::AsmDialect::AD_ATT: + return ::llvm::InlineAsm::AsmDialect::AD_ATT; + case ::mlir::LLVM::AsmDialect::AD_Intel: + return ::llvm::InlineAsm::AsmDialect::AD_Intel; + } + llvm_unreachable("unknown AsmDialect type"); +} + +static LLVM_ATTRIBUTE_UNUSED ::llvm::AtomicRMWInst::BinOp convertAtomicBinOpToLLVM(::mlir::LLVM::AtomicBinOp value) { + switch (value) { + case ::mlir::LLVM::AtomicBinOp::xchg: + return ::llvm::AtomicRMWInst::BinOp::Xchg; + case ::mlir::LLVM::AtomicBinOp::add: + return ::llvm::AtomicRMWInst::BinOp::Add; + case ::mlir::LLVM::AtomicBinOp::sub: + return ::llvm::AtomicRMWInst::BinOp::Sub; + case ::mlir::LLVM::AtomicBinOp::_and: + return ::llvm::AtomicRMWInst::BinOp::And; + case ::mlir::LLVM::AtomicBinOp::nand: + return ::llvm::AtomicRMWInst::BinOp::Nand; + case ::mlir::LLVM::AtomicBinOp::_or: + return ::llvm::AtomicRMWInst::BinOp::Or; + case ::mlir::LLVM::AtomicBinOp::_xor: + return ::llvm::AtomicRMWInst::BinOp::Xor; + case ::mlir::LLVM::AtomicBinOp::max: + return ::llvm::AtomicRMWInst::BinOp::Max; + case ::mlir::LLVM::AtomicBinOp::min: + return ::llvm::AtomicRMWInst::BinOp::Min; + case ::mlir::LLVM::AtomicBinOp::umax: + return ::llvm::AtomicRMWInst::BinOp::UMax; + case ::mlir::LLVM::AtomicBinOp::umin: + return ::llvm::AtomicRMWInst::BinOp::UMin; + case ::mlir::LLVM::AtomicBinOp::fadd: + return ::llvm::AtomicRMWInst::BinOp::FAdd; + case ::mlir::LLVM::AtomicBinOp::fsub: + return ::llvm::AtomicRMWInst::BinOp::FSub; + case ::mlir::LLVM::AtomicBinOp::fmax: + return ::llvm::AtomicRMWInst::BinOp::FMax; + case ::mlir::LLVM::AtomicBinOp::fmin: + return ::llvm::AtomicRMWInst::BinOp::FMin; + case ::mlir::LLVM::AtomicBinOp::uinc_wrap: + return ::llvm::AtomicRMWInst::BinOp::UIncWrap; + case ::mlir::LLVM::AtomicBinOp::udec_wrap: + return ::llvm::AtomicRMWInst::BinOp::UDecWrap; + } + llvm_unreachable("unknown AtomicBinOp type"); +} + +static LLVM_ATTRIBUTE_UNUSED ::llvm::AtomicOrdering convertAtomicOrderingToLLVM(::mlir::LLVM::AtomicOrdering value) { + switch (value) { + case ::mlir::LLVM::AtomicOrdering::not_atomic: + return ::llvm::AtomicOrdering::NotAtomic; + case ::mlir::LLVM::AtomicOrdering::unordered: + return ::llvm::AtomicOrdering::Unordered; + case ::mlir::LLVM::AtomicOrdering::monotonic: + return ::llvm::AtomicOrdering::Monotonic; + case ::mlir::LLVM::AtomicOrdering::acquire: + return ::llvm::AtomicOrdering::Acquire; + case ::mlir::LLVM::AtomicOrdering::release: + return ::llvm::AtomicOrdering::Release; + case ::mlir::LLVM::AtomicOrdering::acq_rel: + return ::llvm::AtomicOrdering::AcquireRelease; + case ::mlir::LLVM::AtomicOrdering::seq_cst: + return ::llvm::AtomicOrdering::SequentiallyConsistent; + } + llvm_unreachable("unknown AtomicOrdering type"); +} + +static LLVM_ATTRIBUTE_UNUSED ::llvm::Comdat::SelectionKind convertComdatToLLVM(::mlir::LLVM::comdat::Comdat value) { + switch (value) { + case ::mlir::LLVM::comdat::Comdat::Any: + return ::llvm::Comdat::SelectionKind::Any; + case ::mlir::LLVM::comdat::Comdat::ExactMatch: + return ::llvm::Comdat::SelectionKind::ExactMatch; + case ::mlir::LLVM::comdat::Comdat::Largest: + return ::llvm::Comdat::SelectionKind::Largest; + case ::mlir::LLVM::comdat::Comdat::NoDeduplicate: + return ::llvm::Comdat::SelectionKind::NoDeduplicate; + case ::mlir::LLVM::comdat::Comdat::SameSize: + return ::llvm::Comdat::SelectionKind::SameSize; + } + llvm_unreachable("unknown Comdat type"); +} + +static LLVM_ATTRIBUTE_UNUSED ::llvm::CmpInst::Predicate convertFCmpPredicateToLLVM(::mlir::LLVM::FCmpPredicate value) { + switch (value) { + case ::mlir::LLVM::FCmpPredicate::_false: + return ::llvm::CmpInst::Predicate::FCMP_FALSE; + case ::mlir::LLVM::FCmpPredicate::oeq: + return ::llvm::CmpInst::Predicate::FCMP_OEQ; + case ::mlir::LLVM::FCmpPredicate::ogt: + return ::llvm::CmpInst::Predicate::FCMP_OGT; + case ::mlir::LLVM::FCmpPredicate::oge: + return ::llvm::CmpInst::Predicate::FCMP_OGE; + case ::mlir::LLVM::FCmpPredicate::olt: + return ::llvm::CmpInst::Predicate::FCMP_OLT; + case ::mlir::LLVM::FCmpPredicate::ole: + return ::llvm::CmpInst::Predicate::FCMP_OLE; + case ::mlir::LLVM::FCmpPredicate::one: + return ::llvm::CmpInst::Predicate::FCMP_ONE; + case ::mlir::LLVM::FCmpPredicate::ord: + return ::llvm::CmpInst::Predicate::FCMP_ORD; + case ::mlir::LLVM::FCmpPredicate::ueq: + return ::llvm::CmpInst::Predicate::FCMP_UEQ; + case ::mlir::LLVM::FCmpPredicate::ugt: + return ::llvm::CmpInst::Predicate::FCMP_UGT; + case ::mlir::LLVM::FCmpPredicate::uge: + return ::llvm::CmpInst::Predicate::FCMP_UGE; + case ::mlir::LLVM::FCmpPredicate::ult: + return ::llvm::CmpInst::Predicate::FCMP_ULT; + case ::mlir::LLVM::FCmpPredicate::ule: + return ::llvm::CmpInst::Predicate::FCMP_ULE; + case ::mlir::LLVM::FCmpPredicate::une: + return ::llvm::CmpInst::Predicate::FCMP_UNE; + case ::mlir::LLVM::FCmpPredicate::uno: + return ::llvm::CmpInst::Predicate::FCMP_UNO; + case ::mlir::LLVM::FCmpPredicate::_true: + return ::llvm::CmpInst::Predicate::FCMP_TRUE; + } + llvm_unreachable("unknown FCmpPredicate type"); +} + +static LLVM_ATTRIBUTE_UNUSED ::llvm::CmpInst::Predicate convertICmpPredicateToLLVM(::mlir::LLVM::ICmpPredicate value) { + switch (value) { + case ::mlir::LLVM::ICmpPredicate::eq: + return ::llvm::CmpInst::Predicate::ICMP_EQ; + case ::mlir::LLVM::ICmpPredicate::ne: + return ::llvm::CmpInst::Predicate::ICMP_NE; + case ::mlir::LLVM::ICmpPredicate::slt: + return ::llvm::CmpInst::Predicate::ICMP_SLT; + case ::mlir::LLVM::ICmpPredicate::sle: + return ::llvm::CmpInst::Predicate::ICMP_SLE; + case ::mlir::LLVM::ICmpPredicate::sgt: + return ::llvm::CmpInst::Predicate::ICMP_SGT; + case ::mlir::LLVM::ICmpPredicate::sge: + return ::llvm::CmpInst::Predicate::ICMP_SGE; + case ::mlir::LLVM::ICmpPredicate::ult: + return ::llvm::CmpInst::Predicate::ICMP_ULT; + case ::mlir::LLVM::ICmpPredicate::ule: + return ::llvm::CmpInst::Predicate::ICMP_ULE; + case ::mlir::LLVM::ICmpPredicate::ugt: + return ::llvm::CmpInst::Predicate::ICMP_UGT; + case ::mlir::LLVM::ICmpPredicate::uge: + return ::llvm::CmpInst::Predicate::ICMP_UGE; + } + llvm_unreachable("unknown ICmpPredicate type"); +} + +static LLVM_ATTRIBUTE_UNUSED ::llvm::GlobalValue::LinkageTypes convertLinkageToLLVM(::mlir::LLVM::linkage::Linkage value) { + switch (value) { + case ::mlir::LLVM::linkage::Linkage::Private: + return ::llvm::GlobalValue::LinkageTypes::PrivateLinkage; + case ::mlir::LLVM::linkage::Linkage::Internal: + return ::llvm::GlobalValue::LinkageTypes::InternalLinkage; + case ::mlir::LLVM::linkage::Linkage::AvailableExternally: + return ::llvm::GlobalValue::LinkageTypes::AvailableExternallyLinkage; + case ::mlir::LLVM::linkage::Linkage::Linkonce: + return ::llvm::GlobalValue::LinkageTypes::LinkOnceAnyLinkage; + case ::mlir::LLVM::linkage::Linkage::Weak: + return ::llvm::GlobalValue::LinkageTypes::WeakAnyLinkage; + case ::mlir::LLVM::linkage::Linkage::Common: + return ::llvm::GlobalValue::LinkageTypes::CommonLinkage; + case ::mlir::LLVM::linkage::Linkage::Appending: + return ::llvm::GlobalValue::LinkageTypes::AppendingLinkage; + case ::mlir::LLVM::linkage::Linkage::ExternWeak: + return ::llvm::GlobalValue::LinkageTypes::ExternalWeakLinkage; + case ::mlir::LLVM::linkage::Linkage::LinkonceODR: + return ::llvm::GlobalValue::LinkageTypes::LinkOnceODRLinkage; + case ::mlir::LLVM::linkage::Linkage::WeakODR: + return ::llvm::GlobalValue::LinkageTypes::WeakODRLinkage; + case ::mlir::LLVM::linkage::Linkage::External: + return ::llvm::GlobalValue::LinkageTypes::ExternalLinkage; + } + llvm_unreachable("unknown Linkage type"); +} + +static LLVM_ATTRIBUTE_UNUSED ::llvm::ModRefInfo convertModRefInfoToLLVM(::mlir::LLVM::ModRefInfo value) { + switch (value) { + case ::mlir::LLVM::ModRefInfo::NoModRef: + return ::llvm::ModRefInfo::NoModRef; + case ::mlir::LLVM::ModRefInfo::Ref: + return ::llvm::ModRefInfo::Ref; + case ::mlir::LLVM::ModRefInfo::Mod: + return ::llvm::ModRefInfo::Mod; + case ::mlir::LLVM::ModRefInfo::ModRef: + return ::llvm::ModRefInfo::ModRef; + } + llvm_unreachable("unknown ModRefInfo type"); +} + +static LLVM_ATTRIBUTE_UNUSED ::llvm::GlobalValue::UnnamedAddr convertUnnamedAddrToLLVM(::mlir::LLVM::UnnamedAddr value) { + switch (value) { + case ::mlir::LLVM::UnnamedAddr::None: + return ::llvm::GlobalValue::UnnamedAddr::None; + case ::mlir::LLVM::UnnamedAddr::Local: + return ::llvm::GlobalValue::UnnamedAddr::Local; + case ::mlir::LLVM::UnnamedAddr::Global: + return ::llvm::GlobalValue::UnnamedAddr::Global; + } + llvm_unreachable("unknown UnnamedAddr type"); +} + +static LLVM_ATTRIBUTE_UNUSED ::llvm::GlobalValue::VisibilityTypes convertVisibilityToLLVM(::mlir::LLVM::Visibility value) { + switch (value) { + case ::mlir::LLVM::Visibility::Default: + return ::llvm::GlobalValue::VisibilityTypes::DefaultVisibility; + case ::mlir::LLVM::Visibility::Hidden: + return ::llvm::GlobalValue::VisibilityTypes::HiddenVisibility; + case ::mlir::LLVM::Visibility::Protected: + return ::llvm::GlobalValue::VisibilityTypes::ProtectedVisibility; + } + llvm_unreachable("unknown Visibility type"); +} + +static LLVM_ATTRIBUTE_UNUSED int64_t convertCConvToLLVM(::mlir::LLVM::cconv::CConv value) { + switch (value) { + case ::mlir::LLVM::cconv::CConv::C: + return static_cast(::llvm::CallingConv::C); + case ::mlir::LLVM::cconv::CConv::Fast: + return static_cast(::llvm::CallingConv::Fast); + case ::mlir::LLVM::cconv::CConv::Cold: + return static_cast(::llvm::CallingConv::Cold); + case ::mlir::LLVM::cconv::CConv::GHC: + return static_cast(::llvm::CallingConv::GHC); + case ::mlir::LLVM::cconv::CConv::HiPE: + return static_cast(::llvm::CallingConv::HiPE); + case ::mlir::LLVM::cconv::CConv::WebKit_JS: + return static_cast(::llvm::CallingConv::WebKit_JS); + case ::mlir::LLVM::cconv::CConv::AnyReg: + return static_cast(::llvm::CallingConv::AnyReg); + case ::mlir::LLVM::cconv::CConv::PreserveMost: + return static_cast(::llvm::CallingConv::PreserveMost); + case ::mlir::LLVM::cconv::CConv::PreserveAll: + return static_cast(::llvm::CallingConv::PreserveAll); + case ::mlir::LLVM::cconv::CConv::Swift: + return static_cast(::llvm::CallingConv::Swift); + case ::mlir::LLVM::cconv::CConv::CXX_FAST_TLS: + return static_cast(::llvm::CallingConv::CXX_FAST_TLS); + case ::mlir::LLVM::cconv::CConv::Tail: + return static_cast(::llvm::CallingConv::Tail); + case ::mlir::LLVM::cconv::CConv::CFGuard_Check: + return static_cast(::llvm::CallingConv::CFGuard_Check); + case ::mlir::LLVM::cconv::CConv::SwiftTail: + return static_cast(::llvm::CallingConv::SwiftTail); + case ::mlir::LLVM::cconv::CConv::X86_StdCall: + return static_cast(::llvm::CallingConv::X86_StdCall); + case ::mlir::LLVM::cconv::CConv::X86_FastCall: + return static_cast(::llvm::CallingConv::X86_FastCall); + case ::mlir::LLVM::cconv::CConv::ARM_APCS: + return static_cast(::llvm::CallingConv::ARM_APCS); + case ::mlir::LLVM::cconv::CConv::ARM_AAPCS: + return static_cast(::llvm::CallingConv::ARM_AAPCS); + case ::mlir::LLVM::cconv::CConv::ARM_AAPCS_VFP: + return static_cast(::llvm::CallingConv::ARM_AAPCS_VFP); + case ::mlir::LLVM::cconv::CConv::MSP430_INTR: + return static_cast(::llvm::CallingConv::MSP430_INTR); + case ::mlir::LLVM::cconv::CConv::X86_ThisCall: + return static_cast(::llvm::CallingConv::X86_ThisCall); + case ::mlir::LLVM::cconv::CConv::PTX_Kernel: + return static_cast(::llvm::CallingConv::PTX_Kernel); + case ::mlir::LLVM::cconv::CConv::PTX_Device: + return static_cast(::llvm::CallingConv::PTX_Device); + case ::mlir::LLVM::cconv::CConv::SPIR_FUNC: + return static_cast(::llvm::CallingConv::SPIR_FUNC); + case ::mlir::LLVM::cconv::CConv::SPIR_KERNEL: + return static_cast(::llvm::CallingConv::SPIR_KERNEL); + case ::mlir::LLVM::cconv::CConv::Intel_OCL_BI: + return static_cast(::llvm::CallingConv::Intel_OCL_BI); + case ::mlir::LLVM::cconv::CConv::X86_64_SysV: + return static_cast(::llvm::CallingConv::X86_64_SysV); + case ::mlir::LLVM::cconv::CConv::Win64: + return static_cast(::llvm::CallingConv::Win64); + case ::mlir::LLVM::cconv::CConv::X86_VectorCall: + return static_cast(::llvm::CallingConv::X86_VectorCall); + case ::mlir::LLVM::cconv::CConv::DUMMY_HHVM: + return static_cast(::llvm::CallingConv::DUMMY_HHVM); + case ::mlir::LLVM::cconv::CConv::DUMMY_HHVM_C: + return static_cast(::llvm::CallingConv::DUMMY_HHVM_C); + case ::mlir::LLVM::cconv::CConv::X86_INTR: + return static_cast(::llvm::CallingConv::X86_INTR); + case ::mlir::LLVM::cconv::CConv::AVR_INTR: + return static_cast(::llvm::CallingConv::AVR_INTR); + case ::mlir::LLVM::cconv::CConv::AVR_BUILTIN: + return static_cast(::llvm::CallingConv::AVR_BUILTIN); + case ::mlir::LLVM::cconv::CConv::AMDGPU_VS: + return static_cast(::llvm::CallingConv::AMDGPU_VS); + case ::mlir::LLVM::cconv::CConv::AMDGPU_GS: + return static_cast(::llvm::CallingConv::AMDGPU_GS); + case ::mlir::LLVM::cconv::CConv::AMDGPU_CS: + return static_cast(::llvm::CallingConv::AMDGPU_CS); + case ::mlir::LLVM::cconv::CConv::AMDGPU_KERNEL: + return static_cast(::llvm::CallingConv::AMDGPU_KERNEL); + case ::mlir::LLVM::cconv::CConv::X86_RegCall: + return static_cast(::llvm::CallingConv::X86_RegCall); + case ::mlir::LLVM::cconv::CConv::AMDGPU_HS: + return static_cast(::llvm::CallingConv::AMDGPU_HS); + case ::mlir::LLVM::cconv::CConv::MSP430_BUILTIN: + return static_cast(::llvm::CallingConv::MSP430_BUILTIN); + case ::mlir::LLVM::cconv::CConv::AMDGPU_LS: + return static_cast(::llvm::CallingConv::AMDGPU_LS); + case ::mlir::LLVM::cconv::CConv::AMDGPU_ES: + return static_cast(::llvm::CallingConv::AMDGPU_ES); + case ::mlir::LLVM::cconv::CConv::AArch64_VectorCall: + return static_cast(::llvm::CallingConv::AArch64_VectorCall); + case ::mlir::LLVM::cconv::CConv::AArch64_SVE_VectorCall: + return static_cast(::llvm::CallingConv::AArch64_SVE_VectorCall); + case ::mlir::LLVM::cconv::CConv::WASM_EmscriptenInvoke: + return static_cast(::llvm::CallingConv::WASM_EmscriptenInvoke); + case ::mlir::LLVM::cconv::CConv::AMDGPU_Gfx: + return static_cast(::llvm::CallingConv::AMDGPU_Gfx); + case ::mlir::LLVM::cconv::CConv::M68k_INTR: + return static_cast(::llvm::CallingConv::M68k_INTR); + } + llvm_unreachable("unknown CConv type"); +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..223a9e973882d423cb754db90ae1f66634c712e7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConversions.inc @@ -0,0 +1,393 @@ +if (auto op = dyn_cast<::mlir::LLVM::AShrOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateAShr(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::AddOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateAdd(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::AddrSpaceCastOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateAddrSpaceCast(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::AllocaOp>(opInst)) { + + auto addrSpace = moduleTranslation.convertType(op.getResult().getType())->getPointerAddressSpace(); + llvm::Type *elementType = moduleTranslation.convertType( + op.getElemType() ? *op.getElemType() + : ::llvm::cast(op.getType()).getElementType()); + auto *inst = builder.CreateAlloca(elementType, addrSpace, moduleTranslation.lookupValue(op.getArraySize())); + + if (op.getAlignment().has_value()) { + auto align = *op.getAlignment(); + if (align != 0) + inst->setAlignment(llvm::Align(align)); + } + + inst->setUsedWithInAlloca(op.getInalloca()); + moduleTranslation.mapValue(op.getRes()) = inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::AndOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateAnd(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::AtomicCmpXchgOp>(opInst)) { + + auto *inst = builder.CreateAtomicCmpXchg(moduleTranslation.lookupValue(op.getPtr()), moduleTranslation.lookupValue(op.getCmp()), moduleTranslation.lookupValue(op.getVal()), + llvm::MaybeAlign(), convertAtomicOrderingToLLVM(op.getSuccessOrdering()), + convertAtomicOrderingToLLVM(op.getFailureOrdering())); + moduleTranslation.mapValue(op.getRes()) = inst; + inst->setWeak(op.getWeak()); + + inst->setVolatile(op.getVolatile_()); + + if (op.getSyncscope().has_value()) { + llvm::LLVMContext &llvmContext = builder.getContext(); + inst->setSyncScopeID(llvmContext.getOrInsertSyncScopeID(*op.getSyncscope())); + } + + if (op.getAlignment().has_value()) { + auto align = *op.getAlignment(); + if (align != 0) + inst->setAlignment(llvm::Align(align)); + } + + moduleTranslation.setAccessGroupsMetadata(op, inst); + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::AtomicRMWOp>(opInst)) { + + auto *inst = builder.CreateAtomicRMW( + convertAtomicBinOpToLLVM(op.getBinOp()), moduleTranslation.lookupValue(op.getPtr()), moduleTranslation.lookupValue(op.getVal()), llvm::MaybeAlign(), + convertAtomicOrderingToLLVM(op.getOrdering())); + moduleTranslation.mapValue(op.getRes()) = inst; + + inst->setVolatile(op.getVolatile_()); + + if (op.getSyncscope().has_value()) { + llvm::LLVMContext &llvmContext = builder.getContext(); + inst->setSyncScopeID(llvmContext.getOrInsertSyncScopeID(*op.getSyncscope())); + } + + if (op.getAlignment().has_value()) { + auto align = *op.getAlignment(); + if (align != 0) + inst->setAlignment(llvm::Align(align)); + } + + moduleTranslation.setAccessGroupsMetadata(op, inst); + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::BitcastOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateBitCast(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CallIntrinsicOp>(opInst)) { + + return convertCallLLVMIntrinsicOp(op, builder, moduleTranslation); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ConstantOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = getLLVMConstant(moduleTranslation.convertType(op.getResult().getType()), op.getValue(), opInst.getLoc(), + moduleTranslation); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ExtractElementOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = builder.CreateExtractElement(moduleTranslation.lookupValue(op.getVector()), moduleTranslation.lookupValue(op.getPosition())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ExtractValueOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = builder.CreateExtractValue(moduleTranslation.lookupValue(op.getContainer()), extractPosition(op.getPosition())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FAddOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFAdd(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FCmpOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = builder.CreateFCmp(convertFCmpPredicateToLLVM(op.getPredicate()), moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FDivOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFDiv(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FMulOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFMul(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FNegOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFNeg(moduleTranslation.lookupValue(op.getOperand())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FPExtOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFPExt(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FPToSIOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFPToSI(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FPToUIOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFPToUI(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FPTruncOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFPTrunc(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FRemOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFRem(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FSubOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFSub(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FenceOp>(opInst)) { + + auto *inst = builder.CreateFence(convertAtomicOrderingToLLVM(op.getOrdering())); + + if (op.getSyncscope().has_value()) { + llvm::LLVMContext &llvmContext = builder.getContext(); + inst->setSyncScopeID(llvmContext.getOrInsertSyncScopeID(*op.getSyncscope())); + } + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FreezeOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateFreeze(moduleTranslation.lookupValue(op.getVal())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::GEPOp>(opInst)) { + + SmallVector indices; + indices.reserve(op.getRawConstantIndices().size()); + GEPIndicesAdaptor + gepIndices(op.getRawConstantIndicesAttr(), moduleTranslation.lookupValues(op.getDynamicIndices())); + for (PointerUnion valueOrAttr : gepIndices) { + if (llvm::Value* value = ::llvm::dyn_cast(valueOrAttr)) + indices.push_back(value); + else + indices.push_back( + builder.getInt32(valueOrAttr.get().getInt())); + } + Type baseElementType = op.getSourceElementType(); + llvm::Type *elementType = moduleTranslation.convertType(baseElementType); + moduleTranslation.mapValue(op.getRes()) = builder.CreateGEP(elementType, moduleTranslation.lookupValue(op.getBase()), indices, "", op.getInbounds()); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ICmpOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = builder.CreateICmp( + convertICmpPredicateToLLVM(op.getPredicate()), moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::InsertElementOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = builder.CreateInsertElement(moduleTranslation.lookupValue(op.getVector()), moduleTranslation.lookupValue(op.getValue()), moduleTranslation.lookupValue(op.getPosition())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::InsertValueOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = builder.CreateInsertValue(moduleTranslation.lookupValue(op.getContainer()), moduleTranslation.lookupValue(op.getValue()), + extractPosition(op.getPosition())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::IntToPtrOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateIntToPtr(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::LShrOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateLShr(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::LoadOp>(opInst)) { + + auto *inst = builder.CreateLoad(moduleTranslation.convertType(op.getResult().getType()), moduleTranslation.lookupValue(op.getAddr()), op.getVolatile_()); + moduleTranslation.mapValue(op.getRes()) = inst; + + inst->setAtomic(convertAtomicOrderingToLLVM(op.getOrdering())); + + if (op.getSyncscope().has_value()) { + llvm::LLVMContext &llvmContext = builder.getContext(); + inst->setSyncScopeID(llvmContext.getOrInsertSyncScopeID(*op.getSyncscope())); + } + + if (op.getAlignment().has_value()) { + auto align = *op.getAlignment(); + if (align != 0) + inst->setAlignment(llvm::Align(align)); + } + + if (op.getNontemporal()) { + llvm::MDNode *metadata = llvm::MDNode::get( + inst->getContext(), llvm::ConstantAsMetadata::get( + builder.getInt32(1))); + inst->setMetadata(llvm::LLVMContext::MD_nontemporal, metadata); + } + + moduleTranslation.setAccessGroupsMetadata(op, inst); + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MulOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateMul(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::NoneTokenOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = llvm::ConstantTokenNone::get(builder.getContext()); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::OrOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateOr(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::PoisonOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = llvm::PoisonValue::get(moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::PtrToIntOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreatePtrToInt(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ResumeOp>(opInst)) { + builder.CreateResume(moduleTranslation.lookupValue(op.getValue())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ReturnOp>(opInst)) { + + if (opInst.getNumOperands() != 0) + builder.CreateRet(moduleTranslation.lookupValue(op.getArg())); + else + builder.CreateRetVoid(); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SDivOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateSDiv(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SExtOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateSExt(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SIToFPOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateSIToFP(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SRemOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateSRem(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SelectOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateSelect(moduleTranslation.lookupValue(op.getCondition()), moduleTranslation.lookupValue(op.getTrueValue()), moduleTranslation.lookupValue(op.getFalseValue())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ShlOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateShl(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ShuffleVectorOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = builder.CreateShuffleVector(moduleTranslation.lookupValue(op.getV1()), moduleTranslation.lookupValue(op.getV2()), op.getMask()); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::StoreOp>(opInst)) { + + auto *inst = builder.CreateStore(moduleTranslation.lookupValue(op.getValue()), moduleTranslation.lookupValue(op.getAddr()), op.getVolatile_()); + + inst->setAtomic(convertAtomicOrderingToLLVM(op.getOrdering())); + + if (op.getSyncscope().has_value()) { + llvm::LLVMContext &llvmContext = builder.getContext(); + inst->setSyncScopeID(llvmContext.getOrInsertSyncScopeID(*op.getSyncscope())); + } + + if (op.getAlignment().has_value()) { + auto align = *op.getAlignment(); + if (align != 0) + inst->setAlignment(llvm::Align(align)); + } + + if (op.getNontemporal()) { + llvm::MDNode *metadata = llvm::MDNode::get( + inst->getContext(), llvm::ConstantAsMetadata::get( + builder.getInt32(1))); + inst->setMetadata(llvm::LLVMContext::MD_nontemporal, metadata); + } + + moduleTranslation.setAccessGroupsMetadata(op, inst); + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SubOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateSub(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::TruncOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateTrunc(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UDivOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateUDiv(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UIToFPOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateUIToFP(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::URemOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateURem(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UndefOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = llvm::UndefValue::get(moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UnreachableOp>(opInst)) { + builder.CreateUnreachable(); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::XOrOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateXor(moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ZExtOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = builder.CreateZExt(moduleTranslation.lookupValue(op.getArg()), moduleTranslation.convertType(op.getResult().getType())); + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ZeroOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = llvm::Constant::getNullValue(moduleTranslation.convertType(op.getResult().getType())); + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConvertibleLLVMIRIntrinsics.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConvertibleLLVMIRIntrinsics.inc new file mode 100644 index 0000000000000000000000000000000000000000..566a478768282079eaf762a648a2f1873712d9d8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMConvertibleLLVMIRIntrinsics.inc @@ -0,0 +1,171 @@ +llvm::Intrinsic::abs, +llvm::Intrinsic::annotation, +llvm::Intrinsic::assume, +llvm::Intrinsic::bitreverse, +llvm::Intrinsic::bswap, +llvm::Intrinsic::copysign, +llvm::Intrinsic::coro_align, +llvm::Intrinsic::coro_begin, +llvm::Intrinsic::coro_end, +llvm::Intrinsic::coro_free, +llvm::Intrinsic::coro_id, +llvm::Intrinsic::coro_resume, +llvm::Intrinsic::coro_save, +llvm::Intrinsic::coro_size, +llvm::Intrinsic::coro_suspend, +llvm::Intrinsic::cos, +llvm::Intrinsic::ctlz, +llvm::Intrinsic::cttz, +llvm::Intrinsic::ctpop, +llvm::Intrinsic::dbg_declare, +llvm::Intrinsic::dbg_label, +llvm::Intrinsic::dbg_value, +llvm::Intrinsic::debugtrap, +llvm::Intrinsic::eh_typeid_for, +llvm::Intrinsic::exp2, +llvm::Intrinsic::exp, +llvm::Intrinsic::expect, +llvm::Intrinsic::expect_with_probability, +llvm::Intrinsic::fabs, +llvm::Intrinsic::ceil, +llvm::Intrinsic::floor, +llvm::Intrinsic::fma, +llvm::Intrinsic::fmuladd, +llvm::Intrinsic::trunc, +llvm::Intrinsic::fshl, +llvm::Intrinsic::fshr, +llvm::Intrinsic::get_active_lane_mask, +llvm::Intrinsic::is_constant, +llvm::Intrinsic::is_fpclass, +llvm::Intrinsic::lifetime_end, +llvm::Intrinsic::lifetime_start, +llvm::Intrinsic::llrint, +llvm::Intrinsic::llround, +llvm::Intrinsic::log2, +llvm::Intrinsic::log10, +llvm::Intrinsic::log, +llvm::Intrinsic::lrint, +llvm::Intrinsic::lround, +llvm::Intrinsic::masked_load, +llvm::Intrinsic::masked_store, +llvm::Intrinsic::matrix_column_major_load, +llvm::Intrinsic::matrix_column_major_store, +llvm::Intrinsic::matrix_multiply, +llvm::Intrinsic::matrix_transpose, +llvm::Intrinsic::maxnum, +llvm::Intrinsic::maximum, +llvm::Intrinsic::memcpy_inline, +llvm::Intrinsic::memcpy, +llvm::Intrinsic::memmove, +llvm::Intrinsic::memset, +llvm::Intrinsic::minnum, +llvm::Intrinsic::minimum, +llvm::Intrinsic::nearbyint, +llvm::Intrinsic::experimental_noalias_scope_decl, +llvm::Intrinsic::powi, +llvm::Intrinsic::pow, +llvm::Intrinsic::prefetch, +llvm::Intrinsic::ptr_annotation, +llvm::Intrinsic::rint, +llvm::Intrinsic::roundeven, +llvm::Intrinsic::round, +llvm::Intrinsic::sadd_sat, +llvm::Intrinsic::sadd_with_overflow, +llvm::Intrinsic::smax, +llvm::Intrinsic::smin, +llvm::Intrinsic::smul_with_overflow, +llvm::Intrinsic::ssa_copy, +llvm::Intrinsic::sshl_sat, +llvm::Intrinsic::ssub_sat, +llvm::Intrinsic::ssub_with_overflow, +llvm::Intrinsic::sin, +llvm::Intrinsic::sqrt, +llvm::Intrinsic::stackrestore, +llvm::Intrinsic::stacksave, +llvm::Intrinsic::experimental_stepvector, +llvm::Intrinsic::threadlocal_address, +llvm::Intrinsic::trap, +llvm::Intrinsic::uadd_sat, +llvm::Intrinsic::uadd_with_overflow, +llvm::Intrinsic::ubsantrap, +llvm::Intrinsic::umax, +llvm::Intrinsic::umin, +llvm::Intrinsic::umul_with_overflow, +llvm::Intrinsic::ushl_sat, +llvm::Intrinsic::usub_sat, +llvm::Intrinsic::usub_with_overflow, +llvm::Intrinsic::vp_ashr, +llvm::Intrinsic::vp_add, +llvm::Intrinsic::vp_and, +llvm::Intrinsic::vp_fadd, +llvm::Intrinsic::vp_fdiv, +llvm::Intrinsic::vp_fmuladd, +llvm::Intrinsic::vp_fmul, +llvm::Intrinsic::vp_fneg, +llvm::Intrinsic::vp_fpext, +llvm::Intrinsic::vp_fptosi, +llvm::Intrinsic::vp_fptoui, +llvm::Intrinsic::vp_fptrunc, +llvm::Intrinsic::vp_frem, +llvm::Intrinsic::vp_fsub, +llvm::Intrinsic::vp_fma, +llvm::Intrinsic::vp_inttoptr, +llvm::Intrinsic::vp_lshr, +llvm::Intrinsic::vp_load, +llvm::Intrinsic::vp_merge, +llvm::Intrinsic::vp_mul, +llvm::Intrinsic::vp_or, +llvm::Intrinsic::vp_ptrtoint, +llvm::Intrinsic::vp_reduce_add, +llvm::Intrinsic::vp_reduce_and, +llvm::Intrinsic::vp_reduce_fadd, +llvm::Intrinsic::vp_reduce_fmax, +llvm::Intrinsic::vp_reduce_fmin, +llvm::Intrinsic::vp_reduce_fmul, +llvm::Intrinsic::vp_reduce_mul, +llvm::Intrinsic::vp_reduce_or, +llvm::Intrinsic::vp_reduce_smax, +llvm::Intrinsic::vp_reduce_smin, +llvm::Intrinsic::vp_reduce_umax, +llvm::Intrinsic::vp_reduce_umin, +llvm::Intrinsic::vp_reduce_xor, +llvm::Intrinsic::vp_sdiv, +llvm::Intrinsic::vp_sext, +llvm::Intrinsic::vp_sitofp, +llvm::Intrinsic::vp_srem, +llvm::Intrinsic::vp_select, +llvm::Intrinsic::vp_shl, +llvm::Intrinsic::vp_store, +llvm::Intrinsic::experimental_vp_strided_load, +llvm::Intrinsic::experimental_vp_strided_store, +llvm::Intrinsic::vp_sub, +llvm::Intrinsic::vp_trunc, +llvm::Intrinsic::vp_udiv, +llvm::Intrinsic::vp_uitofp, +llvm::Intrinsic::vp_urem, +llvm::Intrinsic::vp_xor, +llvm::Intrinsic::vp_zext, +llvm::Intrinsic::vacopy, +llvm::Intrinsic::vaend, +llvm::Intrinsic::vastart, +llvm::Intrinsic::var_annotation, +llvm::Intrinsic::masked_compressstore, +llvm::Intrinsic::masked_expandload, +llvm::Intrinsic::masked_gather, +llvm::Intrinsic::masked_scatter, +llvm::Intrinsic::vector_reduce_add, +llvm::Intrinsic::vector_reduce_and, +llvm::Intrinsic::vector_reduce_fadd, +llvm::Intrinsic::vector_reduce_fmax, +llvm::Intrinsic::vector_reduce_fmaximum, +llvm::Intrinsic::vector_reduce_fmin, +llvm::Intrinsic::vector_reduce_fminimum, +llvm::Intrinsic::vector_reduce_fmul, +llvm::Intrinsic::vector_reduce_mul, +llvm::Intrinsic::vector_reduce_or, +llvm::Intrinsic::vector_reduce_smax, +llvm::Intrinsic::vector_reduce_smin, +llvm::Intrinsic::vector_reduce_umax, +llvm::Intrinsic::vector_reduce_umin, +llvm::Intrinsic::vector_reduce_xor, +llvm::Intrinsic::vscale, diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..447e3c9a59e5c0a43891033524aa08be36808e64 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h @@ -0,0 +1,253 @@ +//===- LLVMDialect.h - MLIR LLVM IR dialect ---------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the LLVM IR dialect in MLIR, containing LLVM operations and +// LLVM type system. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_ +#define MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/LLVMIR/LLVMAttrs.h" +#include "mlir/Dialect/LLVMIR/LLVMInterfaces.h" +#include "mlir/Dialect/LLVMIR/LLVMTypes.h" +#include "mlir/IR/BuiltinOps.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/IR/TypeSupport.h" +#include "mlir/IR/Types.h" +#include "mlir/Interfaces/CallInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/FunctionInterfaces.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" +#include "mlir/Support/ThreadLocalCache.h" +#include "mlir/Transforms/Mem2Reg.h" +#include "llvm/ADT/PointerEmbeddedInt.h" +#include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/LLVMContext.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/Type.h" + +namespace llvm { +class Type; +class LLVMContext; +namespace sys { +template +class SmartMutex; +} // namespace sys +} // namespace llvm + +namespace mlir { +namespace LLVM { +class LLVMDialect; + +namespace detail { +struct LLVMTypeStorage; +struct LLVMDialectImpl; +} // namespace detail +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +template +class GEPIndicesAdaptor; + +/// Bit-width of a 'GEPConstantIndex' within GEPArg. +constexpr int kGEPConstantBitWidth = 29; +/// Wrapper around a int32_t for use in a PointerUnion. +using GEPConstantIndex = + llvm::PointerEmbeddedInt; + +/// Class used for building a 'llvm.getelementptr'. A single instance represents +/// a sum type that is either a 'Value' or a constant 'GEPConstantIndex' index. +/// The former represents a dynamic index in a GEP operation, while the later is +/// a constant index as is required for indices into struct types. +class GEPArg : public PointerUnion { + using BaseT = PointerUnion; + +public: + /// Constructs a GEPArg with a constant index. + /*implicit*/ GEPArg(int32_t integer) : BaseT(integer) {} + + /// Constructs a GEPArg with a dynamic index. + /*implicit*/ GEPArg(Value value) : BaseT(value) {} + + using BaseT::operator=; +}; +} // namespace LLVM +} // namespace mlir + +///// Ops ///// +#define GET_OP_CLASSES +#include "mlir/Dialect/LLVMIR/LLVMOps.h.inc" +#define GET_OP_CLASSES +#include "mlir/Dialect/LLVMIR/LLVMIntrinsicOps.h.inc" + +#include "mlir/Dialect/LLVMIR/LLVMOpsDialect.h.inc" + +namespace mlir { +namespace LLVM { + +/// Class used for convenient access and iteration over GEP indices. +/// This class is templated to support not only retrieving the dynamic operands +/// of a GEP operation, but also as an adaptor during folding or conversion to +/// LLVM IR. +/// +/// GEP indices may either be constant indices or dynamic indices. The +/// 'rawConstantIndices' is specially encoded by GEPOp and contains either the +/// constant index or the information that an index is a dynamic index. +/// +/// When an access to such an index is made it is done through the +/// 'DynamicRange' of this class. This way it can be used as getter in GEPOp via +/// 'GEPIndicesAdaptor' or during folding via +/// 'GEPIndicesAdaptor>'. +template +class GEPIndicesAdaptor { +public: + /// Return type of 'operator[]' and the iterators 'operator*'. It is depended + /// upon the value type of 'DynamicRange'. If 'DynamicRange' contains + /// Attributes or subclasses thereof, then value_type is 'Attribute'. In + /// all other cases it is a pointer union between the value type of + /// 'DynamicRange' and IntegerAttr. + using value_type = std::conditional_t< + std::is_base_of>::value, + Attribute, + PointerUnion>>; + + /// Constructs a GEPIndicesAdaptor with the raw constant indices of a GEPOp + /// and the range that is indexed into for retrieving dynamic indices. + GEPIndicesAdaptor(DenseI32ArrayAttr rawConstantIndices, DynamicRange values) + : rawConstantIndices(rawConstantIndices), values(std::move(values)) {} + + /// Returns the GEP index at the given position. Note that this operation has + /// a linear complexity in regards to the accessed position. To iterate over + /// all indices, use the iterators. + /// + /// This operation is invalid if the index is out of bounds. + value_type operator[](size_t index) const { + assert(index < size() && "index out of bounds"); + return *std::next(begin(), index); + } + + /// Returns whether the GEP index at the given position is a dynamic index. + bool isDynamicIndex(size_t index) const { + return rawConstantIndices[index] == GEPOp::kDynamicIndex; + } + + /// Returns the amount of indices of the GEPOp. + size_t size() const { return rawConstantIndices.size(); } + + /// Returns true if this GEPOp does not have any indices. + bool empty() const { return rawConstantIndices.empty(); } + + class iterator + : public llvm::iterator_facade_base { + public: + iterator(const GEPIndicesAdaptor *base, + ArrayRef::iterator rawConstantIter, + llvm::detail::IterOfRange valuesIter) + : base(base), rawConstantIter(rawConstantIter), valuesIter(valuesIter) { + } + + value_type operator*() const { + if (*rawConstantIter == GEPOp::kDynamicIndex) + return *valuesIter; + + return IntegerAttr::get(base->rawConstantIndices.getElementType(), + *rawConstantIter); + } + + iterator &operator++() { + if (*rawConstantIter == GEPOp::kDynamicIndex) + valuesIter++; + rawConstantIter++; + return *this; + } + + bool operator==(const iterator &rhs) const { + return base == rhs.base && rawConstantIter == rhs.rawConstantIter && + valuesIter == rhs.valuesIter; + } + + private: + const GEPIndicesAdaptor *base; + ArrayRef::const_iterator rawConstantIter; + llvm::detail::IterOfRange valuesIter; + }; + + /// Returns the begin iterator, iterating over all GEP indices. + iterator begin() const { + return iterator(this, rawConstantIndices.asArrayRef().begin(), + values.begin()); + } + + /// Returns the end iterator, iterating over all GEP indices. + iterator end() const { + return iterator(this, rawConstantIndices.asArrayRef().end(), values.end()); + } + +private: + DenseI32ArrayAttr rawConstantIndices; + DynamicRange values; +}; + +/// Create an LLVM global containing the string "value" at the module containing +/// surrounding the insertion point of builder. Obtain the address of that +/// global and use it to compute the address of the first character in the +/// string (operations inserted at the builder insertion point). +Value createGlobalString(Location loc, OpBuilder &builder, StringRef name, + StringRef value, Linkage linkage, + bool useOpaquePointers); + +/// LLVM requires some operations to be inside of a Module operation. This +/// function confirms that the Operation has the desired properties. +bool satisfiesLLVMModule(Operation *op); + +/// Convert an array of integer attributes to a vector of integers that can be +/// used as indices in LLVM operations. +template +SmallVector convertArrayToIndices(ArrayRef attrs) { + SmallVector indices; + indices.reserve(attrs.size()); + for (Attribute attr : attrs) + indices.push_back(cast(attr).getInt()); + return indices; +} + +/// Convert an `ArrayAttr` of integer attributes to a vector of integers that +/// can be used as indices in LLVM operations. +template +SmallVector convertArrayToIndices(ArrayAttr attrs) { + return convertArrayToIndices(attrs.getValue()); +} + +} // namespace LLVM +} // namespace mlir + +namespace llvm { + +// Allow llvm::cast style functions. +template +struct CastInfo + : public CastInfo {}; + +template +struct CastInfo + : public CastInfo {}; + +} // namespace llvm + +#endif // MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..d68a2cb34b59244f4a945adbc4d2c7e1368652c7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.cpp.inc @@ -0,0 +1,68 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Returns the access groups attribute or nullptr +ArrayAttr mlir::LLVM::AccessGroupOpInterface::getAccessGroupsOrNull() { + return getImpl()->getAccessGroupsOrNull(getImpl(), getOperation()); + } +/// Sets the access groups attribute +void mlir::LLVM::AccessGroupOpInterface::setAccessGroups(const ArrayAttr attr) { + return getImpl()->setAccessGroups(getImpl(), getOperation(), attr); + } +/// Returns the alias scopes attribute or nullptr +ArrayAttr mlir::LLVM::AliasAnalysisOpInterface::getAliasScopesOrNull() { + return getImpl()->getAliasScopesOrNull(getImpl(), getOperation()); + } +/// Sets the alias scopes attribute +void mlir::LLVM::AliasAnalysisOpInterface::setAliasScopes(const ArrayAttr attr) { + return getImpl()->setAliasScopes(getImpl(), getOperation(), attr); + } +/// Returns the noalias scopes attribute or nullptr +ArrayAttr mlir::LLVM::AliasAnalysisOpInterface::getNoAliasScopesOrNull() { + return getImpl()->getNoAliasScopesOrNull(getImpl(), getOperation()); + } +/// Sets the noalias scopes attribute +void mlir::LLVM::AliasAnalysisOpInterface::setNoAliasScopes(const ArrayAttr attr) { + return getImpl()->setNoAliasScopes(getImpl(), getOperation(), attr); + } +/// Returns the tbaa attribute or nullptr +ArrayAttr mlir::LLVM::AliasAnalysisOpInterface::getTBAATagsOrNull() { + return getImpl()->getTBAATagsOrNull(getImpl(), getOperation()); + } +/// Sets the tbaa attribute +void mlir::LLVM::AliasAnalysisOpInterface::setTBAATags(const ArrayAttr attr) { + return getImpl()->setTBAATags(getImpl(), getOperation(), attr); + } +/// Returns a list of all pointer operands accessed by the operation +::llvm::SmallVector<::mlir::Value> mlir::LLVM::AliasAnalysisOpInterface::getAccessedOperands() { + return getImpl()->getAccessedOperands(getImpl(), getOperation()); + } +/// Returns the branch weights attribute or nullptr +DenseI32ArrayAttr mlir::LLVM::BranchWeightOpInterface::getBranchWeightsOrNull() { + return getImpl()->getBranchWeightsOrNull(getImpl(), getOperation()); + } +/// Sets the branch weights attribute +void mlir::LLVM::BranchWeightOpInterface::setBranchWeights(DenseI32ArrayAttr attr) { + return getImpl()->setBranchWeights(getImpl(), getOperation(), attr); + } +/// Returns a FastmathFlagsAttr attribute for the operation +FastmathFlagsAttr mlir::LLVM::FastmathFlagsInterface::getFastmathAttr() { + return getImpl()->getFastmathAttr(getImpl(), getOperation()); + } +/// Returns the name of the FastmathFlagsAttr attribute +/// for the operation +StringRef mlir::LLVM::FastmathFlagsInterface::getFastmathAttrName() { + return getImpl()->getFastmathAttrName(); + } +/// Returns the the element type hint of the result +/// LLVMPointer, if known. Returns nullptr if the +/// requested result is not an LLVMPointer or if the +/// element type is unknown. +Type mlir::LLVM::GetResultPtrElementType::getResultPtrElementType() { + return getImpl()->getResultPtrElementType(getImpl(), getOperation()); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.h new file mode 100644 index 0000000000000000000000000000000000000000..961e0be9d267d05e480bbba38bd499f88666a7e9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.h @@ -0,0 +1,36 @@ +//===- LLVMInterfaces.h - LLVM Interfaces -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines op interfaces for the LLVM dialect in MLIR. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_LLVMINTERFACES_H_ +#define MLIR_DIALECT_LLVMIR_LLVMINTERFACES_H_ + +#include "mlir/Dialect/LLVMIR/LLVMAttrs.h" + +namespace mlir { +namespace LLVM { +namespace detail { + +/// Verifies the access groups attribute of memory operations that implement the +/// access group interface. +LogicalResult verifyAccessGroupOpInterface(Operation *op); + +/// Verifies the alias analysis attributes of memory operations that implement +/// the alias analysis interface. +LogicalResult verifyAliasAnalysisOpInterface(Operation *op); + +} // namespace detail +} // namespace LLVM +} // namespace mlir + +#include "mlir/Dialect/LLVMIR/LLVMInterfaces.h.inc" + +#endif // MLIR_DIALECT_LLVMIR_LLVMINTERFACES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..31e8adb4032b010e26dfe014cfa93d40924d9c89 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.h.inc @@ -0,0 +1,571 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace LLVM { +class FastmathFlagsInterface; +namespace detail { +struct FastmathFlagsInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + FastmathFlagsAttr (*getFastmathAttr)(const Concept *impl, ::mlir::Operation *); + StringRef (*getFastmathAttrName)(); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::LLVM::FastmathFlagsInterface; + Model() : Concept{getFastmathAttr, getFastmathAttrName} {} + + static inline FastmathFlagsAttr getFastmathAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline StringRef getFastmathAttrName(); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::LLVM::FastmathFlagsInterface; + FallbackModel() : Concept{getFastmathAttr, getFastmathAttrName} {} + + static inline FastmathFlagsAttr getFastmathAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline StringRef getFastmathAttrName(); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + FastmathFlagsAttr getFastmathAttr(::mlir::Operation *tablegen_opaque_val) const; + static StringRef getFastmathAttrName(); + }; +};template +struct FastmathFlagsInterfaceTrait; + +} // namespace detail +class FastmathFlagsInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::FastmathFlagsInterfaceTrait {}; + /// Returns a FastmathFlagsAttr attribute for the operation + FastmathFlagsAttr getFastmathAttr(); + /// Returns the name of the FastmathFlagsAttr attribute + /// for the operation + StringRef getFastmathAttrName(); +}; +namespace detail { + template + struct FastmathFlagsInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns a FastmathFlagsAttr attribute for the operation + FastmathFlagsAttr getFastmathAttr() { + auto op = cast(this->getOperation()); + return op.getFastmathFlagsAttr(); + } + /// Returns the name of the FastmathFlagsAttr attribute + /// for the operation + static StringRef getFastmathAttrName() { + return "fastmathFlags"; + } + }; +}// namespace detail +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class BranchWeightOpInterface; +namespace detail { +struct BranchWeightOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + DenseI32ArrayAttr (*getBranchWeightsOrNull)(const Concept *impl, ::mlir::Operation *); + void (*setBranchWeights)(const Concept *impl, ::mlir::Operation *, DenseI32ArrayAttr); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::LLVM::BranchWeightOpInterface; + Model() : Concept{getBranchWeightsOrNull, setBranchWeights} {} + + static inline DenseI32ArrayAttr getBranchWeightsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setBranchWeights(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DenseI32ArrayAttr attr); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::LLVM::BranchWeightOpInterface; + FallbackModel() : Concept{getBranchWeightsOrNull, setBranchWeights} {} + + static inline DenseI32ArrayAttr getBranchWeightsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setBranchWeights(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DenseI32ArrayAttr attr); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + DenseI32ArrayAttr getBranchWeightsOrNull(::mlir::Operation *tablegen_opaque_val) const; + void setBranchWeights(::mlir::Operation *tablegen_opaque_val, DenseI32ArrayAttr attr) const; + }; +};template +struct BranchWeightOpInterfaceTrait; + +} // namespace detail +class BranchWeightOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::BranchWeightOpInterfaceTrait {}; + /// Returns the branch weights attribute or nullptr + DenseI32ArrayAttr getBranchWeightsOrNull(); + /// Sets the branch weights attribute + void setBranchWeights(DenseI32ArrayAttr attr); +}; +namespace detail { + template + struct BranchWeightOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns the branch weights attribute or nullptr + DenseI32ArrayAttr getBranchWeightsOrNull() { + auto op = cast(this->getOperation()); + return op.getBranchWeightsAttr(); + } + /// Sets the branch weights attribute + void setBranchWeights(DenseI32ArrayAttr attr) { + auto op = cast(this->getOperation()); + op.setBranchWeightsAttr(attr); + } + }; +}// namespace detail +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AccessGroupOpInterface; +namespace detail { +struct AccessGroupOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ArrayAttr (*getAccessGroupsOrNull)(const Concept *impl, ::mlir::Operation *); + void (*setAccessGroups)(const Concept *impl, ::mlir::Operation *, const ArrayAttr); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::LLVM::AccessGroupOpInterface; + Model() : Concept{getAccessGroupsOrNull, setAccessGroups} {} + + static inline ArrayAttr getAccessGroupsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setAccessGroups(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::LLVM::AccessGroupOpInterface; + FallbackModel() : Concept{getAccessGroupsOrNull, setAccessGroups} {} + + static inline ArrayAttr getAccessGroupsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setAccessGroups(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ArrayAttr getAccessGroupsOrNull(::mlir::Operation *tablegen_opaque_val) const; + void setAccessGroups(::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) const; + }; +};template +struct AccessGroupOpInterfaceTrait; + +} // namespace detail +class AccessGroupOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AccessGroupOpInterfaceTrait {}; + /// Returns the access groups attribute or nullptr + ArrayAttr getAccessGroupsOrNull(); + /// Sets the access groups attribute + void setAccessGroups(const ArrayAttr attr); +}; +namespace detail { + template + struct AccessGroupOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns the access groups attribute or nullptr + ArrayAttr getAccessGroupsOrNull() { + auto op = cast(this->getOperation()); + return op.getAccessGroupsAttr(); + } + /// Sets the access groups attribute + void setAccessGroups(const ArrayAttr attr) { + auto op = cast(this->getOperation()); + op.setAccessGroupsAttr(attr); + } + static ::mlir::LogicalResult verifyTrait(::mlir::Operation *op) { + return detail::verifyAccessGroupOpInterface(op); + } + }; +}// namespace detail +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AliasAnalysisOpInterface; +namespace detail { +struct AliasAnalysisOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ArrayAttr (*getAliasScopesOrNull)(const Concept *impl, ::mlir::Operation *); + void (*setAliasScopes)(const Concept *impl, ::mlir::Operation *, const ArrayAttr); + ArrayAttr (*getNoAliasScopesOrNull)(const Concept *impl, ::mlir::Operation *); + void (*setNoAliasScopes)(const Concept *impl, ::mlir::Operation *, const ArrayAttr); + ArrayAttr (*getTBAATagsOrNull)(const Concept *impl, ::mlir::Operation *); + void (*setTBAATags)(const Concept *impl, ::mlir::Operation *, const ArrayAttr); + ::llvm::SmallVector<::mlir::Value> (*getAccessedOperands)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::LLVM::AliasAnalysisOpInterface; + Model() : Concept{getAliasScopesOrNull, setAliasScopes, getNoAliasScopesOrNull, setNoAliasScopes, getTBAATagsOrNull, setTBAATags, getAccessedOperands} {} + + static inline ArrayAttr getAliasScopesOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setAliasScopes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr); + static inline ArrayAttr getNoAliasScopesOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setNoAliasScopes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr); + static inline ArrayAttr getTBAATagsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setTBAATags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr); + static inline ::llvm::SmallVector<::mlir::Value> getAccessedOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::LLVM::AliasAnalysisOpInterface; + FallbackModel() : Concept{getAliasScopesOrNull, setAliasScopes, getNoAliasScopesOrNull, setNoAliasScopes, getTBAATagsOrNull, setTBAATags, getAccessedOperands} {} + + static inline ArrayAttr getAliasScopesOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setAliasScopes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr); + static inline ArrayAttr getNoAliasScopesOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setNoAliasScopes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr); + static inline ArrayAttr getTBAATagsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setTBAATags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr); + static inline ::llvm::SmallVector<::mlir::Value> getAccessedOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ArrayAttr getAliasScopesOrNull(::mlir::Operation *tablegen_opaque_val) const; + void setAliasScopes(::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) const; + ArrayAttr getNoAliasScopesOrNull(::mlir::Operation *tablegen_opaque_val) const; + void setNoAliasScopes(::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) const; + ArrayAttr getTBAATagsOrNull(::mlir::Operation *tablegen_opaque_val) const; + void setTBAATags(::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) const; + }; +};template +struct AliasAnalysisOpInterfaceTrait; + +} // namespace detail +class AliasAnalysisOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AliasAnalysisOpInterfaceTrait {}; + /// Returns the alias scopes attribute or nullptr + ArrayAttr getAliasScopesOrNull(); + /// Sets the alias scopes attribute + void setAliasScopes(const ArrayAttr attr); + /// Returns the noalias scopes attribute or nullptr + ArrayAttr getNoAliasScopesOrNull(); + /// Sets the noalias scopes attribute + void setNoAliasScopes(const ArrayAttr attr); + /// Returns the tbaa attribute or nullptr + ArrayAttr getTBAATagsOrNull(); + /// Sets the tbaa attribute + void setTBAATags(const ArrayAttr attr); + /// Returns a list of all pointer operands accessed by the operation + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); +}; +namespace detail { + template + struct AliasAnalysisOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns the alias scopes attribute or nullptr + ArrayAttr getAliasScopesOrNull() { + auto op = cast(this->getOperation()); + return op.getAliasScopesAttr(); + } + /// Sets the alias scopes attribute + void setAliasScopes(const ArrayAttr attr) { + auto op = cast(this->getOperation()); + op.setAliasScopesAttr(attr); + } + /// Returns the noalias scopes attribute or nullptr + ArrayAttr getNoAliasScopesOrNull() { + auto op = cast(this->getOperation()); + return op.getNoaliasScopesAttr(); + } + /// Sets the noalias scopes attribute + void setNoAliasScopes(const ArrayAttr attr) { + auto op = cast(this->getOperation()); + op.setNoaliasScopesAttr(attr); + } + /// Returns the tbaa attribute or nullptr + ArrayAttr getTBAATagsOrNull() { + auto op = cast(this->getOperation()); + return op.getTbaaAttr(); + } + /// Sets the tbaa attribute + void setTBAATags(const ArrayAttr attr) { + auto op = cast(this->getOperation()); + op.setTbaaAttr(attr); + } + static ::mlir::LogicalResult verifyTrait(::mlir::Operation *op) { + return detail::verifyAliasAnalysisOpInterface(op); + } + }; +}// namespace detail +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class GetResultPtrElementType; +namespace detail { +struct GetResultPtrElementTypeInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + Type (*getResultPtrElementType)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::LLVM::GetResultPtrElementType; + Model() : Concept{getResultPtrElementType} {} + + static inline Type getResultPtrElementType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::LLVM::GetResultPtrElementType; + FallbackModel() : Concept{getResultPtrElementType} {} + + static inline Type getResultPtrElementType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + }; +};template +struct GetResultPtrElementTypeTrait; + +} // namespace detail +class GetResultPtrElementType : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::GetResultPtrElementTypeTrait {}; + /// Returns the the element type hint of the result + /// LLVMPointer, if known. Returns nullptr if the + /// requested result is not an LLVMPointer or if the + /// element type is unknown. + Type getResultPtrElementType(); +}; +namespace detail { + template + struct GetResultPtrElementTypeTrait : public ::mlir::OpInterface::Trait { + }; +}// namespace detail +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +template +FastmathFlagsAttr detail::FastmathFlagsInterfaceInterfaceTraits::Model::getFastmathAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getFastmathAttr(); +} +template +StringRef detail::FastmathFlagsInterfaceInterfaceTraits::Model::getFastmathAttrName() { + return ConcreteOp::getFastmathAttrName(); +} +template +FastmathFlagsAttr detail::FastmathFlagsInterfaceInterfaceTraits::FallbackModel::getFastmathAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getFastmathAttr(tablegen_opaque_val); +} +template +StringRef detail::FastmathFlagsInterfaceInterfaceTraits::FallbackModel::getFastmathAttrName() { + return ConcreteOp::getFastmathAttrName(); +} +template +FastmathFlagsAttr detail::FastmathFlagsInterfaceInterfaceTraits::ExternalModel::getFastmathAttr(::mlir::Operation *tablegen_opaque_val) const { +auto op = cast(this->getOperation()); + return op.getFastmathFlagsAttr(); +} +template +StringRef detail::FastmathFlagsInterfaceInterfaceTraits::ExternalModel::getFastmathAttrName() { +return "fastmathFlags"; +} +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +template +DenseI32ArrayAttr detail::BranchWeightOpInterfaceInterfaceTraits::Model::getBranchWeightsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getBranchWeightsOrNull(); +} +template +void detail::BranchWeightOpInterfaceInterfaceTraits::Model::setBranchWeights(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DenseI32ArrayAttr attr) { + return (llvm::cast(tablegen_opaque_val)).setBranchWeights(attr); +} +template +DenseI32ArrayAttr detail::BranchWeightOpInterfaceInterfaceTraits::FallbackModel::getBranchWeightsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getBranchWeightsOrNull(tablegen_opaque_val); +} +template +void detail::BranchWeightOpInterfaceInterfaceTraits::FallbackModel::setBranchWeights(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, DenseI32ArrayAttr attr) { + return static_cast(impl)->setBranchWeights(tablegen_opaque_val, attr); +} +template +DenseI32ArrayAttr detail::BranchWeightOpInterfaceInterfaceTraits::ExternalModel::getBranchWeightsOrNull(::mlir::Operation *tablegen_opaque_val) const { +auto op = cast(this->getOperation()); + return op.getBranchWeightsAttr(); +} +template +void detail::BranchWeightOpInterfaceInterfaceTraits::ExternalModel::setBranchWeights(::mlir::Operation *tablegen_opaque_val, DenseI32ArrayAttr attr) const { +auto op = cast(this->getOperation()); + op.setBranchWeightsAttr(attr); +} +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +template +ArrayAttr detail::AccessGroupOpInterfaceInterfaceTraits::Model::getAccessGroupsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getAccessGroupsOrNull(); +} +template +void detail::AccessGroupOpInterfaceInterfaceTraits::Model::setAccessGroups(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) { + return (llvm::cast(tablegen_opaque_val)).setAccessGroups(attr); +} +template +ArrayAttr detail::AccessGroupOpInterfaceInterfaceTraits::FallbackModel::getAccessGroupsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getAccessGroupsOrNull(tablegen_opaque_val); +} +template +void detail::AccessGroupOpInterfaceInterfaceTraits::FallbackModel::setAccessGroups(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) { + return static_cast(impl)->setAccessGroups(tablegen_opaque_val, attr); +} +template +ArrayAttr detail::AccessGroupOpInterfaceInterfaceTraits::ExternalModel::getAccessGroupsOrNull(::mlir::Operation *tablegen_opaque_val) const { +auto op = cast(this->getOperation()); + return op.getAccessGroupsAttr(); +} +template +void detail::AccessGroupOpInterfaceInterfaceTraits::ExternalModel::setAccessGroups(::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) const { +auto op = cast(this->getOperation()); + op.setAccessGroupsAttr(attr); +} +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +template +ArrayAttr detail::AliasAnalysisOpInterfaceInterfaceTraits::Model::getAliasScopesOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getAliasScopesOrNull(); +} +template +void detail::AliasAnalysisOpInterfaceInterfaceTraits::Model::setAliasScopes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) { + return (llvm::cast(tablegen_opaque_val)).setAliasScopes(attr); +} +template +ArrayAttr detail::AliasAnalysisOpInterfaceInterfaceTraits::Model::getNoAliasScopesOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getNoAliasScopesOrNull(); +} +template +void detail::AliasAnalysisOpInterfaceInterfaceTraits::Model::setNoAliasScopes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) { + return (llvm::cast(tablegen_opaque_val)).setNoAliasScopes(attr); +} +template +ArrayAttr detail::AliasAnalysisOpInterfaceInterfaceTraits::Model::getTBAATagsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getTBAATagsOrNull(); +} +template +void detail::AliasAnalysisOpInterfaceInterfaceTraits::Model::setTBAATags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) { + return (llvm::cast(tablegen_opaque_val)).setTBAATags(attr); +} +template +::llvm::SmallVector<::mlir::Value> detail::AliasAnalysisOpInterfaceInterfaceTraits::Model::getAccessedOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getAccessedOperands(); +} +template +ArrayAttr detail::AliasAnalysisOpInterfaceInterfaceTraits::FallbackModel::getAliasScopesOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getAliasScopesOrNull(tablegen_opaque_val); +} +template +void detail::AliasAnalysisOpInterfaceInterfaceTraits::FallbackModel::setAliasScopes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) { + return static_cast(impl)->setAliasScopes(tablegen_opaque_val, attr); +} +template +ArrayAttr detail::AliasAnalysisOpInterfaceInterfaceTraits::FallbackModel::getNoAliasScopesOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getNoAliasScopesOrNull(tablegen_opaque_val); +} +template +void detail::AliasAnalysisOpInterfaceInterfaceTraits::FallbackModel::setNoAliasScopes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) { + return static_cast(impl)->setNoAliasScopes(tablegen_opaque_val, attr); +} +template +ArrayAttr detail::AliasAnalysisOpInterfaceInterfaceTraits::FallbackModel::getTBAATagsOrNull(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getTBAATagsOrNull(tablegen_opaque_val); +} +template +void detail::AliasAnalysisOpInterfaceInterfaceTraits::FallbackModel::setTBAATags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) { + return static_cast(impl)->setTBAATags(tablegen_opaque_val, attr); +} +template +::llvm::SmallVector<::mlir::Value> detail::AliasAnalysisOpInterfaceInterfaceTraits::FallbackModel::getAccessedOperands(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getAccessedOperands(tablegen_opaque_val); +} +template +ArrayAttr detail::AliasAnalysisOpInterfaceInterfaceTraits::ExternalModel::getAliasScopesOrNull(::mlir::Operation *tablegen_opaque_val) const { +auto op = cast(this->getOperation()); + return op.getAliasScopesAttr(); +} +template +void detail::AliasAnalysisOpInterfaceInterfaceTraits::ExternalModel::setAliasScopes(::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) const { +auto op = cast(this->getOperation()); + op.setAliasScopesAttr(attr); +} +template +ArrayAttr detail::AliasAnalysisOpInterfaceInterfaceTraits::ExternalModel::getNoAliasScopesOrNull(::mlir::Operation *tablegen_opaque_val) const { +auto op = cast(this->getOperation()); + return op.getNoaliasScopesAttr(); +} +template +void detail::AliasAnalysisOpInterfaceInterfaceTraits::ExternalModel::setNoAliasScopes(::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) const { +auto op = cast(this->getOperation()); + op.setNoaliasScopesAttr(attr); +} +template +ArrayAttr detail::AliasAnalysisOpInterfaceInterfaceTraits::ExternalModel::getTBAATagsOrNull(::mlir::Operation *tablegen_opaque_val) const { +auto op = cast(this->getOperation()); + return op.getTbaaAttr(); +} +template +void detail::AliasAnalysisOpInterfaceInterfaceTraits::ExternalModel::setTBAATags(::mlir::Operation *tablegen_opaque_val, const ArrayAttr attr) const { +auto op = cast(this->getOperation()); + op.setTbaaAttr(attr); +} +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +template +Type detail::GetResultPtrElementTypeInterfaceTraits::Model::getResultPtrElementType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getResultPtrElementType(); +} +template +Type detail::GetResultPtrElementTypeInterfaceTraits::FallbackModel::getResultPtrElementType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getResultPtrElementType(tablegen_opaque_val); +} +} // namespace LLVM +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..db56ec3166036fa29cb188a94adbe423f3b80f02 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicConversions.inc @@ -0,0 +1,2191 @@ +if (auto op = dyn_cast<::mlir::LLVM::AbsOp>(opInst)) { + + auto *inst = createIntrinsicCall( + builder, llvm::Intrinsic::abs, + {moduleTranslation.lookupValue(op.getIn()), builder.getInt1(op.getIsIntMinPoison())}, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + moduleTranslation.mapValue(op.getRes()) = inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::Annotation>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::annotation, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(2).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::AssumeOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::assume, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::BitReverseOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::bitreverse, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ByteSwapOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::bswap, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CopySignOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::copysign, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CoroAlignOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::coro_align, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CoroBeginOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::coro_begin, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CoroEndOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::coro_end, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CoroFreeOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::coro_free, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CoroIdOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::coro_id, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CoroResumeOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::coro_resume, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CoroSaveOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::coro_save, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CoroSizeOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::coro_size, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CoroSuspendOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::coro_suspend, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CosOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::cos, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CountLeadingZerosOp>(opInst)) { + + auto *inst = createIntrinsicCall( + builder, llvm::Intrinsic::ctlz, + {moduleTranslation.lookupValue(op.getIn()), builder.getInt1(op.getIsZeroPoison())}, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + moduleTranslation.mapValue(op.getRes()) = inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CountTrailingZerosOp>(opInst)) { + + auto *inst = createIntrinsicCall( + builder, llvm::Intrinsic::cttz, + {moduleTranslation.lookupValue(op.getIn()), builder.getInt1(op.getIsZeroPoison())}, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + moduleTranslation.mapValue(op.getRes()) = inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::CtPopOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::ctpop, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::DbgDeclareOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::LLVMContext &ctx = module->getContext(); + llvm::Function *fn = + llvm::Intrinsic::getDeclaration(module, llvm::Intrinsic::dbg_declare); + builder.CreateCall(fn, { + llvm::MetadataAsValue::get(ctx, + llvm::ValueAsMetadata::get(moduleTranslation.lookupValue(opInst.getOperand(0)))), + llvm::MetadataAsValue::get(ctx, moduleTranslation.translateDebugInfo(op.getVarInfo())), + llvm::MetadataAsValue::get(ctx, llvm::DIExpression::get(ctx, std::nullopt)), + }); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::DbgLabelOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::LLVMContext &ctx = module->getContext(); + llvm::Function *fn = + llvm::Intrinsic::getDeclaration(module, llvm::Intrinsic::dbg_label); + builder.CreateCall(fn, { + llvm::MetadataAsValue::get(ctx, moduleTranslation.translateDebugInfo(op.getLabel())) + }); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::DbgValueOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::LLVMContext &ctx = module->getContext(); + llvm::Function *fn = + llvm::Intrinsic::getDeclaration(module, llvm::Intrinsic::dbg_value); + builder.CreateCall(fn, { + llvm::MetadataAsValue::get(ctx, + llvm::ValueAsMetadata::get(moduleTranslation.lookupValue(opInst.getOperand(0)))), + llvm::MetadataAsValue::get(ctx, moduleTranslation.translateDebugInfo(op.getVarInfo())), + llvm::MetadataAsValue::get(ctx, llvm::DIExpression::get(ctx, std::nullopt)), + }); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::DebugTrap>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::debugtrap, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::EhTypeidForOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::eh_typeid_for, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::Exp2Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::exp2, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ExpOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::exp, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ExpectOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::expect, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ExpectWithProbabilityOp>(opInst)) { + + createIntrinsicCall( + builder, llvm::Intrinsic::expect_with_probability, + {moduleTranslation.lookupValue(op.getVal()), moduleTranslation.lookupValue(op.getExpected()), llvm::ConstantFP::get(builder.getDoubleTy(), op.getProb())}, + {moduleTranslation.convertType(op.getResult().getType())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FAbsOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::fabs, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FCeilOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::ceil, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FFloorOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::floor, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FMAOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::fma, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FMulAddOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::fmuladd, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FTruncOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::trunc, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FshlOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::fshl, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::FshrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::fshr, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::GetActiveLaneMaskOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::get_active_lane_mask, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::IsConstantOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::is_constant, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::IsFPClass>(opInst)) { + + auto *inst = createIntrinsicCall( + builder, llvm::Intrinsic::is_fpclass, + {moduleTranslation.lookupValue(op.getIn()), builder.getInt32(op.getBit())}, + { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + moduleTranslation.mapValue(op.getRes()) = inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::LifetimeEndOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, llvm::Intrinsic::lifetime_end, {moduleTranslation.convertType(opInst.getOperand(0).getType())}); + builder.CreateCall(fn, {builder.getInt64(op.getSizeAttr().getInt()), + moduleTranslation.lookupValue(op.getPtr())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::LifetimeStartOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, llvm::Intrinsic::lifetime_start, {moduleTranslation.convertType(opInst.getOperand(0).getType())}); + builder.CreateCall(fn, {builder.getInt64(op.getSizeAttr().getInt()), + moduleTranslation.lookupValue(op.getPtr())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::LlrintOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::llrint, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::LlroundOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::llround, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::Log2Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::log2, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::Log10Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::log10, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::LogOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::log, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::LrintOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::lrint, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::LroundOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::lround, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MaskedLoadOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = moduleTranslation.lookupValues(op.getPassThru()).empty() ? builder.CreateMaskedLoad( + moduleTranslation.convertType(op.getResult().getType()), moduleTranslation.lookupValue(op.getData()), llvm::Align(op.getAlignment()), moduleTranslation.lookupValue(op.getMask())) : + builder.CreateMaskedLoad( + moduleTranslation.convertType(op.getResult().getType()), moduleTranslation.lookupValue(op.getData()), llvm::Align(op.getAlignment()), moduleTranslation.lookupValue(op.getMask()), moduleTranslation.lookupValues(op.getPassThru())[0]); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MaskedStoreOp>(opInst)) { + + builder.CreateMaskedStore( + moduleTranslation.lookupValue(op.getValue()), moduleTranslation.lookupValue(op.getData()), llvm::Align(op.getAlignment()), moduleTranslation.lookupValue(op.getMask())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MatrixColumnMajorLoadOp>(opInst)) { + + llvm::MatrixBuilder mb(builder); + const llvm::DataLayout &dl = + builder.GetInsertBlock()->getModule()->getDataLayout(); + llvm::Type *ElemTy = moduleTranslation.convertType( + getVectorElementType(op.getType())); + llvm::Align align = dl.getABITypeAlign(ElemTy); + moduleTranslation.mapValue(op.getRes()) = mb.CreateColumnMajorLoad( + ElemTy, moduleTranslation.lookupValue(op.getData()), align, moduleTranslation.lookupValue(op.getStride()), op.getIsVolatile(), op.getRows(), + op.getColumns()); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MatrixColumnMajorStoreOp>(opInst)) { + + llvm::MatrixBuilder mb(builder); + const llvm::DataLayout &dl = + builder.GetInsertBlock()->getModule()->getDataLayout(); + Type elementType = getVectorElementType(op.getMatrix().getType()); + llvm::Align align = dl.getABITypeAlign( + moduleTranslation.convertType(elementType)); + mb.CreateColumnMajorStore( + moduleTranslation.lookupValue(op.getMatrix()), moduleTranslation.lookupValue(op.getData()), align, moduleTranslation.lookupValue(op.getStride()), op.getIsVolatile(), + op.getRows(), op.getColumns()); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MatrixMultiplyOp>(opInst)) { + + llvm::MatrixBuilder mb(builder); + moduleTranslation.mapValue(op.getRes()) = mb.CreateMatrixMultiply( + moduleTranslation.lookupValue(op.getLhs()), moduleTranslation.lookupValue(op.getRhs()), op.getLhsRows(), op.getLhsColumns(), + op.getRhsColumns()); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MatrixTransposeOp>(opInst)) { + + llvm::MatrixBuilder mb(builder); + moduleTranslation.mapValue(op.getRes()) = mb.CreateMatrixTranspose( + moduleTranslation.lookupValue(op.getMatrix()), op.getRows(), op.getColumns()); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MaxNumOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::maxnum, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MaximumOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::maximum, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MemcpyInlineOp>(opInst)) { + + auto *inst = createIntrinsicCall( + builder, llvm::Intrinsic::memcpy_inline, + {moduleTranslation.lookupValue(op.getDst()), moduleTranslation.lookupValue(op.getSrc()), builder.getInt(op.getLen()), + builder.getInt1(op.getIsVolatile())}, { moduleTranslation.convertType(opInst.getOperand(0).getType()), moduleTranslation.convertType(opInst.getOperand(1).getType()), moduleTranslation.convertType(op.getLenAttr().getType()) }); + moduleTranslation.setAccessGroupsMetadata(op, inst); + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MemcpyOp>(opInst)) { + + auto *inst = createIntrinsicCall( + builder, llvm::Intrinsic::memcpy, + {moduleTranslation.lookupValue(op.getDst()), moduleTranslation.lookupValue(op.getSrc()), moduleTranslation.lookupValue(op.getLen()), + builder.getInt1(op.getIsVolatile())}, + { moduleTranslation.convertType(opInst.getOperand(0).getType()), moduleTranslation.convertType(opInst.getOperand(1).getType()), moduleTranslation.convertType(opInst.getOperand(2).getType()) } ); + moduleTranslation.setAccessGroupsMetadata(op, inst); + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MemmoveOp>(opInst)) { + + auto *inst = createIntrinsicCall( + builder, llvm::Intrinsic::memmove, + {moduleTranslation.lookupValue(op.getDst()), moduleTranslation.lookupValue(op.getSrc()), moduleTranslation.lookupValue(op.getLen()), + builder.getInt1(op.getIsVolatile())}, + { moduleTranslation.convertType(opInst.getOperand(0).getType()), moduleTranslation.convertType(opInst.getOperand(1).getType()), moduleTranslation.convertType(opInst.getOperand(2).getType()) } ); + moduleTranslation.setAccessGroupsMetadata(op, inst); + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MemsetOp>(opInst)) { + + auto *inst = createIntrinsicCall( + builder, llvm::Intrinsic::memset, + {moduleTranslation.lookupValue(op.getDst()), moduleTranslation.lookupValue(op.getVal()), moduleTranslation.lookupValue(op.getLen()), + builder.getInt1(op.getIsVolatile())}, + { moduleTranslation.convertType(opInst.getOperand(0).getType()), moduleTranslation.convertType(opInst.getOperand(2).getType()) } ); + moduleTranslation.setAccessGroupsMetadata(op, inst); + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MinNumOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::minnum, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::MinimumOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::minimum, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::NearbyintOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nearbyint, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::NoAliasScopeDeclOp>(opInst)) { + + // Wrap the scope argument into a list since the LLVM IR intrinsic takes + // a list containing exactly one scope rather than a scope itself. + llvm::MDNode* node = moduleTranslation.getOrCreateAliasScopes({op.getScope()}); + builder.CreateNoAliasScopeDeclaration(node); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::PowIOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::powi, { moduleTranslation.convertType(opInst.getOperand(0).getType()), moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::PowOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::pow, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::Prefetch>(opInst)) { + + createIntrinsicCall( + builder, llvm::Intrinsic::prefetch, + {moduleTranslation.lookupValue(op.getAddr()), builder.getInt32(op.getRw()), + builder.getInt32(op.getHint()), + builder.getInt32(op.getCache())}, + { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::PtrAnnotation>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::ptr_annotation, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(2).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::RintOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::rint, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::RoundEvenOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::roundeven, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::RoundOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::round, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SAddSat>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::sadd_sat, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SAddWithOverflowOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::sadd_with_overflow, { moduleTranslation.convertType( + ::llvm::cast(opInst.getResult(0).getType()) + .getBody()[0]) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SMaxOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::smax, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SMinOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::smin, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SMulWithOverflowOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::smul_with_overflow, { moduleTranslation.convertType( + ::llvm::cast(opInst.getResult(0).getType()) + .getBody()[0]) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SSACopyOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::ssa_copy, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SSHLSat>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::sshl_sat, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SSubSat>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::ssub_sat, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SSubWithOverflowOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::ssub_with_overflow, { moduleTranslation.convertType( + ::llvm::cast(opInst.getResult(0).getType()) + .getBody()[0]) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SinOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::sin, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::SqrtOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::sqrt, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::StackRestoreOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::stackrestore, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::StackSaveOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::stacksave, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::StepVectorOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::experimental_stepvector, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::ThreadlocalAddressOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::threadlocal_address, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::Trap>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::trap, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UAddSat>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::uadd_sat, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UAddWithOverflowOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::uadd_with_overflow, { moduleTranslation.convertType( + ::llvm::cast(opInst.getResult(0).getType()) + .getBody()[0]) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UBSanTrap>(opInst)) { + + createIntrinsicCall( + builder, llvm::Intrinsic::ubsantrap, {builder.getInt8(op.getFailureKind())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UMaxOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::umax, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UMinOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::umin, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::UMulWithOverflowOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::umul_with_overflow, { moduleTranslation.convertType( + ::llvm::cast(opInst.getResult(0).getType()) + .getBody()[0]) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::USHLSat>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::ushl_sat, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::USubSat>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::usub_sat, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::USubWithOverflowOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::usub_with_overflow, { moduleTranslation.convertType( + ::llvm::cast(opInst.getResult(0).getType()) + .getBody()[0]) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPAShrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_ashr, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPAddOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_add, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPAndOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_and, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFAddOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fadd, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFDivOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fdiv, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFMulAddOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fmuladd, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFMulOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fmul, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFNegOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fneg, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFPExtOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fpext, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFPToSIOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fptosi, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFPToUIOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fptoui, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFPTruncOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fptrunc, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFRemOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_frem, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFSubOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fsub, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPFmaOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_fma, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPIntToPtrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_inttoptr, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPLShrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_lshr, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPLoadOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_load, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPMergeMinOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_merge, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPMulOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_mul, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPOrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_or, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPPtrToIntOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_ptrtoint, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceAddOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_add, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceAndOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_and, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceFAddOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_fadd, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceFMaxOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_fmax, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceFMinOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_fmin, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceFMulOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_fmul, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceMulOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_mul, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceOrOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_or, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceSMaxOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_smax, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceSMinOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_smin, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceUMaxOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_umax, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceUMinOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_umin, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPReduceXorOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_reduce_xor, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPSDivOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_sdiv, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPSExtOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_sext, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPSIToFPOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_sitofp, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPSRemOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_srem, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPSelectMinOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_select, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPShlOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_shl, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPStoreOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_store, { moduleTranslation.convertType(opInst.getOperand(0).getType()), moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPStridedLoadOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::experimental_vp_strided_load, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()), moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPStridedStoreOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::experimental_vp_strided_store, { moduleTranslation.convertType(opInst.getOperand(0).getType()), moduleTranslation.convertType(opInst.getOperand(1).getType()), moduleTranslation.convertType(opInst.getOperand(2).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPSubOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_sub, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPTruncOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_trunc, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPUDivOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_udiv, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPUIToFPOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_uitofp, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPURemOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_urem, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPXorOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_xor, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VPZExtOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vp_zext, { moduleTranslation.convertType(opInst.getResult(0).getType()), moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VaCopyOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vacopy, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VaEndOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vaend, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VaStartOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vastart, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::VarAnnotation>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::var_annotation, { moduleTranslation.convertType(opInst.getOperand(0).getType()), moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::masked_compressstore>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::masked_compressstore, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::masked_expandload>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::masked_expandload, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::masked_gather>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = moduleTranslation.lookupValues(op.getPassThru()).empty() ? builder.CreateMaskedGather( + moduleTranslation.convertType(op.getResult().getType()), moduleTranslation.lookupValue(op.getPtrs()), llvm::Align(op.getAlignment()), moduleTranslation.lookupValue(op.getMask())) : + builder.CreateMaskedGather( + moduleTranslation.convertType(op.getResult().getType()), moduleTranslation.lookupValue(op.getPtrs()), llvm::Align(op.getAlignment()), moduleTranslation.lookupValue(op.getMask()), moduleTranslation.lookupValues(op.getPassThru())[0]); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::masked_scatter>(opInst)) { + + builder.CreateMaskedScatter( + moduleTranslation.lookupValue(op.getValue()), moduleTranslation.lookupValue(op.getPtrs()), llvm::Align(op.getAlignment()), moduleTranslation.lookupValue(op.getMask())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_extract>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = builder.CreateExtractVector( + moduleTranslation.convertType(op.getResult().getType()), moduleTranslation.lookupValue(op.getSrcvec()), builder.getInt64(op.getPos())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_insert>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = builder.CreateInsertVector( + moduleTranslation.convertType(op.getResult().getType()), moduleTranslation.lookupValue(op.getDstvec()), moduleTranslation.lookupValue(op.getSrcvec()), builder.getInt64(op.getPos())); + + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_add>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_add, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_and>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_and, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_fadd>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_fadd, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_fmax>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_fmax, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_fmaximum>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_fmaximum, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_fmin>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_fmin, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_fminimum>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_fminimum, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_fmul>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_fmul, { moduleTranslation.convertType(opInst.getOperand(1).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_mul>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_mul, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_or>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_or, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_smax>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_smax, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_smin>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_smin, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_umax>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_umax, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_umin>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_umin, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vector_reduce_xor>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vector_reduce_xor, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::LLVM::vscale>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::vscale, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicFromLLVMIRConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicFromLLVMIRConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..2a53fe80bdef4fc063b2c0713d3828513fea6994 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicFromLLVMIRConversions.inc @@ -0,0 +1,2384 @@ +if (intrinsicID == llvm::Intrinsic::abs) { +FailureOr _llvmir_gen_operand_in = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_in)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::AbsOp>(moduleImport.translateLoc(inst->getDebugLoc()), + moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_in, moduleImport.matchIntegerAttr(llvmOperands[1])); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (intrinsicID == llvm::Intrinsic::annotation) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::Annotation>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::assume) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::AssumeOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::bitreverse) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::BitReverseOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::bswap) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::ByteSwapOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::copysign) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CopySignOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::coro_align) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CoroAlignOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::coro_begin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CoroBeginOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::coro_end) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CoroEndOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::coro_free) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CoroFreeOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::coro_id) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CoroIdOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::coro_resume) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::CoroResumeOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::coro_save) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CoroSaveOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::coro_size) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CoroSizeOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::coro_suspend) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CoroSuspendOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::cos) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CosOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::ctlz) { +FailureOr _llvmir_gen_operand_in = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_in)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::CountLeadingZerosOp>(moduleImport.translateLoc(inst->getDebugLoc()), + moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_in, moduleImport.matchIntegerAttr(llvmOperands[1])); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (intrinsicID == llvm::Intrinsic::cttz) { +FailureOr _llvmir_gen_operand_in = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_in)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::CountTrailingZerosOp>(moduleImport.translateLoc(inst->getDebugLoc()), + moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_in, moduleImport.matchIntegerAttr(llvmOperands[1])); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (intrinsicID == llvm::Intrinsic::ctpop) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::CtPopOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::dbg_declare) { + + + // Add debug intrindic to the list of intrinsics that need to be converted once the + // full function was converted. + moduleImport.addDebugIntrinsic(inst); + return success(); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::dbg_label) { + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create<::mlir::LLVM::DbgLabelOp>(moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.matchLabelAttr(llvmOperands[0])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::dbg_value) { + + + // Add debug intrindic to the list of intrinsics that need to be converted once the + // full function was converted. + moduleImport.addDebugIntrinsic(inst); + return success(); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::debugtrap) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::DebugTrap>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::eh_typeid_for) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::EhTypeidForOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::exp2) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::Exp2Op>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::exp) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::ExpOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::expect) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::ExpectOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::expect_with_probability) { +FailureOr _llvmir_gen_operand_val = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_val)) + return failure(); +FailureOr _llvmir_gen_operand_expected = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_expected)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_val, *_llvmir_gen_operand_expected, moduleImport.matchFloatAttr(llvmOperands[2])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::fabs) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::FAbsOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::ceil) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::FCeilOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::floor) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::FFloorOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::fma) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::FMAOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::fmuladd) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::FMulAddOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::trunc) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::FTruncOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::fshl) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::FshlOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::fshr) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::FshrOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::get_active_lane_mask) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::GetActiveLaneMaskOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::is_constant) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::IsConstantOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::is_fpclass) { +FailureOr _llvmir_gen_operand_in = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_in)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::IsFPClass>(moduleImport.translateLoc(inst->getDebugLoc()), + moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_in, moduleImport.matchIntegerAttr(llvmOperands[1])); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (intrinsicID == llvm::Intrinsic::lifetime_end) { +FailureOr _llvmir_gen_operand_ptr = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_ptr)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.matchIntegerAttr(llvmOperands[0]), *_llvmir_gen_operand_ptr); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::lifetime_start) { +FailureOr _llvmir_gen_operand_ptr = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_ptr)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.matchIntegerAttr(llvmOperands[0]), *_llvmir_gen_operand_ptr); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::llrint) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::LlrintOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::llround) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::LlroundOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::log2) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::Log2Op>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::log10) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::Log10Op>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::log) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::LogOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::lrint) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::LrintOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::lround) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::LroundOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::masked_load) { +FailureOr _llvmir_gen_operand_data = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_data)) + return failure(); +FailureOr _llvmir_gen_operand_mask = moduleImport.convertValue(llvmOperands[2]); +if (failed(_llvmir_gen_operand_mask)) + return failure(); +FailureOr> _llvmir_gen_operand_pass_thru = moduleImport.convertValues(llvmOperands.drop_front(3)); +if (failed(_llvmir_gen_operand_pass_thru)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), + moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_data, *_llvmir_gen_operand_mask, *_llvmir_gen_operand_pass_thru, moduleImport.matchIntegerAttr(llvmOperands[1])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::masked_store) { +FailureOr _llvmir_gen_operand_value = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_value)) + return failure(); +FailureOr _llvmir_gen_operand_data = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_data)) + return failure(); +FailureOr _llvmir_gen_operand_mask = moduleImport.convertValue(llvmOperands[3]); +if (failed(_llvmir_gen_operand_mask)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), + *_llvmir_gen_operand_value, *_llvmir_gen_operand_data, *_llvmir_gen_operand_mask, moduleImport.matchIntegerAttr(llvmOperands[2])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::matrix_column_major_load) { +FailureOr _llvmir_gen_operand_data = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_data)) + return failure(); +FailureOr _llvmir_gen_operand_stride = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_stride)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_data, *_llvmir_gen_operand_stride, + moduleImport.matchIntegerAttr(llvmOperands[2]), moduleImport.matchIntegerAttr(llvmOperands[3]), moduleImport.matchIntegerAttr(llvmOperands[4])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::matrix_column_major_store) { +FailureOr _llvmir_gen_operand_matrix = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_matrix)) + return failure(); +FailureOr _llvmir_gen_operand_data = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_data)) + return failure(); +FailureOr _llvmir_gen_operand_stride = moduleImport.convertValue(llvmOperands[2]); +if (failed(_llvmir_gen_operand_stride)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_matrix, *_llvmir_gen_operand_data, *_llvmir_gen_operand_stride, + moduleImport.matchIntegerAttr(llvmOperands[3]), moduleImport.matchIntegerAttr(llvmOperands[4]), moduleImport.matchIntegerAttr(llvmOperands[5])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::matrix_multiply) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs, + moduleImport.matchIntegerAttr(llvmOperands[2]), moduleImport.matchIntegerAttr(llvmOperands[3]), moduleImport.matchIntegerAttr(llvmOperands[4])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::matrix_transpose) { +FailureOr _llvmir_gen_operand_matrix = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_matrix)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_matrix, + moduleImport.matchIntegerAttr(llvmOperands[1]), moduleImport.matchIntegerAttr(llvmOperands[2])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::maxnum) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::MaxNumOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::maximum) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::MaximumOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::memcpy_inline) { +FailureOr _llvmir_gen_operand_dst = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_dst)) + return failure(); +FailureOr _llvmir_gen_operand_src = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_src)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create<::mlir::LLVM::MemcpyInlineOp>(moduleImport.translateLoc(inst->getDebugLoc()), + *_llvmir_gen_operand_dst, *_llvmir_gen_operand_src, moduleImport.matchIntegerAttr(llvmOperands[2]), moduleImport.matchIntegerAttr(llvmOperands[3])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::memcpy) { +FailureOr _llvmir_gen_operand_dst = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_dst)) + return failure(); +FailureOr _llvmir_gen_operand_src = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_src)) + return failure(); +FailureOr _llvmir_gen_operand_len = moduleImport.convertValue(llvmOperands[2]); +if (failed(_llvmir_gen_operand_len)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create<::mlir::LLVM::MemcpyOp>(moduleImport.translateLoc(inst->getDebugLoc()), + *_llvmir_gen_operand_dst, *_llvmir_gen_operand_src, *_llvmir_gen_operand_len, moduleImport.matchIntegerAttr(llvmOperands[3])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::memmove) { +FailureOr _llvmir_gen_operand_dst = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_dst)) + return failure(); +FailureOr _llvmir_gen_operand_src = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_src)) + return failure(); +FailureOr _llvmir_gen_operand_len = moduleImport.convertValue(llvmOperands[2]); +if (failed(_llvmir_gen_operand_len)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create<::mlir::LLVM::MemmoveOp>(moduleImport.translateLoc(inst->getDebugLoc()), + *_llvmir_gen_operand_dst, *_llvmir_gen_operand_src, *_llvmir_gen_operand_len, moduleImport.matchIntegerAttr(llvmOperands[3])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::memset) { +FailureOr _llvmir_gen_operand_dst = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_dst)) + return failure(); +FailureOr _llvmir_gen_operand_val = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_val)) + return failure(); +FailureOr _llvmir_gen_operand_len = moduleImport.convertValue(llvmOperands[2]); +if (failed(_llvmir_gen_operand_len)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create<::mlir::LLVM::MemsetOp>(moduleImport.translateLoc(inst->getDebugLoc()), + *_llvmir_gen_operand_dst, *_llvmir_gen_operand_val, *_llvmir_gen_operand_len, moduleImport.matchIntegerAttr(llvmOperands[3])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::minnum) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::MinNumOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::minimum) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::MinimumOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::nearbyint) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::NearbyintOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::experimental_noalias_scope_decl) { + + + FailureOr> scopeAttrs = + moduleImport.matchAliasScopeAttrs(llvmOperands[0]); + // Drop the intrinsic if the alias scope translation fails since the scope + // is not used by an aliasing operation, such as a load or store, that is + // used to convert the alias scope metadata. + if (failed(scopeAttrs)) + return success(); + if (scopeAttrs->size() != 1) + return failure(); + moduleImport.mapNoResultOp(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), (*scopeAttrs)[0]); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::powi) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::PowIOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::pow) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::PowOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::prefetch) { +FailureOr _llvmir_gen_operand_addr = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_addr)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create<::mlir::LLVM::Prefetch>(moduleImport.translateLoc(inst->getDebugLoc()), + *_llvmir_gen_operand_addr, moduleImport.matchIntegerAttr(llvmOperands[1]), moduleImport.matchIntegerAttr(llvmOperands[2]), moduleImport.matchIntegerAttr(llvmOperands[3])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::ptr_annotation) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::PtrAnnotation>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::rint) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::RintOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::roundeven) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::RoundEvenOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::round) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::RoundOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::sadd_sat) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SAddSat>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::sadd_with_overflow) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SAddWithOverflowOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::smax) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SMaxOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::smin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SMinOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::smul_with_overflow) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SMulWithOverflowOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::ssa_copy) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SSACopyOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::sshl_sat) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SSHLSat>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::ssub_sat) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SSubSat>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::ssub_with_overflow) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SSubWithOverflowOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::sin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SinOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::sqrt) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::SqrtOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::stackrestore) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::StackRestoreOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::stacksave) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::StackSaveOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::experimental_stepvector) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::StepVectorOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::threadlocal_address) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::ThreadlocalAddressOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::trap) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::Trap>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::uadd_sat) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::UAddSat>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::uadd_with_overflow) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::UAddWithOverflowOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::ubsantrap) { + + + moduleImport.mapNoResultOp(inst) = + odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.matchIntegerAttr(llvmOperands[0])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::umax) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::UMaxOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::umin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::UMinOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::umul_with_overflow) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::UMulWithOverflowOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::ushl_sat) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::USHLSat>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::usub_sat) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::USubSat>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::usub_with_overflow) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::USubWithOverflowOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_ashr) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPAShrOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_add) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPAddOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_and) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPAndOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fadd) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFAddOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fdiv) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFDivOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fmuladd) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFMulAddOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fmul) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFMulOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fneg) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFNegOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fpext) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFPExtOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fptosi) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFPToSIOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fptoui) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFPToUIOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fptrunc) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFPTruncOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_frem) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFRemOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fsub) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFSubOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_fma) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPFmaOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_inttoptr) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPIntToPtrOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_lshr) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPLShrOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_load) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPLoadOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_merge) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPMergeMinOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_mul) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPMulOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_or) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPOrOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_ptrtoint) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPPtrToIntOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_add) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceAddOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_and) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceAndOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_fadd) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceFAddOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_fmax) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceFMaxOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_fmin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceFMinOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_fmul) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceFMulOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_mul) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceMulOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_or) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceOrOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_smax) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceSMaxOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_smin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceSMinOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_umax) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceUMaxOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_umin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceUMinOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_reduce_xor) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPReduceXorOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_sdiv) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPSDivOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_sext) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPSExtOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_sitofp) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPSIToFPOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_srem) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPSRemOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_select) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPSelectMinOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_shl) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPShlOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_store) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::VPStoreOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::experimental_vp_strided_load) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPStridedLoadOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::experimental_vp_strided_store) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::VPStridedStoreOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_sub) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPSubOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_trunc) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPTruncOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_udiv) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPUDivOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_uitofp) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPUIToFPOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_urem) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPURemOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_xor) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPXorOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vp_zext) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::VPZExtOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vacopy) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::VaCopyOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vaend) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::VaEndOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vastart) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::VaStartOp>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::var_annotation) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::VarAnnotation>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::masked_compressstore) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {}; + auto op = odsBuilder.create<::mlir::LLVM::masked_compressstore>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapNoResultOp(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::masked_expandload) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::masked_expandload>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::masked_gather) { +FailureOr _llvmir_gen_operand_ptrs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_ptrs)) + return failure(); +FailureOr _llvmir_gen_operand_mask = moduleImport.convertValue(llvmOperands[2]); +if (failed(_llvmir_gen_operand_mask)) + return failure(); +FailureOr> _llvmir_gen_operand_pass_thru = moduleImport.convertValues(llvmOperands.drop_front(3)); +if (failed(_llvmir_gen_operand_pass_thru)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), + moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_ptrs, *_llvmir_gen_operand_mask, *_llvmir_gen_operand_pass_thru, moduleImport.matchIntegerAttr(llvmOperands[1])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::masked_scatter) { +FailureOr _llvmir_gen_operand_value = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_value)) + return failure(); +FailureOr _llvmir_gen_operand_ptrs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_ptrs)) + return failure(); +FailureOr _llvmir_gen_operand_mask = moduleImport.convertValue(llvmOperands[3]); +if (failed(_llvmir_gen_operand_mask)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), + *_llvmir_gen_operand_value, *_llvmir_gen_operand_ptrs, *_llvmir_gen_operand_mask, moduleImport.matchIntegerAttr(llvmOperands[2])); + + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_add) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_add>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_and) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_and>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_fadd) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_fadd>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_fmax) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_fmax>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_fmaximum) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_fmaximum>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_fmin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_fmin>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_fminimum) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_fminimum>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_fmul) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_fmul>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.setFastmathFlagsAttr(inst, op);moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_mul) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_mul>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_or) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_or>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_smax) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_smax>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_smin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_smin>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_umax) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_umax>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_umin) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_umin>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vector_reduce_xor) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vector_reduce_xor>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} +if (intrinsicID == llvm::Intrinsic::vscale) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + SmallVector resultTypes = + {moduleImport.convertType(inst->getType())}; + auto op = odsBuilder.create<::mlir::LLVM::vscale>( + moduleImport.translateLoc(inst->getDebugLoc()), resultTypes, *mlirOperands); + moduleImport.mapValue(inst) = op; + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..dd025afb08e320e936b2e86a4229a8938016ec58 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc @@ -0,0 +1,40604 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LLVMIntrinsicOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::LLVM::AbsOp, +::mlir::LLVM::Annotation, +::mlir::LLVM::AssumeOp, +::mlir::LLVM::BitReverseOp, +::mlir::LLVM::ByteSwapOp, +::mlir::LLVM::CopySignOp, +::mlir::LLVM::CoroAlignOp, +::mlir::LLVM::CoroBeginOp, +::mlir::LLVM::CoroEndOp, +::mlir::LLVM::CoroFreeOp, +::mlir::LLVM::CoroIdOp, +::mlir::LLVM::CoroResumeOp, +::mlir::LLVM::CoroSaveOp, +::mlir::LLVM::CoroSizeOp, +::mlir::LLVM::CoroSuspendOp, +::mlir::LLVM::CosOp, +::mlir::LLVM::CountLeadingZerosOp, +::mlir::LLVM::CountTrailingZerosOp, +::mlir::LLVM::CtPopOp, +::mlir::LLVM::DbgDeclareOp, +::mlir::LLVM::DbgLabelOp, +::mlir::LLVM::DbgValueOp, +::mlir::LLVM::DebugTrap, +::mlir::LLVM::EhTypeidForOp, +::mlir::LLVM::Exp2Op, +::mlir::LLVM::ExpOp, +::mlir::LLVM::ExpectOp, +::mlir::LLVM::ExpectWithProbabilityOp, +::mlir::LLVM::FAbsOp, +::mlir::LLVM::FCeilOp, +::mlir::LLVM::FFloorOp, +::mlir::LLVM::FMAOp, +::mlir::LLVM::FMulAddOp, +::mlir::LLVM::FTruncOp, +::mlir::LLVM::FshlOp, +::mlir::LLVM::FshrOp, +::mlir::LLVM::GetActiveLaneMaskOp, +::mlir::LLVM::IsConstantOp, +::mlir::LLVM::IsFPClass, +::mlir::LLVM::LifetimeEndOp, +::mlir::LLVM::LifetimeStartOp, +::mlir::LLVM::LlrintOp, +::mlir::LLVM::LlroundOp, +::mlir::LLVM::Log10Op, +::mlir::LLVM::Log2Op, +::mlir::LLVM::LogOp, +::mlir::LLVM::LrintOp, +::mlir::LLVM::LroundOp, +::mlir::LLVM::MaskedLoadOp, +::mlir::LLVM::MaskedStoreOp, +::mlir::LLVM::MatrixColumnMajorLoadOp, +::mlir::LLVM::MatrixColumnMajorStoreOp, +::mlir::LLVM::MatrixMultiplyOp, +::mlir::LLVM::MatrixTransposeOp, +::mlir::LLVM::MaxNumOp, +::mlir::LLVM::MaximumOp, +::mlir::LLVM::MemcpyInlineOp, +::mlir::LLVM::MemcpyOp, +::mlir::LLVM::MemmoveOp, +::mlir::LLVM::MemsetOp, +::mlir::LLVM::MinNumOp, +::mlir::LLVM::MinimumOp, +::mlir::LLVM::NearbyintOp, +::mlir::LLVM::NoAliasScopeDeclOp, +::mlir::LLVM::PowIOp, +::mlir::LLVM::PowOp, +::mlir::LLVM::Prefetch, +::mlir::LLVM::PtrAnnotation, +::mlir::LLVM::RintOp, +::mlir::LLVM::RoundEvenOp, +::mlir::LLVM::RoundOp, +::mlir::LLVM::SAddSat, +::mlir::LLVM::SAddWithOverflowOp, +::mlir::LLVM::SMaxOp, +::mlir::LLVM::SMinOp, +::mlir::LLVM::SMulWithOverflowOp, +::mlir::LLVM::SSACopyOp, +::mlir::LLVM::SSHLSat, +::mlir::LLVM::SSubSat, +::mlir::LLVM::SSubWithOverflowOp, +::mlir::LLVM::SinOp, +::mlir::LLVM::SqrtOp, +::mlir::LLVM::StackRestoreOp, +::mlir::LLVM::StackSaveOp, +::mlir::LLVM::StepVectorOp, +::mlir::LLVM::ThreadlocalAddressOp, +::mlir::LLVM::Trap, +::mlir::LLVM::UAddSat, +::mlir::LLVM::UAddWithOverflowOp, +::mlir::LLVM::UBSanTrap, +::mlir::LLVM::UMaxOp, +::mlir::LLVM::UMinOp, +::mlir::LLVM::UMulWithOverflowOp, +::mlir::LLVM::USHLSat, +::mlir::LLVM::USubSat, +::mlir::LLVM::USubWithOverflowOp, +::mlir::LLVM::VPAShrOp, +::mlir::LLVM::VPAddOp, +::mlir::LLVM::VPAndOp, +::mlir::LLVM::VPFAddOp, +::mlir::LLVM::VPFDivOp, +::mlir::LLVM::VPFMulAddOp, +::mlir::LLVM::VPFMulOp, +::mlir::LLVM::VPFNegOp, +::mlir::LLVM::VPFPExtOp, +::mlir::LLVM::VPFPToSIOp, +::mlir::LLVM::VPFPToUIOp, +::mlir::LLVM::VPFPTruncOp, +::mlir::LLVM::VPFRemOp, +::mlir::LLVM::VPFSubOp, +::mlir::LLVM::VPFmaOp, +::mlir::LLVM::VPIntToPtrOp, +::mlir::LLVM::VPLShrOp, +::mlir::LLVM::VPLoadOp, +::mlir::LLVM::VPMergeMinOp, +::mlir::LLVM::VPMulOp, +::mlir::LLVM::VPOrOp, +::mlir::LLVM::VPPtrToIntOp, +::mlir::LLVM::VPReduceAddOp, +::mlir::LLVM::VPReduceAndOp, +::mlir::LLVM::VPReduceFAddOp, +::mlir::LLVM::VPReduceFMaxOp, +::mlir::LLVM::VPReduceFMinOp, +::mlir::LLVM::VPReduceFMulOp, +::mlir::LLVM::VPReduceMulOp, +::mlir::LLVM::VPReduceOrOp, +::mlir::LLVM::VPReduceSMaxOp, +::mlir::LLVM::VPReduceSMinOp, +::mlir::LLVM::VPReduceUMaxOp, +::mlir::LLVM::VPReduceUMinOp, +::mlir::LLVM::VPReduceXorOp, +::mlir::LLVM::VPSDivOp, +::mlir::LLVM::VPSExtOp, +::mlir::LLVM::VPSIToFPOp, +::mlir::LLVM::VPSRemOp, +::mlir::LLVM::VPSelectMinOp, +::mlir::LLVM::VPShlOp, +::mlir::LLVM::VPStoreOp, +::mlir::LLVM::VPStridedLoadOp, +::mlir::LLVM::VPStridedStoreOp, +::mlir::LLVM::VPSubOp, +::mlir::LLVM::VPTruncOp, +::mlir::LLVM::VPUDivOp, +::mlir::LLVM::VPUIToFPOp, +::mlir::LLVM::VPURemOp, +::mlir::LLVM::VPXorOp, +::mlir::LLVM::VPZExtOp, +::mlir::LLVM::VaCopyOp, +::mlir::LLVM::VaEndOp, +::mlir::LLVM::VaStartOp, +::mlir::LLVM::VarAnnotation, +::mlir::LLVM::masked_compressstore, +::mlir::LLVM::masked_expandload, +::mlir::LLVM::masked_gather, +::mlir::LLVM::masked_scatter, +::mlir::LLVM::vector_extract, +::mlir::LLVM::vector_insert, +::mlir::LLVM::vector_reduce_add, +::mlir::LLVM::vector_reduce_and, +::mlir::LLVM::vector_reduce_fadd, +::mlir::LLVM::vector_reduce_fmax, +::mlir::LLVM::vector_reduce_fmaximum, +::mlir::LLVM::vector_reduce_fmin, +::mlir::LLVM::vector_reduce_fminimum, +::mlir::LLVM::vector_reduce_fmul, +::mlir::LLVM::vector_reduce_mul, +::mlir::LLVM::vector_reduce_or, +::mlir::LLVM::vector_reduce_smax, +::mlir::LLVM::vector_reduce_smin, +::mlir::LLVM::vector_reduce_umax, +::mlir::LLVM::vector_reduce_umin, +::mlir::LLVM::vector_reduce_xor, +::mlir::LLVM::vscale +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace LLVM { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessInteger())) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::mlir::LLVM::getVectorElementType(type).isSignlessInteger()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be signless integer or LLVM dialect-compatible vector of signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleOuterType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger()))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(32)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::mlir::LLVM::isCompatibleFloatingPointType(type))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::mlir::LLVM::isCompatibleFloatingPointType(::mlir::LLVM::getVectorElementType(type))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be floating point LLVM type or LLVM dialect-compatible vector of floating point LLVM type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMTokenType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM token type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) || ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType().isSignlessInteger(8))))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getAddressSpace() == 0)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer to 8-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleFloatingPointType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be floating point LLVM type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::mlir::LLVM::isCompatibleVectorType(type))) && ((::mlir::LLVM::getVectorElementType(type).isSignlessInteger(1))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible vector of 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps11( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleVectorType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible vector type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps12( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(8)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 8-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps13( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) || ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType().isSignlessInteger()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer to signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps14( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps15( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::mlir::LLVM::isCompatibleVectorType(type))) && ((::mlir::LLVM::getVectorElementType(type).isSignlessInteger())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible vector of signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps16( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::isa<::mlir::FloatType>(::mlir::LLVM::getVectorElementType(type)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible vector of floating-point, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps17( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(::mlir::LLVM::getVectorElementType(type)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible vector of LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMIntrinsicOps18( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::FloatType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be floating-point, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(1))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 1-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM fastmath flags"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::DILocalVariableAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: "; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::DILabelAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: "; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::FloatAttr>(attr))) && ((::llvm::cast<::mlir::FloatAttr>(attr).getType().isF64())))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit float attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::IntegerAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: arbitrary integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps8( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM dialect access group metadata array"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps8( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps8(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps9( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM dialect alias scope array"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps9( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps10( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps10( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps10(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps11( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM dialect alias scope"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps11( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps11(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps12( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(8))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 8-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMIntrinsicOps12( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMIntrinsicOps12(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AbsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AbsOpGenericAdaptorBase::AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.abs", odsAttrs.getContext()); +} + +AbsOpGenericAdaptorBase::AbsOpGenericAdaptorBase(AbsOp op) : AbsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AbsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AbsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr AbsOpGenericAdaptorBase::getIsIntMinPoisonAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().is_int_min_poison); + return attr; +} + +bool AbsOpGenericAdaptorBase::getIsIntMinPoison() { + auto attr = getIsIntMinPoisonAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +AbsOpAdaptor::AbsOpAdaptor(AbsOp op) : AbsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AbsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_is_int_min_poison = getProperties().is_int_min_poison; (void)tblgen_is_int_min_poison; + if (!tblgen_is_int_min_poison) return emitError(loc, "'llvm.intr.abs' op ""requires attribute 'is_int_min_poison'"); + + if (tblgen_is_int_min_poison && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_is_int_min_poison))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_is_int_min_poison).getType().isSignlessInteger(1))))) + return emitError(loc, "'llvm.intr.abs' op ""attribute 'is_int_min_poison' failed to satisfy constraint: 1-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair AbsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AbsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AbsOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AbsOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AbsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AbsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AbsOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AbsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.is_int_min_poison; + auto attr = dict.get("is_int_min_poison"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for is_int_min_poison in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `is_int_min_poison` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AbsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.is_int_min_poison; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("is_int_min_poison", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AbsOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.is_int_min_poison.getAsOpaquePointer())); +} + +std::optional AbsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "is_int_min_poison") + return prop.is_int_min_poison; + return std::nullopt; +} + +void AbsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "is_int_min_poison") { + prop.is_int_min_poison = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AbsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.is_int_min_poison) attrs.append("is_int_min_poison", prop.is_int_min_poison); +} + +::mlir::LogicalResult AbsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIsIntMinPoisonAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, "is_int_min_poison", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AbsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.is_int_min_poison))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AbsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.is_int_min_poison); +} + +::mlir::IntegerAttr AbsOp::getIsIntMinPoisonAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().is_int_min_poison); +} + +bool AbsOp::getIsIntMinPoison() { + auto attr = getIsIntMinPoisonAttr(); + return attr.getValue().getZExtValue(); +} + +void AbsOp::setIsIntMinPoisonAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIsIntMinPoisonAttrName(), attr); +} + +void AbsOp::setIsIntMinPoison(bool attrValue) { + (*this)->setAttr(getIsIntMinPoisonAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(1), attrValue)); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::IntegerAttr is_int_min_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_int_min_poison = is_int_min_poison; + odsState.addTypes(res); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::IntegerAttr is_int_min_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_int_min_poison = is_int_min_poison; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, bool is_int_min_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_int_min_poison = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), is_int_min_poison); + odsState.addTypes(res); +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, bool is_int_min_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_int_min_poison = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), is_int_min_poison); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AbsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AbsOp::verifyInvariantsImpl() { + auto tblgen_is_int_min_poison = getProperties().is_int_min_poison; (void)tblgen_is_int_min_poison; + if (!tblgen_is_int_min_poison) return emitOpError("requires attribute 'is_int_min_poison'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(*this, tblgen_is_int_min_poison, "is_int_min_poison"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AbsOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void AbsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AbsOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Annotation definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AnnotationGenericAdaptorBase::AnnotationGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.annotation", odsAttrs.getContext()); +} + +AnnotationGenericAdaptorBase::AnnotationGenericAdaptorBase(Annotation op) : AnnotationGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AnnotationGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AnnotationGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AnnotationAdaptor::AnnotationAdaptor(Annotation op) : AnnotationGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AnnotationAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair Annotation::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Annotation::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> Annotation::getInteger() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> Annotation::getAnnotation() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> Annotation::getFileName() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> Annotation::getLine() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &Annotation::getIntegerMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &Annotation::getAnnotationMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &Annotation::getFileNameMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &Annotation::getLineMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair Annotation::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Annotation::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> Annotation::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +void Annotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value integer, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line) { + odsState.addOperands(integer); + odsState.addOperands(annotation); + odsState.addOperands(fileName); + odsState.addOperands(line); + odsState.addTypes(res); +} + +void Annotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value integer, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line) { + odsState.addOperands(integer); + odsState.addOperands(annotation); + odsState.addOperands(fileName); + odsState.addOperands(line); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Annotation::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Annotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value integer, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line) { + odsState.addOperands(integer); + odsState.addOperands(annotation); + odsState.addOperands(fileName); + odsState.addOperands(line); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Annotation::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Annotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Annotation::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult Annotation::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that all of {res, integer} have same type"); + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {annotation, fileName} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult Annotation::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Annotation::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::Annotation) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AssumeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AssumeOpGenericAdaptorBase::AssumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.assume", odsAttrs.getContext()); +} + +AssumeOpGenericAdaptorBase::AssumeOpGenericAdaptorBase(AssumeOp op) : AssumeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AssumeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AssumeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AssumeOpAdaptor::AssumeOpAdaptor(AssumeOp op) : AssumeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AssumeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AssumeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AssumeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> AssumeOp::getCond() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AssumeOp::getCondMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AssumeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AssumeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void AssumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value cond) { + odsState.addOperands(cond); +} + +void AssumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond) { + odsState.addOperands(cond); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AssumeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AssumeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AssumeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AssumeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::BitReverseOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BitReverseOpGenericAdaptorBase::BitReverseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.bitreverse", odsAttrs.getContext()); +} + +BitReverseOpGenericAdaptorBase::BitReverseOpGenericAdaptorBase(BitReverseOp op) : BitReverseOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BitReverseOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BitReverseOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BitReverseOpAdaptor::BitReverseOpAdaptor(BitReverseOp op) : BitReverseOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BitReverseOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BitReverseOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BitReverseOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BitReverseOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &BitReverseOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair BitReverseOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BitReverseOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BitReverseOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BitReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void BitReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in) { + odsState.addOperands(in); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BitReverseOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void BitReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BitReverseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void BitReverseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(BitReverseOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult BitReverseOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BitReverseOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult BitReverseOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult BitReverseOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BitReverseOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void BitReverseOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::BitReverseOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ByteSwapOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ByteSwapOpGenericAdaptorBase::ByteSwapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.bswap", odsAttrs.getContext()); +} + +ByteSwapOpGenericAdaptorBase::ByteSwapOpGenericAdaptorBase(ByteSwapOp op) : ByteSwapOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ByteSwapOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ByteSwapOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ByteSwapOpAdaptor::ByteSwapOpAdaptor(ByteSwapOp op) : ByteSwapOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ByteSwapOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ByteSwapOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ByteSwapOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ByteSwapOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ByteSwapOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ByteSwapOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ByteSwapOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ByteSwapOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ByteSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void ByteSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in) { + odsState.addOperands(in); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ByteSwapOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ByteSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ByteSwapOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ByteSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ByteSwapOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ByteSwapOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ByteSwapOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ByteSwapOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ByteSwapOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ByteSwapOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void ByteSwapOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ByteSwapOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CopySignOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CopySignOpGenericAdaptorBase::CopySignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.copysign", odsAttrs.getContext()); +} + +CopySignOpGenericAdaptorBase::CopySignOpGenericAdaptorBase(CopySignOp op) : CopySignOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CopySignOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CopySignOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr CopySignOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags CopySignOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +CopySignOpAdaptor::CopySignOpAdaptor(CopySignOp op) : CopySignOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CopySignOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.copysign' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair CopySignOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CopySignOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CopySignOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CopySignOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CopySignOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CopySignOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CopySignOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CopySignOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CopySignOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CopySignOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CopySignOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CopySignOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional CopySignOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void CopySignOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CopySignOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult CopySignOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopySignOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CopySignOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr CopySignOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags CopySignOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void CopySignOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void CopySignOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CopySignOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CopySignOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CopySignOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CopySignOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void CopySignOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult CopySignOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopySignOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CopySignOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CopySignOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CopySignOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void CopySignOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CopySignOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroAlignOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroAlignOpGenericAdaptorBase::CoroAlignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.coro.align", odsAttrs.getContext()); +} + +CoroAlignOpGenericAdaptorBase::CoroAlignOpGenericAdaptorBase(CoroAlignOp op) : CoroAlignOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroAlignOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroAlignOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroAlignOpAdaptor::CoroAlignOpAdaptor(CoroAlignOp op) : CoroAlignOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroAlignOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroAlignOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroAlignOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CoroAlignOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroAlignOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroAlignOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CoroAlignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void CoroAlignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroAlignOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroAlignOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroAlignOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroAlignOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void CoroAlignOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroAlignOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroBeginOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroBeginOpGenericAdaptorBase::CoroBeginOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.coro.begin", odsAttrs.getContext()); +} + +CoroBeginOpGenericAdaptorBase::CoroBeginOpGenericAdaptorBase(CoroBeginOp op) : CoroBeginOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroBeginOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroBeginOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroBeginOpAdaptor::CoroBeginOpAdaptor(CoroBeginOp op) : CoroBeginOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroBeginOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroBeginOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroBeginOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroBeginOp::getToken() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CoroBeginOp::getMem() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CoroBeginOp::getTokenMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CoroBeginOp::getMemMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroBeginOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroBeginOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroBeginOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CoroBeginOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value token, ::mlir::Value mem) { + odsState.addOperands(token); + odsState.addOperands(mem); + odsState.addTypes(res); +} + +void CoroBeginOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token, ::mlir::Value mem) { + odsState.addOperands(token); + odsState.addOperands(mem); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroBeginOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroBeginOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroBeginOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroBeginOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tokenRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tokenOperands(tokenRawOperands); ::llvm::SMLoc tokenOperandsLoc; + (void)tokenOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memOperands(memRawOperands); ::llvm::SMLoc memOperandsLoc; + (void)memOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + tokenOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tokenRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + memOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(::llvm::concat(tokenOperands, memOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroBeginOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getToken(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMem(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroBeginOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroEndOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroEndOpGenericAdaptorBase::CoroEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.coro.end", odsAttrs.getContext()); +} + +CoroEndOpGenericAdaptorBase::CoroEndOpGenericAdaptorBase(CoroEndOp op) : CoroEndOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroEndOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroEndOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroEndOpAdaptor::CoroEndOpAdaptor(CoroEndOp op) : CoroEndOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroEndOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroEndOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroEndOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroEndOp::getHandle() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CoroEndOp::getUnwind() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::Value CoroEndOp::getRetvals() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &CoroEndOp::getHandleMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CoroEndOp::getUnwindMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CoroEndOp::getRetvalsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroEndOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroEndOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroEndOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CoroEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value handle, ::mlir::Value unwind, ::mlir::Value retvals) { + odsState.addOperands(handle); + odsState.addOperands(unwind); + odsState.addOperands(retvals); + odsState.addTypes(res); +} + +void CoroEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value unwind, ::mlir::Value retvals) { + odsState.addOperands(handle); + odsState.addOperands(unwind); + odsState.addOperands(retvals); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroEndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroEndOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroEndOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroEndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand handleRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> handleOperands(handleRawOperands); ::llvm::SMLoc handleOperandsLoc; + (void)handleOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand unwindRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> unwindOperands(unwindRawOperands); ::llvm::SMLoc unwindOperandsLoc; + (void)unwindOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand retvalsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> retvalsOperands(retvalsRawOperands); ::llvm::SMLoc retvalsOperandsLoc; + (void)retvalsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + handleOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(handleRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + unwindOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(unwindRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + retvalsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(retvalsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(::llvm::concat(handleOperands, unwindOperands, retvalsOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroEndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getHandle(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getUnwind(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRetvals(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroEndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroFreeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroFreeOpGenericAdaptorBase::CoroFreeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.coro.free", odsAttrs.getContext()); +} + +CoroFreeOpGenericAdaptorBase::CoroFreeOpGenericAdaptorBase(CoroFreeOp op) : CoroFreeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroFreeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroFreeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroFreeOpAdaptor::CoroFreeOpAdaptor(CoroFreeOp op) : CoroFreeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroFreeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroFreeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroFreeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroFreeOp::getId() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CoroFreeOp::getHandle() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CoroFreeOp::getIdMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CoroFreeOp::getHandleMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroFreeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroFreeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroFreeOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CoroFreeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value id, ::mlir::Value handle) { + odsState.addOperands(id); + odsState.addOperands(handle); + odsState.addTypes(res); +} + +void CoroFreeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value id, ::mlir::Value handle) { + odsState.addOperands(id); + odsState.addOperands(handle); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroFreeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroFreeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroFreeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroFreeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand idRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> idOperands(idRawOperands); ::llvm::SMLoc idOperandsLoc; + (void)idOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand handleRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> handleOperands(handleRawOperands); ::llvm::SMLoc handleOperandsLoc; + (void)handleOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + idOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(idRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + handleOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(handleRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(::llvm::concat(idOperands, handleOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroFreeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getId(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getHandle(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroFreeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroIdOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroIdOpGenericAdaptorBase::CoroIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.coro.id", odsAttrs.getContext()); +} + +CoroIdOpGenericAdaptorBase::CoroIdOpGenericAdaptorBase(CoroIdOp op) : CoroIdOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroIdOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroIdOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroIdOpAdaptor::CoroIdOpAdaptor(CoroIdOp op) : CoroIdOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroIdOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroIdOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroIdOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> CoroIdOp::getAlign() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value CoroIdOp::getPromise() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value CoroIdOp::getCoroaddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value CoroIdOp::getFnaddrs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &CoroIdOp::getAlignMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CoroIdOp::getPromiseMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CoroIdOp::getCoroaddrMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CoroIdOp::getFnaddrsMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroIdOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroIdOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroIdOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CoroIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value align, ::mlir::Value promise, ::mlir::Value coroaddr, ::mlir::Value fnaddrs) { + odsState.addOperands(align); + odsState.addOperands(promise); + odsState.addOperands(coroaddr); + odsState.addOperands(fnaddrs); + odsState.addTypes(res); +} + +void CoroIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value align, ::mlir::Value promise, ::mlir::Value coroaddr, ::mlir::Value fnaddrs) { + odsState.addOperands(align); + odsState.addOperands(promise); + odsState.addOperands(coroaddr); + odsState.addOperands(fnaddrs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroIdOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroIdOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroIdOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroIdOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand alignRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> alignOperands(alignRawOperands); ::llvm::SMLoc alignOperandsLoc; + (void)alignOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand promiseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> promiseOperands(promiseRawOperands); ::llvm::SMLoc promiseOperandsLoc; + (void)promiseOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand coroaddrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> coroaddrOperands(coroaddrRawOperands); ::llvm::SMLoc coroaddrOperandsLoc; + (void)coroaddrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand fnaddrsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> fnaddrsOperands(fnaddrsRawOperands); ::llvm::SMLoc fnaddrsOperandsLoc; + (void)fnaddrsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + alignOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(alignRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + promiseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(promiseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + coroaddrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(coroaddrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + fnaddrsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(fnaddrsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(::llvm::concat(alignOperands, promiseOperands, coroaddrOperands, fnaddrsOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroIdOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAlign(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getPromise(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCoroaddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getFnaddrs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroIdOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroResumeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroResumeOpGenericAdaptorBase::CoroResumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.coro.resume", odsAttrs.getContext()); +} + +CoroResumeOpGenericAdaptorBase::CoroResumeOpGenericAdaptorBase(CoroResumeOp op) : CoroResumeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroResumeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroResumeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroResumeOpAdaptor::CoroResumeOpAdaptor(CoroResumeOp op) : CoroResumeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroResumeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroResumeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroResumeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroResumeOp::getHandle() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CoroResumeOp::getHandleMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroResumeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroResumeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void CoroResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle) { + odsState.addOperands(handle); +} + +void CoroResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle) { + odsState.addOperands(handle); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroResumeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroResumeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroResumeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroResumeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand handleRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> handleOperands(handleRawOperands); ::llvm::SMLoc handleOperandsLoc; + (void)handleOperandsLoc; + ::mlir::Type handleRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> handleTypes(handleRawTypes); + + handleOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(handleRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(handleRawTypes[0])) + return ::mlir::failure(); + if (parser.resolveOperands(handleOperands, handleTypes, handleOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroResumeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getHandle(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getHandle().getType(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroResumeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroSaveOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroSaveOpGenericAdaptorBase::CoroSaveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.coro.save", odsAttrs.getContext()); +} + +CoroSaveOpGenericAdaptorBase::CoroSaveOpGenericAdaptorBase(CoroSaveOp op) : CoroSaveOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroSaveOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroSaveOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroSaveOpAdaptor::CoroSaveOpAdaptor(CoroSaveOp op) : CoroSaveOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroSaveOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroSaveOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroSaveOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroSaveOp::getHandle() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CoroSaveOp::getHandleMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroSaveOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroSaveOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroSaveOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CoroSaveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value handle) { + odsState.addOperands(handle); + odsState.addTypes(res); +} + +void CoroSaveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle) { + odsState.addOperands(handle); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroSaveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroSaveOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroSaveOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroSaveOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand handleRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> handleOperands(handleRawOperands); ::llvm::SMLoc handleOperandsLoc; + (void)handleOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + handleOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(handleRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(handleOperands, allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroSaveOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getHandle(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroSaveOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroSizeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroSizeOpGenericAdaptorBase::CoroSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.coro.size", odsAttrs.getContext()); +} + +CoroSizeOpGenericAdaptorBase::CoroSizeOpGenericAdaptorBase(CoroSizeOp op) : CoroSizeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroSizeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroSizeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroSizeOpAdaptor::CoroSizeOpAdaptor(CoroSizeOp op) : CoroSizeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroSizeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroSizeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroSizeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CoroSizeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroSizeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroSizeOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CoroSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void CoroSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroSizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroSizeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroSizeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroSizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void CoroSizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroSizeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroSuspendOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CoroSuspendOpGenericAdaptorBase::CoroSuspendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.coro.suspend", odsAttrs.getContext()); +} + +CoroSuspendOpGenericAdaptorBase::CoroSuspendOpGenericAdaptorBase(CoroSuspendOp op) : CoroSuspendOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CoroSuspendOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CoroSuspendOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CoroSuspendOpAdaptor::CoroSuspendOpAdaptor(CoroSuspendOp op) : CoroSuspendOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CoroSuspendOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CoroSuspendOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CoroSuspendOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroSuspendOp::getSave() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CoroSuspendOp::getFinal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CoroSuspendOp::getSaveMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CoroSuspendOp::getFinalMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CoroSuspendOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CoroSuspendOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CoroSuspendOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CoroSuspendOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value save, ::mlir::Value final) { + odsState.addOperands(save); + odsState.addOperands(final); + odsState.addTypes(res); +} + +void CoroSuspendOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value save, ::mlir::Value final) { + odsState.addOperands(save); + odsState.addOperands(final); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CoroSuspendOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CoroSuspendOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CoroSuspendOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CoroSuspendOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand saveRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> saveOperands(saveRawOperands); ::llvm::SMLoc saveOperandsLoc; + (void)saveOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand finalRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> finalOperands(finalRawOperands); ::llvm::SMLoc finalOperandsLoc; + (void)finalOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + saveOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(saveRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + finalOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(finalRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = ::mlir::LLVM::LLVMTokenType::get(parser.getBuilder().getContext()); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(1); + result.addTypes(resTypes); + if (parser.resolveOperands(saveOperands, odsBuildableType0, saveOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(finalOperands, odsBuildableType1, finalOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CoroSuspendOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSave(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getFinal(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroSuspendOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CosOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CosOpGenericAdaptorBase::CosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.cos", odsAttrs.getContext()); +} + +CosOpGenericAdaptorBase::CosOpGenericAdaptorBase(CosOp op) : CosOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CosOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CosOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr CosOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags CosOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +CosOpAdaptor::CosOpAdaptor(CosOp op) : CosOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CosOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.cos' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair CosOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CosOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CosOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CosOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CosOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CosOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CosOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CosOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CosOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CosOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional CosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void CosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult CosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CosOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CosOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr CosOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags CosOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void CosOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void CosOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CosOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void CosOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult CosOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CosOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CosOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void CosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CosOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CountLeadingZerosOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CountLeadingZerosOpGenericAdaptorBase::CountLeadingZerosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.ctlz", odsAttrs.getContext()); +} + +CountLeadingZerosOpGenericAdaptorBase::CountLeadingZerosOpGenericAdaptorBase(CountLeadingZerosOp op) : CountLeadingZerosOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CountLeadingZerosOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CountLeadingZerosOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr CountLeadingZerosOpGenericAdaptorBase::getIsZeroPoisonAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().is_zero_poison); + return attr; +} + +bool CountLeadingZerosOpGenericAdaptorBase::getIsZeroPoison() { + auto attr = getIsZeroPoisonAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +CountLeadingZerosOpAdaptor::CountLeadingZerosOpAdaptor(CountLeadingZerosOp op) : CountLeadingZerosOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CountLeadingZerosOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_is_zero_poison = getProperties().is_zero_poison; (void)tblgen_is_zero_poison; + if (!tblgen_is_zero_poison) return emitError(loc, "'llvm.intr.ctlz' op ""requires attribute 'is_zero_poison'"); + + if (tblgen_is_zero_poison && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_is_zero_poison))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_is_zero_poison).getType().isSignlessInteger(1))))) + return emitError(loc, "'llvm.intr.ctlz' op ""attribute 'is_zero_poison' failed to satisfy constraint: 1-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair CountLeadingZerosOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CountLeadingZerosOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CountLeadingZerosOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CountLeadingZerosOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CountLeadingZerosOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CountLeadingZerosOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CountLeadingZerosOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CountLeadingZerosOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.is_zero_poison; + auto attr = dict.get("is_zero_poison"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for is_zero_poison in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `is_zero_poison` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CountLeadingZerosOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.is_zero_poison; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("is_zero_poison", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CountLeadingZerosOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.is_zero_poison.getAsOpaquePointer())); +} + +std::optional CountLeadingZerosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "is_zero_poison") + return prop.is_zero_poison; + return std::nullopt; +} + +void CountLeadingZerosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "is_zero_poison") { + prop.is_zero_poison = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CountLeadingZerosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.is_zero_poison) attrs.append("is_zero_poison", prop.is_zero_poison); +} + +::mlir::LogicalResult CountLeadingZerosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIsZeroPoisonAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, "is_zero_poison", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CountLeadingZerosOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.is_zero_poison))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CountLeadingZerosOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.is_zero_poison); +} + +::mlir::IntegerAttr CountLeadingZerosOp::getIsZeroPoisonAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().is_zero_poison); +} + +bool CountLeadingZerosOp::getIsZeroPoison() { + auto attr = getIsZeroPoisonAttr(); + return attr.getValue().getZExtValue(); +} + +void CountLeadingZerosOp::setIsZeroPoisonAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIsZeroPoisonAttrName(), attr); +} + +void CountLeadingZerosOp::setIsZeroPoison(bool attrValue) { + (*this)->setAttr(getIsZeroPoisonAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(1), attrValue)); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::IntegerAttr is_zero_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_zero_poison = is_zero_poison; + odsState.addTypes(res); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::IntegerAttr is_zero_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_zero_poison = is_zero_poison; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, bool is_zero_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_zero_poison = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), is_zero_poison); + odsState.addTypes(res); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, bool is_zero_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_zero_poison = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), is_zero_poison); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CountLeadingZerosOp::verifyInvariantsImpl() { + auto tblgen_is_zero_poison = getProperties().is_zero_poison; (void)tblgen_is_zero_poison; + if (!tblgen_is_zero_poison) return emitOpError("requires attribute 'is_zero_poison'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(*this, tblgen_is_zero_poison, "is_zero_poison"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CountLeadingZerosOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void CountLeadingZerosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CountLeadingZerosOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CountTrailingZerosOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CountTrailingZerosOpGenericAdaptorBase::CountTrailingZerosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.cttz", odsAttrs.getContext()); +} + +CountTrailingZerosOpGenericAdaptorBase::CountTrailingZerosOpGenericAdaptorBase(CountTrailingZerosOp op) : CountTrailingZerosOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CountTrailingZerosOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CountTrailingZerosOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr CountTrailingZerosOpGenericAdaptorBase::getIsZeroPoisonAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().is_zero_poison); + return attr; +} + +bool CountTrailingZerosOpGenericAdaptorBase::getIsZeroPoison() { + auto attr = getIsZeroPoisonAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +CountTrailingZerosOpAdaptor::CountTrailingZerosOpAdaptor(CountTrailingZerosOp op) : CountTrailingZerosOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CountTrailingZerosOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_is_zero_poison = getProperties().is_zero_poison; (void)tblgen_is_zero_poison; + if (!tblgen_is_zero_poison) return emitError(loc, "'llvm.intr.cttz' op ""requires attribute 'is_zero_poison'"); + + if (tblgen_is_zero_poison && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_is_zero_poison))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_is_zero_poison).getType().isSignlessInteger(1))))) + return emitError(loc, "'llvm.intr.cttz' op ""attribute 'is_zero_poison' failed to satisfy constraint: 1-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair CountTrailingZerosOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CountTrailingZerosOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CountTrailingZerosOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CountTrailingZerosOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CountTrailingZerosOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CountTrailingZerosOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CountTrailingZerosOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CountTrailingZerosOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.is_zero_poison; + auto attr = dict.get("is_zero_poison"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for is_zero_poison in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `is_zero_poison` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CountTrailingZerosOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.is_zero_poison; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("is_zero_poison", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CountTrailingZerosOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.is_zero_poison.getAsOpaquePointer())); +} + +std::optional CountTrailingZerosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "is_zero_poison") + return prop.is_zero_poison; + return std::nullopt; +} + +void CountTrailingZerosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "is_zero_poison") { + prop.is_zero_poison = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CountTrailingZerosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.is_zero_poison) attrs.append("is_zero_poison", prop.is_zero_poison); +} + +::mlir::LogicalResult CountTrailingZerosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIsZeroPoisonAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, "is_zero_poison", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CountTrailingZerosOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.is_zero_poison))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CountTrailingZerosOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.is_zero_poison); +} + +::mlir::IntegerAttr CountTrailingZerosOp::getIsZeroPoisonAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().is_zero_poison); +} + +bool CountTrailingZerosOp::getIsZeroPoison() { + auto attr = getIsZeroPoisonAttr(); + return attr.getValue().getZExtValue(); +} + +void CountTrailingZerosOp::setIsZeroPoisonAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIsZeroPoisonAttrName(), attr); +} + +void CountTrailingZerosOp::setIsZeroPoison(bool attrValue) { + (*this)->setAttr(getIsZeroPoisonAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(1), attrValue)); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::IntegerAttr is_zero_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_zero_poison = is_zero_poison; + odsState.addTypes(res); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::IntegerAttr is_zero_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_zero_poison = is_zero_poison; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, bool is_zero_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_zero_poison = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), is_zero_poison); + odsState.addTypes(res); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, bool is_zero_poison) { + odsState.addOperands(in); + odsState.getOrAddProperties().is_zero_poison = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), is_zero_poison); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CountTrailingZerosOp::verifyInvariantsImpl() { + auto tblgen_is_zero_poison = getProperties().is_zero_poison; (void)tblgen_is_zero_poison; + if (!tblgen_is_zero_poison) return emitOpError("requires attribute 'is_zero_poison'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(*this, tblgen_is_zero_poison, "is_zero_poison"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CountTrailingZerosOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void CountTrailingZerosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CountTrailingZerosOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CtPopOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CtPopOpGenericAdaptorBase::CtPopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.ctpop", odsAttrs.getContext()); +} + +CtPopOpGenericAdaptorBase::CtPopOpGenericAdaptorBase(CtPopOp op) : CtPopOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CtPopOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CtPopOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CtPopOpAdaptor::CtPopOpAdaptor(CtPopOp op) : CtPopOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CtPopOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CtPopOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CtPopOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CtPopOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CtPopOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CtPopOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CtPopOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CtPopOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CtPopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void CtPopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in) { + odsState.addOperands(in); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CtPopOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CtPopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CtPopOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CtPopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CtPopOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CtPopOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CtPopOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CtPopOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CtPopOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CtPopOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void CtPopOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CtPopOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::DbgDeclareOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DbgDeclareOpGenericAdaptorBase::DbgDeclareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.dbg.declare", odsAttrs.getContext()); +} + +DbgDeclareOpGenericAdaptorBase::DbgDeclareOpGenericAdaptorBase(DbgDeclareOp op) : DbgDeclareOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DbgDeclareOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DbgDeclareOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::DILocalVariableAttr DbgDeclareOpGenericAdaptorBase::getVarInfoAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(getProperties().varInfo); + return attr; +} + +::mlir::LLVM::DILocalVariableAttr DbgDeclareOpGenericAdaptorBase::getVarInfo() { + auto attr = getVarInfoAttr(); + return ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(attr); +} + +} // namespace detail +DbgDeclareOpAdaptor::DbgDeclareOpAdaptor(DbgDeclareOp op) : DbgDeclareOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DbgDeclareOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_varInfo = getProperties().varInfo; (void)tblgen_varInfo; + if (!tblgen_varInfo) return emitError(loc, "'llvm.intr.dbg.declare' op ""requires attribute 'varInfo'"); + + if (tblgen_varInfo && !((::llvm::isa<::mlir::LLVM::DILocalVariableAttr>(tblgen_varInfo)))) + return emitError(loc, "'llvm.intr.dbg.declare' op ""attribute 'varInfo' failed to satisfy constraint: "); + return ::mlir::success(); +} + +std::pair DbgDeclareOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DbgDeclareOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> DbgDeclareOp::getAddr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &DbgDeclareOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair DbgDeclareOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DbgDeclareOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult DbgDeclareOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.varInfo; + auto attr = dict.get("varInfo"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for varInfo in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `varInfo` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute DbgDeclareOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.varInfo; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("varInfo", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DbgDeclareOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.varInfo.getAsOpaquePointer())); +} + +std::optional DbgDeclareOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "varInfo") + return prop.varInfo; + return std::nullopt; +} + +void DbgDeclareOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "varInfo") { + prop.varInfo = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void DbgDeclareOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.varInfo) attrs.append("varInfo", prop.varInfo); +} + +::mlir::LogicalResult DbgDeclareOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getVarInfoAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps2(attr, "varInfo", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DbgDeclareOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.varInfo))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DbgDeclareOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.varInfo); +} + +::mlir::LLVM::DILocalVariableAttr DbgDeclareOp::getVarInfoAttr() { + return ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(getProperties().varInfo); +} + +::mlir::LLVM::DILocalVariableAttr DbgDeclareOp::getVarInfo() { + auto attr = getVarInfoAttr(); + return ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(attr); +} + +void DbgDeclareOp::setVarInfoAttr(::mlir::LLVM::DILocalVariableAttr attr) { + (*this)->setAttr(getVarInfoAttrName(), attr); +} + +void DbgDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::LLVM::DILocalVariableAttr varInfo) { + odsState.addOperands(addr); + odsState.getOrAddProperties().varInfo = varInfo; +} + +void DbgDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::LLVM::DILocalVariableAttr varInfo) { + odsState.addOperands(addr); + odsState.getOrAddProperties().varInfo = varInfo; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DbgDeclareOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DbgDeclareOp::verifyInvariantsImpl() { + auto tblgen_varInfo = getProperties().varInfo; (void)tblgen_varInfo; + if (!tblgen_varInfo) return emitOpError("requires attribute 'varInfo'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps2(*this, tblgen_varInfo, "varInfo"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DbgDeclareOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DbgDeclareOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::LLVM::DILocalVariableAttr varInfoAttr; + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::Type addrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> addrTypes(addrRawTypes); + + if (parser.parseAttribute(varInfoAttr, ::mlir::Type{})) + return ::mlir::failure(); + if (varInfoAttr) result.getOrAddProperties().varInfo = varInfoAttr; + if (parser.parseEqual()) + return ::mlir::failure(); + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(addrRawTypes[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.resolveOperands(addrOperands, addrTypes, addrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DbgDeclareOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttribute(getVarInfoAttr()); + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getAddr().getType(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("varInfo"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DbgDeclareOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::DbgLabelOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DbgLabelOpGenericAdaptorBase::DbgLabelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.dbg.label", odsAttrs.getContext()); +} + +DbgLabelOpGenericAdaptorBase::DbgLabelOpGenericAdaptorBase(DbgLabelOp op) : DbgLabelOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DbgLabelOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DbgLabelOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::DILabelAttr DbgLabelOpGenericAdaptorBase::getLabelAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::DILabelAttr>(getProperties().label); + return attr; +} + +::mlir::LLVM::DILabelAttr DbgLabelOpGenericAdaptorBase::getLabel() { + auto attr = getLabelAttr(); + return ::llvm::cast<::mlir::LLVM::DILabelAttr>(attr); +} + +} // namespace detail +DbgLabelOpAdaptor::DbgLabelOpAdaptor(DbgLabelOp op) : DbgLabelOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DbgLabelOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_label = getProperties().label; (void)tblgen_label; + if (!tblgen_label) return emitError(loc, "'llvm.intr.dbg.label' op ""requires attribute 'label'"); + + if (tblgen_label && !((::llvm::isa<::mlir::LLVM::DILabelAttr>(tblgen_label)))) + return emitError(loc, "'llvm.intr.dbg.label' op ""attribute 'label' failed to satisfy constraint: "); + return ::mlir::success(); +} + +std::pair DbgLabelOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DbgLabelOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair DbgLabelOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DbgLabelOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult DbgLabelOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.label; + auto attr = dict.get("label"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for label in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `label` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute DbgLabelOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.label; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("label", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DbgLabelOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.label.getAsOpaquePointer())); +} + +std::optional DbgLabelOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "label") + return prop.label; + return std::nullopt; +} + +void DbgLabelOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "label") { + prop.label = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void DbgLabelOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.label) attrs.append("label", prop.label); +} + +::mlir::LogicalResult DbgLabelOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLabelAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps3(attr, "label", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DbgLabelOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.label))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DbgLabelOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.label); +} + +::mlir::LLVM::DILabelAttr DbgLabelOp::getLabelAttr() { + return ::llvm::cast<::mlir::LLVM::DILabelAttr>(getProperties().label); +} + +::mlir::LLVM::DILabelAttr DbgLabelOp::getLabel() { + auto attr = getLabelAttr(); + return ::llvm::cast<::mlir::LLVM::DILabelAttr>(attr); +} + +void DbgLabelOp::setLabelAttr(::mlir::LLVM::DILabelAttr attr) { + (*this)->setAttr(getLabelAttrName(), attr); +} + +void DbgLabelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::DILabelAttr label) { + odsState.getOrAddProperties().label = label; +} + +void DbgLabelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::DILabelAttr label) { + odsState.getOrAddProperties().label = label; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DbgLabelOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DbgLabelOp::verifyInvariantsImpl() { + auto tblgen_label = getProperties().label; (void)tblgen_label; + if (!tblgen_label) return emitOpError("requires attribute 'label'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps3(*this, tblgen_label, "label"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult DbgLabelOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DbgLabelOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::LLVM::DILabelAttr labelAttr; + + if (parser.parseCustomAttributeWithFallback(labelAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (labelAttr) result.getOrAddProperties().label = labelAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DbgLabelOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getLabelAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("label"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DbgLabelOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::DbgValueOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DbgValueOpGenericAdaptorBase::DbgValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.dbg.value", odsAttrs.getContext()); +} + +DbgValueOpGenericAdaptorBase::DbgValueOpGenericAdaptorBase(DbgValueOp op) : DbgValueOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DbgValueOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DbgValueOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::DILocalVariableAttr DbgValueOpGenericAdaptorBase::getVarInfoAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(getProperties().varInfo); + return attr; +} + +::mlir::LLVM::DILocalVariableAttr DbgValueOpGenericAdaptorBase::getVarInfo() { + auto attr = getVarInfoAttr(); + return ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(attr); +} + +} // namespace detail +DbgValueOpAdaptor::DbgValueOpAdaptor(DbgValueOp op) : DbgValueOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DbgValueOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_varInfo = getProperties().varInfo; (void)tblgen_varInfo; + if (!tblgen_varInfo) return emitError(loc, "'llvm.intr.dbg.value' op ""requires attribute 'varInfo'"); + + if (tblgen_varInfo && !((::llvm::isa<::mlir::LLVM::DILocalVariableAttr>(tblgen_varInfo)))) + return emitError(loc, "'llvm.intr.dbg.value' op ""attribute 'varInfo' failed to satisfy constraint: "); + return ::mlir::success(); +} + +std::pair DbgValueOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DbgValueOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DbgValueOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &DbgValueOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair DbgValueOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DbgValueOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult DbgValueOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.varInfo; + auto attr = dict.get("varInfo"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for varInfo in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `varInfo` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute DbgValueOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.varInfo; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("varInfo", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DbgValueOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.varInfo.getAsOpaquePointer())); +} + +std::optional DbgValueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "varInfo") + return prop.varInfo; + return std::nullopt; +} + +void DbgValueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "varInfo") { + prop.varInfo = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void DbgValueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.varInfo) attrs.append("varInfo", prop.varInfo); +} + +::mlir::LogicalResult DbgValueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getVarInfoAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps2(attr, "varInfo", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DbgValueOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.varInfo))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DbgValueOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.varInfo); +} + +::mlir::LLVM::DILocalVariableAttr DbgValueOp::getVarInfoAttr() { + return ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(getProperties().varInfo); +} + +::mlir::LLVM::DILocalVariableAttr DbgValueOp::getVarInfo() { + auto attr = getVarInfoAttr(); + return ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(attr); +} + +void DbgValueOp::setVarInfoAttr(::mlir::LLVM::DILocalVariableAttr attr) { + (*this)->setAttr(getVarInfoAttrName(), attr); +} + +void DbgValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::LLVM::DILocalVariableAttr varInfo) { + odsState.addOperands(value); + odsState.getOrAddProperties().varInfo = varInfo; +} + +void DbgValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::LLVM::DILocalVariableAttr varInfo) { + odsState.addOperands(value); + odsState.getOrAddProperties().varInfo = varInfo; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DbgValueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DbgValueOp::verifyInvariantsImpl() { + auto tblgen_varInfo = getProperties().varInfo; (void)tblgen_varInfo; + if (!tblgen_varInfo) return emitOpError("requires attribute 'varInfo'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps2(*this, tblgen_varInfo, "varInfo"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DbgValueOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DbgValueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::LLVM::DILocalVariableAttr varInfoAttr; + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + if (parser.parseAttribute(varInfoAttr, ::mlir::Type{})) + return ::mlir::failure(); + if (varInfoAttr) result.getOrAddProperties().varInfo = varInfoAttr; + if (parser.parseEqual()) + return ::mlir::failure(); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(valueRawTypes[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DbgValueOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttribute(getVarInfoAttr()); + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getValue().getType(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("varInfo"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DbgValueOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::DebugTrap definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DebugTrapGenericAdaptorBase::DebugTrapGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.debugtrap", odsAttrs.getContext()); +} + +DebugTrapGenericAdaptorBase::DebugTrapGenericAdaptorBase(DebugTrap op) : DebugTrapGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DebugTrapGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DebugTrapGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DebugTrapAdaptor::DebugTrapAdaptor(DebugTrap op) : DebugTrapGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DebugTrapAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DebugTrap::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DebugTrap::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair DebugTrap::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DebugTrap::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void DebugTrap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void DebugTrap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DebugTrap::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DebugTrap::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult DebugTrap::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DebugTrap) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::EhTypeidForOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +EhTypeidForOpGenericAdaptorBase::EhTypeidForOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.eh.typeid.for", odsAttrs.getContext()); +} + +EhTypeidForOpGenericAdaptorBase::EhTypeidForOpGenericAdaptorBase(EhTypeidForOp op) : EhTypeidForOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair EhTypeidForOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr EhTypeidForOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +EhTypeidForOpAdaptor::EhTypeidForOpAdaptor(EhTypeidForOp op) : EhTypeidForOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult EhTypeidForOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair EhTypeidForOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range EhTypeidForOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value EhTypeidForOp::getTypeInfo() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &EhTypeidForOp::getTypeInfoMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair EhTypeidForOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range EhTypeidForOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value EhTypeidForOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void EhTypeidForOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value type_info) { + odsState.addOperands(type_info); + odsState.addTypes(res); +} + +void EhTypeidForOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value type_info) { + odsState.addOperands(type_info); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void EhTypeidForOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult EhTypeidForOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult EhTypeidForOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult EhTypeidForOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand type_infoRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> type_infoOperands(type_infoRawOperands); ::llvm::SMLoc type_infoOperandsLoc; + (void)type_infoOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + type_infoOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(type_infoRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(type_infoOperands, allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void EhTypeidForOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTypeInfo(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::EhTypeidForOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Exp2Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Exp2OpGenericAdaptorBase::Exp2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.exp2", odsAttrs.getContext()); +} + +Exp2OpGenericAdaptorBase::Exp2OpGenericAdaptorBase(Exp2Op op) : Exp2OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Exp2OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Exp2OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr Exp2OpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags Exp2OpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +Exp2OpAdaptor::Exp2OpAdaptor(Exp2Op op) : Exp2OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Exp2OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.exp2' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair Exp2Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Exp2Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Exp2Op::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Exp2Op::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Exp2Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Exp2Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Exp2Op::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Exp2Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Exp2Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Exp2Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional Exp2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void Exp2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Exp2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult Exp2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Exp2Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Exp2Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr Exp2Op::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags Exp2Op::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void Exp2Op::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void Exp2Op::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Exp2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Exp2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Exp2Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Exp2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Exp2Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult Exp2Op::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Exp2Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Exp2Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Exp2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Exp2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void Exp2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::Exp2Op) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExpOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExpOpGenericAdaptorBase::ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.exp", odsAttrs.getContext()); +} + +ExpOpGenericAdaptorBase::ExpOpGenericAdaptorBase(ExpOp op) : ExpOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExpOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExpOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr ExpOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags ExpOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +ExpOpAdaptor::ExpOpAdaptor(ExpOp op) : ExpOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExpOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.exp' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair ExpOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExpOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExpOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExpOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExpOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExpOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExpOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ExpOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ExpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExpOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional ExpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void ExpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ExpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult ExpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr ExpOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags ExpOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void ExpOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void ExpOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void ExpOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult ExpOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ExpOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ExpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void ExpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExpOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExpectOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExpectOpGenericAdaptorBase::ExpectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.expect", odsAttrs.getContext()); +} + +ExpectOpGenericAdaptorBase::ExpectOpGenericAdaptorBase(ExpectOp op) : ExpectOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExpectOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExpectOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ExpectOpAdaptor::ExpectOpAdaptor(ExpectOp op) : ExpectOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExpectOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ExpectOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExpectOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> ExpectOp::getVal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ExpectOp::getExpected() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ExpectOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ExpectOp::getExpectedMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExpectOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExpectOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExpectOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ExpectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value expected) { + odsState.addOperands(val); + odsState.addOperands(expected); + odsState.addTypes(res); +} + +void ExpectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value expected) { + odsState.addOperands(val); + odsState.addOperands(expected); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpectOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value expected) { + odsState.addOperands(val); + odsState.addOperands(expected); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ExpectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpectOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ExpectOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpectOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ExpectOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ExpectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(valRawOperands); ::llvm::SMLoc valOperandsLoc; + (void)valOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand expectedRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> expectedOperands(expectedRawOperands); ::llvm::SMLoc expectedOperandsLoc; + (void)expectedOperandsLoc; + ::mlir::Type valRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes); + + valOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + expectedOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(expectedRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valRawTypes[0] = type; + } + result.addTypes(valTypes[0]); + if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(expectedOperands, valTypes[0], expectedOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpectOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getVal(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getExpected(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVal().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExpectOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExpectOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExpectWithProbabilityOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExpectWithProbabilityOpGenericAdaptorBase::ExpectWithProbabilityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.expect.with.probability", odsAttrs.getContext()); +} + +ExpectWithProbabilityOpGenericAdaptorBase::ExpectWithProbabilityOpGenericAdaptorBase(ExpectWithProbabilityOp op) : ExpectWithProbabilityOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExpectWithProbabilityOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExpectWithProbabilityOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::FloatAttr ExpectWithProbabilityOpGenericAdaptorBase::getProbAttr() { + auto attr = ::llvm::cast<::mlir::FloatAttr>(getProperties().prob); + return attr; +} + +::llvm::APFloat ExpectWithProbabilityOpGenericAdaptorBase::getProb() { + auto attr = getProbAttr(); + return attr.getValue(); +} + +} // namespace detail +ExpectWithProbabilityOpAdaptor::ExpectWithProbabilityOpAdaptor(ExpectWithProbabilityOp op) : ExpectWithProbabilityOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExpectWithProbabilityOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_prob = getProperties().prob; (void)tblgen_prob; + if (!tblgen_prob) return emitError(loc, "'llvm.intr.expect.with.probability' op ""requires attribute 'prob'"); + + if (tblgen_prob && !(((::llvm::isa<::mlir::FloatAttr>(tblgen_prob))) && ((::llvm::cast<::mlir::FloatAttr>(tblgen_prob).getType().isF64())))) + return emitError(loc, "'llvm.intr.expect.with.probability' op ""attribute 'prob' failed to satisfy constraint: 64-bit float attribute"); + return ::mlir::success(); +} + +std::pair ExpectWithProbabilityOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExpectWithProbabilityOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> ExpectWithProbabilityOp::getVal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ExpectWithProbabilityOp::getExpected() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ExpectWithProbabilityOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ExpectWithProbabilityOp::getExpectedMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExpectWithProbabilityOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExpectWithProbabilityOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExpectWithProbabilityOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ExpectWithProbabilityOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.prob; + auto attr = dict.get("prob"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for prob in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `prob` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ExpectWithProbabilityOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.prob; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("prob", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExpectWithProbabilityOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.prob.getAsOpaquePointer())); +} + +std::optional ExpectWithProbabilityOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "prob") + return prop.prob; + return std::nullopt; +} + +void ExpectWithProbabilityOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "prob") { + prop.prob = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ExpectWithProbabilityOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.prob) attrs.append("prob", prop.prob); +} + +::mlir::LogicalResult ExpectWithProbabilityOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getProbAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps4(attr, "prob", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpectWithProbabilityOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.prob))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpectWithProbabilityOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.prob); +} + +::mlir::FloatAttr ExpectWithProbabilityOp::getProbAttr() { + return ::llvm::cast<::mlir::FloatAttr>(getProperties().prob); +} + +::llvm::APFloat ExpectWithProbabilityOp::getProb() { + auto attr = getProbAttr(); + return attr.getValue(); +} + +void ExpectWithProbabilityOp::setProbAttr(::mlir::FloatAttr attr) { + (*this)->setAttr(getProbAttrName(), attr); +} + +void ExpectWithProbabilityOp::setProb(::llvm::APFloat attrValue) { + (*this)->setAttr(getProbAttrName(), ::mlir::Builder((*this)->getContext()).getFloatAttr(::mlir::Builder((*this)->getContext()).getF64Type(), attrValue)); +} + +void ExpectWithProbabilityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value expected, ::mlir::FloatAttr prob) { + odsState.addOperands(val); + odsState.addOperands(expected); + odsState.getOrAddProperties().prob = prob; + odsState.addTypes(res); +} + +void ExpectWithProbabilityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value expected, ::mlir::FloatAttr prob) { + odsState.addOperands(val); + odsState.addOperands(expected); + odsState.getOrAddProperties().prob = prob; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpectWithProbabilityOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpectWithProbabilityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value expected, ::mlir::FloatAttr prob) { + odsState.addOperands(val); + odsState.addOperands(expected); + odsState.getOrAddProperties().prob = prob; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpectWithProbabilityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value expected, ::llvm::APFloat prob) { + odsState.addOperands(val); + odsState.addOperands(expected); + odsState.getOrAddProperties().prob = odsBuilder.getFloatAttr(odsBuilder.getF64Type(), prob); + odsState.addTypes(res); +} + +void ExpectWithProbabilityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value expected, ::llvm::APFloat prob) { + odsState.addOperands(val); + odsState.addOperands(expected); + odsState.getOrAddProperties().prob = odsBuilder.getFloatAttr(odsBuilder.getF64Type(), prob); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpectWithProbabilityOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpectWithProbabilityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value expected, ::llvm::APFloat prob) { + odsState.addOperands(val); + odsState.addOperands(expected); + odsState.getOrAddProperties().prob = odsBuilder.getFloatAttr(odsBuilder.getF64Type(), prob); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpectWithProbabilityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ExpectWithProbabilityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpectWithProbabilityOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ExpectWithProbabilityOp::verifyInvariantsImpl() { + auto tblgen_prob = getProperties().prob; (void)tblgen_prob; + if (!tblgen_prob) return emitOpError("requires attribute 'prob'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps4(*this, tblgen_prob, "prob"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {val, expected, res} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult ExpectWithProbabilityOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ExpectWithProbabilityOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[1].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ExpectWithProbabilityOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(valRawOperands); ::llvm::SMLoc valOperandsLoc; + (void)valOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand expectedRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> expectedOperands(expectedRawOperands); ::llvm::SMLoc expectedOperandsLoc; + (void)expectedOperandsLoc; + ::mlir::FloatAttr probAttr; + ::mlir::Type valRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes); + + valOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + expectedOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(expectedRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(probAttr, parser.getBuilder().getF64Type())) { + return ::mlir::failure(); + } + if (probAttr) result.getOrAddProperties().prob = probAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valRawTypes[0] = type; + } + result.addTypes(valTypes[0]); + if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(expectedOperands, valTypes[0], expectedOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpectWithProbabilityOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getVal(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getExpected(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getProbAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("prob"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVal().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExpectWithProbabilityOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExpectWithProbabilityOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FAbsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FAbsOpGenericAdaptorBase::FAbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.fabs", odsAttrs.getContext()); +} + +FAbsOpGenericAdaptorBase::FAbsOpGenericAdaptorBase(FAbsOp op) : FAbsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FAbsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FAbsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FAbsOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FAbsOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FAbsOpAdaptor::FAbsOpAdaptor(FAbsOp op) : FAbsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FAbsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.fabs' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FAbsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FAbsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FAbsOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FAbsOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FAbsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FAbsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FAbsOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FAbsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FAbsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FAbsOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FAbsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FAbsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FAbsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FAbsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FAbsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FAbsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FAbsOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FAbsOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FAbsOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FAbsOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FAbsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FAbsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FAbsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FAbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FAbsOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FAbsOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FAbsOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FAbsOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FAbsOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FAbsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FAbsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void FAbsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FAbsOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FCeilOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FCeilOpGenericAdaptorBase::FCeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.ceil", odsAttrs.getContext()); +} + +FCeilOpGenericAdaptorBase::FCeilOpGenericAdaptorBase(FCeilOp op) : FCeilOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FCeilOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FCeilOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FCeilOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FCeilOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FCeilOpAdaptor::FCeilOpAdaptor(FCeilOp op) : FCeilOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FCeilOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.ceil' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FCeilOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FCeilOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FCeilOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FCeilOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FCeilOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FCeilOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FCeilOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FCeilOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FCeilOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FCeilOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FCeilOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FCeilOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FCeilOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FCeilOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FCeilOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FCeilOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FCeilOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FCeilOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FCeilOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FCeilOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FCeilOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FCeilOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FCeilOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FCeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FCeilOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FCeilOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FCeilOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FCeilOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FCeilOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FCeilOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FCeilOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void FCeilOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FCeilOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FFloorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FFloorOpGenericAdaptorBase::FFloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.floor", odsAttrs.getContext()); +} + +FFloorOpGenericAdaptorBase::FFloorOpGenericAdaptorBase(FFloorOp op) : FFloorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FFloorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FFloorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FFloorOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FFloorOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FFloorOpAdaptor::FFloorOpAdaptor(FFloorOp op) : FFloorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FFloorOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.floor' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FFloorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FFloorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FFloorOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FFloorOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FFloorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FFloorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FFloorOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FFloorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FFloorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FFloorOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FFloorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FFloorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FFloorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FFloorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FFloorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FFloorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FFloorOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FFloorOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FFloorOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FFloorOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FFloorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FFloorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FFloorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FFloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FFloorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FFloorOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FFloorOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FFloorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FFloorOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FFloorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FFloorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void FFloorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FFloorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FMAOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FMAOpGenericAdaptorBase::FMAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.fma", odsAttrs.getContext()); +} + +FMAOpGenericAdaptorBase::FMAOpGenericAdaptorBase(FMAOp op) : FMAOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FMAOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FMAOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FMAOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FMAOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FMAOpAdaptor::FMAOpAdaptor(FMAOp op) : FMAOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FMAOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.fma' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FMAOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FMAOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FMAOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FMAOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value FMAOp::getC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &FMAOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FMAOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FMAOp::getCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair FMAOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FMAOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FMAOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FMAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FMAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FMAOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FMAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FMAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FMAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FMAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FMAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FMAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FMAOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FMAOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FMAOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FMAOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FMAOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FMAOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FMAOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FMAOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FMAOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FMAOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FMAOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FMAOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FMAOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void FMAOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FMAOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FMulAddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FMulAddOpGenericAdaptorBase::FMulAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.fmuladd", odsAttrs.getContext()); +} + +FMulAddOpGenericAdaptorBase::FMulAddOpGenericAdaptorBase(FMulAddOp op) : FMulAddOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FMulAddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FMulAddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FMulAddOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FMulAddOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FMulAddOpAdaptor::FMulAddOpAdaptor(FMulAddOp op) : FMulAddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FMulAddOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.fmuladd' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FMulAddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FMulAddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FMulAddOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FMulAddOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value FMulAddOp::getC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &FMulAddOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FMulAddOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FMulAddOp::getCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair FMulAddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FMulAddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FMulAddOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FMulAddOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FMulAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FMulAddOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FMulAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FMulAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FMulAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FMulAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FMulAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FMulAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FMulAddOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FMulAddOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FMulAddOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FMulAddOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FMulAddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FMulAddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FMulAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FMulAddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FMulAddOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FMulAddOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FMulAddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FMulAddOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FMulAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FMulAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void FMulAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FMulAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FTruncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FTruncOpGenericAdaptorBase::FTruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.trunc", odsAttrs.getContext()); +} + +FTruncOpGenericAdaptorBase::FTruncOpGenericAdaptorBase(FTruncOp op) : FTruncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FTruncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FTruncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FTruncOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FTruncOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FTruncOpAdaptor::FTruncOpAdaptor(FTruncOp op) : FTruncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FTruncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.trunc' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FTruncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FTruncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FTruncOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FTruncOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FTruncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FTruncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FTruncOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FTruncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FTruncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FTruncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FTruncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FTruncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FTruncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FTruncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FTruncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FTruncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FTruncOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FTruncOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FTruncOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FTruncOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FTruncOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FTruncOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FTruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FTruncOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FTruncOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FTruncOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FTruncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FTruncOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FTruncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FTruncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void FTruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FTruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FshlOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FshlOpGenericAdaptorBase::FshlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.fshl", odsAttrs.getContext()); +} + +FshlOpGenericAdaptorBase::FshlOpGenericAdaptorBase(FshlOp op) : FshlOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FshlOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FshlOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FshlOpAdaptor::FshlOpAdaptor(FshlOp op) : FshlOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FshlOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FshlOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FshlOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FshlOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FshlOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value FshlOp::getC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &FshlOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FshlOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FshlOp::getCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair FshlOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FshlOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FshlOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FshlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.addTypes(res); +} + +void FshlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FshlOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FshlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FshlOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FshlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FshlOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult FshlOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FshlOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FshlOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FshlOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FshlOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void FshlOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FshlOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FshrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FshrOpGenericAdaptorBase::FshrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.fshr", odsAttrs.getContext()); +} + +FshrOpGenericAdaptorBase::FshrOpGenericAdaptorBase(FshrOp op) : FshrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FshrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FshrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FshrOpAdaptor::FshrOpAdaptor(FshrOp op) : FshrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FshrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FshrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FshrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FshrOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FshrOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value FshrOp::getC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &FshrOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FshrOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FshrOp::getCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair FshrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FshrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FshrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FshrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.addTypes(res); +} + +void FshrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FshrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FshrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FshrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FshrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FshrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult FshrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FshrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FshrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FshrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FshrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void FshrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FshrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GetActiveLaneMaskOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetActiveLaneMaskOpGenericAdaptorBase::GetActiveLaneMaskOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.get.active.lane.mask", odsAttrs.getContext()); +} + +GetActiveLaneMaskOpGenericAdaptorBase::GetActiveLaneMaskOpGenericAdaptorBase(GetActiveLaneMaskOp op) : GetActiveLaneMaskOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetActiveLaneMaskOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetActiveLaneMaskOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GetActiveLaneMaskOpAdaptor::GetActiveLaneMaskOpAdaptor(GetActiveLaneMaskOp op) : GetActiveLaneMaskOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetActiveLaneMaskOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GetActiveLaneMaskOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetActiveLaneMaskOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> GetActiveLaneMaskOp::getBase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> GetActiveLaneMaskOp::getN() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &GetActiveLaneMaskOp::getBaseMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &GetActiveLaneMaskOp::getNMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetActiveLaneMaskOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetActiveLaneMaskOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GetActiveLaneMaskOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GetActiveLaneMaskOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value base, ::mlir::Value n) { + odsState.addOperands(base); + odsState.addOperands(n); + odsState.addTypes(res); +} + +void GetActiveLaneMaskOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value n) { + odsState.addOperands(base); + odsState.addOperands(n); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetActiveLaneMaskOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetActiveLaneMaskOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetActiveLaneMaskOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetActiveLaneMaskOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand baseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(baseRawOperands); ::llvm::SMLoc baseOperandsLoc; + (void)baseOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand nRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> nOperands(nRawOperands); ::llvm::SMLoc nOperandsLoc; + (void)nOperandsLoc; + ::mlir::Type baseRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> baseTypes(baseRawTypes); + ::mlir::Type nRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> nTypes(nRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + baseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(baseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + nOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(nRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + baseRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + nRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(nOperands, nTypes, nOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetActiveLaneMaskOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBase(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getN(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBase().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getN().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GetActiveLaneMaskOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::GetActiveLaneMaskOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::IsConstantOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +IsConstantOpGenericAdaptorBase::IsConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.is.constant", odsAttrs.getContext()); +} + +IsConstantOpGenericAdaptorBase::IsConstantOpGenericAdaptorBase(IsConstantOp op) : IsConstantOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair IsConstantOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr IsConstantOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +IsConstantOpAdaptor::IsConstantOpAdaptor(IsConstantOp op) : IsConstantOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult IsConstantOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair IsConstantOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range IsConstantOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IsConstantOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &IsConstantOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair IsConstantOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range IsConstantOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> IsConstantOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +void IsConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val) { + odsState.addOperands(val); + odsState.addTypes(res); +} + +void IsConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val) { + odsState.addOperands(val); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(IsConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void IsConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val) { + odsState.addOperands(val); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IsConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void IsConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(IsConstantOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult IsConstantOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult IsConstantOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult IsConstantOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(1); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +void IsConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::IsConstantOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::IsFPClass definitions +//===----------------------------------------------------------------------===// + +namespace detail { +IsFPClassGenericAdaptorBase::IsFPClassGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.is.fpclass", odsAttrs.getContext()); +} + +IsFPClassGenericAdaptorBase::IsFPClassGenericAdaptorBase(IsFPClass op) : IsFPClassGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair IsFPClassGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr IsFPClassGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr IsFPClassGenericAdaptorBase::getBitAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().bit); + return attr; +} + +uint32_t IsFPClassGenericAdaptorBase::getBit() { + auto attr = getBitAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +IsFPClassAdaptor::IsFPClassAdaptor(IsFPClass op) : IsFPClassGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult IsFPClassAdaptor::verify(::mlir::Location loc) { + auto tblgen_bit = getProperties().bit; (void)tblgen_bit; + if (!tblgen_bit) return emitError(loc, "'llvm.intr.is.fpclass' op ""requires attribute 'bit'"); + + if (tblgen_bit && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_bit))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_bit).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.is.fpclass' op ""attribute 'bit' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair IsFPClass::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range IsFPClass::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IsFPClass::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &IsFPClass::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair IsFPClass::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range IsFPClass::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IsFPClass::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult IsFPClass::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.bit; + auto attr = dict.get("bit"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for bit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `bit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute IsFPClass::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.bit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("bit", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code IsFPClass::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.bit.getAsOpaquePointer())); +} + +std::optional IsFPClass::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "bit") + return prop.bit; + return std::nullopt; +} + +void IsFPClass::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "bit") { + prop.bit = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void IsFPClass::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.bit) attrs.append("bit", prop.bit); +} + +::mlir::LogicalResult IsFPClass::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "bit", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult IsFPClass::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.bit))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void IsFPClass::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.bit); +} + +::mlir::IntegerAttr IsFPClass::getBitAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().bit); +} + +uint32_t IsFPClass::getBit() { + auto attr = getBitAttr(); + return attr.getValue().getZExtValue(); +} + +void IsFPClass::setBitAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getBitAttrName(), attr); +} + +void IsFPClass::setBit(uint32_t attrValue) { + (*this)->setAttr(getBitAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void IsFPClass::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::IntegerAttr bit) { + odsState.addOperands(in); + odsState.getOrAddProperties().bit = bit; + odsState.addTypes(res); +} + +void IsFPClass::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::IntegerAttr bit) { + odsState.addOperands(in); + odsState.getOrAddProperties().bit = bit; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IsFPClass::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, uint32_t bit) { + odsState.addOperands(in); + odsState.getOrAddProperties().bit = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), bit); + odsState.addTypes(res); +} + +void IsFPClass::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, uint32_t bit) { + odsState.addOperands(in); + odsState.getOrAddProperties().bit = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), bit); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IsFPClass::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult IsFPClass::verifyInvariantsImpl() { + auto tblgen_bit = getProperties().bit; (void)tblgen_bit; + if (!tblgen_bit) return emitOpError("requires attribute 'bit'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_bit, "bit"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult IsFPClass::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void IsFPClass::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::IsFPClass) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LifetimeEndOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LifetimeEndOpGenericAdaptorBase::LifetimeEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.lifetime.end", odsAttrs.getContext()); +} + +LifetimeEndOpGenericAdaptorBase::LifetimeEndOpGenericAdaptorBase(LifetimeEndOp op) : LifetimeEndOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LifetimeEndOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LifetimeEndOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr LifetimeEndOpGenericAdaptorBase::getSizeAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().size); + return attr; +} + +uint64_t LifetimeEndOpGenericAdaptorBase::getSize() { + auto attr = getSizeAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +LifetimeEndOpAdaptor::LifetimeEndOpAdaptor(LifetimeEndOp op) : LifetimeEndOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LifetimeEndOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_size = getProperties().size; (void)tblgen_size; + if (!tblgen_size) return emitError(loc, "'llvm.intr.lifetime.end' op ""requires attribute 'size'"); + + if (tblgen_size && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_size))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_size).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.intr.lifetime.end' op ""attribute 'size' failed to satisfy constraint: 64-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair LifetimeEndOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LifetimeEndOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> LifetimeEndOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LifetimeEndOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LifetimeEndOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LifetimeEndOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult LifetimeEndOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.size; + auto attr = dict.get("size"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for size in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `size` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LifetimeEndOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.size; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("size", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LifetimeEndOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.size.getAsOpaquePointer())); +} + +std::optional LifetimeEndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "size") + return prop.size; + return std::nullopt; +} + +void LifetimeEndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "size") { + prop.size = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LifetimeEndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.size) attrs.append("size", prop.size); +} + +::mlir::LogicalResult LifetimeEndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getSizeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps6(attr, "size", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LifetimeEndOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.size))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LifetimeEndOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.size); +} + +::mlir::IntegerAttr LifetimeEndOp::getSizeAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().size); +} + +uint64_t LifetimeEndOp::getSize() { + auto attr = getSizeAttr(); + return attr.getValue().getZExtValue(); +} + +void LifetimeEndOp::setSizeAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getSizeAttrName(), attr); +} + +void LifetimeEndOp::setSize(uint64_t attrValue) { + (*this)->setAttr(getSizeAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue)); +} + +void LifetimeEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr size, ::mlir::Value ptr) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().size = size; +} + +void LifetimeEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr size, ::mlir::Value ptr) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().size = size; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LifetimeEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t size, ::mlir::Value ptr) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().size = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), size); +} + +void LifetimeEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t size, ::mlir::Value ptr) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().size = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), size); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LifetimeEndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LifetimeEndOp::verifyInvariantsImpl() { + auto tblgen_size = getProperties().size; (void)tblgen_size; + if (!tblgen_size) return emitOpError("requires attribute 'size'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps6(*this, tblgen_size, "size"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LifetimeEndOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult LifetimeEndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr sizeAttr; + ::mlir::OpAsmParser::UnresolvedOperand ptrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(ptrRawOperands); ::llvm::SMLoc ptrOperandsLoc; + (void)ptrOperandsLoc; + ::mlir::Type ptrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> ptrTypes(ptrRawTypes); + + if (parser.parseCustomAttributeWithFallback(sizeAttr, parser.getBuilder().getIntegerType(64))) { + return ::mlir::failure(); + } + if (sizeAttr) result.getOrAddProperties().size = sizeAttr; + if (parser.parseComma()) + return ::mlir::failure(); + + ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ptrRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(ptrRawTypes[0])) + return ::mlir::failure(); + if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LifetimeEndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getSizeAttr()); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getPtr(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("size"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getPtr().getType(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LifetimeEndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LifetimeStartOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LifetimeStartOpGenericAdaptorBase::LifetimeStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.lifetime.start", odsAttrs.getContext()); +} + +LifetimeStartOpGenericAdaptorBase::LifetimeStartOpGenericAdaptorBase(LifetimeStartOp op) : LifetimeStartOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LifetimeStartOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LifetimeStartOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr LifetimeStartOpGenericAdaptorBase::getSizeAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().size); + return attr; +} + +uint64_t LifetimeStartOpGenericAdaptorBase::getSize() { + auto attr = getSizeAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +LifetimeStartOpAdaptor::LifetimeStartOpAdaptor(LifetimeStartOp op) : LifetimeStartOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LifetimeStartOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_size = getProperties().size; (void)tblgen_size; + if (!tblgen_size) return emitError(loc, "'llvm.intr.lifetime.start' op ""requires attribute 'size'"); + + if (tblgen_size && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_size))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_size).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.intr.lifetime.start' op ""attribute 'size' failed to satisfy constraint: 64-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair LifetimeStartOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LifetimeStartOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> LifetimeStartOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LifetimeStartOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LifetimeStartOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LifetimeStartOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult LifetimeStartOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.size; + auto attr = dict.get("size"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for size in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `size` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LifetimeStartOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.size; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("size", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LifetimeStartOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.size.getAsOpaquePointer())); +} + +std::optional LifetimeStartOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "size") + return prop.size; + return std::nullopt; +} + +void LifetimeStartOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "size") { + prop.size = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LifetimeStartOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.size) attrs.append("size", prop.size); +} + +::mlir::LogicalResult LifetimeStartOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getSizeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps6(attr, "size", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LifetimeStartOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.size))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LifetimeStartOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.size); +} + +::mlir::IntegerAttr LifetimeStartOp::getSizeAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().size); +} + +uint64_t LifetimeStartOp::getSize() { + auto attr = getSizeAttr(); + return attr.getValue().getZExtValue(); +} + +void LifetimeStartOp::setSizeAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getSizeAttrName(), attr); +} + +void LifetimeStartOp::setSize(uint64_t attrValue) { + (*this)->setAttr(getSizeAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue)); +} + +void LifetimeStartOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr size, ::mlir::Value ptr) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().size = size; +} + +void LifetimeStartOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr size, ::mlir::Value ptr) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().size = size; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LifetimeStartOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t size, ::mlir::Value ptr) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().size = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), size); +} + +void LifetimeStartOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t size, ::mlir::Value ptr) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().size = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), size); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LifetimeStartOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LifetimeStartOp::verifyInvariantsImpl() { + auto tblgen_size = getProperties().size; (void)tblgen_size; + if (!tblgen_size) return emitOpError("requires attribute 'size'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps6(*this, tblgen_size, "size"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LifetimeStartOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult LifetimeStartOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr sizeAttr; + ::mlir::OpAsmParser::UnresolvedOperand ptrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(ptrRawOperands); ::llvm::SMLoc ptrOperandsLoc; + (void)ptrOperandsLoc; + ::mlir::Type ptrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> ptrTypes(ptrRawTypes); + + if (parser.parseCustomAttributeWithFallback(sizeAttr, parser.getBuilder().getIntegerType(64))) { + return ::mlir::failure(); + } + if (sizeAttr) result.getOrAddProperties().size = sizeAttr; + if (parser.parseComma()) + return ::mlir::failure(); + + ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ptrRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(ptrRawTypes[0])) + return ::mlir::failure(); + if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LifetimeStartOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getSizeAttr()); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getPtr(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("size"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getPtr().getType(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LifetimeStartOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LlrintOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LlrintOpGenericAdaptorBase::LlrintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.llrint", odsAttrs.getContext()); +} + +LlrintOpGenericAdaptorBase::LlrintOpGenericAdaptorBase(LlrintOp op) : LlrintOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LlrintOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LlrintOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +LlrintOpAdaptor::LlrintOpAdaptor(LlrintOp op) : LlrintOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LlrintOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LlrintOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LlrintOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LlrintOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LlrintOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LlrintOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LlrintOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LlrintOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void LlrintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val) { + odsState.addOperands(val); + odsState.addTypes(res); +} + +void LlrintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val) { + odsState.addOperands(val); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LlrintOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LlrintOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LlrintOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult LlrintOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LlrintOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void LlrintOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LlrintOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LlroundOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LlroundOpGenericAdaptorBase::LlroundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.llround", odsAttrs.getContext()); +} + +LlroundOpGenericAdaptorBase::LlroundOpGenericAdaptorBase(LlroundOp op) : LlroundOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LlroundOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LlroundOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +LlroundOpAdaptor::LlroundOpAdaptor(LlroundOp op) : LlroundOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LlroundOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LlroundOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LlroundOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LlroundOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LlroundOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LlroundOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LlroundOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LlroundOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void LlroundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val) { + odsState.addOperands(val); + odsState.addTypes(res); +} + +void LlroundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val) { + odsState.addOperands(val); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LlroundOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LlroundOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LlroundOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult LlroundOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LlroundOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void LlroundOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LlroundOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Log10Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Log10OpGenericAdaptorBase::Log10OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.log10", odsAttrs.getContext()); +} + +Log10OpGenericAdaptorBase::Log10OpGenericAdaptorBase(Log10Op op) : Log10OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Log10OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Log10OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr Log10OpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags Log10OpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +Log10OpAdaptor::Log10OpAdaptor(Log10Op op) : Log10OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Log10OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.log10' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair Log10Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Log10Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log10Op::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Log10Op::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Log10Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Log10Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log10Op::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Log10Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Log10Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Log10Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional Log10Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void Log10Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Log10Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult Log10Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log10Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log10Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr Log10Op::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags Log10Op::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void Log10Op::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void Log10Op::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log10Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log10Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log10Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log10Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Log10Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult Log10Op::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log10Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Log10Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Log10Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log10Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void Log10Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::Log10Op) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Log2Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Log2OpGenericAdaptorBase::Log2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.log2", odsAttrs.getContext()); +} + +Log2OpGenericAdaptorBase::Log2OpGenericAdaptorBase(Log2Op op) : Log2OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Log2OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Log2OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr Log2OpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags Log2OpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +Log2OpAdaptor::Log2OpAdaptor(Log2Op op) : Log2OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Log2OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.log2' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair Log2Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Log2Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log2Op::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Log2Op::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Log2Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Log2Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log2Op::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Log2Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Log2Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Log2Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional Log2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void Log2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Log2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult Log2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log2Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log2Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr Log2Op::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags Log2Op::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void Log2Op::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void Log2Op::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log2Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Log2Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult Log2Op::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log2Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Log2Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Log2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void Log2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::Log2Op) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LogOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LogOpGenericAdaptorBase::LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.log", odsAttrs.getContext()); +} + +LogOpGenericAdaptorBase::LogOpGenericAdaptorBase(LogOp op) : LogOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LogOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LogOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr LogOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags LogOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +LogOpAdaptor::LogOpAdaptor(LogOp op) : LogOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LogOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.log' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair LogOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LogOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LogOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LogOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LogOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LogOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LogOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult LogOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LogOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LogOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional LogOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void LogOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LogOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult LogOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LogOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LogOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr LogOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags LogOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void LogOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void LogOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LogOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LogOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LogOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LogOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void LogOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult LogOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LogOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult LogOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult LogOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LogOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void LogOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LogOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LrintOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LrintOpGenericAdaptorBase::LrintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.lrint", odsAttrs.getContext()); +} + +LrintOpGenericAdaptorBase::LrintOpGenericAdaptorBase(LrintOp op) : LrintOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LrintOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LrintOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +LrintOpAdaptor::LrintOpAdaptor(LrintOp op) : LrintOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LrintOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LrintOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LrintOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LrintOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LrintOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LrintOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LrintOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LrintOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void LrintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val) { + odsState.addOperands(val); + odsState.addTypes(res); +} + +void LrintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val) { + odsState.addOperands(val); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LrintOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LrintOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LrintOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult LrintOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LrintOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void LrintOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LrintOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LroundOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LroundOpGenericAdaptorBase::LroundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.lround", odsAttrs.getContext()); +} + +LroundOpGenericAdaptorBase::LroundOpGenericAdaptorBase(LroundOp op) : LroundOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LroundOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LroundOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +LroundOpAdaptor::LroundOpAdaptor(LroundOp op) : LroundOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LroundOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LroundOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LroundOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LroundOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LroundOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LroundOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LroundOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LroundOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void LroundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val) { + odsState.addOperands(val); + odsState.addTypes(res); +} + +void LroundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val) { + odsState.addOperands(val); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LroundOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LroundOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LroundOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult LroundOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LroundOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void LroundOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LroundOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MaskedLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaskedLoadOpGenericAdaptorBase::MaskedLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.masked.load", odsAttrs.getContext()); +} + +MaskedLoadOpGenericAdaptorBase::MaskedLoadOpGenericAdaptorBase(MaskedLoadOp op) : MaskedLoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaskedLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr MaskedLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MaskedLoadOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +uint32_t MaskedLoadOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +MaskedLoadOpAdaptor::MaskedLoadOpAdaptor(MaskedLoadOp op) : MaskedLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaskedLoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitError(loc, "'llvm.intr.masked.load' op ""requires attribute 'alignment'"); + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.masked.load' op ""attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair MaskedLoadOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range MaskedLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MaskedLoadOp::getData() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value MaskedLoadOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range MaskedLoadOp::getPassThru() { + return getODSOperands(2); +} + +::mlir::OpOperand &MaskedLoadOp::getDataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaskedLoadOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange MaskedLoadOp::getPassThruMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair MaskedLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaskedLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaskedLoadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MaskedLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MaskedLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MaskedLoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer())); +} + +std::optional MaskedLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + return std::nullopt; +} + +void MaskedLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MaskedLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); +} + +::mlir::LogicalResult MaskedLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "alignment", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaskedLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.alignment))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaskedLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.alignment); +} + +::mlir::IntegerAttr MaskedLoadOp::getAlignmentAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); +} + +uint32_t MaskedLoadOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +void MaskedLoadOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void MaskedLoadOp::setAlignment(uint32_t attrValue) { + (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MaskedLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value data, ::mlir::Value mask, ::mlir::ValueRange pass_thru, ::mlir::IntegerAttr alignment) { + odsState.addOperands(data); + odsState.addOperands(mask); + odsState.addOperands(pass_thru); + odsState.getOrAddProperties().alignment = alignment; + odsState.addTypes(res); +} + +void MaskedLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value mask, ::mlir::ValueRange pass_thru, ::mlir::IntegerAttr alignment) { + odsState.addOperands(data); + odsState.addOperands(mask); + odsState.addOperands(pass_thru); + odsState.getOrAddProperties().alignment = alignment; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaskedLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value data, ::mlir::Value mask, ::mlir::ValueRange pass_thru, uint32_t alignment) { + odsState.addOperands(data); + odsState.addOperands(mask); + odsState.addOperands(pass_thru); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); + odsState.addTypes(res); +} + +void MaskedLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value mask, ::mlir::ValueRange pass_thru, uint32_t alignment) { + odsState.addOperands(data); + odsState.addOperands(mask); + odsState.addOperands(pass_thru); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaskedLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MaskedLoadOp::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitOpError("requires attribute 'alignment'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaskedLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MaskedLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaskedLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MaskedLoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MaskedStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaskedStoreOpGenericAdaptorBase::MaskedStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.masked.store", odsAttrs.getContext()); +} + +MaskedStoreOpGenericAdaptorBase::MaskedStoreOpGenericAdaptorBase(MaskedStoreOp op) : MaskedStoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaskedStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaskedStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MaskedStoreOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +uint32_t MaskedStoreOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +MaskedStoreOpAdaptor::MaskedStoreOpAdaptor(MaskedStoreOp op) : MaskedStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaskedStoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitError(loc, "'llvm.intr.masked.store' op ""requires attribute 'alignment'"); + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.masked.store' op ""attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair MaskedStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaskedStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaskedStoreOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MaskedStoreOp::getData() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::Value MaskedStoreOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MaskedStoreOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaskedStoreOp::getDataMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaskedStoreOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaskedStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaskedStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult MaskedStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MaskedStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MaskedStoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer())); +} + +std::optional MaskedStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + return std::nullopt; +} + +void MaskedStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MaskedStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); +} + +::mlir::LogicalResult MaskedStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "alignment", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaskedStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.alignment))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaskedStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.alignment); +} + +::mlir::IntegerAttr MaskedStoreOp::getAlignmentAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); +} + +uint32_t MaskedStoreOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +void MaskedStoreOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void MaskedStoreOp::setAlignment(uint32_t attrValue) { + (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MaskedStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + assert(isCompatibleType(resultType) && "result must be an LLVM type"); + assert(::llvm::isa(resultType) && + "for zero-result operands, only 'void' is accepted as result type"); + build(odsBuilder, odsState, operands, attributes); + +} + +void MaskedStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void MaskedStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value data, ::mlir::Value mask, ::mlir::IntegerAttr alignment) { + odsState.addOperands(value); + odsState.addOperands(data); + odsState.addOperands(mask); + odsState.getOrAddProperties().alignment = alignment; +} + +void MaskedStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value data, ::mlir::Value mask, ::mlir::IntegerAttr alignment) { + odsState.addOperands(value); + odsState.addOperands(data); + odsState.addOperands(mask); + odsState.getOrAddProperties().alignment = alignment; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaskedStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value data, ::mlir::Value mask, uint32_t alignment) { + odsState.addOperands(value); + odsState.addOperands(data); + odsState.addOperands(mask); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); +} + +void MaskedStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value data, ::mlir::Value mask, uint32_t alignment) { + odsState.addOperands(value); + odsState.addOperands(data); + odsState.addOperands(mask); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaskedStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MaskedStoreOp::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitOpError("requires attribute 'alignment'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaskedStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MaskedStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dataRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dataOperands(dataRawOperands); ::llvm::SMLoc dataOperandsLoc; + (void)dataOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type dataRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dataTypes(dataRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + dataOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dataRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + if (parser.parseType(dataRawTypes[0])) + return ::mlir::failure(); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataOperands, dataTypes, dataOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaskedStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getData(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMask(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + _odsPrinter << getData().getType(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MaskedStoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MatrixColumnMajorLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MatrixColumnMajorLoadOpGenericAdaptorBase::MatrixColumnMajorLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.matrix.column.major.load", odsAttrs.getContext()); +} + +MatrixColumnMajorLoadOpGenericAdaptorBase::MatrixColumnMajorLoadOpGenericAdaptorBase(MatrixColumnMajorLoadOp op) : MatrixColumnMajorLoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MatrixColumnMajorLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MatrixColumnMajorLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MatrixColumnMajorLoadOpGenericAdaptorBase::getIsVolatileAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); + return attr; +} + +bool MatrixColumnMajorLoadOpGenericAdaptorBase::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixColumnMajorLoadOpGenericAdaptorBase::getRowsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().rows); + return attr; +} + +uint32_t MatrixColumnMajorLoadOpGenericAdaptorBase::getRows() { + auto attr = getRowsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixColumnMajorLoadOpGenericAdaptorBase::getColumnsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().columns); + return attr; +} + +uint32_t MatrixColumnMajorLoadOpGenericAdaptorBase::getColumns() { + auto attr = getColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +MatrixColumnMajorLoadOpAdaptor::MatrixColumnMajorLoadOpAdaptor(MatrixColumnMajorLoadOp op) : MatrixColumnMajorLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MatrixColumnMajorLoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_columns = getProperties().columns; (void)tblgen_columns; + if (!tblgen_columns) return emitError(loc, "'llvm.intr.matrix.column.major.load' op ""requires attribute 'columns'"); + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitError(loc, "'llvm.intr.matrix.column.major.load' op ""requires attribute 'isVolatile'"); + auto tblgen_rows = getProperties().rows; (void)tblgen_rows; + if (!tblgen_rows) return emitError(loc, "'llvm.intr.matrix.column.major.load' op ""requires attribute 'rows'"); + + if (tblgen_isVolatile && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_isVolatile))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_isVolatile).getType().isSignlessInteger(1))))) + return emitError(loc, "'llvm.intr.matrix.column.major.load' op ""attribute 'isVolatile' failed to satisfy constraint: 1-bit signless integer attribute"); + + if (tblgen_rows && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_rows))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_rows).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.matrix.column.major.load' op ""attribute 'rows' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_columns && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_columns))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_columns).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.matrix.column.major.load' op ""attribute 'columns' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair MatrixColumnMajorLoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MatrixColumnMajorLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MatrixColumnMajorLoadOp::getData() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MatrixColumnMajorLoadOp::getStride() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MatrixColumnMajorLoadOp::getDataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MatrixColumnMajorLoadOp::getStrideMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MatrixColumnMajorLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MatrixColumnMajorLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MatrixColumnMajorLoadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MatrixColumnMajorLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.columns; + auto attr = dict.get("columns"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for columns in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `columns` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.isVolatile; + auto attr = dict.get("isVolatile"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isVolatile in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isVolatile` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.rows; + auto attr = dict.get("rows"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for rows in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `rows` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MatrixColumnMajorLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.columns; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("columns", + propStorage)); + } + + { + const auto &propStorage = prop.isVolatile; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isVolatile", + propStorage)); + } + + { + const auto &propStorage = prop.rows; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("rows", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MatrixColumnMajorLoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.columns.getAsOpaquePointer()), + llvm::hash_value(prop.isVolatile.getAsOpaquePointer()), + llvm::hash_value(prop.rows.getAsOpaquePointer())); +} + +std::optional MatrixColumnMajorLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "columns") + return prop.columns; + + if (name == "isVolatile") + return prop.isVolatile; + + if (name == "rows") + return prop.rows; + return std::nullopt; +} + +void MatrixColumnMajorLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "columns") { + prop.columns = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "isVolatile") { + prop.isVolatile = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "rows") { + prop.rows = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MatrixColumnMajorLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.columns) attrs.append("columns", prop.columns); + + if (prop.isVolatile) attrs.append("isVolatile", prop.isVolatile); + + if (prop.rows) attrs.append("rows", prop.rows); +} + +::mlir::LogicalResult MatrixColumnMajorLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getColumnsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "columns", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsVolatileAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, "isVolatile", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getRowsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "rows", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatrixColumnMajorLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.columns))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.isVolatile))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.rows))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MatrixColumnMajorLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.columns); + writer.writeAttribute(prop.isVolatile); + writer.writeAttribute(prop.rows); +} + +::mlir::IntegerAttr MatrixColumnMajorLoadOp::getIsVolatileAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); +} + +bool MatrixColumnMajorLoadOp::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixColumnMajorLoadOp::getRowsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().rows); +} + +uint32_t MatrixColumnMajorLoadOp::getRows() { + auto attr = getRowsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixColumnMajorLoadOp::getColumnsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().columns); +} + +uint32_t MatrixColumnMajorLoadOp::getColumns() { + auto attr = getColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +void MatrixColumnMajorLoadOp::setIsVolatileAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIsVolatileAttrName(), attr); +} + +void MatrixColumnMajorLoadOp::setIsVolatile(bool attrValue) { + (*this)->setAttr(getIsVolatileAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(1), attrValue)); +} + +void MatrixColumnMajorLoadOp::setRowsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getRowsAttrName(), attr); +} + +void MatrixColumnMajorLoadOp::setRows(uint32_t attrValue) { + (*this)->setAttr(getRowsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MatrixColumnMajorLoadOp::setColumnsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getColumnsAttrName(), attr); +} + +void MatrixColumnMajorLoadOp::setColumns(uint32_t attrValue) { + (*this)->setAttr(getColumnsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MatrixColumnMajorLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void MatrixColumnMajorLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value data, ::mlir::Value stride, ::mlir::IntegerAttr isVolatile, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns) { + odsState.addOperands(data); + odsState.addOperands(stride); + odsState.getOrAddProperties().isVolatile = isVolatile; + odsState.getOrAddProperties().rows = rows; + odsState.getOrAddProperties().columns = columns; + odsState.addTypes(res); +} + +void MatrixColumnMajorLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value stride, ::mlir::IntegerAttr isVolatile, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns) { + odsState.addOperands(data); + odsState.addOperands(stride); + odsState.getOrAddProperties().isVolatile = isVolatile; + odsState.getOrAddProperties().rows = rows; + odsState.getOrAddProperties().columns = columns; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MatrixColumnMajorLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value data, ::mlir::Value stride, bool isVolatile, uint32_t rows, uint32_t columns) { + odsState.addOperands(data); + odsState.addOperands(stride); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + odsState.getOrAddProperties().rows = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rows); + odsState.getOrAddProperties().columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), columns); + odsState.addTypes(res); +} + +void MatrixColumnMajorLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value stride, bool isVolatile, uint32_t rows, uint32_t columns) { + odsState.addOperands(data); + odsState.addOperands(stride); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + odsState.getOrAddProperties().rows = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rows); + odsState.getOrAddProperties().columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), columns); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MatrixColumnMajorLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MatrixColumnMajorLoadOp::verifyInvariantsImpl() { + auto tblgen_columns = getProperties().columns; (void)tblgen_columns; + if (!tblgen_columns) return emitOpError("requires attribute 'columns'"); + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitOpError("requires attribute 'isVolatile'"); + auto tblgen_rows = getProperties().rows; (void)tblgen_rows; + if (!tblgen_rows) return emitOpError("requires attribute 'rows'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(*this, tblgen_isVolatile, "isVolatile"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_rows, "rows"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_columns, "columns"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatrixColumnMajorLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MatrixColumnMajorLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand dataRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dataOperands(dataRawOperands); ::llvm::SMLoc dataOperandsLoc; + (void)dataOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand strideRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> strideOperands(strideRawOperands); ::llvm::SMLoc strideOperandsLoc; + (void)strideOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + ::mlir::Type dataRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dataTypes(dataRawTypes); + ::mlir::Type strideRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> strideTypes(strideRawTypes); + + dataOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dataRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseLess()) + return ::mlir::failure(); + if (parser.parseKeyword("stride")) + return ::mlir::failure(); + if (parser.parseEqual()) + return ::mlir::failure(); + + strideOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(strideRawOperands[0])) + return ::mlir::failure(); + if (parser.parseGreater()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + if (parser.parseKeyword("from")) + return ::mlir::failure(); + + if (parser.parseType(dataRawTypes[0])) + return ::mlir::failure(); + if (parser.parseKeyword("stride")) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + strideRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(dataOperands, dataTypes, dataOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(strideOperands, strideTypes, strideOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MatrixColumnMajorLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getData(); + _odsPrinter << ","; + _odsPrinter << ' ' << "<"; + _odsPrinter << "stride"; + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getStride(); + _odsPrinter << ">"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "from"; + _odsPrinter << ' '; + _odsPrinter << getData().getType(); + _odsPrinter << ' ' << "stride"; + _odsPrinter << ' '; + { + auto type = getStride().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MatrixColumnMajorLoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MatrixColumnMajorStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MatrixColumnMajorStoreOpGenericAdaptorBase::MatrixColumnMajorStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.matrix.column.major.store", odsAttrs.getContext()); +} + +MatrixColumnMajorStoreOpGenericAdaptorBase::MatrixColumnMajorStoreOpGenericAdaptorBase(MatrixColumnMajorStoreOp op) : MatrixColumnMajorStoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MatrixColumnMajorStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MatrixColumnMajorStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MatrixColumnMajorStoreOpGenericAdaptorBase::getIsVolatileAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); + return attr; +} + +bool MatrixColumnMajorStoreOpGenericAdaptorBase::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixColumnMajorStoreOpGenericAdaptorBase::getRowsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().rows); + return attr; +} + +uint32_t MatrixColumnMajorStoreOpGenericAdaptorBase::getRows() { + auto attr = getRowsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixColumnMajorStoreOpGenericAdaptorBase::getColumnsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().columns); + return attr; +} + +uint32_t MatrixColumnMajorStoreOpGenericAdaptorBase::getColumns() { + auto attr = getColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +MatrixColumnMajorStoreOpAdaptor::MatrixColumnMajorStoreOpAdaptor(MatrixColumnMajorStoreOp op) : MatrixColumnMajorStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MatrixColumnMajorStoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_columns = getProperties().columns; (void)tblgen_columns; + if (!tblgen_columns) return emitError(loc, "'llvm.intr.matrix.column.major.store' op ""requires attribute 'columns'"); + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitError(loc, "'llvm.intr.matrix.column.major.store' op ""requires attribute 'isVolatile'"); + auto tblgen_rows = getProperties().rows; (void)tblgen_rows; + if (!tblgen_rows) return emitError(loc, "'llvm.intr.matrix.column.major.store' op ""requires attribute 'rows'"); + + if (tblgen_isVolatile && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_isVolatile))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_isVolatile).getType().isSignlessInteger(1))))) + return emitError(loc, "'llvm.intr.matrix.column.major.store' op ""attribute 'isVolatile' failed to satisfy constraint: 1-bit signless integer attribute"); + + if (tblgen_rows && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_rows))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_rows).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.matrix.column.major.store' op ""attribute 'rows' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_columns && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_columns))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_columns).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.matrix.column.major.store' op ""attribute 'columns' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair MatrixColumnMajorStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MatrixColumnMajorStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MatrixColumnMajorStoreOp::getMatrix() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MatrixColumnMajorStoreOp::getData() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MatrixColumnMajorStoreOp::getStride() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MatrixColumnMajorStoreOp::getMatrixMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MatrixColumnMajorStoreOp::getDataMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MatrixColumnMajorStoreOp::getStrideMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MatrixColumnMajorStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MatrixColumnMajorStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult MatrixColumnMajorStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.columns; + auto attr = dict.get("columns"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for columns in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `columns` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.isVolatile; + auto attr = dict.get("isVolatile"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isVolatile in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isVolatile` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.rows; + auto attr = dict.get("rows"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for rows in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `rows` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MatrixColumnMajorStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.columns; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("columns", + propStorage)); + } + + { + const auto &propStorage = prop.isVolatile; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isVolatile", + propStorage)); + } + + { + const auto &propStorage = prop.rows; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("rows", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MatrixColumnMajorStoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.columns.getAsOpaquePointer()), + llvm::hash_value(prop.isVolatile.getAsOpaquePointer()), + llvm::hash_value(prop.rows.getAsOpaquePointer())); +} + +std::optional MatrixColumnMajorStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "columns") + return prop.columns; + + if (name == "isVolatile") + return prop.isVolatile; + + if (name == "rows") + return prop.rows; + return std::nullopt; +} + +void MatrixColumnMajorStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "columns") { + prop.columns = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "isVolatile") { + prop.isVolatile = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "rows") { + prop.rows = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MatrixColumnMajorStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.columns) attrs.append("columns", prop.columns); + + if (prop.isVolatile) attrs.append("isVolatile", prop.isVolatile); + + if (prop.rows) attrs.append("rows", prop.rows); +} + +::mlir::LogicalResult MatrixColumnMajorStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getColumnsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "columns", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsVolatileAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, "isVolatile", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getRowsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "rows", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatrixColumnMajorStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.columns))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.isVolatile))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.rows))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MatrixColumnMajorStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.columns); + writer.writeAttribute(prop.isVolatile); + writer.writeAttribute(prop.rows); +} + +::mlir::IntegerAttr MatrixColumnMajorStoreOp::getIsVolatileAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); +} + +bool MatrixColumnMajorStoreOp::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixColumnMajorStoreOp::getRowsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().rows); +} + +uint32_t MatrixColumnMajorStoreOp::getRows() { + auto attr = getRowsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixColumnMajorStoreOp::getColumnsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().columns); +} + +uint32_t MatrixColumnMajorStoreOp::getColumns() { + auto attr = getColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +void MatrixColumnMajorStoreOp::setIsVolatileAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIsVolatileAttrName(), attr); +} + +void MatrixColumnMajorStoreOp::setIsVolatile(bool attrValue) { + (*this)->setAttr(getIsVolatileAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(1), attrValue)); +} + +void MatrixColumnMajorStoreOp::setRowsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getRowsAttrName(), attr); +} + +void MatrixColumnMajorStoreOp::setRows(uint32_t attrValue) { + (*this)->setAttr(getRowsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MatrixColumnMajorStoreOp::setColumnsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getColumnsAttrName(), attr); +} + +void MatrixColumnMajorStoreOp::setColumns(uint32_t attrValue) { + (*this)->setAttr(getColumnsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MatrixColumnMajorStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + assert(isCompatibleType(resultType) && "result must be an LLVM type"); + assert(::llvm::isa(resultType) && + "for zero-result operands, only 'void' is accepted as result type"); + build(odsBuilder, odsState, operands, attributes); + +} + +void MatrixColumnMajorStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void MatrixColumnMajorStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value matrix, ::mlir::Value data, ::mlir::Value stride, ::mlir::IntegerAttr isVolatile, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns) { + odsState.addOperands(matrix); + odsState.addOperands(data); + odsState.addOperands(stride); + odsState.getOrAddProperties().isVolatile = isVolatile; + odsState.getOrAddProperties().rows = rows; + odsState.getOrAddProperties().columns = columns; +} + +void MatrixColumnMajorStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value data, ::mlir::Value stride, ::mlir::IntegerAttr isVolatile, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns) { + odsState.addOperands(matrix); + odsState.addOperands(data); + odsState.addOperands(stride); + odsState.getOrAddProperties().isVolatile = isVolatile; + odsState.getOrAddProperties().rows = rows; + odsState.getOrAddProperties().columns = columns; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MatrixColumnMajorStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value matrix, ::mlir::Value data, ::mlir::Value stride, bool isVolatile, uint32_t rows, uint32_t columns) { + odsState.addOperands(matrix); + odsState.addOperands(data); + odsState.addOperands(stride); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + odsState.getOrAddProperties().rows = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rows); + odsState.getOrAddProperties().columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), columns); +} + +void MatrixColumnMajorStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value data, ::mlir::Value stride, bool isVolatile, uint32_t rows, uint32_t columns) { + odsState.addOperands(matrix); + odsState.addOperands(data); + odsState.addOperands(stride); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + odsState.getOrAddProperties().rows = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rows); + odsState.getOrAddProperties().columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), columns); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MatrixColumnMajorStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MatrixColumnMajorStoreOp::verifyInvariantsImpl() { + auto tblgen_columns = getProperties().columns; (void)tblgen_columns; + if (!tblgen_columns) return emitOpError("requires attribute 'columns'"); + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitOpError("requires attribute 'isVolatile'"); + auto tblgen_rows = getProperties().rows; (void)tblgen_rows; + if (!tblgen_rows) return emitOpError("requires attribute 'rows'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(*this, tblgen_isVolatile, "isVolatile"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_rows, "rows"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_columns, "columns"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatrixColumnMajorStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MatrixColumnMajorStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand matrixRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> matrixOperands(matrixRawOperands); ::llvm::SMLoc matrixOperandsLoc; + (void)matrixOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dataRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dataOperands(dataRawOperands); ::llvm::SMLoc dataOperandsLoc; + (void)dataOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand strideRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> strideOperands(strideRawOperands); ::llvm::SMLoc strideOperandsLoc; + (void)strideOperandsLoc; + ::mlir::Type matrixRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> matrixTypes(matrixRawTypes); + ::mlir::Type dataRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dataTypes(dataRawTypes); + ::mlir::Type strideRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> strideTypes(strideRawTypes); + + matrixOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(matrixRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + dataOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dataRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseLess()) + return ::mlir::failure(); + if (parser.parseKeyword("stride")) + return ::mlir::failure(); + if (parser.parseEqual()) + return ::mlir::failure(); + + strideOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(strideRawOperands[0])) + return ::mlir::failure(); + if (parser.parseGreater()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + matrixRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + if (parser.parseType(dataRawTypes[0])) + return ::mlir::failure(); + if (parser.parseKeyword("stride")) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + strideRawTypes[0] = type; + } + if (parser.resolveOperands(matrixOperands, matrixTypes, matrixOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataOperands, dataTypes, dataOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(strideOperands, strideTypes, strideOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MatrixColumnMajorStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMatrix(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getData(); + _odsPrinter << ","; + _odsPrinter << ' ' << "<"; + _odsPrinter << "stride"; + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getStride(); + _odsPrinter << ">"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMatrix().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + _odsPrinter << getData().getType(); + _odsPrinter << ' ' << "stride"; + _odsPrinter << ' '; + { + auto type = getStride().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MatrixColumnMajorStoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MatrixMultiplyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MatrixMultiplyOpGenericAdaptorBase::MatrixMultiplyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.matrix.multiply", odsAttrs.getContext()); +} + +MatrixMultiplyOpGenericAdaptorBase::MatrixMultiplyOpGenericAdaptorBase(MatrixMultiplyOp op) : MatrixMultiplyOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MatrixMultiplyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MatrixMultiplyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MatrixMultiplyOpGenericAdaptorBase::getLhsRowsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().lhs_rows); + return attr; +} + +uint32_t MatrixMultiplyOpGenericAdaptorBase::getLhsRows() { + auto attr = getLhsRowsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixMultiplyOpGenericAdaptorBase::getLhsColumnsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().lhs_columns); + return attr; +} + +uint32_t MatrixMultiplyOpGenericAdaptorBase::getLhsColumns() { + auto attr = getLhsColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixMultiplyOpGenericAdaptorBase::getRhsColumnsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().rhs_columns); + return attr; +} + +uint32_t MatrixMultiplyOpGenericAdaptorBase::getRhsColumns() { + auto attr = getRhsColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +MatrixMultiplyOpAdaptor::MatrixMultiplyOpAdaptor(MatrixMultiplyOp op) : MatrixMultiplyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MatrixMultiplyOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_lhs_columns = getProperties().lhs_columns; (void)tblgen_lhs_columns; + if (!tblgen_lhs_columns) return emitError(loc, "'llvm.intr.matrix.multiply' op ""requires attribute 'lhs_columns'"); + auto tblgen_lhs_rows = getProperties().lhs_rows; (void)tblgen_lhs_rows; + if (!tblgen_lhs_rows) return emitError(loc, "'llvm.intr.matrix.multiply' op ""requires attribute 'lhs_rows'"); + auto tblgen_rhs_columns = getProperties().rhs_columns; (void)tblgen_rhs_columns; + if (!tblgen_rhs_columns) return emitError(loc, "'llvm.intr.matrix.multiply' op ""requires attribute 'rhs_columns'"); + + if (tblgen_lhs_rows && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_lhs_rows))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_lhs_rows).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.matrix.multiply' op ""attribute 'lhs_rows' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_lhs_columns && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_lhs_columns))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_lhs_columns).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.matrix.multiply' op ""attribute 'lhs_columns' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_rhs_columns && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_rhs_columns))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_rhs_columns).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.matrix.multiply' op ""attribute 'rhs_columns' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair MatrixMultiplyOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MatrixMultiplyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MatrixMultiplyOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MatrixMultiplyOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MatrixMultiplyOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MatrixMultiplyOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MatrixMultiplyOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MatrixMultiplyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MatrixMultiplyOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MatrixMultiplyOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.lhs_columns; + auto attr = dict.get("lhs_columns"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for lhs_columns in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `lhs_columns` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.lhs_rows; + auto attr = dict.get("lhs_rows"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for lhs_rows in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `lhs_rows` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.rhs_columns; + auto attr = dict.get("rhs_columns"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for rhs_columns in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `rhs_columns` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MatrixMultiplyOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.lhs_columns; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("lhs_columns", + propStorage)); + } + + { + const auto &propStorage = prop.lhs_rows; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("lhs_rows", + propStorage)); + } + + { + const auto &propStorage = prop.rhs_columns; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("rhs_columns", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MatrixMultiplyOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.lhs_columns.getAsOpaquePointer()), + llvm::hash_value(prop.lhs_rows.getAsOpaquePointer()), + llvm::hash_value(prop.rhs_columns.getAsOpaquePointer())); +} + +std::optional MatrixMultiplyOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "lhs_columns") + return prop.lhs_columns; + + if (name == "lhs_rows") + return prop.lhs_rows; + + if (name == "rhs_columns") + return prop.rhs_columns; + return std::nullopt; +} + +void MatrixMultiplyOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "lhs_columns") { + prop.lhs_columns = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "lhs_rows") { + prop.lhs_rows = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "rhs_columns") { + prop.rhs_columns = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MatrixMultiplyOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.lhs_columns) attrs.append("lhs_columns", prop.lhs_columns); + + if (prop.lhs_rows) attrs.append("lhs_rows", prop.lhs_rows); + + if (prop.rhs_columns) attrs.append("rhs_columns", prop.rhs_columns); +} + +::mlir::LogicalResult MatrixMultiplyOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLhsColumnsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "lhs_columns", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLhsRowsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "lhs_rows", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getRhsColumnsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "rhs_columns", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatrixMultiplyOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.lhs_columns))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.lhs_rows))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.rhs_columns))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MatrixMultiplyOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.lhs_columns); + writer.writeAttribute(prop.lhs_rows); + writer.writeAttribute(prop.rhs_columns); +} + +::mlir::IntegerAttr MatrixMultiplyOp::getLhsRowsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().lhs_rows); +} + +uint32_t MatrixMultiplyOp::getLhsRows() { + auto attr = getLhsRowsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixMultiplyOp::getLhsColumnsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().lhs_columns); +} + +uint32_t MatrixMultiplyOp::getLhsColumns() { + auto attr = getLhsColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixMultiplyOp::getRhsColumnsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().rhs_columns); +} + +uint32_t MatrixMultiplyOp::getRhsColumns() { + auto attr = getRhsColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +void MatrixMultiplyOp::setLhsRowsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getLhsRowsAttrName(), attr); +} + +void MatrixMultiplyOp::setLhsRows(uint32_t attrValue) { + (*this)->setAttr(getLhsRowsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MatrixMultiplyOp::setLhsColumnsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getLhsColumnsAttrName(), attr); +} + +void MatrixMultiplyOp::setLhsColumns(uint32_t attrValue) { + (*this)->setAttr(getLhsColumnsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MatrixMultiplyOp::setRhsColumnsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getRhsColumnsAttrName(), attr); +} + +void MatrixMultiplyOp::setRhsColumns(uint32_t attrValue) { + (*this)->setAttr(getRhsColumnsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MatrixMultiplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void MatrixMultiplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::IntegerAttr lhs_rows, ::mlir::IntegerAttr lhs_columns, ::mlir::IntegerAttr rhs_columns) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().lhs_rows = lhs_rows; + odsState.getOrAddProperties().lhs_columns = lhs_columns; + odsState.getOrAddProperties().rhs_columns = rhs_columns; + odsState.addTypes(res); +} + +void MatrixMultiplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::IntegerAttr lhs_rows, ::mlir::IntegerAttr lhs_columns, ::mlir::IntegerAttr rhs_columns) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().lhs_rows = lhs_rows; + odsState.getOrAddProperties().lhs_columns = lhs_columns; + odsState.getOrAddProperties().rhs_columns = rhs_columns; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MatrixMultiplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, uint32_t lhs_rows, uint32_t lhs_columns, uint32_t rhs_columns) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().lhs_rows = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), lhs_rows); + odsState.getOrAddProperties().lhs_columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), lhs_columns); + odsState.getOrAddProperties().rhs_columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rhs_columns); + odsState.addTypes(res); +} + +void MatrixMultiplyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, uint32_t lhs_rows, uint32_t lhs_columns, uint32_t rhs_columns) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().lhs_rows = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), lhs_rows); + odsState.getOrAddProperties().lhs_columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), lhs_columns); + odsState.getOrAddProperties().rhs_columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rhs_columns); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MatrixMultiplyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MatrixMultiplyOp::verifyInvariantsImpl() { + auto tblgen_lhs_columns = getProperties().lhs_columns; (void)tblgen_lhs_columns; + if (!tblgen_lhs_columns) return emitOpError("requires attribute 'lhs_columns'"); + auto tblgen_lhs_rows = getProperties().lhs_rows; (void)tblgen_lhs_rows; + if (!tblgen_lhs_rows) return emitOpError("requires attribute 'lhs_rows'"); + auto tblgen_rhs_columns = getProperties().rhs_columns; (void)tblgen_rhs_columns; + if (!tblgen_rhs_columns) return emitOpError("requires attribute 'rhs_columns'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_lhs_rows, "lhs_rows"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_lhs_columns, "lhs_columns"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_rhs_columns, "rhs_columns"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatrixMultiplyOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MatrixMultiplyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + ::mlir::Type rhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> rhsTypes(rhsRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + rhsRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MatrixMultiplyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "("; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MatrixMultiplyOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MatrixTransposeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MatrixTransposeOpGenericAdaptorBase::MatrixTransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.matrix.transpose", odsAttrs.getContext()); +} + +MatrixTransposeOpGenericAdaptorBase::MatrixTransposeOpGenericAdaptorBase(MatrixTransposeOp op) : MatrixTransposeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MatrixTransposeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MatrixTransposeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MatrixTransposeOpGenericAdaptorBase::getRowsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().rows); + return attr; +} + +uint32_t MatrixTransposeOpGenericAdaptorBase::getRows() { + auto attr = getRowsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixTransposeOpGenericAdaptorBase::getColumnsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().columns); + return attr; +} + +uint32_t MatrixTransposeOpGenericAdaptorBase::getColumns() { + auto attr = getColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +MatrixTransposeOpAdaptor::MatrixTransposeOpAdaptor(MatrixTransposeOp op) : MatrixTransposeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MatrixTransposeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_columns = getProperties().columns; (void)tblgen_columns; + if (!tblgen_columns) return emitError(loc, "'llvm.intr.matrix.transpose' op ""requires attribute 'columns'"); + auto tblgen_rows = getProperties().rows; (void)tblgen_rows; + if (!tblgen_rows) return emitError(loc, "'llvm.intr.matrix.transpose' op ""requires attribute 'rows'"); + + if (tblgen_rows && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_rows))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_rows).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.matrix.transpose' op ""attribute 'rows' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_columns && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_columns))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_columns).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.matrix.transpose' op ""attribute 'columns' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair MatrixTransposeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MatrixTransposeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MatrixTransposeOp::getMatrix() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &MatrixTransposeOp::getMatrixMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair MatrixTransposeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MatrixTransposeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MatrixTransposeOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MatrixTransposeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.columns; + auto attr = dict.get("columns"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for columns in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `columns` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.rows; + auto attr = dict.get("rows"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for rows in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `rows` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MatrixTransposeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.columns; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("columns", + propStorage)); + } + + { + const auto &propStorage = prop.rows; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("rows", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MatrixTransposeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.columns.getAsOpaquePointer()), + llvm::hash_value(prop.rows.getAsOpaquePointer())); +} + +std::optional MatrixTransposeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "columns") + return prop.columns; + + if (name == "rows") + return prop.rows; + return std::nullopt; +} + +void MatrixTransposeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "columns") { + prop.columns = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "rows") { + prop.rows = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MatrixTransposeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.columns) attrs.append("columns", prop.columns); + + if (prop.rows) attrs.append("rows", prop.rows); +} + +::mlir::LogicalResult MatrixTransposeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getColumnsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "columns", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getRowsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "rows", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatrixTransposeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.columns))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.rows))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MatrixTransposeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.columns); + writer.writeAttribute(prop.rows); +} + +::mlir::IntegerAttr MatrixTransposeOp::getRowsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().rows); +} + +uint32_t MatrixTransposeOp::getRows() { + auto attr = getRowsAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr MatrixTransposeOp::getColumnsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().columns); +} + +uint32_t MatrixTransposeOp::getColumns() { + auto attr = getColumnsAttr(); + return attr.getValue().getZExtValue(); +} + +void MatrixTransposeOp::setRowsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getRowsAttrName(), attr); +} + +void MatrixTransposeOp::setRows(uint32_t attrValue) { + (*this)->setAttr(getRowsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MatrixTransposeOp::setColumnsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getColumnsAttrName(), attr); +} + +void MatrixTransposeOp::setColumns(uint32_t attrValue) { + (*this)->setAttr(getColumnsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MatrixTransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void MatrixTransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrix, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns) { + odsState.addOperands(matrix); + odsState.getOrAddProperties().rows = rows; + odsState.getOrAddProperties().columns = columns; + odsState.addTypes(res); +} + +void MatrixTransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns) { + odsState.addOperands(matrix); + odsState.getOrAddProperties().rows = rows; + odsState.getOrAddProperties().columns = columns; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MatrixTransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrix, uint32_t rows, uint32_t columns) { + odsState.addOperands(matrix); + odsState.getOrAddProperties().rows = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rows); + odsState.getOrAddProperties().columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), columns); + odsState.addTypes(res); +} + +void MatrixTransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, uint32_t rows, uint32_t columns) { + odsState.addOperands(matrix); + odsState.getOrAddProperties().rows = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rows); + odsState.getOrAddProperties().columns = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), columns); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MatrixTransposeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MatrixTransposeOp::verifyInvariantsImpl() { + auto tblgen_columns = getProperties().columns; (void)tblgen_columns; + if (!tblgen_columns) return emitOpError("requires attribute 'columns'"); + auto tblgen_rows = getProperties().rows; (void)tblgen_rows; + if (!tblgen_rows) return emitOpError("requires attribute 'rows'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_rows, "rows"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_columns, "columns"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatrixTransposeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MatrixTransposeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand matrixRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> matrixOperands(matrixRawOperands); ::llvm::SMLoc matrixOperandsLoc; + (void)matrixOperandsLoc; + ::mlir::Type matrixRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> matrixTypes(matrixRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + matrixOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(matrixRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + matrixRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(matrixOperands, matrixTypes, matrixOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MatrixTransposeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMatrix(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMatrix().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MatrixTransposeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MaxNumOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaxNumOpGenericAdaptorBase::MaxNumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.maxnum", odsAttrs.getContext()); +} + +MaxNumOpGenericAdaptorBase::MaxNumOpGenericAdaptorBase(MaxNumOp op) : MaxNumOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaxNumOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaxNumOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr MaxNumOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags MaxNumOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +MaxNumOpAdaptor::MaxNumOpAdaptor(MaxNumOp op) : MaxNumOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaxNumOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.maxnum' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair MaxNumOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaxNumOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaxNumOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MaxNumOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MaxNumOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaxNumOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaxNumOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaxNumOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaxNumOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MaxNumOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MaxNumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MaxNumOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional MaxNumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void MaxNumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MaxNumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult MaxNumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaxNumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaxNumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr MaxNumOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags MaxNumOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void MaxNumOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void MaxNumOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MaxNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void MaxNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxNumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaxNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaxNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void MaxNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxNumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaxNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaxNumOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MaxNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaxNumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MaxNumOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult MaxNumOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaxNumOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MaxNumOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MaxNumOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaxNumOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void MaxNumOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MaxNumOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MaximumOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaximumOpGenericAdaptorBase::MaximumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.maximum", odsAttrs.getContext()); +} + +MaximumOpGenericAdaptorBase::MaximumOpGenericAdaptorBase(MaximumOp op) : MaximumOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaximumOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MaximumOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr MaximumOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags MaximumOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +MaximumOpAdaptor::MaximumOpAdaptor(MaximumOp op) : MaximumOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaximumOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.maximum' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair MaximumOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MaximumOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaximumOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MaximumOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MaximumOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MaximumOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MaximumOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MaximumOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MaximumOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MaximumOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MaximumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MaximumOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional MaximumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void MaximumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MaximumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult MaximumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaximumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaximumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr MaximumOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags MaximumOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void MaximumOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void MaximumOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void MaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaximumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void MaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaximumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MaximumOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MaximumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MaximumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MaximumOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult MaximumOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaximumOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MaximumOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MaximumOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MaximumOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void MaximumOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MaximumOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MemcpyInlineOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MemcpyInlineOpGenericAdaptorBase::MemcpyInlineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.memcpy.inline", odsAttrs.getContext()); +} + +MemcpyInlineOpGenericAdaptorBase::MemcpyInlineOpGenericAdaptorBase(MemcpyInlineOp op) : MemcpyInlineOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MemcpyInlineOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MemcpyInlineOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MemcpyInlineOpGenericAdaptorBase::getLenAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().len); + return attr; +} + +::mlir::APInt MemcpyInlineOpGenericAdaptorBase::getLen() { + auto attr = getLenAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr MemcpyInlineOpGenericAdaptorBase::getIsVolatileAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); + return attr; +} + +bool MemcpyInlineOpGenericAdaptorBase::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::ArrayAttr MemcpyInlineOpGenericAdaptorBase::getAccessGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemcpyInlineOpGenericAdaptorBase::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyInlineOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemcpyInlineOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyInlineOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemcpyInlineOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyInlineOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemcpyInlineOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +MemcpyInlineOpAdaptor::MemcpyInlineOpAdaptor(MemcpyInlineOp op) : MemcpyInlineOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MemcpyInlineOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitError(loc, "'llvm.intr.memcpy.inline' op ""requires attribute 'isVolatile'"); + auto tblgen_len = getProperties().len; (void)tblgen_len; + if (!tblgen_len) return emitError(loc, "'llvm.intr.memcpy.inline' op ""requires attribute 'len'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_len && !((::llvm::isa<::mlir::IntegerAttr>(tblgen_len)))) + return emitError(loc, "'llvm.intr.memcpy.inline' op ""attribute 'len' failed to satisfy constraint: arbitrary integer attribute"); + + if (tblgen_isVolatile && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_isVolatile))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_isVolatile).getType().isSignlessInteger(1))))) + return emitError(loc, "'llvm.intr.memcpy.inline' op ""attribute 'isVolatile' failed to satisfy constraint: 1-bit signless integer attribute"); + + if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memcpy.inline' op ""attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array"); + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memcpy.inline' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memcpy.inline' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memcpy.inline' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair MemcpyInlineOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MemcpyInlineOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MemcpyInlineOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MemcpyInlineOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MemcpyInlineOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MemcpyInlineOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MemcpyInlineOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MemcpyInlineOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult MemcpyInlineOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.access_groups; + auto attr = dict.get("access_groups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for access_groups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `access_groups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.isVolatile; + auto attr = dict.get("isVolatile"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isVolatile in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isVolatile` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.len; + auto attr = dict.get("len"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for len in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `len` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MemcpyInlineOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.access_groups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("access_groups", + propStorage)); + } + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.isVolatile; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isVolatile", + propStorage)); + } + + { + const auto &propStorage = prop.len; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("len", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MemcpyInlineOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.access_groups.getAsOpaquePointer()), + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.isVolatile.getAsOpaquePointer()), + llvm::hash_value(prop.len.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional MemcpyInlineOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "access_groups") + return prop.access_groups; + + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "isVolatile") + return prop.isVolatile; + + if (name == "len") + return prop.len; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void MemcpyInlineOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "access_groups") { + prop.access_groups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "isVolatile") { + prop.isVolatile = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "len") { + prop.len = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MemcpyInlineOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.access_groups) attrs.append("access_groups", prop.access_groups); + + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.isVolatile) attrs.append("isVolatile", prop.isVolatile); + + if (prop.len) attrs.append("len", prop.len); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult MemcpyInlineOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps8(attr, "access_groups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsVolatileAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, "isVolatile", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLenAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps7(attr, "len", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps10(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemcpyInlineOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.isVolatile))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.len))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MemcpyInlineOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.access_groups); + + writer.writeOptionalAttribute(prop.alias_scopes); + writer.writeAttribute(prop.isVolatile); + writer.writeAttribute(prop.len); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::IntegerAttr MemcpyInlineOp::getLenAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().len); +} + +::mlir::APInt MemcpyInlineOp::getLen() { + auto attr = getLenAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr MemcpyInlineOp::getIsVolatileAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); +} + +bool MemcpyInlineOp::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::ArrayAttr MemcpyInlineOp::getAccessGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); +} + +::std::optional< ::mlir::ArrayAttr > MemcpyInlineOp::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyInlineOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > MemcpyInlineOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyInlineOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > MemcpyInlineOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyInlineOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > MemcpyInlineOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void MemcpyInlineOp::setLenAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getLenAttrName(), attr); +} + +void MemcpyInlineOp::setIsVolatileAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIsVolatileAttrName(), attr); +} + +void MemcpyInlineOp::setIsVolatile(bool attrValue) { + (*this)->setAttr(getIsVolatileAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(1), attrValue)); +} + +void MemcpyInlineOp::setAccessGroupsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAccessGroupsAttrName(), attr); +} + +void MemcpyInlineOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void MemcpyInlineOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void MemcpyInlineOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute MemcpyInlineOp::removeAccessGroupsAttr() { + auto &attr = getProperties().access_groups; + attr = {}; + return attr; +} + +::mlir::Attribute MemcpyInlineOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute MemcpyInlineOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute MemcpyInlineOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void MemcpyInlineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, IntegerAttr len, bool isVolatile) { + build(odsBuilder, odsState, dst, src, len, + odsBuilder.getBoolAttr(isVolatile)); + +} + +void MemcpyInlineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, IntegerAttr len, IntegerAttr isVolatile) { + build(odsBuilder, odsState, dst, src, len, isVolatile, + /*access_groups=*/nullptr, /*alias_scopes=*/nullptr, + /*noalias_scopes=*/nullptr, /*tbaa=*/nullptr); + +} + +void MemcpyInlineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.getOrAddProperties().len = len; + odsState.getOrAddProperties().isVolatile = isVolatile; + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void MemcpyInlineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.getOrAddProperties().len = len; + odsState.getOrAddProperties().isVolatile = isVolatile; + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MemcpyInlineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.getOrAddProperties().len = len; + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void MemcpyInlineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.getOrAddProperties().len = len; + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MemcpyInlineOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MemcpyInlineOp::verifyInvariantsImpl() { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitOpError("requires attribute 'isVolatile'"); + auto tblgen_len = getProperties().len; (void)tblgen_len; + if (!tblgen_len) return emitOpError("requires attribute 'len'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps7(*this, tblgen_len, "len"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(*this, tblgen_isVolatile, "isVolatile"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps8(*this, tblgen_access_groups, "access_groups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps10(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemcpyInlineOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void MemcpyInlineOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemcpyInlineOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MemcpyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MemcpyOpGenericAdaptorBase::MemcpyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.memcpy", odsAttrs.getContext()); +} + +MemcpyOpGenericAdaptorBase::MemcpyOpGenericAdaptorBase(MemcpyOp op) : MemcpyOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MemcpyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MemcpyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MemcpyOpGenericAdaptorBase::getIsVolatileAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); + return attr; +} + +bool MemcpyOpGenericAdaptorBase::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::ArrayAttr MemcpyOpGenericAdaptorBase::getAccessGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemcpyOpGenericAdaptorBase::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemcpyOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemcpyOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemcpyOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +MemcpyOpAdaptor::MemcpyOpAdaptor(MemcpyOp op) : MemcpyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MemcpyOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitError(loc, "'llvm.intr.memcpy' op ""requires attribute 'isVolatile'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_isVolatile && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_isVolatile))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_isVolatile).getType().isSignlessInteger(1))))) + return emitError(loc, "'llvm.intr.memcpy' op ""attribute 'isVolatile' failed to satisfy constraint: 1-bit signless integer attribute"); + + if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memcpy' op ""attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array"); + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memcpy' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memcpy' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memcpy' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair MemcpyOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MemcpyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MemcpyOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MemcpyOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MemcpyOp::getLen() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MemcpyOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MemcpyOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MemcpyOp::getLenMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MemcpyOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MemcpyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult MemcpyOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.access_groups; + auto attr = dict.get("access_groups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for access_groups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `access_groups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.isVolatile; + auto attr = dict.get("isVolatile"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isVolatile in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isVolatile` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MemcpyOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.access_groups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("access_groups", + propStorage)); + } + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.isVolatile; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isVolatile", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MemcpyOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.access_groups.getAsOpaquePointer()), + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.isVolatile.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional MemcpyOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "access_groups") + return prop.access_groups; + + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "isVolatile") + return prop.isVolatile; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void MemcpyOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "access_groups") { + prop.access_groups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "isVolatile") { + prop.isVolatile = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MemcpyOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.access_groups) attrs.append("access_groups", prop.access_groups); + + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.isVolatile) attrs.append("isVolatile", prop.isVolatile); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult MemcpyOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps8(attr, "access_groups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsVolatileAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, "isVolatile", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps10(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemcpyOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.isVolatile))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MemcpyOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.access_groups); + + writer.writeOptionalAttribute(prop.alias_scopes); + writer.writeAttribute(prop.isVolatile); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::IntegerAttr MemcpyOp::getIsVolatileAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); +} + +bool MemcpyOp::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::ArrayAttr MemcpyOp::getAccessGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); +} + +::std::optional< ::mlir::ArrayAttr > MemcpyOp::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > MemcpyOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > MemcpyOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemcpyOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > MemcpyOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void MemcpyOp::setIsVolatileAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIsVolatileAttrName(), attr); +} + +void MemcpyOp::setIsVolatile(bool attrValue) { + (*this)->setAttr(getIsVolatileAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(1), attrValue)); +} + +void MemcpyOp::setAccessGroupsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAccessGroupsAttrName(), attr); +} + +void MemcpyOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void MemcpyOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void MemcpyOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute MemcpyOp::removeAccessGroupsAttr() { + auto &attr = getProperties().access_groups; + attr = {}; + return attr; +} + +::mlir::Attribute MemcpyOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute MemcpyOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute MemcpyOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void MemcpyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, Value len, bool isVolatile) { + build(odsBuilder, odsState, dst, src, len, + odsBuilder.getBoolAttr(isVolatile)); + +} + +void MemcpyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, Value len, IntegerAttr isVolatile) { + build(odsBuilder, odsState, dst, src, len, isVolatile, + /*access_groups=*/nullptr, /*alias_scopes=*/nullptr, + /*noalias_scopes=*/nullptr, /*tbaa=*/nullptr); + +} + +void MemcpyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = isVolatile; + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void MemcpyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = isVolatile; + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MemcpyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void MemcpyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MemcpyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MemcpyOp::verifyInvariantsImpl() { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitOpError("requires attribute 'isVolatile'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(*this, tblgen_isVolatile, "isVolatile"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps8(*this, tblgen_access_groups, "access_groups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps10(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemcpyOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void MemcpyOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemcpyOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MemmoveOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MemmoveOpGenericAdaptorBase::MemmoveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.memmove", odsAttrs.getContext()); +} + +MemmoveOpGenericAdaptorBase::MemmoveOpGenericAdaptorBase(MemmoveOp op) : MemmoveOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MemmoveOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MemmoveOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MemmoveOpGenericAdaptorBase::getIsVolatileAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); + return attr; +} + +bool MemmoveOpGenericAdaptorBase::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::ArrayAttr MemmoveOpGenericAdaptorBase::getAccessGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemmoveOpGenericAdaptorBase::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemmoveOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemmoveOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemmoveOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemmoveOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemmoveOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemmoveOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +MemmoveOpAdaptor::MemmoveOpAdaptor(MemmoveOp op) : MemmoveOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MemmoveOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitError(loc, "'llvm.intr.memmove' op ""requires attribute 'isVolatile'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_isVolatile && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_isVolatile))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_isVolatile).getType().isSignlessInteger(1))))) + return emitError(loc, "'llvm.intr.memmove' op ""attribute 'isVolatile' failed to satisfy constraint: 1-bit signless integer attribute"); + + if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memmove' op ""attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array"); + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memmove' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memmove' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memmove' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair MemmoveOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MemmoveOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MemmoveOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MemmoveOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MemmoveOp::getLen() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MemmoveOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MemmoveOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MemmoveOp::getLenMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MemmoveOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MemmoveOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult MemmoveOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.access_groups; + auto attr = dict.get("access_groups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for access_groups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `access_groups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.isVolatile; + auto attr = dict.get("isVolatile"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isVolatile in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isVolatile` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MemmoveOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.access_groups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("access_groups", + propStorage)); + } + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.isVolatile; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isVolatile", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MemmoveOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.access_groups.getAsOpaquePointer()), + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.isVolatile.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional MemmoveOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "access_groups") + return prop.access_groups; + + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "isVolatile") + return prop.isVolatile; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void MemmoveOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "access_groups") { + prop.access_groups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "isVolatile") { + prop.isVolatile = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MemmoveOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.access_groups) attrs.append("access_groups", prop.access_groups); + + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.isVolatile) attrs.append("isVolatile", prop.isVolatile); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult MemmoveOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps8(attr, "access_groups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsVolatileAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, "isVolatile", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps10(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemmoveOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.isVolatile))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MemmoveOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.access_groups); + + writer.writeOptionalAttribute(prop.alias_scopes); + writer.writeAttribute(prop.isVolatile); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::IntegerAttr MemmoveOp::getIsVolatileAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); +} + +bool MemmoveOp::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::ArrayAttr MemmoveOp::getAccessGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); +} + +::std::optional< ::mlir::ArrayAttr > MemmoveOp::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemmoveOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > MemmoveOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemmoveOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > MemmoveOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemmoveOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > MemmoveOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void MemmoveOp::setIsVolatileAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIsVolatileAttrName(), attr); +} + +void MemmoveOp::setIsVolatile(bool attrValue) { + (*this)->setAttr(getIsVolatileAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(1), attrValue)); +} + +void MemmoveOp::setAccessGroupsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAccessGroupsAttrName(), attr); +} + +void MemmoveOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void MemmoveOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void MemmoveOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute MemmoveOp::removeAccessGroupsAttr() { + auto &attr = getProperties().access_groups; + attr = {}; + return attr; +} + +::mlir::Attribute MemmoveOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute MemmoveOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute MemmoveOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void MemmoveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, Value len, bool isVolatile) { + build(odsBuilder, odsState, dst, src, len, + odsBuilder.getBoolAttr(isVolatile)); + +} + +void MemmoveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, Value len, IntegerAttr isVolatile) { + build(odsBuilder, odsState, dst, src, len, isVolatile, + /*access_groups=*/nullptr, /*alias_scopes=*/nullptr, + /*noalias_scopes=*/nullptr, /*tbaa=*/nullptr); + +} + +void MemmoveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = isVolatile; + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void MemmoveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = isVolatile; + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MemmoveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void MemmoveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(src); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MemmoveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MemmoveOp::verifyInvariantsImpl() { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitOpError("requires attribute 'isVolatile'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(*this, tblgen_isVolatile, "isVolatile"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps8(*this, tblgen_access_groups, "access_groups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps10(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemmoveOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void MemmoveOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemmoveOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MemsetOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MemsetOpGenericAdaptorBase::MemsetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.memset", odsAttrs.getContext()); +} + +MemsetOpGenericAdaptorBase::MemsetOpGenericAdaptorBase(MemsetOp op) : MemsetOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MemsetOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MemsetOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MemsetOpGenericAdaptorBase::getIsVolatileAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); + return attr; +} + +bool MemsetOpGenericAdaptorBase::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::ArrayAttr MemsetOpGenericAdaptorBase::getAccessGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemsetOpGenericAdaptorBase::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemsetOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemsetOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemsetOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemsetOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemsetOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > MemsetOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +MemsetOpAdaptor::MemsetOpAdaptor(MemsetOp op) : MemsetOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MemsetOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitError(loc, "'llvm.intr.memset' op ""requires attribute 'isVolatile'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_isVolatile && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_isVolatile))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_isVolatile).getType().isSignlessInteger(1))))) + return emitError(loc, "'llvm.intr.memset' op ""attribute 'isVolatile' failed to satisfy constraint: 1-bit signless integer attribute"); + + if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memset' op ""attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array"); + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memset' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memset' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'llvm.intr.memset' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair MemsetOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MemsetOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MemsetOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MemsetOp::getVal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MemsetOp::getLen() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MemsetOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MemsetOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MemsetOp::getLenMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MemsetOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MemsetOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult MemsetOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.access_groups; + auto attr = dict.get("access_groups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for access_groups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `access_groups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.isVolatile; + auto attr = dict.get("isVolatile"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isVolatile in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isVolatile` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MemsetOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.access_groups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("access_groups", + propStorage)); + } + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.isVolatile; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isVolatile", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MemsetOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.access_groups.getAsOpaquePointer()), + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.isVolatile.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional MemsetOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "access_groups") + return prop.access_groups; + + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "isVolatile") + return prop.isVolatile; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void MemsetOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "access_groups") { + prop.access_groups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "isVolatile") { + prop.isVolatile = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MemsetOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.access_groups) attrs.append("access_groups", prop.access_groups); + + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.isVolatile) attrs.append("isVolatile", prop.isVolatile); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult MemsetOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps8(attr, "access_groups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsVolatileAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(attr, "isVolatile", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps10(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemsetOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.isVolatile))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MemsetOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.access_groups); + + writer.writeOptionalAttribute(prop.alias_scopes); + writer.writeAttribute(prop.isVolatile); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::IntegerAttr MemsetOp::getIsVolatileAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().isVolatile); +} + +bool MemsetOp::getIsVolatile() { + auto attr = getIsVolatileAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::ArrayAttr MemsetOp::getAccessGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); +} + +::std::optional< ::mlir::ArrayAttr > MemsetOp::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemsetOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > MemsetOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemsetOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > MemsetOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr MemsetOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > MemsetOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void MemsetOp::setIsVolatileAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIsVolatileAttrName(), attr); +} + +void MemsetOp::setIsVolatile(bool attrValue) { + (*this)->setAttr(getIsVolatileAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(1), attrValue)); +} + +void MemsetOp::setAccessGroupsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAccessGroupsAttrName(), attr); +} + +void MemsetOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void MemsetOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void MemsetOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute MemsetOp::removeAccessGroupsAttr() { + auto &attr = getProperties().access_groups; + attr = {}; + return attr; +} + +::mlir::Attribute MemsetOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute MemsetOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute MemsetOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void MemsetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value val, Value len, bool isVolatile) { + build(odsBuilder, odsState, dst, val, len, + odsBuilder.getBoolAttr(isVolatile)); + +} + +void MemsetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value val, Value len, IntegerAttr isVolatile) { + build(odsBuilder, odsState, dst, val, len, isVolatile, + /*access_groups=*/nullptr, /*alias_scopes=*/nullptr, + /*noalias_scopes=*/nullptr, /*tbaa=*/nullptr); + +} + +void MemsetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(val); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = isVolatile; + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void MemsetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(val); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = isVolatile; + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MemsetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(val); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void MemsetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(dst); + odsState.addOperands(val); + odsState.addOperands(len); + odsState.getOrAddProperties().isVolatile = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(1), isVolatile); + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MemsetOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MemsetOp::verifyInvariantsImpl() { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_isVolatile = getProperties().isVolatile; (void)tblgen_isVolatile; + if (!tblgen_isVolatile) return emitOpError("requires attribute 'isVolatile'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps0(*this, tblgen_isVolatile, "isVolatile"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps8(*this, tblgen_access_groups, "access_groups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps9(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps10(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemsetOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void MemsetOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemsetOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MinNumOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MinNumOpGenericAdaptorBase::MinNumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.minnum", odsAttrs.getContext()); +} + +MinNumOpGenericAdaptorBase::MinNumOpGenericAdaptorBase(MinNumOp op) : MinNumOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MinNumOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MinNumOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr MinNumOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags MinNumOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +MinNumOpAdaptor::MinNumOpAdaptor(MinNumOp op) : MinNumOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MinNumOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.minnum' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair MinNumOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MinNumOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinNumOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MinNumOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MinNumOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MinNumOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MinNumOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MinNumOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinNumOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MinNumOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MinNumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MinNumOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional MinNumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void MinNumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MinNumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult MinNumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinNumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinNumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr MinNumOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags MinNumOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void MinNumOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void MinNumOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MinNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void MinNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinNumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void MinNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinNumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinNumOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MinNumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinNumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MinNumOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult MinNumOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinNumOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MinNumOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MinNumOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinNumOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void MinNumOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MinNumOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MinimumOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MinimumOpGenericAdaptorBase::MinimumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.minimum", odsAttrs.getContext()); +} + +MinimumOpGenericAdaptorBase::MinimumOpGenericAdaptorBase(MinimumOp op) : MinimumOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MinimumOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MinimumOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr MinimumOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags MinimumOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +MinimumOpAdaptor::MinimumOpAdaptor(MinimumOp op) : MinimumOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MinimumOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.minimum' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair MinimumOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MinimumOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinimumOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MinimumOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MinimumOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MinimumOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MinimumOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MinimumOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MinimumOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MinimumOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MinimumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MinimumOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional MinimumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void MinimumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MinimumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult MinimumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinimumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinimumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr MinimumOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags MinimumOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void MinimumOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void MinimumOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void MinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinimumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void MinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinimumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MinimumOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MinimumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MinimumOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void MinimumOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult MinimumOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MinimumOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MinimumOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MinimumOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MinimumOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void MinimumOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MinimumOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::NearbyintOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +NearbyintOpGenericAdaptorBase::NearbyintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.nearbyint", odsAttrs.getContext()); +} + +NearbyintOpGenericAdaptorBase::NearbyintOpGenericAdaptorBase(NearbyintOp op) : NearbyintOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair NearbyintOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr NearbyintOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr NearbyintOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags NearbyintOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +NearbyintOpAdaptor::NearbyintOpAdaptor(NearbyintOp op) : NearbyintOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult NearbyintOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.nearbyint' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair NearbyintOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range NearbyintOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value NearbyintOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &NearbyintOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair NearbyintOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range NearbyintOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value NearbyintOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult NearbyintOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute NearbyintOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code NearbyintOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional NearbyintOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void NearbyintOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void NearbyintOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult NearbyintOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult NearbyintOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void NearbyintOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr NearbyintOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags NearbyintOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void NearbyintOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void NearbyintOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void NearbyintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void NearbyintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NearbyintOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void NearbyintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NearbyintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void NearbyintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NearbyintOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void NearbyintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NearbyintOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void NearbyintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NearbyintOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void NearbyintOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult NearbyintOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult NearbyintOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult NearbyintOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult NearbyintOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void NearbyintOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void NearbyintOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::NearbyintOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::NoAliasScopeDeclOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +NoAliasScopeDeclOpGenericAdaptorBase::NoAliasScopeDeclOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.experimental.noalias.scope.decl", odsAttrs.getContext()); +} + +NoAliasScopeDeclOpGenericAdaptorBase::NoAliasScopeDeclOpGenericAdaptorBase(NoAliasScopeDeclOp op) : NoAliasScopeDeclOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair NoAliasScopeDeclOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr NoAliasScopeDeclOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::AliasScopeAttr NoAliasScopeDeclOpGenericAdaptorBase::getScopeAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::AliasScopeAttr>(getProperties().scope); + return attr; +} + +::mlir::LLVM::AliasScopeAttr NoAliasScopeDeclOpGenericAdaptorBase::getScope() { + auto attr = getScopeAttr(); + return ::llvm::cast<::mlir::LLVM::AliasScopeAttr>(attr); +} + +} // namespace detail +NoAliasScopeDeclOpAdaptor::NoAliasScopeDeclOpAdaptor(NoAliasScopeDeclOp op) : NoAliasScopeDeclOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult NoAliasScopeDeclOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_scope = getProperties().scope; (void)tblgen_scope; + if (!tblgen_scope) return emitError(loc, "'llvm.intr.experimental.noalias.scope.decl' op ""requires attribute 'scope'"); + + if (tblgen_scope && !((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(tblgen_scope)))) + return emitError(loc, "'llvm.intr.experimental.noalias.scope.decl' op ""attribute 'scope' failed to satisfy constraint: LLVM dialect alias scope"); + return ::mlir::success(); +} + +std::pair NoAliasScopeDeclOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range NoAliasScopeDeclOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair NoAliasScopeDeclOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range NoAliasScopeDeclOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult NoAliasScopeDeclOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.scope; + auto attr = dict.get("scope"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for scope in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `scope` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute NoAliasScopeDeclOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.scope; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("scope", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code NoAliasScopeDeclOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.scope.getAsOpaquePointer())); +} + +std::optional NoAliasScopeDeclOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "scope") + return prop.scope; + return std::nullopt; +} + +void NoAliasScopeDeclOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "scope") { + prop.scope = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void NoAliasScopeDeclOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.scope) attrs.append("scope", prop.scope); +} + +::mlir::LogicalResult NoAliasScopeDeclOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getScopeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps11(attr, "scope", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult NoAliasScopeDeclOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.scope))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void NoAliasScopeDeclOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.scope); +} + +::mlir::LLVM::AliasScopeAttr NoAliasScopeDeclOp::getScopeAttr() { + return ::llvm::cast<::mlir::LLVM::AliasScopeAttr>(getProperties().scope); +} + +::mlir::LLVM::AliasScopeAttr NoAliasScopeDeclOp::getScope() { + auto attr = getScopeAttr(); + return ::llvm::cast<::mlir::LLVM::AliasScopeAttr>(attr); +} + +void NoAliasScopeDeclOp::setScopeAttr(::mlir::LLVM::AliasScopeAttr attr) { + (*this)->setAttr(getScopeAttrName(), attr); +} + +void NoAliasScopeDeclOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AliasScopeAttr scope) { + odsState.getOrAddProperties().scope = scope; +} + +void NoAliasScopeDeclOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AliasScopeAttr scope) { + odsState.getOrAddProperties().scope = scope; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NoAliasScopeDeclOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult NoAliasScopeDeclOp::verifyInvariantsImpl() { + auto tblgen_scope = getProperties().scope; (void)tblgen_scope; + if (!tblgen_scope) return emitOpError("requires attribute 'scope'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps11(*this, tblgen_scope, "scope"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult NoAliasScopeDeclOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult NoAliasScopeDeclOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::LLVM::AliasScopeAttr scopeAttr; + + if (parser.parseCustomAttributeWithFallback(scopeAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (scopeAttr) result.getOrAddProperties().scope = scopeAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void NoAliasScopeDeclOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getScopeAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("scope"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::NoAliasScopeDeclOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PowIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PowIOpGenericAdaptorBase::PowIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.powi", odsAttrs.getContext()); +} + +PowIOpGenericAdaptorBase::PowIOpGenericAdaptorBase(PowIOp op) : PowIOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PowIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PowIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr PowIOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags PowIOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +PowIOpAdaptor::PowIOpAdaptor(PowIOp op) : PowIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PowIOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.powi' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair PowIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range PowIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value PowIOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> PowIOp::getPower() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &PowIOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &PowIOp::getPowerMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair PowIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PowIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value PowIOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult PowIOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute PowIOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PowIOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional PowIOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void PowIOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void PowIOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult PowIOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PowIOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PowIOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr PowIOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags PowIOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void PowIOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void PowIOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void PowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value power, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(val); + odsState.addOperands(power); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void PowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value power, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(val); + odsState.addOperands(power); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value power, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(val); + odsState.addOperands(power); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void PowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value power, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(val); + odsState.addOperands(power); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PowIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void PowIOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult PowIOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PowIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult PowIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PowIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void PowIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::PowIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PowOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PowOpGenericAdaptorBase::PowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.pow", odsAttrs.getContext()); +} + +PowOpGenericAdaptorBase::PowOpGenericAdaptorBase(PowOp op) : PowOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PowOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PowOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr PowOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags PowOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +PowOpAdaptor::PowOpAdaptor(PowOp op) : PowOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PowOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.pow' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair PowOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range PowOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value PowOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value PowOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &PowOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &PowOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair PowOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PowOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value PowOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult PowOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute PowOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PowOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional PowOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void PowOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void PowOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult PowOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PowOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PowOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr PowOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags PowOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void PowOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void PowOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PowOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PowOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PowOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void PowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PowOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void PowOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult PowOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PowOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult PowOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult PowOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PowOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void PowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::PowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Prefetch definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PrefetchGenericAdaptorBase::PrefetchGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.prefetch", odsAttrs.getContext()); +} + +PrefetchGenericAdaptorBase::PrefetchGenericAdaptorBase(Prefetch op) : PrefetchGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PrefetchGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PrefetchGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr PrefetchGenericAdaptorBase::getRwAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().rw); + return attr; +} + +uint32_t PrefetchGenericAdaptorBase::getRw() { + auto attr = getRwAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr PrefetchGenericAdaptorBase::getHintAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().hint); + return attr; +} + +uint32_t PrefetchGenericAdaptorBase::getHint() { + auto attr = getHintAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr PrefetchGenericAdaptorBase::getCacheAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().cache); + return attr; +} + +uint32_t PrefetchGenericAdaptorBase::getCache() { + auto attr = getCacheAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +PrefetchAdaptor::PrefetchAdaptor(Prefetch op) : PrefetchGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PrefetchAdaptor::verify(::mlir::Location loc) { + auto tblgen_cache = getProperties().cache; (void)tblgen_cache; + if (!tblgen_cache) return emitError(loc, "'llvm.intr.prefetch' op ""requires attribute 'cache'"); + auto tblgen_hint = getProperties().hint; (void)tblgen_hint; + if (!tblgen_hint) return emitError(loc, "'llvm.intr.prefetch' op ""requires attribute 'hint'"); + auto tblgen_rw = getProperties().rw; (void)tblgen_rw; + if (!tblgen_rw) return emitError(loc, "'llvm.intr.prefetch' op ""requires attribute 'rw'"); + + if (tblgen_rw && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_rw))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_rw).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.prefetch' op ""attribute 'rw' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_hint && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_hint))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_hint).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.prefetch' op ""attribute 'hint' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_cache && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_cache))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_cache).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.prefetch' op ""attribute 'cache' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair Prefetch::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Prefetch::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> Prefetch::getAddr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Prefetch::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Prefetch::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Prefetch::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult Prefetch::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cache; + auto attr = dict.get("cache"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for cache in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cache` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.hint; + auto attr = dict.get("hint"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for hint in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hint` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.rw; + auto attr = dict.get("rw"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for rw in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `rw` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Prefetch::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cache; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cache", + propStorage)); + } + + { + const auto &propStorage = prop.hint; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hint", + propStorage)); + } + + { + const auto &propStorage = prop.rw; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("rw", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Prefetch::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.cache.getAsOpaquePointer()), + llvm::hash_value(prop.hint.getAsOpaquePointer()), + llvm::hash_value(prop.rw.getAsOpaquePointer())); +} + +std::optional Prefetch::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cache") + return prop.cache; + + if (name == "hint") + return prop.hint; + + if (name == "rw") + return prop.rw; + return std::nullopt; +} + +void Prefetch::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cache") { + prop.cache = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "hint") { + prop.hint = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "rw") { + prop.rw = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Prefetch::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cache) attrs.append("cache", prop.cache); + + if (prop.hint) attrs.append("hint", prop.hint); + + if (prop.rw) attrs.append("rw", prop.rw); +} + +::mlir::LogicalResult Prefetch::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCacheAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "cache", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getHintAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "hint", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getRwAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "rw", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Prefetch::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.cache))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.hint))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.rw))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Prefetch::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.cache); + writer.writeAttribute(prop.hint); + writer.writeAttribute(prop.rw); +} + +::mlir::IntegerAttr Prefetch::getRwAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().rw); +} + +uint32_t Prefetch::getRw() { + auto attr = getRwAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr Prefetch::getHintAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().hint); +} + +uint32_t Prefetch::getHint() { + auto attr = getHintAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr Prefetch::getCacheAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().cache); +} + +uint32_t Prefetch::getCache() { + auto attr = getCacheAttr(); + return attr.getValue().getZExtValue(); +} + +void Prefetch::setRwAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getRwAttrName(), attr); +} + +void Prefetch::setRw(uint32_t attrValue) { + (*this)->setAttr(getRwAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void Prefetch::setHintAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getHintAttrName(), attr); +} + +void Prefetch::setHint(uint32_t attrValue) { + (*this)->setAttr(getHintAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void Prefetch::setCacheAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getCacheAttrName(), attr); +} + +void Prefetch::setCache(uint32_t attrValue) { + (*this)->setAttr(getCacheAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void Prefetch::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::IntegerAttr rw, ::mlir::IntegerAttr hint, ::mlir::IntegerAttr cache) { + odsState.addOperands(addr); + odsState.getOrAddProperties().rw = rw; + odsState.getOrAddProperties().hint = hint; + odsState.getOrAddProperties().cache = cache; +} + +void Prefetch::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::IntegerAttr rw, ::mlir::IntegerAttr hint, ::mlir::IntegerAttr cache) { + odsState.addOperands(addr); + odsState.getOrAddProperties().rw = rw; + odsState.getOrAddProperties().hint = hint; + odsState.getOrAddProperties().cache = cache; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Prefetch::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, uint32_t rw, uint32_t hint, uint32_t cache) { + odsState.addOperands(addr); + odsState.getOrAddProperties().rw = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rw); + odsState.getOrAddProperties().hint = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), hint); + odsState.getOrAddProperties().cache = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cache); +} + +void Prefetch::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, uint32_t rw, uint32_t hint, uint32_t cache) { + odsState.addOperands(addr); + odsState.getOrAddProperties().rw = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), rw); + odsState.getOrAddProperties().hint = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), hint); + odsState.getOrAddProperties().cache = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cache); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Prefetch::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult Prefetch::verifyInvariantsImpl() { + auto tblgen_cache = getProperties().cache; (void)tblgen_cache; + if (!tblgen_cache) return emitOpError("requires attribute 'cache'"); + auto tblgen_hint = getProperties().hint; (void)tblgen_hint; + if (!tblgen_hint) return emitOpError("requires attribute 'hint'"); + auto tblgen_rw = getProperties().rw; (void)tblgen_rw; + if (!tblgen_rw) return emitOpError("requires attribute 'rw'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_rw, "rw"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_hint, "hint"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_cache, "cache"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Prefetch::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::Prefetch) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PtrAnnotation definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PtrAnnotationGenericAdaptorBase::PtrAnnotationGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.ptr.annotation", odsAttrs.getContext()); +} + +PtrAnnotationGenericAdaptorBase::PtrAnnotationGenericAdaptorBase(PtrAnnotation op) : PtrAnnotationGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PtrAnnotationGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PtrAnnotationGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +PtrAnnotationAdaptor::PtrAnnotationAdaptor(PtrAnnotation op) : PtrAnnotationGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PtrAnnotationAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair PtrAnnotation::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range PtrAnnotation::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> PtrAnnotation::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> PtrAnnotation::getAnnotation() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> PtrAnnotation::getFileName() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> PtrAnnotation::getLine() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> PtrAnnotation::getAttr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &PtrAnnotation::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &PtrAnnotation::getAnnotationMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &PtrAnnotation::getFileNameMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &PtrAnnotation::getLineMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &PtrAnnotation::getAttrMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair PtrAnnotation::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PtrAnnotation::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> PtrAnnotation::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSResults(0).begin()); +} + +void PtrAnnotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr) { + odsState.addOperands(ptr); + odsState.addOperands(annotation); + odsState.addOperands(fileName); + odsState.addOperands(line); + odsState.addOperands(attr); + odsState.addTypes(res); +} + +void PtrAnnotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr) { + odsState.addOperands(ptr); + odsState.addOperands(annotation); + odsState.addOperands(fileName); + odsState.addOperands(line); + odsState.addOperands(attr); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PtrAnnotation::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void PtrAnnotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr) { + odsState.addOperands(ptr); + odsState.addOperands(annotation); + odsState.addOperands(fileName); + odsState.addOperands(line); + odsState.addOperands(attr); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PtrAnnotation::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void PtrAnnotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PtrAnnotation::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult PtrAnnotation::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps13(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps13(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that all of {res, ptr} have same type"); + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(4).begin()).getType()) && ((*this->getODSOperands(4).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {annotation, fileName, attr} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult PtrAnnotation::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult PtrAnnotation::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::PtrAnnotation) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::RintOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RintOpGenericAdaptorBase::RintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.rint", odsAttrs.getContext()); +} + +RintOpGenericAdaptorBase::RintOpGenericAdaptorBase(RintOp op) : RintOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RintOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RintOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr RintOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags RintOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +RintOpAdaptor::RintOpAdaptor(RintOp op) : RintOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RintOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.rint' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair RintOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RintOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RintOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RintOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RintOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RintOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RintOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RintOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RintOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RintOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional RintOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void RintOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RintOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult RintOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RintOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RintOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr RintOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags RintOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void RintOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void RintOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void RintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void RintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RintOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void RintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RintOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RintOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RintOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void RintOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult RintOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RintOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RintOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RintOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RintOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void RintOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::RintOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::RoundEvenOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RoundEvenOpGenericAdaptorBase::RoundEvenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.roundeven", odsAttrs.getContext()); +} + +RoundEvenOpGenericAdaptorBase::RoundEvenOpGenericAdaptorBase(RoundEvenOp op) : RoundEvenOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RoundEvenOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RoundEvenOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr RoundEvenOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags RoundEvenOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +RoundEvenOpAdaptor::RoundEvenOpAdaptor(RoundEvenOp op) : RoundEvenOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RoundEvenOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.roundeven' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair RoundEvenOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RoundEvenOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RoundEvenOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RoundEvenOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RoundEvenOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RoundEvenOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RoundEvenOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RoundEvenOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RoundEvenOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RoundEvenOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional RoundEvenOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void RoundEvenOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RoundEvenOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult RoundEvenOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RoundEvenOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RoundEvenOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr RoundEvenOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags RoundEvenOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void RoundEvenOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void RoundEvenOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundEvenOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundEvenOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoundEvenOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundEvenOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void RoundEvenOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult RoundEvenOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RoundEvenOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RoundEvenOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RoundEvenOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RoundEvenOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void RoundEvenOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::RoundEvenOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::RoundOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RoundOpGenericAdaptorBase::RoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.round", odsAttrs.getContext()); +} + +RoundOpGenericAdaptorBase::RoundOpGenericAdaptorBase(RoundOp op) : RoundOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RoundOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RoundOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr RoundOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags RoundOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +RoundOpAdaptor::RoundOpAdaptor(RoundOp op) : RoundOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RoundOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.round' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair RoundOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RoundOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RoundOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RoundOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RoundOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RoundOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RoundOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RoundOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RoundOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RoundOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional RoundOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void RoundOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RoundOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult RoundOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RoundOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RoundOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr RoundOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags RoundOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void RoundOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void RoundOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoundOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void RoundOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult RoundOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RoundOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RoundOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RoundOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RoundOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void RoundOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::RoundOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SAddSat definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SAddSatGenericAdaptorBase::SAddSatGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.sadd.sat", odsAttrs.getContext()); +} + +SAddSatGenericAdaptorBase::SAddSatGenericAdaptorBase(SAddSat op) : SAddSatGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SAddSatGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SAddSatGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SAddSatAdaptor::SAddSatAdaptor(SAddSat op) : SAddSatGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SAddSatAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SAddSat::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SAddSat::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SAddSat::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SAddSat::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SAddSat::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SAddSat::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SAddSat::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SAddSat::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SAddSat::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SAddSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void SAddSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SAddSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SAddSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SAddSat::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SAddSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SAddSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SAddSat::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SAddSat::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SAddSat::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SAddSat::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SAddSat::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void SAddSat::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SAddSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SAddWithOverflowOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SAddWithOverflowOpGenericAdaptorBase::SAddWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.sadd.with.overflow", odsAttrs.getContext()); +} + +SAddWithOverflowOpGenericAdaptorBase::SAddWithOverflowOpGenericAdaptorBase(SAddWithOverflowOp op) : SAddWithOverflowOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SAddWithOverflowOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SAddWithOverflowOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SAddWithOverflowOpAdaptor::SAddWithOverflowOpAdaptor(SAddWithOverflowOp op) : SAddWithOverflowOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SAddWithOverflowOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SAddWithOverflowOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SAddWithOverflowOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SAddWithOverflowOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SAddWithOverflowOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SAddWithOverflowOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SAddWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addTypes(res); +} + +void SAddWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SAddWithOverflowOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SAddWithOverflowOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SAddWithOverflowOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void SAddWithOverflowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SAddWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SMaxOpGenericAdaptorBase::SMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.smax", odsAttrs.getContext()); +} + +SMaxOpGenericAdaptorBase::SMaxOpGenericAdaptorBase(SMaxOp op) : SMaxOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SMaxOpAdaptor::SMaxOpAdaptor(SMaxOp op) : SMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SMaxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SMaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SMaxOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SMaxOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SMaxOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SMaxOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SMaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SMaxOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void SMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SMaxOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SMaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SMaxOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SMaxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SMaxOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void SMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SMinOpGenericAdaptorBase::SMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.smin", odsAttrs.getContext()); +} + +SMinOpGenericAdaptorBase::SMinOpGenericAdaptorBase(SMinOp op) : SMinOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SMinOpAdaptor::SMinOpAdaptor(SMinOp op) : SMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SMinOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SMinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SMinOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SMinOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SMinOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SMinOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SMinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SMinOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void SMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SMinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SMinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SMinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SMinOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SMinOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void SMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SMulWithOverflowOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SMulWithOverflowOpGenericAdaptorBase::SMulWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.smul.with.overflow", odsAttrs.getContext()); +} + +SMulWithOverflowOpGenericAdaptorBase::SMulWithOverflowOpGenericAdaptorBase(SMulWithOverflowOp op) : SMulWithOverflowOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SMulWithOverflowOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SMulWithOverflowOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SMulWithOverflowOpAdaptor::SMulWithOverflowOpAdaptor(SMulWithOverflowOp op) : SMulWithOverflowOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SMulWithOverflowOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SMulWithOverflowOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SMulWithOverflowOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SMulWithOverflowOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SMulWithOverflowOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SMulWithOverflowOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SMulWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addTypes(res); +} + +void SMulWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SMulWithOverflowOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SMulWithOverflowOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SMulWithOverflowOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void SMulWithOverflowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SMulWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SSACopyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SSACopyOpGenericAdaptorBase::SSACopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.ssa.copy", odsAttrs.getContext()); +} + +SSACopyOpGenericAdaptorBase::SSACopyOpGenericAdaptorBase(SSACopyOp op) : SSACopyOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SSACopyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SSACopyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SSACopyOpAdaptor::SSACopyOpAdaptor(SSACopyOp op) : SSACopyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SSACopyOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SSACopyOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SSACopyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SSACopyOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SSACopyOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SSACopyOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SSACopyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SSACopyOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SSACopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value operand) { + odsState.addOperands(operand); + odsState.addTypes(res); +} + +void SSACopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SSACopyOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SSACopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SSACopyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SSACopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SSACopyOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SSACopyOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SSACopyOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SSACopyOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SSACopyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + result.addTypes(operandTypes[0]); + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SSACopyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SSACopyOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SSACopyOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SSHLSat definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SSHLSatGenericAdaptorBase::SSHLSatGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.sshl.sat", odsAttrs.getContext()); +} + +SSHLSatGenericAdaptorBase::SSHLSatGenericAdaptorBase(SSHLSat op) : SSHLSatGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SSHLSatGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SSHLSatGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SSHLSatAdaptor::SSHLSatAdaptor(SSHLSat op) : SSHLSatGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SSHLSatAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SSHLSat::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SSHLSat::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SSHLSat::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SSHLSat::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SSHLSat::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SSHLSat::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SSHLSat::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SSHLSat::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SSHLSat::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SSHLSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void SSHLSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SSHLSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SSHLSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SSHLSat::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SSHLSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SSHLSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SSHLSat::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SSHLSat::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SSHLSat::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SSHLSat::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SSHLSat::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void SSHLSat::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SSHLSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SSubSat definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SSubSatGenericAdaptorBase::SSubSatGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.ssub.sat", odsAttrs.getContext()); +} + +SSubSatGenericAdaptorBase::SSubSatGenericAdaptorBase(SSubSat op) : SSubSatGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SSubSatGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SSubSatGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SSubSatAdaptor::SSubSatAdaptor(SSubSat op) : SSubSatGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SSubSatAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SSubSat::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SSubSat::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SSubSat::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SSubSat::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SSubSat::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SSubSat::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SSubSat::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SSubSat::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SSubSat::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SSubSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void SSubSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SSubSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SSubSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SSubSat::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SSubSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SSubSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SSubSat::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SSubSat::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SSubSat::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SSubSat::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SSubSat::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void SSubSat::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SSubSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SSubWithOverflowOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SSubWithOverflowOpGenericAdaptorBase::SSubWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.ssub.with.overflow", odsAttrs.getContext()); +} + +SSubWithOverflowOpGenericAdaptorBase::SSubWithOverflowOpGenericAdaptorBase(SSubWithOverflowOp op) : SSubWithOverflowOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SSubWithOverflowOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SSubWithOverflowOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SSubWithOverflowOpAdaptor::SSubWithOverflowOpAdaptor(SSubWithOverflowOp op) : SSubWithOverflowOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SSubWithOverflowOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SSubWithOverflowOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SSubWithOverflowOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SSubWithOverflowOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SSubWithOverflowOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SSubWithOverflowOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SSubWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addTypes(res); +} + +void SSubWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SSubWithOverflowOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SSubWithOverflowOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SSubWithOverflowOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void SSubWithOverflowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SSubWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SinOpGenericAdaptorBase::SinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.sin", odsAttrs.getContext()); +} + +SinOpGenericAdaptorBase::SinOpGenericAdaptorBase(SinOp op) : SinOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr SinOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags SinOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +SinOpAdaptor::SinOpAdaptor(SinOp op) : SinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SinOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.sin' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair SinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SinOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SinOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SinOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SinOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SinOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional SinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void SinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult SinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr SinOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags SinOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void SinOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void SinOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SinOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult SinOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SinOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void SinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SqrtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SqrtOpGenericAdaptorBase::SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.sqrt", odsAttrs.getContext()); +} + +SqrtOpGenericAdaptorBase::SqrtOpGenericAdaptorBase(SqrtOp op) : SqrtOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SqrtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SqrtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr SqrtOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags SqrtOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +SqrtOpAdaptor::SqrtOpAdaptor(SqrtOp op) : SqrtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SqrtOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.sqrt' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair SqrtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SqrtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SqrtOp::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SqrtOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SqrtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SqrtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SqrtOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SqrtOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SqrtOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SqrtOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional SqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void SqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult SqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SqrtOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SqrtOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr SqrtOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags SqrtOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void SqrtOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void SqrtOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SqrtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SqrtOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult SqrtOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SqrtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SqrtOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void SqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SqrtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::StackRestoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +StackRestoreOpGenericAdaptorBase::StackRestoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.stackrestore", odsAttrs.getContext()); +} + +StackRestoreOpGenericAdaptorBase::StackRestoreOpGenericAdaptorBase(StackRestoreOp op) : StackRestoreOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair StackRestoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr StackRestoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +StackRestoreOpAdaptor::StackRestoreOpAdaptor(StackRestoreOp op) : StackRestoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult StackRestoreOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair StackRestoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range StackRestoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> StackRestoreOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &StackRestoreOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair StackRestoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range StackRestoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void StackRestoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr) { + odsState.addOperands(ptr); +} + +void StackRestoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr) { + odsState.addOperands(ptr); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StackRestoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult StackRestoreOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult StackRestoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult StackRestoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand ptrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(ptrRawOperands); ::llvm::SMLoc ptrOperandsLoc; + (void)ptrOperandsLoc; + ::mlir::Type ptrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> ptrTypes(ptrRawTypes); + + ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ptrRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(ptrRawTypes[0])) + return ::mlir::failure(); + if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void StackRestoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getPtr(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getPtr().getType(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::StackRestoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::StackSaveOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +StackSaveOpGenericAdaptorBase::StackSaveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.stacksave", odsAttrs.getContext()); +} + +StackSaveOpGenericAdaptorBase::StackSaveOpGenericAdaptorBase(StackSaveOp op) : StackSaveOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair StackSaveOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr StackSaveOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +StackSaveOpAdaptor::StackSaveOpAdaptor(StackSaveOp op) : StackSaveOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult StackSaveOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair StackSaveOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range StackSaveOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair StackSaveOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range StackSaveOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value StackSaveOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void StackSaveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void StackSaveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StackSaveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult StackSaveOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult StackSaveOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult StackSaveOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(resRawTypes[0])) + return ::mlir::failure(); + result.addTypes(resTypes); + return ::mlir::success(); +} + +void StackSaveOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getRes().getType(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::StackSaveOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::StepVectorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +StepVectorOpGenericAdaptorBase::StepVectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.experimental.stepvector", odsAttrs.getContext()); +} + +StepVectorOpGenericAdaptorBase::StepVectorOpGenericAdaptorBase(StepVectorOp op) : StepVectorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair StepVectorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr StepVectorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +StepVectorOpAdaptor::StepVectorOpAdaptor(StepVectorOp op) : StepVectorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult StepVectorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair StepVectorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range StepVectorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair StepVectorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range StepVectorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value StepVectorOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void StepVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void StepVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StepVectorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult StepVectorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult StepVectorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult StepVectorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void StepVectorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void StepVectorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::StepVectorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ThreadlocalAddressOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ThreadlocalAddressOpGenericAdaptorBase::ThreadlocalAddressOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.threadlocal.address", odsAttrs.getContext()); +} + +ThreadlocalAddressOpGenericAdaptorBase::ThreadlocalAddressOpGenericAdaptorBase(ThreadlocalAddressOp op) : ThreadlocalAddressOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ThreadlocalAddressOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ThreadlocalAddressOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ThreadlocalAddressOpAdaptor::ThreadlocalAddressOpAdaptor(ThreadlocalAddressOp op) : ThreadlocalAddressOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ThreadlocalAddressOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ThreadlocalAddressOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ThreadlocalAddressOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> ThreadlocalAddressOp::getGlobal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ThreadlocalAddressOp::getGlobalMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ThreadlocalAddressOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ThreadlocalAddressOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ThreadlocalAddressOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ThreadlocalAddressOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value global) { + odsState.addOperands(global); + odsState.addTypes(res); +} + +void ThreadlocalAddressOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value global) { + odsState.addOperands(global); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadlocalAddressOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ThreadlocalAddressOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadlocalAddressOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void ThreadlocalAddressOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ThreadlocalAddressOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Trap definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TrapGenericAdaptorBase::TrapGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.trap", odsAttrs.getContext()); +} + +TrapGenericAdaptorBase::TrapGenericAdaptorBase(Trap op) : TrapGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TrapGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TrapGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TrapAdaptor::TrapAdaptor(Trap op) : TrapGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TrapAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair Trap::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Trap::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair Trap::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Trap::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void Trap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void Trap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Trap::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult Trap::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult Trap::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::Trap) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UAddSat definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UAddSatGenericAdaptorBase::UAddSatGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.uadd.sat", odsAttrs.getContext()); +} + +UAddSatGenericAdaptorBase::UAddSatGenericAdaptorBase(UAddSat op) : UAddSatGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UAddSatGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UAddSatGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UAddSatAdaptor::UAddSatAdaptor(UAddSat op) : UAddSatGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UAddSatAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UAddSat::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UAddSat::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UAddSat::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value UAddSat::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &UAddSat::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &UAddSat::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair UAddSat::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UAddSat::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UAddSat::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UAddSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void UAddSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(UAddSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void UAddSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UAddSat::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void UAddSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(UAddSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult UAddSat::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UAddSat::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult UAddSat::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult UAddSat::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UAddSat::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void UAddSat::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UAddSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UAddWithOverflowOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UAddWithOverflowOpGenericAdaptorBase::UAddWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.uadd.with.overflow", odsAttrs.getContext()); +} + +UAddWithOverflowOpGenericAdaptorBase::UAddWithOverflowOpGenericAdaptorBase(UAddWithOverflowOp op) : UAddWithOverflowOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UAddWithOverflowOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UAddWithOverflowOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UAddWithOverflowOpAdaptor::UAddWithOverflowOpAdaptor(UAddWithOverflowOp op) : UAddWithOverflowOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UAddWithOverflowOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UAddWithOverflowOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UAddWithOverflowOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair UAddWithOverflowOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UAddWithOverflowOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UAddWithOverflowOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UAddWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addTypes(res); +} + +void UAddWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UAddWithOverflowOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UAddWithOverflowOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UAddWithOverflowOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void UAddWithOverflowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UAddWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UBSanTrap definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UBSanTrapGenericAdaptorBase::UBSanTrapGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.ubsantrap", odsAttrs.getContext()); +} + +UBSanTrapGenericAdaptorBase::UBSanTrapGenericAdaptorBase(UBSanTrap op) : UBSanTrapGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UBSanTrapGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UBSanTrapGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr UBSanTrapGenericAdaptorBase::getFailureKindAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().failureKind); + return attr; +} + +uint8_t UBSanTrapGenericAdaptorBase::getFailureKind() { + auto attr = getFailureKindAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +UBSanTrapAdaptor::UBSanTrapAdaptor(UBSanTrap op) : UBSanTrapGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UBSanTrapAdaptor::verify(::mlir::Location loc) { + auto tblgen_failureKind = getProperties().failureKind; (void)tblgen_failureKind; + if (!tblgen_failureKind) return emitError(loc, "'llvm.intr.ubsantrap' op ""requires attribute 'failureKind'"); + + if (tblgen_failureKind && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_failureKind))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_failureKind).getType().isSignlessInteger(8))))) + return emitError(loc, "'llvm.intr.ubsantrap' op ""attribute 'failureKind' failed to satisfy constraint: 8-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair UBSanTrap::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UBSanTrap::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair UBSanTrap::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UBSanTrap::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult UBSanTrap::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.failureKind; + auto attr = dict.get("failureKind"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for failureKind in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `failureKind` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute UBSanTrap::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.failureKind; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("failureKind", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code UBSanTrap::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.failureKind.getAsOpaquePointer())); +} + +std::optional UBSanTrap::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "failureKind") + return prop.failureKind; + return std::nullopt; +} + +void UBSanTrap::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "failureKind") { + prop.failureKind = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void UBSanTrap::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.failureKind) attrs.append("failureKind", prop.failureKind); +} + +::mlir::LogicalResult UBSanTrap::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFailureKindAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps12(attr, "failureKind", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult UBSanTrap::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.failureKind))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UBSanTrap::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.failureKind); +} + +::mlir::IntegerAttr UBSanTrap::getFailureKindAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().failureKind); +} + +uint8_t UBSanTrap::getFailureKind() { + auto attr = getFailureKindAttr(); + return attr.getValue().getZExtValue(); +} + +void UBSanTrap::setFailureKindAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getFailureKindAttrName(), attr); +} + +void UBSanTrap::setFailureKind(uint8_t attrValue) { + (*this)->setAttr(getFailureKindAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(8), attrValue)); +} + +void UBSanTrap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr failureKind) { + odsState.getOrAddProperties().failureKind = failureKind; +} + +void UBSanTrap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr failureKind) { + odsState.getOrAddProperties().failureKind = failureKind; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UBSanTrap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint8_t failureKind) { + odsState.getOrAddProperties().failureKind = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(8), failureKind); +} + +void UBSanTrap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint8_t failureKind) { + odsState.getOrAddProperties().failureKind = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(8), failureKind); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UBSanTrap::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UBSanTrap::verifyInvariantsImpl() { + auto tblgen_failureKind = getProperties().failureKind; (void)tblgen_failureKind; + if (!tblgen_failureKind) return emitOpError("requires attribute 'failureKind'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps12(*this, tblgen_failureKind, "failureKind"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult UBSanTrap::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UBSanTrap) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UMaxOpGenericAdaptorBase::UMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.umax", odsAttrs.getContext()); +} + +UMaxOpGenericAdaptorBase::UMaxOpGenericAdaptorBase(UMaxOp op) : UMaxOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UMaxOpAdaptor::UMaxOpAdaptor(UMaxOp op) : UMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UMaxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UMaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UMaxOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value UMaxOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &UMaxOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &UMaxOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair UMaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UMaxOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void UMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(UMaxOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void UMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UMaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void UMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(UMaxOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult UMaxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult UMaxOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult UMaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UMaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void UMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UMinOpGenericAdaptorBase::UMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.umin", odsAttrs.getContext()); +} + +UMinOpGenericAdaptorBase::UMinOpGenericAdaptorBase(UMinOp op) : UMinOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UMinOpAdaptor::UMinOpAdaptor(UMinOp op) : UMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UMinOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UMinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UMinOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value UMinOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &UMinOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &UMinOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair UMinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UMinOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void UMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(UMinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void UMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UMinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void UMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(UMinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult UMinOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult UMinOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult UMinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UMinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void UMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UMulWithOverflowOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UMulWithOverflowOpGenericAdaptorBase::UMulWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.umul.with.overflow", odsAttrs.getContext()); +} + +UMulWithOverflowOpGenericAdaptorBase::UMulWithOverflowOpGenericAdaptorBase(UMulWithOverflowOp op) : UMulWithOverflowOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UMulWithOverflowOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UMulWithOverflowOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UMulWithOverflowOpAdaptor::UMulWithOverflowOpAdaptor(UMulWithOverflowOp op) : UMulWithOverflowOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UMulWithOverflowOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UMulWithOverflowOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UMulWithOverflowOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair UMulWithOverflowOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UMulWithOverflowOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UMulWithOverflowOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UMulWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addTypes(res); +} + +void UMulWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UMulWithOverflowOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UMulWithOverflowOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UMulWithOverflowOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void UMulWithOverflowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UMulWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::USHLSat definitions +//===----------------------------------------------------------------------===// + +namespace detail { +USHLSatGenericAdaptorBase::USHLSatGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.ushl.sat", odsAttrs.getContext()); +} + +USHLSatGenericAdaptorBase::USHLSatGenericAdaptorBase(USHLSat op) : USHLSatGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair USHLSatGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr USHLSatGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +USHLSatAdaptor::USHLSatAdaptor(USHLSat op) : USHLSatGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult USHLSatAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair USHLSat::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range USHLSat::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value USHLSat::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value USHLSat::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &USHLSat::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &USHLSat::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair USHLSat::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range USHLSat::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value USHLSat::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void USHLSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void USHLSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(USHLSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void USHLSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void USHLSat::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void USHLSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(USHLSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult USHLSat::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult USHLSat::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult USHLSat::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult USHLSat::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void USHLSat::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void USHLSat::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::USHLSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::USubSat definitions +//===----------------------------------------------------------------------===// + +namespace detail { +USubSatGenericAdaptorBase::USubSatGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.usub.sat", odsAttrs.getContext()); +} + +USubSatGenericAdaptorBase::USubSatGenericAdaptorBase(USubSat op) : USubSatGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair USubSatGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr USubSatGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +USubSatAdaptor::USubSatAdaptor(USubSat op) : USubSatGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult USubSatAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair USubSat::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range USubSat::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value USubSat::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value USubSat::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &USubSat::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &USubSat::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair USubSat::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range USubSat::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value USubSat::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void USubSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addTypes(res); +} + +void USubSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(USubSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void USubSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b) { + odsState.addOperands(a); + odsState.addOperands(b); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void USubSat::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void USubSat::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(USubSat::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult USubSat::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult USubSat::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult USubSat::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult USubSat::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void USubSat::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void USubSat::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::USubSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::USubWithOverflowOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +USubWithOverflowOpGenericAdaptorBase::USubWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.usub.with.overflow", odsAttrs.getContext()); +} + +USubWithOverflowOpGenericAdaptorBase::USubWithOverflowOpGenericAdaptorBase(USubWithOverflowOp op) : USubWithOverflowOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair USubWithOverflowOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr USubWithOverflowOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +USubWithOverflowOpAdaptor::USubWithOverflowOpAdaptor(USubWithOverflowOp op) : USubWithOverflowOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult USubWithOverflowOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair USubWithOverflowOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range USubWithOverflowOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair USubWithOverflowOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range USubWithOverflowOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value USubWithOverflowOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void USubWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addTypes(res); +} + +void USubWithOverflowOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void USubWithOverflowOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult USubWithOverflowOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult USubWithOverflowOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void USubWithOverflowOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::USubWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPAShrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPAShrOpGenericAdaptorBase::VPAShrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.ashr", odsAttrs.getContext()); +} + +VPAShrOpGenericAdaptorBase::VPAShrOpGenericAdaptorBase(VPAShrOp op) : VPAShrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPAShrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPAShrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPAShrOpAdaptor::VPAShrOpAdaptor(VPAShrOp op) : VPAShrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPAShrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPAShrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPAShrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPAShrOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPAShrOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPAShrOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPAShrOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPAShrOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPAShrOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPAShrOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPAShrOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPAShrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPAShrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPAShrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPAShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPAShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPAShrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPAShrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPAShrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPAShrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPAShrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPAddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPAddOpGenericAdaptorBase::VPAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.add", odsAttrs.getContext()); +} + +VPAddOpGenericAdaptorBase::VPAddOpGenericAdaptorBase(VPAddOp op) : VPAddOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPAddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPAddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPAddOpAdaptor::VPAddOpAdaptor(VPAddOp op) : VPAddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPAddOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPAddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPAddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPAddOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPAddOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPAddOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPAddOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPAddOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPAddOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPAddOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPAddOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPAddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPAddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPAddOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPAddOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPAddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPAndOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPAndOpGenericAdaptorBase::VPAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.and", odsAttrs.getContext()); +} + +VPAndOpGenericAdaptorBase::VPAndOpGenericAdaptorBase(VPAndOp op) : VPAndOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPAndOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPAndOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPAndOpAdaptor::VPAndOpAdaptor(VPAndOp op) : VPAndOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPAndOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPAndOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPAndOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPAndOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPAndOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPAndOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPAndOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPAndOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPAndOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPAndOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPAndOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPAndOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPAndOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPAndOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPAndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPAndOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPAndOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPAndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPAndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFAddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFAddOpGenericAdaptorBase::VPFAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fadd", odsAttrs.getContext()); +} + +VPFAddOpGenericAdaptorBase::VPFAddOpGenericAdaptorBase(VPFAddOp op) : VPFAddOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFAddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFAddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFAddOpAdaptor::VPFAddOpAdaptor(VPFAddOp op) : VPFAddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFAddOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFAddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFAddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFAddOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFAddOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPFAddOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFAddOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPFAddOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFAddOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFAddOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFAddOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFAddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFAddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFAddOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFAddOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFAddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFDivOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFDivOpGenericAdaptorBase::VPFDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fdiv", odsAttrs.getContext()); +} + +VPFDivOpGenericAdaptorBase::VPFDivOpGenericAdaptorBase(VPFDivOp op) : VPFDivOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFDivOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFDivOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFDivOpAdaptor::VPFDivOpAdaptor(VPFDivOp op) : VPFDivOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFDivOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFDivOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFDivOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFDivOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFDivOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPFDivOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFDivOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPFDivOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFDivOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFDivOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFDivOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFDivOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFDivOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFDivOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFDivOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFDivOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFMulAddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFMulAddOpGenericAdaptorBase::VPFMulAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fmuladd", odsAttrs.getContext()); +} + +VPFMulAddOpGenericAdaptorBase::VPFMulAddOpGenericAdaptorBase(VPFMulAddOp op) : VPFMulAddOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFMulAddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFMulAddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFMulAddOpAdaptor::VPFMulAddOpAdaptor(VPFMulAddOp op) : VPFMulAddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFMulAddOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFMulAddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFMulAddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFMulAddOp::getOp1() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFMulAddOp::getOp2() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPFMulAddOp::getOp3() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value VPFMulAddOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFMulAddOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &VPFMulAddOp::getOp1Mutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFMulAddOp::getOp2Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFMulAddOp::getOp3Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFMulAddOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFMulAddOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFMulAddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFMulAddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFMulAddOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value op1, ::mlir::Value op2, ::mlir::Value op3, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(op1); + odsState.addOperands(op2); + odsState.addOperands(op3); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFMulAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value op1, ::mlir::Value op2, ::mlir::Value op3, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(op1); + odsState.addOperands(op2); + odsState.addOperands(op3); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFMulAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFMulAddOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFMulAddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFMulAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFMulAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFMulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFMulOpGenericAdaptorBase::VPFMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fmul", odsAttrs.getContext()); +} + +VPFMulOpGenericAdaptorBase::VPFMulOpGenericAdaptorBase(VPFMulOp op) : VPFMulOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFMulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFMulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFMulOpAdaptor::VPFMulOpAdaptor(VPFMulOp op) : VPFMulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFMulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFMulOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFMulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFMulOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFMulOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPFMulOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFMulOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPFMulOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFMulOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFMulOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFMulOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFMulOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFMulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFMulOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFMulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFMulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFMulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFNegOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFNegOpGenericAdaptorBase::VPFNegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fneg", odsAttrs.getContext()); +} + +VPFNegOpGenericAdaptorBase::VPFNegOpGenericAdaptorBase(VPFNegOp op) : VPFNegOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFNegOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFNegOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFNegOpAdaptor::VPFNegOpAdaptor(VPFNegOp op) : VPFNegOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFNegOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFNegOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFNegOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFNegOp::getOp() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFNegOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFNegOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPFNegOp::getOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFNegOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFNegOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFNegOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFNegOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFNegOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value op, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(op); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value op, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(op); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFNegOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFNegOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFNegOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFNegOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFNegOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFPExtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFPExtOpGenericAdaptorBase::VPFPExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fpext", odsAttrs.getContext()); +} + +VPFPExtOpGenericAdaptorBase::VPFPExtOpGenericAdaptorBase(VPFPExtOp op) : VPFPExtOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFPExtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFPExtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFPExtOpAdaptor::VPFPExtOpAdaptor(VPFPExtOp op) : VPFPExtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFPExtOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFPExtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFPExtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFPExtOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFPExtOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFPExtOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPFPExtOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFPExtOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFPExtOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFPExtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFPExtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFPExtOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFPExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFPExtOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFPExtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFPExtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFPExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFPToSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFPToSIOpGenericAdaptorBase::VPFPToSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fptosi", odsAttrs.getContext()); +} + +VPFPToSIOpGenericAdaptorBase::VPFPToSIOpGenericAdaptorBase(VPFPToSIOp op) : VPFPToSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFPToSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFPToSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFPToSIOpAdaptor::VPFPToSIOpAdaptor(VPFPToSIOp op) : VPFPToSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFPToSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFPToSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFPToSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFPToSIOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFPToSIOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFPToSIOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPFPToSIOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFPToSIOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFPToSIOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFPToSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFPToSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFPToSIOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFPToSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFPToSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFPToSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFPToSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFPToSIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFPToUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFPToUIOpGenericAdaptorBase::VPFPToUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fptoui", odsAttrs.getContext()); +} + +VPFPToUIOpGenericAdaptorBase::VPFPToUIOpGenericAdaptorBase(VPFPToUIOp op) : VPFPToUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFPToUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFPToUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFPToUIOpAdaptor::VPFPToUIOpAdaptor(VPFPToUIOp op) : VPFPToUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFPToUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFPToUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFPToUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFPToUIOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFPToUIOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFPToUIOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPFPToUIOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFPToUIOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFPToUIOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFPToUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFPToUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFPToUIOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFPToUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFPToUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFPToUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFPToUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFPToUIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFPTruncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFPTruncOpGenericAdaptorBase::VPFPTruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fptrunc", odsAttrs.getContext()); +} + +VPFPTruncOpGenericAdaptorBase::VPFPTruncOpGenericAdaptorBase(VPFPTruncOp op) : VPFPTruncOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFPTruncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFPTruncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFPTruncOpAdaptor::VPFPTruncOpAdaptor(VPFPTruncOp op) : VPFPTruncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFPTruncOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFPTruncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFPTruncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFPTruncOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFPTruncOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFPTruncOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPFPTruncOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFPTruncOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFPTruncOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFPTruncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFPTruncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFPTruncOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFPTruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFPTruncOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFPTruncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFPTruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFPTruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFRemOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFRemOpGenericAdaptorBase::VPFRemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.frem", odsAttrs.getContext()); +} + +VPFRemOpGenericAdaptorBase::VPFRemOpGenericAdaptorBase(VPFRemOp op) : VPFRemOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFRemOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFRemOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFRemOpAdaptor::VPFRemOpAdaptor(VPFRemOp op) : VPFRemOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFRemOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFRemOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFRemOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFRemOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFRemOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPFRemOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFRemOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPFRemOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFRemOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFRemOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFRemOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFRemOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFRemOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFRemOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFRemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFRemOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFRemOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFRemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFRemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFSubOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFSubOpGenericAdaptorBase::VPFSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fsub", odsAttrs.getContext()); +} + +VPFSubOpGenericAdaptorBase::VPFSubOpGenericAdaptorBase(VPFSubOp op) : VPFSubOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFSubOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFSubOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFSubOpAdaptor::VPFSubOpAdaptor(VPFSubOp op) : VPFSubOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFSubOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFSubOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFSubOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFSubOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFSubOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPFSubOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFSubOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPFSubOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFSubOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFSubOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFSubOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFSubOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFSubOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFSubOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFSubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFSubOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFSubOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFSubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFSubOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFmaOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPFmaOpGenericAdaptorBase::VPFmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.fma", odsAttrs.getContext()); +} + +VPFmaOpGenericAdaptorBase::VPFmaOpGenericAdaptorBase(VPFmaOp op) : VPFmaOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPFmaOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPFmaOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPFmaOpAdaptor::VPFmaOpAdaptor(VPFmaOp op) : VPFmaOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPFmaOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPFmaOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPFmaOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFmaOp::getOp1() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPFmaOp::getOp2() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPFmaOp::getOp3() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value VPFmaOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPFmaOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &VPFmaOp::getOp1Mutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFmaOp::getOp2Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFmaOp::getOp3Mutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFmaOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPFmaOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPFmaOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPFmaOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPFmaOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPFmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value op1, ::mlir::Value op2, ::mlir::Value op3, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(op1); + odsState.addOperands(op2); + odsState.addOperands(op3); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPFmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value op1, ::mlir::Value op2, ::mlir::Value op3, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(op1); + odsState.addOperands(op2); + odsState.addOperands(op3); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPFmaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPFmaOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPFmaOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPFmaOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFmaOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPIntToPtrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPIntToPtrOpGenericAdaptorBase::VPIntToPtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.inttoptr", odsAttrs.getContext()); +} + +VPIntToPtrOpGenericAdaptorBase::VPIntToPtrOpGenericAdaptorBase(VPIntToPtrOp op) : VPIntToPtrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPIntToPtrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPIntToPtrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPIntToPtrOpAdaptor::VPIntToPtrOpAdaptor(VPIntToPtrOp op) : VPIntToPtrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPIntToPtrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPIntToPtrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPIntToPtrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPIntToPtrOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPIntToPtrOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPIntToPtrOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPIntToPtrOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPIntToPtrOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPIntToPtrOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPIntToPtrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPIntToPtrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPIntToPtrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPIntToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPIntToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPIntToPtrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPIntToPtrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPIntToPtrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPIntToPtrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPIntToPtrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPLShrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPLShrOpGenericAdaptorBase::VPLShrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.lshr", odsAttrs.getContext()); +} + +VPLShrOpGenericAdaptorBase::VPLShrOpGenericAdaptorBase(VPLShrOp op) : VPLShrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPLShrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPLShrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPLShrOpAdaptor::VPLShrOpAdaptor(VPLShrOp op) : VPLShrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPLShrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPLShrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPLShrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPLShrOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPLShrOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPLShrOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPLShrOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPLShrOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPLShrOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPLShrOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPLShrOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPLShrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPLShrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPLShrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPLShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPLShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPLShrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPLShrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPLShrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPLShrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPLShrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPLoadOpGenericAdaptorBase::VPLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.load", odsAttrs.getContext()); +} + +VPLoadOpGenericAdaptorBase::VPLoadOpGenericAdaptorBase(VPLoadOp op) : VPLoadOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPLoadOpAdaptor::VPLoadOpAdaptor(VPLoadOp op) : VPLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPLoadOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPLoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> VPLoadOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPLoadOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPLoadOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPLoadOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPLoadOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPLoadOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPLoadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(ptr); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(ptr); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPLoadOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPLoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPMergeMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPMergeMinOpGenericAdaptorBase::VPMergeMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.merge", odsAttrs.getContext()); +} + +VPMergeMinOpGenericAdaptorBase::VPMergeMinOpGenericAdaptorBase(VPMergeMinOp op) : VPMergeMinOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPMergeMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPMergeMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPMergeMinOpAdaptor::VPMergeMinOpAdaptor(VPMergeMinOp op) : VPMergeMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPMergeMinOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPMergeMinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPMergeMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPMergeMinOp::getCond() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPMergeMinOp::getTrueVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPMergeMinOp::getFalseVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPMergeMinOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPMergeMinOp::getCondMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPMergeMinOp::getTrueValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPMergeMinOp::getFalseValMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPMergeMinOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPMergeMinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPMergeMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPMergeMinOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPMergeMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value cond, ::mlir::Value true_val, ::mlir::Value false_val, ::mlir::Value evl) { + odsState.addOperands(cond); + odsState.addOperands(true_val); + odsState.addOperands(false_val); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPMergeMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::Value true_val, ::mlir::Value false_val, ::mlir::Value evl) { + odsState.addOperands(cond); + odsState.addOperands(true_val); + odsState.addOperands(false_val); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPMergeMinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPMergeMinOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPMergeMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPMergeMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPMergeMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPMulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPMulOpGenericAdaptorBase::VPMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.mul", odsAttrs.getContext()); +} + +VPMulOpGenericAdaptorBase::VPMulOpGenericAdaptorBase(VPMulOp op) : VPMulOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPMulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPMulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPMulOpAdaptor::VPMulOpAdaptor(VPMulOp op) : VPMulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPMulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPMulOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPMulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPMulOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPMulOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPMulOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPMulOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPMulOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPMulOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPMulOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPMulOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPMulOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPMulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPMulOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPMulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPMulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPMulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPOrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPOrOpGenericAdaptorBase::VPOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.or", odsAttrs.getContext()); +} + +VPOrOpGenericAdaptorBase::VPOrOpGenericAdaptorBase(VPOrOp op) : VPOrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPOrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPOrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPOrOpAdaptor::VPOrOpAdaptor(VPOrOp op) : VPOrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPOrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPOrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPOrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPOrOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPOrOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPOrOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPOrOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPOrOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPOrOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPOrOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPOrOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPOrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPOrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPOrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPOrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPOrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPOrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPOrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPPtrToIntOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPPtrToIntOpGenericAdaptorBase::VPPtrToIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.ptrtoint", odsAttrs.getContext()); +} + +VPPtrToIntOpGenericAdaptorBase::VPPtrToIntOpGenericAdaptorBase(VPPtrToIntOp op) : VPPtrToIntOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPPtrToIntOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPPtrToIntOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPPtrToIntOpAdaptor::VPPtrToIntOpAdaptor(VPPtrToIntOp op) : VPPtrToIntOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPPtrToIntOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPPtrToIntOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPPtrToIntOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPPtrToIntOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPPtrToIntOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPPtrToIntOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPPtrToIntOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPPtrToIntOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPPtrToIntOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPPtrToIntOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPPtrToIntOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPPtrToIntOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPPtrToIntOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPPtrToIntOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPPtrToIntOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPPtrToIntOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps17(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPPtrToIntOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPPtrToIntOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPPtrToIntOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceAddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceAddOpGenericAdaptorBase::VPReduceAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.add", odsAttrs.getContext()); +} + +VPReduceAddOpGenericAdaptorBase::VPReduceAddOpGenericAdaptorBase(VPReduceAddOp op) : VPReduceAddOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceAddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceAddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceAddOpAdaptor::VPReduceAddOpAdaptor(VPReduceAddOp op) : VPReduceAddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceAddOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceAddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceAddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceAddOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceAddOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceAddOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceAddOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceAddOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceAddOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceAddOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceAddOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceAddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceAddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceAddOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceAddOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceAddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceAndOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceAndOpGenericAdaptorBase::VPReduceAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.and", odsAttrs.getContext()); +} + +VPReduceAndOpGenericAdaptorBase::VPReduceAndOpGenericAdaptorBase(VPReduceAndOp op) : VPReduceAndOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceAndOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceAndOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceAndOpAdaptor::VPReduceAndOpAdaptor(VPReduceAndOp op) : VPReduceAndOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceAndOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceAndOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceAndOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceAndOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceAndOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceAndOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceAndOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceAndOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceAndOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceAndOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceAndOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceAndOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceAndOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceAndOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceAndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceAndOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceAndOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceAndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceAndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceFAddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceFAddOpGenericAdaptorBase::VPReduceFAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.fadd", odsAttrs.getContext()); +} + +VPReduceFAddOpGenericAdaptorBase::VPReduceFAddOpGenericAdaptorBase(VPReduceFAddOp op) : VPReduceFAddOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceFAddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceFAddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceFAddOpAdaptor::VPReduceFAddOpAdaptor(VPReduceFAddOp op) : VPReduceFAddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceFAddOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceFAddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceFAddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> VPReduceFAddOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceFAddOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceFAddOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceFAddOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceFAddOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFAddOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFAddOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFAddOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceFAddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceFAddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceFAddOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceFAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceFAddOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps18(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceFAddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceFAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceFAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceFMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceFMaxOpGenericAdaptorBase::VPReduceFMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.fmax", odsAttrs.getContext()); +} + +VPReduceFMaxOpGenericAdaptorBase::VPReduceFMaxOpGenericAdaptorBase(VPReduceFMaxOp op) : VPReduceFMaxOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceFMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceFMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceFMaxOpAdaptor::VPReduceFMaxOpAdaptor(VPReduceFMaxOp op) : VPReduceFMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceFMaxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceFMaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceFMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> VPReduceFMaxOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceFMaxOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceFMaxOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceFMaxOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceFMaxOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFMaxOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFMaxOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFMaxOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceFMaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceFMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceFMaxOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceFMaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceFMaxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps18(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceFMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceFMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceFMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceFMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceFMinOpGenericAdaptorBase::VPReduceFMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.fmin", odsAttrs.getContext()); +} + +VPReduceFMinOpGenericAdaptorBase::VPReduceFMinOpGenericAdaptorBase(VPReduceFMinOp op) : VPReduceFMinOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceFMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceFMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceFMinOpAdaptor::VPReduceFMinOpAdaptor(VPReduceFMinOp op) : VPReduceFMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceFMinOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceFMinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceFMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> VPReduceFMinOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceFMinOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceFMinOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceFMinOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceFMinOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFMinOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFMinOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFMinOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceFMinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceFMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceFMinOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceFMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceFMinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceFMinOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps18(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceFMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceFMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceFMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceFMulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceFMulOpGenericAdaptorBase::VPReduceFMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.fmul", odsAttrs.getContext()); +} + +VPReduceFMulOpGenericAdaptorBase::VPReduceFMulOpGenericAdaptorBase(VPReduceFMulOp op) : VPReduceFMulOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceFMulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceFMulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceFMulOpAdaptor::VPReduceFMulOpAdaptor(VPReduceFMulOp op) : VPReduceFMulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceFMulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceFMulOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceFMulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> VPReduceFMulOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceFMulOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceFMulOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceFMulOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceFMulOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFMulOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFMulOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceFMulOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceFMulOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceFMulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceFMulOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceFMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceFMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceFMulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceFMulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps18(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceFMulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceFMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceFMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceMulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceMulOpGenericAdaptorBase::VPReduceMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.mul", odsAttrs.getContext()); +} + +VPReduceMulOpGenericAdaptorBase::VPReduceMulOpGenericAdaptorBase(VPReduceMulOp op) : VPReduceMulOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceMulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceMulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceMulOpAdaptor::VPReduceMulOpAdaptor(VPReduceMulOp op) : VPReduceMulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceMulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceMulOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceMulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceMulOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceMulOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceMulOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceMulOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceMulOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceMulOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceMulOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceMulOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceMulOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceMulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceMulOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceMulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceMulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceMulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceOrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceOrOpGenericAdaptorBase::VPReduceOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.or", odsAttrs.getContext()); +} + +VPReduceOrOpGenericAdaptorBase::VPReduceOrOpGenericAdaptorBase(VPReduceOrOp op) : VPReduceOrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceOrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceOrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceOrOpAdaptor::VPReduceOrOpAdaptor(VPReduceOrOp op) : VPReduceOrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceOrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceOrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceOrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceOrOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceOrOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceOrOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceOrOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceOrOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceOrOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceOrOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceOrOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceOrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceOrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceOrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceOrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceOrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceOrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceOrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceSMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceSMaxOpGenericAdaptorBase::VPReduceSMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.smax", odsAttrs.getContext()); +} + +VPReduceSMaxOpGenericAdaptorBase::VPReduceSMaxOpGenericAdaptorBase(VPReduceSMaxOp op) : VPReduceSMaxOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceSMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceSMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceSMaxOpAdaptor::VPReduceSMaxOpAdaptor(VPReduceSMaxOp op) : VPReduceSMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceSMaxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceSMaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceSMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceSMaxOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceSMaxOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceSMaxOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceSMaxOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceSMaxOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceSMaxOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceSMaxOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceSMaxOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceSMaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceSMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceSMaxOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceSMaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceSMaxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceSMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceSMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceSMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceSMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceSMinOpGenericAdaptorBase::VPReduceSMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.smin", odsAttrs.getContext()); +} + +VPReduceSMinOpGenericAdaptorBase::VPReduceSMinOpGenericAdaptorBase(VPReduceSMinOp op) : VPReduceSMinOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceSMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceSMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceSMinOpAdaptor::VPReduceSMinOpAdaptor(VPReduceSMinOp op) : VPReduceSMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceSMinOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceSMinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceSMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceSMinOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceSMinOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceSMinOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceSMinOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceSMinOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceSMinOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceSMinOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceSMinOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceSMinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceSMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceSMinOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceSMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceSMinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceSMinOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceSMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceSMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceSMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceUMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceUMaxOpGenericAdaptorBase::VPReduceUMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.umax", odsAttrs.getContext()); +} + +VPReduceUMaxOpGenericAdaptorBase::VPReduceUMaxOpGenericAdaptorBase(VPReduceUMaxOp op) : VPReduceUMaxOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceUMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceUMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceUMaxOpAdaptor::VPReduceUMaxOpAdaptor(VPReduceUMaxOp op) : VPReduceUMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceUMaxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceUMaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceUMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceUMaxOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceUMaxOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceUMaxOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceUMaxOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceUMaxOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceUMaxOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceUMaxOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceUMaxOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceUMaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceUMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceUMaxOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceUMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceUMaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceUMaxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceUMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceUMaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceUMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceUMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceUMinOpGenericAdaptorBase::VPReduceUMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.umin", odsAttrs.getContext()); +} + +VPReduceUMinOpGenericAdaptorBase::VPReduceUMinOpGenericAdaptorBase(VPReduceUMinOp op) : VPReduceUMinOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceUMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceUMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceUMinOpAdaptor::VPReduceUMinOpAdaptor(VPReduceUMinOp op) : VPReduceUMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceUMinOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceUMinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceUMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceUMinOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceUMinOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceUMinOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceUMinOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceUMinOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceUMinOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceUMinOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceUMinOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceUMinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceUMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceUMinOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceUMinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceUMinOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceUMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceUMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceUMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceXorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPReduceXorOpGenericAdaptorBase::VPReduceXorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.reduce.xor", odsAttrs.getContext()); +} + +VPReduceXorOpGenericAdaptorBase::VPReduceXorOpGenericAdaptorBase(VPReduceXorOp op) : VPReduceXorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPReduceXorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPReduceXorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPReduceXorOpAdaptor::VPReduceXorOpAdaptor(VPReduceXorOp op) : VPReduceXorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPReduceXorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPReduceXorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPReduceXorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceXorOp::getSatrtValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value VPReduceXorOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPReduceXorOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPReduceXorOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPReduceXorOp::getSatrtValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceXorOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceXorOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPReduceXorOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPReduceXorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPReduceXorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPReduceXorOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPReduceXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPReduceXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(satrt_value); + odsState.addOperands(val); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPReduceXorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPReduceXorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPReduceXorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPReduceXorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceXorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSDivOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPSDivOpGenericAdaptorBase::VPSDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.sdiv", odsAttrs.getContext()); +} + +VPSDivOpGenericAdaptorBase::VPSDivOpGenericAdaptorBase(VPSDivOp op) : VPSDivOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPSDivOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPSDivOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPSDivOpAdaptor::VPSDivOpAdaptor(VPSDivOp op) : VPSDivOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPSDivOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPSDivOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPSDivOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSDivOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPSDivOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPSDivOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPSDivOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPSDivOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSDivOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSDivOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSDivOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPSDivOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPSDivOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSDivOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPSDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPSDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPSDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPSDivOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPSDivOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPSDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSExtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPSExtOpGenericAdaptorBase::VPSExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.sext", odsAttrs.getContext()); +} + +VPSExtOpGenericAdaptorBase::VPSExtOpGenericAdaptorBase(VPSExtOp op) : VPSExtOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPSExtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPSExtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPSExtOpAdaptor::VPSExtOpAdaptor(VPSExtOp op) : VPSExtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPSExtOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPSExtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPSExtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSExtOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPSExtOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPSExtOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPSExtOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSExtOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSExtOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPSExtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPSExtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSExtOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPSExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPSExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPSExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPSExtOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPSExtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPSExtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSIToFPOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPSIToFPOpGenericAdaptorBase::VPSIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.sitofp", odsAttrs.getContext()); +} + +VPSIToFPOpGenericAdaptorBase::VPSIToFPOpGenericAdaptorBase(VPSIToFPOp op) : VPSIToFPOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPSIToFPOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPSIToFPOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPSIToFPOpAdaptor::VPSIToFPOpAdaptor(VPSIToFPOp op) : VPSIToFPOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPSIToFPOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPSIToFPOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPSIToFPOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSIToFPOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPSIToFPOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPSIToFPOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPSIToFPOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSIToFPOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSIToFPOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPSIToFPOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPSIToFPOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSIToFPOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPSIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPSIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPSIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPSIToFPOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPSIToFPOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPSIToFPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSIToFPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSRemOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPSRemOpGenericAdaptorBase::VPSRemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.srem", odsAttrs.getContext()); +} + +VPSRemOpGenericAdaptorBase::VPSRemOpGenericAdaptorBase(VPSRemOp op) : VPSRemOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPSRemOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPSRemOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPSRemOpAdaptor::VPSRemOpAdaptor(VPSRemOp op) : VPSRemOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPSRemOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPSRemOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPSRemOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSRemOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPSRemOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPSRemOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPSRemOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPSRemOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSRemOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSRemOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSRemOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPSRemOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPSRemOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSRemOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPSRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPSRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPSRemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPSRemOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPSRemOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPSRemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSRemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSelectMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPSelectMinOpGenericAdaptorBase::VPSelectMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.select", odsAttrs.getContext()); +} + +VPSelectMinOpGenericAdaptorBase::VPSelectMinOpGenericAdaptorBase(VPSelectMinOp op) : VPSelectMinOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPSelectMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPSelectMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPSelectMinOpAdaptor::VPSelectMinOpAdaptor(VPSelectMinOp op) : VPSelectMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPSelectMinOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPSelectMinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPSelectMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSelectMinOp::getCond() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPSelectMinOp::getTrueVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPSelectMinOp::getFalseVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPSelectMinOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPSelectMinOp::getCondMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSelectMinOp::getTrueValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSelectMinOp::getFalseValMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSelectMinOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPSelectMinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPSelectMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSelectMinOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPSelectMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value cond, ::mlir::Value true_val, ::mlir::Value false_val, ::mlir::Value evl) { + odsState.addOperands(cond); + odsState.addOperands(true_val); + odsState.addOperands(false_val); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPSelectMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::Value true_val, ::mlir::Value false_val, ::mlir::Value evl) { + odsState.addOperands(cond); + odsState.addOperands(true_val); + odsState.addOperands(false_val); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPSelectMinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPSelectMinOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPSelectMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPSelectMinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSelectMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPShlOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPShlOpGenericAdaptorBase::VPShlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.shl", odsAttrs.getContext()); +} + +VPShlOpGenericAdaptorBase::VPShlOpGenericAdaptorBase(VPShlOp op) : VPShlOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPShlOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPShlOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPShlOpAdaptor::VPShlOpAdaptor(VPShlOp op) : VPShlOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPShlOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPShlOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPShlOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPShlOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPShlOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPShlOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPShlOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPShlOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPShlOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPShlOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPShlOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPShlOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPShlOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPShlOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPShlOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPShlOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPShlOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPShlOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPShlOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPStoreOpGenericAdaptorBase::VPStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.store", odsAttrs.getContext()); +} + +VPStoreOpGenericAdaptorBase::VPStoreOpGenericAdaptorBase(VPStoreOp op) : VPStoreOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPStoreOpAdaptor::VPStoreOpAdaptor(VPStoreOp op) : VPStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPStoreOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPStoreOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> VPStoreOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::Value VPStoreOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPStoreOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPStoreOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStoreOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStoreOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStoreOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void VPStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value ptr, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(val); + odsState.addOperands(ptr); + odsState.addOperands(mask); + odsState.addOperands(evl); +} + +void VPStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value ptr, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(val); + odsState.addOperands(ptr); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPStoreOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPStoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPStridedLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPStridedLoadOpGenericAdaptorBase::VPStridedLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.experimental.vp.strided.load", odsAttrs.getContext()); +} + +VPStridedLoadOpGenericAdaptorBase::VPStridedLoadOpGenericAdaptorBase(VPStridedLoadOp op) : VPStridedLoadOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPStridedLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPStridedLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPStridedLoadOpAdaptor::VPStridedLoadOpAdaptor(VPStridedLoadOp op) : VPStridedLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPStridedLoadOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPStridedLoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPStridedLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> VPStridedLoadOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPStridedLoadOp::getStride() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::Value VPStridedLoadOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPStridedLoadOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPStridedLoadOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStridedLoadOp::getStrideMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStridedLoadOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStridedLoadOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPStridedLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPStridedLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPStridedLoadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPStridedLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(ptr); + odsState.addOperands(stride); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPStridedLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(ptr); + odsState.addOperands(stride); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPStridedLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPStridedLoadOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPStridedLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPStridedLoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPStridedStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPStridedStoreOpGenericAdaptorBase::VPStridedStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.experimental.vp.strided.store", odsAttrs.getContext()); +} + +VPStridedStoreOpGenericAdaptorBase::VPStridedStoreOpGenericAdaptorBase(VPStridedStoreOp op) : VPStridedStoreOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPStridedStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPStridedStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPStridedStoreOpAdaptor::VPStridedStoreOpAdaptor(VPStridedStoreOp op) : VPStridedStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPStridedStoreOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPStridedStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPStridedStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPStridedStoreOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> VPStridedStoreOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPStridedStoreOp::getStride() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::Value VPStridedStoreOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPStridedStoreOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &VPStridedStoreOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStridedStoreOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStridedStoreOp::getStrideMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStridedStoreOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPStridedStoreOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPStridedStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPStridedStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void VPStridedStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(val); + odsState.addOperands(ptr); + odsState.addOperands(stride); + odsState.addOperands(mask); + odsState.addOperands(evl); +} + +void VPStridedStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(val); + odsState.addOperands(ptr); + odsState.addOperands(stride); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPStridedStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPStridedStoreOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPStridedStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPStridedStoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSubOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPSubOpGenericAdaptorBase::VPSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.sub", odsAttrs.getContext()); +} + +VPSubOpGenericAdaptorBase::VPSubOpGenericAdaptorBase(VPSubOp op) : VPSubOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPSubOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPSubOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPSubOpAdaptor::VPSubOpAdaptor(VPSubOp op) : VPSubOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPSubOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPSubOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPSubOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSubOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPSubOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPSubOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPSubOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPSubOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSubOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSubOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPSubOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPSubOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPSubOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPSubOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPSubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPSubOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPSubOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPSubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSubOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPTruncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPTruncOpGenericAdaptorBase::VPTruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.trunc", odsAttrs.getContext()); +} + +VPTruncOpGenericAdaptorBase::VPTruncOpGenericAdaptorBase(VPTruncOp op) : VPTruncOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPTruncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPTruncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPTruncOpAdaptor::VPTruncOpAdaptor(VPTruncOp op) : VPTruncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPTruncOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPTruncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPTruncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPTruncOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPTruncOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPTruncOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPTruncOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPTruncOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPTruncOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPTruncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPTruncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPTruncOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPTruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPTruncOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPTruncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPTruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPTruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPUDivOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPUDivOpGenericAdaptorBase::VPUDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.udiv", odsAttrs.getContext()); +} + +VPUDivOpGenericAdaptorBase::VPUDivOpGenericAdaptorBase(VPUDivOp op) : VPUDivOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPUDivOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPUDivOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPUDivOpAdaptor::VPUDivOpAdaptor(VPUDivOp op) : VPUDivOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPUDivOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPUDivOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPUDivOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPUDivOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPUDivOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPUDivOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPUDivOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPUDivOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPUDivOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPUDivOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPUDivOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPUDivOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPUDivOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPUDivOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPUDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPUDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPUDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPUDivOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPUDivOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPUDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPUDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPUIToFPOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPUIToFPOpGenericAdaptorBase::VPUIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.uitofp", odsAttrs.getContext()); +} + +VPUIToFPOpGenericAdaptorBase::VPUIToFPOpGenericAdaptorBase(VPUIToFPOp op) : VPUIToFPOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPUIToFPOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPUIToFPOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPUIToFPOpAdaptor::VPUIToFPOpAdaptor(VPUIToFPOp op) : VPUIToFPOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPUIToFPOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPUIToFPOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPUIToFPOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPUIToFPOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPUIToFPOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPUIToFPOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPUIToFPOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPUIToFPOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPUIToFPOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPUIToFPOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPUIToFPOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPUIToFPOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPUIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPUIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPUIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPUIToFPOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPUIToFPOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPUIToFPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPUIToFPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPURemOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPURemOpGenericAdaptorBase::VPURemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.urem", odsAttrs.getContext()); +} + +VPURemOpGenericAdaptorBase::VPURemOpGenericAdaptorBase(VPURemOp op) : VPURemOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPURemOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPURemOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPURemOpAdaptor::VPURemOpAdaptor(VPURemOp op) : VPURemOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPURemOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPURemOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPURemOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPURemOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPURemOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPURemOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPURemOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPURemOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPURemOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPURemOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPURemOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPURemOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPURemOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPURemOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPURemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPURemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPURemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPURemOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPURemOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPURemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPURemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPXorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPXorOpGenericAdaptorBase::VPXorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.xor", odsAttrs.getContext()); +} + +VPXorOpGenericAdaptorBase::VPXorOpGenericAdaptorBase(VPXorOp op) : VPXorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPXorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPXorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPXorOpAdaptor::VPXorOpAdaptor(VPXorOp op) : VPXorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPXorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPXorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPXorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPXorOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPXorOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value VPXorOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPXorOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &VPXorOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPXorOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPXorOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPXorOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPXorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPXorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPXorOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPXorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPXorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPXorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPXorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPXorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPZExtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VPZExtOpGenericAdaptorBase::VPZExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vp.zext", odsAttrs.getContext()); +} + +VPZExtOpGenericAdaptorBase::VPZExtOpGenericAdaptorBase(VPZExtOp op) : VPZExtOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VPZExtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VPZExtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VPZExtOpAdaptor::VPZExtOpAdaptor(VPZExtOp op) : VPZExtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VPZExtOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VPZExtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VPZExtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPZExtOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VPZExtOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VPZExtOp::getEvl() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &VPZExtOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPZExtOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VPZExtOp::getEvlMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair VPZExtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VPZExtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VPZExtOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VPZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + odsState.addTypes(res); +} + +void VPZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl) { + odsState.addOperands(src); + odsState.addOperands(mask); + odsState.addOperands(evl); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VPZExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VPZExtOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VPZExtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void VPZExtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPZExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VaCopyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VaCopyOpGenericAdaptorBase::VaCopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vacopy", odsAttrs.getContext()); +} + +VaCopyOpGenericAdaptorBase::VaCopyOpGenericAdaptorBase(VaCopyOp op) : VaCopyOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VaCopyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VaCopyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VaCopyOpAdaptor::VaCopyOpAdaptor(VaCopyOp op) : VaCopyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VaCopyOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VaCopyOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VaCopyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VaCopyOp::getDestList() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VaCopyOp::getSrcList() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &VaCopyOp::getDestListMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VaCopyOp::getSrcListMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair VaCopyOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VaCopyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void VaCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dest_list, ::mlir::Value src_list) { + odsState.addOperands(dest_list); + odsState.addOperands(src_list); +} + +void VaCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dest_list, ::mlir::Value src_list) { + odsState.addOperands(dest_list); + odsState.addOperands(src_list); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VaCopyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VaCopyOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VaCopyOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult VaCopyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand src_listRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> src_listOperands(src_listRawOperands); ::llvm::SMLoc src_listOperandsLoc; + (void)src_listOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dest_listRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dest_listOperands(dest_listRawOperands); ::llvm::SMLoc dest_listOperandsLoc; + (void)dest_listOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + src_listOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(src_listRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + dest_listOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dest_listRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(dest_listOperands, src_listOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void VaCopyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrcList(); + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + _odsPrinter << getDestList(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VaCopyOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VaEndOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VaEndOpGenericAdaptorBase::VaEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vaend", odsAttrs.getContext()); +} + +VaEndOpGenericAdaptorBase::VaEndOpGenericAdaptorBase(VaEndOp op) : VaEndOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VaEndOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VaEndOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VaEndOpAdaptor::VaEndOpAdaptor(VaEndOp op) : VaEndOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VaEndOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VaEndOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VaEndOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VaEndOp::getArgList() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &VaEndOp::getArgListMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair VaEndOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VaEndOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void VaEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg_list) { + odsState.addOperands(arg_list); +} + +void VaEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg_list) { + odsState.addOperands(arg_list); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VaEndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VaEndOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VaEndOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult VaEndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand arg_listRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arg_listOperands(arg_listRawOperands); ::llvm::SMLoc arg_listOperandsLoc; + (void)arg_listOperandsLoc; + ::mlir::Type arg_listRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> arg_listTypes(arg_listRawTypes); + + arg_listOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(arg_listRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(arg_listRawTypes[0])) + return ::mlir::failure(); + if (parser.resolveOperands(arg_listOperands, arg_listTypes, arg_listOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void VaEndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgList(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getArgList().getType(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VaEndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VaStartOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VaStartOpGenericAdaptorBase::VaStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vastart", odsAttrs.getContext()); +} + +VaStartOpGenericAdaptorBase::VaStartOpGenericAdaptorBase(VaStartOp op) : VaStartOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VaStartOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VaStartOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VaStartOpAdaptor::VaStartOpAdaptor(VaStartOp op) : VaStartOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VaStartOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VaStartOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VaStartOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VaStartOp::getArgList() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &VaStartOp::getArgListMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair VaStartOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VaStartOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void VaStartOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg_list) { + odsState.addOperands(arg_list); +} + +void VaStartOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg_list) { + odsState.addOperands(arg_list); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VaStartOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VaStartOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VaStartOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult VaStartOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand arg_listRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arg_listOperands(arg_listRawOperands); ::llvm::SMLoc arg_listOperandsLoc; + (void)arg_listOperandsLoc; + ::mlir::Type arg_listRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> arg_listTypes(arg_listRawTypes); + + arg_listOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(arg_listRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(arg_listRawTypes[0])) + return ::mlir::failure(); + if (parser.resolveOperands(arg_listOperands, arg_listTypes, arg_listOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void VaStartOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgList(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getArgList().getType(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VaStartOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VarAnnotation definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VarAnnotationGenericAdaptorBase::VarAnnotationGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.var.annotation", odsAttrs.getContext()); +} + +VarAnnotationGenericAdaptorBase::VarAnnotationGenericAdaptorBase(VarAnnotation op) : VarAnnotationGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VarAnnotationGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VarAnnotationGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VarAnnotationAdaptor::VarAnnotationAdaptor(VarAnnotation op) : VarAnnotationGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VarAnnotationAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VarAnnotation::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VarAnnotation::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> VarAnnotation::getVal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> VarAnnotation::getAnnotation() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> VarAnnotation::getFileName() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> VarAnnotation::getLine() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> VarAnnotation::getAttr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &VarAnnotation::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VarAnnotation::getAnnotationMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VarAnnotation::getFileNameMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VarAnnotation::getLineMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VarAnnotation::getAttrMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair VarAnnotation::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VarAnnotation::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void VarAnnotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr) { + odsState.addOperands(val); + odsState.addOperands(annotation); + odsState.addOperands(fileName); + odsState.addOperands(line); + odsState.addOperands(attr); +} + +void VarAnnotation::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr) { + odsState.addOperands(val); + odsState.addOperands(annotation); + odsState.addOperands(fileName); + odsState.addOperands(line); + odsState.addOperands(attr); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VarAnnotation::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VarAnnotation::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(4).begin()).getType()) && ((*this->getODSOperands(4).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {annotation, fileName, attr} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult VarAnnotation::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VarAnnotation) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::masked_compressstore definitions +//===----------------------------------------------------------------------===// + +namespace detail { +masked_compressstoreGenericAdaptorBase::masked_compressstoreGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.masked.compressstore", odsAttrs.getContext()); +} + +masked_compressstoreGenericAdaptorBase::masked_compressstoreGenericAdaptorBase(masked_compressstore op) : masked_compressstoreGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair masked_compressstoreGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr masked_compressstoreGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +masked_compressstoreAdaptor::masked_compressstoreAdaptor(masked_compressstore op) : masked_compressstoreGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult masked_compressstoreAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair masked_compressstore::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range masked_compressstore::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair masked_compressstore::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range masked_compressstore::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void masked_compressstore::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); +} + +void masked_compressstore::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void masked_compressstore::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult masked_compressstore::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult masked_compressstore::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::masked_compressstore) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::masked_expandload definitions +//===----------------------------------------------------------------------===// + +namespace detail { +masked_expandloadGenericAdaptorBase::masked_expandloadGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.masked.expandload", odsAttrs.getContext()); +} + +masked_expandloadGenericAdaptorBase::masked_expandloadGenericAdaptorBase(masked_expandload op) : masked_expandloadGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair masked_expandloadGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr masked_expandloadGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +masked_expandloadAdaptor::masked_expandloadAdaptor(masked_expandload op) : masked_expandloadGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult masked_expandloadAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair masked_expandload::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range masked_expandload::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair masked_expandload::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range masked_expandload::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value masked_expandload::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void masked_expandload::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + odsState.addTypes(res); +} + +void masked_expandload::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2) { + odsState.addOperands(odsArg_0); + odsState.addOperands(odsArg_1); + odsState.addOperands(odsArg_2); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void masked_expandload::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult masked_expandload::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult masked_expandload::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::masked_expandload) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::masked_gather definitions +//===----------------------------------------------------------------------===// + +namespace detail { +masked_gatherGenericAdaptorBase::masked_gatherGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.masked.gather", odsAttrs.getContext()); +} + +masked_gatherGenericAdaptorBase::masked_gatherGenericAdaptorBase(masked_gather op) : masked_gatherGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair masked_gatherGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr masked_gatherGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr masked_gatherGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +uint32_t masked_gatherGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +masked_gatherAdaptor::masked_gatherAdaptor(masked_gather op) : masked_gatherGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult masked_gatherAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitError(loc, "'llvm.intr.masked.gather' op ""requires attribute 'alignment'"); + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.masked.gather' op ""attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair masked_gather::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range masked_gather::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value masked_gather::getPtrs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value masked_gather::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range masked_gather::getPassThru() { + return getODSOperands(2); +} + +::mlir::OpOperand &masked_gather::getPtrsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &masked_gather::getMaskMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange masked_gather::getPassThruMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair masked_gather::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range masked_gather::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value masked_gather::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult masked_gather::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute masked_gather::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code masked_gather::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer())); +} + +std::optional masked_gather::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + return std::nullopt; +} + +void masked_gather::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void masked_gather::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); +} + +::mlir::LogicalResult masked_gather::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "alignment", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult masked_gather::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.alignment))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void masked_gather::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.alignment); +} + +::mlir::IntegerAttr masked_gather::getAlignmentAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); +} + +uint32_t masked_gather::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +void masked_gather::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void masked_gather::setAlignment(uint32_t attrValue) { + (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void masked_gather::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void masked_gather::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::ValueRange pass_thru, ::mlir::IntegerAttr alignment) { + odsState.addOperands(ptrs); + odsState.addOperands(mask); + odsState.addOperands(pass_thru); + odsState.getOrAddProperties().alignment = alignment; + odsState.addTypes(res); +} + +void masked_gather::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::ValueRange pass_thru, ::mlir::IntegerAttr alignment) { + odsState.addOperands(ptrs); + odsState.addOperands(mask); + odsState.addOperands(pass_thru); + odsState.getOrAddProperties().alignment = alignment; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void masked_gather::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::ValueRange pass_thru, uint32_t alignment) { + odsState.addOperands(ptrs); + odsState.addOperands(mask); + odsState.addOperands(pass_thru); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); + odsState.addTypes(res); +} + +void masked_gather::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::ValueRange pass_thru, uint32_t alignment) { + odsState.addOperands(ptrs); + odsState.addOperands(mask); + odsState.addOperands(pass_thru); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void masked_gather::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult masked_gather::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitOpError("requires attribute 'alignment'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps17(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult masked_gather::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult masked_gather::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void masked_gather::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::masked_gather) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::masked_scatter definitions +//===----------------------------------------------------------------------===// + +namespace detail { +masked_scatterGenericAdaptorBase::masked_scatterGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.masked.scatter", odsAttrs.getContext()); +} + +masked_scatterGenericAdaptorBase::masked_scatterGenericAdaptorBase(masked_scatter op) : masked_scatterGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair masked_scatterGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr masked_scatterGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr masked_scatterGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +uint32_t masked_scatterGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +masked_scatterAdaptor::masked_scatterAdaptor(masked_scatter op) : masked_scatterGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult masked_scatterAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitError(loc, "'llvm.intr.masked.scatter' op ""requires attribute 'alignment'"); + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32))))) + return emitError(loc, "'llvm.intr.masked.scatter' op ""attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair masked_scatter::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range masked_scatter::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value masked_scatter::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value masked_scatter::getPtrs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value masked_scatter::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &masked_scatter::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &masked_scatter::getPtrsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &masked_scatter::getMaskMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair masked_scatter::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range masked_scatter::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult masked_scatter::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute masked_scatter::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code masked_scatter::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer())); +} + +std::optional masked_scatter::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + return std::nullopt; +} + +void masked_scatter::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void masked_scatter::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); +} + +::mlir::LogicalResult masked_scatter::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(attr, "alignment", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult masked_scatter::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.alignment))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void masked_scatter::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.alignment); +} + +::mlir::IntegerAttr masked_scatter::getAlignmentAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); +} + +uint32_t masked_scatter::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +void masked_scatter::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void masked_scatter::setAlignment(uint32_t attrValue) { + (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void masked_scatter::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + assert(isCompatibleType(resultType) && "result must be an LLVM type"); + assert(::llvm::isa(resultType) && + "for zero-result operands, only 'void' is accepted as result type"); + build(odsBuilder, odsState, operands, attributes); + +} + +void masked_scatter::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void masked_scatter::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::IntegerAttr alignment) { + odsState.addOperands(value); + odsState.addOperands(ptrs); + odsState.addOperands(mask); + odsState.getOrAddProperties().alignment = alignment; +} + +void masked_scatter::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::IntegerAttr alignment) { + odsState.addOperands(value); + odsState.addOperands(ptrs); + odsState.addOperands(mask); + odsState.getOrAddProperties().alignment = alignment; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void masked_scatter::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value ptrs, ::mlir::Value mask, uint32_t alignment) { + odsState.addOperands(value); + odsState.addOperands(ptrs); + odsState.addOperands(mask); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); +} + +void masked_scatter::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value ptrs, ::mlir::Value mask, uint32_t alignment) { + odsState.addOperands(value); + odsState.addOperands(ptrs); + odsState.addOperands(mask); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void masked_scatter::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult masked_scatter::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitOpError("requires attribute 'alignment'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps5(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps17(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult masked_scatter::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult masked_scatter::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand ptrsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrsOperands(ptrsRawOperands); ::llvm::SMLoc ptrsOperandsLoc; + (void)ptrsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + ::mlir::Type ptrsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> ptrsTypes(ptrsRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + ptrsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ptrsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + ptrsRawTypes[0] = type; + } + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(ptrsOperands, ptrsTypes, ptrsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void masked_scatter::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getPtrs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMask(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + { + auto type = getPtrs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::masked_scatter) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_extract definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_extractGenericAdaptorBase::vector_extractGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.extract", odsAttrs.getContext()); +} + +vector_extractGenericAdaptorBase::vector_extractGenericAdaptorBase(vector_extract op) : vector_extractGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_extractGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_extractGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr vector_extractGenericAdaptorBase::getPosAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().pos); + return attr; +} + +uint64_t vector_extractGenericAdaptorBase::getPos() { + auto attr = getPosAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +vector_extractAdaptor::vector_extractAdaptor(vector_extract op) : vector_extractGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_extractAdaptor::verify(::mlir::Location loc) { + auto tblgen_pos = getProperties().pos; (void)tblgen_pos; + if (!tblgen_pos) return emitError(loc, "'llvm.intr.vector.extract' op ""requires attribute 'pos'"); + + if (tblgen_pos && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_pos))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_pos).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.intr.vector.extract' op ""attribute 'pos' failed to satisfy constraint: 64-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair vector_extract::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_extract::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_extract::getSrcvec() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_extract::getSrcvecMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_extract::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_extract::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_extract::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult vector_extract::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.pos; + auto attr = dict.get("pos"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for pos in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `pos` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute vector_extract::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.pos; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("pos", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code vector_extract::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.pos.getAsOpaquePointer())); +} + +std::optional vector_extract::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "pos") + return prop.pos; + return std::nullopt; +} + +void vector_extract::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "pos") { + prop.pos = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void vector_extract::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.pos) attrs.append("pos", prop.pos); +} + +::mlir::LogicalResult vector_extract::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPosAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps6(attr, "pos", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_extract::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.pos))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_extract::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.pos); +} + +::mlir::IntegerAttr vector_extract::getPosAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().pos); +} + +uint64_t vector_extract::getPos() { + auto attr = getPosAttr(); + return attr.getValue().getZExtValue(); +} + +void vector_extract::setPosAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getPosAttrName(), attr); +} + +void vector_extract::setPos(uint64_t attrValue) { + (*this)->setAttr(getPosAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue)); +} + +void vector_extract::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void vector_extract::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcvec, ::mlir::IntegerAttr pos) { + odsState.addOperands(srcvec); + odsState.getOrAddProperties().pos = pos; + odsState.addTypes(res); +} + +void vector_extract::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcvec, ::mlir::IntegerAttr pos) { + odsState.addOperands(srcvec); + odsState.getOrAddProperties().pos = pos; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_extract::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcvec, uint64_t pos) { + odsState.addOperands(srcvec); + odsState.getOrAddProperties().pos = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), pos); + odsState.addTypes(res); +} + +void vector_extract::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcvec, uint64_t pos) { + odsState.addOperands(srcvec); + odsState.getOrAddProperties().pos = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), pos); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_extract::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_extract::verifyInvariantsImpl() { + auto tblgen_pos = getProperties().pos; (void)tblgen_pos; + if (!tblgen_pos) return emitOpError("requires attribute 'pos'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps6(*this, tblgen_pos, "pos"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!(((getSrcVectorBitWidth() <= 131072)) && ((getResVectorBitWidth() <= 131072)))) + return emitOpError("failed to verify that vectors are not bigger than 2^17 bits."); + if (!((!isScalableVectorType((*this->getODSResults(0).begin()).getType()) || isScalableVectorType((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that it is not extracting scalable from fixed-length vectors."); + return ::mlir::success(); +} + +::mlir::LogicalResult vector_extract::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult vector_extract::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcvecRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcvecOperands(srcvecRawOperands); ::llvm::SMLoc srcvecOperandsLoc; + (void)srcvecOperandsLoc; + ::mlir::IntegerAttr posAttr; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + ::mlir::Type srcvecRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcvecTypes(srcvecRawTypes); + + srcvecOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcvecRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(posAttr, parser.getBuilder().getIntegerType(64))) { + return ::mlir::failure(); + } + if (posAttr) result.getOrAddProperties().pos = posAttr; + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + if (parser.parseKeyword("from")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcvecRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(srcvecOperands, srcvecTypes, srcvecOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_extract::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrcvec(); + _odsPrinter << "["; + _odsPrinter.printAttributeWithoutType(getPosAttr()); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("pos"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "from"; + _odsPrinter << ' '; + { + auto type = getSrcvec().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void vector_extract::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_extract) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_insert definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_insertGenericAdaptorBase::vector_insertGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.insert", odsAttrs.getContext()); +} + +vector_insertGenericAdaptorBase::vector_insertGenericAdaptorBase(vector_insert op) : vector_insertGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_insertGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_insertGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr vector_insertGenericAdaptorBase::getPosAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().pos); + return attr; +} + +uint64_t vector_insertGenericAdaptorBase::getPos() { + auto attr = getPosAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +vector_insertAdaptor::vector_insertAdaptor(vector_insert op) : vector_insertGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_insertAdaptor::verify(::mlir::Location loc) { + auto tblgen_pos = getProperties().pos; (void)tblgen_pos; + if (!tblgen_pos) return emitError(loc, "'llvm.intr.vector.insert' op ""requires attribute 'pos'"); + + if (tblgen_pos && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_pos))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_pos).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.intr.vector.insert' op ""attribute 'pos' failed to satisfy constraint: 64-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair vector_insert::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_insert::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_insert::getSrcvec() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value vector_insert::getDstvec() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &vector_insert::getSrcvecMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &vector_insert::getDstvecMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_insert::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_insert::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_insert::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult vector_insert::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.pos; + auto attr = dict.get("pos"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for pos in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `pos` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute vector_insert::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.pos; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("pos", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code vector_insert::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.pos.getAsOpaquePointer())); +} + +std::optional vector_insert::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "pos") + return prop.pos; + return std::nullopt; +} + +void vector_insert::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "pos") { + prop.pos = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void vector_insert::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.pos) attrs.append("pos", prop.pos); +} + +::mlir::LogicalResult vector_insert::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPosAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps6(attr, "pos", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_insert::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.pos))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_insert::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.pos); +} + +::mlir::IntegerAttr vector_insert::getPosAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().pos); +} + +uint64_t vector_insert::getPos() { + auto attr = getPosAttr(); + return attr.getValue().getZExtValue(); +} + +void vector_insert::setPosAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getPosAttrName(), attr); +} + +void vector_insert::setPos(uint64_t attrValue) { + (*this)->setAttr(getPosAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue)); +} + +void vector_insert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void vector_insert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcvec, ::mlir::Value dstvec, ::mlir::IntegerAttr pos) { + odsState.addOperands(srcvec); + odsState.addOperands(dstvec); + odsState.getOrAddProperties().pos = pos; + odsState.addTypes(res); +} + +void vector_insert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value srcvec, ::mlir::Value dstvec, ::mlir::IntegerAttr pos) { + odsState.addOperands(srcvec); + odsState.addOperands(dstvec); + odsState.getOrAddProperties().pos = pos; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(vector_insert::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void vector_insert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcvec, ::mlir::Value dstvec, ::mlir::IntegerAttr pos) { + odsState.addOperands(srcvec); + odsState.addOperands(dstvec); + odsState.getOrAddProperties().pos = pos; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_insert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcvec, ::mlir::Value dstvec, uint64_t pos) { + odsState.addOperands(srcvec); + odsState.addOperands(dstvec); + odsState.getOrAddProperties().pos = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), pos); + odsState.addTypes(res); +} + +void vector_insert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value srcvec, ::mlir::Value dstvec, uint64_t pos) { + odsState.addOperands(srcvec); + odsState.addOperands(dstvec); + odsState.getOrAddProperties().pos = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), pos); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(vector_insert::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void vector_insert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcvec, ::mlir::Value dstvec, uint64_t pos) { + odsState.addOperands(srcvec); + odsState.addOperands(dstvec); + odsState.getOrAddProperties().pos = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), pos); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_insert::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void vector_insert::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(vector_insert::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult vector_insert::verifyInvariantsImpl() { + auto tblgen_pos = getProperties().pos; (void)tblgen_pos; + if (!tblgen_pos) return emitOpError("requires attribute 'pos'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps6(*this, tblgen_pos, "pos"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps11(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {dstvec, res} have same type"); + if (!(((getSrcVectorBitWidth() <= 131072)) && ((getDstVectorBitWidth() <= 131072)))) + return emitOpError("failed to verify that vectors are not bigger than 2^17 bits."); + if (!((!isScalableVectorType((*this->getODSOperands(0).begin()).getType()) || isScalableVectorType((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that it is not inserting scalable into fixed-length vectors."); + return ::mlir::success(); +} + +::mlir::LogicalResult vector_insert::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult vector_insert::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[1].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult vector_insert::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcvecRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcvecOperands(srcvecRawOperands); ::llvm::SMLoc srcvecOperandsLoc; + (void)srcvecOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dstvecRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstvecOperands(dstvecRawOperands); ::llvm::SMLoc dstvecOperandsLoc; + (void)dstvecOperandsLoc; + ::mlir::IntegerAttr posAttr; + ::mlir::Type srcvecRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcvecTypes(srcvecRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + srcvecOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcvecRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + dstvecOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstvecRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(posAttr, parser.getBuilder().getIntegerType(64))) { + return ::mlir::failure(); + } + if (posAttr) result.getOrAddProperties().pos = posAttr; + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcvecRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(srcvecOperands, srcvecTypes, srcvecOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dstvecOperands, resTypes[0], dstvecOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_insert::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrcvec(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDstvec(); + _odsPrinter << "["; + _odsPrinter.printAttributeWithoutType(getPosAttr()); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("pos"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrcvec().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void vector_insert::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_insert) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_add definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_addGenericAdaptorBase::vector_reduce_addGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.add", odsAttrs.getContext()); +} + +vector_reduce_addGenericAdaptorBase::vector_reduce_addGenericAdaptorBase(vector_reduce_add op) : vector_reduce_addGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_addGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_addGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vector_reduce_addAdaptor::vector_reduce_addAdaptor(vector_reduce_add op) : vector_reduce_addGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_addAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vector_reduce_add::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_add::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_add::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_add::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_add::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_add::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_add::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vector_reduce_add::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void vector_reduce_add::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_add::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_reduce_add::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_add::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_add::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_add) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_and definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_andGenericAdaptorBase::vector_reduce_andGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.and", odsAttrs.getContext()); +} + +vector_reduce_andGenericAdaptorBase::vector_reduce_andGenericAdaptorBase(vector_reduce_and op) : vector_reduce_andGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_andGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_andGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vector_reduce_andAdaptor::vector_reduce_andAdaptor(vector_reduce_and op) : vector_reduce_andGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_andAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vector_reduce_and::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_and::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_and::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_and::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_and::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_and::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_and::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vector_reduce_and::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void vector_reduce_and::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_and::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_reduce_and::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_and::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_and::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_and) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fadd definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_faddGenericAdaptorBase::vector_reduce_faddGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.fadd", odsAttrs.getContext()); +} + +vector_reduce_faddGenericAdaptorBase::vector_reduce_faddGenericAdaptorBase(vector_reduce_fadd op) : vector_reduce_faddGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_faddGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_faddGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_faddGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags vector_reduce_faddGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +vector_reduce_faddAdaptor::vector_reduce_faddAdaptor(vector_reduce_fadd op) : vector_reduce_faddGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_faddAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.vector.reduce.fadd' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair vector_reduce_fadd::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_fadd::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> vector_reduce_fadd::getStartValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::Value vector_reduce_fadd::getInput() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &vector_reduce_fadd::getStartValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &vector_reduce_fadd::getInputMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_fadd::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_fadd::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fadd::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult vector_reduce_fadd::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute vector_reduce_fadd::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code vector_reduce_fadd::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional vector_reduce_fadd::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void vector_reduce_fadd::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void vector_reduce_fadd::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult vector_reduce_fadd::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fadd::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fadd::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fadd::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags vector_reduce_fadd::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void vector_reduce_fadd::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void vector_reduce_fadd::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void vector_reduce_fadd::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(start_value); + odsState.addOperands(input); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void vector_reduce_fadd::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(start_value); + odsState.addOperands(input); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fadd::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(start_value); + odsState.addOperands(input); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void vector_reduce_fadd::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(start_value); + odsState.addOperands(input); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fadd::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fadd::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult vector_reduce_fadd::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps18(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fadd::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_fadd::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fadd) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fmax definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_fmaxGenericAdaptorBase::vector_reduce_fmaxGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.fmax", odsAttrs.getContext()); +} + +vector_reduce_fmaxGenericAdaptorBase::vector_reduce_fmaxGenericAdaptorBase(vector_reduce_fmax op) : vector_reduce_fmaxGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_fmaxGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_fmaxGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fmaxGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags vector_reduce_fmaxGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +vector_reduce_fmaxAdaptor::vector_reduce_fmaxAdaptor(vector_reduce_fmax op) : vector_reduce_fmaxGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_fmaxAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.vector.reduce.fmax' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair vector_reduce_fmax::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_fmax::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fmax::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_fmax::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_fmax::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_fmax::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fmax::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult vector_reduce_fmax::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute vector_reduce_fmax::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code vector_reduce_fmax::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional vector_reduce_fmax::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void vector_reduce_fmax::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void vector_reduce_fmax::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult vector_reduce_fmax::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fmax::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fmax::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fmax::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags vector_reduce_fmax::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void vector_reduce_fmax::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void vector_reduce_fmax::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void vector_reduce_fmax::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void vector_reduce_fmax::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmax::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void vector_reduce_fmax::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmax::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmax::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult vector_reduce_fmax::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fmax::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult vector_reduce_fmax::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fmax::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void vector_reduce_fmax::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fmax) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fmaximum definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_fmaximumGenericAdaptorBase::vector_reduce_fmaximumGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.fmaximum", odsAttrs.getContext()); +} + +vector_reduce_fmaximumGenericAdaptorBase::vector_reduce_fmaximumGenericAdaptorBase(vector_reduce_fmaximum op) : vector_reduce_fmaximumGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_fmaximumGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_fmaximumGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fmaximumGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags vector_reduce_fmaximumGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +vector_reduce_fmaximumAdaptor::vector_reduce_fmaximumAdaptor(vector_reduce_fmaximum op) : vector_reduce_fmaximumGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_fmaximumAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.vector.reduce.fmaximum' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair vector_reduce_fmaximum::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_fmaximum::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fmaximum::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_fmaximum::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_fmaximum::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_fmaximum::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fmaximum::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult vector_reduce_fmaximum::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute vector_reduce_fmaximum::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code vector_reduce_fmaximum::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional vector_reduce_fmaximum::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void vector_reduce_fmaximum::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void vector_reduce_fmaximum::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult vector_reduce_fmaximum::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fmaximum::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fmaximum::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fmaximum::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags vector_reduce_fmaximum::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void vector_reduce_fmaximum::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void vector_reduce_fmaximum::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void vector_reduce_fmaximum::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void vector_reduce_fmaximum::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmaximum::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void vector_reduce_fmaximum::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmaximum::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmaximum::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult vector_reduce_fmaximum::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fmaximum::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult vector_reduce_fmaximum::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fmaximum::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void vector_reduce_fmaximum::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fmaximum) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fmin definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_fminGenericAdaptorBase::vector_reduce_fminGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.fmin", odsAttrs.getContext()); +} + +vector_reduce_fminGenericAdaptorBase::vector_reduce_fminGenericAdaptorBase(vector_reduce_fmin op) : vector_reduce_fminGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_fminGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_fminGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fminGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags vector_reduce_fminGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +vector_reduce_fminAdaptor::vector_reduce_fminAdaptor(vector_reduce_fmin op) : vector_reduce_fminGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_fminAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.vector.reduce.fmin' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair vector_reduce_fmin::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_fmin::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fmin::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_fmin::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_fmin::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_fmin::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fmin::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult vector_reduce_fmin::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute vector_reduce_fmin::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code vector_reduce_fmin::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional vector_reduce_fmin::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void vector_reduce_fmin::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void vector_reduce_fmin::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult vector_reduce_fmin::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fmin::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fmin::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fmin::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags vector_reduce_fmin::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void vector_reduce_fmin::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void vector_reduce_fmin::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void vector_reduce_fmin::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void vector_reduce_fmin::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmin::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void vector_reduce_fmin::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmin::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmin::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult vector_reduce_fmin::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fmin::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult vector_reduce_fmin::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fmin::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void vector_reduce_fmin::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fmin) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fminimum definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_fminimumGenericAdaptorBase::vector_reduce_fminimumGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.fminimum", odsAttrs.getContext()); +} + +vector_reduce_fminimumGenericAdaptorBase::vector_reduce_fminimumGenericAdaptorBase(vector_reduce_fminimum op) : vector_reduce_fminimumGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_fminimumGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_fminimumGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fminimumGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags vector_reduce_fminimumGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +vector_reduce_fminimumAdaptor::vector_reduce_fminimumAdaptor(vector_reduce_fminimum op) : vector_reduce_fminimumGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_fminimumAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.vector.reduce.fminimum' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair vector_reduce_fminimum::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_fminimum::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fminimum::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_fminimum::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_fminimum::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_fminimum::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fminimum::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult vector_reduce_fminimum::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute vector_reduce_fminimum::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code vector_reduce_fminimum::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional vector_reduce_fminimum::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void vector_reduce_fminimum::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void vector_reduce_fminimum::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult vector_reduce_fminimum::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fminimum::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fminimum::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fminimum::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags vector_reduce_fminimum::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void vector_reduce_fminimum::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void vector_reduce_fminimum::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void vector_reduce_fminimum::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void vector_reduce_fminimum::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(in); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fminimum::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void vector_reduce_fminimum::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(in); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fminimum::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fminimum::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult vector_reduce_fminimum::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fminimum::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult vector_reduce_fminimum::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fminimum::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void vector_reduce_fminimum::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fminimum) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fmul definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_fmulGenericAdaptorBase::vector_reduce_fmulGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.fmul", odsAttrs.getContext()); +} + +vector_reduce_fmulGenericAdaptorBase::vector_reduce_fmulGenericAdaptorBase(vector_reduce_fmul op) : vector_reduce_fmulGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_fmulGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_fmulGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fmulGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags vector_reduce_fmulGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +vector_reduce_fmulAdaptor::vector_reduce_fmulAdaptor(vector_reduce_fmul op) : vector_reduce_fmulGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_fmulAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.intr.vector.reduce.fmul' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair vector_reduce_fmul::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_fmul::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> vector_reduce_fmul::getStartValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::Value vector_reduce_fmul::getInput() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &vector_reduce_fmul::getStartValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &vector_reduce_fmul::getInputMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_fmul::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_fmul::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_fmul::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult vector_reduce_fmul::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute vector_reduce_fmul::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code vector_reduce_fmul::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional vector_reduce_fmul::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void vector_reduce_fmul::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void vector_reduce_fmul::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult vector_reduce_fmul::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fmul::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void vector_reduce_fmul::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr vector_reduce_fmul::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags vector_reduce_fmul::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void vector_reduce_fmul::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void vector_reduce_fmul::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void vector_reduce_fmul::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(start_value); + odsState.addOperands(input); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void vector_reduce_fmul::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(start_value); + odsState.addOperands(input); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmul::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(start_value); + odsState.addOperands(input); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void vector_reduce_fmul::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(start_value); + odsState.addOperands(input); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmul::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_fmul::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult vector_reduce_fmul::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMIntrinsicOps1(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps18(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_fmul::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_fmul::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fmul) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_mul definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_mulGenericAdaptorBase::vector_reduce_mulGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.mul", odsAttrs.getContext()); +} + +vector_reduce_mulGenericAdaptorBase::vector_reduce_mulGenericAdaptorBase(vector_reduce_mul op) : vector_reduce_mulGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_mulGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_mulGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vector_reduce_mulAdaptor::vector_reduce_mulAdaptor(vector_reduce_mul op) : vector_reduce_mulGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_mulAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vector_reduce_mul::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_mul::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_mul::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_mul::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_mul::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_mul::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_mul::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vector_reduce_mul::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void vector_reduce_mul::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_mul::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_reduce_mul::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_mul::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_mul::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_mul) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_or definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_orGenericAdaptorBase::vector_reduce_orGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.or", odsAttrs.getContext()); +} + +vector_reduce_orGenericAdaptorBase::vector_reduce_orGenericAdaptorBase(vector_reduce_or op) : vector_reduce_orGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_orGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_orGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vector_reduce_orAdaptor::vector_reduce_orAdaptor(vector_reduce_or op) : vector_reduce_orGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_orAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vector_reduce_or::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_or::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_or::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_or::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_or::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_or::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_or::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vector_reduce_or::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void vector_reduce_or::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_or::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_reduce_or::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_or::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_or::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_or) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_smax definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_smaxGenericAdaptorBase::vector_reduce_smaxGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.smax", odsAttrs.getContext()); +} + +vector_reduce_smaxGenericAdaptorBase::vector_reduce_smaxGenericAdaptorBase(vector_reduce_smax op) : vector_reduce_smaxGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_smaxGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_smaxGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vector_reduce_smaxAdaptor::vector_reduce_smaxAdaptor(vector_reduce_smax op) : vector_reduce_smaxGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_smaxAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vector_reduce_smax::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_smax::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_smax::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_smax::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_smax::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_smax::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_smax::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vector_reduce_smax::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void vector_reduce_smax::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_smax::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_reduce_smax::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_smax::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_smax::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_smax) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_smin definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_sminGenericAdaptorBase::vector_reduce_sminGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.smin", odsAttrs.getContext()); +} + +vector_reduce_sminGenericAdaptorBase::vector_reduce_sminGenericAdaptorBase(vector_reduce_smin op) : vector_reduce_sminGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_sminGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_sminGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vector_reduce_sminAdaptor::vector_reduce_sminAdaptor(vector_reduce_smin op) : vector_reduce_sminGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_sminAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vector_reduce_smin::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_smin::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_smin::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_smin::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_smin::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_smin::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_smin::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vector_reduce_smin::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void vector_reduce_smin::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_smin::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_reduce_smin::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_smin::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_smin::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_smin) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_umax definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_umaxGenericAdaptorBase::vector_reduce_umaxGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.umax", odsAttrs.getContext()); +} + +vector_reduce_umaxGenericAdaptorBase::vector_reduce_umaxGenericAdaptorBase(vector_reduce_umax op) : vector_reduce_umaxGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_umaxGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_umaxGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vector_reduce_umaxAdaptor::vector_reduce_umaxAdaptor(vector_reduce_umax op) : vector_reduce_umaxGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_umaxAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vector_reduce_umax::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_umax::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_umax::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_umax::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_umax::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_umax::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_umax::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vector_reduce_umax::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void vector_reduce_umax::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_umax::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_reduce_umax::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_umax::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_umax::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_umax) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_umin definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_uminGenericAdaptorBase::vector_reduce_uminGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.umin", odsAttrs.getContext()); +} + +vector_reduce_uminGenericAdaptorBase::vector_reduce_uminGenericAdaptorBase(vector_reduce_umin op) : vector_reduce_uminGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_uminGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_uminGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vector_reduce_uminAdaptor::vector_reduce_uminAdaptor(vector_reduce_umin op) : vector_reduce_uminGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_uminAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vector_reduce_umin::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_umin::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_umin::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_umin::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_umin::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_umin::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_umin::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vector_reduce_umin::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void vector_reduce_umin::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_umin::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_reduce_umin::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_umin::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_umin::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_umin) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_xor definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vector_reduce_xorGenericAdaptorBase::vector_reduce_xorGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vector.reduce.xor", odsAttrs.getContext()); +} + +vector_reduce_xorGenericAdaptorBase::vector_reduce_xorGenericAdaptorBase(vector_reduce_xor op) : vector_reduce_xorGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vector_reduce_xorGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vector_reduce_xorGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vector_reduce_xorAdaptor::vector_reduce_xorAdaptor(vector_reduce_xor op) : vector_reduce_xorGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vector_reduce_xorAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vector_reduce_xor::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vector_reduce_xor::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_xor::getIn() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &vector_reduce_xor::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair vector_reduce_xor::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vector_reduce_xor::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vector_reduce_xor::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vector_reduce_xor::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in) { + odsState.addOperands(in); + odsState.addTypes(res); +} + +void vector_reduce_xor::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) { + odsState.addOperands(in); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vector_reduce_xor::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vector_reduce_xor::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vector_reduce_xor::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void vector_reduce_xor::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_xor) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vscale definitions +//===----------------------------------------------------------------------===// + +namespace detail { +vscaleGenericAdaptorBase::vscaleGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.intr.vscale", odsAttrs.getContext()); +} + +vscaleGenericAdaptorBase::vscaleGenericAdaptorBase(vscale op) : vscaleGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair vscaleGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr vscaleGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +vscaleAdaptor::vscaleAdaptor(vscale op) : vscaleGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult vscaleAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair vscale::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range vscale::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair vscale::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range vscale::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value vscale::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void vscale::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void vscale::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void vscale::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult vscale::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult vscale::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::vscale) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..adbccd8994841e284156f2cee125d623d54b8eef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.h.inc @@ -0,0 +1,23680 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LLVMIntrinsicOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace LLVM { +class AbsOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class Annotation; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AssumeOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class BitReverseOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ByteSwapOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CopySignOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CoroAlignOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CoroBeginOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CoroEndOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CoroFreeOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CoroIdOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CoroResumeOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CoroSaveOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CoroSizeOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CoroSuspendOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CosOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CountLeadingZerosOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CountTrailingZerosOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CtPopOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class DbgDeclareOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class DbgLabelOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class DbgValueOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class DebugTrap; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class EhTypeidForOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class Exp2Op; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ExpOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ExpectOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ExpectWithProbabilityOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FAbsOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FCeilOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FFloorOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FMAOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FMulAddOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FTruncOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FshlOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FshrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class GetActiveLaneMaskOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class IsConstantOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class IsFPClass; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LifetimeEndOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LifetimeStartOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LlrintOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LlroundOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class Log10Op; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class Log2Op; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LogOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LrintOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LroundOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MaskedLoadOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MaskedStoreOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MatrixColumnMajorLoadOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MatrixColumnMajorStoreOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MatrixMultiplyOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MatrixTransposeOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MaxNumOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MaximumOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MemcpyInlineOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MemcpyOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MemmoveOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MemsetOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MinNumOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MinimumOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class NearbyintOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class NoAliasScopeDeclOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class PowIOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class PowOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class Prefetch; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class PtrAnnotation; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class RintOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class RoundEvenOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class RoundOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SAddSat; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SAddWithOverflowOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SMaxOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SMinOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SMulWithOverflowOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SSACopyOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SSHLSat; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SSubSat; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SSubWithOverflowOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SinOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SqrtOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class StackRestoreOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class StackSaveOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class StepVectorOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ThreadlocalAddressOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class Trap; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UAddSat; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UAddWithOverflowOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UBSanTrap; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UMaxOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UMinOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UMulWithOverflowOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class USHLSat; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class USubSat; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class USubWithOverflowOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPAShrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPAddOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPAndOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFAddOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFDivOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFMulAddOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFMulOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFNegOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFPExtOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFPToSIOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFPToUIOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFPTruncOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFRemOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFSubOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPFmaOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPIntToPtrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPLShrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPLoadOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPMergeMinOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPMulOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPOrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPPtrToIntOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceAddOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceAndOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceFAddOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceFMaxOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceFMinOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceFMulOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceMulOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceOrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceSMaxOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceSMinOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceUMaxOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceUMinOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPReduceXorOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPSDivOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPSExtOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPSIToFPOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPSRemOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPSelectMinOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPShlOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPStoreOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPStridedLoadOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPStridedStoreOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPSubOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPTruncOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPUDivOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPUIToFPOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPURemOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPXorOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VPZExtOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VaCopyOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VaEndOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VaStartOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class VarAnnotation; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class masked_compressstore; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class masked_expandload; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class masked_gather; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class masked_scatter; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_extract; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_insert; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_add; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_and; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_fadd; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_fmax; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_fmaximum; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_fmin; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_fminimum; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_fmul; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_mul; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_or; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_smax; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_smin; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_umax; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_umin; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vector_reduce_xor; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class vscale; +} // namespace LLVM +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AbsOpGenericAdaptorBase { +public: + struct Properties { + using is_int_min_poisonTy = ::mlir::IntegerAttr; + is_int_min_poisonTy is_int_min_poison; + + auto getIsIntMinPoison() { + auto &propStorage = this->is_int_min_poison; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIsIntMinPoison(const ::mlir::IntegerAttr &propValue) { + this->is_int_min_poison = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.is_int_min_poison == this->is_int_min_poison && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AbsOpGenericAdaptorBase(AbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIsIntMinPoisonAttr(); + bool getIsIntMinPoison(); +}; +} // namespace detail +template +class AbsOpGenericAdaptor : public detail::AbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AbsOpGenericAdaptorBase; +public: + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AbsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AbsOpAdaptor : public AbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using AbsOpGenericAdaptor::AbsOpGenericAdaptor; + AbsOpAdaptor(AbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AbsOpAdaptor; + template + using GenericAdaptor = AbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_int_min_poison")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsIntMinPoisonAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsIntMinPoisonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.abs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIsIntMinPoisonAttr(); + bool getIsIntMinPoison(); + void setIsIntMinPoisonAttr(::mlir::IntegerAttr attr); + void setIsIntMinPoison(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::IntegerAttr is_int_min_poison); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::IntegerAttr is_int_min_poison); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, bool is_int_min_poison); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, bool is_int_min_poison); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AbsOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Annotation declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnnotationGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnnotationGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnnotationGenericAdaptorBase(Annotation op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AnnotationGenericAdaptor : public detail::AnnotationGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnnotationGenericAdaptorBase; +public: + AnnotationGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnnotationGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnnotationGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnnotationGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInteger() { + return (*getODSOperands(0).begin()); + } + + ValueT getAnnotation() { + return (*getODSOperands(1).begin()); + } + + ValueT getFileName() { + return (*getODSOperands(2).begin()); + } + + ValueT getLine() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnnotationAdaptor : public AnnotationGenericAdaptor<::mlir::ValueRange> { +public: + using AnnotationGenericAdaptor::AnnotationGenericAdaptor; + AnnotationAdaptor(Annotation op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Annotation : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnnotationAdaptor; + template + using GenericAdaptor = AnnotationGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.annotation"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getInteger(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getAnnotation(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getFileName(); + ::mlir::TypedValue<::mlir::IntegerType> getLine(); + ::mlir::OpOperand &getIntegerMutable(); + ::mlir::OpOperand &getAnnotationMutable(); + ::mlir::OpOperand &getFileNameMutable(); + ::mlir::OpOperand &getLineMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value integer, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value integer, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value integer, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::Annotation) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AssumeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssumeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssumeOpGenericAdaptorBase(AssumeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AssumeOpGenericAdaptor : public detail::AssumeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssumeOpGenericAdaptorBase; +public: + AssumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssumeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssumeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCond() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssumeOpAdaptor : public AssumeOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssumeOpGenericAdaptor::AssumeOpGenericAdaptor; + AssumeOpAdaptor(AssumeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssumeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AssumeOpAdaptor; + template + using GenericAdaptor = AssumeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.assume"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getCond(); + ::mlir::OpOperand &getCondMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value cond); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AssumeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::BitReverseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitReverseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitReverseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitReverseOpGenericAdaptorBase(BitReverseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitReverseOpGenericAdaptor : public detail::BitReverseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitReverseOpGenericAdaptorBase; +public: + BitReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitReverseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitReverseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitReverseOpAdaptor : public BitReverseOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitReverseOpGenericAdaptor::BitReverseOpGenericAdaptor; + BitReverseOpAdaptor(BitReverseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitReverseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitReverseOpAdaptor; + template + using GenericAdaptor = BitReverseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.bitreverse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::BitReverseOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ByteSwapOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ByteSwapOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ByteSwapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ByteSwapOpGenericAdaptorBase(ByteSwapOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ByteSwapOpGenericAdaptor : public detail::ByteSwapOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ByteSwapOpGenericAdaptorBase; +public: + ByteSwapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ByteSwapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ByteSwapOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ByteSwapOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ByteSwapOpAdaptor : public ByteSwapOpGenericAdaptor<::mlir::ValueRange> { +public: + using ByteSwapOpGenericAdaptor::ByteSwapOpGenericAdaptor; + ByteSwapOpAdaptor(ByteSwapOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ByteSwapOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ByteSwapOpAdaptor; + template + using GenericAdaptor = ByteSwapOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.bswap"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ByteSwapOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CopySignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CopySignOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CopySignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CopySignOpGenericAdaptorBase(CopySignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class CopySignOpGenericAdaptor : public detail::CopySignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CopySignOpGenericAdaptorBase; +public: + CopySignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CopySignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CopySignOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CopySignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CopySignOpAdaptor : public CopySignOpGenericAdaptor<::mlir::ValueRange> { +public: + using CopySignOpGenericAdaptor::CopySignOpGenericAdaptor; + CopySignOpAdaptor(CopySignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CopySignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CopySignOpAdaptor; + template + using GenericAdaptor = CopySignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.copysign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CopySignOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroAlignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroAlignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroAlignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroAlignOpGenericAdaptorBase(CoroAlignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroAlignOpGenericAdaptor : public detail::CoroAlignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroAlignOpGenericAdaptorBase; +public: + CoroAlignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroAlignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroAlignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroAlignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroAlignOpAdaptor : public CoroAlignOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroAlignOpGenericAdaptor::CoroAlignOpGenericAdaptor; + CoroAlignOpAdaptor(CoroAlignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroAlignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroAlignOpAdaptor; + template + using GenericAdaptor = CoroAlignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.coro.align"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroAlignOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroBeginOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroBeginOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroBeginOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroBeginOpGenericAdaptorBase(CoroBeginOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroBeginOpGenericAdaptor : public detail::CoroBeginOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroBeginOpGenericAdaptorBase; +public: + CoroBeginOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroBeginOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroBeginOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroBeginOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + ValueT getMem() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroBeginOpAdaptor : public CoroBeginOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroBeginOpGenericAdaptor::CoroBeginOpGenericAdaptor; + CoroBeginOpAdaptor(CoroBeginOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroBeginOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroBeginOpAdaptor; + template + using GenericAdaptor = CoroBeginOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.coro.begin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::Value getMem(); + ::mlir::OpOperand &getTokenMutable(); + ::mlir::OpOperand &getMemMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value token, ::mlir::Value mem); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token, ::mlir::Value mem); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroBeginOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroEndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroEndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroEndOpGenericAdaptorBase(CoroEndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroEndOpGenericAdaptor : public detail::CoroEndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroEndOpGenericAdaptorBase; +public: + CoroEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroEndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroEndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getUnwind() { + return (*getODSOperands(1).begin()); + } + + ValueT getRetvals() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroEndOpAdaptor : public CoroEndOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroEndOpGenericAdaptor::CoroEndOpGenericAdaptor; + CoroEndOpAdaptor(CoroEndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroEndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroEndOpAdaptor; + template + using GenericAdaptor = CoroEndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.coro.end"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getHandle(); + ::mlir::TypedValue<::mlir::IntegerType> getUnwind(); + ::mlir::Value getRetvals(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getUnwindMutable(); + ::mlir::OpOperand &getRetvalsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value handle, ::mlir::Value unwind, ::mlir::Value retvals); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value unwind, ::mlir::Value retvals); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroEndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroFreeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroFreeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroFreeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroFreeOpGenericAdaptorBase(CoroFreeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroFreeOpGenericAdaptor : public detail::CoroFreeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroFreeOpGenericAdaptorBase; +public: + CoroFreeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroFreeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroFreeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroFreeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getId() { + return (*getODSOperands(0).begin()); + } + + ValueT getHandle() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroFreeOpAdaptor : public CoroFreeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroFreeOpGenericAdaptor::CoroFreeOpGenericAdaptor; + CoroFreeOpAdaptor(CoroFreeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroFreeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroFreeOpAdaptor; + template + using GenericAdaptor = CoroFreeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.coro.free"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getId(); + ::mlir::Value getHandle(); + ::mlir::OpOperand &getIdMutable(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value id, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value id, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroFreeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroIdOpGenericAdaptorBase(CoroIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroIdOpGenericAdaptor : public detail::CoroIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroIdOpGenericAdaptorBase; +public: + CoroIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAlign() { + return (*getODSOperands(0).begin()); + } + + ValueT getPromise() { + return (*getODSOperands(1).begin()); + } + + ValueT getCoroaddr() { + return (*getODSOperands(2).begin()); + } + + ValueT getFnaddrs() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroIdOpAdaptor : public CoroIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroIdOpGenericAdaptor::CoroIdOpGenericAdaptor; + CoroIdOpAdaptor(CoroIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroIdOpAdaptor; + template + using GenericAdaptor = CoroIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.coro.id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getAlign(); + ::mlir::Value getPromise(); + ::mlir::Value getCoroaddr(); + ::mlir::Value getFnaddrs(); + ::mlir::OpOperand &getAlignMutable(); + ::mlir::OpOperand &getPromiseMutable(); + ::mlir::OpOperand &getCoroaddrMutable(); + ::mlir::OpOperand &getFnaddrsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value align, ::mlir::Value promise, ::mlir::Value coroaddr, ::mlir::Value fnaddrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value align, ::mlir::Value promise, ::mlir::Value coroaddr, ::mlir::Value fnaddrs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroIdOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroResumeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroResumeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroResumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroResumeOpGenericAdaptorBase(CoroResumeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroResumeOpGenericAdaptor : public detail::CoroResumeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroResumeOpGenericAdaptorBase; +public: + CoroResumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroResumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroResumeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroResumeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroResumeOpAdaptor : public CoroResumeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroResumeOpGenericAdaptor::CoroResumeOpGenericAdaptor; + CoroResumeOpAdaptor(CoroResumeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroResumeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroResumeOpAdaptor; + template + using GenericAdaptor = CoroResumeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.coro.resume"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroResumeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroSaveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroSaveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroSaveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroSaveOpGenericAdaptorBase(CoroSaveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroSaveOpGenericAdaptor : public detail::CoroSaveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroSaveOpGenericAdaptorBase; +public: + CoroSaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroSaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroSaveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroSaveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroSaveOpAdaptor : public CoroSaveOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroSaveOpGenericAdaptor::CoroSaveOpGenericAdaptor; + CoroSaveOpAdaptor(CoroSaveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroSaveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroSaveOpAdaptor; + template + using GenericAdaptor = CoroSaveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.coro.save"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroSaveOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroSizeOpGenericAdaptorBase(CoroSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroSizeOpGenericAdaptor : public detail::CoroSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroSizeOpGenericAdaptorBase; +public: + CoroSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroSizeOpAdaptor : public CoroSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroSizeOpGenericAdaptor::CoroSizeOpGenericAdaptor; + CoroSizeOpAdaptor(CoroSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroSizeOpAdaptor; + template + using GenericAdaptor = CoroSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.coro.size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroSizeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CoroSuspendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoroSuspendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoroSuspendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoroSuspendOpGenericAdaptorBase(CoroSuspendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoroSuspendOpGenericAdaptor : public detail::CoroSuspendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoroSuspendOpGenericAdaptorBase; +public: + CoroSuspendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoroSuspendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoroSuspendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoroSuspendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSave() { + return (*getODSOperands(0).begin()); + } + + ValueT getFinal() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoroSuspendOpAdaptor : public CoroSuspendOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoroSuspendOpGenericAdaptor::CoroSuspendOpGenericAdaptor; + CoroSuspendOpAdaptor(CoroSuspendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoroSuspendOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoroSuspendOpAdaptor; + template + using GenericAdaptor = CoroSuspendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.coro.suspend"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSave(); + ::mlir::TypedValue<::mlir::IntegerType> getFinal(); + ::mlir::OpOperand &getSaveMutable(); + ::mlir::OpOperand &getFinalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value save, ::mlir::Value final); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value save, ::mlir::Value final); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CoroSuspendOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CosOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CosOpGenericAdaptorBase(CosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class CosOpGenericAdaptor : public detail::CosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CosOpGenericAdaptorBase; +public: + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CosOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CosOpAdaptor : public CosOpGenericAdaptor<::mlir::ValueRange> { +public: + using CosOpGenericAdaptor::CosOpGenericAdaptor; + CosOpAdaptor(CosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CosOpAdaptor; + template + using GenericAdaptor = CosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.cos"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CosOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CountLeadingZerosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CountLeadingZerosOpGenericAdaptorBase { +public: + struct Properties { + using is_zero_poisonTy = ::mlir::IntegerAttr; + is_zero_poisonTy is_zero_poison; + + auto getIsZeroPoison() { + auto &propStorage = this->is_zero_poison; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIsZeroPoison(const ::mlir::IntegerAttr &propValue) { + this->is_zero_poison = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.is_zero_poison == this->is_zero_poison && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CountLeadingZerosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CountLeadingZerosOpGenericAdaptorBase(CountLeadingZerosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIsZeroPoisonAttr(); + bool getIsZeroPoison(); +}; +} // namespace detail +template +class CountLeadingZerosOpGenericAdaptor : public detail::CountLeadingZerosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CountLeadingZerosOpGenericAdaptorBase; +public: + CountLeadingZerosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CountLeadingZerosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CountLeadingZerosOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CountLeadingZerosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CountLeadingZerosOpAdaptor : public CountLeadingZerosOpGenericAdaptor<::mlir::ValueRange> { +public: + using CountLeadingZerosOpGenericAdaptor::CountLeadingZerosOpGenericAdaptor; + CountLeadingZerosOpAdaptor(CountLeadingZerosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CountLeadingZerosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CountLeadingZerosOpAdaptor; + template + using GenericAdaptor = CountLeadingZerosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_zero_poison")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsZeroPoisonAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsZeroPoisonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.ctlz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIsZeroPoisonAttr(); + bool getIsZeroPoison(); + void setIsZeroPoisonAttr(::mlir::IntegerAttr attr); + void setIsZeroPoison(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::IntegerAttr is_zero_poison); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::IntegerAttr is_zero_poison); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, bool is_zero_poison); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, bool is_zero_poison); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CountLeadingZerosOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CountTrailingZerosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CountTrailingZerosOpGenericAdaptorBase { +public: + struct Properties { + using is_zero_poisonTy = ::mlir::IntegerAttr; + is_zero_poisonTy is_zero_poison; + + auto getIsZeroPoison() { + auto &propStorage = this->is_zero_poison; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIsZeroPoison(const ::mlir::IntegerAttr &propValue) { + this->is_zero_poison = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.is_zero_poison == this->is_zero_poison && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CountTrailingZerosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CountTrailingZerosOpGenericAdaptorBase(CountTrailingZerosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIsZeroPoisonAttr(); + bool getIsZeroPoison(); +}; +} // namespace detail +template +class CountTrailingZerosOpGenericAdaptor : public detail::CountTrailingZerosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CountTrailingZerosOpGenericAdaptorBase; +public: + CountTrailingZerosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CountTrailingZerosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CountTrailingZerosOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CountTrailingZerosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CountTrailingZerosOpAdaptor : public CountTrailingZerosOpGenericAdaptor<::mlir::ValueRange> { +public: + using CountTrailingZerosOpGenericAdaptor::CountTrailingZerosOpGenericAdaptor; + CountTrailingZerosOpAdaptor(CountTrailingZerosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CountTrailingZerosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CountTrailingZerosOpAdaptor; + template + using GenericAdaptor = CountTrailingZerosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_zero_poison")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsZeroPoisonAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsZeroPoisonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.cttz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIsZeroPoisonAttr(); + bool getIsZeroPoison(); + void setIsZeroPoisonAttr(::mlir::IntegerAttr attr); + void setIsZeroPoison(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::IntegerAttr is_zero_poison); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::IntegerAttr is_zero_poison); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, bool is_zero_poison); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, bool is_zero_poison); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CountTrailingZerosOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CtPopOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CtPopOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CtPopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CtPopOpGenericAdaptorBase(CtPopOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CtPopOpGenericAdaptor : public detail::CtPopOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CtPopOpGenericAdaptorBase; +public: + CtPopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CtPopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CtPopOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CtPopOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CtPopOpAdaptor : public CtPopOpGenericAdaptor<::mlir::ValueRange> { +public: + using CtPopOpGenericAdaptor::CtPopOpGenericAdaptor; + CtPopOpAdaptor(CtPopOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CtPopOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CtPopOpAdaptor; + template + using GenericAdaptor = CtPopOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.ctpop"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CtPopOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::DbgDeclareOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DbgDeclareOpGenericAdaptorBase { +public: + struct Properties { + using varInfoTy = ::mlir::LLVM::DILocalVariableAttr; + varInfoTy varInfo; + + auto getVarInfo() { + auto &propStorage = this->varInfo; + return ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(propStorage); + } + void setVarInfo(const ::mlir::LLVM::DILocalVariableAttr &propValue) { + this->varInfo = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.varInfo == this->varInfo && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DbgDeclareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DbgDeclareOpGenericAdaptorBase(DbgDeclareOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::DILocalVariableAttr getVarInfoAttr(); + ::mlir::LLVM::DILocalVariableAttr getVarInfo(); +}; +} // namespace detail +template +class DbgDeclareOpGenericAdaptor : public detail::DbgDeclareOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DbgDeclareOpGenericAdaptorBase; +public: + DbgDeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DbgDeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DbgDeclareOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DbgDeclareOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DbgDeclareOpAdaptor : public DbgDeclareOpGenericAdaptor<::mlir::ValueRange> { +public: + using DbgDeclareOpGenericAdaptor::DbgDeclareOpGenericAdaptor; + DbgDeclareOpAdaptor(DbgDeclareOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DbgDeclareOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DbgDeclareOpAdaptor; + template + using GenericAdaptor = DbgDeclareOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("varInfo")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getVarInfoAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getVarInfoAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.dbg.declare"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getAddr(); + ::mlir::OpOperand &getAddrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::DILocalVariableAttr getVarInfoAttr(); + ::mlir::LLVM::DILocalVariableAttr getVarInfo(); + void setVarInfoAttr(::mlir::LLVM::DILocalVariableAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::LLVM::DILocalVariableAttr varInfo); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::LLVM::DILocalVariableAttr varInfo); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + bool canUsesBeRemoved(const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DbgDeclareOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::DbgLabelOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DbgLabelOpGenericAdaptorBase { +public: + struct Properties { + using labelTy = ::mlir::LLVM::DILabelAttr; + labelTy label; + + auto getLabel() { + auto &propStorage = this->label; + return ::llvm::cast<::mlir::LLVM::DILabelAttr>(propStorage); + } + void setLabel(const ::mlir::LLVM::DILabelAttr &propValue) { + this->label = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.label == this->label && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DbgLabelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DbgLabelOpGenericAdaptorBase(DbgLabelOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::DILabelAttr getLabelAttr(); + ::mlir::LLVM::DILabelAttr getLabel(); +}; +} // namespace detail +template +class DbgLabelOpGenericAdaptor : public detail::DbgLabelOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DbgLabelOpGenericAdaptorBase; +public: + DbgLabelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DbgLabelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DbgLabelOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DbgLabelOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DbgLabelOpAdaptor : public DbgLabelOpGenericAdaptor<::mlir::ValueRange> { +public: + using DbgLabelOpGenericAdaptor::DbgLabelOpGenericAdaptor; + DbgLabelOpAdaptor(DbgLabelOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DbgLabelOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DbgLabelOpAdaptor; + template + using GenericAdaptor = DbgLabelOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("label")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLabelAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLabelAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.dbg.label"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::DILabelAttr getLabelAttr(); + ::mlir::LLVM::DILabelAttr getLabel(); + void setLabelAttr(::mlir::LLVM::DILabelAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::DILabelAttr label); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::DILabelAttr label); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DbgLabelOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::DbgValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DbgValueOpGenericAdaptorBase { +public: + struct Properties { + using varInfoTy = ::mlir::LLVM::DILocalVariableAttr; + varInfoTy varInfo; + + auto getVarInfo() { + auto &propStorage = this->varInfo; + return ::llvm::cast<::mlir::LLVM::DILocalVariableAttr>(propStorage); + } + void setVarInfo(const ::mlir::LLVM::DILocalVariableAttr &propValue) { + this->varInfo = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.varInfo == this->varInfo && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DbgValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DbgValueOpGenericAdaptorBase(DbgValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::DILocalVariableAttr getVarInfoAttr(); + ::mlir::LLVM::DILocalVariableAttr getVarInfo(); +}; +} // namespace detail +template +class DbgValueOpGenericAdaptor : public detail::DbgValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DbgValueOpGenericAdaptorBase; +public: + DbgValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DbgValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DbgValueOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DbgValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DbgValueOpAdaptor : public DbgValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using DbgValueOpGenericAdaptor::DbgValueOpGenericAdaptor; + DbgValueOpAdaptor(DbgValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DbgValueOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DbgValueOpAdaptor; + template + using GenericAdaptor = DbgValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("varInfo")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getVarInfoAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getVarInfoAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.dbg.value"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::DILocalVariableAttr getVarInfoAttr(); + ::mlir::LLVM::DILocalVariableAttr getVarInfo(); + void setVarInfoAttr(::mlir::LLVM::DILocalVariableAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::LLVM::DILocalVariableAttr varInfo); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::LLVM::DILocalVariableAttr varInfo); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + bool canUsesBeRemoved(const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DbgValueOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::DebugTrap declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DebugTrapGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DebugTrapGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DebugTrapGenericAdaptorBase(DebugTrap op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DebugTrapGenericAdaptor : public detail::DebugTrapGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DebugTrapGenericAdaptorBase; +public: + DebugTrapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DebugTrapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DebugTrapGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DebugTrapGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DebugTrapAdaptor : public DebugTrapGenericAdaptor<::mlir::ValueRange> { +public: + using DebugTrapGenericAdaptor::DebugTrapGenericAdaptor; + DebugTrapAdaptor(DebugTrap op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DebugTrap : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DebugTrapAdaptor; + template + using GenericAdaptor = DebugTrapGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.debugtrap"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DebugTrap) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::EhTypeidForOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EhTypeidForOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EhTypeidForOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EhTypeidForOpGenericAdaptorBase(EhTypeidForOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EhTypeidForOpGenericAdaptor : public detail::EhTypeidForOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EhTypeidForOpGenericAdaptorBase; +public: + EhTypeidForOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EhTypeidForOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EhTypeidForOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EhTypeidForOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTypeInfo() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EhTypeidForOpAdaptor : public EhTypeidForOpGenericAdaptor<::mlir::ValueRange> { +public: + using EhTypeidForOpGenericAdaptor::EhTypeidForOpGenericAdaptor; + EhTypeidForOpAdaptor(EhTypeidForOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EhTypeidForOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = EhTypeidForOpAdaptor; + template + using GenericAdaptor = EhTypeidForOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.eh.typeid.for"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getTypeInfo(); + ::mlir::OpOperand &getTypeInfoMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value type_info); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value type_info); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::EhTypeidForOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Exp2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Exp2OpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Exp2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Exp2OpGenericAdaptorBase(Exp2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class Exp2OpGenericAdaptor : public detail::Exp2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Exp2OpGenericAdaptorBase; +public: + Exp2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Exp2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Exp2OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Exp2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Exp2OpAdaptor : public Exp2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Exp2OpGenericAdaptor::Exp2OpGenericAdaptor; + Exp2OpAdaptor(Exp2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Exp2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Exp2OpAdaptor; + template + using GenericAdaptor = Exp2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.exp2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::Exp2Op) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpOpGenericAdaptorBase(ExpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpOpGenericAdaptorBase; +public: + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpOpGenericAdaptor::ExpOpGenericAdaptor; + ExpOpAdaptor(ExpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpOpAdaptor; + template + using GenericAdaptor = ExpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.exp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExpOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExpectOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpectOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExpectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpectOpGenericAdaptorBase(ExpectOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExpectOpGenericAdaptor : public detail::ExpectOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpectOpGenericAdaptorBase; +public: + ExpectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpectOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExpectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + ValueT getExpected() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpectOpAdaptor : public ExpectOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpectOpGenericAdaptor::ExpectOpGenericAdaptor; + ExpectOpAdaptor(ExpectOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpectOpAdaptor; + template + using GenericAdaptor = ExpectOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.expect"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getVal(); + ::mlir::TypedValue<::mlir::IntegerType> getExpected(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getExpectedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value expected); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value expected); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value expected); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExpectOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExpectWithProbabilityOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpectWithProbabilityOpGenericAdaptorBase { +public: + struct Properties { + using probTy = ::mlir::FloatAttr; + probTy prob; + + auto getProb() { + auto &propStorage = this->prob; + return ::llvm::cast<::mlir::FloatAttr>(propStorage); + } + void setProb(const ::mlir::FloatAttr &propValue) { + this->prob = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.prob == this->prob && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExpectWithProbabilityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpectWithProbabilityOpGenericAdaptorBase(ExpectWithProbabilityOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getProbAttr(); + ::llvm::APFloat getProb(); +}; +} // namespace detail +template +class ExpectWithProbabilityOpGenericAdaptor : public detail::ExpectWithProbabilityOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpectWithProbabilityOpGenericAdaptorBase; +public: + ExpectWithProbabilityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpectWithProbabilityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpectWithProbabilityOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExpectWithProbabilityOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + ValueT getExpected() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpectWithProbabilityOpAdaptor : public ExpectWithProbabilityOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpectWithProbabilityOpGenericAdaptor::ExpectWithProbabilityOpGenericAdaptor; + ExpectWithProbabilityOpAdaptor(ExpectWithProbabilityOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpectWithProbabilityOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpectWithProbabilityOpAdaptor; + template + using GenericAdaptor = ExpectWithProbabilityOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("prob")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getProbAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getProbAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.expect.with.probability"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getVal(); + ::mlir::TypedValue<::mlir::IntegerType> getExpected(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getExpectedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::FloatAttr getProbAttr(); + ::llvm::APFloat getProb(); + void setProbAttr(::mlir::FloatAttr attr); + void setProb(::llvm::APFloat attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value expected, ::mlir::FloatAttr prob); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value expected, ::mlir::FloatAttr prob); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value expected, ::mlir::FloatAttr prob); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value expected, ::llvm::APFloat prob); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value expected, ::llvm::APFloat prob); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value expected, ::llvm::APFloat prob); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExpectWithProbabilityOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FAbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FAbsOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FAbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FAbsOpGenericAdaptorBase(FAbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FAbsOpGenericAdaptor : public detail::FAbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FAbsOpGenericAdaptorBase; +public: + FAbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FAbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FAbsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FAbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FAbsOpAdaptor : public FAbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using FAbsOpGenericAdaptor::FAbsOpGenericAdaptor; + FAbsOpAdaptor(FAbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FAbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FAbsOpAdaptor; + template + using GenericAdaptor = FAbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.fabs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FAbsOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FCeilOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FCeilOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FCeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FCeilOpGenericAdaptorBase(FCeilOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FCeilOpGenericAdaptor : public detail::FCeilOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FCeilOpGenericAdaptorBase; +public: + FCeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FCeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FCeilOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FCeilOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FCeilOpAdaptor : public FCeilOpGenericAdaptor<::mlir::ValueRange> { +public: + using FCeilOpGenericAdaptor::FCeilOpGenericAdaptor; + FCeilOpAdaptor(FCeilOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FCeilOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FCeilOpAdaptor; + template + using GenericAdaptor = FCeilOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.ceil"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FCeilOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FFloorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FFloorOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FFloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FFloorOpGenericAdaptorBase(FFloorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FFloorOpGenericAdaptor : public detail::FFloorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FFloorOpGenericAdaptorBase; +public: + FFloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FFloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FFloorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FFloorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FFloorOpAdaptor : public FFloorOpGenericAdaptor<::mlir::ValueRange> { +public: + using FFloorOpGenericAdaptor::FFloorOpGenericAdaptor; + FFloorOpAdaptor(FFloorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FFloorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FFloorOpAdaptor; + template + using GenericAdaptor = FFloorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.floor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FFloorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FMAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FMAOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FMAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FMAOpGenericAdaptorBase(FMAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FMAOpGenericAdaptor : public detail::FMAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FMAOpGenericAdaptorBase; +public: + FMAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FMAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FMAOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FMAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FMAOpAdaptor : public FMAOpGenericAdaptor<::mlir::ValueRange> { +public: + using FMAOpGenericAdaptor::FMAOpGenericAdaptor; + FMAOpAdaptor(FMAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FMAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FMAOpAdaptor; + template + using GenericAdaptor = FMAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.fma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::Value getC(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FMAOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FMulAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FMulAddOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FMulAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FMulAddOpGenericAdaptorBase(FMulAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FMulAddOpGenericAdaptor : public detail::FMulAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FMulAddOpGenericAdaptorBase; +public: + FMulAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FMulAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FMulAddOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FMulAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FMulAddOpAdaptor : public FMulAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using FMulAddOpGenericAdaptor::FMulAddOpGenericAdaptor; + FMulAddOpAdaptor(FMulAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FMulAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FMulAddOpAdaptor; + template + using GenericAdaptor = FMulAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.fmuladd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::Value getC(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FMulAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FTruncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FTruncOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FTruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FTruncOpGenericAdaptorBase(FTruncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FTruncOpGenericAdaptor : public detail::FTruncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FTruncOpGenericAdaptorBase; +public: + FTruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FTruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FTruncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FTruncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FTruncOpAdaptor : public FTruncOpGenericAdaptor<::mlir::ValueRange> { +public: + using FTruncOpGenericAdaptor::FTruncOpGenericAdaptor; + FTruncOpAdaptor(FTruncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FTruncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FTruncOpAdaptor; + template + using GenericAdaptor = FTruncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.trunc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FTruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FshlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FshlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FshlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FshlOpGenericAdaptorBase(FshlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FshlOpGenericAdaptor : public detail::FshlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FshlOpGenericAdaptorBase; +public: + FshlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FshlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FshlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FshlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FshlOpAdaptor : public FshlOpGenericAdaptor<::mlir::ValueRange> { +public: + using FshlOpGenericAdaptor::FshlOpGenericAdaptor; + FshlOpAdaptor(FshlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FshlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FshlOpAdaptor; + template + using GenericAdaptor = FshlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.fshl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::Value getC(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FshlOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FshrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FshrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FshrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FshrOpGenericAdaptorBase(FshrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FshrOpGenericAdaptor : public detail::FshrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FshrOpGenericAdaptorBase; +public: + FshrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FshrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FshrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FshrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FshrOpAdaptor : public FshrOpGenericAdaptor<::mlir::ValueRange> { +public: + using FshrOpGenericAdaptor::FshrOpGenericAdaptor; + FshrOpAdaptor(FshrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FshrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FshrOpAdaptor; + template + using GenericAdaptor = FshrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.fshr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::Value getC(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FshrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GetActiveLaneMaskOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetActiveLaneMaskOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetActiveLaneMaskOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetActiveLaneMaskOpGenericAdaptorBase(GetActiveLaneMaskOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetActiveLaneMaskOpGenericAdaptor : public detail::GetActiveLaneMaskOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetActiveLaneMaskOpGenericAdaptorBase; +public: + GetActiveLaneMaskOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetActiveLaneMaskOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetActiveLaneMaskOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetActiveLaneMaskOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBase() { + return (*getODSOperands(0).begin()); + } + + ValueT getN() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetActiveLaneMaskOpAdaptor : public GetActiveLaneMaskOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetActiveLaneMaskOpGenericAdaptor::GetActiveLaneMaskOpGenericAdaptor; + GetActiveLaneMaskOpAdaptor(GetActiveLaneMaskOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetActiveLaneMaskOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetActiveLaneMaskOpAdaptor; + template + using GenericAdaptor = GetActiveLaneMaskOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.get.active.lane.mask"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getBase(); + ::mlir::TypedValue<::mlir::IntegerType> getN(); + ::mlir::OpOperand &getBaseMutable(); + ::mlir::OpOperand &getNMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value base, ::mlir::Value n); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value n); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::GetActiveLaneMaskOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::IsConstantOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsConstantOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsConstantOpGenericAdaptorBase(IsConstantOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsConstantOpGenericAdaptor : public detail::IsConstantOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsConstantOpGenericAdaptorBase; +public: + IsConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsConstantOpAdaptor : public IsConstantOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsConstantOpGenericAdaptor::IsConstantOpGenericAdaptor; + IsConstantOpAdaptor(IsConstantOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsConstantOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsConstantOpAdaptor; + template + using GenericAdaptor = IsConstantOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.is.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::OpOperand &getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::IsConstantOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::IsFPClass declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsFPClassGenericAdaptorBase { +public: + struct Properties { + using bitTy = ::mlir::IntegerAttr; + bitTy bit; + + auto getBit() { + auto &propStorage = this->bit; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setBit(const ::mlir::IntegerAttr &propValue) { + this->bit = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.bit == this->bit && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + IsFPClassGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + IsFPClassGenericAdaptorBase(IsFPClass op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBitAttr(); + uint32_t getBit(); +}; +} // namespace detail +template +class IsFPClassGenericAdaptor : public detail::IsFPClassGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsFPClassGenericAdaptorBase; +public: + IsFPClassGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsFPClassGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsFPClassGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + IsFPClassGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsFPClassAdaptor : public IsFPClassGenericAdaptor<::mlir::ValueRange> { +public: + using IsFPClassGenericAdaptor::IsFPClassGenericAdaptor; + IsFPClassAdaptor(IsFPClass op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsFPClass : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsFPClassAdaptor; + template + using GenericAdaptor = IsFPClassGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("bit")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBitAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.is.fpclass"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getBitAttr(); + uint32_t getBit(); + void setBitAttr(::mlir::IntegerAttr attr); + void setBit(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::IntegerAttr bit); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::IntegerAttr bit); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, uint32_t bit); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, uint32_t bit); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::IsFPClass) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LifetimeEndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LifetimeEndOpGenericAdaptorBase { +public: + struct Properties { + using sizeTy = ::mlir::IntegerAttr; + sizeTy size; + + auto getSize() { + auto &propStorage = this->size; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setSize(const ::mlir::IntegerAttr &propValue) { + this->size = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.size == this->size && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LifetimeEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LifetimeEndOpGenericAdaptorBase(LifetimeEndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSizeAttr(); + uint64_t getSize(); +}; +} // namespace detail +template +class LifetimeEndOpGenericAdaptor : public detail::LifetimeEndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LifetimeEndOpGenericAdaptorBase; +public: + LifetimeEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LifetimeEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LifetimeEndOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LifetimeEndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LifetimeEndOpAdaptor : public LifetimeEndOpGenericAdaptor<::mlir::ValueRange> { +public: + using LifetimeEndOpGenericAdaptor::LifetimeEndOpGenericAdaptor; + LifetimeEndOpAdaptor(LifetimeEndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LifetimeEndOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LifetimeEndOpAdaptor; + template + using GenericAdaptor = LifetimeEndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSizeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.lifetime.end"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::OpOperand &getPtrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getSizeAttr(); + uint64_t getSize(); + void setSizeAttr(::mlir::IntegerAttr attr); + void setSize(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr size, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr size, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t size, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t size, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + bool canUsesBeRemoved(const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LifetimeEndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LifetimeStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LifetimeStartOpGenericAdaptorBase { +public: + struct Properties { + using sizeTy = ::mlir::IntegerAttr; + sizeTy size; + + auto getSize() { + auto &propStorage = this->size; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setSize(const ::mlir::IntegerAttr &propValue) { + this->size = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.size == this->size && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LifetimeStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LifetimeStartOpGenericAdaptorBase(LifetimeStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSizeAttr(); + uint64_t getSize(); +}; +} // namespace detail +template +class LifetimeStartOpGenericAdaptor : public detail::LifetimeStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LifetimeStartOpGenericAdaptorBase; +public: + LifetimeStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LifetimeStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LifetimeStartOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LifetimeStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LifetimeStartOpAdaptor : public LifetimeStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using LifetimeStartOpGenericAdaptor::LifetimeStartOpGenericAdaptor; + LifetimeStartOpAdaptor(LifetimeStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LifetimeStartOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LifetimeStartOpAdaptor; + template + using GenericAdaptor = LifetimeStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSizeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.lifetime.start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::OpOperand &getPtrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getSizeAttr(); + uint64_t getSize(); + void setSizeAttr(::mlir::IntegerAttr attr); + void setSize(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr size, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr size, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t size, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t size, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + bool canUsesBeRemoved(const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LifetimeStartOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LlrintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LlrintOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LlrintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LlrintOpGenericAdaptorBase(LlrintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LlrintOpGenericAdaptor : public detail::LlrintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LlrintOpGenericAdaptorBase; +public: + LlrintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LlrintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LlrintOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LlrintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LlrintOpAdaptor : public LlrintOpGenericAdaptor<::mlir::ValueRange> { +public: + using LlrintOpGenericAdaptor::LlrintOpGenericAdaptor; + LlrintOpAdaptor(LlrintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LlrintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LlrintOpAdaptor; + template + using GenericAdaptor = LlrintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.llrint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::OpOperand &getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LlrintOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LlroundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LlroundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LlroundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LlroundOpGenericAdaptorBase(LlroundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LlroundOpGenericAdaptor : public detail::LlroundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LlroundOpGenericAdaptorBase; +public: + LlroundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LlroundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LlroundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LlroundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LlroundOpAdaptor : public LlroundOpGenericAdaptor<::mlir::ValueRange> { +public: + using LlroundOpGenericAdaptor::LlroundOpGenericAdaptor; + LlroundOpAdaptor(LlroundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LlroundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LlroundOpAdaptor; + template + using GenericAdaptor = LlroundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.llround"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::OpOperand &getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LlroundOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Log10Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log10OpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Log10OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Log10OpGenericAdaptorBase(Log10Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class Log10OpGenericAdaptor : public detail::Log10OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log10OpGenericAdaptorBase; +public: + Log10OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log10OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log10OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Log10OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log10OpAdaptor : public Log10OpGenericAdaptor<::mlir::ValueRange> { +public: + using Log10OpGenericAdaptor::Log10OpGenericAdaptor; + Log10OpAdaptor(Log10Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log10Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log10OpAdaptor; + template + using GenericAdaptor = Log10OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.log10"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::Log10Op) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Log2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log2OpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Log2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Log2OpGenericAdaptorBase(Log2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class Log2OpGenericAdaptor : public detail::Log2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log2OpGenericAdaptorBase; +public: + Log2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log2OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Log2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log2OpAdaptor : public Log2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Log2OpGenericAdaptor::Log2OpGenericAdaptor; + Log2OpAdaptor(Log2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log2OpAdaptor; + template + using GenericAdaptor = Log2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.log2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::Log2Op) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LogOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LogOpGenericAdaptorBase(LogOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogOpGenericAdaptorBase; +public: + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogOpGenericAdaptor::LogOpGenericAdaptor; + LogOpAdaptor(LogOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogOpAdaptor; + template + using GenericAdaptor = LogOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.log"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LogOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LrintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LrintOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LrintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LrintOpGenericAdaptorBase(LrintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LrintOpGenericAdaptor : public detail::LrintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LrintOpGenericAdaptorBase; +public: + LrintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LrintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LrintOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LrintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LrintOpAdaptor : public LrintOpGenericAdaptor<::mlir::ValueRange> { +public: + using LrintOpGenericAdaptor::LrintOpGenericAdaptor; + LrintOpAdaptor(LrintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LrintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LrintOpAdaptor; + template + using GenericAdaptor = LrintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.lrint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::OpOperand &getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LrintOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LroundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LroundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LroundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LroundOpGenericAdaptorBase(LroundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LroundOpGenericAdaptor : public detail::LroundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LroundOpGenericAdaptorBase; +public: + LroundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LroundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LroundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LroundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LroundOpAdaptor : public LroundOpGenericAdaptor<::mlir::ValueRange> { +public: + using LroundOpGenericAdaptor::LroundOpGenericAdaptor; + LroundOpAdaptor(LroundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LroundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LroundOpAdaptor; + template + using GenericAdaptor = LroundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.lround"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::OpOperand &getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LroundOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MaskedLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaskedLoadOpGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MaskedLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MaskedLoadOpGenericAdaptorBase(MaskedLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); +}; +} // namespace detail +template +class MaskedLoadOpGenericAdaptor : public detail::MaskedLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaskedLoadOpGenericAdaptorBase; +public: + MaskedLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaskedLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaskedLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MaskedLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + RangeT getPassThru() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaskedLoadOpAdaptor : public MaskedLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaskedLoadOpGenericAdaptor::MaskedLoadOpGenericAdaptor; + MaskedLoadOpAdaptor(MaskedLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaskedLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaskedLoadOpAdaptor; + template + using GenericAdaptor = MaskedLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.masked.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getData(); + ::mlir::Value getMask(); + ::mlir::Operation::operand_range getPassThru(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::MutableOperandRange getPassThruMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value data, ::mlir::Value mask, ::mlir::ValueRange pass_thru, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value mask, ::mlir::ValueRange pass_thru, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value data, ::mlir::Value mask, ::mlir::ValueRange pass_thru, uint32_t alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value mask, ::mlir::ValueRange pass_thru, uint32_t alignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MaskedLoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MaskedStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaskedStoreOpGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MaskedStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MaskedStoreOpGenericAdaptorBase(MaskedStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); +}; +} // namespace detail +template +class MaskedStoreOpGenericAdaptor : public detail::MaskedStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaskedStoreOpGenericAdaptorBase; +public: + MaskedStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaskedStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaskedStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MaskedStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getData() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaskedStoreOpAdaptor : public MaskedStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaskedStoreOpGenericAdaptor::MaskedStoreOpGenericAdaptor; + MaskedStoreOpAdaptor(MaskedStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaskedStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaskedStoreOpAdaptor; + template + using GenericAdaptor = MaskedStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.masked.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getData(); + ::mlir::Value getMask(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getMaskMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value data, ::mlir::Value mask, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value data, ::mlir::Value mask, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value data, ::mlir::Value mask, uint32_t alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value data, ::mlir::Value mask, uint32_t alignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MaskedStoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MatrixColumnMajorLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixColumnMajorLoadOpGenericAdaptorBase { +public: + struct Properties { + using columnsTy = ::mlir::IntegerAttr; + columnsTy columns; + + auto getColumns() { + auto &propStorage = this->columns; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setColumns(const ::mlir::IntegerAttr &propValue) { + this->columns = propValue; + } + using isVolatileTy = ::mlir::IntegerAttr; + isVolatileTy isVolatile; + + auto getIsVolatile() { + auto &propStorage = this->isVolatile; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIsVolatile(const ::mlir::IntegerAttr &propValue) { + this->isVolatile = propValue; + } + using rowsTy = ::mlir::IntegerAttr; + rowsTy rows; + + auto getRows() { + auto &propStorage = this->rows; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setRows(const ::mlir::IntegerAttr &propValue) { + this->rows = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.columns == this->columns && + rhs.isVolatile == this->isVolatile && + rhs.rows == this->rows && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MatrixColumnMajorLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixColumnMajorLoadOpGenericAdaptorBase(MatrixColumnMajorLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::IntegerAttr getRowsAttr(); + uint32_t getRows(); + ::mlir::IntegerAttr getColumnsAttr(); + uint32_t getColumns(); +}; +} // namespace detail +template +class MatrixColumnMajorLoadOpGenericAdaptor : public detail::MatrixColumnMajorLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixColumnMajorLoadOpGenericAdaptorBase; +public: + MatrixColumnMajorLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixColumnMajorLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixColumnMajorLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MatrixColumnMajorLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getStride() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixColumnMajorLoadOpAdaptor : public MatrixColumnMajorLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixColumnMajorLoadOpGenericAdaptor::MatrixColumnMajorLoadOpGenericAdaptor; + MatrixColumnMajorLoadOpAdaptor(MatrixColumnMajorLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixColumnMajorLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixColumnMajorLoadOpAdaptor; + template + using GenericAdaptor = MatrixColumnMajorLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("columns"), ::llvm::StringRef("isVolatile"), ::llvm::StringRef("rows")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getColumnsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getColumnsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsVolatileAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsVolatileAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRowsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRowsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.matrix.column.major.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getData(); + ::mlir::TypedValue<::mlir::IntegerType> getStride(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getStrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::IntegerAttr getRowsAttr(); + uint32_t getRows(); + ::mlir::IntegerAttr getColumnsAttr(); + uint32_t getColumns(); + void setIsVolatileAttr(::mlir::IntegerAttr attr); + void setIsVolatile(bool attrValue); + void setRowsAttr(::mlir::IntegerAttr attr); + void setRows(uint32_t attrValue); + void setColumnsAttr(::mlir::IntegerAttr attr); + void setColumns(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value data, ::mlir::Value stride, ::mlir::IntegerAttr isVolatile, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value stride, ::mlir::IntegerAttr isVolatile, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value data, ::mlir::Value stride, bool isVolatile, uint32_t rows, uint32_t columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value stride, bool isVolatile, uint32_t rows, uint32_t columns); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MatrixColumnMajorLoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MatrixColumnMajorStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixColumnMajorStoreOpGenericAdaptorBase { +public: + struct Properties { + using columnsTy = ::mlir::IntegerAttr; + columnsTy columns; + + auto getColumns() { + auto &propStorage = this->columns; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setColumns(const ::mlir::IntegerAttr &propValue) { + this->columns = propValue; + } + using isVolatileTy = ::mlir::IntegerAttr; + isVolatileTy isVolatile; + + auto getIsVolatile() { + auto &propStorage = this->isVolatile; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIsVolatile(const ::mlir::IntegerAttr &propValue) { + this->isVolatile = propValue; + } + using rowsTy = ::mlir::IntegerAttr; + rowsTy rows; + + auto getRows() { + auto &propStorage = this->rows; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setRows(const ::mlir::IntegerAttr &propValue) { + this->rows = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.columns == this->columns && + rhs.isVolatile == this->isVolatile && + rhs.rows == this->rows && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MatrixColumnMajorStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixColumnMajorStoreOpGenericAdaptorBase(MatrixColumnMajorStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::IntegerAttr getRowsAttr(); + uint32_t getRows(); + ::mlir::IntegerAttr getColumnsAttr(); + uint32_t getColumns(); +}; +} // namespace detail +template +class MatrixColumnMajorStoreOpGenericAdaptor : public detail::MatrixColumnMajorStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixColumnMajorStoreOpGenericAdaptorBase; +public: + MatrixColumnMajorStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixColumnMajorStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixColumnMajorStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MatrixColumnMajorStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMatrix() { + return (*getODSOperands(0).begin()); + } + + ValueT getData() { + return (*getODSOperands(1).begin()); + } + + ValueT getStride() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixColumnMajorStoreOpAdaptor : public MatrixColumnMajorStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixColumnMajorStoreOpGenericAdaptor::MatrixColumnMajorStoreOpGenericAdaptor; + MatrixColumnMajorStoreOpAdaptor(MatrixColumnMajorStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixColumnMajorStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixColumnMajorStoreOpAdaptor; + template + using GenericAdaptor = MatrixColumnMajorStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("columns"), ::llvm::StringRef("isVolatile"), ::llvm::StringRef("rows")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getColumnsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getColumnsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsVolatileAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsVolatileAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRowsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRowsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.matrix.column.major.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getMatrix(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getData(); + ::mlir::TypedValue<::mlir::IntegerType> getStride(); + ::mlir::OpOperand &getMatrixMutable(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getStrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::IntegerAttr getRowsAttr(); + uint32_t getRows(); + ::mlir::IntegerAttr getColumnsAttr(); + uint32_t getColumns(); + void setIsVolatileAttr(::mlir::IntegerAttr attr); + void setIsVolatile(bool attrValue); + void setRowsAttr(::mlir::IntegerAttr attr); + void setRows(uint32_t attrValue); + void setColumnsAttr(::mlir::IntegerAttr attr); + void setColumns(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value matrix, ::mlir::Value data, ::mlir::Value stride, ::mlir::IntegerAttr isVolatile, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value data, ::mlir::Value stride, ::mlir::IntegerAttr isVolatile, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value matrix, ::mlir::Value data, ::mlir::Value stride, bool isVolatile, uint32_t rows, uint32_t columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value data, ::mlir::Value stride, bool isVolatile, uint32_t rows, uint32_t columns); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MatrixColumnMajorStoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MatrixMultiplyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixMultiplyOpGenericAdaptorBase { +public: + struct Properties { + using lhs_columnsTy = ::mlir::IntegerAttr; + lhs_columnsTy lhs_columns; + + auto getLhsColumns() { + auto &propStorage = this->lhs_columns; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setLhsColumns(const ::mlir::IntegerAttr &propValue) { + this->lhs_columns = propValue; + } + using lhs_rowsTy = ::mlir::IntegerAttr; + lhs_rowsTy lhs_rows; + + auto getLhsRows() { + auto &propStorage = this->lhs_rows; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setLhsRows(const ::mlir::IntegerAttr &propValue) { + this->lhs_rows = propValue; + } + using rhs_columnsTy = ::mlir::IntegerAttr; + rhs_columnsTy rhs_columns; + + auto getRhsColumns() { + auto &propStorage = this->rhs_columns; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setRhsColumns(const ::mlir::IntegerAttr &propValue) { + this->rhs_columns = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.lhs_columns == this->lhs_columns && + rhs.lhs_rows == this->lhs_rows && + rhs.rhs_columns == this->rhs_columns && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MatrixMultiplyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixMultiplyOpGenericAdaptorBase(MatrixMultiplyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLhsRowsAttr(); + uint32_t getLhsRows(); + ::mlir::IntegerAttr getLhsColumnsAttr(); + uint32_t getLhsColumns(); + ::mlir::IntegerAttr getRhsColumnsAttr(); + uint32_t getRhsColumns(); +}; +} // namespace detail +template +class MatrixMultiplyOpGenericAdaptor : public detail::MatrixMultiplyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixMultiplyOpGenericAdaptorBase; +public: + MatrixMultiplyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixMultiplyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixMultiplyOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MatrixMultiplyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixMultiplyOpAdaptor : public MatrixMultiplyOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixMultiplyOpGenericAdaptor::MatrixMultiplyOpGenericAdaptor; + MatrixMultiplyOpAdaptor(MatrixMultiplyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixMultiplyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixMultiplyOpAdaptor; + template + using GenericAdaptor = MatrixMultiplyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("lhs_columns"), ::llvm::StringRef("lhs_rows"), ::llvm::StringRef("rhs_columns")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLhsColumnsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLhsColumnsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLhsRowsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLhsRowsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRhsColumnsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRhsColumnsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.matrix.multiply"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getLhsRowsAttr(); + uint32_t getLhsRows(); + ::mlir::IntegerAttr getLhsColumnsAttr(); + uint32_t getLhsColumns(); + ::mlir::IntegerAttr getRhsColumnsAttr(); + uint32_t getRhsColumns(); + void setLhsRowsAttr(::mlir::IntegerAttr attr); + void setLhsRows(uint32_t attrValue); + void setLhsColumnsAttr(::mlir::IntegerAttr attr); + void setLhsColumns(uint32_t attrValue); + void setRhsColumnsAttr(::mlir::IntegerAttr attr); + void setRhsColumns(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::IntegerAttr lhs_rows, ::mlir::IntegerAttr lhs_columns, ::mlir::IntegerAttr rhs_columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::IntegerAttr lhs_rows, ::mlir::IntegerAttr lhs_columns, ::mlir::IntegerAttr rhs_columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, uint32_t lhs_rows, uint32_t lhs_columns, uint32_t rhs_columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, uint32_t lhs_rows, uint32_t lhs_columns, uint32_t rhs_columns); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MatrixMultiplyOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MatrixTransposeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixTransposeOpGenericAdaptorBase { +public: + struct Properties { + using columnsTy = ::mlir::IntegerAttr; + columnsTy columns; + + auto getColumns() { + auto &propStorage = this->columns; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setColumns(const ::mlir::IntegerAttr &propValue) { + this->columns = propValue; + } + using rowsTy = ::mlir::IntegerAttr; + rowsTy rows; + + auto getRows() { + auto &propStorage = this->rows; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setRows(const ::mlir::IntegerAttr &propValue) { + this->rows = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.columns == this->columns && + rhs.rows == this->rows && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MatrixTransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixTransposeOpGenericAdaptorBase(MatrixTransposeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getRowsAttr(); + uint32_t getRows(); + ::mlir::IntegerAttr getColumnsAttr(); + uint32_t getColumns(); +}; +} // namespace detail +template +class MatrixTransposeOpGenericAdaptor : public detail::MatrixTransposeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixTransposeOpGenericAdaptorBase; +public: + MatrixTransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixTransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixTransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MatrixTransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMatrix() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixTransposeOpAdaptor : public MatrixTransposeOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixTransposeOpGenericAdaptor::MatrixTransposeOpGenericAdaptor; + MatrixTransposeOpAdaptor(MatrixTransposeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixTransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixTransposeOpAdaptor; + template + using GenericAdaptor = MatrixTransposeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("columns"), ::llvm::StringRef("rows")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getColumnsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getColumnsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRowsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRowsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.matrix.transpose"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getMatrix(); + ::mlir::OpOperand &getMatrixMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getRowsAttr(); + uint32_t getRows(); + ::mlir::IntegerAttr getColumnsAttr(); + uint32_t getColumns(); + void setRowsAttr(::mlir::IntegerAttr attr); + void setRows(uint32_t attrValue); + void setColumnsAttr(::mlir::IntegerAttr attr); + void setColumns(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrix, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::IntegerAttr rows, ::mlir::IntegerAttr columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrix, uint32_t rows, uint32_t columns); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, uint32_t rows, uint32_t columns); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MatrixTransposeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MaxNumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxNumOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MaxNumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxNumOpGenericAdaptorBase(MaxNumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class MaxNumOpGenericAdaptor : public detail::MaxNumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxNumOpGenericAdaptorBase; +public: + MaxNumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxNumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxNumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MaxNumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxNumOpAdaptor : public MaxNumOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxNumOpGenericAdaptor::MaxNumOpGenericAdaptor; + MaxNumOpAdaptor(MaxNumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxNumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxNumOpAdaptor; + template + using GenericAdaptor = MaxNumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.maxnum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MaxNumOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MaximumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaximumOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MaximumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MaximumOpGenericAdaptorBase(MaximumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class MaximumOpGenericAdaptor : public detail::MaximumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaximumOpGenericAdaptorBase; +public: + MaximumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaximumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaximumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MaximumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaximumOpAdaptor : public MaximumOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaximumOpGenericAdaptor::MaximumOpGenericAdaptor; + MaximumOpAdaptor(MaximumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaximumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaximumOpAdaptor; + template + using GenericAdaptor = MaximumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.maximum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MaximumOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MemcpyInlineOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MemcpyInlineOpGenericAdaptorBase { +public: + struct Properties { + using access_groupsTy = ::mlir::ArrayAttr; + access_groupsTy access_groups; + + auto getAccessGroups() { + auto &propStorage = this->access_groups; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAccessGroups(const ::mlir::ArrayAttr &propValue) { + this->access_groups = propValue; + } + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using isVolatileTy = ::mlir::IntegerAttr; + isVolatileTy isVolatile; + + auto getIsVolatile() { + auto &propStorage = this->isVolatile; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIsVolatile(const ::mlir::IntegerAttr &propValue) { + this->isVolatile = propValue; + } + using lenTy = ::mlir::IntegerAttr; + lenTy len; + + auto getLen() { + auto &propStorage = this->len; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setLen(const ::mlir::IntegerAttr &propValue) { + this->len = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.access_groups == this->access_groups && + rhs.alias_scopes == this->alias_scopes && + rhs.isVolatile == this->isVolatile && + rhs.len == this->len && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MemcpyInlineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MemcpyInlineOpGenericAdaptorBase(MemcpyInlineOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLenAttr(); + ::mlir::APInt getLen(); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class MemcpyInlineOpGenericAdaptor : public detail::MemcpyInlineOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MemcpyInlineOpGenericAdaptorBase; +public: + MemcpyInlineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MemcpyInlineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MemcpyInlineOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MemcpyInlineOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDst() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MemcpyInlineOpAdaptor : public MemcpyInlineOpGenericAdaptor<::mlir::ValueRange> { +public: + using MemcpyInlineOpGenericAdaptor::MemcpyInlineOpGenericAdaptor; + MemcpyInlineOpAdaptor(MemcpyInlineOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MemcpyInlineOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AccessGroupOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::PromotableMemOpInterface::Trait, ::mlir::DestructurableAccessorOpInterface::Trait, ::mlir::SafeMemorySlotAccessOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MemcpyInlineOpAdaptor; + template + using GenericAdaptor = MemcpyInlineOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("access_groups"), ::llvm::StringRef("alias_scopes"), ::llvm::StringRef("isVolatile"), ::llvm::StringRef("len"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAccessGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAccessGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsVolatileAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsVolatileAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLenAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.memcpy.inline"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getDst(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getSrc(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::OpOperand &getSrcMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getLenAttr(); + ::mlir::APInt getLen(); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setLenAttr(::mlir::IntegerAttr attr); + void setIsVolatileAttr(::mlir::IntegerAttr attr); + void setIsVolatile(bool attrValue); + void setAccessGroupsAttr(::mlir::ArrayAttr attr); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAccessGroupsAttr(); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, IntegerAttr len, bool isVolatile); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, IntegerAttr len, IntegerAttr isVolatile); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + bool loadsFrom(const ::mlir::MemorySlot &slot); + bool storesTo(const ::mlir::MemorySlot &slot); + ::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + bool canUsesBeRemoved(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter, ::mlir::Value reachingDefinition); + bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + ::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots, ::mlir::RewriterBase &rewriter); + ::mlir::LogicalResult ensureOnlySafeAccesses(const ::mlir::MemorySlot &slot, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemcpyInlineOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MemcpyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MemcpyOpGenericAdaptorBase { +public: + struct Properties { + using access_groupsTy = ::mlir::ArrayAttr; + access_groupsTy access_groups; + + auto getAccessGroups() { + auto &propStorage = this->access_groups; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAccessGroups(const ::mlir::ArrayAttr &propValue) { + this->access_groups = propValue; + } + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using isVolatileTy = ::mlir::IntegerAttr; + isVolatileTy isVolatile; + + auto getIsVolatile() { + auto &propStorage = this->isVolatile; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIsVolatile(const ::mlir::IntegerAttr &propValue) { + this->isVolatile = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.access_groups == this->access_groups && + rhs.alias_scopes == this->alias_scopes && + rhs.isVolatile == this->isVolatile && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MemcpyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MemcpyOpGenericAdaptorBase(MemcpyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class MemcpyOpGenericAdaptor : public detail::MemcpyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MemcpyOpGenericAdaptorBase; +public: + MemcpyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MemcpyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MemcpyOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MemcpyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDst() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getLen() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MemcpyOpAdaptor : public MemcpyOpGenericAdaptor<::mlir::ValueRange> { +public: + using MemcpyOpGenericAdaptor::MemcpyOpGenericAdaptor; + MemcpyOpAdaptor(MemcpyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MemcpyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AccessGroupOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::PromotableMemOpInterface::Trait, ::mlir::DestructurableAccessorOpInterface::Trait, ::mlir::SafeMemorySlotAccessOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MemcpyOpAdaptor; + template + using GenericAdaptor = MemcpyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("access_groups"), ::llvm::StringRef("alias_scopes"), ::llvm::StringRef("isVolatile"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAccessGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAccessGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsVolatileAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsVolatileAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.memcpy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getDst(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getSrc(); + ::mlir::TypedValue<::mlir::IntegerType> getLen(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getLenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setIsVolatileAttr(::mlir::IntegerAttr attr); + void setIsVolatile(bool attrValue); + void setAccessGroupsAttr(::mlir::ArrayAttr attr); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAccessGroupsAttr(); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, Value len, bool isVolatile); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, Value len, IntegerAttr isVolatile); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + bool loadsFrom(const ::mlir::MemorySlot &slot); + bool storesTo(const ::mlir::MemorySlot &slot); + ::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + bool canUsesBeRemoved(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter, ::mlir::Value reachingDefinition); + bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + ::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots, ::mlir::RewriterBase &rewriter); + ::mlir::LogicalResult ensureOnlySafeAccesses(const ::mlir::MemorySlot &slot, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemcpyOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MemmoveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MemmoveOpGenericAdaptorBase { +public: + struct Properties { + using access_groupsTy = ::mlir::ArrayAttr; + access_groupsTy access_groups; + + auto getAccessGroups() { + auto &propStorage = this->access_groups; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAccessGroups(const ::mlir::ArrayAttr &propValue) { + this->access_groups = propValue; + } + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using isVolatileTy = ::mlir::IntegerAttr; + isVolatileTy isVolatile; + + auto getIsVolatile() { + auto &propStorage = this->isVolatile; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIsVolatile(const ::mlir::IntegerAttr &propValue) { + this->isVolatile = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.access_groups == this->access_groups && + rhs.alias_scopes == this->alias_scopes && + rhs.isVolatile == this->isVolatile && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MemmoveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MemmoveOpGenericAdaptorBase(MemmoveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class MemmoveOpGenericAdaptor : public detail::MemmoveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MemmoveOpGenericAdaptorBase; +public: + MemmoveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MemmoveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MemmoveOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MemmoveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDst() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getLen() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MemmoveOpAdaptor : public MemmoveOpGenericAdaptor<::mlir::ValueRange> { +public: + using MemmoveOpGenericAdaptor::MemmoveOpGenericAdaptor; + MemmoveOpAdaptor(MemmoveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MemmoveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AccessGroupOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::PromotableMemOpInterface::Trait, ::mlir::DestructurableAccessorOpInterface::Trait, ::mlir::SafeMemorySlotAccessOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MemmoveOpAdaptor; + template + using GenericAdaptor = MemmoveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("access_groups"), ::llvm::StringRef("alias_scopes"), ::llvm::StringRef("isVolatile"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAccessGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAccessGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsVolatileAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsVolatileAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.memmove"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getDst(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getSrc(); + ::mlir::TypedValue<::mlir::IntegerType> getLen(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getLenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setIsVolatileAttr(::mlir::IntegerAttr attr); + void setIsVolatile(bool attrValue); + void setAccessGroupsAttr(::mlir::ArrayAttr attr); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAccessGroupsAttr(); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, Value len, bool isVolatile); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value src, Value len, IntegerAttr isVolatile); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + bool loadsFrom(const ::mlir::MemorySlot &slot); + bool storesTo(const ::mlir::MemorySlot &slot); + ::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + bool canUsesBeRemoved(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter, ::mlir::Value reachingDefinition); + bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + ::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots, ::mlir::RewriterBase &rewriter); + ::mlir::LogicalResult ensureOnlySafeAccesses(const ::mlir::MemorySlot &slot, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemmoveOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MemsetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MemsetOpGenericAdaptorBase { +public: + struct Properties { + using access_groupsTy = ::mlir::ArrayAttr; + access_groupsTy access_groups; + + auto getAccessGroups() { + auto &propStorage = this->access_groups; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAccessGroups(const ::mlir::ArrayAttr &propValue) { + this->access_groups = propValue; + } + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using isVolatileTy = ::mlir::IntegerAttr; + isVolatileTy isVolatile; + + auto getIsVolatile() { + auto &propStorage = this->isVolatile; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIsVolatile(const ::mlir::IntegerAttr &propValue) { + this->isVolatile = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.access_groups == this->access_groups && + rhs.alias_scopes == this->alias_scopes && + rhs.isVolatile == this->isVolatile && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MemsetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MemsetOpGenericAdaptorBase(MemsetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class MemsetOpGenericAdaptor : public detail::MemsetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MemsetOpGenericAdaptorBase; +public: + MemsetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MemsetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MemsetOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MemsetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDst() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getLen() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MemsetOpAdaptor : public MemsetOpGenericAdaptor<::mlir::ValueRange> { +public: + using MemsetOpGenericAdaptor::MemsetOpGenericAdaptor; + MemsetOpAdaptor(MemsetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MemsetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AccessGroupOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::PromotableMemOpInterface::Trait, ::mlir::DestructurableAccessorOpInterface::Trait, ::mlir::SafeMemorySlotAccessOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MemsetOpAdaptor; + template + using GenericAdaptor = MemsetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("access_groups"), ::llvm::StringRef("alias_scopes"), ::llvm::StringRef("isVolatile"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAccessGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAccessGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsVolatileAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsVolatileAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.memset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getDst(); + ::mlir::TypedValue<::mlir::IntegerType> getVal(); + ::mlir::TypedValue<::mlir::IntegerType> getLen(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getLenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIsVolatileAttr(); + bool getIsVolatile(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setIsVolatileAttr(::mlir::IntegerAttr attr); + void setIsVolatile(bool attrValue); + void setAccessGroupsAttr(::mlir::ArrayAttr attr); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAccessGroupsAttr(); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value val, Value len, bool isVolatile); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dst, Value val, Value len, IntegerAttr isVolatile); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value len, ::mlir::IntegerAttr isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value len, bool isVolatile, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + bool loadsFrom(const ::mlir::MemorySlot &slot); + bool storesTo(const ::mlir::MemorySlot &slot); + ::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + bool canUsesBeRemoved(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter, ::mlir::Value reachingDefinition); + bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + ::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots, ::mlir::RewriterBase &rewriter); + ::mlir::LogicalResult ensureOnlySafeAccesses(const ::mlir::MemorySlot &slot, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemsetOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MinNumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinNumOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MinNumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MinNumOpGenericAdaptorBase(MinNumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class MinNumOpGenericAdaptor : public detail::MinNumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinNumOpGenericAdaptorBase; +public: + MinNumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinNumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinNumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MinNumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinNumOpAdaptor : public MinNumOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinNumOpGenericAdaptor::MinNumOpGenericAdaptor; + MinNumOpAdaptor(MinNumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinNumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinNumOpAdaptor; + template + using GenericAdaptor = MinNumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.minnum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MinNumOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MinimumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinimumOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MinimumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MinimumOpGenericAdaptorBase(MinimumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class MinimumOpGenericAdaptor : public detail::MinimumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinimumOpGenericAdaptorBase; +public: + MinimumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinimumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinimumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MinimumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinimumOpAdaptor : public MinimumOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinimumOpGenericAdaptor::MinimumOpGenericAdaptor; + MinimumOpAdaptor(MinimumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinimumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinimumOpAdaptor; + template + using GenericAdaptor = MinimumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.minimum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MinimumOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::NearbyintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NearbyintOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + NearbyintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + NearbyintOpGenericAdaptorBase(NearbyintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class NearbyintOpGenericAdaptor : public detail::NearbyintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NearbyintOpGenericAdaptorBase; +public: + NearbyintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NearbyintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NearbyintOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + NearbyintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NearbyintOpAdaptor : public NearbyintOpGenericAdaptor<::mlir::ValueRange> { +public: + using NearbyintOpGenericAdaptor::NearbyintOpGenericAdaptor; + NearbyintOpAdaptor(NearbyintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NearbyintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NearbyintOpAdaptor; + template + using GenericAdaptor = NearbyintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.nearbyint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::NearbyintOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::NoAliasScopeDeclOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NoAliasScopeDeclOpGenericAdaptorBase { +public: + struct Properties { + using scopeTy = ::mlir::LLVM::AliasScopeAttr; + scopeTy scope; + + auto getScope() { + auto &propStorage = this->scope; + return ::llvm::cast<::mlir::LLVM::AliasScopeAttr>(propStorage); + } + void setScope(const ::mlir::LLVM::AliasScopeAttr &propValue) { + this->scope = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.scope == this->scope && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + NoAliasScopeDeclOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + NoAliasScopeDeclOpGenericAdaptorBase(NoAliasScopeDeclOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::AliasScopeAttr getScopeAttr(); + ::mlir::LLVM::AliasScopeAttr getScope(); +}; +} // namespace detail +template +class NoAliasScopeDeclOpGenericAdaptor : public detail::NoAliasScopeDeclOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NoAliasScopeDeclOpGenericAdaptorBase; +public: + NoAliasScopeDeclOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NoAliasScopeDeclOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NoAliasScopeDeclOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + NoAliasScopeDeclOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NoAliasScopeDeclOpAdaptor : public NoAliasScopeDeclOpGenericAdaptor<::mlir::ValueRange> { +public: + using NoAliasScopeDeclOpGenericAdaptor::NoAliasScopeDeclOpGenericAdaptor; + NoAliasScopeDeclOpAdaptor(NoAliasScopeDeclOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NoAliasScopeDeclOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = NoAliasScopeDeclOpAdaptor; + template + using GenericAdaptor = NoAliasScopeDeclOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("scope")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getScopeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getScopeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.experimental.noalias.scope.decl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::AliasScopeAttr getScopeAttr(); + ::mlir::LLVM::AliasScopeAttr getScope(); + void setScopeAttr(::mlir::LLVM::AliasScopeAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AliasScopeAttr scope); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AliasScopeAttr scope); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::NoAliasScopeDeclOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PowIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PowIOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PowIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PowIOpGenericAdaptorBase(PowIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class PowIOpGenericAdaptor : public detail::PowIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PowIOpGenericAdaptorBase; +public: + PowIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PowIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PowIOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PowIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + ValueT getPower() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PowIOpAdaptor : public PowIOpGenericAdaptor<::mlir::ValueRange> { +public: + using PowIOpGenericAdaptor::PowIOpGenericAdaptor; + PowIOpAdaptor(PowIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PowIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PowIOpAdaptor; + template + using GenericAdaptor = PowIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.powi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::TypedValue<::mlir::IntegerType> getPower(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getPowerMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value power, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value power, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::Value power, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value power, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::PowIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PowOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PowOpGenericAdaptorBase(PowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class PowOpGenericAdaptor : public detail::PowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PowOpGenericAdaptorBase; +public: + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PowOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PowOpAdaptor : public PowOpGenericAdaptor<::mlir::ValueRange> { +public: + using PowOpGenericAdaptor::PowOpGenericAdaptor; + PowOpAdaptor(PowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PowOpAdaptor; + template + using GenericAdaptor = PowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.pow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::PowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Prefetch declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrefetchGenericAdaptorBase { +public: + struct Properties { + using cacheTy = ::mlir::IntegerAttr; + cacheTy cache; + + auto getCache() { + auto &propStorage = this->cache; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setCache(const ::mlir::IntegerAttr &propValue) { + this->cache = propValue; + } + using hintTy = ::mlir::IntegerAttr; + hintTy hint; + + auto getHint() { + auto &propStorage = this->hint; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setHint(const ::mlir::IntegerAttr &propValue) { + this->hint = propValue; + } + using rwTy = ::mlir::IntegerAttr; + rwTy rw; + + auto getRw() { + auto &propStorage = this->rw; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setRw(const ::mlir::IntegerAttr &propValue) { + this->rw = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.cache == this->cache && + rhs.hint == this->hint && + rhs.rw == this->rw && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PrefetchGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PrefetchGenericAdaptorBase(Prefetch op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getRwAttr(); + uint32_t getRw(); + ::mlir::IntegerAttr getHintAttr(); + uint32_t getHint(); + ::mlir::IntegerAttr getCacheAttr(); + uint32_t getCache(); +}; +} // namespace detail +template +class PrefetchGenericAdaptor : public detail::PrefetchGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrefetchGenericAdaptorBase; +public: + PrefetchGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrefetchGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrefetchGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PrefetchGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrefetchAdaptor : public PrefetchGenericAdaptor<::mlir::ValueRange> { +public: + using PrefetchGenericAdaptor::PrefetchGenericAdaptor; + PrefetchAdaptor(Prefetch op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Prefetch : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = PrefetchAdaptor; + template + using GenericAdaptor = PrefetchGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cache"), ::llvm::StringRef("hint"), ::llvm::StringRef("rw")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCacheAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCacheAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getHintAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRwAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRwAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.prefetch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getAddr(); + ::mlir::OpOperand &getAddrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getRwAttr(); + uint32_t getRw(); + ::mlir::IntegerAttr getHintAttr(); + uint32_t getHint(); + ::mlir::IntegerAttr getCacheAttr(); + uint32_t getCache(); + void setRwAttr(::mlir::IntegerAttr attr); + void setRw(uint32_t attrValue); + void setHintAttr(::mlir::IntegerAttr attr); + void setHint(uint32_t attrValue); + void setCacheAttr(::mlir::IntegerAttr attr); + void setCache(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::IntegerAttr rw, ::mlir::IntegerAttr hint, ::mlir::IntegerAttr cache); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::IntegerAttr rw, ::mlir::IntegerAttr hint, ::mlir::IntegerAttr cache); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, uint32_t rw, uint32_t hint, uint32_t cache); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, uint32_t rw, uint32_t hint, uint32_t cache); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::Prefetch) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PtrAnnotation declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PtrAnnotationGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PtrAnnotationGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PtrAnnotationGenericAdaptorBase(PtrAnnotation op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PtrAnnotationGenericAdaptor : public detail::PtrAnnotationGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PtrAnnotationGenericAdaptorBase; +public: + PtrAnnotationGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PtrAnnotationGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PtrAnnotationGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PtrAnnotationGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getAnnotation() { + return (*getODSOperands(1).begin()); + } + + ValueT getFileName() { + return (*getODSOperands(2).begin()); + } + + ValueT getLine() { + return (*getODSOperands(3).begin()); + } + + ValueT getAttr() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PtrAnnotationAdaptor : public PtrAnnotationGenericAdaptor<::mlir::ValueRange> { +public: + using PtrAnnotationGenericAdaptor::PtrAnnotationGenericAdaptor; + PtrAnnotationAdaptor(PtrAnnotation op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PtrAnnotation : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PtrAnnotationAdaptor; + template + using GenericAdaptor = PtrAnnotationGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.ptr.annotation"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getAnnotation(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getFileName(); + ::mlir::TypedValue<::mlir::IntegerType> getLine(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getAttr(); + ::mlir::OpOperand &getPtrMutable(); + ::mlir::OpOperand &getAnnotationMutable(); + ::mlir::OpOperand &getFileNameMutable(); + ::mlir::OpOperand &getLineMutable(); + ::mlir::OpOperand &getAttrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::PtrAnnotation) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::RintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RintOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RintOpGenericAdaptorBase(RintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class RintOpGenericAdaptor : public detail::RintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RintOpGenericAdaptorBase; +public: + RintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RintOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RintOpAdaptor : public RintOpGenericAdaptor<::mlir::ValueRange> { +public: + using RintOpGenericAdaptor::RintOpGenericAdaptor; + RintOpAdaptor(RintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RintOpAdaptor; + template + using GenericAdaptor = RintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.rint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::RintOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::RoundEvenOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundEvenOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RoundEvenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundEvenOpGenericAdaptorBase(RoundEvenOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class RoundEvenOpGenericAdaptor : public detail::RoundEvenOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundEvenOpGenericAdaptorBase; +public: + RoundEvenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundEvenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundEvenOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RoundEvenOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundEvenOpAdaptor : public RoundEvenOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundEvenOpGenericAdaptor::RoundEvenOpGenericAdaptor; + RoundEvenOpAdaptor(RoundEvenOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundEvenOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundEvenOpAdaptor; + template + using GenericAdaptor = RoundEvenOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.roundeven"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::RoundEvenOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::RoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundOpGenericAdaptorBase(RoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class RoundOpGenericAdaptor : public detail::RoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundOpGenericAdaptorBase; +public: + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundOpAdaptor : public RoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundOpGenericAdaptor::RoundOpGenericAdaptor; + RoundOpAdaptor(RoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundOpAdaptor; + template + using GenericAdaptor = RoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.round"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::RoundOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SAddSat declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SAddSatGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SAddSatGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SAddSatGenericAdaptorBase(SAddSat op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SAddSatGenericAdaptor : public detail::SAddSatGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SAddSatGenericAdaptorBase; +public: + SAddSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SAddSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SAddSatGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SAddSatGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SAddSatAdaptor : public SAddSatGenericAdaptor<::mlir::ValueRange> { +public: + using SAddSatGenericAdaptor::SAddSatGenericAdaptor; + SAddSatAdaptor(SAddSat op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SAddSat : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SAddSatAdaptor; + template + using GenericAdaptor = SAddSatGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.sadd.sat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SAddSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SAddWithOverflowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SAddWithOverflowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SAddWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SAddWithOverflowOpGenericAdaptorBase(SAddWithOverflowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SAddWithOverflowOpGenericAdaptor : public detail::SAddWithOverflowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SAddWithOverflowOpGenericAdaptorBase; +public: + SAddWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SAddWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SAddWithOverflowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SAddWithOverflowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SAddWithOverflowOpAdaptor : public SAddWithOverflowOpGenericAdaptor<::mlir::ValueRange> { +public: + using SAddWithOverflowOpGenericAdaptor::SAddWithOverflowOpGenericAdaptor; + SAddWithOverflowOpAdaptor(SAddWithOverflowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SAddWithOverflowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = SAddWithOverflowOpAdaptor; + template + using GenericAdaptor = SAddWithOverflowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.sadd.with.overflow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SAddWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SMaxOpGenericAdaptorBase(SMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SMaxOpGenericAdaptor : public detail::SMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SMaxOpGenericAdaptorBase; +public: + SMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SMaxOpAdaptor : public SMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using SMaxOpGenericAdaptor::SMaxOpGenericAdaptor; + SMaxOpAdaptor(SMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SMaxOpAdaptor; + template + using GenericAdaptor = SMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.smax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SMinOpGenericAdaptorBase(SMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SMinOpGenericAdaptor : public detail::SMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SMinOpGenericAdaptorBase; +public: + SMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SMinOpAdaptor : public SMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using SMinOpGenericAdaptor::SMinOpGenericAdaptor; + SMinOpAdaptor(SMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SMinOpAdaptor; + template + using GenericAdaptor = SMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.smin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SMulWithOverflowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SMulWithOverflowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SMulWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SMulWithOverflowOpGenericAdaptorBase(SMulWithOverflowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SMulWithOverflowOpGenericAdaptor : public detail::SMulWithOverflowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SMulWithOverflowOpGenericAdaptorBase; +public: + SMulWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SMulWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SMulWithOverflowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SMulWithOverflowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SMulWithOverflowOpAdaptor : public SMulWithOverflowOpGenericAdaptor<::mlir::ValueRange> { +public: + using SMulWithOverflowOpGenericAdaptor::SMulWithOverflowOpGenericAdaptor; + SMulWithOverflowOpAdaptor(SMulWithOverflowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SMulWithOverflowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = SMulWithOverflowOpAdaptor; + template + using GenericAdaptor = SMulWithOverflowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.smul.with.overflow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SMulWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SSACopyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SSACopyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SSACopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SSACopyOpGenericAdaptorBase(SSACopyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SSACopyOpGenericAdaptor : public detail::SSACopyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SSACopyOpGenericAdaptorBase; +public: + SSACopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SSACopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SSACopyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SSACopyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SSACopyOpAdaptor : public SSACopyOpGenericAdaptor<::mlir::ValueRange> { +public: + using SSACopyOpGenericAdaptor::SSACopyOpGenericAdaptor; + SSACopyOpAdaptor(SSACopyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SSACopyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SSACopyOpAdaptor; + template + using GenericAdaptor = SSACopyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.ssa.copy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SSACopyOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SSHLSat declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SSHLSatGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SSHLSatGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SSHLSatGenericAdaptorBase(SSHLSat op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SSHLSatGenericAdaptor : public detail::SSHLSatGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SSHLSatGenericAdaptorBase; +public: + SSHLSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SSHLSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SSHLSatGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SSHLSatGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SSHLSatAdaptor : public SSHLSatGenericAdaptor<::mlir::ValueRange> { +public: + using SSHLSatGenericAdaptor::SSHLSatGenericAdaptor; + SSHLSatAdaptor(SSHLSat op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SSHLSat : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SSHLSatAdaptor; + template + using GenericAdaptor = SSHLSatGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.sshl.sat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SSHLSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SSubSat declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SSubSatGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SSubSatGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SSubSatGenericAdaptorBase(SSubSat op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SSubSatGenericAdaptor : public detail::SSubSatGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SSubSatGenericAdaptorBase; +public: + SSubSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SSubSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SSubSatGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SSubSatGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SSubSatAdaptor : public SSubSatGenericAdaptor<::mlir::ValueRange> { +public: + using SSubSatGenericAdaptor::SSubSatGenericAdaptor; + SSubSatAdaptor(SSubSat op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SSubSat : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SSubSatAdaptor; + template + using GenericAdaptor = SSubSatGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.ssub.sat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SSubSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SSubWithOverflowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SSubWithOverflowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SSubWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SSubWithOverflowOpGenericAdaptorBase(SSubWithOverflowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SSubWithOverflowOpGenericAdaptor : public detail::SSubWithOverflowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SSubWithOverflowOpGenericAdaptorBase; +public: + SSubWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SSubWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SSubWithOverflowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SSubWithOverflowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SSubWithOverflowOpAdaptor : public SSubWithOverflowOpGenericAdaptor<::mlir::ValueRange> { +public: + using SSubWithOverflowOpGenericAdaptor::SSubWithOverflowOpGenericAdaptor; + SSubWithOverflowOpAdaptor(SSubWithOverflowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SSubWithOverflowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = SSubWithOverflowOpAdaptor; + template + using GenericAdaptor = SSubWithOverflowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.ssub.with.overflow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SSubWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SinOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SinOpGenericAdaptorBase(SinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class SinOpGenericAdaptor : public detail::SinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SinOpGenericAdaptorBase; +public: + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SinOpAdaptor : public SinOpGenericAdaptor<::mlir::ValueRange> { +public: + using SinOpGenericAdaptor::SinOpGenericAdaptor; + SinOpAdaptor(SinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SinOpAdaptor; + template + using GenericAdaptor = SinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.sin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqrtOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SqrtOpGenericAdaptorBase(SqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class SqrtOpGenericAdaptor : public detail::SqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqrtOpGenericAdaptorBase; +public: + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqrtOpAdaptor : public SqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqrtOpGenericAdaptor::SqrtOpGenericAdaptor; + SqrtOpAdaptor(SqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqrtOpAdaptor; + template + using GenericAdaptor = SqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.sqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SqrtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::StackRestoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackRestoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackRestoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackRestoreOpGenericAdaptorBase(StackRestoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StackRestoreOpGenericAdaptor : public detail::StackRestoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackRestoreOpGenericAdaptorBase; +public: + StackRestoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackRestoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackRestoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackRestoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackRestoreOpAdaptor : public StackRestoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using StackRestoreOpGenericAdaptor::StackRestoreOpGenericAdaptor; + StackRestoreOpAdaptor(StackRestoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackRestoreOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = StackRestoreOpAdaptor; + template + using GenericAdaptor = StackRestoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.stackrestore"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::OpOperand &getPtrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::StackRestoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::StackSaveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackSaveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackSaveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackSaveOpGenericAdaptorBase(StackSaveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StackSaveOpGenericAdaptor : public detail::StackSaveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackSaveOpGenericAdaptorBase; +public: + StackSaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackSaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackSaveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackSaveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackSaveOpAdaptor : public StackSaveOpGenericAdaptor<::mlir::ValueRange> { +public: + using StackSaveOpGenericAdaptor::StackSaveOpGenericAdaptor; + StackSaveOpAdaptor(StackSaveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackSaveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = StackSaveOpAdaptor; + template + using GenericAdaptor = StackSaveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.stacksave"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::StackSaveOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::StepVectorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StepVectorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StepVectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StepVectorOpGenericAdaptorBase(StepVectorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StepVectorOpGenericAdaptor : public detail::StepVectorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StepVectorOpGenericAdaptorBase; +public: + StepVectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StepVectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StepVectorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StepVectorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StepVectorOpAdaptor : public StepVectorOpGenericAdaptor<::mlir::ValueRange> { +public: + using StepVectorOpGenericAdaptor::StepVectorOpGenericAdaptor; + StepVectorOpAdaptor(StepVectorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StepVectorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StepVectorOpAdaptor; + template + using GenericAdaptor = StepVectorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.experimental.stepvector"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::StepVectorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ThreadlocalAddressOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ThreadlocalAddressOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ThreadlocalAddressOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ThreadlocalAddressOpGenericAdaptorBase(ThreadlocalAddressOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ThreadlocalAddressOpGenericAdaptor : public detail::ThreadlocalAddressOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ThreadlocalAddressOpGenericAdaptorBase; +public: + ThreadlocalAddressOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ThreadlocalAddressOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ThreadlocalAddressOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ThreadlocalAddressOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGlobal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ThreadlocalAddressOpAdaptor : public ThreadlocalAddressOpGenericAdaptor<::mlir::ValueRange> { +public: + using ThreadlocalAddressOpGenericAdaptor::ThreadlocalAddressOpGenericAdaptor; + ThreadlocalAddressOpAdaptor(ThreadlocalAddressOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ThreadlocalAddressOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ThreadlocalAddressOpAdaptor; + template + using GenericAdaptor = ThreadlocalAddressOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.threadlocal.address"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getGlobal(); + ::mlir::OpOperand &getGlobalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value global); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value global); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ThreadlocalAddressOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::Trap declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TrapGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TrapGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TrapGenericAdaptorBase(Trap op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TrapGenericAdaptor : public detail::TrapGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TrapGenericAdaptorBase; +public: + TrapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TrapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TrapGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TrapGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TrapAdaptor : public TrapGenericAdaptor<::mlir::ValueRange> { +public: + using TrapGenericAdaptor::TrapGenericAdaptor; + TrapAdaptor(Trap op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Trap : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TrapAdaptor; + template + using GenericAdaptor = TrapGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.trap"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::Trap) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UAddSat declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UAddSatGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UAddSatGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UAddSatGenericAdaptorBase(UAddSat op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UAddSatGenericAdaptor : public detail::UAddSatGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UAddSatGenericAdaptorBase; +public: + UAddSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UAddSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UAddSatGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UAddSatGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UAddSatAdaptor : public UAddSatGenericAdaptor<::mlir::ValueRange> { +public: + using UAddSatGenericAdaptor::UAddSatGenericAdaptor; + UAddSatAdaptor(UAddSat op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UAddSat : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UAddSatAdaptor; + template + using GenericAdaptor = UAddSatGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.uadd.sat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UAddSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UAddWithOverflowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UAddWithOverflowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UAddWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UAddWithOverflowOpGenericAdaptorBase(UAddWithOverflowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UAddWithOverflowOpGenericAdaptor : public detail::UAddWithOverflowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UAddWithOverflowOpGenericAdaptorBase; +public: + UAddWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UAddWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UAddWithOverflowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UAddWithOverflowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UAddWithOverflowOpAdaptor : public UAddWithOverflowOpGenericAdaptor<::mlir::ValueRange> { +public: + using UAddWithOverflowOpGenericAdaptor::UAddWithOverflowOpGenericAdaptor; + UAddWithOverflowOpAdaptor(UAddWithOverflowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UAddWithOverflowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = UAddWithOverflowOpAdaptor; + template + using GenericAdaptor = UAddWithOverflowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.uadd.with.overflow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UAddWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UBSanTrap declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UBSanTrapGenericAdaptorBase { +public: + struct Properties { + using failureKindTy = ::mlir::IntegerAttr; + failureKindTy failureKind; + + auto getFailureKind() { + auto &propStorage = this->failureKind; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setFailureKind(const ::mlir::IntegerAttr &propValue) { + this->failureKind = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.failureKind == this->failureKind && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + UBSanTrapGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + UBSanTrapGenericAdaptorBase(UBSanTrap op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFailureKindAttr(); + uint8_t getFailureKind(); +}; +} // namespace detail +template +class UBSanTrapGenericAdaptor : public detail::UBSanTrapGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UBSanTrapGenericAdaptorBase; +public: + UBSanTrapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UBSanTrapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UBSanTrapGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + UBSanTrapGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UBSanTrapAdaptor : public UBSanTrapGenericAdaptor<::mlir::ValueRange> { +public: + using UBSanTrapGenericAdaptor::UBSanTrapGenericAdaptor; + UBSanTrapAdaptor(UBSanTrap op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UBSanTrap : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = UBSanTrapAdaptor; + template + using GenericAdaptor = UBSanTrapGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("failureKind")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFailureKindAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFailureKindAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.ubsantrap"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getFailureKindAttr(); + uint8_t getFailureKind(); + void setFailureKindAttr(::mlir::IntegerAttr attr); + void setFailureKind(uint8_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr failureKind); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr failureKind); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint8_t failureKind); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint8_t failureKind); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UBSanTrap) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UMaxOpGenericAdaptorBase(UMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UMaxOpGenericAdaptor : public detail::UMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UMaxOpGenericAdaptorBase; +public: + UMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UMaxOpAdaptor : public UMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using UMaxOpGenericAdaptor::UMaxOpGenericAdaptor; + UMaxOpAdaptor(UMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UMaxOpAdaptor; + template + using GenericAdaptor = UMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.umax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UMinOpGenericAdaptorBase(UMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UMinOpGenericAdaptor : public detail::UMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UMinOpGenericAdaptorBase; +public: + UMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UMinOpAdaptor : public UMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using UMinOpGenericAdaptor::UMinOpGenericAdaptor; + UMinOpAdaptor(UMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UMinOpAdaptor; + template + using GenericAdaptor = UMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.umin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UMulWithOverflowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UMulWithOverflowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UMulWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UMulWithOverflowOpGenericAdaptorBase(UMulWithOverflowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UMulWithOverflowOpGenericAdaptor : public detail::UMulWithOverflowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UMulWithOverflowOpGenericAdaptorBase; +public: + UMulWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UMulWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UMulWithOverflowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UMulWithOverflowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UMulWithOverflowOpAdaptor : public UMulWithOverflowOpGenericAdaptor<::mlir::ValueRange> { +public: + using UMulWithOverflowOpGenericAdaptor::UMulWithOverflowOpGenericAdaptor; + UMulWithOverflowOpAdaptor(UMulWithOverflowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UMulWithOverflowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = UMulWithOverflowOpAdaptor; + template + using GenericAdaptor = UMulWithOverflowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.umul.with.overflow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UMulWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::USHLSat declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class USHLSatGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + USHLSatGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + USHLSatGenericAdaptorBase(USHLSat op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class USHLSatGenericAdaptor : public detail::USHLSatGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::USHLSatGenericAdaptorBase; +public: + USHLSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + USHLSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : USHLSatGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + USHLSatGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class USHLSatAdaptor : public USHLSatGenericAdaptor<::mlir::ValueRange> { +public: + using USHLSatGenericAdaptor::USHLSatGenericAdaptor; + USHLSatAdaptor(USHLSat op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class USHLSat : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = USHLSatAdaptor; + template + using GenericAdaptor = USHLSatGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.ushl.sat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::USHLSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::USubSat declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class USubSatGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + USubSatGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + USubSatGenericAdaptorBase(USubSat op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class USubSatGenericAdaptor : public detail::USubSatGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::USubSatGenericAdaptorBase; +public: + USubSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + USubSatGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : USubSatGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + USubSatGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class USubSatAdaptor : public USubSatGenericAdaptor<::mlir::ValueRange> { +public: + using USubSatGenericAdaptor::USubSatGenericAdaptor; + USubSatAdaptor(USubSat op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class USubSat : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = USubSatAdaptor; + template + using GenericAdaptor = USubSatGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.usub.sat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::USubSat) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::USubWithOverflowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class USubWithOverflowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + USubWithOverflowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + USubWithOverflowOpGenericAdaptorBase(USubWithOverflowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class USubWithOverflowOpGenericAdaptor : public detail::USubWithOverflowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::USubWithOverflowOpGenericAdaptorBase; +public: + USubWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + USubWithOverflowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : USubWithOverflowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + USubWithOverflowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class USubWithOverflowOpAdaptor : public USubWithOverflowOpGenericAdaptor<::mlir::ValueRange> { +public: + using USubWithOverflowOpGenericAdaptor::USubWithOverflowOpGenericAdaptor; + USubWithOverflowOpAdaptor(USubWithOverflowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class USubWithOverflowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = USubWithOverflowOpAdaptor; + template + using GenericAdaptor = USubWithOverflowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.usub.with.overflow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::USubWithOverflowOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPAShrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPAShrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPAShrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPAShrOpGenericAdaptorBase(VPAShrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPAShrOpGenericAdaptor : public detail::VPAShrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPAShrOpGenericAdaptorBase; +public: + VPAShrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPAShrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPAShrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPAShrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPAShrOpAdaptor : public VPAShrOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPAShrOpGenericAdaptor::VPAShrOpGenericAdaptor; + VPAShrOpAdaptor(VPAShrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPAShrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPAShrOpAdaptor; + template + using GenericAdaptor = VPAShrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.ashr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPAShrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPAddOpGenericAdaptorBase(VPAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPAddOpGenericAdaptor : public detail::VPAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPAddOpGenericAdaptorBase; +public: + VPAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPAddOpAdaptor : public VPAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPAddOpGenericAdaptor::VPAddOpGenericAdaptor; + VPAddOpAdaptor(VPAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPAddOpAdaptor; + template + using GenericAdaptor = VPAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPAndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPAndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPAndOpGenericAdaptorBase(VPAndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPAndOpGenericAdaptor : public detail::VPAndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPAndOpGenericAdaptorBase; +public: + VPAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPAndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPAndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPAndOpAdaptor : public VPAndOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPAndOpGenericAdaptor::VPAndOpGenericAdaptor; + VPAndOpAdaptor(VPAndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPAndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPAndOpAdaptor; + template + using GenericAdaptor = VPAndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.and"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPAndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFAddOpGenericAdaptorBase(VPFAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFAddOpGenericAdaptor : public detail::VPFAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFAddOpGenericAdaptorBase; +public: + VPFAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFAddOpAdaptor : public VPFAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFAddOpGenericAdaptor::VPFAddOpGenericAdaptor; + VPFAddOpAdaptor(VPFAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFAddOpAdaptor; + template + using GenericAdaptor = VPFAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fadd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFDivOpGenericAdaptorBase(VPFDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFDivOpGenericAdaptor : public detail::VPFDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFDivOpGenericAdaptorBase; +public: + VPFDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFDivOpAdaptor : public VPFDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFDivOpGenericAdaptor::VPFDivOpGenericAdaptor; + VPFDivOpAdaptor(VPFDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFDivOpAdaptor; + template + using GenericAdaptor = VPFDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fdiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFMulAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFMulAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFMulAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFMulAddOpGenericAdaptorBase(VPFMulAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFMulAddOpGenericAdaptor : public detail::VPFMulAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFMulAddOpGenericAdaptorBase; +public: + VPFMulAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFMulAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFMulAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFMulAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOp1() { + return (*getODSOperands(0).begin()); + } + + ValueT getOp2() { + return (*getODSOperands(1).begin()); + } + + ValueT getOp3() { + return (*getODSOperands(2).begin()); + } + + ValueT getMask() { + return (*getODSOperands(3).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFMulAddOpAdaptor : public VPFMulAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFMulAddOpGenericAdaptor::VPFMulAddOpGenericAdaptor; + VPFMulAddOpAdaptor(VPFMulAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFMulAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFMulAddOpAdaptor; + template + using GenericAdaptor = VPFMulAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fmuladd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOp1(); + ::mlir::Value getOp2(); + ::mlir::Value getOp3(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getOp1Mutable(); + ::mlir::OpOperand &getOp2Mutable(); + ::mlir::OpOperand &getOp3Mutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value op1, ::mlir::Value op2, ::mlir::Value op3, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value op1, ::mlir::Value op2, ::mlir::Value op3, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFMulAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFMulOpGenericAdaptorBase(VPFMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFMulOpGenericAdaptor : public detail::VPFMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFMulOpGenericAdaptorBase; +public: + VPFMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFMulOpAdaptor : public VPFMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFMulOpGenericAdaptor::VPFMulOpGenericAdaptor; + VPFMulOpAdaptor(VPFMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFMulOpAdaptor; + template + using GenericAdaptor = VPFMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFNegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFNegOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFNegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFNegOpGenericAdaptorBase(VPFNegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFNegOpGenericAdaptor : public detail::VPFNegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFNegOpGenericAdaptorBase; +public: + VPFNegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFNegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFNegOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFNegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOp() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFNegOpAdaptor : public VPFNegOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFNegOpGenericAdaptor::VPFNegOpGenericAdaptor; + VPFNegOpAdaptor(VPFNegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFNegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFNegOpAdaptor; + template + using GenericAdaptor = VPFNegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fneg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOp(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getOpMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value op, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value op, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFNegOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFPExtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFPExtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFPExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFPExtOpGenericAdaptorBase(VPFPExtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFPExtOpGenericAdaptor : public detail::VPFPExtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFPExtOpGenericAdaptorBase; +public: + VPFPExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFPExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFPExtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFPExtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFPExtOpAdaptor : public VPFPExtOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFPExtOpGenericAdaptor::VPFPExtOpGenericAdaptor; + VPFPExtOpAdaptor(VPFPExtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFPExtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFPExtOpAdaptor; + template + using GenericAdaptor = VPFPExtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fpext"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFPExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFPToSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFPToSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFPToSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFPToSIOpGenericAdaptorBase(VPFPToSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFPToSIOpGenericAdaptor : public detail::VPFPToSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFPToSIOpGenericAdaptorBase; +public: + VPFPToSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFPToSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFPToSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFPToSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFPToSIOpAdaptor : public VPFPToSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFPToSIOpGenericAdaptor::VPFPToSIOpGenericAdaptor; + VPFPToSIOpAdaptor(VPFPToSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFPToSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFPToSIOpAdaptor; + template + using GenericAdaptor = VPFPToSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fptosi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFPToSIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFPToUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFPToUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFPToUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFPToUIOpGenericAdaptorBase(VPFPToUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFPToUIOpGenericAdaptor : public detail::VPFPToUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFPToUIOpGenericAdaptorBase; +public: + VPFPToUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFPToUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFPToUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFPToUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFPToUIOpAdaptor : public VPFPToUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFPToUIOpGenericAdaptor::VPFPToUIOpGenericAdaptor; + VPFPToUIOpAdaptor(VPFPToUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFPToUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFPToUIOpAdaptor; + template + using GenericAdaptor = VPFPToUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fptoui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFPToUIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFPTruncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFPTruncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFPTruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFPTruncOpGenericAdaptorBase(VPFPTruncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFPTruncOpGenericAdaptor : public detail::VPFPTruncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFPTruncOpGenericAdaptorBase; +public: + VPFPTruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFPTruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFPTruncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFPTruncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFPTruncOpAdaptor : public VPFPTruncOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFPTruncOpGenericAdaptor::VPFPTruncOpGenericAdaptor; + VPFPTruncOpAdaptor(VPFPTruncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFPTruncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFPTruncOpAdaptor; + template + using GenericAdaptor = VPFPTruncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fptrunc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFPTruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFRemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFRemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFRemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFRemOpGenericAdaptorBase(VPFRemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFRemOpGenericAdaptor : public detail::VPFRemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFRemOpGenericAdaptorBase; +public: + VPFRemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFRemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFRemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFRemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFRemOpAdaptor : public VPFRemOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFRemOpGenericAdaptor::VPFRemOpGenericAdaptor; + VPFRemOpAdaptor(VPFRemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFRemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFRemOpAdaptor; + template + using GenericAdaptor = VPFRemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.frem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFRemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFSubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFSubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFSubOpGenericAdaptorBase(VPFSubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFSubOpGenericAdaptor : public detail::VPFSubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFSubOpGenericAdaptorBase; +public: + VPFSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFSubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFSubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFSubOpAdaptor : public VPFSubOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFSubOpGenericAdaptor::VPFSubOpGenericAdaptor; + VPFSubOpAdaptor(VPFSubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFSubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFSubOpAdaptor; + template + using GenericAdaptor = VPFSubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fsub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFSubOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPFmaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPFmaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPFmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPFmaOpGenericAdaptorBase(VPFmaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPFmaOpGenericAdaptor : public detail::VPFmaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPFmaOpGenericAdaptorBase; +public: + VPFmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPFmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPFmaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPFmaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOp1() { + return (*getODSOperands(0).begin()); + } + + ValueT getOp2() { + return (*getODSOperands(1).begin()); + } + + ValueT getOp3() { + return (*getODSOperands(2).begin()); + } + + ValueT getMask() { + return (*getODSOperands(3).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPFmaOpAdaptor : public VPFmaOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPFmaOpGenericAdaptor::VPFmaOpGenericAdaptor; + VPFmaOpAdaptor(VPFmaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPFmaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPFmaOpAdaptor; + template + using GenericAdaptor = VPFmaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.fma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOp1(); + ::mlir::Value getOp2(); + ::mlir::Value getOp3(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getOp1Mutable(); + ::mlir::OpOperand &getOp2Mutable(); + ::mlir::OpOperand &getOp3Mutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value op1, ::mlir::Value op2, ::mlir::Value op3, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value op1, ::mlir::Value op2, ::mlir::Value op3, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPFmaOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPIntToPtrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPIntToPtrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPIntToPtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPIntToPtrOpGenericAdaptorBase(VPIntToPtrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPIntToPtrOpGenericAdaptor : public detail::VPIntToPtrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPIntToPtrOpGenericAdaptorBase; +public: + VPIntToPtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPIntToPtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPIntToPtrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPIntToPtrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPIntToPtrOpAdaptor : public VPIntToPtrOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPIntToPtrOpGenericAdaptor::VPIntToPtrOpGenericAdaptor; + VPIntToPtrOpAdaptor(VPIntToPtrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPIntToPtrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPIntToPtrOpAdaptor; + template + using GenericAdaptor = VPIntToPtrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.inttoptr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPIntToPtrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPLShrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPLShrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPLShrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPLShrOpGenericAdaptorBase(VPLShrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPLShrOpGenericAdaptor : public detail::VPLShrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPLShrOpGenericAdaptorBase; +public: + VPLShrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPLShrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPLShrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPLShrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPLShrOpAdaptor : public VPLShrOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPLShrOpGenericAdaptor::VPLShrOpGenericAdaptor; + VPLShrOpAdaptor(VPLShrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPLShrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPLShrOpAdaptor; + template + using GenericAdaptor = VPLShrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.lshr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPLShrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPLoadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPLoadOpGenericAdaptorBase(VPLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPLoadOpGenericAdaptor : public detail::VPLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPLoadOpGenericAdaptorBase; +public: + VPLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPLoadOpAdaptor : public VPLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPLoadOpGenericAdaptor::VPLoadOpGenericAdaptor; + VPLoadOpAdaptor(VPLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPLoadOpAdaptor; + template + using GenericAdaptor = VPLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getPtrMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPLoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPMergeMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPMergeMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPMergeMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPMergeMinOpGenericAdaptorBase(VPMergeMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPMergeMinOpGenericAdaptor : public detail::VPMergeMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPMergeMinOpGenericAdaptorBase; +public: + VPMergeMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPMergeMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPMergeMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPMergeMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCond() { + return (*getODSOperands(0).begin()); + } + + ValueT getTrueVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getFalseVal() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPMergeMinOpAdaptor : public VPMergeMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPMergeMinOpGenericAdaptor::VPMergeMinOpGenericAdaptor; + VPMergeMinOpAdaptor(VPMergeMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPMergeMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPMergeMinOpAdaptor; + template + using GenericAdaptor = VPMergeMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.merge"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCond(); + ::mlir::Value getTrueVal(); + ::mlir::Value getFalseVal(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getCondMutable(); + ::mlir::OpOperand &getTrueValMutable(); + ::mlir::OpOperand &getFalseValMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value cond, ::mlir::Value true_val, ::mlir::Value false_val, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::Value true_val, ::mlir::Value false_val, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPMergeMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPMulOpGenericAdaptorBase(VPMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPMulOpGenericAdaptor : public detail::VPMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPMulOpGenericAdaptorBase; +public: + VPMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPMulOpAdaptor : public VPMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPMulOpGenericAdaptor::VPMulOpGenericAdaptor; + VPMulOpAdaptor(VPMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPMulOpAdaptor; + template + using GenericAdaptor = VPMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPOrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPOrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPOrOpGenericAdaptorBase(VPOrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPOrOpGenericAdaptor : public detail::VPOrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPOrOpGenericAdaptorBase; +public: + VPOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPOrOpAdaptor : public VPOrOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPOrOpGenericAdaptor::VPOrOpGenericAdaptor; + VPOrOpAdaptor(VPOrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPOrOpAdaptor; + template + using GenericAdaptor = VPOrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.or"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPOrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPPtrToIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPPtrToIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPPtrToIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPPtrToIntOpGenericAdaptorBase(VPPtrToIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPPtrToIntOpGenericAdaptor : public detail::VPPtrToIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPPtrToIntOpGenericAdaptorBase; +public: + VPPtrToIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPPtrToIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPPtrToIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPPtrToIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPPtrToIntOpAdaptor : public VPPtrToIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPPtrToIntOpGenericAdaptor::VPPtrToIntOpGenericAdaptor; + VPPtrToIntOpAdaptor(VPPtrToIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPPtrToIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPPtrToIntOpAdaptor; + template + using GenericAdaptor = VPPtrToIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.ptrtoint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPPtrToIntOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceAddOpGenericAdaptorBase(VPReduceAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceAddOpGenericAdaptor : public detail::VPReduceAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceAddOpGenericAdaptorBase; +public: + VPReduceAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceAddOpAdaptor : public VPReduceAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceAddOpGenericAdaptor::VPReduceAddOpGenericAdaptor; + VPReduceAddOpAdaptor(VPReduceAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceAddOpAdaptor; + template + using GenericAdaptor = VPReduceAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceAndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceAndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceAndOpGenericAdaptorBase(VPReduceAndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceAndOpGenericAdaptor : public detail::VPReduceAndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceAndOpGenericAdaptorBase; +public: + VPReduceAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceAndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceAndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceAndOpAdaptor : public VPReduceAndOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceAndOpGenericAdaptor::VPReduceAndOpGenericAdaptor; + VPReduceAndOpAdaptor(VPReduceAndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceAndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceAndOpAdaptor; + template + using GenericAdaptor = VPReduceAndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.and"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceAndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceFAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceFAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceFAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceFAddOpGenericAdaptorBase(VPReduceFAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceFAddOpGenericAdaptor : public detail::VPReduceFAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceFAddOpGenericAdaptorBase; +public: + VPReduceFAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceFAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceFAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceFAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceFAddOpAdaptor : public VPReduceFAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceFAddOpGenericAdaptor::VPReduceFAddOpGenericAdaptor; + VPReduceFAddOpAdaptor(VPReduceFAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceFAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceFAddOpAdaptor; + template + using GenericAdaptor = VPReduceFAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.fadd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceFAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceFMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceFMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceFMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceFMaxOpGenericAdaptorBase(VPReduceFMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceFMaxOpGenericAdaptor : public detail::VPReduceFMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceFMaxOpGenericAdaptorBase; +public: + VPReduceFMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceFMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceFMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceFMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceFMaxOpAdaptor : public VPReduceFMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceFMaxOpGenericAdaptor::VPReduceFMaxOpGenericAdaptor; + VPReduceFMaxOpAdaptor(VPReduceFMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceFMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceFMaxOpAdaptor; + template + using GenericAdaptor = VPReduceFMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.fmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceFMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceFMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceFMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceFMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceFMinOpGenericAdaptorBase(VPReduceFMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceFMinOpGenericAdaptor : public detail::VPReduceFMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceFMinOpGenericAdaptorBase; +public: + VPReduceFMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceFMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceFMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceFMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceFMinOpAdaptor : public VPReduceFMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceFMinOpGenericAdaptor::VPReduceFMinOpGenericAdaptor; + VPReduceFMinOpAdaptor(VPReduceFMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceFMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceFMinOpAdaptor; + template + using GenericAdaptor = VPReduceFMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.fmin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceFMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceFMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceFMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceFMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceFMulOpGenericAdaptorBase(VPReduceFMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceFMulOpGenericAdaptor : public detail::VPReduceFMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceFMulOpGenericAdaptorBase; +public: + VPReduceFMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceFMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceFMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceFMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceFMulOpAdaptor : public VPReduceFMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceFMulOpGenericAdaptor::VPReduceFMulOpGenericAdaptor; + VPReduceFMulOpAdaptor(VPReduceFMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceFMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceFMulOpAdaptor; + template + using GenericAdaptor = VPReduceFMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.fmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceFMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceMulOpGenericAdaptorBase(VPReduceMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceMulOpGenericAdaptor : public detail::VPReduceMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceMulOpGenericAdaptorBase; +public: + VPReduceMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceMulOpAdaptor : public VPReduceMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceMulOpGenericAdaptor::VPReduceMulOpGenericAdaptor; + VPReduceMulOpAdaptor(VPReduceMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceMulOpAdaptor; + template + using GenericAdaptor = VPReduceMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceOrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceOrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceOrOpGenericAdaptorBase(VPReduceOrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceOrOpGenericAdaptor : public detail::VPReduceOrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceOrOpGenericAdaptorBase; +public: + VPReduceOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceOrOpAdaptor : public VPReduceOrOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceOrOpGenericAdaptor::VPReduceOrOpGenericAdaptor; + VPReduceOrOpAdaptor(VPReduceOrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceOrOpAdaptor; + template + using GenericAdaptor = VPReduceOrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.or"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceOrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceSMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceSMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceSMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceSMaxOpGenericAdaptorBase(VPReduceSMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceSMaxOpGenericAdaptor : public detail::VPReduceSMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceSMaxOpGenericAdaptorBase; +public: + VPReduceSMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceSMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceSMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceSMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceSMaxOpAdaptor : public VPReduceSMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceSMaxOpGenericAdaptor::VPReduceSMaxOpGenericAdaptor; + VPReduceSMaxOpAdaptor(VPReduceSMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceSMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceSMaxOpAdaptor; + template + using GenericAdaptor = VPReduceSMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.smax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceSMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceSMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceSMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceSMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceSMinOpGenericAdaptorBase(VPReduceSMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceSMinOpGenericAdaptor : public detail::VPReduceSMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceSMinOpGenericAdaptorBase; +public: + VPReduceSMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceSMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceSMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceSMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceSMinOpAdaptor : public VPReduceSMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceSMinOpGenericAdaptor::VPReduceSMinOpGenericAdaptor; + VPReduceSMinOpAdaptor(VPReduceSMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceSMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceSMinOpAdaptor; + template + using GenericAdaptor = VPReduceSMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.smin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceSMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceUMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceUMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceUMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceUMaxOpGenericAdaptorBase(VPReduceUMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceUMaxOpGenericAdaptor : public detail::VPReduceUMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceUMaxOpGenericAdaptorBase; +public: + VPReduceUMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceUMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceUMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceUMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceUMaxOpAdaptor : public VPReduceUMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceUMaxOpGenericAdaptor::VPReduceUMaxOpGenericAdaptor; + VPReduceUMaxOpAdaptor(VPReduceUMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceUMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceUMaxOpAdaptor; + template + using GenericAdaptor = VPReduceUMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.umax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceUMaxOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceUMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceUMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceUMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceUMinOpGenericAdaptorBase(VPReduceUMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceUMinOpGenericAdaptor : public detail::VPReduceUMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceUMinOpGenericAdaptorBase; +public: + VPReduceUMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceUMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceUMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceUMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceUMinOpAdaptor : public VPReduceUMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceUMinOpGenericAdaptor::VPReduceUMinOpGenericAdaptor; + VPReduceUMinOpAdaptor(VPReduceUMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceUMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceUMinOpAdaptor; + template + using GenericAdaptor = VPReduceUMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.umin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceUMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPReduceXorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPReduceXorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPReduceXorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPReduceXorOpGenericAdaptorBase(VPReduceXorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPReduceXorOpGenericAdaptor : public detail::VPReduceXorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPReduceXorOpGenericAdaptorBase; +public: + VPReduceXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPReduceXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPReduceXorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPReduceXorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSatrtValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPReduceXorOpAdaptor : public VPReduceXorOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPReduceXorOpGenericAdaptor::VPReduceXorOpGenericAdaptor; + VPReduceXorOpAdaptor(VPReduceXorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPReduceXorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPReduceXorOpAdaptor; + template + using GenericAdaptor = VPReduceXorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.reduce.xor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSatrtValue(); + ::mlir::Value getVal(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSatrtValueMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value satrt_value, ::mlir::Value val, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPReduceXorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPSDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPSDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPSDivOpGenericAdaptorBase(VPSDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPSDivOpGenericAdaptor : public detail::VPSDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPSDivOpGenericAdaptorBase; +public: + VPSDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPSDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPSDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPSDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPSDivOpAdaptor : public VPSDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPSDivOpGenericAdaptor::VPSDivOpGenericAdaptor; + VPSDivOpAdaptor(VPSDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPSDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPSDivOpAdaptor; + template + using GenericAdaptor = VPSDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.sdiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSExtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPSExtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPSExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPSExtOpGenericAdaptorBase(VPSExtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPSExtOpGenericAdaptor : public detail::VPSExtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPSExtOpGenericAdaptorBase; +public: + VPSExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPSExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPSExtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPSExtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPSExtOpAdaptor : public VPSExtOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPSExtOpGenericAdaptor::VPSExtOpGenericAdaptor; + VPSExtOpAdaptor(VPSExtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPSExtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPSExtOpAdaptor; + template + using GenericAdaptor = VPSExtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.sext"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSIToFPOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPSIToFPOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPSIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPSIToFPOpGenericAdaptorBase(VPSIToFPOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPSIToFPOpGenericAdaptor : public detail::VPSIToFPOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPSIToFPOpGenericAdaptorBase; +public: + VPSIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPSIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPSIToFPOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPSIToFPOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPSIToFPOpAdaptor : public VPSIToFPOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPSIToFPOpGenericAdaptor::VPSIToFPOpGenericAdaptor; + VPSIToFPOpAdaptor(VPSIToFPOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPSIToFPOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPSIToFPOpAdaptor; + template + using GenericAdaptor = VPSIToFPOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.sitofp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSIToFPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSRemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPSRemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPSRemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPSRemOpGenericAdaptorBase(VPSRemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPSRemOpGenericAdaptor : public detail::VPSRemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPSRemOpGenericAdaptorBase; +public: + VPSRemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPSRemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPSRemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPSRemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPSRemOpAdaptor : public VPSRemOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPSRemOpGenericAdaptor::VPSRemOpGenericAdaptor; + VPSRemOpAdaptor(VPSRemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPSRemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPSRemOpAdaptor; + template + using GenericAdaptor = VPSRemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.srem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSRemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSelectMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPSelectMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPSelectMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPSelectMinOpGenericAdaptorBase(VPSelectMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPSelectMinOpGenericAdaptor : public detail::VPSelectMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPSelectMinOpGenericAdaptorBase; +public: + VPSelectMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPSelectMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPSelectMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPSelectMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCond() { + return (*getODSOperands(0).begin()); + } + + ValueT getTrueVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getFalseVal() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPSelectMinOpAdaptor : public VPSelectMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPSelectMinOpGenericAdaptor::VPSelectMinOpGenericAdaptor; + VPSelectMinOpAdaptor(VPSelectMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPSelectMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPSelectMinOpAdaptor; + template + using GenericAdaptor = VPSelectMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.select"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCond(); + ::mlir::Value getTrueVal(); + ::mlir::Value getFalseVal(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getCondMutable(); + ::mlir::OpOperand &getTrueValMutable(); + ::mlir::OpOperand &getFalseValMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value cond, ::mlir::Value true_val, ::mlir::Value false_val, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cond, ::mlir::Value true_val, ::mlir::Value false_val, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSelectMinOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPShlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPShlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPShlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPShlOpGenericAdaptorBase(VPShlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPShlOpGenericAdaptor : public detail::VPShlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPShlOpGenericAdaptorBase; +public: + VPShlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPShlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPShlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPShlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPShlOpAdaptor : public VPShlOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPShlOpGenericAdaptor::VPShlOpGenericAdaptor; + VPShlOpAdaptor(VPShlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPShlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPShlOpAdaptor; + template + using GenericAdaptor = VPShlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.shl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPShlOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPStoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPStoreOpGenericAdaptorBase(VPStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPStoreOpGenericAdaptor : public detail::VPStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPStoreOpGenericAdaptorBase; +public: + VPStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + ValueT getPtr() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPStoreOpAdaptor : public VPStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPStoreOpGenericAdaptor::VPStoreOpGenericAdaptor; + VPStoreOpAdaptor(VPStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPStoreOpAdaptor; + template + using GenericAdaptor = VPStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getPtrMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value ptr, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value ptr, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPStoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPStridedLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPStridedLoadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPStridedLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPStridedLoadOpGenericAdaptorBase(VPStridedLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPStridedLoadOpGenericAdaptor : public detail::VPStridedLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPStridedLoadOpGenericAdaptorBase; +public: + VPStridedLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPStridedLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPStridedLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPStridedLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getStride() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPStridedLoadOpAdaptor : public VPStridedLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPStridedLoadOpGenericAdaptor::VPStridedLoadOpGenericAdaptor; + VPStridedLoadOpAdaptor(VPStridedLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPStridedLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPStridedLoadOpAdaptor; + template + using GenericAdaptor = VPStridedLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.experimental.vp.strided.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::TypedValue<::mlir::IntegerType> getStride(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getPtrMutable(); + ::mlir::OpOperand &getStrideMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPStridedLoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPStridedStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPStridedStoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPStridedStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPStridedStoreOpGenericAdaptorBase(VPStridedStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPStridedStoreOpGenericAdaptor : public detail::VPStridedStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPStridedStoreOpGenericAdaptorBase; +public: + VPStridedStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPStridedStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPStridedStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPStridedStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + ValueT getPtr() { + return (*getODSOperands(1).begin()); + } + + ValueT getStride() { + return (*getODSOperands(2).begin()); + } + + ValueT getMask() { + return (*getODSOperands(3).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPStridedStoreOpAdaptor : public VPStridedStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPStridedStoreOpGenericAdaptor::VPStridedStoreOpGenericAdaptor; + VPStridedStoreOpAdaptor(VPStridedStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPStridedStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPStridedStoreOpAdaptor; + template + using GenericAdaptor = VPStridedStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.experimental.vp.strided.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::TypedValue<::mlir::IntegerType> getStride(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getPtrMutable(); + ::mlir::OpOperand &getStrideMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPStridedStoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPSubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPSubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPSubOpGenericAdaptorBase(VPSubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPSubOpGenericAdaptor : public detail::VPSubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPSubOpGenericAdaptorBase; +public: + VPSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPSubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPSubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPSubOpAdaptor : public VPSubOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPSubOpGenericAdaptor::VPSubOpGenericAdaptor; + VPSubOpAdaptor(VPSubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPSubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPSubOpAdaptor; + template + using GenericAdaptor = VPSubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.sub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPSubOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPTruncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPTruncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPTruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPTruncOpGenericAdaptorBase(VPTruncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPTruncOpGenericAdaptor : public detail::VPTruncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPTruncOpGenericAdaptorBase; +public: + VPTruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPTruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPTruncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPTruncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPTruncOpAdaptor : public VPTruncOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPTruncOpGenericAdaptor::VPTruncOpGenericAdaptor; + VPTruncOpAdaptor(VPTruncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPTruncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPTruncOpAdaptor; + template + using GenericAdaptor = VPTruncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.trunc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPTruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPUDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPUDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPUDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPUDivOpGenericAdaptorBase(VPUDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPUDivOpGenericAdaptor : public detail::VPUDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPUDivOpGenericAdaptorBase; +public: + VPUDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPUDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPUDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPUDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPUDivOpAdaptor : public VPUDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPUDivOpGenericAdaptor::VPUDivOpGenericAdaptor; + VPUDivOpAdaptor(VPUDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPUDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPUDivOpAdaptor; + template + using GenericAdaptor = VPUDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.udiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPUDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPUIToFPOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPUIToFPOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPUIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPUIToFPOpGenericAdaptorBase(VPUIToFPOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPUIToFPOpGenericAdaptor : public detail::VPUIToFPOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPUIToFPOpGenericAdaptorBase; +public: + VPUIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPUIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPUIToFPOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPUIToFPOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPUIToFPOpAdaptor : public VPUIToFPOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPUIToFPOpGenericAdaptor::VPUIToFPOpGenericAdaptor; + VPUIToFPOpAdaptor(VPUIToFPOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPUIToFPOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPUIToFPOpAdaptor; + template + using GenericAdaptor = VPUIToFPOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.uitofp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPUIToFPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPURemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPURemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPURemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPURemOpGenericAdaptorBase(VPURemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPURemOpGenericAdaptor : public detail::VPURemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPURemOpGenericAdaptorBase; +public: + VPURemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPURemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPURemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPURemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPURemOpAdaptor : public VPURemOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPURemOpGenericAdaptor::VPURemOpGenericAdaptor; + VPURemOpAdaptor(VPURemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPURemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPURemOpAdaptor; + template + using GenericAdaptor = VPURemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.urem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPURemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPXorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPXorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPXorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPXorOpGenericAdaptorBase(VPXorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPXorOpGenericAdaptor : public detail::VPXorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPXorOpGenericAdaptorBase; +public: + VPXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPXorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPXorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPXorOpAdaptor : public VPXorOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPXorOpGenericAdaptor::VPXorOpGenericAdaptor; + VPXorOpAdaptor(VPXorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPXorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPXorOpAdaptor; + template + using GenericAdaptor = VPXorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.xor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPXorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VPZExtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VPZExtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VPZExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VPZExtOpGenericAdaptorBase(VPZExtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VPZExtOpGenericAdaptor : public detail::VPZExtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VPZExtOpGenericAdaptorBase; +public: + VPZExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VPZExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VPZExtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VPZExtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + ValueT getEvl() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VPZExtOpAdaptor : public VPZExtOpGenericAdaptor<::mlir::ValueRange> { +public: + using VPZExtOpGenericAdaptor::VPZExtOpGenericAdaptor; + VPZExtOpAdaptor(VPZExtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VPZExtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VPZExtOpAdaptor; + template + using GenericAdaptor = VPZExtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vp.zext"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getMask(); + ::mlir::TypedValue<::mlir::IntegerType> getEvl(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getEvlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value mask, ::mlir::Value evl); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VPZExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VaCopyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VaCopyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VaCopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VaCopyOpGenericAdaptorBase(VaCopyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VaCopyOpGenericAdaptor : public detail::VaCopyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VaCopyOpGenericAdaptorBase; +public: + VaCopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VaCopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VaCopyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VaCopyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDestList() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrcList() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VaCopyOpAdaptor : public VaCopyOpGenericAdaptor<::mlir::ValueRange> { +public: + using VaCopyOpGenericAdaptor::VaCopyOpGenericAdaptor; + VaCopyOpAdaptor(VaCopyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VaCopyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = VaCopyOpAdaptor; + template + using GenericAdaptor = VaCopyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vacopy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getDestList(); + ::mlir::Value getSrcList(); + ::mlir::OpOperand &getDestListMutable(); + ::mlir::OpOperand &getSrcListMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dest_list, ::mlir::Value src_list); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dest_list, ::mlir::Value src_list); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VaCopyOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VaEndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VaEndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VaEndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VaEndOpGenericAdaptorBase(VaEndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VaEndOpGenericAdaptor : public detail::VaEndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VaEndOpGenericAdaptorBase; +public: + VaEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VaEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VaEndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VaEndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArgList() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VaEndOpAdaptor : public VaEndOpGenericAdaptor<::mlir::ValueRange> { +public: + using VaEndOpGenericAdaptor::VaEndOpGenericAdaptor; + VaEndOpAdaptor(VaEndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VaEndOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = VaEndOpAdaptor; + template + using GenericAdaptor = VaEndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vaend"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArgList(); + ::mlir::OpOperand &getArgListMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg_list); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg_list); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VaEndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VaStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VaStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VaStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VaStartOpGenericAdaptorBase(VaStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VaStartOpGenericAdaptor : public detail::VaStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VaStartOpGenericAdaptorBase; +public: + VaStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VaStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VaStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VaStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArgList() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VaStartOpAdaptor : public VaStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using VaStartOpGenericAdaptor::VaStartOpGenericAdaptor; + VaStartOpAdaptor(VaStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VaStartOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = VaStartOpAdaptor; + template + using GenericAdaptor = VaStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vastart"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArgList(); + ::mlir::OpOperand &getArgListMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg_list); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg_list); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VaStartOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::VarAnnotation declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VarAnnotationGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VarAnnotationGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VarAnnotationGenericAdaptorBase(VarAnnotation op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VarAnnotationGenericAdaptor : public detail::VarAnnotationGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VarAnnotationGenericAdaptorBase; +public: + VarAnnotationGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VarAnnotationGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VarAnnotationGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VarAnnotationGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + ValueT getAnnotation() { + return (*getODSOperands(1).begin()); + } + + ValueT getFileName() { + return (*getODSOperands(2).begin()); + } + + ValueT getLine() { + return (*getODSOperands(3).begin()); + } + + ValueT getAttr() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VarAnnotationAdaptor : public VarAnnotationGenericAdaptor<::mlir::ValueRange> { +public: + using VarAnnotationGenericAdaptor::VarAnnotationGenericAdaptor; + VarAnnotationAdaptor(VarAnnotation op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VarAnnotation : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = VarAnnotationAdaptor; + template + using GenericAdaptor = VarAnnotationGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.var.annotation"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getVal(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getAnnotation(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getFileName(); + ::mlir::TypedValue<::mlir::IntegerType> getLine(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getAttr(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getAnnotationMutable(); + ::mlir::OpOperand &getFileNameMutable(); + ::mlir::OpOperand &getLineMutable(); + ::mlir::OpOperand &getAttrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::Value annotation, ::mlir::Value fileName, ::mlir::Value line, ::mlir::Value attr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VarAnnotation) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::masked_compressstore declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class masked_compressstoreGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + masked_compressstoreGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + masked_compressstoreGenericAdaptorBase(masked_compressstore op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class masked_compressstoreGenericAdaptor : public detail::masked_compressstoreGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::masked_compressstoreGenericAdaptorBase; +public: + masked_compressstoreGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + masked_compressstoreGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : masked_compressstoreGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + masked_compressstoreGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class masked_compressstoreAdaptor : public masked_compressstoreGenericAdaptor<::mlir::ValueRange> { +public: + using masked_compressstoreGenericAdaptor::masked_compressstoreGenericAdaptor; + masked_compressstoreAdaptor(masked_compressstore op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class masked_compressstore : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = masked_compressstoreAdaptor; + template + using GenericAdaptor = masked_compressstoreGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.masked.compressstore"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::masked_compressstore) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::masked_expandload declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class masked_expandloadGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + masked_expandloadGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + masked_expandloadGenericAdaptorBase(masked_expandload op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class masked_expandloadGenericAdaptor : public detail::masked_expandloadGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::masked_expandloadGenericAdaptorBase; +public: + masked_expandloadGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + masked_expandloadGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : masked_expandloadGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + masked_expandloadGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class masked_expandloadAdaptor : public masked_expandloadGenericAdaptor<::mlir::ValueRange> { +public: + using masked_expandloadGenericAdaptor::masked_expandloadGenericAdaptor; + masked_expandloadAdaptor(masked_expandload op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class masked_expandload : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = masked_expandloadAdaptor; + template + using GenericAdaptor = masked_expandloadGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.masked.expandload"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1, ::mlir::Value odsArg_2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::masked_expandload) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::masked_gather declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class masked_gatherGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + masked_gatherGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + masked_gatherGenericAdaptorBase(masked_gather op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); +}; +} // namespace detail +template +class masked_gatherGenericAdaptor : public detail::masked_gatherGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::masked_gatherGenericAdaptorBase; +public: + masked_gatherGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + masked_gatherGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : masked_gatherGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + masked_gatherGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtrs() { + return (*getODSOperands(0).begin()); + } + + ValueT getMask() { + return (*getODSOperands(1).begin()); + } + + RangeT getPassThru() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class masked_gatherAdaptor : public masked_gatherGenericAdaptor<::mlir::ValueRange> { +public: + using masked_gatherGenericAdaptor::masked_gatherGenericAdaptor; + masked_gatherAdaptor(masked_gather op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class masked_gather : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = masked_gatherAdaptor; + template + using GenericAdaptor = masked_gatherGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.masked.gather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getPtrs(); + ::mlir::Value getMask(); + ::mlir::Operation::operand_range getPassThru(); + ::mlir::OpOperand &getPtrsMutable(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::MutableOperandRange getPassThruMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::ValueRange pass_thru, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::ValueRange pass_thru, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::ValueRange pass_thru, uint32_t alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::ValueRange pass_thru, uint32_t alignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::masked_gather) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::masked_scatter declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class masked_scatterGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + masked_scatterGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + masked_scatterGenericAdaptorBase(masked_scatter op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); +}; +} // namespace detail +template +class masked_scatterGenericAdaptor : public detail::masked_scatterGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::masked_scatterGenericAdaptorBase; +public: + masked_scatterGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + masked_scatterGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : masked_scatterGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + masked_scatterGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getPtrs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMask() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class masked_scatterAdaptor : public masked_scatterGenericAdaptor<::mlir::ValueRange> { +public: + using masked_scatterGenericAdaptor::masked_scatterGenericAdaptor; + masked_scatterAdaptor(masked_scatter op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class masked_scatter : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = masked_scatterAdaptor; + template + using GenericAdaptor = masked_scatterGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.masked.scatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::Value getPtrs(); + ::mlir::Value getMask(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getPtrsMutable(); + ::mlir::OpOperand &getMaskMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value ptrs, ::mlir::Value mask, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value ptrs, ::mlir::Value mask, uint32_t alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value ptrs, ::mlir::Value mask, uint32_t alignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::masked_scatter) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_extract declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_extractGenericAdaptorBase { +public: + struct Properties { + using posTy = ::mlir::IntegerAttr; + posTy pos; + + auto getPos() { + auto &propStorage = this->pos; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setPos(const ::mlir::IntegerAttr &propValue) { + this->pos = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.pos == this->pos && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + vector_extractGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_extractGenericAdaptorBase(vector_extract op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPosAttr(); + uint64_t getPos(); +}; +} // namespace detail +template +class vector_extractGenericAdaptor : public detail::vector_extractGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_extractGenericAdaptorBase; +public: + vector_extractGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_extractGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_extractGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + vector_extractGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcvec() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_extractAdaptor : public vector_extractGenericAdaptor<::mlir::ValueRange> { +public: + using vector_extractGenericAdaptor::vector_extractGenericAdaptor; + vector_extractAdaptor(vector_extract op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_extract : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_extractAdaptor; + template + using GenericAdaptor = vector_extractGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("pos")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPosAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPosAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.extract"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrcvec(); + ::mlir::OpOperand &getSrcvecMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getPosAttr(); + uint64_t getPos(); + void setPosAttr(::mlir::IntegerAttr attr); + void setPos(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcvec, ::mlir::IntegerAttr pos); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcvec, ::mlir::IntegerAttr pos); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcvec, uint64_t pos); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcvec, uint64_t pos); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + uint64_t getVectorBitWidth(Type vector) { + return getVectorNumElements(vector).getKnownMinValue() * + getVectorElementType(vector).getIntOrFloatBitWidth(); + } + uint64_t getSrcVectorBitWidth() { + return getVectorBitWidth(getSrcvec().getType()); + } + uint64_t getResVectorBitWidth() { + return getVectorBitWidth(getRes().getType()); + } +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_extract) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_insert declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_insertGenericAdaptorBase { +public: + struct Properties { + using posTy = ::mlir::IntegerAttr; + posTy pos; + + auto getPos() { + auto &propStorage = this->pos; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setPos(const ::mlir::IntegerAttr &propValue) { + this->pos = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.pos == this->pos && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + vector_insertGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_insertGenericAdaptorBase(vector_insert op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPosAttr(); + uint64_t getPos(); +}; +} // namespace detail +template +class vector_insertGenericAdaptor : public detail::vector_insertGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_insertGenericAdaptorBase; +public: + vector_insertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_insertGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_insertGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + vector_insertGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcvec() { + return (*getODSOperands(0).begin()); + } + + ValueT getDstvec() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_insertAdaptor : public vector_insertGenericAdaptor<::mlir::ValueRange> { +public: + using vector_insertGenericAdaptor::vector_insertGenericAdaptor; + vector_insertAdaptor(vector_insert op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_insert : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_insertAdaptor; + template + using GenericAdaptor = vector_insertGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("pos")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPosAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPosAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.insert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrcvec(); + ::mlir::Value getDstvec(); + ::mlir::OpOperand &getSrcvecMutable(); + ::mlir::OpOperand &getDstvecMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getPosAttr(); + uint64_t getPos(); + void setPosAttr(::mlir::IntegerAttr attr); + void setPos(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcvec, ::mlir::Value dstvec, ::mlir::IntegerAttr pos); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value srcvec, ::mlir::Value dstvec, ::mlir::IntegerAttr pos); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcvec, ::mlir::Value dstvec, ::mlir::IntegerAttr pos); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcvec, ::mlir::Value dstvec, uint64_t pos); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value srcvec, ::mlir::Value dstvec, uint64_t pos); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcvec, ::mlir::Value dstvec, uint64_t pos); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + uint64_t getVectorBitWidth(Type vector) { + return getVectorNumElements(vector).getKnownMinValue() * + getVectorElementType(vector).getIntOrFloatBitWidth(); + } + uint64_t getSrcVectorBitWidth() { + return getVectorBitWidth(getSrcvec().getType()); + } + uint64_t getDstVectorBitWidth() { + return getVectorBitWidth(getDstvec().getType()); + } +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_insert) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_add declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_addGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_addGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_addGenericAdaptorBase(vector_reduce_add op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vector_reduce_addGenericAdaptor : public detail::vector_reduce_addGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_addGenericAdaptorBase; +public: + vector_reduce_addGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_addGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_addGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vector_reduce_addGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_addAdaptor : public vector_reduce_addGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_addGenericAdaptor::vector_reduce_addGenericAdaptor; + vector_reduce_addAdaptor(vector_reduce_add op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_add : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_addAdaptor; + template + using GenericAdaptor = vector_reduce_addGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_add) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_and declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_andGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_andGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_andGenericAdaptorBase(vector_reduce_and op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vector_reduce_andGenericAdaptor : public detail::vector_reduce_andGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_andGenericAdaptorBase; +public: + vector_reduce_andGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_andGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_andGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vector_reduce_andGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_andAdaptor : public vector_reduce_andGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_andGenericAdaptor::vector_reduce_andGenericAdaptor; + vector_reduce_andAdaptor(vector_reduce_and op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_and : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_andAdaptor; + template + using GenericAdaptor = vector_reduce_andGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.and"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_and) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fadd declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_faddGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_faddGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_faddGenericAdaptorBase(vector_reduce_fadd op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class vector_reduce_faddGenericAdaptor : public detail::vector_reduce_faddGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_faddGenericAdaptorBase; +public: + vector_reduce_faddGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_faddGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_faddGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + vector_reduce_faddGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStartValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getInput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_faddAdaptor : public vector_reduce_faddGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_faddGenericAdaptor::vector_reduce_faddGenericAdaptor; + vector_reduce_faddAdaptor(vector_reduce_fadd op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_fadd : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_faddAdaptor; + template + using GenericAdaptor = vector_reduce_faddGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.fadd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getStartValue(); + ::mlir::Value getInput(); + ::mlir::OpOperand &getStartValueMutable(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fadd) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fmax declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_fmaxGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_fmaxGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_fmaxGenericAdaptorBase(vector_reduce_fmax op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class vector_reduce_fmaxGenericAdaptor : public detail::vector_reduce_fmaxGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_fmaxGenericAdaptorBase; +public: + vector_reduce_fmaxGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_fmaxGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_fmaxGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + vector_reduce_fmaxGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_fmaxAdaptor : public vector_reduce_fmaxGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_fmaxGenericAdaptor::vector_reduce_fmaxGenericAdaptor; + vector_reduce_fmaxAdaptor(vector_reduce_fmax op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_fmax : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_fmaxAdaptor; + template + using GenericAdaptor = vector_reduce_fmaxGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.fmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fmax) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fmaximum declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_fmaximumGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_fmaximumGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_fmaximumGenericAdaptorBase(vector_reduce_fmaximum op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class vector_reduce_fmaximumGenericAdaptor : public detail::vector_reduce_fmaximumGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_fmaximumGenericAdaptorBase; +public: + vector_reduce_fmaximumGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_fmaximumGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_fmaximumGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + vector_reduce_fmaximumGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_fmaximumAdaptor : public vector_reduce_fmaximumGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_fmaximumGenericAdaptor::vector_reduce_fmaximumGenericAdaptor; + vector_reduce_fmaximumAdaptor(vector_reduce_fmaximum op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_fmaximum : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_fmaximumAdaptor; + template + using GenericAdaptor = vector_reduce_fmaximumGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.fmaximum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fmaximum) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fmin declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_fminGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_fminGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_fminGenericAdaptorBase(vector_reduce_fmin op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class vector_reduce_fminGenericAdaptor : public detail::vector_reduce_fminGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_fminGenericAdaptorBase; +public: + vector_reduce_fminGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_fminGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_fminGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + vector_reduce_fminGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_fminAdaptor : public vector_reduce_fminGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_fminGenericAdaptor::vector_reduce_fminGenericAdaptor; + vector_reduce_fminAdaptor(vector_reduce_fmin op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_fmin : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_fminAdaptor; + template + using GenericAdaptor = vector_reduce_fminGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.fmin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fmin) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fminimum declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_fminimumGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_fminimumGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_fminimumGenericAdaptorBase(vector_reduce_fminimum op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class vector_reduce_fminimumGenericAdaptor : public detail::vector_reduce_fminimumGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_fminimumGenericAdaptorBase; +public: + vector_reduce_fminimumGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_fminimumGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_fminimumGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + vector_reduce_fminimumGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_fminimumAdaptor : public vector_reduce_fminimumGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_fminimumGenericAdaptor::vector_reduce_fminimumGenericAdaptor; + vector_reduce_fminimumAdaptor(vector_reduce_fminimum op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_fminimum : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_fminimumAdaptor; + template + using GenericAdaptor = vector_reduce_fminimumGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.fminimum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fminimum) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_fmul declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_fmulGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_fmulGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_fmulGenericAdaptorBase(vector_reduce_fmul op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class vector_reduce_fmulGenericAdaptor : public detail::vector_reduce_fmulGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_fmulGenericAdaptorBase; +public: + vector_reduce_fmulGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_fmulGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_fmulGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + vector_reduce_fmulGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStartValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getInput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_fmulAdaptor : public vector_reduce_fmulGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_fmulGenericAdaptor::vector_reduce_fmulGenericAdaptor; + vector_reduce_fmulAdaptor(vector_reduce_fmul op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_fmul : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_fmulAdaptor; + template + using GenericAdaptor = vector_reduce_fmulGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.fmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getStartValue(); + ::mlir::Value getInput(); + ::mlir::OpOperand &getStartValueMutable(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start_value, ::mlir::Value input, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_fmul) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_mul declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_mulGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_mulGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_mulGenericAdaptorBase(vector_reduce_mul op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vector_reduce_mulGenericAdaptor : public detail::vector_reduce_mulGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_mulGenericAdaptorBase; +public: + vector_reduce_mulGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_mulGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_mulGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vector_reduce_mulGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_mulAdaptor : public vector_reduce_mulGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_mulGenericAdaptor::vector_reduce_mulGenericAdaptor; + vector_reduce_mulAdaptor(vector_reduce_mul op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_mul : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_mulAdaptor; + template + using GenericAdaptor = vector_reduce_mulGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_mul) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_or declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_orGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_orGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_orGenericAdaptorBase(vector_reduce_or op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vector_reduce_orGenericAdaptor : public detail::vector_reduce_orGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_orGenericAdaptorBase; +public: + vector_reduce_orGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_orGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_orGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vector_reduce_orGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_orAdaptor : public vector_reduce_orGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_orGenericAdaptor::vector_reduce_orGenericAdaptor; + vector_reduce_orAdaptor(vector_reduce_or op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_or : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_orAdaptor; + template + using GenericAdaptor = vector_reduce_orGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.or"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_or) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_smax declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_smaxGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_smaxGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_smaxGenericAdaptorBase(vector_reduce_smax op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vector_reduce_smaxGenericAdaptor : public detail::vector_reduce_smaxGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_smaxGenericAdaptorBase; +public: + vector_reduce_smaxGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_smaxGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_smaxGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vector_reduce_smaxGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_smaxAdaptor : public vector_reduce_smaxGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_smaxGenericAdaptor::vector_reduce_smaxGenericAdaptor; + vector_reduce_smaxAdaptor(vector_reduce_smax op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_smax : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_smaxAdaptor; + template + using GenericAdaptor = vector_reduce_smaxGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.smax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_smax) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_smin declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_sminGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_sminGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_sminGenericAdaptorBase(vector_reduce_smin op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vector_reduce_sminGenericAdaptor : public detail::vector_reduce_sminGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_sminGenericAdaptorBase; +public: + vector_reduce_sminGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_sminGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_sminGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vector_reduce_sminGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_sminAdaptor : public vector_reduce_sminGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_sminGenericAdaptor::vector_reduce_sminGenericAdaptor; + vector_reduce_sminAdaptor(vector_reduce_smin op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_smin : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_sminAdaptor; + template + using GenericAdaptor = vector_reduce_sminGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.smin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_smin) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_umax declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_umaxGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_umaxGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_umaxGenericAdaptorBase(vector_reduce_umax op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vector_reduce_umaxGenericAdaptor : public detail::vector_reduce_umaxGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_umaxGenericAdaptorBase; +public: + vector_reduce_umaxGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_umaxGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_umaxGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vector_reduce_umaxGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_umaxAdaptor : public vector_reduce_umaxGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_umaxGenericAdaptor::vector_reduce_umaxGenericAdaptor; + vector_reduce_umaxAdaptor(vector_reduce_umax op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_umax : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_umaxAdaptor; + template + using GenericAdaptor = vector_reduce_umaxGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.umax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_umax) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_umin declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_uminGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_uminGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_uminGenericAdaptorBase(vector_reduce_umin op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vector_reduce_uminGenericAdaptor : public detail::vector_reduce_uminGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_uminGenericAdaptorBase; +public: + vector_reduce_uminGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_uminGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_uminGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vector_reduce_uminGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_uminAdaptor : public vector_reduce_uminGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_uminGenericAdaptor::vector_reduce_uminGenericAdaptor; + vector_reduce_uminAdaptor(vector_reduce_umin op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_umin : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_uminAdaptor; + template + using GenericAdaptor = vector_reduce_uminGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.umin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_umin) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vector_reduce_xor declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vector_reduce_xorGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vector_reduce_xorGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vector_reduce_xorGenericAdaptorBase(vector_reduce_xor op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vector_reduce_xorGenericAdaptor : public detail::vector_reduce_xorGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vector_reduce_xorGenericAdaptorBase; +public: + vector_reduce_xorGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vector_reduce_xorGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vector_reduce_xorGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vector_reduce_xorGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vector_reduce_xorAdaptor : public vector_reduce_xorGenericAdaptor<::mlir::ValueRange> { +public: + using vector_reduce_xorGenericAdaptor::vector_reduce_xorGenericAdaptor; + vector_reduce_xorAdaptor(vector_reduce_xor op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vector_reduce_xor : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = vector_reduce_xorAdaptor; + template + using GenericAdaptor = vector_reduce_xorGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vector.reduce.xor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vector_reduce_xor) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::vscale declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class vscaleGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + vscaleGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + vscaleGenericAdaptorBase(vscale op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class vscaleGenericAdaptor : public detail::vscaleGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::vscaleGenericAdaptorBase; +public: + vscaleGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + vscaleGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : vscaleGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + vscaleGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class vscaleAdaptor : public vscaleGenericAdaptor<::mlir::ValueRange> { +public: + using vscaleGenericAdaptor::vscaleGenericAdaptor; + vscaleAdaptor(vscale op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class vscale : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = vscaleAdaptor; + template + using GenericAdaptor = vscaleGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.intr.vscale"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::vscale) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpFromLLVMIRConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpFromLLVMIRConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..d4e7c31986f8be1c9f11a7fb3ae6054df7ee7ef1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpFromLLVMIRConversions.inc @@ -0,0 +1,666 @@ +if (inst->getOpcode() == llvm::Instruction::AShr) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::AShrOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Add) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::AddOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::AddrSpaceCast) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::AddrSpaceCastOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Alloca) { +FailureOr _llvmir_gen_operand_arraySize = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arraySize)) + return failure(); + + + auto *allocaInst = cast(inst); + Type allocatedType = + moduleImport.convertType(allocaInst->getAllocatedType()); + unsigned alignment = allocaInst->getAlign().value(); + moduleImport.mapValue(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arraySize, + alignment == 0 ? IntegerAttr() : odsBuilder.getI64IntegerAttr(alignment), + TypeAttr::get(allocatedType), allocaInst->isUsedWithInAlloca()); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::And) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::AndOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::AtomicCmpXchg) { +FailureOr _llvmir_gen_operand_ptr = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_ptr)) + return failure(); +FailureOr _llvmir_gen_operand_cmp = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_cmp)) + return failure(); +FailureOr _llvmir_gen_operand_val = moduleImport.convertValue(llvmOperands[2]); +if (failed(_llvmir_gen_operand_val)) + return failure(); + + + auto *cmpXchgInst = cast(inst); + unsigned alignment = cmpXchgInst->getAlign().value(); + moduleImport.mapValue(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_ptr, *_llvmir_gen_operand_cmp, *_llvmir_gen_operand_val, + convertAtomicOrderingFromLLVM(cmpXchgInst->getSuccessOrdering()), + convertAtomicOrderingFromLLVM(cmpXchgInst->getFailureOrdering()), + getLLVMSyncScope(cmpXchgInst), alignment, cmpXchgInst->isWeak(), + cmpXchgInst->isVolatile()); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::AtomicRMW) { +FailureOr _llvmir_gen_operand_ptr = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_ptr)) + return failure(); +FailureOr _llvmir_gen_operand_val = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_val)) + return failure(); + + + auto *atomicInst = cast(inst); + unsigned alignment = atomicInst->getAlign().value(); + moduleImport.mapValue(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), + convertAtomicBinOpFromLLVM(atomicInst->getOperation()), *_llvmir_gen_operand_ptr, *_llvmir_gen_operand_val, + convertAtomicOrderingFromLLVM(atomicInst->getOrdering()), + getLLVMSyncScope(atomicInst), alignment, atomicInst->isVolatile()); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::BitCast) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::BitcastOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::ExtractElement) { +FailureOr _llvmir_gen_operand_vector = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_vector)) + return failure(); +FailureOr _llvmir_gen_operand_position = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_position)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_vector, *_llvmir_gen_operand_position); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::ExtractValue) { +FailureOr _llvmir_gen_operand_container = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_container)) + return failure(); + + + auto *evInst = cast(inst); + moduleImport.mapValue(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), + *_llvmir_gen_operand_container, getPositionFromIndices(evInst->getIndices())); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FAdd) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::FAddOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + moduleImport.setFastmathFlagsAttr(inst, op); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FCmp) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + auto *fCmpInst = cast(inst); + auto op = odsBuilder.create<::mlir::LLVM::FCmpOp>( + moduleImport.translateLoc(inst->getDebugLoc()), convertFCmpPredicateFromLLVM(fCmpInst->getPredicate()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + moduleImport.setFastmathFlagsAttr(inst, op); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FDiv) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::FDivOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + moduleImport.setFastmathFlagsAttr(inst, op); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FMul) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::FMulOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + moduleImport.setFastmathFlagsAttr(inst, op); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FNeg) { +FailureOr _llvmir_gen_operand_operand = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_operand)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::FNegOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_operand); + moduleImport.setFastmathFlagsAttr(inst, op); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FPExt) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::FPExtOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FPToSI) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::FPToSIOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FPToUI) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::FPToUIOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FPTrunc) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::FPTruncOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FRem) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::FRemOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + moduleImport.setFastmathFlagsAttr(inst, op); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::FSub) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + auto op = odsBuilder.create<::mlir::LLVM::FSubOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + moduleImport.setFastmathFlagsAttr(inst, op); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Fence) { + + + llvm::FenceInst *fenceInst = cast(inst); + moduleImport.mapNoResultOp(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), + convertAtomicOrderingFromLLVM(fenceInst->getOrdering()), + getLLVMSyncScope(fenceInst)); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Freeze) { +FailureOr _llvmir_gen_operand_val = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_val)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_val); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::ICmp) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + auto *iCmpInst = cast(inst); + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::ICmpOp>(moduleImport.translateLoc(inst->getDebugLoc()), + convertICmpPredicateFromLLVM(iCmpInst->getPredicate()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::InsertElement) { +FailureOr _llvmir_gen_operand_vector = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_vector)) + return failure(); +FailureOr _llvmir_gen_operand_value = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_value)) + return failure(); +FailureOr _llvmir_gen_operand_position = moduleImport.convertValue(llvmOperands[2]); +if (failed(_llvmir_gen_operand_position)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_vector, *_llvmir_gen_operand_value, *_llvmir_gen_operand_position); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::InsertValue) { +FailureOr _llvmir_gen_operand_container = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_container)) + return failure(); +FailureOr _llvmir_gen_operand_value = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_value)) + return failure(); + + + auto *ivInst = cast(inst); + moduleImport.mapValue(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), + *_llvmir_gen_operand_container, *_llvmir_gen_operand_value, getPositionFromIndices(ivInst->getIndices())); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::IntToPtr) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::IntToPtrOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::LShr) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::LShrOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Load) { +FailureOr _llvmir_gen_operand_addr = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_addr)) + return failure(); + + + auto *loadInst = cast(inst); + unsigned alignment = loadInst->getAlign().value(); + moduleImport.mapValue(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_addr, + alignment, loadInst->isVolatile(), + loadInst->hasMetadata(llvm::LLVMContext::MD_nontemporal), + convertAtomicOrderingFromLLVM(loadInst->getOrdering()), + getLLVMSyncScope(loadInst)); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Mul) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::MulOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Or) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::OrOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::PtrToInt) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::PtrToIntOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Resume) { +FailureOr _llvmir_gen_operand_value = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_value)) + return failure(); + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_value); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Ret) { + + + FailureOr> mlirOperands = + moduleImport.convertValues(llvmOperands); + if (failed(mlirOperands)) + return failure(); + moduleImport.mapNoResultOp(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), *mlirOperands); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::SDiv) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::SDivOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::SExt) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::SExtOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::SIToFP) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::SIToFPOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::SRem) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::SRemOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Select) { +FailureOr _llvmir_gen_operand_condition = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_condition)) + return failure(); +FailureOr _llvmir_gen_operand_trueValue = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_trueValue)) + return failure(); +FailureOr _llvmir_gen_operand_falseValue = moduleImport.convertValue(llvmOperands[2]); +if (failed(_llvmir_gen_operand_falseValue)) + return failure(); + + + auto op = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_condition, *_llvmir_gen_operand_trueValue, *_llvmir_gen_operand_falseValue); + moduleImport.setFastmathFlagsAttr(inst, op); + moduleImport.mapValue(inst) = op; + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Shl) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::ShlOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::ShuffleVector) { +FailureOr _llvmir_gen_operand_v1 = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_v1)) + return failure(); +FailureOr _llvmir_gen_operand_v2 = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_v2)) + return failure(); + + + auto *svInst = cast(inst); + SmallVector mask(svInst->getShuffleMask()); + moduleImport.mapValue(inst) = odsBuilder.create( + moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_v1, *_llvmir_gen_operand_v2, mask); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Store) { +FailureOr _llvmir_gen_operand_value = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_value)) + return failure(); +FailureOr _llvmir_gen_operand_addr = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_addr)) + return failure(); + + + auto *storeInst = cast(inst); + unsigned alignment = storeInst->getAlign().value(); + moduleImport.mapNoResultOp(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_value, *_llvmir_gen_operand_addr, + alignment, storeInst->isVolatile(), + storeInst->hasMetadata(llvm::LLVMContext::MD_nontemporal), + convertAtomicOrderingFromLLVM(storeInst->getOrdering()), + getLLVMSyncScope(storeInst)); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Sub) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::SubOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Trunc) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::TruncOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::UDiv) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::UDivOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::UIToFP) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::UIToFPOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::URem) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::URemOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Unreachable) { + + + moduleImport.mapNoResultOp(inst) = odsBuilder.create(moduleImport.translateLoc(inst->getDebugLoc())); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::Xor) { +FailureOr _llvmir_gen_operand_lhs = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_lhs)) + return failure(); +FailureOr _llvmir_gen_operand_rhs = moduleImport.convertValue(llvmOperands[1]); +if (failed(_llvmir_gen_operand_rhs)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::XOrOp>(moduleImport.translateLoc(inst->getDebugLoc()), *_llvmir_gen_operand_lhs, *_llvmir_gen_operand_rhs); + + return success(); +} +if (inst->getOpcode() == llvm::Instruction::ZExt) { +FailureOr _llvmir_gen_operand_arg = moduleImport.convertValue(llvmOperands[0]); +if (failed(_llvmir_gen_operand_arg)) + return failure(); + + + moduleImport.mapValue(inst) = odsBuilder.create<::mlir::LLVM::ZExtOp>( + moduleImport.translateLoc(inst->getDebugLoc()), moduleImport.convertType(inst->getType()), *_llvmir_gen_operand_arg); + + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..4a3f403e500c3d758dbdd65e86e5162ef7ef6495 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc @@ -0,0 +1,29708 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LLVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::LLVM::AShrOp, +::mlir::LLVM::AddOp, +::mlir::LLVM::AddrSpaceCastOp, +::mlir::LLVM::AddressOfOp, +::mlir::LLVM::AllocaOp, +::mlir::LLVM::AndOp, +::mlir::LLVM::AtomicCmpXchgOp, +::mlir::LLVM::AtomicRMWOp, +::mlir::LLVM::BitcastOp, +::mlir::LLVM::BrOp, +::mlir::LLVM::CallIntrinsicOp, +::mlir::LLVM::CallOp, +::mlir::LLVM::ComdatOp, +::mlir::LLVM::ComdatSelectorOp, +::mlir::LLVM::CondBrOp, +::mlir::LLVM::ConstantOp, +::mlir::LLVM::ExtractElementOp, +::mlir::LLVM::ExtractValueOp, +::mlir::LLVM::FAddOp, +::mlir::LLVM::FCmpOp, +::mlir::LLVM::FDivOp, +::mlir::LLVM::FMulOp, +::mlir::LLVM::FNegOp, +::mlir::LLVM::FPExtOp, +::mlir::LLVM::FPToSIOp, +::mlir::LLVM::FPToUIOp, +::mlir::LLVM::FPTruncOp, +::mlir::LLVM::FRemOp, +::mlir::LLVM::FSubOp, +::mlir::LLVM::FenceOp, +::mlir::LLVM::FreezeOp, +::mlir::LLVM::GEPOp, +::mlir::LLVM::GlobalCtorsOp, +::mlir::LLVM::GlobalDtorsOp, +::mlir::LLVM::GlobalOp, +::mlir::LLVM::ICmpOp, +::mlir::LLVM::InlineAsmOp, +::mlir::LLVM::InsertElementOp, +::mlir::LLVM::InsertValueOp, +::mlir::LLVM::IntToPtrOp, +::mlir::LLVM::InvokeOp, +::mlir::LLVM::LLVMFuncOp, +::mlir::LLVM::LShrOp, +::mlir::LLVM::LandingpadOp, +::mlir::LLVM::LoadOp, +::mlir::LLVM::MulOp, +::mlir::LLVM::NoneTokenOp, +::mlir::LLVM::OrOp, +::mlir::LLVM::PoisonOp, +::mlir::LLVM::PtrToIntOp, +::mlir::LLVM::ResumeOp, +::mlir::LLVM::ReturnOp, +::mlir::LLVM::SDivOp, +::mlir::LLVM::SExtOp, +::mlir::LLVM::SIToFPOp, +::mlir::LLVM::SRemOp, +::mlir::LLVM::SelectOp, +::mlir::LLVM::ShlOp, +::mlir::LLVM::ShuffleVectorOp, +::mlir::LLVM::StoreOp, +::mlir::LLVM::SubOp, +::mlir::LLVM::SwitchOp, +::mlir::LLVM::TruncOp, +::mlir::LLVM::UDivOp, +::mlir::LLVM::UIToFPOp, +::mlir::LLVM::URemOp, +::mlir::LLVM::UndefOp, +::mlir::LLVM::UnreachableOp, +::mlir::LLVM::XOrOp, +::mlir::LLVM::ZExtOp, +::mlir::LLVM::ZeroOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace LLVM { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::IntegerType>(type))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::isa<::mlir::IntegerType>(::mlir::LLVM::getVectorElementType(type))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer or LLVM dialect-compatible vector of integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(::mlir::LLVM::getVectorElementType(type))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer type or LLVM dialect-compatible vector of LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IntegerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) || (((::llvm::isa<::mlir::IntegerType>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()))) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer to integer or LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::IntegerType>(type))) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer or LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMStructType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM structure type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) || (((::mlir::LLVM::isCompatibleFloatingPointType(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()))) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()))) || ((::llvm::isa<::mlir::IntegerType>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer to floating point LLVM type or LLVM pointer type or integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::mlir::LLVM::isCompatibleFloatingPointType(type))) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) || ((::llvm::isa<::mlir::IntegerType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be floating point LLVM type or LLVM pointer type or integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::mlir::LLVM::isCompatibleOuterType(type))) && (!((::llvm::isa<::mlir::LLVM::LLVMStructType, ::mlir::LLVM::LLVMArrayType>(type)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM-compatible non-aggregate type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleOuterType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps11( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps12( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleVectorType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible vector type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps13( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMStructType, ::mlir::LLVM::LLVMArrayType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM aggregate type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps14( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::mlir::LLVM::isCompatibleFloatingPointType(type))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::mlir::LLVM::isCompatibleFloatingPointType(::mlir::LLVM::getVectorElementType(type))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be floating point LLVM type or LLVM dialect-compatible vector of floating point LLVM type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps15( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessInteger(1))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::mlir::LLVM::getVectorElementType(type).isSignlessInteger(1)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer or LLVM dialect-compatible vector of 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps16( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::IntegerType>(type))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::isa<::mlir::IntegerType>(::mlir::LLVM::getVectorElementType(type)))))) || (((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) || (((::mlir::LLVM::isCompatibleVectorType(type))) && ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(::mlir::LLVM::getVectorElementType(type)))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer or LLVM dialect-compatible vector of integer or LLVM pointer type or LLVM dialect-compatible vector of LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps17( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::mlir::LLVM::isCompatibleOuterType(type))) && ((!::llvm::isa<::mlir::LLVM::LLVMVoidType, ::mlir::LLVM::LLVMFunctionType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be primitive LLVM type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps18( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) || (((((::mlir::LLVM::isCompatibleOuterType(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()))) && ((!::llvm::isa<::mlir::LLVM::LLVMVoidType, ::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType())))) && (!(((::llvm::isa<::mlir::LLVM::LLVMStructType>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()))) && ((::llvm::cast<::mlir::LLVM::LLVMStructType>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()).isOpaque())))) && (!(((::llvm::isa<::mlir::LLVM::LLVMTargetExtType>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()))) && ((!::llvm::cast<::mlir::LLVM::LLVMTargetExtType>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()).supportsMemOps()))))) || ((::llvm::isa<::mlir::LLVM::PointerElementTypeInterface>(::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType()))))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer to LLVM type with size, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps19( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::mlir::LLVM::isCompatibleOuterType(type))) && ((!::llvm::isa<::mlir::LLVM::LLVMVoidType, ::mlir::LLVM::LLVMFunctionType>(type)))) && (!(((::llvm::isa<::mlir::LLVM::LLVMStructType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMStructType>(type).isOpaque())))) && (!(((::llvm::isa<::mlir::LLVM::LLVMTargetExtType>(type))) && ((!::llvm::cast<::mlir::LLVM::LLVMTargetExtType>(type).supportsMemOps()))))) || ((::llvm::isa<::mlir::LLVM::PointerElementTypeInterface>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM type with size, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps20( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMTokenType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM token type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LLVMOps21( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: flat symbol reference attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any type attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Atomic ordering for LLVM's memory model"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM dialect access group metadata array"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM dialect alias scope array"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps8( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps8( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps8(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps9( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::AtomicBinOpAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: llvm.atomicrmw binary operations"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps9( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps9(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps10( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::LoopAnnotationAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: "; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps10( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps10(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps11( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM fastmath flags"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps11( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps11(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps12( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: type attribute of LLVM function type"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps12( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps12(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps13( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: i32 dense array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps13( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps13(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps14( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::comdat::ComdatAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM Comdat Types"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps14( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps14(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps15( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((true))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps15( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps15(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps16( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: i64 dense array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps16( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps16(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps17( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::FCmpPredicateAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: llvm.fcmp comparison predicate"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps17( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps17(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps18( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: flat symbol ref array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps18( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps18(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps19( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit integer array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps19( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps19(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps20( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::LinkageAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM Linkage specification"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps20( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps20(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps21( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative())))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps21( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps21(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps22( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::UnnamedAddrAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM GlobalValue UnnamedAddr"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps22( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps22(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps23( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: symbol reference attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps23( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps23(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps24( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::VisibilityAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM GlobalValue Visibility"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps24( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps24(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps25( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::ICmpPredicateAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: lvm.icmp comparison predicate"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps25( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps25(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps26( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::AsmDialectAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: ATT (0) or Intel (1) asm dialect"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps26( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps26(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps27( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::ArrayAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps27( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps27(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps28( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::CConvAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM Calling Convention specification"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps28( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps28(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps29( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Array of dictionary attributes"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps29( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps29(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps30( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::MemoryEffectsAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: "; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps30( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps30(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps31( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::LLVM::VScaleRangeAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: "; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps31( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps31(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps32( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: integer elements attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LLVMOps32( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LLVMOps32(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_LLVMOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItems(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with 1 blocks"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_LLVMOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AShrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AShrOpGenericAdaptorBase::AShrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.ashr", odsAttrs.getContext()); +} + +AShrOpGenericAdaptorBase::AShrOpGenericAdaptorBase(AShrOp op) : AShrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AShrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AShrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AShrOpAdaptor::AShrOpAdaptor(AShrOp op) : AShrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AShrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AShrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AShrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AShrOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value AShrOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AShrOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AShrOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AShrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AShrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AShrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AShrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AShrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AShrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AShrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AShrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AShrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AShrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AShrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AShrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AShrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.add", odsAttrs.getContext()); +} + +AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(AddOp op) : AddOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AddOpAdaptor::AddOpAdaptor(AddOp op) : AddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value AddOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AddOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AddOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AddOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AddOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AddrSpaceCastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddrSpaceCastOpGenericAdaptorBase::AddrSpaceCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.addrspacecast", odsAttrs.getContext()); +} + +AddrSpaceCastOpGenericAdaptorBase::AddrSpaceCastOpGenericAdaptorBase(AddrSpaceCastOp op) : AddrSpaceCastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddrSpaceCastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AddrSpaceCastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AddrSpaceCastOpAdaptor::AddrSpaceCastOpAdaptor(AddrSpaceCastOp op) : AddrSpaceCastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddrSpaceCastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AddrSpaceCastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AddrSpaceCastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddrSpaceCastOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AddrSpaceCastOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AddrSpaceCastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AddrSpaceCastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AddrSpaceCastOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void AddrSpaceCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void AddrSpaceCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void AddrSpaceCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddrSpaceCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AddrSpaceCastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddrSpaceCastOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult AddrSpaceCastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddrSpaceCastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AddrSpaceCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddrSpaceCastOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AddressOfOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddressOfOpGenericAdaptorBase::AddressOfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mlir.addressof", odsAttrs.getContext()); +} + +AddressOfOpGenericAdaptorBase::AddressOfOpGenericAdaptorBase(AddressOfOp op) : AddressOfOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddressOfOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AddressOfOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::FlatSymbolRefAttr AddressOfOpGenericAdaptorBase::getGlobalNameAttr() { + auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().global_name); + return attr; +} + +::llvm::StringRef AddressOfOpGenericAdaptorBase::getGlobalName() { + auto attr = getGlobalNameAttr(); + return attr.getValue(); +} + +} // namespace detail +AddressOfOpAdaptor::AddressOfOpAdaptor(AddressOfOp op) : AddressOfOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddressOfOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_global_name = getProperties().global_name; (void)tblgen_global_name; + if (!tblgen_global_name) return emitError(loc, "'llvm.mlir.addressof' op ""requires attribute 'global_name'"); + + if (tblgen_global_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_global_name)))) + return emitError(loc, "'llvm.mlir.addressof' op ""attribute 'global_name' failed to satisfy constraint: flat symbol reference attribute"); + return ::mlir::success(); +} + +std::pair AddressOfOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AddressOfOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair AddressOfOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AddressOfOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> AddressOfOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AddressOfOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.global_name; + auto attr = dict.get("global_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for global_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `global_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AddressOfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.global_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("global_name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AddressOfOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.global_name.getAsOpaquePointer())); +} + +std::optional AddressOfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "global_name") + return prop.global_name; + return std::nullopt; +} + +void AddressOfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "global_name") { + prop.global_name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AddressOfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.global_name) attrs.append("global_name", prop.global_name); +} + +::mlir::LogicalResult AddressOfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getGlobalNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps0(attr, "global_name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddressOfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.global_name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AddressOfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.global_name); +} + +::mlir::FlatSymbolRefAttr AddressOfOp::getGlobalNameAttr() { + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().global_name); +} + +::llvm::StringRef AddressOfOp::getGlobalName() { + auto attr = getGlobalNameAttr(); + return attr.getValue(); +} + +void AddressOfOp::setGlobalNameAttr(::mlir::FlatSymbolRefAttr attr) { + (*this)->setAttr(getGlobalNameAttrName(), attr); +} + +void AddressOfOp::setGlobalName(::llvm::StringRef attrValue) { + (*this)->setAttr(getGlobalNameAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, GlobalOp global, ArrayRef attrs) { + build(odsBuilder, odsState, + LLVM::LLVMPointerType::get(global.getType(), global.getAddrSpace()), + global.getSymName()); + odsState.addAttributes(attrs); + +} + +void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFuncOp func, ArrayRef attrs) { + build(odsBuilder, odsState, + LLVM::LLVMPointerType::get(func.getFunctionType()), func.getName()); + odsState.addAttributes(attrs); + +} + +void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::FlatSymbolRefAttr global_name) { + odsState.getOrAddProperties().global_name = global_name; + odsState.addTypes(res); +} + +void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr global_name) { + odsState.getOrAddProperties().global_name = global_name; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::llvm::StringRef global_name) { + odsState.getOrAddProperties().global_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), global_name); + odsState.addTypes(res); +} + +void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef global_name) { + odsState.getOrAddProperties().global_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), global_name); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AddressOfOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AddressOfOp::verifyInvariantsImpl() { + auto tblgen_global_name = getProperties().global_name; (void)tblgen_global_name; + if (!tblgen_global_name) return emitOpError("requires attribute 'global_name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps0(*this, tblgen_global_name, "global_name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddressOfOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult AddressOfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::FlatSymbolRefAttr global_nameAttr; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + if (parser.parseCustomAttributeWithFallback(global_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (global_nameAttr) result.getOrAddProperties().global_name = global_nameAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(resRawTypes[0])) + return ::mlir::failure(); + result.addTypes(resTypes); + return ::mlir::success(); +} + +void AddressOfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getGlobalNameAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("global_name"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getRes().getType(); +} + +void AddressOfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddressOfOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AllocaOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AllocaOpGenericAdaptorBase::AllocaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.alloca", odsAttrs.getContext()); +} + +AllocaOpGenericAdaptorBase::AllocaOpGenericAdaptorBase(AllocaOp op) : AllocaOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AllocaOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AllocaOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr AllocaOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional AllocaOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::TypeAttr AllocaOpGenericAdaptorBase::getElemTypeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().elem_type); + return attr; +} + +::std::optional<::mlir::Type> AllocaOpGenericAdaptorBase::getElemType() { + auto attr = getElemTypeAttr(); + return attr ? ::std::optional<::mlir::Type>(::llvm::cast<::mlir::Type>(attr.getValue())) : (::std::nullopt); +} + +::mlir::UnitAttr AllocaOpGenericAdaptorBase::getInallocaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inalloca); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool AllocaOpGenericAdaptorBase::getInalloca() { + auto attr = getInallocaAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +AllocaOpAdaptor::AllocaOpAdaptor(AllocaOp op) : AllocaOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AllocaOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_elem_type = getProperties().elem_type; (void)tblgen_elem_type; + auto tblgen_inalloca = getProperties().inalloca; (void)tblgen_inalloca; + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.alloca' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_elem_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_elem_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_elem_type).getValue()))) && ((true)))) + return emitError(loc, "'llvm.alloca' op ""attribute 'elem_type' failed to satisfy constraint: any type attribute"); + + if (tblgen_inalloca && !((::llvm::isa<::mlir::UnitAttr>(tblgen_inalloca)))) + return emitError(loc, "'llvm.alloca' op ""attribute 'inalloca' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair AllocaOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AllocaOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> AllocaOp::getArraySize() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AllocaOp::getArraySizeMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AllocaOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AllocaOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> AllocaOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AllocaOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.elem_type; + auto attr = dict.get("elem_type"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for elem_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `elem_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.inalloca; + auto attr = dict.get("inalloca"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for inalloca in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `inalloca` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AllocaOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.elem_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("elem_type", + propStorage)); + } + + { + const auto &propStorage = prop.inalloca; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("inalloca", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AllocaOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + llvm::hash_value(prop.elem_type.getAsOpaquePointer()), + llvm::hash_value(prop.inalloca.getAsOpaquePointer())); +} + +std::optional AllocaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + + if (name == "elem_type") + return prop.elem_type; + + if (name == "inalloca") + return prop.inalloca; + return std::nullopt; +} + +void AllocaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "elem_type") { + prop.elem_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "inalloca") { + prop.inalloca = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AllocaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); + + if (prop.elem_type) attrs.append("elem_type", prop.elem_type); + + if (prop.inalloca) attrs.append("inalloca", prop.inalloca); +} + +::mlir::LogicalResult AllocaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "alignment", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getElemTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(attr, "elem_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getInallocaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "inalloca", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocaOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.elem_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.inalloca))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AllocaOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alignment); + + writer.writeOptionalAttribute(prop.elem_type); + + writer.writeOptionalAttribute(prop.inalloca); +} + +::mlir::IntegerAttr AllocaOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional AllocaOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::TypeAttr AllocaOp::getElemTypeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().elem_type); +} + +::std::optional<::mlir::Type> AllocaOp::getElemType() { + auto attr = getElemTypeAttr(); + return attr ? ::std::optional<::mlir::Type>(::llvm::cast<::mlir::Type>(attr.getValue())) : (::std::nullopt); +} + +::mlir::UnitAttr AllocaOp::getInallocaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inalloca); +} + +bool AllocaOp::getInalloca() { + auto attr = getInallocaAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void AllocaOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void AllocaOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +void AllocaOp::setElemTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getElemTypeAttrName(), attr); +} + +void AllocaOp::setElemType(::std::optional<::mlir::Type> attrValue) { + if (attrValue) + return (*this)->setAttr(getElemTypeAttrName(), ::mlir::TypeAttr::get(*attrValue)); + (*this)->removeAttr(getElemTypeAttrName()); +} + +void AllocaOp::setInallocaAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getInallocaAttrName(), attr); +} + +void AllocaOp::setInalloca(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getInallocaAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getInallocaAttrName()); +} + +::mlir::Attribute AllocaOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +::mlir::Attribute AllocaOp::removeElemTypeAttr() { + auto &attr = getProperties().elem_type; + attr = {}; + return attr; +} + +::mlir::Attribute AllocaOp::removeInallocaAttr() { + auto &attr = getProperties().inalloca; + attr = {}; + return attr; +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value arraySize, unsigned alignment) { + assert(!::llvm::cast(resultType).isOpaque() && + "pass the allocated type explicitly if opaque pointers are used"); + if (alignment == 0) + return build(odsBuilder, odsState, resultType, arraySize, IntegerAttr(), + TypeAttr(), false); + build(odsBuilder, odsState, resultType, arraySize, + odsBuilder.getI64IntegerAttr(alignment), TypeAttr(), false); + +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Type elementType, Value arraySize, unsigned alignment) { + TypeAttr elemTypeAttr = + ::llvm::cast(resultType).isOpaque() ? + TypeAttr::get(elementType) : TypeAttr(); + build(odsBuilder, odsState, resultType, arraySize, + alignment == 0 ? IntegerAttr() + : odsBuilder.getI64IntegerAttr(alignment), + elemTypeAttr, false); + + +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca) { + odsState.addOperands(arraySize); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (elem_type) { + odsState.getOrAddProperties().elem_type = elem_type; + } + if (inalloca) { + odsState.getOrAddProperties().inalloca = inalloca; + } + odsState.addTypes(res); +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca) { + odsState.addOperands(arraySize); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (elem_type) { + odsState.getOrAddProperties().elem_type = elem_type; + } + if (inalloca) { + odsState.getOrAddProperties().inalloca = inalloca; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::TypeAttr elem_type, /*optional*/bool inalloca) { + odsState.addOperands(arraySize); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (elem_type) { + odsState.getOrAddProperties().elem_type = elem_type; + } + if (inalloca) { + odsState.getOrAddProperties().inalloca = ((inalloca) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(res); +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::TypeAttr elem_type, /*optional*/bool inalloca) { + odsState.addOperands(arraySize); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (elem_type) { + odsState.getOrAddProperties().elem_type = elem_type; + } + if (inalloca) { + odsState.getOrAddProperties().inalloca = ((inalloca) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AllocaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AllocaOp::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_elem_type = getProperties().elem_type; (void)tblgen_elem_type; + auto tblgen_inalloca = getProperties().inalloca; (void)tblgen_inalloca; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(*this, tblgen_elem_type, "elem_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_inalloca, "inalloca"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocaOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AllocaOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSResults(0)) + effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), value, 0, false, ::mlir::SideEffects::AutomaticAllocationScopeResource::get()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AllocaOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AndOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AndOpGenericAdaptorBase::AndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.and", odsAttrs.getContext()); +} + +AndOpGenericAdaptorBase::AndOpGenericAdaptorBase(AndOp op) : AndOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AndOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AndOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AndOpAdaptor::AndOpAdaptor(AndOp op) : AndOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AndOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AndOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AndOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AndOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value AndOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AndOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AndOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AndOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AndOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AndOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AndOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AndOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AndOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AndOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AndOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AndOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AtomicCmpXchgOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicCmpXchgOpGenericAdaptorBase::AtomicCmpXchgOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.cmpxchg", odsAttrs.getContext()); +} + +AtomicCmpXchgOpGenericAdaptorBase::AtomicCmpXchgOpGenericAdaptorBase(AtomicCmpXchgOp op) : AtomicCmpXchgOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicCmpXchgOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicCmpXchgOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::AtomicOrderingAttr AtomicCmpXchgOpGenericAdaptorBase::getSuccessOrderingAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(getProperties().success_ordering); + return attr; +} + +::mlir::LLVM::AtomicOrdering AtomicCmpXchgOpGenericAdaptorBase::getSuccessOrdering() { + auto attr = getSuccessOrderingAttr(); + return attr.getValue(); +} + +::mlir::LLVM::AtomicOrderingAttr AtomicCmpXchgOpGenericAdaptorBase::getFailureOrderingAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(getProperties().failure_ordering); + return attr; +} + +::mlir::LLVM::AtomicOrdering AtomicCmpXchgOpGenericAdaptorBase::getFailureOrdering() { + auto attr = getFailureOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr AtomicCmpXchgOpGenericAdaptorBase::getSyncscopeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); + return attr; +} + +::std::optional< ::llvm::StringRef > AtomicCmpXchgOpGenericAdaptorBase::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr AtomicCmpXchgOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional AtomicCmpXchgOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr AtomicCmpXchgOpGenericAdaptorBase::getWeakAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().weak); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool AtomicCmpXchgOpGenericAdaptorBase::getWeak() { + auto attr = getWeakAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr AtomicCmpXchgOpGenericAdaptorBase::getVolatile_Attr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool AtomicCmpXchgOpGenericAdaptorBase::getVolatile_() { + auto attr = getVolatile_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr AtomicCmpXchgOpGenericAdaptorBase::getAccessGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOpGenericAdaptorBase::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicCmpXchgOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicCmpXchgOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicCmpXchgOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +AtomicCmpXchgOpAdaptor::AtomicCmpXchgOpAdaptor(AtomicCmpXchgOp op) : AtomicCmpXchgOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicCmpXchgOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_failure_ordering = getProperties().failure_ordering; (void)tblgen_failure_ordering; + if (!tblgen_failure_ordering) return emitError(loc, "'llvm.cmpxchg' op ""requires attribute 'failure_ordering'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_success_ordering = getProperties().success_ordering; (void)tblgen_success_ordering; + if (!tblgen_success_ordering) return emitError(loc, "'llvm.cmpxchg' op ""requires attribute 'success_ordering'"); + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_; + auto tblgen_weak = getProperties().weak; (void)tblgen_weak; + + if (tblgen_success_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_success_ordering)))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'success_ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model"); + + if (tblgen_failure_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_failure_ordering)))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'failure_ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model"); + + if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope)))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'syncscope' failed to satisfy constraint: string attribute"); + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_weak && !((::llvm::isa<::mlir::UnitAttr>(tblgen_weak)))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'weak' failed to satisfy constraint: unit attribute"); + + if (tblgen_volatile_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_volatile_)))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'volatile_' failed to satisfy constraint: unit attribute"); + + if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array"); + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'llvm.cmpxchg' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair AtomicCmpXchgOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicCmpXchgOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> AtomicCmpXchgOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value AtomicCmpXchgOp::getCmp() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value AtomicCmpXchgOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &AtomicCmpXchgOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AtomicCmpXchgOp::getCmpMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AtomicCmpXchgOp::getValMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtomicCmpXchgOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicCmpXchgOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AtomicCmpXchgOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AtomicCmpXchgOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.access_groups; + auto attr = dict.get("access_groups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for access_groups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `access_groups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.failure_ordering; + auto attr = dict.get("failure_ordering"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for failure_ordering in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `failure_ordering` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.success_ordering; + auto attr = dict.get("success_ordering"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for success_ordering in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `success_ordering` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.syncscope; + auto attr = dict.get("syncscope"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for syncscope in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `syncscope` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.volatile_; + auto attr = dict.get("volatile_"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for volatile_ in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `volatile_` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.weak; + auto attr = dict.get("weak"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for weak in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `weak` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AtomicCmpXchgOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.access_groups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("access_groups", + propStorage)); + } + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.failure_ordering; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("failure_ordering", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.success_ordering; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("success_ordering", + propStorage)); + } + + { + const auto &propStorage = prop.syncscope; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("syncscope", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + { + const auto &propStorage = prop.volatile_; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("volatile_", + propStorage)); + } + + { + const auto &propStorage = prop.weak; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("weak", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AtomicCmpXchgOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.access_groups.getAsOpaquePointer()), + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + llvm::hash_value(prop.failure_ordering.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.success_ordering.getAsOpaquePointer()), + llvm::hash_value(prop.syncscope.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer()), + llvm::hash_value(prop.volatile_.getAsOpaquePointer()), + llvm::hash_value(prop.weak.getAsOpaquePointer())); +} + +std::optional AtomicCmpXchgOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "access_groups") + return prop.access_groups; + + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "alignment") + return prop.alignment; + + if (name == "failure_ordering") + return prop.failure_ordering; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "success_ordering") + return prop.success_ordering; + + if (name == "syncscope") + return prop.syncscope; + + if (name == "tbaa") + return prop.tbaa; + + if (name == "volatile_") + return prop.volatile_; + + if (name == "weak") + return prop.weak; + return std::nullopt; +} + +void AtomicCmpXchgOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "access_groups") { + prop.access_groups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "failure_ordering") { + prop.failure_ordering = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "success_ordering") { + prop.success_ordering = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "syncscope") { + prop.syncscope = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "volatile_") { + prop.volatile_ = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "weak") { + prop.weak = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AtomicCmpXchgOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.access_groups) attrs.append("access_groups", prop.access_groups); + + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.alignment) attrs.append("alignment", prop.alignment); + + if (prop.failure_ordering) attrs.append("failure_ordering", prop.failure_ordering); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.success_ordering) attrs.append("success_ordering", prop.success_ordering); + + if (prop.syncscope) attrs.append("syncscope", prop.syncscope); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); + + if (prop.volatile_) attrs.append("volatile_", prop.volatile_); + + if (prop.weak) attrs.append("weak", prop.weak); +} + +::mlir::LogicalResult AtomicCmpXchgOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(attr, "access_groups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "alignment", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFailureOrderingAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "failure_ordering", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSuccessOrderingAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "success_ordering", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "syncscope", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getVolatile_AttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "volatile_", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWeakAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "weak", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicCmpXchgOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.failure_ordering))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.success_ordering))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.volatile_))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.weak))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicCmpXchgOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.access_groups); + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.alignment); + writer.writeAttribute(prop.failure_ordering); + + writer.writeOptionalAttribute(prop.noalias_scopes); + writer.writeAttribute(prop.success_ordering); + + writer.writeOptionalAttribute(prop.syncscope); + + writer.writeOptionalAttribute(prop.tbaa); + + writer.writeOptionalAttribute(prop.volatile_); + + writer.writeOptionalAttribute(prop.weak); +} + +::mlir::LLVM::AtomicOrderingAttr AtomicCmpXchgOp::getSuccessOrderingAttr() { + return ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(getProperties().success_ordering); +} + +::mlir::LLVM::AtomicOrdering AtomicCmpXchgOp::getSuccessOrdering() { + auto attr = getSuccessOrderingAttr(); + return attr.getValue(); +} + +::mlir::LLVM::AtomicOrderingAttr AtomicCmpXchgOp::getFailureOrderingAttr() { + return ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(getProperties().failure_ordering); +} + +::mlir::LLVM::AtomicOrdering AtomicCmpXchgOp::getFailureOrdering() { + auto attr = getFailureOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr AtomicCmpXchgOp::getSyncscopeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); +} + +::std::optional< ::llvm::StringRef > AtomicCmpXchgOp::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr AtomicCmpXchgOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional AtomicCmpXchgOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr AtomicCmpXchgOp::getWeakAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().weak); +} + +bool AtomicCmpXchgOp::getWeak() { + auto attr = getWeakAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr AtomicCmpXchgOp::getVolatile_Attr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_); +} + +bool AtomicCmpXchgOp::getVolatile_() { + auto attr = getVolatile_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr AtomicCmpXchgOp::getAccessGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); +} + +::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOp::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicCmpXchgOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicCmpXchgOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicCmpXchgOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > AtomicCmpXchgOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void AtomicCmpXchgOp::setSuccessOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr) { + (*this)->setAttr(getSuccessOrderingAttrName(), attr); +} + +void AtomicCmpXchgOp::setSuccessOrdering(::mlir::LLVM::AtomicOrdering attrValue) { + (*this)->setAttr(getSuccessOrderingAttrName(), ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AtomicCmpXchgOp::setFailureOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr) { + (*this)->setAttr(getFailureOrderingAttrName(), attr); +} + +void AtomicCmpXchgOp::setFailureOrdering(::mlir::LLVM::AtomicOrdering attrValue) { + (*this)->setAttr(getFailureOrderingAttrName(), ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AtomicCmpXchgOp::setSyncscopeAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSyncscopeAttrName(), attr); +} + +void AtomicCmpXchgOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSyncscopeAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSyncscopeAttrName()); +} + +void AtomicCmpXchgOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void AtomicCmpXchgOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +void AtomicCmpXchgOp::setWeakAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWeakAttrName(), attr); +} + +void AtomicCmpXchgOp::setWeak(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWeakAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWeakAttrName()); +} + +void AtomicCmpXchgOp::setVolatile_Attr(::mlir::UnitAttr attr) { + (*this)->setAttr(getVolatile_AttrName(), attr); +} + +void AtomicCmpXchgOp::setVolatile_(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getVolatile_AttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getVolatile_AttrName()); +} + +void AtomicCmpXchgOp::setAccessGroupsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAccessGroupsAttrName(), attr); +} + +void AtomicCmpXchgOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void AtomicCmpXchgOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void AtomicCmpXchgOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute AtomicCmpXchgOp::removeSyncscopeAttr() { + auto &attr = getProperties().syncscope; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicCmpXchgOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicCmpXchgOp::removeWeakAttr() { + auto &attr = getProperties().weak; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicCmpXchgOp::removeVolatile_Attr() { + auto &attr = getProperties().volatile_; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicCmpXchgOp::removeAccessGroupsAttr() { + auto &attr = getProperties().access_groups; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicCmpXchgOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicCmpXchgOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicCmpXchgOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(cmp); + odsState.addOperands(val); + odsState.getOrAddProperties().success_ordering = success_ordering; + odsState.getOrAddProperties().failure_ordering = failure_ordering; + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (weak) { + odsState.getOrAddProperties().weak = weak; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(res); +} + +void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(cmp); + odsState.addOperands(val); + odsState.getOrAddProperties().success_ordering = success_ordering; + odsState.getOrAddProperties().failure_ordering = failure_ordering; + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (weak) { + odsState.getOrAddProperties().weak = weak; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtomicCmpXchgOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(cmp); + odsState.addOperands(val); + odsState.getOrAddProperties().success_ordering = success_ordering; + odsState.getOrAddProperties().failure_ordering = failure_ordering; + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (weak) { + odsState.getOrAddProperties().weak = weak; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(cmp); + odsState.addOperands(val); + odsState.getOrAddProperties().success_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), success_ordering); + odsState.getOrAddProperties().failure_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), failure_ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (weak) { + odsState.getOrAddProperties().weak = ((weak) ? odsBuilder.getUnitAttr() : nullptr); + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(res); +} + +void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(cmp); + odsState.addOperands(val); + odsState.getOrAddProperties().success_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), success_ordering); + odsState.getOrAddProperties().failure_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), failure_ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (weak) { + odsState.getOrAddProperties().weak = ((weak) ? odsBuilder.getUnitAttr() : nullptr); + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtomicCmpXchgOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(cmp); + odsState.addOperands(val); + odsState.getOrAddProperties().success_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), success_ordering); + odsState.getOrAddProperties().failure_ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), failure_ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (weak) { + odsState.getOrAddProperties().weak = ((weak) ? odsBuilder.getUnitAttr() : nullptr); + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicCmpXchgOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AtomicCmpXchgOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtomicCmpXchgOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AtomicCmpXchgOp::verifyInvariantsImpl() { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_failure_ordering = getProperties().failure_ordering; (void)tblgen_failure_ordering; + if (!tblgen_failure_ordering) return emitOpError("requires attribute 'failure_ordering'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_success_ordering = getProperties().success_ordering; (void)tblgen_success_ordering; + if (!tblgen_success_ordering) return emitOpError("requires attribute 'success_ordering'"); + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_; + auto tblgen_weak = getProperties().weak; (void)tblgen_weak; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_success_ordering, "success_ordering"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_failure_ordering, "failure_ordering"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_syncscope, "syncscope"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_weak, "weak"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_volatile_, "volatile_"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(*this, tblgen_access_groups, "access_groups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()((*this->getODSOperands(2).begin()).getType(), (*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that operand #1 and operand #2 have the same type"); + if (!((std::equal_to<>()(getValAndBoolStructType((*this->getODSOperands(2).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result #0 has an LLVM struct type consisting of the type of operand #2 and a bool"); + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicCmpXchgOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult AtomicCmpXchgOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = getValAndBoolStructType(operands[2].getType()); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AtomicCmpXchgOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand ptrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(ptrRawOperands); ::llvm::SMLoc ptrOperandsLoc; + (void)ptrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand cmpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> cmpOperands(cmpRawOperands); ::llvm::SMLoc cmpOperandsLoc; + (void)cmpOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(valRawOperands); ::llvm::SMLoc valOperandsLoc; + (void)valOperandsLoc; + ::mlir::StringAttr syncscopeAttr; + ::mlir::LLVM::AtomicOrderingAttr success_orderingAttr; + ::mlir::LLVM::AtomicOrderingAttr failure_orderingAttr; + ::mlir::Type ptrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> ptrTypes(ptrRawTypes); + ::mlir::Type valRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes); + if (::mlir::succeeded(parser.parseOptionalKeyword("weak"))) { + result.getOrAddProperties().weak = parser.getBuilder().getUnitAttr(); } + if (::mlir::succeeded(parser.parseOptionalKeyword("volatile"))) { + result.getOrAddProperties().volatile_ = parser.getBuilder().getUnitAttr(); } + + ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ptrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + cmpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(cmpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (syncscopeAttr) result.getOrAddProperties().syncscope = syncscopeAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "success_ordering", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'success_ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "success_ordering attribute specification: \"" << attrStr << '"';; + + success_orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().success_ordering = success_orderingAttr; + } + } + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "failure_ordering", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'failure_ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "failure_ordering attribute specification: \"" << attrStr << '"';; + + failure_orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().failure_ordering = failure_orderingAttr; + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(ptrRawTypes[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valRawTypes[0] = type; + } + for (::mlir::Type type : valTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::IntegerType>(type))) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))))) { + return parser.emitError(parser.getNameLoc()) << "'val' must be integer or LLVM pointer type, but got " << type; + } + } + result.addTypes(getValAndBoolStructType(valTypes[0])); + if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(cmpOperands, valTypes[0], cmpOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicCmpXchgOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getWeakAttr()) { + _odsPrinter << ' ' << "weak"; + } + if (getVolatile_Attr()) { + _odsPrinter << ' ' << "volatile"; + } + _odsPrinter << ' '; + _odsPrinter << getPtr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCmp(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getVal(); + if (getSyncscopeAttr()) { + _odsPrinter << ' ' << "syncscope"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getSyncscopeAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + + { + auto caseValue = getSuccessOrdering(); + auto caseValueStr = stringifyAtomicOrdering(caseValue); + _odsPrinter << caseValueStr; + } + _odsPrinter << ' '; + + { + auto caseValue = getFailureOrdering(); + auto caseValueStr = stringifyAtomicOrdering(caseValue); + _odsPrinter << caseValueStr; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("weak"); + elidedAttrs.push_back("volatile_"); + elidedAttrs.push_back("syncscope"); + elidedAttrs.push_back("success_ordering"); + elidedAttrs.push_back("failure_ordering"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWeakAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("weak"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getVolatile_Attr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("volatile_"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getPtr().getType(); + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getVal().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AtomicCmpXchgOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AtomicRMWOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicRMWOpGenericAdaptorBase::AtomicRMWOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.atomicrmw", odsAttrs.getContext()); +} + +AtomicRMWOpGenericAdaptorBase::AtomicRMWOpGenericAdaptorBase(AtomicRMWOp op) : AtomicRMWOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicRMWOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicRMWOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::AtomicBinOpAttr AtomicRMWOpGenericAdaptorBase::getBinOpAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::AtomicBinOpAttr>(getProperties().bin_op); + return attr; +} + +::mlir::LLVM::AtomicBinOp AtomicRMWOpGenericAdaptorBase::getBinOp() { + auto attr = getBinOpAttr(); + return attr.getValue(); +} + +::mlir::LLVM::AtomicOrderingAttr AtomicRMWOpGenericAdaptorBase::getOrderingAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering); + return attr; +} + +::mlir::LLVM::AtomicOrdering AtomicRMWOpGenericAdaptorBase::getOrdering() { + auto attr = getOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr AtomicRMWOpGenericAdaptorBase::getSyncscopeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); + return attr; +} + +::std::optional< ::llvm::StringRef > AtomicRMWOpGenericAdaptorBase::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr AtomicRMWOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional AtomicRMWOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr AtomicRMWOpGenericAdaptorBase::getVolatile_Attr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool AtomicRMWOpGenericAdaptorBase::getVolatile_() { + auto attr = getVolatile_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr AtomicRMWOpGenericAdaptorBase::getAccessGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > AtomicRMWOpGenericAdaptorBase::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicRMWOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > AtomicRMWOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicRMWOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > AtomicRMWOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicRMWOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > AtomicRMWOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +AtomicRMWOpAdaptor::AtomicRMWOpAdaptor(AtomicRMWOp op) : AtomicRMWOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicRMWOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_bin_op = getProperties().bin_op; (void)tblgen_bin_op; + if (!tblgen_bin_op) return emitError(loc, "'llvm.atomicrmw' op ""requires attribute 'bin_op'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering; + if (!tblgen_ordering) return emitError(loc, "'llvm.atomicrmw' op ""requires attribute 'ordering'"); + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_; + + if (tblgen_bin_op && !((::llvm::isa<::mlir::LLVM::AtomicBinOpAttr>(tblgen_bin_op)))) + return emitError(loc, "'llvm.atomicrmw' op ""attribute 'bin_op' failed to satisfy constraint: llvm.atomicrmw binary operations"); + + if (tblgen_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_ordering)))) + return emitError(loc, "'llvm.atomicrmw' op ""attribute 'ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model"); + + if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope)))) + return emitError(loc, "'llvm.atomicrmw' op ""attribute 'syncscope' failed to satisfy constraint: string attribute"); + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.atomicrmw' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_volatile_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_volatile_)))) + return emitError(loc, "'llvm.atomicrmw' op ""attribute 'volatile_' failed to satisfy constraint: unit attribute"); + + if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError(loc, "'llvm.atomicrmw' op ""attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array"); + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.atomicrmw' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.atomicrmw' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'llvm.atomicrmw' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair AtomicRMWOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicRMWOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> AtomicRMWOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value AtomicRMWOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AtomicRMWOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AtomicRMWOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtomicRMWOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicRMWOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AtomicRMWOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AtomicRMWOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.access_groups; + auto attr = dict.get("access_groups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for access_groups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `access_groups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.bin_op; + auto attr = dict.get("bin_op"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for bin_op in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `bin_op` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.ordering; + auto attr = dict.get("ordering"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for ordering in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `ordering` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.syncscope; + auto attr = dict.get("syncscope"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for syncscope in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `syncscope` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.volatile_; + auto attr = dict.get("volatile_"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for volatile_ in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `volatile_` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AtomicRMWOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.access_groups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("access_groups", + propStorage)); + } + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.bin_op; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("bin_op", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.ordering; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("ordering", + propStorage)); + } + + { + const auto &propStorage = prop.syncscope; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("syncscope", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + { + const auto &propStorage = prop.volatile_; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("volatile_", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AtomicRMWOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.access_groups.getAsOpaquePointer()), + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + llvm::hash_value(prop.bin_op.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.ordering.getAsOpaquePointer()), + llvm::hash_value(prop.syncscope.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer()), + llvm::hash_value(prop.volatile_.getAsOpaquePointer())); +} + +std::optional AtomicRMWOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "access_groups") + return prop.access_groups; + + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "alignment") + return prop.alignment; + + if (name == "bin_op") + return prop.bin_op; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "ordering") + return prop.ordering; + + if (name == "syncscope") + return prop.syncscope; + + if (name == "tbaa") + return prop.tbaa; + + if (name == "volatile_") + return prop.volatile_; + return std::nullopt; +} + +void AtomicRMWOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "access_groups") { + prop.access_groups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "bin_op") { + prop.bin_op = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "ordering") { + prop.ordering = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "syncscope") { + prop.syncscope = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "volatile_") { + prop.volatile_ = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AtomicRMWOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.access_groups) attrs.append("access_groups", prop.access_groups); + + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.alignment) attrs.append("alignment", prop.alignment); + + if (prop.bin_op) attrs.append("bin_op", prop.bin_op); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.ordering) attrs.append("ordering", prop.ordering); + + if (prop.syncscope) attrs.append("syncscope", prop.syncscope); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); + + if (prop.volatile_) attrs.append("volatile_", prop.volatile_); +} + +::mlir::LogicalResult AtomicRMWOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(attr, "access_groups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "alignment", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getBinOpAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(attr, "bin_op", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getOrderingAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "ordering", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "syncscope", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getVolatile_AttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "volatile_", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicRMWOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.bin_op))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.ordering))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.volatile_))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicRMWOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.access_groups); + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.alignment); + writer.writeAttribute(prop.bin_op); + + writer.writeOptionalAttribute(prop.noalias_scopes); + writer.writeAttribute(prop.ordering); + + writer.writeOptionalAttribute(prop.syncscope); + + writer.writeOptionalAttribute(prop.tbaa); + + writer.writeOptionalAttribute(prop.volatile_); +} + +::mlir::LLVM::AtomicBinOpAttr AtomicRMWOp::getBinOpAttr() { + return ::llvm::cast<::mlir::LLVM::AtomicBinOpAttr>(getProperties().bin_op); +} + +::mlir::LLVM::AtomicBinOp AtomicRMWOp::getBinOp() { + auto attr = getBinOpAttr(); + return attr.getValue(); +} + +::mlir::LLVM::AtomicOrderingAttr AtomicRMWOp::getOrderingAttr() { + return ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering); +} + +::mlir::LLVM::AtomicOrdering AtomicRMWOp::getOrdering() { + auto attr = getOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr AtomicRMWOp::getSyncscopeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); +} + +::std::optional< ::llvm::StringRef > AtomicRMWOp::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr AtomicRMWOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional AtomicRMWOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr AtomicRMWOp::getVolatile_Attr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_); +} + +bool AtomicRMWOp::getVolatile_() { + auto attr = getVolatile_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr AtomicRMWOp::getAccessGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); +} + +::std::optional< ::mlir::ArrayAttr > AtomicRMWOp::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicRMWOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > AtomicRMWOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicRMWOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > AtomicRMWOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr AtomicRMWOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > AtomicRMWOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void AtomicRMWOp::setBinOpAttr(::mlir::LLVM::AtomicBinOpAttr attr) { + (*this)->setAttr(getBinOpAttrName(), attr); +} + +void AtomicRMWOp::setBinOp(::mlir::LLVM::AtomicBinOp attrValue) { + (*this)->setAttr(getBinOpAttrName(), ::mlir::LLVM::AtomicBinOpAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AtomicRMWOp::setOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr) { + (*this)->setAttr(getOrderingAttrName(), attr); +} + +void AtomicRMWOp::setOrdering(::mlir::LLVM::AtomicOrdering attrValue) { + (*this)->setAttr(getOrderingAttrName(), ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AtomicRMWOp::setSyncscopeAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSyncscopeAttrName(), attr); +} + +void AtomicRMWOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSyncscopeAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSyncscopeAttrName()); +} + +void AtomicRMWOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void AtomicRMWOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +void AtomicRMWOp::setVolatile_Attr(::mlir::UnitAttr attr) { + (*this)->setAttr(getVolatile_AttrName(), attr); +} + +void AtomicRMWOp::setVolatile_(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getVolatile_AttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getVolatile_AttrName()); +} + +void AtomicRMWOp::setAccessGroupsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAccessGroupsAttrName(), attr); +} + +void AtomicRMWOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void AtomicRMWOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void AtomicRMWOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute AtomicRMWOp::removeSyncscopeAttr() { + auto &attr = getProperties().syncscope; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicRMWOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicRMWOp::removeVolatile_Attr() { + auto &attr = getProperties().volatile_; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicRMWOp::removeAccessGroupsAttr() { + auto &attr = getProperties().access_groups; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicRMWOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicRMWOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicRMWOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(val); + odsState.getOrAddProperties().bin_op = bin_op; + odsState.getOrAddProperties().ordering = ordering; + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(res); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(val); + odsState.getOrAddProperties().bin_op = bin_op; + odsState.getOrAddProperties().ordering = ordering; + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(val); + odsState.getOrAddProperties().bin_op = bin_op; + odsState.getOrAddProperties().ordering = ordering; + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(val); + odsState.getOrAddProperties().bin_op = ::mlir::LLVM::AtomicBinOpAttr::get(odsBuilder.getContext(), bin_op); + odsState.getOrAddProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(res); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(val); + odsState.getOrAddProperties().bin_op = ::mlir::LLVM::AtomicBinOpAttr::get(odsBuilder.getContext(), bin_op); + odsState.getOrAddProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(ptr); + odsState.addOperands(val); + odsState.getOrAddProperties().bin_op = ::mlir::LLVM::AtomicBinOpAttr::get(odsBuilder.getContext(), bin_op); + odsState.getOrAddProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AtomicRMWOp::verifyInvariantsImpl() { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_bin_op = getProperties().bin_op; (void)tblgen_bin_op; + if (!tblgen_bin_op) return emitOpError("requires attribute 'bin_op'"); + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering; + if (!tblgen_ordering) return emitOpError("requires attribute 'ordering'"); + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps9(*this, tblgen_bin_op, "bin_op"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_ordering, "ordering"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_syncscope, "syncscope"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_volatile_, "volatile_"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(*this, tblgen_access_groups, "access_groups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps8(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()((*this->getODSOperands(1).begin()).getType(), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result #0 and operand #1 have the same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicRMWOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult AtomicRMWOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[1].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AtomicRMWOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::LLVM::AtomicBinOpAttr bin_opAttr; + ::mlir::OpAsmParser::UnresolvedOperand ptrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(ptrRawOperands); ::llvm::SMLoc ptrOperandsLoc; + (void)ptrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(valRawOperands); ::llvm::SMLoc valOperandsLoc; + (void)valOperandsLoc; + ::mlir::StringAttr syncscopeAttr; + ::mlir::LLVM::AtomicOrderingAttr orderingAttr; + ::mlir::Type ptrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> ptrTypes(ptrRawTypes); + ::mlir::Type valRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes); + if (::mlir::succeeded(parser.parseOptionalKeyword("volatile"))) { + result.getOrAddProperties().volatile_ = parser.getBuilder().getUnitAttr(); } + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"xchg","add","sub","_and","nand","_or","_xor","max","min","umax","umin","fadd","fsub","fmax","fmin","uinc_wrap","udec_wrap"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "bin_op", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'bin_op' [xchg, add, sub, _and, nand, _or, _xor, max, min, umax, umin, fadd, fsub, fmax, fmin, uinc_wrap, udec_wrap]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::LLVM::symbolizeAtomicBinOp(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "bin_op attribute specification: \"" << attrStr << '"';; + + bin_opAttr = ::mlir::LLVM::AtomicBinOpAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().bin_op = bin_opAttr; + } + } + + ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ptrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (syncscopeAttr) result.getOrAddProperties().syncscope = syncscopeAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "ordering", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "ordering attribute specification: \"" << attrStr << '"';; + + orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().ordering = orderingAttr; + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(ptrRawTypes[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valRawTypes[0] = type; + } + for (::mlir::Type type : valTypes) { + (void)type; + if (!(((::mlir::LLVM::isCompatibleFloatingPointType(type))) || ((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) || ((::llvm::isa<::mlir::IntegerType>(type))))) { + return parser.emitError(parser.getNameLoc()) << "'val' must be floating point LLVM type or LLVM pointer type or integer, but got " << type; + } + } + result.addTypes(valTypes[0]); + if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicRMWOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getVolatile_Attr()) { + _odsPrinter << ' ' << "volatile"; + } + _odsPrinter << ' '; + + { + auto caseValue = getBinOp(); + auto caseValueStr = stringifyAtomicBinOp(caseValue); + _odsPrinter << caseValueStr; + } + _odsPrinter << ' '; + _odsPrinter << getPtr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getVal(); + if (getSyncscopeAttr()) { + _odsPrinter << ' ' << "syncscope"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getSyncscopeAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + + { + auto caseValue = getOrdering(); + auto caseValueStr = stringifyAtomicOrdering(caseValue); + _odsPrinter << caseValueStr; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("volatile_"); + elidedAttrs.push_back("bin_op"); + elidedAttrs.push_back("syncscope"); + elidedAttrs.push_back("ordering"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getVolatile_Attr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("volatile_"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getPtr().getType(); + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getVal().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AtomicRMWOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::BitcastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BitcastOpGenericAdaptorBase::BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.bitcast", odsAttrs.getContext()); +} + +BitcastOpGenericAdaptorBase::BitcastOpGenericAdaptorBase(BitcastOp op) : BitcastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BitcastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BitcastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BitcastOpAdaptor::BitcastOpAdaptor(BitcastOp op) : BitcastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BitcastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BitcastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BitcastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BitcastOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &BitcastOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair BitcastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BitcastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BitcastOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BitcastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BitcastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BitcastOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult BitcastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BitcastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BitcastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::BitcastOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::BrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BrOpGenericAdaptorBase::BrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.br", odsAttrs.getContext()); +} + +BrOpGenericAdaptorBase::BrOpGenericAdaptorBase(BrOp op) : BrOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr BrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::LoopAnnotationAttr BrOpGenericAdaptorBase::getLoopAnnotationAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::LoopAnnotationAttr>(getProperties().loop_annotation); + return attr; +} + +::std::optional<::mlir::LLVM::LoopAnnotationAttr> BrOpGenericAdaptorBase::getLoopAnnotation() { + auto attr = getLoopAnnotationAttr(); + return attr ? ::std::optional<::mlir::LLVM::LoopAnnotationAttr>(::llvm::cast<::mlir::LLVM::LoopAnnotationAttr>(attr)) : (::std::nullopt); +} + +} // namespace detail +BrOpAdaptor::BrOpAdaptor(BrOp op) : BrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BrOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_loop_annotation = getProperties().loop_annotation; (void)tblgen_loop_annotation; + + if (tblgen_loop_annotation && !((::llvm::isa<::mlir::LLVM::LoopAnnotationAttr>(tblgen_loop_annotation)))) + return emitError(loc, "'llvm.br' op ""attribute 'loop_annotation' failed to satisfy constraint: "); + return ::mlir::success(); +} + +std::pair BrOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range BrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range BrOp::getDestOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange BrOp::getDestOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair BrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *BrOp::getDest() { + return (*this)->getSuccessor(0); +} + +::mlir::LogicalResult BrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.loop_annotation; + auto attr = dict.get("loop_annotation"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for loop_annotation in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `loop_annotation` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute BrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.loop_annotation; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("loop_annotation", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BrOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.loop_annotation.getAsOpaquePointer())); +} + +std::optional BrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "loop_annotation") + return prop.loop_annotation; + return std::nullopt; +} + +void BrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "loop_annotation") { + prop.loop_annotation = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void BrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.loop_annotation) attrs.append("loop_annotation", prop.loop_annotation); +} + +::mlir::LogicalResult BrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLoopAnnotationAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(attr, "loop_annotation", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.loop_annotation))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.loop_annotation); +} + +::mlir::LLVM::LoopAnnotationAttr BrOp::getLoopAnnotationAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::LoopAnnotationAttr>(getProperties().loop_annotation); +} + +::std::optional<::mlir::LLVM::LoopAnnotationAttr> BrOp::getLoopAnnotation() { + auto attr = getLoopAnnotationAttr(); + return attr ? ::std::optional<::mlir::LLVM::LoopAnnotationAttr>(::llvm::cast<::mlir::LLVM::LoopAnnotationAttr>(attr)) : (::std::nullopt); +} + +void BrOp::setLoopAnnotationAttr(::mlir::LLVM::LoopAnnotationAttr attr) { + (*this)->setAttr(getLoopAnnotationAttrName(), attr); +} + +::mlir::Attribute BrOp::removeLoopAnnotationAttr() { + auto &attr = getProperties().loop_annotation; + attr = {}; + return attr; +} + +void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Block *dest) { + build(odsBuilder, odsState, ValueRange(), dest); + +} + +void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, Block *dest) { + build(odsBuilder, odsState, operands, /*loop_annotation=*/{}, dest); + +} + +void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, SuccessorRange destinations, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addSuccessors(destinations); + odsState.addAttributes(attributes); + +} + +void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest) { + odsState.addOperands(destOperands); + if (loop_annotation) { + odsState.getOrAddProperties().loop_annotation = loop_annotation; + } + odsState.addSuccessors(dest); +} + +void BrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest) { + odsState.addOperands(destOperands); + if (loop_annotation) { + odsState.getOrAddProperties().loop_annotation = loop_annotation; + } + odsState.addSuccessors(dest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BrOp::verifyInvariantsImpl() { + auto tblgen_loop_annotation = getProperties().loop_annotation; (void)tblgen_loop_annotation; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(*this, tblgen_loop_annotation, "loop_annotation"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult BrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Block *destSuccessor = nullptr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> destOperandsOperands; + ::llvm::SMLoc destOperandsOperandsLoc; + (void)destOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> destOperandsTypes; + + if (parser.parseSuccessor(destSuccessor)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + destOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(destOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(destOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addSuccessors(destSuccessor); + if (parser.resolveOperands(destOperandsOperands, destOperandsTypes, destOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getDest(); + if (!getDestOperands().empty()) { + _odsPrinter << "("; + _odsPrinter << getDestOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDestOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void BrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::BrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CallIntrinsicOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CallIntrinsicOpGenericAdaptorBase::CallIntrinsicOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.call_intrinsic", odsAttrs.getContext()); +} + +CallIntrinsicOpGenericAdaptorBase::CallIntrinsicOpGenericAdaptorBase(CallIntrinsicOp op) : CallIntrinsicOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CallIntrinsicOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CallIntrinsicOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr CallIntrinsicOpGenericAdaptorBase::getIntrinAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().intrin); + return attr; +} + +::llvm::StringRef CallIntrinsicOpGenericAdaptorBase::getIntrin() { + auto attr = getIntrinAttr(); + return attr.getValue(); +} + +::mlir::LLVM::FastmathFlagsAttr CallIntrinsicOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags CallIntrinsicOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +CallIntrinsicOpAdaptor::CallIntrinsicOpAdaptor(CallIntrinsicOp op) : CallIntrinsicOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CallIntrinsicOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + auto tblgen_intrin = getProperties().intrin; (void)tblgen_intrin; + if (!tblgen_intrin) return emitError(loc, "'llvm.call_intrinsic' op ""requires attribute 'intrin'"); + + if (tblgen_intrin && !((::llvm::isa<::mlir::StringAttr>(tblgen_intrin)))) + return emitError(loc, "'llvm.call_intrinsic' op ""attribute 'intrin' failed to satisfy constraint: string attribute"); + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.call_intrinsic' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair CallIntrinsicOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CallIntrinsicOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CallIntrinsicOp::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange CallIntrinsicOp::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CallIntrinsicOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CallIntrinsicOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CallIntrinsicOp::getResults() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult CallIntrinsicOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.intrin; + auto attr = dict.get("intrin"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for intrin in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `intrin` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CallIntrinsicOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + { + const auto &propStorage = prop.intrin; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("intrin", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CallIntrinsicOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()), + llvm::hash_value(prop.intrin.getAsOpaquePointer())); +} + +std::optional CallIntrinsicOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + + if (name == "intrin") + return prop.intrin; + return std::nullopt; +} + +void CallIntrinsicOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "intrin") { + prop.intrin = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CallIntrinsicOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); + + if (prop.intrin) attrs.append("intrin", prop.intrin); +} + +::mlir::LogicalResult CallIntrinsicOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIntrinAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "intrin", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CallIntrinsicOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.intrin))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CallIntrinsicOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); + writer.writeAttribute(prop.intrin); +} + +::mlir::StringAttr CallIntrinsicOp::getIntrinAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().intrin); +} + +::llvm::StringRef CallIntrinsicOp::getIntrin() { + auto attr = getIntrinAttr(); + return attr.getValue(); +} + +::mlir::LLVM::FastmathFlagsAttr CallIntrinsicOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags CallIntrinsicOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void CallIntrinsicOp::setIntrinAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getIntrinAttrName(), attr); +} + +void CallIntrinsicOp::setIntrin(::llvm::StringRef attrValue) { + (*this)->setAttr(getIntrinAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void CallIntrinsicOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void CallIntrinsicOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CallIntrinsicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type results, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(args); + odsState.getOrAddProperties().intrin = intrin; + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + if (results) + odsState.addTypes(results); +} + +void CallIntrinsicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(args); + odsState.getOrAddProperties().intrin = intrin; + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(resultTypes); +} + +void CallIntrinsicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type results, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(args); + odsState.getOrAddProperties().intrin = odsBuilder.getStringAttr(intrin); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + if (results) + odsState.addTypes(results); +} + +void CallIntrinsicOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(args); + odsState.getOrAddProperties().intrin = odsBuilder.getStringAttr(intrin); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(resultTypes); +} + +void CallIntrinsicOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +void CallIntrinsicOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult CallIntrinsicOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + auto tblgen_intrin = getProperties().intrin; (void)tblgen_intrin; + if (!tblgen_intrin) return emitOpError("requires attribute 'intrin'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_intrin, "intrin"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CallIntrinsicOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CallIntrinsicOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr intrinAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resultsTypes; + + if (parser.parseCustomAttributeWithFallback(intrinAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (intrinAttr) result.getOrAddProperties().intrin = intrinAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__results_functionType; + if (parser.parseType(args__results_functionType)) + return ::mlir::failure(); + argsTypes = args__results_functionType.getInputs(); + resultsTypes = args__results_functionType.getResults(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addTypes(resultsTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CallIntrinsicOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getIntrinAttr()); + _odsPrinter << "("; + _odsPrinter << getArgs(); + _odsPrinter << ")"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), (getResults() ? ::llvm::ArrayRef<::mlir::Type>(getResults().getType()) : ::llvm::ArrayRef<::mlir::Type>())); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("intrin"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathFlagsAttr(); + if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}))) + elidedAttrs.push_back("fastmathFlags"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CallIntrinsicOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CallOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.call", odsAttrs.getContext()); +} + +CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(CallOp op) : CallOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CallOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CallOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypeAttr CallOpGenericAdaptorBase::getCalleeTypeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().callee_type); + return attr; +} + +::std::optional<::mlir::LLVM::LLVMFunctionType> CallOpGenericAdaptorBase::getCalleeType() { + auto attr = getCalleeTypeAttr(); + return attr ? ::std::optional<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue())) : (::std::nullopt); +} + +::mlir::FlatSymbolRefAttr CallOpGenericAdaptorBase::getCalleeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().callee); + return attr; +} + +::std::optional< ::llvm::StringRef > CallOpGenericAdaptorBase::getCallee() { + auto attr = getCalleeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::LLVM::FastmathFlagsAttr CallOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags CallOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +::mlir::DenseI32ArrayAttr CallOpGenericAdaptorBase::getBranchWeightsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().branch_weights); + return attr; +} + +::std::optional<::llvm::ArrayRef> CallOpGenericAdaptorBase::getBranchWeights() { + auto attr = getBranchWeightsAttr(); + return attr ? ::std::optional<::llvm::ArrayRef>(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr CallOpGenericAdaptorBase::getAccessGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr CallOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr CallOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr CallOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +CallOpAdaptor::CallOpAdaptor(CallOp op) : CallOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CallOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; + auto tblgen_callee = getProperties().callee; (void)tblgen_callee; + auto tblgen_callee_type = getProperties().callee_type; (void)tblgen_callee_type; + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_callee_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_callee_type))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_callee_type).getValue()))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_callee_type).getValue()))))) + return emitError(loc, "'llvm.call' op ""attribute 'callee_type' failed to satisfy constraint: type attribute of LLVM function type"); + + if (tblgen_callee && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_callee)))) + return emitError(loc, "'llvm.call' op ""attribute 'callee' failed to satisfy constraint: flat symbol reference attribute"); + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.call' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + + if (tblgen_branch_weights && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_branch_weights)))) + return emitError(loc, "'llvm.call' op ""attribute 'branch_weights' failed to satisfy constraint: i32 dense array attribute"); + + if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError(loc, "'llvm.call' op ""attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array"); + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.call' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.call' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'llvm.call' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair CallOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CallOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CallOp::getCalleeOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange CallOp::getCalleeOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CallOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CallOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CallOp::getResult() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult CallOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.access_groups; + auto attr = dict.get("access_groups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for access_groups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `access_groups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.branch_weights; + auto attr = dict.get("branch_weights"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for branch_weights in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `branch_weights` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.callee; + auto attr = dict.get("callee"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for callee in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `callee` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.callee_type; + auto attr = dict.get("callee_type"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for callee_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `callee_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CallOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.access_groups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("access_groups", + propStorage)); + } + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.branch_weights; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("branch_weights", + propStorage)); + } + + { + const auto &propStorage = prop.callee; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("callee", + propStorage)); + } + + { + const auto &propStorage = prop.callee_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("callee_type", + propStorage)); + } + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CallOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.access_groups.getAsOpaquePointer()), + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.branch_weights.getAsOpaquePointer()), + llvm::hash_value(prop.callee.getAsOpaquePointer()), + llvm::hash_value(prop.callee_type.getAsOpaquePointer()), + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional CallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "access_groups") + return prop.access_groups; + + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "branch_weights") + return prop.branch_weights; + + if (name == "callee") + return prop.callee; + + if (name == "callee_type") + return prop.callee_type; + + if (name == "fastmathFlags") + return prop.fastmathFlags; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void CallOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "access_groups") { + prop.access_groups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "branch_weights") { + prop.branch_weights = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "callee") { + prop.callee = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "callee_type") { + prop.callee_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.access_groups) attrs.append("access_groups", prop.access_groups); + + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.branch_weights) attrs.append("branch_weights", prop.branch_weights); + + if (prop.callee) attrs.append("callee", prop.callee); + + if (prop.callee_type) attrs.append("callee_type", prop.callee_type); + + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult CallOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(attr, "access_groups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getBranchWeightsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(attr, "branch_weights", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps0(attr, "callee", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCalleeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(attr, "callee_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CallOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.branch_weights))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.callee))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.callee_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.access_groups); + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.branch_weights); + + writer.writeOptionalAttribute(prop.callee); + + writer.writeOptionalAttribute(prop.callee_type); + + writer.writeOptionalAttribute(prop.fastmathFlags); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::TypeAttr CallOp::getCalleeTypeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().callee_type); +} + +::std::optional<::mlir::LLVM::LLVMFunctionType> CallOp::getCalleeType() { + auto attr = getCalleeTypeAttr(); + return attr ? ::std::optional<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue())) : (::std::nullopt); +} + +::mlir::FlatSymbolRefAttr CallOp::getCalleeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().callee); +} + +::std::optional< ::llvm::StringRef > CallOp::getCallee() { + auto attr = getCalleeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::LLVM::FastmathFlagsAttr CallOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags CallOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +::mlir::DenseI32ArrayAttr CallOp::getBranchWeightsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().branch_weights); +} + +::std::optional<::llvm::ArrayRef> CallOp::getBranchWeights() { + auto attr = getBranchWeightsAttr(); + return attr ? ::std::optional<::llvm::ArrayRef>(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr CallOp::getAccessGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); +} + +::std::optional< ::mlir::ArrayAttr > CallOp::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr CallOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > CallOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr CallOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > CallOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr CallOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > CallOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void CallOp::setCalleeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getCalleeTypeAttrName(), attr); +} + +void CallOp::setCalleeType(::std::optional<::mlir::LLVM::LLVMFunctionType> attrValue) { + if (attrValue) + return (*this)->setAttr(getCalleeTypeAttrName(), ::mlir::TypeAttr::get(*attrValue)); + (*this)->removeAttr(getCalleeTypeAttrName()); +} + +void CallOp::setCalleeAttr(::mlir::FlatSymbolRefAttr attr) { + (*this)->setAttr(getCalleeAttrName(), attr); +} + +void CallOp::setCallee(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getCalleeAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getCalleeAttrName()); +} + +void CallOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void CallOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CallOp::setBranchWeightsAttr(::mlir::DenseI32ArrayAttr attr) { + (*this)->setAttr(getBranchWeightsAttrName(), attr); +} + +void CallOp::setBranchWeights(::std::optional<::llvm::ArrayRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getBranchWeightsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue)); + (*this)->removeAttr(getBranchWeightsAttrName()); +} + +void CallOp::setAccessGroupsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAccessGroupsAttrName(), attr); +} + +void CallOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void CallOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void CallOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute CallOp::removeCalleeTypeAttr() { + auto &attr = getProperties().callee_type; + attr = {}; + return attr; +} + +::mlir::Attribute CallOp::removeCalleeAttr() { + auto &attr = getProperties().callee; + attr = {}; + return attr; +} + +::mlir::Attribute CallOp::removeBranchWeightsAttr() { + auto &attr = getProperties().branch_weights; + attr = {}; + return attr; +} + +::mlir::Attribute CallOp::removeAccessGroupsAttr() { + auto &attr = getProperties().access_groups; + attr = {}; + return attr; +} + +::mlir::Attribute CallOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute CallOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute CallOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(callee_operands); + if (callee_type) { + odsState.getOrAddProperties().callee_type = callee_type; + } + if (callee) { + odsState.getOrAddProperties().callee = callee; + } + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + if (branch_weights) { + odsState.getOrAddProperties().branch_weights = branch_weights; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + if (result) + odsState.addTypes(result); +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(callee_operands); + if (callee_type) { + odsState.getOrAddProperties().callee_type = callee_type; + } + if (callee) { + odsState.getOrAddProperties().callee = callee; + } + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + if (branch_weights) { + odsState.getOrAddProperties().branch_weights = branch_weights; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(resultTypes); +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(callee_operands); + if (callee_type) { + odsState.getOrAddProperties().callee_type = callee_type; + } + if (callee) { + odsState.getOrAddProperties().callee = callee; + } + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + if (branch_weights) { + odsState.getOrAddProperties().branch_weights = branch_weights; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + if (result) + odsState.addTypes(result); +} + +void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(callee_operands); + if (callee_type) { + odsState.getOrAddProperties().callee_type = callee_type; + } + if (callee) { + odsState.getOrAddProperties().callee = callee; + } + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + if (branch_weights) { + odsState.getOrAddProperties().branch_weights = branch_weights; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(resultTypes); +} + +void CallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +void CallOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult CallOp::verifyInvariantsImpl() { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; + auto tblgen_callee = getProperties().callee; (void)tblgen_callee; + auto tblgen_callee_type = getProperties().callee_type; (void)tblgen_callee_type; + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(*this, tblgen_callee_type, "callee_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps0(*this, tblgen_callee, "callee"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(*this, tblgen_branch_weights, "branch_weights"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(*this, tblgen_access_groups, "access_groups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CallOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CallOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ComdatOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ComdatOpGenericAdaptorBase::ComdatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.comdat", odsAttrs.getContext()); +} + +ComdatOpGenericAdaptorBase::ComdatOpGenericAdaptorBase(ComdatOp op) : ComdatOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ComdatOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ComdatOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr ComdatOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef ComdatOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::Region &ComdatOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange ComdatOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ComdatOpAdaptor::ComdatOpAdaptor(ComdatOp op) : ComdatOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ComdatOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'llvm.comdat' op ""requires attribute 'sym_name'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'llvm.comdat' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair ComdatOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ComdatOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ComdatOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ComdatOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &ComdatOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult ComdatOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ComdatOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ComdatOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.sym_name.getAsOpaquePointer())); +} + +std::optional ComdatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "sym_name") + return prop.sym_name; + return std::nullopt; +} + +void ComdatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ComdatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); +} + +::mlir::LogicalResult ComdatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ComdatOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ComdatOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.sym_name); +} + +::mlir::StringAttr ComdatOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef ComdatOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +void ComdatOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void ComdatOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +::mlir::LogicalResult ComdatOp::verifyInvariantsImpl() { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LLVMOps0(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ComdatOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ComdatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + std::unique_ptr<::mlir::Region> bodyRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + + if (parser.parseRegion(*bodyRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(bodyRegion)); + return ::mlir::success(); +} + +void ComdatOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' '; + _odsPrinter.printRegion(getBody()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ComdatOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ComdatSelectorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ComdatSelectorOpGenericAdaptorBase::ComdatSelectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.comdat_selector", odsAttrs.getContext()); +} + +ComdatSelectorOpGenericAdaptorBase::ComdatSelectorOpGenericAdaptorBase(ComdatSelectorOp op) : ComdatSelectorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ComdatSelectorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ComdatSelectorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr ComdatSelectorOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef ComdatSelectorOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::LLVM::comdat::ComdatAttr ComdatSelectorOpGenericAdaptorBase::getComdatAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::comdat::ComdatAttr>(getProperties().comdat); + return attr; +} + +::mlir::LLVM::comdat::Comdat ComdatSelectorOpGenericAdaptorBase::getComdat() { + auto attr = getComdatAttr(); + return attr.getValue(); +} + +} // namespace detail +ComdatSelectorOpAdaptor::ComdatSelectorOpAdaptor(ComdatSelectorOp op) : ComdatSelectorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ComdatSelectorOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat; + if (!tblgen_comdat) return emitError(loc, "'llvm.comdat_selector' op ""requires attribute 'comdat'"); + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'llvm.comdat_selector' op ""requires attribute 'sym_name'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'llvm.comdat_selector' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_comdat && !((::llvm::isa<::mlir::LLVM::comdat::ComdatAttr>(tblgen_comdat)))) + return emitError(loc, "'llvm.comdat_selector' op ""attribute 'comdat' failed to satisfy constraint: LLVM Comdat Types"); + return ::mlir::success(); +} + +std::pair ComdatSelectorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ComdatSelectorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ComdatSelectorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ComdatSelectorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult ComdatSelectorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.comdat; + auto attr = dict.get("comdat"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for comdat in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `comdat` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ComdatSelectorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.comdat; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("comdat", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ComdatSelectorOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.comdat.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer())); +} + +std::optional ComdatSelectorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "comdat") + return prop.comdat; + + if (name == "sym_name") + return prop.sym_name; + return std::nullopt; +} + +void ComdatSelectorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "comdat") { + prop.comdat = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ComdatSelectorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.comdat) attrs.append("comdat", prop.comdat); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); +} + +::mlir::LogicalResult ComdatSelectorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getComdatAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps14(attr, "comdat", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ComdatSelectorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.comdat))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ComdatSelectorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.comdat); + writer.writeAttribute(prop.sym_name); +} + +::mlir::StringAttr ComdatSelectorOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef ComdatSelectorOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::LLVM::comdat::ComdatAttr ComdatSelectorOp::getComdatAttr() { + return ::llvm::cast<::mlir::LLVM::comdat::ComdatAttr>(getProperties().comdat); +} + +::mlir::LLVM::comdat::Comdat ComdatSelectorOp::getComdat() { + auto attr = getComdatAttr(); + return attr.getValue(); +} + +void ComdatSelectorOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void ComdatSelectorOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void ComdatSelectorOp::setComdatAttr(::mlir::LLVM::comdat::ComdatAttr attr) { + (*this)->setAttr(getComdatAttrName(), attr); +} + +void ComdatSelectorOp::setComdat(::mlir::LLVM::comdat::Comdat attrValue) { + (*this)->setAttr(getComdatAttrName(), ::mlir::LLVM::comdat::ComdatAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ComdatSelectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().comdat = comdat; +} + +void ComdatSelectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().comdat = comdat; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ComdatSelectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().comdat = ::mlir::LLVM::comdat::ComdatAttr::get(odsBuilder.getContext(), comdat); +} + +void ComdatSelectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().comdat = ::mlir::LLVM::comdat::ComdatAttr::get(odsBuilder.getContext(), comdat); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ComdatSelectorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ComdatSelectorOp::verifyInvariantsImpl() { + auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat; + if (!tblgen_comdat) return emitOpError("requires attribute 'comdat'"); + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps14(*this, tblgen_comdat, "comdat"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult ComdatSelectorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ComdatSelectorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + ::mlir::LLVM::comdat::ComdatAttr comdatAttr; + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"any","exactmatch","largest","nodeduplicate","samesize"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "comdat", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'comdat' [any, exactmatch, largest, nodeduplicate, samesize]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::LLVM::comdat::symbolizeComdat(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "comdat attribute specification: \"" << attrStr << '"';; + + comdatAttr = ::mlir::LLVM::comdat::ComdatAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().comdat = comdatAttr; + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ComdatSelectorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' '; + + { + auto caseValue = getComdat(); + auto caseValueStr = stringifyComdat(caseValue); + _odsPrinter << caseValueStr; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("comdat"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ComdatSelectorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CondBrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CondBrOpGenericAdaptorBase::CondBrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.cond_br", odsAttrs.getContext()); +} + +CondBrOpGenericAdaptorBase::CondBrOpGenericAdaptorBase(CondBrOp op) : CondBrOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CondBrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CondBrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI32ArrayAttr CondBrOpGenericAdaptorBase::getBranchWeightsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().branch_weights); + return attr; +} + +::std::optional<::llvm::ArrayRef> CondBrOpGenericAdaptorBase::getBranchWeights() { + auto attr = getBranchWeightsAttr(); + return attr ? ::std::optional<::llvm::ArrayRef>(attr) : (::std::nullopt); +} + +::mlir::LLVM::LoopAnnotationAttr CondBrOpGenericAdaptorBase::getLoopAnnotationAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::LoopAnnotationAttr>(getProperties().loop_annotation); + return attr; +} + +::std::optional<::mlir::LLVM::LoopAnnotationAttr> CondBrOpGenericAdaptorBase::getLoopAnnotation() { + auto attr = getLoopAnnotationAttr(); + return attr ? ::std::optional<::mlir::LLVM::LoopAnnotationAttr>(::llvm::cast<::mlir::LLVM::LoopAnnotationAttr>(attr)) : (::std::nullopt); +} + +} // namespace detail +CondBrOpAdaptor::CondBrOpAdaptor(CondBrOp op) : CondBrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CondBrOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; + auto tblgen_loop_annotation = getProperties().loop_annotation; (void)tblgen_loop_annotation; + + if (tblgen_branch_weights && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_branch_weights)))) + return emitError(loc, "'llvm.cond_br' op ""attribute 'branch_weights' failed to satisfy constraint: i32 dense array attribute"); + + if (tblgen_loop_annotation && !((::llvm::isa<::mlir::LLVM::LoopAnnotationAttr>(tblgen_loop_annotation)))) + return emitError(loc, "'llvm.cond_br' op ""attribute 'loop_annotation' failed to satisfy constraint: "); + return ::mlir::success(); +} + +std::pair CondBrOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CondBrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> CondBrOp::getCondition() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range CondBrOp::getTrueDestOperands() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range CondBrOp::getFalseDestOperands() { + return getODSOperands(2); +} + +::mlir::OpOperand &CondBrOp::getConditionMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CondBrOp::getTrueDestOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CondBrOp::getFalseDestOperandsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CondBrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CondBrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *CondBrOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *CondBrOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult CondBrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.branch_weights; + auto attr = dict.get("branch_weights"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for branch_weights in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `branch_weights` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.loop_annotation; + auto attr = dict.get("loop_annotation"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for loop_annotation in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `loop_annotation` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CondBrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.branch_weights; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("branch_weights", + propStorage)); + } + + { + const auto &propStorage = prop.loop_annotation; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("loop_annotation", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CondBrOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.branch_weights.getAsOpaquePointer()), + llvm::hash_value(prop.loop_annotation.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CondBrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "branch_weights") + return prop.branch_weights; + + if (name == "loop_annotation") + return prop.loop_annotation; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CondBrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "branch_weights") { + prop.branch_weights = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "loop_annotation") { + prop.loop_annotation = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CondBrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.branch_weights) attrs.append("branch_weights", prop.branch_weights); + + if (prop.loop_annotation) attrs.append("loop_annotation", prop.loop_annotation); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CondBrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBranchWeightsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(attr, "branch_weights", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLoopAnnotationAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(attr, "loop_annotation", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CondBrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.branch_weights))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.loop_annotation))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CondBrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.branch_weights); + + writer.writeOptionalAttribute(prop.loop_annotation); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseI32ArrayAttr CondBrOp::getBranchWeightsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().branch_weights); +} + +::std::optional<::llvm::ArrayRef> CondBrOp::getBranchWeights() { + auto attr = getBranchWeightsAttr(); + return attr ? ::std::optional<::llvm::ArrayRef>(attr) : (::std::nullopt); +} + +::mlir::LLVM::LoopAnnotationAttr CondBrOp::getLoopAnnotationAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::LoopAnnotationAttr>(getProperties().loop_annotation); +} + +::std::optional<::mlir::LLVM::LoopAnnotationAttr> CondBrOp::getLoopAnnotation() { + auto attr = getLoopAnnotationAttr(); + return attr ? ::std::optional<::mlir::LLVM::LoopAnnotationAttr>(::llvm::cast<::mlir::LLVM::LoopAnnotationAttr>(attr)) : (::std::nullopt); +} + +void CondBrOp::setBranchWeightsAttr(::mlir::DenseI32ArrayAttr attr) { + (*this)->setAttr(getBranchWeightsAttrName(), attr); +} + +void CondBrOp::setBranchWeights(::std::optional<::llvm::ArrayRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getBranchWeightsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue)); + (*this)->removeAttr(getBranchWeightsAttrName()); +} + +void CondBrOp::setLoopAnnotationAttr(::mlir::LLVM::LoopAnnotationAttr attr) { + (*this)->setAttr(getLoopAnnotationAttrName(), attr); +} + +::mlir::Attribute CondBrOp::removeBranchWeightsAttr() { + auto &attr = getProperties().branch_weights; + attr = {}; + return attr; +} + +::mlir::Attribute CondBrOp::removeLoopAnnotationAttr() { + auto &attr = getProperties().loop_annotation; + attr = {}; + return attr; +} + +void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Block *trueDest, Block *falseDest, ValueRange falseOperands) { + build(odsBuilder, odsState, condition, trueDest, ValueRange(), falseDest, + falseOperands); + +} + +void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, ValueRange trueOperands, ValueRange falseOperands, DenseI32ArrayAttr branchWeights, Block *trueDest, Block *falseDest) { + build(odsBuilder, odsState, condition, trueOperands, falseOperands, branchWeights, + {}, trueDest, falseDest); + +} + +void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, SuccessorRange destinations, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addSuccessors(destinations); + odsState.addAttributes(attributes); + +} + +void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(condition); + odsState.addOperands(trueDestOperands); + odsState.addOperands(falseDestOperands); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(trueDestOperands.size()), static_cast(falseDestOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (branch_weights) { + odsState.getOrAddProperties().branch_weights = branch_weights; + } + if (loop_annotation) { + odsState.getOrAddProperties().loop_annotation = loop_annotation; + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CondBrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(condition); + odsState.addOperands(trueDestOperands); + odsState.addOperands(falseDestOperands); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(trueDestOperands.size()), static_cast(falseDestOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (branch_weights) { + odsState.getOrAddProperties().branch_weights = branch_weights; + } + if (loop_annotation) { + odsState.getOrAddProperties().loop_annotation = loop_annotation; + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CondBrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CondBrOp::verifyInvariantsImpl() { + auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; + auto tblgen_loop_annotation = getProperties().loop_annotation; (void)tblgen_loop_annotation; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(*this, tblgen_branch_weights, "branch_weights"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps10(*this, tblgen_loop_annotation, "loop_annotation"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult CondBrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CondBrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand conditionRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(conditionRawOperands); ::llvm::SMLoc conditionOperandsLoc; + (void)conditionOperandsLoc; + ::mlir::DenseI32ArrayAttr branch_weightsAttr; + ::mlir::Block *trueDestSuccessor = nullptr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> trueDestOperandsOperands; + ::llvm::SMLoc trueDestOperandsOperandsLoc; + (void)trueDestOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> trueDestOperandsTypes; + ::mlir::Block *falseDestSuccessor = nullptr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> falseDestOperandsOperands; + ::llvm::SMLoc falseDestOperandsOperandsLoc; + (void)falseDestOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> falseDestOperandsTypes; + + conditionOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(conditionRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("weights"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(branch_weightsAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (branch_weightsAttr) result.getOrAddProperties().branch_weights = branch_weightsAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseSuccessor(trueDestSuccessor)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + trueDestOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(trueDestOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(trueDestOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseSuccessor(falseDestSuccessor)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + falseDestOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(falseDestOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(falseDestOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addSuccessors(trueDestSuccessor); + result.addSuccessors(falseDestSuccessor); +::llvm::copy(::llvm::ArrayRef({1, static_cast(trueDestOperandsOperands.size()), static_cast(falseDestOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(conditionOperands, odsBuildableType0, conditionOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(trueDestOperandsOperands, trueDestOperandsTypes, trueDestOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(falseDestOperandsOperands, falseDestOperandsTypes, falseDestOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CondBrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getCondition(); + if (getBranchWeightsAttr()) { + _odsPrinter << ' ' << "weights"; + _odsPrinter << "("; + _odsPrinter.printStrippedAttrOrType(getBranchWeightsAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTrueDest(); + if (!getTrueDestOperands().empty()) { + _odsPrinter << "("; + _odsPrinter << getTrueDestOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getTrueDestOperands().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getFalseDest(); + if (!getFalseDestOperands().empty()) { + _odsPrinter << "("; + _odsPrinter << getFalseDestOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getFalseDestOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("branch_weights"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void CondBrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CondBrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ConstantOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mlir.constant", odsAttrs.getContext()); +} + +ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(ConstantOp op) : ConstantOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ConstantOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ConstantOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Attribute ConstantOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::cast<::mlir::Attribute>(getProperties().value); + return attr; +} + +::mlir::Attribute ConstantOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr; +} + +} // namespace detail +ConstantOpAdaptor::ConstantOpAdaptor(ConstantOp op) : ConstantOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ConstantOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitError(loc, "'llvm.mlir.constant' op ""requires attribute 'value'"); + + if (tblgen_value && !((true))) + return emitError(loc, "'llvm.mlir.constant' op ""attribute 'value' failed to satisfy constraint: any attribute"); + return ::mlir::success(); +} + +std::pair ConstantOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ConstantOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ConstantOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ConstantOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ConstantOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ConstantOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ConstantOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional ConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void ConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult ConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps15(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.value); +} + +::mlir::Attribute ConstantOp::getValueAttr() { + return ::llvm::cast<::mlir::Attribute>(getProperties().value); +} + +::mlir::Attribute ConstantOp::getValue() { + auto attr = getValueAttr(); + return attr; +} + +void ConstantOp::setValueAttr(::mlir::Attribute attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, int64_t value) { + build(odsBuilder, odsState, type, odsBuilder.getIntegerAttr(type, value)); + +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, const APInt &value) { + build(odsBuilder, odsState, type, odsBuilder.getIntegerAttr(type, value)); + +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, const APFloat &value) { + build(odsBuilder, odsState, type, odsBuilder.getFloatAttr(type, value)); + +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypedAttr value) { + build(odsBuilder, odsState, value.getType(), value); + +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Attribute value) { + odsState.getOrAddProperties().value = value; + odsState.addTypes(res); +} + +void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) { + odsState.getOrAddProperties().value = value; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ConstantOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitOpError("requires attribute 'value'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps15(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ConstantOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ConstantOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Attribute valueAttr; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseAttribute(valueAttr, ::mlir::Type{})) + return ::mlir::failure(); + if (valueAttr) result.getOrAddProperties().value = valueAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ConstantOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter.printAttribute(getValueAttr()); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ConstantOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExtractElementOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExtractElementOpGenericAdaptorBase::ExtractElementOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.extractelement", odsAttrs.getContext()); +} + +ExtractElementOpGenericAdaptorBase::ExtractElementOpGenericAdaptorBase(ExtractElementOp op) : ExtractElementOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExtractElementOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExtractElementOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ExtractElementOpAdaptor::ExtractElementOpAdaptor(ExtractElementOp op) : ExtractElementOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExtractElementOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ExtractElementOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExtractElementOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtractElementOp::getVector() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ExtractElementOp::getPosition() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ExtractElementOp::getVectorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ExtractElementOp::getPositionMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExtractElementOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExtractElementOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtractElementOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ExtractElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value position) { + odsState.addOperands(vector); + odsState.addOperands(position); + odsState.addTypes(res); +} + +void ExtractElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value position) { + odsState.addOperands(vector); + odsState.addOperands(position); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExtractElementOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExtractElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value position) { + odsState.addOperands(vector); + odsState.addOperands(position); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtractElementOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ExtractElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExtractElementOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ExtractElementOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(LLVM::getVectorElementType((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result type matches vector element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult ExtractElementOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ExtractElementOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = LLVM::getVectorElementType(operands[0].getType()); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ExtractElementOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand vectorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(vectorRawOperands); ::llvm::SMLoc vectorOperandsLoc; + (void)vectorOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand positionRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> positionOperands(positionRawOperands); ::llvm::SMLoc positionOperandsLoc; + (void)positionOperandsLoc; + ::mlir::Type positionRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> positionTypes(positionRawTypes); + ::mlir::Type vectorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vectorTypes(vectorRawTypes); + + vectorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(vectorRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + positionOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(positionRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + positionRawTypes[0] = type; + } + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vectorRawTypes[0] = type; + } + for (::mlir::Type type : vectorTypes) { + (void)type; + if (!((::mlir::LLVM::isCompatibleVectorType(type)))) { + return parser.emitError(parser.getNameLoc()) << "'vector' must be LLVM dialect-compatible vector type, but got " << type; + } + } + result.addTypes(LLVM::getVectorElementType(vectorTypes[0])); + if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(positionOperands, positionTypes, positionOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtractElementOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getVector(); + _odsPrinter << "["; + _odsPrinter << getPosition(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getPosition().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVector().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExtractElementOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExtractElementOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExtractValueOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExtractValueOpGenericAdaptorBase::ExtractValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.extractvalue", odsAttrs.getContext()); +} + +ExtractValueOpGenericAdaptorBase::ExtractValueOpGenericAdaptorBase(ExtractValueOp op) : ExtractValueOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExtractValueOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExtractValueOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI64ArrayAttr ExtractValueOpGenericAdaptorBase::getPositionAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().position); + return attr; +} + +::llvm::ArrayRef ExtractValueOpGenericAdaptorBase::getPosition() { + auto attr = getPositionAttr(); + return attr; +} + +} // namespace detail +ExtractValueOpAdaptor::ExtractValueOpAdaptor(ExtractValueOp op) : ExtractValueOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExtractValueOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_position = getProperties().position; (void)tblgen_position; + if (!tblgen_position) return emitError(loc, "'llvm.extractvalue' op ""requires attribute 'position'"); + + if (tblgen_position && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_position)))) + return emitError(loc, "'llvm.extractvalue' op ""attribute 'position' failed to satisfy constraint: i64 dense array attribute"); + return ::mlir::success(); +} + +std::pair ExtractValueOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExtractValueOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtractValueOp::getContainer() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExtractValueOp::getContainerMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExtractValueOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExtractValueOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtractValueOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ExtractValueOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.position; + auto attr = dict.get("position"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for position in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `position` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ExtractValueOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.position; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("position", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExtractValueOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.position.getAsOpaquePointer())); +} + +std::optional ExtractValueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "position") + return prop.position; + return std::nullopt; +} + +void ExtractValueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "position") { + prop.position = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ExtractValueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.position) attrs.append("position", prop.position); +} + +::mlir::LogicalResult ExtractValueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPositionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps16(attr, "position", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtractValueOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.position))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtractValueOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.position); +} + +::mlir::DenseI64ArrayAttr ExtractValueOp::getPositionAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().position); +} + +::llvm::ArrayRef ExtractValueOp::getPosition() { + auto attr = getPositionAttr(); + return attr; +} + +void ExtractValueOp::setPositionAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getPositionAttrName(), attr); +} + +void ExtractValueOp::setPosition(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getPositionAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +void ExtractValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position) { + odsState.addOperands(container); + odsState.getOrAddProperties().position = position; + odsState.addTypes(res); +} + +void ExtractValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position) { + odsState.addOperands(container); + odsState.getOrAddProperties().position = position; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtractValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::llvm::ArrayRef position) { + odsState.addOperands(container); + odsState.getOrAddProperties().position = odsBuilder.getDenseI64ArrayAttr(position); + odsState.addTypes(res); +} + +void ExtractValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::llvm::ArrayRef position) { + odsState.addOperands(container); + odsState.getOrAddProperties().position = odsBuilder.getDenseI64ArrayAttr(position); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtractValueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ExtractValueOp::verifyInvariantsImpl() { + auto tblgen_position = getProperties().position; (void)tblgen_position; + if (!tblgen_position) return emitOpError("requires attribute 'position'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps16(*this, tblgen_position, "position"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps13(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtractValueOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ExtractValueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand containerRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> containerOperands(containerRawOperands); ::llvm::SMLoc containerOperandsLoc; + (void)containerOperandsLoc; + ::mlir::DenseI64ArrayAttr positionAttr; + ::mlir::Type containerRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> containerTypes(containerRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + containerOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(containerRawOperands[0])) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(positionAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (positionAttr) result.getOrAddProperties().position = positionAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + containerRawTypes[0] = type; + } + { + auto odsResult = parseInsertExtractValueElementType(parser, resRawTypes[0], containerRawTypes[0], positionAttr); + if (odsResult) return ::mlir::failure(); + } + result.addTypes(resTypes); + if (parser.resolveOperands(containerOperands, containerTypes, containerOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtractValueOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getContainer(); +_odsPrinter.printStrippedAttrOrType(getPositionAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("position"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getContainer().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' '; + printInsertExtractValueElementType(_odsPrinter, *this, getRes().getType(), getContainer().getType(), getPositionAttr()); +} + +void ExtractValueOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExtractValueOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FAddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FAddOpGenericAdaptorBase::FAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fadd", odsAttrs.getContext()); +} + +FAddOpGenericAdaptorBase::FAddOpGenericAdaptorBase(FAddOp op) : FAddOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FAddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FAddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FAddOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FAddOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FAddOpAdaptor::FAddOpAdaptor(FAddOp op) : FAddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FAddOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.fadd' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FAddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FAddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FAddOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FAddOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &FAddOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FAddOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair FAddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FAddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FAddOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FAddOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FAddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FAddOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FAddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FAddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FAddOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FAddOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FAddOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FAddOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FAddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FAddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FAddOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FAddOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FAddOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FAddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FAddOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FCmpOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FCmpOpGenericAdaptorBase::FCmpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fcmp", odsAttrs.getContext()); +} + +FCmpOpGenericAdaptorBase::FCmpOpGenericAdaptorBase(FCmpOp op) : FCmpOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FCmpOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FCmpOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FCmpPredicateAttr FCmpOpGenericAdaptorBase::getPredicateAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::FCmpPredicateAttr>(getProperties().predicate); + return attr; +} + +::mlir::LLVM::FCmpPredicate FCmpOpGenericAdaptorBase::getPredicate() { + auto attr = getPredicateAttr(); + return attr.getValue(); +} + +::mlir::LLVM::FastmathFlagsAttr FCmpOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FCmpOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FCmpOpAdaptor::FCmpOpAdaptor(FCmpOp op) : FCmpOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FCmpOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate; + if (!tblgen_predicate) return emitError(loc, "'llvm.fcmp' op ""requires attribute 'predicate'"); + + if (tblgen_predicate && !((::llvm::isa<::mlir::LLVM::FCmpPredicateAttr>(tblgen_predicate)))) + return emitError(loc, "'llvm.fcmp' op ""attribute 'predicate' failed to satisfy constraint: llvm.fcmp comparison predicate"); + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.fcmp' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FCmpOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FCmpOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FCmpOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FCmpOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &FCmpOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FCmpOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair FCmpOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FCmpOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FCmpOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FCmpOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.predicate; + auto attr = dict.get("predicate"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for predicate in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `predicate` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FCmpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + { + const auto &propStorage = prop.predicate; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("predicate", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FCmpOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer()), + llvm::hash_value(prop.predicate.getAsOpaquePointer())); +} + +std::optional FCmpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + + if (name == "predicate") + return prop.predicate; + return std::nullopt; +} + +void FCmpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "predicate") { + prop.predicate = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FCmpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); + + if (prop.predicate) attrs.append("predicate", prop.predicate); +} + +::mlir::LogicalResult FCmpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getPredicateAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(attr, "predicate", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FCmpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.predicate))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FCmpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); + writer.writeAttribute(prop.predicate); +} + +::mlir::LLVM::FCmpPredicateAttr FCmpOp::getPredicateAttr() { + return ::llvm::cast<::mlir::LLVM::FCmpPredicateAttr>(getProperties().predicate); +} + +::mlir::LLVM::FCmpPredicate FCmpOp::getPredicate() { + auto attr = getPredicateAttr(); + return attr.getValue(); +} + +::mlir::LLVM::FastmathFlagsAttr FCmpOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FCmpOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FCmpOp::setPredicateAttr(::mlir::LLVM::FCmpPredicateAttr attr) { + (*this)->setAttr(getPredicateAttrName(), attr); +} + +void FCmpOp::setPredicate(::mlir::LLVM::FCmpPredicate attrValue) { + (*this)->setAttr(getPredicateAttrName(), ::mlir::LLVM::FCmpPredicateAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FCmpOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FCmpOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FCmpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::LLVM::FCmpPredicateAttr::get(odsBuilder.getContext(), predicate); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::LLVM::FCmpPredicateAttr::get(odsBuilder.getContext(), predicate); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FCmpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::LLVM::FCmpPredicateAttr::get(odsBuilder.getContext(), predicate); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FCmpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FCmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FCmpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FCmpOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FCmpOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate; + if (!tblgen_predicate) return emitOpError("requires attribute 'predicate'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps17(*this, tblgen_predicate, "predicate"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps15(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::getI1SameShape((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result type has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult FCmpOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FCmpOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::getI1SameShape(operands[0].getType()); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +void FCmpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FCmpOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FDivOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FDivOpGenericAdaptorBase::FDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fdiv", odsAttrs.getContext()); +} + +FDivOpGenericAdaptorBase::FDivOpGenericAdaptorBase(FDivOp op) : FDivOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FDivOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FDivOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FDivOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FDivOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FDivOpAdaptor::FDivOpAdaptor(FDivOp op) : FDivOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FDivOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.fdiv' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FDivOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FDivOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FDivOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FDivOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &FDivOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FDivOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair FDivOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FDivOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FDivOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FDivOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FDivOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FDivOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FDivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FDivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FDivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FDivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FDivOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FDivOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FDivOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FDivOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FDivOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FDivOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FDivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FDivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FDivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FDivOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FDivOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FDivOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FDivOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FMulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FMulOpGenericAdaptorBase::FMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fmul", odsAttrs.getContext()); +} + +FMulOpGenericAdaptorBase::FMulOpGenericAdaptorBase(FMulOp op) : FMulOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FMulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FMulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FMulOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FMulOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FMulOpAdaptor::FMulOpAdaptor(FMulOp op) : FMulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FMulOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.fmul' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FMulOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FMulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FMulOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FMulOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &FMulOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FMulOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair FMulOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FMulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FMulOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FMulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FMulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FMulOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FMulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FMulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FMulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FMulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FMulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FMulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FMulOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FMulOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FMulOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FMulOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FMulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FMulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FMulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FMulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FMulOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FMulOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FMulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FMulOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FMulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FMulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FNegOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FNegOpGenericAdaptorBase::FNegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fneg", odsAttrs.getContext()); +} + +FNegOpGenericAdaptorBase::FNegOpGenericAdaptorBase(FNegOp op) : FNegOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FNegOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FNegOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FNegOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FNegOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FNegOpAdaptor::FNegOpAdaptor(FNegOp op) : FNegOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FNegOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.fneg' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FNegOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FNegOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FNegOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FNegOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FNegOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FNegOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FNegOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FNegOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FNegOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FNegOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FNegOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FNegOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FNegOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FNegOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FNegOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FNegOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FNegOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FNegOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FNegOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FNegOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(operand); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(operand); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FNegOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(operand); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FNegOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FNegOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FNegOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FNegOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FNegOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FNegOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FNegOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FNegOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FNegOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(operandOperands, resTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FNegOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FNegOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FNegOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FPExtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FPExtOpGenericAdaptorBase::FPExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fpext", odsAttrs.getContext()); +} + +FPExtOpGenericAdaptorBase::FPExtOpGenericAdaptorBase(FPExtOp op) : FPExtOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FPExtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FPExtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FPExtOpAdaptor::FPExtOpAdaptor(FPExtOp op) : FPExtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FPExtOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FPExtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FPExtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPExtOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FPExtOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FPExtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FPExtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPExtOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void FPExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FPExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FPExtOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FPExtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FPExtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FPExtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FPExtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FPToSIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FPToSIOpGenericAdaptorBase::FPToSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fptosi", odsAttrs.getContext()); +} + +FPToSIOpGenericAdaptorBase::FPToSIOpGenericAdaptorBase(FPToSIOp op) : FPToSIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FPToSIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FPToSIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FPToSIOpAdaptor::FPToSIOpAdaptor(FPToSIOp op) : FPToSIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FPToSIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FPToSIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FPToSIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPToSIOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FPToSIOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FPToSIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FPToSIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPToSIOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FPToSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FPToSIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FPToSIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FPToSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FPToSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FPToSIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPToSIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FPToUIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FPToUIOpGenericAdaptorBase::FPToUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fptoui", odsAttrs.getContext()); +} + +FPToUIOpGenericAdaptorBase::FPToUIOpGenericAdaptorBase(FPToUIOp op) : FPToUIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FPToUIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FPToUIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FPToUIOpAdaptor::FPToUIOpAdaptor(FPToUIOp op) : FPToUIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FPToUIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FPToUIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FPToUIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPToUIOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FPToUIOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FPToUIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FPToUIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPToUIOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FPToUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FPToUIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FPToUIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FPToUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FPToUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FPToUIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPToUIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FPTruncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FPTruncOpGenericAdaptorBase::FPTruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fptrunc", odsAttrs.getContext()); +} + +FPTruncOpGenericAdaptorBase::FPTruncOpGenericAdaptorBase(FPTruncOp op) : FPTruncOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FPTruncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FPTruncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FPTruncOpAdaptor::FPTruncOpAdaptor(FPTruncOp op) : FPTruncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FPTruncOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FPTruncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FPTruncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPTruncOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FPTruncOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FPTruncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FPTruncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPTruncOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void FPTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FPTruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FPTruncOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FPTruncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FPTruncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FPTruncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FPTruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPTruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FRemOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FRemOpGenericAdaptorBase::FRemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.frem", odsAttrs.getContext()); +} + +FRemOpGenericAdaptorBase::FRemOpGenericAdaptorBase(FRemOp op) : FRemOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FRemOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FRemOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FRemOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FRemOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FRemOpAdaptor::FRemOpAdaptor(FRemOp op) : FRemOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FRemOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.frem' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FRemOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FRemOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FRemOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FRemOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &FRemOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FRemOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair FRemOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FRemOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FRemOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FRemOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FRemOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FRemOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FRemOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FRemOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FRemOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FRemOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FRemOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FRemOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FRemOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FRemOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FRemOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FRemOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FRemOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FRemOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FRemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FRemOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FRemOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FRemOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FRemOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FRemOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FRemOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FRemOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FRemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FRemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FSubOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FSubOpGenericAdaptorBase::FSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fsub", odsAttrs.getContext()); +} + +FSubOpGenericAdaptorBase::FSubOpGenericAdaptorBase(FSubOp op) : FSubOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FSubOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FSubOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr FSubOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags FSubOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +FSubOpAdaptor::FSubOpAdaptor(FSubOp op) : FSubOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FSubOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.fsub' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair FSubOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FSubOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FSubOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FSubOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &FSubOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FSubOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair FSubOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FSubOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FSubOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FSubOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FSubOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FSubOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional FSubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void FSubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FSubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult FSubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FSubOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FSubOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr FSubOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags FSubOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void FSubOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void FSubOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FSubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FSubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FSubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FSubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FSubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FSubOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult FSubOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FSubOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FSubOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FSubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FSubOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FSubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FSubOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FenceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FenceOpGenericAdaptorBase::FenceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.fence", odsAttrs.getContext()); +} + +FenceOpGenericAdaptorBase::FenceOpGenericAdaptorBase(FenceOp op) : FenceOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FenceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FenceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::AtomicOrderingAttr FenceOpGenericAdaptorBase::getOrderingAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering); + return attr; +} + +::mlir::LLVM::AtomicOrdering FenceOpGenericAdaptorBase::getOrdering() { + auto attr = getOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr FenceOpGenericAdaptorBase::getSyncscopeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); + return attr; +} + +::std::optional< ::llvm::StringRef > FenceOpGenericAdaptorBase::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +FenceOpAdaptor::FenceOpAdaptor(FenceOp op) : FenceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FenceOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering; + if (!tblgen_ordering) return emitError(loc, "'llvm.fence' op ""requires attribute 'ordering'"); + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + + if (tblgen_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_ordering)))) + return emitError(loc, "'llvm.fence' op ""attribute 'ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model"); + + if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope)))) + return emitError(loc, "'llvm.fence' op ""attribute 'syncscope' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair FenceOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FenceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair FenceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FenceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult FenceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.ordering; + auto attr = dict.get("ordering"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for ordering in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `ordering` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.syncscope; + auto attr = dict.get("syncscope"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for syncscope in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `syncscope` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FenceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.ordering; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("ordering", + propStorage)); + } + + { + const auto &propStorage = prop.syncscope; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("syncscope", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FenceOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.ordering.getAsOpaquePointer()), + llvm::hash_value(prop.syncscope.getAsOpaquePointer())); +} + +std::optional FenceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "ordering") + return prop.ordering; + + if (name == "syncscope") + return prop.syncscope; + return std::nullopt; +} + +void FenceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "ordering") { + prop.ordering = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "syncscope") { + prop.syncscope = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FenceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.ordering) attrs.append("ordering", prop.ordering); + + if (prop.syncscope) attrs.append("syncscope", prop.syncscope); +} + +::mlir::LogicalResult FenceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getOrderingAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "ordering", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "syncscope", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FenceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.ordering))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FenceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.ordering); + + writer.writeOptionalAttribute(prop.syncscope); +} + +::mlir::LLVM::AtomicOrderingAttr FenceOp::getOrderingAttr() { + return ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering); +} + +::mlir::LLVM::AtomicOrdering FenceOp::getOrdering() { + auto attr = getOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr FenceOp::getSyncscopeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); +} + +::std::optional< ::llvm::StringRef > FenceOp::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void FenceOp::setOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr) { + (*this)->setAttr(getOrderingAttrName(), attr); +} + +void FenceOp::setOrdering(::mlir::LLVM::AtomicOrdering attrValue) { + (*this)->setAttr(getOrderingAttrName(), ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FenceOp::setSyncscopeAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSyncscopeAttrName(), attr); +} + +void FenceOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSyncscopeAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSyncscopeAttrName()); +} + +::mlir::Attribute FenceOp::removeSyncscopeAttr() { + auto &attr = getProperties().syncscope; + attr = {}; + return attr; +} + +void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + assert(isCompatibleType(resultType) && "result must be an LLVM type"); + assert(::llvm::isa(resultType) && + "for zero-result operands, only 'void' is accepted as result type"); + build(odsBuilder, odsState, operands, attributes); + +} + +void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope) { + odsState.getOrAddProperties().ordering = ordering; + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } +} + +void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope) { + odsState.getOrAddProperties().ordering = ordering; + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope) { + odsState.getOrAddProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } +} + +void FenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope) { + odsState.getOrAddProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FenceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FenceOp::verifyInvariantsImpl() { + auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering; + if (!tblgen_ordering) return emitOpError("requires attribute 'ordering'"); + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_ordering, "ordering"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_syncscope, "syncscope"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult FenceOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult FenceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr syncscopeAttr; + ::mlir::LLVM::AtomicOrderingAttr orderingAttr; + if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (syncscopeAttr) result.getOrAddProperties().syncscope = syncscopeAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "ordering", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "ordering attribute specification: \"" << attrStr << '"';; + + orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().ordering = orderingAttr; + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void FenceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getSyncscopeAttr()) { + _odsPrinter << ' ' << "syncscope"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getSyncscopeAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + + { + auto caseValue = getOrdering(); + auto caseValueStr = stringifyAtomicOrdering(caseValue); + _odsPrinter << caseValueStr; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("syncscope"); + elidedAttrs.push_back("ordering"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FenceOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FreezeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FreezeOpGenericAdaptorBase::FreezeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.freeze", odsAttrs.getContext()); +} + +FreezeOpGenericAdaptorBase::FreezeOpGenericAdaptorBase(FreezeOp op) : FreezeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FreezeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FreezeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FreezeOpAdaptor::FreezeOpAdaptor(FreezeOp op) : FreezeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FreezeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FreezeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FreezeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FreezeOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FreezeOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FreezeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FreezeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FreezeOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val) { + odsState.addOperands(val); + odsState.addTypes(res); +} + +void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val) { + odsState.addOperands(val); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FreezeOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val) { + odsState.addOperands(val); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FreezeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FreezeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FreezeOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult FreezeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FreezeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FreezeOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FreezeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(valRawOperands); ::llvm::SMLoc valOperandsLoc; + (void)valOperandsLoc; + ::mlir::Type valRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes); + + valOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valRawTypes[0] = type; + } + result.addTypes(valTypes[0]); + if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FreezeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getVal(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVal().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FreezeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FreezeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GEPOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GEPOpGenericAdaptorBase::GEPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.getelementptr", odsAttrs.getContext()); +} + +GEPOpGenericAdaptorBase::GEPOpGenericAdaptorBase(GEPOp op) : GEPOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GEPOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr GEPOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI32ArrayAttr GEPOpGenericAdaptorBase::getRawConstantIndicesAttr() { + auto attr = ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().rawConstantIndices); + return attr; +} + +::llvm::ArrayRef GEPOpGenericAdaptorBase::getRawConstantIndices() { + auto attr = getRawConstantIndicesAttr(); + return attr; +} + +::mlir::TypeAttr GEPOpGenericAdaptorBase::getElemTypeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().elem_type); + return attr; +} + +::std::optional<::mlir::Type> GEPOpGenericAdaptorBase::getElemType() { + auto attr = getElemTypeAttr(); + return attr ? ::std::optional<::mlir::Type>(::llvm::cast<::mlir::Type>(attr.getValue())) : (::std::nullopt); +} + +::mlir::UnitAttr GEPOpGenericAdaptorBase::getInboundsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inbounds); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool GEPOpGenericAdaptorBase::getInbounds() { + auto attr = getInboundsAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +GEPOpAdaptor::GEPOpAdaptor(GEPOp op) : GEPOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GEPOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_elem_type = getProperties().elem_type; (void)tblgen_elem_type; + auto tblgen_inbounds = getProperties().inbounds; (void)tblgen_inbounds; + auto tblgen_rawConstantIndices = getProperties().rawConstantIndices; (void)tblgen_rawConstantIndices; + if (!tblgen_rawConstantIndices) return emitError(loc, "'llvm.getelementptr' op ""requires attribute 'rawConstantIndices'"); + + if (tblgen_rawConstantIndices && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_rawConstantIndices)))) + return emitError(loc, "'llvm.getelementptr' op ""attribute 'rawConstantIndices' failed to satisfy constraint: i32 dense array attribute"); + + if (tblgen_elem_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_elem_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_elem_type).getValue()))) && ((true)))) + return emitError(loc, "'llvm.getelementptr' op ""attribute 'elem_type' failed to satisfy constraint: any type attribute"); + + if (tblgen_inbounds && !((::llvm::isa<::mlir::UnitAttr>(tblgen_inbounds)))) + return emitError(loc, "'llvm.getelementptr' op ""attribute 'inbounds' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair GEPOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range GEPOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GEPOp::getBase() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range GEPOp::getDynamicIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &GEPOp::getBaseMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange GEPOp::getDynamicIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair GEPOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GEPOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GEPOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GEPOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.elem_type; + auto attr = dict.get("elem_type"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for elem_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `elem_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.inbounds; + auto attr = dict.get("inbounds"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for inbounds in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `inbounds` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.rawConstantIndices; + auto attr = dict.get("rawConstantIndices"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for rawConstantIndices in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `rawConstantIndices` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GEPOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.elem_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("elem_type", + propStorage)); + } + + { + const auto &propStorage = prop.inbounds; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("inbounds", + propStorage)); + } + + { + const auto &propStorage = prop.rawConstantIndices; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("rawConstantIndices", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GEPOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.elem_type.getAsOpaquePointer()), + llvm::hash_value(prop.inbounds.getAsOpaquePointer()), + llvm::hash_value(prop.rawConstantIndices.getAsOpaquePointer())); +} + +std::optional GEPOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "elem_type") + return prop.elem_type; + + if (name == "inbounds") + return prop.inbounds; + + if (name == "rawConstantIndices") + return prop.rawConstantIndices; + return std::nullopt; +} + +void GEPOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "elem_type") { + prop.elem_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "inbounds") { + prop.inbounds = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "rawConstantIndices") { + prop.rawConstantIndices = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GEPOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.elem_type) attrs.append("elem_type", prop.elem_type); + + if (prop.inbounds) attrs.append("inbounds", prop.inbounds); + + if (prop.rawConstantIndices) attrs.append("rawConstantIndices", prop.rawConstantIndices); +} + +::mlir::LogicalResult GEPOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getElemTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(attr, "elem_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getInboundsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "inbounds", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getRawConstantIndicesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(attr, "rawConstantIndices", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GEPOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.elem_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.inbounds))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.rawConstantIndices))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GEPOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.elem_type); + + writer.writeOptionalAttribute(prop.inbounds); + writer.writeAttribute(prop.rawConstantIndices); +} + +::mlir::DenseI32ArrayAttr GEPOp::getRawConstantIndicesAttr() { + return ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().rawConstantIndices); +} + +::llvm::ArrayRef GEPOp::getRawConstantIndices() { + auto attr = getRawConstantIndicesAttr(); + return attr; +} + +::mlir::TypeAttr GEPOp::getElemTypeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().elem_type); +} + +::std::optional<::mlir::Type> GEPOp::getElemType() { + auto attr = getElemTypeAttr(); + return attr ? ::std::optional<::mlir::Type>(::llvm::cast<::mlir::Type>(attr.getValue())) : (::std::nullopt); +} + +::mlir::UnitAttr GEPOp::getInboundsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inbounds); +} + +bool GEPOp::getInbounds() { + auto attr = getInboundsAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void GEPOp::setRawConstantIndicesAttr(::mlir::DenseI32ArrayAttr attr) { + (*this)->setAttr(getRawConstantIndicesAttrName(), attr); +} + +void GEPOp::setRawConstantIndices(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getRawConstantIndicesAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue)); +} + +void GEPOp::setElemTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getElemTypeAttrName(), attr); +} + +void GEPOp::setElemType(::std::optional<::mlir::Type> attrValue) { + if (attrValue) + return (*this)->setAttr(getElemTypeAttrName(), ::mlir::TypeAttr::get(*attrValue)); + (*this)->removeAttr(getElemTypeAttrName()); +} + +void GEPOp::setInboundsAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getInboundsAttrName(), attr); +} + +void GEPOp::setInbounds(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getInboundsAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getInboundsAttrName()); +} + +::mlir::Attribute GEPOp::removeElemTypeAttr() { + auto &attr = getProperties().elem_type; + attr = {}; + return attr; +} + +::mlir::Attribute GEPOp::removeInboundsAttr() { + auto &attr = getProperties().inbounds; + attr = {}; + return attr; +} + +::mlir::LogicalResult GEPOp::verifyInvariantsImpl() { + auto tblgen_elem_type = getProperties().elem_type; (void)tblgen_elem_type; + auto tblgen_inbounds = getProperties().inbounds; (void)tblgen_inbounds; + auto tblgen_rawConstantIndices = getProperties().rawConstantIndices; (void)tblgen_rawConstantIndices; + if (!tblgen_rawConstantIndices) return emitOpError("requires attribute 'rawConstantIndices'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(*this, tblgen_rawConstantIndices, "rawConstantIndices"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(*this, tblgen_elem_type, "elem_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_inbounds, "inbounds"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GEPOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult GEPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand baseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(baseRawOperands); ::llvm::SMLoc baseOperandsLoc; + (void)baseOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dynamicIndicesOperands; + ::llvm::SMLoc dynamicIndicesOperandsLoc; + (void)dynamicIndicesOperandsLoc; + ::mlir::DenseI32ArrayAttr rawConstantIndicesAttr; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + ::mlir::TypeAttr elem_typeAttr; + if (::mlir::succeeded(parser.parseOptionalKeyword("inbounds"))) { + result.getOrAddProperties().inbounds = parser.getBuilder().getUnitAttr(); } + + baseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(baseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + { + dynamicIndicesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseGEPIndices(parser, dynamicIndicesOperands, rawConstantIndicesAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().rawConstantIndices = rawConstantIndicesAttr; + } + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + if (::mlir::succeeded(parser.parseOptionalComma())) { + + if (parser.parseCustomAttributeWithFallback(elem_typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (elem_typeAttr) result.getOrAddProperties().elem_type = elem_typeAttr; + } + result.addTypes(allResultTypes); + if (parser.resolveOperands(::llvm::concat(baseOperands, dynamicIndicesOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GEPOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getInboundsAttr()) { + _odsPrinter << ' ' << "inbounds"; + } + _odsPrinter << ' '; + _odsPrinter << getBase(); + _odsPrinter << "["; + printGEPIndices(_odsPrinter, *this, getDynamicIndices(), getRawConstantIndicesAttr()); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("inbounds"); + elidedAttrs.push_back("rawConstantIndices"); + elidedAttrs.push_back("elem_type"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getInboundsAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("inbounds"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); + if (getElemTypeAttr()) { + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getElemTypeAttr()); + } +} + +void GEPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::GEPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GlobalCtorsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalCtorsOpGenericAdaptorBase::GlobalCtorsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mlir.global_ctors", odsAttrs.getContext()); +} + +GlobalCtorsOpGenericAdaptorBase::GlobalCtorsOpGenericAdaptorBase(GlobalCtorsOp op) : GlobalCtorsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalCtorsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalCtorsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr GlobalCtorsOpGenericAdaptorBase::getCtorsAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().ctors); + return attr; +} + +::mlir::ArrayAttr GlobalCtorsOpGenericAdaptorBase::getCtors() { + auto attr = getCtorsAttr(); + return attr; +} + +::mlir::ArrayAttr GlobalCtorsOpGenericAdaptorBase::getPrioritiesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().priorities); + return attr; +} + +::mlir::ArrayAttr GlobalCtorsOpGenericAdaptorBase::getPriorities() { + auto attr = getPrioritiesAttr(); + return attr; +} + +} // namespace detail +GlobalCtorsOpAdaptor::GlobalCtorsOpAdaptor(GlobalCtorsOp op) : GlobalCtorsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalCtorsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_ctors = getProperties().ctors; (void)tblgen_ctors; + if (!tblgen_ctors) return emitError(loc, "'llvm.mlir.global_ctors' op ""requires attribute 'ctors'"); + auto tblgen_priorities = getProperties().priorities; (void)tblgen_priorities; + if (!tblgen_priorities) return emitError(loc, "'llvm.mlir.global_ctors' op ""requires attribute 'priorities'"); + + if (tblgen_ctors && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_ctors))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_ctors), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))); })))) + return emitError(loc, "'llvm.mlir.global_ctors' op ""attribute 'ctors' failed to satisfy constraint: flat symbol ref array attribute"); + + if (tblgen_priorities && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_priorities))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_priorities), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); })))) + return emitError(loc, "'llvm.mlir.global_ctors' op ""attribute 'priorities' failed to satisfy constraint: 32-bit integer array attribute"); + return ::mlir::success(); +} + +std::pair GlobalCtorsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalCtorsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalCtorsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalCtorsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult GlobalCtorsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.ctors; + auto attr = dict.get("ctors"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for ctors in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `ctors` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.priorities; + auto attr = dict.get("priorities"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for priorities in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `priorities` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalCtorsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.ctors; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("ctors", + propStorage)); + } + + { + const auto &propStorage = prop.priorities; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("priorities", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalCtorsOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.ctors.getAsOpaquePointer()), + llvm::hash_value(prop.priorities.getAsOpaquePointer())); +} + +std::optional GlobalCtorsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "ctors") + return prop.ctors; + + if (name == "priorities") + return prop.priorities; + return std::nullopt; +} + +void GlobalCtorsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "ctors") { + prop.ctors = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "priorities") { + prop.priorities = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalCtorsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.ctors) attrs.append("ctors", prop.ctors); + + if (prop.priorities) attrs.append("priorities", prop.priorities); +} + +::mlir::LogicalResult GlobalCtorsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCtorsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "ctors", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getPrioritiesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "priorities", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalCtorsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.ctors))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.priorities))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalCtorsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.ctors); + writer.writeAttribute(prop.priorities); +} + +::mlir::ArrayAttr GlobalCtorsOp::getCtorsAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().ctors); +} + +::mlir::ArrayAttr GlobalCtorsOp::getCtors() { + auto attr = getCtorsAttr(); + return attr; +} + +::mlir::ArrayAttr GlobalCtorsOp::getPrioritiesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().priorities); +} + +::mlir::ArrayAttr GlobalCtorsOp::getPriorities() { + auto attr = getPrioritiesAttr(); + return attr; +} + +void GlobalCtorsOp::setCtorsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getCtorsAttrName(), attr); +} + +void GlobalCtorsOp::setPrioritiesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getPrioritiesAttrName(), attr); +} + +void GlobalCtorsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities) { + odsState.getOrAddProperties().ctors = ctors; + odsState.getOrAddProperties().priorities = priorities; +} + +void GlobalCtorsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities) { + odsState.getOrAddProperties().ctors = ctors; + odsState.getOrAddProperties().priorities = priorities; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalCtorsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalCtorsOp::verifyInvariantsImpl() { + auto tblgen_ctors = getProperties().ctors; (void)tblgen_ctors; + if (!tblgen_ctors) return emitOpError("requires attribute 'ctors'"); + auto tblgen_priorities = getProperties().priorities; (void)tblgen_priorities; + if (!tblgen_priorities) return emitOpError("requires attribute 'priorities'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_ctors, "ctors"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_priorities, "priorities"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalCtorsOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult GlobalCtorsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void GlobalCtorsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::GlobalCtorsOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GlobalDtorsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalDtorsOpGenericAdaptorBase::GlobalDtorsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mlir.global_dtors", odsAttrs.getContext()); +} + +GlobalDtorsOpGenericAdaptorBase::GlobalDtorsOpGenericAdaptorBase(GlobalDtorsOp op) : GlobalDtorsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalDtorsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalDtorsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr GlobalDtorsOpGenericAdaptorBase::getDtorsAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().dtors); + return attr; +} + +::mlir::ArrayAttr GlobalDtorsOpGenericAdaptorBase::getDtors() { + auto attr = getDtorsAttr(); + return attr; +} + +::mlir::ArrayAttr GlobalDtorsOpGenericAdaptorBase::getPrioritiesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().priorities); + return attr; +} + +::mlir::ArrayAttr GlobalDtorsOpGenericAdaptorBase::getPriorities() { + auto attr = getPrioritiesAttr(); + return attr; +} + +} // namespace detail +GlobalDtorsOpAdaptor::GlobalDtorsOpAdaptor(GlobalDtorsOp op) : GlobalDtorsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalDtorsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dtors = getProperties().dtors; (void)tblgen_dtors; + if (!tblgen_dtors) return emitError(loc, "'llvm.mlir.global_dtors' op ""requires attribute 'dtors'"); + auto tblgen_priorities = getProperties().priorities; (void)tblgen_priorities; + if (!tblgen_priorities) return emitError(loc, "'llvm.mlir.global_dtors' op ""requires attribute 'priorities'"); + + if (tblgen_dtors && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_dtors))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_dtors), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))); })))) + return emitError(loc, "'llvm.mlir.global_dtors' op ""attribute 'dtors' failed to satisfy constraint: flat symbol ref array attribute"); + + if (tblgen_priorities && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_priorities))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_priorities), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))); })))) + return emitError(loc, "'llvm.mlir.global_dtors' op ""attribute 'priorities' failed to satisfy constraint: 32-bit integer array attribute"); + return ::mlir::success(); +} + +std::pair GlobalDtorsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalDtorsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalDtorsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalDtorsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult GlobalDtorsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dtors; + auto attr = dict.get("dtors"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dtors in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dtors` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.priorities; + auto attr = dict.get("priorities"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for priorities in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `priorities` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalDtorsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dtors; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dtors", + propStorage)); + } + + { + const auto &propStorage = prop.priorities; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("priorities", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalDtorsOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dtors.getAsOpaquePointer()), + llvm::hash_value(prop.priorities.getAsOpaquePointer())); +} + +std::optional GlobalDtorsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dtors") + return prop.dtors; + + if (name == "priorities") + return prop.priorities; + return std::nullopt; +} + +void GlobalDtorsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dtors") { + prop.dtors = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "priorities") { + prop.priorities = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalDtorsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dtors) attrs.append("dtors", prop.dtors); + + if (prop.priorities) attrs.append("priorities", prop.priorities); +} + +::mlir::LogicalResult GlobalDtorsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDtorsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(attr, "dtors", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getPrioritiesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(attr, "priorities", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalDtorsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dtors))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.priorities))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalDtorsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dtors); + writer.writeAttribute(prop.priorities); +} + +::mlir::ArrayAttr GlobalDtorsOp::getDtorsAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().dtors); +} + +::mlir::ArrayAttr GlobalDtorsOp::getDtors() { + auto attr = getDtorsAttr(); + return attr; +} + +::mlir::ArrayAttr GlobalDtorsOp::getPrioritiesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().priorities); +} + +::mlir::ArrayAttr GlobalDtorsOp::getPriorities() { + auto attr = getPrioritiesAttr(); + return attr; +} + +void GlobalDtorsOp::setDtorsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getDtorsAttrName(), attr); +} + +void GlobalDtorsOp::setPrioritiesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getPrioritiesAttrName(), attr); +} + +void GlobalDtorsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities) { + odsState.getOrAddProperties().dtors = dtors; + odsState.getOrAddProperties().priorities = priorities; +} + +void GlobalDtorsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities) { + odsState.getOrAddProperties().dtors = dtors; + odsState.getOrAddProperties().priorities = priorities; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalDtorsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalDtorsOp::verifyInvariantsImpl() { + auto tblgen_dtors = getProperties().dtors; (void)tblgen_dtors; + if (!tblgen_dtors) return emitOpError("requires attribute 'dtors'"); + auto tblgen_priorities = getProperties().priorities; (void)tblgen_priorities; + if (!tblgen_priorities) return emitOpError("requires attribute 'priorities'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps18(*this, tblgen_dtors, "dtors"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps19(*this, tblgen_priorities, "priorities"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalDtorsOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult GlobalDtorsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void GlobalDtorsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::GlobalDtorsOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GlobalOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalOpGenericAdaptorBase::GlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mlir.global", odsAttrs.getContext()); +} + +GlobalOpGenericAdaptorBase::GlobalOpGenericAdaptorBase(GlobalOp op) : GlobalOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypeAttr GlobalOpGenericAdaptorBase::getGlobalTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().global_type); + return attr; +} + +::mlir::Type GlobalOpGenericAdaptorBase::getGlobalType() { + auto attr = getGlobalTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::UnitAttr GlobalOpGenericAdaptorBase::getConstantAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().constant); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool GlobalOpGenericAdaptorBase::getConstant() { + auto attr = getConstantAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::StringAttr GlobalOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef GlobalOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::LLVM::LinkageAttr GlobalOpGenericAdaptorBase::getLinkageAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::LinkageAttr>(getProperties().linkage); + return attr; +} + +::mlir::LLVM::Linkage GlobalOpGenericAdaptorBase::getLinkage() { + auto attr = getLinkageAttr(); + return attr.getLinkage(); +} + +::mlir::UnitAttr GlobalOpGenericAdaptorBase::getDsoLocalAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().dso_local); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool GlobalOpGenericAdaptorBase::getDsoLocal() { + auto attr = getDsoLocalAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr GlobalOpGenericAdaptorBase::getThreadLocal_Attr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().thread_local_); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool GlobalOpGenericAdaptorBase::getThreadLocal_() { + auto attr = getThreadLocal_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Attribute GlobalOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().value); + return attr; +} + +::std::optional<::mlir::Attribute> GlobalOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +::mlir::IntegerAttr GlobalOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional GlobalOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr GlobalOpGenericAdaptorBase::getAddrSpaceAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().addr_space); + return attr; +} + +uint32_t GlobalOpGenericAdaptorBase::getAddrSpace() { + auto attr = getAddrSpaceAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::LLVM::UnnamedAddrAttr GlobalOpGenericAdaptorBase::getUnnamedAddrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::UnnamedAddrAttr>(getProperties().unnamed_addr); + return attr; +} + +::std::optional<::mlir::LLVM::UnnamedAddr> GlobalOpGenericAdaptorBase::getUnnamedAddr() { + auto attr = getUnnamedAddrAttr(); + return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt); +} + +::mlir::StringAttr GlobalOpGenericAdaptorBase::getSectionAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().section); + return attr; +} + +::std::optional< ::llvm::StringRef > GlobalOpGenericAdaptorBase::getSection() { + auto attr = getSectionAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::SymbolRefAttr GlobalOpGenericAdaptorBase::getComdatAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().comdat); + return attr; +} + +::std::optional< ::mlir::SymbolRefAttr > GlobalOpGenericAdaptorBase::getComdat() { + auto attr = getComdatAttr(); + return attr ? ::std::optional< ::mlir::SymbolRefAttr >(attr) : (::std::nullopt); +} + +::mlir::LLVM::VisibilityAttr GlobalOpGenericAdaptorBase::getVisibility_Attr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(getProperties().visibility_); + return attr; +} + +::mlir::LLVM::Visibility GlobalOpGenericAdaptorBase::getVisibility_() { + auto attr = getVisibility_Attr(); + return attr.getValue(); +} + +::mlir::Region &GlobalOpGenericAdaptorBase::getInitializer() { + return *odsRegions[0]; +} + +::mlir::RegionRange GlobalOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +GlobalOpAdaptor::GlobalOpAdaptor(GlobalOp op) : GlobalOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_addr_space = getProperties().addr_space; (void)tblgen_addr_space; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat; + auto tblgen_constant = getProperties().constant; (void)tblgen_constant; + auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local; + auto tblgen_global_type = getProperties().global_type; (void)tblgen_global_type; + if (!tblgen_global_type) return emitError(loc, "'llvm.mlir.global' op ""requires attribute 'global_type'"); + auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage; + if (!tblgen_linkage) return emitError(loc, "'llvm.mlir.global' op ""requires attribute 'linkage'"); + auto tblgen_section = getProperties().section; (void)tblgen_section; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'llvm.mlir.global' op ""requires attribute 'sym_name'"); + auto tblgen_thread_local_ = getProperties().thread_local_; (void)tblgen_thread_local_; + auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr; + auto tblgen_value = getProperties().value; (void)tblgen_value; + auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_; + + if (tblgen_global_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_global_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_global_type).getValue()))) && ((true)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'global_type' failed to satisfy constraint: any type attribute"); + + if (tblgen_constant && !((::llvm::isa<::mlir::UnitAttr>(tblgen_constant)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'constant' failed to satisfy constraint: unit attribute"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_linkage && !((::llvm::isa<::mlir::LLVM::LinkageAttr>(tblgen_linkage)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'linkage' failed to satisfy constraint: LLVM Linkage specification"); + + if (tblgen_dso_local && !((::llvm::isa<::mlir::UnitAttr>(tblgen_dso_local)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'dso_local' failed to satisfy constraint: unit attribute"); + + if (tblgen_thread_local_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_thread_local_)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'thread_local_' failed to satisfy constraint: unit attribute"); + + if (tblgen_value && !((true))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'value' failed to satisfy constraint: any attribute"); + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_addr_space && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_addr_space))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_addr_space).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_addr_space).getValue().isNegative())))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'addr_space' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"); + + if (tblgen_unnamed_addr && !((::llvm::isa<::mlir::LLVM::UnnamedAddrAttr>(tblgen_unnamed_addr)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'unnamed_addr' failed to satisfy constraint: LLVM GlobalValue UnnamedAddr"); + + if (tblgen_section && !((::llvm::isa<::mlir::StringAttr>(tblgen_section)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'section' failed to satisfy constraint: string attribute"); + + if (tblgen_comdat && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_comdat)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'comdat' failed to satisfy constraint: symbol reference attribute"); + + if (tblgen_visibility_ && !((::llvm::isa<::mlir::LLVM::VisibilityAttr>(tblgen_visibility_)))) + return emitError(loc, "'llvm.mlir.global' op ""attribute 'visibility_' failed to satisfy constraint: LLVM GlobalValue Visibility"); + return ::mlir::success(); +} + +std::pair GlobalOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &GlobalOp::getInitializer() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult GlobalOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.addr_space; + auto attr = dict.get("addr_space"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for addr_space in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `addr_space` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.comdat; + auto attr = dict.get("comdat"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for comdat in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `comdat` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.constant; + auto attr = dict.get("constant"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for constant in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `constant` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.dso_local; + auto attr = dict.get("dso_local"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dso_local in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dso_local` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.global_type; + auto attr = dict.get("global_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for global_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `global_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.linkage; + auto attr = dict.get("linkage"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for linkage in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `linkage` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.section; + auto attr = dict.get("section"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for section in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `section` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.thread_local_; + auto attr = dict.get("thread_local_"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for thread_local_ in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `thread_local_` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.unnamed_addr; + auto attr = dict.get("unnamed_addr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for unnamed_addr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `unnamed_addr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.visibility_; + auto attr = dict.get("visibility_"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for visibility_ in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `visibility_` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.addr_space; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("addr_space", + propStorage)); + } + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.comdat; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("comdat", + propStorage)); + } + + { + const auto &propStorage = prop.constant; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("constant", + propStorage)); + } + + { + const auto &propStorage = prop.dso_local; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dso_local", + propStorage)); + } + + { + const auto &propStorage = prop.global_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("global_type", + propStorage)); + } + + { + const auto &propStorage = prop.linkage; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("linkage", + propStorage)); + } + + { + const auto &propStorage = prop.section; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("section", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.thread_local_; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("thread_local_", + propStorage)); + } + + { + const auto &propStorage = prop.unnamed_addr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("unnamed_addr", + propStorage)); + } + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + { + const auto &propStorage = prop.visibility_; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("visibility_", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.addr_space.getAsOpaquePointer()), + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + llvm::hash_value(prop.comdat.getAsOpaquePointer()), + llvm::hash_value(prop.constant.getAsOpaquePointer()), + llvm::hash_value(prop.dso_local.getAsOpaquePointer()), + llvm::hash_value(prop.global_type.getAsOpaquePointer()), + llvm::hash_value(prop.linkage.getAsOpaquePointer()), + llvm::hash_value(prop.section.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.thread_local_.getAsOpaquePointer()), + llvm::hash_value(prop.unnamed_addr.getAsOpaquePointer()), + llvm::hash_value(prop.value.getAsOpaquePointer()), + llvm::hash_value(prop.visibility_.getAsOpaquePointer())); +} + +std::optional GlobalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "addr_space") + return prop.addr_space; + + if (name == "alignment") + return prop.alignment; + + if (name == "comdat") + return prop.comdat; + + if (name == "constant") + return prop.constant; + + if (name == "dso_local") + return prop.dso_local; + + if (name == "global_type") + return prop.global_type; + + if (name == "linkage") + return prop.linkage; + + if (name == "section") + return prop.section; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "thread_local_") + return prop.thread_local_; + + if (name == "unnamed_addr") + return prop.unnamed_addr; + + if (name == "value") + return prop.value; + + if (name == "visibility_") + return prop.visibility_; + return std::nullopt; +} + +void GlobalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "addr_space") { + prop.addr_space = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "comdat") { + prop.comdat = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "constant") { + prop.constant = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "dso_local") { + prop.dso_local = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "global_type") { + prop.global_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "linkage") { + prop.linkage = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "section") { + prop.section = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "thread_local_") { + prop.thread_local_ = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "unnamed_addr") { + prop.unnamed_addr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "visibility_") { + prop.visibility_ = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.addr_space) attrs.append("addr_space", prop.addr_space); + + if (prop.alignment) attrs.append("alignment", prop.alignment); + + if (prop.comdat) attrs.append("comdat", prop.comdat); + + if (prop.constant) attrs.append("constant", prop.constant); + + if (prop.dso_local) attrs.append("dso_local", prop.dso_local); + + if (prop.global_type) attrs.append("global_type", prop.global_type); + + if (prop.linkage) attrs.append("linkage", prop.linkage); + + if (prop.section) attrs.append("section", prop.section); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.thread_local_) attrs.append("thread_local_", prop.thread_local_); + + if (prop.unnamed_addr) attrs.append("unnamed_addr", prop.unnamed_addr); + + if (prop.value) attrs.append("value", prop.value); + + if (prop.visibility_) attrs.append("visibility_", prop.visibility_); +} + +::mlir::LogicalResult GlobalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAddrSpaceAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps21(attr, "addr_space", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "alignment", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getComdatAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps23(attr, "comdat", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getConstantAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "constant", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getDsoLocalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "dso_local", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getGlobalTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(attr, "global_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLinkageAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "linkage", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSectionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "section", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getThreadLocal_AttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "thread_local_", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUnnamedAddrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(attr, "unnamed_addr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps15(attr, "value", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getVisibility_AttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps24(attr, "visibility_", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.addr_space))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.comdat))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.constant))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.dso_local))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.global_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.linkage))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.section))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.thread_local_))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.unnamed_addr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.value))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.visibility_))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.addr_space); + + writer.writeOptionalAttribute(prop.alignment); + + writer.writeOptionalAttribute(prop.comdat); + + writer.writeOptionalAttribute(prop.constant); + + writer.writeOptionalAttribute(prop.dso_local); + writer.writeAttribute(prop.global_type); + writer.writeAttribute(prop.linkage); + + writer.writeOptionalAttribute(prop.section); + writer.writeAttribute(prop.sym_name); + + writer.writeOptionalAttribute(prop.thread_local_); + + writer.writeOptionalAttribute(prop.unnamed_addr); + + writer.writeOptionalAttribute(prop.value); + + writer.writeOptionalAttribute(prop.visibility_); +} + +::mlir::TypeAttr GlobalOp::getGlobalTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().global_type); +} + +::mlir::Type GlobalOp::getGlobalType() { + auto attr = getGlobalTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::UnitAttr GlobalOp::getConstantAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().constant); +} + +bool GlobalOp::getConstant() { + auto attr = getConstantAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::StringAttr GlobalOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef GlobalOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::LLVM::LinkageAttr GlobalOp::getLinkageAttr() { + return ::llvm::cast<::mlir::LLVM::LinkageAttr>(getProperties().linkage); +} + +::mlir::LLVM::Linkage GlobalOp::getLinkage() { + auto attr = getLinkageAttr(); + return attr.getLinkage(); +} + +::mlir::UnitAttr GlobalOp::getDsoLocalAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().dso_local); +} + +bool GlobalOp::getDsoLocal() { + auto attr = getDsoLocalAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr GlobalOp::getThreadLocal_Attr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().thread_local_); +} + +bool GlobalOp::getThreadLocal_() { + auto attr = getThreadLocal_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Attribute GlobalOp::getValueAttr() { + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().value); +} + +::std::optional<::mlir::Attribute> GlobalOp::getValue() { + auto attr = getValueAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +::mlir::IntegerAttr GlobalOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional GlobalOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr GlobalOp::getAddrSpaceAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().addr_space); +} + +uint32_t GlobalOp::getAddrSpace() { + auto attr = getAddrSpaceAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::LLVM::UnnamedAddrAttr GlobalOp::getUnnamedAddrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::UnnamedAddrAttr>(getProperties().unnamed_addr); +} + +::std::optional<::mlir::LLVM::UnnamedAddr> GlobalOp::getUnnamedAddr() { + auto attr = getUnnamedAddrAttr(); + return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt); +} + +::mlir::StringAttr GlobalOp::getSectionAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().section); +} + +::std::optional< ::llvm::StringRef > GlobalOp::getSection() { + auto attr = getSectionAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::SymbolRefAttr GlobalOp::getComdatAttr() { + return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().comdat); +} + +::std::optional< ::mlir::SymbolRefAttr > GlobalOp::getComdat() { + auto attr = getComdatAttr(); + return attr ? ::std::optional< ::mlir::SymbolRefAttr >(attr) : (::std::nullopt); +} + +::mlir::LLVM::VisibilityAttr GlobalOp::getVisibility_Attr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(getProperties().visibility_); +} + +::mlir::LLVM::Visibility GlobalOp::getVisibility_() { + auto attr = getVisibility_Attr(); + return attr.getValue(); +} + +void GlobalOp::setGlobalTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getGlobalTypeAttrName(), attr); +} + +void GlobalOp::setGlobalType(::mlir::Type attrValue) { + (*this)->setAttr(getGlobalTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void GlobalOp::setConstantAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getConstantAttrName(), attr); +} + +void GlobalOp::setConstant(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getConstantAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getConstantAttrName()); +} + +void GlobalOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void GlobalOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void GlobalOp::setLinkageAttr(::mlir::LLVM::LinkageAttr attr) { + (*this)->setAttr(getLinkageAttrName(), attr); +} + +void GlobalOp::setLinkage(::mlir::LLVM::Linkage attrValue) { + (*this)->setAttr(getLinkageAttrName(), ::mlir::LLVM::LinkageAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void GlobalOp::setDsoLocalAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getDsoLocalAttrName(), attr); +} + +void GlobalOp::setDsoLocal(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getDsoLocalAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getDsoLocalAttrName()); +} + +void GlobalOp::setThreadLocal_Attr(::mlir::UnitAttr attr) { + (*this)->setAttr(getThreadLocal_AttrName(), attr); +} + +void GlobalOp::setThreadLocal_(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getThreadLocal_AttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getThreadLocal_AttrName()); +} + +void GlobalOp::setValueAttr(::mlir::Attribute attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void GlobalOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void GlobalOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +void GlobalOp::setAddrSpaceAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAddrSpaceAttrName(), attr); +} + +void GlobalOp::setAddrSpace(uint32_t attrValue) { + (*this)->setAttr(getAddrSpaceAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void GlobalOp::setUnnamedAddrAttr(::mlir::LLVM::UnnamedAddrAttr attr) { + (*this)->setAttr(getUnnamedAddrAttrName(), attr); +} + +void GlobalOp::setUnnamedAddr(::std::optional<::mlir::LLVM::UnnamedAddr> attrValue) { + if (attrValue) + return (*this)->setAttr(getUnnamedAddrAttrName(), ::mlir::LLVM::UnnamedAddrAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getUnnamedAddrAttrName()); +} + +void GlobalOp::setSectionAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSectionAttrName(), attr); +} + +void GlobalOp::setSection(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSectionAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSectionAttrName()); +} + +void GlobalOp::setComdatAttr(::mlir::SymbolRefAttr attr) { + (*this)->setAttr(getComdatAttrName(), attr); +} + +void GlobalOp::setVisibility_Attr(::mlir::LLVM::VisibilityAttr attr) { + (*this)->setAttr(getVisibility_AttrName(), attr); +} + +void GlobalOp::setVisibility_(::mlir::LLVM::Visibility attrValue) { + (*this)->setAttr(getVisibility_AttrName(), ::mlir::LLVM::VisibilityAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +::mlir::Attribute GlobalOp::removeConstantAttr() { + auto &attr = getProperties().constant; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeDsoLocalAttr() { + auto &attr = getProperties().dso_local; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeThreadLocal_Attr() { + auto &attr = getProperties().thread_local_; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeValueAttr() { + auto &attr = getProperties().value; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeUnnamedAddrAttr() { + auto &attr = getProperties().unnamed_addr; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeSectionAttr() { + auto &attr = getProperties().section; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeComdatAttr() { + auto &attr = getProperties().comdat; + attr = {}; + return attr; +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, ::mlir::LLVM::VisibilityAttr visibility_) { + odsState.getOrAddProperties().global_type = global_type; + if (constant) { + odsState.getOrAddProperties().constant = constant; + } + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().linkage = linkage; + if (dso_local) { + odsState.getOrAddProperties().dso_local = dso_local; + } + if (thread_local_) { + odsState.getOrAddProperties().thread_local_ = thread_local_; + } + if (value) { + odsState.getOrAddProperties().value = value; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (addr_space) { + odsState.getOrAddProperties().addr_space = addr_space; + } + if (unnamed_addr) { + odsState.getOrAddProperties().unnamed_addr = unnamed_addr; + } + if (section) { + odsState.getOrAddProperties().section = section; + } + if (comdat) { + odsState.getOrAddProperties().comdat = comdat; + } + if (visibility_) { + odsState.getOrAddProperties().visibility_ = visibility_; + } + (void)odsState.addRegion(); +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, ::mlir::LLVM::VisibilityAttr visibility_) { + odsState.getOrAddProperties().global_type = global_type; + if (constant) { + odsState.getOrAddProperties().constant = constant; + } + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().linkage = linkage; + if (dso_local) { + odsState.getOrAddProperties().dso_local = dso_local; + } + if (thread_local_) { + odsState.getOrAddProperties().thread_local_ = thread_local_; + } + if (value) { + odsState.getOrAddProperties().value = value; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (addr_space) { + odsState.getOrAddProperties().addr_space = addr_space; + } + if (unnamed_addr) { + odsState.getOrAddProperties().unnamed_addr = unnamed_addr; + } + if (section) { + odsState.getOrAddProperties().section = section; + } + if (comdat) { + odsState.getOrAddProperties().comdat = comdat; + } + if (visibility_) { + odsState.getOrAddProperties().visibility_ = visibility_; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, ::mlir::LLVM::Visibility visibility_) { + odsState.getOrAddProperties().global_type = ::mlir::TypeAttr::get(global_type); + if (constant) { + odsState.getOrAddProperties().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), linkage); + if (dso_local) { + odsState.getOrAddProperties().dso_local = ((dso_local) ? odsBuilder.getUnitAttr() : nullptr); + } + if (thread_local_) { + odsState.getOrAddProperties().thread_local_ = ((thread_local_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (value) { + odsState.getOrAddProperties().value = value; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + odsState.getOrAddProperties().addr_space = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), addr_space); + if (unnamed_addr) { + odsState.getOrAddProperties().unnamed_addr = unnamed_addr; + } + if (section) { + odsState.getOrAddProperties().section = section; + } + if (comdat) { + odsState.getOrAddProperties().comdat = comdat; + } + odsState.getOrAddProperties().visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), visibility_); + (void)odsState.addRegion(); +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, ::mlir::LLVM::Visibility visibility_) { + odsState.getOrAddProperties().global_type = ::mlir::TypeAttr::get(global_type); + if (constant) { + odsState.getOrAddProperties().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), linkage); + if (dso_local) { + odsState.getOrAddProperties().dso_local = ((dso_local) ? odsBuilder.getUnitAttr() : nullptr); + } + if (thread_local_) { + odsState.getOrAddProperties().thread_local_ = ((thread_local_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (value) { + odsState.getOrAddProperties().value = value; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + odsState.getOrAddProperties().addr_space = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), addr_space); + if (unnamed_addr) { + odsState.getOrAddProperties().unnamed_addr = unnamed_addr; + } + if (section) { + odsState.getOrAddProperties().section = section; + } + if (comdat) { + odsState.getOrAddProperties().comdat = comdat; + } + odsState.getOrAddProperties().visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), visibility_); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void GlobalOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.addr_space) + properties.addr_space = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0); + if (!properties.visibility_) + properties.visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), mlir::LLVM::Visibility::Default); +} + +::mlir::LogicalResult GlobalOp::verifyInvariantsImpl() { + auto tblgen_addr_space = getProperties().addr_space; (void)tblgen_addr_space; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat; + auto tblgen_constant = getProperties().constant; (void)tblgen_constant; + auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local; + auto tblgen_global_type = getProperties().global_type; (void)tblgen_global_type; + if (!tblgen_global_type) return emitOpError("requires attribute 'global_type'"); + auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage; + if (!tblgen_linkage) return emitOpError("requires attribute 'linkage'"); + auto tblgen_section = getProperties().section; (void)tblgen_section; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_thread_local_ = getProperties().thread_local_; (void)tblgen_thread_local_; + auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr; + auto tblgen_value = getProperties().value; (void)tblgen_value; + auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps2(*this, tblgen_global_type, "global_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_constant, "constant"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_linkage, "linkage"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_dso_local, "dso_local"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_thread_local_, "thread_local_"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps15(*this, tblgen_value, "value"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps21(*this, tblgen_addr_space, "addr_space"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(*this, tblgen_unnamed_addr, "unnamed_addr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_section, "section"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps23(*this, tblgen_comdat, "comdat"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps24(*this, tblgen_visibility_, "visibility_"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LLVMOps1(*this, region, "initializer", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::GlobalOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ICmpOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ICmpOpGenericAdaptorBase::ICmpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.icmp", odsAttrs.getContext()); +} + +ICmpOpGenericAdaptorBase::ICmpOpGenericAdaptorBase(ICmpOp op) : ICmpOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ICmpOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ICmpOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::ICmpPredicateAttr ICmpOpGenericAdaptorBase::getPredicateAttr() { + auto attr = ::llvm::cast<::mlir::LLVM::ICmpPredicateAttr>(getProperties().predicate); + return attr; +} + +::mlir::LLVM::ICmpPredicate ICmpOpGenericAdaptorBase::getPredicate() { + auto attr = getPredicateAttr(); + return attr.getValue(); +} + +} // namespace detail +ICmpOpAdaptor::ICmpOpAdaptor(ICmpOp op) : ICmpOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ICmpOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate; + if (!tblgen_predicate) return emitError(loc, "'llvm.icmp' op ""requires attribute 'predicate'"); + + if (tblgen_predicate && !((::llvm::isa<::mlir::LLVM::ICmpPredicateAttr>(tblgen_predicate)))) + return emitError(loc, "'llvm.icmp' op ""attribute 'predicate' failed to satisfy constraint: lvm.icmp comparison predicate"); + return ::mlir::success(); +} + +std::pair ICmpOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ICmpOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ICmpOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value ICmpOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ICmpOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ICmpOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ICmpOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ICmpOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ICmpOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ICmpOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.predicate; + auto attr = dict.get("predicate"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for predicate in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `predicate` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ICmpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.predicate; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("predicate", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ICmpOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.predicate.getAsOpaquePointer())); +} + +std::optional ICmpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "predicate") + return prop.predicate; + return std::nullopt; +} + +void ICmpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "predicate") { + prop.predicate = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ICmpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.predicate) attrs.append("predicate", prop.predicate); +} + +::mlir::LogicalResult ICmpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPredicateAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps25(attr, "predicate", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ICmpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.predicate))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ICmpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.predicate); +} + +::mlir::LLVM::ICmpPredicateAttr ICmpOp::getPredicateAttr() { + return ::llvm::cast<::mlir::LLVM::ICmpPredicateAttr>(getProperties().predicate); +} + +::mlir::LLVM::ICmpPredicate ICmpOp::getPredicate() { + auto attr = getPredicateAttr(); + return attr.getValue(); +} + +void ICmpOp::setPredicateAttr(::mlir::LLVM::ICmpPredicateAttr attr) { + (*this)->setAttr(getPredicateAttrName(), attr); +} + +void ICmpOp::setPredicate(::mlir::LLVM::ICmpPredicate attrValue) { + (*this)->setAttr(getPredicateAttrName(), ::mlir::LLVM::ICmpPredicateAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + odsState.addTypes(res); +} + +void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ICmpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = predicate; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::LLVM::ICmpPredicateAttr::get(odsBuilder.getContext(), predicate); + odsState.addTypes(res); +} + +void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::LLVM::ICmpPredicateAttr::get(odsBuilder.getContext(), predicate); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ICmpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().predicate = ::mlir::LLVM::ICmpPredicateAttr::get(odsBuilder.getContext(), predicate); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ICmpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ICmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ICmpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ICmpOp::verifyInvariantsImpl() { + auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate; + if (!tblgen_predicate) return emitOpError("requires attribute 'predicate'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps25(*this, tblgen_predicate, "predicate"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps16(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps15(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::getI1SameShape((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result type has i1 element type and same shape as operands"); + return ::mlir::success(); +} + +::mlir::LogicalResult ICmpOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ICmpOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::getI1SameShape(operands[0].getType()); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +void ICmpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ICmpOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::InlineAsmOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +InlineAsmOpGenericAdaptorBase::InlineAsmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.inline_asm", odsAttrs.getContext()); +} + +InlineAsmOpGenericAdaptorBase::InlineAsmOpGenericAdaptorBase(InlineAsmOp op) : InlineAsmOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair InlineAsmOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr InlineAsmOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr InlineAsmOpGenericAdaptorBase::getAsmStringAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().asm_string); + return attr; +} + +::llvm::StringRef InlineAsmOpGenericAdaptorBase::getAsmString() { + auto attr = getAsmStringAttr(); + return attr.getValue(); +} + +::mlir::StringAttr InlineAsmOpGenericAdaptorBase::getConstraintsAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().constraints); + return attr; +} + +::llvm::StringRef InlineAsmOpGenericAdaptorBase::getConstraints() { + auto attr = getConstraintsAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr InlineAsmOpGenericAdaptorBase::getHasSideEffectsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().has_side_effects); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool InlineAsmOpGenericAdaptorBase::getHasSideEffects() { + auto attr = getHasSideEffectsAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr InlineAsmOpGenericAdaptorBase::getIsAlignStackAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().is_align_stack); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool InlineAsmOpGenericAdaptorBase::getIsAlignStack() { + auto attr = getIsAlignStackAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::LLVM::AsmDialectAttr InlineAsmOpGenericAdaptorBase::getAsmDialectAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::AsmDialectAttr>(getProperties().asm_dialect); + return attr; +} + +::std::optional<::mlir::LLVM::AsmDialect> InlineAsmOpGenericAdaptorBase::getAsmDialect() { + auto attr = getAsmDialectAttr(); + return attr ? ::std::optional<::mlir::LLVM::AsmDialect>(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr InlineAsmOpGenericAdaptorBase::getOperandAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().operand_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > InlineAsmOpGenericAdaptorBase::getOperandAttrs() { + auto attr = getOperandAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +InlineAsmOpAdaptor::InlineAsmOpAdaptor(InlineAsmOp op) : InlineAsmOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult InlineAsmOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_asm_dialect = getProperties().asm_dialect; (void)tblgen_asm_dialect; + auto tblgen_asm_string = getProperties().asm_string; (void)tblgen_asm_string; + if (!tblgen_asm_string) return emitError(loc, "'llvm.inline_asm' op ""requires attribute 'asm_string'"); + auto tblgen_constraints = getProperties().constraints; (void)tblgen_constraints; + if (!tblgen_constraints) return emitError(loc, "'llvm.inline_asm' op ""requires attribute 'constraints'"); + auto tblgen_has_side_effects = getProperties().has_side_effects; (void)tblgen_has_side_effects; + auto tblgen_is_align_stack = getProperties().is_align_stack; (void)tblgen_is_align_stack; + auto tblgen_operand_attrs = getProperties().operand_attrs; (void)tblgen_operand_attrs; + + if (tblgen_asm_string && !((::llvm::isa<::mlir::StringAttr>(tblgen_asm_string)))) + return emitError(loc, "'llvm.inline_asm' op ""attribute 'asm_string' failed to satisfy constraint: string attribute"); + + if (tblgen_constraints && !((::llvm::isa<::mlir::StringAttr>(tblgen_constraints)))) + return emitError(loc, "'llvm.inline_asm' op ""attribute 'constraints' failed to satisfy constraint: string attribute"); + + if (tblgen_has_side_effects && !((::llvm::isa<::mlir::UnitAttr>(tblgen_has_side_effects)))) + return emitError(loc, "'llvm.inline_asm' op ""attribute 'has_side_effects' failed to satisfy constraint: unit attribute"); + + if (tblgen_is_align_stack && !((::llvm::isa<::mlir::UnitAttr>(tblgen_is_align_stack)))) + return emitError(loc, "'llvm.inline_asm' op ""attribute 'is_align_stack' failed to satisfy constraint: unit attribute"); + + if (tblgen_asm_dialect && !((::llvm::isa<::mlir::LLVM::AsmDialectAttr>(tblgen_asm_dialect)))) + return emitError(loc, "'llvm.inline_asm' op ""attribute 'asm_dialect' failed to satisfy constraint: ATT (0) or Intel (1) asm dialect"); + + if (tblgen_operand_attrs && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_operand_attrs)))) + return emitError(loc, "'llvm.inline_asm' op ""attribute 'operand_attrs' failed to satisfy constraint: array attribute"); + return ::mlir::success(); +} + +std::pair InlineAsmOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range InlineAsmOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range InlineAsmOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange InlineAsmOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair InlineAsmOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range InlineAsmOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value InlineAsmOp::getRes() { + auto results = getODSResults(0); + return results.empty() ? ::mlir::Value() : ::llvm::cast<::mlir::Value>(*results.begin()); +} + +::mlir::LogicalResult InlineAsmOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.asm_dialect; + auto attr = dict.get("asm_dialect"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for asm_dialect in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `asm_dialect` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.asm_string; + auto attr = dict.get("asm_string"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for asm_string in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `asm_string` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.constraints; + auto attr = dict.get("constraints"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for constraints in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `constraints` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.has_side_effects; + auto attr = dict.get("has_side_effects"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for has_side_effects in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `has_side_effects` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.is_align_stack; + auto attr = dict.get("is_align_stack"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for is_align_stack in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `is_align_stack` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.operand_attrs; + auto attr = dict.get("operand_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for operand_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `operand_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute InlineAsmOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.asm_dialect; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("asm_dialect", + propStorage)); + } + + { + const auto &propStorage = prop.asm_string; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("asm_string", + propStorage)); + } + + { + const auto &propStorage = prop.constraints; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("constraints", + propStorage)); + } + + { + const auto &propStorage = prop.has_side_effects; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("has_side_effects", + propStorage)); + } + + { + const auto &propStorage = prop.is_align_stack; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("is_align_stack", + propStorage)); + } + + { + const auto &propStorage = prop.operand_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("operand_attrs", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code InlineAsmOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.asm_dialect.getAsOpaquePointer()), + llvm::hash_value(prop.asm_string.getAsOpaquePointer()), + llvm::hash_value(prop.constraints.getAsOpaquePointer()), + llvm::hash_value(prop.has_side_effects.getAsOpaquePointer()), + llvm::hash_value(prop.is_align_stack.getAsOpaquePointer()), + llvm::hash_value(prop.operand_attrs.getAsOpaquePointer())); +} + +std::optional InlineAsmOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "asm_dialect") + return prop.asm_dialect; + + if (name == "asm_string") + return prop.asm_string; + + if (name == "constraints") + return prop.constraints; + + if (name == "has_side_effects") + return prop.has_side_effects; + + if (name == "is_align_stack") + return prop.is_align_stack; + + if (name == "operand_attrs") + return prop.operand_attrs; + return std::nullopt; +} + +void InlineAsmOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "asm_dialect") { + prop.asm_dialect = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "asm_string") { + prop.asm_string = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "constraints") { + prop.constraints = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "has_side_effects") { + prop.has_side_effects = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "is_align_stack") { + prop.is_align_stack = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "operand_attrs") { + prop.operand_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void InlineAsmOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.asm_dialect) attrs.append("asm_dialect", prop.asm_dialect); + + if (prop.asm_string) attrs.append("asm_string", prop.asm_string); + + if (prop.constraints) attrs.append("constraints", prop.constraints); + + if (prop.has_side_effects) attrs.append("has_side_effects", prop.has_side_effects); + + if (prop.is_align_stack) attrs.append("is_align_stack", prop.is_align_stack); + + if (prop.operand_attrs) attrs.append("operand_attrs", prop.operand_attrs); +} + +::mlir::LogicalResult InlineAsmOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAsmDialectAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps26(attr, "asm_dialect", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAsmStringAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "asm_string", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getConstraintsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "constraints", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getHasSideEffectsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "has_side_effects", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsAlignStackAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "is_align_stack", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getOperandAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps27(attr, "operand_attrs", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult InlineAsmOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.asm_dialect))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.asm_string))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.constraints))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.has_side_effects))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.is_align_stack))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.operand_attrs))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void InlineAsmOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.asm_dialect); + writer.writeAttribute(prop.asm_string); + writer.writeAttribute(prop.constraints); + + writer.writeOptionalAttribute(prop.has_side_effects); + + writer.writeOptionalAttribute(prop.is_align_stack); + + writer.writeOptionalAttribute(prop.operand_attrs); +} + +::mlir::StringAttr InlineAsmOp::getAsmStringAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().asm_string); +} + +::llvm::StringRef InlineAsmOp::getAsmString() { + auto attr = getAsmStringAttr(); + return attr.getValue(); +} + +::mlir::StringAttr InlineAsmOp::getConstraintsAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().constraints); +} + +::llvm::StringRef InlineAsmOp::getConstraints() { + auto attr = getConstraintsAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr InlineAsmOp::getHasSideEffectsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().has_side_effects); +} + +bool InlineAsmOp::getHasSideEffects() { + auto attr = getHasSideEffectsAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr InlineAsmOp::getIsAlignStackAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().is_align_stack); +} + +bool InlineAsmOp::getIsAlignStack() { + auto attr = getIsAlignStackAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::LLVM::AsmDialectAttr InlineAsmOp::getAsmDialectAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::AsmDialectAttr>(getProperties().asm_dialect); +} + +::std::optional<::mlir::LLVM::AsmDialect> InlineAsmOp::getAsmDialect() { + auto attr = getAsmDialectAttr(); + return attr ? ::std::optional<::mlir::LLVM::AsmDialect>(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr InlineAsmOp::getOperandAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().operand_attrs); +} + +::std::optional< ::mlir::ArrayAttr > InlineAsmOp::getOperandAttrs() { + auto attr = getOperandAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void InlineAsmOp::setAsmStringAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getAsmStringAttrName(), attr); +} + +void InlineAsmOp::setAsmString(::llvm::StringRef attrValue) { + (*this)->setAttr(getAsmStringAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void InlineAsmOp::setConstraintsAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getConstraintsAttrName(), attr); +} + +void InlineAsmOp::setConstraints(::llvm::StringRef attrValue) { + (*this)->setAttr(getConstraintsAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void InlineAsmOp::setHasSideEffectsAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getHasSideEffectsAttrName(), attr); +} + +void InlineAsmOp::setHasSideEffects(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getHasSideEffectsAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getHasSideEffectsAttrName()); +} + +void InlineAsmOp::setIsAlignStackAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getIsAlignStackAttrName(), attr); +} + +void InlineAsmOp::setIsAlignStack(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getIsAlignStackAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getIsAlignStackAttrName()); +} + +void InlineAsmOp::setAsmDialectAttr(::mlir::LLVM::AsmDialectAttr attr) { + (*this)->setAttr(getAsmDialectAttrName(), attr); +} + +void InlineAsmOp::setAsmDialect(::std::optional<::mlir::LLVM::AsmDialect> attrValue) { + if (attrValue) + return (*this)->setAttr(getAsmDialectAttrName(), ::mlir::LLVM::AsmDialectAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getAsmDialectAttrName()); +} + +void InlineAsmOp::setOperandAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getOperandAttrsAttrName(), attr); +} + +::mlir::Attribute InlineAsmOp::removeHasSideEffectsAttr() { + auto &attr = getProperties().has_side_effects; + attr = {}; + return attr; +} + +::mlir::Attribute InlineAsmOp::removeIsAlignStackAttr() { + auto &attr = getProperties().is_align_stack; + attr = {}; + return attr; +} + +::mlir::Attribute InlineAsmOp::removeAsmDialectAttr() { + auto &attr = getProperties().asm_dialect; + attr = {}; + return attr; +} + +::mlir::Attribute InlineAsmOp::removeOperandAttrsAttr() { + auto &attr = getProperties().operand_attrs; + attr = {}; + return attr; +} + +void InlineAsmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) { + odsState.addOperands(operands); + odsState.getOrAddProperties().asm_string = asm_string; + odsState.getOrAddProperties().constraints = constraints; + if (has_side_effects) { + odsState.getOrAddProperties().has_side_effects = has_side_effects; + } + if (is_align_stack) { + odsState.getOrAddProperties().is_align_stack = is_align_stack; + } + if (asm_dialect) { + odsState.getOrAddProperties().asm_dialect = asm_dialect; + } + if (operand_attrs) { + odsState.getOrAddProperties().operand_attrs = operand_attrs; + } + if (res) + odsState.addTypes(res); +} + +void InlineAsmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) { + odsState.addOperands(operands); + odsState.getOrAddProperties().asm_string = asm_string; + odsState.getOrAddProperties().constraints = constraints; + if (has_side_effects) { + odsState.getOrAddProperties().has_side_effects = has_side_effects; + } + if (is_align_stack) { + odsState.getOrAddProperties().is_align_stack = is_align_stack; + } + if (asm_dialect) { + odsState.getOrAddProperties().asm_dialect = asm_dialect; + } + if (operand_attrs) { + odsState.getOrAddProperties().operand_attrs = operand_attrs; + } + odsState.addTypes(resultTypes); +} + +void InlineAsmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) { + odsState.addOperands(operands); + odsState.getOrAddProperties().asm_string = odsBuilder.getStringAttr(asm_string); + odsState.getOrAddProperties().constraints = odsBuilder.getStringAttr(constraints); + if (has_side_effects) { + odsState.getOrAddProperties().has_side_effects = ((has_side_effects) ? odsBuilder.getUnitAttr() : nullptr); + } + if (is_align_stack) { + odsState.getOrAddProperties().is_align_stack = ((is_align_stack) ? odsBuilder.getUnitAttr() : nullptr); + } + if (asm_dialect) { + odsState.getOrAddProperties().asm_dialect = asm_dialect; + } + if (operand_attrs) { + odsState.getOrAddProperties().operand_attrs = operand_attrs; + } + if (res) + odsState.addTypes(res); +} + +void InlineAsmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs) { + odsState.addOperands(operands); + odsState.getOrAddProperties().asm_string = odsBuilder.getStringAttr(asm_string); + odsState.getOrAddProperties().constraints = odsBuilder.getStringAttr(constraints); + if (has_side_effects) { + odsState.getOrAddProperties().has_side_effects = ((has_side_effects) ? odsBuilder.getUnitAttr() : nullptr); + } + if (is_align_stack) { + odsState.getOrAddProperties().is_align_stack = ((is_align_stack) ? odsBuilder.getUnitAttr() : nullptr); + } + if (asm_dialect) { + odsState.getOrAddProperties().asm_dialect = asm_dialect; + } + if (operand_attrs) { + odsState.getOrAddProperties().operand_attrs = operand_attrs; + } + odsState.addTypes(resultTypes); +} + +void InlineAsmOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult InlineAsmOp::verifyInvariantsImpl() { + auto tblgen_asm_dialect = getProperties().asm_dialect; (void)tblgen_asm_dialect; + auto tblgen_asm_string = getProperties().asm_string; (void)tblgen_asm_string; + if (!tblgen_asm_string) return emitOpError("requires attribute 'asm_string'"); + auto tblgen_constraints = getProperties().constraints; (void)tblgen_constraints; + if (!tblgen_constraints) return emitOpError("requires attribute 'constraints'"); + auto tblgen_has_side_effects = getProperties().has_side_effects; (void)tblgen_has_side_effects; + auto tblgen_is_align_stack = getProperties().is_align_stack; (void)tblgen_is_align_stack; + auto tblgen_operand_attrs = getProperties().operand_attrs; (void)tblgen_operand_attrs; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_asm_string, "asm_string"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_constraints, "constraints"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_has_side_effects, "has_side_effects"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_is_align_stack, "is_align_stack"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps26(*this, tblgen_asm_dialect, "asm_dialect"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps27(*this, tblgen_operand_attrs, "operand_attrs"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + if (valueGroup0.size() > 1) { + return emitOpError("result group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult InlineAsmOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult InlineAsmOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::LLVM::AsmDialectAttr asm_dialectAttr; + ::mlir::ArrayAttr operand_attrsAttr; + ::mlir::StringAttr asm_stringAttr; + ::mlir::StringAttr constraintsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + if (::mlir::succeeded(parser.parseOptionalKeyword("has_side_effects"))) { + result.getOrAddProperties().has_side_effects = parser.getBuilder().getUnitAttr(); } + if (::mlir::succeeded(parser.parseOptionalKeyword("is_align_stack"))) { + result.getOrAddProperties().is_align_stack = parser.getBuilder().getUnitAttr(); } + if (::mlir::succeeded(parser.parseOptionalKeyword("asm_dialect"))) { + if (parser.parseEqual()) + return ::mlir::failure(); + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"att","intel"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "asm_dialect", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'asm_dialect' [att, intel]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::LLVM::symbolizeAsmDialect(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "asm_dialect attribute specification: \"" << attrStr << '"';; + + asm_dialectAttr = ::mlir::LLVM::AsmDialectAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().asm_dialect = asm_dialectAttr; + } + } + } + if (::mlir::succeeded(parser.parseOptionalKeyword("operand_attrs"))) { + if (parser.parseEqual()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(operand_attrsAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (operand_attrsAttr) result.getOrAddProperties().operand_attrs = operand_attrsAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + if (parser.parseCustomAttributeWithFallback(asm_stringAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (asm_stringAttr) result.getOrAddProperties().asm_string = asm_stringAttr; + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(constraintsAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (constraintsAttr) result.getOrAddProperties().constraints = constraintsAttr; + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void InlineAsmOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getHasSideEffectsAttr()) { + _odsPrinter << ' ' << "has_side_effects"; + } + if (getIsAlignStackAttr()) { + _odsPrinter << ' ' << "is_align_stack"; + } + if (getAsmDialectAttr()) { + _odsPrinter << ' ' << "asm_dialect"; + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + + { + auto caseValue = *getAsmDialect(); + auto caseValueStr = stringifyAsmDialect(caseValue); + _odsPrinter << caseValueStr; + } + } + if (getOperandAttrsAttr()) { + _odsPrinter << ' ' << "operand_attrs"; + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getOperandAttrsAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("has_side_effects"); + elidedAttrs.push_back("is_align_stack"); + elidedAttrs.push_back("asm_dialect"); + elidedAttrs.push_back("operand_attrs"); + elidedAttrs.push_back("asm_string"); + elidedAttrs.push_back("constraints"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHasSideEffectsAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("has_side_effects"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getIsAlignStackAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("is_align_stack"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getAsmStringAttr()); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getConstraintsAttr()); + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::InlineAsmOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::InsertElementOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +InsertElementOpGenericAdaptorBase::InsertElementOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.insertelement", odsAttrs.getContext()); +} + +InsertElementOpGenericAdaptorBase::InsertElementOpGenericAdaptorBase(InsertElementOp op) : InsertElementOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair InsertElementOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr InsertElementOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +InsertElementOpAdaptor::InsertElementOpAdaptor(InsertElementOp op) : InsertElementOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult InsertElementOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair InsertElementOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range InsertElementOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value InsertElementOp::getVector() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value InsertElementOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> InsertElementOp::getPosition() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &InsertElementOp::getVectorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &InsertElementOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &InsertElementOp::getPositionMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair InsertElementOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range InsertElementOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value InsertElementOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) { + odsState.addOperands(vector); + odsState.addOperands(value); + odsState.addOperands(position); + odsState.addTypes(res); +} + +void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) { + odsState.addOperands(vector); + odsState.addOperands(value); + odsState.addOperands(position); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(InsertElementOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position) { + odsState.addOperands(vector); + odsState.addOperands(value); + odsState.addOperands(position); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void InsertElementOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void InsertElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(InsertElementOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult InsertElementOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps17(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(LLVM::getVectorElementType((*this->getODSOperands(0).begin()).getType()), (*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that argument type matches vector element type"); + if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that all of {res, vector} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult InsertElementOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult InsertElementOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult InsertElementOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand vectorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vectorOperands(vectorRawOperands); ::llvm::SMLoc vectorOperandsLoc; + (void)vectorOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand positionRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> positionOperands(positionRawOperands); ::llvm::SMLoc positionOperandsLoc; + (void)positionOperandsLoc; + ::mlir::Type positionRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> positionTypes(positionRawTypes); + ::mlir::Type vectorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vectorTypes(vectorRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + vectorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(vectorRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + positionOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(positionRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + positionRawTypes[0] = type; + } + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vectorRawTypes[0] = type; + } + for (::mlir::Type type : vectorTypes) { + (void)type; + if (!((::mlir::LLVM::isCompatibleVectorType(type)))) { + return parser.emitError(parser.getNameLoc()) << "'vector' must be LLVM dialect-compatible vector type, but got " << type; + } + } + result.addTypes(vectorTypes[0]); + if (parser.resolveOperands(vectorOperands, vectorTypes, vectorOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valueOperands, LLVM::getVectorElementType(vectorTypes[0]), valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(positionOperands, positionTypes, positionOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void InsertElementOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getVector(); + _odsPrinter << "["; + _odsPrinter << getPosition(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getPosition().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVector().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void InsertElementOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::InsertElementOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::InsertValueOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +InsertValueOpGenericAdaptorBase::InsertValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.insertvalue", odsAttrs.getContext()); +} + +InsertValueOpGenericAdaptorBase::InsertValueOpGenericAdaptorBase(InsertValueOp op) : InsertValueOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair InsertValueOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr InsertValueOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI64ArrayAttr InsertValueOpGenericAdaptorBase::getPositionAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().position); + return attr; +} + +::llvm::ArrayRef InsertValueOpGenericAdaptorBase::getPosition() { + auto attr = getPositionAttr(); + return attr; +} + +} // namespace detail +InsertValueOpAdaptor::InsertValueOpAdaptor(InsertValueOp op) : InsertValueOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult InsertValueOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_position = getProperties().position; (void)tblgen_position; + if (!tblgen_position) return emitError(loc, "'llvm.insertvalue' op ""requires attribute 'position'"); + + if (tblgen_position && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_position)))) + return emitError(loc, "'llvm.insertvalue' op ""attribute 'position' failed to satisfy constraint: i64 dense array attribute"); + return ::mlir::success(); +} + +std::pair InsertValueOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range InsertValueOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value InsertValueOp::getContainer() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value InsertValueOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &InsertValueOp::getContainerMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &InsertValueOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair InsertValueOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range InsertValueOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value InsertValueOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult InsertValueOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.position; + auto attr = dict.get("position"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for position in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `position` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute InsertValueOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.position; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("position", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code InsertValueOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.position.getAsOpaquePointer())); +} + +std::optional InsertValueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "position") + return prop.position; + return std::nullopt; +} + +void InsertValueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "position") { + prop.position = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void InsertValueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.position) attrs.append("position", prop.position); +} + +::mlir::LogicalResult InsertValueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPositionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps16(attr, "position", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult InsertValueOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.position))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void InsertValueOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.position); +} + +::mlir::DenseI64ArrayAttr InsertValueOp::getPositionAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().position); +} + +::llvm::ArrayRef InsertValueOp::getPosition() { + auto attr = getPositionAttr(); + return attr; +} + +void InsertValueOp::setPositionAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getPositionAttrName(), attr); +} + +void InsertValueOp::setPosition(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getPositionAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) { + odsState.addOperands(container); + odsState.addOperands(value); + odsState.getOrAddProperties().position = position; + odsState.addTypes(res); +} + +void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) { + odsState.addOperands(container); + odsState.addOperands(value); + odsState.getOrAddProperties().position = position; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(InsertValueOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position) { + odsState.addOperands(container); + odsState.addOperands(value); + odsState.getOrAddProperties().position = position; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef position) { + odsState.addOperands(container); + odsState.addOperands(value); + odsState.getOrAddProperties().position = odsBuilder.getDenseI64ArrayAttr(position); + odsState.addTypes(res); +} + +void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef position) { + odsState.addOperands(container); + odsState.addOperands(value); + odsState.getOrAddProperties().position = odsBuilder.getDenseI64ArrayAttr(position); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(InsertValueOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef position) { + odsState.addOperands(container); + odsState.addOperands(value); + odsState.getOrAddProperties().position = odsBuilder.getDenseI64ArrayAttr(position); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void InsertValueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void InsertValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(InsertValueOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult InsertValueOp::verifyInvariantsImpl() { + auto tblgen_position = getProperties().position; (void)tblgen_position; + if (!tblgen_position) return emitOpError("requires attribute 'position'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps16(*this, tblgen_position, "position"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps13(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps17(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps13(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {container, res} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult InsertValueOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult InsertValueOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult InsertValueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand containerRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> containerOperands(containerRawOperands); ::llvm::SMLoc containerOperandsLoc; + (void)containerOperandsLoc; + ::mlir::DenseI64ArrayAttr positionAttr; + ::mlir::Type containerRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> containerTypes(containerRawTypes); + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + containerOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(containerRawOperands[0])) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(positionAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (positionAttr) result.getOrAddProperties().position = positionAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + containerRawTypes[0] = type; + } + { + auto odsResult = parseInsertExtractValueElementType(parser, valueRawTypes[0], containerRawTypes[0], positionAttr); + if (odsResult) return ::mlir::failure(); + } + result.addTypes(containerTypes[0]); + if (parser.resolveOperands(containerOperands, containerTypes, containerOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void InsertValueOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getContainer(); +_odsPrinter.printStrippedAttrOrType(getPositionAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("position"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getContainer().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' '; + printInsertExtractValueElementType(_odsPrinter, *this, getValue().getType(), getContainer().getType(), getPositionAttr()); +} + +void InsertValueOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::InsertValueOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::IntToPtrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +IntToPtrOpGenericAdaptorBase::IntToPtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.inttoptr", odsAttrs.getContext()); +} + +IntToPtrOpGenericAdaptorBase::IntToPtrOpGenericAdaptorBase(IntToPtrOp op) : IntToPtrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair IntToPtrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr IntToPtrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +IntToPtrOpAdaptor::IntToPtrOpAdaptor(IntToPtrOp op) : IntToPtrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult IntToPtrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair IntToPtrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range IntToPtrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IntToPtrOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &IntToPtrOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair IntToPtrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range IntToPtrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IntToPtrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void IntToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void IntToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void IntToPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IntToPtrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult IntToPtrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult IntToPtrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult IntToPtrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void IntToPtrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void IntToPtrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::IntToPtrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::InvokeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +InvokeOpGenericAdaptorBase::InvokeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.invoke", odsAttrs.getContext()); +} + +InvokeOpGenericAdaptorBase::InvokeOpGenericAdaptorBase(InvokeOp op) : InvokeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair InvokeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr InvokeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypeAttr InvokeOpGenericAdaptorBase::getCalleeTypeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().callee_type); + return attr; +} + +::std::optional<::mlir::LLVM::LLVMFunctionType> InvokeOpGenericAdaptorBase::getCalleeType() { + auto attr = getCalleeTypeAttr(); + return attr ? ::std::optional<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue())) : (::std::nullopt); +} + +::mlir::FlatSymbolRefAttr InvokeOpGenericAdaptorBase::getCalleeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().callee); + return attr; +} + +::std::optional< ::llvm::StringRef > InvokeOpGenericAdaptorBase::getCallee() { + auto attr = getCalleeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::DenseI32ArrayAttr InvokeOpGenericAdaptorBase::getBranchWeightsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().branch_weights); + return attr; +} + +::std::optional<::llvm::ArrayRef> InvokeOpGenericAdaptorBase::getBranchWeights() { + auto attr = getBranchWeightsAttr(); + return attr ? ::std::optional<::llvm::ArrayRef>(attr) : (::std::nullopt); +} + +} // namespace detail +InvokeOpAdaptor::InvokeOpAdaptor(InvokeOp op) : InvokeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult InvokeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; + auto tblgen_callee = getProperties().callee; (void)tblgen_callee; + auto tblgen_callee_type = getProperties().callee_type; (void)tblgen_callee_type; + + if (tblgen_callee_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_callee_type))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_callee_type).getValue()))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_callee_type).getValue()))))) + return emitError(loc, "'llvm.invoke' op ""attribute 'callee_type' failed to satisfy constraint: type attribute of LLVM function type"); + + if (tblgen_callee && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_callee)))) + return emitError(loc, "'llvm.invoke' op ""attribute 'callee' failed to satisfy constraint: flat symbol reference attribute"); + + if (tblgen_branch_weights && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_branch_weights)))) + return emitError(loc, "'llvm.invoke' op ""attribute 'branch_weights' failed to satisfy constraint: i32 dense array attribute"); + return ::mlir::success(); +} + +std::pair InvokeOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range InvokeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range InvokeOp::getCalleeOperands() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range InvokeOp::getNormalDestOperands() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range InvokeOp::getUnwindDestOperands() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange InvokeOp::getCalleeOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange InvokeOp::getNormalDestOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange InvokeOp::getUnwindDestOperandsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair InvokeOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range InvokeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *InvokeOp::getNormalDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *InvokeOp::getUnwindDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult InvokeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.branch_weights; + auto attr = dict.get("branch_weights"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for branch_weights in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `branch_weights` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.callee; + auto attr = dict.get("callee"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for callee in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `callee` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.callee_type; + auto attr = dict.get("callee_type"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for callee_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `callee_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute InvokeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.branch_weights; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("branch_weights", + propStorage)); + } + + { + const auto &propStorage = prop.callee; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("callee", + propStorage)); + } + + { + const auto &propStorage = prop.callee_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("callee_type", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code InvokeOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.branch_weights.getAsOpaquePointer()), + llvm::hash_value(prop.callee.getAsOpaquePointer()), + llvm::hash_value(prop.callee_type.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional InvokeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "branch_weights") + return prop.branch_weights; + + if (name == "callee") + return prop.callee; + + if (name == "callee_type") + return prop.callee_type; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void InvokeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "branch_weights") { + prop.branch_weights = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "callee") { + prop.callee = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "callee_type") { + prop.callee_type = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void InvokeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.branch_weights) attrs.append("branch_weights", prop.branch_weights); + + if (prop.callee) attrs.append("callee", prop.callee); + + if (prop.callee_type) attrs.append("callee_type", prop.callee_type); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult InvokeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBranchWeightsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(attr, "branch_weights", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps0(attr, "callee", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCalleeTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(attr, "callee_type", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult InvokeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.branch_weights))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.callee))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.callee_type))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void InvokeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.branch_weights); + + writer.writeOptionalAttribute(prop.callee); + + writer.writeOptionalAttribute(prop.callee_type); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::TypeAttr InvokeOp::getCalleeTypeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().callee_type); +} + +::std::optional<::mlir::LLVM::LLVMFunctionType> InvokeOp::getCalleeType() { + auto attr = getCalleeTypeAttr(); + return attr ? ::std::optional<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue())) : (::std::nullopt); +} + +::mlir::FlatSymbolRefAttr InvokeOp::getCalleeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().callee); +} + +::std::optional< ::llvm::StringRef > InvokeOp::getCallee() { + auto attr = getCalleeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::DenseI32ArrayAttr InvokeOp::getBranchWeightsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().branch_weights); +} + +::std::optional<::llvm::ArrayRef> InvokeOp::getBranchWeights() { + auto attr = getBranchWeightsAttr(); + return attr ? ::std::optional<::llvm::ArrayRef>(attr) : (::std::nullopt); +} + +void InvokeOp::setCalleeTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getCalleeTypeAttrName(), attr); +} + +void InvokeOp::setCalleeType(::std::optional<::mlir::LLVM::LLVMFunctionType> attrValue) { + if (attrValue) + return (*this)->setAttr(getCalleeTypeAttrName(), ::mlir::TypeAttr::get(*attrValue)); + (*this)->removeAttr(getCalleeTypeAttrName()); +} + +void InvokeOp::setCalleeAttr(::mlir::FlatSymbolRefAttr attr) { + (*this)->setAttr(getCalleeAttrName(), attr); +} + +void InvokeOp::setCallee(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getCalleeAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getCalleeAttrName()); +} + +void InvokeOp::setBranchWeightsAttr(::mlir::DenseI32ArrayAttr attr) { + (*this)->setAttr(getBranchWeightsAttrName(), attr); +} + +void InvokeOp::setBranchWeights(::std::optional<::llvm::ArrayRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getBranchWeightsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue)); + (*this)->removeAttr(getBranchWeightsAttrName()); +} + +::mlir::Attribute InvokeOp::removeCalleeTypeAttr() { + auto &attr = getProperties().callee_type; + attr = {}; + return attr; +} + +::mlir::Attribute InvokeOp::removeCalleeAttr() { + auto &attr = getProperties().callee; + attr = {}; + return attr; +} + +::mlir::Attribute InvokeOp::removeBranchWeightsAttr() { + auto &attr = getProperties().branch_weights; + attr = {}; + return attr; +} + +void InvokeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *normalDest, ::mlir::Block *unwindDest) { + odsState.addOperands(callee_operands); + odsState.addOperands(normalDestOperands); + odsState.addOperands(unwindDestOperands); + ::llvm::copy(::llvm::ArrayRef({static_cast(callee_operands.size()), static_cast(normalDestOperands.size()), static_cast(unwindDestOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (callee_type) { + odsState.getOrAddProperties().callee_type = callee_type; + } + if (callee) { + odsState.getOrAddProperties().callee = callee; + } + if (branch_weights) { + odsState.getOrAddProperties().branch_weights = branch_weights; + } + odsState.addSuccessors(normalDest); + odsState.addSuccessors(unwindDest); + odsState.addTypes(resultType0); +} + +void InvokeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult InvokeOp::verifyInvariantsImpl() { + auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; + auto tblgen_callee = getProperties().callee; (void)tblgen_callee; + auto tblgen_callee_type = getProperties().callee_type; (void)tblgen_callee_type; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(*this, tblgen_callee_type, "callee_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps0(*this, tblgen_callee, "callee"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(*this, tblgen_branch_weights, "branch_weights"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult InvokeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::InvokeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LLVMFuncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LLVMFuncOpGenericAdaptorBase::LLVMFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.func", odsAttrs.getContext()); +} + +LLVMFuncOpGenericAdaptorBase::LLVMFuncOpGenericAdaptorBase(LLVMFuncOp op) : LLVMFuncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LLVMFuncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LLVMFuncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr LLVMFuncOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef LLVMFuncOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::StringAttr LLVMFuncOpGenericAdaptorBase::getSymVisibilityAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); + return attr; +} + +::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::TypeAttr LLVMFuncOpGenericAdaptorBase::getFunctionTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); + return attr; +} + +::mlir::LLVM::LLVMFunctionType LLVMFuncOpGenericAdaptorBase::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue()); +} + +::mlir::LLVM::LinkageAttr LLVMFuncOpGenericAdaptorBase::getLinkageAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::LinkageAttr>(getProperties().linkage); + return attr; +} + +::mlir::LLVM::Linkage LLVMFuncOpGenericAdaptorBase::getLinkage() { + auto attr = getLinkageAttr(); + return attr.getLinkage(); +} + +::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getDsoLocalAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().dso_local); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LLVMFuncOpGenericAdaptorBase::getDsoLocal() { + auto attr = getDsoLocalAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::LLVM::CConvAttr LLVMFuncOpGenericAdaptorBase::getCConvAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::CConvAttr>(getProperties().CConv); + return attr; +} + +::mlir::LLVM::cconv::CConv LLVMFuncOpGenericAdaptorBase::getCConv() { + auto attr = getCConvAttr(); + return attr.getCallingConv(); +} + +::mlir::SymbolRefAttr LLVMFuncOpGenericAdaptorBase::getComdatAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().comdat); + return attr; +} + +::std::optional< ::mlir::SymbolRefAttr > LLVMFuncOpGenericAdaptorBase::getComdat() { + auto attr = getComdatAttr(); + return attr ? ::std::optional< ::mlir::SymbolRefAttr >(attr) : (::std::nullopt); +} + +::mlir::FlatSymbolRefAttr LLVMFuncOpGenericAdaptorBase::getPersonalityAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().personality); + return attr; +} + +::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getPersonality() { + auto attr = getPersonalityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::StringAttr LLVMFuncOpGenericAdaptorBase::getGarbageCollectorAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().garbageCollector); + return attr; +} + +::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getGarbageCollector() { + auto attr = getGarbageCollectorAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr LLVMFuncOpGenericAdaptorBase::getPassthroughAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().passthrough); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > LLVMFuncOpGenericAdaptorBase::getPassthrough() { + auto attr = getPassthroughAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LLVMFuncOpGenericAdaptorBase::getArgAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > LLVMFuncOpGenericAdaptorBase::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LLVMFuncOpGenericAdaptorBase::getResAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > LLVMFuncOpGenericAdaptorBase::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::IntegerAttr LLVMFuncOpGenericAdaptorBase::getFunctionEntryCountAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().function_entry_count); + return attr; +} + +::std::optional LLVMFuncOpGenericAdaptorBase::getFunctionEntryCount() { + auto attr = getFunctionEntryCountAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::LLVM::MemoryEffectsAttr LLVMFuncOpGenericAdaptorBase::getMemoryAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::MemoryEffectsAttr>(getProperties().memory); + return attr; +} + +::std::optional<::mlir::LLVM::MemoryEffectsAttr> LLVMFuncOpGenericAdaptorBase::getMemory() { + auto attr = getMemoryAttr(); + return attr ? ::std::optional<::mlir::LLVM::MemoryEffectsAttr>(::llvm::cast<::mlir::LLVM::MemoryEffectsAttr>(attr)) : (::std::nullopt); +} + +::mlir::LLVM::VisibilityAttr LLVMFuncOpGenericAdaptorBase::getVisibility_Attr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(getProperties().visibility_); + return attr; +} + +::mlir::LLVM::Visibility LLVMFuncOpGenericAdaptorBase::getVisibility_() { + auto attr = getVisibility_Attr(); + return attr.getValue(); +} + +::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmStreamingAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_streaming); + return attr; +} + +::std::optional LLVMFuncOpGenericAdaptorBase::getArmStreaming() { + auto attr = getArmStreamingAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +::mlir::UnitAttr LLVMFuncOpGenericAdaptorBase::getArmLocallyStreamingAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_locally_streaming); + return attr; +} + +::std::optional LLVMFuncOpGenericAdaptorBase::getArmLocallyStreaming() { + auto attr = getArmLocallyStreamingAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +::mlir::StringAttr LLVMFuncOpGenericAdaptorBase::getSectionAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().section); + return attr; +} + +::std::optional< ::llvm::StringRef > LLVMFuncOpGenericAdaptorBase::getSection() { + auto attr = getSectionAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::LLVM::UnnamedAddrAttr LLVMFuncOpGenericAdaptorBase::getUnnamedAddrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::UnnamedAddrAttr>(getProperties().unnamed_addr); + return attr; +} + +::std::optional<::mlir::LLVM::UnnamedAddr> LLVMFuncOpGenericAdaptorBase::getUnnamedAddr() { + auto attr = getUnnamedAddrAttr(); + return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr LLVMFuncOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional LLVMFuncOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::LLVM::VScaleRangeAttr LLVMFuncOpGenericAdaptorBase::getVscaleRangeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::VScaleRangeAttr>(getProperties().vscale_range); + return attr; +} + +::std::optional<::mlir::LLVM::VScaleRangeAttr> LLVMFuncOpGenericAdaptorBase::getVscaleRange() { + auto attr = getVscaleRangeAttr(); + return attr ? ::std::optional<::mlir::LLVM::VScaleRangeAttr>(::llvm::cast<::mlir::LLVM::VScaleRangeAttr>(attr)) : (::std::nullopt); +} + +::mlir::Region &LLVMFuncOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange LLVMFuncOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +LLVMFuncOpAdaptor::LLVMFuncOpAdaptor(LLVMFuncOp op) : LLVMFuncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LLVMFuncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_CConv = getProperties().CConv; (void)tblgen_CConv; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_arm_locally_streaming = getProperties().arm_locally_streaming; (void)tblgen_arm_locally_streaming; + auto tblgen_arm_streaming = getProperties().arm_streaming; (void)tblgen_arm_streaming; + auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat; + auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local; + auto tblgen_function_entry_count = getProperties().function_entry_count; (void)tblgen_function_entry_count; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitError(loc, "'llvm.func' op ""requires attribute 'function_type'"); + auto tblgen_garbageCollector = getProperties().garbageCollector; (void)tblgen_garbageCollector; + auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage; + auto tblgen_memory = getProperties().memory; (void)tblgen_memory; + auto tblgen_passthrough = getProperties().passthrough; (void)tblgen_passthrough; + auto tblgen_personality = getProperties().personality; (void)tblgen_personality; + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_section = getProperties().section; (void)tblgen_section; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'llvm.func' op ""requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr; + auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_; + auto tblgen_vscale_range = getProperties().vscale_range; (void)tblgen_vscale_range; + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'llvm.func' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_sym_visibility && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_visibility)))) + return emitError(loc, "'llvm.func' op ""attribute 'sym_visibility' failed to satisfy constraint: string attribute"); + + if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::LLVM::LLVMFunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))))) + return emitError(loc, "'llvm.func' op ""attribute 'function_type' failed to satisfy constraint: type attribute of LLVM function type"); + + if (tblgen_linkage && !((::llvm::isa<::mlir::LLVM::LinkageAttr>(tblgen_linkage)))) + return emitError(loc, "'llvm.func' op ""attribute 'linkage' failed to satisfy constraint: LLVM Linkage specification"); + + if (tblgen_dso_local && !((::llvm::isa<::mlir::UnitAttr>(tblgen_dso_local)))) + return emitError(loc, "'llvm.func' op ""attribute 'dso_local' failed to satisfy constraint: unit attribute"); + + if (tblgen_CConv && !((::llvm::isa<::mlir::LLVM::CConvAttr>(tblgen_CConv)))) + return emitError(loc, "'llvm.func' op ""attribute 'CConv' failed to satisfy constraint: LLVM Calling Convention specification"); + + if (tblgen_comdat && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_comdat)))) + return emitError(loc, "'llvm.func' op ""attribute 'comdat' failed to satisfy constraint: symbol reference attribute"); + + if (tblgen_personality && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_personality)))) + return emitError(loc, "'llvm.func' op ""attribute 'personality' failed to satisfy constraint: flat symbol reference attribute"); + + if (tblgen_garbageCollector && !((::llvm::isa<::mlir::StringAttr>(tblgen_garbageCollector)))) + return emitError(loc, "'llvm.func' op ""attribute 'garbageCollector' failed to satisfy constraint: string attribute"); + + if (tblgen_passthrough && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_passthrough)))) + return emitError(loc, "'llvm.func' op ""attribute 'passthrough' failed to satisfy constraint: array attribute"); + + if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'llvm.func' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'llvm.func' op ""attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_function_entry_count && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_function_entry_count))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_function_entry_count).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.func' op ""attribute 'function_entry_count' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_memory && !((::llvm::isa<::mlir::LLVM::MemoryEffectsAttr>(tblgen_memory)))) + return emitError(loc, "'llvm.func' op ""attribute 'memory' failed to satisfy constraint: "); + + if (tblgen_visibility_ && !((::llvm::isa<::mlir::LLVM::VisibilityAttr>(tblgen_visibility_)))) + return emitError(loc, "'llvm.func' op ""attribute 'visibility_' failed to satisfy constraint: LLVM GlobalValue Visibility"); + + if (tblgen_arm_streaming && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_streaming)))) + return emitError(loc, "'llvm.func' op ""attribute 'arm_streaming' failed to satisfy constraint: unit attribute"); + + if (tblgen_arm_locally_streaming && !((::llvm::isa<::mlir::UnitAttr>(tblgen_arm_locally_streaming)))) + return emitError(loc, "'llvm.func' op ""attribute 'arm_locally_streaming' failed to satisfy constraint: unit attribute"); + + if (tblgen_section && !((::llvm::isa<::mlir::StringAttr>(tblgen_section)))) + return emitError(loc, "'llvm.func' op ""attribute 'section' failed to satisfy constraint: string attribute"); + + if (tblgen_unnamed_addr && !((::llvm::isa<::mlir::LLVM::UnnamedAddrAttr>(tblgen_unnamed_addr)))) + return emitError(loc, "'llvm.func' op ""attribute 'unnamed_addr' failed to satisfy constraint: LLVM GlobalValue UnnamedAddr"); + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.func' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_vscale_range && !((::llvm::isa<::mlir::LLVM::VScaleRangeAttr>(tblgen_vscale_range)))) + return emitError(loc, "'llvm.func' op ""attribute 'vscale_range' failed to satisfy constraint: "); + return ::mlir::success(); +} + +std::pair LLVMFuncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LLVMFuncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair LLVMFuncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LLVMFuncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &LLVMFuncOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult LLVMFuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.CConv; + auto attr = dict.get("CConv"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for CConv in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `CConv` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.arg_attrs; + auto attr = dict.get("arg_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for arg_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.arm_locally_streaming; + auto attr = dict.get("arm_locally_streaming"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for arm_locally_streaming in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `arm_locally_streaming` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.arm_streaming; + auto attr = dict.get("arm_streaming"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for arm_streaming in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `arm_streaming` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.comdat; + auto attr = dict.get("comdat"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for comdat in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `comdat` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.dso_local; + auto attr = dict.get("dso_local"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dso_local in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dso_local` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.function_entry_count; + auto attr = dict.get("function_entry_count"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for function_entry_count in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `function_entry_count` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.function_type; + auto attr = dict.get("function_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for function_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `function_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.garbageCollector; + auto attr = dict.get("garbageCollector"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for garbageCollector in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `garbageCollector` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.linkage; + auto attr = dict.get("linkage"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for linkage in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `linkage` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.memory; + auto attr = dict.get("memory"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for memory in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `memory` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.passthrough; + auto attr = dict.get("passthrough"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for passthrough in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `passthrough` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.personality; + auto attr = dict.get("personality"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for personality in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `personality` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.res_attrs; + auto attr = dict.get("res_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for res_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.section; + auto attr = dict.get("section"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for section in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `section` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_visibility; + auto attr = dict.get("sym_visibility"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for sym_visibility in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.unnamed_addr; + auto attr = dict.get("unnamed_addr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for unnamed_addr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `unnamed_addr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.visibility_; + auto attr = dict.get("visibility_"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for visibility_ in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `visibility_` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.vscale_range; + auto attr = dict.get("vscale_range"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for vscale_range in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `vscale_range` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LLVMFuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.CConv; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("CConv", + propStorage)); + } + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.arg_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.arm_locally_streaming; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("arm_locally_streaming", + propStorage)); + } + + { + const auto &propStorage = prop.arm_streaming; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("arm_streaming", + propStorage)); + } + + { + const auto &propStorage = prop.comdat; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("comdat", + propStorage)); + } + + { + const auto &propStorage = prop.dso_local; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dso_local", + propStorage)); + } + + { + const auto &propStorage = prop.function_entry_count; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("function_entry_count", + propStorage)); + } + + { + const auto &propStorage = prop.function_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("function_type", + propStorage)); + } + + { + const auto &propStorage = prop.garbageCollector; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("garbageCollector", + propStorage)); + } + + { + const auto &propStorage = prop.linkage; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("linkage", + propStorage)); + } + + { + const auto &propStorage = prop.memory; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("memory", + propStorage)); + } + + { + const auto &propStorage = prop.passthrough; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("passthrough", + propStorage)); + } + + { + const auto &propStorage = prop.personality; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("personality", + propStorage)); + } + + { + const auto &propStorage = prop.res_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("res_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.section; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("section", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.sym_visibility; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_visibility", + propStorage)); + } + + { + const auto &propStorage = prop.unnamed_addr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("unnamed_addr", + propStorage)); + } + + { + const auto &propStorage = prop.visibility_; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("visibility_", + propStorage)); + } + + { + const auto &propStorage = prop.vscale_range; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("vscale_range", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LLVMFuncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.CConv.getAsOpaquePointer()), + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.arm_locally_streaming.getAsOpaquePointer()), + llvm::hash_value(prop.arm_streaming.getAsOpaquePointer()), + llvm::hash_value(prop.comdat.getAsOpaquePointer()), + llvm::hash_value(prop.dso_local.getAsOpaquePointer()), + llvm::hash_value(prop.function_entry_count.getAsOpaquePointer()), + llvm::hash_value(prop.function_type.getAsOpaquePointer()), + llvm::hash_value(prop.garbageCollector.getAsOpaquePointer()), + llvm::hash_value(prop.linkage.getAsOpaquePointer()), + llvm::hash_value(prop.memory.getAsOpaquePointer()), + llvm::hash_value(prop.passthrough.getAsOpaquePointer()), + llvm::hash_value(prop.personality.getAsOpaquePointer()), + llvm::hash_value(prop.res_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.section.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.sym_visibility.getAsOpaquePointer()), + llvm::hash_value(prop.unnamed_addr.getAsOpaquePointer()), + llvm::hash_value(prop.visibility_.getAsOpaquePointer()), + llvm::hash_value(prop.vscale_range.getAsOpaquePointer())); +} + +std::optional LLVMFuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "CConv") + return prop.CConv; + + if (name == "alignment") + return prop.alignment; + + if (name == "arg_attrs") + return prop.arg_attrs; + + if (name == "arm_locally_streaming") + return prop.arm_locally_streaming; + + if (name == "arm_streaming") + return prop.arm_streaming; + + if (name == "comdat") + return prop.comdat; + + if (name == "dso_local") + return prop.dso_local; + + if (name == "function_entry_count") + return prop.function_entry_count; + + if (name == "function_type") + return prop.function_type; + + if (name == "garbageCollector") + return prop.garbageCollector; + + if (name == "linkage") + return prop.linkage; + + if (name == "memory") + return prop.memory; + + if (name == "passthrough") + return prop.passthrough; + + if (name == "personality") + return prop.personality; + + if (name == "res_attrs") + return prop.res_attrs; + + if (name == "section") + return prop.section; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "sym_visibility") + return prop.sym_visibility; + + if (name == "unnamed_addr") + return prop.unnamed_addr; + + if (name == "visibility_") + return prop.visibility_; + + if (name == "vscale_range") + return prop.vscale_range; + return std::nullopt; +} + +void LLVMFuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "CConv") { + prop.CConv = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "arg_attrs") { + prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "arm_locally_streaming") { + prop.arm_locally_streaming = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "arm_streaming") { + prop.arm_streaming = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "comdat") { + prop.comdat = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "dso_local") { + prop.dso_local = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "function_entry_count") { + prop.function_entry_count = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "function_type") { + prop.function_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "garbageCollector") { + prop.garbageCollector = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "linkage") { + prop.linkage = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "memory") { + prop.memory = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "passthrough") { + prop.passthrough = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "personality") { + prop.personality = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "res_attrs") { + prop.res_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "section") { + prop.section = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_visibility") { + prop.sym_visibility = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "unnamed_addr") { + prop.unnamed_addr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "visibility_") { + prop.visibility_ = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "vscale_range") { + prop.vscale_range = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LLVMFuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.CConv) attrs.append("CConv", prop.CConv); + + if (prop.alignment) attrs.append("alignment", prop.alignment); + + if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); + + if (prop.arm_locally_streaming) attrs.append("arm_locally_streaming", prop.arm_locally_streaming); + + if (prop.arm_streaming) attrs.append("arm_streaming", prop.arm_streaming); + + if (prop.comdat) attrs.append("comdat", prop.comdat); + + if (prop.dso_local) attrs.append("dso_local", prop.dso_local); + + if (prop.function_entry_count) attrs.append("function_entry_count", prop.function_entry_count); + + if (prop.function_type) attrs.append("function_type", prop.function_type); + + if (prop.garbageCollector) attrs.append("garbageCollector", prop.garbageCollector); + + if (prop.linkage) attrs.append("linkage", prop.linkage); + + if (prop.memory) attrs.append("memory", prop.memory); + + if (prop.passthrough) attrs.append("passthrough", prop.passthrough); + + if (prop.personality) attrs.append("personality", prop.personality); + + if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); + + if (prop.section) attrs.append("section", prop.section); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.sym_visibility) attrs.append("sym_visibility", prop.sym_visibility); + + if (prop.unnamed_addr) attrs.append("unnamed_addr", prop.unnamed_addr); + + if (prop.visibility_) attrs.append("visibility_", prop.visibility_); + + if (prop.vscale_range) attrs.append("vscale_range", prop.vscale_range); +} + +::mlir::LogicalResult LLVMFuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCConvAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps28(attr, "CConv", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "alignment", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps29(attr, "arg_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getArmLocallyStreamingAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "arm_locally_streaming", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getArmStreamingAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "arm_streaming", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getComdatAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps23(attr, "comdat", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getDsoLocalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "dso_local", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunctionEntryCountAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "function_entry_count", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(attr, "function_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getGarbageCollectorAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "garbageCollector", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLinkageAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(attr, "linkage", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMemoryAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps30(attr, "memory", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getPassthroughAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps27(attr, "passthrough", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getPersonalityAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps0(attr, "personality", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps29(attr, "res_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSectionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "section", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymVisibilityAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "sym_visibility", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUnnamedAddrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(attr, "unnamed_addr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getVisibility_AttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps24(attr, "visibility_", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getVscaleRangeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps31(attr, "vscale_range", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LLVMFuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.CConv))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.arm_locally_streaming))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.arm_streaming))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.comdat))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.dso_local))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.function_entry_count))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.function_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.garbageCollector))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.linkage))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.memory))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.passthrough))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.personality))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.section))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.sym_visibility))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.unnamed_addr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.visibility_))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.vscale_range))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LLVMFuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.CConv); + + writer.writeOptionalAttribute(prop.alignment); + + writer.writeOptionalAttribute(prop.arg_attrs); + + writer.writeOptionalAttribute(prop.arm_locally_streaming); + + writer.writeOptionalAttribute(prop.arm_streaming); + + writer.writeOptionalAttribute(prop.comdat); + + writer.writeOptionalAttribute(prop.dso_local); + + writer.writeOptionalAttribute(prop.function_entry_count); + writer.writeAttribute(prop.function_type); + + writer.writeOptionalAttribute(prop.garbageCollector); + + writer.writeOptionalAttribute(prop.linkage); + + writer.writeOptionalAttribute(prop.memory); + + writer.writeOptionalAttribute(prop.passthrough); + + writer.writeOptionalAttribute(prop.personality); + + writer.writeOptionalAttribute(prop.res_attrs); + + writer.writeOptionalAttribute(prop.section); + writer.writeAttribute(prop.sym_name); + + writer.writeOptionalAttribute(prop.sym_visibility); + + writer.writeOptionalAttribute(prop.unnamed_addr); + + writer.writeOptionalAttribute(prop.visibility_); + + writer.writeOptionalAttribute(prop.vscale_range); +} + +::mlir::StringAttr LLVMFuncOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef LLVMFuncOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::StringAttr LLVMFuncOp::getSymVisibilityAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); +} + +::std::optional< ::llvm::StringRef > LLVMFuncOp::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::TypeAttr LLVMFuncOp::getFunctionTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); +} + +::mlir::LLVM::LLVMFunctionType LLVMFuncOp::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::LLVM::LLVMFunctionType>(attr.getValue()); +} + +::mlir::LLVM::LinkageAttr LLVMFuncOp::getLinkageAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::LinkageAttr>(getProperties().linkage); +} + +::mlir::LLVM::Linkage LLVMFuncOp::getLinkage() { + auto attr = getLinkageAttr(); + return attr.getLinkage(); +} + +::mlir::UnitAttr LLVMFuncOp::getDsoLocalAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().dso_local); +} + +bool LLVMFuncOp::getDsoLocal() { + auto attr = getDsoLocalAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::LLVM::CConvAttr LLVMFuncOp::getCConvAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::CConvAttr>(getProperties().CConv); +} + +::mlir::LLVM::cconv::CConv LLVMFuncOp::getCConv() { + auto attr = getCConvAttr(); + return attr.getCallingConv(); +} + +::mlir::SymbolRefAttr LLVMFuncOp::getComdatAttr() { + return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().comdat); +} + +::std::optional< ::mlir::SymbolRefAttr > LLVMFuncOp::getComdat() { + auto attr = getComdatAttr(); + return attr ? ::std::optional< ::mlir::SymbolRefAttr >(attr) : (::std::nullopt); +} + +::mlir::FlatSymbolRefAttr LLVMFuncOp::getPersonalityAttr() { + return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().personality); +} + +::std::optional< ::llvm::StringRef > LLVMFuncOp::getPersonality() { + auto attr = getPersonalityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::StringAttr LLVMFuncOp::getGarbageCollectorAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().garbageCollector); +} + +::std::optional< ::llvm::StringRef > LLVMFuncOp::getGarbageCollector() { + auto attr = getGarbageCollectorAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr LLVMFuncOp::getPassthroughAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().passthrough); +} + +::std::optional< ::mlir::ArrayAttr > LLVMFuncOp::getPassthrough() { + auto attr = getPassthroughAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LLVMFuncOp::getArgAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); +} + +::std::optional< ::mlir::ArrayAttr > LLVMFuncOp::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LLVMFuncOp::getResAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); +} + +::std::optional< ::mlir::ArrayAttr > LLVMFuncOp::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::IntegerAttr LLVMFuncOp::getFunctionEntryCountAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().function_entry_count); +} + +::std::optional LLVMFuncOp::getFunctionEntryCount() { + auto attr = getFunctionEntryCountAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::LLVM::MemoryEffectsAttr LLVMFuncOp::getMemoryAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::MemoryEffectsAttr>(getProperties().memory); +} + +::std::optional<::mlir::LLVM::MemoryEffectsAttr> LLVMFuncOp::getMemory() { + auto attr = getMemoryAttr(); + return attr ? ::std::optional<::mlir::LLVM::MemoryEffectsAttr>(::llvm::cast<::mlir::LLVM::MemoryEffectsAttr>(attr)) : (::std::nullopt); +} + +::mlir::LLVM::VisibilityAttr LLVMFuncOp::getVisibility_Attr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(getProperties().visibility_); +} + +::mlir::LLVM::Visibility LLVMFuncOp::getVisibility_() { + auto attr = getVisibility_Attr(); + return attr.getValue(); +} + +::mlir::UnitAttr LLVMFuncOp::getArmStreamingAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_streaming); +} + +::std::optional LLVMFuncOp::getArmStreaming() { + auto attr = getArmStreamingAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +::mlir::UnitAttr LLVMFuncOp::getArmLocallyStreamingAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().arm_locally_streaming); +} + +::std::optional LLVMFuncOp::getArmLocallyStreaming() { + auto attr = getArmLocallyStreamingAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +::mlir::StringAttr LLVMFuncOp::getSectionAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().section); +} + +::std::optional< ::llvm::StringRef > LLVMFuncOp::getSection() { + auto attr = getSectionAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::LLVM::UnnamedAddrAttr LLVMFuncOp::getUnnamedAddrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::UnnamedAddrAttr>(getProperties().unnamed_addr); +} + +::std::optional<::mlir::LLVM::UnnamedAddr> LLVMFuncOp::getUnnamedAddr() { + auto attr = getUnnamedAddrAttr(); + return attr ? ::std::optional<::mlir::LLVM::UnnamedAddr>(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr LLVMFuncOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional LLVMFuncOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::LLVM::VScaleRangeAttr LLVMFuncOp::getVscaleRangeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::VScaleRangeAttr>(getProperties().vscale_range); +} + +::std::optional<::mlir::LLVM::VScaleRangeAttr> LLVMFuncOp::getVscaleRange() { + auto attr = getVscaleRangeAttr(); + return attr ? ::std::optional<::mlir::LLVM::VScaleRangeAttr>(::llvm::cast<::mlir::LLVM::VScaleRangeAttr>(attr)) : (::std::nullopt); +} + +void LLVMFuncOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void LLVMFuncOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void LLVMFuncOp::setSymVisibilityAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymVisibilityAttrName(), attr); +} + +void LLVMFuncOp::setSymVisibility(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSymVisibilityAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSymVisibilityAttrName()); +} + +void LLVMFuncOp::setFunctionTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getFunctionTypeAttrName(), attr); +} + +void LLVMFuncOp::setFunctionType(::mlir::LLVM::LLVMFunctionType attrValue) { + (*this)->setAttr(getFunctionTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void LLVMFuncOp::setLinkageAttr(::mlir::LLVM::LinkageAttr attr) { + (*this)->setAttr(getLinkageAttrName(), attr); +} + +void LLVMFuncOp::setLinkage(::mlir::LLVM::Linkage attrValue) { + (*this)->setAttr(getLinkageAttrName(), ::mlir::LLVM::LinkageAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void LLVMFuncOp::setDsoLocalAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getDsoLocalAttrName(), attr); +} + +void LLVMFuncOp::setDsoLocal(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getDsoLocalAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getDsoLocalAttrName()); +} + +void LLVMFuncOp::setCConvAttr(::mlir::LLVM::CConvAttr attr) { + (*this)->setAttr(getCConvAttrName(), attr); +} + +void LLVMFuncOp::setCConv(::mlir::LLVM::cconv::CConv attrValue) { + (*this)->setAttr(getCConvAttrName(), ::mlir::LLVM::CConvAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void LLVMFuncOp::setComdatAttr(::mlir::SymbolRefAttr attr) { + (*this)->setAttr(getComdatAttrName(), attr); +} + +void LLVMFuncOp::setPersonalityAttr(::mlir::FlatSymbolRefAttr attr) { + (*this)->setAttr(getPersonalityAttrName(), attr); +} + +void LLVMFuncOp::setPersonality(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getPersonalityAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getPersonalityAttrName()); +} + +void LLVMFuncOp::setGarbageCollectorAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getGarbageCollectorAttrName(), attr); +} + +void LLVMFuncOp::setGarbageCollector(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getGarbageCollectorAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getGarbageCollectorAttrName()); +} + +void LLVMFuncOp::setPassthroughAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getPassthroughAttrName(), attr); +} + +void LLVMFuncOp::setArgAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getArgAttrsAttrName(), attr); +} + +void LLVMFuncOp::setResAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getResAttrsAttrName(), attr); +} + +void LLVMFuncOp::setFunctionEntryCountAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getFunctionEntryCountAttrName(), attr); +} + +void LLVMFuncOp::setFunctionEntryCount(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getFunctionEntryCountAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getFunctionEntryCountAttrName()); +} + +void LLVMFuncOp::setMemoryAttr(::mlir::LLVM::MemoryEffectsAttr attr) { + (*this)->setAttr(getMemoryAttrName(), attr); +} + +void LLVMFuncOp::setVisibility_Attr(::mlir::LLVM::VisibilityAttr attr) { + (*this)->setAttr(getVisibility_AttrName(), attr); +} + +void LLVMFuncOp::setVisibility_(::mlir::LLVM::Visibility attrValue) { + (*this)->setAttr(getVisibility_AttrName(), ::mlir::LLVM::VisibilityAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void LLVMFuncOp::setArmStreamingAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getArmStreamingAttrName(), attr); +} + +void LLVMFuncOp::setArmStreaming(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getArmStreamingAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getArmStreamingAttrName()); +} + +void LLVMFuncOp::setArmLocallyStreamingAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getArmLocallyStreamingAttrName(), attr); +} + +void LLVMFuncOp::setArmLocallyStreaming(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getArmLocallyStreamingAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getArmLocallyStreamingAttrName()); +} + +void LLVMFuncOp::setSectionAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSectionAttrName(), attr); +} + +void LLVMFuncOp::setSection(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSectionAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSectionAttrName()); +} + +void LLVMFuncOp::setUnnamedAddrAttr(::mlir::LLVM::UnnamedAddrAttr attr) { + (*this)->setAttr(getUnnamedAddrAttrName(), attr); +} + +void LLVMFuncOp::setUnnamedAddr(::std::optional<::mlir::LLVM::UnnamedAddr> attrValue) { + if (attrValue) + return (*this)->setAttr(getUnnamedAddrAttrName(), ::mlir::LLVM::UnnamedAddrAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getUnnamedAddrAttrName()); +} + +void LLVMFuncOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void LLVMFuncOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +void LLVMFuncOp::setVscaleRangeAttr(::mlir::LLVM::VScaleRangeAttr attr) { + (*this)->setAttr(getVscaleRangeAttrName(), attr); +} + +::mlir::Attribute LLVMFuncOp::removeSymVisibilityAttr() { + auto &attr = getProperties().sym_visibility; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeDsoLocalAttr() { + auto &attr = getProperties().dso_local; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeComdatAttr() { + auto &attr = getProperties().comdat; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removePersonalityAttr() { + auto &attr = getProperties().personality; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeGarbageCollectorAttr() { + auto &attr = getProperties().garbageCollector; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removePassthroughAttr() { + auto &attr = getProperties().passthrough; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeArgAttrsAttr() { + auto &attr = getProperties().arg_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeResAttrsAttr() { + auto &attr = getProperties().res_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeFunctionEntryCountAttr() { + auto &attr = getProperties().function_entry_count; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeMemoryAttr() { + auto &attr = getProperties().memory; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeArmStreamingAttr() { + auto &attr = getProperties().arm_streaming; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeArmLocallyStreamingAttr() { + auto &attr = getProperties().arm_locally_streaming; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeSectionAttr() { + auto &attr = getProperties().section; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeUnnamedAddrAttr() { + auto &attr = getProperties().unnamed_addr; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +::mlir::Attribute LLVMFuncOp::removeVscaleRangeAttr() { + auto &attr = getProperties().vscale_range; + attr = {}; + return attr; +} + +void LLVMFuncOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.linkage) + properties.linkage = ::mlir::LLVM::LinkageAttr::get(odsBuilder.getContext(), Linkage::External); + if (!properties.CConv) + properties.CConv = ::mlir::LLVM::CConvAttr::get(odsBuilder.getContext(), CConv::C); + if (!properties.visibility_) + properties.visibility_ = ::mlir::LLVM::VisibilityAttr::get(odsBuilder.getContext(), mlir::LLVM::Visibility::Default); +} + +::mlir::LogicalResult LLVMFuncOp::verifyInvariantsImpl() { + auto tblgen_CConv = getProperties().CConv; (void)tblgen_CConv; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_arm_locally_streaming = getProperties().arm_locally_streaming; (void)tblgen_arm_locally_streaming; + auto tblgen_arm_streaming = getProperties().arm_streaming; (void)tblgen_arm_streaming; + auto tblgen_comdat = getProperties().comdat; (void)tblgen_comdat; + auto tblgen_dso_local = getProperties().dso_local; (void)tblgen_dso_local; + auto tblgen_function_entry_count = getProperties().function_entry_count; (void)tblgen_function_entry_count; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'"); + auto tblgen_garbageCollector = getProperties().garbageCollector; (void)tblgen_garbageCollector; + auto tblgen_linkage = getProperties().linkage; (void)tblgen_linkage; + auto tblgen_memory = getProperties().memory; (void)tblgen_memory; + auto tblgen_passthrough = getProperties().passthrough; (void)tblgen_passthrough; + auto tblgen_personality = getProperties().personality; (void)tblgen_personality; + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_section = getProperties().section; (void)tblgen_section; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + auto tblgen_unnamed_addr = getProperties().unnamed_addr; (void)tblgen_unnamed_addr; + auto tblgen_visibility_ = getProperties().visibility_; (void)tblgen_visibility_; + auto tblgen_vscale_range = getProperties().vscale_range; (void)tblgen_vscale_range; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_sym_visibility, "sym_visibility"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps12(*this, tblgen_function_type, "function_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps20(*this, tblgen_linkage, "linkage"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_dso_local, "dso_local"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps28(*this, tblgen_CConv, "CConv"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps23(*this, tblgen_comdat, "comdat"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps0(*this, tblgen_personality, "personality"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_garbageCollector, "garbageCollector"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps27(*this, tblgen_passthrough, "passthrough"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps29(*this, tblgen_arg_attrs, "arg_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps29(*this, tblgen_res_attrs, "res_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_function_entry_count, "function_entry_count"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps30(*this, tblgen_memory, "memory"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps24(*this, tblgen_visibility_, "visibility_"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_arm_streaming, "arm_streaming"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_arm_locally_streaming, "arm_locally_streaming"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_section, "section"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps22(*this, tblgen_unnamed_addr, "unnamed_addr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps31(*this, tblgen_vscale_range, "vscale_range"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LLVMOps1(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LLVMFuncOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMFuncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LShrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LShrOpGenericAdaptorBase::LShrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.lshr", odsAttrs.getContext()); +} + +LShrOpGenericAdaptorBase::LShrOpGenericAdaptorBase(LShrOp op) : LShrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LShrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LShrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +LShrOpAdaptor::LShrOpAdaptor(LShrOp op) : LShrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LShrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LShrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LShrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LShrOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value LShrOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &LShrOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &LShrOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair LShrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LShrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LShrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LShrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LShrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void LShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LShrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult LShrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LShrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult LShrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult LShrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LShrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void LShrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LShrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LandingpadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LandingpadOpGenericAdaptorBase::LandingpadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.landingpad", odsAttrs.getContext()); +} + +LandingpadOpGenericAdaptorBase::LandingpadOpGenericAdaptorBase(LandingpadOp op) : LandingpadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LandingpadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr LandingpadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr LandingpadOpGenericAdaptorBase::getCleanupAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().cleanup); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LandingpadOpGenericAdaptorBase::getCleanup() { + auto attr = getCleanupAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +LandingpadOpAdaptor::LandingpadOpAdaptor(LandingpadOp op) : LandingpadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LandingpadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_cleanup = getProperties().cleanup; (void)tblgen_cleanup; + + if (tblgen_cleanup && !((::llvm::isa<::mlir::UnitAttr>(tblgen_cleanup)))) + return emitError(loc, "'llvm.landingpad' op ""attribute 'cleanup' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair LandingpadOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range LandingpadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair LandingpadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LandingpadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LandingpadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult LandingpadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cleanup; + auto attr = dict.get("cleanup"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for cleanup in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cleanup` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LandingpadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cleanup; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cleanup", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LandingpadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.cleanup.getAsOpaquePointer())); +} + +std::optional LandingpadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cleanup") + return prop.cleanup; + return std::nullopt; +} + +void LandingpadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cleanup") { + prop.cleanup = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LandingpadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cleanup) attrs.append("cleanup", prop.cleanup); +} + +::mlir::LogicalResult LandingpadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCleanupAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "cleanup", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LandingpadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.cleanup))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LandingpadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.cleanup); +} + +::mlir::UnitAttr LandingpadOp::getCleanupAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().cleanup); +} + +bool LandingpadOp::getCleanup() { + auto attr = getCleanupAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void LandingpadOp::setCleanupAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getCleanupAttrName(), attr); +} + +void LandingpadOp::setCleanup(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getCleanupAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getCleanupAttrName()); +} + +::mlir::Attribute LandingpadOp::removeCleanupAttr() { + auto &attr = getProperties().cleanup; + attr = {}; + return attr; +} + +void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0) { + odsState.addOperands(odsArg_0); + if (cleanup) { + odsState.getOrAddProperties().cleanup = cleanup; + } + odsState.addTypes(res); +} + +void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0) { + odsState.addOperands(odsArg_0); + if (cleanup) { + odsState.getOrAddProperties().cleanup = cleanup; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0) { + odsState.addOperands(odsArg_0); + if (cleanup) { + odsState.getOrAddProperties().cleanup = ((cleanup) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(res); +} + +void LandingpadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0) { + odsState.addOperands(odsArg_0); + if (cleanup) { + odsState.getOrAddProperties().cleanup = ((cleanup) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LandingpadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LandingpadOp::verifyInvariantsImpl() { + auto tblgen_cleanup = getProperties().cleanup; (void)tblgen_cleanup; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_cleanup, "cleanup"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LandingpadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LandingpadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LoadOpGenericAdaptorBase::LoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.load", odsAttrs.getContext()); +} + +LoadOpGenericAdaptorBase::LoadOpGenericAdaptorBase(LoadOp op) : LoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr LoadOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional LoadOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr LoadOpGenericAdaptorBase::getVolatile_Attr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LoadOpGenericAdaptorBase::getVolatile_() { + auto attr = getVolatile_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoadOpGenericAdaptorBase::getNontemporalAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nontemporal); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LoadOpGenericAdaptorBase::getNontemporal() { + auto attr = getNontemporalAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::LLVM::AtomicOrderingAttr LoadOpGenericAdaptorBase::getOrderingAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering); + return attr; +} + +::mlir::LLVM::AtomicOrdering LoadOpGenericAdaptorBase::getOrdering() { + auto attr = getOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr LoadOpGenericAdaptorBase::getSyncscopeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); + return attr; +} + +::std::optional< ::llvm::StringRef > LoadOpGenericAdaptorBase::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr LoadOpGenericAdaptorBase::getAccessGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > LoadOpGenericAdaptorBase::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LoadOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > LoadOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LoadOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > LoadOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LoadOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > LoadOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +LoadOpAdaptor::LoadOpAdaptor(LoadOp op) : LoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal; + auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering; + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_; + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.load' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_volatile_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_volatile_)))) + return emitError(loc, "'llvm.load' op ""attribute 'volatile_' failed to satisfy constraint: unit attribute"); + + if (tblgen_nontemporal && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nontemporal)))) + return emitError(loc, "'llvm.load' op ""attribute 'nontemporal' failed to satisfy constraint: unit attribute"); + + if (tblgen_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_ordering)))) + return emitError(loc, "'llvm.load' op ""attribute 'ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model"); + + if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope)))) + return emitError(loc, "'llvm.load' op ""attribute 'syncscope' failed to satisfy constraint: string attribute"); + + if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError(loc, "'llvm.load' op ""attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array"); + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.load' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.load' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'llvm.load' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair LoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> LoadOp::getAddr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LoadOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LoadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult LoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.access_groups; + auto attr = dict.get("access_groups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for access_groups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `access_groups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.nontemporal; + auto attr = dict.get("nontemporal"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nontemporal in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nontemporal` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.ordering; + auto attr = dict.get("ordering"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for ordering in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `ordering` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.syncscope; + auto attr = dict.get("syncscope"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for syncscope in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `syncscope` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.volatile_; + auto attr = dict.get("volatile_"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for volatile_ in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `volatile_` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.access_groups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("access_groups", + propStorage)); + } + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.nontemporal; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nontemporal", + propStorage)); + } + + { + const auto &propStorage = prop.ordering; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("ordering", + propStorage)); + } + + { + const auto &propStorage = prop.syncscope; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("syncscope", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + { + const auto &propStorage = prop.volatile_; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("volatile_", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.access_groups.getAsOpaquePointer()), + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.nontemporal.getAsOpaquePointer()), + llvm::hash_value(prop.ordering.getAsOpaquePointer()), + llvm::hash_value(prop.syncscope.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer()), + llvm::hash_value(prop.volatile_.getAsOpaquePointer())); +} + +std::optional LoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "access_groups") + return prop.access_groups; + + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "alignment") + return prop.alignment; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "nontemporal") + return prop.nontemporal; + + if (name == "ordering") + return prop.ordering; + + if (name == "syncscope") + return prop.syncscope; + + if (name == "tbaa") + return prop.tbaa; + + if (name == "volatile_") + return prop.volatile_; + return std::nullopt; +} + +void LoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "access_groups") { + prop.access_groups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "nontemporal") { + prop.nontemporal = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "ordering") { + prop.ordering = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "syncscope") { + prop.syncscope = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "volatile_") { + prop.volatile_ = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.access_groups) attrs.append("access_groups", prop.access_groups); + + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.alignment) attrs.append("alignment", prop.alignment); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.nontemporal) attrs.append("nontemporal", prop.nontemporal); + + if (prop.ordering) attrs.append("ordering", prop.ordering); + + if (prop.syncscope) attrs.append("syncscope", prop.syncscope); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); + + if (prop.volatile_) attrs.append("volatile_", prop.volatile_); +} + +::mlir::LogicalResult LoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(attr, "access_groups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "alignment", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNontemporalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "nontemporal", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getOrderingAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "ordering", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "syncscope", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getVolatile_AttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "volatile_", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.nontemporal))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.ordering))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.volatile_))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.access_groups); + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.alignment); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.nontemporal); + + writer.writeOptionalAttribute(prop.ordering); + + writer.writeOptionalAttribute(prop.syncscope); + + writer.writeOptionalAttribute(prop.tbaa); + + writer.writeOptionalAttribute(prop.volatile_); +} + +::mlir::IntegerAttr LoadOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional LoadOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr LoadOp::getVolatile_Attr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_); +} + +bool LoadOp::getVolatile_() { + auto attr = getVolatile_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoadOp::getNontemporalAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nontemporal); +} + +bool LoadOp::getNontemporal() { + auto attr = getNontemporalAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::LLVM::AtomicOrderingAttr LoadOp::getOrderingAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering); +} + +::mlir::LLVM::AtomicOrdering LoadOp::getOrdering() { + auto attr = getOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr LoadOp::getSyncscopeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); +} + +::std::optional< ::llvm::StringRef > LoadOp::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr LoadOp::getAccessGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); +} + +::std::optional< ::mlir::ArrayAttr > LoadOp::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LoadOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > LoadOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LoadOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > LoadOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LoadOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > LoadOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void LoadOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void LoadOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +void LoadOp::setVolatile_Attr(::mlir::UnitAttr attr) { + (*this)->setAttr(getVolatile_AttrName(), attr); +} + +void LoadOp::setVolatile_(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getVolatile_AttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getVolatile_AttrName()); +} + +void LoadOp::setNontemporalAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNontemporalAttrName(), attr); +} + +void LoadOp::setNontemporal(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNontemporalAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNontemporalAttrName()); +} + +void LoadOp::setOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr) { + (*this)->setAttr(getOrderingAttrName(), attr); +} + +void LoadOp::setOrdering(::mlir::LLVM::AtomicOrdering attrValue) { + (*this)->setAttr(getOrderingAttrName(), ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void LoadOp::setSyncscopeAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSyncscopeAttrName(), attr); +} + +void LoadOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSyncscopeAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSyncscopeAttrName()); +} + +void LoadOp::setAccessGroupsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAccessGroupsAttrName(), attr); +} + +void LoadOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void LoadOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void LoadOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute LoadOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +::mlir::Attribute LoadOp::removeVolatile_Attr() { + auto &attr = getProperties().volatile_; + attr = {}; + return attr; +} + +::mlir::Attribute LoadOp::removeNontemporalAttr() { + auto &attr = getProperties().nontemporal; + attr = {}; + return attr; +} + +::mlir::Attribute LoadOp::removeSyncscopeAttr() { + auto &attr = getProperties().syncscope; + attr = {}; + return attr; +} + +::mlir::Attribute LoadOp::removeAccessGroupsAttr() { + auto &attr = getProperties().access_groups; + attr = {}; + return attr; +} + +::mlir::Attribute LoadOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute LoadOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute LoadOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(addr); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = nontemporal; + } + if (ordering) { + odsState.getOrAddProperties().ordering = ordering; + } + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(res); +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(addr); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = nontemporal; + } + if (ordering) { + odsState.getOrAddProperties().ordering = ordering; + } + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(addr); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.getOrAddProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(res); +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(addr); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.getOrAddProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void LoadOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.ordering) + properties.ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), AtomicOrdering::not_atomic); +} + +::mlir::LogicalResult LoadOp::verifyInvariantsImpl() { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal; + auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering; + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_volatile_, "volatile_"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_nontemporal, "nontemporal"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_ordering, "ordering"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_syncscope, "syncscope"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(*this, tblgen_access_groups, "access_groups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps18(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps19(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LoadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult LoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::StringAttr syncscopeAttr; + ::mlir::LLVM::AtomicOrderingAttr orderingAttr; + ::mlir::Type addrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> addrTypes(addrRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + if (::mlir::succeeded(parser.parseOptionalKeyword("volatile"))) { + result.getOrAddProperties().volatile_ = parser.getBuilder().getUnitAttr(); } + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("atomic"))) { + if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (syncscopeAttr) result.getOrAddProperties().syncscope = syncscopeAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "ordering", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "ordering attribute specification: \"" << attrStr << '"';; + + orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().ordering = orderingAttr; + } + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + { + auto odsResult = parseLoadType(parser, addrRawTypes[0], resRawTypes[0]); + if (odsResult) return ::mlir::failure(); + } + result.addTypes(resTypes); + if (parser.resolveOperands(addrOperands, addrTypes, addrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getVolatile_Attr()) { + _odsPrinter << ' ' << "volatile"; + } + _odsPrinter << ' '; + _odsPrinter << getAddr(); + if (getOrderingAttr() && getOrderingAttr() != ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), AtomicOrdering::not_atomic)) { + _odsPrinter << ' ' << "atomic"; + if (getSyncscopeAttr()) { + _odsPrinter << ' ' << "syncscope"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getSyncscopeAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + + { + auto caseValue = getOrdering(); + auto caseValueStr = stringifyAtomicOrdering(caseValue); + _odsPrinter << caseValueStr; + } + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("volatile_"); + elidedAttrs.push_back("syncscope"); + elidedAttrs.push_back("ordering"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getVolatile_Attr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("volatile_"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNontemporalAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nontemporal"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getOrderingAttr(); + if(attr && (attr == ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), AtomicOrdering::not_atomic))) + elidedAttrs.push_back("ordering"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + printLoadType(_odsPrinter, *this, getAddr().getType(), getRes().getType()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mul", odsAttrs.getContext()); +} + +MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(MulOp op) : MulOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MulOpAdaptor::MulOpAdaptor(MulOp op) : MulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MulOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MulOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MulOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MulOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MulOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MulOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(MulOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult MulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult MulOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult MulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MulOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::NoneTokenOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +NoneTokenOpGenericAdaptorBase::NoneTokenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mlir.none", odsAttrs.getContext()); +} + +NoneTokenOpGenericAdaptorBase::NoneTokenOpGenericAdaptorBase(NoneTokenOp op) : NoneTokenOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair NoneTokenOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr NoneTokenOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +NoneTokenOpAdaptor::NoneTokenOpAdaptor(NoneTokenOp op) : NoneTokenOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult NoneTokenOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair NoneTokenOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range NoneTokenOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair NoneTokenOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range NoneTokenOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value NoneTokenOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NoneTokenOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NoneTokenOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void NoneTokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(NoneTokenOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult NoneTokenOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps20(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult NoneTokenOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult NoneTokenOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::mlir::LLVM::LLVMTokenType::get(odsBuilder.getContext()); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult NoneTokenOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void NoneTokenOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void NoneTokenOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::NoneTokenOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::OrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +OrOpGenericAdaptorBase::OrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.or", odsAttrs.getContext()); +} + +OrOpGenericAdaptorBase::OrOpGenericAdaptorBase(OrOp op) : OrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair OrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr OrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +OrOpAdaptor::OrOpAdaptor(OrOp op) : OrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult OrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair OrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range OrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value OrOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value OrOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &OrOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &OrOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair OrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range OrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value OrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(OrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void OrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void OrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(OrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult OrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult OrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult OrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult OrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void OrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::OrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PoisonOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoisonOpGenericAdaptorBase::PoisonOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mlir.poison", odsAttrs.getContext()); +} + +PoisonOpGenericAdaptorBase::PoisonOpGenericAdaptorBase(PoisonOp op) : PoisonOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoisonOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PoisonOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +PoisonOpAdaptor::PoisonOpAdaptor(PoisonOp op) : PoisonOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoisonOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair PoisonOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range PoisonOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair PoisonOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PoisonOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value PoisonOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void PoisonOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void PoisonOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void PoisonOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PoisonOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult PoisonOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoisonOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult PoisonOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void PoisonOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void PoisonOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::PoisonOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PtrToIntOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PtrToIntOpGenericAdaptorBase::PtrToIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.ptrtoint", odsAttrs.getContext()); +} + +PtrToIntOpGenericAdaptorBase::PtrToIntOpGenericAdaptorBase(PtrToIntOp op) : PtrToIntOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PtrToIntOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PtrToIntOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +PtrToIntOpAdaptor::PtrToIntOpAdaptor(PtrToIntOp op) : PtrToIntOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PtrToIntOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair PtrToIntOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range PtrToIntOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value PtrToIntOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &PtrToIntOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair PtrToIntOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PtrToIntOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value PtrToIntOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void PtrToIntOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void PtrToIntOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void PtrToIntOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PtrToIntOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult PtrToIntOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PtrToIntOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult PtrToIntOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PtrToIntOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void PtrToIntOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::PtrToIntOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ResumeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ResumeOpGenericAdaptorBase::ResumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.resume", odsAttrs.getContext()); +} + +ResumeOpGenericAdaptorBase::ResumeOpGenericAdaptorBase(ResumeOp op) : ResumeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ResumeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ResumeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ResumeOpAdaptor::ResumeOpAdaptor(ResumeOp op) : ResumeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ResumeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ResumeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ResumeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ResumeOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ResumeOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ResumeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ResumeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value) { + odsState.addOperands(value); +} + +void ResumeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) { + odsState.addOperands(value); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ResumeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ResumeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ResumeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ResumeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ResumeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ResumeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ReturnOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.return", odsAttrs.getContext()); +} + +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(ReturnOp op) : ReturnOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReturnOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ReturnOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ReturnOpAdaptor::ReturnOpAdaptor(ReturnOp op) : ReturnOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReturnOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ReturnOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ReturnOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ReturnOp::getArg() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::MutableOperandRange ReturnOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ReturnOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReturnOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange args) { + build(odsBuilder, odsState, TypeRange(), args); + +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value arg) { + if (arg) + odsState.addOperands(arg); +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value arg) { + if (arg) + odsState.addOperands(arg); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReturnOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReturnOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReturnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argOperands; + ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> argTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + { + argOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + argOperands.push_back(operand); + } + } + if (!argOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + argTypes.push_back(optionalType); + } + } + } + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (getArg()) { + _odsPrinter << ' '; + if (::mlir::Value value = getArg()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getArg() ? ::llvm::ArrayRef<::mlir::Type>(getArg().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + } +} + +void ReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange ReturnOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ReturnOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SDivOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SDivOpGenericAdaptorBase::SDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.sdiv", odsAttrs.getContext()); +} + +SDivOpGenericAdaptorBase::SDivOpGenericAdaptorBase(SDivOp op) : SDivOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SDivOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SDivOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SDivOpAdaptor::SDivOpAdaptor(SDivOp op) : SDivOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SDivOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SDivOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SDivOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SDivOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SDivOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SDivOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SDivOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SDivOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SDivOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SDivOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SDivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SDivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SDivOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SDivOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SDivOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SExtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SExtOpGenericAdaptorBase::SExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.sext", odsAttrs.getContext()); +} + +SExtOpGenericAdaptorBase::SExtOpGenericAdaptorBase(SExtOp op) : SExtOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SExtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SExtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SExtOpAdaptor::SExtOpAdaptor(SExtOp op) : SExtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SExtOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SExtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SExtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SExtOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SExtOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SExtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SExtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SExtOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void SExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void SExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SExtOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SExtOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SExtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SExtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SExtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SIToFPOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SIToFPOpGenericAdaptorBase::SIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.sitofp", odsAttrs.getContext()); +} + +SIToFPOpGenericAdaptorBase::SIToFPOpGenericAdaptorBase(SIToFPOp op) : SIToFPOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SIToFPOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SIToFPOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SIToFPOpAdaptor::SIToFPOpAdaptor(SIToFPOp op) : SIToFPOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SIToFPOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SIToFPOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SIToFPOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SIToFPOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SIToFPOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SIToFPOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SIToFPOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SIToFPOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SIToFPOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SIToFPOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SIToFPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SIToFPOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SIToFPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SIToFPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SRemOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SRemOpGenericAdaptorBase::SRemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.srem", odsAttrs.getContext()); +} + +SRemOpGenericAdaptorBase::SRemOpGenericAdaptorBase(SRemOp op) : SRemOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SRemOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SRemOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SRemOpAdaptor::SRemOpAdaptor(SRemOp op) : SRemOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SRemOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SRemOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SRemOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SRemOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SRemOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SRemOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SRemOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SRemOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SRemOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SRemOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SRemOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SRemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SRemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SRemOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SRemOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SRemOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SRemOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SRemOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SRemOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SRemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SRemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SelectOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SelectOpGenericAdaptorBase::SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.select", odsAttrs.getContext()); +} + +SelectOpGenericAdaptorBase::SelectOpGenericAdaptorBase(SelectOp op) : SelectOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SelectOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SelectOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::LLVM::FastmathFlagsAttr SelectOpGenericAdaptorBase::getFastmathFlagsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); + return attr; +} + +::mlir::LLVM::FastmathFlags SelectOpGenericAdaptorBase::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +} // namespace detail +SelectOpAdaptor::SelectOpAdaptor(SelectOp op) : SelectOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SelectOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (tblgen_fastmathFlags && !((::llvm::isa<::mlir::LLVM::FastmathFlagsAttr>(tblgen_fastmathFlags)))) + return emitError(loc, "'llvm.select' op ""attribute 'fastmathFlags' failed to satisfy constraint: LLVM fastmath flags"); + return ::mlir::success(); +} + +std::pair SelectOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SelectOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SelectOp::getCondition() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SelectOp::getTrueValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value SelectOp::getFalseValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &SelectOp::getConditionMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SelectOp::getTrueValueMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SelectOp::getFalseValueMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair SelectOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SelectOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SelectOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SelectOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmathFlags; + auto attr = dict.get("fastmathFlags"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmathFlags in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmathFlags` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SelectOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmathFlags; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmathFlags", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SelectOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmathFlags.getAsOpaquePointer())); +} + +std::optional SelectOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmathFlags") + return prop.fastmathFlags; + return std::nullopt; +} + +void SelectOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmathFlags") { + prop.fastmathFlags = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SelectOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmathFlags) attrs.append("fastmathFlags", prop.fastmathFlags); +} + +::mlir::LogicalResult SelectOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathFlagsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(attr, "fastmathFlags", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SelectOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmathFlags))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SelectOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmathFlags); +} + +::mlir::LLVM::FastmathFlagsAttr SelectOp::getFastmathFlagsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(getProperties().fastmathFlags); +} + +::mlir::LLVM::FastmathFlags SelectOp::getFastmathFlags() { + auto attr = getFastmathFlagsAttr(); + return attr.getValue(); +} + +void SelectOp::setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr) { + (*this)->setAttr(getFastmathFlagsAttrName(), attr); +} + +void SelectOp::setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue) { + (*this)->setAttr(getFastmathFlagsAttrName(), ::mlir::LLVM::FastmathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(condition); + odsState.addOperands(trueValue); + odsState.addOperands(falseValue); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + odsState.addTypes(res); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(condition); + odsState.addOperands(trueValue); + odsState.addOperands(falseValue); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags) { + odsState.addOperands(condition); + odsState.addOperands(trueValue); + odsState.addOperands(falseValue); + if (fastmathFlags) { + odsState.getOrAddProperties().fastmathFlags = fastmathFlags; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(condition); + odsState.addOperands(trueValue); + odsState.addOperands(falseValue); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + odsState.addTypes(res); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(condition); + odsState.addOperands(trueValue); + odsState.addOperands(falseValue); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags) { + odsState.addOperands(condition); + odsState.addOperands(trueValue); + odsState.addOperands(falseValue); + odsState.getOrAddProperties().fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), fastmathFlags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SelectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SelectOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmathFlags) + properties.fastmathFlags = ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}); +} + +::mlir::LogicalResult SelectOp::verifyInvariantsImpl() { + auto tblgen_fastmathFlags = getProperties().fastmathFlags; (void)tblgen_fastmathFlags; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps11(*this, tblgen_fastmathFlags, "fastmathFlags"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps15(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType())))) + return emitOpError("failed to verify that all of {trueValue, falseValue, res} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult SelectOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SelectOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[2].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SelectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type conditionRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> conditionTypes(conditionRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + conditionRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(conditionTypes), ::llvm::ArrayRef<::mlir::Type>(resTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resTypes[0])), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SelectOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathFlagsAttr(); + if(attr && (attr == ::mlir::LLVM::FastmathFlagsAttr::get(odsBuilder.getContext(), {}))) + elidedAttrs.push_back("fastmathFlags"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getCondition().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SelectOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SelectOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ShlOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShlOpGenericAdaptorBase::ShlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.shl", odsAttrs.getContext()); +} + +ShlOpGenericAdaptorBase::ShlOpGenericAdaptorBase(ShlOp op) : ShlOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShlOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShlOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ShlOpAdaptor::ShlOpAdaptor(ShlOp op) : ShlOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShlOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ShlOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShlOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShlOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value ShlOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ShlOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShlOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShlOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShlOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShlOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShlOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShlOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ShlOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ShlOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShlOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ShlOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ShlOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShlOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ShlOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ShlOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ShuffleVectorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShuffleVectorOpGenericAdaptorBase::ShuffleVectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.shufflevector", odsAttrs.getContext()); +} + +ShuffleVectorOpGenericAdaptorBase::ShuffleVectorOpGenericAdaptorBase(ShuffleVectorOp op) : ShuffleVectorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShuffleVectorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShuffleVectorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI32ArrayAttr ShuffleVectorOpGenericAdaptorBase::getMaskAttr() { + auto attr = ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().mask); + return attr; +} + +::llvm::ArrayRef ShuffleVectorOpGenericAdaptorBase::getMask() { + auto attr = getMaskAttr(); + return attr; +} + +} // namespace detail +ShuffleVectorOpAdaptor::ShuffleVectorOpAdaptor(ShuffleVectorOp op) : ShuffleVectorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShuffleVectorOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_mask = getProperties().mask; (void)tblgen_mask; + if (!tblgen_mask) return emitError(loc, "'llvm.shufflevector' op ""requires attribute 'mask'"); + + if (tblgen_mask && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mask)))) + return emitError(loc, "'llvm.shufflevector' op ""attribute 'mask' failed to satisfy constraint: i32 dense array attribute"); + return ::mlir::success(); +} + +std::pair ShuffleVectorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShuffleVectorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShuffleVectorOp::getV1() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value ShuffleVectorOp::getV2() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ShuffleVectorOp::getV1Mutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShuffleVectorOp::getV2Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShuffleVectorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShuffleVectorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShuffleVectorOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ShuffleVectorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.mask; + auto attr = dict.get("mask"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for mask in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `mask` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ShuffleVectorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.mask; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("mask", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ShuffleVectorOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.mask.getAsOpaquePointer())); +} + +std::optional ShuffleVectorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "mask") + return prop.mask; + return std::nullopt; +} + +void ShuffleVectorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "mask") { + prop.mask = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ShuffleVectorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.mask) attrs.append("mask", prop.mask); +} + +::mlir::LogicalResult ShuffleVectorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMaskAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(attr, "mask", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShuffleVectorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.mask))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShuffleVectorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.mask); +} + +::mlir::DenseI32ArrayAttr ShuffleVectorOp::getMaskAttr() { + return ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().mask); +} + +::llvm::ArrayRef ShuffleVectorOp::getMask() { + auto attr = getMaskAttr(); + return attr; +} + +void ShuffleVectorOp::setMaskAttr(::mlir::DenseI32ArrayAttr attr) { + (*this)->setAttr(getMaskAttrName(), attr); +} + +void ShuffleVectorOp::setMask(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getMaskAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue)); +} + +void ShuffleVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask) { + odsState.addOperands(v1); + odsState.addOperands(v2); + odsState.getOrAddProperties().mask = mask; + odsState.addTypes(res); +} + +void ShuffleVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask) { + odsState.addOperands(v1); + odsState.addOperands(v2); + odsState.getOrAddProperties().mask = mask; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShuffleVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef mask) { + odsState.addOperands(v1); + odsState.addOperands(v2); + odsState.getOrAddProperties().mask = odsBuilder.getDenseI32ArrayAttr(mask); + odsState.addTypes(res); +} + +void ShuffleVectorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef mask) { + odsState.addOperands(v1); + odsState.addOperands(v2); + odsState.getOrAddProperties().mask = odsBuilder.getDenseI32ArrayAttr(mask); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShuffleVectorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ShuffleVectorOp::verifyInvariantsImpl() { + auto tblgen_mask = getProperties().mask; (void)tblgen_mask; + if (!tblgen_mask) return emitOpError("requires attribute 'mask'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(*this, tblgen_mask, "mask"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps12(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {v1, v2} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult ShuffleVectorOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ShuffleVectorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand v1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> v1Operands(v1RawOperands); ::llvm::SMLoc v1OperandsLoc; + (void)v1OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand v2RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> v2Operands(v2RawOperands); ::llvm::SMLoc v2OperandsLoc; + (void)v2OperandsLoc; + ::mlir::DenseI32ArrayAttr maskAttr; + ::mlir::Type v1RawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> v1Types(v1RawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + v1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(v1RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + v2OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(v2RawOperands[0])) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(maskAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (maskAttr) result.getOrAddProperties().mask = maskAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + v1RawTypes[0] = type; + } + { + auto odsResult = parseShuffleType(parser, v1RawTypes[0], resRawTypes[0], maskAttr); + if (odsResult) return ::mlir::failure(); + } + result.addTypes(resTypes); + if (parser.resolveOperands(v1Operands, v1Types, v1OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(v2Operands, v1Types[0], v2OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShuffleVectorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getV1(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getV2(); + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getMaskAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("mask"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getV1().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' '; + printShuffleType(_odsPrinter, *this, getV1().getType(), getRes().getType(), getMaskAttr()); +} + +void ShuffleVectorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ShuffleVectorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::StoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +StoreOpGenericAdaptorBase::StoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.store", odsAttrs.getContext()); +} + +StoreOpGenericAdaptorBase::StoreOpGenericAdaptorBase(StoreOp op) : StoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair StoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr StoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr StoreOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional StoreOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr StoreOpGenericAdaptorBase::getVolatile_Attr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool StoreOpGenericAdaptorBase::getVolatile_() { + auto attr = getVolatile_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr StoreOpGenericAdaptorBase::getNontemporalAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nontemporal); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool StoreOpGenericAdaptorBase::getNontemporal() { + auto attr = getNontemporalAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::LLVM::AtomicOrderingAttr StoreOpGenericAdaptorBase::getOrderingAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering); + return attr; +} + +::mlir::LLVM::AtomicOrdering StoreOpGenericAdaptorBase::getOrdering() { + auto attr = getOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr StoreOpGenericAdaptorBase::getSyncscopeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); + return attr; +} + +::std::optional< ::llvm::StringRef > StoreOpGenericAdaptorBase::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr StoreOpGenericAdaptorBase::getAccessGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > StoreOpGenericAdaptorBase::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr StoreOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > StoreOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr StoreOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > StoreOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr StoreOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > StoreOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +StoreOpAdaptor::StoreOpAdaptor(StoreOp op) : StoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult StoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal; + auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering; + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_; + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64))))) + return emitError(loc, "'llvm.store' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_volatile_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_volatile_)))) + return emitError(loc, "'llvm.store' op ""attribute 'volatile_' failed to satisfy constraint: unit attribute"); + + if (tblgen_nontemporal && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nontemporal)))) + return emitError(loc, "'llvm.store' op ""attribute 'nontemporal' failed to satisfy constraint: unit attribute"); + + if (tblgen_ordering && !((::llvm::isa<::mlir::LLVM::AtomicOrderingAttr>(tblgen_ordering)))) + return emitError(loc, "'llvm.store' op ""attribute 'ordering' failed to satisfy constraint: Atomic ordering for LLVM's memory model"); + + if (tblgen_syncscope && !((::llvm::isa<::mlir::StringAttr>(tblgen_syncscope)))) + return emitError(loc, "'llvm.store' op ""attribute 'syncscope' failed to satisfy constraint: string attribute"); + + if (tblgen_access_groups && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_access_groups))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_access_groups), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AccessGroupAttr>(attr))); })))) + return emitError(loc, "'llvm.store' op ""attribute 'access_groups' failed to satisfy constraint: LLVM dialect access group metadata array"); + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.store' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'llvm.store' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'llvm.store' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair StoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range StoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value StoreOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> StoreOp::getAddr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &StoreOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &StoreOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair StoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range StoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult StoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.access_groups; + auto attr = dict.get("access_groups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for access_groups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `access_groups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.nontemporal; + auto attr = dict.get("nontemporal"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nontemporal in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nontemporal` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.ordering; + auto attr = dict.get("ordering"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for ordering in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `ordering` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.syncscope; + auto attr = dict.get("syncscope"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for syncscope in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `syncscope` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.volatile_; + auto attr = dict.get("volatile_"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for volatile_ in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `volatile_` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute StoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.access_groups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("access_groups", + propStorage)); + } + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.nontemporal; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nontemporal", + propStorage)); + } + + { + const auto &propStorage = prop.ordering; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("ordering", + propStorage)); + } + + { + const auto &propStorage = prop.syncscope; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("syncscope", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + { + const auto &propStorage = prop.volatile_; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("volatile_", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code StoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.access_groups.getAsOpaquePointer()), + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.nontemporal.getAsOpaquePointer()), + llvm::hash_value(prop.ordering.getAsOpaquePointer()), + llvm::hash_value(prop.syncscope.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer()), + llvm::hash_value(prop.volatile_.getAsOpaquePointer())); +} + +std::optional StoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "access_groups") + return prop.access_groups; + + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "alignment") + return prop.alignment; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "nontemporal") + return prop.nontemporal; + + if (name == "ordering") + return prop.ordering; + + if (name == "syncscope") + return prop.syncscope; + + if (name == "tbaa") + return prop.tbaa; + + if (name == "volatile_") + return prop.volatile_; + return std::nullopt; +} + +void StoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "access_groups") { + prop.access_groups = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "nontemporal") { + prop.nontemporal = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "ordering") { + prop.ordering = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "syncscope") { + prop.syncscope = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "volatile_") { + prop.volatile_ = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void StoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.access_groups) attrs.append("access_groups", prop.access_groups); + + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.alignment) attrs.append("alignment", prop.alignment); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.nontemporal) attrs.append("nontemporal", prop.nontemporal); + + if (prop.ordering) attrs.append("ordering", prop.ordering); + + if (prop.syncscope) attrs.append("syncscope", prop.syncscope); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); + + if (prop.volatile_) attrs.append("volatile_", prop.volatile_); +} + +::mlir::LogicalResult StoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAccessGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(attr, "access_groups", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(attr, "alignment", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNontemporalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "nontemporal", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getOrderingAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(attr, "ordering", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSyncscopeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(attr, "syncscope", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getVolatile_AttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(attr, "volatile_", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult StoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.access_groups))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.nontemporal))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.ordering))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.syncscope))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.volatile_))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void StoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.access_groups); + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.alignment); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.nontemporal); + + writer.writeOptionalAttribute(prop.ordering); + + writer.writeOptionalAttribute(prop.syncscope); + + writer.writeOptionalAttribute(prop.tbaa); + + writer.writeOptionalAttribute(prop.volatile_); +} + +::mlir::IntegerAttr StoreOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional StoreOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr StoreOp::getVolatile_Attr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().volatile_); +} + +bool StoreOp::getVolatile_() { + auto attr = getVolatile_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr StoreOp::getNontemporalAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nontemporal); +} + +bool StoreOp::getNontemporal() { + auto attr = getNontemporalAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::LLVM::AtomicOrderingAttr StoreOp::getOrderingAttr() { + return ::llvm::dyn_cast_or_null<::mlir::LLVM::AtomicOrderingAttr>(getProperties().ordering); +} + +::mlir::LLVM::AtomicOrdering StoreOp::getOrdering() { + auto attr = getOrderingAttr(); + return attr.getValue(); +} + +::mlir::StringAttr StoreOp::getSyncscopeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().syncscope); +} + +::std::optional< ::llvm::StringRef > StoreOp::getSyncscope() { + auto attr = getSyncscopeAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr StoreOp::getAccessGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().access_groups); +} + +::std::optional< ::mlir::ArrayAttr > StoreOp::getAccessGroups() { + auto attr = getAccessGroupsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr StoreOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > StoreOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr StoreOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > StoreOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr StoreOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > StoreOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void StoreOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void StoreOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +void StoreOp::setVolatile_Attr(::mlir::UnitAttr attr) { + (*this)->setAttr(getVolatile_AttrName(), attr); +} + +void StoreOp::setVolatile_(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getVolatile_AttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getVolatile_AttrName()); +} + +void StoreOp::setNontemporalAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNontemporalAttrName(), attr); +} + +void StoreOp::setNontemporal(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNontemporalAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNontemporalAttrName()); +} + +void StoreOp::setOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr) { + (*this)->setAttr(getOrderingAttrName(), attr); +} + +void StoreOp::setOrdering(::mlir::LLVM::AtomicOrdering attrValue) { + (*this)->setAttr(getOrderingAttrName(), ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void StoreOp::setSyncscopeAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSyncscopeAttrName(), attr); +} + +void StoreOp::setSyncscope(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSyncscopeAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSyncscopeAttrName()); +} + +void StoreOp::setAccessGroupsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAccessGroupsAttrName(), attr); +} + +void StoreOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void StoreOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void StoreOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute StoreOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +::mlir::Attribute StoreOp::removeVolatile_Attr() { + auto &attr = getProperties().volatile_; + attr = {}; + return attr; +} + +::mlir::Attribute StoreOp::removeNontemporalAttr() { + auto &attr = getProperties().nontemporal; + attr = {}; + return attr; +} + +::mlir::Attribute StoreOp::removeSyncscopeAttr() { + auto &attr = getProperties().syncscope; + attr = {}; + return attr; +} + +::mlir::Attribute StoreOp::removeAccessGroupsAttr() { + auto &attr = getProperties().access_groups; + attr = {}; + return attr; +} + +::mlir::Attribute StoreOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute StoreOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute StoreOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(value); + odsState.addOperands(addr); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = nontemporal; + } + if (ordering) { + odsState.getOrAddProperties().ordering = ordering; + } + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(value); + odsState.addOperands(addr); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = volatile_; + } + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = nontemporal; + } + if (ordering) { + odsState.getOrAddProperties().ordering = ordering; + } + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(value); + odsState.addOperands(addr); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.getOrAddProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(value); + odsState.addOperands(addr); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + if (volatile_) { + odsState.getOrAddProperties().volatile_ = ((volatile_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.getOrAddProperties().ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering); + if (syncscope) { + odsState.getOrAddProperties().syncscope = syncscope; + } + if (access_groups) { + odsState.getOrAddProperties().access_groups = access_groups; + } + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void StoreOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.ordering) + properties.ordering = ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), AtomicOrdering::not_atomic); +} + +::mlir::LogicalResult StoreOp::verifyInvariantsImpl() { + auto tblgen_access_groups = getProperties().access_groups; (void)tblgen_access_groups; + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal; + auto tblgen_ordering = getProperties().ordering; (void)tblgen_ordering; + auto tblgen_syncscope = getProperties().syncscope; (void)tblgen_syncscope; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + auto tblgen_volatile_ = getProperties().volatile_; (void)tblgen_volatile_; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps1(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_volatile_, "volatile_"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps3(*this, tblgen_nontemporal, "nontemporal"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps4(*this, tblgen_ordering, "ordering"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps5(*this, tblgen_syncscope, "syncscope"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps6(*this, tblgen_access_groups, "access_groups"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps7(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps8(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps19(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps18(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult StoreOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult StoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::StringAttr syncscopeAttr; + ::mlir::LLVM::AtomicOrderingAttr orderingAttr; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type addrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> addrTypes(addrRawTypes); + if (::mlir::succeeded(parser.parseOptionalKeyword("volatile"))) { + result.getOrAddProperties().volatile_ = parser.getBuilder().getUnitAttr(); } + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("atomic"))) { + if (::mlir::succeeded(parser.parseOptionalKeyword("syncscope"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(syncscopeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (syncscopeAttr) result.getOrAddProperties().syncscope = syncscopeAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"not_atomic","unordered","monotonic","acquire","release","acq_rel","seq_cst"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "ordering", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'ordering' [not_atomic, unordered, monotonic, acquire, release, acq_rel, seq_cst]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::LLVM::symbolizeAtomicOrdering(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "ordering attribute specification: \"" << attrStr << '"';; + + orderingAttr = ::mlir::LLVM::AtomicOrderingAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().ordering = orderingAttr; + } + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + { + auto odsResult = parseStoreType(parser, valueRawTypes[0], addrRawTypes[0]); + if (odsResult) return ::mlir::failure(); + } + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(addrOperands, addrTypes, addrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void StoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getVolatile_Attr()) { + _odsPrinter << ' ' << "volatile"; + } + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getAddr(); + if (getOrderingAttr() && getOrderingAttr() != ::mlir::LLVM::AtomicOrderingAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), AtomicOrdering::not_atomic)) { + _odsPrinter << ' ' << "atomic"; + if (getSyncscopeAttr()) { + _odsPrinter << ' ' << "syncscope"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getSyncscopeAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + + { + auto caseValue = getOrdering(); + auto caseValueStr = stringifyAtomicOrdering(caseValue); + _odsPrinter << caseValueStr; + } + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("volatile_"); + elidedAttrs.push_back("syncscope"); + elidedAttrs.push_back("ordering"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getVolatile_Attr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("volatile_"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNontemporalAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nontemporal"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getOrderingAttr(); + if(attr && (attr == ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), AtomicOrdering::not_atomic))) + elidedAttrs.push_back("ordering"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + printStoreType(_odsPrinter, *this, getValue().getType(), getAddr().getType()); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::StoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SubOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.sub", odsAttrs.getContext()); +} + +SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(SubOp op) : SubOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SubOpAdaptor::SubOpAdaptor(SubOp op) : SubOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SubOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value SubOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SubOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SubOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SubOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SubOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SubOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult SubOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SubOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SubOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SwitchOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SwitchOpGenericAdaptorBase::SwitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.switch", odsAttrs.getContext()); +} + +SwitchOpGenericAdaptorBase::SwitchOpGenericAdaptorBase(SwitchOp op) : SwitchOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SwitchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SwitchOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr SwitchOpGenericAdaptorBase::getCaseValuesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().case_values); + return attr; +} + +::std::optional< ::mlir::DenseIntElementsAttr > SwitchOpGenericAdaptorBase::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr ? ::std::optional< ::mlir::DenseIntElementsAttr >(attr) : (::std::nullopt); +} + +::mlir::DenseI32ArrayAttr SwitchOpGenericAdaptorBase::getCaseOperandSegmentsAttr() { + auto attr = ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().case_operand_segments); + return attr; +} + +::llvm::ArrayRef SwitchOpGenericAdaptorBase::getCaseOperandSegments() { + auto attr = getCaseOperandSegmentsAttr(); + return attr; +} + +::mlir::DenseI32ArrayAttr SwitchOpGenericAdaptorBase::getBranchWeightsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().branch_weights); + return attr; +} + +::std::optional<::llvm::ArrayRef> SwitchOpGenericAdaptorBase::getBranchWeights() { + auto attr = getBranchWeightsAttr(); + return attr ? ::std::optional<::llvm::ArrayRef>(attr) : (::std::nullopt); +} + +} // namespace detail +SwitchOpAdaptor::SwitchOpAdaptor(SwitchOp op) : SwitchOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SwitchOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; + auto tblgen_case_operand_segments = getProperties().case_operand_segments; (void)tblgen_case_operand_segments; + if (!tblgen_case_operand_segments) return emitError(loc, "'llvm.switch' op ""requires attribute 'case_operand_segments'"); + auto tblgen_case_values = getProperties().case_values; (void)tblgen_case_values; + + if (tblgen_case_values && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_case_values))) && ((true)))) + return emitError(loc, "'llvm.switch' op ""attribute 'case_values' failed to satisfy constraint: integer elements attribute"); + + if (tblgen_case_operand_segments && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_case_operand_segments)))) + return emitError(loc, "'llvm.switch' op ""attribute 'case_operand_segments' failed to satisfy constraint: i32 dense array attribute"); + + if (tblgen_branch_weights && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_branch_weights)))) + return emitError(loc, "'llvm.switch' op ""attribute 'branch_weights' failed to satisfy constraint: i32 dense array attribute"); + return ::mlir::success(); +} + +std::pair SwitchOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SwitchOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> SwitchOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range SwitchOp::getDefaultOperands() { + return getODSOperands(1); +} + +::mlir::OperandRangeRange SwitchOp::getCaseOperands() { + return getODSOperands(2).split(getCaseOperandSegmentsAttr()); +} + +::mlir::OpOperand &SwitchOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange SwitchOp::getDefaultOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRangeRange SwitchOp::getCaseOperandsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getCaseOperandSegmentsAttrName())); +} + +std::pair SwitchOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SwitchOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *SwitchOp::getDefaultDestination() { + return (*this)->getSuccessor(0); +} + +::mlir::SuccessorRange SwitchOp::getCaseDestinations() { + return {std::next((*this)->successor_begin(), 1), (*this)->successor_end()}; +} + +::mlir::LogicalResult SwitchOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.branch_weights; + auto attr = dict.get("branch_weights"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for branch_weights in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `branch_weights` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.case_operand_segments; + auto attr = dict.get("case_operand_segments"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for case_operand_segments in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `case_operand_segments` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.case_values; + auto attr = dict.get("case_values"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for case_values in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `case_values` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SwitchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.branch_weights; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("branch_weights", + propStorage)); + } + + { + const auto &propStorage = prop.case_operand_segments; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("case_operand_segments", + propStorage)); + } + + { + const auto &propStorage = prop.case_values; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("case_values", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SwitchOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.branch_weights.getAsOpaquePointer()), + llvm::hash_value(prop.case_operand_segments.getAsOpaquePointer()), + llvm::hash_value(prop.case_values.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SwitchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "branch_weights") + return prop.branch_weights; + + if (name == "case_operand_segments") + return prop.case_operand_segments; + + if (name == "case_values") + return prop.case_values; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SwitchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "branch_weights") { + prop.branch_weights = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "case_operand_segments") { + prop.case_operand_segments = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "case_values") { + prop.case_values = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SwitchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.branch_weights) attrs.append("branch_weights", prop.branch_weights); + + if (prop.case_operand_segments) attrs.append("case_operand_segments", prop.case_operand_segments); + + if (prop.case_values) attrs.append("case_values", prop.case_values); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SwitchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBranchWeightsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(attr, "branch_weights", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCaseOperandSegmentsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(attr, "case_operand_segments", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCaseValuesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps32(attr, "case_values", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.branch_weights))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.case_operand_segments))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.case_values))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SwitchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.branch_weights); + writer.writeAttribute(prop.case_operand_segments); + + writer.writeOptionalAttribute(prop.case_values); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr SwitchOp::getCaseValuesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().case_values); +} + +::std::optional< ::mlir::DenseIntElementsAttr > SwitchOp::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr ? ::std::optional< ::mlir::DenseIntElementsAttr >(attr) : (::std::nullopt); +} + +::mlir::DenseI32ArrayAttr SwitchOp::getCaseOperandSegmentsAttr() { + return ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().case_operand_segments); +} + +::llvm::ArrayRef SwitchOp::getCaseOperandSegments() { + auto attr = getCaseOperandSegmentsAttr(); + return attr; +} + +::mlir::DenseI32ArrayAttr SwitchOp::getBranchWeightsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().branch_weights); +} + +::std::optional<::llvm::ArrayRef> SwitchOp::getBranchWeights() { + auto attr = getBranchWeightsAttr(); + return attr ? ::std::optional<::llvm::ArrayRef>(attr) : (::std::nullopt); +} + +void SwitchOp::setCaseValuesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getCaseValuesAttrName(), attr); +} + +void SwitchOp::setCaseOperandSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { + (*this)->setAttr(getCaseOperandSegmentsAttrName(), attr); +} + +void SwitchOp::setCaseOperandSegments(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getCaseOperandSegmentsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue)); +} + +void SwitchOp::setBranchWeightsAttr(::mlir::DenseI32ArrayAttr attr) { + (*this)->setAttr(getBranchWeightsAttrName(), attr); +} + +void SwitchOp::setBranchWeights(::std::optional<::llvm::ArrayRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getBranchWeightsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(*attrValue)); + (*this)->removeAttr(getBranchWeightsAttrName()); +} + +::mlir::Attribute SwitchOp::removeCaseValuesAttr() { + auto &attr = getProperties().case_values; + attr = {}; + return attr; +} + +::mlir::Attribute SwitchOp::removeBranchWeightsAttr() { + auto &attr = getProperties().branch_weights; + attr = {}; + return attr; +} + +void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, SuccessorRange destinations, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addSuccessors(destinations); + odsState.addAttributes(attributes); + +} + +void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) { + odsState.addOperands(value); + odsState.addOperands(defaultOperands); + for (::mlir::ValueRange range : caseOperands) + odsState.addOperands(range); + { + ::llvm::SmallVector rangeSegments; + for (::mlir::ValueRange range : caseOperands) + rangeSegments.push_back(range.size()); + auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments); + odsState.getOrAddProperties().case_operand_segments = rangeAttr; } + ::llvm::copy(::llvm::ArrayRef({1, static_cast(defaultOperands.size()), static_cast(std::accumulate(caseOperands.begin(), caseOperands.end(), 0, [](int32_t curSum, ::mlir::ValueRange range) { return curSum + range.size(); }))}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (case_values) { + odsState.getOrAddProperties().case_values = case_values; + } + if (branch_weights) { + odsState.getOrAddProperties().branch_weights = branch_weights; + } + odsState.addSuccessors(defaultDestination); + odsState.addSuccessors(caseDestinations); +} + +void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations) { + odsState.addOperands(value); + odsState.addOperands(defaultOperands); + for (::mlir::ValueRange range : caseOperands) + odsState.addOperands(range); + { + ::llvm::SmallVector rangeSegments; + for (::mlir::ValueRange range : caseOperands) + rangeSegments.push_back(range.size()); + auto rangeAttr = odsBuilder.getDenseI32ArrayAttr(rangeSegments); + odsState.getOrAddProperties().case_operand_segments = rangeAttr; } + ::llvm::copy(::llvm::ArrayRef({1, static_cast(defaultOperands.size()), static_cast(std::accumulate(caseOperands.begin(), caseOperands.end(), 0, [](int32_t curSum, ::mlir::ValueRange range) { return curSum + range.size(); }))}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (case_values) { + odsState.getOrAddProperties().case_values = case_values; + } + if (branch_weights) { + odsState.getOrAddProperties().branch_weights = branch_weights; + } + odsState.addSuccessors(defaultDestination); + odsState.addSuccessors(caseDestinations); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SwitchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SwitchOp::verifyInvariantsImpl() { + auto tblgen_branch_weights = getProperties().branch_weights; (void)tblgen_branch_weights; + auto tblgen_case_operand_segments = getProperties().case_operand_segments; (void)tblgen_case_operand_segments; + if (!tblgen_case_operand_segments) return emitOpError("requires attribute 'case_operand_segments'"); + auto tblgen_case_values = getProperties().case_values; (void)tblgen_case_values; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps32(*this, tblgen_case_values, "case_values"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(*this, tblgen_case_operand_segments, "case_operand_segments"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LLVMOps13(*this, tblgen_branch_weights, "branch_weights"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps21(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "case_operand_segments", "caseOperands", valueGroup2.size()))) + return ::mlir::failure(); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps21(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SwitchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Block *defaultDestinationSuccessor = nullptr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> defaultOperandsOperands; + ::llvm::SMLoc defaultOperandsOperandsLoc; + (void)defaultOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> defaultOperandsTypes; + ::mlir::DenseIntElementsAttr case_valuesAttr; + ::llvm::SmallVector<::mlir::Block *, 2> caseDestinationsSuccessors; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> caseOperandsOperands; + llvm::SmallVector caseOperandsOperandGroupSizes; + ::llvm::SMLoc caseOperandsOperandsLoc; + (void)caseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> caseOperandsTypes; + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseSuccessor(defaultDestinationSuccessor)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + defaultOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(defaultOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(defaultOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + caseOperandsOperandsLoc = parser.getCurrentLocation(); + ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> caseOperandsOperandGroups; + ::llvm::SmallVector> caseOperandsTypeGroups; + auto odsResult = parseSwitchOpCases(parser, valueRawTypes[0], case_valuesAttr, caseDestinationsSuccessors, caseOperandsOperandGroups, caseOperandsTypeGroups); + if (odsResult) return ::mlir::failure(); + if (case_valuesAttr) + result.getOrAddProperties().case_values = case_valuesAttr; + for (const auto &subRange : caseOperandsOperandGroups) { + caseOperandsOperands.append(subRange.begin(), subRange.end()); + caseOperandsOperandGroupSizes.push_back(subRange.size()); + } + for (const auto &subRange : caseOperandsTypeGroups) + caseOperandsTypes.append(subRange.begin(), subRange.end()); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addSuccessors(defaultDestinationSuccessor); + result.addSuccessors(caseDestinationsSuccessors); +::llvm::copy(::llvm::ArrayRef({1, static_cast(defaultOperandsOperands.size()), static_cast(caseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + result.getOrAddProperties().case_operand_segments = parser.getBuilder().getDenseI32ArrayAttr(caseOperandsOperandGroupSizes); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(defaultOperandsOperands, defaultOperandsTypes, defaultOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(caseOperandsOperands, caseOperandsTypes, caseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDefaultDestination(); + if (!getDefaultOperands().empty()) { + _odsPrinter << "("; + _odsPrinter << getDefaultOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDefaultOperands().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + printSwitchOpCases(_odsPrinter, *this, getValue().getType(), getCaseValuesAttr(), getCaseDestinations(), getCaseOperands(), getCaseOperands().getTypes()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("case_operand_segments"); + elidedAttrs.push_back("case_values"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void SwitchOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::SwitchOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::TruncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TruncOpGenericAdaptorBase::TruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.trunc", odsAttrs.getContext()); +} + +TruncOpGenericAdaptorBase::TruncOpGenericAdaptorBase(TruncOp op) : TruncOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TruncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TruncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TruncOpAdaptor::TruncOpAdaptor(TruncOp op) : TruncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TruncOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TruncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TruncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TruncOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &TruncOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair TruncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TruncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TruncOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TruncOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TruncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TruncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TruncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UDivOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UDivOpGenericAdaptorBase::UDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.udiv", odsAttrs.getContext()); +} + +UDivOpGenericAdaptorBase::UDivOpGenericAdaptorBase(UDivOp op) : UDivOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UDivOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UDivOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UDivOpAdaptor::UDivOpAdaptor(UDivOp op) : UDivOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UDivOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UDivOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UDivOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UDivOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value UDivOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &UDivOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &UDivOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair UDivOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UDivOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UDivOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(UDivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UDivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void UDivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(UDivOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult UDivOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UDivOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult UDivOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult UDivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UDivOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void UDivOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UIToFPOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UIToFPOpGenericAdaptorBase::UIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.uitofp", odsAttrs.getContext()); +} + +UIToFPOpGenericAdaptorBase::UIToFPOpGenericAdaptorBase(UIToFPOp op) : UIToFPOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UIToFPOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UIToFPOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UIToFPOpAdaptor::UIToFPOpAdaptor(UIToFPOp op) : UIToFPOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UIToFPOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UIToFPOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UIToFPOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UIToFPOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &UIToFPOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair UIToFPOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UIToFPOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UIToFPOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UIToFPOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps14(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UIToFPOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult UIToFPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UIToFPOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void UIToFPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UIToFPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::URemOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +URemOpGenericAdaptorBase::URemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.urem", odsAttrs.getContext()); +} + +URemOpGenericAdaptorBase::URemOpGenericAdaptorBase(URemOp op) : URemOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair URemOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr URemOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +URemOpAdaptor::URemOpAdaptor(URemOp op) : URemOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult URemOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair URemOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range URemOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value URemOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value URemOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &URemOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &URemOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair URemOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range URemOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value URemOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(URemOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void URemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void URemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(URemOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult URemOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult URemOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult URemOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult URemOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void URemOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void URemOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::URemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UndefOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UndefOpGenericAdaptorBase::UndefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mlir.undef", odsAttrs.getContext()); +} + +UndefOpGenericAdaptorBase::UndefOpGenericAdaptorBase(UndefOp op) : UndefOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UndefOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UndefOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UndefOpAdaptor::UndefOpAdaptor(UndefOp op) : UndefOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UndefOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UndefOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UndefOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair UndefOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UndefOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value UndefOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UndefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UndefOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UndefOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult UndefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void UndefOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void UndefOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UndefOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UnreachableOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UnreachableOpGenericAdaptorBase::UnreachableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.unreachable", odsAttrs.getContext()); +} + +UnreachableOpGenericAdaptorBase::UnreachableOpGenericAdaptorBase(UnreachableOp op) : UnreachableOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UnreachableOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr UnreachableOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +UnreachableOpAdaptor::UnreachableOpAdaptor(UnreachableOp op) : UnreachableOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UnreachableOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair UnreachableOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range UnreachableOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair UnreachableOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UnreachableOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void UnreachableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void UnreachableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UnreachableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UnreachableOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult UnreachableOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult UnreachableOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void UnreachableOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UnreachableOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::XOrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +XOrOpGenericAdaptorBase::XOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.xor", odsAttrs.getContext()); +} + +XOrOpGenericAdaptorBase::XOrOpGenericAdaptorBase(XOrOp op) : XOrOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair XOrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr XOrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +XOrOpAdaptor::XOrOpAdaptor(XOrOp op) : XOrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult XOrOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair XOrOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range XOrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value XOrOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value XOrOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &XOrOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &XOrOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair XOrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range XOrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value XOrOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(res); +} + +void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(XOrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void XOrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void XOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(XOrOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult XOrOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult XOrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult XOrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult XOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseLLVMOpAttrs(parser, result.attributes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(lhsOperands, resTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void XOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + _odsPrinter << ' '; + printLLVMOpAttrs(_odsPrinter, *this, getOperation()->getAttrDictionary()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void XOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::XOrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ZExtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ZExtOpGenericAdaptorBase::ZExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.zext", odsAttrs.getContext()); +} + +ZExtOpGenericAdaptorBase::ZExtOpGenericAdaptorBase(ZExtOp op) : ZExtOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ZExtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ZExtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ZExtOpAdaptor::ZExtOpAdaptor(ZExtOp op) : ZExtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ZExtOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ZExtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ZExtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ZExtOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ZExtOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ZExtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ZExtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ZExtOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void ZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void ZExtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ZExtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ZExtOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ZExtOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ZExtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type argRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> argTypes(argRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + argRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ZExtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getArg().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ZExtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ZExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ZeroOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ZeroOpGenericAdaptorBase::ZeroOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("llvm.mlir.zero", odsAttrs.getContext()); +} + +ZeroOpGenericAdaptorBase::ZeroOpGenericAdaptorBase(ZeroOp op) : ZeroOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ZeroOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ZeroOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ZeroOpAdaptor::ZeroOpAdaptor(ZeroOp op) : ZeroOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ZeroOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ZeroOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ZeroOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ZeroOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ZeroOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ZeroOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes) { + if (resultType) odsState.addTypes(resultType); + odsState.addOperands(operands); + for (auto namedAttr : attributes) + odsState.addAttribute(namedAttr.getName(), namedAttr.getValue()); + +} + +void ZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ZeroOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ZeroOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ZeroOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ZeroOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ZeroOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ZeroOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ZeroOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ZeroOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..000a56e52d42486f5f673d5fe00b1213894659dc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.h.inc @@ -0,0 +1,12550 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LLVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace LLVM { +class AShrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AddOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AddrSpaceCastOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AddressOfOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AllocaOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AndOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AtomicCmpXchgOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class AtomicRMWOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class BitcastOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class BrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CallIntrinsicOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CallOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ComdatOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ComdatSelectorOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class CondBrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ConstantOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ExtractElementOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ExtractValueOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FAddOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FCmpOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FDivOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FMulOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FNegOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FPExtOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FPToSIOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FPToUIOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FPTruncOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FRemOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FSubOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FenceOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class FreezeOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class GEPOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class GlobalCtorsOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class GlobalDtorsOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class GlobalOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ICmpOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class InlineAsmOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class InsertElementOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class InsertValueOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class IntToPtrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class InvokeOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LLVMFuncOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LShrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LandingpadOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class LoadOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class MulOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class NoneTokenOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class OrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class PoisonOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class PtrToIntOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ResumeOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ReturnOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SDivOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SExtOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SIToFPOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SRemOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SelectOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ShlOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ShuffleVectorOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class StoreOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SubOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class SwitchOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class TruncOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UDivOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UIToFPOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class URemOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UndefOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class UnreachableOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class XOrOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ZExtOp; +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +class ZeroOp; +} // namespace LLVM +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AShrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AShrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AShrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AShrOpGenericAdaptorBase(AShrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AShrOpGenericAdaptor : public detail::AShrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AShrOpGenericAdaptorBase; +public: + AShrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AShrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AShrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AShrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AShrOpAdaptor : public AShrOpGenericAdaptor<::mlir::ValueRange> { +public: + using AShrOpGenericAdaptor::AShrOpGenericAdaptor; + AShrOpAdaptor(AShrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AShrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AShrOpAdaptor; + template + using GenericAdaptor = AShrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.ashr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AShrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddOpGenericAdaptorBase(AddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddOpGenericAdaptorBase; +public: + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddOpGenericAdaptor::AddOpGenericAdaptor; + AddOpAdaptor(AddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::IsCommutative, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddOpAdaptor; + template + using GenericAdaptor = AddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AddrSpaceCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddrSpaceCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddrSpaceCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddrSpaceCastOpGenericAdaptorBase(AddrSpaceCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddrSpaceCastOpGenericAdaptor : public detail::AddrSpaceCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddrSpaceCastOpGenericAdaptorBase; +public: + AddrSpaceCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddrSpaceCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddrSpaceCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddrSpaceCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddrSpaceCastOpAdaptor : public AddrSpaceCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddrSpaceCastOpGenericAdaptor::AddrSpaceCastOpGenericAdaptor; + AddrSpaceCastOpAdaptor(AddrSpaceCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddrSpaceCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::PromotableOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddrSpaceCastOpAdaptor; + template + using GenericAdaptor = AddrSpaceCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.addrspacecast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + bool canUsesBeRemoved(const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddrSpaceCastOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AddressOfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddressOfOpGenericAdaptorBase { +public: + struct Properties { + using global_nameTy = ::mlir::FlatSymbolRefAttr; + global_nameTy global_name; + + auto getGlobalName() { + auto &propStorage = this->global_name; + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setGlobalName(const ::mlir::FlatSymbolRefAttr &propValue) { + this->global_name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.global_name == this->global_name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AddressOfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AddressOfOpGenericAdaptorBase(AddressOfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getGlobalNameAttr(); + ::llvm::StringRef getGlobalName(); +}; +} // namespace detail +template +class AddressOfOpGenericAdaptor : public detail::AddressOfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddressOfOpGenericAdaptorBase; +public: + AddressOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddressOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddressOfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AddressOfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddressOfOpAdaptor : public AddressOfOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddressOfOpGenericAdaptor::AddressOfOpGenericAdaptor; + AddressOfOpAdaptor(AddressOfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddressOfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddressOfOpAdaptor; + template + using GenericAdaptor = AddressOfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("global_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getGlobalNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getGlobalNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mlir.addressof"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::FlatSymbolRefAttr getGlobalNameAttr(); + ::llvm::StringRef getGlobalName(); + void setGlobalNameAttr(::mlir::FlatSymbolRefAttr attr); + void setGlobalName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, GlobalOp global, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFuncOp func, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::FlatSymbolRefAttr global_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr global_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::llvm::StringRef global_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef global_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Return the llvm.mlir.global operation that defined the value referenced + /// here. + GlobalOp getGlobal(SymbolTableCollection &symbolTable); + + /// Return the llvm.func operation that is referenced here. + LLVMFuncOp getFunction(SymbolTableCollection &symbolTable); +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddressOfOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AllocaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllocaOpGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using elem_typeTy = ::mlir::TypeAttr; + elem_typeTy elem_type; + + auto getElemType() { + auto &propStorage = this->elem_type; + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(propStorage); + } + void setElemType(const ::mlir::TypeAttr &propValue) { + this->elem_type = propValue; + } + using inallocaTy = ::mlir::UnitAttr; + inallocaTy inalloca; + + auto getInalloca() { + auto &propStorage = this->inalloca; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setInalloca(const ::mlir::UnitAttr &propValue) { + this->inalloca = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + rhs.elem_type == this->elem_type && + rhs.inalloca == this->inalloca && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AllocaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AllocaOpGenericAdaptorBase(AllocaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::TypeAttr getElemTypeAttr(); + ::std::optional<::mlir::Type> getElemType(); + ::mlir::UnitAttr getInallocaAttr(); + bool getInalloca(); +}; +} // namespace detail +template +class AllocaOpGenericAdaptor : public detail::AllocaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllocaOpGenericAdaptorBase; +public: + AllocaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllocaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllocaOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AllocaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArraySize() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllocaOpAdaptor : public AllocaOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllocaOpGenericAdaptor::AllocaOpGenericAdaptor; + AllocaOpAdaptor(AllocaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllocaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::PromotableAllocationOpInterface::Trait, ::mlir::DestructurableAllocationOpInterface::Trait, ::mlir::LLVM::GetResultPtrElementType::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllocaOpAdaptor; + template + using GenericAdaptor = AllocaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment"), ::llvm::StringRef("elem_type"), ::llvm::StringRef("inalloca")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getElemTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getElemTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getInallocaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getInallocaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.alloca"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getArraySize(); + ::mlir::OpOperand &getArraySizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::TypeAttr getElemTypeAttr(); + ::std::optional<::mlir::Type> getElemType(); + ::mlir::UnitAttr getInallocaAttr(); + bool getInalloca(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + void setElemTypeAttr(::mlir::TypeAttr attr); + void setElemType(::std::optional<::mlir::Type> attrValue); + void setInallocaAttr(::mlir::UnitAttr attr); + void setInalloca(bool attrValue); + ::mlir::Attribute removeAlignmentAttr(); + ::mlir::Attribute removeElemTypeAttr(); + ::mlir::Attribute removeInallocaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value arraySize, unsigned alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Type elementType, Value arraySize, unsigned alignment = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::TypeAttr elem_type, /*optional*/::mlir::UnitAttr inalloca); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::TypeAttr elem_type, /*optional*/bool inalloca = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arraySize, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::TypeAttr elem_type, /*optional*/bool inalloca = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::llvm::SmallVector<::mlir::MemorySlot> getPromotableSlots(); + ::mlir::Value getDefaultValue(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + void handleBlockArgument(const ::mlir::MemorySlot &slot, ::mlir::BlockArgument argument, ::mlir::RewriterBase &rewriter); + void handlePromotionComplete(const ::mlir::MemorySlot &slot, ::mlir::Value defaultValue, ::mlir::RewriterBase &rewriter); + ::llvm::SmallVector<::mlir::DestructurableMemorySlot> getDestructurableSlots(); + ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> destructure(const ::mlir::DestructurableMemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices, ::mlir::RewriterBase &rewriter); + void handleDestructuringComplete(const ::mlir::DestructurableMemorySlot &slot, ::mlir::RewriterBase &rewriter); + Type getResultPtrElementType(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AllocaOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AndOpGenericAdaptorBase(AndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AndOpGenericAdaptor : public detail::AndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AndOpGenericAdaptorBase; +public: + AndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AndOpAdaptor : public AndOpGenericAdaptor<::mlir::ValueRange> { +public: + using AndOpGenericAdaptor::AndOpGenericAdaptor; + AndOpAdaptor(AndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AndOpAdaptor; + template + using GenericAdaptor = AndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.and"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AndOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AtomicCmpXchgOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicCmpXchgOpGenericAdaptorBase { +public: + struct Properties { + using access_groupsTy = ::mlir::ArrayAttr; + access_groupsTy access_groups; + + auto getAccessGroups() { + auto &propStorage = this->access_groups; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAccessGroups(const ::mlir::ArrayAttr &propValue) { + this->access_groups = propValue; + } + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using failure_orderingTy = ::mlir::LLVM::AtomicOrderingAttr; + failure_orderingTy failure_ordering; + + auto getFailureOrdering() { + auto &propStorage = this->failure_ordering; + return ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(propStorage); + } + void setFailureOrdering(const ::mlir::LLVM::AtomicOrderingAttr &propValue) { + this->failure_ordering = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using success_orderingTy = ::mlir::LLVM::AtomicOrderingAttr; + success_orderingTy success_ordering; + + auto getSuccessOrdering() { + auto &propStorage = this->success_ordering; + return ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(propStorage); + } + void setSuccessOrdering(const ::mlir::LLVM::AtomicOrderingAttr &propValue) { + this->success_ordering = propValue; + } + using syncscopeTy = ::mlir::StringAttr; + syncscopeTy syncscope; + + auto getSyncscope() { + auto &propStorage = this->syncscope; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSyncscope(const ::mlir::StringAttr &propValue) { + this->syncscope = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + using volatile_Ty = ::mlir::UnitAttr; + volatile_Ty volatile_; + + auto getVolatile_() { + auto &propStorage = this->volatile_; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setVolatile_(const ::mlir::UnitAttr &propValue) { + this->volatile_ = propValue; + } + using weakTy = ::mlir::UnitAttr; + weakTy weak; + + auto getWeak() { + auto &propStorage = this->weak; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWeak(const ::mlir::UnitAttr &propValue) { + this->weak = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.access_groups == this->access_groups && + rhs.alias_scopes == this->alias_scopes && + rhs.alignment == this->alignment && + rhs.failure_ordering == this->failure_ordering && + rhs.noalias_scopes == this->noalias_scopes && + rhs.success_ordering == this->success_ordering && + rhs.syncscope == this->syncscope && + rhs.tbaa == this->tbaa && + rhs.volatile_ == this->volatile_ && + rhs.weak == this->weak && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AtomicCmpXchgOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicCmpXchgOpGenericAdaptorBase(AtomicCmpXchgOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::AtomicOrderingAttr getSuccessOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getSuccessOrdering(); + ::mlir::LLVM::AtomicOrderingAttr getFailureOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getFailureOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::UnitAttr getWeakAttr(); + bool getWeak(); + ::mlir::UnitAttr getVolatile_Attr(); + bool getVolatile_(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class AtomicCmpXchgOpGenericAdaptor : public detail::AtomicCmpXchgOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicCmpXchgOpGenericAdaptorBase; +public: + AtomicCmpXchgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicCmpXchgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicCmpXchgOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AtomicCmpXchgOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getCmp() { + return (*getODSOperands(1).begin()); + } + + ValueT getVal() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicCmpXchgOpAdaptor : public AtomicCmpXchgOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicCmpXchgOpGenericAdaptor::AtomicCmpXchgOpGenericAdaptor; + AtomicCmpXchgOpAdaptor(AtomicCmpXchgOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicCmpXchgOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AccessGroupOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicCmpXchgOpAdaptor; + template + using GenericAdaptor = AtomicCmpXchgOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("access_groups"), ::llvm::StringRef("alias_scopes"), ::llvm::StringRef("alignment"), ::llvm::StringRef("failure_ordering"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("success_ordering"), ::llvm::StringRef("syncscope"), ::llvm::StringRef("tbaa"), ::llvm::StringRef("volatile_"), ::llvm::StringRef("weak")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAccessGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAccessGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFailureOrderingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFailureOrderingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSuccessOrderingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSuccessOrderingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSyncscopeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSyncscopeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getVolatile_AttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getVolatile_AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWeakAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWeakAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.cmpxchg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::Value getCmp(); + ::mlir::Value getVal(); + ::mlir::OpOperand &getPtrMutable(); + ::mlir::OpOperand &getCmpMutable(); + ::mlir::OpOperand &getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::AtomicOrderingAttr getSuccessOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getSuccessOrdering(); + ::mlir::LLVM::AtomicOrderingAttr getFailureOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getFailureOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::UnitAttr getWeakAttr(); + bool getWeak(); + ::mlir::UnitAttr getVolatile_Attr(); + bool getVolatile_(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setSuccessOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr); + void setSuccessOrdering(::mlir::LLVM::AtomicOrdering attrValue); + void setFailureOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr); + void setFailureOrdering(::mlir::LLVM::AtomicOrdering attrValue); + void setSyncscopeAttr(::mlir::StringAttr attr); + void setSyncscope(::std::optional<::llvm::StringRef> attrValue); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + void setWeakAttr(::mlir::UnitAttr attr); + void setWeak(bool attrValue); + void setVolatile_Attr(::mlir::UnitAttr attr); + void setVolatile_(bool attrValue); + void setAccessGroupsAttr(::mlir::ArrayAttr attr); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeSyncscopeAttr(); + ::mlir::Attribute removeAlignmentAttr(); + ::mlir::Attribute removeWeakAttr(); + ::mlir::Attribute removeVolatile_Attr(); + ::mlir::Attribute removeAccessGroupsAttr(); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value ptr, Value cmp, Value val, LLVM::AtomicOrdering successOrdering, LLVM::AtomicOrdering failureOrdering, StringRef syncscope = StringRef(), unsigned alignment = 0, bool isWeak = false, bool isVolatile = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr success_ordering, ::mlir::LLVM::AtomicOrderingAttr failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr weak, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value cmp, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering success_ordering, ::mlir::LLVM::AtomicOrdering failure_ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool weak, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AtomicCmpXchgOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::AtomicRMWOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicRMWOpGenericAdaptorBase { +public: + struct Properties { + using access_groupsTy = ::mlir::ArrayAttr; + access_groupsTy access_groups; + + auto getAccessGroups() { + auto &propStorage = this->access_groups; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAccessGroups(const ::mlir::ArrayAttr &propValue) { + this->access_groups = propValue; + } + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using bin_opTy = ::mlir::LLVM::AtomicBinOpAttr; + bin_opTy bin_op; + + auto getBinOp() { + auto &propStorage = this->bin_op; + return ::llvm::cast<::mlir::LLVM::AtomicBinOpAttr>(propStorage); + } + void setBinOp(const ::mlir::LLVM::AtomicBinOpAttr &propValue) { + this->bin_op = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using orderingTy = ::mlir::LLVM::AtomicOrderingAttr; + orderingTy ordering; + + auto getOrdering() { + auto &propStorage = this->ordering; + return ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(propStorage); + } + void setOrdering(const ::mlir::LLVM::AtomicOrderingAttr &propValue) { + this->ordering = propValue; + } + using syncscopeTy = ::mlir::StringAttr; + syncscopeTy syncscope; + + auto getSyncscope() { + auto &propStorage = this->syncscope; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSyncscope(const ::mlir::StringAttr &propValue) { + this->syncscope = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + using volatile_Ty = ::mlir::UnitAttr; + volatile_Ty volatile_; + + auto getVolatile_() { + auto &propStorage = this->volatile_; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setVolatile_(const ::mlir::UnitAttr &propValue) { + this->volatile_ = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.access_groups == this->access_groups && + rhs.alias_scopes == this->alias_scopes && + rhs.alignment == this->alignment && + rhs.bin_op == this->bin_op && + rhs.noalias_scopes == this->noalias_scopes && + rhs.ordering == this->ordering && + rhs.syncscope == this->syncscope && + rhs.tbaa == this->tbaa && + rhs.volatile_ == this->volatile_ && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AtomicRMWOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicRMWOpGenericAdaptorBase(AtomicRMWOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::AtomicBinOpAttr getBinOpAttr(); + ::mlir::LLVM::AtomicBinOp getBinOp(); + ::mlir::LLVM::AtomicOrderingAttr getOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::UnitAttr getVolatile_Attr(); + bool getVolatile_(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class AtomicRMWOpGenericAdaptor : public detail::AtomicRMWOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicRMWOpGenericAdaptorBase; +public: + AtomicRMWOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicRMWOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicRMWOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AtomicRMWOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicRMWOpAdaptor : public AtomicRMWOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicRMWOpGenericAdaptor::AtomicRMWOpGenericAdaptor; + AtomicRMWOpAdaptor(AtomicRMWOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicRMWOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AccessGroupOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicRMWOpAdaptor; + template + using GenericAdaptor = AtomicRMWOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("access_groups"), ::llvm::StringRef("alias_scopes"), ::llvm::StringRef("alignment"), ::llvm::StringRef("bin_op"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("ordering"), ::llvm::StringRef("syncscope"), ::llvm::StringRef("tbaa"), ::llvm::StringRef("volatile_")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAccessGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAccessGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBinOpAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBinOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOrderingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOrderingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSyncscopeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSyncscopeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getVolatile_AttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getVolatile_AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.atomicrmw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::Value getVal(); + ::mlir::OpOperand &getPtrMutable(); + ::mlir::OpOperand &getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::AtomicBinOpAttr getBinOpAttr(); + ::mlir::LLVM::AtomicBinOp getBinOp(); + ::mlir::LLVM::AtomicOrderingAttr getOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::UnitAttr getVolatile_Attr(); + bool getVolatile_(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setBinOpAttr(::mlir::LLVM::AtomicBinOpAttr attr); + void setBinOp(::mlir::LLVM::AtomicBinOp attrValue); + void setOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr); + void setOrdering(::mlir::LLVM::AtomicOrdering attrValue); + void setSyncscopeAttr(::mlir::StringAttr attr); + void setSyncscope(::std::optional<::llvm::StringRef> attrValue); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + void setVolatile_Attr(::mlir::UnitAttr attr); + void setVolatile_(bool attrValue); + void setAccessGroupsAttr(::mlir::ArrayAttr attr); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeSyncscopeAttr(); + ::mlir::Attribute removeAlignmentAttr(); + ::mlir::Attribute removeVolatile_Attr(); + ::mlir::Attribute removeAccessGroupsAttr(); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVM::AtomicBinOp binOp, Value ptr, Value val, LLVM::AtomicOrdering ordering, StringRef syncscope = StringRef(), unsigned alignment = 0, bool isVolatile = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOpAttr bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicBinOp bin_op, ::mlir::Value ptr, ::mlir::Value val, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AtomicRMWOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::BitcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitcastOpGenericAdaptorBase(BitcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitcastOpGenericAdaptor : public detail::BitcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitcastOpGenericAdaptorBase; +public: + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitcastOpAdaptor : public BitcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitcastOpGenericAdaptor::BitcastOpGenericAdaptor; + BitcastOpAdaptor(BitcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::PromotableOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitcastOpAdaptor; + template + using GenericAdaptor = BitcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.bitcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + bool canUsesBeRemoved(const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::BitcastOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::BrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BrOpGenericAdaptorBase { +public: + struct Properties { + using loop_annotationTy = ::mlir::LLVM::LoopAnnotationAttr; + loop_annotationTy loop_annotation; + + auto getLoopAnnotation() { + auto &propStorage = this->loop_annotation; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::LoopAnnotationAttr>(propStorage); + } + void setLoopAnnotation(const ::mlir::LLVM::LoopAnnotationAttr &propValue) { + this->loop_annotation = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.loop_annotation == this->loop_annotation && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BrOpGenericAdaptorBase(BrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::LoopAnnotationAttr getLoopAnnotationAttr(); + ::std::optional<::mlir::LLVM::LoopAnnotationAttr> getLoopAnnotation(); +}; +} // namespace detail +template +class BrOpGenericAdaptor : public detail::BrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BrOpGenericAdaptorBase; +public: + BrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDestOperands() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BrOpAdaptor : public BrOpGenericAdaptor<::mlir::ValueRange> { +public: + using BrOpGenericAdaptor::BrOpGenericAdaptor; + BrOpAdaptor(BrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BrOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BrOpAdaptor; + template + using GenericAdaptor = BrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("loop_annotation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLoopAnnotationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLoopAnnotationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.br"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDestOperands(); + ::mlir::MutableOperandRange getDestOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::LoopAnnotationAttr getLoopAnnotationAttr(); + ::std::optional<::mlir::LLVM::LoopAnnotationAttr> getLoopAnnotation(); + void setLoopAnnotationAttr(::mlir::LLVM::LoopAnnotationAttr attr); + ::mlir::Attribute removeLoopAnnotationAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Block *dest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, Block *dest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, SuccessorRange destinations, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange destOperands, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::SuccessorOperands getSuccessorOperands(unsigned index); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::BrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CallIntrinsicOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CallIntrinsicOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + using intrinTy = ::mlir::StringAttr; + intrinTy intrin; + + auto getIntrin() { + auto &propStorage = this->intrin; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setIntrin(const ::mlir::StringAttr &propValue) { + this->intrin = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + rhs.intrin == this->intrin && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CallIntrinsicOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CallIntrinsicOpGenericAdaptorBase(CallIntrinsicOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getIntrinAttr(); + ::llvm::StringRef getIntrin(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class CallIntrinsicOpGenericAdaptor : public detail::CallIntrinsicOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CallIntrinsicOpGenericAdaptorBase; +public: + CallIntrinsicOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CallIntrinsicOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CallIntrinsicOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CallIntrinsicOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CallIntrinsicOpAdaptor : public CallIntrinsicOpGenericAdaptor<::mlir::ValueRange> { +public: + using CallIntrinsicOpGenericAdaptor::CallIntrinsicOpGenericAdaptor; + CallIntrinsicOpAdaptor(CallIntrinsicOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CallIntrinsicOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CallIntrinsicOpAdaptor; + template + using GenericAdaptor = CallIntrinsicOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags"), ::llvm::StringRef("intrin")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIntrinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIntrinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.call_intrinsic"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResults(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getIntrinAttr(); + ::llvm::StringRef getIntrin(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setIntrinAttr(::mlir::StringAttr attr); + void setIntrin(::llvm::StringRef attrValue); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type results, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type results, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef intrin, ::mlir::ValueRange args, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CallIntrinsicOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CallOpGenericAdaptorBase { +public: + struct Properties { + using access_groupsTy = ::mlir::ArrayAttr; + access_groupsTy access_groups; + + auto getAccessGroups() { + auto &propStorage = this->access_groups; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAccessGroups(const ::mlir::ArrayAttr &propValue) { + this->access_groups = propValue; + } + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using branch_weightsTy = ::mlir::DenseI32ArrayAttr; + branch_weightsTy branch_weights; + + auto getBranchWeights() { + auto &propStorage = this->branch_weights; + return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); + } + void setBranchWeights(const ::mlir::DenseI32ArrayAttr &propValue) { + this->branch_weights = propValue; + } + using calleeTy = ::mlir::FlatSymbolRefAttr; + calleeTy callee; + + auto getCallee() { + auto &propStorage = this->callee; + return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setCallee(const ::mlir::FlatSymbolRefAttr &propValue) { + this->callee = propValue; + } + using callee_typeTy = ::mlir::TypeAttr; + callee_typeTy callee_type; + + auto getCalleeType() { + auto &propStorage = this->callee_type; + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(propStorage); + } + void setCalleeType(const ::mlir::TypeAttr &propValue) { + this->callee_type = propValue; + } + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.access_groups == this->access_groups && + rhs.alias_scopes == this->alias_scopes && + rhs.branch_weights == this->branch_weights && + rhs.callee == this->callee && + rhs.callee_type == this->callee_type && + rhs.fastmathFlags == this->fastmathFlags && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CallOpGenericAdaptorBase(CallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getCalleeTypeAttr(); + ::std::optional<::mlir::LLVM::LLVMFunctionType> getCalleeType(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::std::optional< ::llvm::StringRef > getCallee(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + ::mlir::DenseI32ArrayAttr getBranchWeightsAttr(); + ::std::optional<::llvm::ArrayRef> getBranchWeights(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class CallOpGenericAdaptor : public detail::CallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CallOpGenericAdaptorBase; +public: + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CallOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getCalleeOperands() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CallOpAdaptor : public CallOpGenericAdaptor<::mlir::ValueRange> { +public: + using CallOpGenericAdaptor::CallOpGenericAdaptor; + CallOpAdaptor(CallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CallOpAdaptor; + template + using GenericAdaptor = CallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("access_groups"), ::llvm::StringRef("alias_scopes"), ::llvm::StringRef("branch_weights"), ::llvm::StringRef("callee"), ::llvm::StringRef("callee_type"), ::llvm::StringRef("fastmathFlags"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAccessGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAccessGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBranchWeightsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBranchWeightsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getCalleeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCalleeTypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCalleeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.call"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getCalleeOperands(); + ::mlir::MutableOperandRange getCalleeOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypeAttr getCalleeTypeAttr(); + ::std::optional<::mlir::LLVM::LLVMFunctionType> getCalleeType(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::std::optional< ::llvm::StringRef > getCallee(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + ::mlir::DenseI32ArrayAttr getBranchWeightsAttr(); + ::std::optional<::llvm::ArrayRef> getBranchWeights(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setCalleeTypeAttr(::mlir::TypeAttr attr); + void setCalleeType(::std::optional<::mlir::LLVM::LLVMFunctionType> attrValue); + void setCalleeAttr(::mlir::FlatSymbolRefAttr attr); + void setCallee(::std::optional<::llvm::StringRef> attrValue); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + void setBranchWeightsAttr(::mlir::DenseI32ArrayAttr attr); + void setBranchWeights(::std::optional<::llvm::ArrayRef> attrValue); + void setAccessGroupsAttr(::mlir::ArrayAttr attr); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeCalleeTypeAttr(); + ::mlir::Attribute removeCalleeAttr(); + ::mlir::Attribute removeBranchWeightsAttr(); + ::mlir::Attribute removeAccessGroupsAttr(); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFuncOp func, ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFunctionType calleeType, ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, StringAttr callee, ValueRange args = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, FlatSymbolRefAttr callee, ValueRange args = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange results, StringRef callee, ValueRange args = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFunctionType calleeType, StringAttr callee, ValueRange args = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFunctionType calleeType, FlatSymbolRefAttr callee, ValueRange args = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFunctionType calleeType, StringRef callee, ValueRange args = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value callee, ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type result, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::LLVM::FastmathFlags fastmathFlags, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + ::mlir::CallInterfaceCallable getCallableForCallee(); + void setCalleeFromCallable(::mlir::CallInterfaceCallable callee); + ::mlir::Operation::operand_range getArgOperands(); + ::mlir::MutableOperandRange getArgOperandsMutable(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the callee function type. + LLVMFunctionType getCalleeFunctionType(); +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CallOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ComdatOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ComdatOpGenericAdaptorBase { +public: + struct Properties { + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.sym_name == this->sym_name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ComdatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ComdatOpGenericAdaptorBase(ComdatOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ComdatOpGenericAdaptor : public detail::ComdatOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ComdatOpGenericAdaptorBase; +public: + ComdatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ComdatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ComdatOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ComdatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ComdatOpAdaptor : public ComdatOpGenericAdaptor<::mlir::ValueRange> { +public: + using ComdatOpGenericAdaptor::ComdatOpGenericAdaptor; + ComdatOpAdaptor(ComdatOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ComdatOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ComdatOpAdaptor; + template + using GenericAdaptor = ComdatOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.comdat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef symName); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ComdatOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ComdatSelectorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ComdatSelectorOpGenericAdaptorBase { +public: + struct Properties { + using comdatTy = ::mlir::LLVM::comdat::ComdatAttr; + comdatTy comdat; + + auto getComdat() { + auto &propStorage = this->comdat; + return ::llvm::cast<::mlir::LLVM::comdat::ComdatAttr>(propStorage); + } + void setComdat(const ::mlir::LLVM::comdat::ComdatAttr &propValue) { + this->comdat = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.comdat == this->comdat && + rhs.sym_name == this->sym_name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ComdatSelectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ComdatSelectorOpGenericAdaptorBase(ComdatSelectorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::LLVM::comdat::ComdatAttr getComdatAttr(); + ::mlir::LLVM::comdat::Comdat getComdat(); +}; +} // namespace detail +template +class ComdatSelectorOpGenericAdaptor : public detail::ComdatSelectorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ComdatSelectorOpGenericAdaptorBase; +public: + ComdatSelectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ComdatSelectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ComdatSelectorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ComdatSelectorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ComdatSelectorOpAdaptor : public ComdatSelectorOpGenericAdaptor<::mlir::ValueRange> { +public: + using ComdatSelectorOpGenericAdaptor::ComdatSelectorOpGenericAdaptor; + ComdatSelectorOpAdaptor(ComdatSelectorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ComdatSelectorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ComdatSelectorOpAdaptor; + template + using GenericAdaptor = ComdatSelectorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("comdat"), ::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComdatAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComdatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.comdat_selector"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::LLVM::comdat::ComdatAttr getComdatAttr(); + ::mlir::LLVM::comdat::Comdat getComdat(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setComdatAttr(::mlir::LLVM::comdat::ComdatAttr attr); + void setComdat(::mlir::LLVM::comdat::Comdat attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::LLVM::comdat::ComdatAttr comdat); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::LLVM::comdat::Comdat comdat); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ComdatSelectorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::CondBrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CondBrOpGenericAdaptorBase { +public: + struct Properties { + using branch_weightsTy = ::mlir::DenseI32ArrayAttr; + branch_weightsTy branch_weights; + + auto getBranchWeights() { + auto &propStorage = this->branch_weights; + return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); + } + void setBranchWeights(const ::mlir::DenseI32ArrayAttr &propValue) { + this->branch_weights = propValue; + } + using loop_annotationTy = ::mlir::LLVM::LoopAnnotationAttr; + loop_annotationTy loop_annotation; + + auto getLoopAnnotation() { + auto &propStorage = this->loop_annotation; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::LoopAnnotationAttr>(propStorage); + } + void setLoopAnnotation(const ::mlir::LLVM::LoopAnnotationAttr &propValue) { + this->loop_annotation = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.branch_weights == this->branch_weights && + rhs.loop_annotation == this->loop_annotation && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CondBrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CondBrOpGenericAdaptorBase(CondBrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI32ArrayAttr getBranchWeightsAttr(); + ::std::optional<::llvm::ArrayRef> getBranchWeights(); + ::mlir::LLVM::LoopAnnotationAttr getLoopAnnotationAttr(); + ::std::optional<::mlir::LLVM::LoopAnnotationAttr> getLoopAnnotation(); +}; +} // namespace detail +template +class CondBrOpGenericAdaptor : public detail::CondBrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CondBrOpGenericAdaptorBase; +public: + CondBrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CondBrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CondBrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CondBrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + RangeT getTrueDestOperands() { + return getODSOperands(1); + } + + RangeT getFalseDestOperands() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CondBrOpAdaptor : public CondBrOpGenericAdaptor<::mlir::ValueRange> { +public: + using CondBrOpGenericAdaptor::CondBrOpGenericAdaptor; + CondBrOpAdaptor(CondBrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CondBrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::BranchOpInterface::Trait, ::mlir::LLVM::BranchWeightOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = CondBrOpAdaptor; + template + using GenericAdaptor = CondBrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("branch_weights"), ::llvm::StringRef("loop_annotation"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBranchWeightsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBranchWeightsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLoopAnnotationAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLoopAnnotationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.cond_br"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getCondition(); + ::mlir::Operation::operand_range getTrueDestOperands(); + ::mlir::Operation::operand_range getFalseDestOperands(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::MutableOperandRange getTrueDestOperandsMutable(); + ::mlir::MutableOperandRange getFalseDestOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI32ArrayAttr getBranchWeightsAttr(); + ::std::optional<::llvm::ArrayRef> getBranchWeights(); + ::mlir::LLVM::LoopAnnotationAttr getLoopAnnotationAttr(); + ::std::optional<::mlir::LLVM::LoopAnnotationAttr> getLoopAnnotation(); + void setBranchWeightsAttr(::mlir::DenseI32ArrayAttr attr); + void setBranchWeights(::std::optional<::llvm::ArrayRef> attrValue); + void setLoopAnnotationAttr(::mlir::LLVM::LoopAnnotationAttr attr); + ::mlir::Attribute removeBranchWeightsAttr(); + ::mlir::Attribute removeLoopAnnotationAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Block *trueDest, ValueRange trueOperands, Block *falseDest, ValueRange falseOperands, std::optional> weights = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Block *trueDest, Block *falseDest, ValueRange falseOperands = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, ValueRange trueOperands, ValueRange falseOperands, DenseI32ArrayAttr branchWeights, Block *trueDest, Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, SuccessorRange destinations, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange trueDestOperands, ::mlir::ValueRange falseDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, /*optional*/::mlir::LLVM::LoopAnnotationAttr loop_annotation, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::SuccessorOperands getSuccessorOperands(unsigned index); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CondBrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ConstantOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstantOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::Attribute; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::cast<::mlir::Attribute>(propStorage); + } + void setValue(const ::mlir::Attribute &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstantOpGenericAdaptorBase(ConstantOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getValueAttr(); + ::mlir::Attribute getValue(); +}; +} // namespace detail +template +class ConstantOpGenericAdaptor : public detail::ConstantOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstantOpGenericAdaptorBase; +public: + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstantOpAdaptor : public ConstantOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstantOpGenericAdaptor::ConstantOpGenericAdaptor; + ConstantOpAdaptor(ConstantOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstantOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ConstantLike> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstantOpAdaptor; + template + using GenericAdaptor = ConstantOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mlir.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::Attribute getValueAttr(); + ::mlir::Attribute getValue(); + void setValueAttr(::mlir::Attribute attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, int64_t value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, const APInt &value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, const APFloat &value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypedAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Whether the constant op can be constructed with a particular value and + /// type. + static bool isBuildableWith(Attribute value, Type type); + + /// Build the constant op with `value` and `type` if possible, otherwise + /// returns null. + static ConstantOp materialize(OpBuilder &builder, Attribute value, + Type type, Location loc); +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ConstantOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExtractElementOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtractElementOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExtractElementOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtractElementOpGenericAdaptorBase(ExtractElementOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExtractElementOpGenericAdaptor : public detail::ExtractElementOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtractElementOpGenericAdaptorBase; +public: + ExtractElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtractElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtractElementOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExtractElementOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVector() { + return (*getODSOperands(0).begin()); + } + + ValueT getPosition() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtractElementOpAdaptor : public ExtractElementOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtractElementOpGenericAdaptor::ExtractElementOpGenericAdaptor; + ExtractElementOpAdaptor(ExtractElementOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtractElementOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtractElementOpAdaptor; + template + using GenericAdaptor = ExtractElementOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.extractelement"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVector(); + ::mlir::TypedValue<::mlir::IntegerType> getPosition(); + ::mlir::OpOperand &getVectorMutable(); + ::mlir::OpOperand &getPositionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value position); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExtractElementOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ExtractValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtractValueOpGenericAdaptorBase { +public: + struct Properties { + using positionTy = ::mlir::DenseI64ArrayAttr; + positionTy position; + + auto getPosition() { + auto &propStorage = this->position; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setPosition(const ::mlir::DenseI64ArrayAttr &propValue) { + this->position = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.position == this->position && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExtractValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtractValueOpGenericAdaptorBase(ExtractValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI64ArrayAttr getPositionAttr(); + ::llvm::ArrayRef getPosition(); +}; +} // namespace detail +template +class ExtractValueOpGenericAdaptor : public detail::ExtractValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtractValueOpGenericAdaptorBase; +public: + ExtractValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtractValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtractValueOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExtractValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContainer() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtractValueOpAdaptor : public ExtractValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtractValueOpGenericAdaptor::ExtractValueOpGenericAdaptor; + ExtractValueOpAdaptor(ExtractValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtractValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtractValueOpAdaptor; + template + using GenericAdaptor = ExtractValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("position")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPositionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPositionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.extractvalue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getContainer(); + ::mlir::OpOperand &getContainerMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI64ArrayAttr getPositionAttr(); + ::llvm::ArrayRef getPosition(); + void setPositionAttr(::mlir::DenseI64ArrayAttr attr); + void setPosition(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value container, ArrayRef position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::DenseI64ArrayAttr position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::llvm::ArrayRef position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::llvm::ArrayRef position); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ExtractValueOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FAddOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FAddOpGenericAdaptorBase(FAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FAddOpGenericAdaptor : public detail::FAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FAddOpGenericAdaptorBase; +public: + FAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FAddOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FAddOpAdaptor : public FAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using FAddOpGenericAdaptor::FAddOpGenericAdaptor; + FAddOpAdaptor(FAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FAddOpAdaptor; + template + using GenericAdaptor = FAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fadd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FAddOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FCmpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FCmpOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + using predicateTy = ::mlir::LLVM::FCmpPredicateAttr; + predicateTy predicate; + + auto getPredicate() { + auto &propStorage = this->predicate; + return ::llvm::cast<::mlir::LLVM::FCmpPredicateAttr>(propStorage); + } + void setPredicate(const ::mlir::LLVM::FCmpPredicateAttr &propValue) { + this->predicate = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + rhs.predicate == this->predicate && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FCmpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FCmpOpGenericAdaptorBase(FCmpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FCmpPredicateAttr getPredicateAttr(); + ::mlir::LLVM::FCmpPredicate getPredicate(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FCmpOpGenericAdaptor : public detail::FCmpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FCmpOpGenericAdaptorBase; +public: + FCmpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FCmpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FCmpOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FCmpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FCmpOpAdaptor : public FCmpOpGenericAdaptor<::mlir::ValueRange> { +public: + using FCmpOpGenericAdaptor::FCmpOpGenericAdaptor; + FCmpOpAdaptor(FCmpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FCmpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FCmpOpAdaptor; + template + using GenericAdaptor = FCmpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags"), ::llvm::StringRef("predicate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPredicateAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPredicateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fcmp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FCmpPredicateAttr getPredicateAttr(); + ::mlir::LLVM::FCmpPredicate getPredicate(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setPredicateAttr(::mlir::LLVM::FCmpPredicateAttr attr); + void setPredicate(::mlir::LLVM::FCmpPredicate attrValue); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::FCmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FCmpOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FDivOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FDivOpGenericAdaptorBase(FDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FDivOpGenericAdaptor : public detail::FDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FDivOpGenericAdaptorBase; +public: + FDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FDivOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FDivOpAdaptor : public FDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using FDivOpGenericAdaptor::FDivOpGenericAdaptor; + FDivOpAdaptor(FDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FDivOpAdaptor; + template + using GenericAdaptor = FDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fdiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FMulOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FMulOpGenericAdaptorBase(FMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FMulOpGenericAdaptor : public detail::FMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FMulOpGenericAdaptorBase; +public: + FMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FMulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FMulOpAdaptor : public FMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using FMulOpGenericAdaptor::FMulOpGenericAdaptor; + FMulOpAdaptor(FMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FMulOpAdaptor; + template + using GenericAdaptor = FMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FMulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FNegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FNegOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FNegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FNegOpGenericAdaptorBase(FNegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FNegOpGenericAdaptor : public detail::FNegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FNegOpGenericAdaptorBase; +public: + FNegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FNegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FNegOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FNegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FNegOpAdaptor : public FNegOpGenericAdaptor<::mlir::ValueRange> { +public: + using FNegOpGenericAdaptor::FNegOpGenericAdaptor; + FNegOpAdaptor(FNegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FNegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FNegOpAdaptor; + template + using GenericAdaptor = FNegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fneg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FNegOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FPExtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FPExtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FPExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FPExtOpGenericAdaptorBase(FPExtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FPExtOpGenericAdaptor : public detail::FPExtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FPExtOpGenericAdaptorBase; +public: + FPExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FPExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FPExtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FPExtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FPExtOpAdaptor : public FPExtOpGenericAdaptor<::mlir::ValueRange> { +public: + using FPExtOpGenericAdaptor::FPExtOpGenericAdaptor; + FPExtOpAdaptor(FPExtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FPExtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FPExtOpAdaptor; + template + using GenericAdaptor = FPExtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fpext"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FPToSIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FPToSIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FPToSIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FPToSIOpGenericAdaptorBase(FPToSIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FPToSIOpGenericAdaptor : public detail::FPToSIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FPToSIOpGenericAdaptorBase; +public: + FPToSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FPToSIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FPToSIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FPToSIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FPToSIOpAdaptor : public FPToSIOpGenericAdaptor<::mlir::ValueRange> { +public: + using FPToSIOpGenericAdaptor::FPToSIOpGenericAdaptor; + FPToSIOpAdaptor(FPToSIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FPToSIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FPToSIOpAdaptor; + template + using GenericAdaptor = FPToSIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fptosi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPToSIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FPToUIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FPToUIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FPToUIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FPToUIOpGenericAdaptorBase(FPToUIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FPToUIOpGenericAdaptor : public detail::FPToUIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FPToUIOpGenericAdaptorBase; +public: + FPToUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FPToUIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FPToUIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FPToUIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FPToUIOpAdaptor : public FPToUIOpGenericAdaptor<::mlir::ValueRange> { +public: + using FPToUIOpGenericAdaptor::FPToUIOpGenericAdaptor; + FPToUIOpAdaptor(FPToUIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FPToUIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FPToUIOpAdaptor; + template + using GenericAdaptor = FPToUIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fptoui"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPToUIOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FPTruncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FPTruncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FPTruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FPTruncOpGenericAdaptorBase(FPTruncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FPTruncOpGenericAdaptor : public detail::FPTruncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FPTruncOpGenericAdaptorBase; +public: + FPTruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FPTruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FPTruncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FPTruncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FPTruncOpAdaptor : public FPTruncOpGenericAdaptor<::mlir::ValueRange> { +public: + using FPTruncOpGenericAdaptor::FPTruncOpGenericAdaptor; + FPTruncOpAdaptor(FPTruncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FPTruncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FPTruncOpAdaptor; + template + using GenericAdaptor = FPTruncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fptrunc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FPTruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FRemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FRemOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FRemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FRemOpGenericAdaptorBase(FRemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FRemOpGenericAdaptor : public detail::FRemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FRemOpGenericAdaptorBase; +public: + FRemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FRemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FRemOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FRemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FRemOpAdaptor : public FRemOpGenericAdaptor<::mlir::ValueRange> { +public: + using FRemOpGenericAdaptor::FRemOpGenericAdaptor; + FRemOpAdaptor(FRemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FRemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FRemOpAdaptor; + template + using GenericAdaptor = FRemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.frem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FRemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FSubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FSubOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FSubOpGenericAdaptorBase(FSubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class FSubOpGenericAdaptor : public detail::FSubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FSubOpGenericAdaptorBase; +public: + FSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FSubOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FSubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FSubOpAdaptor : public FSubOpGenericAdaptor<::mlir::ValueRange> { +public: + using FSubOpGenericAdaptor::FSubOpGenericAdaptor; + FSubOpAdaptor(FSubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FSubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FSubOpAdaptor; + template + using GenericAdaptor = FSubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fsub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FSubOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FenceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FenceOpGenericAdaptorBase { +public: + struct Properties { + using orderingTy = ::mlir::LLVM::AtomicOrderingAttr; + orderingTy ordering; + + auto getOrdering() { + auto &propStorage = this->ordering; + return ::llvm::cast<::mlir::LLVM::AtomicOrderingAttr>(propStorage); + } + void setOrdering(const ::mlir::LLVM::AtomicOrderingAttr &propValue) { + this->ordering = propValue; + } + using syncscopeTy = ::mlir::StringAttr; + syncscopeTy syncscope; + + auto getSyncscope() { + auto &propStorage = this->syncscope; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSyncscope(const ::mlir::StringAttr &propValue) { + this->syncscope = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.ordering == this->ordering && + rhs.syncscope == this->syncscope && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FenceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FenceOpGenericAdaptorBase(FenceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::AtomicOrderingAttr getOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); +}; +} // namespace detail +template +class FenceOpGenericAdaptor : public detail::FenceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FenceOpGenericAdaptorBase; +public: + FenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FenceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FenceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FenceOpAdaptor : public FenceOpGenericAdaptor<::mlir::ValueRange> { +public: + using FenceOpGenericAdaptor::FenceOpGenericAdaptor; + FenceOpAdaptor(FenceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FenceOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FenceOpAdaptor; + template + using GenericAdaptor = FenceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("ordering"), ::llvm::StringRef("syncscope")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOrderingAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOrderingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSyncscopeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSyncscopeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.fence"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::AtomicOrderingAttr getOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); + void setOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr); + void setOrdering(::mlir::LLVM::AtomicOrdering attrValue); + void setSyncscopeAttr(::mlir::StringAttr attr); + void setSyncscope(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSyncscopeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVM::AtomicOrdering ordering, StringRef syncscope = StringRef()); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FenceOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::FreezeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FreezeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FreezeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FreezeOpGenericAdaptorBase(FreezeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FreezeOpGenericAdaptor : public detail::FreezeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FreezeOpGenericAdaptorBase; +public: + FreezeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FreezeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FreezeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FreezeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FreezeOpAdaptor : public FreezeOpGenericAdaptor<::mlir::ValueRange> { +public: + using FreezeOpGenericAdaptor::FreezeOpGenericAdaptor; + FreezeOpAdaptor(FreezeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FreezeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FreezeOpAdaptor; + template + using GenericAdaptor = FreezeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.freeze"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::OpOperand &getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FreezeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GEPOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GEPOpGenericAdaptorBase { +public: + struct Properties { + using elem_typeTy = ::mlir::TypeAttr; + elem_typeTy elem_type; + + auto getElemType() { + auto &propStorage = this->elem_type; + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(propStorage); + } + void setElemType(const ::mlir::TypeAttr &propValue) { + this->elem_type = propValue; + } + using inboundsTy = ::mlir::UnitAttr; + inboundsTy inbounds; + + auto getInbounds() { + auto &propStorage = this->inbounds; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setInbounds(const ::mlir::UnitAttr &propValue) { + this->inbounds = propValue; + } + using rawConstantIndicesTy = ::mlir::DenseI32ArrayAttr; + rawConstantIndicesTy rawConstantIndices; + + auto getRawConstantIndices() { + auto &propStorage = this->rawConstantIndices; + return ::llvm::cast<::mlir::DenseI32ArrayAttr>(propStorage); + } + void setRawConstantIndices(const ::mlir::DenseI32ArrayAttr &propValue) { + this->rawConstantIndices = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.elem_type == this->elem_type && + rhs.inbounds == this->inbounds && + rhs.rawConstantIndices == this->rawConstantIndices && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GEPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GEPOpGenericAdaptorBase(GEPOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI32ArrayAttr getRawConstantIndicesAttr(); + ::llvm::ArrayRef getRawConstantIndices(); + ::mlir::TypeAttr getElemTypeAttr(); + ::std::optional<::mlir::Type> getElemType(); + ::mlir::UnitAttr getInboundsAttr(); + bool getInbounds(); +}; +} // namespace detail +template +class GEPOpGenericAdaptor : public detail::GEPOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GEPOpGenericAdaptorBase; +public: + GEPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GEPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GEPOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GEPOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBase() { + return (*getODSOperands(0).begin()); + } + + RangeT getDynamicIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GEPOpAdaptor : public GEPOpGenericAdaptor<::mlir::ValueRange> { +public: + using GEPOpGenericAdaptor::GEPOpGenericAdaptor; + GEPOpAdaptor(GEPOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GEPOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::PromotableOpInterface::Trait, ::mlir::SafeMemorySlotAccessOpInterface::Trait, ::mlir::DestructurableAccessorOpInterface::Trait, ::mlir::LLVM::GetResultPtrElementType::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GEPOpAdaptor; + template + using GenericAdaptor = GEPOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("elem_type"), ::llvm::StringRef("inbounds"), ::llvm::StringRef("rawConstantIndices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElemTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElemTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInboundsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInboundsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRawConstantIndicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRawConstantIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.getelementptr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getBase(); + ::mlir::Operation::operand_range getDynamicIndices(); + ::mlir::OpOperand &getBaseMutable(); + ::mlir::MutableOperandRange getDynamicIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI32ArrayAttr getRawConstantIndicesAttr(); + ::llvm::ArrayRef getRawConstantIndices(); + ::mlir::TypeAttr getElemTypeAttr(); + ::std::optional<::mlir::Type> getElemType(); + ::mlir::UnitAttr getInboundsAttr(); + bool getInbounds(); + void setRawConstantIndicesAttr(::mlir::DenseI32ArrayAttr attr); + void setRawConstantIndices(::llvm::ArrayRef attrValue); + void setElemTypeAttr(::mlir::TypeAttr attr); + void setElemType(::std::optional<::mlir::Type> attrValue); + void setInboundsAttr(::mlir::UnitAttr attr); + void setInbounds(bool attrValue); + ::mlir::Attribute removeElemTypeAttr(); + ::mlir::Attribute removeInboundsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Type basePtrType, Value basePtr, ValueRange indices, bool inbounds = false, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value basePtr, ValueRange indices, bool inbounds = false, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value basePtr, ArrayRef indices, bool inbounds = false, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Type basePtrType, Value basePtr, ArrayRef indices, bool inbounds = false, ArrayRef attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + bool canUsesBeRemoved(const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter); + ::mlir::LogicalResult ensureOnlySafeAccesses(const ::mlir::MemorySlot &slot, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + ::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots, ::mlir::RewriterBase &rewriter); + Type getResultPtrElementType(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + constexpr static int32_t kDynamicIndex = std::numeric_limits::min(); + + /// Returns the type pointed to by the pointer argument of this GEP. + Type getSourceElementType(); + + GEPIndicesAdaptor getIndices(); +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::GEPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GlobalCtorsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalCtorsOpGenericAdaptorBase { +public: + struct Properties { + using ctorsTy = ::mlir::ArrayAttr; + ctorsTy ctors; + + auto getCtors() { + auto &propStorage = this->ctors; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setCtors(const ::mlir::ArrayAttr &propValue) { + this->ctors = propValue; + } + using prioritiesTy = ::mlir::ArrayAttr; + prioritiesTy priorities; + + auto getPriorities() { + auto &propStorage = this->priorities; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setPriorities(const ::mlir::ArrayAttr &propValue) { + this->priorities = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.ctors == this->ctors && + rhs.priorities == this->priorities && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalCtorsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalCtorsOpGenericAdaptorBase(GlobalCtorsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getCtorsAttr(); + ::mlir::ArrayAttr getCtors(); + ::mlir::ArrayAttr getPrioritiesAttr(); + ::mlir::ArrayAttr getPriorities(); +}; +} // namespace detail +template +class GlobalCtorsOpGenericAdaptor : public detail::GlobalCtorsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalCtorsOpGenericAdaptorBase; +public: + GlobalCtorsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalCtorsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalCtorsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalCtorsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalCtorsOpAdaptor : public GlobalCtorsOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalCtorsOpGenericAdaptor::GlobalCtorsOpGenericAdaptor; + GlobalCtorsOpAdaptor(GlobalCtorsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalCtorsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalCtorsOpAdaptor; + template + using GenericAdaptor = GlobalCtorsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("ctors"), ::llvm::StringRef("priorities")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCtorsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCtorsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPrioritiesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPrioritiesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mlir.global_ctors"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getCtorsAttr(); + ::mlir::ArrayAttr getCtors(); + ::mlir::ArrayAttr getPrioritiesAttr(); + ::mlir::ArrayAttr getPriorities(); + void setCtorsAttr(::mlir::ArrayAttr attr); + void setPrioritiesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr ctors, ::mlir::ArrayAttr priorities); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::GlobalCtorsOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GlobalDtorsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalDtorsOpGenericAdaptorBase { +public: + struct Properties { + using dtorsTy = ::mlir::ArrayAttr; + dtorsTy dtors; + + auto getDtors() { + auto &propStorage = this->dtors; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setDtors(const ::mlir::ArrayAttr &propValue) { + this->dtors = propValue; + } + using prioritiesTy = ::mlir::ArrayAttr; + prioritiesTy priorities; + + auto getPriorities() { + auto &propStorage = this->priorities; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setPriorities(const ::mlir::ArrayAttr &propValue) { + this->priorities = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dtors == this->dtors && + rhs.priorities == this->priorities && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalDtorsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalDtorsOpGenericAdaptorBase(GlobalDtorsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDtorsAttr(); + ::mlir::ArrayAttr getDtors(); + ::mlir::ArrayAttr getPrioritiesAttr(); + ::mlir::ArrayAttr getPriorities(); +}; +} // namespace detail +template +class GlobalDtorsOpGenericAdaptor : public detail::GlobalDtorsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalDtorsOpGenericAdaptorBase; +public: + GlobalDtorsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalDtorsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalDtorsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalDtorsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalDtorsOpAdaptor : public GlobalDtorsOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalDtorsOpGenericAdaptor::GlobalDtorsOpGenericAdaptor; + GlobalDtorsOpAdaptor(GlobalDtorsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalDtorsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalDtorsOpAdaptor; + template + using GenericAdaptor = GlobalDtorsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtors"), ::llvm::StringRef("priorities")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtorsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtorsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPrioritiesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPrioritiesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mlir.global_dtors"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getDtorsAttr(); + ::mlir::ArrayAttr getDtors(); + ::mlir::ArrayAttr getPrioritiesAttr(); + ::mlir::ArrayAttr getPriorities(); + void setDtorsAttr(::mlir::ArrayAttr attr); + void setPrioritiesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr dtors, ::mlir::ArrayAttr priorities); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::GlobalDtorsOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::GlobalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalOpGenericAdaptorBase { +public: + struct Properties { + using addr_spaceTy = ::mlir::IntegerAttr; + addr_spaceTy addr_space; + + auto getAddrSpace() { + auto &propStorage = this->addr_space; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAddrSpace(const ::mlir::IntegerAttr &propValue) { + this->addr_space = propValue; + } + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using comdatTy = ::mlir::SymbolRefAttr; + comdatTy comdat; + + auto getComdat() { + auto &propStorage = this->comdat; + return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); + } + void setComdat(const ::mlir::SymbolRefAttr &propValue) { + this->comdat = propValue; + } + using constantTy = ::mlir::UnitAttr; + constantTy constant; + + auto getConstant() { + auto &propStorage = this->constant; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setConstant(const ::mlir::UnitAttr &propValue) { + this->constant = propValue; + } + using dso_localTy = ::mlir::UnitAttr; + dso_localTy dso_local; + + auto getDsoLocal() { + auto &propStorage = this->dso_local; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setDsoLocal(const ::mlir::UnitAttr &propValue) { + this->dso_local = propValue; + } + using global_typeTy = ::mlir::TypeAttr; + global_typeTy global_type; + + auto getGlobalType() { + auto &propStorage = this->global_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setGlobalType(const ::mlir::TypeAttr &propValue) { + this->global_type = propValue; + } + using linkageTy = ::mlir::LLVM::LinkageAttr; + linkageTy linkage; + + auto getLinkage() { + auto &propStorage = this->linkage; + return ::llvm::cast<::mlir::LLVM::LinkageAttr>(propStorage); + } + void setLinkage(const ::mlir::LLVM::LinkageAttr &propValue) { + this->linkage = propValue; + } + using sectionTy = ::mlir::StringAttr; + sectionTy section; + + auto getSection() { + auto &propStorage = this->section; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSection(const ::mlir::StringAttr &propValue) { + this->section = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using thread_local_Ty = ::mlir::UnitAttr; + thread_local_Ty thread_local_; + + auto getThreadLocal_() { + auto &propStorage = this->thread_local_; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setThreadLocal_(const ::mlir::UnitAttr &propValue) { + this->thread_local_ = propValue; + } + using unnamed_addrTy = ::mlir::LLVM::UnnamedAddrAttr; + unnamed_addrTy unnamed_addr; + + auto getUnnamedAddr() { + auto &propStorage = this->unnamed_addr; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::UnnamedAddrAttr>(propStorage); + } + void setUnnamedAddr(const ::mlir::LLVM::UnnamedAddrAttr &propValue) { + this->unnamed_addr = propValue; + } + using valueTy = ::mlir::Attribute; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(propStorage); + } + void setValue(const ::mlir::Attribute &propValue) { + this->value = propValue; + } + using visibility_Ty = ::mlir::LLVM::VisibilityAttr; + visibility_Ty visibility_; + + auto getVisibility_() { + auto &propStorage = this->visibility_; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(propStorage); + } + void setVisibility_(const ::mlir::LLVM::VisibilityAttr &propValue) { + this->visibility_ = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.addr_space == this->addr_space && + rhs.alignment == this->alignment && + rhs.comdat == this->comdat && + rhs.constant == this->constant && + rhs.dso_local == this->dso_local && + rhs.global_type == this->global_type && + rhs.linkage == this->linkage && + rhs.section == this->section && + rhs.sym_name == this->sym_name && + rhs.thread_local_ == this->thread_local_ && + rhs.unnamed_addr == this->unnamed_addr && + rhs.value == this->value && + rhs.visibility_ == this->visibility_ && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalOpGenericAdaptorBase(GlobalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getGlobalTypeAttr(); + ::mlir::Type getGlobalType(); + ::mlir::UnitAttr getConstantAttr(); + bool getConstant(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::LLVM::LinkageAttr getLinkageAttr(); + ::mlir::LLVM::Linkage getLinkage(); + ::mlir::UnitAttr getDsoLocalAttr(); + bool getDsoLocal(); + ::mlir::UnitAttr getThreadLocal_Attr(); + bool getThreadLocal_(); + ::mlir::Attribute getValueAttr(); + ::std::optional<::mlir::Attribute> getValue(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::IntegerAttr getAddrSpaceAttr(); + uint32_t getAddrSpace(); + ::mlir::LLVM::UnnamedAddrAttr getUnnamedAddrAttr(); + ::std::optional<::mlir::LLVM::UnnamedAddr> getUnnamedAddr(); + ::mlir::StringAttr getSectionAttr(); + ::std::optional< ::llvm::StringRef > getSection(); + ::mlir::SymbolRefAttr getComdatAttr(); + ::std::optional< ::mlir::SymbolRefAttr > getComdat(); + ::mlir::LLVM::VisibilityAttr getVisibility_Attr(); + ::mlir::LLVM::Visibility getVisibility_(); + ::mlir::Region &getInitializer(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class GlobalOpGenericAdaptor : public detail::GlobalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalOpGenericAdaptorBase; +public: + GlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalOpAdaptor : public GlobalOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalOpGenericAdaptor::GlobalOpGenericAdaptor; + GlobalOpAdaptor(GlobalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::SymbolOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalOpAdaptor; + template + using GenericAdaptor = GlobalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("addr_space"), ::llvm::StringRef("alignment"), ::llvm::StringRef("comdat"), ::llvm::StringRef("constant"), ::llvm::StringRef("dso_local"), ::llvm::StringRef("global_type"), ::llvm::StringRef("linkage"), ::llvm::StringRef("section"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("thread_local_"), ::llvm::StringRef("unnamed_addr"), ::llvm::StringRef("value"), ::llvm::StringRef("visibility_")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAddrSpaceAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAddrSpaceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getComdatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getComdatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getConstantAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getConstantAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDsoLocalAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDsoLocalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getGlobalTypeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getGlobalTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getLinkageAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getLinkageAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getSectionAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getSectionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getThreadLocal_AttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getThreadLocal_AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getUnnamedAddrAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getUnnamedAddrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getVisibility_AttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getVisibility_AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mlir.global"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getInitializer(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypeAttr getGlobalTypeAttr(); + ::mlir::Type getGlobalType(); + ::mlir::UnitAttr getConstantAttr(); + bool getConstant(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::LLVM::LinkageAttr getLinkageAttr(); + ::mlir::LLVM::Linkage getLinkage(); + ::mlir::UnitAttr getDsoLocalAttr(); + bool getDsoLocal(); + ::mlir::UnitAttr getThreadLocal_Attr(); + bool getThreadLocal_(); + ::mlir::Attribute getValueAttr(); + ::std::optional<::mlir::Attribute> getValue(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::IntegerAttr getAddrSpaceAttr(); + uint32_t getAddrSpace(); + ::mlir::LLVM::UnnamedAddrAttr getUnnamedAddrAttr(); + ::std::optional<::mlir::LLVM::UnnamedAddr> getUnnamedAddr(); + ::mlir::StringAttr getSectionAttr(); + ::std::optional< ::llvm::StringRef > getSection(); + ::mlir::SymbolRefAttr getComdatAttr(); + ::std::optional< ::mlir::SymbolRefAttr > getComdat(); + ::mlir::LLVM::VisibilityAttr getVisibility_Attr(); + ::mlir::LLVM::Visibility getVisibility_(); + void setGlobalTypeAttr(::mlir::TypeAttr attr); + void setGlobalType(::mlir::Type attrValue); + void setConstantAttr(::mlir::UnitAttr attr); + void setConstant(bool attrValue); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setLinkageAttr(::mlir::LLVM::LinkageAttr attr); + void setLinkage(::mlir::LLVM::Linkage attrValue); + void setDsoLocalAttr(::mlir::UnitAttr attr); + void setDsoLocal(bool attrValue); + void setThreadLocal_Attr(::mlir::UnitAttr attr); + void setThreadLocal_(bool attrValue); + void setValueAttr(::mlir::Attribute attr); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + void setAddrSpaceAttr(::mlir::IntegerAttr attr); + void setAddrSpace(uint32_t attrValue); + void setUnnamedAddrAttr(::mlir::LLVM::UnnamedAddrAttr attr); + void setUnnamedAddr(::std::optional<::mlir::LLVM::UnnamedAddr> attrValue); + void setSectionAttr(::mlir::StringAttr attr); + void setSection(::std::optional<::llvm::StringRef> attrValue); + void setComdatAttr(::mlir::SymbolRefAttr attr); + void setVisibility_Attr(::mlir::LLVM::VisibilityAttr attr); + void setVisibility_(::mlir::LLVM::Visibility attrValue); + ::mlir::Attribute removeConstantAttr(); + ::mlir::Attribute removeDsoLocalAttr(); + ::mlir::Attribute removeThreadLocal_Attr(); + ::mlir::Attribute removeValueAttr(); + ::mlir::Attribute removeAlignmentAttr(); + ::mlir::Attribute removeUnnamedAddrAttr(); + ::mlir::Attribute removeSectionAttr(); + ::mlir::Attribute removeComdatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, bool isConstant, Linkage linkage, StringRef name, Attribute value, uint64_t alignment = 0, unsigned addrSpace = 0, bool dsoLocal = false, bool thread_local_ = false, SymbolRefAttr comdat = {}, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, ::mlir::LLVM::VisibilityAttr visibility_); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr global_type, /*optional*/::mlir::UnitAttr constant, ::mlir::StringAttr sym_name, ::mlir::LLVM::LinkageAttr linkage, /*optional*/::mlir::UnitAttr dso_local, /*optional*/::mlir::UnitAttr thread_local_, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, ::mlir::IntegerAttr addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, ::mlir::LLVM::VisibilityAttr visibility_); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, ::mlir::LLVM::Visibility visibility_ = mlir::LLVM::Visibility::Default); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type global_type, /*optional*/bool constant, ::llvm::StringRef sym_name, ::mlir::LLVM::Linkage linkage, /*optional*/bool dso_local, /*optional*/bool thread_local_, /*optional*/::mlir::Attribute value, /*optional*/::mlir::IntegerAttr alignment, uint32_t addr_space, /*optional*/::mlir::LLVM::UnnamedAddrAttr unnamed_addr, /*optional*/::mlir::StringAttr section, /*optional*/::mlir::SymbolRefAttr comdat, ::mlir::LLVM::Visibility visibility_ = mlir::LLVM::Visibility::Default); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult verifyRegions(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 13 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Return the LLVM type of the global. + Type getType() { + return getGlobalType(); + } + /// Return the initializer attribute if it exists, or a null attribute. + Attribute getValueOrNull() { + return getValue().value_or(Attribute()); + } + /// Return the initializer region. This may be empty, but if it is not it + /// terminates in an `llvm.return` op with the initializer value. + Region &getInitializerRegion() { + return getOperation()->getRegion(0); + } + /// Return the initializer block. If the initializer region is empty this + /// is nullptr. If it is not nullptr, it terminates with an `llvm.return` + /// op with the initializer value. + Block *getInitializerBlock() { + return getInitializerRegion().empty() ? + nullptr : &getInitializerRegion().front(); + } +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::GlobalOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ICmpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ICmpOpGenericAdaptorBase { +public: + struct Properties { + using predicateTy = ::mlir::LLVM::ICmpPredicateAttr; + predicateTy predicate; + + auto getPredicate() { + auto &propStorage = this->predicate; + return ::llvm::cast<::mlir::LLVM::ICmpPredicateAttr>(propStorage); + } + void setPredicate(const ::mlir::LLVM::ICmpPredicateAttr &propValue) { + this->predicate = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.predicate == this->predicate && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ICmpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ICmpOpGenericAdaptorBase(ICmpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::ICmpPredicateAttr getPredicateAttr(); + ::mlir::LLVM::ICmpPredicate getPredicate(); +}; +} // namespace detail +template +class ICmpOpGenericAdaptor : public detail::ICmpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ICmpOpGenericAdaptorBase; +public: + ICmpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ICmpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ICmpOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ICmpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ICmpOpAdaptor : public ICmpOpGenericAdaptor<::mlir::ValueRange> { +public: + using ICmpOpGenericAdaptor::ICmpOpGenericAdaptor; + ICmpOpAdaptor(ICmpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ICmpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ICmpOpAdaptor; + template + using GenericAdaptor = ICmpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("predicate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPredicateAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPredicateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.icmp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::ICmpPredicateAttr getPredicateAttr(); + ::mlir::LLVM::ICmpPredicate getPredicate(); + void setPredicateAttr(::mlir::LLVM::ICmpPredicateAttr attr); + void setPredicate(::mlir::LLVM::ICmpPredicate attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::LLVM::ICmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ICmpOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::InlineAsmOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InlineAsmOpGenericAdaptorBase { +public: + struct Properties { + using asm_dialectTy = ::mlir::LLVM::AsmDialectAttr; + asm_dialectTy asm_dialect; + + auto getAsmDialect() { + auto &propStorage = this->asm_dialect; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::AsmDialectAttr>(propStorage); + } + void setAsmDialect(const ::mlir::LLVM::AsmDialectAttr &propValue) { + this->asm_dialect = propValue; + } + using asm_stringTy = ::mlir::StringAttr; + asm_stringTy asm_string; + + auto getAsmString() { + auto &propStorage = this->asm_string; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setAsmString(const ::mlir::StringAttr &propValue) { + this->asm_string = propValue; + } + using constraintsTy = ::mlir::StringAttr; + constraintsTy constraints; + + auto getConstraints() { + auto &propStorage = this->constraints; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setConstraints(const ::mlir::StringAttr &propValue) { + this->constraints = propValue; + } + using has_side_effectsTy = ::mlir::UnitAttr; + has_side_effectsTy has_side_effects; + + auto getHasSideEffects() { + auto &propStorage = this->has_side_effects; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setHasSideEffects(const ::mlir::UnitAttr &propValue) { + this->has_side_effects = propValue; + } + using is_align_stackTy = ::mlir::UnitAttr; + is_align_stackTy is_align_stack; + + auto getIsAlignStack() { + auto &propStorage = this->is_align_stack; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setIsAlignStack(const ::mlir::UnitAttr &propValue) { + this->is_align_stack = propValue; + } + using operand_attrsTy = ::mlir::ArrayAttr; + operand_attrsTy operand_attrs; + + auto getOperandAttrs() { + auto &propStorage = this->operand_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setOperandAttrs(const ::mlir::ArrayAttr &propValue) { + this->operand_attrs = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.asm_dialect == this->asm_dialect && + rhs.asm_string == this->asm_string && + rhs.constraints == this->constraints && + rhs.has_side_effects == this->has_side_effects && + rhs.is_align_stack == this->is_align_stack && + rhs.operand_attrs == this->operand_attrs && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + InlineAsmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + InlineAsmOpGenericAdaptorBase(InlineAsmOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getAsmStringAttr(); + ::llvm::StringRef getAsmString(); + ::mlir::StringAttr getConstraintsAttr(); + ::llvm::StringRef getConstraints(); + ::mlir::UnitAttr getHasSideEffectsAttr(); + bool getHasSideEffects(); + ::mlir::UnitAttr getIsAlignStackAttr(); + bool getIsAlignStack(); + ::mlir::LLVM::AsmDialectAttr getAsmDialectAttr(); + ::std::optional<::mlir::LLVM::AsmDialect> getAsmDialect(); + ::mlir::ArrayAttr getOperandAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getOperandAttrs(); +}; +} // namespace detail +template +class InlineAsmOpGenericAdaptor : public detail::InlineAsmOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InlineAsmOpGenericAdaptorBase; +public: + InlineAsmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InlineAsmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InlineAsmOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + InlineAsmOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class InlineAsmOpAdaptor : public InlineAsmOpGenericAdaptor<::mlir::ValueRange> { +public: + using InlineAsmOpGenericAdaptor::InlineAsmOpGenericAdaptor; + InlineAsmOpAdaptor(InlineAsmOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InlineAsmOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = InlineAsmOpAdaptor; + template + using GenericAdaptor = InlineAsmOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asm_dialect"), ::llvm::StringRef("asm_string"), ::llvm::StringRef("constraints"), ::llvm::StringRef("has_side_effects"), ::llvm::StringRef("is_align_stack"), ::llvm::StringRef("operand_attrs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAsmDialectAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAsmDialectAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAsmStringAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAsmStringAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConstraintsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConstraintsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getHasSideEffectsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getHasSideEffectsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsAlignStackAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsAlignStackAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOperandAttrsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOperandAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.inline_asm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getAsmStringAttr(); + ::llvm::StringRef getAsmString(); + ::mlir::StringAttr getConstraintsAttr(); + ::llvm::StringRef getConstraints(); + ::mlir::UnitAttr getHasSideEffectsAttr(); + bool getHasSideEffects(); + ::mlir::UnitAttr getIsAlignStackAttr(); + bool getIsAlignStack(); + ::mlir::LLVM::AsmDialectAttr getAsmDialectAttr(); + ::std::optional<::mlir::LLVM::AsmDialect> getAsmDialect(); + ::mlir::ArrayAttr getOperandAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getOperandAttrs(); + void setAsmStringAttr(::mlir::StringAttr attr); + void setAsmString(::llvm::StringRef attrValue); + void setConstraintsAttr(::mlir::StringAttr attr); + void setConstraints(::llvm::StringRef attrValue); + void setHasSideEffectsAttr(::mlir::UnitAttr attr); + void setHasSideEffects(bool attrValue); + void setIsAlignStackAttr(::mlir::UnitAttr attr); + void setIsAlignStack(bool attrValue); + void setAsmDialectAttr(::mlir::LLVM::AsmDialectAttr attr); + void setAsmDialect(::std::optional<::mlir::LLVM::AsmDialect> attrValue); + void setOperandAttrsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeHasSideEffectsAttr(); + ::mlir::Attribute removeIsAlignStackAttr(); + ::mlir::Attribute removeAsmDialectAttr(); + ::mlir::Attribute removeOperandAttrsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::mlir::StringAttr asm_string, ::mlir::StringAttr constraints, /*optional*/::mlir::UnitAttr has_side_effects, /*optional*/::mlir::UnitAttr is_align_stack, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type res, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::StringRef asm_string, ::llvm::StringRef constraints, /*optional*/bool has_side_effects, /*optional*/bool is_align_stack, /*optional*/::mlir::LLVM::AsmDialectAttr asm_dialect, /*optional*/::mlir::ArrayAttr operand_attrs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static StringRef getElementTypeAttrName() { + return "elementtype"; + } +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::InlineAsmOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::InsertElementOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InsertElementOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InsertElementOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InsertElementOpGenericAdaptorBase(InsertElementOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InsertElementOpGenericAdaptor : public detail::InsertElementOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InsertElementOpGenericAdaptorBase; +public: + InsertElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InsertElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InsertElementOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InsertElementOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVector() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getPosition() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InsertElementOpAdaptor : public InsertElementOpGenericAdaptor<::mlir::ValueRange> { +public: + using InsertElementOpGenericAdaptor::InsertElementOpGenericAdaptor; + InsertElementOpAdaptor(InsertElementOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InsertElementOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InsertElementOpAdaptor; + template + using GenericAdaptor = InsertElementOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.insertelement"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVector(); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::IntegerType> getPosition(); + ::mlir::OpOperand &getVectorMutable(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getPositionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vector, ::mlir::Value value, ::mlir::Value position); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::InsertElementOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::InsertValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InsertValueOpGenericAdaptorBase { +public: + struct Properties { + using positionTy = ::mlir::DenseI64ArrayAttr; + positionTy position; + + auto getPosition() { + auto &propStorage = this->position; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setPosition(const ::mlir::DenseI64ArrayAttr &propValue) { + this->position = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.position == this->position && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + InsertValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + InsertValueOpGenericAdaptorBase(InsertValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI64ArrayAttr getPositionAttr(); + ::llvm::ArrayRef getPosition(); +}; +} // namespace detail +template +class InsertValueOpGenericAdaptor : public detail::InsertValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InsertValueOpGenericAdaptorBase; +public: + InsertValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InsertValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InsertValueOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + InsertValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContainer() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InsertValueOpAdaptor : public InsertValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using InsertValueOpGenericAdaptor::InsertValueOpGenericAdaptor; + InsertValueOpAdaptor(InsertValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InsertValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InsertValueOpAdaptor; + template + using GenericAdaptor = InsertValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("position")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPositionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPositionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.insertvalue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getContainer(); + ::mlir::Value getValue(); + ::mlir::OpOperand &getContainerMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI64ArrayAttr getPositionAttr(); + ::llvm::ArrayRef getPosition(); + void setPositionAttr(::mlir::DenseI64ArrayAttr attr); + void setPosition(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::mlir::DenseI64ArrayAttr position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef position); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value container, ::mlir::Value value, ::llvm::ArrayRef position); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::InsertValueOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::IntToPtrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IntToPtrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IntToPtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IntToPtrOpGenericAdaptorBase(IntToPtrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IntToPtrOpGenericAdaptor : public detail::IntToPtrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IntToPtrOpGenericAdaptorBase; +public: + IntToPtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IntToPtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IntToPtrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IntToPtrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IntToPtrOpAdaptor : public IntToPtrOpGenericAdaptor<::mlir::ValueRange> { +public: + using IntToPtrOpGenericAdaptor::IntToPtrOpGenericAdaptor; + IntToPtrOpAdaptor(IntToPtrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IntToPtrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IntToPtrOpAdaptor; + template + using GenericAdaptor = IntToPtrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.inttoptr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::IntToPtrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::InvokeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InvokeOpGenericAdaptorBase { +public: + struct Properties { + using branch_weightsTy = ::mlir::DenseI32ArrayAttr; + branch_weightsTy branch_weights; + + auto getBranchWeights() { + auto &propStorage = this->branch_weights; + return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); + } + void setBranchWeights(const ::mlir::DenseI32ArrayAttr &propValue) { + this->branch_weights = propValue; + } + using calleeTy = ::mlir::FlatSymbolRefAttr; + calleeTy callee; + + auto getCallee() { + auto &propStorage = this->callee; + return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setCallee(const ::mlir::FlatSymbolRefAttr &propValue) { + this->callee = propValue; + } + using callee_typeTy = ::mlir::TypeAttr; + callee_typeTy callee_type; + + auto getCalleeType() { + auto &propStorage = this->callee_type; + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(propStorage); + } + void setCalleeType(const ::mlir::TypeAttr &propValue) { + this->callee_type = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.branch_weights == this->branch_weights && + rhs.callee == this->callee && + rhs.callee_type == this->callee_type && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + InvokeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + InvokeOpGenericAdaptorBase(InvokeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getCalleeTypeAttr(); + ::std::optional<::mlir::LLVM::LLVMFunctionType> getCalleeType(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::std::optional< ::llvm::StringRef > getCallee(); + ::mlir::DenseI32ArrayAttr getBranchWeightsAttr(); + ::std::optional<::llvm::ArrayRef> getBranchWeights(); +}; +} // namespace detail +template +class InvokeOpGenericAdaptor : public detail::InvokeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InvokeOpGenericAdaptorBase; +public: + InvokeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InvokeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InvokeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + InvokeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getCalleeOperands() { + return getODSOperands(0); + } + + RangeT getNormalDestOperands() { + return getODSOperands(1); + } + + RangeT getUnwindDestOperands() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InvokeOpAdaptor : public InvokeOpGenericAdaptor<::mlir::ValueRange> { +public: + using InvokeOpGenericAdaptor::InvokeOpGenericAdaptor; + InvokeOpAdaptor(InvokeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InvokeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::BranchOpInterface::Trait, ::mlir::CallOpInterface::Trait, ::mlir::LLVM::BranchWeightOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = InvokeOpAdaptor; + template + using GenericAdaptor = InvokeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("branch_weights"), ::llvm::StringRef("callee"), ::llvm::StringRef("callee_type"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBranchWeightsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBranchWeightsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCalleeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCalleeTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCalleeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.invoke"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getCalleeOperands(); + ::mlir::Operation::operand_range getNormalDestOperands(); + ::mlir::Operation::operand_range getUnwindDestOperands(); + ::mlir::MutableOperandRange getCalleeOperandsMutable(); + ::mlir::MutableOperandRange getNormalDestOperandsMutable(); + ::mlir::MutableOperandRange getUnwindDestOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getNormalDest(); + ::mlir::Block *getUnwindDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypeAttr getCalleeTypeAttr(); + ::std::optional<::mlir::LLVM::LLVMFunctionType> getCalleeType(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::std::optional< ::llvm::StringRef > getCallee(); + ::mlir::DenseI32ArrayAttr getBranchWeightsAttr(); + ::std::optional<::llvm::ArrayRef> getBranchWeights(); + void setCalleeTypeAttr(::mlir::TypeAttr attr); + void setCalleeType(::std::optional<::mlir::LLVM::LLVMFunctionType> attrValue); + void setCalleeAttr(::mlir::FlatSymbolRefAttr attr); + void setCallee(::std::optional<::llvm::StringRef> attrValue); + void setBranchWeightsAttr(::mlir::DenseI32ArrayAttr attr); + void setBranchWeights(::std::optional<::llvm::ArrayRef> attrValue); + ::mlir::Attribute removeCalleeTypeAttr(); + ::mlir::Attribute removeCalleeAttr(); + ::mlir::Attribute removeBranchWeightsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFuncOp func, ValueRange ops, Block*normal, ValueRange normalOps, Block*unwind, ValueRange unwindOps); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange tys, FlatSymbolRefAttr callee, ValueRange ops, Block*normal, ValueRange normalOps, Block*unwind, ValueRange unwindOps); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, LLVMFunctionType calleeType, FlatSymbolRefAttr callee, ValueRange ops, Block*normal, ValueRange normalOps, Block*unwind, ValueRange unwindOps); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, /*optional*/::mlir::TypeAttr callee_type, /*optional*/::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_operands, ::mlir::ValueRange normalDestOperands, ::mlir::ValueRange unwindDestOperands, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *normalDest, ::mlir::Block *unwindDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::SuccessorOperands getSuccessorOperands(unsigned index); + ::mlir::CallInterfaceCallable getCallableForCallee(); + void setCalleeFromCallable(::mlir::CallInterfaceCallable callee); + ::mlir::Operation::operand_range getArgOperands(); + ::mlir::MutableOperandRange getArgOperandsMutable(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the callee function type. + LLVMFunctionType getCalleeFunctionType(); +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::InvokeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LLVMFuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LLVMFuncOpGenericAdaptorBase { +public: + struct Properties { + using CConvTy = ::mlir::LLVM::CConvAttr; + CConvTy CConv; + + auto getCConv() { + auto &propStorage = this->CConv; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::CConvAttr>(propStorage); + } + void setCConv(const ::mlir::LLVM::CConvAttr &propValue) { + this->CConv = propValue; + } + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using arg_attrsTy = ::mlir::ArrayAttr; + arg_attrsTy arg_attrs; + + auto getArgAttrs() { + auto &propStorage = this->arg_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setArgAttrs(const ::mlir::ArrayAttr &propValue) { + this->arg_attrs = propValue; + } + using arm_locally_streamingTy = ::mlir::UnitAttr; + arm_locally_streamingTy arm_locally_streaming; + + auto getArmLocallyStreaming() { + auto &propStorage = this->arm_locally_streaming; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setArmLocallyStreaming(const ::mlir::UnitAttr &propValue) { + this->arm_locally_streaming = propValue; + } + using arm_streamingTy = ::mlir::UnitAttr; + arm_streamingTy arm_streaming; + + auto getArmStreaming() { + auto &propStorage = this->arm_streaming; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setArmStreaming(const ::mlir::UnitAttr &propValue) { + this->arm_streaming = propValue; + } + using comdatTy = ::mlir::SymbolRefAttr; + comdatTy comdat; + + auto getComdat() { + auto &propStorage = this->comdat; + return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); + } + void setComdat(const ::mlir::SymbolRefAttr &propValue) { + this->comdat = propValue; + } + using dso_localTy = ::mlir::UnitAttr; + dso_localTy dso_local; + + auto getDsoLocal() { + auto &propStorage = this->dso_local; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setDsoLocal(const ::mlir::UnitAttr &propValue) { + this->dso_local = propValue; + } + using function_entry_countTy = ::mlir::IntegerAttr; + function_entry_countTy function_entry_count; + + auto getFunctionEntryCount() { + auto &propStorage = this->function_entry_count; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setFunctionEntryCount(const ::mlir::IntegerAttr &propValue) { + this->function_entry_count = propValue; + } + using function_typeTy = ::mlir::TypeAttr; + function_typeTy function_type; + + auto getFunctionType() { + auto &propStorage = this->function_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setFunctionType(const ::mlir::TypeAttr &propValue) { + this->function_type = propValue; + } + using garbageCollectorTy = ::mlir::StringAttr; + garbageCollectorTy garbageCollector; + + auto getGarbageCollector() { + auto &propStorage = this->garbageCollector; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setGarbageCollector(const ::mlir::StringAttr &propValue) { + this->garbageCollector = propValue; + } + using linkageTy = ::mlir::LLVM::LinkageAttr; + linkageTy linkage; + + auto getLinkage() { + auto &propStorage = this->linkage; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::LinkageAttr>(propStorage); + } + void setLinkage(const ::mlir::LLVM::LinkageAttr &propValue) { + this->linkage = propValue; + } + using memoryTy = ::mlir::LLVM::MemoryEffectsAttr; + memoryTy memory; + + auto getMemory() { + auto &propStorage = this->memory; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::MemoryEffectsAttr>(propStorage); + } + void setMemory(const ::mlir::LLVM::MemoryEffectsAttr &propValue) { + this->memory = propValue; + } + using passthroughTy = ::mlir::ArrayAttr; + passthroughTy passthrough; + + auto getPassthrough() { + auto &propStorage = this->passthrough; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setPassthrough(const ::mlir::ArrayAttr &propValue) { + this->passthrough = propValue; + } + using personalityTy = ::mlir::FlatSymbolRefAttr; + personalityTy personality; + + auto getPersonality() { + auto &propStorage = this->personality; + return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setPersonality(const ::mlir::FlatSymbolRefAttr &propValue) { + this->personality = propValue; + } + using res_attrsTy = ::mlir::ArrayAttr; + res_attrsTy res_attrs; + + auto getResAttrs() { + auto &propStorage = this->res_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setResAttrs(const ::mlir::ArrayAttr &propValue) { + this->res_attrs = propValue; + } + using sectionTy = ::mlir::StringAttr; + sectionTy section; + + auto getSection() { + auto &propStorage = this->section; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSection(const ::mlir::StringAttr &propValue) { + this->section = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using sym_visibilityTy = ::mlir::StringAttr; + sym_visibilityTy sym_visibility; + + auto getSymVisibility() { + auto &propStorage = this->sym_visibility; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSymVisibility(const ::mlir::StringAttr &propValue) { + this->sym_visibility = propValue; + } + using unnamed_addrTy = ::mlir::LLVM::UnnamedAddrAttr; + unnamed_addrTy unnamed_addr; + + auto getUnnamedAddr() { + auto &propStorage = this->unnamed_addr; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::UnnamedAddrAttr>(propStorage); + } + void setUnnamedAddr(const ::mlir::LLVM::UnnamedAddrAttr &propValue) { + this->unnamed_addr = propValue; + } + using visibility_Ty = ::mlir::LLVM::VisibilityAttr; + visibility_Ty visibility_; + + auto getVisibility_() { + auto &propStorage = this->visibility_; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::VisibilityAttr>(propStorage); + } + void setVisibility_(const ::mlir::LLVM::VisibilityAttr &propValue) { + this->visibility_ = propValue; + } + using vscale_rangeTy = ::mlir::LLVM::VScaleRangeAttr; + vscale_rangeTy vscale_range; + + auto getVscaleRange() { + auto &propStorage = this->vscale_range; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::VScaleRangeAttr>(propStorage); + } + void setVscaleRange(const ::mlir::LLVM::VScaleRangeAttr &propValue) { + this->vscale_range = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.CConv == this->CConv && + rhs.alignment == this->alignment && + rhs.arg_attrs == this->arg_attrs && + rhs.arm_locally_streaming == this->arm_locally_streaming && + rhs.arm_streaming == this->arm_streaming && + rhs.comdat == this->comdat && + rhs.dso_local == this->dso_local && + rhs.function_entry_count == this->function_entry_count && + rhs.function_type == this->function_type && + rhs.garbageCollector == this->garbageCollector && + rhs.linkage == this->linkage && + rhs.memory == this->memory && + rhs.passthrough == this->passthrough && + rhs.personality == this->personality && + rhs.res_attrs == this->res_attrs && + rhs.section == this->section && + rhs.sym_name == this->sym_name && + rhs.sym_visibility == this->sym_visibility && + rhs.unnamed_addr == this->unnamed_addr && + rhs.visibility_ == this->visibility_ && + rhs.vscale_range == this->vscale_range && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LLVMFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LLVMFuncOpGenericAdaptorBase(LLVMFuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::LLVM::LLVMFunctionType getFunctionType(); + ::mlir::LLVM::LinkageAttr getLinkageAttr(); + ::mlir::LLVM::Linkage getLinkage(); + ::mlir::UnitAttr getDsoLocalAttr(); + bool getDsoLocal(); + ::mlir::LLVM::CConvAttr getCConvAttr(); + ::mlir::LLVM::cconv::CConv getCConv(); + ::mlir::SymbolRefAttr getComdatAttr(); + ::std::optional< ::mlir::SymbolRefAttr > getComdat(); + ::mlir::FlatSymbolRefAttr getPersonalityAttr(); + ::std::optional< ::llvm::StringRef > getPersonality(); + ::mlir::StringAttr getGarbageCollectorAttr(); + ::std::optional< ::llvm::StringRef > getGarbageCollector(); + ::mlir::ArrayAttr getPassthroughAttr(); + ::std::optional< ::mlir::ArrayAttr > getPassthrough(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::IntegerAttr getFunctionEntryCountAttr(); + ::std::optional getFunctionEntryCount(); + ::mlir::LLVM::MemoryEffectsAttr getMemoryAttr(); + ::std::optional<::mlir::LLVM::MemoryEffectsAttr> getMemory(); + ::mlir::LLVM::VisibilityAttr getVisibility_Attr(); + ::mlir::LLVM::Visibility getVisibility_(); + ::mlir::UnitAttr getArmStreamingAttr(); + ::std::optional getArmStreaming(); + ::mlir::UnitAttr getArmLocallyStreamingAttr(); + ::std::optional getArmLocallyStreaming(); + ::mlir::StringAttr getSectionAttr(); + ::std::optional< ::llvm::StringRef > getSection(); + ::mlir::LLVM::UnnamedAddrAttr getUnnamedAddrAttr(); + ::std::optional<::mlir::LLVM::UnnamedAddr> getUnnamedAddr(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::LLVM::VScaleRangeAttr getVscaleRangeAttr(); + ::std::optional<::mlir::LLVM::VScaleRangeAttr> getVscaleRange(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class LLVMFuncOpGenericAdaptor : public detail::LLVMFuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LLVMFuncOpGenericAdaptorBase; +public: + LLVMFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LLVMFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LLVMFuncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LLVMFuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LLVMFuncOpAdaptor : public LLVMFuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using LLVMFuncOpGenericAdaptor::LLVMFuncOpGenericAdaptor; + LLVMFuncOpAdaptor(LLVMFuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LLVMFuncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LLVMFuncOpAdaptor; + template + using GenericAdaptor = LLVMFuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("CConv"), ::llvm::StringRef("alignment"), ::llvm::StringRef("arg_attrs"), ::llvm::StringRef("arm_locally_streaming"), ::llvm::StringRef("arm_streaming"), ::llvm::StringRef("comdat"), ::llvm::StringRef("dso_local"), ::llvm::StringRef("function_entry_count"), ::llvm::StringRef("function_type"), ::llvm::StringRef("garbageCollector"), ::llvm::StringRef("linkage"), ::llvm::StringRef("memory"), ::llvm::StringRef("passthrough"), ::llvm::StringRef("personality"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("section"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("sym_visibility"), ::llvm::StringRef("unnamed_addr"), ::llvm::StringRef("visibility_"), ::llvm::StringRef("vscale_range")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCConvAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCConvAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getArgAttrsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getArmLocallyStreamingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getArmLocallyStreamingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getArmStreamingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getArmStreamingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getComdatAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getComdatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getDsoLocalAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getDsoLocalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getFunctionEntryCountAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getFunctionEntryCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getFunctionTypeAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getGarbageCollectorAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getGarbageCollectorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getLinkageAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getLinkageAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getMemoryAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getMemoryAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getPassthroughAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getPassthroughAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getPersonalityAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getPersonalityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + ::mlir::StringAttr getResAttrsAttrName() { + return getAttributeNameForIndex(14); + } + + static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 14); + } + + ::mlir::StringAttr getSectionAttrName() { + return getAttributeNameForIndex(15); + } + + static ::mlir::StringAttr getSectionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 15); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(16); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 16); + } + + ::mlir::StringAttr getSymVisibilityAttrName() { + return getAttributeNameForIndex(17); + } + + static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 17); + } + + ::mlir::StringAttr getUnnamedAddrAttrName() { + return getAttributeNameForIndex(18); + } + + static ::mlir::StringAttr getUnnamedAddrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 18); + } + + ::mlir::StringAttr getVisibility_AttrName() { + return getAttributeNameForIndex(19); + } + + static ::mlir::StringAttr getVisibility_AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 19); + } + + ::mlir::StringAttr getVscaleRangeAttrName() { + return getAttributeNameForIndex(20); + } + + static ::mlir::StringAttr getVscaleRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 20); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::LLVM::LLVMFunctionType getFunctionType(); + ::mlir::LLVM::LinkageAttr getLinkageAttr(); + ::mlir::LLVM::Linkage getLinkage(); + ::mlir::UnitAttr getDsoLocalAttr(); + bool getDsoLocal(); + ::mlir::LLVM::CConvAttr getCConvAttr(); + ::mlir::LLVM::cconv::CConv getCConv(); + ::mlir::SymbolRefAttr getComdatAttr(); + ::std::optional< ::mlir::SymbolRefAttr > getComdat(); + ::mlir::FlatSymbolRefAttr getPersonalityAttr(); + ::std::optional< ::llvm::StringRef > getPersonality(); + ::mlir::StringAttr getGarbageCollectorAttr(); + ::std::optional< ::llvm::StringRef > getGarbageCollector(); + ::mlir::ArrayAttr getPassthroughAttr(); + ::std::optional< ::mlir::ArrayAttr > getPassthrough(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::IntegerAttr getFunctionEntryCountAttr(); + ::std::optional getFunctionEntryCount(); + ::mlir::LLVM::MemoryEffectsAttr getMemoryAttr(); + ::std::optional<::mlir::LLVM::MemoryEffectsAttr> getMemory(); + ::mlir::LLVM::VisibilityAttr getVisibility_Attr(); + ::mlir::LLVM::Visibility getVisibility_(); + ::mlir::UnitAttr getArmStreamingAttr(); + ::std::optional getArmStreaming(); + ::mlir::UnitAttr getArmLocallyStreamingAttr(); + ::std::optional getArmLocallyStreaming(); + ::mlir::StringAttr getSectionAttr(); + ::std::optional< ::llvm::StringRef > getSection(); + ::mlir::LLVM::UnnamedAddrAttr getUnnamedAddrAttr(); + ::std::optional<::mlir::LLVM::UnnamedAddr> getUnnamedAddr(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::LLVM::VScaleRangeAttr getVscaleRangeAttr(); + ::std::optional<::mlir::LLVM::VScaleRangeAttr> getVscaleRange(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setSymVisibilityAttr(::mlir::StringAttr attr); + void setSymVisibility(::std::optional<::llvm::StringRef> attrValue); + void setFunctionTypeAttr(::mlir::TypeAttr attr); + void setFunctionType(::mlir::LLVM::LLVMFunctionType attrValue); + void setLinkageAttr(::mlir::LLVM::LinkageAttr attr); + void setLinkage(::mlir::LLVM::Linkage attrValue); + void setDsoLocalAttr(::mlir::UnitAttr attr); + void setDsoLocal(bool attrValue); + void setCConvAttr(::mlir::LLVM::CConvAttr attr); + void setCConv(::mlir::LLVM::cconv::CConv attrValue); + void setComdatAttr(::mlir::SymbolRefAttr attr); + void setPersonalityAttr(::mlir::FlatSymbolRefAttr attr); + void setPersonality(::std::optional<::llvm::StringRef> attrValue); + void setGarbageCollectorAttr(::mlir::StringAttr attr); + void setGarbageCollector(::std::optional<::llvm::StringRef> attrValue); + void setPassthroughAttr(::mlir::ArrayAttr attr); + void setArgAttrsAttr(::mlir::ArrayAttr attr); + void setResAttrsAttr(::mlir::ArrayAttr attr); + void setFunctionEntryCountAttr(::mlir::IntegerAttr attr); + void setFunctionEntryCount(::std::optional attrValue); + void setMemoryAttr(::mlir::LLVM::MemoryEffectsAttr attr); + void setVisibility_Attr(::mlir::LLVM::VisibilityAttr attr); + void setVisibility_(::mlir::LLVM::Visibility attrValue); + void setArmStreamingAttr(::mlir::UnitAttr attr); + void setArmStreaming(bool attrValue); + void setArmLocallyStreamingAttr(::mlir::UnitAttr attr); + void setArmLocallyStreaming(bool attrValue); + void setSectionAttr(::mlir::StringAttr attr); + void setSection(::std::optional<::llvm::StringRef> attrValue); + void setUnnamedAddrAttr(::mlir::LLVM::UnnamedAddrAttr attr); + void setUnnamedAddr(::std::optional<::mlir::LLVM::UnnamedAddr> attrValue); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + void setVscaleRangeAttr(::mlir::LLVM::VScaleRangeAttr attr); + ::mlir::Attribute removeSymVisibilityAttr(); + ::mlir::Attribute removeDsoLocalAttr(); + ::mlir::Attribute removeComdatAttr(); + ::mlir::Attribute removePersonalityAttr(); + ::mlir::Attribute removeGarbageCollectorAttr(); + ::mlir::Attribute removePassthroughAttr(); + ::mlir::Attribute removeArgAttrsAttr(); + ::mlir::Attribute removeResAttrsAttr(); + ::mlir::Attribute removeFunctionEntryCountAttr(); + ::mlir::Attribute removeMemoryAttr(); + ::mlir::Attribute removeArmStreamingAttr(); + ::mlir::Attribute removeArmLocallyStreamingAttr(); + ::mlir::Attribute removeSectionAttr(); + ::mlir::Attribute removeUnnamedAddrAttr(); + ::mlir::Attribute removeAlignmentAttr(); + ::mlir::Attribute removeVscaleRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, Type type, Linkage linkage = Linkage::External, bool dsoLocal = false, CConv cconv = CConv::C, SymbolRefAttr comdat = {}, ArrayRef attrs = {}, ArrayRef argAttrs = {}, std::optional functionEntryCount = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult verifyRegions(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 21 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Add an entry block to an empty function, and set up the block arguments + // to match the signature of the function. + Block *addEntryBlock(); + + bool isVarArg() { return getFunctionType().isVarArg(); } + + /// Returns the argument types of this function. + ArrayRef getArgumentTypes() { return getFunctionType().getParams(); } + + /// Returns the result types of this function. + ArrayRef getResultTypes() { + if (::llvm::isa(getFunctionType().getReturnType())) + return {}; + return getFunctionType().getReturnTypes(); + } + + /// Returns the callable region, which is the function body. If the function + /// is external, returns null. + Region *getCallableRegion(); +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMFuncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LShrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LShrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LShrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LShrOpGenericAdaptorBase(LShrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LShrOpGenericAdaptor : public detail::LShrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LShrOpGenericAdaptorBase; +public: + LShrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LShrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LShrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LShrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LShrOpAdaptor : public LShrOpGenericAdaptor<::mlir::ValueRange> { +public: + using LShrOpGenericAdaptor::LShrOpGenericAdaptor; + LShrOpAdaptor(LShrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LShrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LShrOpAdaptor; + template + using GenericAdaptor = LShrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.lshr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LShrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LandingpadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LandingpadOpGenericAdaptorBase { +public: + struct Properties { + using cleanupTy = ::mlir::UnitAttr; + cleanupTy cleanup; + + auto getCleanup() { + auto &propStorage = this->cleanup; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setCleanup(const ::mlir::UnitAttr &propValue) { + this->cleanup = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.cleanup == this->cleanup && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LandingpadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LandingpadOpGenericAdaptorBase(LandingpadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getCleanupAttr(); + bool getCleanup(); +}; +} // namespace detail +template +class LandingpadOpGenericAdaptor : public detail::LandingpadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LandingpadOpGenericAdaptorBase; +public: + LandingpadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LandingpadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LandingpadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LandingpadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LandingpadOpAdaptor : public LandingpadOpGenericAdaptor<::mlir::ValueRange> { +public: + using LandingpadOpGenericAdaptor::LandingpadOpGenericAdaptor; + LandingpadOpAdaptor(LandingpadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LandingpadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LandingpadOpAdaptor; + template + using GenericAdaptor = LandingpadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cleanup")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCleanupAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCleanupAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.landingpad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getCleanupAttr(); + bool getCleanup(); + void setCleanupAttr(::mlir::UnitAttr attr); + void setCleanup(bool attrValue); + ::mlir::Attribute removeCleanupAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr cleanup, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/bool cleanup, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LandingpadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::LoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadOpGenericAdaptorBase { +public: + struct Properties { + using access_groupsTy = ::mlir::ArrayAttr; + access_groupsTy access_groups; + + auto getAccessGroups() { + auto &propStorage = this->access_groups; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAccessGroups(const ::mlir::ArrayAttr &propValue) { + this->access_groups = propValue; + } + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using nontemporalTy = ::mlir::UnitAttr; + nontemporalTy nontemporal; + + auto getNontemporal() { + auto &propStorage = this->nontemporal; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNontemporal(const ::mlir::UnitAttr &propValue) { + this->nontemporal = propValue; + } + using orderingTy = ::mlir::LLVM::AtomicOrderingAttr; + orderingTy ordering; + + auto getOrdering() { + auto &propStorage = this->ordering; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::AtomicOrderingAttr>(propStorage); + } + void setOrdering(const ::mlir::LLVM::AtomicOrderingAttr &propValue) { + this->ordering = propValue; + } + using syncscopeTy = ::mlir::StringAttr; + syncscopeTy syncscope; + + auto getSyncscope() { + auto &propStorage = this->syncscope; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSyncscope(const ::mlir::StringAttr &propValue) { + this->syncscope = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + using volatile_Ty = ::mlir::UnitAttr; + volatile_Ty volatile_; + + auto getVolatile_() { + auto &propStorage = this->volatile_; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setVolatile_(const ::mlir::UnitAttr &propValue) { + this->volatile_ = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.access_groups == this->access_groups && + rhs.alias_scopes == this->alias_scopes && + rhs.alignment == this->alignment && + rhs.noalias_scopes == this->noalias_scopes && + rhs.nontemporal == this->nontemporal && + rhs.ordering == this->ordering && + rhs.syncscope == this->syncscope && + rhs.tbaa == this->tbaa && + rhs.volatile_ == this->volatile_ && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadOpGenericAdaptorBase(LoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::UnitAttr getVolatile_Attr(); + bool getVolatile_(); + ::mlir::UnitAttr getNontemporalAttr(); + bool getNontemporal(); + ::mlir::LLVM::AtomicOrderingAttr getOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class LoadOpGenericAdaptor : public detail::LoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadOpGenericAdaptorBase; +public: + LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadOpAdaptor : public LoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadOpGenericAdaptor::LoadOpGenericAdaptor; + LoadOpAdaptor(LoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AccessGroupOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::PromotableMemOpInterface::Trait, ::mlir::SafeMemorySlotAccessOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadOpAdaptor; + template + using GenericAdaptor = LoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("access_groups"), ::llvm::StringRef("alias_scopes"), ::llvm::StringRef("alignment"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("nontemporal"), ::llvm::StringRef("ordering"), ::llvm::StringRef("syncscope"), ::llvm::StringRef("tbaa"), ::llvm::StringRef("volatile_")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAccessGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAccessGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNontemporalAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNontemporalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOrderingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOrderingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSyncscopeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSyncscopeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getVolatile_AttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getVolatile_AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getAddr(); + ::mlir::OpOperand &getAddrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::UnitAttr getVolatile_Attr(); + bool getVolatile_(); + ::mlir::UnitAttr getNontemporalAttr(); + bool getNontemporal(); + ::mlir::LLVM::AtomicOrderingAttr getOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + void setVolatile_Attr(::mlir::UnitAttr attr); + void setVolatile_(bool attrValue); + void setNontemporalAttr(::mlir::UnitAttr attr); + void setNontemporal(bool attrValue); + void setOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr); + void setOrdering(::mlir::LLVM::AtomicOrdering attrValue); + void setSyncscopeAttr(::mlir::StringAttr attr); + void setSyncscope(::std::optional<::llvm::StringRef> attrValue); + void setAccessGroupsAttr(::mlir::ArrayAttr attr); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAlignmentAttr(); + ::mlir::Attribute removeVolatile_Attr(); + ::mlir::Attribute removeNontemporalAttr(); + ::mlir::Attribute removeSyncscopeAttr(); + ::mlir::Attribute removeAccessGroupsAttr(); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value addr, unsigned alignment = 0, bool isVolatile = false, bool isNonTemporal = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, Value addr, unsigned alignment = 0, bool isVolatile = false, bool isNonTemporal = false, AtomicOrdering ordering = AtomicOrdering::not_atomic, StringRef syncscope = StringRef()); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + bool loadsFrom(const ::mlir::MemorySlot &slot); + bool storesTo(const ::mlir::MemorySlot &slot); + ::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + bool canUsesBeRemoved(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter, ::mlir::Value reachingDefinition); + ::mlir::LogicalResult ensureOnlySafeAccesses(const ::mlir::MemorySlot &slot, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoadOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::MulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulOpGenericAdaptorBase(MulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulOpGenericAdaptorBase; +public: + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulOpGenericAdaptor::MulOpGenericAdaptor; + MulOpAdaptor(MulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::IsCommutative, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulOpAdaptor; + template + using GenericAdaptor = MulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MulOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::NoneTokenOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NoneTokenOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NoneTokenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NoneTokenOpGenericAdaptorBase(NoneTokenOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NoneTokenOpGenericAdaptor : public detail::NoneTokenOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NoneTokenOpGenericAdaptorBase; +public: + NoneTokenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NoneTokenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NoneTokenOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NoneTokenOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NoneTokenOpAdaptor : public NoneTokenOpGenericAdaptor<::mlir::ValueRange> { +public: + using NoneTokenOpGenericAdaptor::NoneTokenOpGenericAdaptor; + NoneTokenOpAdaptor(NoneTokenOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NoneTokenOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NoneTokenOpAdaptor; + template + using GenericAdaptor = NoneTokenOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mlir.none"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::NoneTokenOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::OrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OrOpGenericAdaptorBase(OrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OrOpGenericAdaptor : public detail::OrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OrOpGenericAdaptorBase; +public: + OrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OrOpAdaptor : public OrOpGenericAdaptor<::mlir::ValueRange> { +public: + using OrOpGenericAdaptor::OrOpGenericAdaptor; + OrOpAdaptor(OrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OrOpAdaptor; + template + using GenericAdaptor = OrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.or"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::OrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PoisonOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoisonOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PoisonOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PoisonOpGenericAdaptorBase(PoisonOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PoisonOpGenericAdaptor : public detail::PoisonOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoisonOpGenericAdaptorBase; +public: + PoisonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoisonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoisonOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PoisonOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoisonOpAdaptor : public PoisonOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoisonOpGenericAdaptor::PoisonOpGenericAdaptor; + PoisonOpAdaptor(PoisonOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoisonOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoisonOpAdaptor; + template + using GenericAdaptor = PoisonOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mlir.poison"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::PoisonOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::PtrToIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PtrToIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PtrToIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PtrToIntOpGenericAdaptorBase(PtrToIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PtrToIntOpGenericAdaptor : public detail::PtrToIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PtrToIntOpGenericAdaptorBase; +public: + PtrToIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PtrToIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PtrToIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PtrToIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PtrToIntOpAdaptor : public PtrToIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using PtrToIntOpGenericAdaptor::PtrToIntOpGenericAdaptor; + PtrToIntOpAdaptor(PtrToIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PtrToIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PtrToIntOpAdaptor; + template + using GenericAdaptor = PtrToIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.ptrtoint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::PtrToIntOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ResumeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResumeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResumeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResumeOpGenericAdaptorBase(ResumeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResumeOpGenericAdaptor : public detail::ResumeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResumeOpGenericAdaptorBase; +public: + ResumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResumeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResumeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResumeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResumeOpAdaptor : public ResumeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResumeOpGenericAdaptor::ResumeOpGenericAdaptor; + ResumeOpAdaptor(ResumeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResumeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ResumeOpAdaptor; + template + using GenericAdaptor = ResumeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.resume"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ResumeOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReturnOpGenericAdaptorBase(ReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReturnOpGenericAdaptorBase; +public: + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor; + ReturnOpAdaptor(ReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReturnOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReturnOpAdaptor; + template + using GenericAdaptor = ReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::MutableOperandRange getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ReturnOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SDivOpGenericAdaptorBase(SDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SDivOpGenericAdaptor : public detail::SDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SDivOpGenericAdaptorBase; +public: + SDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SDivOpAdaptor : public SDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using SDivOpGenericAdaptor::SDivOpGenericAdaptor; + SDivOpAdaptor(SDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SDivOpAdaptor; + template + using GenericAdaptor = SDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.sdiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SExtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SExtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SExtOpGenericAdaptorBase(SExtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SExtOpGenericAdaptor : public detail::SExtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SExtOpGenericAdaptorBase; +public: + SExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SExtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SExtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SExtOpAdaptor : public SExtOpGenericAdaptor<::mlir::ValueRange> { +public: + using SExtOpGenericAdaptor::SExtOpGenericAdaptor; + SExtOpAdaptor(SExtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SExtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SExtOpAdaptor; + template + using GenericAdaptor = SExtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.sext"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SIToFPOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SIToFPOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SIToFPOpGenericAdaptorBase(SIToFPOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SIToFPOpGenericAdaptor : public detail::SIToFPOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SIToFPOpGenericAdaptorBase; +public: + SIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SIToFPOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SIToFPOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SIToFPOpAdaptor : public SIToFPOpGenericAdaptor<::mlir::ValueRange> { +public: + using SIToFPOpGenericAdaptor::SIToFPOpGenericAdaptor; + SIToFPOpAdaptor(SIToFPOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SIToFPOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SIToFPOpAdaptor; + template + using GenericAdaptor = SIToFPOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.sitofp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SIToFPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SRemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SRemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SRemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SRemOpGenericAdaptorBase(SRemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SRemOpGenericAdaptor : public detail::SRemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SRemOpGenericAdaptorBase; +public: + SRemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SRemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SRemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SRemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SRemOpAdaptor : public SRemOpGenericAdaptor<::mlir::ValueRange> { +public: + using SRemOpGenericAdaptor::SRemOpGenericAdaptor; + SRemOpAdaptor(SRemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SRemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SRemOpAdaptor; + template + using GenericAdaptor = SRemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.srem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SRemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SelectOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectOpGenericAdaptorBase { +public: + struct Properties { + using fastmathFlagsTy = ::mlir::LLVM::FastmathFlagsAttr; + fastmathFlagsTy fastmathFlags; + + auto getFastmathFlags() { + auto &propStorage = this->fastmathFlags; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::FastmathFlagsAttr>(propStorage); + } + void setFastmathFlags(const ::mlir::LLVM::FastmathFlagsAttr &propValue) { + this->fastmathFlags = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmathFlags == this->fastmathFlags && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectOpGenericAdaptorBase(SelectOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); +}; +} // namespace detail +template +class SelectOpGenericAdaptor : public detail::SelectOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectOpGenericAdaptorBase; +public: + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SelectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + ValueT getTrueValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getFalseValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectOpAdaptor : public SelectOpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectOpGenericAdaptor::SelectOpGenericAdaptor; + SelectOpAdaptor(SelectOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::LLVM::FastmathFlagsInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectOpAdaptor; + template + using GenericAdaptor = SelectOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmathFlags")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathFlagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathFlagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.select"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCondition(); + ::mlir::Value getTrueValue(); + ::mlir::Value getFalseValue(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::OpOperand &getTrueValueMutable(); + ::mlir::OpOperand &getFalseValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::LLVM::FastmathFlagsAttr getFastmathFlagsAttr(); + ::mlir::LLVM::FastmathFlags getFastmathFlags(); + void setFastmathFlagsAttr(::mlir::LLVM::FastmathFlagsAttr attr); + void setFastmathFlags(::mlir::LLVM::FastmathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlagsAttr fastmathFlags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value trueValue, ::mlir::Value falseValue, ::mlir::LLVM::FastmathFlags fastmathFlags = {}); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SelectOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ShlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShlOpGenericAdaptorBase(ShlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShlOpGenericAdaptor : public detail::ShlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShlOpGenericAdaptorBase; +public: + ShlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShlOpAdaptor : public ShlOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShlOpGenericAdaptor::ShlOpGenericAdaptor; + ShlOpAdaptor(ShlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShlOpAdaptor; + template + using GenericAdaptor = ShlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.shl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ShlOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ShuffleVectorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShuffleVectorOpGenericAdaptorBase { +public: + struct Properties { + using maskTy = ::mlir::DenseI32ArrayAttr; + maskTy mask; + + auto getMask() { + auto &propStorage = this->mask; + return ::llvm::cast<::mlir::DenseI32ArrayAttr>(propStorage); + } + void setMask(const ::mlir::DenseI32ArrayAttr &propValue) { + this->mask = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.mask == this->mask && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ShuffleVectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ShuffleVectorOpGenericAdaptorBase(ShuffleVectorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI32ArrayAttr getMaskAttr(); + ::llvm::ArrayRef getMask(); +}; +} // namespace detail +template +class ShuffleVectorOpGenericAdaptor : public detail::ShuffleVectorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShuffleVectorOpGenericAdaptorBase; +public: + ShuffleVectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShuffleVectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShuffleVectorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ShuffleVectorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getV1() { + return (*getODSOperands(0).begin()); + } + + ValueT getV2() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShuffleVectorOpAdaptor : public ShuffleVectorOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShuffleVectorOpGenericAdaptor::ShuffleVectorOpGenericAdaptor; + ShuffleVectorOpAdaptor(ShuffleVectorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShuffleVectorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShuffleVectorOpAdaptor; + template + using GenericAdaptor = ShuffleVectorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("mask")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMaskAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.shufflevector"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getV1(); + ::mlir::Value getV2(); + ::mlir::OpOperand &getV1Mutable(); + ::mlir::OpOperand &getV2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI32ArrayAttr getMaskAttr(); + ::llvm::ArrayRef getMask(); + void setMaskAttr(::mlir::DenseI32ArrayAttr attr); + void setMask(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value v1, Value v2, DenseI32ArrayAttr mask, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value v1, Value v2, ArrayRef mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::mlir::DenseI32ArrayAttr mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value v1, ::mlir::Value v2, ::llvm::ArrayRef mask); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ShuffleVectorOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::StoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StoreOpGenericAdaptorBase { +public: + struct Properties { + using access_groupsTy = ::mlir::ArrayAttr; + access_groupsTy access_groups; + + auto getAccessGroups() { + auto &propStorage = this->access_groups; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAccessGroups(const ::mlir::ArrayAttr &propValue) { + this->access_groups = propValue; + } + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using nontemporalTy = ::mlir::UnitAttr; + nontemporalTy nontemporal; + + auto getNontemporal() { + auto &propStorage = this->nontemporal; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNontemporal(const ::mlir::UnitAttr &propValue) { + this->nontemporal = propValue; + } + using orderingTy = ::mlir::LLVM::AtomicOrderingAttr; + orderingTy ordering; + + auto getOrdering() { + auto &propStorage = this->ordering; + return ::llvm::dyn_cast_or_null<::mlir::LLVM::AtomicOrderingAttr>(propStorage); + } + void setOrdering(const ::mlir::LLVM::AtomicOrderingAttr &propValue) { + this->ordering = propValue; + } + using syncscopeTy = ::mlir::StringAttr; + syncscopeTy syncscope; + + auto getSyncscope() { + auto &propStorage = this->syncscope; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSyncscope(const ::mlir::StringAttr &propValue) { + this->syncscope = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + using volatile_Ty = ::mlir::UnitAttr; + volatile_Ty volatile_; + + auto getVolatile_() { + auto &propStorage = this->volatile_; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setVolatile_(const ::mlir::UnitAttr &propValue) { + this->volatile_ = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.access_groups == this->access_groups && + rhs.alias_scopes == this->alias_scopes && + rhs.alignment == this->alignment && + rhs.noalias_scopes == this->noalias_scopes && + rhs.nontemporal == this->nontemporal && + rhs.ordering == this->ordering && + rhs.syncscope == this->syncscope && + rhs.tbaa == this->tbaa && + rhs.volatile_ == this->volatile_ && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + StoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + StoreOpGenericAdaptorBase(StoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::UnitAttr getVolatile_Attr(); + bool getVolatile_(); + ::mlir::UnitAttr getNontemporalAttr(); + bool getNontemporal(); + ::mlir::LLVM::AtomicOrderingAttr getOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class StoreOpGenericAdaptor : public detail::StoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StoreOpGenericAdaptorBase; +public: + StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + StoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getAddr() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StoreOpAdaptor : public StoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using StoreOpGenericAdaptor::StoreOpGenericAdaptor; + StoreOpAdaptor(StoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AccessGroupOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::PromotableMemOpInterface::Trait, ::mlir::SafeMemorySlotAccessOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StoreOpAdaptor; + template + using GenericAdaptor = StoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("access_groups"), ::llvm::StringRef("alias_scopes"), ::llvm::StringRef("alignment"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("nontemporal"), ::llvm::StringRef("ordering"), ::llvm::StringRef("syncscope"), ::llvm::StringRef("tbaa"), ::llvm::StringRef("volatile_")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAccessGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAccessGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNontemporalAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNontemporalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOrderingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOrderingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSyncscopeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSyncscopeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getVolatile_AttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getVolatile_AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getAddr(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getAddrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + ::mlir::UnitAttr getVolatile_Attr(); + bool getVolatile_(); + ::mlir::UnitAttr getNontemporalAttr(); + bool getNontemporal(); + ::mlir::LLVM::AtomicOrderingAttr getOrderingAttr(); + ::mlir::LLVM::AtomicOrdering getOrdering(); + ::mlir::StringAttr getSyncscopeAttr(); + ::std::optional< ::llvm::StringRef > getSyncscope(); + ::mlir::ArrayAttr getAccessGroupsAttr(); + ::std::optional< ::mlir::ArrayAttr > getAccessGroups(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + void setVolatile_Attr(::mlir::UnitAttr attr); + void setVolatile_(bool attrValue); + void setNontemporalAttr(::mlir::UnitAttr attr); + void setNontemporal(bool attrValue); + void setOrderingAttr(::mlir::LLVM::AtomicOrderingAttr attr); + void setOrdering(::mlir::LLVM::AtomicOrdering attrValue); + void setSyncscopeAttr(::mlir::StringAttr attr); + void setSyncscope(::std::optional<::llvm::StringRef> attrValue); + void setAccessGroupsAttr(::mlir::ArrayAttr attr); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAlignmentAttr(); + ::mlir::Attribute removeVolatile_Attr(); + ::mlir::Attribute removeNontemporalAttr(); + ::mlir::Attribute removeSyncscopeAttr(); + ::mlir::Attribute removeAccessGroupsAttr(); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value, Value addr, unsigned alignment = 0, bool isVolatile = false, bool isNonTemporal = false, AtomicOrdering ordering = AtomicOrdering::not_atomic, StringRef syncscope = StringRef()); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/::mlir::UnitAttr volatile_, /*optional*/::mlir::UnitAttr nontemporal, ::mlir::LLVM::AtomicOrderingAttr ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value addr, /*optional*/::mlir::IntegerAttr alignment, /*optional*/bool volatile_, /*optional*/bool nontemporal, ::mlir::LLVM::AtomicOrdering ordering, /*optional*/::mlir::StringAttr syncscope, /*optional*/::mlir::ArrayAttr access_groups, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + bool loadsFrom(const ::mlir::MemorySlot &slot); + bool storesTo(const ::mlir::MemorySlot &slot); + ::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + bool canUsesBeRemoved(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter, ::mlir::Value reachingDefinition); + ::mlir::LogicalResult ensureOnlySafeAccesses(const ::mlir::MemorySlot &slot, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::StoreOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubOpGenericAdaptorBase(SubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SubOpGenericAdaptor : public detail::SubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubOpGenericAdaptorBase; +public: + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubOpAdaptor : public SubOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubOpGenericAdaptor::SubOpGenericAdaptor; + SubOpAdaptor(SubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubOpAdaptor; + template + using GenericAdaptor = SubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.sub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SubOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::SwitchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchOpGenericAdaptorBase { +public: + struct Properties { + using branch_weightsTy = ::mlir::DenseI32ArrayAttr; + branch_weightsTy branch_weights; + + auto getBranchWeights() { + auto &propStorage = this->branch_weights; + return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); + } + void setBranchWeights(const ::mlir::DenseI32ArrayAttr &propValue) { + this->branch_weights = propValue; + } + using case_operand_segmentsTy = ::mlir::DenseI32ArrayAttr; + case_operand_segmentsTy case_operand_segments; + + auto getCaseOperandSegments() { + auto &propStorage = this->case_operand_segments; + return ::llvm::cast<::mlir::DenseI32ArrayAttr>(propStorage); + } + void setCaseOperandSegments(const ::mlir::DenseI32ArrayAttr &propValue) { + this->case_operand_segments = propValue; + } + using case_valuesTy = ::mlir::DenseIntElementsAttr; + case_valuesTy case_values; + + auto getCaseValues() { + auto &propStorage = this->case_values; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setCaseValues(const ::mlir::DenseIntElementsAttr &propValue) { + this->case_values = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.branch_weights == this->branch_weights && + rhs.case_operand_segments == this->case_operand_segments && + rhs.case_values == this->case_values && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SwitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchOpGenericAdaptorBase(SwitchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getCaseValuesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getCaseValues(); + ::mlir::DenseI32ArrayAttr getCaseOperandSegmentsAttr(); + ::llvm::ArrayRef getCaseOperandSegments(); + ::mlir::DenseI32ArrayAttr getBranchWeightsAttr(); + ::std::optional<::llvm::ArrayRef> getBranchWeights(); +}; +} // namespace detail +template +class SwitchOpGenericAdaptor : public detail::SwitchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchOpGenericAdaptorBase; +public: + SwitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SwitchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getDefaultOperands() { + return getODSOperands(1); + } + + ::llvm::SmallVector getCaseOperands() { + auto tblgenTmpOperands = getODSOperands(2); + auto sizes = getCaseOperandSegments(); + + ::llvm::SmallVector tblgenTmpOperandGroups; + for (int i = 0, e = sizes.size(); i < e; ++i) { + tblgenTmpOperandGroups.push_back(tblgenTmpOperands.take_front(sizes[i])); + tblgenTmpOperands = tblgenTmpOperands.drop_front(sizes[i]); + } + return tblgenTmpOperandGroups; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchOpAdaptor : public SwitchOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchOpGenericAdaptor::SwitchOpGenericAdaptor; + SwitchOpAdaptor(SwitchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::BranchOpInterface::Trait, ::mlir::LLVM::BranchWeightOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchOpAdaptor; + template + using GenericAdaptor = SwitchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("branch_weights"), ::llvm::StringRef("case_operand_segments"), ::llvm::StringRef("case_values"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBranchWeightsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBranchWeightsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCaseOperandSegmentsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCaseOperandSegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCaseValuesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCaseValuesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.switch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getValue(); + ::mlir::Operation::operand_range getDefaultOperands(); + ::mlir::OperandRangeRange getCaseOperands(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::MutableOperandRange getDefaultOperandsMutable(); + ::mlir::MutableOperandRangeRange getCaseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDefaultDestination(); + ::mlir::SuccessorRange getCaseDestinations(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getCaseValuesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getCaseValues(); + ::mlir::DenseI32ArrayAttr getCaseOperandSegmentsAttr(); + ::llvm::ArrayRef getCaseOperandSegments(); + ::mlir::DenseI32ArrayAttr getBranchWeightsAttr(); + ::std::optional<::llvm::ArrayRef> getBranchWeights(); + void setCaseValuesAttr(::mlir::DenseIntElementsAttr attr); + void setCaseOperandSegmentsAttr(::mlir::DenseI32ArrayAttr attr); + void setCaseOperandSegments(::llvm::ArrayRef attrValue); + void setBranchWeightsAttr(::mlir::DenseI32ArrayAttr attr); + void setBranchWeights(::std::optional<::llvm::ArrayRef> attrValue); + ::mlir::Attribute removeCaseValuesAttr(); + ::mlir::Attribute removeBranchWeightsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value, Block *defaultDestination, ValueRange defaultOperands, ArrayRef caseValues = {}, BlockRange caseDestinations = {}, ArrayRef caseOperands = {}, ArrayRef branchWeights = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value, Block *defaultDestination, ValueRange defaultOperands, ArrayRef caseValues = {}, BlockRange caseDestinations = {}, ArrayRef caseOperands = {}, ArrayRef branchWeights = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value, Block *defaultDestination, ValueRange defaultOperands, DenseIntElementsAttr caseValues = {}, BlockRange caseDestinations = {}, ArrayRef caseOperands = {}, ArrayRef branchWeights = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, SuccessorRange destinations, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange defaultOperands, ::llvm::ArrayRef<::mlir::ValueRange> caseOperands, /*optional*/::mlir::DenseIntElementsAttr case_values, /*optional*/::mlir::DenseI32ArrayAttr branch_weights, ::mlir::Block *defaultDestination, ::mlir::BlockRange caseDestinations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::SuccessorOperands getSuccessorOperands(unsigned index); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Return the operands for the case destination block at the given index. + OperandRange getCaseOperands(unsigned index) { + return getCaseOperands()[index]; + } + + /// Return a mutable range of operands for the case destination block at the + /// given index. + MutableOperandRange getCaseOperandsMutable(unsigned index) { + return getCaseOperandsMutable()[index]; + } +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::SwitchOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::TruncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncOpGenericAdaptorBase(TruncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TruncOpGenericAdaptor : public detail::TruncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncOpGenericAdaptorBase; +public: + TruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TruncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncOpAdaptor : public TruncOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncOpGenericAdaptor::TruncOpGenericAdaptor; + TruncOpAdaptor(TruncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncOpAdaptor; + template + using GenericAdaptor = TruncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.trunc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::TruncOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UDivOpGenericAdaptorBase(UDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UDivOpGenericAdaptor : public detail::UDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UDivOpGenericAdaptorBase; +public: + UDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UDivOpAdaptor : public UDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using UDivOpGenericAdaptor::UDivOpGenericAdaptor; + UDivOpAdaptor(UDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UDivOpAdaptor; + template + using GenericAdaptor = UDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.udiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UDivOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UIToFPOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UIToFPOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UIToFPOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UIToFPOpGenericAdaptorBase(UIToFPOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UIToFPOpGenericAdaptor : public detail::UIToFPOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UIToFPOpGenericAdaptorBase; +public: + UIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UIToFPOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UIToFPOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UIToFPOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UIToFPOpAdaptor : public UIToFPOpGenericAdaptor<::mlir::ValueRange> { +public: + using UIToFPOpGenericAdaptor::UIToFPOpGenericAdaptor; + UIToFPOpAdaptor(UIToFPOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UIToFPOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UIToFPOpAdaptor; + template + using GenericAdaptor = UIToFPOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.uitofp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UIToFPOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::URemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class URemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + URemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + URemOpGenericAdaptorBase(URemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class URemOpGenericAdaptor : public detail::URemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::URemOpGenericAdaptorBase; +public: + URemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + URemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : URemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + URemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class URemOpAdaptor : public URemOpGenericAdaptor<::mlir::ValueRange> { +public: + using URemOpGenericAdaptor::URemOpGenericAdaptor; + URemOpAdaptor(URemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class URemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = URemOpAdaptor; + template + using GenericAdaptor = URemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.urem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::URemOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UndefOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UndefOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UndefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UndefOpGenericAdaptorBase(UndefOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UndefOpGenericAdaptor : public detail::UndefOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UndefOpGenericAdaptorBase; +public: + UndefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UndefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UndefOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UndefOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UndefOpAdaptor : public UndefOpGenericAdaptor<::mlir::ValueRange> { +public: + using UndefOpGenericAdaptor::UndefOpGenericAdaptor; + UndefOpAdaptor(UndefOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UndefOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UndefOpAdaptor; + template + using GenericAdaptor = UndefOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mlir.undef"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UndefOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::UnreachableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnreachableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnreachableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnreachableOpGenericAdaptorBase(UnreachableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnreachableOpGenericAdaptor : public detail::UnreachableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnreachableOpGenericAdaptorBase; +public: + UnreachableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnreachableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnreachableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnreachableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnreachableOpAdaptor : public UnreachableOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnreachableOpGenericAdaptor::UnreachableOpGenericAdaptor; + UnreachableOpAdaptor(UnreachableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnreachableOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = UnreachableOpAdaptor; + template + using GenericAdaptor = UnreachableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.unreachable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::UnreachableOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::XOrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XOrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XOrOpGenericAdaptorBase(XOrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XOrOpGenericAdaptor : public detail::XOrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XOrOpGenericAdaptorBase; +public: + XOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XOrOpAdaptor : public XOrOpGenericAdaptor<::mlir::ValueRange> { +public: + using XOrOpGenericAdaptor::XOrOpGenericAdaptor; + XOrOpAdaptor(XOrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XOrOpAdaptor; + template + using GenericAdaptor = XOrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.xor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::XOrOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ZExtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ZExtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ZExtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ZExtOpGenericAdaptorBase(ZExtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ZExtOpGenericAdaptor : public detail::ZExtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ZExtOpGenericAdaptorBase; +public: + ZExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ZExtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ZExtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ZExtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ZExtOpAdaptor : public ZExtOpGenericAdaptor<::mlir::ValueRange> { +public: + using ZExtOpGenericAdaptor::ZExtOpGenericAdaptor; + ZExtOpAdaptor(ZExtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ZExtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ZExtOpAdaptor; + template + using GenericAdaptor = ZExtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.zext"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ZExtOp) + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// ::mlir::LLVM::ZeroOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ZeroOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ZeroOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ZeroOpGenericAdaptorBase(ZeroOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ZeroOpGenericAdaptor : public detail::ZeroOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ZeroOpGenericAdaptorBase; +public: + ZeroOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ZeroOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ZeroOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ZeroOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ZeroOpAdaptor : public ZeroOpGenericAdaptor<::mlir::ValueRange> { +public: + using ZeroOpGenericAdaptor::ZeroOpGenericAdaptor; + ZeroOpAdaptor(ZeroOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ZeroOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ZeroOpAdaptor; + template + using GenericAdaptor = ZeroOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("llvm.mlir.zero"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ZeroOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..ba2ba52046782850ae73c569817644b171cdb7dd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc @@ -0,0 +1,6878 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::LLVM::CConvAttr, +::mlir::LLVM::ComdatAttr, +::mlir::LLVM::AccessGroupAttr, +::mlir::LLVM::AliasScopeAttr, +::mlir::LLVM::AliasScopeDomainAttr, +::mlir::LLVM::DIBasicTypeAttr, +::mlir::LLVM::DICompileUnitAttr, +::mlir::LLVM::DICompositeTypeAttr, +::mlir::LLVM::DIDerivedTypeAttr, +::mlir::LLVM::DIFileAttr, +::mlir::LLVM::DILabelAttr, +::mlir::LLVM::DILexicalBlockAttr, +::mlir::LLVM::DILexicalBlockFileAttr, +::mlir::LLVM::DILocalVariableAttr, +::mlir::LLVM::DIModuleAttr, +::mlir::LLVM::DINamespaceAttr, +::mlir::LLVM::DINullTypeAttr, +::mlir::LLVM::DISubprogramAttr, +::mlir::LLVM::DISubrangeAttr, +::mlir::LLVM::DISubroutineTypeAttr, +::mlir::LLVM::FastmathFlagsAttr, +::mlir::LLVM::MemoryEffectsAttr, +::mlir::LLVM::TBAAMemberAttr, +::mlir::LLVM::TBAARootAttr, +::mlir::LLVM::TBAATagAttr, +::mlir::LLVM::TBAATypeDescriptorAttr, +::mlir::LLVM::VScaleRangeAttr, +::mlir::LLVM::LinkageAttr, +::mlir::LLVM::LoopAnnotationAttr, +::mlir::LLVM::LoopDistributeAttr, +::mlir::LLVM::LoopInterleaveAttr, +::mlir::LLVM::LoopLICMAttr, +::mlir::LLVM::LoopPeeledAttr, +::mlir::LLVM::LoopPipelineAttr, +::mlir::LLVM::LoopUnrollAndJamAttr, +::mlir::LLVM::LoopUnrollAttr, +::mlir::LLVM::LoopUnswitchAttr, +::mlir::LLVM::LoopVectorizeAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::LLVM::CConvAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::CConvAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::ComdatAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::ComdatAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::AccessGroupAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::AccessGroupAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::AliasScopeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::AliasScopeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::AliasScopeDomainAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::AliasScopeDomainAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DIBasicTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DIBasicTypeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DICompileUnitAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DICompileUnitAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DICompositeTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DICompositeTypeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DIDerivedTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DIDerivedTypeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DIFileAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DIFileAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DILabelAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DILabelAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DILexicalBlockAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DILexicalBlockAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DILexicalBlockFileAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DILexicalBlockFileAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DILocalVariableAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DILocalVariableAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DIModuleAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DIModuleAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DINamespaceAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DINamespaceAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DINullTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DINullTypeAttr::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DISubprogramAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DISubprogramAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DISubrangeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DISubrangeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::DISubroutineTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::DISubroutineTypeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::FastmathFlagsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::FastmathFlagsAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::MemoryEffectsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::MemoryEffectsAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::TBAAMemberAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::TBAAMemberAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::TBAARootAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::TBAARootAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::TBAATagAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::TBAATagAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::TBAATypeDescriptorAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::TBAATypeDescriptorAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::VScaleRangeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::VScaleRangeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LinkageAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LinkageAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopAnnotationAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopAnnotationAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopDistributeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopDistributeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopInterleaveAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopInterleaveAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopLICMAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopLICMAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopPeeledAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopPeeledAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopPipelineAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopPipelineAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopUnrollAndJamAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopUnrollAndJamAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopUnrollAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopUnrollAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopUnswitchAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopUnswitchAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LoopVectorizeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LoopVectorizeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::LLVM::CConvAttr>([&](auto t) { + printer << ::mlir::LLVM::CConvAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::ComdatAttr>([&](auto t) { + printer << ::mlir::LLVM::ComdatAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::AccessGroupAttr>([&](auto t) { + printer << ::mlir::LLVM::AccessGroupAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::AliasScopeAttr>([&](auto t) { + printer << ::mlir::LLVM::AliasScopeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::AliasScopeDomainAttr>([&](auto t) { + printer << ::mlir::LLVM::AliasScopeDomainAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DIBasicTypeAttr>([&](auto t) { + printer << ::mlir::LLVM::DIBasicTypeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DICompileUnitAttr>([&](auto t) { + printer << ::mlir::LLVM::DICompileUnitAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DICompositeTypeAttr>([&](auto t) { + printer << ::mlir::LLVM::DICompositeTypeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DIDerivedTypeAttr>([&](auto t) { + printer << ::mlir::LLVM::DIDerivedTypeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DIFileAttr>([&](auto t) { + printer << ::mlir::LLVM::DIFileAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DILabelAttr>([&](auto t) { + printer << ::mlir::LLVM::DILabelAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DILexicalBlockAttr>([&](auto t) { + printer << ::mlir::LLVM::DILexicalBlockAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DILexicalBlockFileAttr>([&](auto t) { + printer << ::mlir::LLVM::DILexicalBlockFileAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DILocalVariableAttr>([&](auto t) { + printer << ::mlir::LLVM::DILocalVariableAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DIModuleAttr>([&](auto t) { + printer << ::mlir::LLVM::DIModuleAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DINamespaceAttr>([&](auto t) { + printer << ::mlir::LLVM::DINamespaceAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DINullTypeAttr>([&](auto t) { + printer << ::mlir::LLVM::DINullTypeAttr::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DISubprogramAttr>([&](auto t) { + printer << ::mlir::LLVM::DISubprogramAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DISubrangeAttr>([&](auto t) { + printer << ::mlir::LLVM::DISubrangeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::DISubroutineTypeAttr>([&](auto t) { + printer << ::mlir::LLVM::DISubroutineTypeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::FastmathFlagsAttr>([&](auto t) { + printer << ::mlir::LLVM::FastmathFlagsAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::MemoryEffectsAttr>([&](auto t) { + printer << ::mlir::LLVM::MemoryEffectsAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::TBAAMemberAttr>([&](auto t) { + printer << ::mlir::LLVM::TBAAMemberAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::TBAARootAttr>([&](auto t) { + printer << ::mlir::LLVM::TBAARootAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::TBAATagAttr>([&](auto t) { + printer << ::mlir::LLVM::TBAATagAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::TBAATypeDescriptorAttr>([&](auto t) { + printer << ::mlir::LLVM::TBAATypeDescriptorAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::VScaleRangeAttr>([&](auto t) { + printer << ::mlir::LLVM::VScaleRangeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LinkageAttr>([&](auto t) { + printer << ::mlir::LLVM::LinkageAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopAnnotationAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopAnnotationAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopDistributeAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopDistributeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopInterleaveAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopInterleaveAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopLICMAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopLICMAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopPeeledAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopPeeledAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopPipelineAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopPipelineAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopUnrollAndJamAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopUnrollAndJamAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopUnrollAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopUnrollAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopUnswitchAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopUnswitchAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LoopVectorizeAttr>([&](auto t) { + printer << ::mlir::LLVM::LoopVectorizeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace LLVM { +namespace detail { +struct CConvAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + CConvAttrStorage(CConv CallingConv) : CallingConv(std::move(CallingConv)) {} + + KeyTy getAsKey() const { + return KeyTy(CallingConv); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (CallingConv == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static CConvAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto CallingConv = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) CConvAttrStorage(std::move(CallingConv)); + } + + CConv CallingConv; +}; +} // namespace detail +CConvAttr CConvAttr::get(::mlir::MLIRContext *context, CConv CallingConv) { + return Base::get(context, std::move(CallingConv)); +} + +::mlir::Attribute CConvAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_CallingConv; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'CallingConv' + _result_CallingConv = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_CallingConv)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CConvAttr parameter 'CallingConv' which is to be a `CConv`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_CallingConv)); + return CConvAttr::get(odsParser.getContext(), + CConv((*_result_CallingConv))); +} + +void CConvAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter.printStrippedAttrOrType(getCallingConv()); + odsPrinter << ">"; +} + +CConv CConvAttr::getCallingConv() const { + return getImpl()->CallingConv; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CConvAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct ComdatAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + ComdatAttrStorage(comdat::Comdat comdat) : comdat(std::move(comdat)) {} + + KeyTy getAsKey() const { + return KeyTy(comdat); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (comdat == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ComdatAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto comdat = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ComdatAttrStorage(std::move(comdat)); + } + + comdat::Comdat comdat; +}; +} // namespace detail +ComdatAttr ComdatAttr::get(::mlir::MLIRContext *context, comdat::Comdat comdat) { + return Base::get(context, std::move(comdat)); +} + +::mlir::Attribute ComdatAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_comdat; + + // Parse variable 'comdat' + _result_comdat = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_comdat)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ComdatAttr parameter 'comdat' which is to be a `comdat::Comdat`"); + return {}; + } + assert(::mlir::succeeded(_result_comdat)); + return ComdatAttr::get(odsParser.getContext(), + comdat::Comdat((*_result_comdat))); +} + +void ComdatAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter.printStrippedAttrOrType(getComdat()); +} + +comdat::Comdat ComdatAttr::getComdat() const { + return getImpl()->comdat; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ComdatAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct AccessGroupAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + AccessGroupAttrStorage(DistinctAttr id) : id(std::move(id)) {} + + KeyTy getAsKey() const { + return KeyTy(id); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (id == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static AccessGroupAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto id = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) AccessGroupAttrStorage(std::move(id)); + } + + DistinctAttr id; +}; +} // namespace detail +AccessGroupAttr AccessGroupAttr::get(::mlir::MLIRContext *context, DistinctAttr id) { + return Base::get(context, std::move(id)); +} + +AccessGroupAttr AccessGroupAttr::get(::mlir::MLIRContext *context) { + return Base::get(context, DistinctAttr::create(UnitAttr::get(context))); +} + +::mlir::Attribute AccessGroupAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_id; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_id = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_id && _paramKey == "id") { + _seen_id = true; + + // Parse variable 'id' + _result_id = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_id)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AccessGroupAttr parameter 'id' which is to be a `DistinctAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_id)); + return AccessGroupAttr::get(odsParser.getContext(), + DistinctAttr((*_result_id))); +} + +void AccessGroupAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "id = "; + odsPrinter.printStrippedAttrOrType(getId()); + } + odsPrinter << ">"; +} + +DistinctAttr AccessGroupAttr::getId() const { + return getImpl()->id; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AccessGroupAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct AliasScopeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + AliasScopeAttrStorage(DistinctAttr id, AliasScopeDomainAttr domain, StringAttr description) : id(std::move(id)), domain(std::move(domain)), description(std::move(description)) {} + + KeyTy getAsKey() const { + return KeyTy(id, domain, description); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (id == std::get<0>(tblgenKey)) && (domain == std::get<1>(tblgenKey)) && (description == std::get<2>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); + } + + static AliasScopeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto id = std::move(std::get<0>(tblgenKey)); + auto domain = std::move(std::get<1>(tblgenKey)); + auto description = std::move(std::get<2>(tblgenKey)); + return new (allocator.allocate()) AliasScopeAttrStorage(std::move(id), std::move(domain), std::move(description)); + } + + DistinctAttr id; + AliasScopeDomainAttr domain; + StringAttr description; +}; +} // namespace detail +AliasScopeAttr AliasScopeAttr::get(::mlir::MLIRContext *context, DistinctAttr id, AliasScopeDomainAttr domain, StringAttr description) { + return Base::get(context, std::move(id), std::move(domain), std::move(description)); +} + +AliasScopeAttr AliasScopeAttr::get(AliasScopeDomainAttr domain, StringAttr description) { + MLIRContext *ctx = domain.getContext(); + return Base::get(ctx, DistinctAttr::create(UnitAttr::get(ctx)), domain, description); +} + +::mlir::Attribute AliasScopeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_id; + ::mlir::FailureOr _result_domain; + ::mlir::FailureOr _result_description; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_id = false; + bool _seen_domain = false; + bool _seen_description = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_id && _paramKey == "id") { + _seen_id = true; + + // Parse variable 'id' + _result_id = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_id)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeAttr parameter 'id' which is to be a `DistinctAttr`"); + return {}; + } + } else if (!_seen_domain && _paramKey == "domain") { + _seen_domain = true; + + // Parse variable 'domain' + _result_domain = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_domain)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeAttr parameter 'domain' which is to be a `AliasScopeDomainAttr`"); + return {}; + } + } else if (!_seen_description && _paramKey == "description") { + _seen_description = true; + + // Parse variable 'description' + _result_description = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_description)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeAttr parameter 'description' which is to be a `StringAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_id) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "id"; + return {}; + } + if (!_seen_domain) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "domain"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_id)); + assert(::mlir::succeeded(_result_domain)); + return AliasScopeAttr::get(odsParser.getContext(), + DistinctAttr((*_result_id)), + AliasScopeDomainAttr((*_result_domain)), + StringAttr((_result_description.value_or(StringAttr())))); +} + +void AliasScopeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "id = "; + odsPrinter.printStrippedAttrOrType(getId()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "domain = "; + odsPrinter.printStrippedAttrOrType(getDomain()); + if (!(getDescription() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "description = "; + if (!(getDescription() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getDescription()); + } + } + } + odsPrinter << ">"; +} + +DistinctAttr AliasScopeAttr::getId() const { + return getImpl()->id; +} + +AliasScopeDomainAttr AliasScopeAttr::getDomain() const { + return getImpl()->domain; +} + +StringAttr AliasScopeAttr::getDescription() const { + return getImpl()->description; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AliasScopeAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct AliasScopeDomainAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + AliasScopeDomainAttrStorage(DistinctAttr id, StringAttr description) : id(std::move(id)), description(std::move(description)) {} + + KeyTy getAsKey() const { + return KeyTy(id, description); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (id == std::get<0>(tblgenKey)) && (description == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static AliasScopeDomainAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto id = std::move(std::get<0>(tblgenKey)); + auto description = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) AliasScopeDomainAttrStorage(std::move(id), std::move(description)); + } + + DistinctAttr id; + StringAttr description; +}; +} // namespace detail +AliasScopeDomainAttr AliasScopeDomainAttr::get(::mlir::MLIRContext *context, DistinctAttr id, StringAttr description) { + return Base::get(context, std::move(id), std::move(description)); +} + +AliasScopeDomainAttr AliasScopeDomainAttr::get(::mlir::MLIRContext *context, StringAttr description) { + return Base::get(context, DistinctAttr::create(UnitAttr::get(context)), description); +} + +::mlir::Attribute AliasScopeDomainAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_id; + ::mlir::FailureOr _result_description; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_id = false; + bool _seen_description = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_id && _paramKey == "id") { + _seen_id = true; + + // Parse variable 'id' + _result_id = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_id)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeDomainAttr parameter 'id' which is to be a `DistinctAttr`"); + return {}; + } + } else if (!_seen_description && _paramKey == "description") { + _seen_description = true; + + // Parse variable 'description' + _result_description = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_description)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeDomainAttr parameter 'description' which is to be a `StringAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_id) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "id"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_id)); + return AliasScopeDomainAttr::get(odsParser.getContext(), + DistinctAttr((*_result_id)), + StringAttr((_result_description.value_or(StringAttr())))); +} + +void AliasScopeDomainAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "id = "; + odsPrinter.printStrippedAttrOrType(getId()); + if (!(getDescription() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "description = "; + if (!(getDescription() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getDescription()); + } + } + } + odsPrinter << ">"; +} + +DistinctAttr AliasScopeDomainAttr::getId() const { + return getImpl()->id; +} + +StringAttr AliasScopeDomainAttr::getDescription() const { + return getImpl()->description; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AliasScopeDomainAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DIBasicTypeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DIBasicTypeAttrStorage(unsigned tag, StringAttr name, uint64_t sizeInBits, unsigned encoding) : tag(std::move(tag)), name(std::move(name)), sizeInBits(std::move(sizeInBits)), encoding(std::move(encoding)) {} + + KeyTy getAsKey() const { + return KeyTy(tag, name, sizeInBits, encoding); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (sizeInBits == std::get<2>(tblgenKey)) && (encoding == std::get<3>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); + } + + static DIBasicTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto tag = std::move(std::get<0>(tblgenKey)); + auto name = std::move(std::get<1>(tblgenKey)); + auto sizeInBits = std::move(std::get<2>(tblgenKey)); + auto encoding = std::move(std::get<3>(tblgenKey)); + return new (allocator.allocate()) DIBasicTypeAttrStorage(std::move(tag), std::move(name), std::move(sizeInBits), std::move(encoding)); + } + + unsigned tag; + StringAttr name; + uint64_t sizeInBits; + unsigned encoding; +}; +} // namespace detail +DIBasicTypeAttr DIBasicTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, uint64_t sizeInBits, unsigned encoding) { + return Base::get(context, std::move(tag), std::move(name), std::move(sizeInBits), std::move(encoding)); +} + +DIBasicTypeAttr DIBasicTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, const Twine &name, uint64_t sizeInBits, unsigned encoding) { + return Base::get(context, tag, StringAttr::get(context, name), sizeInBits, + encoding); +} + +::mlir::Attribute DIBasicTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_tag; + ::mlir::FailureOr _result_name; + ::mlir::FailureOr _result_sizeInBits; + ::mlir::FailureOr _result_encoding; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_tag = false; + bool _seen_name = false; + bool _seen_sizeInBits = false; + bool _seen_encoding = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_tag && _paramKey == "tag") { + _seen_tag = true; + + // Parse variable 'tag' + _result_tag = [&]() -> FailureOr { + SMLoc tagLoc = odsParser.getCurrentLocation(); + StringRef name; + if (odsParser.parseKeyword(&name)) + return failure(); + + if (unsigned tag = llvm::dwarf::getTag(name)) + return tag; + return odsParser.emitError(tagLoc) + << "invalid debug info debug info tag name: " << name; + }() ; + if (::mlir::failed(_result_tag)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'tag' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_name && _paramKey == "name") { + _seen_name = true; + + // Parse variable 'name' + _result_name = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_name)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'name' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { + _seen_sizeInBits = true; + + // Parse variable 'sizeInBits' + _result_sizeInBits = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_sizeInBits)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); + return {}; + } + } else if (!_seen_encoding && _paramKey == "encoding") { + _seen_encoding = true; + + // Parse variable 'encoding' + _result_encoding = [&]() -> FailureOr { + SMLoc tagLoc = odsParser.getCurrentLocation(); + StringRef name; + if (odsParser.parseKeyword(&name)) + return failure(); + + if (unsigned tag = llvm::dwarf::getAttributeEncoding(name)) + return tag; + return odsParser.emitError(tagLoc) + << "invalid debug info debug info encoding name: " << name; + }() ; + if (::mlir::failed(_result_encoding)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'encoding' which is to be a `unsigned`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_tag) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "tag"; + return {}; + } + if (!_seen_name) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_tag)); + assert(::mlir::succeeded(_result_name)); + return DIBasicTypeAttr::get(odsParser.getContext(), + unsigned((*_result_tag)), + StringAttr((*_result_name)), + uint64_t((_result_sizeInBits.value_or(uint64_t()))), + unsigned((_result_encoding.value_or(0)))); +} + +void DIBasicTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "tag = "; + odsPrinter << llvm::dwarf::TagString(getTag()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "name = "; + odsPrinter.printStrippedAttrOrType(getName()); + if (!(getSizeInBits() == uint64_t())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "sizeInBits = "; + if (!(getSizeInBits() == uint64_t())) { + odsPrinter.printStrippedAttrOrType(getSizeInBits()); + } + } + if (!(getEncoding() == 0)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "encoding = "; + if (!(getEncoding() == 0)) { + odsPrinter << llvm::dwarf::AttributeEncodingString(getEncoding()); + } + } + } + odsPrinter << ">"; +} + +unsigned DIBasicTypeAttr::getTag() const { + return getImpl()->tag; +} + +StringAttr DIBasicTypeAttr::getName() const { + return getImpl()->name; +} + +uint64_t DIBasicTypeAttr::getSizeInBits() const { + return getImpl()->sizeInBits; +} + +unsigned DIBasicTypeAttr::getEncoding() const { + return getImpl()->encoding; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIBasicTypeAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DICompileUnitAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DICompileUnitAttrStorage(unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind) : sourceLanguage(std::move(sourceLanguage)), file(std::move(file)), producer(std::move(producer)), isOptimized(std::move(isOptimized)), emissionKind(std::move(emissionKind)) {} + + KeyTy getAsKey() const { + return KeyTy(sourceLanguage, file, producer, isOptimized, emissionKind); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (sourceLanguage == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (producer == std::get<2>(tblgenKey)) && (isOptimized == std::get<3>(tblgenKey)) && (emissionKind == std::get<4>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey)); + } + + static DICompileUnitAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto sourceLanguage = std::move(std::get<0>(tblgenKey)); + auto file = std::move(std::get<1>(tblgenKey)); + auto producer = std::move(std::get<2>(tblgenKey)); + auto isOptimized = std::move(std::get<3>(tblgenKey)); + auto emissionKind = std::move(std::get<4>(tblgenKey)); + return new (allocator.allocate()) DICompileUnitAttrStorage(std::move(sourceLanguage), std::move(file), std::move(producer), std::move(isOptimized), std::move(emissionKind)); + } + + unsigned sourceLanguage; + DIFileAttr file; + StringAttr producer; + bool isOptimized; + DIEmissionKind emissionKind; +}; +} // namespace detail +DICompileUnitAttr DICompileUnitAttr::get(::mlir::MLIRContext *context, unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind) { + return Base::get(context, std::move(sourceLanguage), std::move(file), std::move(producer), std::move(isOptimized), std::move(emissionKind)); +} + +::mlir::Attribute DICompileUnitAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_sourceLanguage; + ::mlir::FailureOr _result_file; + ::mlir::FailureOr _result_producer; + ::mlir::FailureOr _result_isOptimized; + ::mlir::FailureOr _result_emissionKind; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_sourceLanguage = false; + bool _seen_file = false; + bool _seen_producer = false; + bool _seen_isOptimized = false; + bool _seen_emissionKind = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_sourceLanguage && _paramKey == "sourceLanguage") { + _seen_sourceLanguage = true; + + // Parse variable 'sourceLanguage' + _result_sourceLanguage = [&]() -> FailureOr { + SMLoc tagLoc = odsParser.getCurrentLocation(); + StringRef name; + if (odsParser.parseKeyword(&name)) + return failure(); + + if (unsigned tag = llvm::dwarf::getLanguage(name)) + return tag; + return odsParser.emitError(tagLoc) + << "invalid debug info debug info language name: " << name; + }() ; + if (::mlir::failed(_result_sourceLanguage)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'sourceLanguage' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_file && _paramKey == "file") { + _seen_file = true; + + // Parse variable 'file' + _result_file = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_file)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'file' which is to be a `DIFileAttr`"); + return {}; + } + } else if (!_seen_producer && _paramKey == "producer") { + _seen_producer = true; + + // Parse variable 'producer' + _result_producer = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_producer)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'producer' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_isOptimized && _paramKey == "isOptimized") { + _seen_isOptimized = true; + + // Parse variable 'isOptimized' + _result_isOptimized = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_isOptimized)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'isOptimized' which is to be a `bool`"); + return {}; + } + } else if (!_seen_emissionKind && _paramKey == "emissionKind") { + _seen_emissionKind = true; + + // Parse variable 'emissionKind' + _result_emissionKind = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_emissionKind)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'emissionKind' which is to be a `DIEmissionKind`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_sourceLanguage) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "sourceLanguage"; + return {}; + } + if (!_seen_file) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "file"; + return {}; + } + if (!_seen_isOptimized) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "isOptimized"; + return {}; + } + if (!_seen_emissionKind) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "emissionKind"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_sourceLanguage)); + assert(::mlir::succeeded(_result_file)); + assert(::mlir::succeeded(_result_isOptimized)); + assert(::mlir::succeeded(_result_emissionKind)); + return DICompileUnitAttr::get(odsParser.getContext(), + unsigned((*_result_sourceLanguage)), + DIFileAttr((*_result_file)), + StringAttr((_result_producer.value_or(StringAttr()))), + bool((*_result_isOptimized)), + DIEmissionKind((*_result_emissionKind))); +} + +void DICompileUnitAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "sourceLanguage = "; + odsPrinter << llvm::dwarf::LanguageString(getSourceLanguage()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "file = "; + odsPrinter.printStrippedAttrOrType(getFile()); + if (!(getProducer() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "producer = "; + if (!(getProducer() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getProducer()); + } + } + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "isOptimized = "; + odsPrinter.printStrippedAttrOrType(getIsOptimized()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "emissionKind = "; + odsPrinter.printStrippedAttrOrType(getEmissionKind()); + } + odsPrinter << ">"; +} + +unsigned DICompileUnitAttr::getSourceLanguage() const { + return getImpl()->sourceLanguage; +} + +DIFileAttr DICompileUnitAttr::getFile() const { + return getImpl()->file; +} + +StringAttr DICompileUnitAttr::getProducer() const { + return getImpl()->producer; +} + +bool DICompileUnitAttr::getIsOptimized() const { + return getImpl()->isOptimized; +} + +DIEmissionKind DICompileUnitAttr::getEmissionKind() const { + return getImpl()->emissionKind; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompileUnitAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DICompositeTypeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple>; + DICompositeTypeAttrStorage(unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, DIFlags flags, uint64_t sizeInBits, uint64_t alignInBits, ::llvm::ArrayRef elements) : tag(std::move(tag)), name(std::move(name)), file(std::move(file)), line(std::move(line)), scope(std::move(scope)), baseType(std::move(baseType)), flags(std::move(flags)), sizeInBits(std::move(sizeInBits)), alignInBits(std::move(alignInBits)), elements(std::move(elements)) {} + + KeyTy getAsKey() const { + return KeyTy(tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, elements); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (file == std::get<2>(tblgenKey)) && (line == std::get<3>(tblgenKey)) && (scope == std::get<4>(tblgenKey)) && (baseType == std::get<5>(tblgenKey)) && (flags == std::get<6>(tblgenKey)) && (sizeInBits == std::get<7>(tblgenKey)) && (alignInBits == std::get<8>(tblgenKey)) && (::llvm::ArrayRef(elements) == ::llvm::ArrayRef(std::get<9>(tblgenKey))); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey), std::get<9>(tblgenKey)); + } + + static DICompositeTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto tag = std::move(std::get<0>(tblgenKey)); + auto name = std::move(std::get<1>(tblgenKey)); + auto file = std::move(std::get<2>(tblgenKey)); + auto line = std::move(std::get<3>(tblgenKey)); + auto scope = std::move(std::get<4>(tblgenKey)); + auto baseType = std::move(std::get<5>(tblgenKey)); + auto flags = std::move(std::get<6>(tblgenKey)); + auto sizeInBits = std::move(std::get<7>(tblgenKey)); + auto alignInBits = std::move(std::get<8>(tblgenKey)); + auto elements = std::move(std::get<9>(tblgenKey)); + elements = allocator.copyInto(elements); + return new (allocator.allocate()) DICompositeTypeAttrStorage(std::move(tag), std::move(name), std::move(file), std::move(line), std::move(scope), std::move(baseType), std::move(flags), std::move(sizeInBits), std::move(alignInBits), std::move(elements)); + } + + unsigned tag; + StringAttr name; + DIFileAttr file; + uint32_t line; + DIScopeAttr scope; + DITypeAttr baseType; + DIFlags flags; + uint64_t sizeInBits; + uint64_t alignInBits; + ::llvm::ArrayRef elements; +}; +} // namespace detail +DICompositeTypeAttr DICompositeTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, DIFlags flags, uint64_t sizeInBits, uint64_t alignInBits, ::llvm::ArrayRef elements) { + return Base::get(context, std::move(tag), std::move(name), std::move(file), std::move(line), std::move(scope), std::move(baseType), std::move(flags), std::move(sizeInBits), std::move(alignInBits), std::move(elements)); +} + +::mlir::Attribute DICompositeTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_tag; + ::mlir::FailureOr _result_name; + ::mlir::FailureOr _result_file; + ::mlir::FailureOr _result_line; + ::mlir::FailureOr _result_scope; + ::mlir::FailureOr _result_baseType; + ::mlir::FailureOr _result_flags; + ::mlir::FailureOr _result_sizeInBits; + ::mlir::FailureOr _result_alignInBits; + ::mlir::FailureOr<::llvm::SmallVector> _result_elements; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_tag = false; + bool _seen_name = false; + bool _seen_file = false; + bool _seen_line = false; + bool _seen_scope = false; + bool _seen_baseType = false; + bool _seen_flags = false; + bool _seen_sizeInBits = false; + bool _seen_alignInBits = false; + bool _seen_elements = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_tag && _paramKey == "tag") { + _seen_tag = true; + + // Parse variable 'tag' + _result_tag = [&]() -> FailureOr { + SMLoc tagLoc = odsParser.getCurrentLocation(); + StringRef name; + if (odsParser.parseKeyword(&name)) + return failure(); + + if (unsigned tag = llvm::dwarf::getTag(name)) + return tag; + return odsParser.emitError(tagLoc) + << "invalid debug info debug info tag name: " << name; + }() ; + if (::mlir::failed(_result_tag)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'tag' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_name && _paramKey == "name") { + _seen_name = true; + + // Parse variable 'name' + _result_name = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_name)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'name' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_file && _paramKey == "file") { + _seen_file = true; + + // Parse variable 'file' + _result_file = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_file)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'file' which is to be a `DIFileAttr`"); + return {}; + } + } else if (!_seen_line && _paramKey == "line") { + _seen_line = true; + + // Parse variable 'line' + _result_line = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_line)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'line' which is to be a `uint32_t`"); + return {}; + } + } else if (!_seen_scope && _paramKey == "scope") { + _seen_scope = true; + + // Parse variable 'scope' + _result_scope = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scope)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'scope' which is to be a `DIScopeAttr`"); + return {}; + } + } else if (!_seen_baseType && _paramKey == "baseType") { + _seen_baseType = true; + + // Parse variable 'baseType' + _result_baseType = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_baseType)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'baseType' which is to be a `DITypeAttr`"); + return {}; + } + } else if (!_seen_flags && _paramKey == "flags") { + _seen_flags = true; + + // Parse variable 'flags' + _result_flags = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_flags)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'flags' which is to be a `DIFlags`"); + return {}; + } + } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { + _seen_sizeInBits = true; + + // Parse variable 'sizeInBits' + _result_sizeInBits = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_sizeInBits)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); + return {}; + } + } else if (!_seen_alignInBits && _paramKey == "alignInBits") { + _seen_alignInBits = true; + + // Parse variable 'alignInBits' + _result_alignInBits = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_alignInBits)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'alignInBits' which is to be a `uint64_t`"); + return {}; + } + } else if (!_seen_elements && _paramKey == "elements") { + _seen_elements = true; + + // Parse variable 'elements' + _result_elements = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); + if (::mlir::failed(_result_elements)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'elements' which is to be a `::llvm::ArrayRef`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_tag) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "tag"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_tag)); + return DICompositeTypeAttr::get(odsParser.getContext(), + unsigned((*_result_tag)), + StringAttr((_result_name.value_or(StringAttr()))), + DIFileAttr((_result_file.value_or(DIFileAttr()))), + uint32_t((_result_line.value_or(uint32_t()))), + DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), + DITypeAttr((_result_baseType.value_or(DITypeAttr()))), + DIFlags((_result_flags.value_or(DIFlags()))), + uint64_t((_result_sizeInBits.value_or(uint64_t()))), + uint64_t((_result_alignInBits.value_or(uint64_t()))), + ::llvm::ArrayRef((_result_elements.value_or(::llvm::SmallVector())))); +} + +void DICompositeTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "tag = "; + odsPrinter << llvm::dwarf::TagString(getTag()); + if (!(getName() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "name = "; + if (!(getName() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getName()); + } + } + if (!(getFile() == DIFileAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "file = "; + if (!(getFile() == DIFileAttr())) { + odsPrinter.printStrippedAttrOrType(getFile()); + } + } + if (!(getLine() == uint32_t())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "line = "; + if (!(getLine() == uint32_t())) { + odsPrinter.printStrippedAttrOrType(getLine()); + } + } + if (!(getScope() == DIScopeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scope = "; + if (!(getScope() == DIScopeAttr())) { + odsPrinter.printStrippedAttrOrType(getScope()); + } + } + if (!(getBaseType() == DITypeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "baseType = "; + if (!(getBaseType() == DITypeAttr())) { + odsPrinter.printStrippedAttrOrType(getBaseType()); + } + } + if (!(getFlags() == DIFlags())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "flags = "; + if (!(getFlags() == DIFlags())) { + odsPrinter.printStrippedAttrOrType(getFlags()); + } + } + if (!(getSizeInBits() == uint64_t())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "sizeInBits = "; + if (!(getSizeInBits() == uint64_t())) { + odsPrinter.printStrippedAttrOrType(getSizeInBits()); + } + } + if (!(getAlignInBits() == uint64_t())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "alignInBits = "; + if (!(getAlignInBits() == uint64_t())) { + odsPrinter.printStrippedAttrOrType(getAlignInBits()); + } + } + if (!(::llvm::ArrayRef(getElements()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "elements = "; + if (!(::llvm::ArrayRef(getElements()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { + odsPrinter.printStrippedAttrOrType(getElements()); + } + } + } + odsPrinter << ">"; +} + +unsigned DICompositeTypeAttr::getTag() const { + return getImpl()->tag; +} + +StringAttr DICompositeTypeAttr::getName() const { + return getImpl()->name; +} + +DIFileAttr DICompositeTypeAttr::getFile() const { + return getImpl()->file; +} + +uint32_t DICompositeTypeAttr::getLine() const { + return getImpl()->line; +} + +DIScopeAttr DICompositeTypeAttr::getScope() const { + return getImpl()->scope; +} + +DITypeAttr DICompositeTypeAttr::getBaseType() const { + return getImpl()->baseType; +} + +DIFlags DICompositeTypeAttr::getFlags() const { + return getImpl()->flags; +} + +uint64_t DICompositeTypeAttr::getSizeInBits() const { + return getImpl()->sizeInBits; +} + +uint64_t DICompositeTypeAttr::getAlignInBits() const { + return getImpl()->alignInBits; +} + +::llvm::ArrayRef DICompositeTypeAttr::getElements() const { + return getImpl()->elements; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompositeTypeAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DIDerivedTypeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DIDerivedTypeAttrStorage(unsigned tag, StringAttr name, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits) : tag(std::move(tag)), name(std::move(name)), baseType(std::move(baseType)), sizeInBits(std::move(sizeInBits)), alignInBits(std::move(alignInBits)), offsetInBits(std::move(offsetInBits)) {} + + KeyTy getAsKey() const { + return KeyTy(tag, name, baseType, sizeInBits, alignInBits, offsetInBits); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (baseType == std::get<2>(tblgenKey)) && (sizeInBits == std::get<3>(tblgenKey)) && (alignInBits == std::get<4>(tblgenKey)) && (offsetInBits == std::get<5>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey)); + } + + static DIDerivedTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto tag = std::move(std::get<0>(tblgenKey)); + auto name = std::move(std::get<1>(tblgenKey)); + auto baseType = std::move(std::get<2>(tblgenKey)); + auto sizeInBits = std::move(std::get<3>(tblgenKey)); + auto alignInBits = std::move(std::get<4>(tblgenKey)); + auto offsetInBits = std::move(std::get<5>(tblgenKey)); + return new (allocator.allocate()) DIDerivedTypeAttrStorage(std::move(tag), std::move(name), std::move(baseType), std::move(sizeInBits), std::move(alignInBits), std::move(offsetInBits)); + } + + unsigned tag; + StringAttr name; + DITypeAttr baseType; + uint64_t sizeInBits; + uint32_t alignInBits; + uint64_t offsetInBits; +}; +} // namespace detail +DIDerivedTypeAttr DIDerivedTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits) { + return Base::get(context, std::move(tag), std::move(name), std::move(baseType), std::move(sizeInBits), std::move(alignInBits), std::move(offsetInBits)); +} + +::mlir::Attribute DIDerivedTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_tag; + ::mlir::FailureOr _result_name; + ::mlir::FailureOr _result_baseType; + ::mlir::FailureOr _result_sizeInBits; + ::mlir::FailureOr _result_alignInBits; + ::mlir::FailureOr _result_offsetInBits; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_tag = false; + bool _seen_name = false; + bool _seen_baseType = false; + bool _seen_sizeInBits = false; + bool _seen_alignInBits = false; + bool _seen_offsetInBits = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_tag && _paramKey == "tag") { + _seen_tag = true; + + // Parse variable 'tag' + _result_tag = [&]() -> FailureOr { + SMLoc tagLoc = odsParser.getCurrentLocation(); + StringRef name; + if (odsParser.parseKeyword(&name)) + return failure(); + + if (unsigned tag = llvm::dwarf::getTag(name)) + return tag; + return odsParser.emitError(tagLoc) + << "invalid debug info debug info tag name: " << name; + }() ; + if (::mlir::failed(_result_tag)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'tag' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_name && _paramKey == "name") { + _seen_name = true; + + // Parse variable 'name' + _result_name = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_name)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'name' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_baseType && _paramKey == "baseType") { + _seen_baseType = true; + + // Parse variable 'baseType' + _result_baseType = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_baseType)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'baseType' which is to be a `DITypeAttr`"); + return {}; + } + } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { + _seen_sizeInBits = true; + + // Parse variable 'sizeInBits' + _result_sizeInBits = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_sizeInBits)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); + return {}; + } + } else if (!_seen_alignInBits && _paramKey == "alignInBits") { + _seen_alignInBits = true; + + // Parse variable 'alignInBits' + _result_alignInBits = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_alignInBits)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'alignInBits' which is to be a `uint32_t`"); + return {}; + } + } else if (!_seen_offsetInBits && _paramKey == "offsetInBits") { + _seen_offsetInBits = true; + + // Parse variable 'offsetInBits' + _result_offsetInBits = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_offsetInBits)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'offsetInBits' which is to be a `uint64_t`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_tag) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "tag"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_tag)); + return DIDerivedTypeAttr::get(odsParser.getContext(), + unsigned((*_result_tag)), + StringAttr((_result_name.value_or(StringAttr()))), + DITypeAttr((_result_baseType.value_or(DITypeAttr()))), + uint64_t((_result_sizeInBits.value_or(uint64_t()))), + uint32_t((_result_alignInBits.value_or(uint32_t()))), + uint64_t((_result_offsetInBits.value_or(uint64_t())))); +} + +void DIDerivedTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "tag = "; + odsPrinter << llvm::dwarf::TagString(getTag()); + if (!(getName() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "name = "; + if (!(getName() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getName()); + } + } + if (!(getBaseType() == DITypeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "baseType = "; + if (!(getBaseType() == DITypeAttr())) { + odsPrinter.printStrippedAttrOrType(getBaseType()); + } + } + if (!(getSizeInBits() == uint64_t())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "sizeInBits = "; + if (!(getSizeInBits() == uint64_t())) { + odsPrinter.printStrippedAttrOrType(getSizeInBits()); + } + } + if (!(getAlignInBits() == uint32_t())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "alignInBits = "; + if (!(getAlignInBits() == uint32_t())) { + odsPrinter.printStrippedAttrOrType(getAlignInBits()); + } + } + if (!(getOffsetInBits() == uint64_t())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "offsetInBits = "; + if (!(getOffsetInBits() == uint64_t())) { + odsPrinter.printStrippedAttrOrType(getOffsetInBits()); + } + } + } + odsPrinter << ">"; +} + +unsigned DIDerivedTypeAttr::getTag() const { + return getImpl()->tag; +} + +StringAttr DIDerivedTypeAttr::getName() const { + return getImpl()->name; +} + +DITypeAttr DIDerivedTypeAttr::getBaseType() const { + return getImpl()->baseType; +} + +uint64_t DIDerivedTypeAttr::getSizeInBits() const { + return getImpl()->sizeInBits; +} + +uint32_t DIDerivedTypeAttr::getAlignInBits() const { + return getImpl()->alignInBits; +} + +uint64_t DIDerivedTypeAttr::getOffsetInBits() const { + return getImpl()->offsetInBits; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIDerivedTypeAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DIFileAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DIFileAttrStorage(StringAttr name, StringAttr directory) : name(std::move(name)), directory(std::move(directory)) {} + + KeyTy getAsKey() const { + return KeyTy(name, directory); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (name == std::get<0>(tblgenKey)) && (directory == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static DIFileAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto name = std::move(std::get<0>(tblgenKey)); + auto directory = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) DIFileAttrStorage(std::move(name), std::move(directory)); + } + + StringAttr name; + StringAttr directory; +}; +} // namespace detail +DIFileAttr DIFileAttr::get(::mlir::MLIRContext *context, StringAttr name, StringAttr directory) { + return Base::get(context, std::move(name), std::move(directory)); +} + +DIFileAttr DIFileAttr::get(::mlir::MLIRContext *context, StringRef name, StringRef directory) { + return Base::get(context, StringAttr::get(context, name), + StringAttr::get(context, directory)); +} + +::mlir::Attribute DIFileAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_name; + ::mlir::FailureOr _result_directory; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'name' + _result_name = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_name)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIFileAttr parameter 'name' which is to be a `StringAttr`"); + return {}; + } + // Parse literal 'in' + if (odsParser.parseKeyword("in")) return {}; + + // Parse variable 'directory' + _result_directory = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_directory)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIFileAttr parameter 'directory' which is to be a `StringAttr`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_name)); + assert(::mlir::succeeded(_result_directory)); + return DIFileAttr::get(odsParser.getContext(), + StringAttr((*_result_name)), + StringAttr((*_result_directory))); +} + +void DIFileAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter.printStrippedAttrOrType(getName()); + odsPrinter << ' ' << "in"; + odsPrinter << ' '; + odsPrinter.printStrippedAttrOrType(getDirectory()); + odsPrinter << ">"; +} + +StringAttr DIFileAttr::getName() const { + return getImpl()->name; +} + +StringAttr DIFileAttr::getDirectory() const { + return getImpl()->directory; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIFileAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DILabelAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DILabelAttrStorage(DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line) : scope(std::move(scope)), name(std::move(name)), file(std::move(file)), line(std::move(line)) {} + + KeyTy getAsKey() const { + return KeyTy(scope, name, file, line); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (scope == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (file == std::get<2>(tblgenKey)) && (line == std::get<3>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); + } + + static DILabelAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto scope = std::move(std::get<0>(tblgenKey)); + auto name = std::move(std::get<1>(tblgenKey)); + auto file = std::move(std::get<2>(tblgenKey)); + auto line = std::move(std::get<3>(tblgenKey)); + return new (allocator.allocate()) DILabelAttrStorage(std::move(scope), std::move(name), std::move(file), std::move(line)); + } + + DIScopeAttr scope; + StringAttr name; + DIFileAttr file; + unsigned line; +}; +} // namespace detail +DILabelAttr DILabelAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line) { + return Base::get(context, std::move(scope), std::move(name), std::move(file), std::move(line)); +} + +DILabelAttr DILabelAttr::get(DIScopeAttr scope, StringRef name, DIFileAttr file, unsigned line) { + MLIRContext *ctx = scope.getContext(); + return Base::get(ctx, scope, StringAttr::get(ctx, name), file, line); +} + +::mlir::Attribute DILabelAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_scope; + ::mlir::FailureOr _result_name; + ::mlir::FailureOr _result_file; + ::mlir::FailureOr _result_line; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_scope = false; + bool _seen_name = false; + bool _seen_file = false; + bool _seen_line = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_scope && _paramKey == "scope") { + _seen_scope = true; + + // Parse variable 'scope' + _result_scope = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scope)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILabelAttr parameter 'scope' which is to be a `DIScopeAttr`"); + return {}; + } + } else if (!_seen_name && _paramKey == "name") { + _seen_name = true; + + // Parse variable 'name' + _result_name = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_name)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILabelAttr parameter 'name' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_file && _paramKey == "file") { + _seen_file = true; + + // Parse variable 'file' + _result_file = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_file)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILabelAttr parameter 'file' which is to be a `DIFileAttr`"); + return {}; + } + } else if (!_seen_line && _paramKey == "line") { + _seen_line = true; + + // Parse variable 'line' + _result_line = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_line)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILabelAttr parameter 'line' which is to be a `unsigned`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_scope) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_scope)); + return DILabelAttr::get(odsParser.getContext(), + DIScopeAttr((*_result_scope)), + StringAttr((_result_name.value_or(StringAttr()))), + DIFileAttr((_result_file.value_or(DIFileAttr()))), + unsigned((_result_line.value_or(unsigned())))); +} + +void DILabelAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scope = "; + odsPrinter.printStrippedAttrOrType(getScope()); + if (!(getName() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "name = "; + if (!(getName() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getName()); + } + } + if (!(getFile() == DIFileAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "file = "; + if (!(getFile() == DIFileAttr())) { + odsPrinter.printStrippedAttrOrType(getFile()); + } + } + if (!(getLine() == unsigned())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "line = "; + if (!(getLine() == unsigned())) { + odsPrinter.printStrippedAttrOrType(getLine()); + } + } + } + odsPrinter << ">"; +} + +DIScopeAttr DILabelAttr::getScope() const { + return getImpl()->scope; +} + +StringAttr DILabelAttr::getName() const { + return getImpl()->name; +} + +DIFileAttr DILabelAttr::getFile() const { + return getImpl()->file; +} + +unsigned DILabelAttr::getLine() const { + return getImpl()->line; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILabelAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DILexicalBlockAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DILexicalBlockAttrStorage(DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) : scope(std::move(scope)), file(std::move(file)), line(std::move(line)), column(std::move(column)) {} + + KeyTy getAsKey() const { + return KeyTy(scope, file, line, column); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (scope == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (line == std::get<2>(tblgenKey)) && (column == std::get<3>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); + } + + static DILexicalBlockAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto scope = std::move(std::get<0>(tblgenKey)); + auto file = std::move(std::get<1>(tblgenKey)); + auto line = std::move(std::get<2>(tblgenKey)); + auto column = std::move(std::get<3>(tblgenKey)); + return new (allocator.allocate()) DILexicalBlockAttrStorage(std::move(scope), std::move(file), std::move(line), std::move(column)); + } + + DIScopeAttr scope; + DIFileAttr file; + unsigned line; + unsigned column; +}; +} // namespace detail +DILexicalBlockAttr DILexicalBlockAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) { + return Base::get(context, std::move(scope), std::move(file), std::move(line), std::move(column)); +} + +DILexicalBlockAttr DILexicalBlockAttr::get(DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) { + return Base::get(scope.getContext(), scope, file, line, column); +} + +::mlir::Attribute DILexicalBlockAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_scope; + ::mlir::FailureOr _result_file; + ::mlir::FailureOr _result_line; + ::mlir::FailureOr _result_column; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_scope = false; + bool _seen_file = false; + bool _seen_line = false; + bool _seen_column = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_scope && _paramKey == "scope") { + _seen_scope = true; + + // Parse variable 'scope' + _result_scope = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scope)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'scope' which is to be a `DIScopeAttr`"); + return {}; + } + } else if (!_seen_file && _paramKey == "file") { + _seen_file = true; + + // Parse variable 'file' + _result_file = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_file)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'file' which is to be a `DIFileAttr`"); + return {}; + } + } else if (!_seen_line && _paramKey == "line") { + _seen_line = true; + + // Parse variable 'line' + _result_line = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_line)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'line' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_column && _paramKey == "column") { + _seen_column = true; + + // Parse variable 'column' + _result_column = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_column)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'column' which is to be a `unsigned`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_scope) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_scope)); + return DILexicalBlockAttr::get(odsParser.getContext(), + DIScopeAttr((*_result_scope)), + DIFileAttr((_result_file.value_or(DIFileAttr()))), + unsigned((_result_line.value_or(unsigned()))), + unsigned((_result_column.value_or(unsigned())))); +} + +void DILexicalBlockAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scope = "; + odsPrinter.printStrippedAttrOrType(getScope()); + if (!(getFile() == DIFileAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "file = "; + if (!(getFile() == DIFileAttr())) { + odsPrinter.printStrippedAttrOrType(getFile()); + } + } + if (!(getLine() == unsigned())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "line = "; + if (!(getLine() == unsigned())) { + odsPrinter.printStrippedAttrOrType(getLine()); + } + } + if (!(getColumn() == unsigned())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "column = "; + if (!(getColumn() == unsigned())) { + odsPrinter.printStrippedAttrOrType(getColumn()); + } + } + } + odsPrinter << ">"; +} + +DIScopeAttr DILexicalBlockAttr::getScope() const { + return getImpl()->scope; +} + +DIFileAttr DILexicalBlockAttr::getFile() const { + return getImpl()->file; +} + +unsigned DILexicalBlockAttr::getLine() const { + return getImpl()->line; +} + +unsigned DILexicalBlockAttr::getColumn() const { + return getImpl()->column; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DILexicalBlockFileAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DILexicalBlockFileAttrStorage(DIScopeAttr scope, DIFileAttr file, unsigned discriminator) : scope(std::move(scope)), file(std::move(file)), discriminator(std::move(discriminator)) {} + + KeyTy getAsKey() const { + return KeyTy(scope, file, discriminator); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (scope == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (discriminator == std::get<2>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); + } + + static DILexicalBlockFileAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto scope = std::move(std::get<0>(tblgenKey)); + auto file = std::move(std::get<1>(tblgenKey)); + auto discriminator = std::move(std::get<2>(tblgenKey)); + return new (allocator.allocate()) DILexicalBlockFileAttrStorage(std::move(scope), std::move(file), std::move(discriminator)); + } + + DIScopeAttr scope; + DIFileAttr file; + unsigned discriminator; +}; +} // namespace detail +DILexicalBlockFileAttr DILexicalBlockFileAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned discriminator) { + return Base::get(context, std::move(scope), std::move(file), std::move(discriminator)); +} + +DILexicalBlockFileAttr DILexicalBlockFileAttr::get(DIScopeAttr scope, DIFileAttr file, unsigned discriminator) { + return Base::get(scope.getContext(), scope, file, discriminator); +} + +::mlir::Attribute DILexicalBlockFileAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_scope; + ::mlir::FailureOr _result_file; + ::mlir::FailureOr _result_discriminator; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_scope = false; + bool _seen_file = false; + bool _seen_discriminator = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_scope && _paramKey == "scope") { + _seen_scope = true; + + // Parse variable 'scope' + _result_scope = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scope)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'scope' which is to be a `DIScopeAttr`"); + return {}; + } + } else if (!_seen_file && _paramKey == "file") { + _seen_file = true; + + // Parse variable 'file' + _result_file = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_file)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'file' which is to be a `DIFileAttr`"); + return {}; + } + } else if (!_seen_discriminator && _paramKey == "discriminator") { + _seen_discriminator = true; + + // Parse variable 'discriminator' + _result_discriminator = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_discriminator)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'discriminator' which is to be a `unsigned`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_scope) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; + return {}; + } + if (!_seen_discriminator) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "discriminator"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_scope)); + assert(::mlir::succeeded(_result_discriminator)); + return DILexicalBlockFileAttr::get(odsParser.getContext(), + DIScopeAttr((*_result_scope)), + DIFileAttr((_result_file.value_or(DIFileAttr()))), + unsigned((*_result_discriminator))); +} + +void DILexicalBlockFileAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scope = "; + odsPrinter.printStrippedAttrOrType(getScope()); + if (!(getFile() == DIFileAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "file = "; + if (!(getFile() == DIFileAttr())) { + odsPrinter.printStrippedAttrOrType(getFile()); + } + } + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "discriminator = "; + odsPrinter.printStrippedAttrOrType(getDiscriminator()); + } + odsPrinter << ">"; +} + +DIScopeAttr DILexicalBlockFileAttr::getScope() const { + return getImpl()->scope; +} + +DIFileAttr DILexicalBlockFileAttr::getFile() const { + return getImpl()->file; +} + +unsigned DILexicalBlockFileAttr::getDiscriminator() const { + return getImpl()->discriminator; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockFileAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DILocalVariableAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DILocalVariableAttrStorage(DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type) : scope(std::move(scope)), name(std::move(name)), file(std::move(file)), line(std::move(line)), arg(std::move(arg)), alignInBits(std::move(alignInBits)), type(std::move(type)) {} + + KeyTy getAsKey() const { + return KeyTy(scope, name, file, line, arg, alignInBits, type); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (scope == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (file == std::get<2>(tblgenKey)) && (line == std::get<3>(tblgenKey)) && (arg == std::get<4>(tblgenKey)) && (alignInBits == std::get<5>(tblgenKey)) && (type == std::get<6>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); + } + + static DILocalVariableAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto scope = std::move(std::get<0>(tblgenKey)); + auto name = std::move(std::get<1>(tblgenKey)); + auto file = std::move(std::get<2>(tblgenKey)); + auto line = std::move(std::get<3>(tblgenKey)); + auto arg = std::move(std::get<4>(tblgenKey)); + auto alignInBits = std::move(std::get<5>(tblgenKey)); + auto type = std::move(std::get<6>(tblgenKey)); + return new (allocator.allocate()) DILocalVariableAttrStorage(std::move(scope), std::move(name), std::move(file), std::move(line), std::move(arg), std::move(alignInBits), std::move(type)); + } + + DIScopeAttr scope; + StringAttr name; + DIFileAttr file; + unsigned line; + unsigned arg; + unsigned alignInBits; + DITypeAttr type; +}; +} // namespace detail +DILocalVariableAttr DILocalVariableAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type) { + return Base::get(context, std::move(scope), std::move(name), std::move(file), std::move(line), std::move(arg), std::move(alignInBits), std::move(type)); +} + +DILocalVariableAttr DILocalVariableAttr::get(DIScopeAttr scope, StringRef name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type) { + MLIRContext *ctx = scope.getContext(); + return Base::get(ctx, scope, StringAttr::get(ctx, name), file, line, + arg, alignInBits, type); +} + +::mlir::Attribute DILocalVariableAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_scope; + ::mlir::FailureOr _result_name; + ::mlir::FailureOr _result_file; + ::mlir::FailureOr _result_line; + ::mlir::FailureOr _result_arg; + ::mlir::FailureOr _result_alignInBits; + ::mlir::FailureOr _result_type; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_scope = false; + bool _seen_name = false; + bool _seen_file = false; + bool _seen_line = false; + bool _seen_arg = false; + bool _seen_alignInBits = false; + bool _seen_type = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_scope && _paramKey == "scope") { + _seen_scope = true; + + // Parse variable 'scope' + _result_scope = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scope)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'scope' which is to be a `DIScopeAttr`"); + return {}; + } + } else if (!_seen_name && _paramKey == "name") { + _seen_name = true; + + // Parse variable 'name' + _result_name = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_name)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'name' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_file && _paramKey == "file") { + _seen_file = true; + + // Parse variable 'file' + _result_file = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_file)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'file' which is to be a `DIFileAttr`"); + return {}; + } + } else if (!_seen_line && _paramKey == "line") { + _seen_line = true; + + // Parse variable 'line' + _result_line = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_line)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'line' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_arg && _paramKey == "arg") { + _seen_arg = true; + + // Parse variable 'arg' + _result_arg = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_arg)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'arg' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_alignInBits && _paramKey == "alignInBits") { + _seen_alignInBits = true; + + // Parse variable 'alignInBits' + _result_alignInBits = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_alignInBits)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'alignInBits' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_type && _paramKey == "type") { + _seen_type = true; + + // Parse variable 'type' + _result_type = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_type)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'type' which is to be a `DITypeAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_scope) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_scope)); + return DILocalVariableAttr::get(odsParser.getContext(), + DIScopeAttr((*_result_scope)), + StringAttr((_result_name.value_or(StringAttr()))), + DIFileAttr((_result_file.value_or(DIFileAttr()))), + unsigned((_result_line.value_or(unsigned()))), + unsigned((_result_arg.value_or(unsigned()))), + unsigned((_result_alignInBits.value_or(unsigned()))), + DITypeAttr((_result_type.value_or(DITypeAttr())))); +} + +void DILocalVariableAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scope = "; + odsPrinter.printStrippedAttrOrType(getScope()); + if (!(getName() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "name = "; + if (!(getName() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getName()); + } + } + if (!(getFile() == DIFileAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "file = "; + if (!(getFile() == DIFileAttr())) { + odsPrinter.printStrippedAttrOrType(getFile()); + } + } + if (!(getLine() == unsigned())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "line = "; + if (!(getLine() == unsigned())) { + odsPrinter.printStrippedAttrOrType(getLine()); + } + } + if (!(getArg() == unsigned())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "arg = "; + if (!(getArg() == unsigned())) { + odsPrinter.printStrippedAttrOrType(getArg()); + } + } + if (!(getAlignInBits() == unsigned())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "alignInBits = "; + if (!(getAlignInBits() == unsigned())) { + odsPrinter.printStrippedAttrOrType(getAlignInBits()); + } + } + if (!(getType() == DITypeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "type = "; + if (!(getType() == DITypeAttr())) { + odsPrinter.printStrippedAttrOrType(getType()); + } + } + } + odsPrinter << ">"; +} + +DIScopeAttr DILocalVariableAttr::getScope() const { + return getImpl()->scope; +} + +StringAttr DILocalVariableAttr::getName() const { + return getImpl()->name; +} + +DIFileAttr DILocalVariableAttr::getFile() const { + return getImpl()->file; +} + +unsigned DILocalVariableAttr::getLine() const { + return getImpl()->line; +} + +unsigned DILocalVariableAttr::getArg() const { + return getImpl()->arg; +} + +unsigned DILocalVariableAttr::getAlignInBits() const { + return getImpl()->alignInBits; +} + +DITypeAttr DILocalVariableAttr::getType() const { + return getImpl()->type; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILocalVariableAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DIModuleAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DIModuleAttrStorage(DIFileAttr file, DIScopeAttr scope, StringAttr name, StringAttr configMacros, StringAttr includePath, StringAttr apinotes, unsigned line, bool isDecl) : file(std::move(file)), scope(std::move(scope)), name(std::move(name)), configMacros(std::move(configMacros)), includePath(std::move(includePath)), apinotes(std::move(apinotes)), line(std::move(line)), isDecl(std::move(isDecl)) {} + + KeyTy getAsKey() const { + return KeyTy(file, scope, name, configMacros, includePath, apinotes, line, isDecl); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (file == std::get<0>(tblgenKey)) && (scope == std::get<1>(tblgenKey)) && (name == std::get<2>(tblgenKey)) && (configMacros == std::get<3>(tblgenKey)) && (includePath == std::get<4>(tblgenKey)) && (apinotes == std::get<5>(tblgenKey)) && (line == std::get<6>(tblgenKey)) && (isDecl == std::get<7>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey)); + } + + static DIModuleAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto file = std::move(std::get<0>(tblgenKey)); + auto scope = std::move(std::get<1>(tblgenKey)); + auto name = std::move(std::get<2>(tblgenKey)); + auto configMacros = std::move(std::get<3>(tblgenKey)); + auto includePath = std::move(std::get<4>(tblgenKey)); + auto apinotes = std::move(std::get<5>(tblgenKey)); + auto line = std::move(std::get<6>(tblgenKey)); + auto isDecl = std::move(std::get<7>(tblgenKey)); + return new (allocator.allocate()) DIModuleAttrStorage(std::move(file), std::move(scope), std::move(name), std::move(configMacros), std::move(includePath), std::move(apinotes), std::move(line), std::move(isDecl)); + } + + DIFileAttr file; + DIScopeAttr scope; + StringAttr name; + StringAttr configMacros; + StringAttr includePath; + StringAttr apinotes; + unsigned line; + bool isDecl; +}; +} // namespace detail +DIModuleAttr DIModuleAttr::get(::mlir::MLIRContext *context, DIFileAttr file, DIScopeAttr scope, StringAttr name, StringAttr configMacros, StringAttr includePath, StringAttr apinotes, unsigned line, bool isDecl) { + return Base::get(context, std::move(file), std::move(scope), std::move(name), std::move(configMacros), std::move(includePath), std::move(apinotes), std::move(line), std::move(isDecl)); +} + +::mlir::Attribute DIModuleAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_file; + ::mlir::FailureOr _result_scope; + ::mlir::FailureOr _result_name; + ::mlir::FailureOr _result_configMacros; + ::mlir::FailureOr _result_includePath; + ::mlir::FailureOr _result_apinotes; + ::mlir::FailureOr _result_line; + ::mlir::FailureOr _result_isDecl; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_file = false; + bool _seen_scope = false; + bool _seen_name = false; + bool _seen_configMacros = false; + bool _seen_includePath = false; + bool _seen_apinotes = false; + bool _seen_line = false; + bool _seen_isDecl = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_file && _paramKey == "file") { + _seen_file = true; + + // Parse variable 'file' + _result_file = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_file)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'file' which is to be a `DIFileAttr`"); + return {}; + } + } else if (!_seen_scope && _paramKey == "scope") { + _seen_scope = true; + + // Parse variable 'scope' + _result_scope = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scope)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'scope' which is to be a `DIScopeAttr`"); + return {}; + } + } else if (!_seen_name && _paramKey == "name") { + _seen_name = true; + + // Parse variable 'name' + _result_name = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_name)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'name' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_configMacros && _paramKey == "configMacros") { + _seen_configMacros = true; + + // Parse variable 'configMacros' + _result_configMacros = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_configMacros)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'configMacros' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_includePath && _paramKey == "includePath") { + _seen_includePath = true; + + // Parse variable 'includePath' + _result_includePath = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_includePath)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'includePath' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_apinotes && _paramKey == "apinotes") { + _seen_apinotes = true; + + // Parse variable 'apinotes' + _result_apinotes = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_apinotes)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'apinotes' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_line && _paramKey == "line") { + _seen_line = true; + + // Parse variable 'line' + _result_line = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_line)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'line' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_isDecl && _paramKey == "isDecl") { + _seen_isDecl = true; + + // Parse variable 'isDecl' + _result_isDecl = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_isDecl)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'isDecl' which is to be a `bool`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return DIModuleAttr::get(odsParser.getContext(), + DIFileAttr((_result_file.value_or(DIFileAttr()))), + DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), + StringAttr((_result_name.value_or(StringAttr()))), + StringAttr((_result_configMacros.value_or(StringAttr()))), + StringAttr((_result_includePath.value_or(StringAttr()))), + StringAttr((_result_apinotes.value_or(StringAttr()))), + unsigned((_result_line.value_or(unsigned()))), + bool((_result_isDecl.value_or(bool())))); +} + +void DIModuleAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getFile() == DIFileAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "file = "; + if (!(getFile() == DIFileAttr())) { + odsPrinter.printStrippedAttrOrType(getFile()); + } + } + if (!(getScope() == DIScopeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scope = "; + if (!(getScope() == DIScopeAttr())) { + odsPrinter.printStrippedAttrOrType(getScope()); + } + } + if (!(getName() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "name = "; + if (!(getName() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getName()); + } + } + if (!(getConfigMacros() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "configMacros = "; + if (!(getConfigMacros() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getConfigMacros()); + } + } + if (!(getIncludePath() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "includePath = "; + if (!(getIncludePath() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getIncludePath()); + } + } + if (!(getApinotes() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "apinotes = "; + if (!(getApinotes() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getApinotes()); + } + } + if (!(getLine() == unsigned())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "line = "; + if (!(getLine() == unsigned())) { + odsPrinter.printStrippedAttrOrType(getLine()); + } + } + if (!(getIsDecl() == bool())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "isDecl = "; + if (!(getIsDecl() == bool())) { + odsPrinter.printStrippedAttrOrType(getIsDecl()); + } + } + } + odsPrinter << ">"; +} + +DIFileAttr DIModuleAttr::getFile() const { + return getImpl()->file; +} + +DIScopeAttr DIModuleAttr::getScope() const { + return getImpl()->scope; +} + +StringAttr DIModuleAttr::getName() const { + return getImpl()->name; +} + +StringAttr DIModuleAttr::getConfigMacros() const { + return getImpl()->configMacros; +} + +StringAttr DIModuleAttr::getIncludePath() const { + return getImpl()->includePath; +} + +StringAttr DIModuleAttr::getApinotes() const { + return getImpl()->apinotes; +} + +unsigned DIModuleAttr::getLine() const { + return getImpl()->line; +} + +bool DIModuleAttr::getIsDecl() const { + return getImpl()->isDecl; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIModuleAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DINamespaceAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DINamespaceAttrStorage(StringAttr name, DIScopeAttr scope, bool exportSymbols) : name(std::move(name)), scope(std::move(scope)), exportSymbols(std::move(exportSymbols)) {} + + KeyTy getAsKey() const { + return KeyTy(name, scope, exportSymbols); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (name == std::get<0>(tblgenKey)) && (scope == std::get<1>(tblgenKey)) && (exportSymbols == std::get<2>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); + } + + static DINamespaceAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto name = std::move(std::get<0>(tblgenKey)); + auto scope = std::move(std::get<1>(tblgenKey)); + auto exportSymbols = std::move(std::get<2>(tblgenKey)); + return new (allocator.allocate()) DINamespaceAttrStorage(std::move(name), std::move(scope), std::move(exportSymbols)); + } + + StringAttr name; + DIScopeAttr scope; + bool exportSymbols; +}; +} // namespace detail +DINamespaceAttr DINamespaceAttr::get(::mlir::MLIRContext *context, StringAttr name, DIScopeAttr scope, bool exportSymbols) { + return Base::get(context, std::move(name), std::move(scope), std::move(exportSymbols)); +} + +::mlir::Attribute DINamespaceAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_name; + ::mlir::FailureOr _result_scope; + ::mlir::FailureOr _result_exportSymbols; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_name = false; + bool _seen_scope = false; + bool _seen_exportSymbols = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_name && _paramKey == "name") { + _seen_name = true; + + // Parse variable 'name' + _result_name = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_name)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DINamespaceAttr parameter 'name' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_scope && _paramKey == "scope") { + _seen_scope = true; + + // Parse variable 'scope' + _result_scope = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scope)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DINamespaceAttr parameter 'scope' which is to be a `DIScopeAttr`"); + return {}; + } + } else if (!_seen_exportSymbols && _paramKey == "exportSymbols") { + _seen_exportSymbols = true; + + // Parse variable 'exportSymbols' + _result_exportSymbols = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_exportSymbols)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DINamespaceAttr parameter 'exportSymbols' which is to be a `bool`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_exportSymbols) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "exportSymbols"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_exportSymbols)); + return DINamespaceAttr::get(odsParser.getContext(), + StringAttr((_result_name.value_or(StringAttr()))), + DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), + bool((*_result_exportSymbols))); +} + +void DINamespaceAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getName() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "name = "; + if (!(getName() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getName()); + } + } + if (!(getScope() == DIScopeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scope = "; + if (!(getScope() == DIScopeAttr())) { + odsPrinter.printStrippedAttrOrType(getScope()); + } + } + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "exportSymbols = "; + odsPrinter.printStrippedAttrOrType(getExportSymbols()); + } + odsPrinter << ">"; +} + +StringAttr DINamespaceAttr::getName() const { + return getImpl()->name; +} + +DIScopeAttr DINamespaceAttr::getScope() const { + return getImpl()->scope; +} + +bool DINamespaceAttr::getExportSymbols() const { + return getImpl()->exportSymbols; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DINamespaceAttr) +namespace mlir { +namespace LLVM { +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DINullTypeAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DISubprogramAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DISubprogramAttrStorage(DICompileUnitAttr compileUnit, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type) : compileUnit(std::move(compileUnit)), scope(std::move(scope)), name(std::move(name)), linkageName(std::move(linkageName)), file(std::move(file)), line(std::move(line)), scopeLine(std::move(scopeLine)), subprogramFlags(std::move(subprogramFlags)), type(std::move(type)) {} + + KeyTy getAsKey() const { + return KeyTy(compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (compileUnit == std::get<0>(tblgenKey)) && (scope == std::get<1>(tblgenKey)) && (name == std::get<2>(tblgenKey)) && (linkageName == std::get<3>(tblgenKey)) && (file == std::get<4>(tblgenKey)) && (line == std::get<5>(tblgenKey)) && (scopeLine == std::get<6>(tblgenKey)) && (subprogramFlags == std::get<7>(tblgenKey)) && (type == std::get<8>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey)); + } + + static DISubprogramAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto compileUnit = std::move(std::get<0>(tblgenKey)); + auto scope = std::move(std::get<1>(tblgenKey)); + auto name = std::move(std::get<2>(tblgenKey)); + auto linkageName = std::move(std::get<3>(tblgenKey)); + auto file = std::move(std::get<4>(tblgenKey)); + auto line = std::move(std::get<5>(tblgenKey)); + auto scopeLine = std::move(std::get<6>(tblgenKey)); + auto subprogramFlags = std::move(std::get<7>(tblgenKey)); + auto type = std::move(std::get<8>(tblgenKey)); + return new (allocator.allocate()) DISubprogramAttrStorage(std::move(compileUnit), std::move(scope), std::move(name), std::move(linkageName), std::move(file), std::move(line), std::move(scopeLine), std::move(subprogramFlags), std::move(type)); + } + + DICompileUnitAttr compileUnit; + DIScopeAttr scope; + StringAttr name; + StringAttr linkageName; + DIFileAttr file; + unsigned line; + unsigned scopeLine; + DISubprogramFlags subprogramFlags; + DISubroutineTypeAttr type; +}; +} // namespace detail +DISubprogramAttr DISubprogramAttr::get(::mlir::MLIRContext *context, DICompileUnitAttr compileUnit, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type) { + return Base::get(context, std::move(compileUnit), std::move(scope), std::move(name), std::move(linkageName), std::move(file), std::move(line), std::move(scopeLine), std::move(subprogramFlags), std::move(type)); +} + +DISubprogramAttr DISubprogramAttr::get(DICompileUnitAttr compileUnit, DIScopeAttr scope, StringRef name, StringRef linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type) { + MLIRContext *ctx = file.getContext(); + return Base::get(ctx, compileUnit, scope, StringAttr::get(ctx, name), + StringAttr::get(ctx, linkageName), file, line, + scopeLine, subprogramFlags, type); +} + +::mlir::Attribute DISubprogramAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_compileUnit; + ::mlir::FailureOr _result_scope; + ::mlir::FailureOr _result_name; + ::mlir::FailureOr _result_linkageName; + ::mlir::FailureOr _result_file; + ::mlir::FailureOr _result_line; + ::mlir::FailureOr _result_scopeLine; + ::mlir::FailureOr _result_subprogramFlags; + ::mlir::FailureOr _result_type; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_compileUnit = false; + bool _seen_scope = false; + bool _seen_name = false; + bool _seen_linkageName = false; + bool _seen_file = false; + bool _seen_line = false; + bool _seen_scopeLine = false; + bool _seen_subprogramFlags = false; + bool _seen_type = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_compileUnit && _paramKey == "compileUnit") { + _seen_compileUnit = true; + + // Parse variable 'compileUnit' + _result_compileUnit = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_compileUnit)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'compileUnit' which is to be a `DICompileUnitAttr`"); + return {}; + } + } else if (!_seen_scope && _paramKey == "scope") { + _seen_scope = true; + + // Parse variable 'scope' + _result_scope = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scope)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'scope' which is to be a `DIScopeAttr`"); + return {}; + } + } else if (!_seen_name && _paramKey == "name") { + _seen_name = true; + + // Parse variable 'name' + _result_name = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_name)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'name' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_linkageName && _paramKey == "linkageName") { + _seen_linkageName = true; + + // Parse variable 'linkageName' + _result_linkageName = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_linkageName)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'linkageName' which is to be a `StringAttr`"); + return {}; + } + } else if (!_seen_file && _paramKey == "file") { + _seen_file = true; + + // Parse variable 'file' + _result_file = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_file)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'file' which is to be a `DIFileAttr`"); + return {}; + } + } else if (!_seen_line && _paramKey == "line") { + _seen_line = true; + + // Parse variable 'line' + _result_line = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_line)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'line' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_scopeLine && _paramKey == "scopeLine") { + _seen_scopeLine = true; + + // Parse variable 'scopeLine' + _result_scopeLine = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scopeLine)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'scopeLine' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_subprogramFlags && _paramKey == "subprogramFlags") { + _seen_subprogramFlags = true; + + // Parse variable 'subprogramFlags' + _result_subprogramFlags = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_subprogramFlags)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'subprogramFlags' which is to be a `DISubprogramFlags`"); + return {}; + } + } else if (!_seen_type && _paramKey == "type") { + _seen_type = true; + + // Parse variable 'type' + _result_type = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_type)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'type' which is to be a `DISubroutineTypeAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_scope) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; + return {}; + } + if (!_seen_file) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "file"; + return {}; + } + if (!_seen_subprogramFlags) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "subprogramFlags"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_scope)); + assert(::mlir::succeeded(_result_file)); + assert(::mlir::succeeded(_result_subprogramFlags)); + return DISubprogramAttr::get(odsParser.getContext(), + DICompileUnitAttr((_result_compileUnit.value_or(DICompileUnitAttr()))), + DIScopeAttr((*_result_scope)), + StringAttr((_result_name.value_or(StringAttr()))), + StringAttr((_result_linkageName.value_or(StringAttr()))), + DIFileAttr((*_result_file)), + unsigned((_result_line.value_or(unsigned()))), + unsigned((_result_scopeLine.value_or(unsigned()))), + DISubprogramFlags((*_result_subprogramFlags)), + DISubroutineTypeAttr((_result_type.value_or(DISubroutineTypeAttr())))); +} + +void DISubprogramAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getCompileUnit() == DICompileUnitAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "compileUnit = "; + if (!(getCompileUnit() == DICompileUnitAttr())) { + odsPrinter.printStrippedAttrOrType(getCompileUnit()); + } + } + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scope = "; + odsPrinter.printStrippedAttrOrType(getScope()); + if (!(getName() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "name = "; + if (!(getName() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getName()); + } + } + if (!(getLinkageName() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "linkageName = "; + if (!(getLinkageName() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getLinkageName()); + } + } + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "file = "; + odsPrinter.printStrippedAttrOrType(getFile()); + if (!(getLine() == unsigned())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "line = "; + if (!(getLine() == unsigned())) { + odsPrinter.printStrippedAttrOrType(getLine()); + } + } + if (!(getScopeLine() == unsigned())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scopeLine = "; + if (!(getScopeLine() == unsigned())) { + odsPrinter.printStrippedAttrOrType(getScopeLine()); + } + } + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "subprogramFlags = "; + odsPrinter.printStrippedAttrOrType(getSubprogramFlags()); + if (!(getType() == DISubroutineTypeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "type = "; + if (!(getType() == DISubroutineTypeAttr())) { + odsPrinter.printStrippedAttrOrType(getType()); + } + } + } + odsPrinter << ">"; +} + +DICompileUnitAttr DISubprogramAttr::getCompileUnit() const { + return getImpl()->compileUnit; +} + +DIScopeAttr DISubprogramAttr::getScope() const { + return getImpl()->scope; +} + +StringAttr DISubprogramAttr::getName() const { + return getImpl()->name; +} + +StringAttr DISubprogramAttr::getLinkageName() const { + return getImpl()->linkageName; +} + +DIFileAttr DISubprogramAttr::getFile() const { + return getImpl()->file; +} + +unsigned DISubprogramAttr::getLine() const { + return getImpl()->line; +} + +unsigned DISubprogramAttr::getScopeLine() const { + return getImpl()->scopeLine; +} + +DISubprogramFlags DISubprogramAttr::getSubprogramFlags() const { + return getImpl()->subprogramFlags; +} + +DISubroutineTypeAttr DISubprogramAttr::getType() const { + return getImpl()->type; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubprogramAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DISubrangeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DISubrangeAttrStorage(IntegerAttr count, IntegerAttr lowerBound, IntegerAttr upperBound, IntegerAttr stride) : count(std::move(count)), lowerBound(std::move(lowerBound)), upperBound(std::move(upperBound)), stride(std::move(stride)) {} + + KeyTy getAsKey() const { + return KeyTy(count, lowerBound, upperBound, stride); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (count == std::get<0>(tblgenKey)) && (lowerBound == std::get<1>(tblgenKey)) && (upperBound == std::get<2>(tblgenKey)) && (stride == std::get<3>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); + } + + static DISubrangeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto count = std::move(std::get<0>(tblgenKey)); + auto lowerBound = std::move(std::get<1>(tblgenKey)); + auto upperBound = std::move(std::get<2>(tblgenKey)); + auto stride = std::move(std::get<3>(tblgenKey)); + return new (allocator.allocate()) DISubrangeAttrStorage(std::move(count), std::move(lowerBound), std::move(upperBound), std::move(stride)); + } + + IntegerAttr count; + IntegerAttr lowerBound; + IntegerAttr upperBound; + IntegerAttr stride; +}; +} // namespace detail +DISubrangeAttr DISubrangeAttr::get(::mlir::MLIRContext *context, IntegerAttr count, IntegerAttr lowerBound, IntegerAttr upperBound, IntegerAttr stride) { + return Base::get(context, std::move(count), std::move(lowerBound), std::move(upperBound), std::move(stride)); +} + +::mlir::Attribute DISubrangeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_count; + ::mlir::FailureOr _result_lowerBound; + ::mlir::FailureOr _result_upperBound; + ::mlir::FailureOr _result_stride; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_count = false; + bool _seen_lowerBound = false; + bool _seen_upperBound = false; + bool _seen_stride = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_count && _paramKey == "count") { + _seen_count = true; + + // Parse variable 'count' + _result_count = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_count)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'count' which is to be a `IntegerAttr`"); + return {}; + } + } else if (!_seen_lowerBound && _paramKey == "lowerBound") { + _seen_lowerBound = true; + + // Parse variable 'lowerBound' + _result_lowerBound = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_lowerBound)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'lowerBound' which is to be a `IntegerAttr`"); + return {}; + } + } else if (!_seen_upperBound && _paramKey == "upperBound") { + _seen_upperBound = true; + + // Parse variable 'upperBound' + _result_upperBound = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_upperBound)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'upperBound' which is to be a `IntegerAttr`"); + return {}; + } + } else if (!_seen_stride && _paramKey == "stride") { + _seen_stride = true; + + // Parse variable 'stride' + _result_stride = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_stride)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'stride' which is to be a `IntegerAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return DISubrangeAttr::get(odsParser.getContext(), + IntegerAttr((_result_count.value_or(IntegerAttr()))), + IntegerAttr((_result_lowerBound.value_or(IntegerAttr()))), + IntegerAttr((_result_upperBound.value_or(IntegerAttr()))), + IntegerAttr((_result_stride.value_or(IntegerAttr())))); +} + +void DISubrangeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getCount() == IntegerAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "count = "; + if (!(getCount() == IntegerAttr())) { + odsPrinter.printStrippedAttrOrType(getCount()); + } + } + if (!(getLowerBound() == IntegerAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "lowerBound = "; + if (!(getLowerBound() == IntegerAttr())) { + odsPrinter.printStrippedAttrOrType(getLowerBound()); + } + } + if (!(getUpperBound() == IntegerAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "upperBound = "; + if (!(getUpperBound() == IntegerAttr())) { + odsPrinter.printStrippedAttrOrType(getUpperBound()); + } + } + if (!(getStride() == IntegerAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "stride = "; + if (!(getStride() == IntegerAttr())) { + odsPrinter.printStrippedAttrOrType(getStride()); + } + } + } + odsPrinter << ">"; +} + +IntegerAttr DISubrangeAttr::getCount() const { + return getImpl()->count; +} + +IntegerAttr DISubrangeAttr::getLowerBound() const { + return getImpl()->lowerBound; +} + +IntegerAttr DISubrangeAttr::getUpperBound() const { + return getImpl()->upperBound; +} + +IntegerAttr DISubrangeAttr::getStride() const { + return getImpl()->stride; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubrangeAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct DISubroutineTypeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple>; + DISubroutineTypeAttrStorage(unsigned callingConvention, ::llvm::ArrayRef types) : callingConvention(std::move(callingConvention)), types(std::move(types)) {} + + KeyTy getAsKey() const { + return KeyTy(callingConvention, types); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (callingConvention == std::get<0>(tblgenKey)) && (::llvm::ArrayRef(types) == ::llvm::ArrayRef(std::get<1>(tblgenKey))); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static DISubroutineTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto callingConvention = std::move(std::get<0>(tblgenKey)); + auto types = std::move(std::get<1>(tblgenKey)); + types = allocator.copyInto(types); + return new (allocator.allocate()) DISubroutineTypeAttrStorage(std::move(callingConvention), std::move(types)); + } + + unsigned callingConvention; + ::llvm::ArrayRef types; +}; +} // namespace detail +DISubroutineTypeAttr DISubroutineTypeAttr::get(::mlir::MLIRContext *context, unsigned callingConvention, ::llvm::ArrayRef types) { + return Base::get(context, std::move(callingConvention), std::move(types)); +} + +DISubroutineTypeAttr DISubroutineTypeAttr::get(::mlir::MLIRContext *context, ArrayRef types) { + return Base::get(context, /*callingConvention=*/0, types); +} + +::mlir::Attribute DISubroutineTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_callingConvention; + ::mlir::FailureOr<::llvm::SmallVector> _result_types; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_callingConvention = false; + bool _seen_types = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_callingConvention && _paramKey == "callingConvention") { + _seen_callingConvention = true; + + // Parse variable 'callingConvention' + _result_callingConvention = [&]() -> FailureOr { + SMLoc tagLoc = odsParser.getCurrentLocation(); + StringRef name; + if (odsParser.parseKeyword(&name)) + return failure(); + + if (unsigned tag = llvm::dwarf::getCallingConvention(name)) + return tag; + return odsParser.emitError(tagLoc) + << "invalid debug info debug info calling convention name: " << name; + }() ; + if (::mlir::failed(_result_callingConvention)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubroutineTypeAttr parameter 'callingConvention' which is to be a `unsigned`"); + return {}; + } + } else if (!_seen_types && _paramKey == "types") { + _seen_types = true; + + // Parse variable 'types' + _result_types = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); + if (::mlir::failed(_result_types)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubroutineTypeAttr parameter 'types' which is to be a `::llvm::ArrayRef`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return DISubroutineTypeAttr::get(odsParser.getContext(), + unsigned((_result_callingConvention.value_or(0))), + ::llvm::ArrayRef((_result_types.value_or(::llvm::SmallVector())))); +} + +void DISubroutineTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getCallingConvention() == 0)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "callingConvention = "; + if (!(getCallingConvention() == 0)) { + odsPrinter << llvm::dwarf::ConventionString(getCallingConvention()); + } + } + if (!(::llvm::ArrayRef(getTypes()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "types = "; + if (!(::llvm::ArrayRef(getTypes()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { + odsPrinter.printStrippedAttrOrType(getTypes()); + } + } + } + odsPrinter << ">"; +} + +unsigned DISubroutineTypeAttr::getCallingConvention() const { + return getImpl()->callingConvention; +} + +::llvm::ArrayRef DISubroutineTypeAttr::getTypes() const { + return getImpl()->types; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubroutineTypeAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct FastmathFlagsAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::LLVM::FastmathFlags>; + FastmathFlagsAttrStorage(::mlir::LLVM::FastmathFlags value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static FastmathFlagsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) FastmathFlagsAttrStorage(std::move(value)); + } + + ::mlir::LLVM::FastmathFlags value; +}; +} // namespace detail +FastmathFlagsAttr FastmathFlagsAttr::get(::mlir::MLIRContext *context, ::mlir::LLVM::FastmathFlags value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute FastmathFlagsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::LLVM::FastmathFlags> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::LLVM::FastmathFlags> { + ::mlir::LLVM::FastmathFlags flags = {}; + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + do { + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::LLVM::symbolizeFastmathFlags(enumKeyword); + if (!maybeEnum) { + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::LLVM::FastmathFlags" << " to be one of: " << "none" << ", " << "nnan" << ", " << "ninf" << ", " << "nsz" << ", " << "arcp" << ", " << "contract" << ", " << "afn" << ", " << "reassoc" << ", " << "fast")}; + } + flags = flags | *maybeEnum; + } while(::mlir::succeeded(odsParser.parseOptionalComma())); + return flags; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_FastmathFlagsAttr parameter 'value' which is to be a `::mlir::LLVM::FastmathFlags`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return FastmathFlagsAttr::get(odsParser.getContext(), + ::mlir::LLVM::FastmathFlags((*_result_value))); +} + +void FastmathFlagsAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyFastmathFlags(getValue()); + odsPrinter << ">"; +} + +::mlir::LLVM::FastmathFlags FastmathFlagsAttr::getValue() const { + return getImpl()->value; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FastmathFlagsAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct MemoryEffectsAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + MemoryEffectsAttrStorage(ModRefInfo other, ModRefInfo argMem, ModRefInfo inaccessibleMem) : other(std::move(other)), argMem(std::move(argMem)), inaccessibleMem(std::move(inaccessibleMem)) {} + + KeyTy getAsKey() const { + return KeyTy(other, argMem, inaccessibleMem); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (other == std::get<0>(tblgenKey)) && (argMem == std::get<1>(tblgenKey)) && (inaccessibleMem == std::get<2>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); + } + + static MemoryEffectsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto other = std::move(std::get<0>(tblgenKey)); + auto argMem = std::move(std::get<1>(tblgenKey)); + auto inaccessibleMem = std::move(std::get<2>(tblgenKey)); + return new (allocator.allocate()) MemoryEffectsAttrStorage(std::move(other), std::move(argMem), std::move(inaccessibleMem)); + } + + ModRefInfo other; + ModRefInfo argMem; + ModRefInfo inaccessibleMem; +}; +} // namespace detail +MemoryEffectsAttr MemoryEffectsAttr::get(::mlir::MLIRContext *context, ModRefInfo other, ModRefInfo argMem, ModRefInfo inaccessibleMem) { + return Base::get(context, std::move(other), std::move(argMem), std::move(inaccessibleMem)); +} + +::mlir::Attribute MemoryEffectsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_other; + ::mlir::FailureOr _result_argMem; + ::mlir::FailureOr _result_inaccessibleMem; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_other = false; + bool _seen_argMem = false; + bool _seen_inaccessibleMem = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_other && _paramKey == "other") { + _seen_other = true; + + // Parse variable 'other' + _result_other = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_other)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'other' which is to be a `ModRefInfo`"); + return {}; + } + } else if (!_seen_argMem && _paramKey == "argMem") { + _seen_argMem = true; + + // Parse variable 'argMem' + _result_argMem = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_argMem)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'argMem' which is to be a `ModRefInfo`"); + return {}; + } + } else if (!_seen_inaccessibleMem && _paramKey == "inaccessibleMem") { + _seen_inaccessibleMem = true; + + // Parse variable 'inaccessibleMem' + _result_inaccessibleMem = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_inaccessibleMem)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'inaccessibleMem' which is to be a `ModRefInfo`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 3; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 3 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_other)); + assert(::mlir::succeeded(_result_argMem)); + assert(::mlir::succeeded(_result_inaccessibleMem)); + return MemoryEffectsAttr::get(odsParser.getContext(), + ModRefInfo((*_result_other)), + ModRefInfo((*_result_argMem)), + ModRefInfo((*_result_inaccessibleMem))); +} + +void MemoryEffectsAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "other = "; + odsPrinter.printStrippedAttrOrType(getOther()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "argMem = "; + odsPrinter.printStrippedAttrOrType(getArgMem()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "inaccessibleMem = "; + odsPrinter.printStrippedAttrOrType(getInaccessibleMem()); + } + odsPrinter << ">"; +} + +ModRefInfo MemoryEffectsAttr::getOther() const { + return getImpl()->other; +} + +ModRefInfo MemoryEffectsAttr::getArgMem() const { + return getImpl()->argMem; +} + +ModRefInfo MemoryEffectsAttr::getInaccessibleMem() const { + return getImpl()->inaccessibleMem; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemoryEffectsAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct TBAAMemberAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + TBAAMemberAttrStorage(TBAANodeAttr typeDesc, int64_t offset) : typeDesc(std::move(typeDesc)), offset(std::move(offset)) {} + + KeyTy getAsKey() const { + return KeyTy(typeDesc, offset); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (typeDesc == std::get<0>(tblgenKey)) && (offset == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static TBAAMemberAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto typeDesc = std::move(std::get<0>(tblgenKey)); + auto offset = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) TBAAMemberAttrStorage(std::move(typeDesc), std::move(offset)); + } + + TBAANodeAttr typeDesc; + int64_t offset; +}; +} // namespace detail +TBAAMemberAttr TBAAMemberAttr::get(::mlir::MLIRContext *context, TBAANodeAttr typeDesc, int64_t offset) { + return Base::get(context, std::move(typeDesc), std::move(offset)); +} + +TBAAMemberAttr TBAAMemberAttr::get(TBAANodeAttr typeDesc, int64_t offset) { + return Base::get(typeDesc.getContext(), typeDesc, offset); +} + +::mlir::Attribute TBAAMemberAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_typeDesc; + ::mlir::FailureOr _result_offset; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter list + + // Parse variable 'typeDesc' + _result_typeDesc = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_typeDesc)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAAMemberAttr parameter 'typeDesc' which is to be a `TBAANodeAttr`"); + return {}; + } + // Parse literal ',' + if (odsParser.parseComma()) return {}; + + // Parse variable 'offset' + _result_offset = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_offset)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAAMemberAttr parameter 'offset' which is to be a `int64_t`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_typeDesc)); + assert(::mlir::succeeded(_result_offset)); + return TBAAMemberAttr::get(odsParser.getContext(), + TBAANodeAttr((*_result_typeDesc)), + int64_t((*_result_offset))); +} + +void TBAAMemberAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter.printStrippedAttrOrType(getTypeDesc()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter.printStrippedAttrOrType(getOffset()); + } + odsPrinter << ">"; +} + +TBAANodeAttr TBAAMemberAttr::getTypeDesc() const { + return getImpl()->typeDesc; +} + +int64_t TBAAMemberAttr::getOffset() const { + return getImpl()->offset; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAAMemberAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct TBAARootAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + TBAARootAttrStorage(StringAttr id) : id(std::move(id)) {} + + KeyTy getAsKey() const { + return KeyTy(id); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (id == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static TBAARootAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto id = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) TBAARootAttrStorage(std::move(id)); + } + + StringAttr id; +}; +} // namespace detail +TBAARootAttr TBAARootAttr::get(::mlir::MLIRContext *context, StringAttr id) { + return Base::get(context, std::move(id)); +} + +::mlir::Attribute TBAARootAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_id; + // Parse literal '<' + if (odsParser.parseOptionalLess()) { + } else { + // Parse parameter struct + bool _seen_id = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_id && _paramKey == "id") { + _seen_id = true; + + // Parse variable 'id' + _result_id = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_id)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAARootAttr parameter 'id' which is to be a `StringAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + } + return TBAARootAttr::get(odsParser.getContext(), + StringAttr((_result_id.value_or(StringAttr())))); +} + +void TBAARootAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + if (!(getId() == StringAttr())) { + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getId() == StringAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "id = "; + if (!(getId() == StringAttr())) { + odsPrinter.printStrippedAttrOrType(getId()); + } + } + } + odsPrinter << ">"; + } else { + } +} + +StringAttr TBAARootAttr::getId() const { + return getImpl()->id; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAARootAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct TBAATagAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + TBAATagAttrStorage(TBAATypeDescriptorAttr base_type, TBAATypeDescriptorAttr access_type, int64_t offset, bool constant) : base_type(std::move(base_type)), access_type(std::move(access_type)), offset(std::move(offset)), constant(std::move(constant)) {} + + KeyTy getAsKey() const { + return KeyTy(base_type, access_type, offset, constant); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (base_type == std::get<0>(tblgenKey)) && (access_type == std::get<1>(tblgenKey)) && (offset == std::get<2>(tblgenKey)) && (constant == std::get<3>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); + } + + static TBAATagAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto base_type = std::move(std::get<0>(tblgenKey)); + auto access_type = std::move(std::get<1>(tblgenKey)); + auto offset = std::move(std::get<2>(tblgenKey)); + auto constant = std::move(std::get<3>(tblgenKey)); + return new (allocator.allocate()) TBAATagAttrStorage(std::move(base_type), std::move(access_type), std::move(offset), std::move(constant)); + } + + TBAATypeDescriptorAttr base_type; + TBAATypeDescriptorAttr access_type; + int64_t offset; + bool constant; +}; +} // namespace detail +TBAATagAttr TBAATagAttr::get(::mlir::MLIRContext *context, TBAATypeDescriptorAttr base_type, TBAATypeDescriptorAttr access_type, int64_t offset, bool constant) { + return Base::get(context, std::move(base_type), std::move(access_type), std::move(offset), std::move(constant)); +} + +TBAATagAttr TBAATagAttr::get(TBAATypeDescriptorAttr baseType, TBAATypeDescriptorAttr accessType, int64_t offset) { + return Base::get(baseType.getContext(), baseType, accessType, offset, + /*constant=*/false); +} + +::mlir::Attribute TBAATagAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_base_type; + ::mlir::FailureOr _result_access_type; + ::mlir::FailureOr _result_offset; + ::mlir::FailureOr _result_constant; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_base_type = false; + bool _seen_access_type = false; + bool _seen_offset = false; + bool _seen_constant = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_base_type && _paramKey == "base_type") { + _seen_base_type = true; + + // Parse variable 'base_type' + _result_base_type = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_base_type)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATagAttr parameter 'base_type' which is to be a `TBAATypeDescriptorAttr`"); + return {}; + } + } else if (!_seen_access_type && _paramKey == "access_type") { + _seen_access_type = true; + + // Parse variable 'access_type' + _result_access_type = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_access_type)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATagAttr parameter 'access_type' which is to be a `TBAATypeDescriptorAttr`"); + return {}; + } + } else if (!_seen_offset && _paramKey == "offset") { + _seen_offset = true; + + // Parse variable 'offset' + _result_offset = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_offset)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATagAttr parameter 'offset' which is to be a `int64_t`"); + return {}; + } + } else if (!_seen_constant && _paramKey == "constant") { + _seen_constant = true; + + // Parse variable 'constant' + _result_constant = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_constant)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATagAttr parameter 'constant' which is to be a `bool`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_base_type) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "base_type"; + return {}; + } + if (!_seen_access_type) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "access_type"; + return {}; + } + if (!_seen_offset) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "offset"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_base_type)); + assert(::mlir::succeeded(_result_access_type)); + assert(::mlir::succeeded(_result_offset)); + return TBAATagAttr::get(odsParser.getContext(), + TBAATypeDescriptorAttr((*_result_base_type)), + TBAATypeDescriptorAttr((*_result_access_type)), + int64_t((*_result_offset)), + bool((_result_constant.value_or(false)))); +} + +void TBAATagAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "base_type = "; + odsPrinter.printStrippedAttrOrType(getBaseType()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "access_type = "; + odsPrinter.printStrippedAttrOrType(getAccessType()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "offset = "; + odsPrinter.printStrippedAttrOrType(getOffset()); + if (!(getConstant() == false)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "constant = "; + if (!(getConstant() == false)) { + odsPrinter.printStrippedAttrOrType(getConstant()); + } + } + } + odsPrinter << ">"; +} + +TBAATypeDescriptorAttr TBAATagAttr::getBaseType() const { + return getImpl()->base_type; +} + +TBAATypeDescriptorAttr TBAATagAttr::getAccessType() const { + return getImpl()->access_type; +} + +int64_t TBAATagAttr::getOffset() const { + return getImpl()->offset; +} + +bool TBAATagAttr::getConstant() const { + return getImpl()->constant; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAATagAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct TBAATypeDescriptorAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::llvm::StringRef, ::llvm::ArrayRef>; + TBAATypeDescriptorAttrStorage(::llvm::StringRef id, ::llvm::ArrayRef members) : id(std::move(id)), members(std::move(members)) {} + + KeyTy getAsKey() const { + return KeyTy(id, members); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (id == std::get<0>(tblgenKey)) && (members == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static TBAATypeDescriptorAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto id = std::move(std::get<0>(tblgenKey)); + auto members = std::move(std::get<1>(tblgenKey)); + id = allocator.copyInto(id); + members = allocator.copyInto(members); + return new (allocator.allocate()) TBAATypeDescriptorAttrStorage(std::move(id), std::move(members)); + } + + ::llvm::StringRef id; + ::llvm::ArrayRef members; +}; +} // namespace detail +TBAATypeDescriptorAttr TBAATypeDescriptorAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef id, ::llvm::ArrayRef members) { + return Base::get(context, std::move(id), std::move(members)); +} + +::mlir::Attribute TBAATypeDescriptorAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_id; + ::mlir::FailureOr<::llvm::SmallVector> _result_members; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_id = false; + bool _seen_members = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_id && _paramKey == "id") { + _seen_id = true; + + // Parse variable 'id' + _result_id = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_id)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATypeDescriptorAttr parameter 'id' which is to be a `::llvm::StringRef`"); + return {}; + } + } else if (!_seen_members && _paramKey == "members") { + _seen_members = true; + + // Parse variable 'members' + _result_members = + [&]() -> FailureOr> { + using Result = SmallVector; + if (odsParser.parseLBrace()) + return failure(); + FailureOr result = FieldParser::parse(odsParser); + if (failed(result)) + return failure(); + if (odsParser.parseRBrace()) + return failure(); + return result; + }() + ; + if (::mlir::failed(_result_members)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATypeDescriptorAttr parameter 'members' which is to be a `::llvm::ArrayRef`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 2 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_id)); + assert(::mlir::succeeded(_result_members)); + return TBAATypeDescriptorAttr::get(odsParser.getContext(), + ::llvm::StringRef((*_result_id)), + ::llvm::ArrayRef((*_result_members))); +} + +void TBAATypeDescriptorAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "id = "; + odsPrinter.printString(getId());; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "members = "; + + odsPrinter << '{'; + llvm::interleaveComma(getMembers(), odsPrinter, [&](TBAAMemberAttr attr) { + odsPrinter.printStrippedAttrOrType(attr); + }); + odsPrinter << '}'; + ; + } + odsPrinter << ">"; +} + +::llvm::StringRef TBAATypeDescriptorAttr::getId() const { + return getImpl()->id; +} + +::llvm::ArrayRef TBAATypeDescriptorAttr::getMembers() const { + return getImpl()->members; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAATypeDescriptorAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct VScaleRangeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + VScaleRangeAttrStorage(IntegerAttr minRange, IntegerAttr maxRange) : minRange(std::move(minRange)), maxRange(std::move(maxRange)) {} + + KeyTy getAsKey() const { + return KeyTy(minRange, maxRange); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (minRange == std::get<0>(tblgenKey)) && (maxRange == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static VScaleRangeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto minRange = std::move(std::get<0>(tblgenKey)); + auto maxRange = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) VScaleRangeAttrStorage(std::move(minRange), std::move(maxRange)); + } + + IntegerAttr minRange; + IntegerAttr maxRange; +}; +} // namespace detail +VScaleRangeAttr VScaleRangeAttr::get(::mlir::MLIRContext *context, IntegerAttr minRange, IntegerAttr maxRange) { + return Base::get(context, std::move(minRange), std::move(maxRange)); +} + +::mlir::Attribute VScaleRangeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_minRange; + ::mlir::FailureOr _result_maxRange; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_minRange = false; + bool _seen_maxRange = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_minRange && _paramKey == "minRange") { + _seen_minRange = true; + + // Parse variable 'minRange' + _result_minRange = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_minRange)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_VScaleRangeAttr parameter 'minRange' which is to be a `IntegerAttr`"); + return {}; + } + } else if (!_seen_maxRange && _paramKey == "maxRange") { + _seen_maxRange = true; + + // Parse variable 'maxRange' + _result_maxRange = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_maxRange)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_VScaleRangeAttr parameter 'maxRange' which is to be a `IntegerAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 2 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_minRange)); + assert(::mlir::succeeded(_result_maxRange)); + return VScaleRangeAttr::get(odsParser.getContext(), + IntegerAttr((*_result_minRange)), + IntegerAttr((*_result_maxRange))); +} + +void VScaleRangeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "minRange = "; + odsPrinter.printStrippedAttrOrType(getMinRange()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "maxRange = "; + odsPrinter.printStrippedAttrOrType(getMaxRange()); + } + odsPrinter << ">"; +} + +IntegerAttr VScaleRangeAttr::getMinRange() const { + return getImpl()->minRange; +} + +IntegerAttr VScaleRangeAttr::getMaxRange() const { + return getImpl()->maxRange; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VScaleRangeAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LinkageAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LinkageAttrStorage(linkage::Linkage linkage) : linkage(std::move(linkage)) {} + + KeyTy getAsKey() const { + return KeyTy(linkage); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (linkage == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static LinkageAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto linkage = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) LinkageAttrStorage(std::move(linkage)); + } + + linkage::Linkage linkage; +}; +} // namespace detail +LinkageAttr LinkageAttr::get(::mlir::MLIRContext *context, linkage::Linkage linkage) { + return Base::get(context, std::move(linkage)); +} + +::mlir::Attribute LinkageAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_linkage; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'linkage' + _result_linkage = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_linkage)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LinkageAttr parameter 'linkage' which is to be a `linkage::Linkage`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_linkage)); + return LinkageAttr::get(odsParser.getContext(), + linkage::Linkage((*_result_linkage))); +} + +void LinkageAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter.printStrippedAttrOrType(getLinkage()); + odsPrinter << ">"; +} + +linkage::Linkage LinkageAttr::getLinkage() const { + return getImpl()->linkage; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LinkageAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopAnnotationAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple, FusedLoc, FusedLoc>; + LoopAnnotationAttrStorage(BoolAttr disableNonforced, LoopVectorizeAttr vectorize, LoopInterleaveAttr interleave, LoopUnrollAttr unroll, LoopUnrollAndJamAttr unrollAndJam, LoopLICMAttr licm, LoopDistributeAttr distribute, LoopPipelineAttr pipeline, LoopPeeledAttr peeled, LoopUnswitchAttr unswitch, BoolAttr mustProgress, BoolAttr isVectorized, ::llvm::ArrayRef parallelAccesses, FusedLoc startLoc, FusedLoc endLoc) : disableNonforced(std::move(disableNonforced)), vectorize(std::move(vectorize)), interleave(std::move(interleave)), unroll(std::move(unroll)), unrollAndJam(std::move(unrollAndJam)), licm(std::move(licm)), distribute(std::move(distribute)), pipeline(std::move(pipeline)), peeled(std::move(peeled)), unswitch(std::move(unswitch)), mustProgress(std::move(mustProgress)), isVectorized(std::move(isVectorized)), parallelAccesses(std::move(parallelAccesses)), startLoc(std::move(startLoc)), endLoc(std::move(endLoc)) {} + + KeyTy getAsKey() const { + return KeyTy(disableNonforced, vectorize, interleave, unroll, unrollAndJam, licm, distribute, pipeline, peeled, unswitch, mustProgress, isVectorized, parallelAccesses, startLoc, endLoc); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (disableNonforced == std::get<0>(tblgenKey)) && (vectorize == std::get<1>(tblgenKey)) && (interleave == std::get<2>(tblgenKey)) && (unroll == std::get<3>(tblgenKey)) && (unrollAndJam == std::get<4>(tblgenKey)) && (licm == std::get<5>(tblgenKey)) && (distribute == std::get<6>(tblgenKey)) && (pipeline == std::get<7>(tblgenKey)) && (peeled == std::get<8>(tblgenKey)) && (unswitch == std::get<9>(tblgenKey)) && (mustProgress == std::get<10>(tblgenKey)) && (isVectorized == std::get<11>(tblgenKey)) && (::llvm::ArrayRef(parallelAccesses) == ::llvm::ArrayRef(std::get<12>(tblgenKey))) && (startLoc == std::get<13>(tblgenKey)) && (endLoc == std::get<14>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey), std::get<9>(tblgenKey), std::get<10>(tblgenKey), std::get<11>(tblgenKey), std::get<12>(tblgenKey), std::get<13>(tblgenKey), std::get<14>(tblgenKey)); + } + + static LoopAnnotationAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto disableNonforced = std::move(std::get<0>(tblgenKey)); + auto vectorize = std::move(std::get<1>(tblgenKey)); + auto interleave = std::move(std::get<2>(tblgenKey)); + auto unroll = std::move(std::get<3>(tblgenKey)); + auto unrollAndJam = std::move(std::get<4>(tblgenKey)); + auto licm = std::move(std::get<5>(tblgenKey)); + auto distribute = std::move(std::get<6>(tblgenKey)); + auto pipeline = std::move(std::get<7>(tblgenKey)); + auto peeled = std::move(std::get<8>(tblgenKey)); + auto unswitch = std::move(std::get<9>(tblgenKey)); + auto mustProgress = std::move(std::get<10>(tblgenKey)); + auto isVectorized = std::move(std::get<11>(tblgenKey)); + auto parallelAccesses = std::move(std::get<12>(tblgenKey)); + auto startLoc = std::move(std::get<13>(tblgenKey)); + auto endLoc = std::move(std::get<14>(tblgenKey)); + parallelAccesses = allocator.copyInto(parallelAccesses); + return new (allocator.allocate()) LoopAnnotationAttrStorage(std::move(disableNonforced), std::move(vectorize), std::move(interleave), std::move(unroll), std::move(unrollAndJam), std::move(licm), std::move(distribute), std::move(pipeline), std::move(peeled), std::move(unswitch), std::move(mustProgress), std::move(isVectorized), std::move(parallelAccesses), std::move(startLoc), std::move(endLoc)); + } + + BoolAttr disableNonforced; + LoopVectorizeAttr vectorize; + LoopInterleaveAttr interleave; + LoopUnrollAttr unroll; + LoopUnrollAndJamAttr unrollAndJam; + LoopLICMAttr licm; + LoopDistributeAttr distribute; + LoopPipelineAttr pipeline; + LoopPeeledAttr peeled; + LoopUnswitchAttr unswitch; + BoolAttr mustProgress; + BoolAttr isVectorized; + ::llvm::ArrayRef parallelAccesses; + FusedLoc startLoc; + FusedLoc endLoc; +}; +} // namespace detail +LoopAnnotationAttr LoopAnnotationAttr::get(::mlir::MLIRContext *context, BoolAttr disableNonforced, LoopVectorizeAttr vectorize, LoopInterleaveAttr interleave, LoopUnrollAttr unroll, LoopUnrollAndJamAttr unrollAndJam, LoopLICMAttr licm, LoopDistributeAttr distribute, LoopPipelineAttr pipeline, LoopPeeledAttr peeled, LoopUnswitchAttr unswitch, BoolAttr mustProgress, BoolAttr isVectorized, ::llvm::ArrayRef parallelAccesses, FusedLoc startLoc, FusedLoc endLoc) { + return Base::get(context, std::move(disableNonforced), std::move(vectorize), std::move(interleave), std::move(unroll), std::move(unrollAndJam), std::move(licm), std::move(distribute), std::move(pipeline), std::move(peeled), std::move(unswitch), std::move(mustProgress), std::move(isVectorized), std::move(parallelAccesses), std::move(startLoc), std::move(endLoc)); +} + +::mlir::Attribute LoopAnnotationAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_disableNonforced; + ::mlir::FailureOr _result_vectorize; + ::mlir::FailureOr _result_interleave; + ::mlir::FailureOr _result_unroll; + ::mlir::FailureOr _result_unrollAndJam; + ::mlir::FailureOr _result_licm; + ::mlir::FailureOr _result_distribute; + ::mlir::FailureOr _result_pipeline; + ::mlir::FailureOr _result_peeled; + ::mlir::FailureOr _result_unswitch; + ::mlir::FailureOr _result_mustProgress; + ::mlir::FailureOr _result_isVectorized; + ::mlir::FailureOr<::llvm::SmallVector> _result_parallelAccesses; + ::mlir::FailureOr _result_startLoc; + ::mlir::FailureOr _result_endLoc; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_disableNonforced = false; + bool _seen_vectorize = false; + bool _seen_interleave = false; + bool _seen_unroll = false; + bool _seen_unrollAndJam = false; + bool _seen_licm = false; + bool _seen_distribute = false; + bool _seen_pipeline = false; + bool _seen_peeled = false; + bool _seen_unswitch = false; + bool _seen_mustProgress = false; + bool _seen_isVectorized = false; + bool _seen_parallelAccesses = false; + bool _seen_startLoc = false; + bool _seen_endLoc = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_disableNonforced && _paramKey == "disableNonforced") { + _seen_disableNonforced = true; + + // Parse variable 'disableNonforced' + _result_disableNonforced = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_disableNonforced)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'disableNonforced' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_vectorize && _paramKey == "vectorize") { + _seen_vectorize = true; + + // Parse variable 'vectorize' + _result_vectorize = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_vectorize)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'vectorize' which is to be a `LoopVectorizeAttr`"); + return {}; + } + } else if (!_seen_interleave && _paramKey == "interleave") { + _seen_interleave = true; + + // Parse variable 'interleave' + _result_interleave = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_interleave)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'interleave' which is to be a `LoopInterleaveAttr`"); + return {}; + } + } else if (!_seen_unroll && _paramKey == "unroll") { + _seen_unroll = true; + + // Parse variable 'unroll' + _result_unroll = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_unroll)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'unroll' which is to be a `LoopUnrollAttr`"); + return {}; + } + } else if (!_seen_unrollAndJam && _paramKey == "unrollAndJam") { + _seen_unrollAndJam = true; + + // Parse variable 'unrollAndJam' + _result_unrollAndJam = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_unrollAndJam)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'unrollAndJam' which is to be a `LoopUnrollAndJamAttr`"); + return {}; + } + } else if (!_seen_licm && _paramKey == "licm") { + _seen_licm = true; + + // Parse variable 'licm' + _result_licm = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_licm)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'licm' which is to be a `LoopLICMAttr`"); + return {}; + } + } else if (!_seen_distribute && _paramKey == "distribute") { + _seen_distribute = true; + + // Parse variable 'distribute' + _result_distribute = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_distribute)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'distribute' which is to be a `LoopDistributeAttr`"); + return {}; + } + } else if (!_seen_pipeline && _paramKey == "pipeline") { + _seen_pipeline = true; + + // Parse variable 'pipeline' + _result_pipeline = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_pipeline)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'pipeline' which is to be a `LoopPipelineAttr`"); + return {}; + } + } else if (!_seen_peeled && _paramKey == "peeled") { + _seen_peeled = true; + + // Parse variable 'peeled' + _result_peeled = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_peeled)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'peeled' which is to be a `LoopPeeledAttr`"); + return {}; + } + } else if (!_seen_unswitch && _paramKey == "unswitch") { + _seen_unswitch = true; + + // Parse variable 'unswitch' + _result_unswitch = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_unswitch)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'unswitch' which is to be a `LoopUnswitchAttr`"); + return {}; + } + } else if (!_seen_mustProgress && _paramKey == "mustProgress") { + _seen_mustProgress = true; + + // Parse variable 'mustProgress' + _result_mustProgress = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_mustProgress)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'mustProgress' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_isVectorized && _paramKey == "isVectorized") { + _seen_isVectorized = true; + + // Parse variable 'isVectorized' + _result_isVectorized = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_isVectorized)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'isVectorized' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_parallelAccesses && _paramKey == "parallelAccesses") { + _seen_parallelAccesses = true; + + // Parse variable 'parallelAccesses' + _result_parallelAccesses = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); + if (::mlir::failed(_result_parallelAccesses)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'parallelAccesses' which is to be a `::llvm::ArrayRef`"); + return {}; + } + } else if (!_seen_startLoc && _paramKey == "startLoc") { + _seen_startLoc = true; + + // Parse variable 'startLoc' + _result_startLoc = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_startLoc)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'startLoc' which is to be a `FusedLoc`"); + return {}; + } + } else if (!_seen_endLoc && _paramKey == "endLoc") { + _seen_endLoc = true; + + // Parse variable 'endLoc' + _result_endLoc = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_endLoc)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'endLoc' which is to be a `FusedLoc`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return LoopAnnotationAttr::get(odsParser.getContext(), + BoolAttr((_result_disableNonforced.value_or(BoolAttr()))), + LoopVectorizeAttr((_result_vectorize.value_or(LoopVectorizeAttr()))), + LoopInterleaveAttr((_result_interleave.value_or(LoopInterleaveAttr()))), + LoopUnrollAttr((_result_unroll.value_or(LoopUnrollAttr()))), + LoopUnrollAndJamAttr((_result_unrollAndJam.value_or(LoopUnrollAndJamAttr()))), + LoopLICMAttr((_result_licm.value_or(LoopLICMAttr()))), + LoopDistributeAttr((_result_distribute.value_or(LoopDistributeAttr()))), + LoopPipelineAttr((_result_pipeline.value_or(LoopPipelineAttr()))), + LoopPeeledAttr((_result_peeled.value_or(LoopPeeledAttr()))), + LoopUnswitchAttr((_result_unswitch.value_or(LoopUnswitchAttr()))), + BoolAttr((_result_mustProgress.value_or(BoolAttr()))), + BoolAttr((_result_isVectorized.value_or(BoolAttr()))), + ::llvm::ArrayRef((_result_parallelAccesses.value_or(::llvm::SmallVector()))), + FusedLoc((_result_startLoc.value_or(FusedLoc()))), + FusedLoc((_result_endLoc.value_or(FusedLoc())))); +} + +void LoopAnnotationAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getDisableNonforced() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "disableNonforced = "; + if (!(getDisableNonforced() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getDisableNonforced()); + } + } + if (!(getVectorize() == LoopVectorizeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "vectorize = "; + if (!(getVectorize() == LoopVectorizeAttr())) { + odsPrinter.printStrippedAttrOrType(getVectorize()); + } + } + if (!(getInterleave() == LoopInterleaveAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "interleave = "; + if (!(getInterleave() == LoopInterleaveAttr())) { + odsPrinter.printStrippedAttrOrType(getInterleave()); + } + } + if (!(getUnroll() == LoopUnrollAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "unroll = "; + if (!(getUnroll() == LoopUnrollAttr())) { + odsPrinter.printStrippedAttrOrType(getUnroll()); + } + } + if (!(getUnrollAndJam() == LoopUnrollAndJamAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "unrollAndJam = "; + if (!(getUnrollAndJam() == LoopUnrollAndJamAttr())) { + odsPrinter.printStrippedAttrOrType(getUnrollAndJam()); + } + } + if (!(getLicm() == LoopLICMAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "licm = "; + if (!(getLicm() == LoopLICMAttr())) { + odsPrinter.printStrippedAttrOrType(getLicm()); + } + } + if (!(getDistribute() == LoopDistributeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "distribute = "; + if (!(getDistribute() == LoopDistributeAttr())) { + odsPrinter.printStrippedAttrOrType(getDistribute()); + } + } + if (!(getPipeline() == LoopPipelineAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "pipeline = "; + if (!(getPipeline() == LoopPipelineAttr())) { + odsPrinter.printStrippedAttrOrType(getPipeline()); + } + } + if (!(getPeeled() == LoopPeeledAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "peeled = "; + if (!(getPeeled() == LoopPeeledAttr())) { + odsPrinter.printStrippedAttrOrType(getPeeled()); + } + } + if (!(getUnswitch() == LoopUnswitchAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "unswitch = "; + if (!(getUnswitch() == LoopUnswitchAttr())) { + odsPrinter.printStrippedAttrOrType(getUnswitch()); + } + } + if (!(getMustProgress() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "mustProgress = "; + if (!(getMustProgress() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getMustProgress()); + } + } + if (!(getIsVectorized() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "isVectorized = "; + if (!(getIsVectorized() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getIsVectorized()); + } + } + if (!(::llvm::ArrayRef(getParallelAccesses()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "parallelAccesses = "; + if (!(::llvm::ArrayRef(getParallelAccesses()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { + odsPrinter.printStrippedAttrOrType(getParallelAccesses()); + } + } + if (!(getStartLoc() == FusedLoc())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "startLoc = "; + if (!(getStartLoc() == FusedLoc())) { + odsPrinter.printStrippedAttrOrType(getStartLoc()); + } + } + if (!(getEndLoc() == FusedLoc())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "endLoc = "; + if (!(getEndLoc() == FusedLoc())) { + odsPrinter.printStrippedAttrOrType(getEndLoc()); + } + } + } + odsPrinter << ">"; +} + +BoolAttr LoopAnnotationAttr::getDisableNonforced() const { + return getImpl()->disableNonforced; +} + +LoopVectorizeAttr LoopAnnotationAttr::getVectorize() const { + return getImpl()->vectorize; +} + +LoopInterleaveAttr LoopAnnotationAttr::getInterleave() const { + return getImpl()->interleave; +} + +LoopUnrollAttr LoopAnnotationAttr::getUnroll() const { + return getImpl()->unroll; +} + +LoopUnrollAndJamAttr LoopAnnotationAttr::getUnrollAndJam() const { + return getImpl()->unrollAndJam; +} + +LoopLICMAttr LoopAnnotationAttr::getLicm() const { + return getImpl()->licm; +} + +LoopDistributeAttr LoopAnnotationAttr::getDistribute() const { + return getImpl()->distribute; +} + +LoopPipelineAttr LoopAnnotationAttr::getPipeline() const { + return getImpl()->pipeline; +} + +LoopPeeledAttr LoopAnnotationAttr::getPeeled() const { + return getImpl()->peeled; +} + +LoopUnswitchAttr LoopAnnotationAttr::getUnswitch() const { + return getImpl()->unswitch; +} + +BoolAttr LoopAnnotationAttr::getMustProgress() const { + return getImpl()->mustProgress; +} + +BoolAttr LoopAnnotationAttr::getIsVectorized() const { + return getImpl()->isVectorized; +} + +::llvm::ArrayRef LoopAnnotationAttr::getParallelAccesses() const { + return getImpl()->parallelAccesses; +} + +FusedLoc LoopAnnotationAttr::getStartLoc() const { + return getImpl()->startLoc; +} + +FusedLoc LoopAnnotationAttr::getEndLoc() const { + return getImpl()->endLoc; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopAnnotationAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopDistributeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LoopDistributeAttrStorage(BoolAttr disable, LoopAnnotationAttr followupCoincident, LoopAnnotationAttr followupSequential, LoopAnnotationAttr followupFallback, LoopAnnotationAttr followupAll) : disable(std::move(disable)), followupCoincident(std::move(followupCoincident)), followupSequential(std::move(followupSequential)), followupFallback(std::move(followupFallback)), followupAll(std::move(followupAll)) {} + + KeyTy getAsKey() const { + return KeyTy(disable, followupCoincident, followupSequential, followupFallback, followupAll); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (disable == std::get<0>(tblgenKey)) && (followupCoincident == std::get<1>(tblgenKey)) && (followupSequential == std::get<2>(tblgenKey)) && (followupFallback == std::get<3>(tblgenKey)) && (followupAll == std::get<4>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey)); + } + + static LoopDistributeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto disable = std::move(std::get<0>(tblgenKey)); + auto followupCoincident = std::move(std::get<1>(tblgenKey)); + auto followupSequential = std::move(std::get<2>(tblgenKey)); + auto followupFallback = std::move(std::get<3>(tblgenKey)); + auto followupAll = std::move(std::get<4>(tblgenKey)); + return new (allocator.allocate()) LoopDistributeAttrStorage(std::move(disable), std::move(followupCoincident), std::move(followupSequential), std::move(followupFallback), std::move(followupAll)); + } + + BoolAttr disable; + LoopAnnotationAttr followupCoincident; + LoopAnnotationAttr followupSequential; + LoopAnnotationAttr followupFallback; + LoopAnnotationAttr followupAll; +}; +} // namespace detail +LoopDistributeAttr LoopDistributeAttr::get(::mlir::MLIRContext *context, BoolAttr disable, LoopAnnotationAttr followupCoincident, LoopAnnotationAttr followupSequential, LoopAnnotationAttr followupFallback, LoopAnnotationAttr followupAll) { + return Base::get(context, std::move(disable), std::move(followupCoincident), std::move(followupSequential), std::move(followupFallback), std::move(followupAll)); +} + +::mlir::Attribute LoopDistributeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_disable; + ::mlir::FailureOr _result_followupCoincident; + ::mlir::FailureOr _result_followupSequential; + ::mlir::FailureOr _result_followupFallback; + ::mlir::FailureOr _result_followupAll; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_disable = false; + bool _seen_followupCoincident = false; + bool _seen_followupSequential = false; + bool _seen_followupFallback = false; + bool _seen_followupAll = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_disable && _paramKey == "disable") { + _seen_disable = true; + + // Parse variable 'disable' + _result_disable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_disable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'disable' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_followupCoincident && _paramKey == "followupCoincident") { + _seen_followupCoincident = true; + + // Parse variable 'followupCoincident' + _result_followupCoincident = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupCoincident)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupCoincident' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupSequential && _paramKey == "followupSequential") { + _seen_followupSequential = true; + + // Parse variable 'followupSequential' + _result_followupSequential = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupSequential)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupSequential' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupFallback && _paramKey == "followupFallback") { + _seen_followupFallback = true; + + // Parse variable 'followupFallback' + _result_followupFallback = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupFallback)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupFallback' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupAll && _paramKey == "followupAll") { + _seen_followupAll = true; + + // Parse variable 'followupAll' + _result_followupAll = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupAll)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return LoopDistributeAttr::get(odsParser.getContext(), + BoolAttr((_result_disable.value_or(BoolAttr()))), + LoopAnnotationAttr((_result_followupCoincident.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupSequential.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupFallback.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); +} + +void LoopDistributeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getDisable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "disable = "; + if (!(getDisable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getDisable()); + } + } + if (!(getFollowupCoincident() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupCoincident = "; + if (!(getFollowupCoincident() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupCoincident()); + } + } + if (!(getFollowupSequential() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupSequential = "; + if (!(getFollowupSequential() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupSequential()); + } + } + if (!(getFollowupFallback() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupFallback = "; + if (!(getFollowupFallback() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupFallback()); + } + } + if (!(getFollowupAll() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupAll = "; + if (!(getFollowupAll() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupAll()); + } + } + } + odsPrinter << ">"; +} + +BoolAttr LoopDistributeAttr::getDisable() const { + return getImpl()->disable; +} + +LoopAnnotationAttr LoopDistributeAttr::getFollowupCoincident() const { + return getImpl()->followupCoincident; +} + +LoopAnnotationAttr LoopDistributeAttr::getFollowupSequential() const { + return getImpl()->followupSequential; +} + +LoopAnnotationAttr LoopDistributeAttr::getFollowupFallback() const { + return getImpl()->followupFallback; +} + +LoopAnnotationAttr LoopDistributeAttr::getFollowupAll() const { + return getImpl()->followupAll; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopDistributeAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopInterleaveAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LoopInterleaveAttrStorage(IntegerAttr count) : count(std::move(count)) {} + + KeyTy getAsKey() const { + return KeyTy(count); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (count == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static LoopInterleaveAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto count = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) LoopInterleaveAttrStorage(std::move(count)); + } + + IntegerAttr count; +}; +} // namespace detail +LoopInterleaveAttr LoopInterleaveAttr::get(::mlir::MLIRContext *context, IntegerAttr count) { + return Base::get(context, std::move(count)); +} + +::mlir::Attribute LoopInterleaveAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_count; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_count = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_count && _paramKey == "count") { + _seen_count = true; + + // Parse variable 'count' + _result_count = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_count)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopInterleaveAttr parameter 'count' which is to be a `IntegerAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_count)); + return LoopInterleaveAttr::get(odsParser.getContext(), + IntegerAttr((*_result_count))); +} + +void LoopInterleaveAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "count = "; + odsPrinter.printStrippedAttrOrType(getCount()); + } + odsPrinter << ">"; +} + +IntegerAttr LoopInterleaveAttr::getCount() const { + return getImpl()->count; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopInterleaveAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopLICMAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LoopLICMAttrStorage(BoolAttr disable, BoolAttr versioningDisable) : disable(std::move(disable)), versioningDisable(std::move(versioningDisable)) {} + + KeyTy getAsKey() const { + return KeyTy(disable, versioningDisable); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (disable == std::get<0>(tblgenKey)) && (versioningDisable == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static LoopLICMAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto disable = std::move(std::get<0>(tblgenKey)); + auto versioningDisable = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) LoopLICMAttrStorage(std::move(disable), std::move(versioningDisable)); + } + + BoolAttr disable; + BoolAttr versioningDisable; +}; +} // namespace detail +LoopLICMAttr LoopLICMAttr::get(::mlir::MLIRContext *context, BoolAttr disable, BoolAttr versioningDisable) { + return Base::get(context, std::move(disable), std::move(versioningDisable)); +} + +::mlir::Attribute LoopLICMAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_disable; + ::mlir::FailureOr _result_versioningDisable; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_disable = false; + bool _seen_versioningDisable = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_disable && _paramKey == "disable") { + _seen_disable = true; + + // Parse variable 'disable' + _result_disable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_disable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopLICMAttr parameter 'disable' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_versioningDisable && _paramKey == "versioningDisable") { + _seen_versioningDisable = true; + + // Parse variable 'versioningDisable' + _result_versioningDisable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_versioningDisable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopLICMAttr parameter 'versioningDisable' which is to be a `BoolAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return LoopLICMAttr::get(odsParser.getContext(), + BoolAttr((_result_disable.value_or(BoolAttr()))), + BoolAttr((_result_versioningDisable.value_or(BoolAttr())))); +} + +void LoopLICMAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getDisable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "disable = "; + if (!(getDisable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getDisable()); + } + } + if (!(getVersioningDisable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "versioningDisable = "; + if (!(getVersioningDisable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getVersioningDisable()); + } + } + } + odsPrinter << ">"; +} + +BoolAttr LoopLICMAttr::getDisable() const { + return getImpl()->disable; +} + +BoolAttr LoopLICMAttr::getVersioningDisable() const { + return getImpl()->versioningDisable; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopLICMAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopPeeledAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LoopPeeledAttrStorage(IntegerAttr count) : count(std::move(count)) {} + + KeyTy getAsKey() const { + return KeyTy(count); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (count == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static LoopPeeledAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto count = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) LoopPeeledAttrStorage(std::move(count)); + } + + IntegerAttr count; +}; +} // namespace detail +LoopPeeledAttr LoopPeeledAttr::get(::mlir::MLIRContext *context, IntegerAttr count) { + return Base::get(context, std::move(count)); +} + +::mlir::Attribute LoopPeeledAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_count; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_count = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_count && _paramKey == "count") { + _seen_count = true; + + // Parse variable 'count' + _result_count = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_count)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopPeeledAttr parameter 'count' which is to be a `IntegerAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return LoopPeeledAttr::get(odsParser.getContext(), + IntegerAttr((_result_count.value_or(IntegerAttr())))); +} + +void LoopPeeledAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getCount() == IntegerAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "count = "; + if (!(getCount() == IntegerAttr())) { + odsPrinter.printStrippedAttrOrType(getCount()); + } + } + } + odsPrinter << ">"; +} + +IntegerAttr LoopPeeledAttr::getCount() const { + return getImpl()->count; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopPeeledAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopPipelineAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LoopPipelineAttrStorage(BoolAttr disable, IntegerAttr initiationinterval) : disable(std::move(disable)), initiationinterval(std::move(initiationinterval)) {} + + KeyTy getAsKey() const { + return KeyTy(disable, initiationinterval); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (disable == std::get<0>(tblgenKey)) && (initiationinterval == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static LoopPipelineAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto disable = std::move(std::get<0>(tblgenKey)); + auto initiationinterval = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) LoopPipelineAttrStorage(std::move(disable), std::move(initiationinterval)); + } + + BoolAttr disable; + IntegerAttr initiationinterval; +}; +} // namespace detail +LoopPipelineAttr LoopPipelineAttr::get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr initiationinterval) { + return Base::get(context, std::move(disable), std::move(initiationinterval)); +} + +::mlir::Attribute LoopPipelineAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_disable; + ::mlir::FailureOr _result_initiationinterval; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_disable = false; + bool _seen_initiationinterval = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_disable && _paramKey == "disable") { + _seen_disable = true; + + // Parse variable 'disable' + _result_disable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_disable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopPipelineAttr parameter 'disable' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_initiationinterval && _paramKey == "initiationinterval") { + _seen_initiationinterval = true; + + // Parse variable 'initiationinterval' + _result_initiationinterval = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_initiationinterval)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopPipelineAttr parameter 'initiationinterval' which is to be a `IntegerAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return LoopPipelineAttr::get(odsParser.getContext(), + BoolAttr((_result_disable.value_or(BoolAttr()))), + IntegerAttr((_result_initiationinterval.value_or(IntegerAttr())))); +} + +void LoopPipelineAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getDisable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "disable = "; + if (!(getDisable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getDisable()); + } + } + if (!(getInitiationinterval() == IntegerAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "initiationinterval = "; + if (!(getInitiationinterval() == IntegerAttr())) { + odsPrinter.printStrippedAttrOrType(getInitiationinterval()); + } + } + } + odsPrinter << ">"; +} + +BoolAttr LoopPipelineAttr::getDisable() const { + return getImpl()->disable; +} + +IntegerAttr LoopPipelineAttr::getInitiationinterval() const { + return getImpl()->initiationinterval; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopPipelineAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopUnrollAndJamAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LoopUnrollAndJamAttrStorage(BoolAttr disable, IntegerAttr count, LoopAnnotationAttr followupOuter, LoopAnnotationAttr followupInner, LoopAnnotationAttr followupRemainderOuter, LoopAnnotationAttr followupRemainderInner, LoopAnnotationAttr followupAll) : disable(std::move(disable)), count(std::move(count)), followupOuter(std::move(followupOuter)), followupInner(std::move(followupInner)), followupRemainderOuter(std::move(followupRemainderOuter)), followupRemainderInner(std::move(followupRemainderInner)), followupAll(std::move(followupAll)) {} + + KeyTy getAsKey() const { + return KeyTy(disable, count, followupOuter, followupInner, followupRemainderOuter, followupRemainderInner, followupAll); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (disable == std::get<0>(tblgenKey)) && (count == std::get<1>(tblgenKey)) && (followupOuter == std::get<2>(tblgenKey)) && (followupInner == std::get<3>(tblgenKey)) && (followupRemainderOuter == std::get<4>(tblgenKey)) && (followupRemainderInner == std::get<5>(tblgenKey)) && (followupAll == std::get<6>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); + } + + static LoopUnrollAndJamAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto disable = std::move(std::get<0>(tblgenKey)); + auto count = std::move(std::get<1>(tblgenKey)); + auto followupOuter = std::move(std::get<2>(tblgenKey)); + auto followupInner = std::move(std::get<3>(tblgenKey)); + auto followupRemainderOuter = std::move(std::get<4>(tblgenKey)); + auto followupRemainderInner = std::move(std::get<5>(tblgenKey)); + auto followupAll = std::move(std::get<6>(tblgenKey)); + return new (allocator.allocate()) LoopUnrollAndJamAttrStorage(std::move(disable), std::move(count), std::move(followupOuter), std::move(followupInner), std::move(followupRemainderOuter), std::move(followupRemainderInner), std::move(followupAll)); + } + + BoolAttr disable; + IntegerAttr count; + LoopAnnotationAttr followupOuter; + LoopAnnotationAttr followupInner; + LoopAnnotationAttr followupRemainderOuter; + LoopAnnotationAttr followupRemainderInner; + LoopAnnotationAttr followupAll; +}; +} // namespace detail +LoopUnrollAndJamAttr LoopUnrollAndJamAttr::get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr count, LoopAnnotationAttr followupOuter, LoopAnnotationAttr followupInner, LoopAnnotationAttr followupRemainderOuter, LoopAnnotationAttr followupRemainderInner, LoopAnnotationAttr followupAll) { + return Base::get(context, std::move(disable), std::move(count), std::move(followupOuter), std::move(followupInner), std::move(followupRemainderOuter), std::move(followupRemainderInner), std::move(followupAll)); +} + +::mlir::Attribute LoopUnrollAndJamAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_disable; + ::mlir::FailureOr _result_count; + ::mlir::FailureOr _result_followupOuter; + ::mlir::FailureOr _result_followupInner; + ::mlir::FailureOr _result_followupRemainderOuter; + ::mlir::FailureOr _result_followupRemainderInner; + ::mlir::FailureOr _result_followupAll; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_disable = false; + bool _seen_count = false; + bool _seen_followupOuter = false; + bool _seen_followupInner = false; + bool _seen_followupRemainderOuter = false; + bool _seen_followupRemainderInner = false; + bool _seen_followupAll = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_disable && _paramKey == "disable") { + _seen_disable = true; + + // Parse variable 'disable' + _result_disable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_disable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'disable' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_count && _paramKey == "count") { + _seen_count = true; + + // Parse variable 'count' + _result_count = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_count)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'count' which is to be a `IntegerAttr`"); + return {}; + } + } else if (!_seen_followupOuter && _paramKey == "followupOuter") { + _seen_followupOuter = true; + + // Parse variable 'followupOuter' + _result_followupOuter = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupOuter)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupOuter' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupInner && _paramKey == "followupInner") { + _seen_followupInner = true; + + // Parse variable 'followupInner' + _result_followupInner = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupInner)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupInner' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupRemainderOuter && _paramKey == "followupRemainderOuter") { + _seen_followupRemainderOuter = true; + + // Parse variable 'followupRemainderOuter' + _result_followupRemainderOuter = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupRemainderOuter)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupRemainderOuter' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupRemainderInner && _paramKey == "followupRemainderInner") { + _seen_followupRemainderInner = true; + + // Parse variable 'followupRemainderInner' + _result_followupRemainderInner = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupRemainderInner)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupRemainderInner' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupAll && _paramKey == "followupAll") { + _seen_followupAll = true; + + // Parse variable 'followupAll' + _result_followupAll = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupAll)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return LoopUnrollAndJamAttr::get(odsParser.getContext(), + BoolAttr((_result_disable.value_or(BoolAttr()))), + IntegerAttr((_result_count.value_or(IntegerAttr()))), + LoopAnnotationAttr((_result_followupOuter.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupInner.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupRemainderOuter.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupRemainderInner.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); +} + +void LoopUnrollAndJamAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getDisable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "disable = "; + if (!(getDisable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getDisable()); + } + } + if (!(getCount() == IntegerAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "count = "; + if (!(getCount() == IntegerAttr())) { + odsPrinter.printStrippedAttrOrType(getCount()); + } + } + if (!(getFollowupOuter() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupOuter = "; + if (!(getFollowupOuter() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupOuter()); + } + } + if (!(getFollowupInner() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupInner = "; + if (!(getFollowupInner() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupInner()); + } + } + if (!(getFollowupRemainderOuter() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupRemainderOuter = "; + if (!(getFollowupRemainderOuter() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupRemainderOuter()); + } + } + if (!(getFollowupRemainderInner() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupRemainderInner = "; + if (!(getFollowupRemainderInner() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupRemainderInner()); + } + } + if (!(getFollowupAll() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupAll = "; + if (!(getFollowupAll() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupAll()); + } + } + } + odsPrinter << ">"; +} + +BoolAttr LoopUnrollAndJamAttr::getDisable() const { + return getImpl()->disable; +} + +IntegerAttr LoopUnrollAndJamAttr::getCount() const { + return getImpl()->count; +} + +LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupOuter() const { + return getImpl()->followupOuter; +} + +LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupInner() const { + return getImpl()->followupInner; +} + +LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupRemainderOuter() const { + return getImpl()->followupRemainderOuter; +} + +LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupRemainderInner() const { + return getImpl()->followupRemainderInner; +} + +LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupAll() const { + return getImpl()->followupAll; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnrollAndJamAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopUnrollAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LoopUnrollAttrStorage(BoolAttr disable, IntegerAttr count, BoolAttr runtimeDisable, BoolAttr full, LoopAnnotationAttr followupUnrolled, LoopAnnotationAttr followupRemainder, LoopAnnotationAttr followupAll) : disable(std::move(disable)), count(std::move(count)), runtimeDisable(std::move(runtimeDisable)), full(std::move(full)), followupUnrolled(std::move(followupUnrolled)), followupRemainder(std::move(followupRemainder)), followupAll(std::move(followupAll)) {} + + KeyTy getAsKey() const { + return KeyTy(disable, count, runtimeDisable, full, followupUnrolled, followupRemainder, followupAll); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (disable == std::get<0>(tblgenKey)) && (count == std::get<1>(tblgenKey)) && (runtimeDisable == std::get<2>(tblgenKey)) && (full == std::get<3>(tblgenKey)) && (followupUnrolled == std::get<4>(tblgenKey)) && (followupRemainder == std::get<5>(tblgenKey)) && (followupAll == std::get<6>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); + } + + static LoopUnrollAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto disable = std::move(std::get<0>(tblgenKey)); + auto count = std::move(std::get<1>(tblgenKey)); + auto runtimeDisable = std::move(std::get<2>(tblgenKey)); + auto full = std::move(std::get<3>(tblgenKey)); + auto followupUnrolled = std::move(std::get<4>(tblgenKey)); + auto followupRemainder = std::move(std::get<5>(tblgenKey)); + auto followupAll = std::move(std::get<6>(tblgenKey)); + return new (allocator.allocate()) LoopUnrollAttrStorage(std::move(disable), std::move(count), std::move(runtimeDisable), std::move(full), std::move(followupUnrolled), std::move(followupRemainder), std::move(followupAll)); + } + + BoolAttr disable; + IntegerAttr count; + BoolAttr runtimeDisable; + BoolAttr full; + LoopAnnotationAttr followupUnrolled; + LoopAnnotationAttr followupRemainder; + LoopAnnotationAttr followupAll; +}; +} // namespace detail +LoopUnrollAttr LoopUnrollAttr::get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr count, BoolAttr runtimeDisable, BoolAttr full, LoopAnnotationAttr followupUnrolled, LoopAnnotationAttr followupRemainder, LoopAnnotationAttr followupAll) { + return Base::get(context, std::move(disable), std::move(count), std::move(runtimeDisable), std::move(full), std::move(followupUnrolled), std::move(followupRemainder), std::move(followupAll)); +} + +::mlir::Attribute LoopUnrollAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_disable; + ::mlir::FailureOr _result_count; + ::mlir::FailureOr _result_runtimeDisable; + ::mlir::FailureOr _result_full; + ::mlir::FailureOr _result_followupUnrolled; + ::mlir::FailureOr _result_followupRemainder; + ::mlir::FailureOr _result_followupAll; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_disable = false; + bool _seen_count = false; + bool _seen_runtimeDisable = false; + bool _seen_full = false; + bool _seen_followupUnrolled = false; + bool _seen_followupRemainder = false; + bool _seen_followupAll = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_disable && _paramKey == "disable") { + _seen_disable = true; + + // Parse variable 'disable' + _result_disable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_disable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'disable' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_count && _paramKey == "count") { + _seen_count = true; + + // Parse variable 'count' + _result_count = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_count)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'count' which is to be a `IntegerAttr`"); + return {}; + } + } else if (!_seen_runtimeDisable && _paramKey == "runtimeDisable") { + _seen_runtimeDisable = true; + + // Parse variable 'runtimeDisable' + _result_runtimeDisable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_runtimeDisable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'runtimeDisable' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_full && _paramKey == "full") { + _seen_full = true; + + // Parse variable 'full' + _result_full = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_full)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'full' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_followupUnrolled && _paramKey == "followupUnrolled") { + _seen_followupUnrolled = true; + + // Parse variable 'followupUnrolled' + _result_followupUnrolled = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupUnrolled)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'followupUnrolled' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupRemainder && _paramKey == "followupRemainder") { + _seen_followupRemainder = true; + + // Parse variable 'followupRemainder' + _result_followupRemainder = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupRemainder)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'followupRemainder' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupAll && _paramKey == "followupAll") { + _seen_followupAll = true; + + // Parse variable 'followupAll' + _result_followupAll = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupAll)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return LoopUnrollAttr::get(odsParser.getContext(), + BoolAttr((_result_disable.value_or(BoolAttr()))), + IntegerAttr((_result_count.value_or(IntegerAttr()))), + BoolAttr((_result_runtimeDisable.value_or(BoolAttr()))), + BoolAttr((_result_full.value_or(BoolAttr()))), + LoopAnnotationAttr((_result_followupUnrolled.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupRemainder.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); +} + +void LoopUnrollAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getDisable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "disable = "; + if (!(getDisable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getDisable()); + } + } + if (!(getCount() == IntegerAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "count = "; + if (!(getCount() == IntegerAttr())) { + odsPrinter.printStrippedAttrOrType(getCount()); + } + } + if (!(getRuntimeDisable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "runtimeDisable = "; + if (!(getRuntimeDisable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getRuntimeDisable()); + } + } + if (!(getFull() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "full = "; + if (!(getFull() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getFull()); + } + } + if (!(getFollowupUnrolled() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupUnrolled = "; + if (!(getFollowupUnrolled() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupUnrolled()); + } + } + if (!(getFollowupRemainder() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupRemainder = "; + if (!(getFollowupRemainder() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupRemainder()); + } + } + if (!(getFollowupAll() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupAll = "; + if (!(getFollowupAll() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupAll()); + } + } + } + odsPrinter << ">"; +} + +BoolAttr LoopUnrollAttr::getDisable() const { + return getImpl()->disable; +} + +IntegerAttr LoopUnrollAttr::getCount() const { + return getImpl()->count; +} + +BoolAttr LoopUnrollAttr::getRuntimeDisable() const { + return getImpl()->runtimeDisable; +} + +BoolAttr LoopUnrollAttr::getFull() const { + return getImpl()->full; +} + +LoopAnnotationAttr LoopUnrollAttr::getFollowupUnrolled() const { + return getImpl()->followupUnrolled; +} + +LoopAnnotationAttr LoopUnrollAttr::getFollowupRemainder() const { + return getImpl()->followupRemainder; +} + +LoopAnnotationAttr LoopUnrollAttr::getFollowupAll() const { + return getImpl()->followupAll; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnrollAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopUnswitchAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LoopUnswitchAttrStorage(BoolAttr partialDisable) : partialDisable(std::move(partialDisable)) {} + + KeyTy getAsKey() const { + return KeyTy(partialDisable); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (partialDisable == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static LoopUnswitchAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto partialDisable = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) LoopUnswitchAttrStorage(std::move(partialDisable)); + } + + BoolAttr partialDisable; +}; +} // namespace detail +LoopUnswitchAttr LoopUnswitchAttr::get(::mlir::MLIRContext *context, BoolAttr partialDisable) { + return Base::get(context, std::move(partialDisable)); +} + +::mlir::Attribute LoopUnswitchAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_partialDisable; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_partialDisable = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_partialDisable && _paramKey == "partialDisable") { + _seen_partialDisable = true; + + // Parse variable 'partialDisable' + _result_partialDisable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_partialDisable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnswitchAttr parameter 'partialDisable' which is to be a `BoolAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return LoopUnswitchAttr::get(odsParser.getContext(), + BoolAttr((_result_partialDisable.value_or(BoolAttr())))); +} + +void LoopUnswitchAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getPartialDisable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "partialDisable = "; + if (!(getPartialDisable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getPartialDisable()); + } + } + } + odsPrinter << ">"; +} + +BoolAttr LoopUnswitchAttr::getPartialDisable() const { + return getImpl()->partialDisable; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnswitchAttr) +namespace mlir { +namespace LLVM { +namespace detail { +struct LoopVectorizeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + LoopVectorizeAttrStorage(BoolAttr disable, BoolAttr predicateEnable, BoolAttr scalableEnable, IntegerAttr width, LoopAnnotationAttr followupVectorized, LoopAnnotationAttr followupEpilogue, LoopAnnotationAttr followupAll) : disable(std::move(disable)), predicateEnable(std::move(predicateEnable)), scalableEnable(std::move(scalableEnable)), width(std::move(width)), followupVectorized(std::move(followupVectorized)), followupEpilogue(std::move(followupEpilogue)), followupAll(std::move(followupAll)) {} + + KeyTy getAsKey() const { + return KeyTy(disable, predicateEnable, scalableEnable, width, followupVectorized, followupEpilogue, followupAll); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (disable == std::get<0>(tblgenKey)) && (predicateEnable == std::get<1>(tblgenKey)) && (scalableEnable == std::get<2>(tblgenKey)) && (width == std::get<3>(tblgenKey)) && (followupVectorized == std::get<4>(tblgenKey)) && (followupEpilogue == std::get<5>(tblgenKey)) && (followupAll == std::get<6>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); + } + + static LoopVectorizeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto disable = std::move(std::get<0>(tblgenKey)); + auto predicateEnable = std::move(std::get<1>(tblgenKey)); + auto scalableEnable = std::move(std::get<2>(tblgenKey)); + auto width = std::move(std::get<3>(tblgenKey)); + auto followupVectorized = std::move(std::get<4>(tblgenKey)); + auto followupEpilogue = std::move(std::get<5>(tblgenKey)); + auto followupAll = std::move(std::get<6>(tblgenKey)); + return new (allocator.allocate()) LoopVectorizeAttrStorage(std::move(disable), std::move(predicateEnable), std::move(scalableEnable), std::move(width), std::move(followupVectorized), std::move(followupEpilogue), std::move(followupAll)); + } + + BoolAttr disable; + BoolAttr predicateEnable; + BoolAttr scalableEnable; + IntegerAttr width; + LoopAnnotationAttr followupVectorized; + LoopAnnotationAttr followupEpilogue; + LoopAnnotationAttr followupAll; +}; +} // namespace detail +LoopVectorizeAttr LoopVectorizeAttr::get(::mlir::MLIRContext *context, BoolAttr disable, BoolAttr predicateEnable, BoolAttr scalableEnable, IntegerAttr width, LoopAnnotationAttr followupVectorized, LoopAnnotationAttr followupEpilogue, LoopAnnotationAttr followupAll) { + return Base::get(context, std::move(disable), std::move(predicateEnable), std::move(scalableEnable), std::move(width), std::move(followupVectorized), std::move(followupEpilogue), std::move(followupAll)); +} + +::mlir::Attribute LoopVectorizeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_disable; + ::mlir::FailureOr _result_predicateEnable; + ::mlir::FailureOr _result_scalableEnable; + ::mlir::FailureOr _result_width; + ::mlir::FailureOr _result_followupVectorized; + ::mlir::FailureOr _result_followupEpilogue; + ::mlir::FailureOr _result_followupAll; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_disable = false; + bool _seen_predicateEnable = false; + bool _seen_scalableEnable = false; + bool _seen_width = false; + bool _seen_followupVectorized = false; + bool _seen_followupEpilogue = false; + bool _seen_followupAll = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_disable && _paramKey == "disable") { + _seen_disable = true; + + // Parse variable 'disable' + _result_disable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_disable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'disable' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_predicateEnable && _paramKey == "predicateEnable") { + _seen_predicateEnable = true; + + // Parse variable 'predicateEnable' + _result_predicateEnable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_predicateEnable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'predicateEnable' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_scalableEnable && _paramKey == "scalableEnable") { + _seen_scalableEnable = true; + + // Parse variable 'scalableEnable' + _result_scalableEnable = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_scalableEnable)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'scalableEnable' which is to be a `BoolAttr`"); + return {}; + } + } else if (!_seen_width && _paramKey == "width") { + _seen_width = true; + + // Parse variable 'width' + _result_width = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_width)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'width' which is to be a `IntegerAttr`"); + return {}; + } + } else if (!_seen_followupVectorized && _paramKey == "followupVectorized") { + _seen_followupVectorized = true; + + // Parse variable 'followupVectorized' + _result_followupVectorized = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupVectorized)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'followupVectorized' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupEpilogue && _paramKey == "followupEpilogue") { + _seen_followupEpilogue = true; + + // Parse variable 'followupEpilogue' + _result_followupEpilogue = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupEpilogue)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'followupEpilogue' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else if (!_seen_followupAll && _paramKey == "followupAll") { + _seen_followupAll = true; + + // Parse variable 'followupAll' + _result_followupAll = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_followupAll)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return LoopVectorizeAttr::get(odsParser.getContext(), + BoolAttr((_result_disable.value_or(BoolAttr()))), + BoolAttr((_result_predicateEnable.value_or(BoolAttr()))), + BoolAttr((_result_scalableEnable.value_or(BoolAttr()))), + IntegerAttr((_result_width.value_or(IntegerAttr()))), + LoopAnnotationAttr((_result_followupVectorized.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupEpilogue.value_or(LoopAnnotationAttr()))), + LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); +} + +void LoopVectorizeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getDisable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "disable = "; + if (!(getDisable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getDisable()); + } + } + if (!(getPredicateEnable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "predicateEnable = "; + if (!(getPredicateEnable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getPredicateEnable()); + } + } + if (!(getScalableEnable() == BoolAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "scalableEnable = "; + if (!(getScalableEnable() == BoolAttr())) { + odsPrinter.printStrippedAttrOrType(getScalableEnable()); + } + } + if (!(getWidth() == IntegerAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "width = "; + if (!(getWidth() == IntegerAttr())) { + odsPrinter.printStrippedAttrOrType(getWidth()); + } + } + if (!(getFollowupVectorized() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupVectorized = "; + if (!(getFollowupVectorized() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupVectorized()); + } + } + if (!(getFollowupEpilogue() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupEpilogue = "; + if (!(getFollowupEpilogue() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupEpilogue()); + } + } + if (!(getFollowupAll() == LoopAnnotationAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "followupAll = "; + if (!(getFollowupAll() == LoopAnnotationAttr())) { + odsPrinter.printStrippedAttrOrType(getFollowupAll()); + } + } + } + odsPrinter << ">"; +} + +BoolAttr LoopVectorizeAttr::getDisable() const { + return getImpl()->disable; +} + +BoolAttr LoopVectorizeAttr::getPredicateEnable() const { + return getImpl()->predicateEnable; +} + +BoolAttr LoopVectorizeAttr::getScalableEnable() const { + return getImpl()->scalableEnable; +} + +IntegerAttr LoopVectorizeAttr::getWidth() const { + return getImpl()->width; +} + +LoopAnnotationAttr LoopVectorizeAttr::getFollowupVectorized() const { + return getImpl()->followupVectorized; +} + +LoopAnnotationAttr LoopVectorizeAttr::getFollowupEpilogue() const { + return getImpl()->followupEpilogue; +} + +LoopAnnotationAttr LoopVectorizeAttr::getFollowupAll() const { + return getImpl()->followupAll; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopVectorizeAttr) +namespace mlir { +namespace LLVM { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute LLVMDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void LLVMDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace LLVM +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..44434dbeabbd8ce8d995a4b987a8484609a0c6ba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc @@ -0,0 +1,783 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace LLVM { +class CConvAttr; +class ComdatAttr; +class AccessGroupAttr; +class AliasScopeAttr; +class AliasScopeDomainAttr; +class DIBasicTypeAttr; +class DICompileUnitAttr; +class DICompositeTypeAttr; +class DIDerivedTypeAttr; +class DIFileAttr; +class DILabelAttr; +class DILexicalBlockAttr; +class DILexicalBlockFileAttr; +class DILocalVariableAttr; +class DIModuleAttr; +class DINamespaceAttr; +class DINullTypeAttr; +class DISubprogramAttr; +class DISubrangeAttr; +class DISubroutineTypeAttr; +class FastmathFlagsAttr; +class MemoryEffectsAttr; +class TBAAMemberAttr; +class TBAARootAttr; +class TBAATagAttr; +class TBAATypeDescriptorAttr; +class VScaleRangeAttr; +class LinkageAttr; +class LoopAnnotationAttr; +class LoopDistributeAttr; +class LoopInterleaveAttr; +class LoopLICMAttr; +class LoopPeeledAttr; +class LoopPipelineAttr; +class LoopUnrollAndJamAttr; +class LoopUnrollAttr; +class LoopUnswitchAttr; +class LoopVectorizeAttr; +namespace detail { +struct CConvAttrStorage; +} // namespace detail +class CConvAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static CConvAttr get(::mlir::MLIRContext *context, CConv CallingConv); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"cconv"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + CConv getCallingConv() const; +}; +namespace detail { +struct ComdatAttrStorage; +} // namespace detail +class ComdatAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ComdatAttr get(::mlir::MLIRContext *context, comdat::Comdat comdat); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"comdat"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + comdat::Comdat getComdat() const; +}; +namespace detail { +struct AccessGroupAttrStorage; +} // namespace detail +class AccessGroupAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static AccessGroupAttr get(::mlir::MLIRContext *context, DistinctAttr id); + static AccessGroupAttr get(::mlir::MLIRContext *context); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"access_group"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DistinctAttr getId() const; +}; +namespace detail { +struct AliasScopeAttrStorage; +} // namespace detail +class AliasScopeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static AliasScopeAttr get(::mlir::MLIRContext *context, DistinctAttr id, AliasScopeDomainAttr domain, StringAttr description); + static AliasScopeAttr get(AliasScopeDomainAttr domain, StringAttr description = {}); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"alias_scope"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DistinctAttr getId() const; + AliasScopeDomainAttr getDomain() const; + StringAttr getDescription() const; +}; +namespace detail { +struct AliasScopeDomainAttrStorage; +} // namespace detail +class AliasScopeDomainAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static AliasScopeDomainAttr get(::mlir::MLIRContext *context, DistinctAttr id, StringAttr description); + static AliasScopeDomainAttr get(::mlir::MLIRContext *context, StringAttr description = {}); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"alias_scope_domain"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DistinctAttr getId() const; + StringAttr getDescription() const; +}; +namespace detail { +struct DIBasicTypeAttrStorage; +} // namespace detail +class DIBasicTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DIBasicTypeAttr get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, uint64_t sizeInBits, unsigned encoding); + static DIBasicTypeAttr get(::mlir::MLIRContext *context, unsigned tag, const Twine &name, uint64_t sizeInBits, unsigned encoding); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_basic_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + unsigned getTag() const; + StringAttr getName() const; + uint64_t getSizeInBits() const; + unsigned getEncoding() const; +}; +namespace detail { +struct DICompileUnitAttrStorage; +} // namespace detail +class DICompileUnitAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DICompileUnitAttr get(::mlir::MLIRContext *context, unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_compile_unit"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + unsigned getSourceLanguage() const; + DIFileAttr getFile() const; + StringAttr getProducer() const; + bool getIsOptimized() const; + DIEmissionKind getEmissionKind() const; +}; +namespace detail { +struct DICompositeTypeAttrStorage; +} // namespace detail +class DICompositeTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DICompositeTypeAttr get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, DIFlags flags, uint64_t sizeInBits, uint64_t alignInBits, ::llvm::ArrayRef elements); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_composite_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + unsigned getTag() const; + StringAttr getName() const; + DIFileAttr getFile() const; + uint32_t getLine() const; + DIScopeAttr getScope() const; + DITypeAttr getBaseType() const; + DIFlags getFlags() const; + uint64_t getSizeInBits() const; + uint64_t getAlignInBits() const; + ::llvm::ArrayRef getElements() const; +}; +namespace detail { +struct DIDerivedTypeAttrStorage; +} // namespace detail +class DIDerivedTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DIDerivedTypeAttr get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_derived_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + unsigned getTag() const; + StringAttr getName() const; + DITypeAttr getBaseType() const; + uint64_t getSizeInBits() const; + uint32_t getAlignInBits() const; + uint64_t getOffsetInBits() const; +}; +namespace detail { +struct DIFileAttrStorage; +} // namespace detail +class DIFileAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DIFileAttr get(::mlir::MLIRContext *context, StringAttr name, StringAttr directory); + static DIFileAttr get(::mlir::MLIRContext *context, StringRef name, StringRef directory); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_file"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + StringAttr getName() const; + StringAttr getDirectory() const; +}; +namespace detail { +struct DILabelAttrStorage; +} // namespace detail +class DILabelAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DILabelAttr get(::mlir::MLIRContext *context, DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line); + static DILabelAttr get(DIScopeAttr scope, StringRef name, DIFileAttr file, unsigned line); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_label"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DIScopeAttr getScope() const; + StringAttr getName() const; + DIFileAttr getFile() const; + unsigned getLine() const; +}; +namespace detail { +struct DILexicalBlockAttrStorage; +} // namespace detail +class DILexicalBlockAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DILexicalBlockAttr get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column); + static DILexicalBlockAttr get(DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_lexical_block"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DIScopeAttr getScope() const; + DIFileAttr getFile() const; + unsigned getLine() const; + unsigned getColumn() const; +}; +namespace detail { +struct DILexicalBlockFileAttrStorage; +} // namespace detail +class DILexicalBlockFileAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DILexicalBlockFileAttr get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned discriminator); + static DILexicalBlockFileAttr get(DIScopeAttr scope, DIFileAttr file, unsigned discriminator); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_lexical_block_file"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DIScopeAttr getScope() const; + DIFileAttr getFile() const; + unsigned getDiscriminator() const; +}; +namespace detail { +struct DILocalVariableAttrStorage; +} // namespace detail +class DILocalVariableAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DILocalVariableAttr get(::mlir::MLIRContext *context, DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type); + static DILocalVariableAttr get(DIScopeAttr scope, StringRef name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_local_variable"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DIScopeAttr getScope() const; + StringAttr getName() const; + DIFileAttr getFile() const; + unsigned getLine() const; + unsigned getArg() const; + unsigned getAlignInBits() const; + DITypeAttr getType() const; +}; +namespace detail { +struct DIModuleAttrStorage; +} // namespace detail +class DIModuleAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DIModuleAttr get(::mlir::MLIRContext *context, DIFileAttr file, DIScopeAttr scope, StringAttr name, StringAttr configMacros, StringAttr includePath, StringAttr apinotes, unsigned line, bool isDecl); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_module"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DIFileAttr getFile() const; + DIScopeAttr getScope() const; + StringAttr getName() const; + StringAttr getConfigMacros() const; + StringAttr getIncludePath() const; + StringAttr getApinotes() const; + unsigned getLine() const; + bool getIsDecl() const; +}; +namespace detail { +struct DINamespaceAttrStorage; +} // namespace detail +class DINamespaceAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DINamespaceAttr get(::mlir::MLIRContext *context, StringAttr name, DIScopeAttr scope, bool exportSymbols); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_namespace"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + StringAttr getName() const; + DIScopeAttr getScope() const; + bool getExportSymbols() const; +}; +class DINullTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_null_type"}; + } + +}; +namespace detail { +struct DISubprogramAttrStorage; +} // namespace detail +class DISubprogramAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DISubprogramAttr get(::mlir::MLIRContext *context, DICompileUnitAttr compileUnit, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type); + static DISubprogramAttr get(DICompileUnitAttr compileUnit, DIScopeAttr scope, StringRef name, StringRef linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_subprogram"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DICompileUnitAttr getCompileUnit() const; + DIScopeAttr getScope() const; + StringAttr getName() const; + StringAttr getLinkageName() const; + DIFileAttr getFile() const; + unsigned getLine() const; + unsigned getScopeLine() const; + DISubprogramFlags getSubprogramFlags() const; + DISubroutineTypeAttr getType() const; +}; +namespace detail { +struct DISubrangeAttrStorage; +} // namespace detail +class DISubrangeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DISubrangeAttr get(::mlir::MLIRContext *context, IntegerAttr count, IntegerAttr lowerBound, IntegerAttr upperBound, IntegerAttr stride); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_subrange"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + IntegerAttr getCount() const; + IntegerAttr getLowerBound() const; + IntegerAttr getUpperBound() const; + IntegerAttr getStride() const; +}; +namespace detail { +struct DISubroutineTypeAttrStorage; +} // namespace detail +class DISubroutineTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DISubroutineTypeAttr get(::mlir::MLIRContext *context, unsigned callingConvention, ::llvm::ArrayRef types); + static DISubroutineTypeAttr get(::mlir::MLIRContext *context, ArrayRef types); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"di_subroutine_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + unsigned getCallingConvention() const; + ::llvm::ArrayRef getTypes() const; +}; +namespace detail { +struct FastmathFlagsAttrStorage; +} // namespace detail +class FastmathFlagsAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static FastmathFlagsAttr get(::mlir::MLIRContext *context, ::mlir::LLVM::FastmathFlags value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"fastmath"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::LLVM::FastmathFlags getValue() const; +}; +namespace detail { +struct MemoryEffectsAttrStorage; +} // namespace detail +class MemoryEffectsAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + bool isReadWrite(); + static MemoryEffectsAttr get(::mlir::MLIRContext *context, ModRefInfo other, ModRefInfo argMem, ModRefInfo inaccessibleMem); + static MemoryEffectsAttr get(::mlir::MLIRContext *context, ArrayRef memInfoArgs); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"memory_effects"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ModRefInfo getOther() const; + ModRefInfo getArgMem() const; + ModRefInfo getInaccessibleMem() const; +}; +namespace detail { +struct TBAAMemberAttrStorage; +} // namespace detail +class TBAAMemberAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TBAAMemberAttr get(::mlir::MLIRContext *context, TBAANodeAttr typeDesc, int64_t offset); + static TBAAMemberAttr get(TBAANodeAttr typeDesc, int64_t offset); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"tbaa_member"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + TBAANodeAttr getTypeDesc() const; + int64_t getOffset() const; +}; +namespace detail { +struct TBAARootAttrStorage; +} // namespace detail +class TBAARootAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TBAARootAttr get(::mlir::MLIRContext *context, StringAttr id); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"tbaa_root"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + StringAttr getId() const; +}; +namespace detail { +struct TBAATagAttrStorage; +} // namespace detail +class TBAATagAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TBAATagAttr get(::mlir::MLIRContext *context, TBAATypeDescriptorAttr base_type, TBAATypeDescriptorAttr access_type, int64_t offset, bool constant); + static TBAATagAttr get(TBAATypeDescriptorAttr baseType, TBAATypeDescriptorAttr accessType, int64_t offset); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"tbaa_tag"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + TBAATypeDescriptorAttr getBaseType() const; + TBAATypeDescriptorAttr getAccessType() const; + int64_t getOffset() const; + bool getConstant() const; +}; +namespace detail { +struct TBAATypeDescriptorAttrStorage; +} // namespace detail +class TBAATypeDescriptorAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TBAATypeDescriptorAttr get(::mlir::MLIRContext *context, ::llvm::StringRef id, ::llvm::ArrayRef members); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"tbaa_type_desc"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::StringRef getId() const; + ::llvm::ArrayRef getMembers() const; +}; +namespace detail { +struct VScaleRangeAttrStorage; +} // namespace detail +class VScaleRangeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static VScaleRangeAttr get(::mlir::MLIRContext *context, IntegerAttr minRange, IntegerAttr maxRange); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"vscale_range"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + IntegerAttr getMinRange() const; + IntegerAttr getMaxRange() const; +}; +namespace detail { +struct LinkageAttrStorage; +} // namespace detail +class LinkageAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LinkageAttr get(::mlir::MLIRContext *context, linkage::Linkage linkage); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"linkage"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + linkage::Linkage getLinkage() const; +}; +namespace detail { +struct LoopAnnotationAttrStorage; +} // namespace detail +class LoopAnnotationAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopAnnotationAttr get(::mlir::MLIRContext *context, BoolAttr disableNonforced, LoopVectorizeAttr vectorize, LoopInterleaveAttr interleave, LoopUnrollAttr unroll, LoopUnrollAndJamAttr unrollAndJam, LoopLICMAttr licm, LoopDistributeAttr distribute, LoopPipelineAttr pipeline, LoopPeeledAttr peeled, LoopUnswitchAttr unswitch, BoolAttr mustProgress, BoolAttr isVectorized, ::llvm::ArrayRef parallelAccesses, FusedLoc startLoc, FusedLoc endLoc); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_annotation"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + BoolAttr getDisableNonforced() const; + LoopVectorizeAttr getVectorize() const; + LoopInterleaveAttr getInterleave() const; + LoopUnrollAttr getUnroll() const; + LoopUnrollAndJamAttr getUnrollAndJam() const; + LoopLICMAttr getLicm() const; + LoopDistributeAttr getDistribute() const; + LoopPipelineAttr getPipeline() const; + LoopPeeledAttr getPeeled() const; + LoopUnswitchAttr getUnswitch() const; + BoolAttr getMustProgress() const; + BoolAttr getIsVectorized() const; + ::llvm::ArrayRef getParallelAccesses() const; + FusedLoc getStartLoc() const; + FusedLoc getEndLoc() const; +}; +namespace detail { +struct LoopDistributeAttrStorage; +} // namespace detail +class LoopDistributeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopDistributeAttr get(::mlir::MLIRContext *context, BoolAttr disable, LoopAnnotationAttr followupCoincident, LoopAnnotationAttr followupSequential, LoopAnnotationAttr followupFallback, LoopAnnotationAttr followupAll); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_distribute"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + BoolAttr getDisable() const; + LoopAnnotationAttr getFollowupCoincident() const; + LoopAnnotationAttr getFollowupSequential() const; + LoopAnnotationAttr getFollowupFallback() const; + LoopAnnotationAttr getFollowupAll() const; +}; +namespace detail { +struct LoopInterleaveAttrStorage; +} // namespace detail +class LoopInterleaveAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopInterleaveAttr get(::mlir::MLIRContext *context, IntegerAttr count); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_interleave"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + IntegerAttr getCount() const; +}; +namespace detail { +struct LoopLICMAttrStorage; +} // namespace detail +class LoopLICMAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopLICMAttr get(::mlir::MLIRContext *context, BoolAttr disable, BoolAttr versioningDisable); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_licm"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + BoolAttr getDisable() const; + BoolAttr getVersioningDisable() const; +}; +namespace detail { +struct LoopPeeledAttrStorage; +} // namespace detail +class LoopPeeledAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopPeeledAttr get(::mlir::MLIRContext *context, IntegerAttr count); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_peeled"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + IntegerAttr getCount() const; +}; +namespace detail { +struct LoopPipelineAttrStorage; +} // namespace detail +class LoopPipelineAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopPipelineAttr get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr initiationinterval); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_pipeline"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + BoolAttr getDisable() const; + IntegerAttr getInitiationinterval() const; +}; +namespace detail { +struct LoopUnrollAndJamAttrStorage; +} // namespace detail +class LoopUnrollAndJamAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopUnrollAndJamAttr get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr count, LoopAnnotationAttr followupOuter, LoopAnnotationAttr followupInner, LoopAnnotationAttr followupRemainderOuter, LoopAnnotationAttr followupRemainderInner, LoopAnnotationAttr followupAll); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_unroll_and_jam"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + BoolAttr getDisable() const; + IntegerAttr getCount() const; + LoopAnnotationAttr getFollowupOuter() const; + LoopAnnotationAttr getFollowupInner() const; + LoopAnnotationAttr getFollowupRemainderOuter() const; + LoopAnnotationAttr getFollowupRemainderInner() const; + LoopAnnotationAttr getFollowupAll() const; +}; +namespace detail { +struct LoopUnrollAttrStorage; +} // namespace detail +class LoopUnrollAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopUnrollAttr get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr count, BoolAttr runtimeDisable, BoolAttr full, LoopAnnotationAttr followupUnrolled, LoopAnnotationAttr followupRemainder, LoopAnnotationAttr followupAll); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_unroll"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + BoolAttr getDisable() const; + IntegerAttr getCount() const; + BoolAttr getRuntimeDisable() const; + BoolAttr getFull() const; + LoopAnnotationAttr getFollowupUnrolled() const; + LoopAnnotationAttr getFollowupRemainder() const; + LoopAnnotationAttr getFollowupAll() const; +}; +namespace detail { +struct LoopUnswitchAttrStorage; +} // namespace detail +class LoopUnswitchAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopUnswitchAttr get(::mlir::MLIRContext *context, BoolAttr partialDisable); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_unswitch"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + BoolAttr getPartialDisable() const; +}; +namespace detail { +struct LoopVectorizeAttrStorage; +} // namespace detail +class LoopVectorizeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoopVectorizeAttr get(::mlir::MLIRContext *context, BoolAttr disable, BoolAttr predicateEnable, BoolAttr scalableEnable, IntegerAttr width, LoopAnnotationAttr followupVectorized, LoopAnnotationAttr followupEpilogue, LoopAnnotationAttr followupAll); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"loop_vectorize"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + BoolAttr getDisable() const; + BoolAttr getPredicateEnable() const; + BoolAttr getScalableEnable() const; + IntegerAttr getWidth() const; + LoopAnnotationAttr getFollowupVectorized() const; + LoopAnnotationAttr getFollowupEpilogue() const; + LoopAnnotationAttr getFollowupAll() const; +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::CConvAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::ComdatAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AccessGroupAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AliasScopeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::AliasScopeDomainAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIBasicTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompileUnitAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompositeTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIDerivedTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIFileAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILabelAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockFileAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILocalVariableAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIModuleAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DINamespaceAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DINullTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubprogramAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubrangeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubroutineTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::FastmathFlagsAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemoryEffectsAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAAMemberAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAARootAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAATagAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAATypeDescriptorAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::VScaleRangeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LinkageAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopAnnotationAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopDistributeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopInterleaveAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopLICMAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopPeeledAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopPipelineAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnrollAndJamAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnrollAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnswitchAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopVectorizeAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..8cd4eb2a654d3b64e9b053da3bfc61749d35c5d6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LLVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMDialect) +namespace mlir { +namespace LLVM { + +LLVMDialect::LLVMDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +LLVMDialect::~LLVMDialect() = default; + +} // namespace LLVM +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..36aed85ba687c1f489a30c956a9729de01197b08 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsDialect.h.inc @@ -0,0 +1,132 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LLVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace LLVM { + +class LLVMDialect : public ::mlir::Dialect { + explicit LLVMDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~LLVMDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("llvm"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Materialize a single constant operation from a given attribute value with + /// the desired resultant type. + ::mlir::Operation *materializeConstant(::mlir::OpBuilder &builder, + ::mlir::Attribute value, + ::mlir::Type type, + ::mlir::Location loc) override; + + /// Provides a hook for verifying dialect attributes attached to the given + /// op. + ::mlir::LogicalResult verifyOperationAttribute( + ::mlir::Operation *op, ::mlir::NamedAttribute attribute) override; + + /// Provides a hook for verifying dialect attributes attached to the given + /// op's region argument. + ::mlir::LogicalResult verifyRegionArgAttribute( + ::mlir::Operation *op, unsigned regionIndex, unsigned argIndex, + ::mlir::NamedAttribute attribute) override; + + /// Provides a hook for verifying dialect attributes attached to the given + /// op's region result. + ::mlir::LogicalResult verifyRegionResultAttribute( + ::mlir::Operation *op, unsigned regionIndex, unsigned resultIndex, + ::mlir::NamedAttribute attribute) override; + + /// Name of the data layout attributes. + static StringRef getDataLayoutAttrName() { return "llvm.data_layout"; } + static StringRef getNoAliasScopesAttrName() { return "noalias_scopes"; } + static StringRef getAliasScopesAttrName() { return "alias_scopes"; } + static StringRef getAccessGroupsAttrName() { return "access_groups"; } + + /// Names of llvm parameter attributes. + static StringRef getAlignAttrName() { return "llvm.align"; } + static StringRef getAllocAlignAttrName() { return "llvm.allocalign"; } + static StringRef getAllocatedPointerAttrName() { return "llvm.allocptr"; } + static StringRef getByValAttrName() { return "llvm.byval"; } + static StringRef getByRefAttrName() { return "llvm.byref"; } + static StringRef getNoUndefAttrName() { return "llvm.noundef"; } + static StringRef getDereferenceableAttrName() { return "llvm.dereferenceable"; } + static StringRef getDereferenceableOrNullAttrName() { return "llvm.dereferenceable_or_null"; } + static StringRef getInAllocaAttrName() { return "llvm.inalloca"; } + static StringRef getInRegAttrName() { return "llvm.inreg"; } + static StringRef getNestAttrName() { return "llvm.nest"; } + static StringRef getNoAliasAttrName() { return "llvm.noalias"; } + static StringRef getNoCaptureAttrName() { return "llvm.nocapture"; } + static StringRef getNoFreeAttrName() { return "llvm.nofree"; } + static StringRef getNonNullAttrName() { return "llvm.nonnull"; } + static StringRef getPreallocatedAttrName() { return "llvm.preallocated"; } + static StringRef getReadonlyAttrName() { return "llvm.readonly"; } + static StringRef getReturnedAttrName() { return "llvm.returned"; } + static StringRef getSExtAttrName() { return "llvm.signext"; } + static StringRef getStackAlignmentAttrName() { return "llvm.alignstack"; } + static StringRef getStructRetAttrName() { return "llvm.sret"; } + static StringRef getWriteOnlyAttrName() { return "llvm.writeonly"; } + static StringRef getZExtAttrName() { return "llvm.zeroext"; } + // TODO Restrict the usage of this to parameter attributes once there is an + // alternative way of modeling memory effects on FunctionOpInterface. + /// Name of the attribute that will cause the creation of a readnone memory + /// effect when lowering to the LLVMDialect. + static StringRef getReadnoneAttrName() { return "llvm.readnone"; } + + /// Verifies if the given string is a well-formed data layout descriptor. + /// Uses `reportError` to report errors. + static LogicalResult verifyDataLayoutString( + StringRef descr, llvm::function_ref reportError); + + /// Name of the target triple attribute. + static StringRef getTargetTripleAttrName() { return "llvm.target_triple"; } + + /// Name of the C wrapper emission attribute. + static StringRef getEmitCWrapperAttrName() { + return "llvm.emit_c_interface"; + } + + /// Returns `true` if the given type is compatible with the LLVM dialect. + static bool isCompatibleType(Type); + + + Type parseType(DialectAsmParser &p) const override; + void printType(Type, DialectAsmPrinter &p) const override; + + private: + /// Verifies a parameter attribute attached to a parameter of type + /// paramType. + LogicalResult verifyParameterAttribute(Operation *op, + Type paramType, + NamedAttribute paramAttr); + + /// Register all types. + void registerTypes(); + + /// A cache storing compatible LLVM types that have been verified. This + /// can save us lots of verification time if there are many occurrences + /// of some deeply-nested aggregate types in the program. + ThreadLocalCache> compatibleTypes; + + /// Register the attributes of this dialect. + void registerAttributes(); + }; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..9332cac378808910d192b1574f0887fe364461db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsEnums.cpp.inc @@ -0,0 +1,1135 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LLVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace LLVM { +::llvm::StringRef stringifyAsmDialect(AsmDialect val) { + switch (val) { + case AsmDialect::AD_ATT: return "att"; + case AsmDialect::AD_Intel: return "intel"; + } + return ""; +} + +::std::optional symbolizeAsmDialect(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("att", AsmDialect::AD_ATT) + .Case("intel", AsmDialect::AD_Intel) + .Default(::std::nullopt); +} +::std::optional symbolizeAsmDialect(uint64_t value) { + switch (value) { + case 0: return AsmDialect::AD_ATT; + case 1: return AsmDialect::AD_Intel; + default: return ::std::nullopt; + } +} + +bool AsmDialectAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1))); +} +AsmDialectAttr AsmDialectAttr::get(::mlir::MLIRContext *context, AsmDialect val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +AsmDialect AsmDialectAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +::llvm::StringRef stringifyAtomicBinOp(AtomicBinOp val) { + switch (val) { + case AtomicBinOp::xchg: return "xchg"; + case AtomicBinOp::add: return "add"; + case AtomicBinOp::sub: return "sub"; + case AtomicBinOp::_and: return "_and"; + case AtomicBinOp::nand: return "nand"; + case AtomicBinOp::_or: return "_or"; + case AtomicBinOp::_xor: return "_xor"; + case AtomicBinOp::max: return "max"; + case AtomicBinOp::min: return "min"; + case AtomicBinOp::umax: return "umax"; + case AtomicBinOp::umin: return "umin"; + case AtomicBinOp::fadd: return "fadd"; + case AtomicBinOp::fsub: return "fsub"; + case AtomicBinOp::fmax: return "fmax"; + case AtomicBinOp::fmin: return "fmin"; + case AtomicBinOp::uinc_wrap: return "uinc_wrap"; + case AtomicBinOp::udec_wrap: return "udec_wrap"; + } + return ""; +} + +::std::optional symbolizeAtomicBinOp(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("xchg", AtomicBinOp::xchg) + .Case("add", AtomicBinOp::add) + .Case("sub", AtomicBinOp::sub) + .Case("_and", AtomicBinOp::_and) + .Case("nand", AtomicBinOp::nand) + .Case("_or", AtomicBinOp::_or) + .Case("_xor", AtomicBinOp::_xor) + .Case("max", AtomicBinOp::max) + .Case("min", AtomicBinOp::min) + .Case("umax", AtomicBinOp::umax) + .Case("umin", AtomicBinOp::umin) + .Case("fadd", AtomicBinOp::fadd) + .Case("fsub", AtomicBinOp::fsub) + .Case("fmax", AtomicBinOp::fmax) + .Case("fmin", AtomicBinOp::fmin) + .Case("uinc_wrap", AtomicBinOp::uinc_wrap) + .Case("udec_wrap", AtomicBinOp::udec_wrap) + .Default(::std::nullopt); +} +::std::optional symbolizeAtomicBinOp(uint64_t value) { + switch (value) { + case 0: return AtomicBinOp::xchg; + case 1: return AtomicBinOp::add; + case 2: return AtomicBinOp::sub; + case 3: return AtomicBinOp::_and; + case 4: return AtomicBinOp::nand; + case 5: return AtomicBinOp::_or; + case 6: return AtomicBinOp::_xor; + case 7: return AtomicBinOp::max; + case 8: return AtomicBinOp::min; + case 9: return AtomicBinOp::umax; + case 10: return AtomicBinOp::umin; + case 11: return AtomicBinOp::fadd; + case 12: return AtomicBinOp::fsub; + case 13: return AtomicBinOp::fmax; + case 14: return AtomicBinOp::fmin; + case 15: return AtomicBinOp::uinc_wrap; + case 16: return AtomicBinOp::udec_wrap; + default: return ::std::nullopt; + } +} + +bool AtomicBinOpAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 7)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 8)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 9)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 10)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 11)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 12)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 13)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 14)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 15)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 16))); +} +AtomicBinOpAttr AtomicBinOpAttr::get(::mlir::MLIRContext *context, AtomicBinOp val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +AtomicBinOp AtomicBinOpAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +::llvm::StringRef stringifyAtomicOrdering(AtomicOrdering val) { + switch (val) { + case AtomicOrdering::not_atomic: return "not_atomic"; + case AtomicOrdering::unordered: return "unordered"; + case AtomicOrdering::monotonic: return "monotonic"; + case AtomicOrdering::acquire: return "acquire"; + case AtomicOrdering::release: return "release"; + case AtomicOrdering::acq_rel: return "acq_rel"; + case AtomicOrdering::seq_cst: return "seq_cst"; + } + return ""; +} + +::std::optional symbolizeAtomicOrdering(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("not_atomic", AtomicOrdering::not_atomic) + .Case("unordered", AtomicOrdering::unordered) + .Case("monotonic", AtomicOrdering::monotonic) + .Case("acquire", AtomicOrdering::acquire) + .Case("release", AtomicOrdering::release) + .Case("acq_rel", AtomicOrdering::acq_rel) + .Case("seq_cst", AtomicOrdering::seq_cst) + .Default(::std::nullopt); +} +::std::optional symbolizeAtomicOrdering(uint64_t value) { + switch (value) { + case 0: return AtomicOrdering::not_atomic; + case 1: return AtomicOrdering::unordered; + case 2: return AtomicOrdering::monotonic; + case 4: return AtomicOrdering::acquire; + case 5: return AtomicOrdering::release; + case 6: return AtomicOrdering::acq_rel; + case 7: return AtomicOrdering::seq_cst; + default: return ::std::nullopt; + } +} + +bool AtomicOrderingAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 7))); +} +AtomicOrderingAttr AtomicOrderingAttr::get(::mlir::MLIRContext *context, AtomicOrdering val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +AtomicOrdering AtomicOrderingAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +namespace cconv { +::llvm::StringRef stringifyCConv(CConv val) { + switch (val) { + case CConv::C: return "ccc"; + case CConv::Fast: return "fastcc"; + case CConv::Cold: return "coldcc"; + case CConv::GHC: return "cc_10"; + case CConv::HiPE: return "cc_11"; + case CConv::WebKit_JS: return "webkit_jscc"; + case CConv::AnyReg: return "anyregcc"; + case CConv::PreserveMost: return "preserve_mostcc"; + case CConv::PreserveAll: return "preserve_allcc"; + case CConv::Swift: return "swiftcc"; + case CConv::CXX_FAST_TLS: return "cxx_fast_tlscc"; + case CConv::Tail: return "tailcc"; + case CConv::CFGuard_Check: return "cfguard_checkcc"; + case CConv::SwiftTail: return "swifttailcc"; + case CConv::X86_StdCall: return "x86_stdcallcc"; + case CConv::X86_FastCall: return "x86_fastcallcc"; + case CConv::ARM_APCS: return "arm_apcscc"; + case CConv::ARM_AAPCS: return "arm_aapcscc"; + case CConv::ARM_AAPCS_VFP: return "arm_aapcs_vfpcc"; + case CConv::MSP430_INTR: return "msp430_intrcc"; + case CConv::X86_ThisCall: return "x86_thiscallcc"; + case CConv::PTX_Kernel: return "ptx_kernelcc"; + case CConv::PTX_Device: return "ptx_devicecc"; + case CConv::SPIR_FUNC: return "spir_funccc"; + case CConv::SPIR_KERNEL: return "spir_kernelcc"; + case CConv::Intel_OCL_BI: return "intel_ocl_bicc"; + case CConv::X86_64_SysV: return "x86_64_sysvcc"; + case CConv::Win64: return "win64cc"; + case CConv::X86_VectorCall: return "x86_vectorcallcc"; + case CConv::DUMMY_HHVM: return "hhvmcc"; + case CConv::DUMMY_HHVM_C: return "hhvm_ccc"; + case CConv::X86_INTR: return "x86_intrcc"; + case CConv::AVR_INTR: return "avr_intrcc"; + case CConv::AVR_BUILTIN: return "avr_builtincc"; + case CConv::AMDGPU_VS: return "amdgpu_vscc"; + case CConv::AMDGPU_GS: return "amdgpu_gscc"; + case CConv::AMDGPU_CS: return "amdgpu_cscc"; + case CConv::AMDGPU_KERNEL: return "amdgpu_kernelcc"; + case CConv::X86_RegCall: return "x86_regcallcc"; + case CConv::AMDGPU_HS: return "amdgpu_hscc"; + case CConv::MSP430_BUILTIN: return "msp430_builtincc"; + case CConv::AMDGPU_LS: return "amdgpu_lscc"; + case CConv::AMDGPU_ES: return "amdgpu_escc"; + case CConv::AArch64_VectorCall: return "aarch64_vectorcallcc"; + case CConv::AArch64_SVE_VectorCall: return "aarch64_sve_vectorcallcc"; + case CConv::WASM_EmscriptenInvoke: return "wasm_emscripten_invokecc"; + case CConv::AMDGPU_Gfx: return "amdgpu_gfxcc"; + case CConv::M68k_INTR: return "m68k_intrcc"; + } + return ""; +} + +::std::optional symbolizeCConv(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("ccc", CConv::C) + .Case("fastcc", CConv::Fast) + .Case("coldcc", CConv::Cold) + .Case("cc_10", CConv::GHC) + .Case("cc_11", CConv::HiPE) + .Case("webkit_jscc", CConv::WebKit_JS) + .Case("anyregcc", CConv::AnyReg) + .Case("preserve_mostcc", CConv::PreserveMost) + .Case("preserve_allcc", CConv::PreserveAll) + .Case("swiftcc", CConv::Swift) + .Case("cxx_fast_tlscc", CConv::CXX_FAST_TLS) + .Case("tailcc", CConv::Tail) + .Case("cfguard_checkcc", CConv::CFGuard_Check) + .Case("swifttailcc", CConv::SwiftTail) + .Case("x86_stdcallcc", CConv::X86_StdCall) + .Case("x86_fastcallcc", CConv::X86_FastCall) + .Case("arm_apcscc", CConv::ARM_APCS) + .Case("arm_aapcscc", CConv::ARM_AAPCS) + .Case("arm_aapcs_vfpcc", CConv::ARM_AAPCS_VFP) + .Case("msp430_intrcc", CConv::MSP430_INTR) + .Case("x86_thiscallcc", CConv::X86_ThisCall) + .Case("ptx_kernelcc", CConv::PTX_Kernel) + .Case("ptx_devicecc", CConv::PTX_Device) + .Case("spir_funccc", CConv::SPIR_FUNC) + .Case("spir_kernelcc", CConv::SPIR_KERNEL) + .Case("intel_ocl_bicc", CConv::Intel_OCL_BI) + .Case("x86_64_sysvcc", CConv::X86_64_SysV) + .Case("win64cc", CConv::Win64) + .Case("x86_vectorcallcc", CConv::X86_VectorCall) + .Case("hhvmcc", CConv::DUMMY_HHVM) + .Case("hhvm_ccc", CConv::DUMMY_HHVM_C) + .Case("x86_intrcc", CConv::X86_INTR) + .Case("avr_intrcc", CConv::AVR_INTR) + .Case("avr_builtincc", CConv::AVR_BUILTIN) + .Case("amdgpu_vscc", CConv::AMDGPU_VS) + .Case("amdgpu_gscc", CConv::AMDGPU_GS) + .Case("amdgpu_cscc", CConv::AMDGPU_CS) + .Case("amdgpu_kernelcc", CConv::AMDGPU_KERNEL) + .Case("x86_regcallcc", CConv::X86_RegCall) + .Case("amdgpu_hscc", CConv::AMDGPU_HS) + .Case("msp430_builtincc", CConv::MSP430_BUILTIN) + .Case("amdgpu_lscc", CConv::AMDGPU_LS) + .Case("amdgpu_escc", CConv::AMDGPU_ES) + .Case("aarch64_vectorcallcc", CConv::AArch64_VectorCall) + .Case("aarch64_sve_vectorcallcc", CConv::AArch64_SVE_VectorCall) + .Case("wasm_emscripten_invokecc", CConv::WASM_EmscriptenInvoke) + .Case("amdgpu_gfxcc", CConv::AMDGPU_Gfx) + .Case("m68k_intrcc", CConv::M68k_INTR) + .Default(::std::nullopt); +} +::std::optional symbolizeCConv(uint64_t value) { + switch (value) { + case 0: return CConv::C; + case 8: return CConv::Fast; + case 9: return CConv::Cold; + case 10: return CConv::GHC; + case 11: return CConv::HiPE; + case 12: return CConv::WebKit_JS; + case 13: return CConv::AnyReg; + case 14: return CConv::PreserveMost; + case 15: return CConv::PreserveAll; + case 16: return CConv::Swift; + case 17: return CConv::CXX_FAST_TLS; + case 18: return CConv::Tail; + case 19: return CConv::CFGuard_Check; + case 20: return CConv::SwiftTail; + case 64: return CConv::X86_StdCall; + case 65: return CConv::X86_FastCall; + case 66: return CConv::ARM_APCS; + case 67: return CConv::ARM_AAPCS; + case 68: return CConv::ARM_AAPCS_VFP; + case 69: return CConv::MSP430_INTR; + case 70: return CConv::X86_ThisCall; + case 71: return CConv::PTX_Kernel; + case 72: return CConv::PTX_Device; + case 75: return CConv::SPIR_FUNC; + case 76: return CConv::SPIR_KERNEL; + case 77: return CConv::Intel_OCL_BI; + case 78: return CConv::X86_64_SysV; + case 79: return CConv::Win64; + case 80: return CConv::X86_VectorCall; + case 81: return CConv::DUMMY_HHVM; + case 82: return CConv::DUMMY_HHVM_C; + case 83: return CConv::X86_INTR; + case 84: return CConv::AVR_INTR; + case 86: return CConv::AVR_BUILTIN; + case 87: return CConv::AMDGPU_VS; + case 88: return CConv::AMDGPU_GS; + case 90: return CConv::AMDGPU_CS; + case 91: return CConv::AMDGPU_KERNEL; + case 92: return CConv::X86_RegCall; + case 93: return CConv::AMDGPU_HS; + case 94: return CConv::MSP430_BUILTIN; + case 95: return CConv::AMDGPU_LS; + case 96: return CConv::AMDGPU_ES; + case 97: return CConv::AArch64_VectorCall; + case 98: return CConv::AArch64_SVE_VectorCall; + case 99: return CConv::WASM_EmscriptenInvoke; + case 100: return CConv::AMDGPU_Gfx; + case 101: return CConv::M68k_INTR; + default: return ::std::nullopt; + } +} + +bool CConvAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 8)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 9)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 10)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 11)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 12)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 13)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 14)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 15)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 16)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 17)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 18)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 19)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 20)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 64)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 65)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 66)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 67)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 68)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 69)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 70)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 71)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 72)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 75)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 76)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 77)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 78)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 79)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 80)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 81)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 82)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 83)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 84)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 86)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 87)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 88)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 90)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 91)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 92)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 93)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 94)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 95)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 96)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 97)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 98)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 99)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 100)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 101))); +} +CConvAttr CConvAttr::get(::mlir::MLIRContext *context, CConv val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +CConv CConvAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace cconv +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +namespace comdat { +::llvm::StringRef stringifyComdat(Comdat val) { + switch (val) { + case Comdat::Any: return "any"; + case Comdat::ExactMatch: return "exactmatch"; + case Comdat::Largest: return "largest"; + case Comdat::NoDeduplicate: return "nodeduplicate"; + case Comdat::SameSize: return "samesize"; + } + return ""; +} + +::std::optional symbolizeComdat(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("any", Comdat::Any) + .Case("exactmatch", Comdat::ExactMatch) + .Case("largest", Comdat::Largest) + .Case("nodeduplicate", Comdat::NoDeduplicate) + .Case("samesize", Comdat::SameSize) + .Default(::std::nullopt); +} +::std::optional symbolizeComdat(uint64_t value) { + switch (value) { + case 0: return Comdat::Any; + case 1: return Comdat::ExactMatch; + case 2: return Comdat::Largest; + case 3: return Comdat::NoDeduplicate; + case 4: return Comdat::SameSize; + default: return ::std::nullopt; + } +} + +bool ComdatAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4))); +} +ComdatAttr ComdatAttr::get(::mlir::MLIRContext *context, Comdat val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +Comdat ComdatAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace comdat +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +std::string stringifyDIFlags(DIFlags symbol) { + auto val = static_cast(symbol); + assert(1071513599u == (1071513599u | val) && "invalid bits set in bit enum"); + // Special case for all bits unset. + if (val == 0) return "Zero"; + + ::llvm::SmallVector<::llvm::StringRef, 2> strs; + // Print bit enum groups before individual bits + + if (3u == (3u & val)) { + strs.push_back("Public"); + val &= ~static_cast(3); + } + + if (2u == (2u & val)) { + strs.push_back("Protected"); + val &= ~static_cast(2); + } + + if (1u == (1u & val)) { + strs.push_back("Private"); + val &= ~static_cast(1); + } + + if (1u == (1u & val)) + strs.push_back("Bit0"); + + if (2u == (2u & val)) + strs.push_back("Bit1"); + + if (4u == (4u & val)) + strs.push_back("FwdDecl"); + + if (8u == (8u & val)) + strs.push_back("AppleBlock"); + + if (16u == (16u & val)) + strs.push_back("ReservedBit4"); + + if (32u == (32u & val)) + strs.push_back("Virtual"); + + if (64u == (64u & val)) + strs.push_back("Artificial"); + + if (128u == (128u & val)) + strs.push_back("Explicit"); + + if (256u == (256u & val)) + strs.push_back("Prototyped"); + + if (512u == (512u & val)) + strs.push_back("ObjcClassComplete"); + + if (1024u == (1024u & val)) + strs.push_back("ObjectPointer"); + + if (2048u == (2048u & val)) + strs.push_back("Vector"); + + if (4096u == (4096u & val)) + strs.push_back("StaticMember"); + + if (8192u == (8192u & val)) + strs.push_back("LValueReference"); + + if (16384u == (16384u & val)) + strs.push_back("RValueReference"); + + if (32768u == (32768u & val)) + strs.push_back("ExportSymbols"); + + if (65536u == (65536u & val)) + strs.push_back("SingleInheritance"); + + if (65536u == (65536u & val)) + strs.push_back("MultipleInheritance"); + + if (65536u == (65536u & val)) + strs.push_back("VirtualInheritance"); + + if (262144u == (262144u & val)) + strs.push_back("IntroducedVirtual"); + + if (524288u == (524288u & val)) + strs.push_back("BitField"); + + if (1048576u == (1048576u & val)) + strs.push_back("NoReturn"); + + if (4194304u == (4194304u & val)) + strs.push_back("TypePassByValue"); + + if (8388608u == (8388608u & val)) + strs.push_back("TypePassByReference"); + + if (16777216u == (16777216u & val)) + strs.push_back("EnumClass"); + + if (33554432u == (33554432u & val)) + strs.push_back("Thunk"); + + if (67108864u == (67108864u & val)) + strs.push_back("NonTrivial"); + + if (134217728u == (134217728u & val)) + strs.push_back("BigEndian"); + + if (268435456u == (268435456u & val)) + strs.push_back("LittleEndian"); + + if (536870912u == (536870912u & val)) + strs.push_back("AllCallsDescribed"); + return ::llvm::join(strs, "|"); +} + +::std::optional symbolizeDIFlags(::llvm::StringRef str) { + // Special case for all bits unset. + if (str == "Zero") return DIFlags::Zero; + + ::llvm::SmallVector<::llvm::StringRef, 2> symbols; + str.split(symbols, "|"); + + uint32_t val = 0; + for (auto symbol : symbols) { + auto bit = llvm::StringSwitch<::std::optional>(symbol.trim()) + .Case("Bit0", 1) + .Case("Bit1", 2) + .Case("Private", 1) + .Case("Protected", 2) + .Case("Public", 3) + .Case("FwdDecl", 4) + .Case("AppleBlock", 8) + .Case("ReservedBit4", 16) + .Case("Virtual", 32) + .Case("Artificial", 64) + .Case("Explicit", 128) + .Case("Prototyped", 256) + .Case("ObjcClassComplete", 512) + .Case("ObjectPointer", 1024) + .Case("Vector", 2048) + .Case("StaticMember", 4096) + .Case("LValueReference", 8192) + .Case("RValueReference", 16384) + .Case("ExportSymbols", 32768) + .Case("SingleInheritance", 65536) + .Case("MultipleInheritance", 65536) + .Case("VirtualInheritance", 65536) + .Case("IntroducedVirtual", 262144) + .Case("BitField", 524288) + .Case("NoReturn", 1048576) + .Case("TypePassByValue", 4194304) + .Case("TypePassByReference", 8388608) + .Case("EnumClass", 16777216) + .Case("Thunk", 33554432) + .Case("NonTrivial", 67108864) + .Case("BigEndian", 134217728) + .Case("LittleEndian", 268435456) + .Case("AllCallsDescribed", 536870912) + .Default(::std::nullopt); + if (bit) { val |= *bit; } else { return ::std::nullopt; } + } + return static_cast(val); +} + +::std::optional symbolizeDIFlags(uint32_t value) { + // Special case for all bits unset. + if (value == 0) return DIFlags::Zero; + + if (value & ~static_cast(1071513599u)) return std::nullopt; + return static_cast(value); +} +bool DIFlagsAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!(::llvm::cast<::mlir::IntegerAttr>(attr).getValue().getZExtValue() & (~(0u|1u|2u|1u|2u|3u|4u|8u|16u|32u|64u|128u|256u|512u|1024u|2048u|4096u|8192u|16384u|32768u|65536u|65536u|65536u|262144u|524288u|1048576u|4194304u|8388608u|16777216u|33554432u|67108864u|134217728u|268435456u|536870912u))))); +} +DIFlagsAttr DIFlagsAttr::get(::mlir::MLIRContext *context, DIFlags val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 32); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +DIFlags DIFlagsAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +std::string stringifyDISubprogramFlags(DISubprogramFlags symbol) { + auto val = static_cast(symbol); + assert(3071u == (3071u | val) && "invalid bits set in bit enum"); + ::llvm::SmallVector<::llvm::StringRef, 2> strs; + // Print bit enum groups before individual bits + + if (1u == (1u & val)) + strs.push_back("Virtual"); + + if (2u == (2u & val)) + strs.push_back("PureVirtual"); + + if (4u == (4u & val)) + strs.push_back("LocalToUnit"); + + if (8u == (8u & val)) + strs.push_back("Definition"); + + if (16u == (16u & val)) + strs.push_back("Optimized"); + + if (32u == (32u & val)) + strs.push_back("Pure"); + + if (64u == (64u & val)) + strs.push_back("Elemental"); + + if (128u == (128u & val)) + strs.push_back("Recursive"); + + if (256u == (256u & val)) + strs.push_back("MainSubprogram"); + + if (512u == (512u & val)) + strs.push_back("Deleted"); + + if (2048u == (2048u & val)) + strs.push_back("ObjCDirect"); + return ::llvm::join(strs, "|"); +} + +::std::optional symbolizeDISubprogramFlags(::llvm::StringRef str) { + ::llvm::SmallVector<::llvm::StringRef, 2> symbols; + str.split(symbols, "|"); + + uint32_t val = 0; + for (auto symbol : symbols) { + auto bit = llvm::StringSwitch<::std::optional>(symbol.trim()) + .Case("Virtual", 1) + .Case("PureVirtual", 2) + .Case("LocalToUnit", 4) + .Case("Definition", 8) + .Case("Optimized", 16) + .Case("Pure", 32) + .Case("Elemental", 64) + .Case("Recursive", 128) + .Case("MainSubprogram", 256) + .Case("Deleted", 512) + .Case("ObjCDirect", 2048) + .Default(::std::nullopt); + if (bit) { val |= *bit; } else { return ::std::nullopt; } + } + return static_cast(val); +} + +::std::optional symbolizeDISubprogramFlags(uint32_t value) { + if (value & ~static_cast(3071u)) return std::nullopt; + return static_cast(value); +} +bool DISubprogramFlagsAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!(::llvm::cast<::mlir::IntegerAttr>(attr).getValue().getZExtValue() & (~(1u|2u|4u|8u|16u|32u|64u|128u|256u|512u|2048u))))); +} +DISubprogramFlagsAttr DISubprogramFlagsAttr::get(::mlir::MLIRContext *context, DISubprogramFlags val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 32); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +DISubprogramFlags DISubprogramFlagsAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +::llvm::StringRef stringifyFCmpPredicate(FCmpPredicate val) { + switch (val) { + case FCmpPredicate::_false: return "_false"; + case FCmpPredicate::oeq: return "oeq"; + case FCmpPredicate::ogt: return "ogt"; + case FCmpPredicate::oge: return "oge"; + case FCmpPredicate::olt: return "olt"; + case FCmpPredicate::ole: return "ole"; + case FCmpPredicate::one: return "one"; + case FCmpPredicate::ord: return "ord"; + case FCmpPredicate::ueq: return "ueq"; + case FCmpPredicate::ugt: return "ugt"; + case FCmpPredicate::uge: return "uge"; + case FCmpPredicate::ult: return "ult"; + case FCmpPredicate::ule: return "ule"; + case FCmpPredicate::une: return "une"; + case FCmpPredicate::uno: return "uno"; + case FCmpPredicate::_true: return "_true"; + } + return ""; +} + +::std::optional symbolizeFCmpPredicate(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("_false", FCmpPredicate::_false) + .Case("oeq", FCmpPredicate::oeq) + .Case("ogt", FCmpPredicate::ogt) + .Case("oge", FCmpPredicate::oge) + .Case("olt", FCmpPredicate::olt) + .Case("ole", FCmpPredicate::ole) + .Case("one", FCmpPredicate::one) + .Case("ord", FCmpPredicate::ord) + .Case("ueq", FCmpPredicate::ueq) + .Case("ugt", FCmpPredicate::ugt) + .Case("uge", FCmpPredicate::uge) + .Case("ult", FCmpPredicate::ult) + .Case("ule", FCmpPredicate::ule) + .Case("une", FCmpPredicate::une) + .Case("uno", FCmpPredicate::uno) + .Case("_true", FCmpPredicate::_true) + .Default(::std::nullopt); +} +::std::optional symbolizeFCmpPredicate(uint64_t value) { + switch (value) { + case 0: return FCmpPredicate::_false; + case 1: return FCmpPredicate::oeq; + case 2: return FCmpPredicate::ogt; + case 3: return FCmpPredicate::oge; + case 4: return FCmpPredicate::olt; + case 5: return FCmpPredicate::ole; + case 6: return FCmpPredicate::one; + case 7: return FCmpPredicate::ord; + case 8: return FCmpPredicate::ueq; + case 9: return FCmpPredicate::ugt; + case 10: return FCmpPredicate::uge; + case 11: return FCmpPredicate::ult; + case 12: return FCmpPredicate::ule; + case 13: return FCmpPredicate::une; + case 14: return FCmpPredicate::uno; + case 15: return FCmpPredicate::_true; + default: return ::std::nullopt; + } +} + +bool FCmpPredicateAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 7)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 8)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 9)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 10)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 11)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 12)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 13)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 14)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 15))); +} +FCmpPredicateAttr FCmpPredicateAttr::get(::mlir::MLIRContext *context, FCmpPredicate val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +FCmpPredicate FCmpPredicateAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +std::string stringifyFastmathFlags(FastmathFlags symbol) { + auto val = static_cast(symbol); + assert(127u == (127u | val) && "invalid bits set in bit enum"); + // Special case for all bits unset. + if (val == 0) return "none"; + + ::llvm::SmallVector<::llvm::StringRef, 2> strs; + // Print bit enum groups before individual bits + + if (127u == (127u & val)) { + strs.push_back("fast"); + val &= ~static_cast(127); + } + + if (1u == (1u & val)) + strs.push_back("nnan"); + + if (2u == (2u & val)) + strs.push_back("ninf"); + + if (4u == (4u & val)) + strs.push_back("nsz"); + + if (8u == (8u & val)) + strs.push_back("arcp"); + + if (16u == (16u & val)) + strs.push_back("contract"); + + if (32u == (32u & val)) + strs.push_back("afn"); + + if (64u == (64u & val)) + strs.push_back("reassoc"); + return ::llvm::join(strs, ", "); +} + +::std::optional symbolizeFastmathFlags(::llvm::StringRef str) { + // Special case for all bits unset. + if (str == "none") return FastmathFlags::none; + + ::llvm::SmallVector<::llvm::StringRef, 2> symbols; + str.split(symbols, ","); + + uint32_t val = 0; + for (auto symbol : symbols) { + auto bit = llvm::StringSwitch<::std::optional>(symbol.trim()) + .Case("nnan", 1) + .Case("ninf", 2) + .Case("nsz", 4) + .Case("arcp", 8) + .Case("contract", 16) + .Case("afn", 32) + .Case("reassoc", 64) + .Case("fast", 127) + .Default(::std::nullopt); + if (bit) { val |= *bit; } else { return ::std::nullopt; } + } + return static_cast(val); +} + +::std::optional symbolizeFastmathFlags(uint32_t value) { + // Special case for all bits unset. + if (value == 0) return FastmathFlags::none; + + if (value & ~static_cast(127u)) return std::nullopt; + return static_cast(value); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +::llvm::StringRef stringifyICmpPredicate(ICmpPredicate val) { + switch (val) { + case ICmpPredicate::eq: return "eq"; + case ICmpPredicate::ne: return "ne"; + case ICmpPredicate::slt: return "slt"; + case ICmpPredicate::sle: return "sle"; + case ICmpPredicate::sgt: return "sgt"; + case ICmpPredicate::sge: return "sge"; + case ICmpPredicate::ult: return "ult"; + case ICmpPredicate::ule: return "ule"; + case ICmpPredicate::ugt: return "ugt"; + case ICmpPredicate::uge: return "uge"; + } + return ""; +} + +::std::optional symbolizeICmpPredicate(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("eq", ICmpPredicate::eq) + .Case("ne", ICmpPredicate::ne) + .Case("slt", ICmpPredicate::slt) + .Case("sle", ICmpPredicate::sle) + .Case("sgt", ICmpPredicate::sgt) + .Case("sge", ICmpPredicate::sge) + .Case("ult", ICmpPredicate::ult) + .Case("ule", ICmpPredicate::ule) + .Case("ugt", ICmpPredicate::ugt) + .Case("uge", ICmpPredicate::uge) + .Default(::std::nullopt); +} +::std::optional symbolizeICmpPredicate(uint64_t value) { + switch (value) { + case 0: return ICmpPredicate::eq; + case 1: return ICmpPredicate::ne; + case 2: return ICmpPredicate::slt; + case 3: return ICmpPredicate::sle; + case 4: return ICmpPredicate::sgt; + case 5: return ICmpPredicate::sge; + case 6: return ICmpPredicate::ult; + case 7: return ICmpPredicate::ule; + case 8: return ICmpPredicate::ugt; + case 9: return ICmpPredicate::uge; + default: return ::std::nullopt; + } +} + +bool ICmpPredicateAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 7)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 8)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 9))); +} +ICmpPredicateAttr ICmpPredicateAttr::get(::mlir::MLIRContext *context, ICmpPredicate val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +ICmpPredicate ICmpPredicateAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +::llvm::StringRef stringifyDIEmissionKind(DIEmissionKind val) { + switch (val) { + case DIEmissionKind::None: return "None"; + case DIEmissionKind::Full: return "Full"; + case DIEmissionKind::LineTablesOnly: return "LineTablesOnly"; + case DIEmissionKind::DebugDirectivesOnly: return "DebugDirectivesOnly"; + } + return ""; +} + +::std::optional symbolizeDIEmissionKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("None", DIEmissionKind::None) + .Case("Full", DIEmissionKind::Full) + .Case("LineTablesOnly", DIEmissionKind::LineTablesOnly) + .Case("DebugDirectivesOnly", DIEmissionKind::DebugDirectivesOnly) + .Default(::std::nullopt); +} +::std::optional symbolizeDIEmissionKind(uint64_t value) { + switch (value) { + case 0: return DIEmissionKind::None; + case 1: return DIEmissionKind::Full; + case 2: return DIEmissionKind::LineTablesOnly; + case 3: return DIEmissionKind::DebugDirectivesOnly; + default: return ::std::nullopt; + } +} + +bool DIEmissionKindAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3))); +} +DIEmissionKindAttr DIEmissionKindAttr::get(::mlir::MLIRContext *context, DIEmissionKind val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +DIEmissionKind DIEmissionKindAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +namespace linkage { +::llvm::StringRef stringifyLinkage(Linkage val) { + switch (val) { + case Linkage::Private: return "private"; + case Linkage::Internal: return "internal"; + case Linkage::AvailableExternally: return "available_externally"; + case Linkage::Linkonce: return "linkonce"; + case Linkage::Weak: return "weak"; + case Linkage::Common: return "common"; + case Linkage::Appending: return "appending"; + case Linkage::ExternWeak: return "extern_weak"; + case Linkage::LinkonceODR: return "linkonce_odr"; + case Linkage::WeakODR: return "weak_odr"; + case Linkage::External: return "external"; + } + return ""; +} + +::std::optional symbolizeLinkage(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("private", Linkage::Private) + .Case("internal", Linkage::Internal) + .Case("available_externally", Linkage::AvailableExternally) + .Case("linkonce", Linkage::Linkonce) + .Case("weak", Linkage::Weak) + .Case("common", Linkage::Common) + .Case("appending", Linkage::Appending) + .Case("extern_weak", Linkage::ExternWeak) + .Case("linkonce_odr", Linkage::LinkonceODR) + .Case("weak_odr", Linkage::WeakODR) + .Case("external", Linkage::External) + .Default(::std::nullopt); +} +::std::optional symbolizeLinkage(uint64_t value) { + switch (value) { + case 0: return Linkage::Private; + case 1: return Linkage::Internal; + case 2: return Linkage::AvailableExternally; + case 3: return Linkage::Linkonce; + case 4: return Linkage::Weak; + case 5: return Linkage::Common; + case 6: return Linkage::Appending; + case 7: return Linkage::ExternWeak; + case 8: return Linkage::LinkonceODR; + case 9: return Linkage::WeakODR; + case 10: return Linkage::External; + default: return ::std::nullopt; + } +} + +bool LinkageAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 4)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 5)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 6)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 7)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 8)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 9)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 10))); +} +LinkageAttr LinkageAttr::get(::mlir::MLIRContext *context, Linkage val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +Linkage LinkageAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace linkage +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +::llvm::StringRef stringifyModRefInfo(ModRefInfo val) { + switch (val) { + case ModRefInfo::NoModRef: return "none"; + case ModRefInfo::Ref: return "read"; + case ModRefInfo::Mod: return "write"; + case ModRefInfo::ModRef: return "readwrite"; + } + return ""; +} + +::std::optional symbolizeModRefInfo(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("none", ModRefInfo::NoModRef) + .Case("read", ModRefInfo::Ref) + .Case("write", ModRefInfo::Mod) + .Case("readwrite", ModRefInfo::ModRef) + .Default(::std::nullopt); +} +::std::optional symbolizeModRefInfo(uint64_t value) { + switch (value) { + case 0: return ModRefInfo::NoModRef; + case 1: return ModRefInfo::Ref; + case 2: return ModRefInfo::Mod; + case 3: return ModRefInfo::ModRef; + default: return ::std::nullopt; + } +} + +bool ModRefInfoAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 3))); +} +ModRefInfoAttr ModRefInfoAttr::get(::mlir::MLIRContext *context, ModRefInfo val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +ModRefInfo ModRefInfoAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +::llvm::StringRef stringifyUnnamedAddr(UnnamedAddr val) { + switch (val) { + case UnnamedAddr::None: return ""; + case UnnamedAddr::Local: return "local_unnamed_addr"; + case UnnamedAddr::Global: return "unnamed_addr"; + } + return ""; +} + +::std::optional symbolizeUnnamedAddr(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("", UnnamedAddr::None) + .Case("local_unnamed_addr", UnnamedAddr::Local) + .Case("unnamed_addr", UnnamedAddr::Global) + .Default(::std::nullopt); +} +::std::optional symbolizeUnnamedAddr(uint64_t value) { + switch (value) { + case 0: return UnnamedAddr::None; + case 1: return UnnamedAddr::Local; + case 2: return UnnamedAddr::Global; + default: return ::std::nullopt; + } +} + +bool UnnamedAddrAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2))); +} +UnnamedAddrAttr UnnamedAddrAttr::get(::mlir::MLIRContext *context, UnnamedAddr val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +UnnamedAddr UnnamedAddrAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +namespace LLVM { +::llvm::StringRef stringifyVisibility(Visibility val) { + switch (val) { + case Visibility::Default: return ""; + case Visibility::Hidden: return "hidden"; + case Visibility::Protected: return "protected"; + } + return ""; +} + +::std::optional symbolizeVisibility(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("", Visibility::Default) + .Case("hidden", Visibility::Hidden) + .Case("protected", Visibility::Protected) + .Default(::std::nullopt); +} +::std::optional symbolizeVisibility(uint64_t value) { + switch (value) { + case 0: return Visibility::Default; + case 1: return Visibility::Hidden; + case 2: return Visibility::Protected; + default: return ::std::nullopt; + } +} + +bool VisibilityAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2))); +} +VisibilityAttr VisibilityAttr::get(::mlir::MLIRContext *context, Visibility val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +Visibility VisibilityAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace LLVM +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..dc2ec34c83d8b644c8fcff9d2428ab36e1bb1881 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc @@ -0,0 +1,1611 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LLVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace LLVM { +// ATT (0) or Intel (1) asm dialect +enum class AsmDialect : uint64_t { + AD_ATT = 0, + AD_Intel = 1, +}; + +::std::optional symbolizeAsmDialect(uint64_t); +::llvm::StringRef stringifyAsmDialect(AsmDialect); +::std::optional symbolizeAsmDialect(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForAsmDialect() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(AsmDialect enumValue) { + return stringifyAsmDialect(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeAsmDialect(str); +} + +class AsmDialectAttr : public ::mlir::IntegerAttr { +public: + using ValueType = AsmDialect; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static AsmDialectAttr get(::mlir::MLIRContext *context, AsmDialect val); + AsmDialect getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::AsmDialect, ::mlir::LLVM::AsmDialect> { + template + static FailureOr<::mlir::LLVM::AsmDialect> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for ATT (0) or Intel (1) asm dialect"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::AsmDialect> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::AsmDialect>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid ATT (0) or Intel (1) asm dialect specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::AsmDialect value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::AsmDialect> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::AsmDialect getEmptyKey() { + return static_cast<::mlir::LLVM::AsmDialect>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::AsmDialect getTombstoneKey() { + return static_cast<::mlir::LLVM::AsmDialect>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::AsmDialect &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::AsmDialect &lhs, const ::mlir::LLVM::AsmDialect &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// llvm.atomicrmw binary operations +enum class AtomicBinOp : uint64_t { + xchg = 0, + add = 1, + sub = 2, + _and = 3, + nand = 4, + _or = 5, + _xor = 6, + max = 7, + min = 8, + umax = 9, + umin = 10, + fadd = 11, + fsub = 12, + fmax = 13, + fmin = 14, + uinc_wrap = 15, + udec_wrap = 16, +}; + +::std::optional symbolizeAtomicBinOp(uint64_t); +::llvm::StringRef stringifyAtomicBinOp(AtomicBinOp); +::std::optional symbolizeAtomicBinOp(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForAtomicBinOp() { + return 16; +} + + +inline ::llvm::StringRef stringifyEnum(AtomicBinOp enumValue) { + return stringifyAtomicBinOp(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeAtomicBinOp(str); +} + +class AtomicBinOpAttr : public ::mlir::IntegerAttr { +public: + using ValueType = AtomicBinOp; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static AtomicBinOpAttr get(::mlir::MLIRContext *context, AtomicBinOp val); + AtomicBinOp getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::AtomicBinOp, ::mlir::LLVM::AtomicBinOp> { + template + static FailureOr<::mlir::LLVM::AtomicBinOp> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for llvm.atomicrmw binary operations"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::AtomicBinOp> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::AtomicBinOp>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid llvm.atomicrmw binary operations specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::AtomicBinOp value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::AtomicBinOp> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::AtomicBinOp getEmptyKey() { + return static_cast<::mlir::LLVM::AtomicBinOp>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::AtomicBinOp getTombstoneKey() { + return static_cast<::mlir::LLVM::AtomicBinOp>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::AtomicBinOp &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::AtomicBinOp &lhs, const ::mlir::LLVM::AtomicBinOp &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// Atomic ordering for LLVM's memory model +enum class AtomicOrdering : uint64_t { + not_atomic = 0, + unordered = 1, + monotonic = 2, + acquire = 4, + release = 5, + acq_rel = 6, + seq_cst = 7, +}; + +::std::optional symbolizeAtomicOrdering(uint64_t); +::llvm::StringRef stringifyAtomicOrdering(AtomicOrdering); +::std::optional symbolizeAtomicOrdering(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForAtomicOrdering() { + return 7; +} + + +inline ::llvm::StringRef stringifyEnum(AtomicOrdering enumValue) { + return stringifyAtomicOrdering(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeAtomicOrdering(str); +} + +class AtomicOrderingAttr : public ::mlir::IntegerAttr { +public: + using ValueType = AtomicOrdering; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static AtomicOrderingAttr get(::mlir::MLIRContext *context, AtomicOrdering val); + AtomicOrdering getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::AtomicOrdering, ::mlir::LLVM::AtomicOrdering> { + template + static FailureOr<::mlir::LLVM::AtomicOrdering> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Atomic ordering for LLVM's memory model"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::AtomicOrdering> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::AtomicOrdering>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Atomic ordering for LLVM's memory model specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::AtomicOrdering value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::AtomicOrdering> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::AtomicOrdering getEmptyKey() { + return static_cast<::mlir::LLVM::AtomicOrdering>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::AtomicOrdering getTombstoneKey() { + return static_cast<::mlir::LLVM::AtomicOrdering>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::AtomicOrdering &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::AtomicOrdering &lhs, const ::mlir::LLVM::AtomicOrdering &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +namespace cconv { +// Calling Conventions +enum class CConv : uint64_t { + C = 0, + Fast = 8, + Cold = 9, + GHC = 10, + HiPE = 11, + WebKit_JS = 12, + AnyReg = 13, + PreserveMost = 14, + PreserveAll = 15, + Swift = 16, + CXX_FAST_TLS = 17, + Tail = 18, + CFGuard_Check = 19, + SwiftTail = 20, + X86_StdCall = 64, + X86_FastCall = 65, + ARM_APCS = 66, + ARM_AAPCS = 67, + ARM_AAPCS_VFP = 68, + MSP430_INTR = 69, + X86_ThisCall = 70, + PTX_Kernel = 71, + PTX_Device = 72, + SPIR_FUNC = 75, + SPIR_KERNEL = 76, + Intel_OCL_BI = 77, + X86_64_SysV = 78, + Win64 = 79, + X86_VectorCall = 80, + DUMMY_HHVM = 81, + DUMMY_HHVM_C = 82, + X86_INTR = 83, + AVR_INTR = 84, + AVR_BUILTIN = 86, + AMDGPU_VS = 87, + AMDGPU_GS = 88, + AMDGPU_CS = 90, + AMDGPU_KERNEL = 91, + X86_RegCall = 92, + AMDGPU_HS = 93, + MSP430_BUILTIN = 94, + AMDGPU_LS = 95, + AMDGPU_ES = 96, + AArch64_VectorCall = 97, + AArch64_SVE_VectorCall = 98, + WASM_EmscriptenInvoke = 99, + AMDGPU_Gfx = 100, + M68k_INTR = 101, +}; + +::std::optional symbolizeCConv(uint64_t); +::llvm::StringRef stringifyCConv(CConv); +::std::optional symbolizeCConv(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForCConv() { + return 101; +} + + +inline ::llvm::StringRef stringifyEnum(CConv enumValue) { + return stringifyCConv(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeCConv(str); +} + +class CConvAttr : public ::mlir::IntegerAttr { +public: + using ValueType = CConv; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static CConvAttr get(::mlir::MLIRContext *context, CConv val); + CConv getValue() const; +}; +} // namespace cconv +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::cconv::CConv, ::mlir::LLVM::cconv::CConv> { + template + static FailureOr<::mlir::LLVM::cconv::CConv> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Calling Conventions"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::cconv::CConv> attr = ::mlir::LLVM::cconv::symbolizeEnum<::mlir::LLVM::cconv::CConv>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Calling Conventions specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::cconv::CConv value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::cconv::CConv> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::cconv::CConv getEmptyKey() { + return static_cast<::mlir::LLVM::cconv::CConv>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::cconv::CConv getTombstoneKey() { + return static_cast<::mlir::LLVM::cconv::CConv>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::cconv::CConv &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::cconv::CConv &lhs, const ::mlir::LLVM::cconv::CConv &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +namespace comdat { +// LLVM Comdat Types +enum class Comdat : uint64_t { + Any = 0, + ExactMatch = 1, + Largest = 2, + NoDeduplicate = 3, + SameSize = 4, +}; + +::std::optional symbolizeComdat(uint64_t); +::llvm::StringRef stringifyComdat(Comdat); +::std::optional symbolizeComdat(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForComdat() { + return 4; +} + + +inline ::llvm::StringRef stringifyEnum(Comdat enumValue) { + return stringifyComdat(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeComdat(str); +} + +class ComdatAttr : public ::mlir::IntegerAttr { +public: + using ValueType = Comdat; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static ComdatAttr get(::mlir::MLIRContext *context, Comdat val); + Comdat getValue() const; +}; +} // namespace comdat +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::comdat::Comdat, ::mlir::LLVM::comdat::Comdat> { + template + static FailureOr<::mlir::LLVM::comdat::Comdat> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for LLVM Comdat Types"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::comdat::Comdat> attr = ::mlir::LLVM::comdat::symbolizeEnum<::mlir::LLVM::comdat::Comdat>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid LLVM Comdat Types specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::comdat::Comdat value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::comdat::Comdat> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::comdat::Comdat getEmptyKey() { + return static_cast<::mlir::LLVM::comdat::Comdat>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::comdat::Comdat getTombstoneKey() { + return static_cast<::mlir::LLVM::comdat::Comdat>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::comdat::Comdat &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::comdat::Comdat &lhs, const ::mlir::LLVM::comdat::Comdat &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// LLVM DI flags +enum class DIFlags : uint32_t { + Zero = 0, + Bit0 = 1, + Bit1 = 2, + Private = 1, + Protected = 2, + Public = 3, + FwdDecl = 4, + AppleBlock = 8, + ReservedBit4 = 16, + Virtual = 32, + Artificial = 64, + Explicit = 128, + Prototyped = 256, + ObjcClassComplete = 512, + ObjectPointer = 1024, + Vector = 2048, + StaticMember = 4096, + LValueReference = 8192, + RValueReference = 16384, + ExportSymbols = 32768, + SingleInheritance = 65536, + MultipleInheritance = 65536, + VirtualInheritance = 65536, + IntroducedVirtual = 262144, + BitField = 524288, + NoReturn = 1048576, + TypePassByValue = 4194304, + TypePassByReference = 8388608, + EnumClass = 16777216, + Thunk = 33554432, + NonTrivial = 67108864, + BigEndian = 134217728, + LittleEndian = 268435456, + AllCallsDescribed = 536870912, +}; + +::std::optional symbolizeDIFlags(uint32_t); +std::string stringifyDIFlags(DIFlags); +::std::optional symbolizeDIFlags(::llvm::StringRef); + +inline constexpr DIFlags operator|(DIFlags a, DIFlags b) { + return static_cast(static_cast(a) | static_cast(b)); +} +inline constexpr DIFlags operator&(DIFlags a, DIFlags b) { + return static_cast(static_cast(a) & static_cast(b)); +} +inline constexpr DIFlags operator^(DIFlags a, DIFlags b) { + return static_cast(static_cast(a) ^ static_cast(b)); +} +inline constexpr DIFlags operator~(DIFlags bits) { + // Ensure only bits that can be present in the enum are set + return static_cast(~static_cast(bits) & static_cast(1071513599u)); +} +inline constexpr bool bitEnumContainsAll(DIFlags bits, DIFlags bit) { + return (bits & bit) == bit; +} +inline constexpr bool bitEnumContainsAny(DIFlags bits, DIFlags bit) { + return (static_cast(bits) & static_cast(bit)) != 0; +} +inline constexpr DIFlags bitEnumClear(DIFlags bits, DIFlags bit) { + return bits & ~bit; +} +inline constexpr DIFlags bitEnumSet(DIFlags bits, DIFlags bit, /*optional*/bool value=true) { + return value ? (bits | bit) : bitEnumClear(bits, bit); +} + +inline std::string stringifyEnum(DIFlags enumValue) { + return stringifyDIFlags(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeDIFlags(str); +} + +class DIFlagsAttr : public ::mlir::IntegerAttr { +public: + using ValueType = DIFlags; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static DIFlagsAttr get(::mlir::MLIRContext *context, DIFlags val); + DIFlags getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::DIFlags, ::mlir::LLVM::DIFlags> { + template + static FailureOr<::mlir::LLVM::DIFlags> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for LLVM DI flags"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::DIFlags> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::DIFlags>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid LLVM DI flags specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::DIFlags value) { + auto valueStr = stringifyEnum(value); + switch (value) { + case ::mlir::LLVM::DIFlags::Public: + return p << valueStr; + default: + break; + } + auto underlyingValue = static_cast>(value); + if (underlyingValue && !llvm::has_single_bit(underlyingValue)) + return p << '"' << valueStr << '"'; + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::DIFlags> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::DIFlags getEmptyKey() { + return static_cast<::mlir::LLVM::DIFlags>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::DIFlags getTombstoneKey() { + return static_cast<::mlir::LLVM::DIFlags>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::DIFlags &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::DIFlags &lhs, const ::mlir::LLVM::DIFlags &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// LLVM DISubprogram flags +enum class DISubprogramFlags : uint32_t { + Virtual = 1, + PureVirtual = 2, + LocalToUnit = 4, + Definition = 8, + Optimized = 16, + Pure = 32, + Elemental = 64, + Recursive = 128, + MainSubprogram = 256, + Deleted = 512, + ObjCDirect = 2048, +}; + +::std::optional symbolizeDISubprogramFlags(uint32_t); +std::string stringifyDISubprogramFlags(DISubprogramFlags); +::std::optional symbolizeDISubprogramFlags(::llvm::StringRef); + +inline constexpr DISubprogramFlags operator|(DISubprogramFlags a, DISubprogramFlags b) { + return static_cast(static_cast(a) | static_cast(b)); +} +inline constexpr DISubprogramFlags operator&(DISubprogramFlags a, DISubprogramFlags b) { + return static_cast(static_cast(a) & static_cast(b)); +} +inline constexpr DISubprogramFlags operator^(DISubprogramFlags a, DISubprogramFlags b) { + return static_cast(static_cast(a) ^ static_cast(b)); +} +inline constexpr DISubprogramFlags operator~(DISubprogramFlags bits) { + // Ensure only bits that can be present in the enum are set + return static_cast(~static_cast(bits) & static_cast(3071u)); +} +inline constexpr bool bitEnumContainsAll(DISubprogramFlags bits, DISubprogramFlags bit) { + return (bits & bit) == bit; +} +inline constexpr bool bitEnumContainsAny(DISubprogramFlags bits, DISubprogramFlags bit) { + return (static_cast(bits) & static_cast(bit)) != 0; +} +inline constexpr DISubprogramFlags bitEnumClear(DISubprogramFlags bits, DISubprogramFlags bit) { + return bits & ~bit; +} +inline constexpr DISubprogramFlags bitEnumSet(DISubprogramFlags bits, DISubprogramFlags bit, /*optional*/bool value=true) { + return value ? (bits | bit) : bitEnumClear(bits, bit); +} + +inline std::string stringifyEnum(DISubprogramFlags enumValue) { + return stringifyDISubprogramFlags(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeDISubprogramFlags(str); +} + +class DISubprogramFlagsAttr : public ::mlir::IntegerAttr { +public: + using ValueType = DISubprogramFlags; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static DISubprogramFlagsAttr get(::mlir::MLIRContext *context, DISubprogramFlags val); + DISubprogramFlags getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::DISubprogramFlags, ::mlir::LLVM::DISubprogramFlags> { + template + static FailureOr<::mlir::LLVM::DISubprogramFlags> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for LLVM DISubprogram flags"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::DISubprogramFlags> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::DISubprogramFlags>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid LLVM DISubprogram flags specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::DISubprogramFlags value) { + auto valueStr = stringifyEnum(value); + auto underlyingValue = static_cast>(value); + if (underlyingValue && !llvm::has_single_bit(underlyingValue)) + return p << '"' << valueStr << '"'; + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::DISubprogramFlags> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::DISubprogramFlags getEmptyKey() { + return static_cast<::mlir::LLVM::DISubprogramFlags>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::DISubprogramFlags getTombstoneKey() { + return static_cast<::mlir::LLVM::DISubprogramFlags>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::DISubprogramFlags &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::DISubprogramFlags &lhs, const ::mlir::LLVM::DISubprogramFlags &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// llvm.fcmp comparison predicate +enum class FCmpPredicate : uint64_t { + _false = 0, + oeq = 1, + ogt = 2, + oge = 3, + olt = 4, + ole = 5, + one = 6, + ord = 7, + ueq = 8, + ugt = 9, + uge = 10, + ult = 11, + ule = 12, + une = 13, + uno = 14, + _true = 15, +}; + +::std::optional symbolizeFCmpPredicate(uint64_t); +::llvm::StringRef stringifyFCmpPredicate(FCmpPredicate); +::std::optional symbolizeFCmpPredicate(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForFCmpPredicate() { + return 15; +} + + +inline ::llvm::StringRef stringifyEnum(FCmpPredicate enumValue) { + return stringifyFCmpPredicate(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeFCmpPredicate(str); +} + +class FCmpPredicateAttr : public ::mlir::IntegerAttr { +public: + using ValueType = FCmpPredicate; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static FCmpPredicateAttr get(::mlir::MLIRContext *context, FCmpPredicate val); + FCmpPredicate getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::FCmpPredicate, ::mlir::LLVM::FCmpPredicate> { + template + static FailureOr<::mlir::LLVM::FCmpPredicate> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for llvm.fcmp comparison predicate"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::FCmpPredicate> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::FCmpPredicate>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid llvm.fcmp comparison predicate specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::FCmpPredicate value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::FCmpPredicate> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::FCmpPredicate getEmptyKey() { + return static_cast<::mlir::LLVM::FCmpPredicate>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::FCmpPredicate getTombstoneKey() { + return static_cast<::mlir::LLVM::FCmpPredicate>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::FCmpPredicate &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::FCmpPredicate &lhs, const ::mlir::LLVM::FCmpPredicate &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// LLVM fastmath flags +enum class FastmathFlags : uint32_t { + none = 0, + nnan = 1, + ninf = 2, + nsz = 4, + arcp = 8, + contract = 16, + afn = 32, + reassoc = 64, + fast = 127, +}; + +::std::optional symbolizeFastmathFlags(uint32_t); +std::string stringifyFastmathFlags(FastmathFlags); +::std::optional symbolizeFastmathFlags(::llvm::StringRef); + +inline constexpr FastmathFlags operator|(FastmathFlags a, FastmathFlags b) { + return static_cast(static_cast(a) | static_cast(b)); +} +inline constexpr FastmathFlags operator&(FastmathFlags a, FastmathFlags b) { + return static_cast(static_cast(a) & static_cast(b)); +} +inline constexpr FastmathFlags operator^(FastmathFlags a, FastmathFlags b) { + return static_cast(static_cast(a) ^ static_cast(b)); +} +inline constexpr FastmathFlags operator~(FastmathFlags bits) { + // Ensure only bits that can be present in the enum are set + return static_cast(~static_cast(bits) & static_cast(127u)); +} +inline constexpr bool bitEnumContainsAll(FastmathFlags bits, FastmathFlags bit) { + return (bits & bit) == bit; +} +inline constexpr bool bitEnumContainsAny(FastmathFlags bits, FastmathFlags bit) { + return (static_cast(bits) & static_cast(bit)) != 0; +} +inline constexpr FastmathFlags bitEnumClear(FastmathFlags bits, FastmathFlags bit) { + return bits & ~bit; +} +inline constexpr FastmathFlags bitEnumSet(FastmathFlags bits, FastmathFlags bit, /*optional*/bool value=true) { + return value ? (bits | bit) : bitEnumClear(bits, bit); +} + +inline std::string stringifyEnum(FastmathFlags enumValue) { + return stringifyFastmathFlags(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeFastmathFlags(str); +} +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::FastmathFlags, ::mlir::LLVM::FastmathFlags> { + template + static FailureOr<::mlir::LLVM::FastmathFlags> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for LLVM fastmath flags"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::FastmathFlags> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::FastmathFlags>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid LLVM fastmath flags specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::FastmathFlags value) { + auto valueStr = stringifyEnum(value); + switch (value) { + case ::mlir::LLVM::FastmathFlags::fast: + return p << valueStr; + default: + break; + } + auto underlyingValue = static_cast>(value); + if (underlyingValue && !llvm::has_single_bit(underlyingValue)) + return p << '"' << valueStr << '"'; + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::FastmathFlags> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::FastmathFlags getEmptyKey() { + return static_cast<::mlir::LLVM::FastmathFlags>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::FastmathFlags getTombstoneKey() { + return static_cast<::mlir::LLVM::FastmathFlags>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::FastmathFlags &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::FastmathFlags &lhs, const ::mlir::LLVM::FastmathFlags &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// lvm.icmp comparison predicate +enum class ICmpPredicate : uint64_t { + eq = 0, + ne = 1, + slt = 2, + sle = 3, + sgt = 4, + sge = 5, + ult = 6, + ule = 7, + ugt = 8, + uge = 9, +}; + +::std::optional symbolizeICmpPredicate(uint64_t); +::llvm::StringRef stringifyICmpPredicate(ICmpPredicate); +::std::optional symbolizeICmpPredicate(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForICmpPredicate() { + return 9; +} + + +inline ::llvm::StringRef stringifyEnum(ICmpPredicate enumValue) { + return stringifyICmpPredicate(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeICmpPredicate(str); +} + +class ICmpPredicateAttr : public ::mlir::IntegerAttr { +public: + using ValueType = ICmpPredicate; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static ICmpPredicateAttr get(::mlir::MLIRContext *context, ICmpPredicate val); + ICmpPredicate getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::ICmpPredicate, ::mlir::LLVM::ICmpPredicate> { + template + static FailureOr<::mlir::LLVM::ICmpPredicate> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for lvm.icmp comparison predicate"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::ICmpPredicate> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::ICmpPredicate>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid lvm.icmp comparison predicate specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::ICmpPredicate value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::ICmpPredicate> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::ICmpPredicate getEmptyKey() { + return static_cast<::mlir::LLVM::ICmpPredicate>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::ICmpPredicate getTombstoneKey() { + return static_cast<::mlir::LLVM::ICmpPredicate>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::ICmpPredicate &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::ICmpPredicate &lhs, const ::mlir::LLVM::ICmpPredicate &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// LLVM debug emission kind +enum class DIEmissionKind : uint64_t { + None = 0, + Full = 1, + LineTablesOnly = 2, + DebugDirectivesOnly = 3, +}; + +::std::optional symbolizeDIEmissionKind(uint64_t); +::llvm::StringRef stringifyDIEmissionKind(DIEmissionKind); +::std::optional symbolizeDIEmissionKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForDIEmissionKind() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(DIEmissionKind enumValue) { + return stringifyDIEmissionKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeDIEmissionKind(str); +} + +class DIEmissionKindAttr : public ::mlir::IntegerAttr { +public: + using ValueType = DIEmissionKind; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static DIEmissionKindAttr get(::mlir::MLIRContext *context, DIEmissionKind val); + DIEmissionKind getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::DIEmissionKind, ::mlir::LLVM::DIEmissionKind> { + template + static FailureOr<::mlir::LLVM::DIEmissionKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for LLVM debug emission kind"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::DIEmissionKind> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::DIEmissionKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid LLVM debug emission kind specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::DIEmissionKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::DIEmissionKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::DIEmissionKind getEmptyKey() { + return static_cast<::mlir::LLVM::DIEmissionKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::DIEmissionKind getTombstoneKey() { + return static_cast<::mlir::LLVM::DIEmissionKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::DIEmissionKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::DIEmissionKind &lhs, const ::mlir::LLVM::DIEmissionKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +namespace linkage { +// LLVM linkage types +enum class Linkage : uint64_t { + Private = 0, + Internal = 1, + AvailableExternally = 2, + Linkonce = 3, + Weak = 4, + Common = 5, + Appending = 6, + ExternWeak = 7, + LinkonceODR = 8, + WeakODR = 9, + External = 10, +}; + +::std::optional symbolizeLinkage(uint64_t); +::llvm::StringRef stringifyLinkage(Linkage); +::std::optional symbolizeLinkage(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForLinkage() { + return 10; +} + + +inline ::llvm::StringRef stringifyEnum(Linkage enumValue) { + return stringifyLinkage(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeLinkage(str); +} + +class LinkageAttr : public ::mlir::IntegerAttr { +public: + using ValueType = Linkage; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static LinkageAttr get(::mlir::MLIRContext *context, Linkage val); + Linkage getValue() const; +}; +} // namespace linkage +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::linkage::Linkage, ::mlir::LLVM::linkage::Linkage> { + template + static FailureOr<::mlir::LLVM::linkage::Linkage> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for LLVM linkage types"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::linkage::Linkage> attr = ::mlir::LLVM::linkage::symbolizeEnum<::mlir::LLVM::linkage::Linkage>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid LLVM linkage types specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::linkage::Linkage value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::linkage::Linkage> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::linkage::Linkage getEmptyKey() { + return static_cast<::mlir::LLVM::linkage::Linkage>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::linkage::Linkage getTombstoneKey() { + return static_cast<::mlir::LLVM::linkage::Linkage>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::linkage::Linkage &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::linkage::Linkage &lhs, const ::mlir::LLVM::linkage::Linkage &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// LLVM ModRefInfo +enum class ModRefInfo : uint64_t { + NoModRef = 0, + Ref = 1, + Mod = 2, + ModRef = 3, +}; + +::std::optional symbolizeModRefInfo(uint64_t); +::llvm::StringRef stringifyModRefInfo(ModRefInfo); +::std::optional symbolizeModRefInfo(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForModRefInfo() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(ModRefInfo enumValue) { + return stringifyModRefInfo(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeModRefInfo(str); +} + +class ModRefInfoAttr : public ::mlir::IntegerAttr { +public: + using ValueType = ModRefInfo; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static ModRefInfoAttr get(::mlir::MLIRContext *context, ModRefInfo val); + ModRefInfo getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::ModRefInfo, ::mlir::LLVM::ModRefInfo> { + template + static FailureOr<::mlir::LLVM::ModRefInfo> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for LLVM ModRefInfo"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::ModRefInfo> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::ModRefInfo>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid LLVM ModRefInfo specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::ModRefInfo value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::ModRefInfo> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::ModRefInfo getEmptyKey() { + return static_cast<::mlir::LLVM::ModRefInfo>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::ModRefInfo getTombstoneKey() { + return static_cast<::mlir::LLVM::ModRefInfo>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::ModRefInfo &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::ModRefInfo &lhs, const ::mlir::LLVM::ModRefInfo &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// LLVM GlobalValue UnnamedAddr +enum class UnnamedAddr : uint64_t { + None = 0, + Local = 1, + Global = 2, +}; + +::std::optional symbolizeUnnamedAddr(uint64_t); +::llvm::StringRef stringifyUnnamedAddr(UnnamedAddr); +::std::optional symbolizeUnnamedAddr(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForUnnamedAddr() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(UnnamedAddr enumValue) { + return stringifyUnnamedAddr(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeUnnamedAddr(str); +} + +class UnnamedAddrAttr : public ::mlir::IntegerAttr { +public: + using ValueType = UnnamedAddr; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static UnnamedAddrAttr get(::mlir::MLIRContext *context, UnnamedAddr val); + UnnamedAddr getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::UnnamedAddr, ::mlir::LLVM::UnnamedAddr> { + template + static FailureOr<::mlir::LLVM::UnnamedAddr> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for LLVM GlobalValue UnnamedAddr"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::UnnamedAddr> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::UnnamedAddr>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid LLVM GlobalValue UnnamedAddr specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::UnnamedAddr value) { + auto valueStr = stringifyEnum(value); + switch (value) { + case ::mlir::LLVM::UnnamedAddr::Local: + case ::mlir::LLVM::UnnamedAddr::Global: + break; + default: + return p << '"' << valueStr << '"'; + } + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::UnnamedAddr> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::UnnamedAddr getEmptyKey() { + return static_cast<::mlir::LLVM::UnnamedAddr>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::UnnamedAddr getTombstoneKey() { + return static_cast<::mlir::LLVM::UnnamedAddr>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::UnnamedAddr &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::UnnamedAddr &lhs, const ::mlir::LLVM::UnnamedAddr &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace LLVM { +// LLVM GlobalValue Visibility +enum class Visibility : uint64_t { + Default = 0, + Hidden = 1, + Protected = 2, +}; + +::std::optional symbolizeVisibility(uint64_t); +::llvm::StringRef stringifyVisibility(Visibility); +::std::optional symbolizeVisibility(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForVisibility() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(Visibility enumValue) { + return stringifyVisibility(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeVisibility(str); +} + +class VisibilityAttr : public ::mlir::IntegerAttr { +public: + using ValueType = Visibility; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static VisibilityAttr get(::mlir::MLIRContext *context, Visibility val); + Visibility getValue() const; +}; +} // namespace LLVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::LLVM::Visibility, ::mlir::LLVM::Visibility> { + template + static FailureOr<::mlir::LLVM::Visibility> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for LLVM GlobalValue Visibility"); + + // Symbolize the keyword. + if (::std::optional<::mlir::LLVM::Visibility> attr = ::mlir::LLVM::symbolizeEnum<::mlir::LLVM::Visibility>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid LLVM GlobalValue Visibility specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::LLVM::Visibility value) { + auto valueStr = stringifyEnum(value); + switch (value) { + case ::mlir::LLVM::Visibility::Hidden: + case ::mlir::LLVM::Visibility::Protected: + break; + default: + return p << '"' << valueStr << '"'; + } + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::LLVM::Visibility> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::LLVM::Visibility getEmptyKey() { + return static_cast<::mlir::LLVM::Visibility>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::LLVM::Visibility getTombstoneKey() { + return static_cast<::mlir::LLVM::Visibility>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::LLVM::Visibility &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::LLVM::Visibility &lhs, const ::mlir::LLVM::Visibility &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..961c546eba1779c86b3808c58bce1e9478ffd7d7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.cpp.inc @@ -0,0 +1,12 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Returns the size of the type in bytes. +unsigned mlir::LLVM::PointerElementTypeInterface::getSizeInBytes(const DataLayout & dataLayout) const { + return getImpl()->getSizeInBytes(getImpl(), *this, dataLayout); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..2fde1f53f990629d6a608bb6851b0b9c59a5da93 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.h.inc @@ -0,0 +1,78 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace LLVM { +class PointerElementTypeInterface; +namespace detail { +struct PointerElementTypeInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + unsigned (*getSizeInBytes)(const Concept *impl, ::mlir::Type , const DataLayout &); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::LLVM::PointerElementTypeInterface; + Model() : Concept{getSizeInBytes} {} + + static inline unsigned getSizeInBytes(const Concept *impl, ::mlir::Type tablegen_opaque_val, const DataLayout & dataLayout); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::LLVM::PointerElementTypeInterface; + FallbackModel() : Concept{getSizeInBytes} {} + + static inline unsigned getSizeInBytes(const Concept *impl, ::mlir::Type tablegen_opaque_val, const DataLayout & dataLayout); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteType; + unsigned getSizeInBytes(::mlir::Type tablegen_opaque_val, const DataLayout &dataLayout) const; + }; +};template +struct PointerElementTypeInterfaceTrait; + +} // namespace detail +class PointerElementTypeInterface : public ::mlir::TypeInterface { +public: + using ::mlir::TypeInterface::TypeInterface; + template + struct Trait : public detail::PointerElementTypeInterfaceTrait {}; + /// Returns the size of the type in bytes. + unsigned getSizeInBytes(const DataLayout & dataLayout) const; +}; +namespace detail { + template + struct PointerElementTypeInterfaceTrait : public ::mlir::TypeInterface::Trait { + /// Returns the size of the type in bytes. + unsigned getSizeInBytes(const DataLayout & dataLayout) const { + return dataLayout.getTypeSize((*static_cast(this))); + } + }; +}// namespace detail +} // namespace LLVM +} // namespace mlir +namespace mlir { +namespace LLVM { +template +unsigned detail::PointerElementTypeInterfaceInterfaceTraits::Model::getSizeInBytes(const Concept *impl, ::mlir::Type tablegen_opaque_val, const DataLayout & dataLayout) { + return (::llvm::cast(tablegen_opaque_val)).getSizeInBytes(dataLayout); +} +template +unsigned detail::PointerElementTypeInterfaceInterfaceTraits::FallbackModel::getSizeInBytes(const Concept *impl, ::mlir::Type tablegen_opaque_val, const DataLayout & dataLayout) { + return static_cast(impl)->getSizeInBytes(tablegen_opaque_val, dataLayout); +} +template +unsigned detail::PointerElementTypeInterfaceInterfaceTraits::ExternalModel::getSizeInBytes(::mlir::Type tablegen_opaque_val, const DataLayout &dataLayout) const { +return dataLayout.getTypeSize((::llvm::cast(tablegen_opaque_val))); +} +} // namespace LLVM +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..f58b610a8f680f9a0b1eb8662a1269ca8ec26163 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc @@ -0,0 +1,703 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_LIST +#undef GET_TYPEDEF_LIST + +::mlir::LLVM::LLVMArrayType, +::mlir::LLVM::LLVMFixedVectorType, +::mlir::LLVM::LLVMFunctionType, +::mlir::LLVM::LLVMPointerType, +::mlir::LLVM::LLVMScalableVectorType, +::mlir::LLVM::LLVMTargetExtType + +#endif // GET_TYPEDEF_LIST + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + +static ::mlir::OptionalParseResult generatedTypeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::LLVM::LLVMArrayType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LLVMArrayType::parse(parser); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LLVMFixedVectorType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LLVMFixedVectorType::parse(parser); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LLVMFunctionType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LLVMFunctionType::parse(parser); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LLVMPointerType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LLVMPointerType::parse(parser); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LLVMScalableVectorType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LLVMScalableVectorType::parse(parser); + return ::mlir::success(!!value); + }) + .Case(::mlir::LLVM::LLVMTargetExtType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::LLVM::LLVMTargetExtType::parse(parser); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedTypePrinter(::mlir::Type def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Type, ::mlir::LogicalResult>(def) .Case<::mlir::LLVM::LLVMArrayType>([&](auto t) { + printer << ::mlir::LLVM::LLVMArrayType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LLVMFixedVectorType>([&](auto t) { + printer << ::mlir::LLVM::LLVMFixedVectorType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LLVMFunctionType>([&](auto t) { + printer << ::mlir::LLVM::LLVMFunctionType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LLVMPointerType>([&](auto t) { + printer << ::mlir::LLVM::LLVMPointerType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LLVMScalableVectorType>([&](auto t) { + printer << ::mlir::LLVM::LLVMScalableVectorType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::LLVM::LLVMTargetExtType>([&](auto t) { + printer << ::mlir::LLVM::LLVMTargetExtType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace LLVM { +namespace detail { +struct LLVMArrayTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + LLVMArrayTypeStorage(Type elementType, unsigned numElements) : elementType(std::move(elementType)), numElements(std::move(numElements)) {} + + KeyTy getAsKey() const { + return KeyTy(elementType, numElements); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (elementType == std::get<0>(tblgenKey)) && (numElements == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static LLVMArrayTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto elementType = std::move(std::get<0>(tblgenKey)); + auto numElements = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) LLVMArrayTypeStorage(std::move(elementType), std::move(numElements)); + } + + Type elementType; + unsigned numElements; +}; +} // namespace detail +LLVMArrayType LLVMArrayType::get(::mlir::MLIRContext *context, Type elementType, unsigned numElements) { + return Base::get(context, std::move(elementType), std::move(numElements)); +} + +LLVMArrayType LLVMArrayType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type elementType, unsigned numElements) { + return Base::getChecked(emitError, context, elementType, numElements); +} + +::mlir::Type LLVMArrayType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_elementType; + ::mlir::FailureOr _result_numElements; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'numElements' + _result_numElements = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_numElements)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVMArrayType parameter 'numElements' which is to be a `unsigned`"); + return {}; + } + // Parse literal 'x' + if (odsParser.parseKeyword("x")) return {}; + { + auto odsCustomLoc = odsParser.getCurrentLocation(); + (void)odsCustomLoc; + auto odsCustomResult = parsePrettyLLVMType(odsParser, + ::mlir::detail::unwrapForCustomParse(_result_elementType)); + if (::mlir::failed(odsCustomResult)) return {}; + if (::mlir::failed(_result_elementType)) { + odsParser.emitError(odsCustomLoc, "custom parser failed to parse parameter 'elementType'"); + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_elementType)); + assert(::mlir::succeeded(_result_numElements)); + return odsParser.getChecked(odsLoc, odsParser.getContext(), + Type((*_result_elementType)), + unsigned((*_result_numElements))); +} + +void LLVMArrayType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter.printStrippedAttrOrType(getNumElements()); + odsPrinter << ' ' << "x"; + odsPrinter << ' '; + printPrettyLLVMType(odsPrinter, + getElementType()); + odsPrinter << ">"; +} + +Type LLVMArrayType::getElementType() const { + return getImpl()->elementType; +} + +unsigned LLVMArrayType::getNumElements() const { + return getImpl()->numElements; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMArrayType) +namespace mlir { +namespace LLVM { +namespace detail { +struct LLVMFixedVectorTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + LLVMFixedVectorTypeStorage(Type elementType, unsigned numElements) : elementType(std::move(elementType)), numElements(std::move(numElements)) {} + + KeyTy getAsKey() const { + return KeyTy(elementType, numElements); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (elementType == std::get<0>(tblgenKey)) && (numElements == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static LLVMFixedVectorTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto elementType = std::move(std::get<0>(tblgenKey)); + auto numElements = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) LLVMFixedVectorTypeStorage(std::move(elementType), std::move(numElements)); + } + + Type elementType; + unsigned numElements; +}; +} // namespace detail +LLVMFixedVectorType LLVMFixedVectorType::get(::mlir::MLIRContext *context, Type elementType, unsigned numElements) { + return Base::get(context, std::move(elementType), std::move(numElements)); +} + +LLVMFixedVectorType LLVMFixedVectorType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type elementType, unsigned numElements) { + return Base::getChecked(emitError, context, elementType, numElements); +} + +::mlir::Type LLVMFixedVectorType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_elementType; + ::mlir::FailureOr _result_numElements; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'numElements' + _result_numElements = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_numElements)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVMFixedVectorType parameter 'numElements' which is to be a `unsigned`"); + return {}; + } + // Parse literal 'x' + if (odsParser.parseKeyword("x")) return {}; + { + auto odsCustomLoc = odsParser.getCurrentLocation(); + (void)odsCustomLoc; + auto odsCustomResult = parsePrettyLLVMType(odsParser, + ::mlir::detail::unwrapForCustomParse(_result_elementType)); + if (::mlir::failed(odsCustomResult)) return {}; + if (::mlir::failed(_result_elementType)) { + odsParser.emitError(odsCustomLoc, "custom parser failed to parse parameter 'elementType'"); + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_elementType)); + assert(::mlir::succeeded(_result_numElements)); + return odsParser.getChecked(odsLoc, odsParser.getContext(), + Type((*_result_elementType)), + unsigned((*_result_numElements))); +} + +void LLVMFixedVectorType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter.printStrippedAttrOrType(getNumElements()); + odsPrinter << ' ' << "x"; + odsPrinter << ' '; + printPrettyLLVMType(odsPrinter, + getElementType()); + odsPrinter << ">"; +} + +Type LLVMFixedVectorType::getElementType() const { + return getImpl()->elementType; +} + +unsigned LLVMFixedVectorType::getNumElements() const { + return getImpl()->numElements; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMFixedVectorType) +namespace mlir { +namespace LLVM { +namespace detail { +struct LLVMFunctionTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple, bool>; + LLVMFunctionTypeStorage(Type returnType, ::llvm::ArrayRef params, bool varArg) : returnType(std::move(returnType)), params(std::move(params)), varArg(std::move(varArg)) {} + + KeyTy getAsKey() const { + return KeyTy(returnType, params, varArg); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (returnType == std::get<0>(tblgenKey)) && (params == std::get<1>(tblgenKey)) && (varArg == std::get<2>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); + } + + static LLVMFunctionTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto returnType = std::move(std::get<0>(tblgenKey)); + auto params = std::move(std::get<1>(tblgenKey)); + auto varArg = std::move(std::get<2>(tblgenKey)); + params = allocator.copyInto(params); + return new (allocator.allocate()) LLVMFunctionTypeStorage(std::move(returnType), std::move(params), std::move(varArg)); + } + + Type returnType; + ::llvm::ArrayRef params; + bool varArg; +}; +} // namespace detail +LLVMFunctionType LLVMFunctionType::get(::mlir::MLIRContext *context, Type returnType, ::llvm::ArrayRef params, bool varArg) { + return Base::get(context, std::move(returnType), std::move(params), std::move(varArg)); +} + +LLVMFunctionType LLVMFunctionType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type returnType, ::llvm::ArrayRef params, bool varArg) { + return Base::getChecked(emitError, context, returnType, params, varArg); +} + +::mlir::Type LLVMFunctionType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_returnType; + ::mlir::FailureOr<::llvm::SmallVector> _result_params; + ::mlir::FailureOr _result_varArg; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + { + auto odsCustomLoc = odsParser.getCurrentLocation(); + (void)odsCustomLoc; + auto odsCustomResult = parsePrettyLLVMType(odsParser, + ::mlir::detail::unwrapForCustomParse(_result_returnType)); + if (::mlir::failed(odsCustomResult)) return {}; + if (::mlir::failed(_result_returnType)) { + odsParser.emitError(odsCustomLoc, "custom parser failed to parse parameter 'returnType'"); + return {}; + } + } + // Parse literal '(' + if (odsParser.parseLParen()) return {}; + { + auto odsCustomLoc = odsParser.getCurrentLocation(); + (void)odsCustomLoc; + auto odsCustomResult = parseFunctionTypes(odsParser, + ::mlir::detail::unwrapForCustomParse(_result_params), + ::mlir::detail::unwrapForCustomParse(_result_varArg)); + if (::mlir::failed(odsCustomResult)) return {}; + if (::mlir::failed(_result_params)) { + odsParser.emitError(odsCustomLoc, "custom parser failed to parse parameter 'params'"); + return {}; + } + if (::mlir::failed(_result_varArg)) { + odsParser.emitError(odsCustomLoc, "custom parser failed to parse parameter 'varArg'"); + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_returnType)); + assert(::mlir::succeeded(_result_params)); + assert(::mlir::succeeded(_result_varArg)); + return odsParser.getChecked(odsLoc, odsParser.getContext(), + Type((*_result_returnType)), + ::llvm::ArrayRef((*_result_params)), + bool((*_result_varArg))); +} + +void LLVMFunctionType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + printPrettyLLVMType(odsPrinter, + getReturnType()); + odsPrinter << " "; + odsPrinter << "("; + printFunctionTypes(odsPrinter, + getParams(), + getVarArg()); + odsPrinter << ">"; +} + +Type LLVMFunctionType::getReturnType() const { + return getImpl()->returnType; +} + +::llvm::ArrayRef LLVMFunctionType::getParams() const { + return getImpl()->params; +} + +bool LLVMFunctionType::getVarArg() const { + return getImpl()->varArg; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMFunctionType) +namespace mlir { +namespace LLVM { +namespace detail { +struct LLVMPointerTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + LLVMPointerTypeStorage(Type elementType, unsigned addressSpace) : elementType(std::move(elementType)), addressSpace(std::move(addressSpace)) {} + + KeyTy getAsKey() const { + return KeyTy(elementType, addressSpace); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (elementType == std::get<0>(tblgenKey)) && (addressSpace == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static LLVMPointerTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto elementType = std::move(std::get<0>(tblgenKey)); + auto addressSpace = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) LLVMPointerTypeStorage(std::move(elementType), std::move(addressSpace)); + } + + Type elementType; + unsigned addressSpace; +}; +} // namespace detail +LLVMPointerType LLVMPointerType::get(::mlir::MLIRContext *context, Type elementType, unsigned addressSpace) { + return Base::get(context, std::move(elementType), std::move(addressSpace)); +} + +LLVMPointerType LLVMPointerType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type elementType, unsigned addressSpace) { + return Base::getChecked(emitError, context, elementType, addressSpace); +} + +LLVMPointerType LLVMPointerType::get(::mlir::MLIRContext *context, unsigned addressSpace) { + return Base::get(context, Type(), addressSpace); +} + +LLVMPointerType LLVMPointerType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, unsigned addressSpace) { + return Base::getChecked(emitError, context, Type(), addressSpace); +} + +::mlir::Type LLVMPointerType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_elementType; + ::mlir::FailureOr _result_addressSpace; + // Parse literal '<' + if (odsParser.parseOptionalLess()) { + } else { + { + auto odsCustomLoc = odsParser.getCurrentLocation(); + (void)odsCustomLoc; + auto odsCustomResult = parsePointer(odsParser, + ::mlir::detail::unwrapForCustomParse(_result_elementType), + ::mlir::detail::unwrapForCustomParse(_result_addressSpace)); + if (::mlir::failed(odsCustomResult)) return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + } + return odsParser.getChecked(odsLoc, odsParser.getContext(), + Type((_result_elementType.value_or(Type()))), + unsigned((_result_addressSpace.value_or(0)))); +} + +void LLVMPointerType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + if (!(getElementType() == Type()) || !(getAddressSpace() == 0)) { + odsPrinter << "<"; + printPointer(odsPrinter, + getElementType(), + getAddressSpace()); + odsPrinter << ">"; + } else { + } +} + +Type LLVMPointerType::getElementType() const { + return getImpl()->elementType; +} + +unsigned LLVMPointerType::getAddressSpace() const { + return getImpl()->addressSpace; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMPointerType) +namespace mlir { +namespace LLVM { +namespace detail { +struct LLVMScalableVectorTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + LLVMScalableVectorTypeStorage(Type elementType, unsigned minNumElements) : elementType(std::move(elementType)), minNumElements(std::move(minNumElements)) {} + + KeyTy getAsKey() const { + return KeyTy(elementType, minNumElements); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (elementType == std::get<0>(tblgenKey)) && (minNumElements == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static LLVMScalableVectorTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto elementType = std::move(std::get<0>(tblgenKey)); + auto minNumElements = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) LLVMScalableVectorTypeStorage(std::move(elementType), std::move(minNumElements)); + } + + Type elementType; + unsigned minNumElements; +}; +} // namespace detail +LLVMScalableVectorType LLVMScalableVectorType::get(::mlir::MLIRContext *context, Type elementType, unsigned minNumElements) { + return Base::get(context, std::move(elementType), std::move(minNumElements)); +} + +LLVMScalableVectorType LLVMScalableVectorType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type elementType, unsigned minNumElements) { + return Base::getChecked(emitError, context, elementType, minNumElements); +} + +::mlir::Type LLVMScalableVectorType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_elementType; + ::mlir::FailureOr _result_minNumElements; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse literal '?' + if (odsParser.parseQuestion()) return {}; + // Parse literal 'x' + if (odsParser.parseKeyword("x")) return {}; + + // Parse variable 'minNumElements' + _result_minNumElements = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_minNumElements)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVMScalableVectorType parameter 'minNumElements' which is to be a `unsigned`"); + return {}; + } + // Parse literal 'x' + if (odsParser.parseKeyword("x")) return {}; + { + auto odsCustomLoc = odsParser.getCurrentLocation(); + (void)odsCustomLoc; + auto odsCustomResult = parsePrettyLLVMType(odsParser, + ::mlir::detail::unwrapForCustomParse(_result_elementType)); + if (::mlir::failed(odsCustomResult)) return {}; + if (::mlir::failed(_result_elementType)) { + odsParser.emitError(odsCustomLoc, "custom parser failed to parse parameter 'elementType'"); + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_elementType)); + assert(::mlir::succeeded(_result_minNumElements)); + return odsParser.getChecked(odsLoc, odsParser.getContext(), + Type((*_result_elementType)), + unsigned((*_result_minNumElements))); +} + +void LLVMScalableVectorType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << "?"; + odsPrinter << ' ' << "x"; + odsPrinter << ' '; + odsPrinter.printStrippedAttrOrType(getMinNumElements()); + odsPrinter << ' ' << "x"; + odsPrinter << " "; + odsPrinter << ' '; + printPrettyLLVMType(odsPrinter, + getElementType()); + odsPrinter << ">"; +} + +Type LLVMScalableVectorType::getElementType() const { + return getImpl()->elementType; +} + +unsigned LLVMScalableVectorType::getMinNumElements() const { + return getImpl()->minNumElements; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMScalableVectorType) +namespace mlir { +namespace LLVM { +namespace detail { +struct LLVMTargetExtTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple<::llvm::StringRef, ::llvm::ArrayRef, ::llvm::ArrayRef>; + LLVMTargetExtTypeStorage(::llvm::StringRef extTypeName, ::llvm::ArrayRef typeParams, ::llvm::ArrayRef intParams) : extTypeName(std::move(extTypeName)), typeParams(std::move(typeParams)), intParams(std::move(intParams)) {} + + KeyTy getAsKey() const { + return KeyTy(extTypeName, typeParams, intParams); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (extTypeName == std::get<0>(tblgenKey)) && (::llvm::ArrayRef(typeParams) == ::llvm::ArrayRef(std::get<1>(tblgenKey))) && (::llvm::ArrayRef(intParams) == ::llvm::ArrayRef(std::get<2>(tblgenKey))); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); + } + + static LLVMTargetExtTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto extTypeName = std::move(std::get<0>(tblgenKey)); + auto typeParams = std::move(std::get<1>(tblgenKey)); + auto intParams = std::move(std::get<2>(tblgenKey)); + extTypeName = allocator.copyInto(extTypeName); + typeParams = allocator.copyInto(typeParams); + intParams = allocator.copyInto(intParams); + return new (allocator.allocate()) LLVMTargetExtTypeStorage(std::move(extTypeName), std::move(typeParams), std::move(intParams)); + } + + ::llvm::StringRef extTypeName; + ::llvm::ArrayRef typeParams; + ::llvm::ArrayRef intParams; +}; +} // namespace detail +LLVMTargetExtType LLVMTargetExtType::get(::mlir::MLIRContext *context, ::llvm::StringRef extTypeName, ::llvm::ArrayRef typeParams, ::llvm::ArrayRef intParams) { + return Base::get(context, std::move(extTypeName), std::move(typeParams), std::move(intParams)); +} + +::mlir::Type LLVMTargetExtType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_extTypeName; + ::mlir::FailureOr<::llvm::SmallVector> _result_typeParams; + ::mlir::FailureOr<::llvm::SmallVector> _result_intParams; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'extTypeName' + _result_extTypeName = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_extTypeName)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVMTargetExtType parameter 'extTypeName' which is to be a `::llvm::StringRef`"); + return {}; + } + // Parse literal ',' + if (odsParser.parseOptionalComma()) { + } else { + { + auto odsCustomLoc = odsParser.getCurrentLocation(); + (void)odsCustomLoc; + auto odsCustomResult = parseExtTypeParams(odsParser, + ::mlir::detail::unwrapForCustomParse(_result_typeParams), + ::mlir::detail::unwrapForCustomParse(_result_intParams)); + if (::mlir::failed(odsCustomResult)) return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_extTypeName)); + return LLVMTargetExtType::get(odsParser.getContext(), + ::llvm::StringRef((*_result_extTypeName)), + ::llvm::ArrayRef((_result_typeParams.value_or(::llvm::SmallVector()))), + ::llvm::ArrayRef((_result_intParams.value_or(::llvm::SmallVector())))); +} + +void LLVMTargetExtType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter.printString(getExtTypeName());; + if (!(::llvm::ArrayRef(getTypeParams()) == ::llvm::ArrayRef(::llvm::SmallVector())) || !(::llvm::ArrayRef(getIntParams()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { + odsPrinter << ","; + odsPrinter << ' '; + printExtTypeParams(odsPrinter, + getTypeParams(), + getIntParams()); + } else { + } + odsPrinter << ">"; +} + +::llvm::StringRef LLVMTargetExtType::getExtTypeName() const { + return getImpl()->extTypeName; +} + +::llvm::ArrayRef LLVMTargetExtType::getTypeParams() const { + return getImpl()->typeParams; +} + +::llvm::ArrayRef LLVMTargetExtType::getIntParams() const { + return getImpl()->intParams; +} + +} // namespace LLVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMTargetExtType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..ba2f14f173aa0c33db38130d66b4f836eceabfd8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h @@ -0,0 +1,297 @@ +//===- LLVMTypes.h - MLIR LLVM dialect types --------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the types for the LLVM dialect in MLIR. These MLIR types +// correspond to the LLVM IR type system. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_LLVMTYPES_H_ +#define MLIR_DIALECT_LLVMIR_LLVMTYPES_H_ + +#include "mlir/IR/Types.h" +#include "mlir/Interfaces/DataLayoutInterfaces.h" +#include "mlir/Interfaces/MemorySlotInterfaces.h" +#include + +namespace llvm { +class ElementCount; +class TypeSize; +} // namespace llvm + +namespace mlir { + +class AsmParser; +class AsmPrinter; + +namespace LLVM { +class LLVMDialect; + +namespace detail { +struct LLVMFunctionTypeStorage; +struct LLVMPointerTypeStorage; +struct LLVMStructTypeStorage; +struct LLVMTypeAndSizeStorage; +} // namespace detail +} // namespace LLVM +} // namespace mlir + +//===----------------------------------------------------------------------===// +// ODS-Generated Declarations +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/LLVMIR/LLVMTypeInterfaces.h.inc" + +#define GET_TYPEDEF_CLASSES +#include "mlir/Dialect/LLVMIR/LLVMTypes.h.inc" + +namespace mlir { +namespace LLVM { + +//===----------------------------------------------------------------------===// +// Trivial types. +//===----------------------------------------------------------------------===// + +// Batch-define trivial types. +#define DEFINE_TRIVIAL_LLVM_TYPE(ClassName) \ + class ClassName : public Type::TypeBase { \ + public: \ + using Base::Base; \ + } + +DEFINE_TRIVIAL_LLVM_TYPE(LLVMVoidType); +DEFINE_TRIVIAL_LLVM_TYPE(LLVMPPCFP128Type); +DEFINE_TRIVIAL_LLVM_TYPE(LLVMX86MMXType); +DEFINE_TRIVIAL_LLVM_TYPE(LLVMTokenType); +DEFINE_TRIVIAL_LLVM_TYPE(LLVMLabelType); +DEFINE_TRIVIAL_LLVM_TYPE(LLVMMetadataType); + +#undef DEFINE_TRIVIAL_LLVM_TYPE + +//===----------------------------------------------------------------------===// +// LLVMStructType. +//===----------------------------------------------------------------------===// + +/// LLVM dialect structure type representing a collection of different-typed +/// elements manipulated together. Structured can optionally be packed, meaning +/// that their elements immediately follow each other in memory without +/// accounting for potential alignment. +/// +/// Structure types can be identified (named) or literal. Literal structures +/// are uniquely represented by the list of types they contain and packedness. +/// Literal structure types are immutable after construction. +/// +/// Identified structures are uniquely represented by their name, a string. They +/// have a mutable component, consisting of the list of types they contain, +/// the packedness and the opacity bits. Identified structs can be created +/// without providing the lists of element types, making them suitable to +/// represent recursive, i.e. self-referring, structures. Identified structs +/// without body are considered opaque. For such structs, one can set the body. +/// Identified structs can be created as intentionally-opaque, implying that the +/// caller does not intend to ever set the body (e.g. forward-declarations of +/// structs from another module) and wants to disallow further modification of +/// the body. For intentionally-opaque structs or non-opaque structs with the +/// body, one is not allowed to set another body (however, one can set exactly +/// the same body). +/// +/// Note that the packedness of the struct takes place in uniquing of literal +/// structs, but does not in uniquing of identified structs. +class LLVMStructType + : public Type::TypeBase { +public: + /// Inherit base constructors. + using Base::Base; + + /// Checks if the given type can be contained in a structure type. + static bool isValidElementType(Type type); + + /// Gets or creates an identified struct with the given name in the provided + /// context. Note that unlike llvm::StructType::create, this function will + /// _NOT_ rename a struct in case a struct with the same name already exists + /// in the context. Instead, it will just return the existing struct, + /// similarly to the rest of MLIR type ::get methods. + static LLVMStructType getIdentified(MLIRContext *context, StringRef name); + static LLVMStructType + getIdentifiedChecked(function_ref emitError, + MLIRContext *context, StringRef name); + + /// Gets a new identified struct with the given body. The body _cannot_ be + /// changed later. If a struct with the given name already exists, renames + /// the struct by appending a `.` followed by a number to the name. Renaming + /// happens even if the existing struct has the same body. + static LLVMStructType getNewIdentified(MLIRContext *context, StringRef name, + ArrayRef elements, + bool isPacked = false); + + /// Gets or creates a literal struct with the given body in the provided + /// context. + static LLVMStructType getLiteral(MLIRContext *context, ArrayRef types, + bool isPacked = false); + static LLVMStructType + getLiteralChecked(function_ref emitError, + MLIRContext *context, ArrayRef types, + bool isPacked = false); + + /// Gets or creates an intentionally-opaque identified struct. Such a struct + /// cannot have its body set. To create an opaque struct with a mutable body, + /// use `getIdentified`. Note that unlike llvm::StructType::create, this + /// function will _NOT_ rename a struct in case a struct with the same name + /// already exists in the context. Instead, it will just return the existing + /// struct, similarly to the rest of MLIR type ::get methods. + static LLVMStructType getOpaque(StringRef name, MLIRContext *context); + static LLVMStructType + getOpaqueChecked(function_ref emitError, + MLIRContext *context, StringRef name); + + /// Set the body of an identified struct. Returns failure if the body could + /// not be set, e.g. if the struct already has a body or if it was marked as + /// intentionally opaque. This might happen in a multi-threaded context when a + /// different thread modified the struct after it was created. Most callers + /// are likely to assert this always succeeds, but it is possible to implement + /// a local renaming scheme based on the result of this call. + LogicalResult setBody(ArrayRef types, bool isPacked); + + /// Checks if a struct is packed. + bool isPacked() const; + + /// Checks if a struct is identified. + bool isIdentified() const; + + /// Checks if a struct is opaque. + bool isOpaque(); + + /// Checks if a struct is initialized. + bool isInitialized(); + + /// Returns the name of an identified struct. + StringRef getName(); + + /// Returns the list of element types contained in a non-opaque struct. + ArrayRef getBody() const; + + /// Verifies that the type about to be constructed is well-formed. + static LogicalResult verify(function_ref emitError, + StringRef, bool); + static LogicalResult verify(function_ref emitError, + ArrayRef types, bool); + using Base::verify; + + /// Hooks for DataLayoutTypeInterface. Should not be called directly. Obtain a + /// DataLayout instance and query it instead. + unsigned getTypeSizeInBits(const DataLayout &dataLayout, + DataLayoutEntryListRef params) const; + + unsigned getABIAlignment(const DataLayout &dataLayout, + DataLayoutEntryListRef params) const; + + unsigned getPreferredAlignment(const DataLayout &dataLayout, + DataLayoutEntryListRef params) const; + + bool areCompatible(DataLayoutEntryListRef oldLayout, + DataLayoutEntryListRef newLayout) const; + + LogicalResult verifyEntries(DataLayoutEntryListRef entries, + Location loc) const; + + /// Destructs the struct into its indexed field types. + std::optional> getSubelementIndexMap(); + + /// Returns which type is stored at a given integer index within the struct. + Type getTypeAtIndex(Attribute index); +}; + +//===----------------------------------------------------------------------===// +// Printing and parsing. +//===----------------------------------------------------------------------===// + +namespace detail { +/// Parses an LLVM dialect type. +Type parseType(DialectAsmParser &parser); + +/// Prints an LLVM Dialect type. +void printType(Type type, AsmPrinter &printer); +} // namespace detail + +/// Parse any MLIR type or a concise syntax for LLVM types. +ParseResult parsePrettyLLVMType(AsmParser &p, Type &type); +/// Print any MLIR type or a concise syntax for LLVM types. +void printPrettyLLVMType(AsmPrinter &p, Type type); + +//===----------------------------------------------------------------------===// +// Utility functions. +//===----------------------------------------------------------------------===// + +/// Returns `true` if the given type is compatible with the LLVM dialect. This +/// is an alias to `LLVMDialect::isCompatibleType`. +bool isCompatibleType(Type type); + +/// Returns `true` if the given outer type is compatible with the LLVM dialect +/// without checking its potential nested types such as struct elements. +bool isCompatibleOuterType(Type type); + +/// Returns `true` if the given type is a floating-point type compatible with +/// the LLVM dialect. +bool isCompatibleFloatingPointType(Type type); + +/// Returns `true` if the given type is a vector type compatible with the LLVM +/// dialect. Compatible types include 1D built-in vector types of built-in +/// integers and floating-point values, LLVM dialect fixed vector types of LLVM +/// dialect pointers and LLVM dialect scalable vector types. +bool isCompatibleVectorType(Type type); + +/// Returns the element type of any vector type compatible with the LLVM +/// dialect. +Type getVectorElementType(Type type); + +/// Returns the element count of any LLVM-compatible vector type. +llvm::ElementCount getVectorNumElements(Type type); + +/// Returns whether a vector type is scalable or not. +bool isScalableVectorType(Type vectorType); + +/// Creates an LLVM dialect-compatible vector type with the given element type +/// and length. +Type getVectorType(Type elementType, unsigned numElements, + bool isScalable = false); + +/// Creates an LLVM dialect-compatible vector type with the given element type +/// and length. +Type getVectorType(Type elementType, const llvm::ElementCount &numElements); + +/// Creates an LLVM dialect-compatible type with the given element type and +/// length. +Type getFixedVectorType(Type elementType, unsigned numElements); + +/// Creates an LLVM dialect-compatible type with the given element type and +/// length. +Type getScalableVectorType(Type elementType, unsigned numElements); + +/// Returns the size of the given primitive LLVM dialect-compatible type +/// (including vectors) in bits, for example, the size of i16 is 16 and +/// the size of vector<4xi16> is 64. Returns 0 for non-primitive +/// (aggregates such as struct) or types that don't have a size (such as void). +llvm::TypeSize getPrimitiveTypeSizeInBits(Type type); + +/// The positions of different values in the data layout entry for pointers. +enum class PtrDLEntryPos { Size = 0, Abi = 1, Preferred = 2, Index = 3 }; + +/// Returns the value that corresponds to named position `pos` from the +/// data layout entry `attr` assuming it's a dense integer elements attribute. +/// Returns `std::nullopt` if `pos` is not present in the entry. +/// Currently only `PtrDLEntryPos::Index` is optional, and all other positions +/// may be assumed to be present. +std::optional extractPointerSpecValue(Attribute attr, + PtrDLEntryPos pos); + +} // namespace LLVM +} // namespace mlir + +#endif // MLIR_DIALECT_LLVMIR_LLVMTYPES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e2073827029d948eb1dd7bcab721981cf55b82a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h.inc @@ -0,0 +1,214 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace LLVM { +class LLVMArrayType; +class LLVMFixedVectorType; +class LLVMFunctionType; +class LLVMPointerType; +class LLVMScalableVectorType; +class LLVMTargetExtType; +namespace detail { +struct LLVMArrayTypeStorage; +} // namespace detail +class LLVMArrayType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + /// Checks if the given type can be used inside an array type. + static bool isValidElementType(Type type); + using Base::getChecked; + static LLVMArrayType get(::mlir::MLIRContext *context, Type elementType, unsigned numElements); + static LLVMArrayType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type elementType, unsigned numElements); + static LLVMArrayType get(Type elementType, unsigned numElements); + static LLVMArrayType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType, unsigned numElements); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType, unsigned numElements); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"array"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + Type getElementType() const; + unsigned getNumElements() const; + unsigned getTypeSize(const ::mlir::DataLayout &dataLayout, ::mlir::DataLayoutEntryListRef params) const; + unsigned getTypeSizeInBits(const ::mlir::DataLayout &dataLayout, ::mlir::DataLayoutEntryListRef params) const; + unsigned getABIAlignment(const ::mlir::DataLayout &dataLayout, ::mlir::DataLayoutEntryListRef params) const; + unsigned getPreferredAlignment(const ::mlir::DataLayout &dataLayout, ::mlir::DataLayoutEntryListRef params) const; + ::std::optional<::llvm::DenseMap<::mlir::Attribute, ::mlir::Type>> getSubelementIndexMap() const; + ::mlir::Type getTypeAtIndex(::mlir::Attribute index) const; +}; +namespace detail { +struct LLVMFixedVectorTypeStorage; +} // namespace detail +class LLVMFixedVectorType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + /// Checks if the given type can be used in a vector type. + static bool isValidElementType(Type type); + using Base::getChecked; + static LLVMFixedVectorType get(::mlir::MLIRContext *context, Type elementType, unsigned numElements); + static LLVMFixedVectorType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type elementType, unsigned numElements); + static LLVMFixedVectorType get(Type elementType, unsigned numElements); + static LLVMFixedVectorType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType, unsigned numElements); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType, unsigned numElements); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"vec"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + Type getElementType() const; + unsigned getNumElements() const; +}; +namespace detail { +struct LLVMFunctionTypeStorage; +} // namespace detail +class LLVMFunctionType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + /// Checks if the given type can be used an argument in a function type. + static bool isValidArgumentType(Type type); + + /// Checks if the given type can be used as a result in a function type. + static bool isValidResultType(Type type); + + /// Returns whether the function is variadic. + bool isVarArg() const { return getVarArg(); } + + /// Returns a clone of this function type with the given argument + /// and result types. + LLVMFunctionType clone(TypeRange inputs, TypeRange results) const; + + /// Returns the result type of the function as an ArrayRef, enabling better + /// integration with generic MLIR utilities. + ArrayRef getReturnTypes() const; + + /// Returns the number of arguments to the function. + unsigned getNumParams() const { return getParams().size(); } + + /// Returns `i`-th argument of the function. Asserts on out-of-bounds. + Type getParamType(unsigned i) { return getParams()[i]; } + using Base::getChecked; + static LLVMFunctionType get(::mlir::MLIRContext *context, Type returnType, ::llvm::ArrayRef params, bool varArg); + static LLVMFunctionType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type returnType, ::llvm::ArrayRef params, bool varArg); + static LLVMFunctionType get(Type result, ArrayRef arguments, bool isVarArg = false); + static LLVMFunctionType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type result, ArrayRef arguments, bool isVarArg = false); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type returnType, ::llvm::ArrayRef params, bool varArg); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"func"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + Type getReturnType() const; + ::llvm::ArrayRef getParams() const; + bool getVarArg() const; +}; +namespace detail { +struct LLVMPointerTypeStorage; +} // namespace detail +class LLVMPointerType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + /// Returns `true` if this type is the opaque pointer type, i.e., it has no + /// pointed-to type. + bool isOpaque() const { return !getElementType(); } + + /// Checks if the given type can have a pointer type pointing to it. + static bool isValidElementType(Type type); + using Base::getChecked; + static LLVMPointerType get(::mlir::MLIRContext *context, Type elementType, unsigned addressSpace); + static LLVMPointerType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type elementType, unsigned addressSpace); + static LLVMPointerType get(Type elementType, unsigned addressSpace = 0); + static LLVMPointerType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType, unsigned addressSpace = 0); + static LLVMPointerType get(::mlir::MLIRContext *context, unsigned addressSpace = 0); + static LLVMPointerType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, unsigned addressSpace = 0); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType, unsigned addressSpace); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"ptr"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + Type getElementType() const; + unsigned getAddressSpace() const; + unsigned getTypeSizeInBits(const ::mlir::DataLayout &dataLayout, ::mlir::DataLayoutEntryListRef params) const; + unsigned getABIAlignment(const ::mlir::DataLayout &dataLayout, ::mlir::DataLayoutEntryListRef params) const; + unsigned getPreferredAlignment(const ::mlir::DataLayout &dataLayout, ::mlir::DataLayoutEntryListRef params) const; + bool areCompatible(::mlir::DataLayoutEntryListRef oldLayout, ::mlir::DataLayoutEntryListRef newLayout) const; + ::mlir::LogicalResult verifyEntries(::mlir::DataLayoutEntryListRef entries, ::mlir::Location loc) const; +}; +namespace detail { +struct LLVMScalableVectorTypeStorage; +} // namespace detail +class LLVMScalableVectorType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + /// Checks if the given type can be used in a vector type. + static bool isValidElementType(Type type); + using Base::getChecked; + static LLVMScalableVectorType get(::mlir::MLIRContext *context, Type elementType, unsigned minNumElements); + static LLVMScalableVectorType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Type elementType, unsigned minNumElements); + static LLVMScalableVectorType get(Type elementType, unsigned minNumElements); + static LLVMScalableVectorType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType, unsigned minNumElements); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType, unsigned minNumElements); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"vec"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + Type getElementType() const; + unsigned getMinNumElements() const; +}; +namespace detail { +struct LLVMTargetExtTypeStorage; +} // namespace detail +class LLVMTargetExtType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + enum Property { + /// zeroinitializer is valid for this target extension type. + HasZeroInit = 1U << 0, + /// This type may be used as the value type of a global variable. + CanBeGlobal = 1U << 1, + }; + + bool hasProperty(Property Prop) const; + bool supportsMemOps() const; + static LLVMTargetExtType get(::mlir::MLIRContext *context, ::llvm::StringRef extTypeName, ::llvm::ArrayRef typeParams, ::llvm::ArrayRef intParams); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"target"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::StringRef getExtTypeName() const; + ::llvm::ArrayRef getTypeParams() const; + ::llvm::ArrayRef getIntParams() const; +}; +} // namespace LLVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMArrayType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMFixedVectorType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMFunctionType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMPointerType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMScalableVectorType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::LLVM::LLVMTargetExtType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..9f9b7237c80a8c622c92b4dd3a33c62a441ac48c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMConversions.inc @@ -0,0 +1,590 @@ +if (auto op = dyn_cast<::mlir::NVVM::Barrier0Op>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_barrier0); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::BlockDimXOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_ntid_x, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::BlockDimYOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_ntid_y, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::BlockDimZOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_ntid_z, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::BlockIdXOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_ctaid_x, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::BlockIdYOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_ctaid_y, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::BlockIdZOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_ctaid_z, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::BlockInClusterIdXOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_cluster_ctaid_x, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::BlockInClusterIdYOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_cluster_ctaid_y, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::BlockInClusterIdZOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_cluster_ctaid_z, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterArriveOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_barrier_cluster_arrive); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterArriveRelaxedOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_barrier_cluster_arrive_relaxed); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterDim>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_cluster_nctarank, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterDimXOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_nclusterid_x, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterDimYOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_nclusterid_y, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterDimZOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_nclusterid_z, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterId>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_cluster_ctarank, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterIdXOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_clusterid_x, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterIdYOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_clusterid_y, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterIdZOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_clusterid_z, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ClusterWaitOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_barrier_cluster_wait); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::CpAsyncCommitGroupOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_cp_async_commit_group); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::CpAsyncOp>(opInst)) { + + llvm::Intrinsic::ID id; + switch (op.getSize()) { + case 4: + id = llvm::Intrinsic::nvvm_cp_async_ca_shared_global_4; + break; + case 8: + id = llvm::Intrinsic::nvvm_cp_async_ca_shared_global_8; + break; + case 16: + if(op.getModifier() == NVVM::LoadCacheModifierKind::CG) + id = llvm::Intrinsic::nvvm_cp_async_cg_shared_global_16; + else if(op.getModifier() == NVVM::LoadCacheModifierKind::CA) + id = llvm::Intrinsic::nvvm_cp_async_ca_shared_global_16; + else + llvm_unreachable("unsupported cache modifier"); + break; + default: + llvm_unreachable("unsupported async copy size"); + } + createIntrinsicCall(builder, id, {moduleTranslation.lookupValue(op.getDst()), moduleTranslation.lookupValue(op.getSrc())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::CpAsyncWaitGroupOp>(opInst)) { + + createIntrinsicCall( + builder, + llvm::Intrinsic::nvvm_cp_async_wait_group, + llvm::ConstantInt::get( + llvm::Type::getInt32Ty(moduleTranslation.getLLVMContext()), + op.getN())); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::FenceScClusterOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_fence_sc_cluster); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::GridDimXOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_nctaid_x, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::GridDimYOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_nctaid_y, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::GridDimZOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_nctaid_z, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::GridInClusterDimXOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_cluster_nctaid_x, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::GridInClusterDimYOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_cluster_nctaid_y, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::GridInClusterDimZOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_cluster_nctaid_z, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::LaneIdOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_laneid, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::LdMatrixOp>(opInst)) { + + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + auto intId = getLdMatrixIntrinsicId(op.getLayout(), op.getNum()); + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, intId, operands, {operands[0]->getType()}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierArriveNocompleteOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_arrive_noComplete, {moduleTranslation.lookupValue(op.getAddr()), moduleTranslation.lookupValue(op.getCount())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierArriveNocompleteSharedOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_arrive_noComplete_shared, {moduleTranslation.lookupValue(op.getAddr()), moduleTranslation.lookupValue(op.getCount())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierArriveOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_arrive, {moduleTranslation.lookupValue(op.getAddr())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierArriveSharedOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_arrive_shared, {moduleTranslation.lookupValue(op.getAddr())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierInitOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_init, {moduleTranslation.lookupValue(op.getAddr()), moduleTranslation.lookupValue(op.getCount())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierInitSharedOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_init_shared, {moduleTranslation.lookupValue(op.getAddr()), moduleTranslation.lookupValue(op.getCount())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierInvalOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_inval, {moduleTranslation.lookupValue(op.getAddr())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierInvalSharedOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_inval_shared, {moduleTranslation.lookupValue(op.getAddr())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierTestWaitOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_test_wait, {moduleTranslation.lookupValue(op.getAddr()), moduleTranslation.lookupValue(op.getState())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MBarrierTestWaitSharedOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, llvm::Intrinsic::nvvm_mbarrier_test_wait_shared, {moduleTranslation.lookupValue(op.getAddr()), moduleTranslation.lookupValue(op.getState())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::MmaOp>(opInst)) { + + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + auto intId = mlir::NVVM::MmaOp::getIntrinsicID( + op.getShape().getM(), op.getShape().getN(), op.getShape().getK(), + op.getB1Op(), op.getIntOverflowBehavior(), + op.getLayoutA(), op.getLayoutB(), + *op.getMultiplicandAPtxType(), + *op.getMultiplicandBPtxType(), + op.accumPtxType(), + op.resultPtxType()); + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall( + builder, intId, operands); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::RcpApproxFtzF32Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_rcp_approx_ftz_f, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ReduxOp>(opInst)) { + + auto intId = getReduxIntrinsicId(moduleTranslation.convertType(op.getResult().getType()), op.getKind()); + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, intId, {moduleTranslation.lookupValue(op.getVal()), moduleTranslation.lookupValue(op.getMaskAndClamp())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ShflOp>(opInst)) { + + auto intId = getShflIntrinsicId( + moduleTranslation.convertType(op.getResult().getType()), op.getKind(), static_cast(op.getReturnValueAndIsValid())); + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, + intId, {moduleTranslation.lookupValue(op.getDst()), moduleTranslation.lookupValue(op.getVal()), moduleTranslation.lookupValue(op.getOffset()), moduleTranslation.lookupValue(op.getMaskAndClamp())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::SyncWarpOp>(opInst)) { + + createIntrinsicCall(builder, llvm::Intrinsic::nvvm_bar_warp_sync, {moduleTranslation.lookupValue(op.getMask())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ThreadIdXOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_tid_x, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ThreadIdYOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_tid_y, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::ThreadIdZOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_tid_z, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::VoteBallotOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, + llvm::Intrinsic::nvvm_vote_ballot_sync, {moduleTranslation.lookupValue(op.getMask()), moduleTranslation.lookupValue(op.getPred())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::WMMALoadOp>(opInst)) { + + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + auto intId = mlir::NVVM::WMMALoadOp::getIntrinsicID( + op.getM(), op.getN(), op.getK(), op.getLayout(), op.getEltype(), op.getFrag()); + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, intId, operands, {operands[0]->getType()}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::WMMAMmaOp>(opInst)) { + + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + auto intId = mlir::NVVM::WMMAMmaOp::getIntrinsicID( + op.getM(), op.getN(), op.getK(), op.getLayoutA(), op.getLayoutB(), op.getEltypeA(), op.getEltypeB()); + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, intId, operands); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::WMMAStoreOp>(opInst)) { + + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + auto intId = + mlir::NVVM::WMMAStoreOp::getIntrinsicID(op.getM(), op.getN(), op.getK(), op.getLayout(), op.getEltype()); + createIntrinsicCall(builder, intId, operands, {operands[0]->getType()}); + + return success(); +} +if (auto op = dyn_cast<::mlir::NVVM::WarpSizeOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::nvvm_read_ptx_sreg_warpsize, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..1644d0029380cec0c98d67c5f802e1f06be1b797 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h @@ -0,0 +1,58 @@ +//===- NVVMDialect.h - MLIR NVVM IR dialect ---------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the NVVM IR dialect in MLIR, containing NVVM operations and +// NVVM specific extensions to the LLVM type system. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_NVVMDIALECT_H_ +#define MLIR_DIALECT_LLVMIR_NVVMDIALECT_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" +#include "llvm/IR/IntrinsicsNVPTX.h" + +#include "mlir/Dialect/LLVMIR/NVVMOpsEnums.h.inc" + +namespace mlir { +namespace NVVM { + +#include "mlir/Dialect/LLVMIR/NVVMOpsInterface.h.inc" + +/// NVVM memory space identifiers. +enum NVVMMemorySpace { + /// Global memory space identifier. + kGlobalMemorySpace = 1, + /// Shared memory space identifier. + kSharedMemorySpace = 3 +}; + +/// Return the element type and number of elements associated with a wmma matrix +/// of given chracteristics. This matches the logic in IntrinsicsNVVM.td +/// WMMA_REGS structure. +std::pair inferMMAType(mlir::NVVM::MMATypes type, + mlir::NVVM::MMAFrag frag, int nRow, + int nCol, + mlir::MLIRContext *context); +} // namespace NVVM +} // namespace mlir + +///// Ops ///// +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/LLVMIR/NVVMOpsAttributes.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/LLVMIR/NVVMOps.h.inc" + +#include "mlir/Dialect/LLVMIR/NVVMOpsDialect.h.inc" + +#endif /* MLIR_DIALECT_LLVMIR_NVVMDIALECT_H_ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..264132aad58916424d419641c5619ea922e8c58f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.cpp.inc @@ -0,0 +1,15083 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::NVVM::Barrier0Op, +::mlir::NVVM::BlockDimXOp, +::mlir::NVVM::BlockDimYOp, +::mlir::NVVM::BlockDimZOp, +::mlir::NVVM::BlockIdXOp, +::mlir::NVVM::BlockIdYOp, +::mlir::NVVM::BlockIdZOp, +::mlir::NVVM::BlockInClusterIdXOp, +::mlir::NVVM::BlockInClusterIdYOp, +::mlir::NVVM::BlockInClusterIdZOp, +::mlir::NVVM::ClusterArriveOp, +::mlir::NVVM::ClusterArriveRelaxedOp, +::mlir::NVVM::ClusterDim, +::mlir::NVVM::ClusterDimXOp, +::mlir::NVVM::ClusterDimYOp, +::mlir::NVVM::ClusterDimZOp, +::mlir::NVVM::ClusterId, +::mlir::NVVM::ClusterIdXOp, +::mlir::NVVM::ClusterIdYOp, +::mlir::NVVM::ClusterIdZOp, +::mlir::NVVM::ClusterWaitOp, +::mlir::NVVM::CpAsyncBulkTensorGlobalToSharedClusterOp, +::mlir::NVVM::CpAsyncBulkTensorSharedCTAToGlobalOp, +::mlir::NVVM::CpAsyncCommitGroupOp, +::mlir::NVVM::CpAsyncOp, +::mlir::NVVM::CpAsyncWaitGroupOp, +::mlir::NVVM::ElectSyncOp, +::mlir::NVVM::FenceScClusterOp, +::mlir::NVVM::GridDimXOp, +::mlir::NVVM::GridDimYOp, +::mlir::NVVM::GridDimZOp, +::mlir::NVVM::GridInClusterDimXOp, +::mlir::NVVM::GridInClusterDimYOp, +::mlir::NVVM::GridInClusterDimZOp, +::mlir::NVVM::LaneIdOp, +::mlir::NVVM::LdMatrixOp, +::mlir::NVVM::MBarrierArriveExpectTxOp, +::mlir::NVVM::MBarrierArriveExpectTxSharedOp, +::mlir::NVVM::MBarrierArriveNocompleteOp, +::mlir::NVVM::MBarrierArriveNocompleteSharedOp, +::mlir::NVVM::MBarrierArriveOp, +::mlir::NVVM::MBarrierArriveSharedOp, +::mlir::NVVM::MBarrierInitOp, +::mlir::NVVM::MBarrierInitSharedOp, +::mlir::NVVM::MBarrierInvalOp, +::mlir::NVVM::MBarrierInvalSharedOp, +::mlir::NVVM::MBarrierTestWaitOp, +::mlir::NVVM::MBarrierTestWaitSharedOp, +::mlir::NVVM::MBarrierTryWaitParityOp, +::mlir::NVVM::MBarrierTryWaitParitySharedOp, +::mlir::NVVM::MmaOp, +::mlir::NVVM::RcpApproxFtzF32Op, +::mlir::NVVM::ReduxOp, +::mlir::NVVM::ShflOp, +::mlir::NVVM::SyncWarpOp, +::mlir::NVVM::ThreadIdXOp, +::mlir::NVVM::ThreadIdYOp, +::mlir::NVVM::ThreadIdZOp, +::mlir::NVVM::VoteBallotOp, +::mlir::NVVM::WMMALoadOp, +::mlir::NVVM::WMMAMmaOp, +::mlir::NVVM::WMMAStoreOp, +::mlir::NVVM::WarpSizeOp, +::mlir::NVVM::WgmmaFenceAlignedOp, +::mlir::NVVM::WgmmaGroupSyncAlignedOp, +::mlir::NVVM::WgmmaMmaAsyncOp, +::mlir::NVVM::WgmmaWaitGroupSyncOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace NVVM { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleOuterType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) || ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType().isSignlessInteger(64))))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getAddressSpace() == 3)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer to 64-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) || ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType().isSignlessInteger(64))))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getAddressSpace() == 0)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer to 64-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(32)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) || ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType().isSignlessInteger(8))))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getAddressSpace() == 3)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer to 8-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) || ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getElementType().isSignlessInteger(8))))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getAddressSpace() == 1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer to 8-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMStructType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM structure type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isF32()))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit float, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVVMOps11( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(64)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 64-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::LoadCacheModifierKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: NVVM load cache modifier kind"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: NVVM MMA layout"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::MMAShapeAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Attribute for MMA operation shape."; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::MMAB1OpAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: MMA binary operations"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::MMAIntOverflowAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: MMA overflow options"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::MMATypesAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: NVVM MMA types"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::ReduxKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: NVVM redux kind"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps8( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::ShflKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: NVVM shuffle kind"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps8( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps8(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps9( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps9( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps9(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps10( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::MMAFragAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: NVVM MMA frag type"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps10( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps10(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps11( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::WGMMATypesAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: NVVM WGMMA types"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps11( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps11(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps12( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::WGMMAScaleOutAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: WGMMA input predicate"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps12( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps12(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps13( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::NVVM::WGMMAScaleInAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: WGMMA overflow options"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVVMOps13( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVVMOps13(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::Barrier0Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Barrier0OpGenericAdaptorBase::Barrier0OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.barrier0", odsAttrs.getContext()); +} + +Barrier0OpGenericAdaptorBase::Barrier0OpGenericAdaptorBase(Barrier0Op op) : Barrier0OpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Barrier0OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Barrier0OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +Barrier0OpAdaptor::Barrier0OpAdaptor(Barrier0Op op) : Barrier0OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Barrier0OpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair Barrier0Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Barrier0Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair Barrier0Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Barrier0Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void Barrier0Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void Barrier0Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Barrier0Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult Barrier0Op::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult Barrier0Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult Barrier0Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Barrier0Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::Barrier0Op) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockDimXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockDimXOpGenericAdaptorBase::BlockDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.ntid.x", odsAttrs.getContext()); +} + +BlockDimXOpGenericAdaptorBase::BlockDimXOpGenericAdaptorBase(BlockDimXOp op) : BlockDimXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockDimXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockDimXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockDimXOpAdaptor::BlockDimXOpAdaptor(BlockDimXOp op) : BlockDimXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockDimXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockDimXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockDimXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockDimXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockDimXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockDimXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockDimXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockDimXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockDimXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockDimXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockDimXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockDimXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockDimXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockDimYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockDimYOpGenericAdaptorBase::BlockDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.ntid.y", odsAttrs.getContext()); +} + +BlockDimYOpGenericAdaptorBase::BlockDimYOpGenericAdaptorBase(BlockDimYOp op) : BlockDimYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockDimYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockDimYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockDimYOpAdaptor::BlockDimYOpAdaptor(BlockDimYOp op) : BlockDimYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockDimYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockDimYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockDimYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockDimYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockDimYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockDimYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockDimYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockDimYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockDimYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockDimYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockDimYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockDimYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockDimYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockDimZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockDimZOpGenericAdaptorBase::BlockDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.ntid.z", odsAttrs.getContext()); +} + +BlockDimZOpGenericAdaptorBase::BlockDimZOpGenericAdaptorBase(BlockDimZOp op) : BlockDimZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockDimZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockDimZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockDimZOpAdaptor::BlockDimZOpAdaptor(BlockDimZOp op) : BlockDimZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockDimZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockDimZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockDimZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockDimZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockDimZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockDimZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockDimZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockDimZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockDimZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockDimZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockDimZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockDimZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockDimZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockIdXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockIdXOpGenericAdaptorBase::BlockIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.ctaid.x", odsAttrs.getContext()); +} + +BlockIdXOpGenericAdaptorBase::BlockIdXOpGenericAdaptorBase(BlockIdXOp op) : BlockIdXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockIdXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockIdXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockIdXOpAdaptor::BlockIdXOpAdaptor(BlockIdXOp op) : BlockIdXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockIdXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockIdXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockIdXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockIdXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockIdXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockIdXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockIdXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockIdXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockIdXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockIdXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockIdXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockIdXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockIdXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockIdYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockIdYOpGenericAdaptorBase::BlockIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.ctaid.y", odsAttrs.getContext()); +} + +BlockIdYOpGenericAdaptorBase::BlockIdYOpGenericAdaptorBase(BlockIdYOp op) : BlockIdYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockIdYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockIdYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockIdYOpAdaptor::BlockIdYOpAdaptor(BlockIdYOp op) : BlockIdYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockIdYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockIdYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockIdYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockIdYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockIdYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockIdYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockIdYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockIdYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockIdYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockIdYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockIdYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockIdYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockIdYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockIdZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockIdZOpGenericAdaptorBase::BlockIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.ctaid.z", odsAttrs.getContext()); +} + +BlockIdZOpGenericAdaptorBase::BlockIdZOpGenericAdaptorBase(BlockIdZOp op) : BlockIdZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockIdZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockIdZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockIdZOpAdaptor::BlockIdZOpAdaptor(BlockIdZOp op) : BlockIdZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockIdZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockIdZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockIdZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockIdZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockIdZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockIdZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockIdZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockIdZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockIdZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockIdZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockIdZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockIdZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockIdZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockInClusterIdXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockInClusterIdXOpGenericAdaptorBase::BlockInClusterIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.cluster.ctaid.x", odsAttrs.getContext()); +} + +BlockInClusterIdXOpGenericAdaptorBase::BlockInClusterIdXOpGenericAdaptorBase(BlockInClusterIdXOp op) : BlockInClusterIdXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockInClusterIdXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockInClusterIdXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockInClusterIdXOpAdaptor::BlockInClusterIdXOpAdaptor(BlockInClusterIdXOp op) : BlockInClusterIdXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockInClusterIdXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockInClusterIdXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockInClusterIdXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockInClusterIdXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockInClusterIdXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockInClusterIdXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockInClusterIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockInClusterIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockInClusterIdXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockInClusterIdXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockInClusterIdXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockInClusterIdXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockInClusterIdXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockInClusterIdXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockInClusterIdXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockInClusterIdYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockInClusterIdYOpGenericAdaptorBase::BlockInClusterIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.cluster.ctaid.y", odsAttrs.getContext()); +} + +BlockInClusterIdYOpGenericAdaptorBase::BlockInClusterIdYOpGenericAdaptorBase(BlockInClusterIdYOp op) : BlockInClusterIdYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockInClusterIdYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockInClusterIdYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockInClusterIdYOpAdaptor::BlockInClusterIdYOpAdaptor(BlockInClusterIdYOp op) : BlockInClusterIdYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockInClusterIdYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockInClusterIdYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockInClusterIdYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockInClusterIdYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockInClusterIdYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockInClusterIdYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockInClusterIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockInClusterIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockInClusterIdYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockInClusterIdYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockInClusterIdYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockInClusterIdYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockInClusterIdYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockInClusterIdYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockInClusterIdYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockInClusterIdZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockInClusterIdZOpGenericAdaptorBase::BlockInClusterIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.cluster.ctaid.z", odsAttrs.getContext()); +} + +BlockInClusterIdZOpGenericAdaptorBase::BlockInClusterIdZOpGenericAdaptorBase(BlockInClusterIdZOp op) : BlockInClusterIdZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockInClusterIdZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockInClusterIdZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockInClusterIdZOpAdaptor::BlockInClusterIdZOpAdaptor(BlockInClusterIdZOp op) : BlockInClusterIdZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockInClusterIdZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockInClusterIdZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockInClusterIdZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockInClusterIdZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockInClusterIdZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockInClusterIdZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockInClusterIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockInClusterIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockInClusterIdZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockInClusterIdZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockInClusterIdZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockInClusterIdZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockInClusterIdZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockInClusterIdZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockInClusterIdZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterArriveOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterArriveOpGenericAdaptorBase::ClusterArriveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.cluster.arrive", odsAttrs.getContext()); +} + +ClusterArriveOpGenericAdaptorBase::ClusterArriveOpGenericAdaptorBase(ClusterArriveOp op) : ClusterArriveOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterArriveOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterArriveOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterArriveOpAdaptor::ClusterArriveOpAdaptor(ClusterArriveOp op) : ClusterArriveOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterArriveOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterArriveOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterArriveOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterArriveOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterArriveOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ClusterArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void ClusterArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterArriveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterArriveOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterArriveOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterArriveOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ClusterArriveOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterArriveOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterArriveRelaxedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterArriveRelaxedOpGenericAdaptorBase::ClusterArriveRelaxedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.cluster.arrive.relaxed", odsAttrs.getContext()); +} + +ClusterArriveRelaxedOpGenericAdaptorBase::ClusterArriveRelaxedOpGenericAdaptorBase(ClusterArriveRelaxedOp op) : ClusterArriveRelaxedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterArriveRelaxedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterArriveRelaxedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterArriveRelaxedOpAdaptor::ClusterArriveRelaxedOpAdaptor(ClusterArriveRelaxedOp op) : ClusterArriveRelaxedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterArriveRelaxedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterArriveRelaxedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterArriveRelaxedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterArriveRelaxedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterArriveRelaxedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ClusterArriveRelaxedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void ClusterArriveRelaxedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterArriveRelaxedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterArriveRelaxedOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterArriveRelaxedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterArriveRelaxedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ClusterArriveRelaxedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterArriveRelaxedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterDim definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterDimGenericAdaptorBase::ClusterDimGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.cluster.nctarank", odsAttrs.getContext()); +} + +ClusterDimGenericAdaptorBase::ClusterDimGenericAdaptorBase(ClusterDim op) : ClusterDimGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterDimGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterDimGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterDimAdaptor::ClusterDimAdaptor(ClusterDim op) : ClusterDimGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterDimAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterDim::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterDim::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterDim::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterDim::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ClusterDim::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ClusterDim::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ClusterDim::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterDim::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterDim::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterDim::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterDim::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ClusterDim::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ClusterDim::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterDim) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterDimXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterDimXOpGenericAdaptorBase::ClusterDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.nclusterid.x", odsAttrs.getContext()); +} + +ClusterDimXOpGenericAdaptorBase::ClusterDimXOpGenericAdaptorBase(ClusterDimXOp op) : ClusterDimXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterDimXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterDimXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterDimXOpAdaptor::ClusterDimXOpAdaptor(ClusterDimXOp op) : ClusterDimXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterDimXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterDimXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterDimXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterDimXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterDimXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ClusterDimXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ClusterDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ClusterDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterDimXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterDimXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterDimXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterDimXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ClusterDimXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ClusterDimXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterDimXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterDimYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterDimYOpGenericAdaptorBase::ClusterDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.nclusterid.y", odsAttrs.getContext()); +} + +ClusterDimYOpGenericAdaptorBase::ClusterDimYOpGenericAdaptorBase(ClusterDimYOp op) : ClusterDimYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterDimYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterDimYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterDimYOpAdaptor::ClusterDimYOpAdaptor(ClusterDimYOp op) : ClusterDimYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterDimYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterDimYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterDimYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterDimYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterDimYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ClusterDimYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ClusterDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ClusterDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterDimYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterDimYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterDimYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterDimYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ClusterDimYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ClusterDimYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterDimYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterDimZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterDimZOpGenericAdaptorBase::ClusterDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.nclusterid.z", odsAttrs.getContext()); +} + +ClusterDimZOpGenericAdaptorBase::ClusterDimZOpGenericAdaptorBase(ClusterDimZOp op) : ClusterDimZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterDimZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterDimZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterDimZOpAdaptor::ClusterDimZOpAdaptor(ClusterDimZOp op) : ClusterDimZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterDimZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterDimZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterDimZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterDimZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterDimZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ClusterDimZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ClusterDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ClusterDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterDimZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterDimZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterDimZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterDimZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ClusterDimZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ClusterDimZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterDimZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterId definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterIdGenericAdaptorBase::ClusterIdGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.cluster.ctarank", odsAttrs.getContext()); +} + +ClusterIdGenericAdaptorBase::ClusterIdGenericAdaptorBase(ClusterId op) : ClusterIdGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterIdGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterIdGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterIdAdaptor::ClusterIdAdaptor(ClusterId op) : ClusterIdGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterIdAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterId::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterId::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterId::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterId::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ClusterId::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ClusterId::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ClusterId::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterId::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterId::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterId::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterId::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ClusterId::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ClusterId::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterId) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterIdXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterIdXOpGenericAdaptorBase::ClusterIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.clusterid.x", odsAttrs.getContext()); +} + +ClusterIdXOpGenericAdaptorBase::ClusterIdXOpGenericAdaptorBase(ClusterIdXOp op) : ClusterIdXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterIdXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterIdXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterIdXOpAdaptor::ClusterIdXOpAdaptor(ClusterIdXOp op) : ClusterIdXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterIdXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterIdXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterIdXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterIdXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterIdXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ClusterIdXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ClusterIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ClusterIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterIdXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterIdXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterIdXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterIdXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ClusterIdXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ClusterIdXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterIdXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterIdYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterIdYOpGenericAdaptorBase::ClusterIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.clusterid.y", odsAttrs.getContext()); +} + +ClusterIdYOpGenericAdaptorBase::ClusterIdYOpGenericAdaptorBase(ClusterIdYOp op) : ClusterIdYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterIdYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterIdYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterIdYOpAdaptor::ClusterIdYOpAdaptor(ClusterIdYOp op) : ClusterIdYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterIdYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterIdYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterIdYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterIdYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterIdYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ClusterIdYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ClusterIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ClusterIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterIdYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterIdYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterIdYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterIdYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ClusterIdYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ClusterIdYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterIdYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterIdZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterIdZOpGenericAdaptorBase::ClusterIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.clusterid.z", odsAttrs.getContext()); +} + +ClusterIdZOpGenericAdaptorBase::ClusterIdZOpGenericAdaptorBase(ClusterIdZOp op) : ClusterIdZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterIdZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterIdZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterIdZOpAdaptor::ClusterIdZOpAdaptor(ClusterIdZOp op) : ClusterIdZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterIdZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterIdZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterIdZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterIdZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterIdZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ClusterIdZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ClusterIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ClusterIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterIdZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterIdZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterIdZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterIdZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ClusterIdZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ClusterIdZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterIdZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterWaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ClusterWaitOpGenericAdaptorBase::ClusterWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.cluster.wait", odsAttrs.getContext()); +} + +ClusterWaitOpGenericAdaptorBase::ClusterWaitOpGenericAdaptorBase(ClusterWaitOp op) : ClusterWaitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ClusterWaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ClusterWaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ClusterWaitOpAdaptor::ClusterWaitOpAdaptor(ClusterWaitOp op) : ClusterWaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ClusterWaitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ClusterWaitOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ClusterWaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ClusterWaitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ClusterWaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ClusterWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void ClusterWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ClusterWaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ClusterWaitOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult ClusterWaitOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ClusterWaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ClusterWaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterWaitOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncBulkTensorGlobalToSharedClusterOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase::CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.cp.async.bulk.tensor.shared.cluster.global", odsAttrs.getContext()); +} + +CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase::CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase(CpAsyncBulkTensorGlobalToSharedClusterOp op) : CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CpAsyncBulkTensorGlobalToSharedClusterOpAdaptor::CpAsyncBulkTensorGlobalToSharedClusterOpAdaptor(CpAsyncBulkTensorGlobalToSharedClusterOp op) : CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CpAsyncBulkTensorGlobalToSharedClusterOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CpAsyncBulkTensorGlobalToSharedClusterOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 3) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CpAsyncBulkTensorGlobalToSharedClusterOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CpAsyncBulkTensorGlobalToSharedClusterOp::getDstMem() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CpAsyncBulkTensorGlobalToSharedClusterOp::getTmaDescriptor() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value CpAsyncBulkTensorGlobalToSharedClusterOp::getMbar() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Operation::operand_range CpAsyncBulkTensorGlobalToSharedClusterOp::getCoordinates() { + return getODSOperands(3); +} + +::mlir::OpOperand &CpAsyncBulkTensorGlobalToSharedClusterOp::getDstMemMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CpAsyncBulkTensorGlobalToSharedClusterOp::getTmaDescriptorMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CpAsyncBulkTensorGlobalToSharedClusterOp::getMbarMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CpAsyncBulkTensorGlobalToSharedClusterOp::getCoordinatesMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CpAsyncBulkTensorGlobalToSharedClusterOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CpAsyncBulkTensorGlobalToSharedClusterOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void CpAsyncBulkTensorGlobalToSharedClusterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dstMem, ::mlir::Value tmaDescriptor, ::mlir::Value mbar, ::mlir::ValueRange coordinates) { + odsState.addOperands(dstMem); + odsState.addOperands(tmaDescriptor); + odsState.addOperands(mbar); + odsState.addOperands(coordinates); +} + +void CpAsyncBulkTensorGlobalToSharedClusterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dstMem, ::mlir::Value tmaDescriptor, ::mlir::Value mbar, ::mlir::ValueRange coordinates) { + odsState.addOperands(dstMem); + odsState.addOperands(tmaDescriptor); + odsState.addOperands(mbar); + odsState.addOperands(coordinates); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CpAsyncBulkTensorGlobalToSharedClusterOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CpAsyncBulkTensorGlobalToSharedClusterOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CpAsyncBulkTensorGlobalToSharedClusterOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CpAsyncBulkTensorGlobalToSharedClusterOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand dstMemRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstMemOperands(dstMemRawOperands); ::llvm::SMLoc dstMemOperandsLoc; + (void)dstMemOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand tmaDescriptorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tmaDescriptorOperands(tmaDescriptorRawOperands); ::llvm::SMLoc tmaDescriptorOperandsLoc; + (void)tmaDescriptorOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mbarRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mbarOperands(mbarRawOperands); ::llvm::SMLoc mbarOperandsLoc; + (void)mbarOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> coordinatesOperands; + ::llvm::SMLoc coordinatesOperandsLoc; + (void)coordinatesOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + dstMemOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstMemRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + tmaDescriptorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tmaDescriptorRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + mbarOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mbarRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseKeyword("box")) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + coordinatesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(coordinatesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(dstMemOperands, tmaDescriptorOperands, mbarOperands, coordinatesOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CpAsyncBulkTensorGlobalToSharedClusterOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getDstMem(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTmaDescriptor(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMbar(); + _odsPrinter << ","; + _odsPrinter << ' ' << "box"; + _odsPrinter << "["; + _odsPrinter << getCoordinates(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +std::string CpAsyncBulkTensorGlobalToSharedClusterOp::getPtx() { + int dim = getCoordinates().size(); + std::string ptx = "cp.async.bulk.tensor."; + ptx += std::to_string(dim) + "d."; + ptx += "shared::cluster.global.mbarrier::complete_tx::bytes"; + if(dim == 1) ptx += " [%0], [%1, {%3} ], [%2];"; + if(dim == 2) ptx += " [%0], [%1, {%3, %4} ], [%2];"; + if(dim == 3) ptx += " [%0], [%1, {%3, %4, %5} ], [%2];"; + if(dim == 4) ptx += " [%0], [%1, {%3, %4, %5, %6} ], [%2];"; + if(dim == 5) ptx += " [%0], [%1, {%3, %4, %5, %6, %7} ], [%2];"; + return ptx; +} +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncBulkTensorGlobalToSharedClusterOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncBulkTensorSharedCTAToGlobalOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase::CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.cp.async.bulk.tensor.global.shared.cta", odsAttrs.getContext()); +} + +CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase::CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase(CpAsyncBulkTensorSharedCTAToGlobalOp op) : CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CpAsyncBulkTensorSharedCTAToGlobalOpAdaptor::CpAsyncBulkTensorSharedCTAToGlobalOpAdaptor(CpAsyncBulkTensorSharedCTAToGlobalOp op) : CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CpAsyncBulkTensorSharedCTAToGlobalOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CpAsyncBulkTensorSharedCTAToGlobalOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CpAsyncBulkTensorSharedCTAToGlobalOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CpAsyncBulkTensorSharedCTAToGlobalOp::getTmaDescriptor() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CpAsyncBulkTensorSharedCTAToGlobalOp::getSrcMem() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range CpAsyncBulkTensorSharedCTAToGlobalOp::getCoordinates() { + return getODSOperands(2); +} + +::mlir::OpOperand &CpAsyncBulkTensorSharedCTAToGlobalOp::getTmaDescriptorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CpAsyncBulkTensorSharedCTAToGlobalOp::getSrcMemMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CpAsyncBulkTensorSharedCTAToGlobalOp::getCoordinatesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CpAsyncBulkTensorSharedCTAToGlobalOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CpAsyncBulkTensorSharedCTAToGlobalOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void CpAsyncBulkTensorSharedCTAToGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tmaDescriptor, ::mlir::Value srcMem, ::mlir::ValueRange coordinates) { + odsState.addOperands(tmaDescriptor); + odsState.addOperands(srcMem); + odsState.addOperands(coordinates); +} + +void CpAsyncBulkTensorSharedCTAToGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tmaDescriptor, ::mlir::Value srcMem, ::mlir::ValueRange coordinates) { + odsState.addOperands(tmaDescriptor); + odsState.addOperands(srcMem); + odsState.addOperands(coordinates); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CpAsyncBulkTensorSharedCTAToGlobalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CpAsyncBulkTensorSharedCTAToGlobalOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CpAsyncBulkTensorSharedCTAToGlobalOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CpAsyncBulkTensorSharedCTAToGlobalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tmaDescriptorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tmaDescriptorOperands(tmaDescriptorRawOperands); ::llvm::SMLoc tmaDescriptorOperandsLoc; + (void)tmaDescriptorOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand srcMemRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcMemOperands(srcMemRawOperands); ::llvm::SMLoc srcMemOperandsLoc; + (void)srcMemOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> coordinatesOperands; + ::llvm::SMLoc coordinatesOperandsLoc; + (void)coordinatesOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + tmaDescriptorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tmaDescriptorRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + srcMemOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcMemRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseKeyword("box")) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + coordinatesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(coordinatesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(tmaDescriptorOperands, srcMemOperands, coordinatesOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CpAsyncBulkTensorSharedCTAToGlobalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTmaDescriptor(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrcMem(); + _odsPrinter << ","; + _odsPrinter << ' ' << "box"; + _odsPrinter << "["; + _odsPrinter << getCoordinates(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +std::string CpAsyncBulkTensorSharedCTAToGlobalOp::getPtx() { + int dim = getCoordinates().size(); + std::string ptx = "cp.async.bulk.tensor."; + ptx += std::to_string(dim) + "d."; + ptx += "global.shared::cta.bulk_group"; + if(dim == 1) ptx += " [%0, {%2} ], [%1];"; + if(dim == 2) ptx += " [%0, {%2, %3} ], [%1];"; + if(dim == 3) ptx += " [%0, {%2, %3, %4} ], [%1];"; + if(dim == 4) ptx += " [%0, {%2, %3, %4, %5} ], [%1];"; + if(dim == 5) ptx += " [%0, {%2, %3, %4, %5, %6} ], [%1];"; + return ptx; +} +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncBulkTensorSharedCTAToGlobalOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncCommitGroupOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CpAsyncCommitGroupOpGenericAdaptorBase::CpAsyncCommitGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.cp.async.commit.group", odsAttrs.getContext()); +} + +CpAsyncCommitGroupOpGenericAdaptorBase::CpAsyncCommitGroupOpGenericAdaptorBase(CpAsyncCommitGroupOp op) : CpAsyncCommitGroupOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CpAsyncCommitGroupOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CpAsyncCommitGroupOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CpAsyncCommitGroupOpAdaptor::CpAsyncCommitGroupOpAdaptor(CpAsyncCommitGroupOp op) : CpAsyncCommitGroupOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CpAsyncCommitGroupOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CpAsyncCommitGroupOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CpAsyncCommitGroupOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CpAsyncCommitGroupOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CpAsyncCommitGroupOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void CpAsyncCommitGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void CpAsyncCommitGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CpAsyncCommitGroupOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CpAsyncCommitGroupOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult CpAsyncCommitGroupOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CpAsyncCommitGroupOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CpAsyncCommitGroupOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncCommitGroupOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CpAsyncOpGenericAdaptorBase::CpAsyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.cp.async.shared.global", odsAttrs.getContext()); +} + +CpAsyncOpGenericAdaptorBase::CpAsyncOpGenericAdaptorBase(CpAsyncOp op) : CpAsyncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CpAsyncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CpAsyncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr CpAsyncOpGenericAdaptorBase::getSizeAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().size); + return attr; +} + +uint32_t CpAsyncOpGenericAdaptorBase::getSize() { + auto attr = getSizeAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::LoadCacheModifierKindAttr CpAsyncOpGenericAdaptorBase::getModifierAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::LoadCacheModifierKindAttr>(getProperties().modifier); + return attr; +} + +::mlir::NVVM::LoadCacheModifierKind CpAsyncOpGenericAdaptorBase::getModifier() { + auto attr = getModifierAttr(); + return attr.getValue(); +} + +} // namespace detail +CpAsyncOpAdaptor::CpAsyncOpAdaptor(CpAsyncOp op) : CpAsyncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CpAsyncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_modifier = getProperties().modifier; (void)tblgen_modifier; + if (!tblgen_modifier) return emitError(loc, "'nvvm.cp.async.shared.global' op ""requires attribute 'modifier'"); + auto tblgen_size = getProperties().size; (void)tblgen_size; + if (!tblgen_size) return emitError(loc, "'nvvm.cp.async.shared.global' op ""requires attribute 'size'"); + + if (tblgen_size && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_size))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_size).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.cp.async.shared.global' op ""attribute 'size' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_modifier && !((::llvm::isa<::mlir::NVVM::LoadCacheModifierKindAttr>(tblgen_modifier)))) + return emitError(loc, "'nvvm.cp.async.shared.global' op ""attribute 'modifier' failed to satisfy constraint: NVVM load cache modifier kind"); + return ::mlir::success(); +} + +std::pair CpAsyncOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CpAsyncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CpAsyncOp::getDst() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CpAsyncOp::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value CpAsyncOp::getCpSize() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::OpOperand &CpAsyncOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CpAsyncOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CpAsyncOp::getCpSizeMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CpAsyncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CpAsyncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult CpAsyncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.modifier; + auto attr = dict.get("modifier"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for modifier in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `modifier` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.size; + auto attr = dict.get("size"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for size in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `size` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CpAsyncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.modifier; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("modifier", + propStorage)); + } + + { + const auto &propStorage = prop.size; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("size", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CpAsyncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.modifier.getAsOpaquePointer()), + llvm::hash_value(prop.size.getAsOpaquePointer())); +} + +std::optional CpAsyncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "modifier") + return prop.modifier; + + if (name == "size") + return prop.size; + return std::nullopt; +} + +void CpAsyncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "modifier") { + prop.modifier = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "size") { + prop.size = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CpAsyncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.modifier) attrs.append("modifier", prop.modifier); + + if (prop.size) attrs.append("size", prop.size); +} + +::mlir::LogicalResult CpAsyncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getModifierAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps1(attr, "modifier", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSizeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "size", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CpAsyncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.modifier))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.size))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CpAsyncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.modifier); + writer.writeAttribute(prop.size); +} + +::mlir::IntegerAttr CpAsyncOp::getSizeAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().size); +} + +uint32_t CpAsyncOp::getSize() { + auto attr = getSizeAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::LoadCacheModifierKindAttr CpAsyncOp::getModifierAttr() { + return ::llvm::cast<::mlir::NVVM::LoadCacheModifierKindAttr>(getProperties().modifier); +} + +::mlir::NVVM::LoadCacheModifierKind CpAsyncOp::getModifier() { + auto attr = getModifierAttr(); + return attr.getValue(); +} + +void CpAsyncOp::setSizeAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getSizeAttrName(), attr); +} + +void CpAsyncOp::setSize(uint32_t attrValue) { + (*this)->setAttr(getSizeAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void CpAsyncOp::setModifierAttr(::mlir::NVVM::LoadCacheModifierKindAttr attr) { + (*this)->setAttr(getModifierAttrName(), attr); +} + +void CpAsyncOp::setModifier(::mlir::NVVM::LoadCacheModifierKind attrValue) { + (*this)->setAttr(getModifierAttrName(), ::mlir::NVVM::LoadCacheModifierKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CpAsyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr size, ::mlir::NVVM::LoadCacheModifierKindAttr modifier, /*optional*/::mlir::Value cpSize) { + odsState.addOperands(dst); + odsState.addOperands(src); + if (cpSize) + odsState.addOperands(cpSize); + odsState.getOrAddProperties().size = size; + odsState.getOrAddProperties().modifier = modifier; +} + +void CpAsyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr size, ::mlir::NVVM::LoadCacheModifierKindAttr modifier, /*optional*/::mlir::Value cpSize) { + odsState.addOperands(dst); + odsState.addOperands(src); + if (cpSize) + odsState.addOperands(cpSize); + odsState.getOrAddProperties().size = size; + odsState.getOrAddProperties().modifier = modifier; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CpAsyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, uint32_t size, ::mlir::NVVM::LoadCacheModifierKind modifier, /*optional*/::mlir::Value cpSize) { + odsState.addOperands(dst); + odsState.addOperands(src); + if (cpSize) + odsState.addOperands(cpSize); + odsState.getOrAddProperties().size = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), size); + odsState.getOrAddProperties().modifier = ::mlir::NVVM::LoadCacheModifierKindAttr::get(odsBuilder.getContext(), modifier); +} + +void CpAsyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, uint32_t size, ::mlir::NVVM::LoadCacheModifierKind modifier, /*optional*/::mlir::Value cpSize) { + odsState.addOperands(dst); + odsState.addOperands(src); + if (cpSize) + odsState.addOperands(cpSize); + odsState.getOrAddProperties().size = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), size); + odsState.getOrAddProperties().modifier = ::mlir::NVVM::LoadCacheModifierKindAttr::get(odsBuilder.getContext(), modifier); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CpAsyncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CpAsyncOp::verifyInvariantsImpl() { + auto tblgen_modifier = getProperties().modifier; (void)tblgen_modifier; + if (!tblgen_modifier) return emitOpError("requires attribute 'modifier'"); + auto tblgen_size = getProperties().size; (void)tblgen_size; + if (!tblgen_size) return emitOpError("requires attribute 'size'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_size, "size"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps1(*this, tblgen_modifier, "modifier"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CpAsyncOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CpAsyncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand dstRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstOperands(dstRawOperands); ::llvm::SMLoc dstOperandsLoc; + (void)dstOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand srcRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(srcRawOperands); ::llvm::SMLoc srcOperandsLoc; + (void)srcOperandsLoc; + ::mlir::IntegerAttr sizeAttr; + ::mlir::NVVM::LoadCacheModifierKindAttr modifierAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cpSizeOperands; + ::llvm::SMLoc cpSizeOperandsLoc; + (void)cpSizeOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + dstOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + srcOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(sizeAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (sizeAttr) result.getOrAddProperties().size = sizeAttr; + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseKeyword("cache")) + return ::mlir::failure(); + if (parser.parseEqual()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(modifierAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (modifierAttr) result.getOrAddProperties().modifier = modifierAttr; + if (::mlir::succeeded(parser.parseOptionalComma())) { + + { + cpSizeOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + cpSizeOperands.push_back(operand); + } + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(dstOperands, srcOperands, cpSizeOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CpAsyncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getDst(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getSizeAttr()); + _odsPrinter << ","; + _odsPrinter << ' ' << "cache"; + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getModifierAttr()); + if (getCpSize()) { + _odsPrinter << ","; + _odsPrinter << ' '; + if (::mlir::Value value = getCpSize()) + _odsPrinter << value; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("size"); + elidedAttrs.push_back("modifier"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +std::string CpAsyncOp::getPtx() { + if(getModifier() == NVVM::LoadCacheModifierKind::CG) + return std::string("cp.async.cg.shared.global [%0], [%1], %2, %3;\n"); + if(getModifier() == NVVM::LoadCacheModifierKind::CA) + return std::string("cp.async.ca.shared.global [%0], [%1], %2, %3;\n"); + llvm_unreachable("unsupported cache modifier"); +} +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncWaitGroupOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CpAsyncWaitGroupOpGenericAdaptorBase::CpAsyncWaitGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.cp.async.wait.group", odsAttrs.getContext()); +} + +CpAsyncWaitGroupOpGenericAdaptorBase::CpAsyncWaitGroupOpGenericAdaptorBase(CpAsyncWaitGroupOp op) : CpAsyncWaitGroupOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CpAsyncWaitGroupOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CpAsyncWaitGroupOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr CpAsyncWaitGroupOpGenericAdaptorBase::getNAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); + return attr; +} + +uint32_t CpAsyncWaitGroupOpGenericAdaptorBase::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +CpAsyncWaitGroupOpAdaptor::CpAsyncWaitGroupOpAdaptor(CpAsyncWaitGroupOp op) : CpAsyncWaitGroupOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CpAsyncWaitGroupOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitError(loc, "'nvvm.cp.async.wait.group' op ""requires attribute 'n'"); + + if (tblgen_n && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.cp.async.wait.group' op ""attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair CpAsyncWaitGroupOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CpAsyncWaitGroupOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CpAsyncWaitGroupOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CpAsyncWaitGroupOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult CpAsyncWaitGroupOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.n; + auto attr = dict.get("n"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for n in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `n` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CpAsyncWaitGroupOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.n; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("n", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CpAsyncWaitGroupOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.n.getAsOpaquePointer())); +} + +std::optional CpAsyncWaitGroupOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "n") + return prop.n; + return std::nullopt; +} + +void CpAsyncWaitGroupOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "n") { + prop.n = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CpAsyncWaitGroupOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.n) attrs.append("n", prop.n); +} + +::mlir::LogicalResult CpAsyncWaitGroupOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "n", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CpAsyncWaitGroupOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.n))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CpAsyncWaitGroupOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.n); +} + +::mlir::IntegerAttr CpAsyncWaitGroupOp::getNAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); +} + +uint32_t CpAsyncWaitGroupOp::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +void CpAsyncWaitGroupOp::setNAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getNAttrName(), attr); +} + +void CpAsyncWaitGroupOp::setN(uint32_t attrValue) { + (*this)->setAttr(getNAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void CpAsyncWaitGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr n) { + odsState.getOrAddProperties().n = n; +} + +void CpAsyncWaitGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr n) { + odsState.getOrAddProperties().n = n; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CpAsyncWaitGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t n) { + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); +} + +void CpAsyncWaitGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t n) { + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CpAsyncWaitGroupOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CpAsyncWaitGroupOp::verifyInvariantsImpl() { + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitOpError("requires attribute 'n'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_n, "n"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult CpAsyncWaitGroupOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CpAsyncWaitGroupOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr nAttr; + + if (parser.parseCustomAttributeWithFallback(nAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (nAttr) result.getOrAddProperties().n = nAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CpAsyncWaitGroupOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("n"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncWaitGroupOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ElectSyncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ElectSyncOpGenericAdaptorBase::ElectSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.elect.sync", odsAttrs.getContext()); +} + +ElectSyncOpGenericAdaptorBase::ElectSyncOpGenericAdaptorBase(ElectSyncOp op) : ElectSyncOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ElectSyncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ElectSyncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ElectSyncOpAdaptor::ElectSyncOpAdaptor(ElectSyncOp op) : ElectSyncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ElectSyncOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ElectSyncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ElectSyncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ElectSyncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ElectSyncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> ElectSyncOp::getPred() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +void ElectSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type pred) { + odsState.addTypes(pred); +} + +void ElectSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ElectSyncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ElectSyncOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ElectSyncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ElectSyncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseTypeList(allResultTypes)) + return ::mlir::failure(); + result.addTypes(allResultTypes); + return ::mlir::success(); +} + +void ElectSyncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getResultTypes(); +} + +std::string ElectSyncOp::getPtx() { + return std::string( + "{ \n" + ".reg .u32 rx; \n" + ".reg .pred px; \n" + " mov.u32 %0, 0; \n" + " elect.sync rx | px, 0xFFFFFFFF;\n" + "@px mov.u32 %0, 1; \n" + "}\n" + ); +} +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ElectSyncOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::FenceScClusterOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FenceScClusterOpGenericAdaptorBase::FenceScClusterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.fence.sc.cluster", odsAttrs.getContext()); +} + +FenceScClusterOpGenericAdaptorBase::FenceScClusterOpGenericAdaptorBase(FenceScClusterOp op) : FenceScClusterOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FenceScClusterOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FenceScClusterOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FenceScClusterOpAdaptor::FenceScClusterOpAdaptor(FenceScClusterOp op) : FenceScClusterOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FenceScClusterOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FenceScClusterOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FenceScClusterOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair FenceScClusterOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FenceScClusterOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void FenceScClusterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void FenceScClusterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FenceScClusterOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FenceScClusterOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult FenceScClusterOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FenceScClusterOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void FenceScClusterOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::FenceScClusterOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridDimXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridDimXOpGenericAdaptorBase::GridDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.nctaid.x", odsAttrs.getContext()); +} + +GridDimXOpGenericAdaptorBase::GridDimXOpGenericAdaptorBase(GridDimXOp op) : GridDimXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridDimXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridDimXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GridDimXOpAdaptor::GridDimXOpAdaptor(GridDimXOp op) : GridDimXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridDimXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GridDimXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridDimXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridDimXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridDimXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GridDimXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GridDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void GridDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridDimXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GridDimXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridDimXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GridDimXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void GridDimXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GridDimXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridDimXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridDimYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridDimYOpGenericAdaptorBase::GridDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.nctaid.y", odsAttrs.getContext()); +} + +GridDimYOpGenericAdaptorBase::GridDimYOpGenericAdaptorBase(GridDimYOp op) : GridDimYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridDimYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridDimYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GridDimYOpAdaptor::GridDimYOpAdaptor(GridDimYOp op) : GridDimYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridDimYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GridDimYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridDimYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridDimYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridDimYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GridDimYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GridDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void GridDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridDimYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GridDimYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridDimYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GridDimYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void GridDimYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GridDimYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridDimYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridDimZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridDimZOpGenericAdaptorBase::GridDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.nctaid.z", odsAttrs.getContext()); +} + +GridDimZOpGenericAdaptorBase::GridDimZOpGenericAdaptorBase(GridDimZOp op) : GridDimZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridDimZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridDimZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GridDimZOpAdaptor::GridDimZOpAdaptor(GridDimZOp op) : GridDimZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridDimZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GridDimZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridDimZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridDimZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridDimZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GridDimZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GridDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void GridDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridDimZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GridDimZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridDimZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GridDimZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void GridDimZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GridDimZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridDimZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridInClusterDimXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridInClusterDimXOpGenericAdaptorBase::GridInClusterDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.cluster.nctaid.x", odsAttrs.getContext()); +} + +GridInClusterDimXOpGenericAdaptorBase::GridInClusterDimXOpGenericAdaptorBase(GridInClusterDimXOp op) : GridInClusterDimXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridInClusterDimXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridInClusterDimXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GridInClusterDimXOpAdaptor::GridInClusterDimXOpAdaptor(GridInClusterDimXOp op) : GridInClusterDimXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridInClusterDimXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GridInClusterDimXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridInClusterDimXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridInClusterDimXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridInClusterDimXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GridInClusterDimXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GridInClusterDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void GridInClusterDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridInClusterDimXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GridInClusterDimXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridInClusterDimXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GridInClusterDimXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void GridInClusterDimXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GridInClusterDimXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridInClusterDimXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridInClusterDimYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridInClusterDimYOpGenericAdaptorBase::GridInClusterDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.cluster.nctaid.y", odsAttrs.getContext()); +} + +GridInClusterDimYOpGenericAdaptorBase::GridInClusterDimYOpGenericAdaptorBase(GridInClusterDimYOp op) : GridInClusterDimYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridInClusterDimYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridInClusterDimYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GridInClusterDimYOpAdaptor::GridInClusterDimYOpAdaptor(GridInClusterDimYOp op) : GridInClusterDimYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridInClusterDimYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GridInClusterDimYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridInClusterDimYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridInClusterDimYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridInClusterDimYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GridInClusterDimYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GridInClusterDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void GridInClusterDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridInClusterDimYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GridInClusterDimYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridInClusterDimYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GridInClusterDimYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void GridInClusterDimYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GridInClusterDimYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridInClusterDimYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridInClusterDimZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridInClusterDimZOpGenericAdaptorBase::GridInClusterDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.cluster.nctaid.z", odsAttrs.getContext()); +} + +GridInClusterDimZOpGenericAdaptorBase::GridInClusterDimZOpGenericAdaptorBase(GridInClusterDimZOp op) : GridInClusterDimZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridInClusterDimZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridInClusterDimZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GridInClusterDimZOpAdaptor::GridInClusterDimZOpAdaptor(GridInClusterDimZOp op) : GridInClusterDimZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridInClusterDimZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GridInClusterDimZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridInClusterDimZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridInClusterDimZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridInClusterDimZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GridInClusterDimZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GridInClusterDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void GridInClusterDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridInClusterDimZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GridInClusterDimZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridInClusterDimZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GridInClusterDimZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void GridInClusterDimZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GridInClusterDimZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridInClusterDimZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::LaneIdOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LaneIdOpGenericAdaptorBase::LaneIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.laneid", odsAttrs.getContext()); +} + +LaneIdOpGenericAdaptorBase::LaneIdOpGenericAdaptorBase(LaneIdOp op) : LaneIdOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LaneIdOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LaneIdOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +LaneIdOpAdaptor::LaneIdOpAdaptor(LaneIdOp op) : LaneIdOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LaneIdOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LaneIdOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LaneIdOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair LaneIdOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LaneIdOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LaneIdOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void LaneIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void LaneIdOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LaneIdOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LaneIdOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LaneIdOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult LaneIdOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void LaneIdOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void LaneIdOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::LaneIdOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::LdMatrixOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LdMatrixOpGenericAdaptorBase::LdMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.ldmatrix", odsAttrs.getContext()); +} + +LdMatrixOpGenericAdaptorBase::LdMatrixOpGenericAdaptorBase(LdMatrixOp op) : LdMatrixOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LdMatrixOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LdMatrixOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr LdMatrixOpGenericAdaptorBase::getNumAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().num); + return attr; +} + +uint32_t LdMatrixOpGenericAdaptorBase::getNum() { + auto attr = getNumAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::MMALayoutAttr LdMatrixOpGenericAdaptorBase::getLayoutAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layout); + return attr; +} + +::mlir::NVVM::MMALayout LdMatrixOpGenericAdaptorBase::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +} // namespace detail +LdMatrixOpAdaptor::LdMatrixOpAdaptor(LdMatrixOp op) : LdMatrixOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LdMatrixOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + if (!tblgen_layout) return emitError(loc, "'nvvm.ldmatrix' op ""requires attribute 'layout'"); + auto tblgen_num = getProperties().num; (void)tblgen_num; + if (!tblgen_num) return emitError(loc, "'nvvm.ldmatrix' op ""requires attribute 'num'"); + + if (tblgen_num && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_num))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_num).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.ldmatrix' op ""attribute 'num' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_layout && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(tblgen_layout)))) + return emitError(loc, "'nvvm.ldmatrix' op ""attribute 'layout' failed to satisfy constraint: NVVM MMA layout"); + return ::mlir::success(); +} + +std::pair LdMatrixOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LdMatrixOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> LdMatrixOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LdMatrixOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LdMatrixOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LdMatrixOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LdMatrixOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult LdMatrixOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.layout; + auto attr = dict.get("layout"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for layout in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layout` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.num; + auto attr = dict.get("num"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for num in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `num` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LdMatrixOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.layout; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layout", + propStorage)); + } + + { + const auto &propStorage = prop.num; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("num", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LdMatrixOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.layout.getAsOpaquePointer()), + llvm::hash_value(prop.num.getAsOpaquePointer())); +} + +std::optional LdMatrixOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "layout") + return prop.layout; + + if (name == "num") + return prop.num; + return std::nullopt; +} + +void LdMatrixOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "layout") { + prop.layout = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "num") { + prop.num = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LdMatrixOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.layout) attrs.append("layout", prop.layout); + + if (prop.num) attrs.append("num", prop.num); +} + +::mlir::LogicalResult LdMatrixOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLayoutAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(attr, "layout", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNumAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "num", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LdMatrixOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.layout))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.num))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LdMatrixOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.layout); + writer.writeAttribute(prop.num); +} + +::mlir::IntegerAttr LdMatrixOp::getNumAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().num); +} + +uint32_t LdMatrixOp::getNum() { + auto attr = getNumAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::MMALayoutAttr LdMatrixOp::getLayoutAttr() { + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layout); +} + +::mlir::NVVM::MMALayout LdMatrixOp::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +void LdMatrixOp::setNumAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getNumAttrName(), attr); +} + +void LdMatrixOp::setNum(uint32_t attrValue) { + (*this)->setAttr(getNumAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void LdMatrixOp::setLayoutAttr(::mlir::NVVM::MMALayoutAttr attr) { + (*this)->setAttr(getLayoutAttrName(), attr); +} + +void LdMatrixOp::setLayout(::mlir::NVVM::MMALayout attrValue) { + (*this)->setAttr(getLayoutAttrName(), ::mlir::NVVM::MMALayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void LdMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::IntegerAttr num, ::mlir::NVVM::MMALayoutAttr layout) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().num = num; + odsState.getOrAddProperties().layout = layout; + odsState.addTypes(res); +} + +void LdMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::IntegerAttr num, ::mlir::NVVM::MMALayoutAttr layout) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().num = num; + odsState.getOrAddProperties().layout = layout; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LdMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, uint32_t num, ::mlir::NVVM::MMALayout layout) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().num = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), num); + odsState.getOrAddProperties().layout = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layout); + odsState.addTypes(res); +} + +void LdMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, uint32_t num, ::mlir::NVVM::MMALayout layout) { + odsState.addOperands(ptr); + odsState.getOrAddProperties().num = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), num); + odsState.getOrAddProperties().layout = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layout); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LdMatrixOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LdMatrixOp::verifyInvariantsImpl() { + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + if (!tblgen_layout) return emitOpError("requires attribute 'layout'"); + auto tblgen_num = getProperties().num; (void)tblgen_num; + if (!tblgen_num) return emitOpError("requires attribute 'num'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_num, "num"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(*this, tblgen_layout, "layout"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps8(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LdMatrixOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult LdMatrixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand ptrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(ptrRawOperands); ::llvm::SMLoc ptrOperandsLoc; + (void)ptrOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> ptrTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ptrRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType ptr__res_functionType; + if (parser.parseType(ptr__res_functionType)) + return ::mlir::failure(); + ptrTypes = ptr__res_functionType.getInputs(); + resTypes = ptr__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LdMatrixOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getPtr(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(::llvm::ArrayRef<::mlir::Type>(getPtr().getType()), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::LdMatrixOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveExpectTxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierArriveExpectTxOpGenericAdaptorBase::MBarrierArriveExpectTxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.arrive.expect_tx", odsAttrs.getContext()); +} + +MBarrierArriveExpectTxOpGenericAdaptorBase::MBarrierArriveExpectTxOpGenericAdaptorBase(MBarrierArriveExpectTxOp op) : MBarrierArriveExpectTxOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierArriveExpectTxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierArriveExpectTxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierArriveExpectTxOpAdaptor::MBarrierArriveExpectTxOpAdaptor(MBarrierArriveExpectTxOp op) : MBarrierArriveExpectTxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierArriveExpectTxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierArriveExpectTxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierArriveExpectTxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveExpectTxOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierArriveExpectTxOp::getTxcount() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MBarrierArriveExpectTxOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierArriveExpectTxOp::getTxcountMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierArriveExpectTxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierArriveExpectTxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierArriveExpectTxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value txcount) { + odsState.addOperands(addr); + odsState.addOperands(txcount); +} + +void MBarrierArriveExpectTxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value txcount) { + odsState.addOperands(addr); + odsState.addOperands(txcount); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierArriveExpectTxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierArriveExpectTxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierArriveExpectTxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierArriveExpectTxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand txcountRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> txcountOperands(txcountRawOperands); ::llvm::SMLoc txcountOperandsLoc; + (void)txcountOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + txcountOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(txcountRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(addrOperands, txcountOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierArriveExpectTxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTxcount(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +std::string MBarrierArriveExpectTxOp::getPtx() { return std::string("mbarrier.arrive.expect_tx.b64 _, [%0], %1;"); } +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveExpectTxOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveExpectTxSharedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierArriveExpectTxSharedOpGenericAdaptorBase::MBarrierArriveExpectTxSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.arrive.expect_tx.shared", odsAttrs.getContext()); +} + +MBarrierArriveExpectTxSharedOpGenericAdaptorBase::MBarrierArriveExpectTxSharedOpGenericAdaptorBase(MBarrierArriveExpectTxSharedOp op) : MBarrierArriveExpectTxSharedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierArriveExpectTxSharedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierArriveExpectTxSharedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierArriveExpectTxSharedOpAdaptor::MBarrierArriveExpectTxSharedOpAdaptor(MBarrierArriveExpectTxSharedOp op) : MBarrierArriveExpectTxSharedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierArriveExpectTxSharedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierArriveExpectTxSharedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierArriveExpectTxSharedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveExpectTxSharedOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierArriveExpectTxSharedOp::getTxcount() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MBarrierArriveExpectTxSharedOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierArriveExpectTxSharedOp::getTxcountMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierArriveExpectTxSharedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierArriveExpectTxSharedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierArriveExpectTxSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value txcount) { + odsState.addOperands(addr); + odsState.addOperands(txcount); +} + +void MBarrierArriveExpectTxSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value txcount) { + odsState.addOperands(addr); + odsState.addOperands(txcount); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierArriveExpectTxSharedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierArriveExpectTxSharedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierArriveExpectTxSharedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierArriveExpectTxSharedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand txcountRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> txcountOperands(txcountRawOperands); ::llvm::SMLoc txcountOperandsLoc; + (void)txcountOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + txcountOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(txcountRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(addrOperands, txcountOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierArriveExpectTxSharedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTxcount(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +std::string MBarrierArriveExpectTxSharedOp::getPtx() { return std::string("mbarrier.arrive.expect_tx.shared.b64 _, [%0], %1;"); } +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveExpectTxSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveNocompleteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierArriveNocompleteOpGenericAdaptorBase::MBarrierArriveNocompleteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.arrive.nocomplete", odsAttrs.getContext()); +} + +MBarrierArriveNocompleteOpGenericAdaptorBase::MBarrierArriveNocompleteOpGenericAdaptorBase(MBarrierArriveNocompleteOp op) : MBarrierArriveNocompleteOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierArriveNocompleteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierArriveNocompleteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierArriveNocompleteOpAdaptor::MBarrierArriveNocompleteOpAdaptor(MBarrierArriveNocompleteOp op) : MBarrierArriveNocompleteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierArriveNocompleteOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierArriveNocompleteOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierArriveNocompleteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveNocompleteOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierArriveNocompleteOp::getCount() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MBarrierArriveNocompleteOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierArriveNocompleteOp::getCountMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierArriveNocompleteOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierArriveNocompleteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveNocompleteOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MBarrierArriveNocompleteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, ::mlir::Value count) { + odsState.addOperands(addr); + odsState.addOperands(count); + odsState.addTypes(res); +} + +void MBarrierArriveNocompleteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value count) { + odsState.addOperands(addr); + odsState.addOperands(count); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierArriveNocompleteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierArriveNocompleteOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierArriveNocompleteOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierArriveNocompleteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand countRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> countOperands(countRawOperands); ::llvm::SMLoc countOperandsLoc; + (void)countOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + countOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(countRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(::llvm::concat(addrOperands, countOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierArriveNocompleteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCount(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveNocompleteOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveNocompleteSharedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierArriveNocompleteSharedOpGenericAdaptorBase::MBarrierArriveNocompleteSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.arrive.nocomplete.shared", odsAttrs.getContext()); +} + +MBarrierArriveNocompleteSharedOpGenericAdaptorBase::MBarrierArriveNocompleteSharedOpGenericAdaptorBase(MBarrierArriveNocompleteSharedOp op) : MBarrierArriveNocompleteSharedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierArriveNocompleteSharedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierArriveNocompleteSharedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierArriveNocompleteSharedOpAdaptor::MBarrierArriveNocompleteSharedOpAdaptor(MBarrierArriveNocompleteSharedOp op) : MBarrierArriveNocompleteSharedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierArriveNocompleteSharedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierArriveNocompleteSharedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierArriveNocompleteSharedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveNocompleteSharedOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierArriveNocompleteSharedOp::getCount() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MBarrierArriveNocompleteSharedOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierArriveNocompleteSharedOp::getCountMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierArriveNocompleteSharedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierArriveNocompleteSharedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveNocompleteSharedOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MBarrierArriveNocompleteSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, ::mlir::Value count) { + odsState.addOperands(addr); + odsState.addOperands(count); + odsState.addTypes(res); +} + +void MBarrierArriveNocompleteSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value count) { + odsState.addOperands(addr); + odsState.addOperands(count); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierArriveNocompleteSharedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierArriveNocompleteSharedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierArriveNocompleteSharedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierArriveNocompleteSharedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand countRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> countOperands(countRawOperands); ::llvm::SMLoc countOperandsLoc; + (void)countOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + countOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(countRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(::llvm::concat(addrOperands, countOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierArriveNocompleteSharedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCount(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveNocompleteSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierArriveOpGenericAdaptorBase::MBarrierArriveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.arrive", odsAttrs.getContext()); +} + +MBarrierArriveOpGenericAdaptorBase::MBarrierArriveOpGenericAdaptorBase(MBarrierArriveOp op) : MBarrierArriveOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierArriveOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierArriveOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierArriveOpAdaptor::MBarrierArriveOpAdaptor(MBarrierArriveOp op) : MBarrierArriveOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierArriveOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierArriveOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierArriveOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &MBarrierArriveOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierArriveOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierArriveOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr) { + odsState.addOperands(addr); + odsState.addTypes(res); +} + +void MBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr) { + odsState.addOperands(addr); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierArriveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierArriveOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierArriveOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierArriveOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::Type addrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> addrTypes(addrRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + addrRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(addrOperands, addrTypes, addrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierArriveOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getAddr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveSharedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierArriveSharedOpGenericAdaptorBase::MBarrierArriveSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.arrive.shared", odsAttrs.getContext()); +} + +MBarrierArriveSharedOpGenericAdaptorBase::MBarrierArriveSharedOpGenericAdaptorBase(MBarrierArriveSharedOp op) : MBarrierArriveSharedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierArriveSharedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierArriveSharedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierArriveSharedOpAdaptor::MBarrierArriveSharedOpAdaptor(MBarrierArriveSharedOp op) : MBarrierArriveSharedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierArriveSharedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierArriveSharedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierArriveSharedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveSharedOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &MBarrierArriveSharedOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierArriveSharedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierArriveSharedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierArriveSharedOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MBarrierArriveSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr) { + odsState.addOperands(addr); + odsState.addTypes(res); +} + +void MBarrierArriveSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr) { + odsState.addOperands(addr); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierArriveSharedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierArriveSharedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierArriveSharedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierArriveSharedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::Type addrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> addrTypes(addrRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + addrRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(addrOperands, addrTypes, addrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierArriveSharedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getAddr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierInitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierInitOpGenericAdaptorBase::MBarrierInitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.init", odsAttrs.getContext()); +} + +MBarrierInitOpGenericAdaptorBase::MBarrierInitOpGenericAdaptorBase(MBarrierInitOp op) : MBarrierInitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierInitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierInitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierInitOpAdaptor::MBarrierInitOpAdaptor(MBarrierInitOp op) : MBarrierInitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierInitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierInitOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierInitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierInitOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierInitOp::getCount() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MBarrierInitOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierInitOp::getCountMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierInitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierInitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierInitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value count) { + odsState.addOperands(addr); + odsState.addOperands(count); +} + +void MBarrierInitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value count) { + odsState.addOperands(addr); + odsState.addOperands(count); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierInitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierInitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierInitOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierInitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand countRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> countOperands(countRawOperands); ::llvm::SMLoc countOperandsLoc; + (void)countOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + countOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(countRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(addrOperands, countOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierInitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCount(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierInitOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierInitSharedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierInitSharedOpGenericAdaptorBase::MBarrierInitSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.init.shared", odsAttrs.getContext()); +} + +MBarrierInitSharedOpGenericAdaptorBase::MBarrierInitSharedOpGenericAdaptorBase(MBarrierInitSharedOp op) : MBarrierInitSharedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierInitSharedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierInitSharedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierInitSharedOpAdaptor::MBarrierInitSharedOpAdaptor(MBarrierInitSharedOp op) : MBarrierInitSharedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierInitSharedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierInitSharedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierInitSharedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierInitSharedOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierInitSharedOp::getCount() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MBarrierInitSharedOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierInitSharedOp::getCountMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierInitSharedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierInitSharedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierInitSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value count) { + odsState.addOperands(addr); + odsState.addOperands(count); +} + +void MBarrierInitSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value count) { + odsState.addOperands(addr); + odsState.addOperands(count); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierInitSharedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierInitSharedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierInitSharedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierInitSharedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand countRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> countOperands(countRawOperands); ::llvm::SMLoc countOperandsLoc; + (void)countOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + countOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(countRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(addrOperands, countOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierInitSharedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCount(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierInitSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierInvalOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierInvalOpGenericAdaptorBase::MBarrierInvalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.inval", odsAttrs.getContext()); +} + +MBarrierInvalOpGenericAdaptorBase::MBarrierInvalOpGenericAdaptorBase(MBarrierInvalOp op) : MBarrierInvalOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierInvalOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierInvalOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierInvalOpAdaptor::MBarrierInvalOpAdaptor(MBarrierInvalOp op) : MBarrierInvalOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierInvalOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierInvalOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierInvalOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierInvalOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &MBarrierInvalOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierInvalOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierInvalOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierInvalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr) { + odsState.addOperands(addr); +} + +void MBarrierInvalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr) { + odsState.addOperands(addr); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierInvalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierInvalOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierInvalOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierInvalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(addrOperands, allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierInvalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierInvalOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierInvalSharedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierInvalSharedOpGenericAdaptorBase::MBarrierInvalSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.inval.shared", odsAttrs.getContext()); +} + +MBarrierInvalSharedOpGenericAdaptorBase::MBarrierInvalSharedOpGenericAdaptorBase(MBarrierInvalSharedOp op) : MBarrierInvalSharedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierInvalSharedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierInvalSharedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierInvalSharedOpAdaptor::MBarrierInvalSharedOpAdaptor(MBarrierInvalSharedOp op) : MBarrierInvalSharedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierInvalSharedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierInvalSharedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierInvalSharedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierInvalSharedOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &MBarrierInvalSharedOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierInvalSharedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierInvalSharedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierInvalSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr) { + odsState.addOperands(addr); +} + +void MBarrierInvalSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr) { + odsState.addOperands(addr); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierInvalSharedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierInvalSharedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierInvalSharedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierInvalSharedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(addrOperands, allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierInvalSharedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierInvalSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierTestWaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierTestWaitOpGenericAdaptorBase::MBarrierTestWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.test.wait", odsAttrs.getContext()); +} + +MBarrierTestWaitOpGenericAdaptorBase::MBarrierTestWaitOpGenericAdaptorBase(MBarrierTestWaitOp op) : MBarrierTestWaitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierTestWaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierTestWaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierTestWaitOpAdaptor::MBarrierTestWaitOpAdaptor(MBarrierTestWaitOp op) : MBarrierTestWaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierTestWaitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierTestWaitOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierTestWaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierTestWaitOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MBarrierTestWaitOp::getState() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MBarrierTestWaitOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTestWaitOp::getStateMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierTestWaitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierTestWaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierTestWaitOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MBarrierTestWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, ::mlir::Value state) { + odsState.addOperands(addr); + odsState.addOperands(state); + odsState.addTypes(res); +} + +void MBarrierTestWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value state) { + odsState.addOperands(addr); + odsState.addOperands(state); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierTestWaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierTestWaitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierTestWaitOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierTestWaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand stateRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> stateOperands(stateRawOperands); ::llvm::SMLoc stateOperandsLoc; + (void)stateOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + stateOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(stateRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(::llvm::concat(addrOperands, stateOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierTestWaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getState(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierTestWaitOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierTestWaitSharedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierTestWaitSharedOpGenericAdaptorBase::MBarrierTestWaitSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.test.wait.shared", odsAttrs.getContext()); +} + +MBarrierTestWaitSharedOpGenericAdaptorBase::MBarrierTestWaitSharedOpGenericAdaptorBase(MBarrierTestWaitSharedOp op) : MBarrierTestWaitSharedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierTestWaitSharedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierTestWaitSharedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierTestWaitSharedOpAdaptor::MBarrierTestWaitSharedOpAdaptor(MBarrierTestWaitSharedOp op) : MBarrierTestWaitSharedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierTestWaitSharedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierTestWaitSharedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierTestWaitSharedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierTestWaitSharedOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MBarrierTestWaitSharedOp::getState() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MBarrierTestWaitSharedOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTestWaitSharedOp::getStateMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierTestWaitSharedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierTestWaitSharedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierTestWaitSharedOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MBarrierTestWaitSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, ::mlir::Value state) { + odsState.addOperands(addr); + odsState.addOperands(state); + odsState.addTypes(res); +} + +void MBarrierTestWaitSharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value state) { + odsState.addOperands(addr); + odsState.addOperands(state); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierTestWaitSharedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierTestWaitSharedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierTestWaitSharedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierTestWaitSharedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand stateRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> stateOperands(stateRawOperands); ::llvm::SMLoc stateOperandsLoc; + (void)stateOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + stateOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(stateRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(::llvm::concat(addrOperands, stateOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierTestWaitSharedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getState(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierTestWaitSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierTryWaitParityOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierTryWaitParityOpGenericAdaptorBase::MBarrierTryWaitParityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.try_wait.parity", odsAttrs.getContext()); +} + +MBarrierTryWaitParityOpGenericAdaptorBase::MBarrierTryWaitParityOpGenericAdaptorBase(MBarrierTryWaitParityOp op) : MBarrierTryWaitParityOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierTryWaitParityOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierTryWaitParityOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierTryWaitParityOpAdaptor::MBarrierTryWaitParityOpAdaptor(MBarrierTryWaitParityOp op) : MBarrierTryWaitParityOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierTryWaitParityOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierTryWaitParityOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierTryWaitParityOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierTryWaitParityOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierTryWaitParityOp::getPhase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierTryWaitParityOp::getTicks() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MBarrierTryWaitParityOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTryWaitParityOp::getPhaseMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTryWaitParityOp::getTicksMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierTryWaitParityOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierTryWaitParityOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierTryWaitParityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value phase, ::mlir::Value ticks) { + odsState.addOperands(addr); + odsState.addOperands(phase); + odsState.addOperands(ticks); +} + +void MBarrierTryWaitParityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value phase, ::mlir::Value ticks) { + odsState.addOperands(addr); + odsState.addOperands(phase); + odsState.addOperands(ticks); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierTryWaitParityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierTryWaitParityOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierTryWaitParityOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierTryWaitParityOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand phaseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> phaseOperands(phaseRawOperands); ::llvm::SMLoc phaseOperandsLoc; + (void)phaseOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand ticksRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ticksOperands(ticksRawOperands); ::llvm::SMLoc ticksOperandsLoc; + (void)ticksOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + phaseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(phaseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + ticksOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ticksRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(addrOperands, phaseOperands, ticksOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierTryWaitParityOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getPhase(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTicks(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +std::string MBarrierTryWaitParityOp::getPtx() { + return std::string( + "{\n\t" + ".reg .pred P1; \n\t" + "LAB_WAIT: \n\t" + "mbarrier.try_wait.parity.b64 P1, [%0], %1, %2; \n\t" + "@P1 bra.uni DONE; \n\t" + "bra.uni LAB_WAIT; \n\t" + "DONE: \n\t" + "}" + ); +} +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierTryWaitParityOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierTryWaitParitySharedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierTryWaitParitySharedOpGenericAdaptorBase::MBarrierTryWaitParitySharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mbarrier.try_wait.parity.shared", odsAttrs.getContext()); +} + +MBarrierTryWaitParitySharedOpGenericAdaptorBase::MBarrierTryWaitParitySharedOpGenericAdaptorBase(MBarrierTryWaitParitySharedOp op) : MBarrierTryWaitParitySharedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierTryWaitParitySharedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierTryWaitParitySharedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierTryWaitParitySharedOpAdaptor::MBarrierTryWaitParitySharedOpAdaptor(MBarrierTryWaitParitySharedOp op) : MBarrierTryWaitParitySharedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierTryWaitParitySharedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierTryWaitParitySharedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierTryWaitParitySharedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MBarrierTryWaitParitySharedOp::getAddr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierTryWaitParitySharedOp::getPhase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierTryWaitParitySharedOp::getTicks() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MBarrierTryWaitParitySharedOp::getAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTryWaitParitySharedOp::getPhaseMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTryWaitParitySharedOp::getTicksMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierTryWaitParitySharedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierTryWaitParitySharedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierTryWaitParitySharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value phase, ::mlir::Value ticks) { + odsState.addOperands(addr); + odsState.addOperands(phase); + odsState.addOperands(ticks); +} + +void MBarrierTryWaitParitySharedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value phase, ::mlir::Value ticks) { + odsState.addOperands(addr); + odsState.addOperands(phase); + odsState.addOperands(ticks); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierTryWaitParitySharedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierTryWaitParitySharedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierTryWaitParitySharedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierTryWaitParitySharedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(addrRawOperands); ::llvm::SMLoc addrOperandsLoc; + (void)addrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand phaseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> phaseOperands(phaseRawOperands); ::llvm::SMLoc phaseOperandsLoc; + (void)phaseOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand ticksRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ticksOperands(ticksRawOperands); ::llvm::SMLoc ticksOperandsLoc; + (void)ticksOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allOperandTypes; + + addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + phaseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(phaseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + ticksOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ticksRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(allOperandTypes)) + return ::mlir::failure(); + if (parser.resolveOperands(::llvm::concat(addrOperands, phaseOperands, ticksOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierTryWaitParitySharedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAddr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getPhase(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTicks(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperandTypes(); +} + +std::string MBarrierTryWaitParitySharedOp::getPtx() { + return std::string( + "{\n\t" + ".reg .pred P1; \n\t" + "LAB_WAIT: \n\t" + "mbarrier.try_wait.parity.shared.b64 P1, [%0], %1, %2; \n\t" + "@P1 bra.uni DONE; \n\t" + "bra.uni LAB_WAIT; \n\t" + "DONE: \n\t" + "}" + ); +} +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierTryWaitParitySharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MmaOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MmaOpGenericAdaptorBase::MmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.mma.sync", odsAttrs.getContext()); +} + +MmaOpGenericAdaptorBase::MmaOpGenericAdaptorBase(MmaOp op) : MmaOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MmaOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr MmaOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::NVVM::MMAShapeAttr MmaOpGenericAdaptorBase::getShapeAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(getProperties().shape); + return attr; +} + +::mlir::NVVM::MMAShapeAttr MmaOpGenericAdaptorBase::getShape() { + auto attr = getShapeAttr(); + return ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(attr); +} + +::mlir::NVVM::MMAB1OpAttr MmaOpGenericAdaptorBase::getB1OpAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::NVVM::MMAB1OpAttr>(getProperties().b1Op); + return attr; +} + +::std::optional<::mlir::NVVM::MMAB1Op> MmaOpGenericAdaptorBase::getB1Op() { + auto attr = getB1OpAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMAB1Op>(attr.getValue()) : (::std::nullopt); +} + +::mlir::NVVM::MMAIntOverflowAttr MmaOpGenericAdaptorBase::getIntOverflowBehaviorAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::NVVM::MMAIntOverflowAttr>(getProperties().intOverflowBehavior); + return attr; +} + +::std::optional<::mlir::NVVM::MMAIntOverflow> MmaOpGenericAdaptorBase::getIntOverflowBehavior() { + auto attr = getIntOverflowBehaviorAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMAIntOverflow>(attr.getValue()) : (::std::nullopt); +} + +::mlir::NVVM::MMALayoutAttr MmaOpGenericAdaptorBase::getLayoutAAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutA); + return attr; +} + +::mlir::NVVM::MMALayout MmaOpGenericAdaptorBase::getLayoutA() { + auto attr = getLayoutAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMALayoutAttr MmaOpGenericAdaptorBase::getLayoutBAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutB); + return attr; +} + +::mlir::NVVM::MMALayout MmaOpGenericAdaptorBase::getLayoutB() { + auto attr = getLayoutBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr MmaOpGenericAdaptorBase::getMultiplicandAPtxTypeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::NVVM::MMATypesAttr>(getProperties().multiplicandAPtxType); + return attr; +} + +::std::optional<::mlir::NVVM::MMATypes> MmaOpGenericAdaptorBase::getMultiplicandAPtxType() { + auto attr = getMultiplicandAPtxTypeAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMATypes>(attr.getValue()) : (::std::nullopt); +} + +::mlir::NVVM::MMATypesAttr MmaOpGenericAdaptorBase::getMultiplicandBPtxTypeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::NVVM::MMATypesAttr>(getProperties().multiplicandBPtxType); + return attr; +} + +::std::optional<::mlir::NVVM::MMATypes> MmaOpGenericAdaptorBase::getMultiplicandBPtxType() { + auto attr = getMultiplicandBPtxTypeAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMATypes>(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +MmaOpAdaptor::MmaOpAdaptor(MmaOp op) : MmaOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MmaOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_b1Op = getProperties().b1Op; (void)tblgen_b1Op; + auto tblgen_intOverflowBehavior = getProperties().intOverflowBehavior; (void)tblgen_intOverflowBehavior; + auto tblgen_layoutA = getProperties().layoutA; (void)tblgen_layoutA; + if (!tblgen_layoutA) return emitError(loc, "'nvvm.mma.sync' op ""requires attribute 'layoutA'"); + auto tblgen_layoutB = getProperties().layoutB; (void)tblgen_layoutB; + if (!tblgen_layoutB) return emitError(loc, "'nvvm.mma.sync' op ""requires attribute 'layoutB'"); + auto tblgen_multiplicandAPtxType = getProperties().multiplicandAPtxType; (void)tblgen_multiplicandAPtxType; + auto tblgen_multiplicandBPtxType = getProperties().multiplicandBPtxType; (void)tblgen_multiplicandBPtxType; + auto tblgen_shape = getProperties().shape; (void)tblgen_shape; + if (!tblgen_shape) return emitError(loc, "'nvvm.mma.sync' op ""requires attribute 'shape'"); + + if (tblgen_shape && !((::llvm::isa<::mlir::NVVM::MMAShapeAttr>(tblgen_shape)))) + return emitError(loc, "'nvvm.mma.sync' op ""attribute 'shape' failed to satisfy constraint: Attribute for MMA operation shape."); + + if (tblgen_b1Op && !((::llvm::isa<::mlir::NVVM::MMAB1OpAttr>(tblgen_b1Op)))) + return emitError(loc, "'nvvm.mma.sync' op ""attribute 'b1Op' failed to satisfy constraint: MMA binary operations"); + + if (tblgen_intOverflowBehavior && !((::llvm::isa<::mlir::NVVM::MMAIntOverflowAttr>(tblgen_intOverflowBehavior)))) + return emitError(loc, "'nvvm.mma.sync' op ""attribute 'intOverflowBehavior' failed to satisfy constraint: MMA overflow options"); + + if (tblgen_layoutA && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(tblgen_layoutA)))) + return emitError(loc, "'nvvm.mma.sync' op ""attribute 'layoutA' failed to satisfy constraint: NVVM MMA layout"); + + if (tblgen_layoutB && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(tblgen_layoutB)))) + return emitError(loc, "'nvvm.mma.sync' op ""attribute 'layoutB' failed to satisfy constraint: NVVM MMA layout"); + + if (tblgen_multiplicandAPtxType && !((::llvm::isa<::mlir::NVVM::MMATypesAttr>(tblgen_multiplicandAPtxType)))) + return emitError(loc, "'nvvm.mma.sync' op ""attribute 'multiplicandAPtxType' failed to satisfy constraint: NVVM MMA types"); + + if (tblgen_multiplicandBPtxType && !((::llvm::isa<::mlir::NVVM::MMATypesAttr>(tblgen_multiplicandBPtxType)))) + return emitError(loc, "'nvvm.mma.sync' op ""attribute 'multiplicandBPtxType' failed to satisfy constraint: NVVM MMA types"); + return ::mlir::success(); +} + +std::pair MmaOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range MmaOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MmaOp::getOperandA() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range MmaOp::getOperandB() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range MmaOp::getOperandC() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange MmaOp::getOperandAMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MmaOp::getOperandBMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MmaOp::getOperandCMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair MmaOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MmaOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MmaOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MmaOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.b1Op; + auto attr = dict.get("b1Op"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for b1Op in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `b1Op` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.intOverflowBehavior; + auto attr = dict.get("intOverflowBehavior"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for intOverflowBehavior in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `intOverflowBehavior` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.layoutA; + auto attr = dict.get("layoutA"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for layoutA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layoutA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.layoutB; + auto attr = dict.get("layoutB"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for layoutB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layoutB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.multiplicandAPtxType; + auto attr = dict.get("multiplicandAPtxType"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for multiplicandAPtxType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `multiplicandAPtxType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.multiplicandBPtxType; + auto attr = dict.get("multiplicandBPtxType"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for multiplicandBPtxType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `multiplicandBPtxType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.shape; + auto attr = dict.get("shape"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for shape in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `shape` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute MmaOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.b1Op; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("b1Op", + propStorage)); + } + + { + const auto &propStorage = prop.intOverflowBehavior; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("intOverflowBehavior", + propStorage)); + } + + { + const auto &propStorage = prop.layoutA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layoutA", + propStorage)); + } + + { + const auto &propStorage = prop.layoutB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layoutB", + propStorage)); + } + + { + const auto &propStorage = prop.multiplicandAPtxType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("multiplicandAPtxType", + propStorage)); + } + + { + const auto &propStorage = prop.multiplicandBPtxType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("multiplicandBPtxType", + propStorage)); + } + + { + const auto &propStorage = prop.shape; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("shape", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MmaOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.b1Op.getAsOpaquePointer()), + llvm::hash_value(prop.intOverflowBehavior.getAsOpaquePointer()), + llvm::hash_value(prop.layoutA.getAsOpaquePointer()), + llvm::hash_value(prop.layoutB.getAsOpaquePointer()), + llvm::hash_value(prop.multiplicandAPtxType.getAsOpaquePointer()), + llvm::hash_value(prop.multiplicandBPtxType.getAsOpaquePointer()), + llvm::hash_value(prop.shape.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional MmaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "b1Op") + return prop.b1Op; + + if (name == "intOverflowBehavior") + return prop.intOverflowBehavior; + + if (name == "layoutA") + return prop.layoutA; + + if (name == "layoutB") + return prop.layoutB; + + if (name == "multiplicandAPtxType") + return prop.multiplicandAPtxType; + + if (name == "multiplicandBPtxType") + return prop.multiplicandBPtxType; + + if (name == "shape") + return prop.shape; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void MmaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "b1Op") { + prop.b1Op = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "intOverflowBehavior") { + prop.intOverflowBehavior = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "layoutA") { + prop.layoutA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "layoutB") { + prop.layoutB = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "multiplicandAPtxType") { + prop.multiplicandAPtxType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "multiplicandBPtxType") { + prop.multiplicandBPtxType = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "shape") { + prop.shape = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void MmaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.b1Op) attrs.append("b1Op", prop.b1Op); + + if (prop.intOverflowBehavior) attrs.append("intOverflowBehavior", prop.intOverflowBehavior); + + if (prop.layoutA) attrs.append("layoutA", prop.layoutA); + + if (prop.layoutB) attrs.append("layoutB", prop.layoutB); + + if (prop.multiplicandAPtxType) attrs.append("multiplicandAPtxType", prop.multiplicandAPtxType); + + if (prop.multiplicandBPtxType) attrs.append("multiplicandBPtxType", prop.multiplicandBPtxType); + + if (prop.shape) attrs.append("shape", prop.shape); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult MmaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getB1OpAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps4(attr, "b1Op", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIntOverflowBehaviorAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps5(attr, "intOverflowBehavior", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLayoutAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(attr, "layoutA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLayoutBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(attr, "layoutB", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMultiplicandAPtxTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(attr, "multiplicandAPtxType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMultiplicandBPtxTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(attr, "multiplicandBPtxType", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getShapeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps3(attr, "shape", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MmaOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.b1Op))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.intOverflowBehavior))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.layoutA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.layoutB))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.multiplicandAPtxType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.multiplicandBPtxType))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.shape))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void MmaOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.b1Op); + + writer.writeOptionalAttribute(prop.intOverflowBehavior); + writer.writeAttribute(prop.layoutA); + writer.writeAttribute(prop.layoutB); + + writer.writeOptionalAttribute(prop.multiplicandAPtxType); + + writer.writeOptionalAttribute(prop.multiplicandBPtxType); + writer.writeAttribute(prop.shape); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::NVVM::MMAShapeAttr MmaOp::getShapeAttr() { + return ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(getProperties().shape); +} + +::mlir::NVVM::MMAShapeAttr MmaOp::getShape() { + auto attr = getShapeAttr(); + return ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(attr); +} + +::mlir::NVVM::MMAB1OpAttr MmaOp::getB1OpAttr() { + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMAB1OpAttr>(getProperties().b1Op); +} + +::std::optional<::mlir::NVVM::MMAB1Op> MmaOp::getB1Op() { + auto attr = getB1OpAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMAB1Op>(attr.getValue()) : (::std::nullopt); +} + +::mlir::NVVM::MMAIntOverflowAttr MmaOp::getIntOverflowBehaviorAttr() { + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMAIntOverflowAttr>(getProperties().intOverflowBehavior); +} + +::std::optional<::mlir::NVVM::MMAIntOverflow> MmaOp::getIntOverflowBehavior() { + auto attr = getIntOverflowBehaviorAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMAIntOverflow>(attr.getValue()) : (::std::nullopt); +} + +::mlir::NVVM::MMALayoutAttr MmaOp::getLayoutAAttr() { + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutA); +} + +::mlir::NVVM::MMALayout MmaOp::getLayoutA() { + auto attr = getLayoutAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMALayoutAttr MmaOp::getLayoutBAttr() { + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutB); +} + +::mlir::NVVM::MMALayout MmaOp::getLayoutB() { + auto attr = getLayoutBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr MmaOp::getMultiplicandAPtxTypeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMATypesAttr>(getProperties().multiplicandAPtxType); +} + +::std::optional<::mlir::NVVM::MMATypes> MmaOp::getMultiplicandAPtxType() { + auto attr = getMultiplicandAPtxTypeAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMATypes>(attr.getValue()) : (::std::nullopt); +} + +::mlir::NVVM::MMATypesAttr MmaOp::getMultiplicandBPtxTypeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMATypesAttr>(getProperties().multiplicandBPtxType); +} + +::std::optional<::mlir::NVVM::MMATypes> MmaOp::getMultiplicandBPtxType() { + auto attr = getMultiplicandBPtxTypeAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMATypes>(attr.getValue()) : (::std::nullopt); +} + +void MmaOp::setShapeAttr(::mlir::NVVM::MMAShapeAttr attr) { + (*this)->setAttr(getShapeAttrName(), attr); +} + +void MmaOp::setB1OpAttr(::mlir::NVVM::MMAB1OpAttr attr) { + (*this)->setAttr(getB1OpAttrName(), attr); +} + +void MmaOp::setB1Op(::std::optional<::mlir::NVVM::MMAB1Op> attrValue) { + if (attrValue) + return (*this)->setAttr(getB1OpAttrName(), ::mlir::NVVM::MMAB1OpAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getB1OpAttrName()); +} + +void MmaOp::setIntOverflowBehaviorAttr(::mlir::NVVM::MMAIntOverflowAttr attr) { + (*this)->setAttr(getIntOverflowBehaviorAttrName(), attr); +} + +void MmaOp::setIntOverflowBehavior(::std::optional<::mlir::NVVM::MMAIntOverflow> attrValue) { + if (attrValue) + return (*this)->setAttr(getIntOverflowBehaviorAttrName(), ::mlir::NVVM::MMAIntOverflowAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getIntOverflowBehaviorAttrName()); +} + +void MmaOp::setLayoutAAttr(::mlir::NVVM::MMALayoutAttr attr) { + (*this)->setAttr(getLayoutAAttrName(), attr); +} + +void MmaOp::setLayoutA(::mlir::NVVM::MMALayout attrValue) { + (*this)->setAttr(getLayoutAAttrName(), ::mlir::NVVM::MMALayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MmaOp::setLayoutBAttr(::mlir::NVVM::MMALayoutAttr attr) { + (*this)->setAttr(getLayoutBAttrName(), attr); +} + +void MmaOp::setLayoutB(::mlir::NVVM::MMALayout attrValue) { + (*this)->setAttr(getLayoutBAttrName(), ::mlir::NVVM::MMALayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void MmaOp::setMultiplicandAPtxTypeAttr(::mlir::NVVM::MMATypesAttr attr) { + (*this)->setAttr(getMultiplicandAPtxTypeAttrName(), attr); +} + +void MmaOp::setMultiplicandAPtxType(::std::optional<::mlir::NVVM::MMATypes> attrValue) { + if (attrValue) + return (*this)->setAttr(getMultiplicandAPtxTypeAttrName(), ::mlir::NVVM::MMATypesAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getMultiplicandAPtxTypeAttrName()); +} + +void MmaOp::setMultiplicandBPtxTypeAttr(::mlir::NVVM::MMATypesAttr attr) { + (*this)->setAttr(getMultiplicandBPtxTypeAttrName(), attr); +} + +void MmaOp::setMultiplicandBPtxType(::std::optional<::mlir::NVVM::MMATypes> attrValue) { + if (attrValue) + return (*this)->setAttr(getMultiplicandBPtxTypeAttrName(), ::mlir::NVVM::MMATypesAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getMultiplicandBPtxTypeAttrName()); +} + +::mlir::Attribute MmaOp::removeB1OpAttr() { + auto &attr = getProperties().b1Op; + attr = {}; + return attr; +} + +::mlir::Attribute MmaOp::removeIntOverflowBehaviorAttr() { + auto &attr = getProperties().intOverflowBehavior; + attr = {}; + return attr; +} + +::mlir::Attribute MmaOp::removeMultiplicandAPtxTypeAttr() { + auto &attr = getProperties().multiplicandAPtxType; + attr = {}; + return attr; +} + +::mlir::Attribute MmaOp::removeMultiplicandBPtxTypeAttr() { + auto &attr = getProperties().multiplicandBPtxType; + attr = {}; + return attr; +} + +void MmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::NVVM::MMAShapeAttr shape, /*optional*/::mlir::NVVM::MMAB1OpAttr b1Op, /*optional*/::mlir::NVVM::MMAIntOverflowAttr intOverflowBehavior, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandAPtxType, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandBPtxType, ::mlir::ValueRange operandA, ::mlir::ValueRange operandB, ::mlir::ValueRange operandC) { + odsState.addOperands(operandA); + odsState.addOperands(operandB); + odsState.addOperands(operandC); + ::llvm::copy(::llvm::ArrayRef({static_cast(operandA.size()), static_cast(operandB.size()), static_cast(operandC.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().shape = shape; + if (b1Op) { + odsState.getOrAddProperties().b1Op = b1Op; + } + if (intOverflowBehavior) { + odsState.getOrAddProperties().intOverflowBehavior = intOverflowBehavior; + } + odsState.getOrAddProperties().layoutA = layoutA; + odsState.getOrAddProperties().layoutB = layoutB; + if (multiplicandAPtxType) { + odsState.getOrAddProperties().multiplicandAPtxType = multiplicandAPtxType; + } + if (multiplicandBPtxType) { + odsState.getOrAddProperties().multiplicandBPtxType = multiplicandBPtxType; + } + odsState.addTypes(res); +} + +void MmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::NVVM::MMAShapeAttr shape, /*optional*/::mlir::NVVM::MMAB1OpAttr b1Op, /*optional*/::mlir::NVVM::MMAIntOverflowAttr intOverflowBehavior, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandAPtxType, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandBPtxType, ::mlir::ValueRange operandA, ::mlir::ValueRange operandB, ::mlir::ValueRange operandC) { + odsState.addOperands(operandA); + odsState.addOperands(operandB); + odsState.addOperands(operandC); + ::llvm::copy(::llvm::ArrayRef({static_cast(operandA.size()), static_cast(operandB.size()), static_cast(operandC.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().shape = shape; + if (b1Op) { + odsState.getOrAddProperties().b1Op = b1Op; + } + if (intOverflowBehavior) { + odsState.getOrAddProperties().intOverflowBehavior = intOverflowBehavior; + } + odsState.getOrAddProperties().layoutA = layoutA; + odsState.getOrAddProperties().layoutB = layoutB; + if (multiplicandAPtxType) { + odsState.getOrAddProperties().multiplicandAPtxType = multiplicandAPtxType; + } + if (multiplicandBPtxType) { + odsState.getOrAddProperties().multiplicandBPtxType = multiplicandBPtxType; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::NVVM::MMAShapeAttr shape, /*optional*/::mlir::NVVM::MMAB1OpAttr b1Op, /*optional*/::mlir::NVVM::MMAIntOverflowAttr intOverflowBehavior, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandAPtxType, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandBPtxType, ::mlir::ValueRange operandA, ::mlir::ValueRange operandB, ::mlir::ValueRange operandC) { + odsState.addOperands(operandA); + odsState.addOperands(operandB); + odsState.addOperands(operandC); + ::llvm::copy(::llvm::ArrayRef({static_cast(operandA.size()), static_cast(operandB.size()), static_cast(operandC.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().shape = shape; + if (b1Op) { + odsState.getOrAddProperties().b1Op = b1Op; + } + if (intOverflowBehavior) { + odsState.getOrAddProperties().intOverflowBehavior = intOverflowBehavior; + } + odsState.getOrAddProperties().layoutA = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutA); + odsState.getOrAddProperties().layoutB = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutB); + if (multiplicandAPtxType) { + odsState.getOrAddProperties().multiplicandAPtxType = multiplicandAPtxType; + } + if (multiplicandBPtxType) { + odsState.getOrAddProperties().multiplicandBPtxType = multiplicandBPtxType; + } + odsState.addTypes(res); +} + +void MmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::NVVM::MMAShapeAttr shape, /*optional*/::mlir::NVVM::MMAB1OpAttr b1Op, /*optional*/::mlir::NVVM::MMAIntOverflowAttr intOverflowBehavior, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandAPtxType, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandBPtxType, ::mlir::ValueRange operandA, ::mlir::ValueRange operandB, ::mlir::ValueRange operandC) { + odsState.addOperands(operandA); + odsState.addOperands(operandB); + odsState.addOperands(operandC); + ::llvm::copy(::llvm::ArrayRef({static_cast(operandA.size()), static_cast(operandB.size()), static_cast(operandC.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().shape = shape; + if (b1Op) { + odsState.getOrAddProperties().b1Op = b1Op; + } + if (intOverflowBehavior) { + odsState.getOrAddProperties().intOverflowBehavior = intOverflowBehavior; + } + odsState.getOrAddProperties().layoutA = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutA); + odsState.getOrAddProperties().layoutB = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutB); + if (multiplicandAPtxType) { + odsState.getOrAddProperties().multiplicandAPtxType = multiplicandAPtxType; + } + if (multiplicandBPtxType) { + odsState.getOrAddProperties().multiplicandBPtxType = multiplicandBPtxType; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MmaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MmaOp::verifyInvariantsImpl() { + auto tblgen_b1Op = getProperties().b1Op; (void)tblgen_b1Op; + auto tblgen_intOverflowBehavior = getProperties().intOverflowBehavior; (void)tblgen_intOverflowBehavior; + auto tblgen_layoutA = getProperties().layoutA; (void)tblgen_layoutA; + if (!tblgen_layoutA) return emitOpError("requires attribute 'layoutA'"); + auto tblgen_layoutB = getProperties().layoutB; (void)tblgen_layoutB; + if (!tblgen_layoutB) return emitOpError("requires attribute 'layoutB'"); + auto tblgen_multiplicandAPtxType = getProperties().multiplicandAPtxType; (void)tblgen_multiplicandAPtxType; + auto tblgen_multiplicandBPtxType = getProperties().multiplicandBPtxType; (void)tblgen_multiplicandBPtxType; + auto tblgen_shape = getProperties().shape; (void)tblgen_shape; + if (!tblgen_shape) return emitOpError("requires attribute 'shape'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps3(*this, tblgen_shape, "shape"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps4(*this, tblgen_b1Op, "b1Op"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps5(*this, tblgen_intOverflowBehavior, "intOverflowBehavior"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(*this, tblgen_layoutA, "layoutA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(*this, tblgen_layoutB, "layoutB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(*this, tblgen_multiplicandAPtxType, "multiplicandAPtxType"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(*this, tblgen_multiplicandBPtxType, "multiplicandBPtxType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MmaOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MmaOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::RcpApproxFtzF32Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RcpApproxFtzF32OpGenericAdaptorBase::RcpApproxFtzF32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.rcp.approx.ftz.f", odsAttrs.getContext()); +} + +RcpApproxFtzF32OpGenericAdaptorBase::RcpApproxFtzF32OpGenericAdaptorBase(RcpApproxFtzF32Op op) : RcpApproxFtzF32OpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RcpApproxFtzF32OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RcpApproxFtzF32OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RcpApproxFtzF32OpAdaptor::RcpApproxFtzF32OpAdaptor(RcpApproxFtzF32Op op) : RcpApproxFtzF32OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RcpApproxFtzF32OpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RcpApproxFtzF32Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RcpApproxFtzF32Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> RcpApproxFtzF32Op::getArg() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RcpApproxFtzF32Op::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RcpApproxFtzF32Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RcpApproxFtzF32Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> RcpApproxFtzF32Op::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSResults(0).begin()); +} + +void RcpApproxFtzF32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void RcpApproxFtzF32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RcpApproxFtzF32Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RcpApproxFtzF32Op::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RcpApproxFtzF32Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RcpApproxFtzF32Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand argRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(argRawOperands); ::llvm::SMLoc argOperandsLoc; + (void)argOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + argOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(argRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::FloatType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getF32Type(); + result.addTypes(resTypes); + if (parser.resolveOperands(argOperands, odsBuildableType0, argOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RcpApproxFtzF32Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArg(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::FloatType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RcpApproxFtzF32Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::RcpApproxFtzF32Op) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ReduxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReduxOpGenericAdaptorBase::ReduxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.redux.sync", odsAttrs.getContext()); +} + +ReduxOpGenericAdaptorBase::ReduxOpGenericAdaptorBase(ReduxOp op) : ReduxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReduxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ReduxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::NVVM::ReduxKindAttr ReduxOpGenericAdaptorBase::getKindAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::ReduxKindAttr>(getProperties().kind); + return attr; +} + +::mlir::NVVM::ReduxKind ReduxOpGenericAdaptorBase::getKind() { + auto attr = getKindAttr(); + return attr.getValue(); +} + +} // namespace detail +ReduxOpAdaptor::ReduxOpAdaptor(ReduxOp op) : ReduxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReduxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_kind = getProperties().kind; (void)tblgen_kind; + if (!tblgen_kind) return emitError(loc, "'nvvm.redux.sync' op ""requires attribute 'kind'"); + + if (tblgen_kind && !((::llvm::isa<::mlir::NVVM::ReduxKindAttr>(tblgen_kind)))) + return emitError(loc, "'nvvm.redux.sync' op ""attribute 'kind' failed to satisfy constraint: NVVM redux kind"); + return ::mlir::success(); +} + +std::pair ReduxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ReduxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ReduxOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ReduxOp::getMaskAndClamp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ReduxOp::getValMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ReduxOp::getMaskAndClampMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ReduxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReduxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ReduxOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ReduxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.kind; + auto attr = dict.get("kind"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for kind in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `kind` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ReduxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.kind; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("kind", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ReduxOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.kind.getAsOpaquePointer())); +} + +std::optional ReduxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "kind") + return prop.kind; + return std::nullopt; +} + +void ReduxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "kind") { + prop.kind = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ReduxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.kind) attrs.append("kind", prop.kind); +} + +::mlir::LogicalResult ReduxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getKindAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps7(attr, "kind", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReduxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.kind))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReduxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.kind); +} + +::mlir::NVVM::ReduxKindAttr ReduxOp::getKindAttr() { + return ::llvm::cast<::mlir::NVVM::ReduxKindAttr>(getProperties().kind); +} + +::mlir::NVVM::ReduxKind ReduxOp::getKind() { + auto attr = getKindAttr(); + return attr.getValue(); +} + +void ReduxOp::setKindAttr(::mlir::NVVM::ReduxKindAttr attr) { + (*this)->setAttr(getKindAttrName(), attr); +} + +void ReduxOp::setKind(::mlir::NVVM::ReduxKind attrValue) { + (*this)->setAttr(getKindAttrName(), ::mlir::NVVM::ReduxKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ReduxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::NVVM::ReduxKindAttr kind, ::mlir::Value mask_and_clamp) { + odsState.addOperands(val); + odsState.addOperands(mask_and_clamp); + odsState.getOrAddProperties().kind = kind; + odsState.addTypes(res); +} + +void ReduxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::NVVM::ReduxKindAttr kind, ::mlir::Value mask_and_clamp) { + odsState.addOperands(val); + odsState.addOperands(mask_and_clamp); + odsState.getOrAddProperties().kind = kind; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReduxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::NVVM::ReduxKind kind, ::mlir::Value mask_and_clamp) { + odsState.addOperands(val); + odsState.addOperands(mask_and_clamp); + odsState.getOrAddProperties().kind = ::mlir::NVVM::ReduxKindAttr::get(odsBuilder.getContext(), kind); + odsState.addTypes(res); +} + +void ReduxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::NVVM::ReduxKind kind, ::mlir::Value mask_and_clamp) { + odsState.addOperands(val); + odsState.addOperands(mask_and_clamp); + odsState.getOrAddProperties().kind = ::mlir::NVVM::ReduxKindAttr::get(odsBuilder.getContext(), kind); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReduxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReduxOp::verifyInvariantsImpl() { + auto tblgen_kind = getProperties().kind; (void)tblgen_kind; + if (!tblgen_kind) return emitOpError("requires attribute 'kind'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps7(*this, tblgen_kind, "kind"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReduxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ReduxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::NVVM::ReduxKindAttr kindAttr; + ::mlir::OpAsmParser::UnresolvedOperand valRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(valRawOperands); ::llvm::SMLoc valOperandsLoc; + (void)valOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mask_and_clampRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mask_and_clampOperands(mask_and_clampRawOperands); ::llvm::SMLoc mask_and_clampOperandsLoc; + (void)mask_and_clampOperandsLoc; + ::mlir::Type valRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + if (parser.parseCustomAttributeWithFallback(kindAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (kindAttr) result.getOrAddProperties().kind = kindAttr; + + valOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + mask_and_clampOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mask_and_clampRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(mask_and_clampOperands, odsBuildableType0, mask_and_clampOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReduxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getKindAttr()); + _odsPrinter << ' '; + _odsPrinter << getVal(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMaskAndClamp(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("kind"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVal().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ReduxOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ShflOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShflOpGenericAdaptorBase::ShflOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.shfl.sync", odsAttrs.getContext()); +} + +ShflOpGenericAdaptorBase::ShflOpGenericAdaptorBase(ShflOp op) : ShflOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShflOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ShflOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::NVVM::ShflKindAttr ShflOpGenericAdaptorBase::getKindAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::ShflKindAttr>(getProperties().kind); + return attr; +} + +::mlir::NVVM::ShflKind ShflOpGenericAdaptorBase::getKind() { + auto attr = getKindAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr ShflOpGenericAdaptorBase::getReturnValueAndIsValidAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().return_value_and_is_valid); + return attr; +} + +::std::optional ShflOpGenericAdaptorBase::getReturnValueAndIsValid() { + auto attr = getReturnValueAndIsValidAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +} // namespace detail +ShflOpAdaptor::ShflOpAdaptor(ShflOp op) : ShflOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShflOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_kind = getProperties().kind; (void)tblgen_kind; + if (!tblgen_kind) return emitError(loc, "'nvvm.shfl.sync' op ""requires attribute 'kind'"); + auto tblgen_return_value_and_is_valid = getProperties().return_value_and_is_valid; (void)tblgen_return_value_and_is_valid; + + if (tblgen_kind && !((::llvm::isa<::mlir::NVVM::ShflKindAttr>(tblgen_kind)))) + return emitError(loc, "'nvvm.shfl.sync' op ""attribute 'kind' failed to satisfy constraint: NVVM shuffle kind"); + + if (tblgen_return_value_and_is_valid && !((::llvm::isa<::mlir::UnitAttr>(tblgen_return_value_and_is_valid)))) + return emitError(loc, "'nvvm.shfl.sync' op ""attribute 'return_value_and_is_valid' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair ShflOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ShflOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> ShflOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::Value ShflOp::getVal() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ShflOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ShflOp::getMaskAndClamp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &ShflOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShflOp::getValMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShflOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ShflOp::getMaskAndClampMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair ShflOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShflOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ShflOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ShflOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.kind; + auto attr = dict.get("kind"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for kind in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `kind` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.return_value_and_is_valid; + auto attr = dict.get("return_value_and_is_valid"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for return_value_and_is_valid in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `return_value_and_is_valid` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ShflOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.kind; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("kind", + propStorage)); + } + + { + const auto &propStorage = prop.return_value_and_is_valid; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("return_value_and_is_valid", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ShflOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.kind.getAsOpaquePointer()), + llvm::hash_value(prop.return_value_and_is_valid.getAsOpaquePointer())); +} + +std::optional ShflOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "kind") + return prop.kind; + + if (name == "return_value_and_is_valid") + return prop.return_value_and_is_valid; + return std::nullopt; +} + +void ShflOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "kind") { + prop.kind = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "return_value_and_is_valid") { + prop.return_value_and_is_valid = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ShflOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.kind) attrs.append("kind", prop.kind); + + if (prop.return_value_and_is_valid) attrs.append("return_value_and_is_valid", prop.return_value_and_is_valid); +} + +::mlir::LogicalResult ShflOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getKindAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps8(attr, "kind", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReturnValueAndIsValidAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps9(attr, "return_value_and_is_valid", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShflOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.kind))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.return_value_and_is_valid))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShflOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.kind); + + writer.writeOptionalAttribute(prop.return_value_and_is_valid); +} + +::mlir::NVVM::ShflKindAttr ShflOp::getKindAttr() { + return ::llvm::cast<::mlir::NVVM::ShflKindAttr>(getProperties().kind); +} + +::mlir::NVVM::ShflKind ShflOp::getKind() { + auto attr = getKindAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr ShflOp::getReturnValueAndIsValidAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().return_value_and_is_valid); +} + +::std::optional ShflOp::getReturnValueAndIsValid() { + auto attr = getReturnValueAndIsValidAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +void ShflOp::setKindAttr(::mlir::NVVM::ShflKindAttr attr) { + (*this)->setAttr(getKindAttrName(), attr); +} + +void ShflOp::setKind(::mlir::NVVM::ShflKind attrValue) { + (*this)->setAttr(getKindAttrName(), ::mlir::NVVM::ShflKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ShflOp::setReturnValueAndIsValidAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getReturnValueAndIsValidAttrName(), attr); +} + +void ShflOp::setReturnValueAndIsValid(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getReturnValueAndIsValidAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getReturnValueAndIsValidAttrName()); +} + +::mlir::Attribute ShflOp::removeReturnValueAndIsValidAttr() { + auto &attr = getProperties().return_value_and_is_valid; + attr = {}; + return attr; +} + +void ShflOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value offset, ::mlir::Value mask_and_clamp, ::mlir::NVVM::ShflKindAttr kind, /*optional*/::mlir::UnitAttr return_value_and_is_valid) { + odsState.addOperands(dst); + odsState.addOperands(val); + odsState.addOperands(offset); + odsState.addOperands(mask_and_clamp); + odsState.getOrAddProperties().kind = kind; + if (return_value_and_is_valid) { + odsState.getOrAddProperties().return_value_and_is_valid = return_value_and_is_valid; + } + odsState.addTypes(res); +} + +void ShflOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value offset, ::mlir::Value mask_and_clamp, ::mlir::NVVM::ShflKindAttr kind, /*optional*/::mlir::UnitAttr return_value_and_is_valid) { + odsState.addOperands(dst); + odsState.addOperands(val); + odsState.addOperands(offset); + odsState.addOperands(mask_and_clamp); + odsState.getOrAddProperties().kind = kind; + if (return_value_and_is_valid) { + odsState.getOrAddProperties().return_value_and_is_valid = return_value_and_is_valid; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShflOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value offset, ::mlir::Value mask_and_clamp, ::mlir::NVVM::ShflKind kind, /*optional*/::mlir::UnitAttr return_value_and_is_valid) { + odsState.addOperands(dst); + odsState.addOperands(val); + odsState.addOperands(offset); + odsState.addOperands(mask_and_clamp); + odsState.getOrAddProperties().kind = ::mlir::NVVM::ShflKindAttr::get(odsBuilder.getContext(), kind); + if (return_value_and_is_valid) { + odsState.getOrAddProperties().return_value_and_is_valid = return_value_and_is_valid; + } + odsState.addTypes(res); +} + +void ShflOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value offset, ::mlir::Value mask_and_clamp, ::mlir::NVVM::ShflKind kind, /*optional*/::mlir::UnitAttr return_value_and_is_valid) { + odsState.addOperands(dst); + odsState.addOperands(val); + odsState.addOperands(offset); + odsState.addOperands(mask_and_clamp); + odsState.getOrAddProperties().kind = ::mlir::NVVM::ShflKindAttr::get(odsBuilder.getContext(), kind); + if (return_value_and_is_valid) { + odsState.getOrAddProperties().return_value_and_is_valid = return_value_and_is_valid; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShflOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ShflOp::verifyInvariantsImpl() { + auto tblgen_kind = getProperties().kind; (void)tblgen_kind; + if (!tblgen_kind) return emitOpError("requires attribute 'kind'"); + auto tblgen_return_value_and_is_valid = getProperties().return_value_and_is_valid; (void)tblgen_return_value_and_is_valid; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps8(*this, tblgen_kind, "kind"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps9(*this, tblgen_return_value_and_is_valid, "return_value_and_is_valid"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShflOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ShflOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::NVVM::ShflKindAttr kindAttr; + ::mlir::OpAsmParser::UnresolvedOperand dstRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstOperands(dstRawOperands); ::llvm::SMLoc dstOperandsLoc; + (void)dstOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand valRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(valRawOperands); ::llvm::SMLoc valOperandsLoc; + (void)valOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand offsetRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> offsetOperands(offsetRawOperands); ::llvm::SMLoc offsetOperandsLoc; + (void)offsetOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mask_and_clampRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mask_and_clampOperands(mask_and_clampRawOperands); ::llvm::SMLoc mask_and_clampOperandsLoc; + (void)mask_and_clampOperandsLoc; + ::mlir::Type valRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + if (parser.parseCustomAttributeWithFallback(kindAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (kindAttr) result.getOrAddProperties().kind = kindAttr; + + dstOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + valOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + offsetOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(offsetRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + mask_and_clampOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mask_and_clampRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(dstOperands, odsBuildableType0, dstOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(offsetOperands, odsBuildableType0, offsetOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(mask_and_clampOperands, odsBuildableType0, mask_and_clampOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShflOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getKindAttr()); + _odsPrinter << ' '; + _odsPrinter << getDst(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getVal(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getOffset(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMaskAndClamp(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("kind"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVal().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ShflOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::SyncWarpOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SyncWarpOpGenericAdaptorBase::SyncWarpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.bar.warp.sync", odsAttrs.getContext()); +} + +SyncWarpOpGenericAdaptorBase::SyncWarpOpGenericAdaptorBase(SyncWarpOp op) : SyncWarpOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SyncWarpOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SyncWarpOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SyncWarpOpAdaptor::SyncWarpOpAdaptor(SyncWarpOp op) : SyncWarpOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SyncWarpOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SyncWarpOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SyncWarpOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SyncWarpOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SyncWarpOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SyncWarpOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SyncWarpOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void SyncWarpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value mask) { + odsState.addOperands(mask); +} + +void SyncWarpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask) { + odsState.addOperands(mask); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SyncWarpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SyncWarpOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SyncWarpOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SyncWarpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand maskRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> maskOperands(maskRawOperands); ::llvm::SMLoc maskOperandsLoc; + (void)maskOperandsLoc; + ::mlir::Type maskRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> maskTypes(maskRawTypes); + + maskOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(maskRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + maskRawTypes[0] = type; + } + if (parser.resolveOperands(maskOperands, maskTypes, maskOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SyncWarpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMask(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMask().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::SyncWarpOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ThreadIdXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ThreadIdXOpGenericAdaptorBase::ThreadIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.tid.x", odsAttrs.getContext()); +} + +ThreadIdXOpGenericAdaptorBase::ThreadIdXOpGenericAdaptorBase(ThreadIdXOp op) : ThreadIdXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ThreadIdXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ThreadIdXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ThreadIdXOpAdaptor::ThreadIdXOpAdaptor(ThreadIdXOp op) : ThreadIdXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ThreadIdXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ThreadIdXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ThreadIdXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ThreadIdXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ThreadIdXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ThreadIdXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ThreadIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ThreadIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadIdXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ThreadIdXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadIdXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ThreadIdXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ThreadIdXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ThreadIdXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ThreadIdXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ThreadIdYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ThreadIdYOpGenericAdaptorBase::ThreadIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.tid.y", odsAttrs.getContext()); +} + +ThreadIdYOpGenericAdaptorBase::ThreadIdYOpGenericAdaptorBase(ThreadIdYOp op) : ThreadIdYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ThreadIdYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ThreadIdYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ThreadIdYOpAdaptor::ThreadIdYOpAdaptor(ThreadIdYOp op) : ThreadIdYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ThreadIdYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ThreadIdYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ThreadIdYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ThreadIdYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ThreadIdYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ThreadIdYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ThreadIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ThreadIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadIdYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ThreadIdYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadIdYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ThreadIdYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ThreadIdYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ThreadIdYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ThreadIdYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ThreadIdZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ThreadIdZOpGenericAdaptorBase::ThreadIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.tid.z", odsAttrs.getContext()); +} + +ThreadIdZOpGenericAdaptorBase::ThreadIdZOpGenericAdaptorBase(ThreadIdZOp op) : ThreadIdZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ThreadIdZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ThreadIdZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ThreadIdZOpAdaptor::ThreadIdZOpAdaptor(ThreadIdZOp op) : ThreadIdZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ThreadIdZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ThreadIdZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ThreadIdZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ThreadIdZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ThreadIdZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ThreadIdZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ThreadIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ThreadIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadIdZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ThreadIdZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadIdZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ThreadIdZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ThreadIdZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ThreadIdZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ThreadIdZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::VoteBallotOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VoteBallotOpGenericAdaptorBase::VoteBallotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.vote.ballot.sync", odsAttrs.getContext()); +} + +VoteBallotOpGenericAdaptorBase::VoteBallotOpGenericAdaptorBase(VoteBallotOp op) : VoteBallotOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VoteBallotOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr VoteBallotOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +VoteBallotOpAdaptor::VoteBallotOpAdaptor(VoteBallotOp op) : VoteBallotOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VoteBallotOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VoteBallotOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range VoteBallotOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VoteBallotOp::getMask() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value VoteBallotOp::getPred() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &VoteBallotOp::getMaskMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &VoteBallotOp::getPredMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair VoteBallotOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range VoteBallotOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value VoteBallotOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void VoteBallotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value pred) { + odsState.addOperands(mask); + odsState.addOperands(pred); + odsState.addTypes(res); +} + +void VoteBallotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value pred) { + odsState.addOperands(mask); + odsState.addOperands(pred); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void VoteBallotOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult VoteBallotOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult VoteBallotOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::VoteBallotOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WMMALoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WMMALoadOpGenericAdaptorBase::WMMALoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.wmma.load", odsAttrs.getContext()); +} + +WMMALoadOpGenericAdaptorBase::WMMALoadOpGenericAdaptorBase(WMMALoadOp op) : WMMALoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WMMALoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr WMMALoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr WMMALoadOpGenericAdaptorBase::getMAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().m); + return attr; +} + +uint32_t WMMALoadOpGenericAdaptorBase::getM() { + auto attr = getMAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMALoadOpGenericAdaptorBase::getNAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); + return attr; +} + +uint32_t WMMALoadOpGenericAdaptorBase::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMALoadOpGenericAdaptorBase::getKAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().k); + return attr; +} + +uint32_t WMMALoadOpGenericAdaptorBase::getK() { + auto attr = getKAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::MMALayoutAttr WMMALoadOpGenericAdaptorBase::getLayoutAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layout); + return attr; +} + +::mlir::NVVM::MMALayout WMMALoadOpGenericAdaptorBase::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr WMMALoadOpGenericAdaptorBase::getEltypeAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMATypesAttr>(getProperties().eltype); + return attr; +} + +::mlir::NVVM::MMATypes WMMALoadOpGenericAdaptorBase::getEltype() { + auto attr = getEltypeAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMAFragAttr WMMALoadOpGenericAdaptorBase::getFragAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMAFragAttr>(getProperties().frag); + return attr; +} + +::mlir::NVVM::MMAFrag WMMALoadOpGenericAdaptorBase::getFrag() { + auto attr = getFragAttr(); + return attr.getValue(); +} + +} // namespace detail +WMMALoadOpAdaptor::WMMALoadOpAdaptor(WMMALoadOp op) : WMMALoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WMMALoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_eltype = getProperties().eltype; (void)tblgen_eltype; + if (!tblgen_eltype) return emitError(loc, "'nvvm.wmma.load' op ""requires attribute 'eltype'"); + auto tblgen_frag = getProperties().frag; (void)tblgen_frag; + if (!tblgen_frag) return emitError(loc, "'nvvm.wmma.load' op ""requires attribute 'frag'"); + auto tblgen_k = getProperties().k; (void)tblgen_k; + if (!tblgen_k) return emitError(loc, "'nvvm.wmma.load' op ""requires attribute 'k'"); + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + if (!tblgen_layout) return emitError(loc, "'nvvm.wmma.load' op ""requires attribute 'layout'"); + auto tblgen_m = getProperties().m; (void)tblgen_m; + if (!tblgen_m) return emitError(loc, "'nvvm.wmma.load' op ""requires attribute 'm'"); + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitError(loc, "'nvvm.wmma.load' op ""requires attribute 'n'"); + + if (tblgen_m && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wmma.load' op ""attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_n && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wmma.load' op ""attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_k && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wmma.load' op ""attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_layout && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(tblgen_layout)))) + return emitError(loc, "'nvvm.wmma.load' op ""attribute 'layout' failed to satisfy constraint: NVVM MMA layout"); + + if (tblgen_eltype && !((::llvm::isa<::mlir::NVVM::MMATypesAttr>(tblgen_eltype)))) + return emitError(loc, "'nvvm.wmma.load' op ""attribute 'eltype' failed to satisfy constraint: NVVM MMA types"); + + if (tblgen_frag && !((::llvm::isa<::mlir::NVVM::MMAFragAttr>(tblgen_frag)))) + return emitError(loc, "'nvvm.wmma.load' op ""attribute 'frag' failed to satisfy constraint: NVVM MMA frag type"); + return ::mlir::success(); +} + +std::pair WMMALoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range WMMALoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> WMMALoadOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> WMMALoadOp::getStride() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &WMMALoadOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &WMMALoadOp::getStrideMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair WMMALoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WMMALoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value WMMALoadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult WMMALoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.eltype; + auto attr = dict.get("eltype"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for eltype in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `eltype` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.frag; + auto attr = dict.get("frag"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for frag in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `frag` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.k; + auto attr = dict.get("k"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for k in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `k` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.layout; + auto attr = dict.get("layout"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for layout in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layout` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.m; + auto attr = dict.get("m"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for m in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `m` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.n; + auto attr = dict.get("n"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for n in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `n` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute WMMALoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.eltype; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("eltype", + propStorage)); + } + + { + const auto &propStorage = prop.frag; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("frag", + propStorage)); + } + + { + const auto &propStorage = prop.k; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("k", + propStorage)); + } + + { + const auto &propStorage = prop.layout; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layout", + propStorage)); + } + + { + const auto &propStorage = prop.m; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("m", + propStorage)); + } + + { + const auto &propStorage = prop.n; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("n", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code WMMALoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.eltype.getAsOpaquePointer()), + llvm::hash_value(prop.frag.getAsOpaquePointer()), + llvm::hash_value(prop.k.getAsOpaquePointer()), + llvm::hash_value(prop.layout.getAsOpaquePointer()), + llvm::hash_value(prop.m.getAsOpaquePointer()), + llvm::hash_value(prop.n.getAsOpaquePointer())); +} + +std::optional WMMALoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "eltype") + return prop.eltype; + + if (name == "frag") + return prop.frag; + + if (name == "k") + return prop.k; + + if (name == "layout") + return prop.layout; + + if (name == "m") + return prop.m; + + if (name == "n") + return prop.n; + return std::nullopt; +} + +void WMMALoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "eltype") { + prop.eltype = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "frag") { + prop.frag = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "k") { + prop.k = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "layout") { + prop.layout = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "m") { + prop.m = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "n") { + prop.n = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void WMMALoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.eltype) attrs.append("eltype", prop.eltype); + + if (prop.frag) attrs.append("frag", prop.frag); + + if (prop.k) attrs.append("k", prop.k); + + if (prop.layout) attrs.append("layout", prop.layout); + + if (prop.m) attrs.append("m", prop.m); + + if (prop.n) attrs.append("n", prop.n); +} + +::mlir::LogicalResult WMMALoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getEltypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(attr, "eltype", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFragAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps10(attr, "frag", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getKAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "k", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLayoutAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(attr, "layout", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "m", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "n", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WMMALoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.eltype))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.frag))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.k))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.layout))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.m))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.n))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WMMALoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.eltype); + writer.writeAttribute(prop.frag); + writer.writeAttribute(prop.k); + writer.writeAttribute(prop.layout); + writer.writeAttribute(prop.m); + writer.writeAttribute(prop.n); +} + +::mlir::IntegerAttr WMMALoadOp::getMAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().m); +} + +uint32_t WMMALoadOp::getM() { + auto attr = getMAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMALoadOp::getNAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); +} + +uint32_t WMMALoadOp::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMALoadOp::getKAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().k); +} + +uint32_t WMMALoadOp::getK() { + auto attr = getKAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::MMALayoutAttr WMMALoadOp::getLayoutAttr() { + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layout); +} + +::mlir::NVVM::MMALayout WMMALoadOp::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr WMMALoadOp::getEltypeAttr() { + return ::llvm::cast<::mlir::NVVM::MMATypesAttr>(getProperties().eltype); +} + +::mlir::NVVM::MMATypes WMMALoadOp::getEltype() { + auto attr = getEltypeAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMAFragAttr WMMALoadOp::getFragAttr() { + return ::llvm::cast<::mlir::NVVM::MMAFragAttr>(getProperties().frag); +} + +::mlir::NVVM::MMAFrag WMMALoadOp::getFrag() { + auto attr = getFragAttr(); + return attr.getValue(); +} + +void WMMALoadOp::setMAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getMAttrName(), attr); +} + +void WMMALoadOp::setM(uint32_t attrValue) { + (*this)->setAttr(getMAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMALoadOp::setNAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getNAttrName(), attr); +} + +void WMMALoadOp::setN(uint32_t attrValue) { + (*this)->setAttr(getNAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMALoadOp::setKAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getKAttrName(), attr); +} + +void WMMALoadOp::setK(uint32_t attrValue) { + (*this)->setAttr(getKAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMALoadOp::setLayoutAttr(::mlir::NVVM::MMALayoutAttr attr) { + (*this)->setAttr(getLayoutAttrName(), attr); +} + +void WMMALoadOp::setLayout(::mlir::NVVM::MMALayout attrValue) { + (*this)->setAttr(getLayoutAttrName(), ::mlir::NVVM::MMALayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WMMALoadOp::setEltypeAttr(::mlir::NVVM::MMATypesAttr attr) { + (*this)->setAttr(getEltypeAttrName(), attr); +} + +void WMMALoadOp::setEltype(::mlir::NVVM::MMATypes attrValue) { + (*this)->setAttr(getEltypeAttrName(), ::mlir::NVVM::MMATypesAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WMMALoadOp::setFragAttr(::mlir::NVVM::MMAFragAttr attr) { + (*this)->setAttr(getFragAttrName(), attr); +} + +void WMMALoadOp::setFrag(::mlir::NVVM::MMAFrag attrValue) { + (*this)->setAttr(getFragAttrName(), ::mlir::NVVM::MMAFragAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WMMALoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layout, ::mlir::NVVM::MMATypesAttr eltype, ::mlir::NVVM::MMAFragAttr frag) { + odsState.addOperands(ptr); + odsState.addOperands(stride); + odsState.getOrAddProperties().m = m; + odsState.getOrAddProperties().n = n; + odsState.getOrAddProperties().k = k; + odsState.getOrAddProperties().layout = layout; + odsState.getOrAddProperties().eltype = eltype; + odsState.getOrAddProperties().frag = frag; + odsState.addTypes(res); +} + +void WMMALoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layout, ::mlir::NVVM::MMATypesAttr eltype, ::mlir::NVVM::MMAFragAttr frag) { + odsState.addOperands(ptr); + odsState.addOperands(stride); + odsState.getOrAddProperties().m = m; + odsState.getOrAddProperties().n = n; + odsState.getOrAddProperties().k = k; + odsState.getOrAddProperties().layout = layout; + odsState.getOrAddProperties().eltype = eltype; + odsState.getOrAddProperties().frag = frag; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WMMALoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value stride, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layout, ::mlir::NVVM::MMATypes eltype, ::mlir::NVVM::MMAFrag frag) { + odsState.addOperands(ptr); + odsState.addOperands(stride); + odsState.getOrAddProperties().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m); + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); + odsState.getOrAddProperties().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k); + odsState.getOrAddProperties().layout = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layout); + odsState.getOrAddProperties().eltype = ::mlir::NVVM::MMATypesAttr::get(odsBuilder.getContext(), eltype); + odsState.getOrAddProperties().frag = ::mlir::NVVM::MMAFragAttr::get(odsBuilder.getContext(), frag); + odsState.addTypes(res); +} + +void WMMALoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value stride, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layout, ::mlir::NVVM::MMATypes eltype, ::mlir::NVVM::MMAFrag frag) { + odsState.addOperands(ptr); + odsState.addOperands(stride); + odsState.getOrAddProperties().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m); + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); + odsState.getOrAddProperties().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k); + odsState.getOrAddProperties().layout = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layout); + odsState.getOrAddProperties().eltype = ::mlir::NVVM::MMATypesAttr::get(odsBuilder.getContext(), eltype); + odsState.getOrAddProperties().frag = ::mlir::NVVM::MMAFragAttr::get(odsBuilder.getContext(), frag); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WMMALoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WMMALoadOp::verifyInvariantsImpl() { + auto tblgen_eltype = getProperties().eltype; (void)tblgen_eltype; + if (!tblgen_eltype) return emitOpError("requires attribute 'eltype'"); + auto tblgen_frag = getProperties().frag; (void)tblgen_frag; + if (!tblgen_frag) return emitOpError("requires attribute 'frag'"); + auto tblgen_k = getProperties().k; (void)tblgen_k; + if (!tblgen_k) return emitOpError("requires attribute 'k'"); + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + if (!tblgen_layout) return emitOpError("requires attribute 'layout'"); + auto tblgen_m = getProperties().m; (void)tblgen_m; + if (!tblgen_m) return emitOpError("requires attribute 'm'"); + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitOpError("requires attribute 'n'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_m, "m"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_n, "n"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_k, "k"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(*this, tblgen_layout, "layout"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(*this, tblgen_eltype, "eltype"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps10(*this, tblgen_frag, "frag"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult WMMALoadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WMMALoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand ptrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(ptrRawOperands); ::llvm::SMLoc ptrOperandsLoc; + (void)ptrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand strideRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> strideOperands(strideRawOperands); ::llvm::SMLoc strideOperandsLoc; + (void)strideOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> ptrTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ptrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + strideOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(strideRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType ptr__res_functionType; + if (parser.parseType(ptr__res_functionType)) + return ::mlir::failure(); + ptrTypes = ptr__res_functionType.getInputs(); + resTypes = ptr__res_functionType.getResults(); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(strideOperands, odsBuildableType0, strideOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WMMALoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getPtr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getStride(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(::llvm::ArrayRef<::mlir::Type>(getPtr().getType()), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WMMALoadOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WMMAMmaOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WMMAMmaOpGenericAdaptorBase::WMMAMmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.wmma.mma", odsAttrs.getContext()); +} + +WMMAMmaOpGenericAdaptorBase::WMMAMmaOpGenericAdaptorBase(WMMAMmaOp op) : WMMAMmaOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WMMAMmaOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr WMMAMmaOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr WMMAMmaOpGenericAdaptorBase::getMAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().m); + return attr; +} + +uint32_t WMMAMmaOpGenericAdaptorBase::getM() { + auto attr = getMAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMAMmaOpGenericAdaptorBase::getNAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); + return attr; +} + +uint32_t WMMAMmaOpGenericAdaptorBase::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMAMmaOpGenericAdaptorBase::getKAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().k); + return attr; +} + +uint32_t WMMAMmaOpGenericAdaptorBase::getK() { + auto attr = getKAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::MMALayoutAttr WMMAMmaOpGenericAdaptorBase::getLayoutAAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutA); + return attr; +} + +::mlir::NVVM::MMALayout WMMAMmaOpGenericAdaptorBase::getLayoutA() { + auto attr = getLayoutAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMALayoutAttr WMMAMmaOpGenericAdaptorBase::getLayoutBAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutB); + return attr; +} + +::mlir::NVVM::MMALayout WMMAMmaOpGenericAdaptorBase::getLayoutB() { + auto attr = getLayoutBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr WMMAMmaOpGenericAdaptorBase::getEltypeAAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMATypesAttr>(getProperties().eltypeA); + return attr; +} + +::mlir::NVVM::MMATypes WMMAMmaOpGenericAdaptorBase::getEltypeA() { + auto attr = getEltypeAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr WMMAMmaOpGenericAdaptorBase::getEltypeBAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMATypesAttr>(getProperties().eltypeB); + return attr; +} + +::mlir::NVVM::MMATypes WMMAMmaOpGenericAdaptorBase::getEltypeB() { + auto attr = getEltypeBAttr(); + return attr.getValue(); +} + +} // namespace detail +WMMAMmaOpAdaptor::WMMAMmaOpAdaptor(WMMAMmaOp op) : WMMAMmaOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WMMAMmaOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_eltypeA = getProperties().eltypeA; (void)tblgen_eltypeA; + if (!tblgen_eltypeA) return emitError(loc, "'nvvm.wmma.mma' op ""requires attribute 'eltypeA'"); + auto tblgen_eltypeB = getProperties().eltypeB; (void)tblgen_eltypeB; + if (!tblgen_eltypeB) return emitError(loc, "'nvvm.wmma.mma' op ""requires attribute 'eltypeB'"); + auto tblgen_k = getProperties().k; (void)tblgen_k; + if (!tblgen_k) return emitError(loc, "'nvvm.wmma.mma' op ""requires attribute 'k'"); + auto tblgen_layoutA = getProperties().layoutA; (void)tblgen_layoutA; + if (!tblgen_layoutA) return emitError(loc, "'nvvm.wmma.mma' op ""requires attribute 'layoutA'"); + auto tblgen_layoutB = getProperties().layoutB; (void)tblgen_layoutB; + if (!tblgen_layoutB) return emitError(loc, "'nvvm.wmma.mma' op ""requires attribute 'layoutB'"); + auto tblgen_m = getProperties().m; (void)tblgen_m; + if (!tblgen_m) return emitError(loc, "'nvvm.wmma.mma' op ""requires attribute 'm'"); + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitError(loc, "'nvvm.wmma.mma' op ""requires attribute 'n'"); + + if (tblgen_m && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wmma.mma' op ""attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_n && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wmma.mma' op ""attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_k && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wmma.mma' op ""attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_layoutA && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(tblgen_layoutA)))) + return emitError(loc, "'nvvm.wmma.mma' op ""attribute 'layoutA' failed to satisfy constraint: NVVM MMA layout"); + + if (tblgen_layoutB && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(tblgen_layoutB)))) + return emitError(loc, "'nvvm.wmma.mma' op ""attribute 'layoutB' failed to satisfy constraint: NVVM MMA layout"); + + if (tblgen_eltypeA && !((::llvm::isa<::mlir::NVVM::MMATypesAttr>(tblgen_eltypeA)))) + return emitError(loc, "'nvvm.wmma.mma' op ""attribute 'eltypeA' failed to satisfy constraint: NVVM MMA types"); + + if (tblgen_eltypeB && !((::llvm::isa<::mlir::NVVM::MMATypesAttr>(tblgen_eltypeB)))) + return emitError(loc, "'nvvm.wmma.mma' op ""attribute 'eltypeB' failed to satisfy constraint: NVVM MMA types"); + return ::mlir::success(); +} + +std::pair WMMAMmaOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range WMMAMmaOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range WMMAMmaOp::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange WMMAMmaOp::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair WMMAMmaOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WMMAMmaOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value WMMAMmaOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult WMMAMmaOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.eltypeA; + auto attr = dict.get("eltypeA"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for eltypeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `eltypeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.eltypeB; + auto attr = dict.get("eltypeB"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for eltypeB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `eltypeB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.k; + auto attr = dict.get("k"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for k in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `k` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.layoutA; + auto attr = dict.get("layoutA"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for layoutA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layoutA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.layoutB; + auto attr = dict.get("layoutB"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for layoutB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layoutB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.m; + auto attr = dict.get("m"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for m in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `m` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.n; + auto attr = dict.get("n"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for n in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `n` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute WMMAMmaOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.eltypeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("eltypeA", + propStorage)); + } + + { + const auto &propStorage = prop.eltypeB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("eltypeB", + propStorage)); + } + + { + const auto &propStorage = prop.k; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("k", + propStorage)); + } + + { + const auto &propStorage = prop.layoutA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layoutA", + propStorage)); + } + + { + const auto &propStorage = prop.layoutB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layoutB", + propStorage)); + } + + { + const auto &propStorage = prop.m; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("m", + propStorage)); + } + + { + const auto &propStorage = prop.n; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("n", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code WMMAMmaOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.eltypeA.getAsOpaquePointer()), + llvm::hash_value(prop.eltypeB.getAsOpaquePointer()), + llvm::hash_value(prop.k.getAsOpaquePointer()), + llvm::hash_value(prop.layoutA.getAsOpaquePointer()), + llvm::hash_value(prop.layoutB.getAsOpaquePointer()), + llvm::hash_value(prop.m.getAsOpaquePointer()), + llvm::hash_value(prop.n.getAsOpaquePointer())); +} + +std::optional WMMAMmaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "eltypeA") + return prop.eltypeA; + + if (name == "eltypeB") + return prop.eltypeB; + + if (name == "k") + return prop.k; + + if (name == "layoutA") + return prop.layoutA; + + if (name == "layoutB") + return prop.layoutB; + + if (name == "m") + return prop.m; + + if (name == "n") + return prop.n; + return std::nullopt; +} + +void WMMAMmaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "eltypeA") { + prop.eltypeA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "eltypeB") { + prop.eltypeB = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "k") { + prop.k = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "layoutA") { + prop.layoutA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "layoutB") { + prop.layoutB = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "m") { + prop.m = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "n") { + prop.n = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void WMMAMmaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.eltypeA) attrs.append("eltypeA", prop.eltypeA); + + if (prop.eltypeB) attrs.append("eltypeB", prop.eltypeB); + + if (prop.k) attrs.append("k", prop.k); + + if (prop.layoutA) attrs.append("layoutA", prop.layoutA); + + if (prop.layoutB) attrs.append("layoutB", prop.layoutB); + + if (prop.m) attrs.append("m", prop.m); + + if (prop.n) attrs.append("n", prop.n); +} + +::mlir::LogicalResult WMMAMmaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getEltypeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(attr, "eltypeA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getEltypeBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(attr, "eltypeB", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getKAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "k", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLayoutAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(attr, "layoutA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLayoutBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(attr, "layoutB", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "m", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "n", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WMMAMmaOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.eltypeA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.eltypeB))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.k))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.layoutA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.layoutB))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.m))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.n))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WMMAMmaOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.eltypeA); + writer.writeAttribute(prop.eltypeB); + writer.writeAttribute(prop.k); + writer.writeAttribute(prop.layoutA); + writer.writeAttribute(prop.layoutB); + writer.writeAttribute(prop.m); + writer.writeAttribute(prop.n); +} + +::mlir::IntegerAttr WMMAMmaOp::getMAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().m); +} + +uint32_t WMMAMmaOp::getM() { + auto attr = getMAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMAMmaOp::getNAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); +} + +uint32_t WMMAMmaOp::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMAMmaOp::getKAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().k); +} + +uint32_t WMMAMmaOp::getK() { + auto attr = getKAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::MMALayoutAttr WMMAMmaOp::getLayoutAAttr() { + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutA); +} + +::mlir::NVVM::MMALayout WMMAMmaOp::getLayoutA() { + auto attr = getLayoutAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMALayoutAttr WMMAMmaOp::getLayoutBAttr() { + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutB); +} + +::mlir::NVVM::MMALayout WMMAMmaOp::getLayoutB() { + auto attr = getLayoutBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr WMMAMmaOp::getEltypeAAttr() { + return ::llvm::cast<::mlir::NVVM::MMATypesAttr>(getProperties().eltypeA); +} + +::mlir::NVVM::MMATypes WMMAMmaOp::getEltypeA() { + auto attr = getEltypeAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr WMMAMmaOp::getEltypeBAttr() { + return ::llvm::cast<::mlir::NVVM::MMATypesAttr>(getProperties().eltypeB); +} + +::mlir::NVVM::MMATypes WMMAMmaOp::getEltypeB() { + auto attr = getEltypeBAttr(); + return attr.getValue(); +} + +void WMMAMmaOp::setMAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getMAttrName(), attr); +} + +void WMMAMmaOp::setM(uint32_t attrValue) { + (*this)->setAttr(getMAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMAMmaOp::setNAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getNAttrName(), attr); +} + +void WMMAMmaOp::setN(uint32_t attrValue) { + (*this)->setAttr(getNAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMAMmaOp::setKAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getKAttrName(), attr); +} + +void WMMAMmaOp::setK(uint32_t attrValue) { + (*this)->setAttr(getKAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMAMmaOp::setLayoutAAttr(::mlir::NVVM::MMALayoutAttr attr) { + (*this)->setAttr(getLayoutAAttrName(), attr); +} + +void WMMAMmaOp::setLayoutA(::mlir::NVVM::MMALayout attrValue) { + (*this)->setAttr(getLayoutAAttrName(), ::mlir::NVVM::MMALayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WMMAMmaOp::setLayoutBAttr(::mlir::NVVM::MMALayoutAttr attr) { + (*this)->setAttr(getLayoutBAttrName(), attr); +} + +void WMMAMmaOp::setLayoutB(::mlir::NVVM::MMALayout attrValue) { + (*this)->setAttr(getLayoutBAttrName(), ::mlir::NVVM::MMALayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WMMAMmaOp::setEltypeAAttr(::mlir::NVVM::MMATypesAttr attr) { + (*this)->setAttr(getEltypeAAttrName(), attr); +} + +void WMMAMmaOp::setEltypeA(::mlir::NVVM::MMATypes attrValue) { + (*this)->setAttr(getEltypeAAttrName(), ::mlir::NVVM::MMATypesAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WMMAMmaOp::setEltypeBAttr(::mlir::NVVM::MMATypesAttr attr) { + (*this)->setAttr(getEltypeBAttrName(), attr); +} + +void WMMAMmaOp::setEltypeB(::mlir::NVVM::MMATypes attrValue) { + (*this)->setAttr(getEltypeBAttrName(), ::mlir::NVVM::MMATypesAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WMMAMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, ::mlir::NVVM::MMATypesAttr eltypeA, ::mlir::NVVM::MMATypesAttr eltypeB, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().m = m; + odsState.getOrAddProperties().n = n; + odsState.getOrAddProperties().k = k; + odsState.getOrAddProperties().layoutA = layoutA; + odsState.getOrAddProperties().layoutB = layoutB; + odsState.getOrAddProperties().eltypeA = eltypeA; + odsState.getOrAddProperties().eltypeB = eltypeB; + odsState.addTypes(res); +} + +void WMMAMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, ::mlir::NVVM::MMATypesAttr eltypeA, ::mlir::NVVM::MMATypesAttr eltypeB, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().m = m; + odsState.getOrAddProperties().n = n; + odsState.getOrAddProperties().k = k; + odsState.getOrAddProperties().layoutA = layoutA; + odsState.getOrAddProperties().layoutB = layoutB; + odsState.getOrAddProperties().eltypeA = eltypeA; + odsState.getOrAddProperties().eltypeB = eltypeB; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WMMAMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, ::mlir::NVVM::MMATypes eltypeA, ::mlir::NVVM::MMATypes eltypeB, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m); + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); + odsState.getOrAddProperties().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k); + odsState.getOrAddProperties().layoutA = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutA); + odsState.getOrAddProperties().layoutB = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutB); + odsState.getOrAddProperties().eltypeA = ::mlir::NVVM::MMATypesAttr::get(odsBuilder.getContext(), eltypeA); + odsState.getOrAddProperties().eltypeB = ::mlir::NVVM::MMATypesAttr::get(odsBuilder.getContext(), eltypeB); + odsState.addTypes(res); +} + +void WMMAMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, ::mlir::NVVM::MMATypes eltypeA, ::mlir::NVVM::MMATypes eltypeB, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m); + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); + odsState.getOrAddProperties().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k); + odsState.getOrAddProperties().layoutA = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutA); + odsState.getOrAddProperties().layoutB = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutB); + odsState.getOrAddProperties().eltypeA = ::mlir::NVVM::MMATypesAttr::get(odsBuilder.getContext(), eltypeA); + odsState.getOrAddProperties().eltypeB = ::mlir::NVVM::MMATypesAttr::get(odsBuilder.getContext(), eltypeB); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WMMAMmaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WMMAMmaOp::verifyInvariantsImpl() { + auto tblgen_eltypeA = getProperties().eltypeA; (void)tblgen_eltypeA; + if (!tblgen_eltypeA) return emitOpError("requires attribute 'eltypeA'"); + auto tblgen_eltypeB = getProperties().eltypeB; (void)tblgen_eltypeB; + if (!tblgen_eltypeB) return emitOpError("requires attribute 'eltypeB'"); + auto tblgen_k = getProperties().k; (void)tblgen_k; + if (!tblgen_k) return emitOpError("requires attribute 'k'"); + auto tblgen_layoutA = getProperties().layoutA; (void)tblgen_layoutA; + if (!tblgen_layoutA) return emitOpError("requires attribute 'layoutA'"); + auto tblgen_layoutB = getProperties().layoutB; (void)tblgen_layoutB; + if (!tblgen_layoutB) return emitOpError("requires attribute 'layoutB'"); + auto tblgen_m = getProperties().m; (void)tblgen_m; + if (!tblgen_m) return emitOpError("requires attribute 'm'"); + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitOpError("requires attribute 'n'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_m, "m"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_n, "n"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_k, "k"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(*this, tblgen_layoutA, "layoutA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(*this, tblgen_layoutB, "layoutB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(*this, tblgen_eltypeA, "eltypeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(*this, tblgen_eltypeB, "eltypeB"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult WMMAMmaOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WMMAMmaOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WMMAMmaOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WMMAMmaOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WMMAStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WMMAStoreOpGenericAdaptorBase::WMMAStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.wmma.store", odsAttrs.getContext()); +} + +WMMAStoreOpGenericAdaptorBase::WMMAStoreOpGenericAdaptorBase(WMMAStoreOp op) : WMMAStoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WMMAStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr WMMAStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr WMMAStoreOpGenericAdaptorBase::getMAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().m); + return attr; +} + +uint32_t WMMAStoreOpGenericAdaptorBase::getM() { + auto attr = getMAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMAStoreOpGenericAdaptorBase::getNAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); + return attr; +} + +uint32_t WMMAStoreOpGenericAdaptorBase::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMAStoreOpGenericAdaptorBase::getKAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().k); + return attr; +} + +uint32_t WMMAStoreOpGenericAdaptorBase::getK() { + auto attr = getKAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::MMALayoutAttr WMMAStoreOpGenericAdaptorBase::getLayoutAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layout); + return attr; +} + +::mlir::NVVM::MMALayout WMMAStoreOpGenericAdaptorBase::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr WMMAStoreOpGenericAdaptorBase::getEltypeAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMATypesAttr>(getProperties().eltype); + return attr; +} + +::mlir::NVVM::MMATypes WMMAStoreOpGenericAdaptorBase::getEltype() { + auto attr = getEltypeAttr(); + return attr.getValue(); +} + +} // namespace detail +WMMAStoreOpAdaptor::WMMAStoreOpAdaptor(WMMAStoreOp op) : WMMAStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WMMAStoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_eltype = getProperties().eltype; (void)tblgen_eltype; + if (!tblgen_eltype) return emitError(loc, "'nvvm.wmma.store' op ""requires attribute 'eltype'"); + auto tblgen_k = getProperties().k; (void)tblgen_k; + if (!tblgen_k) return emitError(loc, "'nvvm.wmma.store' op ""requires attribute 'k'"); + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + if (!tblgen_layout) return emitError(loc, "'nvvm.wmma.store' op ""requires attribute 'layout'"); + auto tblgen_m = getProperties().m; (void)tblgen_m; + if (!tblgen_m) return emitError(loc, "'nvvm.wmma.store' op ""requires attribute 'm'"); + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitError(loc, "'nvvm.wmma.store' op ""requires attribute 'n'"); + + if (tblgen_m && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wmma.store' op ""attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_n && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wmma.store' op ""attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_k && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wmma.store' op ""attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_layout && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(tblgen_layout)))) + return emitError(loc, "'nvvm.wmma.store' op ""attribute 'layout' failed to satisfy constraint: NVVM MMA layout"); + + if (tblgen_eltype && !((::llvm::isa<::mlir::NVVM::MMATypesAttr>(tblgen_eltype)))) + return emitError(loc, "'nvvm.wmma.store' op ""attribute 'eltype' failed to satisfy constraint: NVVM MMA types"); + return ::mlir::success(); +} + +std::pair WMMAStoreOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range WMMAStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> WMMAStoreOp::getPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range WMMAStoreOp::getArgs() { + return getODSOperands(1); +} + +::mlir::TypedValue<::mlir::IntegerType> WMMAStoreOp::getStride() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &WMMAStoreOp::getPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange WMMAStoreOp::getArgsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &WMMAStoreOp::getStrideMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair WMMAStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WMMAStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult WMMAStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.eltype; + auto attr = dict.get("eltype"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for eltype in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `eltype` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.k; + auto attr = dict.get("k"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for k in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `k` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.layout; + auto attr = dict.get("layout"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for layout in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layout` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.m; + auto attr = dict.get("m"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for m in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `m` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.n; + auto attr = dict.get("n"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for n in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `n` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute WMMAStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.eltype; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("eltype", + propStorage)); + } + + { + const auto &propStorage = prop.k; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("k", + propStorage)); + } + + { + const auto &propStorage = prop.layout; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layout", + propStorage)); + } + + { + const auto &propStorage = prop.m; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("m", + propStorage)); + } + + { + const auto &propStorage = prop.n; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("n", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code WMMAStoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.eltype.getAsOpaquePointer()), + llvm::hash_value(prop.k.getAsOpaquePointer()), + llvm::hash_value(prop.layout.getAsOpaquePointer()), + llvm::hash_value(prop.m.getAsOpaquePointer()), + llvm::hash_value(prop.n.getAsOpaquePointer())); +} + +std::optional WMMAStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "eltype") + return prop.eltype; + + if (name == "k") + return prop.k; + + if (name == "layout") + return prop.layout; + + if (name == "m") + return prop.m; + + if (name == "n") + return prop.n; + return std::nullopt; +} + +void WMMAStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "eltype") { + prop.eltype = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "k") { + prop.k = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "layout") { + prop.layout = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "m") { + prop.m = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "n") { + prop.n = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void WMMAStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.eltype) attrs.append("eltype", prop.eltype); + + if (prop.k) attrs.append("k", prop.k); + + if (prop.layout) attrs.append("layout", prop.layout); + + if (prop.m) attrs.append("m", prop.m); + + if (prop.n) attrs.append("n", prop.n); +} + +::mlir::LogicalResult WMMAStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getEltypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(attr, "eltype", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getKAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "k", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLayoutAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(attr, "layout", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "m", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "n", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WMMAStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.eltype))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.k))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.layout))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.m))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.n))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WMMAStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.eltype); + writer.writeAttribute(prop.k); + writer.writeAttribute(prop.layout); + writer.writeAttribute(prop.m); + writer.writeAttribute(prop.n); +} + +::mlir::IntegerAttr WMMAStoreOp::getMAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().m); +} + +uint32_t WMMAStoreOp::getM() { + auto attr = getMAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMAStoreOp::getNAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().n); +} + +uint32_t WMMAStoreOp::getN() { + auto attr = getNAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::IntegerAttr WMMAStoreOp::getKAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().k); +} + +uint32_t WMMAStoreOp::getK() { + auto attr = getKAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::NVVM::MMALayoutAttr WMMAStoreOp::getLayoutAttr() { + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layout); +} + +::mlir::NVVM::MMALayout WMMAStoreOp::getLayout() { + auto attr = getLayoutAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMATypesAttr WMMAStoreOp::getEltypeAttr() { + return ::llvm::cast<::mlir::NVVM::MMATypesAttr>(getProperties().eltype); +} + +::mlir::NVVM::MMATypes WMMAStoreOp::getEltype() { + auto attr = getEltypeAttr(); + return attr.getValue(); +} + +void WMMAStoreOp::setMAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getMAttrName(), attr); +} + +void WMMAStoreOp::setM(uint32_t attrValue) { + (*this)->setAttr(getMAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMAStoreOp::setNAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getNAttrName(), attr); +} + +void WMMAStoreOp::setN(uint32_t attrValue) { + (*this)->setAttr(getNAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMAStoreOp::setKAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getKAttrName(), attr); +} + +void WMMAStoreOp::setK(uint32_t attrValue) { + (*this)->setAttr(getKAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WMMAStoreOp::setLayoutAttr(::mlir::NVVM::MMALayoutAttr attr) { + (*this)->setAttr(getLayoutAttrName(), attr); +} + +void WMMAStoreOp::setLayout(::mlir::NVVM::MMALayout attrValue) { + (*this)->setAttr(getLayoutAttrName(), ::mlir::NVVM::MMALayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WMMAStoreOp::setEltypeAttr(::mlir::NVVM::MMATypesAttr attr) { + (*this)->setAttr(getEltypeAttrName(), attr); +} + +void WMMAStoreOp::setEltype(::mlir::NVVM::MMATypes attrValue) { + (*this)->setAttr(getEltypeAttrName(), ::mlir::NVVM::MMATypesAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WMMAStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layout, ::mlir::NVVM::MMATypesAttr eltype, ::mlir::ValueRange args, ::mlir::Value stride) { + odsState.addOperands(ptr); + odsState.addOperands(args); + odsState.addOperands(stride); + odsState.getOrAddProperties().m = m; + odsState.getOrAddProperties().n = n; + odsState.getOrAddProperties().k = k; + odsState.getOrAddProperties().layout = layout; + odsState.getOrAddProperties().eltype = eltype; +} + +void WMMAStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layout, ::mlir::NVVM::MMATypesAttr eltype, ::mlir::ValueRange args, ::mlir::Value stride) { + odsState.addOperands(ptr); + odsState.addOperands(args); + odsState.addOperands(stride); + odsState.getOrAddProperties().m = m; + odsState.getOrAddProperties().n = n; + odsState.getOrAddProperties().k = k; + odsState.getOrAddProperties().layout = layout; + odsState.getOrAddProperties().eltype = eltype; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WMMAStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layout, ::mlir::NVVM::MMATypes eltype, ::mlir::ValueRange args, ::mlir::Value stride) { + odsState.addOperands(ptr); + odsState.addOperands(args); + odsState.addOperands(stride); + odsState.getOrAddProperties().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m); + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); + odsState.getOrAddProperties().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k); + odsState.getOrAddProperties().layout = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layout); + odsState.getOrAddProperties().eltype = ::mlir::NVVM::MMATypesAttr::get(odsBuilder.getContext(), eltype); +} + +void WMMAStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layout, ::mlir::NVVM::MMATypes eltype, ::mlir::ValueRange args, ::mlir::Value stride) { + odsState.addOperands(ptr); + odsState.addOperands(args); + odsState.addOperands(stride); + odsState.getOrAddProperties().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m); + odsState.getOrAddProperties().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n); + odsState.getOrAddProperties().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k); + odsState.getOrAddProperties().layout = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layout); + odsState.getOrAddProperties().eltype = ::mlir::NVVM::MMATypesAttr::get(odsBuilder.getContext(), eltype); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WMMAStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WMMAStoreOp::verifyInvariantsImpl() { + auto tblgen_eltype = getProperties().eltype; (void)tblgen_eltype; + if (!tblgen_eltype) return emitOpError("requires attribute 'eltype'"); + auto tblgen_k = getProperties().k; (void)tblgen_k; + if (!tblgen_k) return emitOpError("requires attribute 'k'"); + auto tblgen_layout = getProperties().layout; (void)tblgen_layout; + if (!tblgen_layout) return emitOpError("requires attribute 'layout'"); + auto tblgen_m = getProperties().m; (void)tblgen_m; + if (!tblgen_m) return emitOpError("requires attribute 'm'"); + auto tblgen_n = getProperties().n; (void)tblgen_n; + if (!tblgen_n) return emitOpError("requires attribute 'n'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_m, "m"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_n, "n"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_k, "k"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(*this, tblgen_layout, "layout"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps6(*this, tblgen_eltype, "eltype"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult WMMAStoreOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WMMAStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand ptrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ptrOperands(ptrRawOperands); ::llvm::SMLoc ptrOperandsLoc; + (void)ptrOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand strideRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> strideOperands(strideRawOperands); ::llvm::SMLoc strideOperandsLoc; + (void)strideOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::mlir::Type ptrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> ptrTypes(ptrRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> argsTypes; + + ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ptrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + strideOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(strideRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseType(ptrRawTypes[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseTypeList(argsTypes)) + return ::mlir::failure(); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(ptrOperands, ptrTypes, ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(strideOperands, odsBuildableType0, strideOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WMMAStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getPtr(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getStride(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getPtr().getType(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getArgs().getTypes(); +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WMMAStoreOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WarpSizeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WarpSizeOpGenericAdaptorBase::WarpSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.read.ptx.sreg.warpsize", odsAttrs.getContext()); +} + +WarpSizeOpGenericAdaptorBase::WarpSizeOpGenericAdaptorBase(WarpSizeOp op) : WarpSizeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WarpSizeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr WarpSizeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +WarpSizeOpAdaptor::WarpSizeOpAdaptor(WarpSizeOp op) : WarpSizeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WarpSizeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair WarpSizeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range WarpSizeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair WarpSizeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WarpSizeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value WarpSizeOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void WarpSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void WarpSizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WarpSizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WarpSizeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult WarpSizeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult WarpSizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void WarpSizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void WarpSizeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WarpSizeOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WgmmaFenceAlignedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WgmmaFenceAlignedOpGenericAdaptorBase::WgmmaFenceAlignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.wgmma.fence.aligned", odsAttrs.getContext()); +} + +WgmmaFenceAlignedOpGenericAdaptorBase::WgmmaFenceAlignedOpGenericAdaptorBase(WgmmaFenceAlignedOp op) : WgmmaFenceAlignedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WgmmaFenceAlignedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr WgmmaFenceAlignedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +WgmmaFenceAlignedOpAdaptor::WgmmaFenceAlignedOpAdaptor(WgmmaFenceAlignedOp op) : WgmmaFenceAlignedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WgmmaFenceAlignedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair WgmmaFenceAlignedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range WgmmaFenceAlignedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair WgmmaFenceAlignedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WgmmaFenceAlignedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void WgmmaFenceAlignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void WgmmaFenceAlignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WgmmaFenceAlignedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WgmmaFenceAlignedOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult WgmmaFenceAlignedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult WgmmaFenceAlignedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void WgmmaFenceAlignedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +std::string WgmmaFenceAlignedOp::getPtx() { return std::string("wgmma.fence.sync.aligned;"); } +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WgmmaFenceAlignedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WgmmaGroupSyncAlignedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WgmmaGroupSyncAlignedOpGenericAdaptorBase::WgmmaGroupSyncAlignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.wgmma.commit.group.sync.aligned", odsAttrs.getContext()); +} + +WgmmaGroupSyncAlignedOpGenericAdaptorBase::WgmmaGroupSyncAlignedOpGenericAdaptorBase(WgmmaGroupSyncAlignedOp op) : WgmmaGroupSyncAlignedOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WgmmaGroupSyncAlignedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr WgmmaGroupSyncAlignedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +WgmmaGroupSyncAlignedOpAdaptor::WgmmaGroupSyncAlignedOpAdaptor(WgmmaGroupSyncAlignedOp op) : WgmmaGroupSyncAlignedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WgmmaGroupSyncAlignedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair WgmmaGroupSyncAlignedOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range WgmmaGroupSyncAlignedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair WgmmaGroupSyncAlignedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WgmmaGroupSyncAlignedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void WgmmaGroupSyncAlignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void WgmmaGroupSyncAlignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WgmmaGroupSyncAlignedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WgmmaGroupSyncAlignedOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult WgmmaGroupSyncAlignedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult WgmmaGroupSyncAlignedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void WgmmaGroupSyncAlignedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +std::string WgmmaGroupSyncAlignedOp::getPtx() { return std::string("wgmma.commit_group.sync.aligned;"); } +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WgmmaGroupSyncAlignedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WgmmaMmaAsyncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WgmmaMmaAsyncOpGenericAdaptorBase::WgmmaMmaAsyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.wgmma.mma_async", odsAttrs.getContext()); +} + +WgmmaMmaAsyncOpGenericAdaptorBase::WgmmaMmaAsyncOpGenericAdaptorBase(WgmmaMmaAsyncOp op) : WgmmaMmaAsyncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WgmmaMmaAsyncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr WgmmaMmaAsyncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::NVVM::MMAShapeAttr WgmmaMmaAsyncOpGenericAdaptorBase::getShapeAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(getProperties().shape); + return attr; +} + +::mlir::NVVM::MMAShapeAttr WgmmaMmaAsyncOpGenericAdaptorBase::getShape() { + auto attr = getShapeAttr(); + return ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(attr); +} + +::mlir::NVVM::WGMMATypesAttr WgmmaMmaAsyncOpGenericAdaptorBase::getTypeAAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::WGMMATypesAttr>(getProperties().typeA); + return attr; +} + +::mlir::NVVM::WGMMATypes WgmmaMmaAsyncOpGenericAdaptorBase::getTypeA() { + auto attr = getTypeAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::WGMMATypesAttr WgmmaMmaAsyncOpGenericAdaptorBase::getTypeBAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::WGMMATypesAttr>(getProperties().typeB); + return attr; +} + +::mlir::NVVM::WGMMATypes WgmmaMmaAsyncOpGenericAdaptorBase::getTypeB() { + auto attr = getTypeBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::WGMMAScaleOutAttr WgmmaMmaAsyncOpGenericAdaptorBase::getScaleDAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::WGMMAScaleOutAttr>(getProperties().scaleD); + return attr; +} + +::mlir::NVVM::WGMMAScaleOut WgmmaMmaAsyncOpGenericAdaptorBase::getScaleD() { + auto attr = getScaleDAttr(); + return attr.getValue(); +} + +::mlir::NVVM::WGMMAScaleInAttr WgmmaMmaAsyncOpGenericAdaptorBase::getScaleAAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::WGMMAScaleInAttr>(getProperties().scaleA); + return attr; +} + +::mlir::NVVM::WGMMAScaleIn WgmmaMmaAsyncOpGenericAdaptorBase::getScaleA() { + auto attr = getScaleAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::WGMMAScaleInAttr WgmmaMmaAsyncOpGenericAdaptorBase::getScaleBAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::WGMMAScaleInAttr>(getProperties().scaleB); + return attr; +} + +::mlir::NVVM::WGMMAScaleIn WgmmaMmaAsyncOpGenericAdaptorBase::getScaleB() { + auto attr = getScaleBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMALayoutAttr WgmmaMmaAsyncOpGenericAdaptorBase::getLayoutAAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutA); + return attr; +} + +::mlir::NVVM::MMALayout WgmmaMmaAsyncOpGenericAdaptorBase::getLayoutA() { + auto attr = getLayoutAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMALayoutAttr WgmmaMmaAsyncOpGenericAdaptorBase::getLayoutBAttr() { + auto attr = ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutB); + return attr; +} + +::mlir::NVVM::MMALayout WgmmaMmaAsyncOpGenericAdaptorBase::getLayoutB() { + auto attr = getLayoutBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMAIntOverflowAttr WgmmaMmaAsyncOpGenericAdaptorBase::getSatfiniteAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::NVVM::MMAIntOverflowAttr>(getProperties().satfinite); + return attr; +} + +::std::optional<::mlir::NVVM::MMAIntOverflow> WgmmaMmaAsyncOpGenericAdaptorBase::getSatfinite() { + auto attr = getSatfiniteAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMAIntOverflow>(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +WgmmaMmaAsyncOpAdaptor::WgmmaMmaAsyncOpAdaptor(WgmmaMmaAsyncOp op) : WgmmaMmaAsyncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WgmmaMmaAsyncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_layoutA = getProperties().layoutA; (void)tblgen_layoutA; + if (!tblgen_layoutA) return emitError(loc, "'nvvm.wgmma.mma_async' op ""requires attribute 'layoutA'"); + auto tblgen_layoutB = getProperties().layoutB; (void)tblgen_layoutB; + if (!tblgen_layoutB) return emitError(loc, "'nvvm.wgmma.mma_async' op ""requires attribute 'layoutB'"); + auto tblgen_satfinite = getProperties().satfinite; (void)tblgen_satfinite; + auto tblgen_scaleA = getProperties().scaleA; (void)tblgen_scaleA; + if (!tblgen_scaleA) return emitError(loc, "'nvvm.wgmma.mma_async' op ""requires attribute 'scaleA'"); + auto tblgen_scaleB = getProperties().scaleB; (void)tblgen_scaleB; + if (!tblgen_scaleB) return emitError(loc, "'nvvm.wgmma.mma_async' op ""requires attribute 'scaleB'"); + auto tblgen_scaleD = getProperties().scaleD; (void)tblgen_scaleD; + if (!tblgen_scaleD) return emitError(loc, "'nvvm.wgmma.mma_async' op ""requires attribute 'scaleD'"); + auto tblgen_shape = getProperties().shape; (void)tblgen_shape; + if (!tblgen_shape) return emitError(loc, "'nvvm.wgmma.mma_async' op ""requires attribute 'shape'"); + auto tblgen_typeA = getProperties().typeA; (void)tblgen_typeA; + if (!tblgen_typeA) return emitError(loc, "'nvvm.wgmma.mma_async' op ""requires attribute 'typeA'"); + auto tblgen_typeB = getProperties().typeB; (void)tblgen_typeB; + if (!tblgen_typeB) return emitError(loc, "'nvvm.wgmma.mma_async' op ""requires attribute 'typeB'"); + + if (tblgen_shape && !((::llvm::isa<::mlir::NVVM::MMAShapeAttr>(tblgen_shape)))) + return emitError(loc, "'nvvm.wgmma.mma_async' op ""attribute 'shape' failed to satisfy constraint: Attribute for MMA operation shape."); + + if (tblgen_typeA && !((::llvm::isa<::mlir::NVVM::WGMMATypesAttr>(tblgen_typeA)))) + return emitError(loc, "'nvvm.wgmma.mma_async' op ""attribute 'typeA' failed to satisfy constraint: NVVM WGMMA types"); + + if (tblgen_typeB && !((::llvm::isa<::mlir::NVVM::WGMMATypesAttr>(tblgen_typeB)))) + return emitError(loc, "'nvvm.wgmma.mma_async' op ""attribute 'typeB' failed to satisfy constraint: NVVM WGMMA types"); + + if (tblgen_scaleD && !((::llvm::isa<::mlir::NVVM::WGMMAScaleOutAttr>(tblgen_scaleD)))) + return emitError(loc, "'nvvm.wgmma.mma_async' op ""attribute 'scaleD' failed to satisfy constraint: WGMMA input predicate"); + + if (tblgen_scaleA && !((::llvm::isa<::mlir::NVVM::WGMMAScaleInAttr>(tblgen_scaleA)))) + return emitError(loc, "'nvvm.wgmma.mma_async' op ""attribute 'scaleA' failed to satisfy constraint: WGMMA overflow options"); + + if (tblgen_scaleB && !((::llvm::isa<::mlir::NVVM::WGMMAScaleInAttr>(tblgen_scaleB)))) + return emitError(loc, "'nvvm.wgmma.mma_async' op ""attribute 'scaleB' failed to satisfy constraint: WGMMA overflow options"); + + if (tblgen_layoutA && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(tblgen_layoutA)))) + return emitError(loc, "'nvvm.wgmma.mma_async' op ""attribute 'layoutA' failed to satisfy constraint: NVVM MMA layout"); + + if (tblgen_layoutB && !((::llvm::isa<::mlir::NVVM::MMALayoutAttr>(tblgen_layoutB)))) + return emitError(loc, "'nvvm.wgmma.mma_async' op ""attribute 'layoutB' failed to satisfy constraint: NVVM MMA layout"); + + if (tblgen_satfinite && !((::llvm::isa<::mlir::NVVM::MMAIntOverflowAttr>(tblgen_satfinite)))) + return emitError(loc, "'nvvm.wgmma.mma_async' op ""attribute 'satfinite' failed to satisfy constraint: MMA overflow options"); + return ::mlir::success(); +} + +std::pair WgmmaMmaAsyncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range WgmmaMmaAsyncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value WgmmaMmaAsyncOp::getInouts() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> WgmmaMmaAsyncOp::getDescriptorA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> WgmmaMmaAsyncOp::getDescriptorB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &WgmmaMmaAsyncOp::getInoutsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &WgmmaMmaAsyncOp::getDescriptorAMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &WgmmaMmaAsyncOp::getDescriptorBMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair WgmmaMmaAsyncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WgmmaMmaAsyncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value WgmmaMmaAsyncOp::getResults() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult WgmmaMmaAsyncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.layoutA; + auto attr = dict.get("layoutA"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for layoutA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layoutA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.layoutB; + auto attr = dict.get("layoutB"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for layoutB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `layoutB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.satfinite; + auto attr = dict.get("satfinite"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for satfinite in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `satfinite` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.scaleA; + auto attr = dict.get("scaleA"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for scaleA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `scaleA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.scaleB; + auto attr = dict.get("scaleB"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for scaleB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `scaleB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.scaleD; + auto attr = dict.get("scaleD"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for scaleD in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `scaleD` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.shape; + auto attr = dict.get("shape"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for shape in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `shape` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.typeA; + auto attr = dict.get("typeA"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for typeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `typeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.typeB; + auto attr = dict.get("typeB"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for typeB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `typeB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute WgmmaMmaAsyncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.layoutA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layoutA", + propStorage)); + } + + { + const auto &propStorage = prop.layoutB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("layoutB", + propStorage)); + } + + { + const auto &propStorage = prop.satfinite; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("satfinite", + propStorage)); + } + + { + const auto &propStorage = prop.scaleA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("scaleA", + propStorage)); + } + + { + const auto &propStorage = prop.scaleB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("scaleB", + propStorage)); + } + + { + const auto &propStorage = prop.scaleD; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("scaleD", + propStorage)); + } + + { + const auto &propStorage = prop.shape; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("shape", + propStorage)); + } + + { + const auto &propStorage = prop.typeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("typeA", + propStorage)); + } + + { + const auto &propStorage = prop.typeB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("typeB", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code WgmmaMmaAsyncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.layoutA.getAsOpaquePointer()), + llvm::hash_value(prop.layoutB.getAsOpaquePointer()), + llvm::hash_value(prop.satfinite.getAsOpaquePointer()), + llvm::hash_value(prop.scaleA.getAsOpaquePointer()), + llvm::hash_value(prop.scaleB.getAsOpaquePointer()), + llvm::hash_value(prop.scaleD.getAsOpaquePointer()), + llvm::hash_value(prop.shape.getAsOpaquePointer()), + llvm::hash_value(prop.typeA.getAsOpaquePointer()), + llvm::hash_value(prop.typeB.getAsOpaquePointer())); +} + +std::optional WgmmaMmaAsyncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "layoutA") + return prop.layoutA; + + if (name == "layoutB") + return prop.layoutB; + + if (name == "satfinite") + return prop.satfinite; + + if (name == "scaleA") + return prop.scaleA; + + if (name == "scaleB") + return prop.scaleB; + + if (name == "scaleD") + return prop.scaleD; + + if (name == "shape") + return prop.shape; + + if (name == "typeA") + return prop.typeA; + + if (name == "typeB") + return prop.typeB; + return std::nullopt; +} + +void WgmmaMmaAsyncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "layoutA") { + prop.layoutA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "layoutB") { + prop.layoutB = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "satfinite") { + prop.satfinite = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "scaleA") { + prop.scaleA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "scaleB") { + prop.scaleB = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "scaleD") { + prop.scaleD = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "shape") { + prop.shape = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "typeA") { + prop.typeA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "typeB") { + prop.typeB = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void WgmmaMmaAsyncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.layoutA) attrs.append("layoutA", prop.layoutA); + + if (prop.layoutB) attrs.append("layoutB", prop.layoutB); + + if (prop.satfinite) attrs.append("satfinite", prop.satfinite); + + if (prop.scaleA) attrs.append("scaleA", prop.scaleA); + + if (prop.scaleB) attrs.append("scaleB", prop.scaleB); + + if (prop.scaleD) attrs.append("scaleD", prop.scaleD); + + if (prop.shape) attrs.append("shape", prop.shape); + + if (prop.typeA) attrs.append("typeA", prop.typeA); + + if (prop.typeB) attrs.append("typeB", prop.typeB); +} + +::mlir::LogicalResult WgmmaMmaAsyncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getLayoutAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(attr, "layoutA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLayoutBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(attr, "layoutB", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSatfiniteAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps5(attr, "satfinite", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getScaleAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps13(attr, "scaleA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getScaleBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps13(attr, "scaleB", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getScaleDAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps12(attr, "scaleD", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getShapeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps3(attr, "shape", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTypeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps11(attr, "typeA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTypeBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps11(attr, "typeB", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WgmmaMmaAsyncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.layoutA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.layoutB))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.satfinite))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.scaleA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.scaleB))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.scaleD))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.shape))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.typeA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.typeB))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WgmmaMmaAsyncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.layoutA); + writer.writeAttribute(prop.layoutB); + + writer.writeOptionalAttribute(prop.satfinite); + writer.writeAttribute(prop.scaleA); + writer.writeAttribute(prop.scaleB); + writer.writeAttribute(prop.scaleD); + writer.writeAttribute(prop.shape); + writer.writeAttribute(prop.typeA); + writer.writeAttribute(prop.typeB); +} + +::mlir::NVVM::MMAShapeAttr WgmmaMmaAsyncOp::getShapeAttr() { + return ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(getProperties().shape); +} + +::mlir::NVVM::MMAShapeAttr WgmmaMmaAsyncOp::getShape() { + auto attr = getShapeAttr(); + return ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(attr); +} + +::mlir::NVVM::WGMMATypesAttr WgmmaMmaAsyncOp::getTypeAAttr() { + return ::llvm::cast<::mlir::NVVM::WGMMATypesAttr>(getProperties().typeA); +} + +::mlir::NVVM::WGMMATypes WgmmaMmaAsyncOp::getTypeA() { + auto attr = getTypeAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::WGMMATypesAttr WgmmaMmaAsyncOp::getTypeBAttr() { + return ::llvm::cast<::mlir::NVVM::WGMMATypesAttr>(getProperties().typeB); +} + +::mlir::NVVM::WGMMATypes WgmmaMmaAsyncOp::getTypeB() { + auto attr = getTypeBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::WGMMAScaleOutAttr WgmmaMmaAsyncOp::getScaleDAttr() { + return ::llvm::cast<::mlir::NVVM::WGMMAScaleOutAttr>(getProperties().scaleD); +} + +::mlir::NVVM::WGMMAScaleOut WgmmaMmaAsyncOp::getScaleD() { + auto attr = getScaleDAttr(); + return attr.getValue(); +} + +::mlir::NVVM::WGMMAScaleInAttr WgmmaMmaAsyncOp::getScaleAAttr() { + return ::llvm::cast<::mlir::NVVM::WGMMAScaleInAttr>(getProperties().scaleA); +} + +::mlir::NVVM::WGMMAScaleIn WgmmaMmaAsyncOp::getScaleA() { + auto attr = getScaleAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::WGMMAScaleInAttr WgmmaMmaAsyncOp::getScaleBAttr() { + return ::llvm::cast<::mlir::NVVM::WGMMAScaleInAttr>(getProperties().scaleB); +} + +::mlir::NVVM::WGMMAScaleIn WgmmaMmaAsyncOp::getScaleB() { + auto attr = getScaleBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMALayoutAttr WgmmaMmaAsyncOp::getLayoutAAttr() { + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutA); +} + +::mlir::NVVM::MMALayout WgmmaMmaAsyncOp::getLayoutA() { + auto attr = getLayoutAAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMALayoutAttr WgmmaMmaAsyncOp::getLayoutBAttr() { + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(getProperties().layoutB); +} + +::mlir::NVVM::MMALayout WgmmaMmaAsyncOp::getLayoutB() { + auto attr = getLayoutBAttr(); + return attr.getValue(); +} + +::mlir::NVVM::MMAIntOverflowAttr WgmmaMmaAsyncOp::getSatfiniteAttr() { + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMAIntOverflowAttr>(getProperties().satfinite); +} + +::std::optional<::mlir::NVVM::MMAIntOverflow> WgmmaMmaAsyncOp::getSatfinite() { + auto attr = getSatfiniteAttr(); + return attr ? ::std::optional<::mlir::NVVM::MMAIntOverflow>(attr.getValue()) : (::std::nullopt); +} + +void WgmmaMmaAsyncOp::setShapeAttr(::mlir::NVVM::MMAShapeAttr attr) { + (*this)->setAttr(getShapeAttrName(), attr); +} + +void WgmmaMmaAsyncOp::setTypeAAttr(::mlir::NVVM::WGMMATypesAttr attr) { + (*this)->setAttr(getTypeAAttrName(), attr); +} + +void WgmmaMmaAsyncOp::setTypeA(::mlir::NVVM::WGMMATypes attrValue) { + (*this)->setAttr(getTypeAAttrName(), ::mlir::NVVM::WGMMATypesAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WgmmaMmaAsyncOp::setTypeBAttr(::mlir::NVVM::WGMMATypesAttr attr) { + (*this)->setAttr(getTypeBAttrName(), attr); +} + +void WgmmaMmaAsyncOp::setTypeB(::mlir::NVVM::WGMMATypes attrValue) { + (*this)->setAttr(getTypeBAttrName(), ::mlir::NVVM::WGMMATypesAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WgmmaMmaAsyncOp::setScaleDAttr(::mlir::NVVM::WGMMAScaleOutAttr attr) { + (*this)->setAttr(getScaleDAttrName(), attr); +} + +void WgmmaMmaAsyncOp::setScaleD(::mlir::NVVM::WGMMAScaleOut attrValue) { + (*this)->setAttr(getScaleDAttrName(), ::mlir::NVVM::WGMMAScaleOutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WgmmaMmaAsyncOp::setScaleAAttr(::mlir::NVVM::WGMMAScaleInAttr attr) { + (*this)->setAttr(getScaleAAttrName(), attr); +} + +void WgmmaMmaAsyncOp::setScaleA(::mlir::NVVM::WGMMAScaleIn attrValue) { + (*this)->setAttr(getScaleAAttrName(), ::mlir::NVVM::WGMMAScaleInAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WgmmaMmaAsyncOp::setScaleBAttr(::mlir::NVVM::WGMMAScaleInAttr attr) { + (*this)->setAttr(getScaleBAttrName(), attr); +} + +void WgmmaMmaAsyncOp::setScaleB(::mlir::NVVM::WGMMAScaleIn attrValue) { + (*this)->setAttr(getScaleBAttrName(), ::mlir::NVVM::WGMMAScaleInAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WgmmaMmaAsyncOp::setLayoutAAttr(::mlir::NVVM::MMALayoutAttr attr) { + (*this)->setAttr(getLayoutAAttrName(), attr); +} + +void WgmmaMmaAsyncOp::setLayoutA(::mlir::NVVM::MMALayout attrValue) { + (*this)->setAttr(getLayoutAAttrName(), ::mlir::NVVM::MMALayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WgmmaMmaAsyncOp::setLayoutBAttr(::mlir::NVVM::MMALayoutAttr attr) { + (*this)->setAttr(getLayoutBAttrName(), attr); +} + +void WgmmaMmaAsyncOp::setLayoutB(::mlir::NVVM::MMALayout attrValue) { + (*this)->setAttr(getLayoutBAttrName(), ::mlir::NVVM::MMALayoutAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void WgmmaMmaAsyncOp::setSatfiniteAttr(::mlir::NVVM::MMAIntOverflowAttr attr) { + (*this)->setAttr(getSatfiniteAttrName(), attr); +} + +void WgmmaMmaAsyncOp::setSatfinite(::std::optional<::mlir::NVVM::MMAIntOverflow> attrValue) { + if (attrValue) + return (*this)->setAttr(getSatfiniteAttrName(), ::mlir::NVVM::MMAIntOverflowAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getSatfiniteAttrName()); +} + +::mlir::Attribute WgmmaMmaAsyncOp::removeSatfiniteAttr() { + auto &attr = getProperties().satfinite; + attr = {}; + return attr; +} + +void WgmmaMmaAsyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type results, ::mlir::Value inouts, ::mlir::Value descriptorA, ::mlir::Value descriptorB, ::mlir::NVVM::MMAShapeAttr shape, ::mlir::NVVM::WGMMATypesAttr typeA, ::mlir::NVVM::WGMMATypesAttr typeB, ::mlir::NVVM::WGMMAScaleOutAttr scaleD, ::mlir::NVVM::WGMMAScaleInAttr scaleA, ::mlir::NVVM::WGMMAScaleInAttr scaleB, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, /*optional*/::mlir::NVVM::MMAIntOverflowAttr satfinite) { + odsState.addOperands(inouts); + odsState.addOperands(descriptorA); + odsState.addOperands(descriptorB); + odsState.getOrAddProperties().shape = shape; + odsState.getOrAddProperties().typeA = typeA; + odsState.getOrAddProperties().typeB = typeB; + odsState.getOrAddProperties().scaleD = scaleD; + odsState.getOrAddProperties().scaleA = scaleA; + odsState.getOrAddProperties().scaleB = scaleB; + odsState.getOrAddProperties().layoutA = layoutA; + odsState.getOrAddProperties().layoutB = layoutB; + if (satfinite) { + odsState.getOrAddProperties().satfinite = satfinite; + } + odsState.addTypes(results); +} + +void WgmmaMmaAsyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inouts, ::mlir::Value descriptorA, ::mlir::Value descriptorB, ::mlir::NVVM::MMAShapeAttr shape, ::mlir::NVVM::WGMMATypesAttr typeA, ::mlir::NVVM::WGMMATypesAttr typeB, ::mlir::NVVM::WGMMAScaleOutAttr scaleD, ::mlir::NVVM::WGMMAScaleInAttr scaleA, ::mlir::NVVM::WGMMAScaleInAttr scaleB, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, /*optional*/::mlir::NVVM::MMAIntOverflowAttr satfinite) { + odsState.addOperands(inouts); + odsState.addOperands(descriptorA); + odsState.addOperands(descriptorB); + odsState.getOrAddProperties().shape = shape; + odsState.getOrAddProperties().typeA = typeA; + odsState.getOrAddProperties().typeB = typeB; + odsState.getOrAddProperties().scaleD = scaleD; + odsState.getOrAddProperties().scaleA = scaleA; + odsState.getOrAddProperties().scaleB = scaleB; + odsState.getOrAddProperties().layoutA = layoutA; + odsState.getOrAddProperties().layoutB = layoutB; + if (satfinite) { + odsState.getOrAddProperties().satfinite = satfinite; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WgmmaMmaAsyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type results, ::mlir::Value inouts, ::mlir::Value descriptorA, ::mlir::Value descriptorB, ::mlir::NVVM::MMAShapeAttr shape, ::mlir::NVVM::WGMMATypes typeA, ::mlir::NVVM::WGMMATypes typeB, ::mlir::NVVM::WGMMAScaleOut scaleD, ::mlir::NVVM::WGMMAScaleIn scaleA, ::mlir::NVVM::WGMMAScaleIn scaleB, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, /*optional*/::mlir::NVVM::MMAIntOverflowAttr satfinite) { + odsState.addOperands(inouts); + odsState.addOperands(descriptorA); + odsState.addOperands(descriptorB); + odsState.getOrAddProperties().shape = shape; + odsState.getOrAddProperties().typeA = ::mlir::NVVM::WGMMATypesAttr::get(odsBuilder.getContext(), typeA); + odsState.getOrAddProperties().typeB = ::mlir::NVVM::WGMMATypesAttr::get(odsBuilder.getContext(), typeB); + odsState.getOrAddProperties().scaleD = ::mlir::NVVM::WGMMAScaleOutAttr::get(odsBuilder.getContext(), scaleD); + odsState.getOrAddProperties().scaleA = ::mlir::NVVM::WGMMAScaleInAttr::get(odsBuilder.getContext(), scaleA); + odsState.getOrAddProperties().scaleB = ::mlir::NVVM::WGMMAScaleInAttr::get(odsBuilder.getContext(), scaleB); + odsState.getOrAddProperties().layoutA = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutA); + odsState.getOrAddProperties().layoutB = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutB); + if (satfinite) { + odsState.getOrAddProperties().satfinite = satfinite; + } + odsState.addTypes(results); +} + +void WgmmaMmaAsyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inouts, ::mlir::Value descriptorA, ::mlir::Value descriptorB, ::mlir::NVVM::MMAShapeAttr shape, ::mlir::NVVM::WGMMATypes typeA, ::mlir::NVVM::WGMMATypes typeB, ::mlir::NVVM::WGMMAScaleOut scaleD, ::mlir::NVVM::WGMMAScaleIn scaleA, ::mlir::NVVM::WGMMAScaleIn scaleB, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, /*optional*/::mlir::NVVM::MMAIntOverflowAttr satfinite) { + odsState.addOperands(inouts); + odsState.addOperands(descriptorA); + odsState.addOperands(descriptorB); + odsState.getOrAddProperties().shape = shape; + odsState.getOrAddProperties().typeA = ::mlir::NVVM::WGMMATypesAttr::get(odsBuilder.getContext(), typeA); + odsState.getOrAddProperties().typeB = ::mlir::NVVM::WGMMATypesAttr::get(odsBuilder.getContext(), typeB); + odsState.getOrAddProperties().scaleD = ::mlir::NVVM::WGMMAScaleOutAttr::get(odsBuilder.getContext(), scaleD); + odsState.getOrAddProperties().scaleA = ::mlir::NVVM::WGMMAScaleInAttr::get(odsBuilder.getContext(), scaleA); + odsState.getOrAddProperties().scaleB = ::mlir::NVVM::WGMMAScaleInAttr::get(odsBuilder.getContext(), scaleB); + odsState.getOrAddProperties().layoutA = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutA); + odsState.getOrAddProperties().layoutB = ::mlir::NVVM::MMALayoutAttr::get(odsBuilder.getContext(), layoutB); + if (satfinite) { + odsState.getOrAddProperties().satfinite = satfinite; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WgmmaMmaAsyncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WgmmaMmaAsyncOp::verifyInvariantsImpl() { + auto tblgen_layoutA = getProperties().layoutA; (void)tblgen_layoutA; + if (!tblgen_layoutA) return emitOpError("requires attribute 'layoutA'"); + auto tblgen_layoutB = getProperties().layoutB; (void)tblgen_layoutB; + if (!tblgen_layoutB) return emitOpError("requires attribute 'layoutB'"); + auto tblgen_satfinite = getProperties().satfinite; (void)tblgen_satfinite; + auto tblgen_scaleA = getProperties().scaleA; (void)tblgen_scaleA; + if (!tblgen_scaleA) return emitOpError("requires attribute 'scaleA'"); + auto tblgen_scaleB = getProperties().scaleB; (void)tblgen_scaleB; + if (!tblgen_scaleB) return emitOpError("requires attribute 'scaleB'"); + auto tblgen_scaleD = getProperties().scaleD; (void)tblgen_scaleD; + if (!tblgen_scaleD) return emitOpError("requires attribute 'scaleD'"); + auto tblgen_shape = getProperties().shape; (void)tblgen_shape; + if (!tblgen_shape) return emitOpError("requires attribute 'shape'"); + auto tblgen_typeA = getProperties().typeA; (void)tblgen_typeA; + if (!tblgen_typeA) return emitOpError("requires attribute 'typeA'"); + auto tblgen_typeB = getProperties().typeB; (void)tblgen_typeB; + if (!tblgen_typeB) return emitOpError("requires attribute 'typeB'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps3(*this, tblgen_shape, "shape"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps11(*this, tblgen_typeA, "typeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps11(*this, tblgen_typeB, "typeB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps12(*this, tblgen_scaleD, "scaleD"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps13(*this, tblgen_scaleA, "scaleA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps13(*this, tblgen_scaleB, "scaleB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(*this, tblgen_layoutA, "layoutA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps2(*this, tblgen_layoutB, "layoutB"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps5(*this, tblgen_satfinite, "satfinite"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVVMOps9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!(((*this->getOperation()).getResult(0).getType() == (*this->getOperation()).getOperand(0).getType()))) + return emitOpError("failed to verify that input struct and result struct must be the same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult WgmmaMmaAsyncOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WgmmaMmaAsyncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand descriptorARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> descriptorAOperands(descriptorARawOperands); ::llvm::SMLoc descriptorAOperandsLoc; + (void)descriptorAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand descriptorBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> descriptorBOperands(descriptorBRawOperands); ::llvm::SMLoc descriptorBOperandsLoc; + (void)descriptorBOperandsLoc; + ::mlir::NVVM::MMAShapeAttr shapeAttr; + ::mlir::OpAsmParser::UnresolvedOperand inoutsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inoutsOperands(inoutsRawOperands); ::llvm::SMLoc inoutsOperandsLoc; + (void)inoutsOperandsLoc; + ::mlir::NVVM::WGMMAScaleOutAttr scaleDAttr; + ::mlir::NVVM::MMAIntOverflowAttr satfiniteAttr; + ::mlir::NVVM::WGMMATypesAttr typeAAttr; + ::mlir::NVVM::WGMMAScaleInAttr scaleAAttr; + ::mlir::NVVM::MMALayoutAttr layoutAAttr; + ::mlir::NVVM::WGMMATypesAttr typeBAttr; + ::mlir::NVVM::WGMMAScaleInAttr scaleBAttr; + ::mlir::NVVM::MMALayoutAttr layoutBAttr; + ::mlir::Type inoutsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inoutsTypes(inoutsRawTypes); + ::mlir::Type resultsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultsTypes(resultsRawTypes); + + descriptorAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(descriptorARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + descriptorBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(descriptorBRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(shapeAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (shapeAttr) result.getOrAddProperties().shape = shapeAttr; + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseKeyword("D")) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + inoutsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inoutsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(scaleDAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (scaleDAttr) result.getOrAddProperties().scaleD = scaleDAttr; + if (::mlir::succeeded(parser.parseOptionalComma())) { + + if (parser.parseCustomAttributeWithFallback(satfiniteAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (satfiniteAttr) result.getOrAddProperties().satfinite = satfiniteAttr; + } + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseKeyword("A")) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(typeAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (typeAAttr) result.getOrAddProperties().typeA = typeAAttr; + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(scaleAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (scaleAAttr) result.getOrAddProperties().scaleA = scaleAAttr; + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(layoutAAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (layoutAAttr) result.getOrAddProperties().layoutA = layoutAAttr; + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseKeyword("B")) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(typeBAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (typeBAttr) result.getOrAddProperties().typeB = typeBAttr; + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(scaleBAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (scaleBAttr) result.getOrAddProperties().scaleB = scaleBAttr; + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(layoutBAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (layoutBAttr) result.getOrAddProperties().layoutB = layoutBAttr; + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inoutsRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultsRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(64); + result.addTypes(resultsTypes); + if (parser.resolveOperands(inoutsOperands, inoutsTypes, inoutsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(descriptorAOperands, odsBuildableType0, descriptorAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(descriptorBOperands, odsBuildableType0, descriptorBOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WgmmaMmaAsyncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getDescriptorA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDescriptorB(); + _odsPrinter << ","; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getShapeAttr()); + _odsPrinter << ","; + _odsPrinter << ' ' << "D"; + _odsPrinter << "["; + _odsPrinter << getInouts(); + _odsPrinter << ","; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getScaleDAttr()); + if (getSatfiniteAttr()) { + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printStrippedAttrOrType(getSatfiniteAttr()); + } + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' ' << "A"; + _odsPrinter << "["; +_odsPrinter.printStrippedAttrOrType(getTypeAAttr()); + _odsPrinter << ","; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getScaleAAttr()); + _odsPrinter << ","; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getLayoutAAttr()); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' ' << "B"; + _odsPrinter << "["; +_odsPrinter.printStrippedAttrOrType(getTypeBAttr()); + _odsPrinter << ","; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getScaleBAttr()); + _odsPrinter << ","; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getLayoutBAttr()); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("shape"); + elidedAttrs.push_back("scaleD"); + elidedAttrs.push_back("satfinite"); + elidedAttrs.push_back("typeA"); + elidedAttrs.push_back("scaleA"); + elidedAttrs.push_back("layoutA"); + elidedAttrs.push_back("typeB"); + elidedAttrs.push_back("scaleB"); + elidedAttrs.push_back("layoutB"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getInouts().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getResults().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WgmmaMmaAsyncOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WgmmaWaitGroupSyncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WgmmaWaitGroupSyncOpGenericAdaptorBase::WgmmaWaitGroupSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvvm.wgmma.wait.group.sync.aligned", odsAttrs.getContext()); +} + +WgmmaWaitGroupSyncOpGenericAdaptorBase::WgmmaWaitGroupSyncOpGenericAdaptorBase(WgmmaWaitGroupSyncOp op) : WgmmaWaitGroupSyncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WgmmaWaitGroupSyncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr WgmmaWaitGroupSyncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr WgmmaWaitGroupSyncOpGenericAdaptorBase::getGroupAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().group); + return attr; +} + +uint32_t WgmmaWaitGroupSyncOpGenericAdaptorBase::getGroup() { + auto attr = getGroupAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +WgmmaWaitGroupSyncOpAdaptor::WgmmaWaitGroupSyncOpAdaptor(WgmmaWaitGroupSyncOp op) : WgmmaWaitGroupSyncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WgmmaWaitGroupSyncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_group = getProperties().group; (void)tblgen_group; + if (!tblgen_group) return emitError(loc, "'nvvm.wgmma.wait.group.sync.aligned' op ""requires attribute 'group'"); + + if (tblgen_group && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_group))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_group).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvvm.wgmma.wait.group.sync.aligned' op ""attribute 'group' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair WgmmaWaitGroupSyncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range WgmmaWaitGroupSyncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair WgmmaWaitGroupSyncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WgmmaWaitGroupSyncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult WgmmaWaitGroupSyncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.group; + auto attr = dict.get("group"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for group in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `group` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute WgmmaWaitGroupSyncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.group; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("group", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code WgmmaWaitGroupSyncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.group.getAsOpaquePointer())); +} + +std::optional WgmmaWaitGroupSyncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "group") + return prop.group; + return std::nullopt; +} + +void WgmmaWaitGroupSyncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "group") { + prop.group = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void WgmmaWaitGroupSyncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.group) attrs.append("group", prop.group); +} + +::mlir::LogicalResult WgmmaWaitGroupSyncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getGroupAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(attr, "group", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WgmmaWaitGroupSyncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.group))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WgmmaWaitGroupSyncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.group); +} + +::mlir::IntegerAttr WgmmaWaitGroupSyncOp::getGroupAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().group); +} + +uint32_t WgmmaWaitGroupSyncOp::getGroup() { + auto attr = getGroupAttr(); + return attr.getValue().getZExtValue(); +} + +void WgmmaWaitGroupSyncOp::setGroupAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getGroupAttrName(), attr); +} + +void WgmmaWaitGroupSyncOp::setGroup(uint32_t attrValue) { + (*this)->setAttr(getGroupAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void WgmmaWaitGroupSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr group) { + odsState.getOrAddProperties().group = group; +} + +void WgmmaWaitGroupSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr group) { + odsState.getOrAddProperties().group = group; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WgmmaWaitGroupSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t group) { + odsState.getOrAddProperties().group = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), group); +} + +void WgmmaWaitGroupSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t group) { + odsState.getOrAddProperties().group = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), group); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WgmmaWaitGroupSyncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WgmmaWaitGroupSyncOp::verifyInvariantsImpl() { + auto tblgen_group = getProperties().group; (void)tblgen_group; + if (!tblgen_group) return emitOpError("requires attribute 'group'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVVMOps0(*this, tblgen_group, "group"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult WgmmaWaitGroupSyncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult WgmmaWaitGroupSyncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr groupAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + if (parser.parseCustomAttributeWithFallback(groupAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (groupAttr) result.getOrAddProperties().group = groupAttr; + return ::mlir::success(); +} + +void WgmmaWaitGroupSyncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("group"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getGroupAttr()); +} + +std::string WgmmaWaitGroupSyncOp::getPtx() { return std::string("wgmma.wait_group.sync.aligned %0;"); } +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WgmmaWaitGroupSyncOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..4436dae6434c577c5088de005bf08402c8a9e5db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.h.inc @@ -0,0 +1,9172 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace NVVM { +class Barrier0Op; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class BlockDimXOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class BlockDimYOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class BlockDimZOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class BlockIdXOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class BlockIdYOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class BlockIdZOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class BlockInClusterIdXOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class BlockInClusterIdYOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class BlockInClusterIdZOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterArriveOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterArriveRelaxedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterDim; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterDimXOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterDimYOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterDimZOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterId; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterIdXOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterIdYOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterIdZOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ClusterWaitOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class CpAsyncBulkTensorGlobalToSharedClusterOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class CpAsyncBulkTensorSharedCTAToGlobalOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class CpAsyncCommitGroupOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class CpAsyncOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class CpAsyncWaitGroupOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ElectSyncOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class FenceScClusterOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class GridDimXOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class GridDimYOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class GridDimZOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class GridInClusterDimXOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class GridInClusterDimYOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class GridInClusterDimZOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class LaneIdOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class LdMatrixOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierArriveExpectTxOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierArriveExpectTxSharedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierArriveNocompleteOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierArriveNocompleteSharedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierArriveOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierArriveSharedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierInitOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierInitSharedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierInvalOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierInvalSharedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierTestWaitOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierTestWaitSharedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierTryWaitParityOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MBarrierTryWaitParitySharedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class MmaOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class RcpApproxFtzF32Op; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ReduxOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ShflOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class SyncWarpOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ThreadIdXOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ThreadIdYOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class ThreadIdZOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class VoteBallotOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class WMMALoadOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class WMMAMmaOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class WMMAStoreOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class WarpSizeOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class WgmmaFenceAlignedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class WgmmaGroupSyncAlignedOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class WgmmaMmaAsyncOp; +} // namespace NVVM +} // namespace mlir +namespace mlir { +namespace NVVM { +class WgmmaWaitGroupSyncOp; +} // namespace NVVM +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::Barrier0Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Barrier0OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Barrier0OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Barrier0OpGenericAdaptorBase(Barrier0Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Barrier0OpGenericAdaptor : public detail::Barrier0OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Barrier0OpGenericAdaptorBase; +public: + Barrier0OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Barrier0OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Barrier0OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Barrier0OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Barrier0OpAdaptor : public Barrier0OpGenericAdaptor<::mlir::ValueRange> { +public: + using Barrier0OpGenericAdaptor::Barrier0OpGenericAdaptor; + Barrier0OpAdaptor(Barrier0Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Barrier0Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = Barrier0OpAdaptor; + template + using GenericAdaptor = Barrier0OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.barrier0"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::Barrier0Op) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockDimXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockDimXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockDimXOpGenericAdaptorBase(BlockDimXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockDimXOpGenericAdaptor : public detail::BlockDimXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockDimXOpGenericAdaptorBase; +public: + BlockDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockDimXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockDimXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockDimXOpAdaptor : public BlockDimXOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockDimXOpGenericAdaptor::BlockDimXOpGenericAdaptor; + BlockDimXOpAdaptor(BlockDimXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockDimXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockDimXOpAdaptor; + template + using GenericAdaptor = BlockDimXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.ntid.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockDimXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockDimYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockDimYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockDimYOpGenericAdaptorBase(BlockDimYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockDimYOpGenericAdaptor : public detail::BlockDimYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockDimYOpGenericAdaptorBase; +public: + BlockDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockDimYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockDimYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockDimYOpAdaptor : public BlockDimYOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockDimYOpGenericAdaptor::BlockDimYOpGenericAdaptor; + BlockDimYOpAdaptor(BlockDimYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockDimYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockDimYOpAdaptor; + template + using GenericAdaptor = BlockDimYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.ntid.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockDimYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockDimZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockDimZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockDimZOpGenericAdaptorBase(BlockDimZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockDimZOpGenericAdaptor : public detail::BlockDimZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockDimZOpGenericAdaptorBase; +public: + BlockDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockDimZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockDimZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockDimZOpAdaptor : public BlockDimZOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockDimZOpGenericAdaptor::BlockDimZOpGenericAdaptor; + BlockDimZOpAdaptor(BlockDimZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockDimZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockDimZOpAdaptor; + template + using GenericAdaptor = BlockDimZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.ntid.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockDimZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockIdXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockIdXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockIdXOpGenericAdaptorBase(BlockIdXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockIdXOpGenericAdaptor : public detail::BlockIdXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockIdXOpGenericAdaptorBase; +public: + BlockIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockIdXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockIdXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockIdXOpAdaptor : public BlockIdXOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockIdXOpGenericAdaptor::BlockIdXOpGenericAdaptor; + BlockIdXOpAdaptor(BlockIdXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockIdXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockIdXOpAdaptor; + template + using GenericAdaptor = BlockIdXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.ctaid.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockIdXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockIdYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockIdYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockIdYOpGenericAdaptorBase(BlockIdYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockIdYOpGenericAdaptor : public detail::BlockIdYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockIdYOpGenericAdaptorBase; +public: + BlockIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockIdYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockIdYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockIdYOpAdaptor : public BlockIdYOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockIdYOpGenericAdaptor::BlockIdYOpGenericAdaptor; + BlockIdYOpAdaptor(BlockIdYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockIdYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockIdYOpAdaptor; + template + using GenericAdaptor = BlockIdYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.ctaid.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockIdYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockIdZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockIdZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockIdZOpGenericAdaptorBase(BlockIdZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockIdZOpGenericAdaptor : public detail::BlockIdZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockIdZOpGenericAdaptorBase; +public: + BlockIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockIdZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockIdZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockIdZOpAdaptor : public BlockIdZOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockIdZOpGenericAdaptor::BlockIdZOpGenericAdaptor; + BlockIdZOpAdaptor(BlockIdZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockIdZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockIdZOpAdaptor; + template + using GenericAdaptor = BlockIdZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.ctaid.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockIdZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockInClusterIdXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockInClusterIdXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockInClusterIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockInClusterIdXOpGenericAdaptorBase(BlockInClusterIdXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockInClusterIdXOpGenericAdaptor : public detail::BlockInClusterIdXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockInClusterIdXOpGenericAdaptorBase; +public: + BlockInClusterIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockInClusterIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockInClusterIdXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockInClusterIdXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockInClusterIdXOpAdaptor : public BlockInClusterIdXOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockInClusterIdXOpGenericAdaptor::BlockInClusterIdXOpGenericAdaptor; + BlockInClusterIdXOpAdaptor(BlockInClusterIdXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockInClusterIdXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockInClusterIdXOpAdaptor; + template + using GenericAdaptor = BlockInClusterIdXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.cluster.ctaid.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockInClusterIdXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockInClusterIdYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockInClusterIdYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockInClusterIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockInClusterIdYOpGenericAdaptorBase(BlockInClusterIdYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockInClusterIdYOpGenericAdaptor : public detail::BlockInClusterIdYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockInClusterIdYOpGenericAdaptorBase; +public: + BlockInClusterIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockInClusterIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockInClusterIdYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockInClusterIdYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockInClusterIdYOpAdaptor : public BlockInClusterIdYOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockInClusterIdYOpGenericAdaptor::BlockInClusterIdYOpGenericAdaptor; + BlockInClusterIdYOpAdaptor(BlockInClusterIdYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockInClusterIdYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockInClusterIdYOpAdaptor; + template + using GenericAdaptor = BlockInClusterIdYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.cluster.ctaid.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockInClusterIdYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::BlockInClusterIdZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockInClusterIdZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockInClusterIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockInClusterIdZOpGenericAdaptorBase(BlockInClusterIdZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockInClusterIdZOpGenericAdaptor : public detail::BlockInClusterIdZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockInClusterIdZOpGenericAdaptorBase; +public: + BlockInClusterIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockInClusterIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockInClusterIdZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockInClusterIdZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockInClusterIdZOpAdaptor : public BlockInClusterIdZOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockInClusterIdZOpGenericAdaptor::BlockInClusterIdZOpGenericAdaptor; + BlockInClusterIdZOpAdaptor(BlockInClusterIdZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockInClusterIdZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockInClusterIdZOpAdaptor; + template + using GenericAdaptor = BlockInClusterIdZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.cluster.ctaid.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::BlockInClusterIdZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterArriveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterArriveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterArriveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterArriveOpGenericAdaptorBase(ClusterArriveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterArriveOpGenericAdaptor : public detail::ClusterArriveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterArriveOpGenericAdaptorBase; +public: + ClusterArriveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterArriveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterArriveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterArriveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterArriveOpAdaptor : public ClusterArriveOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterArriveOpGenericAdaptor::ClusterArriveOpGenericAdaptor; + ClusterArriveOpAdaptor(ClusterArriveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterArriveOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterArriveOpAdaptor; + template + using GenericAdaptor = ClusterArriveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.cluster.arrive"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterArriveOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterArriveRelaxedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterArriveRelaxedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterArriveRelaxedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterArriveRelaxedOpGenericAdaptorBase(ClusterArriveRelaxedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterArriveRelaxedOpGenericAdaptor : public detail::ClusterArriveRelaxedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterArriveRelaxedOpGenericAdaptorBase; +public: + ClusterArriveRelaxedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterArriveRelaxedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterArriveRelaxedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterArriveRelaxedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterArriveRelaxedOpAdaptor : public ClusterArriveRelaxedOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterArriveRelaxedOpGenericAdaptor::ClusterArriveRelaxedOpGenericAdaptor; + ClusterArriveRelaxedOpAdaptor(ClusterArriveRelaxedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterArriveRelaxedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterArriveRelaxedOpAdaptor; + template + using GenericAdaptor = ClusterArriveRelaxedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.cluster.arrive.relaxed"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterArriveRelaxedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterDim declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterDimGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterDimGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterDimGenericAdaptorBase(ClusterDim op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterDimGenericAdaptor : public detail::ClusterDimGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterDimGenericAdaptorBase; +public: + ClusterDimGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterDimGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterDimGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterDimGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterDimAdaptor : public ClusterDimGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterDimGenericAdaptor::ClusterDimGenericAdaptor; + ClusterDimAdaptor(ClusterDim op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterDim : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterDimAdaptor; + template + using GenericAdaptor = ClusterDimGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.cluster.nctarank"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterDim) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterDimXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterDimXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterDimXOpGenericAdaptorBase(ClusterDimXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterDimXOpGenericAdaptor : public detail::ClusterDimXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterDimXOpGenericAdaptorBase; +public: + ClusterDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterDimXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterDimXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterDimXOpAdaptor : public ClusterDimXOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterDimXOpGenericAdaptor::ClusterDimXOpGenericAdaptor; + ClusterDimXOpAdaptor(ClusterDimXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterDimXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterDimXOpAdaptor; + template + using GenericAdaptor = ClusterDimXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.nclusterid.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterDimXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterDimYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterDimYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterDimYOpGenericAdaptorBase(ClusterDimYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterDimYOpGenericAdaptor : public detail::ClusterDimYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterDimYOpGenericAdaptorBase; +public: + ClusterDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterDimYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterDimYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterDimYOpAdaptor : public ClusterDimYOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterDimYOpGenericAdaptor::ClusterDimYOpGenericAdaptor; + ClusterDimYOpAdaptor(ClusterDimYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterDimYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterDimYOpAdaptor; + template + using GenericAdaptor = ClusterDimYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.nclusterid.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterDimYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterDimZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterDimZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterDimZOpGenericAdaptorBase(ClusterDimZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterDimZOpGenericAdaptor : public detail::ClusterDimZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterDimZOpGenericAdaptorBase; +public: + ClusterDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterDimZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterDimZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterDimZOpAdaptor : public ClusterDimZOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterDimZOpGenericAdaptor::ClusterDimZOpGenericAdaptor; + ClusterDimZOpAdaptor(ClusterDimZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterDimZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterDimZOpAdaptor; + template + using GenericAdaptor = ClusterDimZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.nclusterid.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterDimZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterId declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterIdGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterIdGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterIdGenericAdaptorBase(ClusterId op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterIdGenericAdaptor : public detail::ClusterIdGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterIdGenericAdaptorBase; +public: + ClusterIdGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterIdGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterIdGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterIdGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterIdAdaptor : public ClusterIdGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterIdGenericAdaptor::ClusterIdGenericAdaptor; + ClusterIdAdaptor(ClusterId op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterId : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterIdAdaptor; + template + using GenericAdaptor = ClusterIdGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.cluster.ctarank"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterId) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterIdXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterIdXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterIdXOpGenericAdaptorBase(ClusterIdXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterIdXOpGenericAdaptor : public detail::ClusterIdXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterIdXOpGenericAdaptorBase; +public: + ClusterIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterIdXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterIdXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterIdXOpAdaptor : public ClusterIdXOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterIdXOpGenericAdaptor::ClusterIdXOpGenericAdaptor; + ClusterIdXOpAdaptor(ClusterIdXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterIdXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterIdXOpAdaptor; + template + using GenericAdaptor = ClusterIdXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.clusterid.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterIdXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterIdYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterIdYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterIdYOpGenericAdaptorBase(ClusterIdYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterIdYOpGenericAdaptor : public detail::ClusterIdYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterIdYOpGenericAdaptorBase; +public: + ClusterIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterIdYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterIdYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterIdYOpAdaptor : public ClusterIdYOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterIdYOpGenericAdaptor::ClusterIdYOpGenericAdaptor; + ClusterIdYOpAdaptor(ClusterIdYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterIdYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterIdYOpAdaptor; + template + using GenericAdaptor = ClusterIdYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.clusterid.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterIdYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterIdZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterIdZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterIdZOpGenericAdaptorBase(ClusterIdZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterIdZOpGenericAdaptor : public detail::ClusterIdZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterIdZOpGenericAdaptorBase; +public: + ClusterIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterIdZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterIdZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterIdZOpAdaptor : public ClusterIdZOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterIdZOpGenericAdaptor::ClusterIdZOpGenericAdaptor; + ClusterIdZOpAdaptor(ClusterIdZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterIdZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterIdZOpAdaptor; + template + using GenericAdaptor = ClusterIdZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.clusterid.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterIdZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ClusterWaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterWaitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterWaitOpGenericAdaptorBase(ClusterWaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClusterWaitOpGenericAdaptor : public detail::ClusterWaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterWaitOpGenericAdaptorBase; +public: + ClusterWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterWaitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterWaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterWaitOpAdaptor : public ClusterWaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterWaitOpGenericAdaptor::ClusterWaitOpGenericAdaptor; + ClusterWaitOpAdaptor(ClusterWaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterWaitOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterWaitOpAdaptor; + template + using GenericAdaptor = ClusterWaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.cluster.wait"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ClusterWaitOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncBulkTensorGlobalToSharedClusterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase(CpAsyncBulkTensorGlobalToSharedClusterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor : public detail::CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptorBase; +public: + CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDstMem() { + return (*getODSOperands(0).begin()); + } + + ValueT getTmaDescriptor() { + return (*getODSOperands(1).begin()); + } + + ValueT getMbar() { + return (*getODSOperands(2).begin()); + } + + RangeT getCoordinates() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CpAsyncBulkTensorGlobalToSharedClusterOpAdaptor : public CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor<::mlir::ValueRange> { +public: + using CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor::CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor; + CpAsyncBulkTensorGlobalToSharedClusterOpAdaptor(CpAsyncBulkTensorGlobalToSharedClusterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CpAsyncBulkTensorGlobalToSharedClusterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, BasicPtxBuilderInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CpAsyncBulkTensorGlobalToSharedClusterOpAdaptor; + template + using GenericAdaptor = CpAsyncBulkTensorGlobalToSharedClusterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.cp.async.bulk.tensor.shared.cluster.global"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getDstMem(); + ::mlir::Value getTmaDescriptor(); + ::mlir::Value getMbar(); + ::mlir::Operation::operand_range getCoordinates(); + ::mlir::OpOperand &getDstMemMutable(); + ::mlir::OpOperand &getTmaDescriptorMutable(); + ::mlir::OpOperand &getMbarMutable(); + ::mlir::MutableOperandRange getCoordinatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dstMem, ::mlir::Value tmaDescriptor, ::mlir::Value mbar, ::mlir::ValueRange coordinates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dstMem, ::mlir::Value tmaDescriptor, ::mlir::Value mbar, ::mlir::ValueRange coordinates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncBulkTensorGlobalToSharedClusterOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncBulkTensorSharedCTAToGlobalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase(CpAsyncBulkTensorSharedCTAToGlobalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor : public detail::CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptorBase; +public: + CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTmaDescriptor() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrcMem() { + return (*getODSOperands(1).begin()); + } + + RangeT getCoordinates() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CpAsyncBulkTensorSharedCTAToGlobalOpAdaptor : public CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor<::mlir::ValueRange> { +public: + using CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor::CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor; + CpAsyncBulkTensorSharedCTAToGlobalOpAdaptor(CpAsyncBulkTensorSharedCTAToGlobalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CpAsyncBulkTensorSharedCTAToGlobalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, BasicPtxBuilderInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CpAsyncBulkTensorSharedCTAToGlobalOpAdaptor; + template + using GenericAdaptor = CpAsyncBulkTensorSharedCTAToGlobalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.cp.async.bulk.tensor.global.shared.cta"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getTmaDescriptor(); + ::mlir::Value getSrcMem(); + ::mlir::Operation::operand_range getCoordinates(); + ::mlir::OpOperand &getTmaDescriptorMutable(); + ::mlir::OpOperand &getSrcMemMutable(); + ::mlir::MutableOperandRange getCoordinatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tmaDescriptor, ::mlir::Value srcMem, ::mlir::ValueRange coordinates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tmaDescriptor, ::mlir::Value srcMem, ::mlir::ValueRange coordinates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncBulkTensorSharedCTAToGlobalOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncCommitGroupOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CpAsyncCommitGroupOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CpAsyncCommitGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CpAsyncCommitGroupOpGenericAdaptorBase(CpAsyncCommitGroupOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CpAsyncCommitGroupOpGenericAdaptor : public detail::CpAsyncCommitGroupOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CpAsyncCommitGroupOpGenericAdaptorBase; +public: + CpAsyncCommitGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CpAsyncCommitGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CpAsyncCommitGroupOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CpAsyncCommitGroupOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CpAsyncCommitGroupOpAdaptor : public CpAsyncCommitGroupOpGenericAdaptor<::mlir::ValueRange> { +public: + using CpAsyncCommitGroupOpGenericAdaptor::CpAsyncCommitGroupOpGenericAdaptor; + CpAsyncCommitGroupOpAdaptor(CpAsyncCommitGroupOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CpAsyncCommitGroupOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CpAsyncCommitGroupOpAdaptor; + template + using GenericAdaptor = CpAsyncCommitGroupOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.cp.async.commit.group"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncCommitGroupOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CpAsyncOpGenericAdaptorBase { +public: + struct Properties { + using modifierTy = ::mlir::NVVM::LoadCacheModifierKindAttr; + modifierTy modifier; + + auto getModifier() { + auto &propStorage = this->modifier; + return ::llvm::cast<::mlir::NVVM::LoadCacheModifierKindAttr>(propStorage); + } + void setModifier(const ::mlir::NVVM::LoadCacheModifierKindAttr &propValue) { + this->modifier = propValue; + } + using sizeTy = ::mlir::IntegerAttr; + sizeTy size; + + auto getSize() { + auto &propStorage = this->size; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setSize(const ::mlir::IntegerAttr &propValue) { + this->size = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.modifier == this->modifier && + rhs.size == this->size && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CpAsyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CpAsyncOpGenericAdaptorBase(CpAsyncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSizeAttr(); + uint32_t getSize(); + ::mlir::NVVM::LoadCacheModifierKindAttr getModifierAttr(); + ::mlir::NVVM::LoadCacheModifierKind getModifier(); +}; +} // namespace detail +template +class CpAsyncOpGenericAdaptor : public detail::CpAsyncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CpAsyncOpGenericAdaptorBase; +public: + CpAsyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CpAsyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CpAsyncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CpAsyncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDst() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getCpSize() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CpAsyncOpAdaptor : public CpAsyncOpGenericAdaptor<::mlir::ValueRange> { +public: + using CpAsyncOpGenericAdaptor::CpAsyncOpGenericAdaptor; + CpAsyncOpAdaptor(CpAsyncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CpAsyncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, BasicPtxBuilderInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CpAsyncOpAdaptor; + template + using GenericAdaptor = CpAsyncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("modifier"), ::llvm::StringRef("size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getModifierAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getModifierAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.cp.async.shared.global"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getDst(); + ::mlir::Value getSrc(); + ::mlir::Value getCpSize(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::MutableOperandRange getCpSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getSizeAttr(); + uint32_t getSize(); + ::mlir::NVVM::LoadCacheModifierKindAttr getModifierAttr(); + ::mlir::NVVM::LoadCacheModifierKind getModifier(); + void setSizeAttr(::mlir::IntegerAttr attr); + void setSize(uint32_t attrValue); + void setModifierAttr(::mlir::NVVM::LoadCacheModifierKindAttr attr); + void setModifier(::mlir::NVVM::LoadCacheModifierKind attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr size, ::mlir::NVVM::LoadCacheModifierKindAttr modifier, /*optional*/::mlir::Value cpSize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, ::mlir::IntegerAttr size, ::mlir::NVVM::LoadCacheModifierKindAttr modifier, /*optional*/::mlir::Value cpSize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value src, uint32_t size, ::mlir::NVVM::LoadCacheModifierKind modifier, /*optional*/::mlir::Value cpSize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value src, uint32_t size, ::mlir::NVVM::LoadCacheModifierKind modifier, /*optional*/::mlir::Value cpSize); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + bool hasIntrinsic() { if(getCpSize()) return false; return true; } + + void getAsmValues(RewriterBase &rewriter, + llvm::SmallVectorImpl> &asmValues) { + asmValues.push_back({getDst(), PTXRegisterMod::Read}); + asmValues.push_back({getSrc(), PTXRegisterMod::Read}); + asmValues.push_back({makeConstantI32(rewriter, getSize()), PTXRegisterMod::Read}); + asmValues.push_back({getCpSize(), PTXRegisterMod::Read}); + } +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::CpAsyncWaitGroupOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CpAsyncWaitGroupOpGenericAdaptorBase { +public: + struct Properties { + using nTy = ::mlir::IntegerAttr; + nTy n; + + auto getN() { + auto &propStorage = this->n; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setN(const ::mlir::IntegerAttr &propValue) { + this->n = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.n == this->n && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CpAsyncWaitGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CpAsyncWaitGroupOpGenericAdaptorBase(CpAsyncWaitGroupOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); +}; +} // namespace detail +template +class CpAsyncWaitGroupOpGenericAdaptor : public detail::CpAsyncWaitGroupOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CpAsyncWaitGroupOpGenericAdaptorBase; +public: + CpAsyncWaitGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CpAsyncWaitGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CpAsyncWaitGroupOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CpAsyncWaitGroupOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CpAsyncWaitGroupOpAdaptor : public CpAsyncWaitGroupOpGenericAdaptor<::mlir::ValueRange> { +public: + using CpAsyncWaitGroupOpGenericAdaptor::CpAsyncWaitGroupOpGenericAdaptor; + CpAsyncWaitGroupOpAdaptor(CpAsyncWaitGroupOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CpAsyncWaitGroupOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CpAsyncWaitGroupOpAdaptor; + template + using GenericAdaptor = CpAsyncWaitGroupOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("n")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.cp.async.wait.group"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + void setNAttr(::mlir::IntegerAttr attr); + void setN(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr n); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr n); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t n); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t n); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::CpAsyncWaitGroupOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ElectSyncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ElectSyncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ElectSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ElectSyncOpGenericAdaptorBase(ElectSyncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ElectSyncOpGenericAdaptor : public detail::ElectSyncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ElectSyncOpGenericAdaptorBase; +public: + ElectSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ElectSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ElectSyncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ElectSyncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ElectSyncOpAdaptor : public ElectSyncOpGenericAdaptor<::mlir::ValueRange> { +public: + using ElectSyncOpGenericAdaptor::ElectSyncOpGenericAdaptor; + ElectSyncOpAdaptor(ElectSyncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ElectSyncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, BasicPtxBuilderInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ElectSyncOpAdaptor; + template + using GenericAdaptor = ElectSyncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.elect.sync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getPred(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type pred); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ElectSyncOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::FenceScClusterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FenceScClusterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FenceScClusterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FenceScClusterOpGenericAdaptorBase(FenceScClusterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FenceScClusterOpGenericAdaptor : public detail::FenceScClusterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FenceScClusterOpGenericAdaptorBase; +public: + FenceScClusterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FenceScClusterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FenceScClusterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FenceScClusterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FenceScClusterOpAdaptor : public FenceScClusterOpGenericAdaptor<::mlir::ValueRange> { +public: + using FenceScClusterOpGenericAdaptor::FenceScClusterOpGenericAdaptor; + FenceScClusterOpAdaptor(FenceScClusterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FenceScClusterOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FenceScClusterOpAdaptor; + template + using GenericAdaptor = FenceScClusterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.fence.sc.cluster"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::FenceScClusterOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridDimXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridDimXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GridDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GridDimXOpGenericAdaptorBase(GridDimXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GridDimXOpGenericAdaptor : public detail::GridDimXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridDimXOpGenericAdaptorBase; +public: + GridDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridDimXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GridDimXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridDimXOpAdaptor : public GridDimXOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridDimXOpGenericAdaptor::GridDimXOpGenericAdaptor; + GridDimXOpAdaptor(GridDimXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridDimXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridDimXOpAdaptor; + template + using GenericAdaptor = GridDimXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.nctaid.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridDimXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridDimYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridDimYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GridDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GridDimYOpGenericAdaptorBase(GridDimYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GridDimYOpGenericAdaptor : public detail::GridDimYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridDimYOpGenericAdaptorBase; +public: + GridDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridDimYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GridDimYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridDimYOpAdaptor : public GridDimYOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridDimYOpGenericAdaptor::GridDimYOpGenericAdaptor; + GridDimYOpAdaptor(GridDimYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridDimYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridDimYOpAdaptor; + template + using GenericAdaptor = GridDimYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.nctaid.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridDimYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridDimZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridDimZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GridDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GridDimZOpGenericAdaptorBase(GridDimZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GridDimZOpGenericAdaptor : public detail::GridDimZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridDimZOpGenericAdaptorBase; +public: + GridDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridDimZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GridDimZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridDimZOpAdaptor : public GridDimZOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridDimZOpGenericAdaptor::GridDimZOpGenericAdaptor; + GridDimZOpAdaptor(GridDimZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridDimZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridDimZOpAdaptor; + template + using GenericAdaptor = GridDimZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.nctaid.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridDimZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridInClusterDimXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridInClusterDimXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GridInClusterDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GridInClusterDimXOpGenericAdaptorBase(GridInClusterDimXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GridInClusterDimXOpGenericAdaptor : public detail::GridInClusterDimXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridInClusterDimXOpGenericAdaptorBase; +public: + GridInClusterDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridInClusterDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridInClusterDimXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GridInClusterDimXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridInClusterDimXOpAdaptor : public GridInClusterDimXOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridInClusterDimXOpGenericAdaptor::GridInClusterDimXOpGenericAdaptor; + GridInClusterDimXOpAdaptor(GridInClusterDimXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridInClusterDimXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridInClusterDimXOpAdaptor; + template + using GenericAdaptor = GridInClusterDimXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.cluster.nctaid.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridInClusterDimXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridInClusterDimYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridInClusterDimYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GridInClusterDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GridInClusterDimYOpGenericAdaptorBase(GridInClusterDimYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GridInClusterDimYOpGenericAdaptor : public detail::GridInClusterDimYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridInClusterDimYOpGenericAdaptorBase; +public: + GridInClusterDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridInClusterDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridInClusterDimYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GridInClusterDimYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridInClusterDimYOpAdaptor : public GridInClusterDimYOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridInClusterDimYOpGenericAdaptor::GridInClusterDimYOpGenericAdaptor; + GridInClusterDimYOpAdaptor(GridInClusterDimYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridInClusterDimYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridInClusterDimYOpAdaptor; + template + using GenericAdaptor = GridInClusterDimYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.cluster.nctaid.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridInClusterDimYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::GridInClusterDimZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridInClusterDimZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GridInClusterDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GridInClusterDimZOpGenericAdaptorBase(GridInClusterDimZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GridInClusterDimZOpGenericAdaptor : public detail::GridInClusterDimZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridInClusterDimZOpGenericAdaptorBase; +public: + GridInClusterDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridInClusterDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridInClusterDimZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GridInClusterDimZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridInClusterDimZOpAdaptor : public GridInClusterDimZOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridInClusterDimZOpGenericAdaptor::GridInClusterDimZOpGenericAdaptor; + GridInClusterDimZOpAdaptor(GridInClusterDimZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridInClusterDimZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridInClusterDimZOpAdaptor; + template + using GenericAdaptor = GridInClusterDimZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.cluster.nctaid.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::GridInClusterDimZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::LaneIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LaneIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LaneIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LaneIdOpGenericAdaptorBase(LaneIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LaneIdOpGenericAdaptor : public detail::LaneIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LaneIdOpGenericAdaptorBase; +public: + LaneIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LaneIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LaneIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LaneIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LaneIdOpAdaptor : public LaneIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using LaneIdOpGenericAdaptor::LaneIdOpGenericAdaptor; + LaneIdOpAdaptor(LaneIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LaneIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LaneIdOpAdaptor; + template + using GenericAdaptor = LaneIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.laneid"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::LaneIdOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::LdMatrixOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LdMatrixOpGenericAdaptorBase { +public: + struct Properties { + using layoutTy = ::mlir::NVVM::MMALayoutAttr; + layoutTy layout; + + auto getLayout() { + auto &propStorage = this->layout; + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(propStorage); + } + void setLayout(const ::mlir::NVVM::MMALayoutAttr &propValue) { + this->layout = propValue; + } + using numTy = ::mlir::IntegerAttr; + numTy num; + + auto getNum() { + auto &propStorage = this->num; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setNum(const ::mlir::IntegerAttr &propValue) { + this->num = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.layout == this->layout && + rhs.num == this->num && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LdMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LdMatrixOpGenericAdaptorBase(LdMatrixOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumAttr(); + uint32_t getNum(); + ::mlir::NVVM::MMALayoutAttr getLayoutAttr(); + ::mlir::NVVM::MMALayout getLayout(); +}; +} // namespace detail +template +class LdMatrixOpGenericAdaptor : public detail::LdMatrixOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LdMatrixOpGenericAdaptorBase; +public: + LdMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LdMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LdMatrixOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LdMatrixOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LdMatrixOpAdaptor : public LdMatrixOpGenericAdaptor<::mlir::ValueRange> { +public: + using LdMatrixOpGenericAdaptor::LdMatrixOpGenericAdaptor; + LdMatrixOpAdaptor(LdMatrixOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LdMatrixOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LdMatrixOpAdaptor; + template + using GenericAdaptor = LdMatrixOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("layout"), ::llvm::StringRef("num")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLayoutAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.ldmatrix"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::OpOperand &getPtrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getNumAttr(); + uint32_t getNum(); + ::mlir::NVVM::MMALayoutAttr getLayoutAttr(); + ::mlir::NVVM::MMALayout getLayout(); + void setNumAttr(::mlir::IntegerAttr attr); + void setNum(uint32_t attrValue); + void setLayoutAttr(::mlir::NVVM::MMALayoutAttr attr); + void setLayout(::mlir::NVVM::MMALayout attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::IntegerAttr num, ::mlir::NVVM::MMALayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::IntegerAttr num, ::mlir::NVVM::MMALayoutAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, uint32_t num, ::mlir::NVVM::MMALayout layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, uint32_t num, ::mlir::NVVM::MMALayout layout); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::LdMatrixOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveExpectTxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierArriveExpectTxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierArriveExpectTxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierArriveExpectTxOpGenericAdaptorBase(MBarrierArriveExpectTxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierArriveExpectTxOpGenericAdaptor : public detail::MBarrierArriveExpectTxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierArriveExpectTxOpGenericAdaptorBase; +public: + MBarrierArriveExpectTxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierArriveExpectTxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierArriveExpectTxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierArriveExpectTxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getTxcount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierArriveExpectTxOpAdaptor : public MBarrierArriveExpectTxOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierArriveExpectTxOpGenericAdaptor::MBarrierArriveExpectTxOpGenericAdaptor; + MBarrierArriveExpectTxOpAdaptor(MBarrierArriveExpectTxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierArriveExpectTxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, BasicPtxBuilderInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierArriveExpectTxOpAdaptor; + template + using GenericAdaptor = MBarrierArriveExpectTxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.arrive.expect_tx"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::TypedValue<::mlir::IntegerType> getTxcount(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getTxcountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value txcount); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value txcount); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveExpectTxOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveExpectTxSharedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierArriveExpectTxSharedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierArriveExpectTxSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierArriveExpectTxSharedOpGenericAdaptorBase(MBarrierArriveExpectTxSharedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierArriveExpectTxSharedOpGenericAdaptor : public detail::MBarrierArriveExpectTxSharedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierArriveExpectTxSharedOpGenericAdaptorBase; +public: + MBarrierArriveExpectTxSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierArriveExpectTxSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierArriveExpectTxSharedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierArriveExpectTxSharedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getTxcount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierArriveExpectTxSharedOpAdaptor : public MBarrierArriveExpectTxSharedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierArriveExpectTxSharedOpGenericAdaptor::MBarrierArriveExpectTxSharedOpGenericAdaptor; + MBarrierArriveExpectTxSharedOpAdaptor(MBarrierArriveExpectTxSharedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierArriveExpectTxSharedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, BasicPtxBuilderInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierArriveExpectTxSharedOpAdaptor; + template + using GenericAdaptor = MBarrierArriveExpectTxSharedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.arrive.expect_tx.shared"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::TypedValue<::mlir::IntegerType> getTxcount(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getTxcountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value txcount); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value txcount); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveExpectTxSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveNocompleteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierArriveNocompleteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierArriveNocompleteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierArriveNocompleteOpGenericAdaptorBase(MBarrierArriveNocompleteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierArriveNocompleteOpGenericAdaptor : public detail::MBarrierArriveNocompleteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierArriveNocompleteOpGenericAdaptorBase; +public: + MBarrierArriveNocompleteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierArriveNocompleteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierArriveNocompleteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierArriveNocompleteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getCount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierArriveNocompleteOpAdaptor : public MBarrierArriveNocompleteOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierArriveNocompleteOpGenericAdaptor::MBarrierArriveNocompleteOpGenericAdaptor; + MBarrierArriveNocompleteOpAdaptor(MBarrierArriveNocompleteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierArriveNocompleteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierArriveNocompleteOpAdaptor; + template + using GenericAdaptor = MBarrierArriveNocompleteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.arrive.nocomplete"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::TypedValue<::mlir::IntegerType> getCount(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, ::mlir::Value count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveNocompleteOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveNocompleteSharedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierArriveNocompleteSharedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierArriveNocompleteSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierArriveNocompleteSharedOpGenericAdaptorBase(MBarrierArriveNocompleteSharedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierArriveNocompleteSharedOpGenericAdaptor : public detail::MBarrierArriveNocompleteSharedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierArriveNocompleteSharedOpGenericAdaptorBase; +public: + MBarrierArriveNocompleteSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierArriveNocompleteSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierArriveNocompleteSharedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierArriveNocompleteSharedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getCount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierArriveNocompleteSharedOpAdaptor : public MBarrierArriveNocompleteSharedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierArriveNocompleteSharedOpGenericAdaptor::MBarrierArriveNocompleteSharedOpGenericAdaptor; + MBarrierArriveNocompleteSharedOpAdaptor(MBarrierArriveNocompleteSharedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierArriveNocompleteSharedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierArriveNocompleteSharedOpAdaptor; + template + using GenericAdaptor = MBarrierArriveNocompleteSharedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.arrive.nocomplete.shared"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::TypedValue<::mlir::IntegerType> getCount(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, ::mlir::Value count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveNocompleteSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierArriveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierArriveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierArriveOpGenericAdaptorBase(MBarrierArriveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierArriveOpGenericAdaptor : public detail::MBarrierArriveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierArriveOpGenericAdaptorBase; +public: + MBarrierArriveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierArriveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierArriveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierArriveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierArriveOpAdaptor : public MBarrierArriveOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierArriveOpGenericAdaptor::MBarrierArriveOpGenericAdaptor; + MBarrierArriveOpAdaptor(MBarrierArriveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierArriveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierArriveOpAdaptor; + template + using GenericAdaptor = MBarrierArriveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.arrive"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::OpOperand &getAddrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierArriveSharedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierArriveSharedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierArriveSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierArriveSharedOpGenericAdaptorBase(MBarrierArriveSharedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierArriveSharedOpGenericAdaptor : public detail::MBarrierArriveSharedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierArriveSharedOpGenericAdaptorBase; +public: + MBarrierArriveSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierArriveSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierArriveSharedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierArriveSharedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierArriveSharedOpAdaptor : public MBarrierArriveSharedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierArriveSharedOpGenericAdaptor::MBarrierArriveSharedOpGenericAdaptor; + MBarrierArriveSharedOpAdaptor(MBarrierArriveSharedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierArriveSharedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierArriveSharedOpAdaptor; + template + using GenericAdaptor = MBarrierArriveSharedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.arrive.shared"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::OpOperand &getAddrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierArriveSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierInitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierInitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierInitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierInitOpGenericAdaptorBase(MBarrierInitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierInitOpGenericAdaptor : public detail::MBarrierInitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierInitOpGenericAdaptorBase; +public: + MBarrierInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierInitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierInitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getCount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierInitOpAdaptor : public MBarrierInitOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierInitOpGenericAdaptor::MBarrierInitOpGenericAdaptor; + MBarrierInitOpAdaptor(MBarrierInitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierInitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierInitOpAdaptor; + template + using GenericAdaptor = MBarrierInitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.init"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::TypedValue<::mlir::IntegerType> getCount(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierInitOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierInitSharedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierInitSharedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierInitSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierInitSharedOpGenericAdaptorBase(MBarrierInitSharedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierInitSharedOpGenericAdaptor : public detail::MBarrierInitSharedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierInitSharedOpGenericAdaptorBase; +public: + MBarrierInitSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierInitSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierInitSharedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierInitSharedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getCount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierInitSharedOpAdaptor : public MBarrierInitSharedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierInitSharedOpGenericAdaptor::MBarrierInitSharedOpGenericAdaptor; + MBarrierInitSharedOpAdaptor(MBarrierInitSharedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierInitSharedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierInitSharedOpAdaptor; + template + using GenericAdaptor = MBarrierInitSharedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.init.shared"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::TypedValue<::mlir::IntegerType> getCount(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierInitSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierInvalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierInvalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierInvalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierInvalOpGenericAdaptorBase(MBarrierInvalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierInvalOpGenericAdaptor : public detail::MBarrierInvalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierInvalOpGenericAdaptorBase; +public: + MBarrierInvalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierInvalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierInvalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierInvalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierInvalOpAdaptor : public MBarrierInvalOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierInvalOpGenericAdaptor::MBarrierInvalOpGenericAdaptor; + MBarrierInvalOpAdaptor(MBarrierInvalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierInvalOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierInvalOpAdaptor; + template + using GenericAdaptor = MBarrierInvalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.inval"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::OpOperand &getAddrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierInvalOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierInvalSharedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierInvalSharedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierInvalSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierInvalSharedOpGenericAdaptorBase(MBarrierInvalSharedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierInvalSharedOpGenericAdaptor : public detail::MBarrierInvalSharedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierInvalSharedOpGenericAdaptorBase; +public: + MBarrierInvalSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierInvalSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierInvalSharedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierInvalSharedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierInvalSharedOpAdaptor : public MBarrierInvalSharedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierInvalSharedOpGenericAdaptor::MBarrierInvalSharedOpGenericAdaptor; + MBarrierInvalSharedOpAdaptor(MBarrierInvalSharedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierInvalSharedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierInvalSharedOpAdaptor; + template + using GenericAdaptor = MBarrierInvalSharedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.inval.shared"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::OpOperand &getAddrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierInvalSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierTestWaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierTestWaitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierTestWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierTestWaitOpGenericAdaptorBase(MBarrierTestWaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierTestWaitOpGenericAdaptor : public detail::MBarrierTestWaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierTestWaitOpGenericAdaptorBase; +public: + MBarrierTestWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierTestWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierTestWaitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierTestWaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getState() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierTestWaitOpAdaptor : public MBarrierTestWaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierTestWaitOpGenericAdaptor::MBarrierTestWaitOpGenericAdaptor; + MBarrierTestWaitOpAdaptor(MBarrierTestWaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierTestWaitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierTestWaitOpAdaptor; + template + using GenericAdaptor = MBarrierTestWaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.test.wait"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::Value getState(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getStateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, ::mlir::Value state); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value state); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierTestWaitOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierTestWaitSharedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierTestWaitSharedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierTestWaitSharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierTestWaitSharedOpGenericAdaptorBase(MBarrierTestWaitSharedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierTestWaitSharedOpGenericAdaptor : public detail::MBarrierTestWaitSharedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierTestWaitSharedOpGenericAdaptorBase; +public: + MBarrierTestWaitSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierTestWaitSharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierTestWaitSharedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierTestWaitSharedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getState() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierTestWaitSharedOpAdaptor : public MBarrierTestWaitSharedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierTestWaitSharedOpGenericAdaptor::MBarrierTestWaitSharedOpGenericAdaptor; + MBarrierTestWaitSharedOpAdaptor(MBarrierTestWaitSharedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierTestWaitSharedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierTestWaitSharedOpAdaptor; + template + using GenericAdaptor = MBarrierTestWaitSharedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.test.wait.shared"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::Value getState(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getStateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, ::mlir::Value state); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value state); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierTestWaitSharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierTryWaitParityOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierTryWaitParityOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierTryWaitParityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierTryWaitParityOpGenericAdaptorBase(MBarrierTryWaitParityOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierTryWaitParityOpGenericAdaptor : public detail::MBarrierTryWaitParityOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierTryWaitParityOpGenericAdaptorBase; +public: + MBarrierTryWaitParityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierTryWaitParityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierTryWaitParityOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierTryWaitParityOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getPhase() { + return (*getODSOperands(1).begin()); + } + + ValueT getTicks() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierTryWaitParityOpAdaptor : public MBarrierTryWaitParityOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierTryWaitParityOpGenericAdaptor::MBarrierTryWaitParityOpGenericAdaptor; + MBarrierTryWaitParityOpAdaptor(MBarrierTryWaitParityOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierTryWaitParityOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, BasicPtxBuilderInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierTryWaitParityOpAdaptor; + template + using GenericAdaptor = MBarrierTryWaitParityOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.try_wait.parity"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::TypedValue<::mlir::IntegerType> getPhase(); + ::mlir::TypedValue<::mlir::IntegerType> getTicks(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getPhaseMutable(); + ::mlir::OpOperand &getTicksMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value phase, ::mlir::Value ticks); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value phase, ::mlir::Value ticks); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierTryWaitParityOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MBarrierTryWaitParitySharedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierTryWaitParitySharedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierTryWaitParitySharedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierTryWaitParitySharedOpGenericAdaptorBase(MBarrierTryWaitParitySharedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierTryWaitParitySharedOpGenericAdaptor : public detail::MBarrierTryWaitParitySharedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierTryWaitParitySharedOpGenericAdaptorBase; +public: + MBarrierTryWaitParitySharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierTryWaitParitySharedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierTryWaitParitySharedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierTryWaitParitySharedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAddr() { + return (*getODSOperands(0).begin()); + } + + ValueT getPhase() { + return (*getODSOperands(1).begin()); + } + + ValueT getTicks() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierTryWaitParitySharedOpAdaptor : public MBarrierTryWaitParitySharedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierTryWaitParitySharedOpGenericAdaptor::MBarrierTryWaitParitySharedOpGenericAdaptor; + MBarrierTryWaitParitySharedOpAdaptor(MBarrierTryWaitParitySharedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierTryWaitParitySharedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, BasicPtxBuilderInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierTryWaitParitySharedOpAdaptor; + template + using GenericAdaptor = MBarrierTryWaitParitySharedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mbarrier.try_wait.parity.shared"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAddr(); + ::mlir::TypedValue<::mlir::IntegerType> getPhase(); + ::mlir::TypedValue<::mlir::IntegerType> getTicks(); + ::mlir::OpOperand &getAddrMutable(); + ::mlir::OpOperand &getPhaseMutable(); + ::mlir::OpOperand &getTicksMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value phase, ::mlir::Value ticks); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value phase, ::mlir::Value ticks); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MBarrierTryWaitParitySharedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::MmaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MmaOpGenericAdaptorBase { +public: + struct Properties { + using b1OpTy = ::mlir::NVVM::MMAB1OpAttr; + b1OpTy b1Op; + + auto getB1Op() { + auto &propStorage = this->b1Op; + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMAB1OpAttr>(propStorage); + } + void setB1Op(const ::mlir::NVVM::MMAB1OpAttr &propValue) { + this->b1Op = propValue; + } + using intOverflowBehaviorTy = ::mlir::NVVM::MMAIntOverflowAttr; + intOverflowBehaviorTy intOverflowBehavior; + + auto getIntOverflowBehavior() { + auto &propStorage = this->intOverflowBehavior; + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMAIntOverflowAttr>(propStorage); + } + void setIntOverflowBehavior(const ::mlir::NVVM::MMAIntOverflowAttr &propValue) { + this->intOverflowBehavior = propValue; + } + using layoutATy = ::mlir::NVVM::MMALayoutAttr; + layoutATy layoutA; + + auto getLayoutA() { + auto &propStorage = this->layoutA; + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(propStorage); + } + void setLayoutA(const ::mlir::NVVM::MMALayoutAttr &propValue) { + this->layoutA = propValue; + } + using layoutBTy = ::mlir::NVVM::MMALayoutAttr; + layoutBTy layoutB; + + auto getLayoutB() { + auto &propStorage = this->layoutB; + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(propStorage); + } + void setLayoutB(const ::mlir::NVVM::MMALayoutAttr &propValue) { + this->layoutB = propValue; + } + using multiplicandAPtxTypeTy = ::mlir::NVVM::MMATypesAttr; + multiplicandAPtxTypeTy multiplicandAPtxType; + + auto getMultiplicandAPtxType() { + auto &propStorage = this->multiplicandAPtxType; + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMATypesAttr>(propStorage); + } + void setMultiplicandAPtxType(const ::mlir::NVVM::MMATypesAttr &propValue) { + this->multiplicandAPtxType = propValue; + } + using multiplicandBPtxTypeTy = ::mlir::NVVM::MMATypesAttr; + multiplicandBPtxTypeTy multiplicandBPtxType; + + auto getMultiplicandBPtxType() { + auto &propStorage = this->multiplicandBPtxType; + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMATypesAttr>(propStorage); + } + void setMultiplicandBPtxType(const ::mlir::NVVM::MMATypesAttr &propValue) { + this->multiplicandBPtxType = propValue; + } + using shapeTy = ::mlir::NVVM::MMAShapeAttr; + shapeTy shape; + + auto getShape() { + auto &propStorage = this->shape; + return ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(propStorage); + } + void setShape(const ::mlir::NVVM::MMAShapeAttr &propValue) { + this->shape = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.b1Op == this->b1Op && + rhs.intOverflowBehavior == this->intOverflowBehavior && + rhs.layoutA == this->layoutA && + rhs.layoutB == this->layoutB && + rhs.multiplicandAPtxType == this->multiplicandAPtxType && + rhs.multiplicandBPtxType == this->multiplicandBPtxType && + rhs.shape == this->shape && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MmaOpGenericAdaptorBase(MmaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::NVVM::MMAShapeAttr getShapeAttr(); + ::mlir::NVVM::MMAShapeAttr getShape(); + ::mlir::NVVM::MMAB1OpAttr getB1OpAttr(); + ::std::optional<::mlir::NVVM::MMAB1Op> getB1Op(); + ::mlir::NVVM::MMAIntOverflowAttr getIntOverflowBehaviorAttr(); + ::std::optional<::mlir::NVVM::MMAIntOverflow> getIntOverflowBehavior(); + ::mlir::NVVM::MMALayoutAttr getLayoutAAttr(); + ::mlir::NVVM::MMALayout getLayoutA(); + ::mlir::NVVM::MMALayoutAttr getLayoutBAttr(); + ::mlir::NVVM::MMALayout getLayoutB(); + ::mlir::NVVM::MMATypesAttr getMultiplicandAPtxTypeAttr(); + ::std::optional<::mlir::NVVM::MMATypes> getMultiplicandAPtxType(); + ::mlir::NVVM::MMATypesAttr getMultiplicandBPtxTypeAttr(); + ::std::optional<::mlir::NVVM::MMATypes> getMultiplicandBPtxType(); +}; +} // namespace detail +template +class MmaOpGenericAdaptor : public detail::MmaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MmaOpGenericAdaptorBase; +public: + MmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MmaOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MmaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperandA() { + return getODSOperands(0); + } + + RangeT getOperandB() { + return getODSOperands(1); + } + + RangeT getOperandC() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MmaOpAdaptor : public MmaOpGenericAdaptor<::mlir::ValueRange> { +public: + using MmaOpGenericAdaptor::MmaOpGenericAdaptor; + MmaOpAdaptor(MmaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MmaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MmaOpAdaptor; + template + using GenericAdaptor = MmaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("b1Op"), ::llvm::StringRef("intOverflowBehavior"), ::llvm::StringRef("layoutA"), ::llvm::StringRef("layoutB"), ::llvm::StringRef("multiplicandAPtxType"), ::llvm::StringRef("multiplicandBPtxType"), ::llvm::StringRef("shape"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getB1OpAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getB1OpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIntOverflowBehaviorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIntOverflowBehaviorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLayoutAAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLayoutAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLayoutBAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLayoutBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getMultiplicandAPtxTypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getMultiplicandAPtxTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getMultiplicandBPtxTypeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getMultiplicandBPtxTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.mma.sync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperandA(); + ::mlir::Operation::operand_range getOperandB(); + ::mlir::Operation::operand_range getOperandC(); + ::mlir::MutableOperandRange getOperandAMutable(); + ::mlir::MutableOperandRange getOperandBMutable(); + ::mlir::MutableOperandRange getOperandCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::NVVM::MMAShapeAttr getShapeAttr(); + ::mlir::NVVM::MMAShapeAttr getShape(); + ::mlir::NVVM::MMAB1OpAttr getB1OpAttr(); + ::std::optional<::mlir::NVVM::MMAB1Op> getB1Op(); + ::mlir::NVVM::MMAIntOverflowAttr getIntOverflowBehaviorAttr(); + ::std::optional<::mlir::NVVM::MMAIntOverflow> getIntOverflowBehavior(); + ::mlir::NVVM::MMALayoutAttr getLayoutAAttr(); + ::mlir::NVVM::MMALayout getLayoutA(); + ::mlir::NVVM::MMALayoutAttr getLayoutBAttr(); + ::mlir::NVVM::MMALayout getLayoutB(); + ::mlir::NVVM::MMATypesAttr getMultiplicandAPtxTypeAttr(); + ::std::optional<::mlir::NVVM::MMATypes> getMultiplicandAPtxType(); + ::mlir::NVVM::MMATypesAttr getMultiplicandBPtxTypeAttr(); + ::std::optional<::mlir::NVVM::MMATypes> getMultiplicandBPtxType(); + void setShapeAttr(::mlir::NVVM::MMAShapeAttr attr); + void setB1OpAttr(::mlir::NVVM::MMAB1OpAttr attr); + void setB1Op(::std::optional<::mlir::NVVM::MMAB1Op> attrValue); + void setIntOverflowBehaviorAttr(::mlir::NVVM::MMAIntOverflowAttr attr); + void setIntOverflowBehavior(::std::optional<::mlir::NVVM::MMAIntOverflow> attrValue); + void setLayoutAAttr(::mlir::NVVM::MMALayoutAttr attr); + void setLayoutA(::mlir::NVVM::MMALayout attrValue); + void setLayoutBAttr(::mlir::NVVM::MMALayoutAttr attr); + void setLayoutB(::mlir::NVVM::MMALayout attrValue); + void setMultiplicandAPtxTypeAttr(::mlir::NVVM::MMATypesAttr attr); + void setMultiplicandAPtxType(::std::optional<::mlir::NVVM::MMATypes> attrValue); + void setMultiplicandBPtxTypeAttr(::mlir::NVVM::MMATypesAttr attr); + void setMultiplicandBPtxType(::std::optional<::mlir::NVVM::MMATypes> attrValue); + ::mlir::Attribute removeB1OpAttr(); + ::mlir::Attribute removeIntOverflowBehaviorAttr(); + ::mlir::Attribute removeMultiplicandAPtxTypeAttr(); + ::mlir::Attribute removeMultiplicandBPtxTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, ValueRange operandA, ValueRange operandB, ValueRange operandC, ArrayRef shape, std::optional b1Op, std::optional intOverflow, std::optional> multiplicandPtxTypes, std::optional> multiplicandLayouts); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::NVVM::MMAShapeAttr shape, /*optional*/::mlir::NVVM::MMAB1OpAttr b1Op, /*optional*/::mlir::NVVM::MMAIntOverflowAttr intOverflowBehavior, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandAPtxType, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandBPtxType, ::mlir::ValueRange operandA, ::mlir::ValueRange operandB, ::mlir::ValueRange operandC); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::NVVM::MMAShapeAttr shape, /*optional*/::mlir::NVVM::MMAB1OpAttr b1Op, /*optional*/::mlir::NVVM::MMAIntOverflowAttr intOverflowBehavior, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandAPtxType, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandBPtxType, ::mlir::ValueRange operandA, ::mlir::ValueRange operandB, ::mlir::ValueRange operandC); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::NVVM::MMAShapeAttr shape, /*optional*/::mlir::NVVM::MMAB1OpAttr b1Op, /*optional*/::mlir::NVVM::MMAIntOverflowAttr intOverflowBehavior, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandAPtxType, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandBPtxType, ::mlir::ValueRange operandA, ::mlir::ValueRange operandB, ::mlir::ValueRange operandC); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::NVVM::MMAShapeAttr shape, /*optional*/::mlir::NVVM::MMAB1OpAttr b1Op, /*optional*/::mlir::NVVM::MMAIntOverflowAttr intOverflowBehavior, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandAPtxType, /*optional*/::mlir::NVVM::MMATypesAttr multiplicandBPtxType, ::mlir::ValueRange operandA, ::mlir::ValueRange operandB, ::mlir::ValueRange operandC); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static llvm::Intrinsic::ID getIntrinsicID( + int64_t m, int64_t n, uint64_t k, + std::optional b1Op, + std::optional sat, + mlir::NVVM::MMALayout layoutAEnum, mlir::NVVM::MMALayout layoutBEnum, + mlir::NVVM::MMATypes eltypeAEnum, mlir::NVVM::MMATypes eltypeBEnum, + mlir::NVVM::MMATypes eltypeCEnum, mlir::NVVM::MMATypes eltypeDEnum) { + llvm::StringRef layoutA = stringifyEnum(layoutAEnum); + llvm::StringRef layoutB = stringifyEnum(layoutBEnum); + llvm::StringRef eltypeA = stringifyEnum(eltypeAEnum); + llvm::StringRef eltypeB = stringifyEnum(eltypeBEnum); + llvm::StringRef eltypeC = stringifyEnum(eltypeCEnum); + llvm::StringRef eltypeD = stringifyEnum(eltypeDEnum); + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 4 && "tf32" == eltypeA && "tf32" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k4_row_col_tf32; + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 8 && "tf32" == eltypeA && "tf32" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k8_row_col_tf32; + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "bf16" == eltypeA && "bf16" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_bf16; + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 8 && "bf16" == eltypeA && "bf16" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k8_row_col_bf16; + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 4 && "f64" == eltypeA && "f64" == eltypeB && "f64" == eltypeC && "f64" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_row_col_f64; + + + + + + if (layoutA == "row" && layoutB == "row" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f16" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_row_row_f16_f16; + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f16" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_row_col_f16_f16; + + if (layoutA == "col" && layoutB == "row" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f16" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_col_row_f16_f16; + + if (layoutA == "col" && layoutB == "col" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f16" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_col_col_f16_f16; + + if (layoutA == "row" && layoutB == "row" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_row_row_f32_f16; + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_row_col_f32_f16; + + if (layoutA == "col" && layoutB == "row" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_col_row_f32_f16; + + if (layoutA == "col" && layoutB == "col" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_col_col_f32_f16; + + + + + + + + + + if (layoutA == "row" && layoutB == "row" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_row_row_f32_f32; + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_row_col_f32_f32; + + if (layoutA == "col" && layoutB == "row" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_col_row_f32_f32; + + if (layoutA == "col" && layoutB == "col" && m == 8 && n == 8 && k == 4 && "f16" == eltypeA && "f16" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k4_col_col_f32_f32; + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 8 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f16" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k8_row_col_f16_f16; + + + + + + + + + + + + + + + + + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 8 && "f16" == eltypeA && "f16" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k8_row_col_f32_f32; + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f16" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_f16_f16; + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "f16" == eltypeA && "f16" == eltypeB && "f16" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_f32_f16; + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "f16" == eltypeA && "f16" == eltypeB && "f32" == eltypeC && "f16" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_f16_f32; + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "f16" == eltypeA && "f16" == eltypeB && "f32" == eltypeC && "f32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_f32_f32; + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 16 && "s8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k16_row_col_s8; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 16 && "s8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k16_row_col_satfinite_s8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 16 && "s8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k16_row_col_s8_u8; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 16 && "s8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k16_row_col_satfinite_s8_u8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 16 && "u8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k16_row_col_u8_s8; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 16 && "u8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k16_row_col_satfinite_u8_s8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 16 && "u8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k16_row_col_u8; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 16 && "u8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k16_row_col_satfinite_u8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "s8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_s8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "s8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_satfinite_s8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "s8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_s8_u8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "s8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_satfinite_s8_u8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "u8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_u8_s8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "u8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_satfinite_u8_s8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "u8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_u8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 16 && "u8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k16_row_col_satfinite_u8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "s8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_s8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "s8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_satfinite_s8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "s8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_s8_u8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "s8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_satfinite_s8_u8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "u8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_u8_s8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "u8" == eltypeA && "s8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_satfinite_u8_s8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "u8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_u8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "u8" == eltypeA && "u8" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_satfinite_u8; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 32 && "s4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k32_row_col_s4; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 32 && "s4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k32_row_col_satfinite_s4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 32 && "s4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k32_row_col_s4_u4; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 32 && "s4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k32_row_col_satfinite_s4_u4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 32 && "u4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k32_row_col_u4_s4; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 32 && "u4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k32_row_col_satfinite_u4_s4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 32 && "u4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k32_row_col_u4; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 32 && "u4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m8n8k32_row_col_satfinite_u4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "s4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_s4; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "s4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_satfinite_s4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "s4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_s4_u4; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "s4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_satfinite_s4_u4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "u4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_u4_s4; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "u4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_satfinite_u4_s4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "u4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_u4; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 32 && "u4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k32_row_col_satfinite_u4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 64 && "s4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k64_row_col_s4; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 64 && "s4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k64_row_col_satfinite_s4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 64 && "s4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k64_row_col_s4_u4; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 64 && "s4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k64_row_col_satfinite_s4_u4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 64 && "u4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k64_row_col_u4_s4; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 64 && "u4" == eltypeA && "s4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k64_row_col_satfinite_u4_s4; + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 64 && "u4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k64_row_col_u4; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 64 && "u4" == eltypeA && "u4" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 1 == static_cast(*sat) : true)) + return llvm::Intrinsic::nvvm_mma_m16n8k64_row_col_satfinite_u4; + + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 128 && "b1" == eltypeA && "b1" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true) && (b1Op.has_value() ? MMAB1Op::xor_popc == *b1Op : true)) + return llvm::Intrinsic::nvvm_mma_xor_popc_m8n8k128_row_col_b1; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 8 && k == 128 && "b1" == eltypeA && "b1" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true) && (b1Op.has_value() ? MMAB1Op::and_popc == *b1Op : true)) + return llvm::Intrinsic::nvvm_mma_and_popc_m8n8k128_row_col_b1; + + + + + + + + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 128 && "b1" == eltypeA && "b1" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true) && (b1Op.has_value() ? MMAB1Op::xor_popc == *b1Op : true)) + return llvm::Intrinsic::nvvm_mma_xor_popc_m16n8k128_row_col_b1; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 128 && "b1" == eltypeA && "b1" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true) && (b1Op.has_value() ? MMAB1Op::and_popc == *b1Op : true)) + return llvm::Intrinsic::nvvm_mma_and_popc_m16n8k128_row_col_b1; + + + + + + + + + + + + + + + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 256 && "b1" == eltypeA && "b1" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true) && (b1Op.has_value() ? MMAB1Op::xor_popc == *b1Op : true)) + return llvm::Intrinsic::nvvm_mma_xor_popc_m16n8k256_row_col_b1; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 8 && k == 256 && "b1" == eltypeA && "b1" == eltypeB && "s32" == eltypeC && "s32" == eltypeD && (sat.has_value() ? 0 == static_cast(*sat) : true) && (b1Op.has_value() ? MMAB1Op::and_popc == *b1Op : true)) + return llvm::Intrinsic::nvvm_mma_and_popc_m16n8k256_row_col_b1; + + + + + + + + + + + return 0; + } + + static std::optional inferOperandMMAType(Type operandElType, + bool isAccumulator); + + MMATypes accumPtxType(); + MMATypes resultPtxType(); + }; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MmaOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::RcpApproxFtzF32Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RcpApproxFtzF32OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RcpApproxFtzF32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RcpApproxFtzF32OpGenericAdaptorBase(RcpApproxFtzF32Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RcpApproxFtzF32OpGenericAdaptor : public detail::RcpApproxFtzF32OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RcpApproxFtzF32OpGenericAdaptorBase; +public: + RcpApproxFtzF32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RcpApproxFtzF32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RcpApproxFtzF32OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RcpApproxFtzF32OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RcpApproxFtzF32OpAdaptor : public RcpApproxFtzF32OpGenericAdaptor<::mlir::ValueRange> { +public: + using RcpApproxFtzF32OpGenericAdaptor::RcpApproxFtzF32OpGenericAdaptor; + RcpApproxFtzF32OpAdaptor(RcpApproxFtzF32Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RcpApproxFtzF32Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RcpApproxFtzF32OpAdaptor; + template + using GenericAdaptor = RcpApproxFtzF32OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.rcp.approx.ftz.f"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::RcpApproxFtzF32Op) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ReduxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduxOpGenericAdaptorBase { +public: + struct Properties { + using kindTy = ::mlir::NVVM::ReduxKindAttr; + kindTy kind; + + auto getKind() { + auto &propStorage = this->kind; + return ::llvm::cast<::mlir::NVVM::ReduxKindAttr>(propStorage); + } + void setKind(const ::mlir::NVVM::ReduxKindAttr &propValue) { + this->kind = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.kind == this->kind && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReduxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduxOpGenericAdaptorBase(ReduxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::NVVM::ReduxKindAttr getKindAttr(); + ::mlir::NVVM::ReduxKind getKind(); +}; +} // namespace detail +template +class ReduxOpGenericAdaptor : public detail::ReduxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduxOpGenericAdaptorBase; +public: + ReduxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReduxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVal() { + return (*getODSOperands(0).begin()); + } + + ValueT getMaskAndClamp() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduxOpAdaptor : public ReduxOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduxOpGenericAdaptor::ReduxOpGenericAdaptor; + ReduxOpAdaptor(ReduxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduxOpAdaptor; + template + using GenericAdaptor = ReduxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("kind")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKindAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKindAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.redux.sync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVal(); + ::mlir::TypedValue<::mlir::IntegerType> getMaskAndClamp(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getMaskAndClampMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::NVVM::ReduxKindAttr getKindAttr(); + ::mlir::NVVM::ReduxKind getKind(); + void setKindAttr(::mlir::NVVM::ReduxKindAttr attr); + void setKind(::mlir::NVVM::ReduxKind attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::NVVM::ReduxKindAttr kind, ::mlir::Value mask_and_clamp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::NVVM::ReduxKindAttr kind, ::mlir::Value mask_and_clamp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value val, ::mlir::NVVM::ReduxKind kind, ::mlir::Value mask_and_clamp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val, ::mlir::NVVM::ReduxKind kind, ::mlir::Value mask_and_clamp); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ReduxOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ShflOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShflOpGenericAdaptorBase { +public: + struct Properties { + using kindTy = ::mlir::NVVM::ShflKindAttr; + kindTy kind; + + auto getKind() { + auto &propStorage = this->kind; + return ::llvm::cast<::mlir::NVVM::ShflKindAttr>(propStorage); + } + void setKind(const ::mlir::NVVM::ShflKindAttr &propValue) { + this->kind = propValue; + } + using return_value_and_is_validTy = ::mlir::UnitAttr; + return_value_and_is_validTy return_value_and_is_valid; + + auto getReturnValueAndIsValid() { + auto &propStorage = this->return_value_and_is_valid; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setReturnValueAndIsValid(const ::mlir::UnitAttr &propValue) { + this->return_value_and_is_valid = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.kind == this->kind && + rhs.return_value_and_is_valid == this->return_value_and_is_valid && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ShflOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ShflOpGenericAdaptorBase(ShflOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::NVVM::ShflKindAttr getKindAttr(); + ::mlir::NVVM::ShflKind getKind(); + ::mlir::UnitAttr getReturnValueAndIsValidAttr(); + ::std::optional getReturnValueAndIsValid(); +}; +} // namespace detail +template +class ShflOpGenericAdaptor : public detail::ShflOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShflOpGenericAdaptorBase; +public: + ShflOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShflOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShflOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ShflOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDst() { + return (*getODSOperands(0).begin()); + } + + ValueT getVal() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMaskAndClamp() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShflOpAdaptor : public ShflOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShflOpGenericAdaptor::ShflOpGenericAdaptor; + ShflOpAdaptor(ShflOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShflOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShflOpAdaptor; + template + using GenericAdaptor = ShflOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("kind"), ::llvm::StringRef("return_value_and_is_valid")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKindAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKindAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getReturnValueAndIsValidAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getReturnValueAndIsValidAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.shfl.sync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getDst(); + ::mlir::Value getVal(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getMaskAndClamp(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::OpOperand &getValMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMaskAndClampMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::NVVM::ShflKindAttr getKindAttr(); + ::mlir::NVVM::ShflKind getKind(); + ::mlir::UnitAttr getReturnValueAndIsValidAttr(); + ::std::optional getReturnValueAndIsValid(); + void setKindAttr(::mlir::NVVM::ShflKindAttr attr); + void setKind(::mlir::NVVM::ShflKind attrValue); + void setReturnValueAndIsValidAttr(::mlir::UnitAttr attr); + void setReturnValueAndIsValid(bool attrValue); + ::mlir::Attribute removeReturnValueAndIsValidAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value offset, ::mlir::Value mask_and_clamp, ::mlir::NVVM::ShflKindAttr kind, /*optional*/::mlir::UnitAttr return_value_and_is_valid); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value offset, ::mlir::Value mask_and_clamp, ::mlir::NVVM::ShflKindAttr kind, /*optional*/::mlir::UnitAttr return_value_and_is_valid); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value offset, ::mlir::Value mask_and_clamp, ::mlir::NVVM::ShflKind kind, /*optional*/::mlir::UnitAttr return_value_and_is_valid); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value val, ::mlir::Value offset, ::mlir::Value mask_and_clamp, ::mlir::NVVM::ShflKind kind, /*optional*/::mlir::UnitAttr return_value_and_is_valid); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ShflOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::SyncWarpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SyncWarpOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SyncWarpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SyncWarpOpGenericAdaptorBase(SyncWarpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SyncWarpOpGenericAdaptor : public detail::SyncWarpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SyncWarpOpGenericAdaptorBase; +public: + SyncWarpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SyncWarpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SyncWarpOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SyncWarpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SyncWarpOpAdaptor : public SyncWarpOpGenericAdaptor<::mlir::ValueRange> { +public: + using SyncWarpOpGenericAdaptor::SyncWarpOpGenericAdaptor; + SyncWarpOpAdaptor(SyncWarpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SyncWarpOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SyncWarpOpAdaptor; + template + using GenericAdaptor = SyncWarpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.bar.warp.sync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getMask(); + ::mlir::OpOperand &getMaskMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::SyncWarpOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ThreadIdXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ThreadIdXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ThreadIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ThreadIdXOpGenericAdaptorBase(ThreadIdXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ThreadIdXOpGenericAdaptor : public detail::ThreadIdXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ThreadIdXOpGenericAdaptorBase; +public: + ThreadIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ThreadIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ThreadIdXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ThreadIdXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ThreadIdXOpAdaptor : public ThreadIdXOpGenericAdaptor<::mlir::ValueRange> { +public: + using ThreadIdXOpGenericAdaptor::ThreadIdXOpGenericAdaptor; + ThreadIdXOpAdaptor(ThreadIdXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ThreadIdXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ThreadIdXOpAdaptor; + template + using GenericAdaptor = ThreadIdXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.tid.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ThreadIdXOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ThreadIdYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ThreadIdYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ThreadIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ThreadIdYOpGenericAdaptorBase(ThreadIdYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ThreadIdYOpGenericAdaptor : public detail::ThreadIdYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ThreadIdYOpGenericAdaptorBase; +public: + ThreadIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ThreadIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ThreadIdYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ThreadIdYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ThreadIdYOpAdaptor : public ThreadIdYOpGenericAdaptor<::mlir::ValueRange> { +public: + using ThreadIdYOpGenericAdaptor::ThreadIdYOpGenericAdaptor; + ThreadIdYOpAdaptor(ThreadIdYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ThreadIdYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ThreadIdYOpAdaptor; + template + using GenericAdaptor = ThreadIdYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.tid.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ThreadIdYOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::ThreadIdZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ThreadIdZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ThreadIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ThreadIdZOpGenericAdaptorBase(ThreadIdZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ThreadIdZOpGenericAdaptor : public detail::ThreadIdZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ThreadIdZOpGenericAdaptorBase; +public: + ThreadIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ThreadIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ThreadIdZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ThreadIdZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ThreadIdZOpAdaptor : public ThreadIdZOpGenericAdaptor<::mlir::ValueRange> { +public: + using ThreadIdZOpGenericAdaptor::ThreadIdZOpGenericAdaptor; + ThreadIdZOpAdaptor(ThreadIdZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ThreadIdZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ThreadIdZOpAdaptor; + template + using GenericAdaptor = ThreadIdZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.tid.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ThreadIdZOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::VoteBallotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VoteBallotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VoteBallotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VoteBallotOpGenericAdaptorBase(VoteBallotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VoteBallotOpGenericAdaptor : public detail::VoteBallotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VoteBallotOpGenericAdaptorBase; +public: + VoteBallotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VoteBallotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VoteBallotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VoteBallotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMask() { + return (*getODSOperands(0).begin()); + } + + ValueT getPred() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VoteBallotOpAdaptor : public VoteBallotOpGenericAdaptor<::mlir::ValueRange> { +public: + using VoteBallotOpGenericAdaptor::VoteBallotOpGenericAdaptor; + VoteBallotOpAdaptor(VoteBallotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VoteBallotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = VoteBallotOpAdaptor; + template + using GenericAdaptor = VoteBallotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.vote.ballot.sync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getMask(); + ::mlir::Value getPred(); + ::mlir::OpOperand &getMaskMutable(); + ::mlir::OpOperand &getPredMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value mask, ::mlir::Value pred); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value mask, ::mlir::Value pred); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::VoteBallotOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WMMALoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WMMALoadOpGenericAdaptorBase { +public: + struct Properties { + using eltypeTy = ::mlir::NVVM::MMATypesAttr; + eltypeTy eltype; + + auto getEltype() { + auto &propStorage = this->eltype; + return ::llvm::cast<::mlir::NVVM::MMATypesAttr>(propStorage); + } + void setEltype(const ::mlir::NVVM::MMATypesAttr &propValue) { + this->eltype = propValue; + } + using fragTy = ::mlir::NVVM::MMAFragAttr; + fragTy frag; + + auto getFrag() { + auto &propStorage = this->frag; + return ::llvm::cast<::mlir::NVVM::MMAFragAttr>(propStorage); + } + void setFrag(const ::mlir::NVVM::MMAFragAttr &propValue) { + this->frag = propValue; + } + using kTy = ::mlir::IntegerAttr; + kTy k; + + auto getK() { + auto &propStorage = this->k; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setK(const ::mlir::IntegerAttr &propValue) { + this->k = propValue; + } + using layoutTy = ::mlir::NVVM::MMALayoutAttr; + layoutTy layout; + + auto getLayout() { + auto &propStorage = this->layout; + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(propStorage); + } + void setLayout(const ::mlir::NVVM::MMALayoutAttr &propValue) { + this->layout = propValue; + } + using mTy = ::mlir::IntegerAttr; + mTy m; + + auto getM() { + auto &propStorage = this->m; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setM(const ::mlir::IntegerAttr &propValue) { + this->m = propValue; + } + using nTy = ::mlir::IntegerAttr; + nTy n; + + auto getN() { + auto &propStorage = this->n; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setN(const ::mlir::IntegerAttr &propValue) { + this->n = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.eltype == this->eltype && + rhs.frag == this->frag && + rhs.k == this->k && + rhs.layout == this->layout && + rhs.m == this->m && + rhs.n == this->n && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + WMMALoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + WMMALoadOpGenericAdaptorBase(WMMALoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMAttr(); + uint32_t getM(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::IntegerAttr getKAttr(); + uint32_t getK(); + ::mlir::NVVM::MMALayoutAttr getLayoutAttr(); + ::mlir::NVVM::MMALayout getLayout(); + ::mlir::NVVM::MMATypesAttr getEltypeAttr(); + ::mlir::NVVM::MMATypes getEltype(); + ::mlir::NVVM::MMAFragAttr getFragAttr(); + ::mlir::NVVM::MMAFrag getFrag(); +}; +} // namespace detail +template +class WMMALoadOpGenericAdaptor : public detail::WMMALoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WMMALoadOpGenericAdaptorBase; +public: + WMMALoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WMMALoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WMMALoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + WMMALoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getStride() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WMMALoadOpAdaptor : public WMMALoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using WMMALoadOpGenericAdaptor::WMMALoadOpGenericAdaptor; + WMMALoadOpAdaptor(WMMALoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WMMALoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WMMALoadOpAdaptor; + template + using GenericAdaptor = WMMALoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("eltype"), ::llvm::StringRef("frag"), ::llvm::StringRef("k"), ::llvm::StringRef("layout"), ::llvm::StringRef("m"), ::llvm::StringRef("n")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEltypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEltypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFragAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFragAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLayoutAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getMAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getMAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.wmma.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::TypedValue<::mlir::IntegerType> getStride(); + ::mlir::OpOperand &getPtrMutable(); + ::mlir::OpOperand &getStrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getMAttr(); + uint32_t getM(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::IntegerAttr getKAttr(); + uint32_t getK(); + ::mlir::NVVM::MMALayoutAttr getLayoutAttr(); + ::mlir::NVVM::MMALayout getLayout(); + ::mlir::NVVM::MMATypesAttr getEltypeAttr(); + ::mlir::NVVM::MMATypes getEltype(); + ::mlir::NVVM::MMAFragAttr getFragAttr(); + ::mlir::NVVM::MMAFrag getFrag(); + void setMAttr(::mlir::IntegerAttr attr); + void setM(uint32_t attrValue); + void setNAttr(::mlir::IntegerAttr attr); + void setN(uint32_t attrValue); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint32_t attrValue); + void setLayoutAttr(::mlir::NVVM::MMALayoutAttr attr); + void setLayout(::mlir::NVVM::MMALayout attrValue); + void setEltypeAttr(::mlir::NVVM::MMATypesAttr attr); + void setEltype(::mlir::NVVM::MMATypes attrValue); + void setFragAttr(::mlir::NVVM::MMAFragAttr attr); + void setFrag(::mlir::NVVM::MMAFrag attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layout, ::mlir::NVVM::MMATypesAttr eltype, ::mlir::NVVM::MMAFragAttr frag); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value stride, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layout, ::mlir::NVVM::MMATypesAttr eltype, ::mlir::NVVM::MMAFragAttr frag); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value ptr, ::mlir::Value stride, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layout, ::mlir::NVVM::MMATypes eltype, ::mlir::NVVM::MMAFrag frag); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::Value stride, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layout, ::mlir::NVVM::MMATypes eltype, ::mlir::NVVM::MMAFrag frag); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static llvm::Intrinsic::ID getIntrinsicID(int m, int n, int k, mlir::NVVM::MMALayout layoutEnum,mlir::NVVM::MMATypes eltypeEnum,mlir::NVVM::MMAFrag fragEnum) {llvm::StringRef layout = stringifyEnum(layoutEnum);llvm::StringRef eltype = stringifyEnum(eltypeEnum);llvm::StringRef frag = stringifyEnum(fragEnum); + + if (layout == "row" && m == 16 && n == 16 && k == 16 && "f16" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_a_f16_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "f16" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_a_f16_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "s8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_a_s8_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "s8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_a_s8_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "u8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_a_u8_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "u8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_a_u8_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "f16" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_b_f16_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "f16" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_b_f16_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "s8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_b_s8_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "s8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_b_s8_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "u8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_b_u8_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "u8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_b_u8_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "f16" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_a_f16_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "f16" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_a_f16_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "s8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_a_s8_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "s8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_a_s8_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "u8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_a_u8_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "u8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_a_u8_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "f16" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_b_f16_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "f16" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_b_f16_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "s8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_b_s8_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "s8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_b_s8_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "u8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_b_u8_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "u8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_b_u8_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "f16" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_a_f16_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "f16" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_a_f16_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "s8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_a_s8_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "s8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_a_s8_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "u8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_a_u8_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "u8" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_a_u8_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "f16" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_b_f16_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "f16" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_b_f16_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "s8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_b_s8_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "s8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_b_s8_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "u8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_b_u8_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "u8" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_b_u8_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "f16" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_c_f16_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "f16" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_c_f16_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "f32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_c_f32_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "f32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_c_f32_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "s32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_c_s32_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "s32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m16n16k16_load_c_s32_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "f16" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_c_f16_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "f16" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_c_f16_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "f32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_c_f32_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "f32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_c_f32_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "s32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_c_s32_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "s32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m32n8k16_load_c_s32_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "f16" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_c_f16_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "f16" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_c_f16_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "f32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_c_f32_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "f32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_c_f32_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "s32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_c_s32_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "s32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m8n32k16_load_c_s32_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 8 && "tf32" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m16n16k8_load_a_tf32_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 8 && "tf32" == eltype && frag == "a") return llvm::Intrinsic::nvvm_wmma_m16n16k8_load_a_tf32_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 8 && "tf32" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m16n16k8_load_b_tf32_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 8 && "tf32" == eltype && frag == "b") return llvm::Intrinsic::nvvm_wmma_m16n16k8_load_b_tf32_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 8 && "f32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m16n16k8_load_c_f32_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 8 && "f32" == eltype && frag == "c") return llvm::Intrinsic::nvvm_wmma_m16n16k8_load_c_f32_col_stride; + return 0;} + /// Helpers to find valid n dimension based on mxk load shape. + static int inferNDimension(int m, int k, mlir::NVVM::MMATypes eltypeEnum) { llvm::StringRef eltype = stringifyEnum(eltypeEnum); + if (m == 16 && k == 16 && "f16" == eltype) return 16; + if (m == 16 && k == 16 && "s8" == eltype) return 16; + if (m == 16 && k == 16 && "u8" == eltype) return 16; + if (m == 32 && k == 16 && "f16" == eltype) return 8; + if (m == 32 && k == 16 && "s8" == eltype) return 8; + if (m == 32 && k == 16 && "u8" == eltype) return 8; + if (m == 8 && k == 16 && "f16" == eltype) return 32; + if (m == 8 && k == 16 && "s8" == eltype) return 32; + if (m == 8 && k == 16 && "u8" == eltype) return 32; + if (m == 16 && k == 8 && "tf32" == eltype) return 16; + return 0;} + /// Helpers to find valid m dimension based on kxn load shape. + static int inferMDimension(int k, int n, mlir::NVVM::MMATypes eltypeEnum) { llvm::StringRef eltype = stringifyEnum(eltypeEnum); + if (n == 16 && k == 16 && "f16" == eltype) return 16; + if (n == 16 && k == 16 && "s8" == eltype) return 16; + if (n == 16 && k == 16 && "u8" == eltype) return 16; + if (n == 8 && k == 16 && "f16" == eltype) return 32; + if (n == 8 && k == 16 && "s8" == eltype) return 32; + if (n == 8 && k == 16 && "u8" == eltype) return 32; + if (n == 32 && k == 16 && "f16" == eltype) return 8; + if (n == 32 && k == 16 && "s8" == eltype) return 8; + if (n == 32 && k == 16 && "u8" == eltype) return 8; + if (n == 16 && k == 8 && "tf32" == eltype) return 16; + return 0;} + /// Helpers to find valid k dimension based on mxn load shape. + static int inferKDimension(int m, int n, mlir::NVVM::MMATypes eltypeEnum) { llvm::StringRef eltype = stringifyEnum(eltypeEnum); + if (m == 16 && n == 16 && "f16" == eltype) return 16; + if (m == 16 && n == 16 && "f32" == eltype) return 16; + if (m == 16 && n == 16 && "s32" == eltype) return 16; + if (m == 32 && n == 8 && "f16" == eltype) return 16; + if (m == 32 && n == 8 && "f32" == eltype) return 16; + if (m == 32 && n == 8 && "s32" == eltype) return 16; + if (m == 8 && n == 32 && "f16" == eltype) return 16; + if (m == 8 && n == 32 && "f32" == eltype) return 16; + if (m == 8 && n == 32 && "s32" == eltype) return 16; + if (m == 16 && n == 16 && "f32" == eltype) return 8; + return 0;} +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WMMALoadOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WMMAMmaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WMMAMmaOpGenericAdaptorBase { +public: + struct Properties { + using eltypeATy = ::mlir::NVVM::MMATypesAttr; + eltypeATy eltypeA; + + auto getEltypeA() { + auto &propStorage = this->eltypeA; + return ::llvm::cast<::mlir::NVVM::MMATypesAttr>(propStorage); + } + void setEltypeA(const ::mlir::NVVM::MMATypesAttr &propValue) { + this->eltypeA = propValue; + } + using eltypeBTy = ::mlir::NVVM::MMATypesAttr; + eltypeBTy eltypeB; + + auto getEltypeB() { + auto &propStorage = this->eltypeB; + return ::llvm::cast<::mlir::NVVM::MMATypesAttr>(propStorage); + } + void setEltypeB(const ::mlir::NVVM::MMATypesAttr &propValue) { + this->eltypeB = propValue; + } + using kTy = ::mlir::IntegerAttr; + kTy k; + + auto getK() { + auto &propStorage = this->k; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setK(const ::mlir::IntegerAttr &propValue) { + this->k = propValue; + } + using layoutATy = ::mlir::NVVM::MMALayoutAttr; + layoutATy layoutA; + + auto getLayoutA() { + auto &propStorage = this->layoutA; + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(propStorage); + } + void setLayoutA(const ::mlir::NVVM::MMALayoutAttr &propValue) { + this->layoutA = propValue; + } + using layoutBTy = ::mlir::NVVM::MMALayoutAttr; + layoutBTy layoutB; + + auto getLayoutB() { + auto &propStorage = this->layoutB; + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(propStorage); + } + void setLayoutB(const ::mlir::NVVM::MMALayoutAttr &propValue) { + this->layoutB = propValue; + } + using mTy = ::mlir::IntegerAttr; + mTy m; + + auto getM() { + auto &propStorage = this->m; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setM(const ::mlir::IntegerAttr &propValue) { + this->m = propValue; + } + using nTy = ::mlir::IntegerAttr; + nTy n; + + auto getN() { + auto &propStorage = this->n; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setN(const ::mlir::IntegerAttr &propValue) { + this->n = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.eltypeA == this->eltypeA && + rhs.eltypeB == this->eltypeB && + rhs.k == this->k && + rhs.layoutA == this->layoutA && + rhs.layoutB == this->layoutB && + rhs.m == this->m && + rhs.n == this->n && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + WMMAMmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + WMMAMmaOpGenericAdaptorBase(WMMAMmaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMAttr(); + uint32_t getM(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::IntegerAttr getKAttr(); + uint32_t getK(); + ::mlir::NVVM::MMALayoutAttr getLayoutAAttr(); + ::mlir::NVVM::MMALayout getLayoutA(); + ::mlir::NVVM::MMALayoutAttr getLayoutBAttr(); + ::mlir::NVVM::MMALayout getLayoutB(); + ::mlir::NVVM::MMATypesAttr getEltypeAAttr(); + ::mlir::NVVM::MMATypes getEltypeA(); + ::mlir::NVVM::MMATypesAttr getEltypeBAttr(); + ::mlir::NVVM::MMATypes getEltypeB(); +}; +} // namespace detail +template +class WMMAMmaOpGenericAdaptor : public detail::WMMAMmaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WMMAMmaOpGenericAdaptorBase; +public: + WMMAMmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WMMAMmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WMMAMmaOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + WMMAMmaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WMMAMmaOpAdaptor : public WMMAMmaOpGenericAdaptor<::mlir::ValueRange> { +public: + using WMMAMmaOpGenericAdaptor::WMMAMmaOpGenericAdaptor; + WMMAMmaOpAdaptor(WMMAMmaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WMMAMmaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WMMAMmaOpAdaptor; + template + using GenericAdaptor = WMMAMmaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("eltypeA"), ::llvm::StringRef("eltypeB"), ::llvm::StringRef("k"), ::llvm::StringRef("layoutA"), ::llvm::StringRef("layoutB"), ::llvm::StringRef("m"), ::llvm::StringRef("n")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEltypeAAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEltypeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEltypeBAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEltypeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLayoutAAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLayoutAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLayoutBAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLayoutBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getMAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getMAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.wmma.mma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getMAttr(); + uint32_t getM(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::IntegerAttr getKAttr(); + uint32_t getK(); + ::mlir::NVVM::MMALayoutAttr getLayoutAAttr(); + ::mlir::NVVM::MMALayout getLayoutA(); + ::mlir::NVVM::MMALayoutAttr getLayoutBAttr(); + ::mlir::NVVM::MMALayout getLayoutB(); + ::mlir::NVVM::MMATypesAttr getEltypeAAttr(); + ::mlir::NVVM::MMATypes getEltypeA(); + ::mlir::NVVM::MMATypesAttr getEltypeBAttr(); + ::mlir::NVVM::MMATypes getEltypeB(); + void setMAttr(::mlir::IntegerAttr attr); + void setM(uint32_t attrValue); + void setNAttr(::mlir::IntegerAttr attr); + void setN(uint32_t attrValue); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint32_t attrValue); + void setLayoutAAttr(::mlir::NVVM::MMALayoutAttr attr); + void setLayoutA(::mlir::NVVM::MMALayout attrValue); + void setLayoutBAttr(::mlir::NVVM::MMALayoutAttr attr); + void setLayoutB(::mlir::NVVM::MMALayout attrValue); + void setEltypeAAttr(::mlir::NVVM::MMATypesAttr attr); + void setEltypeA(::mlir::NVVM::MMATypes attrValue); + void setEltypeBAttr(::mlir::NVVM::MMATypesAttr attr); + void setEltypeB(::mlir::NVVM::MMATypes attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, ::mlir::NVVM::MMATypesAttr eltypeA, ::mlir::NVVM::MMATypesAttr eltypeB, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, ::mlir::NVVM::MMATypesAttr eltypeA, ::mlir::NVVM::MMATypesAttr eltypeB, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, ::mlir::NVVM::MMATypes eltypeA, ::mlir::NVVM::MMATypes eltypeB, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, ::mlir::NVVM::MMATypes eltypeA, ::mlir::NVVM::MMATypes eltypeB, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static llvm::Intrinsic::ID getIntrinsicID(int m, int n, int k, mlir::NVVM::MMALayout layoutAEnum,mlir::NVVM::MMALayout layoutBEnum, mlir::NVVM::MMATypes eltypeAEnum,mlir::NVVM::MMATypes eltypeBEnum) {llvm::StringRef layoutA = stringifyEnum(layoutAEnum);llvm::StringRef layoutB = stringifyEnum(layoutBEnum);llvm::StringRef eltypeA = stringifyEnum(eltypeAEnum);llvm::StringRef eltypeB = stringifyEnum(eltypeBEnum); + + + if (layoutA == "row" && layoutB == "row" && m == 16 && n == 16 && k == 8 && "tf32" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k8_mma_row_row_tf32; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 16 && k == 8 && "tf32" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k8_mma_row_col_tf32; + if (layoutA == "col" && layoutB == "row" && m == 16 && n == 16 && k == 8 && "tf32" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k8_mma_col_row_tf32; + if (layoutA == "col" && layoutB == "col" && m == 16 && n == 16 && k == 8 && "tf32" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k8_mma_col_col_tf32; + if (layoutA == "row" && layoutB == "row" && m == 16 && n == 16 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_row_row_f16_f16; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 16 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_row_col_f16_f16; + if (layoutA == "col" && layoutB == "row" && m == 16 && n == 16 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_col_row_f16_f16; + if (layoutA == "col" && layoutB == "col" && m == 16 && n == 16 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_col_col_f16_f16; + if (layoutA == "row" && layoutB == "row" && m == 16 && n == 16 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_row_row_f32_f32; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 16 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_row_col_f32_f32; + if (layoutA == "col" && layoutB == "row" && m == 16 && n == 16 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_col_row_f32_f32; + if (layoutA == "col" && layoutB == "col" && m == 16 && n == 16 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_col_col_f32_f32; + if (layoutA == "row" && layoutB == "row" && m == 32 && n == 8 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_row_row_f16_f16; + if (layoutA == "row" && layoutB == "col" && m == 32 && n == 8 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_row_col_f16_f16; + if (layoutA == "col" && layoutB == "row" && m == 32 && n == 8 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_col_row_f16_f16; + if (layoutA == "col" && layoutB == "col" && m == 32 && n == 8 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_col_col_f16_f16; + if (layoutA == "row" && layoutB == "row" && m == 32 && n == 8 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_row_row_f32_f32; + if (layoutA == "row" && layoutB == "col" && m == 32 && n == 8 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_row_col_f32_f32; + if (layoutA == "col" && layoutB == "row" && m == 32 && n == 8 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_col_row_f32_f32; + if (layoutA == "col" && layoutB == "col" && m == 32 && n == 8 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_col_col_f32_f32; + if (layoutA == "row" && layoutB == "row" && m == 8 && n == 32 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_row_row_f16_f16; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 32 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_row_col_f16_f16; + if (layoutA == "col" && layoutB == "row" && m == 8 && n == 32 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_col_row_f16_f16; + if (layoutA == "col" && layoutB == "col" && m == 8 && n == 32 && k == 16 && "f16" == eltypeA && "f16" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_col_col_f16_f16; + if (layoutA == "row" && layoutB == "row" && m == 8 && n == 32 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_row_row_f32_f32; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 32 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_row_col_f32_f32; + if (layoutA == "col" && layoutB == "row" && m == 8 && n == 32 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_col_row_f32_f32; + if (layoutA == "col" && layoutB == "col" && m == 8 && n == 32 && k == 16 && "f16" == eltypeA && "f32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_col_col_f32_f32; + if (layoutA == "row" && layoutB == "row" && m == 16 && n == 16 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_row_row_s8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 16 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_row_col_s8; + if (layoutA == "col" && layoutB == "row" && m == 16 && n == 16 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_col_row_s8; + if (layoutA == "col" && layoutB == "col" && m == 16 && n == 16 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_col_col_s8; + if (layoutA == "row" && layoutB == "row" && m == 16 && n == 16 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_row_row_u8; + if (layoutA == "row" && layoutB == "col" && m == 16 && n == 16 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_row_col_u8; + if (layoutA == "col" && layoutB == "row" && m == 16 && n == 16 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_col_row_u8; + if (layoutA == "col" && layoutB == "col" && m == 16 && n == 16 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m16n16k16_mma_col_col_u8; + if (layoutA == "row" && layoutB == "row" && m == 32 && n == 8 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_row_row_s8; + if (layoutA == "row" && layoutB == "col" && m == 32 && n == 8 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_row_col_s8; + if (layoutA == "col" && layoutB == "row" && m == 32 && n == 8 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_col_row_s8; + if (layoutA == "col" && layoutB == "col" && m == 32 && n == 8 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_col_col_s8; + if (layoutA == "row" && layoutB == "row" && m == 32 && n == 8 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_row_row_u8; + if (layoutA == "row" && layoutB == "col" && m == 32 && n == 8 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_row_col_u8; + if (layoutA == "col" && layoutB == "row" && m == 32 && n == 8 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_col_row_u8; + if (layoutA == "col" && layoutB == "col" && m == 32 && n == 8 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m32n8k16_mma_col_col_u8; + if (layoutA == "row" && layoutB == "row" && m == 8 && n == 32 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_row_row_s8; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 32 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_row_col_s8; + if (layoutA == "col" && layoutB == "row" && m == 8 && n == 32 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_col_row_s8; + if (layoutA == "col" && layoutB == "col" && m == 8 && n == 32 && k == 16 && "s8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_col_col_s8; + if (layoutA == "row" && layoutB == "row" && m == 8 && n == 32 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_row_row_u8; + if (layoutA == "row" && layoutB == "col" && m == 8 && n == 32 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_row_col_u8; + if (layoutA == "col" && layoutB == "row" && m == 8 && n == 32 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_col_row_u8; + if (layoutA == "col" && layoutB == "col" && m == 8 && n == 32 && k == 16 && "u8" == eltypeA && "s32" == eltypeB) return llvm::Intrinsic::nvvm_wmma_m8n32k16_mma_col_col_u8; + return 0;}}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WMMAMmaOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WMMAStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WMMAStoreOpGenericAdaptorBase { +public: + struct Properties { + using eltypeTy = ::mlir::NVVM::MMATypesAttr; + eltypeTy eltype; + + auto getEltype() { + auto &propStorage = this->eltype; + return ::llvm::cast<::mlir::NVVM::MMATypesAttr>(propStorage); + } + void setEltype(const ::mlir::NVVM::MMATypesAttr &propValue) { + this->eltype = propValue; + } + using kTy = ::mlir::IntegerAttr; + kTy k; + + auto getK() { + auto &propStorage = this->k; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setK(const ::mlir::IntegerAttr &propValue) { + this->k = propValue; + } + using layoutTy = ::mlir::NVVM::MMALayoutAttr; + layoutTy layout; + + auto getLayout() { + auto &propStorage = this->layout; + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(propStorage); + } + void setLayout(const ::mlir::NVVM::MMALayoutAttr &propValue) { + this->layout = propValue; + } + using mTy = ::mlir::IntegerAttr; + mTy m; + + auto getM() { + auto &propStorage = this->m; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setM(const ::mlir::IntegerAttr &propValue) { + this->m = propValue; + } + using nTy = ::mlir::IntegerAttr; + nTy n; + + auto getN() { + auto &propStorage = this->n; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setN(const ::mlir::IntegerAttr &propValue) { + this->n = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.eltype == this->eltype && + rhs.k == this->k && + rhs.layout == this->layout && + rhs.m == this->m && + rhs.n == this->n && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + WMMAStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + WMMAStoreOpGenericAdaptorBase(WMMAStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMAttr(); + uint32_t getM(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::IntegerAttr getKAttr(); + uint32_t getK(); + ::mlir::NVVM::MMALayoutAttr getLayoutAttr(); + ::mlir::NVVM::MMALayout getLayout(); + ::mlir::NVVM::MMATypesAttr getEltypeAttr(); + ::mlir::NVVM::MMATypes getEltype(); +}; +} // namespace detail +template +class WMMAStoreOpGenericAdaptor : public detail::WMMAStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WMMAStoreOpGenericAdaptorBase; +public: + WMMAStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WMMAStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WMMAStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + WMMAStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPtr() { + return (*getODSOperands(0).begin()); + } + + RangeT getArgs() { + return getODSOperands(1); + } + + ValueT getStride() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WMMAStoreOpAdaptor : public WMMAStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using WMMAStoreOpGenericAdaptor::WMMAStoreOpGenericAdaptor; + WMMAStoreOpAdaptor(WMMAStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WMMAStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WMMAStoreOpAdaptor; + template + using GenericAdaptor = WMMAStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("eltype"), ::llvm::StringRef("k"), ::llvm::StringRef("layout"), ::llvm::StringRef("m"), ::llvm::StringRef("n")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEltypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEltypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLayoutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.wmma.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getPtr(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::TypedValue<::mlir::IntegerType> getStride(); + ::mlir::OpOperand &getPtrMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::OpOperand &getStrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getMAttr(); + uint32_t getM(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::IntegerAttr getKAttr(); + uint32_t getK(); + ::mlir::NVVM::MMALayoutAttr getLayoutAttr(); + ::mlir::NVVM::MMALayout getLayout(); + ::mlir::NVVM::MMATypesAttr getEltypeAttr(); + ::mlir::NVVM::MMATypes getEltype(); + void setMAttr(::mlir::IntegerAttr attr); + void setM(uint32_t attrValue); + void setNAttr(::mlir::IntegerAttr attr); + void setN(uint32_t attrValue); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint32_t attrValue); + void setLayoutAttr(::mlir::NVVM::MMALayoutAttr attr); + void setLayout(::mlir::NVVM::MMALayout attrValue); + void setEltypeAttr(::mlir::NVVM::MMATypesAttr attr); + void setEltype(::mlir::NVVM::MMATypes attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layout, ::mlir::NVVM::MMATypesAttr eltype, ::mlir::ValueRange args, ::mlir::Value stride); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::NVVM::MMALayoutAttr layout, ::mlir::NVVM::MMATypesAttr eltype, ::mlir::ValueRange args, ::mlir::Value stride); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ptr, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layout, ::mlir::NVVM::MMATypes eltype, ::mlir::ValueRange args, ::mlir::Value stride); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ptr, uint32_t m, uint32_t n, uint32_t k, ::mlir::NVVM::MMALayout layout, ::mlir::NVVM::MMATypes eltype, ::mlir::ValueRange args, ::mlir::Value stride); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static llvm::Intrinsic::ID getIntrinsicID(int m, int n, int k, mlir::NVVM::MMALayout layoutEnum,mlir::NVVM::MMATypes eltypeEnum) { llvm::StringRef layout = stringifyEnum(layoutEnum); llvm::StringRef eltype = stringifyEnum(eltypeEnum); + + if (layout == "row" && m == 16 && n == 16 && k == 16 && "f16" == eltype) return llvm::Intrinsic::nvvm_wmma_m16n16k16_store_d_f16_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "f16" == eltype) return llvm::Intrinsic::nvvm_wmma_m16n16k16_store_d_f16_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "f32" == eltype) return llvm::Intrinsic::nvvm_wmma_m16n16k16_store_d_f32_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "f32" == eltype) return llvm::Intrinsic::nvvm_wmma_m16n16k16_store_d_f32_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 16 && "s32" == eltype) return llvm::Intrinsic::nvvm_wmma_m16n16k16_store_d_s32_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 16 && "s32" == eltype) return llvm::Intrinsic::nvvm_wmma_m16n16k16_store_d_s32_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "f16" == eltype) return llvm::Intrinsic::nvvm_wmma_m32n8k16_store_d_f16_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "f16" == eltype) return llvm::Intrinsic::nvvm_wmma_m32n8k16_store_d_f16_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "f32" == eltype) return llvm::Intrinsic::nvvm_wmma_m32n8k16_store_d_f32_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "f32" == eltype) return llvm::Intrinsic::nvvm_wmma_m32n8k16_store_d_f32_col_stride; + if (layout == "row" && m == 32 && n == 8 && k == 16 && "s32" == eltype) return llvm::Intrinsic::nvvm_wmma_m32n8k16_store_d_s32_row_stride; + if (layout == "col" && m == 32 && n == 8 && k == 16 && "s32" == eltype) return llvm::Intrinsic::nvvm_wmma_m32n8k16_store_d_s32_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "f16" == eltype) return llvm::Intrinsic::nvvm_wmma_m8n32k16_store_d_f16_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "f16" == eltype) return llvm::Intrinsic::nvvm_wmma_m8n32k16_store_d_f16_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "f32" == eltype) return llvm::Intrinsic::nvvm_wmma_m8n32k16_store_d_f32_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "f32" == eltype) return llvm::Intrinsic::nvvm_wmma_m8n32k16_store_d_f32_col_stride; + if (layout == "row" && m == 8 && n == 32 && k == 16 && "s32" == eltype) return llvm::Intrinsic::nvvm_wmma_m8n32k16_store_d_s32_row_stride; + if (layout == "col" && m == 8 && n == 32 && k == 16 && "s32" == eltype) return llvm::Intrinsic::nvvm_wmma_m8n32k16_store_d_s32_col_stride; + if (layout == "row" && m == 16 && n == 16 && k == 8 && "f32" == eltype) return llvm::Intrinsic::nvvm_wmma_m16n16k8_store_d_f32_row_stride; + if (layout == "col" && m == 16 && n == 16 && k == 8 && "f32" == eltype) return llvm::Intrinsic::nvvm_wmma_m16n16k8_store_d_f32_col_stride; + return 0;} + /// Helpers to find valid k dimension based on mxn store shape. + static int inferKDimension(int m, int n, mlir::NVVM::MMATypes eltypeEnum) { llvm::StringRef eltype = stringifyEnum(eltypeEnum); + if (m == 16 && n == 16 && "f16" == eltype) return 16; + if (m == 16 && n == 16 && "f32" == eltype) return 16; + if (m == 16 && n == 16 && "s32" == eltype) return 16; + if (m == 32 && n == 8 && "f16" == eltype) return 16; + if (m == 32 && n == 8 && "f32" == eltype) return 16; + if (m == 32 && n == 8 && "s32" == eltype) return 16; + if (m == 8 && n == 32 && "f16" == eltype) return 16; + if (m == 8 && n == 32 && "f32" == eltype) return 16; + if (m == 8 && n == 32 && "s32" == eltype) return 16; + if (m == 16 && n == 16 && "f32" == eltype) return 8; + return 0;}}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WMMAStoreOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WarpSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WarpSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WarpSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WarpSizeOpGenericAdaptorBase(WarpSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WarpSizeOpGenericAdaptor : public detail::WarpSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WarpSizeOpGenericAdaptorBase; +public: + WarpSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WarpSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WarpSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WarpSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WarpSizeOpAdaptor : public WarpSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using WarpSizeOpGenericAdaptor::WarpSizeOpGenericAdaptor; + WarpSizeOpAdaptor(WarpSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WarpSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WarpSizeOpAdaptor; + template + using GenericAdaptor = WarpSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.read.ptx.sreg.warpsize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WarpSizeOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WgmmaFenceAlignedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WgmmaFenceAlignedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WgmmaFenceAlignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WgmmaFenceAlignedOpGenericAdaptorBase(WgmmaFenceAlignedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WgmmaFenceAlignedOpGenericAdaptor : public detail::WgmmaFenceAlignedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WgmmaFenceAlignedOpGenericAdaptorBase; +public: + WgmmaFenceAlignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WgmmaFenceAlignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WgmmaFenceAlignedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WgmmaFenceAlignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WgmmaFenceAlignedOpAdaptor : public WgmmaFenceAlignedOpGenericAdaptor<::mlir::ValueRange> { +public: + using WgmmaFenceAlignedOpGenericAdaptor::WgmmaFenceAlignedOpGenericAdaptor; + WgmmaFenceAlignedOpAdaptor(WgmmaFenceAlignedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WgmmaFenceAlignedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = WgmmaFenceAlignedOpAdaptor; + template + using GenericAdaptor = WgmmaFenceAlignedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.wgmma.fence.aligned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WgmmaFenceAlignedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WgmmaGroupSyncAlignedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WgmmaGroupSyncAlignedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WgmmaGroupSyncAlignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WgmmaGroupSyncAlignedOpGenericAdaptorBase(WgmmaGroupSyncAlignedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WgmmaGroupSyncAlignedOpGenericAdaptor : public detail::WgmmaGroupSyncAlignedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WgmmaGroupSyncAlignedOpGenericAdaptorBase; +public: + WgmmaGroupSyncAlignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WgmmaGroupSyncAlignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WgmmaGroupSyncAlignedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WgmmaGroupSyncAlignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WgmmaGroupSyncAlignedOpAdaptor : public WgmmaGroupSyncAlignedOpGenericAdaptor<::mlir::ValueRange> { +public: + using WgmmaGroupSyncAlignedOpGenericAdaptor::WgmmaGroupSyncAlignedOpGenericAdaptor; + WgmmaGroupSyncAlignedOpAdaptor(WgmmaGroupSyncAlignedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WgmmaGroupSyncAlignedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = WgmmaGroupSyncAlignedOpAdaptor; + template + using GenericAdaptor = WgmmaGroupSyncAlignedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.wgmma.commit.group.sync.aligned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WgmmaGroupSyncAlignedOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WgmmaMmaAsyncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WgmmaMmaAsyncOpGenericAdaptorBase { +public: + struct Properties { + using layoutATy = ::mlir::NVVM::MMALayoutAttr; + layoutATy layoutA; + + auto getLayoutA() { + auto &propStorage = this->layoutA; + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(propStorage); + } + void setLayoutA(const ::mlir::NVVM::MMALayoutAttr &propValue) { + this->layoutA = propValue; + } + using layoutBTy = ::mlir::NVVM::MMALayoutAttr; + layoutBTy layoutB; + + auto getLayoutB() { + auto &propStorage = this->layoutB; + return ::llvm::cast<::mlir::NVVM::MMALayoutAttr>(propStorage); + } + void setLayoutB(const ::mlir::NVVM::MMALayoutAttr &propValue) { + this->layoutB = propValue; + } + using satfiniteTy = ::mlir::NVVM::MMAIntOverflowAttr; + satfiniteTy satfinite; + + auto getSatfinite() { + auto &propStorage = this->satfinite; + return ::llvm::dyn_cast_or_null<::mlir::NVVM::MMAIntOverflowAttr>(propStorage); + } + void setSatfinite(const ::mlir::NVVM::MMAIntOverflowAttr &propValue) { + this->satfinite = propValue; + } + using scaleATy = ::mlir::NVVM::WGMMAScaleInAttr; + scaleATy scaleA; + + auto getScaleA() { + auto &propStorage = this->scaleA; + return ::llvm::cast<::mlir::NVVM::WGMMAScaleInAttr>(propStorage); + } + void setScaleA(const ::mlir::NVVM::WGMMAScaleInAttr &propValue) { + this->scaleA = propValue; + } + using scaleBTy = ::mlir::NVVM::WGMMAScaleInAttr; + scaleBTy scaleB; + + auto getScaleB() { + auto &propStorage = this->scaleB; + return ::llvm::cast<::mlir::NVVM::WGMMAScaleInAttr>(propStorage); + } + void setScaleB(const ::mlir::NVVM::WGMMAScaleInAttr &propValue) { + this->scaleB = propValue; + } + using scaleDTy = ::mlir::NVVM::WGMMAScaleOutAttr; + scaleDTy scaleD; + + auto getScaleD() { + auto &propStorage = this->scaleD; + return ::llvm::cast<::mlir::NVVM::WGMMAScaleOutAttr>(propStorage); + } + void setScaleD(const ::mlir::NVVM::WGMMAScaleOutAttr &propValue) { + this->scaleD = propValue; + } + using shapeTy = ::mlir::NVVM::MMAShapeAttr; + shapeTy shape; + + auto getShape() { + auto &propStorage = this->shape; + return ::llvm::cast<::mlir::NVVM::MMAShapeAttr>(propStorage); + } + void setShape(const ::mlir::NVVM::MMAShapeAttr &propValue) { + this->shape = propValue; + } + using typeATy = ::mlir::NVVM::WGMMATypesAttr; + typeATy typeA; + + auto getTypeA() { + auto &propStorage = this->typeA; + return ::llvm::cast<::mlir::NVVM::WGMMATypesAttr>(propStorage); + } + void setTypeA(const ::mlir::NVVM::WGMMATypesAttr &propValue) { + this->typeA = propValue; + } + using typeBTy = ::mlir::NVVM::WGMMATypesAttr; + typeBTy typeB; + + auto getTypeB() { + auto &propStorage = this->typeB; + return ::llvm::cast<::mlir::NVVM::WGMMATypesAttr>(propStorage); + } + void setTypeB(const ::mlir::NVVM::WGMMATypesAttr &propValue) { + this->typeB = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.layoutA == this->layoutA && + rhs.layoutB == this->layoutB && + rhs.satfinite == this->satfinite && + rhs.scaleA == this->scaleA && + rhs.scaleB == this->scaleB && + rhs.scaleD == this->scaleD && + rhs.shape == this->shape && + rhs.typeA == this->typeA && + rhs.typeB == this->typeB && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + WgmmaMmaAsyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + WgmmaMmaAsyncOpGenericAdaptorBase(WgmmaMmaAsyncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::NVVM::MMAShapeAttr getShapeAttr(); + ::mlir::NVVM::MMAShapeAttr getShape(); + ::mlir::NVVM::WGMMATypesAttr getTypeAAttr(); + ::mlir::NVVM::WGMMATypes getTypeA(); + ::mlir::NVVM::WGMMATypesAttr getTypeBAttr(); + ::mlir::NVVM::WGMMATypes getTypeB(); + ::mlir::NVVM::WGMMAScaleOutAttr getScaleDAttr(); + ::mlir::NVVM::WGMMAScaleOut getScaleD(); + ::mlir::NVVM::WGMMAScaleInAttr getScaleAAttr(); + ::mlir::NVVM::WGMMAScaleIn getScaleA(); + ::mlir::NVVM::WGMMAScaleInAttr getScaleBAttr(); + ::mlir::NVVM::WGMMAScaleIn getScaleB(); + ::mlir::NVVM::MMALayoutAttr getLayoutAAttr(); + ::mlir::NVVM::MMALayout getLayoutA(); + ::mlir::NVVM::MMALayoutAttr getLayoutBAttr(); + ::mlir::NVVM::MMALayout getLayoutB(); + ::mlir::NVVM::MMAIntOverflowAttr getSatfiniteAttr(); + ::std::optional<::mlir::NVVM::MMAIntOverflow> getSatfinite(); +}; +} // namespace detail +template +class WgmmaMmaAsyncOpGenericAdaptor : public detail::WgmmaMmaAsyncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WgmmaMmaAsyncOpGenericAdaptorBase; +public: + WgmmaMmaAsyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WgmmaMmaAsyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WgmmaMmaAsyncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + WgmmaMmaAsyncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInouts() { + return (*getODSOperands(0).begin()); + } + + ValueT getDescriptorA() { + return (*getODSOperands(1).begin()); + } + + ValueT getDescriptorB() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WgmmaMmaAsyncOpAdaptor : public WgmmaMmaAsyncOpGenericAdaptor<::mlir::ValueRange> { +public: + using WgmmaMmaAsyncOpGenericAdaptor::WgmmaMmaAsyncOpGenericAdaptor; + WgmmaMmaAsyncOpAdaptor(WgmmaMmaAsyncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WgmmaMmaAsyncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, BasicPtxBuilderInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WgmmaMmaAsyncOpAdaptor; + template + using GenericAdaptor = WgmmaMmaAsyncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("layoutA"), ::llvm::StringRef("layoutB"), ::llvm::StringRef("satfinite"), ::llvm::StringRef("scaleA"), ::llvm::StringRef("scaleB"), ::llvm::StringRef("scaleD"), ::llvm::StringRef("shape"), ::llvm::StringRef("typeA"), ::llvm::StringRef("typeB")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLayoutAAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLayoutAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLayoutBAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLayoutBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSatfiniteAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSatfiniteAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getScaleAAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getScaleAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getScaleBAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getScaleBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getScaleDAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getScaleDAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTypeAAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTypeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTypeBAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTypeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.wgmma.mma_async"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getInouts(); + ::mlir::TypedValue<::mlir::IntegerType> getDescriptorA(); + ::mlir::TypedValue<::mlir::IntegerType> getDescriptorB(); + ::mlir::OpOperand &getInoutsMutable(); + ::mlir::OpOperand &getDescriptorAMutable(); + ::mlir::OpOperand &getDescriptorBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResults(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::NVVM::MMAShapeAttr getShapeAttr(); + ::mlir::NVVM::MMAShapeAttr getShape(); + ::mlir::NVVM::WGMMATypesAttr getTypeAAttr(); + ::mlir::NVVM::WGMMATypes getTypeA(); + ::mlir::NVVM::WGMMATypesAttr getTypeBAttr(); + ::mlir::NVVM::WGMMATypes getTypeB(); + ::mlir::NVVM::WGMMAScaleOutAttr getScaleDAttr(); + ::mlir::NVVM::WGMMAScaleOut getScaleD(); + ::mlir::NVVM::WGMMAScaleInAttr getScaleAAttr(); + ::mlir::NVVM::WGMMAScaleIn getScaleA(); + ::mlir::NVVM::WGMMAScaleInAttr getScaleBAttr(); + ::mlir::NVVM::WGMMAScaleIn getScaleB(); + ::mlir::NVVM::MMALayoutAttr getLayoutAAttr(); + ::mlir::NVVM::MMALayout getLayoutA(); + ::mlir::NVVM::MMALayoutAttr getLayoutBAttr(); + ::mlir::NVVM::MMALayout getLayoutB(); + ::mlir::NVVM::MMAIntOverflowAttr getSatfiniteAttr(); + ::std::optional<::mlir::NVVM::MMAIntOverflow> getSatfinite(); + void setShapeAttr(::mlir::NVVM::MMAShapeAttr attr); + void setTypeAAttr(::mlir::NVVM::WGMMATypesAttr attr); + void setTypeA(::mlir::NVVM::WGMMATypes attrValue); + void setTypeBAttr(::mlir::NVVM::WGMMATypesAttr attr); + void setTypeB(::mlir::NVVM::WGMMATypes attrValue); + void setScaleDAttr(::mlir::NVVM::WGMMAScaleOutAttr attr); + void setScaleD(::mlir::NVVM::WGMMAScaleOut attrValue); + void setScaleAAttr(::mlir::NVVM::WGMMAScaleInAttr attr); + void setScaleA(::mlir::NVVM::WGMMAScaleIn attrValue); + void setScaleBAttr(::mlir::NVVM::WGMMAScaleInAttr attr); + void setScaleB(::mlir::NVVM::WGMMAScaleIn attrValue); + void setLayoutAAttr(::mlir::NVVM::MMALayoutAttr attr); + void setLayoutA(::mlir::NVVM::MMALayout attrValue); + void setLayoutBAttr(::mlir::NVVM::MMALayoutAttr attr); + void setLayoutB(::mlir::NVVM::MMALayout attrValue); + void setSatfiniteAttr(::mlir::NVVM::MMAIntOverflowAttr attr); + void setSatfinite(::std::optional<::mlir::NVVM::MMAIntOverflow> attrValue); + ::mlir::Attribute removeSatfiniteAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type results, ::mlir::Value inouts, ::mlir::Value descriptorA, ::mlir::Value descriptorB, ::mlir::NVVM::MMAShapeAttr shape, ::mlir::NVVM::WGMMATypesAttr typeA, ::mlir::NVVM::WGMMATypesAttr typeB, ::mlir::NVVM::WGMMAScaleOutAttr scaleD, ::mlir::NVVM::WGMMAScaleInAttr scaleA, ::mlir::NVVM::WGMMAScaleInAttr scaleB, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, /*optional*/::mlir::NVVM::MMAIntOverflowAttr satfinite); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inouts, ::mlir::Value descriptorA, ::mlir::Value descriptorB, ::mlir::NVVM::MMAShapeAttr shape, ::mlir::NVVM::WGMMATypesAttr typeA, ::mlir::NVVM::WGMMATypesAttr typeB, ::mlir::NVVM::WGMMAScaleOutAttr scaleD, ::mlir::NVVM::WGMMAScaleInAttr scaleA, ::mlir::NVVM::WGMMAScaleInAttr scaleB, ::mlir::NVVM::MMALayoutAttr layoutA, ::mlir::NVVM::MMALayoutAttr layoutB, /*optional*/::mlir::NVVM::MMAIntOverflowAttr satfinite); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type results, ::mlir::Value inouts, ::mlir::Value descriptorA, ::mlir::Value descriptorB, ::mlir::NVVM::MMAShapeAttr shape, ::mlir::NVVM::WGMMATypes typeA, ::mlir::NVVM::WGMMATypes typeB, ::mlir::NVVM::WGMMAScaleOut scaleD, ::mlir::NVVM::WGMMAScaleIn scaleA, ::mlir::NVVM::WGMMAScaleIn scaleB, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, /*optional*/::mlir::NVVM::MMAIntOverflowAttr satfinite); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inouts, ::mlir::Value descriptorA, ::mlir::Value descriptorB, ::mlir::NVVM::MMAShapeAttr shape, ::mlir::NVVM::WGMMATypes typeA, ::mlir::NVVM::WGMMATypes typeB, ::mlir::NVVM::WGMMAScaleOut scaleD, ::mlir::NVVM::WGMMAScaleIn scaleA, ::mlir::NVVM::WGMMAScaleIn scaleB, ::mlir::NVVM::MMALayout layoutA, ::mlir::NVVM::MMALayout layoutB, /*optional*/::mlir::NVVM::MMAIntOverflowAttr satfinite); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + void getAsmValues(RewriterBase &rewriter, + llvm::SmallVectorImpl> &asmValues); +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WgmmaMmaAsyncOp) + +namespace mlir { +namespace NVVM { + +//===----------------------------------------------------------------------===// +// ::mlir::NVVM::WgmmaWaitGroupSyncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WgmmaWaitGroupSyncOpGenericAdaptorBase { +public: + struct Properties { + using groupTy = ::mlir::IntegerAttr; + groupTy group; + + auto getGroup() { + auto &propStorage = this->group; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setGroup(const ::mlir::IntegerAttr &propValue) { + this->group = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.group == this->group && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + WgmmaWaitGroupSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + WgmmaWaitGroupSyncOpGenericAdaptorBase(WgmmaWaitGroupSyncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getGroupAttr(); + uint32_t getGroup(); +}; +} // namespace detail +template +class WgmmaWaitGroupSyncOpGenericAdaptor : public detail::WgmmaWaitGroupSyncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WgmmaWaitGroupSyncOpGenericAdaptorBase; +public: + WgmmaWaitGroupSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WgmmaWaitGroupSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WgmmaWaitGroupSyncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + WgmmaWaitGroupSyncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WgmmaWaitGroupSyncOpAdaptor : public WgmmaWaitGroupSyncOpGenericAdaptor<::mlir::ValueRange> { +public: + using WgmmaWaitGroupSyncOpGenericAdaptor::WgmmaWaitGroupSyncOpGenericAdaptor; + WgmmaWaitGroupSyncOpAdaptor(WgmmaWaitGroupSyncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WgmmaWaitGroupSyncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = WgmmaWaitGroupSyncOpAdaptor; + template + using GenericAdaptor = WgmmaWaitGroupSyncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("group")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getGroupAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getGroupAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvvm.wgmma.wait.group.sync.aligned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getGroupAttr(); + uint32_t getGroup(); + void setGroupAttr(::mlir::IntegerAttr attr); + void setGroup(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr group); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr group); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t group); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t group); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::string getPtx(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WgmmaWaitGroupSyncOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..4b547a7fc3be7348b6df2d0103e88ea9f57cc571 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.cpp.inc @@ -0,0 +1,1400 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::NVVM::LoadCacheModifierKindAttr, +::mlir::NVVM::MMAB1OpAttr, +::mlir::NVVM::MMAFragAttr, +::mlir::NVVM::MMAIntOverflowAttr, +::mlir::NVVM::MMALayoutAttr, +::mlir::NVVM::MMATypesAttr, +::mlir::NVVM::MMAShapeAttr, +::mlir::NVVM::NVVMTargetAttr, +::mlir::NVVM::ReduxKindAttr, +::mlir::NVVM::ShflKindAttr, +::mlir::NVVM::WGMMAScaleInAttr, +::mlir::NVVM::WGMMAScaleOutAttr, +::mlir::NVVM::WGMMATypesAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::NVVM::LoadCacheModifierKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::LoadCacheModifierKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::MMAB1OpAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::MMAB1OpAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::MMAFragAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::MMAFragAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::MMAIntOverflowAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::MMAIntOverflowAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::MMALayoutAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::MMALayoutAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::MMATypesAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::MMATypesAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::MMAShapeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::MMAShapeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::NVVMTargetAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::NVVMTargetAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::ReduxKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::ReduxKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::ShflKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::ShflKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::WGMMAScaleInAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::WGMMAScaleInAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::WGMMAScaleOutAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::WGMMAScaleOutAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::NVVM::WGMMATypesAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::NVVM::WGMMATypesAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::NVVM::LoadCacheModifierKindAttr>([&](auto t) { + printer << ::mlir::NVVM::LoadCacheModifierKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::MMAB1OpAttr>([&](auto t) { + printer << ::mlir::NVVM::MMAB1OpAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::MMAFragAttr>([&](auto t) { + printer << ::mlir::NVVM::MMAFragAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::MMAIntOverflowAttr>([&](auto t) { + printer << ::mlir::NVVM::MMAIntOverflowAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::MMALayoutAttr>([&](auto t) { + printer << ::mlir::NVVM::MMALayoutAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::MMATypesAttr>([&](auto t) { + printer << ::mlir::NVVM::MMATypesAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::MMAShapeAttr>([&](auto t) { + printer << ::mlir::NVVM::MMAShapeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::NVVMTargetAttr>([&](auto t) { + printer << ::mlir::NVVM::NVVMTargetAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::ReduxKindAttr>([&](auto t) { + printer << ::mlir::NVVM::ReduxKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::ShflKindAttr>([&](auto t) { + printer << ::mlir::NVVM::ShflKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::WGMMAScaleInAttr>([&](auto t) { + printer << ::mlir::NVVM::WGMMAScaleInAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::WGMMAScaleOutAttr>([&](auto t) { + printer << ::mlir::NVVM::WGMMAScaleOutAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::NVVM::WGMMATypesAttr>([&](auto t) { + printer << ::mlir::NVVM::WGMMATypesAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace NVVM { +namespace detail { +struct LoadCacheModifierKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::LoadCacheModifierKind>; + LoadCacheModifierKindAttrStorage(::mlir::NVVM::LoadCacheModifierKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static LoadCacheModifierKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) LoadCacheModifierKindAttrStorage(std::move(value)); + } + + ::mlir::NVVM::LoadCacheModifierKind value; +}; +} // namespace detail +LoadCacheModifierKindAttr LoadCacheModifierKindAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::LoadCacheModifierKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute LoadCacheModifierKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::LoadCacheModifierKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::LoadCacheModifierKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeLoadCacheModifierKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::LoadCacheModifierKind" << " to be one of: " << "ca" << ", " << "cg" << ", " << "cs" << ", " << "lu" << ", " << "cv")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoadCacheModifierAttr parameter 'value' which is to be a `::mlir::NVVM::LoadCacheModifierKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return LoadCacheModifierKindAttr::get(odsParser.getContext(), + ::mlir::NVVM::LoadCacheModifierKind((*_result_value))); +} + +void LoadCacheModifierKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyLoadCacheModifierKind(getValue()); +} + +::mlir::NVVM::LoadCacheModifierKind LoadCacheModifierKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::LoadCacheModifierKindAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct MMAB1OpAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::MMAB1Op>; + MMAB1OpAttrStorage(::mlir::NVVM::MMAB1Op value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static MMAB1OpAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) MMAB1OpAttrStorage(std::move(value)); + } + + ::mlir::NVVM::MMAB1Op value; +}; +} // namespace detail +MMAB1OpAttr MMAB1OpAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::MMAB1Op value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute MMAB1OpAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::MMAB1Op> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::MMAB1Op> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeMMAB1Op(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::MMAB1Op" << " to be one of: " << "none" << ", " << "xor_popc" << ", " << "and_popc")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse MMAB1OpAttr parameter 'value' which is to be a `::mlir::NVVM::MMAB1Op`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return MMAB1OpAttr::get(odsParser.getContext(), + ::mlir::NVVM::MMAB1Op((*_result_value))); +} + +void MMAB1OpAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyMMAB1Op(getValue()); + odsPrinter << ">"; +} + +::mlir::NVVM::MMAB1Op MMAB1OpAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMAB1OpAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct MMAFragAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::MMAFrag>; + MMAFragAttrStorage(::mlir::NVVM::MMAFrag value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static MMAFragAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) MMAFragAttrStorage(std::move(value)); + } + + ::mlir::NVVM::MMAFrag value; +}; +} // namespace detail +MMAFragAttr MMAFragAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::MMAFrag value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute MMAFragAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::MMAFrag> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::MMAFrag> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeMMAFrag(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::MMAFrag" << " to be one of: " << "a" << ", " << "b" << ", " << "c")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse MMAFragAttr parameter 'value' which is to be a `::mlir::NVVM::MMAFrag`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return MMAFragAttr::get(odsParser.getContext(), + ::mlir::NVVM::MMAFrag((*_result_value))); +} + +void MMAFragAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyMMAFrag(getValue()); + odsPrinter << ">"; +} + +::mlir::NVVM::MMAFrag MMAFragAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMAFragAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct MMAIntOverflowAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::MMAIntOverflow>; + MMAIntOverflowAttrStorage(::mlir::NVVM::MMAIntOverflow value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static MMAIntOverflowAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) MMAIntOverflowAttrStorage(std::move(value)); + } + + ::mlir::NVVM::MMAIntOverflow value; +}; +} // namespace detail +MMAIntOverflowAttr MMAIntOverflowAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::MMAIntOverflow value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute MMAIntOverflowAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::MMAIntOverflow> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::MMAIntOverflow> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeMMAIntOverflow(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::MMAIntOverflow" << " to be one of: " << "satfinite" << ", " << "wrapped")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse MMAIntOverflowAttr parameter 'value' which is to be a `::mlir::NVVM::MMAIntOverflow`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return MMAIntOverflowAttr::get(odsParser.getContext(), + ::mlir::NVVM::MMAIntOverflow((*_result_value))); +} + +void MMAIntOverflowAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyMMAIntOverflow(getValue()); + odsPrinter << ">"; +} + +::mlir::NVVM::MMAIntOverflow MMAIntOverflowAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMAIntOverflowAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct MMALayoutAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::MMALayout>; + MMALayoutAttrStorage(::mlir::NVVM::MMALayout value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static MMALayoutAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) MMALayoutAttrStorage(std::move(value)); + } + + ::mlir::NVVM::MMALayout value; +}; +} // namespace detail +MMALayoutAttr MMALayoutAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::MMALayout value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute MMALayoutAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::MMALayout> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::MMALayout> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeMMALayout(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::MMALayout" << " to be one of: " << "row" << ", " << "col")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse MMALayoutAttr parameter 'value' which is to be a `::mlir::NVVM::MMALayout`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return MMALayoutAttr::get(odsParser.getContext(), + ::mlir::NVVM::MMALayout((*_result_value))); +} + +void MMALayoutAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyMMALayout(getValue()); + odsPrinter << ">"; +} + +::mlir::NVVM::MMALayout MMALayoutAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMALayoutAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct MMATypesAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::MMATypes>; + MMATypesAttrStorage(::mlir::NVVM::MMATypes value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static MMATypesAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) MMATypesAttrStorage(std::move(value)); + } + + ::mlir::NVVM::MMATypes value; +}; +} // namespace detail +MMATypesAttr MMATypesAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::MMATypes value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute MMATypesAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::MMATypes> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::MMATypes> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeMMATypes(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::MMATypes" << " to be one of: " << "f16" << ", " << "f32" << ", " << "tf32" << ", " << "bf16" << ", " << "s8" << ", " << "u8" << ", " << "s32" << ", " << "s4" << ", " << "u4" << ", " << "b1" << ", " << "f64")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse MMATypesAttr parameter 'value' which is to be a `::mlir::NVVM::MMATypes`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return MMATypesAttr::get(odsParser.getContext(), + ::mlir::NVVM::MMATypes((*_result_value))); +} + +void MMATypesAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyMMATypes(getValue()); + odsPrinter << ">"; +} + +::mlir::NVVM::MMATypes MMATypesAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMATypesAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct MMAShapeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + MMAShapeAttrStorage(int m, int n, int k) : m(std::move(m)), n(std::move(n)), k(std::move(k)) {} + + KeyTy getAsKey() const { + return KeyTy(m, n, k); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (m == std::get<0>(tblgenKey)) && (n == std::get<1>(tblgenKey)) && (k == std::get<2>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); + } + + static MMAShapeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto m = std::move(std::get<0>(tblgenKey)); + auto n = std::move(std::get<1>(tblgenKey)); + auto k = std::move(std::get<2>(tblgenKey)); + return new (allocator.allocate()) MMAShapeAttrStorage(std::move(m), std::move(n), std::move(k)); + } + + int m; + int n; + int k; +}; +} // namespace detail +MMAShapeAttr MMAShapeAttr::get(::mlir::MLIRContext *context, int m, int n, int k) { + return Base::get(context, std::move(m), std::move(n), std::move(k)); +} + +::mlir::Attribute MMAShapeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_m; + ::mlir::FailureOr _result_n; + ::mlir::FailureOr _result_k; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_m = false; + bool _seen_n = false; + bool _seen_k = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_m && _paramKey == "m") { + _seen_m = true; + + // Parse variable 'm' + _result_m = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_m)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVVM_MMAShapeAttr parameter 'm' which is to be a `int`"); + return {}; + } + } else if (!_seen_n && _paramKey == "n") { + _seen_n = true; + + // Parse variable 'n' + _result_n = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_n)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVVM_MMAShapeAttr parameter 'n' which is to be a `int`"); + return {}; + } + } else if (!_seen_k && _paramKey == "k") { + _seen_k = true; + + // Parse variable 'k' + _result_k = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_k)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVVM_MMAShapeAttr parameter 'k' which is to be a `int`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 3; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 3 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_m)); + assert(::mlir::succeeded(_result_n)); + assert(::mlir::succeeded(_result_k)); + return MMAShapeAttr::get(odsParser.getContext(), + int((*_result_m)), + int((*_result_n)), + int((*_result_k))); +} + +void MMAShapeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "m = "; + odsPrinter.printStrippedAttrOrType(getM()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "n = "; + odsPrinter.printStrippedAttrOrType(getN()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "k = "; + odsPrinter.printStrippedAttrOrType(getK()); + } + odsPrinter << ">"; +} + +int MMAShapeAttr::getM() const { + return getImpl()->m; +} + +int MMAShapeAttr::getN() const { + return getImpl()->n; +} + +int MMAShapeAttr::getK() const { + return getImpl()->k; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMAShapeAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct NVVMTargetAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + NVVMTargetAttrStorage(int O, ::llvm::StringRef triple, ::llvm::StringRef chip, ::llvm::StringRef features, DictionaryAttr flags, ArrayAttr link) : O(std::move(O)), triple(std::move(triple)), chip(std::move(chip)), features(std::move(features)), flags(std::move(flags)), link(std::move(link)) {} + + KeyTy getAsKey() const { + return KeyTy(O, triple, chip, features, flags, link); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (O == std::get<0>(tblgenKey)) && (triple == std::get<1>(tblgenKey)) && (chip == std::get<2>(tblgenKey)) && (features == std::get<3>(tblgenKey)) && (flags == std::get<4>(tblgenKey)) && (link == std::get<5>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey)); + } + + static NVVMTargetAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto O = std::move(std::get<0>(tblgenKey)); + auto triple = std::move(std::get<1>(tblgenKey)); + auto chip = std::move(std::get<2>(tblgenKey)); + auto features = std::move(std::get<3>(tblgenKey)); + auto flags = std::move(std::get<4>(tblgenKey)); + auto link = std::move(std::get<5>(tblgenKey)); + triple = allocator.copyInto(triple); + chip = allocator.copyInto(chip); + features = allocator.copyInto(features); + return new (allocator.allocate()) NVVMTargetAttrStorage(std::move(O), std::move(triple), std::move(chip), std::move(features), std::move(flags), std::move(link)); + } + + int O; + ::llvm::StringRef triple; + ::llvm::StringRef chip; + ::llvm::StringRef features; + DictionaryAttr flags; + ArrayAttr link; +}; +} // namespace detail +bool NVVMTargetAttr::hasFlag(StringRef flag) const { + if (DictionaryAttr flags = getFlags()) + return flags.get(flag) != nullptr; + return false; +} +bool NVVMTargetAttr::hasFastMath() const { + return hasFlag("fast"); +} +bool NVVMTargetAttr::hasFtz() const { + return hasFlag("ftz"); +} +NVVMTargetAttr NVVMTargetAttr::get(::mlir::MLIRContext *context, int optLevel, StringRef triple, StringRef chip, StringRef features, DictionaryAttr targetFlags, ArrayAttr linkFiles) { + return Base::get(context, optLevel, triple, chip, features, targetFlags, linkFiles); +} + +NVVMTargetAttr NVVMTargetAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int optLevel, StringRef triple, StringRef chip, StringRef features, DictionaryAttr targetFlags, ArrayAttr linkFiles) { + return Base::get(context, optLevel, triple, chip, features, targetFlags, linkFiles); +} + +::mlir::Attribute NVVMTargetAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_O; + ::mlir::FailureOr _result_triple; + ::mlir::FailureOr _result_chip; + ::mlir::FailureOr _result_features; + ::mlir::FailureOr _result_flags; + ::mlir::FailureOr _result_link; + // Parse literal '<' + if (odsParser.parseOptionalLess()) { + } else { + // Parse parameter struct + bool _seen_O = false; + bool _seen_triple = false; + bool _seen_chip = false; + bool _seen_features = false; + bool _seen_flags = false; + bool _seen_link = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_O && _paramKey == "O") { + _seen_O = true; + + // Parse variable 'O' + _result_O = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_O)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVVM_TargettAttr parameter 'O' which is to be a `int`"); + return {}; + } + } else if (!_seen_triple && _paramKey == "triple") { + _seen_triple = true; + + // Parse variable 'triple' + _result_triple = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_triple)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVVM_TargettAttr parameter 'triple' which is to be a `::llvm::StringRef`"); + return {}; + } + } else if (!_seen_chip && _paramKey == "chip") { + _seen_chip = true; + + // Parse variable 'chip' + _result_chip = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_chip)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVVM_TargettAttr parameter 'chip' which is to be a `::llvm::StringRef`"); + return {}; + } + } else if (!_seen_features && _paramKey == "features") { + _seen_features = true; + + // Parse variable 'features' + _result_features = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_features)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVVM_TargettAttr parameter 'features' which is to be a `::llvm::StringRef`"); + return {}; + } + } else if (!_seen_flags && _paramKey == "flags") { + _seen_flags = true; + + // Parse variable 'flags' + _result_flags = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_flags)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVVM_TargettAttr parameter 'flags' which is to be a `DictionaryAttr`"); + return {}; + } + } else if (!_seen_link && _paramKey == "link") { + _seen_link = true; + + // Parse variable 'link' + _result_link = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_link)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVVM_TargettAttr parameter 'link' which is to be a `ArrayAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + } + return odsParser.getChecked(odsLoc, odsParser.getContext(), + int((_result_O.value_or(2))), + ::llvm::StringRef((_result_triple.value_or("nvptx64-nvidia-cuda"))), + ::llvm::StringRef((_result_chip.value_or("sm_50"))), + ::llvm::StringRef((_result_features.value_or("+ptx60"))), + DictionaryAttr((_result_flags.value_or(DictionaryAttr()))), + ArrayAttr((_result_link.value_or(ArrayAttr())))); +} + +void NVVMTargetAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + if (!(getO() == 2) || !(getTriple() == "nvptx64-nvidia-cuda") || !(getChip() == "sm_50") || !(getFeatures() == "+ptx60") || !(getFlags() == DictionaryAttr()) || !(getLink() == ArrayAttr())) { + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getO() == 2)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "O = "; + if (!(getO() == 2)) { + odsPrinter.printStrippedAttrOrType(getO()); + } + } + if (!(getTriple() == "nvptx64-nvidia-cuda")) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "triple = "; + if (!(getTriple() == "nvptx64-nvidia-cuda")) { + odsPrinter.printString(getTriple());; + } + } + if (!(getChip() == "sm_50")) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "chip = "; + if (!(getChip() == "sm_50")) { + odsPrinter.printString(getChip());; + } + } + if (!(getFeatures() == "+ptx60")) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "features = "; + if (!(getFeatures() == "+ptx60")) { + odsPrinter.printString(getFeatures());; + } + } + if (!(getFlags() == DictionaryAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "flags = "; + if (!(getFlags() == DictionaryAttr())) { + odsPrinter.printStrippedAttrOrType(getFlags()); + } + } + if (!(getLink() == ArrayAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "link = "; + if (!(getLink() == ArrayAttr())) { + odsPrinter.printStrippedAttrOrType(getLink()); + } + } + } + odsPrinter << ">"; + } else { + } +} + +int NVVMTargetAttr::getO() const { + return getImpl()->O; +} + +::llvm::StringRef NVVMTargetAttr::getTriple() const { + return getImpl()->triple; +} + +::llvm::StringRef NVVMTargetAttr::getChip() const { + return getImpl()->chip; +} + +::llvm::StringRef NVVMTargetAttr::getFeatures() const { + return getImpl()->features; +} + +DictionaryAttr NVVMTargetAttr::getFlags() const { + return getImpl()->flags; +} + +ArrayAttr NVVMTargetAttr::getLink() const { + return getImpl()->link; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::NVVMTargetAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct ReduxKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::ReduxKind>; + ReduxKindAttrStorage(::mlir::NVVM::ReduxKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ReduxKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ReduxKindAttrStorage(std::move(value)); + } + + ::mlir::NVVM::ReduxKind value; +}; +} // namespace detail +ReduxKindAttr ReduxKindAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::ReduxKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ReduxKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::ReduxKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::ReduxKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeReduxKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::ReduxKind" << " to be one of: " << "add" << ", " << "and" << ", " << "max" << ", " << "min" << ", " << "or" << ", " << "umax" << ", " << "umin" << ", " << "xor")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ReduxKindAttr parameter 'value' which is to be a `::mlir::NVVM::ReduxKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ReduxKindAttr::get(odsParser.getContext(), + ::mlir::NVVM::ReduxKind((*_result_value))); +} + +void ReduxKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyReduxKind(getValue()); +} + +::mlir::NVVM::ReduxKind ReduxKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ReduxKindAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct ShflKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::ShflKind>; + ShflKindAttrStorage(::mlir::NVVM::ShflKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ShflKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ShflKindAttrStorage(std::move(value)); + } + + ::mlir::NVVM::ShflKind value; +}; +} // namespace detail +ShflKindAttr ShflKindAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::ShflKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ShflKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::ShflKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::ShflKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeShflKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::ShflKind" << " to be one of: " << "bfly" << ", " << "up" << ", " << "down" << ", " << "idx")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ShflKindAttr parameter 'value' which is to be a `::mlir::NVVM::ShflKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ShflKindAttr::get(odsParser.getContext(), + ::mlir::NVVM::ShflKind((*_result_value))); +} + +void ShflKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyShflKind(getValue()); +} + +::mlir::NVVM::ShflKind ShflKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::ShflKindAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct WGMMAScaleInAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::WGMMAScaleIn>; + WGMMAScaleInAttrStorage(::mlir::NVVM::WGMMAScaleIn value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static WGMMAScaleInAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) WGMMAScaleInAttrStorage(std::move(value)); + } + + ::mlir::NVVM::WGMMAScaleIn value; +}; +} // namespace detail +WGMMAScaleInAttr WGMMAScaleInAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::WGMMAScaleIn value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute WGMMAScaleInAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::WGMMAScaleIn> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::WGMMAScaleIn> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeWGMMAScaleIn(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::WGMMAScaleIn" << " to be one of: " << "one" << ", " << "neg")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse WGMMAScaleInAttr parameter 'value' which is to be a `::mlir::NVVM::WGMMAScaleIn`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return WGMMAScaleInAttr::get(odsParser.getContext(), + ::mlir::NVVM::WGMMAScaleIn((*_result_value))); +} + +void WGMMAScaleInAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyWGMMAScaleIn(getValue()); + odsPrinter << ">"; +} + +::mlir::NVVM::WGMMAScaleIn WGMMAScaleInAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WGMMAScaleInAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct WGMMAScaleOutAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::WGMMAScaleOut>; + WGMMAScaleOutAttrStorage(::mlir::NVVM::WGMMAScaleOut value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static WGMMAScaleOutAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) WGMMAScaleOutAttrStorage(std::move(value)); + } + + ::mlir::NVVM::WGMMAScaleOut value; +}; +} // namespace detail +WGMMAScaleOutAttr WGMMAScaleOutAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::WGMMAScaleOut value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute WGMMAScaleOutAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::WGMMAScaleOut> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::WGMMAScaleOut> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeWGMMAScaleOut(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::WGMMAScaleOut" << " to be one of: " << "zero" << ", " << "one")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse WGMMAScaleOutAttr parameter 'value' which is to be a `::mlir::NVVM::WGMMAScaleOut`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return WGMMAScaleOutAttr::get(odsParser.getContext(), + ::mlir::NVVM::WGMMAScaleOut((*_result_value))); +} + +void WGMMAScaleOutAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyWGMMAScaleOut(getValue()); + odsPrinter << ">"; +} + +::mlir::NVVM::WGMMAScaleOut WGMMAScaleOutAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WGMMAScaleOutAttr) +namespace mlir { +namespace NVVM { +namespace detail { +struct WGMMATypesAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::NVVM::WGMMATypes>; + WGMMATypesAttrStorage(::mlir::NVVM::WGMMATypes value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static WGMMATypesAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) WGMMATypesAttrStorage(std::move(value)); + } + + ::mlir::NVVM::WGMMATypes value; +}; +} // namespace detail +WGMMATypesAttr WGMMATypesAttr::get(::mlir::MLIRContext *context, ::mlir::NVVM::WGMMATypes value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute WGMMATypesAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::NVVM::WGMMATypes> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::NVVM::WGMMATypes> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::NVVM::symbolizeWGMMATypes(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::NVVM::WGMMATypes" << " to be one of: " << "f16" << ", " << "tf32" << ", " << "u8" << ", " << "s8" << ", " << "b1" << ", " << "bf16" << ", " << "e4m3" << ", " << "e5m2")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse WGMMATypesAttr parameter 'value' which is to be a `::mlir::NVVM::WGMMATypes`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return WGMMATypesAttr::get(odsParser.getContext(), + ::mlir::NVVM::WGMMATypes((*_result_value))); +} + +void WGMMATypesAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyWGMMATypes(getValue()); + odsPrinter << ">"; +} + +::mlir::NVVM::WGMMATypes WGMMATypesAttr::getValue() const { + return getImpl()->value; +} + +} // namespace NVVM +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::WGMMATypesAttr) +namespace mlir { +namespace NVVM { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute NVVMDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void NVVMDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace NVVM +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..56dfad0c7f6e9395a1880c07ffbef9c6e2ad490a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.h.inc @@ -0,0 +1,257 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace NVVM { +class LoadCacheModifierKindAttr; +class MMAB1OpAttr; +class MMAFragAttr; +class MMAIntOverflowAttr; +class MMALayoutAttr; +class MMATypesAttr; +class MMAShapeAttr; +class NVVMTargetAttr; +class ReduxKindAttr; +class ShflKindAttr; +class WGMMAScaleInAttr; +class WGMMAScaleOutAttr; +class WGMMATypesAttr; +namespace detail { +struct LoadCacheModifierKindAttrStorage; +} // namespace detail +class LoadCacheModifierKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static LoadCacheModifierKindAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::LoadCacheModifierKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"load_cache_modifier"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::LoadCacheModifierKind getValue() const; +}; +namespace detail { +struct MMAB1OpAttrStorage; +} // namespace detail +class MMAB1OpAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static MMAB1OpAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::MMAB1Op value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mma_b1op"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::MMAB1Op getValue() const; +}; +namespace detail { +struct MMAFragAttrStorage; +} // namespace detail +class MMAFragAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static MMAFragAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::MMAFrag value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mma_frag"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::MMAFrag getValue() const; +}; +namespace detail { +struct MMAIntOverflowAttrStorage; +} // namespace detail +class MMAIntOverflowAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static MMAIntOverflowAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::MMAIntOverflow value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mma_int_overflow"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::MMAIntOverflow getValue() const; +}; +namespace detail { +struct MMALayoutAttrStorage; +} // namespace detail +class MMALayoutAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static MMALayoutAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::MMALayout value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mma_layout"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::MMALayout getValue() const; +}; +namespace detail { +struct MMATypesAttrStorage; +} // namespace detail +class MMATypesAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static MMATypesAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::MMATypes value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mma_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::MMATypes getValue() const; +}; +namespace detail { +struct MMAShapeAttrStorage; +} // namespace detail +class MMAShapeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static MMAShapeAttr get(::mlir::MLIRContext *context, int m, int n, int k); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"shape"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int getM() const; + int getN() const; + int getK() const; +}; +namespace detail { +struct NVVMTargetAttrStorage; +} // namespace detail +class NVVMTargetAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + bool hasFlag(StringRef flag) const; + bool hasFastMath() const; + bool hasFtz() const; + using Base::getChecked; + static NVVMTargetAttr get(::mlir::MLIRContext *context, int optLevel = 2, StringRef triple = "nvptx64-nvidia-cuda", StringRef chip = "sm_50", StringRef features = "+ptx60", DictionaryAttr targetFlags = nullptr, ArrayAttr linkFiles = nullptr); + static NVVMTargetAttr getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int optLevel = 2, StringRef triple = "nvptx64-nvidia-cuda", StringRef chip = "sm_50", StringRef features = "+ptx60", DictionaryAttr targetFlags = nullptr, ArrayAttr linkFiles = nullptr); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, int O, ::llvm::StringRef triple, ::llvm::StringRef chip, ::llvm::StringRef features, DictionaryAttr flags, ArrayAttr link); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"target"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int getO() const; + ::llvm::StringRef getTriple() const; + ::llvm::StringRef getChip() const; + ::llvm::StringRef getFeatures() const; + DictionaryAttr getFlags() const; + ArrayAttr getLink() const; +}; +namespace detail { +struct ReduxKindAttrStorage; +} // namespace detail +class ReduxKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ReduxKindAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::ReduxKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"redux_kind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::ReduxKind getValue() const; +}; +namespace detail { +struct ShflKindAttrStorage; +} // namespace detail +class ShflKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ShflKindAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::ShflKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"shfl_kind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::ShflKind getValue() const; +}; +namespace detail { +struct WGMMAScaleInAttrStorage; +} // namespace detail +class WGMMAScaleInAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static WGMMAScaleInAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::WGMMAScaleIn value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"wgmma_scale_in"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::WGMMAScaleIn getValue() const; +}; +namespace detail { +struct WGMMAScaleOutAttrStorage; +} // namespace detail +class WGMMAScaleOutAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static WGMMAScaleOutAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::WGMMAScaleOut value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"wgmma_scale_out"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::WGMMAScaleOut getValue() const; +}; +namespace detail { +struct WGMMATypesAttrStorage; +} // namespace detail +class WGMMATypesAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static WGMMATypesAttr get(::mlir::MLIRContext *context, ::mlir::NVVM::WGMMATypes value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"wgmma_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::NVVM::WGMMATypes getValue() const; +}; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::LoadCacheModifierKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMAB1OpAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMAFragAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMAIntOverflowAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMALayoutAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMATypesAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::MMAShapeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::NVVMTargetAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ReduxKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::ShflKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WGMMAScaleInAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WGMMAScaleOutAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::WGMMATypesAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..d2be5acbf237a3bcd5596733b74a325a2b99725f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::NVVM::NVVMDialect) +namespace mlir { +namespace NVVM { + +NVVMDialect::NVVMDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + initialize(); +} + +NVVMDialect::~NVVMDialect() = default; + +} // namespace NVVM +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..18129785a2595e1008c09014ff637fe1bb231737 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsDialect.h.inc @@ -0,0 +1,66 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace NVVM { + +class NVVMDialect : public ::mlir::Dialect { + explicit NVVMDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~NVVMDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("nvvm"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Provides a hook for verifying dialect attributes attached to the given + /// op. + ::mlir::LogicalResult verifyOperationAttribute( + ::mlir::Operation *op, ::mlir::NamedAttribute attribute) override; + + /// Get the name of the attribute used to annotate external kernel + /// functions. + static StringRef getKernelFuncAttrName() { return "nvvm.kernel"; } + /// Get the name of the attribute used to annotate max threads required + /// per CTA for kernel functions. + static StringRef getMaxntidAttrName() { return "nvvm.maxntid"; } + /// Get the name of the metadata names for each dimension + static StringRef getMaxntidXName() { return "maxntidx"; } + static StringRef getMaxntidYName() { return "maxntidy"; } + static StringRef getMaxntidZName() { return "maxntidz"; } + + /// Get the name of the attribute used to annotate exact threads required + /// per CTA for kernel functions. + static StringRef getReqntidAttrName() { return "nvvm.reqntid"; } + /// Get the name of the metadata names for each dimension + static StringRef getReqntidXName() { return "reqntidx"; } + static StringRef getReqntidYName() { return "reqntidy"; } + static StringRef getReqntidZName() { return "reqntidz"; } + + /// Get the name of the attribute used to annotate min CTA required + /// per SM for kernel functions. + static StringRef getMinctasmAttrName() { return "nvvm.minctasm"; } + + /// Get the name of the attribute used to annotate max number of + /// registers that can be allocated per thread. + static StringRef getMaxnregAttrName() { return "nvvm.maxnreg"; } + }; +} // namespace NVVM +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::NVVM::NVVMDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..1908851873b148863b3167d0e96911b742149c65 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsEnums.cpp.inc @@ -0,0 +1,423 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyLoadCacheModifierKind(LoadCacheModifierKind val) { + switch (val) { + case LoadCacheModifierKind::CA: return "ca"; + case LoadCacheModifierKind::CG: return "cg"; + case LoadCacheModifierKind::CS: return "cs"; + case LoadCacheModifierKind::LU: return "lu"; + case LoadCacheModifierKind::CV: return "cv"; + } + return ""; +} + +::std::optional symbolizeLoadCacheModifierKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("ca", LoadCacheModifierKind::CA) + .Case("cg", LoadCacheModifierKind::CG) + .Case("cs", LoadCacheModifierKind::CS) + .Case("lu", LoadCacheModifierKind::LU) + .Case("cv", LoadCacheModifierKind::CV) + .Default(::std::nullopt); +} +::std::optional symbolizeLoadCacheModifierKind(uint32_t value) { + switch (value) { + case 0: return LoadCacheModifierKind::CA; + case 1: return LoadCacheModifierKind::CG; + case 2: return LoadCacheModifierKind::CS; + case 3: return LoadCacheModifierKind::LU; + case 4: return LoadCacheModifierKind::CV; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyMMAB1Op(MMAB1Op val) { + switch (val) { + case MMAB1Op::none: return "none"; + case MMAB1Op::xor_popc: return "xor_popc"; + case MMAB1Op::and_popc: return "and_popc"; + } + return ""; +} + +::std::optional symbolizeMMAB1Op(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("none", MMAB1Op::none) + .Case("xor_popc", MMAB1Op::xor_popc) + .Case("and_popc", MMAB1Op::and_popc) + .Default(::std::nullopt); +} +::std::optional symbolizeMMAB1Op(uint32_t value) { + switch (value) { + case 0: return MMAB1Op::none; + case 1: return MMAB1Op::xor_popc; + case 2: return MMAB1Op::and_popc; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyMMAFrag(MMAFrag val) { + switch (val) { + case MMAFrag::a: return "a"; + case MMAFrag::b: return "b"; + case MMAFrag::c: return "c"; + } + return ""; +} + +::std::optional symbolizeMMAFrag(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("a", MMAFrag::a) + .Case("b", MMAFrag::b) + .Case("c", MMAFrag::c) + .Default(::std::nullopt); +} +::std::optional symbolizeMMAFrag(uint32_t value) { + switch (value) { + case 0: return MMAFrag::a; + case 1: return MMAFrag::b; + case 2: return MMAFrag::c; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyMMAIntOverflow(MMAIntOverflow val) { + switch (val) { + case MMAIntOverflow::satfinite: return "satfinite"; + case MMAIntOverflow::wrapped: return "wrapped"; + } + return ""; +} + +::std::optional symbolizeMMAIntOverflow(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("satfinite", MMAIntOverflow::satfinite) + .Case("wrapped", MMAIntOverflow::wrapped) + .Default(::std::nullopt); +} +::std::optional symbolizeMMAIntOverflow(uint32_t value) { + switch (value) { + case 1: return MMAIntOverflow::satfinite; + case 0: return MMAIntOverflow::wrapped; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyMMALayout(MMALayout val) { + switch (val) { + case MMALayout::row: return "row"; + case MMALayout::col: return "col"; + } + return ""; +} + +::std::optional symbolizeMMALayout(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("row", MMALayout::row) + .Case("col", MMALayout::col) + .Default(::std::nullopt); +} +::std::optional symbolizeMMALayout(uint32_t value) { + switch (value) { + case 0: return MMALayout::row; + case 1: return MMALayout::col; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyMMATypes(MMATypes val) { + switch (val) { + case MMATypes::f16: return "f16"; + case MMATypes::f32: return "f32"; + case MMATypes::tf32: return "tf32"; + case MMATypes::bf16: return "bf16"; + case MMATypes::s8: return "s8"; + case MMATypes::u8: return "u8"; + case MMATypes::s32: return "s32"; + case MMATypes::s4: return "s4"; + case MMATypes::u4: return "u4"; + case MMATypes::b1: return "b1"; + case MMATypes::f64: return "f64"; + } + return ""; +} + +::std::optional symbolizeMMATypes(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("f16", MMATypes::f16) + .Case("f32", MMATypes::f32) + .Case("tf32", MMATypes::tf32) + .Case("bf16", MMATypes::bf16) + .Case("s8", MMATypes::s8) + .Case("u8", MMATypes::u8) + .Case("s32", MMATypes::s32) + .Case("s4", MMATypes::s4) + .Case("u4", MMATypes::u4) + .Case("b1", MMATypes::b1) + .Case("f64", MMATypes::f64) + .Default(::std::nullopt); +} +::std::optional symbolizeMMATypes(uint32_t value) { + switch (value) { + case 0: return MMATypes::f16; + case 1: return MMATypes::f32; + case 2: return MMATypes::tf32; + case 9: return MMATypes::bf16; + case 4: return MMATypes::s8; + case 3: return MMATypes::u8; + case 5: return MMATypes::s32; + case 8: return MMATypes::s4; + case 7: return MMATypes::u4; + case 6: return MMATypes::b1; + case 10: return MMATypes::f64; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyPTXRegisterMod(PTXRegisterMod val) { + switch (val) { + case PTXRegisterMod::Read: return "read"; + case PTXRegisterMod::Write: return "write"; + case PTXRegisterMod::ReadWrite: return "readwrite"; + } + return ""; +} + +::std::optional symbolizePTXRegisterMod(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("read", PTXRegisterMod::Read) + .Case("write", PTXRegisterMod::Write) + .Case("readwrite", PTXRegisterMod::ReadWrite) + .Default(::std::nullopt); +} +::std::optional symbolizePTXRegisterMod(uint32_t value) { + switch (value) { + case 0: return PTXRegisterMod::Read; + case 2: return PTXRegisterMod::Write; + case 1: return PTXRegisterMod::ReadWrite; + default: return ::std::nullopt; + } +} + +bool PTXRegisterModAttr::classof(::mlir::Attribute attr) { + return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && (((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 0)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 2)) || ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() == 1))); +} +PTXRegisterModAttr PTXRegisterModAttr::get(::mlir::MLIRContext *context, PTXRegisterMod val) { + ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 32); + ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast(val)); + return ::llvm::cast(baseAttr); +} +PTXRegisterMod PTXRegisterModAttr::getValue() const { + return static_cast(::mlir::IntegerAttr::getInt()); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyReduxKind(ReduxKind val) { + switch (val) { + case ReduxKind::ADD: return "add"; + case ReduxKind::AND: return "and"; + case ReduxKind::MAX: return "max"; + case ReduxKind::MIN: return "min"; + case ReduxKind::OR: return "or"; + case ReduxKind::UMAX: return "umax"; + case ReduxKind::UMIN: return "umin"; + case ReduxKind::XOR: return "xor"; + } + return ""; +} + +::std::optional symbolizeReduxKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("add", ReduxKind::ADD) + .Case("and", ReduxKind::AND) + .Case("max", ReduxKind::MAX) + .Case("min", ReduxKind::MIN) + .Case("or", ReduxKind::OR) + .Case("umax", ReduxKind::UMAX) + .Case("umin", ReduxKind::UMIN) + .Case("xor", ReduxKind::XOR) + .Default(::std::nullopt); +} +::std::optional symbolizeReduxKind(uint32_t value) { + switch (value) { + case 1: return ReduxKind::ADD; + case 2: return ReduxKind::AND; + case 3: return ReduxKind::MAX; + case 4: return ReduxKind::MIN; + case 5: return ReduxKind::OR; + case 6: return ReduxKind::UMAX; + case 7: return ReduxKind::UMIN; + case 8: return ReduxKind::XOR; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyShflKind(ShflKind val) { + switch (val) { + case ShflKind::bfly: return "bfly"; + case ShflKind::up: return "up"; + case ShflKind::down: return "down"; + case ShflKind::idx: return "idx"; + } + return ""; +} + +::std::optional symbolizeShflKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("bfly", ShflKind::bfly) + .Case("up", ShflKind::up) + .Case("down", ShflKind::down) + .Case("idx", ShflKind::idx) + .Default(::std::nullopt); +} +::std::optional symbolizeShflKind(uint32_t value) { + switch (value) { + case 0: return ShflKind::bfly; + case 1: return ShflKind::up; + case 2: return ShflKind::down; + case 3: return ShflKind::idx; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyWGMMAScaleIn(WGMMAScaleIn val) { + switch (val) { + case WGMMAScaleIn::one: return "one"; + case WGMMAScaleIn::neg: return "neg"; + } + return ""; +} + +::std::optional symbolizeWGMMAScaleIn(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("one", WGMMAScaleIn::one) + .Case("neg", WGMMAScaleIn::neg) + .Default(::std::nullopt); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyWGMMAScaleOut(WGMMAScaleOut val) { + switch (val) { + case WGMMAScaleOut::zero: return "zero"; + case WGMMAScaleOut::one: return "one"; + } + return ""; +} + +::std::optional symbolizeWGMMAScaleOut(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("zero", WGMMAScaleOut::zero) + .Case("one", WGMMAScaleOut::one) + .Default(::std::nullopt); +} +::std::optional symbolizeWGMMAScaleOut(uint32_t value) { + switch (value) { + case 0: return WGMMAScaleOut::zero; + case 1: return WGMMAScaleOut::one; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + +namespace mlir { +namespace NVVM { +::llvm::StringRef stringifyWGMMATypes(WGMMATypes val) { + switch (val) { + case WGMMATypes::f16: return "f16"; + case WGMMATypes::tf32: return "tf32"; + case WGMMATypes::u8: return "u8"; + case WGMMATypes::s8: return "s8"; + case WGMMATypes::b1: return "b1"; + case WGMMATypes::bf16: return "bf16"; + case WGMMATypes::e4m3: return "e4m3"; + case WGMMATypes::e5m2: return "e5m2"; + } + return ""; +} + +::std::optional symbolizeWGMMATypes(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("f16", WGMMATypes::f16) + .Case("tf32", WGMMATypes::tf32) + .Case("u8", WGMMATypes::u8) + .Case("s8", WGMMATypes::s8) + .Case("b1", WGMMATypes::b1) + .Case("bf16", WGMMATypes::bf16) + .Case("e4m3", WGMMATypes::e4m3) + .Case("e5m2", WGMMATypes::e5m2) + .Default(::std::nullopt); +} +::std::optional symbolizeWGMMATypes(uint32_t value) { + switch (value) { + case 0: return WGMMATypes::f16; + case 1: return WGMMATypes::tf32; + case 2: return WGMMATypes::u8; + case 3: return WGMMATypes::s8; + case 4: return WGMMATypes::b1; + case 5: return WGMMATypes::bf16; + case 6: return WGMMATypes::e4m3; + case 7: return WGMMATypes::e5m2; + default: return ::std::nullopt; + } +} + +} // namespace NVVM +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..5af3546b28c07dc0bad6e09a3dc5b47654b7fd3f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsEnums.h.inc @@ -0,0 +1,1014 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVVMOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace NVVM { +// NVVM load cache modifier kind +enum class LoadCacheModifierKind : uint32_t { + CA = 0, + CG = 1, + CS = 2, + LU = 3, + CV = 4, +}; + +::std::optional symbolizeLoadCacheModifierKind(uint32_t); +::llvm::StringRef stringifyLoadCacheModifierKind(LoadCacheModifierKind); +::std::optional symbolizeLoadCacheModifierKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForLoadCacheModifierKind() { + return 4; +} + + +inline ::llvm::StringRef stringifyEnum(LoadCacheModifierKind enumValue) { + return stringifyLoadCacheModifierKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeLoadCacheModifierKind(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::LoadCacheModifierKind, ::mlir::NVVM::LoadCacheModifierKind> { + template + static FailureOr<::mlir::NVVM::LoadCacheModifierKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for NVVM load cache modifier kind"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::LoadCacheModifierKind> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::LoadCacheModifierKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid NVVM load cache modifier kind specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::LoadCacheModifierKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::LoadCacheModifierKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::LoadCacheModifierKind getEmptyKey() { + return static_cast<::mlir::NVVM::LoadCacheModifierKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::LoadCacheModifierKind getTombstoneKey() { + return static_cast<::mlir::NVVM::LoadCacheModifierKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::LoadCacheModifierKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::LoadCacheModifierKind &lhs, const ::mlir::NVVM::LoadCacheModifierKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// MMA binary operations +enum class MMAB1Op : uint32_t { + none = 0, + xor_popc = 1, + and_popc = 2, +}; + +::std::optional symbolizeMMAB1Op(uint32_t); +::llvm::StringRef stringifyMMAB1Op(MMAB1Op); +::std::optional symbolizeMMAB1Op(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForMMAB1Op() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(MMAB1Op enumValue) { + return stringifyMMAB1Op(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeMMAB1Op(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::MMAB1Op, ::mlir::NVVM::MMAB1Op> { + template + static FailureOr<::mlir::NVVM::MMAB1Op> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for MMA binary operations"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::MMAB1Op> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::MMAB1Op>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid MMA binary operations specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::MMAB1Op value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::MMAB1Op> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::MMAB1Op getEmptyKey() { + return static_cast<::mlir::NVVM::MMAB1Op>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::MMAB1Op getTombstoneKey() { + return static_cast<::mlir::NVVM::MMAB1Op>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::MMAB1Op &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::MMAB1Op &lhs, const ::mlir::NVVM::MMAB1Op &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// NVVM MMA frag type +enum class MMAFrag : uint32_t { + a = 0, + b = 1, + c = 2, +}; + +::std::optional symbolizeMMAFrag(uint32_t); +::llvm::StringRef stringifyMMAFrag(MMAFrag); +::std::optional symbolizeMMAFrag(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForMMAFrag() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(MMAFrag enumValue) { + return stringifyMMAFrag(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeMMAFrag(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::MMAFrag, ::mlir::NVVM::MMAFrag> { + template + static FailureOr<::mlir::NVVM::MMAFrag> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for NVVM MMA frag type"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::MMAFrag> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::MMAFrag>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid NVVM MMA frag type specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::MMAFrag value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::MMAFrag> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::MMAFrag getEmptyKey() { + return static_cast<::mlir::NVVM::MMAFrag>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::MMAFrag getTombstoneKey() { + return static_cast<::mlir::NVVM::MMAFrag>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::MMAFrag &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::MMAFrag &lhs, const ::mlir::NVVM::MMAFrag &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// MMA overflow options +enum class MMAIntOverflow : uint32_t { + satfinite = 1, + wrapped = 0, +}; + +::std::optional symbolizeMMAIntOverflow(uint32_t); +::llvm::StringRef stringifyMMAIntOverflow(MMAIntOverflow); +::std::optional symbolizeMMAIntOverflow(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForMMAIntOverflow() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(MMAIntOverflow enumValue) { + return stringifyMMAIntOverflow(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeMMAIntOverflow(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::MMAIntOverflow, ::mlir::NVVM::MMAIntOverflow> { + template + static FailureOr<::mlir::NVVM::MMAIntOverflow> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for MMA overflow options"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::MMAIntOverflow> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::MMAIntOverflow>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid MMA overflow options specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::MMAIntOverflow value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::MMAIntOverflow> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::MMAIntOverflow getEmptyKey() { + return static_cast<::mlir::NVVM::MMAIntOverflow>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::MMAIntOverflow getTombstoneKey() { + return static_cast<::mlir::NVVM::MMAIntOverflow>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::MMAIntOverflow &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::MMAIntOverflow &lhs, const ::mlir::NVVM::MMAIntOverflow &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// NVVM MMA layout +enum class MMALayout : uint32_t { + row = 0, + col = 1, +}; + +::std::optional symbolizeMMALayout(uint32_t); +::llvm::StringRef stringifyMMALayout(MMALayout); +::std::optional symbolizeMMALayout(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForMMALayout() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(MMALayout enumValue) { + return stringifyMMALayout(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeMMALayout(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::MMALayout, ::mlir::NVVM::MMALayout> { + template + static FailureOr<::mlir::NVVM::MMALayout> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for NVVM MMA layout"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::MMALayout> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::MMALayout>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid NVVM MMA layout specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::MMALayout value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::MMALayout> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::MMALayout getEmptyKey() { + return static_cast<::mlir::NVVM::MMALayout>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::MMALayout getTombstoneKey() { + return static_cast<::mlir::NVVM::MMALayout>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::MMALayout &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::MMALayout &lhs, const ::mlir::NVVM::MMALayout &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// NVVM MMA types +enum class MMATypes : uint32_t { + f16 = 0, + f32 = 1, + tf32 = 2, + bf16 = 9, + s8 = 4, + u8 = 3, + s32 = 5, + s4 = 8, + u4 = 7, + b1 = 6, + f64 = 10, +}; + +::std::optional symbolizeMMATypes(uint32_t); +::llvm::StringRef stringifyMMATypes(MMATypes); +::std::optional symbolizeMMATypes(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForMMATypes() { + return 10; +} + + +inline ::llvm::StringRef stringifyEnum(MMATypes enumValue) { + return stringifyMMATypes(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeMMATypes(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::MMATypes, ::mlir::NVVM::MMATypes> { + template + static FailureOr<::mlir::NVVM::MMATypes> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for NVVM MMA types"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::MMATypes> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::MMATypes>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid NVVM MMA types specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::MMATypes value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::MMATypes> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::MMATypes getEmptyKey() { + return static_cast<::mlir::NVVM::MMATypes>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::MMATypes getTombstoneKey() { + return static_cast<::mlir::NVVM::MMATypes>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::MMATypes &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::MMATypes &lhs, const ::mlir::NVVM::MMATypes &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// Register read/write modifier to build cosntraint string for PTX inline +enum class PTXRegisterMod : uint32_t { + Read = 0, + Write = 2, + ReadWrite = 1, +}; + +::std::optional symbolizePTXRegisterMod(uint32_t); +::llvm::StringRef stringifyPTXRegisterMod(PTXRegisterMod); +::std::optional symbolizePTXRegisterMod(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForPTXRegisterMod() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(PTXRegisterMod enumValue) { + return stringifyPTXRegisterMod(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizePTXRegisterMod(str); +} + +class PTXRegisterModAttr : public ::mlir::IntegerAttr { +public: + using ValueType = PTXRegisterMod; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static PTXRegisterModAttr get(::mlir::MLIRContext *context, PTXRegisterMod val); + PTXRegisterMod getValue() const; +}; +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::PTXRegisterMod, ::mlir::NVVM::PTXRegisterMod> { + template + static FailureOr<::mlir::NVVM::PTXRegisterMod> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Register read/write modifier to build cosntraint string for PTX inline"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::PTXRegisterMod> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::PTXRegisterMod>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Register read/write modifier to build cosntraint string for PTX inline specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::PTXRegisterMod value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::PTXRegisterMod> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::PTXRegisterMod getEmptyKey() { + return static_cast<::mlir::NVVM::PTXRegisterMod>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::PTXRegisterMod getTombstoneKey() { + return static_cast<::mlir::NVVM::PTXRegisterMod>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::PTXRegisterMod &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::PTXRegisterMod &lhs, const ::mlir::NVVM::PTXRegisterMod &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// NVVM redux kind +enum class ReduxKind : uint32_t { + ADD = 1, + AND = 2, + MAX = 3, + MIN = 4, + OR = 5, + UMAX = 6, + UMIN = 7, + XOR = 8, +}; + +::std::optional symbolizeReduxKind(uint32_t); +::llvm::StringRef stringifyReduxKind(ReduxKind); +::std::optional symbolizeReduxKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForReduxKind() { + return 8; +} + + +inline ::llvm::StringRef stringifyEnum(ReduxKind enumValue) { + return stringifyReduxKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeReduxKind(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::ReduxKind, ::mlir::NVVM::ReduxKind> { + template + static FailureOr<::mlir::NVVM::ReduxKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for NVVM redux kind"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::ReduxKind> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::ReduxKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid NVVM redux kind specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::ReduxKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::ReduxKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::ReduxKind getEmptyKey() { + return static_cast<::mlir::NVVM::ReduxKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::ReduxKind getTombstoneKey() { + return static_cast<::mlir::NVVM::ReduxKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::ReduxKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::ReduxKind &lhs, const ::mlir::NVVM::ReduxKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// NVVM shuffle kind +enum class ShflKind : uint32_t { + bfly = 0, + up = 1, + down = 2, + idx = 3, +}; + +::std::optional symbolizeShflKind(uint32_t); +::llvm::StringRef stringifyShflKind(ShflKind); +::std::optional symbolizeShflKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForShflKind() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(ShflKind enumValue) { + return stringifyShflKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeShflKind(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::ShflKind, ::mlir::NVVM::ShflKind> { + template + static FailureOr<::mlir::NVVM::ShflKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for NVVM shuffle kind"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::ShflKind> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::ShflKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid NVVM shuffle kind specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::ShflKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::ShflKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::ShflKind getEmptyKey() { + return static_cast<::mlir::NVVM::ShflKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::ShflKind getTombstoneKey() { + return static_cast<::mlir::NVVM::ShflKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::ShflKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::ShflKind &lhs, const ::mlir::NVVM::ShflKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// WGMMA overflow options +enum class WGMMAScaleIn : uint32_t { + one = 1, + neg, +}; + +::llvm::StringRef stringifyWGMMAScaleIn(WGMMAScaleIn); +::std::optional symbolizeWGMMAScaleIn(::llvm::StringRef); + +inline ::llvm::StringRef stringifyEnum(WGMMAScaleIn enumValue) { + return stringifyWGMMAScaleIn(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeWGMMAScaleIn(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::WGMMAScaleIn, ::mlir::NVVM::WGMMAScaleIn> { + template + static FailureOr<::mlir::NVVM::WGMMAScaleIn> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for WGMMA overflow options"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::WGMMAScaleIn> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::WGMMAScaleIn>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid WGMMA overflow options specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::WGMMAScaleIn value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::WGMMAScaleIn> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::WGMMAScaleIn getEmptyKey() { + return static_cast<::mlir::NVVM::WGMMAScaleIn>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::WGMMAScaleIn getTombstoneKey() { + return static_cast<::mlir::NVVM::WGMMAScaleIn>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::WGMMAScaleIn &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::WGMMAScaleIn &lhs, const ::mlir::NVVM::WGMMAScaleIn &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// WGMMA input predicate +enum class WGMMAScaleOut : uint32_t { + zero = 0, + one = 1, +}; + +::std::optional symbolizeWGMMAScaleOut(uint32_t); +::llvm::StringRef stringifyWGMMAScaleOut(WGMMAScaleOut); +::std::optional symbolizeWGMMAScaleOut(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForWGMMAScaleOut() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(WGMMAScaleOut enumValue) { + return stringifyWGMMAScaleOut(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeWGMMAScaleOut(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::WGMMAScaleOut, ::mlir::NVVM::WGMMAScaleOut> { + template + static FailureOr<::mlir::NVVM::WGMMAScaleOut> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for WGMMA input predicate"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::WGMMAScaleOut> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::WGMMAScaleOut>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid WGMMA input predicate specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::WGMMAScaleOut value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::WGMMAScaleOut> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::WGMMAScaleOut getEmptyKey() { + return static_cast<::mlir::NVVM::WGMMAScaleOut>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::WGMMAScaleOut getTombstoneKey() { + return static_cast<::mlir::NVVM::WGMMAScaleOut>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::WGMMAScaleOut &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::WGMMAScaleOut &lhs, const ::mlir::NVVM::WGMMAScaleOut &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace NVVM { +// NVVM WGMMA types +enum class WGMMATypes : uint32_t { + f16 = 0, + tf32 = 1, + u8 = 2, + s8 = 3, + b1 = 4, + bf16 = 5, + e4m3 = 6, + e5m2 = 7, +}; + +::std::optional symbolizeWGMMATypes(uint32_t); +::llvm::StringRef stringifyWGMMATypes(WGMMATypes); +::std::optional symbolizeWGMMATypes(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForWGMMATypes() { + return 7; +} + + +inline ::llvm::StringRef stringifyEnum(WGMMATypes enumValue) { + return stringifyWGMMATypes(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeWGMMATypes(str); +} +} // namespace NVVM +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::NVVM::WGMMATypes, ::mlir::NVVM::WGMMATypes> { + template + static FailureOr<::mlir::NVVM::WGMMATypes> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for NVVM WGMMA types"); + + // Symbolize the keyword. + if (::std::optional<::mlir::NVVM::WGMMATypes> attr = ::mlir::NVVM::symbolizeEnum<::mlir::NVVM::WGMMATypes>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid NVVM WGMMA types specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::NVVM::WGMMATypes value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::NVVM::WGMMATypes> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::NVVM::WGMMATypes getEmptyKey() { + return static_cast<::mlir::NVVM::WGMMATypes>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::NVVM::WGMMATypes getTombstoneKey() { + return static_cast<::mlir::NVVM::WGMMATypes>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::NVVM::WGMMATypes &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::NVVM::WGMMATypes &lhs, const ::mlir::NVVM::WGMMATypes &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsInterface.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsInterface.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..bf5cd5110fd4d72689742c2f0391c8bb44f6cbdb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsInterface.cpp.inc @@ -0,0 +1,30 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Returns whether the operation has intrinsic support in LLVM. +bool BasicPtxBuilderInterface::hasIntrinsic() { + return getImpl()->hasIntrinsic(getImpl(), getOperation()); + } +/// Return whether the operation has memory side effects. +bool BasicPtxBuilderInterface::hasSideEffect() { + return getImpl()->hasSideEffect(getImpl(), getOperation()); + } +/// Returns PTX code. +std::string BasicPtxBuilderInterface::getPtx() { + return getImpl()->getPtx(getImpl(), getOperation()); + } +/// Generate constant value. +::mlir::Value BasicPtxBuilderInterface::makeConstantI32(::mlir::RewriterBase & rewriter, int val) { + return getImpl()->makeConstantI32(getImpl(), getOperation(), rewriter, val); + } +/// Returns arguments to pass PTX code. +/// The order of arguments is started from the results and they are +/// used as write, followed by the operands and attributes. +void BasicPtxBuilderInterface::getAsmValues(::mlir::RewriterBase & rewriter, llvm::SmallVectorImpl>& asmValues) { + return getImpl()->getAsmValues(getImpl(), getOperation(), rewriter, asmValues); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsInterface.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsInterface.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ee3d5ebc1569120d7585521b341ee2f0cfb2dc1f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/NVVMOpsInterface.h.inc @@ -0,0 +1,177 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +class BasicPtxBuilderInterface; +namespace detail { +struct BasicPtxBuilderInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + bool (*hasIntrinsic)(const Concept *impl, ::mlir::Operation *); + bool (*hasSideEffect)(const Concept *impl, ::mlir::Operation *); + std::string (*getPtx)(const Concept *impl, ::mlir::Operation *); + ::mlir::Value (*makeConstantI32)(const Concept *impl, ::mlir::Operation *, ::mlir::RewriterBase &, int); + void (*getAsmValues)(const Concept *impl, ::mlir::Operation *, ::mlir::RewriterBase &, llvm::SmallVectorImpl>&); + }; + template + class Model : public Concept { + public: + using Interface = BasicPtxBuilderInterface; + Model() : Concept{hasIntrinsic, hasSideEffect, getPtx, makeConstantI32, getAsmValues} {} + + static inline bool hasIntrinsic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasSideEffect(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline std::string getPtx(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value makeConstantI32(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, int val); + static inline void getAsmValues(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, llvm::SmallVectorImpl>& asmValues); + }; + template + class FallbackModel : public Concept { + public: + using Interface = BasicPtxBuilderInterface; + FallbackModel() : Concept{hasIntrinsic, hasSideEffect, getPtx, makeConstantI32, getAsmValues} {} + + static inline bool hasIntrinsic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasSideEffect(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline std::string getPtx(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value makeConstantI32(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, int val); + static inline void getAsmValues(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, llvm::SmallVectorImpl>& asmValues); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + bool hasIntrinsic(::mlir::Operation *tablegen_opaque_val) const; + bool hasSideEffect(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::Value makeConstantI32(::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase &rewriter, int val) const; + void getAsmValues(::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase &rewriter, llvm::SmallVectorImpl>&asmValues) const; + }; +};template +struct BasicPtxBuilderInterfaceTrait; + +} // namespace detail +class BasicPtxBuilderInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::BasicPtxBuilderInterfaceTrait {}; + /// Returns whether the operation has intrinsic support in LLVM. + bool hasIntrinsic(); + /// Return whether the operation has memory side effects. + bool hasSideEffect(); + /// Returns PTX code. + std::string getPtx(); + /// Generate constant value. + ::mlir::Value makeConstantI32(::mlir::RewriterBase & rewriter, int val); + /// Returns arguments to pass PTX code. + /// The order of arguments is started from the results and they are + /// used as write, followed by the operands and attributes. + void getAsmValues(::mlir::RewriterBase & rewriter, llvm::SmallVectorImpl>& asmValues); +}; +namespace detail { + template + struct BasicPtxBuilderInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns whether the operation has intrinsic support in LLVM. + bool hasIntrinsic() { + return false; + } + /// Return whether the operation has memory side effects. + bool hasSideEffect() { + return true; + } + /// Generate constant value. + ::mlir::Value makeConstantI32(::mlir::RewriterBase & rewriter, int val) { + mlir::Operation* op = (*static_cast(this)); + return rewriter.create( + op->getLoc(), rewriter.getIntegerType(32), val); + } + /// Returns arguments to pass PTX code. + /// The order of arguments is started from the results and they are + /// used as write, followed by the operands and attributes. + void getAsmValues(::mlir::RewriterBase & rewriter, llvm::SmallVectorImpl>& asmValues) { + mlir::Operation* op = (*static_cast(this)); + for (auto val : op->getResults()) + asmValues.push_back({val, mlir::NVVM::PTXRegisterMod::Write}); + for (auto val : op->getOperands()) + asmValues.push_back({val, mlir::NVVM::PTXRegisterMod::Read}); + for (auto attr : op->getAttrs()) { + if (auto intAttr = dyn_cast(attr.getValue())) { + Value val = makeConstantI32(rewriter, intAttr.getInt()); + asmValues.push_back({val ,mlir::NVVM::PTXRegisterMod::Read}); + } + } + } + }; +}// namespace detail +template +bool detail::BasicPtxBuilderInterfaceInterfaceTraits::Model::hasIntrinsic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).hasIntrinsic(); +} +template +bool detail::BasicPtxBuilderInterfaceInterfaceTraits::Model::hasSideEffect(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).hasSideEffect(); +} +template +std::string detail::BasicPtxBuilderInterfaceInterfaceTraits::Model::getPtx(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getPtx(); +} +template +::mlir::Value detail::BasicPtxBuilderInterfaceInterfaceTraits::Model::makeConstantI32(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, int val) { + return (llvm::cast(tablegen_opaque_val)).makeConstantI32(rewriter, val); +} +template +void detail::BasicPtxBuilderInterfaceInterfaceTraits::Model::getAsmValues(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, llvm::SmallVectorImpl>& asmValues) { + return (llvm::cast(tablegen_opaque_val)).getAsmValues(rewriter, asmValues); +} +template +bool detail::BasicPtxBuilderInterfaceInterfaceTraits::FallbackModel::hasIntrinsic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->hasIntrinsic(tablegen_opaque_val); +} +template +bool detail::BasicPtxBuilderInterfaceInterfaceTraits::FallbackModel::hasSideEffect(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->hasSideEffect(tablegen_opaque_val); +} +template +std::string detail::BasicPtxBuilderInterfaceInterfaceTraits::FallbackModel::getPtx(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getPtx(tablegen_opaque_val); +} +template +::mlir::Value detail::BasicPtxBuilderInterfaceInterfaceTraits::FallbackModel::makeConstantI32(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, int val) { + return static_cast(impl)->makeConstantI32(tablegen_opaque_val, rewriter, val); +} +template +void detail::BasicPtxBuilderInterfaceInterfaceTraits::FallbackModel::getAsmValues(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase & rewriter, llvm::SmallVectorImpl>& asmValues) { + return static_cast(impl)->getAsmValues(tablegen_opaque_val, rewriter, asmValues); +} +template +bool detail::BasicPtxBuilderInterfaceInterfaceTraits::ExternalModel::hasIntrinsic(::mlir::Operation *tablegen_opaque_val) const { +return false; +} +template +bool detail::BasicPtxBuilderInterfaceInterfaceTraits::ExternalModel::hasSideEffect(::mlir::Operation *tablegen_opaque_val) const { +return true; +} +template +::mlir::Value detail::BasicPtxBuilderInterfaceInterfaceTraits::ExternalModel::makeConstantI32(::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase &rewriter, int val) const { +mlir::Operation* op = (llvm::cast(tablegen_opaque_val)); + return rewriter.create( + op->getLoc(), rewriter.getIntegerType(32), val); +} +template +void detail::BasicPtxBuilderInterfaceInterfaceTraits::ExternalModel::getAsmValues(::mlir::Operation *tablegen_opaque_val, ::mlir::RewriterBase &rewriter, llvm::SmallVectorImpl>&asmValues) const { +mlir::Operation* op = (llvm::cast(tablegen_opaque_val)); + for (auto val : op->getResults()) + asmValues.push_back({val, mlir::NVVM::PTXRegisterMod::Write}); + for (auto val : op->getOperands()) + asmValues.push_back({val, mlir::NVVM::PTXRegisterMod::Read}); + for (auto attr : op->getAttrs()) { + if (auto intAttr = dyn_cast(attr.getValue())) { + Value val = makeConstantI32(rewriter, intAttr.getInt()); + asmValues.push_back({val ,mlir::NVVM::PTXRegisterMod::Read}); + } + } +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLConversions.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLConversions.inc new file mode 100644 index 0000000000000000000000000000000000000000..f1e25dd3a04497cfbac258f3de34dae2897e0ed9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLConversions.inc @@ -0,0 +1,963 @@ +if (auto op = dyn_cast<::mlir::ROCDL::BarrierOp>(opInst)) { + + llvm::LLVMContext &llvmContext = builder.getContext(); + builder.CreateFence(llvm::AtomicOrdering::Release, + llvmContext.getOrInsertSyncScopeID("workgroup")); + createIntrinsicCall(builder, llvm::Intrinsic::amdgcn_s_barrier); + builder.CreateFence(llvm::AtomicOrdering::Acquire, + llvmContext.getOrInsertSyncScopeID("workgroup")); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::BlockDimXOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createDeviceFunctionCall(builder, "__ockl_get_local_size", 0); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::BlockDimYOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createDeviceFunctionCall(builder, "__ockl_get_local_size", 1); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::BlockDimZOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createDeviceFunctionCall(builder, "__ockl_get_local_size", 2); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::BlockIdXOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createIntrinsicCallWithRange(builder,llvm::Intrinsic::amdgcn_workgroup_id_x, op->getAttrOfType<::mlir::DenseI32ArrayAttr>("range")); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::BlockIdYOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createIntrinsicCallWithRange(builder,llvm::Intrinsic::amdgcn_workgroup_id_y, op->getAttrOfType<::mlir::DenseI32ArrayAttr>("range")); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::BlockIdZOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createIntrinsicCallWithRange(builder,llvm::Intrinsic::amdgcn_workgroup_id_z, op->getAttrOfType<::mlir::DenseI32ArrayAttr>("range")); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::CvtF32Bf8Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_cvt_f32_bf8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::CvtF32Fp8Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_cvt_f32_fp8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::CvtPkBf8F32Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_cvt_pk_bf8_f32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::CvtPkFp8F32Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_cvt_pk_fp8_f32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::CvtSrBf8F32Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_cvt_sr_bf8_f32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::CvtSrFp8F32Op>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_cvt_sr_fp8_f32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::DsBpermuteOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, llvm::Intrinsic::amdgcn_ds_bpermute, {moduleTranslation.lookupValue(op.getIndex()), moduleTranslation.lookupValue(op.getSrc())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::DsSwizzleOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, llvm::Intrinsic::amdgcn_ds_swizzle, {moduleTranslation.lookupValue(op.getSrc()), moduleTranslation.lookupValue(op.getOffset())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::GridDimXOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createDeviceFunctionCall(builder, "__ockl_get_num_groups", 0); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::GridDimYOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createDeviceFunctionCall(builder, "__ockl_get_num_groups", 1); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::GridDimZOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createDeviceFunctionCall(builder, "__ockl_get_num_groups", 2); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::MakeBufferRsrcOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_make_buffer_rsrc, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::MbcntHiOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mbcnt_hi, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::MbcntLoOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mbcnt_lo, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::MubufLoadOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, + llvm::Intrinsic::amdgcn_buffer_load, {moduleTranslation.lookupValue(op.getRsrc()), moduleTranslation.lookupValue(op.getVindex()), moduleTranslation.lookupValue(op.getOffset()), moduleTranslation.lookupValue(op.getGlc()), + moduleTranslation.lookupValue(op.getSlc())}, {moduleTranslation.convertType(op.getResult().getType())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::MubufStoreOp>(opInst)) { + + auto vdataType = moduleTranslation.convertType(op.getVdata().getType()); + createIntrinsicCall(builder, + llvm::Intrinsic::amdgcn_buffer_store, {moduleTranslation.lookupValue(op.getVdata()), moduleTranslation.lookupValue(op.getRsrc()), moduleTranslation.lookupValue(op.getVindex()), + moduleTranslation.lookupValue(op.getOffset()), moduleTranslation.lookupValue(op.getGlc()), moduleTranslation.lookupValue(op.getSlc())}, {vdataType}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawBufferAtomicCmpSwap>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, + llvm::Intrinsic::amdgcn_raw_buffer_atomic_cmpswap, {moduleTranslation.lookupValue(op.getSrc()), moduleTranslation.lookupValue(op.getCmp()), moduleTranslation.lookupValue(op.getRsrc()), + moduleTranslation.lookupValue(op.getOffset()), moduleTranslation.lookupValue(op.getSoffset()), moduleTranslation.lookupValue(op.getAux())}, {moduleTranslation.convertType(op.getResult().getType())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawBufferAtomicFAddOp>(opInst)) { + + auto vdataType = moduleTranslation.convertType(op.getVdata().getType()); + createIntrinsicCall(builder, + llvm::Intrinsic::amdgcn_raw_buffer_atomic_fadd, {moduleTranslation.lookupValue(op.getVdata()), moduleTranslation.lookupValue(op.getRsrc()), + moduleTranslation.lookupValue(op.getOffset()), moduleTranslation.lookupValue(op.getSoffset()), moduleTranslation.lookupValue(op.getAux())}, {vdataType}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawBufferAtomicFMaxOp>(opInst)) { + + auto vdataType = moduleTranslation.convertType(op.getVdata().getType()); + createIntrinsicCall(builder, + llvm::Intrinsic::amdgcn_raw_buffer_atomic_fmax, {moduleTranslation.lookupValue(op.getVdata()), moduleTranslation.lookupValue(op.getRsrc()), + moduleTranslation.lookupValue(op.getOffset()), moduleTranslation.lookupValue(op.getSoffset()), moduleTranslation.lookupValue(op.getAux())}, {vdataType}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawBufferAtomicSMaxOp>(opInst)) { + + auto vdataType = moduleTranslation.convertType(op.getVdata().getType()); + createIntrinsicCall(builder, + llvm::Intrinsic::amdgcn_raw_buffer_atomic_smax, {moduleTranslation.lookupValue(op.getVdata()), moduleTranslation.lookupValue(op.getRsrc()), + moduleTranslation.lookupValue(op.getOffset()), moduleTranslation.lookupValue(op.getSoffset()), moduleTranslation.lookupValue(op.getAux())}, {vdataType}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawBufferAtomicUMinOp>(opInst)) { + + auto vdataType = moduleTranslation.convertType(op.getVdata().getType()); + createIntrinsicCall(builder, + llvm::Intrinsic::amdgcn_raw_buffer_atomic_umin, {moduleTranslation.lookupValue(op.getVdata()), moduleTranslation.lookupValue(op.getRsrc()), + moduleTranslation.lookupValue(op.getOffset()), moduleTranslation.lookupValue(op.getSoffset()), moduleTranslation.lookupValue(op.getAux())}, {vdataType}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawBufferLoadOp>(opInst)) { + + moduleTranslation.mapValue(op.getRes()) = createIntrinsicCall(builder, + llvm::Intrinsic::amdgcn_raw_buffer_load, {moduleTranslation.lookupValue(op.getRsrc()), moduleTranslation.lookupValue(op.getOffset()), + moduleTranslation.lookupValue(op.getSoffset()), moduleTranslation.lookupValue(op.getAux())}, {moduleTranslation.convertType(op.getResult().getType())}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawBufferStoreOp>(opInst)) { + + auto vdataType = moduleTranslation.convertType(op.getVdata().getType()); + createIntrinsicCall(builder, + llvm::Intrinsic::amdgcn_raw_buffer_store, {moduleTranslation.lookupValue(op.getVdata()), moduleTranslation.lookupValue(op.getRsrc()), + moduleTranslation.lookupValue(op.getOffset()), moduleTranslation.lookupValue(op.getSoffset()), moduleTranslation.lookupValue(op.getAux())}, {vdataType}); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawPtrBufferAtomicCmpSwap>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_raw_ptr_buffer_atomic_cmpswap, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawPtrBufferAtomicFaddOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_raw_ptr_buffer_atomic_fadd, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawPtrBufferAtomicFmaxOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_raw_ptr_buffer_atomic_fmax, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawPtrBufferAtomicSmaxOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_raw_ptr_buffer_atomic_smax, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawPtrBufferAtomicUminOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_raw_ptr_buffer_atomic_umin, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawPtrBufferLoadOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_raw_ptr_buffer_load, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::RawPtrBufferStoreOp>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_raw_ptr_buffer_store, { moduleTranslation.convertType(opInst.getOperand(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + + moduleTranslation.setAliasScopeMetadata(op, inst); + moduleTranslation.setTBAAMetadata(op, inst); + + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::ThreadIdXOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createIntrinsicCallWithRange(builder,llvm::Intrinsic::amdgcn_workitem_id_x, op->getAttrOfType<::mlir::DenseI32ArrayAttr>("range")); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::ThreadIdYOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createIntrinsicCallWithRange(builder,llvm::Intrinsic::amdgcn_workitem_id_y, op->getAttrOfType<::mlir::DenseI32ArrayAttr>("range")); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::ThreadIdZOp>(opInst)) { +moduleTranslation.mapValue(op.getRes()) = createIntrinsicCallWithRange(builder,llvm::Intrinsic::amdgcn_workitem_id_z, op->getAttrOfType<::mlir::DenseI32ArrayAttr>("range")); + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_4x4x1f32>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_4x4x1f32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_4x4x2bf16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_4x4x2bf16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_4x4x4bf16_1k>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_4x4x4bf16_1k, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_4x4x4f16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_4x4x4f16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x1f32>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x1f32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x2bf16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x2bf16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x4bf16_1k>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x4bf16_1k, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x4f16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x4f16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x4f32>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x4f32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x8_xf32>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x8_xf32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x8bf16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x8bf16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x16bf16_1k>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x16bf16_1k, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x16f16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x16f16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x32_bf8_bf8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x32_bf8_bf8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x32_bf8_fp8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x32_bf8_fp8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x32_fp8_bf8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x32_fp8_bf8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_16x16x32_fp8_fp8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_16x16x32_fp8_fp8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x1f32>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x1f32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x2bf16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x2bf16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x2f32>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x2f32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x4_xf32>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x4_xf32, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x4bf16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x4bf16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x4bf16_1k>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x4bf16_1k, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x4f16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x4f16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x8bf16_1k>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x8bf16_1k, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x8f16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x8f16, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x16_bf8_bf8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x16_bf8_bf8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x16_bf8_fp8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x16_bf8_fp8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x16_fp8_bf8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x16_fp8_bf8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f32_32x32x16_fp8_fp8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f32_32x32x16_fp8_fp8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f64_4x4x4f64>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f64_4x4x4f64, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_f64_16x16x4f64>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_f64_16x16x4f64, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_i32_4x4x4i8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_i32_4x4x4i8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_i32_16x16x4i8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_i32_16x16x4i8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_i32_16x16x16i8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_i32_16x16x16i8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_i32_16x16x32_i8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_i32_16x16x32_i8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_i32_32x32x4i8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_i32_32x32x4i8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_i32_32x32x8i8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_i32_32x32x8i8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::mfma_i32_32x32x16_i8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_mfma_i32_32x32x16_i8, { } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::wmma_bf16_16x16x16_bf16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_wmma_bf16_16x16x16_bf16, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::wmma_f16_16x16x16_f16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_wmma_f16_16x16x16_f16, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::wmma_f32_16x16x16_bf16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_wmma_f32_16x16x16_bf16, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::wmma_f32_16x16x16_f16>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_wmma_f32_16x16x16_f16, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::wmma_i32_16x16x16_iu4>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_wmma_i32_16x16x16_iu4, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} +if (auto op = dyn_cast<::mlir::ROCDL::wmma_i32_16x16x16_iu8>(opInst)) { + + llvm::Module *module = builder.GetInsertBlock()->getModule(); + llvm::Function *fn = llvm::Intrinsic::getDeclaration( + module, + llvm::Intrinsic::amdgcn_wmma_i32_16x16x16_iu8, { moduleTranslation.convertType(opInst.getResult(0).getType()) } ); + auto operands = moduleTranslation.lookupValues(opInst.getOperands()); + + auto *inst = builder.CreateCall(fn, operands); + (void) inst; + moduleTranslation.mapValue(op.getRes()) = inst; + return success(); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..c2a82ffc1c43cf62e898e3eed59fa7c33718c8be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLDialect.h @@ -0,0 +1,40 @@ +//===- ROCDLDialect.h - MLIR ROCDL IR dialect -------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the ROCDL dialect in MLIR, containing ROCDL operations +// and ROCDL specific extensions to the LLVM type system. +// +// Unfortunately there does not exists a formal definition of ROCDL IR that be +// pointed to here. However the following links contain more information about +// ROCDL (ROCm-Device-Library) +// +// https://github.com/RadeonOpenCompute/ROCm-Device-Libs/blob/amd-stg-open/doc/OCML.md +// https://github.com/RadeonOpenCompute/ROCm-Device-Libs/blob/amd-stg-open/doc/OCKL.md +// https://llvm.org/docs/AMDGPUUsage.html +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_ROCDLDIALECT_H_ +#define MLIR_DIALECT_LLVMIR_ROCDLDIALECT_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +///// Ops ///// +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/LLVMIR/ROCDLOpsAttributes.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/LLVMIR/ROCDLOps.h.inc" + +#include "mlir/Dialect/LLVMIR/ROCDLOpsDialect.h.inc" + +#endif /* MLIR_DIALECT_LLVMIR_ROCDLDIALECT_H_ */ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..4f326db1fe300e750507947b87361c85fef51df3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc @@ -0,0 +1,17572 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ROCDLOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::ROCDL::BarrierOp, +::mlir::ROCDL::BlockDimXOp, +::mlir::ROCDL::BlockDimYOp, +::mlir::ROCDL::BlockDimZOp, +::mlir::ROCDL::BlockIdXOp, +::mlir::ROCDL::BlockIdYOp, +::mlir::ROCDL::BlockIdZOp, +::mlir::ROCDL::CvtF32Bf8Op, +::mlir::ROCDL::CvtF32Fp8Op, +::mlir::ROCDL::CvtPkBf8F32Op, +::mlir::ROCDL::CvtPkFp8F32Op, +::mlir::ROCDL::CvtSrBf8F32Op, +::mlir::ROCDL::CvtSrFp8F32Op, +::mlir::ROCDL::DsBpermuteOp, +::mlir::ROCDL::DsSwizzleOp, +::mlir::ROCDL::GridDimXOp, +::mlir::ROCDL::GridDimYOp, +::mlir::ROCDL::GridDimZOp, +::mlir::ROCDL::MakeBufferRsrcOp, +::mlir::ROCDL::MbcntHiOp, +::mlir::ROCDL::MbcntLoOp, +::mlir::ROCDL::MubufLoadOp, +::mlir::ROCDL::MubufStoreOp, +::mlir::ROCDL::RawBufferAtomicCmpSwap, +::mlir::ROCDL::RawBufferAtomicFAddOp, +::mlir::ROCDL::RawBufferAtomicFMaxOp, +::mlir::ROCDL::RawBufferAtomicSMaxOp, +::mlir::ROCDL::RawBufferAtomicUMinOp, +::mlir::ROCDL::RawBufferLoadOp, +::mlir::ROCDL::RawBufferStoreOp, +::mlir::ROCDL::RawPtrBufferAtomicCmpSwap, +::mlir::ROCDL::RawPtrBufferAtomicFaddOp, +::mlir::ROCDL::RawPtrBufferAtomicFmaxOp, +::mlir::ROCDL::RawPtrBufferAtomicSmaxOp, +::mlir::ROCDL::RawPtrBufferAtomicUminOp, +::mlir::ROCDL::RawPtrBufferLoadOp, +::mlir::ROCDL::RawPtrBufferStoreOp, +::mlir::ROCDL::ThreadIdXOp, +::mlir::ROCDL::ThreadIdYOp, +::mlir::ROCDL::ThreadIdZOp, +::mlir::ROCDL::mfma_f32_16x16x16bf16_1k, +::mlir::ROCDL::mfma_f32_16x16x16f16, +::mlir::ROCDL::mfma_f32_16x16x1f32, +::mlir::ROCDL::mfma_f32_16x16x2bf16, +::mlir::ROCDL::mfma_f32_16x16x32_bf8_bf8, +::mlir::ROCDL::mfma_f32_16x16x32_bf8_fp8, +::mlir::ROCDL::mfma_f32_16x16x32_fp8_bf8, +::mlir::ROCDL::mfma_f32_16x16x32_fp8_fp8, +::mlir::ROCDL::mfma_f32_16x16x4bf16_1k, +::mlir::ROCDL::mfma_f32_16x16x4f16, +::mlir::ROCDL::mfma_f32_16x16x4f32, +::mlir::ROCDL::mfma_f32_16x16x8_xf32, +::mlir::ROCDL::mfma_f32_16x16x8bf16, +::mlir::ROCDL::mfma_f32_32x32x16_bf8_bf8, +::mlir::ROCDL::mfma_f32_32x32x16_bf8_fp8, +::mlir::ROCDL::mfma_f32_32x32x16_fp8_bf8, +::mlir::ROCDL::mfma_f32_32x32x16_fp8_fp8, +::mlir::ROCDL::mfma_f32_32x32x1f32, +::mlir::ROCDL::mfma_f32_32x32x2bf16, +::mlir::ROCDL::mfma_f32_32x32x2f32, +::mlir::ROCDL::mfma_f32_32x32x4_xf32, +::mlir::ROCDL::mfma_f32_32x32x4bf16, +::mlir::ROCDL::mfma_f32_32x32x4bf16_1k, +::mlir::ROCDL::mfma_f32_32x32x4f16, +::mlir::ROCDL::mfma_f32_32x32x8bf16_1k, +::mlir::ROCDL::mfma_f32_32x32x8f16, +::mlir::ROCDL::mfma_f32_4x4x1f32, +::mlir::ROCDL::mfma_f32_4x4x2bf16, +::mlir::ROCDL::mfma_f32_4x4x4bf16_1k, +::mlir::ROCDL::mfma_f32_4x4x4f16, +::mlir::ROCDL::mfma_f64_16x16x4f64, +::mlir::ROCDL::mfma_f64_4x4x4f64, +::mlir::ROCDL::mfma_i32_16x16x16i8, +::mlir::ROCDL::mfma_i32_16x16x32_i8, +::mlir::ROCDL::mfma_i32_16x16x4i8, +::mlir::ROCDL::mfma_i32_32x32x16_i8, +::mlir::ROCDL::mfma_i32_32x32x4i8, +::mlir::ROCDL::mfma_i32_32x32x8i8, +::mlir::ROCDL::mfma_i32_4x4x4i8, +::mlir::ROCDL::wmma_bf16_16x16x16_bf16, +::mlir::ROCDL::wmma_f16_16x16x16_f16, +::mlir::ROCDL::wmma_f32_16x16x16_bf16, +::mlir::ROCDL::wmma_f32_16x16x16_f16, +::mlir::ROCDL::wmma_i32_16x16x16_iu4, +::mlir::ROCDL::wmma_i32_16x16x16_iu8 +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace ROCDL { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ROCDLOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::mlir::LLVM::isCompatibleOuterType(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM dialect-compatible type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ROCDLOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(32)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ROCDLOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isF32()))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit float, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ROCDLOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ROCDLOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be LLVM pointer type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ROCDLOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(16)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 16-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ROCDLOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::LLVM::LLVMPointerType>(type))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).isOpaque()))) && ((::llvm::cast<::mlir::LLVM::LLVMPointerType>(type).getAddressSpace() == 8)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be Opaque LLVM pointer in address space 8, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ROCDLOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM dialect alias scope array"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ROCDLOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ROCDLOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ROCDLOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ROCDLOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_ROCDLOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BarrierOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BarrierOpGenericAdaptorBase::BarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.barrier", odsAttrs.getContext()); +} + +BarrierOpGenericAdaptorBase::BarrierOpGenericAdaptorBase(BarrierOp op) : BarrierOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BarrierOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BarrierOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BarrierOpAdaptor::BarrierOpAdaptor(BarrierOp op) : BarrierOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BarrierOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BarrierOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BarrierOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BarrierOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BarrierOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void BarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void BarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BarrierOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BarrierOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult BarrierOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BarrierOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void BarrierOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BarrierOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockDimXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockDimXOpGenericAdaptorBase::BlockDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.workgroup.dim.x", odsAttrs.getContext()); +} + +BlockDimXOpGenericAdaptorBase::BlockDimXOpGenericAdaptorBase(BlockDimXOp op) : BlockDimXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockDimXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockDimXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockDimXOpAdaptor::BlockDimXOpAdaptor(BlockDimXOp op) : BlockDimXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockDimXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockDimXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockDimXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockDimXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockDimXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockDimXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockDimXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockDimXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockDimXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockDimXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockDimXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockDimXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockDimXOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockDimYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockDimYOpGenericAdaptorBase::BlockDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.workgroup.dim.y", odsAttrs.getContext()); +} + +BlockDimYOpGenericAdaptorBase::BlockDimYOpGenericAdaptorBase(BlockDimYOp op) : BlockDimYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockDimYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockDimYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockDimYOpAdaptor::BlockDimYOpAdaptor(BlockDimYOp op) : BlockDimYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockDimYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockDimYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockDimYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockDimYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockDimYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockDimYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockDimYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockDimYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockDimYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockDimYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockDimYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockDimYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockDimYOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockDimZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockDimZOpGenericAdaptorBase::BlockDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.workgroup.dim.z", odsAttrs.getContext()); +} + +BlockDimZOpGenericAdaptorBase::BlockDimZOpGenericAdaptorBase(BlockDimZOp op) : BlockDimZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockDimZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockDimZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockDimZOpAdaptor::BlockDimZOpAdaptor(BlockDimZOp op) : BlockDimZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockDimZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockDimZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockDimZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockDimZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockDimZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockDimZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockDimZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockDimZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockDimZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockDimZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockDimZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockDimZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockDimZOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockIdXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockIdXOpGenericAdaptorBase::BlockIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.workgroup.id.x", odsAttrs.getContext()); +} + +BlockIdXOpGenericAdaptorBase::BlockIdXOpGenericAdaptorBase(BlockIdXOp op) : BlockIdXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockIdXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockIdXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockIdXOpAdaptor::BlockIdXOpAdaptor(BlockIdXOp op) : BlockIdXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockIdXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockIdXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockIdXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockIdXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockIdXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockIdXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockIdXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockIdXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockIdXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockIdXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockIdXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockIdXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockIdXOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockIdYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockIdYOpGenericAdaptorBase::BlockIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.workgroup.id.y", odsAttrs.getContext()); +} + +BlockIdYOpGenericAdaptorBase::BlockIdYOpGenericAdaptorBase(BlockIdYOp op) : BlockIdYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockIdYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockIdYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockIdYOpAdaptor::BlockIdYOpAdaptor(BlockIdYOp op) : BlockIdYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockIdYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockIdYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockIdYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockIdYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockIdYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockIdYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockIdYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockIdYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockIdYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockIdYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockIdYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockIdYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockIdYOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockIdZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BlockIdZOpGenericAdaptorBase::BlockIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.workgroup.id.z", odsAttrs.getContext()); +} + +BlockIdZOpGenericAdaptorBase::BlockIdZOpGenericAdaptorBase(BlockIdZOp op) : BlockIdZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BlockIdZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BlockIdZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BlockIdZOpAdaptor::BlockIdZOpAdaptor(BlockIdZOp op) : BlockIdZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BlockIdZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BlockIdZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BlockIdZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BlockIdZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BlockIdZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value BlockIdZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void BlockIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void BlockIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BlockIdZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BlockIdZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult BlockIdZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BlockIdZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void BlockIdZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void BlockIdZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockIdZOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtF32Bf8Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CvtF32Bf8OpGenericAdaptorBase::CvtF32Bf8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.cvt.f32.bf8", odsAttrs.getContext()); +} + +CvtF32Bf8OpGenericAdaptorBase::CvtF32Bf8OpGenericAdaptorBase(CvtF32Bf8Op op) : CvtF32Bf8OpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CvtF32Bf8OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CvtF32Bf8OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CvtF32Bf8OpAdaptor::CvtF32Bf8OpAdaptor(CvtF32Bf8Op op) : CvtF32Bf8OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CvtF32Bf8OpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CvtF32Bf8Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CvtF32Bf8Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> CvtF32Bf8Op::getSrcA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtF32Bf8Op::getByteSel() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CvtF32Bf8Op::getSrcAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtF32Bf8Op::getByteSelMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CvtF32Bf8Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CvtF32Bf8Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CvtF32Bf8Op::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CvtF32Bf8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value byteSel) { + odsState.addOperands(srcA); + odsState.addOperands(byteSel); + odsState.addTypes(res); +} + +void CvtF32Bf8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value byteSel) { + odsState.addOperands(srcA); + odsState.addOperands(byteSel); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CvtF32Bf8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CvtF32Bf8Op::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CvtF32Bf8Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CvtF32Bf8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcAOperands(srcARawOperands); ::llvm::SMLoc srcAOperandsLoc; + (void)srcAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand byteSelRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> byteSelOperands(byteSelRawOperands); ::llvm::SMLoc byteSelOperandsLoc; + (void)byteSelOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + srcAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcARawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + byteSelOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(byteSelRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(srcAOperands, odsBuildableType0, srcAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(byteSelOperands, odsBuildableType0, byteSelOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CvtF32Bf8Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSrcA(); + _odsPrinter << "["; + _odsPrinter << getByteSel(); + _odsPrinter << "]"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CvtF32Bf8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtF32Bf8Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtF32Fp8Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CvtF32Fp8OpGenericAdaptorBase::CvtF32Fp8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.cvt.f32.fp8", odsAttrs.getContext()); +} + +CvtF32Fp8OpGenericAdaptorBase::CvtF32Fp8OpGenericAdaptorBase(CvtF32Fp8Op op) : CvtF32Fp8OpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CvtF32Fp8OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CvtF32Fp8OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CvtF32Fp8OpAdaptor::CvtF32Fp8OpAdaptor(CvtF32Fp8Op op) : CvtF32Fp8OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CvtF32Fp8OpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CvtF32Fp8Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CvtF32Fp8Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> CvtF32Fp8Op::getSrcA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtF32Fp8Op::getByteSel() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CvtF32Fp8Op::getSrcAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtF32Fp8Op::getByteSelMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CvtF32Fp8Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CvtF32Fp8Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CvtF32Fp8Op::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CvtF32Fp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value byteSel) { + odsState.addOperands(srcA); + odsState.addOperands(byteSel); + odsState.addTypes(res); +} + +void CvtF32Fp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value byteSel) { + odsState.addOperands(srcA); + odsState.addOperands(byteSel); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CvtF32Fp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CvtF32Fp8Op::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CvtF32Fp8Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CvtF32Fp8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcAOperands(srcARawOperands); ::llvm::SMLoc srcAOperandsLoc; + (void)srcAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand byteSelRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> byteSelOperands(byteSelRawOperands); ::llvm::SMLoc byteSelOperandsLoc; + (void)byteSelOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + srcAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcARawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + byteSelOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(byteSelRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(srcAOperands, odsBuildableType0, srcAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(byteSelOperands, odsBuildableType0, byteSelOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CvtF32Fp8Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSrcA(); + _odsPrinter << "["; + _odsPrinter << getByteSel(); + _odsPrinter << "]"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CvtF32Fp8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtF32Fp8Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtPkBf8F32Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CvtPkBf8F32OpGenericAdaptorBase::CvtPkBf8F32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.cvt.pk.bf8.f32", odsAttrs.getContext()); +} + +CvtPkBf8F32OpGenericAdaptorBase::CvtPkBf8F32OpGenericAdaptorBase(CvtPkBf8F32Op op) : CvtPkBf8F32OpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CvtPkBf8F32OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CvtPkBf8F32OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CvtPkBf8F32OpAdaptor::CvtPkBf8F32OpAdaptor(CvtPkBf8F32Op op) : CvtPkBf8F32OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CvtPkBf8F32OpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CvtPkBf8F32Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CvtPkBf8F32Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> CvtPkBf8F32Op::getSrcA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::FloatType> CvtPkBf8F32Op::getSrcB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtPkBf8F32Op::getOld() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtPkBf8F32Op::getWordSel() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &CvtPkBf8F32Op::getSrcAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtPkBf8F32Op::getSrcBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtPkBf8F32Op::getOldMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtPkBf8F32Op::getWordSelMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair CvtPkBf8F32Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CvtPkBf8F32Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CvtPkBf8F32Op::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CvtPkBf8F32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value wordSel) { + odsState.addOperands(srcA); + odsState.addOperands(srcB); + odsState.addOperands(old); + odsState.addOperands(wordSel); + odsState.addTypes(res); +} + +void CvtPkBf8F32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value wordSel) { + odsState.addOperands(srcA); + odsState.addOperands(srcB); + odsState.addOperands(old); + odsState.addOperands(wordSel); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CvtPkBf8F32Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CvtPkBf8F32Op::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CvtPkBf8F32Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CvtPkBf8F32Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcAOperands(srcARawOperands); ::llvm::SMLoc srcAOperandsLoc; + (void)srcAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand srcBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcBOperands(srcBRawOperands); ::llvm::SMLoc srcBOperandsLoc; + (void)srcBOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand oldRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> oldOperands(oldRawOperands); ::llvm::SMLoc oldOperandsLoc; + (void)oldOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand wordSelRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> wordSelOperands(wordSelRawOperands); ::llvm::SMLoc wordSelOperandsLoc; + (void)wordSelOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + srcAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + srcBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcBRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + oldOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(oldRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + wordSelOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(wordSelRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getF32Type(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + ::mlir::Type odsBuildableType2 = parser.getBuilder().getIntegerType(1); + result.addTypes(resTypes); + if (parser.resolveOperands(srcAOperands, odsBuildableType0, srcAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(srcBOperands, odsBuildableType0, srcBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(oldOperands, odsBuildableType1, oldOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(wordSelOperands, odsBuildableType2, wordSelOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CvtPkBf8F32Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSrcA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrcB(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getOld(); + _odsPrinter << "["; + _odsPrinter << getWordSel(); + _odsPrinter << "]"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CvtPkBf8F32Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtPkBf8F32Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtPkFp8F32Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CvtPkFp8F32OpGenericAdaptorBase::CvtPkFp8F32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.cvt.pk.fp8.f32", odsAttrs.getContext()); +} + +CvtPkFp8F32OpGenericAdaptorBase::CvtPkFp8F32OpGenericAdaptorBase(CvtPkFp8F32Op op) : CvtPkFp8F32OpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CvtPkFp8F32OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CvtPkFp8F32OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CvtPkFp8F32OpAdaptor::CvtPkFp8F32OpAdaptor(CvtPkFp8F32Op op) : CvtPkFp8F32OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CvtPkFp8F32OpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CvtPkFp8F32Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CvtPkFp8F32Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> CvtPkFp8F32Op::getSrcA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::FloatType> CvtPkFp8F32Op::getSrcB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtPkFp8F32Op::getOld() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtPkFp8F32Op::getWordSel() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &CvtPkFp8F32Op::getSrcAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtPkFp8F32Op::getSrcBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtPkFp8F32Op::getOldMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtPkFp8F32Op::getWordSelMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair CvtPkFp8F32Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CvtPkFp8F32Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CvtPkFp8F32Op::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CvtPkFp8F32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value wordSel) { + odsState.addOperands(srcA); + odsState.addOperands(srcB); + odsState.addOperands(old); + odsState.addOperands(wordSel); + odsState.addTypes(res); +} + +void CvtPkFp8F32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value wordSel) { + odsState.addOperands(srcA); + odsState.addOperands(srcB); + odsState.addOperands(old); + odsState.addOperands(wordSel); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CvtPkFp8F32Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CvtPkFp8F32Op::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CvtPkFp8F32Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CvtPkFp8F32Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcAOperands(srcARawOperands); ::llvm::SMLoc srcAOperandsLoc; + (void)srcAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand srcBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcBOperands(srcBRawOperands); ::llvm::SMLoc srcBOperandsLoc; + (void)srcBOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand oldRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> oldOperands(oldRawOperands); ::llvm::SMLoc oldOperandsLoc; + (void)oldOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand wordSelRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> wordSelOperands(wordSelRawOperands); ::llvm::SMLoc wordSelOperandsLoc; + (void)wordSelOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + srcAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + srcBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcBRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + oldOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(oldRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + wordSelOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(wordSelRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getF32Type(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + ::mlir::Type odsBuildableType2 = parser.getBuilder().getIntegerType(1); + result.addTypes(resTypes); + if (parser.resolveOperands(srcAOperands, odsBuildableType0, srcAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(srcBOperands, odsBuildableType0, srcBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(oldOperands, odsBuildableType1, oldOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(wordSelOperands, odsBuildableType2, wordSelOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CvtPkFp8F32Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSrcA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrcB(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getOld(); + _odsPrinter << "["; + _odsPrinter << getWordSel(); + _odsPrinter << "]"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CvtPkFp8F32Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtPkFp8F32Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtSrBf8F32Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CvtSrBf8F32OpGenericAdaptorBase::CvtSrBf8F32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.cvt.sr.bf8.f32", odsAttrs.getContext()); +} + +CvtSrBf8F32OpGenericAdaptorBase::CvtSrBf8F32OpGenericAdaptorBase(CvtSrBf8F32Op op) : CvtSrBf8F32OpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CvtSrBf8F32OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CvtSrBf8F32OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CvtSrBf8F32OpAdaptor::CvtSrBf8F32OpAdaptor(CvtSrBf8F32Op op) : CvtSrBf8F32OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CvtSrBf8F32OpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CvtSrBf8F32Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CvtSrBf8F32Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> CvtSrBf8F32Op::getSrcA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtSrBf8F32Op::getSrcB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtSrBf8F32Op::getOld() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtSrBf8F32Op::getByteSel() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &CvtSrBf8F32Op::getSrcAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtSrBf8F32Op::getSrcBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtSrBf8F32Op::getOldMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtSrBf8F32Op::getByteSelMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair CvtSrBf8F32Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CvtSrBf8F32Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CvtSrBf8F32Op::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CvtSrBf8F32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value byteSel) { + odsState.addOperands(srcA); + odsState.addOperands(srcB); + odsState.addOperands(old); + odsState.addOperands(byteSel); + odsState.addTypes(res); +} + +void CvtSrBf8F32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value byteSel) { + odsState.addOperands(srcA); + odsState.addOperands(srcB); + odsState.addOperands(old); + odsState.addOperands(byteSel); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CvtSrBf8F32Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CvtSrBf8F32Op::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CvtSrBf8F32Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CvtSrBf8F32Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcAOperands(srcARawOperands); ::llvm::SMLoc srcAOperandsLoc; + (void)srcAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand srcBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcBOperands(srcBRawOperands); ::llvm::SMLoc srcBOperandsLoc; + (void)srcBOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand oldRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> oldOperands(oldRawOperands); ::llvm::SMLoc oldOperandsLoc; + (void)oldOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand byteSelRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> byteSelOperands(byteSelRawOperands); ::llvm::SMLoc byteSelOperandsLoc; + (void)byteSelOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + srcAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + srcBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcBRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + oldOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(oldRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + byteSelOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(byteSelRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getF32Type(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(srcAOperands, odsBuildableType0, srcAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(srcBOperands, odsBuildableType1, srcBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(oldOperands, odsBuildableType1, oldOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(byteSelOperands, odsBuildableType1, byteSelOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CvtSrBf8F32Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSrcA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrcB(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getOld(); + _odsPrinter << "["; + _odsPrinter << getByteSel(); + _odsPrinter << "]"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CvtSrBf8F32Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtSrBf8F32Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtSrFp8F32Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CvtSrFp8F32OpGenericAdaptorBase::CvtSrFp8F32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.cvt.sr.fp8.f32", odsAttrs.getContext()); +} + +CvtSrFp8F32OpGenericAdaptorBase::CvtSrFp8F32OpGenericAdaptorBase(CvtSrFp8F32Op op) : CvtSrFp8F32OpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CvtSrFp8F32OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CvtSrFp8F32OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CvtSrFp8F32OpAdaptor::CvtSrFp8F32OpAdaptor(CvtSrFp8F32Op op) : CvtSrFp8F32OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CvtSrFp8F32OpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CvtSrFp8F32Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CvtSrFp8F32Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::FloatType> CvtSrFp8F32Op::getSrcA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::FloatType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtSrFp8F32Op::getSrcB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtSrFp8F32Op::getOld() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> CvtSrFp8F32Op::getByteSel() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &CvtSrFp8F32Op::getSrcAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtSrFp8F32Op::getSrcBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtSrFp8F32Op::getOldMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CvtSrFp8F32Op::getByteSelMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair CvtSrFp8F32Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CvtSrFp8F32Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CvtSrFp8F32Op::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CvtSrFp8F32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value byteSel) { + odsState.addOperands(srcA); + odsState.addOperands(srcB); + odsState.addOperands(old); + odsState.addOperands(byteSel); + odsState.addTypes(res); +} + +void CvtSrFp8F32Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value byteSel) { + odsState.addOperands(srcA); + odsState.addOperands(srcB); + odsState.addOperands(old); + odsState.addOperands(byteSel); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CvtSrFp8F32Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CvtSrFp8F32Op::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CvtSrFp8F32Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CvtSrFp8F32Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcAOperands(srcARawOperands); ::llvm::SMLoc srcAOperandsLoc; + (void)srcAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand srcBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcBOperands(srcBRawOperands); ::llvm::SMLoc srcBOperandsLoc; + (void)srcBOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand oldRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> oldOperands(oldRawOperands); ::llvm::SMLoc oldOperandsLoc; + (void)oldOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand byteSelRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> byteSelOperands(byteSelRawOperands); ::llvm::SMLoc byteSelOperandsLoc; + (void)byteSelOperandsLoc; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + srcAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + srcBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcBRawOperands[0])) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + oldOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(oldRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + byteSelOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(byteSelRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getF32Type(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(srcAOperands, odsBuildableType0, srcAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(srcBOperands, odsBuildableType1, srcBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(oldOperands, odsBuildableType1, oldOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(byteSelOperands, odsBuildableType1, byteSelOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CvtSrFp8F32Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSrcA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrcB(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getOld(); + _odsPrinter << "["; + _odsPrinter << getByteSel(); + _odsPrinter << "]"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CvtSrFp8F32Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtSrFp8F32Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::DsBpermuteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DsBpermuteOpGenericAdaptorBase::DsBpermuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.ds_bpermute", odsAttrs.getContext()); +} + +DsBpermuteOpGenericAdaptorBase::DsBpermuteOpGenericAdaptorBase(DsBpermuteOp op) : DsBpermuteOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DsBpermuteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DsBpermuteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DsBpermuteOpAdaptor::DsBpermuteOpAdaptor(DsBpermuteOp op) : DsBpermuteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DsBpermuteOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DsBpermuteOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DsBpermuteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> DsBpermuteOp::getIndex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> DsBpermuteOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &DsBpermuteOp::getIndexMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &DsBpermuteOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DsBpermuteOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DsBpermuteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> DsBpermuteOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +void DsBpermuteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value index, ::mlir::Value src) { + odsState.addOperands(index); + odsState.addOperands(src); + odsState.addTypes(res); +} + +void DsBpermuteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value index, ::mlir::Value src) { + odsState.addOperands(index); + odsState.addOperands(src); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DsBpermuteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DsBpermuteOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DsBpermuteOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DsBpermuteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand indexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> indexOperands(indexRawOperands); ::llvm::SMLoc indexOperandsLoc; + (void)indexOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand srcRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(srcRawOperands); ::llvm::SMLoc srcOperandsLoc; + (void)srcOperandsLoc; + ::mlir::Type indexRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> indexTypes(indexRawTypes); + ::mlir::Type srcRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcTypes(srcRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + indexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(indexRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + srcOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + indexRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(indexOperands, indexTypes, indexOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DsBpermuteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIndex(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getSrc(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "("; + { + auto type = getIndex().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getSrc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::DsBpermuteOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::DsSwizzleOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DsSwizzleOpGenericAdaptorBase::DsSwizzleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.ds_swizzle", odsAttrs.getContext()); +} + +DsSwizzleOpGenericAdaptorBase::DsSwizzleOpGenericAdaptorBase(DsSwizzleOp op) : DsSwizzleOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DsSwizzleOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DsSwizzleOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DsSwizzleOpAdaptor::DsSwizzleOpAdaptor(DsSwizzleOp op) : DsSwizzleOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DsSwizzleOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DsSwizzleOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DsSwizzleOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> DsSwizzleOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> DsSwizzleOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &DsSwizzleOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &DsSwizzleOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DsSwizzleOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DsSwizzleOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> DsSwizzleOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +void DsSwizzleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value offset) { + odsState.addOperands(src); + odsState.addOperands(offset); + odsState.addTypes(res); +} + +void DsSwizzleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value offset) { + odsState.addOperands(src); + odsState.addOperands(offset); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DsSwizzleOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DsSwizzleOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DsSwizzleOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DsSwizzleOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(srcRawOperands); ::llvm::SMLoc srcOperandsLoc; + (void)srcOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand offsetRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> offsetOperands(offsetRawOperands); ::llvm::SMLoc offsetOperandsLoc; + (void)offsetOperandsLoc; + ::mlir::Type srcRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcTypes(srcRawTypes); + ::mlir::Type offsetRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> offsetTypes(offsetRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + srcOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + offsetOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(offsetRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + offsetRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(offsetOperands, offsetTypes, offsetOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DsSwizzleOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrc(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getOffset(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "("; + { + auto type = getSrc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getOffset().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::DsSwizzleOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::GridDimXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridDimXOpGenericAdaptorBase::GridDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.grid.dim.x", odsAttrs.getContext()); +} + +GridDimXOpGenericAdaptorBase::GridDimXOpGenericAdaptorBase(GridDimXOp op) : GridDimXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridDimXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridDimXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GridDimXOpAdaptor::GridDimXOpAdaptor(GridDimXOp op) : GridDimXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridDimXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GridDimXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridDimXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridDimXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridDimXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GridDimXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GridDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void GridDimXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridDimXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GridDimXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridDimXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GridDimXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void GridDimXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GridDimXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::GridDimXOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::GridDimYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridDimYOpGenericAdaptorBase::GridDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.grid.dim.y", odsAttrs.getContext()); +} + +GridDimYOpGenericAdaptorBase::GridDimYOpGenericAdaptorBase(GridDimYOp op) : GridDimYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridDimYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridDimYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GridDimYOpAdaptor::GridDimYOpAdaptor(GridDimYOp op) : GridDimYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridDimYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GridDimYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridDimYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridDimYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridDimYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GridDimYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GridDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void GridDimYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridDimYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GridDimYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridDimYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GridDimYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void GridDimYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GridDimYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::GridDimYOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::GridDimZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GridDimZOpGenericAdaptorBase::GridDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.grid.dim.z", odsAttrs.getContext()); +} + +GridDimZOpGenericAdaptorBase::GridDimZOpGenericAdaptorBase(GridDimZOp op) : GridDimZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GridDimZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GridDimZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GridDimZOpAdaptor::GridDimZOpAdaptor(GridDimZOp op) : GridDimZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GridDimZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GridDimZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GridDimZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GridDimZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GridDimZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GridDimZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void GridDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void GridDimZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GridDimZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GridDimZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GridDimZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GridDimZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void GridDimZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void GridDimZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::GridDimZOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MakeBufferRsrcOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MakeBufferRsrcOpGenericAdaptorBase::MakeBufferRsrcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.make.buffer.rsrc", odsAttrs.getContext()); +} + +MakeBufferRsrcOpGenericAdaptorBase::MakeBufferRsrcOpGenericAdaptorBase(MakeBufferRsrcOp op) : MakeBufferRsrcOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MakeBufferRsrcOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MakeBufferRsrcOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MakeBufferRsrcOpAdaptor::MakeBufferRsrcOpAdaptor(MakeBufferRsrcOp op) : MakeBufferRsrcOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MakeBufferRsrcOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MakeBufferRsrcOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MakeBufferRsrcOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MakeBufferRsrcOp::getBase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MakeBufferRsrcOp::getStride() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MakeBufferRsrcOp::getNumRecords() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MakeBufferRsrcOp::getFlags() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &MakeBufferRsrcOp::getBaseMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MakeBufferRsrcOp::getStrideMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MakeBufferRsrcOp::getNumRecordsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MakeBufferRsrcOp::getFlagsMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair MakeBufferRsrcOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MakeBufferRsrcOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> MakeBufferRsrcOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSResults(0).begin()); +} + +void MakeBufferRsrcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value base, ::mlir::Value stride, ::mlir::Value numRecords, ::mlir::Value flags) { + odsState.addOperands(base); + odsState.addOperands(stride); + odsState.addOperands(numRecords); + odsState.addOperands(flags); + odsState.addTypes(res); +} + +void MakeBufferRsrcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value stride, ::mlir::Value numRecords, ::mlir::Value flags) { + odsState.addOperands(base); + odsState.addOperands(stride); + odsState.addOperands(numRecords); + odsState.addOperands(flags); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MakeBufferRsrcOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MakeBufferRsrcOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MakeBufferRsrcOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MakeBufferRsrcOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type baseRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> baseTypes(baseRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::LLVM::LLVMPointerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + baseRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::LLVM::LLVMPointerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(16); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(baseTypes), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1)), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MakeBufferRsrcOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBase().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::LLVM::LLVMPointerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::LLVM::LLVMPointerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MakeBufferRsrcOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MakeBufferRsrcOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MbcntHiOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MbcntHiOpGenericAdaptorBase::MbcntHiOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mbcnt.hi", odsAttrs.getContext()); +} + +MbcntHiOpGenericAdaptorBase::MbcntHiOpGenericAdaptorBase(MbcntHiOp op) : MbcntHiOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MbcntHiOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MbcntHiOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MbcntHiOpAdaptor::MbcntHiOpAdaptor(MbcntHiOp op) : MbcntHiOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MbcntHiOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MbcntHiOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MbcntHiOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> MbcntHiOp::getIn0() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MbcntHiOp::getIn1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MbcntHiOp::getIn0Mutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MbcntHiOp::getIn1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MbcntHiOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MbcntHiOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MbcntHiOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MbcntHiOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in0, ::mlir::Value in1) { + odsState.addOperands(in0); + odsState.addOperands(in1); + odsState.addTypes(res); +} + +void MbcntHiOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in0, ::mlir::Value in1) { + odsState.addOperands(in0); + odsState.addOperands(in1); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MbcntHiOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MbcntHiOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MbcntHiOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MbcntHiOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand in0RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> in0Operands(in0RawOperands); ::llvm::SMLoc in0OperandsLoc; + (void)in0OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand in1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> in1Operands(in1RawOperands); ::llvm::SMLoc in1OperandsLoc; + (void)in1OperandsLoc; + ::mlir::Type in0RawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> in0Types(in0RawTypes); + ::mlir::Type in1RawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> in1Types(in1RawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + in0OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(in0RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + in1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(in1RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + in0RawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + in1RawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(in0Operands, in0Types, in0OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(in1Operands, in1Types, in1OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MbcntHiOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn0(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIn1(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "("; + { + auto type = getIn0().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getIn1().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MbcntHiOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MbcntHiOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MbcntLoOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MbcntLoOpGenericAdaptorBase::MbcntLoOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mbcnt.lo", odsAttrs.getContext()); +} + +MbcntLoOpGenericAdaptorBase::MbcntLoOpGenericAdaptorBase(MbcntLoOp op) : MbcntLoOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MbcntLoOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MbcntLoOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MbcntLoOpAdaptor::MbcntLoOpAdaptor(MbcntLoOp op) : MbcntLoOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MbcntLoOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MbcntLoOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MbcntLoOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> MbcntLoOp::getIn0() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> MbcntLoOp::getIn1() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MbcntLoOp::getIn0Mutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MbcntLoOp::getIn1Mutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MbcntLoOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MbcntLoOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MbcntLoOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MbcntLoOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in0, ::mlir::Value in1) { + odsState.addOperands(in0); + odsState.addOperands(in1); + odsState.addTypes(res); +} + +void MbcntLoOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in0, ::mlir::Value in1) { + odsState.addOperands(in0); + odsState.addOperands(in1); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MbcntLoOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MbcntLoOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MbcntLoOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MbcntLoOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand in0RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> in0Operands(in0RawOperands); ::llvm::SMLoc in0OperandsLoc; + (void)in0OperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand in1RawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> in1Operands(in1RawOperands); ::llvm::SMLoc in1OperandsLoc; + (void)in1OperandsLoc; + ::mlir::Type in0RawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> in0Types(in0RawTypes); + ::mlir::Type in1RawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> in1Types(in1RawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + in0OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(in0RawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + in1OperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(in1RawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + in0RawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::IntegerType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + in1RawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(in0Operands, in0Types, in0OperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(in1Operands, in1Types, in1OperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MbcntLoOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getIn0(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIn1(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "("; + { + auto type = getIn0().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getIn1().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MbcntLoOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MbcntLoOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MubufLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MubufLoadOpGenericAdaptorBase::MubufLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.buffer.load", odsAttrs.getContext()); +} + +MubufLoadOpGenericAdaptorBase::MubufLoadOpGenericAdaptorBase(MubufLoadOp op) : MubufLoadOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MubufLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MubufLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MubufLoadOpAdaptor::MubufLoadOpAdaptor(MubufLoadOp op) : MubufLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MubufLoadOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MubufLoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MubufLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MubufLoadOp::getRsrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MubufLoadOp::getVindex() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value MubufLoadOp::getOffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value MubufLoadOp::getGlc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value MubufLoadOp::getSlc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &MubufLoadOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MubufLoadOp::getVindexMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MubufLoadOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MubufLoadOp::getGlcMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MubufLoadOp::getSlcMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair MubufLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MubufLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MubufLoadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void MubufLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value rsrc, ::mlir::Value vindex, ::mlir::Value offset, ::mlir::Value glc, ::mlir::Value slc) { + odsState.addOperands(rsrc); + odsState.addOperands(vindex); + odsState.addOperands(offset); + odsState.addOperands(glc); + odsState.addOperands(slc); + odsState.addTypes(res); +} + +void MubufLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value rsrc, ::mlir::Value vindex, ::mlir::Value offset, ::mlir::Value glc, ::mlir::Value slc) { + odsState.addOperands(rsrc); + odsState.addOperands(vindex); + odsState.addOperands(offset); + odsState.addOperands(glc); + odsState.addOperands(slc); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MubufLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MubufLoadOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MubufLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MubufLoadOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MubufStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MubufStoreOpGenericAdaptorBase::MubufStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.buffer.store", odsAttrs.getContext()); +} + +MubufStoreOpGenericAdaptorBase::MubufStoreOpGenericAdaptorBase(MubufStoreOp op) : MubufStoreOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MubufStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MubufStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MubufStoreOpAdaptor::MubufStoreOpAdaptor(MubufStoreOp op) : MubufStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MubufStoreOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MubufStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MubufStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value MubufStoreOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value MubufStoreOp::getRsrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value MubufStoreOp::getVindex() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value MubufStoreOp::getOffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value MubufStoreOp::getGlc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::Value MubufStoreOp::getSlc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(5).begin()); +} + +::mlir::OpOperand &MubufStoreOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MubufStoreOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MubufStoreOp::getVindexMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MubufStoreOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MubufStoreOp::getGlcMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MubufStoreOp::getSlcMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +std::pair MubufStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MubufStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MubufStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value vindex, ::mlir::Value offset, ::mlir::Value glc, ::mlir::Value slc) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(vindex); + odsState.addOperands(offset); + odsState.addOperands(glc); + odsState.addOperands(slc); +} + +void MubufStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value vindex, ::mlir::Value offset, ::mlir::Value glc, ::mlir::Value slc) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(vindex); + odsState.addOperands(offset); + odsState.addOperands(glc); + odsState.addOperands(slc); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MubufStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MubufStoreOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MubufStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MubufStoreOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicCmpSwap definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicCmpSwapGenericAdaptorBase::RawBufferAtomicCmpSwapGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.buffer.atomic.cmpswap", odsAttrs.getContext()); +} + +RawBufferAtomicCmpSwapGenericAdaptorBase::RawBufferAtomicCmpSwapGenericAdaptorBase(RawBufferAtomicCmpSwap op) : RawBufferAtomicCmpSwapGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicCmpSwapGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawBufferAtomicCmpSwapGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RawBufferAtomicCmpSwapAdaptor::RawBufferAtomicCmpSwapAdaptor(RawBufferAtomicCmpSwap op) : RawBufferAtomicCmpSwapGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicCmpSwapAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RawBufferAtomicCmpSwap::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawBufferAtomicCmpSwap::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferAtomicCmpSwap::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RawBufferAtomicCmpSwap::getCmp() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value RawBufferAtomicCmpSwap::getRsrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicCmpSwap::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicCmpSwap::getSoffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawBufferAtomicCmpSwap::getAux() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(5).begin()); +} + +::mlir::OpOperand &RawBufferAtomicCmpSwap::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicCmpSwap::getCmpMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicCmpSwap::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicCmpSwap::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicCmpSwap::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicCmpSwap::getAuxMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawBufferAtomicCmpSwap::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicCmpSwap::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferAtomicCmpSwap::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void RawBufferAtomicCmpSwap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(src); + odsState.addOperands(cmp); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + odsState.addTypes(res); +} + +void RawBufferAtomicCmpSwap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(src); + odsState.addOperands(cmp); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicCmpSwap::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawBufferAtomicCmpSwap::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that all of {res, src, cmp} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicCmpSwap::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RawBufferAtomicCmpSwap::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + ::mlir::Type rsrcRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> rsrcTypes(rsrcRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseLParen()) + return ::mlir::failure(); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + rsrcRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resTypes[0]), ::llvm::ArrayRef<::mlir::Type>(rsrcTypes), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0)), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawBufferAtomicCmpSwap::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << "("; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ")"; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRsrc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicCmpSwap) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicFAddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicFAddOpGenericAdaptorBase::RawBufferAtomicFAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.buffer.atomic.fadd", odsAttrs.getContext()); +} + +RawBufferAtomicFAddOpGenericAdaptorBase::RawBufferAtomicFAddOpGenericAdaptorBase(RawBufferAtomicFAddOp op) : RawBufferAtomicFAddOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicFAddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawBufferAtomicFAddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RawBufferAtomicFAddOpAdaptor::RawBufferAtomicFAddOpAdaptor(RawBufferAtomicFAddOp op) : RawBufferAtomicFAddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicFAddOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RawBufferAtomicFAddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawBufferAtomicFAddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferAtomicFAddOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RawBufferAtomicFAddOp::getRsrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value RawBufferAtomicFAddOp::getOffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value RawBufferAtomicFAddOp::getSoffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value RawBufferAtomicFAddOp::getAux() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawBufferAtomicFAddOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFAddOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFAddOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFAddOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFAddOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawBufferAtomicFAddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicFAddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RawBufferAtomicFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); +} + +void RawBufferAtomicFAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicFAddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawBufferAtomicFAddOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicFAddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicFAddOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicFMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicFMaxOpGenericAdaptorBase::RawBufferAtomicFMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.buffer.atomic.fmax", odsAttrs.getContext()); +} + +RawBufferAtomicFMaxOpGenericAdaptorBase::RawBufferAtomicFMaxOpGenericAdaptorBase(RawBufferAtomicFMaxOp op) : RawBufferAtomicFMaxOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicFMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawBufferAtomicFMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RawBufferAtomicFMaxOpAdaptor::RawBufferAtomicFMaxOpAdaptor(RawBufferAtomicFMaxOp op) : RawBufferAtomicFMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicFMaxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RawBufferAtomicFMaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawBufferAtomicFMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferAtomicFMaxOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RawBufferAtomicFMaxOp::getRsrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value RawBufferAtomicFMaxOp::getOffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value RawBufferAtomicFMaxOp::getSoffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value RawBufferAtomicFMaxOp::getAux() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawBufferAtomicFMaxOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFMaxOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFMaxOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFMaxOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicFMaxOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawBufferAtomicFMaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicFMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RawBufferAtomicFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); +} + +void RawBufferAtomicFMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicFMaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawBufferAtomicFMaxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicFMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicFMaxOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicSMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicSMaxOpGenericAdaptorBase::RawBufferAtomicSMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.buffer.atomic.smax", odsAttrs.getContext()); +} + +RawBufferAtomicSMaxOpGenericAdaptorBase::RawBufferAtomicSMaxOpGenericAdaptorBase(RawBufferAtomicSMaxOp op) : RawBufferAtomicSMaxOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicSMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawBufferAtomicSMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RawBufferAtomicSMaxOpAdaptor::RawBufferAtomicSMaxOpAdaptor(RawBufferAtomicSMaxOp op) : RawBufferAtomicSMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicSMaxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RawBufferAtomicSMaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawBufferAtomicSMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferAtomicSMaxOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RawBufferAtomicSMaxOp::getRsrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value RawBufferAtomicSMaxOp::getOffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value RawBufferAtomicSMaxOp::getSoffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value RawBufferAtomicSMaxOp::getAux() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawBufferAtomicSMaxOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicSMaxOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicSMaxOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicSMaxOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicSMaxOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawBufferAtomicSMaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicSMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RawBufferAtomicSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); +} + +void RawBufferAtomicSMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicSMaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawBufferAtomicSMaxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicSMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicSMaxOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicUMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferAtomicUMinOpGenericAdaptorBase::RawBufferAtomicUMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.buffer.atomic.umin", odsAttrs.getContext()); +} + +RawBufferAtomicUMinOpGenericAdaptorBase::RawBufferAtomicUMinOpGenericAdaptorBase(RawBufferAtomicUMinOp op) : RawBufferAtomicUMinOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferAtomicUMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawBufferAtomicUMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RawBufferAtomicUMinOpAdaptor::RawBufferAtomicUMinOpAdaptor(RawBufferAtomicUMinOp op) : RawBufferAtomicUMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferAtomicUMinOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RawBufferAtomicUMinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawBufferAtomicUMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferAtomicUMinOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RawBufferAtomicUMinOp::getRsrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value RawBufferAtomicUMinOp::getOffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value RawBufferAtomicUMinOp::getSoffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value RawBufferAtomicUMinOp::getAux() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawBufferAtomicUMinOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicUMinOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicUMinOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicUMinOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferAtomicUMinOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawBufferAtomicUMinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferAtomicUMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RawBufferAtomicUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); +} + +void RawBufferAtomicUMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferAtomicUMinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawBufferAtomicUMinOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferAtomicUMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicUMinOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferLoadOpGenericAdaptorBase::RawBufferLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.buffer.load", odsAttrs.getContext()); +} + +RawBufferLoadOpGenericAdaptorBase::RawBufferLoadOpGenericAdaptorBase(RawBufferLoadOp op) : RawBufferLoadOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawBufferLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RawBufferLoadOpAdaptor::RawBufferLoadOpAdaptor(RawBufferLoadOp op) : RawBufferLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferLoadOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RawBufferLoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawBufferLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferLoadOp::getRsrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RawBufferLoadOp::getOffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value RawBufferLoadOp::getSoffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value RawBufferLoadOp::getAux() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &RawBufferLoadOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferLoadOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferLoadOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferLoadOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawBufferLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferLoadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + odsState.addTypes(res); +} + +void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawBufferLoadOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferLoadOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawBufferStoreOpGenericAdaptorBase::RawBufferStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.buffer.store", odsAttrs.getContext()); +} + +RawBufferStoreOpGenericAdaptorBase::RawBufferStoreOpGenericAdaptorBase(RawBufferStoreOp op) : RawBufferStoreOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawBufferStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawBufferStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RawBufferStoreOpAdaptor::RawBufferStoreOpAdaptor(RawBufferStoreOp op) : RawBufferStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawBufferStoreOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RawBufferStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawBufferStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawBufferStoreOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RawBufferStoreOp::getRsrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value RawBufferStoreOp::getOffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::Value RawBufferStoreOp::getSoffset() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(3).begin()); +} + +::mlir::Value RawBufferStoreOp::getAux() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawBufferStoreOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferStoreOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferStoreOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferStoreOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawBufferStoreOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawBufferStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawBufferStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); +} + +void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawBufferStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawBufferStoreOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawBufferStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferStoreOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicCmpSwap definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawPtrBufferAtomicCmpSwapGenericAdaptorBase::RawPtrBufferAtomicCmpSwapGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.ptr.buffer.atomic.cmpswap", odsAttrs.getContext()); +} + +RawPtrBufferAtomicCmpSwapGenericAdaptorBase::RawPtrBufferAtomicCmpSwapGenericAdaptorBase(RawPtrBufferAtomicCmpSwap op) : RawPtrBufferAtomicCmpSwapGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawPtrBufferAtomicCmpSwapGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawPtrBufferAtomicCmpSwapGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr RawPtrBufferAtomicCmpSwapGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicCmpSwapGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicCmpSwapGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicCmpSwapGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicCmpSwapGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicCmpSwapGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +RawPtrBufferAtomicCmpSwapAdaptor::RawPtrBufferAtomicCmpSwapAdaptor(RawPtrBufferAtomicCmpSwap op) : RawPtrBufferAtomicCmpSwapGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawPtrBufferAtomicCmpSwapAdaptor::verify(::mlir::Location loc) { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.cmpswap' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.cmpswap' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.cmpswap' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair RawPtrBufferAtomicCmpSwap::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawPtrBufferAtomicCmpSwap::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawPtrBufferAtomicCmpSwap::getSrc() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value RawPtrBufferAtomicCmpSwap::getCmp() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> RawPtrBufferAtomicCmpSwap::getRsrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicCmpSwap::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicCmpSwap::getSoffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicCmpSwap::getAux() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(5).begin()); +} + +::mlir::OpOperand &RawPtrBufferAtomicCmpSwap::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicCmpSwap::getCmpMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicCmpSwap::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicCmpSwap::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicCmpSwap::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicCmpSwap::getAuxMutable() { + auto range = getODSOperandIndexAndLength(5); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawPtrBufferAtomicCmpSwap::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawPtrBufferAtomicCmpSwap::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawPtrBufferAtomicCmpSwap::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RawPtrBufferAtomicCmpSwap::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RawPtrBufferAtomicCmpSwap::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawPtrBufferAtomicCmpSwap::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional RawPtrBufferAtomicCmpSwap::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void RawPtrBufferAtomicCmpSwap::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RawPtrBufferAtomicCmpSwap::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult RawPtrBufferAtomicCmpSwap::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicCmpSwap::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicCmpSwap::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::ArrayAttr RawPtrBufferAtomicCmpSwap::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicCmpSwap::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicCmpSwap::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicCmpSwap::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicCmpSwap::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicCmpSwap::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void RawPtrBufferAtomicCmpSwap::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicCmpSwap::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicCmpSwap::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute RawPtrBufferAtomicCmpSwap::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicCmpSwap::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicCmpSwap::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void RawPtrBufferAtomicCmpSwap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(src); + odsState.addOperands(cmp); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(res); +} + +void RawPtrBufferAtomicCmpSwap::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(src); + odsState.addOperands(cmp); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawPtrBufferAtomicCmpSwap::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 6u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawPtrBufferAtomicCmpSwap::verifyInvariantsImpl() { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that all of {res, src, cmp} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicCmpSwap::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RawPtrBufferAtomicCmpSwap::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::LLVM::LLVMPointerType>(8); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(resTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resTypes[0]), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1)), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicCmpSwap::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RawPtrBufferAtomicCmpSwap::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(2)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(2)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +::llvm::SmallVector<::mlir::Value> RawPtrBufferAtomicCmpSwap::getAccessedOperands() { + return {getRsrc()}; +} +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicCmpSwap) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicFaddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawPtrBufferAtomicFaddOpGenericAdaptorBase::RawPtrBufferAtomicFaddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.ptr.buffer.atomic.fadd", odsAttrs.getContext()); +} + +RawPtrBufferAtomicFaddOpGenericAdaptorBase::RawPtrBufferAtomicFaddOpGenericAdaptorBase(RawPtrBufferAtomicFaddOp op) : RawPtrBufferAtomicFaddOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawPtrBufferAtomicFaddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawPtrBufferAtomicFaddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr RawPtrBufferAtomicFaddOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFaddOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFaddOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFaddOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFaddOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFaddOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +RawPtrBufferAtomicFaddOpAdaptor::RawPtrBufferAtomicFaddOpAdaptor(RawPtrBufferAtomicFaddOp op) : RawPtrBufferAtomicFaddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawPtrBufferAtomicFaddOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.fadd' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.fadd' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.fadd' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair RawPtrBufferAtomicFaddOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawPtrBufferAtomicFaddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawPtrBufferAtomicFaddOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> RawPtrBufferAtomicFaddOp::getRsrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicFaddOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicFaddOp::getSoffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicFaddOp::getAux() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawPtrBufferAtomicFaddOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicFaddOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicFaddOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicFaddOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicFaddOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawPtrBufferAtomicFaddOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawPtrBufferAtomicFaddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawPtrBufferAtomicFaddOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RawPtrBufferAtomicFaddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawPtrBufferAtomicFaddOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional RawPtrBufferAtomicFaddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void RawPtrBufferAtomicFaddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RawPtrBufferAtomicFaddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult RawPtrBufferAtomicFaddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicFaddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicFaddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFaddOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFaddOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFaddOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFaddOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFaddOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFaddOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void RawPtrBufferAtomicFaddOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicFaddOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicFaddOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute RawPtrBufferAtomicFaddOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicFaddOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicFaddOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void RawPtrBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void RawPtrBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawPtrBufferAtomicFaddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawPtrBufferAtomicFaddOp::verifyInvariantsImpl() { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicFaddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RawPtrBufferAtomicFaddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type vdataRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vdataTypes(vdataRawTypes); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vdataRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::LLVM::LLVMPointerType>(8); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(vdataTypes), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1)), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicFaddOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVdata().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RawPtrBufferAtomicFaddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +::llvm::SmallVector<::mlir::Value> RawPtrBufferAtomicFaddOp::getAccessedOperands() { + return {getRsrc()}; +} +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicFaddOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicFmaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawPtrBufferAtomicFmaxOpGenericAdaptorBase::RawPtrBufferAtomicFmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.ptr.buffer.atomic.fmax", odsAttrs.getContext()); +} + +RawPtrBufferAtomicFmaxOpGenericAdaptorBase::RawPtrBufferAtomicFmaxOpGenericAdaptorBase(RawPtrBufferAtomicFmaxOp op) : RawPtrBufferAtomicFmaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawPtrBufferAtomicFmaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawPtrBufferAtomicFmaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr RawPtrBufferAtomicFmaxOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFmaxOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFmaxOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFmaxOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFmaxOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFmaxOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +RawPtrBufferAtomicFmaxOpAdaptor::RawPtrBufferAtomicFmaxOpAdaptor(RawPtrBufferAtomicFmaxOp op) : RawPtrBufferAtomicFmaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawPtrBufferAtomicFmaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.fmax' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.fmax' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.fmax' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair RawPtrBufferAtomicFmaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawPtrBufferAtomicFmaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawPtrBufferAtomicFmaxOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> RawPtrBufferAtomicFmaxOp::getRsrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicFmaxOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicFmaxOp::getSoffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicFmaxOp::getAux() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawPtrBufferAtomicFmaxOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicFmaxOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicFmaxOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicFmaxOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicFmaxOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawPtrBufferAtomicFmaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawPtrBufferAtomicFmaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawPtrBufferAtomicFmaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RawPtrBufferAtomicFmaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawPtrBufferAtomicFmaxOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional RawPtrBufferAtomicFmaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void RawPtrBufferAtomicFmaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RawPtrBufferAtomicFmaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult RawPtrBufferAtomicFmaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicFmaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicFmaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFmaxOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFmaxOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFmaxOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFmaxOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicFmaxOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicFmaxOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void RawPtrBufferAtomicFmaxOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicFmaxOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicFmaxOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute RawPtrBufferAtomicFmaxOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicFmaxOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicFmaxOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void RawPtrBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void RawPtrBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawPtrBufferAtomicFmaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawPtrBufferAtomicFmaxOp::verifyInvariantsImpl() { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicFmaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RawPtrBufferAtomicFmaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type vdataRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vdataTypes(vdataRawTypes); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vdataRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::LLVM::LLVMPointerType>(8); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(vdataTypes), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1)), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicFmaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVdata().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RawPtrBufferAtomicFmaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +::llvm::SmallVector<::mlir::Value> RawPtrBufferAtomicFmaxOp::getAccessedOperands() { + return {getRsrc()}; +} +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicFmaxOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicSmaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawPtrBufferAtomicSmaxOpGenericAdaptorBase::RawPtrBufferAtomicSmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.ptr.buffer.atomic.smax", odsAttrs.getContext()); +} + +RawPtrBufferAtomicSmaxOpGenericAdaptorBase::RawPtrBufferAtomicSmaxOpGenericAdaptorBase(RawPtrBufferAtomicSmaxOp op) : RawPtrBufferAtomicSmaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawPtrBufferAtomicSmaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawPtrBufferAtomicSmaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr RawPtrBufferAtomicSmaxOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicSmaxOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicSmaxOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicSmaxOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicSmaxOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicSmaxOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +RawPtrBufferAtomicSmaxOpAdaptor::RawPtrBufferAtomicSmaxOpAdaptor(RawPtrBufferAtomicSmaxOp op) : RawPtrBufferAtomicSmaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawPtrBufferAtomicSmaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.smax' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.smax' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.smax' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair RawPtrBufferAtomicSmaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawPtrBufferAtomicSmaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawPtrBufferAtomicSmaxOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> RawPtrBufferAtomicSmaxOp::getRsrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicSmaxOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicSmaxOp::getSoffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicSmaxOp::getAux() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawPtrBufferAtomicSmaxOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicSmaxOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicSmaxOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicSmaxOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicSmaxOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawPtrBufferAtomicSmaxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawPtrBufferAtomicSmaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawPtrBufferAtomicSmaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RawPtrBufferAtomicSmaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawPtrBufferAtomicSmaxOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional RawPtrBufferAtomicSmaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void RawPtrBufferAtomicSmaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RawPtrBufferAtomicSmaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult RawPtrBufferAtomicSmaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicSmaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicSmaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::ArrayAttr RawPtrBufferAtomicSmaxOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicSmaxOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicSmaxOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicSmaxOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicSmaxOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicSmaxOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void RawPtrBufferAtomicSmaxOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicSmaxOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicSmaxOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute RawPtrBufferAtomicSmaxOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicSmaxOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicSmaxOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void RawPtrBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void RawPtrBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawPtrBufferAtomicSmaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawPtrBufferAtomicSmaxOp::verifyInvariantsImpl() { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicSmaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RawPtrBufferAtomicSmaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type vdataRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vdataTypes(vdataRawTypes); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vdataRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::LLVM::LLVMPointerType>(8); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(vdataTypes), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1)), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicSmaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVdata().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RawPtrBufferAtomicSmaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +::llvm::SmallVector<::mlir::Value> RawPtrBufferAtomicSmaxOp::getAccessedOperands() { + return {getRsrc()}; +} +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicSmaxOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicUminOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawPtrBufferAtomicUminOpGenericAdaptorBase::RawPtrBufferAtomicUminOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.ptr.buffer.atomic.umin", odsAttrs.getContext()); +} + +RawPtrBufferAtomicUminOpGenericAdaptorBase::RawPtrBufferAtomicUminOpGenericAdaptorBase(RawPtrBufferAtomicUminOp op) : RawPtrBufferAtomicUminOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawPtrBufferAtomicUminOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawPtrBufferAtomicUminOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr RawPtrBufferAtomicUminOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicUminOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicUminOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicUminOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicUminOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicUminOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +RawPtrBufferAtomicUminOpAdaptor::RawPtrBufferAtomicUminOpAdaptor(RawPtrBufferAtomicUminOp op) : RawPtrBufferAtomicUminOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawPtrBufferAtomicUminOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.umin' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.umin' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.atomic.umin' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair RawPtrBufferAtomicUminOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawPtrBufferAtomicUminOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawPtrBufferAtomicUminOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> RawPtrBufferAtomicUminOp::getRsrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicUminOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicUminOp::getSoffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferAtomicUminOp::getAux() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawPtrBufferAtomicUminOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicUminOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicUminOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicUminOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferAtomicUminOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawPtrBufferAtomicUminOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawPtrBufferAtomicUminOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawPtrBufferAtomicUminOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RawPtrBufferAtomicUminOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawPtrBufferAtomicUminOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional RawPtrBufferAtomicUminOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void RawPtrBufferAtomicUminOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RawPtrBufferAtomicUminOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult RawPtrBufferAtomicUminOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicUminOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicUminOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::ArrayAttr RawPtrBufferAtomicUminOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicUminOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicUminOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicUminOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferAtomicUminOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferAtomicUminOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void RawPtrBufferAtomicUminOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicUminOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void RawPtrBufferAtomicUminOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute RawPtrBufferAtomicUminOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicUminOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferAtomicUminOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void RawPtrBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void RawPtrBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawPtrBufferAtomicUminOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawPtrBufferAtomicUminOp::verifyInvariantsImpl() { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferAtomicUminOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RawPtrBufferAtomicUminOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type vdataRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vdataTypes(vdataRawTypes); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vdataRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::LLVM::LLVMPointerType>(8); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(vdataTypes), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1)), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferAtomicUminOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVdata().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RawPtrBufferAtomicUminOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +::llvm::SmallVector<::mlir::Value> RawPtrBufferAtomicUminOp::getAccessedOperands() { + return {getRsrc()}; +} +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicUminOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawPtrBufferLoadOpGenericAdaptorBase::RawPtrBufferLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.ptr.buffer.load", odsAttrs.getContext()); +} + +RawPtrBufferLoadOpGenericAdaptorBase::RawPtrBufferLoadOpGenericAdaptorBase(RawPtrBufferLoadOp op) : RawPtrBufferLoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawPtrBufferLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawPtrBufferLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr RawPtrBufferLoadOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferLoadOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferLoadOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferLoadOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferLoadOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferLoadOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +RawPtrBufferLoadOpAdaptor::RawPtrBufferLoadOpAdaptor(RawPtrBufferLoadOp op) : RawPtrBufferLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawPtrBufferLoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.load' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.load' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.load' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair RawPtrBufferLoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawPtrBufferLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> RawPtrBufferLoadOp::getRsrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferLoadOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferLoadOp::getSoffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferLoadOp::getAux() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &RawPtrBufferLoadOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferLoadOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferLoadOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferLoadOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawPtrBufferLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawPtrBufferLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawPtrBufferLoadOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RawPtrBufferLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RawPtrBufferLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawPtrBufferLoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional RawPtrBufferLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void RawPtrBufferLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RawPtrBufferLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult RawPtrBufferLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::ArrayAttr RawPtrBufferLoadOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferLoadOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferLoadOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferLoadOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferLoadOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferLoadOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void RawPtrBufferLoadOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void RawPtrBufferLoadOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void RawPtrBufferLoadOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute RawPtrBufferLoadOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferLoadOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferLoadOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void RawPtrBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + odsState.addTypes(res); +} + +void RawPtrBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawPtrBufferLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawPtrBufferLoadOp::verifyInvariantsImpl() { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RawPtrBufferLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::LLVM::LLVMPointerType>(8); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + result.addTypes(resTypes); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1)), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RawPtrBufferLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +::llvm::SmallVector<::mlir::Value> RawPtrBufferLoadOp::getAccessedOperands() { + return {getRes()}; +} +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferLoadOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RawPtrBufferStoreOpGenericAdaptorBase::RawPtrBufferStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.raw.ptr.buffer.store", odsAttrs.getContext()); +} + +RawPtrBufferStoreOpGenericAdaptorBase::RawPtrBufferStoreOpGenericAdaptorBase(RawPtrBufferStoreOp op) : RawPtrBufferStoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RawPtrBufferStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RawPtrBufferStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr RawPtrBufferStoreOpGenericAdaptorBase::getAliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferStoreOpGenericAdaptorBase::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferStoreOpGenericAdaptorBase::getNoaliasScopesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferStoreOpGenericAdaptorBase::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferStoreOpGenericAdaptorBase::getTbaaAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferStoreOpGenericAdaptorBase::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +RawPtrBufferStoreOpAdaptor::RawPtrBufferStoreOpAdaptor(RawPtrBufferStoreOp op) : RawPtrBufferStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RawPtrBufferStoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (tblgen_alias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.store' op ""attribute 'alias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_noalias_scopes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_noalias_scopes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_noalias_scopes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::AliasScopeAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.store' op ""attribute 'noalias_scopes' failed to satisfy constraint: LLVM dialect alias scope array"); + + if (tblgen_tbaa && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_tbaa))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_tbaa), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LLVM::TBAATagAttr>(attr))); })))) + return emitError(loc, "'rocdl.raw.ptr.buffer.store' op ""attribute 'tbaa' failed to satisfy constraint: LLVM dialect TBAA tag metadata array"); + return ::mlir::success(); +} + +std::pair RawPtrBufferStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RawPtrBufferStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RawPtrBufferStoreOp::getVdata() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> RawPtrBufferStoreOp::getRsrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::LLVM::LLVMPointerType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferStoreOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferStoreOp::getSoffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(3).begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> RawPtrBufferStoreOp::getAux() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &RawPtrBufferStoreOp::getVdataMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferStoreOp::getRsrcMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferStoreOp::getOffsetMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferStoreOp::getSoffsetMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &RawPtrBufferStoreOp::getAuxMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair RawPtrBufferStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RawPtrBufferStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RawPtrBufferStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alias_scopes; + auto attr = dict.get("alias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.noalias_scopes; + auto attr = dict.get("noalias_scopes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for noalias_scopes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `noalias_scopes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tbaa; + auto attr = dict.get("tbaa"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tbaa in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tbaa` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RawPtrBufferStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.noalias_scopes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("noalias_scopes", + propStorage)); + } + + { + const auto &propStorage = prop.tbaa; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tbaa", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RawPtrBufferStoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.noalias_scopes.getAsOpaquePointer()), + llvm::hash_value(prop.tbaa.getAsOpaquePointer())); +} + +std::optional RawPtrBufferStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alias_scopes") + return prop.alias_scopes; + + if (name == "noalias_scopes") + return prop.noalias_scopes; + + if (name == "tbaa") + return prop.tbaa; + return std::nullopt; +} + +void RawPtrBufferStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alias_scopes") { + prop.alias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "noalias_scopes") { + prop.noalias_scopes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tbaa") { + prop.tbaa = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RawPtrBufferStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alias_scopes) attrs.append("alias_scopes", prop.alias_scopes); + + if (prop.noalias_scopes) attrs.append("noalias_scopes", prop.noalias_scopes); + + if (prop.tbaa) attrs.append("tbaa", prop.tbaa); +} + +::mlir::LogicalResult RawPtrBufferStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "alias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNoaliasScopesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(attr, "noalias_scopes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTbaaAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(attr, "tbaa", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.noalias_scopes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tbaa))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alias_scopes); + + writer.writeOptionalAttribute(prop.noalias_scopes); + + writer.writeOptionalAttribute(prop.tbaa); +} + +::mlir::ArrayAttr RawPtrBufferStoreOp::getAliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferStoreOp::getAliasScopes() { + auto attr = getAliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferStoreOp::getNoaliasScopesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().noalias_scopes); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferStoreOp::getNoaliasScopes() { + auto attr = getNoaliasScopesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr RawPtrBufferStoreOp::getTbaaAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tbaa); +} + +::std::optional< ::mlir::ArrayAttr > RawPtrBufferStoreOp::getTbaa() { + auto attr = getTbaaAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void RawPtrBufferStoreOp::setAliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAliasScopesAttrName(), attr); +} + +void RawPtrBufferStoreOp::setNoaliasScopesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getNoaliasScopesAttrName(), attr); +} + +void RawPtrBufferStoreOp::setTbaaAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTbaaAttrName(), attr); +} + +::mlir::Attribute RawPtrBufferStoreOp::removeAliasScopesAttr() { + auto &attr = getProperties().alias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferStoreOp::removeNoaliasScopesAttr() { + auto &attr = getProperties().noalias_scopes; + attr = {}; + return attr; +} + +::mlir::Attribute RawPtrBufferStoreOp::removeTbaaAttr() { + auto &attr = getProperties().tbaa; + attr = {}; + return attr; +} + +void RawPtrBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } +} + +void RawPtrBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa) { + odsState.addOperands(vdata); + odsState.addOperands(rsrc); + odsState.addOperands(offset); + odsState.addOperands(soffset); + odsState.addOperands(aux); + if (alias_scopes) { + odsState.getOrAddProperties().alias_scopes = alias_scopes; + } + if (noalias_scopes) { + odsState.getOrAddProperties().noalias_scopes = noalias_scopes; + } + if (tbaa) { + odsState.getOrAddProperties().tbaa = tbaa; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RawPtrBufferStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 5u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RawPtrBufferStoreOp::verifyInvariantsImpl() { + auto tblgen_alias_scopes = getProperties().alias_scopes; (void)tblgen_alias_scopes; + auto tblgen_noalias_scopes = getProperties().noalias_scopes; (void)tblgen_noalias_scopes; + auto tblgen_tbaa = getProperties().tbaa; (void)tblgen_tbaa; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_alias_scopes, "alias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps0(*this, tblgen_noalias_scopes, "noalias_scopes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_ROCDLOps1(*this, tblgen_tbaa, "tbaa"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RawPtrBufferStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RawPtrBufferStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type vdataRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> vdataTypes(vdataRawTypes); + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + vdataRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::LLVM::LLVMPointerType>(8); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(vdataTypes), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1), ::llvm::ArrayRef<::mlir::Type>(odsBuildableType1)), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RawPtrBufferStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVdata().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RawPtrBufferStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +::llvm::SmallVector<::mlir::Value> RawPtrBufferStoreOp::getAccessedOperands() { + return {getRsrc()}; +} +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferStoreOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::ThreadIdXOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ThreadIdXOpGenericAdaptorBase::ThreadIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.workitem.id.x", odsAttrs.getContext()); +} + +ThreadIdXOpGenericAdaptorBase::ThreadIdXOpGenericAdaptorBase(ThreadIdXOp op) : ThreadIdXOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ThreadIdXOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ThreadIdXOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ThreadIdXOpAdaptor::ThreadIdXOpAdaptor(ThreadIdXOp op) : ThreadIdXOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ThreadIdXOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ThreadIdXOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ThreadIdXOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ThreadIdXOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ThreadIdXOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ThreadIdXOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ThreadIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ThreadIdXOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadIdXOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ThreadIdXOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadIdXOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ThreadIdXOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ThreadIdXOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ThreadIdXOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ThreadIdXOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::ThreadIdYOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ThreadIdYOpGenericAdaptorBase::ThreadIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.workitem.id.y", odsAttrs.getContext()); +} + +ThreadIdYOpGenericAdaptorBase::ThreadIdYOpGenericAdaptorBase(ThreadIdYOp op) : ThreadIdYOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ThreadIdYOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ThreadIdYOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ThreadIdYOpAdaptor::ThreadIdYOpAdaptor(ThreadIdYOp op) : ThreadIdYOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ThreadIdYOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ThreadIdYOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ThreadIdYOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ThreadIdYOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ThreadIdYOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ThreadIdYOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ThreadIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ThreadIdYOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadIdYOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ThreadIdYOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadIdYOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ThreadIdYOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ThreadIdYOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ThreadIdYOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ThreadIdYOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::ThreadIdZOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ThreadIdZOpGenericAdaptorBase::ThreadIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.workitem.id.z", odsAttrs.getContext()); +} + +ThreadIdZOpGenericAdaptorBase::ThreadIdZOpGenericAdaptorBase(ThreadIdZOp op) : ThreadIdZOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ThreadIdZOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ThreadIdZOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ThreadIdZOpAdaptor::ThreadIdZOpAdaptor(ThreadIdZOp op) : ThreadIdZOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ThreadIdZOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ThreadIdZOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ThreadIdZOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ThreadIdZOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ThreadIdZOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ThreadIdZOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void ThreadIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) { + odsState.addTypes(res); +} + +void ThreadIdZOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadIdZOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ThreadIdZOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadIdZOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ThreadIdZOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + return ::mlir::success(); +} + +void ThreadIdZOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ThreadIdZOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ThreadIdZOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x16bf16_1k definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x16bf16_1kGenericAdaptorBase::mfma_f32_16x16x16bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x16bf16.1k", odsAttrs.getContext()); +} + +mfma_f32_16x16x16bf16_1kGenericAdaptorBase::mfma_f32_16x16x16bf16_1kGenericAdaptorBase(mfma_f32_16x16x16bf16_1k op) : mfma_f32_16x16x16bf16_1kGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x16bf16_1kGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x16bf16_1kGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x16bf16_1kAdaptor::mfma_f32_16x16x16bf16_1kAdaptor(mfma_f32_16x16x16bf16_1k op) : mfma_f32_16x16x16bf16_1kGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x16bf16_1kAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x16bf16_1k::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x16bf16_1k::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x16bf16_1k::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x16bf16_1k::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x16bf16_1k::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x16bf16_1k::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x16bf16_1k::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x16bf16_1k::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x16bf16_1k::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x16bf16_1k::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x16bf16_1k::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x16bf16_1k::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x16bf16_1k::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x16bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x16f16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x16f16GenericAdaptorBase::mfma_f32_16x16x16f16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x16f16", odsAttrs.getContext()); +} + +mfma_f32_16x16x16f16GenericAdaptorBase::mfma_f32_16x16x16f16GenericAdaptorBase(mfma_f32_16x16x16f16 op) : mfma_f32_16x16x16f16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x16f16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x16f16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x16f16Adaptor::mfma_f32_16x16x16f16Adaptor(mfma_f32_16x16x16f16 op) : mfma_f32_16x16x16f16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x16f16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x16f16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x16f16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x16f16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x16f16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x16f16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x16f16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x16f16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x16f16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x16f16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x16f16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x16f16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x16f16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x16f16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x16f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x1f32 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x1f32GenericAdaptorBase::mfma_f32_16x16x1f32GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x1f32", odsAttrs.getContext()); +} + +mfma_f32_16x16x1f32GenericAdaptorBase::mfma_f32_16x16x1f32GenericAdaptorBase(mfma_f32_16x16x1f32 op) : mfma_f32_16x16x1f32GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x1f32GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x1f32GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x1f32Adaptor::mfma_f32_16x16x1f32Adaptor(mfma_f32_16x16x1f32 op) : mfma_f32_16x16x1f32GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x1f32Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x1f32::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x1f32::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x1f32::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x1f32::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x1f32::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x1f32::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x1f32::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x1f32::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x1f32::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x1f32::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x1f32::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x1f32::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x1f32::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x1f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x2bf16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x2bf16GenericAdaptorBase::mfma_f32_16x16x2bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x2bf16", odsAttrs.getContext()); +} + +mfma_f32_16x16x2bf16GenericAdaptorBase::mfma_f32_16x16x2bf16GenericAdaptorBase(mfma_f32_16x16x2bf16 op) : mfma_f32_16x16x2bf16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x2bf16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x2bf16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x2bf16Adaptor::mfma_f32_16x16x2bf16Adaptor(mfma_f32_16x16x2bf16 op) : mfma_f32_16x16x2bf16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x2bf16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x2bf16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x2bf16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x2bf16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x2bf16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x2bf16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x2bf16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x2bf16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x2bf16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x2bf16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x2bf16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x2bf16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x2bf16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x2bf16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x2bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x32_bf8_bf8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase::mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x32.bf8.bf8", odsAttrs.getContext()); +} + +mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase::mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase(mfma_f32_16x16x32_bf8_bf8 op) : mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x32_bf8_bf8Adaptor::mfma_f32_16x16x32_bf8_bf8Adaptor(mfma_f32_16x16x32_bf8_bf8 op) : mfma_f32_16x16x32_bf8_bf8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x32_bf8_bf8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x32_bf8_bf8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x32_bf8_bf8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x32_bf8_bf8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x32_bf8_bf8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x32_bf8_bf8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x32_bf8_bf8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x32_bf8_bf8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x32_bf8_bf8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x32_bf8_bf8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x32_bf8_bf8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x32_bf8_bf8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x32_bf8_bf8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x32_bf8_bf8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x32_bf8_bf8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x32_bf8_fp8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase::mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x32.bf8.fp8", odsAttrs.getContext()); +} + +mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase::mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase(mfma_f32_16x16x32_bf8_fp8 op) : mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x32_bf8_fp8Adaptor::mfma_f32_16x16x32_bf8_fp8Adaptor(mfma_f32_16x16x32_bf8_fp8 op) : mfma_f32_16x16x32_bf8_fp8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x32_bf8_fp8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x32_bf8_fp8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x32_bf8_fp8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x32_bf8_fp8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x32_bf8_fp8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x32_bf8_fp8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x32_bf8_fp8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x32_bf8_fp8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x32_bf8_fp8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x32_bf8_fp8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x32_bf8_fp8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x32_bf8_fp8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x32_bf8_fp8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x32_bf8_fp8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x32_bf8_fp8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x32_fp8_bf8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase::mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x32.fp8.bf8", odsAttrs.getContext()); +} + +mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase::mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase(mfma_f32_16x16x32_fp8_bf8 op) : mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x32_fp8_bf8Adaptor::mfma_f32_16x16x32_fp8_bf8Adaptor(mfma_f32_16x16x32_fp8_bf8 op) : mfma_f32_16x16x32_fp8_bf8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x32_fp8_bf8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x32_fp8_bf8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x32_fp8_bf8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x32_fp8_bf8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x32_fp8_bf8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x32_fp8_bf8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x32_fp8_bf8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x32_fp8_bf8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x32_fp8_bf8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x32_fp8_bf8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x32_fp8_bf8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x32_fp8_bf8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x32_fp8_bf8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x32_fp8_bf8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x32_fp8_bf8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x32_fp8_fp8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase::mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x32.fp8.fp8", odsAttrs.getContext()); +} + +mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase::mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase(mfma_f32_16x16x32_fp8_fp8 op) : mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x32_fp8_fp8Adaptor::mfma_f32_16x16x32_fp8_fp8Adaptor(mfma_f32_16x16x32_fp8_fp8 op) : mfma_f32_16x16x32_fp8_fp8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x32_fp8_fp8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x32_fp8_fp8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x32_fp8_fp8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x32_fp8_fp8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x32_fp8_fp8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x32_fp8_fp8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x32_fp8_fp8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x32_fp8_fp8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x32_fp8_fp8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x32_fp8_fp8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x32_fp8_fp8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x32_fp8_fp8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x32_fp8_fp8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x32_fp8_fp8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x32_fp8_fp8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x4bf16_1k definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x4bf16_1kGenericAdaptorBase::mfma_f32_16x16x4bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x4bf16.1k", odsAttrs.getContext()); +} + +mfma_f32_16x16x4bf16_1kGenericAdaptorBase::mfma_f32_16x16x4bf16_1kGenericAdaptorBase(mfma_f32_16x16x4bf16_1k op) : mfma_f32_16x16x4bf16_1kGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x4bf16_1kGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x4bf16_1kGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x4bf16_1kAdaptor::mfma_f32_16x16x4bf16_1kAdaptor(mfma_f32_16x16x4bf16_1k op) : mfma_f32_16x16x4bf16_1kGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x4bf16_1kAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x4bf16_1k::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x4bf16_1k::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x4bf16_1k::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x4bf16_1k::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x4bf16_1k::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x4bf16_1k::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x4bf16_1k::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x4bf16_1k::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x4bf16_1k::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x4bf16_1k::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x4bf16_1k::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x4bf16_1k::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x4bf16_1k::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x4bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x4f16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x4f16GenericAdaptorBase::mfma_f32_16x16x4f16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x4f16", odsAttrs.getContext()); +} + +mfma_f32_16x16x4f16GenericAdaptorBase::mfma_f32_16x16x4f16GenericAdaptorBase(mfma_f32_16x16x4f16 op) : mfma_f32_16x16x4f16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x4f16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x4f16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x4f16Adaptor::mfma_f32_16x16x4f16Adaptor(mfma_f32_16x16x4f16 op) : mfma_f32_16x16x4f16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x4f16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x4f16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x4f16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x4f16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x4f16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x4f16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x4f16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x4f16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x4f16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x4f16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x4f16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x4f16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x4f16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x4f16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x4f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x4f32 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x4f32GenericAdaptorBase::mfma_f32_16x16x4f32GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x4f32", odsAttrs.getContext()); +} + +mfma_f32_16x16x4f32GenericAdaptorBase::mfma_f32_16x16x4f32GenericAdaptorBase(mfma_f32_16x16x4f32 op) : mfma_f32_16x16x4f32GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x4f32GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x4f32GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x4f32Adaptor::mfma_f32_16x16x4f32Adaptor(mfma_f32_16x16x4f32 op) : mfma_f32_16x16x4f32GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x4f32Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x4f32::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x4f32::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x4f32::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x4f32::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x4f32::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x4f32::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x4f32::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x4f32::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x4f32::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x4f32::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x4f32::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x4f32::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x4f32::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x4f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x8_xf32 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x8_xf32GenericAdaptorBase::mfma_f32_16x16x8_xf32GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x8.xf32", odsAttrs.getContext()); +} + +mfma_f32_16x16x8_xf32GenericAdaptorBase::mfma_f32_16x16x8_xf32GenericAdaptorBase(mfma_f32_16x16x8_xf32 op) : mfma_f32_16x16x8_xf32GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x8_xf32GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x8_xf32GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x8_xf32Adaptor::mfma_f32_16x16x8_xf32Adaptor(mfma_f32_16x16x8_xf32 op) : mfma_f32_16x16x8_xf32GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x8_xf32Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x8_xf32::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x8_xf32::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x8_xf32::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x8_xf32::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x8_xf32::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x8_xf32::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x8_xf32::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x8_xf32::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x8_xf32::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x8_xf32::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x8_xf32::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x8_xf32::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x8_xf32::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x8_xf32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x8bf16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_16x16x8bf16GenericAdaptorBase::mfma_f32_16x16x8bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.16x16x8bf16", odsAttrs.getContext()); +} + +mfma_f32_16x16x8bf16GenericAdaptorBase::mfma_f32_16x16x8bf16GenericAdaptorBase(mfma_f32_16x16x8bf16 op) : mfma_f32_16x16x8bf16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_16x16x8bf16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_16x16x8bf16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_16x16x8bf16Adaptor::mfma_f32_16x16x8bf16Adaptor(mfma_f32_16x16x8bf16 op) : mfma_f32_16x16x8bf16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_16x16x8bf16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_16x16x8bf16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x8bf16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_16x16x8bf16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_16x16x8bf16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_16x16x8bf16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_16x16x8bf16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_16x16x8bf16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_16x16x8bf16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_16x16x8bf16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_16x16x8bf16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_16x16x8bf16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_16x16x8bf16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_16x16x8bf16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x8bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x16_bf8_bf8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase::mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x16.bf8.bf8", odsAttrs.getContext()); +} + +mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase::mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase(mfma_f32_32x32x16_bf8_bf8 op) : mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x16_bf8_bf8Adaptor::mfma_f32_32x32x16_bf8_bf8Adaptor(mfma_f32_32x32x16_bf8_bf8 op) : mfma_f32_32x32x16_bf8_bf8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x16_bf8_bf8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x16_bf8_bf8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x16_bf8_bf8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x16_bf8_bf8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x16_bf8_bf8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x16_bf8_bf8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x16_bf8_bf8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x16_bf8_bf8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x16_bf8_bf8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x16_bf8_bf8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x16_bf8_bf8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x16_bf8_bf8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x16_bf8_bf8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x16_bf8_bf8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x16_bf8_bf8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x16_bf8_fp8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase::mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x16.bf8.fp8", odsAttrs.getContext()); +} + +mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase::mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase(mfma_f32_32x32x16_bf8_fp8 op) : mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x16_bf8_fp8Adaptor::mfma_f32_32x32x16_bf8_fp8Adaptor(mfma_f32_32x32x16_bf8_fp8 op) : mfma_f32_32x32x16_bf8_fp8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x16_bf8_fp8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x16_bf8_fp8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x16_bf8_fp8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x16_bf8_fp8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x16_bf8_fp8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x16_bf8_fp8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x16_bf8_fp8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x16_bf8_fp8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x16_bf8_fp8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x16_bf8_fp8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x16_bf8_fp8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x16_bf8_fp8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x16_bf8_fp8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x16_bf8_fp8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x16_bf8_fp8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x16_fp8_bf8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase::mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x16.fp8.bf8", odsAttrs.getContext()); +} + +mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase::mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase(mfma_f32_32x32x16_fp8_bf8 op) : mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x16_fp8_bf8Adaptor::mfma_f32_32x32x16_fp8_bf8Adaptor(mfma_f32_32x32x16_fp8_bf8 op) : mfma_f32_32x32x16_fp8_bf8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x16_fp8_bf8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x16_fp8_bf8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x16_fp8_bf8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x16_fp8_bf8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x16_fp8_bf8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x16_fp8_bf8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x16_fp8_bf8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x16_fp8_bf8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x16_fp8_bf8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x16_fp8_bf8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x16_fp8_bf8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x16_fp8_bf8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x16_fp8_bf8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x16_fp8_bf8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x16_fp8_bf8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x16_fp8_fp8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase::mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x16.fp8.fp8", odsAttrs.getContext()); +} + +mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase::mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase(mfma_f32_32x32x16_fp8_fp8 op) : mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x16_fp8_fp8Adaptor::mfma_f32_32x32x16_fp8_fp8Adaptor(mfma_f32_32x32x16_fp8_fp8 op) : mfma_f32_32x32x16_fp8_fp8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x16_fp8_fp8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x16_fp8_fp8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x16_fp8_fp8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x16_fp8_fp8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x16_fp8_fp8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x16_fp8_fp8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x16_fp8_fp8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x16_fp8_fp8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x16_fp8_fp8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x16_fp8_fp8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x16_fp8_fp8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x16_fp8_fp8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x16_fp8_fp8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x16_fp8_fp8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x16_fp8_fp8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x1f32 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x1f32GenericAdaptorBase::mfma_f32_32x32x1f32GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x1f32", odsAttrs.getContext()); +} + +mfma_f32_32x32x1f32GenericAdaptorBase::mfma_f32_32x32x1f32GenericAdaptorBase(mfma_f32_32x32x1f32 op) : mfma_f32_32x32x1f32GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x1f32GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x1f32GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x1f32Adaptor::mfma_f32_32x32x1f32Adaptor(mfma_f32_32x32x1f32 op) : mfma_f32_32x32x1f32GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x1f32Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x1f32::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x1f32::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x1f32::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x1f32::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x1f32::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x1f32::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x1f32::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x1f32::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x1f32::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x1f32::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x1f32::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x1f32::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x1f32::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x1f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x2bf16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x2bf16GenericAdaptorBase::mfma_f32_32x32x2bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x2bf16", odsAttrs.getContext()); +} + +mfma_f32_32x32x2bf16GenericAdaptorBase::mfma_f32_32x32x2bf16GenericAdaptorBase(mfma_f32_32x32x2bf16 op) : mfma_f32_32x32x2bf16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x2bf16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x2bf16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x2bf16Adaptor::mfma_f32_32x32x2bf16Adaptor(mfma_f32_32x32x2bf16 op) : mfma_f32_32x32x2bf16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x2bf16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x2bf16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x2bf16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x2bf16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x2bf16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x2bf16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x2bf16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x2bf16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x2bf16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x2bf16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x2bf16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x2bf16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x2bf16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x2bf16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x2bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x2f32 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x2f32GenericAdaptorBase::mfma_f32_32x32x2f32GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x2f32", odsAttrs.getContext()); +} + +mfma_f32_32x32x2f32GenericAdaptorBase::mfma_f32_32x32x2f32GenericAdaptorBase(mfma_f32_32x32x2f32 op) : mfma_f32_32x32x2f32GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x2f32GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x2f32GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x2f32Adaptor::mfma_f32_32x32x2f32Adaptor(mfma_f32_32x32x2f32 op) : mfma_f32_32x32x2f32GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x2f32Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x2f32::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x2f32::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x2f32::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x2f32::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x2f32::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x2f32::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x2f32::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x2f32::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x2f32::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x2f32::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x2f32::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x2f32::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x2f32::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x2f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x4_xf32 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x4_xf32GenericAdaptorBase::mfma_f32_32x32x4_xf32GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x4.xf32", odsAttrs.getContext()); +} + +mfma_f32_32x32x4_xf32GenericAdaptorBase::mfma_f32_32x32x4_xf32GenericAdaptorBase(mfma_f32_32x32x4_xf32 op) : mfma_f32_32x32x4_xf32GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x4_xf32GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x4_xf32GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x4_xf32Adaptor::mfma_f32_32x32x4_xf32Adaptor(mfma_f32_32x32x4_xf32 op) : mfma_f32_32x32x4_xf32GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x4_xf32Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x4_xf32::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x4_xf32::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x4_xf32::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x4_xf32::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x4_xf32::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x4_xf32::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x4_xf32::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x4_xf32::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x4_xf32::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x4_xf32::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x4_xf32::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x4_xf32::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x4_xf32::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x4_xf32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x4bf16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x4bf16GenericAdaptorBase::mfma_f32_32x32x4bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x4bf16", odsAttrs.getContext()); +} + +mfma_f32_32x32x4bf16GenericAdaptorBase::mfma_f32_32x32x4bf16GenericAdaptorBase(mfma_f32_32x32x4bf16 op) : mfma_f32_32x32x4bf16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x4bf16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x4bf16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x4bf16Adaptor::mfma_f32_32x32x4bf16Adaptor(mfma_f32_32x32x4bf16 op) : mfma_f32_32x32x4bf16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x4bf16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x4bf16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x4bf16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x4bf16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x4bf16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x4bf16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x4bf16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x4bf16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x4bf16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x4bf16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x4bf16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x4bf16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x4bf16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x4bf16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x4bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x4bf16_1k definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x4bf16_1kGenericAdaptorBase::mfma_f32_32x32x4bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x4bf16.1k", odsAttrs.getContext()); +} + +mfma_f32_32x32x4bf16_1kGenericAdaptorBase::mfma_f32_32x32x4bf16_1kGenericAdaptorBase(mfma_f32_32x32x4bf16_1k op) : mfma_f32_32x32x4bf16_1kGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x4bf16_1kGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x4bf16_1kGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x4bf16_1kAdaptor::mfma_f32_32x32x4bf16_1kAdaptor(mfma_f32_32x32x4bf16_1k op) : mfma_f32_32x32x4bf16_1kGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x4bf16_1kAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x4bf16_1k::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x4bf16_1k::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x4bf16_1k::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x4bf16_1k::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x4bf16_1k::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x4bf16_1k::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x4bf16_1k::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x4bf16_1k::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x4bf16_1k::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x4bf16_1k::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x4bf16_1k::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x4bf16_1k::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x4bf16_1k::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x4bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x4f16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x4f16GenericAdaptorBase::mfma_f32_32x32x4f16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x4f16", odsAttrs.getContext()); +} + +mfma_f32_32x32x4f16GenericAdaptorBase::mfma_f32_32x32x4f16GenericAdaptorBase(mfma_f32_32x32x4f16 op) : mfma_f32_32x32x4f16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x4f16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x4f16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x4f16Adaptor::mfma_f32_32x32x4f16Adaptor(mfma_f32_32x32x4f16 op) : mfma_f32_32x32x4f16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x4f16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x4f16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x4f16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x4f16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x4f16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x4f16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x4f16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x4f16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x4f16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x4f16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x4f16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x4f16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x4f16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x4f16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x4f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x8bf16_1k definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x8bf16_1kGenericAdaptorBase::mfma_f32_32x32x8bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x8bf16.1k", odsAttrs.getContext()); +} + +mfma_f32_32x32x8bf16_1kGenericAdaptorBase::mfma_f32_32x32x8bf16_1kGenericAdaptorBase(mfma_f32_32x32x8bf16_1k op) : mfma_f32_32x32x8bf16_1kGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x8bf16_1kGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x8bf16_1kGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x8bf16_1kAdaptor::mfma_f32_32x32x8bf16_1kAdaptor(mfma_f32_32x32x8bf16_1k op) : mfma_f32_32x32x8bf16_1kGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x8bf16_1kAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x8bf16_1k::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x8bf16_1k::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x8bf16_1k::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x8bf16_1k::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x8bf16_1k::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x8bf16_1k::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x8bf16_1k::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x8bf16_1k::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x8bf16_1k::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x8bf16_1k::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x8bf16_1k::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x8bf16_1k::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x8bf16_1k::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x8bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x8f16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_32x32x8f16GenericAdaptorBase::mfma_f32_32x32x8f16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.32x32x8f16", odsAttrs.getContext()); +} + +mfma_f32_32x32x8f16GenericAdaptorBase::mfma_f32_32x32x8f16GenericAdaptorBase(mfma_f32_32x32x8f16 op) : mfma_f32_32x32x8f16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_32x32x8f16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_32x32x8f16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_32x32x8f16Adaptor::mfma_f32_32x32x8f16Adaptor(mfma_f32_32x32x8f16 op) : mfma_f32_32x32x8f16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_32x32x8f16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_32x32x8f16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x8f16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_32x32x8f16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_32x32x8f16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_32x32x8f16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_32x32x8f16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_32x32x8f16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_32x32x8f16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_32x32x8f16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_32x32x8f16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_32x32x8f16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_32x32x8f16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_32x32x8f16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x8f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_4x4x1f32 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_4x4x1f32GenericAdaptorBase::mfma_f32_4x4x1f32GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.4x4x1f32", odsAttrs.getContext()); +} + +mfma_f32_4x4x1f32GenericAdaptorBase::mfma_f32_4x4x1f32GenericAdaptorBase(mfma_f32_4x4x1f32 op) : mfma_f32_4x4x1f32GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_4x4x1f32GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_4x4x1f32GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_4x4x1f32Adaptor::mfma_f32_4x4x1f32Adaptor(mfma_f32_4x4x1f32 op) : mfma_f32_4x4x1f32GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_4x4x1f32Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_4x4x1f32::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_4x4x1f32::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_4x4x1f32::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_4x4x1f32::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_4x4x1f32::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_4x4x1f32::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_4x4x1f32::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_4x4x1f32::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_4x4x1f32::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_4x4x1f32::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_4x4x1f32::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_4x4x1f32::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_4x4x1f32::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_4x4x1f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_4x4x2bf16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_4x4x2bf16GenericAdaptorBase::mfma_f32_4x4x2bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.4x4x2bf16", odsAttrs.getContext()); +} + +mfma_f32_4x4x2bf16GenericAdaptorBase::mfma_f32_4x4x2bf16GenericAdaptorBase(mfma_f32_4x4x2bf16 op) : mfma_f32_4x4x2bf16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_4x4x2bf16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_4x4x2bf16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_4x4x2bf16Adaptor::mfma_f32_4x4x2bf16Adaptor(mfma_f32_4x4x2bf16 op) : mfma_f32_4x4x2bf16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_4x4x2bf16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_4x4x2bf16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_4x4x2bf16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_4x4x2bf16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_4x4x2bf16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_4x4x2bf16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_4x4x2bf16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_4x4x2bf16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_4x4x2bf16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_4x4x2bf16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_4x4x2bf16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_4x4x2bf16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_4x4x2bf16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_4x4x2bf16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_4x4x2bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_4x4x4bf16_1k definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_4x4x4bf16_1kGenericAdaptorBase::mfma_f32_4x4x4bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.4x4x4bf16.1k", odsAttrs.getContext()); +} + +mfma_f32_4x4x4bf16_1kGenericAdaptorBase::mfma_f32_4x4x4bf16_1kGenericAdaptorBase(mfma_f32_4x4x4bf16_1k op) : mfma_f32_4x4x4bf16_1kGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_4x4x4bf16_1kGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_4x4x4bf16_1kGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_4x4x4bf16_1kAdaptor::mfma_f32_4x4x4bf16_1kAdaptor(mfma_f32_4x4x4bf16_1k op) : mfma_f32_4x4x4bf16_1kGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_4x4x4bf16_1kAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_4x4x4bf16_1k::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_4x4x4bf16_1k::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_4x4x4bf16_1k::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_4x4x4bf16_1k::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_4x4x4bf16_1k::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_4x4x4bf16_1k::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_4x4x4bf16_1k::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_4x4x4bf16_1k::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_4x4x4bf16_1k::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_4x4x4bf16_1k::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_4x4x4bf16_1k::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_4x4x4bf16_1k::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_4x4x4bf16_1k::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_4x4x4bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_4x4x4f16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f32_4x4x4f16GenericAdaptorBase::mfma_f32_4x4x4f16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f32.4x4x4f16", odsAttrs.getContext()); +} + +mfma_f32_4x4x4f16GenericAdaptorBase::mfma_f32_4x4x4f16GenericAdaptorBase(mfma_f32_4x4x4f16 op) : mfma_f32_4x4x4f16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f32_4x4x4f16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f32_4x4x4f16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f32_4x4x4f16Adaptor::mfma_f32_4x4x4f16Adaptor(mfma_f32_4x4x4f16 op) : mfma_f32_4x4x4f16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f32_4x4x4f16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f32_4x4x4f16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f32_4x4x4f16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f32_4x4x4f16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f32_4x4x4f16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f32_4x4x4f16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f32_4x4x4f16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f32_4x4x4f16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f32_4x4x4f16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f32_4x4x4f16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f32_4x4x4f16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f32_4x4x4f16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f32_4x4x4f16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f32_4x4x4f16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_4x4x4f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f64_16x16x4f64 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f64_16x16x4f64GenericAdaptorBase::mfma_f64_16x16x4f64GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f64.16x16x4f64", odsAttrs.getContext()); +} + +mfma_f64_16x16x4f64GenericAdaptorBase::mfma_f64_16x16x4f64GenericAdaptorBase(mfma_f64_16x16x4f64 op) : mfma_f64_16x16x4f64GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f64_16x16x4f64GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f64_16x16x4f64GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f64_16x16x4f64Adaptor::mfma_f64_16x16x4f64Adaptor(mfma_f64_16x16x4f64 op) : mfma_f64_16x16x4f64GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f64_16x16x4f64Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f64_16x16x4f64::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f64_16x16x4f64::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f64_16x16x4f64::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f64_16x16x4f64::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f64_16x16x4f64::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f64_16x16x4f64::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f64_16x16x4f64::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f64_16x16x4f64::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f64_16x16x4f64::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f64_16x16x4f64::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f64_16x16x4f64::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f64_16x16x4f64::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f64_16x16x4f64::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f64_16x16x4f64) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f64_4x4x4f64 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_f64_4x4x4f64GenericAdaptorBase::mfma_f64_4x4x4f64GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.f64.4x4x4f64", odsAttrs.getContext()); +} + +mfma_f64_4x4x4f64GenericAdaptorBase::mfma_f64_4x4x4f64GenericAdaptorBase(mfma_f64_4x4x4f64 op) : mfma_f64_4x4x4f64GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_f64_4x4x4f64GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_f64_4x4x4f64GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_f64_4x4x4f64Adaptor::mfma_f64_4x4x4f64Adaptor(mfma_f64_4x4x4f64 op) : mfma_f64_4x4x4f64GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_f64_4x4x4f64Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_f64_4x4x4f64::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_f64_4x4x4f64::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_f64_4x4x4f64::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_f64_4x4x4f64::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_f64_4x4x4f64::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_f64_4x4x4f64::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_f64_4x4x4f64::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_f64_4x4x4f64::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_f64_4x4x4f64::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_f64_4x4x4f64::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_f64_4x4x4f64::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_f64_4x4x4f64::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_f64_4x4x4f64::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f64_4x4x4f64) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_16x16x16i8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_i32_16x16x16i8GenericAdaptorBase::mfma_i32_16x16x16i8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.i32.16x16x16i8", odsAttrs.getContext()); +} + +mfma_i32_16x16x16i8GenericAdaptorBase::mfma_i32_16x16x16i8GenericAdaptorBase(mfma_i32_16x16x16i8 op) : mfma_i32_16x16x16i8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_i32_16x16x16i8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_i32_16x16x16i8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_i32_16x16x16i8Adaptor::mfma_i32_16x16x16i8Adaptor(mfma_i32_16x16x16i8 op) : mfma_i32_16x16x16i8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_i32_16x16x16i8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_i32_16x16x16i8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_i32_16x16x16i8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_i32_16x16x16i8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_i32_16x16x16i8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_i32_16x16x16i8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_i32_16x16x16i8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_i32_16x16x16i8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_i32_16x16x16i8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_i32_16x16x16i8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_i32_16x16x16i8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_i32_16x16x16i8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_i32_16x16x16i8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_i32_16x16x16i8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_16x16x16i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_16x16x32_i8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_i32_16x16x32_i8GenericAdaptorBase::mfma_i32_16x16x32_i8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.i32.16x16x32.i8", odsAttrs.getContext()); +} + +mfma_i32_16x16x32_i8GenericAdaptorBase::mfma_i32_16x16x32_i8GenericAdaptorBase(mfma_i32_16x16x32_i8 op) : mfma_i32_16x16x32_i8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_i32_16x16x32_i8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_i32_16x16x32_i8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_i32_16x16x32_i8Adaptor::mfma_i32_16x16x32_i8Adaptor(mfma_i32_16x16x32_i8 op) : mfma_i32_16x16x32_i8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_i32_16x16x32_i8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_i32_16x16x32_i8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_i32_16x16x32_i8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_i32_16x16x32_i8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_i32_16x16x32_i8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_i32_16x16x32_i8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_i32_16x16x32_i8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_i32_16x16x32_i8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_i32_16x16x32_i8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_i32_16x16x32_i8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_i32_16x16x32_i8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_i32_16x16x32_i8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_i32_16x16x32_i8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_i32_16x16x32_i8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_16x16x32_i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_16x16x4i8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_i32_16x16x4i8GenericAdaptorBase::mfma_i32_16x16x4i8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.i32.16x16x4i8", odsAttrs.getContext()); +} + +mfma_i32_16x16x4i8GenericAdaptorBase::mfma_i32_16x16x4i8GenericAdaptorBase(mfma_i32_16x16x4i8 op) : mfma_i32_16x16x4i8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_i32_16x16x4i8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_i32_16x16x4i8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_i32_16x16x4i8Adaptor::mfma_i32_16x16x4i8Adaptor(mfma_i32_16x16x4i8 op) : mfma_i32_16x16x4i8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_i32_16x16x4i8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_i32_16x16x4i8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_i32_16x16x4i8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_i32_16x16x4i8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_i32_16x16x4i8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_i32_16x16x4i8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_i32_16x16x4i8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_i32_16x16x4i8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_i32_16x16x4i8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_i32_16x16x4i8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_i32_16x16x4i8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_i32_16x16x4i8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_i32_16x16x4i8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_i32_16x16x4i8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_16x16x4i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_32x32x16_i8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_i32_32x32x16_i8GenericAdaptorBase::mfma_i32_32x32x16_i8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.i32.32x32x16.i8", odsAttrs.getContext()); +} + +mfma_i32_32x32x16_i8GenericAdaptorBase::mfma_i32_32x32x16_i8GenericAdaptorBase(mfma_i32_32x32x16_i8 op) : mfma_i32_32x32x16_i8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_i32_32x32x16_i8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_i32_32x32x16_i8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_i32_32x32x16_i8Adaptor::mfma_i32_32x32x16_i8Adaptor(mfma_i32_32x32x16_i8 op) : mfma_i32_32x32x16_i8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_i32_32x32x16_i8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_i32_32x32x16_i8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_i32_32x32x16_i8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_i32_32x32x16_i8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_i32_32x32x16_i8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_i32_32x32x16_i8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_i32_32x32x16_i8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_i32_32x32x16_i8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_i32_32x32x16_i8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_i32_32x32x16_i8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_i32_32x32x16_i8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_i32_32x32x16_i8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_i32_32x32x16_i8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_i32_32x32x16_i8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_32x32x16_i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_32x32x4i8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_i32_32x32x4i8GenericAdaptorBase::mfma_i32_32x32x4i8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.i32.32x32x4i8", odsAttrs.getContext()); +} + +mfma_i32_32x32x4i8GenericAdaptorBase::mfma_i32_32x32x4i8GenericAdaptorBase(mfma_i32_32x32x4i8 op) : mfma_i32_32x32x4i8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_i32_32x32x4i8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_i32_32x32x4i8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_i32_32x32x4i8Adaptor::mfma_i32_32x32x4i8Adaptor(mfma_i32_32x32x4i8 op) : mfma_i32_32x32x4i8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_i32_32x32x4i8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_i32_32x32x4i8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_i32_32x32x4i8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_i32_32x32x4i8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_i32_32x32x4i8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_i32_32x32x4i8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_i32_32x32x4i8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_i32_32x32x4i8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_i32_32x32x4i8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_i32_32x32x4i8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_i32_32x32x4i8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_i32_32x32x4i8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_i32_32x32x4i8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_i32_32x32x4i8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_32x32x4i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_32x32x8i8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_i32_32x32x8i8GenericAdaptorBase::mfma_i32_32x32x8i8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.i32.32x32x8i8", odsAttrs.getContext()); +} + +mfma_i32_32x32x8i8GenericAdaptorBase::mfma_i32_32x32x8i8GenericAdaptorBase(mfma_i32_32x32x8i8 op) : mfma_i32_32x32x8i8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_i32_32x32x8i8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_i32_32x32x8i8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_i32_32x32x8i8Adaptor::mfma_i32_32x32x8i8Adaptor(mfma_i32_32x32x8i8 op) : mfma_i32_32x32x8i8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_i32_32x32x8i8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_i32_32x32x8i8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_i32_32x32x8i8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_i32_32x32x8i8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_i32_32x32x8i8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_i32_32x32x8i8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_i32_32x32x8i8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_i32_32x32x8i8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_i32_32x32x8i8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_i32_32x32x8i8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_i32_32x32x8i8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_i32_32x32x8i8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_i32_32x32x8i8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_i32_32x32x8i8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_32x32x8i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_4x4x4i8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +mfma_i32_4x4x4i8GenericAdaptorBase::mfma_i32_4x4x4i8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.mfma.i32.4x4x4i8", odsAttrs.getContext()); +} + +mfma_i32_4x4x4i8GenericAdaptorBase::mfma_i32_4x4x4i8GenericAdaptorBase(mfma_i32_4x4x4i8 op) : mfma_i32_4x4x4i8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair mfma_i32_4x4x4i8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr mfma_i32_4x4x4i8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +mfma_i32_4x4x4i8Adaptor::mfma_i32_4x4x4i8Adaptor(mfma_i32_4x4x4i8 op) : mfma_i32_4x4x4i8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult mfma_i32_4x4x4i8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair mfma_i32_4x4x4i8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range mfma_i32_4x4x4i8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range mfma_i32_4x4x4i8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange mfma_i32_4x4x4i8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair mfma_i32_4x4x4i8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range mfma_i32_4x4x4i8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value mfma_i32_4x4x4i8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void mfma_i32_4x4x4i8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void mfma_i32_4x4x4i8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult mfma_i32_4x4x4i8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult mfma_i32_4x4x4i8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult mfma_i32_4x4x4i8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void mfma_i32_4x4x4i8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_4x4x4i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_bf16_16x16x16_bf16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +wmma_bf16_16x16x16_bf16GenericAdaptorBase::wmma_bf16_16x16x16_bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.wmma.bf16.16x16x16.bf16", odsAttrs.getContext()); +} + +wmma_bf16_16x16x16_bf16GenericAdaptorBase::wmma_bf16_16x16x16_bf16GenericAdaptorBase(wmma_bf16_16x16x16_bf16 op) : wmma_bf16_16x16x16_bf16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair wmma_bf16_16x16x16_bf16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr wmma_bf16_16x16x16_bf16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +wmma_bf16_16x16x16_bf16Adaptor::wmma_bf16_16x16x16_bf16Adaptor(wmma_bf16_16x16x16_bf16 op) : wmma_bf16_16x16x16_bf16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult wmma_bf16_16x16x16_bf16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair wmma_bf16_16x16x16_bf16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range wmma_bf16_16x16x16_bf16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range wmma_bf16_16x16x16_bf16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange wmma_bf16_16x16x16_bf16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair wmma_bf16_16x16x16_bf16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range wmma_bf16_16x16x16_bf16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value wmma_bf16_16x16x16_bf16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void wmma_bf16_16x16x16_bf16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void wmma_bf16_16x16x16_bf16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult wmma_bf16_16x16x16_bf16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult wmma_bf16_16x16x16_bf16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult wmma_bf16_16x16x16_bf16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void wmma_bf16_16x16x16_bf16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_bf16_16x16x16_bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_f16_16x16x16_f16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +wmma_f16_16x16x16_f16GenericAdaptorBase::wmma_f16_16x16x16_f16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.wmma.f16.16x16x16.f16", odsAttrs.getContext()); +} + +wmma_f16_16x16x16_f16GenericAdaptorBase::wmma_f16_16x16x16_f16GenericAdaptorBase(wmma_f16_16x16x16_f16 op) : wmma_f16_16x16x16_f16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair wmma_f16_16x16x16_f16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr wmma_f16_16x16x16_f16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +wmma_f16_16x16x16_f16Adaptor::wmma_f16_16x16x16_f16Adaptor(wmma_f16_16x16x16_f16 op) : wmma_f16_16x16x16_f16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult wmma_f16_16x16x16_f16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair wmma_f16_16x16x16_f16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range wmma_f16_16x16x16_f16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range wmma_f16_16x16x16_f16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange wmma_f16_16x16x16_f16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair wmma_f16_16x16x16_f16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range wmma_f16_16x16x16_f16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value wmma_f16_16x16x16_f16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void wmma_f16_16x16x16_f16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void wmma_f16_16x16x16_f16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult wmma_f16_16x16x16_f16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult wmma_f16_16x16x16_f16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult wmma_f16_16x16x16_f16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void wmma_f16_16x16x16_f16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_f16_16x16x16_f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_f32_16x16x16_bf16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +wmma_f32_16x16x16_bf16GenericAdaptorBase::wmma_f32_16x16x16_bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.wmma.f32.16x16x16.bf16", odsAttrs.getContext()); +} + +wmma_f32_16x16x16_bf16GenericAdaptorBase::wmma_f32_16x16x16_bf16GenericAdaptorBase(wmma_f32_16x16x16_bf16 op) : wmma_f32_16x16x16_bf16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair wmma_f32_16x16x16_bf16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr wmma_f32_16x16x16_bf16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +wmma_f32_16x16x16_bf16Adaptor::wmma_f32_16x16x16_bf16Adaptor(wmma_f32_16x16x16_bf16 op) : wmma_f32_16x16x16_bf16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult wmma_f32_16x16x16_bf16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair wmma_f32_16x16x16_bf16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range wmma_f32_16x16x16_bf16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range wmma_f32_16x16x16_bf16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange wmma_f32_16x16x16_bf16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair wmma_f32_16x16x16_bf16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range wmma_f32_16x16x16_bf16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value wmma_f32_16x16x16_bf16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void wmma_f32_16x16x16_bf16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void wmma_f32_16x16x16_bf16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult wmma_f32_16x16x16_bf16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult wmma_f32_16x16x16_bf16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult wmma_f32_16x16x16_bf16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void wmma_f32_16x16x16_bf16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_f32_16x16x16_bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_f32_16x16x16_f16 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +wmma_f32_16x16x16_f16GenericAdaptorBase::wmma_f32_16x16x16_f16GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.wmma.f32.16x16x16.f16", odsAttrs.getContext()); +} + +wmma_f32_16x16x16_f16GenericAdaptorBase::wmma_f32_16x16x16_f16GenericAdaptorBase(wmma_f32_16x16x16_f16 op) : wmma_f32_16x16x16_f16GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair wmma_f32_16x16x16_f16GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr wmma_f32_16x16x16_f16GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +wmma_f32_16x16x16_f16Adaptor::wmma_f32_16x16x16_f16Adaptor(wmma_f32_16x16x16_f16 op) : wmma_f32_16x16x16_f16GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult wmma_f32_16x16x16_f16Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair wmma_f32_16x16x16_f16::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range wmma_f32_16x16x16_f16::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range wmma_f32_16x16x16_f16::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange wmma_f32_16x16x16_f16::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair wmma_f32_16x16x16_f16::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range wmma_f32_16x16x16_f16::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value wmma_f32_16x16x16_f16::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void wmma_f32_16x16x16_f16::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void wmma_f32_16x16x16_f16::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult wmma_f32_16x16x16_f16::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult wmma_f32_16x16x16_f16::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult wmma_f32_16x16x16_f16::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void wmma_f32_16x16x16_f16::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_f32_16x16x16_f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_i32_16x16x16_iu4 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +wmma_i32_16x16x16_iu4GenericAdaptorBase::wmma_i32_16x16x16_iu4GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.wmma.i32.16x16x16.iu4", odsAttrs.getContext()); +} + +wmma_i32_16x16x16_iu4GenericAdaptorBase::wmma_i32_16x16x16_iu4GenericAdaptorBase(wmma_i32_16x16x16_iu4 op) : wmma_i32_16x16x16_iu4GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair wmma_i32_16x16x16_iu4GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr wmma_i32_16x16x16_iu4GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +wmma_i32_16x16x16_iu4Adaptor::wmma_i32_16x16x16_iu4Adaptor(wmma_i32_16x16x16_iu4 op) : wmma_i32_16x16x16_iu4GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult wmma_i32_16x16x16_iu4Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair wmma_i32_16x16x16_iu4::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range wmma_i32_16x16x16_iu4::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range wmma_i32_16x16x16_iu4::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange wmma_i32_16x16x16_iu4::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair wmma_i32_16x16x16_iu4::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range wmma_i32_16x16x16_iu4::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value wmma_i32_16x16x16_iu4::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void wmma_i32_16x16x16_iu4::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void wmma_i32_16x16x16_iu4::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult wmma_i32_16x16x16_iu4::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult wmma_i32_16x16x16_iu4::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult wmma_i32_16x16x16_iu4::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void wmma_i32_16x16x16_iu4::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_i32_16x16x16_iu4) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_i32_16x16x16_iu8 definitions +//===----------------------------------------------------------------------===// + +namespace detail { +wmma_i32_16x16x16_iu8GenericAdaptorBase::wmma_i32_16x16x16_iu8GenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("rocdl.wmma.i32.16x16x16.iu8", odsAttrs.getContext()); +} + +wmma_i32_16x16x16_iu8GenericAdaptorBase::wmma_i32_16x16x16_iu8GenericAdaptorBase(wmma_i32_16x16x16_iu8 op) : wmma_i32_16x16x16_iu8GenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair wmma_i32_16x16x16_iu8GenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr wmma_i32_16x16x16_iu8GenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +wmma_i32_16x16x16_iu8Adaptor::wmma_i32_16x16x16_iu8Adaptor(wmma_i32_16x16x16_iu8 op) : wmma_i32_16x16x16_iu8GenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult wmma_i32_16x16x16_iu8Adaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair wmma_i32_16x16x16_iu8::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range wmma_i32_16x16x16_iu8::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range wmma_i32_16x16x16_iu8::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange wmma_i32_16x16x16_iu8::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair wmma_i32_16x16x16_iu8::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range wmma_i32_16x16x16_iu8::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value wmma_i32_16x16x16_iu8::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void wmma_i32_16x16x16_iu8::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.addTypes(res); +} + +void wmma_i32_16x16x16_iu8::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult wmma_i32_16x16x16_iu8::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult wmma_i32_16x16x16_iu8::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult wmma_i32_16x16x16_iu8::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> argsTypes; + ::llvm::ArrayRef<::mlir::Type> resTypes; + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType args__res_functionType; + if (parser.parseType(args__res_functionType)) + return ::mlir::failure(); + argsTypes = args__res_functionType.getInputs(); + resTypes = args__res_functionType.getResults(); + result.addTypes(resTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void wmma_i32_16x16x16_iu8::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getArgs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getArgs().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getRes().getType())); +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_i32_16x16x16_iu8) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..5fe8435a67e2c81584dfe7f1d327b9759db8c61d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.h.inc @@ -0,0 +1,10057 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ROCDLOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace ROCDL { +class BarrierOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class BlockDimXOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class BlockDimYOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class BlockDimZOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class BlockIdXOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class BlockIdYOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class BlockIdZOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class CvtF32Bf8Op; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class CvtF32Fp8Op; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class CvtPkBf8F32Op; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class CvtPkFp8F32Op; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class CvtSrBf8F32Op; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class CvtSrFp8F32Op; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class DsBpermuteOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class DsSwizzleOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class GridDimXOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class GridDimYOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class GridDimZOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class MakeBufferRsrcOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class MbcntHiOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class MbcntLoOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class MubufLoadOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class MubufStoreOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawBufferAtomicCmpSwap; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawBufferAtomicFAddOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawBufferAtomicFMaxOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawBufferAtomicSMaxOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawBufferAtomicUMinOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawBufferLoadOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawBufferStoreOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawPtrBufferAtomicCmpSwap; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawPtrBufferAtomicFaddOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawPtrBufferAtomicFmaxOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawPtrBufferAtomicSmaxOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawPtrBufferAtomicUminOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawPtrBufferLoadOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class RawPtrBufferStoreOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class ThreadIdXOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class ThreadIdYOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class ThreadIdZOp; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x16bf16_1k; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x16f16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x1f32; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x2bf16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x32_bf8_bf8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x32_bf8_fp8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x32_fp8_bf8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x32_fp8_fp8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x4bf16_1k; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x4f16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x4f32; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x8_xf32; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_16x16x8bf16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x16_bf8_bf8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x16_bf8_fp8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x16_fp8_bf8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x16_fp8_fp8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x1f32; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x2bf16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x2f32; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x4_xf32; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x4bf16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x4bf16_1k; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x4f16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x8bf16_1k; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_32x32x8f16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_4x4x1f32; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_4x4x2bf16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_4x4x4bf16_1k; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f32_4x4x4f16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f64_16x16x4f64; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_f64_4x4x4f64; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_i32_16x16x16i8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_i32_16x16x32_i8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_i32_16x16x4i8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_i32_32x32x16_i8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_i32_32x32x4i8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_i32_32x32x8i8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class mfma_i32_4x4x4i8; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class wmma_bf16_16x16x16_bf16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class wmma_f16_16x16x16_f16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class wmma_f32_16x16x16_bf16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class wmma_f32_16x16x16_f16; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class wmma_i32_16x16x16_iu4; +} // namespace ROCDL +} // namespace mlir +namespace mlir { +namespace ROCDL { +class wmma_i32_16x16x16_iu8; +} // namespace ROCDL +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BarrierOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BarrierOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BarrierOpGenericAdaptorBase(BarrierOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BarrierOpGenericAdaptor : public detail::BarrierOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BarrierOpGenericAdaptorBase; +public: + BarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BarrierOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BarrierOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BarrierOpAdaptor : public BarrierOpGenericAdaptor<::mlir::ValueRange> { +public: + using BarrierOpGenericAdaptor::BarrierOpGenericAdaptor; + BarrierOpAdaptor(BarrierOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BarrierOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BarrierOpAdaptor; + template + using GenericAdaptor = BarrierOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.barrier"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BarrierOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockDimXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockDimXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockDimXOpGenericAdaptorBase(BlockDimXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockDimXOpGenericAdaptor : public detail::BlockDimXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockDimXOpGenericAdaptorBase; +public: + BlockDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockDimXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockDimXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockDimXOpAdaptor : public BlockDimXOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockDimXOpGenericAdaptor::BlockDimXOpGenericAdaptor; + BlockDimXOpAdaptor(BlockDimXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockDimXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockDimXOpAdaptor; + template + using GenericAdaptor = BlockDimXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.workgroup.dim.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockDimXOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockDimYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockDimYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockDimYOpGenericAdaptorBase(BlockDimYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockDimYOpGenericAdaptor : public detail::BlockDimYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockDimYOpGenericAdaptorBase; +public: + BlockDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockDimYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockDimYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockDimYOpAdaptor : public BlockDimYOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockDimYOpGenericAdaptor::BlockDimYOpGenericAdaptor; + BlockDimYOpAdaptor(BlockDimYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockDimYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockDimYOpAdaptor; + template + using GenericAdaptor = BlockDimYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.workgroup.dim.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockDimYOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockDimZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockDimZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockDimZOpGenericAdaptorBase(BlockDimZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockDimZOpGenericAdaptor : public detail::BlockDimZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockDimZOpGenericAdaptorBase; +public: + BlockDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockDimZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockDimZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockDimZOpAdaptor : public BlockDimZOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockDimZOpGenericAdaptor::BlockDimZOpGenericAdaptor; + BlockDimZOpAdaptor(BlockDimZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockDimZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockDimZOpAdaptor; + template + using GenericAdaptor = BlockDimZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.workgroup.dim.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockDimZOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockIdXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockIdXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockIdXOpGenericAdaptorBase(BlockIdXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockIdXOpGenericAdaptor : public detail::BlockIdXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockIdXOpGenericAdaptorBase; +public: + BlockIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockIdXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockIdXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockIdXOpAdaptor : public BlockIdXOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockIdXOpGenericAdaptor::BlockIdXOpGenericAdaptor; + BlockIdXOpAdaptor(BlockIdXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockIdXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockIdXOpAdaptor; + template + using GenericAdaptor = BlockIdXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.workgroup.id.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockIdXOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockIdYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockIdYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockIdYOpGenericAdaptorBase(BlockIdYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockIdYOpGenericAdaptor : public detail::BlockIdYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockIdYOpGenericAdaptorBase; +public: + BlockIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockIdYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockIdYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockIdYOpAdaptor : public BlockIdYOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockIdYOpGenericAdaptor::BlockIdYOpGenericAdaptor; + BlockIdYOpAdaptor(BlockIdYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockIdYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockIdYOpAdaptor; + template + using GenericAdaptor = BlockIdYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.workgroup.id.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockIdYOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::BlockIdZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BlockIdZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BlockIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BlockIdZOpGenericAdaptorBase(BlockIdZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BlockIdZOpGenericAdaptor : public detail::BlockIdZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BlockIdZOpGenericAdaptorBase; +public: + BlockIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BlockIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BlockIdZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BlockIdZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BlockIdZOpAdaptor : public BlockIdZOpGenericAdaptor<::mlir::ValueRange> { +public: + using BlockIdZOpGenericAdaptor::BlockIdZOpGenericAdaptor; + BlockIdZOpAdaptor(BlockIdZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BlockIdZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BlockIdZOpAdaptor; + template + using GenericAdaptor = BlockIdZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.workgroup.id.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::BlockIdZOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtF32Bf8Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CvtF32Bf8OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CvtF32Bf8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CvtF32Bf8OpGenericAdaptorBase(CvtF32Bf8Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CvtF32Bf8OpGenericAdaptor : public detail::CvtF32Bf8OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CvtF32Bf8OpGenericAdaptorBase; +public: + CvtF32Bf8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CvtF32Bf8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CvtF32Bf8OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CvtF32Bf8OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcA() { + return (*getODSOperands(0).begin()); + } + + ValueT getByteSel() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CvtF32Bf8OpAdaptor : public CvtF32Bf8OpGenericAdaptor<::mlir::ValueRange> { +public: + using CvtF32Bf8OpGenericAdaptor::CvtF32Bf8OpGenericAdaptor; + CvtF32Bf8OpAdaptor(CvtF32Bf8Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CvtF32Bf8Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CvtF32Bf8OpAdaptor; + template + using GenericAdaptor = CvtF32Bf8OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.cvt.f32.bf8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSrcA(); + ::mlir::TypedValue<::mlir::IntegerType> getByteSel(); + ::mlir::OpOperand &getSrcAMutable(); + ::mlir::OpOperand &getByteSelMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value byteSel); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value byteSel); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtF32Bf8Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtF32Fp8Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CvtF32Fp8OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CvtF32Fp8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CvtF32Fp8OpGenericAdaptorBase(CvtF32Fp8Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CvtF32Fp8OpGenericAdaptor : public detail::CvtF32Fp8OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CvtF32Fp8OpGenericAdaptorBase; +public: + CvtF32Fp8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CvtF32Fp8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CvtF32Fp8OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CvtF32Fp8OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcA() { + return (*getODSOperands(0).begin()); + } + + ValueT getByteSel() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CvtF32Fp8OpAdaptor : public CvtF32Fp8OpGenericAdaptor<::mlir::ValueRange> { +public: + using CvtF32Fp8OpGenericAdaptor::CvtF32Fp8OpGenericAdaptor; + CvtF32Fp8OpAdaptor(CvtF32Fp8Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CvtF32Fp8Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CvtF32Fp8OpAdaptor; + template + using GenericAdaptor = CvtF32Fp8OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.cvt.f32.fp8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSrcA(); + ::mlir::TypedValue<::mlir::IntegerType> getByteSel(); + ::mlir::OpOperand &getSrcAMutable(); + ::mlir::OpOperand &getByteSelMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value byteSel); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value byteSel); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtF32Fp8Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtPkBf8F32Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CvtPkBf8F32OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CvtPkBf8F32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CvtPkBf8F32OpGenericAdaptorBase(CvtPkBf8F32Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CvtPkBf8F32OpGenericAdaptor : public detail::CvtPkBf8F32OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CvtPkBf8F32OpGenericAdaptorBase; +public: + CvtPkBf8F32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CvtPkBf8F32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CvtPkBf8F32OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CvtPkBf8F32OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcA() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrcB() { + return (*getODSOperands(1).begin()); + } + + ValueT getOld() { + return (*getODSOperands(2).begin()); + } + + ValueT getWordSel() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CvtPkBf8F32OpAdaptor : public CvtPkBf8F32OpGenericAdaptor<::mlir::ValueRange> { +public: + using CvtPkBf8F32OpGenericAdaptor::CvtPkBf8F32OpGenericAdaptor; + CvtPkBf8F32OpAdaptor(CvtPkBf8F32Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CvtPkBf8F32Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CvtPkBf8F32OpAdaptor; + template + using GenericAdaptor = CvtPkBf8F32OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.cvt.pk.bf8.f32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSrcA(); + ::mlir::TypedValue<::mlir::FloatType> getSrcB(); + ::mlir::TypedValue<::mlir::IntegerType> getOld(); + ::mlir::TypedValue<::mlir::IntegerType> getWordSel(); + ::mlir::OpOperand &getSrcAMutable(); + ::mlir::OpOperand &getSrcBMutable(); + ::mlir::OpOperand &getOldMutable(); + ::mlir::OpOperand &getWordSelMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value wordSel); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value wordSel); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtPkBf8F32Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtPkFp8F32Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CvtPkFp8F32OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CvtPkFp8F32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CvtPkFp8F32OpGenericAdaptorBase(CvtPkFp8F32Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CvtPkFp8F32OpGenericAdaptor : public detail::CvtPkFp8F32OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CvtPkFp8F32OpGenericAdaptorBase; +public: + CvtPkFp8F32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CvtPkFp8F32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CvtPkFp8F32OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CvtPkFp8F32OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcA() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrcB() { + return (*getODSOperands(1).begin()); + } + + ValueT getOld() { + return (*getODSOperands(2).begin()); + } + + ValueT getWordSel() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CvtPkFp8F32OpAdaptor : public CvtPkFp8F32OpGenericAdaptor<::mlir::ValueRange> { +public: + using CvtPkFp8F32OpGenericAdaptor::CvtPkFp8F32OpGenericAdaptor; + CvtPkFp8F32OpAdaptor(CvtPkFp8F32Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CvtPkFp8F32Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CvtPkFp8F32OpAdaptor; + template + using GenericAdaptor = CvtPkFp8F32OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.cvt.pk.fp8.f32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSrcA(); + ::mlir::TypedValue<::mlir::FloatType> getSrcB(); + ::mlir::TypedValue<::mlir::IntegerType> getOld(); + ::mlir::TypedValue<::mlir::IntegerType> getWordSel(); + ::mlir::OpOperand &getSrcAMutable(); + ::mlir::OpOperand &getSrcBMutable(); + ::mlir::OpOperand &getOldMutable(); + ::mlir::OpOperand &getWordSelMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value wordSel); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value wordSel); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtPkFp8F32Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtSrBf8F32Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CvtSrBf8F32OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CvtSrBf8F32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CvtSrBf8F32OpGenericAdaptorBase(CvtSrBf8F32Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CvtSrBf8F32OpGenericAdaptor : public detail::CvtSrBf8F32OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CvtSrBf8F32OpGenericAdaptorBase; +public: + CvtSrBf8F32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CvtSrBf8F32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CvtSrBf8F32OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CvtSrBf8F32OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcA() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrcB() { + return (*getODSOperands(1).begin()); + } + + ValueT getOld() { + return (*getODSOperands(2).begin()); + } + + ValueT getByteSel() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CvtSrBf8F32OpAdaptor : public CvtSrBf8F32OpGenericAdaptor<::mlir::ValueRange> { +public: + using CvtSrBf8F32OpGenericAdaptor::CvtSrBf8F32OpGenericAdaptor; + CvtSrBf8F32OpAdaptor(CvtSrBf8F32Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CvtSrBf8F32Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CvtSrBf8F32OpAdaptor; + template + using GenericAdaptor = CvtSrBf8F32OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.cvt.sr.bf8.f32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSrcA(); + ::mlir::TypedValue<::mlir::IntegerType> getSrcB(); + ::mlir::TypedValue<::mlir::IntegerType> getOld(); + ::mlir::TypedValue<::mlir::IntegerType> getByteSel(); + ::mlir::OpOperand &getSrcAMutable(); + ::mlir::OpOperand &getSrcBMutable(); + ::mlir::OpOperand &getOldMutable(); + ::mlir::OpOperand &getByteSelMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value byteSel); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value byteSel); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtSrBf8F32Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::CvtSrFp8F32Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CvtSrFp8F32OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CvtSrFp8F32OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CvtSrFp8F32OpGenericAdaptorBase(CvtSrFp8F32Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CvtSrFp8F32OpGenericAdaptor : public detail::CvtSrFp8F32OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CvtSrFp8F32OpGenericAdaptorBase; +public: + CvtSrFp8F32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CvtSrFp8F32OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CvtSrFp8F32OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CvtSrFp8F32OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcA() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrcB() { + return (*getODSOperands(1).begin()); + } + + ValueT getOld() { + return (*getODSOperands(2).begin()); + } + + ValueT getByteSel() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CvtSrFp8F32OpAdaptor : public CvtSrFp8F32OpGenericAdaptor<::mlir::ValueRange> { +public: + using CvtSrFp8F32OpGenericAdaptor::CvtSrFp8F32OpGenericAdaptor; + CvtSrFp8F32OpAdaptor(CvtSrFp8F32Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CvtSrFp8F32Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CvtSrFp8F32OpAdaptor; + template + using GenericAdaptor = CvtSrFp8F32OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.cvt.sr.fp8.f32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getSrcA(); + ::mlir::TypedValue<::mlir::IntegerType> getSrcB(); + ::mlir::TypedValue<::mlir::IntegerType> getOld(); + ::mlir::TypedValue<::mlir::IntegerType> getByteSel(); + ::mlir::OpOperand &getSrcAMutable(); + ::mlir::OpOperand &getSrcBMutable(); + ::mlir::OpOperand &getOldMutable(); + ::mlir::OpOperand &getByteSelMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value byteSel); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcA, ::mlir::Value srcB, ::mlir::Value old, ::mlir::Value byteSel); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::CvtSrFp8F32Op) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::DsBpermuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DsBpermuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DsBpermuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DsBpermuteOpGenericAdaptorBase(DsBpermuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DsBpermuteOpGenericAdaptor : public detail::DsBpermuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DsBpermuteOpGenericAdaptorBase; +public: + DsBpermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DsBpermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DsBpermuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DsBpermuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndex() { + return (*getODSOperands(0).begin()); + } + + ValueT getSrc() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DsBpermuteOpAdaptor : public DsBpermuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using DsBpermuteOpGenericAdaptor::DsBpermuteOpGenericAdaptor; + DsBpermuteOpAdaptor(DsBpermuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DsBpermuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = DsBpermuteOpAdaptor; + template + using GenericAdaptor = DsBpermuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.ds_bpermute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIndex(); + ::mlir::TypedValue<::mlir::IntegerType> getSrc(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::OpOperand &getSrcMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value index, ::mlir::Value src); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value index, ::mlir::Value src); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::DsBpermuteOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::DsSwizzleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DsSwizzleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DsSwizzleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DsSwizzleOpGenericAdaptorBase(DsSwizzleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DsSwizzleOpGenericAdaptor : public detail::DsSwizzleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DsSwizzleOpGenericAdaptorBase; +public: + DsSwizzleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DsSwizzleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DsSwizzleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DsSwizzleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DsSwizzleOpAdaptor : public DsSwizzleOpGenericAdaptor<::mlir::ValueRange> { +public: + using DsSwizzleOpGenericAdaptor::DsSwizzleOpGenericAdaptor; + DsSwizzleOpAdaptor(DsSwizzleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DsSwizzleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = DsSwizzleOpAdaptor; + template + using GenericAdaptor = DsSwizzleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.ds_swizzle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getSrc(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value offset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value offset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::DsSwizzleOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::GridDimXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridDimXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GridDimXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GridDimXOpGenericAdaptorBase(GridDimXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GridDimXOpGenericAdaptor : public detail::GridDimXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridDimXOpGenericAdaptorBase; +public: + GridDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridDimXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridDimXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GridDimXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridDimXOpAdaptor : public GridDimXOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridDimXOpGenericAdaptor::GridDimXOpGenericAdaptor; + GridDimXOpAdaptor(GridDimXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridDimXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridDimXOpAdaptor; + template + using GenericAdaptor = GridDimXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.grid.dim.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::GridDimXOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::GridDimYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridDimYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GridDimYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GridDimYOpGenericAdaptorBase(GridDimYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GridDimYOpGenericAdaptor : public detail::GridDimYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridDimYOpGenericAdaptorBase; +public: + GridDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridDimYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridDimYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GridDimYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridDimYOpAdaptor : public GridDimYOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridDimYOpGenericAdaptor::GridDimYOpGenericAdaptor; + GridDimYOpAdaptor(GridDimYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridDimYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridDimYOpAdaptor; + template + using GenericAdaptor = GridDimYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.grid.dim.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::GridDimYOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::GridDimZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GridDimZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GridDimZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GridDimZOpGenericAdaptorBase(GridDimZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GridDimZOpGenericAdaptor : public detail::GridDimZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GridDimZOpGenericAdaptorBase; +public: + GridDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GridDimZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GridDimZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GridDimZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GridDimZOpAdaptor : public GridDimZOpGenericAdaptor<::mlir::ValueRange> { +public: + using GridDimZOpGenericAdaptor::GridDimZOpGenericAdaptor; + GridDimZOpAdaptor(GridDimZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GridDimZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GridDimZOpAdaptor; + template + using GenericAdaptor = GridDimZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.grid.dim.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::GridDimZOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MakeBufferRsrcOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MakeBufferRsrcOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MakeBufferRsrcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MakeBufferRsrcOpGenericAdaptorBase(MakeBufferRsrcOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MakeBufferRsrcOpGenericAdaptor : public detail::MakeBufferRsrcOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MakeBufferRsrcOpGenericAdaptorBase; +public: + MakeBufferRsrcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MakeBufferRsrcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MakeBufferRsrcOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MakeBufferRsrcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBase() { + return (*getODSOperands(0).begin()); + } + + ValueT getStride() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumRecords() { + return (*getODSOperands(2).begin()); + } + + ValueT getFlags() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MakeBufferRsrcOpAdaptor : public MakeBufferRsrcOpGenericAdaptor<::mlir::ValueRange> { +public: + using MakeBufferRsrcOpGenericAdaptor::MakeBufferRsrcOpGenericAdaptor; + MakeBufferRsrcOpAdaptor(MakeBufferRsrcOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MakeBufferRsrcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MakeBufferRsrcOpAdaptor; + template + using GenericAdaptor = MakeBufferRsrcOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.make.buffer.rsrc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getBase(); + ::mlir::TypedValue<::mlir::IntegerType> getStride(); + ::mlir::TypedValue<::mlir::IntegerType> getNumRecords(); + ::mlir::TypedValue<::mlir::IntegerType> getFlags(); + ::mlir::OpOperand &getBaseMutable(); + ::mlir::OpOperand &getStrideMutable(); + ::mlir::OpOperand &getNumRecordsMutable(); + ::mlir::OpOperand &getFlagsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value base, ::mlir::Value stride, ::mlir::Value numRecords, ::mlir::Value flags); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value stride, ::mlir::Value numRecords, ::mlir::Value flags); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MakeBufferRsrcOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MbcntHiOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MbcntHiOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MbcntHiOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MbcntHiOpGenericAdaptorBase(MbcntHiOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MbcntHiOpGenericAdaptor : public detail::MbcntHiOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MbcntHiOpGenericAdaptorBase; +public: + MbcntHiOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MbcntHiOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MbcntHiOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MbcntHiOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn0() { + return (*getODSOperands(0).begin()); + } + + ValueT getIn1() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MbcntHiOpAdaptor : public MbcntHiOpGenericAdaptor<::mlir::ValueRange> { +public: + using MbcntHiOpGenericAdaptor::MbcntHiOpGenericAdaptor; + MbcntHiOpAdaptor(MbcntHiOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MbcntHiOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MbcntHiOpAdaptor; + template + using GenericAdaptor = MbcntHiOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mbcnt.hi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIn0(); + ::mlir::TypedValue<::mlir::IntegerType> getIn1(); + ::mlir::OpOperand &getIn0Mutable(); + ::mlir::OpOperand &getIn1Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in0, ::mlir::Value in1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in0, ::mlir::Value in1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MbcntHiOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MbcntLoOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MbcntLoOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MbcntLoOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MbcntLoOpGenericAdaptorBase(MbcntLoOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MbcntLoOpGenericAdaptor : public detail::MbcntLoOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MbcntLoOpGenericAdaptorBase; +public: + MbcntLoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MbcntLoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MbcntLoOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MbcntLoOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn0() { + return (*getODSOperands(0).begin()); + } + + ValueT getIn1() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MbcntLoOpAdaptor : public MbcntLoOpGenericAdaptor<::mlir::ValueRange> { +public: + using MbcntLoOpGenericAdaptor::MbcntLoOpGenericAdaptor; + MbcntLoOpAdaptor(MbcntLoOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MbcntLoOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MbcntLoOpAdaptor; + template + using GenericAdaptor = MbcntLoOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mbcnt.lo"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIn0(); + ::mlir::TypedValue<::mlir::IntegerType> getIn1(); + ::mlir::OpOperand &getIn0Mutable(); + ::mlir::OpOperand &getIn1Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value in0, ::mlir::Value in1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in0, ::mlir::Value in1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MbcntLoOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MubufLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MubufLoadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MubufLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MubufLoadOpGenericAdaptorBase(MubufLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MubufLoadOpGenericAdaptor : public detail::MubufLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MubufLoadOpGenericAdaptorBase; +public: + MubufLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MubufLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MubufLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MubufLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRsrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getVindex() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getGlc() { + return (*getODSOperands(3).begin()); + } + + ValueT getSlc() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MubufLoadOpAdaptor : public MubufLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using MubufLoadOpGenericAdaptor::MubufLoadOpGenericAdaptor; + MubufLoadOpAdaptor(MubufLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MubufLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MubufLoadOpAdaptor; + template + using GenericAdaptor = MubufLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.buffer.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getRsrc(); + ::mlir::Value getVindex(); + ::mlir::Value getOffset(); + ::mlir::Value getGlc(); + ::mlir::Value getSlc(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getVindexMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getGlcMutable(); + ::mlir::OpOperand &getSlcMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value rsrc, ::mlir::Value vindex, ::mlir::Value offset, ::mlir::Value glc, ::mlir::Value slc); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value rsrc, ::mlir::Value vindex, ::mlir::Value offset, ::mlir::Value glc, ::mlir::Value slc); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MubufLoadOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::MubufStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MubufStoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MubufStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MubufStoreOpGenericAdaptorBase(MubufStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MubufStoreOpGenericAdaptor : public detail::MubufStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MubufStoreOpGenericAdaptorBase; +public: + MubufStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MubufStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MubufStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MubufStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getVindex() { + return (*getODSOperands(2).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getGlc() { + return (*getODSOperands(4).begin()); + } + + ValueT getSlc() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MubufStoreOpAdaptor : public MubufStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using MubufStoreOpGenericAdaptor::MubufStoreOpGenericAdaptor; + MubufStoreOpAdaptor(MubufStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MubufStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MubufStoreOpAdaptor; + template + using GenericAdaptor = MubufStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.buffer.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::Value getRsrc(); + ::mlir::Value getVindex(); + ::mlir::Value getOffset(); + ::mlir::Value getGlc(); + ::mlir::Value getSlc(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getVindexMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getGlcMutable(); + ::mlir::OpOperand &getSlcMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value vindex, ::mlir::Value offset, ::mlir::Value glc, ::mlir::Value slc); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value vindex, ::mlir::Value offset, ::mlir::Value glc, ::mlir::Value slc); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::MubufStoreOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicCmpSwap declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicCmpSwapGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicCmpSwapGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicCmpSwapGenericAdaptorBase(RawBufferAtomicCmpSwap op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RawBufferAtomicCmpSwapGenericAdaptor : public detail::RawBufferAtomicCmpSwapGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicCmpSwapGenericAdaptorBase; +public: + RawBufferAtomicCmpSwapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicCmpSwapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicCmpSwapGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RawBufferAtomicCmpSwapGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getCmp() { + return (*getODSOperands(1).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(2).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(4).begin()); + } + + ValueT getAux() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicCmpSwapAdaptor : public RawBufferAtomicCmpSwapGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicCmpSwapGenericAdaptor::RawBufferAtomicCmpSwapGenericAdaptor; + RawBufferAtomicCmpSwapAdaptor(RawBufferAtomicCmpSwap op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicCmpSwap : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicCmpSwapAdaptor; + template + using GenericAdaptor = RawBufferAtomicCmpSwapGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.buffer.atomic.cmpswap"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getCmp(); + ::mlir::Value getRsrc(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getSoffset(); + ::mlir::TypedValue<::mlir::IntegerType> getAux(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getCmpMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicCmpSwap) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicFAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicFAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicFAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicFAddOpGenericAdaptorBase(RawBufferAtomicFAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RawBufferAtomicFAddOpGenericAdaptor : public detail::RawBufferAtomicFAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicFAddOpGenericAdaptorBase; +public: + RawBufferAtomicFAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicFAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicFAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RawBufferAtomicFAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicFAddOpAdaptor : public RawBufferAtomicFAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicFAddOpGenericAdaptor::RawBufferAtomicFAddOpGenericAdaptor; + RawBufferAtomicFAddOpAdaptor(RawBufferAtomicFAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicFAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicFAddOpAdaptor; + template + using GenericAdaptor = RawBufferAtomicFAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.buffer.atomic.fadd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::Value getRsrc(); + ::mlir::Value getOffset(); + ::mlir::Value getSoffset(); + ::mlir::Value getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicFAddOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicFMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicFMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicFMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicFMaxOpGenericAdaptorBase(RawBufferAtomicFMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RawBufferAtomicFMaxOpGenericAdaptor : public detail::RawBufferAtomicFMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicFMaxOpGenericAdaptorBase; +public: + RawBufferAtomicFMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicFMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicFMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RawBufferAtomicFMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicFMaxOpAdaptor : public RawBufferAtomicFMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicFMaxOpGenericAdaptor::RawBufferAtomicFMaxOpGenericAdaptor; + RawBufferAtomicFMaxOpAdaptor(RawBufferAtomicFMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicFMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicFMaxOpAdaptor; + template + using GenericAdaptor = RawBufferAtomicFMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.buffer.atomic.fmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::Value getRsrc(); + ::mlir::Value getOffset(); + ::mlir::Value getSoffset(); + ::mlir::Value getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicFMaxOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicSMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicSMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicSMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicSMaxOpGenericAdaptorBase(RawBufferAtomicSMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RawBufferAtomicSMaxOpGenericAdaptor : public detail::RawBufferAtomicSMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicSMaxOpGenericAdaptorBase; +public: + RawBufferAtomicSMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicSMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicSMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RawBufferAtomicSMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicSMaxOpAdaptor : public RawBufferAtomicSMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicSMaxOpGenericAdaptor::RawBufferAtomicSMaxOpGenericAdaptor; + RawBufferAtomicSMaxOpAdaptor(RawBufferAtomicSMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicSMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicSMaxOpAdaptor; + template + using GenericAdaptor = RawBufferAtomicSMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.buffer.atomic.smax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::Value getRsrc(); + ::mlir::Value getOffset(); + ::mlir::Value getSoffset(); + ::mlir::Value getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicSMaxOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferAtomicUMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferAtomicUMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RawBufferAtomicUMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferAtomicUMinOpGenericAdaptorBase(RawBufferAtomicUMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RawBufferAtomicUMinOpGenericAdaptor : public detail::RawBufferAtomicUMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferAtomicUMinOpGenericAdaptorBase; +public: + RawBufferAtomicUMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferAtomicUMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferAtomicUMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RawBufferAtomicUMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferAtomicUMinOpAdaptor : public RawBufferAtomicUMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferAtomicUMinOpGenericAdaptor::RawBufferAtomicUMinOpGenericAdaptor; + RawBufferAtomicUMinOpAdaptor(RawBufferAtomicUMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferAtomicUMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferAtomicUMinOpAdaptor; + template + using GenericAdaptor = RawBufferAtomicUMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.buffer.atomic.umin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::Value getRsrc(); + ::mlir::Value getOffset(); + ::mlir::Value getSoffset(); + ::mlir::Value getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferAtomicUMinOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferLoadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RawBufferLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferLoadOpGenericAdaptorBase(RawBufferLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RawBufferLoadOpGenericAdaptor : public detail::RawBufferLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferLoadOpGenericAdaptorBase; +public: + RawBufferLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RawBufferLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRsrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(1).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getAux() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferLoadOpAdaptor : public RawBufferLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferLoadOpGenericAdaptor::RawBufferLoadOpGenericAdaptor; + RawBufferLoadOpAdaptor(RawBufferLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferLoadOpAdaptor; + template + using GenericAdaptor = RawBufferLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.buffer.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getRsrc(); + ::mlir::Value getOffset(); + ::mlir::Value getSoffset(); + ::mlir::Value getAux(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferLoadOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawBufferStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawBufferStoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RawBufferStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RawBufferStoreOpGenericAdaptorBase(RawBufferStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RawBufferStoreOpGenericAdaptor : public detail::RawBufferStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawBufferStoreOpGenericAdaptorBase; +public: + RawBufferStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawBufferStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawBufferStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RawBufferStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawBufferStoreOpAdaptor : public RawBufferStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawBufferStoreOpGenericAdaptor::RawBufferStoreOpGenericAdaptor; + RawBufferStoreOpAdaptor(RawBufferStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawBufferStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawBufferStoreOpAdaptor; + template + using GenericAdaptor = RawBufferStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.buffer.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::Value getRsrc(); + ::mlir::Value getOffset(); + ::mlir::Value getSoffset(); + ::mlir::Value getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawBufferStoreOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicCmpSwap declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawPtrBufferAtomicCmpSwapGenericAdaptorBase { +public: + struct Properties { + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alias_scopes == this->alias_scopes && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawPtrBufferAtomicCmpSwapGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawPtrBufferAtomicCmpSwapGenericAdaptorBase(RawPtrBufferAtomicCmpSwap op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class RawPtrBufferAtomicCmpSwapGenericAdaptor : public detail::RawPtrBufferAtomicCmpSwapGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawPtrBufferAtomicCmpSwapGenericAdaptorBase; +public: + RawPtrBufferAtomicCmpSwapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawPtrBufferAtomicCmpSwapGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawPtrBufferAtomicCmpSwapGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawPtrBufferAtomicCmpSwapGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getCmp() { + return (*getODSOperands(1).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(2).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(4).begin()); + } + + ValueT getAux() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawPtrBufferAtomicCmpSwapAdaptor : public RawPtrBufferAtomicCmpSwapGenericAdaptor<::mlir::ValueRange> { +public: + using RawPtrBufferAtomicCmpSwapGenericAdaptor::RawPtrBufferAtomicCmpSwapGenericAdaptor; + RawPtrBufferAtomicCmpSwapAdaptor(RawPtrBufferAtomicCmpSwap op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawPtrBufferAtomicCmpSwap : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawPtrBufferAtomicCmpSwapAdaptor; + template + using GenericAdaptor = RawPtrBufferAtomicCmpSwapGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alias_scopes"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.ptr.buffer.atomic.cmpswap"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSrc(); + ::mlir::Value getCmp(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRsrc(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getSoffset(); + ::mlir::TypedValue<::mlir::IntegerType> getAux(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::OpOperand &getCmpMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicCmpSwap) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicFaddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawPtrBufferAtomicFaddOpGenericAdaptorBase { +public: + struct Properties { + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alias_scopes == this->alias_scopes && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawPtrBufferAtomicFaddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawPtrBufferAtomicFaddOpGenericAdaptorBase(RawPtrBufferAtomicFaddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class RawPtrBufferAtomicFaddOpGenericAdaptor : public detail::RawPtrBufferAtomicFaddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawPtrBufferAtomicFaddOpGenericAdaptorBase; +public: + RawPtrBufferAtomicFaddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawPtrBufferAtomicFaddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawPtrBufferAtomicFaddOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawPtrBufferAtomicFaddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawPtrBufferAtomicFaddOpAdaptor : public RawPtrBufferAtomicFaddOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawPtrBufferAtomicFaddOpGenericAdaptor::RawPtrBufferAtomicFaddOpGenericAdaptor; + RawPtrBufferAtomicFaddOpAdaptor(RawPtrBufferAtomicFaddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawPtrBufferAtomicFaddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawPtrBufferAtomicFaddOpAdaptor; + template + using GenericAdaptor = RawPtrBufferAtomicFaddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alias_scopes"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.ptr.buffer.atomic.fadd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRsrc(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getSoffset(); + ::mlir::TypedValue<::mlir::IntegerType> getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicFaddOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicFmaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawPtrBufferAtomicFmaxOpGenericAdaptorBase { +public: + struct Properties { + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alias_scopes == this->alias_scopes && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawPtrBufferAtomicFmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawPtrBufferAtomicFmaxOpGenericAdaptorBase(RawPtrBufferAtomicFmaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class RawPtrBufferAtomicFmaxOpGenericAdaptor : public detail::RawPtrBufferAtomicFmaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawPtrBufferAtomicFmaxOpGenericAdaptorBase; +public: + RawPtrBufferAtomicFmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawPtrBufferAtomicFmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawPtrBufferAtomicFmaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawPtrBufferAtomicFmaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawPtrBufferAtomicFmaxOpAdaptor : public RawPtrBufferAtomicFmaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawPtrBufferAtomicFmaxOpGenericAdaptor::RawPtrBufferAtomicFmaxOpGenericAdaptor; + RawPtrBufferAtomicFmaxOpAdaptor(RawPtrBufferAtomicFmaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawPtrBufferAtomicFmaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawPtrBufferAtomicFmaxOpAdaptor; + template + using GenericAdaptor = RawPtrBufferAtomicFmaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alias_scopes"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.ptr.buffer.atomic.fmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRsrc(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getSoffset(); + ::mlir::TypedValue<::mlir::IntegerType> getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicFmaxOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicSmaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawPtrBufferAtomicSmaxOpGenericAdaptorBase { +public: + struct Properties { + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alias_scopes == this->alias_scopes && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawPtrBufferAtomicSmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawPtrBufferAtomicSmaxOpGenericAdaptorBase(RawPtrBufferAtomicSmaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class RawPtrBufferAtomicSmaxOpGenericAdaptor : public detail::RawPtrBufferAtomicSmaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawPtrBufferAtomicSmaxOpGenericAdaptorBase; +public: + RawPtrBufferAtomicSmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawPtrBufferAtomicSmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawPtrBufferAtomicSmaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawPtrBufferAtomicSmaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawPtrBufferAtomicSmaxOpAdaptor : public RawPtrBufferAtomicSmaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawPtrBufferAtomicSmaxOpGenericAdaptor::RawPtrBufferAtomicSmaxOpGenericAdaptor; + RawPtrBufferAtomicSmaxOpAdaptor(RawPtrBufferAtomicSmaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawPtrBufferAtomicSmaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawPtrBufferAtomicSmaxOpAdaptor; + template + using GenericAdaptor = RawPtrBufferAtomicSmaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alias_scopes"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.ptr.buffer.atomic.smax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRsrc(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getSoffset(); + ::mlir::TypedValue<::mlir::IntegerType> getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicSmaxOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferAtomicUminOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawPtrBufferAtomicUminOpGenericAdaptorBase { +public: + struct Properties { + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alias_scopes == this->alias_scopes && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawPtrBufferAtomicUminOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawPtrBufferAtomicUminOpGenericAdaptorBase(RawPtrBufferAtomicUminOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class RawPtrBufferAtomicUminOpGenericAdaptor : public detail::RawPtrBufferAtomicUminOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawPtrBufferAtomicUminOpGenericAdaptorBase; +public: + RawPtrBufferAtomicUminOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawPtrBufferAtomicUminOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawPtrBufferAtomicUminOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawPtrBufferAtomicUminOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawPtrBufferAtomicUminOpAdaptor : public RawPtrBufferAtomicUminOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawPtrBufferAtomicUminOpGenericAdaptor::RawPtrBufferAtomicUminOpGenericAdaptor; + RawPtrBufferAtomicUminOpAdaptor(RawPtrBufferAtomicUminOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawPtrBufferAtomicUminOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawPtrBufferAtomicUminOpAdaptor; + template + using GenericAdaptor = RawPtrBufferAtomicUminOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alias_scopes"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.ptr.buffer.atomic.umin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRsrc(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getSoffset(); + ::mlir::TypedValue<::mlir::IntegerType> getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferAtomicUminOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawPtrBufferLoadOpGenericAdaptorBase { +public: + struct Properties { + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alias_scopes == this->alias_scopes && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawPtrBufferLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawPtrBufferLoadOpGenericAdaptorBase(RawPtrBufferLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class RawPtrBufferLoadOpGenericAdaptor : public detail::RawPtrBufferLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawPtrBufferLoadOpGenericAdaptorBase; +public: + RawPtrBufferLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawPtrBufferLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawPtrBufferLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawPtrBufferLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRsrc() { + return (*getODSOperands(0).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(1).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getAux() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawPtrBufferLoadOpAdaptor : public RawPtrBufferLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawPtrBufferLoadOpGenericAdaptor::RawPtrBufferLoadOpGenericAdaptor; + RawPtrBufferLoadOpAdaptor(RawPtrBufferLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawPtrBufferLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawPtrBufferLoadOpAdaptor; + template + using GenericAdaptor = RawPtrBufferLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alias_scopes"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.ptr.buffer.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRsrc(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getSoffset(); + ::mlir::TypedValue<::mlir::IntegerType> getAux(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferLoadOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::RawPtrBufferStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RawPtrBufferStoreOpGenericAdaptorBase { +public: + struct Properties { + using alias_scopesTy = ::mlir::ArrayAttr; + alias_scopesTy alias_scopes; + + auto getAliasScopes() { + auto &propStorage = this->alias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAliasScopes(const ::mlir::ArrayAttr &propValue) { + this->alias_scopes = propValue; + } + using noalias_scopesTy = ::mlir::ArrayAttr; + noalias_scopesTy noalias_scopes; + + auto getNoaliasScopes() { + auto &propStorage = this->noalias_scopes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setNoaliasScopes(const ::mlir::ArrayAttr &propValue) { + this->noalias_scopes = propValue; + } + using tbaaTy = ::mlir::ArrayAttr; + tbaaTy tbaa; + + auto getTbaa() { + auto &propStorage = this->tbaa; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTbaa(const ::mlir::ArrayAttr &propValue) { + this->tbaa = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alias_scopes == this->alias_scopes && + rhs.noalias_scopes == this->noalias_scopes && + rhs.tbaa == this->tbaa && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RawPtrBufferStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RawPtrBufferStoreOpGenericAdaptorBase(RawPtrBufferStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); +}; +} // namespace detail +template +class RawPtrBufferStoreOpGenericAdaptor : public detail::RawPtrBufferStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RawPtrBufferStoreOpGenericAdaptorBase; +public: + RawPtrBufferStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RawPtrBufferStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RawPtrBufferStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RawPtrBufferStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVdata() { + return (*getODSOperands(0).begin()); + } + + ValueT getRsrc() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getSoffset() { + return (*getODSOperands(3).begin()); + } + + ValueT getAux() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RawPtrBufferStoreOpAdaptor : public RawPtrBufferStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using RawPtrBufferStoreOpGenericAdaptor::RawPtrBufferStoreOpGenericAdaptor; + RawPtrBufferStoreOpAdaptor(RawPtrBufferStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RawPtrBufferStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::LLVM::AliasAnalysisOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RawPtrBufferStoreOpAdaptor; + template + using GenericAdaptor = RawPtrBufferStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alias_scopes"), ::llvm::StringRef("noalias_scopes"), ::llvm::StringRef("tbaa")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAliasScopesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNoaliasScopesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNoaliasScopesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTbaaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTbaaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.raw.ptr.buffer.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getVdata(); + ::mlir::TypedValue<::mlir::LLVM::LLVMPointerType> getRsrc(); + ::mlir::TypedValue<::mlir::IntegerType> getOffset(); + ::mlir::TypedValue<::mlir::IntegerType> getSoffset(); + ::mlir::TypedValue<::mlir::IntegerType> getAux(); + ::mlir::OpOperand &getVdataMutable(); + ::mlir::OpOperand &getRsrcMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getSoffsetMutable(); + ::mlir::OpOperand &getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getAliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAliasScopes(); + ::mlir::ArrayAttr getNoaliasScopesAttr(); + ::std::optional< ::mlir::ArrayAttr > getNoaliasScopes(); + ::mlir::ArrayAttr getTbaaAttr(); + ::std::optional< ::mlir::ArrayAttr > getTbaa(); + void setAliasScopesAttr(::mlir::ArrayAttr attr); + void setNoaliasScopesAttr(::mlir::ArrayAttr attr); + void setTbaaAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAliasScopesAttr(); + ::mlir::Attribute removeNoaliasScopesAttr(); + ::mlir::Attribute removeTbaaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value vdata, ::mlir::Value rsrc, ::mlir::Value offset, ::mlir::Value soffset, ::mlir::Value aux, /*optional*/::mlir::ArrayAttr alias_scopes, /*optional*/::mlir::ArrayAttr noalias_scopes, /*optional*/::mlir::ArrayAttr tbaa); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::llvm::SmallVector<::mlir::Value> getAccessedOperands(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::RawPtrBufferStoreOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::ThreadIdXOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ThreadIdXOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ThreadIdXOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ThreadIdXOpGenericAdaptorBase(ThreadIdXOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ThreadIdXOpGenericAdaptor : public detail::ThreadIdXOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ThreadIdXOpGenericAdaptorBase; +public: + ThreadIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ThreadIdXOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ThreadIdXOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ThreadIdXOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ThreadIdXOpAdaptor : public ThreadIdXOpGenericAdaptor<::mlir::ValueRange> { +public: + using ThreadIdXOpGenericAdaptor::ThreadIdXOpGenericAdaptor; + ThreadIdXOpAdaptor(ThreadIdXOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ThreadIdXOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ThreadIdXOpAdaptor; + template + using GenericAdaptor = ThreadIdXOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.workitem.id.x"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ThreadIdXOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::ThreadIdYOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ThreadIdYOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ThreadIdYOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ThreadIdYOpGenericAdaptorBase(ThreadIdYOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ThreadIdYOpGenericAdaptor : public detail::ThreadIdYOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ThreadIdYOpGenericAdaptorBase; +public: + ThreadIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ThreadIdYOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ThreadIdYOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ThreadIdYOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ThreadIdYOpAdaptor : public ThreadIdYOpGenericAdaptor<::mlir::ValueRange> { +public: + using ThreadIdYOpGenericAdaptor::ThreadIdYOpGenericAdaptor; + ThreadIdYOpAdaptor(ThreadIdYOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ThreadIdYOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ThreadIdYOpAdaptor; + template + using GenericAdaptor = ThreadIdYOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.workitem.id.y"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ThreadIdYOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::ThreadIdZOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ThreadIdZOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ThreadIdZOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ThreadIdZOpGenericAdaptorBase(ThreadIdZOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ThreadIdZOpGenericAdaptor : public detail::ThreadIdZOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ThreadIdZOpGenericAdaptorBase; +public: + ThreadIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ThreadIdZOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ThreadIdZOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ThreadIdZOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ThreadIdZOpAdaptor : public ThreadIdZOpGenericAdaptor<::mlir::ValueRange> { +public: + using ThreadIdZOpGenericAdaptor::ThreadIdZOpGenericAdaptor; + ThreadIdZOpAdaptor(ThreadIdZOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ThreadIdZOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ThreadIdZOpAdaptor; + template + using GenericAdaptor = ThreadIdZOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.workitem.id.z"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ThreadIdZOp) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x16bf16_1k declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x16bf16_1kGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x16bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x16bf16_1kGenericAdaptorBase(mfma_f32_16x16x16bf16_1k op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x16bf16_1kGenericAdaptor : public detail::mfma_f32_16x16x16bf16_1kGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x16bf16_1kGenericAdaptorBase; +public: + mfma_f32_16x16x16bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x16bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x16bf16_1kGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x16bf16_1kGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x16bf16_1kAdaptor : public mfma_f32_16x16x16bf16_1kGenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x16bf16_1kGenericAdaptor::mfma_f32_16x16x16bf16_1kGenericAdaptor; + mfma_f32_16x16x16bf16_1kAdaptor(mfma_f32_16x16x16bf16_1k op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x16bf16_1k : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x16bf16_1kAdaptor; + template + using GenericAdaptor = mfma_f32_16x16x16bf16_1kGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x16bf16.1k"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x16bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x16f16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x16f16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x16f16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x16f16GenericAdaptorBase(mfma_f32_16x16x16f16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x16f16GenericAdaptor : public detail::mfma_f32_16x16x16f16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x16f16GenericAdaptorBase; +public: + mfma_f32_16x16x16f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x16f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x16f16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x16f16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x16f16Adaptor : public mfma_f32_16x16x16f16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x16f16GenericAdaptor::mfma_f32_16x16x16f16GenericAdaptor; + mfma_f32_16x16x16f16Adaptor(mfma_f32_16x16x16f16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x16f16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x16f16Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x16f16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x16f16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x16f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x1f32 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x1f32GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x1f32GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x1f32GenericAdaptorBase(mfma_f32_16x16x1f32 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x1f32GenericAdaptor : public detail::mfma_f32_16x16x1f32GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x1f32GenericAdaptorBase; +public: + mfma_f32_16x16x1f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x1f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x1f32GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x1f32GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x1f32Adaptor : public mfma_f32_16x16x1f32GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x1f32GenericAdaptor::mfma_f32_16x16x1f32GenericAdaptor; + mfma_f32_16x16x1f32Adaptor(mfma_f32_16x16x1f32 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x1f32 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x1f32Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x1f32GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x1f32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x1f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x2bf16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x2bf16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x2bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x2bf16GenericAdaptorBase(mfma_f32_16x16x2bf16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x2bf16GenericAdaptor : public detail::mfma_f32_16x16x2bf16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x2bf16GenericAdaptorBase; +public: + mfma_f32_16x16x2bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x2bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x2bf16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x2bf16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x2bf16Adaptor : public mfma_f32_16x16x2bf16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x2bf16GenericAdaptor::mfma_f32_16x16x2bf16GenericAdaptor; + mfma_f32_16x16x2bf16Adaptor(mfma_f32_16x16x2bf16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x2bf16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x2bf16Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x2bf16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x2bf16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x2bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x32_bf8_bf8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase(mfma_f32_16x16x32_bf8_bf8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x32_bf8_bf8GenericAdaptor : public detail::mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x32_bf8_bf8GenericAdaptorBase; +public: + mfma_f32_16x16x32_bf8_bf8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x32_bf8_bf8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x32_bf8_bf8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x32_bf8_bf8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x32_bf8_bf8Adaptor : public mfma_f32_16x16x32_bf8_bf8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x32_bf8_bf8GenericAdaptor::mfma_f32_16x16x32_bf8_bf8GenericAdaptor; + mfma_f32_16x16x32_bf8_bf8Adaptor(mfma_f32_16x16x32_bf8_bf8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x32_bf8_bf8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x32_bf8_bf8Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x32_bf8_bf8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x32.bf8.bf8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x32_bf8_bf8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x32_bf8_fp8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase(mfma_f32_16x16x32_bf8_fp8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x32_bf8_fp8GenericAdaptor : public detail::mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x32_bf8_fp8GenericAdaptorBase; +public: + mfma_f32_16x16x32_bf8_fp8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x32_bf8_fp8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x32_bf8_fp8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x32_bf8_fp8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x32_bf8_fp8Adaptor : public mfma_f32_16x16x32_bf8_fp8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x32_bf8_fp8GenericAdaptor::mfma_f32_16x16x32_bf8_fp8GenericAdaptor; + mfma_f32_16x16x32_bf8_fp8Adaptor(mfma_f32_16x16x32_bf8_fp8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x32_bf8_fp8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x32_bf8_fp8Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x32_bf8_fp8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x32.bf8.fp8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x32_bf8_fp8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x32_fp8_bf8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase(mfma_f32_16x16x32_fp8_bf8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x32_fp8_bf8GenericAdaptor : public detail::mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x32_fp8_bf8GenericAdaptorBase; +public: + mfma_f32_16x16x32_fp8_bf8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x32_fp8_bf8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x32_fp8_bf8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x32_fp8_bf8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x32_fp8_bf8Adaptor : public mfma_f32_16x16x32_fp8_bf8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x32_fp8_bf8GenericAdaptor::mfma_f32_16x16x32_fp8_bf8GenericAdaptor; + mfma_f32_16x16x32_fp8_bf8Adaptor(mfma_f32_16x16x32_fp8_bf8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x32_fp8_bf8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x32_fp8_bf8Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x32_fp8_bf8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x32.fp8.bf8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x32_fp8_bf8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x32_fp8_fp8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase(mfma_f32_16x16x32_fp8_fp8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x32_fp8_fp8GenericAdaptor : public detail::mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x32_fp8_fp8GenericAdaptorBase; +public: + mfma_f32_16x16x32_fp8_fp8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x32_fp8_fp8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x32_fp8_fp8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x32_fp8_fp8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x32_fp8_fp8Adaptor : public mfma_f32_16x16x32_fp8_fp8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x32_fp8_fp8GenericAdaptor::mfma_f32_16x16x32_fp8_fp8GenericAdaptor; + mfma_f32_16x16x32_fp8_fp8Adaptor(mfma_f32_16x16x32_fp8_fp8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x32_fp8_fp8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x32_fp8_fp8Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x32_fp8_fp8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x32.fp8.fp8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x32_fp8_fp8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x4bf16_1k declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x4bf16_1kGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x4bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x4bf16_1kGenericAdaptorBase(mfma_f32_16x16x4bf16_1k op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x4bf16_1kGenericAdaptor : public detail::mfma_f32_16x16x4bf16_1kGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x4bf16_1kGenericAdaptorBase; +public: + mfma_f32_16x16x4bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x4bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x4bf16_1kGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x4bf16_1kGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x4bf16_1kAdaptor : public mfma_f32_16x16x4bf16_1kGenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x4bf16_1kGenericAdaptor::mfma_f32_16x16x4bf16_1kGenericAdaptor; + mfma_f32_16x16x4bf16_1kAdaptor(mfma_f32_16x16x4bf16_1k op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x4bf16_1k : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x4bf16_1kAdaptor; + template + using GenericAdaptor = mfma_f32_16x16x4bf16_1kGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x4bf16.1k"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x4bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x4f16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x4f16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x4f16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x4f16GenericAdaptorBase(mfma_f32_16x16x4f16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x4f16GenericAdaptor : public detail::mfma_f32_16x16x4f16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x4f16GenericAdaptorBase; +public: + mfma_f32_16x16x4f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x4f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x4f16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x4f16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x4f16Adaptor : public mfma_f32_16x16x4f16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x4f16GenericAdaptor::mfma_f32_16x16x4f16GenericAdaptor; + mfma_f32_16x16x4f16Adaptor(mfma_f32_16x16x4f16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x4f16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x4f16Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x4f16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x4f16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x4f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x4f32 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x4f32GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x4f32GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x4f32GenericAdaptorBase(mfma_f32_16x16x4f32 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x4f32GenericAdaptor : public detail::mfma_f32_16x16x4f32GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x4f32GenericAdaptorBase; +public: + mfma_f32_16x16x4f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x4f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x4f32GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x4f32GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x4f32Adaptor : public mfma_f32_16x16x4f32GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x4f32GenericAdaptor::mfma_f32_16x16x4f32GenericAdaptor; + mfma_f32_16x16x4f32Adaptor(mfma_f32_16x16x4f32 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x4f32 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x4f32Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x4f32GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x4f32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x4f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x8_xf32 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x8_xf32GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x8_xf32GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x8_xf32GenericAdaptorBase(mfma_f32_16x16x8_xf32 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x8_xf32GenericAdaptor : public detail::mfma_f32_16x16x8_xf32GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x8_xf32GenericAdaptorBase; +public: + mfma_f32_16x16x8_xf32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x8_xf32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x8_xf32GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x8_xf32GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x8_xf32Adaptor : public mfma_f32_16x16x8_xf32GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x8_xf32GenericAdaptor::mfma_f32_16x16x8_xf32GenericAdaptor; + mfma_f32_16x16x8_xf32Adaptor(mfma_f32_16x16x8_xf32 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x8_xf32 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x8_xf32Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x8_xf32GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x8.xf32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x8_xf32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_16x16x8bf16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_16x16x8bf16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_16x16x8bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_16x16x8bf16GenericAdaptorBase(mfma_f32_16x16x8bf16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_16x16x8bf16GenericAdaptor : public detail::mfma_f32_16x16x8bf16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_16x16x8bf16GenericAdaptorBase; +public: + mfma_f32_16x16x8bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_16x16x8bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_16x16x8bf16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_16x16x8bf16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_16x16x8bf16Adaptor : public mfma_f32_16x16x8bf16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_16x16x8bf16GenericAdaptor::mfma_f32_16x16x8bf16GenericAdaptor; + mfma_f32_16x16x8bf16Adaptor(mfma_f32_16x16x8bf16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_16x16x8bf16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_16x16x8bf16Adaptor; + template + using GenericAdaptor = mfma_f32_16x16x8bf16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.16x16x8bf16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_16x16x8bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x16_bf8_bf8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase(mfma_f32_32x32x16_bf8_bf8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x16_bf8_bf8GenericAdaptor : public detail::mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x16_bf8_bf8GenericAdaptorBase; +public: + mfma_f32_32x32x16_bf8_bf8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x16_bf8_bf8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x16_bf8_bf8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x16_bf8_bf8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x16_bf8_bf8Adaptor : public mfma_f32_32x32x16_bf8_bf8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x16_bf8_bf8GenericAdaptor::mfma_f32_32x32x16_bf8_bf8GenericAdaptor; + mfma_f32_32x32x16_bf8_bf8Adaptor(mfma_f32_32x32x16_bf8_bf8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x16_bf8_bf8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x16_bf8_bf8Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x16_bf8_bf8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x16.bf8.bf8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x16_bf8_bf8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x16_bf8_fp8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase(mfma_f32_32x32x16_bf8_fp8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x16_bf8_fp8GenericAdaptor : public detail::mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x16_bf8_fp8GenericAdaptorBase; +public: + mfma_f32_32x32x16_bf8_fp8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x16_bf8_fp8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x16_bf8_fp8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x16_bf8_fp8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x16_bf8_fp8Adaptor : public mfma_f32_32x32x16_bf8_fp8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x16_bf8_fp8GenericAdaptor::mfma_f32_32x32x16_bf8_fp8GenericAdaptor; + mfma_f32_32x32x16_bf8_fp8Adaptor(mfma_f32_32x32x16_bf8_fp8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x16_bf8_fp8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x16_bf8_fp8Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x16_bf8_fp8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x16.bf8.fp8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x16_bf8_fp8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x16_fp8_bf8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase(mfma_f32_32x32x16_fp8_bf8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x16_fp8_bf8GenericAdaptor : public detail::mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x16_fp8_bf8GenericAdaptorBase; +public: + mfma_f32_32x32x16_fp8_bf8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x16_fp8_bf8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x16_fp8_bf8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x16_fp8_bf8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x16_fp8_bf8Adaptor : public mfma_f32_32x32x16_fp8_bf8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x16_fp8_bf8GenericAdaptor::mfma_f32_32x32x16_fp8_bf8GenericAdaptor; + mfma_f32_32x32x16_fp8_bf8Adaptor(mfma_f32_32x32x16_fp8_bf8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x16_fp8_bf8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x16_fp8_bf8Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x16_fp8_bf8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x16.fp8.bf8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x16_fp8_bf8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x16_fp8_fp8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase(mfma_f32_32x32x16_fp8_fp8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x16_fp8_fp8GenericAdaptor : public detail::mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x16_fp8_fp8GenericAdaptorBase; +public: + mfma_f32_32x32x16_fp8_fp8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x16_fp8_fp8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x16_fp8_fp8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x16_fp8_fp8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x16_fp8_fp8Adaptor : public mfma_f32_32x32x16_fp8_fp8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x16_fp8_fp8GenericAdaptor::mfma_f32_32x32x16_fp8_fp8GenericAdaptor; + mfma_f32_32x32x16_fp8_fp8Adaptor(mfma_f32_32x32x16_fp8_fp8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x16_fp8_fp8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x16_fp8_fp8Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x16_fp8_fp8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x16.fp8.fp8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x16_fp8_fp8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x1f32 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x1f32GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x1f32GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x1f32GenericAdaptorBase(mfma_f32_32x32x1f32 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x1f32GenericAdaptor : public detail::mfma_f32_32x32x1f32GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x1f32GenericAdaptorBase; +public: + mfma_f32_32x32x1f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x1f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x1f32GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x1f32GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x1f32Adaptor : public mfma_f32_32x32x1f32GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x1f32GenericAdaptor::mfma_f32_32x32x1f32GenericAdaptor; + mfma_f32_32x32x1f32Adaptor(mfma_f32_32x32x1f32 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x1f32 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x1f32Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x1f32GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x1f32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x1f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x2bf16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x2bf16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x2bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x2bf16GenericAdaptorBase(mfma_f32_32x32x2bf16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x2bf16GenericAdaptor : public detail::mfma_f32_32x32x2bf16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x2bf16GenericAdaptorBase; +public: + mfma_f32_32x32x2bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x2bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x2bf16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x2bf16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x2bf16Adaptor : public mfma_f32_32x32x2bf16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x2bf16GenericAdaptor::mfma_f32_32x32x2bf16GenericAdaptor; + mfma_f32_32x32x2bf16Adaptor(mfma_f32_32x32x2bf16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x2bf16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x2bf16Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x2bf16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x2bf16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x2bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x2f32 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x2f32GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x2f32GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x2f32GenericAdaptorBase(mfma_f32_32x32x2f32 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x2f32GenericAdaptor : public detail::mfma_f32_32x32x2f32GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x2f32GenericAdaptorBase; +public: + mfma_f32_32x32x2f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x2f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x2f32GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x2f32GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x2f32Adaptor : public mfma_f32_32x32x2f32GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x2f32GenericAdaptor::mfma_f32_32x32x2f32GenericAdaptor; + mfma_f32_32x32x2f32Adaptor(mfma_f32_32x32x2f32 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x2f32 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x2f32Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x2f32GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x2f32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x2f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x4_xf32 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x4_xf32GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x4_xf32GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x4_xf32GenericAdaptorBase(mfma_f32_32x32x4_xf32 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x4_xf32GenericAdaptor : public detail::mfma_f32_32x32x4_xf32GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x4_xf32GenericAdaptorBase; +public: + mfma_f32_32x32x4_xf32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x4_xf32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x4_xf32GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x4_xf32GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x4_xf32Adaptor : public mfma_f32_32x32x4_xf32GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x4_xf32GenericAdaptor::mfma_f32_32x32x4_xf32GenericAdaptor; + mfma_f32_32x32x4_xf32Adaptor(mfma_f32_32x32x4_xf32 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x4_xf32 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x4_xf32Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x4_xf32GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x4.xf32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x4_xf32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x4bf16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x4bf16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x4bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x4bf16GenericAdaptorBase(mfma_f32_32x32x4bf16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x4bf16GenericAdaptor : public detail::mfma_f32_32x32x4bf16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x4bf16GenericAdaptorBase; +public: + mfma_f32_32x32x4bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x4bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x4bf16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x4bf16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x4bf16Adaptor : public mfma_f32_32x32x4bf16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x4bf16GenericAdaptor::mfma_f32_32x32x4bf16GenericAdaptor; + mfma_f32_32x32x4bf16Adaptor(mfma_f32_32x32x4bf16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x4bf16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x4bf16Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x4bf16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x4bf16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x4bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x4bf16_1k declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x4bf16_1kGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x4bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x4bf16_1kGenericAdaptorBase(mfma_f32_32x32x4bf16_1k op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x4bf16_1kGenericAdaptor : public detail::mfma_f32_32x32x4bf16_1kGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x4bf16_1kGenericAdaptorBase; +public: + mfma_f32_32x32x4bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x4bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x4bf16_1kGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x4bf16_1kGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x4bf16_1kAdaptor : public mfma_f32_32x32x4bf16_1kGenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x4bf16_1kGenericAdaptor::mfma_f32_32x32x4bf16_1kGenericAdaptor; + mfma_f32_32x32x4bf16_1kAdaptor(mfma_f32_32x32x4bf16_1k op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x4bf16_1k : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x4bf16_1kAdaptor; + template + using GenericAdaptor = mfma_f32_32x32x4bf16_1kGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x4bf16.1k"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x4bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x4f16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x4f16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x4f16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x4f16GenericAdaptorBase(mfma_f32_32x32x4f16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x4f16GenericAdaptor : public detail::mfma_f32_32x32x4f16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x4f16GenericAdaptorBase; +public: + mfma_f32_32x32x4f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x4f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x4f16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x4f16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x4f16Adaptor : public mfma_f32_32x32x4f16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x4f16GenericAdaptor::mfma_f32_32x32x4f16GenericAdaptor; + mfma_f32_32x32x4f16Adaptor(mfma_f32_32x32x4f16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x4f16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x4f16Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x4f16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x4f16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x4f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x8bf16_1k declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x8bf16_1kGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x8bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x8bf16_1kGenericAdaptorBase(mfma_f32_32x32x8bf16_1k op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x8bf16_1kGenericAdaptor : public detail::mfma_f32_32x32x8bf16_1kGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x8bf16_1kGenericAdaptorBase; +public: + mfma_f32_32x32x8bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x8bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x8bf16_1kGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x8bf16_1kGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x8bf16_1kAdaptor : public mfma_f32_32x32x8bf16_1kGenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x8bf16_1kGenericAdaptor::mfma_f32_32x32x8bf16_1kGenericAdaptor; + mfma_f32_32x32x8bf16_1kAdaptor(mfma_f32_32x32x8bf16_1k op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x8bf16_1k : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x8bf16_1kAdaptor; + template + using GenericAdaptor = mfma_f32_32x32x8bf16_1kGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x8bf16.1k"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x8bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_32x32x8f16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_32x32x8f16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_32x32x8f16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_32x32x8f16GenericAdaptorBase(mfma_f32_32x32x8f16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_32x32x8f16GenericAdaptor : public detail::mfma_f32_32x32x8f16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_32x32x8f16GenericAdaptorBase; +public: + mfma_f32_32x32x8f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_32x32x8f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_32x32x8f16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_32x32x8f16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_32x32x8f16Adaptor : public mfma_f32_32x32x8f16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_32x32x8f16GenericAdaptor::mfma_f32_32x32x8f16GenericAdaptor; + mfma_f32_32x32x8f16Adaptor(mfma_f32_32x32x8f16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_32x32x8f16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_32x32x8f16Adaptor; + template + using GenericAdaptor = mfma_f32_32x32x8f16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.32x32x8f16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_32x32x8f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_4x4x1f32 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_4x4x1f32GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_4x4x1f32GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_4x4x1f32GenericAdaptorBase(mfma_f32_4x4x1f32 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_4x4x1f32GenericAdaptor : public detail::mfma_f32_4x4x1f32GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_4x4x1f32GenericAdaptorBase; +public: + mfma_f32_4x4x1f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_4x4x1f32GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_4x4x1f32GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_4x4x1f32GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_4x4x1f32Adaptor : public mfma_f32_4x4x1f32GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_4x4x1f32GenericAdaptor::mfma_f32_4x4x1f32GenericAdaptor; + mfma_f32_4x4x1f32Adaptor(mfma_f32_4x4x1f32 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_4x4x1f32 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_4x4x1f32Adaptor; + template + using GenericAdaptor = mfma_f32_4x4x1f32GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.4x4x1f32"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_4x4x1f32) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_4x4x2bf16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_4x4x2bf16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_4x4x2bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_4x4x2bf16GenericAdaptorBase(mfma_f32_4x4x2bf16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_4x4x2bf16GenericAdaptor : public detail::mfma_f32_4x4x2bf16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_4x4x2bf16GenericAdaptorBase; +public: + mfma_f32_4x4x2bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_4x4x2bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_4x4x2bf16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_4x4x2bf16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_4x4x2bf16Adaptor : public mfma_f32_4x4x2bf16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_4x4x2bf16GenericAdaptor::mfma_f32_4x4x2bf16GenericAdaptor; + mfma_f32_4x4x2bf16Adaptor(mfma_f32_4x4x2bf16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_4x4x2bf16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_4x4x2bf16Adaptor; + template + using GenericAdaptor = mfma_f32_4x4x2bf16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.4x4x2bf16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_4x4x2bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_4x4x4bf16_1k declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_4x4x4bf16_1kGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_4x4x4bf16_1kGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_4x4x4bf16_1kGenericAdaptorBase(mfma_f32_4x4x4bf16_1k op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_4x4x4bf16_1kGenericAdaptor : public detail::mfma_f32_4x4x4bf16_1kGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_4x4x4bf16_1kGenericAdaptorBase; +public: + mfma_f32_4x4x4bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_4x4x4bf16_1kGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_4x4x4bf16_1kGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_4x4x4bf16_1kGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_4x4x4bf16_1kAdaptor : public mfma_f32_4x4x4bf16_1kGenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_4x4x4bf16_1kGenericAdaptor::mfma_f32_4x4x4bf16_1kGenericAdaptor; + mfma_f32_4x4x4bf16_1kAdaptor(mfma_f32_4x4x4bf16_1k op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_4x4x4bf16_1k : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_4x4x4bf16_1kAdaptor; + template + using GenericAdaptor = mfma_f32_4x4x4bf16_1kGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.4x4x4bf16.1k"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_4x4x4bf16_1k) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f32_4x4x4f16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f32_4x4x4f16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f32_4x4x4f16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f32_4x4x4f16GenericAdaptorBase(mfma_f32_4x4x4f16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f32_4x4x4f16GenericAdaptor : public detail::mfma_f32_4x4x4f16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f32_4x4x4f16GenericAdaptorBase; +public: + mfma_f32_4x4x4f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f32_4x4x4f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f32_4x4x4f16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f32_4x4x4f16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f32_4x4x4f16Adaptor : public mfma_f32_4x4x4f16GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f32_4x4x4f16GenericAdaptor::mfma_f32_4x4x4f16GenericAdaptor; + mfma_f32_4x4x4f16Adaptor(mfma_f32_4x4x4f16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f32_4x4x4f16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f32_4x4x4f16Adaptor; + template + using GenericAdaptor = mfma_f32_4x4x4f16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f32.4x4x4f16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f32_4x4x4f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f64_16x16x4f64 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f64_16x16x4f64GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f64_16x16x4f64GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f64_16x16x4f64GenericAdaptorBase(mfma_f64_16x16x4f64 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f64_16x16x4f64GenericAdaptor : public detail::mfma_f64_16x16x4f64GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f64_16x16x4f64GenericAdaptorBase; +public: + mfma_f64_16x16x4f64GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f64_16x16x4f64GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f64_16x16x4f64GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f64_16x16x4f64GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f64_16x16x4f64Adaptor : public mfma_f64_16x16x4f64GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f64_16x16x4f64GenericAdaptor::mfma_f64_16x16x4f64GenericAdaptor; + mfma_f64_16x16x4f64Adaptor(mfma_f64_16x16x4f64 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f64_16x16x4f64 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f64_16x16x4f64Adaptor; + template + using GenericAdaptor = mfma_f64_16x16x4f64GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f64.16x16x4f64"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f64_16x16x4f64) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_f64_4x4x4f64 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_f64_4x4x4f64GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_f64_4x4x4f64GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_f64_4x4x4f64GenericAdaptorBase(mfma_f64_4x4x4f64 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_f64_4x4x4f64GenericAdaptor : public detail::mfma_f64_4x4x4f64GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_f64_4x4x4f64GenericAdaptorBase; +public: + mfma_f64_4x4x4f64GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_f64_4x4x4f64GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_f64_4x4x4f64GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_f64_4x4x4f64GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_f64_4x4x4f64Adaptor : public mfma_f64_4x4x4f64GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_f64_4x4x4f64GenericAdaptor::mfma_f64_4x4x4f64GenericAdaptor; + mfma_f64_4x4x4f64Adaptor(mfma_f64_4x4x4f64 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_f64_4x4x4f64 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_f64_4x4x4f64Adaptor; + template + using GenericAdaptor = mfma_f64_4x4x4f64GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.f64.4x4x4f64"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_f64_4x4x4f64) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_16x16x16i8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_i32_16x16x16i8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_i32_16x16x16i8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_i32_16x16x16i8GenericAdaptorBase(mfma_i32_16x16x16i8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_i32_16x16x16i8GenericAdaptor : public detail::mfma_i32_16x16x16i8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_i32_16x16x16i8GenericAdaptorBase; +public: + mfma_i32_16x16x16i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_i32_16x16x16i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_i32_16x16x16i8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_i32_16x16x16i8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_i32_16x16x16i8Adaptor : public mfma_i32_16x16x16i8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_i32_16x16x16i8GenericAdaptor::mfma_i32_16x16x16i8GenericAdaptor; + mfma_i32_16x16x16i8Adaptor(mfma_i32_16x16x16i8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_i32_16x16x16i8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_i32_16x16x16i8Adaptor; + template + using GenericAdaptor = mfma_i32_16x16x16i8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.i32.16x16x16i8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_16x16x16i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_16x16x32_i8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_i32_16x16x32_i8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_i32_16x16x32_i8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_i32_16x16x32_i8GenericAdaptorBase(mfma_i32_16x16x32_i8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_i32_16x16x32_i8GenericAdaptor : public detail::mfma_i32_16x16x32_i8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_i32_16x16x32_i8GenericAdaptorBase; +public: + mfma_i32_16x16x32_i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_i32_16x16x32_i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_i32_16x16x32_i8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_i32_16x16x32_i8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_i32_16x16x32_i8Adaptor : public mfma_i32_16x16x32_i8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_i32_16x16x32_i8GenericAdaptor::mfma_i32_16x16x32_i8GenericAdaptor; + mfma_i32_16x16x32_i8Adaptor(mfma_i32_16x16x32_i8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_i32_16x16x32_i8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_i32_16x16x32_i8Adaptor; + template + using GenericAdaptor = mfma_i32_16x16x32_i8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.i32.16x16x32.i8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_16x16x32_i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_16x16x4i8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_i32_16x16x4i8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_i32_16x16x4i8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_i32_16x16x4i8GenericAdaptorBase(mfma_i32_16x16x4i8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_i32_16x16x4i8GenericAdaptor : public detail::mfma_i32_16x16x4i8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_i32_16x16x4i8GenericAdaptorBase; +public: + mfma_i32_16x16x4i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_i32_16x16x4i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_i32_16x16x4i8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_i32_16x16x4i8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_i32_16x16x4i8Adaptor : public mfma_i32_16x16x4i8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_i32_16x16x4i8GenericAdaptor::mfma_i32_16x16x4i8GenericAdaptor; + mfma_i32_16x16x4i8Adaptor(mfma_i32_16x16x4i8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_i32_16x16x4i8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_i32_16x16x4i8Adaptor; + template + using GenericAdaptor = mfma_i32_16x16x4i8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.i32.16x16x4i8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_16x16x4i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_32x32x16_i8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_i32_32x32x16_i8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_i32_32x32x16_i8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_i32_32x32x16_i8GenericAdaptorBase(mfma_i32_32x32x16_i8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_i32_32x32x16_i8GenericAdaptor : public detail::mfma_i32_32x32x16_i8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_i32_32x32x16_i8GenericAdaptorBase; +public: + mfma_i32_32x32x16_i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_i32_32x32x16_i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_i32_32x32x16_i8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_i32_32x32x16_i8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_i32_32x32x16_i8Adaptor : public mfma_i32_32x32x16_i8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_i32_32x32x16_i8GenericAdaptor::mfma_i32_32x32x16_i8GenericAdaptor; + mfma_i32_32x32x16_i8Adaptor(mfma_i32_32x32x16_i8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_i32_32x32x16_i8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_i32_32x32x16_i8Adaptor; + template + using GenericAdaptor = mfma_i32_32x32x16_i8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.i32.32x32x16.i8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_32x32x16_i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_32x32x4i8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_i32_32x32x4i8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_i32_32x32x4i8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_i32_32x32x4i8GenericAdaptorBase(mfma_i32_32x32x4i8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_i32_32x32x4i8GenericAdaptor : public detail::mfma_i32_32x32x4i8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_i32_32x32x4i8GenericAdaptorBase; +public: + mfma_i32_32x32x4i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_i32_32x32x4i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_i32_32x32x4i8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_i32_32x32x4i8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_i32_32x32x4i8Adaptor : public mfma_i32_32x32x4i8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_i32_32x32x4i8GenericAdaptor::mfma_i32_32x32x4i8GenericAdaptor; + mfma_i32_32x32x4i8Adaptor(mfma_i32_32x32x4i8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_i32_32x32x4i8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_i32_32x32x4i8Adaptor; + template + using GenericAdaptor = mfma_i32_32x32x4i8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.i32.32x32x4i8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_32x32x4i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_32x32x8i8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_i32_32x32x8i8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_i32_32x32x8i8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_i32_32x32x8i8GenericAdaptorBase(mfma_i32_32x32x8i8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_i32_32x32x8i8GenericAdaptor : public detail::mfma_i32_32x32x8i8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_i32_32x32x8i8GenericAdaptorBase; +public: + mfma_i32_32x32x8i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_i32_32x32x8i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_i32_32x32x8i8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_i32_32x32x8i8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_i32_32x32x8i8Adaptor : public mfma_i32_32x32x8i8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_i32_32x32x8i8GenericAdaptor::mfma_i32_32x32x8i8GenericAdaptor; + mfma_i32_32x32x8i8Adaptor(mfma_i32_32x32x8i8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_i32_32x32x8i8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_i32_32x32x8i8Adaptor; + template + using GenericAdaptor = mfma_i32_32x32x8i8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.i32.32x32x8i8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_32x32x8i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::mfma_i32_4x4x4i8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class mfma_i32_4x4x4i8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + mfma_i32_4x4x4i8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + mfma_i32_4x4x4i8GenericAdaptorBase(mfma_i32_4x4x4i8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class mfma_i32_4x4x4i8GenericAdaptor : public detail::mfma_i32_4x4x4i8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::mfma_i32_4x4x4i8GenericAdaptorBase; +public: + mfma_i32_4x4x4i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + mfma_i32_4x4x4i8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : mfma_i32_4x4x4i8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + mfma_i32_4x4x4i8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class mfma_i32_4x4x4i8Adaptor : public mfma_i32_4x4x4i8GenericAdaptor<::mlir::ValueRange> { +public: + using mfma_i32_4x4x4i8GenericAdaptor::mfma_i32_4x4x4i8GenericAdaptor; + mfma_i32_4x4x4i8Adaptor(mfma_i32_4x4x4i8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class mfma_i32_4x4x4i8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = mfma_i32_4x4x4i8Adaptor; + template + using GenericAdaptor = mfma_i32_4x4x4i8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.mfma.i32.4x4x4i8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::mfma_i32_4x4x4i8) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_bf16_16x16x16_bf16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class wmma_bf16_16x16x16_bf16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + wmma_bf16_16x16x16_bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + wmma_bf16_16x16x16_bf16GenericAdaptorBase(wmma_bf16_16x16x16_bf16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class wmma_bf16_16x16x16_bf16GenericAdaptor : public detail::wmma_bf16_16x16x16_bf16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::wmma_bf16_16x16x16_bf16GenericAdaptorBase; +public: + wmma_bf16_16x16x16_bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + wmma_bf16_16x16x16_bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : wmma_bf16_16x16x16_bf16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + wmma_bf16_16x16x16_bf16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class wmma_bf16_16x16x16_bf16Adaptor : public wmma_bf16_16x16x16_bf16GenericAdaptor<::mlir::ValueRange> { +public: + using wmma_bf16_16x16x16_bf16GenericAdaptor::wmma_bf16_16x16x16_bf16GenericAdaptor; + wmma_bf16_16x16x16_bf16Adaptor(wmma_bf16_16x16x16_bf16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class wmma_bf16_16x16x16_bf16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = wmma_bf16_16x16x16_bf16Adaptor; + template + using GenericAdaptor = wmma_bf16_16x16x16_bf16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.wmma.bf16.16x16x16.bf16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_bf16_16x16x16_bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_f16_16x16x16_f16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class wmma_f16_16x16x16_f16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + wmma_f16_16x16x16_f16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + wmma_f16_16x16x16_f16GenericAdaptorBase(wmma_f16_16x16x16_f16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class wmma_f16_16x16x16_f16GenericAdaptor : public detail::wmma_f16_16x16x16_f16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::wmma_f16_16x16x16_f16GenericAdaptorBase; +public: + wmma_f16_16x16x16_f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + wmma_f16_16x16x16_f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : wmma_f16_16x16x16_f16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + wmma_f16_16x16x16_f16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class wmma_f16_16x16x16_f16Adaptor : public wmma_f16_16x16x16_f16GenericAdaptor<::mlir::ValueRange> { +public: + using wmma_f16_16x16x16_f16GenericAdaptor::wmma_f16_16x16x16_f16GenericAdaptor; + wmma_f16_16x16x16_f16Adaptor(wmma_f16_16x16x16_f16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class wmma_f16_16x16x16_f16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = wmma_f16_16x16x16_f16Adaptor; + template + using GenericAdaptor = wmma_f16_16x16x16_f16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.wmma.f16.16x16x16.f16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_f16_16x16x16_f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_f32_16x16x16_bf16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class wmma_f32_16x16x16_bf16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + wmma_f32_16x16x16_bf16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + wmma_f32_16x16x16_bf16GenericAdaptorBase(wmma_f32_16x16x16_bf16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class wmma_f32_16x16x16_bf16GenericAdaptor : public detail::wmma_f32_16x16x16_bf16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::wmma_f32_16x16x16_bf16GenericAdaptorBase; +public: + wmma_f32_16x16x16_bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + wmma_f32_16x16x16_bf16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : wmma_f32_16x16x16_bf16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + wmma_f32_16x16x16_bf16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class wmma_f32_16x16x16_bf16Adaptor : public wmma_f32_16x16x16_bf16GenericAdaptor<::mlir::ValueRange> { +public: + using wmma_f32_16x16x16_bf16GenericAdaptor::wmma_f32_16x16x16_bf16GenericAdaptor; + wmma_f32_16x16x16_bf16Adaptor(wmma_f32_16x16x16_bf16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class wmma_f32_16x16x16_bf16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = wmma_f32_16x16x16_bf16Adaptor; + template + using GenericAdaptor = wmma_f32_16x16x16_bf16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.wmma.f32.16x16x16.bf16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_f32_16x16x16_bf16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_f32_16x16x16_f16 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class wmma_f32_16x16x16_f16GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + wmma_f32_16x16x16_f16GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + wmma_f32_16x16x16_f16GenericAdaptorBase(wmma_f32_16x16x16_f16 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class wmma_f32_16x16x16_f16GenericAdaptor : public detail::wmma_f32_16x16x16_f16GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::wmma_f32_16x16x16_f16GenericAdaptorBase; +public: + wmma_f32_16x16x16_f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + wmma_f32_16x16x16_f16GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : wmma_f32_16x16x16_f16GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + wmma_f32_16x16x16_f16GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class wmma_f32_16x16x16_f16Adaptor : public wmma_f32_16x16x16_f16GenericAdaptor<::mlir::ValueRange> { +public: + using wmma_f32_16x16x16_f16GenericAdaptor::wmma_f32_16x16x16_f16GenericAdaptor; + wmma_f32_16x16x16_f16Adaptor(wmma_f32_16x16x16_f16 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class wmma_f32_16x16x16_f16 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = wmma_f32_16x16x16_f16Adaptor; + template + using GenericAdaptor = wmma_f32_16x16x16_f16GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.wmma.f32.16x16x16.f16"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_f32_16x16x16_f16) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_i32_16x16x16_iu4 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class wmma_i32_16x16x16_iu4GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + wmma_i32_16x16x16_iu4GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + wmma_i32_16x16x16_iu4GenericAdaptorBase(wmma_i32_16x16x16_iu4 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class wmma_i32_16x16x16_iu4GenericAdaptor : public detail::wmma_i32_16x16x16_iu4GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::wmma_i32_16x16x16_iu4GenericAdaptorBase; +public: + wmma_i32_16x16x16_iu4GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + wmma_i32_16x16x16_iu4GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : wmma_i32_16x16x16_iu4GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + wmma_i32_16x16x16_iu4GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class wmma_i32_16x16x16_iu4Adaptor : public wmma_i32_16x16x16_iu4GenericAdaptor<::mlir::ValueRange> { +public: + using wmma_i32_16x16x16_iu4GenericAdaptor::wmma_i32_16x16x16_iu4GenericAdaptor; + wmma_i32_16x16x16_iu4Adaptor(wmma_i32_16x16x16_iu4 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class wmma_i32_16x16x16_iu4 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = wmma_i32_16x16x16_iu4Adaptor; + template + using GenericAdaptor = wmma_i32_16x16x16_iu4GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.wmma.i32.16x16x16.iu4"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_i32_16x16x16_iu4) + +namespace mlir { +namespace ROCDL { + +//===----------------------------------------------------------------------===// +// ::mlir::ROCDL::wmma_i32_16x16x16_iu8 declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class wmma_i32_16x16x16_iu8GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + wmma_i32_16x16x16_iu8GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + wmma_i32_16x16x16_iu8GenericAdaptorBase(wmma_i32_16x16x16_iu8 op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class wmma_i32_16x16x16_iu8GenericAdaptor : public detail::wmma_i32_16x16x16_iu8GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::wmma_i32_16x16x16_iu8GenericAdaptorBase; +public: + wmma_i32_16x16x16_iu8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + wmma_i32_16x16x16_iu8GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : wmma_i32_16x16x16_iu8GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + wmma_i32_16x16x16_iu8GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class wmma_i32_16x16x16_iu8Adaptor : public wmma_i32_16x16x16_iu8GenericAdaptor<::mlir::ValueRange> { +public: + using wmma_i32_16x16x16_iu8GenericAdaptor::wmma_i32_16x16x16_iu8GenericAdaptor; + wmma_i32_16x16x16_iu8Adaptor(wmma_i32_16x16x16_iu8 op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class wmma_i32_16x16x16_iu8 : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = wmma_i32_16x16x16_iu8Adaptor; + template + using GenericAdaptor = wmma_i32_16x16x16_iu8GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rocdl.wmma.i32.16x16x16.iu8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::wmma_i32_16x16x16_iu8) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..7df00243711e192e36dcf7464b2b1227b934188e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.cpp.inc @@ -0,0 +1,367 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::ROCDL::ROCDLTargetAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::ROCDL::ROCDLTargetAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::ROCDL::ROCDLTargetAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::ROCDL::ROCDLTargetAttr>([&](auto t) { + printer << ::mlir::ROCDL::ROCDLTargetAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace ROCDL { +namespace detail { +struct ROCDLTargetAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + ROCDLTargetAttrStorage(int O, ::llvm::StringRef triple, ::llvm::StringRef chip, ::llvm::StringRef features, ::llvm::StringRef abi, DictionaryAttr flags, ArrayAttr link) : O(std::move(O)), triple(std::move(triple)), chip(std::move(chip)), features(std::move(features)), abi(std::move(abi)), flags(std::move(flags)), link(std::move(link)) {} + + KeyTy getAsKey() const { + return KeyTy(O, triple, chip, features, abi, flags, link); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (O == std::get<0>(tblgenKey)) && (triple == std::get<1>(tblgenKey)) && (chip == std::get<2>(tblgenKey)) && (features == std::get<3>(tblgenKey)) && (abi == std::get<4>(tblgenKey)) && (flags == std::get<5>(tblgenKey)) && (link == std::get<6>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); + } + + static ROCDLTargetAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto O = std::move(std::get<0>(tblgenKey)); + auto triple = std::move(std::get<1>(tblgenKey)); + auto chip = std::move(std::get<2>(tblgenKey)); + auto features = std::move(std::get<3>(tblgenKey)); + auto abi = std::move(std::get<4>(tblgenKey)); + auto flags = std::move(std::get<5>(tblgenKey)); + auto link = std::move(std::get<6>(tblgenKey)); + triple = allocator.copyInto(triple); + chip = allocator.copyInto(chip); + features = allocator.copyInto(features); + abi = allocator.copyInto(abi); + return new (allocator.allocate()) ROCDLTargetAttrStorage(std::move(O), std::move(triple), std::move(chip), std::move(features), std::move(abi), std::move(flags), std::move(link)); + } + + int O; + ::llvm::StringRef triple; + ::llvm::StringRef chip; + ::llvm::StringRef features; + ::llvm::StringRef abi; + DictionaryAttr flags; + ArrayAttr link; +}; +} // namespace detail +bool ROCDLTargetAttr::hasFlag(StringRef flag) const { + if (DictionaryAttr flags = getFlags()) + return flags.get(flag) != nullptr; + return false; +} +bool ROCDLTargetAttr::hasWave64() const { + return hasFlag("wave64") || !hasFlag("no_wave64"); +} +bool ROCDLTargetAttr::hasFastMath() const { + return hasFlag("fast"); +} +bool ROCDLTargetAttr::hasDaz() const { + return hasFlag("daz"); +} +bool ROCDLTargetAttr::hasFiniteOnly() const { + return hasFlag("finite_only"); +} +bool ROCDLTargetAttr::hasUnsafeMath() const { + return hasFlag("unsafe_math"); +} +bool ROCDLTargetAttr::hasCorrectSqrt() const { + return !hasFlag("unsafe_sqrt"); +} +ROCDLTargetAttr ROCDLTargetAttr::get(::mlir::MLIRContext *context, int optLevel, StringRef triple, StringRef chip, StringRef features, StringRef abiVersion, DictionaryAttr targetFlags, ArrayAttr linkFiles) { + return Base::get(context, optLevel, triple, chip, features, abiVersion, + targetFlags, linkFiles); +} + +ROCDLTargetAttr ROCDLTargetAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int optLevel, StringRef triple, StringRef chip, StringRef features, StringRef abiVersion, DictionaryAttr targetFlags, ArrayAttr linkFiles) { + return Base::get(context, optLevel, triple, chip, features, abiVersion, + targetFlags, linkFiles); +} + +::mlir::Attribute ROCDLTargetAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_O; + ::mlir::FailureOr _result_triple; + ::mlir::FailureOr _result_chip; + ::mlir::FailureOr _result_features; + ::mlir::FailureOr _result_abi; + ::mlir::FailureOr _result_flags; + ::mlir::FailureOr _result_link; + // Parse literal '<' + if (odsParser.parseOptionalLess()) { + } else { + // Parse parameter struct + bool _seen_O = false; + bool _seen_triple = false; + bool _seen_chip = false; + bool _seen_features = false; + bool _seen_abi = false; + bool _seen_flags = false; + bool _seen_link = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_O && _paramKey == "O") { + _seen_O = true; + + // Parse variable 'O' + _result_O = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_O)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargettAttr parameter 'O' which is to be a `int`"); + return {}; + } + } else if (!_seen_triple && _paramKey == "triple") { + _seen_triple = true; + + // Parse variable 'triple' + _result_triple = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_triple)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargettAttr parameter 'triple' which is to be a `::llvm::StringRef`"); + return {}; + } + } else if (!_seen_chip && _paramKey == "chip") { + _seen_chip = true; + + // Parse variable 'chip' + _result_chip = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_chip)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargettAttr parameter 'chip' which is to be a `::llvm::StringRef`"); + return {}; + } + } else if (!_seen_features && _paramKey == "features") { + _seen_features = true; + + // Parse variable 'features' + _result_features = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_features)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargettAttr parameter 'features' which is to be a `::llvm::StringRef`"); + return {}; + } + } else if (!_seen_abi && _paramKey == "abi") { + _seen_abi = true; + + // Parse variable 'abi' + _result_abi = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_abi)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargettAttr parameter 'abi' which is to be a `::llvm::StringRef`"); + return {}; + } + } else if (!_seen_flags && _paramKey == "flags") { + _seen_flags = true; + + // Parse variable 'flags' + _result_flags = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_flags)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargettAttr parameter 'flags' which is to be a `DictionaryAttr`"); + return {}; + } + } else if (!_seen_link && _paramKey == "link") { + _seen_link = true; + + // Parse variable 'link' + _result_link = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_link)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ROCDL_TargettAttr parameter 'link' which is to be a `ArrayAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + } + return odsParser.getChecked(odsLoc, odsParser.getContext(), + int((_result_O.value_or(2))), + ::llvm::StringRef((_result_triple.value_or("amdgcn-amd-amdhsa"))), + ::llvm::StringRef((_result_chip.value_or("gfx900"))), + ::llvm::StringRef((_result_features.value_or(""))), + ::llvm::StringRef((_result_abi.value_or("400"))), + DictionaryAttr((_result_flags.value_or(DictionaryAttr()))), + ArrayAttr((_result_link.value_or(ArrayAttr())))); +} + +void ROCDLTargetAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + if (!(getO() == 2) || !(getTriple() == "amdgcn-amd-amdhsa") || !(getChip() == "gfx900") || !(getFeatures() == "") || !(getAbi() == "400") || !(getFlags() == DictionaryAttr()) || !(getLink() == ArrayAttr())) { + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getO() == 2)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "O = "; + if (!(getO() == 2)) { + odsPrinter.printStrippedAttrOrType(getO()); + } + } + if (!(getTriple() == "amdgcn-amd-amdhsa")) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "triple = "; + if (!(getTriple() == "amdgcn-amd-amdhsa")) { + odsPrinter.printString(getTriple());; + } + } + if (!(getChip() == "gfx900")) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "chip = "; + if (!(getChip() == "gfx900")) { + odsPrinter.printString(getChip());; + } + } + if (!(getFeatures() == "")) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "features = "; + if (!(getFeatures() == "")) { + odsPrinter.printString(getFeatures());; + } + } + if (!(getAbi() == "400")) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "abi = "; + if (!(getAbi() == "400")) { + odsPrinter.printString(getAbi());; + } + } + if (!(getFlags() == DictionaryAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "flags = "; + if (!(getFlags() == DictionaryAttr())) { + odsPrinter.printStrippedAttrOrType(getFlags()); + } + } + if (!(getLink() == ArrayAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "link = "; + if (!(getLink() == ArrayAttr())) { + odsPrinter.printStrippedAttrOrType(getLink()); + } + } + } + odsPrinter << ">"; + } else { + } +} + +int ROCDLTargetAttr::getO() const { + return getImpl()->O; +} + +::llvm::StringRef ROCDLTargetAttr::getTriple() const { + return getImpl()->triple; +} + +::llvm::StringRef ROCDLTargetAttr::getChip() const { + return getImpl()->chip; +} + +::llvm::StringRef ROCDLTargetAttr::getFeatures() const { + return getImpl()->features; +} + +::llvm::StringRef ROCDLTargetAttr::getAbi() const { + return getImpl()->abi; +} + +DictionaryAttr ROCDLTargetAttr::getFlags() const { + return getImpl()->flags; +} + +ArrayAttr ROCDLTargetAttr::getLink() const { + return getImpl()->link; +} + +} // namespace ROCDL +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ROCDLTargetAttr) +namespace mlir { +namespace ROCDL { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute ROCDLDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void ROCDLDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace ROCDL +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..09466e942ad2c398f8103a4095494e4120653454 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.h.inc @@ -0,0 +1,56 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace ROCDL { +class ROCDLTargetAttr; +namespace detail { +struct ROCDLTargetAttrStorage; +} // namespace detail +class ROCDLTargetAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + bool hasFlag(StringRef flag) const; + bool hasWave64() const; + bool hasFastMath() const; + bool hasDaz() const; + bool hasFiniteOnly() const; + bool hasUnsafeMath() const; + bool hasCorrectSqrt() const; + using Base::getChecked; + static ROCDLTargetAttr get(::mlir::MLIRContext *context, int optLevel = 2, StringRef triple = "amdgcn-amd-amdhsa", StringRef chip = "gfx900", StringRef features = "", StringRef abiVersion = "400", DictionaryAttr targetFlags = nullptr, ArrayAttr linkFiles = nullptr); + static ROCDLTargetAttr getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int optLevel = 2, StringRef triple = "amdgcn-amd-amdhsa", StringRef chip = "gfx900", StringRef features = "", StringRef abiVersion = "400", DictionaryAttr targetFlags = nullptr, ArrayAttr linkFiles = nullptr); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, int O, ::llvm::StringRef triple, ::llvm::StringRef chip, ::llvm::StringRef features, ::llvm::StringRef abi, DictionaryAttr flags, ArrayAttr link); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"target"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int getO() const; + ::llvm::StringRef getTriple() const; + ::llvm::StringRef getChip() const; + ::llvm::StringRef getFeatures() const; + ::llvm::StringRef getAbi() const; + DictionaryAttr getFlags() const; + ArrayAttr getLink() const; +}; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ROCDLTargetAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..f76d5639366c29cacabb011ab29505fbf9db8f51 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ROCDLOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ROCDLDialect) +namespace mlir { +namespace ROCDL { + +ROCDLDialect::ROCDLDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + initialize(); +} + +ROCDLDialect::~ROCDLDialect() = default; + +} // namespace ROCDL +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..a12894583d2dfa55d4530aec258e2997b7b25219 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.h.inc @@ -0,0 +1,56 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: ROCDLOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace ROCDL { + +class ROCDLDialect : public ::mlir::Dialect { + explicit ROCDLDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~ROCDLDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("rocdl"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Provides a hook for verifying dialect attributes attached to the given + /// op. + ::mlir::LogicalResult verifyOperationAttribute( + ::mlir::Operation *op, ::mlir::NamedAttribute attribute) override; + + /// Get the name of the attribute used to annotate external kernel + /// functions. + static StringRef getKernelFuncAttrName() { return "rocdl.kernel"; } + static constexpr ::llvm::StringLiteral getFlatWorkGroupSizeAttrName() { + return ::llvm::StringLiteral("rocdl.flat_work_group_size"); + } + static constexpr ::llvm::StringLiteral getReqdWorkGroupSizeAttrName() { + return ::llvm::StringLiteral("rocdl.reqd_work_group_size"); + } + + /// The address space value that represents global memory. + static constexpr unsigned kGlobalMemoryAddressSpace = 1; + /// The address space value that represents shared memory. + static constexpr unsigned kSharedMemoryAddressSpace = 3; + /// The address space value that represents private memory. + static constexpr unsigned kPrivateMemoryAddressSpace = 5; + }; +} // namespace ROCDL +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ROCDL::ROCDLDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/AddComdats.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/AddComdats.h new file mode 100644 index 0000000000000000000000000000000000000000..a7bc1a1d286deda5b80949200291e3fc3264ca14 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/AddComdats.h @@ -0,0 +1,26 @@ +//===- AddComdats.h - Add comdats to linkonce functions -*- C++ -*---------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_TRANSFORMS_ADDCOMDATS_H +#define MLIR_DIALECT_LLVMIR_TRANSFORMS_ADDCOMDATS_H + +#include + +namespace mlir { + +class Pass; + +namespace LLVM { + +#define GEN_PASS_DECL_LLVMADDCOMDATS +#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc" + +} // namespace LLVM +} // namespace mlir + +#endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_ADDCOMDATS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h new file mode 100644 index 0000000000000000000000000000000000000000..09f62e1190f29a6d5c93601ef16ef60b139135c3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h @@ -0,0 +1,37 @@ +//===- LegalizeForExport.h - Prepare for translation to LLVM IR -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_TRANSFORMS_LEGALIZEFOREXPORT_H +#define MLIR_DIALECT_LLVMIR_TRANSFORMS_LEGALIZEFOREXPORT_H + +#include + +namespace mlir { +class Operation; +class Pass; + +namespace LLVM { + +#define GEN_PASS_DECL_LLVMLEGALIZEFOREXPORT +#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc" + +/// Make argument-taking successors of each block distinct. PHI nodes in LLVM +/// IR use the predecessor ID to identify which value to take. They do not +/// support different values coming from the same predecessor. If a block has +/// another block as a successor more than once with different values, insert +/// a new dummy block for LLVM PHI nodes to tell the sources apart. +void ensureDistinctSuccessors(Operation *op); + +/// Creates a pass that legalizes the LLVM dialect operations so that they can +/// be translated to LLVM IR. +std::unique_ptr createLegalizeForExportPass(); + +} // namespace LLVM +} // namespace mlir + +#endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_LEGALIZEFOREXPORT_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h new file mode 100644 index 0000000000000000000000000000000000000000..261d2a2389c1649266ad07ce21d54908c71154ab --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h @@ -0,0 +1,28 @@ +//===- OptimizeForNVVM.h - Optimize LLVM IR for NVVM -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_TRANSFORMS_OPTIMIZENVVM_H +#define MLIR_DIALECT_LLVMIR_TRANSFORMS_OPTIMIZENVVM_H + +#include + +namespace mlir { +class Pass; + +namespace NVVM { + +#define GEN_PASS_DECL_NVVMOPTIMIZEFORTARGET +#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc" + +/// Creates a pass that optimizes LLVM IR for the NVVM target. +std::unique_ptr createOptimizeForTargetPass(); + +} // namespace NVVM +} // namespace mlir + +#endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_OPTIMIZENVVM_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..13e10b29c0743cab039b0ccee74c78a286b63b3d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h @@ -0,0 +1,33 @@ +//===- Passes.h - LLVM Pass Construction and Registration -----------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_TRANSFORMS_PASSES_H +#define MLIR_DIALECT_LLVMIR_TRANSFORMS_PASSES_H + +#include "mlir/Dialect/LLVMIR/Transforms/AddComdats.h" +#include "mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h" +#include "mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h" +#include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h" +#include "mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { + +namespace LLVM { + +/// Create a pass to add DIScope to LLVMFuncOp that are missing it. +std::unique_ptr createDIScopeForLLVMFuncOpPass(); + +/// Generate the code for registering conversion passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc" + +} // namespace LLVM +} // namespace mlir + +#endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..d3d199ac652d07e3f650d0d3f5720738ff8fa39f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h.inc @@ -0,0 +1,777 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_DISCOPEFORLLVMFUNCOP +#define GEN_PASS_DECL_LLVMADDCOMDATS +#define GEN_PASS_DECL_LLVMLEGALIZEFOREXPORT +#define GEN_PASS_DECL_LLVMREQUESTCWRAPPERS +#define GEN_PASS_DECL_LLVMTYPECONSISTENCY +#define GEN_PASS_DECL_NVVMOPTIMIZEFORTARGET +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// DIScopeForLLVMFuncOp +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DISCOPEFORLLVMFUNCOP +#undef GEN_PASS_DECL_DISCOPEFORLLVMFUNCOP +#endif // GEN_PASS_DECL_DISCOPEFORLLVMFUNCOP +#ifdef GEN_PASS_DEF_DISCOPEFORLLVMFUNCOP +namespace impl { + +template +class DIScopeForLLVMFuncOpBase : public ::mlir::OperationPass { +public: + using Base = DIScopeForLLVMFuncOpBase; + + DIScopeForLLVMFuncOpBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DIScopeForLLVMFuncOpBase(const DIScopeForLLVMFuncOpBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("ensure-debug-info-scope-on-llvm-func"); + } + ::llvm::StringRef getArgument() const override { return "ensure-debug-info-scope-on-llvm-func"; } + + ::llvm::StringRef getDescription() const override { return "Materialize LLVM debug info subprogram attribute on every LLVMFuncOp"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DIScopeForLLVMFuncOp"); + } + ::llvm::StringRef getName() const override { return "DIScopeForLLVMFuncOp"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DIScopeForLLVMFuncOpBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DISCOPEFORLLVMFUNCOP +#endif // GEN_PASS_DEF_DISCOPEFORLLVMFUNCOP + +//===----------------------------------------------------------------------===// +// LLVMAddComdats +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LLVMADDCOMDATS +std::unique_ptr<::mlir::Pass> createLLVMAddComdats(); +#undef GEN_PASS_DECL_LLVMADDCOMDATS +#endif // GEN_PASS_DECL_LLVMADDCOMDATS +#ifdef GEN_PASS_DEF_LLVMADDCOMDATS + +namespace impl { + std::unique_ptr<::mlir::Pass> createLLVMAddComdats(); +} // namespace impl +namespace impl { + +template +class LLVMAddComdatsBase : public ::mlir::OperationPass<::mlir::ModuleOp> { +public: + using Base = LLVMAddComdatsBase; + + LLVMAddComdatsBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get()) {} + LLVMAddComdatsBase(const LLVMAddComdatsBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-add-comdats"); + } + ::llvm::StringRef getArgument() const override { return "llvm-add-comdats"; } + + ::llvm::StringRef getDescription() const override { return "Add comdats to linkonce and linkonce_odr functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LLVMAddComdats"); + } + ::llvm::StringRef getName() const override { return "LLVMAddComdats"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LLVMAddComdatsBase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createLLVMAddComdats() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createLLVMAddComdats() { + return impl::createLLVMAddComdats(); +} +#undef GEN_PASS_DEF_LLVMADDCOMDATS +#endif // GEN_PASS_DEF_LLVMADDCOMDATS + +//===----------------------------------------------------------------------===// +// LLVMLegalizeForExport +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LLVMLEGALIZEFOREXPORT +#undef GEN_PASS_DECL_LLVMLEGALIZEFOREXPORT +#endif // GEN_PASS_DECL_LLVMLEGALIZEFOREXPORT +#ifdef GEN_PASS_DEF_LLVMLEGALIZEFOREXPORT +namespace impl { + +template +class LLVMLegalizeForExportBase : public ::mlir::OperationPass<> { +public: + using Base = LLVMLegalizeForExportBase; + + LLVMLegalizeForExportBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LLVMLegalizeForExportBase(const LLVMLegalizeForExportBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-legalize-for-export"); + } + ::llvm::StringRef getArgument() const override { return "llvm-legalize-for-export"; } + + ::llvm::StringRef getDescription() const override { return "Legalize LLVM dialect to be convertible to LLVM IR"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LLVMLegalizeForExport"); + } + ::llvm::StringRef getName() const override { return "LLVMLegalizeForExport"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LLVMLegalizeForExportBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LLVMLEGALIZEFOREXPORT +#endif // GEN_PASS_DEF_LLVMLEGALIZEFOREXPORT + +//===----------------------------------------------------------------------===// +// LLVMRequestCWrappers +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LLVMREQUESTCWRAPPERS +#undef GEN_PASS_DECL_LLVMREQUESTCWRAPPERS +#endif // GEN_PASS_DECL_LLVMREQUESTCWRAPPERS +#ifdef GEN_PASS_DEF_LLVMREQUESTCWRAPPERS +namespace impl { + +template +class LLVMRequestCWrappersBase : public ::mlir::OperationPass<::mlir::func::FuncOp> { +public: + using Base = LLVMRequestCWrappersBase; + + LLVMRequestCWrappersBase() : ::mlir::OperationPass<::mlir::func::FuncOp>(::mlir::TypeID::get()) {} + LLVMRequestCWrappersBase(const LLVMRequestCWrappersBase &other) : ::mlir::OperationPass<::mlir::func::FuncOp>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-request-c-wrappers"); + } + ::llvm::StringRef getArgument() const override { return "llvm-request-c-wrappers"; } + + ::llvm::StringRef getDescription() const override { return "Request C wrapper emission for all functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LLVMRequestCWrappers"); + } + ::llvm::StringRef getName() const override { return "LLVMRequestCWrappers"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LLVMRequestCWrappersBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LLVMREQUESTCWRAPPERS +#endif // GEN_PASS_DEF_LLVMREQUESTCWRAPPERS + +//===----------------------------------------------------------------------===// +// LLVMTypeConsistency +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LLVMTYPECONSISTENCY +struct LLVMTypeConsistencyOptions { + unsigned maxVectorSplitSize = 512; +}; +#undef GEN_PASS_DECL_LLVMTYPECONSISTENCY +#endif // GEN_PASS_DECL_LLVMTYPECONSISTENCY +#ifdef GEN_PASS_DEF_LLVMTYPECONSISTENCY +namespace impl { + +template +class LLVMTypeConsistencyBase : public ::mlir::OperationPass<::mlir::LLVM::LLVMFuncOp> { +public: + using Base = LLVMTypeConsistencyBase; + + LLVMTypeConsistencyBase() : ::mlir::OperationPass<::mlir::LLVM::LLVMFuncOp>(::mlir::TypeID::get()) {} + LLVMTypeConsistencyBase(const LLVMTypeConsistencyBase &other) : ::mlir::OperationPass<::mlir::LLVM::LLVMFuncOp>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-type-consistency"); + } + ::llvm::StringRef getArgument() const override { return "llvm-type-consistency"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites to improve type consistency"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LLVMTypeConsistency"); + } + ::llvm::StringRef getName() const override { return "LLVMTypeConsistency"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LLVMTypeConsistencyBase) + + LLVMTypeConsistencyBase(const LLVMTypeConsistencyOptions &options) : LLVMTypeConsistencyBase() { + maxVectorSplitSize = options.maxVectorSplitSize; + } +protected: + ::mlir::Pass::Option maxVectorSplitSize{*this, "max-vector-split-size", ::llvm::cl::desc("Maximum size in bits of a vector value in a load or store operation operating on multiple elements that should still be split"), ::llvm::cl::init(512)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LLVMTYPECONSISTENCY +#endif // GEN_PASS_DEF_LLVMTYPECONSISTENCY + +//===----------------------------------------------------------------------===// +// NVVMOptimizeForTarget +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_NVVMOPTIMIZEFORTARGET +#undef GEN_PASS_DECL_NVVMOPTIMIZEFORTARGET +#endif // GEN_PASS_DECL_NVVMOPTIMIZEFORTARGET +#ifdef GEN_PASS_DEF_NVVMOPTIMIZEFORTARGET +namespace impl { + +template +class NVVMOptimizeForTargetBase : public ::mlir::OperationPass<> { +public: + using Base = NVVMOptimizeForTargetBase; + + NVVMOptimizeForTargetBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + NVVMOptimizeForTargetBase(const NVVMOptimizeForTargetBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-optimize-for-nvvm-target"); + } + ::llvm::StringRef getArgument() const override { return "llvm-optimize-for-nvvm-target"; } + + ::llvm::StringRef getDescription() const override { return "Optimize NVVM IR"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("NVVMOptimizeForTarget"); + } + ::llvm::StringRef getName() const override { return "NVVMOptimizeForTarget"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(NVVMOptimizeForTargetBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_NVVMOPTIMIZEFORTARGET +#endif // GEN_PASS_DEF_NVVMOPTIMIZEFORTARGET +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// DIScopeForLLVMFuncOp Registration +//===----------------------------------------------------------------------===// + +inline void registerDIScopeForLLVMFuncOp() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::LLVM::createDIScopeForLLVMFuncOpPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDIScopeForLLVMFuncOpPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::LLVM::createDIScopeForLLVMFuncOpPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LLVMAddComdats Registration +//===----------------------------------------------------------------------===// + +inline void registerLLVMAddComdats() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLLVMAddComdats(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLLVMAddComdatsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLLVMAddComdats(); + }); +} + +//===----------------------------------------------------------------------===// +// LLVMLegalizeForExport Registration +//===----------------------------------------------------------------------===// + +inline void registerLLVMLegalizeForExport() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::LLVM::createLegalizeForExportPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLLVMLegalizeForExportPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::LLVM::createLegalizeForExportPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LLVMRequestCWrappers Registration +//===----------------------------------------------------------------------===// + +inline void registerLLVMRequestCWrappers() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::LLVM::createRequestCWrappersPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLLVMRequestCWrappersPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::LLVM::createRequestCWrappersPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LLVMTypeConsistency Registration +//===----------------------------------------------------------------------===// + +inline void registerLLVMTypeConsistency() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::LLVM::createTypeConsistencyPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLLVMTypeConsistencyPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::LLVM::createTypeConsistencyPass(); + }); +} + +//===----------------------------------------------------------------------===// +// NVVMOptimizeForTarget Registration +//===----------------------------------------------------------------------===// + +inline void registerNVVMOptimizeForTarget() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::NVVM::createOptimizeForTargetPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerNVVMOptimizeForTargetPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::NVVM::createOptimizeForTargetPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LLVM Registration +//===----------------------------------------------------------------------===// + +inline void registerLLVMPasses() { + registerDIScopeForLLVMFuncOp(); + registerLLVMAddComdats(); + registerLLVMLegalizeForExport(); + registerLLVMRequestCWrappers(); + registerLLVMTypeConsistency(); + registerNVVMOptimizeForTarget(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class DIScopeForLLVMFuncOpBase : public ::mlir::OperationPass { +public: + using Base = DIScopeForLLVMFuncOpBase; + + DIScopeForLLVMFuncOpBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DIScopeForLLVMFuncOpBase(const DIScopeForLLVMFuncOpBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("ensure-debug-info-scope-on-llvm-func"); + } + ::llvm::StringRef getArgument() const override { return "ensure-debug-info-scope-on-llvm-func"; } + + ::llvm::StringRef getDescription() const override { return "Materialize LLVM debug info subprogram attribute on every LLVMFuncOp"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DIScopeForLLVMFuncOp"); + } + ::llvm::StringRef getName() const override { return "DIScopeForLLVMFuncOp"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DIScopeForLLVMFuncOpBase) + +protected: +}; + +template +class LLVMAddComdatsBase : public ::mlir::OperationPass<::mlir::ModuleOp> { +public: + using Base = LLVMAddComdatsBase; + + LLVMAddComdatsBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get()) {} + LLVMAddComdatsBase(const LLVMAddComdatsBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-add-comdats"); + } + ::llvm::StringRef getArgument() const override { return "llvm-add-comdats"; } + + ::llvm::StringRef getDescription() const override { return "Add comdats to linkonce and linkonce_odr functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LLVMAddComdats"); + } + ::llvm::StringRef getName() const override { return "LLVMAddComdats"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LLVMAddComdatsBase) + +protected: +}; + +template +class LLVMLegalizeForExportBase : public ::mlir::OperationPass<> { +public: + using Base = LLVMLegalizeForExportBase; + + LLVMLegalizeForExportBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LLVMLegalizeForExportBase(const LLVMLegalizeForExportBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-legalize-for-export"); + } + ::llvm::StringRef getArgument() const override { return "llvm-legalize-for-export"; } + + ::llvm::StringRef getDescription() const override { return "Legalize LLVM dialect to be convertible to LLVM IR"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LLVMLegalizeForExport"); + } + ::llvm::StringRef getName() const override { return "LLVMLegalizeForExport"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LLVMLegalizeForExportBase) + +protected: +}; + +template +class LLVMRequestCWrappersBase : public ::mlir::OperationPass<::mlir::func::FuncOp> { +public: + using Base = LLVMRequestCWrappersBase; + + LLVMRequestCWrappersBase() : ::mlir::OperationPass<::mlir::func::FuncOp>(::mlir::TypeID::get()) {} + LLVMRequestCWrappersBase(const LLVMRequestCWrappersBase &other) : ::mlir::OperationPass<::mlir::func::FuncOp>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-request-c-wrappers"); + } + ::llvm::StringRef getArgument() const override { return "llvm-request-c-wrappers"; } + + ::llvm::StringRef getDescription() const override { return "Request C wrapper emission for all functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LLVMRequestCWrappers"); + } + ::llvm::StringRef getName() const override { return "LLVMRequestCWrappers"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LLVMRequestCWrappersBase) + +protected: +}; + +template +class LLVMTypeConsistencyBase : public ::mlir::OperationPass<::mlir::LLVM::LLVMFuncOp> { +public: + using Base = LLVMTypeConsistencyBase; + + LLVMTypeConsistencyBase() : ::mlir::OperationPass<::mlir::LLVM::LLVMFuncOp>(::mlir::TypeID::get()) {} + LLVMTypeConsistencyBase(const LLVMTypeConsistencyBase &other) : ::mlir::OperationPass<::mlir::LLVM::LLVMFuncOp>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-type-consistency"); + } + ::llvm::StringRef getArgument() const override { return "llvm-type-consistency"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites to improve type consistency"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LLVMTypeConsistency"); + } + ::llvm::StringRef getName() const override { return "LLVMTypeConsistency"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LLVMTypeConsistencyBase) + +protected: + ::mlir::Pass::Option maxVectorSplitSize{*this, "max-vector-split-size", ::llvm::cl::desc("Maximum size in bits of a vector value in a load or store operation operating on multiple elements that should still be split"), ::llvm::cl::init(512)}; +}; + +template +class NVVMOptimizeForTargetBase : public ::mlir::OperationPass<> { +public: + using Base = NVVMOptimizeForTargetBase; + + NVVMOptimizeForTargetBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + NVVMOptimizeForTargetBase(const NVVMOptimizeForTargetBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("llvm-optimize-for-nvvm-target"); + } + ::llvm::StringRef getArgument() const override { return "llvm-optimize-for-nvvm-target"; } + + ::llvm::StringRef getDescription() const override { return "Optimize NVVM IR"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("NVVMOptimizeForTarget"); + } + ::llvm::StringRef getName() const override { return "NVVMOptimizeForTarget"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(NVVMOptimizeForTargetBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h new file mode 100644 index 0000000000000000000000000000000000000000..c6fd2642e307de77256a184fd3b6e8e12d145bfe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h @@ -0,0 +1,26 @@ +//===- RequestCWrappers.h - Annotate funcs with wrap attributes -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_TRANSFORMS_REQUESTCWRAPPERS_H +#define MLIR_DIALECT_LLVMIR_TRANSFORMS_REQUESTCWRAPPERS_H + +#include + +namespace mlir { +class Pass; + +namespace LLVM { + +#define GEN_PASS_DECL_LLVMREQUESTCWRAPPERS +#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc" + +std::unique_ptr createRequestCWrappersPass(); +} // namespace LLVM +} // namespace mlir + +#endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_REQUESTCWRAPPERS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h new file mode 100644 index 0000000000000000000000000000000000000000..b32ac56d7079c60388f28e8a3566a10338c5c28b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h @@ -0,0 +1,96 @@ +//===- TypeConsistency.h - Rewrites to improve type consistency -----------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Set of rewrites to improve the coherency of types within an LLVM dialect +// program. This will adjust operations around a given pointer so they interpret +// its pointee type as consistently as possible. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LLVMIR_TRANSFORMS_TYPECONSISTENCY_H +#define MLIR_DIALECT_LLVMIR_TRANSFORMS_TYPECONSISTENCY_H + +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { +namespace LLVM { + +#define GEN_PASS_DECL_LLVMTYPECONSISTENCY +#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc" + +/// Creates a pass that adjusts operations operating on pointers so they +/// interpret pointee types as consistently as possible. +std::unique_ptr createTypeConsistencyPass(); + +/// Transforms uses of pointers to a whole struct to uses of pointers to the +/// first element of a struct. This is achieved by inserting a GEP to the first +/// element when possible. +template +class AddFieldGetterToStructDirectUse : public OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(User user, + PatternRewriter &rewriter) const override; +}; + +/// Canonicalizes GEPs of which the base type and the pointer's type hint do not +/// match. This is done by replacing the original GEP into a GEP with the type +/// hint as a base type when an element of the hinted type aligns with the +/// original GEP. +class CanonicalizeAlignedGep : public OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(GEPOp gep, + PatternRewriter &rewriter) const override; +}; + +/// Splits stores which write into multiple adjacent elements of an aggregate +/// through a pointer. Currently, integers and vector are split and stores +/// are generated for every element being stored to in a type-consistent manner. +/// This is done on a best-effort basis. +class SplitStores : public OpRewritePattern { + unsigned maxVectorSplitSize; + +public: + SplitStores(MLIRContext *context, unsigned maxVectorSplitSize) + : OpRewritePattern(context), maxVectorSplitSize(maxVectorSplitSize) {} + + LogicalResult matchAndRewrite(StoreOp store, + PatternRewriter &rewrite) const override; +}; + +/// Transforms type-inconsistent stores, aka stores where the type hint of +/// the address contradicts the value stored, by inserting a bitcast if +/// possible. +class BitcastStores : public OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(StoreOp store, + PatternRewriter &rewriter) const override; +}; + +/// Splits GEPs with more than two indices into multiple GEPs with exactly +/// two indices. The created GEPs are then guaranteed to index into only +/// one aggregate at a time. +class SplitGEP : public OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(GEPOp gepOp, + PatternRewriter &rewriter) const override; +}; + +} // namespace LLVM +} // namespace mlir + +#endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_TYPECONSISTENCY_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/Linalg.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/Linalg.h new file mode 100644 index 0000000000000000000000000000000000000000..85f5ebeb8081ee74654872202b7236044da9dd41 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/Linalg.h @@ -0,0 +1,126 @@ +//===- Linalg.h - Linalg dialect --------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_IR_LINALG_H +#define MLIR_DIALECT_LINALG_IR_LINALG_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/Utils/ReshapeOpsUtils.h" +#include "mlir/Dialect/Utils/StructuredOpsUtils.h" +#include "mlir/IR/AffineExpr.h" +#include "mlir/IR/AffineMap.h" +#include "mlir/IR/BuiltinDialect.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/ImplicitLocOpBuilder.h" +#include "mlir/IR/TypeUtilities.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/CopyOpInterface.h" +#include "mlir/Interfaces/DestinationStyleOpInterface.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" +#include "mlir/Interfaces/TilingInterface.h" +#include "mlir/Interfaces/ViewLikeInterface.h" +#include + +namespace mlir { +namespace linalg { + +class LinalgOp; + +/// Returns the name mangled library call name to disambiguate between different +/// overloads at the C level. The name mangling scheme is basic and uses MLIR +/// type names: +/// 1. form a string which is the concatenation of the linalg op name with all +/// the operand type names, separate by underscores; +/// 2. drop the `linalg.` prefix, and the `<`, `>`, `?` symbols from the type. +/// Assumes `op` is a LinalgOp. +/// +/// Examples: +/// +/// 1. linalg.fill(%f, %A) : f32, memref +/// name mangles into `linalg_fill_f32_viewf32` +/// +/// 2. linalg.dot %A, %B, %C : +/// (memref, +/// memref, memref) +/// name mangles into `linalg_dot_viewxf32_viewxf32_viewf32` +/// +/// 3. linalg.matmul(...) : +/// memref, +/// memref, +/// memref +/// name mangles into `linalg_matmul_viewxxf32_viewxxf32_viewxxf32` +std::string generateLibraryCallName(Operation *op); + +/// Returns `num` AffineDimExpr dimensions at positions +/// [startIdx, startIdx + num) and increments `startIdx` to `startIdx + num`. +SmallVector makeAffineDimExprs(unsigned num, unsigned &startIdx, + MLIRContext *context); + +/// Returns `maybeMap.get()` if `maybeMap` is set, otherwise returns the +/// symbol-less identity map of `rank`. +AffineMap extractOrIdentityMap(std::optional maybeMap, unsigned rank, + MLIRContext *context); + +/// Return the vector that is the concatenation of `a` and `b`. +SmallVector concat(ArrayRef a, + ArrayRef b); + +/// Create one memref::DimOp or tensor::DimOp depending on the type of `val`. +/// This is a polymorphic convenience function to abstract away the rank and +/// concrete type of `val`. +/// Asserts that `val` is a memref or tensor type. +Value createOrFoldDimOp(OpBuilder &b, Location loc, Value val, int64_t dim); + +/// Create one memref::DimOp or tensor::DimOp depending on the type of `val`. +/// This is a polymorphic convenience function to abstract away the rank and +/// concrete type of `val`. +/// Asserts that `val` is a memref or tensor type. +OpFoldResult createFoldedDimOp(OpBuilder &b, Location loc, Value val, + int64_t dim); + +} // namespace linalg +} // namespace mlir + +//===----------------------------------------------------------------------===// +// Linalg Dialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Linalg/IR/LinalgOpsDialect.h.inc" + +//===----------------------------------------------------------------------===// +// Linalg Enums +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Linalg/IR/LinalgOpsEnums.h.inc" + +//===----------------------------------------------------------------------===// +// Linalg Attributes +//===----------------------------------------------------------------------===// + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.h.inc" + +//===----------------------------------------------------------------------===// +// Linalg Interfaces +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Linalg/IR/LinalgInterfaces.h" + +//===----------------------------------------------------------------------===// +// Linalg Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/Linalg/IR/LinalgOps.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc" + +#endif // MLIR_DIALECT_LINALG_IR_LINALG_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..723b32dfbd188c6be371fab9936f6026a23311f7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.cpp.inc @@ -0,0 +1,265 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Method to decompose the operation into simpler operations. +/// +/// On success, this method returns one `Value` per result in the +/// original operation. +/// The order of the returned values must match the order of the +/// original values. +/// In other words, the returned vector can be used directly with +/// `RewriterBase::replaceOp(this, returnedValues)`. +FailureOr> mlir::linalg::AggregatedOpInterface::decomposeOperation(OpBuilder & b) { + return getImpl()->decomposeOperation(getImpl(), getOperation(), b); + } +/// Returns the left-hand side operand. +Value mlir::linalg::ContractionOpInterface::lhs() { + return getImpl()->lhs(getImpl(), getOperation()); + } +/// Returns the right-hand side operand. +Value mlir::linalg::ContractionOpInterface::rhs() { + return getImpl()->rhs(getImpl(), getOperation()); + } +/// Returns whether the given op has indexing maps that correspond to a +/// row-major matmul operation. +bool mlir::linalg::ContractionOpInterface::isRowMajorMatmul() { + return getImpl()->isRowMajorMatmul(getImpl(), getOperation()); + } +/// Returns whether the given op has indexing maps that correspond to a +/// column-major matmul operation. +bool mlir::linalg::ContractionOpInterface::isColumnMajorMatmul() { + return getImpl()->isColumnMajorMatmul(getImpl(), getOperation()); + } +/// Returns whether the given op has indexing maps that correspond to a +/// row-major batch matmul operation. +bool mlir::linalg::ContractionOpInterface::isRowMajorBatchMatmul() { + return getImpl()->isRowMajorBatchMatmul(getImpl(), getOperation()); + } +/// Return the image operand. +Value mlir::linalg::ConvolutionOpInterface::image() { + return getImpl()->image(getImpl(), getOperation()); + } +/// Return the filter operand. +Value mlir::linalg::ConvolutionOpInterface::filter() { + return getImpl()->filter(getImpl(), getOperation()); + } +/// Return the fill value. +Value mlir::linalg::FillOpInterface::value() { + return getImpl()->value(getImpl(), getOperation()); + } +/// Return the output operand. +Value mlir::linalg::FillOpInterface::output() { + return getImpl()->output(getImpl(), getOperation()); + } +/// Return the result. +Value mlir::linalg::FillOpInterface::result() { + return getImpl()->result(getImpl(), getOperation()); + } +/// Return the number of parallel loops. +unsigned mlir::linalg::LinalgOp::getNumParallelLoops() { + return getImpl()->getNumParallelLoops(getImpl(), getOperation()); + } +/// Return the dims that are parallel loops. +void mlir::linalg::LinalgOp::getParallelDims(SmallVectorImpl & res) { + return getImpl()->getParallelDims(getImpl(), getOperation(), res); + } +/// Return the number of reduction loops. +unsigned mlir::linalg::LinalgOp::getNumReductionLoops() { + return getImpl()->getNumReductionLoops(getImpl(), getOperation()); + } +/// Return the dims that are reduction loops. +void mlir::linalg::LinalgOp::getReductionDims(SmallVectorImpl & res) { + return getImpl()->getReductionDims(getImpl(), getOperation(), res); + } +/// Return the total number of loops within the current operation. +unsigned mlir::linalg::LinalgOp::getNumLoops() { + return getImpl()->getNumLoops(getImpl(), getOperation()); + } +/// Returns true if the current operation has only one loop and it's a +/// reduction loop. +bool mlir::linalg::LinalgOp::hasSingleReductionLoop() { + return getImpl()->hasSingleReductionLoop(getImpl(), getOperation()); + } +/// Return true if the payload uses the value loaded from `opOperand`. This +/// is useful to avoid loading from "write-only" memory that may be +/// uninitialized, as well as properly cloning "read-write" operands. +bool mlir::linalg::LinalgOp::payloadUsesValueFromOperand(OpOperand * opOperand) { + return getImpl()->payloadUsesValueFromOperand(getImpl(), getOperation(), opOperand); + } +/// Return true if `opOperand` is an init tensor. This is true when it is +/// an output tensor operand whose value is used in the payload region. +bool mlir::linalg::LinalgOp::isInitTensor(OpOperand * opOperand) { + return getImpl()->isInitTensor(getImpl(), getOperation(), opOperand); + } +/// Return the `opOperand` rank or zero for scalars. +int64_t mlir::linalg::LinalgOp::getRank(OpOperand* opOperand) { + return getImpl()->getRank(getImpl(), getOperation(), opOperand); + } +/// Return the input block arguments of the region. +Block::BlockArgListType mlir::linalg::LinalgOp::getRegionInputArgs() { + return getImpl()->getRegionInputArgs(getImpl(), getOperation()); + } +/// Return the output block arguments of the region. +Block::BlockArgListType mlir::linalg::LinalgOp::getRegionOutputArgs() { + return getImpl()->getRegionOutputArgs(getImpl(), getOperation()); + } +/// Return the `opOperand` shape or an empty vector for scalars. +ArrayRef mlir::linalg::LinalgOp::getShape(OpOperand* opOperand) { + return getImpl()->getShape(getImpl(), getOperation(), opOperand); + } +/// Return the block argument for an `opOperand`. +BlockArgument mlir::linalg::LinalgOp::getMatchingBlockArgument(OpOperand * opOperand) { + return getImpl()->getMatchingBlockArgument(getImpl(), getOperation(), opOperand); + } +/// Return the operand for a `blockArgument`. +OpOperand *mlir::linalg::LinalgOp::getMatchingOpOperand(BlockArgument blockArgument) { + return getImpl()->getMatchingOpOperand(getImpl(), getOperation(), blockArgument); + } +/// Return the input or output indexing map for `opOperand`. +AffineMap mlir::linalg::LinalgOp::getMatchingIndexingMap(OpOperand* opOperand) { + return getImpl()->getMatchingIndexingMap(getImpl(), getOperation(), opOperand); + } +/// Return the indexing map for a `result`. +AffineMap mlir::linalg::LinalgOp::getIndexingMapMatchingResult(OpResult result) { + return getImpl()->getIndexingMapMatchingResult(getImpl(), getOperation(), result); + } +/// Return the value yielded by the region corresponding to an output +/// `opOperand`. +OpOperand *mlir::linalg::LinalgOp::getMatchingYieldValue(OpOperand* opOperand) { + return getImpl()->getMatchingYieldValue(getImpl(), getOperation(), opOperand); + } +/// Return the single block constituting the body of the operation by +/// calling the getBody method on the concrete operation. +Block*mlir::linalg::LinalgOp::getBlock() { + return getImpl()->getBlock(getImpl(), getOperation()); + } +/// Return iterator types in the current operation. +/// +/// Default implementation assumes that the operation has an attribute +/// `iterator_types`, but it's not always the case. Sometimes iterator types +/// can be infered from other parameters and in such cases default +/// getIteratorTypesArray should be overriden. +SmallVector mlir::linalg::LinalgOp::getIteratorTypesArray() { + return getImpl()->getIteratorTypesArray(getImpl(), getOperation()); + } +/// Return true if the indexing map is depending on the current op instance. +/// This means that the indexing map is dynamically synthesized by using the +/// op instance's concrete attributes, instead of being static for all +/// instances of the same op kind. +bool mlir::linalg::LinalgOp::hasDynamicIndexingMaps() { + return getImpl()->hasDynamicIndexingMaps(getImpl(), getOperation()); + } +/// Verify all attributes used by indexing maps are valid. +LogicalResult mlir::linalg::LinalgOp::verifyIndexingMapRequiredAttributes() { + return getImpl()->verifyIndexingMapRequiredAttributes(getImpl(), getOperation()); + } +/// Return the indexing maps attribute within the current operation. +ArrayAttr mlir::linalg::LinalgOp::getIndexingMaps() { + return getImpl()->getIndexingMaps(getImpl(), getOperation()); + } +/// Return the indexing maps within the current operation. +SmallVector mlir::linalg::LinalgOp::getIndexingMapsArray() { + return getImpl()->getIndexingMapsArray(getImpl(), getOperation()); + } +/// Return true if any of the operands has a dynamic shape. +bool mlir::linalg::LinalgOp::hasDynamicShape() { + return getImpl()->hasDynamicShape(getImpl(), getOperation()); + } +/// Return the name registered for this op when lowering to an external +/// library call. +std::string mlir::linalg::LinalgOp::getLibraryCallName() { + return getImpl()->getLibraryCallName(getImpl(), getOperation()); + } +/// Return whether the op accesses the iteration indices. +bool mlir::linalg::LinalgOp::hasIndexSemantics() { + return getImpl()->hasIndexSemantics(getImpl(), getOperation()); + } +/// Return op operands that have a corresponding argument in the basic block. +/// By default, the block should have an argument for each operand, but there +/// are expection. For example, in `map` output operand isn't used in +/// the block. +::llvm::SmallVector mlir::linalg::LinalgOp::getOpOperandsMatchingBBargs() { + return getImpl()->getOpOperandsMatchingBBargs(getImpl(), getOperation()); + } +/// Given a dimension of the iteration space of a Linalg operation, finds an +/// operand in the operation that is defined on such dimension. Returns +/// whether such operand was found or not. If found, also returns the +/// operand value and the dimension position within the operand. +LogicalResult mlir::linalg::LinalgOp::mapIterationSpaceDimToOperandDim(unsigned dimPos, ::mlir::Value & operand, unsigned & operandDimPos) { + return getImpl()->mapIterationSpaceDimToOperandDim(getImpl(), getOperation(), dimPos, operand, operandDimPos); + } +/// Given a dimension of the iteration space of a Linalg operation, finds +/// all the operands in the operation that are defined on such dimension. +/// Returns all the operand values found and their dimension positions in +/// `operandDimPairs`. +void mlir::linalg::LinalgOp::mapIterationSpaceDimToAllOperandDims(unsigned dimPos, mlir::SmallVectorImpl>& operandDimPairs) { + return getImpl()->mapIterationSpaceDimToAllOperandDims(getImpl(), getOperation(), dimPos, operandDimPairs); + } +/// Hook to provide a custom AffineMap used to compute all the operand +/// subshapes given loop bounds. This is used to answer the question: "given +/// an iteration space over the codomain, what are the subshapes of the +/// operands involved in the computation". +/// The default behavior is to just concatenate all the indexing maps. +/// A custom AffineMap allows providing a map that can be used to +/// compute subshapes even in cases where the concatenation of indexing maps +/// (i.e. the data traversal order) is not a simple permutation of the loop +/// traversal order. It is then possible to define ops with skewed data +/// traversal order for which we can still easily compute hyperrectangular +/// loop bounds and subviews. +AffineMap mlir::linalg::LinalgOp::getLoopsToShapesMap() { + return getImpl()->getLoopsToShapesMap(getImpl(), getOperation()); + } +/// Hook to provide a custom AffineMap used to construct the +/// hyperrectangular loop iteration space given all the operand subshapes. +/// This is used to answer the question: +/// "Given a list of operand ranges, what is the subportion of the iteration +/// space involved in the computation". +/// This is the inverse problem of `getLoopsToShapesMap`. +/// Return the empty AffineMap when such an AffineMap cannot be constructed. +/// The default behavior is based on a very simple inference procedure that +/// only works with permutation affine maps. +/// A more advanced Tensor-Comprehension like inference is possible but has +/// proven to be ambiguous in unfavorable case. +/// A safer and more robust alternative is to allow each op to define +/// its own AffineMap. +AffineMap mlir::linalg::LinalgOp::getShapesToLoopsMap() { + return getImpl()->getShapesToLoopsMap(getImpl(), getOperation()); + } +/// Checks if the given operands can be dropped, and the remaining +/// operands can still compute the bounds of the op. +bool mlir::linalg::LinalgOp::canOpOperandsBeDropped(ArrayRef droppedOperands) { + return getImpl()->canOpOperandsBeDropped(getImpl(), getOperation(), droppedOperands); + } +/// Like `getShape`, but only returns statically-known information, without +/// generating any new IR. For each shape dimension, returns >=0 if that +/// dimension is statically known, or ShapedType::kDynamic otherwise. +SmallVector mlir::linalg::LinalgOp::getStaticShape() { + return getImpl()->getStaticShape(getImpl(), getOperation()); + } +/// Returns the statically-known loop ranges. Composes +/// `getShapesToLoopsMap()` with the result of `getStaticShape`. +/// Returns ShapedType::kDynamic for non-statically-known loop ranges. +/// This is expected to be called by a valid Linalg op +SmallVector mlir::linalg::LinalgOp::getStaticLoopRanges() { + return getImpl()->getStaticLoopRanges(getImpl(), getOperation()); + } +/// Returns the region builder for constructing the body for linalg.generic. +/// Returns a null function if this named op does not define a region +/// builder. +std::function)> mlir::linalg::LinalgOp::getRegionBuilder() { + return getImpl()->getRegionBuilder(); + } +/// Return true if all the indexing maps are projected permutations. +/// Otherwise return false. +bool mlir::linalg::LinalgOp::hasOnlyProjectedPermutations() { + return getImpl()->hasOnlyProjectedPermutations(getImpl(), getOperation()); + } +/// Return start and end indices of the init operands range. +::mlir::MutableOperandRange mlir::linalg::LinalgOp::getDpsInitsMutable() { + return getImpl()->implDestinationStyleOpInterface->getDpsInitsMutable(getImpl()->implDestinationStyleOpInterface, getOperation()); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h new file mode 100644 index 0000000000000000000000000000000000000000..f6ba6586a81a24466b2a00a8b3aaa820dcfaa5aa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h @@ -0,0 +1,186 @@ +//===- LinalgInterface.h - Linalg operations interfaces -------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements the operation interfaces for Linalg operations. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_IR_LINALGINTERFACES_H_ +#define MLIR_DIALECT_LINALG_IR_LINALGINTERFACES_H_ + +#include "mlir/Dialect/Utils/StructuredOpsUtils.h" +#include "mlir/IR/AffineMap.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/IRMapping.h" +#include "mlir/IR/ImplicitLocOpBuilder.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/DestinationStyleOpInterface.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/ViewLikeInterface.h" +#include "mlir/Support/RawOstreamExtras.h" + +namespace mlir { +namespace linalg { +class IteratorTypeAttr; +class LinalgOp; + +namespace detail { +/// Implementation of the method that check if given operands +/// can be dropped, i.e. the remaining operands can compute the loop +/// bounds of the op. +bool canOpOperandsBeDroppedImpl(linalg::LinalgOp linalgOp, + ArrayRef droppedOperands); +} // namespace detail + +/// Positions of a Linalg op loops that correspond to different kinds of a +/// contraction dimension. +struct ContractionDimensions { + SmallVector batch; + SmallVector m; + SmallVector n; + SmallVector k; +}; + +/// Find at least 2 parallel (m and n) and 1 reduction (k) dimension candidates +/// that form a matmul subcomputation within `linalgOp`. +/// These dimensions are such that: +/// 1. The m dimension is involved in an outer-product along LHS +/// (i.e. it is a permutation on RES and LHS and does not appear in RHS). +/// 2. The n dimension is involved in an outer-product along RHS +/// (i.e. it is a permutation on RES and RHS and does not appear in LHS). +/// 3. The k dimension appears as a permutation on LHS and RHS. +/// 4. m, n and k appear only once in any given indexing. +/// 5. Optional batch dimensions that appear in all operands are captured. +/// This allows e.g. detecting that some contraction is embedded within +/// `linalgOp` with some orthogonal heuristic. +/// When multiple dimension occurrences exist that match `batch`, `m`, `n`, or +/// `k`, indices are returned in sorted order. +/// Returns a failure if any of `m`, `n` or `k` is empty. +FailureOr inferContractionDims(LinalgOp linalgOp); + +/// Checks whether `linalgOp` conforms to ContractionOpInterface. +// TODO: embed within `isa` if possible / natural. +bool isaContractionOpInterface(LinalgOp linalgOp); + +/// Positions of a Linalg op loops that correspond to different kinds of a +/// convolution dimension. +struct ConvolutionDimensions { + SmallVector batch; + SmallVector outputImage; + SmallVector outputChannel; + SmallVector filterLoop; + SmallVector inputChannel; + SmallVector depth; + SmallVector strides; + SmallVector dilations; +}; + +/// Find at least 1 parallel (output_image) and reduction (filter_loop) +/// dimension candidates that form a convolution subcomputation within +/// `linalgOp`. The LHS is assumed to be the convolution input while the +/// RHS is assumed as the filter. +/// These dimensions are such that: +/// 1. Optional batch dimensions that appear in the input and filter. +/// 2. The output_image dimension is involved in a cross-correlation along LHS +/// (i.e. it is a permutation on RES and LHS and has an associated +/// filter_loop in RHS). +/// 3. Optional output_channel dimension is involved in an outer-product along +/// RHS (i.e. it is a permutation on RES and RHS and does not appear in +/// LHS). +/// 4. Optional input_channel dimension appears as a permutation on LHS and +/// RHS. +/// 5. The filter_loop dimension appears as a permutation on the RHS and +/// represents the shape of the kernel cross-correlated along a +/// corresponding output_image dim. +/// 6. The input_channel dimension appears as a permutation on LHS and RHS. +/// 7. All dimensions appear only once in any given indexing map. +/// This allows e.g. detecting that some convolution is embedded within +/// `linalgOp` with some orthogonal heuristic. +/// When multiple dimension occurrences exist that match any classification +/// indices are returned in sorted order. +/// Returns a failure if `output_image` (and implicitly `filter_loop`) is empty. +FailureOr inferConvolutionDims(LinalgOp linalgOp); + +/// Checks whether `linalgOp` conforms to ConvolutionOpInterface. +// TODO: embed within `isa` if possible / natural. +bool isaConvolutionOpInterface(LinalgOp linalgOp); + +namespace detail { + +/// Returns true if the block contains a contraction of the following form: +/// +/// %0 = (permutation-of(cu(block-argument-0), +/// cu(block-argument-1))) +/// %1 = (permutation-of(cu(%0), cu(block-argument-2))) +/// return-like cu(%1) +/// +/// where and are binary operations constituting a +/// contraction (in the canonical case, is a multiplication and +/// is an addition). The name and other properties of these operations +/// are checked by `isaPair`. All operands of all operations may be supplied +/// through a chain of side effect-free unary operations, such as casts, which +/// is denoted as `cu` above. +/// +/// When the body does not contain a contraction, a more precise description of +/// the failed precondition is send to the `errs` stream, if provided. +bool isContractionBody(Block &block, + function_ref isaPair, + llvm::raw_ostream &errs = mlir::thread_safe_nulls()); + +/// Result of matching a Linalg generic against the predicates of it being a +/// contraction. +enum class MatchContractionResult; + +/// Checks whether `op` conforms to ContractionOpInterface and populates +/// `dimensions` with indexes of the different kinds of dimensions when +/// present. +MatchContractionResult +isContractionInterfaceImpl(Operation *op, + ContractionDimensions *dimensions = nullptr); + +/// Returns the error message corresponding to the contraction checking return +/// code. +StringRef getMatchContractionMessage(MatchContractionResult res); + +/// Result of matching a Linalg generic against the predicates of it being a +/// convolution. +enum class MatchConvolutionResult; + +/// Checks whether `op` conforms to ConvolutionOpInterface and populates +/// `dimensions` with indexes of the different kinds of dimensions when +/// present. +MatchConvolutionResult +isConvolutionInterfaceImpl(Operation *op, + ConvolutionDimensions *dimensions = nullptr); + +/// Returns the error message corresponding to the convolution checking return +/// code. +StringRef getMatchConvolutionMessage(MatchConvolutionResult res); + +/// Verify that `op` conforms to ContractionOpInterface. +LogicalResult verifyContractionInterface(Operation *op); + +/// Verify that `op` conforms to the ConvolutionOpInterface. +LogicalResult verifyConvolutionInterface(Operation *op); + +/// Verify that `op` conforms to the FillOpInterface. +LogicalResult verifyFillInterface(Operation *op); + +/// Verify that `op` conforms to the invariants of StructuredOpInterface +LogicalResult verifyStructuredOpInterface(Operation *op); + +} // namespace detail +} // namespace linalg +} // namespace mlir + +#include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc" + +/// Include the generated interface declarations. +#include "mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc" + +#endif // MLIR_DIALECT_LINALG_IR_LINALGINTERFACES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..8fa3ef55376da3c230731605af35228f5d359593 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc @@ -0,0 +1,1676 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace linalg { +class ContractionOpInterface; +namespace detail { +struct ContractionOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + Value (*lhs)(const Concept *impl, ::mlir::Operation *); + Value (*rhs)(const Concept *impl, ::mlir::Operation *); + bool (*isRowMajorMatmul)(const Concept *impl, ::mlir::Operation *); + bool (*isColumnMajorMatmul)(const Concept *impl, ::mlir::Operation *); + bool (*isRowMajorBatchMatmul)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::linalg::ContractionOpInterface; + Model() : Concept{lhs, rhs, isRowMajorMatmul, isColumnMajorMatmul, isRowMajorBatchMatmul} {} + + static inline Value lhs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Value rhs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isRowMajorMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isColumnMajorMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isRowMajorBatchMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::linalg::ContractionOpInterface; + FallbackModel() : Concept{lhs, rhs, isRowMajorMatmul, isColumnMajorMatmul, isRowMajorBatchMatmul} {} + + static inline Value lhs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Value rhs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isRowMajorMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isColumnMajorMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isRowMajorBatchMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + }; +};template +struct ContractionOpInterfaceTrait; + +} // namespace detail +class ContractionOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::ContractionOpInterfaceTrait {}; + /// Returns the left-hand side operand. + Value lhs(); + /// Returns the right-hand side operand. + Value rhs(); + /// Returns whether the given op has indexing maps that correspond to a + /// row-major matmul operation. + bool isRowMajorMatmul(); + /// Returns whether the given op has indexing maps that correspond to a + /// column-major matmul operation. + bool isColumnMajorMatmul(); + /// Returns whether the given op has indexing maps that correspond to a + /// row-major batch matmul operation. + bool isRowMajorBatchMatmul(); +}; +namespace detail { + template + struct ContractionOpInterfaceTrait : public ::mlir::OpInterface::Trait { + static ::mlir::LogicalResult verifyRegionTrait(::mlir::Operation *op) { + return detail::verifyContractionInterface(op); + } + }; +}// namespace detail +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class ConvolutionOpInterface; +namespace detail { +struct ConvolutionOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + Value (*image)(const Concept *impl, ::mlir::Operation *); + Value (*filter)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::linalg::ConvolutionOpInterface; + Model() : Concept{image, filter} {} + + static inline Value image(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Value filter(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::linalg::ConvolutionOpInterface; + FallbackModel() : Concept{image, filter} {} + + static inline Value image(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Value filter(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + Value image(::mlir::Operation *tablegen_opaque_val) const; + Value filter(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct ConvolutionOpInterfaceTrait; + +} // namespace detail +class ConvolutionOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::ConvolutionOpInterfaceTrait {}; + /// Return the image operand. + Value image(); + /// Return the filter operand. + Value filter(); +}; +namespace detail { + template + struct ConvolutionOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Return the image operand. + Value image() { + return (*static_cast(this)).getOperation()->getOperand(0); + } + /// Return the filter operand. + Value filter() { + return (*static_cast(this)).getOperation()->getOperand(1); + } + static ::mlir::LogicalResult verifyTrait(::mlir::Operation *op) { + return detail::verifyConvolutionInterface(op); + } + }; +}// namespace detail +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class FillOpInterface; +namespace detail { +struct FillOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + Value (*value)(const Concept *impl, ::mlir::Operation *); + Value (*output)(const Concept *impl, ::mlir::Operation *); + Value (*result)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::linalg::FillOpInterface; + Model() : Concept{value, output, result} {} + + static inline Value value(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Value output(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Value result(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::linalg::FillOpInterface; + FallbackModel() : Concept{value, output, result} {} + + static inline Value value(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Value output(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Value result(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + Value value(::mlir::Operation *tablegen_opaque_val) const; + Value output(::mlir::Operation *tablegen_opaque_val) const; + Value result(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct FillOpInterfaceTrait; + +} // namespace detail +class FillOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::FillOpInterfaceTrait {}; + /// Return the fill value. + Value value(); + /// Return the output operand. + Value output(); + /// Return the result. + Value result(); +}; +namespace detail { + template + struct FillOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Return the fill value. + Value value() { + return (*static_cast(this)).getOperation()->getOperand(0); + } + /// Return the output operand. + Value output() { + return (*static_cast(this)).getOperation()->getOperand(1); + } + /// Return the result. + Value result() { + if ((*static_cast(this)).getOperation()->getResults().empty()) + return nullptr; + return (*static_cast(this)).getOperation()->getResults().front(); + } + static ::mlir::LogicalResult verifyTrait(::mlir::Operation *op) { + return detail::verifyFillInterface(op); + } + }; +}// namespace detail +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class LinalgOp; +namespace detail { +struct LinalgOpInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + unsigned (*getNumParallelLoops)(const Concept *impl, ::mlir::Operation *); + void (*getParallelDims)(const Concept *impl, ::mlir::Operation *, SmallVectorImpl &); + unsigned (*getNumReductionLoops)(const Concept *impl, ::mlir::Operation *); + void (*getReductionDims)(const Concept *impl, ::mlir::Operation *, SmallVectorImpl &); + unsigned (*getNumLoops)(const Concept *impl, ::mlir::Operation *); + bool (*hasSingleReductionLoop)(const Concept *impl, ::mlir::Operation *); + bool (*payloadUsesValueFromOperand)(const Concept *impl, ::mlir::Operation *, OpOperand *); + bool (*isInitTensor)(const Concept *impl, ::mlir::Operation *, OpOperand *); + int64_t (*getRank)(const Concept *impl, ::mlir::Operation *, OpOperand*); + Block::BlockArgListType (*getRegionInputArgs)(const Concept *impl, ::mlir::Operation *); + Block::BlockArgListType (*getRegionOutputArgs)(const Concept *impl, ::mlir::Operation *); + ArrayRef (*getShape)(const Concept *impl, ::mlir::Operation *, OpOperand*); + BlockArgument (*getMatchingBlockArgument)(const Concept *impl, ::mlir::Operation *, OpOperand *); + OpOperand *(*getMatchingOpOperand)(const Concept *impl, ::mlir::Operation *, BlockArgument); + AffineMap (*getMatchingIndexingMap)(const Concept *impl, ::mlir::Operation *, OpOperand*); + AffineMap (*getIndexingMapMatchingResult)(const Concept *impl, ::mlir::Operation *, OpResult); + OpOperand *(*getMatchingYieldValue)(const Concept *impl, ::mlir::Operation *, OpOperand*); + Block*(*getBlock)(const Concept *impl, ::mlir::Operation *); + SmallVector (*getIteratorTypesArray)(const Concept *impl, ::mlir::Operation *); + bool (*hasDynamicIndexingMaps)(const Concept *impl, ::mlir::Operation *); + LogicalResult (*verifyIndexingMapRequiredAttributes)(const Concept *impl, ::mlir::Operation *); + ArrayAttr (*getIndexingMaps)(const Concept *impl, ::mlir::Operation *); + SmallVector (*getIndexingMapsArray)(const Concept *impl, ::mlir::Operation *); + bool (*hasDynamicShape)(const Concept *impl, ::mlir::Operation *); + std::string (*getLibraryCallName)(const Concept *impl, ::mlir::Operation *); + bool (*hasIndexSemantics)(const Concept *impl, ::mlir::Operation *); + ::llvm::SmallVector (*getOpOperandsMatchingBBargs)(const Concept *impl, ::mlir::Operation *); + LogicalResult (*mapIterationSpaceDimToOperandDim)(const Concept *impl, ::mlir::Operation *, unsigned, ::mlir::Value &, unsigned &); + void (*mapIterationSpaceDimToAllOperandDims)(const Concept *impl, ::mlir::Operation *, unsigned, mlir::SmallVectorImpl>&); + AffineMap (*getLoopsToShapesMap)(const Concept *impl, ::mlir::Operation *); + AffineMap (*getShapesToLoopsMap)(const Concept *impl, ::mlir::Operation *); + bool (*canOpOperandsBeDropped)(const Concept *impl, ::mlir::Operation *, ArrayRef); + SmallVector (*getStaticShape)(const Concept *impl, ::mlir::Operation *); + SmallVector (*getStaticLoopRanges)(const Concept *impl, ::mlir::Operation *); + std::function)> (*getRegionBuilder)(); + bool (*hasOnlyProjectedPermutations)(const Concept *impl, ::mlir::Operation *); + /// The base classes of this interface. + const ::mlir::DestinationStyleOpInterface::Concept *implDestinationStyleOpInterface = nullptr; + + void initializeInterfaceConcept(::mlir::detail::InterfaceMap &interfaceMap) { + implDestinationStyleOpInterface = interfaceMap.lookup<::mlir::DestinationStyleOpInterface>(); + assert(implDestinationStyleOpInterface && "`::mlir::linalg::LinalgOp` expected its base interface `::mlir::DestinationStyleOpInterface` to be registered"); + } + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::linalg::LinalgOp; + Model() : Concept{getNumParallelLoops, getParallelDims, getNumReductionLoops, getReductionDims, getNumLoops, hasSingleReductionLoop, payloadUsesValueFromOperand, isInitTensor, getRank, getRegionInputArgs, getRegionOutputArgs, getShape, getMatchingBlockArgument, getMatchingOpOperand, getMatchingIndexingMap, getIndexingMapMatchingResult, getMatchingYieldValue, getBlock, getIteratorTypesArray, hasDynamicIndexingMaps, verifyIndexingMapRequiredAttributes, getIndexingMaps, getIndexingMapsArray, hasDynamicShape, getLibraryCallName, hasIndexSemantics, getOpOperandsMatchingBBargs, mapIterationSpaceDimToOperandDim, mapIterationSpaceDimToAllOperandDims, getLoopsToShapesMap, getShapesToLoopsMap, canOpOperandsBeDropped, getStaticShape, getStaticLoopRanges, getRegionBuilder, hasOnlyProjectedPermutations} {} + + static inline unsigned getNumParallelLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void getParallelDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, SmallVectorImpl & res); + static inline unsigned getNumReductionLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void getReductionDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, SmallVectorImpl & res); + static inline unsigned getNumLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasSingleReductionLoop(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool payloadUsesValueFromOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand); + static inline bool isInitTensor(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand); + static inline int64_t getRank(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand); + static inline Block::BlockArgListType getRegionInputArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Block::BlockArgListType getRegionOutputArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ArrayRef getShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand); + static inline BlockArgument getMatchingBlockArgument(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand); + static inline OpOperand *getMatchingOpOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, BlockArgument blockArgument); + static inline AffineMap getMatchingIndexingMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand); + static inline AffineMap getIndexingMapMatchingResult(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpResult result); + static inline OpOperand *getMatchingYieldValue(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand); + static inline Block*getBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector getIteratorTypesArray(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasDynamicIndexingMaps(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline LogicalResult verifyIndexingMapRequiredAttributes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ArrayAttr getIndexingMaps(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector getIndexingMapsArray(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasDynamicShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline std::string getLibraryCallName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasIndexSemantics(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::llvm::SmallVector getOpOperandsMatchingBBargs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline LogicalResult mapIterationSpaceDimToOperandDim(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned dimPos, ::mlir::Value & operand, unsigned & operandDimPos); + static inline void mapIterationSpaceDimToAllOperandDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned dimPos, mlir::SmallVectorImpl>& operandDimPairs); + static inline AffineMap getLoopsToShapesMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline AffineMap getShapesToLoopsMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool canOpOperandsBeDropped(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ArrayRef droppedOperands); + static inline SmallVector getStaticShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector getStaticLoopRanges(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline std::function)> getRegionBuilder(); + static inline bool hasOnlyProjectedPermutations(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::linalg::LinalgOp; + FallbackModel() : Concept{getNumParallelLoops, getParallelDims, getNumReductionLoops, getReductionDims, getNumLoops, hasSingleReductionLoop, payloadUsesValueFromOperand, isInitTensor, getRank, getRegionInputArgs, getRegionOutputArgs, getShape, getMatchingBlockArgument, getMatchingOpOperand, getMatchingIndexingMap, getIndexingMapMatchingResult, getMatchingYieldValue, getBlock, getIteratorTypesArray, hasDynamicIndexingMaps, verifyIndexingMapRequiredAttributes, getIndexingMaps, getIndexingMapsArray, hasDynamicShape, getLibraryCallName, hasIndexSemantics, getOpOperandsMatchingBBargs, mapIterationSpaceDimToOperandDim, mapIterationSpaceDimToAllOperandDims, getLoopsToShapesMap, getShapesToLoopsMap, canOpOperandsBeDropped, getStaticShape, getStaticLoopRanges, getRegionBuilder, hasOnlyProjectedPermutations} {} + + static inline unsigned getNumParallelLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void getParallelDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, SmallVectorImpl & res); + static inline unsigned getNumReductionLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void getReductionDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, SmallVectorImpl & res); + static inline unsigned getNumLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasSingleReductionLoop(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool payloadUsesValueFromOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand); + static inline bool isInitTensor(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand); + static inline int64_t getRank(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand); + static inline Block::BlockArgListType getRegionInputArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline Block::BlockArgListType getRegionOutputArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ArrayRef getShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand); + static inline BlockArgument getMatchingBlockArgument(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand); + static inline OpOperand *getMatchingOpOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, BlockArgument blockArgument); + static inline AffineMap getMatchingIndexingMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand); + static inline AffineMap getIndexingMapMatchingResult(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpResult result); + static inline OpOperand *getMatchingYieldValue(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand); + static inline Block*getBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector getIteratorTypesArray(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasDynamicIndexingMaps(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline LogicalResult verifyIndexingMapRequiredAttributes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ArrayAttr getIndexingMaps(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector getIndexingMapsArray(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasDynamicShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline std::string getLibraryCallName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool hasIndexSemantics(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::llvm::SmallVector getOpOperandsMatchingBBargs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline LogicalResult mapIterationSpaceDimToOperandDim(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned dimPos, ::mlir::Value & operand, unsigned & operandDimPos); + static inline void mapIterationSpaceDimToAllOperandDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned dimPos, mlir::SmallVectorImpl>& operandDimPairs); + static inline AffineMap getLoopsToShapesMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline AffineMap getShapesToLoopsMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool canOpOperandsBeDropped(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ArrayRef droppedOperands); + static inline SmallVector getStaticShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector getStaticLoopRanges(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline std::function)> getRegionBuilder(); + static inline bool hasOnlyProjectedPermutations(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + unsigned getNumParallelLoops(::mlir::Operation *tablegen_opaque_val) const; + void getParallelDims(::mlir::Operation *tablegen_opaque_val, SmallVectorImpl &res) const; + unsigned getNumReductionLoops(::mlir::Operation *tablegen_opaque_val) const; + void getReductionDims(::mlir::Operation *tablegen_opaque_val, SmallVectorImpl &res) const; + unsigned getNumLoops(::mlir::Operation *tablegen_opaque_val) const; + bool hasSingleReductionLoop(::mlir::Operation *tablegen_opaque_val) const; + bool payloadUsesValueFromOperand(::mlir::Operation *tablegen_opaque_val, OpOperand *opOperand) const; + bool isInitTensor(::mlir::Operation *tablegen_opaque_val, OpOperand *opOperand) const; + int64_t getRank(::mlir::Operation *tablegen_opaque_val, OpOperand*opOperand) const; + Block::BlockArgListType getRegionInputArgs(::mlir::Operation *tablegen_opaque_val) const; + Block::BlockArgListType getRegionOutputArgs(::mlir::Operation *tablegen_opaque_val) const; + ArrayRef getShape(::mlir::Operation *tablegen_opaque_val, OpOperand*opOperand) const; + BlockArgument getMatchingBlockArgument(::mlir::Operation *tablegen_opaque_val, OpOperand *opOperand) const; + OpOperand *getMatchingOpOperand(::mlir::Operation *tablegen_opaque_val, BlockArgument blockArgument) const; + AffineMap getMatchingIndexingMap(::mlir::Operation *tablegen_opaque_val, OpOperand*opOperand) const; + AffineMap getIndexingMapMatchingResult(::mlir::Operation *tablegen_opaque_val, OpResult result) const; + OpOperand *getMatchingYieldValue(::mlir::Operation *tablegen_opaque_val, OpOperand*opOperand) const; + Block*getBlock(::mlir::Operation *tablegen_opaque_val) const; + SmallVector getIteratorTypesArray(::mlir::Operation *tablegen_opaque_val) const; + bool hasDynamicIndexingMaps(::mlir::Operation *tablegen_opaque_val) const; + LogicalResult verifyIndexingMapRequiredAttributes(::mlir::Operation *tablegen_opaque_val) const; + SmallVector getIndexingMapsArray(::mlir::Operation *tablegen_opaque_val) const; + bool hasDynamicShape(::mlir::Operation *tablegen_opaque_val) const; + std::string getLibraryCallName(::mlir::Operation *tablegen_opaque_val) const; + ::llvm::SmallVector getOpOperandsMatchingBBargs(::mlir::Operation *tablegen_opaque_val) const; + LogicalResult mapIterationSpaceDimToOperandDim(::mlir::Operation *tablegen_opaque_val, unsigned dimPos, ::mlir::Value &operand, unsigned &operandDimPos) const; + void mapIterationSpaceDimToAllOperandDims(::mlir::Operation *tablegen_opaque_val, unsigned dimPos, mlir::SmallVectorImpl>&operandDimPairs) const; + AffineMap getLoopsToShapesMap(::mlir::Operation *tablegen_opaque_val) const; + AffineMap getShapesToLoopsMap(::mlir::Operation *tablegen_opaque_val) const; + bool canOpOperandsBeDropped(::mlir::Operation *tablegen_opaque_val, ArrayRef droppedOperands) const; + SmallVector getStaticShape(::mlir::Operation *tablegen_opaque_val) const; + SmallVector getStaticLoopRanges(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct LinalgOpTrait; + +} // namespace detail +class LinalgOp : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::LinalgOpTrait {}; + /// Return the number of parallel loops. + unsigned getNumParallelLoops(); + /// Return the dims that are parallel loops. + void getParallelDims(SmallVectorImpl & res); + /// Return the number of reduction loops. + unsigned getNumReductionLoops(); + /// Return the dims that are reduction loops. + void getReductionDims(SmallVectorImpl & res); + /// Return the total number of loops within the current operation. + unsigned getNumLoops(); + /// Returns true if the current operation has only one loop and it's a + /// reduction loop. + bool hasSingleReductionLoop(); + /// Return true if the payload uses the value loaded from `opOperand`. This + /// is useful to avoid loading from "write-only" memory that may be + /// uninitialized, as well as properly cloning "read-write" operands. + bool payloadUsesValueFromOperand(OpOperand * opOperand); + /// Return true if `opOperand` is an init tensor. This is true when it is + /// an output tensor operand whose value is used in the payload region. + bool isInitTensor(OpOperand * opOperand); + /// Return the `opOperand` rank or zero for scalars. + int64_t getRank(OpOperand* opOperand); + /// Return the input block arguments of the region. + Block::BlockArgListType getRegionInputArgs(); + /// Return the output block arguments of the region. + Block::BlockArgListType getRegionOutputArgs(); + /// Return the `opOperand` shape or an empty vector for scalars. + ArrayRef getShape(OpOperand* opOperand); + /// Return the block argument for an `opOperand`. + BlockArgument getMatchingBlockArgument(OpOperand * opOperand); + /// Return the operand for a `blockArgument`. + OpOperand *getMatchingOpOperand(BlockArgument blockArgument); + /// Return the input or output indexing map for `opOperand`. + AffineMap getMatchingIndexingMap(OpOperand* opOperand); + /// Return the indexing map for a `result`. + AffineMap getIndexingMapMatchingResult(OpResult result); + /// Return the value yielded by the region corresponding to an output + /// `opOperand`. + OpOperand *getMatchingYieldValue(OpOperand* opOperand); + /// Return the single block constituting the body of the operation by + /// calling the getBody method on the concrete operation. + Block*getBlock(); + /// Return iterator types in the current operation. + /// + /// Default implementation assumes that the operation has an attribute + /// `iterator_types`, but it's not always the case. Sometimes iterator types + /// can be infered from other parameters and in such cases default + /// getIteratorTypesArray should be overriden. + SmallVector getIteratorTypesArray(); + /// Return true if the indexing map is depending on the current op instance. + /// This means that the indexing map is dynamically synthesized by using the + /// op instance's concrete attributes, instead of being static for all + /// instances of the same op kind. + bool hasDynamicIndexingMaps(); + /// Verify all attributes used by indexing maps are valid. + LogicalResult verifyIndexingMapRequiredAttributes(); + /// Return the indexing maps attribute within the current operation. + ArrayAttr getIndexingMaps(); + /// Return the indexing maps within the current operation. + SmallVector getIndexingMapsArray(); + /// Return true if any of the operands has a dynamic shape. + bool hasDynamicShape(); + /// Return the name registered for this op when lowering to an external + /// library call. + std::string getLibraryCallName(); + /// Return whether the op accesses the iteration indices. + bool hasIndexSemantics(); + /// Return op operands that have a corresponding argument in the basic block. + /// By default, the block should have an argument for each operand, but there + /// are expection. For example, in `map` output operand isn't used in + /// the block. + ::llvm::SmallVector getOpOperandsMatchingBBargs(); + /// Given a dimension of the iteration space of a Linalg operation, finds an + /// operand in the operation that is defined on such dimension. Returns + /// whether such operand was found or not. If found, also returns the + /// operand value and the dimension position within the operand. + LogicalResult mapIterationSpaceDimToOperandDim(unsigned dimPos, ::mlir::Value & operand, unsigned & operandDimPos); + /// Given a dimension of the iteration space of a Linalg operation, finds + /// all the operands in the operation that are defined on such dimension. + /// Returns all the operand values found and their dimension positions in + /// `operandDimPairs`. + void mapIterationSpaceDimToAllOperandDims(unsigned dimPos, mlir::SmallVectorImpl>& operandDimPairs); + /// Hook to provide a custom AffineMap used to compute all the operand + /// subshapes given loop bounds. This is used to answer the question: "given + /// an iteration space over the codomain, what are the subshapes of the + /// operands involved in the computation". + /// The default behavior is to just concatenate all the indexing maps. + /// A custom AffineMap allows providing a map that can be used to + /// compute subshapes even in cases where the concatenation of indexing maps + /// (i.e. the data traversal order) is not a simple permutation of the loop + /// traversal order. It is then possible to define ops with skewed data + /// traversal order for which we can still easily compute hyperrectangular + /// loop bounds and subviews. + AffineMap getLoopsToShapesMap(); + /// Hook to provide a custom AffineMap used to construct the + /// hyperrectangular loop iteration space given all the operand subshapes. + /// This is used to answer the question: + /// "Given a list of operand ranges, what is the subportion of the iteration + /// space involved in the computation". + /// This is the inverse problem of `getLoopsToShapesMap`. + /// Return the empty AffineMap when such an AffineMap cannot be constructed. + /// The default behavior is based on a very simple inference procedure that + /// only works with permutation affine maps. + /// A more advanced Tensor-Comprehension like inference is possible but has + /// proven to be ambiguous in unfavorable case. + /// A safer and more robust alternative is to allow each op to define + /// its own AffineMap. + AffineMap getShapesToLoopsMap(); + /// Checks if the given operands can be dropped, and the remaining + /// operands can still compute the bounds of the op. + bool canOpOperandsBeDropped(ArrayRef droppedOperands); + /// Like `getShape`, but only returns statically-known information, without + /// generating any new IR. For each shape dimension, returns >=0 if that + /// dimension is statically known, or ShapedType::kDynamic otherwise. + SmallVector getStaticShape(); + /// Returns the statically-known loop ranges. Composes + /// `getShapesToLoopsMap()` with the result of `getStaticShape`. + /// Returns ShapedType::kDynamic for non-statically-known loop ranges. + /// This is expected to be called by a valid Linalg op + SmallVector getStaticLoopRanges(); + /// Returns the region builder for constructing the body for linalg.generic. + /// Returns a null function if this named op does not define a region + /// builder. + std::function)> getRegionBuilder(); + /// Return true if all the indexing maps are projected permutations. + /// Otherwise return false. + bool hasOnlyProjectedPermutations(); + + /// Return the flat list of all operand dimension sizes in the order they + /// appear in the operands. + SmallVector createFlatListOfOperandDims(OpBuilder &, Location); + + /// Return the flat list of all operands' static dimension sizes in the + /// order they appear in the operands. All operand dimension sizes have to + /// be statically known. + SmallVector createFlatListOfOperandStaticDims(); + + /// Create the loop ranges to materialize the computation over the current + /// operands. This is done by applying `getShapesToLoopsMap` to + /// `createFlatListOfOperandDims`. + SmallVector createLoopRanges(OpBuilder &b, Location loc); + + /// Compute the static loop sizes necessary to vectorize the computation. + /// This is done by applying `getShapesToLoopsMap` to + /// `createFlatListOfOperandStaticDims`. + SmallVector computeStaticLoopSizes(); + + /// Returns the value that expresses the shape of the output in terms of + /// shape of the input operands where possible + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes); + + /// Return the index in the indexingMaps vector that corresponds to this `opOperand` + int64_t getIndexingMapIndex(OpOperand *opOperand); + //===----------------------------------------------------------------===// + // Inherited from ::mlir::DestinationStyleOpInterface + //===----------------------------------------------------------------===// + + operator ::mlir::DestinationStyleOpInterface () const { + if (!*this) return nullptr; + return ::mlir::DestinationStyleOpInterface(*this, getImpl()->implDestinationStyleOpInterface); + } + + /// Return start and end indices of the init operands range. + ::mlir::MutableOperandRange getDpsInitsMutable(); + + ::mlir::OperandRange getDpsInits() { + return (*this).getDpsInitsMutable(); + } + + /// Return the number of DPS inits. + int64_t getNumDpsInits() { return (*this).getDpsInits().size(); } + + /// Return the `i`-th DPS init. + ::mlir::OpOperand *getDpsInitOperand(int64_t i) { + return &(*this).getDpsInitsMutable()[i]; + } + + /// Set the `i`-th DPS init. + void setDpsInitOperand(int64_t i, Value value) { + assert(i >= 0 && i < (*this).getNumDpsInits() && "invalid index"); + (*this)->setOperand((*this).getDpsInits().getBeginOperandIndex() + i, value); + } + + /// Return the number of DPS inits. + int64_t getNumDpsInputs() { + return (*this)->getNumOperands() - (*this).getNumDpsInits(); + } + + /// Return the DPS input operands. + ::llvm::SmallVector<::mlir::OpOperand *> getDpsInputOperands() { + ::llvm::SmallVector<::mlir::OpOperand *> result; + int64_t numOperands = (*this)->getNumOperands(); + ::mlir::OperandRange range = (*this).getDpsInits(); + if (range.empty()) { + result.reserve(numOperands); + for (int64_t i = 0; i < numOperands; ++i) + result.push_back(&(*this)->getOpOperand(i)); + return result; + } + int64_t firstInitPos = range.getBeginOperandIndex(); + int64_t numInits = range.size(); + result.reserve(numOperands - numInits); + for (int64_t i = 0; i < firstInitPos; ++i) + result.push_back(&(*this)->getOpOperand(i)); + for (int64_t i = firstInitPos + numInits; i < numOperands; ++i) + result.push_back(&(*this)->getOpOperand(i)); + return result; + } + + /// Return the DPS input operands. + ::llvm::SmallVector<::mlir::Value> getDpsInputs() { + return ::llvm::to_vector(::llvm::map_range( + (*this).getDpsInputOperands(), [](OpOperand *o) { return o->get(); })); + } + + /// Return the `i`-th DPS input operand. + ::mlir::OpOperand *getDpsInputOperand(int64_t i) { + ::mlir::OperandRange range = (*this).getDpsInits(); + if (range.empty()) + return &(*this)->getOpOperand(i); + int64_t firstInitPos = range.getBeginOperandIndex(); + int64_t numInits = range.size(); + assert(i >= 0 && i < (*this)->getNumOperands() - numInits + && "invalid index"); + return &(*this)->getOpOperand( + i < firstInitPos ? i : i + firstInitPos + numInits); + } + + /// Return "true" if `opOperand` is an "input". + bool isDpsInput(::mlir::OpOperand *opOperand) { + assert(opOperand->getOwner() == (*this) && "invalid operand"); + return !(*this).isDpsInit(opOperand); + } + + /// Return "true" if `opOperand` is an "init". + bool isDpsInit(::mlir::OpOperand *opOperand) { + assert(opOperand->getOwner() == (*this) && "invalid operand"); + ::mlir::OperandRange range = (*this).getDpsInits(); + if (range.empty()) + return false; + auto operandNumber = opOperand->getOperandNumber(); + return operandNumber >= range.getBeginOperandIndex() + && operandNumber < range.getBeginOperandIndex() + range.size(); + } + + /// Return "true" if `opOperand` is a scalar value. A sclar is defined as + /// neither a MemRef nor a tensor value. + bool isScalar(::mlir::OpOperand *opOperand) { + assert(opOperand->getOwner() == (*this) && "invalid operand"); + return !::llvm::isa(opOperand->get().getType()); + } + + /// Return the OpResult that is tied to the given OpOperand. + ::mlir::OpResult getTiedOpResult(::mlir::OpOperand *opOperand) { + assert(opOperand->getOwner() == (*this) && "invalid operand"); + ::mlir::OperandRange range = (*this).getDpsInits(); + assert(!range.empty() && "op has no inits"); + int64_t resultIndex = + opOperand->getOperandNumber() - range.getBeginOperandIndex(); + assert(resultIndex >= 0 && + resultIndex < (*this)->getNumResults()); + return (*this)->getResult(resultIndex); + } + + /// Return the OpOperand that is tied to the given OpResult. + ::mlir::OpOperand *getTiedOpOperand(::mlir::OpResult opResult) { + assert(opResult.getDefiningOp() == (*this) && "invalid opresult"); + return (*this).getDpsInitOperand(opResult.getResultNumber()); + } + + /// Return whether the op has buffer semantics. That is the case if the op + /// has no ranked tensor operands and at least one memref operand. + bool hasBufferSemantics() { + // No tensors. + auto isTensor = [](Value v){ + return ::llvm::isa<::mlir::RankedTensorType>(v.getType()); + }; + if (::llvm::any_of((*this)->getOperands(), isTensor)) + return false; + // At least one memref. + auto isMemref = [](Value v){ + return ::llvm::isa<::mlir::MemRefType>(v.getType()); + }; + return llvm::any_of((*this)->getOperands(), isMemref); + } + + /// Return whether the op has tensor semantics. That is the case if the op + /// has no memref operands and at least one ranked tensor operand. + bool hasTensorSemantics() { + // No memrefs. + auto isMemref = [](Value v){ + return ::llvm::isa<::mlir::MemRefType>(v.getType()); + }; + if (::llvm::any_of((*this)->getOperands(), isMemref)) + return false; + // At least one tensor. + auto isTensor = [](Value v){ + return ::llvm::isa<::mlir::RankedTensorType>(v.getType()); + }; + return llvm::any_of((*this)->getOperands(), isTensor); + } +}; +namespace detail { + template + struct LinalgOpTrait : public ::mlir::OpInterface::Trait { + /// Return the number of parallel loops. + unsigned getNumParallelLoops() { + return llvm::count((*static_cast(this)).getIteratorTypesArray(), + utils::IteratorType::parallel); + } + /// Return the dims that are parallel loops. + void getParallelDims(SmallVectorImpl & res) { + return findPositionsOfType((*static_cast(this)).getIteratorTypesArray(), + utils::IteratorType::parallel, res); + } + /// Return the number of reduction loops. + unsigned getNumReductionLoops() { + return llvm::count((*static_cast(this)).getIteratorTypesArray(), + utils::IteratorType::reduction); + } + /// Return the dims that are reduction loops. + void getReductionDims(SmallVectorImpl & res) { + return findPositionsOfType((*static_cast(this)).getIteratorTypesArray(), + utils::IteratorType::reduction, res); + } + /// Return the total number of loops within the current operation. + unsigned getNumLoops() { + return (*static_cast(this)).getIteratorTypesArray().size(); + } + /// Returns true if the current operation has only one loop and it's a + /// reduction loop. + bool hasSingleReductionLoop() { + auto iters = (*static_cast(this)).getIteratorTypesArray(); + return iters.size() == 1 && + llvm::count(iters, utils::IteratorType::reduction) == 1; + } + /// Return true if the payload uses the value loaded from `opOperand`. This + /// is useful to avoid loading from "write-only" memory that may be + /// uninitialized, as well as properly cloning "read-write" operands. + bool payloadUsesValueFromOperand(OpOperand * opOperand) { + unsigned bbArgNumber = opOperand->getOperandNumber(); + // Init tensors have uses. + return !getBlock()->getArgument(bbArgNumber).use_empty(); + } + /// Return true if `opOperand` is an init tensor. This is true when it is + /// an output tensor operand whose value is used in the payload region. + bool isInitTensor(OpOperand * opOperand) { + if (!(*static_cast(this)).isDpsInit(opOperand)) + return false; + return payloadUsesValueFromOperand(opOperand); + } + /// Return the `opOperand` rank or zero for scalars. + int64_t getRank(OpOperand* opOperand) { + assert(opOperand->getOwner() == this->getOperation()); + if (auto shapedType = + ::llvm::dyn_cast(opOperand->get().getType())) + return shapedType.getRank(); + return 0; + } + /// Return the input block arguments of the region. + Block::BlockArgListType getRegionInputArgs() { + return getBlock()->getArguments().take_front((*static_cast(this)).getNumDpsInputs()); + } + /// Return the output block arguments of the region. + Block::BlockArgListType getRegionOutputArgs() { + return getBlock()->getArguments().take_back((*static_cast(this)).getNumDpsInits()); + } + /// Return the `opOperand` shape or an empty vector for scalars. + ArrayRef getShape(OpOperand* opOperand) { + assert(opOperand->getOwner() == this->getOperation()); + if (auto shapedType = + ::llvm::dyn_cast(opOperand->get().getType())) + return shapedType.getShape(); + return {}; + } + /// Return the block argument for an `opOperand`. + BlockArgument getMatchingBlockArgument(OpOperand * opOperand) { + assert(opOperand->getOwner() == this->getOperation()); + return getBlock()->getArgument(opOperand->getOperandNumber()); + } + /// Return the operand for a `blockArgument`. + OpOperand *getMatchingOpOperand(BlockArgument blockArgument) { + assert(blockArgument.getOwner() == getBlock()); + return &this->getOperation()->getOpOperand( + blockArgument.getArgNumber()); + } + /// Return the input or output indexing map for `opOperand`. + AffineMap getMatchingIndexingMap(OpOperand* opOperand) { + assert(opOperand->getOwner() == this->getOperation()); + auto indexingMaps = + (*static_cast(this)).getIndexingMaps().template getAsValueRange(); + return *(indexingMaps.begin() + opOperand->getOperandNumber()); + } + /// Return the indexing map for a `result`. + AffineMap getIndexingMapMatchingResult(OpResult result) { + assert(result.getOwner() == this->getOperation()); + auto indexingMaps = + (*static_cast(this)).getIndexingMaps().template getAsValueRange(); + return *(indexingMaps.begin() + (*static_cast(this)).getNumDpsInputs() + + result.getResultNumber()); + } + /// Return the value yielded by the region corresponding to an output + /// `opOperand`. + OpOperand *getMatchingYieldValue(OpOperand* opOperand) { + assert(opOperand->getOwner() == this->getOperation()); + int64_t resultIndex = + opOperand->getOperandNumber() - (*static_cast(this)).getNumDpsInputs(); + assert(resultIndex >= 0 && + resultIndex < this->getOperation()->getNumResults()); + Operation *yieldOp = getBlock()->getTerminator(); + return &yieldOp->getOpOperand(resultIndex); + } + /// Return the single block constituting the body of the operation by + /// calling the getBody method on the concrete operation. + Block*getBlock() { + // Assume the concrete operation implements the + // SingleBlockImplicitTerminator trait. + return (*static_cast(this)).getBody(); + } + /// Return iterator types in the current operation. + /// + /// Default implementation assumes that the operation has an attribute + /// `iterator_types`, but it's not always the case. Sometimes iterator types + /// can be infered from other parameters and in such cases default + /// getIteratorTypesArray should be overriden. + SmallVector getIteratorTypesArray() { + auto range = (*static_cast(this)).getIteratorTypes() + .template getAsValueRange(); + return {range.begin(), range.end()}; + } + /// Return true if the indexing map is depending on the current op instance. + /// This means that the indexing map is dynamically synthesized by using the + /// op instance's concrete attributes, instead of being static for all + /// instances of the same op kind. + bool hasDynamicIndexingMaps() { + return false; + } + /// Verify all attributes used by indexing maps are valid. + LogicalResult verifyIndexingMapRequiredAttributes() { + return success(); + } + /// Return the indexing maps within the current operation. + SmallVector getIndexingMapsArray() { + auto range = (*static_cast(this)).getIndexingMaps() + .template getAsValueRange(); + return {range.begin(), range.end()}; + } + /// Return true if any of the operands has a dynamic shape. + bool hasDynamicShape() { + return llvm::any_of(getStaticShape(), ShapedType::isDynamic); + } + /// Return the name registered for this op when lowering to an external + /// library call. + std::string getLibraryCallName() { + return (*static_cast(this)).getLibraryCallName(); + } + /// Return op operands that have a corresponding argument in the basic block. + /// By default, the block should have an argument for each operand, but there + /// are expection. For example, in `map` output operand isn't used in + /// the block. + ::llvm::SmallVector getOpOperandsMatchingBBargs() { + ::llvm::SmallVector result; + result.reserve((*static_cast(this))->getNumOperands()); + llvm::transform( + this->getOperation()->getOpOperands(), + std::back_inserter(result), + [](OpOperand &opOperand) { return &opOperand; }); + return result; + } + /// Given a dimension of the iteration space of a Linalg operation, finds an + /// operand in the operation that is defined on such dimension. Returns + /// whether such operand was found or not. If found, also returns the + /// operand value and the dimension position within the operand. + LogicalResult mapIterationSpaceDimToOperandDim(unsigned dimPos, ::mlir::Value & operand, unsigned & operandDimPos) { + // Retrieve the operand and its dimension position from the first + // operand with a permutation map that is defined on such dimension. + for (auto [i, idxMap] : llvm::enumerate((*static_cast(this)).getIndexingMapsArray())) { + if (idxMap.isProjectedPermutation()) { + if (auto mayOperandDim = idxMap.getResultPosition( + getAffineDimExpr(dimPos, idxMap.getContext()))) { + operand = (*static_cast(this))->getOperand(i); + operandDimPos = *mayOperandDim; + return success(); + } + } + } + + return failure(); + } + /// Given a dimension of the iteration space of a Linalg operation, finds + /// all the operands in the operation that are defined on such dimension. + /// Returns all the operand values found and their dimension positions in + /// `operandDimPairs`. + void mapIterationSpaceDimToAllOperandDims(unsigned dimPos, mlir::SmallVectorImpl>& operandDimPairs) { + for (auto [i, idxMap] : llvm::enumerate((*static_cast(this)).getIndexingMapsArray())) { + if (idxMap.isProjectedPermutation()) { + if (auto mayOperandDim = idxMap.getResultPosition( + getAffineDimExpr(dimPos, idxMap.getContext()))) { + operandDimPairs.push_back({(*static_cast(this))->getOperand(i), *mayOperandDim}); + } + } + } + + return; + } + /// Hook to provide a custom AffineMap used to compute all the operand + /// subshapes given loop bounds. This is used to answer the question: "given + /// an iteration space over the codomain, what are the subshapes of the + /// operands involved in the computation". + /// The default behavior is to just concatenate all the indexing maps. + /// A custom AffineMap allows providing a map that can be used to + /// compute subshapes even in cases where the concatenation of indexing maps + /// (i.e. the data traversal order) is not a simple permutation of the loop + /// traversal order. It is then possible to define ops with skewed data + /// traversal order for which we can still easily compute hyperrectangular + /// loop bounds and subviews. + AffineMap getLoopsToShapesMap() { + auto maps = (*static_cast(this)).getIndexingMapsArray(); + return concatAffineMaps(maps); + } + /// Hook to provide a custom AffineMap used to construct the + /// hyperrectangular loop iteration space given all the operand subshapes. + /// This is used to answer the question: + /// "Given a list of operand ranges, what is the subportion of the iteration + /// space involved in the computation". + /// This is the inverse problem of `getLoopsToShapesMap`. + /// Return the empty AffineMap when such an AffineMap cannot be constructed. + /// The default behavior is based on a very simple inference procedure that + /// only works with permutation affine maps. + /// A more advanced Tensor-Comprehension like inference is possible but has + /// proven to be ambiguous in unfavorable case. + /// A safer and more robust alternative is to allow each op to define + /// its own AffineMap. + AffineMap getShapesToLoopsMap() { + return inversePermutation(getLoopsToShapesMap()); + } + /// Checks if the given operands can be dropped, and the remaining + /// operands can still compute the bounds of the op. + bool canOpOperandsBeDropped(ArrayRef droppedOperands) { + return detail::canOpOperandsBeDroppedImpl((*static_cast(this)), droppedOperands); + } + /// Like `getShape`, but only returns statically-known information, without + /// generating any new IR. For each shape dimension, returns >=0 if that + /// dimension is statically known, or ShapedType::kDynamic otherwise. + SmallVector getStaticShape() { + SmallVector res; + for (OpOperand &opOperand : this->getOperation()->getOpOperands()) + llvm::append_range(res, getShape(&opOperand)); + return res; + } + /// Returns the statically-known loop ranges. Composes + /// `getShapesToLoopsMap()` with the result of `getStaticShape`. + /// Returns ShapedType::kDynamic for non-statically-known loop ranges. + /// This is expected to be called by a valid Linalg op + SmallVector getStaticLoopRanges() { + SmallVector viewSizes = getStaticShape(); + AffineMap invertedMap = getShapesToLoopsMap(); + assert(invertedMap && "expected a valid Linalg op to call the method"); + return invertedMap.compose(viewSizes); + } + static ::mlir::LogicalResult verifyRegionTrait(::mlir::Operation *op) { + return detail::verifyStructuredOpInterface(op); + } + }; +}// namespace detail +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class AggregatedOpInterface; +namespace detail { +struct AggregatedOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + FailureOr> (*decomposeOperation)(const Concept *impl, ::mlir::Operation *, OpBuilder &); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::linalg::AggregatedOpInterface; + Model() : Concept{decomposeOperation} {} + + static inline FailureOr> decomposeOperation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpBuilder & b); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::linalg::AggregatedOpInterface; + FallbackModel() : Concept{decomposeOperation} {} + + static inline FailureOr> decomposeOperation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpBuilder & b); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + FailureOr> decomposeOperation(::mlir::Operation *tablegen_opaque_val, OpBuilder &b) const; + }; +};template +struct AggregatedOpInterfaceTrait; + +} // namespace detail +class AggregatedOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AggregatedOpInterfaceTrait {}; + /// Method to decompose the operation into simpler operations. + /// + /// On success, this method returns one `Value` per result in the + /// original operation. + /// The order of the returned values must match the order of the + /// original values. + /// In other words, the returned vector can be used directly with + /// `RewriterBase::replaceOp(this, returnedValues)`. + FailureOr> decomposeOperation(OpBuilder & b); +}; +namespace detail { + template + struct AggregatedOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Method to decompose the operation into simpler operations. + /// + /// On success, this method returns one `Value` per result in the + /// original operation. + /// The order of the returned values must match the order of the + /// original values. + /// In other words, the returned vector can be used directly with + /// `RewriterBase::replaceOp(this, returnedValues)`. + FailureOr> decomposeOperation(OpBuilder & b) { + return {}; + } + }; +}// namespace detail +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +template +Value detail::ContractionOpInterfaceInterfaceTraits::Model::lhs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getOperation()->getOperand(0); +} +template +Value detail::ContractionOpInterfaceInterfaceTraits::Model::rhs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getOperation()->getOperand(1); +} +template +bool detail::ContractionOpInterfaceInterfaceTraits::Model::isRowMajorMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return mlir::isRowMajorMatmul((llvm::cast(tablegen_opaque_val)).getIndexingMaps()); +} +template +bool detail::ContractionOpInterfaceInterfaceTraits::Model::isColumnMajorMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return mlir::isColumnMajorMatmul((llvm::cast(tablegen_opaque_val)).getIndexingMaps()); +} +template +bool detail::ContractionOpInterfaceInterfaceTraits::Model::isRowMajorBatchMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return mlir::isRowMajorBatchMatmul((llvm::cast(tablegen_opaque_val)).getIndexingMaps()); +} +template +Value detail::ContractionOpInterfaceInterfaceTraits::FallbackModel::lhs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->lhs(tablegen_opaque_val); +} +template +Value detail::ContractionOpInterfaceInterfaceTraits::FallbackModel::rhs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->rhs(tablegen_opaque_val); +} +template +bool detail::ContractionOpInterfaceInterfaceTraits::FallbackModel::isRowMajorMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->isRowMajorMatmul(tablegen_opaque_val); +} +template +bool detail::ContractionOpInterfaceInterfaceTraits::FallbackModel::isColumnMajorMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->isColumnMajorMatmul(tablegen_opaque_val); +} +template +bool detail::ContractionOpInterfaceInterfaceTraits::FallbackModel::isRowMajorBatchMatmul(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->isRowMajorBatchMatmul(tablegen_opaque_val); +} +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +template +Value detail::ConvolutionOpInterfaceInterfaceTraits::Model::image(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).image(); +} +template +Value detail::ConvolutionOpInterfaceInterfaceTraits::Model::filter(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).filter(); +} +template +Value detail::ConvolutionOpInterfaceInterfaceTraits::FallbackModel::image(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->image(tablegen_opaque_val); +} +template +Value detail::ConvolutionOpInterfaceInterfaceTraits::FallbackModel::filter(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->filter(tablegen_opaque_val); +} +template +Value detail::ConvolutionOpInterfaceInterfaceTraits::ExternalModel::image(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getOperation()->getOperand(0); +} +template +Value detail::ConvolutionOpInterfaceInterfaceTraits::ExternalModel::filter(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getOperation()->getOperand(1); +} +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +template +Value detail::FillOpInterfaceInterfaceTraits::Model::value(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).value(); +} +template +Value detail::FillOpInterfaceInterfaceTraits::Model::output(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).output(); +} +template +Value detail::FillOpInterfaceInterfaceTraits::Model::result(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).result(); +} +template +Value detail::FillOpInterfaceInterfaceTraits::FallbackModel::value(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->value(tablegen_opaque_val); +} +template +Value detail::FillOpInterfaceInterfaceTraits::FallbackModel::output(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->output(tablegen_opaque_val); +} +template +Value detail::FillOpInterfaceInterfaceTraits::FallbackModel::result(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->result(tablegen_opaque_val); +} +template +Value detail::FillOpInterfaceInterfaceTraits::ExternalModel::value(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getOperation()->getOperand(0); +} +template +Value detail::FillOpInterfaceInterfaceTraits::ExternalModel::output(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getOperation()->getOperand(1); +} +template +Value detail::FillOpInterfaceInterfaceTraits::ExternalModel::result(::mlir::Operation *tablegen_opaque_val) const { +if ((llvm::cast(tablegen_opaque_val)).getOperation()->getResults().empty()) + return nullptr; + return (llvm::cast(tablegen_opaque_val)).getOperation()->getResults().front(); +} +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +template +unsigned detail::LinalgOpInterfaceTraits::Model::getNumParallelLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getNumParallelLoops(); +} +template +void detail::LinalgOpInterfaceTraits::Model::getParallelDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, SmallVectorImpl & res) { + return (llvm::cast(tablegen_opaque_val)).getParallelDims(res); +} +template +unsigned detail::LinalgOpInterfaceTraits::Model::getNumReductionLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getNumReductionLoops(); +} +template +void detail::LinalgOpInterfaceTraits::Model::getReductionDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, SmallVectorImpl & res) { + return (llvm::cast(tablegen_opaque_val)).getReductionDims(res); +} +template +unsigned detail::LinalgOpInterfaceTraits::Model::getNumLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getNumLoops(); +} +template +bool detail::LinalgOpInterfaceTraits::Model::hasSingleReductionLoop(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).hasSingleReductionLoop(); +} +template +bool detail::LinalgOpInterfaceTraits::Model::payloadUsesValueFromOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand) { + return (llvm::cast(tablegen_opaque_val)).payloadUsesValueFromOperand(opOperand); +} +template +bool detail::LinalgOpInterfaceTraits::Model::isInitTensor(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand) { + return (llvm::cast(tablegen_opaque_val)).isInitTensor(opOperand); +} +template +int64_t detail::LinalgOpInterfaceTraits::Model::getRank(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand) { + return (llvm::cast(tablegen_opaque_val)).getRank(opOperand); +} +template +Block::BlockArgListType detail::LinalgOpInterfaceTraits::Model::getRegionInputArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getRegionInputArgs(); +} +template +Block::BlockArgListType detail::LinalgOpInterfaceTraits::Model::getRegionOutputArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getRegionOutputArgs(); +} +template +ArrayRef detail::LinalgOpInterfaceTraits::Model::getShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand) { + return (llvm::cast(tablegen_opaque_val)).getShape(opOperand); +} +template +BlockArgument detail::LinalgOpInterfaceTraits::Model::getMatchingBlockArgument(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand) { + return (llvm::cast(tablegen_opaque_val)).getMatchingBlockArgument(opOperand); +} +template +OpOperand *detail::LinalgOpInterfaceTraits::Model::getMatchingOpOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, BlockArgument blockArgument) { + return (llvm::cast(tablegen_opaque_val)).getMatchingOpOperand(blockArgument); +} +template +AffineMap detail::LinalgOpInterfaceTraits::Model::getMatchingIndexingMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand) { + return (llvm::cast(tablegen_opaque_val)).getMatchingIndexingMap(opOperand); +} +template +AffineMap detail::LinalgOpInterfaceTraits::Model::getIndexingMapMatchingResult(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpResult result) { + return (llvm::cast(tablegen_opaque_val)).getIndexingMapMatchingResult(result); +} +template +OpOperand *detail::LinalgOpInterfaceTraits::Model::getMatchingYieldValue(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand) { + return (llvm::cast(tablegen_opaque_val)).getMatchingYieldValue(opOperand); +} +template +Block*detail::LinalgOpInterfaceTraits::Model::getBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getBlock(); +} +template +SmallVector detail::LinalgOpInterfaceTraits::Model::getIteratorTypesArray(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getIteratorTypesArray(); +} +template +bool detail::LinalgOpInterfaceTraits::Model::hasDynamicIndexingMaps(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).hasDynamicIndexingMaps(); +} +template +LogicalResult detail::LinalgOpInterfaceTraits::Model::verifyIndexingMapRequiredAttributes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).verifyIndexingMapRequiredAttributes(); +} +template +ArrayAttr detail::LinalgOpInterfaceTraits::Model::getIndexingMaps(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getIndexingMaps(); +} +template +SmallVector detail::LinalgOpInterfaceTraits::Model::getIndexingMapsArray(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getIndexingMapsArray(); +} +template +bool detail::LinalgOpInterfaceTraits::Model::hasDynamicShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).hasDynamicShape(); +} +template +std::string detail::LinalgOpInterfaceTraits::Model::getLibraryCallName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getLibraryCallName(); +} +template +bool detail::LinalgOpInterfaceTraits::Model::hasIndexSemantics(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).hasIndexSemantics(); +} +template +::llvm::SmallVector detail::LinalgOpInterfaceTraits::Model::getOpOperandsMatchingBBargs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getOpOperandsMatchingBBargs(); +} +template +LogicalResult detail::LinalgOpInterfaceTraits::Model::mapIterationSpaceDimToOperandDim(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned dimPos, ::mlir::Value & operand, unsigned & operandDimPos) { + return (llvm::cast(tablegen_opaque_val)).mapIterationSpaceDimToOperandDim(dimPos, operand, operandDimPos); +} +template +void detail::LinalgOpInterfaceTraits::Model::mapIterationSpaceDimToAllOperandDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned dimPos, mlir::SmallVectorImpl>& operandDimPairs) { + return (llvm::cast(tablegen_opaque_val)).mapIterationSpaceDimToAllOperandDims(dimPos, operandDimPairs); +} +template +AffineMap detail::LinalgOpInterfaceTraits::Model::getLoopsToShapesMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getLoopsToShapesMap(); +} +template +AffineMap detail::LinalgOpInterfaceTraits::Model::getShapesToLoopsMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getShapesToLoopsMap(); +} +template +bool detail::LinalgOpInterfaceTraits::Model::canOpOperandsBeDropped(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ArrayRef droppedOperands) { + return (llvm::cast(tablegen_opaque_val)).canOpOperandsBeDropped(droppedOperands); +} +template +SmallVector detail::LinalgOpInterfaceTraits::Model::getStaticShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getStaticShape(); +} +template +SmallVector detail::LinalgOpInterfaceTraits::Model::getStaticLoopRanges(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getStaticLoopRanges(); +} +template +std::function)> detail::LinalgOpInterfaceTraits::Model::getRegionBuilder() { + return ConcreteOp::getRegionBuilder(); +} +template +bool detail::LinalgOpInterfaceTraits::Model::hasOnlyProjectedPermutations(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return llvm::all_of((llvm::cast(tablegen_opaque_val)).getIndexingMapsArray(), + [](AffineMap map) { return map.isProjectedPermutation(); }); +} +template +unsigned detail::LinalgOpInterfaceTraits::FallbackModel::getNumParallelLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getNumParallelLoops(tablegen_opaque_val); +} +template +void detail::LinalgOpInterfaceTraits::FallbackModel::getParallelDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, SmallVectorImpl & res) { + return static_cast(impl)->getParallelDims(tablegen_opaque_val, res); +} +template +unsigned detail::LinalgOpInterfaceTraits::FallbackModel::getNumReductionLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getNumReductionLoops(tablegen_opaque_val); +} +template +void detail::LinalgOpInterfaceTraits::FallbackModel::getReductionDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, SmallVectorImpl & res) { + return static_cast(impl)->getReductionDims(tablegen_opaque_val, res); +} +template +unsigned detail::LinalgOpInterfaceTraits::FallbackModel::getNumLoops(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getNumLoops(tablegen_opaque_val); +} +template +bool detail::LinalgOpInterfaceTraits::FallbackModel::hasSingleReductionLoop(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->hasSingleReductionLoop(tablegen_opaque_val); +} +template +bool detail::LinalgOpInterfaceTraits::FallbackModel::payloadUsesValueFromOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand) { + return static_cast(impl)->payloadUsesValueFromOperand(tablegen_opaque_val, opOperand); +} +template +bool detail::LinalgOpInterfaceTraits::FallbackModel::isInitTensor(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand) { + return static_cast(impl)->isInitTensor(tablegen_opaque_val, opOperand); +} +template +int64_t detail::LinalgOpInterfaceTraits::FallbackModel::getRank(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand) { + return static_cast(impl)->getRank(tablegen_opaque_val, opOperand); +} +template +Block::BlockArgListType detail::LinalgOpInterfaceTraits::FallbackModel::getRegionInputArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getRegionInputArgs(tablegen_opaque_val); +} +template +Block::BlockArgListType detail::LinalgOpInterfaceTraits::FallbackModel::getRegionOutputArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getRegionOutputArgs(tablegen_opaque_val); +} +template +ArrayRef detail::LinalgOpInterfaceTraits::FallbackModel::getShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand) { + return static_cast(impl)->getShape(tablegen_opaque_val, opOperand); +} +template +BlockArgument detail::LinalgOpInterfaceTraits::FallbackModel::getMatchingBlockArgument(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand * opOperand) { + return static_cast(impl)->getMatchingBlockArgument(tablegen_opaque_val, opOperand); +} +template +OpOperand *detail::LinalgOpInterfaceTraits::FallbackModel::getMatchingOpOperand(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, BlockArgument blockArgument) { + return static_cast(impl)->getMatchingOpOperand(tablegen_opaque_val, blockArgument); +} +template +AffineMap detail::LinalgOpInterfaceTraits::FallbackModel::getMatchingIndexingMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand) { + return static_cast(impl)->getMatchingIndexingMap(tablegen_opaque_val, opOperand); +} +template +AffineMap detail::LinalgOpInterfaceTraits::FallbackModel::getIndexingMapMatchingResult(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpResult result) { + return static_cast(impl)->getIndexingMapMatchingResult(tablegen_opaque_val, result); +} +template +OpOperand *detail::LinalgOpInterfaceTraits::FallbackModel::getMatchingYieldValue(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpOperand* opOperand) { + return static_cast(impl)->getMatchingYieldValue(tablegen_opaque_val, opOperand); +} +template +Block*detail::LinalgOpInterfaceTraits::FallbackModel::getBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getBlock(tablegen_opaque_val); +} +template +SmallVector detail::LinalgOpInterfaceTraits::FallbackModel::getIteratorTypesArray(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getIteratorTypesArray(tablegen_opaque_val); +} +template +bool detail::LinalgOpInterfaceTraits::FallbackModel::hasDynamicIndexingMaps(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->hasDynamicIndexingMaps(tablegen_opaque_val); +} +template +LogicalResult detail::LinalgOpInterfaceTraits::FallbackModel::verifyIndexingMapRequiredAttributes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->verifyIndexingMapRequiredAttributes(tablegen_opaque_val); +} +template +ArrayAttr detail::LinalgOpInterfaceTraits::FallbackModel::getIndexingMaps(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getIndexingMaps(tablegen_opaque_val); +} +template +SmallVector detail::LinalgOpInterfaceTraits::FallbackModel::getIndexingMapsArray(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getIndexingMapsArray(tablegen_opaque_val); +} +template +bool detail::LinalgOpInterfaceTraits::FallbackModel::hasDynamicShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->hasDynamicShape(tablegen_opaque_val); +} +template +std::string detail::LinalgOpInterfaceTraits::FallbackModel::getLibraryCallName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getLibraryCallName(tablegen_opaque_val); +} +template +bool detail::LinalgOpInterfaceTraits::FallbackModel::hasIndexSemantics(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->hasIndexSemantics(tablegen_opaque_val); +} +template +::llvm::SmallVector detail::LinalgOpInterfaceTraits::FallbackModel::getOpOperandsMatchingBBargs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getOpOperandsMatchingBBargs(tablegen_opaque_val); +} +template +LogicalResult detail::LinalgOpInterfaceTraits::FallbackModel::mapIterationSpaceDimToOperandDim(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned dimPos, ::mlir::Value & operand, unsigned & operandDimPos) { + return static_cast(impl)->mapIterationSpaceDimToOperandDim(tablegen_opaque_val, dimPos, operand, operandDimPos); +} +template +void detail::LinalgOpInterfaceTraits::FallbackModel::mapIterationSpaceDimToAllOperandDims(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned dimPos, mlir::SmallVectorImpl>& operandDimPairs) { + return static_cast(impl)->mapIterationSpaceDimToAllOperandDims(tablegen_opaque_val, dimPos, operandDimPairs); +} +template +AffineMap detail::LinalgOpInterfaceTraits::FallbackModel::getLoopsToShapesMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getLoopsToShapesMap(tablegen_opaque_val); +} +template +AffineMap detail::LinalgOpInterfaceTraits::FallbackModel::getShapesToLoopsMap(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getShapesToLoopsMap(tablegen_opaque_val); +} +template +bool detail::LinalgOpInterfaceTraits::FallbackModel::canOpOperandsBeDropped(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ArrayRef droppedOperands) { + return static_cast(impl)->canOpOperandsBeDropped(tablegen_opaque_val, droppedOperands); +} +template +SmallVector detail::LinalgOpInterfaceTraits::FallbackModel::getStaticShape(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getStaticShape(tablegen_opaque_val); +} +template +SmallVector detail::LinalgOpInterfaceTraits::FallbackModel::getStaticLoopRanges(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getStaticLoopRanges(tablegen_opaque_val); +} +template +std::function)> detail::LinalgOpInterfaceTraits::FallbackModel::getRegionBuilder() { + return ConcreteOp::getRegionBuilder(); +} +template +bool detail::LinalgOpInterfaceTraits::FallbackModel::hasOnlyProjectedPermutations(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->hasOnlyProjectedPermutations(tablegen_opaque_val); +} +template +unsigned detail::LinalgOpInterfaceTraits::ExternalModel::getNumParallelLoops(::mlir::Operation *tablegen_opaque_val) const { +return llvm::count((llvm::cast(tablegen_opaque_val)).getIteratorTypesArray(), + utils::IteratorType::parallel); +} +template +void detail::LinalgOpInterfaceTraits::ExternalModel::getParallelDims(::mlir::Operation *tablegen_opaque_val, SmallVectorImpl &res) const { +return findPositionsOfType((llvm::cast(tablegen_opaque_val)).getIteratorTypesArray(), + utils::IteratorType::parallel, res); +} +template +unsigned detail::LinalgOpInterfaceTraits::ExternalModel::getNumReductionLoops(::mlir::Operation *tablegen_opaque_val) const { +return llvm::count((llvm::cast(tablegen_opaque_val)).getIteratorTypesArray(), + utils::IteratorType::reduction); +} +template +void detail::LinalgOpInterfaceTraits::ExternalModel::getReductionDims(::mlir::Operation *tablegen_opaque_val, SmallVectorImpl &res) const { +return findPositionsOfType((llvm::cast(tablegen_opaque_val)).getIteratorTypesArray(), + utils::IteratorType::reduction, res); +} +template +unsigned detail::LinalgOpInterfaceTraits::ExternalModel::getNumLoops(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getIteratorTypesArray().size(); +} +template +bool detail::LinalgOpInterfaceTraits::ExternalModel::hasSingleReductionLoop(::mlir::Operation *tablegen_opaque_val) const { +auto iters = (llvm::cast(tablegen_opaque_val)).getIteratorTypesArray(); + return iters.size() == 1 && + llvm::count(iters, utils::IteratorType::reduction) == 1; +} +template +bool detail::LinalgOpInterfaceTraits::ExternalModel::payloadUsesValueFromOperand(::mlir::Operation *tablegen_opaque_val, OpOperand *opOperand) const { +unsigned bbArgNumber = opOperand->getOperandNumber(); + // Init tensors have uses. + return !getBlock()->getArgument(bbArgNumber).use_empty(); +} +template +bool detail::LinalgOpInterfaceTraits::ExternalModel::isInitTensor(::mlir::Operation *tablegen_opaque_val, OpOperand *opOperand) const { +if (!(llvm::cast(tablegen_opaque_val)).isDpsInit(opOperand)) + return false; + return payloadUsesValueFromOperand(opOperand); +} +template +int64_t detail::LinalgOpInterfaceTraits::ExternalModel::getRank(::mlir::Operation *tablegen_opaque_val, OpOperand*opOperand) const { +assert(opOperand->getOwner() == this->getOperation()); + if (auto shapedType = + ::llvm::dyn_cast(opOperand->get().getType())) + return shapedType.getRank(); + return 0; +} +template +Block::BlockArgListType detail::LinalgOpInterfaceTraits::ExternalModel::getRegionInputArgs(::mlir::Operation *tablegen_opaque_val) const { +return getBlock()->getArguments().take_front((llvm::cast(tablegen_opaque_val)).getNumDpsInputs()); +} +template +Block::BlockArgListType detail::LinalgOpInterfaceTraits::ExternalModel::getRegionOutputArgs(::mlir::Operation *tablegen_opaque_val) const { +return getBlock()->getArguments().take_back((llvm::cast(tablegen_opaque_val)).getNumDpsInits()); +} +template +ArrayRef detail::LinalgOpInterfaceTraits::ExternalModel::getShape(::mlir::Operation *tablegen_opaque_val, OpOperand*opOperand) const { +assert(opOperand->getOwner() == this->getOperation()); + if (auto shapedType = + ::llvm::dyn_cast(opOperand->get().getType())) + return shapedType.getShape(); + return {}; +} +template +BlockArgument detail::LinalgOpInterfaceTraits::ExternalModel::getMatchingBlockArgument(::mlir::Operation *tablegen_opaque_val, OpOperand *opOperand) const { +assert(opOperand->getOwner() == this->getOperation()); + return getBlock()->getArgument(opOperand->getOperandNumber()); +} +template +OpOperand *detail::LinalgOpInterfaceTraits::ExternalModel::getMatchingOpOperand(::mlir::Operation *tablegen_opaque_val, BlockArgument blockArgument) const { +assert(blockArgument.getOwner() == getBlock()); + return &this->getOperation()->getOpOperand( + blockArgument.getArgNumber()); +} +template +AffineMap detail::LinalgOpInterfaceTraits::ExternalModel::getMatchingIndexingMap(::mlir::Operation *tablegen_opaque_val, OpOperand*opOperand) const { +assert(opOperand->getOwner() == this->getOperation()); + auto indexingMaps = + (llvm::cast(tablegen_opaque_val)).getIndexingMaps().template getAsValueRange(); + return *(indexingMaps.begin() + opOperand->getOperandNumber()); +} +template +AffineMap detail::LinalgOpInterfaceTraits::ExternalModel::getIndexingMapMatchingResult(::mlir::Operation *tablegen_opaque_val, OpResult result) const { +assert(result.getOwner() == this->getOperation()); + auto indexingMaps = + (llvm::cast(tablegen_opaque_val)).getIndexingMaps().template getAsValueRange(); + return *(indexingMaps.begin() + (llvm::cast(tablegen_opaque_val)).getNumDpsInputs() + + result.getResultNumber()); +} +template +OpOperand *detail::LinalgOpInterfaceTraits::ExternalModel::getMatchingYieldValue(::mlir::Operation *tablegen_opaque_val, OpOperand*opOperand) const { +assert(opOperand->getOwner() == this->getOperation()); + int64_t resultIndex = + opOperand->getOperandNumber() - (llvm::cast(tablegen_opaque_val)).getNumDpsInputs(); + assert(resultIndex >= 0 && + resultIndex < this->getOperation()->getNumResults()); + Operation *yieldOp = getBlock()->getTerminator(); + return &yieldOp->getOpOperand(resultIndex); +} +template +Block*detail::LinalgOpInterfaceTraits::ExternalModel::getBlock(::mlir::Operation *tablegen_opaque_val) const { +// Assume the concrete operation implements the + // SingleBlockImplicitTerminator trait. + return (llvm::cast(tablegen_opaque_val)).getBody(); +} +template +SmallVector detail::LinalgOpInterfaceTraits::ExternalModel::getIteratorTypesArray(::mlir::Operation *tablegen_opaque_val) const { +auto range = (llvm::cast(tablegen_opaque_val)).getIteratorTypes() + .template getAsValueRange(); + return {range.begin(), range.end()}; +} +template +bool detail::LinalgOpInterfaceTraits::ExternalModel::hasDynamicIndexingMaps(::mlir::Operation *tablegen_opaque_val) const { +return false; +} +template +LogicalResult detail::LinalgOpInterfaceTraits::ExternalModel::verifyIndexingMapRequiredAttributes(::mlir::Operation *tablegen_opaque_val) const { +return success(); +} +template +SmallVector detail::LinalgOpInterfaceTraits::ExternalModel::getIndexingMapsArray(::mlir::Operation *tablegen_opaque_val) const { +auto range = (llvm::cast(tablegen_opaque_val)).getIndexingMaps() + .template getAsValueRange(); + return {range.begin(), range.end()}; +} +template +bool detail::LinalgOpInterfaceTraits::ExternalModel::hasDynamicShape(::mlir::Operation *tablegen_opaque_val) const { +return llvm::any_of(getStaticShape(), ShapedType::isDynamic); +} +template +std::string detail::LinalgOpInterfaceTraits::ExternalModel::getLibraryCallName(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getLibraryCallName(); +} +template +::llvm::SmallVector detail::LinalgOpInterfaceTraits::ExternalModel::getOpOperandsMatchingBBargs(::mlir::Operation *tablegen_opaque_val) const { +::llvm::SmallVector result; + result.reserve((llvm::cast(tablegen_opaque_val))->getNumOperands()); + llvm::transform( + this->getOperation()->getOpOperands(), + std::back_inserter(result), + [](OpOperand &opOperand) { return &opOperand; }); + return result; +} +template +LogicalResult detail::LinalgOpInterfaceTraits::ExternalModel::mapIterationSpaceDimToOperandDim(::mlir::Operation *tablegen_opaque_val, unsigned dimPos, ::mlir::Value &operand, unsigned &operandDimPos) const { +// Retrieve the operand and its dimension position from the first + // operand with a permutation map that is defined on such dimension. + for (auto [i, idxMap] : llvm::enumerate((llvm::cast(tablegen_opaque_val)).getIndexingMapsArray())) { + if (idxMap.isProjectedPermutation()) { + if (auto mayOperandDim = idxMap.getResultPosition( + getAffineDimExpr(dimPos, idxMap.getContext()))) { + operand = (llvm::cast(tablegen_opaque_val))->getOperand(i); + operandDimPos = *mayOperandDim; + return success(); + } + } + } + + return failure(); +} +template +void detail::LinalgOpInterfaceTraits::ExternalModel::mapIterationSpaceDimToAllOperandDims(::mlir::Operation *tablegen_opaque_val, unsigned dimPos, mlir::SmallVectorImpl>&operandDimPairs) const { +for (auto [i, idxMap] : llvm::enumerate((llvm::cast(tablegen_opaque_val)).getIndexingMapsArray())) { + if (idxMap.isProjectedPermutation()) { + if (auto mayOperandDim = idxMap.getResultPosition( + getAffineDimExpr(dimPos, idxMap.getContext()))) { + operandDimPairs.push_back({(llvm::cast(tablegen_opaque_val))->getOperand(i), *mayOperandDim}); + } + } + } + + return; +} +template +AffineMap detail::LinalgOpInterfaceTraits::ExternalModel::getLoopsToShapesMap(::mlir::Operation *tablegen_opaque_val) const { +auto maps = (llvm::cast(tablegen_opaque_val)).getIndexingMapsArray(); + return concatAffineMaps(maps); +} +template +AffineMap detail::LinalgOpInterfaceTraits::ExternalModel::getShapesToLoopsMap(::mlir::Operation *tablegen_opaque_val) const { +return inversePermutation(getLoopsToShapesMap()); +} +template +bool detail::LinalgOpInterfaceTraits::ExternalModel::canOpOperandsBeDropped(::mlir::Operation *tablegen_opaque_val, ArrayRef droppedOperands) const { +return detail::canOpOperandsBeDroppedImpl((llvm::cast(tablegen_opaque_val)), droppedOperands); +} +template +SmallVector detail::LinalgOpInterfaceTraits::ExternalModel::getStaticShape(::mlir::Operation *tablegen_opaque_val) const { +SmallVector res; + for (OpOperand &opOperand : this->getOperation()->getOpOperands()) + llvm::append_range(res, getShape(&opOperand)); + return res; +} +template +SmallVector detail::LinalgOpInterfaceTraits::ExternalModel::getStaticLoopRanges(::mlir::Operation *tablegen_opaque_val) const { +SmallVector viewSizes = getStaticShape(); + AffineMap invertedMap = getShapesToLoopsMap(); + assert(invertedMap && "expected a valid Linalg op to call the method"); + return invertedMap.compose(viewSizes); +} +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +template +FailureOr> detail::AggregatedOpInterfaceInterfaceTraits::Model::decomposeOperation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpBuilder & b) { + return (llvm::cast(tablegen_opaque_val)).decomposeOperation(b); +} +template +FailureOr> detail::AggregatedOpInterfaceInterfaceTraits::FallbackModel::decomposeOperation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, OpBuilder & b) { + return static_cast(impl)->decomposeOperation(tablegen_opaque_val, b); +} +template +FailureOr> detail::AggregatedOpInterfaceInterfaceTraits::ExternalModel::decomposeOperation(::mlir::Operation *tablegen_opaque_val, OpBuilder &b) const { +return {}; +} +} // namespace linalg +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..4757308f10bcb3af7b49e75069fd0576297738c6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.cpp.inc @@ -0,0 +1,7168 @@ + +//===----------------------------------------------------------------------===// +// Implementation of CopyOp +//===----------------------------------------------------------------------===// + +SmallVector CopyOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr CopyOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned CopyOp::getNumRegionArgs() { return 2; } + +std::string CopyOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void CopyOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(2 > 0 && block.getNumArguments() == 2 && + "CopyOp regionBuilder expects 2 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + TypeFn castVal = TypeFn::cast_signed; + auto castIter = llvm::find_if(attrs, [&](const NamedAttribute &attr) { + return attr.getName() == "cast"; }); + if (castIter != attrs.end()) { + if (auto attr = llvm::dyn_cast(castIter->getValue())) + castVal = attr.getValue(); + } + + Value value1 = helper.buildTypeFn(castVal, block.getArgument(1).getType(), block.getArgument(0)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult CopyOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + CopyOp::getNumRegionArgs(), CopyOp::getRegionBuilder()); +} +void CopyOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult CopyOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void CopyOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of ElemwiseUnaryOp +//===----------------------------------------------------------------------===// + +SmallVector ElemwiseUnaryOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr ElemwiseUnaryOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned ElemwiseUnaryOp::getNumRegionArgs() { return 2; } + +std::string ElemwiseUnaryOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void ElemwiseUnaryOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(2 > 0 && block.getNumArguments() == 2 && + "ElemwiseUnaryOp regionBuilder expects 2 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + UnaryFn funVal = UnaryFn::exp; + auto funIter = llvm::find_if(attrs, [&](const NamedAttribute &attr) { + return attr.getName() == "fun"; }); + if (funIter != attrs.end()) { + if (auto attr = llvm::dyn_cast(funIter->getValue())) + funVal = attr.getValue(); + } + + + TypeFn castVal = TypeFn::cast_signed; + auto castIter = llvm::find_if(attrs, [&](const NamedAttribute &attr) { + return attr.getName() == "cast"; }); + if (castIter != attrs.end()) { + if (auto attr = llvm::dyn_cast(castIter->getValue())) + castVal = attr.getValue(); + } + + Value value1 = helper.buildTypeFn(castVal, block.getArgument(1).getType(), block.getArgument(0)); + Value value2 = helper.buildUnaryFn(funVal, value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult ElemwiseUnaryOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + ElemwiseUnaryOp::getNumRegionArgs(), ElemwiseUnaryOp::getRegionBuilder()); +} +void ElemwiseUnaryOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult ElemwiseUnaryOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void ElemwiseUnaryOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of ExpOp +//===----------------------------------------------------------------------===// + +SmallVector ExpOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr ExpOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned ExpOp::getNumRegionArgs() { return 2; } + +std::string ExpOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void ExpOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(2 > 0 && block.getNumArguments() == 2 && + "ExpOp regionBuilder expects 2 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildUnaryFn(UnaryFn::exp, block.getArgument(0)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult ExpOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + ExpOp::getNumRegionArgs(), ExpOp::getRegionBuilder()); +} +void ExpOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult ExpOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void ExpOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of LogOp +//===----------------------------------------------------------------------===// + +SmallVector LogOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr LogOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned LogOp::getNumRegionArgs() { return 2; } + +std::string LogOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void LogOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(2 > 0 && block.getNumArguments() == 2 && + "LogOp regionBuilder expects 2 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildUnaryFn(UnaryFn::log, block.getArgument(0)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult LogOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + LogOp::getNumRegionArgs(), LogOp::getRegionBuilder()); +} +void LogOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult LogOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void LogOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of AbsOp +//===----------------------------------------------------------------------===// + +SmallVector AbsOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr AbsOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned AbsOp::getNumRegionArgs() { return 2; } + +std::string AbsOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void AbsOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(2 > 0 && block.getNumArguments() == 2 && + "AbsOp regionBuilder expects 2 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildUnaryFn(UnaryFn::abs, block.getArgument(0)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult AbsOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + AbsOp::getNumRegionArgs(), AbsOp::getRegionBuilder()); +} +void AbsOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult AbsOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void AbsOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of CeilOp +//===----------------------------------------------------------------------===// + +SmallVector CeilOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr CeilOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned CeilOp::getNumRegionArgs() { return 2; } + +std::string CeilOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void CeilOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(2 > 0 && block.getNumArguments() == 2 && + "CeilOp regionBuilder expects 2 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildUnaryFn(UnaryFn::ceil, block.getArgument(0)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult CeilOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + CeilOp::getNumRegionArgs(), CeilOp::getRegionBuilder()); +} +void CeilOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult CeilOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void CeilOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of FloorOp +//===----------------------------------------------------------------------===// + +SmallVector FloorOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr FloorOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned FloorOp::getNumRegionArgs() { return 2; } + +std::string FloorOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void FloorOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(2 > 0 && block.getNumArguments() == 2 && + "FloorOp regionBuilder expects 2 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildUnaryFn(UnaryFn::floor, block.getArgument(0)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult FloorOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + FloorOp::getNumRegionArgs(), FloorOp::getRegionBuilder()); +} +void FloorOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult FloorOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void FloorOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of NegfOp +//===----------------------------------------------------------------------===// + +SmallVector NegfOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr NegfOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned NegfOp::getNumRegionArgs() { return 2; } + +std::string NegfOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void NegfOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(2 > 0 && block.getNumArguments() == 2 && + "NegfOp regionBuilder expects 2 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildUnaryFn(UnaryFn::negf, block.getArgument(0)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult NegfOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + NegfOp::getNumRegionArgs(), NegfOp::getRegionBuilder()); +} +void NegfOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult NegfOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void NegfOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of ElemwiseBinaryOp +//===----------------------------------------------------------------------===// + +SmallVector ElemwiseBinaryOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr ElemwiseBinaryOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned ElemwiseBinaryOp::getNumRegionArgs() { return 3; } + +std::string ElemwiseBinaryOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void ElemwiseBinaryOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "ElemwiseBinaryOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + BinaryFn funVal = BinaryFn::add; + auto funIter = llvm::find_if(attrs, [&](const NamedAttribute &attr) { + return attr.getName() == "fun"; }); + if (funIter != attrs.end()) { + if (auto attr = llvm::dyn_cast(funIter->getValue())) + funVal = attr.getValue(); + } + + + TypeFn castVal = TypeFn::cast_signed; + auto castIter = llvm::find_if(attrs, [&](const NamedAttribute &attr) { + return attr.getName() == "cast"; }); + if (castIter != attrs.end()) { + if (auto attr = llvm::dyn_cast(castIter->getValue())) + castVal = attr.getValue(); + } + + Value value1 = helper.buildTypeFn(castVal, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(castVal, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(funVal, value1, value2); + yields.push_back(value3); + helper.yieldOutputs(yields); +} + +ParseResult ElemwiseBinaryOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + ElemwiseBinaryOp::getNumRegionArgs(), ElemwiseBinaryOp::getRegionBuilder()); +} +void ElemwiseBinaryOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult ElemwiseBinaryOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void ElemwiseBinaryOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of AddOp +//===----------------------------------------------------------------------===// + +SmallVector AddOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr AddOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned AddOp::getNumRegionArgs() { return 3; } + +std::string AddOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void AddOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "AddOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(0), block.getArgument(1)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult AddOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + AddOp::getNumRegionArgs(), AddOp::getRegionBuilder()); +} +void AddOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult AddOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void AddOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of SubOp +//===----------------------------------------------------------------------===// + +SmallVector SubOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr SubOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned SubOp::getNumRegionArgs() { return 3; } + +std::string SubOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void SubOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "SubOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildBinaryFn(BinaryFn::sub, block.getArgument(0), block.getArgument(1)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult SubOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + SubOp::getNumRegionArgs(), SubOp::getRegionBuilder()); +} +void SubOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult SubOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void SubOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of MulOp +//===----------------------------------------------------------------------===// + +SmallVector MulOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr MulOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned MulOp::getNumRegionArgs() { return 3; } + +std::string MulOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void MulOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "MulOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildBinaryFn(BinaryFn::mul, block.getArgument(0), block.getArgument(1)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult MulOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + MulOp::getNumRegionArgs(), MulOp::getRegionBuilder()); +} +void MulOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult MulOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void MulOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DivOp +//===----------------------------------------------------------------------===// + +SmallVector DivOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr DivOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned DivOp::getNumRegionArgs() { return 3; } + +std::string DivOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void DivOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DivOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildBinaryFn(BinaryFn::div, block.getArgument(0), block.getArgument(1)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult DivOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DivOp::getNumRegionArgs(), DivOp::getRegionBuilder()); +} +void DivOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DivOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DivOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DivUnsignedOp +//===----------------------------------------------------------------------===// + +SmallVector DivUnsignedOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr DivUnsignedOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned DivUnsignedOp::getNumRegionArgs() { return 3; } + +std::string DivUnsignedOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void DivUnsignedOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DivUnsignedOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildBinaryFn(BinaryFn::div_unsigned, block.getArgument(0), block.getArgument(1)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult DivUnsignedOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DivUnsignedOp::getNumRegionArgs(), DivUnsignedOp::getRegionBuilder()); +} +void DivUnsignedOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DivUnsignedOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DivUnsignedOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of MaxOp +//===----------------------------------------------------------------------===// + +SmallVector MaxOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr MaxOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned MaxOp::getNumRegionArgs() { return 3; } + +std::string MaxOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void MaxOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "MaxOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildBinaryFn(BinaryFn::max_signed, block.getArgument(0), block.getArgument(1)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult MaxOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + MaxOp::getNumRegionArgs(), MaxOp::getRegionBuilder()); +} +void MaxOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult MaxOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void MaxOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of MatmulOp +//===----------------------------------------------------------------------===// + +SmallVector MatmulOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(MatmulOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + return exprs; +} + +ArrayAttr MatmulOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned MatmulOp::getNumRegionArgs() { return 3; } + +std::string MatmulOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void MatmulOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "MatmulOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + TypeFn castVal = TypeFn::cast_signed; + auto castIter = llvm::find_if(attrs, [&](const NamedAttribute &attr) { + return attr.getName() == "cast"; }); + if (castIter != attrs.end()) { + if (auto attr = llvm::dyn_cast(castIter->getValue())) + castVal = attr.getValue(); + } + + Value value1 = helper.buildTypeFn(castVal, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(castVal, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult MatmulOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + MatmulOp::getNumRegionArgs(), MatmulOp::getRegionBuilder()); +} +void MatmulOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult MatmulOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void MatmulOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of MatmulUnsignedOp +//===----------------------------------------------------------------------===// + +SmallVector MatmulUnsignedOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(MatmulUnsignedOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + return exprs; +} + +ArrayAttr MatmulUnsignedOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned MatmulUnsignedOp::getNumRegionArgs() { return 3; } + +std::string MatmulUnsignedOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void MatmulUnsignedOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "MatmulUnsignedOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_unsigned, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_unsigned, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult MatmulUnsignedOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + MatmulUnsignedOp::getNumRegionArgs(), MatmulUnsignedOp::getRegionBuilder()); +} +void MatmulUnsignedOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult MatmulUnsignedOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void MatmulUnsignedOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of QuantizedMatmulOp +//===----------------------------------------------------------------------===// + +SmallVector QuantizedMatmulOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(QuantizedMatmulOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + return exprs; +} + +ArrayAttr QuantizedMatmulOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned QuantizedMatmulOp::getNumRegionArgs() { return 5; } + +std::string QuantizedMatmulOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void QuantizedMatmulOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(5 > 0 && block.getNumArguments() == 5 && + "QuantizedMatmulOp regionBuilder expects 5 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(2)); + Value value3 = helper.buildBinaryFn(BinaryFn::sub, value1, value2); + Value value4 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(1)); + Value value5 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(3)); + Value value6 = helper.buildBinaryFn(BinaryFn::sub, value4, value5); + Value value7 = helper.buildBinaryFn(BinaryFn::mul, value3, value6); + Value value8 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(4), value7); + yields.push_back(value8); + helper.yieldOutputs(yields); +} + +ParseResult QuantizedMatmulOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + QuantizedMatmulOp::getNumRegionArgs(), QuantizedMatmulOp::getRegionBuilder()); +} +void QuantizedMatmulOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult QuantizedMatmulOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void QuantizedMatmulOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of MatmulTransposeAOp +//===----------------------------------------------------------------------===// + +SmallVector MatmulTransposeAOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(MatmulTransposeAOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + return exprs; +} + +ArrayAttr MatmulTransposeAOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2, d0)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned MatmulTransposeAOp::getNumRegionArgs() { return 3; } + +std::string MatmulTransposeAOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void MatmulTransposeAOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "MatmulTransposeAOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + TypeFn castVal = TypeFn::cast_signed; + auto castIter = llvm::find_if(attrs, [&](const NamedAttribute &attr) { + return attr.getName() == "cast"; }); + if (castIter != attrs.end()) { + if (auto attr = llvm::dyn_cast(castIter->getValue())) + castVal = attr.getValue(); + } + + Value value1 = helper.buildTypeFn(castVal, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(castVal, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult MatmulTransposeAOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + MatmulTransposeAOp::getNumRegionArgs(), MatmulTransposeAOp::getRegionBuilder()); +} +void MatmulTransposeAOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult MatmulTransposeAOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void MatmulTransposeAOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of MatmulTransposeBOp +//===----------------------------------------------------------------------===// + +SmallVector MatmulTransposeBOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(MatmulTransposeBOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + return exprs; +} + +ArrayAttr MatmulTransposeBOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned MatmulTransposeBOp::getNumRegionArgs() { return 3; } + +std::string MatmulTransposeBOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void MatmulTransposeBOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "MatmulTransposeBOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + TypeFn castVal = TypeFn::cast_signed; + auto castIter = llvm::find_if(attrs, [&](const NamedAttribute &attr) { + return attr.getName() == "cast"; }); + if (castIter != attrs.end()) { + if (auto attr = llvm::dyn_cast(castIter->getValue())) + castVal = attr.getValue(); + } + + Value value1 = helper.buildTypeFn(castVal, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(castVal, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult MatmulTransposeBOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + MatmulTransposeBOp::getNumRegionArgs(), MatmulTransposeBOp::getRegionBuilder()); +} +void MatmulTransposeBOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult MatmulTransposeBOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void MatmulTransposeBOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Mmt4DOp +//===----------------------------------------------------------------------===// + +SmallVector Mmt4DOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Mmt4DOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + exprs.push_back(getAffineSymbolExpr(4, context)); + exprs.push_back(getAffineSymbolExpr(5, context)); + return exprs; +} + +ArrayAttr Mmt4DOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5] -> (d0, d2, d3, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5] -> (d1, d2, d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Mmt4DOp::getNumRegionArgs() { return 3; } + +std::string Mmt4DOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void Mmt4DOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Mmt4DOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Mmt4DOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Mmt4DOp::getNumRegionArgs(), Mmt4DOp::getRegionBuilder()); +} +void Mmt4DOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Mmt4DOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Mmt4DOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of BatchMmt4DOp +//===----------------------------------------------------------------------===// + +SmallVector BatchMmt4DOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(BatchMmt4DOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + exprs.push_back(getAffineSymbolExpr(4, context)); + exprs.push_back(getAffineSymbolExpr(5, context)); + exprs.push_back(getAffineSymbolExpr(6, context)); + return exprs; +} + +ArrayAttr BatchMmt4DOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6] -> (d0, d1, d3, d4, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6] -> (d0, d2, d3, d5, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6] -> (d0, d1, d2, d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned BatchMmt4DOp::getNumRegionArgs() { return 3; } + +std::string BatchMmt4DOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void BatchMmt4DOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "BatchMmt4DOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult BatchMmt4DOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + BatchMmt4DOp::getNumRegionArgs(), BatchMmt4DOp::getRegionBuilder()); +} +void BatchMmt4DOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult BatchMmt4DOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void BatchMmt4DOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of BatchMatmulOp +//===----------------------------------------------------------------------===// + +SmallVector BatchMatmulOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(BatchMatmulOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + return exprs; +} + +ArrayAttr BatchMatmulOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d1, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d3, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned BatchMatmulOp::getNumRegionArgs() { return 3; } + +std::string BatchMatmulOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void BatchMatmulOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "BatchMatmulOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult BatchMatmulOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + BatchMatmulOp::getNumRegionArgs(), BatchMatmulOp::getRegionBuilder()); +} +void BatchMatmulOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult BatchMatmulOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void BatchMatmulOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of BatchMatmulTransposeAOp +//===----------------------------------------------------------------------===// + +SmallVector BatchMatmulTransposeAOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(BatchMatmulTransposeAOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + return exprs; +} + +ArrayAttr BatchMatmulTransposeAOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d3, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d3, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned BatchMatmulTransposeAOp::getNumRegionArgs() { return 3; } + +std::string BatchMatmulTransposeAOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void BatchMatmulTransposeAOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "BatchMatmulTransposeAOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult BatchMatmulTransposeAOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + BatchMatmulTransposeAOp::getNumRegionArgs(), BatchMatmulTransposeAOp::getRegionBuilder()); +} +void BatchMatmulTransposeAOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult BatchMatmulTransposeAOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void BatchMatmulTransposeAOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of BatchMatmulTransposeBOp +//===----------------------------------------------------------------------===// + +SmallVector BatchMatmulTransposeBOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(BatchMatmulTransposeBOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + return exprs; +} + +ArrayAttr BatchMatmulTransposeBOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d1, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned BatchMatmulTransposeBOp::getNumRegionArgs() { return 3; } + +std::string BatchMatmulTransposeBOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void BatchMatmulTransposeBOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "BatchMatmulTransposeBOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult BatchMatmulTransposeBOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + BatchMatmulTransposeBOp::getNumRegionArgs(), BatchMatmulTransposeBOp::getRegionBuilder()); +} +void BatchMatmulTransposeBOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult BatchMatmulTransposeBOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void BatchMatmulTransposeBOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of QuantizedBatchMatmulOp +//===----------------------------------------------------------------------===// + +SmallVector QuantizedBatchMatmulOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(QuantizedBatchMatmulOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + return exprs; +} + +ArrayAttr QuantizedBatchMatmulOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d1, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d3, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned QuantizedBatchMatmulOp::getNumRegionArgs() { return 5; } + +std::string QuantizedBatchMatmulOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void QuantizedBatchMatmulOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(5 > 0 && block.getNumArguments() == 5 && + "QuantizedBatchMatmulOp regionBuilder expects 5 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(2)); + Value value3 = helper.buildBinaryFn(BinaryFn::sub, value1, value2); + Value value4 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(1)); + Value value5 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(3)); + Value value6 = helper.buildBinaryFn(BinaryFn::sub, value4, value5); + Value value7 = helper.buildBinaryFn(BinaryFn::mul, value3, value6); + Value value8 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(4), value7); + yields.push_back(value8); + helper.yieldOutputs(yields); +} + +ParseResult QuantizedBatchMatmulOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + QuantizedBatchMatmulOp::getNumRegionArgs(), QuantizedBatchMatmulOp::getRegionBuilder()); +} +void QuantizedBatchMatmulOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult QuantizedBatchMatmulOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void QuantizedBatchMatmulOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of BatchReduceMatmulOp +//===----------------------------------------------------------------------===// + +SmallVector BatchReduceMatmulOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::reduction, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(BatchReduceMatmulOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + return exprs; +} + +ArrayAttr BatchReduceMatmulOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d1, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d3, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned BatchReduceMatmulOp::getNumRegionArgs() { return 3; } + +std::string BatchReduceMatmulOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void BatchReduceMatmulOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "BatchReduceMatmulOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value2 = helper.buildBinaryFn(BinaryFn::mul, block.getArgument(0), value1); + Value value3 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult BatchReduceMatmulOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + BatchReduceMatmulOp::getNumRegionArgs(), BatchReduceMatmulOp::getRegionBuilder()); +} +void BatchReduceMatmulOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult BatchReduceMatmulOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void BatchReduceMatmulOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of MatvecOp +//===----------------------------------------------------------------------===// + +SmallVector MatvecOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(MatvecOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + return exprs; +} + +ArrayAttr MatvecOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d0, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d0)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned MatvecOp::getNumRegionArgs() { return 3; } + +std::string MatvecOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void MatvecOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "MatvecOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult MatvecOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + MatvecOp::getNumRegionArgs(), MatvecOp::getRegionBuilder()); +} +void MatvecOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult MatvecOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void MatvecOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of VecmatOp +//===----------------------------------------------------------------------===// + +SmallVector VecmatOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(VecmatOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + return exprs; +} + +ArrayAttr VecmatOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d1, d0)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d0)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned VecmatOp::getNumRegionArgs() { return 3; } + +std::string VecmatOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void VecmatOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "VecmatOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult VecmatOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + VecmatOp::getNumRegionArgs(), VecmatOp::getRegionBuilder()); +} +void VecmatOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult VecmatOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void VecmatOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of BatchMatvecOp +//===----------------------------------------------------------------------===// + +SmallVector BatchMatvecOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(BatchMatvecOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + return exprs; +} + +ArrayAttr BatchMatvecOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2)[s0, s1, s2] -> (d0, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 3, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned BatchMatvecOp::getNumRegionArgs() { return 3; } + +std::string BatchMatvecOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void BatchMatvecOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "BatchMatvecOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult BatchMatvecOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + BatchMatvecOp::getNumRegionArgs(), BatchMatvecOp::getRegionBuilder()); +} +void BatchMatvecOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult BatchMatvecOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void BatchMatvecOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DotOp +//===----------------------------------------------------------------------===// + +SmallVector DotOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(DotOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + return exprs; +} + +ArrayAttr DotOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0)[s0] -> (d0)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 1, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0)[s0] -> (d0)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 1, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0)[s0] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 1, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DotOp::getNumRegionArgs() { return 3; } + +std::string DotOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void DotOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DotOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DotOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DotOp::getNumRegionArgs(), DotOp::getRegionBuilder()); +} +void DotOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DotOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DotOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv1DOp +//===----------------------------------------------------------------------===// + +SmallVector Conv1DOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv1DOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + return exprs; +} + +ArrayAttr Conv1DOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d0 + d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d0)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv1DOp::getNumRegionArgs() { return 3; } + +std::string Conv1DOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void Conv1DOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv1DOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv1DOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv1DOp::getNumRegionArgs(), Conv1DOp::getRegionBuilder()); +} +void Conv1DOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv1DOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv1DOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv2DOp +//===----------------------------------------------------------------------===// + +SmallVector Conv2DOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv2DOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + return exprs; +} + +ArrayAttr Conv2DOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0 + d2, d1 + d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv2DOp::getNumRegionArgs() { return 3; } + +std::string Conv2DOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void Conv2DOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv2DOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv2DOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv2DOp::getNumRegionArgs(), Conv2DOp::getRegionBuilder()); +} +void Conv2DOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv2DOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv2DOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv3DOp +//===----------------------------------------------------------------------===// + +SmallVector Conv3DOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv3DOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + exprs.push_back(getAffineSymbolExpr(4, context)); + exprs.push_back(getAffineSymbolExpr(5, context)); + return exprs; +} + +ArrayAttr Conv3DOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5] -> (d0 + d3, d1 + d4, d2 + d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5] -> (d3, d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv3DOp::getNumRegionArgs() { return 3; } + +std::string Conv3DOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void Conv3DOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv3DOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv3DOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv3DOp::getNumRegionArgs(), Conv3DOp::getRegionBuilder()); +} +void Conv3DOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv3DOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv3DOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv1DNwcWcfOp +//===----------------------------------------------------------------------===// + +SmallVector Conv1DNwcWcfOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv1DNwcWcfOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + exprs.push_back(getAffineSymbolExpr(6, context)); + return exprs; +} + +ArrayAttr Conv1DNwcWcfOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4)[s0, s1, s2, s3, s4, s5, s6] -> (d0, d1 * s2 + d3 * s4, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 5, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4)[s0, s1, s2, s3, s4, s5, s6] -> (d3, d4, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 5, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4)[s0, s1, s2, s3, s4, s5, s6] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 5, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv1DNwcWcfOp::getNumRegionArgs() { return 3; } + +std::string Conv1DNwcWcfOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv1DNwcWcfOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv1DNwcWcfOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv1DNwcWcfOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv1DNwcWcfOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv1DNwcWcfOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv1DNwcWcfOp::getNumRegionArgs(), Conv1DNwcWcfOp::getRegionBuilder()); +} +void Conv1DNwcWcfOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv1DNwcWcfOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv1DNwcWcfOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv1DNcwFcwOp +//===----------------------------------------------------------------------===// + +SmallVector Conv1DNcwFcwOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv1DNcwFcwOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + exprs.push_back(getAffineSymbolExpr(6, context)); + return exprs; +} + +ArrayAttr Conv1DNcwFcwOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4)[s0, s1, s2, s3, s4, s5, s6] -> (d0, d3, d2 * s3 + d4 * s5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 5, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4)[s0, s1, s2, s3, s4, s5, s6] -> (d1, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 5, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4)[s0, s1, s2, s3, s4, s5, s6] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 5, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv1DNcwFcwOp::getNumRegionArgs() { return 3; } + +std::string Conv1DNcwFcwOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv1DNcwFcwOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv1DNcwFcwOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv1DNcwFcwOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv1DNcwFcwOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv1DNcwFcwOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv1DNcwFcwOp::getNumRegionArgs(), Conv1DNcwFcwOp::getRegionBuilder()); +} +void Conv1DNcwFcwOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv1DNcwFcwOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv1DNcwFcwOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv2DNhwcHwcfOp +//===----------------------------------------------------------------------===// + +SmallVector Conv2DNhwcHwcfOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv2DNhwcHwcfOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + exprs.push_back(getAffineSymbolExpr(10, context)); + return exprs; +} + +ArrayAttr Conv2DNhwcHwcfOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d4, d5, d6, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv2DNhwcHwcfOp::getNumRegionArgs() { return 3; } + +std::string Conv2DNhwcHwcfOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv2DNhwcHwcfOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv2DNhwcHwcfOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv2DNhwcHwcfOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv2DNhwcHwcfOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv2DNhwcHwcfOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv2DNhwcHwcfOp::getNumRegionArgs(), Conv2DNhwcHwcfOp::getRegionBuilder()); +} +void Conv2DNhwcHwcfOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv2DNhwcHwcfOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv2DNhwcHwcfOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv2DNhwcFhwcOp +//===----------------------------------------------------------------------===// + +SmallVector Conv2DNhwcFhwcOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv2DNhwcFhwcOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + exprs.push_back(getAffineSymbolExpr(10, context)); + return exprs; +} + +ArrayAttr Conv2DNhwcFhwcOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d3, d4, d5, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv2DNhwcFhwcOp::getNumRegionArgs() { return 3; } + +std::string Conv2DNhwcFhwcOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv2DNhwcFhwcOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv2DNhwcFhwcOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv2DNhwcFhwcOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv2DNhwcFhwcOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv2DNhwcFhwcOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv2DNhwcFhwcOp::getNumRegionArgs(), Conv2DNhwcFhwcOp::getRegionBuilder()); +} +void Conv2DNhwcFhwcOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv2DNhwcFhwcOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv2DNhwcFhwcOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv2DNhwcHwcfQOp +//===----------------------------------------------------------------------===// + +SmallVector Conv2DNhwcHwcfQOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv2DNhwcHwcfQOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + exprs.push_back(getAffineSymbolExpr(10, context)); + return exprs; +} + +ArrayAttr Conv2DNhwcHwcfQOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d4, d5, d6, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv2DNhwcHwcfQOp::getNumRegionArgs() { return 5; } + +std::string Conv2DNhwcHwcfQOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv2DNhwcHwcfQOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv2DNhwcHwcfQOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv2DNhwcHwcfQOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(5 > 0 && block.getNumArguments() == 5 && + "Conv2DNhwcHwcfQOp regionBuilder expects 5 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(2)); + Value value3 = helper.buildBinaryFn(BinaryFn::sub, value1, value2); + Value value4 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(1)); + Value value5 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(3)); + Value value6 = helper.buildBinaryFn(BinaryFn::sub, value4, value5); + Value value7 = helper.buildBinaryFn(BinaryFn::mul, value3, value6); + Value value8 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(4), value7); + yields.push_back(value8); + helper.yieldOutputs(yields); +} + +ParseResult Conv2DNhwcHwcfQOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv2DNhwcHwcfQOp::getNumRegionArgs(), Conv2DNhwcHwcfQOp::getRegionBuilder()); +} +void Conv2DNhwcHwcfQOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv2DNhwcHwcfQOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv2DNhwcHwcfQOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv2DNhwcFhwcQOp +//===----------------------------------------------------------------------===// + +SmallVector Conv2DNhwcFhwcQOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv2DNhwcFhwcQOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + exprs.push_back(getAffineSymbolExpr(10, context)); + return exprs; +} + +ArrayAttr Conv2DNhwcFhwcQOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d3, d4, d5, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv2DNhwcFhwcQOp::getNumRegionArgs() { return 5; } + +std::string Conv2DNhwcFhwcQOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv2DNhwcFhwcQOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv2DNhwcFhwcQOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv2DNhwcFhwcQOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(5 > 0 && block.getNumArguments() == 5 && + "Conv2DNhwcFhwcQOp regionBuilder expects 5 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(2)); + Value value3 = helper.buildBinaryFn(BinaryFn::sub, value1, value2); + Value value4 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(1)); + Value value5 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(3)); + Value value6 = helper.buildBinaryFn(BinaryFn::sub, value4, value5); + Value value7 = helper.buildBinaryFn(BinaryFn::mul, value3, value6); + Value value8 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(4), value7); + yields.push_back(value8); + helper.yieldOutputs(yields); +} + +ParseResult Conv2DNhwcFhwcQOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv2DNhwcFhwcQOp::getNumRegionArgs(), Conv2DNhwcFhwcQOp::getRegionBuilder()); +} +void Conv2DNhwcFhwcQOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv2DNhwcFhwcQOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv2DNhwcFhwcQOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv2DNchwFchwOp +//===----------------------------------------------------------------------===// + +SmallVector Conv2DNchwFchwOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv2DNchwFchwOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + exprs.push_back(getAffineSymbolExpr(6, context)); + +int64_t cst7 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst7, context)); + + exprs.push_back(getAffineSymbolExpr(8, context)); + +int64_t cst9 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst9, context)); + + exprs.push_back(getAffineSymbolExpr(10, context)); + return exprs; +} + +ArrayAttr Conv2DNchwFchwOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d4, d2 * s3 + d5 * s5, d3 * s7 + d6 * s9)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d1, d4, d5, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv2DNchwFchwOp::getNumRegionArgs() { return 3; } + +std::string Conv2DNchwFchwOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv2DNchwFchwOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv2DNchwFchwOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv2DNchwFchwOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv2DNchwFchwOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv2DNchwFchwOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv2DNchwFchwOp::getNumRegionArgs(), Conv2DNchwFchwOp::getRegionBuilder()); +} +void Conv2DNchwFchwOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv2DNchwFchwOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv2DNchwFchwOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv2DNgchwFgchwOp +//===----------------------------------------------------------------------===// + +SmallVector Conv2DNgchwFgchwOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv2DNgchwFgchwOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + +int64_t cst10 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst10, context)); + + exprs.push_back(getAffineSymbolExpr(11, context)); + return exprs; +} + +ArrayAttr Conv2DNgchwFgchwOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11] -> (d0, d1, d5, d3 * s4 + d6 * s6, d4 * s8 + d7 * s10)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11] -> (d1, d2, d5, d6, d7)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11] -> (d0, d1, d2, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv2DNgchwFgchwOp::getNumRegionArgs() { return 3; } + +std::string Conv2DNgchwFgchwOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv2DNgchwFgchwOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv2DNgchwFgchwOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv2DNgchwFgchwOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv2DNgchwFgchwOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv2DNgchwFgchwOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv2DNgchwFgchwOp::getNumRegionArgs(), Conv2DNgchwFgchwOp::getRegionBuilder()); +} +void Conv2DNgchwFgchwOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv2DNgchwFgchwOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv2DNgchwFgchwOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv3DNdhwcDhwcfOp +//===----------------------------------------------------------------------===// + +SmallVector Conv3DNdhwcDhwcfOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv3DNdhwcDhwcfOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + +int64_t cst10 = self.getStrides().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst10, context)); + + exprs.push_back(getAffineSymbolExpr(11, context)); + +int64_t cst12 = self.getDilations().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst12, context)); + + exprs.push_back(getAffineSymbolExpr(13, context)); + exprs.push_back(getAffineSymbolExpr(14, context)); + return exprs; +} + +ArrayAttr Conv3DNdhwcDhwcfOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d0, d1 * s2 + d5 * s4, d2 * s6 + d6 * s8, d3 * s10 + d7 * s12, d8)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d5, d6, d7, d8, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d0, d1, d2, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv3DNdhwcDhwcfOp::getNumRegionArgs() { return 3; } + +std::string Conv3DNdhwcDhwcfOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv3DNdhwcDhwcfOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv3DNdhwcDhwcfOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv3DNdhwcDhwcfOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv3DNdhwcDhwcfOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv3DNdhwcDhwcfOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv3DNdhwcDhwcfOp::getNumRegionArgs(), Conv3DNdhwcDhwcfOp::getRegionBuilder()); +} +void Conv3DNdhwcDhwcfOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv3DNdhwcDhwcfOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv3DNdhwcDhwcfOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv3DNdhwcDhwcfQOp +//===----------------------------------------------------------------------===// + +SmallVector Conv3DNdhwcDhwcfQOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv3DNdhwcDhwcfQOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + +int64_t cst10 = self.getStrides().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst10, context)); + + exprs.push_back(getAffineSymbolExpr(11, context)); + +int64_t cst12 = self.getDilations().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst12, context)); + + exprs.push_back(getAffineSymbolExpr(13, context)); + exprs.push_back(getAffineSymbolExpr(14, context)); + return exprs; +} + +ArrayAttr Conv3DNdhwcDhwcfQOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d0, d1 * s2 + d5 * s4, d2 * s6 + d6 * s8, d3 * s10 + d7 * s12, d8)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d5, d6, d7, d8, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d0, d1, d2, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv3DNdhwcDhwcfQOp::getNumRegionArgs() { return 5; } + +std::string Conv3DNdhwcDhwcfQOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv3DNdhwcDhwcfQOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv3DNdhwcDhwcfQOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv3DNdhwcDhwcfQOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(5 > 0 && block.getNumArguments() == 5 && + "Conv3DNdhwcDhwcfQOp regionBuilder expects 5 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(2)); + Value value3 = helper.buildBinaryFn(BinaryFn::sub, value1, value2); + Value value4 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(1)); + Value value5 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(3)); + Value value6 = helper.buildBinaryFn(BinaryFn::sub, value4, value5); + Value value7 = helper.buildBinaryFn(BinaryFn::mul, value3, value6); + Value value8 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(4), value7); + yields.push_back(value8); + helper.yieldOutputs(yields); +} + +ParseResult Conv3DNdhwcDhwcfQOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv3DNdhwcDhwcfQOp::getNumRegionArgs(), Conv3DNdhwcDhwcfQOp::getRegionBuilder()); +} +void Conv3DNdhwcDhwcfQOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv3DNdhwcDhwcfQOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv3DNdhwcDhwcfQOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of Conv3DNcdhwFcdhwOp +//===----------------------------------------------------------------------===// + +SmallVector Conv3DNcdhwFcdhwOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(Conv3DNcdhwFcdhwOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + exprs.push_back(getAffineSymbolExpr(6, context)); + +int64_t cst7 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst7, context)); + + exprs.push_back(getAffineSymbolExpr(8, context)); + +int64_t cst9 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst9, context)); + + exprs.push_back(getAffineSymbolExpr(10, context)); + +int64_t cst11 = self.getStrides().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst11, context)); + + exprs.push_back(getAffineSymbolExpr(12, context)); + +int64_t cst13 = self.getDilations().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst13, context)); + + exprs.push_back(getAffineSymbolExpr(14, context)); + return exprs; +} + +ArrayAttr Conv3DNcdhwFcdhwOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d0, d8, d1 * s3 + d5 * s5, d2 * s7 + d6 * s9, d3 * s11 + d7 * s13)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d4, d8, d5, d6, d7)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d0, d4, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned Conv3DNcdhwFcdhwOp::getNumRegionArgs() { return 3; } + +std::string Conv3DNcdhwFcdhwOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool Conv3DNcdhwFcdhwOp::hasDynamicIndexingMaps() { return true; } +LogicalResult Conv3DNcdhwFcdhwOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void Conv3DNcdhwFcdhwOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "Conv3DNcdhwFcdhwOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult Conv3DNcdhwFcdhwOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + Conv3DNcdhwFcdhwOp::getNumRegionArgs(), Conv3DNcdhwFcdhwOp::getRegionBuilder()); +} +void Conv3DNcdhwFcdhwOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult Conv3DNcdhwFcdhwOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void Conv3DNcdhwFcdhwOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv1DNwcWcOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv1DNwcWcOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(DepthwiseConv1DNwcWcOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + return exprs; +} + +ArrayAttr DepthwiseConv1DNwcWcOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1 * s2 + d3 * s4, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d3, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv1DNwcWcOp::getNumRegionArgs() { return 3; } + +std::string DepthwiseConv1DNwcWcOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv1DNwcWcOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv1DNwcWcOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv1DNwcWcOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DepthwiseConv1DNwcWcOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv1DNwcWcOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv1DNwcWcOp::getNumRegionArgs(), DepthwiseConv1DNwcWcOp::getRegionBuilder()); +} +void DepthwiseConv1DNwcWcOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv1DNwcWcOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv1DNwcWcOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv1DNcwCwOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv1DNcwCwOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(DepthwiseConv1DNcwCwOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + return exprs; +} + +ArrayAttr DepthwiseConv1DNcwCwOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d2, d1 * s3 + d3 * s5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d2, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv1DNcwCwOp::getNumRegionArgs() { return 3; } + +std::string DepthwiseConv1DNcwCwOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv1DNcwCwOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv1DNcwCwOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv1DNcwCwOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DepthwiseConv1DNcwCwOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv1DNcwCwOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv1DNcwCwOp::getNumRegionArgs(), DepthwiseConv1DNcwCwOp::getRegionBuilder()); +} +void DepthwiseConv1DNcwCwOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv1DNcwCwOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv1DNcwCwOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv1DNwcWcmOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv1DNwcWcmOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(DepthwiseConv1DNwcWcmOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + exprs.push_back(getAffineSymbolExpr(6, context)); + return exprs; +} + +ArrayAttr DepthwiseConv1DNwcWcmOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4)[s0, s1, s2, s3, s4, s5, s6] -> (d0, d1 * s2 + d4 * s4, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 5, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4)[s0, s1, s2, s3, s4, s5, s6] -> (d4, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 5, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4)[s0, s1, s2, s3, s4, s5, s6] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 5, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv1DNwcWcmOp::getNumRegionArgs() { return 3; } + +std::string DepthwiseConv1DNwcWcmOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv1DNwcWcmOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv1DNwcWcmOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv1DNwcWcmOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DepthwiseConv1DNwcWcmOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv1DNwcWcmOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv1DNwcWcmOp::getNumRegionArgs(), DepthwiseConv1DNwcWcmOp::getRegionBuilder()); +} +void DepthwiseConv1DNwcWcmOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv1DNwcWcmOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv1DNwcWcmOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv2DNhwcHwcOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv2DNhwcHwcOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(DepthwiseConv2DNhwcHwcOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + return exprs; +} + +ArrayAttr DepthwiseConv2DNhwcHwcOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d4, d5, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv2DNhwcHwcOp::getNumRegionArgs() { return 3; } + +std::string DepthwiseConv2DNhwcHwcOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv2DNhwcHwcOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv2DNhwcHwcOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv2DNhwcHwcOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DepthwiseConv2DNhwcHwcOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv2DNhwcHwcOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv2DNhwcHwcOp::getNumRegionArgs(), DepthwiseConv2DNhwcHwcOp::getRegionBuilder()); +} +void DepthwiseConv2DNhwcHwcOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv2DNhwcHwcOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv2DNhwcHwcOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv2DNchwChwOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv2DNchwChwOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(DepthwiseConv2DNchwChwOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + exprs.push_back(getAffineSymbolExpr(6, context)); + +int64_t cst7 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst7, context)); + + exprs.push_back(getAffineSymbolExpr(8, context)); + +int64_t cst9 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst9, context)); + + return exprs; +} + +ArrayAttr DepthwiseConv2DNchwChwOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d3, d1 * s3 + d4 * s5, d2 * s7 + d5 * s9)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d3, d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d3, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv2DNchwChwOp::getNumRegionArgs() { return 3; } + +std::string DepthwiseConv2DNchwChwOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv2DNchwChwOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv2DNchwChwOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv2DNchwChwOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DepthwiseConv2DNchwChwOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv2DNchwChwOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv2DNchwChwOp::getNumRegionArgs(), DepthwiseConv2DNchwChwOp::getRegionBuilder()); +} +void DepthwiseConv2DNchwChwOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv2DNchwChwOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv2DNchwChwOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv2DNhwcHwcQOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv2DNhwcHwcQOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(DepthwiseConv2DNhwcHwcQOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + return exprs; +} + +ArrayAttr DepthwiseConv2DNhwcHwcQOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d4, d5, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv2DNhwcHwcQOp::getNumRegionArgs() { return 5; } + +std::string DepthwiseConv2DNhwcHwcQOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv2DNhwcHwcQOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv2DNhwcHwcQOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv2DNhwcHwcQOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(5 > 0 && block.getNumArguments() == 5 && + "DepthwiseConv2DNhwcHwcQOp regionBuilder expects 5 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(2)); + Value value3 = helper.buildBinaryFn(BinaryFn::sub, value1, value2); + Value value4 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(1)); + Value value5 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(3)); + Value value6 = helper.buildBinaryFn(BinaryFn::sub, value4, value5); + Value value7 = helper.buildBinaryFn(BinaryFn::mul, value3, value6); + Value value8 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(4), value7); + yields.push_back(value8); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv2DNhwcHwcQOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv2DNhwcHwcQOp::getNumRegionArgs(), DepthwiseConv2DNhwcHwcQOp::getRegionBuilder()); +} +void DepthwiseConv2DNhwcHwcQOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv2DNhwcHwcQOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv2DNhwcHwcQOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv2DNhwcHwcmOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv2DNhwcHwcmOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(DepthwiseConv2DNhwcHwcmOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + exprs.push_back(getAffineSymbolExpr(10, context)); + return exprs; +} + +ArrayAttr DepthwiseConv2DNhwcHwcmOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1 * s2 + d5 * s4, d2 * s6 + d6 * s8, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d5, d6, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1, d2, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv2DNhwcHwcmOp::getNumRegionArgs() { return 3; } + +std::string DepthwiseConv2DNhwcHwcmOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv2DNhwcHwcmOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv2DNhwcHwcmOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv2DNhwcHwcmOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DepthwiseConv2DNhwcHwcmOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv2DNhwcHwcmOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv2DNhwcHwcmOp::getNumRegionArgs(), DepthwiseConv2DNhwcHwcmOp::getRegionBuilder()); +} +void DepthwiseConv2DNhwcHwcmOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv2DNhwcHwcmOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv2DNhwcHwcmOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv2DNhwcHwcmQOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv2DNhwcHwcmQOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(DepthwiseConv2DNhwcHwcmQOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + exprs.push_back(getAffineSymbolExpr(10, context)); + return exprs; +} + +ArrayAttr DepthwiseConv2DNhwcHwcmQOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1 * s2 + d5 * s4, d2 * s6 + d6 * s8, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d5, d6, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10] -> (d0, d1, d2, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 7, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv2DNhwcHwcmQOp::getNumRegionArgs() { return 5; } + +std::string DepthwiseConv2DNhwcHwcmQOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv2DNhwcHwcmQOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv2DNhwcHwcmQOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv2DNhwcHwcmQOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(5 > 0 && block.getNumArguments() == 5 && + "DepthwiseConv2DNhwcHwcmQOp regionBuilder expects 5 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(2)); + Value value3 = helper.buildBinaryFn(BinaryFn::sub, value1, value2); + Value value4 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(1)); + Value value5 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(4).getType(), block.getArgument(3)); + Value value6 = helper.buildBinaryFn(BinaryFn::sub, value4, value5); + Value value7 = helper.buildBinaryFn(BinaryFn::mul, value3, value6); + Value value8 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(4), value7); + yields.push_back(value8); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv2DNhwcHwcmQOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv2DNhwcHwcmQOp::getNumRegionArgs(), DepthwiseConv2DNhwcHwcmQOp::getRegionBuilder()); +} +void DepthwiseConv2DNhwcHwcmQOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv2DNhwcHwcmQOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv2DNhwcHwcmQOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv3DNdhwcDhwcOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv3DNdhwcDhwcOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::parallel }; +} + +static SmallVector getSymbolBindings(DepthwiseConv3DNdhwcDhwcOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + +int64_t cst10 = self.getStrides().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst10, context)); + + exprs.push_back(getAffineSymbolExpr(11, context)); + +int64_t cst12 = self.getDilations().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst12, context)); + + exprs.push_back(getAffineSymbolExpr(13, context)); + return exprs; +} + +ArrayAttr DepthwiseConv3DNdhwcDhwcOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d3 * s10 + d6 * s12, d7)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d4, d5, d6, d7)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d1, d2, d3, d7)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv3DNdhwcDhwcOp::getNumRegionArgs() { return 3; } + +std::string DepthwiseConv3DNdhwcDhwcOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv3DNdhwcDhwcOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv3DNdhwcDhwcOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv3DNdhwcDhwcOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DepthwiseConv3DNdhwcDhwcOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv3DNdhwcDhwcOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv3DNdhwcDhwcOp::getNumRegionArgs(), DepthwiseConv3DNdhwcDhwcOp::getRegionBuilder()); +} +void DepthwiseConv3DNdhwcDhwcOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv3DNdhwcDhwcOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv3DNdhwcDhwcOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv3DNcdhwCdhwOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv3DNcdhwCdhwOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::parallel }; +} + +static SmallVector getSymbolBindings(DepthwiseConv3DNcdhwCdhwOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + exprs.push_back(getAffineSymbolExpr(6, context)); + +int64_t cst7 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst7, context)); + + exprs.push_back(getAffineSymbolExpr(8, context)); + +int64_t cst9 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst9, context)); + + exprs.push_back(getAffineSymbolExpr(10, context)); + +int64_t cst11 = self.getStrides().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst11, context)); + + exprs.push_back(getAffineSymbolExpr(12, context)); + +int64_t cst13 = self.getDilations().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst13, context)); + + return exprs; +} + +ArrayAttr DepthwiseConv3DNcdhwCdhwOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d7, d1 * s3 + d4 * s5, d2 * s7 + d5 * s9, d3 * s11 + d6 * s13)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d7, d4, d5, d6)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d7, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv3DNcdhwCdhwOp::getNumRegionArgs() { return 3; } + +std::string DepthwiseConv3DNcdhwCdhwOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv3DNcdhwCdhwOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv3DNcdhwCdhwOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv3DNcdhwCdhwOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DepthwiseConv3DNcdhwCdhwOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv3DNcdhwCdhwOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv3DNcdhwCdhwOp::getNumRegionArgs(), DepthwiseConv3DNcdhwCdhwOp::getRegionBuilder()); +} +void DepthwiseConv3DNcdhwCdhwOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv3DNcdhwCdhwOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv3DNcdhwCdhwOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of DepthwiseConv3DNdhwcDhwcmOp +//===----------------------------------------------------------------------===// + +SmallVector DepthwiseConv3DNdhwcDhwcmOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::parallel }; +} + +static SmallVector getSymbolBindings(DepthwiseConv3DNdhwcDhwcmOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + +int64_t cst10 = self.getStrides().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst10, context)); + + exprs.push_back(getAffineSymbolExpr(11, context)); + +int64_t cst12 = self.getDilations().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst12, context)); + + exprs.push_back(getAffineSymbolExpr(13, context)); + exprs.push_back(getAffineSymbolExpr(14, context)); + return exprs; +} + +ArrayAttr DepthwiseConv3DNdhwcDhwcmOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d0, d1 * s2 + d5 * s4, d2 * s6 + d6 * s8, d3 * s10 + d7 * s12, d8)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d5, d6, d7, d8, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14] -> (d0, d1, d2, d3, d8, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 9, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned DepthwiseConv3DNdhwcDhwcmOp::getNumRegionArgs() { return 3; } + +std::string DepthwiseConv3DNdhwcDhwcmOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool DepthwiseConv3DNdhwcDhwcmOp::hasDynamicIndexingMaps() { return true; } +LogicalResult DepthwiseConv3DNdhwcDhwcmOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void DepthwiseConv3DNdhwcDhwcmOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "DepthwiseConv3DNdhwcDhwcmOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(1)); + Value value3 = helper.buildBinaryFn(BinaryFn::mul, value1, value2); + Value value4 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value3); + yields.push_back(value4); + helper.yieldOutputs(yields); +} + +ParseResult DepthwiseConv3DNdhwcDhwcmOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + DepthwiseConv3DNdhwcDhwcmOp::getNumRegionArgs(), DepthwiseConv3DNdhwcDhwcmOp::getRegionBuilder()); +} +void DepthwiseConv3DNdhwcDhwcmOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult DepthwiseConv3DNdhwcDhwcmOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void DepthwiseConv3DNdhwcDhwcmOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNhwcSumOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNhwcSumOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNhwcSumOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + return exprs; +} + +ArrayAttr PoolingNhwcSumOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNhwcSumOp::getNumRegionArgs() { return 3; } + +std::string PoolingNhwcSumOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNhwcSumOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNhwcSumOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNhwcSumOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNhwcSumOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNhwcSumOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNhwcSumOp::getNumRegionArgs(), PoolingNhwcSumOp::getRegionBuilder()); +} +void PoolingNhwcSumOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNhwcSumOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNhwcSumOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNchwSumOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNchwSumOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNchwSumOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + exprs.push_back(getAffineSymbolExpr(6, context)); + +int64_t cst7 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst7, context)); + + exprs.push_back(getAffineSymbolExpr(8, context)); + +int64_t cst9 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst9, context)); + + return exprs; +} + +ArrayAttr PoolingNchwSumOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2 * s3 + d4 * s5, d3 * s7 + d5 * s9)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNchwSumOp::getNumRegionArgs() { return 3; } + +std::string PoolingNchwSumOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNchwSumOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNchwSumOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNchwSumOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNchwSumOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNchwSumOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNchwSumOp::getNumRegionArgs(), PoolingNchwSumOp::getRegionBuilder()); +} +void PoolingNchwSumOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNchwSumOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNchwSumOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNhwcMaxOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNhwcMaxOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNhwcMaxOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + return exprs; +} + +ArrayAttr PoolingNhwcMaxOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNhwcMaxOp::getNumRegionArgs() { return 3; } + +std::string PoolingNhwcMaxOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNhwcMaxOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNhwcMaxOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNhwcMaxOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNhwcMaxOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::max_signed, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNhwcMaxOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNhwcMaxOp::getNumRegionArgs(), PoolingNhwcMaxOp::getRegionBuilder()); +} +void PoolingNhwcMaxOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNhwcMaxOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNhwcMaxOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNhwcMaxUnsignedOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNhwcMaxUnsignedOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNhwcMaxUnsignedOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + return exprs; +} + +ArrayAttr PoolingNhwcMaxUnsignedOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNhwcMaxUnsignedOp::getNumRegionArgs() { return 3; } + +std::string PoolingNhwcMaxUnsignedOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNhwcMaxUnsignedOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNhwcMaxUnsignedOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNhwcMaxUnsignedOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNhwcMaxUnsignedOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_unsigned, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::max_unsigned, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNhwcMaxUnsignedOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNhwcMaxUnsignedOp::getNumRegionArgs(), PoolingNhwcMaxUnsignedOp::getRegionBuilder()); +} +void PoolingNhwcMaxUnsignedOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNhwcMaxUnsignedOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNhwcMaxUnsignedOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNchwMaxOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNchwMaxOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNchwMaxOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + exprs.push_back(getAffineSymbolExpr(6, context)); + +int64_t cst7 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst7, context)); + + exprs.push_back(getAffineSymbolExpr(8, context)); + +int64_t cst9 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst9, context)); + + return exprs; +} + +ArrayAttr PoolingNchwMaxOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2 * s3 + d4 * s5, d3 * s7 + d5 * s9)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNchwMaxOp::getNumRegionArgs() { return 3; } + +std::string PoolingNchwMaxOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNchwMaxOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNchwMaxOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNchwMaxOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNchwMaxOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::max_signed, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNchwMaxOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNchwMaxOp::getNumRegionArgs(), PoolingNchwMaxOp::getRegionBuilder()); +} +void PoolingNchwMaxOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNchwMaxOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNchwMaxOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNhwcMinOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNhwcMinOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNhwcMinOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + return exprs; +} + +ArrayAttr PoolingNhwcMinOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNhwcMinOp::getNumRegionArgs() { return 3; } + +std::string PoolingNhwcMinOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNhwcMinOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNhwcMinOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNhwcMinOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNhwcMinOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::min_signed, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNhwcMinOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNhwcMinOp::getNumRegionArgs(), PoolingNhwcMinOp::getRegionBuilder()); +} +void PoolingNhwcMinOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNhwcMinOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNhwcMinOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNhwcMinUnsignedOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNhwcMinUnsignedOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNhwcMinUnsignedOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + return exprs; +} + +ArrayAttr PoolingNhwcMinUnsignedOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1 * s2 + d4 * s4, d2 * s6 + d5 * s8, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d4, d5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9] -> (d0, d1, d2, d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNhwcMinUnsignedOp::getNumRegionArgs() { return 3; } + +std::string PoolingNhwcMinUnsignedOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNhwcMinUnsignedOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNhwcMinUnsignedOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 2 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNhwcMinUnsignedOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNhwcMinUnsignedOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_unsigned, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::min_unsigned, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNhwcMinUnsignedOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNhwcMinUnsignedOp::getNumRegionArgs(), PoolingNhwcMinUnsignedOp::getRegionBuilder()); +} +void PoolingNhwcMinUnsignedOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNhwcMinUnsignedOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNhwcMinUnsignedOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNwcSumOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNwcSumOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNwcSumOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + return exprs; +} + +ArrayAttr PoolingNwcSumOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1 * s2 + d3 * s4, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNwcSumOp::getNumRegionArgs() { return 3; } + +std::string PoolingNwcSumOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNwcSumOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNwcSumOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNwcSumOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNwcSumOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNwcSumOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNwcSumOp::getNumRegionArgs(), PoolingNwcSumOp::getRegionBuilder()); +} +void PoolingNwcSumOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNwcSumOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNwcSumOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNcwSumOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNcwSumOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNcwSumOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + return exprs; +} + +ArrayAttr PoolingNcwSumOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2 * s3 + d3 * s5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNcwSumOp::getNumRegionArgs() { return 3; } + +std::string PoolingNcwSumOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNcwSumOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNcwSumOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNcwSumOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNcwSumOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNcwSumOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNcwSumOp::getNumRegionArgs(), PoolingNcwSumOp::getRegionBuilder()); +} +void PoolingNcwSumOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNcwSumOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNcwSumOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNwcMaxOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNwcMaxOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNwcMaxOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + return exprs; +} + +ArrayAttr PoolingNwcMaxOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1 * s2 + d3 * s4, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNwcMaxOp::getNumRegionArgs() { return 3; } + +std::string PoolingNwcMaxOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNwcMaxOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNwcMaxOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNwcMaxOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNwcMaxOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::max_signed, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNwcMaxOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNwcMaxOp::getNumRegionArgs(), PoolingNwcMaxOp::getRegionBuilder()); +} +void PoolingNwcMaxOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNwcMaxOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNwcMaxOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNwcMaxUnsignedOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNwcMaxUnsignedOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNwcMaxUnsignedOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + return exprs; +} + +ArrayAttr PoolingNwcMaxUnsignedOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1 * s2 + d3 * s4, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNwcMaxUnsignedOp::getNumRegionArgs() { return 3; } + +std::string PoolingNwcMaxUnsignedOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNwcMaxUnsignedOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNwcMaxUnsignedOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNwcMaxUnsignedOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNwcMaxUnsignedOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_unsigned, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::max_unsigned, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNwcMaxUnsignedOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNwcMaxUnsignedOp::getNumRegionArgs(), PoolingNwcMaxUnsignedOp::getRegionBuilder()); +} +void PoolingNwcMaxUnsignedOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNwcMaxUnsignedOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNwcMaxUnsignedOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNcwMaxOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNcwMaxOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNcwMaxOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + exprs.push_back(getAffineSymbolExpr(2, context)); + +int64_t cst3 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst3, context)); + + exprs.push_back(getAffineSymbolExpr(4, context)); + +int64_t cst5 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst5, context)); + + return exprs; +} + +ArrayAttr PoolingNcwMaxOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2 * s3 + d3 * s5)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNcwMaxOp::getNumRegionArgs() { return 3; } + +std::string PoolingNcwMaxOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNcwMaxOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNcwMaxOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNcwMaxOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNcwMaxOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::max_signed, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNcwMaxOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNcwMaxOp::getNumRegionArgs(), PoolingNcwMaxOp::getRegionBuilder()); +} +void PoolingNcwMaxOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNcwMaxOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNcwMaxOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNwcMinOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNwcMinOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNwcMinOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + return exprs; +} + +ArrayAttr PoolingNwcMinOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1 * s2 + d3 * s4, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNwcMinOp::getNumRegionArgs() { return 3; } + +std::string PoolingNwcMinOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNwcMinOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNwcMinOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNwcMinOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNwcMinOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::min_signed, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNwcMinOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNwcMinOp::getNumRegionArgs(), PoolingNwcMinOp::getRegionBuilder()); +} +void PoolingNwcMinOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNwcMinOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNwcMinOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNwcMinUnsignedOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNwcMinUnsignedOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNwcMinUnsignedOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + return exprs; +} + +ArrayAttr PoolingNwcMinUnsignedOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1 * s2 + d3 * s4, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d3)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d2)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 4, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNwcMinUnsignedOp::getNumRegionArgs() { return 3; } + +std::string PoolingNwcMinUnsignedOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNwcMinUnsignedOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNwcMinUnsignedOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 1 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNwcMinUnsignedOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNwcMinUnsignedOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_unsigned, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::min_unsigned, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNwcMinUnsignedOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNwcMinUnsignedOp::getNumRegionArgs(), PoolingNwcMinUnsignedOp::getRegionBuilder()); +} +void PoolingNwcMinUnsignedOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNwcMinUnsignedOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNwcMinUnsignedOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNdhwcSumOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNdhwcSumOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNdhwcSumOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + +int64_t cst10 = self.getStrides().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst10, context)); + + exprs.push_back(getAffineSymbolExpr(11, context)); + +int64_t cst12 = self.getDilations().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst12, context)); + + exprs.push_back(getAffineSymbolExpr(13, context)); + return exprs; +} + +ArrayAttr PoolingNdhwcSumOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d1 * s2 + d5 * s4, d2 * s6 + d6 * s8, d3 * s10 + d7 * s12, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d5, d6, d7)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d1, d2, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNdhwcSumOp::getNumRegionArgs() { return 3; } + +std::string PoolingNdhwcSumOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNdhwcSumOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNdhwcSumOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNdhwcSumOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNdhwcSumOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNdhwcSumOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNdhwcSumOp::getNumRegionArgs(), PoolingNdhwcSumOp::getRegionBuilder()); +} +void PoolingNdhwcSumOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNdhwcSumOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNdhwcSumOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNdhwcMaxOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNdhwcMaxOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNdhwcMaxOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + +int64_t cst10 = self.getStrides().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst10, context)); + + exprs.push_back(getAffineSymbolExpr(11, context)); + +int64_t cst12 = self.getDilations().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst12, context)); + + exprs.push_back(getAffineSymbolExpr(13, context)); + return exprs; +} + +ArrayAttr PoolingNdhwcMaxOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d1 * s2 + d5 * s4, d2 * s6 + d6 * s8, d3 * s10 + d7 * s12, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d5, d6, d7)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d1, d2, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNdhwcMaxOp::getNumRegionArgs() { return 3; } + +std::string PoolingNdhwcMaxOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNdhwcMaxOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNdhwcMaxOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNdhwcMaxOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNdhwcMaxOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::max_signed, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNdhwcMaxOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNdhwcMaxOp::getNumRegionArgs(), PoolingNdhwcMaxOp::getRegionBuilder()); +} +void PoolingNdhwcMaxOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNdhwcMaxOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNdhwcMaxOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of PoolingNdhwcMinOp +//===----------------------------------------------------------------------===// + +SmallVector PoolingNdhwcMinOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::parallel, utils::IteratorType::reduction, utils::IteratorType::reduction, utils::IteratorType::reduction }; +} + +static SmallVector getSymbolBindings(PoolingNdhwcMinOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + +int64_t cst2 = self.getStrides().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst2, context)); + + exprs.push_back(getAffineSymbolExpr(3, context)); + +int64_t cst4 = self.getDilations().getValues()[0]; +exprs.push_back(getAffineConstantExpr(cst4, context)); + + exprs.push_back(getAffineSymbolExpr(5, context)); + +int64_t cst6 = self.getStrides().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst6, context)); + + exprs.push_back(getAffineSymbolExpr(7, context)); + +int64_t cst8 = self.getDilations().getValues()[1]; +exprs.push_back(getAffineConstantExpr(cst8, context)); + + exprs.push_back(getAffineSymbolExpr(9, context)); + +int64_t cst10 = self.getStrides().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst10, context)); + + exprs.push_back(getAffineSymbolExpr(11, context)); + +int64_t cst12 = self.getDilations().getValues()[2]; +exprs.push_back(getAffineConstantExpr(cst12, context)); + + exprs.push_back(getAffineSymbolExpr(13, context)); + return exprs; +} + +ArrayAttr PoolingNdhwcMinOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d1 * s2 + d5 * s4, d2 * s6 + d6 * s8, d3 * s10 + d7 * s12, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d5, d6, d7)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5, d6, d7)[s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13] -> (d0, d1, d2, d3, d4)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 8, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned PoolingNdhwcMinOp::getNumRegionArgs() { return 3; } + +std::string PoolingNdhwcMinOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +bool PoolingNdhwcMinOp::hasDynamicIndexingMaps() { return true; } +LogicalResult PoolingNdhwcMinOp::verifyIndexingMapRequiredAttributes() { + Operation *op = getOperation(); + +if (auto attr = op->getAttrOfType("strides")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'strides'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'strides'"); +} + + +if (auto attr = op->getAttrOfType("dilations")) { + if (!attr.getType().getElementType().isInteger(64)) + return op->emitError("incorrect element type for index attribute 'dilations'"); + if (attr.getType().getShape() != ArrayRef{ 3 }) + return op->emitError("incorrect shape for index attribute 'dilations'"); +} + + return success(); +} + +void PoolingNdhwcMinOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(3 > 0 && block.getNumArguments() == 3 && + "PoolingNdhwcMinOp regionBuilder expects 3 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(2).getType(), block.getArgument(0)); + Value value2 = helper.buildBinaryFn(BinaryFn::min_signed, block.getArgument(2), value1); + yields.push_back(value2); + helper.yieldOutputs(yields); +} + +ParseResult PoolingNdhwcMinOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + PoolingNdhwcMinOp::getNumRegionArgs(), PoolingNdhwcMinOp::getRegionBuilder()); +} +void PoolingNdhwcMinOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult PoolingNdhwcMinOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void PoolingNdhwcMinOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of FillOp +//===----------------------------------------------------------------------===// + +SmallVector FillOp::getIteratorTypesArray() { + int64_t rank = getRank(getDpsInitOperand(0)); + return SmallVector(rank, utils::IteratorType::parallel); +} + +ArrayAttr FillOp::getIndexingMaps() { + MLIRContext *context = getContext(); + AffineMap scalarMap = AffineMap::get(getNumParallelLoops(), 0, context); + AffineMap tensorMap = AffineMap::getMultiDimIdentityMap( + getNumParallelLoops(), context); + SmallVector indexingMaps; + for (OpOperand &opOperand : getOperation()->getOpOperands()) + indexingMaps.push_back(getRank(&opOperand) == 0 ? scalarMap : tensorMap); + return Builder(getContext()).getAffineMapArrayAttr(indexingMaps); +} + +unsigned FillOp::getNumRegionArgs() { return 2; } + +std::string FillOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void FillOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(2 > 0 && block.getNumArguments() == 2 && + "FillOp regionBuilder expects 2 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(1).getType(), block.getArgument(0)); + yields.push_back(value1); + helper.yieldOutputs(yields); +} + +ParseResult FillOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + FillOp::getNumRegionArgs(), FillOp::getRegionBuilder()); +} +void FillOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult FillOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void FillOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} + +//===----------------------------------------------------------------------===// +// Implementation of FillRng2DOp +//===----------------------------------------------------------------------===// + +SmallVector FillRng2DOp::getIteratorTypesArray() { + return SmallVector{ utils::IteratorType::parallel, utils::IteratorType::parallel }; +} + +static SmallVector getSymbolBindings(FillRng2DOp self) { + MLIRContext *context = self.getContext(); + SmallVector exprs; + exprs.push_back(getAffineSymbolExpr(0, context)); + exprs.push_back(getAffineSymbolExpr(1, context)); + return exprs; +} + +ArrayAttr FillRng2DOp::getIndexingMaps() { + static const char memoizeAttr[] = "linalg.memoized_indexing_maps"; + ArrayAttr cached = getOperation()->getAttrOfType(memoizeAttr); + if (cached) + return cached; + + MLIRContext *context = getContext(); + auto symbolBindings = getSymbolBindings(*this); + SmallVector maps; + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> ()>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + maps.push_back(llvm::cast(mlir::parseAttribute("affine_map<(d0, d1)[s0, s1] -> (d0, d1)>", context)).getValue()); + maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 2, 0)); + cached = Builder(context).getAffineMapArrayAttr(maps); + getOperation()->setAttr(memoizeAttr, cached); + return cached; +} + +unsigned FillRng2DOp::getNumRegionArgs() { return 4; } + +std::string FillRng2DOp::getLibraryCallName() { + return generateLibraryCallName(getOperation()); +} + +void FillRng2DOp::regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs) { + assert(4 > 0 && block.getNumArguments() == 4 && + "FillRng2DOp regionBuilder expects 4 (>=0) args"); + RegionBuilderHelper helper(block.getArgument(0).getContext(), block); + SmallVector yields; + + Value value1 = helper.constant("2147483647 : i64"); + Value value2 = helper.buildTypeFn(TypeFn::cast_signed, helper.getFloat64Type(), value1); + Value value3 = helper.index(1); + Value value4 = helper.buildTypeFn(TypeFn::cast_signed, helper.getIntegerType(32), value3); + Value value5 = helper.index(0); + Value value6 = helper.buildTypeFn(TypeFn::cast_signed, helper.getIntegerType(32), value5); + Value value7 = helper.buildBinaryFn(BinaryFn::add, value6, block.getArgument(2)); + Value value8 = helper.constant("1103515245 : i64"); + Value value9 = helper.buildTypeFn(TypeFn::cast_signed, helper.getIntegerType(32), value8); + Value value10 = helper.buildBinaryFn(BinaryFn::mul, value7, value9); + Value value11 = helper.constant("12345 : i64"); + Value value12 = helper.buildTypeFn(TypeFn::cast_signed, helper.getIntegerType(32), value11); + Value value13 = helper.buildBinaryFn(BinaryFn::add, value10, value12); + Value value14 = helper.buildBinaryFn(BinaryFn::add, value4, value13); + Value value15 = helper.constant("1103515245 : i64"); + Value value16 = helper.buildTypeFn(TypeFn::cast_signed, helper.getIntegerType(32), value15); + Value value17 = helper.buildBinaryFn(BinaryFn::mul, value14, value16); + Value value18 = helper.constant("12345 : i64"); + Value value19 = helper.buildTypeFn(TypeFn::cast_signed, helper.getIntegerType(32), value18); + Value value20 = helper.buildBinaryFn(BinaryFn::add, value17, value19); + Value value21 = helper.buildTypeFn(TypeFn::cast_signed, helper.getFloat64Type(), value20); + Value value22 = helper.buildBinaryFn(BinaryFn::add, value2, value21); + Value value23 = helper.buildBinaryFn(BinaryFn::sub, block.getArgument(1), block.getArgument(0)); + Value value24 = helper.constant("2.3283063999999999E-10 : f64"); + Value value25 = helper.buildTypeFn(TypeFn::cast_signed, helper.getFloat64Type(), value24); + Value value26 = helper.buildBinaryFn(BinaryFn::mul, value23, value25); + Value value27 = helper.buildBinaryFn(BinaryFn::mul, value22, value26); + Value value28 = helper.buildBinaryFn(BinaryFn::add, value27, block.getArgument(0)); + Value value29 = helper.buildTypeFn(TypeFn::cast_signed, block.getArgument(3).getType(), value28); + yields.push_back(value29); + helper.yieldOutputs(yields); +} + +ParseResult FillRng2DOp::parse(OpAsmParser &parser, OperationState &result) { + return ::parseNamedStructuredOp(parser, result, + FillRng2DOp::getNumRegionArgs(), FillRng2DOp::getRegionBuilder()); +} +void FillRng2DOp::print(OpAsmPrinter &p) { + ::printNamedStructuredOp(p, getOperation(), getInputs(), getOutputs()); +} + +LogicalResult FillRng2DOp::fold(FoldAdaptor, + SmallVectorImpl &) { + return memref::foldMemRefCast(*this); +} +void FillRng2DOp::getEffects(SmallVectorImpl< + SideEffects::EffectInstance >&effects) { + if (hasTensorSemantics()) return; + getGenericEffectsImpl(effects, + getOperation()->getResults(), getDpsInputs(), getDpsInits()); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td new file mode 100644 index 0000000000000000000000000000000000000000..fab26bb91834d400df79565ac88c9d8bc17af286 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td @@ -0,0 +1,6272 @@ + +//===----------------------------------------------------------------------===// +// Op definition for CopyOp +//===----------------------------------------------------------------------===// + +def CopyOp : LinalgStructuredBase_Op<"copy", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Copies the tensor elementwise.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr:$cast + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, CopyOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, CopyOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$cast, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("cast", cast); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, CopyOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + let hasCanonicalizer = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for ElemwiseUnaryOp +//===----------------------------------------------------------------------===// + +def ElemwiseUnaryOp : LinalgStructuredBase_Op<"elemwise_unary", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Applies the unary function fun elementwise.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr:$fun, +DefaultValuedOptionalAttr:$cast + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, ElemwiseUnaryOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, ElemwiseUnaryOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$fun, "Attribute":$cast, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("fun", fun); +$_state.addAttribute("cast", cast); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, ElemwiseUnaryOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for ExpOp +//===----------------------------------------------------------------------===// + +def ExpOp : LinalgStructuredBase_Op<"exp", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Applies exp(x) elementwise.}]; + let description = [{No numeric casting is performed on the input operand.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, ExpOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, ExpOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for LogOp +//===----------------------------------------------------------------------===// + +def LogOp : LinalgStructuredBase_Op<"log", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Applies log(x) elementwise.}]; + let description = [{No numeric casting is performed on the input operand.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, LogOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, LogOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for AbsOp +//===----------------------------------------------------------------------===// + +def AbsOp : LinalgStructuredBase_Op<"abs", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Applies abs(x) elementwise.}]; + let description = [{No numeric casting is performed on the input operand.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, AbsOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, AbsOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for CeilOp +//===----------------------------------------------------------------------===// + +def CeilOp : LinalgStructuredBase_Op<"ceil", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Applies ceil(x) elementwise.}]; + let description = [{No numeric casting is performed on the input operand.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, CeilOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, CeilOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for FloorOp +//===----------------------------------------------------------------------===// + +def FloorOp : LinalgStructuredBase_Op<"floor", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Applies floor(x) elementwise.}]; + let description = [{No numeric casting is performed on the input operand.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, FloorOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, FloorOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for NegfOp +//===----------------------------------------------------------------------===// + +def NegfOp : LinalgStructuredBase_Op<"negf", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Applies negf(x) elementwise.}]; + let description = [{No numeric casting is performed on the input operand.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, NegfOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, NegfOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for ElemwiseBinaryOp +//===----------------------------------------------------------------------===// + +def ElemwiseBinaryOp : LinalgStructuredBase_Op<"elemwise_binary", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Applies the binary function fun elementwise.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr:$fun, +DefaultValuedOptionalAttr:$cast + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, ElemwiseBinaryOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, ElemwiseBinaryOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$fun, "Attribute":$cast, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("fun", fun); +$_state.addAttribute("cast", cast); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, ElemwiseBinaryOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for AddOp +//===----------------------------------------------------------------------===// + +def AddOp : LinalgStructuredBase_Op<"add", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Adds two tensors elementwise.}]; + let description = [{The shapes and element types must be identical. The appropriate casts, +broadcasts and reductions should be done previously to calling this op. + +This means reduction/broadcast/element cast semantics is explicit. Further +passes can take that into account when lowering this code. For example, +a `linalg.broadcast` + `linalg.add` sequence can be lowered to a +`linalg.generic` with different affine maps for the two operands.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, AddOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, AddOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for SubOp +//===----------------------------------------------------------------------===// + +def SubOp : LinalgStructuredBase_Op<"sub", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Subtracts two tensors elementwise.}]; + let description = [{The shapes and element types must be identical. The appropriate casts, +broadcasts and reductions should be done previously to calling this op. + +This means reduction/broadcast/element cast semantics is explicit. Further +passes can take that into account when lowering this code. For example, +a `linalg.broadcast` + `linalg.sub` sequence can be lowered to a +`linalg.generic` with different affine maps for the two operands.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, SubOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, SubOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for MulOp +//===----------------------------------------------------------------------===// + +def MulOp : LinalgStructuredBase_Op<"mul", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Multiplies two tensors elementwise.}]; + let description = [{The shapes and element types must be identical. The appropriate casts, +broadcasts and reductions should be done previously to calling this op. + +This means reduction/broadcast/element cast semantics is explicit. Further +passes can take that into account when lowering this code. For example, +a `linalg.broadcast` + `linalg.mul` sequence can be lowered to a +`linalg.generic` with different affine maps for the two operands.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, MulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, MulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DivOp +//===----------------------------------------------------------------------===// + +def DivOp : LinalgStructuredBase_Op<"div", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Divides the first tensor by the second tensor, elementwise.}]; + let description = [{The shapes and element types must be identical. The appropriate casts, +broadcasts and reductions should be done previously to calling this op. + +This means reduction/broadcast/element cast semantics is explicit. Further +passes can take that into account when lowering this code. For example, +a `linalg.broadcast` + `linalg.div` sequence can be lowered to a +`linalg.generic` with different affine maps for the two operands.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DivOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DivOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DivUnsignedOp +//===----------------------------------------------------------------------===// + +def DivUnsignedOp : LinalgStructuredBase_Op<"div_unsigned", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Divides the first tensor by the second tensor, elementwise. For integer +types, performs an unsigned division.}]; + let description = [{The shapes and element types must be identical. The appropriate casts, +broadcasts and reductions should be done previously to calling this op. + +This means reduction/broadcast/element cast semantics is explicit. Further +passes can take that into account when lowering this code. For example, +a `linalg.broadcast` + `linalg.div` sequence can be lowered to a +`linalg.generic` with different affine maps for the two operands.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DivUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DivUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for MaxOp +//===----------------------------------------------------------------------===// + +def MaxOp : LinalgStructuredBase_Op<"max", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Takes the max (signed) between two inputs, elementwise.}]; + let description = [{The shapes and element types must be identical. The appropriate casts, +broadcasts and reductions should be done previously to calling this op. + +This means reduction/broadcast/element cast semantics is explicit. Further +passes can take that into account when lowering this code. For example, +a `linalg.broadcast` + `linalg.div` sequence can be lowered to a +`linalg.generic` with different affine maps for the two operands.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, MaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, MaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for MatmulOp +//===----------------------------------------------------------------------===// + +def MatmulOp : LinalgStructuredBase_Op<"matmul", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a matrix multiplication of two 2D inputs.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr:$cast + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, MatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, MatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$cast, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("cast", cast); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, MatmulOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for MatmulUnsignedOp +//===----------------------------------------------------------------------===// + +def MatmulUnsignedOp : LinalgStructuredBase_Op<"matmul_unsigned", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs an unsigned matrix multiplication of two 2D inputs.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, MatmulUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, MatmulUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for QuantizedMatmulOp +//===----------------------------------------------------------------------===// + +def QuantizedMatmulOp : LinalgStructuredBase_Op<"quantized_matmul", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Performs a matrix multiplication of two 2D inputs.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. The quantized variant +includes zero-point adjustments for the left and right operands of the +matmul.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, QuantizedMatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, QuantizedMatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for MatmulTransposeAOp +//===----------------------------------------------------------------------===// + +def MatmulTransposeAOp : LinalgStructuredBase_Op<"matmul_transpose_a", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a matrix multiplication of two 2D inputs with lhs operand +transposed.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr:$cast + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, MatmulTransposeAOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, MatmulTransposeAOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$cast, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("cast", cast); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, MatmulTransposeAOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for MatmulTransposeBOp +//===----------------------------------------------------------------------===// + +def MatmulTransposeBOp : LinalgStructuredBase_Op<"matmul_transpose_b", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a matrix multiplication of two 2D inputs with rhs operand +transposed.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr:$cast + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, MatmulTransposeBOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, MatmulTransposeBOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$cast, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("cast", cast); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, MatmulTransposeBOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Mmt4DOp +//===----------------------------------------------------------------------===// + +def Mmt4DOp : LinalgStructuredBase_Op<"mmt4d", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a matrix-matrix-transpose multiplication of two 4D inputs.}]; + let description = [{Differences from linalg.matmul: +* The right hand side is transposed, whence the 't' in 'mmt'. +* The input and output tensors have a 4D shape instead of a 2D shape. They + are interpreted as 2D matrices with one level of 2D tile subdivision, + whence the 2+2=4 dimensions. The inner tile dimensions are identified with + '0' suffixes below, for instance the LHS matrix shape (M, K, M0, K0) reads + as: MxK tiles, each of shape M0xK0.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Mmt4DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Mmt4DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for BatchMmt4DOp +//===----------------------------------------------------------------------===// + +def BatchMmt4DOp : LinalgStructuredBase_Op<"batch_mmt4d", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a batched matrix-matrix-transpose multiplication of two +batched-4D (5D) inputs.}]; + let description = [{Besides the outermost batch dimension has the same semantic as +linalg.batch_matmul, the differences from linalg.batch_matmul in the +non-batch dimensions are the same as linalg.mmt4d vs. linalg.matmul. See the +description of lingalg.mmt4d.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, BatchMmt4DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, BatchMmt4DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for BatchMatmulOp +//===----------------------------------------------------------------------===// + +def BatchMatmulOp : LinalgStructuredBase_Op<"batch_matmul", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a batched matrix multiplication of two 3D inputs.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, BatchMatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, BatchMatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for BatchMatmulTransposeAOp +//===----------------------------------------------------------------------===// + +def BatchMatmulTransposeAOp : LinalgStructuredBase_Op<"batch_matmul_transpose_a", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a batched matrix multiplication of two 3D inputs where lhs operand +has its non-batch dimensions transposed.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, BatchMatmulTransposeAOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, BatchMatmulTransposeAOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for BatchMatmulTransposeBOp +//===----------------------------------------------------------------------===// + +def BatchMatmulTransposeBOp : LinalgStructuredBase_Op<"batch_matmul_transpose_b", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a batched matrix multiplication of two 3D inputs where rhs operand +has its non-batch dimensions transposed.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, BatchMatmulTransposeBOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, BatchMatmulTransposeBOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for QuantizedBatchMatmulOp +//===----------------------------------------------------------------------===// + +def QuantizedBatchMatmulOp : LinalgStructuredBase_Op<"quantized_batch_matmul", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Performs a batched matrix multiplication of two 3D inputs.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. The quantized variant +includes zero-point adjustments for the left and right operands of the +matmul.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, QuantizedBatchMatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, QuantizedBatchMatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for BatchReduceMatmulOp +//===----------------------------------------------------------------------===// + +def BatchReduceMatmulOp : LinalgStructuredBase_Op<"batch_reduce_matmul", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a batch-reduce matrix multiplication of two 3D inputs. +The partial multiplication results are reduced into a 2D output.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, BatchReduceMatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, BatchReduceMatmulOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for MatvecOp +//===----------------------------------------------------------------------===// + +def MatvecOp : LinalgStructuredBase_Op<"matvec", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a matrix-vector multiplication.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, MatvecOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, MatvecOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for VecmatOp +//===----------------------------------------------------------------------===// + +def VecmatOp : LinalgStructuredBase_Op<"vecmat", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a vector-matrix multiplication.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, VecmatOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, VecmatOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for BatchMatvecOp +//===----------------------------------------------------------------------===// + +def BatchMatvecOp : LinalgStructuredBase_Op<"batch_matvec", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a batched matrix-vector multiplication.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, BatchMatvecOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, BatchMatvecOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DotOp +//===----------------------------------------------------------------------===// + +def DotOp : LinalgStructuredBase_Op<"dot", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgContractionOpInterface])> { + + let summary = [{Performs a dot product of two vectors to a scalar result.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DotOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DotOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv1DOp +//===----------------------------------------------------------------------===// + +def Conv1DOp : LinalgStructuredBase_Op<"conv_1d", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 1-D convolution with no channels.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv1DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv1DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv2DOp +//===----------------------------------------------------------------------===// + +def Conv2DOp : LinalgStructuredBase_Op<"conv_2d", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 2-D convolution with no channels.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv2DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv2DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv3DOp +//===----------------------------------------------------------------------===// + +def Conv3DOp : LinalgStructuredBase_Op<"conv_3d", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 3-D convolution with no channels.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv3DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv3DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv1DNwcWcfOp +//===----------------------------------------------------------------------===// + +def Conv1DNwcWcfOp : LinalgStructuredBase_Op<"conv_1d_nwc_wcf", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 1-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv1DNwcWcfOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv1DNwcWcfOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv1DNwcWcfOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv1DNcwFcwOp +//===----------------------------------------------------------------------===// + +def Conv1DNcwFcwOp : LinalgStructuredBase_Op<"conv_1d_ncw_fcw", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 1-D convolution.}]; + let description = [{Layout: + * Input: NCW. + * Kernel: FCW. + +Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv1DNcwFcwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv1DNcwFcwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv1DNcwFcwOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv2DNhwcHwcfOp +//===----------------------------------------------------------------------===// + +def Conv2DNhwcHwcfOp : LinalgStructuredBase_Op<"conv_2d_nhwc_hwcf", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 2-D convolution.}]; + let description = [{Layout: + * Input: NHWC. + * Kernel: HWCF. + +Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv2DNhwcHwcfOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv2DNhwcHwcfOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv2DNhwcHwcfOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv2DNhwcFhwcOp +//===----------------------------------------------------------------------===// + +def Conv2DNhwcFhwcOp : LinalgStructuredBase_Op<"conv_2d_nhwc_fhwc", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 2-D convolution.}]; + let description = [{Layout: + * Input: NHWC. + * Kernel: FHWC. + +Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv2DNhwcFhwcOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv2DNhwcFhwcOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv2DNhwcFhwcOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv2DNhwcHwcfQOp +//===----------------------------------------------------------------------===// + +def Conv2DNhwcHwcfQOp : LinalgStructuredBase_Op<"conv_2d_nhwc_hwcf_q", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 2-D convolution with zero point offsets.}]; + let description = [{Layout: + * Input: NHWC. + * Kernel: HWCF. + +Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. This includes the zero +point offsets common to quantized operations.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv2DNhwcHwcfQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv2DNhwcHwcfQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv2DNhwcHwcfQOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv2DNhwcFhwcQOp +//===----------------------------------------------------------------------===// + +def Conv2DNhwcFhwcQOp : LinalgStructuredBase_Op<"conv_2d_nhwc_fhwc_q", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 2-D convolution with zero point offsets.}]; + let description = [{Layout: + * Input: NHWC. + * Kernel: FHWC. + +Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. This includes the zero +point offsets common to quantized operations.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv2DNhwcFhwcQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv2DNhwcFhwcQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv2DNhwcFhwcQOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv2DNchwFchwOp +//===----------------------------------------------------------------------===// + +def Conv2DNchwFchwOp : LinalgStructuredBase_Op<"conv_2d_nchw_fchw", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 2-D convolution.}]; + let description = [{Layout: + * Input: NCHW. + * Kernel: FCHW. + +Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv2DNchwFchwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv2DNchwFchwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv2DNchwFchwOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv2DNgchwFgchwOp +//===----------------------------------------------------------------------===// + +def Conv2DNgchwFgchwOp : LinalgStructuredBase_Op<"conv_2d_ngchw_fgchw", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 2-D grouped convolution.}]; + let description = [{Layout: + * Input: NGCHW. + * Kernel: FGCHW. + +Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv2DNgchwFgchwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv2DNgchwFgchwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv2DNgchwFgchwOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv3DNdhwcDhwcfOp +//===----------------------------------------------------------------------===// + +def Conv3DNdhwcDhwcfOp : LinalgStructuredBase_Op<"conv_3d_ndhwc_dhwcf", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 3-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv3DNdhwcDhwcfOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv3DNdhwcDhwcfOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv3DNdhwcDhwcfOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv3DNdhwcDhwcfQOp +//===----------------------------------------------------------------------===// + +def Conv3DNdhwcDhwcfQOp : LinalgStructuredBase_Op<"conv_3d_ndhwc_dhwcf_q", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 3-D convolution with zero point offsets.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. This includes the zero +point offsets common to quantized operations.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv3DNdhwcDhwcfQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv3DNdhwcDhwcfQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv3DNdhwcDhwcfQOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for Conv3DNcdhwFcdhwOp +//===----------------------------------------------------------------------===// + +def Conv3DNcdhwFcdhwOp : LinalgStructuredBase_Op<"conv_3d_ncdhw_fcdhw", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 3-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, Conv3DNcdhwFcdhwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, Conv3DNcdhwFcdhwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, Conv3DNcdhwFcdhwOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv1DNwcWcOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv1DNwcWcOp : LinalgStructuredBase_Op<"depthwise_conv_1d_nwc_wc", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 1-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. Multiplier is set to 1 +which is a special case for most depthwise convolutions.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv1DNwcWcOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv1DNwcWcOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv1DNwcWcOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv1DNcwCwOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv1DNcwCwOp : LinalgStructuredBase_Op<"depthwise_conv_1d_ncw_cw", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 1-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. Multiplier is set to 1 +which is a special case for most depthwise convolutions.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv1DNcwCwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv1DNcwCwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv1DNcwCwOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv1DNwcWcmOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv1DNwcWcmOp : LinalgStructuredBase_Op<"depthwise_conv_1d_nwc_wcm", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 1-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv1DNwcWcmOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv1DNwcWcmOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv1DNwcWcmOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv2DNhwcHwcOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv2DNhwcHwcOp : LinalgStructuredBase_Op<"depthwise_conv_2d_nhwc_hwc", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 2-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. Multiplier is set to 1 +which is a special case for most depthwise convolutions.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNhwcHwcOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv2DNchwChwOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv2DNchwChwOp : LinalgStructuredBase_Op<"depthwise_conv_2d_nchw_chw", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 2-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. Multiplier is set to 1 +which is a special case for most depthwise convolutions.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNchwChwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNchwChwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNchwChwOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv2DNhwcHwcQOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv2DNhwcHwcQOp : LinalgStructuredBase_Op<"depthwise_conv_2d_nhwc_hwc_q", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 2-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNhwcHwcQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcQOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv2DNhwcHwcmOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv2DNhwcHwcmOp : LinalgStructuredBase_Op<"depthwise_conv_2d_nhwc_hwcm", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 2-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcmOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNhwcHwcmOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcmOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv2DNhwcHwcmQOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv2DNhwcHwcmQOp : LinalgStructuredBase_Op<"depthwise_conv_2d_nhwc_hwcm_q", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 2-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcmQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNhwcHwcmQOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcmQOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv3DNdhwcDhwcOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv3DNdhwcDhwcOp : LinalgStructuredBase_Op<"depthwise_conv_3d_ndhwc_dhwc", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 3-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. Multiplier is set to 1 +which is a special case for most depthwise convolutions.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv3DNdhwcDhwcOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv3DNdhwcDhwcOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv3DNdhwcDhwcOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv3DNcdhwCdhwOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv3DNcdhwCdhwOp : LinalgStructuredBase_Op<"depthwise_conv_3d_ncdhw_cdhw", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 3-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output. Multiplier is set to 1 +which is a special case for most depthwise convolutions.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv3DNcdhwCdhwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv3DNcdhwCdhwOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv3DNcdhwCdhwOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for DepthwiseConv3DNdhwcDhwcmOp +//===----------------------------------------------------------------------===// + +def DepthwiseConv3DNdhwcDhwcmOp : LinalgStructuredBase_Op<"depthwise_conv_3d_ndhwc_dhwcm", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs depth-wise 3-D convolution.}]; + let description = [{Numeric casting is performed on the operands to the inner multiply, promoting +them to the same data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, DepthwiseConv3DNdhwcDhwcmOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv3DNdhwcDhwcmOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv3DNdhwcDhwcmOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNhwcSumOp +//===----------------------------------------------------------------------===// + +def PoolingNhwcSumOp : LinalgStructuredBase_Op<"pooling_nhwc_sum", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs sum pooling.}]; + let description = [{Layout: + * Input: NHWC. + * Kernel: HW. + +Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNhwcSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcSumOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNchwSumOp +//===----------------------------------------------------------------------===// + +def PoolingNchwSumOp : LinalgStructuredBase_Op<"pooling_nchw_sum", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs sum pooling.}]; + let description = [{Layout: + * Input: NCHW. + * Kernel: HW. + +Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNchwSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNchwSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNchwSumOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNhwcMaxOp +//===----------------------------------------------------------------------===// + +def PoolingNhwcMaxOp : LinalgStructuredBase_Op<"pooling_nhwc_max", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs max pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNhwcMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcMaxOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNhwcMaxUnsignedOp +//===----------------------------------------------------------------------===// + +def PoolingNhwcMaxUnsignedOp : LinalgStructuredBase_Op<"pooling_nhwc_max_unsigned", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs unsigned max pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNhwcMaxUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcMaxUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcMaxUnsignedOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNchwMaxOp +//===----------------------------------------------------------------------===// + +def PoolingNchwMaxOp : LinalgStructuredBase_Op<"pooling_nchw_max", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs max pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNchwMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNchwMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNchwMaxOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNhwcMinOp +//===----------------------------------------------------------------------===// + +def PoolingNhwcMinOp : LinalgStructuredBase_Op<"pooling_nhwc_min", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs min pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNhwcMinOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcMinOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcMinOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNhwcMinUnsignedOp +//===----------------------------------------------------------------------===// + +def PoolingNhwcMinUnsignedOp : LinalgStructuredBase_Op<"pooling_nhwc_min_unsigned", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs unsigned min pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNhwcMinUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcMinUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcMinUnsignedOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNwcSumOp +//===----------------------------------------------------------------------===// + +def PoolingNwcSumOp : LinalgStructuredBase_Op<"pooling_nwc_sum", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs sum pooling.}]; + let description = [{Layout: + * Input: NWC. + * Kernel: W. + +Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNwcSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcSumOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNcwSumOp +//===----------------------------------------------------------------------===// + +def PoolingNcwSumOp : LinalgStructuredBase_Op<"pooling_ncw_sum", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs sum pooling.}]; + let description = [{Layout: + * Input: NCW. + * Kernel: W. + +Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNcwSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNcwSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNcwSumOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNwcMaxOp +//===----------------------------------------------------------------------===// + +def PoolingNwcMaxOp : LinalgStructuredBase_Op<"pooling_nwc_max", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs max pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNwcMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcMaxOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNwcMaxUnsignedOp +//===----------------------------------------------------------------------===// + +def PoolingNwcMaxUnsignedOp : LinalgStructuredBase_Op<"pooling_nwc_max_unsigned", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs unsigned max pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNwcMaxUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcMaxUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcMaxUnsignedOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNcwMaxOp +//===----------------------------------------------------------------------===// + +def PoolingNcwMaxOp : LinalgStructuredBase_Op<"pooling_ncw_max", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs max pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNcwMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNcwMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNcwMaxOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNwcMinOp +//===----------------------------------------------------------------------===// + +def PoolingNwcMinOp : LinalgStructuredBase_Op<"pooling_nwc_min", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs min pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNwcMinOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcMinOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcMinOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNwcMinUnsignedOp +//===----------------------------------------------------------------------===// + +def PoolingNwcMinUnsignedOp : LinalgStructuredBase_Op<"pooling_nwc_min_unsigned", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs unsigned min pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNwcMinUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcMinUnsignedOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcMinUnsignedOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNdhwcSumOp +//===----------------------------------------------------------------------===// + +def PoolingNdhwcSumOp : LinalgStructuredBase_Op<"pooling_ndhwc_sum", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 3D sum pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNdhwcSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNdhwcSumOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNdhwcSumOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNdhwcMaxOp +//===----------------------------------------------------------------------===// + +def PoolingNdhwcMaxOp : LinalgStructuredBase_Op<"pooling_ndhwc_max", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 3D max pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNdhwcMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNdhwcMaxOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNdhwcMaxOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for PoolingNdhwcMinOp +//===----------------------------------------------------------------------===// + +def PoolingNdhwcMinOp : LinalgStructuredBase_Op<"pooling_ndhwc_min", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgConvolutionOpInterface])> { + + let summary = [{Performs 3D min pooling.}]; + let description = [{Numeric casting is performed on the input operand, promoting it to the same +data type as the accumulator/output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$strides, +DefaultValuedOptionalAttr, "{ static_cast(1), static_cast(1), static_cast(1) }">:$dilations + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, PoolingNdhwcMinOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, PoolingNdhwcMinOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + , OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, "Attribute":$strides, "Attribute":$dilations, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addAttribute("strides", strides); +$_state.addAttribute("dilations", dilations); + buildStructuredOp($_builder, $_state, resultTensorTypes, inputs, outputs, + attributes, PoolingNdhwcMinOp::getRegionBuilder()); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for FillOp +//===----------------------------------------------------------------------===// + +def FillOp : LinalgStructuredBase_Op<"fill", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[LinalgFillOpInterface])> { + + let summary = [{Fills the output tensor with the given value.}]; + let description = [{Works for arbitrary ranked output tensors since the operation performs scalar +accesses only and is thus rank polymorphic. Numeric casting is performed on +the value operand, promoting it to the same data type as the output.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, FillOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, FillOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + let hasCanonicalizer = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} + +//===----------------------------------------------------------------------===// +// Op definition for FillRng2DOp +//===----------------------------------------------------------------------===// + +def FillRng2DOp : LinalgStructuredBase_Op<"fill_rng_2d", !listconcat([AttrSizedOperandSegments], + /*extraInterfaces=*/[])> { + + let summary = [{Fills the output tensor with pseudo random numbers.}]; + let description = [{The operation generations pseudo random numbers using a linear congruential +generator. It provides no guarantees regarding the distribution of the +generated random numbers. Instead of generating the random numbers +sequentially, it instantiates one random number generator per data element +and runs them in parallel. The seed operand and the indices of the data +element seed the random number generation. The min and max operands limit +the range of the generated random numbers.}]; + + let arguments = (ins + Variadic:$inputs, + Variadic:$outputs + ); + let results = (outs Variadic:$result_tensors); + let regions = (region AnyRegion:$region); + + let skipDefaultBuilders = 1; + let builders = [ + OpBuilder< + (ins "ValueRange":$inputs, "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, std::nullopt, inputs, outputs, + attributes, FillRng2DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs, + "ValueRange":$outputs, + CArg<"ArrayRef", "{}">:$attributes), + [{ + buildStructuredOp($_builder, $_state, resultTensorTypes, + inputs, outputs, attributes, FillRng2DOp::getRegionBuilder()); + }]>, + OpBuilder< + (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands, + CArg<"ArrayRef", "{}">:$attributes), + [{ + $_state.addOperands(operands); + $_state.addAttributes(attributes); + $_state.addTypes(resultTensorTypes); + (void)$_state.addRegion(); + }]> + + ]; + let hasCustomAssemblyFormat = 1; + let hasFolder = 1; + + + let extraClassDeclaration = structuredOpsBaseDecls # [{ + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + }]; +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..3d8516cc0518b37fe2c36d0012d19bd66ee89d67 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc @@ -0,0 +1,963 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LinalgOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::linalg::IndexOp, +::mlir::linalg::SoftmaxOp, +::mlir::linalg::YieldOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace linalg { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LinalgOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LinalgOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::ShapedType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be shaped of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LinalgOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::RankedTensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be ranked tensor of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LinalgOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() >= 0)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::IndexOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +IndexOpGenericAdaptorBase::IndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.index", odsAttrs.getContext()); +} + +IndexOpGenericAdaptorBase::IndexOpGenericAdaptorBase(IndexOp op) : IndexOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair IndexOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr IndexOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr IndexOpGenericAdaptorBase::getDimAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().dim); + return attr; +} + +uint64_t IndexOpGenericAdaptorBase::getDim() { + auto attr = getDimAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +IndexOpAdaptor::IndexOpAdaptor(IndexOp op) : IndexOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult IndexOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dim = getProperties().dim; (void)tblgen_dim; + if (!tblgen_dim) return emitError(loc, "'linalg.index' op ""requires attribute 'dim'"); + + if (tblgen_dim && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_dim))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_dim).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_dim).getInt() >= 0)))) + return emitError(loc, "'linalg.index' op ""attribute 'dim' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"); + return ::mlir::success(); +} + +std::pair IndexOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range IndexOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair IndexOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range IndexOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> IndexOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult IndexOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dim; + auto attr = dict.get("dim"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dim in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dim` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute IndexOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dim; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dim", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code IndexOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dim.getAsOpaquePointer())); +} + +std::optional IndexOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dim") + return prop.dim; + return std::nullopt; +} + +void IndexOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dim") { + prop.dim = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void IndexOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dim) attrs.append("dim", prop.dim); +} + +::mlir::LogicalResult IndexOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDimAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgOps0(attr, "dim", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult IndexOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dim))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void IndexOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dim); +} + +::mlir::IntegerAttr IndexOp::getDimAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().dim); +} + +uint64_t IndexOp::getDim() { + auto attr = getDimAttr(); + return attr.getValue().getZExtValue(); +} + +void IndexOp::setDimAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getDimAttrName(), attr); +} + +void IndexOp::setDim(uint64_t attrValue) { + (*this)->setAttr(getDimAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue)); +} + +void IndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::IntegerAttr dim) { + odsState.getOrAddProperties().dim = dim; + odsState.addTypes(result); +} + +void IndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr dim) { + odsState.getOrAddProperties().dim = dim; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(IndexOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void IndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr dim) { + odsState.getOrAddProperties().dim = dim; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, uint64_t dim) { + odsState.getOrAddProperties().dim = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), dim); + odsState.addTypes(result); +} + +void IndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t dim) { + odsState.getOrAddProperties().dim = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), dim); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(IndexOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void IndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t dim) { + odsState.getOrAddProperties().dim = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), dim); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IndexOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void IndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(IndexOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult IndexOp::verifyInvariantsImpl() { + auto tblgen_dim = getProperties().dim; (void)tblgen_dim; + if (!tblgen_dim) return emitOpError("requires attribute 'dim'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgOps0(*this, tblgen_dim, "dim"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult IndexOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult IndexOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult IndexOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr dimAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + if (parser.parseCustomAttributeWithFallback(dimAttr, parser.getBuilder().getIntegerType(64))) { + return ::mlir::failure(); + } + if (dimAttr) result.getOrAddProperties().dim = dimAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::IndexType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + return ::mlir::success(); +} + +void IndexOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getDimAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("dim"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::IndexType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void IndexOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::IndexOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::SoftmaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SoftmaxOpGenericAdaptorBase::SoftmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.softmax", odsAttrs.getContext()); +} + +SoftmaxOpGenericAdaptorBase::SoftmaxOpGenericAdaptorBase(SoftmaxOp op) : SoftmaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SoftmaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SoftmaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr SoftmaxOpGenericAdaptorBase::getDimensionAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().dimension); + return attr; +} + +uint64_t SoftmaxOpGenericAdaptorBase::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +SoftmaxOpAdaptor::SoftmaxOpAdaptor(SoftmaxOp op) : SoftmaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SoftmaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitError(loc, "'linalg.softmax' op ""requires attribute 'dimension'"); + + if (tblgen_dimension && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_dimension))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_dimension).getType().isSignlessInteger(64))))) + return emitError(loc, "'linalg.softmax' op ""attribute 'dimension' failed to satisfy constraint: 64-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair SoftmaxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SoftmaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ShapedType> SoftmaxOp::getInput() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ShapedType> SoftmaxOp::getOutput() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &SoftmaxOp::getInputMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &SoftmaxOp::getOutputMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair SoftmaxOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SoftmaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range SoftmaxOp::getResult() { + return getODSResults(0); +} + +::mlir::LogicalResult SoftmaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dimension; + auto attr = dict.get("dimension"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dimension in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dimension` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SoftmaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dimension; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dimension", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SoftmaxOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dimension.getAsOpaquePointer())); +} + +std::optional SoftmaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dimension") + return prop.dimension; + return std::nullopt; +} + +void SoftmaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dimension") { + prop.dimension = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SoftmaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dimension) attrs.append("dimension", prop.dimension); +} + +::mlir::LogicalResult SoftmaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDimensionAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgOps1(attr, "dimension", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SoftmaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dimension))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SoftmaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dimension); +} + +::mlir::IntegerAttr SoftmaxOp::getDimensionAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().dimension); +} + +uint64_t SoftmaxOp::getDimension() { + auto attr = getDimensionAttr(); + return attr.getValue().getZExtValue(); +} + +void SoftmaxOp::setDimensionAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getDimensionAttrName(), attr); +} + +void SoftmaxOp::setDimension(uint64_t attrValue) { + (*this)->setAttr(getDimensionAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue)); +} + +void SoftmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result, ::mlir::Value input, ::mlir::Value output, ::mlir::IntegerAttr dimension) { + odsState.addOperands(input); + odsState.addOperands(output); + odsState.getOrAddProperties().dimension = dimension; + odsState.addTypes(result); +} + +void SoftmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result, ::mlir::Value input, ::mlir::Value output, uint64_t dimension) { + odsState.addOperands(input); + odsState.addOperands(output); + odsState.getOrAddProperties().dimension = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), dimension); + odsState.addTypes(result); +} + +void SoftmaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SoftmaxOp::verifyInvariantsImpl() { + auto tblgen_dimension = getProperties().dimension; (void)tblgen_dimension; + if (!tblgen_dimension) return emitOpError("requires attribute 'dimension'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgOps1(*this, tblgen_dimension, "dimension"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getOperation()).getNumOperands() > 1)) && ((::llvm::isa<::mlir::ShapedType>((*this->getOperation()).getOperand(0).getType()))) && ((::llvm::isa<::mlir::ShapedType>((*this->getOperation()).getOperand(1).getType()))) && ((::mlir::getElementTypeOrSelf((*this->getOperation()).getOperand(0)) == ::mlir::getElementTypeOrSelf((*this->getOperation()).getOperand(1)))))) + return emitOpError("failed to verify that input and output have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult SoftmaxOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SoftmaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr dimensionAttr; + ::mlir::OpAsmParser::UnresolvedOperand inputRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(inputRawOperands); ::llvm::SMLoc inputOperandsLoc; + (void)inputOperandsLoc; + ::mlir::Type inputRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> inputTypes(inputRawTypes); + ::mlir::OpAsmParser::UnresolvedOperand outputRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> outputOperands(outputRawOperands); ::llvm::SMLoc outputOperandsLoc; + (void)outputOperandsLoc; + ::mlir::Type outputRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> outputTypes(outputRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> resultTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseKeyword("dimension")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(dimensionAttr, parser.getBuilder().getIntegerType(64))) { + return ::mlir::failure(); + } + if (dimensionAttr) result.getOrAddProperties().dimension = dimensionAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseKeyword("ins")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + inputOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ShapedType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + inputRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseKeyword("outs")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + outputOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(outputRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::ShapedType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + outputRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalArrow())) { + + if (parser.parseTypeList(resultTypes)) + return ::mlir::failure(); + } + result.addTypes(resultTypes); + if (parser.resolveOperands(inputOperands, inputTypes, inputOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(outputOperands, outputTypes, outputOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SoftmaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("dimension"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "dimension"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getDimensionAttr()); + _odsPrinter << ")"; + _odsPrinter << ' ' << "ins"; + _odsPrinter << "("; + _odsPrinter << getInput(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getInput().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ShapedType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << "outs"; + _odsPrinter << "("; + _odsPrinter << getOutput(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOutput().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::ShapedType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + if (!getResult().empty()) { + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getResult().getTypes(); + } +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::SoftmaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::YieldOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.yield", odsAttrs.getContext()); +} + +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(YieldOp op) : YieldOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair YieldOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr YieldOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +YieldOpAdaptor::YieldOpAdaptor(YieldOp op) : YieldOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult YieldOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair YieldOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range YieldOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range YieldOp::getValues() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange YieldOp::getValuesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair YieldOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range YieldOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + /* nothing to do */ +} + +void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange values) { + odsState.addOperands(values); +} + +void YieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult YieldOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult YieldOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void YieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange YieldOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..f069f1f6007b931985f6010ef40313d03bdf8210 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h.inc @@ -0,0 +1,490 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LinalgOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace linalg { +class IndexOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class SoftmaxOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class YieldOp; +} // namespace linalg +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::IndexOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IndexOpGenericAdaptorBase { +public: + struct Properties { + using dimTy = ::mlir::IntegerAttr; + dimTy dim; + + auto getDim() { + auto &propStorage = this->dim; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setDim(const ::mlir::IntegerAttr &propValue) { + this->dim = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dim == this->dim && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + IndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + IndexOpGenericAdaptorBase(IndexOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); +}; +} // namespace detail +template +class IndexOpGenericAdaptor : public detail::IndexOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IndexOpGenericAdaptorBase; +public: + IndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IndexOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + IndexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IndexOpAdaptor : public IndexOpGenericAdaptor<::mlir::ValueRange> { +public: + using IndexOpGenericAdaptor::IndexOpGenericAdaptor; + IndexOpAdaptor(IndexOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IndexOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IndexOpAdaptor; + template + using GenericAdaptor = IndexOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.index"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + void setDimAttr(::mlir::IntegerAttr attr); + void setDim(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::IntegerAttr dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, uint64_t dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t dim); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::IndexOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::SoftmaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftmaxOpGenericAdaptorBase { +public: + struct Properties { + using dimensionTy = ::mlir::IntegerAttr; + dimensionTy dimension; + + auto getDimension() { + auto &propStorage = this->dimension; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setDimension(const ::mlir::IntegerAttr &propValue) { + this->dimension = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dimension == this->dimension && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SoftmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftmaxOpGenericAdaptorBase(SoftmaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); +}; +} // namespace detail +template +class SoftmaxOpGenericAdaptor : public detail::SoftmaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftmaxOpGenericAdaptorBase; +public: + SoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftmaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SoftmaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftmaxOpAdaptor : public SoftmaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftmaxOpGenericAdaptor::SoftmaxOpGenericAdaptor; + SoftmaxOpAdaptor(SoftmaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftmaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::AggregatedOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::TilingInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftmaxOpAdaptor; + template + using GenericAdaptor = SoftmaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.softmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ShapedType> getInput(); + ::mlir::TypedValue<::mlir::ShapedType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); + void setDimensionAttr(::mlir::IntegerAttr attr); + void setDimension(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result, ::mlir::Value input, ::mlir::Value output, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result, ::mlir::Value input, ::mlir::Value output, uint64_t dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + ::mlir::LogicalResult reifyResultShapes(::mlir::OpBuilder &builder, ::mlir::ReifiedRankedShapedTypeDims &reifiedReturnShapes); + FailureOr> decomposeOperation(OpBuilder &b); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + SmallVector getLoopIteratorTypes(); + SmallVector getIterationDomain(OpBuilder &b); + FailureOr getTiledImplementation(OpBuilder &b, ArrayRef offsets, ArrayRef sizes); + LogicalResult getResultTilePosition(OpBuilder &b, unsigned resultNumber, ArrayRef offsets, ArrayRef sizes, SmallVector &resultOffsets, SmallVector &resultSizes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + ShapedType getInputOperandType() { + return getInput().getType().cast(); + } + ShapedType getOutputOperandType() { + return getOutput().getType().cast(); + } + int64_t getInputOperandRank() { + return getInputOperandType().getRank(); + } + int64_t getOutputOperandRank() { + return getOutputOperandType().getRank(); + } + MutableOperandRange getDpsInitsMutable() { return getOutputMutable(); } +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::SoftmaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getValues() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getValues(); + ::mlir::MutableOperandRange getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..e1cbba235e40683f1acfacb69187a9d2bbb66478 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.cpp.inc @@ -0,0 +1,400 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::linalg::BinaryFnAttr, +::mlir::linalg::IteratorTypeAttr, +::mlir::linalg::TypeFnAttr, +::mlir::linalg::UnaryFnAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::linalg::BinaryFnAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::linalg::BinaryFnAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::linalg::IteratorTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::linalg::IteratorTypeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::linalg::TypeFnAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::linalg::TypeFnAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::linalg::UnaryFnAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::linalg::UnaryFnAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::linalg::BinaryFnAttr>([&](auto t) { + printer << ::mlir::linalg::BinaryFnAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::linalg::IteratorTypeAttr>([&](auto t) { + printer << ::mlir::linalg::IteratorTypeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::linalg::TypeFnAttr>([&](auto t) { + printer << ::mlir::linalg::TypeFnAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::linalg::UnaryFnAttr>([&](auto t) { + printer << ::mlir::linalg::UnaryFnAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace linalg { +namespace detail { +struct BinaryFnAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::linalg::BinaryFn>; + BinaryFnAttrStorage(::mlir::linalg::BinaryFn value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static BinaryFnAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) BinaryFnAttrStorage(std::move(value)); + } + + ::mlir::linalg::BinaryFn value; +}; +} // namespace detail +BinaryFnAttr BinaryFnAttr::get(::mlir::MLIRContext *context, ::mlir::linalg::BinaryFn value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute BinaryFnAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::linalg::BinaryFn> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::linalg::BinaryFn> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::linalg::symbolizeBinaryFn(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::linalg::BinaryFn" << " to be one of: " << "add" << ", " << "sub" << ", " << "mul" << ", " << "div" << ", " << "div_unsigned" << ", " << "max_signed" << ", " << "min_signed" << ", " << "max_unsigned" << ", " << "min_unsigned")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse BinaryFnAttr parameter 'value' which is to be a `::mlir::linalg::BinaryFn`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return BinaryFnAttr::get(odsParser.getContext(), + ::mlir::linalg::BinaryFn((*_result_value))); +} + +void BinaryFnAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyBinaryFn(getValue()); + odsPrinter << ">"; +} + +::mlir::linalg::BinaryFn BinaryFnAttr::getValue() const { + return getImpl()->value; +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::BinaryFnAttr) +namespace mlir { +namespace linalg { +namespace detail { +struct IteratorTypeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::utils::IteratorType>; + IteratorTypeAttrStorage(::mlir::utils::IteratorType value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static IteratorTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) IteratorTypeAttrStorage(std::move(value)); + } + + ::mlir::utils::IteratorType value; +}; +} // namespace detail +IteratorTypeAttr IteratorTypeAttr::get(::mlir::MLIRContext *context, ::mlir::utils::IteratorType value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute IteratorTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::utils::IteratorType> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::utils::IteratorType> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::utils::symbolizeIteratorType(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::utils::IteratorType" << " to be one of: " << "parallel" << ", " << "reduction")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse IteratorTypeEnum parameter 'value' which is to be a `::mlir::utils::IteratorType`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return IteratorTypeAttr::get(odsParser.getContext(), + ::mlir::utils::IteratorType((*_result_value))); +} + +void IteratorTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyIteratorType(getValue()); + odsPrinter << ">"; +} + +::mlir::utils::IteratorType IteratorTypeAttr::getValue() const { + return getImpl()->value; +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::IteratorTypeAttr) +namespace mlir { +namespace linalg { +namespace detail { +struct TypeFnAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::linalg::TypeFn>; + TypeFnAttrStorage(::mlir::linalg::TypeFn value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static TypeFnAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) TypeFnAttrStorage(std::move(value)); + } + + ::mlir::linalg::TypeFn value; +}; +} // namespace detail +TypeFnAttr TypeFnAttr::get(::mlir::MLIRContext *context, ::mlir::linalg::TypeFn value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute TypeFnAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::linalg::TypeFn> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::linalg::TypeFn> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::linalg::symbolizeTypeFn(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::linalg::TypeFn" << " to be one of: " << "cast_signed" << ", " << "cast_unsigned")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TypeFnAttr parameter 'value' which is to be a `::mlir::linalg::TypeFn`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return TypeFnAttr::get(odsParser.getContext(), + ::mlir::linalg::TypeFn((*_result_value))); +} + +void TypeFnAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyTypeFn(getValue()); + odsPrinter << ">"; +} + +::mlir::linalg::TypeFn TypeFnAttr::getValue() const { + return getImpl()->value; +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::TypeFnAttr) +namespace mlir { +namespace linalg { +namespace detail { +struct UnaryFnAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::linalg::UnaryFn>; + UnaryFnAttrStorage(::mlir::linalg::UnaryFn value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static UnaryFnAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) UnaryFnAttrStorage(std::move(value)); + } + + ::mlir::linalg::UnaryFn value; +}; +} // namespace detail +UnaryFnAttr UnaryFnAttr::get(::mlir::MLIRContext *context, ::mlir::linalg::UnaryFn value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute UnaryFnAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::linalg::UnaryFn> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::linalg::UnaryFn> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::linalg::symbolizeUnaryFn(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::linalg::UnaryFn" << " to be one of: " << "exp" << ", " << "log" << ", " << "abs" << ", " << "ceil" << ", " << "floor" << ", " << "negf")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse UnaryFnAttr parameter 'value' which is to be a `::mlir::linalg::UnaryFn`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return UnaryFnAttr::get(odsParser.getContext(), + ::mlir::linalg::UnaryFn((*_result_value))); +} + +void UnaryFnAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyUnaryFn(getValue()); + odsPrinter << ">"; +} + +::mlir::linalg::UnaryFn UnaryFnAttr::getValue() const { + return getImpl()->value; +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::UnaryFnAttr) +namespace mlir { +namespace linalg { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute LinalgDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void LinalgDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace linalg +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..76cd6351b804aeb0a2aed4b44156b34c255c132c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.h.inc @@ -0,0 +1,91 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace linalg { +class BinaryFnAttr; +class IteratorTypeAttr; +class TypeFnAttr; +class UnaryFnAttr; +namespace detail { +struct BinaryFnAttrStorage; +} // namespace detail +class BinaryFnAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static BinaryFnAttr get(::mlir::MLIRContext *context, ::mlir::linalg::BinaryFn value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"binary_fn"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::linalg::BinaryFn getValue() const; +}; +namespace detail { +struct IteratorTypeAttrStorage; +} // namespace detail +class IteratorTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static IteratorTypeAttr get(::mlir::MLIRContext *context, ::mlir::utils::IteratorType value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"iterator_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::utils::IteratorType getValue() const; +}; +namespace detail { +struct TypeFnAttrStorage; +} // namespace detail +class TypeFnAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TypeFnAttr get(::mlir::MLIRContext *context, ::mlir::linalg::TypeFn value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"type_fn"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::linalg::TypeFn getValue() const; +}; +namespace detail { +struct UnaryFnAttrStorage; +} // namespace detail +class UnaryFnAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static UnaryFnAttr get(::mlir::MLIRContext *context, ::mlir::linalg::UnaryFn value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"unary_fn"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::linalg::UnaryFn getValue() const; +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BinaryFnAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::IteratorTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::TypeFnAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::UnaryFnAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..58d11ce30f5db47e145219e005fcd0b20d267433 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.cpp.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LinalgOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::LinalgDialect) +namespace mlir { +namespace linalg { + +LinalgDialect::LinalgDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + getContext()->loadDialect(); + + initialize(); +} + +LinalgDialect::~LinalgDialect() = default; + +} // namespace linalg +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..93df51a09e3ed6518e675f7e39a6ddaed3a3d855 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.h.inc @@ -0,0 +1,62 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LinalgOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace linalg { + +class LinalgDialect : public ::mlir::Dialect { + explicit LinalgDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~LinalgDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("linalg"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Register canonicalization patterns. + void getCanonicalizationPatterns( + ::mlir::RewritePatternSet &results) const override; + + /// Materialize a single constant operation from a given attribute value with + /// the desired resultant type. + ::mlir::Operation *materializeConstant(::mlir::OpBuilder &builder, + ::mlir::Attribute value, + ::mlir::Type type, + ::mlir::Location loc) override; + + /// Provides a hook for verifying dialect attributes attached to the given + /// op. + ::mlir::LogicalResult verifyOperationAttribute( + ::mlir::Operation *op, ::mlir::NamedAttribute attribute) override; + + /// Attribute name used to memoize indexing maps for named ops. + constexpr const static ::llvm::StringLiteral + kMemoizedIndexingMapsAttrName = "linalg.memoized_indexing_maps"; + + using RegionBuilderFunType = llvm::function_ref< + void(ImplicitLocOpBuilder &b, Block &, ArrayRef)>; + RegionBuilderFunType getRegionBuilder(StringRef name) { + return namedStructuredOpRegionBuilders.lookup(name); + } + private: + llvm::StringMap namedStructuredOpRegionBuilders; + }; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::LinalgDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..a277234cc2069571e44767409c312b73b9848337 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.cpp.inc @@ -0,0 +1,123 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LinalgEnums.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace linalg { +::llvm::StringRef stringifyBinaryFn(BinaryFn val) { + switch (val) { + case BinaryFn::add: return "add"; + case BinaryFn::sub: return "sub"; + case BinaryFn::mul: return "mul"; + case BinaryFn::div: return "div"; + case BinaryFn::div_unsigned: return "div_unsigned"; + case BinaryFn::max_signed: return "max_signed"; + case BinaryFn::min_signed: return "min_signed"; + case BinaryFn::max_unsigned: return "max_unsigned"; + case BinaryFn::min_unsigned: return "min_unsigned"; + } + return ""; +} + +::std::optional symbolizeBinaryFn(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("add", BinaryFn::add) + .Case("sub", BinaryFn::sub) + .Case("mul", BinaryFn::mul) + .Case("div", BinaryFn::div) + .Case("div_unsigned", BinaryFn::div_unsigned) + .Case("max_signed", BinaryFn::max_signed) + .Case("min_signed", BinaryFn::min_signed) + .Case("max_unsigned", BinaryFn::max_unsigned) + .Case("min_unsigned", BinaryFn::min_unsigned) + .Default(::std::nullopt); +} +::std::optional symbolizeBinaryFn(uint32_t value) { + switch (value) { + case 0: return BinaryFn::add; + case 1: return BinaryFn::sub; + case 2: return BinaryFn::mul; + case 3: return BinaryFn::div; + case 4: return BinaryFn::div_unsigned; + case 5: return BinaryFn::max_signed; + case 6: return BinaryFn::min_signed; + case 7: return BinaryFn::max_unsigned; + case 8: return BinaryFn::min_unsigned; + default: return ::std::nullopt; + } +} + +} // namespace linalg +} // namespace mlir + +namespace mlir { +namespace linalg { +::llvm::StringRef stringifyTypeFn(TypeFn val) { + switch (val) { + case TypeFn::cast_signed: return "cast_signed"; + case TypeFn::cast_unsigned: return "cast_unsigned"; + } + return ""; +} + +::std::optional symbolizeTypeFn(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("cast_signed", TypeFn::cast_signed) + .Case("cast_unsigned", TypeFn::cast_unsigned) + .Default(::std::nullopt); +} +::std::optional symbolizeTypeFn(uint32_t value) { + switch (value) { + case 0: return TypeFn::cast_signed; + case 1: return TypeFn::cast_unsigned; + default: return ::std::nullopt; + } +} + +} // namespace linalg +} // namespace mlir + +namespace mlir { +namespace linalg { +::llvm::StringRef stringifyUnaryFn(UnaryFn val) { + switch (val) { + case UnaryFn::exp: return "exp"; + case UnaryFn::log: return "log"; + case UnaryFn::abs: return "abs"; + case UnaryFn::ceil: return "ceil"; + case UnaryFn::floor: return "floor"; + case UnaryFn::negf: return "negf"; + } + return ""; +} + +::std::optional symbolizeUnaryFn(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("exp", UnaryFn::exp) + .Case("log", UnaryFn::log) + .Case("abs", UnaryFn::abs) + .Case("ceil", UnaryFn::ceil) + .Case("floor", UnaryFn::floor) + .Case("negf", UnaryFn::negf) + .Default(::std::nullopt); +} +::std::optional symbolizeUnaryFn(uint32_t value) { + switch (value) { + case 0: return UnaryFn::exp; + case 1: return UnaryFn::log; + case 2: return UnaryFn::abs; + case 3: return UnaryFn::ceil; + case 4: return UnaryFn::floor; + case 5: return UnaryFn::negf; + default: return ::std::nullopt; + } +} + +} // namespace linalg +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..451ed76acea3863919570a417911930f68ecd01e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.h.inc @@ -0,0 +1,263 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LinalgEnums.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace linalg { +// allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8 +enum class BinaryFn : uint32_t { + add = 0, + sub = 1, + mul = 2, + div = 3, + div_unsigned = 4, + max_signed = 5, + min_signed = 6, + max_unsigned = 7, + min_unsigned = 8, +}; + +::std::optional symbolizeBinaryFn(uint32_t); +::llvm::StringRef stringifyBinaryFn(BinaryFn); +::std::optional symbolizeBinaryFn(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForBinaryFn() { + return 8; +} + + +inline ::llvm::StringRef stringifyEnum(BinaryFn enumValue) { + return stringifyBinaryFn(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeBinaryFn(str); +} +} // namespace linalg +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::linalg::BinaryFn, ::mlir::linalg::BinaryFn> { + template + static FailureOr<::mlir::linalg::BinaryFn> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8"); + + // Symbolize the keyword. + if (::std::optional<::mlir::linalg::BinaryFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::BinaryFn>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8 specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::BinaryFn value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::linalg::BinaryFn> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::linalg::BinaryFn getEmptyKey() { + return static_cast<::mlir::linalg::BinaryFn>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::linalg::BinaryFn getTombstoneKey() { + return static_cast<::mlir::linalg::BinaryFn>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::linalg::BinaryFn &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::linalg::BinaryFn &lhs, const ::mlir::linalg::BinaryFn &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace linalg { +// allowed 32-bit signless integer cases: 0, 1 +enum class TypeFn : uint32_t { + cast_signed = 0, + cast_unsigned = 1, +}; + +::std::optional symbolizeTypeFn(uint32_t); +::llvm::StringRef stringifyTypeFn(TypeFn); +::std::optional symbolizeTypeFn(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForTypeFn() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(TypeFn enumValue) { + return stringifyTypeFn(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeTypeFn(str); +} +} // namespace linalg +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::linalg::TypeFn, ::mlir::linalg::TypeFn> { + template + static FailureOr<::mlir::linalg::TypeFn> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 0, 1"); + + // Symbolize the keyword. + if (::std::optional<::mlir::linalg::TypeFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::TypeFn>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid allowed 32-bit signless integer cases: 0, 1 specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::TypeFn value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::linalg::TypeFn> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::linalg::TypeFn getEmptyKey() { + return static_cast<::mlir::linalg::TypeFn>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::linalg::TypeFn getTombstoneKey() { + return static_cast<::mlir::linalg::TypeFn>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::linalg::TypeFn &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::linalg::TypeFn &lhs, const ::mlir::linalg::TypeFn &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace linalg { +// allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5 +enum class UnaryFn : uint32_t { + exp = 0, + log = 1, + abs = 2, + ceil = 3, + floor = 4, + negf = 5, +}; + +::std::optional symbolizeUnaryFn(uint32_t); +::llvm::StringRef stringifyUnaryFn(UnaryFn); +::std::optional symbolizeUnaryFn(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForUnaryFn() { + return 5; +} + + +inline ::llvm::StringRef stringifyEnum(UnaryFn enumValue) { + return stringifyUnaryFn(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeUnaryFn(str); +} +} // namespace linalg +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::linalg::UnaryFn, ::mlir::linalg::UnaryFn> { + template + static FailureOr<::mlir::linalg::UnaryFn> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5"); + + // Symbolize the keyword. + if (::std::optional<::mlir::linalg::UnaryFn> attr = ::mlir::linalg::symbolizeEnum<::mlir::linalg::UnaryFn>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5 specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::linalg::UnaryFn value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::linalg::UnaryFn> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::linalg::UnaryFn getEmptyKey() { + return static_cast<::mlir::linalg::UnaryFn>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::linalg::UnaryFn getTombstoneKey() { + return static_cast<::mlir::linalg::UnaryFn>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::linalg::UnaryFn &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::linalg::UnaryFn &lhs, const ::mlir::linalg::UnaryFn &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..bae00b51e2a5515572d19b55b669f118a19d1597 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc @@ -0,0 +1,31276 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LinalgStructuredOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::linalg::AbsOp, +::mlir::linalg::AddOp, +::mlir::linalg::BatchMatmulOp, +::mlir::linalg::BatchMatmulTransposeAOp, +::mlir::linalg::BatchMatmulTransposeBOp, +::mlir::linalg::BatchMatvecOp, +::mlir::linalg::BatchMmt4DOp, +::mlir::linalg::BatchReduceMatmulOp, +::mlir::linalg::BroadcastOp, +::mlir::linalg::CeilOp, +::mlir::linalg::Conv1DNcwFcwOp, +::mlir::linalg::Conv1DNwcWcfOp, +::mlir::linalg::Conv1DOp, +::mlir::linalg::Conv2DNchwFchwOp, +::mlir::linalg::Conv2DNgchwFgchwOp, +::mlir::linalg::Conv2DNhwcFhwcOp, +::mlir::linalg::Conv2DNhwcFhwcQOp, +::mlir::linalg::Conv2DNhwcHwcfOp, +::mlir::linalg::Conv2DNhwcHwcfQOp, +::mlir::linalg::Conv2DOp, +::mlir::linalg::Conv3DNcdhwFcdhwOp, +::mlir::linalg::Conv3DNdhwcDhwcfOp, +::mlir::linalg::Conv3DNdhwcDhwcfQOp, +::mlir::linalg::Conv3DOp, +::mlir::linalg::CopyOp, +::mlir::linalg::DepthwiseConv1DNcwCwOp, +::mlir::linalg::DepthwiseConv1DNwcWcOp, +::mlir::linalg::DepthwiseConv1DNwcWcmOp, +::mlir::linalg::DepthwiseConv2DNchwChwOp, +::mlir::linalg::DepthwiseConv2DNhwcHwcOp, +::mlir::linalg::DepthwiseConv2DNhwcHwcQOp, +::mlir::linalg::DepthwiseConv2DNhwcHwcmOp, +::mlir::linalg::DepthwiseConv2DNhwcHwcmQOp, +::mlir::linalg::DepthwiseConv3DNcdhwCdhwOp, +::mlir::linalg::DepthwiseConv3DNdhwcDhwcOp, +::mlir::linalg::DepthwiseConv3DNdhwcDhwcmOp, +::mlir::linalg::DivOp, +::mlir::linalg::DivUnsignedOp, +::mlir::linalg::DotOp, +::mlir::linalg::ElemwiseBinaryOp, +::mlir::linalg::ElemwiseUnaryOp, +::mlir::linalg::ExpOp, +::mlir::linalg::FillOp, +::mlir::linalg::FillRng2DOp, +::mlir::linalg::FloorOp, +::mlir::linalg::GenericOp, +::mlir::linalg::LogOp, +::mlir::linalg::MapOp, +::mlir::linalg::MatmulOp, +::mlir::linalg::MatmulTransposeAOp, +::mlir::linalg::MatmulTransposeBOp, +::mlir::linalg::MatmulUnsignedOp, +::mlir::linalg::MatvecOp, +::mlir::linalg::MaxOp, +::mlir::linalg::Mmt4DOp, +::mlir::linalg::MulOp, +::mlir::linalg::NegfOp, +::mlir::linalg::PoolingNchwMaxOp, +::mlir::linalg::PoolingNchwSumOp, +::mlir::linalg::PoolingNcwMaxOp, +::mlir::linalg::PoolingNcwSumOp, +::mlir::linalg::PoolingNdhwcMaxOp, +::mlir::linalg::PoolingNdhwcMinOp, +::mlir::linalg::PoolingNdhwcSumOp, +::mlir::linalg::PoolingNhwcMaxOp, +::mlir::linalg::PoolingNhwcMaxUnsignedOp, +::mlir::linalg::PoolingNhwcMinOp, +::mlir::linalg::PoolingNhwcMinUnsignedOp, +::mlir::linalg::PoolingNhwcSumOp, +::mlir::linalg::PoolingNwcMaxOp, +::mlir::linalg::PoolingNwcMaxUnsignedOp, +::mlir::linalg::PoolingNwcMinOp, +::mlir::linalg::PoolingNwcMinUnsignedOp, +::mlir::linalg::PoolingNwcSumOp, +::mlir::linalg::QuantizedBatchMatmulOp, +::mlir::linalg::QuantizedMatmulOp, +::mlir::linalg::ReduceOp, +::mlir::linalg::SubOp, +::mlir::linalg::TransposeOp, +::mlir::linalg::VecmatOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace linalg { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LinalgStructuredOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LinalgStructuredOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::ShapedType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be shaped of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LinalgStructuredOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::RankedTensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be ranked tensor of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LinalgStructuredOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::RankedTensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of any type values or ranked tensor of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_LinalgStructuredOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be tensor of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: i64 dense array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::linalg::TypeFnAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::linalg::BinaryFnAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::linalg::UnaryFnAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::AffineMapAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: AffineMap array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps8( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::linalg::IteratorTypeAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Iterator type should be an enum."; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps8( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps8(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps9( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps9( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps9(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps10( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr))) && (((llvm::is_sorted(::llvm::cast(attr).asArrayRef()))) && (([](::llvm::ArrayRef a) { +return std::adjacent_find(std::begin(a), std::end(a)) == std::end(a); +}(::llvm::cast(attr).asArrayRef())))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: i64 dense array attribute should be in increasing order"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_LinalgStructuredOps10( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_LinalgStructuredOps10(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_LinalgStructuredOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_LinalgStructuredOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItems(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with 1 blocks"; + } + return ::mlir::success(); +} +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::AbsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AbsOpGenericAdaptorBase::AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.abs", odsAttrs.getContext()); +} + +AbsOpGenericAdaptorBase::AbsOpGenericAdaptorBase(AbsOp op) : AbsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AbsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr AbsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &AbsOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange AbsOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AbsOpAdaptor::AbsOpAdaptor(AbsOp op) : AbsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AbsOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AbsOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range AbsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AbsOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range AbsOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange AbsOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AbsOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair AbsOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range AbsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range AbsOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &AbsOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult AbsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute AbsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AbsOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional AbsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void AbsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void AbsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult AbsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult AbsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void AbsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, AbsOp::getRegionBuilder()); + +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, AbsOp::getRegionBuilder()); + +} + +void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult AbsOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AbsOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::AbsOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::AddOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.add", odsAttrs.getContext()); +} + +AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(AddOp op) : AddOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr AddOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &AddOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange AddOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AddOpAdaptor::AddOpAdaptor(AddOp op) : AddOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AddOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AddOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range AddOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AddOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range AddOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange AddOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AddOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair AddOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range AddOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range AddOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &AddOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult AddOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute AddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AddOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional AddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void AddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void AddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult AddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult AddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void AddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, AddOp::getRegionBuilder()); + +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, AddOp::getRegionBuilder()); + +} + +void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult AddOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AddOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::AddOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMatmulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BatchMatmulOpGenericAdaptorBase::BatchMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.batch_matmul", odsAttrs.getContext()); +} + +BatchMatmulOpGenericAdaptorBase::BatchMatmulOpGenericAdaptorBase(BatchMatmulOp op) : BatchMatmulOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BatchMatmulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr BatchMatmulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &BatchMatmulOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange BatchMatmulOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +BatchMatmulOpAdaptor::BatchMatmulOpAdaptor(BatchMatmulOp op) : BatchMatmulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BatchMatmulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BatchMatmulOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range BatchMatmulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range BatchMatmulOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range BatchMatmulOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange BatchMatmulOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange BatchMatmulOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair BatchMatmulOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range BatchMatmulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range BatchMatmulOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &BatchMatmulOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult BatchMatmulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute BatchMatmulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BatchMatmulOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional BatchMatmulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void BatchMatmulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void BatchMatmulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult BatchMatmulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMatmulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void BatchMatmulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void BatchMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, BatchMatmulOp::getRegionBuilder()); + +} + +void BatchMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, BatchMatmulOp::getRegionBuilder()); + +} + +void BatchMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult BatchMatmulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMatmulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMatmulTransposeAOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BatchMatmulTransposeAOpGenericAdaptorBase::BatchMatmulTransposeAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.batch_matmul_transpose_a", odsAttrs.getContext()); +} + +BatchMatmulTransposeAOpGenericAdaptorBase::BatchMatmulTransposeAOpGenericAdaptorBase(BatchMatmulTransposeAOp op) : BatchMatmulTransposeAOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BatchMatmulTransposeAOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr BatchMatmulTransposeAOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &BatchMatmulTransposeAOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange BatchMatmulTransposeAOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +BatchMatmulTransposeAOpAdaptor::BatchMatmulTransposeAOpAdaptor(BatchMatmulTransposeAOp op) : BatchMatmulTransposeAOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BatchMatmulTransposeAOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BatchMatmulTransposeAOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range BatchMatmulTransposeAOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range BatchMatmulTransposeAOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range BatchMatmulTransposeAOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange BatchMatmulTransposeAOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange BatchMatmulTransposeAOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair BatchMatmulTransposeAOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range BatchMatmulTransposeAOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range BatchMatmulTransposeAOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &BatchMatmulTransposeAOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult BatchMatmulTransposeAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute BatchMatmulTransposeAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BatchMatmulTransposeAOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional BatchMatmulTransposeAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void BatchMatmulTransposeAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void BatchMatmulTransposeAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult BatchMatmulTransposeAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMatmulTransposeAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void BatchMatmulTransposeAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void BatchMatmulTransposeAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, BatchMatmulTransposeAOp::getRegionBuilder()); + +} + +void BatchMatmulTransposeAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, BatchMatmulTransposeAOp::getRegionBuilder()); + +} + +void BatchMatmulTransposeAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult BatchMatmulTransposeAOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMatmulTransposeAOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatmulTransposeAOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMatmulTransposeBOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BatchMatmulTransposeBOpGenericAdaptorBase::BatchMatmulTransposeBOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.batch_matmul_transpose_b", odsAttrs.getContext()); +} + +BatchMatmulTransposeBOpGenericAdaptorBase::BatchMatmulTransposeBOpGenericAdaptorBase(BatchMatmulTransposeBOp op) : BatchMatmulTransposeBOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BatchMatmulTransposeBOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr BatchMatmulTransposeBOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &BatchMatmulTransposeBOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange BatchMatmulTransposeBOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +BatchMatmulTransposeBOpAdaptor::BatchMatmulTransposeBOpAdaptor(BatchMatmulTransposeBOp op) : BatchMatmulTransposeBOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BatchMatmulTransposeBOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BatchMatmulTransposeBOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range BatchMatmulTransposeBOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range BatchMatmulTransposeBOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range BatchMatmulTransposeBOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange BatchMatmulTransposeBOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange BatchMatmulTransposeBOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair BatchMatmulTransposeBOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range BatchMatmulTransposeBOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range BatchMatmulTransposeBOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &BatchMatmulTransposeBOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult BatchMatmulTransposeBOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute BatchMatmulTransposeBOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BatchMatmulTransposeBOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional BatchMatmulTransposeBOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void BatchMatmulTransposeBOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void BatchMatmulTransposeBOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult BatchMatmulTransposeBOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMatmulTransposeBOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void BatchMatmulTransposeBOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void BatchMatmulTransposeBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, BatchMatmulTransposeBOp::getRegionBuilder()); + +} + +void BatchMatmulTransposeBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, BatchMatmulTransposeBOp::getRegionBuilder()); + +} + +void BatchMatmulTransposeBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult BatchMatmulTransposeBOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMatmulTransposeBOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatmulTransposeBOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMatvecOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BatchMatvecOpGenericAdaptorBase::BatchMatvecOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.batch_matvec", odsAttrs.getContext()); +} + +BatchMatvecOpGenericAdaptorBase::BatchMatvecOpGenericAdaptorBase(BatchMatvecOp op) : BatchMatvecOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BatchMatvecOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr BatchMatvecOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &BatchMatvecOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange BatchMatvecOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +BatchMatvecOpAdaptor::BatchMatvecOpAdaptor(BatchMatvecOp op) : BatchMatvecOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BatchMatvecOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BatchMatvecOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range BatchMatvecOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range BatchMatvecOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range BatchMatvecOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange BatchMatvecOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange BatchMatvecOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair BatchMatvecOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range BatchMatvecOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range BatchMatvecOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &BatchMatvecOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult BatchMatvecOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute BatchMatvecOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BatchMatvecOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional BatchMatvecOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void BatchMatvecOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void BatchMatvecOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult BatchMatvecOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMatvecOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void BatchMatvecOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void BatchMatvecOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, BatchMatvecOp::getRegionBuilder()); + +} + +void BatchMatvecOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, BatchMatvecOp::getRegionBuilder()); + +} + +void BatchMatvecOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult BatchMatvecOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMatvecOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatvecOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMmt4DOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BatchMmt4DOpGenericAdaptorBase::BatchMmt4DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.batch_mmt4d", odsAttrs.getContext()); +} + +BatchMmt4DOpGenericAdaptorBase::BatchMmt4DOpGenericAdaptorBase(BatchMmt4DOp op) : BatchMmt4DOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BatchMmt4DOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr BatchMmt4DOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &BatchMmt4DOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange BatchMmt4DOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +BatchMmt4DOpAdaptor::BatchMmt4DOpAdaptor(BatchMmt4DOp op) : BatchMmt4DOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BatchMmt4DOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BatchMmt4DOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range BatchMmt4DOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range BatchMmt4DOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range BatchMmt4DOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange BatchMmt4DOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange BatchMmt4DOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair BatchMmt4DOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range BatchMmt4DOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range BatchMmt4DOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &BatchMmt4DOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult BatchMmt4DOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute BatchMmt4DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BatchMmt4DOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional BatchMmt4DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void BatchMmt4DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void BatchMmt4DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult BatchMmt4DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMmt4DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void BatchMmt4DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void BatchMmt4DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, BatchMmt4DOp::getRegionBuilder()); + +} + +void BatchMmt4DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, BatchMmt4DOp::getRegionBuilder()); + +} + +void BatchMmt4DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult BatchMmt4DOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BatchMmt4DOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMmt4DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchReduceMatmulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BatchReduceMatmulOpGenericAdaptorBase::BatchReduceMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.batch_reduce_matmul", odsAttrs.getContext()); +} + +BatchReduceMatmulOpGenericAdaptorBase::BatchReduceMatmulOpGenericAdaptorBase(BatchReduceMatmulOp op) : BatchReduceMatmulOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BatchReduceMatmulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr BatchReduceMatmulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &BatchReduceMatmulOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange BatchReduceMatmulOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +BatchReduceMatmulOpAdaptor::BatchReduceMatmulOpAdaptor(BatchReduceMatmulOp op) : BatchReduceMatmulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BatchReduceMatmulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BatchReduceMatmulOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range BatchReduceMatmulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range BatchReduceMatmulOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range BatchReduceMatmulOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange BatchReduceMatmulOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange BatchReduceMatmulOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair BatchReduceMatmulOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range BatchReduceMatmulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range BatchReduceMatmulOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &BatchReduceMatmulOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult BatchReduceMatmulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute BatchReduceMatmulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BatchReduceMatmulOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional BatchReduceMatmulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void BatchReduceMatmulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void BatchReduceMatmulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult BatchReduceMatmulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult BatchReduceMatmulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void BatchReduceMatmulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void BatchReduceMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, BatchReduceMatmulOp::getRegionBuilder()); + +} + +void BatchReduceMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, BatchReduceMatmulOp::getRegionBuilder()); + +} + +void BatchReduceMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult BatchReduceMatmulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BatchReduceMatmulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchReduceMatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BroadcastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BroadcastOpGenericAdaptorBase::BroadcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.broadcast", odsAttrs.getContext()); +} + +BroadcastOpGenericAdaptorBase::BroadcastOpGenericAdaptorBase(BroadcastOp op) : BroadcastOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BroadcastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BroadcastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI64ArrayAttr BroadcastOpGenericAdaptorBase::getDimensionsAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().dimensions); + return attr; +} + +::llvm::ArrayRef BroadcastOpGenericAdaptorBase::getDimensions() { + auto attr = getDimensionsAttr(); + return attr; +} + +::mlir::Region &BroadcastOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange BroadcastOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +BroadcastOpAdaptor::BroadcastOpAdaptor(BroadcastOp op) : BroadcastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BroadcastOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dimensions = getProperties().dimensions; (void)tblgen_dimensions; + if (!tblgen_dimensions) return emitError(loc, "'linalg.broadcast' op ""requires attribute 'dimensions'"); + + if (tblgen_dimensions && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_dimensions)))) + return emitError(loc, "'linalg.broadcast' op ""attribute 'dimensions' failed to satisfy constraint: i64 dense array attribute"); + return ::mlir::success(); +} + +std::pair BroadcastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BroadcastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ShapedType> BroadcastOp::getInput() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ShapedType> BroadcastOp::getInit() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &BroadcastOp::getInputMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &BroadcastOp::getInitMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair BroadcastOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range BroadcastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range BroadcastOp::getResult() { + return getODSResults(0); +} + +::mlir::Region &BroadcastOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult BroadcastOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dimensions; + auto attr = dict.get("dimensions"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dimensions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dimensions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute BroadcastOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dimensions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dimensions", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code BroadcastOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dimensions.getAsOpaquePointer())); +} + +std::optional BroadcastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dimensions") + return prop.dimensions; + return std::nullopt; +} + +void BroadcastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dimensions") { + prop.dimensions = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void BroadcastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dimensions) attrs.append("dimensions", prop.dimensions); +} + +::mlir::LogicalResult BroadcastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDimensionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps0(attr, "dimensions", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BroadcastOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dimensions))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void BroadcastOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dimensions); +} + +::mlir::DenseI64ArrayAttr BroadcastOp::getDimensionsAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().dimensions); +} + +::llvm::ArrayRef BroadcastOp::getDimensions() { + auto attr = getDimensionsAttr(); + return attr; +} + +void BroadcastOp::setDimensionsAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getDimensionsAttrName(), attr); +} + +void BroadcastOp::setDimensions(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getDimensionsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +::mlir::LogicalResult BroadcastOp::verifyInvariantsImpl() { + auto tblgen_dimensions = getProperties().dimensions; (void)tblgen_dimensions; + if (!tblgen_dimensions) return emitOpError("requires attribute 'dimensions'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps0(*this, tblgen_dimensions, "dimensions"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult BroadcastOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::BroadcastOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::CeilOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CeilOpGenericAdaptorBase::CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.ceil", odsAttrs.getContext()); +} + +CeilOpGenericAdaptorBase::CeilOpGenericAdaptorBase(CeilOp op) : CeilOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CeilOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CeilOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &CeilOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange CeilOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +CeilOpAdaptor::CeilOpAdaptor(CeilOp op) : CeilOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CeilOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CeilOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CeilOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CeilOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range CeilOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange CeilOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CeilOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CeilOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CeilOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range CeilOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &CeilOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult CeilOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CeilOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CeilOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CeilOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CeilOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CeilOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CeilOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult CeilOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CeilOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, CeilOp::getRegionBuilder()); + +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, CeilOp::getRegionBuilder()); + +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult CeilOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CeilOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::CeilOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv1DNcwFcwOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv1DNcwFcwOpGenericAdaptorBase::Conv1DNcwFcwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_1d_ncw_fcw", odsAttrs.getContext()); +} + +Conv1DNcwFcwOpGenericAdaptorBase::Conv1DNcwFcwOpGenericAdaptorBase(Conv1DNcwFcwOp op) : Conv1DNcwFcwOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv1DNcwFcwOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv1DNcwFcwOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv1DNcwFcwOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv1DNcwFcwOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv1DNcwFcwOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv1DNcwFcwOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &Conv1DNcwFcwOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv1DNcwFcwOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv1DNcwFcwOpAdaptor::Conv1DNcwFcwOpAdaptor(Conv1DNcwFcwOp op) : Conv1DNcwFcwOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv1DNcwFcwOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.conv_1d_ncw_fcw' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.conv_1d_ncw_fcw' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair Conv1DNcwFcwOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv1DNcwFcwOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv1DNcwFcwOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv1DNcwFcwOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv1DNcwFcwOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv1DNcwFcwOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv1DNcwFcwOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv1DNcwFcwOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv1DNcwFcwOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv1DNcwFcwOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv1DNcwFcwOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv1DNcwFcwOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv1DNcwFcwOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv1DNcwFcwOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv1DNcwFcwOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv1DNcwFcwOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv1DNcwFcwOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv1DNcwFcwOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv1DNcwFcwOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv1DNcwFcwOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv1DNcwFcwOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv1DNcwFcwOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv1DNcwFcwOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void Conv1DNcwFcwOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv1DNcwFcwOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv1DNcwFcwOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv1DNcwFcwOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv1DNcwFcwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv1DNcwFcwOp::getRegionBuilder()); + +} + +void Conv1DNcwFcwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv1DNcwFcwOp::getRegionBuilder()); + +} + +void Conv1DNcwFcwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv1DNcwFcwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv1DNcwFcwOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv1DNcwFcwOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv1DNcwFcwOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv1DNcwFcwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv1DNwcWcfOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv1DNwcWcfOpGenericAdaptorBase::Conv1DNwcWcfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_1d_nwc_wcf", odsAttrs.getContext()); +} + +Conv1DNwcWcfOpGenericAdaptorBase::Conv1DNwcWcfOpGenericAdaptorBase(Conv1DNwcWcfOp op) : Conv1DNwcWcfOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv1DNwcWcfOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv1DNwcWcfOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv1DNwcWcfOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv1DNwcWcfOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv1DNwcWcfOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv1DNwcWcfOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &Conv1DNwcWcfOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv1DNwcWcfOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv1DNwcWcfOpAdaptor::Conv1DNwcWcfOpAdaptor(Conv1DNwcWcfOp op) : Conv1DNwcWcfOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv1DNwcWcfOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.conv_1d_nwc_wcf' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.conv_1d_nwc_wcf' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair Conv1DNwcWcfOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv1DNwcWcfOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv1DNwcWcfOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv1DNwcWcfOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv1DNwcWcfOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv1DNwcWcfOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv1DNwcWcfOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv1DNwcWcfOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv1DNwcWcfOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv1DNwcWcfOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv1DNwcWcfOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv1DNwcWcfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv1DNwcWcfOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv1DNwcWcfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv1DNwcWcfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv1DNwcWcfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv1DNwcWcfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv1DNwcWcfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv1DNwcWcfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv1DNwcWcfOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv1DNwcWcfOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv1DNwcWcfOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv1DNwcWcfOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void Conv1DNwcWcfOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv1DNwcWcfOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv1DNwcWcfOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv1DNwcWcfOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv1DNwcWcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv1DNwcWcfOp::getRegionBuilder()); + +} + +void Conv1DNwcWcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv1DNwcWcfOp::getRegionBuilder()); + +} + +void Conv1DNwcWcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv1DNwcWcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv1DNwcWcfOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv1DNwcWcfOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv1DNwcWcfOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv1DNwcWcfOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv1DOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv1DOpGenericAdaptorBase::Conv1DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_1d", odsAttrs.getContext()); +} + +Conv1DOpGenericAdaptorBase::Conv1DOpGenericAdaptorBase(Conv1DOp op) : Conv1DOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv1DOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv1DOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &Conv1DOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv1DOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv1DOpAdaptor::Conv1DOpAdaptor(Conv1DOp op) : Conv1DOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv1DOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair Conv1DOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv1DOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv1DOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv1DOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv1DOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv1DOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv1DOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv1DOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv1DOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv1DOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv1DOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv1DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv1DOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv1DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv1DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv1DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv1DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult Conv1DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv1DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void Conv1DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv1DOp::getRegionBuilder()); + +} + +void Conv1DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv1DOp::getRegionBuilder()); + +} + +void Conv1DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult Conv1DOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv1DOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv1DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNchwFchwOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv2DNchwFchwOpGenericAdaptorBase::Conv2DNchwFchwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_2d_nchw_fchw", odsAttrs.getContext()); +} + +Conv2DNchwFchwOpGenericAdaptorBase::Conv2DNchwFchwOpGenericAdaptorBase(Conv2DNchwFchwOp op) : Conv2DNchwFchwOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv2DNchwFchwOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv2DNchwFchwOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv2DNchwFchwOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNchwFchwOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNchwFchwOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNchwFchwOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &Conv2DNchwFchwOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv2DNchwFchwOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv2DNchwFchwOpAdaptor::Conv2DNchwFchwOpAdaptor(Conv2DNchwFchwOp op) : Conv2DNchwFchwOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv2DNchwFchwOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nchw_fchw' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nchw_fchw' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair Conv2DNchwFchwOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv2DNchwFchwOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv2DNchwFchwOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv2DNchwFchwOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv2DNchwFchwOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv2DNchwFchwOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv2DNchwFchwOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv2DNchwFchwOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv2DNchwFchwOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv2DNchwFchwOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv2DNchwFchwOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv2DNchwFchwOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv2DNchwFchwOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv2DNchwFchwOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv2DNchwFchwOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv2DNchwFchwOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv2DNchwFchwOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNchwFchwOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv2DNchwFchwOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv2DNchwFchwOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv2DNchwFchwOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNchwFchwOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv2DNchwFchwOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void Conv2DNchwFchwOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv2DNchwFchwOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv2DNchwFchwOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv2DNchwFchwOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv2DNchwFchwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv2DNchwFchwOp::getRegionBuilder()); + +} + +void Conv2DNchwFchwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv2DNchwFchwOp::getRegionBuilder()); + +} + +void Conv2DNchwFchwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv2DNchwFchwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv2DNchwFchwOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv2DNchwFchwOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNchwFchwOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNchwFchwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNgchwFgchwOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv2DNgchwFgchwOpGenericAdaptorBase::Conv2DNgchwFgchwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_2d_ngchw_fgchw", odsAttrs.getContext()); +} + +Conv2DNgchwFgchwOpGenericAdaptorBase::Conv2DNgchwFgchwOpGenericAdaptorBase(Conv2DNgchwFgchwOp op) : Conv2DNgchwFgchwOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv2DNgchwFgchwOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv2DNgchwFgchwOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv2DNgchwFgchwOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNgchwFgchwOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNgchwFgchwOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNgchwFgchwOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &Conv2DNgchwFgchwOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv2DNgchwFgchwOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv2DNgchwFgchwOpAdaptor::Conv2DNgchwFgchwOpAdaptor(Conv2DNgchwFgchwOp op) : Conv2DNgchwFgchwOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv2DNgchwFgchwOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_ngchw_fgchw' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_ngchw_fgchw' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair Conv2DNgchwFgchwOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv2DNgchwFgchwOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv2DNgchwFgchwOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv2DNgchwFgchwOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv2DNgchwFgchwOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv2DNgchwFgchwOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv2DNgchwFgchwOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv2DNgchwFgchwOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv2DNgchwFgchwOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv2DNgchwFgchwOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv2DNgchwFgchwOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv2DNgchwFgchwOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv2DNgchwFgchwOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv2DNgchwFgchwOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv2DNgchwFgchwOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv2DNgchwFgchwOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv2DNgchwFgchwOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNgchwFgchwOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv2DNgchwFgchwOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv2DNgchwFgchwOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv2DNgchwFgchwOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNgchwFgchwOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv2DNgchwFgchwOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void Conv2DNgchwFgchwOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv2DNgchwFgchwOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv2DNgchwFgchwOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv2DNgchwFgchwOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv2DNgchwFgchwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv2DNgchwFgchwOp::getRegionBuilder()); + +} + +void Conv2DNgchwFgchwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv2DNgchwFgchwOp::getRegionBuilder()); + +} + +void Conv2DNgchwFgchwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv2DNgchwFgchwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv2DNgchwFgchwOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv2DNgchwFgchwOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNgchwFgchwOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNgchwFgchwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNhwcFhwcOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv2DNhwcFhwcOpGenericAdaptorBase::Conv2DNhwcFhwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_2d_nhwc_fhwc", odsAttrs.getContext()); +} + +Conv2DNhwcFhwcOpGenericAdaptorBase::Conv2DNhwcFhwcOpGenericAdaptorBase(Conv2DNhwcFhwcOp op) : Conv2DNhwcFhwcOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv2DNhwcFhwcOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv2DNhwcFhwcOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &Conv2DNhwcFhwcOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv2DNhwcFhwcOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv2DNhwcFhwcOpAdaptor::Conv2DNhwcFhwcOpAdaptor(Conv2DNhwcFhwcOp op) : Conv2DNhwcFhwcOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv2DNhwcFhwcOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nhwc_fhwc' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nhwc_fhwc' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair Conv2DNhwcFhwcOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv2DNhwcFhwcOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv2DNhwcFhwcOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv2DNhwcFhwcOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv2DNhwcFhwcOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv2DNhwcFhwcOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv2DNhwcFhwcOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv2DNhwcFhwcOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv2DNhwcFhwcOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv2DNhwcFhwcOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv2DNhwcFhwcOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv2DNhwcFhwcOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv2DNhwcFhwcOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv2DNhwcFhwcOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv2DNhwcFhwcOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv2DNhwcFhwcOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv2DNhwcFhwcOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNhwcFhwcOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv2DNhwcFhwcOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void Conv2DNhwcFhwcOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv2DNhwcFhwcOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv2DNhwcFhwcOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv2DNhwcFhwcOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv2DNhwcFhwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv2DNhwcFhwcOp::getRegionBuilder()); + +} + +void Conv2DNhwcFhwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv2DNhwcFhwcOp::getRegionBuilder()); + +} + +void Conv2DNhwcFhwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv2DNhwcFhwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv2DNhwcFhwcOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv2DNhwcFhwcOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNhwcFhwcOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcFhwcOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNhwcFhwcQOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv2DNhwcFhwcQOpGenericAdaptorBase::Conv2DNhwcFhwcQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_2d_nhwc_fhwc_q", odsAttrs.getContext()); +} + +Conv2DNhwcFhwcQOpGenericAdaptorBase::Conv2DNhwcFhwcQOpGenericAdaptorBase(Conv2DNhwcFhwcQOp op) : Conv2DNhwcFhwcQOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv2DNhwcFhwcQOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv2DNhwcFhwcQOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcQOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcQOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcQOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcQOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &Conv2DNhwcFhwcQOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv2DNhwcFhwcQOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv2DNhwcFhwcQOpAdaptor::Conv2DNhwcFhwcQOpAdaptor(Conv2DNhwcFhwcQOp op) : Conv2DNhwcFhwcQOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv2DNhwcFhwcQOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nhwc_fhwc_q' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nhwc_fhwc_q' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair Conv2DNhwcFhwcQOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv2DNhwcFhwcQOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv2DNhwcFhwcQOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv2DNhwcFhwcQOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv2DNhwcFhwcQOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv2DNhwcFhwcQOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv2DNhwcFhwcQOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv2DNhwcFhwcQOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv2DNhwcFhwcQOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv2DNhwcFhwcQOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv2DNhwcFhwcQOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv2DNhwcFhwcQOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv2DNhwcFhwcQOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv2DNhwcFhwcQOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv2DNhwcFhwcQOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv2DNhwcFhwcQOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv2DNhwcFhwcQOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNhwcFhwcQOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv2DNhwcFhwcQOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcQOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcQOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcQOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv2DNhwcFhwcQOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void Conv2DNhwcFhwcQOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv2DNhwcFhwcQOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv2DNhwcFhwcQOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv2DNhwcFhwcQOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv2DNhwcFhwcQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv2DNhwcFhwcQOp::getRegionBuilder()); + +} + +void Conv2DNhwcFhwcQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv2DNhwcFhwcQOp::getRegionBuilder()); + +} + +void Conv2DNhwcFhwcQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv2DNhwcFhwcQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv2DNhwcFhwcQOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv2DNhwcFhwcQOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNhwcFhwcQOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcFhwcQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNhwcHwcfOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv2DNhwcHwcfOpGenericAdaptorBase::Conv2DNhwcHwcfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_2d_nhwc_hwcf", odsAttrs.getContext()); +} + +Conv2DNhwcHwcfOpGenericAdaptorBase::Conv2DNhwcHwcfOpGenericAdaptorBase(Conv2DNhwcHwcfOp op) : Conv2DNhwcHwcfOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv2DNhwcHwcfOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv2DNhwcHwcfOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &Conv2DNhwcHwcfOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv2DNhwcHwcfOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv2DNhwcHwcfOpAdaptor::Conv2DNhwcHwcfOpAdaptor(Conv2DNhwcHwcfOp op) : Conv2DNhwcHwcfOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv2DNhwcHwcfOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nhwc_hwcf' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nhwc_hwcf' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair Conv2DNhwcHwcfOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv2DNhwcHwcfOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv2DNhwcHwcfOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv2DNhwcHwcfOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv2DNhwcHwcfOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv2DNhwcHwcfOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv2DNhwcHwcfOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv2DNhwcHwcfOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv2DNhwcHwcfOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv2DNhwcHwcfOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv2DNhwcHwcfOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv2DNhwcHwcfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv2DNhwcHwcfOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv2DNhwcHwcfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv2DNhwcHwcfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv2DNhwcHwcfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv2DNhwcHwcfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNhwcHwcfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv2DNhwcHwcfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void Conv2DNhwcHwcfOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv2DNhwcHwcfOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv2DNhwcHwcfOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv2DNhwcHwcfOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv2DNhwcHwcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv2DNhwcHwcfOp::getRegionBuilder()); + +} + +void Conv2DNhwcHwcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv2DNhwcHwcfOp::getRegionBuilder()); + +} + +void Conv2DNhwcHwcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv2DNhwcHwcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv2DNhwcHwcfOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv2DNhwcHwcfOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNhwcHwcfOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcHwcfOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNhwcHwcfQOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv2DNhwcHwcfQOpGenericAdaptorBase::Conv2DNhwcHwcfQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_2d_nhwc_hwcf_q", odsAttrs.getContext()); +} + +Conv2DNhwcHwcfQOpGenericAdaptorBase::Conv2DNhwcHwcfQOpGenericAdaptorBase(Conv2DNhwcHwcfQOp op) : Conv2DNhwcHwcfQOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv2DNhwcHwcfQOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv2DNhwcHwcfQOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfQOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfQOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfQOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfQOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &Conv2DNhwcHwcfQOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv2DNhwcHwcfQOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv2DNhwcHwcfQOpAdaptor::Conv2DNhwcHwcfQOpAdaptor(Conv2DNhwcHwcfQOp op) : Conv2DNhwcHwcfQOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv2DNhwcHwcfQOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nhwc_hwcf_q' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.conv_2d_nhwc_hwcf_q' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair Conv2DNhwcHwcfQOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv2DNhwcHwcfQOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv2DNhwcHwcfQOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv2DNhwcHwcfQOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv2DNhwcHwcfQOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv2DNhwcHwcfQOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv2DNhwcHwcfQOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv2DNhwcHwcfQOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv2DNhwcHwcfQOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv2DNhwcHwcfQOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv2DNhwcHwcfQOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv2DNhwcHwcfQOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv2DNhwcHwcfQOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv2DNhwcHwcfQOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv2DNhwcHwcfQOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv2DNhwcHwcfQOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv2DNhwcHwcfQOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNhwcHwcfQOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv2DNhwcHwcfQOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfQOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfQOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfQOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv2DNhwcHwcfQOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void Conv2DNhwcHwcfQOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv2DNhwcHwcfQOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv2DNhwcHwcfQOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv2DNhwcHwcfQOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv2DNhwcHwcfQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv2DNhwcHwcfQOp::getRegionBuilder()); + +} + +void Conv2DNhwcHwcfQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv2DNhwcHwcfQOp::getRegionBuilder()); + +} + +void Conv2DNhwcHwcfQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv2DNhwcHwcfQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv2DNhwcHwcfQOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv2DNhwcHwcfQOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DNhwcHwcfQOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcHwcfQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv2DOpGenericAdaptorBase::Conv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_2d", odsAttrs.getContext()); +} + +Conv2DOpGenericAdaptorBase::Conv2DOpGenericAdaptorBase(Conv2DOp op) : Conv2DOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv2DOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv2DOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &Conv2DOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv2DOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv2DOpAdaptor::Conv2DOpAdaptor(Conv2DOp op) : Conv2DOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv2DOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair Conv2DOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv2DOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv2DOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv2DOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv2DOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv2DOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv2DOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv2DOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv2DOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv2DOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv2DOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv2DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv2DOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv2DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv2DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv2DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv2DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv2DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void Conv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv2DOp::getRegionBuilder()); + +} + +void Conv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv2DOp::getRegionBuilder()); + +} + +void Conv2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult Conv2DOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv2DOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv3DNcdhwFcdhwOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv3DNcdhwFcdhwOpGenericAdaptorBase::Conv3DNcdhwFcdhwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_3d_ncdhw_fcdhw", odsAttrs.getContext()); +} + +Conv3DNcdhwFcdhwOpGenericAdaptorBase::Conv3DNcdhwFcdhwOpGenericAdaptorBase(Conv3DNcdhwFcdhwOp op) : Conv3DNcdhwFcdhwOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv3DNcdhwFcdhwOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv3DNcdhwFcdhwOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv3DNcdhwFcdhwOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNcdhwFcdhwOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNcdhwFcdhwOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNcdhwFcdhwOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &Conv3DNcdhwFcdhwOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv3DNcdhwFcdhwOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv3DNcdhwFcdhwOpAdaptor::Conv3DNcdhwFcdhwOpAdaptor(Conv3DNcdhwFcdhwOp op) : Conv3DNcdhwFcdhwOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv3DNcdhwFcdhwOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.conv_3d_ncdhw_fcdhw' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.conv_3d_ncdhw_fcdhw' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + return ::mlir::success(); +} + +std::pair Conv3DNcdhwFcdhwOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv3DNcdhwFcdhwOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv3DNcdhwFcdhwOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv3DNcdhwFcdhwOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv3DNcdhwFcdhwOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv3DNcdhwFcdhwOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv3DNcdhwFcdhwOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv3DNcdhwFcdhwOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv3DNcdhwFcdhwOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv3DNcdhwFcdhwOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv3DNcdhwFcdhwOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv3DNcdhwFcdhwOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv3DNcdhwFcdhwOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv3DNcdhwFcdhwOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv3DNcdhwFcdhwOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv3DNcdhwFcdhwOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv3DNcdhwFcdhwOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv3DNcdhwFcdhwOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv3DNcdhwFcdhwOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv3DNcdhwFcdhwOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv3DNcdhwFcdhwOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNcdhwFcdhwOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv3DNcdhwFcdhwOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +void Conv3DNcdhwFcdhwOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv3DNcdhwFcdhwOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv3DNcdhwFcdhwOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv3DNcdhwFcdhwOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv3DNcdhwFcdhwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv3DNcdhwFcdhwOp::getRegionBuilder()); + +} + +void Conv3DNcdhwFcdhwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv3DNcdhwFcdhwOp::getRegionBuilder()); + +} + +void Conv3DNcdhwFcdhwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv3DNcdhwFcdhwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv3DNcdhwFcdhwOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv3DNcdhwFcdhwOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv3DNcdhwFcdhwOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DNcdhwFcdhwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv3DNdhwcDhwcfOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv3DNdhwcDhwcfOpGenericAdaptorBase::Conv3DNdhwcDhwcfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_3d_ndhwc_dhwcf", odsAttrs.getContext()); +} + +Conv3DNdhwcDhwcfOpGenericAdaptorBase::Conv3DNdhwcDhwcfOpGenericAdaptorBase(Conv3DNdhwcDhwcfOp op) : Conv3DNdhwcDhwcfOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv3DNdhwcDhwcfOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv3DNdhwcDhwcfOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &Conv3DNdhwcDhwcfOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv3DNdhwcDhwcfOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv3DNdhwcDhwcfOpAdaptor::Conv3DNdhwcDhwcfOpAdaptor(Conv3DNdhwcDhwcfOp op) : Conv3DNdhwcDhwcfOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv3DNdhwcDhwcfOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.conv_3d_ndhwc_dhwcf' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.conv_3d_ndhwc_dhwcf' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + return ::mlir::success(); +} + +std::pair Conv3DNdhwcDhwcfOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv3DNdhwcDhwcfOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv3DNdhwcDhwcfOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv3DNdhwcDhwcfOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv3DNdhwcDhwcfOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv3DNdhwcDhwcfOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv3DNdhwcDhwcfOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv3DNdhwcDhwcfOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv3DNdhwcDhwcfOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv3DNdhwcDhwcfOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv3DNdhwcDhwcfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv3DNdhwcDhwcfOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv3DNdhwcDhwcfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv3DNdhwcDhwcfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv3DNdhwcDhwcfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv3DNdhwcDhwcfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +void Conv3DNdhwcDhwcfOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv3DNdhwcDhwcfOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv3DNdhwcDhwcfOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv3DNdhwcDhwcfOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv3DNdhwcDhwcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv3DNdhwcDhwcfOp::getRegionBuilder()); + +} + +void Conv3DNdhwcDhwcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv3DNdhwcDhwcfOp::getRegionBuilder()); + +} + +void Conv3DNdhwcDhwcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv3DNdhwcDhwcfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv3DNdhwcDhwcfOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DNdhwcDhwcfOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv3DNdhwcDhwcfQOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv3DNdhwcDhwcfQOpGenericAdaptorBase::Conv3DNdhwcDhwcfQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_3d_ndhwc_dhwcf_q", odsAttrs.getContext()); +} + +Conv3DNdhwcDhwcfQOpGenericAdaptorBase::Conv3DNdhwcDhwcfQOpGenericAdaptorBase(Conv3DNdhwcDhwcfQOp op) : Conv3DNdhwcDhwcfQOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv3DNdhwcDhwcfQOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv3DNdhwcDhwcfQOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfQOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfQOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfQOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfQOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &Conv3DNdhwcDhwcfQOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv3DNdhwcDhwcfQOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv3DNdhwcDhwcfQOpAdaptor::Conv3DNdhwcDhwcfQOpAdaptor(Conv3DNdhwcDhwcfQOp op) : Conv3DNdhwcDhwcfQOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv3DNdhwcDhwcfQOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.conv_3d_ndhwc_dhwcf_q' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.conv_3d_ndhwc_dhwcf_q' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + return ::mlir::success(); +} + +std::pair Conv3DNdhwcDhwcfQOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv3DNdhwcDhwcfQOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv3DNdhwcDhwcfQOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv3DNdhwcDhwcfQOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv3DNdhwcDhwcfQOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv3DNdhwcDhwcfQOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv3DNdhwcDhwcfQOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv3DNdhwcDhwcfQOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv3DNdhwcDhwcfQOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv3DNdhwcDhwcfQOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfQOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv3DNdhwcDhwcfQOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv3DNdhwcDhwcfQOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv3DNdhwcDhwcfQOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv3DNdhwcDhwcfQOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv3DNdhwcDhwcfQOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfQOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfQOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv3DNdhwcDhwcfQOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfQOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfQOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfQOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr Conv3DNdhwcDhwcfQOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +void Conv3DNdhwcDhwcfQOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void Conv3DNdhwcDhwcfQOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute Conv3DNdhwcDhwcfQOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute Conv3DNdhwcDhwcfQOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void Conv3DNdhwcDhwcfQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv3DNdhwcDhwcfQOp::getRegionBuilder()); + +} + +void Conv3DNdhwcDhwcfQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv3DNdhwcDhwcfQOp::getRegionBuilder()); + +} + +void Conv3DNdhwcDhwcfQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void Conv3DNdhwcDhwcfQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, Conv3DNdhwcDhwcfQOp::getRegionBuilder()); + +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfQOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv3DNdhwcDhwcfQOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DNdhwcDhwcfQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv3DOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Conv3DOpGenericAdaptorBase::Conv3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.conv_3d", odsAttrs.getContext()); +} + +Conv3DOpGenericAdaptorBase::Conv3DOpGenericAdaptorBase(Conv3DOp op) : Conv3DOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Conv3DOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Conv3DOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &Conv3DOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Conv3DOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Conv3DOpAdaptor::Conv3DOpAdaptor(Conv3DOp op) : Conv3DOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Conv3DOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair Conv3DOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Conv3DOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Conv3DOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Conv3DOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Conv3DOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Conv3DOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Conv3DOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Conv3DOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Conv3DOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Conv3DOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Conv3DOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Conv3DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Conv3DOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Conv3DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Conv3DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Conv3DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Conv3DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult Conv3DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Conv3DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void Conv3DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Conv3DOp::getRegionBuilder()); + +} + +void Conv3DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Conv3DOp::getRegionBuilder()); + +} + +void Conv3DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult Conv3DOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Conv3DOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::CopyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CopyOpGenericAdaptorBase::CopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.copy", odsAttrs.getContext()); +} + +CopyOpGenericAdaptorBase::CopyOpGenericAdaptorBase(CopyOp op) : CopyOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CopyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CopyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::linalg::TypeFnAttr CopyOpGenericAdaptorBase::getCastAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); + if (!attr) + attr = ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed); + return attr; +} + +::mlir::linalg::TypeFn CopyOpGenericAdaptorBase::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +::mlir::Region &CopyOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange CopyOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +CopyOpAdaptor::CopyOpAdaptor(CopyOp op) : CopyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CopyOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + + if (tblgen_cast && !((::llvm::isa<::mlir::linalg::TypeFnAttr>(tblgen_cast)))) + return emitError(loc, "'linalg.copy' op ""attribute 'cast' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1"); + return ::mlir::success(); +} + +std::pair CopyOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CopyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CopyOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range CopyOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange CopyOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CopyOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CopyOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range CopyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range CopyOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &CopyOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult CopyOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cast; + auto attr = dict.get("cast"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for cast in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cast` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CopyOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cast; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cast", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CopyOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.cast.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CopyOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cast") + return prop.cast; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CopyOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cast") { + prop.cast = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CopyOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cast) attrs.append("cast", prop.cast); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CopyOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCastAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(attr, "cast", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopyOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.cast))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CopyOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.cast); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::linalg::TypeFnAttr CopyOp::getCastAttr() { + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); +} + +::mlir::linalg::TypeFn CopyOp::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +void CopyOp::setCastAttr(::mlir::linalg::TypeFnAttr attr) { + (*this)->setAttr(getCastAttrName(), attr); +} + +void CopyOp::setCast(::std::optional<::mlir::linalg::TypeFn> attrValue) { + if (attrValue) + return (*this)->setAttr(getCastAttrName(), ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getCastAttrName()); +} + +::mlir::Attribute CopyOp::removeCastAttr() { + auto &attr = getProperties().cast; + attr = {}; + return attr; +} + +void CopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, CopyOp::getRegionBuilder()); + +} + +void CopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, CopyOp::getRegionBuilder()); + +} + +void CopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void CopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes) { + odsState.addAttribute("cast", cast); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, CopyOp::getRegionBuilder()); + +} + +::mlir::LogicalResult CopyOp::verifyInvariantsImpl() { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(*this, tblgen_cast, "cast"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopyOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::CopyOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv1DNcwCwOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv1DNcwCwOpGenericAdaptorBase::DepthwiseConv1DNcwCwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_1d_ncw_cw", odsAttrs.getContext()); +} + +DepthwiseConv1DNcwCwOpGenericAdaptorBase::DepthwiseConv1DNcwCwOpGenericAdaptorBase(DepthwiseConv1DNcwCwOp op) : DepthwiseConv1DNcwCwOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv1DNcwCwOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv1DNcwCwOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNcwCwOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNcwCwOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNcwCwOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNcwCwOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv1DNcwCwOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv1DNcwCwOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv1DNcwCwOpAdaptor::DepthwiseConv1DNcwCwOpAdaptor(DepthwiseConv1DNcwCwOp op) : DepthwiseConv1DNcwCwOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv1DNcwCwOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.depthwise_conv_1d_ncw_cw' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.depthwise_conv_1d_ncw_cw' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv1DNcwCwOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv1DNcwCwOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv1DNcwCwOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv1DNcwCwOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv1DNcwCwOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv1DNcwCwOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv1DNcwCwOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv1DNcwCwOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv1DNcwCwOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv1DNcwCwOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv1DNcwCwOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv1DNcwCwOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv1DNcwCwOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv1DNcwCwOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv1DNcwCwOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv1DNcwCwOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv1DNcwCwOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv1DNcwCwOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv1DNcwCwOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNcwCwOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNcwCwOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNcwCwOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNcwCwOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void DepthwiseConv1DNcwCwOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv1DNcwCwOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv1DNcwCwOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv1DNcwCwOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv1DNcwCwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv1DNcwCwOp::getRegionBuilder()); + +} + +void DepthwiseConv1DNcwCwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv1DNcwCwOp::getRegionBuilder()); + +} + +void DepthwiseConv1DNcwCwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv1DNcwCwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv1DNcwCwOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv1DNcwCwOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv1DNcwCwOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv1DNcwCwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv1DNwcWcOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv1DNwcWcOpGenericAdaptorBase::DepthwiseConv1DNwcWcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_1d_nwc_wc", odsAttrs.getContext()); +} + +DepthwiseConv1DNwcWcOpGenericAdaptorBase::DepthwiseConv1DNwcWcOpGenericAdaptorBase(DepthwiseConv1DNwcWcOp op) : DepthwiseConv1DNwcWcOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv1DNwcWcOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv1DNwcWcOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv1DNwcWcOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv1DNwcWcOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv1DNwcWcOpAdaptor::DepthwiseConv1DNwcWcOpAdaptor(DepthwiseConv1DNwcWcOp op) : DepthwiseConv1DNwcWcOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv1DNwcWcOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.depthwise_conv_1d_nwc_wc' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.depthwise_conv_1d_nwc_wc' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv1DNwcWcOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv1DNwcWcOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv1DNwcWcOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv1DNwcWcOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv1DNwcWcOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv1DNwcWcOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv1DNwcWcOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv1DNwcWcOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv1DNwcWcOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv1DNwcWcOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv1DNwcWcOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv1DNwcWcOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv1DNwcWcOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv1DNwcWcOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv1DNwcWcOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv1DNwcWcOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void DepthwiseConv1DNwcWcOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv1DNwcWcOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv1DNwcWcOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv1DNwcWcOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv1DNwcWcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv1DNwcWcOp::getRegionBuilder()); + +} + +void DepthwiseConv1DNwcWcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv1DNwcWcOp::getRegionBuilder()); + +} + +void DepthwiseConv1DNwcWcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv1DNwcWcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv1DNwcWcOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv1DNwcWcOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv1DNwcWcmOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv1DNwcWcmOpGenericAdaptorBase::DepthwiseConv1DNwcWcmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_1d_nwc_wcm", odsAttrs.getContext()); +} + +DepthwiseConv1DNwcWcmOpGenericAdaptorBase::DepthwiseConv1DNwcWcmOpGenericAdaptorBase(DepthwiseConv1DNwcWcmOp op) : DepthwiseConv1DNwcWcmOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv1DNwcWcmOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv1DNwcWcmOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcmOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcmOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcmOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcmOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv1DNwcWcmOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv1DNwcWcmOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv1DNwcWcmOpAdaptor::DepthwiseConv1DNwcWcmOpAdaptor(DepthwiseConv1DNwcWcmOp op) : DepthwiseConv1DNwcWcmOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv1DNwcWcmOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.depthwise_conv_1d_nwc_wcm' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.depthwise_conv_1d_nwc_wcm' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv1DNwcWcmOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv1DNwcWcmOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv1DNwcWcmOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv1DNwcWcmOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv1DNwcWcmOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv1DNwcWcmOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv1DNwcWcmOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv1DNwcWcmOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv1DNwcWcmOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv1DNwcWcmOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcmOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv1DNwcWcmOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv1DNwcWcmOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv1DNwcWcmOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv1DNwcWcmOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv1DNwcWcmOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcmOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcmOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv1DNwcWcmOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcmOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcmOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcmOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv1DNwcWcmOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void DepthwiseConv1DNwcWcmOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv1DNwcWcmOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv1DNwcWcmOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv1DNwcWcmOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv1DNwcWcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv1DNwcWcmOp::getRegionBuilder()); + +} + +void DepthwiseConv1DNwcWcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv1DNwcWcmOp::getRegionBuilder()); + +} + +void DepthwiseConv1DNwcWcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv1DNwcWcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv1DNwcWcmOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcmOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv1DNwcWcmOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv1DNwcWcmOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNchwChwOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv2DNchwChwOpGenericAdaptorBase::DepthwiseConv2DNchwChwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_2d_nchw_chw", odsAttrs.getContext()); +} + +DepthwiseConv2DNchwChwOpGenericAdaptorBase::DepthwiseConv2DNchwChwOpGenericAdaptorBase(DepthwiseConv2DNchwChwOp op) : DepthwiseConv2DNchwChwOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv2DNchwChwOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv2DNchwChwOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNchwChwOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNchwChwOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNchwChwOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNchwChwOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv2DNchwChwOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv2DNchwChwOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv2DNchwChwOpAdaptor::DepthwiseConv2DNchwChwOpAdaptor(DepthwiseConv2DNchwChwOp op) : DepthwiseConv2DNchwChwOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv2DNchwChwOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nchw_chw' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nchw_chw' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv2DNchwChwOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNchwChwOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNchwChwOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv2DNchwChwOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv2DNchwChwOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv2DNchwChwOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv2DNchwChwOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv2DNchwChwOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv2DNchwChwOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv2DNchwChwOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv2DNchwChwOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv2DNchwChwOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv2DNchwChwOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv2DNchwChwOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv2DNchwChwOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv2DNchwChwOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv2DNchwChwOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNchwChwOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv2DNchwChwOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNchwChwOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNchwChwOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNchwChwOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNchwChwOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void DepthwiseConv2DNchwChwOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv2DNchwChwOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv2DNchwChwOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv2DNchwChwOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv2DNchwChwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNchwChwOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNchwChwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNchwChwOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNchwChwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv2DNchwChwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNchwChwOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv2DNchwChwOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNchwChwOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNchwChwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNhwcHwcOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::DepthwiseConv2DNhwcHwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_2d_nhwc_hwc", odsAttrs.getContext()); +} + +DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::DepthwiseConv2DNhwcHwcOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcOp op) : DepthwiseConv2DNhwcHwcOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv2DNhwcHwcOpAdaptor::DepthwiseConv2DNhwcHwcOpAdaptor(DepthwiseConv2DNhwcHwcOp op) : DepthwiseConv2DNhwcHwcOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nhwc_hwc' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nhwc_hwc' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv2DNhwcHwcOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv2DNhwcHwcOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv2DNhwcHwcOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv2DNhwcHwcOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv2DNhwcHwcOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv2DNhwcHwcOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv2DNhwcHwcOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv2DNhwcHwcOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv2DNhwcHwcOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv2DNhwcHwcOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv2DNhwcHwcOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv2DNhwcHwcOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void DepthwiseConv2DNhwcHwcOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv2DNhwcHwcOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv2DNhwcHwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNhwcHwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNhwcHwcOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNhwcHwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv2DNhwcHwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNhwcHwcQOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_2d_nhwc_hwc_q", odsAttrs.getContext()); +} + +DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcQOp op) : DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv2DNhwcHwcQOpAdaptor::DepthwiseConv2DNhwcHwcQOpAdaptor(DepthwiseConv2DNhwcHwcQOp op) : DepthwiseConv2DNhwcHwcQOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcQOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nhwc_hwc_q' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nhwc_hwc_q' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv2DNhwcHwcQOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcQOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcQOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcQOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv2DNhwcHwcQOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv2DNhwcHwcQOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv2DNhwcHwcQOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv2DNhwcHwcQOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv2DNhwcHwcQOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv2DNhwcHwcQOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcQOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcQOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv2DNhwcHwcQOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv2DNhwcHwcQOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv2DNhwcHwcQOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv2DNhwcHwcQOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcQOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcQOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv2DNhwcHwcQOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcQOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcQOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcQOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcQOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void DepthwiseConv2DNhwcHwcQOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv2DNhwcHwcQOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcQOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcQOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv2DNhwcHwcQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcQOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNhwcHwcQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNhwcHwcQOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNhwcHwcQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv2DNhwcHwcQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcQOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcQOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcQOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNhwcHwcmOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_2d_nhwc_hwcm", odsAttrs.getContext()); +} + +DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcmOp op) : DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv2DNhwcHwcmOpAdaptor::DepthwiseConv2DNhwcHwcmOpAdaptor(DepthwiseConv2DNhwcHwcmOp op) : DepthwiseConv2DNhwcHwcmOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nhwc_hwcm' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nhwc_hwcm' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv2DNhwcHwcmOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcmOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcmOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcmOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv2DNhwcHwcmOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv2DNhwcHwcmOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv2DNhwcHwcmOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv2DNhwcHwcmOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv2DNhwcHwcmOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv2DNhwcHwcmOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcmOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv2DNhwcHwcmOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv2DNhwcHwcmOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv2DNhwcHwcmOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv2DNhwcHwcmOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv2DNhwcHwcmOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void DepthwiseConv2DNhwcHwcmOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv2DNhwcHwcmOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcmOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcmOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv2DNhwcHwcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcmOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNhwcHwcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNhwcHwcmOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNhwcHwcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv2DNhwcHwcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcmOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcmOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNhwcHwcmQOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_2d_nhwc_hwcm_q", odsAttrs.getContext()); +} + +DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcmQOp op) : DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv2DNhwcHwcmQOpAdaptor::DepthwiseConv2DNhwcHwcmQOpAdaptor(DepthwiseConv2DNhwcHwcmQOp op) : DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmQOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nhwc_hwcm_q' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.depthwise_conv_2d_nhwc_hwcm_q' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv2DNhwcHwcmQOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcmQOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcmQOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv2DNhwcHwcmQOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv2DNhwcHwcmQOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv2DNhwcHwcmQOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv2DNhwcHwcmQOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv2DNhwcHwcmQOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv2DNhwcHwcmQOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv2DNhwcHwcmQOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmQOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcmQOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv2DNhwcHwcmQOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv2DNhwcHwcmQOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv2DNhwcHwcmQOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv2DNhwcHwcmQOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmQOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmQOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv2DNhwcHwcmQOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmQOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmQOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmQOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv2DNhwcHwcmQOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void DepthwiseConv2DNhwcHwcmQOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv2DNhwcHwcmQOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcmQOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv2DNhwcHwcmQOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv2DNhwcHwcmQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcmQOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNhwcHwcmQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv2DNhwcHwcmQOp::getRegionBuilder()); + +} + +void DepthwiseConv2DNhwcHwcmQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv2DNhwcHwcmQOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv2DNhwcHwcmQOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmQOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv2DNhwcHwcmQOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcmQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv3DNcdhwCdhwOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_3d_ncdhw_cdhw", odsAttrs.getContext()); +} + +DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase(DepthwiseConv3DNcdhwCdhwOp op) : DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv3DNcdhwCdhwOpAdaptor::DepthwiseConv3DNcdhwCdhwOpAdaptor(DepthwiseConv3DNcdhwCdhwOp op) : DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv3DNcdhwCdhwOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.depthwise_conv_3d_ncdhw_cdhw' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.depthwise_conv_3d_ncdhw_cdhw' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv3DNcdhwCdhwOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv3DNcdhwCdhwOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv3DNcdhwCdhwOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv3DNcdhwCdhwOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv3DNcdhwCdhwOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv3DNcdhwCdhwOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv3DNcdhwCdhwOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv3DNcdhwCdhwOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv3DNcdhwCdhwOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv3DNcdhwCdhwOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv3DNcdhwCdhwOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv3DNcdhwCdhwOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv3DNcdhwCdhwOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv3DNcdhwCdhwOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv3DNcdhwCdhwOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv3DNcdhwCdhwOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv3DNcdhwCdhwOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv3DNcdhwCdhwOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv3DNcdhwCdhwOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNcdhwCdhwOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNcdhwCdhwOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNcdhwCdhwOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNcdhwCdhwOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +void DepthwiseConv3DNcdhwCdhwOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv3DNcdhwCdhwOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv3DNcdhwCdhwOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv3DNcdhwCdhwOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv3DNcdhwCdhwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv3DNcdhwCdhwOp::getRegionBuilder()); + +} + +void DepthwiseConv3DNcdhwCdhwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv3DNcdhwCdhwOp::getRegionBuilder()); + +} + +void DepthwiseConv3DNcdhwCdhwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv3DNcdhwCdhwOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv3DNcdhwCdhwOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv3DNcdhwCdhwOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv3DNcdhwCdhwOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv3DNcdhwCdhwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv3DNdhwcDhwcOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_3d_ndhwc_dhwc", odsAttrs.getContext()); +} + +DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase(DepthwiseConv3DNdhwcDhwcOp op) : DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv3DNdhwcDhwcOpAdaptor::DepthwiseConv3DNdhwcDhwcOpAdaptor(DepthwiseConv3DNdhwcDhwcOp op) : DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.depthwise_conv_3d_ndhwc_dhwc' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.depthwise_conv_3d_ndhwc_dhwc' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv3DNdhwcDhwcOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv3DNdhwcDhwcOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv3DNdhwcDhwcOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv3DNdhwcDhwcOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv3DNdhwcDhwcOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv3DNdhwcDhwcOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv3DNdhwcDhwcOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv3DNdhwcDhwcOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv3DNdhwcDhwcOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv3DNdhwcDhwcOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv3DNdhwcDhwcOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv3DNdhwcDhwcOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv3DNdhwcDhwcOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv3DNdhwcDhwcOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv3DNdhwcDhwcOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv3DNdhwcDhwcOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +void DepthwiseConv3DNdhwcDhwcOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv3DNdhwcDhwcOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv3DNdhwcDhwcOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv3DNdhwcDhwcOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv3DNdhwcDhwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv3DNdhwcDhwcOp::getRegionBuilder()); + +} + +void DepthwiseConv3DNdhwcDhwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv3DNdhwcDhwcOp::getRegionBuilder()); + +} + +void DepthwiseConv3DNdhwcDhwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv3DNdhwcDhwcOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv3DNdhwcDhwcOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv3DNdhwcDhwcOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv3DNdhwcDhwcmOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.depthwise_conv_3d_ndhwc_dhwcm", odsAttrs.getContext()); +} + +DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase(DepthwiseConv3DNdhwcDhwcmOp op) : DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DepthwiseConv3DNdhwcDhwcmOpAdaptor::DepthwiseConv3DNdhwcDhwcmOpAdaptor(DepthwiseConv3DNdhwcDhwcmOp op) : DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcmOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.depthwise_conv_3d_ndhwc_dhwcm' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.depthwise_conv_3d_ndhwc_dhwcm' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + return ::mlir::success(); +} + +std::pair DepthwiseConv3DNdhwcDhwcmOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DepthwiseConv3DNdhwcDhwcmOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DepthwiseConv3DNdhwcDhwcmOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DepthwiseConv3DNdhwcDhwcmOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DepthwiseConv3DNdhwcDhwcmOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DepthwiseConv3DNdhwcDhwcmOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DepthwiseConv3DNdhwcDhwcmOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DepthwiseConv3DNdhwcDhwcmOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DepthwiseConv3DNdhwcDhwcmOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DepthwiseConv3DNdhwcDhwcmOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcmOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DepthwiseConv3DNdhwcDhwcmOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DepthwiseConv3DNdhwcDhwcmOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DepthwiseConv3DNdhwcDhwcmOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DepthwiseConv3DNdhwcDhwcmOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DepthwiseConv3DNdhwcDhwcmOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcmOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcmOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DepthwiseConv3DNdhwcDhwcmOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcmOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcmOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcmOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr DepthwiseConv3DNdhwcDhwcmOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +void DepthwiseConv3DNdhwcDhwcmOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void DepthwiseConv3DNdhwcDhwcmOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute DepthwiseConv3DNdhwcDhwcmOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute DepthwiseConv3DNdhwcDhwcmOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void DepthwiseConv3DNdhwcDhwcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DepthwiseConv3DNdhwcDhwcmOp::getRegionBuilder()); + +} + +void DepthwiseConv3DNdhwcDhwcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DepthwiseConv3DNdhwcDhwcmOp::getRegionBuilder()); + +} + +void DepthwiseConv3DNdhwcDhwcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void DepthwiseConv3DNdhwcDhwcmOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, DepthwiseConv3DNdhwcDhwcmOp::getRegionBuilder()); + +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcmOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DepthwiseConv3DNdhwcDhwcmOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv3DNdhwcDhwcmOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DivOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DivOpGenericAdaptorBase::DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.div", odsAttrs.getContext()); +} + +DivOpGenericAdaptorBase::DivOpGenericAdaptorBase(DivOp op) : DivOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DivOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DivOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &DivOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DivOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DivOpAdaptor::DivOpAdaptor(DivOp op) : DivOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DivOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DivOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DivOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DivOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DivOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DivOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DivOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DivOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DivOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DivOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DivOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DivOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DivOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DivOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult DivOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DivOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DivOp::getRegionBuilder()); + +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DivOp::getRegionBuilder()); + +} + +void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult DivOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DivOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DivUnsignedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DivUnsignedOpGenericAdaptorBase::DivUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.div_unsigned", odsAttrs.getContext()); +} + +DivUnsignedOpGenericAdaptorBase::DivUnsignedOpGenericAdaptorBase(DivUnsignedOp op) : DivUnsignedOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DivUnsignedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DivUnsignedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &DivUnsignedOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DivUnsignedOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DivUnsignedOpAdaptor::DivUnsignedOpAdaptor(DivUnsignedOp op) : DivUnsignedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DivUnsignedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DivUnsignedOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DivUnsignedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DivUnsignedOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DivUnsignedOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DivUnsignedOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DivUnsignedOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DivUnsignedOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DivUnsignedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DivUnsignedOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DivUnsignedOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DivUnsignedOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DivUnsignedOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DivUnsignedOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DivUnsignedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DivUnsignedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DivUnsignedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DivUnsignedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult DivUnsignedOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DivUnsignedOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void DivUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DivUnsignedOp::getRegionBuilder()); + +} + +void DivUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DivUnsignedOp::getRegionBuilder()); + +} + +void DivUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult DivUnsignedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DivUnsignedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DivUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DotOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DotOpGenericAdaptorBase::DotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.dot", odsAttrs.getContext()); +} + +DotOpGenericAdaptorBase::DotOpGenericAdaptorBase(DotOp op) : DotOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DotOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DotOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &DotOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DotOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DotOpAdaptor::DotOpAdaptor(DotOp op) : DotOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DotOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DotOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DotOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DotOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range DotOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange DotOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DotOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DotOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range DotOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range DotOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &DotOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DotOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DotOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DotOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult DotOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DotOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, DotOp::getRegionBuilder()); + +} + +void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, DotOp::getRegionBuilder()); + +} + +void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult DotOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DotOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::DotOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::ElemwiseBinaryOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ElemwiseBinaryOpGenericAdaptorBase::ElemwiseBinaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.elemwise_binary", odsAttrs.getContext()); +} + +ElemwiseBinaryOpGenericAdaptorBase::ElemwiseBinaryOpGenericAdaptorBase(ElemwiseBinaryOp op) : ElemwiseBinaryOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ElemwiseBinaryOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ElemwiseBinaryOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::linalg::BinaryFnAttr ElemwiseBinaryOpGenericAdaptorBase::getFunAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::linalg::BinaryFnAttr>(getProperties().fun); + if (!attr) + attr = ::mlir::linalg::BinaryFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), BinaryFn::add); + return attr; +} + +::mlir::linalg::BinaryFn ElemwiseBinaryOpGenericAdaptorBase::getFun() { + auto attr = getFunAttr(); + if (!attr) + return ::mlir::linalg::BinaryFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), BinaryFn::add).getValue(); + return attr.getValue(); +} + +::mlir::linalg::TypeFnAttr ElemwiseBinaryOpGenericAdaptorBase::getCastAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); + if (!attr) + attr = ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed); + return attr; +} + +::mlir::linalg::TypeFn ElemwiseBinaryOpGenericAdaptorBase::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +::mlir::Region &ElemwiseBinaryOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange ElemwiseBinaryOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ElemwiseBinaryOpAdaptor::ElemwiseBinaryOpAdaptor(ElemwiseBinaryOp op) : ElemwiseBinaryOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ElemwiseBinaryOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + auto tblgen_fun = getProperties().fun; (void)tblgen_fun; + + if (tblgen_fun && !((::llvm::isa<::mlir::linalg::BinaryFnAttr>(tblgen_fun)))) + return emitError(loc, "'linalg.elemwise_binary' op ""attribute 'fun' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8"); + + if (tblgen_cast && !((::llvm::isa<::mlir::linalg::TypeFnAttr>(tblgen_cast)))) + return emitError(loc, "'linalg.elemwise_binary' op ""attribute 'cast' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1"); + return ::mlir::success(); +} + +std::pair ElemwiseBinaryOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ElemwiseBinaryOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ElemwiseBinaryOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range ElemwiseBinaryOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange ElemwiseBinaryOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ElemwiseBinaryOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ElemwiseBinaryOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range ElemwiseBinaryOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range ElemwiseBinaryOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &ElemwiseBinaryOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult ElemwiseBinaryOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cast; + auto attr = dict.get("cast"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for cast in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cast` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.fun; + auto attr = dict.get("fun"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fun in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fun` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ElemwiseBinaryOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cast; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cast", + propStorage)); + } + + { + const auto &propStorage = prop.fun; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fun", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ElemwiseBinaryOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.cast.getAsOpaquePointer()), + llvm::hash_value(prop.fun.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ElemwiseBinaryOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cast") + return prop.cast; + + if (name == "fun") + return prop.fun; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ElemwiseBinaryOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cast") { + prop.cast = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "fun") { + prop.fun = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ElemwiseBinaryOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cast) attrs.append("cast", prop.cast); + + if (prop.fun) attrs.append("fun", prop.fun); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ElemwiseBinaryOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCastAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(attr, "cast", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps5(attr, "fun", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ElemwiseBinaryOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.cast))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.fun))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ElemwiseBinaryOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.cast); + + writer.writeOptionalAttribute(prop.fun); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::linalg::BinaryFnAttr ElemwiseBinaryOp::getFunAttr() { + return ::llvm::dyn_cast_or_null<::mlir::linalg::BinaryFnAttr>(getProperties().fun); +} + +::mlir::linalg::BinaryFn ElemwiseBinaryOp::getFun() { + auto attr = getFunAttr(); + if (!attr) + return ::mlir::linalg::BinaryFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), BinaryFn::add).getValue(); + return attr.getValue(); +} + +::mlir::linalg::TypeFnAttr ElemwiseBinaryOp::getCastAttr() { + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); +} + +::mlir::linalg::TypeFn ElemwiseBinaryOp::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +void ElemwiseBinaryOp::setFunAttr(::mlir::linalg::BinaryFnAttr attr) { + (*this)->setAttr(getFunAttrName(), attr); +} + +void ElemwiseBinaryOp::setFun(::std::optional<::mlir::linalg::BinaryFn> attrValue) { + if (attrValue) + return (*this)->setAttr(getFunAttrName(), ::mlir::linalg::BinaryFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getFunAttrName()); +} + +void ElemwiseBinaryOp::setCastAttr(::mlir::linalg::TypeFnAttr attr) { + (*this)->setAttr(getCastAttrName(), attr); +} + +void ElemwiseBinaryOp::setCast(::std::optional<::mlir::linalg::TypeFn> attrValue) { + if (attrValue) + return (*this)->setAttr(getCastAttrName(), ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getCastAttrName()); +} + +::mlir::Attribute ElemwiseBinaryOp::removeFunAttr() { + auto &attr = getProperties().fun; + attr = {}; + return attr; +} + +::mlir::Attribute ElemwiseBinaryOp::removeCastAttr() { + auto &attr = getProperties().cast; + attr = {}; + return attr; +} + +void ElemwiseBinaryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, ElemwiseBinaryOp::getRegionBuilder()); + +} + +void ElemwiseBinaryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, ElemwiseBinaryOp::getRegionBuilder()); + +} + +void ElemwiseBinaryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void ElemwiseBinaryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute fun, Attribute cast, ArrayRef attributes) { + odsState.addAttribute("fun", fun); +odsState.addAttribute("cast", cast); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, ElemwiseBinaryOp::getRegionBuilder()); + +} + +::mlir::LogicalResult ElemwiseBinaryOp::verifyInvariantsImpl() { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + auto tblgen_fun = getProperties().fun; (void)tblgen_fun; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps5(*this, tblgen_fun, "fun"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(*this, tblgen_cast, "cast"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ElemwiseBinaryOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::ElemwiseBinaryOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::ElemwiseUnaryOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ElemwiseUnaryOpGenericAdaptorBase::ElemwiseUnaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.elemwise_unary", odsAttrs.getContext()); +} + +ElemwiseUnaryOpGenericAdaptorBase::ElemwiseUnaryOpGenericAdaptorBase(ElemwiseUnaryOp op) : ElemwiseUnaryOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ElemwiseUnaryOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ElemwiseUnaryOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::linalg::UnaryFnAttr ElemwiseUnaryOpGenericAdaptorBase::getFunAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::linalg::UnaryFnAttr>(getProperties().fun); + if (!attr) + attr = ::mlir::linalg::UnaryFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), UnaryFn::exp); + return attr; +} + +::mlir::linalg::UnaryFn ElemwiseUnaryOpGenericAdaptorBase::getFun() { + auto attr = getFunAttr(); + if (!attr) + return ::mlir::linalg::UnaryFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), UnaryFn::exp).getValue(); + return attr.getValue(); +} + +::mlir::linalg::TypeFnAttr ElemwiseUnaryOpGenericAdaptorBase::getCastAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); + if (!attr) + attr = ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed); + return attr; +} + +::mlir::linalg::TypeFn ElemwiseUnaryOpGenericAdaptorBase::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +::mlir::Region &ElemwiseUnaryOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange ElemwiseUnaryOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ElemwiseUnaryOpAdaptor::ElemwiseUnaryOpAdaptor(ElemwiseUnaryOp op) : ElemwiseUnaryOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ElemwiseUnaryOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + auto tblgen_fun = getProperties().fun; (void)tblgen_fun; + + if (tblgen_fun && !((::llvm::isa<::mlir::linalg::UnaryFnAttr>(tblgen_fun)))) + return emitError(loc, "'linalg.elemwise_unary' op ""attribute 'fun' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5"); + + if (tblgen_cast && !((::llvm::isa<::mlir::linalg::TypeFnAttr>(tblgen_cast)))) + return emitError(loc, "'linalg.elemwise_unary' op ""attribute 'cast' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1"); + return ::mlir::success(); +} + +std::pair ElemwiseUnaryOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ElemwiseUnaryOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ElemwiseUnaryOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range ElemwiseUnaryOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange ElemwiseUnaryOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ElemwiseUnaryOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ElemwiseUnaryOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range ElemwiseUnaryOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range ElemwiseUnaryOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &ElemwiseUnaryOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult ElemwiseUnaryOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cast; + auto attr = dict.get("cast"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for cast in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cast` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.fun; + auto attr = dict.get("fun"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fun in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fun` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ElemwiseUnaryOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cast; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cast", + propStorage)); + } + + { + const auto &propStorage = prop.fun; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fun", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ElemwiseUnaryOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.cast.getAsOpaquePointer()), + llvm::hash_value(prop.fun.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ElemwiseUnaryOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cast") + return prop.cast; + + if (name == "fun") + return prop.fun; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ElemwiseUnaryOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cast") { + prop.cast = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "fun") { + prop.fun = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ElemwiseUnaryOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cast) attrs.append("cast", prop.cast); + + if (prop.fun) attrs.append("fun", prop.fun); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ElemwiseUnaryOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCastAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(attr, "cast", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps6(attr, "fun", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ElemwiseUnaryOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.cast))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.fun))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ElemwiseUnaryOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.cast); + + writer.writeOptionalAttribute(prop.fun); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::linalg::UnaryFnAttr ElemwiseUnaryOp::getFunAttr() { + return ::llvm::dyn_cast_or_null<::mlir::linalg::UnaryFnAttr>(getProperties().fun); +} + +::mlir::linalg::UnaryFn ElemwiseUnaryOp::getFun() { + auto attr = getFunAttr(); + if (!attr) + return ::mlir::linalg::UnaryFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), UnaryFn::exp).getValue(); + return attr.getValue(); +} + +::mlir::linalg::TypeFnAttr ElemwiseUnaryOp::getCastAttr() { + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); +} + +::mlir::linalg::TypeFn ElemwiseUnaryOp::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +void ElemwiseUnaryOp::setFunAttr(::mlir::linalg::UnaryFnAttr attr) { + (*this)->setAttr(getFunAttrName(), attr); +} + +void ElemwiseUnaryOp::setFun(::std::optional<::mlir::linalg::UnaryFn> attrValue) { + if (attrValue) + return (*this)->setAttr(getFunAttrName(), ::mlir::linalg::UnaryFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getFunAttrName()); +} + +void ElemwiseUnaryOp::setCastAttr(::mlir::linalg::TypeFnAttr attr) { + (*this)->setAttr(getCastAttrName(), attr); +} + +void ElemwiseUnaryOp::setCast(::std::optional<::mlir::linalg::TypeFn> attrValue) { + if (attrValue) + return (*this)->setAttr(getCastAttrName(), ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getCastAttrName()); +} + +::mlir::Attribute ElemwiseUnaryOp::removeFunAttr() { + auto &attr = getProperties().fun; + attr = {}; + return attr; +} + +::mlir::Attribute ElemwiseUnaryOp::removeCastAttr() { + auto &attr = getProperties().cast; + attr = {}; + return attr; +} + +void ElemwiseUnaryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, ElemwiseUnaryOp::getRegionBuilder()); + +} + +void ElemwiseUnaryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, ElemwiseUnaryOp::getRegionBuilder()); + +} + +void ElemwiseUnaryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void ElemwiseUnaryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute fun, Attribute cast, ArrayRef attributes) { + odsState.addAttribute("fun", fun); +odsState.addAttribute("cast", cast); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, ElemwiseUnaryOp::getRegionBuilder()); + +} + +::mlir::LogicalResult ElemwiseUnaryOp::verifyInvariantsImpl() { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + auto tblgen_fun = getProperties().fun; (void)tblgen_fun; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps6(*this, tblgen_fun, "fun"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(*this, tblgen_cast, "cast"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ElemwiseUnaryOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::ElemwiseUnaryOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::ExpOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExpOpGenericAdaptorBase::ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.exp", odsAttrs.getContext()); +} + +ExpOpGenericAdaptorBase::ExpOpGenericAdaptorBase(ExpOp op) : ExpOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExpOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ExpOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &ExpOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange ExpOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ExpOpAdaptor::ExpOpAdaptor(ExpOp op) : ExpOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExpOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ExpOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ExpOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ExpOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range ExpOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange ExpOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ExpOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ExpOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range ExpOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range ExpOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &ExpOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult ExpOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ExpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExpOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ExpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ExpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ExpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ExpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult ExpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ExpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, ExpOp::getRegionBuilder()); + +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, ExpOp::getRegionBuilder()); + +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult ExpOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::ExpOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::FillOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FillOpGenericAdaptorBase::FillOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.fill", odsAttrs.getContext()); +} + +FillOpGenericAdaptorBase::FillOpGenericAdaptorBase(FillOp op) : FillOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FillOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr FillOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &FillOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange FillOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +FillOpAdaptor::FillOpAdaptor(FillOp op) : FillOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FillOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FillOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range FillOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range FillOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range FillOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange FillOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange FillOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair FillOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range FillOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range FillOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &FillOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult FillOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute FillOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FillOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional FillOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void FillOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void FillOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult FillOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult FillOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void FillOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void FillOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, FillOp::getRegionBuilder()); + +} + +void FillOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, FillOp::getRegionBuilder()); + +} + +void FillOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult FillOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FillOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::FillOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::FillRng2DOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FillRng2DOpGenericAdaptorBase::FillRng2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.fill_rng_2d", odsAttrs.getContext()); +} + +FillRng2DOpGenericAdaptorBase::FillRng2DOpGenericAdaptorBase(FillRng2DOp op) : FillRng2DOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FillRng2DOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr FillRng2DOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &FillRng2DOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange FillRng2DOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +FillRng2DOpAdaptor::FillRng2DOpAdaptor(FillRng2DOp op) : FillRng2DOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FillRng2DOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FillRng2DOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range FillRng2DOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range FillRng2DOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range FillRng2DOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange FillRng2DOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange FillRng2DOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair FillRng2DOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range FillRng2DOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range FillRng2DOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &FillRng2DOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult FillRng2DOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute FillRng2DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FillRng2DOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional FillRng2DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void FillRng2DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void FillRng2DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult FillRng2DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult FillRng2DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void FillRng2DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void FillRng2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, FillRng2DOp::getRegionBuilder()); + +} + +void FillRng2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, FillRng2DOp::getRegionBuilder()); + +} + +void FillRng2DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult FillRng2DOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FillRng2DOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::FillRng2DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::FloorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FloorOpGenericAdaptorBase::FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.floor", odsAttrs.getContext()); +} + +FloorOpGenericAdaptorBase::FloorOpGenericAdaptorBase(FloorOp op) : FloorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FloorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr FloorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &FloorOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange FloorOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +FloorOpAdaptor::FloorOpAdaptor(FloorOp op) : FloorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FloorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FloorOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range FloorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range FloorOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range FloorOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange FloorOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange FloorOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair FloorOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range FloorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range FloorOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &FloorOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult FloorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute FloorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FloorOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional FloorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void FloorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void FloorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult FloorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult FloorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void FloorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, FloorOp::getRegionBuilder()); + +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, FloorOp::getRegionBuilder()); + +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult FloorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FloorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::FloorOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::GenericOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GenericOpGenericAdaptorBase::GenericOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.generic", odsAttrs.getContext()); +} + +GenericOpGenericAdaptorBase::GenericOpGenericAdaptorBase(GenericOp op) : GenericOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GenericOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr GenericOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr GenericOpGenericAdaptorBase::getIndexingMapsAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().indexing_maps); + return attr; +} + +::mlir::ArrayAttr GenericOpGenericAdaptorBase::getIndexingMaps() { + auto attr = getIndexingMapsAttr(); + return attr; +} + +::mlir::ArrayAttr GenericOpGenericAdaptorBase::getIteratorTypesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().iterator_types); + return attr; +} + +::mlir::ArrayAttr GenericOpGenericAdaptorBase::getIteratorTypes() { + auto attr = getIteratorTypesAttr(); + return attr; +} + +::mlir::StringAttr GenericOpGenericAdaptorBase::getDocAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().doc); + return attr; +} + +::std::optional< ::llvm::StringRef > GenericOpGenericAdaptorBase::getDoc() { + auto attr = getDocAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::StringAttr GenericOpGenericAdaptorBase::getLibraryCallAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().library_call); + return attr; +} + +::std::optional< ::llvm::StringRef > GenericOpGenericAdaptorBase::getLibraryCall() { + auto attr = getLibraryCallAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &GenericOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange GenericOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +GenericOpAdaptor::GenericOpAdaptor(GenericOp op) : GenericOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GenericOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_doc = getProperties().doc; (void)tblgen_doc; + auto tblgen_indexing_maps = getProperties().indexing_maps; (void)tblgen_indexing_maps; + if (!tblgen_indexing_maps) return emitError(loc, "'linalg.generic' op ""requires attribute 'indexing_maps'"); + auto tblgen_iterator_types = getProperties().iterator_types; (void)tblgen_iterator_types; + if (!tblgen_iterator_types) return emitError(loc, "'linalg.generic' op ""requires attribute 'iterator_types'"); + auto tblgen_library_call = getProperties().library_call; (void)tblgen_library_call; + + if (tblgen_indexing_maps && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_indexing_maps))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_indexing_maps), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::AffineMapAttr>(attr))); })))) + return emitError(loc, "'linalg.generic' op ""attribute 'indexing_maps' failed to satisfy constraint: AffineMap array attribute"); + + if (tblgen_iterator_types && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_iterator_types))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_iterator_types), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::linalg::IteratorTypeAttr>(attr))); })))) + return emitError(loc, "'linalg.generic' op ""attribute 'iterator_types' failed to satisfy constraint: Iterator type should be an enum."); + + if (tblgen_doc && !((::llvm::isa<::mlir::StringAttr>(tblgen_doc)))) + return emitError(loc, "'linalg.generic' op ""attribute 'doc' failed to satisfy constraint: string attribute"); + + if (tblgen_library_call && !((::llvm::isa<::mlir::StringAttr>(tblgen_library_call)))) + return emitError(loc, "'linalg.generic' op ""attribute 'library_call' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair GenericOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range GenericOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range GenericOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range GenericOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange GenericOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange GenericOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair GenericOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range GenericOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range GenericOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &GenericOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult GenericOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.doc; + auto attr = dict.get("doc"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for doc in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `doc` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.indexing_maps; + auto attr = dict.get("indexing_maps"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for indexing_maps in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `indexing_maps` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.iterator_types; + auto attr = dict.get("iterator_types"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for iterator_types in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `iterator_types` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.library_call; + auto attr = dict.get("library_call"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for library_call in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `library_call` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute GenericOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.doc; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("doc", + propStorage)); + } + + { + const auto &propStorage = prop.indexing_maps; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("indexing_maps", + propStorage)); + } + + { + const auto &propStorage = prop.iterator_types; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("iterator_types", + propStorage)); + } + + { + const auto &propStorage = prop.library_call; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("library_call", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GenericOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.doc.getAsOpaquePointer()), + llvm::hash_value(prop.indexing_maps.getAsOpaquePointer()), + llvm::hash_value(prop.iterator_types.getAsOpaquePointer()), + llvm::hash_value(prop.library_call.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional GenericOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "doc") + return prop.doc; + + if (name == "indexing_maps") + return prop.indexing_maps; + + if (name == "iterator_types") + return prop.iterator_types; + + if (name == "library_call") + return prop.library_call; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void GenericOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "doc") { + prop.doc = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "indexing_maps") { + prop.indexing_maps = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "iterator_types") { + prop.iterator_types = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "library_call") { + prop.library_call = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void GenericOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.doc) attrs.append("doc", prop.doc); + + if (prop.indexing_maps) attrs.append("indexing_maps", prop.indexing_maps); + + if (prop.iterator_types) attrs.append("iterator_types", prop.iterator_types); + + if (prop.library_call) attrs.append("library_call", prop.library_call); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult GenericOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDocAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps9(attr, "doc", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIndexingMapsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps7(attr, "indexing_maps", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIteratorTypesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps8(attr, "iterator_types", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLibraryCallAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps9(attr, "library_call", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GenericOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.doc))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.indexing_maps))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.iterator_types))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.library_call))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void GenericOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.doc); + writer.writeAttribute(prop.indexing_maps); + writer.writeAttribute(prop.iterator_types); + + writer.writeOptionalAttribute(prop.library_call); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::ArrayAttr GenericOp::getIndexingMapsAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().indexing_maps); +} + +::mlir::ArrayAttr GenericOp::getIndexingMaps() { + auto attr = getIndexingMapsAttr(); + return attr; +} + +::mlir::ArrayAttr GenericOp::getIteratorTypesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().iterator_types); +} + +::mlir::ArrayAttr GenericOp::getIteratorTypes() { + auto attr = getIteratorTypesAttr(); + return attr; +} + +::mlir::StringAttr GenericOp::getDocAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().doc); +} + +::std::optional< ::llvm::StringRef > GenericOp::getDoc() { + auto attr = getDocAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::StringAttr GenericOp::getLibraryCallAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().library_call); +} + +::std::optional< ::llvm::StringRef > GenericOp::getLibraryCall() { + auto attr = getLibraryCallAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void GenericOp::setIndexingMapsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getIndexingMapsAttrName(), attr); +} + +void GenericOp::setIteratorTypesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getIteratorTypesAttrName(), attr); +} + +void GenericOp::setDocAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getDocAttrName(), attr); +} + +void GenericOp::setDoc(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getDocAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getDocAttrName()); +} + +void GenericOp::setLibraryCallAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getLibraryCallAttrName(), attr); +} + +void GenericOp::setLibraryCall(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getLibraryCallAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getLibraryCallAttrName()); +} + +::mlir::Attribute GenericOp::removeDocAttr() { + auto &attr = getProperties().doc; + attr = {}; + return attr; +} + +::mlir::Attribute GenericOp::removeLibraryCallAttr() { + auto &attr = getProperties().library_call; + attr = {}; + return attr; +} + +void GenericOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result_tensors, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::ArrayAttr indexing_maps, ::mlir::ArrayAttr iterator_types, /*optional*/::mlir::StringAttr doc, /*optional*/::mlir::StringAttr library_call) { + odsState.addOperands(inputs); + odsState.addOperands(outputs); + ::llvm::copy(::llvm::ArrayRef({static_cast(inputs.size()), static_cast(outputs.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().indexing_maps = indexing_maps; + odsState.getOrAddProperties().iterator_types = iterator_types; + if (doc) { + odsState.getOrAddProperties().doc = doc; + } + if (library_call) { + odsState.getOrAddProperties().library_call = library_call; + } + (void)odsState.addRegion(); + odsState.addTypes(result_tensors); +} + +void GenericOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GenericOp::verifyInvariantsImpl() { + auto tblgen_doc = getProperties().doc; (void)tblgen_doc; + auto tblgen_indexing_maps = getProperties().indexing_maps; (void)tblgen_indexing_maps; + if (!tblgen_indexing_maps) return emitOpError("requires attribute 'indexing_maps'"); + auto tblgen_iterator_types = getProperties().iterator_types; (void)tblgen_iterator_types; + if (!tblgen_iterator_types) return emitOpError("requires attribute 'iterator_types'"); + auto tblgen_library_call = getProperties().library_call; (void)tblgen_library_call; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps7(*this, tblgen_indexing_maps, "indexing_maps"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps8(*this, tblgen_iterator_types, "iterator_types"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps9(*this, tblgen_doc, "doc"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps9(*this, tblgen_library_call, "library_call"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GenericOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::GenericOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::LogOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LogOpGenericAdaptorBase::LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.log", odsAttrs.getContext()); +} + +LogOpGenericAdaptorBase::LogOpGenericAdaptorBase(LogOp op) : LogOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LogOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr LogOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &LogOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange LogOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +LogOpAdaptor::LogOpAdaptor(LogOp op) : LogOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LogOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair LogOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range LogOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range LogOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range LogOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange LogOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LogOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair LogOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range LogOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range LogOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &LogOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult LogOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute LogOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LogOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional LogOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void LogOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void LogOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult LogOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult LogOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void LogOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, LogOp::getRegionBuilder()); + +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, LogOp::getRegionBuilder()); + +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult LogOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LogOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::LogOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MapOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MapOpGenericAdaptorBase::MapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.map", odsAttrs.getContext()); +} + +MapOpGenericAdaptorBase::MapOpGenericAdaptorBase(MapOp op) : MapOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MapOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr MapOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &MapOpGenericAdaptorBase::getMapper() { + return *odsRegions[0]; +} + +::mlir::RegionRange MapOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +MapOpAdaptor::MapOpAdaptor(MapOp op) : MapOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MapOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MapOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range MapOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MapOp::getInputs() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::ShapedType> MapOp::getInit() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(1).begin()); +} + +::mlir::MutableOperandRange MapOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &MapOp::getInitMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MapOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MapOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range MapOp::getResult() { + return getODSResults(0); +} + +::mlir::Region &MapOp::getMapper() { + return (*this)->getRegion(0); +} + +void MapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result, ::mlir::ValueRange inputs, ::mlir::Value init) { + odsState.addOperands(inputs); + odsState.addOperands(init); + (void)odsState.addRegion(); + odsState.addTypes(result); +} + +void MapOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MapOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps1(*this, region, "mapper", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MapOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::MapOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatmulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MatmulOpGenericAdaptorBase::MatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.matmul", odsAttrs.getContext()); +} + +MatmulOpGenericAdaptorBase::MatmulOpGenericAdaptorBase(MatmulOp op) : MatmulOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MatmulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr MatmulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::linalg::TypeFnAttr MatmulOpGenericAdaptorBase::getCastAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); + if (!attr) + attr = ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed); + return attr; +} + +::mlir::linalg::TypeFn MatmulOpGenericAdaptorBase::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +::mlir::Region &MatmulOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange MatmulOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +MatmulOpAdaptor::MatmulOpAdaptor(MatmulOp op) : MatmulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MatmulOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + + if (tblgen_cast && !((::llvm::isa<::mlir::linalg::TypeFnAttr>(tblgen_cast)))) + return emitError(loc, "'linalg.matmul' op ""attribute 'cast' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1"); + return ::mlir::success(); +} + +std::pair MatmulOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range MatmulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MatmulOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range MatmulOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange MatmulOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MatmulOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair MatmulOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MatmulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range MatmulOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &MatmulOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult MatmulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cast; + auto attr = dict.get("cast"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for cast in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cast` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute MatmulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cast; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cast", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MatmulOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.cast.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional MatmulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cast") + return prop.cast; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void MatmulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cast") { + prop.cast = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void MatmulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cast) attrs.append("cast", prop.cast); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult MatmulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCastAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(attr, "cast", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatmulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.cast))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void MatmulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.cast); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::linalg::TypeFnAttr MatmulOp::getCastAttr() { + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); +} + +::mlir::linalg::TypeFn MatmulOp::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +void MatmulOp::setCastAttr(::mlir::linalg::TypeFnAttr attr) { + (*this)->setAttr(getCastAttrName(), attr); +} + +void MatmulOp::setCast(::std::optional<::mlir::linalg::TypeFn> attrValue) { + if (attrValue) + return (*this)->setAttr(getCastAttrName(), ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getCastAttrName()); +} + +::mlir::Attribute MatmulOp::removeCastAttr() { + auto &attr = getProperties().cast; + attr = {}; + return attr; +} + +void MatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, MatmulOp::getRegionBuilder()); + +} + +void MatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, MatmulOp::getRegionBuilder()); + +} + +void MatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void MatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes) { + odsState.addAttribute("cast", cast); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, MatmulOp::getRegionBuilder()); + +} + +::mlir::LogicalResult MatmulOp::verifyInvariantsImpl() { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(*this, tblgen_cast, "cast"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatmulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::MatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatmulTransposeAOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MatmulTransposeAOpGenericAdaptorBase::MatmulTransposeAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.matmul_transpose_a", odsAttrs.getContext()); +} + +MatmulTransposeAOpGenericAdaptorBase::MatmulTransposeAOpGenericAdaptorBase(MatmulTransposeAOp op) : MatmulTransposeAOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MatmulTransposeAOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr MatmulTransposeAOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::linalg::TypeFnAttr MatmulTransposeAOpGenericAdaptorBase::getCastAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); + if (!attr) + attr = ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed); + return attr; +} + +::mlir::linalg::TypeFn MatmulTransposeAOpGenericAdaptorBase::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +::mlir::Region &MatmulTransposeAOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange MatmulTransposeAOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +MatmulTransposeAOpAdaptor::MatmulTransposeAOpAdaptor(MatmulTransposeAOp op) : MatmulTransposeAOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MatmulTransposeAOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + + if (tblgen_cast && !((::llvm::isa<::mlir::linalg::TypeFnAttr>(tblgen_cast)))) + return emitError(loc, "'linalg.matmul_transpose_a' op ""attribute 'cast' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1"); + return ::mlir::success(); +} + +std::pair MatmulTransposeAOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range MatmulTransposeAOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MatmulTransposeAOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range MatmulTransposeAOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange MatmulTransposeAOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MatmulTransposeAOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair MatmulTransposeAOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MatmulTransposeAOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range MatmulTransposeAOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &MatmulTransposeAOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult MatmulTransposeAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cast; + auto attr = dict.get("cast"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for cast in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cast` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute MatmulTransposeAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cast; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cast", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MatmulTransposeAOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.cast.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional MatmulTransposeAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cast") + return prop.cast; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void MatmulTransposeAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cast") { + prop.cast = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void MatmulTransposeAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cast) attrs.append("cast", prop.cast); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult MatmulTransposeAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCastAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(attr, "cast", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatmulTransposeAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.cast))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void MatmulTransposeAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.cast); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::linalg::TypeFnAttr MatmulTransposeAOp::getCastAttr() { + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); +} + +::mlir::linalg::TypeFn MatmulTransposeAOp::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +void MatmulTransposeAOp::setCastAttr(::mlir::linalg::TypeFnAttr attr) { + (*this)->setAttr(getCastAttrName(), attr); +} + +void MatmulTransposeAOp::setCast(::std::optional<::mlir::linalg::TypeFn> attrValue) { + if (attrValue) + return (*this)->setAttr(getCastAttrName(), ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getCastAttrName()); +} + +::mlir::Attribute MatmulTransposeAOp::removeCastAttr() { + auto &attr = getProperties().cast; + attr = {}; + return attr; +} + +void MatmulTransposeAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, MatmulTransposeAOp::getRegionBuilder()); + +} + +void MatmulTransposeAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, MatmulTransposeAOp::getRegionBuilder()); + +} + +void MatmulTransposeAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void MatmulTransposeAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes) { + odsState.addAttribute("cast", cast); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, MatmulTransposeAOp::getRegionBuilder()); + +} + +::mlir::LogicalResult MatmulTransposeAOp::verifyInvariantsImpl() { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(*this, tblgen_cast, "cast"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatmulTransposeAOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::MatmulTransposeAOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatmulTransposeBOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MatmulTransposeBOpGenericAdaptorBase::MatmulTransposeBOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.matmul_transpose_b", odsAttrs.getContext()); +} + +MatmulTransposeBOpGenericAdaptorBase::MatmulTransposeBOpGenericAdaptorBase(MatmulTransposeBOp op) : MatmulTransposeBOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MatmulTransposeBOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr MatmulTransposeBOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::linalg::TypeFnAttr MatmulTransposeBOpGenericAdaptorBase::getCastAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); + if (!attr) + attr = ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed); + return attr; +} + +::mlir::linalg::TypeFn MatmulTransposeBOpGenericAdaptorBase::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder(odsAttrs.getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +::mlir::Region &MatmulTransposeBOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange MatmulTransposeBOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +MatmulTransposeBOpAdaptor::MatmulTransposeBOpAdaptor(MatmulTransposeBOp op) : MatmulTransposeBOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MatmulTransposeBOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + + if (tblgen_cast && !((::llvm::isa<::mlir::linalg::TypeFnAttr>(tblgen_cast)))) + return emitError(loc, "'linalg.matmul_transpose_b' op ""attribute 'cast' failed to satisfy constraint: allowed 32-bit signless integer cases: 0, 1"); + return ::mlir::success(); +} + +std::pair MatmulTransposeBOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range MatmulTransposeBOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MatmulTransposeBOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range MatmulTransposeBOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange MatmulTransposeBOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MatmulTransposeBOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair MatmulTransposeBOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MatmulTransposeBOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range MatmulTransposeBOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &MatmulTransposeBOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult MatmulTransposeBOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cast; + auto attr = dict.get("cast"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for cast in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cast` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute MatmulTransposeBOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cast; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cast", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MatmulTransposeBOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.cast.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional MatmulTransposeBOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cast") + return prop.cast; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void MatmulTransposeBOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cast") { + prop.cast = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void MatmulTransposeBOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cast) attrs.append("cast", prop.cast); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult MatmulTransposeBOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCastAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(attr, "cast", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatmulTransposeBOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.cast))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void MatmulTransposeBOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.cast); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::linalg::TypeFnAttr MatmulTransposeBOp::getCastAttr() { + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); +} + +::mlir::linalg::TypeFn MatmulTransposeBOp::getCast() { + auto attr = getCastAttr(); + if (!attr) + return ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), TypeFn::cast_signed).getValue(); + return attr.getValue(); +} + +void MatmulTransposeBOp::setCastAttr(::mlir::linalg::TypeFnAttr attr) { + (*this)->setAttr(getCastAttrName(), attr); +} + +void MatmulTransposeBOp::setCast(::std::optional<::mlir::linalg::TypeFn> attrValue) { + if (attrValue) + return (*this)->setAttr(getCastAttrName(), ::mlir::linalg::TypeFnAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getCastAttrName()); +} + +::mlir::Attribute MatmulTransposeBOp::removeCastAttr() { + auto &attr = getProperties().cast; + attr = {}; + return attr; +} + +void MatmulTransposeBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, MatmulTransposeBOp::getRegionBuilder()); + +} + +void MatmulTransposeBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, MatmulTransposeBOp::getRegionBuilder()); + +} + +void MatmulTransposeBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void MatmulTransposeBOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes) { + odsState.addAttribute("cast", cast); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, MatmulTransposeBOp::getRegionBuilder()); + +} + +::mlir::LogicalResult MatmulTransposeBOp::verifyInvariantsImpl() { + auto tblgen_cast = getProperties().cast; (void)tblgen_cast; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps4(*this, tblgen_cast, "cast"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatmulTransposeBOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::MatmulTransposeBOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatmulUnsignedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MatmulUnsignedOpGenericAdaptorBase::MatmulUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.matmul_unsigned", odsAttrs.getContext()); +} + +MatmulUnsignedOpGenericAdaptorBase::MatmulUnsignedOpGenericAdaptorBase(MatmulUnsignedOp op) : MatmulUnsignedOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MatmulUnsignedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr MatmulUnsignedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &MatmulUnsignedOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange MatmulUnsignedOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +MatmulUnsignedOpAdaptor::MatmulUnsignedOpAdaptor(MatmulUnsignedOp op) : MatmulUnsignedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MatmulUnsignedOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MatmulUnsignedOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range MatmulUnsignedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MatmulUnsignedOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range MatmulUnsignedOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange MatmulUnsignedOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MatmulUnsignedOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair MatmulUnsignedOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MatmulUnsignedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range MatmulUnsignedOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &MatmulUnsignedOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult MatmulUnsignedOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute MatmulUnsignedOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MatmulUnsignedOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional MatmulUnsignedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void MatmulUnsignedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void MatmulUnsignedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult MatmulUnsignedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult MatmulUnsignedOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void MatmulUnsignedOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void MatmulUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, MatmulUnsignedOp::getRegionBuilder()); + +} + +void MatmulUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, MatmulUnsignedOp::getRegionBuilder()); + +} + +void MatmulUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult MatmulUnsignedOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatmulUnsignedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::MatmulUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatvecOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MatvecOpGenericAdaptorBase::MatvecOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.matvec", odsAttrs.getContext()); +} + +MatvecOpGenericAdaptorBase::MatvecOpGenericAdaptorBase(MatvecOp op) : MatvecOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MatvecOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr MatvecOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &MatvecOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange MatvecOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +MatvecOpAdaptor::MatvecOpAdaptor(MatvecOp op) : MatvecOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MatvecOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MatvecOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range MatvecOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MatvecOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range MatvecOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange MatvecOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MatvecOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair MatvecOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MatvecOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range MatvecOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &MatvecOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult MatvecOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute MatvecOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MatvecOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional MatvecOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void MatvecOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void MatvecOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult MatvecOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult MatvecOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void MatvecOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void MatvecOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, MatvecOp::getRegionBuilder()); + +} + +void MatvecOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, MatvecOp::getRegionBuilder()); + +} + +void MatvecOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult MatvecOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MatvecOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::MatvecOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MaxOpGenericAdaptorBase::MaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.max", odsAttrs.getContext()); +} + +MaxOpGenericAdaptorBase::MaxOpGenericAdaptorBase(MaxOp op) : MaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr MaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &MaxOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange MaxOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +MaxOpAdaptor::MaxOpAdaptor(MaxOp op) : MaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MaxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MaxOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range MaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MaxOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range MaxOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange MaxOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MaxOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair MaxOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range MaxOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &MaxOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult MaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute MaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MaxOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional MaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void MaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void MaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult MaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult MaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void MaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void MaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, MaxOp::getRegionBuilder()); + +} + +void MaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, MaxOp::getRegionBuilder()); + +} + +void MaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult MaxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::MaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Mmt4DOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Mmt4DOpGenericAdaptorBase::Mmt4DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.mmt4d", odsAttrs.getContext()); +} + +Mmt4DOpGenericAdaptorBase::Mmt4DOpGenericAdaptorBase(Mmt4DOp op) : Mmt4DOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Mmt4DOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr Mmt4DOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &Mmt4DOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange Mmt4DOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +Mmt4DOpAdaptor::Mmt4DOpAdaptor(Mmt4DOp op) : Mmt4DOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Mmt4DOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair Mmt4DOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range Mmt4DOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range Mmt4DOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range Mmt4DOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange Mmt4DOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange Mmt4DOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair Mmt4DOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range Mmt4DOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range Mmt4DOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &Mmt4DOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult Mmt4DOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute Mmt4DOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Mmt4DOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional Mmt4DOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void Mmt4DOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void Mmt4DOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult Mmt4DOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult Mmt4DOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void Mmt4DOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void Mmt4DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, Mmt4DOp::getRegionBuilder()); + +} + +void Mmt4DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, Mmt4DOp::getRegionBuilder()); + +} + +void Mmt4DOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult Mmt4DOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Mmt4DOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::Mmt4DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.mul", odsAttrs.getContext()); +} + +MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(MulOp op) : MulOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr MulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &MulOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange MulOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +MulOpAdaptor::MulOpAdaptor(MulOp op) : MulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MulOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range MulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range MulOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range MulOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange MulOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MulOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair MulOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range MulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range MulOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &MulOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult MulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute MulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MulOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional MulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void MulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void MulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult MulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult MulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void MulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, MulOp::getRegionBuilder()); + +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, MulOp::getRegionBuilder()); + +} + +void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult MulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::MulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::NegfOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +NegfOpGenericAdaptorBase::NegfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.negf", odsAttrs.getContext()); +} + +NegfOpGenericAdaptorBase::NegfOpGenericAdaptorBase(NegfOp op) : NegfOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair NegfOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr NegfOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &NegfOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange NegfOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +NegfOpAdaptor::NegfOpAdaptor(NegfOp op) : NegfOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult NegfOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair NegfOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range NegfOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range NegfOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range NegfOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange NegfOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange NegfOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair NegfOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range NegfOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range NegfOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &NegfOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult NegfOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute NegfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code NegfOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional NegfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void NegfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void NegfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult NegfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult NegfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void NegfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void NegfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, NegfOp::getRegionBuilder()); + +} + +void NegfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, NegfOp::getRegionBuilder()); + +} + +void NegfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult NegfOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult NegfOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::NegfOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNchwMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNchwMaxOpGenericAdaptorBase::PoolingNchwMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nchw_max", odsAttrs.getContext()); +} + +PoolingNchwMaxOpGenericAdaptorBase::PoolingNchwMaxOpGenericAdaptorBase(PoolingNchwMaxOp op) : PoolingNchwMaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNchwMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNchwMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNchwMaxOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNchwMaxOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNchwMaxOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNchwMaxOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNchwMaxOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNchwMaxOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNchwMaxOpAdaptor::PoolingNchwMaxOpAdaptor(PoolingNchwMaxOp op) : PoolingNchwMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNchwMaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nchw_max' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nchw_max' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair PoolingNchwMaxOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNchwMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNchwMaxOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNchwMaxOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNchwMaxOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNchwMaxOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNchwMaxOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNchwMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNchwMaxOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNchwMaxOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNchwMaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNchwMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNchwMaxOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNchwMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNchwMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNchwMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNchwMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNchwMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNchwMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNchwMaxOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNchwMaxOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNchwMaxOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNchwMaxOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNchwMaxOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNchwMaxOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNchwMaxOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNchwMaxOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNchwMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNchwMaxOp::getRegionBuilder()); + +} + +void PoolingNchwMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNchwMaxOp::getRegionBuilder()); + +} + +void PoolingNchwMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNchwMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNchwMaxOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNchwMaxOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNchwMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNchwMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNchwSumOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNchwSumOpGenericAdaptorBase::PoolingNchwSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nchw_sum", odsAttrs.getContext()); +} + +PoolingNchwSumOpGenericAdaptorBase::PoolingNchwSumOpGenericAdaptorBase(PoolingNchwSumOp op) : PoolingNchwSumOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNchwSumOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNchwSumOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNchwSumOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNchwSumOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNchwSumOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNchwSumOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNchwSumOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNchwSumOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNchwSumOpAdaptor::PoolingNchwSumOpAdaptor(PoolingNchwSumOp op) : PoolingNchwSumOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNchwSumOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nchw_sum' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nchw_sum' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair PoolingNchwSumOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNchwSumOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNchwSumOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNchwSumOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNchwSumOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNchwSumOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNchwSumOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNchwSumOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNchwSumOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNchwSumOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNchwSumOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNchwSumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNchwSumOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNchwSumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNchwSumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNchwSumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNchwSumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNchwSumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNchwSumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNchwSumOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNchwSumOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNchwSumOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNchwSumOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNchwSumOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNchwSumOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNchwSumOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNchwSumOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNchwSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNchwSumOp::getRegionBuilder()); + +} + +void PoolingNchwSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNchwSumOp::getRegionBuilder()); + +} + +void PoolingNchwSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNchwSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNchwSumOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNchwSumOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNchwSumOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNchwSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNcwMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNcwMaxOpGenericAdaptorBase::PoolingNcwMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_ncw_max", odsAttrs.getContext()); +} + +PoolingNcwMaxOpGenericAdaptorBase::PoolingNcwMaxOpGenericAdaptorBase(PoolingNcwMaxOp op) : PoolingNcwMaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNcwMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNcwMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNcwMaxOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNcwMaxOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNcwMaxOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNcwMaxOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNcwMaxOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNcwMaxOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNcwMaxOpAdaptor::PoolingNcwMaxOpAdaptor(PoolingNcwMaxOp op) : PoolingNcwMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNcwMaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_ncw_max' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_ncw_max' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair PoolingNcwMaxOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNcwMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNcwMaxOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNcwMaxOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNcwMaxOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNcwMaxOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNcwMaxOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNcwMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNcwMaxOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNcwMaxOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNcwMaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNcwMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNcwMaxOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNcwMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNcwMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNcwMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNcwMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNcwMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNcwMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNcwMaxOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNcwMaxOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNcwMaxOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNcwMaxOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void PoolingNcwMaxOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNcwMaxOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNcwMaxOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNcwMaxOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNcwMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNcwMaxOp::getRegionBuilder()); + +} + +void PoolingNcwMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNcwMaxOp::getRegionBuilder()); + +} + +void PoolingNcwMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNcwMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNcwMaxOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNcwMaxOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNcwMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNcwMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNcwSumOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNcwSumOpGenericAdaptorBase::PoolingNcwSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_ncw_sum", odsAttrs.getContext()); +} + +PoolingNcwSumOpGenericAdaptorBase::PoolingNcwSumOpGenericAdaptorBase(PoolingNcwSumOp op) : PoolingNcwSumOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNcwSumOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNcwSumOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNcwSumOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNcwSumOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNcwSumOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNcwSumOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNcwSumOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNcwSumOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNcwSumOpAdaptor::PoolingNcwSumOpAdaptor(PoolingNcwSumOp op) : PoolingNcwSumOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNcwSumOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_ncw_sum' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_ncw_sum' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair PoolingNcwSumOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNcwSumOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNcwSumOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNcwSumOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNcwSumOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNcwSumOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNcwSumOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNcwSumOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNcwSumOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNcwSumOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNcwSumOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNcwSumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNcwSumOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNcwSumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNcwSumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNcwSumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNcwSumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNcwSumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNcwSumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNcwSumOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNcwSumOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNcwSumOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNcwSumOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void PoolingNcwSumOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNcwSumOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNcwSumOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNcwSumOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNcwSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNcwSumOp::getRegionBuilder()); + +} + +void PoolingNcwSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNcwSumOp::getRegionBuilder()); + +} + +void PoolingNcwSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNcwSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNcwSumOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNcwSumOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNcwSumOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNcwSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNdhwcMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNdhwcMaxOpGenericAdaptorBase::PoolingNdhwcMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_ndhwc_max", odsAttrs.getContext()); +} + +PoolingNdhwcMaxOpGenericAdaptorBase::PoolingNdhwcMaxOpGenericAdaptorBase(PoolingNdhwcMaxOp op) : PoolingNdhwcMaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNdhwcMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNdhwcMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMaxOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMaxOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMaxOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMaxOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNdhwcMaxOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNdhwcMaxOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNdhwcMaxOpAdaptor::PoolingNdhwcMaxOpAdaptor(PoolingNdhwcMaxOp op) : PoolingNdhwcMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNdhwcMaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.pooling_ndhwc_max' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.pooling_ndhwc_max' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + return ::mlir::success(); +} + +std::pair PoolingNdhwcMaxOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNdhwcMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNdhwcMaxOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNdhwcMaxOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNdhwcMaxOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNdhwcMaxOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNdhwcMaxOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNdhwcMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNdhwcMaxOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNdhwcMaxOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNdhwcMaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNdhwcMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNdhwcMaxOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNdhwcMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNdhwcMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNdhwcMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNdhwcMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNdhwcMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNdhwcMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMaxOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMaxOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMaxOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMaxOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNdhwcMaxOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNdhwcMaxOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNdhwcMaxOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNdhwcMaxOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNdhwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNdhwcMaxOp::getRegionBuilder()); + +} + +void PoolingNdhwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNdhwcMaxOp::getRegionBuilder()); + +} + +void PoolingNdhwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNdhwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNdhwcMaxOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNdhwcMaxOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNdhwcMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNdhwcMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNdhwcMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNdhwcMinOpGenericAdaptorBase::PoolingNdhwcMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_ndhwc_min", odsAttrs.getContext()); +} + +PoolingNdhwcMinOpGenericAdaptorBase::PoolingNdhwcMinOpGenericAdaptorBase(PoolingNdhwcMinOp op) : PoolingNdhwcMinOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNdhwcMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNdhwcMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMinOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMinOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMinOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMinOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNdhwcMinOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNdhwcMinOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNdhwcMinOpAdaptor::PoolingNdhwcMinOpAdaptor(PoolingNdhwcMinOp op) : PoolingNdhwcMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNdhwcMinOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.pooling_ndhwc_min' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.pooling_ndhwc_min' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + return ::mlir::success(); +} + +std::pair PoolingNdhwcMinOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNdhwcMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNdhwcMinOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNdhwcMinOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNdhwcMinOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNdhwcMinOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNdhwcMinOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNdhwcMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNdhwcMinOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNdhwcMinOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNdhwcMinOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNdhwcMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNdhwcMinOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNdhwcMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNdhwcMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNdhwcMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNdhwcMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNdhwcMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNdhwcMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMinOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMinOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMinOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNdhwcMinOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNdhwcMinOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNdhwcMinOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNdhwcMinOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNdhwcMinOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNdhwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNdhwcMinOp::getRegionBuilder()); + +} + +void PoolingNdhwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNdhwcMinOp::getRegionBuilder()); + +} + +void PoolingNdhwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNdhwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNdhwcMinOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNdhwcMinOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNdhwcMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNdhwcMinOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNdhwcSumOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNdhwcSumOpGenericAdaptorBase::PoolingNdhwcSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_ndhwc_sum", odsAttrs.getContext()); +} + +PoolingNdhwcSumOpGenericAdaptorBase::PoolingNdhwcSumOpGenericAdaptorBase(PoolingNdhwcSumOp op) : PoolingNdhwcSumOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNdhwcSumOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNdhwcSumOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcSumOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcSumOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcSumOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcSumOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNdhwcSumOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNdhwcSumOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNdhwcSumOpAdaptor::PoolingNdhwcSumOpAdaptor(PoolingNdhwcSumOp op) : PoolingNdhwcSumOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNdhwcSumOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.pooling_ndhwc_sum' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({3}))))) + return emitError(loc, "'linalg.pooling_ndhwc_sum' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [3]"); + return ::mlir::success(); +} + +std::pair PoolingNdhwcSumOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNdhwcSumOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNdhwcSumOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNdhwcSumOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNdhwcSumOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNdhwcSumOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNdhwcSumOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNdhwcSumOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNdhwcSumOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNdhwcSumOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNdhwcSumOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNdhwcSumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNdhwcSumOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNdhwcSumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNdhwcSumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNdhwcSumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNdhwcSumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNdhwcSumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNdhwcSumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNdhwcSumOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNdhwcSumOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNdhwcSumOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNdhwcSumOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({3}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNdhwcSumOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNdhwcSumOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNdhwcSumOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNdhwcSumOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNdhwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNdhwcSumOp::getRegionBuilder()); + +} + +void PoolingNdhwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNdhwcSumOp::getRegionBuilder()); + +} + +void PoolingNdhwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNdhwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNdhwcSumOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNdhwcSumOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps3(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNdhwcSumOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNdhwcSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNhwcMaxOpGenericAdaptorBase::PoolingNhwcMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nhwc_max", odsAttrs.getContext()); +} + +PoolingNhwcMaxOpGenericAdaptorBase::PoolingNhwcMaxOpGenericAdaptorBase(PoolingNhwcMaxOp op) : PoolingNhwcMaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNhwcMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNhwcMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNhwcMaxOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNhwcMaxOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNhwcMaxOpAdaptor::PoolingNhwcMaxOpAdaptor(PoolingNhwcMaxOp op) : PoolingNhwcMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNhwcMaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_max' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_max' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair PoolingNhwcMaxOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNhwcMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNhwcMaxOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNhwcMaxOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNhwcMaxOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNhwcMaxOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNhwcMaxOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNhwcMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNhwcMaxOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNhwcMaxOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNhwcMaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNhwcMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNhwcMaxOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNhwcMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNhwcMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNhwcMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNhwcMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNhwcMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNhwcMaxOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNhwcMaxOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNhwcMaxOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNhwcMaxOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNhwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNhwcMaxOp::getRegionBuilder()); + +} + +void PoolingNhwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcMaxOp::getRegionBuilder()); + +} + +void PoolingNhwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNhwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcMaxOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNhwcMaxOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcMaxUnsignedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNhwcMaxUnsignedOpGenericAdaptorBase::PoolingNhwcMaxUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nhwc_max_unsigned", odsAttrs.getContext()); +} + +PoolingNhwcMaxUnsignedOpGenericAdaptorBase::PoolingNhwcMaxUnsignedOpGenericAdaptorBase(PoolingNhwcMaxUnsignedOp op) : PoolingNhwcMaxUnsignedOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNhwcMaxUnsignedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNhwcMaxUnsignedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxUnsignedOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxUnsignedOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxUnsignedOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxUnsignedOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNhwcMaxUnsignedOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNhwcMaxUnsignedOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNhwcMaxUnsignedOpAdaptor::PoolingNhwcMaxUnsignedOpAdaptor(PoolingNhwcMaxUnsignedOp op) : PoolingNhwcMaxUnsignedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNhwcMaxUnsignedOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_max_unsigned' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_max_unsigned' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair PoolingNhwcMaxUnsignedOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNhwcMaxUnsignedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNhwcMaxUnsignedOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNhwcMaxUnsignedOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNhwcMaxUnsignedOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNhwcMaxUnsignedOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNhwcMaxUnsignedOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNhwcMaxUnsignedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNhwcMaxUnsignedOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNhwcMaxUnsignedOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNhwcMaxUnsignedOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNhwcMaxUnsignedOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNhwcMaxUnsignedOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNhwcMaxUnsignedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNhwcMaxUnsignedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNhwcMaxUnsignedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNhwcMaxUnsignedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcMaxUnsignedOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNhwcMaxUnsignedOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxUnsignedOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxUnsignedOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxUnsignedOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNhwcMaxUnsignedOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNhwcMaxUnsignedOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNhwcMaxUnsignedOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNhwcMaxUnsignedOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNhwcMaxUnsignedOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNhwcMaxUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNhwcMaxUnsignedOp::getRegionBuilder()); + +} + +void PoolingNhwcMaxUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcMaxUnsignedOp::getRegionBuilder()); + +} + +void PoolingNhwcMaxUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNhwcMaxUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcMaxUnsignedOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNhwcMaxUnsignedOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcMaxUnsignedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMaxUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNhwcMinOpGenericAdaptorBase::PoolingNhwcMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nhwc_min", odsAttrs.getContext()); +} + +PoolingNhwcMinOpGenericAdaptorBase::PoolingNhwcMinOpGenericAdaptorBase(PoolingNhwcMinOp op) : PoolingNhwcMinOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNhwcMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNhwcMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNhwcMinOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNhwcMinOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNhwcMinOpAdaptor::PoolingNhwcMinOpAdaptor(PoolingNhwcMinOp op) : PoolingNhwcMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNhwcMinOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_min' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_min' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair PoolingNhwcMinOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNhwcMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNhwcMinOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNhwcMinOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNhwcMinOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNhwcMinOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNhwcMinOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNhwcMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNhwcMinOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNhwcMinOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNhwcMinOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNhwcMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNhwcMinOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNhwcMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNhwcMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNhwcMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNhwcMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNhwcMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNhwcMinOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNhwcMinOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNhwcMinOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNhwcMinOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNhwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNhwcMinOp::getRegionBuilder()); + +} + +void PoolingNhwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcMinOp::getRegionBuilder()); + +} + +void PoolingNhwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNhwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcMinOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNhwcMinOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMinOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcMinUnsignedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNhwcMinUnsignedOpGenericAdaptorBase::PoolingNhwcMinUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nhwc_min_unsigned", odsAttrs.getContext()); +} + +PoolingNhwcMinUnsignedOpGenericAdaptorBase::PoolingNhwcMinUnsignedOpGenericAdaptorBase(PoolingNhwcMinUnsignedOp op) : PoolingNhwcMinUnsignedOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNhwcMinUnsignedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNhwcMinUnsignedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinUnsignedOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinUnsignedOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinUnsignedOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinUnsignedOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNhwcMinUnsignedOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNhwcMinUnsignedOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNhwcMinUnsignedOpAdaptor::PoolingNhwcMinUnsignedOpAdaptor(PoolingNhwcMinUnsignedOp op) : PoolingNhwcMinUnsignedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNhwcMinUnsignedOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_min_unsigned' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_min_unsigned' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair PoolingNhwcMinUnsignedOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNhwcMinUnsignedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNhwcMinUnsignedOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNhwcMinUnsignedOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNhwcMinUnsignedOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNhwcMinUnsignedOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNhwcMinUnsignedOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNhwcMinUnsignedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNhwcMinUnsignedOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNhwcMinUnsignedOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNhwcMinUnsignedOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNhwcMinUnsignedOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNhwcMinUnsignedOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNhwcMinUnsignedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNhwcMinUnsignedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNhwcMinUnsignedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNhwcMinUnsignedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcMinUnsignedOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNhwcMinUnsignedOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinUnsignedOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinUnsignedOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinUnsignedOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNhwcMinUnsignedOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNhwcMinUnsignedOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNhwcMinUnsignedOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNhwcMinUnsignedOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNhwcMinUnsignedOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNhwcMinUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNhwcMinUnsignedOp::getRegionBuilder()); + +} + +void PoolingNhwcMinUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcMinUnsignedOp::getRegionBuilder()); + +} + +void PoolingNhwcMinUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNhwcMinUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcMinUnsignedOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNhwcMinUnsignedOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcMinUnsignedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMinUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcSumOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNhwcSumOpGenericAdaptorBase::PoolingNhwcSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nhwc_sum", odsAttrs.getContext()); +} + +PoolingNhwcSumOpGenericAdaptorBase::PoolingNhwcSumOpGenericAdaptorBase(PoolingNhwcSumOp op) : PoolingNhwcSumOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNhwcSumOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNhwcSumOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNhwcSumOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcSumOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcSumOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcSumOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNhwcSumOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNhwcSumOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNhwcSumOpAdaptor::PoolingNhwcSumOpAdaptor(PoolingNhwcSumOp op) : PoolingNhwcSumOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNhwcSumOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_sum' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({2}))))) + return emitError(loc, "'linalg.pooling_nhwc_sum' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [2]"); + return ::mlir::success(); +} + +std::pair PoolingNhwcSumOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNhwcSumOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNhwcSumOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNhwcSumOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNhwcSumOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNhwcSumOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNhwcSumOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNhwcSumOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNhwcSumOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNhwcSumOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNhwcSumOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNhwcSumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNhwcSumOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNhwcSumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNhwcSumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNhwcSumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNhwcSumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcSumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNhwcSumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNhwcSumOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNhwcSumOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNhwcSumOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNhwcSumOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({2}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1), static_cast(1) })); + return attr; +} + +void PoolingNhwcSumOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNhwcSumOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNhwcSumOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNhwcSumOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNhwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNhwcSumOp::getRegionBuilder()); + +} + +void PoolingNhwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNhwcSumOp::getRegionBuilder()); + +} + +void PoolingNhwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNhwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNhwcSumOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNhwcSumOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps2(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNhwcSumOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcMaxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNwcMaxOpGenericAdaptorBase::PoolingNwcMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nwc_max", odsAttrs.getContext()); +} + +PoolingNwcMaxOpGenericAdaptorBase::PoolingNwcMaxOpGenericAdaptorBase(PoolingNwcMaxOp op) : PoolingNwcMaxOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNwcMaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNwcMaxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNwcMaxOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNwcMaxOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNwcMaxOpAdaptor::PoolingNwcMaxOpAdaptor(PoolingNwcMaxOp op) : PoolingNwcMaxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNwcMaxOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_max' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_max' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair PoolingNwcMaxOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNwcMaxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNwcMaxOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNwcMaxOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNwcMaxOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNwcMaxOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNwcMaxOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNwcMaxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNwcMaxOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNwcMaxOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNwcMaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNwcMaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNwcMaxOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNwcMaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNwcMaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNwcMaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNwcMaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcMaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNwcMaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void PoolingNwcMaxOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNwcMaxOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNwcMaxOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNwcMaxOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNwcMaxOp::getRegionBuilder()); + +} + +void PoolingNwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcMaxOp::getRegionBuilder()); + +} + +void PoolingNwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNwcMaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcMaxOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNwcMaxOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcMaxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcMaxUnsignedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNwcMaxUnsignedOpGenericAdaptorBase::PoolingNwcMaxUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nwc_max_unsigned", odsAttrs.getContext()); +} + +PoolingNwcMaxUnsignedOpGenericAdaptorBase::PoolingNwcMaxUnsignedOpGenericAdaptorBase(PoolingNwcMaxUnsignedOp op) : PoolingNwcMaxUnsignedOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNwcMaxUnsignedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNwcMaxUnsignedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxUnsignedOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxUnsignedOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxUnsignedOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxUnsignedOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNwcMaxUnsignedOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNwcMaxUnsignedOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNwcMaxUnsignedOpAdaptor::PoolingNwcMaxUnsignedOpAdaptor(PoolingNwcMaxUnsignedOp op) : PoolingNwcMaxUnsignedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNwcMaxUnsignedOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_max_unsigned' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_max_unsigned' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair PoolingNwcMaxUnsignedOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNwcMaxUnsignedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNwcMaxUnsignedOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNwcMaxUnsignedOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNwcMaxUnsignedOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNwcMaxUnsignedOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNwcMaxUnsignedOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNwcMaxUnsignedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNwcMaxUnsignedOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNwcMaxUnsignedOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNwcMaxUnsignedOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNwcMaxUnsignedOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNwcMaxUnsignedOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNwcMaxUnsignedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNwcMaxUnsignedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNwcMaxUnsignedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNwcMaxUnsignedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcMaxUnsignedOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNwcMaxUnsignedOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxUnsignedOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxUnsignedOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxUnsignedOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNwcMaxUnsignedOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void PoolingNwcMaxUnsignedOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNwcMaxUnsignedOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNwcMaxUnsignedOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNwcMaxUnsignedOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNwcMaxUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNwcMaxUnsignedOp::getRegionBuilder()); + +} + +void PoolingNwcMaxUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcMaxUnsignedOp::getRegionBuilder()); + +} + +void PoolingNwcMaxUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNwcMaxUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcMaxUnsignedOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNwcMaxUnsignedOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcMaxUnsignedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMaxUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcMinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNwcMinOpGenericAdaptorBase::PoolingNwcMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nwc_min", odsAttrs.getContext()); +} + +PoolingNwcMinOpGenericAdaptorBase::PoolingNwcMinOpGenericAdaptorBase(PoolingNwcMinOp op) : PoolingNwcMinOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNwcMinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNwcMinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNwcMinOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNwcMinOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNwcMinOpAdaptor::PoolingNwcMinOpAdaptor(PoolingNwcMinOp op) : PoolingNwcMinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNwcMinOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_min' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_min' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair PoolingNwcMinOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNwcMinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNwcMinOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNwcMinOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNwcMinOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNwcMinOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNwcMinOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNwcMinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNwcMinOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNwcMinOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNwcMinOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNwcMinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNwcMinOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNwcMinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNwcMinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNwcMinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNwcMinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcMinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNwcMinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNwcMinOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNwcMinOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNwcMinOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void PoolingNwcMinOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNwcMinOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNwcMinOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNwcMinOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNwcMinOp::getRegionBuilder()); + +} + +void PoolingNwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcMinOp::getRegionBuilder()); + +} + +void PoolingNwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNwcMinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcMinOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNwcMinOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcMinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMinOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcMinUnsignedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNwcMinUnsignedOpGenericAdaptorBase::PoolingNwcMinUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nwc_min_unsigned", odsAttrs.getContext()); +} + +PoolingNwcMinUnsignedOpGenericAdaptorBase::PoolingNwcMinUnsignedOpGenericAdaptorBase(PoolingNwcMinUnsignedOp op) : PoolingNwcMinUnsignedOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNwcMinUnsignedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNwcMinUnsignedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinUnsignedOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinUnsignedOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinUnsignedOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinUnsignedOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNwcMinUnsignedOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNwcMinUnsignedOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNwcMinUnsignedOpAdaptor::PoolingNwcMinUnsignedOpAdaptor(PoolingNwcMinUnsignedOp op) : PoolingNwcMinUnsignedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNwcMinUnsignedOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_min_unsigned' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_min_unsigned' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair PoolingNwcMinUnsignedOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNwcMinUnsignedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNwcMinUnsignedOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNwcMinUnsignedOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNwcMinUnsignedOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNwcMinUnsignedOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNwcMinUnsignedOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNwcMinUnsignedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNwcMinUnsignedOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNwcMinUnsignedOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNwcMinUnsignedOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNwcMinUnsignedOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNwcMinUnsignedOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNwcMinUnsignedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNwcMinUnsignedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNwcMinUnsignedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNwcMinUnsignedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcMinUnsignedOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNwcMinUnsignedOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNwcMinUnsignedOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNwcMinUnsignedOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcMinUnsignedOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNwcMinUnsignedOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void PoolingNwcMinUnsignedOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNwcMinUnsignedOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNwcMinUnsignedOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNwcMinUnsignedOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNwcMinUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNwcMinUnsignedOp::getRegionBuilder()); + +} + +void PoolingNwcMinUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcMinUnsignedOp::getRegionBuilder()); + +} + +void PoolingNwcMinUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNwcMinUnsignedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcMinUnsignedOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNwcMinUnsignedOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcMinUnsignedOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMinUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcSumOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PoolingNwcSumOpGenericAdaptorBase::PoolingNwcSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.pooling_nwc_sum", odsAttrs.getContext()); +} + +PoolingNwcSumOpGenericAdaptorBase::PoolingNwcSumOpGenericAdaptorBase(PoolingNwcSumOp op) : PoolingNwcSumOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PoolingNwcSumOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PoolingNwcSumOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr PoolingNwcSumOpGenericAdaptorBase::getStridesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcSumOpGenericAdaptorBase::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcSumOpGenericAdaptorBase::getDilationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); + if (!attr) + attr = ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcSumOpGenericAdaptorBase::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder(odsAttrs.getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::Region &PoolingNwcSumOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PoolingNwcSumOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PoolingNwcSumOpAdaptor::PoolingNwcSumOpAdaptor(PoolingNwcSumOp op) : PoolingNwcSumOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PoolingNwcSumOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (tblgen_strides && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_strides))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_strides).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_sum' op ""attribute 'strides' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + + if (tblgen_dilations && !((((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_dilations))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getElementType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_dilations).getType().getShape() == ::mlir::ArrayRef({1}))))) + return emitError(loc, "'linalg.pooling_nwc_sum' op ""attribute 'dilations' failed to satisfy constraint: 64-bit signless int elements attribute of shape [1]"); + return ::mlir::success(); +} + +std::pair PoolingNwcSumOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PoolingNwcSumOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range PoolingNwcSumOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range PoolingNwcSumOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange PoolingNwcSumOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PoolingNwcSumOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PoolingNwcSumOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range PoolingNwcSumOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range PoolingNwcSumOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &PoolingNwcSumOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PoolingNwcSumOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dilations; + auto attr = dict.get("dilations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dilations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dilations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.strides; + auto attr = dict.get("strides"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PoolingNwcSumOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dilations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dilations", + propStorage)); + } + + { + const auto &propStorage = prop.strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PoolingNwcSumOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dilations.getAsOpaquePointer()), + llvm::hash_value(prop.strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PoolingNwcSumOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dilations") + return prop.dilations; + + if (name == "strides") + return prop.strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PoolingNwcSumOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dilations") { + prop.dilations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "strides") { + prop.strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PoolingNwcSumOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dilations) attrs.append("dilations", prop.dilations); + + if (prop.strides) attrs.append("strides", prop.strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PoolingNwcSumOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDilationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "dilations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(attr, "strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcSumOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dilations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PoolingNwcSumOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dilations); + + writer.writeOptionalAttribute(prop.strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseIntElementsAttr PoolingNwcSumOp::getStridesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); +} + +::mlir::DenseIntElementsAttr PoolingNwcSumOp::getStrides() { + auto attr = getStridesAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +::mlir::DenseIntElementsAttr PoolingNwcSumOp::getDilationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); +} + +::mlir::DenseIntElementsAttr PoolingNwcSumOp::getDilations() { + auto attr = getDilationsAttr(); + if (!attr) + return ::mlir::DenseIntElementsAttr::get(::mlir::RankedTensorType::get({1}, ::mlir::Builder((*this)->getContext()).getIntegerType(64)), ::llvm::ArrayRef({ static_cast(1) })); + return attr; +} + +void PoolingNwcSumOp::setStridesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getStridesAttrName(), attr); +} + +void PoolingNwcSumOp::setDilationsAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getDilationsAttrName(), attr); +} + +::mlir::Attribute PoolingNwcSumOp::removeStridesAttr() { + auto &attr = getProperties().strides; + attr = {}; + return attr; +} + +::mlir::Attribute PoolingNwcSumOp::removeDilationsAttr() { + auto &attr = getProperties().dilations; + attr = {}; + return attr; +} + +void PoolingNwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, PoolingNwcSumOp::getRegionBuilder()); + +} + +void PoolingNwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, PoolingNwcSumOp::getRegionBuilder()); + +} + +void PoolingNwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +void PoolingNwcSumOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes) { + odsState.addAttribute("strides", strides); +odsState.addAttribute("dilations", dilations); + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, inputs, outputs, + attributes, PoolingNwcSumOp::getRegionBuilder()); + +} + +::mlir::LogicalResult PoolingNwcSumOp::verifyInvariantsImpl() { + auto tblgen_dilations = getProperties().dilations; (void)tblgen_dilations; + auto tblgen_strides = getProperties().strides; (void)tblgen_strides; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_strides, "strides"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps1(*this, tblgen_dilations, "dilations"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PoolingNwcSumOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::QuantizedBatchMatmulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +QuantizedBatchMatmulOpGenericAdaptorBase::QuantizedBatchMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.quantized_batch_matmul", odsAttrs.getContext()); +} + +QuantizedBatchMatmulOpGenericAdaptorBase::QuantizedBatchMatmulOpGenericAdaptorBase(QuantizedBatchMatmulOp op) : QuantizedBatchMatmulOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair QuantizedBatchMatmulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr QuantizedBatchMatmulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &QuantizedBatchMatmulOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange QuantizedBatchMatmulOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +QuantizedBatchMatmulOpAdaptor::QuantizedBatchMatmulOpAdaptor(QuantizedBatchMatmulOp op) : QuantizedBatchMatmulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult QuantizedBatchMatmulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair QuantizedBatchMatmulOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range QuantizedBatchMatmulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range QuantizedBatchMatmulOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range QuantizedBatchMatmulOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange QuantizedBatchMatmulOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange QuantizedBatchMatmulOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair QuantizedBatchMatmulOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range QuantizedBatchMatmulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range QuantizedBatchMatmulOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &QuantizedBatchMatmulOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult QuantizedBatchMatmulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute QuantizedBatchMatmulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code QuantizedBatchMatmulOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional QuantizedBatchMatmulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void QuantizedBatchMatmulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void QuantizedBatchMatmulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult QuantizedBatchMatmulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult QuantizedBatchMatmulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void QuantizedBatchMatmulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void QuantizedBatchMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, QuantizedBatchMatmulOp::getRegionBuilder()); + +} + +void QuantizedBatchMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, QuantizedBatchMatmulOp::getRegionBuilder()); + +} + +void QuantizedBatchMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult QuantizedBatchMatmulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult QuantizedBatchMatmulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::QuantizedBatchMatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::QuantizedMatmulOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +QuantizedMatmulOpGenericAdaptorBase::QuantizedMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.quantized_matmul", odsAttrs.getContext()); +} + +QuantizedMatmulOpGenericAdaptorBase::QuantizedMatmulOpGenericAdaptorBase(QuantizedMatmulOp op) : QuantizedMatmulOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair QuantizedMatmulOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr QuantizedMatmulOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &QuantizedMatmulOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange QuantizedMatmulOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +QuantizedMatmulOpAdaptor::QuantizedMatmulOpAdaptor(QuantizedMatmulOp op) : QuantizedMatmulOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult QuantizedMatmulOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair QuantizedMatmulOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range QuantizedMatmulOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range QuantizedMatmulOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range QuantizedMatmulOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange QuantizedMatmulOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange QuantizedMatmulOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair QuantizedMatmulOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range QuantizedMatmulOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range QuantizedMatmulOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &QuantizedMatmulOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult QuantizedMatmulOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute QuantizedMatmulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code QuantizedMatmulOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional QuantizedMatmulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void QuantizedMatmulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void QuantizedMatmulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult QuantizedMatmulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult QuantizedMatmulOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void QuantizedMatmulOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void QuantizedMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, QuantizedMatmulOp::getRegionBuilder()); + +} + +void QuantizedMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, QuantizedMatmulOp::getRegionBuilder()); + +} + +void QuantizedMatmulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult QuantizedMatmulOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult QuantizedMatmulOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::QuantizedMatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::ReduceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReduceOpGenericAdaptorBase::ReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.reduce", odsAttrs.getContext()); +} + +ReduceOpGenericAdaptorBase::ReduceOpGenericAdaptorBase(ReduceOp op) : ReduceOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReduceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 2; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ReduceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI64ArrayAttr ReduceOpGenericAdaptorBase::getDimensionsAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().dimensions); + return attr; +} + +::llvm::ArrayRef ReduceOpGenericAdaptorBase::getDimensions() { + auto attr = getDimensionsAttr(); + return attr; +} + +::mlir::Region &ReduceOpGenericAdaptorBase::getCombiner() { + return *odsRegions[0]; +} + +::mlir::RegionRange ReduceOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ReduceOpAdaptor::ReduceOpAdaptor(ReduceOp op) : ReduceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReduceOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dimensions = getProperties().dimensions; (void)tblgen_dimensions; + if (!tblgen_dimensions) return emitError(loc, "'linalg.reduce' op ""requires attribute 'dimensions'"); + + if (tblgen_dimensions && !(((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_dimensions))) && (((llvm::is_sorted(::llvm::cast(tblgen_dimensions).asArrayRef()))) && (([](::llvm::ArrayRef a) { +return std::adjacent_find(std::begin(a), std::end(a)) == std::end(a); +}(::llvm::cast(tblgen_dimensions).asArrayRef())))))) + return emitError(loc, "'linalg.reduce' op ""attribute 'dimensions' failed to satisfy constraint: i64 dense array attribute should be in increasing order"); + return ::mlir::success(); +} + +std::pair ReduceOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 2; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ReduceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ReduceOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range ReduceOp::getInits() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange ReduceOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::MutableOperandRange ReduceOp::getInitsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ReduceOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range ReduceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &ReduceOp::getCombiner() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult ReduceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dimensions; + auto attr = dict.get("dimensions"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dimensions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dimensions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ReduceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dimensions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dimensions", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ReduceOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.dimensions.getAsOpaquePointer())); +} + +std::optional ReduceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dimensions") + return prop.dimensions; + return std::nullopt; +} + +void ReduceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dimensions") { + prop.dimensions = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ReduceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dimensions) attrs.append("dimensions", prop.dimensions); +} + +::mlir::LogicalResult ReduceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDimensionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps10(attr, "dimensions", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReduceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.dimensions))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReduceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.dimensions); +} + +::mlir::DenseI64ArrayAttr ReduceOp::getDimensionsAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().dimensions); +} + +::llvm::ArrayRef ReduceOp::getDimensions() { + auto attr = getDimensionsAttr(); + return attr; +} + +void ReduceOp::setDimensionsAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getDimensionsAttrName(), attr); +} + +void ReduceOp::setDimensions(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getDimensionsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +void ReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::mlir::DenseI64ArrayAttr dimensions) { + odsState.addOperands(inputs); + odsState.addOperands(inits); + odsState.getOrAddProperties().dimensions = dimensions; + (void)odsState.addRegion(); + odsState.addTypes(resultType0); +} + +void ReduceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::llvm::ArrayRef dimensions) { + odsState.addOperands(inputs); + odsState.addOperands(inits); + odsState.getOrAddProperties().dimensions = odsBuilder.getDenseI64ArrayAttr(dimensions); + (void)odsState.addRegion(); + odsState.addTypes(resultType0); +} + +void ReduceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReduceOp::verifyInvariantsImpl() { + auto tblgen_dimensions = getProperties().dimensions; (void)tblgen_dimensions; + if (!tblgen_dimensions) return emitOpError("requires attribute 'dimensions'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps10(*this, tblgen_dimensions, "dimensions"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps1(*this, region, "combiner", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReduceOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::ReduceOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::SubOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.sub", odsAttrs.getContext()); +} + +SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(SubOp op) : SubOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SubOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &SubOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange SubOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +SubOpAdaptor::SubOpAdaptor(SubOp op) : SubOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SubOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SubOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SubOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range SubOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange SubOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SubOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair SubOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range SubOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range SubOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &SubOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult SubOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SubOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult SubOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SubOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, SubOp::getRegionBuilder()); + +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, SubOp::getRegionBuilder()); + +} + +void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult SubOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::SubOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::TransposeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TransposeOpGenericAdaptorBase::TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.transpose", odsAttrs.getContext()); +} + +TransposeOpGenericAdaptorBase::TransposeOpGenericAdaptorBase(TransposeOp op) : TransposeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TransposeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TransposeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI64ArrayAttr TransposeOpGenericAdaptorBase::getPermutationAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().permutation); + return attr; +} + +::llvm::ArrayRef TransposeOpGenericAdaptorBase::getPermutation() { + auto attr = getPermutationAttr(); + return attr; +} + +::mlir::Region &TransposeOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange TransposeOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +TransposeOpAdaptor::TransposeOpAdaptor(TransposeOp op) : TransposeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TransposeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_permutation = getProperties().permutation; (void)tblgen_permutation; + if (!tblgen_permutation) return emitError(loc, "'linalg.transpose' op ""requires attribute 'permutation'"); + + if (tblgen_permutation && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_permutation)))) + return emitError(loc, "'linalg.transpose' op ""attribute 'permutation' failed to satisfy constraint: i64 dense array attribute"); + return ::mlir::success(); +} + +std::pair TransposeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TransposeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ShapedType> TransposeOp::getInput() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::ShapedType> TransposeOp::getInit() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &TransposeOp::getInputMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &TransposeOp::getInitMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair TransposeOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range TransposeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range TransposeOp::getResult() { + return getODSResults(0); +} + +::mlir::Region &TransposeOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult TransposeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.permutation; + auto attr = dict.get("permutation"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for permutation in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `permutation` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TransposeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.permutation; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("permutation", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TransposeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.permutation.getAsOpaquePointer())); +} + +std::optional TransposeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "permutation") + return prop.permutation; + return std::nullopt; +} + +void TransposeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "permutation") { + prop.permutation = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TransposeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.permutation) attrs.append("permutation", prop.permutation); +} + +::mlir::LogicalResult TransposeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPermutationAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps0(attr, "permutation", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TransposeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.permutation))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TransposeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.permutation); +} + +::mlir::DenseI64ArrayAttr TransposeOp::getPermutationAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().permutation); +} + +::llvm::ArrayRef TransposeOp::getPermutation() { + auto attr = getPermutationAttr(); + return attr; +} + +void TransposeOp::setPermutationAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getPermutationAttrName(), attr); +} + +void TransposeOp::setPermutation(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getPermutationAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +::mlir::LogicalResult TransposeOp::verifyInvariantsImpl() { + auto tblgen_permutation = getProperties().permutation; (void)tblgen_permutation; + if (!tblgen_permutation) return emitOpError("requires attribute 'permutation'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgStructuredOps0(*this, tblgen_permutation, "permutation"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TransposeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::TransposeOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::VecmatOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +VecmatOpGenericAdaptorBase::VecmatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("linalg.vecmat", odsAttrs.getContext()); +} + +VecmatOpGenericAdaptorBase::VecmatOpGenericAdaptorBase(VecmatOp op) : VecmatOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair VecmatOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr VecmatOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &VecmatOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange VecmatOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +VecmatOpAdaptor::VecmatOpAdaptor(VecmatOp op) : VecmatOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult VecmatOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair VecmatOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range VecmatOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range VecmatOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range VecmatOp::getOutputs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange VecmatOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange VecmatOp::getOutputsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair VecmatOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range VecmatOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range VecmatOp::getResultTensors() { + return getODSResults(0); +} + +::mlir::Region &VecmatOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult VecmatOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute VecmatOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code VecmatOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional VecmatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void VecmatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void VecmatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult VecmatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult VecmatOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void VecmatOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void VecmatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, + attributes, VecmatOp::getRegionBuilder()); + +} + +void VecmatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes) { + buildStructuredOp(odsBuilder, odsState, resultTensorTypes, + inputs, outputs, attributes, VecmatOp::getRegionBuilder()); + +} + +void VecmatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTensorTypes); + (void)odsState.addRegion(); + +} + +::mlir::LogicalResult VecmatOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgStructuredOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_LinalgStructuredOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult VecmatOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace linalg +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::linalg::VecmatOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..18e28f608280c5d3ca477eb8cd996b5b03267a3f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc @@ -0,0 +1,18355 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: LinalgStructuredOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace linalg { +class AbsOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class AddOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class BatchMatmulOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class BatchMatmulTransposeAOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class BatchMatmulTransposeBOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class BatchMatvecOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class BatchMmt4DOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class BatchReduceMatmulOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class BroadcastOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class CeilOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv1DNcwFcwOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv1DNwcWcfOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv1DOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv2DNchwFchwOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv2DNgchwFgchwOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv2DNhwcFhwcOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv2DNhwcFhwcQOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv2DNhwcHwcfOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv2DNhwcHwcfQOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv2DOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv3DNcdhwFcdhwOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv3DNdhwcDhwcfOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv3DNdhwcDhwcfQOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Conv3DOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class CopyOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv1DNcwCwOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv1DNwcWcOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv1DNwcWcmOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv2DNchwChwOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv2DNhwcHwcOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv2DNhwcHwcQOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv2DNhwcHwcmOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv2DNhwcHwcmQOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv3DNcdhwCdhwOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv3DNdhwcDhwcOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DepthwiseConv3DNdhwcDhwcmOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DivOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DivUnsignedOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class DotOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class ElemwiseBinaryOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class ElemwiseUnaryOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class ExpOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class FillOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class FillRng2DOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class FloorOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class GenericOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class LogOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class MapOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class MatmulOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class MatmulTransposeAOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class MatmulTransposeBOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class MatmulUnsignedOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class MatvecOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class MaxOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class Mmt4DOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class MulOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class NegfOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNchwMaxOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNchwSumOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNcwMaxOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNcwSumOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNdhwcMaxOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNdhwcMinOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNdhwcSumOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNhwcMaxOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNhwcMaxUnsignedOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNhwcMinOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNhwcMinUnsignedOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNhwcSumOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNwcMaxOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNwcMaxUnsignedOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNwcMinOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNwcMinUnsignedOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class PoolingNwcSumOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class QuantizedBatchMatmulOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class QuantizedMatmulOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class ReduceOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class SubOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class TransposeOp; +} // namespace linalg +} // namespace mlir +namespace mlir { +namespace linalg { +class VecmatOp; +} // namespace linalg +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::AbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AbsOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AbsOpGenericAdaptorBase(AbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AbsOpGenericAdaptor : public detail::AbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AbsOpGenericAdaptorBase; +public: + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AbsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AbsOpAdaptor : public AbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using AbsOpGenericAdaptor::AbsOpGenericAdaptor; + AbsOpAdaptor(AbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AbsOpAdaptor; + template + using GenericAdaptor = AbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.abs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::AbsOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::AddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AddOpGenericAdaptorBase(AddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddOpGenericAdaptorBase; +public: + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddOpGenericAdaptor::AddOpGenericAdaptor; + AddOpAdaptor(AddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddOpAdaptor; + template + using GenericAdaptor = AddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::AddOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMatmulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatmulOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BatchMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatmulOpGenericAdaptorBase(BatchMatmulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class BatchMatmulOpGenericAdaptor : public detail::BatchMatmulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatmulOpGenericAdaptorBase; +public: + BatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BatchMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatmulOpAdaptor : public BatchMatmulOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatmulOpGenericAdaptor::BatchMatmulOpGenericAdaptor; + BatchMatmulOpAdaptor(BatchMatmulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatmulOpAdaptor; + template + using GenericAdaptor = BatchMatmulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.batch_matmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMatmulTransposeAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatmulTransposeAOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BatchMatmulTransposeAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatmulTransposeAOpGenericAdaptorBase(BatchMatmulTransposeAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class BatchMatmulTransposeAOpGenericAdaptor : public detail::BatchMatmulTransposeAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatmulTransposeAOpGenericAdaptorBase; +public: + BatchMatmulTransposeAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatmulTransposeAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatmulTransposeAOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BatchMatmulTransposeAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatmulTransposeAOpAdaptor : public BatchMatmulTransposeAOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatmulTransposeAOpGenericAdaptor::BatchMatmulTransposeAOpGenericAdaptor; + BatchMatmulTransposeAOpAdaptor(BatchMatmulTransposeAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatmulTransposeAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatmulTransposeAOpAdaptor; + template + using GenericAdaptor = BatchMatmulTransposeAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.batch_matmul_transpose_a"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatmulTransposeAOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMatmulTransposeBOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatmulTransposeBOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BatchMatmulTransposeBOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatmulTransposeBOpGenericAdaptorBase(BatchMatmulTransposeBOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class BatchMatmulTransposeBOpGenericAdaptor : public detail::BatchMatmulTransposeBOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatmulTransposeBOpGenericAdaptorBase; +public: + BatchMatmulTransposeBOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatmulTransposeBOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatmulTransposeBOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BatchMatmulTransposeBOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatmulTransposeBOpAdaptor : public BatchMatmulTransposeBOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatmulTransposeBOpGenericAdaptor::BatchMatmulTransposeBOpGenericAdaptor; + BatchMatmulTransposeBOpAdaptor(BatchMatmulTransposeBOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatmulTransposeBOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatmulTransposeBOpAdaptor; + template + using GenericAdaptor = BatchMatmulTransposeBOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.batch_matmul_transpose_b"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatmulTransposeBOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMatvecOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatvecOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BatchMatvecOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatvecOpGenericAdaptorBase(BatchMatvecOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class BatchMatvecOpGenericAdaptor : public detail::BatchMatvecOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatvecOpGenericAdaptorBase; +public: + BatchMatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatvecOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BatchMatvecOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatvecOpAdaptor : public BatchMatvecOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatvecOpGenericAdaptor::BatchMatvecOpGenericAdaptor; + BatchMatvecOpAdaptor(BatchMatvecOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatvecOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatvecOpAdaptor; + template + using GenericAdaptor = BatchMatvecOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.batch_matvec"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatvecOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchMmt4DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMmt4DOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BatchMmt4DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMmt4DOpGenericAdaptorBase(BatchMmt4DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class BatchMmt4DOpGenericAdaptor : public detail::BatchMmt4DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMmt4DOpGenericAdaptorBase; +public: + BatchMmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMmt4DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BatchMmt4DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMmt4DOpAdaptor : public BatchMmt4DOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMmt4DOpGenericAdaptor::BatchMmt4DOpGenericAdaptor; + BatchMmt4DOpAdaptor(BatchMmt4DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMmt4DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMmt4DOpAdaptor; + template + using GenericAdaptor = BatchMmt4DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.batch_mmt4d"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMmt4DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BatchReduceMatmulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchReduceMatmulOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BatchReduceMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchReduceMatmulOpGenericAdaptorBase(BatchReduceMatmulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class BatchReduceMatmulOpGenericAdaptor : public detail::BatchReduceMatmulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchReduceMatmulOpGenericAdaptorBase; +public: + BatchReduceMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchReduceMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchReduceMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BatchReduceMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchReduceMatmulOpAdaptor : public BatchReduceMatmulOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchReduceMatmulOpGenericAdaptor::BatchReduceMatmulOpGenericAdaptor; + BatchReduceMatmulOpAdaptor(BatchReduceMatmulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchReduceMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchReduceMatmulOpAdaptor; + template + using GenericAdaptor = BatchReduceMatmulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.batch_reduce_matmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchReduceMatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::BroadcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastOpGenericAdaptorBase { +public: + struct Properties { + using dimensionsTy = ::mlir::DenseI64ArrayAttr; + dimensionsTy dimensions; + + auto getDimensions() { + auto &propStorage = this->dimensions; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setDimensions(const ::mlir::DenseI64ArrayAttr &propValue) { + this->dimensions = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dimensions == this->dimensions && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + BroadcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastOpGenericAdaptorBase(BroadcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI64ArrayAttr getDimensionsAttr(); + ::llvm::ArrayRef getDimensions(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class BroadcastOpGenericAdaptor : public detail::BroadcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastOpGenericAdaptorBase; +public: + BroadcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + BroadcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInit() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastOpAdaptor : public BroadcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastOpGenericAdaptor::BroadcastOpGenericAdaptor; + BroadcastOpAdaptor(BroadcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastOpAdaptor; + template + using GenericAdaptor = BroadcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.broadcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ShapedType> getInput(); + ::mlir::TypedValue<::mlir::ShapedType> getInit(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInitMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResult(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI64ArrayAttr getDimensionsAttr(); + ::llvm::ArrayRef getDimensions(); + void setDimensionsAttr(::mlir::DenseI64ArrayAttr attr); + void setDimensions(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value init, DenseI64ArrayAttr dimensions, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value init, ArrayRef dimensions, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Declare functions necessary for LinalgStructuredInterface. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + std::string getLibraryCallName() { + return "op_has_no_registered_library_name"; + } + + // Implement functions necessary for DestinationStyleOpInterface. + MutableOperandRange getDpsInitsMutable() { return getInitMutable(); } + + static std::function)> + getRegionBuilder() { + return nullptr; + } +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BroadcastOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::CeilOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilOpGenericAdaptorBase(CeilOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class CeilOpGenericAdaptor : public detail::CeilOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilOpGenericAdaptorBase; +public: + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CeilOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilOpAdaptor : public CeilOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilOpGenericAdaptor::CeilOpGenericAdaptor; + CeilOpAdaptor(CeilOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilOpAdaptor; + template + using GenericAdaptor = CeilOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.ceil"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::CeilOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv1DNcwFcwOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv1DNcwFcwOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv1DNcwFcwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv1DNcwFcwOpGenericAdaptorBase(Conv1DNcwFcwOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv1DNcwFcwOpGenericAdaptor : public detail::Conv1DNcwFcwOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv1DNcwFcwOpGenericAdaptorBase; +public: + Conv1DNcwFcwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv1DNcwFcwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv1DNcwFcwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv1DNcwFcwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv1DNcwFcwOpAdaptor : public Conv1DNcwFcwOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv1DNcwFcwOpGenericAdaptor::Conv1DNcwFcwOpGenericAdaptor; + Conv1DNcwFcwOpAdaptor(Conv1DNcwFcwOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv1DNcwFcwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv1DNcwFcwOpAdaptor; + template + using GenericAdaptor = Conv1DNcwFcwOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_1d_ncw_fcw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv1DNcwFcwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv1DNwcWcfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv1DNwcWcfOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv1DNwcWcfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv1DNwcWcfOpGenericAdaptorBase(Conv1DNwcWcfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv1DNwcWcfOpGenericAdaptor : public detail::Conv1DNwcWcfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv1DNwcWcfOpGenericAdaptorBase; +public: + Conv1DNwcWcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv1DNwcWcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv1DNwcWcfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv1DNwcWcfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv1DNwcWcfOpAdaptor : public Conv1DNwcWcfOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv1DNwcWcfOpGenericAdaptor::Conv1DNwcWcfOpGenericAdaptor; + Conv1DNwcWcfOpAdaptor(Conv1DNwcWcfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv1DNwcWcfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv1DNwcWcfOpAdaptor; + template + using GenericAdaptor = Conv1DNwcWcfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_1d_nwc_wcf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv1DNwcWcfOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv1DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv1DOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv1DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv1DOpGenericAdaptorBase(Conv1DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv1DOpGenericAdaptor : public detail::Conv1DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv1DOpGenericAdaptorBase; +public: + Conv1DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv1DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv1DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv1DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv1DOpAdaptor : public Conv1DOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv1DOpGenericAdaptor::Conv1DOpGenericAdaptor; + Conv1DOpAdaptor(Conv1DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv1DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv1DOpAdaptor; + template + using GenericAdaptor = Conv1DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_1d"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv1DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNchwFchwOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DNchwFchwOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv2DNchwFchwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DNchwFchwOpGenericAdaptorBase(Conv2DNchwFchwOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv2DNchwFchwOpGenericAdaptor : public detail::Conv2DNchwFchwOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DNchwFchwOpGenericAdaptorBase; +public: + Conv2DNchwFchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DNchwFchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DNchwFchwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv2DNchwFchwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DNchwFchwOpAdaptor : public Conv2DNchwFchwOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DNchwFchwOpGenericAdaptor::Conv2DNchwFchwOpGenericAdaptor; + Conv2DNchwFchwOpAdaptor(Conv2DNchwFchwOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DNchwFchwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DNchwFchwOpAdaptor; + template + using GenericAdaptor = Conv2DNchwFchwOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_2d_nchw_fchw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNchwFchwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNgchwFgchwOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DNgchwFgchwOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv2DNgchwFgchwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DNgchwFgchwOpGenericAdaptorBase(Conv2DNgchwFgchwOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv2DNgchwFgchwOpGenericAdaptor : public detail::Conv2DNgchwFgchwOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DNgchwFgchwOpGenericAdaptorBase; +public: + Conv2DNgchwFgchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DNgchwFgchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DNgchwFgchwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv2DNgchwFgchwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DNgchwFgchwOpAdaptor : public Conv2DNgchwFgchwOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DNgchwFgchwOpGenericAdaptor::Conv2DNgchwFgchwOpGenericAdaptor; + Conv2DNgchwFgchwOpAdaptor(Conv2DNgchwFgchwOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DNgchwFgchwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DNgchwFgchwOpAdaptor; + template + using GenericAdaptor = Conv2DNgchwFgchwOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_2d_ngchw_fgchw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNgchwFgchwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNhwcFhwcOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DNhwcFhwcOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv2DNhwcFhwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DNhwcFhwcOpGenericAdaptorBase(Conv2DNhwcFhwcOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv2DNhwcFhwcOpGenericAdaptor : public detail::Conv2DNhwcFhwcOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DNhwcFhwcOpGenericAdaptorBase; +public: + Conv2DNhwcFhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DNhwcFhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DNhwcFhwcOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv2DNhwcFhwcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DNhwcFhwcOpAdaptor : public Conv2DNhwcFhwcOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DNhwcFhwcOpGenericAdaptor::Conv2DNhwcFhwcOpGenericAdaptor; + Conv2DNhwcFhwcOpAdaptor(Conv2DNhwcFhwcOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DNhwcFhwcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DNhwcFhwcOpAdaptor; + template + using GenericAdaptor = Conv2DNhwcFhwcOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_2d_nhwc_fhwc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcFhwcOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNhwcFhwcQOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DNhwcFhwcQOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv2DNhwcFhwcQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DNhwcFhwcQOpGenericAdaptorBase(Conv2DNhwcFhwcQOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv2DNhwcFhwcQOpGenericAdaptor : public detail::Conv2DNhwcFhwcQOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DNhwcFhwcQOpGenericAdaptorBase; +public: + Conv2DNhwcFhwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DNhwcFhwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DNhwcFhwcQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv2DNhwcFhwcQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DNhwcFhwcQOpAdaptor : public Conv2DNhwcFhwcQOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DNhwcFhwcQOpGenericAdaptor::Conv2DNhwcFhwcQOpGenericAdaptor; + Conv2DNhwcFhwcQOpAdaptor(Conv2DNhwcFhwcQOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DNhwcFhwcQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DNhwcFhwcQOpAdaptor; + template + using GenericAdaptor = Conv2DNhwcFhwcQOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_2d_nhwc_fhwc_q"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcFhwcQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNhwcHwcfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DNhwcHwcfOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv2DNhwcHwcfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DNhwcHwcfOpGenericAdaptorBase(Conv2DNhwcHwcfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv2DNhwcHwcfOpGenericAdaptor : public detail::Conv2DNhwcHwcfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DNhwcHwcfOpGenericAdaptorBase; +public: + Conv2DNhwcHwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DNhwcHwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DNhwcHwcfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv2DNhwcHwcfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DNhwcHwcfOpAdaptor : public Conv2DNhwcHwcfOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DNhwcHwcfOpGenericAdaptor::Conv2DNhwcHwcfOpGenericAdaptor; + Conv2DNhwcHwcfOpAdaptor(Conv2DNhwcHwcfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DNhwcHwcfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DNhwcHwcfOpAdaptor; + template + using GenericAdaptor = Conv2DNhwcHwcfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_2d_nhwc_hwcf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcHwcfOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DNhwcHwcfQOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DNhwcHwcfQOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv2DNhwcHwcfQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DNhwcHwcfQOpGenericAdaptorBase(Conv2DNhwcHwcfQOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv2DNhwcHwcfQOpGenericAdaptor : public detail::Conv2DNhwcHwcfQOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DNhwcHwcfQOpGenericAdaptorBase; +public: + Conv2DNhwcHwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DNhwcHwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DNhwcHwcfQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv2DNhwcHwcfQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DNhwcHwcfQOpAdaptor : public Conv2DNhwcHwcfQOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DNhwcHwcfQOpGenericAdaptor::Conv2DNhwcHwcfQOpGenericAdaptor; + Conv2DNhwcHwcfQOpAdaptor(Conv2DNhwcHwcfQOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DNhwcHwcfQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DNhwcHwcfQOpAdaptor; + template + using GenericAdaptor = Conv2DNhwcHwcfQOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_2d_nhwc_hwcf_q"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcHwcfQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DOpGenericAdaptorBase(Conv2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv2DOpGenericAdaptor : public detail::Conv2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DOpGenericAdaptorBase; +public: + Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DOpAdaptor : public Conv2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DOpGenericAdaptor::Conv2DOpGenericAdaptor; + Conv2DOpAdaptor(Conv2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DOpAdaptor; + template + using GenericAdaptor = Conv2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_2d"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv3DNcdhwFcdhwOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DNcdhwFcdhwOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv3DNcdhwFcdhwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DNcdhwFcdhwOpGenericAdaptorBase(Conv3DNcdhwFcdhwOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv3DNcdhwFcdhwOpGenericAdaptor : public detail::Conv3DNcdhwFcdhwOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DNcdhwFcdhwOpGenericAdaptorBase; +public: + Conv3DNcdhwFcdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DNcdhwFcdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DNcdhwFcdhwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv3DNcdhwFcdhwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DNcdhwFcdhwOpAdaptor : public Conv3DNcdhwFcdhwOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DNcdhwFcdhwOpGenericAdaptor::Conv3DNcdhwFcdhwOpGenericAdaptor; + Conv3DNcdhwFcdhwOpAdaptor(Conv3DNcdhwFcdhwOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DNcdhwFcdhwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DNcdhwFcdhwOpAdaptor; + template + using GenericAdaptor = Conv3DNcdhwFcdhwOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_3d_ncdhw_fcdhw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DNcdhwFcdhwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv3DNdhwcDhwcfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DNdhwcDhwcfOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv3DNdhwcDhwcfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DNdhwcDhwcfOpGenericAdaptorBase(Conv3DNdhwcDhwcfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv3DNdhwcDhwcfOpGenericAdaptor : public detail::Conv3DNdhwcDhwcfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DNdhwcDhwcfOpGenericAdaptorBase; +public: + Conv3DNdhwcDhwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DNdhwcDhwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DNdhwcDhwcfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv3DNdhwcDhwcfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DNdhwcDhwcfOpAdaptor : public Conv3DNdhwcDhwcfOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DNdhwcDhwcfOpGenericAdaptor::Conv3DNdhwcDhwcfOpGenericAdaptor; + Conv3DNdhwcDhwcfOpAdaptor(Conv3DNdhwcDhwcfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DNdhwcDhwcfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DNdhwcDhwcfOpAdaptor; + template + using GenericAdaptor = Conv3DNdhwcDhwcfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_3d_ndhwc_dhwcf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DNdhwcDhwcfOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv3DNdhwcDhwcfQOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DNdhwcDhwcfQOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv3DNdhwcDhwcfQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DNdhwcDhwcfQOpGenericAdaptorBase(Conv3DNdhwcDhwcfQOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv3DNdhwcDhwcfQOpGenericAdaptor : public detail::Conv3DNdhwcDhwcfQOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DNdhwcDhwcfQOpGenericAdaptorBase; +public: + Conv3DNdhwcDhwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DNdhwcDhwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DNdhwcDhwcfQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv3DNdhwcDhwcfQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DNdhwcDhwcfQOpAdaptor : public Conv3DNdhwcDhwcfQOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DNdhwcDhwcfQOpGenericAdaptor::Conv3DNdhwcDhwcfQOpGenericAdaptor; + Conv3DNdhwcDhwcfQOpAdaptor(Conv3DNdhwcDhwcfQOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DNdhwcDhwcfQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DNdhwcDhwcfQOpAdaptor; + template + using GenericAdaptor = Conv3DNdhwcDhwcfQOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_3d_ndhwc_dhwcf_q"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DNdhwcDhwcfQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Conv3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Conv3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DOpGenericAdaptorBase(Conv3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Conv3DOpGenericAdaptor : public detail::Conv3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DOpGenericAdaptorBase; +public: + Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Conv3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DOpAdaptor : public Conv3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DOpGenericAdaptor::Conv3DOpGenericAdaptor; + Conv3DOpAdaptor(Conv3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DOpAdaptor; + template + using GenericAdaptor = Conv3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.conv_3d"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::CopyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CopyOpGenericAdaptorBase { +public: + struct Properties { + using castTy = ::mlir::linalg::TypeFnAttr; + castTy cast; + + auto getCast() { + auto &propStorage = this->cast; + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); + } + void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { + this->cast = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.cast == this->cast && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CopyOpGenericAdaptorBase(CopyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class CopyOpGenericAdaptor : public detail::CopyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CopyOpGenericAdaptorBase; +public: + CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CopyOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CopyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CopyOpAdaptor : public CopyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CopyOpGenericAdaptor::CopyOpGenericAdaptor; + CopyOpAdaptor(CopyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CopyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CopyOpAdaptor; + template + using GenericAdaptor = CopyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCastAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.copy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + void setCastAttr(::mlir::linalg::TypeFnAttr attr); + void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); + ::mlir::Attribute removeCastAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::CopyOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv1DNcwCwOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv1DNcwCwOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv1DNcwCwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv1DNcwCwOpGenericAdaptorBase(DepthwiseConv1DNcwCwOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv1DNcwCwOpGenericAdaptor : public detail::DepthwiseConv1DNcwCwOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv1DNcwCwOpGenericAdaptorBase; +public: + DepthwiseConv1DNcwCwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv1DNcwCwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv1DNcwCwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv1DNcwCwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv1DNcwCwOpAdaptor : public DepthwiseConv1DNcwCwOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv1DNcwCwOpGenericAdaptor::DepthwiseConv1DNcwCwOpGenericAdaptor; + DepthwiseConv1DNcwCwOpAdaptor(DepthwiseConv1DNcwCwOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv1DNcwCwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv1DNcwCwOpAdaptor; + template + using GenericAdaptor = DepthwiseConv1DNcwCwOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_1d_ncw_cw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv1DNcwCwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv1DNwcWcOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv1DNwcWcOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv1DNwcWcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv1DNwcWcOpGenericAdaptorBase(DepthwiseConv1DNwcWcOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv1DNwcWcOpGenericAdaptor : public detail::DepthwiseConv1DNwcWcOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv1DNwcWcOpGenericAdaptorBase; +public: + DepthwiseConv1DNwcWcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv1DNwcWcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv1DNwcWcOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv1DNwcWcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv1DNwcWcOpAdaptor : public DepthwiseConv1DNwcWcOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv1DNwcWcOpGenericAdaptor::DepthwiseConv1DNwcWcOpGenericAdaptor; + DepthwiseConv1DNwcWcOpAdaptor(DepthwiseConv1DNwcWcOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv1DNwcWcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv1DNwcWcOpAdaptor; + template + using GenericAdaptor = DepthwiseConv1DNwcWcOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_1d_nwc_wc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv1DNwcWcOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv1DNwcWcmOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv1DNwcWcmOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv1DNwcWcmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv1DNwcWcmOpGenericAdaptorBase(DepthwiseConv1DNwcWcmOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv1DNwcWcmOpGenericAdaptor : public detail::DepthwiseConv1DNwcWcmOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv1DNwcWcmOpGenericAdaptorBase; +public: + DepthwiseConv1DNwcWcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv1DNwcWcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv1DNwcWcmOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv1DNwcWcmOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv1DNwcWcmOpAdaptor : public DepthwiseConv1DNwcWcmOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv1DNwcWcmOpGenericAdaptor::DepthwiseConv1DNwcWcmOpGenericAdaptor; + DepthwiseConv1DNwcWcmOpAdaptor(DepthwiseConv1DNwcWcmOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv1DNwcWcmOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv1DNwcWcmOpAdaptor; + template + using GenericAdaptor = DepthwiseConv1DNwcWcmOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_1d_nwc_wcm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv1DNwcWcmOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNchwChwOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2DNchwChwOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2DNchwChwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2DNchwChwOpGenericAdaptorBase(DepthwiseConv2DNchwChwOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv2DNchwChwOpGenericAdaptor : public detail::DepthwiseConv2DNchwChwOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2DNchwChwOpGenericAdaptorBase; +public: + DepthwiseConv2DNchwChwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2DNchwChwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNchwChwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv2DNchwChwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2DNchwChwOpAdaptor : public DepthwiseConv2DNchwChwOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2DNchwChwOpGenericAdaptor::DepthwiseConv2DNchwChwOpGenericAdaptor; + DepthwiseConv2DNchwChwOpAdaptor(DepthwiseConv2DNchwChwOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2DNchwChwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2DNchwChwOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2DNchwChwOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nchw_chw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNchwChwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNhwcHwcOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2DNhwcHwcOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2DNhwcHwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2DNhwcHwcOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv2DNhwcHwcOpGenericAdaptor : public detail::DepthwiseConv2DNhwcHwcOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2DNhwcHwcOpGenericAdaptorBase; +public: + DepthwiseConv2DNhwcHwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2DNhwcHwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNhwcHwcOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv2DNhwcHwcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2DNhwcHwcOpAdaptor : public DepthwiseConv2DNhwcHwcOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2DNhwcHwcOpGenericAdaptor::DepthwiseConv2DNhwcHwcOpGenericAdaptor; + DepthwiseConv2DNhwcHwcOpAdaptor(DepthwiseConv2DNhwcHwcOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2DNhwcHwcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2DNhwcHwcOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2DNhwcHwcOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nhwc_hwc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNhwcHwcQOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcQOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv2DNhwcHwcQOpGenericAdaptor : public detail::DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase; +public: + DepthwiseConv2DNhwcHwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2DNhwcHwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNhwcHwcQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv2DNhwcHwcQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2DNhwcHwcQOpAdaptor : public DepthwiseConv2DNhwcHwcQOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2DNhwcHwcQOpGenericAdaptor::DepthwiseConv2DNhwcHwcQOpGenericAdaptor; + DepthwiseConv2DNhwcHwcQOpAdaptor(DepthwiseConv2DNhwcHwcQOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2DNhwcHwcQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2DNhwcHwcQOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2DNhwcHwcQOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nhwc_hwc_q"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNhwcHwcmOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcmOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv2DNhwcHwcmOpGenericAdaptor : public detail::DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase; +public: + DepthwiseConv2DNhwcHwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2DNhwcHwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNhwcHwcmOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv2DNhwcHwcmOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2DNhwcHwcmOpAdaptor : public DepthwiseConv2DNhwcHwcmOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2DNhwcHwcmOpGenericAdaptor::DepthwiseConv2DNhwcHwcmOpGenericAdaptor; + DepthwiseConv2DNhwcHwcmOpAdaptor(DepthwiseConv2DNhwcHwcmOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2DNhwcHwcmOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2DNhwcHwcmOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2DNhwcHwcmOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nhwc_hwcm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcmOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv2DNhwcHwcmQOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcmQOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv2DNhwcHwcmQOpGenericAdaptor : public detail::DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase; +public: + DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2DNhwcHwcmQOpAdaptor : public DepthwiseConv2DNhwcHwcmQOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2DNhwcHwcmQOpGenericAdaptor::DepthwiseConv2DNhwcHwcmQOpGenericAdaptor; + DepthwiseConv2DNhwcHwcmQOpAdaptor(DepthwiseConv2DNhwcHwcmQOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2DNhwcHwcmQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2DNhwcHwcmQOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2DNhwcHwcmQOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nhwc_hwcm_q"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcmQOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv3DNcdhwCdhwOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase(DepthwiseConv3DNcdhwCdhwOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv3DNcdhwCdhwOpGenericAdaptor : public detail::DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase; +public: + DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv3DNcdhwCdhwOpAdaptor : public DepthwiseConv3DNcdhwCdhwOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv3DNcdhwCdhwOpGenericAdaptor::DepthwiseConv3DNcdhwCdhwOpGenericAdaptor; + DepthwiseConv3DNcdhwCdhwOpAdaptor(DepthwiseConv3DNcdhwCdhwOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv3DNcdhwCdhwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv3DNcdhwCdhwOpAdaptor; + template + using GenericAdaptor = DepthwiseConv3DNcdhwCdhwOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_3d_ncdhw_cdhw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv3DNcdhwCdhwOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv3DNdhwcDhwcOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase(DepthwiseConv3DNdhwcDhwcOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv3DNdhwcDhwcOpGenericAdaptor : public detail::DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase; +public: + DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv3DNdhwcDhwcOpAdaptor : public DepthwiseConv3DNdhwcDhwcOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv3DNdhwcDhwcOpGenericAdaptor::DepthwiseConv3DNdhwcDhwcOpGenericAdaptor; + DepthwiseConv3DNdhwcDhwcOpAdaptor(DepthwiseConv3DNdhwcDhwcOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv3DNdhwcDhwcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv3DNdhwcDhwcOpAdaptor; + template + using GenericAdaptor = DepthwiseConv3DNdhwcDhwcOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_3d_ndhwc_dhwc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv3DNdhwcDhwcOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DepthwiseConv3DNdhwcDhwcmOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase(DepthwiseConv3DNdhwcDhwcmOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor : public detail::DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase; +public: + DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv3DNdhwcDhwcmOpAdaptor : public DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor::DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor; + DepthwiseConv3DNdhwcDhwcmOpAdaptor(DepthwiseConv3DNdhwcDhwcmOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv3DNdhwcDhwcmOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv3DNdhwcDhwcmOpAdaptor; + template + using GenericAdaptor = DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.depthwise_conv_3d_ndhwc_dhwcm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv3DNdhwcDhwcmOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DivOpGenericAdaptorBase(DivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DivOpGenericAdaptor : public detail::DivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivOpGenericAdaptorBase; +public: + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivOpAdaptor : public DivOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivOpGenericAdaptor::DivOpGenericAdaptor; + DivOpAdaptor(DivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivOpAdaptor; + template + using GenericAdaptor = DivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.div"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DivOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DivUnsignedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivUnsignedOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DivUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DivUnsignedOpGenericAdaptorBase(DivUnsignedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DivUnsignedOpGenericAdaptor : public detail::DivUnsignedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivUnsignedOpGenericAdaptorBase; +public: + DivUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DivUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivUnsignedOpAdaptor : public DivUnsignedOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivUnsignedOpGenericAdaptor::DivUnsignedOpGenericAdaptor; + DivUnsignedOpAdaptor(DivUnsignedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivUnsignedOpAdaptor; + template + using GenericAdaptor = DivUnsignedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.div_unsigned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DivUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::DotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DotOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DotOpGenericAdaptorBase(DotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DotOpGenericAdaptor : public detail::DotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DotOpGenericAdaptorBase; +public: + DotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DotOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DotOpAdaptor : public DotOpGenericAdaptor<::mlir::ValueRange> { +public: + using DotOpGenericAdaptor::DotOpGenericAdaptor; + DotOpAdaptor(DotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DotOpAdaptor; + template + using GenericAdaptor = DotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.dot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DotOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::ElemwiseBinaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ElemwiseBinaryOpGenericAdaptorBase { +public: + struct Properties { + using castTy = ::mlir::linalg::TypeFnAttr; + castTy cast; + + auto getCast() { + auto &propStorage = this->cast; + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); + } + void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { + this->cast = propValue; + } + using funTy = ::mlir::linalg::BinaryFnAttr; + funTy fun; + + auto getFun() { + auto &propStorage = this->fun; + return ::llvm::dyn_cast_or_null<::mlir::linalg::BinaryFnAttr>(propStorage); + } + void setFun(const ::mlir::linalg::BinaryFnAttr &propValue) { + this->fun = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.cast == this->cast && + rhs.fun == this->fun && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ElemwiseBinaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ElemwiseBinaryOpGenericAdaptorBase(ElemwiseBinaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::linalg::BinaryFnAttr getFunAttr(); + ::mlir::linalg::BinaryFn getFun(); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ElemwiseBinaryOpGenericAdaptor : public detail::ElemwiseBinaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ElemwiseBinaryOpGenericAdaptorBase; +public: + ElemwiseBinaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ElemwiseBinaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ElemwiseBinaryOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ElemwiseBinaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ElemwiseBinaryOpAdaptor : public ElemwiseBinaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using ElemwiseBinaryOpGenericAdaptor::ElemwiseBinaryOpGenericAdaptor; + ElemwiseBinaryOpAdaptor(ElemwiseBinaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ElemwiseBinaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ElemwiseBinaryOpAdaptor; + template + using GenericAdaptor = ElemwiseBinaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("fun"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCastAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFunAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFunAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.elemwise_binary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::linalg::BinaryFnAttr getFunAttr(); + ::mlir::linalg::BinaryFn getFun(); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + void setFunAttr(::mlir::linalg::BinaryFnAttr attr); + void setFun(::std::optional<::mlir::linalg::BinaryFn> attrValue); + void setCastAttr(::mlir::linalg::TypeFnAttr attr); + void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); + ::mlir::Attribute removeFunAttr(); + ::mlir::Attribute removeCastAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute fun, Attribute cast, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ElemwiseBinaryOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::ElemwiseUnaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ElemwiseUnaryOpGenericAdaptorBase { +public: + struct Properties { + using castTy = ::mlir::linalg::TypeFnAttr; + castTy cast; + + auto getCast() { + auto &propStorage = this->cast; + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); + } + void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { + this->cast = propValue; + } + using funTy = ::mlir::linalg::UnaryFnAttr; + funTy fun; + + auto getFun() { + auto &propStorage = this->fun; + return ::llvm::dyn_cast_or_null<::mlir::linalg::UnaryFnAttr>(propStorage); + } + void setFun(const ::mlir::linalg::UnaryFnAttr &propValue) { + this->fun = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.cast == this->cast && + rhs.fun == this->fun && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ElemwiseUnaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ElemwiseUnaryOpGenericAdaptorBase(ElemwiseUnaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::linalg::UnaryFnAttr getFunAttr(); + ::mlir::linalg::UnaryFn getFun(); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ElemwiseUnaryOpGenericAdaptor : public detail::ElemwiseUnaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ElemwiseUnaryOpGenericAdaptorBase; +public: + ElemwiseUnaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ElemwiseUnaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ElemwiseUnaryOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ElemwiseUnaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ElemwiseUnaryOpAdaptor : public ElemwiseUnaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using ElemwiseUnaryOpGenericAdaptor::ElemwiseUnaryOpGenericAdaptor; + ElemwiseUnaryOpAdaptor(ElemwiseUnaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ElemwiseUnaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ElemwiseUnaryOpAdaptor; + template + using GenericAdaptor = ElemwiseUnaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("fun"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCastAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFunAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFunAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.elemwise_unary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::linalg::UnaryFnAttr getFunAttr(); + ::mlir::linalg::UnaryFn getFun(); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + void setFunAttr(::mlir::linalg::UnaryFnAttr attr); + void setFun(::std::optional<::mlir::linalg::UnaryFn> attrValue); + void setCastAttr(::mlir::linalg::TypeFnAttr attr); + void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); + ::mlir::Attribute removeFunAttr(); + ::mlir::Attribute removeCastAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute fun, Attribute cast, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ElemwiseUnaryOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::ExpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpOpGenericAdaptorBase(ExpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpOpGenericAdaptorBase; +public: + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpOpGenericAdaptor::ExpOpGenericAdaptor; + ExpOpAdaptor(ExpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpOpAdaptor; + template + using GenericAdaptor = ExpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.exp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ExpOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::FillOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FillOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FillOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FillOpGenericAdaptorBase(FillOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FillOpGenericAdaptor : public detail::FillOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FillOpGenericAdaptorBase; +public: + FillOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FillOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FillOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FillOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FillOpAdaptor : public FillOpGenericAdaptor<::mlir::ValueRange> { +public: + using FillOpGenericAdaptor::FillOpGenericAdaptor; + FillOpAdaptor(FillOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FillOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::FillOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FillOpAdaptor; + template + using GenericAdaptor = FillOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.fill"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::FillOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::FillRng2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FillRng2DOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FillRng2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FillRng2DOpGenericAdaptorBase(FillRng2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FillRng2DOpGenericAdaptor : public detail::FillRng2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FillRng2DOpGenericAdaptorBase; +public: + FillRng2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FillRng2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FillRng2DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FillRng2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FillRng2DOpAdaptor : public FillRng2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using FillRng2DOpGenericAdaptor::FillRng2DOpGenericAdaptor; + FillRng2DOpAdaptor(FillRng2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FillRng2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FillRng2DOpAdaptor; + template + using GenericAdaptor = FillRng2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.fill_rng_2d"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::FillRng2DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::FloorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorOpGenericAdaptorBase(FloorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FloorOpGenericAdaptor : public detail::FloorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorOpGenericAdaptorBase; +public: + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FloorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorOpAdaptor : public FloorOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorOpGenericAdaptor::FloorOpGenericAdaptor; + FloorOpAdaptor(FloorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorOpAdaptor; + template + using GenericAdaptor = FloorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.floor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::FloorOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::GenericOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GenericOpGenericAdaptorBase { +public: + struct Properties { + using docTy = ::mlir::StringAttr; + docTy doc; + + auto getDoc() { + auto &propStorage = this->doc; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setDoc(const ::mlir::StringAttr &propValue) { + this->doc = propValue; + } + using indexing_mapsTy = ::mlir::ArrayAttr; + indexing_mapsTy indexing_maps; + + auto getIndexingMaps() { + auto &propStorage = this->indexing_maps; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setIndexingMaps(const ::mlir::ArrayAttr &propValue) { + this->indexing_maps = propValue; + } + using iterator_typesTy = ::mlir::ArrayAttr; + iterator_typesTy iterator_types; + + auto getIteratorTypes() { + auto &propStorage = this->iterator_types; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setIteratorTypes(const ::mlir::ArrayAttr &propValue) { + this->iterator_types = propValue; + } + using library_callTy = ::mlir::StringAttr; + library_callTy library_call; + + auto getLibraryCall() { + auto &propStorage = this->library_call; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setLibraryCall(const ::mlir::StringAttr &propValue) { + this->library_call = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.doc == this->doc && + rhs.indexing_maps == this->indexing_maps && + rhs.iterator_types == this->iterator_types && + rhs.library_call == this->library_call && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GenericOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GenericOpGenericAdaptorBase(GenericOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getIndexingMapsAttr(); + ::mlir::ArrayAttr getIndexingMaps(); + ::mlir::ArrayAttr getIteratorTypesAttr(); + ::mlir::ArrayAttr getIteratorTypes(); + ::mlir::StringAttr getDocAttr(); + ::std::optional< ::llvm::StringRef > getDoc(); + ::mlir::StringAttr getLibraryCallAttr(); + ::std::optional< ::llvm::StringRef > getLibraryCall(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class GenericOpGenericAdaptor : public detail::GenericOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GenericOpGenericAdaptorBase; +public: + GenericOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GenericOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GenericOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GenericOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GenericOpAdaptor : public GenericOpGenericAdaptor<::mlir::ValueRange> { +public: + using GenericOpGenericAdaptor::GenericOpGenericAdaptor; + GenericOpAdaptor(GenericOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GenericOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GenericOpAdaptor; + template + using GenericAdaptor = GenericOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("doc"), ::llvm::StringRef("indexing_maps"), ::llvm::StringRef("iterator_types"), ::llvm::StringRef("library_call"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDocAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDocAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexingMapsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexingMapsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIteratorTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIteratorTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLibraryCallAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLibraryCallAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.generic"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getIndexingMapsAttr(); + ::mlir::ArrayAttr getIndexingMaps(); + ::mlir::ArrayAttr getIteratorTypesAttr(); + ::mlir::ArrayAttr getIteratorTypes(); + ::mlir::StringAttr getDocAttr(); + ::std::optional< ::llvm::StringRef > getDoc(); + ::mlir::StringAttr getLibraryCallAttr(); + ::std::optional< ::llvm::StringRef > getLibraryCall(); + void setIndexingMapsAttr(::mlir::ArrayAttr attr); + void setIteratorTypesAttr(::mlir::ArrayAttr attr); + void setDocAttr(::mlir::StringAttr attr); + void setDoc(::std::optional<::llvm::StringRef> attrValue); + void setLibraryCallAttr(::mlir::StringAttr attr); + void setLibraryCall(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDocAttr(); + ::mlir::Attribute removeLibraryCallAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayAttr iteratorTypes, StringAttr doc, StringAttr libraryCall, function_ref odsArg7, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef indexingMaps, ArrayRef iteratorTypes, StringRef doc, StringRef libraryCall, function_ref odsArg7 = nullptr, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputBuffers, ArrayRef indexingMaps, ArrayRef iteratorTypes, StringRef doc, StringRef libraryCall, function_ref odsArg6 = nullptr, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef indexingMaps, ArrayRef iteratorTypes, function_ref odsArg5 = nullptr, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputBuffers, ArrayRef indexingMaps, ArrayRef iteratorTypes, function_ref odsArg4 = nullptr, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result_tensors, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::ArrayAttr indexing_maps, ::mlir::ArrayAttr iterator_types, /*optional*/::mlir::StringAttr doc, /*optional*/::mlir::StringAttr library_call); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + void getAsmBlockArgumentNames(::mlir::Region®ion, ::mlir::OpAsmSetValueNameFn setNameFn); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + SmallVector linalgTraitAttrNames() { + return SmallVector{ + getDocAttrName(), + getIndexingMapsAttrName(), getLibraryCallAttrName(), + getIteratorTypesAttrName(), + }; + } + std::string getLibraryCallName() { + return getLibraryCall() ? + getLibraryCall()->str() : "op_has_no_registered_library_name"; + } + + static std::function)> + getRegionBuilder() { + return nullptr; + } + + MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::GenericOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::LogOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LogOpGenericAdaptorBase(LogOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogOpGenericAdaptorBase; +public: + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogOpGenericAdaptor::LogOpGenericAdaptor; + LogOpAdaptor(LogOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogOpAdaptor; + template + using GenericAdaptor = LogOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.log"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::LogOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MapOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MapOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MapOpGenericAdaptorBase(MapOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getMapper(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MapOpGenericAdaptor : public detail::MapOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MapOpGenericAdaptorBase; +public: + MapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MapOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MapOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getInit() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MapOpAdaptor : public MapOpGenericAdaptor<::mlir::ValueRange> { +public: + using MapOpGenericAdaptor::MapOpGenericAdaptor; + MapOpAdaptor(MapOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MapOp : public ::mlir::Op::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MapOpAdaptor; + template + using GenericAdaptor = MapOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.map"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::TypedValue<::mlir::ShapedType> getInit(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getInitMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResult(); + ::mlir::Region &getMapper(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, Value init, function_ref odsArg2, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result, ::mlir::ValueRange inputs, ::mlir::Value init); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + void getAsmBlockArgumentNames(::mlir::Region®ion, ::mlir::OpAsmSetValueNameFn setNameFn); +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Implement functions necessary for LinalgStructuredInterface. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + std::string getLibraryCallName() { + return "op_has_no_registered_library_name"; + } + + // Implement functions necessary for DestinationStyleOpInterface. + MutableOperandRange getDpsInitsMutable() { return getInitMutable(); } + + SmallVector getOpOperandsMatchingBBargs() { + return getDpsInputOperands(); + } + + bool payloadUsesValueFromOperand(OpOperand * opOperand) { + if (isDpsInit(opOperand)) return false; + return !getMatchingBlockArgument(opOperand).use_empty(); + } + + static std::function)> + getRegionBuilder() { + return nullptr; + } +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MapOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatmulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatmulOpGenericAdaptorBase { +public: + struct Properties { + using castTy = ::mlir::linalg::TypeFnAttr; + castTy cast; + + auto getCast() { + auto &propStorage = this->cast; + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); + } + void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { + this->cast = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.cast == this->cast && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MatmulOpGenericAdaptorBase(MatmulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MatmulOpGenericAdaptor : public detail::MatmulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatmulOpGenericAdaptorBase; +public: + MatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatmulOpAdaptor : public MatmulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatmulOpGenericAdaptor::MatmulOpGenericAdaptor; + MatmulOpAdaptor(MatmulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatmulOpAdaptor; + template + using GenericAdaptor = MatmulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCastAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.matmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + void setCastAttr(::mlir::linalg::TypeFnAttr attr); + void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); + ::mlir::Attribute removeCastAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatmulTransposeAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatmulTransposeAOpGenericAdaptorBase { +public: + struct Properties { + using castTy = ::mlir::linalg::TypeFnAttr; + castTy cast; + + auto getCast() { + auto &propStorage = this->cast; + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); + } + void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { + this->cast = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.cast == this->cast && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MatmulTransposeAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MatmulTransposeAOpGenericAdaptorBase(MatmulTransposeAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MatmulTransposeAOpGenericAdaptor : public detail::MatmulTransposeAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatmulTransposeAOpGenericAdaptorBase; +public: + MatmulTransposeAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatmulTransposeAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatmulTransposeAOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MatmulTransposeAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatmulTransposeAOpAdaptor : public MatmulTransposeAOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatmulTransposeAOpGenericAdaptor::MatmulTransposeAOpGenericAdaptor; + MatmulTransposeAOpAdaptor(MatmulTransposeAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatmulTransposeAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatmulTransposeAOpAdaptor; + template + using GenericAdaptor = MatmulTransposeAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCastAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.matmul_transpose_a"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + void setCastAttr(::mlir::linalg::TypeFnAttr attr); + void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); + ::mlir::Attribute removeCastAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MatmulTransposeAOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatmulTransposeBOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatmulTransposeBOpGenericAdaptorBase { +public: + struct Properties { + using castTy = ::mlir::linalg::TypeFnAttr; + castTy cast; + + auto getCast() { + auto &propStorage = this->cast; + return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); + } + void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { + this->cast = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.cast == this->cast && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MatmulTransposeBOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MatmulTransposeBOpGenericAdaptorBase(MatmulTransposeBOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MatmulTransposeBOpGenericAdaptor : public detail::MatmulTransposeBOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatmulTransposeBOpGenericAdaptorBase; +public: + MatmulTransposeBOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatmulTransposeBOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatmulTransposeBOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MatmulTransposeBOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatmulTransposeBOpAdaptor : public MatmulTransposeBOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatmulTransposeBOpGenericAdaptor::MatmulTransposeBOpGenericAdaptor; + MatmulTransposeBOpAdaptor(MatmulTransposeBOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatmulTransposeBOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatmulTransposeBOpAdaptor; + template + using GenericAdaptor = MatmulTransposeBOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCastAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.matmul_transpose_b"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::linalg::TypeFnAttr getCastAttr(); + ::mlir::linalg::TypeFn getCast(); + void setCastAttr(::mlir::linalg::TypeFnAttr attr); + void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); + ::mlir::Attribute removeCastAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MatmulTransposeBOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatmulUnsignedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatmulUnsignedOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MatmulUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MatmulUnsignedOpGenericAdaptorBase(MatmulUnsignedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MatmulUnsignedOpGenericAdaptor : public detail::MatmulUnsignedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatmulUnsignedOpGenericAdaptorBase; +public: + MatmulUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatmulUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatmulUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MatmulUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatmulUnsignedOpAdaptor : public MatmulUnsignedOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatmulUnsignedOpGenericAdaptor::MatmulUnsignedOpGenericAdaptor; + MatmulUnsignedOpAdaptor(MatmulUnsignedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatmulUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatmulUnsignedOpAdaptor; + template + using GenericAdaptor = MatmulUnsignedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.matmul_unsigned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MatmulUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MatvecOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatvecOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MatvecOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MatvecOpGenericAdaptorBase(MatvecOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MatvecOpGenericAdaptor : public detail::MatvecOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatvecOpGenericAdaptorBase; +public: + MatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatvecOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MatvecOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatvecOpAdaptor : public MatvecOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatvecOpGenericAdaptor::MatvecOpGenericAdaptor; + MatvecOpAdaptor(MatvecOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatvecOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatvecOpAdaptor; + template + using GenericAdaptor = MatvecOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.matvec"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MatvecOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxOpGenericAdaptorBase(MaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MaxOpGenericAdaptor : public detail::MaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxOpGenericAdaptorBase; +public: + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxOpAdaptor : public MaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxOpGenericAdaptor::MaxOpGenericAdaptor; + MaxOpAdaptor(MaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxOpAdaptor; + template + using GenericAdaptor = MaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.max"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::Mmt4DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Mmt4DOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Mmt4DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Mmt4DOpGenericAdaptorBase(Mmt4DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class Mmt4DOpGenericAdaptor : public detail::Mmt4DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Mmt4DOpGenericAdaptorBase; +public: + Mmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Mmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Mmt4DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Mmt4DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Mmt4DOpAdaptor : public Mmt4DOpGenericAdaptor<::mlir::ValueRange> { +public: + using Mmt4DOpGenericAdaptor::Mmt4DOpGenericAdaptor; + Mmt4DOpAdaptor(Mmt4DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Mmt4DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Mmt4DOpAdaptor; + template + using GenericAdaptor = Mmt4DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.mmt4d"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Mmt4DOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::MulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MulOpGenericAdaptorBase(MulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulOpGenericAdaptorBase; +public: + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulOpGenericAdaptor::MulOpGenericAdaptor; + MulOpAdaptor(MulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulOpAdaptor; + template + using GenericAdaptor = MulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::NegfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NegfOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + NegfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + NegfOpGenericAdaptorBase(NegfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class NegfOpGenericAdaptor : public detail::NegfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NegfOpGenericAdaptorBase; +public: + NegfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NegfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NegfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + NegfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NegfOpAdaptor : public NegfOpGenericAdaptor<::mlir::ValueRange> { +public: + using NegfOpGenericAdaptor::NegfOpGenericAdaptor; + NegfOpAdaptor(NegfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NegfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NegfOpAdaptor; + template + using GenericAdaptor = NegfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.negf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::NegfOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNchwMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNchwMaxOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNchwMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNchwMaxOpGenericAdaptorBase(PoolingNchwMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNchwMaxOpGenericAdaptor : public detail::PoolingNchwMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNchwMaxOpGenericAdaptorBase; +public: + PoolingNchwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNchwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNchwMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNchwMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNchwMaxOpAdaptor : public PoolingNchwMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNchwMaxOpGenericAdaptor::PoolingNchwMaxOpGenericAdaptor; + PoolingNchwMaxOpAdaptor(PoolingNchwMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNchwMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNchwMaxOpAdaptor; + template + using GenericAdaptor = PoolingNchwMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nchw_max"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNchwMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNchwSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNchwSumOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNchwSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNchwSumOpGenericAdaptorBase(PoolingNchwSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNchwSumOpGenericAdaptor : public detail::PoolingNchwSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNchwSumOpGenericAdaptorBase; +public: + PoolingNchwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNchwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNchwSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNchwSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNchwSumOpAdaptor : public PoolingNchwSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNchwSumOpGenericAdaptor::PoolingNchwSumOpGenericAdaptor; + PoolingNchwSumOpAdaptor(PoolingNchwSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNchwSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNchwSumOpAdaptor; + template + using GenericAdaptor = PoolingNchwSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nchw_sum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNchwSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNcwMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNcwMaxOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNcwMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNcwMaxOpGenericAdaptorBase(PoolingNcwMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNcwMaxOpGenericAdaptor : public detail::PoolingNcwMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNcwMaxOpGenericAdaptorBase; +public: + PoolingNcwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNcwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNcwMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNcwMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNcwMaxOpAdaptor : public PoolingNcwMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNcwMaxOpGenericAdaptor::PoolingNcwMaxOpGenericAdaptor; + PoolingNcwMaxOpAdaptor(PoolingNcwMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNcwMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNcwMaxOpAdaptor; + template + using GenericAdaptor = PoolingNcwMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_ncw_max"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNcwMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNcwSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNcwSumOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNcwSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNcwSumOpGenericAdaptorBase(PoolingNcwSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNcwSumOpGenericAdaptor : public detail::PoolingNcwSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNcwSumOpGenericAdaptorBase; +public: + PoolingNcwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNcwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNcwSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNcwSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNcwSumOpAdaptor : public PoolingNcwSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNcwSumOpGenericAdaptor::PoolingNcwSumOpGenericAdaptor; + PoolingNcwSumOpAdaptor(PoolingNcwSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNcwSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNcwSumOpAdaptor; + template + using GenericAdaptor = PoolingNcwSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_ncw_sum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNcwSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNdhwcMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNdhwcMaxOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNdhwcMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNdhwcMaxOpGenericAdaptorBase(PoolingNdhwcMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNdhwcMaxOpGenericAdaptor : public detail::PoolingNdhwcMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNdhwcMaxOpGenericAdaptorBase; +public: + PoolingNdhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNdhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNdhwcMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNdhwcMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNdhwcMaxOpAdaptor : public PoolingNdhwcMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNdhwcMaxOpGenericAdaptor::PoolingNdhwcMaxOpGenericAdaptor; + PoolingNdhwcMaxOpAdaptor(PoolingNdhwcMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNdhwcMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNdhwcMaxOpAdaptor; + template + using GenericAdaptor = PoolingNdhwcMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_ndhwc_max"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNdhwcMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNdhwcMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNdhwcMinOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNdhwcMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNdhwcMinOpGenericAdaptorBase(PoolingNdhwcMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNdhwcMinOpGenericAdaptor : public detail::PoolingNdhwcMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNdhwcMinOpGenericAdaptorBase; +public: + PoolingNdhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNdhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNdhwcMinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNdhwcMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNdhwcMinOpAdaptor : public PoolingNdhwcMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNdhwcMinOpGenericAdaptor::PoolingNdhwcMinOpGenericAdaptor; + PoolingNdhwcMinOpAdaptor(PoolingNdhwcMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNdhwcMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNdhwcMinOpAdaptor; + template + using GenericAdaptor = PoolingNdhwcMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_ndhwc_min"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNdhwcMinOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNdhwcSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNdhwcSumOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNdhwcSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNdhwcSumOpGenericAdaptorBase(PoolingNdhwcSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNdhwcSumOpGenericAdaptor : public detail::PoolingNdhwcSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNdhwcSumOpGenericAdaptorBase; +public: + PoolingNdhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNdhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNdhwcSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNdhwcSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNdhwcSumOpAdaptor : public PoolingNdhwcSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNdhwcSumOpGenericAdaptor::PoolingNdhwcSumOpGenericAdaptor; + PoolingNdhwcSumOpAdaptor(PoolingNdhwcSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNdhwcSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNdhwcSumOpAdaptor; + template + using GenericAdaptor = PoolingNdhwcSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_ndhwc_sum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNdhwcSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNhwcMaxOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNhwcMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNhwcMaxOpGenericAdaptorBase(PoolingNhwcMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNhwcMaxOpGenericAdaptor : public detail::PoolingNhwcMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNhwcMaxOpGenericAdaptorBase; +public: + PoolingNhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNhwcMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNhwcMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNhwcMaxOpAdaptor : public PoolingNhwcMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNhwcMaxOpGenericAdaptor::PoolingNhwcMaxOpGenericAdaptor; + PoolingNhwcMaxOpAdaptor(PoolingNhwcMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNhwcMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNhwcMaxOpAdaptor; + template + using GenericAdaptor = PoolingNhwcMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nhwc_max"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcMaxUnsignedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNhwcMaxUnsignedOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNhwcMaxUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNhwcMaxUnsignedOpGenericAdaptorBase(PoolingNhwcMaxUnsignedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNhwcMaxUnsignedOpGenericAdaptor : public detail::PoolingNhwcMaxUnsignedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNhwcMaxUnsignedOpGenericAdaptorBase; +public: + PoolingNhwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNhwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNhwcMaxUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNhwcMaxUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNhwcMaxUnsignedOpAdaptor : public PoolingNhwcMaxUnsignedOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNhwcMaxUnsignedOpGenericAdaptor::PoolingNhwcMaxUnsignedOpGenericAdaptor; + PoolingNhwcMaxUnsignedOpAdaptor(PoolingNhwcMaxUnsignedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNhwcMaxUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNhwcMaxUnsignedOpAdaptor; + template + using GenericAdaptor = PoolingNhwcMaxUnsignedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nhwc_max_unsigned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMaxUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNhwcMinOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNhwcMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNhwcMinOpGenericAdaptorBase(PoolingNhwcMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNhwcMinOpGenericAdaptor : public detail::PoolingNhwcMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNhwcMinOpGenericAdaptorBase; +public: + PoolingNhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNhwcMinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNhwcMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNhwcMinOpAdaptor : public PoolingNhwcMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNhwcMinOpGenericAdaptor::PoolingNhwcMinOpGenericAdaptor; + PoolingNhwcMinOpAdaptor(PoolingNhwcMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNhwcMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNhwcMinOpAdaptor; + template + using GenericAdaptor = PoolingNhwcMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nhwc_min"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMinOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcMinUnsignedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNhwcMinUnsignedOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNhwcMinUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNhwcMinUnsignedOpGenericAdaptorBase(PoolingNhwcMinUnsignedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNhwcMinUnsignedOpGenericAdaptor : public detail::PoolingNhwcMinUnsignedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNhwcMinUnsignedOpGenericAdaptorBase; +public: + PoolingNhwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNhwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNhwcMinUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNhwcMinUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNhwcMinUnsignedOpAdaptor : public PoolingNhwcMinUnsignedOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNhwcMinUnsignedOpGenericAdaptor::PoolingNhwcMinUnsignedOpGenericAdaptor; + PoolingNhwcMinUnsignedOpAdaptor(PoolingNhwcMinUnsignedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNhwcMinUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNhwcMinUnsignedOpAdaptor; + template + using GenericAdaptor = PoolingNhwcMinUnsignedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nhwc_min_unsigned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMinUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNhwcSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNhwcSumOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNhwcSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNhwcSumOpGenericAdaptorBase(PoolingNhwcSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNhwcSumOpGenericAdaptor : public detail::PoolingNhwcSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNhwcSumOpGenericAdaptorBase; +public: + PoolingNhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNhwcSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNhwcSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNhwcSumOpAdaptor : public PoolingNhwcSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNhwcSumOpGenericAdaptor::PoolingNhwcSumOpGenericAdaptor; + PoolingNhwcSumOpAdaptor(PoolingNhwcSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNhwcSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNhwcSumOpAdaptor; + template + using GenericAdaptor = PoolingNhwcSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nhwc_sum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNwcMaxOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNwcMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNwcMaxOpGenericAdaptorBase(PoolingNwcMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNwcMaxOpGenericAdaptor : public detail::PoolingNwcMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNwcMaxOpGenericAdaptorBase; +public: + PoolingNwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNwcMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNwcMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNwcMaxOpAdaptor : public PoolingNwcMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNwcMaxOpGenericAdaptor::PoolingNwcMaxOpGenericAdaptor; + PoolingNwcMaxOpAdaptor(PoolingNwcMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNwcMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNwcMaxOpAdaptor; + template + using GenericAdaptor = PoolingNwcMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nwc_max"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMaxOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcMaxUnsignedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNwcMaxUnsignedOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNwcMaxUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNwcMaxUnsignedOpGenericAdaptorBase(PoolingNwcMaxUnsignedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNwcMaxUnsignedOpGenericAdaptor : public detail::PoolingNwcMaxUnsignedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNwcMaxUnsignedOpGenericAdaptorBase; +public: + PoolingNwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNwcMaxUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNwcMaxUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNwcMaxUnsignedOpAdaptor : public PoolingNwcMaxUnsignedOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNwcMaxUnsignedOpGenericAdaptor::PoolingNwcMaxUnsignedOpGenericAdaptor; + PoolingNwcMaxUnsignedOpAdaptor(PoolingNwcMaxUnsignedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNwcMaxUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNwcMaxUnsignedOpAdaptor; + template + using GenericAdaptor = PoolingNwcMaxUnsignedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nwc_max_unsigned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMaxUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNwcMinOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNwcMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNwcMinOpGenericAdaptorBase(PoolingNwcMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNwcMinOpGenericAdaptor : public detail::PoolingNwcMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNwcMinOpGenericAdaptorBase; +public: + PoolingNwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNwcMinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNwcMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNwcMinOpAdaptor : public PoolingNwcMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNwcMinOpGenericAdaptor::PoolingNwcMinOpGenericAdaptor; + PoolingNwcMinOpAdaptor(PoolingNwcMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNwcMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNwcMinOpAdaptor; + template + using GenericAdaptor = PoolingNwcMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nwc_min"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMinOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcMinUnsignedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNwcMinUnsignedOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNwcMinUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNwcMinUnsignedOpGenericAdaptorBase(PoolingNwcMinUnsignedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNwcMinUnsignedOpGenericAdaptor : public detail::PoolingNwcMinUnsignedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNwcMinUnsignedOpGenericAdaptorBase; +public: + PoolingNwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNwcMinUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNwcMinUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNwcMinUnsignedOpAdaptor : public PoolingNwcMinUnsignedOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNwcMinUnsignedOpGenericAdaptor::PoolingNwcMinUnsignedOpGenericAdaptor; + PoolingNwcMinUnsignedOpAdaptor(PoolingNwcMinUnsignedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNwcMinUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNwcMinUnsignedOpAdaptor; + template + using GenericAdaptor = PoolingNwcMinUnsignedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nwc_min_unsigned"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMinUnsignedOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::PoolingNwcSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PoolingNwcSumOpGenericAdaptorBase { +public: + struct Properties { + using dilationsTy = ::mlir::DenseIntElementsAttr; + dilationsTy dilations; + + auto getDilations() { + auto &propStorage = this->dilations; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { + this->dilations = propValue; + } + using stridesTy = ::mlir::DenseIntElementsAttr; + stridesTy strides; + + auto getStrides() { + auto &propStorage = this->strides; + return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); + } + void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { + this->strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dilations == this->dilations && + rhs.strides == this->strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PoolingNwcSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PoolingNwcSumOpGenericAdaptorBase(PoolingNwcSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PoolingNwcSumOpGenericAdaptor : public detail::PoolingNwcSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PoolingNwcSumOpGenericAdaptorBase; +public: + PoolingNwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PoolingNwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PoolingNwcSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PoolingNwcSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PoolingNwcSumOpAdaptor : public PoolingNwcSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using PoolingNwcSumOpGenericAdaptor::PoolingNwcSumOpGenericAdaptor; + PoolingNwcSumOpAdaptor(PoolingNwcSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PoolingNwcSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PoolingNwcSumOpAdaptor; + template + using GenericAdaptor = PoolingNwcSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.pooling_nwc_sum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + ::mlir::DenseIntElementsAttr getDilationsAttr(); + ::mlir::DenseIntElementsAttr getDilations(); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + void setDilationsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeStridesAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + + bool hasDynamicIndexingMaps(); + LogicalResult verifyIndexingMapRequiredAttributes(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcSumOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::QuantizedBatchMatmulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizedBatchMatmulOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + QuantizedBatchMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizedBatchMatmulOpGenericAdaptorBase(QuantizedBatchMatmulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class QuantizedBatchMatmulOpGenericAdaptor : public detail::QuantizedBatchMatmulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizedBatchMatmulOpGenericAdaptorBase; +public: + QuantizedBatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizedBatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizedBatchMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + QuantizedBatchMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizedBatchMatmulOpAdaptor : public QuantizedBatchMatmulOpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizedBatchMatmulOpGenericAdaptor::QuantizedBatchMatmulOpGenericAdaptor; + QuantizedBatchMatmulOpAdaptor(QuantizedBatchMatmulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizedBatchMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizedBatchMatmulOpAdaptor; + template + using GenericAdaptor = QuantizedBatchMatmulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.quantized_batch_matmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::QuantizedBatchMatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::QuantizedMatmulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizedMatmulOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + QuantizedMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizedMatmulOpGenericAdaptorBase(QuantizedMatmulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class QuantizedMatmulOpGenericAdaptor : public detail::QuantizedMatmulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizedMatmulOpGenericAdaptorBase; +public: + QuantizedMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizedMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizedMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + QuantizedMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizedMatmulOpAdaptor : public QuantizedMatmulOpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizedMatmulOpGenericAdaptor::QuantizedMatmulOpGenericAdaptor; + QuantizedMatmulOpAdaptor(QuantizedMatmulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizedMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizedMatmulOpAdaptor; + template + using GenericAdaptor = QuantizedMatmulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.quantized_matmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::QuantizedMatmulOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::ReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceOpGenericAdaptorBase { +public: + struct Properties { + using dimensionsTy = ::mlir::DenseI64ArrayAttr; + dimensionsTy dimensions; + + auto getDimensions() { + auto &propStorage = this->dimensions; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setDimensions(const ::mlir::DenseI64ArrayAttr &propValue) { + this->dimensions = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.dimensions == this->dimensions && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceOpGenericAdaptorBase(ReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI64ArrayAttr getDimensionsAttr(); + ::llvm::ArrayRef getDimensions(); + ::mlir::Region &getCombiner(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReduceOpGenericAdaptor : public detail::ReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceOpGenericAdaptorBase; +public: + ReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getInits() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceOpAdaptor : public ReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceOpGenericAdaptor::ReduceOpGenericAdaptor; + ReduceOpAdaptor(ReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceOpAdaptor; + template + using GenericAdaptor = ReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.reduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getInits(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getInitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getCombiner(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI64ArrayAttr getDimensionsAttr(); + ::llvm::ArrayRef getDimensions(); + void setDimensionsAttr(::mlir::DenseI64ArrayAttr attr); + void setDimensions(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange inits, ArrayRef dimensions, function_ref odsArg3, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::mlir::DenseI64ArrayAttr dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::llvm::ArrayRef dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + void getAsmBlockArgumentNames(::mlir::Region®ion, ::mlir::OpAsmSetValueNameFn setNameFn); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Declare functions necessary for LinalgStructuredInterface. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + std::string getLibraryCallName() { + return "op_has_no_registered_library_name"; + } + + // Implement functions necessary for DestinationStyleOpInterface. + static std::function)> + getRegionBuilder() { + return nullptr; + } + MutableOperandRange getDpsInitsMutable() { return getInitsMutable(); } +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ReduceOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::SubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubOpGenericAdaptorBase(SubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SubOpGenericAdaptor : public detail::SubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubOpGenericAdaptorBase; +public: + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubOpAdaptor : public SubOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubOpGenericAdaptor::SubOpGenericAdaptor; + SubOpAdaptor(SubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubOpAdaptor; + template + using GenericAdaptor = SubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.sub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::SubOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::TransposeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TransposeOpGenericAdaptorBase { +public: + struct Properties { + using permutationTy = ::mlir::DenseI64ArrayAttr; + permutationTy permutation; + + auto getPermutation() { + auto &propStorage = this->permutation; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setPermutation(const ::mlir::DenseI64ArrayAttr &propValue) { + this->permutation = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.permutation == this->permutation && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TransposeOpGenericAdaptorBase(TransposeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI64ArrayAttr getPermutationAttr(); + ::llvm::ArrayRef getPermutation(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class TransposeOpGenericAdaptor : public detail::TransposeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TransposeOpGenericAdaptorBase; +public: + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInit() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TransposeOpAdaptor : public TransposeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TransposeOpGenericAdaptor::TransposeOpGenericAdaptor; + TransposeOpAdaptor(TransposeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TransposeOpAdaptor; + template + using GenericAdaptor = TransposeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("permutation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPermutationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPermutationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.transpose"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ShapedType> getInput(); + ::mlir::TypedValue<::mlir::ShapedType> getInit(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInitMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResult(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI64ArrayAttr getPermutationAttr(); + ::llvm::ArrayRef getPermutation(); + void setPermutationAttr(::mlir::DenseI64ArrayAttr attr); + void setPermutation(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value init, DenseI64ArrayAttr permutation, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value init, ArrayRef permutation, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Declare functions necessary for LinalgStructuredInterface. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + std::string getLibraryCallName() { + return "op_has_no_registered_library_name"; + } + + // Implement functions necessary for DestinationStyleOpInterface. + MutableOperandRange getDpsInitsMutable() { return getInitMutable(); } + + static std::function)> + getRegionBuilder() { + return nullptr; + } + + static void createRegion(::mlir::OpBuilder &opBuilder, + ::mlir::OperationState & odsState); +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::TransposeOp) + +namespace mlir { +namespace linalg { + +//===----------------------------------------------------------------------===// +// ::mlir::linalg::VecmatOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VecmatOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + VecmatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + VecmatOpGenericAdaptorBase(VecmatOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class VecmatOpGenericAdaptor : public detail::VecmatOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VecmatOpGenericAdaptorBase; +public: + VecmatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VecmatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VecmatOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + VecmatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VecmatOpAdaptor : public VecmatOpGenericAdaptor<::mlir::ValueRange> { +public: + using VecmatOpGenericAdaptor::VecmatOpGenericAdaptor; + VecmatOpAdaptor(VecmatOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VecmatOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VecmatOpAdaptor; + template + using GenericAdaptor = VecmatOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("linalg.vecmat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultTensors(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: + // Return whether the op accesses the iteration indices. + bool hasIndexSemantics() { + return !this->getBody()->getOps().empty(); + } + + LogicalResult reifyResultShapes(OpBuilder &b, + ReifiedRankedShapedTypeDims &reifiedReturnShapes) { + return llvm::cast(getOperation()).reifyResultShapes(b, + reifiedReturnShapes); + } + + // Auto-generated. + SmallVector getIteratorTypesArray(); + ArrayAttr getIndexingMaps(); + static void regionBuilder(ImplicitLocOpBuilder &b, + Block &block, ArrayRef attrs); + static std::function)> + getRegionBuilder() { + return regionBuilder; + } + + ::mlir::MutableOperandRange getDpsInitsMutable() { + return getOutputsMutable(); + } + + // Generic methods. + static unsigned getNumRegionArgs(); + std::string getLibraryCallName(); + +}; +} // namespace linalg +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::VecmatOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/ValueBoundsOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/ValueBoundsOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..005ed4bf646062c76b3405e479ba6b7ecb9ff68f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/IR/ValueBoundsOpInterfaceImpl.h @@ -0,0 +1,20 @@ +//===- ValueBoundsOpInterfaceImpl.h - Impl. of ValueBoundsOpInterface -----===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_IR_VALUEBOUNDSOPINTERFACEIMPL_H +#define MLIR_DIALECT_LINALG_IR_VALUEBOUNDSOPINTERFACEIMPL_H + +namespace mlir { +class DialectRegistry; + +namespace linalg { +void registerValueBoundsOpInterfaceExternalModels(DialectRegistry ®istry); +} // namespace linalg +} // namespace mlir + +#endif // MLIR_DIALECT_LINALG_IR_VALUEBOUNDSOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.capi.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.capi.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..c2a6a98dde3009b136bf5f150f701da4e4cd9372 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.capi.cpp.inc @@ -0,0 +1,96 @@ +/* Autogenerated by mlir-tblgen; don't manually edit. */ +//===----------------------------------------------------------------------===// +// Linalg Group Registration +//===----------------------------------------------------------------------===// + +void mlirRegisterLinalgPasses(void) { + registerLinalgPasses(); +} + +MlirPass mlirCreateLinalgConvertElementwiseToLinalg(void) { + return wrap(mlir::createConvertElementwiseToLinalgPass().release()); +} +void mlirRegisterLinalgConvertElementwiseToLinalg(void) { + registerConvertElementwiseToLinalg(); +} + + +MlirPass mlirCreateLinalgLinalgBufferize(void) { + return wrap(mlir::createLinalgBufferizePass().release()); +} +void mlirRegisterLinalgLinalgBufferize(void) { + registerLinalgBufferize(); +} + + +MlirPass mlirCreateLinalgLinalgDetensorize(void) { + return wrap(mlir::createLinalgDetensorizePass().release()); +} +void mlirRegisterLinalgLinalgDetensorize(void) { + registerLinalgDetensorize(); +} + + +MlirPass mlirCreateLinalgLinalgElementwiseOpFusion(void) { + return wrap(mlir::createLinalgElementwiseOpFusionPass().release()); +} +void mlirRegisterLinalgLinalgElementwiseOpFusion(void) { + registerLinalgElementwiseOpFusion(); +} + + +MlirPass mlirCreateLinalgLinalgFoldUnitExtentDims(void) { + return wrap(mlir::createLinalgFoldUnitExtentDimsPass().release()); +} +void mlirRegisterLinalgLinalgFoldUnitExtentDims(void) { + registerLinalgFoldUnitExtentDims(); +} + + +MlirPass mlirCreateLinalgLinalgGeneralization(void) { + return wrap(mlir::createLinalgGeneralizationPass().release()); +} +void mlirRegisterLinalgLinalgGeneralization(void) { + registerLinalgGeneralization(); +} + + +MlirPass mlirCreateLinalgLinalgInlineScalarOperands(void) { + return wrap(mlir::createLinalgInlineScalarOperandsPass().release()); +} +void mlirRegisterLinalgLinalgInlineScalarOperands(void) { + registerLinalgInlineScalarOperands(); +} + + +MlirPass mlirCreateLinalgLinalgLowerToAffineLoops(void) { + return wrap(mlir::createConvertLinalgToAffineLoopsPass().release()); +} +void mlirRegisterLinalgLinalgLowerToAffineLoops(void) { + registerLinalgLowerToAffineLoops(); +} + + +MlirPass mlirCreateLinalgLinalgLowerToLoops(void) { + return wrap(mlir::createConvertLinalgToLoopsPass().release()); +} +void mlirRegisterLinalgLinalgLowerToLoops(void) { + registerLinalgLowerToLoops(); +} + + +MlirPass mlirCreateLinalgLinalgLowerToParallelLoops(void) { + return wrap(mlir::createConvertLinalgToParallelLoopsPass().release()); +} +void mlirRegisterLinalgLinalgLowerToParallelLoops(void) { + registerLinalgLowerToParallelLoops(); +} + + +MlirPass mlirCreateLinalgLinalgNamedOpConversion(void) { + return wrap(mlir::createLinalgNamedOpConversionPass().release()); +} +void mlirRegisterLinalgLinalgNamedOpConversion(void) { + registerLinalgNamedOpConversion(); +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.capi.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.capi.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..4564c2b30d2596913bfa51339f7de314ccb2cb82 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.capi.h.inc @@ -0,0 +1,72 @@ + +/* Autogenerated by mlir-tblgen; don't manually edit. */ + +#include "mlir-c/Pass.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Registration for the entire group +MLIR_CAPI_EXPORTED void mlirRegisterLinalgPasses(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgConvertElementwiseToLinalg(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgConvertElementwiseToLinalg(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgBufferize(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgBufferize(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgDetensorize(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgDetensorize(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgElementwiseOpFusion(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgElementwiseOpFusion(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgFoldUnitExtentDims(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgFoldUnitExtentDims(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgGeneralization(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgGeneralization(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgInlineScalarOperands(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgInlineScalarOperands(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgLowerToAffineLoops(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgLowerToAffineLoops(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgLowerToLoops(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgLowerToLoops(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgLowerToParallelLoops(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgLowerToParallelLoops(void); + + +/* Create Linalg Pass. */ +MLIR_CAPI_EXPORTED MlirPass mlirCreateLinalgLinalgNamedOpConversion(void); +MLIR_CAPI_EXPORTED void mlirRegisterLinalgLinalgNamedOpConversion(void); + + + +#ifdef __cplusplus +} +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..5f46affe592a2da07282bc211f175a71672a5527 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.h @@ -0,0 +1,78 @@ +//===- Passes.h - Linalg pass entry points ----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes that expose pass constructors. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_PASSES_H_ +#define MLIR_DIALECT_LINALG_PASSES_H_ + +#include "mlir/Dialect/Linalg/Transforms/Transforms.h" +#include "mlir/Dialect/Linalg/Utils/Utils.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { +namespace func { +class FuncOp; +} // namespace func + +namespace bufferization { +struct OneShotBufferizationOptions; +} // namespace bufferization + +#define GEN_PASS_DECL +#include "mlir/Dialect/Linalg/Passes.h.inc" + +std::unique_ptr createConvertElementwiseToLinalgPass(); + +std::unique_ptr createLinalgFoldUnitExtentDimsPass(); + +std::unique_ptr createLinalgElementwiseOpFusionPass(); +std::unique_ptr createFoldReshapeOpsByLinearizationPass(); + +std::unique_ptr createLinalgNamedOpConversionPass(); + +std::unique_ptr createLinalgInlineScalarOperandsPass(); + +/// Create a pass to convert Linalg operations to scf.for loops and +/// memref.load/memref.store accesses. +std::unique_ptr createConvertLinalgToLoopsPass(); + +/// Create a pass to convert Linalg operations to scf.parallel loops and +/// memref.load/memref.store accesses. +std::unique_ptr createConvertLinalgToParallelLoopsPass(); + +/// Create a pass to convert Linalg operations to affine.for loops and +/// affine_load/affine_store accesses. +/// Placeholder for now, this is NYI. +std::unique_ptr createConvertLinalgToAffineLoopsPass(); + +/// Create a pass to convert Linalg operations which work on tensors to use +/// buffers instead. +std::unique_ptr createLinalgBufferizePass(); + +/// Create a pass to convert named Linalg operations to Linalg generic +/// operations. +std::unique_ptr createLinalgGeneralizationPass(); + +/// Create a pass to convert Linalg operations to equivalent operations that +/// work on primitive types, if possible. +std::unique_ptr createLinalgDetensorizePass(); + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/Linalg/Passes.h.inc" + +} // namespace mlir + +#endif // MLIR_DIALECT_LINALG_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ef2cf5322c5ff909094edff9711bd65fba4ca7f5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Passes.h.inc @@ -0,0 +1,1482 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_CONVERTELEMENTWISETOLINALG +#define GEN_PASS_DECL_LINALGBUFFERIZE +#define GEN_PASS_DECL_LINALGDETENSORIZE +#define GEN_PASS_DECL_LINALGELEMENTWISEOPFUSION +#define GEN_PASS_DECL_LINALGFOLDUNITEXTENTDIMS +#define GEN_PASS_DECL_LINALGGENERALIZATION +#define GEN_PASS_DECL_LINALGINLINESCALAROPERANDS +#define GEN_PASS_DECL_LINALGLOWERTOAFFINELOOPS +#define GEN_PASS_DECL_LINALGLOWERTOLOOPS +#define GEN_PASS_DECL_LINALGLOWERTOPARALLELLOOPS +#define GEN_PASS_DECL_LINALGNAMEDOPCONVERSION +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// ConvertElementwiseToLinalg +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTELEMENTWISETOLINALG +#undef GEN_PASS_DECL_CONVERTELEMENTWISETOLINALG +#endif // GEN_PASS_DECL_CONVERTELEMENTWISETOLINALG +#ifdef GEN_PASS_DEF_CONVERTELEMENTWISETOLINALG +namespace impl { + +template +class ConvertElementwiseToLinalgBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertElementwiseToLinalgBase; + + ConvertElementwiseToLinalgBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertElementwiseToLinalgBase(const ConvertElementwiseToLinalgBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-elementwise-to-linalg"); + } + ::llvm::StringRef getArgument() const override { return "convert-elementwise-to-linalg"; } + + ::llvm::StringRef getDescription() const override { return "Convert ElementwiseMappable ops to linalg"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertElementwiseToLinalg"); + } + ::llvm::StringRef getName() const override { return "ConvertElementwiseToLinalg"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertElementwiseToLinalgBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTELEMENTWISETOLINALG +#endif // GEN_PASS_DEF_CONVERTELEMENTWISETOLINALG + +//===----------------------------------------------------------------------===// +// LinalgBufferize +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGBUFFERIZE +#undef GEN_PASS_DECL_LINALGBUFFERIZE +#endif // GEN_PASS_DECL_LINALGBUFFERIZE +#ifdef GEN_PASS_DEF_LINALGBUFFERIZE +namespace impl { + +template +class LinalgBufferizeBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgBufferizeBase; + + LinalgBufferizeBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgBufferizeBase(const LinalgBufferizeBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "linalg-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Bufferize the linalg dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgBufferize"); + } + ::llvm::StringRef getName() const override { return "LinalgBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgBufferizeBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGBUFFERIZE +#endif // GEN_PASS_DEF_LINALGBUFFERIZE + +//===----------------------------------------------------------------------===// +// LinalgDetensorize +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGDETENSORIZE +struct LinalgDetensorizeOptions { + bool aggressiveMode = false; +}; +#undef GEN_PASS_DECL_LINALGDETENSORIZE +#endif // GEN_PASS_DECL_LINALGDETENSORIZE +#ifdef GEN_PASS_DEF_LINALGDETENSORIZE +namespace impl { + +template +class LinalgDetensorizeBase : public ::mlir::InterfacePass { +public: + using Base = LinalgDetensorizeBase; + + LinalgDetensorizeBase() : ::mlir::InterfacePass(::mlir::TypeID::get()) {} + LinalgDetensorizeBase(const LinalgDetensorizeBase &other) : ::mlir::InterfacePass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-detensorize"); + } + ::llvm::StringRef getArgument() const override { return "linalg-detensorize"; } + + ::llvm::StringRef getDescription() const override { return "Detensorize linalg ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgDetensorize"); + } + ::llvm::StringRef getName() const override { return "LinalgDetensorize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgDetensorizeBase) + + LinalgDetensorizeBase(const LinalgDetensorizeOptions &options) : LinalgDetensorizeBase() { + aggressiveMode = options.aggressiveMode; + } +protected: + ::mlir::Pass::Option aggressiveMode{*this, "aggressive-mode", ::llvm::cl::desc("Detensorize all ops that qualify for detensoring along with branch operands and basic-block arguments."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGDETENSORIZE +#endif // GEN_PASS_DEF_LINALGDETENSORIZE + +//===----------------------------------------------------------------------===// +// LinalgElementwiseOpFusion +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGELEMENTWISEOPFUSION +#undef GEN_PASS_DECL_LINALGELEMENTWISEOPFUSION +#endif // GEN_PASS_DECL_LINALGELEMENTWISEOPFUSION +#ifdef GEN_PASS_DEF_LINALGELEMENTWISEOPFUSION +namespace impl { + +template +class LinalgElementwiseOpFusionBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgElementwiseOpFusionBase; + + LinalgElementwiseOpFusionBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgElementwiseOpFusionBase(const LinalgElementwiseOpFusionBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-fuse-elementwise-ops"); + } + ::llvm::StringRef getArgument() const override { return "linalg-fuse-elementwise-ops"; } + + ::llvm::StringRef getDescription() const override { return "Fuse elementwise operations on tensors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgElementwiseOpFusion"); + } + ::llvm::StringRef getName() const override { return "LinalgElementwiseOpFusion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgElementwiseOpFusionBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGELEMENTWISEOPFUSION +#endif // GEN_PASS_DEF_LINALGELEMENTWISEOPFUSION + +//===----------------------------------------------------------------------===// +// LinalgFoldUnitExtentDims +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGFOLDUNITEXTENTDIMS +struct LinalgFoldUnitExtentDimsOptions { + bool useRankReducingSlices = false; +}; +#undef GEN_PASS_DECL_LINALGFOLDUNITEXTENTDIMS +#endif // GEN_PASS_DECL_LINALGFOLDUNITEXTENTDIMS +#ifdef GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMS +namespace impl { + +template +class LinalgFoldUnitExtentDimsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgFoldUnitExtentDimsBase; + + LinalgFoldUnitExtentDimsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgFoldUnitExtentDimsBase(const LinalgFoldUnitExtentDimsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-fold-unit-extent-dims"); + } + ::llvm::StringRef getArgument() const override { return "linalg-fold-unit-extent-dims"; } + + ::llvm::StringRef getDescription() const override { return "Remove unit-extent dimension in Linalg ops on tensors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgFoldUnitExtentDims"); + } + ::llvm::StringRef getName() const override { return "LinalgFoldUnitExtentDims"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgFoldUnitExtentDimsBase) + + LinalgFoldUnitExtentDimsBase(const LinalgFoldUnitExtentDimsOptions &options) : LinalgFoldUnitExtentDimsBase() { + useRankReducingSlices = options.useRankReducingSlices; + } +protected: + ::mlir::Pass::Option useRankReducingSlices{*this, "use-rank-reducing-slices", ::llvm::cl::desc("Generate rank-reducing slices instead of reassociative reshapes"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMS +#endif // GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMS + +//===----------------------------------------------------------------------===// +// LinalgGeneralization +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGGENERALIZATION +#undef GEN_PASS_DECL_LINALGGENERALIZATION +#endif // GEN_PASS_DECL_LINALGGENERALIZATION +#ifdef GEN_PASS_DEF_LINALGGENERALIZATION +namespace impl { + +template +class LinalgGeneralizationBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgGeneralizationBase; + + LinalgGeneralizationBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgGeneralizationBase(const LinalgGeneralizationBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-generalize-named-ops"); + } + ::llvm::StringRef getArgument() const override { return "linalg-generalize-named-ops"; } + + ::llvm::StringRef getDescription() const override { return "Convert named ops into generic ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgGeneralization"); + } + ::llvm::StringRef getName() const override { return "LinalgGeneralization"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgGeneralizationBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGGENERALIZATION +#endif // GEN_PASS_DEF_LINALGGENERALIZATION + +//===----------------------------------------------------------------------===// +// LinalgInlineScalarOperands +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGINLINESCALAROPERANDS +#undef GEN_PASS_DECL_LINALGINLINESCALAROPERANDS +#endif // GEN_PASS_DECL_LINALGINLINESCALAROPERANDS +#ifdef GEN_PASS_DEF_LINALGINLINESCALAROPERANDS +namespace impl { + +template +class LinalgInlineScalarOperandsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgInlineScalarOperandsBase; + + LinalgInlineScalarOperandsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgInlineScalarOperandsBase(const LinalgInlineScalarOperandsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-inline-scalar-operands"); + } + ::llvm::StringRef getArgument() const override { return "linalg-inline-scalar-operands"; } + + ::llvm::StringRef getDescription() const override { return "Inline scalar operands into linalg generic ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgInlineScalarOperands"); + } + ::llvm::StringRef getName() const override { return "LinalgInlineScalarOperands"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgInlineScalarOperandsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGINLINESCALAROPERANDS +#endif // GEN_PASS_DEF_LINALGINLINESCALAROPERANDS + +//===----------------------------------------------------------------------===// +// LinalgLowerToAffineLoops +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGLOWERTOAFFINELOOPS +#undef GEN_PASS_DECL_LINALGLOWERTOAFFINELOOPS +#endif // GEN_PASS_DECL_LINALGLOWERTOAFFINELOOPS +#ifdef GEN_PASS_DEF_LINALGLOWERTOAFFINELOOPS +namespace impl { + +template +class LinalgLowerToAffineLoopsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgLowerToAffineLoopsBase; + + LinalgLowerToAffineLoopsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgLowerToAffineLoopsBase(const LinalgLowerToAffineLoopsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-linalg-to-affine-loops"); + } + ::llvm::StringRef getArgument() const override { return "convert-linalg-to-affine-loops"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the linalg dialect into affine loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgLowerToAffineLoops"); + } + ::llvm::StringRef getName() const override { return "LinalgLowerToAffineLoops"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgLowerToAffineLoopsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGLOWERTOAFFINELOOPS +#endif // GEN_PASS_DEF_LINALGLOWERTOAFFINELOOPS + +//===----------------------------------------------------------------------===// +// LinalgLowerToLoops +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGLOWERTOLOOPS +#undef GEN_PASS_DECL_LINALGLOWERTOLOOPS +#endif // GEN_PASS_DECL_LINALGLOWERTOLOOPS +#ifdef GEN_PASS_DEF_LINALGLOWERTOLOOPS +namespace impl { + +template +class LinalgLowerToLoopsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgLowerToLoopsBase; + + LinalgLowerToLoopsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgLowerToLoopsBase(const LinalgLowerToLoopsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-linalg-to-loops"); + } + ::llvm::StringRef getArgument() const override { return "convert-linalg-to-loops"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the linalg dialect into loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgLowerToLoops"); + } + ::llvm::StringRef getName() const override { return "LinalgLowerToLoops"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgLowerToLoopsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGLOWERTOLOOPS +#endif // GEN_PASS_DEF_LINALGLOWERTOLOOPS + +//===----------------------------------------------------------------------===// +// LinalgLowerToParallelLoops +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGLOWERTOPARALLELLOOPS +#undef GEN_PASS_DECL_LINALGLOWERTOPARALLELLOOPS +#endif // GEN_PASS_DECL_LINALGLOWERTOPARALLELLOOPS +#ifdef GEN_PASS_DEF_LINALGLOWERTOPARALLELLOOPS +namespace impl { + +template +class LinalgLowerToParallelLoopsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgLowerToParallelLoopsBase; + + LinalgLowerToParallelLoopsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgLowerToParallelLoopsBase(const LinalgLowerToParallelLoopsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-linalg-to-parallel-loops"); + } + ::llvm::StringRef getArgument() const override { return "convert-linalg-to-parallel-loops"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the linalg dialect into parallel loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgLowerToParallelLoops"); + } + ::llvm::StringRef getName() const override { return "LinalgLowerToParallelLoops"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgLowerToParallelLoopsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGLOWERTOPARALLELLOOPS +#endif // GEN_PASS_DEF_LINALGLOWERTOPARALLELLOOPS + +//===----------------------------------------------------------------------===// +// LinalgNamedOpConversion +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LINALGNAMEDOPCONVERSION +#undef GEN_PASS_DECL_LINALGNAMEDOPCONVERSION +#endif // GEN_PASS_DECL_LINALGNAMEDOPCONVERSION +#ifdef GEN_PASS_DEF_LINALGNAMEDOPCONVERSION +namespace impl { + +template +class LinalgNamedOpConversionBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgNamedOpConversionBase; + + LinalgNamedOpConversionBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgNamedOpConversionBase(const LinalgNamedOpConversionBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-named-op-conversion"); + } + ::llvm::StringRef getArgument() const override { return "linalg-named-op-conversion"; } + + ::llvm::StringRef getDescription() const override { return "Convert from one named linalg op to another."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgNamedOpConversion"); + } + ::llvm::StringRef getName() const override { return "LinalgNamedOpConversion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgNamedOpConversionBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LINALGNAMEDOPCONVERSION +#endif // GEN_PASS_DEF_LINALGNAMEDOPCONVERSION +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// ConvertElementwiseToLinalg Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertElementwiseToLinalg() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertElementwiseToLinalgPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertElementwiseToLinalgPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertElementwiseToLinalgPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgBufferize Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgBufferize() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgBufferizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgBufferizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgBufferizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgDetensorize Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgDetensorize() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgDetensorizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgDetensorizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgDetensorizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgElementwiseOpFusion Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgElementwiseOpFusion() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgElementwiseOpFusionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgElementwiseOpFusionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgElementwiseOpFusionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgFoldUnitExtentDims Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgFoldUnitExtentDims() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgFoldUnitExtentDimsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgFoldUnitExtentDimsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgFoldUnitExtentDimsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgGeneralization Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgGeneralization() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgGeneralizationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgGeneralizationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgGeneralizationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgInlineScalarOperands Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgInlineScalarOperands() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgInlineScalarOperandsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgInlineScalarOperandsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgInlineScalarOperandsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgLowerToAffineLoops Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgLowerToAffineLoops() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertLinalgToAffineLoopsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgLowerToAffineLoopsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertLinalgToAffineLoopsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgLowerToLoops Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgLowerToLoops() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertLinalgToLoopsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgLowerToLoopsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertLinalgToLoopsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgLowerToParallelLoops Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgLowerToParallelLoops() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertLinalgToParallelLoopsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgLowerToParallelLoopsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createConvertLinalgToParallelLoopsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LinalgNamedOpConversion Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgNamedOpConversion() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgNamedOpConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLinalgNamedOpConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::createLinalgNamedOpConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// Linalg Registration +//===----------------------------------------------------------------------===// + +inline void registerLinalgPasses() { + registerConvertElementwiseToLinalg(); + registerLinalgBufferize(); + registerLinalgDetensorize(); + registerLinalgElementwiseOpFusion(); + registerLinalgFoldUnitExtentDims(); + registerLinalgGeneralization(); + registerLinalgInlineScalarOperands(); + registerLinalgLowerToAffineLoops(); + registerLinalgLowerToLoops(); + registerLinalgLowerToParallelLoops(); + registerLinalgNamedOpConversion(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class ConvertElementwiseToLinalgBase : public ::mlir::OperationPass<> { +public: + using Base = ConvertElementwiseToLinalgBase; + + ConvertElementwiseToLinalgBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ConvertElementwiseToLinalgBase(const ConvertElementwiseToLinalgBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-elementwise-to-linalg"); + } + ::llvm::StringRef getArgument() const override { return "convert-elementwise-to-linalg"; } + + ::llvm::StringRef getDescription() const override { return "Convert ElementwiseMappable ops to linalg"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertElementwiseToLinalg"); + } + ::llvm::StringRef getName() const override { return "ConvertElementwiseToLinalg"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertElementwiseToLinalgBase) + +protected: +}; + +template +class LinalgBufferizeBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgBufferizeBase; + + LinalgBufferizeBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgBufferizeBase(const LinalgBufferizeBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "linalg-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Bufferize the linalg dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgBufferize"); + } + ::llvm::StringRef getName() const override { return "LinalgBufferize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgBufferizeBase) + +protected: +}; + +template +class LinalgDetensorizeBase : public ::mlir::InterfacePass { +public: + using Base = LinalgDetensorizeBase; + + LinalgDetensorizeBase() : ::mlir::InterfacePass(::mlir::TypeID::get()) {} + LinalgDetensorizeBase(const LinalgDetensorizeBase &other) : ::mlir::InterfacePass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-detensorize"); + } + ::llvm::StringRef getArgument() const override { return "linalg-detensorize"; } + + ::llvm::StringRef getDescription() const override { return "Detensorize linalg ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgDetensorize"); + } + ::llvm::StringRef getName() const override { return "LinalgDetensorize"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgDetensorizeBase) + +protected: + ::mlir::Pass::Option aggressiveMode{*this, "aggressive-mode", ::llvm::cl::desc("Detensorize all ops that qualify for detensoring along with branch operands and basic-block arguments."), ::llvm::cl::init(false)}; +}; + +template +class LinalgElementwiseOpFusionBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgElementwiseOpFusionBase; + + LinalgElementwiseOpFusionBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgElementwiseOpFusionBase(const LinalgElementwiseOpFusionBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-fuse-elementwise-ops"); + } + ::llvm::StringRef getArgument() const override { return "linalg-fuse-elementwise-ops"; } + + ::llvm::StringRef getDescription() const override { return "Fuse elementwise operations on tensors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgElementwiseOpFusion"); + } + ::llvm::StringRef getName() const override { return "LinalgElementwiseOpFusion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgElementwiseOpFusionBase) + +protected: +}; + +template +class LinalgFoldUnitExtentDimsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgFoldUnitExtentDimsBase; + + LinalgFoldUnitExtentDimsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgFoldUnitExtentDimsBase(const LinalgFoldUnitExtentDimsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-fold-unit-extent-dims"); + } + ::llvm::StringRef getArgument() const override { return "linalg-fold-unit-extent-dims"; } + + ::llvm::StringRef getDescription() const override { return "Remove unit-extent dimension in Linalg ops on tensors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgFoldUnitExtentDims"); + } + ::llvm::StringRef getName() const override { return "LinalgFoldUnitExtentDims"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgFoldUnitExtentDimsBase) + +protected: + ::mlir::Pass::Option useRankReducingSlices{*this, "use-rank-reducing-slices", ::llvm::cl::desc("Generate rank-reducing slices instead of reassociative reshapes"), ::llvm::cl::init(false)}; +}; + +template +class LinalgGeneralizationBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgGeneralizationBase; + + LinalgGeneralizationBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgGeneralizationBase(const LinalgGeneralizationBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-generalize-named-ops"); + } + ::llvm::StringRef getArgument() const override { return "linalg-generalize-named-ops"; } + + ::llvm::StringRef getDescription() const override { return "Convert named ops into generic ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgGeneralization"); + } + ::llvm::StringRef getName() const override { return "LinalgGeneralization"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgGeneralizationBase) + +protected: +}; + +template +class LinalgInlineScalarOperandsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgInlineScalarOperandsBase; + + LinalgInlineScalarOperandsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgInlineScalarOperandsBase(const LinalgInlineScalarOperandsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-inline-scalar-operands"); + } + ::llvm::StringRef getArgument() const override { return "linalg-inline-scalar-operands"; } + + ::llvm::StringRef getDescription() const override { return "Inline scalar operands into linalg generic ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgInlineScalarOperands"); + } + ::llvm::StringRef getName() const override { return "LinalgInlineScalarOperands"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgInlineScalarOperandsBase) + +protected: +}; + +template +class LinalgLowerToAffineLoopsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgLowerToAffineLoopsBase; + + LinalgLowerToAffineLoopsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgLowerToAffineLoopsBase(const LinalgLowerToAffineLoopsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-linalg-to-affine-loops"); + } + ::llvm::StringRef getArgument() const override { return "convert-linalg-to-affine-loops"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the linalg dialect into affine loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgLowerToAffineLoops"); + } + ::llvm::StringRef getName() const override { return "LinalgLowerToAffineLoops"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgLowerToAffineLoopsBase) + +protected: +}; + +template +class LinalgLowerToLoopsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgLowerToLoopsBase; + + LinalgLowerToLoopsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgLowerToLoopsBase(const LinalgLowerToLoopsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-linalg-to-loops"); + } + ::llvm::StringRef getArgument() const override { return "convert-linalg-to-loops"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the linalg dialect into loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgLowerToLoops"); + } + ::llvm::StringRef getName() const override { return "LinalgLowerToLoops"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgLowerToLoopsBase) + +protected: +}; + +template +class LinalgLowerToParallelLoopsBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgLowerToParallelLoopsBase; + + LinalgLowerToParallelLoopsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgLowerToParallelLoopsBase(const LinalgLowerToParallelLoopsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-linalg-to-parallel-loops"); + } + ::llvm::StringRef getArgument() const override { return "convert-linalg-to-parallel-loops"; } + + ::llvm::StringRef getDescription() const override { return "Lower the operations from the linalg dialect into parallel loops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgLowerToParallelLoops"); + } + ::llvm::StringRef getName() const override { return "LinalgLowerToParallelLoops"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgLowerToParallelLoopsBase) + +protected: +}; + +template +class LinalgNamedOpConversionBase : public ::mlir::OperationPass<> { +public: + using Base = LinalgNamedOpConversionBase; + + LinalgNamedOpConversionBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + LinalgNamedOpConversionBase(const LinalgNamedOpConversionBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("linalg-named-op-conversion"); + } + ::llvm::StringRef getArgument() const override { return "linalg-named-op-conversion"; } + + ::llvm::StringRef getDescription() const override { return "Convert from one named linalg op to another."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LinalgNamedOpConversion"); + } + ::llvm::StringRef getName() const override { return "LinalgNamedOpConversion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgNamedOpConversionBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..3afe2cd0d32f870a883e53cd0643f3dacfd0a176 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h @@ -0,0 +1,20 @@ +//===- BufferizableOpInterfaceImpl.h - Impl. of BufferizableOpInterface ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_BUFFERIZABLEOPINTERFACEIMPL_H +#define MLIR_DIALECT_LINALG_BUFFERIZABLEOPINTERFACEIMPL_H + +namespace mlir { +class DialectRegistry; + +namespace linalg { +void registerBufferizableOpInterfaceExternalModels(DialectRegistry ®istry); +} // namespace linalg +} // namespace mlir + +#endif // MLIR_DIALECT_LINALG_BUFFERIZABLEOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h new file mode 100644 index 0000000000000000000000000000000000000000..d4444c3f869e5ccec3d7d994d4cd05def8d69778 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h @@ -0,0 +1,154 @@ +//===- Hoisting.h - Linalg hoisting transformations -------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_TRANSFORMS_HOISTING_H_ +#define MLIR_DIALECT_LINALG_TRANSFORMS_HOISTING_H_ + +namespace mlir { +class RewriterBase; +namespace func { +class FuncOp; +} // namespace func +namespace scf { +class ForOp; +} // namespace scf + +namespace linalg { + +/// Hoist vector.transfer_read/vector.transfer_write on buffers pairs out of +/// immediately enclosing scf::ForOp iteratively, if the following conditions +/// are true: +/// 1. The two ops access the same memref with the same indices. +/// 2. All operands are invariant under the enclosing scf::ForOp. +/// 3. No uses of the memref either dominate the transfer_read or are +/// dominated by the transfer_write (i.e. no aliasing between the write and +/// the read across the loop) +/// 4. The source operands for vector.transfer_{read|write} do not originate +/// from Ops implementing ViewLikeOpInterface (to reduce the risk of +/// aliasing). +/// To improve hoisting opportunities, call the `moveLoopInvariantCode` helper +/// function on the candidate loop above which to hoist. Hoisting the transfers +/// results in scf::ForOp yielding the value that originally transited through +/// memory. +/// +/// TODO: To further improve hoisting opportunities, fold aliasing memref +/// operations into respective vector.transfer{read|write} operations and +/// avoid using ops implementing ViewLikeOpInterface as the source for transfer +/// Ops. +/// +/// WARNING: This hoisting does not model parallelism and is generally incorrect +/// when used on distributed loops with memref semantics! +void hoistRedundantVectorTransfers(func::FuncOp func); + +/// Greedily hoist redundant subset extract/insert operations on tensors outside +/// of `forOp`. The logic follows: +/// 1. Look for a write walking back from the `forOp` yield. +/// 2. Check the uses of the matching block argument and look for a matching +/// read (i.e. extract_slice of transfer_read) with matching indices. +/// 3. In the case of a transfer_write, we can bypass other non-conflicting +/// operations and find more hoisting opportunities. +/// 4. Hoist the read/write pair and update the tensor SSA links. +/// +/// Return the unmodified `forOp` if no hoisting occured. +/// Return a new scf::ForOp if hoisting on tensors occured. +/// +/// After this transformation the returned scf::ForOp may have unused arguments +/// that can be removed by application of canonicalization patterns. +/// +/// Example: +/// ======== +/// IR Resembling: +/// +/// ``` +/// %0 = scf.for %i = %l to %u step %s iter_args(%a0 = %t0)->(tensor<10xf32>) { +/// %1 = scf.for %j = %l to %u step %s iter_args(%a6 = %a0)->(tensor<10xf32>) { +/// %e = tensor.extract_slice %a6[%i][%sz][1]: tensor<10xf32> to tensor +/// %r = vector.transfer_read %e[%c0], %cst: tensor, vector<4xf32> +/// %u = "some_use"(%r) : (vector<4xf32>) -> vector<4xf32> +/// %w = vector.transfer_write %u, %e[%c0] : vector<4xf32>, tensor +/// %st = tensor.insert_slice %w into %a6[%i][%sz][1] +/// : tensor into tensor<10xf32> +/// scf.yield %st: tensor<10xf32> +/// } +/// scf.yield %1: tensor<10xf32> +/// } +/// ``` +/// +/// Progressively hoists to: +/// +/// ``` +/// %0 = scf.for %i = %l to %u step %s iter_args(%a0 = %t0) -> (tensor<10xf32>){ +/// %e = tensor.extract_slice %a0[%i][%sz][1]: tensor<10xf32> to tensor +/// %1:2 = scf.for %j = %l to %u step %s iter_args(%a6 = a0, %a7 = %e) +/// -> (tensor<10xf32>, tensor) { +/// %r = vector.transfer_read %a7[%c0], %cst: tensor, vector<4xf32> +/// %u = "some_use"(%r) : (vector<4xf32>) -> vector<4xf32> +/// %w = vector.transfer_write %u, %a7[%c0] : vector<4xf32>, tensor +/// scf.yield %a6, %w: tensor<10xf32>, tensor +/// } +/// %st = tensor.insert_slice %1#1 into %1#0[%i][%sz][1] +/// : tensor into tensor<10xf32> +/// scf.yield %1: tensor<10xf32> +/// } +/// ``` +/// +/// and +/// +/// ``` +/// %0 = scf.for %i = %l to %u step %s iter_args(%a0 = %t0) -> (tensor<10xf32>){ +/// %e = tensor.extract_slice %a0[%i][%sz][1]: tensor<10xf32> to tensor +/// %r = vector.transfer_read %a7[%c0], %cst: tensor, vector<4xf32> +/// %1:3 = scf.for %j = %l to %u step %s iter_args(%a6 = a0, %a7 = %e, %a7 = r) +/// -> (tensor<10xf32>, tensor, vector<4xf32>) { +/// %u = "some_use"(%r) : (vector<4xf32>) -> vector<4xf32> +/// scf.yield %a6, %a7, %u: tensor<10xf32>, tensor, vector<4xf32> +/// } +/// %w = vector.transfer_write %1#2, %1#1[%c0] : vector<4xf32>, tensor +/// %st = tensor.insert_slice %w into %1#0[%i][%sz][1] +/// : tensor into tensor<10xf32> +/// scf.yield %1: tensor<10xf32> +/// } +/// ``` +/// +/// It can then canonicalize to: +/// +/// ``` +/// %0 = scf.for %i = %l to %u step %s iter_args(%a0 = %t0) -> (tensor<10xf32>){ +/// %e = tensor.extract_slice %a0[%i][%sz][1]: tensor<10xf32> to tensor +/// %r = vector.transfer_read %a7[%c0], %cst: tensor, vector<4xf32> +/// %1 = scf.for %j = %l to %u step %s iter_args(%a7 = r) +/// -> (tensor<10xf32>, tensor, vector<4xf32>) { +/// %u = "some_use"(%r) : (vector<4xf32>) -> vector<4xf32> +/// scf.yield %u: vector<4xf32> +/// } +/// %w = vector.transfer_write %1, %e[%c0] : vector<4xf32>, tensor +/// %st = tensor.insert_slice %w into %a0[%i][%sz][1] +/// : tensor into tensor<10xf32> +/// scf.yield %1: tensor<10xf32> +/// } +/// ``` +/// +// TODO: This should be further generalized along a few different axes: +// - Other loops than scf.ForOp that operate on tensors (both sequential and +// parallel loops). +// - Other subset extract/insert pairs than tensor.extract/insert_slice and +// vector.transfer_read/write. +// - More general areSubsetDisjoint analysis/interface to work across all +// subset op types and allow bypassing non-WAW-conflicting operations in +// more cases. +scf::ForOp hoistRedundantSubsetExtractInsert(RewriterBase &rewriter, + scf::ForOp forOp); + +/// Call into `hoistRedundantSubsetInsertExtract` without a RewriterBase. +// TODO: obsolete and should be retired +void hoistRedundantVectorTransfersOnTensor(func::FuncOp func); + +} // namespace linalg +} // namespace mlir + +#endif // MLIR_DIALECT_LINALG_TRANSFORMS_HOISTING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/SubsetInsertionOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/SubsetInsertionOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..023a46df26201091efb9058cdc9f39c2d48f22b1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/SubsetInsertionOpInterfaceImpl.h @@ -0,0 +1,21 @@ +//===- SubsetInsertionOpInterfaceImpl.h - Tensor subsets --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_SUBSETINSERTIONOPINTERFACEIMPL_H +#define MLIR_DIALECT_LINALG_SUBSETINSERTIONOPINTERFACEIMPL_H + +namespace mlir { +class DialectRegistry; + +namespace linalg { +void registerSubsetInsertionOpInterfaceExternalModels( + DialectRegistry ®istry); +} // namespace linalg +} // namespace mlir + +#endif // MLIR_DIALECT_LINALG_SUBSETINSERTIONOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/TilingInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/TilingInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..5b88f1d05ce84d289e49092817ef7c3fff8cd3fa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/TilingInterfaceImpl.h @@ -0,0 +1,20 @@ +//===- TilingInterfaceImpl.h - Implementation of TilingInterface ----------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_TILINGINTERFACEIMPL_H +#define MLIR_DIALECT_LINALG_TILINGINTERFACEIMPL_H + +namespace mlir { +class DialectRegistry; + +namespace linalg { +void registerTilingInterfaceExternalModels(DialectRegistry ®istry); +} // namespace linalg +} // namespace mlir + +#endif // MLIR_DIALECT_LINALG_TILINGINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..07a192f7b8606d30adb22919a53936075e78087d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h @@ -0,0 +1,1569 @@ +//===- Transforms.h - Linalg transformations as patterns --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_TRANSFORMS_TRANSFORMS_H +#define MLIR_DIALECT_LINALG_TRANSFORMS_TRANSFORMS_H + +#include + +#include "mlir/Conversion/VectorToSCF/VectorToSCF.h" +#include "mlir/Dialect/Linalg/Utils/Utils.h" +#include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/Dialect/SCF/Utils/Utils.h" +#include "mlir/Dialect/Tensor/IR/Tensor.h" +#include "mlir/Dialect/Utils/StaticValueUtils.h" +#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h" +#include "mlir/Dialect/X86Vector/Transforms.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Interfaces/TilingInterface.h" +#include "mlir/Support/LogicalResult.h" +#include "mlir/Transforms/DialectConversion.h" +#include "llvm/ADT/SmallBitVector.h" +#include "llvm/ADT/SmallSet.h" + +namespace mlir { +namespace bufferization { +class OneShotAnalysisState; +} // namespace bufferization + +namespace linalg { + +class LinalgOp; + +//===----------------------------------------------------------------------===// +// Utils. +//===----------------------------------------------------------------------===// + +/// Return vector::CombiningKind for the given op. +std::optional getCombinerOpKind(Operation *combinerOp); + +//===----------------------------------------------------------------------===// +// Bufferization-related transforms. +//===----------------------------------------------------------------------===// + +struct BufferizeToAllocationOptions { + enum class AllocOp { MemrefAlloc = 0, MemrefAlloca = 1 }; + AllocOp allocOp = AllocOp::MemrefAlloc; + + enum class MemcpyOp { MemrefTensorStore = 0, MemrefCopy = 1, LinalgCopy = 2 }; + MemcpyOp memcpyOp = MemcpyOp::MemrefTensorStore; + + /// If set to "true", only the destination tensor operands are bufferized to + /// a new allocation (and wrapped in "bufferization.to_tensor"), but not the + /// targeted op itself. + bool bufferizeDestinationOnly = false; + + /// If set to "true", a `memref.dealloc` operation will be emitted for each + /// allocated buffer. Otherwise, the memory is leaked, which is useful if + /// the buffer deallocation pipeline should be run after bufferization is + /// done. + bool emitDealloc = false; +}; + +/// Materialize a buffer allocation for the given tensor.pad op and lower the +/// op to linalg.fill/linalg.generic + memref.tensor_store. E.g.: +/// +/// %0 = tensor.pad low[%l] high[%h] %t ... +/// +/// is lowered to: +/// +/// %alloc = memref.alloc +/// linalg.fill ... outs(%alloc) +/// %subview = memref.subview %alloc [%l] [...] [1] +/// memref.tensor_store %t, %subview +/// %0 = bufferization.to_tensor %alloc restrict writable +/// +/// In addition to rewriting the IR as shown above, this function returns the +/// newly allocated buffer. The `insertionPoint` parameter can be used to +/// specify a custom insertion point for the buffer allocation. +Value bufferizeToAllocation(RewriterBase &rewriter, + const BufferizeToAllocationOptions &options, + tensor::PadOp padOp, Attribute memorySpace = {}, + Operation *insertionPoint = nullptr); + +/// Materialize a buffer allocation for the given vector.mask op and bufferize +/// the op, including its region. E.g.: +/// +/// %0 = vector.mask { +/// vector.transfer_write %v, %t : vector<16xf32>, tensor +/// } : vector<16xi1> -> tensor +/// +/// is lowered to: +/// +/// %alloc = memref.alloc +/// memref.tensor_store %t, %subview +/// vector.mask { +/// vector.transfer_write %arg0, %alloc : vector<16xf32>, memref +/// } : vector<16xi1> +/// %0 = bufferization.to_tensor %alloc restrict writable +/// +/// In addition to rewriting the IR as shown above, this function returns the +/// newly allocated buffer. The `insertionPoint` parameter can be used to +/// specify a custom insertion point for the buffer allocation. +Value bufferizeToAllocation(RewriterBase &rewriter, + const BufferizeToAllocationOptions &options, + vector::MaskOp maskOp, Attribute memorySpace = {}, + Operation *insertionPoint = nullptr); + +/// Bufferize the given op with tensor semantics and materialize the result in +/// a newly allocated buffer. +/// +/// Only bufferizable ops that bufferize to a memory write or have an +/// aliasing OpOperand (and do not themselves bufferize to an allocation) are +/// supported. They are bufferized using their BufferizableOpInterface +/// implementation. +/// +/// Selected ops that bufferize to an allocation (or need special handling) are +/// also supported: +/// - tensor.pad +/// - vector.mask +/// +/// This function returns the newly allocated buffer. The `insertionPoint` +/// parameter can be used to specify a custom insertion point for the buffer +/// allocation. +Value bufferizeToAllocation(RewriterBase &rewriter, + const BufferizeToAllocationOptions &options, + Operation *op, Attribute memorySpace = {}, + Operation *insertionPoint = nullptr); + +/// Try to eliminate tensor::EmptyOps inside `op` that are anchored on a +/// LinalgOp. This transforms looks for LinalgOps that have an unused output +/// operand and an input operand that is rooted in a tensor::EmptyOp. The +/// tensor::EmptyOp uses are replaced with the output operand and the two +/// operands of the LinalgOp are swapped. +/// +/// Example: +/// %0 = tensor.empty() +/// %1 = linalg.matmul ins(...) outs(%0) +/// %2 = linalg.generic ins(%1) outs(%dest) { +/// ^bb0(%in: f32, %out: f32): +/// // out not used +/// } +/// +/// The IR is transformed as follows: +/// %0 = tensor.empty() +/// %1 = linalg.matmul ins(...) outs(%dest) +/// %2 = linalg.generic ins(%0) outs(%1) { +/// ^bb0(%in: f32, %out: f32): +/// // Use %out instead of %in +/// } +/// +/// The "ins" operand has no uses inside the body of the LinalgOp and can be +/// folded away with existing cleanup patterns. Afterwards, the tensor::EmptyOp +/// can also fold away. +LogicalResult linalgOpAnchoredEmptyTensorEliminationStep( + RewriterBase &rewriter, Operation *op, + bufferization::OneShotAnalysisState &state); + +//===----------------------------------------------------------------------===// +// Structs that configure the behavior of various transformations. +//===----------------------------------------------------------------------===// + +using TileSizeComputationFunction = + std::function(OpBuilder &, Operation *)>; + +struct LinalgTilingOptions { + /// Computation function that returns the tile sizes for each operation. + /// Delayed construction of constant tile sizes should occur to interoperate + /// with folding. + TileSizeComputationFunction tileSizeComputationFunction = nullptr; + + LinalgTilingOptions & + setTileSizeComputationFunction(TileSizeComputationFunction fun) { + tileSizeComputationFunction = std::move(fun); + return *this; + } + /// Set the `tileSizeComputationFunction` to return the values `ts`. The + /// values must not fold away when tiling. Otherwise, use a more robust + /// `tileSizeComputationFunction`. + LinalgTilingOptions &setTileSizes(const SmallVector &ts) { + tileSizeComputationFunction = [=](OpBuilder &, Operation *) { return ts; }; + return *this; + } + /// Convenience function to set the `tileSizeComputationFunction` to a + /// function that computes tile sizes at the point they are needed. Allows + /// proper interaction with folding. + LinalgTilingOptions &setTileSizes(ArrayRef ts); + + /// Tile all dynamic dimensions by 1. I.e., scalarize those dimensions. + /// Note: `scalarizeDynamicDims` and `setTileSizes` cannot be used together. + LinalgTilingOptions &scalarizeDynamicDims(); + + /// The interchange vector to reorder the tiled loops. + SmallVector interchangeVector = {}; + + LinalgTilingOptions &setInterchange(ArrayRef interchange) { + interchangeVector.assign(interchange.begin(), interchange.end()); + return *this; + } + + /// The type of tile loops to generate. + LinalgTilingLoopType loopType = LinalgTilingLoopType::Loops; + + LinalgTilingOptions &setLoopType(LinalgTilingLoopType lt) { + loopType = lt; + return *this; + } + + /// When specified, specifies distribution of generated tile loops to + /// processors. + std::optional distribution; + + LinalgTilingOptions & + setDistributionOptions(LinalgLoopDistributionOptions distributionOptions) { + distribution = std::move(distributionOptions); + return *this; + } + + /// Specification markers of how to distribute the `linalg.tiled_loop`. + SmallVector distributionTypes = {}; + + LinalgTilingOptions &setDistributionTypes(ArrayRef types) { + distributionTypes.assign(types.begin(), types.end()); + return *this; + } + + /// Peel the specified loops. + SmallVector peeledLoops; + + LinalgTilingOptions &setPeeledLoops(ArrayRef loops) { + peeledLoops.clear(); + peeledLoops.append(loops.begin(), loops.end()); + return *this; + } +}; + +struct LinalgTilingAndFusionOptions { + /// Tile sizes used to tile the root operation. + SmallVector tileSizes; + LinalgTilingAndFusionOptions &setTileSizes(ArrayRef ts) { + tileSizes.assign(ts.begin(), ts.end()); + return *this; + } + /// Tile interchange used to permute the tile loops. + SmallVector tileInterchange; + /// When specified, specifies distribution of generated tile loops to + /// processors. + std::optional tileDistribution; + LinalgTilingAndFusionOptions & + setDistributionOptions(LinalgLoopDistributionOptions distributionOptions) { + tileDistribution = std::move(distributionOptions); + return *this; + } +}; + +struct LinalgPaddingOptions { + /// A padding value for every operand. + SmallVector paddingValues; + LinalgPaddingOptions &setPaddingValues(ArrayRef pv) { + paddingValues.assign(pv.begin(), pv.end()); + return *this; + } + /// A list of iterator dimensions to pad. + SmallVector paddingDimensions; + LinalgPaddingOptions &setPaddingDimensions(ArrayRef pd) { + paddingDimensions.assign(pd.begin(), pd.end()); + return *this; + } + /// A list of multiples to which each padding dimension should be padded to. + std::optional> padToMultipleOf; + LinalgPaddingOptions &setPadToMultipleOf(ArrayRef m) { + padToMultipleOf.emplace(m.begin(), m.end()); + return *this; + } + /// A flag for every operand to mark the PadOp as nofold which enables + /// packing for statically shaped operands. + SmallVector packPaddings; + LinalgPaddingOptions &setPackPaddings(ArrayRef pp) { + packPaddings.assign(pp.begin(), pp.end()); + return *this; + } + /// A number of loops to hoist the PadOp out for every operand. + SmallVector hoistPaddings; + LinalgPaddingOptions &setHoistPaddings(ArrayRef hp) { + hoistPaddings.assign(hp.begin(), hp.end()); + return *this; + } + /// A permutation vector for every operand used to transpose the packed + /// PadOp results. + SmallVector> transposePaddings; + LinalgPaddingOptions & + setTransposePaddings(ArrayRef> tp) { + transposePaddings.assign(tp.begin(), tp.end()); + return *this; + } + enum class CopyBackOp : int8_t { + None = 0, + BufferizationMaterializeInDestination = 1, + LinalgCopy = 2 + }; + /// The op to be used for copying the padded result to the original + /// destination tensor. + CopyBackOp copyBackOp = CopyBackOp::BufferizationMaterializeInDestination; + LinalgPaddingOptions &setCopyBackOp(CopyBackOp op) { + copyBackOp = op; + return *this; + } +}; + +/// Callback function type used to perform the allocation for the promoted +/// `subView`. In `boundingSubViewsize` a best attempt is made to find the +/// smallest constant value for the size of the buffer needed for each +/// dimension. If that is not possible, contains the dynamic size of the +/// subview. The call back should return the buffer to use. +using AllocBufferCallbackFn = std::function( + OpBuilder &b, memref::SubViewOp subView, + ArrayRef boundingSubViewSize, DataLayout &layout)>; + +/// Callback function type used to deallocate the buffers used to hold the +/// promoted subview. +using DeallocBufferCallbackFn = + std::function; + +/// Callback function type used to insert copy from original subview to +/// subview of the promoted region for the read operands/subview of promoted +/// region to original subview for the results. The copy has to happen from +/// `src` to `dst`. +using CopyCallbackFn = + std::function; + +struct LinalgPromotionOptions { + /// Indices of subViews to promote. If `std::nullopt`, try to promote all + /// operands. + std::optional> operandsToPromote; + LinalgPromotionOptions &setOperandsToPromote(ArrayRef operands) { + operandsToPromote = DenseSet(); + operandsToPromote->insert(operands.begin(), operands.end()); + return *this; + } + /// If ith element of `useFullTiles` is true the full view should be used + /// for the promoted buffer of the ith operand in `operandsToPromote`. + /// Otherwise the partial view will be used. The decision is defaulted to + /// `useFullTileBuffersDefault` when `useFullTileBuffers` is std::nullopt and + /// for operands missing from `useFullTileBuffers`. + std::optional useFullTileBuffers; + LinalgPromotionOptions &setUseFullTileBuffers(ArrayRef useFullTiles) { + unsigned size = useFullTiles.size(); + llvm::SmallBitVector tmp(size, false); + for (unsigned i = 0; i < size; ++i) + tmp[i] = useFullTiles[i]; + useFullTileBuffers = tmp; + return *this; + } + /// If true all operands unspecified by `useFullTileBuffers` will use the + /// full view, otherwise the partial view. + bool useFullTileBuffersDefault = false; + LinalgPromotionOptions &setUseFullTileBuffersByDefault(bool use) { + useFullTileBuffersDefault = use; + return *this; + } + /// Alignment of promoted buffer. If `std::nullopt` do not specify alignment. + std::optional alignment; + LinalgPromotionOptions &setAlignment(unsigned align) { + alignment = align; + return *this; + } + /// Memory space of promoted buffer. If `std::nullopt` do not specify memory + /// space. + std::optional memorySpace; + LinalgPromotionOptions &setMemorySpace(Attribute memorySpc) { + memorySpace = memorySpc; + return *this; + } + /// Use alloca with the default allocation scheme. + bool useAlloca = false; + LinalgPromotionOptions &setUseAlloca(bool use) { + useAlloca = use; + return *this; + } + /// Callback function to do the allocation of the promoted buffer. If + /// std::nullopt, then the default allocation scheme of allocating a + /// memref buffer followed by a view operation is used. + std::optional allocationFn; + std::optional deallocationFn; + LinalgPromotionOptions & + setAllocationDeallocationFns(AllocBufferCallbackFn const &allocFn, + DeallocBufferCallbackFn const &deallocFn) { + allocationFn = allocFn; + deallocationFn = deallocFn; + return *this; + } + /// Callback function to do the copy of data to and from the promoted + /// subview. If std::nullopt then a memref.copy is used. + std::optional copyInFn; + std::optional copyOutFn; + LinalgPromotionOptions &setCopyInOutFns(CopyCallbackFn const ©In, + CopyCallbackFn const ©Out) { + copyInFn = copyIn; + copyOutFn = copyOut; + return *this; + } +}; + +/// Split Reduction options. +struct SplitReductionOptions { + // Ratio used to split the reduction dimension. If the ratio is <= 1, + // nothing will be done. + int64_t ratio = 0; + // Index where the extra dimension is added to the intermediate tensor + // shape. + unsigned index = 0; + // If the inner dimension after splitting is parallel or reduction. + bool innerParallel = false; +}; + +/// Function signature to control reduction splitting. This returns +/// `SplitReductionOptions`. +// TODO: don't use unsigned unless doing bit manipulation. +using ControlSplitReductionFn = + std::function; + +//===----------------------------------------------------------------------===// +// Preconditions that ensure the corresponding transformation succeeds and can +// be applied as a rewrite pattern. +//===----------------------------------------------------------------------===// + +/// Return true if two `linalg.generic` operations with producer/consumer +/// relationship through `fusedOperand` can be fused using elementwise op +/// fusion. +bool areElementwiseOpsFusable(OpOperand *fusedOperand); + +/// Promote memref.subviews feeding linalg-on-buffers operations. +LogicalResult promoteSubviewsPrecondition(Operation *op, + LinalgPromotionOptions options); + +/// Return success if the operation can be vectorized. +LogicalResult vectorizeOpPrecondition(Operation *op, + ArrayRef inputVectorSizes = {}, + ArrayRef inputScalableVecDims = {}, + bool vectorizeNDExtract = false); + +//===----------------------------------------------------------------------===// +// Transformations exposed as functional-style API calls. +//===----------------------------------------------------------------------===// + +using LinalgLoops = SmallVector; + +/// Transformation to drop unit-extent dimensions from `linalg.generic` +/// operations. +struct ControlDropUnitDims { + enum class RankReductionStrategy { ReassociativeReshape, ExtractInsertSlice }; + + RankReductionStrategy rankReductionStrategy = + RankReductionStrategy::ReassociativeReshape; + + using ControlFnTy = std::function(Operation *)>; + ControlFnTy controlFn = [](Operation *op) { + if (auto genericOp = dyn_cast_or_null(op)) { + return llvm::to_vector(llvm::seq(0, genericOp.getNumLoops())); + } + return SmallVector{}; + }; +}; +LogicalResult dropUnitDims(RewriterBase &rewriter, GenericOp genericOp, + const ControlDropUnitDims &options); + +/// Fuse two `linalg.generic` operations that have a producer-consumer +/// relationship captured through `fusedOperand`. The method expects +/// that `areElementwiseOpsFusable` returns true for the given `fusedOperand`. +struct ElementwiseOpFusionResult { + Operation *fusedOp; + llvm::DenseMap replacements; +}; +FailureOr +fuseElementwiseOps(RewriterBase &rewriter, OpOperand *fusedOperand); + +/// Try to peel and canonicalize loop `op` and return the new result. +/// Also applies affine_min/max bounds simplification on the fly where relevant. +// TODO: Add support for scf.parallel and affine.for loops. +SmallVector peelLoop(RewriterBase &rewriter, Operation *op); + +/// Peel 'loops' and applies affine_min/max bounds simplification on the fly +/// where relevant. +void peelLoops(RewriterBase &rewriter, ArrayRef loops); + +/// Pad the iterator dimensions `paddingDimensions` of all `opToPad` operands +/// to a static bounding box. The original `opToPad` is cloned and operates on +/// the padded tensors. +/// +/// * "options.padToMultipleOf" indicates that each padding dimension should be +/// padded to the specified multiple. +/// * Use "options.paddingValues" and "options.packPaddings" to set padding +/// value and nofold attribute of the created tensor::PadOps, respectively. +/// * The unpadded results (extracted slice of the cloned operation) are +/// returned via `replacements`. +/// * The tensor::PadOps are returned via `padOps`. +/// * "options.copyBackOp" specifies the op type for copying back the unpadded +/// result to the original destination tensor. +LogicalResult rewriteAsPaddedOp(RewriterBase &rewriter, LinalgOp opToPad, + const LinalgPaddingOptions &options, + LinalgOp &paddedOp, + SmallVector &replacements, + SmallVector &padOps); + +namespace detail { + +/// Helper struct to hold the results of building a packing loop nest. +struct PackingResult { + SmallVector offsets, sizes, strides; + SmallVector clonedLoopIvs, leadingPackedTensorIndexings; + GenericOp maybeTransposeOp; + tensor::PadOp hoistedPadOp; +}; + +/// Build the packing loop nest required to hoist `opToHoist` above +/// `outermostEnclosingForOp`. +/// The loop nest is built just before `outermostEnclosingForOp`. +FailureOr +buildPackingLoopNest(RewriterBase &rewriter, tensor::PadOp opToHoist, + scf::ForOp outermostEnclosingForOp, + ArrayRef transposeVector); + +} // namespace detail + +/// Mechanically hoist padding operations on tensors by `numLoops` into a new, +/// generally larger tensor. This achieves packing of multiple padding ops into +/// a larger tensor. On success, `opToHoist` is replaced by the cloned version +/// in the packing loop so the caller can continue reasoning about the padding +/// operation. If `transposeVector` is non-empty, hoist padding introduces a +/// GenericOp to transpose the padded tensor before inserting it into the packed +/// tensor. A `transposeVector` can change the storage order of the padded +/// tensor but does not change the order of the pack or compute loops. +/// +/// TODO: In the future, we should consider rewriting as a tensor.pack after +/// hoisting since this abstraction is now available. +/// +/// Example in pseudo-mlir: +/// ======================= +/// +/// If hoistPaddingOnTensors is called with `nLoops` = 2 on the following IR. +/// ``` +/// scf.for (%i, %j, %k) +/// %st0 = tensor.extract_slice f(%i, %k) : ... to tensor +/// %0 = tensor.pad %st0 low[0, 0] high[...] { +/// ^bb0( ... ): +/// linalg.yield %pad +/// } : tensor to tensor<4x8xf32> +/// compute(%0) +/// ``` +/// +/// IR resembling the following is produced: +/// +/// ``` +/// scf.for (%i) { +/// %packed_init = tensor.empty range(%j) : tensor +/// %packed = scf.for (%k) iter_args(%p : %packed_init) { +/// %st0 = tensor.extract_slice f(%i, %k) : ... to tensor +/// %0 = tensor.pad %st0 low[0, 0] high[...] { +/// ^bb0( ... ): +/// linalg.yield %pad +/// } : tensor to tensor<4x8xf32> +/// %1 = tensor.insert_slice %0 ... +/// : tensor<4x8xf32> to tensor +/// scf.yield %1: tensor +/// } -> tensor +/// scf.for (%j, %k) { +/// %st0 = tensor.extract_slice %packed [%k, 0, 0][1, 4, 8][1, 1, 1] : +/// tensor to tensor<4x8xf32> +/// compute(%st0) +/// } +/// } +/// ``` +FailureOr +hoistPaddingOnTensors(RewriterBase &rewriter, tensor::PadOp opToHoist, + int64_t numLoops, ArrayRef transposeVector, + tensor::PadOp &hoistedOp, + SmallVectorImpl &transposeOps); +/// Calls into `hoistPaddingOnTensors` with a local IRRewriter. +FailureOr +hoistPaddingOnTensors(tensor::PadOp opToHoist, int64_t numLoops, + ArrayRef transposeVector, + tensor::PadOp &hoistedOp, + SmallVectorImpl &transposeOps); + +/// Apply padding and hoisting to `linalgOp` according to the configuration +/// specified in `options`. +FailureOr padAndHoistLinalgOp(RewriterBase &rewriter, + LinalgOp linalgOp, + const LinalgPaddingOptions &options); + +/// Split the given `op` into two parts along the given iteration space +/// `dimension` at the specified `splitPoint`, and return the two parts. +/// If the second part is statically known to be empty, do not create it +/// and return nullptr instead. Error state is signalled by returning +/// a pair of nullptrs. +/// +/// For example, the following op: +/// +/// linalg.matmul ins(%0, %1 : tensor<128x32xf32>, tensor<32x64xf32>) +/// outs(%2 : tensor<128x64xf32>) +/// +/// split along the first dimension at position 42 will result in: +/// +/// %3 = tensor.extract_slice %0[0, 0][42, 32][1, 1] +/// %4 = tensor.extract_slice %2[0, 0][42, 64][1, 1] +/// %5 = linalg.matmul ins(%3, %1 : tensor<42x32xf32>, tensor<32x64xf32>) +/// outs(%5 : tensor<42x64xf32>) +/// %6 = tensor.insert_slice %5 into %2[0, 0][42, 64][1, 1] +/// +/// %7 = tensor.extract_slice %0[42, 0][86, 32][1, 1] +/// %8 = tensor.extract_slice %6[42, 0][86, 64][1, 1] +/// %9 = linalg.matmul ins(%7, %1 : tensor<86x32xf32>, tensor<32x64xf32>) +/// outs(%8 : tensor<86x64xf32>) +/// tensor.insert_slice %5 into %6[42, 0][86, 64][1, 1] +/// +/// Note that there is no simplification other than constant propagation applied +/// to slice extraction and insertion. +std::pair splitOp(RewriterBase &rewriter, + TilingInterface op, + unsigned dimension, + OpFoldResult splitPoint); + +/// Perform standalone tiling of a single LinalgOp by `tileSizes`. +/// and permute the loop nest according to `interchangeVector` +/// The permutation is expressed as a list of integers that specify +/// the new ordering of the loop nest. The length of `interchangeVector` +/// must be equal to the length of `tileSizes`. +/// An empty vector is interpreted as the identity permutation and the +/// transformation returns early. +/// +/// Return a struct containing the tiled loops in the specified order +/// and the cloned op if successful, std::nullopt otherwise. +/// +/// E.g. the permutation `(i,j,k) -> (j,k,i)` is expressed by +/// `interchangeVector = [1,2,0]`. All values in `interchangeVector` must be +/// integers, in the range 0..`tileSizes.size()` without duplications +/// (i.e. `[1,1,2]` is an invalid permutation). +struct TiledLinalgOp { + LinalgOp op; + SmallVector loops; + SmallVector tensorResults; +}; +FailureOr tileLinalgOp(RewriterBase &b, LinalgOp op, + const LinalgTilingOptions &options); + +/// Interchange the `iterator_types` and `iterator_maps` dimensions and adapts +/// the index accesses of `op`. This is an in-place transformation controlled +/// by `interchangeVector`. An empty vector is interpreted as the identity +/// permutation and the transformation returns early. +/// +/// E.g. the permutation `(i,j,k) -> (j,k,i)` is expressed with +/// `interchangeVector = [1,2,0]`. All values in `interchangeVector` must be +/// integers, in the range 0..`op.rank` without duplications +/// (i.e. `[1,1,2]` is an invalid permutation). +/// +/// Return failure if the permutation is not valid. +FailureOr interchangeGenericOp(RewriterBase &rewriter, + GenericOp genericOp, + ArrayRef interchangeVector); + +/// Create a GenericOp from the given named operation `namedOp` and replace +/// namedOp. +/// Return failure if `namedOp` is a GenericOp or misses a region builder. +FailureOr generalizeNamedOp(RewriterBase &rewriter, + LinalgOp namedOp); + +/// Create a new buffer using the `allocationFn` provided. The size of this +/// buffer is the smallest constant bounding size along each dimension that +/// can be computed for the size of the result of `subView`. Returns the +/// allocated buffer as `fullLocalView` and the view that matches the size of +/// the result of subview operation as `partialLocalView`. +struct PromotionInfo { + Value fullLocalView; + Value partialLocalView; +}; +FailureOr +promoteSubviewAsNewBuffer(OpBuilder &b, Location loc, memref::SubViewOp subView, + const AllocBufferCallbackFn &allocationFn, + DataLayout &layout); + +/// Promote the `subViews` into a new buffer allocated at the insertion point +/// `b`. Promotion occurs in 3 steps: +/// 1. Create a new buffer for a full tile (i.e. not clipped at the +/// boundary). +/// 2. Take a full view on the buffer. +/// 3. Take a partial slice of the full view in step 2. and copy into it. +/// +/// Return the modified linalg op (the modification happens in place) as well +/// as all the copy ops created. +FailureOr promoteSubViews(OpBuilder &b, LinalgOp op, + const LinalgPromotionOptions &options); + +/// Allocate the subview in the GPU workgroup memory. +std::optional allocateWorkgroupMemory(OpBuilder &builder, + memref::SubViewOp subview, + ArrayRef sizeBounds, + DataLayout &); + +/// In case of GPU group memory there is no need to deallocate. +LogicalResult deallocateWorkgroupMemory(OpBuilder &, Value /*buffer*/); + +/// Create Memref copy operations and add gpu barrier guards before and after +/// the copy operation to ensure data integrity. +LogicalResult copyToWorkgroupMemory(OpBuilder &b, Value src, Value dst); + +/// Allocate the subview in the GPU private memory. +std::optional allocateGPUPrivateMemory(OpBuilder &builder, + memref::SubViewOp subview, + ArrayRef sizeBounds, + DataLayout &); + +/// Normal copy to between src and dst. +LogicalResult copyToGPUPrivateMemory(OpBuilder &b, Value src, Value dst); + +/// In case of GPU private memory there is no need to deallocate since the +/// memory is freed when going outside of the scope. +LogicalResult deallocateGPUPrivateMemory(OpBuilder &, Value /*buffer*/); + +/// Emit a suitable vector form for an operation. If provided, +/// `inputVectorSizes` are used to vectorize this operation. `inputVectorSizes` +/// must match the rank of the iteration space of the operation and the sizes +/// must be smaller or equal than their counterpart interation space sizes, if +/// static. `inputVectorShapes` also allows the vectorization of operations with +/// dynamic shapes. +LogicalResult vectorize(RewriterBase &rewriter, Operation *op, + ArrayRef inputVectorSizes = {}, + ArrayRef inputScalableVecDims = {}, + bool vectorizeNDExtract = false); + +/// Emit a suitable vector form for a Copy op with fully static shape. +LogicalResult vectorizeCopy(RewriterBase &builder, memref::CopyOp copyOp); + +/// Emit a loop nest of `scf.for` with the proper body for `linalgOp`. +FailureOr linalgOpToLoops(RewriterBase &rewriter, + LinalgOp linalgOp); + +/// Emit a loop nest of `scf.parallel` with the proper body for `linalgOp`. +FailureOr linalgOpToParallelLoops(RewriterBase &rewriter, + LinalgOp linalgOp); + +/// Emit a loop nest of `affine.for` with the proper body for `linalgOp`. +FailureOr linalgOpToAffineLoops(RewriterBase &rewriter, + LinalgOp linalgOp); + +/// Creates a number of ranges equal to the number of non-zero in `tileSizes`. +/// One for each loop of the LinalgOp that is tiled. The `tileSizes` argument +/// has one entry per surrounding loop. It uses zero as the convention that a +/// particular loop is not tiled. This convention simplifies implementations +/// by avoiding affine map manipulations. The returned ranges correspond to +/// the loop ranges, in the proper order, that are tiled and for which new +/// loops will be created. Also the function returns a map from loop indices +/// of the LinalgOp to the corresponding non-empty range indices of newly +/// created loops. +using LoopIndexToRangeIndexMap = DenseMap; +std::tuple, LoopIndexToRangeIndexMap> +makeTiledLoopRanges(RewriterBase &b, Location loc, AffineMap map, + ArrayRef allShapeSizes, + ArrayRef allTileSizes); + +namespace detail { +template +struct MultiSizeSpecificationBase { + /// Tile sizes. + T lowTileSize, highTileSize; + /// Number of tiles associated with each size. + T lowTripCount, highTripCount; +}; +} // namespace detail + +/// A description of a multi-size tiling comprising tile sizes and numbers of +/// tiles, expressed as Values which may or may not be constant. Multi-size +/// currently means two-size. +struct MultiSizeSpecification + : public detail::MultiSizeSpecificationBase {}; +struct StaticMultiSizeSpecification + : public detail::MultiSizeSpecificationBase {}; + +/// Emits the IR computing the multi-sized tiling specification with two tile +/// sizes not exceeding `targetSize`, each divisible by `sizeDivisor`, such +/// that there exist numbers of tiles with these sizes that fully cover the +/// given iteration space `dimension` of the structured `op`. +/// +/// The computation is as follows: +/// +/// b = originalTripCount floordiv sizeDivisor +/// t = (targetSize + sizeDivisor - 1) floordiv sizeDivisor +/// d = (b + t - 1) floordiv t +/// s = (b floordiv d) * sizeDivisor +/// v = b % d +/// u = d - v +/// +/// where the tile sizes are `s` and `s` + `sizeDivisor`, and the numbers of +/// the corresponding tiles are `u` and `v`, respectively. Alternatively, +/// +/// s * u + (s + sizeDivisor) * v == original size, +/// where s mod sizeDivisor = 0. +/// +/// Expects all values to be positive. In some cases with the target tile size +/// sufficiently close to the dimension shape and non-unit divisor, it is +/// impossible to compute such sizes. If `emitAssertion` is set, also emit the +/// assertion that size computation succeeded. +/// +/// Returns the specification consisting of both tile values and the number of +/// tiles of each size. +FailureOr +computeMultiTileSizes(OpBuilder &builder, LinalgOp op, unsigned dimension, + OpFoldResult targetSize, OpFoldResult divisor, + bool emitAssertions = true); +FailureOr +computeStaticMultiTileSizes(LinalgOp op, unsigned dimension, int64_t targetSize, + int64_t divisor); + +/// Rewrite a TilingInterface `op` to a tiled `scf.forall`, applying +/// tiling by `numThreads`. +/// If non-empty, the `mapping` is added as an attribute to the +/// resulting `scf.forall`. +/// Zero tile sizes indicate that the dimension is not tiled, and can be +/// thought of as tiling by the full size of data. It is the user's +/// responsibility to ensure that `numThreads` is a valid tiling specification +/// (i.e. that only tiles parallel dimensions, e.g. in the Linalg case). +struct ForallTilingResult { + Operation *tileOp; + Operation *tiledOp; +}; +FailureOr tileToForallOp(RewriterBase &builder, + TilingInterface op, + ArrayRef numThreads, + std::optional mapping); + +/// Same as `tileToForallOp`, but calculate the number of threads +/// required using the given tileSizes. +FailureOr +tileToForallOpUsingTileSizes(RewriterBase &builder, TilingInterface op, + ArrayRef tileSizes, + std::optional mapping); + +/// Transformation information returned after reduction tiling. +struct ForallReductionTilingResult { + /// The partial reduction tiled op generated. + Operation *parallelTiledOp; + /// The final reduction operation merging all the partial reductions. + Operation *mergeOp; + /// The op initializing the tensor used for partial reductions. + Operation *initialOp; + /// The `scf.forall` operation that iterate over the tiles. + scf::ForallOp loops; +}; + +/// Method to tile a reduction to parallel iterations computing partial +/// reductions. After the loop all the partial reduction are merged into a final +/// reduction. For example for the following sequence +/// +/// ```mlir +/// %0 = linalg.generic %in ["parallel", "reduction"] +/// : tensor<7x9xf32> -> tensor<7xf32> +/// ``` +/// +/// into: +/// +/// ```mlir +/// %0 = linalg.fill ... : tensor<7x4xf32> +/// %1 = scf.forall (%iv) in (%c4) shared_outs(%arg0 = %0) +/// -> (tensor<7x4xf32>) { +/// %2 = tensor.extract_slice %arg3 : tensor<7x4xf32> to tensor<7xf32> +/// %3 = tensor.extract_slice %in : tensor<7x9xf32> -> tensor<7x?xf32> +/// %4 = linalg.generic %2, %3 ["parallel", "reduction"] +/// : tensor<7x?xf32> -> tensor<7xf32> +/// %5 = tensor.insert_slice %3, %arg0[0, %iv] : tensor<7x4xf32> +/// } +/// %6 = linalg.generic %1 ["parallel", "reduction"] +/// : tensor<7x4xf32> -> tensor<7xf32> +/// ``` +FailureOr +tileReductionUsingForall(RewriterBase &b, PartialReductionOpInterface op, + ArrayRef numThreads, + ArrayRef tileSizes = {}, + std::optional mapping = std::nullopt); + +/// All indices returned by IndexOp should be invariant with respect to +/// tiling. Therefore, if an operation is tiled, we have to transform the +/// indices accordingly, i.e. offset them by the values of the corresponding +/// induction variables that are captured implicitly in the body of the op. +/// +/// Example. `linalg.generic` before tiling: +/// +/// #id_2d = (i, j) -> (i, j) +/// #pointwise_2d_trait = { +/// indexing_maps = [#id_2d, #id_2d], +/// iterator_types = ["parallel", "parallel"] +/// } +/// linalg.generic #pointwise_2d_trait %operand, %result { +/// ^bb0(%operand_in: f32, %result_in: f32): +/// %i = linalg.index 0 : index +/// %j = linalg.index 1 : index +/// +/// }: memref<50x100xf32>, memref<50x100xf32> +/// +/// After tiling pass with tiles sizes 10 and 25: +/// +/// #strided = (i, j)[s0, s1, s2] -> (i * s1 + s0 + j * s2) +/// +/// %c1 = arith.constant 1 : index +/// %c0 = arith.constant 0 : index +/// %c25 = arith.constant 25 : index +/// %c10 = arith.constant 10 : index +/// operand_dim_0 = dim %operand, 0 : memref<50x100xf32> +/// operand_dim_1 = dim %operand, 1 : memref<50x100xf32> +/// scf.for %k = %c0 to operand_dim_0 step %c10 { +/// scf.for %l = %c0 to operand_dim_1 step %c25 { +/// %4 = memref.subview %operand[%k, %l][%c10, %c25][%c1, %c1] +/// : memref<50x100xf32> to memref +/// %5 = memref.subview %result[%k, %l][%c10, %c25][%c1, %c1] +/// : memref<50x100xf32> to memref +/// linalg.generic pointwise_2d_trait %4, %5 { +/// ^bb0(%operand_in: f32, %result_in: f32): +/// %i = linalg.index 0 : index +/// %j = linalg.index 1 : index +/// // Indices `k` and `l` are implicitly captured in the body. +/// %transformed_i = arith.addi %i, %k : index // index `i` is offset by +/// %k %transformed_j = arith.addi %j, %l : index // index `j` is offset +/// by %l +/// // Every use of %i, %j is replaced with %transformed_i, +/// %transformed_j +/// }: memref, memref +/// } +/// } +/// +/// TODO: Investigate whether mixing implicit and explicit indices +/// does not lead to losing information. +void transformIndexOps(RewriterBase &b, LinalgOp op, + SmallVectorImpl &ivs, + const LoopIndexToRangeIndexMap &loopIndexToRangeIndex); + +/// Apply transformation to split the single linalg op reduction into a +/// parallel and reduction dimension. Then create a new linalg.generic op +/// doing the rest of the reduction. Return the new linalg op with an extra +/// parallel dimension or failure if the transformation didn't happen. +/// +/// Example: +/// ``` +/// %r = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, +/// affine_map<(d0) -> ()>], +/// iterator_types = ["reduction"]} +/// ins(%in : tensor<32xf32>) +/// outs(%out : tensor) { +/// ^bb0(%arg1: f32, %arg2: f32): +/// %y = arith.addf %arg1, %arg2 : f32 +/// linalg.yield %y : f32 +/// } -> tensor +/// ``` +/// To: +/// ``` +/// %cst = arith.constant 0.000000e+00 : f32 +/// %0 = tensor.expand_shape %in [[0, 1]] : tensor<32xf32> into +/// tensor<4x8xf32> %1 = tensor.empty [4] : tensor<4xf32> %2 = linalg.fill +/// ins(%cst : f32) outs(%1 : tensor<4xf32>) -> tensor<4xf32> %3 = +/// linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, +/// affine_map<(d0, d1) -> (d0)>], +/// iterator_types = ["parallel", "reduction"]} +/// ins(%0 : tensor<4x8xf32>) outs(%2 : tensor<4xf32>) { +/// ^bb0(%arg3: f32, %arg5: f32): +/// %5 = arith.addf %arg3, %arg4 : f32 +/// linalg.yield %5 : f32 +/// } -> tensor<4xf32> +/// %r = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, +/// affine_map<(d0) -> ()>], +/// iterator_types = ["reduction"]} +/// ins(%3 : tensor<4xf32>) outs(%out : tensor) { +/// ^bb0(%arg3: f32, %arg4: f32): +/// %5 = arith.addf %arg3, %arg4 : f32 +/// linalg.yield %5 : f32 +/// } -> tensor +/// ``` +struct SplitReductionResult { + Operation *initOrAlloc; + FillOp fillOp; + LinalgOp splitLinalgOp; + LinalgOp resultCombiningLinalgOp; +}; +FailureOr +splitReduction(RewriterBase &b, LinalgOp op, + const ControlSplitReductionFn &controlSplitReductionFn, + bool useAlloc = false); + +/// Scaling-based implementation of the split reduction transformation. +/// Instead of introducing an ExpandShapeOp, this rewrites a reduction +/// dimension `k` into `k * scale + kk`. +/// +/// Example: +/// ``` +/// %0 = linalg.matmul ins(%A, %B: tensor<16x256xf32>, tensor<256x32xf32>) +/// outs(%C: tensor<16x32xf32>) -> tensor<16x32xf32> +/// ``` +/// +/// Is transformed to: +/// +/// ``` +/// #map0 = affine_map<(d0, d1, d2, d3) -> (d0, d2 * 4 + d3)> +/// #map1 = affine_map<(d0, d1, d2, d3) -> (d2 * 4 + d3, d1)> +/// #map2 = affine_map<(d0, d1, d2, d3) -> (d2, d3)> +/// #map3 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2)> +/// #map4 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> +/// #map5 = affine_map<(d0, d1, d2) -> (d0, d1)> +/// %0 = tensor.empty [16, 32, 64] : tensor<16x32x64xf32> +/// %cst = arith.constant 0.000000e+00 : f32 +/// %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<16x32x64xf32>) -> +/// tensor<16x32x64xf32> +/// %2 = tensor.empty [64, 4] : tensor<64x4xi1> +/// +/// %3 = linalg.generic {indexing_maps = [#map0, #map1, #map2, #map3], +/// iterator_types = ["parallel", "parallel", "parallel", "reduction"]} +/// ins(%A, %B, %2 : tensor<16x256xf32>, tensor<256x32xf32>, +/// tensor<64x4xi1>) +/// outs(%1 : tensor<16x32x64xf32>) { +/// ^bb0(%arg3: f32, %arg4: f32, %arg5: i1, %arg6: f32): +/// %5 = arith.mulf %arg3, %arg4 : f32 +/// %6 = arith.addf %arg6, %5 : f32 +/// linalg.yield %6 : f32 +/// } -> tensor<16x32x64xf32> +/// +/// %4 = linalg.generic {indexing_maps = [#map4, #map5], +/// iterator_types = ["parallel", "parallel", "reduction"]} +// ins(%3 : tensor<16x32x64xf32>) +/// outs(%C : tensor<16x32xf32>) { +/// ^bb0(%arg3: f32, %arg4: f32): +/// %5 = arith.addf %arg3, %arg4 : f32 +/// linalg.yield %5 : f32 +/// } -> tensor<16x32xf32> +/// +/// return %4 : tensor<16x32xf32> +/// ``` +FailureOr +splitReductionByScaling(RewriterBase &b, LinalgOp op, + const ControlSplitReductionFn &controlSplitReductionFn, + bool useAlloc = false); + +/// Return `true` if a given sequence of dimensions are contiguous in the +/// range of the specified indexing map. +bool isDimSequencePreserved(AffineMap map, ReassociationIndicesRef dimSequence); +/// Return `true` if all sequences of dimensions specified in `dimSequences` are +/// contiguous in all the ranges of the `maps`. +bool areDimSequencesPreserved(ArrayRef maps, + ArrayRef dimSequences); + +/// Collapses dimensions of linalg.generic operation. A precondition to +/// calling this method is that for each list in `foldedIterationDim`, the +/// sequence of dimensions is contiguous in domains of all `indexing_maps` of +/// the `genericOp`. This can be checked using `areDimSequencePreserved` method. +/// When valid, the method also collapses the operands of the op. Returns +/// replacement values of the results of the original `genericOp` by inserting +/// reshapes to get back values of compatible types. +FailureOr> collapseGenericOpIterationDims( + GenericOp genericOp, ArrayRef foldedIterationDims, + RewriterBase &rewriter); + +struct LowerPackResult { + tensor::PadOp padOp; + tensor::ExpandShapeOp expandShapeOp; + linalg::TransposeOp transposeOp; +}; + +/// Rewrite pack as pad + reshape + transpose. +FailureOr lowerPack(RewriterBase &rewriter, + tensor::PackOp packOp); + +struct LowerUnPackOpResult { + tensor::EmptyOp emptyOp; + linalg::TransposeOp transposeOp; + tensor::CollapseShapeOp collapseShapeOp; + tensor::ExtractSliceOp extractSliceOp; +}; + +/// Rewrite pack as empty + transpose + reshape + extract_slice. +FailureOr lowerUnPack(RewriterBase &rewriter, + tensor::UnPackOp unPackOp); + +/// Struct to hold the result of a `pack` call. +struct PackResult { + SmallVector packOps; + linalg::LinalgOp packedLinalgOp; + SmallVector unPackOps; +}; +/// Implement packing of a single LinalgOp by `packedSizes`. +/// There must be one packedSizes entry per `linalgOp` iterator. +/// Return the packed Linalg op on success, failure otherwise. +FailureOr pack(RewriterBase &rewriter, linalg::LinalgOp linalgOp, + ArrayRef packedSizes); + +/// Struct to hold the result of a `packTranspose` call. +struct PackTransposeResult { + tensor::PackOp transposedPackOp; + linalg::LinalgOp transposedLinalgOp; + tensor::UnPackOp transposedUnPackOp; +}; +/// Transpose a single PackOp -> LinalgOp -> UnPackOp chain and return the +/// transposed PackOp -> LinalgOp -> UnPackOp chain after replacements. +/// Return failure if either: +/// 1. the `packOp` does not have the `linalgOp` as its unique use. +/// 2. the `maybeUnPackOp`, if specified must be a consumer of the result tied +/// to the unique `packOp` use. +/// 3. `outerPerm` (resp. `innerPerm`) must be valid permutations of +/// `packOp.getOuterDimsPerm` (resp. `packOp.getInnerDimsPerm`) or empty. +FailureOr +packTranspose(RewriterBase &rewriter, tensor::PackOp packOp, + linalg::LinalgOp linalgOp, tensor::UnPackOp maybeUnPackOp, + ArrayRef outerPerm, ArrayRef innerPerm); + +/// Pack a LinalgOp by greedily inferring matmul dimensions (m, n, k) where m +/// and n are proper parallel dimensions and k is a proper reduction +/// dimension. Packing occurs by rewriting the op as a linalg.generic and +/// calling linalg::pack by `mnkPackedSizes`. The order of the packed +/// dimensions is customizable: the `mnkOrder` is a permutation of {0, 1, 2} +/// to reorder {m, n, k} into one of the 8 possible forms. The outer +/// dimensions of the operands are not permuted at this time, this is left for +/// future work. +FailureOr +packMatmulGreedily(RewriterBase &rewriter, LinalgOp linalgOp, + ArrayRef mnkPackedSizes, + ArrayRef mnkPaddedSizesNextMultipleOf, + ArrayRef mnkOrder); + +/// Rewrite tensor.from_elements to linalg.generic. +FailureOr +rewriteInDestinationPassingStyle(RewriterBase &rewriter, + tensor::FromElementsOp fromElementsOp); + +/// Rewrite tensor.generate to linalg.generic. +FailureOr +rewriteInDestinationPassingStyle(RewriterBase &rewriter, + tensor::GenerateOp generateOp); + +/// Rewrite tensor.pad to linalg.generic + tensor.insert_slice. +FailureOr rewriteInDestinationPassingStyle(RewriterBase &rewriter, + tensor::PadOp padOp); + +/// Convert linalg.conv_2d_nhwc_hwcf into linalg.generic (for img2col packing) +/// and linalg.matmul. +/// +/// A convolution operation can be written as a matrix-matrix multiplication by +/// unfolding the cross-correlation between input and filter and explicitly copy +/// overlapped sliding window inputs. +/// +/// Consider 2D input X with single channel input and output and 2x2 filter W: +/// [x(0, 0) , x(0, 1) , ..., x(0, n) ] +/// [x(1, 0) , x(1, 1) , ..., x(1, n) ] +/// [. , . ,. , . ] [w(0, 0), w(0, 1)] +/// [. , . , . , . ] (conv) [w(1, 0), w(1, 1)] +/// [. , . , ., . ] +/// [x(n-1, 0), x(n-1, 1), ..., x(n-1, n-1)] +/// +/// The packed input data (img2col) is a matrix with |rows| = output spatial +/// size, |columns| = filter spatial size. To compute the output Y(i, j) we need +/// to calculate the dot product between filter window at input X(x, y)) and the +/// filter which will look like the following where r.h.s is the img2col matrix +/// and l.h.s is the flattened filter: +/// +/// [x(0,0), x(0,1), x(1,0), x(1,1)] +/// [x(0,1), x(1,1), x(0,2), x(1,2)] (matmul) [w(0,0), w(0,1), w(1,0), w(1,1)] +/// [x(0,1), x(1,1), x(0,2), x(1,2)] +/// [ . , . , . , . ] +/// +/// In general for 2D case with (N, H, W, C) input and (Kh, Kw, C, D) filter +/// and output (N, Ho, Wo, D) the convolution is the following matrix-matrix +/// multiplication (Ho x Wo, Kh x Kw x C) * (Kh x Kw x C, D) for each input in +/// the N input. For the case where N > 1 its a batched matrix-matrix +/// multiplication. +/// +/// On success, return both the operation that produces the img2col tensor and +/// the final operation of the sequence that replaces the original convolution. +FailureOr> +rewriteInIm2Col(RewriterBase &rewriter, linalg::Conv2DNhwcHwcfOp convOp); + +/// Similar to rewriteInIm2Col with linalg::Conv2DNhwcHwcfOp except there is no +/// reduction among the input channels so each convolution can be a +/// matrix-vector product and by transposing both input filter so channels are +/// outer most the computation is a batched matrix-vector product. +FailureOr> +rewriteInIm2Col(RewriterBase &rewriter, + linalg::DepthwiseConv2DNhwcHwcOp convOp); + +/// Similar to rewriteInIm2Col with linalg::Conv2DNhwcHwcfOp except because the +/// channels are to the left of the image shape dimensions, the position of the +/// contraction dimension in the resulting matmul is reversed. This swaps the +/// LHS and RHS of the matmul when compared with nhwc (i.e. (D, C x Kh x Kw) * +/// (C x Kh x Kw, Ho x Wo)) +FailureOr> +rewriteInIm2Col(RewriterBase &rewriter, linalg::Conv2DNchwFchwOp convOp); + +//===----------------------------------------------------------------------===// +// Rewrite patterns wrapping transformations. +// TODO: every single such pattern should be a close to noop wrapper around a +// functional-stye API call. +//===----------------------------------------------------------------------===// + +/// Rewrites 2-D convolution ops with size-1 window dimensions into 1-D +/// convolution ops. +template +struct DownscaleSizeOneWindowed2DConvolution final + : public OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + FailureOr returningMatchAndRewrite(Conv2DOp convOp, + PatternRewriter &rewriter) const; + + LogicalResult matchAndRewrite(Conv2DOp convOp, + PatternRewriter &rewriter) const override { + return returningMatchAndRewrite(convOp, rewriter); + } +}; + +extern template struct DownscaleSizeOneWindowed2DConvolution; +extern template struct DownscaleSizeOneWindowed2DConvolution; + +/// Rewrites 2-D depthwise convolution ops with size-1 (w, kw) or (h, kh) +/// dimensions into 1-D depthwise convolution ops. +struct DownscaleDepthwiseConv2DNhwcHwcOp final + : public OpRewritePattern { + DownscaleDepthwiseConv2DNhwcHwcOp(MLIRContext *context, + PatternBenefit benefit = 1) + : OpRewritePattern(context, benefit) {} + + FailureOr + returningMatchAndRewrite(DepthwiseConv2DNhwcHwcOp convOp, + PatternRewriter &rewriter) const; + + LogicalResult matchAndRewrite(DepthwiseConv2DNhwcHwcOp convOp, + PatternRewriter &rewriter) const override { + return returningMatchAndRewrite(convOp, rewriter); + } +}; + +struct DownscaleConv2DOp final : public OpRewritePattern { + DownscaleConv2DOp(MLIRContext *context, PatternBenefit benefit = 1) + : OpRewritePattern(context, benefit) {} + + FailureOr returningMatchAndRewrite(Conv2DOp convOp, + PatternRewriter &rewriter) const; + + LogicalResult matchAndRewrite(Conv2DOp convOp, + PatternRewriter &rewriter) const override { + return returningMatchAndRewrite(convOp, rewriter); + } +}; + +/// +/// Linalg generalization pattern. +/// +/// Apply the `generalization` transformation as a pattern. +/// See `generalization` for more details. +// +// TODO: Automatic default pattern class that just unwraps a function +// returning FailureOr. +struct LinalgGeneralizationPattern + : public OpInterfaceRewritePattern { + using OpInterfaceRewritePattern::OpInterfaceRewritePattern; + + /// `matchAndRewrite` implementation that returns the significant + /// transformed pieces of IR. + FailureOr + returningMatchAndRewrite(LinalgOp op, PatternRewriter &rewriter) const { + return generalizeNamedOp(rewriter, op); + } + + LogicalResult matchAndRewrite(LinalgOp op, + PatternRewriter &rewriter) const override { + return returningMatchAndRewrite(op, rewriter); + } +}; + +/// Vectorization pattern for memref::CopyOp. +struct CopyVectorizationPattern : public OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(memref::CopyOp copyOp, + PatternRewriter &rewriter) const override; +}; + +using OptimizeCopyFn = + std::function; + +/// Rewrite a tensor::PadOp into a sequence of EmptyOp, FillOp and +/// InsertSliceOp. For now, only constant padding values are supported. +/// `OptimizeCopyFn` can be used to customize copying step optimization. +struct GeneralizePadOpPattern : public OpRewritePattern { + GeneralizePadOpPattern(MLIRContext *context, + OptimizeCopyFn optimizeCopyFn = nullptr, + PatternBenefit benefit = 1) + : OpRewritePattern(context, benefit), + optimizeCopyFn(std::move(optimizeCopyFn)) {} + LogicalResult matchAndRewrite(tensor::PadOp padOp, + PatternRewriter &rewriter) const override; + +protected: + OptimizeCopyFn optimizeCopyFn; + Value createFillOrGenerateOp(RewriterBase &rewriter, tensor::PadOp padOp, + Value dest, + const SmallVector &dynSizes) const; +}; + +/// Rewrites a tensor::PackOp into a sequence of tensor.pad + linalg.transpose + +/// tensor.insert_slice ops, where the tensor::PackOp has outer dims being all +/// 1s. +struct GeneralizeOuterUnitDimsPackOpPattern + : public OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + LogicalResult matchAndRewrite(tensor::PackOp packOp, + PatternRewriter &rewriter) const override; +}; + +/// Rewrites a tensor::UnPackOp into a sequence of rank-reduced extract_slice op +/// + transpose op + insert_slice op, where the tensor::UnPackOp has outer dims +/// being all 1s. +struct GeneralizeOuterUnitDimsUnPackOpPattern + : public OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + LogicalResult matchAndRewrite(tensor::UnPackOp unpackOp, + PatternRewriter &rewriter) const override; +}; + +/// Match and rewrite for the pattern: +/// ``` +/// %alloc = ... +/// [optional] %view = memref.view %alloc ... +/// %subView = subview %allocOrView ... +/// [optional] linalg.fill(%allocOrView, %cst) ... +/// ... +/// memref.copy(%in, %subView) ... +/// vector.transfer_read %allocOrView[...], %cst ... +/// ``` +/// into +/// ``` +/// [unchanged] %alloc = ... +/// [unchanged] [optional] %view = memref.view %alloc ... +/// [unchanged] [unchanged] %subView = subview %allocOrView ... +/// ... +/// vector.transfer_read %in[...], %cst ... +/// ``` +/// Where there is no interleaved use between memref.copy and transfer_read as +/// well as no interleaved use between linalg.fill and memref.copy (if +/// linalg.fill is specified). +/// This is a custom rewrite to forward partial reads (with optional fills) to +/// vector.transfer_read. +struct LinalgCopyVTRForwardingPattern + : public OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(vector::TransferReadOp xferOp, + PatternRewriter &rewriter) const override; +}; + +/// Match and rewrite for the pattern: +/// ``` +/// %alloc = ... +/// [optional] %view = memref.view %alloc ... +/// %subView = subview %allocOrView... +/// ... +/// vector.transfer_write %..., %allocOrView[...] +/// memref.copy(%subView, %out) +/// ``` +/// into +/// ``` +/// [unchanged] %alloc = ... +/// [unchanged] [optional] %view = memref.view %alloc ... +/// [unchanged] %subView = subview %allocOrView... +/// ... +/// vector.transfer_write %..., %out[...] +/// ``` +/// Where there is no interleaved use between transfer_write and memref.copy. +/// This is a custom rewrite to forward partial writes to +/// vector.transfer_write. +struct LinalgCopyVTWForwardingPattern + : public OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(vector::TransferWriteOp xferOp, + PatternRewriter &rewriter) const override; +}; + +/// Rewrite extract_slice(tensor.pad(x)) into tensor.pad(extract_slice(x)). +struct ExtractSliceOfPadTensorSwapPattern + : public OpRewritePattern { + /// A function to control pattern application and rewrite logic. + /// + /// The function will be given the slice op and should return: + /// - std::nullopt: to fail the match and not apply the pattern; + /// - true: to apply the pattern with zero slice guard; + /// - false: to apply the pattern without zero slice guard. + /// + /// See the documentation for tensor::bubbleUpPadSlice regarding zero slice + /// guard. + using ControlFn = std::function(tensor::ExtractSliceOp)>; + + ExtractSliceOfPadTensorSwapPattern(MLIRContext *context, + ControlFn controlFn = nullptr, + PatternBenefit benefit = 1) + : OpRewritePattern(context, benefit), controlFn(std::move(controlFn)) {} + + LogicalResult matchAndRewrite(tensor::ExtractSliceOp sliceOp, + PatternRewriter &rewriter) const override; + +private: + ControlFn controlFn; +}; + +//===----------------------------------------------------------------------===// +// Populate functions. +//===----------------------------------------------------------------------===// + +/// Canonicalization patterns relevant to apply after tiling patterns. These +/// are applied automatically by the tiling pass but need to be applied +/// manually when tiling is called programmatically. +RewritePatternSet getLinalgTilingCanonicalizationPatterns(MLIRContext *ctx); +void populateLinalgTilingCanonicalizationPatterns(RewritePatternSet &patterns); + +/// Linalg generalization patterns + +/// Populates `patterns` with patterns to convert spec-generated named ops to +/// linalg.generic ops. +void populateLinalgNamedOpsGeneralizationPatterns(RewritePatternSet &patterns); + +/// Linalg decompose convolutions patterns + +/// Populates patterns to decompose high-D convolution ops into low-D ones. +/// This is a step in progressive lowering for convolution ops, afterwards we +/// can vectorize the low-D convolution ops. +void populateDecomposeConvolutionPatterns(RewritePatternSet &patterns, + PatternBenefit benefit = 1); + +/// Populates patterns to transform linalg.conv_2d_xxx operations into +/// linalg.generic (for img2col packing) and linalg.matmul. +/// \see rewriteInIm2Col for more details. +void populateConvertConv2DToImg2ColPatterns(RewritePatternSet &patterns); + +/// Populates `patterns` with patterns that vectorize tensor.pad. +/// These patterns are meant to apply in a complementary fashion. Benefits +/// are used to encode a certain ordering of pattern application. To avoid +/// scattering magic constants throughout the code base, the patterns must be +/// added with this function. `baseBenefit` can be used to offset the benefit +/// of all tensor::PadOp vectorization patterns by a certain value. +void populatePadOpVectorizationPatterns(RewritePatternSet &patterns, + PatternBenefit baseBenefit = 1); + +/// Populate patterns for splitting a `LinalgOp` with multiple statements within +/// its payload into multiple `GenericOp` that have a single statement. +/// The option `removeDeadArgsAndResults` adds patterns to remove dead arguments +/// and results from the generated decomposed ops. This is default `true` since +/// the core decomposition patterns relies on these clean up patterns. It is set +/// to false only for testing purposes. +void populateDecomposeLinalgOpsPattern(RewritePatternSet &patterns, + bool removeDeadArgsAndResults = true); + +/// Populate patterns that convert non-destination-style ops to destination +/// style ops. +void populateConvertToDestinationStylePatterns(RewritePatternSet &patterns); + +/// Populate patterns for vectorizing low-D convolution ops. This is a step in +/// progressive lowering for convolution ops, it assume high-D convolution ops +/// were decomposed previously. +void populateConvolutionVectorizationPatterns(RewritePatternSet &patterns, + PatternBenefit benefit = 1); + +/// Populate patterns that convert `ElementwiseMappable` ops to linalg +/// parallel loops. +void populateElementwiseToLinalgConversionPatterns(RewritePatternSet &patterns); + +/// Populate patterns that are only useful in the context of sparse tensors. +void populateSparseTensorRewriting(RewritePatternSet &patterns); + +/// Function type which is used to control when to stop fusion. It is expected +/// that OpOperand is not modified in the callback. The OpOperand is not marked +/// as const to allow callers to use non-const methods. +using ControlFusionFn = std::function; + +/// Patterns for fusing linalg operation on tensors. + +/// Pattern to fuse `linalg.generic` -> `linalg.generic` operations +/// when both operations are fusable elementwise operations. +void populateElementwiseOpsFusionPatterns( + RewritePatternSet &patterns, + const ControlFusionFn &controlElementwiseOpFusion); + +/// Function type which is used to control propagation of tensor.pack/unpack +/// ops. +using ControlPropagationFn = std::function; + +/// Patterns to bubble up or down data layout ops across other operations. +void populateDataLayoutPropagationPatterns( + RewritePatternSet &patterns, + const ControlPropagationFn &controlPackUnPackPropagation); + +/// Pattern to remove dead operands and results of `linalg.generic` operations. +/// This is effectively DCE for a linalg op. +void populateEraseUnusedOperandsAndResultsPatterns(RewritePatternSet &patterns); + +/// Patterns to promote inputs to outputs and remove unused inputs of +/// `linalg.generic` ops. +void populateEraseUnnecessaryInputsPatterns(RewritePatternSet &patterns); + +/// Function type to control generic op dimension collapsing. It is expected +/// to return an array of `ReassociationIndices` representing dimensions that +/// should be merged. +using GetCollapsableDimensionsFn = + std::function(linalg::GenericOp)>; + +/// Pattern to collapse dimensions in a linalg.generic op. This will collapse +/// tensor operands when needed and expand back the result tensors. +void populateCollapseDimensions( + RewritePatternSet &patterns, + const GetCollapsableDimensionsFn &controlCollapseDimensions); + +/// Patterns to fold an expanding (collapsing) tensor_reshape operation with its +/// producer (consumer) generic operation by expanding the dimensionality of the +/// loop in the generic op. +void populateFoldReshapeOpsByExpansionPatterns( + RewritePatternSet &patterns, const ControlFusionFn &controlFoldingReshapes); + +/// Patterns to fold an expanding tensor.expand_shape operation with its +/// producer generic operation by collapsing the dimensions of the generic op. +void populateFoldReshapeOpsByCollapsingPatterns( + RewritePatternSet &patterns, const ControlFusionFn &controlFoldingReshapes); + +/// Patterns to constant fold Linalg operations. +void populateConstantFoldLinalgOperations(RewritePatternSet &patterns, + const ControlFusionFn &controlFn); + +/// Pattern to fuse a `tensor.pad` operation with the producer of its source, +/// if the producer is a `linalg` operation with all parallel iterator types. +void populateFuseTensorPadWithProducerLinalgOpPatterns( + RewritePatternSet &patterns); + +/// Patterns to convert from one named op to another. These can be seen as +/// canonicalizations of named ops into another named op. +void populateLinalgNamedOpConversionPatterns(RewritePatternSet &patterns); + +/// Patterns to fold unit-extent dimensions in operands/results of linalg ops on +/// tensors via reassociative reshape ops. +void populateFoldUnitExtentDimsPatterns(RewritePatternSet &patterns, + ControlDropUnitDims &options); + +/// A pattern that converts init operands to input operands. +void populateMoveInitOperandsToInputPattern(RewritePatternSet &patterns); + +/// Patterns that are used to inline constant operands into linalg generic ops. +void populateInlineConstantOperandsPatterns(RewritePatternSet &patterns); + +/// Patterns that are used to bubble up extract slice op above linalg op. +void populateBubbleUpExtractSliceOpPatterns(RewritePatternSet &patterns); + +/// Adds patterns that waps tensor.extract_slice(linalg.fill(%cst, %init)) into +/// linalg.fill(%cst, tensor.extract_slice(%init)). +void populateSwapExtractSliceWithFillPatterns(RewritePatternSet &patterns); + +/// Patterns to apply `splitReduction` below. +void populateSplitReductionPattern( + RewritePatternSet &patterns, + const ControlSplitReductionFn &controlSplitReductionFn, + bool useAlloc = false); + +} // namespace linalg +} // namespace mlir + +#endif // MLIR_DIALECT_LINALG_TRANSFORMS_TRANSFORMS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h new file mode 100644 index 0000000000000000000000000000000000000000..b3397ae131b56f907e01e5071dcc22686e0d170e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h @@ -0,0 +1,381 @@ +//===- Utils.h - Utilities to support the Linalg dialect --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_LINALG_UTILS_UTILS_H +#define MLIR_DIALECT_LINALG_UTILS_UTILS_H + +#include "mlir/Dialect/Linalg/IR/Linalg.h" +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/Dialect/Utils/StructuredOpsUtils.h" +#include "llvm/ADT/StringSet.h" +#include + +namespace mlir { +class AffineExpr; +class AffineMap; +class PatternRewriter; + +namespace affine { +class AffineForOp; +} // namespace affine + +namespace tensor { +class ExtractSliceOp; +} // namespace tensor + +namespace linalg { + +//===----------------------------------------------------------------------===// +// Utilities for inferring various semantics properties of Linalg ops. +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +// General utilities +//===----------------------------------------------------------------------===// + +/// Check if all indexing maps are projected permutations. +bool allIndexingsAreProjectedPermutation(LinalgOp op); + +/// Detect whether `r` has only ConstantOp, ElementwiseMappable and YieldOp. +bool hasOnlyScalarElementwiseOp(Region &r); + +/// Check if a LinalgOp is an element-wise operation. +bool isElementwise(LinalgOp op); + +/// Check if iterator type has "parallel" semantics. +bool isParallelIterator(utils::IteratorType iteratorType); + +/// Check if iterator type has "reduction" semantics. +bool isReductionIterator(utils::IteratorType iteratorType); + +/// Create a tensor::PadOp that pads `source` to the size of the statically +/// sized `type` whose static sizes are assumed to be greater than the dynamic +/// `source` size. The padding introduces trailing `pad` values until the +/// target size is met. If `source` is defined by one or more LinalgOps that +/// have been padded with the same value and sizes, return their padded result +/// instead of creating a tensor::PadOp. +/// +/// Example: +/// ``` +/// %0 = tensor.extract_slice %arg0 [%iv0, %iv1] [%sz0, %sz1] +/// %1 = tensor.pad %0 low[0, 0] high[...] { tensor.yield %cst } +/// %2 = linalg.matmul ins(...) outs(%1) +/// %3 = tensor.extract_slice %2 [0, 0] [%sz0, %sz1] +/// ``` +/// makeComposedPadHighOp(source=%3, pad=%cst) returns %2 +/// makeComposedPadHighOp(source=%3, pad=%other_cst) returns %4 +/// ``` +/// %4 = tensor.pad %3 low[0, 0] high[...] { tensor.yield %other_cst } +/// ``` +Value makeComposedPadHighOp(OpBuilder &b, Location loc, RankedTensorType type, + Value source, Value pad, bool nofold); + +/// Returns a GenericOp that transposes `inputTensor` into `outputTensor` +/// using `transposeVector` to permute the `inputTensor` dimensions. +GenericOp makeTransposeOp(OpBuilder &b, Location loc, Value inputTensor, + Value outputTensor, + ArrayRef transposeVector); + +/// Returns GenericOp that copies an n-D memref. Unlike the current +/// implementation of memref::CopyOp, this op can further tile, lower to loops +/// or vectorize. +GenericOp makeMemRefCopyOp(OpBuilder &b, Location loc, Value from, Value to); + +/// Get the reassociation maps to fold the result of a extract_slice (or +/// source of a insert_slice) operation with given offsets, and sizes to its +/// rank-reduced version. This is only done for the cases where the size is 1 +/// and offset is 0. Strictly speaking the offset 0 is not required in +/// general, but non-zero offsets are not handled by SPIR-V backend at this +/// point (and potentially cannot be handled). +std::optional> +getReassociationMapForFoldingUnitDims(ArrayRef mixedSizes); + +//===----------------------------------------------------------------------===// +// Fusion / Tiling utilities +//===----------------------------------------------------------------------===// + +/// The type of loops to be generated during tiling. +enum class LinalgTilingLoopType { + Loops = 0, + AffineLoops = 1, + ParallelLoops = 2 +}; + +/// Computes tile offsets, given a list of loop `ivs` and `tileSizes`. In case +/// a tile size is zero (i.e., no tiling), the corresponding offset is also +/// zero. +SmallVector computeTileOffsets(OpBuilder &b, Location loc, + ArrayRef ivs, + ArrayRef tileSizes); + +/// Computes tile sizes, given a list of `tileSizes` and dimension +/// sizes (`sizeBounds`). In case a tile size is zero (i.e., no tiling), the +/// corresponding result size is the corresponding value from `sizeBounds`. +/// Note: The returned tile sizes are closed intervals. +SmallVector computeTileSizes(OpBuilder &b, Location loc, + ArrayRef tileSizes, + ArrayRef sizeBounds); + +/// Returns the list of tensor output types produced when the given structured +/// operation `op` is applied to the given `operands`. Note that `operands` +/// are not necessarily the actual operands of `op`. +SmallVector getTensorOutputTypes(LinalgOp op, ValueRange operands); + +/// Creates `insert_slice` ops that insert `results` back into larger tensors +/// they were originally extracted from with `extract_slice` before being +/// passed as `operands` to the given structured operation `op` or its clone. +/// Note that `operands` are not necessarily the actual operands of `op`, the +/// operation serves only as metadata container for operand types and +/// positions. +SmallVector insertSlicesBack(OpBuilder &builder, Location loc, + LinalgOp op, ValueRange operands, + ValueRange results); + +/// A struct containg offsets-sizes-strides arguments of the tiled shape. +struct SliceParameters { + SmallVector offsets; + SmallVector sizes; + SmallVector strides; +}; + +/// Computes SliceParameters for a single `valueToTile` assuming that its user +/// is being tiled with the given loop bounds `lbs` and `ubs` and the tile +/// sizes `tileSizes`. +/// +/// `omitPartialTileCheck` controls whether to omit the partial/boundary tile +/// condition check in cases where we statically know that it is unnecessary. +SliceParameters +computeSliceParameters(OpBuilder &builder, Location loc, Value valueToTile, + ArrayRef tileSizes, AffineMap map, + ArrayRef lbs, ArrayRef ubs, + ArrayRef subShapeSizes, + bool omitPartialTileCheck); + +/// Computes SliceParamaters for all `valuesToTile` of the given `linalgOp`, +/// assuming `linalgOp` is being fused into a loop nest. Calls +/// `computeSliceParameters` for every individual value. +/// +/// Note that a constant zero in `tileSizes` means no tiling at that implicit +/// loop. The number of non-zero values in `tileSizes` should be equal to the +/// number of values in `ivs`. +/// +/// Some of the `valuesToTile` won't be affected by tiling. For these values, +/// std::nullopt will be returned. +SmallVector> +computeAllSliceParameters(OpBuilder &builder, Location loc, LinalgOp linalgOp, + ValueRange valuesToTile, ArrayRef ivs, + ArrayRef tileSizes, + ArrayRef sizeBounds, + bool omitPartialTileCheck); + +/// Creates an extract_slice/subview op for a single `valueToTile` with +/// `builder`. This new operation extracts a tile of `valueToTile`, starting +/// at offsets `lbs` and with sizes `subShapeSizes`. `omitPartialTileCheck` +/// controls whether to omit the partial/boundary tile condition check in +/// cases where we statically know that it is unnecessary. +Value makeTiledShape(OpBuilder &builder, Location loc, Value valueToTile, + ArrayRef tileSizes, AffineMap map, + ArrayRef lbs, ArrayRef ubs, + ArrayRef subShapeSizes, + bool omitPartialTileCheck); + +/// Creates extract_slice/subview ops for all `valuesToTile` of the given +/// `linalgOp` with `builder`, assuming `linalgOp` is being fused into a loop +/// nest for tiling with the given induction variables `ivs` and tile sizes +/// `tileSizes`. `sizeBounds` are the iteration space bounds for *all* the +/// implicit loops in `linalgOp`. `omitPartialTileCheck` controls whether to +/// omit the partial/boundary tile condition check in cases where we +/// statically know that it is unnecessary. +/// +/// Note that a constant zero in `tileSizes` means no tiling at that implicit +/// loop. The number of non-zero values in `tileSizes` should be equal to the +/// number of values in `ivs`. +SmallVector makeTiledShapes(OpBuilder &builder, Location loc, + LinalgOp linalgOp, ValueRange valuesToTile, + ArrayRef ivs, + ArrayRef tileSizes, + ArrayRef sizeBounds, + bool omitPartialTileCheck); + +/// Add the specified offsets to any `linalg.index` ops contained in the given +/// `linalgOp`. The offsets are provided in the same order as iteration space +/// dimensions. Null offests are assumed to be zero. +void offsetIndices(OpBuilder &b, LinalgOp linalgOp, + ArrayRef offests); +void offsetIndices(RewriterBase &b, LinalgOp linalgOp, + ArrayRef offests); + +/// A struct containing the Linalg producer before and after fusion. +/// When operating on tensors, `fusedProducer` may feed into a `tensor.cast` +/// op before the consumer Linalg op, until enough canonicalizations have +/// applied. +struct FusionInfo { + LinalgOp originalProducer; + LinalgOp fusedProducer; +}; + +/// Tensor counterpart of `fuseProducerOfBuffer`. +/// This implements the fusion part of the "tileAndFuse on tensors" +/// transformation and thus requires the `consumerOpOperand` to be a +/// `extract_slice` op (generally obtained by applying the tiling +/// transformation). +FailureOr fuseProducerOfTensor(OpBuilder &b, + OpOperand &consumerOpOperand); + +/// Tensor counterpart of `fuseProducerOfBuffer`. +/// This implements the fusion part of the "tileAndFuse on tensors" +/// transformation and thus requires the `consumerOpOperand` to be a +/// `extract_slice` op (generally obtained by applying the tiling +/// transformation). Assumes `producerOfTensor` is a Linalg op that produces +/// `consumerOpOperand`. +FailureOr fuseProducerOfTensor(OpBuilder &b, + OpResult producerOpResult, + OpOperand &consumerOpOperand); + +//===----------------------------------------------------------------------===// +// Distribution utilities +//===----------------------------------------------------------------------===// + +/// Scheme used to distribute loops to processors. +enum class DistributionMethod { + /// Cyclic distribution where no assumption is made about the dynamic + /// relationship between number of processors and number of iterations of + /// the + /// distributed loop. Distributes the following loop + /// + /// scf.parallel (%iv) = (%lb) to (%ub) step (%step) + /// + /// to + /// + /// scf.parallel(%iv)= (%lb + %procId * %step) to (%ub) step (%step * + /// %nprocs) + Cyclic = 0, + + /// Cyclic distribution where the number of processors can be assumed to be + /// more than or equal to the number of iterations of the distributed loop. + /// In + /// such cases, a simple in-bounds check is enough (instead of materializing + /// a + /// loop). Distributes the following loop + /// + /// scf.parallel (%iv) = (%lb) to (%ub) step (%step) + /// + /// to + /// + /// %iv = %lb + %procId * %step + /// %cond = arith.cmpi "slt", %iv, %ub + /// scf.if %cond { + /// ... + /// } + CyclicNumProcsGeNumIters = 1, + + /// Cyclic distribution where the number of processors can be assumed to be + /// equal to the number of iterations of the distributed loop. In such + /// cases, + /// no bounds check is needed. Distributes the following loop + /// + /// scf.parallel (%iv) = (%lb) to (%ub) step (%step) + /// + /// to + /// + /// %iv = %lb + %procId * %step + CyclicNumProcsEqNumIters = 2, + + /// No Distribution. + None = 3 +}; + +/// Callback function type used to get processor ID, and number of processors +/// used for distribution for all parallel loops generated. +struct ProcInfo { + Value procId; + Value nprocs; + DistributionMethod distributionMethod; +}; +using ProcInfoCallBackFn = std::function( + OpBuilder &b, Location loc, ArrayRef parallelLoopRanges)>; + +/// Options that allow distribution of loops generated in Linalg transforms to +/// processors while generating the loops. +struct LinalgLoopDistributionOptions { + /// Callback function that returns the Values for processor ID (`procId`), + /// and number of processors (`nprocs`) used to execute the parallel loops. + /// The number of `{procId, nprocs}` pairs returned must be equal to the + /// number of `parallelLoopRanges` passed into the callback. The + /// `parallelLoopRanges` are ranges of the outer parallel loops of the + /// operation that do have non-zero tile sizes specified. + ProcInfoCallBackFn procInfo; +}; + +/// Update the `lb`, `ub` and `step` to get per processor `lb`, `ub` and +/// `step`. +void updateBoundsForCyclicDistribution(OpBuilder &builder, Location loc, + Value procId, Value nprocs, Value &lb, + Value &ub, Value &step); + +//===----------------------------------------------------------------------===// +// Fusion on tensor utilities +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +// Generic op region utilities +//===----------------------------------------------------------------------===// + +/// A struct containing common matchers over linalg op's region. +struct RegionMatcher { + enum class BinaryOpKind { + IAdd, + }; + + /// Matches the given linalg op if its body is performing binary operation + /// on int or float scalar values and returns the binary op kind. + /// + /// The linalg op's region is expected to be + /// ``` + /// { + /// ^bb(%a: , %b: ): + /// %0 = %a, %b: + /// linalg.yield %0: + /// } + /// ``` + static std::optional matchAsScalarBinaryOp(GenericOp op); +}; + +//===----------------------------------------------------------------------===// +// Loop nest utilities +//===----------------------------------------------------------------------===// + +/// Utility class used to generate nested loops with ranges described by +/// `loopRanges` and loop type described by the `iteratorTypes`. +/// `bodyBuilderFn` is used to generate the body of the innermost loop. It is +/// passed a range of loop induction variables and a range of operand values +/// to use. +template +struct GenerateLoopNest { + static void doit(OpBuilder &b, Location loc, ArrayRef loopRanges, + LinalgOp linalgOp, + ArrayRef iteratorTypes, + function_ref + bodyBuilderFn, + ArrayRef procInfo = {}); +}; + +/// Returns an attribute list that excludes pre-defined attributes. +template +SmallVector getPrunedAttributeList(OpTy op) { + auto elidedAttrs = llvm::to_vector(op.getAttributeNames()); + if (isa(op.getOperation())) + elidedAttrs.push_back(LinalgDialect::kMemoizedIndexingMapsAttrName); + return getPrunedAttributeList(op, elidedAttrs); +} + +} // namespace linalg +} // namespace mlir + +#endif // MLIR_DIALECT_LINALG_UTILS_UTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgram.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgram.h new file mode 100644 index 0000000000000000000000000000000000000000..a31e69f30d7a8add9ce3cc22be0c90358ef81580 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgram.h @@ -0,0 +1,37 @@ +//===- MLProgram.h - MLProgram dialect ----------------------------*- C++-*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef MLIR_DIALECT_MLPROGRAM_IR_MLPROGRAM_H_ +#define MLIR_DIALECT_MLPROGRAM_IR_MLPROGRAM_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/MLProgram/IR/MLProgramAttributes.h" +#include "mlir/Dialect/MLProgram/IR/MLProgramTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/IR/RegionKindInterface.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/CallInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/FunctionInterfaces.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +//===----------------------------------------------------------------------===// +// MLProgramDialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.h.inc" + +//===----------------------------------------------------------------------===// +// MLProgram Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/MLProgram/IR/MLProgramOps.h.inc" + +#endif // MLIR_DIALECT_MLPROGRAM_IR_MLPROGRAM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..720badbf9663d5a902193ca1e0c587f50ffa7b11 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc @@ -0,0 +1,130 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::ml_program::ExternAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::ml_program::ExternAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::ml_program::ExternAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::ml_program::ExternAttr>([&](auto t) { + printer << ::mlir::ml_program::ExternAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace ml_program { +namespace detail { +struct ExternAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::Type>; + ExternAttrStorage(::mlir::Type type) : type(std::move(type)) {} + + KeyTy getAsKey() const { + return KeyTy(type); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (type == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ExternAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto type = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ExternAttrStorage(std::move(type)); + } + + ::mlir::Type type; +}; +} // namespace detail +ExternAttr ExternAttr::get(::mlir::MLIRContext *context, ::mlir::Type type) { + return Base::get(context, std::move(type)); +} + +::mlir::Attribute ExternAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::Type> _result_type; + + if (odsType) { + if (auto reqType = ::llvm::dyn_cast<::mlir::Type>(odsType)) { + _result_type = reqType; + } else { + odsParser.emitError(odsLoc, "invalid kind of type specified"); + return {}; + } + } + return ExternAttr::get(odsParser.getContext(), + ::mlir::Type((_result_type.value_or(::mlir::NoneType::get(odsParser.getContext()))))); +} + +void ExternAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); +} + +::mlir::Type ExternAttr::getType() const { + return getImpl()->type; +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::ExternAttr) +namespace mlir { +namespace ml_program { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute MLProgramDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void MLProgramDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace ml_program +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h new file mode 100644 index 0000000000000000000000000000000000000000..3836684726cb313a8f40e589ec805543b7bfb848 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h @@ -0,0 +1,22 @@ +//===- MLProgramAttributes.h - Attribute Classes ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MLPROGRAM_IR_MLPROGRAMATTRIBUTES_H_ +#define MLIR_DIALECT_MLPROGRAM_IR_MLPROGRAMATTRIBUTES_H_ + +#include "mlir/IR/Attributes.h" +#include "mlir/IR/BuiltinAttributeInterfaces.h" + +//===----------------------------------------------------------------------===// +// Tablegen Attribute Declarations +//===----------------------------------------------------------------------===// + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/MLProgram/IR/MLProgramAttributes.h.inc" + +#endif // MLIR_DIALECT_MLPROGRAM_IR_MLPROGRAMATTRIBUTES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..6eb1a1eff048f3d28ae880279674211b67427024 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h.inc @@ -0,0 +1,40 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace ml_program { +class ExternAttr; +namespace detail { +struct ExternAttrStorage; +} // namespace detail +class ExternAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ExternAttr get(::mlir::MLIRContext *context, ::mlir::Type type); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"extern"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::Type getType() const; +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::ExternAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..d5bfe163dcc6410c09846f87752a1871b1250089 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOps.cpp.inc @@ -0,0 +1,4061 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MLProgramOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::ml_program::FuncOp, +::mlir::ml_program::GlobalLoadConstOp, +::mlir::ml_program::GlobalLoadGraphOp, +::mlir::ml_program::GlobalLoadOp, +::mlir::ml_program::GlobalOp, +::mlir::ml_program::GlobalStoreGraphOp, +::mlir::ml_program::GlobalStoreOp, +::mlir::ml_program::OutputOp, +::mlir::ml_program::ReturnOp, +::mlir::ml_program::SubgraphOp, +::mlir::ml_program::TokenOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace ml_program { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MLProgramOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MLProgramOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::ml_program::TokenType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be Token for establishing execution ordering in a graph, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MLProgramOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: type attribute of function type"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MLProgramOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Array of dictionary attributes"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MLProgramOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: symbol reference attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MLProgramOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any type attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MLProgramOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MLProgramOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((true))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MLProgramOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MLProgramOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_MLProgramOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::FuncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.func", odsAttrs.getContext()); +} + +FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(FuncOp op) : FuncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FuncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FuncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr FuncOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef FuncOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FuncOpGenericAdaptorBase::getFunctionTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); + return attr; +} + +::mlir::FunctionType FuncOpGenericAdaptorBase::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::ArrayAttr FuncOpGenericAdaptorBase::getArgAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOpGenericAdaptorBase::getResAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::StringAttr FuncOpGenericAdaptorBase::getSymVisibilityAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); + return attr; +} + +::std::optional< ::llvm::StringRef > FuncOpGenericAdaptorBase::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &FuncOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange FuncOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +FuncOpAdaptor::FuncOpAdaptor(FuncOp op) : FuncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FuncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitError(loc, "'ml_program.func' op ""requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'ml_program.func' op ""requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'ml_program.func' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))))) + return emitError(loc, "'ml_program.func' op ""attribute 'function_type' failed to satisfy constraint: type attribute of function type"); + + if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'ml_program.func' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'ml_program.func' op ""attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_sym_visibility && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_visibility)))) + return emitError(loc, "'ml_program.func' op ""attribute 'sym_visibility' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair FuncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FuncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair FuncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FuncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &FuncOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult FuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.arg_attrs; + auto attr = dict.get("arg_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for arg_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.function_type; + auto attr = dict.get("function_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for function_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `function_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.res_attrs; + auto attr = dict.get("res_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for res_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_visibility; + auto attr = dict.get("sym_visibility"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for sym_visibility in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.arg_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.function_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("function_type", + propStorage)); + } + + { + const auto &propStorage = prop.res_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("res_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.sym_visibility; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_visibility", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FuncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.function_type.getAsOpaquePointer()), + llvm::hash_value(prop.res_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.sym_visibility.getAsOpaquePointer())); +} + +std::optional FuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "arg_attrs") + return prop.arg_attrs; + + if (name == "function_type") + return prop.function_type; + + if (name == "res_attrs") + return prop.res_attrs; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "sym_visibility") + return prop.sym_visibility; + return std::nullopt; +} + +void FuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "arg_attrs") { + prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "function_type") { + prop.function_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "res_attrs") { + prop.res_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_visibility") { + prop.sym_visibility = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); + + if (prop.function_type) attrs.append("function_type", prop.function_type); + + if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.sym_visibility) attrs.append("sym_visibility", prop.sym_visibility); +} + +::mlir::LogicalResult FuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps2(attr, "arg_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps1(attr, "function_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps2(attr, "res_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymVisibilityAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(attr, "sym_visibility", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.function_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.sym_visibility))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.arg_attrs); + writer.writeAttribute(prop.function_type); + + writer.writeOptionalAttribute(prop.res_attrs); + writer.writeAttribute(prop.sym_name); + + writer.writeOptionalAttribute(prop.sym_visibility); +} + +::mlir::StringAttr FuncOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef FuncOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FuncOp::getFunctionTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); +} + +::mlir::FunctionType FuncOp::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::ArrayAttr FuncOp::getArgAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); +} + +::std::optional< ::mlir::ArrayAttr > FuncOp::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOp::getResAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); +} + +::std::optional< ::mlir::ArrayAttr > FuncOp::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::StringAttr FuncOp::getSymVisibilityAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); +} + +::std::optional< ::llvm::StringRef > FuncOp::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void FuncOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void FuncOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void FuncOp::setFunctionTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getFunctionTypeAttrName(), attr); +} + +void FuncOp::setFunctionType(::mlir::FunctionType attrValue) { + (*this)->setAttr(getFunctionTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void FuncOp::setArgAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getArgAttrsAttrName(), attr); +} + +void FuncOp::setResAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getResAttrsAttrName(), attr); +} + +void FuncOp::setSymVisibilityAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymVisibilityAttrName(), attr); +} + +void FuncOp::setSymVisibility(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSymVisibilityAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSymVisibilityAttrName()); +} + +::mlir::Attribute FuncOp::removeArgAttrsAttr() { + auto &attr = getProperties().arg_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute FuncOp::removeResAttrsAttr() { + auto &attr = getProperties().res_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute FuncOp::removeSymVisibilityAttr() { + auto &attr = getProperties().sym_visibility; + attr = {}; + return attr; +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().function_type = function_type; + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + (void)odsState.addRegion(); +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().function_type = function_type; + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + (void)odsState.addRegion(); +} + +void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FuncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FuncOp::verifyInvariantsImpl() { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps1(*this, tblgen_function_type, "function_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps2(*this, tblgen_arg_attrs, "arg_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps2(*this, tblgen_res_attrs, "res_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(*this, tblgen_sym_visibility, "sym_visibility"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_MLProgramOps0(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FuncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::FuncOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalLoadConstOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalLoadConstOpGenericAdaptorBase::GlobalLoadConstOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.global_load_const", odsAttrs.getContext()); +} + +GlobalLoadConstOpGenericAdaptorBase::GlobalLoadConstOpGenericAdaptorBase(GlobalLoadConstOp op) : GlobalLoadConstOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalLoadConstOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalLoadConstOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::SymbolRefAttr GlobalLoadConstOpGenericAdaptorBase::getGlobalAttr() { + auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); + return attr; +} + +::mlir::SymbolRefAttr GlobalLoadConstOpGenericAdaptorBase::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +} // namespace detail +GlobalLoadConstOpAdaptor::GlobalLoadConstOpAdaptor(GlobalLoadConstOp op) : GlobalLoadConstOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalLoadConstOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitError(loc, "'ml_program.global_load_const' op ""requires attribute 'global'"); + + if (tblgen_global && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_global)))) + return emitError(loc, "'ml_program.global_load_const' op ""attribute 'global' failed to satisfy constraint: symbol reference attribute"); + return ::mlir::success(); +} + +std::pair GlobalLoadConstOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalLoadConstOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalLoadConstOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalLoadConstOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GlobalLoadConstOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GlobalLoadConstOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.global; + auto attr = dict.get("global"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for global in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `global` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalLoadConstOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.global; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("global", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalLoadConstOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.global.getAsOpaquePointer())); +} + +std::optional GlobalLoadConstOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "global") + return prop.global; + return std::nullopt; +} + +void GlobalLoadConstOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "global") { + prop.global = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalLoadConstOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.global) attrs.append("global", prop.global); +} + +::mlir::LogicalResult GlobalLoadConstOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getGlobalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(attr, "global", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalLoadConstOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.global))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalLoadConstOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.global); +} + +::mlir::SymbolRefAttr GlobalLoadConstOp::getGlobalAttr() { + return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); +} + +::mlir::SymbolRefAttr GlobalLoadConstOp::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +void GlobalLoadConstOp::setGlobalAttr(::mlir::SymbolRefAttr attr) { + (*this)->setAttr(getGlobalAttrName(), attr); +} + +void GlobalLoadConstOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::SymbolRefAttr global) { + odsState.getOrAddProperties().global = global; + odsState.addTypes(result); +} + +void GlobalLoadConstOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global) { + odsState.getOrAddProperties().global = global; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalLoadConstOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalLoadConstOp::verifyInvariantsImpl() { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitOpError("requires attribute 'global'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(*this, tblgen_global, "global"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalLoadConstOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GlobalLoadConstOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::SymbolRefAttr globalAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + if (parser.parseCustomAttributeWithFallback(globalAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (globalAttr) result.getOrAddProperties().global = globalAttr; + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addTypes(resultTypes); + return ::mlir::success(); +} + +void GlobalLoadConstOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getGlobalAttr()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("global"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GlobalLoadConstOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalLoadConstOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalLoadGraphOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalLoadGraphOpGenericAdaptorBase::GlobalLoadGraphOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.global_load_graph", odsAttrs.getContext()); +} + +GlobalLoadGraphOpGenericAdaptorBase::GlobalLoadGraphOpGenericAdaptorBase(GlobalLoadGraphOp op) : GlobalLoadGraphOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalLoadGraphOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr GlobalLoadGraphOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::SymbolRefAttr GlobalLoadGraphOpGenericAdaptorBase::getGlobalAttr() { + auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); + return attr; +} + +::mlir::SymbolRefAttr GlobalLoadGraphOpGenericAdaptorBase::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +} // namespace detail +GlobalLoadGraphOpAdaptor::GlobalLoadGraphOpAdaptor(GlobalLoadGraphOp op) : GlobalLoadGraphOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalLoadGraphOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitError(loc, "'ml_program.global_load_graph' op ""requires attribute 'global'"); + + if (tblgen_global && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_global)))) + return emitError(loc, "'ml_program.global_load_graph' op ""attribute 'global' failed to satisfy constraint: symbol reference attribute"); + return ::mlir::success(); +} + +void GlobalLoadGraphOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) { + auto resultGroup0 = getODSResults(0); + if (!resultGroup0.empty()) + setNameFn(*resultGroup0.begin(), "result"); + auto resultGroup1 = getODSResults(1); + if (!resultGroup1.empty()) + setNameFn(*resultGroup1.begin(), "produceToken"); +} + +std::pair GlobalLoadGraphOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range GlobalLoadGraphOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range GlobalLoadGraphOp::getConsumeTokens() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange GlobalLoadGraphOp::getConsumeTokensMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair GlobalLoadGraphOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalLoadGraphOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GlobalLoadGraphOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::TypedValue<::mlir::ml_program::TokenType> GlobalLoadGraphOp::getProduceToken() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ml_program::TokenType>>(*getODSResults(1).begin()); +} + +::mlir::LogicalResult GlobalLoadGraphOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.global; + auto attr = dict.get("global"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for global in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `global` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalLoadGraphOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.global; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("global", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalLoadGraphOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.global.getAsOpaquePointer())); +} + +std::optional GlobalLoadGraphOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "global") + return prop.global; + return std::nullopt; +} + +void GlobalLoadGraphOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "global") { + prop.global = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalLoadGraphOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.global) attrs.append("global", prop.global); +} + +::mlir::LogicalResult GlobalLoadGraphOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getGlobalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(attr, "global", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalLoadGraphOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.global))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalLoadGraphOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.global); +} + +::mlir::SymbolRefAttr GlobalLoadGraphOp::getGlobalAttr() { + return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); +} + +::mlir::SymbolRefAttr GlobalLoadGraphOp::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +void GlobalLoadGraphOp::setGlobalAttr(::mlir::SymbolRefAttr attr) { + (*this)->setAttr(getGlobalAttrName(), attr); +} + +void GlobalLoadGraphOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Type produceToken, ::mlir::SymbolRefAttr global, ::mlir::ValueRange consumeTokens) { + odsState.addOperands(consumeTokens); + odsState.getOrAddProperties().global = global; + odsState.addTypes(result); + odsState.addTypes(produceToken); +} + +void GlobalLoadGraphOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global, ::mlir::ValueRange consumeTokens) { + odsState.addOperands(consumeTokens); + odsState.getOrAddProperties().global = global; + assert(resultTypes.size() == 2u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalLoadGraphOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 2u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalLoadGraphOp::verifyInvariantsImpl() { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitOpError("requires attribute 'global'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(*this, tblgen_global, "global"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalLoadGraphOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GlobalLoadGraphOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::SymbolRefAttr globalAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> consumeTokensOperands; + ::llvm::SMLoc consumeTokensOperandsLoc; + (void)consumeTokensOperandsLoc; + ::mlir::Type produceTokenRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> produceTokenTypes(produceTokenRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + if (parser.parseCustomAttributeWithFallback(globalAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (globalAttr) result.getOrAddProperties().global = globalAttr; + { + consumeTokensOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseTokenOrdering(parser, consumeTokensOperands, produceTokenRawTypes[0]); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::ml_program::TokenType>(); + result.addTypes(resultTypes); + result.addTypes(produceTokenTypes); + if (parser.resolveOperands(consumeTokensOperands, odsBuildableType0, consumeTokensOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalLoadGraphOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getGlobalAttr()); + printTokenOrdering(_odsPrinter, *this, getConsumeTokens(), getProduceToken().getType()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("global"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GlobalLoadGraphOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + effects.emplace_back(::mlir::MemoryEffects::Read::get(), getGlobalAttr(), 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalLoadGraphOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalLoadOpGenericAdaptorBase::GlobalLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.global_load", odsAttrs.getContext()); +} + +GlobalLoadOpGenericAdaptorBase::GlobalLoadOpGenericAdaptorBase(GlobalLoadOp op) : GlobalLoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::SymbolRefAttr GlobalLoadOpGenericAdaptorBase::getGlobalAttr() { + auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); + return attr; +} + +::mlir::SymbolRefAttr GlobalLoadOpGenericAdaptorBase::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +} // namespace detail +GlobalLoadOpAdaptor::GlobalLoadOpAdaptor(GlobalLoadOp op) : GlobalLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalLoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitError(loc, "'ml_program.global_load' op ""requires attribute 'global'"); + + if (tblgen_global && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_global)))) + return emitError(loc, "'ml_program.global_load' op ""attribute 'global' failed to satisfy constraint: symbol reference attribute"); + return ::mlir::success(); +} + +std::pair GlobalLoadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GlobalLoadOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GlobalLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.global; + auto attr = dict.get("global"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for global in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `global` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.global; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("global", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalLoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.global.getAsOpaquePointer())); +} + +std::optional GlobalLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "global") + return prop.global; + return std::nullopt; +} + +void GlobalLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "global") { + prop.global = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.global) attrs.append("global", prop.global); +} + +::mlir::LogicalResult GlobalLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getGlobalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(attr, "global", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.global))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.global); +} + +::mlir::SymbolRefAttr GlobalLoadOp::getGlobalAttr() { + return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); +} + +::mlir::SymbolRefAttr GlobalLoadOp::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +void GlobalLoadOp::setGlobalAttr(::mlir::SymbolRefAttr attr) { + (*this)->setAttr(getGlobalAttrName(), attr); +} + +void GlobalLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::SymbolRefAttr global) { + odsState.getOrAddProperties().global = global; + odsState.addTypes(result); +} + +void GlobalLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global) { + odsState.getOrAddProperties().global = global; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalLoadOp::verifyInvariantsImpl() { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitOpError("requires attribute 'global'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(*this, tblgen_global, "global"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalLoadOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GlobalLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::SymbolRefAttr globalAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + if (parser.parseCustomAttributeWithFallback(globalAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (globalAttr) result.getOrAddProperties().global = globalAttr; + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addTypes(resultTypes); + return ::mlir::success(); +} + +void GlobalLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getGlobalAttr()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("global"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GlobalLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + effects.emplace_back(::mlir::MemoryEffects::Read::get(), getGlobalAttr(), 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalLoadOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalOpGenericAdaptorBase::GlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.global", odsAttrs.getContext()); +} + +GlobalOpGenericAdaptorBase::GlobalOpGenericAdaptorBase(GlobalOp op) : GlobalOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr GlobalOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef GlobalOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr GlobalOpGenericAdaptorBase::getTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); + return attr; +} + +::mlir::Type GlobalOpGenericAdaptorBase::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::UnitAttr GlobalOpGenericAdaptorBase::getIsMutableAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().is_mutable); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool GlobalOpGenericAdaptorBase::getIsMutable() { + auto attr = getIsMutableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Attribute GlobalOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().value); + return attr; +} + +::std::optional<::mlir::Attribute> GlobalOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +::mlir::StringAttr GlobalOpGenericAdaptorBase::getSymVisibilityAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); + return attr; +} + +::std::optional< ::llvm::StringRef > GlobalOpGenericAdaptorBase::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +GlobalOpAdaptor::GlobalOpAdaptor(GlobalOp op) : GlobalOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_is_mutable = getProperties().is_mutable; (void)tblgen_is_mutable; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'ml_program.global' op ""requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitError(loc, "'ml_program.global' op ""requires attribute 'type'"); + auto tblgen_value = getProperties().value; (void)tblgen_value; + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'ml_program.global' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) + return emitError(loc, "'ml_program.global' op ""attribute 'type' failed to satisfy constraint: any type attribute"); + + if (tblgen_is_mutable && !((::llvm::isa<::mlir::UnitAttr>(tblgen_is_mutable)))) + return emitError(loc, "'ml_program.global' op ""attribute 'is_mutable' failed to satisfy constraint: unit attribute"); + + if (tblgen_value && !((true))) + return emitError(loc, "'ml_program.global' op ""attribute 'value' failed to satisfy constraint: any attribute"); + + if (tblgen_sym_visibility && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_visibility)))) + return emitError(loc, "'ml_program.global' op ""attribute 'sym_visibility' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair GlobalOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult GlobalOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.is_mutable; + auto attr = dict.get("is_mutable"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for is_mutable in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `is_mutable` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_visibility; + auto attr = dict.get("sym_visibility"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for sym_visibility in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.type; + auto attr = dict.get("type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.is_mutable; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("is_mutable", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.sym_visibility; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_visibility", + propStorage)); + } + + { + const auto &propStorage = prop.type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("type", + propStorage)); + } + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.is_mutable.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.sym_visibility.getAsOpaquePointer()), + llvm::hash_value(prop.type.getAsOpaquePointer()), + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional GlobalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "is_mutable") + return prop.is_mutable; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "sym_visibility") + return prop.sym_visibility; + + if (name == "type") + return prop.type; + + if (name == "value") + return prop.value; + return std::nullopt; +} + +void GlobalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "is_mutable") { + prop.is_mutable = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_visibility") { + prop.sym_visibility = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "type") { + prop.type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.is_mutable) attrs.append("is_mutable", prop.is_mutable); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.sym_visibility) attrs.append("sym_visibility", prop.sym_visibility); + + if (prop.type) attrs.append("type", prop.type); + + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult GlobalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIsMutableAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps5(attr, "is_mutable", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymVisibilityAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(attr, "sym_visibility", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps4(attr, "type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps6(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.is_mutable))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.sym_visibility))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.is_mutable); + writer.writeAttribute(prop.sym_name); + + writer.writeOptionalAttribute(prop.sym_visibility); + writer.writeAttribute(prop.type); + + writer.writeOptionalAttribute(prop.value); +} + +::mlir::StringAttr GlobalOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef GlobalOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr GlobalOp::getTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); +} + +::mlir::Type GlobalOp::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::UnitAttr GlobalOp::getIsMutableAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().is_mutable); +} + +bool GlobalOp::getIsMutable() { + auto attr = getIsMutableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Attribute GlobalOp::getValueAttr() { + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().value); +} + +::std::optional<::mlir::Attribute> GlobalOp::getValue() { + auto attr = getValueAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +::mlir::StringAttr GlobalOp::getSymVisibilityAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); +} + +::std::optional< ::llvm::StringRef > GlobalOp::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void GlobalOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void GlobalOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void GlobalOp::setTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getTypeAttrName(), attr); +} + +void GlobalOp::setType(::mlir::Type attrValue) { + (*this)->setAttr(getTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void GlobalOp::setIsMutableAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getIsMutableAttrName(), attr); +} + +void GlobalOp::setIsMutable(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getIsMutableAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getIsMutableAttrName()); +} + +void GlobalOp::setValueAttr(::mlir::Attribute attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void GlobalOp::setSymVisibilityAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymVisibilityAttrName(), attr); +} + +void GlobalOp::setSymVisibility(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSymVisibilityAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSymVisibilityAttrName()); +} + +::mlir::Attribute GlobalOp::removeIsMutableAttr() { + auto &attr = getProperties().is_mutable; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeValueAttr() { + auto &attr = getProperties().value; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeSymVisibilityAttr() { + auto &attr = getProperties().sym_visibility; + attr = {}; + return attr; +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::UnitAttr is_mutable, /*optional*/::mlir::Attribute value, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + if (is_mutable) { + odsState.getOrAddProperties().is_mutable = is_mutable; + } + if (value) { + odsState.getOrAddProperties().value = value; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::UnitAttr is_mutable, /*optional*/::mlir::Attribute value, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + if (is_mutable) { + odsState.getOrAddProperties().is_mutable = is_mutable; + } + if (value) { + odsState.getOrAddProperties().value = value; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/bool is_mutable, /*optional*/::mlir::Attribute value, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + if (is_mutable) { + odsState.getOrAddProperties().is_mutable = ((is_mutable) ? odsBuilder.getUnitAttr() : nullptr); + } + if (value) { + odsState.getOrAddProperties().value = value; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/bool is_mutable, /*optional*/::mlir::Attribute value, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + if (is_mutable) { + odsState.getOrAddProperties().is_mutable = ((is_mutable) ? odsBuilder.getUnitAttr() : nullptr); + } + if (value) { + odsState.getOrAddProperties().value = value; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalOp::verifyInvariantsImpl() { + auto tblgen_is_mutable = getProperties().is_mutable; (void)tblgen_is_mutable; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitOpError("requires attribute 'type'"); + auto tblgen_value = getProperties().value; (void)tblgen_value; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps4(*this, tblgen_type, "type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps5(*this, tblgen_is_mutable, "is_mutable"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps6(*this, tblgen_value, "value"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(*this, tblgen_sym_visibility, "sym_visibility"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult GlobalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_visibilityAttr; + ::mlir::StringAttr sym_nameAttr; + ::mlir::TypeAttr typeAttr; + ::mlir::Attribute valueAttr; + { + auto odsResult = parseSymbolVisibility(parser, sym_visibilityAttr); + if (odsResult) return ::mlir::failure(); + if (sym_visibilityAttr) + result.getOrAddProperties().sym_visibility = sym_visibilityAttr; + } + if (::mlir::succeeded(parser.parseOptionalKeyword("mutable"))) { + result.getOrAddProperties().is_mutable = parser.getBuilder().getUnitAttr(); } + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + { + auto odsResult = parseTypedInitialValue(parser, typeAttr, valueAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().type = typeAttr; + if (valueAttr) + result.getOrAddProperties().value = valueAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void GlobalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + printSymbolVisibility(_odsPrinter, *this, getSymVisibilityAttr()); + if (getIsMutableAttr()) { + _odsPrinter << ' ' << "mutable"; + } + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + printTypedInitialValue(_odsPrinter, *this, getTypeAttr(), getValueAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_visibility"); + elidedAttrs.push_back("is_mutable"); + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("type"); + elidedAttrs.push_back("value"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getIsMutableAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("is_mutable"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalStoreGraphOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalStoreGraphOpGenericAdaptorBase::GlobalStoreGraphOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.global_store_graph", odsAttrs.getContext()); +} + +GlobalStoreGraphOpGenericAdaptorBase::GlobalStoreGraphOpGenericAdaptorBase(GlobalStoreGraphOp op) : GlobalStoreGraphOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalStoreGraphOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr GlobalStoreGraphOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::SymbolRefAttr GlobalStoreGraphOpGenericAdaptorBase::getGlobalAttr() { + auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); + return attr; +} + +::mlir::SymbolRefAttr GlobalStoreGraphOpGenericAdaptorBase::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +} // namespace detail +GlobalStoreGraphOpAdaptor::GlobalStoreGraphOpAdaptor(GlobalStoreGraphOp op) : GlobalStoreGraphOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalStoreGraphOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitError(loc, "'ml_program.global_store_graph' op ""requires attribute 'global'"); + + if (tblgen_global && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_global)))) + return emitError(loc, "'ml_program.global_store_graph' op ""attribute 'global' failed to satisfy constraint: symbol reference attribute"); + return ::mlir::success(); +} + +std::pair GlobalStoreGraphOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range GlobalStoreGraphOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GlobalStoreGraphOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range GlobalStoreGraphOp::getConsumeTokens() { + return getODSOperands(1); +} + +::mlir::OpOperand &GlobalStoreGraphOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange GlobalStoreGraphOp::getConsumeTokensMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair GlobalStoreGraphOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalStoreGraphOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ml_program::TokenType> GlobalStoreGraphOp::getProduceToken() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ml_program::TokenType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GlobalStoreGraphOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.global; + auto attr = dict.get("global"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for global in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `global` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalStoreGraphOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.global; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("global", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalStoreGraphOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.global.getAsOpaquePointer())); +} + +std::optional GlobalStoreGraphOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "global") + return prop.global; + return std::nullopt; +} + +void GlobalStoreGraphOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "global") { + prop.global = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalStoreGraphOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.global) attrs.append("global", prop.global); +} + +::mlir::LogicalResult GlobalStoreGraphOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getGlobalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(attr, "global", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalStoreGraphOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.global))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalStoreGraphOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.global); +} + +::mlir::SymbolRefAttr GlobalStoreGraphOp::getGlobalAttr() { + return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); +} + +::mlir::SymbolRefAttr GlobalStoreGraphOp::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +void GlobalStoreGraphOp::setGlobalAttr(::mlir::SymbolRefAttr attr) { + (*this)->setAttr(getGlobalAttrName(), attr); +} + +void GlobalStoreGraphOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type produceToken, ::mlir::SymbolRefAttr global, ::mlir::Value value, ::mlir::ValueRange consumeTokens) { + odsState.addOperands(value); + odsState.addOperands(consumeTokens); + odsState.getOrAddProperties().global = global; + odsState.addTypes(produceToken); +} + +void GlobalStoreGraphOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global, ::mlir::Value value, ::mlir::ValueRange consumeTokens) { + odsState.addOperands(value); + odsState.addOperands(consumeTokens); + odsState.getOrAddProperties().global = global; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalStoreGraphOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalStoreGraphOp::verifyInvariantsImpl() { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitOpError("requires attribute 'global'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(*this, tblgen_global, "global"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalStoreGraphOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GlobalStoreGraphOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::SymbolRefAttr globalAttr; + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> consumeTokensOperands; + ::llvm::SMLoc consumeTokensOperandsLoc; + (void)consumeTokensOperandsLoc; + ::mlir::Type produceTokenRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> produceTokenTypes(produceTokenRawTypes); + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + if (parser.parseCustomAttributeWithFallback(globalAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (globalAttr) result.getOrAddProperties().global = globalAttr; + if (parser.parseEqual()) + return ::mlir::failure(); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + { + consumeTokensOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseTokenOrdering(parser, consumeTokensOperands, produceTokenRawTypes[0]); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::ml_program::TokenType>(); + result.addTypes(produceTokenTypes); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(consumeTokensOperands, odsBuildableType0, consumeTokensOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalStoreGraphOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getGlobalAttr()); + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getValue(); + printTokenOrdering(_odsPrinter, *this, getConsumeTokens(), getProduceToken().getType()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("global"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GlobalStoreGraphOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + effects.emplace_back(::mlir::MemoryEffects::Read::get(), getGlobalAttr(), 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalStoreGraphOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalStoreOpGenericAdaptorBase::GlobalStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.global_store", odsAttrs.getContext()); +} + +GlobalStoreOpGenericAdaptorBase::GlobalStoreOpGenericAdaptorBase(GlobalStoreOp op) : GlobalStoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::SymbolRefAttr GlobalStoreOpGenericAdaptorBase::getGlobalAttr() { + auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); + return attr; +} + +::mlir::SymbolRefAttr GlobalStoreOpGenericAdaptorBase::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +} // namespace detail +GlobalStoreOpAdaptor::GlobalStoreOpAdaptor(GlobalStoreOp op) : GlobalStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalStoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitError(loc, "'ml_program.global_store' op ""requires attribute 'global'"); + + if (tblgen_global && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_global)))) + return emitError(loc, "'ml_program.global_store' op ""attribute 'global' failed to satisfy constraint: symbol reference attribute"); + return ::mlir::success(); +} + +std::pair GlobalStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GlobalStoreOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GlobalStoreOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GlobalStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult GlobalStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.global; + auto attr = dict.get("global"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for global in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `global` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.global; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("global", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalStoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.global.getAsOpaquePointer())); +} + +std::optional GlobalStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "global") + return prop.global; + return std::nullopt; +} + +void GlobalStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "global") { + prop.global = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.global) attrs.append("global", prop.global); +} + +::mlir::LogicalResult GlobalStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getGlobalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(attr, "global", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.global))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.global); +} + +::mlir::SymbolRefAttr GlobalStoreOp::getGlobalAttr() { + return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().global); +} + +::mlir::SymbolRefAttr GlobalStoreOp::getGlobal() { + auto attr = getGlobalAttr(); + return attr; +} + +void GlobalStoreOp::setGlobalAttr(::mlir::SymbolRefAttr attr) { + (*this)->setAttr(getGlobalAttrName(), attr); +} + +void GlobalStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::SymbolRefAttr global, ::mlir::Value value) { + odsState.addOperands(value); + odsState.getOrAddProperties().global = global; +} + +void GlobalStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global, ::mlir::Value value) { + odsState.addOperands(value); + odsState.getOrAddProperties().global = global; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalStoreOp::verifyInvariantsImpl() { + auto tblgen_global = getProperties().global; (void)tblgen_global; + if (!tblgen_global) return emitOpError("requires attribute 'global'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps3(*this, tblgen_global, "global"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GlobalStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::SymbolRefAttr globalAttr; + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + if (parser.parseCustomAttributeWithFallback(globalAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (globalAttr) result.getOrAddProperties().global = globalAttr; + if (parser.parseEqual()) + return ::mlir::failure(); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getGlobalAttr()); + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("global"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GlobalStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + effects.emplace_back(::mlir::MemoryEffects::Write::get(), getGlobalAttr(), 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalStoreOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::OutputOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +OutputOpGenericAdaptorBase::OutputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.output", odsAttrs.getContext()); +} + +OutputOpGenericAdaptorBase::OutputOpGenericAdaptorBase(OutputOp op) : OutputOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair OutputOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr OutputOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +OutputOpAdaptor::OutputOpAdaptor(OutputOp op) : OutputOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult OutputOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair OutputOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range OutputOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range OutputOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange OutputOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair OutputOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range OutputOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void OutputOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + build(odsBuilder, odsState, std::nullopt); + +} + +void OutputOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { + odsState.addOperands(operands); +} + +void OutputOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult OutputOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult OutputOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult OutputOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> operandsTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (!operandsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(operandsTypes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OutputOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (!getOperands().empty()) { + _odsPrinter << ' '; + _odsPrinter << getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperands().getTypes(); + } +} + +void OutputOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange OutputOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::OutputOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::ReturnOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.return", odsAttrs.getContext()); +} + +ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(ReturnOp op) : ReturnOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReturnOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ReturnOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ReturnOpAdaptor::ReturnOpAdaptor(ReturnOp op) : ReturnOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReturnOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ReturnOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ReturnOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ReturnOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange ReturnOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ReturnOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReturnOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + build(odsBuilder, odsState, std::nullopt); + +} + +void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { + odsState.addOperands(operands); +} + +void ReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReturnOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReturnOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReturnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> operandsTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (!operandsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(operandsTypes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (!getOperands().empty()) { + _odsPrinter << ' '; + _odsPrinter << getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperands().getTypes(); + } +} + +void ReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange ReturnOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::ReturnOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::SubgraphOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubgraphOpGenericAdaptorBase::SubgraphOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.subgraph", odsAttrs.getContext()); +} + +SubgraphOpGenericAdaptorBase::SubgraphOpGenericAdaptorBase(SubgraphOp op) : SubgraphOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubgraphOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SubgraphOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr SubgraphOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef SubgraphOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SubgraphOpGenericAdaptorBase::getFunctionTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); + return attr; +} + +::mlir::FunctionType SubgraphOpGenericAdaptorBase::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::ArrayAttr SubgraphOpGenericAdaptorBase::getArgAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > SubgraphOpGenericAdaptorBase::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr SubgraphOpGenericAdaptorBase::getResAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > SubgraphOpGenericAdaptorBase::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::StringAttr SubgraphOpGenericAdaptorBase::getSymVisibilityAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); + return attr; +} + +::std::optional< ::llvm::StringRef > SubgraphOpGenericAdaptorBase::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &SubgraphOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange SubgraphOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +SubgraphOpAdaptor::SubgraphOpAdaptor(SubgraphOp op) : SubgraphOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubgraphOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitError(loc, "'ml_program.subgraph' op ""requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'ml_program.subgraph' op ""requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'ml_program.subgraph' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))))) + return emitError(loc, "'ml_program.subgraph' op ""attribute 'function_type' failed to satisfy constraint: type attribute of function type"); + + if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'ml_program.subgraph' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'ml_program.subgraph' op ""attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_sym_visibility && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_visibility)))) + return emitError(loc, "'ml_program.subgraph' op ""attribute 'sym_visibility' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair SubgraphOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SubgraphOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SubgraphOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubgraphOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &SubgraphOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult SubgraphOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.arg_attrs; + auto attr = dict.get("arg_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for arg_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.function_type; + auto attr = dict.get("function_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for function_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `function_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.res_attrs; + auto attr = dict.get("res_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for res_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_visibility; + auto attr = dict.get("sym_visibility"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for sym_visibility in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SubgraphOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.arg_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.function_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("function_type", + propStorage)); + } + + { + const auto &propStorage = prop.res_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("res_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.sym_visibility; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_visibility", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubgraphOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.function_type.getAsOpaquePointer()), + llvm::hash_value(prop.res_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.sym_visibility.getAsOpaquePointer())); +} + +std::optional SubgraphOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "arg_attrs") + return prop.arg_attrs; + + if (name == "function_type") + return prop.function_type; + + if (name == "res_attrs") + return prop.res_attrs; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "sym_visibility") + return prop.sym_visibility; + return std::nullopt; +} + +void SubgraphOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "arg_attrs") { + prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "function_type") { + prop.function_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "res_attrs") { + prop.res_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_visibility") { + prop.sym_visibility = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SubgraphOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); + + if (prop.function_type) attrs.append("function_type", prop.function_type); + + if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.sym_visibility) attrs.append("sym_visibility", prop.sym_visibility); +} + +::mlir::LogicalResult SubgraphOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps2(attr, "arg_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps1(attr, "function_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps2(attr, "res_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymVisibilityAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(attr, "sym_visibility", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgraphOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.function_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.sym_visibility))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubgraphOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.arg_attrs); + writer.writeAttribute(prop.function_type); + + writer.writeOptionalAttribute(prop.res_attrs); + writer.writeAttribute(prop.sym_name); + + writer.writeOptionalAttribute(prop.sym_visibility); +} + +::mlir::StringAttr SubgraphOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef SubgraphOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr SubgraphOp::getFunctionTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); +} + +::mlir::FunctionType SubgraphOp::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::ArrayAttr SubgraphOp::getArgAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); +} + +::std::optional< ::mlir::ArrayAttr > SubgraphOp::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr SubgraphOp::getResAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); +} + +::std::optional< ::mlir::ArrayAttr > SubgraphOp::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::StringAttr SubgraphOp::getSymVisibilityAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); +} + +::std::optional< ::llvm::StringRef > SubgraphOp::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void SubgraphOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void SubgraphOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void SubgraphOp::setFunctionTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getFunctionTypeAttrName(), attr); +} + +void SubgraphOp::setFunctionType(::mlir::FunctionType attrValue) { + (*this)->setAttr(getFunctionTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void SubgraphOp::setArgAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getArgAttrsAttrName(), attr); +} + +void SubgraphOp::setResAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getResAttrsAttrName(), attr); +} + +void SubgraphOp::setSymVisibilityAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymVisibilityAttrName(), attr); +} + +void SubgraphOp::setSymVisibility(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSymVisibilityAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSymVisibilityAttrName()); +} + +::mlir::Attribute SubgraphOp::removeArgAttrsAttr() { + auto &attr = getProperties().arg_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute SubgraphOp::removeResAttrsAttr() { + auto &attr = getProperties().res_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute SubgraphOp::removeSymVisibilityAttr() { + auto &attr = getProperties().sym_visibility; + attr = {}; + return attr; +} + +void SubgraphOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().function_type = function_type; + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + (void)odsState.addRegion(); +} + +void SubgraphOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().function_type = function_type; + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgraphOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + (void)odsState.addRegion(); +} + +void SubgraphOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().function_type = ::mlir::TypeAttr::get(function_type); + if (arg_attrs) { + odsState.getOrAddProperties().arg_attrs = arg_attrs; + } + if (res_attrs) { + odsState.getOrAddProperties().res_attrs = res_attrs; + } + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubgraphOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SubgraphOp::verifyInvariantsImpl() { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps1(*this, tblgen_function_type, "function_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps2(*this, tblgen_arg_attrs, "arg_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps2(*this, tblgen_res_attrs, "res_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MLProgramOps0(*this, tblgen_sym_visibility, "sym_visibility"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_MLProgramOps0(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubgraphOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::SubgraphOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::TokenOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TokenOpGenericAdaptorBase::TokenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("ml_program.token", odsAttrs.getContext()); +} + +TokenOpGenericAdaptorBase::TokenOpGenericAdaptorBase(TokenOp op) : TokenOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TokenOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TokenOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TokenOpAdaptor::TokenOpAdaptor(TokenOp op) : TokenOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TokenOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TokenOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TokenOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair TokenOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TokenOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::ml_program::TokenType> TokenOp::getToken() { + return ::llvm::cast<::mlir::TypedValue<::mlir::ml_program::TokenType>>(*getODSResults(0).begin()); +} + +void TokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token) { + odsState.addTypes(token); +} + +void TokenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TokenOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TokenOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MLProgramOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TokenOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TokenOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::ml_program::TokenType>(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void TokenOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void TokenOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::TokenOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..973aebb0b59e7540fd5feba17dfeca1cbf8c7f8f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOps.h.inc @@ -0,0 +1,2002 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MLProgramOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace ml_program { +class FuncOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class GlobalLoadConstOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class GlobalLoadGraphOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class GlobalLoadOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class GlobalOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class GlobalStoreGraphOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class GlobalStoreOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class OutputOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class ReturnOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class SubgraphOp; +} // namespace ml_program +} // namespace mlir +namespace mlir { +namespace ml_program { +class TokenOp; +} // namespace ml_program +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::FuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FuncOpGenericAdaptorBase { +public: + struct Properties { + using arg_attrsTy = ::mlir::ArrayAttr; + arg_attrsTy arg_attrs; + + auto getArgAttrs() { + auto &propStorage = this->arg_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setArgAttrs(const ::mlir::ArrayAttr &propValue) { + this->arg_attrs = propValue; + } + using function_typeTy = ::mlir::TypeAttr; + function_typeTy function_type; + + auto getFunctionType() { + auto &propStorage = this->function_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setFunctionType(const ::mlir::TypeAttr &propValue) { + this->function_type = propValue; + } + using res_attrsTy = ::mlir::ArrayAttr; + res_attrsTy res_attrs; + + auto getResAttrs() { + auto &propStorage = this->res_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setResAttrs(const ::mlir::ArrayAttr &propValue) { + this->res_attrs = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using sym_visibilityTy = ::mlir::StringAttr; + sym_visibilityTy sym_visibility; + + auto getSymVisibility() { + auto &propStorage = this->sym_visibility; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSymVisibility(const ::mlir::StringAttr &propValue) { + this->sym_visibility = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.arg_attrs == this->arg_attrs && + rhs.function_type == this->function_type && + rhs.res_attrs == this->res_attrs && + rhs.sym_name == this->sym_name && + rhs.sym_visibility == this->sym_visibility && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FuncOpGenericAdaptorBase(FuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FuncOpGenericAdaptor : public detail::FuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FuncOpGenericAdaptorBase; +public: + FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FuncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FuncOpAdaptor : public FuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using FuncOpGenericAdaptor::FuncOpGenericAdaptor; + FuncOpAdaptor(FuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FuncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FuncOpAdaptor; + template + using GenericAdaptor = FuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("function_type"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("sym_visibility")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getArgAttrsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFunctionTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getResAttrsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSymVisibilityAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setFunctionTypeAttr(::mlir::TypeAttr attr); + void setFunctionType(::mlir::FunctionType attrValue); + void setArgAttrsAttr(::mlir::ArrayAttr attr); + void setResAttrsAttr(::mlir::ArrayAttr attr); + void setSymVisibilityAttr(::mlir::StringAttr attr); + void setSymVisibility(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeArgAttrsAttr(); + ::mlir::Attribute removeResAttrsAttr(); + ::mlir::Attribute removeSymVisibilityAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + //===------------------------------------------------------------------===// + // FunctionOpInterface Methods + //===------------------------------------------------------------------===// + + /// Returns the region on the current operation that is callable. This may + /// return null in the case of an external callable object, e.g. an external + /// function. + ::mlir::Region *getCallableRegion() { + return isExternal() ? nullptr : &getBody(); + } + + /// Returns the argument types of this function. + ArrayRef getArgumentTypes() { return getFunctionType().getInputs(); } + + /// Returns the result types of this function. + ArrayRef getResultTypes() { return getFunctionType().getResults(); } + + //===------------------------------------------------------------------===// + // RegionKindInterface Methods + //===------------------------------------------------------------------===// + static ::mlir::RegionKind getRegionKind(unsigned index) { + return ::mlir::RegionKind::SSACFG; + } + + //===------------------------------------------------------------------===// + // SymbolOpInterface Methods + //===------------------------------------------------------------------===// + + bool isDeclaration() { return isExternal(); } +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::FuncOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalLoadConstOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalLoadConstOpGenericAdaptorBase { +public: + struct Properties { + using globalTy = ::mlir::SymbolRefAttr; + globalTy global; + + auto getGlobal() { + auto &propStorage = this->global; + return ::llvm::cast<::mlir::SymbolRefAttr>(propStorage); + } + void setGlobal(const ::mlir::SymbolRefAttr &propValue) { + this->global = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.global == this->global && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalLoadConstOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalLoadConstOpGenericAdaptorBase(GlobalLoadConstOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); +}; +} // namespace detail +template +class GlobalLoadConstOpGenericAdaptor : public detail::GlobalLoadConstOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalLoadConstOpGenericAdaptorBase; +public: + GlobalLoadConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalLoadConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalLoadConstOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalLoadConstOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalLoadConstOpAdaptor : public GlobalLoadConstOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalLoadConstOpGenericAdaptor::GlobalLoadConstOpGenericAdaptor; + GlobalLoadConstOpAdaptor(GlobalLoadConstOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalLoadConstOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalLoadConstOpAdaptor; + template + using GenericAdaptor = GlobalLoadConstOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("global")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getGlobalAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getGlobalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.global_load_const"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); + void setGlobalAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::SymbolRefAttr global); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Gets the corresponding GlobalOp (or nullptr). + GlobalOp getGlobalOp(SymbolTableCollection &symbolTable); +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalLoadConstOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalLoadGraphOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalLoadGraphOpGenericAdaptorBase { +public: + struct Properties { + using globalTy = ::mlir::SymbolRefAttr; + globalTy global; + + auto getGlobal() { + auto &propStorage = this->global; + return ::llvm::cast<::mlir::SymbolRefAttr>(propStorage); + } + void setGlobal(const ::mlir::SymbolRefAttr &propValue) { + this->global = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.global == this->global && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalLoadGraphOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalLoadGraphOpGenericAdaptorBase(GlobalLoadGraphOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); +}; +} // namespace detail +template +class GlobalLoadGraphOpGenericAdaptor : public detail::GlobalLoadGraphOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalLoadGraphOpGenericAdaptorBase; +public: + GlobalLoadGraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalLoadGraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalLoadGraphOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalLoadGraphOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getConsumeTokens() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalLoadGraphOpAdaptor : public GlobalLoadGraphOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalLoadGraphOpGenericAdaptor::GlobalLoadGraphOpGenericAdaptor; + GlobalLoadGraphOpAdaptor(GlobalLoadGraphOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalLoadGraphOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalLoadGraphOpAdaptor; + template + using GenericAdaptor = GlobalLoadGraphOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("global")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getGlobalAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getGlobalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.global_load_graph"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getConsumeTokens(); + ::mlir::MutableOperandRange getConsumeTokensMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + ::mlir::TypedValue<::mlir::ml_program::TokenType> getProduceToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); + void setGlobalAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Type produceToken, ::mlir::SymbolRefAttr global, ::mlir::ValueRange consumeTokens); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global, ::mlir::ValueRange consumeTokens); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Gets the corresponding GlobalOp (or nullptr). + GlobalOp getGlobalOp(SymbolTableCollection &symbolTable); +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalLoadGraphOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalLoadOpGenericAdaptorBase { +public: + struct Properties { + using globalTy = ::mlir::SymbolRefAttr; + globalTy global; + + auto getGlobal() { + auto &propStorage = this->global; + return ::llvm::cast<::mlir::SymbolRefAttr>(propStorage); + } + void setGlobal(const ::mlir::SymbolRefAttr &propValue) { + this->global = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.global == this->global && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalLoadOpGenericAdaptorBase(GlobalLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); +}; +} // namespace detail +template +class GlobalLoadOpGenericAdaptor : public detail::GlobalLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalLoadOpGenericAdaptorBase; +public: + GlobalLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalLoadOpAdaptor : public GlobalLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalLoadOpGenericAdaptor::GlobalLoadOpGenericAdaptor; + GlobalLoadOpAdaptor(GlobalLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalLoadOpAdaptor; + template + using GenericAdaptor = GlobalLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("global")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getGlobalAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getGlobalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.global_load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); + void setGlobalAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::SymbolRefAttr global); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Gets the corresponding GlobalOp (or nullptr). + GlobalOp getGlobalOp(SymbolTableCollection &symbolTable); +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalLoadOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalOpGenericAdaptorBase { +public: + struct Properties { + using is_mutableTy = ::mlir::UnitAttr; + is_mutableTy is_mutable; + + auto getIsMutable() { + auto &propStorage = this->is_mutable; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setIsMutable(const ::mlir::UnitAttr &propValue) { + this->is_mutable = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using sym_visibilityTy = ::mlir::StringAttr; + sym_visibilityTy sym_visibility; + + auto getSymVisibility() { + auto &propStorage = this->sym_visibility; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSymVisibility(const ::mlir::StringAttr &propValue) { + this->sym_visibility = propValue; + } + using typeTy = ::mlir::TypeAttr; + typeTy type; + + auto getType() { + auto &propStorage = this->type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setType(const ::mlir::TypeAttr &propValue) { + this->type = propValue; + } + using valueTy = ::mlir::Attribute; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(propStorage); + } + void setValue(const ::mlir::Attribute &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.is_mutable == this->is_mutable && + rhs.sym_name == this->sym_name && + rhs.sym_visibility == this->sym_visibility && + rhs.type == this->type && + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalOpGenericAdaptorBase(GlobalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + ::mlir::UnitAttr getIsMutableAttr(); + bool getIsMutable(); + ::mlir::Attribute getValueAttr(); + ::std::optional<::mlir::Attribute> getValue(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); +}; +} // namespace detail +template +class GlobalOpGenericAdaptor : public detail::GlobalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalOpGenericAdaptorBase; +public: + GlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalOpAdaptor : public GlobalOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalOpGenericAdaptor::GlobalOpGenericAdaptor; + GlobalOpAdaptor(GlobalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalOpAdaptor; + template + using GenericAdaptor = GlobalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_mutable"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("sym_visibility"), ::llvm::StringRef("type"), ::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsMutableAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsMutableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSymVisibilityAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.global"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + ::mlir::UnitAttr getIsMutableAttr(); + bool getIsMutable(); + ::mlir::Attribute getValueAttr(); + ::std::optional<::mlir::Attribute> getValue(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setTypeAttr(::mlir::TypeAttr attr); + void setType(::mlir::Type attrValue); + void setIsMutableAttr(::mlir::UnitAttr attr); + void setIsMutable(bool attrValue); + void setValueAttr(::mlir::Attribute attr); + void setSymVisibilityAttr(::mlir::StringAttr attr); + void setSymVisibility(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeIsMutableAttr(); + ::mlir::Attribute removeValueAttr(); + ::mlir::Attribute removeSymVisibilityAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::UnitAttr is_mutable, /*optional*/::mlir::Attribute value, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::UnitAttr is_mutable, /*optional*/::mlir::Attribute value, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/bool is_mutable, /*optional*/::mlir::Attribute value, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/bool is_mutable, /*optional*/::mlir::Attribute value, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalStoreGraphOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalStoreGraphOpGenericAdaptorBase { +public: + struct Properties { + using globalTy = ::mlir::SymbolRefAttr; + globalTy global; + + auto getGlobal() { + auto &propStorage = this->global; + return ::llvm::cast<::mlir::SymbolRefAttr>(propStorage); + } + void setGlobal(const ::mlir::SymbolRefAttr &propValue) { + this->global = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.global == this->global && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalStoreGraphOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalStoreGraphOpGenericAdaptorBase(GlobalStoreGraphOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); +}; +} // namespace detail +template +class GlobalStoreGraphOpGenericAdaptor : public detail::GlobalStoreGraphOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalStoreGraphOpGenericAdaptorBase; +public: + GlobalStoreGraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalStoreGraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalStoreGraphOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalStoreGraphOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getConsumeTokens() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalStoreGraphOpAdaptor : public GlobalStoreGraphOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalStoreGraphOpGenericAdaptor::GlobalStoreGraphOpGenericAdaptor; + GlobalStoreGraphOpAdaptor(GlobalStoreGraphOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalStoreGraphOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalStoreGraphOpAdaptor; + template + using GenericAdaptor = GlobalStoreGraphOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("global")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getGlobalAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getGlobalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.global_store_graph"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::Operation::operand_range getConsumeTokens(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::MutableOperandRange getConsumeTokensMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ml_program::TokenType> getProduceToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); + void setGlobalAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type produceToken, ::mlir::SymbolRefAttr global, ::mlir::Value value, ::mlir::ValueRange consumeTokens); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global, ::mlir::Value value, ::mlir::ValueRange consumeTokens); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Gets the corresponding GlobalOp (or nullptr). + GlobalOp getGlobalOp(SymbolTableCollection &symbolTable); +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalStoreGraphOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::GlobalStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalStoreOpGenericAdaptorBase { +public: + struct Properties { + using globalTy = ::mlir::SymbolRefAttr; + globalTy global; + + auto getGlobal() { + auto &propStorage = this->global; + return ::llvm::cast<::mlir::SymbolRefAttr>(propStorage); + } + void setGlobal(const ::mlir::SymbolRefAttr &propValue) { + this->global = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.global == this->global && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalStoreOpGenericAdaptorBase(GlobalStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); +}; +} // namespace detail +template +class GlobalStoreOpGenericAdaptor : public detail::GlobalStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalStoreOpGenericAdaptorBase; +public: + GlobalStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalStoreOpAdaptor : public GlobalStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalStoreOpGenericAdaptor::GlobalStoreOpGenericAdaptor; + GlobalStoreOpAdaptor(GlobalStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalStoreOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalStoreOpAdaptor; + template + using GenericAdaptor = GlobalStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("global")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getGlobalAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getGlobalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.global_store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::SymbolRefAttr getGlobalAttr(); + ::mlir::SymbolRefAttr getGlobal(); + void setGlobalAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::SymbolRefAttr global, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr global, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Gets the corresponding GlobalOp (or nullptr). + GlobalOp getGlobalOp(SymbolTableCollection &symbolTable); +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::GlobalStoreOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::OutputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OutputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OutputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OutputOpGenericAdaptorBase(OutputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OutputOpGenericAdaptor : public detail::OutputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OutputOpGenericAdaptorBase; +public: + OutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OutputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OutputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class OutputOpAdaptor : public OutputOpGenericAdaptor<::mlir::ValueRange> { +public: + using OutputOpGenericAdaptor::OutputOpGenericAdaptor; + OutputOpAdaptor(OutputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OutputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = OutputOpAdaptor; + template + using GenericAdaptor = OutputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.output"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::OutputOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::ReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReturnOpGenericAdaptorBase(ReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReturnOpGenericAdaptorBase; +public: + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor; + ReturnOpAdaptor(ReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReturnOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReturnOpAdaptor; + template + using GenericAdaptor = ReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::ReturnOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::SubgraphOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubgraphOpGenericAdaptorBase { +public: + struct Properties { + using arg_attrsTy = ::mlir::ArrayAttr; + arg_attrsTy arg_attrs; + + auto getArgAttrs() { + auto &propStorage = this->arg_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setArgAttrs(const ::mlir::ArrayAttr &propValue) { + this->arg_attrs = propValue; + } + using function_typeTy = ::mlir::TypeAttr; + function_typeTy function_type; + + auto getFunctionType() { + auto &propStorage = this->function_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setFunctionType(const ::mlir::TypeAttr &propValue) { + this->function_type = propValue; + } + using res_attrsTy = ::mlir::ArrayAttr; + res_attrsTy res_attrs; + + auto getResAttrs() { + auto &propStorage = this->res_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setResAttrs(const ::mlir::ArrayAttr &propValue) { + this->res_attrs = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using sym_visibilityTy = ::mlir::StringAttr; + sym_visibilityTy sym_visibility; + + auto getSymVisibility() { + auto &propStorage = this->sym_visibility; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSymVisibility(const ::mlir::StringAttr &propValue) { + this->sym_visibility = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.arg_attrs == this->arg_attrs && + rhs.function_type == this->function_type && + rhs.res_attrs == this->res_attrs && + rhs.sym_name == this->sym_name && + rhs.sym_visibility == this->sym_visibility && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubgraphOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubgraphOpGenericAdaptorBase(SubgraphOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SubgraphOpGenericAdaptor : public detail::SubgraphOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubgraphOpGenericAdaptorBase; +public: + SubgraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubgraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubgraphOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubgraphOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubgraphOpAdaptor : public SubgraphOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubgraphOpGenericAdaptor::SubgraphOpGenericAdaptor; + SubgraphOpAdaptor(SubgraphOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubgraphOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SubgraphOpAdaptor; + template + using GenericAdaptor = SubgraphOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("function_type"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("sym_visibility")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getArgAttrsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFunctionTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getResAttrsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSymVisibilityAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.subgraph"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setFunctionTypeAttr(::mlir::TypeAttr attr); + void setFunctionType(::mlir::FunctionType attrValue); + void setArgAttrsAttr(::mlir::ArrayAttr attr); + void setResAttrsAttr(::mlir::ArrayAttr attr); + void setSymVisibilityAttr(::mlir::StringAttr attr); + void setSymVisibility(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeArgAttrsAttr(); + ::mlir::Attribute removeResAttrsAttr(); + ::mlir::Attribute removeSymVisibilityAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs, /*optional*/::mlir::StringAttr sym_visibility); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + //===------------------------------------------------------------------===// + // FunctionOpInterface Methods + //===------------------------------------------------------------------===// + + /// Returns the region on the current operation that is callable. This may + /// return null in the case of an external callable object, e.g. an external + /// function. + ::mlir::Region *getCallableRegion() { return isExternal() ? nullptr : &getBody(); } + + /// Returns the argument types of this function. + ArrayRef getArgumentTypes() { return getFunctionType().getInputs(); } + + /// Returns the result types of this function. + ArrayRef getResultTypes() { return getFunctionType().getResults(); } + + //===------------------------------------------------------------------===// + // SymbolOpInterface Methods + //===------------------------------------------------------------------===// + + bool isDeclaration() { return isExternal(); } +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::SubgraphOp) + +namespace mlir { +namespace ml_program { + +//===----------------------------------------------------------------------===// +// ::mlir::ml_program::TokenOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TokenOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TokenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TokenOpGenericAdaptorBase(TokenOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TokenOpGenericAdaptor : public detail::TokenOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TokenOpGenericAdaptorBase; +public: + TokenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TokenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TokenOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TokenOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TokenOpAdaptor : public TokenOpGenericAdaptor<::mlir::ValueRange> { +public: + using TokenOpGenericAdaptor::TokenOpGenericAdaptor; + TokenOpAdaptor(TokenOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TokenOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TokenOpAdaptor; + template + using GenericAdaptor = TokenOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("ml_program.token"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::ml_program::TokenType> getToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::TokenOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..29ca836efa83c789f8da2588bbf0ce308c0a6d0c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MLProgramOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::MLProgramDialect) +namespace mlir { +namespace ml_program { + +MLProgramDialect::MLProgramDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +MLProgramDialect::~MLProgramDialect() = default; + +} // namespace ml_program +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..566e42d1db8b5b299a576a7c380e3c2cabd26080 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.h.inc @@ -0,0 +1,41 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MLProgramOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace ml_program { + +class MLProgramDialect : public ::mlir::Dialect { + explicit MLProgramDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~MLProgramDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("ml_program"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::MLProgramDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramTypes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramTypes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..d06e06ec0cf94ddddcafb3396c686116c7ae242e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramTypes.cpp.inc @@ -0,0 +1,71 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_LIST +#undef GET_TYPEDEF_LIST + +::mlir::ml_program::TokenType + +#endif // GET_TYPEDEF_LIST + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + +static ::mlir::OptionalParseResult generatedTypeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::ml_program::TokenType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::ml_program::TokenType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedTypePrinter(::mlir::Type def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Type, ::mlir::LogicalResult>(def) .Case<::mlir::ml_program::TokenType>([&](auto t) { + printer << ::mlir::ml_program::TokenType::getMnemonic(); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace ml_program { +} // namespace ml_program +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ml_program::TokenType) +namespace mlir { +namespace ml_program { + +/// Parse a type registered to this dialect. +::mlir::Type MLProgramDialect::parseType(::mlir::DialectAsmParser &parser) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef mnemonic; + ::mlir::Type genType; + auto parseResult = generatedTypeParser(parser, &mnemonic, genType); + if (parseResult.has_value()) + return genType; + + parser.emitError(typeLoc) << "unknown type `" + << mnemonic << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print a type registered to this dialect. +void MLProgramDialect::printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedTypePrinter(type, printer))) + return; + +} +} // namespace ml_program +} // namespace mlir + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramTypes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..c392ed6c3c2cae7f67755781bf0d726f544b3447 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramTypes.h @@ -0,0 +1,21 @@ +//===- MLProgramTypes.h - Type Classes --------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MLPROGRAM_IR_MLPROGRAMTYPES_H_ +#define MLIR_DIALECT_MLPROGRAM_IR_MLPROGRAMTYPES_H_ + +#include "mlir/IR/Types.h" + +//===----------------------------------------------------------------------===// +// Tablegen Type Declarations +//===----------------------------------------------------------------------===// + +#define GET_TYPEDEF_CLASSES +#include "mlir/Dialect/MLProgram/IR/MLProgramTypes.h.inc" + +#endif // MLIR_DIALECT_MLPROGRAM_IR_MLPROGRAMTYPES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramTypes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramTypes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..c0bc6a57faf04edf94e72f12c6f7afaed80e80c1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramTypes.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace ml_program { +class TokenType; +class TokenType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"token"}; + } + +}; +} // namespace ml_program +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ml_program::TokenType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/Math.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/Math.h new file mode 100644 index 0000000000000000000000000000000000000000..dcbcb1572fb80852ca29b67f802d23cdf83cbeba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/Math.h @@ -0,0 +1,35 @@ +//===- Math.h - Math dialect --------------------------------------*- C++-*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MATH_IR_MATH_H_ +#define MLIR_DIALECT_MATH_IR_MATH_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" +#include "mlir/Interfaces/VectorInterfaces.h" + +//===----------------------------------------------------------------------===// +// Math Dialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/Math/IR/MathOpsDialect.h.inc" + +//===----------------------------------------------------------------------===// +// Math Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/Math/IR/MathOps.h.inc" + +#endif // MLIR_DIALECT_MATH_IR_MATH_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..7d7d40ce4f2980e80967a72679817fc0b0ebcdf2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOps.cpp.inc @@ -0,0 +1,11862 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MathOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::math::AbsFOp, +::mlir::math::AbsIOp, +::mlir::math::Atan2Op, +::mlir::math::AtanOp, +::mlir::math::CbrtOp, +::mlir::math::CeilOp, +::mlir::math::CopySignOp, +::mlir::math::CosOp, +::mlir::math::CountLeadingZerosOp, +::mlir::math::CountTrailingZerosOp, +::mlir::math::CtPopOp, +::mlir::math::ErfOp, +::mlir::math::Exp2Op, +::mlir::math::ExpM1Op, +::mlir::math::ExpOp, +::mlir::math::FPowIOp, +::mlir::math::FloorOp, +::mlir::math::FmaOp, +::mlir::math::IPowIOp, +::mlir::math::Log10Op, +::mlir::math::Log1pOp, +::mlir::math::Log2Op, +::mlir::math::LogOp, +::mlir::math::PowFOp, +::mlir::math::RoundEvenOp, +::mlir::math::RoundOp, +::mlir::math::RsqrtOp, +::mlir::math::SinOp, +::mlir::math::SqrtOp, +::mlir::math::TanOp, +::mlir::math::TanhOp, +::mlir::math::TruncOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace math { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MathOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::FloatType>(type))) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::FloatType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::FloatType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be floating-point-like, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MathOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessIntOrIndex())) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be signless-integer-like, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MathOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Floating point fast math flags"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MathOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MathOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::AbsFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AbsFOpGenericAdaptorBase::AbsFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.absf", odsAttrs.getContext()); +} + +AbsFOpGenericAdaptorBase::AbsFOpGenericAdaptorBase(AbsFOp op) : AbsFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AbsFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AbsFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr AbsFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags AbsFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +AbsFOpAdaptor::AbsFOpAdaptor(AbsFOp op) : AbsFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AbsFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.absf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair AbsFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AbsFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AbsFOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AbsFOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AbsFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AbsFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AbsFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AbsFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AbsFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AbsFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional AbsFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void AbsFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AbsFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult AbsFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AbsFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AbsFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr AbsFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags AbsFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void AbsFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void AbsFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AbsFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void AbsFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AbsFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AbsFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AbsFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void AbsFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AbsFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AbsFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AbsFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AbsFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AbsFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void AbsFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult AbsFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AbsFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AbsFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AbsFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AbsFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AbsFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::AbsFOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::AbsIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AbsIOpGenericAdaptorBase::AbsIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.absi", odsAttrs.getContext()); +} + +AbsIOpGenericAdaptorBase::AbsIOpGenericAdaptorBase(AbsIOp op) : AbsIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AbsIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AbsIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AbsIOpAdaptor::AbsIOpAdaptor(AbsIOp op) : AbsIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AbsIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AbsIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AbsIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AbsIOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AbsIOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AbsIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AbsIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AbsIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void AbsIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { + odsState.addOperands(operand); + odsState.addTypes(result); +} + +void AbsIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AbsIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AbsIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AbsIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AbsIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AbsIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AbsIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AbsIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AbsIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AbsIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AbsIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AbsIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::AbsIOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Atan2Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Atan2OpGenericAdaptorBase::Atan2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.atan2", odsAttrs.getContext()); +} + +Atan2OpGenericAdaptorBase::Atan2OpGenericAdaptorBase(Atan2Op op) : Atan2OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Atan2OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Atan2OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr Atan2OpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags Atan2OpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +Atan2OpAdaptor::Atan2OpAdaptor(Atan2Op op) : Atan2OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Atan2OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.atan2' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair Atan2Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Atan2Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Atan2Op::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value Atan2Op::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &Atan2Op::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &Atan2Op::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair Atan2Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Atan2Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Atan2Op::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Atan2Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Atan2Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Atan2Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional Atan2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void Atan2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Atan2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult Atan2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Atan2Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Atan2Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr Atan2Op::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags Atan2Op::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void Atan2Op::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void Atan2Op::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Atan2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Atan2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Atan2Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Atan2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Atan2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Atan2Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult Atan2Op::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Atan2Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Atan2Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Atan2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Atan2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void Atan2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::Atan2Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::AtanOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtanOpGenericAdaptorBase::AtanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.atan", odsAttrs.getContext()); +} + +AtanOpGenericAdaptorBase::AtanOpGenericAdaptorBase(AtanOp op) : AtanOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtanOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtanOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr AtanOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags AtanOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +AtanOpAdaptor::AtanOpAdaptor(AtanOp op) : AtanOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtanOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.atan' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair AtanOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtanOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AtanOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AtanOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtanOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtanOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AtanOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AtanOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AtanOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AtanOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional AtanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void AtanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AtanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult AtanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtanOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtanOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr AtanOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags AtanOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void AtanOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void AtanOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void AtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtanOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void AtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtanOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtanOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AtanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtanOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void AtanOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult AtanOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtanOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult AtanOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AtanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AtanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::AtanOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CbrtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CbrtOpGenericAdaptorBase::CbrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.cbrt", odsAttrs.getContext()); +} + +CbrtOpGenericAdaptorBase::CbrtOpGenericAdaptorBase(CbrtOp op) : CbrtOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CbrtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CbrtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr CbrtOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags CbrtOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +CbrtOpAdaptor::CbrtOpAdaptor(CbrtOp op) : CbrtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CbrtOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.cbrt' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair CbrtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CbrtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CbrtOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CbrtOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CbrtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CbrtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CbrtOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CbrtOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CbrtOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CbrtOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional CbrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void CbrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CbrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult CbrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CbrtOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CbrtOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr CbrtOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags CbrtOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void CbrtOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void CbrtOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void CbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CbrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void CbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CbrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CbrtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CbrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CbrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void CbrtOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult CbrtOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CbrtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CbrtOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CbrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CbrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CbrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::CbrtOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CeilOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CeilOpGenericAdaptorBase::CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.ceil", odsAttrs.getContext()); +} + +CeilOpGenericAdaptorBase::CeilOpGenericAdaptorBase(CeilOp op) : CeilOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CeilOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CeilOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr CeilOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags CeilOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +CeilOpAdaptor::CeilOpAdaptor(CeilOp op) : CeilOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CeilOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.ceil' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair CeilOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CeilOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CeilOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CeilOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CeilOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CeilOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CeilOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CeilOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CeilOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CeilOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional CeilOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void CeilOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CeilOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult CeilOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CeilOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CeilOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr CeilOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags CeilOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void CeilOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void CeilOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CeilOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CeilOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CeilOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void CeilOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult CeilOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CeilOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CeilOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CeilOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CeilOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CeilOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::CeilOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CopySignOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CopySignOpGenericAdaptorBase::CopySignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.copysign", odsAttrs.getContext()); +} + +CopySignOpGenericAdaptorBase::CopySignOpGenericAdaptorBase(CopySignOp op) : CopySignOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CopySignOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CopySignOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr CopySignOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags CopySignOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +CopySignOpAdaptor::CopySignOpAdaptor(CopySignOp op) : CopySignOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CopySignOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.copysign' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair CopySignOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CopySignOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CopySignOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value CopySignOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CopySignOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CopySignOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CopySignOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CopySignOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CopySignOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CopySignOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CopySignOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CopySignOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional CopySignOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void CopySignOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CopySignOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult CopySignOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopySignOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CopySignOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr CopySignOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags CopySignOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void CopySignOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void CopySignOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CopySignOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CopySignOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CopySignOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CopySignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CopySignOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void CopySignOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult CopySignOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopySignOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CopySignOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CopySignOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CopySignOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CopySignOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::CopySignOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CosOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CosOpGenericAdaptorBase::CosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.cos", odsAttrs.getContext()); +} + +CosOpGenericAdaptorBase::CosOpGenericAdaptorBase(CosOp op) : CosOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CosOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CosOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr CosOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags CosOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +CosOpAdaptor::CosOpAdaptor(CosOp op) : CosOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CosOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.cos' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair CosOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CosOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CosOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CosOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CosOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CosOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CosOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CosOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CosOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CosOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional CosOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void CosOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CosOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult CosOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CosOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CosOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr CosOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags CosOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void CosOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void CosOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CosOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void CosOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult CosOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CosOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CosOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::CosOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CountLeadingZerosOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CountLeadingZerosOpGenericAdaptorBase::CountLeadingZerosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.ctlz", odsAttrs.getContext()); +} + +CountLeadingZerosOpGenericAdaptorBase::CountLeadingZerosOpGenericAdaptorBase(CountLeadingZerosOp op) : CountLeadingZerosOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CountLeadingZerosOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CountLeadingZerosOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CountLeadingZerosOpAdaptor::CountLeadingZerosOpAdaptor(CountLeadingZerosOp op) : CountLeadingZerosOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CountLeadingZerosOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CountLeadingZerosOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CountLeadingZerosOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CountLeadingZerosOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CountLeadingZerosOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CountLeadingZerosOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CountLeadingZerosOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CountLeadingZerosOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { + odsState.addOperands(operand); + odsState.addTypes(result); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CountLeadingZerosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CountLeadingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CountLeadingZerosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CountLeadingZerosOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CountLeadingZerosOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CountLeadingZerosOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CountLeadingZerosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CountLeadingZerosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CountLeadingZerosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::CountLeadingZerosOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CountTrailingZerosOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CountTrailingZerosOpGenericAdaptorBase::CountTrailingZerosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.cttz", odsAttrs.getContext()); +} + +CountTrailingZerosOpGenericAdaptorBase::CountTrailingZerosOpGenericAdaptorBase(CountTrailingZerosOp op) : CountTrailingZerosOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CountTrailingZerosOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CountTrailingZerosOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CountTrailingZerosOpAdaptor::CountTrailingZerosOpAdaptor(CountTrailingZerosOp op) : CountTrailingZerosOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CountTrailingZerosOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CountTrailingZerosOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CountTrailingZerosOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CountTrailingZerosOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CountTrailingZerosOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CountTrailingZerosOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CountTrailingZerosOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CountTrailingZerosOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { + odsState.addOperands(operand); + odsState.addTypes(result); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CountTrailingZerosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CountTrailingZerosOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CountTrailingZerosOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CountTrailingZerosOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CountTrailingZerosOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CountTrailingZerosOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CountTrailingZerosOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CountTrailingZerosOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CountTrailingZerosOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::CountTrailingZerosOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CtPopOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CtPopOpGenericAdaptorBase::CtPopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.ctpop", odsAttrs.getContext()); +} + +CtPopOpGenericAdaptorBase::CtPopOpGenericAdaptorBase(CtPopOp op) : CtPopOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CtPopOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CtPopOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CtPopOpAdaptor::CtPopOpAdaptor(CtPopOp op) : CtPopOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CtPopOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CtPopOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CtPopOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CtPopOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CtPopOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CtPopOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CtPopOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value CtPopOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void CtPopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) { + odsState.addOperands(operand); + odsState.addTypes(result); +} + +void CtPopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) { + odsState.addOperands(operand); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CtPopOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void CtPopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) { + odsState.addOperands(operand); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CtPopOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CtPopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(CtPopOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult CtPopOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CtPopOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult CtPopOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult CtPopOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CtPopOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CtPopOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::CtPopOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::ErfOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ErfOpGenericAdaptorBase::ErfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.erf", odsAttrs.getContext()); +} + +ErfOpGenericAdaptorBase::ErfOpGenericAdaptorBase(ErfOp op) : ErfOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ErfOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ErfOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr ErfOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags ErfOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +ErfOpAdaptor::ErfOpAdaptor(ErfOp op) : ErfOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ErfOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.erf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair ErfOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ErfOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ErfOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ErfOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ErfOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ErfOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ErfOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ErfOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ErfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ErfOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional ErfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void ErfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ErfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult ErfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ErfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ErfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr ErfOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags ErfOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void ErfOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void ErfOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void ErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ErfOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void ErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ErfOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ErfOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ErfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ErfOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void ErfOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult ErfOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ErfOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ErfOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ErfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ErfOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ErfOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::ErfOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Exp2Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Exp2OpGenericAdaptorBase::Exp2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.exp2", odsAttrs.getContext()); +} + +Exp2OpGenericAdaptorBase::Exp2OpGenericAdaptorBase(Exp2Op op) : Exp2OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Exp2OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Exp2OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr Exp2OpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags Exp2OpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +Exp2OpAdaptor::Exp2OpAdaptor(Exp2Op op) : Exp2OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Exp2OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.exp2' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair Exp2Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Exp2Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Exp2Op::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Exp2Op::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Exp2Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Exp2Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Exp2Op::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Exp2Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Exp2Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Exp2Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional Exp2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void Exp2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Exp2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult Exp2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Exp2Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Exp2Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr Exp2Op::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags Exp2Op::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void Exp2Op::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void Exp2Op::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Exp2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Exp2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Exp2Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Exp2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Exp2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Exp2Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult Exp2Op::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Exp2Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Exp2Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Exp2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Exp2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void Exp2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::Exp2Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::ExpM1Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExpM1OpGenericAdaptorBase::ExpM1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.expm1", odsAttrs.getContext()); +} + +ExpM1OpGenericAdaptorBase::ExpM1OpGenericAdaptorBase(ExpM1Op op) : ExpM1OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExpM1OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExpM1OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr ExpM1OpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags ExpM1OpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +ExpM1OpAdaptor::ExpM1OpAdaptor(ExpM1Op op) : ExpM1OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExpM1OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.expm1' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair ExpM1Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExpM1Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExpM1Op::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExpM1Op::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExpM1Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExpM1Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExpM1Op::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ExpM1Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ExpM1Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExpM1Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional ExpM1Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void ExpM1Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ExpM1Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult ExpM1Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpM1Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpM1Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr ExpM1Op::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags ExpM1Op::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void ExpM1Op::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void ExpM1Op::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ExpM1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void ExpM1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpM1Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpM1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpM1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void ExpM1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpM1Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpM1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpM1Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ExpM1Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpM1Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void ExpM1Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult ExpM1Op::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpM1Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ExpM1Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ExpM1Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpM1Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExpM1Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::ExpM1Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::ExpOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExpOpGenericAdaptorBase::ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.exp", odsAttrs.getContext()); +} + +ExpOpGenericAdaptorBase::ExpOpGenericAdaptorBase(ExpOp op) : ExpOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExpOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExpOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr ExpOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags ExpOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +ExpOpAdaptor::ExpOpAdaptor(ExpOp op) : ExpOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExpOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.exp' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair ExpOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExpOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExpOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExpOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExpOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExpOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExpOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ExpOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ExpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExpOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional ExpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void ExpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ExpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult ExpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr ExpOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags ExpOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void ExpOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void ExpOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ExpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExpOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void ExpOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult ExpOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ExpOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ExpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::ExpOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::FPowIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FPowIOpGenericAdaptorBase::FPowIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.fpowi", odsAttrs.getContext()); +} + +FPowIOpGenericAdaptorBase::FPowIOpGenericAdaptorBase(FPowIOp op) : FPowIOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FPowIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FPowIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr FPowIOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags FPowIOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +FPowIOpAdaptor::FPowIOpAdaptor(FPowIOp op) : FPowIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FPowIOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.fpowi' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair FPowIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FPowIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPowIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FPowIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &FPowIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FPowIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair FPowIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FPowIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FPowIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FPowIOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FPowIOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FPowIOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional FPowIOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void FPowIOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FPowIOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult FPowIOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FPowIOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FPowIOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr FPowIOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags FPowIOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void FPowIOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void FPowIOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void FPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FPowIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void FPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FPowIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FPowIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FPowIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FPowIOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult FPowIOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {lhs, result} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult FPowIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FPowIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FPowIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + ::mlir::Type rhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> rhsTypes(rhsRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + rhsRawTypes[0] = type; + } + result.addTypes(lhsTypes[0]); + if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FPowIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getRhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FPowIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::FPowIOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::FloorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FloorOpGenericAdaptorBase::FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.floor", odsAttrs.getContext()); +} + +FloorOpGenericAdaptorBase::FloorOpGenericAdaptorBase(FloorOp op) : FloorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FloorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FloorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr FloorOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags FloorOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +FloorOpAdaptor::FloorOpAdaptor(FloorOp op) : FloorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FloorOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.floor' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair FloorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FloorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FloorOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &FloorOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair FloorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FloorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FloorOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FloorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FloorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FloorOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional FloorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void FloorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FloorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult FloorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FloorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FloorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr FloorOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags FloorOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void FloorOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void FloorOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FloorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FloorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FloorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FloorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FloorOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FloorOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult FloorOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FloorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FloorOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FloorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FloorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FloorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::FloorOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::FmaOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FmaOpGenericAdaptorBase::FmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.fma", odsAttrs.getContext()); +} + +FmaOpGenericAdaptorBase::FmaOpGenericAdaptorBase(FmaOp op) : FmaOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FmaOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FmaOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr FmaOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags FmaOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +FmaOpAdaptor::FmaOpAdaptor(FmaOp op) : FmaOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FmaOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.fma' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair FmaOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FmaOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FmaOp::getA() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value FmaOp::getB() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::Value FmaOp::getC() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &FmaOp::getAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FmaOp::getBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &FmaOp::getCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair FmaOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FmaOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value FmaOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FmaOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FmaOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FmaOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional FmaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void FmaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FmaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult FmaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FmaOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FmaOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr FmaOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags FmaOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void FmaOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void FmaOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void FmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FmaOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void FmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FmaOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void FmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(a); + odsState.addOperands(b); + odsState.addOperands(c); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FmaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(FmaOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void FmaOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult FmaOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FmaOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult FmaOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult FmaOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand aRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> aOperands(aRawOperands); ::llvm::SMLoc aOperandsLoc; + (void)aOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand bRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> bOperands(bRawOperands); ::llvm::SMLoc bOperandsLoc; + (void)bOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand cRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> cOperands(cRawOperands); ::llvm::SMLoc cOperandsLoc; + (void)cOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + aOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(aRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + bOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(bRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + cOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(cRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(aOperands, resultTypes[0], aOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(bOperands, resultTypes[0], bOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(cOperands, resultTypes[0], cOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FmaOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getB(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getC(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void FmaOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::FmaOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::IPowIOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +IPowIOpGenericAdaptorBase::IPowIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.ipowi", odsAttrs.getContext()); +} + +IPowIOpGenericAdaptorBase::IPowIOpGenericAdaptorBase(IPowIOp op) : IPowIOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair IPowIOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr IPowIOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +IPowIOpAdaptor::IPowIOpAdaptor(IPowIOp op) : IPowIOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult IPowIOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair IPowIOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range IPowIOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IPowIOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value IPowIOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &IPowIOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &IPowIOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair IPowIOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range IPowIOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value IPowIOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void IPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addTypes(result); +} + +void IPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(IPowIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void IPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IPowIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void IPowIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(IPowIOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult IPowIOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult IPowIOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult IPowIOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult IPowIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void IPowIOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void IPowIOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::IPowIOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Log10Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Log10OpGenericAdaptorBase::Log10OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.log10", odsAttrs.getContext()); +} + +Log10OpGenericAdaptorBase::Log10OpGenericAdaptorBase(Log10Op op) : Log10OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Log10OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Log10OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr Log10OpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags Log10OpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +Log10OpAdaptor::Log10OpAdaptor(Log10Op op) : Log10OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Log10OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.log10' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair Log10Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Log10Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log10Op::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Log10Op::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Log10Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Log10Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log10Op::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Log10Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Log10Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Log10Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional Log10Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void Log10Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Log10Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult Log10Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log10Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log10Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr Log10Op::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags Log10Op::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void Log10Op::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void Log10Op::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log10Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log10Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log10Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Log10Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log10Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Log10Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult Log10Op::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log10Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Log10Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Log10Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log10Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void Log10Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::Log10Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Log1pOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Log1pOpGenericAdaptorBase::Log1pOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.log1p", odsAttrs.getContext()); +} + +Log1pOpGenericAdaptorBase::Log1pOpGenericAdaptorBase(Log1pOp op) : Log1pOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Log1pOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Log1pOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr Log1pOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags Log1pOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +Log1pOpAdaptor::Log1pOpAdaptor(Log1pOp op) : Log1pOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Log1pOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.log1p' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair Log1pOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Log1pOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log1pOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Log1pOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Log1pOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Log1pOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log1pOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Log1pOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Log1pOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Log1pOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional Log1pOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void Log1pOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Log1pOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult Log1pOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log1pOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log1pOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr Log1pOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags Log1pOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void Log1pOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void Log1pOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log1pOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log1pOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log1pOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Log1pOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log1pOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Log1pOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult Log1pOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log1pOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Log1pOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Log1pOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log1pOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void Log1pOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::Log1pOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Log2Op definitions +//===----------------------------------------------------------------------===// + +namespace detail { +Log2OpGenericAdaptorBase::Log2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.log2", odsAttrs.getContext()); +} + +Log2OpGenericAdaptorBase::Log2OpGenericAdaptorBase(Log2Op op) : Log2OpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair Log2OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr Log2OpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr Log2OpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags Log2OpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +Log2OpAdaptor::Log2OpAdaptor(Log2Op op) : Log2OpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult Log2OpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.log2' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair Log2Op::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range Log2Op::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log2Op::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &Log2Op::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair Log2Op::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range Log2Op::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value Log2Op::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult Log2Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute Log2Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code Log2Op::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional Log2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void Log2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void Log2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult Log2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log2Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log2Op::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr Log2Op::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags Log2Op::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void Log2Op::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void Log2Op::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void Log2Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void Log2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(Log2Op::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void Log2Op::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult Log2Op::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult Log2Op::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult Log2Op::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult Log2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void Log2Op::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void Log2Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::Log2Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::LogOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LogOpGenericAdaptorBase::LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.log", odsAttrs.getContext()); +} + +LogOpGenericAdaptorBase::LogOpGenericAdaptorBase(LogOp op) : LogOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LogOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr LogOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr LogOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags LogOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +LogOpAdaptor::LogOpAdaptor(LogOp op) : LogOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LogOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.log' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair LogOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range LogOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LogOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &LogOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair LogOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LogOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LogOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult LogOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LogOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LogOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional LogOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void LogOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LogOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult LogOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LogOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LogOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr LogOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags LogOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void LogOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void LogOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LogOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LogOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LogOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void LogOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LogOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void LogOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult LogOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult LogOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult LogOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult LogOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LogOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void LogOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::LogOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::PowFOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PowFOpGenericAdaptorBase::PowFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.powf", odsAttrs.getContext()); +} + +PowFOpGenericAdaptorBase::PowFOpGenericAdaptorBase(PowFOp op) : PowFOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PowFOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PowFOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr PowFOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags PowFOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +PowFOpAdaptor::PowFOpAdaptor(PowFOp op) : PowFOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PowFOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.powf' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair PowFOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range PowFOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value PowFOp::getLhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::Value PowFOp::getRhs() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &PowFOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &PowFOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair PowFOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PowFOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value PowFOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult PowFOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute PowFOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PowFOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional PowFOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void PowFOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void PowFOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult PowFOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PowFOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PowFOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr PowFOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags PowFOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void PowFOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void PowFOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void PowFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void PowFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PowFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void PowFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PowFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void PowFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PowFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void PowFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PowFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void PowFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(PowFOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void PowFOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult PowFOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PowFOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult PowFOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult PowFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc; + (void)lhsOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc; + (void)rhsOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + lhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(lhsRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + rhsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rhsRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PowFOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getLhs(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getRhs(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void PowFOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::PowFOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::RoundEvenOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RoundEvenOpGenericAdaptorBase::RoundEvenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.roundeven", odsAttrs.getContext()); +} + +RoundEvenOpGenericAdaptorBase::RoundEvenOpGenericAdaptorBase(RoundEvenOp op) : RoundEvenOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RoundEvenOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RoundEvenOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr RoundEvenOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags RoundEvenOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +RoundEvenOpAdaptor::RoundEvenOpAdaptor(RoundEvenOp op) : RoundEvenOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RoundEvenOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.roundeven' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair RoundEvenOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RoundEvenOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RoundEvenOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RoundEvenOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RoundEvenOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RoundEvenOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RoundEvenOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RoundEvenOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RoundEvenOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RoundEvenOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional RoundEvenOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void RoundEvenOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RoundEvenOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult RoundEvenOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RoundEvenOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RoundEvenOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr RoundEvenOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags RoundEvenOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void RoundEvenOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void RoundEvenOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundEvenOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundEvenOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoundEvenOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RoundEvenOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundEvenOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void RoundEvenOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult RoundEvenOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RoundEvenOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RoundEvenOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RoundEvenOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RoundEvenOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RoundEvenOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::RoundEvenOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::RoundOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RoundOpGenericAdaptorBase::RoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.round", odsAttrs.getContext()); +} + +RoundOpGenericAdaptorBase::RoundOpGenericAdaptorBase(RoundOp op) : RoundOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RoundOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RoundOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr RoundOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags RoundOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +RoundOpAdaptor::RoundOpAdaptor(RoundOp op) : RoundOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RoundOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.round' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair RoundOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RoundOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RoundOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RoundOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RoundOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RoundOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RoundOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RoundOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RoundOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RoundOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional RoundOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void RoundOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RoundOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult RoundOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RoundOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RoundOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr RoundOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags RoundOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void RoundOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void RoundOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoundOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RoundOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RoundOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void RoundOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult RoundOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RoundOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RoundOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RoundOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RoundOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RoundOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::RoundOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::RsqrtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RsqrtOpGenericAdaptorBase::RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.rsqrt", odsAttrs.getContext()); +} + +RsqrtOpGenericAdaptorBase::RsqrtOpGenericAdaptorBase(RsqrtOp op) : RsqrtOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RsqrtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RsqrtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr RsqrtOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags RsqrtOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +RsqrtOpAdaptor::RsqrtOpAdaptor(RsqrtOp op) : RsqrtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RsqrtOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.rsqrt' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair RsqrtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RsqrtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RsqrtOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RsqrtOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RsqrtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RsqrtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RsqrtOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult RsqrtOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RsqrtOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RsqrtOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional RsqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void RsqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RsqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult RsqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RsqrtOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RsqrtOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr RsqrtOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags RsqrtOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void RsqrtOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void RsqrtOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RsqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RsqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RsqrtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RsqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RsqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void RsqrtOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult RsqrtOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RsqrtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RsqrtOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RsqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RsqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RsqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::RsqrtOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::SinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SinOpGenericAdaptorBase::SinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.sin", odsAttrs.getContext()); +} + +SinOpGenericAdaptorBase::SinOpGenericAdaptorBase(SinOp op) : SinOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr SinOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags SinOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +SinOpAdaptor::SinOpAdaptor(SinOp op) : SinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SinOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.sin' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair SinOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SinOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SinOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SinOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SinOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SinOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional SinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void SinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult SinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr SinOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags SinOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void SinOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void SinOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SinOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SinOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult SinOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SinOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SinOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SinOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::SinOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::SqrtOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SqrtOpGenericAdaptorBase::SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.sqrt", odsAttrs.getContext()); +} + +SqrtOpGenericAdaptorBase::SqrtOpGenericAdaptorBase(SqrtOp op) : SqrtOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SqrtOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SqrtOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr SqrtOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags SqrtOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +SqrtOpAdaptor::SqrtOpAdaptor(SqrtOp op) : SqrtOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SqrtOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.sqrt' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair SqrtOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SqrtOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SqrtOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SqrtOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SqrtOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SqrtOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SqrtOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SqrtOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SqrtOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SqrtOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional SqrtOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void SqrtOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SqrtOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult SqrtOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SqrtOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SqrtOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr SqrtOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags SqrtOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void SqrtOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void SqrtOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SqrtOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void SqrtOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(SqrtOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void SqrtOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult SqrtOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SqrtOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult SqrtOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult SqrtOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SqrtOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SqrtOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::SqrtOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::TanOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TanOpGenericAdaptorBase::TanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.tan", odsAttrs.getContext()); +} + +TanOpGenericAdaptorBase::TanOpGenericAdaptorBase(TanOp op) : TanOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TanOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TanOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr TanOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags TanOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +TanOpAdaptor::TanOpAdaptor(TanOp op) : TanOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TanOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.tan' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair TanOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TanOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TanOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &TanOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair TanOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TanOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TanOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult TanOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TanOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TanOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional TanOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void TanOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TanOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult TanOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TanOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TanOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr TanOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags TanOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void TanOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void TanOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TanOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void TanOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void TanOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult TanOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TanOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult TanOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult TanOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TanOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TanOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::TanOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::TanhOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TanhOpGenericAdaptorBase::TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.tanh", odsAttrs.getContext()); +} + +TanhOpGenericAdaptorBase::TanhOpGenericAdaptorBase(TanhOp op) : TanhOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TanhOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TanhOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr TanhOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags TanhOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +TanhOpAdaptor::TanhOpAdaptor(TanhOp op) : TanhOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TanhOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.tanh' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair TanhOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TanhOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TanhOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &TanhOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair TanhOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TanhOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TanhOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult TanhOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TanhOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TanhOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional TanhOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void TanhOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TanhOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult TanhOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TanhOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TanhOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr TanhOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags TanhOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void TanhOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void TanhOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanhOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanhOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TanhOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void TanhOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TanhOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void TanhOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult TanhOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TanhOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult TanhOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult TanhOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TanhOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TanhOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::TanhOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::TruncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TruncOpGenericAdaptorBase::TruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("math.trunc", odsAttrs.getContext()); +} + +TruncOpGenericAdaptorBase::TruncOpGenericAdaptorBase(TruncOp op) : TruncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TruncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TruncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::FastMathFlagsAttr TruncOpGenericAdaptorBase::getFastmathAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); + return attr; +} + +::mlir::arith::FastMathFlags TruncOpGenericAdaptorBase::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +} // namespace detail +TruncOpAdaptor::TruncOpAdaptor(TruncOp op) : TruncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TruncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (tblgen_fastmath && !((::llvm::isa<::mlir::arith::FastMathFlagsAttr>(tblgen_fastmath)))) + return emitError(loc, "'math.trunc' op ""attribute 'fastmath' failed to satisfy constraint: Floating point fast math flags"); + return ::mlir::success(); +} + +std::pair TruncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TruncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TruncOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &TruncOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair TruncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TruncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value TruncOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult TruncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.fastmath; + auto attr = dict.get("fastmath"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for fastmath in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `fastmath` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TruncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.fastmath; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("fastmath", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TruncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.fastmath.getAsOpaquePointer())); +} + +std::optional TruncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "fastmath") + return prop.fastmath; + return std::nullopt; +} + +void TruncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "fastmath") { + prop.fastmath = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TruncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.fastmath) attrs.append("fastmath", prop.fastmath); +} + +::mlir::LogicalResult TruncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getFastmathAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(attr, "fastmath", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TruncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.fastmath))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TruncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.fastmath); +} + +::mlir::arith::FastMathFlagsAttr TruncOp::getFastmathAttr() { + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(getProperties().fastmath); +} + +::mlir::arith::FastMathFlags TruncOp::getFastmath() { + auto attr = getFastmathAttr(); + return attr.getValue(); +} + +void TruncOp::setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr) { + (*this)->setAttr(getFastmathAttrName(), attr); +} + +void TruncOp::setFastmath(::mlir::arith::FastMathFlags attrValue) { + (*this)->setAttr(getFastmathAttrName(), ::mlir::arith::FastMathFlagsAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + odsState.addTypes(result); +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TruncOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath) { + odsState.addOperands(operand); + if (fastmath) { + odsState.getOrAddProperties().fastmath = fastmath; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + odsState.addTypes(result); +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TruncOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath) { + odsState.addOperands(operand); + odsState.getOrAddProperties().fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), fastmath); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void TruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(TruncOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +void TruncOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.fastmath) + properties.fastmath = ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none); +} + +::mlir::LogicalResult TruncOp::verifyInvariantsImpl() { + auto tblgen_fastmath = getProperties().fastmath; (void)tblgen_fastmath; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MathOps0(*this, tblgen_fastmath, "fastmath"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MathOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TruncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult TruncOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult TruncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::arith::FastMathFlagsAttr fastmathAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("fastmath"))) { + + if (parser.parseCustomAttributeWithFallback(fastmathAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (fastmathAttr) result.getOrAddProperties().fastmath = fastmathAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(operandOperands, resultTypes[0], operandOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TruncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + if (getFastmathAttr() && getFastmathAttr() != ::mlir::arith::FastMathFlagsAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ::mlir::arith::FastMathFlags::none)) { + _odsPrinter << ' ' << "fastmath"; + _odsPrinter.printStrippedAttrOrType(getFastmathAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("fastmath"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFastmathAttr(); + if(attr && (attr == ::mlir::arith::FastMathFlagsAttr::get(odsBuilder.getContext(), ::mlir::arith::FastMathFlags::none))) + elidedAttrs.push_back("fastmath"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace math +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::TruncOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..7ef83bc380c6b8e8718eb52d1363aea338191c23 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOps.h.inc @@ -0,0 +1,5305 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MathOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace math { +class AbsFOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class AbsIOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class Atan2Op; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class AtanOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class CbrtOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class CeilOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class CopySignOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class CosOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class CountLeadingZerosOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class CountTrailingZerosOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class CtPopOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class ErfOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class Exp2Op; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class ExpM1Op; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class ExpOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class FPowIOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class FloorOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class FmaOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class IPowIOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class Log10Op; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class Log1pOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class Log2Op; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class LogOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class PowFOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class RoundEvenOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class RoundOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class RsqrtOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class SinOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class SqrtOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class TanOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class TanhOp; +} // namespace math +} // namespace mlir +namespace mlir { +namespace math { +class TruncOp; +} // namespace math +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::AbsFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AbsFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AbsFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AbsFOpGenericAdaptorBase(AbsFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class AbsFOpGenericAdaptor : public detail::AbsFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AbsFOpGenericAdaptorBase; +public: + AbsFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AbsFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AbsFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AbsFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AbsFOpAdaptor : public AbsFOpGenericAdaptor<::mlir::ValueRange> { +public: + using AbsFOpGenericAdaptor::AbsFOpGenericAdaptor; + AbsFOpAdaptor(AbsFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AbsFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AbsFOpAdaptor; + template + using GenericAdaptor = AbsFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.absf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::AbsFOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::AbsIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AbsIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AbsIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AbsIOpGenericAdaptorBase(AbsIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AbsIOpGenericAdaptor : public detail::AbsIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AbsIOpGenericAdaptorBase; +public: + AbsIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AbsIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AbsIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AbsIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AbsIOpAdaptor : public AbsIOpGenericAdaptor<::mlir::ValueRange> { +public: + using AbsIOpGenericAdaptor::AbsIOpGenericAdaptor; + AbsIOpAdaptor(AbsIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AbsIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AbsIOpAdaptor; + template + using GenericAdaptor = AbsIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.absi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::AbsIOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Atan2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Atan2OpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Atan2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Atan2OpGenericAdaptorBase(Atan2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class Atan2OpGenericAdaptor : public detail::Atan2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Atan2OpGenericAdaptorBase; +public: + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Atan2OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Atan2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Atan2OpAdaptor : public Atan2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Atan2OpGenericAdaptor::Atan2OpGenericAdaptor; + Atan2OpAdaptor(Atan2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Atan2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Atan2OpAdaptor; + template + using GenericAdaptor = Atan2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.atan2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::Atan2Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::AtanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtanOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AtanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AtanOpGenericAdaptorBase(AtanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class AtanOpGenericAdaptor : public detail::AtanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtanOpGenericAdaptorBase; +public: + AtanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtanOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AtanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtanOpAdaptor : public AtanOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtanOpGenericAdaptor::AtanOpGenericAdaptor; + AtanOpAdaptor(AtanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtanOpAdaptor; + template + using GenericAdaptor = AtanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.atan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::AtanOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CbrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CbrtOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CbrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CbrtOpGenericAdaptorBase(CbrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class CbrtOpGenericAdaptor : public detail::CbrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CbrtOpGenericAdaptorBase; +public: + CbrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CbrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CbrtOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CbrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CbrtOpAdaptor : public CbrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using CbrtOpGenericAdaptor::CbrtOpGenericAdaptor; + CbrtOpAdaptor(CbrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CbrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CbrtOpAdaptor; + template + using GenericAdaptor = CbrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.cbrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::CbrtOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CeilOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilOpGenericAdaptorBase(CeilOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class CeilOpGenericAdaptor : public detail::CeilOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilOpGenericAdaptorBase; +public: + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CeilOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilOpAdaptor : public CeilOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilOpGenericAdaptor::CeilOpGenericAdaptor; + CeilOpAdaptor(CeilOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilOpAdaptor; + template + using GenericAdaptor = CeilOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.ceil"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::CeilOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CopySignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CopySignOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CopySignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CopySignOpGenericAdaptorBase(CopySignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class CopySignOpGenericAdaptor : public detail::CopySignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CopySignOpGenericAdaptorBase; +public: + CopySignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CopySignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CopySignOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CopySignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CopySignOpAdaptor : public CopySignOpGenericAdaptor<::mlir::ValueRange> { +public: + using CopySignOpGenericAdaptor::CopySignOpGenericAdaptor; + CopySignOpAdaptor(CopySignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CopySignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CopySignOpAdaptor; + template + using GenericAdaptor = CopySignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.copysign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::CopySignOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CosOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CosOpGenericAdaptorBase(CosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class CosOpGenericAdaptor : public detail::CosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CosOpGenericAdaptorBase; +public: + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CosOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CosOpAdaptor : public CosOpGenericAdaptor<::mlir::ValueRange> { +public: + using CosOpGenericAdaptor::CosOpGenericAdaptor; + CosOpAdaptor(CosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CosOpAdaptor; + template + using GenericAdaptor = CosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.cos"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::CosOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CountLeadingZerosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CountLeadingZerosOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CountLeadingZerosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CountLeadingZerosOpGenericAdaptorBase(CountLeadingZerosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CountLeadingZerosOpGenericAdaptor : public detail::CountLeadingZerosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CountLeadingZerosOpGenericAdaptorBase; +public: + CountLeadingZerosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CountLeadingZerosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CountLeadingZerosOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CountLeadingZerosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CountLeadingZerosOpAdaptor : public CountLeadingZerosOpGenericAdaptor<::mlir::ValueRange> { +public: + using CountLeadingZerosOpGenericAdaptor::CountLeadingZerosOpGenericAdaptor; + CountLeadingZerosOpAdaptor(CountLeadingZerosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CountLeadingZerosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CountLeadingZerosOpAdaptor; + template + using GenericAdaptor = CountLeadingZerosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.ctlz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::CountLeadingZerosOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CountTrailingZerosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CountTrailingZerosOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CountTrailingZerosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CountTrailingZerosOpGenericAdaptorBase(CountTrailingZerosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CountTrailingZerosOpGenericAdaptor : public detail::CountTrailingZerosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CountTrailingZerosOpGenericAdaptorBase; +public: + CountTrailingZerosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CountTrailingZerosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CountTrailingZerosOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CountTrailingZerosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CountTrailingZerosOpAdaptor : public CountTrailingZerosOpGenericAdaptor<::mlir::ValueRange> { +public: + using CountTrailingZerosOpGenericAdaptor::CountTrailingZerosOpGenericAdaptor; + CountTrailingZerosOpAdaptor(CountTrailingZerosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CountTrailingZerosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CountTrailingZerosOpAdaptor; + template + using GenericAdaptor = CountTrailingZerosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.cttz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::CountTrailingZerosOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::CtPopOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CtPopOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CtPopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CtPopOpGenericAdaptorBase(CtPopOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CtPopOpGenericAdaptor : public detail::CtPopOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CtPopOpGenericAdaptorBase; +public: + CtPopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CtPopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CtPopOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CtPopOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CtPopOpAdaptor : public CtPopOpGenericAdaptor<::mlir::ValueRange> { +public: + using CtPopOpGenericAdaptor::CtPopOpGenericAdaptor; + CtPopOpAdaptor(CtPopOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CtPopOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CtPopOpAdaptor; + template + using GenericAdaptor = CtPopOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.ctpop"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::CtPopOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::ErfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ErfOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ErfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ErfOpGenericAdaptorBase(ErfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class ErfOpGenericAdaptor : public detail::ErfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ErfOpGenericAdaptorBase; +public: + ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ErfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ErfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ErfOpAdaptor : public ErfOpGenericAdaptor<::mlir::ValueRange> { +public: + using ErfOpGenericAdaptor::ErfOpGenericAdaptor; + ErfOpAdaptor(ErfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ErfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ErfOpAdaptor; + template + using GenericAdaptor = ErfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.erf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::ErfOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Exp2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Exp2OpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Exp2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Exp2OpGenericAdaptorBase(Exp2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class Exp2OpGenericAdaptor : public detail::Exp2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Exp2OpGenericAdaptorBase; +public: + Exp2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Exp2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Exp2OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Exp2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Exp2OpAdaptor : public Exp2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Exp2OpGenericAdaptor::Exp2OpGenericAdaptor; + Exp2OpAdaptor(Exp2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Exp2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Exp2OpAdaptor; + template + using GenericAdaptor = Exp2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.exp2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::Exp2Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::ExpM1Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpM1OpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExpM1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpM1OpGenericAdaptorBase(ExpM1Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class ExpM1OpGenericAdaptor : public detail::ExpM1OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpM1OpGenericAdaptorBase; +public: + ExpM1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpM1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpM1OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExpM1OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpM1OpAdaptor : public ExpM1OpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpM1OpGenericAdaptor::ExpM1OpGenericAdaptor; + ExpM1OpAdaptor(ExpM1Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpM1Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpM1OpAdaptor; + template + using GenericAdaptor = ExpM1OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.expm1"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::ExpM1Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::ExpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpOpGenericAdaptorBase(ExpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpOpGenericAdaptorBase; +public: + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpOpGenericAdaptor::ExpOpGenericAdaptor; + ExpOpAdaptor(ExpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpOpAdaptor; + template + using GenericAdaptor = ExpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.exp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::ExpOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::FPowIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FPowIOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FPowIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FPowIOpGenericAdaptorBase(FPowIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class FPowIOpGenericAdaptor : public detail::FPowIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FPowIOpGenericAdaptorBase; +public: + FPowIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FPowIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FPowIOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FPowIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FPowIOpAdaptor : public FPowIOpGenericAdaptor<::mlir::ValueRange> { +public: + using FPowIOpGenericAdaptor::FPowIOpGenericAdaptor; + FPowIOpAdaptor(FPowIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FPowIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FPowIOpAdaptor; + template + using GenericAdaptor = FPowIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.fpowi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::FPowIOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::FloorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorOpGenericAdaptorBase(FloorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class FloorOpGenericAdaptor : public detail::FloorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorOpGenericAdaptorBase; +public: + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FloorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorOpAdaptor : public FloorOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorOpGenericAdaptor::FloorOpGenericAdaptor; + FloorOpAdaptor(FloorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorOpAdaptor; + template + using GenericAdaptor = FloorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.floor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::FloorOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::FmaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FmaOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FmaOpGenericAdaptorBase(FmaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class FmaOpGenericAdaptor : public detail::FmaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FmaOpGenericAdaptorBase; +public: + FmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FmaOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FmaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FmaOpAdaptor : public FmaOpGenericAdaptor<::mlir::ValueRange> { +public: + using FmaOpGenericAdaptor::FmaOpGenericAdaptor; + FmaOpAdaptor(FmaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FmaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FmaOpAdaptor; + template + using GenericAdaptor = FmaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.fma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getA(); + ::mlir::Value getB(); + ::mlir::Value getC(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::FmaOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::IPowIOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IPowIOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IPowIOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IPowIOpGenericAdaptorBase(IPowIOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IPowIOpGenericAdaptor : public detail::IPowIOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IPowIOpGenericAdaptorBase; +public: + IPowIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IPowIOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IPowIOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IPowIOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IPowIOpAdaptor : public IPowIOpGenericAdaptor<::mlir::ValueRange> { +public: + using IPowIOpGenericAdaptor::IPowIOpGenericAdaptor; + IPowIOpAdaptor(IPowIOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IPowIOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IPowIOpAdaptor; + template + using GenericAdaptor = IPowIOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.ipowi"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::IPowIOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Log10Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log10OpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Log10OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Log10OpGenericAdaptorBase(Log10Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class Log10OpGenericAdaptor : public detail::Log10OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log10OpGenericAdaptorBase; +public: + Log10OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log10OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log10OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Log10OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log10OpAdaptor : public Log10OpGenericAdaptor<::mlir::ValueRange> { +public: + using Log10OpGenericAdaptor::Log10OpGenericAdaptor; + Log10OpAdaptor(Log10Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log10Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log10OpAdaptor; + template + using GenericAdaptor = Log10OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.log10"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::Log10Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Log1pOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log1pOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Log1pOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Log1pOpGenericAdaptorBase(Log1pOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class Log1pOpGenericAdaptor : public detail::Log1pOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log1pOpGenericAdaptorBase; +public: + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log1pOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Log1pOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log1pOpAdaptor : public Log1pOpGenericAdaptor<::mlir::ValueRange> { +public: + using Log1pOpGenericAdaptor::Log1pOpGenericAdaptor; + Log1pOpAdaptor(Log1pOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log1pOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log1pOpAdaptor; + template + using GenericAdaptor = Log1pOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.log1p"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::Log1pOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::Log2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log2OpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + Log2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + Log2OpGenericAdaptorBase(Log2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class Log2OpGenericAdaptor : public detail::Log2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log2OpGenericAdaptorBase; +public: + Log2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log2OpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + Log2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log2OpAdaptor : public Log2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Log2OpGenericAdaptor::Log2OpGenericAdaptor; + Log2OpAdaptor(Log2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log2OpAdaptor; + template + using GenericAdaptor = Log2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.log2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::Log2Op) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::LogOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LogOpGenericAdaptorBase(LogOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogOpGenericAdaptorBase; +public: + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogOpGenericAdaptor::LogOpGenericAdaptor; + LogOpAdaptor(LogOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogOpAdaptor; + template + using GenericAdaptor = LogOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.log"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::LogOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::PowFOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PowFOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PowFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PowFOpGenericAdaptorBase(PowFOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class PowFOpGenericAdaptor : public detail::PowFOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PowFOpGenericAdaptorBase; +public: + PowFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PowFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PowFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PowFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PowFOpAdaptor : public PowFOpGenericAdaptor<::mlir::ValueRange> { +public: + using PowFOpGenericAdaptor::PowFOpGenericAdaptor; + PowFOpAdaptor(PowFOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PowFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PowFOpAdaptor; + template + using GenericAdaptor = PowFOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.powf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::PowFOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::RoundEvenOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundEvenOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RoundEvenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundEvenOpGenericAdaptorBase(RoundEvenOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class RoundEvenOpGenericAdaptor : public detail::RoundEvenOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundEvenOpGenericAdaptorBase; +public: + RoundEvenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundEvenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundEvenOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RoundEvenOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundEvenOpAdaptor : public RoundEvenOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundEvenOpGenericAdaptor::RoundEvenOpGenericAdaptor; + RoundEvenOpAdaptor(RoundEvenOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundEvenOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundEvenOpAdaptor; + template + using GenericAdaptor = RoundEvenOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.roundeven"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::RoundEvenOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::RoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundOpGenericAdaptorBase(RoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class RoundOpGenericAdaptor : public detail::RoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundOpGenericAdaptorBase; +public: + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundOpAdaptor : public RoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundOpGenericAdaptor::RoundOpGenericAdaptor; + RoundOpAdaptor(RoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundOpAdaptor; + template + using GenericAdaptor = RoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.round"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::RoundOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::RsqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RsqrtOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RsqrtOpGenericAdaptorBase(RsqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class RsqrtOpGenericAdaptor : public detail::RsqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RsqrtOpGenericAdaptorBase; +public: + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RsqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RsqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RsqrtOpAdaptor : public RsqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using RsqrtOpGenericAdaptor::RsqrtOpGenericAdaptor; + RsqrtOpAdaptor(RsqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RsqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RsqrtOpAdaptor; + template + using GenericAdaptor = RsqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.rsqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::RsqrtOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::SinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SinOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SinOpGenericAdaptorBase(SinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class SinOpGenericAdaptor : public detail::SinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SinOpGenericAdaptorBase; +public: + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SinOpAdaptor : public SinOpGenericAdaptor<::mlir::ValueRange> { +public: + using SinOpGenericAdaptor::SinOpGenericAdaptor; + SinOpAdaptor(SinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SinOpAdaptor; + template + using GenericAdaptor = SinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.sin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::SinOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::SqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqrtOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SqrtOpGenericAdaptorBase(SqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class SqrtOpGenericAdaptor : public detail::SqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqrtOpGenericAdaptorBase; +public: + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqrtOpAdaptor : public SqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqrtOpGenericAdaptor::SqrtOpGenericAdaptor; + SqrtOpAdaptor(SqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqrtOpAdaptor; + template + using GenericAdaptor = SqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.sqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::SqrtOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::TanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TanOpGenericAdaptorBase(TanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class TanOpGenericAdaptor : public detail::TanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanOpGenericAdaptorBase; +public: + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanOpAdaptor : public TanOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanOpGenericAdaptor::TanOpGenericAdaptor; + TanOpAdaptor(TanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanOpAdaptor; + template + using GenericAdaptor = TanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.tan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::TanOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::TanhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanhOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TanhOpGenericAdaptorBase(TanhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class TanhOpGenericAdaptor : public detail::TanhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanhOpGenericAdaptorBase; +public: + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanhOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanhOpAdaptor : public TanhOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanhOpGenericAdaptor::TanhOpGenericAdaptor; + TanhOpAdaptor(TanhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanhOpAdaptor; + template + using GenericAdaptor = TanhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.tanh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::TanhOp) + +namespace mlir { +namespace math { + +//===----------------------------------------------------------------------===// +// ::mlir::math::TruncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncOpGenericAdaptorBase { +public: + struct Properties { + using fastmathTy = ::mlir::arith::FastMathFlagsAttr; + fastmathTy fastmath; + + auto getFastmath() { + auto &propStorage = this->fastmath; + return ::llvm::dyn_cast_or_null<::mlir::arith::FastMathFlagsAttr>(propStorage); + } + void setFastmath(const ::mlir::arith::FastMathFlagsAttr &propValue) { + this->fastmath = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.fastmath == this->fastmath && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TruncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncOpGenericAdaptorBase(TruncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); +}; +} // namespace detail +template +class TruncOpGenericAdaptor : public detail::TruncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncOpGenericAdaptorBase; +public: + TruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TruncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncOpAdaptor : public TruncOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncOpGenericAdaptor::TruncOpGenericAdaptor; + TruncOpAdaptor(TruncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::arith::ArithFastMathInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::VectorUnrollOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncOpAdaptor; + template + using GenericAdaptor = TruncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fastmath")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFastmathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFastmathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("math.trunc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::FastMathFlagsAttr getFastmathAttr(); + ::mlir::arith::FastMathFlags getFastmath(); + void setFastmathAttr(::mlir::arith::FastMathFlagsAttr attr); + void setFastmath(::mlir::arith::FastMathFlags attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlagsAttr fastmath); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::arith::FastMathFlags fastmath = ::mlir::arith::FastMathFlags::none); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::TruncOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..69891da2fe9b7d22036008baab16ce281d4c3907 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MathBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::math::MathDialect) +namespace mlir { +namespace math { + +MathDialect::MathDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect<::mlir::arith::ArithDialect>(); + + initialize(); +} + +MathDialect::~MathDialect() = default; + +} // namespace math +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..d0bfeedd4aad1a9a28310b335e2f0ac5c47d1db9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/IR/MathOpsDialect.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MathBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace math { + +class MathDialect : public ::mlir::Dialect { + explicit MathDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~MathDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("math"); + } + + /// Materialize a single constant operation from a given attribute value with + /// the desired resultant type. + ::mlir::Operation *materializeConstant(::mlir::OpBuilder &builder, + ::mlir::Attribute value, + ::mlir::Type type, + ::mlir::Location loc) override; +}; +} // namespace math +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::math::MathDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/Transforms/Approximation.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/Transforms/Approximation.h new file mode 100644 index 0000000000000000000000000000000000000000..b4ebc2f0f8fcd2875d7f4a03b31bbd637aaa6f26 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/Transforms/Approximation.h @@ -0,0 +1,29 @@ +//===- Approximation.h - Math dialect -----------------------------*- C++-*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MATH_TRANSFORMS_APPROXIMATION_H +#define MLIR_DIALECT_MATH_TRANSFORMS_APPROXIMATION_H + +#include "mlir/Dialect/Math/IR/Math.h" +#include "mlir/IR/PatternMatch.h" + +namespace mlir { +namespace math { + +struct ErfPolynomialApproximation : public OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + LogicalResult matchAndRewrite(math::ErfOp op, + PatternRewriter &rewriter) const final; +}; + +} // namespace math +} // namespace mlir + +#endif // MLIR_DIALECT_MATH_TRANSFORMS_APPROXIMATION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/Transforms/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/Transforms/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..817d6e1dae051f31114713eecb9f7a2623f7e2a4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/Transforms/Passes.h @@ -0,0 +1,51 @@ +//===- Passes.h - Pass Entrypoints ------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MATH_TRANSFORMS_PASSES_H_ +#define MLIR_DIALECT_MATH_TRANSFORMS_PASSES_H_ + +#include "mlir/Pass/Pass.h" + +namespace mlir { +namespace math { +#define GEN_PASS_DECL +#include "mlir/Dialect/Math/Transforms/Passes.h.inc" +#define GEN_PASS_DECL_MATHUPLIFTTOFMA +#include "mlir/Dialect/Math/Transforms/Passes.h.inc" +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/Math/Transforms/Passes.h.inc" +} // namespace math + +class RewritePatternSet; + +void populateExpandCtlzPattern(RewritePatternSet &patterns); +void populateExpandTanPattern(RewritePatternSet &patterns); +void populateExpandTanhPattern(RewritePatternSet &patterns); +void populateExpandFmaFPattern(RewritePatternSet &patterns); +void populateExpandFloorFPattern(RewritePatternSet &patterns); +void populateExpandCeilFPattern(RewritePatternSet &patterns); +void populateExpandExp2FPattern(RewritePatternSet &patterns); +void populateExpandPowFPattern(RewritePatternSet &patterns); +void populateExpandRoundFPattern(RewritePatternSet &patterns); +void populateExpandRoundEvenPattern(RewritePatternSet &patterns); +void populateMathAlgebraicSimplificationPatterns(RewritePatternSet &patterns); + +struct MathPolynomialApproximationOptions { + // Enables the use of AVX2 intrinsics in some of the approximations. + bool enableAvx2 = false; +}; + +void populateMathPolynomialApproximationPatterns( + RewritePatternSet &patterns, + const MathPolynomialApproximationOptions &options = {}); + +void populateUpliftToFMAPatterns(RewritePatternSet &patterns); + +} // namespace mlir + +#endif // MLIR_DIALECT_MATH_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/Transforms/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/Transforms/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..1368484d22268901676e0eadbd1eb0dff4793d8f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Math/Transforms/Passes.h.inc @@ -0,0 +1,159 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_MATHUPLIFTTOFMA +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// MathUpliftToFMA +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MATHUPLIFTTOFMA +std::unique_ptr<::mlir::Pass> createMathUpliftToFMA(); +#undef GEN_PASS_DECL_MATHUPLIFTTOFMA +#endif // GEN_PASS_DECL_MATHUPLIFTTOFMA +#ifdef GEN_PASS_DEF_MATHUPLIFTTOFMA + +namespace impl { + std::unique_ptr<::mlir::Pass> createMathUpliftToFMA(); +} // namespace impl +namespace impl { + +template +class MathUpliftToFMABase : public ::mlir::OperationPass<> { +public: + using Base = MathUpliftToFMABase; + + MathUpliftToFMABase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + MathUpliftToFMABase(const MathUpliftToFMABase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("math-uplift-to-fma"); + } + ::llvm::StringRef getArgument() const override { return "math-uplift-to-fma"; } + + ::llvm::StringRef getDescription() const override { return "Uplift arith ops to math.fma."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MathUpliftToFMA"); + } + ::llvm::StringRef getName() const override { return "MathUpliftToFMA"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MathUpliftToFMABase) + +protected: +private: + + friend std::unique_ptr<::mlir::Pass> createMathUpliftToFMA() { + return std::make_unique(); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createMathUpliftToFMA() { + return impl::createMathUpliftToFMA(); +} +#undef GEN_PASS_DEF_MATHUPLIFTTOFMA +#endif // GEN_PASS_DEF_MATHUPLIFTTOFMA +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// MathUpliftToFMA Registration +//===----------------------------------------------------------------------===// + +inline void registerMathUpliftToFMA() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createMathUpliftToFMA(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMathUpliftToFMAPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createMathUpliftToFMA(); + }); +} + +//===----------------------------------------------------------------------===// +// Math Registration +//===----------------------------------------------------------------------===// + +inline void registerMathPasses() { + registerMathUpliftToFMA(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class MathUpliftToFMABase : public ::mlir::OperationPass<> { +public: + using Base = MathUpliftToFMABase; + + MathUpliftToFMABase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + MathUpliftToFMABase(const MathUpliftToFMABase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("math-uplift-to-fma"); + } + ::llvm::StringRef getArgument() const override { return "math-uplift-to-fma"; } + + ::llvm::StringRef getDescription() const override { return "Uplift arith ops to math.fma."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MathUpliftToFMA"); + } + ::llvm::StringRef getName() const override { return "MathUpliftToFMA"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MathUpliftToFMABase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h new file mode 100644 index 0000000000000000000000000000000000000000..72463dca715ca32140371439ff5f804ffa20b2f6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h @@ -0,0 +1,92 @@ +//===- MemRef.h - MemRef dialect --------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_IR_MEMREF_H_ +#define MLIR_DIALECT_MEMREF_IR_MEMREF_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/Arith/IR/Arith.h" +#include "mlir/Dialect/Utils/ReshapeOpsUtils.h" +#include "mlir/IR/Dialect.h" +#include "mlir/Interfaces/CallInterfaces.h" +#include "mlir/Interfaces/CastInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/CopyOpInterface.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/MemorySlotInterfaces.h" +#include "mlir/Interfaces/ShapedOpInterfaces.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" +#include "mlir/Interfaces/ViewLikeInterface.h" + +#include + +namespace mlir { + +namespace arith { +enum class AtomicRMWKind : uint64_t; +class AtomicRMWKindAttr; +} // namespace arith + +class Location; +class OpBuilder; + +raw_ostream &operator<<(raw_ostream &os, const Range &range); + +/// Return the list of Range (i.e. offset, size, stride). Each Range +/// entry contains either the dynamic value or a ConstantIndexOp constructed +/// with `b` at location `loc`. +SmallVector getOrCreateRanges(OffsetSizeAndStrideOpInterface op, + OpBuilder &b, Location loc); + +namespace memref { + +/// This is a common utility used for patterns of the form +/// "someop(memref.cast) -> someop". It folds the source of any memref.cast +/// into the root operation directly. +LogicalResult foldMemRefCast(Operation *op, Value inner = nullptr); + +/// Return an unranked/ranked tensor type for the given unranked/ranked memref +/// type. +Type getTensorTypeFromMemRefType(Type type); + +/// Finds a single dealloc operation for the given allocated value. If there +/// are > 1 deallocates for `allocValue`, returns std::nullopt, else returns the +/// single deallocate if it exists or nullptr. +std::optional findDealloc(Value allocValue); + +/// Return the dimension of the given memref value. +OpFoldResult getMixedSize(OpBuilder &builder, Location loc, Value value, + int64_t dim); + +/// Return the dimensions of the given memref value. +SmallVector getMixedSizes(OpBuilder &builder, Location loc, + Value value); + +/// Create a rank-reducing SubViewOp @[0 .. 0] with strides [1 .. 1] and +/// appropriate sizes (i.e. `memref.getSizes()`) to reduce the rank of `memref` +/// to that of `targetShape`. +Value createCanonicalRankReducingSubViewOp(OpBuilder &b, Location loc, + Value memref, + ArrayRef targetShape); +} // namespace memref +} // namespace mlir + +//===----------------------------------------------------------------------===// +// MemRef Dialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/MemRef/IR/MemRefOpsDialect.h.inc" + +//===----------------------------------------------------------------------===// +// MemRef Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/MemRef/IR/MemRefOps.h.inc" + +#endif // MLIR_DIALECT_MEMREF_IR_MEMREF_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefMemorySlot.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefMemorySlot.h new file mode 100644 index 0000000000000000000000000000000000000000..6b56311ed8840a1fb7c47568dbc807a5200f2f3c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefMemorySlot.h @@ -0,0 +1,20 @@ +//===- MemRefMemorySlot.h - Implementation of Memory Slot Interfaces ------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_IR_MEMREFMEMORYSLOT_H +#define MLIR_DIALECT_MEMREF_IR_MEMREFMEMORYSLOT_H + +namespace mlir { +class DialectRegistry; + +namespace memref { +void registerMemorySlotExternalModels(DialectRegistry ®istry); +} // namespace memref +} // namespace mlir + +#endif // MLIR_DIALECT_MEMREF_IR_MEMREFMEMORYSLOT_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..848911f34c7875bd0a4f5945fe0f3bfa57d6ee1f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc @@ -0,0 +1,10555 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MemRefOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::memref::AssumeAlignmentOp, +::mlir::memref::AtomicRMWOp, +::mlir::memref::AtomicYieldOp, +::mlir::memref::CopyOp, +::mlir::memref::GenericAtomicRMWOp, +::mlir::memref::LoadOp, +::mlir::memref::AllocOp, +::mlir::memref::AllocaOp, +::mlir::memref::AllocaScopeOp, +::mlir::memref::AllocaScopeReturnOp, +::mlir::memref::CastOp, +::mlir::memref::CollapseShapeOp, +::mlir::memref::DeallocOp, +::mlir::memref::DimOp, +::mlir::memref::DmaStartOp, +::mlir::memref::DmaWaitOp, +::mlir::memref::ExpandShapeOp, +::mlir::memref::ExtractAlignedPointerAsIndexOp, +::mlir::memref::ExtractStridedMetadataOp, +::mlir::memref::GetGlobalOp, +::mlir::memref::GlobalOp, +::mlir::memref::MemorySpaceCastOp, +::mlir::memref::PrefetchOp, +::mlir::memref::RankOp, +::mlir::memref::ReallocOp, +::mlir::memref::ReinterpretCastOp, +::mlir::memref::ReshapeOp, +::mlir::memref::StoreOp, +::mlir::memref::TransposeOp, +::mlir::memref::ViewOp, +::mlir::memref::SubViewOp, +::mlir::memref::TensorStoreOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace memref { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((type.isSignlessInteger())) || ((::llvm::isa<::mlir::FloatType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be signless integer or floating-point, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger())) || ((::llvm::isa<::mlir::FloatType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of signless integer or floating-point values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::BaseMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be ranked or unranked memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (( isStrided(::llvm::cast<::mlir::MemRefType>(type)) )))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be strided memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::UnrankedMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() >= 1)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be unranked.memref of any type values or non-0-ranked.memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (( isStrided(::llvm::cast<::mlir::MemRefType>(type)) ))) && ((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() + == 0)))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be strided memref of any type values of rank 0, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((::llvm::cast<::mlir::ShapedType>(type).hasStaticShape())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be statically shaped memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() + == 1))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1D memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps11( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger())) || ((::llvm::isa<::mlir::IndexType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() + == 1))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1D memref of signless integer or index values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps12( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::cast<::mlir::ShapedType>(type).hasRank())) && ((::llvm::cast<::mlir::ShapedType>(type).getRank() + == 1))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1D memref of 8-bit signless integer values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_MemRefOps13( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be tensor of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isStrictlyPositive())))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::arith::AtomicRMWKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: bool attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() >= 0)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); }))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Array of 64-bit integer array attributes"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: flat symbol reference attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::MemRefType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: memref type attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps8( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((true))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps8( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps8(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps9( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps9( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps9(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps10( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps10( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps10(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps11( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() >= 0)) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() <= 3)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 3"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps11( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps11(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps12( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: i64 dense array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps12( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps12(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps13( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::AffineMapAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: AffineMap attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_MemRefOps13( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_MemRefOps13(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_MemRefOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_MemRefOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItems(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with 1 blocks"; + } + return ::mlir::success(); +} +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AssumeAlignmentOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AssumeAlignmentOpGenericAdaptorBase::AssumeAlignmentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.assume_alignment", odsAttrs.getContext()); +} + +AssumeAlignmentOpGenericAdaptorBase::AssumeAlignmentOpGenericAdaptorBase(AssumeAlignmentOp op) : AssumeAlignmentOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AssumeAlignmentOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AssumeAlignmentOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr AssumeAlignmentOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +uint32_t AssumeAlignmentOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +AssumeAlignmentOpAdaptor::AssumeAlignmentOpAdaptor(AssumeAlignmentOp op) : AssumeAlignmentOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AssumeAlignmentOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitError(loc, "'memref.assume_alignment' op ""requires attribute 'alignment'"); + + if (tblgen_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getValue().isStrictlyPositive())))) + return emitError(loc, "'memref.assume_alignment' op ""attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive"); + return ::mlir::success(); +} + +std::pair AssumeAlignmentOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AssumeAlignmentOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> AssumeAlignmentOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AssumeAlignmentOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AssumeAlignmentOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AssumeAlignmentOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AssumeAlignmentOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AssumeAlignmentOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AssumeAlignmentOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer())); +} + +std::optional AssumeAlignmentOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + return std::nullopt; +} + +void AssumeAlignmentOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AssumeAlignmentOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); +} + +::mlir::LogicalResult AssumeAlignmentOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps0(attr, "alignment", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AssumeAlignmentOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.alignment))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AssumeAlignmentOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.alignment); +} + +::mlir::IntegerAttr AssumeAlignmentOp::getAlignmentAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().alignment); +} + +uint32_t AssumeAlignmentOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr.getValue().getZExtValue(); +} + +void AssumeAlignmentOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void AssumeAlignmentOp::setAlignment(uint32_t attrValue) { + (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void AssumeAlignmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::IntegerAttr alignment) { + odsState.addOperands(memref); + odsState.getOrAddProperties().alignment = alignment; +} + +void AssumeAlignmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::IntegerAttr alignment) { + odsState.addOperands(memref); + odsState.getOrAddProperties().alignment = alignment; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AssumeAlignmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, uint32_t alignment) { + odsState.addOperands(memref); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); +} + +void AssumeAlignmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, uint32_t alignment) { + odsState.addOperands(memref); + odsState.getOrAddProperties().alignment = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AssumeAlignmentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AssumeAlignmentOp::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + if (!tblgen_alignment) return emitOpError("requires attribute 'alignment'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps0(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AssumeAlignmentOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AssumeAlignmentOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::mlir::IntegerAttr alignmentAttr; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(alignmentAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (alignmentAttr) result.getOrAddProperties().alignment = alignmentAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AssumeAlignmentOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getAlignmentAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("alignment"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::AssumeAlignmentOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AtomicRMWOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicRMWOpGenericAdaptorBase::AtomicRMWOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.atomic_rmw", odsAttrs.getContext()); +} + +AtomicRMWOpGenericAdaptorBase::AtomicRMWOpGenericAdaptorBase(AtomicRMWOp op) : AtomicRMWOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicRMWOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AtomicRMWOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::arith::AtomicRMWKindAttr AtomicRMWOpGenericAdaptorBase::getKindAttr() { + auto attr = ::llvm::cast<::mlir::arith::AtomicRMWKindAttr>(getProperties().kind); + return attr; +} + +::mlir::arith::AtomicRMWKind AtomicRMWOpGenericAdaptorBase::getKind() { + auto attr = getKindAttr(); + return attr.getValue(); +} + +} // namespace detail +AtomicRMWOpAdaptor::AtomicRMWOpAdaptor(AtomicRMWOp op) : AtomicRMWOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicRMWOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_kind = getProperties().kind; (void)tblgen_kind; + if (!tblgen_kind) return emitError(loc, "'memref.atomic_rmw' op ""requires attribute 'kind'"); + + if (tblgen_kind && !((::llvm::isa<::mlir::arith::AtomicRMWKindAttr>(tblgen_kind)))) + return emitError(loc, "'memref.atomic_rmw' op ""attribute 'kind' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14"); + return ::mlir::success(); +} + +std::pair AtomicRMWOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AtomicRMWOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AtomicRMWOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> AtomicRMWOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range AtomicRMWOp::getIndices() { + return getODSOperands(2); +} + +::mlir::OpOperand &AtomicRMWOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AtomicRMWOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange AtomicRMWOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AtomicRMWOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicRMWOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AtomicRMWOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AtomicRMWOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.kind; + auto attr = dict.get("kind"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for kind in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `kind` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AtomicRMWOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.kind; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("kind", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AtomicRMWOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.kind.getAsOpaquePointer())); +} + +std::optional AtomicRMWOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "kind") + return prop.kind; + return std::nullopt; +} + +void AtomicRMWOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "kind") { + prop.kind = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AtomicRMWOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.kind) attrs.append("kind", prop.kind); +} + +::mlir::LogicalResult AtomicRMWOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getKindAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps1(attr, "kind", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicRMWOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.kind))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicRMWOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.kind); +} + +::mlir::arith::AtomicRMWKindAttr AtomicRMWOp::getKindAttr() { + return ::llvm::cast<::mlir::arith::AtomicRMWKindAttr>(getProperties().kind); +} + +::mlir::arith::AtomicRMWKind AtomicRMWOp::getKind() { + auto attr = getKindAttr(); + return attr.getValue(); +} + +void AtomicRMWOp::setKindAttr(::mlir::arith::AtomicRMWKindAttr attr) { + (*this)->setAttr(getKindAttrName(), attr); +} + +void AtomicRMWOp::setKind(::mlir::arith::AtomicRMWKind attrValue) { + (*this)->setAttr(getKindAttrName(), ::mlir::arith::AtomicRMWKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::AtomicRMWKindAttr kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().kind = kind; + odsState.addTypes(result); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::AtomicRMWKindAttr kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().kind = kind; + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::AtomicRMWKindAttr kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().kind = kind; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::AtomicRMWKind kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().kind = ::mlir::arith::AtomicRMWKindAttr::get(odsBuilder.getContext(), kind); + odsState.addTypes(result); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::AtomicRMWKind kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().kind = ::mlir::arith::AtomicRMWKindAttr::get(odsBuilder.getContext(), kind); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::AtomicRMWKind kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().kind = ::mlir::arith::AtomicRMWKindAttr::get(odsBuilder.getContext(), kind); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AtomicRMWOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(AtomicRMWOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult AtomicRMWOp::verifyInvariantsImpl() { + auto tblgen_kind = getProperties().kind; (void)tblgen_kind; + if (!tblgen_kind) return emitOpError("requires attribute 'kind'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps1(*this, tblgen_kind, "kind"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {value, result} have same type"); + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(1).begin()).getType()).getElementType(), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that value type matches element type of memref"); + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicRMWOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult AtomicRMWOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = operands[0].getType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult AtomicRMWOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::arith::AtomicRMWKindAttr kindAttr; + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + { + ::llvm::StringRef attrStr; + ::mlir::NamedAttrList attrStorage; + auto loc = parser.getCurrentLocation(); + if (parser.parseOptionalKeyword(&attrStr, {"addf","addi","assign","maximumf","maxs","maxu","minimumf","mins","minu","mulf","muli","ori","andi","maxnumf","minnumf"})) { + ::mlir::StringAttr attrVal; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalAttribute(attrVal, + parser.getBuilder().getNoneType(), + "kind", attrStorage); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + attrStr = attrVal.getValue(); + } else { + return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'kind' [addf, addi, assign, maximumf, maxs, maxu, minimumf, mins, minu, mulf, muli, ori, andi, maxnumf, minnumf]"); + } + } + if (!attrStr.empty()) { + auto attrOptional = ::mlir::arith::symbolizeAtomicRMWKind(attrStr); + if (!attrOptional) + return parser.emitError(loc, "invalid ") + << "kind attribute specification: \"" << attrStr << '"';; + + kindAttr = ::mlir::arith::AtomicRMWKindAttr::get(parser.getBuilder().getContext(), *attrOptional); + result.getOrAddProperties().kind = kindAttr; + } + } + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resultTypes); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicRMWOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + + { + auto caseValue = getKind(); + auto caseValueStr = stringifyAtomicRMWKind(caseValue); + _odsPrinter << caseValueStr; + } + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("kind"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "("; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AtomicRMWOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::AtomicRMWOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AtomicYieldOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicYieldOpGenericAdaptorBase::AtomicYieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.atomic_yield", odsAttrs.getContext()); +} + +AtomicYieldOpGenericAdaptorBase::AtomicYieldOpGenericAdaptorBase(AtomicYieldOp op) : AtomicYieldOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicYieldOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicYieldOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AtomicYieldOpAdaptor::AtomicYieldOpAdaptor(AtomicYieldOp op) : AtomicYieldOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicYieldOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AtomicYieldOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicYieldOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AtomicYieldOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AtomicYieldOp::getResultMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtomicYieldOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicYieldOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void AtomicYieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value result) { + odsState.addOperands(result); +} + +void AtomicYieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value result) { + odsState.addOperands(result); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicYieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AtomicYieldOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicYieldOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AtomicYieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand resultRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> resultOperands(resultRawOperands); ::llvm::SMLoc resultOperandsLoc; + (void)resultOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + resultOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(resultRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + if (parser.resolveOperands(resultOperands, resultTypes, resultOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicYieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getResult(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AtomicYieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::AtomicYieldOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::CopyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CopyOpGenericAdaptorBase::CopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.copy", odsAttrs.getContext()); +} + +CopyOpGenericAdaptorBase::CopyOpGenericAdaptorBase(CopyOp op) : CopyOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CopyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CopyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CopyOpAdaptor::CopyOpAdaptor(CopyOp op) : CopyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CopyOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CopyOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CopyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> CopyOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::BaseMemRefType> CopyOp::getTarget() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &CopyOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &CopyOp::getTargetMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair CopyOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CopyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void CopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source, ::mlir::Value target) { + odsState.addOperands(source); + odsState.addOperands(target); +} + +void CopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value target) { + odsState.addOperands(source); + odsState.addOperands(target); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CopyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CopyOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopyOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CopyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand targetRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> targetOperands(targetRawOperands); ::llvm::SMLoc targetOperandsLoc; + (void)targetOperandsLoc; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::mlir::Type targetRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> targetTypes(targetRawTypes); + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + targetOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(targetRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + targetRawTypes[0] = type; + } + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(targetOperands, targetTypes, targetOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CopyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTarget(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getTarget().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CopyOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::CopyOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::GenericAtomicRMWOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GenericAtomicRMWOpGenericAdaptorBase::GenericAtomicRMWOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.generic_atomic_rmw", odsAttrs.getContext()); +} + +GenericAtomicRMWOpGenericAdaptorBase::GenericAtomicRMWOpGenericAdaptorBase(GenericAtomicRMWOp op) : GenericAtomicRMWOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GenericAtomicRMWOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr GenericAtomicRMWOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &GenericAtomicRMWOpGenericAdaptorBase::getAtomicBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange GenericAtomicRMWOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +GenericAtomicRMWOpAdaptor::GenericAtomicRMWOpAdaptor(GenericAtomicRMWOp op) : GenericAtomicRMWOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GenericAtomicRMWOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GenericAtomicRMWOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range GenericAtomicRMWOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> GenericAtomicRMWOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range GenericAtomicRMWOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &GenericAtomicRMWOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange GenericAtomicRMWOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair GenericAtomicRMWOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GenericAtomicRMWOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value GenericAtomicRMWOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::Region &GenericAtomicRMWOp::getAtomicBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult GenericAtomicRMWOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result type matches element type of memref"); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_MemRefOps0(*this, region, "atomic_body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GenericAtomicRMWOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult GenericAtomicRMWOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::llvm::cast(operands[0].getType()).getElementType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +void GenericAtomicRMWOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::GenericAtomicRMWOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::LoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LoadOpGenericAdaptorBase::LoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.load", odsAttrs.getContext()); +} + +LoadOpGenericAdaptorBase::LoadOpGenericAdaptorBase(LoadOp op) : LoadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr LoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr LoadOpGenericAdaptorBase::getNontemporalAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().nontemporal); + if (!attr) + attr = ::mlir::Builder(odsAttrs.getContext()).getBoolAttr(false); + return attr; +} + +bool LoadOpGenericAdaptorBase::getNontemporal() { + auto attr = getNontemporalAttr(); + if (!attr) + return ::mlir::Builder(odsAttrs.getContext()).getBoolAttr(false).getValue(); + return attr.getValue(); +} + +} // namespace detail +LoadOpAdaptor::LoadOpAdaptor(LoadOp op) : LoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LoadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal; + + if (tblgen_nontemporal && !((::llvm::isa<::mlir::BoolAttr>(tblgen_nontemporal)))) + return emitError(loc, "'memref.load' op ""attribute 'nontemporal' failed to satisfy constraint: bool attribute"); + return ::mlir::success(); +} + +std::pair LoadOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range LoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> LoadOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range LoadOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &LoadOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange LoadOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair LoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LoadOp::getResult() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult LoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.nontemporal; + auto attr = dict.get("nontemporal"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nontemporal in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nontemporal` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.nontemporal; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nontemporal", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LoadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.nontemporal.getAsOpaquePointer())); +} + +std::optional LoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "nontemporal") + return prop.nontemporal; + return std::nullopt; +} + +void LoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "nontemporal") { + prop.nontemporal = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.nontemporal) attrs.append("nontemporal", prop.nontemporal); +} + +::mlir::LogicalResult LoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNontemporalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps2(attr, "nontemporal", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.nontemporal))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.nontemporal); +} + +::mlir::BoolAttr LoadOp::getNontemporalAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().nontemporal); +} + +bool LoadOp::getNontemporal() { + auto attr = getNontemporalAttr(); + if (!attr) + return ::mlir::Builder((*this)->getContext()).getBoolAttr(false).getValue(); + return attr.getValue(); +} + +void LoadOp::setNontemporalAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getNontemporalAttrName(), attr); +} + +void LoadOp::setNontemporal(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getNontemporalAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(*attrValue)); + (*this)->removeAttr(getNontemporalAttrName()); +} + +::mlir::Attribute LoadOp::removeNontemporalAttr() { + auto &attr = getProperties().nontemporal; + attr = {}; + return attr; +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal) { + odsState.addOperands(memref); + odsState.addOperands(indices); + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = nontemporal; + } + odsState.addTypes(result); +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal) { + odsState.addOperands(memref); + odsState.addOperands(indices); + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = nontemporal; + } + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LoadOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal) { + odsState.addOperands(memref); + odsState.addOperands(indices); + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = nontemporal; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().nontemporal = odsBuilder.getBoolAttr(nontemporal); + odsState.addTypes(result); +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().nontemporal = odsBuilder.getBoolAttr(nontemporal); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LoadOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().nontemporal = odsBuilder.getBoolAttr(nontemporal); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(LoadOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult LoadOp::verifyInvariantsImpl() { + auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps2(*this, tblgen_nontemporal, "nontemporal"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType())))) + return emitOpError("failed to verify that result type matches element type of 'memref'"); + return ::mlir::success(); +} + +::mlir::LogicalResult LoadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::LogicalResult LoadOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = ::llvm::cast(operands[0].getType()).getElementType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult LoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + for (::mlir::Type type : memrefTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return parser.emitError(parser.getNameLoc()) << "'memref' must be memref of any type values, but got " << type; + } + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(::llvm::cast(memrefTypes[0]).getElementType()); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNontemporalAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("nontemporal"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void LoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::LoadOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AllocOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AllocOpGenericAdaptorBase::AllocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.alloc", odsAttrs.getContext()); +} + +AllocOpGenericAdaptorBase::AllocOpGenericAdaptorBase(AllocOp op) : AllocOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AllocOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr AllocOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr AllocOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional AllocOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +AllocOpAdaptor::AllocOpAdaptor(AllocOp op) : AllocOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AllocOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + + if (tblgen_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getInt() >= 0)))) + return emitError(loc, "'memref.alloc' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"); + return ::mlir::success(); +} + +std::pair AllocOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range AllocOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AllocOp::getDynamicSizes() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range AllocOp::getSymbolOperands() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange AllocOp::getDynamicSizesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AllocOp::getSymbolOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair AllocOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AllocOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> AllocOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AllocOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute AllocOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AllocOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional AllocOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void AllocOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void AllocOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult AllocOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps3(attr, "alignment", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void AllocOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alignment); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::IntegerAttr AllocOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional AllocOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void AllocOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void AllocOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +::mlir::Attribute AllocOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, IntegerAttr alignment) { + return build(odsBuilder, odsState, memrefType, {}, alignment); + +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, ValueRange dynamicSizes, IntegerAttr alignment) { + return build(odsBuilder, odsState, memrefType, dynamicSizes, {}, alignment); + +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, ValueRange dynamicSizes, ValueRange symbolOperands, IntegerAttr alignment) { + odsState.types.push_back(memrefType); + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + odsState.addAttribute(getOperandSegmentSizeAttr(), + odsBuilder.getDenseI32ArrayAttr({ + static_cast(dynamicSizes.size()), + static_cast(symbolOperands.size())})); + if (alignment) + odsState.addAttribute(getAlignmentAttrStrName(), alignment); + +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef sizes, Type elementType, Attribute memorySpace) { + SmallVector staticShape; + SmallVector dynamicSizes; + dispatchIndexOpFoldResults(sizes, dynamicSizes, staticShape); + MemRefLayoutAttrInterface layout; + MemRefType memrefType = MemRefType::get(staticShape, elementType, layout, + memorySpace); + return build(odsBuilder, odsState, memrefType, dynamicSizes); + +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::IntegerAttr alignment) { + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + ::llvm::copy(::llvm::ArrayRef({static_cast(dynamicSizes.size()), static_cast(symbolOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + odsState.addTypes(memref); +} + +void AllocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::IntegerAttr alignment) { + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + ::llvm::copy(::llvm::ArrayRef({static_cast(dynamicSizes.size()), static_cast(symbolOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AllocOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AllocOp::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps3(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AllocOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dynamicSizesOperands; + ::llvm::SMLoc dynamicSizesOperandsLoc; + (void)dynamicSizesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> symbolOperandsOperands; + ::llvm::SMLoc symbolOperandsOperandsLoc; + (void)symbolOperandsOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + if (parser.parseLParen()) + return ::mlir::failure(); + + dynamicSizesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dynamicSizesOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLSquare())) { + + symbolOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(symbolOperandsOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } +::llvm::copy(::llvm::ArrayRef({static_cast(dynamicSizesOperands.size()), static_cast(symbolOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(memrefTypes); + if (parser.resolveOperands(dynamicSizesOperands, odsBuildableType0, dynamicSizesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(symbolOperandsOperands, odsBuildableType0, symbolOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AllocOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getDynamicSizes(); + _odsPrinter << ")"; + if (!getSymbolOperands().empty()) { + _odsPrinter << "["; + _odsPrinter << getSymbolOperands(); + _odsPrinter << "]"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AllocOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSResults(0)) + effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::AllocOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AllocaOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AllocaOpGenericAdaptorBase::AllocaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.alloca", odsAttrs.getContext()); +} + +AllocaOpGenericAdaptorBase::AllocaOpGenericAdaptorBase(AllocaOp op) : AllocaOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AllocaOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr AllocaOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr AllocaOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional AllocaOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +AllocaOpAdaptor::AllocaOpAdaptor(AllocaOp op) : AllocaOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AllocaOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + + if (tblgen_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getInt() >= 0)))) + return emitError(loc, "'memref.alloca' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"); + return ::mlir::success(); +} + +std::pair AllocaOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range AllocaOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AllocaOp::getDynamicSizes() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range AllocaOp::getSymbolOperands() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange AllocaOp::getDynamicSizesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AllocaOp::getSymbolOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair AllocaOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AllocaOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> AllocaOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AllocaOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute AllocaOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AllocaOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional AllocaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void AllocaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void AllocaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult AllocaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps3(attr, "alignment", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocaOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void AllocaOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alignment); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::IntegerAttr AllocaOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional AllocaOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void AllocaOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void AllocaOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +::mlir::Attribute AllocaOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, IntegerAttr alignment) { + return build(odsBuilder, odsState, memrefType, {}, alignment); + +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, ValueRange dynamicSizes, IntegerAttr alignment) { + return build(odsBuilder, odsState, memrefType, dynamicSizes, {}, alignment); + +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, ValueRange dynamicSizes, ValueRange symbolOperands, IntegerAttr alignment) { + odsState.types.push_back(memrefType); + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + odsState.addAttribute(getOperandSegmentSizeAttr(), + odsBuilder.getDenseI32ArrayAttr({ + static_cast(dynamicSizes.size()), + static_cast(symbolOperands.size())})); + if (alignment) + odsState.addAttribute(getAlignmentAttrStrName(), alignment); + +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef sizes, Type elementType, Attribute memorySpace) { + SmallVector staticShape; + SmallVector dynamicSizes; + dispatchIndexOpFoldResults(sizes, dynamicSizes, staticShape); + MemRefLayoutAttrInterface layout; + MemRefType memrefType = MemRefType::get(staticShape, elementType, layout, + memorySpace); + return build(odsBuilder, odsState, memrefType, dynamicSizes); + +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::IntegerAttr alignment) { + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + ::llvm::copy(::llvm::ArrayRef({static_cast(dynamicSizes.size()), static_cast(symbolOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + odsState.addTypes(memref); +} + +void AllocaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::IntegerAttr alignment) { + odsState.addOperands(dynamicSizes); + odsState.addOperands(symbolOperands); + ::llvm::copy(::llvm::ArrayRef({static_cast(dynamicSizes.size()), static_cast(symbolOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AllocaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AllocaOp::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps3(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocaOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AllocaOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dynamicSizesOperands; + ::llvm::SMLoc dynamicSizesOperandsLoc; + (void)dynamicSizesOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> symbolOperandsOperands; + ::llvm::SMLoc symbolOperandsOperandsLoc; + (void)symbolOperandsOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + if (parser.parseLParen()) + return ::mlir::failure(); + + dynamicSizesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dynamicSizesOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLSquare())) { + + symbolOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(symbolOperandsOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } +::llvm::copy(::llvm::ArrayRef({static_cast(dynamicSizesOperands.size()), static_cast(symbolOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(memrefTypes); + if (parser.resolveOperands(dynamicSizesOperands, odsBuildableType0, dynamicSizesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(symbolOperandsOperands, odsBuildableType0, symbolOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AllocaOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getDynamicSizes(); + _odsPrinter << ")"; + if (!getSymbolOperands().empty()) { + _odsPrinter << "["; + _odsPrinter << getSymbolOperands(); + _odsPrinter << "]"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void AllocaOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSResults(0)) + effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), value, 0, true, ::mlir::SideEffects::AutomaticAllocationScopeResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::AllocaOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AllocaScopeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AllocaScopeOpGenericAdaptorBase::AllocaScopeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.alloca_scope", odsAttrs.getContext()); +} + +AllocaScopeOpGenericAdaptorBase::AllocaScopeOpGenericAdaptorBase(AllocaScopeOp op) : AllocaScopeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AllocaScopeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AllocaScopeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &AllocaScopeOpGenericAdaptorBase::getBodyRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange AllocaScopeOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AllocaScopeOpAdaptor::AllocaScopeOpAdaptor(AllocaScopeOp op) : AllocaScopeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AllocaScopeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AllocaScopeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AllocaScopeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair AllocaScopeOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range AllocaScopeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range AllocaScopeOp::getResults() { + return getODSResults(0); +} + +::mlir::Region &AllocaScopeOp::getBodyRegion() { + return (*this)->getRegion(0); +} + +void AllocaScopeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results) { + (void)odsState.addRegion(); + odsState.addTypes(results); +} + +void AllocaScopeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AllocaScopeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_MemRefOps1(*this, region, "bodyRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocaScopeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::AllocaScopeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AllocaScopeReturnOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AllocaScopeReturnOpGenericAdaptorBase::AllocaScopeReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.alloca_scope.return", odsAttrs.getContext()); +} + +AllocaScopeReturnOpGenericAdaptorBase::AllocaScopeReturnOpGenericAdaptorBase(AllocaScopeReturnOp op) : AllocaScopeReturnOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AllocaScopeReturnOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AllocaScopeReturnOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AllocaScopeReturnOpAdaptor::AllocaScopeReturnOpAdaptor(AllocaScopeReturnOp op) : AllocaScopeReturnOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AllocaScopeReturnOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AllocaScopeReturnOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AllocaScopeReturnOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range AllocaScopeReturnOp::getResults() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange AllocaScopeReturnOp::getResultsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AllocaScopeReturnOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AllocaScopeReturnOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void AllocaScopeReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + /*nothing to do */ +} + +void AllocaScopeReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange results) { + odsState.addOperands(results); +} + +void AllocaScopeReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AllocaScopeReturnOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AllocaScopeReturnOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult AllocaScopeReturnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> resultsOperands; + ::llvm::SMLoc resultsOperandsLoc; + (void)resultsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> resultsTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + resultsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(resultsOperands)) + return ::mlir::failure(); + if (!resultsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(resultsTypes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(resultsOperands, resultsTypes, resultsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AllocaScopeReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (!getResults().empty()) { + _odsPrinter << ' '; + _odsPrinter << getResults(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getResults().getTypes(); + } +} + +void AllocaScopeReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange AllocaScopeReturnOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::AllocaScopeReturnOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::CastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CastOpGenericAdaptorBase::CastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.cast", odsAttrs.getContext()); +} + +CastOpGenericAdaptorBase::CastOpGenericAdaptorBase(CastOp op) : CastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CastOpAdaptor::CastOpAdaptor(CastOp op) : CastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> CastOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CastOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> CastOp::getDest() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSResults(0).begin()); +} + +void CastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dest, ::mlir::Value source) { + odsState.addOperands(source); + odsState.addTypes(dest); +} + +void CastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source) { + odsState.addOperands(source); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CastOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::mlir::Type destRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> destTypes(destRawTypes); + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + destRawTypes[0] = type; + } + result.addTypes(destTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getDest().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::CastOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::CollapseShapeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CollapseShapeOpGenericAdaptorBase::CollapseShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.collapse_shape", odsAttrs.getContext()); +} + +CollapseShapeOpGenericAdaptorBase::CollapseShapeOpGenericAdaptorBase(CollapseShapeOp op) : CollapseShapeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CollapseShapeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CollapseShapeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr CollapseShapeOpGenericAdaptorBase::getReassociationAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().reassociation); + return attr; +} + +::mlir::ArrayAttr CollapseShapeOpGenericAdaptorBase::getReassociation() { + auto attr = getReassociationAttr(); + return attr; +} + +} // namespace detail +CollapseShapeOpAdaptor::CollapseShapeOpAdaptor(CollapseShapeOp op) : CollapseShapeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CollapseShapeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_reassociation = getProperties().reassociation; (void)tblgen_reassociation; + if (!tblgen_reassociation) return emitError(loc, "'memref.collapse_shape' op ""requires attribute 'reassociation'"); + + if (tblgen_reassociation && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reassociation))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reassociation), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); }))); })))) + return emitError(loc, "'memref.collapse_shape' op ""attribute 'reassociation' failed to satisfy constraint: Array of 64-bit integer array attributes"); + return ::mlir::success(); +} + +std::pair CollapseShapeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CollapseShapeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> CollapseShapeOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CollapseShapeOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CollapseShapeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CollapseShapeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> CollapseShapeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CollapseShapeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.reassociation; + auto attr = dict.get("reassociation"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for reassociation in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reassociation` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CollapseShapeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.reassociation; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reassociation", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CollapseShapeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.reassociation.getAsOpaquePointer())); +} + +std::optional CollapseShapeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "reassociation") + return prop.reassociation; + return std::nullopt; +} + +void CollapseShapeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "reassociation") { + prop.reassociation = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CollapseShapeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.reassociation) attrs.append("reassociation", prop.reassociation); +} + +::mlir::LogicalResult CollapseShapeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getReassociationAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps4(attr, "reassociation", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CollapseShapeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.reassociation))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CollapseShapeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.reassociation); +} + +::mlir::ArrayAttr CollapseShapeOp::getReassociationAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().reassociation); +} + +::mlir::ArrayAttr CollapseShapeOp::getReassociation() { + auto attr = getReassociationAttr(); + return attr; +} + +void CollapseShapeOp::setReassociationAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReassociationAttrName(), attr); +} + +void CollapseShapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value src, ArrayRef reassociation, ArrayRef attrs) { + auto reassociationMaps = + convertReassociationMapsToIndices(odsBuilder, reassociation); + build(odsBuilder, odsState, src, reassociationMaps, attrs); + +} + +void CollapseShapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value src, ArrayRef reassociation, ArrayRef attrs) { + build(odsBuilder, odsState, resultType, src, attrs); + odsState.addAttribute("reassociation", + getReassociationIndicesAttribute(odsBuilder, reassociation)); + +} + +void CollapseShapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value src, ArrayRef reassociation, ArrayRef attrs) { + auto reassociationMaps = + convertReassociationMapsToIndices(odsBuilder, reassociation); + build(odsBuilder, odsState, resultType, src, reassociationMaps, attrs); + +} + +void CollapseShapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::ArrayAttr reassociation) { + odsState.addOperands(src); + odsState.getOrAddProperties().reassociation = reassociation; + odsState.addTypes(result); +} + +void CollapseShapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ArrayAttr reassociation) { + odsState.addOperands(src); + odsState.getOrAddProperties().reassociation = reassociation; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CollapseShapeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CollapseShapeOp::verifyInvariantsImpl() { + auto tblgen_reassociation = getProperties().reassociation; (void)tblgen_reassociation; + if (!tblgen_reassociation) return emitOpError("requires attribute 'reassociation'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps4(*this, tblgen_reassociation, "reassociation"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CollapseShapeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CollapseShapeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(srcRawOperands); ::llvm::SMLoc srcOperandsLoc; + (void)srcOperandsLoc; + ::mlir::ArrayAttr reassociationAttr; + ::mlir::Type srcRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcTypes(srcRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + srcOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcRawOperands[0])) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(reassociationAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (reassociationAttr) result.getOrAddProperties().reassociation = reassociationAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CollapseShapeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrc(); + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getReassociationAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("reassociation"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void CollapseShapeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::CollapseShapeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::DeallocOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeallocOpGenericAdaptorBase::DeallocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.dealloc", odsAttrs.getContext()); +} + +DeallocOpGenericAdaptorBase::DeallocOpGenericAdaptorBase(DeallocOp op) : DeallocOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeallocOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DeallocOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DeallocOpAdaptor::DeallocOpAdaptor(DeallocOp op) : DeallocOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeallocOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DeallocOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DeallocOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> DeallocOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &DeallocOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair DeallocOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeallocOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void DeallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref) { + odsState.addOperands(memref); +} + +void DeallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref) { + odsState.addOperands(memref); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeallocOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DeallocOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeallocOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DeallocOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeallocOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMemref(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void DeallocOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Free::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::DeallocOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::DimOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DimOpGenericAdaptorBase::DimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.dim", odsAttrs.getContext()); +} + +DimOpGenericAdaptorBase::DimOpGenericAdaptorBase(DimOp op) : DimOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DimOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DimOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DimOpAdaptor::DimOpAdaptor(DimOp op) : DimOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DimOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DimOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DimOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DimOp::getSource() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> DimOp::getIndex() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &DimOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &DimOp::getIndexMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair DimOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DimOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> DimOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void DimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::Value index) { + odsState.addOperands(source); + odsState.addOperands(index); + odsState.addTypes(result); +} + +void DimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source, ::mlir::Value index) { + odsState.addOperands(source); + odsState.addOperands(index); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DimOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void DimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value index) { + odsState.addOperands(source); + odsState.addOperands(index); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DimOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(DimOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult DimOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DimOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult DimOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult DimOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand indexRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> indexOperands(indexRawOperands); ::llvm::SMLoc indexOperandsLoc; + (void)indexOperandsLoc; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + indexOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(indexRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indexOperands, odsBuildableType0, indexOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DimOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getIndex(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void DimOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::DimOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::DmaStartOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DmaStartOpGenericAdaptorBase::DmaStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.dma_start", odsAttrs.getContext()); +} + +DmaStartOpGenericAdaptorBase::DmaStartOpGenericAdaptorBase(DmaStartOp op) : DmaStartOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DmaStartOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr DmaStartOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DmaStartOpAdaptor::DmaStartOpAdaptor(DmaStartOp op) : DmaStartOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DmaStartOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DmaStartOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range DmaStartOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DmaStartOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange DmaStartOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair DmaStartOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DmaStartOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void DmaStartOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { + odsState.addOperands(operands); +} + +void DmaStartOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DmaStartOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DmaStartOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::DmaStartOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::DmaWaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DmaWaitOpGenericAdaptorBase::DmaWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.dma_wait", odsAttrs.getContext()); +} + +DmaWaitOpGenericAdaptorBase::DmaWaitOpGenericAdaptorBase(DmaWaitOp op) : DmaWaitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DmaWaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr DmaWaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DmaWaitOpAdaptor::DmaWaitOpAdaptor(DmaWaitOp op) : DmaWaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DmaWaitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DmaWaitOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range DmaWaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> DmaWaitOp::getTagMemRef() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range DmaWaitOp::getTagIndices() { + return getODSOperands(1); +} + +::mlir::TypedValue<::mlir::IndexType> DmaWaitOp::getNumElements() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &DmaWaitOp::getTagMemRefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange DmaWaitOp::getTagIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &DmaWaitOp::getNumElementsMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair DmaWaitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DmaWaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void DmaWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tagMemRef, ::mlir::ValueRange tagIndices, ::mlir::Value numElements) { + odsState.addOperands(tagMemRef); + odsState.addOperands(tagIndices); + odsState.addOperands(numElements); +} + +void DmaWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tagMemRef, ::mlir::ValueRange tagIndices, ::mlir::Value numElements) { + odsState.addOperands(tagMemRef); + odsState.addOperands(tagIndices); + odsState.addOperands(numElements); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DmaWaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DmaWaitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DmaWaitOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DmaWaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tagMemRefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tagMemRefOperands(tagMemRefRawOperands); ::llvm::SMLoc tagMemRefOperandsLoc; + (void)tagMemRefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> tagIndicesOperands; + ::llvm::SMLoc tagIndicesOperandsLoc; + (void)tagIndicesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand numElementsRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> numElementsOperands(numElementsRawOperands); ::llvm::SMLoc numElementsOperandsLoc; + (void)numElementsOperandsLoc; + ::mlir::Type tagMemRefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tagMemRefTypes(tagMemRefRawTypes); + + tagMemRefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tagMemRefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + tagIndicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(tagIndicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + numElementsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(numElementsRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tagMemRefRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(tagMemRefOperands, tagMemRefTypes, tagMemRefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tagIndicesOperands, odsBuildableType0, tagIndicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(numElementsOperands, odsBuildableType0, numElementsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DmaWaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTagMemRef(); + _odsPrinter << "["; + _odsPrinter << getTagIndices(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getNumElements(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getTagMemRef().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::DmaWaitOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ExpandShapeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExpandShapeOpGenericAdaptorBase::ExpandShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.expand_shape", odsAttrs.getContext()); +} + +ExpandShapeOpGenericAdaptorBase::ExpandShapeOpGenericAdaptorBase(ExpandShapeOp op) : ExpandShapeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExpandShapeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExpandShapeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr ExpandShapeOpGenericAdaptorBase::getReassociationAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().reassociation); + return attr; +} + +::mlir::ArrayAttr ExpandShapeOpGenericAdaptorBase::getReassociation() { + auto attr = getReassociationAttr(); + return attr; +} + +} // namespace detail +ExpandShapeOpAdaptor::ExpandShapeOpAdaptor(ExpandShapeOp op) : ExpandShapeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExpandShapeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_reassociation = getProperties().reassociation; (void)tblgen_reassociation; + if (!tblgen_reassociation) return emitError(loc, "'memref.expand_shape' op ""requires attribute 'reassociation'"); + + if (tblgen_reassociation && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reassociation))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reassociation), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); }))); })))) + return emitError(loc, "'memref.expand_shape' op ""attribute 'reassociation' failed to satisfy constraint: Array of 64-bit integer array attributes"); + return ::mlir::success(); +} + +std::pair ExpandShapeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExpandShapeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> ExpandShapeOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExpandShapeOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExpandShapeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExpandShapeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> ExpandShapeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ExpandShapeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.reassociation; + auto attr = dict.get("reassociation"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for reassociation in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reassociation` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ExpandShapeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.reassociation; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reassociation", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExpandShapeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.reassociation.getAsOpaquePointer())); +} + +std::optional ExpandShapeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "reassociation") + return prop.reassociation; + return std::nullopt; +} + +void ExpandShapeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "reassociation") { + prop.reassociation = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ExpandShapeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.reassociation) attrs.append("reassociation", prop.reassociation); +} + +::mlir::LogicalResult ExpandShapeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getReassociationAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps4(attr, "reassociation", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpandShapeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.reassociation))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpandShapeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.reassociation); +} + +::mlir::ArrayAttr ExpandShapeOp::getReassociationAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().reassociation); +} + +::mlir::ArrayAttr ExpandShapeOp::getReassociation() { + auto attr = getReassociationAttr(); + return attr; +} + +void ExpandShapeOp::setReassociationAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReassociationAttrName(), attr); +} + +void ExpandShapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value src, ArrayRef reassociation, ArrayRef attrs) { + build(odsBuilder, odsState, resultType, src, attrs); + odsState.addAttribute("reassociation", + getReassociationIndicesAttribute(odsBuilder, reassociation)); + +} + +void ExpandShapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value src, ArrayRef reassociation, ArrayRef attrs) { + auto reassociationMaps = + convertReassociationMapsToIndices(odsBuilder, reassociation); + build(odsBuilder, odsState, resultType, src, reassociationMaps, attrs); + +} + +void ExpandShapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::ArrayAttr reassociation) { + odsState.addOperands(src); + odsState.getOrAddProperties().reassociation = reassociation; + odsState.addTypes(result); +} + +void ExpandShapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ArrayAttr reassociation) { + odsState.addOperands(src); + odsState.getOrAddProperties().reassociation = reassociation; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExpandShapeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ExpandShapeOp::verifyInvariantsImpl() { + auto tblgen_reassociation = getProperties().reassociation; (void)tblgen_reassociation; + if (!tblgen_reassociation) return emitOpError("requires attribute 'reassociation'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps4(*this, tblgen_reassociation, "reassociation"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExpandShapeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ExpandShapeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(srcRawOperands); ::llvm::SMLoc srcOperandsLoc; + (void)srcOperandsLoc; + ::mlir::ArrayAttr reassociationAttr; + ::mlir::Type srcRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcTypes(srcRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + srcOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcRawOperands[0])) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(reassociationAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (reassociationAttr) result.getOrAddProperties().reassociation = reassociationAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcRawTypes[0] = type; + } + if (parser.parseKeyword("into")) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + result.addTypes(resultTypes); + if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExpandShapeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrc(); + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getReassociationAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("reassociation"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "into"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ExpandShapeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::ExpandShapeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ExtractAlignedPointerAsIndexOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExtractAlignedPointerAsIndexOpGenericAdaptorBase::ExtractAlignedPointerAsIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.extract_aligned_pointer_as_index", odsAttrs.getContext()); +} + +ExtractAlignedPointerAsIndexOpGenericAdaptorBase::ExtractAlignedPointerAsIndexOpGenericAdaptorBase(ExtractAlignedPointerAsIndexOp op) : ExtractAlignedPointerAsIndexOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExtractAlignedPointerAsIndexOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExtractAlignedPointerAsIndexOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ExtractAlignedPointerAsIndexOpAdaptor::ExtractAlignedPointerAsIndexOpAdaptor(ExtractAlignedPointerAsIndexOp op) : ExtractAlignedPointerAsIndexOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExtractAlignedPointerAsIndexOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ExtractAlignedPointerAsIndexOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExtractAlignedPointerAsIndexOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> ExtractAlignedPointerAsIndexOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExtractAlignedPointerAsIndexOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExtractAlignedPointerAsIndexOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExtractAlignedPointerAsIndexOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IndexType> ExtractAlignedPointerAsIndexOp::getAlignedPointer() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); +} + +void ExtractAlignedPointerAsIndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type aligned_pointer, ::mlir::Value source) { + odsState.addOperands(source); + odsState.addTypes(aligned_pointer); +} + +void ExtractAlignedPointerAsIndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source) { + odsState.addOperands(source); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExtractAlignedPointerAsIndexOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExtractAlignedPointerAsIndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source) { + odsState.addOperands(source); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtractAlignedPointerAsIndexOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ExtractAlignedPointerAsIndexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExtractAlignedPointerAsIndexOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ExtractAlignedPointerAsIndexOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtractAlignedPointerAsIndexOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult ExtractAlignedPointerAsIndexOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult ExtractAlignedPointerAsIndexOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseTypeList(allResultTypes)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addTypes(allResultTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtractAlignedPointerAsIndexOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getResultTypes(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ExtractAlignedPointerAsIndexOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::ExtractAlignedPointerAsIndexOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ExtractStridedMetadataOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExtractStridedMetadataOpGenericAdaptorBase::ExtractStridedMetadataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.extract_strided_metadata", odsAttrs.getContext()); +} + +ExtractStridedMetadataOpGenericAdaptorBase::ExtractStridedMetadataOpGenericAdaptorBase(ExtractStridedMetadataOp op) : ExtractStridedMetadataOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExtractStridedMetadataOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExtractStridedMetadataOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ExtractStridedMetadataOpAdaptor::ExtractStridedMetadataOpAdaptor(ExtractStridedMetadataOp op) : ExtractStridedMetadataOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExtractStridedMetadataOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ExtractStridedMetadataOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExtractStridedMetadataOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> ExtractStridedMetadataOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExtractStridedMetadataOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExtractStridedMetadataOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 2) / 2; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range ExtractStridedMetadataOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ExtractStridedMetadataOp::getBaseBuffer() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> ExtractStridedMetadataOp::getOffset() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(1).begin()); +} + +::mlir::Operation::result_range ExtractStridedMetadataOp::getSizes() { + return getODSResults(2); +} + +::mlir::Operation::result_range ExtractStridedMetadataOp::getStrides() { + return getODSResults(3); +} + +void ExtractStridedMetadataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type base_buffer, ::mlir::Type offset, ::mlir::TypeRange sizes, ::mlir::TypeRange strides, ::mlir::Value source) { + odsState.addOperands(source); + odsState.addTypes(base_buffer); + odsState.addTypes(offset); + odsState.addTypes(sizes); + odsState.addTypes(strides); +} + +void ExtractStridedMetadataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source) { + odsState.addOperands(source); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExtractStridedMetadataOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void ExtractStridedMetadataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source) { + odsState.addOperands(source); + assert(resultTypes.size() >= 2u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtractStridedMetadataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() >= 2u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ExtractStridedMetadataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(ExtractStridedMetadataOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() >= 2u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult ExtractStridedMetadataOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps8(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSResults(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSResults(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSResults(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtractStridedMetadataOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ExtractStridedMetadataOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseTypeList(allResultTypes)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addTypes(allResultTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtractStridedMetadataOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getResultTypes(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ExtractStridedMetadataOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::LogicalResult +ExtractStridedMetadataOp::inferReturnTypes(::mlir::MLIRContext *context, + std::optional<::mlir::Location> location, + ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, + ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, + ::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) { + ExtractStridedMetadataOp::Adaptor adaptor(operands, attributes, properties, regions); + return ExtractStridedMetadataOp::inferReturnTypes(context, + location, adaptor, inferredReturnTypes); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::ExtractStridedMetadataOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::GetGlobalOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetGlobalOpGenericAdaptorBase::GetGlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.get_global", odsAttrs.getContext()); +} + +GetGlobalOpGenericAdaptorBase::GetGlobalOpGenericAdaptorBase(GetGlobalOp op) : GetGlobalOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetGlobalOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetGlobalOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::FlatSymbolRefAttr GetGlobalOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().name); + return attr; +} + +::llvm::StringRef GetGlobalOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +} // namespace detail +GetGlobalOpAdaptor::GetGlobalOpAdaptor(GetGlobalOp op) : GetGlobalOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetGlobalOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitError(loc, "'memref.get_global' op ""requires attribute 'name'"); + + if (tblgen_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_name)))) + return emitError(loc, "'memref.get_global' op ""attribute 'name' failed to satisfy constraint: flat symbol reference attribute"); + return ::mlir::success(); +} + +std::pair GetGlobalOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetGlobalOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GetGlobalOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetGlobalOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> GetGlobalOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GetGlobalOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GetGlobalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GetGlobalOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.name.getAsOpaquePointer())); +} + +std::optional GetGlobalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "name") + return prop.name; + return std::nullopt; +} + +void GetGlobalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GetGlobalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.name) attrs.append("name", prop.name); +} + +::mlir::LogicalResult GetGlobalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps5(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetGlobalOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetGlobalOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.name); +} + +::mlir::FlatSymbolRefAttr GetGlobalOp::getNameAttr() { + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().name); +} + +::llvm::StringRef GetGlobalOp::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +void GetGlobalOp::setNameAttr(::mlir::FlatSymbolRefAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void GetGlobalOp::setName(::llvm::StringRef attrValue) { + (*this)->setAttr(getNameAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void GetGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::FlatSymbolRefAttr name) { + odsState.getOrAddProperties().name = name; + odsState.addTypes(result); +} + +void GetGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr name) { + odsState.getOrAddProperties().name = name; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef name) { + odsState.getOrAddProperties().name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), name); + odsState.addTypes(result); +} + +void GetGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name) { + odsState.getOrAddProperties().name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), name); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetGlobalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetGlobalOp::verifyInvariantsImpl() { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitOpError("requires attribute 'name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps5(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetGlobalOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetGlobalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::FlatSymbolRefAttr nameAttr; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addTypes(resultTypes); + return ::mlir::success(); +} + +void GetGlobalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("name"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetGlobalOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::GetGlobalOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::GlobalOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalOpGenericAdaptorBase::GlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.global", odsAttrs.getContext()); +} + +GlobalOpGenericAdaptorBase::GlobalOpGenericAdaptorBase(GlobalOp op) : GlobalOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr GlobalOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef GlobalOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::StringAttr GlobalOpGenericAdaptorBase::getSymVisibilityAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); + return attr; +} + +::std::optional< ::llvm::StringRef > GlobalOpGenericAdaptorBase::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::TypeAttr GlobalOpGenericAdaptorBase::getTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); + return attr; +} + +::mlir::MemRefType GlobalOpGenericAdaptorBase::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::MemRefType>(attr.getValue()); +} + +::mlir::Attribute GlobalOpGenericAdaptorBase::getInitialValueAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().initial_value); + return attr; +} + +::std::optional<::mlir::Attribute> GlobalOpGenericAdaptorBase::getInitialValue() { + auto attr = getInitialValueAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +::mlir::UnitAttr GlobalOpGenericAdaptorBase::getConstantAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().constant); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool GlobalOpGenericAdaptorBase::getConstant() { + auto attr = getConstantAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::IntegerAttr GlobalOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional GlobalOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +GlobalOpAdaptor::GlobalOpAdaptor(GlobalOp op) : GlobalOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_constant = getProperties().constant; (void)tblgen_constant; + auto tblgen_initial_value = getProperties().initial_value; (void)tblgen_initial_value; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'memref.global' op ""requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitError(loc, "'memref.global' op ""requires attribute 'type'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'memref.global' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_sym_visibility && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_visibility)))) + return emitError(loc, "'memref.global' op ""attribute 'sym_visibility' failed to satisfy constraint: string attribute"); + + if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::MemRefType>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) + return emitError(loc, "'memref.global' op ""attribute 'type' failed to satisfy constraint: memref type attribute"); + + if (tblgen_initial_value && !((true))) + return emitError(loc, "'memref.global' op ""attribute 'initial_value' failed to satisfy constraint: any attribute"); + + if (tblgen_constant && !((::llvm::isa<::mlir::UnitAttr>(tblgen_constant)))) + return emitError(loc, "'memref.global' op ""attribute 'constant' failed to satisfy constraint: unit attribute"); + + if (tblgen_alignment && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64))))) + return emitError(loc, "'memref.global' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair GlobalOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult GlobalOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.constant; + auto attr = dict.get("constant"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for constant in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `constant` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.initial_value; + auto attr = dict.get("initial_value"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for initial_value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `initial_value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_visibility; + auto attr = dict.get("sym_visibility"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for sym_visibility in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.type; + auto attr = dict.get("type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + { + const auto &propStorage = prop.constant; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("constant", + propStorage)); + } + + { + const auto &propStorage = prop.initial_value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("initial_value", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.sym_visibility; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_visibility", + propStorage)); + } + + { + const auto &propStorage = prop.type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("type", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer()), + llvm::hash_value(prop.constant.getAsOpaquePointer()), + llvm::hash_value(prop.initial_value.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.sym_visibility.getAsOpaquePointer()), + llvm::hash_value(prop.type.getAsOpaquePointer())); +} + +std::optional GlobalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + + if (name == "constant") + return prop.constant; + + if (name == "initial_value") + return prop.initial_value; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "sym_visibility") + return prop.sym_visibility; + + if (name == "type") + return prop.type; + return std::nullopt; +} + +void GlobalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "constant") { + prop.constant = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "initial_value") { + prop.initial_value = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_visibility") { + prop.sym_visibility = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "type") { + prop.type = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); + + if (prop.constant) attrs.append("constant", prop.constant); + + if (prop.initial_value) attrs.append("initial_value", prop.initial_value); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.sym_visibility) attrs.append("sym_visibility", prop.sym_visibility); + + if (prop.type) attrs.append("type", prop.type); +} + +::mlir::LogicalResult GlobalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps10(attr, "alignment", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getConstantAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps9(attr, "constant", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getInitialValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps8(attr, "initial_value", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps6(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymVisibilityAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps6(attr, "sym_visibility", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps7(attr, "type", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.constant))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.initial_value))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.sym_visibility))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.type))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alignment); + + writer.writeOptionalAttribute(prop.constant); + + writer.writeOptionalAttribute(prop.initial_value); + writer.writeAttribute(prop.sym_name); + + writer.writeOptionalAttribute(prop.sym_visibility); + writer.writeAttribute(prop.type); +} + +::mlir::StringAttr GlobalOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef GlobalOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::StringAttr GlobalOp::getSymVisibilityAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_visibility); +} + +::std::optional< ::llvm::StringRef > GlobalOp::getSymVisibility() { + auto attr = getSymVisibilityAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::TypeAttr GlobalOp::getTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); +} + +::mlir::MemRefType GlobalOp::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::MemRefType>(attr.getValue()); +} + +::mlir::Attribute GlobalOp::getInitialValueAttr() { + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().initial_value); +} + +::std::optional<::mlir::Attribute> GlobalOp::getInitialValue() { + auto attr = getInitialValueAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +::mlir::UnitAttr GlobalOp::getConstantAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().constant); +} + +bool GlobalOp::getConstant() { + auto attr = getConstantAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::IntegerAttr GlobalOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional GlobalOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void GlobalOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void GlobalOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void GlobalOp::setSymVisibilityAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymVisibilityAttrName(), attr); +} + +void GlobalOp::setSymVisibility(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSymVisibilityAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSymVisibilityAttrName()); +} + +void GlobalOp::setTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getTypeAttrName(), attr); +} + +void GlobalOp::setType(::mlir::MemRefType attrValue) { + (*this)->setAttr(getTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void GlobalOp::setInitialValueAttr(::mlir::Attribute attr) { + (*this)->setAttr(getInitialValueAttrName(), attr); +} + +void GlobalOp::setConstantAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getConstantAttrName(), attr); +} + +void GlobalOp::setConstant(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getConstantAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getConstantAttrName()); +} + +void GlobalOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void GlobalOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +::mlir::Attribute GlobalOp::removeSymVisibilityAttr() { + auto &attr = getProperties().sym_visibility; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeInitialValueAttr() { + auto &attr = getProperties().initial_value; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeConstantAttr() { + auto &attr = getProperties().constant; + attr = {}; + return attr; +} + +::mlir::Attribute GlobalOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr constant, /*optional*/::mlir::IntegerAttr alignment) { + odsState.getOrAddProperties().sym_name = sym_name; + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + odsState.getOrAddProperties().type = type; + if (initial_value) { + odsState.getOrAddProperties().initial_value = initial_value; + } + if (constant) { + odsState.getOrAddProperties().constant = constant; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr constant, /*optional*/::mlir::IntegerAttr alignment) { + odsState.getOrAddProperties().sym_name = sym_name; + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + odsState.getOrAddProperties().type = type; + if (initial_value) { + odsState.getOrAddProperties().initial_value = initial_value; + } + if (constant) { + odsState.getOrAddProperties().constant = constant; + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::MemRefType type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool constant, /*optional*/::mlir::IntegerAttr alignment) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + if (initial_value) { + odsState.getOrAddProperties().initial_value = initial_value; + } + if (constant) { + odsState.getOrAddProperties().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr); + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } +} + +void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::MemRefType type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool constant, /*optional*/::mlir::IntegerAttr alignment) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + if (sym_visibility) { + odsState.getOrAddProperties().sym_visibility = sym_visibility; + } + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + if (initial_value) { + odsState.getOrAddProperties().initial_value = initial_value; + } + if (constant) { + odsState.getOrAddProperties().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr); + } + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalOp::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + auto tblgen_constant = getProperties().constant; (void)tblgen_constant; + auto tblgen_initial_value = getProperties().initial_value; (void)tblgen_initial_value; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility; + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitOpError("requires attribute 'type'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps6(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps6(*this, tblgen_sym_visibility, "sym_visibility"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps7(*this, tblgen_type, "type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps8(*this, tblgen_initial_value, "initial_value"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps9(*this, tblgen_constant, "constant"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps10(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult GlobalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_visibilityAttr; + ::mlir::StringAttr sym_nameAttr; + ::mlir::TypeAttr typeAttr; + ::mlir::Attribute initial_valueAttr; + + ::mlir::OptionalParseResult parseResultsym_visibilityAttr = + parser.parseOptionalAttribute(sym_visibilityAttr, parser.getBuilder().getType<::mlir::NoneType>()); + if (parseResultsym_visibilityAttr.has_value() && failed(*parseResultsym_visibilityAttr)) + return ::mlir::failure(); + if (parseResultsym_visibilityAttr.has_value() && succeeded(*parseResultsym_visibilityAttr)) + if (sym_visibilityAttr) result.getOrAddProperties().sym_visibility = sym_visibilityAttr; + if (sym_visibilityAttr) { + } + if (::mlir::succeeded(parser.parseOptionalKeyword("constant"))) { + result.getOrAddProperties().constant = parser.getBuilder().getUnitAttr(); } + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + if (parser.parseColon()) + return ::mlir::failure(); + { + auto odsResult = parseGlobalMemrefOpTypeAndInitialValue(parser, typeAttr, initial_valueAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().type = typeAttr; + if (initial_valueAttr) + result.getOrAddProperties().initial_value = initial_valueAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void GlobalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getSymVisibilityAttr()) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getSymVisibilityAttr()); + } + if (getConstantAttr()) { + _odsPrinter << ' ' << "constant"; + } + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + printGlobalMemrefOpTypeAndInitialValue(_odsPrinter, *this, getTypeAttr(), getInitialValueAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_visibility"); + elidedAttrs.push_back("constant"); + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("type"); + elidedAttrs.push_back("initial_value"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getConstantAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("constant"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::GlobalOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::MemorySpaceCastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MemorySpaceCastOpGenericAdaptorBase::MemorySpaceCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.memory_space_cast", odsAttrs.getContext()); +} + +MemorySpaceCastOpGenericAdaptorBase::MemorySpaceCastOpGenericAdaptorBase(MemorySpaceCastOp op) : MemorySpaceCastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MemorySpaceCastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MemorySpaceCastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MemorySpaceCastOpAdaptor::MemorySpaceCastOpAdaptor(MemorySpaceCastOp op) : MemorySpaceCastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MemorySpaceCastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MemorySpaceCastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MemorySpaceCastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> MemorySpaceCastOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &MemorySpaceCastOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair MemorySpaceCastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MemorySpaceCastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> MemorySpaceCastOp::getDest() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSResults(0).begin()); +} + +void MemorySpaceCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dest, ::mlir::Value source) { + odsState.addOperands(source); + odsState.addTypes(dest); +} + +void MemorySpaceCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source) { + odsState.addOperands(source); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MemorySpaceCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MemorySpaceCastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MemorySpaceCastOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MemorySpaceCastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::mlir::Type destRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> destTypes(destRawTypes); + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + destRawTypes[0] = type; + } + result.addTypes(destTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MemorySpaceCastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getDest().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MemorySpaceCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::MemorySpaceCastOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::PrefetchOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PrefetchOpGenericAdaptorBase::PrefetchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.prefetch", odsAttrs.getContext()); +} + +PrefetchOpGenericAdaptorBase::PrefetchOpGenericAdaptorBase(PrefetchOp op) : PrefetchOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PrefetchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr PrefetchOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr PrefetchOpGenericAdaptorBase::getIsWriteAttr() { + auto attr = ::llvm::cast<::mlir::BoolAttr>(getProperties().isWrite); + return attr; +} + +bool PrefetchOpGenericAdaptorBase::getIsWrite() { + auto attr = getIsWriteAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr PrefetchOpGenericAdaptorBase::getLocalityHintAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().localityHint); + return attr; +} + +uint32_t PrefetchOpGenericAdaptorBase::getLocalityHint() { + auto attr = getLocalityHintAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::BoolAttr PrefetchOpGenericAdaptorBase::getIsDataCacheAttr() { + auto attr = ::llvm::cast<::mlir::BoolAttr>(getProperties().isDataCache); + return attr; +} + +bool PrefetchOpGenericAdaptorBase::getIsDataCache() { + auto attr = getIsDataCacheAttr(); + return attr.getValue(); +} + +} // namespace detail +PrefetchOpAdaptor::PrefetchOpAdaptor(PrefetchOp op) : PrefetchOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PrefetchOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_isDataCache = getProperties().isDataCache; (void)tblgen_isDataCache; + if (!tblgen_isDataCache) return emitError(loc, "'memref.prefetch' op ""requires attribute 'isDataCache'"); + auto tblgen_isWrite = getProperties().isWrite; (void)tblgen_isWrite; + if (!tblgen_isWrite) return emitError(loc, "'memref.prefetch' op ""requires attribute 'isWrite'"); + auto tblgen_localityHint = getProperties().localityHint; (void)tblgen_localityHint; + if (!tblgen_localityHint) return emitError(loc, "'memref.prefetch' op ""requires attribute 'localityHint'"); + + if (tblgen_isWrite && !((::llvm::isa<::mlir::BoolAttr>(tblgen_isWrite)))) + return emitError(loc, "'memref.prefetch' op ""attribute 'isWrite' failed to satisfy constraint: bool attribute"); + + if (tblgen_localityHint && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_localityHint))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_localityHint).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_localityHint).getInt() >= 0)) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_localityHint).getInt() <= 3)))) + return emitError(loc, "'memref.prefetch' op ""attribute 'localityHint' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 3"); + + if (tblgen_isDataCache && !((::llvm::isa<::mlir::BoolAttr>(tblgen_isDataCache)))) + return emitError(loc, "'memref.prefetch' op ""attribute 'isDataCache' failed to satisfy constraint: bool attribute"); + return ::mlir::success(); +} + +std::pair PrefetchOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range PrefetchOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> PrefetchOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range PrefetchOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &PrefetchOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange PrefetchOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair PrefetchOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PrefetchOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult PrefetchOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.isDataCache; + auto attr = dict.get("isDataCache"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isDataCache in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isDataCache` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.isWrite; + auto attr = dict.get("isWrite"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for isWrite in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isWrite` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.localityHint; + auto attr = dict.get("localityHint"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for localityHint in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `localityHint` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute PrefetchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.isDataCache; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isDataCache", + propStorage)); + } + + { + const auto &propStorage = prop.isWrite; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isWrite", + propStorage)); + } + + { + const auto &propStorage = prop.localityHint; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("localityHint", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PrefetchOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.isDataCache.getAsOpaquePointer()), + llvm::hash_value(prop.isWrite.getAsOpaquePointer()), + llvm::hash_value(prop.localityHint.getAsOpaquePointer())); +} + +std::optional PrefetchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "isDataCache") + return prop.isDataCache; + + if (name == "isWrite") + return prop.isWrite; + + if (name == "localityHint") + return prop.localityHint; + return std::nullopt; +} + +void PrefetchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "isDataCache") { + prop.isDataCache = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "isWrite") { + prop.isWrite = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "localityHint") { + prop.localityHint = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void PrefetchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.isDataCache) attrs.append("isDataCache", prop.isDataCache); + + if (prop.isWrite) attrs.append("isWrite", prop.isWrite); + + if (prop.localityHint) attrs.append("localityHint", prop.localityHint); +} + +::mlir::LogicalResult PrefetchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIsDataCacheAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps2(attr, "isDataCache", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIsWriteAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps2(attr, "isWrite", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getLocalityHintAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps11(attr, "localityHint", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PrefetchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.isDataCache))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.isWrite))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.localityHint))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PrefetchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.isDataCache); + writer.writeAttribute(prop.isWrite); + writer.writeAttribute(prop.localityHint); +} + +::mlir::BoolAttr PrefetchOp::getIsWriteAttr() { + return ::llvm::cast<::mlir::BoolAttr>(getProperties().isWrite); +} + +bool PrefetchOp::getIsWrite() { + auto attr = getIsWriteAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr PrefetchOp::getLocalityHintAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().localityHint); +} + +uint32_t PrefetchOp::getLocalityHint() { + auto attr = getLocalityHintAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::BoolAttr PrefetchOp::getIsDataCacheAttr() { + return ::llvm::cast<::mlir::BoolAttr>(getProperties().isDataCache); +} + +bool PrefetchOp::getIsDataCache() { + auto attr = getIsDataCacheAttr(); + return attr.getValue(); +} + +void PrefetchOp::setIsWriteAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getIsWriteAttrName(), attr); +} + +void PrefetchOp::setIsWrite(bool attrValue) { + (*this)->setAttr(getIsWriteAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void PrefetchOp::setLocalityHintAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getLocalityHintAttrName(), attr); +} + +void PrefetchOp::setLocalityHint(uint32_t attrValue) { + (*this)->setAttr(getLocalityHintAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void PrefetchOp::setIsDataCacheAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getIsDataCacheAttrName(), attr); +} + +void PrefetchOp::setIsDataCache(bool attrValue) { + (*this)->setAttr(getIsDataCacheAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void PrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr isWrite, ::mlir::IntegerAttr localityHint, ::mlir::BoolAttr isDataCache) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().isWrite = isWrite; + odsState.getOrAddProperties().localityHint = localityHint; + odsState.getOrAddProperties().isDataCache = isDataCache; +} + +void PrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr isWrite, ::mlir::IntegerAttr localityHint, ::mlir::BoolAttr isDataCache) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().isWrite = isWrite; + odsState.getOrAddProperties().localityHint = localityHint; + odsState.getOrAddProperties().isDataCache = isDataCache; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, bool isWrite, uint32_t localityHint, bool isDataCache) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().isWrite = odsBuilder.getBoolAttr(isWrite); + odsState.getOrAddProperties().localityHint = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), localityHint); + odsState.getOrAddProperties().isDataCache = odsBuilder.getBoolAttr(isDataCache); +} + +void PrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, bool isWrite, uint32_t localityHint, bool isDataCache) { + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().isWrite = odsBuilder.getBoolAttr(isWrite); + odsState.getOrAddProperties().localityHint = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), localityHint); + odsState.getOrAddProperties().isDataCache = odsBuilder.getBoolAttr(isDataCache); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PrefetchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult PrefetchOp::verifyInvariantsImpl() { + auto tblgen_isDataCache = getProperties().isDataCache; (void)tblgen_isDataCache; + if (!tblgen_isDataCache) return emitOpError("requires attribute 'isDataCache'"); + auto tblgen_isWrite = getProperties().isWrite; (void)tblgen_isWrite; + if (!tblgen_isWrite) return emitOpError("requires attribute 'isWrite'"); + auto tblgen_localityHint = getProperties().localityHint; (void)tblgen_localityHint; + if (!tblgen_localityHint) return emitOpError("requires attribute 'localityHint'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps2(*this, tblgen_isWrite, "isWrite"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps11(*this, tblgen_localityHint, "localityHint"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps2(*this, tblgen_isDataCache, "isDataCache"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PrefetchOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::PrefetchOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::RankOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RankOpGenericAdaptorBase::RankOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.rank", odsAttrs.getContext()); +} + +RankOpGenericAdaptorBase::RankOpGenericAdaptorBase(RankOp op) : RankOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RankOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RankOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RankOpAdaptor::RankOpAdaptor(RankOp op) : RankOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RankOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RankOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RankOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> RankOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &RankOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair RankOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RankOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void RankOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value memref) { + odsState.addOperands(memref); + odsState.addTypes(resultType0); +} + +void RankOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref) { + odsState.addOperands(memref); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RankOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, odsState.operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) + odsState.addTypes(inferredReturnTypes); + else + ::llvm::report_fatal_error("Failed to infer result type(s)."); +} + +void RankOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref) { + odsState.addOperands(memref); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RankOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void RankOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + + ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes; + if (::mlir::succeeded(RankOp::inferReturnTypes(odsBuilder.getContext(), + odsState.location, operands, + odsState.attributes.getDictionary(odsState.getContext()), + odsState.getRawProperties(), + odsState.regions, inferredReturnTypes))) { + assert(inferredReturnTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(inferredReturnTypes); + } else { + ::llvm::report_fatal_error("Failed to infer result type(s)."); + } +} + +::mlir::LogicalResult RankOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RankOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::LogicalResult RankOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) { + inferredReturnTypes.resize(1); + ::mlir::Builder odsBuilder(context); + ::mlir::Type odsInferredType0 = odsBuilder.getIndexType(); + inferredReturnTypes[0] = odsInferredType0; + return ::mlir::success(); +} + +::mlir::ParseResult RankOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RankOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getMemref(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void RankOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::RankOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ReallocOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReallocOpGenericAdaptorBase::ReallocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.realloc", odsAttrs.getContext()); +} + +ReallocOpGenericAdaptorBase::ReallocOpGenericAdaptorBase(ReallocOp op) : ReallocOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReallocOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ReallocOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr ReallocOpGenericAdaptorBase::getAlignmentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); + return attr; +} + +::std::optional ReallocOpGenericAdaptorBase::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +ReallocOpAdaptor::ReallocOpAdaptor(ReallocOp op) : ReallocOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReallocOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + + if (tblgen_alignment && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_alignment))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_alignment).getInt() >= 0)))) + return emitError(loc, "'memref.realloc' op ""attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"); + return ::mlir::success(); +} + +std::pair ReallocOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ReallocOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> ReallocOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> ReallocOp::getDynamicResultSize() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::IndexType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*operands.begin()); +} + +::mlir::OpOperand &ReallocOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange ReallocOp::getDynamicResultSizeMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ReallocOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReallocOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult ReallocOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment; + auto attr = dict.get("alignment"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ReallocOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ReallocOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.alignment.getAsOpaquePointer())); +} + +std::optional ReallocOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment") + return prop.alignment; + return std::nullopt; +} + +void ReallocOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment") { + prop.alignment = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ReallocOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment) attrs.append("alignment", prop.alignment); +} + +::mlir::LogicalResult ReallocOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps3(attr, "alignment", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReallocOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReallocOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alignment); +} + +::mlir::IntegerAttr ReallocOp::getAlignmentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().alignment); +} + +::std::optional ReallocOp::getAlignment() { + auto attr = getAlignmentAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void ReallocOp::setAlignmentAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getAlignmentAttrName(), attr); +} + +void ReallocOp::setAlignment(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getAlignmentAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getAlignmentAttrName()); +} + +::mlir::Attribute ReallocOp::removeAlignmentAttr() { + auto &attr = getProperties().alignment; + attr = {}; + return attr; +} + +void ReallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value source, Value dynamicResultSize) { + return build(odsBuilder, odsState, resultType, source, dynamicResultSize, + IntegerAttr()); + +} + +void ReallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value source, /*optional*/::mlir::Value dynamicResultSize, /*optional*/::mlir::IntegerAttr alignment) { + odsState.addOperands(source); + if (dynamicResultSize) + odsState.addOperands(dynamicResultSize); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + odsState.addTypes(resultType0); +} + +void ReallocOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::Value dynamicResultSize, /*optional*/::mlir::IntegerAttr alignment) { + odsState.addOperands(source); + if (dynamicResultSize) + odsState.addOperands(dynamicResultSize); + if (alignment) { + odsState.getOrAddProperties().alignment = alignment; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReallocOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReallocOp::verifyInvariantsImpl() { + auto tblgen_alignment = getProperties().alignment; (void)tblgen_alignment; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps3(*this, tblgen_alignment, "alignment"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReallocOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReallocOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dynamicResultSizeOperands; + ::llvm::SMLoc dynamicResultSizeOperandsLoc; + (void)dynamicResultSizeOperandsLoc; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + { + dynamicResultSizeOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + dynamicResultSizeOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + if (parser.parseTypeList(allResultTypes)) + return ::mlir::failure(); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dynamicResultSizeOperands, odsBuildableType0, dynamicResultSizeOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReallocOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + if (getDynamicResultSize()) { + _odsPrinter << "("; + if (::mlir::Value value = getDynamicResultSize()) + _odsPrinter << value; + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getResultTypes(); +} + +void ReallocOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Free::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSResults(0)) + effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), value, 1, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::ReallocOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ReinterpretCastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReinterpretCastOpGenericAdaptorBase::ReinterpretCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.reinterpret_cast", odsAttrs.getContext()); +} + +ReinterpretCastOpGenericAdaptorBase::ReinterpretCastOpGenericAdaptorBase(ReinterpretCastOp op) : ReinterpretCastOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReinterpretCastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ReinterpretCastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI64ArrayAttr ReinterpretCastOpGenericAdaptorBase::getStaticOffsetsAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_offsets); + return attr; +} + +::llvm::ArrayRef ReinterpretCastOpGenericAdaptorBase::getStaticOffsets() { + auto attr = getStaticOffsetsAttr(); + return attr; +} + +::mlir::DenseI64ArrayAttr ReinterpretCastOpGenericAdaptorBase::getStaticSizesAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_sizes); + return attr; +} + +::llvm::ArrayRef ReinterpretCastOpGenericAdaptorBase::getStaticSizes() { + auto attr = getStaticSizesAttr(); + return attr; +} + +::mlir::DenseI64ArrayAttr ReinterpretCastOpGenericAdaptorBase::getStaticStridesAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_strides); + return attr; +} + +::llvm::ArrayRef ReinterpretCastOpGenericAdaptorBase::getStaticStrides() { + auto attr = getStaticStridesAttr(); + return attr; +} + +} // namespace detail +ReinterpretCastOpAdaptor::ReinterpretCastOpAdaptor(ReinterpretCastOp op) : ReinterpretCastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReinterpretCastOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_static_offsets = getProperties().static_offsets; (void)tblgen_static_offsets; + if (!tblgen_static_offsets) return emitError(loc, "'memref.reinterpret_cast' op ""requires attribute 'static_offsets'"); + auto tblgen_static_sizes = getProperties().static_sizes; (void)tblgen_static_sizes; + if (!tblgen_static_sizes) return emitError(loc, "'memref.reinterpret_cast' op ""requires attribute 'static_sizes'"); + auto tblgen_static_strides = getProperties().static_strides; (void)tblgen_static_strides; + if (!tblgen_static_strides) return emitError(loc, "'memref.reinterpret_cast' op ""requires attribute 'static_strides'"); + + if (tblgen_static_offsets && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_static_offsets)))) + return emitError(loc, "'memref.reinterpret_cast' op ""attribute 'static_offsets' failed to satisfy constraint: i64 dense array attribute"); + + if (tblgen_static_sizes && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_static_sizes)))) + return emitError(loc, "'memref.reinterpret_cast' op ""attribute 'static_sizes' failed to satisfy constraint: i64 dense array attribute"); + + if (tblgen_static_strides && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_static_strides)))) + return emitError(loc, "'memref.reinterpret_cast' op ""attribute 'static_strides' failed to satisfy constraint: i64 dense array attribute"); + return ::mlir::success(); +} + +std::pair ReinterpretCastOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ReinterpretCastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> ReinterpretCastOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range ReinterpretCastOp::getOffsets() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range ReinterpretCastOp::getSizes() { + return getODSOperands(2); +} + +::mlir::Operation::operand_range ReinterpretCastOp::getStrides() { + return getODSOperands(3); +} + +::mlir::OpOperand &ReinterpretCastOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange ReinterpretCastOp::getOffsetsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ReinterpretCastOp::getSizesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ReinterpretCastOp::getStridesMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ReinterpretCastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReinterpretCastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> ReinterpretCastOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ReinterpretCastOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.static_offsets; + auto attr = dict.get("static_offsets"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for static_offsets in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `static_offsets` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.static_sizes; + auto attr = dict.get("static_sizes"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for static_sizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `static_sizes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.static_strides; + auto attr = dict.get("static_strides"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for static_strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `static_strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ReinterpretCastOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.static_offsets; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("static_offsets", + propStorage)); + } + + { + const auto &propStorage = prop.static_sizes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("static_sizes", + propStorage)); + } + + { + const auto &propStorage = prop.static_strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("static_strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ReinterpretCastOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.static_offsets.getAsOpaquePointer()), + llvm::hash_value(prop.static_sizes.getAsOpaquePointer()), + llvm::hash_value(prop.static_strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ReinterpretCastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "static_offsets") + return prop.static_offsets; + + if (name == "static_sizes") + return prop.static_sizes; + + if (name == "static_strides") + return prop.static_strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ReinterpretCastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "static_offsets") { + prop.static_offsets = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "static_sizes") { + prop.static_sizes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "static_strides") { + prop.static_strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ReinterpretCastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.static_offsets) attrs.append("static_offsets", prop.static_offsets); + + if (prop.static_sizes) attrs.append("static_sizes", prop.static_sizes); + + if (prop.static_strides) attrs.append("static_strides", prop.static_strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ReinterpretCastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getStaticOffsetsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(attr, "static_offsets", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStaticSizesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(attr, "static_sizes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStaticStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(attr, "static_strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReinterpretCastOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.static_offsets))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.static_sizes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.static_strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ReinterpretCastOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.static_offsets); + writer.writeAttribute(prop.static_sizes); + writer.writeAttribute(prop.static_strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseI64ArrayAttr ReinterpretCastOp::getStaticOffsetsAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_offsets); +} + +::llvm::ArrayRef ReinterpretCastOp::getStaticOffsets() { + auto attr = getStaticOffsetsAttr(); + return attr; +} + +::mlir::DenseI64ArrayAttr ReinterpretCastOp::getStaticSizesAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_sizes); +} + +::llvm::ArrayRef ReinterpretCastOp::getStaticSizes() { + auto attr = getStaticSizesAttr(); + return attr; +} + +::mlir::DenseI64ArrayAttr ReinterpretCastOp::getStaticStridesAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_strides); +} + +::llvm::ArrayRef ReinterpretCastOp::getStaticStrides() { + auto attr = getStaticStridesAttr(); + return attr; +} + +void ReinterpretCastOp::setStaticOffsetsAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getStaticOffsetsAttrName(), attr); +} + +void ReinterpretCastOp::setStaticOffsets(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getStaticOffsetsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +void ReinterpretCastOp::setStaticSizesAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getStaticSizesAttrName(), attr); +} + +void ReinterpretCastOp::setStaticSizes(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getStaticSizesAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +void ReinterpretCastOp::setStaticStridesAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getStaticStridesAttrName(), attr); +} + +void ReinterpretCastOp::setStaticStrides(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getStaticStridesAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +void ReinterpretCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::mlir::DenseI64ArrayAttr static_offsets, ::mlir::DenseI64ArrayAttr static_sizes, ::mlir::DenseI64ArrayAttr static_strides) { + odsState.addOperands(source); + odsState.addOperands(offsets); + odsState.addOperands(sizes); + odsState.addOperands(strides); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(offsets.size()), static_cast(sizes.size()), static_cast(strides.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().static_offsets = static_offsets; + odsState.getOrAddProperties().static_sizes = static_sizes; + odsState.getOrAddProperties().static_strides = static_strides; + odsState.addTypes(result); +} + +void ReinterpretCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::mlir::DenseI64ArrayAttr static_offsets, ::mlir::DenseI64ArrayAttr static_sizes, ::mlir::DenseI64ArrayAttr static_strides) { + odsState.addOperands(source); + odsState.addOperands(offsets); + odsState.addOperands(sizes); + odsState.addOperands(strides); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(offsets.size()), static_cast(sizes.size()), static_cast(strides.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().static_offsets = static_offsets; + odsState.getOrAddProperties().static_sizes = static_sizes; + odsState.getOrAddProperties().static_strides = static_strides; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReinterpretCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::llvm::ArrayRef static_offsets, ::llvm::ArrayRef static_sizes, ::llvm::ArrayRef static_strides) { + odsState.addOperands(source); + odsState.addOperands(offsets); + odsState.addOperands(sizes); + odsState.addOperands(strides); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(offsets.size()), static_cast(sizes.size()), static_cast(strides.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().static_offsets = odsBuilder.getDenseI64ArrayAttr(static_offsets); + odsState.getOrAddProperties().static_sizes = odsBuilder.getDenseI64ArrayAttr(static_sizes); + odsState.getOrAddProperties().static_strides = odsBuilder.getDenseI64ArrayAttr(static_strides); + odsState.addTypes(result); +} + +void ReinterpretCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::llvm::ArrayRef static_offsets, ::llvm::ArrayRef static_sizes, ::llvm::ArrayRef static_strides) { + odsState.addOperands(source); + odsState.addOperands(offsets); + odsState.addOperands(sizes); + odsState.addOperands(strides); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(offsets.size()), static_cast(sizes.size()), static_cast(strides.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().static_offsets = odsBuilder.getDenseI64ArrayAttr(static_offsets); + odsState.getOrAddProperties().static_sizes = odsBuilder.getDenseI64ArrayAttr(static_sizes); + odsState.getOrAddProperties().static_strides = odsBuilder.getDenseI64ArrayAttr(static_strides); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReinterpretCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReinterpretCastOp::verifyInvariantsImpl() { + auto tblgen_static_offsets = getProperties().static_offsets; (void)tblgen_static_offsets; + if (!tblgen_static_offsets) return emitOpError("requires attribute 'static_offsets'"); + auto tblgen_static_sizes = getProperties().static_sizes; (void)tblgen_static_sizes; + if (!tblgen_static_sizes) return emitOpError("requires attribute 'static_sizes'"); + auto tblgen_static_strides = getProperties().static_strides; (void)tblgen_static_strides; + if (!tblgen_static_strides) return emitOpError("requires attribute 'static_strides'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(*this, tblgen_static_offsets, "static_offsets"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(*this, tblgen_static_sizes, "static_sizes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(*this, tblgen_static_strides, "static_strides"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReinterpretCastOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReinterpretCastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> offsetsOperands; + ::llvm::SMLoc offsetsOperandsLoc; + (void)offsetsOperandsLoc; + ::mlir::DenseI64ArrayAttr static_offsetsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sizesOperands; + ::llvm::SMLoc sizesOperandsLoc; + (void)sizesOperandsLoc; + ::mlir::DenseI64ArrayAttr static_sizesAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> stridesOperands; + ::llvm::SMLoc stridesOperandsLoc; + (void)stridesOperandsLoc; + ::mlir::DenseI64ArrayAttr static_stridesAttr; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + if (parser.parseKeyword("offset")) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + { + offsetsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseDynamicIndexList(parser, offsetsOperands, static_offsetsAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().static_offsets = static_offsetsAttr; + } + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseKeyword("sizes")) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + { + sizesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseDynamicIndexList(parser, sizesOperands, static_sizesAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().static_sizes = static_sizesAttr; + } + if (parser.parseComma()) + return ::mlir::failure(); + if (parser.parseKeyword("strides")) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + { + stridesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseDynamicIndexList(parser, stridesOperands, static_stridesAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().static_strides = static_stridesAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(offsetsOperands.size()), static_cast(sizesOperands.size()), static_cast(stridesOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resultTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(offsetsOperands, odsBuildableType0, offsetsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sizesOperands, odsBuildableType0, sizesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(stridesOperands, odsBuildableType0, stridesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReinterpretCastOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << ' ' << "to"; + _odsPrinter << ' ' << "offset"; + _odsPrinter << ":"; + _odsPrinter << ' '; + printDynamicIndexList(_odsPrinter, *this, getOffsets(), getStaticOffsetsAttr()); + _odsPrinter << ","; + _odsPrinter << ' ' << "sizes"; + _odsPrinter << ":"; + _odsPrinter << ' '; + printDynamicIndexList(_odsPrinter, *this, getSizes(), getStaticSizesAttr()); + _odsPrinter << ","; + _odsPrinter << ' ' << "strides"; + _odsPrinter << ":"; + _odsPrinter << ' '; + printDynamicIndexList(_odsPrinter, *this, getStrides(), getStaticStridesAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("static_offsets"); + elidedAttrs.push_back("static_sizes"); + elidedAttrs.push_back("static_strides"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void ReinterpretCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::ReinterpretCastOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ReshapeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReshapeOpGenericAdaptorBase::ReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.reshape", odsAttrs.getContext()); +} + +ReshapeOpGenericAdaptorBase::ReshapeOpGenericAdaptorBase(ReshapeOp op) : ReshapeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReshapeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ReshapeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ReshapeOpAdaptor::ReshapeOpAdaptor(ReshapeOp op) : ReshapeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReshapeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ReshapeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ReshapeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> ReshapeOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> ReshapeOp::getShape() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ReshapeOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ReshapeOp::getShapeMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ReshapeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReshapeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::BaseMemRefType> ReshapeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSResults(0).begin()); +} + +void ReshapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value operand, Value shape) { + odsState.addOperands(operand); + odsState.addOperands(shape); + odsState.addTypes(resultType); + +} + +void ReshapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::Value shape) { + odsState.addOperands(source); + odsState.addOperands(shape); + odsState.addTypes(result); +} + +void ReshapeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value shape) { + odsState.addOperands(source); + odsState.addOperands(shape); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReshapeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReshapeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReshapeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReshapeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand shapeRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> shapeOperands(shapeRawOperands); ::llvm::SMLoc shapeOperandsLoc; + (void)shapeOperandsLoc; + ::llvm::ArrayRef<::mlir::Type> allOperandTypes; + ::llvm::ArrayRef<::mlir::Type> allResultTypes; + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + shapeOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(shapeRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + ::mlir::FunctionType allOperand__allResult_functionType; + if (parser.parseType(allOperand__allResult_functionType)) + return ::mlir::failure(); + allOperandTypes = allOperand__allResult_functionType.getInputs(); + allResultTypes = allOperand__allResult_functionType.getResults(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(::llvm::concat(sourceOperands, shapeOperands), allOperandTypes, parser.getNameLoc(), result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReshapeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << "("; + _odsPrinter << getShape(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes()); +} + +void ReshapeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::ReshapeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::StoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +StoreOpGenericAdaptorBase::StoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.store", odsAttrs.getContext()); +} + +StoreOpGenericAdaptorBase::StoreOpGenericAdaptorBase(StoreOp op) : StoreOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair StoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr StoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr StoreOpGenericAdaptorBase::getNontemporalAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().nontemporal); + if (!attr) + attr = ::mlir::Builder(odsAttrs.getContext()).getBoolAttr(false); + return attr; +} + +bool StoreOpGenericAdaptorBase::getNontemporal() { + auto attr = getNontemporalAttr(); + if (!attr) + return ::mlir::Builder(odsAttrs.getContext()).getBoolAttr(false).getValue(); + return attr.getValue(); +} + +} // namespace detail +StoreOpAdaptor::StoreOpAdaptor(StoreOp op) : StoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult StoreOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal; + + if (tblgen_nontemporal && !((::llvm::isa<::mlir::BoolAttr>(tblgen_nontemporal)))) + return emitError(loc, "'memref.store' op ""attribute 'nontemporal' failed to satisfy constraint: bool attribute"); + return ::mlir::success(); +} + +std::pair StoreOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range StoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value StoreOp::getValue() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::MemRefType> StoreOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range StoreOp::getIndices() { + return getODSOperands(2); +} + +::mlir::OpOperand &StoreOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &StoreOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange StoreOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair StoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range StoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult StoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.nontemporal; + auto attr = dict.get("nontemporal"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nontemporal in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nontemporal` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute StoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.nontemporal; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nontemporal", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code StoreOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.nontemporal.getAsOpaquePointer())); +} + +std::optional StoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "nontemporal") + return prop.nontemporal; + return std::nullopt; +} + +void StoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "nontemporal") { + prop.nontemporal = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void StoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.nontemporal) attrs.append("nontemporal", prop.nontemporal); +} + +::mlir::LogicalResult StoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNontemporalAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps2(attr, "nontemporal", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult StoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.nontemporal))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void StoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.nontemporal); +} + +::mlir::BoolAttr StoreOp::getNontemporalAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().nontemporal); +} + +bool StoreOp::getNontemporal() { + auto attr = getNontemporalAttr(); + if (!attr) + return ::mlir::Builder((*this)->getContext()).getBoolAttr(false).getValue(); + return attr.getValue(); +} + +void StoreOp::setNontemporalAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getNontemporalAttrName(), attr); +} + +void StoreOp::setNontemporal(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getNontemporalAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(*attrValue)); + (*this)->removeAttr(getNontemporalAttrName()); +} + +::mlir::Attribute StoreOp::removeNontemporalAttr() { + auto &attr = getProperties().nontemporal; + attr = {}; + return attr; +} + +void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value valueToStore, Value memref) { + odsState.addOperands(valueToStore); + odsState.addOperands(memref); + +} + +void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = nontemporal; + } +} + +void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + if (nontemporal) { + odsState.getOrAddProperties().nontemporal = nontemporal; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().nontemporal = odsBuilder.getBoolAttr(nontemporal); +} + +void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal) { + odsState.addOperands(value); + odsState.addOperands(memref); + odsState.addOperands(indices); + odsState.getOrAddProperties().nontemporal = odsBuilder.getBoolAttr(nontemporal); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult StoreOp::verifyInvariantsImpl() { + auto tblgen_nontemporal = getProperties().nontemporal; (void)tblgen_nontemporal; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps2(*this, tblgen_nontemporal, "nontemporal"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(::llvm::cast((*this->getODSOperands(1).begin()).getType()).getElementType(), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that type of 'value' matches element type of 'memref'"); + return ::mlir::success(); +} + +::mlir::LogicalResult StoreOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult StoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + for (::mlir::Type type : memrefTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return parser.emitError(parser.getNameLoc()) << "'memref' must be memref of any type values, but got " << type; + } + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(valueOperands, ::llvm::cast(memrefTypes[0]).getElementType(), valueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void StoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNontemporalAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("nontemporal"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void StoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::StoreOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::TransposeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TransposeOpGenericAdaptorBase::TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.transpose", odsAttrs.getContext()); +} + +TransposeOpGenericAdaptorBase::TransposeOpGenericAdaptorBase(TransposeOp op) : TransposeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TransposeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TransposeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::AffineMapAttr TransposeOpGenericAdaptorBase::getPermutationAttr() { + auto attr = ::llvm::cast<::mlir::AffineMapAttr>(getProperties().permutation); + return attr; +} + +::mlir::AffineMap TransposeOpGenericAdaptorBase::getPermutation() { + auto attr = getPermutationAttr(); + return attr.getValue(); +} + +} // namespace detail +TransposeOpAdaptor::TransposeOpAdaptor(TransposeOp op) : TransposeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TransposeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_permutation = getProperties().permutation; (void)tblgen_permutation; + if (!tblgen_permutation) return emitError(loc, "'memref.transpose' op ""requires attribute 'permutation'"); + + if (tblgen_permutation && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_permutation)))) + return emitError(loc, "'memref.transpose' op ""attribute 'permutation' failed to satisfy constraint: AffineMap attribute"); + return ::mlir::success(); +} + +std::pair TransposeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TransposeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> TransposeOp::getIn() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &TransposeOp::getInMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair TransposeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TransposeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult TransposeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.permutation; + auto attr = dict.get("permutation"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for permutation in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `permutation` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TransposeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.permutation; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("permutation", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TransposeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.permutation.getAsOpaquePointer())); +} + +std::optional TransposeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "permutation") + return prop.permutation; + return std::nullopt; +} + +void TransposeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "permutation") { + prop.permutation = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TransposeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.permutation) attrs.append("permutation", prop.permutation); +} + +::mlir::LogicalResult TransposeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getPermutationAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps13(attr, "permutation", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TransposeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.permutation))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TransposeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.permutation); +} + +::mlir::AffineMapAttr TransposeOp::getPermutationAttr() { + return ::llvm::cast<::mlir::AffineMapAttr>(getProperties().permutation); +} + +::mlir::AffineMap TransposeOp::getPermutation() { + auto attr = getPermutationAttr(); + return attr.getValue(); +} + +void TransposeOp::setPermutationAttr(::mlir::AffineMapAttr attr) { + (*this)->setAttr(getPermutationAttrName(), attr); +} + +void TransposeOp::setPermutation(::mlir::AffineMap attrValue) { + (*this)->setAttr(getPermutationAttrName(), ::mlir::AffineMapAttr::get(attrValue)); +} + +void TransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value in, ::mlir::AffineMapAttr permutation) { + odsState.addOperands(in); + odsState.getOrAddProperties().permutation = permutation; + odsState.addTypes(resultType0); +} + +void TransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::AffineMapAttr permutation) { + odsState.addOperands(in); + odsState.getOrAddProperties().permutation = permutation; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value in, ::mlir::AffineMap permutation) { + odsState.addOperands(in); + odsState.getOrAddProperties().permutation = ::mlir::AffineMapAttr::get(permutation); + odsState.addTypes(resultType0); +} + +void TransposeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::AffineMap permutation) { + odsState.addOperands(in); + odsState.getOrAddProperties().permutation = ::mlir::AffineMapAttr::get(permutation); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TransposeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TransposeOp::verifyInvariantsImpl() { + auto tblgen_permutation = getProperties().permutation; (void)tblgen_permutation; + if (!tblgen_permutation) return emitOpError("requires attribute 'permutation'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps13(*this, tblgen_permutation, "permutation"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TransposeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void TransposeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::TransposeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ViewOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ViewOpGenericAdaptorBase::ViewOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.view", odsAttrs.getContext()); +} + +ViewOpGenericAdaptorBase::ViewOpGenericAdaptorBase(ViewOp op) : ViewOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ViewOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ViewOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ViewOpAdaptor::ViewOpAdaptor(ViewOp op) : ViewOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ViewOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ViewOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ViewOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> ViewOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> ViewOp::getByteShift() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range ViewOp::getSizes() { + return getODSOperands(2); +} + +::mlir::OpOperand &ViewOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ViewOp::getByteShiftMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange ViewOp::getSizesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ViewOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ViewOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ViewOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value source, ::mlir::Value byte_shift, ::mlir::ValueRange sizes) { + odsState.addOperands(source); + odsState.addOperands(byte_shift); + odsState.addOperands(sizes); + odsState.addTypes(resultType0); +} + +void ViewOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value byte_shift, ::mlir::ValueRange sizes) { + odsState.addOperands(source); + odsState.addOperands(byte_shift); + odsState.addOperands(sizes); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ViewOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ViewOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps12(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ViewOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ViewOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand byte_shiftRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> byte_shiftOperands(byte_shiftRawOperands); ::llvm::SMLoc byte_shiftOperandsLoc; + (void)byte_shiftOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sizesOperands; + ::llvm::SMLoc sizesOperandsLoc; + (void)sizesOperandsLoc; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> allResultTypes; + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + byte_shiftOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(byte_shiftRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + sizesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(sizesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + if (parser.parseTypeList(allResultTypes)) + return ::mlir::failure(); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(allResultTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(byte_shiftOperands, odsBuildableType0, byte_shiftOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sizesOperands, odsBuildableType0, sizesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ViewOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + _odsPrinter << "["; + _odsPrinter << getByteShift(); + _odsPrinter << "]"; + _odsPrinter << "["; + _odsPrinter << getSizes(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + _odsPrinter << getOperation()->getResultTypes(); +} + +void ViewOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::ViewOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::SubViewOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SubViewOpGenericAdaptorBase::SubViewOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.subview", odsAttrs.getContext()); +} + +SubViewOpGenericAdaptorBase::SubViewOpGenericAdaptorBase(SubViewOp op) : SubViewOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SubViewOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SubViewOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseI64ArrayAttr SubViewOpGenericAdaptorBase::getStaticOffsetsAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_offsets); + return attr; +} + +::llvm::ArrayRef SubViewOpGenericAdaptorBase::getStaticOffsets() { + auto attr = getStaticOffsetsAttr(); + return attr; +} + +::mlir::DenseI64ArrayAttr SubViewOpGenericAdaptorBase::getStaticSizesAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_sizes); + return attr; +} + +::llvm::ArrayRef SubViewOpGenericAdaptorBase::getStaticSizes() { + auto attr = getStaticSizesAttr(); + return attr; +} + +::mlir::DenseI64ArrayAttr SubViewOpGenericAdaptorBase::getStaticStridesAttr() { + auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_strides); + return attr; +} + +::llvm::ArrayRef SubViewOpGenericAdaptorBase::getStaticStrides() { + auto attr = getStaticStridesAttr(); + return attr; +} + +} // namespace detail +SubViewOpAdaptor::SubViewOpAdaptor(SubViewOp op) : SubViewOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SubViewOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_static_offsets = getProperties().static_offsets; (void)tblgen_static_offsets; + if (!tblgen_static_offsets) return emitError(loc, "'memref.subview' op ""requires attribute 'static_offsets'"); + auto tblgen_static_sizes = getProperties().static_sizes; (void)tblgen_static_sizes; + if (!tblgen_static_sizes) return emitError(loc, "'memref.subview' op ""requires attribute 'static_sizes'"); + auto tblgen_static_strides = getProperties().static_strides; (void)tblgen_static_strides; + if (!tblgen_static_strides) return emitError(loc, "'memref.subview' op ""requires attribute 'static_strides'"); + + if (tblgen_static_offsets && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_static_offsets)))) + return emitError(loc, "'memref.subview' op ""attribute 'static_offsets' failed to satisfy constraint: i64 dense array attribute"); + + if (tblgen_static_sizes && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_static_sizes)))) + return emitError(loc, "'memref.subview' op ""attribute 'static_sizes' failed to satisfy constraint: i64 dense array attribute"); + + if (tblgen_static_strides && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_static_strides)))) + return emitError(loc, "'memref.subview' op ""attribute 'static_strides' failed to satisfy constraint: i64 dense array attribute"); + return ::mlir::success(); +} + +std::pair SubViewOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SubViewOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> SubViewOp::getSource() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range SubViewOp::getOffsets() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range SubViewOp::getSizes() { + return getODSOperands(2); +} + +::mlir::Operation::operand_range SubViewOp::getStrides() { + return getODSOperands(3); +} + +::mlir::OpOperand &SubViewOp::getSourceMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange SubViewOp::getOffsetsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SubViewOp::getSizesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SubViewOp::getStridesMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair SubViewOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SubViewOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> SubViewOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult SubViewOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.static_offsets; + auto attr = dict.get("static_offsets"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for static_offsets in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `static_offsets` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.static_sizes; + auto attr = dict.get("static_sizes"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for static_sizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `static_sizes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.static_strides; + auto attr = dict.get("static_strides"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for static_strides in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `static_strides` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SubViewOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.static_offsets; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("static_offsets", + propStorage)); + } + + { + const auto &propStorage = prop.static_sizes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("static_sizes", + propStorage)); + } + + { + const auto &propStorage = prop.static_strides; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("static_strides", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SubViewOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.static_offsets.getAsOpaquePointer()), + llvm::hash_value(prop.static_sizes.getAsOpaquePointer()), + llvm::hash_value(prop.static_strides.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SubViewOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "static_offsets") + return prop.static_offsets; + + if (name == "static_sizes") + return prop.static_sizes; + + if (name == "static_strides") + return prop.static_strides; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SubViewOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "static_offsets") { + prop.static_offsets = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "static_sizes") { + prop.static_sizes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "static_strides") { + prop.static_strides = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SubViewOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.static_offsets) attrs.append("static_offsets", prop.static_offsets); + + if (prop.static_sizes) attrs.append("static_sizes", prop.static_sizes); + + if (prop.static_strides) attrs.append("static_strides", prop.static_strides); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SubViewOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getStaticOffsetsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(attr, "static_offsets", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStaticSizesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(attr, "static_sizes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStaticStridesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(attr, "static_strides", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubViewOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.static_offsets))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.static_sizes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.static_strides))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SubViewOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.static_offsets); + writer.writeAttribute(prop.static_sizes); + writer.writeAttribute(prop.static_strides); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::DenseI64ArrayAttr SubViewOp::getStaticOffsetsAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_offsets); +} + +::llvm::ArrayRef SubViewOp::getStaticOffsets() { + auto attr = getStaticOffsetsAttr(); + return attr; +} + +::mlir::DenseI64ArrayAttr SubViewOp::getStaticSizesAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_sizes); +} + +::llvm::ArrayRef SubViewOp::getStaticSizes() { + auto attr = getStaticSizesAttr(); + return attr; +} + +::mlir::DenseI64ArrayAttr SubViewOp::getStaticStridesAttr() { + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().static_strides); +} + +::llvm::ArrayRef SubViewOp::getStaticStrides() { + auto attr = getStaticStridesAttr(); + return attr; +} + +void SubViewOp::setStaticOffsetsAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getStaticOffsetsAttrName(), attr); +} + +void SubViewOp::setStaticOffsets(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getStaticOffsetsAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +void SubViewOp::setStaticSizesAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getStaticSizesAttrName(), attr); +} + +void SubViewOp::setStaticSizes(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getStaticSizesAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +void SubViewOp::setStaticStridesAttr(::mlir::DenseI64ArrayAttr attr) { + (*this)->setAttr(getStaticStridesAttrName(), attr); +} + +void SubViewOp::setStaticStrides(::llvm::ArrayRef attrValue) { + (*this)->setAttr(getStaticStridesAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue)); +} + +void SubViewOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::mlir::DenseI64ArrayAttr static_offsets, ::mlir::DenseI64ArrayAttr static_sizes, ::mlir::DenseI64ArrayAttr static_strides) { + odsState.addOperands(source); + odsState.addOperands(offsets); + odsState.addOperands(sizes); + odsState.addOperands(strides); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(offsets.size()), static_cast(sizes.size()), static_cast(strides.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().static_offsets = static_offsets; + odsState.getOrAddProperties().static_sizes = static_sizes; + odsState.getOrAddProperties().static_strides = static_strides; + odsState.addTypes(result); +} + +void SubViewOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::mlir::DenseI64ArrayAttr static_offsets, ::mlir::DenseI64ArrayAttr static_sizes, ::mlir::DenseI64ArrayAttr static_strides) { + odsState.addOperands(source); + odsState.addOperands(offsets); + odsState.addOperands(sizes); + odsState.addOperands(strides); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(offsets.size()), static_cast(sizes.size()), static_cast(strides.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().static_offsets = static_offsets; + odsState.getOrAddProperties().static_sizes = static_sizes; + odsState.getOrAddProperties().static_strides = static_strides; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubViewOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::llvm::ArrayRef static_offsets, ::llvm::ArrayRef static_sizes, ::llvm::ArrayRef static_strides) { + odsState.addOperands(source); + odsState.addOperands(offsets); + odsState.addOperands(sizes); + odsState.addOperands(strides); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(offsets.size()), static_cast(sizes.size()), static_cast(strides.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().static_offsets = odsBuilder.getDenseI64ArrayAttr(static_offsets); + odsState.getOrAddProperties().static_sizes = odsBuilder.getDenseI64ArrayAttr(static_sizes); + odsState.getOrAddProperties().static_strides = odsBuilder.getDenseI64ArrayAttr(static_strides); + odsState.addTypes(result); +} + +void SubViewOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::llvm::ArrayRef static_offsets, ::llvm::ArrayRef static_sizes, ::llvm::ArrayRef static_strides) { + odsState.addOperands(source); + odsState.addOperands(offsets); + odsState.addOperands(sizes); + odsState.addOperands(strides); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(offsets.size()), static_cast(sizes.size()), static_cast(strides.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().static_offsets = odsBuilder.getDenseI64ArrayAttr(static_offsets); + odsState.getOrAddProperties().static_sizes = odsBuilder.getDenseI64ArrayAttr(static_sizes); + odsState.getOrAddProperties().static_strides = odsBuilder.getDenseI64ArrayAttr(static_strides); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SubViewOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SubViewOp::verifyInvariantsImpl() { + auto tblgen_static_offsets = getProperties().static_offsets; (void)tblgen_static_offsets; + if (!tblgen_static_offsets) return emitOpError("requires attribute 'static_offsets'"); + auto tblgen_static_sizes = getProperties().static_sizes; (void)tblgen_static_sizes; + if (!tblgen_static_sizes) return emitOpError("requires attribute 'static_sizes'"); + auto tblgen_static_strides = getProperties().static_strides; (void)tblgen_static_strides; + if (!tblgen_static_strides) return emitOpError("requires attribute 'static_strides'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(*this, tblgen_static_offsets, "static_offsets"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(*this, tblgen_static_sizes, "static_sizes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_MemRefOps12(*this, tblgen_static_strides, "static_strides"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SubViewOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SubViewOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sourceRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(sourceRawOperands); ::llvm::SMLoc sourceOperandsLoc; + (void)sourceOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> offsetsOperands; + ::llvm::SMLoc offsetsOperandsLoc; + (void)offsetsOperandsLoc; + ::mlir::DenseI64ArrayAttr static_offsetsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sizesOperands; + ::llvm::SMLoc sizesOperandsLoc; + (void)sizesOperandsLoc; + ::mlir::DenseI64ArrayAttr static_sizesAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> stridesOperands; + ::llvm::SMLoc stridesOperandsLoc; + (void)stridesOperandsLoc; + ::mlir::DenseI64ArrayAttr static_stridesAttr; + ::mlir::Type sourceRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sourceTypes(sourceRawTypes); + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + sourceOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sourceRawOperands[0])) + return ::mlir::failure(); + { + offsetsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseDynamicIndexList(parser, offsetsOperands, static_offsetsAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().static_offsets = static_offsetsAttr; + } + { + sizesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseDynamicIndexList(parser, sizesOperands, static_sizesAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().static_sizes = static_sizesAttr; + } + { + stridesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseDynamicIndexList(parser, stridesOperands, static_stridesAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().static_strides = static_stridesAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sourceRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(offsetsOperands.size()), static_cast(sizesOperands.size()), static_cast(stridesOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resultTypes); + if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(offsetsOperands, odsBuildableType0, offsetsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sizesOperands, odsBuildableType0, sizesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(stridesOperands, odsBuildableType0, stridesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SubViewOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSource(); + printDynamicIndexList(_odsPrinter, *this, getOffsets(), getStaticOffsetsAttr()); + _odsPrinter << ' '; + printDynamicIndexList(_odsPrinter, *this, getSizes(), getStaticSizesAttr()); + _odsPrinter << ' '; + printDynamicIndexList(_odsPrinter, *this, getStrides(), getStaticStridesAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("static_offsets"); + elidedAttrs.push_back("static_sizes"); + elidedAttrs.push_back("static_strides"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSource().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void SubViewOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::SubViewOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::TensorStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TensorStoreOpGenericAdaptorBase::TensorStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("memref.tensor_store", odsAttrs.getContext()); +} + +TensorStoreOpGenericAdaptorBase::TensorStoreOpGenericAdaptorBase(TensorStoreOp op) : TensorStoreOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TensorStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TensorStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TensorStoreOpAdaptor::TensorStoreOpAdaptor(TensorStoreOp op) : TensorStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TensorStoreOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TensorStoreOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TensorStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::TensorType> TensorStoreOp::getTensor() { + return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::BaseMemRefType> TensorStoreOp::getMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::BaseMemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &TensorStoreOp::getTensorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &TensorStoreOp::getMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair TensorStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TensorStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void TensorStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::Value memref) { + odsState.addOperands(tensor); + odsState.addOperands(memref); +} + +void TensorStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value memref) { + odsState.addOperands(tensor); + odsState.addOperands(memref); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TensorStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TensorStoreOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps13(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_MemRefOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(getTensorTypeFromMemRefType((*this->getODSOperands(1).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that type of 'value' matches tensor equivalent of 'memref'"); + return ::mlir::success(); +} + +::mlir::LogicalResult TensorStoreOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TensorStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tensorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tensorOperands(tensorRawOperands); ::llvm::SMLoc tensorOperandsLoc; + (void)tensorOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand memrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(memrefRawOperands); ::llvm::SMLoc memrefOperandsLoc; + (void)memrefOperandsLoc; + ::mlir::Type memrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> memrefTypes(memrefRawTypes); + + tensorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tensorRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + memrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(memrefRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::BaseMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + memrefRawTypes[0] = type; + } + for (::mlir::Type type : memrefTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::BaseMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return parser.emitError(parser.getNameLoc()) << "'memref' must be ranked or unranked memref of any type values, but got " << type; + } + } + if (parser.resolveOperands(tensorOperands, getTensorTypeFromMemRefType(memrefTypes[0]), tensorOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TensorStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTensor(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMemref(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TensorStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace memref +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::TensorStoreOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..7ec54f3e08f92c8f09fad003b2a3cd559d57192a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.h.inc @@ -0,0 +1,5333 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MemRefOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace memref { +class AssumeAlignmentOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class AtomicRMWOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class AtomicYieldOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class CopyOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class GenericAtomicRMWOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class LoadOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class AllocOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class AllocaOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class AllocaScopeOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class AllocaScopeReturnOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class CastOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class CollapseShapeOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class DeallocOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class DimOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class DmaStartOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class DmaWaitOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class ExpandShapeOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class ExtractAlignedPointerAsIndexOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class ExtractStridedMetadataOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class GetGlobalOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class GlobalOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class MemorySpaceCastOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class PrefetchOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class RankOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class ReallocOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class ReinterpretCastOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class ReshapeOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class StoreOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class TransposeOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class ViewOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class SubViewOp; +} // namespace memref +} // namespace mlir +namespace mlir { +namespace memref { +class TensorStoreOp; +} // namespace memref +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AssumeAlignmentOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssumeAlignmentOpGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AssumeAlignmentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AssumeAlignmentOpGenericAdaptorBase(AssumeAlignmentOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); +}; +} // namespace detail +template +class AssumeAlignmentOpGenericAdaptor : public detail::AssumeAlignmentOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssumeAlignmentOpGenericAdaptorBase; +public: + AssumeAlignmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssumeAlignmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssumeAlignmentOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AssumeAlignmentOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssumeAlignmentOpAdaptor : public AssumeAlignmentOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssumeAlignmentOpGenericAdaptor::AssumeAlignmentOpGenericAdaptor; + AssumeAlignmentOpAdaptor(AssumeAlignmentOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssumeAlignmentOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AssumeAlignmentOpAdaptor; + template + using GenericAdaptor = AssumeAlignmentOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.assume_alignment"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + uint32_t getAlignment(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, uint32_t alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, uint32_t alignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::AssumeAlignmentOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AtomicRMWOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicRMWOpGenericAdaptorBase { +public: + struct Properties { + using kindTy = ::mlir::arith::AtomicRMWKindAttr; + kindTy kind; + + auto getKind() { + auto &propStorage = this->kind; + return ::llvm::cast<::mlir::arith::AtomicRMWKindAttr>(propStorage); + } + void setKind(const ::mlir::arith::AtomicRMWKindAttr &propValue) { + this->kind = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.kind == this->kind && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AtomicRMWOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicRMWOpGenericAdaptorBase(AtomicRMWOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::arith::AtomicRMWKindAttr getKindAttr(); + ::mlir::arith::AtomicRMWKind getKind(); +}; +} // namespace detail +template +class AtomicRMWOpGenericAdaptor : public detail::AtomicRMWOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicRMWOpGenericAdaptorBase; +public: + AtomicRMWOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicRMWOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicRMWOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AtomicRMWOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicRMWOpAdaptor : public AtomicRMWOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicRMWOpGenericAdaptor::AtomicRMWOpGenericAdaptor; + AtomicRMWOpAdaptor(AtomicRMWOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicRMWOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicRMWOpAdaptor; + template + using GenericAdaptor = AtomicRMWOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("kind")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKindAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKindAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.atomic_rmw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::arith::AtomicRMWKindAttr getKindAttr(); + ::mlir::arith::AtomicRMWKind getKind(); + void setKindAttr(::mlir::arith::AtomicRMWKindAttr attr); + void setKind(::mlir::arith::AtomicRMWKind attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::AtomicRMWKindAttr kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::AtomicRMWKindAttr kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::AtomicRMWKindAttr kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::AtomicRMWKind kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::arith::AtomicRMWKind kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::AtomicRMWKind kind, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + MemRefType getMemRefType() { + return ::llvm::cast(getMemref().getType()); + } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::AtomicRMWOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AtomicYieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicYieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AtomicYieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicYieldOpGenericAdaptorBase(AtomicYieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AtomicYieldOpGenericAdaptor : public detail::AtomicYieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicYieldOpGenericAdaptorBase; +public: + AtomicYieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicYieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicYieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AtomicYieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResult() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicYieldOpAdaptor : public AtomicYieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicYieldOpGenericAdaptor::AtomicYieldOpGenericAdaptor; + AtomicYieldOpAdaptor(AtomicYieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicYieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicYieldOpAdaptor; + template + using GenericAdaptor = AtomicYieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.atomic_yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getResult(); + ::mlir::OpOperand &getResultMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value result); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::AtomicYieldOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::CopyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CopyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CopyOpGenericAdaptorBase(CopyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CopyOpGenericAdaptor : public detail::CopyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CopyOpGenericAdaptorBase; +public: + CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CopyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CopyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + ValueT getTarget() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CopyOpAdaptor : public CopyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CopyOpGenericAdaptor::CopyOpGenericAdaptor; + CopyOpAdaptor(CopyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CopyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::CopyOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType, ::mlir::OpTrait::SameOperandsShape, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CopyOpAdaptor; + template + using GenericAdaptor = CopyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.copy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getSource(); + ::mlir::TypedValue<::mlir::BaseMemRefType> getTarget(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getTargetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source, ::mlir::Value target); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value target); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::CopyOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::GenericAtomicRMWOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GenericAtomicRMWOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GenericAtomicRMWOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GenericAtomicRMWOpGenericAdaptorBase(GenericAtomicRMWOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getAtomicBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class GenericAtomicRMWOpGenericAdaptor : public detail::GenericAtomicRMWOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GenericAtomicRMWOpGenericAdaptorBase; +public: + GenericAtomicRMWOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GenericAtomicRMWOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GenericAtomicRMWOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GenericAtomicRMWOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GenericAtomicRMWOpAdaptor : public GenericAtomicRMWOpGenericAdaptor<::mlir::ValueRange> { +public: + using GenericAtomicRMWOpGenericAdaptor::GenericAtomicRMWOpGenericAdaptor; + GenericAtomicRMWOpAdaptor(GenericAtomicRMWOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GenericAtomicRMWOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GenericAtomicRMWOpAdaptor; + template + using GenericAdaptor = GenericAtomicRMWOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.generic_atomic_rmw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + ::mlir::Region &getAtomicBody(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value memref, ValueRange ivs); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // TODO: remove post migrating callers. + Region &body() { return getRegion(); } + + // The value stored in memref[ivs]. + Value getCurrentValue() { + return getRegion().getArgument(0); + } + MemRefType getMemRefType() { + return ::llvm::cast(getMemref().getType()); + } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::GenericAtomicRMWOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::LoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadOpGenericAdaptorBase { +public: + struct Properties { + using nontemporalTy = ::mlir::BoolAttr; + nontemporalTy nontemporal; + + auto getNontemporal() { + auto &propStorage = this->nontemporal; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setNontemporal(const ::mlir::BoolAttr &propValue) { + this->nontemporal = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.nontemporal == this->nontemporal && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadOpGenericAdaptorBase(LoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getNontemporalAttr(); + bool getNontemporal(); +}; +} // namespace detail +template +class LoadOpGenericAdaptor : public detail::LoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadOpGenericAdaptorBase; +public: + LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadOpAdaptor : public LoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadOpGenericAdaptor::LoadOpGenericAdaptor; + LoadOpAdaptor(LoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::PromotableMemOpInterface::Trait, ::mlir::DestructurableAccessorOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadOpAdaptor; + template + using GenericAdaptor = LoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nontemporal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNontemporalAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNontemporalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getNontemporalAttr(); + bool getNontemporal(); + void setNontemporalAttr(::mlir::BoolAttr attr); + void setNontemporal(::std::optional attrValue); + ::mlir::Attribute removeNontemporalAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + bool loadsFrom(const ::mlir::MemorySlot &slot); + bool storesTo(const ::mlir::MemorySlot &slot); + ::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + bool canUsesBeRemoved(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter, ::mlir::Value reachingDefinition); + bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + ::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots, ::mlir::RewriterBase &rewriter); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + Value getMemRef() { return getOperand(0); } + void setMemRef(Value value) { setOperand(0, value); } + MemRefType getMemRefType() { + return ::llvm::cast(getMemRef().getType()); + } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::LoadOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AllocOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllocOpGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AllocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AllocOpGenericAdaptorBase(AllocOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); +}; +} // namespace detail +template +class AllocOpGenericAdaptor : public detail::AllocOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllocOpGenericAdaptorBase; +public: + AllocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllocOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AllocOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDynamicSizes() { + return getODSOperands(0); + } + + RangeT getSymbolOperands() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllocOpAdaptor : public AllocOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllocOpGenericAdaptor::AllocOpGenericAdaptor; + AllocOpAdaptor(AllocOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllocOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllocOpAdaptor; + template + using GenericAdaptor = AllocOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.alloc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDynamicSizes(); + ::mlir::Operation::operand_range getSymbolOperands(); + ::mlir::MutableOperandRange getDynamicSizesMutable(); + ::mlir::MutableOperandRange getSymbolOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + ::mlir::Attribute removeAlignmentAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, IntegerAttr alignment = IntegerAttr()); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, ValueRange dynamicSizes, IntegerAttr alignment = IntegerAttr()); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, ValueRange dynamicSizes, ValueRange symbolOperands, IntegerAttr alignment = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef sizes, Type elementType, Attribute memorySpace = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static StringRef getAlignmentAttrStrName() { return "alignment"; } + + MemRefType getType() { return ::llvm::cast(getResult().getType()); } + + SmallVector getMixedSizes() { + SmallVector result; + unsigned ctr = 0; + OpBuilder b(getContext()); + for (int64_t i = 0, e = getType().getRank(); i < e; ++i) { + if (getType().isDynamicDim(i)) { + result.push_back(getDynamicSizes()[ctr++]); + } else { + result.push_back(b.getIndexAttr(getType().getShape()[i])); + } + } + return result; + } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::AllocOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AllocaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllocaOpGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AllocaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AllocaOpGenericAdaptorBase(AllocaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); +}; +} // namespace detail +template +class AllocaOpGenericAdaptor : public detail::AllocaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllocaOpGenericAdaptorBase; +public: + AllocaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllocaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllocaOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AllocaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDynamicSizes() { + return getODSOperands(0); + } + + RangeT getSymbolOperands() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllocaOpAdaptor : public AllocaOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllocaOpGenericAdaptor::AllocaOpGenericAdaptor; + AllocaOpAdaptor(AllocaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllocaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::PromotableAllocationOpInterface::Trait, ::mlir::DestructurableAllocationOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllocaOpAdaptor; + template + using GenericAdaptor = AllocaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.alloca"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDynamicSizes(); + ::mlir::Operation::operand_range getSymbolOperands(); + ::mlir::MutableOperandRange getDynamicSizesMutable(); + ::mlir::MutableOperandRange getSymbolOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + ::mlir::Attribute removeAlignmentAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, IntegerAttr alignment = IntegerAttr()); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, ValueRange dynamicSizes, IntegerAttr alignment = IntegerAttr()); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memrefType, ValueRange dynamicSizes, ValueRange symbolOperands, IntegerAttr alignment = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef sizes, Type elementType, Attribute memorySpace = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memref, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamicSizes, ::mlir::ValueRange symbolOperands, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + ::llvm::SmallVector<::mlir::MemorySlot> getPromotableSlots(); + ::mlir::Value getDefaultValue(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + void handleBlockArgument(const ::mlir::MemorySlot &slot, ::mlir::BlockArgument argument, ::mlir::RewriterBase &rewriter); + void handlePromotionComplete(const ::mlir::MemorySlot &slot, ::mlir::Value defaultValue, ::mlir::RewriterBase &rewriter); + ::llvm::SmallVector<::mlir::DestructurableMemorySlot> getDestructurableSlots(); + ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> destructure(const ::mlir::DestructurableMemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices, ::mlir::RewriterBase &rewriter); + void handleDestructuringComplete(const ::mlir::DestructurableMemorySlot &slot, ::mlir::RewriterBase &rewriter); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static StringRef getAlignmentAttrStrName() { return "alignment"; } + + MemRefType getType() { return ::llvm::cast(getResult().getType()); } + + SmallVector getMixedSizes() { + SmallVector result; + unsigned ctr = 0; + OpBuilder b(getContext()); + for (int64_t i = 0, e = getType().getRank(); i < e; ++i) { + if (getType().isDynamicDim(i)) { + result.push_back(getDynamicSizes()[ctr++]); + } else { + result.push_back(b.getIndexAttr(getType().getShape()[i])); + } + } + return result; + } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::AllocaOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AllocaScopeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllocaScopeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllocaScopeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllocaScopeOpGenericAdaptorBase(AllocaScopeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getBodyRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AllocaScopeOpGenericAdaptor : public detail::AllocaScopeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllocaScopeOpGenericAdaptorBase; +public: + AllocaScopeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllocaScopeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllocaScopeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllocaScopeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllocaScopeOpAdaptor : public AllocaScopeOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllocaScopeOpGenericAdaptor::AllocaScopeOpGenericAdaptor; + AllocaScopeOpAdaptor(AllocaScopeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllocaScopeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::RegionBranchOpInterface::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllocaScopeOpAdaptor; + template + using GenericAdaptor = AllocaScopeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.alloca_scope"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getBodyRegion(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::AllocaScopeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::AllocaScopeReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllocaScopeReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllocaScopeReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllocaScopeReturnOpGenericAdaptorBase(AllocaScopeReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AllocaScopeReturnOpGenericAdaptor : public detail::AllocaScopeReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllocaScopeReturnOpGenericAdaptorBase; +public: + AllocaScopeReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllocaScopeReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllocaScopeReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllocaScopeReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getResults() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllocaScopeReturnOpAdaptor : public AllocaScopeReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllocaScopeReturnOpGenericAdaptor::AllocaScopeReturnOpGenericAdaptor; + AllocaScopeReturnOpAdaptor(AllocaScopeReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllocaScopeReturnOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllocaScopeReturnOpAdaptor; + template + using GenericAdaptor = AllocaScopeReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.alloca_scope.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getResults(); + ::mlir::MutableOperandRange getResultsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange results); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::AllocaScopeReturnOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::CastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CastOpGenericAdaptorBase(CastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CastOpGenericAdaptor : public detail::CastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CastOpGenericAdaptorBase; +public: + CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CastOpAdaptor : public CastOpGenericAdaptor<::mlir::ValueRange> { +public: + using CastOpGenericAdaptor::CastOpGenericAdaptor; + CastOpAdaptor(CastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::CastOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::ViewLikeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CastOpAdaptor; + template + using GenericAdaptor = CastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.cast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getSource(); + ::mlir::OpOperand &getSourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getDest(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dest, ::mlir::Value source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + /// Fold the given CastOp into consumer op. + static bool canFoldIntoConsumerOp(CastOp castOp); + + Value getViewSource() { return getSource(); } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::CastOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::CollapseShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollapseShapeOpGenericAdaptorBase { +public: + struct Properties { + using reassociationTy = ::mlir::ArrayAttr; + reassociationTy reassociation; + + auto getReassociation() { + auto &propStorage = this->reassociation; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setReassociation(const ::mlir::ArrayAttr &propValue) { + this->reassociation = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.reassociation == this->reassociation && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CollapseShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CollapseShapeOpGenericAdaptorBase(CollapseShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getReassociationAttr(); + ::mlir::ArrayAttr getReassociation(); +}; +} // namespace detail +template +class CollapseShapeOpGenericAdaptor : public detail::CollapseShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollapseShapeOpGenericAdaptorBase; +public: + CollapseShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollapseShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollapseShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CollapseShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollapseShapeOpAdaptor : public CollapseShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollapseShapeOpGenericAdaptor::CollapseShapeOpGenericAdaptor; + CollapseShapeOpAdaptor(CollapseShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollapseShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ViewLikeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollapseShapeOpAdaptor; + template + using GenericAdaptor = CollapseShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("reassociation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getReassociationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getReassociationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.collapse_shape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSrc(); + ::mlir::OpOperand &getSrcMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getReassociationAttr(); + ::mlir::ArrayAttr getReassociation(); + void setReassociationAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value src, ArrayRef reassociation, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value src, ArrayRef reassociation, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value src, ArrayRef reassociation, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value src, ArrayRef reassociation, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::ArrayAttr reassociation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ArrayAttr reassociation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + SmallVector getReassociationMaps(); + + SmallVector getReassociationExprs(); + + SmallVector getReassociationIndices() { + SmallVector reassociationIndices; + for (auto attr : getReassociation()) + reassociationIndices.push_back(llvm::to_vector<2>( + llvm::map_range(::llvm::cast(attr), [&](Attribute indexAttr) { + return ::llvm::cast(indexAttr).getInt(); + }))); + return reassociationIndices; + }; + + MemRefType getSrcType() { return ::llvm::cast(getSrc().getType()); } + + MemRefType getResultType() { return ::llvm::cast(getResult().getType()); } + + Value getViewSource() { return getSrc(); } + + /// Return `true` if this source MemRef type is guaranteed to be collapsible + /// according to the given reassociation indices. In the presence of dynamic + /// strides this is usually not the case. + static bool isGuaranteedCollapsible( + MemRefType srcType, ArrayRef reassociation); + + static MemRefType computeCollapsedType( + MemRefType srcType, ArrayRef reassociation); +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::CollapseShapeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::DeallocOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeallocOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeallocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeallocOpGenericAdaptorBase(DeallocOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeallocOpGenericAdaptor : public detail::DeallocOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeallocOpGenericAdaptorBase; +public: + DeallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeallocOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeallocOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeallocOpAdaptor : public DeallocOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeallocOpGenericAdaptor::DeallocOpGenericAdaptor; + DeallocOpAdaptor(DeallocOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeallocOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DeallocOpAdaptor; + template + using GenericAdaptor = DeallocOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.dealloc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getMemref(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::DeallocOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::DimOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DimOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DimOpGenericAdaptorBase(DimOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DimOpGenericAdaptor : public detail::DimOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DimOpGenericAdaptorBase; +public: + DimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DimOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DimOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DimOpAdaptor : public DimOpGenericAdaptor<::mlir::ValueRange> { +public: + using DimOpGenericAdaptor::DimOpGenericAdaptor; + DimOpAdaptor(DimOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DimOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::ConditionallySpeculatable::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ShapedDimOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DimOpAdaptor; + template + using GenericAdaptor = DimOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.dim"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getSource(); + ::mlir::TypedValue<::mlir::IndexType> getIndex(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value source, int64_t index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::Value index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source, ::mlir::Value index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + /// Helper function to get the index as a simple integer if it is constant. + std::optional getConstantIndex(); + + /// Interface method of ShapedDimOpInterface: Return the source memref. + Value getShapedValue() { return getSource(); } + + /// Interface method of ShapedDimOpInterface: Return the dimension. + OpFoldResult getDimension() { return getIndex(); } + + /// Interface method for ConditionallySpeculatable. + Speculation::Speculatability getSpeculatability(); +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::DimOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::DmaStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DmaStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DmaStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DmaStartOpGenericAdaptorBase(DmaStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DmaStartOpGenericAdaptor : public detail::DmaStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DmaStartOpGenericAdaptorBase; +public: + DmaStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DmaStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DmaStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DmaStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class DmaStartOpAdaptor : public DmaStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using DmaStartOpGenericAdaptor::DmaStartOpGenericAdaptor; + DmaStartOpAdaptor(DmaStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DmaStartOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DmaStartOpAdaptor; + template + using GenericAdaptor = DmaStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.dma_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value srcMemRef, ValueRange srcIndices, Value destMemRef, ValueRange destIndices, Value numElements, Value tagMemRef, ValueRange tagIndices, Value stride = {}, Value elementsPerStride = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); +public: + // Returns the source MemRefType for this DMA operation. + Value getSrcMemRef() { return getOperand(0); } + // Returns the rank (number of indices) of the source MemRefType. + unsigned getSrcMemRefRank() { + return ::llvm::cast(getSrcMemRef().getType()).getRank(); + } + // Returns the source memref indices for this DMA operation. + operand_range getSrcIndices() { + return {(*this)->operand_begin() + 1, + (*this)->operand_begin() + 1 + getSrcMemRefRank()}; + } + + // Returns the destination MemRefType for this DMA operations. + Value getDstMemRef() { return getOperand(1 + getSrcMemRefRank()); } + // Returns the rank (number of indices) of the destination MemRefType. + unsigned getDstMemRefRank() { + return ::llvm::cast(getDstMemRef().getType()).getRank(); + } + unsigned getSrcMemorySpace() { + return ::llvm::cast(getSrcMemRef().getType()).getMemorySpaceAsInt(); + } + unsigned getDstMemorySpace() { + return ::llvm::cast(getDstMemRef().getType()).getMemorySpaceAsInt(); + } + + // Returns the destination memref indices for this DMA operation. + operand_range getDstIndices() { + return {(*this)->operand_begin() + 1 + getSrcMemRefRank() + 1, + (*this)->operand_begin() + 1 + getSrcMemRefRank() + 1 + + getDstMemRefRank()}; + } + + // Returns the number of elements being transferred by this DMA operation. + Value getNumElements() { + return getOperand(1 + getSrcMemRefRank() + 1 + getDstMemRefRank()); + } + + // Returns the Tag MemRef for this DMA operation. + Value getTagMemRef() { + return getOperand(1 + getSrcMemRefRank() + 1 + getDstMemRefRank() + 1); + } + + // Returns the rank (number of indices) of the tag MemRefType. + unsigned getTagMemRefRank() { + return ::llvm::cast(getTagMemRef().getType()).getRank(); + } + + // Returns the tag memref index for this DMA operation. + operand_range getTagIndices() { + unsigned tagIndexStartPos = + 1 + getSrcMemRefRank() + 1 + getDstMemRefRank() + 1 + 1; + return {(*this)->operand_begin() + tagIndexStartPos, + (*this)->operand_begin() + tagIndexStartPos + getTagMemRefRank()}; + } + + /// Returns true if this is a DMA from a faster memory space to a slower + /// one. + bool isDestMemorySpaceFaster() { + return (getSrcMemorySpace() < getDstMemorySpace()); + } + + /// Returns true if this is a DMA from a slower memory space to a faster + /// one. + bool isSrcMemorySpaceFaster() { + // Assumes that a lower number is for a slower memory space. + return (getDstMemorySpace() < getSrcMemorySpace()); + } + + /// Given a DMA start operation, returns the operand position of either the + /// source or destination memref depending on the one that is at the higher + /// level of the memory hierarchy. Asserts failure if neither is true. + unsigned getFasterMemPos() { + assert(isSrcMemorySpaceFaster() || isDestMemorySpaceFaster()); + return isSrcMemorySpaceFaster() ? 0 : getSrcMemRefRank() + 1; + } + + bool isStrided() { + return getNumOperands() != 1 + getSrcMemRefRank() + 1 + + getDstMemRefRank() + 1 + 1 + + getTagMemRefRank(); + } + + Value getStride() { + if (!isStrided()) + return nullptr; + return getOperand(getNumOperands() - 1 - 1); + } + + Value getNumElementsPerStride() { + if (!isStrided()) + return nullptr; + return getOperand(getNumOperands() - 1); + } + + void getEffects( + SmallVectorImpl> & + effects) { + effects.emplace_back(MemoryEffects::Read::get(), getSrcMemRef(), + SideEffects::DefaultResource::get()); + effects.emplace_back(MemoryEffects::Write::get(), getDstMemRef(), + SideEffects::DefaultResource::get()); + effects.emplace_back(MemoryEffects::Read::get(), getTagMemRef(), + SideEffects::DefaultResource::get()); + } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::DmaStartOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::DmaWaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DmaWaitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DmaWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DmaWaitOpGenericAdaptorBase(DmaWaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DmaWaitOpGenericAdaptor : public detail::DmaWaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DmaWaitOpGenericAdaptorBase; +public: + DmaWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DmaWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DmaWaitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DmaWaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTagMemRef() { + return (*getODSOperands(0).begin()); + } + + RangeT getTagIndices() { + return getODSOperands(1); + } + + ValueT getNumElements() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DmaWaitOpAdaptor : public DmaWaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using DmaWaitOpGenericAdaptor::DmaWaitOpGenericAdaptor; + DmaWaitOpAdaptor(DmaWaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DmaWaitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = DmaWaitOpAdaptor; + template + using GenericAdaptor = DmaWaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.dma_wait"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getTagMemRef(); + ::mlir::Operation::operand_range getTagIndices(); + ::mlir::TypedValue<::mlir::IndexType> getNumElements(); + ::mlir::OpOperand &getTagMemRefMutable(); + ::mlir::MutableOperandRange getTagIndicesMutable(); + ::mlir::OpOperand &getNumElementsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tagMemRef, ::mlir::ValueRange tagIndices, ::mlir::Value numElements); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tagMemRef, ::mlir::ValueRange tagIndices, ::mlir::Value numElements); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + /// Returns the rank (number of indices) of the tag memref. + unsigned getTagMemRefRank() { + return ::llvm::cast(getTagMemRef().getType()).getRank(); + } + void getEffects( + SmallVectorImpl> & + effects) { + effects.emplace_back(MemoryEffects::Read::get(), getTagMemRef(), + SideEffects::DefaultResource::get()); + } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::DmaWaitOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ExpandShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpandShapeOpGenericAdaptorBase { +public: + struct Properties { + using reassociationTy = ::mlir::ArrayAttr; + reassociationTy reassociation; + + auto getReassociation() { + auto &propStorage = this->reassociation; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setReassociation(const ::mlir::ArrayAttr &propValue) { + this->reassociation = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.reassociation == this->reassociation && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExpandShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpandShapeOpGenericAdaptorBase(ExpandShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getReassociationAttr(); + ::mlir::ArrayAttr getReassociation(); +}; +} // namespace detail +template +class ExpandShapeOpGenericAdaptor : public detail::ExpandShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpandShapeOpGenericAdaptorBase; +public: + ExpandShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpandShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpandShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExpandShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpandShapeOpAdaptor : public ExpandShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpandShapeOpGenericAdaptor::ExpandShapeOpGenericAdaptor; + ExpandShapeOpAdaptor(ExpandShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpandShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ViewLikeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpandShapeOpAdaptor; + template + using GenericAdaptor = ExpandShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("reassociation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getReassociationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getReassociationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.expand_shape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSrc(); + ::mlir::OpOperand &getSrcMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getReassociationAttr(); + ::mlir::ArrayAttr getReassociation(); + void setReassociationAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value src, ArrayRef reassociation, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value src, ArrayRef reassociation, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef resultShape, Value src, ArrayRef reassociation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::ArrayAttr reassociation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ArrayAttr reassociation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + SmallVector getReassociationMaps(); + + SmallVector getReassociationExprs(); + + SmallVector getReassociationIndices() { + SmallVector reassociationIndices; + for (auto attr : getReassociation()) + reassociationIndices.push_back(llvm::to_vector<2>( + llvm::map_range(::llvm::cast(attr), [&](Attribute indexAttr) { + return ::llvm::cast(indexAttr).getInt(); + }))); + return reassociationIndices; + }; + + MemRefType getSrcType() { return ::llvm::cast(getSrc().getType()); } + + MemRefType getResultType() { return ::llvm::cast(getResult().getType()); } + + Value getViewSource() { return getSrc(); } + + static FailureOr computeExpandedType( + MemRefType srcType, ArrayRef resultShape, + ArrayRef reassociation); +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::ExpandShapeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ExtractAlignedPointerAsIndexOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtractAlignedPointerAsIndexOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExtractAlignedPointerAsIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtractAlignedPointerAsIndexOpGenericAdaptorBase(ExtractAlignedPointerAsIndexOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExtractAlignedPointerAsIndexOpGenericAdaptor : public detail::ExtractAlignedPointerAsIndexOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtractAlignedPointerAsIndexOpGenericAdaptorBase; +public: + ExtractAlignedPointerAsIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtractAlignedPointerAsIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtractAlignedPointerAsIndexOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExtractAlignedPointerAsIndexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtractAlignedPointerAsIndexOpAdaptor : public ExtractAlignedPointerAsIndexOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtractAlignedPointerAsIndexOpGenericAdaptor::ExtractAlignedPointerAsIndexOpGenericAdaptor; + ExtractAlignedPointerAsIndexOpAdaptor(ExtractAlignedPointerAsIndexOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtractAlignedPointerAsIndexOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtractAlignedPointerAsIndexOpAdaptor; + template + using GenericAdaptor = ExtractAlignedPointerAsIndexOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.extract_aligned_pointer_as_index"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSource(); + ::mlir::OpOperand &getSourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getAlignedPointer(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type aligned_pointer, ::mlir::Value source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::ExtractAlignedPointerAsIndexOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ExtractStridedMetadataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtractStridedMetadataOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExtractStridedMetadataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtractStridedMetadataOpGenericAdaptorBase(ExtractStridedMetadataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExtractStridedMetadataOpGenericAdaptor : public detail::ExtractStridedMetadataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtractStridedMetadataOpGenericAdaptorBase; +public: + ExtractStridedMetadataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtractStridedMetadataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtractStridedMetadataOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExtractStridedMetadataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtractStridedMetadataOpAdaptor : public ExtractStridedMetadataOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtractStridedMetadataOpGenericAdaptor::ExtractStridedMetadataOpGenericAdaptor; + ExtractStridedMetadataOpAdaptor(ExtractStridedMetadataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtractStridedMetadataOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ViewLikeOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpTrait::InferTypeOpAdaptor> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtractStridedMetadataOpAdaptor; + template + using GenericAdaptor = ExtractStridedMetadataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.extract_strided_metadata"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSource(); + ::mlir::OpOperand &getSourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getBaseBuffer(); + ::mlir::TypedValue<::mlir::IndexType> getOffset(); + ::mlir::Operation::result_range getSizes(); + ::mlir::Operation::result_range getStrides(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type base_buffer, ::mlir::Type offset, ::mlir::TypeRange sizes, ::mlir::TypeRange strides, ::mlir::Value source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static ::mlir::LogicalResult + inferReturnTypes(::mlir::MLIRContext *context, + std::optional<::mlir::Location> location, + Adaptor adaptor, + ::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes); + + + /// Return a vector of all the static or dynamic sizes of the op, while + /// statically inferring the sizes of the dynamic sizes, when possible. + /// This is best effort. + /// E.g., if `getSizes` returns `[%dyn_size0, %dyn_size1]`, but the + /// source memref type is `memref<2x8xi16>`, this method will + /// return `[2, 8]`. + /// Similarly if the resulting memref type is `memref<2x?xi16>`, but + /// `%dyn_size1` can statically be pinned to a constant value, this + /// constant value is returned instead of `%dyn_size`. + SmallVector getConstifiedMixedSizes(); + /// Similar to `getConstifiedMixedSizes` but for strides. + SmallVector getConstifiedMixedStrides(); + /// Similar to `getConstifiedMixedSizes` but for the offset. + OpFoldResult getConstifiedMixedOffset(); + + ::mlir::Value getViewSource() { return getSource(); } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::ExtractStridedMetadataOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::GetGlobalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetGlobalOpGenericAdaptorBase { +public: + struct Properties { + using nameTy = ::mlir::FlatSymbolRefAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setName(const ::mlir::FlatSymbolRefAttr &propValue) { + this->name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.name == this->name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GetGlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GetGlobalOpGenericAdaptorBase(GetGlobalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getNameAttr(); + ::llvm::StringRef getName(); +}; +} // namespace detail +template +class GetGlobalOpGenericAdaptor : public detail::GetGlobalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetGlobalOpGenericAdaptorBase; +public: + GetGlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetGlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetGlobalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GetGlobalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetGlobalOpAdaptor : public GetGlobalOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetGlobalOpGenericAdaptor::GetGlobalOpGenericAdaptor; + GetGlobalOpAdaptor(GetGlobalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetGlobalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetGlobalOpAdaptor; + template + using GenericAdaptor = GetGlobalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.get_global"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::FlatSymbolRefAttr getNameAttr(); + ::llvm::StringRef getName(); + void setNameAttr(::mlir::FlatSymbolRefAttr attr); + void setName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::FlatSymbolRefAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::GetGlobalOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::GlobalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalOpGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + using constantTy = ::mlir::UnitAttr; + constantTy constant; + + auto getConstant() { + auto &propStorage = this->constant; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setConstant(const ::mlir::UnitAttr &propValue) { + this->constant = propValue; + } + using initial_valueTy = ::mlir::Attribute; + initial_valueTy initial_value; + + auto getInitialValue() { + auto &propStorage = this->initial_value; + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(propStorage); + } + void setInitialValue(const ::mlir::Attribute &propValue) { + this->initial_value = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using sym_visibilityTy = ::mlir::StringAttr; + sym_visibilityTy sym_visibility; + + auto getSymVisibility() { + auto &propStorage = this->sym_visibility; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSymVisibility(const ::mlir::StringAttr &propValue) { + this->sym_visibility = propValue; + } + using typeTy = ::mlir::TypeAttr; + typeTy type; + + auto getType() { + auto &propStorage = this->type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setType(const ::mlir::TypeAttr &propValue) { + this->type = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + rhs.constant == this->constant && + rhs.initial_value == this->initial_value && + rhs.sym_name == this->sym_name && + rhs.sym_visibility == this->sym_visibility && + rhs.type == this->type && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalOpGenericAdaptorBase(GlobalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::MemRefType getType(); + ::mlir::Attribute getInitialValueAttr(); + ::std::optional<::mlir::Attribute> getInitialValue(); + ::mlir::UnitAttr getConstantAttr(); + bool getConstant(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); +}; +} // namespace detail +template +class GlobalOpGenericAdaptor : public detail::GlobalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalOpGenericAdaptorBase; +public: + GlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalOpAdaptor : public GlobalOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalOpGenericAdaptor::GlobalOpGenericAdaptor; + GlobalOpAdaptor(GlobalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalOpAdaptor; + template + using GenericAdaptor = GlobalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment"), ::llvm::StringRef("constant"), ::llvm::StringRef("initial_value"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("sym_visibility"), ::llvm::StringRef("type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConstantAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConstantAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getInitialValueAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getInitialValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSymVisibilityAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.global"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::StringAttr getSymVisibilityAttr(); + ::std::optional< ::llvm::StringRef > getSymVisibility(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::MemRefType getType(); + ::mlir::Attribute getInitialValueAttr(); + ::std::optional<::mlir::Attribute> getInitialValue(); + ::mlir::UnitAttr getConstantAttr(); + bool getConstant(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setSymVisibilityAttr(::mlir::StringAttr attr); + void setSymVisibility(::std::optional<::llvm::StringRef> attrValue); + void setTypeAttr(::mlir::TypeAttr attr); + void setType(::mlir::MemRefType attrValue); + void setInitialValueAttr(::mlir::Attribute attr); + void setConstantAttr(::mlir::UnitAttr attr); + void setConstant(bool attrValue); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + ::mlir::Attribute removeSymVisibilityAttr(); + ::mlir::Attribute removeInitialValueAttr(); + ::mlir::Attribute removeConstantAttr(); + ::mlir::Attribute removeAlignmentAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr constant, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr constant, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::MemRefType type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool constant, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::MemRefType type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool constant, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + bool isExternal() { return !getInitialValue(); } + bool isUninitialized() { + return !isExternal() && ::llvm::isa(*getInitialValue()); + } + /// Returns the constant initial value if the memref.global is a constant, + /// or null otherwise. + ElementsAttr getConstantInitValue(); +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::GlobalOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::MemorySpaceCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MemorySpaceCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MemorySpaceCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MemorySpaceCastOpGenericAdaptorBase(MemorySpaceCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MemorySpaceCastOpGenericAdaptor : public detail::MemorySpaceCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MemorySpaceCastOpGenericAdaptorBase; +public: + MemorySpaceCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MemorySpaceCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MemorySpaceCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MemorySpaceCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MemorySpaceCastOpAdaptor : public MemorySpaceCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using MemorySpaceCastOpGenericAdaptor::MemorySpaceCastOpGenericAdaptor; + MemorySpaceCastOpAdaptor(MemorySpaceCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MemorySpaceCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::CastOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::ViewLikeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MemorySpaceCastOpAdaptor; + template + using GenericAdaptor = MemorySpaceCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.memory_space_cast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getSource(); + ::mlir::OpOperand &getSourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getDest(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dest, ::mlir::Value source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + Value getViewSource() { return getSource(); } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::MemorySpaceCastOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::PrefetchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrefetchOpGenericAdaptorBase { +public: + struct Properties { + using isDataCacheTy = ::mlir::BoolAttr; + isDataCacheTy isDataCache; + + auto getIsDataCache() { + auto &propStorage = this->isDataCache; + return ::llvm::cast<::mlir::BoolAttr>(propStorage); + } + void setIsDataCache(const ::mlir::BoolAttr &propValue) { + this->isDataCache = propValue; + } + using isWriteTy = ::mlir::BoolAttr; + isWriteTy isWrite; + + auto getIsWrite() { + auto &propStorage = this->isWrite; + return ::llvm::cast<::mlir::BoolAttr>(propStorage); + } + void setIsWrite(const ::mlir::BoolAttr &propValue) { + this->isWrite = propValue; + } + using localityHintTy = ::mlir::IntegerAttr; + localityHintTy localityHint; + + auto getLocalityHint() { + auto &propStorage = this->localityHint; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setLocalityHint(const ::mlir::IntegerAttr &propValue) { + this->localityHint = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.isDataCache == this->isDataCache && + rhs.isWrite == this->isWrite && + rhs.localityHint == this->localityHint && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PrefetchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PrefetchOpGenericAdaptorBase(PrefetchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsWriteAttr(); + bool getIsWrite(); + ::mlir::IntegerAttr getLocalityHintAttr(); + uint32_t getLocalityHint(); + ::mlir::BoolAttr getIsDataCacheAttr(); + bool getIsDataCache(); +}; +} // namespace detail +template +class PrefetchOpGenericAdaptor : public detail::PrefetchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrefetchOpGenericAdaptorBase; +public: + PrefetchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrefetchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrefetchOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PrefetchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrefetchOpAdaptor : public PrefetchOpGenericAdaptor<::mlir::ValueRange> { +public: + using PrefetchOpGenericAdaptor::PrefetchOpGenericAdaptor; + PrefetchOpAdaptor(PrefetchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrefetchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PrefetchOpAdaptor; + template + using GenericAdaptor = PrefetchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("isDataCache"), ::llvm::StringRef("isWrite"), ::llvm::StringRef("localityHint")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsDataCacheAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsDataCacheAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsWriteAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsWriteAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLocalityHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLocalityHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.prefetch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getIsWriteAttr(); + bool getIsWrite(); + ::mlir::IntegerAttr getLocalityHintAttr(); + uint32_t getLocalityHint(); + ::mlir::BoolAttr getIsDataCacheAttr(); + bool getIsDataCache(); + void setIsWriteAttr(::mlir::BoolAttr attr); + void setIsWrite(bool attrValue); + void setLocalityHintAttr(::mlir::IntegerAttr attr); + void setLocalityHint(uint32_t attrValue); + void setIsDataCacheAttr(::mlir::BoolAttr attr); + void setIsDataCache(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr isWrite, ::mlir::IntegerAttr localityHint, ::mlir::BoolAttr isDataCache); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr isWrite, ::mlir::IntegerAttr localityHint, ::mlir::BoolAttr isDataCache); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref, ::mlir::ValueRange indices, bool isWrite, uint32_t localityHint, bool isDataCache); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, bool isWrite, uint32_t localityHint, bool isDataCache); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + MemRefType getMemRefType() { + return ::llvm::cast(getMemref().getType()); + } + static StringRef getLocalityHintAttrStrName() { return "localityHint"; } + static StringRef getIsWriteAttrStrName() { return "isWrite"; } + static StringRef getIsDataCacheAttrStrName() { return "isDataCache"; } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::PrefetchOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::RankOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RankOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RankOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RankOpGenericAdaptorBase(RankOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RankOpGenericAdaptor : public detail::RankOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RankOpGenericAdaptorBase; +public: + RankOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RankOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RankOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RankOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RankOpAdaptor : public RankOpGenericAdaptor<::mlir::ValueRange> { +public: + using RankOpGenericAdaptor::RankOpGenericAdaptor; + RankOpAdaptor(RankOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RankOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RankOpAdaptor; + template + using GenericAdaptor = RankOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.rank"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getMemref(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::RankOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ReallocOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReallocOpGenericAdaptorBase { +public: + struct Properties { + using alignmentTy = ::mlir::IntegerAttr; + alignmentTy alignment; + + auto getAlignment() { + auto &propStorage = this->alignment; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setAlignment(const ::mlir::IntegerAttr &propValue) { + this->alignment = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment == this->alignment && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReallocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReallocOpGenericAdaptorBase(ReallocOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); +}; +} // namespace detail +template +class ReallocOpGenericAdaptor : public detail::ReallocOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReallocOpGenericAdaptorBase; +public: + ReallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReallocOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReallocOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + ValueT getDynamicResultSize() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReallocOpAdaptor : public ReallocOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReallocOpGenericAdaptor::ReallocOpGenericAdaptor; + ReallocOpAdaptor(ReallocOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReallocOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReallocOpAdaptor; + template + using GenericAdaptor = ReallocOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.realloc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSource(); + ::mlir::TypedValue<::mlir::IndexType> getDynamicResultSize(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::MutableOperandRange getDynamicResultSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getAlignmentAttr(); + ::std::optional getAlignment(); + void setAlignmentAttr(::mlir::IntegerAttr attr); + void setAlignment(::std::optional attrValue); + ::mlir::Attribute removeAlignmentAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value source, Value dynamicResultSize = Value()); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value source, /*optional*/::mlir::Value dynamicResultSize, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::Value dynamicResultSize, /*optional*/::mlir::IntegerAttr alignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The result of a realloc is always a memref. + MemRefType getType() { return ::llvm::cast(getResult().getType()); } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::ReallocOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ReinterpretCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReinterpretCastOpGenericAdaptorBase { +public: + struct Properties { + using static_offsetsTy = ::mlir::DenseI64ArrayAttr; + static_offsetsTy static_offsets; + + auto getStaticOffsets() { + auto &propStorage = this->static_offsets; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setStaticOffsets(const ::mlir::DenseI64ArrayAttr &propValue) { + this->static_offsets = propValue; + } + using static_sizesTy = ::mlir::DenseI64ArrayAttr; + static_sizesTy static_sizes; + + auto getStaticSizes() { + auto &propStorage = this->static_sizes; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setStaticSizes(const ::mlir::DenseI64ArrayAttr &propValue) { + this->static_sizes = propValue; + } + using static_stridesTy = ::mlir::DenseI64ArrayAttr; + static_stridesTy static_strides; + + auto getStaticStrides() { + auto &propStorage = this->static_strides; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setStaticStrides(const ::mlir::DenseI64ArrayAttr &propValue) { + this->static_strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.static_offsets == this->static_offsets && + rhs.static_sizes == this->static_sizes && + rhs.static_strides == this->static_strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReinterpretCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReinterpretCastOpGenericAdaptorBase(ReinterpretCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI64ArrayAttr getStaticOffsetsAttr(); + ::llvm::ArrayRef getStaticOffsets(); + ::mlir::DenseI64ArrayAttr getStaticSizesAttr(); + ::llvm::ArrayRef getStaticSizes(); + ::mlir::DenseI64ArrayAttr getStaticStridesAttr(); + ::llvm::ArrayRef getStaticStrides(); +}; +} // namespace detail +template +class ReinterpretCastOpGenericAdaptor : public detail::ReinterpretCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReinterpretCastOpGenericAdaptorBase; +public: + ReinterpretCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReinterpretCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReinterpretCastOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReinterpretCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOffsets() { + return getODSOperands(1); + } + + RangeT getSizes() { + return getODSOperands(2); + } + + RangeT getStrides() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReinterpretCastOpAdaptor : public ReinterpretCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReinterpretCastOpGenericAdaptor::ReinterpretCastOpGenericAdaptor; + ReinterpretCastOpAdaptor(ReinterpretCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReinterpretCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OffsetSizeAndStrideOpInterface::Trait, ::mlir::ViewLikeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReinterpretCastOpAdaptor; + template + using GenericAdaptor = ReinterpretCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("static_offsets"), ::llvm::StringRef("static_sizes"), ::llvm::StringRef("static_strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getStaticOffsetsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getStaticOffsetsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStaticSizesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStaticSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getStaticStridesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getStaticStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.reinterpret_cast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getSource(); + ::mlir::Operation::operand_range getOffsets(); + ::mlir::Operation::operand_range getSizes(); + ::mlir::Operation::operand_range getStrides(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::MutableOperandRange getOffsetsMutable(); + ::mlir::MutableOperandRange getSizesMutable(); + ::mlir::MutableOperandRange getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI64ArrayAttr getStaticOffsetsAttr(); + ::llvm::ArrayRef getStaticOffsets(); + ::mlir::DenseI64ArrayAttr getStaticSizesAttr(); + ::llvm::ArrayRef getStaticSizes(); + ::mlir::DenseI64ArrayAttr getStaticStridesAttr(); + ::llvm::ArrayRef getStaticStrides(); + void setStaticOffsetsAttr(::mlir::DenseI64ArrayAttr attr); + void setStaticOffsets(::llvm::ArrayRef attrValue); + void setStaticSizesAttr(::mlir::DenseI64ArrayAttr attr); + void setStaticSizes(::llvm::ArrayRef attrValue); + void setStaticStridesAttr(::mlir::DenseI64ArrayAttr attr); + void setStaticStrides(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value source, OpFoldResult offset, ArrayRef sizes, ArrayRef strides, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value source, int64_t offset, ArrayRef sizes, ArrayRef strides, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value source, Value offset, ValueRange sizes, ValueRange strides, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::mlir::DenseI64ArrayAttr static_offsets, ::mlir::DenseI64ArrayAttr static_sizes, ::mlir::DenseI64ArrayAttr static_strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::mlir::DenseI64ArrayAttr static_offsets, ::mlir::DenseI64ArrayAttr static_sizes, ::mlir::DenseI64ArrayAttr static_strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::llvm::ArrayRef static_offsets, ::llvm::ArrayRef static_sizes, ::llvm::ArrayRef static_strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::llvm::ArrayRef static_offsets, ::llvm::ArrayRef static_sizes, ::llvm::ArrayRef static_strides); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the dynamic sizes for this subview operation if specified. + ::mlir::Operation::operand_range getDynamicSizes() { return getSizes(); } + + /// Return the list of Range (i.e. offset, size, stride). Each + /// Range entry contains either the dynamic value or a ConstantIndexOp + /// constructed with `b` at location `loc`. + ::mlir::SmallVector<::mlir::Range, 8> getOrCreateRanges( + ::mlir::OpBuilder &b, ::mlir::Location loc) { + return ::mlir::getOrCreateRanges(*this, b, loc); + } + + // The result of the op is always a ranked memref. + MemRefType getType() { return getResult().getType(); } + Value getViewSource() { return getSource(); } + + /// Return the rank of the result type. + unsigned getResultRank() { return getType().getRank(); } + + /// Return the expected rank of each of the`static_offsets`, `static_sizes` + /// and `static_strides` attributes. + std::array getArrayAttrMaxRanks() { + unsigned resultRank = getType().getRank(); + return {1, resultRank, resultRank}; + } + + /// Return the number of leading operands before the `offsets`, `sizes` and + /// and `strides` operands. + static unsigned getOffsetSizeAndStrideStartOperandIndex() { return 1; } + + /// Return a vector of all the static or dynamic sizes of the op, while + /// statically inferring the sizes of the dynamic sizes, when possible. + /// This is best effort. + /// E.g., if `getMixedSizes` returns `[2, %dyn_size]`, but the resulting + /// memref type is `memref<2x8xi16>`, this method will return `[2, 8]`. + /// Similarly if the resulting memref type is `memref<2x?xi16>`, but + /// `%dyn_size` can statically be pinned to a constant value, this + /// constant value is returned instead of `%dyn_size`. + SmallVector getConstifiedMixedSizes(); + /// Similar to `getConstifiedMixedSizes` but for strides. + SmallVector getConstifiedMixedStrides(); + /// Similar to `getConstifiedMixedSizes` but for the offset. + OpFoldResult getConstifiedMixedOffset(); +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::ReinterpretCastOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ReshapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReshapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReshapeOpGenericAdaptorBase(ReshapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReshapeOpGenericAdaptor : public detail::ReshapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReshapeOpGenericAdaptorBase; +public: + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + ValueT getShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReshapeOpAdaptor : public ReshapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReshapeOpGenericAdaptor::ReshapeOpGenericAdaptor; + ReshapeOpAdaptor(ReshapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReshapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ViewLikeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReshapeOpAdaptor; + template + using GenericAdaptor = ReshapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.reshape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getSource(); + ::mlir::TypedValue<::mlir::MemRefType> getShape(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value operand, Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + MemRefType getType() { return ::llvm::cast(getResult().getType()); } + Value getViewSource() { return getSource(); } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::ReshapeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::StoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StoreOpGenericAdaptorBase { +public: + struct Properties { + using nontemporalTy = ::mlir::BoolAttr; + nontemporalTy nontemporal; + + auto getNontemporal() { + auto &propStorage = this->nontemporal; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setNontemporal(const ::mlir::BoolAttr &propValue) { + this->nontemporal = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.nontemporal == this->nontemporal && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + StoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + StoreOpGenericAdaptorBase(StoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getNontemporalAttr(); + bool getNontemporal(); +}; +} // namespace detail +template +class StoreOpGenericAdaptor : public detail::StoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StoreOpGenericAdaptorBase; +public: + StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StoreOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + StoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getIndices() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StoreOpAdaptor : public StoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using StoreOpGenericAdaptor::StoreOpGenericAdaptor; + StoreOpAdaptor(StoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::MemRefsNormalizable, ::mlir::PromotableMemOpInterface::Trait, ::mlir::DestructurableAccessorOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StoreOpAdaptor; + template + using GenericAdaptor = StoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nontemporal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNontemporalAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNontemporalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::TypedValue<::mlir::MemRefType> getMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getNontemporalAttr(); + bool getNontemporal(); + void setNontemporalAttr(::mlir::BoolAttr attr); + void setNontemporal(::std::optional attrValue); + ::mlir::Attribute removeNontemporalAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value valueToStore, Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/::mlir::BoolAttr nontemporal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, /*optional*/bool nontemporal = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + bool loadsFrom(const ::mlir::MemorySlot &slot); + bool storesTo(const ::mlir::MemorySlot &slot); + ::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter); + bool canUsesBeRemoved(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &blockingUses, ::llvm::SmallVectorImpl<::mlir::OpOperand *> &newBlockingUses); + ::mlir::DeletionKind removeBlockingUses(const ::mlir::MemorySlot &slot, const ::llvm::SmallPtrSetImpl &blockingUses, ::mlir::RewriterBase &rewriter, ::mlir::Value reachingDefinition); + bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed); + ::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots, ::mlir::RewriterBase &rewriter); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + Value getValueToStore() { return getOperand(0); } + + Value getMemRef() { return getOperand(1); } + void setMemRef(Value value) { setOperand(1, value); } + MemRefType getMemRefType() { + return ::llvm::cast(getMemRef().getType()); + } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::StoreOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::TransposeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TransposeOpGenericAdaptorBase { +public: + struct Properties { + using permutationTy = ::mlir::AffineMapAttr; + permutationTy permutation; + + auto getPermutation() { + auto &propStorage = this->permutation; + return ::llvm::cast<::mlir::AffineMapAttr>(propStorage); + } + void setPermutation(const ::mlir::AffineMapAttr &propValue) { + this->permutation = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.permutation == this->permutation && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TransposeOpGenericAdaptorBase(TransposeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::AffineMapAttr getPermutationAttr(); + ::mlir::AffineMap getPermutation(); +}; +} // namespace detail +template +class TransposeOpGenericAdaptor : public detail::TransposeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TransposeOpGenericAdaptorBase; +public: + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIn() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TransposeOpAdaptor : public TransposeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TransposeOpGenericAdaptor::TransposeOpGenericAdaptor; + TransposeOpAdaptor(TransposeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TransposeOpAdaptor; + template + using GenericAdaptor = TransposeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("permutation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPermutationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPermutationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.transpose"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getIn(); + ::mlir::OpOperand &getInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::AffineMapAttr getPermutationAttr(); + ::mlir::AffineMap getPermutation(); + void setPermutationAttr(::mlir::AffineMapAttr attr); + void setPermutation(::mlir::AffineMap attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value in, AffineMapAttr permutation, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value in, ::mlir::AffineMapAttr permutation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::AffineMapAttr permutation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value in, ::mlir::AffineMap permutation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in, ::mlir::AffineMap permutation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static StringRef getPermutationAttrStrName() { return "permutation"; } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::TransposeOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::ViewOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ViewOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ViewOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ViewOpGenericAdaptorBase(ViewOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ViewOpGenericAdaptor : public detail::ViewOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ViewOpGenericAdaptorBase; +public: + ViewOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ViewOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ViewOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ViewOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + ValueT getByteShift() { + return (*getODSOperands(1).begin()); + } + + RangeT getSizes() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ViewOpAdaptor : public ViewOpGenericAdaptor<::mlir::ValueRange> { +public: + using ViewOpGenericAdaptor::ViewOpGenericAdaptor; + ViewOpAdaptor(ViewOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ViewOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::ViewLikeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ViewOpAdaptor; + template + using GenericAdaptor = ViewOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.view"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSource(); + ::mlir::TypedValue<::mlir::IndexType> getByteShift(); + ::mlir::Operation::operand_range getSizes(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getByteShiftMutable(); + ::mlir::MutableOperandRange getSizesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value source, ::mlir::Value byte_shift, ::mlir::ValueRange sizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value byte_shift, ::mlir::ValueRange sizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + ::mlir::Value getViewSource(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + /// The result of a view is always a memref. + MemRefType getType() { return ::llvm::cast(getResult().getType()); } + + /// Returns the dynamic sizes for this view operation. This is redundant + /// with `sizes` but needed in template implementations. More specifically: + /// ``` + /// template + /// bool isMemRefSizeValidSymbol(AnyMemRefDefOp memrefDefOp, unsigned index, + /// Region *region) + /// ``` + operand_range getDynamicSizes() { + return {getSizes().begin(), getSizes().end()}; + } +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::ViewOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::SubViewOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubViewOpGenericAdaptorBase { +public: + struct Properties { + using static_offsetsTy = ::mlir::DenseI64ArrayAttr; + static_offsetsTy static_offsets; + + auto getStaticOffsets() { + auto &propStorage = this->static_offsets; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setStaticOffsets(const ::mlir::DenseI64ArrayAttr &propValue) { + this->static_offsets = propValue; + } + using static_sizesTy = ::mlir::DenseI64ArrayAttr; + static_sizesTy static_sizes; + + auto getStaticSizes() { + auto &propStorage = this->static_sizes; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setStaticSizes(const ::mlir::DenseI64ArrayAttr &propValue) { + this->static_sizes = propValue; + } + using static_stridesTy = ::mlir::DenseI64ArrayAttr; + static_stridesTy static_strides; + + auto getStaticStrides() { + auto &propStorage = this->static_strides; + return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); + } + void setStaticStrides(const ::mlir::DenseI64ArrayAttr &propValue) { + this->static_strides = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.static_offsets == this->static_offsets && + rhs.static_sizes == this->static_sizes && + rhs.static_strides == this->static_strides && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SubViewOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SubViewOpGenericAdaptorBase(SubViewOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI64ArrayAttr getStaticOffsetsAttr(); + ::llvm::ArrayRef getStaticOffsets(); + ::mlir::DenseI64ArrayAttr getStaticSizesAttr(); + ::llvm::ArrayRef getStaticSizes(); + ::mlir::DenseI64ArrayAttr getStaticStridesAttr(); + ::llvm::ArrayRef getStaticStrides(); +}; +} // namespace detail +template +class SubViewOpGenericAdaptor : public detail::SubViewOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubViewOpGenericAdaptorBase; +public: + SubViewOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubViewOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubViewOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SubViewOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOffsets() { + return getODSOperands(1); + } + + RangeT getSizes() { + return getODSOperands(2); + } + + RangeT getStrides() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubViewOpAdaptor : public SubViewOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubViewOpGenericAdaptor::SubViewOpGenericAdaptor; + SubViewOpAdaptor(SubViewOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubViewOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::ViewLikeOpInterface::Trait, ::mlir::OffsetSizeAndStrideOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubViewOpAdaptor; + template + using GenericAdaptor = SubViewOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("static_offsets"), ::llvm::StringRef("static_sizes"), ::llvm::StringRef("static_strides"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getStaticOffsetsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getStaticOffsetsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStaticSizesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStaticSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getStaticStridesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getStaticStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.subview"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSource(); + ::mlir::Operation::operand_range getOffsets(); + ::mlir::Operation::operand_range getSizes(); + ::mlir::Operation::operand_range getStrides(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::MutableOperandRange getOffsetsMutable(); + ::mlir::MutableOperandRange getSizesMutable(); + ::mlir::MutableOperandRange getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseI64ArrayAttr getStaticOffsetsAttr(); + ::llvm::ArrayRef getStaticOffsets(); + ::mlir::DenseI64ArrayAttr getStaticSizesAttr(); + ::llvm::ArrayRef getStaticSizes(); + ::mlir::DenseI64ArrayAttr getStaticStridesAttr(); + ::llvm::ArrayRef getStaticStrides(); + void setStaticOffsetsAttr(::mlir::DenseI64ArrayAttr attr); + void setStaticOffsets(::llvm::ArrayRef attrValue); + void setStaticSizesAttr(::mlir::DenseI64ArrayAttr attr); + void setStaticSizes(::llvm::ArrayRef attrValue); + void setStaticStridesAttr(::mlir::DenseI64ArrayAttr attr); + void setStaticStrides(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value source, ArrayRef offsets, ArrayRef sizes, ArrayRef strides, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value source, ArrayRef offsets, ArrayRef sizes, ArrayRef strides, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value source, ArrayRef offsets, ArrayRef sizes, ArrayRef strides, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value source, ArrayRef offsets, ArrayRef sizes, ArrayRef strides, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType resultType, Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, ArrayRef attrs = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::mlir::DenseI64ArrayAttr static_offsets, ::mlir::DenseI64ArrayAttr static_sizes, ::mlir::DenseI64ArrayAttr static_strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::mlir::DenseI64ArrayAttr static_offsets, ::mlir::DenseI64ArrayAttr static_sizes, ::mlir::DenseI64ArrayAttr static_strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::llvm::ArrayRef static_offsets, ::llvm::ArrayRef static_sizes, ::llvm::ArrayRef static_strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::ValueRange offsets, ::mlir::ValueRange sizes, ::mlir::ValueRange strides, ::llvm::ArrayRef static_offsets, ::llvm::ArrayRef static_sizes, ::llvm::ArrayRef static_strides); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + ::mlir::Value getViewSource(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the dynamic sizes for this subview operation if specified. + ::mlir::Operation::operand_range getDynamicSizes() { return getSizes(); } + + /// Return the list of Range (i.e. offset, size, stride). Each + /// Range entry contains either the dynamic value or a ConstantIndexOp + /// constructed with `b` at location `loc`. + ::mlir::SmallVector<::mlir::Range, 8> getOrCreateRanges( + ::mlir::OpBuilder &b, ::mlir::Location loc) { + return ::mlir::getOrCreateRanges(*this, b, loc); + } + + /// Returns the type of the base memref operand. + MemRefType getSourceType() { + return ::llvm::cast(getSource().getType()); + } + + /// The result of a subview is always a memref. + MemRefType getType() { return ::llvm::cast(getResult().getType()); } + + /// A subview result type can be fully inferred from the source type and the + /// static representation of offsets, sizes and strides. Special sentinels + /// encode the dynamic case. + static Type inferResultType(MemRefType sourceMemRefType, + ArrayRef staticOffsets, + ArrayRef staticSizes, + ArrayRef staticStrides); + static Type inferResultType(MemRefType sourceMemRefType, + ArrayRef staticOffsets, + ArrayRef staticSizes, + ArrayRef staticStrides); + + /// A rank-reducing result type can be inferred from the desired result + /// shape. Only the layout map is inferred. + /// + /// Note: The result shape cannot be inferred with just the result rank and + /// and the desired sizes. In case there are more "ones" among the sizes + /// than the difference in source/result rank, it is not clear which dims of + /// size one should be dropped. + static Type inferRankReducedResultType(ArrayRef resultShape, + MemRefType sourceMemRefType, + ArrayRef staticOffsets, + ArrayRef staticSizes, + ArrayRef staticStrides); + static Type inferRankReducedResultType(ArrayRef resultShape, + MemRefType sourceMemRefType, + ArrayRef staticOffsets, + ArrayRef staticSizes, + ArrayRef staticStrides); + + /// Return the expected rank of each of the`static_offsets`, `static_sizes` + /// and `static_strides` attributes. + std::array getArrayAttrMaxRanks() { + unsigned rank = getSourceType().getRank(); + return {rank, rank, rank}; + } + + /// Return the number of leading operands before the `offsets`, `sizes` and + /// and `strides` operands. + static unsigned getOffsetSizeAndStrideStartOperandIndex() { return 1; } + + /// Return the dimensions of the source type that are dropped when + /// the result is rank-reduced. + llvm::SmallBitVector getDroppedDims(); + + /// Given a `value`, asserted to be of MemRefType, build a SubViewOp that + /// results in a rank reduction to the desired memref shape and return the + /// new value created. + /// If the shape of `value` is already the `desiredShape`, just return + /// `value`. + /// If the shape of `value` cannot be rank-reduced to `desiredShape`, fail. + static FailureOr rankReduceIfNeeded( + OpBuilder &b, Location loc, Value value, ArrayRef desiredShape); +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::SubViewOp) + +namespace mlir { +namespace memref { + +//===----------------------------------------------------------------------===// +// ::mlir::memref::TensorStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorStoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorStoreOpGenericAdaptorBase(TensorStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorStoreOpGenericAdaptor : public detail::TensorStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorStoreOpGenericAdaptorBase; +public: + TensorStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorStoreOpAdaptor : public TensorStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorStoreOpGenericAdaptor::TensorStoreOpGenericAdaptor; + TensorStoreOpAdaptor(TensorStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsShape, ::mlir::OpTrait::SameOperandsElementType, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorStoreOpAdaptor; + template + using GenericAdaptor = TensorStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("memref.tensor_store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::BaseMemRefType> getMemref(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value memref); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::TensorStoreOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..ef6d1dec4deb443492039c82fe8fb6d050e7fe48 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MemRefBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::memref::MemRefDialect) +namespace mlir { +namespace memref { + +MemRefDialect::MemRefDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + initialize(); +} + +MemRefDialect::~MemRefDialect() = default; + +} // namespace memref +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..377141738434ec96975a9a896426215037c6ddc9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: MemRefBase.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace memref { + +class MemRefDialect : public ::mlir::Dialect { + explicit MemRefDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~MemRefDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("memref"); + } + + /// Materialize a single constant operation from a given attribute value with + /// the desired resultant type. + ::mlir::Operation *materializeConstant(::mlir::OpBuilder &builder, + ::mlir::Attribute value, + ::mlir::Type type, + ::mlir::Location loc) override; +}; +} // namespace memref +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::memref::MemRefDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..eec43b7609c0dc5d0f6e11cd5e70bab068446d22 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.h @@ -0,0 +1,20 @@ +//===- ValueBoundsOpInterfaceImpl.h - Impl. of ValueBoundsOpInterface -----===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_IR_VALUEBOUNDSOPINTERFACEIMPL_H +#define MLIR_DIALECT_MEMREF_IR_VALUEBOUNDSOPINTERFACEIMPL_H + +namespace mlir { +class DialectRegistry; + +namespace memref { +void registerValueBoundsOpInterfaceExternalModels(DialectRegistry ®istry); +} // namespace memref +} // namespace mlir + +#endif // MLIR_DIALECT_MEMREF_IR_VALUEBOUNDSOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/AllocationOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/AllocationOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..aea05821fd1167cafdfb40388889aad7b59e39dd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/AllocationOpInterfaceImpl.h @@ -0,0 +1,20 @@ +//===- AllocationOpInterfaceImpl.h - Impl. of AllocationOpInterface -------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_ALLOCATIONOPINTERFACEIMPL_H +#define MLIR_DIALECT_MEMREF_ALLOCATIONOPINTERFACEIMPL_H + +namespace mlir { +class DialectRegistry; + +namespace memref { +void registerAllocationOpInterfaceExternalModels(DialectRegistry ®istry); +} // namespace memref +} // namespace mlir + +#endif // MLIR_DIALECT_MEMREF_ALLOCATIONOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/BufferizableOpInterfaceImpl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/BufferizableOpInterfaceImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..7e532100e4eeb74ca783b48ea77f5809c6bd4afa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/BufferizableOpInterfaceImpl.h @@ -0,0 +1,21 @@ +//===- BufferizableOpInterfaceImpl.h - Impl. of BufferizableOpInterface ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_BUFFERIZABLEOPINTERFACEIMPL_H +#define MLIR_DIALECT_MEMREF_BUFFERIZABLEOPINTERFACEIMPL_H + +namespace mlir { + +class DialectRegistry; + +namespace memref { +void registerBufferizableOpInterfaceExternalModels(DialectRegistry ®istry); +} // namespace memref +} // namespace mlir + +#endif // MLIR_DIALECT_MEMREF_BUFFERIZABLEOPINTERFACEIMPL_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/ComposeSubView.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/ComposeSubView.h new file mode 100644 index 0000000000000000000000000000000000000000..6a487d902cce9d480776cedb88d40805f5f7b137 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/ComposeSubView.h @@ -0,0 +1,28 @@ +//===- ComposeSubView.h - Combining composed memref ops ---------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Patterns for combining composed subview ops. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_TRANSFORMS_COMPOSESUBVIEW_H_ +#define MLIR_DIALECT_MEMREF_TRANSFORMS_COMPOSESUBVIEW_H_ + +namespace mlir { +class MLIRContext; +class RewritePatternSet; + +namespace memref { + +void populateComposeSubViewPatterns(RewritePatternSet &patterns, + MLIRContext *context); + +} // namespace memref +} // namespace mlir + +#endif // MLIR_DIALECT_MEMREF_TRANSFORMS_COMPOSESUBVIEW_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..f502aac799270946ea09d79268b2a89eff1f48ea --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h @@ -0,0 +1,90 @@ +//===- Passes.h - MemRef Patterns and Passes --------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header declares patterns and passes on MemRef operations. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_TRANSFORMS_PASSES_H +#define MLIR_DIALECT_MEMREF_TRANSFORMS_PASSES_H + +#include "mlir/Pass/Pass.h" + +namespace mlir { + +class AffineDialect; +class ModuleOp; + +namespace func { +namespace arith { +class ArithDialect; +} // namespace arith +class FuncDialect; +} // namespace func +namespace scf { +class SCFDialect; +} // namespace scf +namespace tensor { +class TensorDialect; +} // namespace tensor +namespace vector { +class VectorDialect; +} // namespace vector + +namespace memref { +//===----------------------------------------------------------------------===// +// Passes +//===----------------------------------------------------------------------===// + +#define GEN_PASS_DECL +#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc" + +/// Creates an instance of the ExpandOps pass that legalizes memref dialect ops +/// to be convertible to LLVM. For example, `memref.reshape` gets converted to +/// `memref_reinterpret_cast`. +std::unique_ptr createExpandOpsPass(); + +/// Creates an operation pass to fold memref aliasing ops into consumer +/// load/store ops into `patterns`. +std::unique_ptr createFoldMemRefAliasOpsPass(); + +/// Creates an interprocedural pass to normalize memrefs to have a trivial +/// (identity) layout map. +std::unique_ptr> createNormalizeMemRefsPass(); + +/// Creates an operation pass to resolve `memref.dim` operations with values +/// that are defined by operations that implement the +/// `ReifyRankedShapeTypeShapeOpInterface`, in terms of shapes of its input +/// operands. +std::unique_ptr createResolveRankedShapeTypeResultDimsPass(); + +/// Creates an operation pass to resolve `memref.dim` operations with values +/// that are defined by operations that implement the +/// `InferShapedTypeOpInterface` or the `ReifyRankedShapeTypeShapeOpInterface`, +/// in terms of shapes of its input operands. +std::unique_ptr createResolveShapedTypeResultDimsPass(); + +/// Creates an operation pass to expand some memref operation into +/// easier to reason about operations. +std::unique_ptr createExpandStridedMetadataPass(); + +/// Creates an operation pass to expand `memref.realloc` operations into their +/// components. +std::unique_ptr createExpandReallocPass(bool emitDeallocs = true); + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +#define GEN_PASS_REGISTRATION +#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc" + +} // namespace memref +} // namespace mlir + +#endif // MLIR_DIALECT_MEMREF_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..b73f8d1abf082d219369f2ff9ddb1c9e3f5d9b16 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h.inc @@ -0,0 +1,1098 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_EXPANDOPS +#define GEN_PASS_DECL_EXPANDREALLOC +#define GEN_PASS_DECL_EXPANDSTRIDEDMETADATA +#define GEN_PASS_DECL_FOLDMEMREFALIASOPS +#define GEN_PASS_DECL_MEMREFEMULATEWIDEINT +#define GEN_PASS_DECL_NORMALIZEMEMREFS +#define GEN_PASS_DECL_RESOLVERANKEDSHAPETYPERESULTDIMS +#define GEN_PASS_DECL_RESOLVESHAPEDTYPERESULTDIMS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// ExpandOps +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXPANDOPS +#undef GEN_PASS_DECL_EXPANDOPS +#endif // GEN_PASS_DECL_EXPANDOPS +#ifdef GEN_PASS_DEF_EXPANDOPS +namespace impl { + +template +class ExpandOpsBase : public ::mlir::OperationPass<> { +public: + using Base = ExpandOpsBase; + + ExpandOpsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ExpandOpsBase(const ExpandOpsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("memref-expand"); + } + ::llvm::StringRef getArgument() const override { return "memref-expand"; } + + ::llvm::StringRef getDescription() const override { return "Legalize memref operations to be convertible to LLVM."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExpandOps"); + } + ::llvm::StringRef getName() const override { return "ExpandOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExpandOpsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXPANDOPS +#endif // GEN_PASS_DEF_EXPANDOPS + +//===----------------------------------------------------------------------===// +// ExpandRealloc +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXPANDREALLOC +struct ExpandReallocOptions { + bool emitDeallocs = true; +}; +#undef GEN_PASS_DECL_EXPANDREALLOC +#endif // GEN_PASS_DECL_EXPANDREALLOC +#ifdef GEN_PASS_DEF_EXPANDREALLOC +namespace impl { + +template +class ExpandReallocBase : public ::mlir::OperationPass<> { +public: + using Base = ExpandReallocBase; + + ExpandReallocBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ExpandReallocBase(const ExpandReallocBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("expand-realloc"); + } + ::llvm::StringRef getArgument() const override { return "expand-realloc"; } + + ::llvm::StringRef getDescription() const override { return "Expand memref.realloc operations into its components"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExpandRealloc"); + } + ::llvm::StringRef getName() const override { return "ExpandRealloc"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExpandReallocBase) + + ExpandReallocBase(const ExpandReallocOptions &options) : ExpandReallocBase() { + emitDeallocs = options.emitDeallocs; + } +protected: + ::mlir::Pass::Option emitDeallocs{*this, "emit-deallocs", ::llvm::cl::desc("Emit deallocation operations for the original MemRef"), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXPANDREALLOC +#endif // GEN_PASS_DEF_EXPANDREALLOC + +//===----------------------------------------------------------------------===// +// ExpandStridedMetadata +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXPANDSTRIDEDMETADATA +#undef GEN_PASS_DECL_EXPANDSTRIDEDMETADATA +#endif // GEN_PASS_DECL_EXPANDSTRIDEDMETADATA +#ifdef GEN_PASS_DEF_EXPANDSTRIDEDMETADATA +namespace impl { + +template +class ExpandStridedMetadataBase : public ::mlir::OperationPass<> { +public: + using Base = ExpandStridedMetadataBase; + + ExpandStridedMetadataBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ExpandStridedMetadataBase(const ExpandStridedMetadataBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("expand-strided-metadata"); + } + ::llvm::StringRef getArgument() const override { return "expand-strided-metadata"; } + + ::llvm::StringRef getDescription() const override { return "Expand memref operations into easier to analyze constructs"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExpandStridedMetadata"); + } + ::llvm::StringRef getName() const override { return "ExpandStridedMetadata"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExpandStridedMetadataBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXPANDSTRIDEDMETADATA +#endif // GEN_PASS_DEF_EXPANDSTRIDEDMETADATA + +//===----------------------------------------------------------------------===// +// FoldMemRefAliasOps +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FOLDMEMREFALIASOPS +#undef GEN_PASS_DECL_FOLDMEMREFALIASOPS +#endif // GEN_PASS_DECL_FOLDMEMREFALIASOPS +#ifdef GEN_PASS_DEF_FOLDMEMREFALIASOPS +namespace impl { + +template +class FoldMemRefAliasOpsBase : public ::mlir::OperationPass<> { +public: + using Base = FoldMemRefAliasOpsBase; + + FoldMemRefAliasOpsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + FoldMemRefAliasOpsBase(const FoldMemRefAliasOpsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("fold-memref-alias-ops"); + } + ::llvm::StringRef getArgument() const override { return "fold-memref-alias-ops"; } + + ::llvm::StringRef getDescription() const override { return "Fold memref alias ops into consumer load/store ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FoldMemRefAliasOps"); + } + ::llvm::StringRef getName() const override { return "FoldMemRefAliasOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FoldMemRefAliasOpsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FOLDMEMREFALIASOPS +#endif // GEN_PASS_DEF_FOLDMEMREFALIASOPS + +//===----------------------------------------------------------------------===// +// MemRefEmulateWideInt +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MEMREFEMULATEWIDEINT +struct MemRefEmulateWideIntOptions { + unsigned widestIntSupported = 32; +}; +std::unique_ptr<::mlir::Pass> createMemRefEmulateWideInt(); +std::unique_ptr<::mlir::Pass> createMemRefEmulateWideInt(const MemRefEmulateWideIntOptions &options); +#undef GEN_PASS_DECL_MEMREFEMULATEWIDEINT +#endif // GEN_PASS_DECL_MEMREFEMULATEWIDEINT +#ifdef GEN_PASS_DEF_MEMREFEMULATEWIDEINT + +namespace impl { + std::unique_ptr<::mlir::Pass> createMemRefEmulateWideInt(); +} // namespace impl + +namespace impl { + std::unique_ptr<::mlir::Pass> createMemRefEmulateWideInt(const MemRefEmulateWideIntOptions &options); +} // namespace impl +namespace impl { + +template +class MemRefEmulateWideIntBase : public ::mlir::OperationPass<> { +public: + using Base = MemRefEmulateWideIntBase; + + MemRefEmulateWideIntBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + MemRefEmulateWideIntBase(const MemRefEmulateWideIntBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("memref-emulate-wide-int"); + } + ::llvm::StringRef getArgument() const override { return "memref-emulate-wide-int"; } + + ::llvm::StringRef getDescription() const override { return "Emulate 2*N-bit integer operations using N-bit operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MemRefEmulateWideInt"); + } + ::llvm::StringRef getName() const override { return "MemRefEmulateWideInt"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MemRefEmulateWideIntBase) + + MemRefEmulateWideIntBase(const MemRefEmulateWideIntOptions &options) : MemRefEmulateWideIntBase() { + widestIntSupported = options.widestIntSupported; + } +protected: + ::mlir::Pass::Option widestIntSupported{*this, "widest-int-supported", ::llvm::cl::desc("Widest integer type supported by the target"), ::llvm::cl::init(32)}; +private: + + friend std::unique_ptr<::mlir::Pass> createMemRefEmulateWideInt() { + return std::make_unique(); + } + + friend std::unique_ptr<::mlir::Pass> createMemRefEmulateWideInt(const MemRefEmulateWideIntOptions &options) { + return std::make_unique(options); + } +}; +} // namespace impl + +std::unique_ptr<::mlir::Pass> createMemRefEmulateWideInt() { + return impl::createMemRefEmulateWideInt(); +} + +std::unique_ptr<::mlir::Pass> createMemRefEmulateWideInt(const MemRefEmulateWideIntOptions &options) { + return impl::createMemRefEmulateWideInt(options); +} +#undef GEN_PASS_DEF_MEMREFEMULATEWIDEINT +#endif // GEN_PASS_DEF_MEMREFEMULATEWIDEINT + +//===----------------------------------------------------------------------===// +// NormalizeMemRefs +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_NORMALIZEMEMREFS +#undef GEN_PASS_DECL_NORMALIZEMEMREFS +#endif // GEN_PASS_DECL_NORMALIZEMEMREFS +#ifdef GEN_PASS_DEF_NORMALIZEMEMREFS +namespace impl { + +template +class NormalizeMemRefsBase : public ::mlir::OperationPass { +public: + using Base = NormalizeMemRefsBase; + + NormalizeMemRefsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + NormalizeMemRefsBase(const NormalizeMemRefsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("normalize-memrefs"); + } + ::llvm::StringRef getArgument() const override { return "normalize-memrefs"; } + + ::llvm::StringRef getDescription() const override { return "Normalize memrefs"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("NormalizeMemRefs"); + } + ::llvm::StringRef getName() const override { return "NormalizeMemRefs"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(NormalizeMemRefsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_NORMALIZEMEMREFS +#endif // GEN_PASS_DEF_NORMALIZEMEMREFS + +//===----------------------------------------------------------------------===// +// ResolveRankedShapeTypeResultDims +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_RESOLVERANKEDSHAPETYPERESULTDIMS +#undef GEN_PASS_DECL_RESOLVERANKEDSHAPETYPERESULTDIMS +#endif // GEN_PASS_DECL_RESOLVERANKEDSHAPETYPERESULTDIMS +#ifdef GEN_PASS_DEF_RESOLVERANKEDSHAPETYPERESULTDIMS +namespace impl { + +template +class ResolveRankedShapeTypeResultDimsBase : public ::mlir::OperationPass<> { +public: + using Base = ResolveRankedShapeTypeResultDimsBase; + + ResolveRankedShapeTypeResultDimsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ResolveRankedShapeTypeResultDimsBase(const ResolveRankedShapeTypeResultDimsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("resolve-ranked-shaped-type-result-dims"); + } + ::llvm::StringRef getArgument() const override { return "resolve-ranked-shaped-type-result-dims"; } + + ::llvm::StringRef getDescription() const override { return "Resolve memref.dim of result values of ranked shape type"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResolveRankedShapeTypeResultDims"); + } + ::llvm::StringRef getName() const override { return "ResolveRankedShapeTypeResultDims"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResolveRankedShapeTypeResultDimsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_RESOLVERANKEDSHAPETYPERESULTDIMS +#endif // GEN_PASS_DEF_RESOLVERANKEDSHAPETYPERESULTDIMS + +//===----------------------------------------------------------------------===// +// ResolveShapedTypeResultDims +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_RESOLVESHAPEDTYPERESULTDIMS +#undef GEN_PASS_DECL_RESOLVESHAPEDTYPERESULTDIMS +#endif // GEN_PASS_DECL_RESOLVESHAPEDTYPERESULTDIMS +#ifdef GEN_PASS_DEF_RESOLVESHAPEDTYPERESULTDIMS +namespace impl { + +template +class ResolveShapedTypeResultDimsBase : public ::mlir::OperationPass<> { +public: + using Base = ResolveShapedTypeResultDimsBase; + + ResolveShapedTypeResultDimsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ResolveShapedTypeResultDimsBase(const ResolveShapedTypeResultDimsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("resolve-shaped-type-result-dims"); + } + ::llvm::StringRef getArgument() const override { return "resolve-shaped-type-result-dims"; } + + ::llvm::StringRef getDescription() const override { return "Resolve memref.dim of result values"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResolveShapedTypeResultDims"); + } + ::llvm::StringRef getName() const override { return "ResolveShapedTypeResultDims"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResolveShapedTypeResultDimsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_RESOLVESHAPEDTYPERESULTDIMS +#endif // GEN_PASS_DEF_RESOLVESHAPEDTYPERESULTDIMS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// ExpandOps Registration +//===----------------------------------------------------------------------===// + +inline void registerExpandOps() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createExpandOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExpandOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createExpandOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExpandRealloc Registration +//===----------------------------------------------------------------------===// + +inline void registerExpandRealloc() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createExpandReallocPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExpandReallocPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createExpandReallocPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExpandStridedMetadata Registration +//===----------------------------------------------------------------------===// + +inline void registerExpandStridedMetadata() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createExpandStridedMetadataPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExpandStridedMetadataPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createExpandStridedMetadataPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FoldMemRefAliasOps Registration +//===----------------------------------------------------------------------===// + +inline void registerFoldMemRefAliasOps() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createFoldMemRefAliasOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFoldMemRefAliasOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createFoldMemRefAliasOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MemRefEmulateWideInt Registration +//===----------------------------------------------------------------------===// + +inline void registerMemRefEmulateWideInt() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createMemRefEmulateWideInt(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMemRefEmulateWideIntPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createMemRefEmulateWideInt(); + }); +} + +//===----------------------------------------------------------------------===// +// NormalizeMemRefs Registration +//===----------------------------------------------------------------------===// + +inline void registerNormalizeMemRefs() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createNormalizeMemRefsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerNormalizeMemRefsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createNormalizeMemRefsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ResolveRankedShapeTypeResultDims Registration +//===----------------------------------------------------------------------===// + +inline void registerResolveRankedShapeTypeResultDims() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createResolveRankedShapeTypeResultDimsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerResolveRankedShapeTypeResultDimsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createResolveRankedShapeTypeResultDimsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ResolveShapedTypeResultDims Registration +//===----------------------------------------------------------------------===// + +inline void registerResolveShapedTypeResultDims() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createResolveShapedTypeResultDimsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerResolveShapedTypeResultDimsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::memref::createResolveShapedTypeResultDimsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MemRef Registration +//===----------------------------------------------------------------------===// + +inline void registerMemRefPasses() { + registerExpandOps(); + registerExpandRealloc(); + registerExpandStridedMetadata(); + registerFoldMemRefAliasOps(); + registerMemRefEmulateWideInt(); + registerNormalizeMemRefs(); + registerResolveRankedShapeTypeResultDims(); + registerResolveShapedTypeResultDims(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class ExpandOpsBase : public ::mlir::OperationPass<> { +public: + using Base = ExpandOpsBase; + + ExpandOpsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ExpandOpsBase(const ExpandOpsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("memref-expand"); + } + ::llvm::StringRef getArgument() const override { return "memref-expand"; } + + ::llvm::StringRef getDescription() const override { return "Legalize memref operations to be convertible to LLVM."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExpandOps"); + } + ::llvm::StringRef getName() const override { return "ExpandOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExpandOpsBase) + +protected: +}; + +template +class ExpandReallocBase : public ::mlir::OperationPass<> { +public: + using Base = ExpandReallocBase; + + ExpandReallocBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ExpandReallocBase(const ExpandReallocBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("expand-realloc"); + } + ::llvm::StringRef getArgument() const override { return "expand-realloc"; } + + ::llvm::StringRef getDescription() const override { return "Expand memref.realloc operations into its components"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExpandRealloc"); + } + ::llvm::StringRef getName() const override { return "ExpandRealloc"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExpandReallocBase) + +protected: + ::mlir::Pass::Option emitDeallocs{*this, "emit-deallocs", ::llvm::cl::desc("Emit deallocation operations for the original MemRef"), ::llvm::cl::init(true)}; +}; + +template +class ExpandStridedMetadataBase : public ::mlir::OperationPass<> { +public: + using Base = ExpandStridedMetadataBase; + + ExpandStridedMetadataBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ExpandStridedMetadataBase(const ExpandStridedMetadataBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("expand-strided-metadata"); + } + ::llvm::StringRef getArgument() const override { return "expand-strided-metadata"; } + + ::llvm::StringRef getDescription() const override { return "Expand memref operations into easier to analyze constructs"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExpandStridedMetadata"); + } + ::llvm::StringRef getName() const override { return "ExpandStridedMetadata"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExpandStridedMetadataBase) + +protected: +}; + +template +class FoldMemRefAliasOpsBase : public ::mlir::OperationPass<> { +public: + using Base = FoldMemRefAliasOpsBase; + + FoldMemRefAliasOpsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + FoldMemRefAliasOpsBase(const FoldMemRefAliasOpsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("fold-memref-alias-ops"); + } + ::llvm::StringRef getArgument() const override { return "fold-memref-alias-ops"; } + + ::llvm::StringRef getDescription() const override { return "Fold memref alias ops into consumer load/store ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FoldMemRefAliasOps"); + } + ::llvm::StringRef getName() const override { return "FoldMemRefAliasOps"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FoldMemRefAliasOpsBase) + +protected: +}; + +template +class MemRefEmulateWideIntBase : public ::mlir::OperationPass<> { +public: + using Base = MemRefEmulateWideIntBase; + + MemRefEmulateWideIntBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + MemRefEmulateWideIntBase(const MemRefEmulateWideIntBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("memref-emulate-wide-int"); + } + ::llvm::StringRef getArgument() const override { return "memref-emulate-wide-int"; } + + ::llvm::StringRef getDescription() const override { return "Emulate 2*N-bit integer operations using N-bit operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MemRefEmulateWideInt"); + } + ::llvm::StringRef getName() const override { return "MemRefEmulateWideInt"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MemRefEmulateWideIntBase) + +protected: + ::mlir::Pass::Option widestIntSupported{*this, "widest-int-supported", ::llvm::cl::desc("Widest integer type supported by the target"), ::llvm::cl::init(32)}; +}; + +template +class NormalizeMemRefsBase : public ::mlir::OperationPass { +public: + using Base = NormalizeMemRefsBase; + + NormalizeMemRefsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + NormalizeMemRefsBase(const NormalizeMemRefsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("normalize-memrefs"); + } + ::llvm::StringRef getArgument() const override { return "normalize-memrefs"; } + + ::llvm::StringRef getDescription() const override { return "Normalize memrefs"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("NormalizeMemRefs"); + } + ::llvm::StringRef getName() const override { return "NormalizeMemRefs"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(NormalizeMemRefsBase) + +protected: +}; + +template +class ResolveRankedShapeTypeResultDimsBase : public ::mlir::OperationPass<> { +public: + using Base = ResolveRankedShapeTypeResultDimsBase; + + ResolveRankedShapeTypeResultDimsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ResolveRankedShapeTypeResultDimsBase(const ResolveRankedShapeTypeResultDimsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("resolve-ranked-shaped-type-result-dims"); + } + ::llvm::StringRef getArgument() const override { return "resolve-ranked-shaped-type-result-dims"; } + + ::llvm::StringRef getDescription() const override { return "Resolve memref.dim of result values of ranked shape type"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResolveRankedShapeTypeResultDims"); + } + ::llvm::StringRef getName() const override { return "ResolveRankedShapeTypeResultDims"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResolveRankedShapeTypeResultDimsBase) + +protected: +}; + +template +class ResolveShapedTypeResultDimsBase : public ::mlir::OperationPass<> { +public: + using Base = ResolveShapedTypeResultDimsBase; + + ResolveShapedTypeResultDimsBase() : ::mlir::OperationPass<>(::mlir::TypeID::get()) {} + ResolveShapedTypeResultDimsBase(const ResolveShapedTypeResultDimsBase &other) : ::mlir::OperationPass<>(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("resolve-shaped-type-result-dims"); + } + ::llvm::StringRef getArgument() const override { return "resolve-shaped-type-result-dims"; } + + ::llvm::StringRef getDescription() const override { return "Resolve memref.dim of result values"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResolveShapedTypeResultDims"); + } + ::llvm::StringRef getName() const override { return "ResolveShapedTypeResultDims"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResolveShapedTypeResultDimsBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/RuntimeOpVerification.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/RuntimeOpVerification.h new file mode 100644 index 0000000000000000000000000000000000000000..df6ce9f10762beaa49360041ebf0d953d99687a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/RuntimeOpVerification.h @@ -0,0 +1,21 @@ +//===- RuntimeOpVerification.h - Op Verification ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_RUNTIMEOPVERIFICATION_H +#define MLIR_DIALECT_MEMREF_RUNTIMEOPVERIFICATION_H + +namespace mlir { +class DialectRegistry; + +namespace memref { +void registerRuntimeVerifiableOpInterfaceExternalModels( + DialectRegistry ®istry); +} // namespace memref +} // namespace mlir + +#endif // MLIR_DIALECT_MEMREF_RUNTIMEOPVERIFICATION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..a918f62cbc8db8f20c0f8007531ac0a80c2f5b02 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h @@ -0,0 +1,213 @@ +//===- Transforms.h - MemRef Dialect transformations ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +/// This header declares functions that assist transformations in the MemRef +/// dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_TRANSFORMS_TRANSFORMS_H +#define MLIR_DIALECT_MEMREF_TRANSFORMS_TRANSFORMS_H + +#include "mlir/Support/LogicalResult.h" +#include "llvm/ADT/STLFunctionalExtras.h" + +namespace mlir { +class OpBuilder; +class RewritePatternSet; +class RewriterBase; +class Value; +class ValueRange; + +namespace arith { +class WideIntEmulationConverter; +class NarrowTypeEmulationConverter; +} // namespace arith + +namespace memref { +class AllocOp; +class AllocaOp; +class DeallocOp; + +//===----------------------------------------------------------------------===// +// Patterns +//===----------------------------------------------------------------------===// + +/// Collects a set of patterns to rewrite ops within the memref dialect. +void populateExpandOpsPatterns(RewritePatternSet &patterns); + +/// Appends patterns for folding memref aliasing ops into consumer load/store +/// ops into `patterns`. +void populateFoldMemRefAliasOpPatterns(RewritePatternSet &patterns); + +/// Appends patterns that resolve `memref.dim` operations with values that are +/// defined by operations that implement the +/// `ReifyRankedShapedTypeOpInterface`, in terms of shapes of its input +/// operands. +void populateResolveRankedShapedTypeResultDimsPatterns( + RewritePatternSet &patterns); + +/// Appends patterns that resolve `memref.dim` operations with values that are +/// defined by operations that implement the `InferShapedTypeOpInterface`, in +/// terms of shapes of its input operands. +void populateResolveShapedTypeResultDimsPatterns(RewritePatternSet &patterns); + +/// Appends patterns for expanding memref operations that modify the metadata +/// (sizes, offset, strides) of a memref into easier to analyze constructs. +void populateExpandStridedMetadataPatterns(RewritePatternSet &patterns); + +/// Appends patterns for resolving `memref.extract_strided_metadata` into +/// `memref.extract_strided_metadata` of its source. +void populateResolveExtractStridedMetadataPatterns(RewritePatternSet &patterns); + +/// Appends patterns for expanding `memref.realloc` operations. +void populateExpandReallocPatterns(RewritePatternSet &patterns, + bool emitDeallocs = true); + +/// Appends patterns for emulating wide integer memref operations with ops over +/// narrower integer types. +void populateMemRefWideIntEmulationPatterns( + arith::WideIntEmulationConverter &typeConverter, + RewritePatternSet &patterns); + +/// Appends type conversions for emulating wide integer memref operations with +/// ops over narrowe integer types. +void populateMemRefWideIntEmulationConversions( + arith::WideIntEmulationConverter &typeConverter); + +/// Appends patterns for emulating memref operations over narrow types with ops +/// over wider types. +void populateMemRefNarrowTypeEmulationPatterns( + arith::NarrowTypeEmulationConverter &typeConverter, + RewritePatternSet &patterns); + +/// Appends type conversions for emulating memref operations over narrow types +/// with ops over wider types. +void populateMemRefNarrowTypeEmulationConversions( + arith::NarrowTypeEmulationConverter &typeConverter); + +/// Transformation to do multi-buffering/array expansion to remove dependencies +/// on the temporary allocation between consecutive loop iterations. +/// It returns the new allocation if the original allocation was multi-buffered +/// and returns failure() otherwise. +/// When `skipOverrideAnalysis`, the pass will apply the transformation +/// without checking thwt the buffer is overrided at the beginning of each +/// iteration. This implies that user knows that there is no data carried across +/// loop iterations. Example: +/// ``` +/// %0 = memref.alloc() : memref<4x128xf32> +/// scf.for %iv = %c1 to %c1024 step %c3 { +/// memref.copy %1, %0 : memref<4x128xf32> to memref<4x128xf32> +/// "some_use"(%0) : (memref<4x128xf32>) -> () +/// } +/// ``` +/// into: +/// ``` +/// %0 = memref.alloc() : memref<5x4x128xf32> +/// scf.for %iv = %c1 to %c1024 step %c3 { +/// %s = arith.subi %iv, %c1 : index +/// %d = arith.divsi %s, %c3 : index +/// %i = arith.remsi %d, %c5 : index +/// %sv = memref.subview %0[%i, 0, 0] [1, 4, 128] [1, 1, 1] : +/// memref<5x4x128xf32> to memref<4x128xf32, strided<[128, 1], offset: ?>> +/// memref.copy %1, %sv : memref<4x128xf32> to memref<4x128xf32, strided<...>> +/// "some_use"(%sv) : (memref<4x128xf32, strided<...>) -> () +/// } +/// ``` +FailureOr multiBuffer(RewriterBase &rewriter, + memref::AllocOp allocOp, + unsigned multiplier, + bool skipOverrideAnalysis = false); +/// Call into `multiBuffer` with locally constructed IRRewriter. +FailureOr multiBuffer(memref::AllocOp allocOp, + unsigned multiplier, + bool skipOverrideAnalysis = false); + +/// Appends patterns for extracting address computations from the instructions +/// with memory accesses such that these memory accesses use only a base +/// pointer. +/// +/// For instance, +/// ```mlir +/// memref.load %base[%off0, ...] +/// ``` +/// +/// Will be rewritten in: +/// ```mlir +/// %new_base = memref.subview %base[%off0,...][1,...][1,...] +/// memref.load %new_base[%c0,...] +/// ``` +void populateExtractAddressComputationsPatterns(RewritePatternSet &patterns); + +/// Build a new memref::AllocaOp whose dynamic sizes are independent of all +/// given independencies. If the op is already independent of all +/// independencies, the same AllocaOp result is returned. +/// +/// Failure indicates the no suitable upper bound for the dynamic sizes could be +/// found. +FailureOr buildIndependentOp(OpBuilder &b, AllocaOp allocaOp, + ValueRange independencies); + +/// Build a new memref::AllocaOp whose dynamic sizes are independent of all +/// given independencies. If the op is already independent of all +/// independencies, the same AllocaOp result is returned. +/// +/// The original AllocaOp is replaced with the new one, wrapped in a SubviewOp. +/// The result type of the replacement is different from the original allocation +/// type: it has the same shape, but a different layout map. This function +/// updates all users that do not have a memref result or memref region block +/// argument, and some frequently used memref dialect ops (such as +/// memref.subview). It does not update other uses such as the init_arg of an +/// scf.for op. Such uses are wrapped in unrealized_conversion_cast. +/// +/// Failure indicates the no suitable upper bound for the dynamic sizes could be +/// found. +/// +/// Example (make independent of %iv): +/// ``` +/// scf.for %iv = %c0 to %sz step %c1 { +/// %0 = memref.alloca(%iv) : memref +/// %1 = memref.subview %0[0][5][1] : ... +/// linalg.generic outs(%1 : ...) ... +/// %2 = scf.for ... iter_arg(%arg0 = %0) ... +/// ... +/// } +/// ``` +/// +/// The above IR is rewritten to: +/// +/// ``` +/// scf.for %iv = %c0 to %sz step %c1 { +/// %0 = memref.alloca(%sz - 1) : memref +/// %0_subview = memref.subview %0[0][%iv][1] +/// : memref to memref +/// %1 = memref.subview %0_subview[0][5][1] : ... +/// linalg.generic outs(%1 : ...) ... +/// %cast = unrealized_conversion_cast %0_subview +/// : memref to memref +/// %2 = scf.for ... iter_arg(%arg0 = %cast) ... +/// ... +/// } +/// ``` +FailureOr replaceWithIndependentOp(RewriterBase &rewriter, + memref::AllocaOp allocaOp, + ValueRange independencies); + +/// Replaces the given `alloc` with the corresponding `alloca` and returns it if +/// the following conditions are met: +/// - the corresponding dealloc is available in the same block as the alloc; +/// - the filter, if provided, succeeds on the alloc/dealloc pair. +/// Otherwise returns nullptr and leaves the IR unchanged. +memref::AllocaOp allocToAlloca( + RewriterBase &rewriter, memref::AllocOp alloc, + function_ref filter = nullptr); + +} // namespace memref +} // namespace mlir + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..7d9a5e6ca7596cb32a33b0c5a029fcff321e240c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h @@ -0,0 +1,70 @@ +//===- MemRefUtils.h - MemRef transformation utilities ----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header file defines prototypes for various transformation utilities for +// the MemRefOps dialect. These are not passes by themselves but are used +// either by passes, optimization sequences, or in turn by other transformation +// utilities. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_MEMREF_UTILS_MEMREFUTILS_H +#define MLIR_DIALECT_MEMREF_UTILS_MEMREFUTILS_H + +#include "mlir/Dialect/MemRef/IR/MemRef.h" + +namespace mlir { + +class MemRefType; + +namespace memref { + +/// Returns true, if the memref type has static shapes and represents a +/// contiguous chunk of memory. +bool isStaticShapeAndContiguousRowMajor(MemRefType type); + +/// For a `memref` with `offset`, `sizes` and `strides`, returns the +/// offset and size to use for the linearized `memref`. +/// - If the linearization is done for emulating load/stores of +/// element type with bitwidth `srcBits` using element type with +/// bitwidth `dstBits`, the linearized offset and size are +/// scaled down by `dstBits`/`srcBits`. +/// - If `indices` is provided, it represents the position in the +/// original `memref` being accessed. The method then returns the +/// index to use in the linearized `memref`. The linearized index +/// is also scaled down by `dstBits`/`srcBits`. If `indices` is not provided +/// 0, is returned for the linearized index. +struct LinearizedMemRefInfo { + OpFoldResult linearizedOffset; + OpFoldResult linearizedSize; +}; +std::pair getLinearizedMemRefOffsetAndSize( + OpBuilder &builder, Location loc, int srcBits, int dstBits, + OpFoldResult offset, ArrayRef sizes, + ArrayRef strides, ArrayRef indices = {}); + +/// For a `memref` with `offset` and `sizes`, returns the +/// offset and size to use for the linearized `memref`, assuming that +/// the strides are computed from a row-major ordering of the sizes; +/// - If the linearization is done for emulating load/stores of +/// element type with bitwidth `srcBits` using element type with +/// bitwidth `dstBits`, the linearized offset and size are +/// scaled down by `dstBits`/`srcBits`. +LinearizedMemRefInfo +getLinearizedMemRefOffsetAndSize(OpBuilder &builder, Location loc, int srcBits, + int dstBits, OpFoldResult offset, + ArrayRef sizes); + +// Track temporary allocations that are never read from. If this is the case +// it means both the allocations and associated stores can be removed. +void eraseDeadAllocAndStores(RewriterBase &rewriter, Operation *parentOp); + +} // namespace memref +} // namespace mlir + +#endif // MLIR_DIALECT_MEMREF_UTILS_MEMREFUTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPU.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPU.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..acf81de40879525bbdffeb09f4b272243dd7853b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPU.cpp.inc @@ -0,0 +1,6208 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::nvgpu::DeviceAsyncCopyOp, +::mlir::nvgpu::DeviceAsyncCreateGroupOp, +::mlir::nvgpu::DeviceAsyncWaitOp, +::mlir::nvgpu::LdMatrixOp, +::mlir::nvgpu::MBarrierArriveExpectTxOp, +::mlir::nvgpu::MBarrierArriveNoCompleteOp, +::mlir::nvgpu::MBarrierArriveOp, +::mlir::nvgpu::MBarrierCreateOp, +::mlir::nvgpu::MBarrierInitOp, +::mlir::nvgpu::MBarrierTestWaitOp, +::mlir::nvgpu::MBarrierTryWaitParityOp, +::mlir::nvgpu::MmaSparseSyncOp, +::mlir::nvgpu::MmaSyncOp, +::mlir::nvgpu::TmaAsyncLoadOp, +::mlir::nvgpu::TmaCreateDescriptorOp, +::mlir::nvgpu::WarpgroupGenerateDescriptorOp, +::mlir::nvgpu::WarpgroupMmaOp, +::mlir::nvgpu::WarpgroupMmaStoreOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace nvgpu { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IndexType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::nvgpu::DeviceAsyncTokenType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be device async token type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be vector of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::nvgpu::MBarrierGroupType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be mbarrier barrier type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::nvgpu::MBarrierTokenType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be , but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::VectorType>(type) && + !::llvm::cast(type).isScalable())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(16)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::VectorType>(type) && + !::llvm::cast(type).isScalable())) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() + == 2))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be fixed-length vector of 16-bit signless integer values of length 2, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::nvgpu::TensorMapDescriptorType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be TensorMap descriptor, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::UnrankedMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be unranked.memref of any type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::nvgpu::WarpgroupMatrixDescriptorType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be Warpgroup matrix descriptor type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_NVGPU11( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::nvgpu::WarpgroupAccumulatorType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be , but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(attr).getType()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: index attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVGPU0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVGPU1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVGPU2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: bool attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVGPU3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit integer array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_NVGPU4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_NVGPU4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::DeviceAsyncCopyOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeviceAsyncCopyOpGenericAdaptorBase::DeviceAsyncCopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.device_async_copy", odsAttrs.getContext()); +} + +DeviceAsyncCopyOpGenericAdaptorBase::DeviceAsyncCopyOpGenericAdaptorBase(DeviceAsyncCopyOp op) : DeviceAsyncCopyOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeviceAsyncCopyOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DeviceAsyncCopyOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr DeviceAsyncCopyOpGenericAdaptorBase::getDstElementsAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().dstElements); + return attr; +} + +::llvm::APInt DeviceAsyncCopyOpGenericAdaptorBase::getDstElements() { + auto attr = getDstElementsAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr DeviceAsyncCopyOpGenericAdaptorBase::getBypassL1Attr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().bypassL1); + return attr; +} + +::std::optional DeviceAsyncCopyOpGenericAdaptorBase::getBypassL1() { + auto attr = getBypassL1Attr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +} // namespace detail +DeviceAsyncCopyOpAdaptor::DeviceAsyncCopyOpAdaptor(DeviceAsyncCopyOp op) : DeviceAsyncCopyOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeviceAsyncCopyOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_bypassL1 = getProperties().bypassL1; (void)tblgen_bypassL1; + auto tblgen_dstElements = getProperties().dstElements; (void)tblgen_dstElements; + if (!tblgen_dstElements) return emitError(loc, "'nvgpu.device_async_copy' op ""requires attribute 'dstElements'"); + + if (tblgen_dstElements && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_dstElements))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(tblgen_dstElements).getType()))))) + return emitError(loc, "'nvgpu.device_async_copy' op ""attribute 'dstElements' failed to satisfy constraint: index attribute"); + + if (tblgen_bypassL1 && !((::llvm::isa<::mlir::UnitAttr>(tblgen_bypassL1)))) + return emitError(loc, "'nvgpu.device_async_copy' op ""attribute 'bypassL1' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair DeviceAsyncCopyOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DeviceAsyncCopyOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> DeviceAsyncCopyOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range DeviceAsyncCopyOp::getDstIndices() { + return getODSOperands(1); +} + +::mlir::TypedValue<::mlir::MemRefType> DeviceAsyncCopyOp::getSrc() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(2).begin()); +} + +::mlir::Operation::operand_range DeviceAsyncCopyOp::getSrcIndices() { + return getODSOperands(3); +} + +::mlir::TypedValue<::mlir::IndexType> DeviceAsyncCopyOp::getSrcElements() { + auto operands = getODSOperands(4); + return operands.empty() ? ::mlir::TypedValue<::mlir::IndexType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*operands.begin()); +} + +::mlir::OpOperand &DeviceAsyncCopyOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange DeviceAsyncCopyOp::getDstIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::OpOperand &DeviceAsyncCopyOp::getSrcMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange DeviceAsyncCopyOp::getSrcIndicesMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DeviceAsyncCopyOp::getSrcElementsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DeviceAsyncCopyOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeviceAsyncCopyOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::DeviceAsyncTokenType> DeviceAsyncCopyOp::getAsyncToken() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::DeviceAsyncTokenType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult DeviceAsyncCopyOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.bypassL1; + auto attr = dict.get("bypassL1"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for bypassL1 in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `bypassL1` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.dstElements; + auto attr = dict.get("dstElements"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for dstElements in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dstElements` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DeviceAsyncCopyOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.bypassL1; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("bypassL1", + propStorage)); + } + + { + const auto &propStorage = prop.dstElements; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dstElements", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DeviceAsyncCopyOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.bypassL1.getAsOpaquePointer()), + llvm::hash_value(prop.dstElements.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DeviceAsyncCopyOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "bypassL1") + return prop.bypassL1; + + if (name == "dstElements") + return prop.dstElements; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DeviceAsyncCopyOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "bypassL1") { + prop.bypassL1 = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "dstElements") { + prop.dstElements = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DeviceAsyncCopyOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.bypassL1) attrs.append("bypassL1", prop.bypassL1); + + if (prop.dstElements) attrs.append("dstElements", prop.dstElements); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DeviceAsyncCopyOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBypassL1AttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(attr, "bypassL1", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getDstElementsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU0(attr, "dstElements", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeviceAsyncCopyOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.bypassL1))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.dstElements))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DeviceAsyncCopyOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.bypassL1); + writer.writeAttribute(prop.dstElements); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::IntegerAttr DeviceAsyncCopyOp::getDstElementsAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().dstElements); +} + +::llvm::APInt DeviceAsyncCopyOp::getDstElements() { + auto attr = getDstElementsAttr(); + return attr.getValue(); +} + +::mlir::UnitAttr DeviceAsyncCopyOp::getBypassL1Attr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().bypassL1); +} + +::std::optional DeviceAsyncCopyOp::getBypassL1() { + auto attr = getBypassL1Attr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +void DeviceAsyncCopyOp::setDstElementsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getDstElementsAttrName(), attr); +} + +void DeviceAsyncCopyOp::setDstElements(::llvm::APInt attrValue) { + (*this)->setAttr(getDstElementsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIndexType(), attrValue)); +} + +void DeviceAsyncCopyOp::setBypassL1Attr(::mlir::UnitAttr attr) { + (*this)->setAttr(getBypassL1AttrName(), attr); +} + +void DeviceAsyncCopyOp::setBypassL1(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getBypassL1AttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getBypassL1AttrName()); +} + +::mlir::Attribute DeviceAsyncCopyOp::removeBypassL1Attr() { + auto &attr = getProperties().bypassL1; + attr = {}; + return attr; +} + +void DeviceAsyncCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type asyncToken, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::IntegerAttr dstElements, /*optional*/::mlir::Value srcElements, /*optional*/::mlir::UnitAttr bypassL1) { + odsState.addOperands(dst); + odsState.addOperands(dstIndices); + odsState.addOperands(src); + odsState.addOperands(srcIndices); + if (srcElements) + odsState.addOperands(srcElements); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(dstIndices.size()), 1, static_cast(srcIndices.size()), (srcElements ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dstElements = dstElements; + if (bypassL1) { + odsState.getOrAddProperties().bypassL1 = bypassL1; + } + odsState.addTypes(asyncToken); +} + +void DeviceAsyncCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::IntegerAttr dstElements, /*optional*/::mlir::Value srcElements, /*optional*/::mlir::UnitAttr bypassL1) { + odsState.addOperands(dst); + odsState.addOperands(dstIndices); + odsState.addOperands(src); + odsState.addOperands(srcIndices); + if (srcElements) + odsState.addOperands(srcElements); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(dstIndices.size()), 1, static_cast(srcIndices.size()), (srcElements ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dstElements = dstElements; + if (bypassL1) { + odsState.getOrAddProperties().bypassL1 = bypassL1; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeviceAsyncCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type asyncToken, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::llvm::APInt dstElements, /*optional*/::mlir::Value srcElements, /*optional*/::mlir::UnitAttr bypassL1) { + odsState.addOperands(dst); + odsState.addOperands(dstIndices); + odsState.addOperands(src); + odsState.addOperands(srcIndices); + if (srcElements) + odsState.addOperands(srcElements); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(dstIndices.size()), 1, static_cast(srcIndices.size()), (srcElements ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dstElements = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), dstElements); + if (bypassL1) { + odsState.getOrAddProperties().bypassL1 = bypassL1; + } + odsState.addTypes(asyncToken); +} + +void DeviceAsyncCopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::llvm::APInt dstElements, /*optional*/::mlir::Value srcElements, /*optional*/::mlir::UnitAttr bypassL1) { + odsState.addOperands(dst); + odsState.addOperands(dstIndices); + odsState.addOperands(src); + odsState.addOperands(srcIndices); + if (srcElements) + odsState.addOperands(srcElements); + ::llvm::copy(::llvm::ArrayRef({1, static_cast(dstIndices.size()), 1, static_cast(srcIndices.size()), (srcElements ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dstElements = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), dstElements); + if (bypassL1) { + odsState.getOrAddProperties().bypassL1 = bypassL1; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeviceAsyncCopyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DeviceAsyncCopyOp::verifyInvariantsImpl() { + auto tblgen_bypassL1 = getProperties().bypassL1; (void)tblgen_bypassL1; + auto tblgen_dstElements = getProperties().dstElements; (void)tblgen_dstElements; + if (!tblgen_dstElements) return emitOpError("requires attribute 'dstElements'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU0(*this, tblgen_dstElements, "dstElements"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(*this, tblgen_bypassL1, "bypassL1"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + if (valueGroup4.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup4.size(); + } + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeviceAsyncCopyOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DeviceAsyncCopyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(srcRawOperands); ::llvm::SMLoc srcOperandsLoc; + (void)srcOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> srcIndicesOperands; + ::llvm::SMLoc srcIndicesOperandsLoc; + (void)srcIndicesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dstRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstOperands(dstRawOperands); ::llvm::SMLoc dstOperandsLoc; + (void)dstOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dstIndicesOperands; + ::llvm::SMLoc dstIndicesOperandsLoc; + (void)dstIndicesOperandsLoc; + ::mlir::IntegerAttr dstElementsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> srcElementsOperands; + ::llvm::SMLoc srcElementsOperandsLoc; + (void)srcElementsOperandsLoc; + ::mlir::Type srcRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcTypes(srcRawTypes); + ::mlir::Type dstRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstTypes(dstRawTypes); + + srcOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + srcIndicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(srcIndicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + dstOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + dstIndicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dstIndicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(dstElementsAttr, parser.getBuilder().getIndexType())) { + return ::mlir::failure(); + } + if (dstElementsAttr) result.getOrAddProperties().dstElements = dstElementsAttr; + if (::mlir::succeeded(parser.parseOptionalComma())) { + + { + srcElementsOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + srcElementsOperands.push_back(operand); + } + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcRawTypes[0] = type; + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstRawTypes[0] = type; + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(dstIndicesOperands.size()), 1, static_cast(srcIndicesOperands.size()), static_cast(srcElementsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::nvgpu::DeviceAsyncTokenType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(dstOperands, dstTypes, dstOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dstIndicesOperands, odsBuildableType1, dstIndicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(srcIndicesOperands, odsBuildableType1, srcIndicesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(srcElementsOperands, odsBuildableType1, srcElementsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeviceAsyncCopyOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrc(); + _odsPrinter << "["; + _odsPrinter << getSrcIndices(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDst(); + _odsPrinter << "["; + _odsPrinter << getDstIndices(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getDstElementsAttr()); + if (getSrcElements()) { + _odsPrinter << ","; + _odsPrinter << ' '; + if (::mlir::Value value = getSrcElements()) + _odsPrinter << value; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("dstElements"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrc().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getDst().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void DeviceAsyncCopyOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(2)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::DeviceAsyncCopyOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::DeviceAsyncCreateGroupOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeviceAsyncCreateGroupOpGenericAdaptorBase::DeviceAsyncCreateGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.device_async_create_group", odsAttrs.getContext()); +} + +DeviceAsyncCreateGroupOpGenericAdaptorBase::DeviceAsyncCreateGroupOpGenericAdaptorBase(DeviceAsyncCreateGroupOp op) : DeviceAsyncCreateGroupOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeviceAsyncCreateGroupOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr DeviceAsyncCreateGroupOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DeviceAsyncCreateGroupOpAdaptor::DeviceAsyncCreateGroupOpAdaptor(DeviceAsyncCreateGroupOp op) : DeviceAsyncCreateGroupOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeviceAsyncCreateGroupOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DeviceAsyncCreateGroupOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range DeviceAsyncCreateGroupOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DeviceAsyncCreateGroupOp::getInputTokens() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange DeviceAsyncCreateGroupOp::getInputTokensMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair DeviceAsyncCreateGroupOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeviceAsyncCreateGroupOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::DeviceAsyncTokenType> DeviceAsyncCreateGroupOp::getAsyncToken() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::DeviceAsyncTokenType>>(*getODSResults(0).begin()); +} + +void DeviceAsyncCreateGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type asyncToken, ::mlir::ValueRange inputTokens) { + odsState.addOperands(inputTokens); + odsState.addTypes(asyncToken); +} + +void DeviceAsyncCreateGroupOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DeviceAsyncCreateGroupOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeviceAsyncCreateGroupOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DeviceAsyncCreateGroupOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> inputTokensOperands; + ::llvm::SMLoc inputTokensOperandsLoc; + (void)inputTokensOperandsLoc; + + inputTokensOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(inputTokensOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::nvgpu::DeviceAsyncTokenType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(inputTokensOperands, odsBuildableType0, inputTokensOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeviceAsyncCreateGroupOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getInputTokens(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::DeviceAsyncCreateGroupOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::DeviceAsyncWaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeviceAsyncWaitOpGenericAdaptorBase::DeviceAsyncWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.device_async_wait", odsAttrs.getContext()); +} + +DeviceAsyncWaitOpGenericAdaptorBase::DeviceAsyncWaitOpGenericAdaptorBase(DeviceAsyncWaitOp op) : DeviceAsyncWaitOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeviceAsyncWaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DeviceAsyncWaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr DeviceAsyncWaitOpGenericAdaptorBase::getNumGroupsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().numGroups); + return attr; +} + +::std::optional DeviceAsyncWaitOpGenericAdaptorBase::getNumGroups() { + auto attr = getNumGroupsAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +DeviceAsyncWaitOpAdaptor::DeviceAsyncWaitOpAdaptor(DeviceAsyncWaitOp op) : DeviceAsyncWaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeviceAsyncWaitOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_numGroups = getProperties().numGroups; (void)tblgen_numGroups; + + if (tblgen_numGroups && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_numGroups))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_numGroups).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvgpu.device_async_wait' op ""attribute 'numGroups' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair DeviceAsyncWaitOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DeviceAsyncWaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::DeviceAsyncTokenType> DeviceAsyncWaitOp::getAsyncDependencies() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::DeviceAsyncTokenType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &DeviceAsyncWaitOp::getAsyncDependenciesMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair DeviceAsyncWaitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeviceAsyncWaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult DeviceAsyncWaitOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.numGroups; + auto attr = dict.get("numGroups"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for numGroups in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `numGroups` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute DeviceAsyncWaitOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.numGroups; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("numGroups", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DeviceAsyncWaitOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.numGroups.getAsOpaquePointer())); +} + +std::optional DeviceAsyncWaitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "numGroups") + return prop.numGroups; + return std::nullopt; +} + +void DeviceAsyncWaitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "numGroups") { + prop.numGroups = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void DeviceAsyncWaitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.numGroups) attrs.append("numGroups", prop.numGroups); +} + +::mlir::LogicalResult DeviceAsyncWaitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNumGroupsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU2(attr, "numGroups", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeviceAsyncWaitOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.numGroups))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeviceAsyncWaitOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.numGroups); +} + +::mlir::IntegerAttr DeviceAsyncWaitOp::getNumGroupsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().numGroups); +} + +::std::optional DeviceAsyncWaitOp::getNumGroups() { + auto attr = getNumGroupsAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void DeviceAsyncWaitOp::setNumGroupsAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getNumGroupsAttrName(), attr); +} + +void DeviceAsyncWaitOp::setNumGroups(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getNumGroupsAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getNumGroupsAttrName()); +} + +::mlir::Attribute DeviceAsyncWaitOp::removeNumGroupsAttr() { + auto &attr = getProperties().numGroups; + attr = {}; + return attr; +} + +void DeviceAsyncWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value asyncDependencies, /*optional*/::mlir::IntegerAttr numGroups) { + odsState.addOperands(asyncDependencies); + if (numGroups) { + odsState.getOrAddProperties().numGroups = numGroups; + } +} + +void DeviceAsyncWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value asyncDependencies, /*optional*/::mlir::IntegerAttr numGroups) { + odsState.addOperands(asyncDependencies); + if (numGroups) { + odsState.getOrAddProperties().numGroups = numGroups; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeviceAsyncWaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DeviceAsyncWaitOp::verifyInvariantsImpl() { + auto tblgen_numGroups = getProperties().numGroups; (void)tblgen_numGroups; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU2(*this, tblgen_numGroups, "numGroups"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeviceAsyncWaitOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult DeviceAsyncWaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand asyncDependenciesRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> asyncDependenciesOperands(asyncDependenciesRawOperands); ::llvm::SMLoc asyncDependenciesOperandsLoc; + (void)asyncDependenciesOperandsLoc; + + asyncDependenciesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(asyncDependenciesRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::nvgpu::DeviceAsyncTokenType>(); + if (parser.resolveOperands(asyncDependenciesOperands, odsBuildableType0, asyncDependenciesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeviceAsyncWaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAsyncDependencies(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::DeviceAsyncWaitOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::LdMatrixOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LdMatrixOpGenericAdaptorBase::LdMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.ldmatrix", odsAttrs.getContext()); +} + +LdMatrixOpGenericAdaptorBase::LdMatrixOpGenericAdaptorBase(LdMatrixOp op) : LdMatrixOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LdMatrixOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr LdMatrixOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr LdMatrixOpGenericAdaptorBase::getTransposeAttr() { + auto attr = ::llvm::cast<::mlir::BoolAttr>(getProperties().transpose); + return attr; +} + +bool LdMatrixOpGenericAdaptorBase::getTranspose() { + auto attr = getTransposeAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr LdMatrixOpGenericAdaptorBase::getNumTilesAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().numTiles); + return attr; +} + +uint32_t LdMatrixOpGenericAdaptorBase::getNumTiles() { + auto attr = getNumTilesAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +LdMatrixOpAdaptor::LdMatrixOpAdaptor(LdMatrixOp op) : LdMatrixOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LdMatrixOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_numTiles = getProperties().numTiles; (void)tblgen_numTiles; + if (!tblgen_numTiles) return emitError(loc, "'nvgpu.ldmatrix' op ""requires attribute 'numTiles'"); + auto tblgen_transpose = getProperties().transpose; (void)tblgen_transpose; + if (!tblgen_transpose) return emitError(loc, "'nvgpu.ldmatrix' op ""requires attribute 'transpose'"); + + if (tblgen_transpose && !((::llvm::isa<::mlir::BoolAttr>(tblgen_transpose)))) + return emitError(loc, "'nvgpu.ldmatrix' op ""attribute 'transpose' failed to satisfy constraint: bool attribute"); + + if (tblgen_numTiles && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_numTiles))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_numTiles).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvgpu.ldmatrix' op ""attribute 'numTiles' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair LdMatrixOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range LdMatrixOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> LdMatrixOp::getSrcMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range LdMatrixOp::getIndices() { + return getODSOperands(1); +} + +::mlir::OpOperand &LdMatrixOp::getSrcMemrefMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange LdMatrixOp::getIndicesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair LdMatrixOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range LdMatrixOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> LdMatrixOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult LdMatrixOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.numTiles; + auto attr = dict.get("numTiles"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for numTiles in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `numTiles` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.transpose; + auto attr = dict.get("transpose"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for transpose in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `transpose` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute LdMatrixOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.numTiles; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("numTiles", + propStorage)); + } + + { + const auto &propStorage = prop.transpose; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("transpose", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LdMatrixOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.numTiles.getAsOpaquePointer()), + llvm::hash_value(prop.transpose.getAsOpaquePointer())); +} + +std::optional LdMatrixOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "numTiles") + return prop.numTiles; + + if (name == "transpose") + return prop.transpose; + return std::nullopt; +} + +void LdMatrixOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "numTiles") { + prop.numTiles = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "transpose") { + prop.transpose = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void LdMatrixOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.numTiles) attrs.append("numTiles", prop.numTiles); + + if (prop.transpose) attrs.append("transpose", prop.transpose); +} + +::mlir::LogicalResult LdMatrixOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNumTilesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU2(attr, "numTiles", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTransposeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU3(attr, "transpose", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LdMatrixOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.numTiles))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.transpose))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LdMatrixOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.numTiles); + writer.writeAttribute(prop.transpose); +} + +::mlir::BoolAttr LdMatrixOp::getTransposeAttr() { + return ::llvm::cast<::mlir::BoolAttr>(getProperties().transpose); +} + +bool LdMatrixOp::getTranspose() { + auto attr = getTransposeAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr LdMatrixOp::getNumTilesAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().numTiles); +} + +uint32_t LdMatrixOp::getNumTiles() { + auto attr = getNumTilesAttr(); + return attr.getValue().getZExtValue(); +} + +void LdMatrixOp::setTransposeAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getTransposeAttrName(), attr); +} + +void LdMatrixOp::setTranspose(bool attrValue) { + (*this)->setAttr(getTransposeAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void LdMatrixOp::setNumTilesAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getNumTilesAttrName(), attr); +} + +void LdMatrixOp::setNumTiles(uint32_t attrValue) { + (*this)->setAttr(getNumTilesAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void LdMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::mlir::BoolAttr transpose, ::mlir::IntegerAttr numTiles) { + odsState.addOperands(srcMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().transpose = transpose; + odsState.getOrAddProperties().numTiles = numTiles; + odsState.addTypes(res); +} + +void LdMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::mlir::BoolAttr transpose, ::mlir::IntegerAttr numTiles) { + odsState.addOperands(srcMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().transpose = transpose; + odsState.getOrAddProperties().numTiles = numTiles; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LdMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcMemref, ::mlir::ValueRange indices, bool transpose, uint32_t numTiles) { + odsState.addOperands(srcMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().transpose = odsBuilder.getBoolAttr(transpose); + odsState.getOrAddProperties().numTiles = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), numTiles); + odsState.addTypes(res); +} + +void LdMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcMemref, ::mlir::ValueRange indices, bool transpose, uint32_t numTiles) { + odsState.addOperands(srcMemref); + odsState.addOperands(indices); + odsState.getOrAddProperties().transpose = odsBuilder.getBoolAttr(transpose); + odsState.getOrAddProperties().numTiles = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), numTiles); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void LdMatrixOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LdMatrixOp::verifyInvariantsImpl() { + auto tblgen_numTiles = getProperties().numTiles; (void)tblgen_numTiles; + if (!tblgen_numTiles) return emitOpError("requires attribute 'numTiles'"); + auto tblgen_transpose = getProperties().transpose; (void)tblgen_transpose; + if (!tblgen_transpose) return emitOpError("requires attribute 'transpose'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU3(*this, tblgen_transpose, "transpose"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU2(*this, tblgen_numTiles, "numTiles"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!(((((*this->getOperation()).getNumResults() > 0)) && (((*this->getOperation()).getNumOperands() > 0)) && ((::llvm::isa<::mlir::ShapedType>((*this->getOperation()).getResult(0).getType()))) && ((::llvm::isa<::mlir::ShapedType>((*this->getOperation()).getOperand(0).getType())))) && ((getElementTypeOrSelf((*this->getOperation()).getResult(0)) == getElementTypeOrSelf((*this->getOperation()).getOperand(0)))))) + return emitOpError("failed to verify that srcMemref and res have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult LdMatrixOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult LdMatrixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand srcMemrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcMemrefOperands(srcMemrefRawOperands); ::llvm::SMLoc srcMemrefOperandsLoc; + (void)srcMemrefOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands; + ::llvm::SMLoc indicesOperandsLoc; + (void)indicesOperandsLoc; + ::mlir::Type srcMemrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> srcMemrefTypes(srcMemrefRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + + srcMemrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(srcMemrefRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + indicesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(indicesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + srcMemrefRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(resTypes); + if (parser.resolveOperands(srcMemrefOperands, srcMemrefTypes, srcMemrefOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LdMatrixOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSrcMemref(); + _odsPrinter << "["; + _odsPrinter << getIndices(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSrcMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void LdMatrixOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::LdMatrixOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierArriveExpectTxOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierArriveExpectTxOpGenericAdaptorBase::MBarrierArriveExpectTxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.mbarrier.arrive.expect_tx", odsAttrs.getContext()); +} + +MBarrierArriveExpectTxOpGenericAdaptorBase::MBarrierArriveExpectTxOpGenericAdaptorBase(MBarrierArriveExpectTxOp op) : MBarrierArriveExpectTxOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierArriveExpectTxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierArriveExpectTxOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierArriveExpectTxOpAdaptor::MBarrierArriveExpectTxOpAdaptor(MBarrierArriveExpectTxOp op) : MBarrierArriveExpectTxOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierArriveExpectTxOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierArriveExpectTxOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierArriveExpectTxOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> MBarrierArriveExpectTxOp::getBarriers() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierArriveExpectTxOp::getTxcount() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierArriveExpectTxOp::getMbarId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MBarrierArriveExpectTxOp::getBarriersMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierArriveExpectTxOp::getTxcountMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierArriveExpectTxOp::getMbarIdMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierArriveExpectTxOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierArriveExpectTxOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierArriveExpectTxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value barriers, ::mlir::Value txcount, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(txcount); + odsState.addOperands(mbarId); +} + +void MBarrierArriveExpectTxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value txcount, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(txcount); + odsState.addOperands(mbarId); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierArriveExpectTxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierArriveExpectTxOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierArriveExpectTxOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierArriveExpectTxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand barriersRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> barriersOperands(barriersRawOperands); ::llvm::SMLoc barriersOperandsLoc; + (void)barriersOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mbarIdRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mbarIdOperands(mbarIdRawOperands); ::llvm::SMLoc mbarIdOperandsLoc; + (void)mbarIdOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand txcountRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> txcountOperands(txcountRawOperands); ::llvm::SMLoc txcountOperandsLoc; + (void)txcountOperandsLoc; + ::mlir::Type barriersRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> barriersTypes(barriersRawTypes); + + barriersOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(barriersRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + mbarIdOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mbarIdRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + txcountOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(txcountRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierGroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + barriersRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(barriersOperands, barriersTypes, barriersOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(txcountOperands, odsBuildableType0, txcountOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(mbarIdOperands, odsBuildableType0, mbarIdOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierArriveExpectTxOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBarriers(); + _odsPrinter << "["; + _odsPrinter << getMbarId(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTxcount(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBarriers().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierGroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierArriveExpectTxOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierArriveNoCompleteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierArriveNoCompleteOpGenericAdaptorBase::MBarrierArriveNoCompleteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.mbarrier.arrive.nocomplete", odsAttrs.getContext()); +} + +MBarrierArriveNoCompleteOpGenericAdaptorBase::MBarrierArriveNoCompleteOpGenericAdaptorBase(MBarrierArriveNoCompleteOp op) : MBarrierArriveNoCompleteOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierArriveNoCompleteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierArriveNoCompleteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierArriveNoCompleteOpAdaptor::MBarrierArriveNoCompleteOpAdaptor(MBarrierArriveNoCompleteOp op) : MBarrierArriveNoCompleteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierArriveNoCompleteOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierArriveNoCompleteOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierArriveNoCompleteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> MBarrierArriveNoCompleteOp::getBarriers() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierArriveNoCompleteOp::getMbarId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierArriveNoCompleteOp::getCount() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MBarrierArriveNoCompleteOp::getBarriersMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierArriveNoCompleteOp::getMbarIdMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierArriveNoCompleteOp::getCountMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierArriveNoCompleteOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierArriveNoCompleteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierTokenType> MBarrierArriveNoCompleteOp::getToken() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierTokenType>>(*getODSResults(0).begin()); +} + +void MBarrierArriveNoCompleteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::Value barriers, ::mlir::Value mbarId, ::mlir::Value count) { + odsState.addOperands(barriers); + odsState.addOperands(mbarId); + odsState.addOperands(count); + odsState.addTypes(token); +} + +void MBarrierArriveNoCompleteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value mbarId, ::mlir::Value count) { + odsState.addOperands(barriers); + odsState.addOperands(mbarId); + odsState.addOperands(count); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierArriveNoCompleteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierArriveNoCompleteOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierArriveNoCompleteOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierArriveNoCompleteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand barriersRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> barriersOperands(barriersRawOperands); ::llvm::SMLoc barriersOperandsLoc; + (void)barriersOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mbarIdRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mbarIdOperands(mbarIdRawOperands); ::llvm::SMLoc mbarIdOperandsLoc; + (void)mbarIdOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand countRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> countOperands(countRawOperands); ::llvm::SMLoc countOperandsLoc; + (void)countOperandsLoc; + ::mlir::Type barriersRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> barriersTypes(barriersRawTypes); + ::mlir::Type tokenRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tokenTypes(tokenRawTypes); + + barriersOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(barriersRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + mbarIdOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mbarIdRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + countOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(countRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierGroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + barriersRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierTokenType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tokenRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(tokenTypes); + if (parser.resolveOperands(barriersOperands, barriersTypes, barriersOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(mbarIdOperands, odsBuildableType0, mbarIdOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(countOperands, odsBuildableType0, countOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierArriveNoCompleteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBarriers(); + _odsPrinter << "["; + _odsPrinter << getMbarId(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCount(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBarriers().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierGroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getToken().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierTokenType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierArriveNoCompleteOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierArriveOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierArriveOpGenericAdaptorBase::MBarrierArriveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.mbarrier.arrive", odsAttrs.getContext()); +} + +MBarrierArriveOpGenericAdaptorBase::MBarrierArriveOpGenericAdaptorBase(MBarrierArriveOp op) : MBarrierArriveOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierArriveOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierArriveOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierArriveOpAdaptor::MBarrierArriveOpAdaptor(MBarrierArriveOp op) : MBarrierArriveOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierArriveOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierArriveOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierArriveOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> MBarrierArriveOp::getBarriers() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierArriveOp::getMbarId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &MBarrierArriveOp::getBarriersMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierArriveOp::getMbarIdMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierArriveOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierArriveOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierTokenType> MBarrierArriveOp::getToken() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierTokenType>>(*getODSResults(0).begin()); +} + +void MBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::Value barriers, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(mbarId); + odsState.addTypes(token); +} + +void MBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(mbarId); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierArriveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierArriveOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierArriveOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierArriveOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand barriersRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> barriersOperands(barriersRawOperands); ::llvm::SMLoc barriersOperandsLoc; + (void)barriersOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mbarIdRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mbarIdOperands(mbarIdRawOperands); ::llvm::SMLoc mbarIdOperandsLoc; + (void)mbarIdOperandsLoc; + ::mlir::Type barriersRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> barriersTypes(barriersRawTypes); + ::mlir::Type tokenRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tokenTypes(tokenRawTypes); + + barriersOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(barriersRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + mbarIdOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mbarIdRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierGroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + barriersRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierTokenType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tokenRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(tokenTypes); + if (parser.resolveOperands(barriersOperands, barriersTypes, barriersOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(mbarIdOperands, odsBuildableType0, mbarIdOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierArriveOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBarriers(); + _odsPrinter << "["; + _odsPrinter << getMbarId(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBarriers().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierGroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getToken().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierTokenType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierArriveOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierCreateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierCreateOpGenericAdaptorBase::MBarrierCreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.mbarrier.create", odsAttrs.getContext()); +} + +MBarrierCreateOpGenericAdaptorBase::MBarrierCreateOpGenericAdaptorBase(MBarrierCreateOp op) : MBarrierCreateOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierCreateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierCreateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierCreateOpAdaptor::MBarrierCreateOpAdaptor(MBarrierCreateOp op) : MBarrierCreateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierCreateOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierCreateOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierCreateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair MBarrierCreateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierCreateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> MBarrierCreateOp::getBarriers() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType>>(*getODSResults(0).begin()); +} + +void MBarrierCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type barriers) { + odsState.addTypes(barriers); +} + +void MBarrierCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierCreateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierCreateOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierCreateOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierCreateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Type barriersRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> barriersTypes(barriersRawTypes); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierGroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + barriersRawTypes[0] = type; + } + result.addTypes(barriersTypes); + return ::mlir::success(); +} + +void MBarrierCreateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getBarriers().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierGroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierCreateOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierInitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierInitOpGenericAdaptorBase::MBarrierInitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.mbarrier.init", odsAttrs.getContext()); +} + +MBarrierInitOpGenericAdaptorBase::MBarrierInitOpGenericAdaptorBase(MBarrierInitOp op) : MBarrierInitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierInitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierInitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierInitOpAdaptor::MBarrierInitOpAdaptor(MBarrierInitOp op) : MBarrierInitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierInitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierInitOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierInitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> MBarrierInitOp::getBarriers() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierInitOp::getCount() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierInitOp::getMbarId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MBarrierInitOp::getBarriersMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierInitOp::getCountMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierInitOp::getMbarIdMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierInitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierInitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierInitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value barriers, ::mlir::Value count, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(count); + odsState.addOperands(mbarId); +} + +void MBarrierInitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value count, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(count); + odsState.addOperands(mbarId); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierInitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierInitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierInitOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierInitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand barriersRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> barriersOperands(barriersRawOperands); ::llvm::SMLoc barriersOperandsLoc; + (void)barriersOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mbarIdRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mbarIdOperands(mbarIdRawOperands); ::llvm::SMLoc mbarIdOperandsLoc; + (void)mbarIdOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand countRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> countOperands(countRawOperands); ::llvm::SMLoc countOperandsLoc; + (void)countOperandsLoc; + ::mlir::Type barriersRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> barriersTypes(barriersRawTypes); + + barriersOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(barriersRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + mbarIdOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mbarIdRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + countOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(countRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierGroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + barriersRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(barriersOperands, barriersTypes, barriersOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(countOperands, odsBuildableType0, countOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(mbarIdOperands, odsBuildableType0, mbarIdOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierInitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBarriers(); + _odsPrinter << "["; + _odsPrinter << getMbarId(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getCount(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBarriers().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierGroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierInitOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierTestWaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierTestWaitOpGenericAdaptorBase::MBarrierTestWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.mbarrier.test.wait", odsAttrs.getContext()); +} + +MBarrierTestWaitOpGenericAdaptorBase::MBarrierTestWaitOpGenericAdaptorBase(MBarrierTestWaitOp op) : MBarrierTestWaitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierTestWaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierTestWaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierTestWaitOpAdaptor::MBarrierTestWaitOpAdaptor(MBarrierTestWaitOp op) : MBarrierTestWaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierTestWaitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierTestWaitOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierTestWaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> MBarrierTestWaitOp::getBarriers() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierTokenType> MBarrierTestWaitOp::getToken() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierTokenType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierTestWaitOp::getMbarId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MBarrierTestWaitOp::getBarriersMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTestWaitOp::getTokenMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTestWaitOp::getMbarIdMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierTestWaitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierTestWaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> MBarrierTestWaitOp::getWaitComplete() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSResults(0).begin()); +} + +void MBarrierTestWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type waitComplete, ::mlir::Value barriers, ::mlir::Value token, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(token); + odsState.addOperands(mbarId); + odsState.addTypes(waitComplete); +} + +void MBarrierTestWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value token, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(token); + odsState.addOperands(mbarId); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierTestWaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierTestWaitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierTestWaitOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierTestWaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand barriersRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> barriersOperands(barriersRawOperands); ::llvm::SMLoc barriersOperandsLoc; + (void)barriersOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mbarIdRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mbarIdOperands(mbarIdRawOperands); ::llvm::SMLoc mbarIdOperandsLoc; + (void)mbarIdOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand tokenRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tokenOperands(tokenRawOperands); ::llvm::SMLoc tokenOperandsLoc; + (void)tokenOperandsLoc; + ::mlir::Type barriersRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> barriersTypes(barriersRawTypes); + ::mlir::Type tokenRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tokenTypes(tokenRawTypes); + + barriersOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(barriersRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + mbarIdOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mbarIdRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + tokenOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tokenRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierGroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + barriersRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierTokenType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tokenRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIndexType(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(barriersOperands, barriersTypes, barriersOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tokenOperands, tokenTypes, tokenOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(mbarIdOperands, odsBuildableType1, mbarIdOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierTestWaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBarriers(); + _odsPrinter << "["; + _odsPrinter << getMbarId(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getToken(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBarriers().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierGroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getToken().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierTokenType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierTestWaitOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierTryWaitParityOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MBarrierTryWaitParityOpGenericAdaptorBase::MBarrierTryWaitParityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.mbarrier.try_wait.parity", odsAttrs.getContext()); +} + +MBarrierTryWaitParityOpGenericAdaptorBase::MBarrierTryWaitParityOpGenericAdaptorBase(MBarrierTryWaitParityOp op) : MBarrierTryWaitParityOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MBarrierTryWaitParityOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MBarrierTryWaitParityOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +MBarrierTryWaitParityOpAdaptor::MBarrierTryWaitParityOpAdaptor(MBarrierTryWaitParityOp op) : MBarrierTryWaitParityOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MBarrierTryWaitParityOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MBarrierTryWaitParityOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MBarrierTryWaitParityOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> MBarrierTryWaitParityOp::getBarriers() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierTryWaitParityOp::getPhase() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierTryWaitParityOp::getTicks() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::IndexType> MBarrierTryWaitParityOp::getMbarId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &MBarrierTryWaitParityOp::getBarriersMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTryWaitParityOp::getPhaseMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTryWaitParityOp::getTicksMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MBarrierTryWaitParityOp::getMbarIdMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair MBarrierTryWaitParityOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MBarrierTryWaitParityOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void MBarrierTryWaitParityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value barriers, ::mlir::Value phase, ::mlir::Value ticks, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(phase); + odsState.addOperands(ticks); + odsState.addOperands(mbarId); +} + +void MBarrierTryWaitParityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value phase, ::mlir::Value ticks, ::mlir::Value mbarId) { + odsState.addOperands(barriers); + odsState.addOperands(phase); + odsState.addOperands(ticks); + odsState.addOperands(mbarId); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MBarrierTryWaitParityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MBarrierTryWaitParityOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MBarrierTryWaitParityOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MBarrierTryWaitParityOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand barriersRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> barriersOperands(barriersRawOperands); ::llvm::SMLoc barriersOperandsLoc; + (void)barriersOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mbarIdRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mbarIdOperands(mbarIdRawOperands); ::llvm::SMLoc mbarIdOperandsLoc; + (void)mbarIdOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand phaseRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> phaseOperands(phaseRawOperands); ::llvm::SMLoc phaseOperandsLoc; + (void)phaseOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand ticksRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ticksOperands(ticksRawOperands); ::llvm::SMLoc ticksOperandsLoc; + (void)ticksOperandsLoc; + ::mlir::Type barriersRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> barriersTypes(barriersRawTypes); + + barriersOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(barriersRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + mbarIdOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mbarIdRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + phaseOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(phaseRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + ticksOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(ticksRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierGroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + barriersRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(barriersOperands, barriersTypes, barriersOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(phaseOperands, odsBuildableType0, phaseOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(ticksOperands, odsBuildableType0, ticksOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(mbarIdOperands, odsBuildableType0, mbarIdOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MBarrierTryWaitParityOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getBarriers(); + _odsPrinter << "["; + _odsPrinter << getMbarId(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getPhase(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTicks(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getBarriers().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierGroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierTryWaitParityOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MmaSparseSyncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MmaSparseSyncOpGenericAdaptorBase::MmaSparseSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.mma.sp.sync", odsAttrs.getContext()); +} + +MmaSparseSyncOpGenericAdaptorBase::MmaSparseSyncOpGenericAdaptorBase(MmaSparseSyncOp op) : MmaSparseSyncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MmaSparseSyncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MmaSparseSyncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr MmaSparseSyncOpGenericAdaptorBase::getMmaShapeAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().mmaShape); + return attr; +} + +::mlir::ArrayAttr MmaSparseSyncOpGenericAdaptorBase::getMmaShape() { + auto attr = getMmaShapeAttr(); + return attr; +} + +::mlir::IntegerAttr MmaSparseSyncOpGenericAdaptorBase::getSparsitySelectorAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().sparsitySelector); + return attr; +} + +uint32_t MmaSparseSyncOpGenericAdaptorBase::getSparsitySelector() { + auto attr = getSparsitySelectorAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr MmaSparseSyncOpGenericAdaptorBase::getTf32EnabledAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().tf32Enabled); + return attr; +} + +::std::optional MmaSparseSyncOpGenericAdaptorBase::getTf32Enabled() { + auto attr = getTf32EnabledAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +} // namespace detail +MmaSparseSyncOpAdaptor::MmaSparseSyncOpAdaptor(MmaSparseSyncOp op) : MmaSparseSyncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MmaSparseSyncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_mmaShape = getProperties().mmaShape; (void)tblgen_mmaShape; + if (!tblgen_mmaShape) return emitError(loc, "'nvgpu.mma.sp.sync' op ""requires attribute 'mmaShape'"); + auto tblgen_sparsitySelector = getProperties().sparsitySelector; (void)tblgen_sparsitySelector; + auto tblgen_tf32Enabled = getProperties().tf32Enabled; (void)tblgen_tf32Enabled; + + if (tblgen_mmaShape && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_mmaShape))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_mmaShape), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); })))) + return emitError(loc, "'nvgpu.mma.sp.sync' op ""attribute 'mmaShape' failed to satisfy constraint: 64-bit integer array attribute"); + + if (tblgen_sparsitySelector && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_sparsitySelector))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_sparsitySelector).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvgpu.mma.sp.sync' op ""attribute 'sparsitySelector' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_tf32Enabled && !((::llvm::isa<::mlir::UnitAttr>(tblgen_tf32Enabled)))) + return emitError(loc, "'nvgpu.mma.sp.sync' op ""attribute 'tf32Enabled' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair MmaSparseSyncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MmaSparseSyncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> MmaSparseSyncOp::getMatrixA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> MmaSparseSyncOp::getMatrixB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> MmaSparseSyncOp::getMatrixC() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> MmaSparseSyncOp::getSparseMetadata() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(3).begin()); +} + +::mlir::OpOperand &MmaSparseSyncOp::getMatrixAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MmaSparseSyncOp::getMatrixBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MmaSparseSyncOp::getMatrixCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MmaSparseSyncOp::getSparseMetadataMutable() { + auto range = getODSOperandIndexAndLength(3); + return getOperation()->getOpOperand(range.first); +} + +std::pair MmaSparseSyncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MmaSparseSyncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> MmaSparseSyncOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MmaSparseSyncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.mmaShape; + auto attr = dict.get("mmaShape"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for mmaShape in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `mmaShape` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sparsitySelector; + auto attr = dict.get("sparsitySelector"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for sparsitySelector in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sparsitySelector` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tf32Enabled; + auto attr = dict.get("tf32Enabled"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tf32Enabled in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tf32Enabled` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MmaSparseSyncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.mmaShape; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("mmaShape", + propStorage)); + } + + { + const auto &propStorage = prop.sparsitySelector; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sparsitySelector", + propStorage)); + } + + { + const auto &propStorage = prop.tf32Enabled; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tf32Enabled", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MmaSparseSyncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.mmaShape.getAsOpaquePointer()), + llvm::hash_value(prop.sparsitySelector.getAsOpaquePointer()), + llvm::hash_value(prop.tf32Enabled.getAsOpaquePointer())); +} + +std::optional MmaSparseSyncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "mmaShape") + return prop.mmaShape; + + if (name == "sparsitySelector") + return prop.sparsitySelector; + + if (name == "tf32Enabled") + return prop.tf32Enabled; + return std::nullopt; +} + +void MmaSparseSyncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "mmaShape") { + prop.mmaShape = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sparsitySelector") { + prop.sparsitySelector = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tf32Enabled") { + prop.tf32Enabled = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MmaSparseSyncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.mmaShape) attrs.append("mmaShape", prop.mmaShape); + + if (prop.sparsitySelector) attrs.append("sparsitySelector", prop.sparsitySelector); + + if (prop.tf32Enabled) attrs.append("tf32Enabled", prop.tf32Enabled); +} + +::mlir::LogicalResult MmaSparseSyncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMmaShapeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU4(attr, "mmaShape", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSparsitySelectorAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU2(attr, "sparsitySelector", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTf32EnabledAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(attr, "tf32Enabled", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MmaSparseSyncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.mmaShape))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.sparsitySelector))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tf32Enabled))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MmaSparseSyncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.mmaShape); + + writer.writeOptionalAttribute(prop.sparsitySelector); + + writer.writeOptionalAttribute(prop.tf32Enabled); +} + +::mlir::ArrayAttr MmaSparseSyncOp::getMmaShapeAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().mmaShape); +} + +::mlir::ArrayAttr MmaSparseSyncOp::getMmaShape() { + auto attr = getMmaShapeAttr(); + return attr; +} + +::mlir::IntegerAttr MmaSparseSyncOp::getSparsitySelectorAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().sparsitySelector); +} + +uint32_t MmaSparseSyncOp::getSparsitySelector() { + auto attr = getSparsitySelectorAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr MmaSparseSyncOp::getTf32EnabledAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().tf32Enabled); +} + +::std::optional MmaSparseSyncOp::getTf32Enabled() { + auto attr = getTf32EnabledAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +void MmaSparseSyncOp::setMmaShapeAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getMmaShapeAttrName(), attr); +} + +void MmaSparseSyncOp::setSparsitySelectorAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getSparsitySelectorAttrName(), attr); +} + +void MmaSparseSyncOp::setSparsitySelector(uint32_t attrValue) { + (*this)->setAttr(getSparsitySelectorAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void MmaSparseSyncOp::setTf32EnabledAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getTf32EnabledAttrName(), attr); +} + +void MmaSparseSyncOp::setTf32Enabled(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getTf32EnabledAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getTf32EnabledAttrName()); +} + +::mlir::Attribute MmaSparseSyncOp::removeTf32EnabledAttr() { + auto &attr = getProperties().tf32Enabled; + attr = {}; + return attr; +} + +void MmaSparseSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::Value sparseMetadata, ::mlir::ArrayAttr mmaShape, ::mlir::IntegerAttr sparsitySelector, /*optional*/::mlir::UnitAttr tf32Enabled) { + odsState.addOperands(matrixA); + odsState.addOperands(matrixB); + odsState.addOperands(matrixC); + odsState.addOperands(sparseMetadata); + odsState.getOrAddProperties().mmaShape = mmaShape; + if (sparsitySelector) { + odsState.getOrAddProperties().sparsitySelector = sparsitySelector; + } + if (tf32Enabled) { + odsState.getOrAddProperties().tf32Enabled = tf32Enabled; + } + odsState.addTypes(res); +} + +void MmaSparseSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::Value sparseMetadata, ::mlir::ArrayAttr mmaShape, ::mlir::IntegerAttr sparsitySelector, /*optional*/::mlir::UnitAttr tf32Enabled) { + odsState.addOperands(matrixA); + odsState.addOperands(matrixB); + odsState.addOperands(matrixC); + odsState.addOperands(sparseMetadata); + odsState.getOrAddProperties().mmaShape = mmaShape; + if (sparsitySelector) { + odsState.getOrAddProperties().sparsitySelector = sparsitySelector; + } + if (tf32Enabled) { + odsState.getOrAddProperties().tf32Enabled = tf32Enabled; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MmaSparseSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::Value sparseMetadata, ::mlir::ArrayAttr mmaShape, uint32_t sparsitySelector, /*optional*/::mlir::UnitAttr tf32Enabled) { + odsState.addOperands(matrixA); + odsState.addOperands(matrixB); + odsState.addOperands(matrixC); + odsState.addOperands(sparseMetadata); + odsState.getOrAddProperties().mmaShape = mmaShape; + odsState.getOrAddProperties().sparsitySelector = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), sparsitySelector); + if (tf32Enabled) { + odsState.getOrAddProperties().tf32Enabled = tf32Enabled; + } + odsState.addTypes(res); +} + +void MmaSparseSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::Value sparseMetadata, ::mlir::ArrayAttr mmaShape, uint32_t sparsitySelector, /*optional*/::mlir::UnitAttr tf32Enabled) { + odsState.addOperands(matrixA); + odsState.addOperands(matrixB); + odsState.addOperands(matrixC); + odsState.addOperands(sparseMetadata); + odsState.getOrAddProperties().mmaShape = mmaShape; + odsState.getOrAddProperties().sparsitySelector = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), sparsitySelector); + if (tf32Enabled) { + odsState.getOrAddProperties().tf32Enabled = tf32Enabled; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MmaSparseSyncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MmaSparseSyncOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.sparsitySelector) + properties.sparsitySelector = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0); +} + +::mlir::LogicalResult MmaSparseSyncOp::verifyInvariantsImpl() { + auto tblgen_mmaShape = getProperties().mmaShape; (void)tblgen_mmaShape; + if (!tblgen_mmaShape) return emitOpError("requires attribute 'mmaShape'"); + auto tblgen_sparsitySelector = getProperties().sparsitySelector; (void)tblgen_sparsitySelector; + auto tblgen_tf32Enabled = getProperties().tf32Enabled; (void)tblgen_tf32Enabled; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU4(*this, tblgen_mmaShape, "mmaShape"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU2(*this, tblgen_sparsitySelector, "sparsitySelector"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(*this, tblgen_tf32Enabled, "tf32Enabled"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getOperation()).getNumOperands() > 1)) && ((::llvm::isa<::mlir::ShapedType>((*this->getOperation()).getOperand(0).getType()))) && ((::llvm::isa<::mlir::ShapedType>((*this->getOperation()).getOperand(1).getType()))) && ((::mlir::getElementTypeOrSelf((*this->getOperation()).getOperand(0)) == ::mlir::getElementTypeOrSelf((*this->getOperation()).getOperand(1)))))) + return emitOpError("failed to verify that matrixA and matrixB have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult MmaSparseSyncOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult MmaSparseSyncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand matrixARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> matrixAOperands(matrixARawOperands); ::llvm::SMLoc matrixAOperandsLoc; + (void)matrixAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand matrixBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> matrixBOperands(matrixBRawOperands); ::llvm::SMLoc matrixBOperandsLoc; + (void)matrixBOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand matrixCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> matrixCOperands(matrixCRawOperands); ::llvm::SMLoc matrixCOperandsLoc; + (void)matrixCOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand sparseMetadataRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sparseMetadataOperands(sparseMetadataRawOperands); ::llvm::SMLoc sparseMetadataOperandsLoc; + (void)sparseMetadataOperandsLoc; + ::mlir::Type matrixARawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> matrixATypes(matrixARawTypes); + ::mlir::Type matrixBRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> matrixBTypes(matrixBRawTypes); + ::mlir::Type matrixCRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> matrixCTypes(matrixCRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + if (parser.parseLParen()) + return ::mlir::failure(); + + matrixAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(matrixARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + matrixBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(matrixBRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + matrixCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(matrixCRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseKeyword("metadata")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + sparseMetadataOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sparseMetadataRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + matrixARawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + matrixBRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + matrixCRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = ::mlir::VectorType::get({2},parser.getBuilder().getI16Type()); + result.addTypes(resTypes); + if (parser.resolveOperands(matrixAOperands, matrixATypes, matrixAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(matrixBOperands, matrixBTypes, matrixBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(matrixCOperands, matrixCTypes, matrixCOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(sparseMetadataOperands, odsBuildableType0, sparseMetadataOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MmaSparseSyncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getMatrixA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMatrixB(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMatrixC(); + _odsPrinter << ")"; + _odsPrinter << ' ' << "metadata"; + _odsPrinter << "("; + _odsPrinter << getSparseMetadata(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getSparsitySelectorAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0))) + elidedAttrs.push_back("sparsitySelector"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "("; + { + auto type = getMatrixA().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getMatrixB().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getMatrixC().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MmaSparseSyncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MmaSparseSyncOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MmaSyncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MmaSyncOpGenericAdaptorBase::MmaSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.mma.sync", odsAttrs.getContext()); +} + +MmaSyncOpGenericAdaptorBase::MmaSyncOpGenericAdaptorBase(MmaSyncOp op) : MmaSyncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MmaSyncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MmaSyncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr MmaSyncOpGenericAdaptorBase::getMmaShapeAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().mmaShape); + return attr; +} + +::mlir::ArrayAttr MmaSyncOpGenericAdaptorBase::getMmaShape() { + auto attr = getMmaShapeAttr(); + return attr; +} + +::mlir::UnitAttr MmaSyncOpGenericAdaptorBase::getTf32EnabledAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().tf32Enabled); + return attr; +} + +::std::optional MmaSyncOpGenericAdaptorBase::getTf32Enabled() { + auto attr = getTf32EnabledAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +} // namespace detail +MmaSyncOpAdaptor::MmaSyncOpAdaptor(MmaSyncOp op) : MmaSyncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MmaSyncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_mmaShape = getProperties().mmaShape; (void)tblgen_mmaShape; + if (!tblgen_mmaShape) return emitError(loc, "'nvgpu.mma.sync' op ""requires attribute 'mmaShape'"); + auto tblgen_tf32Enabled = getProperties().tf32Enabled; (void)tblgen_tf32Enabled; + + if (tblgen_mmaShape && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_mmaShape))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_mmaShape), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); })))) + return emitError(loc, "'nvgpu.mma.sync' op ""attribute 'mmaShape' failed to satisfy constraint: 64-bit integer array attribute"); + + if (tblgen_tf32Enabled && !((::llvm::isa<::mlir::UnitAttr>(tblgen_tf32Enabled)))) + return emitError(loc, "'nvgpu.mma.sync' op ""attribute 'tf32Enabled' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair MmaSyncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MmaSyncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> MmaSyncOp::getMatrixA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> MmaSyncOp::getMatrixB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::VectorType> MmaSyncOp::getMatrixC() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSOperands(2).begin()); +} + +::mlir::OpOperand &MmaSyncOp::getMatrixAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MmaSyncOp::getMatrixBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &MmaSyncOp::getMatrixCMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +std::pair MmaSyncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MmaSyncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::VectorType> MmaSyncOp::getRes() { + return ::llvm::cast<::mlir::TypedValue<::mlir::VectorType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MmaSyncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.mmaShape; + auto attr = dict.get("mmaShape"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for mmaShape in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `mmaShape` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.tf32Enabled; + auto attr = dict.get("tf32Enabled"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for tf32Enabled in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `tf32Enabled` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute MmaSyncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.mmaShape; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("mmaShape", + propStorage)); + } + + { + const auto &propStorage = prop.tf32Enabled; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("tf32Enabled", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MmaSyncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.mmaShape.getAsOpaquePointer()), + llvm::hash_value(prop.tf32Enabled.getAsOpaquePointer())); +} + +std::optional MmaSyncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "mmaShape") + return prop.mmaShape; + + if (name == "tf32Enabled") + return prop.tf32Enabled; + return std::nullopt; +} + +void MmaSyncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "mmaShape") { + prop.mmaShape = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "tf32Enabled") { + prop.tf32Enabled = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void MmaSyncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.mmaShape) attrs.append("mmaShape", prop.mmaShape); + + if (prop.tf32Enabled) attrs.append("tf32Enabled", prop.tf32Enabled); +} + +::mlir::LogicalResult MmaSyncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getMmaShapeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU4(attr, "mmaShape", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTf32EnabledAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(attr, "tf32Enabled", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MmaSyncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.mmaShape))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.tf32Enabled))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MmaSyncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.mmaShape); + + writer.writeOptionalAttribute(prop.tf32Enabled); +} + +::mlir::ArrayAttr MmaSyncOp::getMmaShapeAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().mmaShape); +} + +::mlir::ArrayAttr MmaSyncOp::getMmaShape() { + auto attr = getMmaShapeAttr(); + return attr; +} + +::mlir::UnitAttr MmaSyncOp::getTf32EnabledAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().tf32Enabled); +} + +::std::optional MmaSyncOp::getTf32Enabled() { + auto attr = getTf32EnabledAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +void MmaSyncOp::setMmaShapeAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getMmaShapeAttrName(), attr); +} + +void MmaSyncOp::setTf32EnabledAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getTf32EnabledAttrName(), attr); +} + +void MmaSyncOp::setTf32Enabled(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getTf32EnabledAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getTf32EnabledAttrName()); +} + +::mlir::Attribute MmaSyncOp::removeTf32EnabledAttr() { + auto &attr = getProperties().tf32Enabled; + attr = {}; + return attr; +} + +void MmaSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::ArrayAttr mmaShape, /*optional*/::mlir::UnitAttr tf32Enabled) { + odsState.addOperands(matrixA); + odsState.addOperands(matrixB); + odsState.addOperands(matrixC); + odsState.getOrAddProperties().mmaShape = mmaShape; + if (tf32Enabled) { + odsState.getOrAddProperties().tf32Enabled = tf32Enabled; + } + odsState.addTypes(res); +} + +void MmaSyncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::ArrayAttr mmaShape, /*optional*/::mlir::UnitAttr tf32Enabled) { + odsState.addOperands(matrixA); + odsState.addOperands(matrixB); + odsState.addOperands(matrixC); + odsState.getOrAddProperties().mmaShape = mmaShape; + if (tf32Enabled) { + odsState.getOrAddProperties().tf32Enabled = tf32Enabled; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MmaSyncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 3u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MmaSyncOp::verifyInvariantsImpl() { + auto tblgen_mmaShape = getProperties().mmaShape; (void)tblgen_mmaShape; + if (!tblgen_mmaShape) return emitOpError("requires attribute 'mmaShape'"); + auto tblgen_tf32Enabled = getProperties().tf32Enabled; (void)tblgen_tf32Enabled; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU4(*this, tblgen_mmaShape, "mmaShape"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(*this, tblgen_tf32Enabled, "tf32Enabled"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getOperation()).getNumOperands() > 1)) && ((::llvm::isa<::mlir::ShapedType>((*this->getOperation()).getOperand(0).getType()))) && ((::llvm::isa<::mlir::ShapedType>((*this->getOperation()).getOperand(1).getType()))) && ((::mlir::getElementTypeOrSelf((*this->getOperation()).getOperand(0)) == ::mlir::getElementTypeOrSelf((*this->getOperation()).getOperand(1)))))) + return emitOpError("failed to verify that matrixA and matrixB have same element type"); + return ::mlir::success(); +} + +::mlir::LogicalResult MmaSyncOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult MmaSyncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand matrixARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> matrixAOperands(matrixARawOperands); ::llvm::SMLoc matrixAOperandsLoc; + (void)matrixAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand matrixBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> matrixBOperands(matrixBRawOperands); ::llvm::SMLoc matrixBOperandsLoc; + (void)matrixBOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand matrixCRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> matrixCOperands(matrixCRawOperands); ::llvm::SMLoc matrixCOperandsLoc; + (void)matrixCOperandsLoc; + ::mlir::Type matrixARawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> matrixATypes(matrixARawTypes); + ::mlir::Type matrixBRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> matrixBTypes(matrixBRawTypes); + ::mlir::Type matrixCRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> matrixCTypes(matrixCRawTypes); + ::mlir::Type resRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes); + if (parser.parseLParen()) + return ::mlir::failure(); + + matrixAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(matrixARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + matrixBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(matrixBRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + matrixCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(matrixCRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + matrixARawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + matrixBRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + matrixCRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::VectorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resRawTypes[0] = type; + } + result.addTypes(resTypes); + if (parser.resolveOperands(matrixAOperands, matrixATypes, matrixAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(matrixBOperands, matrixBTypes, matrixBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(matrixCOperands, matrixCTypes, matrixCOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MmaSyncOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "("; + _odsPrinter << getMatrixA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMatrixB(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMatrixC(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "("; + { + auto type = getMatrixA().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getMatrixB().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getMatrixC().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getRes().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void MmaSyncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MmaSyncOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::TmaAsyncLoadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TmaAsyncLoadOpGenericAdaptorBase::TmaAsyncLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.tma.async.load", odsAttrs.getContext()); +} + +TmaAsyncLoadOpGenericAdaptorBase::TmaAsyncLoadOpGenericAdaptorBase(TmaAsyncLoadOp op) : TmaAsyncLoadOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TmaAsyncLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr TmaAsyncLoadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TmaAsyncLoadOpAdaptor::TmaAsyncLoadOpAdaptor(TmaAsyncLoadOp op) : TmaAsyncLoadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TmaAsyncLoadOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TmaAsyncLoadOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, false, true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 4) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range TmaAsyncLoadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> TmaAsyncLoadOp::getDst() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> TmaAsyncLoadOp::getBarriers() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType>>(*getODSOperands(1).begin()); +} + +::mlir::TypedValue<::mlir::nvgpu::TensorMapDescriptorType> TmaAsyncLoadOp::getTensorMapDescriptor() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::TensorMapDescriptorType>>(*getODSOperands(2).begin()); +} + +::mlir::Operation::operand_range TmaAsyncLoadOp::getCoordinates() { + return getODSOperands(3); +} + +::mlir::TypedValue<::mlir::IndexType> TmaAsyncLoadOp::getMbarId() { + return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(4).begin()); +} + +::mlir::OpOperand &TmaAsyncLoadOp::getDstMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &TmaAsyncLoadOp::getBarriersMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &TmaAsyncLoadOp::getTensorMapDescriptorMutable() { + auto range = getODSOperandIndexAndLength(2); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange TmaAsyncLoadOp::getCoordinatesMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &TmaAsyncLoadOp::getMbarIdMutable() { + auto range = getODSOperandIndexAndLength(4); + return getOperation()->getOpOperand(range.first); +} + +std::pair TmaAsyncLoadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TmaAsyncLoadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void TmaAsyncLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value barriers, ::mlir::Value tensorMapDescriptor, ::mlir::ValueRange coordinates, ::mlir::Value mbarId) { + odsState.addOperands(dst); + odsState.addOperands(barriers); + odsState.addOperands(tensorMapDescriptor); + odsState.addOperands(coordinates); + odsState.addOperands(mbarId); +} + +void TmaAsyncLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value barriers, ::mlir::Value tensorMapDescriptor, ::mlir::ValueRange coordinates, ::mlir::Value mbarId) { + odsState.addOperands(dst); + odsState.addOperands(barriers); + odsState.addOperands(tensorMapDescriptor); + odsState.addOperands(coordinates); + odsState.addOperands(mbarId); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TmaAsyncLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 4u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TmaAsyncLoadOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TmaAsyncLoadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TmaAsyncLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tensorMapDescriptorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tensorMapDescriptorOperands(tensorMapDescriptorRawOperands); ::llvm::SMLoc tensorMapDescriptorOperandsLoc; + (void)tensorMapDescriptorOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> coordinatesOperands; + ::llvm::SMLoc coordinatesOperandsLoc; + (void)coordinatesOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand barriersRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> barriersOperands(barriersRawOperands); ::llvm::SMLoc barriersOperandsLoc; + (void)barriersOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand mbarIdRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> mbarIdOperands(mbarIdRawOperands); ::llvm::SMLoc mbarIdOperandsLoc; + (void)mbarIdOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dstRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstOperands(dstRawOperands); ::llvm::SMLoc dstOperandsLoc; + (void)dstOperandsLoc; + ::mlir::Type tensorMapDescriptorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tensorMapDescriptorTypes(tensorMapDescriptorRawTypes); + ::mlir::Type barriersRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> barriersTypes(barriersRawTypes); + ::mlir::Type dstRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstTypes(dstRawTypes); + + tensorMapDescriptorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tensorMapDescriptorRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + coordinatesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(coordinatesOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + barriersOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(barriersRawOperands[0])) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + mbarIdOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(mbarIdRawOperands[0])) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + dstOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::TensorMapDescriptorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tensorMapDescriptorRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::MBarrierGroupType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + barriersRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + if (parser.resolveOperands(dstOperands, dstTypes, dstOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(barriersOperands, barriersTypes, barriersOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tensorMapDescriptorOperands, tensorMapDescriptorTypes, tensorMapDescriptorOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(coordinatesOperands, odsBuildableType0, coordinatesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(mbarIdOperands, odsBuildableType0, mbarIdOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TmaAsyncLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTensorMapDescriptor(); + _odsPrinter << "["; + _odsPrinter << getCoordinates(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getBarriers(); + _odsPrinter << "["; + _odsPrinter << getMbarId(); + _odsPrinter << "]"; + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + _odsPrinter << getDst(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getTensorMapDescriptor().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::TensorMapDescriptorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getBarriers().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::MBarrierGroupType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getDst().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void TmaAsyncLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, true, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TmaAsyncLoadOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::TmaCreateDescriptorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TmaCreateDescriptorOpGenericAdaptorBase::TmaCreateDescriptorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.tma.create.descriptor", odsAttrs.getContext()); +} + +TmaCreateDescriptorOpGenericAdaptorBase::TmaCreateDescriptorOpGenericAdaptorBase(TmaCreateDescriptorOp op) : TmaCreateDescriptorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TmaCreateDescriptorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr TmaCreateDescriptorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TmaCreateDescriptorOpAdaptor::TmaCreateDescriptorOpAdaptor(TmaCreateDescriptorOp op) : TmaCreateDescriptorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TmaCreateDescriptorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TmaCreateDescriptorOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range TmaCreateDescriptorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::UnrankedMemRefType> TmaCreateDescriptorOp::getTensor() { + return ::llvm::cast<::mlir::TypedValue<::mlir::UnrankedMemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range TmaCreateDescriptorOp::getBoxDimensions() { + return getODSOperands(1); +} + +::mlir::OpOperand &TmaCreateDescriptorOp::getTensorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange TmaCreateDescriptorOp::getBoxDimensionsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair TmaCreateDescriptorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TmaCreateDescriptorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::TensorMapDescriptorType> TmaCreateDescriptorOp::getTensorMap() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::TensorMapDescriptorType>>(*getODSResults(0).begin()); +} + +void TmaCreateDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensorMap, ::mlir::Value tensor, ::mlir::ValueRange boxDimensions) { + odsState.addOperands(tensor); + odsState.addOperands(boxDimensions); + odsState.addTypes(tensorMap); +} + +void TmaCreateDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::ValueRange boxDimensions) { + odsState.addOperands(tensor); + odsState.addOperands(boxDimensions); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TmaCreateDescriptorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TmaCreateDescriptorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU9(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU8(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TmaCreateDescriptorOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TmaCreateDescriptorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tensorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tensorOperands(tensorRawOperands); ::llvm::SMLoc tensorOperandsLoc; + (void)tensorOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boxDimensionsOperands; + ::llvm::SMLoc boxDimensionsOperandsLoc; + (void)boxDimensionsOperandsLoc; + ::mlir::Type tensorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tensorTypes(tensorRawTypes); + ::mlir::Type tensorMapRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tensorMapTypes(tensorMapRawTypes); + + tensorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tensorRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("box")) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + boxDimensionsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boxDimensionsOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::UnrankedMemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tensorRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::TensorMapDescriptorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tensorMapRawTypes[0] = type; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType(); + result.addTypes(tensorMapTypes); + if (parser.resolveOperands(tensorOperands, tensorTypes, tensorOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boxDimensionsOperands, odsBuildableType0, boxDimensionsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TmaCreateDescriptorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTensor(); + _odsPrinter << ' ' << "box"; + _odsPrinter << "["; + _odsPrinter << getBoxDimensions(); + _odsPrinter << "]"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getTensor().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::UnrankedMemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getTensorMap().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::TensorMapDescriptorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TmaCreateDescriptorOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::WarpgroupGenerateDescriptorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WarpgroupGenerateDescriptorOpGenericAdaptorBase::WarpgroupGenerateDescriptorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.warpgroup.generate.descriptor", odsAttrs.getContext()); +} + +WarpgroupGenerateDescriptorOpGenericAdaptorBase::WarpgroupGenerateDescriptorOpGenericAdaptorBase(WarpgroupGenerateDescriptorOp op) : WarpgroupGenerateDescriptorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WarpgroupGenerateDescriptorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr WarpgroupGenerateDescriptorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +WarpgroupGenerateDescriptorOpAdaptor::WarpgroupGenerateDescriptorOpAdaptor(WarpgroupGenerateDescriptorOp op) : WarpgroupGenerateDescriptorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WarpgroupGenerateDescriptorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair WarpgroupGenerateDescriptorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range WarpgroupGenerateDescriptorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::MemRefType> WarpgroupGenerateDescriptorOp::getTensor() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::nvgpu::TensorMapDescriptorType> WarpgroupGenerateDescriptorOp::getTensorMap() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::TensorMapDescriptorType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &WarpgroupGenerateDescriptorOp::getTensorMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &WarpgroupGenerateDescriptorOp::getTensorMapMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair WarpgroupGenerateDescriptorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WarpgroupGenerateDescriptorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::WarpgroupMatrixDescriptorType> WarpgroupGenerateDescriptorOp::getDescriptor() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::WarpgroupMatrixDescriptorType>>(*getODSResults(0).begin()); +} + +void WarpgroupGenerateDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type descriptor, ::mlir::Value tensor, ::mlir::Value tensorMap) { + odsState.addOperands(tensor); + odsState.addOperands(tensorMap); + odsState.addTypes(descriptor); +} + +void WarpgroupGenerateDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value tensorMap) { + odsState.addOperands(tensor); + odsState.addOperands(tensorMap); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WarpgroupGenerateDescriptorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WarpgroupGenerateDescriptorOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult WarpgroupGenerateDescriptorOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WarpgroupGenerateDescriptorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand tensorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tensorOperands(tensorRawOperands); ::llvm::SMLoc tensorOperandsLoc; + (void)tensorOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand tensorMapRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> tensorMapOperands(tensorMapRawOperands); ::llvm::SMLoc tensorMapOperandsLoc; + (void)tensorMapOperandsLoc; + ::mlir::Type tensorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tensorTypes(tensorRawTypes); + ::mlir::Type tensorMapRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tensorMapTypes(tensorMapRawTypes); + ::mlir::Type descriptorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> descriptorTypes(descriptorRawTypes); + + tensorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tensorRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + tensorMapOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(tensorMapRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tensorRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::TensorMapDescriptorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tensorMapRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::WarpgroupMatrixDescriptorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + descriptorRawTypes[0] = type; + } + result.addTypes(descriptorTypes); + if (parser.resolveOperands(tensorOperands, tensorTypes, tensorOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tensorMapOperands, tensorMapTypes, tensorMapOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WarpgroupGenerateDescriptorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getTensor(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getTensorMap(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getTensor().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getTensorMap().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::TensorMapDescriptorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getDescriptor().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::WarpgroupMatrixDescriptorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void WarpgroupGenerateDescriptorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupGenerateDescriptorOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::WarpgroupMmaOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WarpgroupMmaOpGenericAdaptorBase::WarpgroupMmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.warpgroup.mma", odsAttrs.getContext()); +} + +WarpgroupMmaOpGenericAdaptorBase::WarpgroupMmaOpGenericAdaptorBase(WarpgroupMmaOp op) : WarpgroupMmaOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WarpgroupMmaOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr WarpgroupMmaOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr WarpgroupMmaOpGenericAdaptorBase::getWaitGroupAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().waitGroup); + if (!attr) + attr = ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(32), 1); + return attr; +} + +uint32_t WarpgroupMmaOpGenericAdaptorBase::getWaitGroup() { + auto attr = getWaitGroupAttr(); + if (!attr) + return ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(32), 1).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr WarpgroupMmaOpGenericAdaptorBase::getTransposeAAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().transposeA); + return attr; +} + +::std::optional WarpgroupMmaOpGenericAdaptorBase::getTransposeA() { + auto attr = getTransposeAAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +::mlir::UnitAttr WarpgroupMmaOpGenericAdaptorBase::getTransposeBAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().transposeB); + return attr; +} + +::std::optional WarpgroupMmaOpGenericAdaptorBase::getTransposeB() { + auto attr = getTransposeBAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +} // namespace detail +WarpgroupMmaOpAdaptor::WarpgroupMmaOpAdaptor(WarpgroupMmaOp op) : WarpgroupMmaOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WarpgroupMmaOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_transposeA = getProperties().transposeA; (void)tblgen_transposeA; + auto tblgen_transposeB = getProperties().transposeB; (void)tblgen_transposeB; + auto tblgen_waitGroup = getProperties().waitGroup; (void)tblgen_waitGroup; + + if (tblgen_waitGroup && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_waitGroup))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_waitGroup).getType().isSignlessInteger(32))))) + return emitError(loc, "'nvgpu.warpgroup.mma' op ""attribute 'waitGroup' failed to satisfy constraint: 32-bit signless integer attribute"); + + if (tblgen_transposeA && !((::llvm::isa<::mlir::UnitAttr>(tblgen_transposeA)))) + return emitError(loc, "'nvgpu.warpgroup.mma' op ""attribute 'transposeA' failed to satisfy constraint: unit attribute"); + + if (tblgen_transposeB && !((::llvm::isa<::mlir::UnitAttr>(tblgen_transposeB)))) + return emitError(loc, "'nvgpu.warpgroup.mma' op ""attribute 'transposeB' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair WarpgroupMmaOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 2) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range WarpgroupMmaOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::nvgpu::WarpgroupMatrixDescriptorType> WarpgroupMmaOp::getDescriptorA() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::WarpgroupMatrixDescriptorType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::nvgpu::WarpgroupMatrixDescriptorType> WarpgroupMmaOp::getDescriptorB() { + return ::llvm::cast<::mlir::TypedValue<::mlir::nvgpu::WarpgroupMatrixDescriptorType>>(*getODSOperands(1).begin()); +} + +::mlir::Operation::operand_range WarpgroupMmaOp::getMatrixC() { + return getODSOperands(2); +} + +::mlir::OpOperand &WarpgroupMmaOp::getDescriptorAMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &WarpgroupMmaOp::getDescriptorBMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange WarpgroupMmaOp::getMatrixCMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair WarpgroupMmaOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range WarpgroupMmaOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range WarpgroupMmaOp::getMatrixD() { + return getODSResults(0); +} + +::mlir::LogicalResult WarpgroupMmaOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.transposeA; + auto attr = dict.get("transposeA"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for transposeA in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `transposeA` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.transposeB; + auto attr = dict.get("transposeB"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for transposeB in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `transposeB` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.waitGroup; + auto attr = dict.get("waitGroup"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for waitGroup in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `waitGroup` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute WarpgroupMmaOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.transposeA; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("transposeA", + propStorage)); + } + + { + const auto &propStorage = prop.transposeB; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("transposeB", + propStorage)); + } + + { + const auto &propStorage = prop.waitGroup; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("waitGroup", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code WarpgroupMmaOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.transposeA.getAsOpaquePointer()), + llvm::hash_value(prop.transposeB.getAsOpaquePointer()), + llvm::hash_value(prop.waitGroup.getAsOpaquePointer())); +} + +std::optional WarpgroupMmaOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "transposeA") + return prop.transposeA; + + if (name == "transposeB") + return prop.transposeB; + + if (name == "waitGroup") + return prop.waitGroup; + return std::nullopt; +} + +void WarpgroupMmaOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "transposeA") { + prop.transposeA = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "transposeB") { + prop.transposeB = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "waitGroup") { + prop.waitGroup = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void WarpgroupMmaOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.transposeA) attrs.append("transposeA", prop.transposeA); + + if (prop.transposeB) attrs.append("transposeB", prop.transposeB); + + if (prop.waitGroup) attrs.append("waitGroup", prop.waitGroup); +} + +::mlir::LogicalResult WarpgroupMmaOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getTransposeAAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(attr, "transposeA", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTransposeBAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(attr, "transposeB", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWaitGroupAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU2(attr, "waitGroup", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WarpgroupMmaOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.transposeA))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.transposeB))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.waitGroup))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WarpgroupMmaOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.transposeA); + + writer.writeOptionalAttribute(prop.transposeB); + + writer.writeOptionalAttribute(prop.waitGroup); +} + +::mlir::IntegerAttr WarpgroupMmaOp::getWaitGroupAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().waitGroup); +} + +uint32_t WarpgroupMmaOp::getWaitGroup() { + auto attr = getWaitGroupAttr(); + if (!attr) + return ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), 1).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr WarpgroupMmaOp::getTransposeAAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().transposeA); +} + +::std::optional WarpgroupMmaOp::getTransposeA() { + auto attr = getTransposeAAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +::mlir::UnitAttr WarpgroupMmaOp::getTransposeBAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().transposeB); +} + +::std::optional WarpgroupMmaOp::getTransposeB() { + auto attr = getTransposeBAttr(); + return attr ? ::std::optional(attr != nullptr) : (::std::nullopt); +} + +void WarpgroupMmaOp::setWaitGroupAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getWaitGroupAttrName(), attr); +} + +void WarpgroupMmaOp::setWaitGroup(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getWaitGroupAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getWaitGroupAttrName()); +} + +void WarpgroupMmaOp::setTransposeAAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getTransposeAAttrName(), attr); +} + +void WarpgroupMmaOp::setTransposeA(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getTransposeAAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getTransposeAAttrName()); +} + +void WarpgroupMmaOp::setTransposeBAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getTransposeBAttrName(), attr); +} + +void WarpgroupMmaOp::setTransposeB(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getTransposeBAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getTransposeBAttrName()); +} + +::mlir::Attribute WarpgroupMmaOp::removeWaitGroupAttr() { + auto &attr = getProperties().waitGroup; + attr = {}; + return attr; +} + +::mlir::Attribute WarpgroupMmaOp::removeTransposeAAttr() { + auto &attr = getProperties().transposeA; + attr = {}; + return attr; +} + +::mlir::Attribute WarpgroupMmaOp::removeTransposeBAttr() { + auto &attr = getProperties().transposeB; + attr = {}; + return attr; +} + +void WarpgroupMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange matrixD, ::mlir::Value descriptorA, ::mlir::Value descriptorB, /*optional*/::mlir::IntegerAttr waitGroup, /*optional*/::mlir::UnitAttr transposeA, /*optional*/::mlir::UnitAttr transposeB, ::mlir::ValueRange matrixC) { + odsState.addOperands(descriptorA); + odsState.addOperands(descriptorB); + odsState.addOperands(matrixC); + if (waitGroup) { + odsState.getOrAddProperties().waitGroup = waitGroup; + } + if (transposeA) { + odsState.getOrAddProperties().transposeA = transposeA; + } + if (transposeB) { + odsState.getOrAddProperties().transposeB = transposeB; + } + odsState.addTypes(matrixD); +} + +void WarpgroupMmaOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange matrixD, ::mlir::Value descriptorA, ::mlir::Value descriptorB, /*optional*/uint32_t waitGroup, /*optional*/::mlir::UnitAttr transposeA, /*optional*/::mlir::UnitAttr transposeB, ::mlir::ValueRange matrixC) { + odsState.addOperands(descriptorA); + odsState.addOperands(descriptorB); + odsState.addOperands(matrixC); + odsState.getOrAddProperties().waitGroup = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), waitGroup); + if (transposeA) { + odsState.getOrAddProperties().transposeA = transposeA; + } + if (transposeB) { + odsState.getOrAddProperties().transposeB = transposeB; + } + odsState.addTypes(matrixD); +} + +void WarpgroupMmaOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WarpgroupMmaOp::verifyInvariantsImpl() { + auto tblgen_transposeA = getProperties().transposeA; (void)tblgen_transposeA; + auto tblgen_transposeB = getProperties().transposeB; (void)tblgen_transposeB; + auto tblgen_waitGroup = getProperties().waitGroup; (void)tblgen_waitGroup; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU2(*this, tblgen_waitGroup, "waitGroup"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(*this, tblgen_transposeA, "transposeA"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_NVGPU1(*this, tblgen_transposeB, "transposeB"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU10(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU11(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult WarpgroupMmaOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WarpgroupMmaOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand descriptorARawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> descriptorAOperands(descriptorARawOperands); ::llvm::SMLoc descriptorAOperandsLoc; + (void)descriptorAOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand descriptorBRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> descriptorBOperands(descriptorBRawOperands); ::llvm::SMLoc descriptorBOperandsLoc; + (void)descriptorBOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> matrixCOperands; + ::llvm::SMLoc matrixCOperandsLoc; + (void)matrixCOperandsLoc; + ::mlir::Type descriptorARawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> descriptorATypes(descriptorARawTypes); + ::mlir::Type descriptorBRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> descriptorBTypes(descriptorBRawTypes); + ::llvm::SmallVector<::mlir::Type, 1> matrixCTypes; + ::llvm::SmallVector<::mlir::Type, 1> matrixDTypes; + + descriptorAOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(descriptorARawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + descriptorBOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(descriptorBRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + matrixCOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(matrixCOperands)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::WarpgroupMatrixDescriptorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + descriptorARawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::nvgpu::WarpgroupMatrixDescriptorType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + descriptorBRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseTypeList(matrixCTypes)) + return ::mlir::failure(); + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseTypeList(matrixDTypes)) + return ::mlir::failure(); + result.addTypes(matrixDTypes); + if (parser.resolveOperands(descriptorAOperands, descriptorATypes, descriptorAOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(descriptorBOperands, descriptorBTypes, descriptorBOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(matrixCOperands, matrixCTypes, matrixCOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WarpgroupMmaOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getDescriptorA(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDescriptorB(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMatrixC(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWaitGroupAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 1))) + elidedAttrs.push_back("waitGroup"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getDescriptorA().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::WarpgroupMatrixDescriptorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getDescriptorB().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::nvgpu::WarpgroupMatrixDescriptorType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getMatrixC().getTypes(); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getMatrixD().getTypes(); +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupMmaOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::WarpgroupMmaStoreOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WarpgroupMmaStoreOpGenericAdaptorBase::WarpgroupMmaStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("nvgpu.warpgroup.mma.store", odsAttrs.getContext()); +} + +WarpgroupMmaStoreOpGenericAdaptorBase::WarpgroupMmaStoreOpGenericAdaptorBase(WarpgroupMmaStoreOp op) : WarpgroupMmaStoreOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WarpgroupMmaStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr WarpgroupMmaStoreOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +WarpgroupMmaStoreOpAdaptor::WarpgroupMmaStoreOpAdaptor(WarpgroupMmaStoreOp op) : WarpgroupMmaStoreOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WarpgroupMmaStoreOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair WarpgroupMmaStoreOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true, false}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range WarpgroupMmaStoreOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range WarpgroupMmaStoreOp::getMatrixD() { + return getODSOperands(0); +} + +::mlir::TypedValue<::mlir::MemRefType> WarpgroupMmaStoreOp::getDstMemref() { + return ::llvm::cast<::mlir::TypedValue<::mlir::MemRefType>>(*getODSOperands(1).begin()); +} + +::mlir::MutableOperandRange WarpgroupMmaStoreOp::getMatrixDMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +::mlir::OpOperand &WarpgroupMmaStoreOp::getDstMemrefMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair WarpgroupMmaStoreOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WarpgroupMmaStoreOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void WarpgroupMmaStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange matrixD, ::mlir::Value dstMemref) { + odsState.addOperands(matrixD); + odsState.addOperands(dstMemref); +} + +void WarpgroupMmaStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange matrixD, ::mlir::Value dstMemref) { + odsState.addOperands(matrixD); + odsState.addOperands(dstMemref); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WarpgroupMmaStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WarpgroupMmaStoreOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU11(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_NVGPU0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult WarpgroupMmaStoreOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WarpgroupMmaStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> matrixDOperands; + ::llvm::SMLoc matrixDOperandsLoc; + (void)matrixDOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand dstMemrefRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstMemrefOperands(dstMemrefRawOperands); ::llvm::SMLoc dstMemrefOperandsLoc; + (void)dstMemrefOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> matrixDTypes; + ::mlir::Type dstMemrefRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> dstMemrefTypes(dstMemrefRawTypes); + if (parser.parseLSquare()) + return ::mlir::failure(); + + matrixDOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(matrixDOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + dstMemrefOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(dstMemrefRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(matrixDTypes)) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + ::mlir::MemRefType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + dstMemrefRawTypes[0] = type; + } + if (parser.resolveOperands(matrixDOperands, matrixDTypes, matrixDOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dstMemrefOperands, dstMemrefTypes, dstMemrefOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WarpgroupMmaStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << "["; + _odsPrinter << getMatrixD(); + _odsPrinter << "]"; + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getDstMemref(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getMatrixD().getTypes(); + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + { + auto type = getDstMemref().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +void WarpgroupMmaStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(1)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupMmaStoreOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPU.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPU.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..eac4b319c6e289aef45cc71e5da4f5dc49f3d823 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPU.h.inc @@ -0,0 +1,2675 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace nvgpu { +class DeviceAsyncCopyOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class DeviceAsyncCreateGroupOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class DeviceAsyncWaitOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class LdMatrixOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class MBarrierArriveExpectTxOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class MBarrierArriveNoCompleteOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class MBarrierArriveOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class MBarrierCreateOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class MBarrierInitOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class MBarrierTestWaitOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class MBarrierTryWaitParityOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class MmaSparseSyncOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class MmaSyncOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class TmaAsyncLoadOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class TmaCreateDescriptorOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class WarpgroupGenerateDescriptorOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class WarpgroupMmaOp; +} // namespace nvgpu +} // namespace mlir +namespace mlir { +namespace nvgpu { +class WarpgroupMmaStoreOp; +} // namespace nvgpu +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::DeviceAsyncCopyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeviceAsyncCopyOpGenericAdaptorBase { +public: + struct Properties { + using bypassL1Ty = ::mlir::UnitAttr; + bypassL1Ty bypassL1; + + auto getBypassL1() { + auto &propStorage = this->bypassL1; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setBypassL1(const ::mlir::UnitAttr &propValue) { + this->bypassL1 = propValue; + } + using dstElementsTy = ::mlir::IntegerAttr; + dstElementsTy dstElements; + + auto getDstElements() { + auto &propStorage = this->dstElements; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setDstElements(const ::mlir::IntegerAttr &propValue) { + this->dstElements = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.bypassL1 == this->bypassL1 && + rhs.dstElements == this->dstElements && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DeviceAsyncCopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DeviceAsyncCopyOpGenericAdaptorBase(DeviceAsyncCopyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDstElementsAttr(); + ::llvm::APInt getDstElements(); + ::mlir::UnitAttr getBypassL1Attr(); + ::std::optional getBypassL1(); +}; +} // namespace detail +template +class DeviceAsyncCopyOpGenericAdaptor : public detail::DeviceAsyncCopyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeviceAsyncCopyOpGenericAdaptorBase; +public: + DeviceAsyncCopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeviceAsyncCopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeviceAsyncCopyOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DeviceAsyncCopyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDst() { + return (*getODSOperands(0).begin()); + } + + RangeT getDstIndices() { + return getODSOperands(1); + } + + ValueT getSrc() { + return (*getODSOperands(2).begin()); + } + + RangeT getSrcIndices() { + return getODSOperands(3); + } + + ValueT getSrcElements() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeviceAsyncCopyOpAdaptor : public DeviceAsyncCopyOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeviceAsyncCopyOpGenericAdaptor::DeviceAsyncCopyOpGenericAdaptor; + DeviceAsyncCopyOpAdaptor(DeviceAsyncCopyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeviceAsyncCopyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeviceAsyncCopyOpAdaptor; + template + using GenericAdaptor = DeviceAsyncCopyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("bypassL1"), ::llvm::StringRef("dstElements"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBypassL1AttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBypassL1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDstElementsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDstElementsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.device_async_copy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getDst(); + ::mlir::Operation::operand_range getDstIndices(); + ::mlir::TypedValue<::mlir::MemRefType> getSrc(); + ::mlir::Operation::operand_range getSrcIndices(); + ::mlir::TypedValue<::mlir::IndexType> getSrcElements(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::MutableOperandRange getDstIndicesMutable(); + ::mlir::OpOperand &getSrcMutable(); + ::mlir::MutableOperandRange getSrcIndicesMutable(); + ::mlir::MutableOperandRange getSrcElementsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::DeviceAsyncTokenType> getAsyncToken(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getDstElementsAttr(); + ::llvm::APInt getDstElements(); + ::mlir::UnitAttr getBypassL1Attr(); + ::std::optional getBypassL1(); + void setDstElementsAttr(::mlir::IntegerAttr attr); + void setDstElements(::llvm::APInt attrValue); + void setBypassL1Attr(::mlir::UnitAttr attr); + void setBypassL1(bool attrValue); + ::mlir::Attribute removeBypassL1Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type asyncToken, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::IntegerAttr dstElements, /*optional*/::mlir::Value srcElements, /*optional*/::mlir::UnitAttr bypassL1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::IntegerAttr dstElements, /*optional*/::mlir::Value srcElements, /*optional*/::mlir::UnitAttr bypassL1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type asyncToken, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::llvm::APInt dstElements, /*optional*/::mlir::Value srcElements, /*optional*/::mlir::UnitAttr bypassL1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::llvm::APInt dstElements, /*optional*/::mlir::Value srcElements, /*optional*/::mlir::UnitAttr bypassL1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::DeviceAsyncCopyOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::DeviceAsyncCreateGroupOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeviceAsyncCreateGroupOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeviceAsyncCreateGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeviceAsyncCreateGroupOpGenericAdaptorBase(DeviceAsyncCreateGroupOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeviceAsyncCreateGroupOpGenericAdaptor : public detail::DeviceAsyncCreateGroupOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeviceAsyncCreateGroupOpGenericAdaptorBase; +public: + DeviceAsyncCreateGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeviceAsyncCreateGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeviceAsyncCreateGroupOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeviceAsyncCreateGroupOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputTokens() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeviceAsyncCreateGroupOpAdaptor : public DeviceAsyncCreateGroupOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeviceAsyncCreateGroupOpGenericAdaptor::DeviceAsyncCreateGroupOpGenericAdaptor; + DeviceAsyncCreateGroupOpAdaptor(DeviceAsyncCreateGroupOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeviceAsyncCreateGroupOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeviceAsyncCreateGroupOpAdaptor; + template + using GenericAdaptor = DeviceAsyncCreateGroupOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.device_async_create_group"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputTokens(); + ::mlir::MutableOperandRange getInputTokensMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::DeviceAsyncTokenType> getAsyncToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type asyncToken, ::mlir::ValueRange inputTokens); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::DeviceAsyncCreateGroupOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::DeviceAsyncWaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeviceAsyncWaitOpGenericAdaptorBase { +public: + struct Properties { + using numGroupsTy = ::mlir::IntegerAttr; + numGroupsTy numGroups; + + auto getNumGroups() { + auto &propStorage = this->numGroups; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setNumGroups(const ::mlir::IntegerAttr &propValue) { + this->numGroups = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.numGroups == this->numGroups && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DeviceAsyncWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DeviceAsyncWaitOpGenericAdaptorBase(DeviceAsyncWaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumGroupsAttr(); + ::std::optional getNumGroups(); +}; +} // namespace detail +template +class DeviceAsyncWaitOpGenericAdaptor : public detail::DeviceAsyncWaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeviceAsyncWaitOpGenericAdaptorBase; +public: + DeviceAsyncWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeviceAsyncWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeviceAsyncWaitOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DeviceAsyncWaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAsyncDependencies() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeviceAsyncWaitOpAdaptor : public DeviceAsyncWaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeviceAsyncWaitOpGenericAdaptor::DeviceAsyncWaitOpGenericAdaptor; + DeviceAsyncWaitOpAdaptor(DeviceAsyncWaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeviceAsyncWaitOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DeviceAsyncWaitOpAdaptor; + template + using GenericAdaptor = DeviceAsyncWaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("numGroups")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.device_async_wait"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::DeviceAsyncTokenType> getAsyncDependencies(); + ::mlir::OpOperand &getAsyncDependenciesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getNumGroupsAttr(); + ::std::optional getNumGroups(); + void setNumGroupsAttr(::mlir::IntegerAttr attr); + void setNumGroups(::std::optional attrValue); + ::mlir::Attribute removeNumGroupsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value asyncDependencies, /*optional*/::mlir::IntegerAttr numGroups); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value asyncDependencies, /*optional*/::mlir::IntegerAttr numGroups); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::DeviceAsyncWaitOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::LdMatrixOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LdMatrixOpGenericAdaptorBase { +public: + struct Properties { + using numTilesTy = ::mlir::IntegerAttr; + numTilesTy numTiles; + + auto getNumTiles() { + auto &propStorage = this->numTiles; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setNumTiles(const ::mlir::IntegerAttr &propValue) { + this->numTiles = propValue; + } + using transposeTy = ::mlir::BoolAttr; + transposeTy transpose; + + auto getTranspose() { + auto &propStorage = this->transpose; + return ::llvm::cast<::mlir::BoolAttr>(propStorage); + } + void setTranspose(const ::mlir::BoolAttr &propValue) { + this->transpose = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.numTiles == this->numTiles && + rhs.transpose == this->transpose && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LdMatrixOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LdMatrixOpGenericAdaptorBase(LdMatrixOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTransposeAttr(); + bool getTranspose(); + ::mlir::IntegerAttr getNumTilesAttr(); + uint32_t getNumTiles(); +}; +} // namespace detail +template +class LdMatrixOpGenericAdaptor : public detail::LdMatrixOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LdMatrixOpGenericAdaptorBase; +public: + LdMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LdMatrixOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LdMatrixOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LdMatrixOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrcMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LdMatrixOpAdaptor : public LdMatrixOpGenericAdaptor<::mlir::ValueRange> { +public: + using LdMatrixOpGenericAdaptor::LdMatrixOpGenericAdaptor; + LdMatrixOpAdaptor(LdMatrixOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LdMatrixOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LdMatrixOpAdaptor; + template + using GenericAdaptor = LdMatrixOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("numTiles"), ::llvm::StringRef("transpose")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumTilesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumTilesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTransposeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTransposeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.ldmatrix"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSrcMemref(); + ::mlir::Operation::operand_range getIndices(); + ::mlir::OpOperand &getSrcMemrefMutable(); + ::mlir::MutableOperandRange getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getTransposeAttr(); + bool getTranspose(); + ::mlir::IntegerAttr getNumTilesAttr(); + uint32_t getNumTiles(); + void setTransposeAttr(::mlir::BoolAttr attr); + void setTranspose(bool attrValue); + void setNumTilesAttr(::mlir::IntegerAttr attr); + void setNumTiles(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::mlir::BoolAttr transpose, ::mlir::IntegerAttr numTiles); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcMemref, ::mlir::ValueRange indices, ::mlir::BoolAttr transpose, ::mlir::IntegerAttr numTiles); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value srcMemref, ::mlir::ValueRange indices, bool transpose, uint32_t numTiles); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value srcMemref, ::mlir::ValueRange indices, bool transpose, uint32_t numTiles); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::LdMatrixOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierArriveExpectTxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierArriveExpectTxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierArriveExpectTxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierArriveExpectTxOpGenericAdaptorBase(MBarrierArriveExpectTxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierArriveExpectTxOpGenericAdaptor : public detail::MBarrierArriveExpectTxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierArriveExpectTxOpGenericAdaptorBase; +public: + MBarrierArriveExpectTxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierArriveExpectTxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierArriveExpectTxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierArriveExpectTxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBarriers() { + return (*getODSOperands(0).begin()); + } + + ValueT getTxcount() { + return (*getODSOperands(1).begin()); + } + + ValueT getMbarId() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierArriveExpectTxOpAdaptor : public MBarrierArriveExpectTxOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierArriveExpectTxOpGenericAdaptor::MBarrierArriveExpectTxOpGenericAdaptor; + MBarrierArriveExpectTxOpAdaptor(MBarrierArriveExpectTxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierArriveExpectTxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierArriveExpectTxOpAdaptor; + template + using GenericAdaptor = MBarrierArriveExpectTxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.mbarrier.arrive.expect_tx"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> getBarriers(); + ::mlir::TypedValue<::mlir::IndexType> getTxcount(); + ::mlir::TypedValue<::mlir::IndexType> getMbarId(); + ::mlir::OpOperand &getBarriersMutable(); + ::mlir::OpOperand &getTxcountMutable(); + ::mlir::OpOperand &getMbarIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value barriers, ::mlir::Value txcount, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value txcount, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierArriveExpectTxOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierArriveNoCompleteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierArriveNoCompleteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierArriveNoCompleteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierArriveNoCompleteOpGenericAdaptorBase(MBarrierArriveNoCompleteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierArriveNoCompleteOpGenericAdaptor : public detail::MBarrierArriveNoCompleteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierArriveNoCompleteOpGenericAdaptorBase; +public: + MBarrierArriveNoCompleteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierArriveNoCompleteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierArriveNoCompleteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierArriveNoCompleteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBarriers() { + return (*getODSOperands(0).begin()); + } + + ValueT getMbarId() { + return (*getODSOperands(1).begin()); + } + + ValueT getCount() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierArriveNoCompleteOpAdaptor : public MBarrierArriveNoCompleteOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierArriveNoCompleteOpGenericAdaptor::MBarrierArriveNoCompleteOpGenericAdaptor; + MBarrierArriveNoCompleteOpAdaptor(MBarrierArriveNoCompleteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierArriveNoCompleteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierArriveNoCompleteOpAdaptor; + template + using GenericAdaptor = MBarrierArriveNoCompleteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.mbarrier.arrive.nocomplete"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> getBarriers(); + ::mlir::TypedValue<::mlir::IndexType> getMbarId(); + ::mlir::TypedValue<::mlir::IndexType> getCount(); + ::mlir::OpOperand &getBarriersMutable(); + ::mlir::OpOperand &getMbarIdMutable(); + ::mlir::OpOperand &getCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierTokenType> getToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::Value barriers, ::mlir::Value mbarId, ::mlir::Value count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value mbarId, ::mlir::Value count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierArriveNoCompleteOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierArriveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierArriveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierArriveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierArriveOpGenericAdaptorBase(MBarrierArriveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierArriveOpGenericAdaptor : public detail::MBarrierArriveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierArriveOpGenericAdaptorBase; +public: + MBarrierArriveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierArriveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierArriveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierArriveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBarriers() { + return (*getODSOperands(0).begin()); + } + + ValueT getMbarId() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierArriveOpAdaptor : public MBarrierArriveOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierArriveOpGenericAdaptor::MBarrierArriveOpGenericAdaptor; + MBarrierArriveOpAdaptor(MBarrierArriveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierArriveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierArriveOpAdaptor; + template + using GenericAdaptor = MBarrierArriveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.mbarrier.arrive"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> getBarriers(); + ::mlir::TypedValue<::mlir::IndexType> getMbarId(); + ::mlir::OpOperand &getBarriersMutable(); + ::mlir::OpOperand &getMbarIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierTokenType> getToken(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::Value barriers, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierArriveOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierCreateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierCreateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierCreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierCreateOpGenericAdaptorBase(MBarrierCreateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierCreateOpGenericAdaptor : public detail::MBarrierCreateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierCreateOpGenericAdaptorBase; +public: + MBarrierCreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierCreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierCreateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierCreateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierCreateOpAdaptor : public MBarrierCreateOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierCreateOpGenericAdaptor::MBarrierCreateOpGenericAdaptor; + MBarrierCreateOpAdaptor(MBarrierCreateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierCreateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierCreateOpAdaptor; + template + using GenericAdaptor = MBarrierCreateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.mbarrier.create"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> getBarriers(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type barriers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierCreateOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierInitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierInitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierInitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierInitOpGenericAdaptorBase(MBarrierInitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierInitOpGenericAdaptor : public detail::MBarrierInitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierInitOpGenericAdaptorBase; +public: + MBarrierInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierInitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierInitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBarriers() { + return (*getODSOperands(0).begin()); + } + + ValueT getCount() { + return (*getODSOperands(1).begin()); + } + + ValueT getMbarId() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierInitOpAdaptor : public MBarrierInitOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierInitOpGenericAdaptor::MBarrierInitOpGenericAdaptor; + MBarrierInitOpAdaptor(MBarrierInitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierInitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierInitOpAdaptor; + template + using GenericAdaptor = MBarrierInitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.mbarrier.init"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> getBarriers(); + ::mlir::TypedValue<::mlir::IndexType> getCount(); + ::mlir::TypedValue<::mlir::IndexType> getMbarId(); + ::mlir::OpOperand &getBarriersMutable(); + ::mlir::OpOperand &getCountMutable(); + ::mlir::OpOperand &getMbarIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value barriers, ::mlir::Value count, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value count, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierInitOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierTestWaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierTestWaitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierTestWaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierTestWaitOpGenericAdaptorBase(MBarrierTestWaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierTestWaitOpGenericAdaptor : public detail::MBarrierTestWaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierTestWaitOpGenericAdaptorBase; +public: + MBarrierTestWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierTestWaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierTestWaitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierTestWaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBarriers() { + return (*getODSOperands(0).begin()); + } + + ValueT getToken() { + return (*getODSOperands(1).begin()); + } + + ValueT getMbarId() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierTestWaitOpAdaptor : public MBarrierTestWaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierTestWaitOpGenericAdaptor::MBarrierTestWaitOpGenericAdaptor; + MBarrierTestWaitOpAdaptor(MBarrierTestWaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierTestWaitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierTestWaitOpAdaptor; + template + using GenericAdaptor = MBarrierTestWaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.mbarrier.test.wait"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> getBarriers(); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierTokenType> getToken(); + ::mlir::TypedValue<::mlir::IndexType> getMbarId(); + ::mlir::OpOperand &getBarriersMutable(); + ::mlir::OpOperand &getTokenMutable(); + ::mlir::OpOperand &getMbarIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getWaitComplete(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type waitComplete, ::mlir::Value barriers, ::mlir::Value token, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value token, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierTestWaitOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MBarrierTryWaitParityOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MBarrierTryWaitParityOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MBarrierTryWaitParityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MBarrierTryWaitParityOpGenericAdaptorBase(MBarrierTryWaitParityOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MBarrierTryWaitParityOpGenericAdaptor : public detail::MBarrierTryWaitParityOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MBarrierTryWaitParityOpGenericAdaptorBase; +public: + MBarrierTryWaitParityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MBarrierTryWaitParityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MBarrierTryWaitParityOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MBarrierTryWaitParityOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBarriers() { + return (*getODSOperands(0).begin()); + } + + ValueT getPhase() { + return (*getODSOperands(1).begin()); + } + + ValueT getTicks() { + return (*getODSOperands(2).begin()); + } + + ValueT getMbarId() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MBarrierTryWaitParityOpAdaptor : public MBarrierTryWaitParityOpGenericAdaptor<::mlir::ValueRange> { +public: + using MBarrierTryWaitParityOpGenericAdaptor::MBarrierTryWaitParityOpGenericAdaptor; + MBarrierTryWaitParityOpAdaptor(MBarrierTryWaitParityOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MBarrierTryWaitParityOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MBarrierTryWaitParityOpAdaptor; + template + using GenericAdaptor = MBarrierTryWaitParityOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.mbarrier.try_wait.parity"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> getBarriers(); + ::mlir::TypedValue<::mlir::IndexType> getPhase(); + ::mlir::TypedValue<::mlir::IndexType> getTicks(); + ::mlir::TypedValue<::mlir::IndexType> getMbarId(); + ::mlir::OpOperand &getBarriersMutable(); + ::mlir::OpOperand &getPhaseMutable(); + ::mlir::OpOperand &getTicksMutable(); + ::mlir::OpOperand &getMbarIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value barriers, ::mlir::Value phase, ::mlir::Value ticks, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value barriers, ::mlir::Value phase, ::mlir::Value ticks, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierTryWaitParityOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MmaSparseSyncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MmaSparseSyncOpGenericAdaptorBase { +public: + struct Properties { + using mmaShapeTy = ::mlir::ArrayAttr; + mmaShapeTy mmaShape; + + auto getMmaShape() { + auto &propStorage = this->mmaShape; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setMmaShape(const ::mlir::ArrayAttr &propValue) { + this->mmaShape = propValue; + } + using sparsitySelectorTy = ::mlir::IntegerAttr; + sparsitySelectorTy sparsitySelector; + + auto getSparsitySelector() { + auto &propStorage = this->sparsitySelector; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setSparsitySelector(const ::mlir::IntegerAttr &propValue) { + this->sparsitySelector = propValue; + } + using tf32EnabledTy = ::mlir::UnitAttr; + tf32EnabledTy tf32Enabled; + + auto getTf32Enabled() { + auto &propStorage = this->tf32Enabled; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setTf32Enabled(const ::mlir::UnitAttr &propValue) { + this->tf32Enabled = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.mmaShape == this->mmaShape && + rhs.sparsitySelector == this->sparsitySelector && + rhs.tf32Enabled == this->tf32Enabled && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MmaSparseSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MmaSparseSyncOpGenericAdaptorBase(MmaSparseSyncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getMmaShapeAttr(); + ::mlir::ArrayAttr getMmaShape(); + ::mlir::IntegerAttr getSparsitySelectorAttr(); + uint32_t getSparsitySelector(); + ::mlir::UnitAttr getTf32EnabledAttr(); + ::std::optional getTf32Enabled(); +}; +} // namespace detail +template +class MmaSparseSyncOpGenericAdaptor : public detail::MmaSparseSyncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MmaSparseSyncOpGenericAdaptorBase; +public: + MmaSparseSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MmaSparseSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MmaSparseSyncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MmaSparseSyncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMatrixA() { + return (*getODSOperands(0).begin()); + } + + ValueT getMatrixB() { + return (*getODSOperands(1).begin()); + } + + ValueT getMatrixC() { + return (*getODSOperands(2).begin()); + } + + ValueT getSparseMetadata() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MmaSparseSyncOpAdaptor : public MmaSparseSyncOpGenericAdaptor<::mlir::ValueRange> { +public: + using MmaSparseSyncOpGenericAdaptor::MmaSparseSyncOpGenericAdaptor; + MmaSparseSyncOpAdaptor(MmaSparseSyncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MmaSparseSyncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MmaSparseSyncOpAdaptor; + template + using GenericAdaptor = MmaSparseSyncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("mmaShape"), ::llvm::StringRef("sparsitySelector"), ::llvm::StringRef("tf32Enabled")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMmaShapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMmaShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSparsitySelectorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSparsitySelectorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTf32EnabledAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTf32EnabledAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.mma.sp.sync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMatrixA(); + ::mlir::TypedValue<::mlir::VectorType> getMatrixB(); + ::mlir::TypedValue<::mlir::VectorType> getMatrixC(); + ::mlir::TypedValue<::mlir::VectorType> getSparseMetadata(); + ::mlir::OpOperand &getMatrixAMutable(); + ::mlir::OpOperand &getMatrixBMutable(); + ::mlir::OpOperand &getMatrixCMutable(); + ::mlir::OpOperand &getSparseMetadataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getMmaShapeAttr(); + ::mlir::ArrayAttr getMmaShape(); + ::mlir::IntegerAttr getSparsitySelectorAttr(); + uint32_t getSparsitySelector(); + ::mlir::UnitAttr getTf32EnabledAttr(); + ::std::optional getTf32Enabled(); + void setMmaShapeAttr(::mlir::ArrayAttr attr); + void setSparsitySelectorAttr(::mlir::IntegerAttr attr); + void setSparsitySelector(uint32_t attrValue); + void setTf32EnabledAttr(::mlir::UnitAttr attr); + void setTf32Enabled(bool attrValue); + ::mlir::Attribute removeTf32EnabledAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value matrixA, Value matrixB, Value matrixC, Value sparseMetadata, ArrayRef mmaShape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::Value sparseMetadata, ::mlir::ArrayAttr mmaShape, ::mlir::IntegerAttr sparsitySelector, /*optional*/::mlir::UnitAttr tf32Enabled); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::Value sparseMetadata, ::mlir::ArrayAttr mmaShape, ::mlir::IntegerAttr sparsitySelector, /*optional*/::mlir::UnitAttr tf32Enabled); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::Value sparseMetadata, ::mlir::ArrayAttr mmaShape, uint32_t sparsitySelector, /*optional*/::mlir::UnitAttr tf32Enabled); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::Value sparseMetadata, ::mlir::ArrayAttr mmaShape, uint32_t sparsitySelector, /*optional*/::mlir::UnitAttr tf32Enabled); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + std::array getMmaShapeAsArray() { + ArrayAttr mmaShape = this->getMmaShape(); + assert(mmaShape.size() == 3 && "mmaShape should be three integers"); + return {::llvm::cast(mmaShape[0]).getInt(), + ::llvm::cast(mmaShape[1]).getInt(), + ::llvm::cast(mmaShape[2]).getInt()}; + } +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MmaSparseSyncOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::MmaSyncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MmaSyncOpGenericAdaptorBase { +public: + struct Properties { + using mmaShapeTy = ::mlir::ArrayAttr; + mmaShapeTy mmaShape; + + auto getMmaShape() { + auto &propStorage = this->mmaShape; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setMmaShape(const ::mlir::ArrayAttr &propValue) { + this->mmaShape = propValue; + } + using tf32EnabledTy = ::mlir::UnitAttr; + tf32EnabledTy tf32Enabled; + + auto getTf32Enabled() { + auto &propStorage = this->tf32Enabled; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setTf32Enabled(const ::mlir::UnitAttr &propValue) { + this->tf32Enabled = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.mmaShape == this->mmaShape && + rhs.tf32Enabled == this->tf32Enabled && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MmaSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MmaSyncOpGenericAdaptorBase(MmaSyncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getMmaShapeAttr(); + ::mlir::ArrayAttr getMmaShape(); + ::mlir::UnitAttr getTf32EnabledAttr(); + ::std::optional getTf32Enabled(); +}; +} // namespace detail +template +class MmaSyncOpGenericAdaptor : public detail::MmaSyncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MmaSyncOpGenericAdaptorBase; +public: + MmaSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MmaSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MmaSyncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MmaSyncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMatrixA() { + return (*getODSOperands(0).begin()); + } + + ValueT getMatrixB() { + return (*getODSOperands(1).begin()); + } + + ValueT getMatrixC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MmaSyncOpAdaptor : public MmaSyncOpGenericAdaptor<::mlir::ValueRange> { +public: + using MmaSyncOpGenericAdaptor::MmaSyncOpGenericAdaptor; + MmaSyncOpAdaptor(MmaSyncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MmaSyncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MmaSyncOpAdaptor; + template + using GenericAdaptor = MmaSyncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("mmaShape"), ::llvm::StringRef("tf32Enabled")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMmaShapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMmaShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTf32EnabledAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTf32EnabledAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.mma.sync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getMatrixA(); + ::mlir::TypedValue<::mlir::VectorType> getMatrixB(); + ::mlir::TypedValue<::mlir::VectorType> getMatrixC(); + ::mlir::OpOperand &getMatrixAMutable(); + ::mlir::OpOperand &getMatrixBMutable(); + ::mlir::OpOperand &getMatrixCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::VectorType> getRes(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getMmaShapeAttr(); + ::mlir::ArrayAttr getMmaShape(); + ::mlir::UnitAttr getTf32EnabledAttr(); + ::std::optional getTf32Enabled(); + void setMmaShapeAttr(::mlir::ArrayAttr attr); + void setTf32EnabledAttr(::mlir::UnitAttr attr); + void setTf32Enabled(bool attrValue); + ::mlir::Attribute removeTf32EnabledAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value matrixA, Value matrixB, Value matrixC, ArrayAttr mmaShape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value matrixA, Value matrixB, Value matrixC, ArrayRef mmaShape, bool tf32Enabled = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::ArrayAttr mmaShape, /*optional*/::mlir::UnitAttr tf32Enabled); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrixA, ::mlir::Value matrixB, ::mlir::Value matrixC, ::mlir::ArrayAttr mmaShape, /*optional*/::mlir::UnitAttr tf32Enabled); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + std::array getMmaShapeAsArray() { + ArrayAttr mmaShape = this->getMmaShape(); + assert(mmaShape.size() == 3 && "mmaShape should be three integers"); + return {::llvm::cast(mmaShape[0]).getInt(), + ::llvm::cast(mmaShape[1]).getInt(), + ::llvm::cast(mmaShape[2]).getInt()}; + } +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MmaSyncOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::TmaAsyncLoadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TmaAsyncLoadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TmaAsyncLoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TmaAsyncLoadOpGenericAdaptorBase(TmaAsyncLoadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TmaAsyncLoadOpGenericAdaptor : public detail::TmaAsyncLoadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TmaAsyncLoadOpGenericAdaptorBase; +public: + TmaAsyncLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TmaAsyncLoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TmaAsyncLoadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TmaAsyncLoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDst() { + return (*getODSOperands(0).begin()); + } + + ValueT getBarriers() { + return (*getODSOperands(1).begin()); + } + + ValueT getTensorMapDescriptor() { + return (*getODSOperands(2).begin()); + } + + RangeT getCoordinates() { + return getODSOperands(3); + } + + ValueT getMbarId() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TmaAsyncLoadOpAdaptor : public TmaAsyncLoadOpGenericAdaptor<::mlir::ValueRange> { +public: + using TmaAsyncLoadOpGenericAdaptor::TmaAsyncLoadOpGenericAdaptor; + TmaAsyncLoadOpAdaptor(TmaAsyncLoadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TmaAsyncLoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TmaAsyncLoadOpAdaptor; + template + using GenericAdaptor = TmaAsyncLoadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.tma.async.load"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getDst(); + ::mlir::TypedValue<::mlir::nvgpu::MBarrierGroupType> getBarriers(); + ::mlir::TypedValue<::mlir::nvgpu::TensorMapDescriptorType> getTensorMapDescriptor(); + ::mlir::Operation::operand_range getCoordinates(); + ::mlir::TypedValue<::mlir::IndexType> getMbarId(); + ::mlir::OpOperand &getDstMutable(); + ::mlir::OpOperand &getBarriersMutable(); + ::mlir::OpOperand &getTensorMapDescriptorMutable(); + ::mlir::MutableOperandRange getCoordinatesMutable(); + ::mlir::OpOperand &getMbarIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dst, ::mlir::Value barriers, ::mlir::Value tensorMapDescriptor, ::mlir::ValueRange coordinates, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dst, ::mlir::Value barriers, ::mlir::Value tensorMapDescriptor, ::mlir::ValueRange coordinates, ::mlir::Value mbarId); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TmaAsyncLoadOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::TmaCreateDescriptorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TmaCreateDescriptorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TmaCreateDescriptorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TmaCreateDescriptorOpGenericAdaptorBase(TmaCreateDescriptorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TmaCreateDescriptorOpGenericAdaptor : public detail::TmaCreateDescriptorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TmaCreateDescriptorOpGenericAdaptorBase; +public: + TmaCreateDescriptorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TmaCreateDescriptorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TmaCreateDescriptorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TmaCreateDescriptorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getBoxDimensions() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TmaCreateDescriptorOpAdaptor : public TmaCreateDescriptorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TmaCreateDescriptorOpGenericAdaptor::TmaCreateDescriptorOpGenericAdaptor; + TmaCreateDescriptorOpAdaptor(TmaCreateDescriptorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TmaCreateDescriptorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = TmaCreateDescriptorOpAdaptor; + template + using GenericAdaptor = TmaCreateDescriptorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.tma.create.descriptor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::UnrankedMemRefType> getTensor(); + ::mlir::Operation::operand_range getBoxDimensions(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::MutableOperandRange getBoxDimensionsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::TensorMapDescriptorType> getTensorMap(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensorMap, ::mlir::Value tensor, ::mlir::ValueRange boxDimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::ValueRange boxDimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TmaCreateDescriptorOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::WarpgroupGenerateDescriptorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WarpgroupGenerateDescriptorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WarpgroupGenerateDescriptorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WarpgroupGenerateDescriptorOpGenericAdaptorBase(WarpgroupGenerateDescriptorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WarpgroupGenerateDescriptorOpGenericAdaptor : public detail::WarpgroupGenerateDescriptorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WarpgroupGenerateDescriptorOpGenericAdaptorBase; +public: + WarpgroupGenerateDescriptorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WarpgroupGenerateDescriptorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WarpgroupGenerateDescriptorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WarpgroupGenerateDescriptorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorMap() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WarpgroupGenerateDescriptorOpAdaptor : public WarpgroupGenerateDescriptorOpGenericAdaptor<::mlir::ValueRange> { +public: + using WarpgroupGenerateDescriptorOpGenericAdaptor::WarpgroupGenerateDescriptorOpGenericAdaptor; + WarpgroupGenerateDescriptorOpAdaptor(WarpgroupGenerateDescriptorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WarpgroupGenerateDescriptorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WarpgroupGenerateDescriptorOpAdaptor; + template + using GenericAdaptor = WarpgroupGenerateDescriptorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.warpgroup.generate.descriptor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getTensor(); + ::mlir::TypedValue<::mlir::nvgpu::TensorMapDescriptorType> getTensorMap(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getTensorMapMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::WarpgroupMatrixDescriptorType> getDescriptor(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type descriptor, ::mlir::Value tensor, ::mlir::Value tensorMap); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value tensorMap); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupGenerateDescriptorOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::WarpgroupMmaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WarpgroupMmaOpGenericAdaptorBase { +public: + struct Properties { + using transposeATy = ::mlir::UnitAttr; + transposeATy transposeA; + + auto getTransposeA() { + auto &propStorage = this->transposeA; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setTransposeA(const ::mlir::UnitAttr &propValue) { + this->transposeA = propValue; + } + using transposeBTy = ::mlir::UnitAttr; + transposeBTy transposeB; + + auto getTransposeB() { + auto &propStorage = this->transposeB; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setTransposeB(const ::mlir::UnitAttr &propValue) { + this->transposeB = propValue; + } + using waitGroupTy = ::mlir::IntegerAttr; + waitGroupTy waitGroup; + + auto getWaitGroup() { + auto &propStorage = this->waitGroup; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setWaitGroup(const ::mlir::IntegerAttr &propValue) { + this->waitGroup = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.transposeA == this->transposeA && + rhs.transposeB == this->transposeB && + rhs.waitGroup == this->waitGroup && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + WarpgroupMmaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + WarpgroupMmaOpGenericAdaptorBase(WarpgroupMmaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getWaitGroupAttr(); + uint32_t getWaitGroup(); + ::mlir::UnitAttr getTransposeAAttr(); + ::std::optional getTransposeA(); + ::mlir::UnitAttr getTransposeBAttr(); + ::std::optional getTransposeB(); +}; +} // namespace detail +template +class WarpgroupMmaOpGenericAdaptor : public detail::WarpgroupMmaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WarpgroupMmaOpGenericAdaptorBase; +public: + WarpgroupMmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WarpgroupMmaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WarpgroupMmaOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + WarpgroupMmaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDescriptorA() { + return (*getODSOperands(0).begin()); + } + + ValueT getDescriptorB() { + return (*getODSOperands(1).begin()); + } + + RangeT getMatrixC() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WarpgroupMmaOpAdaptor : public WarpgroupMmaOpGenericAdaptor<::mlir::ValueRange> { +public: + using WarpgroupMmaOpGenericAdaptor::WarpgroupMmaOpGenericAdaptor; + WarpgroupMmaOpAdaptor(WarpgroupMmaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WarpgroupMmaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WarpgroupMmaOpAdaptor; + template + using GenericAdaptor = WarpgroupMmaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("transposeA"), ::llvm::StringRef("transposeB"), ::llvm::StringRef("waitGroup")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTransposeBAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTransposeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getWaitGroupAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getWaitGroupAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.warpgroup.mma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::nvgpu::WarpgroupMatrixDescriptorType> getDescriptorA(); + ::mlir::TypedValue<::mlir::nvgpu::WarpgroupMatrixDescriptorType> getDescriptorB(); + ::mlir::Operation::operand_range getMatrixC(); + ::mlir::OpOperand &getDescriptorAMutable(); + ::mlir::OpOperand &getDescriptorBMutable(); + ::mlir::MutableOperandRange getMatrixCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getMatrixD(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getWaitGroupAttr(); + uint32_t getWaitGroup(); + ::mlir::UnitAttr getTransposeAAttr(); + ::std::optional getTransposeA(); + ::mlir::UnitAttr getTransposeBAttr(); + ::std::optional getTransposeB(); + void setWaitGroupAttr(::mlir::IntegerAttr attr); + void setWaitGroup(::std::optional attrValue); + void setTransposeAAttr(::mlir::UnitAttr attr); + void setTransposeA(bool attrValue); + void setTransposeBAttr(::mlir::UnitAttr attr); + void setTransposeB(bool attrValue); + ::mlir::Attribute removeWaitGroupAttr(); + ::mlir::Attribute removeTransposeAAttr(); + ::mlir::Attribute removeTransposeBAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange matrixD, ::mlir::Value descriptorA, ::mlir::Value descriptorB, /*optional*/::mlir::IntegerAttr waitGroup, /*optional*/::mlir::UnitAttr transposeA, /*optional*/::mlir::UnitAttr transposeB, ::mlir::ValueRange matrixC); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange matrixD, ::mlir::Value descriptorA, ::mlir::Value descriptorB, /*optional*/uint32_t waitGroup, /*optional*/::mlir::UnitAttr transposeA, /*optional*/::mlir::UnitAttr transposeB, ::mlir::ValueRange matrixC); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupMmaOp) + +namespace mlir { +namespace nvgpu { + +//===----------------------------------------------------------------------===// +// ::mlir::nvgpu::WarpgroupMmaStoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WarpgroupMmaStoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WarpgroupMmaStoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WarpgroupMmaStoreOpGenericAdaptorBase(WarpgroupMmaStoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WarpgroupMmaStoreOpGenericAdaptor : public detail::WarpgroupMmaStoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WarpgroupMmaStoreOpGenericAdaptorBase; +public: + WarpgroupMmaStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WarpgroupMmaStoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WarpgroupMmaStoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WarpgroupMmaStoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getMatrixD() { + return getODSOperands(0); + } + + ValueT getDstMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WarpgroupMmaStoreOpAdaptor : public WarpgroupMmaStoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using WarpgroupMmaStoreOpGenericAdaptor::WarpgroupMmaStoreOpGenericAdaptor; + WarpgroupMmaStoreOpAdaptor(WarpgroupMmaStoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WarpgroupMmaStoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WarpgroupMmaStoreOpAdaptor; + template + using GenericAdaptor = WarpgroupMmaStoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("nvgpu.warpgroup.mma.store"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getMatrixD(); + ::mlir::TypedValue<::mlir::MemRefType> getDstMemref(); + ::mlir::MutableOperandRange getMatrixDMutable(); + ::mlir::OpOperand &getDstMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange matrixD, ::mlir::Value dstMemref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange matrixD, ::mlir::Value dstMemref); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupMmaStoreOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..cb5fd38c88ce914dccb7095d12a97e783f577b62 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.cpp.inc @@ -0,0 +1,380 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::nvgpu::TensorMapInterleaveKindAttr, +::mlir::nvgpu::TensorMapL2PromoKindAttr, +::mlir::nvgpu::TensorMapOOBKindAttr, +::mlir::nvgpu::TensorMapSwizzleKindAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::nvgpu::TensorMapInterleaveKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::TensorMapInterleaveKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::nvgpu::TensorMapL2PromoKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::TensorMapL2PromoKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::nvgpu::TensorMapOOBKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::TensorMapOOBKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::nvgpu::TensorMapSwizzleKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::TensorMapSwizzleKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::nvgpu::TensorMapInterleaveKindAttr>([&](auto t) { + printer << ::mlir::nvgpu::TensorMapInterleaveKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::nvgpu::TensorMapL2PromoKindAttr>([&](auto t) { + printer << ::mlir::nvgpu::TensorMapL2PromoKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::nvgpu::TensorMapOOBKindAttr>([&](auto t) { + printer << ::mlir::nvgpu::TensorMapOOBKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::nvgpu::TensorMapSwizzleKindAttr>([&](auto t) { + printer << ::mlir::nvgpu::TensorMapSwizzleKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace nvgpu { +namespace detail { +struct TensorMapInterleaveKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::nvgpu::TensorMapInterleaveKind>; + TensorMapInterleaveKindAttrStorage(::mlir::nvgpu::TensorMapInterleaveKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static TensorMapInterleaveKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) TensorMapInterleaveKindAttrStorage(std::move(value)); + } + + ::mlir::nvgpu::TensorMapInterleaveKind value; +}; +} // namespace detail +TensorMapInterleaveKindAttr TensorMapInterleaveKindAttr::get(::mlir::MLIRContext *context, ::mlir::nvgpu::TensorMapInterleaveKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute TensorMapInterleaveKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::nvgpu::TensorMapInterleaveKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::nvgpu::TensorMapInterleaveKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::nvgpu::symbolizeTensorMapInterleaveKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::nvgpu::TensorMapInterleaveKind" << " to be one of: " << "none" << ", " << "interleave_16b" << ", " << "interleave_32b")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TensorMapInterleaveAttr parameter 'value' which is to be a `::mlir::nvgpu::TensorMapInterleaveKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return TensorMapInterleaveKindAttr::get(odsParser.getContext(), + ::mlir::nvgpu::TensorMapInterleaveKind((*_result_value))); +} + +void TensorMapInterleaveKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyTensorMapInterleaveKind(getValue()); +} + +::mlir::nvgpu::TensorMapInterleaveKind TensorMapInterleaveKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapInterleaveKindAttr) +namespace mlir { +namespace nvgpu { +namespace detail { +struct TensorMapL2PromoKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::nvgpu::TensorMapL2PromoKind>; + TensorMapL2PromoKindAttrStorage(::mlir::nvgpu::TensorMapL2PromoKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static TensorMapL2PromoKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) TensorMapL2PromoKindAttrStorage(std::move(value)); + } + + ::mlir::nvgpu::TensorMapL2PromoKind value; +}; +} // namespace detail +TensorMapL2PromoKindAttr TensorMapL2PromoKindAttr::get(::mlir::MLIRContext *context, ::mlir::nvgpu::TensorMapL2PromoKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute TensorMapL2PromoKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::nvgpu::TensorMapL2PromoKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::nvgpu::TensorMapL2PromoKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::nvgpu::symbolizeTensorMapL2PromoKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::nvgpu::TensorMapL2PromoKind" << " to be one of: " << "none" << ", " << "l2promo_64b" << ", " << "l2promo_128b" << ", " << "l2promo_256b")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TensorMapL2PromoAttr parameter 'value' which is to be a `::mlir::nvgpu::TensorMapL2PromoKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return TensorMapL2PromoKindAttr::get(odsParser.getContext(), + ::mlir::nvgpu::TensorMapL2PromoKind((*_result_value))); +} + +void TensorMapL2PromoKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyTensorMapL2PromoKind(getValue()); +} + +::mlir::nvgpu::TensorMapL2PromoKind TensorMapL2PromoKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapL2PromoKindAttr) +namespace mlir { +namespace nvgpu { +namespace detail { +struct TensorMapOOBKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::nvgpu::TensorMapOOBKind>; + TensorMapOOBKindAttrStorage(::mlir::nvgpu::TensorMapOOBKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static TensorMapOOBKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) TensorMapOOBKindAttrStorage(std::move(value)); + } + + ::mlir::nvgpu::TensorMapOOBKind value; +}; +} // namespace detail +TensorMapOOBKindAttr TensorMapOOBKindAttr::get(::mlir::MLIRContext *context, ::mlir::nvgpu::TensorMapOOBKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute TensorMapOOBKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::nvgpu::TensorMapOOBKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::nvgpu::TensorMapOOBKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::nvgpu::symbolizeTensorMapOOBKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::nvgpu::TensorMapOOBKind" << " to be one of: " << "zero" << ", " << "nan")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TensorMapOOBAttr parameter 'value' which is to be a `::mlir::nvgpu::TensorMapOOBKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return TensorMapOOBKindAttr::get(odsParser.getContext(), + ::mlir::nvgpu::TensorMapOOBKind((*_result_value))); +} + +void TensorMapOOBKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyTensorMapOOBKind(getValue()); +} + +::mlir::nvgpu::TensorMapOOBKind TensorMapOOBKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapOOBKindAttr) +namespace mlir { +namespace nvgpu { +namespace detail { +struct TensorMapSwizzleKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::nvgpu::TensorMapSwizzleKind>; + TensorMapSwizzleKindAttrStorage(::mlir::nvgpu::TensorMapSwizzleKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static TensorMapSwizzleKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) TensorMapSwizzleKindAttrStorage(std::move(value)); + } + + ::mlir::nvgpu::TensorMapSwizzleKind value; +}; +} // namespace detail +TensorMapSwizzleKindAttr TensorMapSwizzleKindAttr::get(::mlir::MLIRContext *context, ::mlir::nvgpu::TensorMapSwizzleKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute TensorMapSwizzleKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::nvgpu::TensorMapSwizzleKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::nvgpu::TensorMapSwizzleKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::nvgpu::symbolizeTensorMapSwizzleKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::nvgpu::TensorMapSwizzleKind" << " to be one of: " << "none" << ", " << "swizzle_32b" << ", " << "swizzle_64b" << ", " << "swizzle_128b")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TensorMapSwizzleAttr parameter 'value' which is to be a `::mlir::nvgpu::TensorMapSwizzleKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return TensorMapSwizzleKindAttr::get(odsParser.getContext(), + ::mlir::nvgpu::TensorMapSwizzleKind((*_result_value))); +} + +void TensorMapSwizzleKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyTensorMapSwizzleKind(getValue()); +} + +::mlir::nvgpu::TensorMapSwizzleKind TensorMapSwizzleKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapSwizzleKindAttr) +namespace mlir { +namespace nvgpu { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute NVGPUDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void NVGPUDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace nvgpu +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e511307e43f1a369bbcdc3a55abda56ee58379be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.h.inc @@ -0,0 +1,91 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace nvgpu { +class TensorMapInterleaveKindAttr; +class TensorMapL2PromoKindAttr; +class TensorMapOOBKindAttr; +class TensorMapSwizzleKindAttr; +namespace detail { +struct TensorMapInterleaveKindAttrStorage; +} // namespace detail +class TensorMapInterleaveKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TensorMapInterleaveKindAttr get(::mlir::MLIRContext *context, ::mlir::nvgpu::TensorMapInterleaveKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"interleave"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::nvgpu::TensorMapInterleaveKind getValue() const; +}; +namespace detail { +struct TensorMapL2PromoKindAttrStorage; +} // namespace detail +class TensorMapL2PromoKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TensorMapL2PromoKindAttr get(::mlir::MLIRContext *context, ::mlir::nvgpu::TensorMapL2PromoKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"l2promo"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::nvgpu::TensorMapL2PromoKind getValue() const; +}; +namespace detail { +struct TensorMapOOBKindAttrStorage; +} // namespace detail +class TensorMapOOBKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TensorMapOOBKindAttr get(::mlir::MLIRContext *context, ::mlir::nvgpu::TensorMapOOBKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"oob"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::nvgpu::TensorMapOOBKind getValue() const; +}; +namespace detail { +struct TensorMapSwizzleKindAttrStorage; +} // namespace detail +class TensorMapSwizzleKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TensorMapSwizzleKindAttr get(::mlir::MLIRContext *context, ::mlir::nvgpu::TensorMapSwizzleKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"swizzle"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::nvgpu::TensorMapSwizzleKind getValue() const; +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapInterleaveKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapL2PromoKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapOOBKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapSwizzleKindAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..f359449531d628acc0bd7e35b8c2b23023bd9ac9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::NVGPUDialect) +namespace mlir { +namespace nvgpu { + +NVGPUDialect::NVGPUDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +NVGPUDialect::~NVGPUDialect() = default; + +} // namespace nvgpu +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..96af26842dafea2a3a1c12264f4329f763f7daee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h @@ -0,0 +1,37 @@ +//===- NVGPUDialect.h - MLIR Dialect for NVGPU ------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares the Target dialect for NVGPU in MLIR. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_NVGPU_NVGPUDIALECT_H_ +#define MLIR_DIALECT_NVGPU_NVGPUDIALECT_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#include "mlir/Dialect/NVGPU/IR/NVGPUEnums.h.inc" + +constexpr int kWarpSize = 32; + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.h.inc" + +#define GET_TYPEDEF_CLASSES +#include "mlir/Dialect/NVGPU/IR/NVGPUTypes.h.inc" + +#include "mlir/Dialect/NVGPU/IR/NVGPUDialect.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/NVGPU/IR/NVGPU.h.inc" + +#endif // MLIR_DIALECT_NVGPU_NVGPUDIALECT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..1a2d408ebc549cd428f77858b68063cf5814fc77 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h.inc @@ -0,0 +1,61 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace nvgpu { + +class NVGPUDialect : public ::mlir::Dialect { + explicit NVGPUDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~NVGPUDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("nvgpu"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; + + /// Return true if the given MemRefType has an integer address + /// space that matches the NVVM shared memory address space or + /// is a gpu::AddressSpaceAttr attribute with value 'workgroup`. + static bool hasSharedMemoryAddressSpace(MemRefType type); + + /// Return true if the given Attribute has an integer address + /// space that matches the NVVM shared memory address space or + /// is a gpu::AddressSpaceAttr attribute with value 'workgroup`. + static bool isSharedMemoryAddressSpace(Attribute type); + + /// Defines the MemRef memory space attribute numeric value that indicates + /// a memref is located in global memory. This should correspond to the + /// value used in NVVM. + static constexpr unsigned kGlobaldMemoryAddressSpace = 1; + + /// Defines the MemRef memory space attribute numeric value that indicates + /// a memref is located in shared memory. This should correspond to the + /// value used in NVVM. + static constexpr unsigned kSharedMemoryAddressSpace = 3; + }; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::NVGPUDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..5a8d1170738089804065546517640e4d81d66706 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUEnums.cpp.inc @@ -0,0 +1,132 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace nvgpu { +::llvm::StringRef stringifyTensorMapInterleaveKind(TensorMapInterleaveKind val) { + switch (val) { + case TensorMapInterleaveKind::INTERLEAVE_NONE: return "none"; + case TensorMapInterleaveKind::INTERLEAVE_16B: return "interleave_16b"; + case TensorMapInterleaveKind::INTERLEAVE_32B: return "interleave_32b"; + } + return ""; +} + +::std::optional symbolizeTensorMapInterleaveKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("none", TensorMapInterleaveKind::INTERLEAVE_NONE) + .Case("interleave_16b", TensorMapInterleaveKind::INTERLEAVE_16B) + .Case("interleave_32b", TensorMapInterleaveKind::INTERLEAVE_32B) + .Default(::std::nullopt); +} +::std::optional symbolizeTensorMapInterleaveKind(uint32_t value) { + switch (value) { + case 0: return TensorMapInterleaveKind::INTERLEAVE_NONE; + case 1: return TensorMapInterleaveKind::INTERLEAVE_16B; + case 2: return TensorMapInterleaveKind::INTERLEAVE_32B; + default: return ::std::nullopt; + } +} + +} // namespace nvgpu +} // namespace mlir + +namespace mlir { +namespace nvgpu { +::llvm::StringRef stringifyTensorMapL2PromoKind(TensorMapL2PromoKind val) { + switch (val) { + case TensorMapL2PromoKind::L2PROMO_NONE: return "none"; + case TensorMapL2PromoKind::L2PROMO_64B: return "l2promo_64b"; + case TensorMapL2PromoKind::L2PROMO_128B: return "l2promo_128b"; + case TensorMapL2PromoKind::L2PROMO_256B: return "l2promo_256b"; + } + return ""; +} + +::std::optional symbolizeTensorMapL2PromoKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("none", TensorMapL2PromoKind::L2PROMO_NONE) + .Case("l2promo_64b", TensorMapL2PromoKind::L2PROMO_64B) + .Case("l2promo_128b", TensorMapL2PromoKind::L2PROMO_128B) + .Case("l2promo_256b", TensorMapL2PromoKind::L2PROMO_256B) + .Default(::std::nullopt); +} +::std::optional symbolizeTensorMapL2PromoKind(uint32_t value) { + switch (value) { + case 0: return TensorMapL2PromoKind::L2PROMO_NONE; + case 1: return TensorMapL2PromoKind::L2PROMO_64B; + case 2: return TensorMapL2PromoKind::L2PROMO_128B; + case 3: return TensorMapL2PromoKind::L2PROMO_256B; + default: return ::std::nullopt; + } +} + +} // namespace nvgpu +} // namespace mlir + +namespace mlir { +namespace nvgpu { +::llvm::StringRef stringifyTensorMapOOBKind(TensorMapOOBKind val) { + switch (val) { + case TensorMapOOBKind::OOB_ZERO: return "zero"; + case TensorMapOOBKind::OOB_NAN: return "nan"; + } + return ""; +} + +::std::optional symbolizeTensorMapOOBKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("zero", TensorMapOOBKind::OOB_ZERO) + .Case("nan", TensorMapOOBKind::OOB_NAN) + .Default(::std::nullopt); +} +::std::optional symbolizeTensorMapOOBKind(uint32_t value) { + switch (value) { + case 0: return TensorMapOOBKind::OOB_ZERO; + case 1: return TensorMapOOBKind::OOB_NAN; + default: return ::std::nullopt; + } +} + +} // namespace nvgpu +} // namespace mlir + +namespace mlir { +namespace nvgpu { +::llvm::StringRef stringifyTensorMapSwizzleKind(TensorMapSwizzleKind val) { + switch (val) { + case TensorMapSwizzleKind::SWIZZLE_NONE: return "none"; + case TensorMapSwizzleKind::SWIZZLE_32B: return "swizzle_32b"; + case TensorMapSwizzleKind::SWIZZLE_64B: return "swizzle_64b"; + case TensorMapSwizzleKind::SWIZZLE_128B: return "swizzle_128b"; + } + return ""; +} + +::std::optional symbolizeTensorMapSwizzleKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("none", TensorMapSwizzleKind::SWIZZLE_NONE) + .Case("swizzle_32b", TensorMapSwizzleKind::SWIZZLE_32B) + .Case("swizzle_64b", TensorMapSwizzleKind::SWIZZLE_64B) + .Case("swizzle_128b", TensorMapSwizzleKind::SWIZZLE_128B) + .Default(::std::nullopt); +} +::std::optional symbolizeTensorMapSwizzleKind(uint32_t value) { + switch (value) { + case 0: return TensorMapSwizzleKind::SWIZZLE_NONE; + case 1: return TensorMapSwizzleKind::SWIZZLE_32B; + case 2: return TensorMapSwizzleKind::SWIZZLE_64B; + case 3: return TensorMapSwizzleKind::SWIZZLE_128B; + default: return ::std::nullopt; + } +} + +} // namespace nvgpu +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..188614e6ac6ffe8829b05be89ff93f87714b7da9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUEnums.h.inc @@ -0,0 +1,338 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: NVGPU.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace nvgpu { +// Tensor map interleave layout type +enum class TensorMapInterleaveKind : uint32_t { + INTERLEAVE_NONE = 0, + INTERLEAVE_16B = 1, + INTERLEAVE_32B = 2, +}; + +::std::optional symbolizeTensorMapInterleaveKind(uint32_t); +::llvm::StringRef stringifyTensorMapInterleaveKind(TensorMapInterleaveKind); +::std::optional symbolizeTensorMapInterleaveKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForTensorMapInterleaveKind() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(TensorMapInterleaveKind enumValue) { + return stringifyTensorMapInterleaveKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeTensorMapInterleaveKind(str); +} +} // namespace nvgpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::nvgpu::TensorMapInterleaveKind, ::mlir::nvgpu::TensorMapInterleaveKind> { + template + static FailureOr<::mlir::nvgpu::TensorMapInterleaveKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Tensor map interleave layout type"); + + // Symbolize the keyword. + if (::std::optional<::mlir::nvgpu::TensorMapInterleaveKind> attr = ::mlir::nvgpu::symbolizeEnum<::mlir::nvgpu::TensorMapInterleaveKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Tensor map interleave layout type specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::nvgpu::TensorMapInterleaveKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::nvgpu::TensorMapInterleaveKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::nvgpu::TensorMapInterleaveKind getEmptyKey() { + return static_cast<::mlir::nvgpu::TensorMapInterleaveKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::nvgpu::TensorMapInterleaveKind getTombstoneKey() { + return static_cast<::mlir::nvgpu::TensorMapInterleaveKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::nvgpu::TensorMapInterleaveKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::nvgpu::TensorMapInterleaveKind &lhs, const ::mlir::nvgpu::TensorMapInterleaveKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace nvgpu { +// Tensor map L2 promotion type +enum class TensorMapL2PromoKind : uint32_t { + L2PROMO_NONE = 0, + L2PROMO_64B = 1, + L2PROMO_128B = 2, + L2PROMO_256B = 3, +}; + +::std::optional symbolizeTensorMapL2PromoKind(uint32_t); +::llvm::StringRef stringifyTensorMapL2PromoKind(TensorMapL2PromoKind); +::std::optional symbolizeTensorMapL2PromoKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForTensorMapL2PromoKind() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(TensorMapL2PromoKind enumValue) { + return stringifyTensorMapL2PromoKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeTensorMapL2PromoKind(str); +} +} // namespace nvgpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::nvgpu::TensorMapL2PromoKind, ::mlir::nvgpu::TensorMapL2PromoKind> { + template + static FailureOr<::mlir::nvgpu::TensorMapL2PromoKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Tensor map L2 promotion type"); + + // Symbolize the keyword. + if (::std::optional<::mlir::nvgpu::TensorMapL2PromoKind> attr = ::mlir::nvgpu::symbolizeEnum<::mlir::nvgpu::TensorMapL2PromoKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Tensor map L2 promotion type specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::nvgpu::TensorMapL2PromoKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::nvgpu::TensorMapL2PromoKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::nvgpu::TensorMapL2PromoKind getEmptyKey() { + return static_cast<::mlir::nvgpu::TensorMapL2PromoKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::nvgpu::TensorMapL2PromoKind getTombstoneKey() { + return static_cast<::mlir::nvgpu::TensorMapL2PromoKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::nvgpu::TensorMapL2PromoKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::nvgpu::TensorMapL2PromoKind &lhs, const ::mlir::nvgpu::TensorMapL2PromoKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace nvgpu { +// Tensor map out-of-bounds fill type +enum class TensorMapOOBKind : uint32_t { + OOB_ZERO = 0, + OOB_NAN = 1, +}; + +::std::optional symbolizeTensorMapOOBKind(uint32_t); +::llvm::StringRef stringifyTensorMapOOBKind(TensorMapOOBKind); +::std::optional symbolizeTensorMapOOBKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForTensorMapOOBKind() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(TensorMapOOBKind enumValue) { + return stringifyTensorMapOOBKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeTensorMapOOBKind(str); +} +} // namespace nvgpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::nvgpu::TensorMapOOBKind, ::mlir::nvgpu::TensorMapOOBKind> { + template + static FailureOr<::mlir::nvgpu::TensorMapOOBKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Tensor map out-of-bounds fill type"); + + // Symbolize the keyword. + if (::std::optional<::mlir::nvgpu::TensorMapOOBKind> attr = ::mlir::nvgpu::symbolizeEnum<::mlir::nvgpu::TensorMapOOBKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Tensor map out-of-bounds fill type specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::nvgpu::TensorMapOOBKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::nvgpu::TensorMapOOBKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::nvgpu::TensorMapOOBKind getEmptyKey() { + return static_cast<::mlir::nvgpu::TensorMapOOBKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::nvgpu::TensorMapOOBKind getTombstoneKey() { + return static_cast<::mlir::nvgpu::TensorMapOOBKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::nvgpu::TensorMapOOBKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::nvgpu::TensorMapOOBKind &lhs, const ::mlir::nvgpu::TensorMapOOBKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace nvgpu { +// Tensor map swizzling mode of shared memory banks +enum class TensorMapSwizzleKind : uint32_t { + SWIZZLE_NONE = 0, + SWIZZLE_32B = 1, + SWIZZLE_64B = 2, + SWIZZLE_128B = 3, +}; + +::std::optional symbolizeTensorMapSwizzleKind(uint32_t); +::llvm::StringRef stringifyTensorMapSwizzleKind(TensorMapSwizzleKind); +::std::optional symbolizeTensorMapSwizzleKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForTensorMapSwizzleKind() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(TensorMapSwizzleKind enumValue) { + return stringifyTensorMapSwizzleKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeTensorMapSwizzleKind(str); +} +} // namespace nvgpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::nvgpu::TensorMapSwizzleKind, ::mlir::nvgpu::TensorMapSwizzleKind> { + template + static FailureOr<::mlir::nvgpu::TensorMapSwizzleKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Tensor map swizzling mode of shared memory banks"); + + // Symbolize the keyword. + if (::std::optional<::mlir::nvgpu::TensorMapSwizzleKind> attr = ::mlir::nvgpu::symbolizeEnum<::mlir::nvgpu::TensorMapSwizzleKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Tensor map swizzling mode of shared memory banks specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::nvgpu::TensorMapSwizzleKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::nvgpu::TensorMapSwizzleKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::nvgpu::TensorMapSwizzleKind getEmptyKey() { + return static_cast<::mlir::nvgpu::TensorMapSwizzleKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::nvgpu::TensorMapSwizzleKind getTombstoneKey() { + return static_cast<::mlir::nvgpu::TensorMapSwizzleKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::nvgpu::TensorMapSwizzleKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::nvgpu::TensorMapSwizzleKind &lhs, const ::mlir::nvgpu::TensorMapSwizzleKind &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUTypes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUTypes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..d82596802604b623f55688c3fc1164489ea14888 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUTypes.cpp.inc @@ -0,0 +1,677 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_LIST +#undef GET_TYPEDEF_LIST + +::mlir::nvgpu::DeviceAsyncTokenType, +::mlir::nvgpu::MBarrierGroupType, +::mlir::nvgpu::MBarrierTokenType, +::mlir::nvgpu::TensorMapDescriptorType, +::mlir::nvgpu::WarpgroupAccumulatorType, +::mlir::nvgpu::WarpgroupMatrixDescriptorType + +#endif // GET_TYPEDEF_LIST + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + +static ::mlir::OptionalParseResult generatedTypeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::nvgpu::DeviceAsyncTokenType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::DeviceAsyncTokenType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::nvgpu::MBarrierGroupType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::MBarrierGroupType::parse(parser); + return ::mlir::success(!!value); + }) + .Case(::mlir::nvgpu::MBarrierTokenType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::MBarrierTokenType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::nvgpu::TensorMapDescriptorType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::TensorMapDescriptorType::parse(parser); + return ::mlir::success(!!value); + }) + .Case(::mlir::nvgpu::WarpgroupAccumulatorType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::WarpgroupAccumulatorType::parse(parser); + return ::mlir::success(!!value); + }) + .Case(::mlir::nvgpu::WarpgroupMatrixDescriptorType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::nvgpu::WarpgroupMatrixDescriptorType::parse(parser); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedTypePrinter(::mlir::Type def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Type, ::mlir::LogicalResult>(def) .Case<::mlir::nvgpu::DeviceAsyncTokenType>([&](auto t) { + printer << ::mlir::nvgpu::DeviceAsyncTokenType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::nvgpu::MBarrierGroupType>([&](auto t) { + printer << ::mlir::nvgpu::MBarrierGroupType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::nvgpu::MBarrierTokenType>([&](auto t) { + printer << ::mlir::nvgpu::MBarrierTokenType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::nvgpu::TensorMapDescriptorType>([&](auto t) { + printer << ::mlir::nvgpu::TensorMapDescriptorType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::nvgpu::WarpgroupAccumulatorType>([&](auto t) { + printer << ::mlir::nvgpu::WarpgroupAccumulatorType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::nvgpu::WarpgroupMatrixDescriptorType>([&](auto t) { + printer << ::mlir::nvgpu::WarpgroupMatrixDescriptorType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace nvgpu { +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::DeviceAsyncTokenType) +namespace mlir { +namespace nvgpu { +namespace detail { +struct MBarrierGroupTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + MBarrierGroupTypeStorage(Attribute memorySpace, unsigned num_barriers) : memorySpace(std::move(memorySpace)), num_barriers(std::move(num_barriers)) {} + + KeyTy getAsKey() const { + return KeyTy(memorySpace, num_barriers); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (memorySpace == std::get<0>(tblgenKey)) && (num_barriers == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static MBarrierGroupTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto memorySpace = std::move(std::get<0>(tblgenKey)); + auto num_barriers = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) MBarrierGroupTypeStorage(std::move(memorySpace), std::move(num_barriers)); + } + + Attribute memorySpace; + unsigned num_barriers; +}; +} // namespace detail +MBarrierGroupType MBarrierGroupType::get(::mlir::MLIRContext *context, Attribute memorySpace, unsigned num_barriers) { + return Base::get(context, std::move(memorySpace), std::move(num_barriers)); +} + +MBarrierGroupType MBarrierGroupType::get(::mlir::MLIRContext *context, Attribute memorySpace) { + return Base::get(context, memorySpace, 1); +} + +::mlir::Type MBarrierGroupType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_memorySpace; + ::mlir::FailureOr _result_num_barriers; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_memorySpace = false; + bool _seen_num_barriers = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_memorySpace && _paramKey == "memorySpace") { + _seen_memorySpace = true; + + // Parse variable 'memorySpace' + _result_memorySpace = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_memorySpace)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVGPU_MBarrierGroup parameter 'memorySpace' which is to be a `Attribute`"); + return {}; + } + } else if (!_seen_num_barriers && _paramKey == "num_barriers") { + _seen_num_barriers = true; + + // Parse variable 'num_barriers' + _result_num_barriers = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_num_barriers)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVGPU_MBarrierGroup parameter 'num_barriers' which is to be a `unsigned`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_memorySpace) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "memorySpace"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_memorySpace)); + return MBarrierGroupType::get(odsParser.getContext(), + Attribute((*_result_memorySpace)), + unsigned((_result_num_barriers.value_or(1)))); +} + +void MBarrierGroupType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "memorySpace = "; + odsPrinter.printStrippedAttrOrType(getMemorySpace()); + if (!(getNumBarriers() == 1)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "num_barriers = "; + if (!(getNumBarriers() == 1)) { + odsPrinter.printStrippedAttrOrType(getNumBarriers()); + } + } + } + odsPrinter << ">"; +} + +Attribute MBarrierGroupType::getMemorySpace() const { + return getImpl()->memorySpace; +} + +unsigned MBarrierGroupType::getNumBarriers() const { + return getImpl()->num_barriers; +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierGroupType) +namespace mlir { +namespace nvgpu { +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierTokenType) +namespace mlir { +namespace nvgpu { +namespace detail { +struct TensorMapDescriptorTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + TensorMapDescriptorTypeStorage(MemRefType tensor, ::mlir::nvgpu::TensorMapSwizzleKind swizzle, ::mlir::nvgpu::TensorMapL2PromoKind l2promo, ::mlir::nvgpu::TensorMapOOBKind oob, ::mlir::nvgpu::TensorMapInterleaveKind interleave) : tensor(std::move(tensor)), swizzle(std::move(swizzle)), l2promo(std::move(l2promo)), oob(std::move(oob)), interleave(std::move(interleave)) {} + + KeyTy getAsKey() const { + return KeyTy(tensor, swizzle, l2promo, oob, interleave); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (tensor == std::get<0>(tblgenKey)) && (swizzle == std::get<1>(tblgenKey)) && (l2promo == std::get<2>(tblgenKey)) && (oob == std::get<3>(tblgenKey)) && (interleave == std::get<4>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey)); + } + + static TensorMapDescriptorTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto tensor = std::move(std::get<0>(tblgenKey)); + auto swizzle = std::move(std::get<1>(tblgenKey)); + auto l2promo = std::move(std::get<2>(tblgenKey)); + auto oob = std::move(std::get<3>(tblgenKey)); + auto interleave = std::move(std::get<4>(tblgenKey)); + return new (allocator.allocate()) TensorMapDescriptorTypeStorage(std::move(tensor), std::move(swizzle), std::move(l2promo), std::move(oob), std::move(interleave)); + } + + MemRefType tensor; + ::mlir::nvgpu::TensorMapSwizzleKind swizzle; + ::mlir::nvgpu::TensorMapL2PromoKind l2promo; + ::mlir::nvgpu::TensorMapOOBKind oob; + ::mlir::nvgpu::TensorMapInterleaveKind interleave; +}; +} // namespace detail +TensorMapDescriptorType TensorMapDescriptorType::get(::mlir::MLIRContext *context, MemRefType tensor, ::mlir::nvgpu::TensorMapSwizzleKind swizzle, ::mlir::nvgpu::TensorMapL2PromoKind l2promo, ::mlir::nvgpu::TensorMapOOBKind oob, ::mlir::nvgpu::TensorMapInterleaveKind interleave) { + return Base::get(context, std::move(tensor), std::move(swizzle), std::move(l2promo), std::move(oob), std::move(interleave)); +} + +::mlir::Type TensorMapDescriptorType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_tensor; + ::mlir::FailureOr<::mlir::nvgpu::TensorMapSwizzleKind> _result_swizzle; + ::mlir::FailureOr<::mlir::nvgpu::TensorMapL2PromoKind> _result_l2promo; + ::mlir::FailureOr<::mlir::nvgpu::TensorMapOOBKind> _result_oob; + ::mlir::FailureOr<::mlir::nvgpu::TensorMapInterleaveKind> _result_interleave; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_tensor = false; + bool _seen_swizzle = false; + bool _seen_l2promo = false; + bool _seen_oob = false; + bool _seen_interleave = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_tensor && _paramKey == "tensor") { + _seen_tensor = true; + + // Parse variable 'tensor' + _result_tensor = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_tensor)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVGPU_TensorMapDescriptor parameter 'tensor' which is to be a `MemRefType`"); + return {}; + } + } else if (!_seen_swizzle && _paramKey == "swizzle") { + _seen_swizzle = true; + + // Parse variable 'swizzle' + _result_swizzle = [&]() -> ::mlir::FailureOr<::mlir::nvgpu::TensorMapSwizzleKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::nvgpu::symbolizeTensorMapSwizzleKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::nvgpu::TensorMapSwizzleKind" << " to be one of: " << "none" << ", " << "swizzle_32b" << ", " << "swizzle_64b" << ", " << "swizzle_128b")}; + }(); + if (::mlir::failed(_result_swizzle)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVGPU_TensorMapDescriptor parameter 'swizzle' which is to be a `::mlir::nvgpu::TensorMapSwizzleKind`"); + return {}; + } + } else if (!_seen_l2promo && _paramKey == "l2promo") { + _seen_l2promo = true; + + // Parse variable 'l2promo' + _result_l2promo = [&]() -> ::mlir::FailureOr<::mlir::nvgpu::TensorMapL2PromoKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::nvgpu::symbolizeTensorMapL2PromoKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::nvgpu::TensorMapL2PromoKind" << " to be one of: " << "none" << ", " << "l2promo_64b" << ", " << "l2promo_128b" << ", " << "l2promo_256b")}; + }(); + if (::mlir::failed(_result_l2promo)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVGPU_TensorMapDescriptor parameter 'l2promo' which is to be a `::mlir::nvgpu::TensorMapL2PromoKind`"); + return {}; + } + } else if (!_seen_oob && _paramKey == "oob") { + _seen_oob = true; + + // Parse variable 'oob' + _result_oob = [&]() -> ::mlir::FailureOr<::mlir::nvgpu::TensorMapOOBKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::nvgpu::symbolizeTensorMapOOBKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::nvgpu::TensorMapOOBKind" << " to be one of: " << "zero" << ", " << "nan")}; + }(); + if (::mlir::failed(_result_oob)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVGPU_TensorMapDescriptor parameter 'oob' which is to be a `::mlir::nvgpu::TensorMapOOBKind`"); + return {}; + } + } else if (!_seen_interleave && _paramKey == "interleave") { + _seen_interleave = true; + + // Parse variable 'interleave' + _result_interleave = [&]() -> ::mlir::FailureOr<::mlir::nvgpu::TensorMapInterleaveKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::nvgpu::symbolizeTensorMapInterleaveKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::nvgpu::TensorMapInterleaveKind" << " to be one of: " << "none" << ", " << "interleave_16b" << ", " << "interleave_32b")}; + }(); + if (::mlir::failed(_result_interleave)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVGPU_TensorMapDescriptor parameter 'interleave' which is to be a `::mlir::nvgpu::TensorMapInterleaveKind`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 5; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 5 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_tensor)); + assert(::mlir::succeeded(_result_swizzle)); + assert(::mlir::succeeded(_result_l2promo)); + assert(::mlir::succeeded(_result_oob)); + assert(::mlir::succeeded(_result_interleave)); + return TensorMapDescriptorType::get(odsParser.getContext(), + MemRefType((*_result_tensor)), + ::mlir::nvgpu::TensorMapSwizzleKind((*_result_swizzle)), + ::mlir::nvgpu::TensorMapL2PromoKind((*_result_l2promo)), + ::mlir::nvgpu::TensorMapOOBKind((*_result_oob)), + ::mlir::nvgpu::TensorMapInterleaveKind((*_result_interleave))); +} + +void TensorMapDescriptorType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "tensor = "; + odsPrinter.printStrippedAttrOrType(getTensor()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "swizzle = "; + odsPrinter << stringifyTensorMapSwizzleKind(getSwizzle()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "l2promo = "; + odsPrinter << stringifyTensorMapL2PromoKind(getL2promo()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "oob = "; + odsPrinter << stringifyTensorMapOOBKind(getOob()); + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "interleave = "; + odsPrinter << stringifyTensorMapInterleaveKind(getInterleave()); + } + odsPrinter << ">"; +} + +MemRefType TensorMapDescriptorType::getTensor() const { + return getImpl()->tensor; +} + +::mlir::nvgpu::TensorMapSwizzleKind TensorMapDescriptorType::getSwizzle() const { + return getImpl()->swizzle; +} + +::mlir::nvgpu::TensorMapL2PromoKind TensorMapDescriptorType::getL2promo() const { + return getImpl()->l2promo; +} + +::mlir::nvgpu::TensorMapOOBKind TensorMapDescriptorType::getOob() const { + return getImpl()->oob; +} + +::mlir::nvgpu::TensorMapInterleaveKind TensorMapDescriptorType::getInterleave() const { + return getImpl()->interleave; +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapDescriptorType) +namespace mlir { +namespace nvgpu { +namespace detail { +struct WarpgroupAccumulatorTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + WarpgroupAccumulatorTypeStorage(VectorType fragmented) : fragmented(std::move(fragmented)) {} + + KeyTy getAsKey() const { + return KeyTy(fragmented); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (fragmented == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static WarpgroupAccumulatorTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto fragmented = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) WarpgroupAccumulatorTypeStorage(std::move(fragmented)); + } + + VectorType fragmented; +}; +} // namespace detail +WarpgroupAccumulatorType WarpgroupAccumulatorType::get(::mlir::MLIRContext *context, VectorType fragmented) { + return Base::get(context, std::move(fragmented)); +} + +::mlir::Type WarpgroupAccumulatorType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_fragmented; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_fragmented = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_fragmented && _paramKey == "fragmented") { + _seen_fragmented = true; + + // Parse variable 'fragmented' + _result_fragmented = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_fragmented)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVGPU_WarpgroupAccumulator parameter 'fragmented' which is to be a `VectorType`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_fragmented)); + return WarpgroupAccumulatorType::get(odsParser.getContext(), + VectorType((*_result_fragmented))); +} + +void WarpgroupAccumulatorType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "fragmented = "; + odsPrinter.printStrippedAttrOrType(getFragmented()); + } + odsPrinter << ">"; +} + +VectorType WarpgroupAccumulatorType::getFragmented() const { + return getImpl()->fragmented; +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupAccumulatorType) +namespace mlir { +namespace nvgpu { +namespace detail { +struct WarpgroupMatrixDescriptorTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + WarpgroupMatrixDescriptorTypeStorage(MemRefType tensor) : tensor(std::move(tensor)) {} + + KeyTy getAsKey() const { + return KeyTy(tensor); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (tensor == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static WarpgroupMatrixDescriptorTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto tensor = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) WarpgroupMatrixDescriptorTypeStorage(std::move(tensor)); + } + + MemRefType tensor; +}; +} // namespace detail +WarpgroupMatrixDescriptorType WarpgroupMatrixDescriptorType::get(::mlir::MLIRContext *context, MemRefType tensor) { + return Base::get(context, std::move(tensor)); +} + +::mlir::Type WarpgroupMatrixDescriptorType::parse(::mlir::AsmParser &odsParser) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_tensor; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_tensor = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_tensor && _paramKey == "tensor") { + _seen_tensor = true; + + // Parse variable 'tensor' + _result_tensor = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_tensor)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NVGPU_WarpgroupMatrixDescriptor parameter 'tensor' which is to be a `MemRefType`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_tensor)); + return WarpgroupMatrixDescriptorType::get(odsParser.getContext(), + MemRefType((*_result_tensor))); +} + +void WarpgroupMatrixDescriptorType::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "tensor = "; + odsPrinter.printStrippedAttrOrType(getTensor()); + } + odsPrinter << ">"; +} + +MemRefType WarpgroupMatrixDescriptorType::getTensor() const { + return getImpl()->tensor; +} + +} // namespace nvgpu +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupMatrixDescriptorType) +namespace mlir { +namespace nvgpu { + +/// Parse a type registered to this dialect. +::mlir::Type NVGPUDialect::parseType(::mlir::DialectAsmParser &parser) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef mnemonic; + ::mlir::Type genType; + auto parseResult = generatedTypeParser(parser, &mnemonic, genType); + if (parseResult.has_value()) + return genType; + + parser.emitError(typeLoc) << "unknown type `" + << mnemonic << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print a type registered to this dialect. +void NVGPUDialect::printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedTypePrinter(type, printer))) + return; + +} +} // namespace nvgpu +} // namespace mlir + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUTypes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUTypes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ef4e143ba3aad8efd663b0c84fde7732bb55e956 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUTypes.h.inc @@ -0,0 +1,117 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace nvgpu { +class DeviceAsyncTokenType; +class MBarrierGroupType; +class MBarrierTokenType; +class TensorMapDescriptorType; +class WarpgroupAccumulatorType; +class WarpgroupMatrixDescriptorType; +class DeviceAsyncTokenType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"device.async.token"}; + } + +}; +namespace detail { +struct MBarrierGroupTypeStorage; +} // namespace detail +class MBarrierGroupType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static MBarrierGroupType get(::mlir::MLIRContext *context, Attribute memorySpace, unsigned num_barriers); + static MBarrierGroupType get(::mlir::MLIRContext *context, Attribute memorySpace); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mbarrier.group"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + Attribute getMemorySpace() const; + unsigned getNumBarriers() const; +}; +class MBarrierTokenType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"mbarrier.token"}; + } + +}; +namespace detail { +struct TensorMapDescriptorTypeStorage; +} // namespace detail +class TensorMapDescriptorType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static TensorMapDescriptorType get(::mlir::MLIRContext *context, MemRefType tensor, ::mlir::nvgpu::TensorMapSwizzleKind swizzle, ::mlir::nvgpu::TensorMapL2PromoKind l2promo, ::mlir::nvgpu::TensorMapOOBKind oob, ::mlir::nvgpu::TensorMapInterleaveKind interleave); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"tensormap.descriptor"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + MemRefType getTensor() const; + ::mlir::nvgpu::TensorMapSwizzleKind getSwizzle() const; + ::mlir::nvgpu::TensorMapL2PromoKind getL2promo() const; + ::mlir::nvgpu::TensorMapOOBKind getOob() const; + ::mlir::nvgpu::TensorMapInterleaveKind getInterleave() const; +}; +namespace detail { +struct WarpgroupAccumulatorTypeStorage; +} // namespace detail +class WarpgroupAccumulatorType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static WarpgroupAccumulatorType get(::mlir::MLIRContext *context, VectorType fragmented); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"warpgroup.accumulator"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + VectorType getFragmented() const; +}; +namespace detail { +struct WarpgroupMatrixDescriptorTypeStorage; +} // namespace detail +class WarpgroupMatrixDescriptorType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static WarpgroupMatrixDescriptorType get(::mlir::MLIRContext *context, MemRefType tensor); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"warpgroup.descriptor"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + MemRefType getTensor() const; +}; +} // namespace nvgpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::DeviceAsyncTokenType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierGroupType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::MBarrierTokenType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::TensorMapDescriptorType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupAccumulatorType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::nvgpu::WarpgroupMatrixDescriptorType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACC.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACC.h new file mode 100644 index 0000000000000000000000000000000000000000..bc4680656d4cf620f76e95b147eb717d88fc8e18 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACC.h @@ -0,0 +1,102 @@ +//===- OpenACC.h - MLIR OpenACC Dialect -------------------------*- C++ -*-===// +// +// Part of the MLIR Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// ============================================================================ +// +// This file declares the OpenACC dialect in MLIR. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_OPENACC_OPENACC_H_ +#define MLIR_DIALECT_OPENACC_OPENACC_H_ + +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/IR/SymbolTable.h" + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/OpenACC/OpenACCOpsDialect.h.inc" +#include "mlir/Dialect/OpenACC/OpenACCOpsEnums.h.inc" +#include "mlir/Dialect/OpenACC/OpenACCTypeInterfaces.h.inc" +#include "mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#define GET_TYPEDEF_CLASSES +#include "mlir/Dialect/OpenACC/OpenACCOpsTypes.h.inc" + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/OpenACC/OpenACCOpsAttributes.h.inc" + +#include "mlir/Dialect/OpenACC/OpenACCInterfaces.h" + +#define GET_OP_CLASSES +#include "mlir/Dialect/OpenACC/OpenACCOps.h.inc" + +#define ACC_DATA_ENTRY_OPS \ + mlir::acc::CopyinOp, mlir::acc::CreateOp, mlir::acc::PresentOp, \ + mlir::acc::NoCreateOp, mlir::acc::AttachOp, mlir::acc::DevicePtrOp, \ + mlir::acc::GetDevicePtrOp, mlir::acc::PrivateOp, \ + mlir::acc::FirstprivateOp, mlir::acc::UpdateDeviceOp, \ + mlir::acc::UseDeviceOp, mlir::acc::ReductionOp, \ + mlir::acc::DeclareDeviceResidentOp, mlir::acc::DeclareLinkOp, \ + mlir::acc::CacheOp +#define ACC_COMPUTE_CONSTRUCT_OPS \ + mlir::acc::ParallelOp, mlir::acc::KernelsOp, mlir::acc::SerialOp +#define ACC_DATA_CONSTRUCT_OPS \ + mlir::acc::DataOp, mlir::acc::EnterDataOp, mlir::acc::ExitDataOp, \ + mlir::acc::UpdateOp, mlir::acc::HostDataOp, mlir::acc::DeclareEnterOp, \ + mlir::acc::DeclareExitOp, mlir::acc::DeclareOp +#define ACC_COMPUTE_AND_DATA_CONSTRUCT_OPS \ + ACC_COMPUTE_CONSTRUCT_OPS, ACC_DATA_CONSTRUCT_OPS + +namespace mlir { +namespace acc { + +/// Enumeration used to encode the execution mapping on a loop construct. +/// They refer directly to the OpenACC 3.3 standard: +/// 2.9.2. gang +/// 2.9.3. worker +/// 2.9.4. vector +/// +/// Value can be combined bitwise to reflect the mapping applied to the +/// construct. e.g. `acc.loop gang vector`, the `gang` and `vector` could be +/// combined and the final mapping value would be 5 (4 | 1). +enum OpenACCExecMapping { NONE = 0, VECTOR = 1, WORKER = 2, GANG = 4 }; + +/// Used to obtain the `varPtr` from a data entry operation. +/// Returns empty value if not a data entry operation. +mlir::Value getVarPtr(mlir::Operation *accDataEntryOp); + +/// Used to obtain the `dataClause` from a data entry operation. +/// Returns empty optional if not a data entry operation. +std::optional +getDataClause(mlir::Operation *accDataEntryOp); + +/// Used to find out whether data operation is implicit. +/// Returns false if not a data operation or if it is a data operation without +/// implicit flag. +bool getImplicitFlag(mlir::Operation *accDataEntryOp); + +/// Used to obtain the attribute name for declare. +static constexpr StringLiteral getDeclareAttrName() { + return StringLiteral("acc.declare"); +} + +static constexpr StringLiteral getDeclareActionAttrName() { + return StringLiteral("acc.declare_action"); +} + +static constexpr StringLiteral getRoutineInfoAttrName() { + return StringLiteral("acc.routine_info"); +} + +} // namespace acc +} // namespace mlir + +#endif // MLIR_DIALECT_OPENACC_OPENACC_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCInterfaces.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCInterfaces.h new file mode 100644 index 0000000000000000000000000000000000000000..5ce094969728f46f4026466f28ce81df04382759 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCInterfaces.h @@ -0,0 +1,20 @@ +//===- OpenACCInterfaces.h - MLIR Interfaces for OpenACC --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares OpenACC Interface implementations for the OpenACC dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_OPENACC_OPENACCINTERFACES_H_ +#define MLIR_DIALECT_OPENACC_OPENACCINTERFACES_H_ + +#include "mlir/IR/OpDefinition.h" + +#include "mlir/Dialect/OpenACC/OpenACCOpsInterfaces.h.inc" + +#endif // MLIR_DIALECT_OPENACC_OPENACCINTERFACES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..83f50c556462bc5568ed9fbd985ccbf019c79e3f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.cpp.inc @@ -0,0 +1,34752 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenACCOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::acc::AtomicCaptureOp, +::mlir::acc::AtomicReadOp, +::mlir::acc::AtomicUpdateOp, +::mlir::acc::AtomicWriteOp, +::mlir::acc::AttachOp, +::mlir::acc::CacheOp, +::mlir::acc::CopyinOp, +::mlir::acc::CopyoutOp, +::mlir::acc::CreateOp, +::mlir::acc::DataBoundsOp, +::mlir::acc::DataOp, +::mlir::acc::DeclareDeviceResidentOp, +::mlir::acc::DeclareEnterOp, +::mlir::acc::DeclareExitOp, +::mlir::acc::DeclareLinkOp, +::mlir::acc::DeclareOp, +::mlir::acc::DeleteOp, +::mlir::acc::DetachOp, +::mlir::acc::DevicePtrOp, +::mlir::acc::EnterDataOp, +::mlir::acc::ExitDataOp, +::mlir::acc::FirstprivateOp, +::mlir::acc::FirstprivateRecipeOp, +::mlir::acc::GetDevicePtrOp, +::mlir::acc::GlobalConstructorOp, +::mlir::acc::GlobalDestructorOp, +::mlir::acc::HostDataOp, +::mlir::acc::InitOp, +::mlir::acc::KernelsOp, +::mlir::acc::LoopOp, +::mlir::acc::NoCreateOp, +::mlir::acc::ParallelOp, +::mlir::acc::PresentOp, +::mlir::acc::PrivateOp, +::mlir::acc::PrivateRecipeOp, +::mlir::acc::ReductionOp, +::mlir::acc::ReductionRecipeOp, +::mlir::acc::RoutineOp, +::mlir::acc::SerialOp, +::mlir::acc::SetOp, +::mlir::acc::ShutdownOp, +::mlir::acc::TerminatorOp, +::mlir::acc::UpdateDeviceOp, +::mlir::acc::UpdateHostOp, +::mlir::acc::UpdateOp, +::mlir::acc::UseDeviceOp, +::mlir::acc::WaitOp, +::mlir::acc::YieldOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace acc { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenACCOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::acc::PointerLikeType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be pointer-like type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenACCOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenACCOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::acc::PointerLikeType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be PointerLikeType instance, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenACCOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::acc::DataBoundsType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be Type for representing acc data clause bounds information, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenACCOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::IntegerType>(type))) || ((::llvm::isa<::mlir::IndexType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer or index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenACCOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenACCOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IntegerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any type attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::acc::DataClauseAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: data clauses supported by OpenACC"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: bool attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::acc::ClauseDefaultValueAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: DefaultValue Clause"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: symbol ref array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps8( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::acc::ReductionOperatorAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: built-in reduction operations supported by OpenACC"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps8( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps8(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps9( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::IntegerAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: arbitrary integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenACCOps9( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenACCOps9(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_OpenACCOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItems(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with 1 blocks"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_OpenACCOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AtomicCaptureOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicCaptureOpGenericAdaptorBase::AtomicCaptureOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.atomic.capture", odsAttrs.getContext()); +} + +AtomicCaptureOpGenericAdaptorBase::AtomicCaptureOpGenericAdaptorBase(AtomicCaptureOp op) : AtomicCaptureOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicCaptureOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicCaptureOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &AtomicCaptureOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange AtomicCaptureOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AtomicCaptureOpAdaptor::AtomicCaptureOpAdaptor(AtomicCaptureOp op) : AtomicCaptureOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicCaptureOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AtomicCaptureOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicCaptureOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair AtomicCaptureOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicCaptureOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &AtomicCaptureOp::getRegion() { + return (*this)->getRegion(0); +} + +void AtomicCaptureOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + (void)odsState.addRegion(); +} + +void AtomicCaptureOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicCaptureOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AtomicCaptureOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicCaptureOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult AtomicCaptureOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + + ensureTerminator(*regionRegion, parser.getBuilder(), result.location); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + return ::mlir::success(); +} + +void AtomicCaptureOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + + { + bool printTerminator = true; + if (auto *term = getRegion().empty() ? nullptr : getRegion().begin()->getTerminator()) { + printTerminator = !term->getAttrDictionary().empty() || + term->getNumOperands() != 0 || + term->getNumResults() != 0; + } + _odsPrinter.printRegion(getRegion(), /*printEntryBlockArgs=*/true, + /*printBlockTerminators=*/printTerminator); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicCaptureOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AtomicReadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicReadOpGenericAdaptorBase::AtomicReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.atomic.read", odsAttrs.getContext()); +} + +AtomicReadOpGenericAdaptorBase::AtomicReadOpGenericAdaptorBase(AtomicReadOp op) : AtomicReadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicReadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicReadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypeAttr AtomicReadOpGenericAdaptorBase::getElementTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().element_type); + return attr; +} + +::mlir::Type AtomicReadOpGenericAdaptorBase::getElementType() { + auto attr = getElementTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +AtomicReadOpAdaptor::AtomicReadOpAdaptor(AtomicReadOp op) : AtomicReadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicReadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_element_type = getProperties().element_type; (void)tblgen_element_type; + if (!tblgen_element_type) return emitError(loc, "'acc.atomic.read' op ""requires attribute 'element_type'"); + + if (tblgen_element_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_element_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_element_type).getValue()))) && ((true)))) + return emitError(loc, "'acc.atomic.read' op ""attribute 'element_type' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair AtomicReadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicReadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> AtomicReadOp::getX() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> AtomicReadOp::getV() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AtomicReadOp::getXMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AtomicReadOp::getVMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtomicReadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicReadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AtomicReadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.element_type; + auto attr = dict.get("element_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for element_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `element_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AtomicReadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.element_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("element_type", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AtomicReadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.element_type.getAsOpaquePointer())); +} + +std::optional AtomicReadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "element_type") + return prop.element_type; + return std::nullopt; +} + +void AtomicReadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "element_type") { + prop.element_type = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AtomicReadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.element_type) attrs.append("element_type", prop.element_type); +} + +::mlir::LogicalResult AtomicReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getElementTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps0(attr, "element_type", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicReadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.element_type))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicReadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.element_type); +} + +::mlir::TypeAttr AtomicReadOp::getElementTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().element_type); +} + +::mlir::Type AtomicReadOp::getElementType() { + auto attr = getElementTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void AtomicReadOp::setElementTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getElementTypeAttrName(), attr); +} + +void AtomicReadOp::setElementType(::mlir::Type attrValue) { + (*this)->setAttr(getElementTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void AtomicReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type) { + odsState.addOperands(x); + odsState.addOperands(v); + odsState.getOrAddProperties().element_type = element_type; +} + +void AtomicReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type) { + odsState.addOperands(x); + odsState.addOperands(v); + odsState.getOrAddProperties().element_type = element_type; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type) { + odsState.addOperands(x); + odsState.addOperands(v); + odsState.getOrAddProperties().element_type = ::mlir::TypeAttr::get(element_type); +} + +void AtomicReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type) { + odsState.addOperands(x); + odsState.addOperands(v); + odsState.getOrAddProperties().element_type = ::mlir::TypeAttr::get(element_type); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicReadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AtomicReadOp::verifyInvariantsImpl() { + auto tblgen_element_type = getProperties().element_type; (void)tblgen_element_type; + if (!tblgen_element_type) return emitOpError("requires attribute 'element_type'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps0(*this, tblgen_element_type, "element_type"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {x, v} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicReadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AtomicReadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand vRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vOperands(vRawOperands); ::llvm::SMLoc vOperandsLoc; + (void)vOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand xRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(xRawOperands); ::llvm::SMLoc xOperandsLoc; + (void)xOperandsLoc; + ::mlir::Type xRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> xTypes(xRawTypes); + ::mlir::TypeAttr element_typeAttr; + + vOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(vRawOperands[0])) + return ::mlir::failure(); + if (parser.parseEqual()) + return ::mlir::failure(); + + xOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(xRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + xRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(element_typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (element_typeAttr) result.getOrAddProperties().element_type = element_typeAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(vOperands, xTypes[0], vOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicReadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getV(); + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getX(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getX().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getElementTypeAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("element_type"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicReadOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AtomicUpdateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicUpdateOpGenericAdaptorBase::AtomicUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.atomic.update", odsAttrs.getContext()); +} + +AtomicUpdateOpGenericAdaptorBase::AtomicUpdateOpGenericAdaptorBase(AtomicUpdateOp op) : AtomicUpdateOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicUpdateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicUpdateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &AtomicUpdateOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange AtomicUpdateOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AtomicUpdateOpAdaptor::AtomicUpdateOpAdaptor(AtomicUpdateOp op) : AtomicUpdateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicUpdateOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AtomicUpdateOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicUpdateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> AtomicUpdateOp::getX() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AtomicUpdateOp::getXMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtomicUpdateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicUpdateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &AtomicUpdateOp::getRegion() { + return (*this)->getRegion(0); +} + +void AtomicUpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x) { + odsState.addOperands(x); + (void)odsState.addRegion(); +} + +void AtomicUpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x) { + odsState.addOperands(x); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicUpdateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AtomicUpdateOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicUpdateOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AtomicUpdateOp::getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context) { + results.add(canonicalize); +} + +::mlir::ParseResult AtomicUpdateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand xRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(xRawOperands); ::llvm::SMLoc xOperandsLoc; + (void)xOperandsLoc; + ::mlir::Type xRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> xTypes(xRawTypes); + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + + xOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(xRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + xRawTypes[0] = type; + } + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + + ensureTerminator(*regionRegion, parser.getBuilder(), result.location); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicUpdateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getX(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getX().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' '; + + { + bool printTerminator = true; + if (auto *term = getRegion().empty() ? nullptr : getRegion().begin()->getTerminator()) { + printTerminator = !term->getAttrDictionary().empty() || + term->getNumOperands() != 0 || + term->getNumResults() != 0; + } + _odsPrinter.printRegion(getRegion(), /*printEntryBlockArgs=*/true, + /*printBlockTerminators=*/printTerminator); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void AtomicUpdateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicUpdateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AtomicWriteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicWriteOpGenericAdaptorBase::AtomicWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.atomic.write", odsAttrs.getContext()); +} + +AtomicWriteOpGenericAdaptorBase::AtomicWriteOpGenericAdaptorBase(AtomicWriteOp op) : AtomicWriteOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicWriteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicWriteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AtomicWriteOpAdaptor::AtomicWriteOpAdaptor(AtomicWriteOp op) : AtomicWriteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicWriteOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AtomicWriteOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicWriteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> AtomicWriteOp::getX() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::Value AtomicWriteOp::getExpr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AtomicWriteOp::getXMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AtomicWriteOp::getExprMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtomicWriteOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicWriteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void AtomicWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value expr) { + odsState.addOperands(x); + odsState.addOperands(expr); +} + +void AtomicWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value expr) { + odsState.addOperands(x); + odsState.addOperands(expr); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AtomicWriteOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicWriteOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AtomicWriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand xRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(xRawOperands); ::llvm::SMLoc xOperandsLoc; + (void)xOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand exprRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> exprOperands(exprRawOperands); ::llvm::SMLoc exprOperandsLoc; + (void)exprOperandsLoc; + ::mlir::Type xRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> xTypes(xRawTypes); + ::mlir::Type exprRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> exprTypes(exprRawTypes); + + xOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(xRawOperands[0])) + return ::mlir::failure(); + if (parser.parseEqual()) + return ::mlir::failure(); + + exprOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(exprRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + xRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + exprRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(exprOperands, exprTypes, exprOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicWriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getX(); + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getExpr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getX().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getExpr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicWriteOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AttachOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AttachOpGenericAdaptorBase::AttachOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.attach", odsAttrs.getContext()); +} + +AttachOpGenericAdaptorBase::AttachOpGenericAdaptorBase(AttachOp op) : AttachOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AttachOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr AttachOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr AttachOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause AttachOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr AttachOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool AttachOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr AttachOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool AttachOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr AttachOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > AttachOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +AttachOpAdaptor::AttachOpAdaptor(AttachOp op) : AttachOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AttachOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.attach' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.attach' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.attach' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.attach' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair AttachOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range AttachOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> AttachOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> AttachOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range AttachOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &AttachOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange AttachOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange AttachOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair AttachOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AttachOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> AttachOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AttachOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute AttachOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AttachOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional AttachOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void AttachOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void AttachOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult AttachOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AttachOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void AttachOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr AttachOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause AttachOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr AttachOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool AttachOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr AttachOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool AttachOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr AttachOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > AttachOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void AttachOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void AttachOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void AttachOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void AttachOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void AttachOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void AttachOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void AttachOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void AttachOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute AttachOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void AttachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void AttachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AttachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void AttachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AttachOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void AttachOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_attach); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult AttachOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AttachOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AttachOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AttachOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_attach))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::AttachOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::CacheOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CacheOpGenericAdaptorBase::CacheOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.cache", odsAttrs.getContext()); +} + +CacheOpGenericAdaptorBase::CacheOpGenericAdaptorBase(CacheOp op) : CacheOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CacheOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CacheOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr CacheOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause CacheOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CacheOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool CacheOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CacheOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool CacheOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr CacheOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > CacheOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +CacheOpAdaptor::CacheOpAdaptor(CacheOp op) : CacheOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CacheOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.cache' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.cache' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.cache' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.cache' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair CacheOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CacheOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CacheOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CacheOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range CacheOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &CacheOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CacheOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CacheOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CacheOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CacheOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CacheOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CacheOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CacheOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CacheOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CacheOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CacheOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CacheOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CacheOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CacheOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CacheOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr CacheOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause CacheOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CacheOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool CacheOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CacheOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool CacheOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr CacheOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > CacheOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void CacheOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void CacheOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CacheOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void CacheOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void CacheOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void CacheOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void CacheOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void CacheOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute CacheOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void CacheOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void CacheOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CacheOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void CacheOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CacheOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CacheOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_cache); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult CacheOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CacheOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CacheOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CacheOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_cache))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::CacheOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::CopyinOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CopyinOpGenericAdaptorBase::CopyinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.copyin", odsAttrs.getContext()); +} + +CopyinOpGenericAdaptorBase::CopyinOpGenericAdaptorBase(CopyinOp op) : CopyinOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CopyinOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CopyinOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr CopyinOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause CopyinOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CopyinOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool CopyinOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CopyinOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool CopyinOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr CopyinOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > CopyinOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +CopyinOpAdaptor::CopyinOpAdaptor(CopyinOp op) : CopyinOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CopyinOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.copyin' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.copyin' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.copyin' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.copyin' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair CopyinOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CopyinOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CopyinOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CopyinOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range CopyinOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &CopyinOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CopyinOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CopyinOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CopyinOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CopyinOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CopyinOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CopyinOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CopyinOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CopyinOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CopyinOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CopyinOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CopyinOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CopyinOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopyinOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CopyinOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr CopyinOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause CopyinOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CopyinOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool CopyinOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CopyinOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool CopyinOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr CopyinOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > CopyinOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void CopyinOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void CopyinOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CopyinOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void CopyinOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void CopyinOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void CopyinOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void CopyinOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void CopyinOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute CopyinOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void CopyinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void CopyinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CopyinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void CopyinOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CopyinOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CopyinOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_copyin); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult CopyinOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopyinOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CopyinOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CopyinOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_copyin))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::CopyinOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::CopyoutOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CopyoutOpGenericAdaptorBase::CopyoutOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.copyout", odsAttrs.getContext()); +} + +CopyoutOpGenericAdaptorBase::CopyoutOpGenericAdaptorBase(CopyoutOp op) : CopyoutOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CopyoutOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CopyoutOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr CopyoutOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause CopyoutOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CopyoutOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool CopyoutOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CopyoutOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool CopyoutOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr CopyoutOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > CopyoutOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +CopyoutOpAdaptor::CopyoutOpAdaptor(CopyoutOp op) : CopyoutOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CopyoutOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.copyout' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.copyout' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.copyout' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.copyout' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair CopyoutOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CopyoutOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CopyoutOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CopyoutOp::getVarPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range CopyoutOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &CopyoutOp::getAccPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CopyoutOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CopyoutOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CopyoutOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CopyoutOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult CopyoutOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CopyoutOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CopyoutOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CopyoutOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CopyoutOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CopyoutOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CopyoutOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopyoutOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CopyoutOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr CopyoutOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause CopyoutOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CopyoutOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool CopyoutOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CopyoutOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool CopyoutOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr CopyoutOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > CopyoutOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void CopyoutOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void CopyoutOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CopyoutOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void CopyoutOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void CopyoutOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void CopyoutOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void CopyoutOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void CopyoutOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute CopyoutOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void CopyoutOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } +} + +void CopyoutOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CopyoutOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } +} + +void CopyoutOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CopyoutOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CopyoutOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_copyout); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult CopyoutOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CopyoutOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CopyoutOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand accPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accPtrOperands(accPtrRawOperands); ::llvm::SMLoc accPtrOperandsLoc; + (void)accPtrOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrOperands; + ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrTypes; + if (parser.parseKeyword("accPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + accPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool boundsClause = false; + bool toClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("to"))) { + + if (toClause) { + return parser.emitError(parser.getNameLoc()) + << "`to` clause can appear at most once in the expansion of the " + "oilist directive"; + } + toClause = true; + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + if (parser.resolveOperands(accPtrOperands, accPtrTypes, accPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CopyoutOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "accPtr"; + _odsPrinter << "("; + _odsPrinter << getAccPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + if (false || getVarPtr()) { + _odsPrinter << ' ' << "to"; + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_copyout))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::CopyoutOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::CreateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateOpGenericAdaptorBase::CreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.create", odsAttrs.getContext()); +} + +CreateOpGenericAdaptorBase::CreateOpGenericAdaptorBase(CreateOp op) : CreateOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CreateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr CreateOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause CreateOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CreateOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool CreateOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CreateOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool CreateOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr CreateOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > CreateOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +CreateOpAdaptor::CreateOpAdaptor(CreateOp op) : CreateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.create' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.create' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.create' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.create' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair CreateOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CreateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CreateOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CreateOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range CreateOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &CreateOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange CreateOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CreateOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CreateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CreateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> CreateOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CreateOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CreateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CreateOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CreateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CreateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CreateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CreateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CreateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr CreateOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause CreateOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CreateOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool CreateOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr CreateOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool CreateOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr CreateOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > CreateOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void CreateOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void CreateOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CreateOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void CreateOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void CreateOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void CreateOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void CreateOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void CreateOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute CreateOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void CreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void CreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void CreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CreateOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_create); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult CreateOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CreateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_create))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::CreateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DataBoundsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DataBoundsOpGenericAdaptorBase::DataBoundsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.bounds", odsAttrs.getContext()); +} + +DataBoundsOpGenericAdaptorBase::DataBoundsOpGenericAdaptorBase(DataBoundsOp op) : DataBoundsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DataBoundsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DataBoundsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr DataBoundsOpGenericAdaptorBase::getStrideInBytesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().strideInBytes); + return attr; +} + +bool DataBoundsOpGenericAdaptorBase::getStrideInBytes() { + auto attr = getStrideInBytesAttr(); + return attr.getValue(); +} + +} // namespace detail +DataBoundsOpAdaptor::DataBoundsOpAdaptor(DataBoundsOp op) : DataBoundsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DataBoundsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_strideInBytes = getProperties().strideInBytes; (void)tblgen_strideInBytes; + + if (tblgen_strideInBytes && !((::llvm::isa<::mlir::BoolAttr>(tblgen_strideInBytes)))) + return emitError(loc, "'acc.bounds' op ""attribute 'strideInBytes' failed to satisfy constraint: bool attribute"); + return ::mlir::success(); +} + +std::pair DataBoundsOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DataBoundsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DataBoundsOp::getLowerbound() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value DataBoundsOp::getUpperbound() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value DataBoundsOp::getExtent() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value DataBoundsOp::getStride() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value DataBoundsOp::getStartIdx() { + auto operands = getODSOperands(4); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::MutableOperandRange DataBoundsOp::getLowerboundMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataBoundsOp::getUpperboundMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataBoundsOp::getExtentMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataBoundsOp::getStrideMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataBoundsOp::getStartIdxMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DataBoundsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DataBoundsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::DataBoundsType> DataBoundsOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::DataBoundsType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult DataBoundsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.strideInBytes; + auto attr = dict.get("strideInBytes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for strideInBytes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `strideInBytes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DataBoundsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.strideInBytes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("strideInBytes", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DataBoundsOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.strideInBytes.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DataBoundsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "strideInBytes") + return prop.strideInBytes; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DataBoundsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "strideInBytes") { + prop.strideInBytes = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DataBoundsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.strideInBytes) attrs.append("strideInBytes", prop.strideInBytes); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DataBoundsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getStrideInBytesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "strideInBytes", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DataBoundsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.strideInBytes))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DataBoundsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.strideInBytes); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::BoolAttr DataBoundsOp::getStrideInBytesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().strideInBytes); +} + +bool DataBoundsOp::getStrideInBytes() { + auto attr = getStrideInBytesAttr(); + return attr.getValue(); +} + +void DataBoundsOp::setStrideInBytesAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStrideInBytesAttrName(), attr); +} + +void DataBoundsOp::setStrideInBytes(bool attrValue) { + (*this)->setAttr(getStrideInBytesAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DataBoundsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx) { + if (lowerbound) + odsState.addOperands(lowerbound); + if (upperbound) + odsState.addOperands(upperbound); + if (extent) + odsState.addOperands(extent); + if (stride) + odsState.addOperands(stride); + if (startIdx) + odsState.addOperands(startIdx); + ::llvm::copy(::llvm::ArrayRef({(lowerbound ? 1 : 0), (upperbound ? 1 : 0), (extent ? 1 : 0), (stride ? 1 : 0), (startIdx ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (strideInBytes) { + odsState.getOrAddProperties().strideInBytes = strideInBytes; + } + odsState.addTypes(result); +} + +void DataBoundsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx) { + if (lowerbound) + odsState.addOperands(lowerbound); + if (upperbound) + odsState.addOperands(upperbound); + if (extent) + odsState.addOperands(extent); + if (stride) + odsState.addOperands(stride); + if (startIdx) + odsState.addOperands(startIdx); + ::llvm::copy(::llvm::ArrayRef({(lowerbound ? 1 : 0), (upperbound ? 1 : 0), (extent ? 1 : 0), (stride ? 1 : 0), (startIdx ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (strideInBytes) { + odsState.getOrAddProperties().strideInBytes = strideInBytes; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DataBoundsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx) { + if (lowerbound) + odsState.addOperands(lowerbound); + if (upperbound) + odsState.addOperands(upperbound); + if (extent) + odsState.addOperands(extent); + if (stride) + odsState.addOperands(stride); + if (startIdx) + odsState.addOperands(startIdx); + ::llvm::copy(::llvm::ArrayRef({(lowerbound ? 1 : 0), (upperbound ? 1 : 0), (extent ? 1 : 0), (stride ? 1 : 0), (startIdx ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().strideInBytes = odsBuilder.getBoolAttr(strideInBytes); + odsState.addTypes(result); +} + +void DataBoundsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx) { + if (lowerbound) + odsState.addOperands(lowerbound); + if (upperbound) + odsState.addOperands(upperbound); + if (extent) + odsState.addOperands(extent); + if (stride) + odsState.addOperands(stride); + if (startIdx) + odsState.addOperands(startIdx); + ::llvm::copy(::llvm::ArrayRef({(lowerbound ? 1 : 0), (upperbound ? 1 : 0), (extent ? 1 : 0), (stride ? 1 : 0), (startIdx ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().strideInBytes = odsBuilder.getBoolAttr(strideInBytes); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DataBoundsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DataBoundsOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.strideInBytes) + properties.strideInBytes = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult DataBoundsOp::verifyInvariantsImpl() { + auto tblgen_strideInBytes = getProperties().strideInBytes; (void)tblgen_strideInBytes; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_strideInBytes, "strideInBytes"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + if (valueGroup4.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup4.size(); + } + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DataBoundsOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DataBoundsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> lowerboundOperands; + ::llvm::SMLoc lowerboundOperandsLoc; + (void)lowerboundOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> lowerboundTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> upperboundOperands; + ::llvm::SMLoc upperboundOperandsLoc; + (void)upperboundOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> upperboundTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> extentOperands; + ::llvm::SMLoc extentOperandsLoc; + (void)extentOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> extentTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> strideOperands; + ::llvm::SMLoc strideOperandsLoc; + (void)strideOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> strideTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> startIdxOperands; + ::llvm::SMLoc startIdxOperandsLoc; + (void)startIdxOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> startIdxTypes; + bool lowerboundClause = false; + bool upperboundClause = false; + bool extentClause = false; + bool strideClause = false; + bool startIdxClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("lowerbound"))) { + + if (lowerboundClause) { + return parser.emitError(parser.getNameLoc()) + << "`lowerbound` clause can appear at most once in the expansion of the " + "oilist directive"; + } + lowerboundClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + lowerboundOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + lowerboundOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + lowerboundTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("upperbound"))) { + + if (upperboundClause) { + return parser.emitError(parser.getNameLoc()) + << "`upperbound` clause can appear at most once in the expansion of the " + "oilist directive"; + } + upperboundClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + upperboundOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + upperboundOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + upperboundTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("extent"))) { + + if (extentClause) { + return parser.emitError(parser.getNameLoc()) + << "`extent` clause can appear at most once in the expansion of the " + "oilist directive"; + } + extentClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + extentOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + extentOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + extentTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("stride"))) { + + if (strideClause) { + return parser.emitError(parser.getNameLoc()) + << "`stride` clause can appear at most once in the expansion of the " + "oilist directive"; + } + strideClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + strideOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + strideOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + strideTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("startIdx"))) { + + if (startIdxClause) { + return parser.emitError(parser.getNameLoc()) + << "`startIdx` clause can appear at most once in the expansion of the " + "oilist directive"; + } + startIdxClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + startIdxOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + startIdxOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + startIdxTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(lowerboundOperands.size()), static_cast(upperboundOperands.size()), static_cast(extentOperands.size()), static_cast(strideOperands.size()), static_cast(startIdxOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lowerboundOperands, lowerboundTypes, lowerboundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(upperboundOperands, upperboundTypes, upperboundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(extentOperands, extentTypes, extentOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(strideOperands, strideTypes, strideOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(startIdxOperands, startIdxTypes, startIdxOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DataBoundsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getLowerbound()) { + _odsPrinter << ' ' << "lowerbound"; + _odsPrinter << "("; + if (::mlir::Value value = getLowerbound()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getLowerbound() ? ::llvm::ArrayRef<::mlir::Type>(getLowerbound().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getUpperbound()) { + _odsPrinter << ' ' << "upperbound"; + _odsPrinter << "("; + if (::mlir::Value value = getUpperbound()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getUpperbound() ? ::llvm::ArrayRef<::mlir::Type>(getUpperbound().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getExtent()) { + _odsPrinter << ' ' << "extent"; + _odsPrinter << "("; + if (::mlir::Value value = getExtent()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getExtent() ? ::llvm::ArrayRef<::mlir::Type>(getExtent().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getStride()) { + _odsPrinter << ' ' << "stride"; + _odsPrinter << "("; + if (::mlir::Value value = getStride()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getStride() ? ::llvm::ArrayRef<::mlir::Type>(getStride().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getStartIdx()) { + _odsPrinter << ' ' << "startIdx"; + _odsPrinter << "("; + if (::mlir::Value value = getStartIdx()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getStartIdx() ? ::llvm::ArrayRef<::mlir::Type>(getStartIdx().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStrideInBytesAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("strideInBytes"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void DataBoundsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DataBoundsOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DataOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DataOpGenericAdaptorBase::DataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.data", odsAttrs.getContext()); +} + +DataOpGenericAdaptorBase::DataOpGenericAdaptorBase(DataOp op) : DataOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DataOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DataOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr DataOpGenericAdaptorBase::getAsyncAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().asyncAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool DataOpGenericAdaptorBase::getAsyncAttr() { + auto attr = getAsyncAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr DataOpGenericAdaptorBase::getWaitAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().waitAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool DataOpGenericAdaptorBase::getWaitAttr() { + auto attr = getWaitAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::acc::ClauseDefaultValueAttr DataOpGenericAdaptorBase::getDefaultAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); + return attr; +} + +::std::optional<::mlir::acc::ClauseDefaultValue> DataOpGenericAdaptorBase::getDefaultAttr() { + auto attr = getDefaultAttrAttr(); + return attr ? ::std::optional<::mlir::acc::ClauseDefaultValue>(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &DataOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DataOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DataOpAdaptor::DataOpAdaptor(DataOp op) : DataOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DataOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_asyncAttr = getProperties().asyncAttr; (void)tblgen_asyncAttr; + auto tblgen_defaultAttr = getProperties().defaultAttr; (void)tblgen_defaultAttr; + auto tblgen_waitAttr = getProperties().waitAttr; (void)tblgen_waitAttr; + + if (tblgen_asyncAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_asyncAttr)))) + return emitError(loc, "'acc.data' op ""attribute 'asyncAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_waitAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_waitAttr)))) + return emitError(loc, "'acc.data' op ""attribute 'waitAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_defaultAttr && !((::llvm::isa<::mlir::acc::ClauseDefaultValueAttr>(tblgen_defaultAttr)))) + return emitError(loc, "'acc.data' op ""attribute 'defaultAttr' failed to satisfy constraint: DefaultValue Clause"); + return ::mlir::success(); +} + +std::pair DataOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DataOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> DataOp::getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Value DataOp::getAsync() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value DataOp::getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range DataOp::getWaitOperands() { + return getODSOperands(3); +} + +::mlir::Operation::operand_range DataOp::getDataClauseOperands() { + return getODSOperands(4); +} + +::mlir::MutableOperandRange DataOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataOp::getAsyncMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataOp::getWaitDevnumMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataOp::getWaitOperandsMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DataOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DataOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &DataOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DataOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.asyncAttr; + auto attr = dict.get("asyncAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for asyncAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `asyncAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.defaultAttr; + auto attr = dict.get("defaultAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for defaultAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `defaultAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.waitAttr; + auto attr = dict.get("waitAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for waitAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `waitAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DataOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.asyncAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("asyncAttr", + propStorage)); + } + + { + const auto &propStorage = prop.defaultAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("defaultAttr", + propStorage)); + } + + { + const auto &propStorage = prop.waitAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("waitAttr", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DataOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.asyncAttr.getAsOpaquePointer()), + llvm::hash_value(prop.defaultAttr.getAsOpaquePointer()), + llvm::hash_value(prop.waitAttr.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DataOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "asyncAttr") + return prop.asyncAttr; + + if (name == "defaultAttr") + return prop.defaultAttr; + + if (name == "waitAttr") + return prop.waitAttr; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DataOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "asyncAttr") { + prop.asyncAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "defaultAttr") { + prop.defaultAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "waitAttr") { + prop.waitAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DataOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.asyncAttr) attrs.append("asyncAttr", prop.asyncAttr); + + if (prop.defaultAttr) attrs.append("defaultAttr", prop.defaultAttr); + + if (prop.waitAttr) attrs.append("waitAttr", prop.waitAttr); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DataOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAsyncAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "asyncAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getDefaultAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps5(attr, "defaultAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWaitAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "waitAttr", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DataOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.asyncAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.defaultAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.waitAttr))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DataOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.asyncAttr); + + writer.writeOptionalAttribute(prop.defaultAttr); + + writer.writeOptionalAttribute(prop.waitAttr); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr DataOp::getAsyncAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().asyncAttr); +} + +bool DataOp::getAsyncAttr() { + auto attr = getAsyncAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr DataOp::getWaitAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().waitAttr); +} + +bool DataOp::getWaitAttr() { + auto attr = getWaitAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::acc::ClauseDefaultValueAttr DataOp::getDefaultAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); +} + +::std::optional<::mlir::acc::ClauseDefaultValue> DataOp::getDefaultAttr() { + auto attr = getDefaultAttrAttr(); + return attr ? ::std::optional<::mlir::acc::ClauseDefaultValue>(attr.getValue()) : (::std::nullopt); +} + +void DataOp::setAsyncAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getAsyncAttrAttrName(), attr); +} + +void DataOp::setAsyncAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getAsyncAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getAsyncAttrAttrName()); +} + +void DataOp::setWaitAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWaitAttrAttrName(), attr); +} + +void DataOp::setWaitAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWaitAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWaitAttrAttrName()); +} + +void DataOp::setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr) { + (*this)->setAttr(getDefaultAttrAttrName(), attr); +} + +void DataOp::setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue) { + if (attrValue) + return (*this)->setAttr(getDefaultAttrAttrName(), ::mlir::acc::ClauseDefaultValueAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getDefaultAttrAttrName()); +} + +::mlir::Attribute DataOp::removeAsyncAttrAttr() { + auto &attr = getProperties().asyncAttr; + attr = {}; + return attr; +} + +::mlir::Attribute DataOp::removeWaitAttrAttr() { + auto &attr = getProperties().waitAttr; + attr = {}; + return attr; +} + +::mlir::Attribute DataOp::removeDefaultAttrAttr() { + auto &attr = getProperties().defaultAttr; + attr = {}; + return attr; +} + +void DataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (ifCond) + odsState.addOperands(ifCond); + if (async) + odsState.addOperands(async); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (async ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = asyncAttr; + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = waitAttr; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); +} + +void DataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (ifCond) + odsState.addOperands(ifCond); + if (async) + odsState.addOperands(async); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (async ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = asyncAttr; + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = waitAttr; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (ifCond) + odsState.addOperands(ifCond); + if (async) + odsState.addOperands(async); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (async ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = ((asyncAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = ((waitAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); +} + +void DataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (ifCond) + odsState.addOperands(ifCond); + if (async) + odsState.addOperands(async); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (async ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = ((asyncAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = ((waitAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DataOp::verifyInvariantsImpl() { + auto tblgen_asyncAttr = getProperties().asyncAttr; (void)tblgen_asyncAttr; + auto tblgen_defaultAttr = getProperties().defaultAttr; (void)tblgen_defaultAttr; + auto tblgen_waitAttr = getProperties().waitAttr; (void)tblgen_waitAttr; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_asyncAttr, "asyncAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_waitAttr, "waitAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps5(*this, tblgen_defaultAttr, "defaultAttr"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DataOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DataOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncOperands; + ::llvm::SMLoc asyncOperandsLoc; + (void)asyncOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> asyncTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitDevnumOperands; + ::llvm::SMLoc waitDevnumOperandsLoc; + (void)waitDevnumOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitDevnumTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitOperandsOperands; + ::llvm::SMLoc waitOperandsOperandsLoc; + (void)waitOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitOperandsTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool ifClause = false; + bool asyncClause = false; + bool dataOperandsClause = false; + bool wait_devnumClause = false; + bool waitClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("async"))) { + + if (asyncClause) { + return parser.emitError(parser.getNameLoc()) + << "`async` clause can appear at most once in the expansion of the " + "oilist directive"; + } + asyncClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + asyncOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait_devnum"))) { + + if (wait_devnumClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait_devnum` clause can appear at most once in the expansion of the " + "oilist directive"; + } + wait_devnumClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + waitDevnumOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait"))) { + + if (waitClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + waitClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + waitOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(waitOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(waitOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(ifCondOperands.size()), static_cast(asyncOperands.size()), static_cast(waitDevnumOperands.size()), static_cast(waitOperandsOperands.size()), static_cast(dataClauseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(asyncOperands, asyncTypes, asyncOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitDevnumOperands, waitDevnumTypes, waitDevnumOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitOperandsOperands, waitOperandsTypes, waitOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DataOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getAsync()) { + _odsPrinter << ' ' << "async"; + _odsPrinter << "("; + if (::mlir::Value value = getAsync()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getAsync() ? ::llvm::ArrayRef<::mlir::Type>(getAsync().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getWaitDevnum()) { + _odsPrinter << ' ' << "wait_devnum"; + _odsPrinter << "("; + if (::mlir::Value value = getWaitDevnum()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getWaitDevnum() ? ::llvm::ArrayRef<::mlir::Type>(getWaitDevnum().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getWaitOperands().size()) { + _odsPrinter << ' ' << "wait"; + _odsPrinter << "("; + _odsPrinter << getWaitOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getWaitOperands().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAsyncAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("asyncAttr"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWaitAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("waitAttr"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DataOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareDeviceResidentOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeclareDeviceResidentOpGenericAdaptorBase::DeclareDeviceResidentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.declare_device_resident", odsAttrs.getContext()); +} + +DeclareDeviceResidentOpGenericAdaptorBase::DeclareDeviceResidentOpGenericAdaptorBase(DeclareDeviceResidentOp op) : DeclareDeviceResidentOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeclareDeviceResidentOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DeclareDeviceResidentOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr DeclareDeviceResidentOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause DeclareDeviceResidentOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeclareDeviceResidentOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool DeclareDeviceResidentOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeclareDeviceResidentOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool DeclareDeviceResidentOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DeclareDeviceResidentOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > DeclareDeviceResidentOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +DeclareDeviceResidentOpAdaptor::DeclareDeviceResidentOpAdaptor(DeclareDeviceResidentOp op) : DeclareDeviceResidentOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeclareDeviceResidentOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.declare_device_resident' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.declare_device_resident' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.declare_device_resident' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.declare_device_resident' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair DeclareDeviceResidentOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DeclareDeviceResidentOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DeclareDeviceResidentOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DeclareDeviceResidentOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range DeclareDeviceResidentOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &DeclareDeviceResidentOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange DeclareDeviceResidentOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DeclareDeviceResidentOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DeclareDeviceResidentOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeclareDeviceResidentOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DeclareDeviceResidentOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult DeclareDeviceResidentOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DeclareDeviceResidentOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DeclareDeviceResidentOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DeclareDeviceResidentOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DeclareDeviceResidentOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DeclareDeviceResidentOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DeclareDeviceResidentOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeclareDeviceResidentOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DeclareDeviceResidentOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr DeclareDeviceResidentOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause DeclareDeviceResidentOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeclareDeviceResidentOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool DeclareDeviceResidentOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeclareDeviceResidentOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool DeclareDeviceResidentOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DeclareDeviceResidentOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > DeclareDeviceResidentOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void DeclareDeviceResidentOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void DeclareDeviceResidentOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void DeclareDeviceResidentOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void DeclareDeviceResidentOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DeclareDeviceResidentOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void DeclareDeviceResidentOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DeclareDeviceResidentOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void DeclareDeviceResidentOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute DeclareDeviceResidentOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void DeclareDeviceResidentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void DeclareDeviceResidentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeclareDeviceResidentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void DeclareDeviceResidentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeclareDeviceResidentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DeclareDeviceResidentOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_declare_device_resident); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult DeclareDeviceResidentOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeclareDeviceResidentOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DeclareDeviceResidentOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeclareDeviceResidentOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_declare_device_resident))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareDeviceResidentOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareEnterOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeclareEnterOpGenericAdaptorBase::DeclareEnterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.declare_enter", odsAttrs.getContext()); +} + +DeclareEnterOpGenericAdaptorBase::DeclareEnterOpGenericAdaptorBase(DeclareEnterOp op) : DeclareEnterOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeclareEnterOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr DeclareEnterOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DeclareEnterOpAdaptor::DeclareEnterOpAdaptor(DeclareEnterOp op) : DeclareEnterOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeclareEnterOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DeclareEnterOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range DeclareEnterOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DeclareEnterOp::getDataClauseOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange DeclareEnterOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair DeclareEnterOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeclareEnterOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void DeclareEnterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange dataClauseOperands) { + odsState.addOperands(dataClauseOperands); +} + +void DeclareEnterOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DeclareEnterOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeclareEnterOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DeclareEnterOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + bool dataOperandsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeclareEnterOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareEnterOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareExitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeclareExitOpGenericAdaptorBase::DeclareExitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.declare_exit", odsAttrs.getContext()); +} + +DeclareExitOpGenericAdaptorBase::DeclareExitOpGenericAdaptorBase(DeclareExitOp op) : DeclareExitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeclareExitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr DeclareExitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DeclareExitOpAdaptor::DeclareExitOpAdaptor(DeclareExitOp op) : DeclareExitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeclareExitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DeclareExitOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range DeclareExitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DeclareExitOp::getDataClauseOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange DeclareExitOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair DeclareExitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeclareExitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void DeclareExitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange dataClauseOperands) { + odsState.addOperands(dataClauseOperands); +} + +void DeclareExitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DeclareExitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeclareExitOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DeclareExitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + bool dataOperandsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeclareExitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareExitOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareLinkOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeclareLinkOpGenericAdaptorBase::DeclareLinkOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.declare_link", odsAttrs.getContext()); +} + +DeclareLinkOpGenericAdaptorBase::DeclareLinkOpGenericAdaptorBase(DeclareLinkOp op) : DeclareLinkOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeclareLinkOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DeclareLinkOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr DeclareLinkOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause DeclareLinkOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeclareLinkOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool DeclareLinkOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeclareLinkOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool DeclareLinkOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DeclareLinkOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > DeclareLinkOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +DeclareLinkOpAdaptor::DeclareLinkOpAdaptor(DeclareLinkOp op) : DeclareLinkOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeclareLinkOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.declare_link' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.declare_link' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.declare_link' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.declare_link' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair DeclareLinkOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DeclareLinkOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DeclareLinkOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DeclareLinkOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range DeclareLinkOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &DeclareLinkOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange DeclareLinkOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DeclareLinkOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DeclareLinkOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeclareLinkOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DeclareLinkOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult DeclareLinkOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DeclareLinkOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DeclareLinkOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DeclareLinkOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DeclareLinkOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DeclareLinkOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DeclareLinkOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeclareLinkOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DeclareLinkOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr DeclareLinkOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause DeclareLinkOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeclareLinkOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool DeclareLinkOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeclareLinkOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool DeclareLinkOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DeclareLinkOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > DeclareLinkOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void DeclareLinkOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void DeclareLinkOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void DeclareLinkOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void DeclareLinkOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DeclareLinkOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void DeclareLinkOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DeclareLinkOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void DeclareLinkOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute DeclareLinkOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void DeclareLinkOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void DeclareLinkOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeclareLinkOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void DeclareLinkOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeclareLinkOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DeclareLinkOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_declare_link); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult DeclareLinkOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeclareLinkOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DeclareLinkOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeclareLinkOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_declare_link))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareLinkOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeclareOpGenericAdaptorBase::DeclareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.declare", odsAttrs.getContext()); +} + +DeclareOpGenericAdaptorBase::DeclareOpGenericAdaptorBase(DeclareOp op) : DeclareOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeclareOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr DeclareOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &DeclareOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DeclareOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DeclareOpAdaptor::DeclareOpAdaptor(DeclareOp op) : DeclareOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeclareOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DeclareOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range DeclareOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range DeclareOp::getDataClauseOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange DeclareOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair DeclareOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeclareOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &DeclareOp::getRegion() { + return (*this)->getRegion(0); +} + +void DeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange dataClauseOperands) { + odsState.addOperands(dataClauseOperands); + (void)odsState.addRegion(); +} + +void DeclareOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DeclareOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeclareOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DeclareOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + if (parser.parseKeyword("dataOperands")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeclareOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeleteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DeleteOpGenericAdaptorBase::DeleteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.delete", odsAttrs.getContext()); +} + +DeleteOpGenericAdaptorBase::DeleteOpGenericAdaptorBase(DeleteOp op) : DeleteOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DeleteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DeleteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr DeleteOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause DeleteOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeleteOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool DeleteOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeleteOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool DeleteOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DeleteOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > DeleteOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +DeleteOpAdaptor::DeleteOpAdaptor(DeleteOp op) : DeleteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DeleteOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.delete' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.delete' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.delete' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.delete' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair DeleteOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DeleteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DeleteOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DeleteOp::getVarPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range DeleteOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &DeleteOp::getAccPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange DeleteOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DeleteOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DeleteOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DeleteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult DeleteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DeleteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DeleteOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DeleteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DeleteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DeleteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DeleteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeleteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DeleteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr DeleteOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause DeleteOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeleteOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool DeleteOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DeleteOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool DeleteOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DeleteOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > DeleteOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void DeleteOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void DeleteOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void DeleteOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void DeleteOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DeleteOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void DeleteOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DeleteOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void DeleteOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute DeleteOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void DeleteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } +} + +void DeleteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeleteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } +} + +void DeleteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DeleteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DeleteOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_delete); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult DeleteOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DeleteOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DeleteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand accPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accPtrOperands(accPtrRawOperands); ::llvm::SMLoc accPtrOperandsLoc; + (void)accPtrOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrOperands; + ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrTypes; + if (parser.parseKeyword("accPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + accPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool boundsClause = false; + bool toClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("to"))) { + + if (toClause) { + return parser.emitError(parser.getNameLoc()) + << "`to` clause can appear at most once in the expansion of the " + "oilist directive"; + } + toClause = true; + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + if (parser.resolveOperands(accPtrOperands, accPtrTypes, accPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DeleteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "accPtr"; + _odsPrinter << "("; + _odsPrinter << getAccPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + if (false || getVarPtr()) { + _odsPrinter << ' ' << "to"; + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_delete))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeleteOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DetachOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DetachOpGenericAdaptorBase::DetachOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.detach", odsAttrs.getContext()); +} + +DetachOpGenericAdaptorBase::DetachOpGenericAdaptorBase(DetachOp op) : DetachOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DetachOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DetachOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr DetachOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause DetachOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DetachOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool DetachOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DetachOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool DetachOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DetachOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > DetachOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +DetachOpAdaptor::DetachOpAdaptor(DetachOp op) : DetachOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DetachOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.detach' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.detach' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.detach' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.detach' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair DetachOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DetachOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DetachOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DetachOp::getVarPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range DetachOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &DetachOp::getAccPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange DetachOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DetachOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DetachOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DetachOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult DetachOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DetachOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DetachOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DetachOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DetachOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DetachOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DetachOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DetachOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DetachOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr DetachOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause DetachOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DetachOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool DetachOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DetachOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool DetachOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DetachOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > DetachOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void DetachOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void DetachOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void DetachOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void DetachOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DetachOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void DetachOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DetachOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void DetachOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute DetachOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void DetachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } +} + +void DetachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DetachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } +} + +void DetachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DetachOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DetachOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_detach); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult DetachOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DetachOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DetachOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand accPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accPtrOperands(accPtrRawOperands); ::llvm::SMLoc accPtrOperandsLoc; + (void)accPtrOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrOperands; + ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrTypes; + if (parser.parseKeyword("accPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + accPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool boundsClause = false; + bool toClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("to"))) { + + if (toClause) { + return parser.emitError(parser.getNameLoc()) + << "`to` clause can appear at most once in the expansion of the " + "oilist directive"; + } + toClause = true; + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + if (parser.resolveOperands(accPtrOperands, accPtrTypes, accPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DetachOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "accPtr"; + _odsPrinter << "("; + _odsPrinter << getAccPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + if (false || getVarPtr()) { + _odsPrinter << ' ' << "to"; + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_detach))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DetachOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DevicePtrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DevicePtrOpGenericAdaptorBase::DevicePtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.deviceptr", odsAttrs.getContext()); +} + +DevicePtrOpGenericAdaptorBase::DevicePtrOpGenericAdaptorBase(DevicePtrOp op) : DevicePtrOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DevicePtrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DevicePtrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr DevicePtrOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause DevicePtrOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DevicePtrOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool DevicePtrOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DevicePtrOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool DevicePtrOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DevicePtrOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > DevicePtrOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +DevicePtrOpAdaptor::DevicePtrOpAdaptor(DevicePtrOp op) : DevicePtrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DevicePtrOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.deviceptr' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.deviceptr' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.deviceptr' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.deviceptr' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair DevicePtrOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DevicePtrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DevicePtrOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DevicePtrOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range DevicePtrOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &DevicePtrOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange DevicePtrOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DevicePtrOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DevicePtrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DevicePtrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> DevicePtrOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult DevicePtrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DevicePtrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DevicePtrOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DevicePtrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DevicePtrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DevicePtrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DevicePtrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DevicePtrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DevicePtrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr DevicePtrOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause DevicePtrOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DevicePtrOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool DevicePtrOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr DevicePtrOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool DevicePtrOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr DevicePtrOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > DevicePtrOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void DevicePtrOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void DevicePtrOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void DevicePtrOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void DevicePtrOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DevicePtrOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void DevicePtrOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DevicePtrOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void DevicePtrOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute DevicePtrOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void DevicePtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void DevicePtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DevicePtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void DevicePtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DevicePtrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DevicePtrOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_deviceptr); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult DevicePtrOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DevicePtrOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DevicePtrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DevicePtrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_deviceptr))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DevicePtrOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::EnterDataOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +EnterDataOpGenericAdaptorBase::EnterDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.enter_data", odsAttrs.getContext()); +} + +EnterDataOpGenericAdaptorBase::EnterDataOpGenericAdaptorBase(EnterDataOp op) : EnterDataOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair EnterDataOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr EnterDataOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr EnterDataOpGenericAdaptorBase::getAsyncAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool EnterDataOpGenericAdaptorBase::getAsync() { + auto attr = getAsyncAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr EnterDataOpGenericAdaptorBase::getWaitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().wait); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool EnterDataOpGenericAdaptorBase::getWait() { + auto attr = getWaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +EnterDataOpAdaptor::EnterDataOpAdaptor(EnterDataOp op) : EnterDataOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult EnterDataOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_async = getProperties().async; (void)tblgen_async; + auto tblgen_wait = getProperties().wait; (void)tblgen_wait; + + if (tblgen_async && !((::llvm::isa<::mlir::UnitAttr>(tblgen_async)))) + return emitError(loc, "'acc.enter_data' op ""attribute 'async' failed to satisfy constraint: unit attribute"); + + if (tblgen_wait && !((::llvm::isa<::mlir::UnitAttr>(tblgen_wait)))) + return emitError(loc, "'acc.enter_data' op ""attribute 'wait' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair EnterDataOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range EnterDataOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> EnterDataOp::getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Value EnterDataOp::getAsyncOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value EnterDataOp::getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range EnterDataOp::getWaitOperands() { + return getODSOperands(3); +} + +::mlir::Operation::operand_range EnterDataOp::getDataClauseOperands() { + return getODSOperands(4); +} + +::mlir::MutableOperandRange EnterDataOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange EnterDataOp::getAsyncOperandMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange EnterDataOp::getWaitDevnumMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange EnterDataOp::getWaitOperandsMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange EnterDataOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair EnterDataOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range EnterDataOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult EnterDataOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.async; + auto attr = dict.get("async"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for async in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `async` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.wait; + auto attr = dict.get("wait"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for wait in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `wait` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute EnterDataOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.async; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("async", + propStorage)); + } + + { + const auto &propStorage = prop.wait; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("wait", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code EnterDataOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.async.getAsOpaquePointer()), + llvm::hash_value(prop.wait.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional EnterDataOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "async") + return prop.async; + + if (name == "wait") + return prop.wait; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void EnterDataOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "async") { + prop.async = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "wait") { + prop.wait = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void EnterDataOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.async) attrs.append("async", prop.async); + + if (prop.wait) attrs.append("wait", prop.wait); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult EnterDataOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAsyncAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "async", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWaitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "wait", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult EnterDataOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.async))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.wait))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void EnterDataOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.async); + + writer.writeOptionalAttribute(prop.wait); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr EnterDataOp::getAsyncAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); +} + +bool EnterDataOp::getAsync() { + auto attr = getAsyncAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr EnterDataOp::getWaitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().wait); +} + +bool EnterDataOp::getWait() { + auto attr = getWaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void EnterDataOp::setAsyncAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getAsyncAttrName(), attr); +} + +void EnterDataOp::setAsync(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getAsyncAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getAsyncAttrName()); +} + +void EnterDataOp::setWaitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWaitAttrName(), attr); +} + +void EnterDataOp::setWait(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWaitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWaitAttrName()); +} + +::mlir::Attribute EnterDataOp::removeAsyncAttr() { + auto &attr = getProperties().async; + attr = {}; + return attr; +} + +::mlir::Attribute EnterDataOp::removeWaitAttr() { + auto &attr = getProperties().wait; + attr = {}; + return attr; +} + +void EnterDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = async; + } + if (wait) { + odsState.getOrAddProperties().wait = wait; + } +} + +void EnterDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = async; + } + if (wait) { + odsState.getOrAddProperties().wait = wait; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void EnterDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = ((async) ? odsBuilder.getUnitAttr() : nullptr); + } + if (wait) { + odsState.getOrAddProperties().wait = ((wait) ? odsBuilder.getUnitAttr() : nullptr); + } +} + +void EnterDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = ((async) ? odsBuilder.getUnitAttr() : nullptr); + } + if (wait) { + odsState.getOrAddProperties().wait = ((wait) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void EnterDataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult EnterDataOp::verifyInvariantsImpl() { + auto tblgen_async = getProperties().async; (void)tblgen_async; + auto tblgen_wait = getProperties().wait; (void)tblgen_wait; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_async, "async"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_wait, "wait"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult EnterDataOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult EnterDataOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncOperandOperands; + ::llvm::SMLoc asyncOperandOperandsLoc; + (void)asyncOperandOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> asyncOperandTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitDevnumOperands; + ::llvm::SMLoc waitDevnumOperandsLoc; + (void)waitDevnumOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitDevnumTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitOperandsOperands; + ::llvm::SMLoc waitOperandsOperandsLoc; + (void)waitOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + bool ifClause = false; + bool asyncClause = false; + bool wait_devnumClause = false; + bool waitClause = false; + bool dataOperandsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("async"))) { + + if (asyncClause) { + return parser.emitError(parser.getNameLoc()) + << "`async` clause can appear at most once in the expansion of the " + "oilist directive"; + } + asyncClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + asyncOperandOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperandOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperandTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait_devnum"))) { + + if (wait_devnumClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait_devnum` clause can appear at most once in the expansion of the " + "oilist directive"; + } + wait_devnumClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + waitDevnumOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait"))) { + + if (waitClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + waitClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + waitOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(waitOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(waitOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(ifCondOperands.size()), static_cast(asyncOperandOperands.size()), static_cast(waitDevnumOperands.size()), static_cast(waitOperandsOperands.size()), static_cast(dataClauseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(asyncOperandOperands, asyncOperandTypes, asyncOperandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitDevnumOperands, waitDevnumTypes, waitDevnumOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitOperandsOperands, waitOperandsTypes, waitOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void EnterDataOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getAsyncOperand()) { + _odsPrinter << ' ' << "async"; + _odsPrinter << "("; + if (::mlir::Value value = getAsyncOperand()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getAsyncOperand() ? ::llvm::ArrayRef<::mlir::Type>(getAsyncOperand().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getWaitDevnum()) { + _odsPrinter << ' ' << "wait_devnum"; + _odsPrinter << "("; + if (::mlir::Value value = getWaitDevnum()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getWaitDevnum() ? ::llvm::ArrayRef<::mlir::Type>(getWaitDevnum().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getWaitOperands().size()) { + _odsPrinter << ' ' << "wait"; + _odsPrinter << "("; + _odsPrinter << getWaitOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getWaitOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAsyncAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("async"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWaitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("wait"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::EnterDataOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ExitDataOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExitDataOpGenericAdaptorBase::ExitDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.exit_data", odsAttrs.getContext()); +} + +ExitDataOpGenericAdaptorBase::ExitDataOpGenericAdaptorBase(ExitDataOp op) : ExitDataOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExitDataOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ExitDataOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr ExitDataOpGenericAdaptorBase::getAsyncAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ExitDataOpGenericAdaptorBase::getAsync() { + auto attr = getAsyncAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ExitDataOpGenericAdaptorBase::getWaitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().wait); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ExitDataOpGenericAdaptorBase::getWait() { + auto attr = getWaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ExitDataOpGenericAdaptorBase::getFinalizeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().finalize); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ExitDataOpGenericAdaptorBase::getFinalize() { + auto attr = getFinalizeAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +ExitDataOpAdaptor::ExitDataOpAdaptor(ExitDataOp op) : ExitDataOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExitDataOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_async = getProperties().async; (void)tblgen_async; + auto tblgen_finalize = getProperties().finalize; (void)tblgen_finalize; + auto tblgen_wait = getProperties().wait; (void)tblgen_wait; + + if (tblgen_async && !((::llvm::isa<::mlir::UnitAttr>(tblgen_async)))) + return emitError(loc, "'acc.exit_data' op ""attribute 'async' failed to satisfy constraint: unit attribute"); + + if (tblgen_wait && !((::llvm::isa<::mlir::UnitAttr>(tblgen_wait)))) + return emitError(loc, "'acc.exit_data' op ""attribute 'wait' failed to satisfy constraint: unit attribute"); + + if (tblgen_finalize && !((::llvm::isa<::mlir::UnitAttr>(tblgen_finalize)))) + return emitError(loc, "'acc.exit_data' op ""attribute 'finalize' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair ExitDataOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ExitDataOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> ExitDataOp::getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Value ExitDataOp::getAsyncOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value ExitDataOp::getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range ExitDataOp::getWaitOperands() { + return getODSOperands(3); +} + +::mlir::Operation::operand_range ExitDataOp::getDataClauseOperands() { + return getODSOperands(4); +} + +::mlir::MutableOperandRange ExitDataOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ExitDataOp::getAsyncOperandMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ExitDataOp::getWaitDevnumMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ExitDataOp::getWaitOperandsMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ExitDataOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ExitDataOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExitDataOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult ExitDataOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.async; + auto attr = dict.get("async"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for async in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `async` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.finalize; + auto attr = dict.get("finalize"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for finalize in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `finalize` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.wait; + auto attr = dict.get("wait"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for wait in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `wait` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ExitDataOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.async; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("async", + propStorage)); + } + + { + const auto &propStorage = prop.finalize; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("finalize", + propStorage)); + } + + { + const auto &propStorage = prop.wait; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("wait", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExitDataOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.async.getAsOpaquePointer()), + llvm::hash_value(prop.finalize.getAsOpaquePointer()), + llvm::hash_value(prop.wait.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ExitDataOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "async") + return prop.async; + + if (name == "finalize") + return prop.finalize; + + if (name == "wait") + return prop.wait; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ExitDataOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "async") { + prop.async = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "finalize") { + prop.finalize = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "wait") { + prop.wait = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ExitDataOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.async) attrs.append("async", prop.async); + + if (prop.finalize) attrs.append("finalize", prop.finalize); + + if (prop.wait) attrs.append("wait", prop.wait); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ExitDataOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAsyncAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "async", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFinalizeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "finalize", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWaitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "wait", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExitDataOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.async))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.finalize))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.wait))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ExitDataOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.async); + + writer.writeOptionalAttribute(prop.finalize); + + writer.writeOptionalAttribute(prop.wait); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr ExitDataOp::getAsyncAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); +} + +bool ExitDataOp::getAsync() { + auto attr = getAsyncAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ExitDataOp::getWaitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().wait); +} + +bool ExitDataOp::getWait() { + auto attr = getWaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ExitDataOp::getFinalizeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().finalize); +} + +bool ExitDataOp::getFinalize() { + auto attr = getFinalizeAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void ExitDataOp::setAsyncAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getAsyncAttrName(), attr); +} + +void ExitDataOp::setAsync(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getAsyncAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getAsyncAttrName()); +} + +void ExitDataOp::setWaitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWaitAttrName(), attr); +} + +void ExitDataOp::setWait(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWaitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWaitAttrName()); +} + +void ExitDataOp::setFinalizeAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getFinalizeAttrName(), attr); +} + +void ExitDataOp::setFinalize(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getFinalizeAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getFinalizeAttrName()); +} + +::mlir::Attribute ExitDataOp::removeAsyncAttr() { + auto &attr = getProperties().async; + attr = {}; + return attr; +} + +::mlir::Attribute ExitDataOp::removeWaitAttr() { + auto &attr = getProperties().wait; + attr = {}; + return attr; +} + +::mlir::Attribute ExitDataOp::removeFinalizeAttr() { + auto &attr = getProperties().finalize; + attr = {}; + return attr; +} + +void ExitDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = async; + } + if (wait) { + odsState.getOrAddProperties().wait = wait; + } + if (finalize) { + odsState.getOrAddProperties().finalize = finalize; + } +} + +void ExitDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = async; + } + if (wait) { + odsState.getOrAddProperties().wait = wait; + } + if (finalize) { + odsState.getOrAddProperties().finalize = finalize; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExitDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = ((async) ? odsBuilder.getUnitAttr() : nullptr); + } + if (wait) { + odsState.getOrAddProperties().wait = ((wait) ? odsBuilder.getUnitAttr() : nullptr); + } + if (finalize) { + odsState.getOrAddProperties().finalize = ((finalize) ? odsBuilder.getUnitAttr() : nullptr); + } +} + +void ExitDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = ((async) ? odsBuilder.getUnitAttr() : nullptr); + } + if (wait) { + odsState.getOrAddProperties().wait = ((wait) ? odsBuilder.getUnitAttr() : nullptr); + } + if (finalize) { + odsState.getOrAddProperties().finalize = ((finalize) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExitDataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ExitDataOp::verifyInvariantsImpl() { + auto tblgen_async = getProperties().async; (void)tblgen_async; + auto tblgen_finalize = getProperties().finalize; (void)tblgen_finalize; + auto tblgen_wait = getProperties().wait; (void)tblgen_wait; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_async, "async"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_wait, "wait"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_finalize, "finalize"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExitDataOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ExitDataOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncOperandOperands; + ::llvm::SMLoc asyncOperandOperandsLoc; + (void)asyncOperandOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> asyncOperandTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitDevnumOperands; + ::llvm::SMLoc waitDevnumOperandsLoc; + (void)waitDevnumOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitDevnumTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitOperandsOperands; + ::llvm::SMLoc waitOperandsOperandsLoc; + (void)waitOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + bool ifClause = false; + bool asyncClause = false; + bool wait_devnumClause = false; + bool waitClause = false; + bool dataOperandsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("async"))) { + + if (asyncClause) { + return parser.emitError(parser.getNameLoc()) + << "`async` clause can appear at most once in the expansion of the " + "oilist directive"; + } + asyncClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + asyncOperandOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperandOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperandTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait_devnum"))) { + + if (wait_devnumClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait_devnum` clause can appear at most once in the expansion of the " + "oilist directive"; + } + wait_devnumClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + waitDevnumOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait"))) { + + if (waitClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + waitClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + waitOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(waitOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(waitOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(ifCondOperands.size()), static_cast(asyncOperandOperands.size()), static_cast(waitDevnumOperands.size()), static_cast(waitOperandsOperands.size()), static_cast(dataClauseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(asyncOperandOperands, asyncOperandTypes, asyncOperandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitDevnumOperands, waitDevnumTypes, waitDevnumOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitOperandsOperands, waitOperandsTypes, waitOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExitDataOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getAsyncOperand()) { + _odsPrinter << ' ' << "async"; + _odsPrinter << "("; + if (::mlir::Value value = getAsyncOperand()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getAsyncOperand() ? ::llvm::ArrayRef<::mlir::Type>(getAsyncOperand().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getWaitDevnum()) { + _odsPrinter << ' ' << "wait_devnum"; + _odsPrinter << "("; + if (::mlir::Value value = getWaitDevnum()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getWaitDevnum() ? ::llvm::ArrayRef<::mlir::Type>(getWaitDevnum().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getWaitOperands().size()) { + _odsPrinter << ' ' << "wait"; + _odsPrinter << "("; + _odsPrinter << getWaitOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getWaitOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAsyncAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("async"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWaitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("wait"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getFinalizeAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("finalize"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ExitDataOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::FirstprivateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FirstprivateOpGenericAdaptorBase::FirstprivateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.firstprivate", odsAttrs.getContext()); +} + +FirstprivateOpGenericAdaptorBase::FirstprivateOpGenericAdaptorBase(FirstprivateOp op) : FirstprivateOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FirstprivateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr FirstprivateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr FirstprivateOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause FirstprivateOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr FirstprivateOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool FirstprivateOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr FirstprivateOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool FirstprivateOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr FirstprivateOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > FirstprivateOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +FirstprivateOpAdaptor::FirstprivateOpAdaptor(FirstprivateOp op) : FirstprivateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FirstprivateOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.firstprivate' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.firstprivate' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.firstprivate' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.firstprivate' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair FirstprivateOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range FirstprivateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> FirstprivateOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> FirstprivateOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range FirstprivateOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &FirstprivateOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange FirstprivateOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange FirstprivateOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair FirstprivateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FirstprivateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> FirstprivateOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult FirstprivateOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute FirstprivateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FirstprivateOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional FirstprivateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void FirstprivateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void FirstprivateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult FirstprivateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FirstprivateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void FirstprivateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr FirstprivateOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause FirstprivateOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr FirstprivateOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool FirstprivateOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr FirstprivateOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool FirstprivateOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr FirstprivateOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > FirstprivateOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void FirstprivateOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void FirstprivateOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void FirstprivateOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void FirstprivateOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void FirstprivateOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void FirstprivateOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void FirstprivateOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void FirstprivateOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute FirstprivateOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void FirstprivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void FirstprivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FirstprivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void FirstprivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FirstprivateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void FirstprivateOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_firstprivate); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult FirstprivateOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FirstprivateOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult FirstprivateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FirstprivateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_firstprivate))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::FirstprivateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::FirstprivateRecipeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FirstprivateRecipeOpGenericAdaptorBase::FirstprivateRecipeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.firstprivate.recipe", odsAttrs.getContext()); +} + +FirstprivateRecipeOpGenericAdaptorBase::FirstprivateRecipeOpGenericAdaptorBase(FirstprivateRecipeOp op) : FirstprivateRecipeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FirstprivateRecipeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FirstprivateRecipeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr FirstprivateRecipeOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef FirstprivateRecipeOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FirstprivateRecipeOpGenericAdaptorBase::getTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); + return attr; +} + +::mlir::Type FirstprivateRecipeOpGenericAdaptorBase::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::Region &FirstprivateRecipeOpGenericAdaptorBase::getInitRegion() { + return *odsRegions[0]; +} + +::mlir::Region &FirstprivateRecipeOpGenericAdaptorBase::getCopyRegion() { + return *odsRegions[1]; +} + +::mlir::Region &FirstprivateRecipeOpGenericAdaptorBase::getDestroyRegion() { + return *odsRegions[2]; +} + +::mlir::RegionRange FirstprivateRecipeOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +FirstprivateRecipeOpAdaptor::FirstprivateRecipeOpAdaptor(FirstprivateRecipeOp op) : FirstprivateRecipeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FirstprivateRecipeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'acc.firstprivate.recipe' op ""requires attribute 'sym_name'"); + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitError(loc, "'acc.firstprivate.recipe' op ""requires attribute 'type'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'acc.firstprivate.recipe' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) + return emitError(loc, "'acc.firstprivate.recipe' op ""attribute 'type' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair FirstprivateRecipeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FirstprivateRecipeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair FirstprivateRecipeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FirstprivateRecipeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &FirstprivateRecipeOp::getInitRegion() { + return (*this)->getRegion(0); +} + +::mlir::Region &FirstprivateRecipeOp::getCopyRegion() { + return (*this)->getRegion(1); +} + +::mlir::Region &FirstprivateRecipeOp::getDestroyRegion() { + return (*this)->getRegion(2); +} + +::mlir::LogicalResult FirstprivateRecipeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.type; + auto attr = dict.get("type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FirstprivateRecipeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("type", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FirstprivateRecipeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.type.getAsOpaquePointer())); +} + +std::optional FirstprivateRecipeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "sym_name") + return prop.sym_name; + + if (name == "type") + return prop.type; + return std::nullopt; +} + +void FirstprivateRecipeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "type") { + prop.type = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FirstprivateRecipeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.type) attrs.append("type", prop.type); +} + +::mlir::LogicalResult FirstprivateRecipeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps0(attr, "type", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FirstprivateRecipeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.type))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FirstprivateRecipeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.sym_name); + writer.writeAttribute(prop.type); +} + +::mlir::StringAttr FirstprivateRecipeOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef FirstprivateRecipeOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FirstprivateRecipeOp::getTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); +} + +::mlir::Type FirstprivateRecipeOp::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void FirstprivateRecipeOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void FirstprivateRecipeOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void FirstprivateRecipeOp::setTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getTypeAttrName(), attr); +} + +void FirstprivateRecipeOp::setType(::mlir::Type attrValue) { + (*this)->setAttr(getTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void FirstprivateRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + (void)odsState.addRegion(); + (void)odsState.addRegion(); + (void)odsState.addRegion(); +} + +void FirstprivateRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + (void)odsState.addRegion(); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FirstprivateRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + (void)odsState.addRegion(); +} + +void FirstprivateRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FirstprivateRecipeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 3; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FirstprivateRecipeOp::verifyInvariantsImpl() { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitOpError("requires attribute 'type'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps0(*this, tblgen_type, "type"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "initRegion", index++))) + return ::mlir::failure(); + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(1))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "copyRegion", index++))) + return ::mlir::failure(); + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(2))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "destroyRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FirstprivateRecipeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FirstprivateRecipeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + ::mlir::TypeAttr typeAttr; + std::unique_ptr<::mlir::Region> initRegionRegion = std::make_unique<::mlir::Region>(); + std::unique_ptr<::mlir::Region> copyRegionRegion = std::make_unique<::mlir::Region>(); + std::unique_ptr<::mlir::Region> destroyRegionRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (typeAttr) result.getOrAddProperties().type = typeAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseKeyword("init")) + return ::mlir::failure(); + + if (parser.parseRegion(*initRegionRegion)) + return ::mlir::failure(); + if (parser.parseKeyword("copy")) + return ::mlir::failure(); + + if (parser.parseRegion(*copyRegionRegion)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("destroy"))) { + + if (parser.parseRegion(*destroyRegionRegion)) + return ::mlir::failure(); + } + result.addRegion(std::move(initRegionRegion)); + result.addRegion(std::move(copyRegionRegion)); + result.addRegion(std::move(destroyRegionRegion)); + return ::mlir::success(); +} + +void FirstprivateRecipeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getTypeAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("type"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "init"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getInitRegion()); + _odsPrinter << ' ' << "copy"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getCopyRegion()); + if (!getDestroyRegion().empty()) { + _odsPrinter << ' ' << "destroy"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getDestroyRegion()); + } +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::FirstprivateRecipeOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::GetDevicePtrOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetDevicePtrOpGenericAdaptorBase::GetDevicePtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.getdeviceptr", odsAttrs.getContext()); +} + +GetDevicePtrOpGenericAdaptorBase::GetDevicePtrOpGenericAdaptorBase(GetDevicePtrOp op) : GetDevicePtrOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetDevicePtrOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr GetDevicePtrOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr GetDevicePtrOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause GetDevicePtrOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr GetDevicePtrOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool GetDevicePtrOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr GetDevicePtrOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool GetDevicePtrOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr GetDevicePtrOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > GetDevicePtrOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +GetDevicePtrOpAdaptor::GetDevicePtrOpAdaptor(GetDevicePtrOp op) : GetDevicePtrOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetDevicePtrOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.getdeviceptr' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.getdeviceptr' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.getdeviceptr' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.getdeviceptr' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair GetDevicePtrOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range GetDevicePtrOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> GetDevicePtrOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> GetDevicePtrOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range GetDevicePtrOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &GetDevicePtrOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange GetDevicePtrOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange GetDevicePtrOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair GetDevicePtrOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetDevicePtrOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> GetDevicePtrOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GetDevicePtrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute GetDevicePtrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GetDevicePtrOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional GetDevicePtrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void GetDevicePtrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void GetDevicePtrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult GetDevicePtrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetDevicePtrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void GetDevicePtrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr GetDevicePtrOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause GetDevicePtrOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr GetDevicePtrOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool GetDevicePtrOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr GetDevicePtrOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool GetDevicePtrOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr GetDevicePtrOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > GetDevicePtrOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void GetDevicePtrOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void GetDevicePtrOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void GetDevicePtrOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void GetDevicePtrOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void GetDevicePtrOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void GetDevicePtrOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void GetDevicePtrOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void GetDevicePtrOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute GetDevicePtrOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void GetDevicePtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void GetDevicePtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetDevicePtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void GetDevicePtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetDevicePtrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void GetDevicePtrOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_getdeviceptr); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult GetDevicePtrOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetDevicePtrOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetDevicePtrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetDevicePtrOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_getdeviceptr))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::GetDevicePtrOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::GlobalConstructorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalConstructorOpGenericAdaptorBase::GlobalConstructorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.global_ctor", odsAttrs.getContext()); +} + +GlobalConstructorOpGenericAdaptorBase::GlobalConstructorOpGenericAdaptorBase(GlobalConstructorOp op) : GlobalConstructorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalConstructorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalConstructorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr GlobalConstructorOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef GlobalConstructorOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::Region &GlobalConstructorOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange GlobalConstructorOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +GlobalConstructorOpAdaptor::GlobalConstructorOpAdaptor(GlobalConstructorOp op) : GlobalConstructorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalConstructorOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'acc.global_ctor' op ""requires attribute 'sym_name'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'acc.global_ctor' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair GlobalConstructorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalConstructorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalConstructorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalConstructorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &GlobalConstructorOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult GlobalConstructorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalConstructorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalConstructorOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.sym_name.getAsOpaquePointer())); +} + +std::optional GlobalConstructorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "sym_name") + return prop.sym_name; + return std::nullopt; +} + +void GlobalConstructorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalConstructorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); +} + +::mlir::LogicalResult GlobalConstructorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalConstructorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalConstructorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.sym_name); +} + +::mlir::StringAttr GlobalConstructorOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef GlobalConstructorOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +void GlobalConstructorOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void GlobalConstructorOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void GlobalConstructorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name) { + odsState.getOrAddProperties().sym_name = sym_name; + (void)odsState.addRegion(); +} + +void GlobalConstructorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name) { + odsState.getOrAddProperties().sym_name = sym_name; + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalConstructorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + (void)odsState.addRegion(); +} + +void GlobalConstructorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalConstructorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalConstructorOp::verifyInvariantsImpl() { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalConstructorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GlobalConstructorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + return ::mlir::success(); +} + +void GlobalConstructorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::GlobalConstructorOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::GlobalDestructorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GlobalDestructorOpGenericAdaptorBase::GlobalDestructorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.global_dtor", odsAttrs.getContext()); +} + +GlobalDestructorOpGenericAdaptorBase::GlobalDestructorOpGenericAdaptorBase(GlobalDestructorOp op) : GlobalDestructorOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GlobalDestructorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GlobalDestructorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr GlobalDestructorOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef GlobalDestructorOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::Region &GlobalDestructorOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange GlobalDestructorOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +GlobalDestructorOpAdaptor::GlobalDestructorOpAdaptor(GlobalDestructorOp op) : GlobalDestructorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GlobalDestructorOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'acc.global_dtor' op ""requires attribute 'sym_name'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'acc.global_dtor' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair GlobalDestructorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GlobalDestructorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair GlobalDestructorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GlobalDestructorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &GlobalDestructorOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult GlobalDestructorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GlobalDestructorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GlobalDestructorOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.sym_name.getAsOpaquePointer())); +} + +std::optional GlobalDestructorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "sym_name") + return prop.sym_name; + return std::nullopt; +} + +void GlobalDestructorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GlobalDestructorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); +} + +::mlir::LogicalResult GlobalDestructorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalDestructorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GlobalDestructorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.sym_name); +} + +::mlir::StringAttr GlobalDestructorOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef GlobalDestructorOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +void GlobalDestructorOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void GlobalDestructorOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void GlobalDestructorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name) { + odsState.getOrAddProperties().sym_name = sym_name; + (void)odsState.addRegion(); +} + +void GlobalDestructorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name) { + odsState.getOrAddProperties().sym_name = sym_name; + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalDestructorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + (void)odsState.addRegion(); +} + +void GlobalDestructorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GlobalDestructorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GlobalDestructorOp::verifyInvariantsImpl() { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GlobalDestructorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GlobalDestructorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + return ::mlir::success(); +} + +void GlobalDestructorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::GlobalDestructorOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::HostDataOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +HostDataOpGenericAdaptorBase::HostDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.host_data", odsAttrs.getContext()); +} + +HostDataOpGenericAdaptorBase::HostDataOpGenericAdaptorBase(HostDataOp op) : HostDataOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair HostDataOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr HostDataOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr HostDataOpGenericAdaptorBase::getIfPresentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().ifPresent); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool HostDataOpGenericAdaptorBase::getIfPresent() { + auto attr = getIfPresentAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Region &HostDataOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange HostDataOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +HostDataOpAdaptor::HostDataOpAdaptor(HostDataOp op) : HostDataOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult HostDataOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_ifPresent = getProperties().ifPresent; (void)tblgen_ifPresent; + + if (tblgen_ifPresent && !((::llvm::isa<::mlir::UnitAttr>(tblgen_ifPresent)))) + return emitError(loc, "'acc.host_data' op ""attribute 'ifPresent' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair HostDataOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range HostDataOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> HostDataOp::getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range HostDataOp::getDataClauseOperands() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange HostDataOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange HostDataOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair HostDataOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range HostDataOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &HostDataOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult HostDataOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.ifPresent; + auto attr = dict.get("ifPresent"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for ifPresent in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `ifPresent` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute HostDataOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.ifPresent; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("ifPresent", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code HostDataOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.ifPresent.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional HostDataOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "ifPresent") + return prop.ifPresent; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void HostDataOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "ifPresent") { + prop.ifPresent = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void HostDataOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.ifPresent) attrs.append("ifPresent", prop.ifPresent); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult HostDataOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIfPresentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "ifPresent", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult HostDataOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.ifPresent))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void HostDataOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.ifPresent); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr HostDataOp::getIfPresentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().ifPresent); +} + +bool HostDataOp::getIfPresent() { + auto attr = getIfPresentAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void HostDataOp::setIfPresentAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getIfPresentAttrName(), attr); +} + +void HostDataOp::setIfPresent(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getIfPresentAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getIfPresentAttrName()); +} + +::mlir::Attribute HostDataOp::removeIfPresentAttr() { + auto &attr = getProperties().ifPresent; + attr = {}; + return attr; +} + +void HostDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent) { + if (ifCond) + odsState.addOperands(ifCond); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (ifPresent) { + odsState.getOrAddProperties().ifPresent = ifPresent; + } + (void)odsState.addRegion(); +} + +void HostDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent) { + if (ifCond) + odsState.addOperands(ifCond); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (ifPresent) { + odsState.getOrAddProperties().ifPresent = ifPresent; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void HostDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent) { + if (ifCond) + odsState.addOperands(ifCond); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (ifPresent) { + odsState.getOrAddProperties().ifPresent = ((ifPresent) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); +} + +void HostDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent) { + if (ifCond) + odsState.addOperands(ifCond); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (ifPresent) { + odsState.getOrAddProperties().ifPresent = ((ifPresent) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void HostDataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult HostDataOp::verifyInvariantsImpl() { + auto tblgen_ifPresent = getProperties().ifPresent; (void)tblgen_ifPresent; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_ifPresent, "ifPresent"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult HostDataOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult HostDataOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool ifClause = false; + bool dataOperandsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(ifCondOperands.size()), static_cast(dataClauseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void HostDataOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getIfPresentAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("ifPresent"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::HostDataOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::InitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +InitOpGenericAdaptorBase::InitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.init", odsAttrs.getContext()); +} + +InitOpGenericAdaptorBase::InitOpGenericAdaptorBase(InitOp op) : InitOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair InitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr InitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +InitOpAdaptor::InitOpAdaptor(InitOp op) : InitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult InitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair InitOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range InitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range InitOp::getDeviceTypeOperands() { + return getODSOperands(0); +} + +::mlir::Value InitOp::getDeviceNumOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> InitOp::getIfCond() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::MutableOperandRange InitOp::getDeviceTypeOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange InitOp::getDeviceNumOperandMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange InitOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair InitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range InitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult InitOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute InitOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code InitOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional InitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void InitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void InitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult InitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult InitOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void InitOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void InitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange deviceTypeOperands, /*optional*/::mlir::Value deviceNumOperand, /*optional*/::mlir::Value ifCond) { + odsState.addOperands(deviceTypeOperands); + if (deviceNumOperand) + odsState.addOperands(deviceNumOperand); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({static_cast(deviceTypeOperands.size()), (deviceNumOperand ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); +} + +void InitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange deviceTypeOperands, /*optional*/::mlir::Value deviceNumOperand, /*optional*/::mlir::Value ifCond) { + odsState.addOperands(deviceTypeOperands); + if (deviceNumOperand) + odsState.addOperands(deviceNumOperand); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({static_cast(deviceTypeOperands.size()), (deviceNumOperand ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void InitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult InitOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult InitOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult InitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceTypeOperandsOperands; + ::llvm::SMLoc deviceTypeOperandsOperandsLoc; + (void)deviceTypeOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceTypeOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceNumOperandOperands; + ::llvm::SMLoc deviceNumOperandOperandsLoc; + (void)deviceNumOperandOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceNumOperandTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + bool device_typeClause = false; + bool device_numClause = false; + bool ifClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("device_type"))) { + + if (device_typeClause) { + return parser.emitError(parser.getNameLoc()) + << "`device_type` clause can appear at most once in the expansion of the " + "oilist directive"; + } + device_typeClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + deviceTypeOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(deviceTypeOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(deviceTypeOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("device_num"))) { + + if (device_numClause) { + return parser.emitError(parser.getNameLoc()) + << "`device_num` clause can appear at most once in the expansion of the " + "oilist directive"; + } + device_numClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + deviceNumOperandOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceNumOperandOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceNumOperandTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(deviceTypeOperandsOperands.size()), static_cast(deviceNumOperandOperands.size()), static_cast(ifCondOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(deviceTypeOperandsOperands, deviceTypeOperandsTypes, deviceTypeOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(deviceNumOperandOperands, deviceNumOperandTypes, deviceNumOperandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void InitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getDeviceTypeOperands().size()) { + _odsPrinter << ' ' << "device_type"; + _odsPrinter << "("; + _odsPrinter << getDeviceTypeOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDeviceTypeOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getDeviceNumOperand()) { + _odsPrinter << ' ' << "device_num"; + _odsPrinter << "("; + if (::mlir::Value value = getDeviceNumOperand()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getDeviceNumOperand() ? ::llvm::ArrayRef<::mlir::Type>(getDeviceNumOperand().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::InitOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::KernelsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +KernelsOpGenericAdaptorBase::KernelsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.kernels", odsAttrs.getContext()); +} + +KernelsOpGenericAdaptorBase::KernelsOpGenericAdaptorBase(KernelsOp op) : KernelsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair KernelsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr KernelsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr KernelsOpGenericAdaptorBase::getAsyncAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().asyncAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool KernelsOpGenericAdaptorBase::getAsyncAttr() { + auto attr = getAsyncAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr KernelsOpGenericAdaptorBase::getWaitAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().waitAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool KernelsOpGenericAdaptorBase::getWaitAttr() { + auto attr = getWaitAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr KernelsOpGenericAdaptorBase::getSelfAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().selfAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool KernelsOpGenericAdaptorBase::getSelfAttr() { + auto attr = getSelfAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::acc::ClauseDefaultValueAttr KernelsOpGenericAdaptorBase::getDefaultAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); + return attr; +} + +::std::optional<::mlir::acc::ClauseDefaultValue> KernelsOpGenericAdaptorBase::getDefaultAttr() { + auto attr = getDefaultAttrAttr(); + return attr ? ::std::optional<::mlir::acc::ClauseDefaultValue>(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &KernelsOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange KernelsOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +KernelsOpAdaptor::KernelsOpAdaptor(KernelsOp op) : KernelsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult KernelsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_asyncAttr = getProperties().asyncAttr; (void)tblgen_asyncAttr; + auto tblgen_defaultAttr = getProperties().defaultAttr; (void)tblgen_defaultAttr; + auto tblgen_selfAttr = getProperties().selfAttr; (void)tblgen_selfAttr; + auto tblgen_waitAttr = getProperties().waitAttr; (void)tblgen_waitAttr; + + if (tblgen_asyncAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_asyncAttr)))) + return emitError(loc, "'acc.kernels' op ""attribute 'asyncAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_waitAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_waitAttr)))) + return emitError(loc, "'acc.kernels' op ""attribute 'waitAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_selfAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_selfAttr)))) + return emitError(loc, "'acc.kernels' op ""attribute 'selfAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_defaultAttr && !((::llvm::isa<::mlir::acc::ClauseDefaultValueAttr>(tblgen_defaultAttr)))) + return emitError(loc, "'acc.kernels' op ""attribute 'defaultAttr' failed to satisfy constraint: DefaultValue Clause"); + return ::mlir::success(); +} + +std::pair KernelsOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range KernelsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value KernelsOp::getAsync() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range KernelsOp::getWaitOperands() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range KernelsOp::getNumGangs() { + return getODSOperands(2); +} + +::mlir::Value KernelsOp::getNumWorkers() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value KernelsOp::getVectorLength() { + auto operands = getODSOperands(4); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> KernelsOp::getIfCond() { + auto operands = getODSOperands(5); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> KernelsOp::getSelfCond() { + auto operands = getODSOperands(6); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range KernelsOp::getDataClauseOperands() { + return getODSOperands(7); +} + +::mlir::MutableOperandRange KernelsOp::getAsyncMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange KernelsOp::getWaitOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange KernelsOp::getNumGangsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange KernelsOp::getNumWorkersMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange KernelsOp::getVectorLengthMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange KernelsOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange KernelsOp::getSelfCondMutable() { + auto range = getODSOperandIndexAndLength(6); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange KernelsOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(7); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(7u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair KernelsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range KernelsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &KernelsOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult KernelsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.asyncAttr; + auto attr = dict.get("asyncAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for asyncAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `asyncAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.defaultAttr; + auto attr = dict.get("defaultAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for defaultAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `defaultAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.selfAttr; + auto attr = dict.get("selfAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for selfAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `selfAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.waitAttr; + auto attr = dict.get("waitAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for waitAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `waitAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute KernelsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.asyncAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("asyncAttr", + propStorage)); + } + + { + const auto &propStorage = prop.defaultAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("defaultAttr", + propStorage)); + } + + { + const auto &propStorage = prop.selfAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("selfAttr", + propStorage)); + } + + { + const auto &propStorage = prop.waitAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("waitAttr", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code KernelsOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.asyncAttr.getAsOpaquePointer()), + llvm::hash_value(prop.defaultAttr.getAsOpaquePointer()), + llvm::hash_value(prop.selfAttr.getAsOpaquePointer()), + llvm::hash_value(prop.waitAttr.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional KernelsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "asyncAttr") + return prop.asyncAttr; + + if (name == "defaultAttr") + return prop.defaultAttr; + + if (name == "selfAttr") + return prop.selfAttr; + + if (name == "waitAttr") + return prop.waitAttr; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void KernelsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "asyncAttr") { + prop.asyncAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "defaultAttr") { + prop.defaultAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "selfAttr") { + prop.selfAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "waitAttr") { + prop.waitAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void KernelsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.asyncAttr) attrs.append("asyncAttr", prop.asyncAttr); + + if (prop.defaultAttr) attrs.append("defaultAttr", prop.defaultAttr); + + if (prop.selfAttr) attrs.append("selfAttr", prop.selfAttr); + + if (prop.waitAttr) attrs.append("waitAttr", prop.waitAttr); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult KernelsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAsyncAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "asyncAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getDefaultAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps5(attr, "defaultAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSelfAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "selfAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWaitAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "waitAttr", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult KernelsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.asyncAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.defaultAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.selfAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.waitAttr))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void KernelsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.asyncAttr); + + writer.writeOptionalAttribute(prop.defaultAttr); + + writer.writeOptionalAttribute(prop.selfAttr); + + writer.writeOptionalAttribute(prop.waitAttr); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr KernelsOp::getAsyncAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().asyncAttr); +} + +bool KernelsOp::getAsyncAttr() { + auto attr = getAsyncAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr KernelsOp::getWaitAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().waitAttr); +} + +bool KernelsOp::getWaitAttr() { + auto attr = getWaitAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr KernelsOp::getSelfAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().selfAttr); +} + +bool KernelsOp::getSelfAttr() { + auto attr = getSelfAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::acc::ClauseDefaultValueAttr KernelsOp::getDefaultAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); +} + +::std::optional<::mlir::acc::ClauseDefaultValue> KernelsOp::getDefaultAttr() { + auto attr = getDefaultAttrAttr(); + return attr ? ::std::optional<::mlir::acc::ClauseDefaultValue>(attr.getValue()) : (::std::nullopt); +} + +void KernelsOp::setAsyncAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getAsyncAttrAttrName(), attr); +} + +void KernelsOp::setAsyncAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getAsyncAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getAsyncAttrAttrName()); +} + +void KernelsOp::setWaitAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWaitAttrAttrName(), attr); +} + +void KernelsOp::setWaitAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWaitAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWaitAttrAttrName()); +} + +void KernelsOp::setSelfAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getSelfAttrAttrName(), attr); +} + +void KernelsOp::setSelfAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getSelfAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getSelfAttrAttrName()); +} + +void KernelsOp::setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr) { + (*this)->setAttr(getDefaultAttrAttrName(), attr); +} + +void KernelsOp::setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue) { + if (attrValue) + return (*this)->setAttr(getDefaultAttrAttrName(), ::mlir::acc::ClauseDefaultValueAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getDefaultAttrAttrName()); +} + +::mlir::Attribute KernelsOp::removeAsyncAttrAttr() { + auto &attr = getProperties().asyncAttr; + attr = {}; + return attr; +} + +::mlir::Attribute KernelsOp::removeWaitAttrAttr() { + auto &attr = getProperties().waitAttr; + attr = {}; + return attr; +} + +::mlir::Attribute KernelsOp::removeSelfAttrAttr() { + auto &attr = getProperties().selfAttr; + attr = {}; + return attr; +} + +::mlir::Attribute KernelsOp::removeDefaultAttrAttr() { + auto &attr = getProperties().defaultAttr; + attr = {}; + return attr; +} + +void KernelsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + odsState.addOperands(numGangs); + if (numWorkers) + odsState.addOperands(numWorkers); + if (vectorLength) + odsState.addOperands(vectorLength); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), static_cast(numGangs.size()), (numWorkers ? 1 : 0), (vectorLength ? 1 : 0), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = asyncAttr; + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = waitAttr; + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = selfAttr; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); +} + +void KernelsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + odsState.addOperands(numGangs); + if (numWorkers) + odsState.addOperands(numWorkers); + if (vectorLength) + odsState.addOperands(vectorLength); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), static_cast(numGangs.size()), (numWorkers ? 1 : 0), (vectorLength ? 1 : 0), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = asyncAttr; + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = waitAttr; + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = selfAttr; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void KernelsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + odsState.addOperands(numGangs); + if (numWorkers) + odsState.addOperands(numWorkers); + if (vectorLength) + odsState.addOperands(vectorLength); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), static_cast(numGangs.size()), (numWorkers ? 1 : 0), (vectorLength ? 1 : 0), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = ((asyncAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = ((waitAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = ((selfAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); +} + +void KernelsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + odsState.addOperands(numGangs); + if (numWorkers) + odsState.addOperands(numWorkers); + if (vectorLength) + odsState.addOperands(vectorLength); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), static_cast(numGangs.size()), (numWorkers ? 1 : 0), (vectorLength ? 1 : 0), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = ((asyncAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = ((waitAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = ((selfAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void KernelsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult KernelsOp::verifyInvariantsImpl() { + auto tblgen_asyncAttr = getProperties().asyncAttr; (void)tblgen_asyncAttr; + auto tblgen_defaultAttr = getProperties().defaultAttr; (void)tblgen_defaultAttr; + auto tblgen_selfAttr = getProperties().selfAttr; (void)tblgen_selfAttr; + auto tblgen_waitAttr = getProperties().waitAttr; (void)tblgen_waitAttr; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_asyncAttr, "asyncAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_waitAttr, "waitAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_selfAttr, "selfAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps5(*this, tblgen_defaultAttr, "defaultAttr"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + if (valueGroup4.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup4.size(); + } + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + if (valueGroup5.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup5.size(); + } + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + if (valueGroup6.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup6.size(); + } + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup7 = getODSOperands(7); + + for (auto v : valueGroup7) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult KernelsOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult KernelsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncOperands; + ::llvm::SMLoc asyncOperandsLoc; + (void)asyncOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> asyncTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> numGangsOperands; + ::llvm::SMLoc numGangsOperandsLoc; + (void)numGangsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> numGangsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> numWorkersOperands; + ::llvm::SMLoc numWorkersOperandsLoc; + (void)numWorkersOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> numWorkersTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> vectorLengthOperands; + ::llvm::SMLoc vectorLengthOperandsLoc; + (void)vectorLengthOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> vectorLengthTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitOperandsOperands; + ::llvm::SMLoc waitOperandsOperandsLoc; + (void)waitOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> selfCondOperands; + ::llvm::SMLoc selfCondOperandsLoc; + (void)selfCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool dataOperandsClause = false; + bool asyncClause = false; + bool num_gangsClause = false; + bool num_workersClause = false; + bool vector_lengthClause = false; + bool waitClause = false; + bool selfClause = false; + bool ifClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("async"))) { + + if (asyncClause) { + return parser.emitError(parser.getNameLoc()) + << "`async` clause can appear at most once in the expansion of the " + "oilist directive"; + } + asyncClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + asyncOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("num_gangs"))) { + + if (num_gangsClause) { + return parser.emitError(parser.getNameLoc()) + << "`num_gangs` clause can appear at most once in the expansion of the " + "oilist directive"; + } + num_gangsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + numGangsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(numGangsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(numGangsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("num_workers"))) { + + if (num_workersClause) { + return parser.emitError(parser.getNameLoc()) + << "`num_workers` clause can appear at most once in the expansion of the " + "oilist directive"; + } + num_workersClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + numWorkersOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + numWorkersOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + numWorkersTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("vector_length"))) { + + if (vector_lengthClause) { + return parser.emitError(parser.getNameLoc()) + << "`vector_length` clause can appear at most once in the expansion of the " + "oilist directive"; + } + vector_lengthClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + vectorLengthOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + vectorLengthOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + vectorLengthTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait"))) { + + if (waitClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + waitClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + waitOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(waitOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(waitOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("self"))) { + + if (selfClause) { + return parser.emitError(parser.getNameLoc()) + << "`self` clause can appear at most once in the expansion of the " + "oilist directive"; + } + selfClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + selfCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + selfCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(asyncOperands.size()), static_cast(waitOperandsOperands.size()), static_cast(numGangsOperands.size()), static_cast(numWorkersOperands.size()), static_cast(vectorLengthOperands.size()), static_cast(ifCondOperands.size()), static_cast(selfCondOperands.size()), static_cast(dataClauseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(asyncOperands, asyncTypes, asyncOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitOperandsOperands, waitOperandsTypes, waitOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(numGangsOperands, numGangsTypes, numGangsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(numWorkersOperands, numWorkersTypes, numWorkersOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(vectorLengthOperands, vectorLengthTypes, vectorLengthOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(selfCondOperands, odsBuildableType0, selfCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void KernelsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getAsync()) { + _odsPrinter << ' ' << "async"; + _odsPrinter << "("; + if (::mlir::Value value = getAsync()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getAsync() ? ::llvm::ArrayRef<::mlir::Type>(getAsync().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getNumGangs().size()) { + _odsPrinter << ' ' << "num_gangs"; + _odsPrinter << "("; + _odsPrinter << getNumGangs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getNumGangs().getTypes(); + _odsPrinter << ")"; + } + if (false || getNumWorkers()) { + _odsPrinter << ' ' << "num_workers"; + _odsPrinter << "("; + if (::mlir::Value value = getNumWorkers()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getNumWorkers() ? ::llvm::ArrayRef<::mlir::Type>(getNumWorkers().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getVectorLength()) { + _odsPrinter << ' ' << "vector_length"; + _odsPrinter << "("; + if (::mlir::Value value = getVectorLength()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVectorLength() ? ::llvm::ArrayRef<::mlir::Type>(getVectorLength().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getWaitOperands().size()) { + _odsPrinter << ' ' << "wait"; + _odsPrinter << "("; + _odsPrinter << getWaitOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getWaitOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getSelfCond()) { + _odsPrinter << ' ' << "self"; + _odsPrinter << "("; + if (::mlir::Value value = getSelfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAsyncAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("asyncAttr"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWaitAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("waitAttr"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getSelfAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("selfAttr"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::KernelsOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::LoopOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +LoopOpGenericAdaptorBase::LoopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.loop", odsAttrs.getContext()); +} + +LoopOpGenericAdaptorBase::LoopOpGenericAdaptorBase(LoopOp op) : LoopOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair LoopOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr LoopOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr LoopOpGenericAdaptorBase::getCollapseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().collapse); + return attr; +} + +::std::optional LoopOpGenericAdaptorBase::getCollapse() { + auto attr = getCollapseAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr LoopOpGenericAdaptorBase::getSeqAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().seq); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LoopOpGenericAdaptorBase::getSeq() { + auto attr = getSeqAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOpGenericAdaptorBase::getIndependentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().independent); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LoopOpGenericAdaptorBase::getIndependent() { + auto attr = getIndependentAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOpGenericAdaptorBase::getAuto_Attr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().auto_); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LoopOpGenericAdaptorBase::getAuto_() { + auto attr = getAuto_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOpGenericAdaptorBase::getHasGangAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hasGang); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LoopOpGenericAdaptorBase::getHasGang() { + auto attr = getHasGangAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOpGenericAdaptorBase::getHasWorkerAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hasWorker); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LoopOpGenericAdaptorBase::getHasWorker() { + auto attr = getHasWorkerAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOpGenericAdaptorBase::getHasVectorAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hasVector); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool LoopOpGenericAdaptorBase::getHasVector() { + auto attr = getHasVectorAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr LoopOpGenericAdaptorBase::getPrivatizationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().privatizations); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > LoopOpGenericAdaptorBase::getPrivatizations() { + auto attr = getPrivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LoopOpGenericAdaptorBase::getReductionRecipesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductionRecipes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > LoopOpGenericAdaptorBase::getReductionRecipes() { + auto attr = getReductionRecipesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::Region &LoopOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange LoopOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +LoopOpAdaptor::LoopOpAdaptor(LoopOp op) : LoopOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult LoopOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_auto_ = getProperties().auto_; (void)tblgen_auto_; + auto tblgen_collapse = getProperties().collapse; (void)tblgen_collapse; + auto tblgen_hasGang = getProperties().hasGang; (void)tblgen_hasGang; + auto tblgen_hasVector = getProperties().hasVector; (void)tblgen_hasVector; + auto tblgen_hasWorker = getProperties().hasWorker; (void)tblgen_hasWorker; + auto tblgen_independent = getProperties().independent; (void)tblgen_independent; + auto tblgen_privatizations = getProperties().privatizations; (void)tblgen_privatizations; + auto tblgen_reductionRecipes = getProperties().reductionRecipes; (void)tblgen_reductionRecipes; + auto tblgen_seq = getProperties().seq; (void)tblgen_seq; + + if (tblgen_collapse && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_collapse))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_collapse).getType().isSignlessInteger(64))))) + return emitError(loc, "'acc.loop' op ""attribute 'collapse' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_seq && !((::llvm::isa<::mlir::UnitAttr>(tblgen_seq)))) + return emitError(loc, "'acc.loop' op ""attribute 'seq' failed to satisfy constraint: unit attribute"); + + if (tblgen_independent && !((::llvm::isa<::mlir::UnitAttr>(tblgen_independent)))) + return emitError(loc, "'acc.loop' op ""attribute 'independent' failed to satisfy constraint: unit attribute"); + + if (tblgen_auto_ && !((::llvm::isa<::mlir::UnitAttr>(tblgen_auto_)))) + return emitError(loc, "'acc.loop' op ""attribute 'auto_' failed to satisfy constraint: unit attribute"); + + if (tblgen_hasGang && !((::llvm::isa<::mlir::UnitAttr>(tblgen_hasGang)))) + return emitError(loc, "'acc.loop' op ""attribute 'hasGang' failed to satisfy constraint: unit attribute"); + + if (tblgen_hasWorker && !((::llvm::isa<::mlir::UnitAttr>(tblgen_hasWorker)))) + return emitError(loc, "'acc.loop' op ""attribute 'hasWorker' failed to satisfy constraint: unit attribute"); + + if (tblgen_hasVector && !((::llvm::isa<::mlir::UnitAttr>(tblgen_hasVector)))) + return emitError(loc, "'acc.loop' op ""attribute 'hasVector' failed to satisfy constraint: unit attribute"); + + if (tblgen_privatizations && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_privatizations))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_privatizations), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'acc.loop' op ""attribute 'privatizations' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_reductionRecipes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reductionRecipes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reductionRecipes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'acc.loop' op ""attribute 'reductionRecipes' failed to satisfy constraint: symbol ref array attribute"); + return ::mlir::success(); +} + +std::pair LoopOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range LoopOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value LoopOp::getGangNum() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value LoopOp::getGangDim() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value LoopOp::getGangStatic() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value LoopOp::getWorkerNum() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value LoopOp::getVectorLength() { + auto operands = getODSOperands(4); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range LoopOp::getTileOperands() { + return getODSOperands(5); +} + +::mlir::Operation::operand_range LoopOp::getPrivateOperands() { + return getODSOperands(6); +} + +::mlir::Operation::operand_range LoopOp::getReductionOperands() { + return getODSOperands(7); +} + +::mlir::Operation::operand_range LoopOp::getCacheOperands() { + return getODSOperands(8); +} + +::mlir::MutableOperandRange LoopOp::getGangNumMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LoopOp::getGangDimMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LoopOp::getGangStaticMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LoopOp::getWorkerNumMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LoopOp::getVectorLengthMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LoopOp::getTileOperandsMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LoopOp::getPrivateOperandsMutable() { + auto range = getODSOperandIndexAndLength(6); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LoopOp::getReductionOperandsMutable() { + auto range = getODSOperandIndexAndLength(7); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(7u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange LoopOp::getCacheOperandsMutable() { + auto range = getODSOperandIndexAndLength(8); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(8u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair LoopOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range LoopOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range LoopOp::getResults() { + return getODSResults(0); +} + +::mlir::Region &LoopOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult LoopOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.auto_; + auto attr = dict.get("auto_"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for auto_ in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `auto_` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.collapse; + auto attr = dict.get("collapse"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for collapse in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `collapse` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.hasGang; + auto attr = dict.get("hasGang"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for hasGang in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hasGang` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.hasVector; + auto attr = dict.get("hasVector"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for hasVector in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hasVector` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.hasWorker; + auto attr = dict.get("hasWorker"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for hasWorker in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hasWorker` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.independent; + auto attr = dict.get("independent"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for independent in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `independent` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.privatizations; + auto attr = dict.get("privatizations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for privatizations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `privatizations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.reductionRecipes; + auto attr = dict.get("reductionRecipes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for reductionRecipes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductionRecipes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.seq; + auto attr = dict.get("seq"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for seq in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `seq` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute LoopOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.auto_; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("auto_", + propStorage)); + } + + { + const auto &propStorage = prop.collapse; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("collapse", + propStorage)); + } + + { + const auto &propStorage = prop.hasGang; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hasGang", + propStorage)); + } + + { + const auto &propStorage = prop.hasVector; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hasVector", + propStorage)); + } + + { + const auto &propStorage = prop.hasWorker; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hasWorker", + propStorage)); + } + + { + const auto &propStorage = prop.independent; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("independent", + propStorage)); + } + + { + const auto &propStorage = prop.privatizations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("privatizations", + propStorage)); + } + + { + const auto &propStorage = prop.reductionRecipes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductionRecipes", + propStorage)); + } + + { + const auto &propStorage = prop.seq; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("seq", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code LoopOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.auto_.getAsOpaquePointer()), + llvm::hash_value(prop.collapse.getAsOpaquePointer()), + llvm::hash_value(prop.hasGang.getAsOpaquePointer()), + llvm::hash_value(prop.hasVector.getAsOpaquePointer()), + llvm::hash_value(prop.hasWorker.getAsOpaquePointer()), + llvm::hash_value(prop.independent.getAsOpaquePointer()), + llvm::hash_value(prop.privatizations.getAsOpaquePointer()), + llvm::hash_value(prop.reductionRecipes.getAsOpaquePointer()), + llvm::hash_value(prop.seq.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional LoopOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "auto_") + return prop.auto_; + + if (name == "collapse") + return prop.collapse; + + if (name == "hasGang") + return prop.hasGang; + + if (name == "hasVector") + return prop.hasVector; + + if (name == "hasWorker") + return prop.hasWorker; + + if (name == "independent") + return prop.independent; + + if (name == "privatizations") + return prop.privatizations; + + if (name == "reductionRecipes") + return prop.reductionRecipes; + + if (name == "seq") + return prop.seq; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void LoopOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "auto_") { + prop.auto_ = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "collapse") { + prop.collapse = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "hasGang") { + prop.hasGang = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "hasVector") { + prop.hasVector = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "hasWorker") { + prop.hasWorker = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "independent") { + prop.independent = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "privatizations") { + prop.privatizations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "reductionRecipes") { + prop.reductionRecipes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "seq") { + prop.seq = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void LoopOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.auto_) attrs.append("auto_", prop.auto_); + + if (prop.collapse) attrs.append("collapse", prop.collapse); + + if (prop.hasGang) attrs.append("hasGang", prop.hasGang); + + if (prop.hasVector) attrs.append("hasVector", prop.hasVector); + + if (prop.hasWorker) attrs.append("hasWorker", prop.hasWorker); + + if (prop.independent) attrs.append("independent", prop.independent); + + if (prop.privatizations) attrs.append("privatizations", prop.privatizations); + + if (prop.reductionRecipes) attrs.append("reductionRecipes", prop.reductionRecipes); + + if (prop.seq) attrs.append("seq", prop.seq); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult LoopOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAuto_AttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "auto_", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCollapseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps6(attr, "collapse", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getHasGangAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "hasGang", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getHasVectorAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "hasVector", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getHasWorkerAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "hasWorker", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIndependentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "independent", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getPrivatizationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(attr, "privatizations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReductionRecipesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(attr, "reductionRecipes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSeqAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "seq", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LoopOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.auto_))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.collapse))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.hasGang))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.hasVector))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.hasWorker))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.independent))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.privatizations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.reductionRecipes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.seq))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void LoopOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.auto_); + + writer.writeOptionalAttribute(prop.collapse); + + writer.writeOptionalAttribute(prop.hasGang); + + writer.writeOptionalAttribute(prop.hasVector); + + writer.writeOptionalAttribute(prop.hasWorker); + + writer.writeOptionalAttribute(prop.independent); + + writer.writeOptionalAttribute(prop.privatizations); + + writer.writeOptionalAttribute(prop.reductionRecipes); + + writer.writeOptionalAttribute(prop.seq); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::IntegerAttr LoopOp::getCollapseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().collapse); +} + +::std::optional LoopOp::getCollapse() { + auto attr = getCollapseAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr LoopOp::getSeqAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().seq); +} + +bool LoopOp::getSeq() { + auto attr = getSeqAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOp::getIndependentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().independent); +} + +bool LoopOp::getIndependent() { + auto attr = getIndependentAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOp::getAuto_Attr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().auto_); +} + +bool LoopOp::getAuto_() { + auto attr = getAuto_Attr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOp::getHasGangAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hasGang); +} + +bool LoopOp::getHasGang() { + auto attr = getHasGangAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOp::getHasWorkerAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hasWorker); +} + +bool LoopOp::getHasWorker() { + auto attr = getHasWorkerAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr LoopOp::getHasVectorAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().hasVector); +} + +bool LoopOp::getHasVector() { + auto attr = getHasVectorAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr LoopOp::getPrivatizationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().privatizations); +} + +::std::optional< ::mlir::ArrayAttr > LoopOp::getPrivatizations() { + auto attr = getPrivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr LoopOp::getReductionRecipesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductionRecipes); +} + +::std::optional< ::mlir::ArrayAttr > LoopOp::getReductionRecipes() { + auto attr = getReductionRecipesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void LoopOp::setCollapseAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getCollapseAttrName(), attr); +} + +void LoopOp::setCollapse(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getCollapseAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getCollapseAttrName()); +} + +void LoopOp::setSeqAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getSeqAttrName(), attr); +} + +void LoopOp::setSeq(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getSeqAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getSeqAttrName()); +} + +void LoopOp::setIndependentAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getIndependentAttrName(), attr); +} + +void LoopOp::setIndependent(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getIndependentAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getIndependentAttrName()); +} + +void LoopOp::setAuto_Attr(::mlir::UnitAttr attr) { + (*this)->setAttr(getAuto_AttrName(), attr); +} + +void LoopOp::setAuto_(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getAuto_AttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getAuto_AttrName()); +} + +void LoopOp::setHasGangAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getHasGangAttrName(), attr); +} + +void LoopOp::setHasGang(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getHasGangAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getHasGangAttrName()); +} + +void LoopOp::setHasWorkerAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getHasWorkerAttrName(), attr); +} + +void LoopOp::setHasWorker(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getHasWorkerAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getHasWorkerAttrName()); +} + +void LoopOp::setHasVectorAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getHasVectorAttrName(), attr); +} + +void LoopOp::setHasVector(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getHasVectorAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getHasVectorAttrName()); +} + +void LoopOp::setPrivatizationsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getPrivatizationsAttrName(), attr); +} + +void LoopOp::setReductionRecipesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReductionRecipesAttrName(), attr); +} + +::mlir::Attribute LoopOp::removeCollapseAttr() { + auto &attr = getProperties().collapse; + attr = {}; + return attr; +} + +::mlir::Attribute LoopOp::removeSeqAttr() { + auto &attr = getProperties().seq; + attr = {}; + return attr; +} + +::mlir::Attribute LoopOp::removeIndependentAttr() { + auto &attr = getProperties().independent; + attr = {}; + return attr; +} + +::mlir::Attribute LoopOp::removeAuto_Attr() { + auto &attr = getProperties().auto_; + attr = {}; + return attr; +} + +::mlir::Attribute LoopOp::removeHasGangAttr() { + auto &attr = getProperties().hasGang; + attr = {}; + return attr; +} + +::mlir::Attribute LoopOp::removeHasWorkerAttr() { + auto &attr = getProperties().hasWorker; + attr = {}; + return attr; +} + +::mlir::Attribute LoopOp::removeHasVectorAttr() { + auto &attr = getProperties().hasVector; + attr = {}; + return attr; +} + +::mlir::Attribute LoopOp::removePrivatizationsAttr() { + auto &attr = getProperties().privatizations; + attr = {}; + return attr; +} + +::mlir::Attribute LoopOp::removeReductionRecipesAttr() { + auto &attr = getProperties().reductionRecipes; + attr = {}; + return attr; +} + +void LoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, /*optional*/::mlir::IntegerAttr collapse, /*optional*/::mlir::Value gangNum, /*optional*/::mlir::Value gangDim, /*optional*/::mlir::Value gangStatic, /*optional*/::mlir::Value workerNum, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::UnitAttr seq, /*optional*/::mlir::UnitAttr independent, /*optional*/::mlir::UnitAttr auto_, /*optional*/::mlir::UnitAttr hasGang, /*optional*/::mlir::UnitAttr hasWorker, /*optional*/::mlir::UnitAttr hasVector, ::mlir::ValueRange tileOperands, ::mlir::ValueRange privateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange cacheOperands) { + if (gangNum) + odsState.addOperands(gangNum); + if (gangDim) + odsState.addOperands(gangDim); + if (gangStatic) + odsState.addOperands(gangStatic); + if (workerNum) + odsState.addOperands(workerNum); + if (vectorLength) + odsState.addOperands(vectorLength); + odsState.addOperands(tileOperands); + odsState.addOperands(privateOperands); + odsState.addOperands(reductionOperands); + odsState.addOperands(cacheOperands); + ::llvm::copy(::llvm::ArrayRef({(gangNum ? 1 : 0), (gangDim ? 1 : 0), (gangStatic ? 1 : 0), (workerNum ? 1 : 0), (vectorLength ? 1 : 0), static_cast(tileOperands.size()), static_cast(privateOperands.size()), static_cast(reductionOperands.size()), static_cast(cacheOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (collapse) { + odsState.getOrAddProperties().collapse = collapse; + } + if (seq) { + odsState.getOrAddProperties().seq = seq; + } + if (independent) { + odsState.getOrAddProperties().independent = independent; + } + if (auto_) { + odsState.getOrAddProperties().auto_ = auto_; + } + if (hasGang) { + odsState.getOrAddProperties().hasGang = hasGang; + } + if (hasWorker) { + odsState.getOrAddProperties().hasWorker = hasWorker; + } + if (hasVector) { + odsState.getOrAddProperties().hasVector = hasVector; + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + (void)odsState.addRegion(); + odsState.addTypes(results); +} + +void LoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, /*optional*/::mlir::IntegerAttr collapse, /*optional*/::mlir::Value gangNum, /*optional*/::mlir::Value gangDim, /*optional*/::mlir::Value gangStatic, /*optional*/::mlir::Value workerNum, /*optional*/::mlir::Value vectorLength, /*optional*/bool seq, /*optional*/bool independent, /*optional*/bool auto_, /*optional*/bool hasGang, /*optional*/bool hasWorker, /*optional*/bool hasVector, ::mlir::ValueRange tileOperands, ::mlir::ValueRange privateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange cacheOperands) { + if (gangNum) + odsState.addOperands(gangNum); + if (gangDim) + odsState.addOperands(gangDim); + if (gangStatic) + odsState.addOperands(gangStatic); + if (workerNum) + odsState.addOperands(workerNum); + if (vectorLength) + odsState.addOperands(vectorLength); + odsState.addOperands(tileOperands); + odsState.addOperands(privateOperands); + odsState.addOperands(reductionOperands); + odsState.addOperands(cacheOperands); + ::llvm::copy(::llvm::ArrayRef({(gangNum ? 1 : 0), (gangDim ? 1 : 0), (gangStatic ? 1 : 0), (workerNum ? 1 : 0), (vectorLength ? 1 : 0), static_cast(tileOperands.size()), static_cast(privateOperands.size()), static_cast(reductionOperands.size()), static_cast(cacheOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (collapse) { + odsState.getOrAddProperties().collapse = collapse; + } + if (seq) { + odsState.getOrAddProperties().seq = ((seq) ? odsBuilder.getUnitAttr() : nullptr); + } + if (independent) { + odsState.getOrAddProperties().independent = ((independent) ? odsBuilder.getUnitAttr() : nullptr); + } + if (auto_) { + odsState.getOrAddProperties().auto_ = ((auto_) ? odsBuilder.getUnitAttr() : nullptr); + } + if (hasGang) { + odsState.getOrAddProperties().hasGang = ((hasGang) ? odsBuilder.getUnitAttr() : nullptr); + } + if (hasWorker) { + odsState.getOrAddProperties().hasWorker = ((hasWorker) ? odsBuilder.getUnitAttr() : nullptr); + } + if (hasVector) { + odsState.getOrAddProperties().hasVector = ((hasVector) ? odsBuilder.getUnitAttr() : nullptr); + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + (void)odsState.addRegion(); + odsState.addTypes(results); +} + +void LoopOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult LoopOp::verifyInvariantsImpl() { + auto tblgen_auto_ = getProperties().auto_; (void)tblgen_auto_; + auto tblgen_collapse = getProperties().collapse; (void)tblgen_collapse; + auto tblgen_hasGang = getProperties().hasGang; (void)tblgen_hasGang; + auto tblgen_hasVector = getProperties().hasVector; (void)tblgen_hasVector; + auto tblgen_hasWorker = getProperties().hasWorker; (void)tblgen_hasWorker; + auto tblgen_independent = getProperties().independent; (void)tblgen_independent; + auto tblgen_privatizations = getProperties().privatizations; (void)tblgen_privatizations; + auto tblgen_reductionRecipes = getProperties().reductionRecipes; (void)tblgen_reductionRecipes; + auto tblgen_seq = getProperties().seq; (void)tblgen_seq; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps6(*this, tblgen_collapse, "collapse"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_seq, "seq"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_independent, "independent"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_auto_, "auto_"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_hasGang, "hasGang"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_hasWorker, "hasWorker"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_hasVector, "hasVector"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(*this, tblgen_privatizations, "privatizations"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(*this, tblgen_reductionRecipes, "reductionRecipes"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + if (valueGroup4.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup4.size(); + } + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup7 = getODSOperands(7); + + for (auto v : valueGroup7) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup8 = getODSOperands(8); + + for (auto v : valueGroup8) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult LoopOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult LoopOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> gangNumOperands; + ::llvm::SMLoc gangNumOperandsLoc; + (void)gangNumOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> gangNumTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> gangDimOperands; + ::llvm::SMLoc gangDimOperandsLoc; + (void)gangDimOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> gangDimTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> gangStaticOperands; + ::llvm::SMLoc gangStaticOperandsLoc; + (void)gangStaticOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> gangStaticTypes; + ::mlir::UnitAttr hasGangAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> workerNumOperands; + ::llvm::SMLoc workerNumOperandsLoc; + (void)workerNumOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> workerNumTypes; + ::mlir::UnitAttr hasWorkerAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> vectorLengthOperands; + ::llvm::SMLoc vectorLengthOperandsLoc; + (void)vectorLengthOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> vectorLengthTypes; + ::mlir::UnitAttr hasVectorAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> privateOperandsOperands; + ::llvm::SMLoc privateOperandsOperandsLoc; + (void)privateOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> privateOperandsTypes; + ::mlir::ArrayAttr privatizationsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> tileOperandsOperands; + ::llvm::SMLoc tileOperandsOperandsLoc; + (void)tileOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> tileOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> reductionOperandsOperands; + ::llvm::SMLoc reductionOperandsOperandsLoc; + (void)reductionOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> reductionOperandsTypes; + ::mlir::ArrayAttr reductionRecipesAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cacheOperandsOperands; + ::llvm::SMLoc cacheOperandsOperandsLoc; + (void)cacheOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> cacheOperandsTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + ::llvm::SmallVector<::mlir::Type, 1> resultsTypes; + bool gangClause = false; + bool workerClause = false; + bool vectorClause = false; + bool privateClause = false; + bool tileClause = false; + bool reductionClause = false; + bool cacheClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("gang"))) { + + if (gangClause) { + return parser.emitError(parser.getNameLoc()) + << "`gang` clause can appear at most once in the expansion of the " + "oilist directive"; + } + gangClause = true; + { + gangNumOperandsLoc = parser.getCurrentLocation(); + ::std::optional<::mlir::OpAsmParser::UnresolvedOperand> gangNumOperand; + ::mlir::Type gangNumType; + gangDimOperandsLoc = parser.getCurrentLocation(); + ::std::optional<::mlir::OpAsmParser::UnresolvedOperand> gangDimOperand; + ::mlir::Type gangDimType; + gangStaticOperandsLoc = parser.getCurrentLocation(); + ::std::optional<::mlir::OpAsmParser::UnresolvedOperand> gangStaticOperand; + ::mlir::Type gangStaticType; + auto odsResult = parseGangClause(parser, gangNumOperand, gangNumType, gangDimOperand, gangDimType, gangStaticOperand, gangStaticType, hasGangAttr); + if (odsResult) return ::mlir::failure(); + if (gangNumOperand.has_value()) + gangNumOperands.push_back(*gangNumOperand); + if (gangNumType) + gangNumTypes.push_back(gangNumType); + if (gangDimOperand.has_value()) + gangDimOperands.push_back(*gangDimOperand); + if (gangDimType) + gangDimTypes.push_back(gangDimType); + if (gangStaticOperand.has_value()) + gangStaticOperands.push_back(*gangStaticOperand); + if (gangStaticType) + gangStaticTypes.push_back(gangStaticType); + if (hasGangAttr) + result.getOrAddProperties().hasGang = hasGangAttr; + } + } else if (succeeded(parser.parseOptionalKeyword("worker"))) { + + if (workerClause) { + return parser.emitError(parser.getNameLoc()) + << "`worker` clause can appear at most once in the expansion of the " + "oilist directive"; + } + workerClause = true; + { + workerNumOperandsLoc = parser.getCurrentLocation(); + ::std::optional<::mlir::OpAsmParser::UnresolvedOperand> workerNumOperand; + ::mlir::Type workerNumType; + auto odsResult = parseWorkerClause(parser, workerNumOperand, workerNumType, hasWorkerAttr); + if (odsResult) return ::mlir::failure(); + if (workerNumOperand.has_value()) + workerNumOperands.push_back(*workerNumOperand); + if (workerNumType) + workerNumTypes.push_back(workerNumType); + if (hasWorkerAttr) + result.getOrAddProperties().hasWorker = hasWorkerAttr; + } + } else if (succeeded(parser.parseOptionalKeyword("vector"))) { + + if (vectorClause) { + return parser.emitError(parser.getNameLoc()) + << "`vector` clause can appear at most once in the expansion of the " + "oilist directive"; + } + vectorClause = true; + { + vectorLengthOperandsLoc = parser.getCurrentLocation(); + ::std::optional<::mlir::OpAsmParser::UnresolvedOperand> vectorLengthOperand; + ::mlir::Type vectorLengthType; + auto odsResult = parseVectorClause(parser, vectorLengthOperand, vectorLengthType, hasVectorAttr); + if (odsResult) return ::mlir::failure(); + if (vectorLengthOperand.has_value()) + vectorLengthOperands.push_back(*vectorLengthOperand); + if (vectorLengthType) + vectorLengthTypes.push_back(vectorLengthType); + if (hasVectorAttr) + result.getOrAddProperties().hasVector = hasVectorAttr; + } + } else if (succeeded(parser.parseOptionalKeyword("private"))) { + + if (privateClause) { + return parser.emitError(parser.getNameLoc()) + << "`private` clause can appear at most once in the expansion of the " + "oilist directive"; + } + privateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + privateOperandsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseSymOperandList(parser, privateOperandsOperands, privateOperandsTypes, privatizationsAttr); + if (odsResult) return ::mlir::failure(); + if (privatizationsAttr) + result.getOrAddProperties().privatizations = privatizationsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("tile"))) { + + if (tileClause) { + return parser.emitError(parser.getNameLoc()) + << "`tile` clause can appear at most once in the expansion of the " + "oilist directive"; + } + tileClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + tileOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(tileOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(tileOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("reduction"))) { + + if (reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + reductionOperandsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseSymOperandList(parser, reductionOperandsOperands, reductionOperandsTypes, reductionRecipesAttr); + if (odsResult) return ::mlir::failure(); + if (reductionRecipesAttr) + result.getOrAddProperties().reductionRecipes = reductionRecipesAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("cache"))) { + + if (cacheClause) { + return parser.emitError(parser.getNameLoc()) + << "`cache` clause can appear at most once in the expansion of the " + "oilist directive"; + } + cacheClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + cacheOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(cacheOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(cacheOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + if (parser.parseTypeList(resultsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(gangNumOperands.size()), static_cast(gangDimOperands.size()), static_cast(gangStaticOperands.size()), static_cast(workerNumOperands.size()), static_cast(vectorLengthOperands.size()), static_cast(tileOperandsOperands.size()), static_cast(privateOperandsOperands.size()), static_cast(reductionOperandsOperands.size()), static_cast(cacheOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + result.addTypes(resultsTypes); + if (parser.resolveOperands(gangNumOperands, gangNumTypes, gangNumOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(gangDimOperands, gangDimTypes, gangDimOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(gangStaticOperands, gangStaticTypes, gangStaticOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(workerNumOperands, workerNumTypes, workerNumOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(vectorLengthOperands, vectorLengthTypes, vectorLengthOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(tileOperandsOperands, tileOperandsTypes, tileOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(privateOperandsOperands, privateOperandsTypes, privateOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(reductionOperandsOperands, reductionOperandsTypes, reductionOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(cacheOperandsOperands, cacheOperandsTypes, cacheOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void LoopOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getGangNum() || getGangDim() || getGangStatic() || getHasGangAttr()) { + _odsPrinter << ' ' << "gang"; + printGangClause(_odsPrinter, *this, getGangNum(), (getGangNum() ? getGangNum().getType() : ::mlir::Type()), getGangDim(), (getGangDim() ? getGangDim().getType() : ::mlir::Type()), getGangStatic(), (getGangStatic() ? getGangStatic().getType() : ::mlir::Type()), getHasGangAttr()); + } + if (false || getWorkerNum() || getHasWorkerAttr()) { + _odsPrinter << ' ' << "worker"; + printWorkerClause(_odsPrinter, *this, getWorkerNum(), (getWorkerNum() ? getWorkerNum().getType() : ::mlir::Type()), getHasWorkerAttr()); + } + if (false || getVectorLength() || getHasVectorAttr()) { + _odsPrinter << ' ' << "vector"; + printVectorClause(_odsPrinter, *this, getVectorLength(), (getVectorLength() ? getVectorLength().getType() : ::mlir::Type()), getHasVectorAttr()); + } + if (false || getPrivateOperands().size() || getPrivatizationsAttr()) { + _odsPrinter << ' ' << "private"; + _odsPrinter << "("; + printSymOperandList(_odsPrinter, *this, getPrivateOperands(), getPrivateOperands().getTypes(), getPrivatizationsAttr()); + _odsPrinter << ")"; + } + if (false || getTileOperands().size()) { + _odsPrinter << ' ' << "tile"; + _odsPrinter << "("; + _odsPrinter << getTileOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getTileOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getReductionOperands().size() || getReductionRecipesAttr()) { + _odsPrinter << ' ' << "reduction"; + _odsPrinter << "("; + printSymOperandList(_odsPrinter, *this, getReductionOperands(), getReductionOperands().getTypes(), getReductionRecipesAttr()); + _odsPrinter << ")"; + } + if (false || getCacheOperands().size()) { + _odsPrinter << ' ' << "cache"; + _odsPrinter << "("; + _odsPrinter << getCacheOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getCacheOperands().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + if (!getResults().empty()) { + _odsPrinter << "("; + _odsPrinter << getResults().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("hasGang"); + elidedAttrs.push_back("hasWorker"); + elidedAttrs.push_back("hasVector"); + elidedAttrs.push_back("privatizations"); + elidedAttrs.push_back("reductionRecipes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getSeqAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("seq"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getIndependentAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("independent"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAuto_Attr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("auto_"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHasGangAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("hasGang"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHasWorkerAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("hasWorker"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHasVectorAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("hasVector"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::LoopOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::NoCreateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +NoCreateOpGenericAdaptorBase::NoCreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.nocreate", odsAttrs.getContext()); +} + +NoCreateOpGenericAdaptorBase::NoCreateOpGenericAdaptorBase(NoCreateOp op) : NoCreateOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair NoCreateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr NoCreateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr NoCreateOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause NoCreateOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr NoCreateOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool NoCreateOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr NoCreateOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool NoCreateOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr NoCreateOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > NoCreateOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +NoCreateOpAdaptor::NoCreateOpAdaptor(NoCreateOp op) : NoCreateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult NoCreateOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.nocreate' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.nocreate' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.nocreate' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.nocreate' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair NoCreateOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range NoCreateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> NoCreateOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> NoCreateOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range NoCreateOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &NoCreateOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange NoCreateOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange NoCreateOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair NoCreateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range NoCreateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> NoCreateOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult NoCreateOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute NoCreateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code NoCreateOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional NoCreateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void NoCreateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void NoCreateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult NoCreateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult NoCreateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void NoCreateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr NoCreateOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause NoCreateOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr NoCreateOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool NoCreateOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr NoCreateOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool NoCreateOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr NoCreateOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > NoCreateOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void NoCreateOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void NoCreateOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void NoCreateOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void NoCreateOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void NoCreateOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void NoCreateOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void NoCreateOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void NoCreateOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute NoCreateOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void NoCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void NoCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NoCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void NoCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void NoCreateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void NoCreateOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_no_create); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult NoCreateOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult NoCreateOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult NoCreateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void NoCreateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_no_create))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::NoCreateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ParallelOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ParallelOpGenericAdaptorBase::ParallelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.parallel", odsAttrs.getContext()); +} + +ParallelOpGenericAdaptorBase::ParallelOpGenericAdaptorBase(ParallelOp op) : ParallelOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ParallelOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ParallelOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr ParallelOpGenericAdaptorBase::getAsyncAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().asyncAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ParallelOpGenericAdaptorBase::getAsyncAttr() { + auto attr = getAsyncAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ParallelOpGenericAdaptorBase::getWaitAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().waitAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ParallelOpGenericAdaptorBase::getWaitAttr() { + auto attr = getWaitAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ParallelOpGenericAdaptorBase::getSelfAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().selfAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ParallelOpGenericAdaptorBase::getSelfAttr() { + auto attr = getSelfAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr ParallelOpGenericAdaptorBase::getReductionRecipesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductionRecipes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > ParallelOpGenericAdaptorBase::getReductionRecipes() { + auto attr = getReductionRecipesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr ParallelOpGenericAdaptorBase::getPrivatizationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().privatizations); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > ParallelOpGenericAdaptorBase::getPrivatizations() { + auto attr = getPrivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr ParallelOpGenericAdaptorBase::getFirstprivatizationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().firstprivatizations); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > ParallelOpGenericAdaptorBase::getFirstprivatizations() { + auto attr = getFirstprivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::acc::ClauseDefaultValueAttr ParallelOpGenericAdaptorBase::getDefaultAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); + return attr; +} + +::std::optional<::mlir::acc::ClauseDefaultValue> ParallelOpGenericAdaptorBase::getDefaultAttr() { + auto attr = getDefaultAttrAttr(); + return attr ? ::std::optional<::mlir::acc::ClauseDefaultValue>(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &ParallelOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange ParallelOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ParallelOpAdaptor::ParallelOpAdaptor(ParallelOp op) : ParallelOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ParallelOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_asyncAttr = getProperties().asyncAttr; (void)tblgen_asyncAttr; + auto tblgen_defaultAttr = getProperties().defaultAttr; (void)tblgen_defaultAttr; + auto tblgen_firstprivatizations = getProperties().firstprivatizations; (void)tblgen_firstprivatizations; + auto tblgen_privatizations = getProperties().privatizations; (void)tblgen_privatizations; + auto tblgen_reductionRecipes = getProperties().reductionRecipes; (void)tblgen_reductionRecipes; + auto tblgen_selfAttr = getProperties().selfAttr; (void)tblgen_selfAttr; + auto tblgen_waitAttr = getProperties().waitAttr; (void)tblgen_waitAttr; + + if (tblgen_asyncAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_asyncAttr)))) + return emitError(loc, "'acc.parallel' op ""attribute 'asyncAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_waitAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_waitAttr)))) + return emitError(loc, "'acc.parallel' op ""attribute 'waitAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_selfAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_selfAttr)))) + return emitError(loc, "'acc.parallel' op ""attribute 'selfAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_reductionRecipes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reductionRecipes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reductionRecipes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'acc.parallel' op ""attribute 'reductionRecipes' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_privatizations && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_privatizations))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_privatizations), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'acc.parallel' op ""attribute 'privatizations' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_firstprivatizations && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_firstprivatizations))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_firstprivatizations), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'acc.parallel' op ""attribute 'firstprivatizations' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_defaultAttr && !((::llvm::isa<::mlir::acc::ClauseDefaultValueAttr>(tblgen_defaultAttr)))) + return emitError(loc, "'acc.parallel' op ""attribute 'defaultAttr' failed to satisfy constraint: DefaultValue Clause"); + return ::mlir::success(); +} + +std::pair ParallelOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ParallelOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ParallelOp::getAsync() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range ParallelOp::getWaitOperands() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range ParallelOp::getNumGangs() { + return getODSOperands(2); +} + +::mlir::Value ParallelOp::getNumWorkers() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value ParallelOp::getVectorLength() { + auto operands = getODSOperands(4); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ParallelOp::getIfCond() { + auto operands = getODSOperands(5); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ParallelOp::getSelfCond() { + auto operands = getODSOperands(6); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range ParallelOp::getReductionOperands() { + return getODSOperands(7); +} + +::mlir::Operation::operand_range ParallelOp::getGangPrivateOperands() { + return getODSOperands(8); +} + +::mlir::Operation::operand_range ParallelOp::getGangFirstPrivateOperands() { + return getODSOperands(9); +} + +::mlir::Operation::operand_range ParallelOp::getDataClauseOperands() { + return getODSOperands(10); +} + +::mlir::MutableOperandRange ParallelOp::getAsyncMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getWaitOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getNumGangsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getNumWorkersMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getVectorLengthMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getSelfCondMutable() { + auto range = getODSOperandIndexAndLength(6); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getReductionOperandsMutable() { + auto range = getODSOperandIndexAndLength(7); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(7u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getGangPrivateOperandsMutable() { + auto range = getODSOperandIndexAndLength(8); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(8u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getGangFirstPrivateOperandsMutable() { + auto range = getODSOperandIndexAndLength(9); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(9u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(10); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(10u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ParallelOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ParallelOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &ParallelOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult ParallelOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.asyncAttr; + auto attr = dict.get("asyncAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for asyncAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `asyncAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.defaultAttr; + auto attr = dict.get("defaultAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for defaultAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `defaultAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.firstprivatizations; + auto attr = dict.get("firstprivatizations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for firstprivatizations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `firstprivatizations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.privatizations; + auto attr = dict.get("privatizations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for privatizations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `privatizations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.reductionRecipes; + auto attr = dict.get("reductionRecipes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for reductionRecipes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductionRecipes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.selfAttr; + auto attr = dict.get("selfAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for selfAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `selfAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.waitAttr; + auto attr = dict.get("waitAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for waitAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `waitAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ParallelOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.asyncAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("asyncAttr", + propStorage)); + } + + { + const auto &propStorage = prop.defaultAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("defaultAttr", + propStorage)); + } + + { + const auto &propStorage = prop.firstprivatizations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("firstprivatizations", + propStorage)); + } + + { + const auto &propStorage = prop.privatizations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("privatizations", + propStorage)); + } + + { + const auto &propStorage = prop.reductionRecipes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductionRecipes", + propStorage)); + } + + { + const auto &propStorage = prop.selfAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("selfAttr", + propStorage)); + } + + { + const auto &propStorage = prop.waitAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("waitAttr", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ParallelOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.asyncAttr.getAsOpaquePointer()), + llvm::hash_value(prop.defaultAttr.getAsOpaquePointer()), + llvm::hash_value(prop.firstprivatizations.getAsOpaquePointer()), + llvm::hash_value(prop.privatizations.getAsOpaquePointer()), + llvm::hash_value(prop.reductionRecipes.getAsOpaquePointer()), + llvm::hash_value(prop.selfAttr.getAsOpaquePointer()), + llvm::hash_value(prop.waitAttr.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ParallelOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "asyncAttr") + return prop.asyncAttr; + + if (name == "defaultAttr") + return prop.defaultAttr; + + if (name == "firstprivatizations") + return prop.firstprivatizations; + + if (name == "privatizations") + return prop.privatizations; + + if (name == "reductionRecipes") + return prop.reductionRecipes; + + if (name == "selfAttr") + return prop.selfAttr; + + if (name == "waitAttr") + return prop.waitAttr; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ParallelOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "asyncAttr") { + prop.asyncAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "defaultAttr") { + prop.defaultAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "firstprivatizations") { + prop.firstprivatizations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "privatizations") { + prop.privatizations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "reductionRecipes") { + prop.reductionRecipes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "selfAttr") { + prop.selfAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "waitAttr") { + prop.waitAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ParallelOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.asyncAttr) attrs.append("asyncAttr", prop.asyncAttr); + + if (prop.defaultAttr) attrs.append("defaultAttr", prop.defaultAttr); + + if (prop.firstprivatizations) attrs.append("firstprivatizations", prop.firstprivatizations); + + if (prop.privatizations) attrs.append("privatizations", prop.privatizations); + + if (prop.reductionRecipes) attrs.append("reductionRecipes", prop.reductionRecipes); + + if (prop.selfAttr) attrs.append("selfAttr", prop.selfAttr); + + if (prop.waitAttr) attrs.append("waitAttr", prop.waitAttr); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ParallelOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAsyncAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "asyncAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getDefaultAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps5(attr, "defaultAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFirstprivatizationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(attr, "firstprivatizations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getPrivatizationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(attr, "privatizations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReductionRecipesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(attr, "reductionRecipes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSelfAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "selfAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWaitAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "waitAttr", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ParallelOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.asyncAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.defaultAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.firstprivatizations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.privatizations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.reductionRecipes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.selfAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.waitAttr))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ParallelOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.asyncAttr); + + writer.writeOptionalAttribute(prop.defaultAttr); + + writer.writeOptionalAttribute(prop.firstprivatizations); + + writer.writeOptionalAttribute(prop.privatizations); + + writer.writeOptionalAttribute(prop.reductionRecipes); + + writer.writeOptionalAttribute(prop.selfAttr); + + writer.writeOptionalAttribute(prop.waitAttr); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr ParallelOp::getAsyncAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().asyncAttr); +} + +bool ParallelOp::getAsyncAttr() { + auto attr = getAsyncAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ParallelOp::getWaitAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().waitAttr); +} + +bool ParallelOp::getWaitAttr() { + auto attr = getWaitAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr ParallelOp::getSelfAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().selfAttr); +} + +bool ParallelOp::getSelfAttr() { + auto attr = getSelfAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr ParallelOp::getReductionRecipesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductionRecipes); +} + +::std::optional< ::mlir::ArrayAttr > ParallelOp::getReductionRecipes() { + auto attr = getReductionRecipesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr ParallelOp::getPrivatizationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().privatizations); +} + +::std::optional< ::mlir::ArrayAttr > ParallelOp::getPrivatizations() { + auto attr = getPrivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr ParallelOp::getFirstprivatizationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().firstprivatizations); +} + +::std::optional< ::mlir::ArrayAttr > ParallelOp::getFirstprivatizations() { + auto attr = getFirstprivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::acc::ClauseDefaultValueAttr ParallelOp::getDefaultAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); +} + +::std::optional<::mlir::acc::ClauseDefaultValue> ParallelOp::getDefaultAttr() { + auto attr = getDefaultAttrAttr(); + return attr ? ::std::optional<::mlir::acc::ClauseDefaultValue>(attr.getValue()) : (::std::nullopt); +} + +void ParallelOp::setAsyncAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getAsyncAttrAttrName(), attr); +} + +void ParallelOp::setAsyncAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getAsyncAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getAsyncAttrAttrName()); +} + +void ParallelOp::setWaitAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWaitAttrAttrName(), attr); +} + +void ParallelOp::setWaitAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWaitAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWaitAttrAttrName()); +} + +void ParallelOp::setSelfAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getSelfAttrAttrName(), attr); +} + +void ParallelOp::setSelfAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getSelfAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getSelfAttrAttrName()); +} + +void ParallelOp::setReductionRecipesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReductionRecipesAttrName(), attr); +} + +void ParallelOp::setPrivatizationsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getPrivatizationsAttrName(), attr); +} + +void ParallelOp::setFirstprivatizationsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getFirstprivatizationsAttrName(), attr); +} + +void ParallelOp::setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr) { + (*this)->setAttr(getDefaultAttrAttrName(), attr); +} + +void ParallelOp::setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue) { + if (attrValue) + return (*this)->setAttr(getDefaultAttrAttrName(), ::mlir::acc::ClauseDefaultValueAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getDefaultAttrAttrName()); +} + +::mlir::Attribute ParallelOp::removeAsyncAttrAttr() { + auto &attr = getProperties().asyncAttr; + attr = {}; + return attr; +} + +::mlir::Attribute ParallelOp::removeWaitAttrAttr() { + auto &attr = getProperties().waitAttr; + attr = {}; + return attr; +} + +::mlir::Attribute ParallelOp::removeSelfAttrAttr() { + auto &attr = getProperties().selfAttr; + attr = {}; + return attr; +} + +::mlir::Attribute ParallelOp::removeReductionRecipesAttr() { + auto &attr = getProperties().reductionRecipes; + attr = {}; + return attr; +} + +::mlir::Attribute ParallelOp::removePrivatizationsAttr() { + auto &attr = getProperties().privatizations; + attr = {}; + return attr; +} + +::mlir::Attribute ParallelOp::removeFirstprivatizationsAttr() { + auto &attr = getProperties().firstprivatizations; + attr = {}; + return attr; +} + +::mlir::Attribute ParallelOp::removeDefaultAttrAttr() { + auto &attr = getProperties().defaultAttr; + attr = {}; + return attr; +} + +void ParallelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + odsState.addOperands(numGangs); + if (numWorkers) + odsState.addOperands(numWorkers); + if (vectorLength) + odsState.addOperands(vectorLength); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(reductionOperands); + odsState.addOperands(gangPrivateOperands); + odsState.addOperands(gangFirstPrivateOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), static_cast(numGangs.size()), (numWorkers ? 1 : 0), (vectorLength ? 1 : 0), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(reductionOperands.size()), static_cast(gangPrivateOperands.size()), static_cast(gangFirstPrivateOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = asyncAttr; + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = waitAttr; + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = selfAttr; + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (firstprivatizations) { + odsState.getOrAddProperties().firstprivatizations = firstprivatizations; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); +} + +void ParallelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + odsState.addOperands(numGangs); + if (numWorkers) + odsState.addOperands(numWorkers); + if (vectorLength) + odsState.addOperands(vectorLength); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(reductionOperands); + odsState.addOperands(gangPrivateOperands); + odsState.addOperands(gangFirstPrivateOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), static_cast(numGangs.size()), (numWorkers ? 1 : 0), (vectorLength ? 1 : 0), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(reductionOperands.size()), static_cast(gangPrivateOperands.size()), static_cast(gangFirstPrivateOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = asyncAttr; + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = waitAttr; + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = selfAttr; + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (firstprivatizations) { + odsState.getOrAddProperties().firstprivatizations = firstprivatizations; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ParallelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + odsState.addOperands(numGangs); + if (numWorkers) + odsState.addOperands(numWorkers); + if (vectorLength) + odsState.addOperands(vectorLength); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(reductionOperands); + odsState.addOperands(gangPrivateOperands); + odsState.addOperands(gangFirstPrivateOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), static_cast(numGangs.size()), (numWorkers ? 1 : 0), (vectorLength ? 1 : 0), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(reductionOperands.size()), static_cast(gangPrivateOperands.size()), static_cast(gangFirstPrivateOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = ((asyncAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = ((waitAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = ((selfAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (firstprivatizations) { + odsState.getOrAddProperties().firstprivatizations = firstprivatizations; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); +} + +void ParallelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + odsState.addOperands(numGangs); + if (numWorkers) + odsState.addOperands(numWorkers); + if (vectorLength) + odsState.addOperands(vectorLength); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(reductionOperands); + odsState.addOperands(gangPrivateOperands); + odsState.addOperands(gangFirstPrivateOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), static_cast(numGangs.size()), (numWorkers ? 1 : 0), (vectorLength ? 1 : 0), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(reductionOperands.size()), static_cast(gangPrivateOperands.size()), static_cast(gangFirstPrivateOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = ((asyncAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = ((waitAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = ((selfAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (firstprivatizations) { + odsState.getOrAddProperties().firstprivatizations = firstprivatizations; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ParallelOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ParallelOp::verifyInvariantsImpl() { + auto tblgen_asyncAttr = getProperties().asyncAttr; (void)tblgen_asyncAttr; + auto tblgen_defaultAttr = getProperties().defaultAttr; (void)tblgen_defaultAttr; + auto tblgen_firstprivatizations = getProperties().firstprivatizations; (void)tblgen_firstprivatizations; + auto tblgen_privatizations = getProperties().privatizations; (void)tblgen_privatizations; + auto tblgen_reductionRecipes = getProperties().reductionRecipes; (void)tblgen_reductionRecipes; + auto tblgen_selfAttr = getProperties().selfAttr; (void)tblgen_selfAttr; + auto tblgen_waitAttr = getProperties().waitAttr; (void)tblgen_waitAttr; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_asyncAttr, "asyncAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_waitAttr, "waitAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_selfAttr, "selfAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(*this, tblgen_reductionRecipes, "reductionRecipes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(*this, tblgen_privatizations, "privatizations"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(*this, tblgen_firstprivatizations, "firstprivatizations"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps5(*this, tblgen_defaultAttr, "defaultAttr"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + if (valueGroup4.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup4.size(); + } + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + if (valueGroup5.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup5.size(); + } + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + if (valueGroup6.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup6.size(); + } + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup7 = getODSOperands(7); + + for (auto v : valueGroup7) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup8 = getODSOperands(8); + + for (auto v : valueGroup8) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup9 = getODSOperands(9); + + for (auto v : valueGroup9) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup10 = getODSOperands(10); + + for (auto v : valueGroup10) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ParallelOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ParallelOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncOperands; + ::llvm::SMLoc asyncOperandsLoc; + (void)asyncOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> asyncTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> gangFirstPrivateOperandsOperands; + ::llvm::SMLoc gangFirstPrivateOperandsOperandsLoc; + (void)gangFirstPrivateOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> gangFirstPrivateOperandsTypes; + ::mlir::ArrayAttr firstprivatizationsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> numGangsOperands; + ::llvm::SMLoc numGangsOperandsLoc; + (void)numGangsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> numGangsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> numWorkersOperands; + ::llvm::SMLoc numWorkersOperandsLoc; + (void)numWorkersOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> numWorkersTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> gangPrivateOperandsOperands; + ::llvm::SMLoc gangPrivateOperandsOperandsLoc; + (void)gangPrivateOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> gangPrivateOperandsTypes; + ::mlir::ArrayAttr privatizationsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> vectorLengthOperands; + ::llvm::SMLoc vectorLengthOperandsLoc; + (void)vectorLengthOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> vectorLengthTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitOperandsOperands; + ::llvm::SMLoc waitOperandsOperandsLoc; + (void)waitOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> selfCondOperands; + ::llvm::SMLoc selfCondOperandsLoc; + (void)selfCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> reductionOperandsOperands; + ::llvm::SMLoc reductionOperandsOperandsLoc; + (void)reductionOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> reductionOperandsTypes; + ::mlir::ArrayAttr reductionRecipesAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool dataOperandsClause = false; + bool asyncClause = false; + bool firstprivateClause = false; + bool num_gangsClause = false; + bool num_workersClause = false; + bool privateClause = false; + bool vector_lengthClause = false; + bool waitClause = false; + bool selfClause = false; + bool ifClause = false; + bool reductionClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("async"))) { + + if (asyncClause) { + return parser.emitError(parser.getNameLoc()) + << "`async` clause can appear at most once in the expansion of the " + "oilist directive"; + } + asyncClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + asyncOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("firstprivate"))) { + + if (firstprivateClause) { + return parser.emitError(parser.getNameLoc()) + << "`firstprivate` clause can appear at most once in the expansion of the " + "oilist directive"; + } + firstprivateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + gangFirstPrivateOperandsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseSymOperandList(parser, gangFirstPrivateOperandsOperands, gangFirstPrivateOperandsTypes, firstprivatizationsAttr); + if (odsResult) return ::mlir::failure(); + if (firstprivatizationsAttr) + result.getOrAddProperties().firstprivatizations = firstprivatizationsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("num_gangs"))) { + + if (num_gangsClause) { + return parser.emitError(parser.getNameLoc()) + << "`num_gangs` clause can appear at most once in the expansion of the " + "oilist directive"; + } + num_gangsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + numGangsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(numGangsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(numGangsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("num_workers"))) { + + if (num_workersClause) { + return parser.emitError(parser.getNameLoc()) + << "`num_workers` clause can appear at most once in the expansion of the " + "oilist directive"; + } + num_workersClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + numWorkersOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + numWorkersOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + numWorkersTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("private"))) { + + if (privateClause) { + return parser.emitError(parser.getNameLoc()) + << "`private` clause can appear at most once in the expansion of the " + "oilist directive"; + } + privateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + gangPrivateOperandsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseSymOperandList(parser, gangPrivateOperandsOperands, gangPrivateOperandsTypes, privatizationsAttr); + if (odsResult) return ::mlir::failure(); + if (privatizationsAttr) + result.getOrAddProperties().privatizations = privatizationsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("vector_length"))) { + + if (vector_lengthClause) { + return parser.emitError(parser.getNameLoc()) + << "`vector_length` clause can appear at most once in the expansion of the " + "oilist directive"; + } + vector_lengthClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + vectorLengthOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + vectorLengthOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + vectorLengthTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait"))) { + + if (waitClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + waitClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + waitOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(waitOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(waitOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("self"))) { + + if (selfClause) { + return parser.emitError(parser.getNameLoc()) + << "`self` clause can appear at most once in the expansion of the " + "oilist directive"; + } + selfClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + selfCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + selfCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("reduction"))) { + + if (reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + reductionOperandsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseSymOperandList(parser, reductionOperandsOperands, reductionOperandsTypes, reductionRecipesAttr); + if (odsResult) return ::mlir::failure(); + if (reductionRecipesAttr) + result.getOrAddProperties().reductionRecipes = reductionRecipesAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(asyncOperands.size()), static_cast(waitOperandsOperands.size()), static_cast(numGangsOperands.size()), static_cast(numWorkersOperands.size()), static_cast(vectorLengthOperands.size()), static_cast(ifCondOperands.size()), static_cast(selfCondOperands.size()), static_cast(reductionOperandsOperands.size()), static_cast(gangPrivateOperandsOperands.size()), static_cast(gangFirstPrivateOperandsOperands.size()), static_cast(dataClauseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(asyncOperands, asyncTypes, asyncOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitOperandsOperands, waitOperandsTypes, waitOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(numGangsOperands, numGangsTypes, numGangsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(numWorkersOperands, numWorkersTypes, numWorkersOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(vectorLengthOperands, vectorLengthTypes, vectorLengthOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(selfCondOperands, odsBuildableType0, selfCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(reductionOperandsOperands, reductionOperandsTypes, reductionOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(gangPrivateOperandsOperands, gangPrivateOperandsTypes, gangPrivateOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(gangFirstPrivateOperandsOperands, gangFirstPrivateOperandsTypes, gangFirstPrivateOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ParallelOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getAsync()) { + _odsPrinter << ' ' << "async"; + _odsPrinter << "("; + if (::mlir::Value value = getAsync()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getAsync() ? ::llvm::ArrayRef<::mlir::Type>(getAsync().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getGangFirstPrivateOperands().size() || getFirstprivatizationsAttr()) { + _odsPrinter << ' ' << "firstprivate"; + _odsPrinter << "("; + printSymOperandList(_odsPrinter, *this, getGangFirstPrivateOperands(), getGangFirstPrivateOperands().getTypes(), getFirstprivatizationsAttr()); + _odsPrinter << ")"; + } + if (false || getNumGangs().size()) { + _odsPrinter << ' ' << "num_gangs"; + _odsPrinter << "("; + _odsPrinter << getNumGangs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getNumGangs().getTypes(); + _odsPrinter << ")"; + } + if (false || getNumWorkers()) { + _odsPrinter << ' ' << "num_workers"; + _odsPrinter << "("; + if (::mlir::Value value = getNumWorkers()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getNumWorkers() ? ::llvm::ArrayRef<::mlir::Type>(getNumWorkers().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getGangPrivateOperands().size() || getPrivatizationsAttr()) { + _odsPrinter << ' ' << "private"; + _odsPrinter << "("; + printSymOperandList(_odsPrinter, *this, getGangPrivateOperands(), getGangPrivateOperands().getTypes(), getPrivatizationsAttr()); + _odsPrinter << ")"; + } + if (false || getVectorLength()) { + _odsPrinter << ' ' << "vector_length"; + _odsPrinter << "("; + if (::mlir::Value value = getVectorLength()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVectorLength() ? ::llvm::ArrayRef<::mlir::Type>(getVectorLength().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getWaitOperands().size()) { + _odsPrinter << ' ' << "wait"; + _odsPrinter << "("; + _odsPrinter << getWaitOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getWaitOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getSelfCond()) { + _odsPrinter << ' ' << "self"; + _odsPrinter << "("; + if (::mlir::Value value = getSelfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getReductionOperands().size() || getReductionRecipesAttr()) { + _odsPrinter << ' ' << "reduction"; + _odsPrinter << "("; + printSymOperandList(_odsPrinter, *this, getReductionOperands(), getReductionOperands().getTypes(), getReductionRecipesAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("firstprivatizations"); + elidedAttrs.push_back("privatizations"); + elidedAttrs.push_back("reductionRecipes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAsyncAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("asyncAttr"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWaitAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("waitAttr"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getSelfAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("selfAttr"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ParallelOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::PresentOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PresentOpGenericAdaptorBase::PresentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.present", odsAttrs.getContext()); +} + +PresentOpGenericAdaptorBase::PresentOpGenericAdaptorBase(PresentOp op) : PresentOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PresentOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PresentOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr PresentOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause PresentOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr PresentOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool PresentOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr PresentOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool PresentOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr PresentOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > PresentOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +PresentOpAdaptor::PresentOpAdaptor(PresentOp op) : PresentOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PresentOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.present' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.present' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.present' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.present' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair PresentOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PresentOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> PresentOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> PresentOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range PresentOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &PresentOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange PresentOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PresentOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PresentOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PresentOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> PresentOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult PresentOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PresentOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PresentOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PresentOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PresentOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PresentOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PresentOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PresentOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PresentOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr PresentOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause PresentOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr PresentOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool PresentOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr PresentOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool PresentOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr PresentOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > PresentOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void PresentOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void PresentOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void PresentOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void PresentOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void PresentOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void PresentOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void PresentOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void PresentOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute PresentOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void PresentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void PresentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PresentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void PresentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PresentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void PresentOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_present); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult PresentOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PresentOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult PresentOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PresentOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_present))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::PresentOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::PrivateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PrivateOpGenericAdaptorBase::PrivateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.private", odsAttrs.getContext()); +} + +PrivateOpGenericAdaptorBase::PrivateOpGenericAdaptorBase(PrivateOp op) : PrivateOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PrivateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr PrivateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr PrivateOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause PrivateOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr PrivateOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool PrivateOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr PrivateOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool PrivateOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr PrivateOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > PrivateOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +PrivateOpAdaptor::PrivateOpAdaptor(PrivateOp op) : PrivateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PrivateOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.private' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.private' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.private' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.private' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair PrivateOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range PrivateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> PrivateOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> PrivateOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range PrivateOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &PrivateOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange PrivateOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange PrivateOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair PrivateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PrivateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> PrivateOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult PrivateOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute PrivateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PrivateOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional PrivateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void PrivateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void PrivateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult PrivateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PrivateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void PrivateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr PrivateOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause PrivateOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr PrivateOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool PrivateOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr PrivateOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool PrivateOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr PrivateOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > PrivateOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void PrivateOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void PrivateOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void PrivateOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void PrivateOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void PrivateOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void PrivateOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void PrivateOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void PrivateOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute PrivateOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void PrivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void PrivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PrivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void PrivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PrivateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void PrivateOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_private); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult PrivateOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult PrivateOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult PrivateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PrivateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_private))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::PrivateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::PrivateRecipeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PrivateRecipeOpGenericAdaptorBase::PrivateRecipeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.private.recipe", odsAttrs.getContext()); +} + +PrivateRecipeOpGenericAdaptorBase::PrivateRecipeOpGenericAdaptorBase(PrivateRecipeOp op) : PrivateRecipeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PrivateRecipeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PrivateRecipeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr PrivateRecipeOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef PrivateRecipeOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr PrivateRecipeOpGenericAdaptorBase::getTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); + return attr; +} + +::mlir::Type PrivateRecipeOpGenericAdaptorBase::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::Region &PrivateRecipeOpGenericAdaptorBase::getInitRegion() { + return *odsRegions[0]; +} + +::mlir::Region &PrivateRecipeOpGenericAdaptorBase::getDestroyRegion() { + return *odsRegions[1]; +} + +::mlir::RegionRange PrivateRecipeOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PrivateRecipeOpAdaptor::PrivateRecipeOpAdaptor(PrivateRecipeOp op) : PrivateRecipeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PrivateRecipeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'acc.private.recipe' op ""requires attribute 'sym_name'"); + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitError(loc, "'acc.private.recipe' op ""requires attribute 'type'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'acc.private.recipe' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) + return emitError(loc, "'acc.private.recipe' op ""attribute 'type' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair PrivateRecipeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range PrivateRecipeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair PrivateRecipeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PrivateRecipeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &PrivateRecipeOp::getInitRegion() { + return (*this)->getRegion(0); +} + +::mlir::Region &PrivateRecipeOp::getDestroyRegion() { + return (*this)->getRegion(1); +} + +::mlir::LogicalResult PrivateRecipeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.type; + auto attr = dict.get("type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute PrivateRecipeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("type", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PrivateRecipeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.type.getAsOpaquePointer())); +} + +std::optional PrivateRecipeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "sym_name") + return prop.sym_name; + + if (name == "type") + return prop.type; + return std::nullopt; +} + +void PrivateRecipeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "type") { + prop.type = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void PrivateRecipeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.type) attrs.append("type", prop.type); +} + +::mlir::LogicalResult PrivateRecipeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps0(attr, "type", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PrivateRecipeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.type))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PrivateRecipeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.sym_name); + writer.writeAttribute(prop.type); +} + +::mlir::StringAttr PrivateRecipeOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef PrivateRecipeOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr PrivateRecipeOp::getTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); +} + +::mlir::Type PrivateRecipeOp::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void PrivateRecipeOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void PrivateRecipeOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void PrivateRecipeOp::setTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getTypeAttrName(), attr); +} + +void PrivateRecipeOp::setType(::mlir::Type attrValue) { + (*this)->setAttr(getTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void PrivateRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + (void)odsState.addRegion(); + (void)odsState.addRegion(); +} + +void PrivateRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + (void)odsState.addRegion(); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PrivateRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + (void)odsState.addRegion(); + (void)odsState.addRegion(); +} + +void PrivateRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PrivateRecipeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 2; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult PrivateRecipeOp::verifyInvariantsImpl() { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitOpError("requires attribute 'type'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps0(*this, tblgen_type, "type"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "initRegion", index++))) + return ::mlir::failure(); + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(1))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "destroyRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PrivateRecipeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult PrivateRecipeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + ::mlir::TypeAttr typeAttr; + std::unique_ptr<::mlir::Region> initRegionRegion = std::make_unique<::mlir::Region>(); + std::unique_ptr<::mlir::Region> destroyRegionRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (typeAttr) result.getOrAddProperties().type = typeAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseKeyword("init")) + return ::mlir::failure(); + + if (parser.parseRegion(*initRegionRegion)) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("destroy"))) { + + if (parser.parseRegion(*destroyRegionRegion)) + return ::mlir::failure(); + } + result.addRegion(std::move(initRegionRegion)); + result.addRegion(std::move(destroyRegionRegion)); + return ::mlir::success(); +} + +void PrivateRecipeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getTypeAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("type"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "init"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getInitRegion()); + if (!getDestroyRegion().empty()) { + _odsPrinter << ' ' << "destroy"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getDestroyRegion()); + } +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::PrivateRecipeOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ReductionOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReductionOpGenericAdaptorBase::ReductionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.reduction", odsAttrs.getContext()); +} + +ReductionOpGenericAdaptorBase::ReductionOpGenericAdaptorBase(ReductionOp op) : ReductionOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReductionOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ReductionOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr ReductionOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause ReductionOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr ReductionOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool ReductionOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr ReductionOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool ReductionOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr ReductionOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > ReductionOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +ReductionOpAdaptor::ReductionOpAdaptor(ReductionOp op) : ReductionOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReductionOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.reduction' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.reduction' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.reduction' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.reduction' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair ReductionOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ReductionOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> ReductionOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> ReductionOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range ReductionOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &ReductionOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange ReductionOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ReductionOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ReductionOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReductionOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> ReductionOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ReductionOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ReductionOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ReductionOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ReductionOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ReductionOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ReductionOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ReductionOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReductionOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ReductionOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr ReductionOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause ReductionOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr ReductionOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool ReductionOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr ReductionOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool ReductionOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr ReductionOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > ReductionOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void ReductionOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void ReductionOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ReductionOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void ReductionOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void ReductionOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void ReductionOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void ReductionOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void ReductionOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute ReductionOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void ReductionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void ReductionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReductionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void ReductionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReductionOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ReductionOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_reduction); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult ReductionOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReductionOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReductionOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReductionOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_reduction))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ReductionRecipeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReductionRecipeOpGenericAdaptorBase::ReductionRecipeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.reduction.recipe", odsAttrs.getContext()); +} + +ReductionRecipeOpGenericAdaptorBase::ReductionRecipeOpGenericAdaptorBase(ReductionRecipeOp op) : ReductionRecipeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReductionRecipeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ReductionRecipeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr ReductionRecipeOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef ReductionRecipeOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr ReductionRecipeOpGenericAdaptorBase::getTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); + return attr; +} + +::mlir::Type ReductionRecipeOpGenericAdaptorBase::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::acc::ReductionOperatorAttr ReductionRecipeOpGenericAdaptorBase::getReductionOperatorAttr() { + auto attr = ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); + return attr; +} + +::mlir::acc::ReductionOperator ReductionRecipeOpGenericAdaptorBase::getReductionOperator() { + auto attr = getReductionOperatorAttr(); + return attr.getValue(); +} + +::mlir::Region &ReductionRecipeOpGenericAdaptorBase::getInitRegion() { + return *odsRegions[0]; +} + +::mlir::Region &ReductionRecipeOpGenericAdaptorBase::getCombinerRegion() { + return *odsRegions[1]; +} + +::mlir::RegionRange ReductionRecipeOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ReductionRecipeOpAdaptor::ReductionRecipeOpAdaptor(ReductionRecipeOp op) : ReductionRecipeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReductionRecipeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_reductionOperator = getProperties().reductionOperator; (void)tblgen_reductionOperator; + if (!tblgen_reductionOperator) return emitError(loc, "'acc.reduction.recipe' op ""requires attribute 'reductionOperator'"); + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'acc.reduction.recipe' op ""requires attribute 'sym_name'"); + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitError(loc, "'acc.reduction.recipe' op ""requires attribute 'type'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'acc.reduction.recipe' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) + return emitError(loc, "'acc.reduction.recipe' op ""attribute 'type' failed to satisfy constraint: any type attribute"); + + if (tblgen_reductionOperator && !((::llvm::isa<::mlir::acc::ReductionOperatorAttr>(tblgen_reductionOperator)))) + return emitError(loc, "'acc.reduction.recipe' op ""attribute 'reductionOperator' failed to satisfy constraint: built-in reduction operations supported by OpenACC"); + return ::mlir::success(); +} + +std::pair ReductionRecipeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ReductionRecipeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ReductionRecipeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReductionRecipeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &ReductionRecipeOp::getInitRegion() { + return (*this)->getRegion(0); +} + +::mlir::Region &ReductionRecipeOp::getCombinerRegion() { + return (*this)->getRegion(1); +} + +::mlir::LogicalResult ReductionRecipeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.reductionOperator; + auto attr = dict.get("reductionOperator"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for reductionOperator in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductionOperator` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.type; + auto attr = dict.get("type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ReductionRecipeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.reductionOperator; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductionOperator", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("type", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ReductionRecipeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.reductionOperator.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.type.getAsOpaquePointer())); +} + +std::optional ReductionRecipeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "reductionOperator") + return prop.reductionOperator; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "type") + return prop.type; + return std::nullopt; +} + +void ReductionRecipeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "reductionOperator") { + prop.reductionOperator = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "type") { + prop.type = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ReductionRecipeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.reductionOperator) attrs.append("reductionOperator", prop.reductionOperator); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.type) attrs.append("type", prop.type); +} + +::mlir::LogicalResult ReductionRecipeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getReductionOperatorAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps8(attr, "reductionOperator", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps0(attr, "type", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReductionRecipeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.reductionOperator))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.type))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReductionRecipeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.reductionOperator); + writer.writeAttribute(prop.sym_name); + writer.writeAttribute(prop.type); +} + +::mlir::StringAttr ReductionRecipeOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef ReductionRecipeOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr ReductionRecipeOp::getTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); +} + +::mlir::Type ReductionRecipeOp::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::acc::ReductionOperatorAttr ReductionRecipeOp::getReductionOperatorAttr() { + return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); +} + +::mlir::acc::ReductionOperator ReductionRecipeOp::getReductionOperator() { + auto attr = getReductionOperatorAttr(); + return attr.getValue(); +} + +void ReductionRecipeOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void ReductionRecipeOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void ReductionRecipeOp::setTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getTypeAttrName(), attr); +} + +void ReductionRecipeOp::setType(::mlir::Type attrValue) { + (*this)->setAttr(getTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void ReductionRecipeOp::setReductionOperatorAttr(::mlir::acc::ReductionOperatorAttr attr) { + (*this)->setAttr(getReductionOperatorAttrName(), attr); +} + +void ReductionRecipeOp::setReductionOperator(::mlir::acc::ReductionOperator attrValue) { + (*this)->setAttr(getReductionOperatorAttrName(), ::mlir::acc::ReductionOperatorAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void ReductionRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + odsState.getOrAddProperties().reductionOperator = reductionOperator; + (void)odsState.addRegion(); + (void)odsState.addRegion(); +} + +void ReductionRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + odsState.getOrAddProperties().reductionOperator = reductionOperator; + (void)odsState.addRegion(); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReductionRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + odsState.getOrAddProperties().reductionOperator = ::mlir::acc::ReductionOperatorAttr::get(odsBuilder.getContext(), reductionOperator); + (void)odsState.addRegion(); + (void)odsState.addRegion(); +} + +void ReductionRecipeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + odsState.getOrAddProperties().reductionOperator = ::mlir::acc::ReductionOperatorAttr::get(odsBuilder.getContext(), reductionOperator); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReductionRecipeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 2; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReductionRecipeOp::verifyInvariantsImpl() { + auto tblgen_reductionOperator = getProperties().reductionOperator; (void)tblgen_reductionOperator; + if (!tblgen_reductionOperator) return emitOpError("requires attribute 'reductionOperator'"); + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitOpError("requires attribute 'type'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps0(*this, tblgen_type, "type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps8(*this, tblgen_reductionOperator, "reductionOperator"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "initRegion", index++))) + return ::mlir::failure(); + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(1))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "combinerRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReductionRecipeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ReductionRecipeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + ::mlir::TypeAttr typeAttr; + ::mlir::acc::ReductionOperatorAttr reductionOperatorAttr; + std::unique_ptr<::mlir::Region> initRegionRegion = std::make_unique<::mlir::Region>(); + std::unique_ptr<::mlir::Region> combinerRegionRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (typeAttr) result.getOrAddProperties().type = typeAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseKeyword("reduction_operator")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(reductionOperatorAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (reductionOperatorAttr) result.getOrAddProperties().reductionOperator = reductionOperatorAttr; + if (parser.parseKeyword("init")) + return ::mlir::failure(); + + if (parser.parseRegion(*initRegionRegion)) + return ::mlir::failure(); + if (parser.parseKeyword("combiner")) + return ::mlir::failure(); + + if (parser.parseRegion(*combinerRegionRegion)) + return ::mlir::failure(); + result.addRegion(std::move(initRegionRegion)); + result.addRegion(std::move(combinerRegionRegion)); + return ::mlir::success(); +} + +void ReductionRecipeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getTypeAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("type"); + elidedAttrs.push_back("reductionOperator"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "reduction_operator"; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getReductionOperatorAttr()); + _odsPrinter << ' ' << "init"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getInitRegion()); + _odsPrinter << ' ' << "combiner"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getCombinerRegion()); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionRecipeOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::RoutineOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RoutineOpGenericAdaptorBase::RoutineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.routine", odsAttrs.getContext()); +} + +RoutineOpGenericAdaptorBase::RoutineOpGenericAdaptorBase(RoutineOp op) : RoutineOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RoutineOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr RoutineOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr RoutineOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef RoutineOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::StringAttr RoutineOpGenericAdaptorBase::getFuncNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().func_name); + return attr; +} + +::llvm::StringRef RoutineOpGenericAdaptorBase::getFuncName() { + auto attr = getFuncNameAttr(); + return attr.getValue(); +} + +::mlir::StringAttr RoutineOpGenericAdaptorBase::getBindNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().bind_name); + return attr; +} + +::std::optional< ::llvm::StringRef > RoutineOpGenericAdaptorBase::getBindName() { + auto attr = getBindNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::UnitAttr RoutineOpGenericAdaptorBase::getGangAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().gang); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool RoutineOpGenericAdaptorBase::getGang() { + auto attr = getGangAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOpGenericAdaptorBase::getWorkerAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().worker); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool RoutineOpGenericAdaptorBase::getWorker() { + auto attr = getWorkerAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOpGenericAdaptorBase::getVectorAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().vector); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool RoutineOpGenericAdaptorBase::getVector() { + auto attr = getVectorAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOpGenericAdaptorBase::getSeqAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().seq); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool RoutineOpGenericAdaptorBase::getSeq() { + auto attr = getSeqAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOpGenericAdaptorBase::getNohostAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nohost); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool RoutineOpGenericAdaptorBase::getNohost() { + auto attr = getNohostAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().implicit); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool RoutineOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::IntegerAttr RoutineOpGenericAdaptorBase::getGangDimAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().gangDim); + return attr; +} + +::std::optional< ::mlir::APInt > RoutineOpGenericAdaptorBase::getGangDim() { + auto attr = getGangDimAttr(); + return attr ? ::std::optional< ::mlir::APInt >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +RoutineOpAdaptor::RoutineOpAdaptor(RoutineOp op) : RoutineOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RoutineOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_bind_name = getProperties().bind_name; (void)tblgen_bind_name; + auto tblgen_func_name = getProperties().func_name; (void)tblgen_func_name; + if (!tblgen_func_name) return emitError(loc, "'acc.routine' op ""requires attribute 'func_name'"); + auto tblgen_gang = getProperties().gang; (void)tblgen_gang; + auto tblgen_gangDim = getProperties().gangDim; (void)tblgen_gangDim; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_nohost = getProperties().nohost; (void)tblgen_nohost; + auto tblgen_seq = getProperties().seq; (void)tblgen_seq; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'acc.routine' op ""requires attribute 'sym_name'"); + auto tblgen_vector = getProperties().vector; (void)tblgen_vector; + auto tblgen_worker = getProperties().worker; (void)tblgen_worker; + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'acc.routine' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_func_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_func_name)))) + return emitError(loc, "'acc.routine' op ""attribute 'func_name' failed to satisfy constraint: string attribute"); + + if (tblgen_bind_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_bind_name)))) + return emitError(loc, "'acc.routine' op ""attribute 'bind_name' failed to satisfy constraint: string attribute"); + + if (tblgen_gang && !((::llvm::isa<::mlir::UnitAttr>(tblgen_gang)))) + return emitError(loc, "'acc.routine' op ""attribute 'gang' failed to satisfy constraint: unit attribute"); + + if (tblgen_worker && !((::llvm::isa<::mlir::UnitAttr>(tblgen_worker)))) + return emitError(loc, "'acc.routine' op ""attribute 'worker' failed to satisfy constraint: unit attribute"); + + if (tblgen_vector && !((::llvm::isa<::mlir::UnitAttr>(tblgen_vector)))) + return emitError(loc, "'acc.routine' op ""attribute 'vector' failed to satisfy constraint: unit attribute"); + + if (tblgen_seq && !((::llvm::isa<::mlir::UnitAttr>(tblgen_seq)))) + return emitError(loc, "'acc.routine' op ""attribute 'seq' failed to satisfy constraint: unit attribute"); + + if (tblgen_nohost && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nohost)))) + return emitError(loc, "'acc.routine' op ""attribute 'nohost' failed to satisfy constraint: unit attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::UnitAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.routine' op ""attribute 'implicit' failed to satisfy constraint: unit attribute"); + + if (tblgen_gangDim && !((::llvm::isa<::mlir::IntegerAttr>(tblgen_gangDim)))) + return emitError(loc, "'acc.routine' op ""attribute 'gangDim' failed to satisfy constraint: arbitrary integer attribute"); + return ::mlir::success(); +} + +std::pair RoutineOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range RoutineOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair RoutineOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RoutineOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult RoutineOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.bind_name; + auto attr = dict.get("bind_name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for bind_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `bind_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.func_name; + auto attr = dict.get("func_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for func_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `func_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.gang; + auto attr = dict.get("gang"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for gang in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `gang` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.gangDim; + auto attr = dict.get("gangDim"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for gangDim in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `gangDim` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.nohost; + auto attr = dict.get("nohost"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nohost in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nohost` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.seq; + auto attr = dict.get("seq"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for seq in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `seq` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.vector; + auto attr = dict.get("vector"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for vector in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `vector` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.worker; + auto attr = dict.get("worker"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for worker in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `worker` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute RoutineOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.bind_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("bind_name", + propStorage)); + } + + { + const auto &propStorage = prop.func_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("func_name", + propStorage)); + } + + { + const auto &propStorage = prop.gang; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("gang", + propStorage)); + } + + { + const auto &propStorage = prop.gangDim; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("gangDim", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.nohost; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nohost", + propStorage)); + } + + { + const auto &propStorage = prop.seq; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("seq", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.vector; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("vector", + propStorage)); + } + + { + const auto &propStorage = prop.worker; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("worker", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RoutineOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.bind_name.getAsOpaquePointer()), + llvm::hash_value(prop.func_name.getAsOpaquePointer()), + llvm::hash_value(prop.gang.getAsOpaquePointer()), + llvm::hash_value(prop.gangDim.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.nohost.getAsOpaquePointer()), + llvm::hash_value(prop.seq.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.vector.getAsOpaquePointer()), + llvm::hash_value(prop.worker.getAsOpaquePointer())); +} + +std::optional RoutineOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "bind_name") + return prop.bind_name; + + if (name == "func_name") + return prop.func_name; + + if (name == "gang") + return prop.gang; + + if (name == "gangDim") + return prop.gangDim; + + if (name == "implicit") + return prop.implicit; + + if (name == "nohost") + return prop.nohost; + + if (name == "seq") + return prop.seq; + + if (name == "sym_name") + return prop.sym_name; + + if (name == "vector") + return prop.vector; + + if (name == "worker") + return prop.worker; + return std::nullopt; +} + +void RoutineOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "bind_name") { + prop.bind_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "func_name") { + prop.func_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "gang") { + prop.gang = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "gangDim") { + prop.gangDim = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "nohost") { + prop.nohost = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "seq") { + prop.seq = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "vector") { + prop.vector = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "worker") { + prop.worker = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void RoutineOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.bind_name) attrs.append("bind_name", prop.bind_name); + + if (prop.func_name) attrs.append("func_name", prop.func_name); + + if (prop.gang) attrs.append("gang", prop.gang); + + if (prop.gangDim) attrs.append("gangDim", prop.gangDim); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.nohost) attrs.append("nohost", prop.nohost); + + if (prop.seq) attrs.append("seq", prop.seq); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.vector) attrs.append("vector", prop.vector); + + if (prop.worker) attrs.append("worker", prop.worker); +} + +::mlir::LogicalResult RoutineOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBindNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "bind_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFuncNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "func_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getGangAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "gang", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getGangDimAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps9(attr, "gangDim", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNohostAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "nohost", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSeqAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "seq", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getVectorAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "vector", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWorkerAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "worker", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RoutineOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.bind_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.func_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.gang))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.gangDim))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.nohost))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.seq))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.vector))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.worker))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RoutineOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.bind_name); + writer.writeAttribute(prop.func_name); + + writer.writeOptionalAttribute(prop.gang); + + writer.writeOptionalAttribute(prop.gangDim); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.nohost); + + writer.writeOptionalAttribute(prop.seq); + writer.writeAttribute(prop.sym_name); + + writer.writeOptionalAttribute(prop.vector); + + writer.writeOptionalAttribute(prop.worker); +} + +::mlir::StringAttr RoutineOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef RoutineOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::StringAttr RoutineOp::getFuncNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().func_name); +} + +::llvm::StringRef RoutineOp::getFuncName() { + auto attr = getFuncNameAttr(); + return attr.getValue(); +} + +::mlir::StringAttr RoutineOp::getBindNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().bind_name); +} + +::std::optional< ::llvm::StringRef > RoutineOp::getBindName() { + auto attr = getBindNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::UnitAttr RoutineOp::getGangAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().gang); +} + +bool RoutineOp::getGang() { + auto attr = getGangAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOp::getWorkerAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().worker); +} + +bool RoutineOp::getWorker() { + auto attr = getWorkerAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOp::getVectorAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().vector); +} + +bool RoutineOp::getVector() { + auto attr = getVectorAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOp::getSeqAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().seq); +} + +bool RoutineOp::getSeq() { + auto attr = getSeqAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOp::getNohostAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nohost); +} + +bool RoutineOp::getNohost() { + auto attr = getNohostAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr RoutineOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().implicit); +} + +bool RoutineOp::getImplicit() { + auto attr = getImplicitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::IntegerAttr RoutineOp::getGangDimAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().gangDim); +} + +::std::optional< ::mlir::APInt > RoutineOp::getGangDim() { + auto attr = getGangDimAttr(); + return attr ? ::std::optional< ::mlir::APInt >(attr.getValue()) : (::std::nullopt); +} + +void RoutineOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void RoutineOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void RoutineOp::setFuncNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getFuncNameAttrName(), attr); +} + +void RoutineOp::setFuncName(::llvm::StringRef attrValue) { + (*this)->setAttr(getFuncNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void RoutineOp::setBindNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getBindNameAttrName(), attr); +} + +void RoutineOp::setBindName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getBindNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getBindNameAttrName()); +} + +void RoutineOp::setGangAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getGangAttrName(), attr); +} + +void RoutineOp::setGang(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getGangAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getGangAttrName()); +} + +void RoutineOp::setWorkerAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWorkerAttrName(), attr); +} + +void RoutineOp::setWorker(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWorkerAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWorkerAttrName()); +} + +void RoutineOp::setVectorAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getVectorAttrName(), attr); +} + +void RoutineOp::setVector(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getVectorAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getVectorAttrName()); +} + +void RoutineOp::setSeqAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getSeqAttrName(), attr); +} + +void RoutineOp::setSeq(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getSeqAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getSeqAttrName()); +} + +void RoutineOp::setNohostAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNohostAttrName(), attr); +} + +void RoutineOp::setNohost(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNohostAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNohostAttrName()); +} + +void RoutineOp::setImplicitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void RoutineOp::setImplicit(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getImplicitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getImplicitAttrName()); +} + +void RoutineOp::setGangDimAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getGangDimAttrName(), attr); +} + +::mlir::Attribute RoutineOp::removeBindNameAttr() { + auto &attr = getProperties().bind_name; + attr = {}; + return attr; +} + +::mlir::Attribute RoutineOp::removeGangAttr() { + auto &attr = getProperties().gang; + attr = {}; + return attr; +} + +::mlir::Attribute RoutineOp::removeWorkerAttr() { + auto &attr = getProperties().worker; + attr = {}; + return attr; +} + +::mlir::Attribute RoutineOp::removeVectorAttr() { + auto &attr = getProperties().vector; + attr = {}; + return attr; +} + +::mlir::Attribute RoutineOp::removeSeqAttr() { + auto &attr = getProperties().seq; + attr = {}; + return attr; +} + +::mlir::Attribute RoutineOp::removeNohostAttr() { + auto &attr = getProperties().nohost; + attr = {}; + return attr; +} + +::mlir::Attribute RoutineOp::removeImplicitAttr() { + auto &attr = getProperties().implicit; + attr = {}; + return attr; +} + +::mlir::Attribute RoutineOp::removeGangDimAttr() { + auto &attr = getProperties().gangDim; + attr = {}; + return attr; +} + +void RoutineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::StringAttr func_name, /*optional*/::mlir::StringAttr bind_name, /*optional*/::mlir::UnitAttr gang, /*optional*/::mlir::UnitAttr worker, /*optional*/::mlir::UnitAttr vector, /*optional*/::mlir::UnitAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::IntegerAttr gangDim) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().func_name = func_name; + if (bind_name) { + odsState.getOrAddProperties().bind_name = bind_name; + } + if (gang) { + odsState.getOrAddProperties().gang = gang; + } + if (worker) { + odsState.getOrAddProperties().worker = worker; + } + if (vector) { + odsState.getOrAddProperties().vector = vector; + } + if (seq) { + odsState.getOrAddProperties().seq = seq; + } + if (nohost) { + odsState.getOrAddProperties().nohost = nohost; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (gangDim) { + odsState.getOrAddProperties().gangDim = gangDim; + } +} + +void RoutineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::StringAttr func_name, /*optional*/::mlir::StringAttr bind_name, /*optional*/::mlir::UnitAttr gang, /*optional*/::mlir::UnitAttr worker, /*optional*/::mlir::UnitAttr vector, /*optional*/::mlir::UnitAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::IntegerAttr gangDim) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().func_name = func_name; + if (bind_name) { + odsState.getOrAddProperties().bind_name = bind_name; + } + if (gang) { + odsState.getOrAddProperties().gang = gang; + } + if (worker) { + odsState.getOrAddProperties().worker = worker; + } + if (vector) { + odsState.getOrAddProperties().vector = vector; + } + if (seq) { + odsState.getOrAddProperties().seq = seq; + } + if (nohost) { + odsState.getOrAddProperties().nohost = nohost; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (gangDim) { + odsState.getOrAddProperties().gangDim = gangDim; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoutineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::llvm::StringRef func_name, /*optional*/::mlir::StringAttr bind_name, /*optional*/bool gang, /*optional*/bool worker, /*optional*/bool vector, /*optional*/bool seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::IntegerAttr gangDim) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().func_name = odsBuilder.getStringAttr(func_name); + if (bind_name) { + odsState.getOrAddProperties().bind_name = bind_name; + } + if (gang) { + odsState.getOrAddProperties().gang = ((gang) ? odsBuilder.getUnitAttr() : nullptr); + } + if (worker) { + odsState.getOrAddProperties().worker = ((worker) ? odsBuilder.getUnitAttr() : nullptr); + } + if (vector) { + odsState.getOrAddProperties().vector = ((vector) ? odsBuilder.getUnitAttr() : nullptr); + } + if (seq) { + odsState.getOrAddProperties().seq = ((seq) ? odsBuilder.getUnitAttr() : nullptr); + } + if (nohost) { + odsState.getOrAddProperties().nohost = ((nohost) ? odsBuilder.getUnitAttr() : nullptr); + } + if (implicit) { + odsState.getOrAddProperties().implicit = ((implicit) ? odsBuilder.getUnitAttr() : nullptr); + } + if (gangDim) { + odsState.getOrAddProperties().gangDim = gangDim; + } +} + +void RoutineOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::llvm::StringRef func_name, /*optional*/::mlir::StringAttr bind_name, /*optional*/bool gang, /*optional*/bool worker, /*optional*/bool vector, /*optional*/bool seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::IntegerAttr gangDim) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().func_name = odsBuilder.getStringAttr(func_name); + if (bind_name) { + odsState.getOrAddProperties().bind_name = bind_name; + } + if (gang) { + odsState.getOrAddProperties().gang = ((gang) ? odsBuilder.getUnitAttr() : nullptr); + } + if (worker) { + odsState.getOrAddProperties().worker = ((worker) ? odsBuilder.getUnitAttr() : nullptr); + } + if (vector) { + odsState.getOrAddProperties().vector = ((vector) ? odsBuilder.getUnitAttr() : nullptr); + } + if (seq) { + odsState.getOrAddProperties().seq = ((seq) ? odsBuilder.getUnitAttr() : nullptr); + } + if (nohost) { + odsState.getOrAddProperties().nohost = ((nohost) ? odsBuilder.getUnitAttr() : nullptr); + } + if (implicit) { + odsState.getOrAddProperties().implicit = ((implicit) ? odsBuilder.getUnitAttr() : nullptr); + } + if (gangDim) { + odsState.getOrAddProperties().gangDim = gangDim; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RoutineOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RoutineOp::verifyInvariantsImpl() { + auto tblgen_bind_name = getProperties().bind_name; (void)tblgen_bind_name; + auto tblgen_func_name = getProperties().func_name; (void)tblgen_func_name; + if (!tblgen_func_name) return emitOpError("requires attribute 'func_name'"); + auto tblgen_gang = getProperties().gang; (void)tblgen_gang; + auto tblgen_gangDim = getProperties().gangDim; (void)tblgen_gangDim; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_nohost = getProperties().nohost; (void)tblgen_nohost; + auto tblgen_seq = getProperties().seq; (void)tblgen_seq; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_vector = getProperties().vector; (void)tblgen_vector; + auto tblgen_worker = getProperties().worker; (void)tblgen_worker; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_func_name, "func_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_bind_name, "bind_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_gang, "gang"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_worker, "worker"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_vector, "vector"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_seq, "seq"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_nohost, "nohost"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps9(*this, tblgen_gangDim, "gangDim"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult RoutineOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult RoutineOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + ::mlir::StringAttr func_nameAttr; + ::mlir::StringAttr bind_nameAttr; + ::mlir::UnitAttr gangAttr; + ::mlir::IntegerAttr gangDimAttr; + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + if (parser.parseKeyword("func")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseSymbolName(func_nameAttr)) + return ::mlir::failure(); + if (func_nameAttr) result.getOrAddProperties().func_name = func_nameAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + bool bindClause = false; + bool gangClause = false; + bool workerClause = false; + bool vectorClause = false; + bool seqClause = false; + bool nohostClause = false; + bool implicitClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("bind"))) { + + if (bindClause) { + return parser.emitError(parser.getNameLoc()) + << "`bind` clause can appear at most once in the expansion of the " + "oilist directive"; + } + bindClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + ::mlir::OptionalParseResult parseResultbind_nameAttr = + parser.parseOptionalAttribute(bind_nameAttr, parser.getBuilder().getType<::mlir::NoneType>()); + if (parseResultbind_nameAttr.has_value() && failed(*parseResultbind_nameAttr)) + return ::mlir::failure(); + if (parseResultbind_nameAttr.has_value() && succeeded(*parseResultbind_nameAttr)) + if (bind_nameAttr) result.getOrAddProperties().bind_name = bind_nameAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("gang"))) { + + if (gangClause) { + return parser.emitError(parser.getNameLoc()) + << "`gang` clause can appear at most once in the expansion of the " + "oilist directive"; + } + gangClause = true; + { + auto odsResult = parseRoutineGangClause(parser, gangAttr, gangDimAttr); + if (odsResult) return ::mlir::failure(); + if (gangAttr) + result.getOrAddProperties().gang = gangAttr; + if (gangDimAttr) + result.getOrAddProperties().gangDim = gangDimAttr; + } + } else if (succeeded(parser.parseOptionalKeyword("worker"))) { + + if (workerClause) { + return parser.emitError(parser.getNameLoc()) + << "`worker` clause can appear at most once in the expansion of the " + "oilist directive"; + } + workerClause = true; + result.getOrAddProperties().worker = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("vector"))) { + + if (vectorClause) { + return parser.emitError(parser.getNameLoc()) + << "`vector` clause can appear at most once in the expansion of the " + "oilist directive"; + } + vectorClause = true; + result.getOrAddProperties().vector = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("seq"))) { + + if (seqClause) { + return parser.emitError(parser.getNameLoc()) + << "`seq` clause can appear at most once in the expansion of the " + "oilist directive"; + } + seqClause = true; + result.getOrAddProperties().seq = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("nohost"))) { + + if (nohostClause) { + return parser.emitError(parser.getNameLoc()) + << "`nohost` clause can appear at most once in the expansion of the " + "oilist directive"; + } + nohostClause = true; + result.getOrAddProperties().nohost = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("implicit"))) { + + if (implicitClause) { + return parser.emitError(parser.getNameLoc()) + << "`implicit` clause can appear at most once in the expansion of the " + "oilist directive"; + } + implicitClause = true; + result.getOrAddProperties().implicit = parser.getBuilder().getUnitAttr(); } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RoutineOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' ' << "func"; + _odsPrinter << "("; + _odsPrinter.printSymbolName(getFuncNameAttr().getValue()); + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getBindNameAttr()) { + _odsPrinter << ' ' << "bind"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getBindNameAttr()); + _odsPrinter << ")"; + } + if (false || getGangAttr() || getGangDimAttr()) { + _odsPrinter << ' ' << "gang"; + printRoutineGangClause(_odsPrinter, *this, getGangAttr(), getGangDimAttr()); + } + if (false || getWorkerAttr()) { + _odsPrinter << ' ' << "worker"; + } + if (false || getVectorAttr()) { + _odsPrinter << ' ' << "vector"; + } + if (false || getSeqAttr()) { + _odsPrinter << ' ' << "seq"; + } + if (false || getNohostAttr()) { + _odsPrinter << ' ' << "nohost"; + } + if (false || getImplicitAttr()) { + _odsPrinter << ' ' << "implicit"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("func_name"); + elidedAttrs.push_back("bind_name"); + elidedAttrs.push_back("gang"); + elidedAttrs.push_back("gangDim"); + elidedAttrs.push_back("worker"); + elidedAttrs.push_back("vector"); + elidedAttrs.push_back("seq"); + elidedAttrs.push_back("nohost"); + elidedAttrs.push_back("implicit"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getGangAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("gang"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWorkerAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("worker"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getVectorAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("vector"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getSeqAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("seq"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNohostAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nohost"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::RoutineOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::SerialOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SerialOpGenericAdaptorBase::SerialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.serial", odsAttrs.getContext()); +} + +SerialOpGenericAdaptorBase::SerialOpGenericAdaptorBase(SerialOp op) : SerialOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SerialOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SerialOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr SerialOpGenericAdaptorBase::getAsyncAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().asyncAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool SerialOpGenericAdaptorBase::getAsyncAttr() { + auto attr = getAsyncAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr SerialOpGenericAdaptorBase::getWaitAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().waitAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool SerialOpGenericAdaptorBase::getWaitAttr() { + auto attr = getWaitAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr SerialOpGenericAdaptorBase::getSelfAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().selfAttr); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool SerialOpGenericAdaptorBase::getSelfAttr() { + auto attr = getSelfAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr SerialOpGenericAdaptorBase::getReductionRecipesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductionRecipes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > SerialOpGenericAdaptorBase::getReductionRecipes() { + auto attr = getReductionRecipesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr SerialOpGenericAdaptorBase::getPrivatizationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().privatizations); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > SerialOpGenericAdaptorBase::getPrivatizations() { + auto attr = getPrivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr SerialOpGenericAdaptorBase::getFirstprivatizationsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().firstprivatizations); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > SerialOpGenericAdaptorBase::getFirstprivatizations() { + auto attr = getFirstprivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::acc::ClauseDefaultValueAttr SerialOpGenericAdaptorBase::getDefaultAttrAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); + return attr; +} + +::std::optional<::mlir::acc::ClauseDefaultValue> SerialOpGenericAdaptorBase::getDefaultAttr() { + auto attr = getDefaultAttrAttr(); + return attr ? ::std::optional<::mlir::acc::ClauseDefaultValue>(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &SerialOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange SerialOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +SerialOpAdaptor::SerialOpAdaptor(SerialOp op) : SerialOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SerialOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_asyncAttr = getProperties().asyncAttr; (void)tblgen_asyncAttr; + auto tblgen_defaultAttr = getProperties().defaultAttr; (void)tblgen_defaultAttr; + auto tblgen_firstprivatizations = getProperties().firstprivatizations; (void)tblgen_firstprivatizations; + auto tblgen_privatizations = getProperties().privatizations; (void)tblgen_privatizations; + auto tblgen_reductionRecipes = getProperties().reductionRecipes; (void)tblgen_reductionRecipes; + auto tblgen_selfAttr = getProperties().selfAttr; (void)tblgen_selfAttr; + auto tblgen_waitAttr = getProperties().waitAttr; (void)tblgen_waitAttr; + + if (tblgen_asyncAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_asyncAttr)))) + return emitError(loc, "'acc.serial' op ""attribute 'asyncAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_waitAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_waitAttr)))) + return emitError(loc, "'acc.serial' op ""attribute 'waitAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_selfAttr && !((::llvm::isa<::mlir::UnitAttr>(tblgen_selfAttr)))) + return emitError(loc, "'acc.serial' op ""attribute 'selfAttr' failed to satisfy constraint: unit attribute"); + + if (tblgen_reductionRecipes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reductionRecipes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reductionRecipes), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'acc.serial' op ""attribute 'reductionRecipes' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_privatizations && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_privatizations))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_privatizations), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'acc.serial' op ""attribute 'privatizations' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_firstprivatizations && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_firstprivatizations))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_firstprivatizations), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'acc.serial' op ""attribute 'firstprivatizations' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_defaultAttr && !((::llvm::isa<::mlir::acc::ClauseDefaultValueAttr>(tblgen_defaultAttr)))) + return emitError(loc, "'acc.serial' op ""attribute 'defaultAttr' failed to satisfy constraint: DefaultValue Clause"); + return ::mlir::success(); +} + +std::pair SerialOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SerialOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SerialOp::getAsync() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range SerialOp::getWaitOperands() { + return getODSOperands(1); +} + +::mlir::TypedValue<::mlir::IntegerType> SerialOp::getIfCond() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> SerialOp::getSelfCond() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range SerialOp::getReductionOperands() { + return getODSOperands(4); +} + +::mlir::Operation::operand_range SerialOp::getGangPrivateOperands() { + return getODSOperands(5); +} + +::mlir::Operation::operand_range SerialOp::getGangFirstPrivateOperands() { + return getODSOperands(6); +} + +::mlir::Operation::operand_range SerialOp::getDataClauseOperands() { + return getODSOperands(7); +} + +::mlir::MutableOperandRange SerialOp::getAsyncMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SerialOp::getWaitOperandsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SerialOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SerialOp::getSelfCondMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SerialOp::getReductionOperandsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SerialOp::getGangPrivateOperandsMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SerialOp::getGangFirstPrivateOperandsMutable() { + auto range = getODSOperandIndexAndLength(6); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SerialOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(7); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(7u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair SerialOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SerialOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &SerialOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult SerialOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.asyncAttr; + auto attr = dict.get("asyncAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for asyncAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `asyncAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.defaultAttr; + auto attr = dict.get("defaultAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for defaultAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `defaultAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.firstprivatizations; + auto attr = dict.get("firstprivatizations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for firstprivatizations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `firstprivatizations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.privatizations; + auto attr = dict.get("privatizations"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for privatizations in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `privatizations` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.reductionRecipes; + auto attr = dict.get("reductionRecipes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for reductionRecipes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductionRecipes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.selfAttr; + auto attr = dict.get("selfAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for selfAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `selfAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.waitAttr; + auto attr = dict.get("waitAttr"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for waitAttr in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `waitAttr` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SerialOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.asyncAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("asyncAttr", + propStorage)); + } + + { + const auto &propStorage = prop.defaultAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("defaultAttr", + propStorage)); + } + + { + const auto &propStorage = prop.firstprivatizations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("firstprivatizations", + propStorage)); + } + + { + const auto &propStorage = prop.privatizations; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("privatizations", + propStorage)); + } + + { + const auto &propStorage = prop.reductionRecipes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductionRecipes", + propStorage)); + } + + { + const auto &propStorage = prop.selfAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("selfAttr", + propStorage)); + } + + { + const auto &propStorage = prop.waitAttr; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("waitAttr", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SerialOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.asyncAttr.getAsOpaquePointer()), + llvm::hash_value(prop.defaultAttr.getAsOpaquePointer()), + llvm::hash_value(prop.firstprivatizations.getAsOpaquePointer()), + llvm::hash_value(prop.privatizations.getAsOpaquePointer()), + llvm::hash_value(prop.reductionRecipes.getAsOpaquePointer()), + llvm::hash_value(prop.selfAttr.getAsOpaquePointer()), + llvm::hash_value(prop.waitAttr.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SerialOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "asyncAttr") + return prop.asyncAttr; + + if (name == "defaultAttr") + return prop.defaultAttr; + + if (name == "firstprivatizations") + return prop.firstprivatizations; + + if (name == "privatizations") + return prop.privatizations; + + if (name == "reductionRecipes") + return prop.reductionRecipes; + + if (name == "selfAttr") + return prop.selfAttr; + + if (name == "waitAttr") + return prop.waitAttr; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SerialOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "asyncAttr") { + prop.asyncAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "defaultAttr") { + prop.defaultAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "firstprivatizations") { + prop.firstprivatizations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "privatizations") { + prop.privatizations = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "reductionRecipes") { + prop.reductionRecipes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "selfAttr") { + prop.selfAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "waitAttr") { + prop.waitAttr = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SerialOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.asyncAttr) attrs.append("asyncAttr", prop.asyncAttr); + + if (prop.defaultAttr) attrs.append("defaultAttr", prop.defaultAttr); + + if (prop.firstprivatizations) attrs.append("firstprivatizations", prop.firstprivatizations); + + if (prop.privatizations) attrs.append("privatizations", prop.privatizations); + + if (prop.reductionRecipes) attrs.append("reductionRecipes", prop.reductionRecipes); + + if (prop.selfAttr) attrs.append("selfAttr", prop.selfAttr); + + if (prop.waitAttr) attrs.append("waitAttr", prop.waitAttr); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SerialOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAsyncAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "asyncAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getDefaultAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps5(attr, "defaultAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFirstprivatizationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(attr, "firstprivatizations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getPrivatizationsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(attr, "privatizations", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReductionRecipesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(attr, "reductionRecipes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSelfAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "selfAttr", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWaitAttrAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "waitAttr", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SerialOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.asyncAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.defaultAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.firstprivatizations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.privatizations))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.reductionRecipes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.selfAttr))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.waitAttr))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SerialOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.asyncAttr); + + writer.writeOptionalAttribute(prop.defaultAttr); + + writer.writeOptionalAttribute(prop.firstprivatizations); + + writer.writeOptionalAttribute(prop.privatizations); + + writer.writeOptionalAttribute(prop.reductionRecipes); + + writer.writeOptionalAttribute(prop.selfAttr); + + writer.writeOptionalAttribute(prop.waitAttr); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr SerialOp::getAsyncAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().asyncAttr); +} + +bool SerialOp::getAsyncAttr() { + auto attr = getAsyncAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr SerialOp::getWaitAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().waitAttr); +} + +bool SerialOp::getWaitAttr() { + auto attr = getWaitAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr SerialOp::getSelfAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().selfAttr); +} + +bool SerialOp::getSelfAttr() { + auto attr = getSelfAttrAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr SerialOp::getReductionRecipesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductionRecipes); +} + +::std::optional< ::mlir::ArrayAttr > SerialOp::getReductionRecipes() { + auto attr = getReductionRecipesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr SerialOp::getPrivatizationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().privatizations); +} + +::std::optional< ::mlir::ArrayAttr > SerialOp::getPrivatizations() { + auto attr = getPrivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr SerialOp::getFirstprivatizationsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().firstprivatizations); +} + +::std::optional< ::mlir::ArrayAttr > SerialOp::getFirstprivatizations() { + auto attr = getFirstprivatizationsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::acc::ClauseDefaultValueAttr SerialOp::getDefaultAttrAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); +} + +::std::optional<::mlir::acc::ClauseDefaultValue> SerialOp::getDefaultAttr() { + auto attr = getDefaultAttrAttr(); + return attr ? ::std::optional<::mlir::acc::ClauseDefaultValue>(attr.getValue()) : (::std::nullopt); +} + +void SerialOp::setAsyncAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getAsyncAttrAttrName(), attr); +} + +void SerialOp::setAsyncAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getAsyncAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getAsyncAttrAttrName()); +} + +void SerialOp::setWaitAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWaitAttrAttrName(), attr); +} + +void SerialOp::setWaitAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWaitAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWaitAttrAttrName()); +} + +void SerialOp::setSelfAttrAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getSelfAttrAttrName(), attr); +} + +void SerialOp::setSelfAttr(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getSelfAttrAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getSelfAttrAttrName()); +} + +void SerialOp::setReductionRecipesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReductionRecipesAttrName(), attr); +} + +void SerialOp::setPrivatizationsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getPrivatizationsAttrName(), attr); +} + +void SerialOp::setFirstprivatizationsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getFirstprivatizationsAttrName(), attr); +} + +void SerialOp::setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr) { + (*this)->setAttr(getDefaultAttrAttrName(), attr); +} + +void SerialOp::setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue) { + if (attrValue) + return (*this)->setAttr(getDefaultAttrAttrName(), ::mlir::acc::ClauseDefaultValueAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getDefaultAttrAttrName()); +} + +::mlir::Attribute SerialOp::removeAsyncAttrAttr() { + auto &attr = getProperties().asyncAttr; + attr = {}; + return attr; +} + +::mlir::Attribute SerialOp::removeWaitAttrAttr() { + auto &attr = getProperties().waitAttr; + attr = {}; + return attr; +} + +::mlir::Attribute SerialOp::removeSelfAttrAttr() { + auto &attr = getProperties().selfAttr; + attr = {}; + return attr; +} + +::mlir::Attribute SerialOp::removeReductionRecipesAttr() { + auto &attr = getProperties().reductionRecipes; + attr = {}; + return attr; +} + +::mlir::Attribute SerialOp::removePrivatizationsAttr() { + auto &attr = getProperties().privatizations; + attr = {}; + return attr; +} + +::mlir::Attribute SerialOp::removeFirstprivatizationsAttr() { + auto &attr = getProperties().firstprivatizations; + attr = {}; + return attr; +} + +::mlir::Attribute SerialOp::removeDefaultAttrAttr() { + auto &attr = getProperties().defaultAttr; + attr = {}; + return attr; +} + +void SerialOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(reductionOperands); + odsState.addOperands(gangPrivateOperands); + odsState.addOperands(gangFirstPrivateOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(reductionOperands.size()), static_cast(gangPrivateOperands.size()), static_cast(gangFirstPrivateOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = asyncAttr; + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = waitAttr; + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = selfAttr; + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (firstprivatizations) { + odsState.getOrAddProperties().firstprivatizations = firstprivatizations; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); +} + +void SerialOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(reductionOperands); + odsState.addOperands(gangPrivateOperands); + odsState.addOperands(gangFirstPrivateOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(reductionOperands.size()), static_cast(gangPrivateOperands.size()), static_cast(gangFirstPrivateOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = asyncAttr; + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = waitAttr; + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = selfAttr; + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (firstprivatizations) { + odsState.getOrAddProperties().firstprivatizations = firstprivatizations; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SerialOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(reductionOperands); + odsState.addOperands(gangPrivateOperands); + odsState.addOperands(gangFirstPrivateOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(reductionOperands.size()), static_cast(gangPrivateOperands.size()), static_cast(gangFirstPrivateOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = ((asyncAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = ((waitAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = ((selfAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (firstprivatizations) { + odsState.getOrAddProperties().firstprivatizations = firstprivatizations; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); +} + +void SerialOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr) { + if (async) + odsState.addOperands(async); + odsState.addOperands(waitOperands); + if (ifCond) + odsState.addOperands(ifCond); + if (selfCond) + odsState.addOperands(selfCond); + odsState.addOperands(reductionOperands); + odsState.addOperands(gangPrivateOperands); + odsState.addOperands(gangFirstPrivateOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(async ? 1 : 0), static_cast(waitOperands.size()), (ifCond ? 1 : 0), (selfCond ? 1 : 0), static_cast(reductionOperands.size()), static_cast(gangPrivateOperands.size()), static_cast(gangFirstPrivateOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (asyncAttr) { + odsState.getOrAddProperties().asyncAttr = ((asyncAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (waitAttr) { + odsState.getOrAddProperties().waitAttr = ((waitAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (selfAttr) { + odsState.getOrAddProperties().selfAttr = ((selfAttr) ? odsBuilder.getUnitAttr() : nullptr); + } + if (reductionRecipes) { + odsState.getOrAddProperties().reductionRecipes = reductionRecipes; + } + if (privatizations) { + odsState.getOrAddProperties().privatizations = privatizations; + } + if (firstprivatizations) { + odsState.getOrAddProperties().firstprivatizations = firstprivatizations; + } + if (defaultAttr) { + odsState.getOrAddProperties().defaultAttr = defaultAttr; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SerialOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SerialOp::verifyInvariantsImpl() { + auto tblgen_asyncAttr = getProperties().asyncAttr; (void)tblgen_asyncAttr; + auto tblgen_defaultAttr = getProperties().defaultAttr; (void)tblgen_defaultAttr; + auto tblgen_firstprivatizations = getProperties().firstprivatizations; (void)tblgen_firstprivatizations; + auto tblgen_privatizations = getProperties().privatizations; (void)tblgen_privatizations; + auto tblgen_reductionRecipes = getProperties().reductionRecipes; (void)tblgen_reductionRecipes; + auto tblgen_selfAttr = getProperties().selfAttr; (void)tblgen_selfAttr; + auto tblgen_waitAttr = getProperties().waitAttr; (void)tblgen_waitAttr; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_asyncAttr, "asyncAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_waitAttr, "waitAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_selfAttr, "selfAttr"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(*this, tblgen_reductionRecipes, "reductionRecipes"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(*this, tblgen_privatizations, "privatizations"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps7(*this, tblgen_firstprivatizations, "firstprivatizations"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps5(*this, tblgen_defaultAttr, "defaultAttr"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup7 = getODSOperands(7); + + for (auto v : valueGroup7) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenACCOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SerialOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SerialOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncOperands; + ::llvm::SMLoc asyncOperandsLoc; + (void)asyncOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> asyncTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> gangFirstPrivateOperandsOperands; + ::llvm::SMLoc gangFirstPrivateOperandsOperandsLoc; + (void)gangFirstPrivateOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> gangFirstPrivateOperandsTypes; + ::mlir::ArrayAttr firstprivatizationsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> gangPrivateOperandsOperands; + ::llvm::SMLoc gangPrivateOperandsOperandsLoc; + (void)gangPrivateOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> gangPrivateOperandsTypes; + ::mlir::ArrayAttr privatizationsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitOperandsOperands; + ::llvm::SMLoc waitOperandsOperandsLoc; + (void)waitOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> selfCondOperands; + ::llvm::SMLoc selfCondOperandsLoc; + (void)selfCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> reductionOperandsOperands; + ::llvm::SMLoc reductionOperandsOperandsLoc; + (void)reductionOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> reductionOperandsTypes; + ::mlir::ArrayAttr reductionRecipesAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool dataOperandsClause = false; + bool asyncClause = false; + bool firstprivateClause = false; + bool privateClause = false; + bool waitClause = false; + bool selfClause = false; + bool ifClause = false; + bool reductionClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("async"))) { + + if (asyncClause) { + return parser.emitError(parser.getNameLoc()) + << "`async` clause can appear at most once in the expansion of the " + "oilist directive"; + } + asyncClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + asyncOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("firstprivate"))) { + + if (firstprivateClause) { + return parser.emitError(parser.getNameLoc()) + << "`firstprivate` clause can appear at most once in the expansion of the " + "oilist directive"; + } + firstprivateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + gangFirstPrivateOperandsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseSymOperandList(parser, gangFirstPrivateOperandsOperands, gangFirstPrivateOperandsTypes, firstprivatizationsAttr); + if (odsResult) return ::mlir::failure(); + if (firstprivatizationsAttr) + result.getOrAddProperties().firstprivatizations = firstprivatizationsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("private"))) { + + if (privateClause) { + return parser.emitError(parser.getNameLoc()) + << "`private` clause can appear at most once in the expansion of the " + "oilist directive"; + } + privateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + gangPrivateOperandsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseSymOperandList(parser, gangPrivateOperandsOperands, gangPrivateOperandsTypes, privatizationsAttr); + if (odsResult) return ::mlir::failure(); + if (privatizationsAttr) + result.getOrAddProperties().privatizations = privatizationsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait"))) { + + if (waitClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + waitClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + waitOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(waitOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(waitOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("self"))) { + + if (selfClause) { + return parser.emitError(parser.getNameLoc()) + << "`self` clause can appear at most once in the expansion of the " + "oilist directive"; + } + selfClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + selfCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + selfCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("reduction"))) { + + if (reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + reductionOperandsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseSymOperandList(parser, reductionOperandsOperands, reductionOperandsTypes, reductionRecipesAttr); + if (odsResult) return ::mlir::failure(); + if (reductionRecipesAttr) + result.getOrAddProperties().reductionRecipes = reductionRecipesAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(asyncOperands.size()), static_cast(waitOperandsOperands.size()), static_cast(ifCondOperands.size()), static_cast(selfCondOperands.size()), static_cast(reductionOperandsOperands.size()), static_cast(gangPrivateOperandsOperands.size()), static_cast(gangFirstPrivateOperandsOperands.size()), static_cast(dataClauseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(asyncOperands, asyncTypes, asyncOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitOperandsOperands, waitOperandsTypes, waitOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(selfCondOperands, odsBuildableType0, selfCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(reductionOperandsOperands, reductionOperandsTypes, reductionOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(gangPrivateOperandsOperands, gangPrivateOperandsTypes, gangPrivateOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(gangFirstPrivateOperandsOperands, gangFirstPrivateOperandsTypes, gangFirstPrivateOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SerialOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getAsync()) { + _odsPrinter << ' ' << "async"; + _odsPrinter << "("; + if (::mlir::Value value = getAsync()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getAsync() ? ::llvm::ArrayRef<::mlir::Type>(getAsync().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getGangFirstPrivateOperands().size() || getFirstprivatizationsAttr()) { + _odsPrinter << ' ' << "firstprivate"; + _odsPrinter << "("; + printSymOperandList(_odsPrinter, *this, getGangFirstPrivateOperands(), getGangFirstPrivateOperands().getTypes(), getFirstprivatizationsAttr()); + _odsPrinter << ")"; + } + if (false || getGangPrivateOperands().size() || getPrivatizationsAttr()) { + _odsPrinter << ' ' << "private"; + _odsPrinter << "("; + printSymOperandList(_odsPrinter, *this, getGangPrivateOperands(), getGangPrivateOperands().getTypes(), getPrivatizationsAttr()); + _odsPrinter << ")"; + } + if (false || getWaitOperands().size()) { + _odsPrinter << ' ' << "wait"; + _odsPrinter << "("; + _odsPrinter << getWaitOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getWaitOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getSelfCond()) { + _odsPrinter << ' ' << "self"; + _odsPrinter << "("; + if (::mlir::Value value = getSelfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getReductionOperands().size() || getReductionRecipesAttr()) { + _odsPrinter << ' ' << "reduction"; + _odsPrinter << "("; + printSymOperandList(_odsPrinter, *this, getReductionOperands(), getReductionOperands().getTypes(), getReductionRecipesAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("firstprivatizations"); + elidedAttrs.push_back("privatizations"); + elidedAttrs.push_back("reductionRecipes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAsyncAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("asyncAttr"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWaitAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("waitAttr"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getSelfAttrAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("selfAttr"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::SerialOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::SetOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SetOpGenericAdaptorBase::SetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.set", odsAttrs.getContext()); +} + +SetOpGenericAdaptorBase::SetOpGenericAdaptorBase(SetOp op) : SetOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SetOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SetOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +SetOpAdaptor::SetOpAdaptor(SetOp op) : SetOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SetOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SetOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SetOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value SetOp::getDeviceType() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value SetOp::getDefaultAsync() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value SetOp::getDeviceNum() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> SetOp::getIfCond() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::MutableOperandRange SetOp::getDeviceTypeMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SetOp::getDefaultAsyncMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SetOp::getDeviceNumMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SetOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair SetOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SetOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult SetOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SetOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SetOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SetOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SetOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SetOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SetOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult SetOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SetOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void SetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value deviceType, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond) { + if (deviceType) + odsState.addOperands(deviceType); + if (defaultAsync) + odsState.addOperands(defaultAsync); + if (deviceNum) + odsState.addOperands(deviceNum); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({(deviceType ? 1 : 0), (defaultAsync ? 1 : 0), (deviceNum ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); +} + +void SetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value deviceType, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond) { + if (deviceType) + odsState.addOperands(deviceType); + if (defaultAsync) + odsState.addOperands(defaultAsync); + if (deviceNum) + odsState.addOperands(deviceNum); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({(deviceType ? 1 : 0), (defaultAsync ? 1 : 0), (deviceNum ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SetOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SetOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult SetOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SetOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceTypeOperands; + ::llvm::SMLoc deviceTypeOperandsLoc; + (void)deviceTypeOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceTypeTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> defaultAsyncOperands; + ::llvm::SMLoc defaultAsyncOperandsLoc; + (void)defaultAsyncOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> defaultAsyncTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceNumOperands; + ::llvm::SMLoc deviceNumOperandsLoc; + (void)deviceNumOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceNumTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + bool device_typeClause = false; + bool default_asyncClause = false; + bool device_numClause = false; + bool ifClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("device_type"))) { + + if (device_typeClause) { + return parser.emitError(parser.getNameLoc()) + << "`device_type` clause can appear at most once in the expansion of the " + "oilist directive"; + } + device_typeClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + deviceTypeOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceTypeOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceTypeTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("default_async"))) { + + if (default_asyncClause) { + return parser.emitError(parser.getNameLoc()) + << "`default_async` clause can appear at most once in the expansion of the " + "oilist directive"; + } + default_asyncClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + defaultAsyncOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + defaultAsyncOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + defaultAsyncTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("device_num"))) { + + if (device_numClause) { + return parser.emitError(parser.getNameLoc()) + << "`device_num` clause can appear at most once in the expansion of the " + "oilist directive"; + } + device_numClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + deviceNumOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceNumOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceNumTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(deviceTypeOperands.size()), static_cast(defaultAsyncOperands.size()), static_cast(deviceNumOperands.size()), static_cast(ifCondOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(deviceTypeOperands, deviceTypeTypes, deviceTypeOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(defaultAsyncOperands, defaultAsyncTypes, defaultAsyncOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(deviceNumOperands, deviceNumTypes, deviceNumOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SetOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getDeviceType()) { + _odsPrinter << ' ' << "device_type"; + _odsPrinter << "("; + if (::mlir::Value value = getDeviceType()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getDeviceType() ? ::llvm::ArrayRef<::mlir::Type>(getDeviceType().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getDefaultAsync()) { + _odsPrinter << ' ' << "default_async"; + _odsPrinter << "("; + if (::mlir::Value value = getDefaultAsync()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getDefaultAsync() ? ::llvm::ArrayRef<::mlir::Type>(getDefaultAsync().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getDeviceNum()) { + _odsPrinter << ' ' << "device_num"; + _odsPrinter << "("; + if (::mlir::Value value = getDeviceNum()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getDeviceNum() ? ::llvm::ArrayRef<::mlir::Type>(getDeviceNum().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::SetOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ShutdownOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ShutdownOpGenericAdaptorBase::ShutdownOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.shutdown", odsAttrs.getContext()); +} + +ShutdownOpGenericAdaptorBase::ShutdownOpGenericAdaptorBase(ShutdownOp op) : ShutdownOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ShutdownOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ShutdownOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ShutdownOpAdaptor::ShutdownOpAdaptor(ShutdownOp op) : ShutdownOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ShutdownOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ShutdownOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ShutdownOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ShutdownOp::getDeviceTypeOperands() { + return getODSOperands(0); +} + +::mlir::Value ShutdownOp::getDeviceNumOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ShutdownOp::getIfCond() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::MutableOperandRange ShutdownOp::getDeviceTypeOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ShutdownOp::getDeviceNumOperandMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ShutdownOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ShutdownOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ShutdownOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult ShutdownOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ShutdownOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ShutdownOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ShutdownOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ShutdownOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ShutdownOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ShutdownOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult ShutdownOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ShutdownOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void ShutdownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange deviceTypeOperands, /*optional*/::mlir::Value deviceNumOperand, /*optional*/::mlir::Value ifCond) { + odsState.addOperands(deviceTypeOperands); + if (deviceNumOperand) + odsState.addOperands(deviceNumOperand); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({static_cast(deviceTypeOperands.size()), (deviceNumOperand ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); +} + +void ShutdownOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange deviceTypeOperands, /*optional*/::mlir::Value deviceNumOperand, /*optional*/::mlir::Value ifCond) { + odsState.addOperands(deviceTypeOperands); + if (deviceNumOperand) + odsState.addOperands(deviceNumOperand); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({static_cast(deviceTypeOperands.size()), (deviceNumOperand ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ShutdownOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ShutdownOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ShutdownOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ShutdownOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceTypeOperandsOperands; + ::llvm::SMLoc deviceTypeOperandsOperandsLoc; + (void)deviceTypeOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceTypeOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceNumOperandOperands; + ::llvm::SMLoc deviceNumOperandOperandsLoc; + (void)deviceNumOperandOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceNumOperandTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + bool device_typeClause = false; + bool device_numClause = false; + bool ifClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("device_type"))) { + + if (device_typeClause) { + return parser.emitError(parser.getNameLoc()) + << "`device_type` clause can appear at most once in the expansion of the " + "oilist directive"; + } + device_typeClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + deviceTypeOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(deviceTypeOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(deviceTypeOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("device_num"))) { + + if (device_numClause) { + return parser.emitError(parser.getNameLoc()) + << "`device_num` clause can appear at most once in the expansion of the " + "oilist directive"; + } + device_numClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + deviceNumOperandOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceNumOperandOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceNumOperandTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(deviceTypeOperandsOperands.size()), static_cast(deviceNumOperandOperands.size()), static_cast(ifCondOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(deviceTypeOperandsOperands, deviceTypeOperandsTypes, deviceTypeOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(deviceNumOperandOperands, deviceNumOperandTypes, deviceNumOperandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ShutdownOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getDeviceTypeOperands().size()) { + _odsPrinter << ' ' << "device_type"; + _odsPrinter << "("; + _odsPrinter << getDeviceTypeOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDeviceTypeOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getDeviceNumOperand()) { + _odsPrinter << ' ' << "device_num"; + _odsPrinter << "("; + if (::mlir::Value value = getDeviceNumOperand()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getDeviceNumOperand() ? ::llvm::ArrayRef<::mlir::Type>(getDeviceNumOperand().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ShutdownOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::TerminatorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TerminatorOpGenericAdaptorBase::TerminatorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.terminator", odsAttrs.getContext()); +} + +TerminatorOpGenericAdaptorBase::TerminatorOpGenericAdaptorBase(TerminatorOp op) : TerminatorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TerminatorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TerminatorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TerminatorOpAdaptor::TerminatorOpAdaptor(TerminatorOp op) : TerminatorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TerminatorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TerminatorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TerminatorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair TerminatorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TerminatorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void TerminatorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void TerminatorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TerminatorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TerminatorOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult TerminatorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TerminatorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TerminatorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::TerminatorOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::UpdateDeviceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UpdateDeviceOpGenericAdaptorBase::UpdateDeviceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.update_device", odsAttrs.getContext()); +} + +UpdateDeviceOpGenericAdaptorBase::UpdateDeviceOpGenericAdaptorBase(UpdateDeviceOp op) : UpdateDeviceOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UpdateDeviceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr UpdateDeviceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr UpdateDeviceOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause UpdateDeviceOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UpdateDeviceOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool UpdateDeviceOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UpdateDeviceOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool UpdateDeviceOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr UpdateDeviceOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > UpdateDeviceOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +UpdateDeviceOpAdaptor::UpdateDeviceOpAdaptor(UpdateDeviceOp op) : UpdateDeviceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UpdateDeviceOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.update_device' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.update_device' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.update_device' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.update_device' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair UpdateDeviceOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range UpdateDeviceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> UpdateDeviceOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> UpdateDeviceOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range UpdateDeviceOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &UpdateDeviceOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange UpdateDeviceOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange UpdateDeviceOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair UpdateDeviceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UpdateDeviceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> UpdateDeviceOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult UpdateDeviceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute UpdateDeviceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code UpdateDeviceOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional UpdateDeviceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void UpdateDeviceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void UpdateDeviceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult UpdateDeviceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult UpdateDeviceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void UpdateDeviceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr UpdateDeviceOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause UpdateDeviceOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UpdateDeviceOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool UpdateDeviceOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UpdateDeviceOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool UpdateDeviceOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr UpdateDeviceOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > UpdateDeviceOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void UpdateDeviceOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void UpdateDeviceOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void UpdateDeviceOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void UpdateDeviceOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void UpdateDeviceOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void UpdateDeviceOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void UpdateDeviceOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void UpdateDeviceOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute UpdateDeviceOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void UpdateDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void UpdateDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UpdateDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void UpdateDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UpdateDeviceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void UpdateDeviceOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_update_device); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult UpdateDeviceOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UpdateDeviceOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult UpdateDeviceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UpdateDeviceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_update_device))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::UpdateDeviceOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::UpdateHostOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UpdateHostOpGenericAdaptorBase::UpdateHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.update_host", odsAttrs.getContext()); +} + +UpdateHostOpGenericAdaptorBase::UpdateHostOpGenericAdaptorBase(UpdateHostOp op) : UpdateHostOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UpdateHostOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr UpdateHostOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr UpdateHostOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause UpdateHostOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UpdateHostOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool UpdateHostOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UpdateHostOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool UpdateHostOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr UpdateHostOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > UpdateHostOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +UpdateHostOpAdaptor::UpdateHostOpAdaptor(UpdateHostOp op) : UpdateHostOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UpdateHostOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.update_host' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.update_host' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.update_host' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.update_host' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair UpdateHostOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range UpdateHostOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> UpdateHostOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> UpdateHostOp::getVarPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range UpdateHostOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &UpdateHostOp::getAccPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange UpdateHostOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange UpdateHostOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair UpdateHostOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UpdateHostOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult UpdateHostOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute UpdateHostOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code UpdateHostOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional UpdateHostOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void UpdateHostOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void UpdateHostOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult UpdateHostOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult UpdateHostOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void UpdateHostOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr UpdateHostOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause UpdateHostOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UpdateHostOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool UpdateHostOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UpdateHostOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool UpdateHostOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr UpdateHostOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > UpdateHostOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void UpdateHostOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void UpdateHostOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void UpdateHostOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void UpdateHostOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void UpdateHostOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void UpdateHostOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void UpdateHostOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void UpdateHostOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute UpdateHostOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void UpdateHostOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } +} + +void UpdateHostOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UpdateHostOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } +} + +void UpdateHostOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(accPtr); + if (varPtr) + odsState.addOperands(varPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UpdateHostOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void UpdateHostOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_update_host); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult UpdateHostOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UpdateHostOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult UpdateHostOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand accPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accPtrOperands(accPtrRawOperands); ::llvm::SMLoc accPtrOperandsLoc; + (void)accPtrOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrOperands; + ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrTypes; + if (parser.parseKeyword("accPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + accPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool boundsClause = false; + bool toClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("to"))) { + + if (toClause) { + return parser.emitError(parser.getNameLoc()) + << "`to` clause can appear at most once in the expansion of the " + "oilist directive"; + } + toClause = true; + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + if (parser.resolveOperands(accPtrOperands, accPtrTypes, accPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UpdateHostOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "accPtr"; + _odsPrinter << "("; + _odsPrinter << getAccPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + if (false || getVarPtr()) { + _odsPrinter << ' ' << "to"; + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_update_host))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::UpdateHostOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::UpdateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UpdateOpGenericAdaptorBase::UpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.update", odsAttrs.getContext()); +} + +UpdateOpGenericAdaptorBase::UpdateOpGenericAdaptorBase(UpdateOp op) : UpdateOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UpdateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr UpdateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr UpdateOpGenericAdaptorBase::getAsyncAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool UpdateOpGenericAdaptorBase::getAsync() { + auto attr = getAsyncAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr UpdateOpGenericAdaptorBase::getWaitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().wait); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool UpdateOpGenericAdaptorBase::getWait() { + auto attr = getWaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr UpdateOpGenericAdaptorBase::getIfPresentAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().ifPresent); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool UpdateOpGenericAdaptorBase::getIfPresent() { + auto attr = getIfPresentAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +UpdateOpAdaptor::UpdateOpAdaptor(UpdateOp op) : UpdateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UpdateOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_async = getProperties().async; (void)tblgen_async; + auto tblgen_ifPresent = getProperties().ifPresent; (void)tblgen_ifPresent; + auto tblgen_wait = getProperties().wait; (void)tblgen_wait; + + if (tblgen_async && !((::llvm::isa<::mlir::UnitAttr>(tblgen_async)))) + return emitError(loc, "'acc.update' op ""attribute 'async' failed to satisfy constraint: unit attribute"); + + if (tblgen_wait && !((::llvm::isa<::mlir::UnitAttr>(tblgen_wait)))) + return emitError(loc, "'acc.update' op ""attribute 'wait' failed to satisfy constraint: unit attribute"); + + if (tblgen_ifPresent && !((::llvm::isa<::mlir::UnitAttr>(tblgen_ifPresent)))) + return emitError(loc, "'acc.update' op ""attribute 'ifPresent' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair UpdateOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range UpdateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> UpdateOp::getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Value UpdateOp::getAsyncOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value UpdateOp::getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range UpdateOp::getWaitOperands() { + return getODSOperands(3); +} + +::mlir::Operation::operand_range UpdateOp::getDeviceTypeOperands() { + return getODSOperands(4); +} + +::mlir::Operation::operand_range UpdateOp::getDataClauseOperands() { + return getODSOperands(5); +} + +::mlir::MutableOperandRange UpdateOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange UpdateOp::getAsyncOperandMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange UpdateOp::getWaitDevnumMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange UpdateOp::getWaitOperandsMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange UpdateOp::getDeviceTypeOperandsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange UpdateOp::getDataClauseOperandsMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair UpdateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UpdateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult UpdateOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.async; + auto attr = dict.get("async"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for async in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `async` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.ifPresent; + auto attr = dict.get("ifPresent"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for ifPresent in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `ifPresent` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.wait; + auto attr = dict.get("wait"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for wait in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `wait` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute UpdateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.async; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("async", + propStorage)); + } + + { + const auto &propStorage = prop.ifPresent; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("ifPresent", + propStorage)); + } + + { + const auto &propStorage = prop.wait; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("wait", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code UpdateOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.async.getAsOpaquePointer()), + llvm::hash_value(prop.ifPresent.getAsOpaquePointer()), + llvm::hash_value(prop.wait.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional UpdateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "async") + return prop.async; + + if (name == "ifPresent") + return prop.ifPresent; + + if (name == "wait") + return prop.wait; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void UpdateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "async") { + prop.async = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "ifPresent") { + prop.ifPresent = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "wait") { + prop.wait = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void UpdateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.async) attrs.append("async", prop.async); + + if (prop.ifPresent) attrs.append("ifPresent", prop.ifPresent); + + if (prop.wait) attrs.append("wait", prop.wait); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult UpdateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAsyncAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "async", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getIfPresentAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "ifPresent", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getWaitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "wait", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult UpdateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.async))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.ifPresent))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.wait))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void UpdateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.async); + + writer.writeOptionalAttribute(prop.ifPresent); + + writer.writeOptionalAttribute(prop.wait); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr UpdateOp::getAsyncAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); +} + +bool UpdateOp::getAsync() { + auto attr = getAsyncAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr UpdateOp::getWaitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().wait); +} + +bool UpdateOp::getWait() { + auto attr = getWaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr UpdateOp::getIfPresentAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().ifPresent); +} + +bool UpdateOp::getIfPresent() { + auto attr = getIfPresentAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void UpdateOp::setAsyncAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getAsyncAttrName(), attr); +} + +void UpdateOp::setAsync(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getAsyncAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getAsyncAttrName()); +} + +void UpdateOp::setWaitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getWaitAttrName(), attr); +} + +void UpdateOp::setWait(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getWaitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getWaitAttrName()); +} + +void UpdateOp::setIfPresentAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getIfPresentAttrName(), attr); +} + +void UpdateOp::setIfPresent(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getIfPresentAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getIfPresentAttrName()); +} + +::mlir::Attribute UpdateOp::removeAsyncAttr() { + auto &attr = getProperties().async; + attr = {}; + return attr; +} + +::mlir::Attribute UpdateOp::removeWaitAttr() { + auto &attr = getProperties().wait; + attr = {}; + return attr; +} + +::mlir::Attribute UpdateOp::removeIfPresentAttr() { + auto &attr = getProperties().ifPresent; + attr = {}; + return attr; +} + +void UpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange deviceTypeOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(deviceTypeOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(deviceTypeOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = async; + } + if (wait) { + odsState.getOrAddProperties().wait = wait; + } + if (ifPresent) { + odsState.getOrAddProperties().ifPresent = ifPresent; + } +} + +void UpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange deviceTypeOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(deviceTypeOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(deviceTypeOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = async; + } + if (wait) { + odsState.getOrAddProperties().wait = wait; + } + if (ifPresent) { + odsState.getOrAddProperties().ifPresent = ifPresent; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool async, /*optional*/bool wait, ::mlir::ValueRange deviceTypeOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(deviceTypeOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(deviceTypeOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = ((async) ? odsBuilder.getUnitAttr() : nullptr); + } + if (wait) { + odsState.getOrAddProperties().wait = ((wait) ? odsBuilder.getUnitAttr() : nullptr); + } + if (ifPresent) { + odsState.getOrAddProperties().ifPresent = ((ifPresent) ? odsBuilder.getUnitAttr() : nullptr); + } +} + +void UpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool async, /*optional*/bool wait, ::mlir::ValueRange deviceTypeOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent) { + if (ifCond) + odsState.addOperands(ifCond); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + odsState.addOperands(waitOperands); + odsState.addOperands(deviceTypeOperands); + odsState.addOperands(dataClauseOperands); + ::llvm::copy(::llvm::ArrayRef({(ifCond ? 1 : 0), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), static_cast(waitOperands.size()), static_cast(deviceTypeOperands.size()), static_cast(dataClauseOperands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = ((async) ? odsBuilder.getUnitAttr() : nullptr); + } + if (wait) { + odsState.getOrAddProperties().wait = ((wait) ? odsBuilder.getUnitAttr() : nullptr); + } + if (ifPresent) { + odsState.getOrAddProperties().ifPresent = ((ifPresent) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UpdateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult UpdateOp::verifyInvariantsImpl() { + auto tblgen_async = getProperties().async; (void)tblgen_async; + auto tblgen_ifPresent = getProperties().ifPresent; (void)tblgen_ifPresent; + auto tblgen_wait = getProperties().wait; (void)tblgen_wait; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_async, "async"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_wait, "wait"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_ifPresent, "ifPresent"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UpdateOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult UpdateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncOperandOperands; + ::llvm::SMLoc asyncOperandOperandsLoc; + (void)asyncOperandOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> asyncOperandTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitDevnumOperands; + ::llvm::SMLoc waitDevnumOperandsLoc; + (void)waitDevnumOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitDevnumTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceTypeOperandsOperands; + ::llvm::SMLoc deviceTypeOperandsOperandsLoc; + (void)deviceTypeOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceTypeOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitOperandsOperands; + ::llvm::SMLoc waitOperandsOperandsLoc; + (void)waitOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dataClauseOperandsOperands; + ::llvm::SMLoc dataClauseOperandsOperandsLoc; + (void)dataClauseOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> dataClauseOperandsTypes; + bool ifClause = false; + bool asyncClause = false; + bool wait_devnumClause = false; + bool device_typeClause = false; + bool waitClause = false; + bool dataOperandsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("async"))) { + + if (asyncClause) { + return parser.emitError(parser.getNameLoc()) + << "`async` clause can appear at most once in the expansion of the " + "oilist directive"; + } + asyncClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + asyncOperandOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperandOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperandTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait_devnum"))) { + + if (wait_devnumClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait_devnum` clause can appear at most once in the expansion of the " + "oilist directive"; + } + wait_devnumClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + waitDevnumOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("device_type"))) { + + if (device_typeClause) { + return parser.emitError(parser.getNameLoc()) + << "`device_type` clause can appear at most once in the expansion of the " + "oilist directive"; + } + device_typeClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + deviceTypeOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(deviceTypeOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(deviceTypeOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait"))) { + + if (waitClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + waitClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + waitOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(waitOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(waitOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("dataOperands"))) { + + if (dataOperandsClause) { + return parser.emitError(parser.getNameLoc()) + << "`dataOperands` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dataOperandsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + dataClauseOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(dataClauseOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(dataClauseOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(ifCondOperands.size()), static_cast(asyncOperandOperands.size()), static_cast(waitDevnumOperands.size()), static_cast(waitOperandsOperands.size()), static_cast(deviceTypeOperandsOperands.size()), static_cast(dataClauseOperandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(asyncOperandOperands, asyncOperandTypes, asyncOperandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitDevnumOperands, waitDevnumTypes, waitDevnumOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitOperandsOperands, waitOperandsTypes, waitOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(deviceTypeOperandsOperands, deviceTypeOperandsTypes, deviceTypeOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(dataClauseOperandsOperands, dataClauseOperandsTypes, dataClauseOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UpdateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getAsyncOperand()) { + _odsPrinter << ' ' << "async"; + _odsPrinter << "("; + if (::mlir::Value value = getAsyncOperand()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getAsyncOperand() ? ::llvm::ArrayRef<::mlir::Type>(getAsyncOperand().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getWaitDevnum()) { + _odsPrinter << ' ' << "wait_devnum"; + _odsPrinter << "("; + if (::mlir::Value value = getWaitDevnum()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getWaitDevnum() ? ::llvm::ArrayRef<::mlir::Type>(getWaitDevnum().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getDeviceTypeOperands().size()) { + _odsPrinter << ' ' << "device_type"; + _odsPrinter << "("; + _odsPrinter << getDeviceTypeOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDeviceTypeOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getWaitOperands().size()) { + _odsPrinter << ' ' << "wait"; + _odsPrinter << "("; + _odsPrinter << getWaitOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getWaitOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getDataClauseOperands().size()) { + _odsPrinter << ' ' << "dataOperands"; + _odsPrinter << "("; + _odsPrinter << getDataClauseOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDataClauseOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAsyncAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("async"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getWaitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("wait"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getIfPresentAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("ifPresent"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::UpdateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::UseDeviceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +UseDeviceOpGenericAdaptorBase::UseDeviceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.use_device", odsAttrs.getContext()); +} + +UseDeviceOpGenericAdaptorBase::UseDeviceOpGenericAdaptorBase(UseDeviceOp op) : UseDeviceOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair UseDeviceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr UseDeviceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::acc::DataClauseAttr UseDeviceOpGenericAdaptorBase::getDataClauseAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); + return attr; +} + +::mlir::acc::DataClause UseDeviceOpGenericAdaptorBase::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UseDeviceOpGenericAdaptorBase::getStructuredAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); + return attr; +} + +bool UseDeviceOpGenericAdaptorBase::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UseDeviceOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool UseDeviceOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr UseDeviceOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > UseDeviceOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +UseDeviceOpAdaptor::UseDeviceOpAdaptor(UseDeviceOp op) : UseDeviceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult UseDeviceOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (tblgen_dataClause && !((::llvm::isa<::mlir::acc::DataClauseAttr>(tblgen_dataClause)))) + return emitError(loc, "'acc.use_device' op ""attribute 'dataClause' failed to satisfy constraint: data clauses supported by OpenACC"); + + if (tblgen_structured && !((::llvm::isa<::mlir::BoolAttr>(tblgen_structured)))) + return emitError(loc, "'acc.use_device' op ""attribute 'structured' failed to satisfy constraint: bool attribute"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'acc.use_device' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'acc.use_device' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair UseDeviceOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range UseDeviceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> UseDeviceOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> UseDeviceOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range UseDeviceOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &UseDeviceOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange UseDeviceOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange UseDeviceOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair UseDeviceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range UseDeviceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::acc::PointerLikeType> UseDeviceOp::getAccPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult UseDeviceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.dataClause; + auto attr = dict.get("dataClause"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for dataClause in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `dataClause` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.structured; + auto attr = dict.get("structured"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for structured in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `structured` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute UseDeviceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.dataClause; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("dataClause", + propStorage)); + } + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.structured; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("structured", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code UseDeviceOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.dataClause.getAsOpaquePointer()), + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + llvm::hash_value(prop.structured.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional UseDeviceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "dataClause") + return prop.dataClause; + + if (name == "implicit") + return prop.implicit; + + if (name == "name") + return prop.name; + + if (name == "structured") + return prop.structured; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void UseDeviceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "dataClause") { + prop.dataClause = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "structured") { + prop.structured = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void UseDeviceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.dataClause) attrs.append("dataClause", prop.dataClause); + + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.name) attrs.append("name", prop.name); + + if (prop.structured) attrs.append("structured", prop.structured); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult UseDeviceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDataClauseAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(attr, "dataClause", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(attr, "name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getStructuredAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(attr, "structured", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult UseDeviceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.dataClause))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.structured))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void UseDeviceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.dataClause); + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.name); + + writer.writeOptionalAttribute(prop.structured); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::acc::DataClauseAttr UseDeviceOp::getDataClauseAttr() { + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); +} + +::mlir::acc::DataClause UseDeviceOp::getDataClause() { + auto attr = getDataClauseAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UseDeviceOp::getStructuredAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); +} + +bool UseDeviceOp::getStructured() { + auto attr = getStructuredAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr UseDeviceOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool UseDeviceOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr UseDeviceOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > UseDeviceOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void UseDeviceOp::setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { + (*this)->setAttr(getDataClauseAttrName(), attr); +} + +void UseDeviceOp::setDataClause(::mlir::acc::DataClause attrValue) { + (*this)->setAttr(getDataClauseAttrName(), ::mlir::acc::DataClauseAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void UseDeviceOp::setStructuredAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStructuredAttrName(), attr); +} + +void UseDeviceOp::setStructured(bool attrValue) { + (*this)->setAttr(getStructuredAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void UseDeviceOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void UseDeviceOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void UseDeviceOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void UseDeviceOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute UseDeviceOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void UseDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void UseDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (dataClause) { + odsState.getOrAddProperties().dataClause = dataClause; + } + if (structured) { + odsState.getOrAddProperties().structured = structured; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UseDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(accPtr); +} + +void UseDeviceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(varPtr); + if (varPtrPtr) + odsState.addOperands(varPtrPtr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (varPtrPtr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), dataClause); + odsState.getOrAddProperties().structured = odsBuilder.getBoolAttr(structured); + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void UseDeviceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void UseDeviceOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.dataClause) + properties.dataClause = ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_use_device); + if (!properties.structured) + properties.structured = odsBuilder.getBoolAttr(true); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult UseDeviceOp::verifyInvariantsImpl() { + auto tblgen_dataClause = getProperties().dataClause; (void)tblgen_dataClause; + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_name = getProperties().name; (void)tblgen_name; + auto tblgen_structured = getProperties().structured; (void)tblgen_structured; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps1(*this, tblgen_dataClause, "dataClause"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_structured, "structured"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps2(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps3(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult UseDeviceOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult UseDeviceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand varPtrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varPtrOperands(varPtrRawOperands); ::llvm::SMLoc varPtrOperandsLoc; + (void)varPtrOperandsLoc; + ::mlir::Type varPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> varPtrTypes(varPtrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varPtrPtrOperands; + ::llvm::SMLoc varPtrPtrOperandsLoc; + (void)varPtrPtrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varPtrPtrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type accPtrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accPtrTypes(accPtrRawTypes); + if (parser.parseKeyword("varPtr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + varPtrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(varPtrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + varPtrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool varPtrPtrClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("varPtrPtr"))) { + + if (varPtrPtrClause) { + return parser.emitError(parser.getNameLoc()) + << "`varPtrPtr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + varPtrPtrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + varPtrPtrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + varPtrPtrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::acc::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accPtrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(varPtrPtrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::acc::DataBoundsType>(); + result.addTypes(accPtrTypes); + if (parser.resolveOperands(varPtrOperands, varPtrTypes, varPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(varPtrPtrOperands, varPtrPtrTypes, varPtrPtrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void UseDeviceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "varPtr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "varPtrPtr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getAccPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::acc::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getDataClauseAttr(); + if(attr && (attr == ::mlir::acc::DataClauseAttr::get(odsBuilder.getContext(), mlir::acc::DataClause::acc_use_device))) + elidedAttrs.push_back("dataClause"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStructuredAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(true))) + elidedAttrs.push_back("structured"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::UseDeviceOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::WaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WaitOpGenericAdaptorBase::WaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.wait", odsAttrs.getContext()); +} + +WaitOpGenericAdaptorBase::WaitOpGenericAdaptorBase(WaitOp op) : WaitOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr WaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr WaitOpGenericAdaptorBase::getAsyncAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool WaitOpGenericAdaptorBase::getAsync() { + auto attr = getAsyncAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +WaitOpAdaptor::WaitOpAdaptor(WaitOp op) : WaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WaitOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_async = getProperties().async; (void)tblgen_async; + + if (tblgen_async && !((::llvm::isa<::mlir::UnitAttr>(tblgen_async)))) + return emitError(loc, "'acc.wait' op ""attribute 'async' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair WaitOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range WaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range WaitOp::getWaitOperands() { + return getODSOperands(0); +} + +::mlir::Value WaitOp::getAsyncOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value WaitOp::getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> WaitOp::getIfCond() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::MutableOperandRange WaitOp::getWaitOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange WaitOp::getAsyncOperandMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange WaitOp::getWaitDevnumMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange WaitOp::getIfCondMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair WaitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult WaitOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.async; + auto attr = dict.get("async"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for async in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `async` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute WaitOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.async; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("async", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code WaitOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.async.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional WaitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "async") + return prop.async; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void WaitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "async") { + prop.async = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void WaitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.async) attrs.append("async", prop.async); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult WaitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAsyncAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(attr, "async", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WaitOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.async))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void WaitOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.async); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr WaitOp::getAsyncAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); +} + +bool WaitOp::getAsync() { + auto attr = getAsyncAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void WaitOp::setAsyncAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getAsyncAttrName(), attr); +} + +void WaitOp::setAsync(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getAsyncAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getAsyncAttrName()); +} + +::mlir::Attribute WaitOp::removeAsyncAttr() { + auto &attr = getProperties().async; + attr = {}; + return attr; +} + +void WaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond) { + odsState.addOperands(waitOperands); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({static_cast(waitOperands.size()), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = async; + } +} + +void WaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond) { + odsState.addOperands(waitOperands); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({static_cast(waitOperands.size()), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = async; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond) { + odsState.addOperands(waitOperands); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({static_cast(waitOperands.size()), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = ((async) ? odsBuilder.getUnitAttr() : nullptr); + } +} + +void WaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond) { + odsState.addOperands(waitOperands); + if (asyncOperand) + odsState.addOperands(asyncOperand); + if (waitDevnum) + odsState.addOperands(waitDevnum); + if (ifCond) + odsState.addOperands(ifCond); + ::llvm::copy(::llvm::ArrayRef({static_cast(waitOperands.size()), (asyncOperand ? 1 : 0), (waitDevnum ? 1 : 0), (ifCond ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (async) { + odsState.getOrAddProperties().async = ((async) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WaitOp::verifyInvariantsImpl() { + auto tblgen_async = getProperties().async; (void)tblgen_async; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenACCOps4(*this, tblgen_async, "async"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult WaitOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitOperandsOperands; + ::llvm::SMLoc waitOperandsOperandsLoc; + (void)waitOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> asyncOperandOperands; + ::llvm::SMLoc asyncOperandOperandsLoc; + (void)asyncOperandOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> asyncOperandTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> waitDevnumOperands; + ::llvm::SMLoc waitDevnumOperandsLoc; + (void)waitDevnumOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> waitDevnumTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> ifCondOperands; + ::llvm::SMLoc ifCondOperandsLoc; + (void)ifCondOperandsLoc; + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + waitOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(waitOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(waitOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + bool asyncClause = false; + bool wait_devnumClause = false; + bool ifClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("async"))) { + + if (asyncClause) { + return parser.emitError(parser.getNameLoc()) + << "`async` clause can appear at most once in the expansion of the " + "oilist directive"; + } + asyncClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + asyncOperandOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperandOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + asyncOperandTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("wait_devnum"))) { + + if (wait_devnumClause) { + return parser.emitError(parser.getNameLoc()) + << "`wait_devnum` clause can appear at most once in the expansion of the " + "oilist directive"; + } + wait_devnumClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + waitDevnumOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + waitDevnumTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ifCondOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + ifCondOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(waitOperandsOperands.size()), static_cast(asyncOperandOperands.size()), static_cast(waitDevnumOperands.size()), static_cast(ifCondOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(waitOperandsOperands, waitOperandsTypes, waitOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(asyncOperandOperands, asyncOperandTypes, asyncOperandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(waitDevnumOperands, waitDevnumTypes, waitDevnumOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(ifCondOperands, odsBuildableType0, ifCondOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (!getWaitOperands().empty()) { + _odsPrinter << "("; + _odsPrinter << getWaitOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getWaitOperands().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << " "; + if (false || getAsyncOperand()) { + _odsPrinter << ' ' << "async"; + _odsPrinter << "("; + if (::mlir::Value value = getAsyncOperand()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getAsyncOperand() ? ::llvm::ArrayRef<::mlir::Type>(getAsyncOperand().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getWaitDevnum()) { + _odsPrinter << ' ' << "wait_devnum"; + _odsPrinter << "("; + if (::mlir::Value value = getWaitDevnum()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getWaitDevnum() ? ::llvm::ArrayRef<::mlir::Type>(getWaitDevnum().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getIfCond()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfCond()) + _odsPrinter << value; + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getAsyncAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("async"); + } + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::WaitOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::YieldOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("acc.yield", odsAttrs.getContext()); +} + +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(YieldOp op) : YieldOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair YieldOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr YieldOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +YieldOpAdaptor::YieldOpAdaptor(YieldOp op) : YieldOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult YieldOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair YieldOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range YieldOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range YieldOp::getOperands() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange YieldOp::getOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair YieldOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range YieldOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + /* nothing to do */ +} + +void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) { + odsState.addOperands(operands); +} + +void YieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult YieldOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenACCOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult YieldOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult YieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands; + ::llvm::SMLoc operandsOperandsLoc; + (void)operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> operandsTypes; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + + operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandsOperands)) + return ::mlir::failure(); + if (!operandsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(operandsTypes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void YieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (!getOperands().empty()) { + _odsPrinter << ' '; + _odsPrinter << getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperands().getTypes(); + } +} + +::mlir::MutableOperandRange YieldOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..46f7443b7d53755e056557ec0385045fa9fd218c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.h.inc @@ -0,0 +1,11427 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenACCOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace acc { +class AtomicCaptureOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class AtomicReadOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class AtomicUpdateOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class AtomicWriteOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class AttachOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class CacheOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class CopyinOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class CopyoutOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class CreateOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DataBoundsOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DataOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DeclareDeviceResidentOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DeclareEnterOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DeclareExitOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DeclareLinkOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DeclareOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DeleteOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DetachOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class DevicePtrOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class EnterDataOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class ExitDataOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class FirstprivateOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class FirstprivateRecipeOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class GetDevicePtrOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class GlobalConstructorOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class GlobalDestructorOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class HostDataOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class InitOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class KernelsOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class LoopOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class NoCreateOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class ParallelOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class PresentOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class PrivateOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class PrivateRecipeOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class ReductionOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class ReductionRecipeOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class RoutineOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class SerialOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class SetOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class ShutdownOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class TerminatorOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class UpdateDeviceOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class UpdateHostOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class UpdateOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class UseDeviceOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class WaitOp; +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +class YieldOp; +} // namespace acc +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AtomicCaptureOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicCaptureOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AtomicCaptureOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicCaptureOpGenericAdaptorBase(AtomicCaptureOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AtomicCaptureOpGenericAdaptor : public detail::AtomicCaptureOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicCaptureOpGenericAdaptorBase; +public: + AtomicCaptureOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicCaptureOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicCaptureOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AtomicCaptureOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicCaptureOpAdaptor : public AtomicCaptureOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicCaptureOpGenericAdaptor::AtomicCaptureOpGenericAdaptor; + AtomicCaptureOpAdaptor(AtomicCaptureOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicCaptureOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::accomp::AtomicCaptureOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicCaptureOpAdaptor; + template + using GenericAdaptor = AtomicCaptureOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.atomic.capture"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + /// Returns the `atomic.read` operation inside the region, if any. + /// Otherwise, it returns nullptr. + AtomicReadOp getAtomicReadOp(); + + /// Returns the `atomic.write` operation inside the region, if any. + /// Otherwise, it returns nullptr. + AtomicWriteOp getAtomicWriteOp(); + + /// Returns the `atomic.update` operation inside the region, if any. + /// Otherwise, it returns nullptr. + AtomicUpdateOp getAtomicUpdateOp(); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicCaptureOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AtomicReadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicReadOpGenericAdaptorBase { +public: + struct Properties { + using element_typeTy = ::mlir::TypeAttr; + element_typeTy element_type; + + auto getElementType() { + auto &propStorage = this->element_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setElementType(const ::mlir::TypeAttr &propValue) { + this->element_type = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.element_type == this->element_type && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AtomicReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicReadOpGenericAdaptorBase(AtomicReadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getElementTypeAttr(); + ::mlir::Type getElementType(); +}; +} // namespace detail +template +class AtomicReadOpGenericAdaptor : public detail::AtomicReadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicReadOpGenericAdaptorBase; +public: + AtomicReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicReadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AtomicReadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getV() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicReadOpAdaptor : public AtomicReadOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicReadOpGenericAdaptor::AtomicReadOpGenericAdaptor; + AtomicReadOpAdaptor(AtomicReadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicReadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::accomp::AtomicReadOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicReadOpAdaptor; + template + using GenericAdaptor = AtomicReadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.atomic.read"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getX(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getV(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getVMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypeAttr getElementTypeAttr(); + ::mlir::Type getElementType(); + void setElementTypeAttr(::mlir::TypeAttr attr); + void setElementType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicReadOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AtomicUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AtomicUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicUpdateOpGenericAdaptorBase(AtomicUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AtomicUpdateOpGenericAdaptor : public detail::AtomicUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicUpdateOpGenericAdaptorBase; +public: + AtomicUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AtomicUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicUpdateOpAdaptor : public AtomicUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicUpdateOpGenericAdaptor::AtomicUpdateOpGenericAdaptor; + AtomicUpdateOpAdaptor(AtomicUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::accomp::AtomicUpdateOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicUpdateOpAdaptor; + template + using GenericAdaptor = AtomicUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.atomic.update"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::LogicalResult canonicalize(AtomicUpdateOp op, ::mlir::PatternRewriter &rewriter); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + Operation* getFirstOp() { + return &getRegion().front().getOperations().front(); + } +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicUpdateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AtomicWriteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicWriteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AtomicWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicWriteOpGenericAdaptorBase(AtomicWriteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AtomicWriteOpGenericAdaptor : public detail::AtomicWriteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicWriteOpGenericAdaptorBase; +public: + AtomicWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicWriteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AtomicWriteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getExpr() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicWriteOpAdaptor : public AtomicWriteOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicWriteOpGenericAdaptor::AtomicWriteOpGenericAdaptor; + AtomicWriteOpAdaptor(AtomicWriteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicWriteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::accomp::AtomicWriteOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicWriteOpAdaptor; + template + using GenericAdaptor = AtomicWriteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.atomic.write"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getX(); + ::mlir::Value getExpr(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getExprMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value expr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value expr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicWriteOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::AttachOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AttachOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AttachOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AttachOpGenericAdaptorBase(AttachOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class AttachOpGenericAdaptor : public detail::AttachOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AttachOpGenericAdaptorBase; +public: + AttachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AttachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AttachOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AttachOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AttachOpAdaptor : public AttachOpGenericAdaptor<::mlir::ValueRange> { +public: + using AttachOpGenericAdaptor::AttachOpGenericAdaptor; + AttachOpAdaptor(AttachOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AttachOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AttachOpAdaptor; + template + using GenericAdaptor = AttachOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.attach"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AttachOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::CacheOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CacheOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CacheOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CacheOpGenericAdaptorBase(CacheOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class CacheOpGenericAdaptor : public detail::CacheOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CacheOpGenericAdaptorBase; +public: + CacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CacheOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CacheOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CacheOpAdaptor : public CacheOpGenericAdaptor<::mlir::ValueRange> { +public: + using CacheOpGenericAdaptor::CacheOpGenericAdaptor; + CacheOpAdaptor(CacheOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CacheOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CacheOpAdaptor; + template + using GenericAdaptor = CacheOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.cache"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Check if this is a cache with readonly modifier. + bool isCacheReadonly() { + return getDataClause() == acc::DataClause::acc_cache_readonly; + } +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::CacheOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::CopyinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CopyinOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CopyinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CopyinOpGenericAdaptorBase(CopyinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class CopyinOpGenericAdaptor : public detail::CopyinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CopyinOpGenericAdaptorBase; +public: + CopyinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CopyinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CopyinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CopyinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CopyinOpAdaptor : public CopyinOpGenericAdaptor<::mlir::ValueRange> { +public: + using CopyinOpGenericAdaptor::CopyinOpGenericAdaptor; + CopyinOpAdaptor(CopyinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CopyinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CopyinOpAdaptor; + template + using GenericAdaptor = CopyinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.copyin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Check if this is a copyin with readonly modifier. + bool isCopyinReadonly(); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::CopyinOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::CopyoutOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CopyoutOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CopyoutOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CopyoutOpGenericAdaptorBase(CopyoutOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class CopyoutOpGenericAdaptor : public detail::CopyoutOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CopyoutOpGenericAdaptorBase; +public: + CopyoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CopyoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CopyoutOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CopyoutOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAccPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CopyoutOpAdaptor : public CopyoutOpGenericAdaptor<::mlir::ValueRange> { +public: + using CopyoutOpGenericAdaptor::CopyoutOpGenericAdaptor; + CopyoutOpAdaptor(CopyoutOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CopyoutOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CopyoutOpAdaptor; + template + using GenericAdaptor = CopyoutOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.copyout"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getAccPtrMutable(); + ::mlir::MutableOperandRange getVarPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Check if this is a copyout with zero modifier. + bool isCopyoutZero(); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::CopyoutOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::CreateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateOpGenericAdaptorBase(CreateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class CreateOpGenericAdaptor : public detail::CreateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateOpGenericAdaptorBase; +public: + CreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CreateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateOpAdaptor : public CreateOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateOpGenericAdaptor::CreateOpGenericAdaptor; + CreateOpAdaptor(CreateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateOpAdaptor; + template + using GenericAdaptor = CreateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.create"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Check if this is a create with zero modifier. + bool isCreateZero(); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::CreateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DataBoundsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DataBoundsOpGenericAdaptorBase { +public: + struct Properties { + using strideInBytesTy = ::mlir::BoolAttr; + strideInBytesTy strideInBytes; + + auto getStrideInBytes() { + auto &propStorage = this->strideInBytes; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStrideInBytes(const ::mlir::BoolAttr &propValue) { + this->strideInBytes = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.strideInBytes == this->strideInBytes && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DataBoundsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DataBoundsOpGenericAdaptorBase(DataBoundsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getStrideInBytesAttr(); + bool getStrideInBytes(); +}; +} // namespace detail +template +class DataBoundsOpGenericAdaptor : public detail::DataBoundsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DataBoundsOpGenericAdaptorBase; +public: + DataBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DataBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DataBoundsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DataBoundsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLowerbound() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getUpperbound() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getExtent() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getStride() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getStartIdx() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DataBoundsOpAdaptor : public DataBoundsOpGenericAdaptor<::mlir::ValueRange> { +public: + using DataBoundsOpGenericAdaptor::DataBoundsOpGenericAdaptor; + DataBoundsOpAdaptor(DataBoundsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DataBoundsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DataBoundsOpAdaptor; + template + using GenericAdaptor = DataBoundsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("strideInBytes"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getStrideInBytesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getStrideInBytesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.bounds"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLowerbound(); + ::mlir::Value getUpperbound(); + ::mlir::Value getExtent(); + ::mlir::Value getStride(); + ::mlir::Value getStartIdx(); + ::mlir::MutableOperandRange getLowerboundMutable(); + ::mlir::MutableOperandRange getUpperboundMutable(); + ::mlir::MutableOperandRange getExtentMutable(); + ::mlir::MutableOperandRange getStrideMutable(); + ::mlir::MutableOperandRange getStartIdxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::DataBoundsType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getStrideInBytesAttr(); + bool getStrideInBytes(); + void setStrideInBytesAttr(::mlir::BoolAttr attr); + void setStrideInBytes(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DataBoundsOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DataOpGenericAdaptorBase { +public: + struct Properties { + using asyncAttrTy = ::mlir::UnitAttr; + asyncAttrTy asyncAttr; + + auto getAsyncAttr() { + auto &propStorage = this->asyncAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setAsyncAttr(const ::mlir::UnitAttr &propValue) { + this->asyncAttr = propValue; + } + using defaultAttrTy = ::mlir::acc::ClauseDefaultValueAttr; + defaultAttrTy defaultAttr; + + auto getDefaultAttr() { + auto &propStorage = this->defaultAttr; + return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(propStorage); + } + void setDefaultAttr(const ::mlir::acc::ClauseDefaultValueAttr &propValue) { + this->defaultAttr = propValue; + } + using waitAttrTy = ::mlir::UnitAttr; + waitAttrTy waitAttr; + + auto getWaitAttr() { + auto &propStorage = this->waitAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWaitAttr(const ::mlir::UnitAttr &propValue) { + this->waitAttr = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.asyncAttr == this->asyncAttr && + rhs.defaultAttr == this->defaultAttr && + rhs.waitAttr == this->waitAttr && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DataOpGenericAdaptorBase(DataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getAsyncAttrAttr(); + bool getAsyncAttr(); + ::mlir::UnitAttr getWaitAttrAttr(); + bool getWaitAttr(); + ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr(); + ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DataOpGenericAdaptor : public detail::DataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DataOpGenericAdaptorBase; +public: + DataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getAsync() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getWaitOperands() { + return getODSOperands(3); + } + + RangeT getDataClauseOperands() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DataOpAdaptor : public DataOpGenericAdaptor<::mlir::ValueRange> { +public: + using DataOpGenericAdaptor::DataOpGenericAdaptor; + DataOpAdaptor(DataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DataOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DataOpAdaptor; + template + using GenericAdaptor = DataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncAttr"), ::llvm::StringRef("defaultAttr"), ::llvm::StringRef("waitAttr"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAsyncAttrAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAsyncAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDefaultAttrAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDefaultAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getWaitAttrAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getWaitAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.data"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::Value getAsync(); + ::mlir::Value getWaitDevnum(); + ::mlir::Operation::operand_range getWaitOperands(); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getIfCondMutable(); + ::mlir::MutableOperandRange getAsyncMutable(); + ::mlir::MutableOperandRange getWaitDevnumMutable(); + ::mlir::MutableOperandRange getWaitOperandsMutable(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getAsyncAttrAttr(); + bool getAsyncAttr(); + ::mlir::UnitAttr getWaitAttrAttr(); + bool getWaitAttr(); + ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr(); + ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); + void setAsyncAttrAttr(::mlir::UnitAttr attr); + void setAsyncAttr(bool attrValue); + void setWaitAttrAttr(::mlir::UnitAttr attr); + void setWaitAttr(bool attrValue); + void setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr); + void setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue); + ::mlir::Attribute removeAsyncAttrAttr(); + ::mlir::Attribute removeWaitAttrAttr(); + ::mlir::Attribute removeDefaultAttrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of data operands. + unsigned getNumDataOperands(); + + /// The i-th data operand passed. + Value getDataOperand(unsigned i); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DataOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareDeviceResidentOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeclareDeviceResidentOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DeclareDeviceResidentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DeclareDeviceResidentOpGenericAdaptorBase(DeclareDeviceResidentOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class DeclareDeviceResidentOpGenericAdaptor : public detail::DeclareDeviceResidentOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeclareDeviceResidentOpGenericAdaptorBase; +public: + DeclareDeviceResidentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeclareDeviceResidentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeclareDeviceResidentOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DeclareDeviceResidentOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeclareDeviceResidentOpAdaptor : public DeclareDeviceResidentOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeclareDeviceResidentOpGenericAdaptor::DeclareDeviceResidentOpGenericAdaptor; + DeclareDeviceResidentOpAdaptor(DeclareDeviceResidentOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeclareDeviceResidentOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeclareDeviceResidentOpAdaptor; + template + using GenericAdaptor = DeclareDeviceResidentOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.declare_device_resident"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareDeviceResidentOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareEnterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeclareEnterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeclareEnterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeclareEnterOpGenericAdaptorBase(DeclareEnterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeclareEnterOpGenericAdaptor : public detail::DeclareEnterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeclareEnterOpGenericAdaptorBase; +public: + DeclareEnterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeclareEnterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeclareEnterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeclareEnterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDataClauseOperands() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeclareEnterOpAdaptor : public DeclareEnterOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeclareEnterOpGenericAdaptor::DeclareEnterOpGenericAdaptor; + DeclareEnterOpAdaptor(DeclareEnterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeclareEnterOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DeclareEnterOpAdaptor; + template + using GenericAdaptor = DeclareEnterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.declare_enter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange dataClauseOperands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareEnterOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareExitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeclareExitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeclareExitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeclareExitOpGenericAdaptorBase(DeclareExitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeclareExitOpGenericAdaptor : public detail::DeclareExitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeclareExitOpGenericAdaptorBase; +public: + DeclareExitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeclareExitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeclareExitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeclareExitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDataClauseOperands() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeclareExitOpAdaptor : public DeclareExitOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeclareExitOpGenericAdaptor::DeclareExitOpGenericAdaptor; + DeclareExitOpAdaptor(DeclareExitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeclareExitOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DeclareExitOpAdaptor; + template + using GenericAdaptor = DeclareExitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.declare_exit"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange dataClauseOperands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareExitOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareLinkOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeclareLinkOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DeclareLinkOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DeclareLinkOpGenericAdaptorBase(DeclareLinkOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class DeclareLinkOpGenericAdaptor : public detail::DeclareLinkOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeclareLinkOpGenericAdaptorBase; +public: + DeclareLinkOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeclareLinkOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeclareLinkOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DeclareLinkOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeclareLinkOpAdaptor : public DeclareLinkOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeclareLinkOpGenericAdaptor::DeclareLinkOpGenericAdaptor; + DeclareLinkOpAdaptor(DeclareLinkOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeclareLinkOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeclareLinkOpAdaptor; + template + using GenericAdaptor = DeclareLinkOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.declare_link"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareLinkOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeclareOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeclareOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeclareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeclareOpGenericAdaptorBase(DeclareOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DeclareOpGenericAdaptor : public detail::DeclareOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeclareOpGenericAdaptorBase; +public: + DeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeclareOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeclareOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDataClauseOperands() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeclareOpAdaptor : public DeclareOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeclareOpGenericAdaptor::DeclareOpGenericAdaptor; + DeclareOpAdaptor(DeclareOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeclareOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DeclareOpAdaptor; + template + using GenericAdaptor = DeclareOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.declare"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange dataClauseOperands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DeleteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DeleteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteOpGenericAdaptorBase(DeleteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class DeleteOpGenericAdaptor : public detail::DeleteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteOpGenericAdaptorBase; +public: + DeleteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DeleteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAccPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteOpAdaptor : public DeleteOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteOpGenericAdaptor::DeleteOpGenericAdaptor; + DeleteOpAdaptor(DeleteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteOpAdaptor; + template + using GenericAdaptor = DeleteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.delete"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getAccPtrMutable(); + ::mlir::MutableOperandRange getVarPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeleteOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DetachOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DetachOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DetachOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DetachOpGenericAdaptorBase(DetachOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class DetachOpGenericAdaptor : public detail::DetachOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DetachOpGenericAdaptorBase; +public: + DetachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DetachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DetachOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DetachOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAccPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DetachOpAdaptor : public DetachOpGenericAdaptor<::mlir::ValueRange> { +public: + using DetachOpGenericAdaptor::DetachOpGenericAdaptor; + DetachOpAdaptor(DetachOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DetachOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DetachOpAdaptor; + template + using GenericAdaptor = DetachOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.detach"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getAccPtrMutable(); + ::mlir::MutableOperandRange getVarPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DetachOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::DevicePtrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DevicePtrOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DevicePtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DevicePtrOpGenericAdaptorBase(DevicePtrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class DevicePtrOpGenericAdaptor : public detail::DevicePtrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DevicePtrOpGenericAdaptorBase; +public: + DevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DevicePtrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DevicePtrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DevicePtrOpAdaptor : public DevicePtrOpGenericAdaptor<::mlir::ValueRange> { +public: + using DevicePtrOpGenericAdaptor::DevicePtrOpGenericAdaptor; + DevicePtrOpAdaptor(DevicePtrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DevicePtrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DevicePtrOpAdaptor; + template + using GenericAdaptor = DevicePtrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.deviceptr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DevicePtrOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::EnterDataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnterDataOpGenericAdaptorBase { +public: + struct Properties { + using asyncTy = ::mlir::UnitAttr; + asyncTy async; + + auto getAsync() { + auto &propStorage = this->async; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setAsync(const ::mlir::UnitAttr &propValue) { + this->async = propValue; + } + using waitTy = ::mlir::UnitAttr; + waitTy wait; + + auto getWait() { + auto &propStorage = this->wait; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWait(const ::mlir::UnitAttr &propValue) { + this->wait = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.async == this->async && + rhs.wait == this->wait && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + EnterDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + EnterDataOpGenericAdaptorBase(EnterDataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getAsyncAttr(); + bool getAsync(); + ::mlir::UnitAttr getWaitAttr(); + bool getWait(); +}; +} // namespace detail +template +class EnterDataOpGenericAdaptor : public detail::EnterDataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnterDataOpGenericAdaptorBase; +public: + EnterDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnterDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnterDataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + EnterDataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getAsyncOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getWaitOperands() { + return getODSOperands(3); + } + + RangeT getDataClauseOperands() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnterDataOpAdaptor : public EnterDataOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnterDataOpGenericAdaptor::EnterDataOpGenericAdaptor; + EnterDataOpAdaptor(EnterDataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnterDataOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = EnterDataOpAdaptor; + template + using GenericAdaptor = EnterDataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("async"), ::llvm::StringRef("wait"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAsyncAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAsyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getWaitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getWaitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.enter_data"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::Value getAsyncOperand(); + ::mlir::Value getWaitDevnum(); + ::mlir::Operation::operand_range getWaitOperands(); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getIfCondMutable(); + ::mlir::MutableOperandRange getAsyncOperandMutable(); + ::mlir::MutableOperandRange getWaitDevnumMutable(); + ::mlir::MutableOperandRange getWaitOperandsMutable(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getAsyncAttr(); + bool getAsync(); + ::mlir::UnitAttr getWaitAttr(); + bool getWait(); + void setAsyncAttr(::mlir::UnitAttr attr); + void setAsync(bool attrValue); + void setWaitAttr(::mlir::UnitAttr attr); + void setWait(bool attrValue); + ::mlir::Attribute removeAsyncAttr(); + ::mlir::Attribute removeWaitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of data operands. + unsigned getNumDataOperands(); + + /// The i-th data operand passed. + Value getDataOperand(unsigned i); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::EnterDataOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ExitDataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExitDataOpGenericAdaptorBase { +public: + struct Properties { + using asyncTy = ::mlir::UnitAttr; + asyncTy async; + + auto getAsync() { + auto &propStorage = this->async; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setAsync(const ::mlir::UnitAttr &propValue) { + this->async = propValue; + } + using finalizeTy = ::mlir::UnitAttr; + finalizeTy finalize; + + auto getFinalize() { + auto &propStorage = this->finalize; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setFinalize(const ::mlir::UnitAttr &propValue) { + this->finalize = propValue; + } + using waitTy = ::mlir::UnitAttr; + waitTy wait; + + auto getWait() { + auto &propStorage = this->wait; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWait(const ::mlir::UnitAttr &propValue) { + this->wait = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.async == this->async && + rhs.finalize == this->finalize && + rhs.wait == this->wait && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExitDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExitDataOpGenericAdaptorBase(ExitDataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getAsyncAttr(); + bool getAsync(); + ::mlir::UnitAttr getWaitAttr(); + bool getWait(); + ::mlir::UnitAttr getFinalizeAttr(); + bool getFinalize(); +}; +} // namespace detail +template +class ExitDataOpGenericAdaptor : public detail::ExitDataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExitDataOpGenericAdaptorBase; +public: + ExitDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExitDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExitDataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExitDataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getAsyncOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getWaitOperands() { + return getODSOperands(3); + } + + RangeT getDataClauseOperands() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExitDataOpAdaptor : public ExitDataOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExitDataOpGenericAdaptor::ExitDataOpGenericAdaptor; + ExitDataOpAdaptor(ExitDataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExitDataOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ExitDataOpAdaptor; + template + using GenericAdaptor = ExitDataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("async"), ::llvm::StringRef("finalize"), ::llvm::StringRef("wait"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAsyncAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAsyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFinalizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFinalizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getWaitAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getWaitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.exit_data"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::Value getAsyncOperand(); + ::mlir::Value getWaitDevnum(); + ::mlir::Operation::operand_range getWaitOperands(); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getIfCondMutable(); + ::mlir::MutableOperandRange getAsyncOperandMutable(); + ::mlir::MutableOperandRange getWaitDevnumMutable(); + ::mlir::MutableOperandRange getWaitOperandsMutable(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getAsyncAttr(); + bool getAsync(); + ::mlir::UnitAttr getWaitAttr(); + bool getWait(); + ::mlir::UnitAttr getFinalizeAttr(); + bool getFinalize(); + void setAsyncAttr(::mlir::UnitAttr attr); + void setAsync(bool attrValue); + void setWaitAttr(::mlir::UnitAttr attr); + void setWait(bool attrValue); + void setFinalizeAttr(::mlir::UnitAttr attr); + void setFinalize(bool attrValue); + ::mlir::Attribute removeAsyncAttr(); + ::mlir::Attribute removeWaitAttr(); + ::mlir::Attribute removeFinalizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of data operands. + unsigned getNumDataOperands(); + + /// The i-th data operand passed. + Value getDataOperand(unsigned i); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ExitDataOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::FirstprivateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FirstprivateOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FirstprivateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FirstprivateOpGenericAdaptorBase(FirstprivateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class FirstprivateOpGenericAdaptor : public detail::FirstprivateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FirstprivateOpGenericAdaptorBase; +public: + FirstprivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FirstprivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FirstprivateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FirstprivateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FirstprivateOpAdaptor : public FirstprivateOpGenericAdaptor<::mlir::ValueRange> { +public: + using FirstprivateOpGenericAdaptor::FirstprivateOpGenericAdaptor; + FirstprivateOpAdaptor(FirstprivateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FirstprivateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FirstprivateOpAdaptor; + template + using GenericAdaptor = FirstprivateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.firstprivate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::FirstprivateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::FirstprivateRecipeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FirstprivateRecipeOpGenericAdaptorBase { +public: + struct Properties { + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using typeTy = ::mlir::TypeAttr; + typeTy type; + + auto getType() { + auto &propStorage = this->type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setType(const ::mlir::TypeAttr &propValue) { + this->type = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.sym_name == this->sym_name && + rhs.type == this->type && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FirstprivateRecipeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FirstprivateRecipeOpGenericAdaptorBase(FirstprivateRecipeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + ::mlir::Region &getInitRegion(); + ::mlir::Region &getCopyRegion(); + ::mlir::Region &getDestroyRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FirstprivateRecipeOpGenericAdaptor : public detail::FirstprivateRecipeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FirstprivateRecipeOpGenericAdaptorBase; +public: + FirstprivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FirstprivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FirstprivateRecipeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FirstprivateRecipeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FirstprivateRecipeOpAdaptor : public FirstprivateRecipeOpGenericAdaptor<::mlir::ValueRange> { +public: + using FirstprivateRecipeOpGenericAdaptor::FirstprivateRecipeOpGenericAdaptor; + FirstprivateRecipeOpAdaptor(FirstprivateRecipeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FirstprivateRecipeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::SymbolOpInterface::Trait, ::mlir::acc::RecipeInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FirstprivateRecipeOpAdaptor; + template + using GenericAdaptor = FirstprivateRecipeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name"), ::llvm::StringRef("type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.firstprivate.recipe"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getInitRegion(); + ::mlir::Region &getCopyRegion(); + ::mlir::Region &getDestroyRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setTypeAttr(::mlir::TypeAttr attr); + void setType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::FirstprivateRecipeOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::GetDevicePtrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetDevicePtrOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GetDevicePtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GetDevicePtrOpGenericAdaptorBase(GetDevicePtrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class GetDevicePtrOpGenericAdaptor : public detail::GetDevicePtrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetDevicePtrOpGenericAdaptorBase; +public: + GetDevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetDevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetDevicePtrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GetDevicePtrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetDevicePtrOpAdaptor : public GetDevicePtrOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetDevicePtrOpGenericAdaptor::GetDevicePtrOpGenericAdaptor; + GetDevicePtrOpAdaptor(GetDevicePtrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetDevicePtrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetDevicePtrOpAdaptor; + template + using GenericAdaptor = GetDevicePtrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.getdeviceptr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GetDevicePtrOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::GlobalConstructorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalConstructorOpGenericAdaptorBase { +public: + struct Properties { + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.sym_name == this->sym_name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalConstructorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalConstructorOpGenericAdaptorBase(GlobalConstructorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class GlobalConstructorOpGenericAdaptor : public detail::GlobalConstructorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalConstructorOpGenericAdaptorBase; +public: + GlobalConstructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalConstructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalConstructorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalConstructorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalConstructorOpAdaptor : public GlobalConstructorOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalConstructorOpGenericAdaptor::GlobalConstructorOpGenericAdaptor; + GlobalConstructorOpAdaptor(GlobalConstructorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalConstructorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalConstructorOpAdaptor; + template + using GenericAdaptor = GlobalConstructorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.global_ctor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GlobalConstructorOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::GlobalDestructorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalDestructorOpGenericAdaptorBase { +public: + struct Properties { + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.sym_name == this->sym_name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GlobalDestructorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalDestructorOpGenericAdaptorBase(GlobalDestructorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class GlobalDestructorOpGenericAdaptor : public detail::GlobalDestructorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalDestructorOpGenericAdaptorBase; +public: + GlobalDestructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalDestructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalDestructorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GlobalDestructorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalDestructorOpAdaptor : public GlobalDestructorOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalDestructorOpGenericAdaptor::GlobalDestructorOpGenericAdaptor; + GlobalDestructorOpAdaptor(GlobalDestructorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalDestructorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalDestructorOpAdaptor; + template + using GenericAdaptor = GlobalDestructorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.global_dtor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GlobalDestructorOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::HostDataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class HostDataOpGenericAdaptorBase { +public: + struct Properties { + using ifPresentTy = ::mlir::UnitAttr; + ifPresentTy ifPresent; + + auto getIfPresent() { + auto &propStorage = this->ifPresent; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setIfPresent(const ::mlir::UnitAttr &propValue) { + this->ifPresent = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.ifPresent == this->ifPresent && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + HostDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + HostDataOpGenericAdaptorBase(HostDataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getIfPresentAttr(); + bool getIfPresent(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class HostDataOpGenericAdaptor : public detail::HostDataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::HostDataOpGenericAdaptorBase; +public: + HostDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + HostDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : HostDataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + HostDataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getDataClauseOperands() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class HostDataOpAdaptor : public HostDataOpGenericAdaptor<::mlir::ValueRange> { +public: + using HostDataOpGenericAdaptor::HostDataOpGenericAdaptor; + HostDataOpAdaptor(HostDataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class HostDataOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = HostDataOpAdaptor; + template + using GenericAdaptor = HostDataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("ifPresent"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIfPresentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIfPresentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.host_data"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getIfCondMutable(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getIfPresentAttr(); + bool getIfPresent(); + void setIfPresentAttr(::mlir::UnitAttr attr); + void setIfPresent(bool attrValue); + ::mlir::Attribute removeIfPresentAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::HostDataOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::InitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + InitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + InitOpGenericAdaptorBase(InitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InitOpGenericAdaptor : public detail::InitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitOpGenericAdaptorBase; +public: + InitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + InitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDeviceTypeOperands() { + return getODSOperands(0); + } + + ValueT getDeviceNumOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getIfCond() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitOpAdaptor : public InitOpGenericAdaptor<::mlir::ValueRange> { +public: + using InitOpGenericAdaptor::InitOpGenericAdaptor; + InitOpAdaptor(InitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = InitOpAdaptor; + template + using GenericAdaptor = InitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.init"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDeviceTypeOperands(); + ::mlir::Value getDeviceNumOperand(); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::MutableOperandRange getDeviceTypeOperandsMutable(); + ::mlir::MutableOperandRange getDeviceNumOperandMutable(); + ::mlir::MutableOperandRange getIfCondMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange deviceTypeOperands, /*optional*/::mlir::Value deviceNumOperand, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange deviceTypeOperands, /*optional*/::mlir::Value deviceNumOperand, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::InitOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::KernelsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class KernelsOpGenericAdaptorBase { +public: + struct Properties { + using asyncAttrTy = ::mlir::UnitAttr; + asyncAttrTy asyncAttr; + + auto getAsyncAttr() { + auto &propStorage = this->asyncAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setAsyncAttr(const ::mlir::UnitAttr &propValue) { + this->asyncAttr = propValue; + } + using defaultAttrTy = ::mlir::acc::ClauseDefaultValueAttr; + defaultAttrTy defaultAttr; + + auto getDefaultAttr() { + auto &propStorage = this->defaultAttr; + return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(propStorage); + } + void setDefaultAttr(const ::mlir::acc::ClauseDefaultValueAttr &propValue) { + this->defaultAttr = propValue; + } + using selfAttrTy = ::mlir::UnitAttr; + selfAttrTy selfAttr; + + auto getSelfAttr() { + auto &propStorage = this->selfAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setSelfAttr(const ::mlir::UnitAttr &propValue) { + this->selfAttr = propValue; + } + using waitAttrTy = ::mlir::UnitAttr; + waitAttrTy waitAttr; + + auto getWaitAttr() { + auto &propStorage = this->waitAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWaitAttr(const ::mlir::UnitAttr &propValue) { + this->waitAttr = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.asyncAttr == this->asyncAttr && + rhs.defaultAttr == this->defaultAttr && + rhs.selfAttr == this->selfAttr && + rhs.waitAttr == this->waitAttr && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + KernelsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + KernelsOpGenericAdaptorBase(KernelsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getAsyncAttrAttr(); + bool getAsyncAttr(); + ::mlir::UnitAttr getWaitAttrAttr(); + bool getWaitAttr(); + ::mlir::UnitAttr getSelfAttrAttr(); + bool getSelfAttr(); + ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr(); + ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class KernelsOpGenericAdaptor : public detail::KernelsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::KernelsOpGenericAdaptorBase; +public: + KernelsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + KernelsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : KernelsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + KernelsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAsync() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getWaitOperands() { + return getODSOperands(1); + } + + RangeT getNumGangs() { + return getODSOperands(2); + } + + ValueT getNumWorkers() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getVectorLength() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getIfCond() { + auto operands = getODSOperands(5); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getSelfCond() { + auto operands = getODSOperands(6); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getDataClauseOperands() { + return getODSOperands(7); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class KernelsOpAdaptor : public KernelsOpGenericAdaptor<::mlir::ValueRange> { +public: + using KernelsOpGenericAdaptor::KernelsOpGenericAdaptor; + KernelsOpAdaptor(KernelsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class KernelsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = KernelsOpAdaptor; + template + using GenericAdaptor = KernelsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncAttr"), ::llvm::StringRef("defaultAttr"), ::llvm::StringRef("selfAttr"), ::llvm::StringRef("waitAttr"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAsyncAttrAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAsyncAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDefaultAttrAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDefaultAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSelfAttrAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSelfAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getWaitAttrAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getWaitAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.kernels"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAsync(); + ::mlir::Operation::operand_range getWaitOperands(); + ::mlir::Operation::operand_range getNumGangs(); + ::mlir::Value getNumWorkers(); + ::mlir::Value getVectorLength(); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::TypedValue<::mlir::IntegerType> getSelfCond(); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getAsyncMutable(); + ::mlir::MutableOperandRange getWaitOperandsMutable(); + ::mlir::MutableOperandRange getNumGangsMutable(); + ::mlir::MutableOperandRange getNumWorkersMutable(); + ::mlir::MutableOperandRange getVectorLengthMutable(); + ::mlir::MutableOperandRange getIfCondMutable(); + ::mlir::MutableOperandRange getSelfCondMutable(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getAsyncAttrAttr(); + bool getAsyncAttr(); + ::mlir::UnitAttr getWaitAttrAttr(); + bool getWaitAttr(); + ::mlir::UnitAttr getSelfAttrAttr(); + bool getSelfAttr(); + ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr(); + ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); + void setAsyncAttrAttr(::mlir::UnitAttr attr); + void setAsyncAttr(bool attrValue); + void setWaitAttrAttr(::mlir::UnitAttr attr); + void setWaitAttr(bool attrValue); + void setSelfAttrAttr(::mlir::UnitAttr attr); + void setSelfAttr(bool attrValue); + void setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr); + void setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue); + ::mlir::Attribute removeAsyncAttrAttr(); + ::mlir::Attribute removeWaitAttrAttr(); + ::mlir::Attribute removeSelfAttrAttr(); + ::mlir::Attribute removeDefaultAttrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of data operands. + unsigned getNumDataOperands(); + + /// The i-th data operand passed. + Value getDataOperand(unsigned i); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::KernelsOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::LoopOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoopOpGenericAdaptorBase { +public: + struct Properties { + using auto_Ty = ::mlir::UnitAttr; + auto_Ty auto_; + + auto getAuto_() { + auto &propStorage = this->auto_; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setAuto_(const ::mlir::UnitAttr &propValue) { + this->auto_ = propValue; + } + using collapseTy = ::mlir::IntegerAttr; + collapseTy collapse; + + auto getCollapse() { + auto &propStorage = this->collapse; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setCollapse(const ::mlir::IntegerAttr &propValue) { + this->collapse = propValue; + } + using hasGangTy = ::mlir::UnitAttr; + hasGangTy hasGang; + + auto getHasGang() { + auto &propStorage = this->hasGang; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setHasGang(const ::mlir::UnitAttr &propValue) { + this->hasGang = propValue; + } + using hasVectorTy = ::mlir::UnitAttr; + hasVectorTy hasVector; + + auto getHasVector() { + auto &propStorage = this->hasVector; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setHasVector(const ::mlir::UnitAttr &propValue) { + this->hasVector = propValue; + } + using hasWorkerTy = ::mlir::UnitAttr; + hasWorkerTy hasWorker; + + auto getHasWorker() { + auto &propStorage = this->hasWorker; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setHasWorker(const ::mlir::UnitAttr &propValue) { + this->hasWorker = propValue; + } + using independentTy = ::mlir::UnitAttr; + independentTy independent; + + auto getIndependent() { + auto &propStorage = this->independent; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setIndependent(const ::mlir::UnitAttr &propValue) { + this->independent = propValue; + } + using privatizationsTy = ::mlir::ArrayAttr; + privatizationsTy privatizations; + + auto getPrivatizations() { + auto &propStorage = this->privatizations; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setPrivatizations(const ::mlir::ArrayAttr &propValue) { + this->privatizations = propValue; + } + using reductionRecipesTy = ::mlir::ArrayAttr; + reductionRecipesTy reductionRecipes; + + auto getReductionRecipes() { + auto &propStorage = this->reductionRecipes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setReductionRecipes(const ::mlir::ArrayAttr &propValue) { + this->reductionRecipes = propValue; + } + using seqTy = ::mlir::UnitAttr; + seqTy seq; + + auto getSeq() { + auto &propStorage = this->seq; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setSeq(const ::mlir::UnitAttr &propValue) { + this->seq = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.auto_ == this->auto_ && + rhs.collapse == this->collapse && + rhs.hasGang == this->hasGang && + rhs.hasVector == this->hasVector && + rhs.hasWorker == this->hasWorker && + rhs.independent == this->independent && + rhs.privatizations == this->privatizations && + rhs.reductionRecipes == this->reductionRecipes && + rhs.seq == this->seq && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + LoopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + LoopOpGenericAdaptorBase(LoopOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getCollapseAttr(); + ::std::optional getCollapse(); + ::mlir::UnitAttr getSeqAttr(); + bool getSeq(); + ::mlir::UnitAttr getIndependentAttr(); + bool getIndependent(); + ::mlir::UnitAttr getAuto_Attr(); + bool getAuto_(); + ::mlir::UnitAttr getHasGangAttr(); + bool getHasGang(); + ::mlir::UnitAttr getHasWorkerAttr(); + bool getHasWorker(); + ::mlir::UnitAttr getHasVectorAttr(); + bool getHasVector(); + ::mlir::ArrayAttr getPrivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrivatizations(); + ::mlir::ArrayAttr getReductionRecipesAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductionRecipes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class LoopOpGenericAdaptor : public detail::LoopOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoopOpGenericAdaptorBase; +public: + LoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoopOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + LoopOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGangNum() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getGangDim() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getGangStatic() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getWorkerNum() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getVectorLength() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getTileOperands() { + return getODSOperands(5); + } + + RangeT getPrivateOperands() { + return getODSOperands(6); + } + + RangeT getReductionOperands() { + return getODSOperands(7); + } + + RangeT getCacheOperands() { + return getODSOperands(8); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoopOpAdaptor : public LoopOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoopOpGenericAdaptor::LoopOpGenericAdaptor; + LoopOpAdaptor(LoopOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoopOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LoopOpAdaptor; + template + using GenericAdaptor = LoopOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("auto_"), ::llvm::StringRef("collapse"), ::llvm::StringRef("hasGang"), ::llvm::StringRef("hasVector"), ::llvm::StringRef("hasWorker"), ::llvm::StringRef("independent"), ::llvm::StringRef("privatizations"), ::llvm::StringRef("reductionRecipes"), ::llvm::StringRef("seq"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAuto_AttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAuto_AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCollapseAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCollapseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHasGangAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHasGangAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getHasVectorAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getHasVectorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getHasWorkerAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getHasWorkerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getIndependentAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getIndependentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPrivatizationsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPrivatizationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getReductionRecipesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getReductionRecipesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getSeqAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getSeqAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.loop"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getGangNum(); + ::mlir::Value getGangDim(); + ::mlir::Value getGangStatic(); + ::mlir::Value getWorkerNum(); + ::mlir::Value getVectorLength(); + ::mlir::Operation::operand_range getTileOperands(); + ::mlir::Operation::operand_range getPrivateOperands(); + ::mlir::Operation::operand_range getReductionOperands(); + ::mlir::Operation::operand_range getCacheOperands(); + ::mlir::MutableOperandRange getGangNumMutable(); + ::mlir::MutableOperandRange getGangDimMutable(); + ::mlir::MutableOperandRange getGangStaticMutable(); + ::mlir::MutableOperandRange getWorkerNumMutable(); + ::mlir::MutableOperandRange getVectorLengthMutable(); + ::mlir::MutableOperandRange getTileOperandsMutable(); + ::mlir::MutableOperandRange getPrivateOperandsMutable(); + ::mlir::MutableOperandRange getReductionOperandsMutable(); + ::mlir::MutableOperandRange getCacheOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getCollapseAttr(); + ::std::optional getCollapse(); + ::mlir::UnitAttr getSeqAttr(); + bool getSeq(); + ::mlir::UnitAttr getIndependentAttr(); + bool getIndependent(); + ::mlir::UnitAttr getAuto_Attr(); + bool getAuto_(); + ::mlir::UnitAttr getHasGangAttr(); + bool getHasGang(); + ::mlir::UnitAttr getHasWorkerAttr(); + bool getHasWorker(); + ::mlir::UnitAttr getHasVectorAttr(); + bool getHasVector(); + ::mlir::ArrayAttr getPrivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrivatizations(); + ::mlir::ArrayAttr getReductionRecipesAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductionRecipes(); + void setCollapseAttr(::mlir::IntegerAttr attr); + void setCollapse(::std::optional attrValue); + void setSeqAttr(::mlir::UnitAttr attr); + void setSeq(bool attrValue); + void setIndependentAttr(::mlir::UnitAttr attr); + void setIndependent(bool attrValue); + void setAuto_Attr(::mlir::UnitAttr attr); + void setAuto_(bool attrValue); + void setHasGangAttr(::mlir::UnitAttr attr); + void setHasGang(bool attrValue); + void setHasWorkerAttr(::mlir::UnitAttr attr); + void setHasWorker(bool attrValue); + void setHasVectorAttr(::mlir::UnitAttr attr); + void setHasVector(bool attrValue); + void setPrivatizationsAttr(::mlir::ArrayAttr attr); + void setReductionRecipesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeCollapseAttr(); + ::mlir::Attribute removeSeqAttr(); + ::mlir::Attribute removeIndependentAttr(); + ::mlir::Attribute removeAuto_Attr(); + ::mlir::Attribute removeHasGangAttr(); + ::mlir::Attribute removeHasWorkerAttr(); + ::mlir::Attribute removeHasVectorAttr(); + ::mlir::Attribute removePrivatizationsAttr(); + ::mlir::Attribute removeReductionRecipesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, /*optional*/::mlir::IntegerAttr collapse, /*optional*/::mlir::Value gangNum, /*optional*/::mlir::Value gangDim, /*optional*/::mlir::Value gangStatic, /*optional*/::mlir::Value workerNum, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::UnitAttr seq, /*optional*/::mlir::UnitAttr independent, /*optional*/::mlir::UnitAttr auto_, /*optional*/::mlir::UnitAttr hasGang, /*optional*/::mlir::UnitAttr hasWorker, /*optional*/::mlir::UnitAttr hasVector, ::mlir::ValueRange tileOperands, ::mlir::ValueRange privateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange cacheOperands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, /*optional*/::mlir::IntegerAttr collapse, /*optional*/::mlir::Value gangNum, /*optional*/::mlir::Value gangDim, /*optional*/::mlir::Value gangStatic, /*optional*/::mlir::Value workerNum, /*optional*/::mlir::Value vectorLength, /*optional*/bool seq, /*optional*/bool independent, /*optional*/bool auto_, /*optional*/bool hasGang, /*optional*/bool hasWorker, /*optional*/bool hasVector, ::mlir::ValueRange tileOperands, ::mlir::ValueRange privateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange cacheOperands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static StringRef getAutoAttrStrName() { return "auto"; } + static StringRef getGangNumKeyword() { return "num"; } + static StringRef getGangDimKeyword() { return "dim"; } + static StringRef getGangStaticKeyword() { return "static"; } +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::LoopOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::NoCreateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NoCreateOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + NoCreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + NoCreateOpGenericAdaptorBase(NoCreateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class NoCreateOpGenericAdaptor : public detail::NoCreateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NoCreateOpGenericAdaptorBase; +public: + NoCreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NoCreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NoCreateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + NoCreateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NoCreateOpAdaptor : public NoCreateOpGenericAdaptor<::mlir::ValueRange> { +public: + using NoCreateOpGenericAdaptor::NoCreateOpGenericAdaptor; + NoCreateOpAdaptor(NoCreateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NoCreateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NoCreateOpAdaptor; + template + using GenericAdaptor = NoCreateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.nocreate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::NoCreateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ParallelOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParallelOpGenericAdaptorBase { +public: + struct Properties { + using asyncAttrTy = ::mlir::UnitAttr; + asyncAttrTy asyncAttr; + + auto getAsyncAttr() { + auto &propStorage = this->asyncAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setAsyncAttr(const ::mlir::UnitAttr &propValue) { + this->asyncAttr = propValue; + } + using defaultAttrTy = ::mlir::acc::ClauseDefaultValueAttr; + defaultAttrTy defaultAttr; + + auto getDefaultAttr() { + auto &propStorage = this->defaultAttr; + return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(propStorage); + } + void setDefaultAttr(const ::mlir::acc::ClauseDefaultValueAttr &propValue) { + this->defaultAttr = propValue; + } + using firstprivatizationsTy = ::mlir::ArrayAttr; + firstprivatizationsTy firstprivatizations; + + auto getFirstprivatizations() { + auto &propStorage = this->firstprivatizations; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setFirstprivatizations(const ::mlir::ArrayAttr &propValue) { + this->firstprivatizations = propValue; + } + using privatizationsTy = ::mlir::ArrayAttr; + privatizationsTy privatizations; + + auto getPrivatizations() { + auto &propStorage = this->privatizations; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setPrivatizations(const ::mlir::ArrayAttr &propValue) { + this->privatizations = propValue; + } + using reductionRecipesTy = ::mlir::ArrayAttr; + reductionRecipesTy reductionRecipes; + + auto getReductionRecipes() { + auto &propStorage = this->reductionRecipes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setReductionRecipes(const ::mlir::ArrayAttr &propValue) { + this->reductionRecipes = propValue; + } + using selfAttrTy = ::mlir::UnitAttr; + selfAttrTy selfAttr; + + auto getSelfAttr() { + auto &propStorage = this->selfAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setSelfAttr(const ::mlir::UnitAttr &propValue) { + this->selfAttr = propValue; + } + using waitAttrTy = ::mlir::UnitAttr; + waitAttrTy waitAttr; + + auto getWaitAttr() { + auto &propStorage = this->waitAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWaitAttr(const ::mlir::UnitAttr &propValue) { + this->waitAttr = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.asyncAttr == this->asyncAttr && + rhs.defaultAttr == this->defaultAttr && + rhs.firstprivatizations == this->firstprivatizations && + rhs.privatizations == this->privatizations && + rhs.reductionRecipes == this->reductionRecipes && + rhs.selfAttr == this->selfAttr && + rhs.waitAttr == this->waitAttr && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ParallelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ParallelOpGenericAdaptorBase(ParallelOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getAsyncAttrAttr(); + bool getAsyncAttr(); + ::mlir::UnitAttr getWaitAttrAttr(); + bool getWaitAttr(); + ::mlir::UnitAttr getSelfAttrAttr(); + bool getSelfAttr(); + ::mlir::ArrayAttr getReductionRecipesAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductionRecipes(); + ::mlir::ArrayAttr getPrivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrivatizations(); + ::mlir::ArrayAttr getFirstprivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getFirstprivatizations(); + ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr(); + ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ParallelOpGenericAdaptor : public detail::ParallelOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParallelOpGenericAdaptorBase; +public: + ParallelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParallelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParallelOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ParallelOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAsync() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getWaitOperands() { + return getODSOperands(1); + } + + RangeT getNumGangs() { + return getODSOperands(2); + } + + ValueT getNumWorkers() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getVectorLength() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getIfCond() { + auto operands = getODSOperands(5); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getSelfCond() { + auto operands = getODSOperands(6); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getReductionOperands() { + return getODSOperands(7); + } + + RangeT getGangPrivateOperands() { + return getODSOperands(8); + } + + RangeT getGangFirstPrivateOperands() { + return getODSOperands(9); + } + + RangeT getDataClauseOperands() { + return getODSOperands(10); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParallelOpAdaptor : public ParallelOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParallelOpGenericAdaptor::ParallelOpGenericAdaptor; + ParallelOpAdaptor(ParallelOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParallelOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ParallelOpAdaptor; + template + using GenericAdaptor = ParallelOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncAttr"), ::llvm::StringRef("defaultAttr"), ::llvm::StringRef("firstprivatizations"), ::llvm::StringRef("privatizations"), ::llvm::StringRef("reductionRecipes"), ::llvm::StringRef("selfAttr"), ::llvm::StringRef("waitAttr"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAsyncAttrAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAsyncAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDefaultAttrAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDefaultAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFirstprivatizationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFirstprivatizationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPrivatizationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPrivatizationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getReductionRecipesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getReductionRecipesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSelfAttrAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSelfAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getWaitAttrAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getWaitAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.parallel"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAsync(); + ::mlir::Operation::operand_range getWaitOperands(); + ::mlir::Operation::operand_range getNumGangs(); + ::mlir::Value getNumWorkers(); + ::mlir::Value getVectorLength(); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::TypedValue<::mlir::IntegerType> getSelfCond(); + ::mlir::Operation::operand_range getReductionOperands(); + ::mlir::Operation::operand_range getGangPrivateOperands(); + ::mlir::Operation::operand_range getGangFirstPrivateOperands(); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getAsyncMutable(); + ::mlir::MutableOperandRange getWaitOperandsMutable(); + ::mlir::MutableOperandRange getNumGangsMutable(); + ::mlir::MutableOperandRange getNumWorkersMutable(); + ::mlir::MutableOperandRange getVectorLengthMutable(); + ::mlir::MutableOperandRange getIfCondMutable(); + ::mlir::MutableOperandRange getSelfCondMutable(); + ::mlir::MutableOperandRange getReductionOperandsMutable(); + ::mlir::MutableOperandRange getGangPrivateOperandsMutable(); + ::mlir::MutableOperandRange getGangFirstPrivateOperandsMutable(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getAsyncAttrAttr(); + bool getAsyncAttr(); + ::mlir::UnitAttr getWaitAttrAttr(); + bool getWaitAttr(); + ::mlir::UnitAttr getSelfAttrAttr(); + bool getSelfAttr(); + ::mlir::ArrayAttr getReductionRecipesAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductionRecipes(); + ::mlir::ArrayAttr getPrivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrivatizations(); + ::mlir::ArrayAttr getFirstprivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getFirstprivatizations(); + ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr(); + ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); + void setAsyncAttrAttr(::mlir::UnitAttr attr); + void setAsyncAttr(bool attrValue); + void setWaitAttrAttr(::mlir::UnitAttr attr); + void setWaitAttr(bool attrValue); + void setSelfAttrAttr(::mlir::UnitAttr attr); + void setSelfAttr(bool attrValue); + void setReductionRecipesAttr(::mlir::ArrayAttr attr); + void setPrivatizationsAttr(::mlir::ArrayAttr attr); + void setFirstprivatizationsAttr(::mlir::ArrayAttr attr); + void setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr); + void setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue); + ::mlir::Attribute removeAsyncAttrAttr(); + ::mlir::Attribute removeWaitAttrAttr(); + ::mlir::Attribute removeSelfAttrAttr(); + ::mlir::Attribute removeReductionRecipesAttr(); + ::mlir::Attribute removePrivatizationsAttr(); + ::mlir::Attribute removeFirstprivatizationsAttr(); + ::mlir::Attribute removeDefaultAttrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, ::mlir::ValueRange numGangs, /*optional*/::mlir::Value numWorkers, /*optional*/::mlir::Value vectorLength, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of data operands. + unsigned getNumDataOperands(); + + /// The i-th data operand passed. + Value getDataOperand(unsigned i); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ParallelOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::PresentOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PresentOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PresentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PresentOpGenericAdaptorBase(PresentOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class PresentOpGenericAdaptor : public detail::PresentOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PresentOpGenericAdaptorBase; +public: + PresentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PresentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PresentOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PresentOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PresentOpAdaptor : public PresentOpGenericAdaptor<::mlir::ValueRange> { +public: + using PresentOpGenericAdaptor::PresentOpGenericAdaptor; + PresentOpAdaptor(PresentOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PresentOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PresentOpAdaptor; + template + using GenericAdaptor = PresentOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.present"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::PresentOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::PrivateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrivateOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PrivateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PrivateOpGenericAdaptorBase(PrivateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class PrivateOpGenericAdaptor : public detail::PrivateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrivateOpGenericAdaptorBase; +public: + PrivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrivateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PrivateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrivateOpAdaptor : public PrivateOpGenericAdaptor<::mlir::ValueRange> { +public: + using PrivateOpGenericAdaptor::PrivateOpGenericAdaptor; + PrivateOpAdaptor(PrivateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrivateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PrivateOpAdaptor; + template + using GenericAdaptor = PrivateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.private"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::PrivateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::PrivateRecipeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrivateRecipeOpGenericAdaptorBase { +public: + struct Properties { + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using typeTy = ::mlir::TypeAttr; + typeTy type; + + auto getType() { + auto &propStorage = this->type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setType(const ::mlir::TypeAttr &propValue) { + this->type = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.sym_name == this->sym_name && + rhs.type == this->type && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PrivateRecipeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PrivateRecipeOpGenericAdaptorBase(PrivateRecipeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + ::mlir::Region &getInitRegion(); + ::mlir::Region &getDestroyRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PrivateRecipeOpGenericAdaptor : public detail::PrivateRecipeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrivateRecipeOpGenericAdaptorBase; +public: + PrivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrivateRecipeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PrivateRecipeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrivateRecipeOpAdaptor : public PrivateRecipeOpGenericAdaptor<::mlir::ValueRange> { +public: + using PrivateRecipeOpGenericAdaptor::PrivateRecipeOpGenericAdaptor; + PrivateRecipeOpAdaptor(PrivateRecipeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrivateRecipeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::SymbolOpInterface::Trait, ::mlir::acc::RecipeInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PrivateRecipeOpAdaptor; + template + using GenericAdaptor = PrivateRecipeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name"), ::llvm::StringRef("type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.private.recipe"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getInitRegion(); + ::mlir::Region &getDestroyRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setTypeAttr(::mlir::TypeAttr attr); + void setType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::PrivateRecipeOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ReductionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReductionOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReductionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReductionOpGenericAdaptorBase(ReductionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class ReductionOpGenericAdaptor : public detail::ReductionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReductionOpGenericAdaptorBase; +public: + ReductionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReductionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReductionOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReductionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReductionOpAdaptor : public ReductionOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReductionOpGenericAdaptor::ReductionOpGenericAdaptor; + ReductionOpAdaptor(ReductionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReductionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReductionOpAdaptor; + template + using GenericAdaptor = ReductionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.reduction"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ReductionRecipeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReductionRecipeOpGenericAdaptorBase { +public: + struct Properties { + using reductionOperatorTy = ::mlir::acc::ReductionOperatorAttr; + reductionOperatorTy reductionOperator; + + auto getReductionOperator() { + auto &propStorage = this->reductionOperator; + return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(propStorage); + } + void setReductionOperator(const ::mlir::acc::ReductionOperatorAttr &propValue) { + this->reductionOperator = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using typeTy = ::mlir::TypeAttr; + typeTy type; + + auto getType() { + auto &propStorage = this->type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setType(const ::mlir::TypeAttr &propValue) { + this->type = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.reductionOperator == this->reductionOperator && + rhs.sym_name == this->sym_name && + rhs.type == this->type && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReductionRecipeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReductionRecipeOpGenericAdaptorBase(ReductionRecipeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + ::mlir::acc::ReductionOperatorAttr getReductionOperatorAttr(); + ::mlir::acc::ReductionOperator getReductionOperator(); + ::mlir::Region &getInitRegion(); + ::mlir::Region &getCombinerRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReductionRecipeOpGenericAdaptor : public detail::ReductionRecipeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReductionRecipeOpGenericAdaptorBase; +public: + ReductionRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReductionRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReductionRecipeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReductionRecipeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReductionRecipeOpAdaptor : public ReductionRecipeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReductionRecipeOpGenericAdaptor::ReductionRecipeOpGenericAdaptor; + ReductionRecipeOpAdaptor(ReductionRecipeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReductionRecipeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::SymbolOpInterface::Trait, ::mlir::acc::RecipeInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReductionRecipeOpAdaptor; + template + using GenericAdaptor = ReductionRecipeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("reductionOperator"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getReductionOperatorAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getReductionOperatorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.reduction.recipe"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getInitRegion(); + ::mlir::Region &getCombinerRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + ::mlir::acc::ReductionOperatorAttr getReductionOperatorAttr(); + ::mlir::acc::ReductionOperator getReductionOperator(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setTypeAttr(::mlir::TypeAttr attr); + void setType(::mlir::Type attrValue); + void setReductionOperatorAttr(::mlir::acc::ReductionOperatorAttr attr); + void setReductionOperator(::mlir::acc::ReductionOperator attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionRecipeOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::RoutineOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoutineOpGenericAdaptorBase { +public: + struct Properties { + using bind_nameTy = ::mlir::StringAttr; + bind_nameTy bind_name; + + auto getBindName() { + auto &propStorage = this->bind_name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setBindName(const ::mlir::StringAttr &propValue) { + this->bind_name = propValue; + } + using func_nameTy = ::mlir::StringAttr; + func_nameTy func_name; + + auto getFuncName() { + auto &propStorage = this->func_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setFuncName(const ::mlir::StringAttr &propValue) { + this->func_name = propValue; + } + using gangTy = ::mlir::UnitAttr; + gangTy gang; + + auto getGang() { + auto &propStorage = this->gang; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setGang(const ::mlir::UnitAttr &propValue) { + this->gang = propValue; + } + using gangDimTy = ::mlir::IntegerAttr; + gangDimTy gangDim; + + auto getGangDim() { + auto &propStorage = this->gangDim; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setGangDim(const ::mlir::IntegerAttr &propValue) { + this->gangDim = propValue; + } + using implicitTy = ::mlir::UnitAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setImplicit(const ::mlir::UnitAttr &propValue) { + this->implicit = propValue; + } + using nohostTy = ::mlir::UnitAttr; + nohostTy nohost; + + auto getNohost() { + auto &propStorage = this->nohost; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNohost(const ::mlir::UnitAttr &propValue) { + this->nohost = propValue; + } + using seqTy = ::mlir::UnitAttr; + seqTy seq; + + auto getSeq() { + auto &propStorage = this->seq; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setSeq(const ::mlir::UnitAttr &propValue) { + this->seq = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using vectorTy = ::mlir::UnitAttr; + vectorTy vector; + + auto getVector() { + auto &propStorage = this->vector; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setVector(const ::mlir::UnitAttr &propValue) { + this->vector = propValue; + } + using workerTy = ::mlir::UnitAttr; + workerTy worker; + + auto getWorker() { + auto &propStorage = this->worker; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWorker(const ::mlir::UnitAttr &propValue) { + this->worker = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.bind_name == this->bind_name && + rhs.func_name == this->func_name && + rhs.gang == this->gang && + rhs.gangDim == this->gangDim && + rhs.implicit == this->implicit && + rhs.nohost == this->nohost && + rhs.seq == this->seq && + rhs.sym_name == this->sym_name && + rhs.vector == this->vector && + rhs.worker == this->worker && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RoutineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RoutineOpGenericAdaptorBase(RoutineOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::StringAttr getFuncNameAttr(); + ::llvm::StringRef getFuncName(); + ::mlir::StringAttr getBindNameAttr(); + ::std::optional< ::llvm::StringRef > getBindName(); + ::mlir::UnitAttr getGangAttr(); + bool getGang(); + ::mlir::UnitAttr getWorkerAttr(); + bool getWorker(); + ::mlir::UnitAttr getVectorAttr(); + bool getVector(); + ::mlir::UnitAttr getSeqAttr(); + bool getSeq(); + ::mlir::UnitAttr getNohostAttr(); + bool getNohost(); + ::mlir::UnitAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::IntegerAttr getGangDimAttr(); + ::std::optional< ::mlir::APInt > getGangDim(); +}; +} // namespace detail +template +class RoutineOpGenericAdaptor : public detail::RoutineOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoutineOpGenericAdaptorBase; +public: + RoutineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoutineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoutineOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RoutineOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoutineOpAdaptor : public RoutineOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoutineOpGenericAdaptor::RoutineOpGenericAdaptor; + RoutineOpAdaptor(RoutineOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoutineOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RoutineOpAdaptor; + template + using GenericAdaptor = RoutineOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("bind_name"), ::llvm::StringRef("func_name"), ::llvm::StringRef("gang"), ::llvm::StringRef("gangDim"), ::llvm::StringRef("implicit"), ::llvm::StringRef("nohost"), ::llvm::StringRef("seq"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("vector"), ::llvm::StringRef("worker")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBindNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBindNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFuncNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFuncNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGangAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGangAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getGangDimAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getGangDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNohostAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNohostAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSeqAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSeqAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getVectorAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getVectorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWorkerAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWorkerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.routine"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::StringAttr getFuncNameAttr(); + ::llvm::StringRef getFuncName(); + ::mlir::StringAttr getBindNameAttr(); + ::std::optional< ::llvm::StringRef > getBindName(); + ::mlir::UnitAttr getGangAttr(); + bool getGang(); + ::mlir::UnitAttr getWorkerAttr(); + bool getWorker(); + ::mlir::UnitAttr getVectorAttr(); + bool getVector(); + ::mlir::UnitAttr getSeqAttr(); + bool getSeq(); + ::mlir::UnitAttr getNohostAttr(); + bool getNohost(); + ::mlir::UnitAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::IntegerAttr getGangDimAttr(); + ::std::optional< ::mlir::APInt > getGangDim(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setFuncNameAttr(::mlir::StringAttr attr); + void setFuncName(::llvm::StringRef attrValue); + void setBindNameAttr(::mlir::StringAttr attr); + void setBindName(::std::optional<::llvm::StringRef> attrValue); + void setGangAttr(::mlir::UnitAttr attr); + void setGang(bool attrValue); + void setWorkerAttr(::mlir::UnitAttr attr); + void setWorker(bool attrValue); + void setVectorAttr(::mlir::UnitAttr attr); + void setVector(bool attrValue); + void setSeqAttr(::mlir::UnitAttr attr); + void setSeq(bool attrValue); + void setNohostAttr(::mlir::UnitAttr attr); + void setNohost(bool attrValue); + void setImplicitAttr(::mlir::UnitAttr attr); + void setImplicit(bool attrValue); + void setGangDimAttr(::mlir::IntegerAttr attr); + ::mlir::Attribute removeBindNameAttr(); + ::mlir::Attribute removeGangAttr(); + ::mlir::Attribute removeWorkerAttr(); + ::mlir::Attribute removeVectorAttr(); + ::mlir::Attribute removeSeqAttr(); + ::mlir::Attribute removeNohostAttr(); + ::mlir::Attribute removeImplicitAttr(); + ::mlir::Attribute removeGangDimAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::StringAttr func_name, /*optional*/::mlir::StringAttr bind_name, /*optional*/::mlir::UnitAttr gang, /*optional*/::mlir::UnitAttr worker, /*optional*/::mlir::UnitAttr vector, /*optional*/::mlir::UnitAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::IntegerAttr gangDim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::StringAttr func_name, /*optional*/::mlir::StringAttr bind_name, /*optional*/::mlir::UnitAttr gang, /*optional*/::mlir::UnitAttr worker, /*optional*/::mlir::UnitAttr vector, /*optional*/::mlir::UnitAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::IntegerAttr gangDim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::llvm::StringRef func_name, /*optional*/::mlir::StringAttr bind_name, /*optional*/bool gang, /*optional*/bool worker, /*optional*/bool vector, /*optional*/bool seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::IntegerAttr gangDim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::llvm::StringRef func_name, /*optional*/::mlir::StringAttr bind_name, /*optional*/bool gang, /*optional*/bool worker, /*optional*/bool vector, /*optional*/bool seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::IntegerAttr gangDim); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static StringRef getGangDimKeyword() { return "dim"; } +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::RoutineOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::SerialOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SerialOpGenericAdaptorBase { +public: + struct Properties { + using asyncAttrTy = ::mlir::UnitAttr; + asyncAttrTy asyncAttr; + + auto getAsyncAttr() { + auto &propStorage = this->asyncAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setAsyncAttr(const ::mlir::UnitAttr &propValue) { + this->asyncAttr = propValue; + } + using defaultAttrTy = ::mlir::acc::ClauseDefaultValueAttr; + defaultAttrTy defaultAttr; + + auto getDefaultAttr() { + auto &propStorage = this->defaultAttr; + return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(propStorage); + } + void setDefaultAttr(const ::mlir::acc::ClauseDefaultValueAttr &propValue) { + this->defaultAttr = propValue; + } + using firstprivatizationsTy = ::mlir::ArrayAttr; + firstprivatizationsTy firstprivatizations; + + auto getFirstprivatizations() { + auto &propStorage = this->firstprivatizations; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setFirstprivatizations(const ::mlir::ArrayAttr &propValue) { + this->firstprivatizations = propValue; + } + using privatizationsTy = ::mlir::ArrayAttr; + privatizationsTy privatizations; + + auto getPrivatizations() { + auto &propStorage = this->privatizations; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setPrivatizations(const ::mlir::ArrayAttr &propValue) { + this->privatizations = propValue; + } + using reductionRecipesTy = ::mlir::ArrayAttr; + reductionRecipesTy reductionRecipes; + + auto getReductionRecipes() { + auto &propStorage = this->reductionRecipes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setReductionRecipes(const ::mlir::ArrayAttr &propValue) { + this->reductionRecipes = propValue; + } + using selfAttrTy = ::mlir::UnitAttr; + selfAttrTy selfAttr; + + auto getSelfAttr() { + auto &propStorage = this->selfAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setSelfAttr(const ::mlir::UnitAttr &propValue) { + this->selfAttr = propValue; + } + using waitAttrTy = ::mlir::UnitAttr; + waitAttrTy waitAttr; + + auto getWaitAttr() { + auto &propStorage = this->waitAttr; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWaitAttr(const ::mlir::UnitAttr &propValue) { + this->waitAttr = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.asyncAttr == this->asyncAttr && + rhs.defaultAttr == this->defaultAttr && + rhs.firstprivatizations == this->firstprivatizations && + rhs.privatizations == this->privatizations && + rhs.reductionRecipes == this->reductionRecipes && + rhs.selfAttr == this->selfAttr && + rhs.waitAttr == this->waitAttr && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SerialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SerialOpGenericAdaptorBase(SerialOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getAsyncAttrAttr(); + bool getAsyncAttr(); + ::mlir::UnitAttr getWaitAttrAttr(); + bool getWaitAttr(); + ::mlir::UnitAttr getSelfAttrAttr(); + bool getSelfAttr(); + ::mlir::ArrayAttr getReductionRecipesAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductionRecipes(); + ::mlir::ArrayAttr getPrivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrivatizations(); + ::mlir::ArrayAttr getFirstprivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getFirstprivatizations(); + ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr(); + ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SerialOpGenericAdaptor : public detail::SerialOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SerialOpGenericAdaptorBase; +public: + SerialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SerialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SerialOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SerialOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAsync() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getWaitOperands() { + return getODSOperands(1); + } + + ValueT getIfCond() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getSelfCond() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getReductionOperands() { + return getODSOperands(4); + } + + RangeT getGangPrivateOperands() { + return getODSOperands(5); + } + + RangeT getGangFirstPrivateOperands() { + return getODSOperands(6); + } + + RangeT getDataClauseOperands() { + return getODSOperands(7); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SerialOpAdaptor : public SerialOpGenericAdaptor<::mlir::ValueRange> { +public: + using SerialOpGenericAdaptor::SerialOpGenericAdaptor; + SerialOpAdaptor(SerialOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SerialOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SerialOpAdaptor; + template + using GenericAdaptor = SerialOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncAttr"), ::llvm::StringRef("defaultAttr"), ::llvm::StringRef("firstprivatizations"), ::llvm::StringRef("privatizations"), ::llvm::StringRef("reductionRecipes"), ::llvm::StringRef("selfAttr"), ::llvm::StringRef("waitAttr"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAsyncAttrAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAsyncAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDefaultAttrAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDefaultAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFirstprivatizationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFirstprivatizationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPrivatizationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPrivatizationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getReductionRecipesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getReductionRecipesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSelfAttrAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSelfAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getWaitAttrAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getWaitAttrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.serial"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAsync(); + ::mlir::Operation::operand_range getWaitOperands(); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::TypedValue<::mlir::IntegerType> getSelfCond(); + ::mlir::Operation::operand_range getReductionOperands(); + ::mlir::Operation::operand_range getGangPrivateOperands(); + ::mlir::Operation::operand_range getGangFirstPrivateOperands(); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getAsyncMutable(); + ::mlir::MutableOperandRange getWaitOperandsMutable(); + ::mlir::MutableOperandRange getIfCondMutable(); + ::mlir::MutableOperandRange getSelfCondMutable(); + ::mlir::MutableOperandRange getReductionOperandsMutable(); + ::mlir::MutableOperandRange getGangPrivateOperandsMutable(); + ::mlir::MutableOperandRange getGangFirstPrivateOperandsMutable(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getAsyncAttrAttr(); + bool getAsyncAttr(); + ::mlir::UnitAttr getWaitAttrAttr(); + bool getWaitAttr(); + ::mlir::UnitAttr getSelfAttrAttr(); + bool getSelfAttr(); + ::mlir::ArrayAttr getReductionRecipesAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductionRecipes(); + ::mlir::ArrayAttr getPrivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrivatizations(); + ::mlir::ArrayAttr getFirstprivatizationsAttr(); + ::std::optional< ::mlir::ArrayAttr > getFirstprivatizations(); + ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr(); + ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); + void setAsyncAttrAttr(::mlir::UnitAttr attr); + void setAsyncAttr(bool attrValue); + void setWaitAttrAttr(::mlir::UnitAttr attr); + void setWaitAttr(bool attrValue); + void setSelfAttrAttr(::mlir::UnitAttr attr); + void setSelfAttr(bool attrValue); + void setReductionRecipesAttr(::mlir::ArrayAttr attr); + void setPrivatizationsAttr(::mlir::ArrayAttr attr); + void setFirstprivatizationsAttr(::mlir::ArrayAttr attr); + void setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr); + void setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue); + ::mlir::Attribute removeAsyncAttrAttr(); + ::mlir::Attribute removeWaitAttrAttr(); + ::mlir::Attribute removeSelfAttrAttr(); + ::mlir::Attribute removeReductionRecipesAttr(); + ::mlir::Attribute removePrivatizationsAttr(); + ::mlir::Attribute removeFirstprivatizationsAttr(); + ::mlir::Attribute removeDefaultAttrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/::mlir::UnitAttr asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitAttr, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value async, /*optional*/bool asyncAttr, ::mlir::ValueRange waitOperands, /*optional*/bool waitAttr, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::ArrayAttr reductionRecipes, ::mlir::ValueRange gangPrivateOperands, /*optional*/::mlir::ArrayAttr privatizations, ::mlir::ValueRange gangFirstPrivateOperands, /*optional*/::mlir::ArrayAttr firstprivatizations, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of data operands. + unsigned getNumDataOperands(); + + /// The i-th data operand passed. + Value getDataOperand(unsigned i); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::SerialOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::SetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SetOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SetOpGenericAdaptorBase(SetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SetOpGenericAdaptor : public detail::SetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SetOpGenericAdaptorBase; +public: + SetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SetOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDeviceType() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDefaultAsync() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDeviceNum() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getIfCond() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SetOpAdaptor : public SetOpGenericAdaptor<::mlir::ValueRange> { +public: + using SetOpGenericAdaptor::SetOpGenericAdaptor; + SetOpAdaptor(SetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SetOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SetOpAdaptor; + template + using GenericAdaptor = SetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.set"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getDeviceType(); + ::mlir::Value getDefaultAsync(); + ::mlir::Value getDeviceNum(); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::MutableOperandRange getDeviceTypeMutable(); + ::mlir::MutableOperandRange getDefaultAsyncMutable(); + ::mlir::MutableOperandRange getDeviceNumMutable(); + ::mlir::MutableOperandRange getIfCondMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value deviceType, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value deviceType, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::SetOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::ShutdownOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShutdownOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ShutdownOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ShutdownOpGenericAdaptorBase(ShutdownOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShutdownOpGenericAdaptor : public detail::ShutdownOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShutdownOpGenericAdaptorBase; +public: + ShutdownOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShutdownOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShutdownOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ShutdownOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDeviceTypeOperands() { + return getODSOperands(0); + } + + ValueT getDeviceNumOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getIfCond() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShutdownOpAdaptor : public ShutdownOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShutdownOpGenericAdaptor::ShutdownOpGenericAdaptor; + ShutdownOpAdaptor(ShutdownOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShutdownOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ShutdownOpAdaptor; + template + using GenericAdaptor = ShutdownOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.shutdown"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDeviceTypeOperands(); + ::mlir::Value getDeviceNumOperand(); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::MutableOperandRange getDeviceTypeOperandsMutable(); + ::mlir::MutableOperandRange getDeviceNumOperandMutable(); + ::mlir::MutableOperandRange getIfCondMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange deviceTypeOperands, /*optional*/::mlir::Value deviceNumOperand, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange deviceTypeOperands, /*optional*/::mlir::Value deviceNumOperand, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ShutdownOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::TerminatorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TerminatorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TerminatorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TerminatorOpGenericAdaptorBase(TerminatorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TerminatorOpGenericAdaptor : public detail::TerminatorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TerminatorOpGenericAdaptorBase; +public: + TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TerminatorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TerminatorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TerminatorOpAdaptor : public TerminatorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TerminatorOpGenericAdaptor::TerminatorOpGenericAdaptor; + TerminatorOpAdaptor(TerminatorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TerminatorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TerminatorOpAdaptor; + template + using GenericAdaptor = TerminatorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.terminator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::TerminatorOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::UpdateDeviceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UpdateDeviceOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + UpdateDeviceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + UpdateDeviceOpGenericAdaptorBase(UpdateDeviceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class UpdateDeviceOpGenericAdaptor : public detail::UpdateDeviceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UpdateDeviceOpGenericAdaptorBase; +public: + UpdateDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UpdateDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UpdateDeviceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + UpdateDeviceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UpdateDeviceOpAdaptor : public UpdateDeviceOpGenericAdaptor<::mlir::ValueRange> { +public: + using UpdateDeviceOpGenericAdaptor::UpdateDeviceOpGenericAdaptor; + UpdateDeviceOpAdaptor(UpdateDeviceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UpdateDeviceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UpdateDeviceOpAdaptor; + template + using GenericAdaptor = UpdateDeviceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.update_device"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::UpdateDeviceOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::UpdateHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UpdateHostOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + UpdateHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + UpdateHostOpGenericAdaptorBase(UpdateHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class UpdateHostOpGenericAdaptor : public detail::UpdateHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UpdateHostOpGenericAdaptorBase; +public: + UpdateHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UpdateHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UpdateHostOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + UpdateHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAccPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UpdateHostOpAdaptor : public UpdateHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using UpdateHostOpGenericAdaptor::UpdateHostOpGenericAdaptor; + UpdateHostOpAdaptor(UpdateHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UpdateHostOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UpdateHostOpAdaptor; + template + using GenericAdaptor = UpdateHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.update_host"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getAccPtrMutable(); + ::mlir::MutableOperandRange getVarPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accPtr, /*optional*/::mlir::Value varPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Check if this is an acc update self. + bool isSelf() { + return getDataClause() == acc::DataClause::acc_update_self; + } +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::UpdateHostOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::UpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UpdateOpGenericAdaptorBase { +public: + struct Properties { + using asyncTy = ::mlir::UnitAttr; + asyncTy async; + + auto getAsync() { + auto &propStorage = this->async; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setAsync(const ::mlir::UnitAttr &propValue) { + this->async = propValue; + } + using ifPresentTy = ::mlir::UnitAttr; + ifPresentTy ifPresent; + + auto getIfPresent() { + auto &propStorage = this->ifPresent; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setIfPresent(const ::mlir::UnitAttr &propValue) { + this->ifPresent = propValue; + } + using waitTy = ::mlir::UnitAttr; + waitTy wait; + + auto getWait() { + auto &propStorage = this->wait; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setWait(const ::mlir::UnitAttr &propValue) { + this->wait = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.async == this->async && + rhs.ifPresent == this->ifPresent && + rhs.wait == this->wait && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + UpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + UpdateOpGenericAdaptorBase(UpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getAsyncAttr(); + bool getAsync(); + ::mlir::UnitAttr getWaitAttr(); + bool getWait(); + ::mlir::UnitAttr getIfPresentAttr(); + bool getIfPresent(); +}; +} // namespace detail +template +class UpdateOpGenericAdaptor : public detail::UpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UpdateOpGenericAdaptorBase; +public: + UpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + UpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfCond() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getAsyncOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getWaitOperands() { + return getODSOperands(3); + } + + RangeT getDeviceTypeOperands() { + return getODSOperands(4); + } + + RangeT getDataClauseOperands() { + return getODSOperands(5); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UpdateOpAdaptor : public UpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using UpdateOpGenericAdaptor::UpdateOpGenericAdaptor; + UpdateOpAdaptor(UpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UpdateOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = UpdateOpAdaptor; + template + using GenericAdaptor = UpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("async"), ::llvm::StringRef("ifPresent"), ::llvm::StringRef("wait"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAsyncAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAsyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIfPresentAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIfPresentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getWaitAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getWaitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.update"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::Value getAsyncOperand(); + ::mlir::Value getWaitDevnum(); + ::mlir::Operation::operand_range getWaitOperands(); + ::mlir::Operation::operand_range getDeviceTypeOperands(); + ::mlir::Operation::operand_range getDataClauseOperands(); + ::mlir::MutableOperandRange getIfCondMutable(); + ::mlir::MutableOperandRange getAsyncOperandMutable(); + ::mlir::MutableOperandRange getWaitDevnumMutable(); + ::mlir::MutableOperandRange getWaitOperandsMutable(); + ::mlir::MutableOperandRange getDeviceTypeOperandsMutable(); + ::mlir::MutableOperandRange getDataClauseOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getAsyncAttr(); + bool getAsync(); + ::mlir::UnitAttr getWaitAttr(); + bool getWait(); + ::mlir::UnitAttr getIfPresentAttr(); + bool getIfPresent(); + void setAsyncAttr(::mlir::UnitAttr attr); + void setAsync(bool attrValue); + void setWaitAttr(::mlir::UnitAttr attr); + void setWait(bool attrValue); + void setIfPresentAttr(::mlir::UnitAttr attr); + void setIfPresent(bool attrValue); + ::mlir::Attribute removeAsyncAttr(); + ::mlir::Attribute removeWaitAttr(); + ::mlir::Attribute removeIfPresentAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange deviceTypeOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange deviceTypeOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool async, /*optional*/bool wait, ::mlir::ValueRange deviceTypeOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool async, /*optional*/bool wait, ::mlir::ValueRange deviceTypeOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of data operands. + unsigned getNumDataOperands(); + + /// The i-th data operand passed. + Value getDataOperand(unsigned i); +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::UpdateOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::UseDeviceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UseDeviceOpGenericAdaptorBase { +public: + struct Properties { + using dataClauseTy = ::mlir::acc::DataClauseAttr; + dataClauseTy dataClause; + + auto getDataClause() { + auto &propStorage = this->dataClause; + return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); + } + void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { + this->dataClause = propValue; + } + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using structuredTy = ::mlir::BoolAttr; + structuredTy structured; + + auto getStructured() { + auto &propStorage = this->structured; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStructured(const ::mlir::BoolAttr &propValue) { + this->structured = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.dataClause == this->dataClause && + rhs.implicit == this->implicit && + rhs.name == this->name && + rhs.structured == this->structured && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + UseDeviceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + UseDeviceOpGenericAdaptorBase(UseDeviceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class UseDeviceOpGenericAdaptor : public detail::UseDeviceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UseDeviceOpGenericAdaptorBase; +public: + UseDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UseDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UseDeviceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + UseDeviceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UseDeviceOpAdaptor : public UseDeviceOpGenericAdaptor<::mlir::ValueRange> { +public: + using UseDeviceOpGenericAdaptor::UseDeviceOpGenericAdaptor; + UseDeviceOpAdaptor(UseDeviceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UseDeviceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UseDeviceOpAdaptor; + template + using GenericAdaptor = UseDeviceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDataClauseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStructuredAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.use_device"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::acc::PointerLikeType> getAccPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::acc::DataClauseAttr getDataClauseAttr(); + ::mlir::acc::DataClause getDataClause(); + ::mlir::BoolAttr getStructuredAttr(); + bool getStructured(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setDataClauseAttr(::mlir::acc::DataClauseAttr attr); + void setDataClause(::mlir::acc::DataClause attrValue); + void setStructuredAttr(::mlir::BoolAttr attr); + void setStructured(bool attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accPtr, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value varPtr, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::UseDeviceOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::WaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WaitOpGenericAdaptorBase { +public: + struct Properties { + using asyncTy = ::mlir::UnitAttr; + asyncTy async; + + auto getAsync() { + auto &propStorage = this->async; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setAsync(const ::mlir::UnitAttr &propValue) { + this->async = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.async == this->async && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + WaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + WaitOpGenericAdaptorBase(WaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getAsyncAttr(); + bool getAsync(); +}; +} // namespace detail +template +class WaitOpGenericAdaptor : public detail::WaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WaitOpGenericAdaptorBase; +public: + WaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WaitOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + WaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getWaitOperands() { + return getODSOperands(0); + } + + ValueT getAsyncOperand() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getWaitDevnum() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getIfCond() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WaitOpAdaptor : public WaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using WaitOpGenericAdaptor::WaitOpGenericAdaptor; + WaitOpAdaptor(WaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WaitOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = WaitOpAdaptor; + template + using GenericAdaptor = WaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("async"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAsyncAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAsyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.wait"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getWaitOperands(); + ::mlir::Value getAsyncOperand(); + ::mlir::Value getWaitDevnum(); + ::mlir::TypedValue<::mlir::IntegerType> getIfCond(); + ::mlir::MutableOperandRange getWaitOperandsMutable(); + ::mlir::MutableOperandRange getAsyncOperandMutable(); + ::mlir::MutableOperandRange getWaitDevnumMutable(); + ::mlir::MutableOperandRange getIfCondMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getAsyncAttr(); + bool getAsync(); + void setAsyncAttr(::mlir::UnitAttr attr); + void setAsync(bool attrValue); + ::mlir::Attribute removeAsyncAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::WaitOp) + +namespace mlir { +namespace acc { + +//===----------------------------------------------------------------------===// +// ::mlir::acc::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("acc.yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..e09c817732e28ae8f18d02fd6ab01802fdea8c1c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.cpp.inc @@ -0,0 +1,719 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::acc::DeclareActionAttr, +::mlir::acc::DeclareAttr, +::mlir::acc::ClauseDefaultValueAttr, +::mlir::acc::DataClauseAttr, +::mlir::acc::ReductionOperatorAttr, +::mlir::acc::RoutineInfoAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::acc::DeclareActionAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::acc::DeclareActionAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::acc::DeclareAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::acc::DeclareAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::acc::ClauseDefaultValueAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::acc::ClauseDefaultValueAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::acc::DataClauseAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::acc::DataClauseAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::acc::ReductionOperatorAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::acc::ReductionOperatorAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::acc::RoutineInfoAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::acc::RoutineInfoAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::acc::DeclareActionAttr>([&](auto t) { + printer << ::mlir::acc::DeclareActionAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::acc::DeclareAttr>([&](auto t) { + printer << ::mlir::acc::DeclareAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::acc::ClauseDefaultValueAttr>([&](auto t) { + printer << ::mlir::acc::ClauseDefaultValueAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::acc::DataClauseAttr>([&](auto t) { + printer << ::mlir::acc::DataClauseAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::acc::ReductionOperatorAttr>([&](auto t) { + printer << ::mlir::acc::ReductionOperatorAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::acc::RoutineInfoAttr>([&](auto t) { + printer << ::mlir::acc::RoutineInfoAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace acc { +namespace detail { +struct DeclareActionAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DeclareActionAttrStorage(SymbolRefAttr preAlloc, SymbolRefAttr postAlloc, SymbolRefAttr preDealloc, SymbolRefAttr postDealloc) : preAlloc(std::move(preAlloc)), postAlloc(std::move(postAlloc)), preDealloc(std::move(preDealloc)), postDealloc(std::move(postDealloc)) {} + + KeyTy getAsKey() const { + return KeyTy(preAlloc, postAlloc, preDealloc, postDealloc); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (preAlloc == std::get<0>(tblgenKey)) && (postAlloc == std::get<1>(tblgenKey)) && (preDealloc == std::get<2>(tblgenKey)) && (postDealloc == std::get<3>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); + } + + static DeclareActionAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto preAlloc = std::move(std::get<0>(tblgenKey)); + auto postAlloc = std::move(std::get<1>(tblgenKey)); + auto preDealloc = std::move(std::get<2>(tblgenKey)); + auto postDealloc = std::move(std::get<3>(tblgenKey)); + return new (allocator.allocate()) DeclareActionAttrStorage(std::move(preAlloc), std::move(postAlloc), std::move(preDealloc), std::move(postDealloc)); + } + + SymbolRefAttr preAlloc; + SymbolRefAttr postAlloc; + SymbolRefAttr preDealloc; + SymbolRefAttr postDealloc; +}; +} // namespace detail +DeclareActionAttr DeclareActionAttr::get(::mlir::MLIRContext *context, SymbolRefAttr preAlloc, SymbolRefAttr postAlloc, SymbolRefAttr preDealloc, SymbolRefAttr postDealloc) { + return Base::get(context, std::move(preAlloc), std::move(postAlloc), std::move(preDealloc), std::move(postDealloc)); +} + +::mlir::Attribute DeclareActionAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_preAlloc; + ::mlir::FailureOr _result_postAlloc; + ::mlir::FailureOr _result_preDealloc; + ::mlir::FailureOr _result_postDealloc; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_preAlloc = false; + bool _seen_postAlloc = false; + bool _seen_preDealloc = false; + bool _seen_postDealloc = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_preAlloc && _paramKey == "preAlloc") { + _seen_preAlloc = true; + + // Parse variable 'preAlloc' + _result_preAlloc = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_preAlloc)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareActionAttr parameter 'preAlloc' which is to be a `SymbolRefAttr`"); + return {}; + } + } else if (!_seen_postAlloc && _paramKey == "postAlloc") { + _seen_postAlloc = true; + + // Parse variable 'postAlloc' + _result_postAlloc = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_postAlloc)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareActionAttr parameter 'postAlloc' which is to be a `SymbolRefAttr`"); + return {}; + } + } else if (!_seen_preDealloc && _paramKey == "preDealloc") { + _seen_preDealloc = true; + + // Parse variable 'preDealloc' + _result_preDealloc = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_preDealloc)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareActionAttr parameter 'preDealloc' which is to be a `SymbolRefAttr`"); + return {}; + } + } else if (!_seen_postDealloc && _paramKey == "postDealloc") { + _seen_postDealloc = true; + + // Parse variable 'postDealloc' + _result_postDealloc = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_postDealloc)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareActionAttr parameter 'postDealloc' which is to be a `SymbolRefAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return DeclareActionAttr::get(odsParser.getContext(), + SymbolRefAttr((_result_preAlloc.value_or(SymbolRefAttr()))), + SymbolRefAttr((_result_postAlloc.value_or(SymbolRefAttr()))), + SymbolRefAttr((_result_preDealloc.value_or(SymbolRefAttr()))), + SymbolRefAttr((_result_postDealloc.value_or(SymbolRefAttr())))); +} + +void DeclareActionAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getPreAlloc() == SymbolRefAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "preAlloc = "; + if (!(getPreAlloc() == SymbolRefAttr())) { + odsPrinter.printStrippedAttrOrType(getPreAlloc()); + } + } + if (!(getPostAlloc() == SymbolRefAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "postAlloc = "; + if (!(getPostAlloc() == SymbolRefAttr())) { + odsPrinter.printStrippedAttrOrType(getPostAlloc()); + } + } + if (!(getPreDealloc() == SymbolRefAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "preDealloc = "; + if (!(getPreDealloc() == SymbolRefAttr())) { + odsPrinter.printStrippedAttrOrType(getPreDealloc()); + } + } + if (!(getPostDealloc() == SymbolRefAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "postDealloc = "; + if (!(getPostDealloc() == SymbolRefAttr())) { + odsPrinter.printStrippedAttrOrType(getPostDealloc()); + } + } + } + odsPrinter << ">"; +} + +SymbolRefAttr DeclareActionAttr::getPreAlloc() const { + return getImpl()->preAlloc; +} + +SymbolRefAttr DeclareActionAttr::getPostAlloc() const { + return getImpl()->postAlloc; +} + +SymbolRefAttr DeclareActionAttr::getPreDealloc() const { + return getImpl()->preDealloc; +} + +SymbolRefAttr DeclareActionAttr::getPostDealloc() const { + return getImpl()->postDealloc; +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareActionAttr) +namespace mlir { +namespace acc { +namespace detail { +struct DeclareAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DeclareAttrStorage(DataClauseAttr dataClause, bool implicit) : dataClause(std::move(dataClause)), implicit(std::move(implicit)) {} + + KeyTy getAsKey() const { + return KeyTy(dataClause, implicit); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (dataClause == std::get<0>(tblgenKey)) && (implicit == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static DeclareAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto dataClause = std::move(std::get<0>(tblgenKey)); + auto implicit = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) DeclareAttrStorage(std::move(dataClause), std::move(implicit)); + } + + DataClauseAttr dataClause; + bool implicit; +}; +} // namespace detail +DeclareAttr DeclareAttr::get(::mlir::MLIRContext *context, DataClauseAttr dataClause, bool implicit) { + return Base::get(context, std::move(dataClause), std::move(implicit)); +} + +DeclareAttr DeclareAttr::get(::mlir::MLIRContext *context, DataClauseAttr dataClause) { + return Base::get(context, dataClause, /*implicit=*/false); +} + +::mlir::Attribute DeclareAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_dataClause; + ::mlir::FailureOr _result_implicit; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_dataClause = false; + bool _seen_implicit = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_dataClause && _paramKey == "dataClause") { + _seen_dataClause = true; + + // Parse variable 'dataClause' + _result_dataClause = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_dataClause)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareAttr parameter 'dataClause' which is to be a `DataClauseAttr`"); + return {}; + } + } else if (!_seen_implicit && _paramKey == "implicit") { + _seen_implicit = true; + + // Parse variable 'implicit' + _result_implicit = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_implicit)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareAttr parameter 'implicit' which is to be a `bool`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + do { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } while(!odsParser.parseOptionalComma()); + if (!_seen_dataClause) { + odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "dataClause"; + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_dataClause)); + return DeclareAttr::get(odsParser.getContext(), + DataClauseAttr((*_result_dataClause)), + bool((_result_implicit.value_or(false)))); +} + +void DeclareAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "dataClause = "; + odsPrinter.printStrippedAttrOrType(getDataClause()); + if (!(getImplicit() == false)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "implicit = "; + if (!(getImplicit() == false)) { + odsPrinter.printStrippedAttrOrType(getImplicit()); + } + } + } + odsPrinter << ">"; +} + +DataClauseAttr DeclareAttr::getDataClause() const { + return getImpl()->dataClause; +} + +bool DeclareAttr::getImplicit() const { + return getImpl()->implicit; +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareAttr) +namespace mlir { +namespace acc { +namespace detail { +struct ClauseDefaultValueAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::acc::ClauseDefaultValue>; + ClauseDefaultValueAttrStorage(::mlir::acc::ClauseDefaultValue value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseDefaultValueAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseDefaultValueAttrStorage(std::move(value)); + } + + ::mlir::acc::ClauseDefaultValue value; +}; +} // namespace detail +ClauseDefaultValueAttr ClauseDefaultValueAttr::get(::mlir::MLIRContext *context, ::mlir::acc::ClauseDefaultValue value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseDefaultValueAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::acc::ClauseDefaultValue> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::ClauseDefaultValue> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::acc::symbolizeClauseDefaultValue(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::ClauseDefaultValue" << " to be one of: " << "present" << ", " << "none")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DefaultValueAttr parameter 'value' which is to be a `::mlir::acc::ClauseDefaultValue`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ClauseDefaultValueAttr::get(odsParser.getContext(), + ::mlir::acc::ClauseDefaultValue((*_result_value))); +} + +void ClauseDefaultValueAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyClauseDefaultValue(getValue()); +} + +::mlir::acc::ClauseDefaultValue ClauseDefaultValueAttr::getValue() const { + return getImpl()->value; +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ClauseDefaultValueAttr) +namespace mlir { +namespace acc { +namespace detail { +struct DataClauseAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::acc::DataClause>; + DataClauseAttrStorage(::mlir::acc::DataClause value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static DataClauseAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) DataClauseAttrStorage(std::move(value)); + } + + ::mlir::acc::DataClause value; +}; +} // namespace detail +DataClauseAttr DataClauseAttr::get(::mlir::MLIRContext *context, ::mlir::acc::DataClause value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute DataClauseAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::acc::DataClause> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::DataClause> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::acc::symbolizeDataClause(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::DataClause" << " to be one of: " << "acc_copyin" << ", " << "acc_copyin_readonly" << ", " << "acc_copy" << ", " << "acc_copyout" << ", " << "acc_copyout_zero" << ", " << "acc_present" << ", " << "acc_create" << ", " << "acc_create_zero" << ", " << "acc_delete" << ", " << "acc_attach" << ", " << "acc_detach" << ", " << "acc_no_create" << ", " << "acc_private" << ", " << "acc_firstprivate" << ", " << "acc_deviceptr" << ", " << "acc_getdeviceptr" << ", " << "acc_update_host" << ", " << "acc_update_self" << ", " << "acc_update_device" << ", " << "acc_use_device" << ", " << "acc_reduction" << ", " << "acc_declare_device_resident" << ", " << "acc_declare_link" << ", " << "acc_cache" << ", " << "acc_cache_readonly")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_DataClauseAttr parameter 'value' which is to be a `::mlir::acc::DataClause`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return DataClauseAttr::get(odsParser.getContext(), + ::mlir::acc::DataClause((*_result_value))); +} + +void DataClauseAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyDataClause(getValue()); +} + +::mlir::acc::DataClause DataClauseAttr::getValue() const { + return getImpl()->value; +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DataClauseAttr) +namespace mlir { +namespace acc { +namespace detail { +struct ReductionOperatorAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::acc::ReductionOperator>; + ReductionOperatorAttrStorage(::mlir::acc::ReductionOperator value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ReductionOperatorAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ReductionOperatorAttrStorage(std::move(value)); + } + + ::mlir::acc::ReductionOperator value; +}; +} // namespace detail +ReductionOperatorAttr ReductionOperatorAttr::get(::mlir::MLIRContext *context, ::mlir::acc::ReductionOperator value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ReductionOperatorAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::acc::ReductionOperator> _result_value; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::ReductionOperator> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::acc::symbolizeReductionOperator(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::ReductionOperator" << " to be one of: " << "add" << ", " << "mul" << ", " << "max" << ", " << "min" << ", " << "iand" << ", " << "ior" << ", " << "xor" << ", " << "eqv" << ", " << "neqv" << ", " << "land" << ", " << "lor")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_ReductionOperatorAttr parameter 'value' which is to be a `::mlir::acc::ReductionOperator`"); + return {}; + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_value)); + return ReductionOperatorAttr::get(odsParser.getContext(), + ::mlir::acc::ReductionOperator((*_result_value))); +} + +void ReductionOperatorAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << stringifyReductionOperator(getValue()); + odsPrinter << ">"; +} + +::mlir::acc::ReductionOperator ReductionOperatorAttr::getValue() const { + return getImpl()->value; +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionOperatorAttr) +namespace mlir { +namespace acc { +namespace detail { +struct RoutineInfoAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::llvm::ArrayRef>; + RoutineInfoAttrStorage(::llvm::ArrayRef accRoutines) : accRoutines(std::move(accRoutines)) {} + + KeyTy getAsKey() const { + return KeyTy(accRoutines); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (accRoutines == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static RoutineInfoAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto accRoutines = std::move(std::get<0>(tblgenKey)); + accRoutines = allocator.copyInto(accRoutines); + return new (allocator.allocate()) RoutineInfoAttrStorage(std::move(accRoutines)); + } + + ::llvm::ArrayRef accRoutines; +}; +} // namespace detail +RoutineInfoAttr RoutineInfoAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef accRoutines) { + return Base::get(context, std::move(accRoutines)); +} + +::mlir::Attribute RoutineInfoAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::llvm::SmallVector> _result_accRoutines; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse literal '[' + if (odsParser.parseLSquare()) return {}; + + // Parse variable 'accRoutines' + _result_accRoutines = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); + if (::mlir::failed(_result_accRoutines)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse RoutineInfoAttr parameter 'accRoutines' which is to be a `::llvm::ArrayRef`"); + return {}; + } + // Parse literal ']' + if (odsParser.parseRSquare()) return {}; + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_accRoutines)); + return RoutineInfoAttr::get(odsParser.getContext(), + ::llvm::ArrayRef((*_result_accRoutines))); +} + +void RoutineInfoAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + odsPrinter << "["; + odsPrinter.printStrippedAttrOrType(getAccRoutines()); + odsPrinter << "]"; + odsPrinter << ">"; +} + +::llvm::ArrayRef RoutineInfoAttr::getAccRoutines() const { + return getImpl()->accRoutines; +} + +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::RoutineInfoAttr) +namespace mlir { +namespace acc { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute OpenACCDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void OpenACCDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace acc +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..0b2c1ecb6168b64c09fe73c667f848af4f9ec5f9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.h.inc @@ -0,0 +1,130 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace acc { +class DeclareActionAttr; +class DeclareAttr; +class ClauseDefaultValueAttr; +class DataClauseAttr; +class ReductionOperatorAttr; +class RoutineInfoAttr; +namespace detail { +struct DeclareActionAttrStorage; +} // namespace detail +class DeclareActionAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DeclareActionAttr get(::mlir::MLIRContext *context, SymbolRefAttr preAlloc, SymbolRefAttr postAlloc, SymbolRefAttr preDealloc, SymbolRefAttr postDealloc); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"declare_action"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + SymbolRefAttr getPreAlloc() const; + SymbolRefAttr getPostAlloc() const; + SymbolRefAttr getPreDealloc() const; + SymbolRefAttr getPostDealloc() const; +}; +namespace detail { +struct DeclareAttrStorage; +} // namespace detail +class DeclareAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DeclareAttr get(::mlir::MLIRContext *context, DataClauseAttr dataClause, bool implicit); + static DeclareAttr get(::mlir::MLIRContext *context, DataClauseAttr dataClause); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"declare"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DataClauseAttr getDataClause() const; + bool getImplicit() const; +}; +namespace detail { +struct ClauseDefaultValueAttrStorage; +} // namespace detail +class ClauseDefaultValueAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseDefaultValueAttr get(::mlir::MLIRContext *context, ::mlir::acc::ClauseDefaultValue value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"defaultvalue"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::acc::ClauseDefaultValue getValue() const; +}; +namespace detail { +struct DataClauseAttrStorage; +} // namespace detail +class DataClauseAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DataClauseAttr get(::mlir::MLIRContext *context, ::mlir::acc::DataClause value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"data_clause"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::acc::DataClause getValue() const; +}; +namespace detail { +struct ReductionOperatorAttrStorage; +} // namespace detail +class ReductionOperatorAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ReductionOperatorAttr get(::mlir::MLIRContext *context, ::mlir::acc::ReductionOperator value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"reduction_operator"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::acc::ReductionOperator getValue() const; +}; +namespace detail { +struct RoutineInfoAttrStorage; +} // namespace detail +class RoutineInfoAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static RoutineInfoAttr get(::mlir::MLIRContext *context, ::llvm::ArrayRef accRoutines); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"routine_info"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::ArrayRef getAccRoutines() const; +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareActionAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ClauseDefaultValueAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DataClauseAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionOperatorAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::RoutineInfoAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..5b8ff852bc8b36fc237663f315992135f0ce3f8c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsDialect.cpp.inc @@ -0,0 +1,27 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenACCOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::OpenACCDialect) +namespace mlir { +namespace acc { + +OpenACCDialect::OpenACCDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect<::mlir::memref::MemRefDialect>(); + + getContext()->loadDialect<::mlir::LLVM::LLVMDialect>(); + + initialize(); +} + +OpenACCDialect::~OpenACCDialect() = default; + +} // namespace acc +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..0faf7518c1f09787ee20ed249a89311253e07f6c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsDialect.h.inc @@ -0,0 +1,41 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenACCOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace acc { + +class OpenACCDialect : public ::mlir::Dialect { + explicit OpenACCDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~OpenACCDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("acc"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::OpenACCDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..b85fc033ad7a53b787b36944f133f4640a005795 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsEnums.cpp.inc @@ -0,0 +1,186 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenACCOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace acc { +::llvm::StringRef stringifyClauseDefaultValue(ClauseDefaultValue val) { + switch (val) { + case ClauseDefaultValue::Present: return "present"; + case ClauseDefaultValue::None: return "none"; + } + return ""; +} + +::std::optional symbolizeClauseDefaultValue(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("present", ClauseDefaultValue::Present) + .Case("none", ClauseDefaultValue::None) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseDefaultValue(uint32_t value) { + switch (value) { + case 0: return ClauseDefaultValue::Present; + case 1: return ClauseDefaultValue::None; + default: return ::std::nullopt; + } +} + +} // namespace acc +} // namespace mlir + +namespace mlir { +namespace acc { +::llvm::StringRef stringifyDataClause(DataClause val) { + switch (val) { + case DataClause::acc_copyin: return "acc_copyin"; + case DataClause::acc_copyin_readonly: return "acc_copyin_readonly"; + case DataClause::acc_copy: return "acc_copy"; + case DataClause::acc_copyout: return "acc_copyout"; + case DataClause::acc_copyout_zero: return "acc_copyout_zero"; + case DataClause::acc_present: return "acc_present"; + case DataClause::acc_create: return "acc_create"; + case DataClause::acc_create_zero: return "acc_create_zero"; + case DataClause::acc_delete: return "acc_delete"; + case DataClause::acc_attach: return "acc_attach"; + case DataClause::acc_detach: return "acc_detach"; + case DataClause::acc_no_create: return "acc_no_create"; + case DataClause::acc_private: return "acc_private"; + case DataClause::acc_firstprivate: return "acc_firstprivate"; + case DataClause::acc_deviceptr: return "acc_deviceptr"; + case DataClause::acc_getdeviceptr: return "acc_getdeviceptr"; + case DataClause::acc_update_host: return "acc_update_host"; + case DataClause::acc_update_self: return "acc_update_self"; + case DataClause::acc_update_device: return "acc_update_device"; + case DataClause::acc_use_device: return "acc_use_device"; + case DataClause::acc_reduction: return "acc_reduction"; + case DataClause::acc_declare_device_resident: return "acc_declare_device_resident"; + case DataClause::acc_declare_link: return "acc_declare_link"; + case DataClause::acc_cache: return "acc_cache"; + case DataClause::acc_cache_readonly: return "acc_cache_readonly"; + } + return ""; +} + +::std::optional symbolizeDataClause(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("acc_copyin", DataClause::acc_copyin) + .Case("acc_copyin_readonly", DataClause::acc_copyin_readonly) + .Case("acc_copy", DataClause::acc_copy) + .Case("acc_copyout", DataClause::acc_copyout) + .Case("acc_copyout_zero", DataClause::acc_copyout_zero) + .Case("acc_present", DataClause::acc_present) + .Case("acc_create", DataClause::acc_create) + .Case("acc_create_zero", DataClause::acc_create_zero) + .Case("acc_delete", DataClause::acc_delete) + .Case("acc_attach", DataClause::acc_attach) + .Case("acc_detach", DataClause::acc_detach) + .Case("acc_no_create", DataClause::acc_no_create) + .Case("acc_private", DataClause::acc_private) + .Case("acc_firstprivate", DataClause::acc_firstprivate) + .Case("acc_deviceptr", DataClause::acc_deviceptr) + .Case("acc_getdeviceptr", DataClause::acc_getdeviceptr) + .Case("acc_update_host", DataClause::acc_update_host) + .Case("acc_update_self", DataClause::acc_update_self) + .Case("acc_update_device", DataClause::acc_update_device) + .Case("acc_use_device", DataClause::acc_use_device) + .Case("acc_reduction", DataClause::acc_reduction) + .Case("acc_declare_device_resident", DataClause::acc_declare_device_resident) + .Case("acc_declare_link", DataClause::acc_declare_link) + .Case("acc_cache", DataClause::acc_cache) + .Case("acc_cache_readonly", DataClause::acc_cache_readonly) + .Default(::std::nullopt); +} +::std::optional symbolizeDataClause(uint64_t value) { + switch (value) { + case 1: return DataClause::acc_copyin; + case 2: return DataClause::acc_copyin_readonly; + case 3: return DataClause::acc_copy; + case 4: return DataClause::acc_copyout; + case 5: return DataClause::acc_copyout_zero; + case 6: return DataClause::acc_present; + case 7: return DataClause::acc_create; + case 8: return DataClause::acc_create_zero; + case 9: return DataClause::acc_delete; + case 10: return DataClause::acc_attach; + case 11: return DataClause::acc_detach; + case 12: return DataClause::acc_no_create; + case 13: return DataClause::acc_private; + case 14: return DataClause::acc_firstprivate; + case 15: return DataClause::acc_deviceptr; + case 16: return DataClause::acc_getdeviceptr; + case 17: return DataClause::acc_update_host; + case 18: return DataClause::acc_update_self; + case 19: return DataClause::acc_update_device; + case 20: return DataClause::acc_use_device; + case 21: return DataClause::acc_reduction; + case 22: return DataClause::acc_declare_device_resident; + case 23: return DataClause::acc_declare_link; + case 24: return DataClause::acc_cache; + case 25: return DataClause::acc_cache_readonly; + default: return ::std::nullopt; + } +} + +} // namespace acc +} // namespace mlir + +namespace mlir { +namespace acc { +::llvm::StringRef stringifyReductionOperator(ReductionOperator val) { + switch (val) { + case ReductionOperator::AccAdd: return "add"; + case ReductionOperator::AccMul: return "mul"; + case ReductionOperator::AccMax: return "max"; + case ReductionOperator::AccMin: return "min"; + case ReductionOperator::AccIand: return "iand"; + case ReductionOperator::AccIor: return "ior"; + case ReductionOperator::AccXor: return "xor"; + case ReductionOperator::AccEqv: return "eqv"; + case ReductionOperator::AccNeqv: return "neqv"; + case ReductionOperator::AccLand: return "land"; + case ReductionOperator::AccLor: return "lor"; + } + return ""; +} + +::std::optional symbolizeReductionOperator(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("add", ReductionOperator::AccAdd) + .Case("mul", ReductionOperator::AccMul) + .Case("max", ReductionOperator::AccMax) + .Case("min", ReductionOperator::AccMin) + .Case("iand", ReductionOperator::AccIand) + .Case("ior", ReductionOperator::AccIor) + .Case("xor", ReductionOperator::AccXor) + .Case("eqv", ReductionOperator::AccEqv) + .Case("neqv", ReductionOperator::AccNeqv) + .Case("land", ReductionOperator::AccLand) + .Case("lor", ReductionOperator::AccLor) + .Default(::std::nullopt); +} +::std::optional symbolizeReductionOperator(uint32_t value) { + switch (value) { + case 0: return ReductionOperator::AccAdd; + case 1: return ReductionOperator::AccMul; + case 2: return ReductionOperator::AccMax; + case 3: return ReductionOperator::AccMin; + case 4: return ReductionOperator::AccIand; + case 5: return ReductionOperator::AccIor; + case 6: return ReductionOperator::AccXor; + case 7: return ReductionOperator::AccEqv; + case 8: return ReductionOperator::AccNeqv; + case 9: return ReductionOperator::AccLand; + case 10: return ReductionOperator::AccLor; + default: return ::std::nullopt; + } +} + +} // namespace acc +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e935fc96dc22b620a45fd15520891303c68b5fc2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsEnums.h.inc @@ -0,0 +1,284 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenACCOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace acc { +// DefaultValue Clause +enum class ClauseDefaultValue : uint32_t { + Present = 0, + None = 1, +}; + +::std::optional symbolizeClauseDefaultValue(uint32_t); +::llvm::StringRef stringifyClauseDefaultValue(ClauseDefaultValue); +::std::optional symbolizeClauseDefaultValue(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseDefaultValue() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseDefaultValue enumValue) { + return stringifyClauseDefaultValue(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseDefaultValue(str); +} +} // namespace acc +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::acc::ClauseDefaultValue, ::mlir::acc::ClauseDefaultValue> { + template + static FailureOr<::mlir::acc::ClauseDefaultValue> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for DefaultValue Clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::acc::ClauseDefaultValue> attr = ::mlir::acc::symbolizeEnum<::mlir::acc::ClauseDefaultValue>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid DefaultValue Clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::acc::ClauseDefaultValue value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::acc::ClauseDefaultValue> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::acc::ClauseDefaultValue getEmptyKey() { + return static_cast<::mlir::acc::ClauseDefaultValue>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::acc::ClauseDefaultValue getTombstoneKey() { + return static_cast<::mlir::acc::ClauseDefaultValue>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::acc::ClauseDefaultValue &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::acc::ClauseDefaultValue &lhs, const ::mlir::acc::ClauseDefaultValue &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace acc { +// data clauses supported by OpenACC +enum class DataClause : uint64_t { + acc_copyin = 1, + acc_copyin_readonly = 2, + acc_copy = 3, + acc_copyout = 4, + acc_copyout_zero = 5, + acc_present = 6, + acc_create = 7, + acc_create_zero = 8, + acc_delete = 9, + acc_attach = 10, + acc_detach = 11, + acc_no_create = 12, + acc_private = 13, + acc_firstprivate = 14, + acc_deviceptr = 15, + acc_getdeviceptr = 16, + acc_update_host = 17, + acc_update_self = 18, + acc_update_device = 19, + acc_use_device = 20, + acc_reduction = 21, + acc_declare_device_resident = 22, + acc_declare_link = 23, + acc_cache = 24, + acc_cache_readonly = 25, +}; + +::std::optional symbolizeDataClause(uint64_t); +::llvm::StringRef stringifyDataClause(DataClause); +::std::optional symbolizeDataClause(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForDataClause() { + return 25; +} + + +inline ::llvm::StringRef stringifyEnum(DataClause enumValue) { + return stringifyDataClause(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeDataClause(str); +} +} // namespace acc +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::acc::DataClause, ::mlir::acc::DataClause> { + template + static FailureOr<::mlir::acc::DataClause> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for data clauses supported by OpenACC"); + + // Symbolize the keyword. + if (::std::optional<::mlir::acc::DataClause> attr = ::mlir::acc::symbolizeEnum<::mlir::acc::DataClause>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid data clauses supported by OpenACC specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::acc::DataClause value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::acc::DataClause> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::acc::DataClause getEmptyKey() { + return static_cast<::mlir::acc::DataClause>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::acc::DataClause getTombstoneKey() { + return static_cast<::mlir::acc::DataClause>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::acc::DataClause &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::acc::DataClause &lhs, const ::mlir::acc::DataClause &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace acc { +// built-in reduction operations supported by OpenACC +enum class ReductionOperator : uint32_t { + AccAdd = 0, + AccMul = 1, + AccMax = 2, + AccMin = 3, + AccIand = 4, + AccIor = 5, + AccXor = 6, + AccEqv = 7, + AccNeqv = 8, + AccLand = 9, + AccLor = 10, +}; + +::std::optional symbolizeReductionOperator(uint32_t); +::llvm::StringRef stringifyReductionOperator(ReductionOperator); +::std::optional symbolizeReductionOperator(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForReductionOperator() { + return 10; +} + + +inline ::llvm::StringRef stringifyEnum(ReductionOperator enumValue) { + return stringifyReductionOperator(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeReductionOperator(str); +} +} // namespace acc +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::acc::ReductionOperator, ::mlir::acc::ReductionOperator> { + template + static FailureOr<::mlir::acc::ReductionOperator> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for built-in reduction operations supported by OpenACC"); + + // Symbolize the keyword. + if (::std::optional<::mlir::acc::ReductionOperator> attr = ::mlir::acc::symbolizeEnum<::mlir::acc::ReductionOperator>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid built-in reduction operations supported by OpenACC specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::acc::ReductionOperator value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::acc::ReductionOperator> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::acc::ReductionOperator getEmptyKey() { + return static_cast<::mlir::acc::ReductionOperator>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::acc::ReductionOperator getTombstoneKey() { + return static_cast<::mlir::acc::ReductionOperator>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::acc::ReductionOperator &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::acc::ReductionOperator &lhs, const ::mlir::acc::ReductionOperator &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..818641c76f1c155d4e0fa3b3c9fba17b53b4a985 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.cpp.inc @@ -0,0 +1,14 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// For the given region of the operation return the block +/// inside the region, where an alloca-like operation should be inserted. +/// The default implementation returns the entry block of the region. +::mlir::Block *mlir::acc::RecipeInterface::getAllocaBlock(::mlir::Region & region) { + return getImpl()->getAllocaBlock(getImpl(), getOperation(), region); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..7b056a3eba8a09718360746a81712cb655737e7c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.h.inc @@ -0,0 +1,82 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace acc { +class RecipeInterface; +namespace detail { +struct RecipeInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::Block *(*getAllocaBlock)(const Concept *impl, ::mlir::Operation *, ::mlir::Region &); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::acc::RecipeInterface; + Model() : Concept{getAllocaBlock} {} + + static inline ::mlir::Block *getAllocaBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Region & region); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::acc::RecipeInterface; + FallbackModel() : Concept{getAllocaBlock} {} + + static inline ::mlir::Block *getAllocaBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Region & region); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::Block *getAllocaBlock(::mlir::Operation *tablegen_opaque_val, ::mlir::Region ®ion) const; + }; +};template +struct RecipeInterfaceTrait; + +} // namespace detail +class RecipeInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::RecipeInterfaceTrait {}; + /// For the given region of the operation return the block + /// inside the region, where an alloca-like operation should be inserted. + /// The default implementation returns the entry block of the region. + ::mlir::Block *getAllocaBlock(::mlir::Region & region); +}; +namespace detail { + template + struct RecipeInterfaceTrait : public ::mlir::OpInterface::Trait { + /// For the given region of the operation return the block + /// inside the region, where an alloca-like operation should be inserted. + /// The default implementation returns the entry block of the region. + ::mlir::Block *getAllocaBlock(::mlir::Region & region) { + return ®ion.front(); + } + }; +}// namespace detail +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +template +::mlir::Block *detail::RecipeInterfaceInterfaceTraits::Model::getAllocaBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Region & region) { + return (llvm::cast(tablegen_opaque_val)).getAllocaBlock(region); +} +template +::mlir::Block *detail::RecipeInterfaceInterfaceTraits::FallbackModel::getAllocaBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Region & region) { + return static_cast(impl)->getAllocaBlock(tablegen_opaque_val, region); +} +template +::mlir::Block *detail::RecipeInterfaceInterfaceTraits::ExternalModel::getAllocaBlock(::mlir::Operation *tablegen_opaque_val, ::mlir::Region ®ion) const { +return ®ion.front(); +} +} // namespace acc +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsTypes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsTypes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..e549e1cc91af6f9a669b030ebc408d95c376d422 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsTypes.cpp.inc @@ -0,0 +1,71 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_LIST +#undef GET_TYPEDEF_LIST + +::mlir::acc::DataBoundsType + +#endif // GET_TYPEDEF_LIST + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + +static ::mlir::OptionalParseResult generatedTypeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::acc::DataBoundsType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::acc::DataBoundsType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedTypePrinter(::mlir::Type def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Type, ::mlir::LogicalResult>(def) .Case<::mlir::acc::DataBoundsType>([&](auto t) { + printer << ::mlir::acc::DataBoundsType::getMnemonic(); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace acc { +} // namespace acc +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DataBoundsType) +namespace mlir { +namespace acc { + +/// Parse a type registered to this dialect. +::mlir::Type OpenACCDialect::parseType(::mlir::DialectAsmParser &parser) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef mnemonic; + ::mlir::Type genType; + auto parseResult = generatedTypeParser(parser, &mnemonic, genType); + if (parseResult.has_value()) + return genType; + + parser.emitError(typeLoc) << "unknown type `" + << mnemonic << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print a type registered to this dialect. +void OpenACCDialect::printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedTypePrinter(type, printer))) + return; + +} +} // namespace acc +} // namespace mlir + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsTypes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsTypes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..db066c83b595a3f8e4409d20978519913335639f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCOpsTypes.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace acc { +class DataBoundsType; +class DataBoundsType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"data_bounds_ty"}; + } + +}; +} // namespace acc +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DataBoundsType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..71a0b16ba42615b6b3798e288ffb624ea3d788e3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.cpp.inc @@ -0,0 +1,12 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Returns the pointee type or null if the pointer has no pointee type +::mlir::Type mlir::acc::PointerLikeType::getElementType() const { + return getImpl()->getElementType(getImpl(), *this); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..48fd0cc76a0cba0e481057ed4c073d603b555746 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.h.inc @@ -0,0 +1,69 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace acc { +class PointerLikeType; +namespace detail { +struct PointerLikeTypeInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::Type (*getElementType)(const Concept *impl, ::mlir::Type ); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::acc::PointerLikeType; + Model() : Concept{getElementType} {} + + static inline ::mlir::Type getElementType(const Concept *impl, ::mlir::Type tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::acc::PointerLikeType; + FallbackModel() : Concept{getElementType} {} + + static inline ::mlir::Type getElementType(const Concept *impl, ::mlir::Type tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteType; + }; +};template +struct PointerLikeTypeTrait; + +} // namespace detail +class PointerLikeType : public ::mlir::TypeInterface { +public: + using ::mlir::TypeInterface::TypeInterface; + template + struct Trait : public detail::PointerLikeTypeTrait {}; + /// Returns the pointee type or null if the pointer has no pointee type + ::mlir::Type getElementType() const; +}; +namespace detail { + template + struct PointerLikeTypeTrait : public ::mlir::TypeInterface::Trait { + }; +}// namespace detail +} // namespace acc +} // namespace mlir +namespace mlir { +namespace acc { +template +::mlir::Type detail::PointerLikeTypeInterfaceTraits::Model::getElementType(const Concept *impl, ::mlir::Type tablegen_opaque_val) { + return (::llvm::cast(tablegen_opaque_val)).getElementType(); +} +template +::mlir::Type detail::PointerLikeTypeInterfaceTraits::FallbackModel::getElementType(const Concept *impl, ::mlir::Type tablegen_opaque_val) { + return static_cast(impl)->getElementType(tablegen_opaque_val); +} +} // namespace acc +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..cc05dff3ad06849a521cda3ffdbf067536dc3cbf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.cpp.inc @@ -0,0 +1,77 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Returns the first operation in atomic capture region. +::mlir::Operation *mlir::accomp::AtomicCaptureOpInterface::getFirstOp() { + return getImpl()->getFirstOp(getImpl(), getOperation()); + } +/// Returns the second operation in atomic capture region. +::mlir::Operation *mlir::accomp::AtomicCaptureOpInterface::getSecondOp() { + return getImpl()->getSecondOp(getImpl(), getOperation()); + } +/// Common verifier of the required region for operation that implements +/// atomic capture interface. +::mlir::LogicalResult mlir::accomp::AtomicCaptureOpInterface::verifyRegionsCommon() { + return getImpl()->verifyRegionsCommon(getImpl(), getOperation()); + } +/// Common verifier for operation that implements atomic read interface. +::mlir::LogicalResult mlir::accomp::AtomicReadOpInterface::verifyCommon() { + return getImpl()->verifyCommon(getImpl(), getOperation()); + } +/// Obtains `x` which is the address from where the value is atomically +/// read. +::mlir::Value mlir::accomp::AtomicReadOpInterface::getX() { + return getImpl()->getX(getImpl(), getOperation()); + } +/// Obtains `v` which is the address where the value is stored after +/// reading. +::mlir::Value mlir::accomp::AtomicReadOpInterface::getV() { + return getImpl()->getV(getImpl(), getOperation()); + } +/// Obtains `x` which is the address to which the value is atomically +/// written to / read from. +::mlir::Value mlir::accomp::AtomicUpdateOpInterface::getX() { + return getImpl()->getX(getImpl(), getOperation()); + } +/// Returns the first operation in atomic update region. +::mlir::Operation *mlir::accomp::AtomicUpdateOpInterface::getFirstOp() { + return getImpl()->getFirstOp(getImpl(), getOperation()); + } +/// Returns true if the new value is same as old value and the operation is +/// a no-op, false otherwise. +bool mlir::accomp::AtomicUpdateOpInterface::isNoOp() { + return getImpl()->isNoOp(getImpl(), getOperation()); + } +/// Returns the new value if the operation is equivalent to just a write +/// operation. Otherwise, returns nullptr. +::mlir::Value mlir::accomp::AtomicUpdateOpInterface::getWriteOpVal() { + return getImpl()->getWriteOpVal(getImpl(), getOperation()); + } +/// Common verifier for operation that implements atomic update interface. +::mlir::LogicalResult mlir::accomp::AtomicUpdateOpInterface::verifyCommon() { + return getImpl()->verifyCommon(getImpl(), getOperation()); + } +/// Common verifier of the required region for operation that implements +/// atomic update interface. +::mlir::LogicalResult mlir::accomp::AtomicUpdateOpInterface::verifyRegionsCommon() { + return getImpl()->verifyRegionsCommon(getImpl(), getOperation()); + } +/// Common verifier for operation that implements atomic write interface. +::mlir::LogicalResult mlir::accomp::AtomicWriteOpInterface::verifyCommon() { + return getImpl()->verifyCommon(getImpl(), getOperation()); + } +/// Obtains `x` which is the address to which the value is atomically +/// written to. +::mlir::Value mlir::accomp::AtomicWriteOpInterface::getX() { + return getImpl()->getX(getImpl(), getOperation()); + } +/// Obtains `expr` which corresponds to the expression whose value is +/// written to `x`. +::mlir::Value mlir::accomp::AtomicWriteOpInterface::getExpr() { + return getImpl()->getExpr(getImpl(), getOperation()); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h new file mode 100644 index 0000000000000000000000000000000000000000..cfe0ec5185bc8ff29879a97671ff50c89bf67559 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h @@ -0,0 +1,22 @@ +//===- DirectiveAtomicInterfaces.h - directive atomic ops interfaces ------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements the operation interface for atomic operations used +// in OpenACC and OpenMP. +// +//===----------------------------------------------------------------------===// + +#ifndef OPENACC_MP_COMMON_INTERFACES_ATOMICINTERFACES_H_ +#define OPENACC_MP_COMMON_INTERFACES_ATOMICINTERFACES_H_ + +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" + +#include "mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h.inc" + +#endif // OPENACC_MP_COMMON_INTERFACES_ATOMICINTERFACES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..1db9c56996aec54ae0d993dc128873a25171a9b7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h.inc @@ -0,0 +1,640 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace accomp { +class AtomicReadOpInterface; +namespace detail { +struct AtomicReadOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::LogicalResult (*verifyCommon)(const Concept *impl, ::mlir::Operation *); + ::mlir::Value (*getX)(const Concept *impl, ::mlir::Operation *); + ::mlir::Value (*getV)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::accomp::AtomicReadOpInterface; + Model() : Concept{verifyCommon, getX, getV} {} + + static inline ::mlir::LogicalResult verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getV(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::accomp::AtomicReadOpInterface; + FallbackModel() : Concept{verifyCommon, getX, getV} {} + + static inline ::mlir::LogicalResult verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getV(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::LogicalResult verifyCommon(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct AtomicReadOpInterfaceTrait; + +} // namespace detail +class AtomicReadOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AtomicReadOpInterfaceTrait {}; + /// Common verifier for operation that implements atomic read interface. + ::mlir::LogicalResult verifyCommon(); + /// Obtains `x` which is the address from where the value is atomically + /// read. + ::mlir::Value getX(); + /// Obtains `v` which is the address where the value is stored after + /// reading. + ::mlir::Value getV(); +}; +namespace detail { + template + struct AtomicReadOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Common verifier for operation that implements atomic read interface. + ::mlir::LogicalResult verifyCommon() { + if ((*static_cast(this)).getX() == (*static_cast(this)).getV()) { + return (*static_cast(this)).emitError( + "read and write must not be to the same location for atomic reads"); + } + return mlir::success(); + } + }; +}// namespace detail +} // namespace accomp +} // namespace mlir +namespace mlir { +namespace accomp { +class AtomicWriteOpInterface; +namespace detail { +struct AtomicWriteOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::LogicalResult (*verifyCommon)(const Concept *impl, ::mlir::Operation *); + ::mlir::Value (*getX)(const Concept *impl, ::mlir::Operation *); + ::mlir::Value (*getExpr)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::accomp::AtomicWriteOpInterface; + Model() : Concept{verifyCommon, getX, getExpr} {} + + static inline ::mlir::LogicalResult verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getExpr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::accomp::AtomicWriteOpInterface; + FallbackModel() : Concept{verifyCommon, getX, getExpr} {} + + static inline ::mlir::LogicalResult verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getExpr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::LogicalResult verifyCommon(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct AtomicWriteOpInterfaceTrait; + +} // namespace detail +class AtomicWriteOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AtomicWriteOpInterfaceTrait {}; + /// Common verifier for operation that implements atomic write interface. + ::mlir::LogicalResult verifyCommon(); + /// Obtains `x` which is the address to which the value is atomically + /// written to. + ::mlir::Value getX(); + /// Obtains `expr` which corresponds to the expression whose value is + /// written to `x`. + ::mlir::Value getExpr(); +}; +namespace detail { + template + struct AtomicWriteOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Common verifier for operation that implements atomic write interface. + ::mlir::LogicalResult verifyCommon() { + mlir::Type elementType = (*static_cast(this)).getX().getType().getElementType(); + if (elementType && elementType != (*static_cast(this)).getExpr().getType()) + return (*static_cast(this)).emitError("address must dereference to value type"); + return mlir::success(); + } + }; +}// namespace detail +} // namespace accomp +} // namespace mlir +namespace mlir { +namespace accomp { +class AtomicUpdateOpInterface; +namespace detail { +struct AtomicUpdateOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::Value (*getX)(const Concept *impl, ::mlir::Operation *); + ::mlir::Operation *(*getFirstOp)(const Concept *impl, ::mlir::Operation *); + bool (*isNoOp)(const Concept *impl, ::mlir::Operation *); + ::mlir::Value (*getWriteOpVal)(const Concept *impl, ::mlir::Operation *); + ::mlir::LogicalResult (*verifyCommon)(const Concept *impl, ::mlir::Operation *); + ::mlir::LogicalResult (*verifyRegionsCommon)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::accomp::AtomicUpdateOpInterface; + Model() : Concept{getX, getFirstOp, isNoOp, getWriteOpVal, verifyCommon, verifyRegionsCommon} {} + + static inline ::mlir::Value getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Operation *getFirstOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isNoOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getWriteOpVal(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::LogicalResult verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::LogicalResult verifyRegionsCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::accomp::AtomicUpdateOpInterface; + FallbackModel() : Concept{getX, getFirstOp, isNoOp, getWriteOpVal, verifyCommon, verifyRegionsCommon} {} + + static inline ::mlir::Value getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Operation *getFirstOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline bool isNoOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Value getWriteOpVal(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::LogicalResult verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::LogicalResult verifyRegionsCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::Operation *getFirstOp(::mlir::Operation *tablegen_opaque_val) const; + bool isNoOp(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::Value getWriteOpVal(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::LogicalResult verifyCommon(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::LogicalResult verifyRegionsCommon(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct AtomicUpdateOpInterfaceTrait; + +} // namespace detail +class AtomicUpdateOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AtomicUpdateOpInterfaceTrait {}; + /// Obtains `x` which is the address to which the value is atomically + /// written to / read from. + ::mlir::Value getX(); + /// Returns the first operation in atomic update region. + ::mlir::Operation *getFirstOp(); + /// Returns true if the new value is same as old value and the operation is + /// a no-op, false otherwise. + bool isNoOp(); + /// Returns the new value if the operation is equivalent to just a write + /// operation. Otherwise, returns nullptr. + ::mlir::Value getWriteOpVal(); + /// Common verifier for operation that implements atomic update interface. + ::mlir::LogicalResult verifyCommon(); + /// Common verifier of the required region for operation that implements + /// atomic update interface. + ::mlir::LogicalResult verifyRegionsCommon(); +}; +namespace detail { + template + struct AtomicUpdateOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns the first operation in atomic update region. + ::mlir::Operation *getFirstOp() { + return &((*static_cast(this)).getRegion().front().getOperations().front()); + } + /// Returns true if the new value is same as old value and the operation is + /// a no-op, false otherwise. + bool isNoOp() { + // The atomic update is a no-op if the terminator is the first and only + // operation in its region. + mlir::Operation* terminator = + llvm::dyn_cast((*static_cast(this)).getFirstOp()); + return terminator && terminator->getOperands().front() == + (*static_cast(this)).getRegion().front().getArgument(0); + } + /// Returns the new value if the operation is equivalent to just a write + /// operation. Otherwise, returns nullptr. + ::mlir::Value getWriteOpVal() { + mlir::Operation* terminator = + llvm::dyn_cast((*static_cast(this)).getFirstOp()); + if (terminator && terminator->getOperands().front() != + (*static_cast(this)).getRegion().front().getArgument(0)) { + return terminator->getOperands().front(); + } + return nullptr; + } + /// Common verifier for operation that implements atomic update interface. + ::mlir::LogicalResult verifyCommon() { + if ((*static_cast(this)).getRegion().getNumArguments() != 1) + return (*static_cast(this)).emitError("the region must accept exactly one argument"); + + Type elementType = (*static_cast(this)).getX().getType().getElementType(); + if (elementType && elementType != (*static_cast(this)).getRegion().getArgument(0).getType()) { + return (*static_cast(this)).emitError("the type of the operand must be a pointer type whose " + "element type is the same as that of the region argument"); + } + + return mlir::success(); + } + /// Common verifier of the required region for operation that implements + /// atomic update interface. + ::mlir::LogicalResult verifyRegionsCommon() { + mlir::Operation *terminator = (*static_cast(this)).getRegion().front().getTerminator(); + + if (terminator->getOperands().size() != 1) + return (*static_cast(this)).emitError("only updated value must be returned"); + + if (terminator->getOperands().front().getType() != + (*static_cast(this)).getRegion().getArgument(0).getType()) + return (*static_cast(this)).emitError("input and yielded value must have the same type"); + + return mlir::success(); + } + }; +}// namespace detail +} // namespace accomp +} // namespace mlir +namespace mlir { +namespace accomp { +class AtomicCaptureOpInterface; +namespace detail { +struct AtomicCaptureOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::Operation *(*getFirstOp)(const Concept *impl, ::mlir::Operation *); + ::mlir::Operation *(*getSecondOp)(const Concept *impl, ::mlir::Operation *); + ::mlir::LogicalResult (*verifyRegionsCommon)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::accomp::AtomicCaptureOpInterface; + Model() : Concept{getFirstOp, getSecondOp, verifyRegionsCommon} {} + + static inline ::mlir::Operation *getFirstOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Operation *getSecondOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::LogicalResult verifyRegionsCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::accomp::AtomicCaptureOpInterface; + FallbackModel() : Concept{getFirstOp, getSecondOp, verifyRegionsCommon} {} + + static inline ::mlir::Operation *getFirstOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::Operation *getSecondOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::LogicalResult verifyRegionsCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::Operation *getFirstOp(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::Operation *getSecondOp(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::LogicalResult verifyRegionsCommon(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct AtomicCaptureOpInterfaceTrait; + +} // namespace detail +class AtomicCaptureOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::AtomicCaptureOpInterfaceTrait {}; + /// Returns the first operation in atomic capture region. + ::mlir::Operation *getFirstOp(); + /// Returns the second operation in atomic capture region. + ::mlir::Operation *getSecondOp(); + /// Common verifier of the required region for operation that implements + /// atomic capture interface. + ::mlir::LogicalResult verifyRegionsCommon(); +}; +namespace detail { + template + struct AtomicCaptureOpInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Returns the first operation in atomic capture region. + ::mlir::Operation *getFirstOp() { + return &((*static_cast(this)).getRegion().front().getOperations().front()); + } + /// Returns the second operation in atomic capture region. + ::mlir::Operation *getSecondOp() { + auto &ops = (*static_cast(this)).getRegion().front().getOperations(); + return ops.getNextNode(ops.front()); + } + /// Common verifier of the required region for operation that implements + /// atomic capture interface. + ::mlir::LogicalResult verifyRegionsCommon() { + Block::OpListType &ops = (*static_cast(this)).getRegion().front().getOperations(); + if (ops.size() != 3) + return (*static_cast(this)).emitError() + << "expected three operations in atomic.capture region (one " + "terminator, and two atomic ops)"; + auto &firstOp = ops.front(); + auto &secondOp = *ops.getNextNode(firstOp); + auto firstReadStmt = dyn_cast(firstOp); + auto firstUpdateStmt = dyn_cast(firstOp); + auto secondReadStmt = dyn_cast(secondOp); + auto secondUpdateStmt = dyn_cast(secondOp); + auto secondWriteStmt = dyn_cast(secondOp); + + if (!((firstUpdateStmt && secondReadStmt) || + (firstReadStmt && secondUpdateStmt) || + (firstReadStmt && secondWriteStmt))) + return ops.front().emitError() + << "invalid sequence of operations in the capture region"; + if (firstUpdateStmt && secondReadStmt && + firstUpdateStmt.getX() != secondReadStmt.getX()) + return firstUpdateStmt.emitError() + << "updated variable in atomic.update must be captured in " + "second operation"; + if (firstReadStmt && secondUpdateStmt && + firstReadStmt.getX() != secondUpdateStmt.getX()) + return firstReadStmt.emitError() + << "captured variable in atomic.read must be updated in second " + "operation"; + if (firstReadStmt && secondWriteStmt && + firstReadStmt.getX() != secondWriteStmt.getX()) + return firstReadStmt.emitError() + << "captured variable in atomic.read must be updated in " + "second operation"; + + return mlir::success(); + } + }; +}// namespace detail +} // namespace accomp +} // namespace mlir +namespace mlir { +namespace accomp { +template +::mlir::LogicalResult detail::AtomicReadOpInterfaceInterfaceTraits::Model::verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).verifyCommon(); +} +template +::mlir::Value detail::AtomicReadOpInterfaceInterfaceTraits::Model::getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getX(); +} +template +::mlir::Value detail::AtomicReadOpInterfaceInterfaceTraits::Model::getV(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getV(); +} +template +::mlir::LogicalResult detail::AtomicReadOpInterfaceInterfaceTraits::FallbackModel::verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->verifyCommon(tablegen_opaque_val); +} +template +::mlir::Value detail::AtomicReadOpInterfaceInterfaceTraits::FallbackModel::getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getX(tablegen_opaque_val); +} +template +::mlir::Value detail::AtomicReadOpInterfaceInterfaceTraits::FallbackModel::getV(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getV(tablegen_opaque_val); +} +template +::mlir::LogicalResult detail::AtomicReadOpInterfaceInterfaceTraits::ExternalModel::verifyCommon(::mlir::Operation *tablegen_opaque_val) const { +if ((llvm::cast(tablegen_opaque_val)).getX() == (llvm::cast(tablegen_opaque_val)).getV()) { + return (llvm::cast(tablegen_opaque_val)).emitError( + "read and write must not be to the same location for atomic reads"); + } + return mlir::success(); +} +} // namespace accomp +} // namespace mlir +namespace mlir { +namespace accomp { +template +::mlir::LogicalResult detail::AtomicWriteOpInterfaceInterfaceTraits::Model::verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).verifyCommon(); +} +template +::mlir::Value detail::AtomicWriteOpInterfaceInterfaceTraits::Model::getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getX(); +} +template +::mlir::Value detail::AtomicWriteOpInterfaceInterfaceTraits::Model::getExpr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getExpr(); +} +template +::mlir::LogicalResult detail::AtomicWriteOpInterfaceInterfaceTraits::FallbackModel::verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->verifyCommon(tablegen_opaque_val); +} +template +::mlir::Value detail::AtomicWriteOpInterfaceInterfaceTraits::FallbackModel::getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getX(tablegen_opaque_val); +} +template +::mlir::Value detail::AtomicWriteOpInterfaceInterfaceTraits::FallbackModel::getExpr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getExpr(tablegen_opaque_val); +} +template +::mlir::LogicalResult detail::AtomicWriteOpInterfaceInterfaceTraits::ExternalModel::verifyCommon(::mlir::Operation *tablegen_opaque_val) const { +mlir::Type elementType = (llvm::cast(tablegen_opaque_val)).getX().getType().getElementType(); + if (elementType && elementType != (llvm::cast(tablegen_opaque_val)).getExpr().getType()) + return (llvm::cast(tablegen_opaque_val)).emitError("address must dereference to value type"); + return mlir::success(); +} +} // namespace accomp +} // namespace mlir +namespace mlir { +namespace accomp { +template +::mlir::Value detail::AtomicUpdateOpInterfaceInterfaceTraits::Model::getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getX(); +} +template +::mlir::Operation *detail::AtomicUpdateOpInterfaceInterfaceTraits::Model::getFirstOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getFirstOp(); +} +template +bool detail::AtomicUpdateOpInterfaceInterfaceTraits::Model::isNoOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).isNoOp(); +} +template +::mlir::Value detail::AtomicUpdateOpInterfaceInterfaceTraits::Model::getWriteOpVal(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getWriteOpVal(); +} +template +::mlir::LogicalResult detail::AtomicUpdateOpInterfaceInterfaceTraits::Model::verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).verifyCommon(); +} +template +::mlir::LogicalResult detail::AtomicUpdateOpInterfaceInterfaceTraits::Model::verifyRegionsCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).verifyRegionsCommon(); +} +template +::mlir::Value detail::AtomicUpdateOpInterfaceInterfaceTraits::FallbackModel::getX(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getX(tablegen_opaque_val); +} +template +::mlir::Operation *detail::AtomicUpdateOpInterfaceInterfaceTraits::FallbackModel::getFirstOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getFirstOp(tablegen_opaque_val); +} +template +bool detail::AtomicUpdateOpInterfaceInterfaceTraits::FallbackModel::isNoOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->isNoOp(tablegen_opaque_val); +} +template +::mlir::Value detail::AtomicUpdateOpInterfaceInterfaceTraits::FallbackModel::getWriteOpVal(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getWriteOpVal(tablegen_opaque_val); +} +template +::mlir::LogicalResult detail::AtomicUpdateOpInterfaceInterfaceTraits::FallbackModel::verifyCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->verifyCommon(tablegen_opaque_val); +} +template +::mlir::LogicalResult detail::AtomicUpdateOpInterfaceInterfaceTraits::FallbackModel::verifyRegionsCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->verifyRegionsCommon(tablegen_opaque_val); +} +template +::mlir::Operation *detail::AtomicUpdateOpInterfaceInterfaceTraits::ExternalModel::getFirstOp(::mlir::Operation *tablegen_opaque_val) const { +return &((llvm::cast(tablegen_opaque_val)).getRegion().front().getOperations().front()); +} +template +bool detail::AtomicUpdateOpInterfaceInterfaceTraits::ExternalModel::isNoOp(::mlir::Operation *tablegen_opaque_val) const { +// The atomic update is a no-op if the terminator is the first and only + // operation in its region. + mlir::Operation* terminator = + llvm::dyn_cast((llvm::cast(tablegen_opaque_val)).getFirstOp()); + return terminator && terminator->getOperands().front() == + (llvm::cast(tablegen_opaque_val)).getRegion().front().getArgument(0); +} +template +::mlir::Value detail::AtomicUpdateOpInterfaceInterfaceTraits::ExternalModel::getWriteOpVal(::mlir::Operation *tablegen_opaque_val) const { +mlir::Operation* terminator = + llvm::dyn_cast((llvm::cast(tablegen_opaque_val)).getFirstOp()); + if (terminator && terminator->getOperands().front() != + (llvm::cast(tablegen_opaque_val)).getRegion().front().getArgument(0)) { + return terminator->getOperands().front(); + } + return nullptr; +} +template +::mlir::LogicalResult detail::AtomicUpdateOpInterfaceInterfaceTraits::ExternalModel::verifyCommon(::mlir::Operation *tablegen_opaque_val) const { +if ((llvm::cast(tablegen_opaque_val)).getRegion().getNumArguments() != 1) + return (llvm::cast(tablegen_opaque_val)).emitError("the region must accept exactly one argument"); + + Type elementType = (llvm::cast(tablegen_opaque_val)).getX().getType().getElementType(); + if (elementType && elementType != (llvm::cast(tablegen_opaque_val)).getRegion().getArgument(0).getType()) { + return (llvm::cast(tablegen_opaque_val)).emitError("the type of the operand must be a pointer type whose " + "element type is the same as that of the region argument"); + } + + return mlir::success(); +} +template +::mlir::LogicalResult detail::AtomicUpdateOpInterfaceInterfaceTraits::ExternalModel::verifyRegionsCommon(::mlir::Operation *tablegen_opaque_val) const { +mlir::Operation *terminator = (llvm::cast(tablegen_opaque_val)).getRegion().front().getTerminator(); + + if (terminator->getOperands().size() != 1) + return (llvm::cast(tablegen_opaque_val)).emitError("only updated value must be returned"); + + if (terminator->getOperands().front().getType() != + (llvm::cast(tablegen_opaque_val)).getRegion().getArgument(0).getType()) + return (llvm::cast(tablegen_opaque_val)).emitError("input and yielded value must have the same type"); + + return mlir::success(); +} +} // namespace accomp +} // namespace mlir +namespace mlir { +namespace accomp { +template +::mlir::Operation *detail::AtomicCaptureOpInterfaceInterfaceTraits::Model::getFirstOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getFirstOp(); +} +template +::mlir::Operation *detail::AtomicCaptureOpInterfaceInterfaceTraits::Model::getSecondOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getSecondOp(); +} +template +::mlir::LogicalResult detail::AtomicCaptureOpInterfaceInterfaceTraits::Model::verifyRegionsCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).verifyRegionsCommon(); +} +template +::mlir::Operation *detail::AtomicCaptureOpInterfaceInterfaceTraits::FallbackModel::getFirstOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getFirstOp(tablegen_opaque_val); +} +template +::mlir::Operation *detail::AtomicCaptureOpInterfaceInterfaceTraits::FallbackModel::getSecondOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getSecondOp(tablegen_opaque_val); +} +template +::mlir::LogicalResult detail::AtomicCaptureOpInterfaceInterfaceTraits::FallbackModel::verifyRegionsCommon(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->verifyRegionsCommon(tablegen_opaque_val); +} +template +::mlir::Operation *detail::AtomicCaptureOpInterfaceInterfaceTraits::ExternalModel::getFirstOp(::mlir::Operation *tablegen_opaque_val) const { +return &((llvm::cast(tablegen_opaque_val)).getRegion().front().getOperations().front()); +} +template +::mlir::Operation *detail::AtomicCaptureOpInterfaceInterfaceTraits::ExternalModel::getSecondOp(::mlir::Operation *tablegen_opaque_val) const { +auto &ops = (llvm::cast(tablegen_opaque_val)).getRegion().front().getOperations(); + return ops.getNextNode(ops.front()); +} +template +::mlir::LogicalResult detail::AtomicCaptureOpInterfaceInterfaceTraits::ExternalModel::verifyRegionsCommon(::mlir::Operation *tablegen_opaque_val) const { +Block::OpListType &ops = (llvm::cast(tablegen_opaque_val)).getRegion().front().getOperations(); + if (ops.size() != 3) + return (llvm::cast(tablegen_opaque_val)).emitError() + << "expected three operations in atomic.capture region (one " + "terminator, and two atomic ops)"; + auto &firstOp = ops.front(); + auto &secondOp = *ops.getNextNode(firstOp); + auto firstReadStmt = dyn_cast(firstOp); + auto firstUpdateStmt = dyn_cast(firstOp); + auto secondReadStmt = dyn_cast(secondOp); + auto secondUpdateStmt = dyn_cast(secondOp); + auto secondWriteStmt = dyn_cast(secondOp); + + if (!((firstUpdateStmt && secondReadStmt) || + (firstReadStmt && secondUpdateStmt) || + (firstReadStmt && secondWriteStmt))) + return ops.front().emitError() + << "invalid sequence of operations in the capture region"; + if (firstUpdateStmt && secondReadStmt && + firstUpdateStmt.getX() != secondReadStmt.getX()) + return firstUpdateStmt.emitError() + << "updated variable in atomic.update must be captured in " + "second operation"; + if (firstReadStmt && secondUpdateStmt && + firstReadStmt.getX() != secondUpdateStmt.getX()) + return firstReadStmt.emitError() + << "captured variable in atomic.read must be updated in second " + "operation"; + if (firstReadStmt && secondWriteStmt && + firstReadStmt.getX() != secondWriteStmt.getX()) + return firstReadStmt.emitError() + << "captured variable in atomic.read must be updated in " + "second operation"; + + return mlir::success(); +} +} // namespace accomp +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.h new file mode 100644 index 0000000000000000000000000000000000000000..23509c5b6070160e8cf84d12e7fe00d1aaa7c439 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.h @@ -0,0 +1,40 @@ +//===- OpenMPDialect.h - MLIR Dialect for OpenMP ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares the OpenMP dialect in MLIR. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_OPENMP_OPENMPDIALECT_H_ +#define MLIR_DIALECT_OPENMP_OPENMPDIALECT_H_ + +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#define GET_TYPEDEF_CLASSES +#include "mlir/Dialect/OpenMP/OpenMPOpsTypes.h.inc" + +#include "mlir/Dialect/OpenMP/OpenMPOpsDialect.h.inc" +#include "mlir/Dialect/OpenMP/OpenMPOpsEnums.h.inc" +#include "mlir/Dialect/OpenMP/OpenMPTypeInterfaces.h.inc" + +#define GET_ATTRDEF_CLASSES +#include "mlir/Dialect/OpenMP/OpenMPOpsAttributes.h.inc" + +#include "mlir/Dialect/OpenMP/OpenMPInterfaces.h" + +#define GET_OP_CLASSES +#include "mlir/Dialect/OpenMP/OpenMPOps.h.inc" + +#endif // MLIR_DIALECT_OPENMP_OPENMPDIALECT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPInterfaces.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPInterfaces.h new file mode 100644 index 0000000000000000000000000000000000000000..d78c541252a98d43624474791dbaa4b77c3939b9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPInterfaces.h @@ -0,0 +1,46 @@ +//===- OpenMPInterfaces.h - MLIR Interfaces for OpenMP ----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares OpenMP Interface implementations for the OpenMP dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_OPENMP_OPENMPINTERFACES_H_ +#define MLIR_DIALECT_OPENMP_OPENMPINTERFACES_H_ + +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#include "mlir/Dialect/OpenMP/OpenMPOpsInterfaces.h.inc" + +namespace mlir::omp { +// You can override defaults here or implement more complex implementations of +// functions. Or define a completely seperate external model implementation, +// to override the existing implementation. +struct OffloadModuleDefaultModel + : public OffloadModuleInterface::ExternalModel {}; + +template +struct DeclareTargetDefaultModel + : public DeclareTargetInterface::ExternalModel, + T> {}; + +template +struct EarlyOutliningDefaultModel + : public EarlyOutliningInterface::ExternalModel< + EarlyOutliningDefaultModel, T> {}; + +} // namespace mlir::omp + +#endif // MLIR_DIALECT_OPENMP_OPENMPINTERFACES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..cc3412d85333aa9560078aae00036bfe6ac3172c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.cpp.inc @@ -0,0 +1,18866 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenMPOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::omp::AtomicCaptureOp, +::mlir::omp::AtomicReadOp, +::mlir::omp::AtomicUpdateOp, +::mlir::omp::AtomicWriteOp, +::mlir::omp::BarrierOp, +::mlir::omp::CancelOp, +::mlir::omp::CancellationPointOp, +::mlir::omp::CriticalDeclareOp, +::mlir::omp::CriticalOp, +::mlir::omp::DataBoundsOp, +::mlir::omp::FlushOp, +::mlir::omp::MapInfoOp, +::mlir::omp::MasterOp, +::mlir::omp::OrderedOp, +::mlir::omp::OrderedRegionOp, +::mlir::omp::ParallelOp, +::mlir::omp::ReductionDeclareOp, +::mlir::omp::ReductionOp, +::mlir::omp::SectionOp, +::mlir::omp::SectionsOp, +::mlir::omp::SimdLoopOp, +::mlir::omp::SingleOp, +::mlir::omp::TargetOp, +::mlir::omp::DataOp, +::mlir::omp::EnterDataOp, +::mlir::omp::ExitDataOp, +::mlir::omp::TaskGroupOp, +::mlir::omp::TaskLoopOp, +::mlir::omp::TaskOp, +::mlir::omp::TaskwaitOp, +::mlir::omp::TaskyieldOp, +::mlir::omp::TeamsOp, +::mlir::omp::TerminatorOp, +::mlir::omp::ThreadprivateOp, +::mlir::omp::WsLoopOp, +::mlir::omp::YieldOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace omp { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenMPOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::omp::PointerLikeType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be OpenMP-compatible variable type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenMPOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((true))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be any type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenMPOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(1)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 1-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenMPOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::IntegerType>(type))) || ((::llvm::isa<::mlir::IndexType>(type))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer or index, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenMPOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::omp::DataBoundsType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be Type for representing omp data clause bounds information, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenMPOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::IntegerType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_OpenMPOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((type.isSignlessInteger(32)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be 32-bit signless integer, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::omp::ClauseMemoryOrderKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: MemoryOrderKind Clause"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any type attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::omp::ClauseCancellationConstructTypeAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: CancellationConstructType Clause"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: flat symbol reference attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: bool attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isUnsignedInteger(64))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit unsigned integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps8( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::omp::VariableCaptureKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: variable capture kind"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps8( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps8(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps9( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::omp::ClauseDependAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: depend clause"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps9( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps9(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps10( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() >= 0)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps10( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps10(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps11( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps11( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps11(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps12( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: symbol ref array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps12( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps12(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps13( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::omp::ClauseProcBindKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: ProcBindKind Clause"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps13( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps13(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps14( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit integer array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps14( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps14(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps15( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::omp::ClauseOrderKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: OrderKind Clause"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps15( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps15(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps16( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isStrictlyPositive())))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps16( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps16(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps17( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::omp::ClauseTaskDependAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: clause_task_depend array attr"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps17( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps17(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps18( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::omp::ClauseScheduleKindAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: ScheduleKind Clause"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps18( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps18(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps19( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::omp::ScheduleModifierAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: OpenMP Schedule Modifier"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_OpenMPOps19( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_OpenMPOps19(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_OpenMPOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItems(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with 1 blocks"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_OpenMPOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::AtomicCaptureOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicCaptureOpGenericAdaptorBase::AtomicCaptureOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.atomic.capture", odsAttrs.getContext()); +} + +AtomicCaptureOpGenericAdaptorBase::AtomicCaptureOpGenericAdaptorBase(AtomicCaptureOp op) : AtomicCaptureOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicCaptureOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicCaptureOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr AtomicCaptureOpGenericAdaptorBase::getHintValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); + if (!attr) + attr = ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(64), 0); + return attr; +} + +uint64_t AtomicCaptureOpGenericAdaptorBase::getHintVal() { + auto attr = getHintValAttr(); + if (!attr) + return ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(64), 0).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::omp::ClauseMemoryOrderKindAttr AtomicCaptureOpGenericAdaptorBase::getMemoryOrderValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(getProperties().memory_order_val); + return attr; +} + +::std::optional<::mlir::omp::ClauseMemoryOrderKind> AtomicCaptureOpGenericAdaptorBase::getMemoryOrderVal() { + auto attr = getMemoryOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseMemoryOrderKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &AtomicCaptureOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange AtomicCaptureOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AtomicCaptureOpAdaptor::AtomicCaptureOpAdaptor(AtomicCaptureOp op) : AtomicCaptureOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicCaptureOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_memory_order_val = getProperties().memory_order_val; (void)tblgen_memory_order_val; + + if (tblgen_hint_val && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_hint_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_hint_val).getType().isSignlessInteger(64))))) + return emitError(loc, "'omp.atomic.capture' op ""attribute 'hint_val' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_memory_order_val && !((::llvm::isa<::mlir::omp::ClauseMemoryOrderKindAttr>(tblgen_memory_order_val)))) + return emitError(loc, "'omp.atomic.capture' op ""attribute 'memory_order_val' failed to satisfy constraint: MemoryOrderKind Clause"); + return ::mlir::success(); +} + +std::pair AtomicCaptureOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicCaptureOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair AtomicCaptureOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicCaptureOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &AtomicCaptureOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult AtomicCaptureOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.hint_val; + auto attr = dict.get("hint_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for hint_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hint_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.memory_order_val; + auto attr = dict.get("memory_order_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for memory_order_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `memory_order_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AtomicCaptureOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.hint_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hint_val", + propStorage)); + } + + { + const auto &propStorage = prop.memory_order_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("memory_order_val", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AtomicCaptureOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.hint_val.getAsOpaquePointer()), + llvm::hash_value(prop.memory_order_val.getAsOpaquePointer())); +} + +std::optional AtomicCaptureOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "hint_val") + return prop.hint_val; + + if (name == "memory_order_val") + return prop.memory_order_val; + return std::nullopt; +} + +void AtomicCaptureOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "hint_val") { + prop.hint_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "memory_order_val") { + prop.memory_order_val = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AtomicCaptureOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.hint_val) attrs.append("hint_val", prop.hint_val); + + if (prop.memory_order_val) attrs.append("memory_order_val", prop.memory_order_val); +} + +::mlir::LogicalResult AtomicCaptureOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getHintValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(attr, "hint_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMemoryOrderValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps1(attr, "memory_order_val", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicCaptureOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.hint_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.memory_order_val))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicCaptureOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.hint_val); + + writer.writeOptionalAttribute(prop.memory_order_val); +} + +::mlir::IntegerAttr AtomicCaptureOp::getHintValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); +} + +uint64_t AtomicCaptureOp::getHintVal() { + auto attr = getHintValAttr(); + if (!attr) + return ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), 0).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::omp::ClauseMemoryOrderKindAttr AtomicCaptureOp::getMemoryOrderValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(getProperties().memory_order_val); +} + +::std::optional<::mlir::omp::ClauseMemoryOrderKind> AtomicCaptureOp::getMemoryOrderVal() { + auto attr = getMemoryOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseMemoryOrderKind>(attr.getValue()) : (::std::nullopt); +} + +void AtomicCaptureOp::setHintValAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getHintValAttrName(), attr); +} + +void AtomicCaptureOp::setHintVal(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getHintValAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getHintValAttrName()); +} + +void AtomicCaptureOp::setMemoryOrderValAttr(::mlir::omp::ClauseMemoryOrderKindAttr attr) { + (*this)->setAttr(getMemoryOrderValAttrName(), attr); +} + +void AtomicCaptureOp::setMemoryOrderVal(::std::optional<::mlir::omp::ClauseMemoryOrderKind> attrValue) { + if (attrValue) + return (*this)->setAttr(getMemoryOrderValAttrName(), ::mlir::omp::ClauseMemoryOrderKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getMemoryOrderValAttrName()); +} + +::mlir::Attribute AtomicCaptureOp::removeHintValAttr() { + auto &attr = getProperties().hint_val; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicCaptureOp::removeMemoryOrderValAttr() { + auto &attr = getProperties().memory_order_val; + attr = {}; + return attr; +} + +void AtomicCaptureOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + (void)odsState.addRegion(); +} + +void AtomicCaptureOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicCaptureOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + (void)odsState.addRegion(); +} + +void AtomicCaptureOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicCaptureOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AtomicCaptureOp::verifyInvariantsImpl() { + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_memory_order_val = getProperties().memory_order_val; (void)tblgen_memory_order_val; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(*this, tblgen_hint_val, "hint_val"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps1(*this, tblgen_memory_order_val, "memory_order_val"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicCaptureOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AtomicCaptureOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::omp::ClauseMemoryOrderKindAttr memory_order_valAttr; + ::mlir::IntegerAttr hint_valAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool memory_orderClause = false; + bool hintClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("memory_order"))) { + + if (memory_orderClause) { + return parser.emitError(parser.getNameLoc()) + << "`memory_order` clause can appear at most once in the expansion of the " + "oilist directive"; + } + memory_orderClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseClauseAttr(parser, memory_order_valAttr); + if (odsResult) return ::mlir::failure(); + if (memory_order_valAttr) + result.getOrAddProperties().memory_order_val = memory_order_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("hint"))) { + + if (hintClause) { + return parser.emitError(parser.getNameLoc()) + << "`hint` clause can appear at most once in the expansion of the " + "oilist directive"; + } + hintClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseSynchronizationHint(parser, hint_valAttr); + if (odsResult) return ::mlir::failure(); + if (hint_valAttr) + result.getOrAddProperties().hint_val = hint_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + + ensureTerminator(*regionRegion, parser.getBuilder(), result.location); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + return ::mlir::success(); +} + +void AtomicCaptureOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getMemoryOrderValAttr()) { + _odsPrinter << ' ' << "memory_order"; + _odsPrinter << "("; + printClauseAttr(_odsPrinter, *this, getMemoryOrderValAttr()); + _odsPrinter << ")"; + } + if (false || getHintValAttr()) { + _odsPrinter << ' ' << "hint"; + _odsPrinter << "("; + printSynchronizationHint(_odsPrinter, *this, getHintValAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + + { + bool printTerminator = true; + if (auto *term = getRegion().empty() ? nullptr : getRegion().begin()->getTerminator()) { + printTerminator = !term->getAttrDictionary().empty() || + term->getNumOperands() != 0 || + term->getNumResults() != 0; + } + _odsPrinter.printRegion(getRegion(), /*printEntryBlockArgs=*/true, + /*printBlockTerminators=*/printTerminator); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("memory_order_val"); + elidedAttrs.push_back("hint_val"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHintValAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), 0))) + elidedAttrs.push_back("hint_val"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::AtomicCaptureOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::AtomicReadOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicReadOpGenericAdaptorBase::AtomicReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.atomic.read", odsAttrs.getContext()); +} + +AtomicReadOpGenericAdaptorBase::AtomicReadOpGenericAdaptorBase(AtomicReadOp op) : AtomicReadOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicReadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicReadOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypeAttr AtomicReadOpGenericAdaptorBase::getElementTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().element_type); + return attr; +} + +::mlir::Type AtomicReadOpGenericAdaptorBase::getElementType() { + auto attr = getElementTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::IntegerAttr AtomicReadOpGenericAdaptorBase::getHintValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); + if (!attr) + attr = ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(64), 0); + return attr; +} + +uint64_t AtomicReadOpGenericAdaptorBase::getHintVal() { + auto attr = getHintValAttr(); + if (!attr) + return ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(64), 0).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::omp::ClauseMemoryOrderKindAttr AtomicReadOpGenericAdaptorBase::getMemoryOrderValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(getProperties().memory_order_val); + return attr; +} + +::std::optional<::mlir::omp::ClauseMemoryOrderKind> AtomicReadOpGenericAdaptorBase::getMemoryOrderVal() { + auto attr = getMemoryOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseMemoryOrderKind>(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +AtomicReadOpAdaptor::AtomicReadOpAdaptor(AtomicReadOp op) : AtomicReadOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicReadOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_element_type = getProperties().element_type; (void)tblgen_element_type; + if (!tblgen_element_type) return emitError(loc, "'omp.atomic.read' op ""requires attribute 'element_type'"); + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_memory_order_val = getProperties().memory_order_val; (void)tblgen_memory_order_val; + + if (tblgen_element_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_element_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_element_type).getValue()))) && ((true)))) + return emitError(loc, "'omp.atomic.read' op ""attribute 'element_type' failed to satisfy constraint: any type attribute"); + + if (tblgen_hint_val && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_hint_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_hint_val).getType().isSignlessInteger(64))))) + return emitError(loc, "'omp.atomic.read' op ""attribute 'hint_val' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_memory_order_val && !((::llvm::isa<::mlir::omp::ClauseMemoryOrderKindAttr>(tblgen_memory_order_val)))) + return emitError(loc, "'omp.atomic.read' op ""attribute 'memory_order_val' failed to satisfy constraint: MemoryOrderKind Clause"); + return ::mlir::success(); +} + +std::pair AtomicReadOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicReadOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> AtomicReadOp::getX() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> AtomicReadOp::getV() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AtomicReadOp::getXMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AtomicReadOp::getVMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtomicReadOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicReadOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AtomicReadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.element_type; + auto attr = dict.get("element_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for element_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `element_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.hint_val; + auto attr = dict.get("hint_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for hint_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hint_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.memory_order_val; + auto attr = dict.get("memory_order_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for memory_order_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `memory_order_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AtomicReadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.element_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("element_type", + propStorage)); + } + + { + const auto &propStorage = prop.hint_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hint_val", + propStorage)); + } + + { + const auto &propStorage = prop.memory_order_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("memory_order_val", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AtomicReadOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.element_type.getAsOpaquePointer()), + llvm::hash_value(prop.hint_val.getAsOpaquePointer()), + llvm::hash_value(prop.memory_order_val.getAsOpaquePointer())); +} + +std::optional AtomicReadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "element_type") + return prop.element_type; + + if (name == "hint_val") + return prop.hint_val; + + if (name == "memory_order_val") + return prop.memory_order_val; + return std::nullopt; +} + +void AtomicReadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "element_type") { + prop.element_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "hint_val") { + prop.hint_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "memory_order_val") { + prop.memory_order_val = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AtomicReadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.element_type) attrs.append("element_type", prop.element_type); + + if (prop.hint_val) attrs.append("hint_val", prop.hint_val); + + if (prop.memory_order_val) attrs.append("memory_order_val", prop.memory_order_val); +} + +::mlir::LogicalResult AtomicReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getElementTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps2(attr, "element_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getHintValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(attr, "hint_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMemoryOrderValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps1(attr, "memory_order_val", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicReadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.element_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.hint_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.memory_order_val))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicReadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.element_type); + + writer.writeOptionalAttribute(prop.hint_val); + + writer.writeOptionalAttribute(prop.memory_order_val); +} + +::mlir::TypeAttr AtomicReadOp::getElementTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().element_type); +} + +::mlir::Type AtomicReadOp::getElementType() { + auto attr = getElementTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::IntegerAttr AtomicReadOp::getHintValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); +} + +uint64_t AtomicReadOp::getHintVal() { + auto attr = getHintValAttr(); + if (!attr) + return ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), 0).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::omp::ClauseMemoryOrderKindAttr AtomicReadOp::getMemoryOrderValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(getProperties().memory_order_val); +} + +::std::optional<::mlir::omp::ClauseMemoryOrderKind> AtomicReadOp::getMemoryOrderVal() { + auto attr = getMemoryOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseMemoryOrderKind>(attr.getValue()) : (::std::nullopt); +} + +void AtomicReadOp::setElementTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getElementTypeAttrName(), attr); +} + +void AtomicReadOp::setElementType(::mlir::Type attrValue) { + (*this)->setAttr(getElementTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void AtomicReadOp::setHintValAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getHintValAttrName(), attr); +} + +void AtomicReadOp::setHintVal(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getHintValAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getHintValAttrName()); +} + +void AtomicReadOp::setMemoryOrderValAttr(::mlir::omp::ClauseMemoryOrderKindAttr attr) { + (*this)->setAttr(getMemoryOrderValAttrName(), attr); +} + +void AtomicReadOp::setMemoryOrderVal(::std::optional<::mlir::omp::ClauseMemoryOrderKind> attrValue) { + if (attrValue) + return (*this)->setAttr(getMemoryOrderValAttrName(), ::mlir::omp::ClauseMemoryOrderKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getMemoryOrderValAttrName()); +} + +::mlir::Attribute AtomicReadOp::removeHintValAttr() { + auto &attr = getProperties().hint_val; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicReadOp::removeMemoryOrderValAttr() { + auto &attr = getProperties().memory_order_val; + attr = {}; + return attr; +} + +void AtomicReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.addOperands(v); + odsState.getOrAddProperties().element_type = element_type; + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } +} + +void AtomicReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.addOperands(v); + odsState.getOrAddProperties().element_type = element_type; + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.addOperands(v); + odsState.getOrAddProperties().element_type = ::mlir::TypeAttr::get(element_type); + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } +} + +void AtomicReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.addOperands(v); + odsState.getOrAddProperties().element_type = ::mlir::TypeAttr::get(element_type); + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicReadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AtomicReadOp::verifyInvariantsImpl() { + auto tblgen_element_type = getProperties().element_type; (void)tblgen_element_type; + if (!tblgen_element_type) return emitOpError("requires attribute 'element_type'"); + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_memory_order_val = getProperties().memory_order_val; (void)tblgen_memory_order_val; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps2(*this, tblgen_element_type, "element_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(*this, tblgen_hint_val, "hint_val"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps1(*this, tblgen_memory_order_val, "memory_order_val"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {x, v} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicReadOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AtomicReadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand vRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> vOperands(vRawOperands); ::llvm::SMLoc vOperandsLoc; + (void)vOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand xRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(xRawOperands); ::llvm::SMLoc xOperandsLoc; + (void)xOperandsLoc; + ::mlir::omp::ClauseMemoryOrderKindAttr memory_order_valAttr; + ::mlir::IntegerAttr hint_valAttr; + ::mlir::Type xRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> xTypes(xRawTypes); + ::mlir::TypeAttr element_typeAttr; + + vOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(vRawOperands[0])) + return ::mlir::failure(); + if (parser.parseEqual()) + return ::mlir::failure(); + + xOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(xRawOperands[0])) + return ::mlir::failure(); + bool memory_orderClause = false; + bool hintClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("memory_order"))) { + + if (memory_orderClause) { + return parser.emitError(parser.getNameLoc()) + << "`memory_order` clause can appear at most once in the expansion of the " + "oilist directive"; + } + memory_orderClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseClauseAttr(parser, memory_order_valAttr); + if (odsResult) return ::mlir::failure(); + if (memory_order_valAttr) + result.getOrAddProperties().memory_order_val = memory_order_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("hint"))) { + + if (hintClause) { + return parser.emitError(parser.getNameLoc()) + << "`hint` clause can appear at most once in the expansion of the " + "oilist directive"; + } + hintClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseSynchronizationHint(parser, hint_valAttr); + if (odsResult) return ::mlir::failure(); + if (hint_valAttr) + result.getOrAddProperties().hint_val = hint_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::omp::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + xRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(element_typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (element_typeAttr) result.getOrAddProperties().element_type = element_typeAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(vOperands, xTypes[0], vOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicReadOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getV(); + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getX(); + _odsPrinter << ' ' << " "; + if (false || getMemoryOrderValAttr()) { + _odsPrinter << ' ' << "memory_order"; + _odsPrinter << "("; + printClauseAttr(_odsPrinter, *this, getMemoryOrderValAttr()); + _odsPrinter << ")"; + } + if (false || getHintValAttr()) { + _odsPrinter << ' ' << "hint"; + _odsPrinter << "("; + printSynchronizationHint(_odsPrinter, *this, getHintValAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getX().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::omp::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getElementTypeAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("memory_order_val"); + elidedAttrs.push_back("hint_val"); + elidedAttrs.push_back("element_type"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHintValAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), 0))) + elidedAttrs.push_back("hint_val"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::AtomicReadOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::AtomicUpdateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicUpdateOpGenericAdaptorBase::AtomicUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.atomic.update", odsAttrs.getContext()); +} + +AtomicUpdateOpGenericAdaptorBase::AtomicUpdateOpGenericAdaptorBase(AtomicUpdateOp op) : AtomicUpdateOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicUpdateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicUpdateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr AtomicUpdateOpGenericAdaptorBase::getHintValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); + if (!attr) + attr = ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(64), 0); + return attr; +} + +uint64_t AtomicUpdateOpGenericAdaptorBase::getHintVal() { + auto attr = getHintValAttr(); + if (!attr) + return ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(64), 0).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::omp::ClauseMemoryOrderKindAttr AtomicUpdateOpGenericAdaptorBase::getMemoryOrderValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(getProperties().memory_order_val); + return attr; +} + +::std::optional<::mlir::omp::ClauseMemoryOrderKind> AtomicUpdateOpGenericAdaptorBase::getMemoryOrderVal() { + auto attr = getMemoryOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseMemoryOrderKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &AtomicUpdateOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange AtomicUpdateOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +AtomicUpdateOpAdaptor::AtomicUpdateOpAdaptor(AtomicUpdateOp op) : AtomicUpdateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicUpdateOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_memory_order_val = getProperties().memory_order_val; (void)tblgen_memory_order_val; + + if (tblgen_hint_val && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_hint_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_hint_val).getType().isSignlessInteger(64))))) + return emitError(loc, "'omp.atomic.update' op ""attribute 'hint_val' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_memory_order_val && !((::llvm::isa<::mlir::omp::ClauseMemoryOrderKindAttr>(tblgen_memory_order_val)))) + return emitError(loc, "'omp.atomic.update' op ""attribute 'memory_order_val' failed to satisfy constraint: MemoryOrderKind Clause"); + return ::mlir::success(); +} + +std::pair AtomicUpdateOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicUpdateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> AtomicUpdateOp::getX() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &AtomicUpdateOp::getXMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtomicUpdateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicUpdateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &AtomicUpdateOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult AtomicUpdateOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.hint_val; + auto attr = dict.get("hint_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for hint_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hint_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.memory_order_val; + auto attr = dict.get("memory_order_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for memory_order_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `memory_order_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AtomicUpdateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.hint_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hint_val", + propStorage)); + } + + { + const auto &propStorage = prop.memory_order_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("memory_order_val", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AtomicUpdateOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.hint_val.getAsOpaquePointer()), + llvm::hash_value(prop.memory_order_val.getAsOpaquePointer())); +} + +std::optional AtomicUpdateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "hint_val") + return prop.hint_val; + + if (name == "memory_order_val") + return prop.memory_order_val; + return std::nullopt; +} + +void AtomicUpdateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "hint_val") { + prop.hint_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "memory_order_val") { + prop.memory_order_val = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AtomicUpdateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.hint_val) attrs.append("hint_val", prop.hint_val); + + if (prop.memory_order_val) attrs.append("memory_order_val", prop.memory_order_val); +} + +::mlir::LogicalResult AtomicUpdateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getHintValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(attr, "hint_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMemoryOrderValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps1(attr, "memory_order_val", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicUpdateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.hint_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.memory_order_val))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicUpdateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.hint_val); + + writer.writeOptionalAttribute(prop.memory_order_val); +} + +::mlir::IntegerAttr AtomicUpdateOp::getHintValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); +} + +uint64_t AtomicUpdateOp::getHintVal() { + auto attr = getHintValAttr(); + if (!attr) + return ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), 0).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::omp::ClauseMemoryOrderKindAttr AtomicUpdateOp::getMemoryOrderValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(getProperties().memory_order_val); +} + +::std::optional<::mlir::omp::ClauseMemoryOrderKind> AtomicUpdateOp::getMemoryOrderVal() { + auto attr = getMemoryOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseMemoryOrderKind>(attr.getValue()) : (::std::nullopt); +} + +void AtomicUpdateOp::setHintValAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getHintValAttrName(), attr); +} + +void AtomicUpdateOp::setHintVal(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getHintValAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getHintValAttrName()); +} + +void AtomicUpdateOp::setMemoryOrderValAttr(::mlir::omp::ClauseMemoryOrderKindAttr attr) { + (*this)->setAttr(getMemoryOrderValAttrName(), attr); +} + +void AtomicUpdateOp::setMemoryOrderVal(::std::optional<::mlir::omp::ClauseMemoryOrderKind> attrValue) { + if (attrValue) + return (*this)->setAttr(getMemoryOrderValAttrName(), ::mlir::omp::ClauseMemoryOrderKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getMemoryOrderValAttrName()); +} + +::mlir::Attribute AtomicUpdateOp::removeHintValAttr() { + auto &attr = getProperties().hint_val; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicUpdateOp::removeMemoryOrderValAttr() { + auto &attr = getProperties().memory_order_val; + attr = {}; + return attr; +} + +void AtomicUpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + (void)odsState.addRegion(); +} + +void AtomicUpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicUpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + (void)odsState.addRegion(); +} + +void AtomicUpdateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicUpdateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AtomicUpdateOp::verifyInvariantsImpl() { + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_memory_order_val = getProperties().memory_order_val; (void)tblgen_memory_order_val; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(*this, tblgen_hint_val, "hint_val"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps1(*this, tblgen_memory_order_val, "memory_order_val"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicUpdateOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +void AtomicUpdateOp::getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context) { + results.add(canonicalize); +} + +::mlir::ParseResult AtomicUpdateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::omp::ClauseMemoryOrderKindAttr memory_order_valAttr; + ::mlir::IntegerAttr hint_valAttr; + ::mlir::OpAsmParser::UnresolvedOperand xRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(xRawOperands); ::llvm::SMLoc xOperandsLoc; + (void)xOperandsLoc; + ::mlir::Type xRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> xTypes(xRawTypes); + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool memory_orderClause = false; + bool hintClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("memory_order"))) { + + if (memory_orderClause) { + return parser.emitError(parser.getNameLoc()) + << "`memory_order` clause can appear at most once in the expansion of the " + "oilist directive"; + } + memory_orderClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseClauseAttr(parser, memory_order_valAttr); + if (odsResult) return ::mlir::failure(); + if (memory_order_valAttr) + result.getOrAddProperties().memory_order_val = memory_order_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("hint"))) { + + if (hintClause) { + return parser.emitError(parser.getNameLoc()) + << "`hint` clause can appear at most once in the expansion of the " + "oilist directive"; + } + hintClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseSynchronizationHint(parser, hint_valAttr); + if (odsResult) return ::mlir::failure(); + if (hint_valAttr) + result.getOrAddProperties().hint_val = hint_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + xOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(xRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::omp::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + xRawTypes[0] = type; + } + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + + ensureTerminator(*regionRegion, parser.getBuilder(), result.location); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicUpdateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getMemoryOrderValAttr()) { + _odsPrinter << ' ' << "memory_order"; + _odsPrinter << "("; + printClauseAttr(_odsPrinter, *this, getMemoryOrderValAttr()); + _odsPrinter << ")"; + } + if (false || getHintValAttr()) { + _odsPrinter << ' ' << "hint"; + _odsPrinter << "("; + printSynchronizationHint(_odsPrinter, *this, getHintValAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter << getX(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getX().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::omp::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' '; + + { + bool printTerminator = true; + if (auto *term = getRegion().empty() ? nullptr : getRegion().begin()->getTerminator()) { + printTerminator = !term->getAttrDictionary().empty() || + term->getNumOperands() != 0 || + term->getNumResults() != 0; + } + _odsPrinter.printRegion(getRegion(), /*printEntryBlockArgs=*/true, + /*printBlockTerminators=*/printTerminator); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("memory_order_val"); + elidedAttrs.push_back("hint_val"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHintValAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), 0))) + elidedAttrs.push_back("hint_val"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void AtomicUpdateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Read::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); + for (::mlir::Value value : getODSOperands(0)) + effects.emplace_back(::mlir::MemoryEffects::Write::get(), value, 0, false, ::mlir::SideEffects::DefaultResource::get()); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::AtomicUpdateOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::AtomicWriteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AtomicWriteOpGenericAdaptorBase::AtomicWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.atomic.write", odsAttrs.getContext()); +} + +AtomicWriteOpGenericAdaptorBase::AtomicWriteOpGenericAdaptorBase(AtomicWriteOp op) : AtomicWriteOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AtomicWriteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AtomicWriteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr AtomicWriteOpGenericAdaptorBase::getHintValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); + if (!attr) + attr = ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(64), 0); + return attr; +} + +uint64_t AtomicWriteOpGenericAdaptorBase::getHintVal() { + auto attr = getHintValAttr(); + if (!attr) + return ::mlir::Builder(odsAttrs.getContext()).getIntegerAttr(::mlir::Builder(odsAttrs.getContext()).getIntegerType(64), 0).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::omp::ClauseMemoryOrderKindAttr AtomicWriteOpGenericAdaptorBase::getMemoryOrderValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(getProperties().memory_order_val); + return attr; +} + +::std::optional<::mlir::omp::ClauseMemoryOrderKind> AtomicWriteOpGenericAdaptorBase::getMemoryOrderVal() { + auto attr = getMemoryOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseMemoryOrderKind>(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +AtomicWriteOpAdaptor::AtomicWriteOpAdaptor(AtomicWriteOp op) : AtomicWriteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AtomicWriteOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_memory_order_val = getProperties().memory_order_val; (void)tblgen_memory_order_val; + + if (tblgen_hint_val && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_hint_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_hint_val).getType().isSignlessInteger(64))))) + return emitError(loc, "'omp.atomic.write' op ""attribute 'hint_val' failed to satisfy constraint: 64-bit signless integer attribute"); + + if (tblgen_memory_order_val && !((::llvm::isa<::mlir::omp::ClauseMemoryOrderKindAttr>(tblgen_memory_order_val)))) + return emitError(loc, "'omp.atomic.write' op ""attribute 'memory_order_val' failed to satisfy constraint: MemoryOrderKind Clause"); + return ::mlir::success(); +} + +std::pair AtomicWriteOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AtomicWriteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> AtomicWriteOp::getX() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::Value AtomicWriteOp::getExpr() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AtomicWriteOp::getXMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AtomicWriteOp::getExprMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AtomicWriteOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AtomicWriteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult AtomicWriteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.hint_val; + auto attr = dict.get("hint_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for hint_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hint_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.memory_order_val; + auto attr = dict.get("memory_order_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for memory_order_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `memory_order_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AtomicWriteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.hint_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hint_val", + propStorage)); + } + + { + const auto &propStorage = prop.memory_order_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("memory_order_val", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AtomicWriteOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.hint_val.getAsOpaquePointer()), + llvm::hash_value(prop.memory_order_val.getAsOpaquePointer())); +} + +std::optional AtomicWriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "hint_val") + return prop.hint_val; + + if (name == "memory_order_val") + return prop.memory_order_val; + return std::nullopt; +} + +void AtomicWriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "hint_val") { + prop.hint_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "memory_order_val") { + prop.memory_order_val = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AtomicWriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.hint_val) attrs.append("hint_val", prop.hint_val); + + if (prop.memory_order_val) attrs.append("memory_order_val", prop.memory_order_val); +} + +::mlir::LogicalResult AtomicWriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getHintValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(attr, "hint_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMemoryOrderValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps1(attr, "memory_order_val", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicWriteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.hint_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.memory_order_val))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicWriteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.hint_val); + + writer.writeOptionalAttribute(prop.memory_order_val); +} + +::mlir::IntegerAttr AtomicWriteOp::getHintValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); +} + +uint64_t AtomicWriteOp::getHintVal() { + auto attr = getHintValAttr(); + if (!attr) + return ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), 0).getValue().getZExtValue(); + return attr.getValue().getZExtValue(); +} + +::mlir::omp::ClauseMemoryOrderKindAttr AtomicWriteOp::getMemoryOrderValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(getProperties().memory_order_val); +} + +::std::optional<::mlir::omp::ClauseMemoryOrderKind> AtomicWriteOp::getMemoryOrderVal() { + auto attr = getMemoryOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseMemoryOrderKind>(attr.getValue()) : (::std::nullopt); +} + +void AtomicWriteOp::setHintValAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getHintValAttrName(), attr); +} + +void AtomicWriteOp::setHintVal(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getHintValAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getHintValAttrName()); +} + +void AtomicWriteOp::setMemoryOrderValAttr(::mlir::omp::ClauseMemoryOrderKindAttr attr) { + (*this)->setAttr(getMemoryOrderValAttrName(), attr); +} + +void AtomicWriteOp::setMemoryOrderVal(::std::optional<::mlir::omp::ClauseMemoryOrderKind> attrValue) { + if (attrValue) + return (*this)->setAttr(getMemoryOrderValAttrName(), ::mlir::omp::ClauseMemoryOrderKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getMemoryOrderValAttrName()); +} + +::mlir::Attribute AtomicWriteOp::removeHintValAttr() { + auto &attr = getProperties().hint_val; + attr = {}; + return attr; +} + +::mlir::Attribute AtomicWriteOp::removeMemoryOrderValAttr() { + auto &attr = getProperties().memory_order_val; + attr = {}; + return attr; +} + +void AtomicWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.addOperands(expr); + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } +} + +void AtomicWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.addOperands(expr); + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value expr, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.addOperands(expr); + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } +} + +void AtomicWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value expr, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val) { + odsState.addOperands(x); + odsState.addOperands(expr); + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); + if (memory_order_val) { + odsState.getOrAddProperties().memory_order_val = memory_order_val; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AtomicWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AtomicWriteOp::verifyInvariantsImpl() { + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_memory_order_val = getProperties().memory_order_val; (void)tblgen_memory_order_val; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(*this, tblgen_hint_val, "hint_val"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps1(*this, tblgen_memory_order_val, "memory_order_val"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AtomicWriteOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AtomicWriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand xRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> xOperands(xRawOperands); ::llvm::SMLoc xOperandsLoc; + (void)xOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand exprRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> exprOperands(exprRawOperands); ::llvm::SMLoc exprOperandsLoc; + (void)exprOperandsLoc; + ::mlir::IntegerAttr hint_valAttr; + ::mlir::omp::ClauseMemoryOrderKindAttr memory_order_valAttr; + ::mlir::Type xRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> xTypes(xRawTypes); + ::mlir::Type exprRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> exprTypes(exprRawTypes); + + xOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(xRawOperands[0])) + return ::mlir::failure(); + if (parser.parseEqual()) + return ::mlir::failure(); + + exprOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(exprRawOperands[0])) + return ::mlir::failure(); + bool hintClause = false; + bool memory_orderClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("hint"))) { + + if (hintClause) { + return parser.emitError(parser.getNameLoc()) + << "`hint` clause can appear at most once in the expansion of the " + "oilist directive"; + } + hintClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseSynchronizationHint(parser, hint_valAttr); + if (odsResult) return ::mlir::failure(); + if (hint_valAttr) + result.getOrAddProperties().hint_val = hint_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("memory_order"))) { + + if (memory_orderClause) { + return parser.emitError(parser.getNameLoc()) + << "`memory_order` clause can appear at most once in the expansion of the " + "oilist directive"; + } + memory_orderClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseClauseAttr(parser, memory_order_valAttr); + if (odsResult) return ::mlir::failure(); + if (memory_order_valAttr) + result.getOrAddProperties().memory_order_val = memory_order_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::omp::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + xRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + exprRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.resolveOperands(xOperands, xTypes, xOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(exprOperands, exprTypes, exprOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AtomicWriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getX(); + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter << getExpr(); + _odsPrinter << ' ' << " "; + if (false || getHintValAttr()) { + _odsPrinter << ' ' << "hint"; + _odsPrinter << "("; + printSynchronizationHint(_odsPrinter, *this, getHintValAttr()); + _odsPrinter << ")"; + } + if (false || getMemoryOrderValAttr()) { + _odsPrinter << ' ' << "memory_order"; + _odsPrinter << "("; + printClauseAttr(_odsPrinter, *this, getMemoryOrderValAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getX().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::omp::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getExpr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("hint_val"); + elidedAttrs.push_back("memory_order_val"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHintValAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), 0))) + elidedAttrs.push_back("hint_val"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::AtomicWriteOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::BarrierOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BarrierOpGenericAdaptorBase::BarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.barrier", odsAttrs.getContext()); +} + +BarrierOpGenericAdaptorBase::BarrierOpGenericAdaptorBase(BarrierOp op) : BarrierOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BarrierOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BarrierOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BarrierOpAdaptor::BarrierOpAdaptor(BarrierOp op) : BarrierOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BarrierOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BarrierOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BarrierOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BarrierOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BarrierOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void BarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void BarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BarrierOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BarrierOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult BarrierOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BarrierOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void BarrierOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::BarrierOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::CancelOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CancelOpGenericAdaptorBase::CancelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.cancel", odsAttrs.getContext()); +} + +CancelOpGenericAdaptorBase::CancelOpGenericAdaptorBase(CancelOp op) : CancelOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CancelOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CancelOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::omp::ClauseCancellationConstructTypeAttr CancelOpGenericAdaptorBase::getCancellationConstructTypeValAttr() { + auto attr = ::llvm::cast<::mlir::omp::ClauseCancellationConstructTypeAttr>(getProperties().cancellation_construct_type_val); + return attr; +} + +::mlir::omp::ClauseCancellationConstructType CancelOpGenericAdaptorBase::getCancellationConstructTypeVal() { + auto attr = getCancellationConstructTypeValAttr(); + return attr.getValue(); +} + +} // namespace detail +CancelOpAdaptor::CancelOpAdaptor(CancelOp op) : CancelOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CancelOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_cancellation_construct_type_val = getProperties().cancellation_construct_type_val; (void)tblgen_cancellation_construct_type_val; + if (!tblgen_cancellation_construct_type_val) return emitError(loc, "'omp.cancel' op ""requires attribute 'cancellation_construct_type_val'"); + + if (tblgen_cancellation_construct_type_val && !((::llvm::isa<::mlir::omp::ClauseCancellationConstructTypeAttr>(tblgen_cancellation_construct_type_val)))) + return emitError(loc, "'omp.cancel' op ""attribute 'cancellation_construct_type_val' failed to satisfy constraint: CancellationConstructType Clause"); + return ::mlir::success(); +} + +std::pair CancelOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CancelOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> CancelOp::getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::MutableOperandRange CancelOp::getIfExprMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CancelOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CancelOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult CancelOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cancellation_construct_type_val; + auto attr = dict.get("cancellation_construct_type_val"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for cancellation_construct_type_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cancellation_construct_type_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CancelOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cancellation_construct_type_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cancellation_construct_type_val", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CancelOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.cancellation_construct_type_val.getAsOpaquePointer())); +} + +std::optional CancelOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cancellation_construct_type_val") + return prop.cancellation_construct_type_val; + return std::nullopt; +} + +void CancelOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cancellation_construct_type_val") { + prop.cancellation_construct_type_val = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CancelOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cancellation_construct_type_val) attrs.append("cancellation_construct_type_val", prop.cancellation_construct_type_val); +} + +::mlir::LogicalResult CancelOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCancellationConstructTypeValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps3(attr, "cancellation_construct_type_val", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CancelOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.cancellation_construct_type_val))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CancelOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.cancellation_construct_type_val); +} + +::mlir::omp::ClauseCancellationConstructTypeAttr CancelOp::getCancellationConstructTypeValAttr() { + return ::llvm::cast<::mlir::omp::ClauseCancellationConstructTypeAttr>(getProperties().cancellation_construct_type_val); +} + +::mlir::omp::ClauseCancellationConstructType CancelOp::getCancellationConstructTypeVal() { + auto attr = getCancellationConstructTypeValAttr(); + return attr.getValue(); +} + +void CancelOp::setCancellationConstructTypeValAttr(::mlir::omp::ClauseCancellationConstructTypeAttr attr) { + (*this)->setAttr(getCancellationConstructTypeValAttrName(), attr); +} + +void CancelOp::setCancellationConstructTypeVal(::mlir::omp::ClauseCancellationConstructType attrValue) { + (*this)->setAttr(getCancellationConstructTypeValAttrName(), ::mlir::omp::ClauseCancellationConstructTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CancelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_val, /*optional*/::mlir::Value if_expr) { + if (if_expr) + odsState.addOperands(if_expr); + odsState.getOrAddProperties().cancellation_construct_type_val = cancellation_construct_type_val; +} + +void CancelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_val, /*optional*/::mlir::Value if_expr) { + if (if_expr) + odsState.addOperands(if_expr); + odsState.getOrAddProperties().cancellation_construct_type_val = cancellation_construct_type_val; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CancelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::omp::ClauseCancellationConstructType cancellation_construct_type_val, /*optional*/::mlir::Value if_expr) { + if (if_expr) + odsState.addOperands(if_expr); + odsState.getOrAddProperties().cancellation_construct_type_val = ::mlir::omp::ClauseCancellationConstructTypeAttr::get(odsBuilder.getContext(), cancellation_construct_type_val); +} + +void CancelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::omp::ClauseCancellationConstructType cancellation_construct_type_val, /*optional*/::mlir::Value if_expr) { + if (if_expr) + odsState.addOperands(if_expr); + odsState.getOrAddProperties().cancellation_construct_type_val = ::mlir::omp::ClauseCancellationConstructTypeAttr::get(odsBuilder.getContext(), cancellation_construct_type_val); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CancelOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CancelOp::verifyInvariantsImpl() { + auto tblgen_cancellation_construct_type_val = getProperties().cancellation_construct_type_val; (void)tblgen_cancellation_construct_type_val; + if (!tblgen_cancellation_construct_type_val) return emitOpError("requires attribute 'cancellation_construct_type_val'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps3(*this, tblgen_cancellation_construct_type_val, "cancellation_construct_type_val"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CancelOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CancelOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_valAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_exprOperands; + ::llvm::SMLoc if_exprOperandsLoc; + (void)if_exprOperandsLoc; + if (parser.parseKeyword("cancellation_construct_type")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseClauseAttr(parser, cancellation_construct_type_valAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().cancellation_construct_type_val = cancellation_construct_type_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("if"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(if_exprOperands, odsBuildableType0, if_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CancelOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "cancellation_construct_type"; + _odsPrinter << "("; + printClauseAttr(_odsPrinter, *this, getCancellationConstructTypeValAttr()); + _odsPrinter << ")"; + if (getIfExpr()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExpr()) + _odsPrinter << value; + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("cancellation_construct_type_val"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::CancelOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::CancellationPointOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CancellationPointOpGenericAdaptorBase::CancellationPointOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.cancellationpoint", odsAttrs.getContext()); +} + +CancellationPointOpGenericAdaptorBase::CancellationPointOpGenericAdaptorBase(CancellationPointOp op) : CancellationPointOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CancellationPointOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CancellationPointOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::omp::ClauseCancellationConstructTypeAttr CancellationPointOpGenericAdaptorBase::getCancellationConstructTypeValAttr() { + auto attr = ::llvm::cast<::mlir::omp::ClauseCancellationConstructTypeAttr>(getProperties().cancellation_construct_type_val); + return attr; +} + +::mlir::omp::ClauseCancellationConstructType CancellationPointOpGenericAdaptorBase::getCancellationConstructTypeVal() { + auto attr = getCancellationConstructTypeValAttr(); + return attr.getValue(); +} + +} // namespace detail +CancellationPointOpAdaptor::CancellationPointOpAdaptor(CancellationPointOp op) : CancellationPointOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CancellationPointOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_cancellation_construct_type_val = getProperties().cancellation_construct_type_val; (void)tblgen_cancellation_construct_type_val; + if (!tblgen_cancellation_construct_type_val) return emitError(loc, "'omp.cancellationpoint' op ""requires attribute 'cancellation_construct_type_val'"); + + if (tblgen_cancellation_construct_type_val && !((::llvm::isa<::mlir::omp::ClauseCancellationConstructTypeAttr>(tblgen_cancellation_construct_type_val)))) + return emitError(loc, "'omp.cancellationpoint' op ""attribute 'cancellation_construct_type_val' failed to satisfy constraint: CancellationConstructType Clause"); + return ::mlir::success(); +} + +std::pair CancellationPointOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CancellationPointOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CancellationPointOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CancellationPointOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult CancellationPointOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.cancellation_construct_type_val; + auto attr = dict.get("cancellation_construct_type_val"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for cancellation_construct_type_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `cancellation_construct_type_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CancellationPointOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.cancellation_construct_type_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("cancellation_construct_type_val", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CancellationPointOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.cancellation_construct_type_val.getAsOpaquePointer())); +} + +std::optional CancellationPointOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "cancellation_construct_type_val") + return prop.cancellation_construct_type_val; + return std::nullopt; +} + +void CancellationPointOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "cancellation_construct_type_val") { + prop.cancellation_construct_type_val = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CancellationPointOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.cancellation_construct_type_val) attrs.append("cancellation_construct_type_val", prop.cancellation_construct_type_val); +} + +::mlir::LogicalResult CancellationPointOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCancellationConstructTypeValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps3(attr, "cancellation_construct_type_val", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CancellationPointOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.cancellation_construct_type_val))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CancellationPointOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.cancellation_construct_type_val); +} + +::mlir::omp::ClauseCancellationConstructTypeAttr CancellationPointOp::getCancellationConstructTypeValAttr() { + return ::llvm::cast<::mlir::omp::ClauseCancellationConstructTypeAttr>(getProperties().cancellation_construct_type_val); +} + +::mlir::omp::ClauseCancellationConstructType CancellationPointOp::getCancellationConstructTypeVal() { + auto attr = getCancellationConstructTypeValAttr(); + return attr.getValue(); +} + +void CancellationPointOp::setCancellationConstructTypeValAttr(::mlir::omp::ClauseCancellationConstructTypeAttr attr) { + (*this)->setAttr(getCancellationConstructTypeValAttrName(), attr); +} + +void CancellationPointOp::setCancellationConstructTypeVal(::mlir::omp::ClauseCancellationConstructType attrValue) { + (*this)->setAttr(getCancellationConstructTypeValAttrName(), ::mlir::omp::ClauseCancellationConstructTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue)); +} + +void CancellationPointOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_val) { + odsState.getOrAddProperties().cancellation_construct_type_val = cancellation_construct_type_val; +} + +void CancellationPointOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_val) { + odsState.getOrAddProperties().cancellation_construct_type_val = cancellation_construct_type_val; + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CancellationPointOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::omp::ClauseCancellationConstructType cancellation_construct_type_val) { + odsState.getOrAddProperties().cancellation_construct_type_val = ::mlir::omp::ClauseCancellationConstructTypeAttr::get(odsBuilder.getContext(), cancellation_construct_type_val); +} + +void CancellationPointOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::omp::ClauseCancellationConstructType cancellation_construct_type_val) { + odsState.getOrAddProperties().cancellation_construct_type_val = ::mlir::omp::ClauseCancellationConstructTypeAttr::get(odsBuilder.getContext(), cancellation_construct_type_val); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CancellationPointOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CancellationPointOp::verifyInvariantsImpl() { + auto tblgen_cancellation_construct_type_val = getProperties().cancellation_construct_type_val; (void)tblgen_cancellation_construct_type_val; + if (!tblgen_cancellation_construct_type_val) return emitOpError("requires attribute 'cancellation_construct_type_val'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps3(*this, tblgen_cancellation_construct_type_val, "cancellation_construct_type_val"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult CancellationPointOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CancellationPointOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_valAttr; + if (parser.parseKeyword("cancellation_construct_type")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseClauseAttr(parser, cancellation_construct_type_valAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().cancellation_construct_type_val = cancellation_construct_type_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CancellationPointOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "cancellation_construct_type"; + _odsPrinter << "("; + printClauseAttr(_odsPrinter, *this, getCancellationConstructTypeValAttr()); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("cancellation_construct_type_val"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::CancellationPointOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::CriticalDeclareOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CriticalDeclareOpGenericAdaptorBase::CriticalDeclareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.critical.declare", odsAttrs.getContext()); +} + +CriticalDeclareOpGenericAdaptorBase::CriticalDeclareOpGenericAdaptorBase(CriticalDeclareOp op) : CriticalDeclareOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CriticalDeclareOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CriticalDeclareOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr CriticalDeclareOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef CriticalDeclareOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr CriticalDeclareOpGenericAdaptorBase::getHintValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); + return attr; +} + +uint64_t CriticalDeclareOpGenericAdaptorBase::getHintVal() { + auto attr = getHintValAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +CriticalDeclareOpAdaptor::CriticalDeclareOpAdaptor(CriticalDeclareOp op) : CriticalDeclareOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CriticalDeclareOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'omp.critical.declare' op ""requires attribute 'sym_name'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'omp.critical.declare' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_hint_val && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_hint_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_hint_val).getType().isSignlessInteger(64))))) + return emitError(loc, "'omp.critical.declare' op ""attribute 'hint_val' failed to satisfy constraint: 64-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair CriticalDeclareOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CriticalDeclareOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CriticalDeclareOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CriticalDeclareOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult CriticalDeclareOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.hint_val; + auto attr = dict.get("hint_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for hint_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `hint_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CriticalDeclareOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.hint_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("hint_val", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CriticalDeclareOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.hint_val.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer())); +} + +std::optional CriticalDeclareOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "hint_val") + return prop.hint_val; + + if (name == "sym_name") + return prop.sym_name; + return std::nullopt; +} + +void CriticalDeclareOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "hint_val") { + prop.hint_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CriticalDeclareOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.hint_val) attrs.append("hint_val", prop.hint_val); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); +} + +::mlir::LogicalResult CriticalDeclareOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getHintValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(attr, "hint_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps4(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CriticalDeclareOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.hint_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CriticalDeclareOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.hint_val); + writer.writeAttribute(prop.sym_name); +} + +::mlir::StringAttr CriticalDeclareOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef CriticalDeclareOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::IntegerAttr CriticalDeclareOp::getHintValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().hint_val); +} + +uint64_t CriticalDeclareOp::getHintVal() { + auto attr = getHintValAttr(); + return attr.getValue().getZExtValue(); +} + +void CriticalDeclareOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void CriticalDeclareOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void CriticalDeclareOp::setHintValAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getHintValAttrName(), attr); +} + +void CriticalDeclareOp::setHintVal(uint64_t attrValue) { + (*this)->setAttr(getHintValAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), attrValue)); +} + +void CriticalDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::IntegerAttr hint_val) { + odsState.getOrAddProperties().sym_name = sym_name; + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } +} + +void CriticalDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::IntegerAttr hint_val) { + odsState.getOrAddProperties().sym_name = sym_name; + if (hint_val) { + odsState.getOrAddProperties().hint_val = hint_val; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CriticalDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, uint64_t hint_val) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); +} + +void CriticalDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, uint64_t hint_val) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), hint_val); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CriticalDeclareOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void CriticalDeclareOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.hint_val) + properties.hint_val = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), 0); +} + +::mlir::LogicalResult CriticalDeclareOp::verifyInvariantsImpl() { + auto tblgen_hint_val = getProperties().hint_val; (void)tblgen_hint_val; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps4(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps0(*this, tblgen_hint_val, "hint_val"))) + return ::mlir::failure(); + return ::mlir::success(); +} + +::mlir::LogicalResult CriticalDeclareOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CriticalDeclareOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + ::mlir::IntegerAttr hint_valAttr; + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + bool hintClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("hint"))) { + + if (hintClause) { + return parser.emitError(parser.getNameLoc()) + << "`hint` clause can appear at most once in the expansion of the " + "oilist directive"; + } + hintClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseSynchronizationHint(parser, hint_valAttr); + if (odsResult) return ::mlir::failure(); + if (hint_valAttr) + result.getOrAddProperties().hint_val = hint_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CriticalDeclareOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' ' << " "; + if (false || getHintValAttr()) { + _odsPrinter << ' ' << "hint"; + _odsPrinter << "("; + printSynchronizationHint(_odsPrinter, *this, getHintValAttr()); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("hint_val"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getHintValAttr(); + if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(64), 0))) + elidedAttrs.push_back("hint_val"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::CriticalDeclareOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::CriticalOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CriticalOpGenericAdaptorBase::CriticalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.critical", odsAttrs.getContext()); +} + +CriticalOpGenericAdaptorBase::CriticalOpGenericAdaptorBase(CriticalOp op) : CriticalOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CriticalOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CriticalOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::FlatSymbolRefAttr CriticalOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > CriticalOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &CriticalOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange CriticalOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +CriticalOpAdaptor::CriticalOpAdaptor(CriticalOp op) : CriticalOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CriticalOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_name = getProperties().name; (void)tblgen_name; + + if (tblgen_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_name)))) + return emitError(loc, "'omp.critical' op ""attribute 'name' failed to satisfy constraint: flat symbol reference attribute"); + return ::mlir::success(); +} + +std::pair CriticalOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CriticalOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CriticalOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CriticalOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &CriticalOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult CriticalOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CriticalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CriticalOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.name.getAsOpaquePointer())); +} + +std::optional CriticalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "name") + return prop.name; + return std::nullopt; +} + +void CriticalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CriticalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.name) attrs.append("name", prop.name); +} + +::mlir::LogicalResult CriticalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps5(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CriticalOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CriticalOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.name); +} + +::mlir::FlatSymbolRefAttr CriticalOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > CriticalOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void CriticalOp::setNameAttr(::mlir::FlatSymbolRefAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void CriticalOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute CriticalOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void CriticalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::FlatSymbolRefAttr name) { + if (name) { + odsState.getOrAddProperties().name = name; + } + (void)odsState.addRegion(); +} + +void CriticalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::FlatSymbolRefAttr name) { + if (name) { + odsState.getOrAddProperties().name = name; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CriticalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CriticalOp::verifyInvariantsImpl() { + auto tblgen_name = getProperties().name; (void)tblgen_name; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps5(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CriticalOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CriticalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::FlatSymbolRefAttr nameAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + return ::mlir::success(); +} + +void CriticalOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getNameAttr()) { + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("name"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::CriticalOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::DataBoundsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DataBoundsOpGenericAdaptorBase::DataBoundsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.bounds", odsAttrs.getContext()); +} + +DataBoundsOpGenericAdaptorBase::DataBoundsOpGenericAdaptorBase(DataBoundsOp op) : DataBoundsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DataBoundsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DataBoundsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::BoolAttr DataBoundsOpGenericAdaptorBase::getStrideInBytesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().stride_in_bytes); + return attr; +} + +bool DataBoundsOpGenericAdaptorBase::getStrideInBytes() { + auto attr = getStrideInBytesAttr(); + return attr.getValue(); +} + +} // namespace detail +DataBoundsOpAdaptor::DataBoundsOpAdaptor(DataBoundsOp op) : DataBoundsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DataBoundsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_stride_in_bytes = getProperties().stride_in_bytes; (void)tblgen_stride_in_bytes; + + if (tblgen_stride_in_bytes && !((::llvm::isa<::mlir::BoolAttr>(tblgen_stride_in_bytes)))) + return emitError(loc, "'omp.bounds' op ""attribute 'stride_in_bytes' failed to satisfy constraint: bool attribute"); + return ::mlir::success(); +} + +std::pair DataBoundsOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DataBoundsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DataBoundsOp::getLowerBound() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value DataBoundsOp::getUpperBound() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value DataBoundsOp::getExtent() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value DataBoundsOp::getStride() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value DataBoundsOp::getStartIdx() { + auto operands = getODSOperands(4); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::MutableOperandRange DataBoundsOp::getLowerBoundMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataBoundsOp::getUpperBoundMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataBoundsOp::getExtentMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataBoundsOp::getStrideMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataBoundsOp::getStartIdxMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DataBoundsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DataBoundsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::omp::DataBoundsType> DataBoundsOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::DataBoundsType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult DataBoundsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.stride_in_bytes; + auto attr = dict.get("stride_in_bytes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for stride_in_bytes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `stride_in_bytes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DataBoundsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.stride_in_bytes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("stride_in_bytes", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DataBoundsOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.stride_in_bytes.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DataBoundsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "stride_in_bytes") + return prop.stride_in_bytes; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DataBoundsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "stride_in_bytes") { + prop.stride_in_bytes = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DataBoundsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.stride_in_bytes) attrs.append("stride_in_bytes", prop.stride_in_bytes); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DataBoundsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getStrideInBytesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps6(attr, "stride_in_bytes", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DataBoundsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.stride_in_bytes))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DataBoundsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.stride_in_bytes); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::BoolAttr DataBoundsOp::getStrideInBytesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().stride_in_bytes); +} + +bool DataBoundsOp::getStrideInBytes() { + auto attr = getStrideInBytesAttr(); + return attr.getValue(); +} + +void DataBoundsOp::setStrideInBytesAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getStrideInBytesAttrName(), attr); +} + +void DataBoundsOp::setStrideInBytes(bool attrValue) { + (*this)->setAttr(getStrideInBytesAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void DataBoundsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lower_bound, /*optional*/::mlir::Value upper_bound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr stride_in_bytes, /*optional*/::mlir::Value start_idx) { + if (lower_bound) + odsState.addOperands(lower_bound); + if (upper_bound) + odsState.addOperands(upper_bound); + if (extent) + odsState.addOperands(extent); + if (stride) + odsState.addOperands(stride); + if (start_idx) + odsState.addOperands(start_idx); + ::llvm::copy(::llvm::ArrayRef({(lower_bound ? 1 : 0), (upper_bound ? 1 : 0), (extent ? 1 : 0), (stride ? 1 : 0), (start_idx ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (stride_in_bytes) { + odsState.getOrAddProperties().stride_in_bytes = stride_in_bytes; + } + odsState.addTypes(result); +} + +void DataBoundsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lower_bound, /*optional*/::mlir::Value upper_bound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr stride_in_bytes, /*optional*/::mlir::Value start_idx) { + if (lower_bound) + odsState.addOperands(lower_bound); + if (upper_bound) + odsState.addOperands(upper_bound); + if (extent) + odsState.addOperands(extent); + if (stride) + odsState.addOperands(stride); + if (start_idx) + odsState.addOperands(start_idx); + ::llvm::copy(::llvm::ArrayRef({(lower_bound ? 1 : 0), (upper_bound ? 1 : 0), (extent ? 1 : 0), (stride ? 1 : 0), (start_idx ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (stride_in_bytes) { + odsState.getOrAddProperties().stride_in_bytes = stride_in_bytes; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DataBoundsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lower_bound, /*optional*/::mlir::Value upper_bound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool stride_in_bytes, /*optional*/::mlir::Value start_idx) { + if (lower_bound) + odsState.addOperands(lower_bound); + if (upper_bound) + odsState.addOperands(upper_bound); + if (extent) + odsState.addOperands(extent); + if (stride) + odsState.addOperands(stride); + if (start_idx) + odsState.addOperands(start_idx); + ::llvm::copy(::llvm::ArrayRef({(lower_bound ? 1 : 0), (upper_bound ? 1 : 0), (extent ? 1 : 0), (stride ? 1 : 0), (start_idx ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().stride_in_bytes = odsBuilder.getBoolAttr(stride_in_bytes); + odsState.addTypes(result); +} + +void DataBoundsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lower_bound, /*optional*/::mlir::Value upper_bound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool stride_in_bytes, /*optional*/::mlir::Value start_idx) { + if (lower_bound) + odsState.addOperands(lower_bound); + if (upper_bound) + odsState.addOperands(upper_bound); + if (extent) + odsState.addOperands(extent); + if (stride) + odsState.addOperands(stride); + if (start_idx) + odsState.addOperands(start_idx); + ::llvm::copy(::llvm::ArrayRef({(lower_bound ? 1 : 0), (upper_bound ? 1 : 0), (extent ? 1 : 0), (stride ? 1 : 0), (start_idx ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().stride_in_bytes = odsBuilder.getBoolAttr(stride_in_bytes); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DataBoundsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void DataBoundsOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.stride_in_bytes) + properties.stride_in_bytes = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult DataBoundsOp::verifyInvariantsImpl() { + auto tblgen_stride_in_bytes = getProperties().stride_in_bytes; (void)tblgen_stride_in_bytes; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps6(*this, tblgen_stride_in_bytes, "stride_in_bytes"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + if (valueGroup4.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup4.size(); + } + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DataBoundsOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DataBoundsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> lower_boundOperands; + ::llvm::SMLoc lower_boundOperandsLoc; + (void)lower_boundOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> lower_boundTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> upper_boundOperands; + ::llvm::SMLoc upper_boundOperandsLoc; + (void)upper_boundOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> upper_boundTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> extentOperands; + ::llvm::SMLoc extentOperandsLoc; + (void)extentOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> extentTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> strideOperands; + ::llvm::SMLoc strideOperandsLoc; + (void)strideOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> strideTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> start_idxOperands; + ::llvm::SMLoc start_idxOperandsLoc; + (void)start_idxOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> start_idxTypes; + bool lower_boundClause = false; + bool upper_boundClause = false; + bool extentClause = false; + bool strideClause = false; + bool start_idxClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("lower_bound"))) { + + if (lower_boundClause) { + return parser.emitError(parser.getNameLoc()) + << "`lower_bound` clause can appear at most once in the expansion of the " + "oilist directive"; + } + lower_boundClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + lower_boundOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + lower_boundOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + lower_boundTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("upper_bound"))) { + + if (upper_boundClause) { + return parser.emitError(parser.getNameLoc()) + << "`upper_bound` clause can appear at most once in the expansion of the " + "oilist directive"; + } + upper_boundClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + upper_boundOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + upper_boundOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + upper_boundTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("extent"))) { + + if (extentClause) { + return parser.emitError(parser.getNameLoc()) + << "`extent` clause can appear at most once in the expansion of the " + "oilist directive"; + } + extentClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + extentOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + extentOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + extentTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("stride"))) { + + if (strideClause) { + return parser.emitError(parser.getNameLoc()) + << "`stride` clause can appear at most once in the expansion of the " + "oilist directive"; + } + strideClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + strideOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + strideOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + strideTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("start_idx"))) { + + if (start_idxClause) { + return parser.emitError(parser.getNameLoc()) + << "`start_idx` clause can appear at most once in the expansion of the " + "oilist directive"; + } + start_idxClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + start_idxOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + start_idxOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + start_idxTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(lower_boundOperands.size()), static_cast(upper_boundOperands.size()), static_cast(extentOperands.size()), static_cast(strideOperands.size()), static_cast(start_idxOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::omp::DataBoundsType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(lower_boundOperands, lower_boundTypes, lower_boundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(upper_boundOperands, upper_boundTypes, upper_boundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(extentOperands, extentTypes, extentOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(strideOperands, strideTypes, strideOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(start_idxOperands, start_idxTypes, start_idxOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DataBoundsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getLowerBound()) { + _odsPrinter << ' ' << "lower_bound"; + _odsPrinter << "("; + if (::mlir::Value value = getLowerBound()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getLowerBound() ? ::llvm::ArrayRef<::mlir::Type>(getLowerBound().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getUpperBound()) { + _odsPrinter << ' ' << "upper_bound"; + _odsPrinter << "("; + if (::mlir::Value value = getUpperBound()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getUpperBound() ? ::llvm::ArrayRef<::mlir::Type>(getUpperBound().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getExtent()) { + _odsPrinter << ' ' << "extent"; + _odsPrinter << "("; + if (::mlir::Value value = getExtent()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getExtent() ? ::llvm::ArrayRef<::mlir::Type>(getExtent().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getStride()) { + _odsPrinter << ' ' << "stride"; + _odsPrinter << "("; + if (::mlir::Value value = getStride()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getStride() ? ::llvm::ArrayRef<::mlir::Type>(getStride().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getStartIdx()) { + _odsPrinter << ' ' << "start_idx"; + _odsPrinter << "("; + if (::mlir::Value value = getStartIdx()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getStartIdx() ? ::llvm::ArrayRef<::mlir::Type>(getStartIdx().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getStrideInBytesAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("stride_in_bytes"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void DataBoundsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::DataBoundsOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::FlushOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FlushOpGenericAdaptorBase::FlushOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.flush", odsAttrs.getContext()); +} + +FlushOpGenericAdaptorBase::FlushOpGenericAdaptorBase(FlushOp op) : FlushOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FlushOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr FlushOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FlushOpAdaptor::FlushOpAdaptor(FlushOp op) : FlushOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FlushOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FlushOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range FlushOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range FlushOp::getVarList() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange FlushOp::getVarListMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair FlushOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FlushOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void FlushOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange varList) { + odsState.addOperands(varList); +} + +void FlushOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FlushOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult FlushOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FlushOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> varListOperands; + ::llvm::SMLoc varListOperandsLoc; + (void)varListOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> varListTypes; + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + varListOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(varListOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(varListTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(varListOperands, varListTypes, varListOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FlushOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (!getVarList().empty()) { + _odsPrinter << "("; + _odsPrinter << getVarList(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getVarList().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::FlushOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::MapInfoOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MapInfoOpGenericAdaptorBase::MapInfoOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.map_info", odsAttrs.getContext()); +} + +MapInfoOpGenericAdaptorBase::MapInfoOpGenericAdaptorBase(MapInfoOp op) : MapInfoOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MapInfoOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr MapInfoOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr MapInfoOpGenericAdaptorBase::getMapTypeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().map_type); + return attr; +} + +::std::optional MapInfoOpGenericAdaptorBase::getMapType() { + auto attr = getMapTypeAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::omp::VariableCaptureKindAttr MapInfoOpGenericAdaptorBase::getMapCaptureTypeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::VariableCaptureKindAttr>(getProperties().map_capture_type); + return attr; +} + +::std::optional<::mlir::omp::VariableCaptureKind> MapInfoOpGenericAdaptorBase::getMapCaptureType() { + auto attr = getMapCaptureTypeAttr(); + return attr ? ::std::optional<::mlir::omp::VariableCaptureKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::BoolAttr MapInfoOpGenericAdaptorBase::getImplicitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); + return attr; +} + +bool MapInfoOpGenericAdaptorBase::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr MapInfoOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > MapInfoOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +} // namespace detail +MapInfoOpAdaptor::MapInfoOpAdaptor(MapInfoOp op) : MapInfoOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MapInfoOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_map_capture_type = getProperties().map_capture_type; (void)tblgen_map_capture_type; + auto tblgen_map_type = getProperties().map_type; (void)tblgen_map_type; + auto tblgen_name = getProperties().name; (void)tblgen_name; + + if (tblgen_map_type && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_map_type))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_map_type).getType().isUnsignedInteger(64))))) + return emitError(loc, "'omp.map_info' op ""attribute 'map_type' failed to satisfy constraint: 64-bit unsigned integer attribute"); + + if (tblgen_map_capture_type && !((::llvm::isa<::mlir::omp::VariableCaptureKindAttr>(tblgen_map_capture_type)))) + return emitError(loc, "'omp.map_info' op ""attribute 'map_capture_type' failed to satisfy constraint: variable capture kind"); + + if (tblgen_implicit && !((::llvm::isa<::mlir::BoolAttr>(tblgen_implicit)))) + return emitError(loc, "'omp.map_info' op ""attribute 'implicit' failed to satisfy constraint: bool attribute"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'omp.map_info' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair MapInfoOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range MapInfoOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> MapInfoOp::getVarPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> MapInfoOp::getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::omp::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*operands.begin()); +} + +::mlir::Operation::operand_range MapInfoOp::getBounds() { + return getODSOperands(2); +} + +::mlir::OpOperand &MapInfoOp::getVarPtrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange MapInfoOp::getVarPtrPtrMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange MapInfoOp::getBoundsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair MapInfoOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MapInfoOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> MapInfoOp::getOmpPtr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult MapInfoOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.implicit; + auto attr = dict.get("implicit"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for implicit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `implicit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.map_capture_type; + auto attr = dict.get("map_capture_type"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for map_capture_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map_capture_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.map_type; + auto attr = dict.get("map_type"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for map_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `map_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute MapInfoOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.implicit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("implicit", + propStorage)); + } + + { + const auto &propStorage = prop.map_capture_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map_capture_type", + propStorage)); + } + + { + const auto &propStorage = prop.map_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("map_type", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code MapInfoOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.implicit.getAsOpaquePointer()), + llvm::hash_value(prop.map_capture_type.getAsOpaquePointer()), + llvm::hash_value(prop.map_type.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional MapInfoOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "implicit") + return prop.implicit; + + if (name == "map_capture_type") + return prop.map_capture_type; + + if (name == "map_type") + return prop.map_type; + + if (name == "name") + return prop.name; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void MapInfoOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "implicit") { + prop.implicit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "map_capture_type") { + prop.map_capture_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "map_type") { + prop.map_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void MapInfoOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.implicit) attrs.append("implicit", prop.implicit); + + if (prop.map_capture_type) attrs.append("map_capture_type", prop.map_capture_type); + + if (prop.map_type) attrs.append("map_type", prop.map_type); + + if (prop.name) attrs.append("name", prop.name); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult MapInfoOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getImplicitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps6(attr, "implicit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMapCaptureTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps8(attr, "map_capture_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMapTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps7(attr, "map_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps4(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MapInfoOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.implicit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.map_capture_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.map_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void MapInfoOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.implicit); + + writer.writeOptionalAttribute(prop.map_capture_type); + + writer.writeOptionalAttribute(prop.map_type); + + writer.writeOptionalAttribute(prop.name); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::IntegerAttr MapInfoOp::getMapTypeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().map_type); +} + +::std::optional MapInfoOp::getMapType() { + auto attr = getMapTypeAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::omp::VariableCaptureKindAttr MapInfoOp::getMapCaptureTypeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::VariableCaptureKindAttr>(getProperties().map_capture_type); +} + +::std::optional<::mlir::omp::VariableCaptureKind> MapInfoOp::getMapCaptureType() { + auto attr = getMapCaptureTypeAttr(); + return attr ? ::std::optional<::mlir::omp::VariableCaptureKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::BoolAttr MapInfoOp::getImplicitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); +} + +bool MapInfoOp::getImplicit() { + auto attr = getImplicitAttr(); + return attr.getValue(); +} + +::mlir::StringAttr MapInfoOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > MapInfoOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void MapInfoOp::setMapTypeAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getMapTypeAttrName(), attr); +} + +void MapInfoOp::setMapType(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getMapTypeAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64, /*isSigned=*/false), *attrValue)); + (*this)->removeAttr(getMapTypeAttrName()); +} + +void MapInfoOp::setMapCaptureTypeAttr(::mlir::omp::VariableCaptureKindAttr attr) { + (*this)->setAttr(getMapCaptureTypeAttrName(), attr); +} + +void MapInfoOp::setMapCaptureType(::std::optional<::mlir::omp::VariableCaptureKind> attrValue) { + if (attrValue) + return (*this)->setAttr(getMapCaptureTypeAttrName(), ::mlir::omp::VariableCaptureKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getMapCaptureTypeAttrName()); +} + +void MapInfoOp::setImplicitAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getImplicitAttrName(), attr); +} + +void MapInfoOp::setImplicit(bool attrValue) { + (*this)->setAttr(getImplicitAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void MapInfoOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void MapInfoOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute MapInfoOp::removeMapTypeAttr() { + auto &attr = getProperties().map_type; + attr = {}; + return attr; +} + +::mlir::Attribute MapInfoOp::removeMapCaptureTypeAttr() { + auto &attr = getProperties().map_capture_type; + attr = {}; + return attr; +} + +::mlir::Attribute MapInfoOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void MapInfoOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type omp_ptr, ::mlir::Value var_ptr, /*optional*/::mlir::Value var_ptr_ptr, ::mlir::ValueRange bounds, /*optional*/::mlir::IntegerAttr map_type, /*optional*/::mlir::omp::VariableCaptureKindAttr map_capture_type, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(var_ptr); + if (var_ptr_ptr) + odsState.addOperands(var_ptr_ptr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (var_ptr_ptr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (map_type) { + odsState.getOrAddProperties().map_type = map_type; + } + if (map_capture_type) { + odsState.getOrAddProperties().map_capture_type = map_capture_type; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(omp_ptr); +} + +void MapInfoOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var_ptr, /*optional*/::mlir::Value var_ptr_ptr, ::mlir::ValueRange bounds, /*optional*/::mlir::IntegerAttr map_type, /*optional*/::mlir::omp::VariableCaptureKindAttr map_capture_type, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(var_ptr); + if (var_ptr_ptr) + odsState.addOperands(var_ptr_ptr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (var_ptr_ptr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (map_type) { + odsState.getOrAddProperties().map_type = map_type; + } + if (map_capture_type) { + odsState.getOrAddProperties().map_capture_type = map_capture_type; + } + if (implicit) { + odsState.getOrAddProperties().implicit = implicit; + } + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MapInfoOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type omp_ptr, ::mlir::Value var_ptr, /*optional*/::mlir::Value var_ptr_ptr, ::mlir::ValueRange bounds, /*optional*/::mlir::IntegerAttr map_type, /*optional*/::mlir::omp::VariableCaptureKindAttr map_capture_type, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(var_ptr); + if (var_ptr_ptr) + odsState.addOperands(var_ptr_ptr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (var_ptr_ptr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (map_type) { + odsState.getOrAddProperties().map_type = map_type; + } + if (map_capture_type) { + odsState.getOrAddProperties().map_capture_type = map_capture_type; + } + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + odsState.addTypes(omp_ptr); +} + +void MapInfoOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var_ptr, /*optional*/::mlir::Value var_ptr_ptr, ::mlir::ValueRange bounds, /*optional*/::mlir::IntegerAttr map_type, /*optional*/::mlir::omp::VariableCaptureKindAttr map_capture_type, bool implicit, /*optional*/::mlir::StringAttr name) { + odsState.addOperands(var_ptr); + if (var_ptr_ptr) + odsState.addOperands(var_ptr_ptr); + odsState.addOperands(bounds); + ::llvm::copy(::llvm::ArrayRef({1, (var_ptr_ptr ? 1 : 0), static_cast(bounds.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (map_type) { + odsState.getOrAddProperties().map_type = map_type; + } + if (map_capture_type) { + odsState.getOrAddProperties().map_capture_type = map_capture_type; + } + odsState.getOrAddProperties().implicit = odsBuilder.getBoolAttr(implicit); + if (name) { + odsState.getOrAddProperties().name = name; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MapInfoOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void MapInfoOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.implicit) + properties.implicit = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult MapInfoOp::verifyInvariantsImpl() { + auto tblgen_implicit = getProperties().implicit; (void)tblgen_implicit; + auto tblgen_map_capture_type = getProperties().map_capture_type; (void)tblgen_map_capture_type; + auto tblgen_map_type = getProperties().map_type; (void)tblgen_map_type; + auto tblgen_name = getProperties().name; (void)tblgen_name; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps7(*this, tblgen_map_type, "map_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps8(*this, tblgen_map_capture_type, "map_capture_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps6(*this, tblgen_implicit, "implicit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps4(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult MapInfoOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MapInfoOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand var_ptrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> var_ptrOperands(var_ptrRawOperands); ::llvm::SMLoc var_ptrOperandsLoc; + (void)var_ptrOperandsLoc; + ::mlir::Type var_ptrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> var_ptrTypes(var_ptrRawTypes); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> var_ptr_ptrOperands; + ::llvm::SMLoc var_ptr_ptrOperandsLoc; + (void)var_ptr_ptrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> var_ptr_ptrTypes; + ::mlir::IntegerAttr map_typeAttr; + ::mlir::omp::VariableCaptureKindAttr map_capture_typeAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> boundsOperands; + ::llvm::SMLoc boundsOperandsLoc; + (void)boundsOperandsLoc; + ::mlir::Type omp_ptrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> omp_ptrTypes(omp_ptrRawTypes); + if (parser.parseKeyword("var_ptr")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + var_ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(var_ptrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::omp::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + var_ptrRawTypes[0] = type; + } + if (parser.parseRParen()) + return ::mlir::failure(); + bool var_ptr_ptrClause = false; + bool map_clausesClause = false; + bool captureClause = false; + bool boundsClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("var_ptr_ptr"))) { + + if (var_ptr_ptrClause) { + return parser.emitError(parser.getNameLoc()) + << "`var_ptr_ptr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + var_ptr_ptrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + var_ptr_ptrOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + var_ptr_ptrOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + var_ptr_ptrTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("map_clauses"))) { + + if (map_clausesClause) { + return parser.emitError(parser.getNameLoc()) + << "`map_clauses` clause can appear at most once in the expansion of the " + "oilist directive"; + } + map_clausesClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseMapClause(parser, map_typeAttr); + if (odsResult) return ::mlir::failure(); + if (map_typeAttr) + result.getOrAddProperties().map_type = map_typeAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("capture"))) { + + if (captureClause) { + return parser.emitError(parser.getNameLoc()) + << "`capture` clause can appear at most once in the expansion of the " + "oilist directive"; + } + captureClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseCaptureType(parser, map_capture_typeAttr); + if (odsResult) return ::mlir::failure(); + if (map_capture_typeAttr) + result.getOrAddProperties().map_capture_type = map_capture_typeAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("bounds"))) { + + if (boundsClause) { + return parser.emitError(parser.getNameLoc()) + << "`bounds` clause can appear at most once in the expansion of the " + "oilist directive"; + } + boundsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + boundsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(boundsOperands)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::omp::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + omp_ptrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(var_ptr_ptrOperands.size()), static_cast(boundsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::omp::DataBoundsType>(); + result.addTypes(omp_ptrTypes); + if (parser.resolveOperands(var_ptrOperands, var_ptrTypes, var_ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(var_ptr_ptrOperands, var_ptr_ptrTypes, var_ptr_ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(boundsOperands, odsBuildableType0, boundsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void MapInfoOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "var_ptr"; + _odsPrinter << "("; + _odsPrinter << getVarPtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getVarPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::omp::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ")"; + _odsPrinter << ' ' << " "; + if (false || getVarPtrPtr()) { + _odsPrinter << ' ' << "var_ptr_ptr"; + _odsPrinter << "("; + if (::mlir::Value value = getVarPtrPtr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getVarPtrPtr() ? ::llvm::ArrayRef<::mlir::Type>(getVarPtrPtr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getMapTypeAttr()) { + _odsPrinter << ' ' << "map_clauses"; + _odsPrinter << "("; + printMapClause(_odsPrinter, *this, getMapTypeAttr()); + _odsPrinter << ")"; + } + if (false || getMapCaptureTypeAttr()) { + _odsPrinter << ' ' << "capture"; + _odsPrinter << "("; + printCaptureType(_odsPrinter, *this, getMapCaptureTypeAttr()); + _odsPrinter << ")"; + } + if (false || getBounds().size()) { + _odsPrinter << ' ' << "bounds"; + _odsPrinter << "("; + _odsPrinter << getBounds(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getOmpPtr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::omp::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("map_type"); + elidedAttrs.push_back("map_capture_type"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getImplicitAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("implicit"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::MapInfoOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::MasterOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +MasterOpGenericAdaptorBase::MasterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.master", odsAttrs.getContext()); +} + +MasterOpGenericAdaptorBase::MasterOpGenericAdaptorBase(MasterOp op) : MasterOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair MasterOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr MasterOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &MasterOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange MasterOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +MasterOpAdaptor::MasterOpAdaptor(MasterOp op) : MasterOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult MasterOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair MasterOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range MasterOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair MasterOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range MasterOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &MasterOp::getRegion() { + return (*this)->getRegion(0); +} + +void MasterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + (void)odsState.addRegion(); +} + +void MasterOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void MasterOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult MasterOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult MasterOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult MasterOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + return ::mlir::success(); +} + +void MasterOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::MasterOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::OrderedOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +OrderedOpGenericAdaptorBase::OrderedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.ordered", odsAttrs.getContext()); +} + +OrderedOpGenericAdaptorBase::OrderedOpGenericAdaptorBase(OrderedOp op) : OrderedOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair OrderedOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr OrderedOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::omp::ClauseDependAttr OrderedOpGenericAdaptorBase::getDependTypeValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ClauseDependAttr>(getProperties().depend_type_val); + return attr; +} + +::std::optional<::mlir::omp::ClauseDepend> OrderedOpGenericAdaptorBase::getDependTypeVal() { + auto attr = getDependTypeValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseDepend>(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr OrderedOpGenericAdaptorBase::getNumLoopsValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().num_loops_val); + return attr; +} + +::std::optional OrderedOpGenericAdaptorBase::getNumLoopsVal() { + auto attr = getNumLoopsValAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +OrderedOpAdaptor::OrderedOpAdaptor(OrderedOp op) : OrderedOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult OrderedOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_depend_type_val = getProperties().depend_type_val; (void)tblgen_depend_type_val; + auto tblgen_num_loops_val = getProperties().num_loops_val; (void)tblgen_num_loops_val; + + if (tblgen_depend_type_val && !((::llvm::isa<::mlir::omp::ClauseDependAttr>(tblgen_depend_type_val)))) + return emitError(loc, "'omp.ordered' op ""attribute 'depend_type_val' failed to satisfy constraint: depend clause"); + + if (tblgen_num_loops_val && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_num_loops_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_num_loops_val).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_num_loops_val).getInt() >= 0)))) + return emitError(loc, "'omp.ordered' op ""attribute 'num_loops_val' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"); + return ::mlir::success(); +} + +std::pair OrderedOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range OrderedOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range OrderedOp::getDependVecVars() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange OrderedOp::getDependVecVarsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair OrderedOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range OrderedOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult OrderedOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.depend_type_val; + auto attr = dict.get("depend_type_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for depend_type_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `depend_type_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.num_loops_val; + auto attr = dict.get("num_loops_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for num_loops_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `num_loops_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute OrderedOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.depend_type_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("depend_type_val", + propStorage)); + } + + { + const auto &propStorage = prop.num_loops_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("num_loops_val", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code OrderedOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.depend_type_val.getAsOpaquePointer()), + llvm::hash_value(prop.num_loops_val.getAsOpaquePointer())); +} + +std::optional OrderedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "depend_type_val") + return prop.depend_type_val; + + if (name == "num_loops_val") + return prop.num_loops_val; + return std::nullopt; +} + +void OrderedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "depend_type_val") { + prop.depend_type_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "num_loops_val") { + prop.num_loops_val = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void OrderedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.depend_type_val) attrs.append("depend_type_val", prop.depend_type_val); + + if (prop.num_loops_val) attrs.append("num_loops_val", prop.num_loops_val); +} + +::mlir::LogicalResult OrderedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDependTypeValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps9(attr, "depend_type_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNumLoopsValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps10(attr, "num_loops_val", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult OrderedOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.depend_type_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.num_loops_val))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OrderedOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.depend_type_val); + + writer.writeOptionalAttribute(prop.num_loops_val); +} + +::mlir::omp::ClauseDependAttr OrderedOp::getDependTypeValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseDependAttr>(getProperties().depend_type_val); +} + +::std::optional<::mlir::omp::ClauseDepend> OrderedOp::getDependTypeVal() { + auto attr = getDependTypeValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseDepend>(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr OrderedOp::getNumLoopsValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().num_loops_val); +} + +::std::optional OrderedOp::getNumLoopsVal() { + auto attr = getNumLoopsValAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void OrderedOp::setDependTypeValAttr(::mlir::omp::ClauseDependAttr attr) { + (*this)->setAttr(getDependTypeValAttrName(), attr); +} + +void OrderedOp::setDependTypeVal(::std::optional<::mlir::omp::ClauseDepend> attrValue) { + if (attrValue) + return (*this)->setAttr(getDependTypeValAttrName(), ::mlir::omp::ClauseDependAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getDependTypeValAttrName()); +} + +void OrderedOp::setNumLoopsValAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getNumLoopsValAttrName(), attr); +} + +void OrderedOp::setNumLoopsVal(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getNumLoopsValAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getNumLoopsValAttrName()); +} + +::mlir::Attribute OrderedOp::removeDependTypeValAttr() { + auto &attr = getProperties().depend_type_val; + attr = {}; + return attr; +} + +::mlir::Attribute OrderedOp::removeNumLoopsValAttr() { + auto &attr = getProperties().num_loops_val; + attr = {}; + return attr; +} + +void OrderedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::omp::ClauseDependAttr depend_type_val, /*optional*/::mlir::IntegerAttr num_loops_val, ::mlir::ValueRange depend_vec_vars) { + odsState.addOperands(depend_vec_vars); + if (depend_type_val) { + odsState.getOrAddProperties().depend_type_val = depend_type_val; + } + if (num_loops_val) { + odsState.getOrAddProperties().num_loops_val = num_loops_val; + } +} + +void OrderedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::omp::ClauseDependAttr depend_type_val, /*optional*/::mlir::IntegerAttr num_loops_val, ::mlir::ValueRange depend_vec_vars) { + odsState.addOperands(depend_vec_vars); + if (depend_type_val) { + odsState.getOrAddProperties().depend_type_val = depend_type_val; + } + if (num_loops_val) { + odsState.getOrAddProperties().num_loops_val = num_loops_val; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void OrderedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult OrderedOp::verifyInvariantsImpl() { + auto tblgen_depend_type_val = getProperties().depend_type_val; (void)tblgen_depend_type_val; + auto tblgen_num_loops_val = getProperties().num_loops_val; (void)tblgen_num_loops_val; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps9(*this, tblgen_depend_type_val, "depend_type_val"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps10(*this, tblgen_num_loops_val, "num_loops_val"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult OrderedOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult OrderedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::omp::ClauseDependAttr depend_type_valAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> depend_vec_varsOperands; + ::llvm::SMLoc depend_vec_varsOperandsLoc; + (void)depend_vec_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> depend_vec_varsTypes; + if (::mlir::succeeded(parser.parseOptionalKeyword("depend_type"))) { + + if (parser.parseCustomAttributeWithFallback(depend_type_valAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (depend_type_valAttr) result.getOrAddProperties().depend_type_val = depend_type_valAttr; + } + if (::mlir::succeeded(parser.parseOptionalKeyword("depend_vec"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + depend_vec_varsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(depend_vec_varsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(depend_vec_varsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.resolveOperands(depend_vec_varsOperands, depend_vec_varsTypes, depend_vec_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OrderedOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getDependTypeValAttr()) { + _odsPrinter << ' ' << "depend_type"; + _odsPrinter.printStrippedAttrOrType(getDependTypeValAttr()); + } + if (!getDependVecVars().empty()) { + _odsPrinter << ' ' << "depend_vec"; + _odsPrinter << "("; + _odsPrinter << getDependVecVars(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getDependVecVars().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("depend_type_val"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::OrderedOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::OrderedRegionOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +OrderedRegionOpGenericAdaptorBase::OrderedRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.ordered_region", odsAttrs.getContext()); +} + +OrderedRegionOpGenericAdaptorBase::OrderedRegionOpGenericAdaptorBase(OrderedRegionOp op) : OrderedRegionOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair OrderedRegionOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr OrderedRegionOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr OrderedRegionOpGenericAdaptorBase::getSimdAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().simd); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool OrderedRegionOpGenericAdaptorBase::getSimd() { + auto attr = getSimdAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Region &OrderedRegionOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange OrderedRegionOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +OrderedRegionOpAdaptor::OrderedRegionOpAdaptor(OrderedRegionOp op) : OrderedRegionOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult OrderedRegionOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_simd = getProperties().simd; (void)tblgen_simd; + + if (tblgen_simd && !((::llvm::isa<::mlir::UnitAttr>(tblgen_simd)))) + return emitError(loc, "'omp.ordered_region' op ""attribute 'simd' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair OrderedRegionOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range OrderedRegionOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair OrderedRegionOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range OrderedRegionOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &OrderedRegionOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult OrderedRegionOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.simd; + auto attr = dict.get("simd"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for simd in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `simd` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute OrderedRegionOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.simd; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("simd", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code OrderedRegionOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.simd.getAsOpaquePointer())); +} + +std::optional OrderedRegionOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "simd") + return prop.simd; + return std::nullopt; +} + +void OrderedRegionOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "simd") { + prop.simd = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void OrderedRegionOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.simd) attrs.append("simd", prop.simd); +} + +::mlir::LogicalResult OrderedRegionOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getSimdAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "simd", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult OrderedRegionOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.simd))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OrderedRegionOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.simd); +} + +::mlir::UnitAttr OrderedRegionOp::getSimdAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().simd); +} + +bool OrderedRegionOp::getSimd() { + auto attr = getSimdAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void OrderedRegionOp::setSimdAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getSimdAttrName(), attr); +} + +void OrderedRegionOp::setSimd(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getSimdAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getSimdAttrName()); +} + +::mlir::Attribute OrderedRegionOp::removeSimdAttr() { + auto &attr = getProperties().simd; + attr = {}; + return attr; +} + +void OrderedRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::UnitAttr simd) { + if (simd) { + odsState.getOrAddProperties().simd = simd; + } + (void)odsState.addRegion(); +} + +void OrderedRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr simd) { + if (simd) { + odsState.getOrAddProperties().simd = simd; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void OrderedRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/bool simd) { + if (simd) { + odsState.getOrAddProperties().simd = ((simd) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); +} + +void OrderedRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/bool simd) { + if (simd) { + odsState.getOrAddProperties().simd = ((simd) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void OrderedRegionOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult OrderedRegionOp::verifyInvariantsImpl() { + auto tblgen_simd = getProperties().simd; (void)tblgen_simd; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_simd, "simd"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult OrderedRegionOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult OrderedRegionOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + if (::mlir::succeeded(parser.parseOptionalKeyword("simd"))) { + result.getOrAddProperties().simd = parser.getBuilder().getUnitAttr(); } + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + return ::mlir::success(); +} + +void OrderedRegionOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getSimdAttr()) { + _odsPrinter << ' ' << "simd"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("simd"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getSimdAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("simd"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::OrderedRegionOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ParallelOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ParallelOpGenericAdaptorBase::ParallelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.parallel", odsAttrs.getContext()); +} + +ParallelOpGenericAdaptorBase::ParallelOpGenericAdaptorBase(ParallelOp op) : ParallelOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ParallelOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ParallelOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr ParallelOpGenericAdaptorBase::getReductionsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > ParallelOpGenericAdaptorBase::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::omp::ClauseProcBindKindAttr ParallelOpGenericAdaptorBase::getProcBindValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ClauseProcBindKindAttr>(getProperties().proc_bind_val); + return attr; +} + +::std::optional<::mlir::omp::ClauseProcBindKind> ParallelOpGenericAdaptorBase::getProcBindVal() { + auto attr = getProcBindValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseProcBindKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &ParallelOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange ParallelOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ParallelOpAdaptor::ParallelOpAdaptor(ParallelOp op) : ParallelOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ParallelOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_proc_bind_val = getProperties().proc_bind_val; (void)tblgen_proc_bind_val; + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + + if (tblgen_reductions && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reductions))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reductions), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'omp.parallel' op ""attribute 'reductions' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_proc_bind_val && !((::llvm::isa<::mlir::omp::ClauseProcBindKindAttr>(tblgen_proc_bind_val)))) + return emitError(loc, "'omp.parallel' op ""attribute 'proc_bind_val' failed to satisfy constraint: ProcBindKind Clause"); + return ::mlir::success(); +} + +std::pair ParallelOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ParallelOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> ParallelOp::getIfExprVar() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Value ParallelOp::getNumThreadsVar() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range ParallelOp::getAllocateVars() { + return getODSOperands(2); +} + +::mlir::Operation::operand_range ParallelOp::getAllocatorsVars() { + return getODSOperands(3); +} + +::mlir::Operation::operand_range ParallelOp::getReductionVars() { + return getODSOperands(4); +} + +::mlir::MutableOperandRange ParallelOp::getIfExprVarMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getNumThreadsVarMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getAllocateVarsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getAllocatorsVarsMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ParallelOp::getReductionVarsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ParallelOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ParallelOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &ParallelOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult ParallelOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.proc_bind_val; + auto attr = dict.get("proc_bind_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for proc_bind_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `proc_bind_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.reductions; + auto attr = dict.get("reductions"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for reductions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ParallelOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.proc_bind_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("proc_bind_val", + propStorage)); + } + + { + const auto &propStorage = prop.reductions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductions", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ParallelOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.proc_bind_val.getAsOpaquePointer()), + llvm::hash_value(prop.reductions.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ParallelOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "proc_bind_val") + return prop.proc_bind_val; + + if (name == "reductions") + return prop.reductions; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ParallelOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "proc_bind_val") { + prop.proc_bind_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "reductions") { + prop.reductions = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ParallelOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.proc_bind_val) attrs.append("proc_bind_val", prop.proc_bind_val); + + if (prop.reductions) attrs.append("reductions", prop.reductions); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ParallelOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getProcBindValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps13(attr, "proc_bind_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReductionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(attr, "reductions", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ParallelOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.proc_bind_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.reductions))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ParallelOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.proc_bind_val); + + writer.writeOptionalAttribute(prop.reductions); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::ArrayAttr ParallelOp::getReductionsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); +} + +::std::optional< ::mlir::ArrayAttr > ParallelOp::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::omp::ClauseProcBindKindAttr ParallelOp::getProcBindValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseProcBindKindAttr>(getProperties().proc_bind_val); +} + +::std::optional<::mlir::omp::ClauseProcBindKind> ParallelOp::getProcBindVal() { + auto attr = getProcBindValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseProcBindKind>(attr.getValue()) : (::std::nullopt); +} + +void ParallelOp::setReductionsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReductionsAttrName(), attr); +} + +void ParallelOp::setProcBindValAttr(::mlir::omp::ClauseProcBindKindAttr attr) { + (*this)->setAttr(getProcBindValAttrName(), attr); +} + +void ParallelOp::setProcBindVal(::std::optional<::mlir::omp::ClauseProcBindKind> attrValue) { + if (attrValue) + return (*this)->setAttr(getProcBindValAttrName(), ::mlir::omp::ClauseProcBindKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getProcBindValAttrName()); +} + +::mlir::Attribute ParallelOp::removeReductionsAttr() { + auto &attr = getProperties().reductions; + attr = {}; + return attr; +} + +::mlir::Attribute ParallelOp::removeProcBindValAttr() { + auto &attr = getProperties().proc_bind_val; + attr = {}; + return attr; +} + +void ParallelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr_var, /*optional*/::mlir::Value num_threads_var, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseProcBindKindAttr proc_bind_val) { + if (if_expr_var) + odsState.addOperands(if_expr_var); + if (num_threads_var) + odsState.addOperands(num_threads_var); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + odsState.addOperands(reduction_vars); + ::llvm::copy(::llvm::ArrayRef({(if_expr_var ? 1 : 0), (num_threads_var ? 1 : 0), static_cast(allocate_vars.size()), static_cast(allocators_vars.size()), static_cast(reduction_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (proc_bind_val) { + odsState.getOrAddProperties().proc_bind_val = proc_bind_val; + } + (void)odsState.addRegion(); +} + +void ParallelOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr_var, /*optional*/::mlir::Value num_threads_var, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseProcBindKindAttr proc_bind_val) { + if (if_expr_var) + odsState.addOperands(if_expr_var); + if (num_threads_var) + odsState.addOperands(num_threads_var); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + odsState.addOperands(reduction_vars); + ::llvm::copy(::llvm::ArrayRef({(if_expr_var ? 1 : 0), (num_threads_var ? 1 : 0), static_cast(allocate_vars.size()), static_cast(allocators_vars.size()), static_cast(reduction_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (proc_bind_val) { + odsState.getOrAddProperties().proc_bind_val = proc_bind_val; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ParallelOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ParallelOp::verifyInvariantsImpl() { + auto tblgen_proc_bind_val = getProperties().proc_bind_val; (void)tblgen_proc_bind_val; + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(*this, tblgen_reductions, "reductions"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps13(*this, tblgen_proc_bind_val, "proc_bind_val"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ParallelOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ParallelOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> reduction_varsOperands; + ::llvm::SMLoc reduction_varsOperandsLoc; + (void)reduction_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> reduction_varsTypes; + ::mlir::ArrayAttr reductionsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_expr_varOperands; + ::llvm::SMLoc if_expr_varOperandsLoc; + (void)if_expr_varOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> if_expr_varTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> num_threads_varOperands; + ::llvm::SMLoc num_threads_varOperandsLoc; + (void)num_threads_varOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> num_threads_varTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocate_varsOperands; + ::llvm::SMLoc allocate_varsOperandsLoc; + (void)allocate_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocate_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocators_varsOperands; + ::llvm::SMLoc allocators_varsOperandsLoc; + (void)allocators_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocators_varsTypes; + ::mlir::omp::ClauseProcBindKindAttr proc_bind_valAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool reductionClause = false; + bool ifClause = false; + bool num_threadsClause = false; + bool allocateClause = false; + bool proc_bindClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("reduction"))) { + + if (reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + reduction_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseReductionVarList(parser, reduction_varsOperands, reduction_varsTypes, reductionsAttr); + if (odsResult) return ::mlir::failure(); + if (reductionsAttr) + result.getOrAddProperties().reductions = reductionsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_expr_varOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_expr_varOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_expr_varTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("num_threads"))) { + + if (num_threadsClause) { + return parser.emitError(parser.getNameLoc()) + << "`num_threads` clause can appear at most once in the expansion of the " + "oilist directive"; + } + num_threadsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + num_threads_varOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + num_threads_varOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + num_threads_varTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("allocate"))) { + + if (allocateClause) { + return parser.emitError(parser.getNameLoc()) + << "`allocate` clause can appear at most once in the expansion of the " + "oilist directive"; + } + allocateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + allocate_varsOperandsLoc = parser.getCurrentLocation(); + allocators_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAllocateAndAllocator(parser, allocate_varsOperands, allocate_varsTypes, allocators_varsOperands, allocators_varsTypes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("proc_bind"))) { + + if (proc_bindClause) { + return parser.emitError(parser.getNameLoc()) + << "`proc_bind` clause can appear at most once in the expansion of the " + "oilist directive"; + } + proc_bindClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseClauseAttr(parser, proc_bind_valAttr); + if (odsResult) return ::mlir::failure(); + if (proc_bind_valAttr) + result.getOrAddProperties().proc_bind_val = proc_bind_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(if_expr_varOperands.size()), static_cast(num_threads_varOperands.size()), static_cast(allocate_varsOperands.size()), static_cast(allocators_varsOperands.size()), static_cast(reduction_varsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + if (parser.resolveOperands(if_expr_varOperands, if_expr_varTypes, if_expr_varOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(num_threads_varOperands, num_threads_varTypes, num_threads_varOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocate_varsOperands, allocate_varsTypes, allocate_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocators_varsOperands, allocators_varsTypes, allocators_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(reduction_varsOperands, reduction_varsTypes, reduction_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ParallelOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getReductionVars().size() || getReductionsAttr()) { + _odsPrinter << ' ' << "reduction"; + _odsPrinter << "("; + printReductionVarList(_odsPrinter, *this, getReductionVars(), getReductionVars().getTypes(), getReductionsAttr()); + _odsPrinter << ")"; + } + if (false || getIfExprVar()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExprVar()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getIfExprVar() ? ::llvm::ArrayRef<::mlir::Type>(getIfExprVar().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getNumThreadsVar()) { + _odsPrinter << ' ' << "num_threads"; + _odsPrinter << "("; + if (::mlir::Value value = getNumThreadsVar()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getNumThreadsVar() ? ::llvm::ArrayRef<::mlir::Type>(getNumThreadsVar().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getAllocateVars().size() || getAllocatorsVars().size()) { + _odsPrinter << ' ' << "allocate"; + _odsPrinter << "("; + printAllocateAndAllocator(_odsPrinter, *this, getAllocateVars(), getAllocateVars().getTypes(), getAllocatorsVars(), getAllocatorsVars().getTypes()); + _odsPrinter << ")"; + } + if (false || getProcBindValAttr()) { + _odsPrinter << ' ' << "proc_bind"; + _odsPrinter << "("; + printClauseAttr(_odsPrinter, *this, getProcBindValAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("reductions"); + elidedAttrs.push_back("proc_bind_val"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ParallelOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ReductionDeclareOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReductionDeclareOpGenericAdaptorBase::ReductionDeclareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.reduction.declare", odsAttrs.getContext()); +} + +ReductionDeclareOpGenericAdaptorBase::ReductionDeclareOpGenericAdaptorBase(ReductionDeclareOp op) : ReductionDeclareOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReductionDeclareOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ReductionDeclareOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr ReductionDeclareOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef ReductionDeclareOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr ReductionDeclareOpGenericAdaptorBase::getTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); + return attr; +} + +::mlir::Type ReductionDeclareOpGenericAdaptorBase::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +::mlir::Region &ReductionDeclareOpGenericAdaptorBase::getInitializerRegion() { + return *odsRegions[0]; +} + +::mlir::Region &ReductionDeclareOpGenericAdaptorBase::getReductionRegion() { + return *odsRegions[1]; +} + +::mlir::Region &ReductionDeclareOpGenericAdaptorBase::getAtomicReductionRegion() { + return *odsRegions[2]; +} + +::mlir::RegionRange ReductionDeclareOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ReductionDeclareOpAdaptor::ReductionDeclareOpAdaptor(ReductionDeclareOp op) : ReductionDeclareOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReductionDeclareOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'omp.reduction.declare' op ""requires attribute 'sym_name'"); + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitError(loc, "'omp.reduction.declare' op ""requires attribute 'type'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'omp.reduction.declare' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) + return emitError(loc, "'omp.reduction.declare' op ""attribute 'type' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair ReductionDeclareOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ReductionDeclareOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ReductionDeclareOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReductionDeclareOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &ReductionDeclareOp::getInitializerRegion() { + return (*this)->getRegion(0); +} + +::mlir::Region &ReductionDeclareOp::getReductionRegion() { + return (*this)->getRegion(1); +} + +::mlir::Region &ReductionDeclareOp::getAtomicReductionRegion() { + return (*this)->getRegion(2); +} + +::mlir::LogicalResult ReductionDeclareOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.type; + auto attr = dict.get("type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ReductionDeclareOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + { + const auto &propStorage = prop.type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("type", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ReductionDeclareOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.sym_name.getAsOpaquePointer()), + llvm::hash_value(prop.type.getAsOpaquePointer())); +} + +std::optional ReductionDeclareOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "sym_name") + return prop.sym_name; + + if (name == "type") + return prop.type; + return std::nullopt; +} + +void ReductionDeclareOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "type") { + prop.type = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ReductionDeclareOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); + + if (prop.type) attrs.append("type", prop.type); +} + +::mlir::LogicalResult ReductionDeclareOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps4(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps2(attr, "type", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReductionDeclareOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.type))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReductionDeclareOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.sym_name); + writer.writeAttribute(prop.type); +} + +::mlir::StringAttr ReductionDeclareOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef ReductionDeclareOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr ReductionDeclareOp::getTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); +} + +::mlir::Type ReductionDeclareOp::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void ReductionDeclareOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void ReductionDeclareOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void ReductionDeclareOp::setTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getTypeAttrName(), attr); +} + +void ReductionDeclareOp::setType(::mlir::Type attrValue) { + (*this)->setAttr(getTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void ReductionDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + (void)odsState.addRegion(); + (void)odsState.addRegion(); + (void)odsState.addRegion(); +} + +void ReductionDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type) { + odsState.getOrAddProperties().sym_name = sym_name; + odsState.getOrAddProperties().type = type; + (void)odsState.addRegion(); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReductionDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + (void)odsState.addRegion(); +} + +void ReductionDeclareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type) { + odsState.getOrAddProperties().sym_name = odsBuilder.getStringAttr(sym_name); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReductionDeclareOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 3; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReductionDeclareOp::verifyInvariantsImpl() { + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitOpError("requires attribute 'type'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps4(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps2(*this, tblgen_type, "type"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "initializerRegion", index++))) + return ::mlir::failure(); + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(1))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "reductionRegion", index++))) + return ::mlir::failure(); + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(2))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "atomicReductionRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReductionDeclareOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ReductionDeclareOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + ::mlir::TypeAttr typeAttr; + std::unique_ptr<::mlir::Region> initializerRegionRegion = std::make_unique<::mlir::Region>(); + std::unique_ptr<::mlir::Region> reductionRegionRegion = std::make_unique<::mlir::Region>(); + std::unique_ptr<::mlir::Region> atomicReductionRegionRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseSymbolName(sym_nameAttr)) + return ::mlir::failure(); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (typeAttr) result.getOrAddProperties().type = typeAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseKeyword("init")) + return ::mlir::failure(); + + if (parser.parseRegion(*initializerRegionRegion)) + return ::mlir::failure(); + if (parser.parseKeyword("combiner")) + return ::mlir::failure(); + + if (parser.parseRegion(*reductionRegionRegion)) + return ::mlir::failure(); + { + auto odsResult = parseAtomicReductionRegion(parser, *atomicReductionRegionRegion); + if (odsResult) return ::mlir::failure(); + } + result.addRegion(std::move(initializerRegionRegion)); + result.addRegion(std::move(reductionRegionRegion)); + result.addRegion(std::move(atomicReductionRegionRegion)); + return ::mlir::success(); +} + +void ReductionDeclareOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getTypeAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("type"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "init"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getInitializerRegion()); + _odsPrinter << ' ' << "combiner"; + _odsPrinter << ' '; + _odsPrinter.printRegion(getReductionRegion()); + _odsPrinter << ' '; + printAtomicReductionRegion(_odsPrinter, *this, getAtomicReductionRegion()); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ReductionDeclareOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ReductionOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReductionOpGenericAdaptorBase::ReductionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.reduction", odsAttrs.getContext()); +} + +ReductionOpGenericAdaptorBase::ReductionOpGenericAdaptorBase(ReductionOp op) : ReductionOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReductionOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ReductionOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ReductionOpAdaptor::ReductionOpAdaptor(ReductionOp op) : ReductionOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReductionOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ReductionOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ReductionOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value ReductionOp::getOperand() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> ReductionOp::getAccumulator() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &ReductionOp::getOperandMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &ReductionOp::getAccumulatorMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair ReductionOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReductionOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ReductionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value accumulator) { + odsState.addOperands(operand); + odsState.addOperands(accumulator); +} + +void ReductionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value accumulator) { + odsState.addOperands(operand); + odsState.addOperands(accumulator); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReductionOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReductionOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReductionOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReductionOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc; + (void)operandOperandsLoc; + ::mlir::OpAsmParser::UnresolvedOperand accumulatorRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> accumulatorOperands(accumulatorRawOperands); ::llvm::SMLoc accumulatorOperandsLoc; + (void)accumulatorOperandsLoc; + ::mlir::Type operandRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> operandTypes(operandRawTypes); + ::mlir::Type accumulatorRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> accumulatorTypes(accumulatorRawTypes); + + operandOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(operandRawOperands[0])) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + + accumulatorOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(accumulatorRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + operandRawTypes[0] = type; + } + if (parser.parseComma()) + return ::mlir::failure(); + + { + ::mlir::omp::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + accumulatorRawTypes[0] = type; + } + if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(accumulatorOperands, accumulatorTypes, accumulatorOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReductionOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperand(); + _odsPrinter << ","; + _odsPrinter << ' '; + _odsPrinter << getAccumulator(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getOperand().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ","; + _odsPrinter << ' '; + { + auto type = getAccumulator().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::omp::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ReductionOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::SectionOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SectionOpGenericAdaptorBase::SectionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.section", odsAttrs.getContext()); +} + +SectionOpGenericAdaptorBase::SectionOpGenericAdaptorBase(SectionOp op) : SectionOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SectionOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SectionOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &SectionOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange SectionOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +SectionOpAdaptor::SectionOpAdaptor(SectionOp op) : SectionOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SectionOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair SectionOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SectionOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair SectionOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SectionOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &SectionOp::getRegion() { + return (*this)->getRegion(0); +} + +void SectionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + (void)odsState.addRegion(); +} + +void SectionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SectionOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SectionOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SectionOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult SectionOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); + return ::mlir::success(); +} + +void SectionOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::SectionOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::SectionsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SectionsOpGenericAdaptorBase::SectionsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.sections", odsAttrs.getContext()); +} + +SectionsOpGenericAdaptorBase::SectionsOpGenericAdaptorBase(SectionsOp op) : SectionsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SectionsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SectionsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr SectionsOpGenericAdaptorBase::getReductionsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > SectionsOpGenericAdaptorBase::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::UnitAttr SectionsOpGenericAdaptorBase::getNowaitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool SectionsOpGenericAdaptorBase::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Region &SectionsOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange SectionsOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +SectionsOpAdaptor::SectionsOpAdaptor(SectionsOp op) : SectionsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SectionsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + + if (tblgen_reductions && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reductions))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reductions), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'omp.sections' op ""attribute 'reductions' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_nowait && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nowait)))) + return emitError(loc, "'omp.sections' op ""attribute 'nowait' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair SectionsOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SectionsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SectionsOp::getReductionVars() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range SectionsOp::getAllocateVars() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range SectionsOp::getAllocatorsVars() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange SectionsOp::getReductionVarsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SectionsOp::getAllocateVarsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SectionsOp::getAllocatorsVarsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair SectionsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SectionsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &SectionsOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult SectionsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.nowait; + auto attr = dict.get("nowait"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nowait in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nowait` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.reductions; + auto attr = dict.get("reductions"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for reductions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SectionsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.nowait; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nowait", + propStorage)); + } + + { + const auto &propStorage = prop.reductions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductions", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SectionsOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.nowait.getAsOpaquePointer()), + llvm::hash_value(prop.reductions.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SectionsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "nowait") + return prop.nowait; + + if (name == "reductions") + return prop.reductions; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SectionsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "nowait") { + prop.nowait = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "reductions") { + prop.reductions = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SectionsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.nowait) attrs.append("nowait", prop.nowait); + + if (prop.reductions) attrs.append("reductions", prop.reductions); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SectionsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNowaitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "nowait", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReductionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(attr, "reductions", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SectionsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.nowait))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.reductions))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SectionsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.nowait); + + writer.writeOptionalAttribute(prop.reductions); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::ArrayAttr SectionsOp::getReductionsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); +} + +::std::optional< ::mlir::ArrayAttr > SectionsOp::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::UnitAttr SectionsOp::getNowaitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); +} + +bool SectionsOp::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void SectionsOp::setReductionsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReductionsAttrName(), attr); +} + +void SectionsOp::setNowaitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNowaitAttrName(), attr); +} + +void SectionsOp::setNowait(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNowaitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNowaitAttrName()); +} + +::mlir::Attribute SectionsOp::removeReductionsAttr() { + auto &attr = getProperties().reductions; + attr = {}; + return attr; +} + +::mlir::Attribute SectionsOp::removeNowaitAttr() { + auto &attr = getProperties().nowait; + attr = {}; + return attr; +} + +void SectionsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::UnitAttr nowait) { + odsState.addOperands(reduction_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(reduction_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + (void)odsState.addRegion(); +} + +void SectionsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::UnitAttr nowait) { + odsState.addOperands(reduction_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(reduction_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SectionsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/bool nowait) { + odsState.addOperands(reduction_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(reduction_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); +} + +void SectionsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/bool nowait) { + odsState.addOperands(reduction_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(reduction_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SectionsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SectionsOp::verifyInvariantsImpl() { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(*this, tblgen_reductions, "reductions"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_nowait, "nowait"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SectionsOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SectionsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> reduction_varsOperands; + ::llvm::SMLoc reduction_varsOperandsLoc; + (void)reduction_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> reduction_varsTypes; + ::mlir::ArrayAttr reductionsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocate_varsOperands; + ::llvm::SMLoc allocate_varsOperandsLoc; + (void)allocate_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocate_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocators_varsOperands; + ::llvm::SMLoc allocators_varsOperandsLoc; + (void)allocators_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocators_varsTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool reductionClause = false; + bool allocateClause = false; + bool nowaitClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("reduction"))) { + + if (reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + reduction_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseReductionVarList(parser, reduction_varsOperands, reduction_varsTypes, reductionsAttr); + if (odsResult) return ::mlir::failure(); + if (reductionsAttr) + result.getOrAddProperties().reductions = reductionsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("allocate"))) { + + if (allocateClause) { + return parser.emitError(parser.getNameLoc()) + << "`allocate` clause can appear at most once in the expansion of the " + "oilist directive"; + } + allocateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + allocate_varsOperandsLoc = parser.getCurrentLocation(); + allocators_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAllocateAndAllocator(parser, allocate_varsOperands, allocate_varsTypes, allocators_varsOperands, allocators_varsTypes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("nowait"))) { + + if (nowaitClause) { + return parser.emitError(parser.getNameLoc()) + << "`nowait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + nowaitClause = true; + result.getOrAddProperties().nowait = parser.getBuilder().getUnitAttr(); } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(reduction_varsOperands.size()), static_cast(allocate_varsOperands.size()), static_cast(allocators_varsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + if (parser.resolveOperands(reduction_varsOperands, reduction_varsTypes, reduction_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocate_varsOperands, allocate_varsTypes, allocate_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocators_varsOperands, allocators_varsTypes, allocators_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SectionsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getReductionVars().size() || getReductionsAttr()) { + _odsPrinter << ' ' << "reduction"; + _odsPrinter << "("; + printReductionVarList(_odsPrinter, *this, getReductionVars(), getReductionVars().getTypes(), getReductionsAttr()); + _odsPrinter << ")"; + } + if (false || getAllocateVars().size() || getAllocatorsVars().size()) { + _odsPrinter << ' ' << "allocate"; + _odsPrinter << "("; + printAllocateAndAllocator(_odsPrinter, *this, getAllocateVars(), getAllocateVars().getTypes(), getAllocatorsVars(), getAllocatorsVars().getTypes()); + _odsPrinter << ")"; + } + if (false || getNowaitAttr()) { + _odsPrinter << ' ' << "nowait"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("reductions"); + elidedAttrs.push_back("nowait"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNowaitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nowait"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::SectionsOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::SimdLoopOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SimdLoopOpGenericAdaptorBase::SimdLoopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.simdloop", odsAttrs.getContext()); +} + +SimdLoopOpGenericAdaptorBase::SimdLoopOpGenericAdaptorBase(SimdLoopOp op) : SimdLoopOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SimdLoopOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SimdLoopOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr SimdLoopOpGenericAdaptorBase::getAlignmentValuesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alignment_values); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > SimdLoopOpGenericAdaptorBase::getAlignmentValues() { + auto attr = getAlignmentValuesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::omp::ClauseOrderKindAttr SimdLoopOpGenericAdaptorBase::getOrderValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ClauseOrderKindAttr>(getProperties().order_val); + return attr; +} + +::std::optional<::mlir::omp::ClauseOrderKind> SimdLoopOpGenericAdaptorBase::getOrderVal() { + auto attr = getOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseOrderKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr SimdLoopOpGenericAdaptorBase::getSimdlenAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().simdlen); + return attr; +} + +::std::optional SimdLoopOpGenericAdaptorBase::getSimdlen() { + auto attr = getSimdlenAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr SimdLoopOpGenericAdaptorBase::getSafelenAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().safelen); + return attr; +} + +::std::optional SimdLoopOpGenericAdaptorBase::getSafelen() { + auto attr = getSafelenAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr SimdLoopOpGenericAdaptorBase::getInclusiveAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inclusive); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool SimdLoopOpGenericAdaptorBase::getInclusive() { + auto attr = getInclusiveAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Region &SimdLoopOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange SimdLoopOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +SimdLoopOpAdaptor::SimdLoopOpAdaptor(SimdLoopOp op) : SimdLoopOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SimdLoopOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_alignment_values = getProperties().alignment_values; (void)tblgen_alignment_values; + auto tblgen_inclusive = getProperties().inclusive; (void)tblgen_inclusive; + auto tblgen_order_val = getProperties().order_val; (void)tblgen_order_val; + auto tblgen_safelen = getProperties().safelen; (void)tblgen_safelen; + auto tblgen_simdlen = getProperties().simdlen; (void)tblgen_simdlen; + + if (tblgen_alignment_values && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_alignment_values))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_alignment_values), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))); })))) + return emitError(loc, "'omp.simdloop' op ""attribute 'alignment_values' failed to satisfy constraint: 64-bit integer array attribute"); + + if (tblgen_order_val && !((::llvm::isa<::mlir::omp::ClauseOrderKindAttr>(tblgen_order_val)))) + return emitError(loc, "'omp.simdloop' op ""attribute 'order_val' failed to satisfy constraint: OrderKind Clause"); + + if (tblgen_simdlen && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_simdlen))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_simdlen).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_simdlen).getValue().isStrictlyPositive())))) + return emitError(loc, "'omp.simdloop' op ""attribute 'simdlen' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive"); + + if (tblgen_safelen && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_safelen))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_safelen).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_safelen).getValue().isStrictlyPositive())))) + return emitError(loc, "'omp.simdloop' op ""attribute 'safelen' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive"); + + if (tblgen_inclusive && !((::llvm::isa<::mlir::UnitAttr>(tblgen_inclusive)))) + return emitError(loc, "'omp.simdloop' op ""attribute 'inclusive' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair SimdLoopOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SimdLoopOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SimdLoopOp::getLowerBound() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range SimdLoopOp::getUpperBound() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range SimdLoopOp::getStep() { + return getODSOperands(2); +} + +::mlir::Operation::operand_range SimdLoopOp::getAlignedVars() { + return getODSOperands(3); +} + +::mlir::TypedValue<::mlir::IntegerType> SimdLoopOp::getIfExpr() { + auto operands = getODSOperands(4); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range SimdLoopOp::getNontemporalVars() { + return getODSOperands(5); +} + +::mlir::MutableOperandRange SimdLoopOp::getLowerBoundMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SimdLoopOp::getUpperBoundMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SimdLoopOp::getStepMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SimdLoopOp::getAlignedVarsMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SimdLoopOp::getIfExprMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SimdLoopOp::getNontemporalVarsMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair SimdLoopOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SimdLoopOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &SimdLoopOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult SimdLoopOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.alignment_values; + auto attr = dict.get("alignment_values"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for alignment_values in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `alignment_values` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.inclusive; + auto attr = dict.get("inclusive"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for inclusive in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `inclusive` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.order_val; + auto attr = dict.get("order_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for order_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `order_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.safelen; + auto attr = dict.get("safelen"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for safelen in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `safelen` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.simdlen; + auto attr = dict.get("simdlen"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for simdlen in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `simdlen` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SimdLoopOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.alignment_values; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("alignment_values", + propStorage)); + } + + { + const auto &propStorage = prop.inclusive; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("inclusive", + propStorage)); + } + + { + const auto &propStorage = prop.order_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("order_val", + propStorage)); + } + + { + const auto &propStorage = prop.safelen; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("safelen", + propStorage)); + } + + { + const auto &propStorage = prop.simdlen; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("simdlen", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SimdLoopOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.alignment_values.getAsOpaquePointer()), + llvm::hash_value(prop.inclusive.getAsOpaquePointer()), + llvm::hash_value(prop.order_val.getAsOpaquePointer()), + llvm::hash_value(prop.safelen.getAsOpaquePointer()), + llvm::hash_value(prop.simdlen.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SimdLoopOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "alignment_values") + return prop.alignment_values; + + if (name == "inclusive") + return prop.inclusive; + + if (name == "order_val") + return prop.order_val; + + if (name == "safelen") + return prop.safelen; + + if (name == "simdlen") + return prop.simdlen; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SimdLoopOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "alignment_values") { + prop.alignment_values = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "inclusive") { + prop.inclusive = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "order_val") { + prop.order_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "safelen") { + prop.safelen = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "simdlen") { + prop.simdlen = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SimdLoopOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.alignment_values) attrs.append("alignment_values", prop.alignment_values); + + if (prop.inclusive) attrs.append("inclusive", prop.inclusive); + + if (prop.order_val) attrs.append("order_val", prop.order_val); + + if (prop.safelen) attrs.append("safelen", prop.safelen); + + if (prop.simdlen) attrs.append("simdlen", prop.simdlen); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SimdLoopOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAlignmentValuesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps14(attr, "alignment_values", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getInclusiveAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "inclusive", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getOrderValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps15(attr, "order_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSafelenAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps16(attr, "safelen", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSimdlenAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps16(attr, "simdlen", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SimdLoopOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.alignment_values))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.inclusive))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.order_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.safelen))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.simdlen))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SimdLoopOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.alignment_values); + + writer.writeOptionalAttribute(prop.inclusive); + + writer.writeOptionalAttribute(prop.order_val); + + writer.writeOptionalAttribute(prop.safelen); + + writer.writeOptionalAttribute(prop.simdlen); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::ArrayAttr SimdLoopOp::getAlignmentValuesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().alignment_values); +} + +::std::optional< ::mlir::ArrayAttr > SimdLoopOp::getAlignmentValues() { + auto attr = getAlignmentValuesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::omp::ClauseOrderKindAttr SimdLoopOp::getOrderValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseOrderKindAttr>(getProperties().order_val); +} + +::std::optional<::mlir::omp::ClauseOrderKind> SimdLoopOp::getOrderVal() { + auto attr = getOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseOrderKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr SimdLoopOp::getSimdlenAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().simdlen); +} + +::std::optional SimdLoopOp::getSimdlen() { + auto attr = getSimdlenAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::IntegerAttr SimdLoopOp::getSafelenAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().safelen); +} + +::std::optional SimdLoopOp::getSafelen() { + auto attr = getSafelenAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::UnitAttr SimdLoopOp::getInclusiveAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inclusive); +} + +bool SimdLoopOp::getInclusive() { + auto attr = getInclusiveAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void SimdLoopOp::setAlignmentValuesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAlignmentValuesAttrName(), attr); +} + +void SimdLoopOp::setOrderValAttr(::mlir::omp::ClauseOrderKindAttr attr) { + (*this)->setAttr(getOrderValAttrName(), attr); +} + +void SimdLoopOp::setOrderVal(::std::optional<::mlir::omp::ClauseOrderKind> attrValue) { + if (attrValue) + return (*this)->setAttr(getOrderValAttrName(), ::mlir::omp::ClauseOrderKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getOrderValAttrName()); +} + +void SimdLoopOp::setSimdlenAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getSimdlenAttrName(), attr); +} + +void SimdLoopOp::setSimdlen(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getSimdlenAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getSimdlenAttrName()); +} + +void SimdLoopOp::setSafelenAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getSafelenAttrName(), attr); +} + +void SimdLoopOp::setSafelen(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getSafelenAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getSafelenAttrName()); +} + +void SimdLoopOp::setInclusiveAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getInclusiveAttrName(), attr); +} + +void SimdLoopOp::setInclusive(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getInclusiveAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getInclusiveAttrName()); +} + +::mlir::Attribute SimdLoopOp::removeAlignmentValuesAttr() { + auto &attr = getProperties().alignment_values; + attr = {}; + return attr; +} + +::mlir::Attribute SimdLoopOp::removeOrderValAttr() { + auto &attr = getProperties().order_val; + attr = {}; + return attr; +} + +::mlir::Attribute SimdLoopOp::removeSimdlenAttr() { + auto &attr = getProperties().simdlen; + attr = {}; + return attr; +} + +::mlir::Attribute SimdLoopOp::removeSafelenAttr() { + auto &attr = getProperties().safelen; + attr = {}; + return attr; +} + +::mlir::Attribute SimdLoopOp::removeInclusiveAttr() { + auto &attr = getProperties().inclusive; + attr = {}; + return attr; +} + +void SimdLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange aligned_vars, /*optional*/::mlir::ArrayAttr alignment_values, /*optional*/::mlir::Value if_expr, ::mlir::ValueRange nontemporal_vars, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::IntegerAttr simdlen, /*optional*/::mlir::IntegerAttr safelen, /*optional*/::mlir::UnitAttr inclusive) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + odsState.addOperands(aligned_vars); + if (if_expr) + odsState.addOperands(if_expr); + odsState.addOperands(nontemporal_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), static_cast(aligned_vars.size()), (if_expr ? 1 : 0), static_cast(nontemporal_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (alignment_values) { + odsState.getOrAddProperties().alignment_values = alignment_values; + } + if (order_val) { + odsState.getOrAddProperties().order_val = order_val; + } + if (simdlen) { + odsState.getOrAddProperties().simdlen = simdlen; + } + if (safelen) { + odsState.getOrAddProperties().safelen = safelen; + } + if (inclusive) { + odsState.getOrAddProperties().inclusive = inclusive; + } + (void)odsState.addRegion(); +} + +void SimdLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange aligned_vars, /*optional*/::mlir::ArrayAttr alignment_values, /*optional*/::mlir::Value if_expr, ::mlir::ValueRange nontemporal_vars, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::IntegerAttr simdlen, /*optional*/::mlir::IntegerAttr safelen, /*optional*/::mlir::UnitAttr inclusive) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + odsState.addOperands(aligned_vars); + if (if_expr) + odsState.addOperands(if_expr); + odsState.addOperands(nontemporal_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), static_cast(aligned_vars.size()), (if_expr ? 1 : 0), static_cast(nontemporal_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (alignment_values) { + odsState.getOrAddProperties().alignment_values = alignment_values; + } + if (order_val) { + odsState.getOrAddProperties().order_val = order_val; + } + if (simdlen) { + odsState.getOrAddProperties().simdlen = simdlen; + } + if (safelen) { + odsState.getOrAddProperties().safelen = safelen; + } + if (inclusive) { + odsState.getOrAddProperties().inclusive = inclusive; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SimdLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange aligned_vars, /*optional*/::mlir::ArrayAttr alignment_values, /*optional*/::mlir::Value if_expr, ::mlir::ValueRange nontemporal_vars, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::IntegerAttr simdlen, /*optional*/::mlir::IntegerAttr safelen, /*optional*/bool inclusive) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + odsState.addOperands(aligned_vars); + if (if_expr) + odsState.addOperands(if_expr); + odsState.addOperands(nontemporal_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), static_cast(aligned_vars.size()), (if_expr ? 1 : 0), static_cast(nontemporal_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (alignment_values) { + odsState.getOrAddProperties().alignment_values = alignment_values; + } + if (order_val) { + odsState.getOrAddProperties().order_val = order_val; + } + if (simdlen) { + odsState.getOrAddProperties().simdlen = simdlen; + } + if (safelen) { + odsState.getOrAddProperties().safelen = safelen; + } + if (inclusive) { + odsState.getOrAddProperties().inclusive = ((inclusive) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); +} + +void SimdLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange aligned_vars, /*optional*/::mlir::ArrayAttr alignment_values, /*optional*/::mlir::Value if_expr, ::mlir::ValueRange nontemporal_vars, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::IntegerAttr simdlen, /*optional*/::mlir::IntegerAttr safelen, /*optional*/bool inclusive) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + odsState.addOperands(aligned_vars); + if (if_expr) + odsState.addOperands(if_expr); + odsState.addOperands(nontemporal_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), static_cast(aligned_vars.size()), (if_expr ? 1 : 0), static_cast(nontemporal_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (alignment_values) { + odsState.getOrAddProperties().alignment_values = alignment_values; + } + if (order_val) { + odsState.getOrAddProperties().order_val = order_val; + } + if (simdlen) { + odsState.getOrAddProperties().simdlen = simdlen; + } + if (safelen) { + odsState.getOrAddProperties().safelen = safelen; + } + if (inclusive) { + odsState.getOrAddProperties().inclusive = ((inclusive) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SimdLoopOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SimdLoopOp::verifyInvariantsImpl() { + auto tblgen_alignment_values = getProperties().alignment_values; (void)tblgen_alignment_values; + auto tblgen_inclusive = getProperties().inclusive; (void)tblgen_inclusive; + auto tblgen_order_val = getProperties().order_val; (void)tblgen_order_val; + auto tblgen_safelen = getProperties().safelen; (void)tblgen_safelen; + auto tblgen_simdlen = getProperties().simdlen; (void)tblgen_simdlen; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps14(*this, tblgen_alignment_values, "alignment_values"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps15(*this, tblgen_order_val, "order_val"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps16(*this, tblgen_simdlen, "simdlen"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps16(*this, tblgen_safelen, "safelen"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_inclusive, "inclusive"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + if (valueGroup4.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup4.size(); + } + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!(((this->getODSOperands(0).getType()) == (this->getODSOperands(1).getType()) && (this->getODSOperands(1).getType()) == (this->getODSOperands(2).getType()) && (this->getODSOperands(2).getType()) == (this->getODSOperands(0).getType())))) + return emitOpError("failed to verify that all of {lowerBound, upperBound, step} have same type"); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SimdLoopOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SimdLoopOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> aligned_varsOperands; + ::llvm::SMLoc aligned_varsOperandsLoc; + (void)aligned_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> aligned_varsTypes; + ::mlir::ArrayAttr alignment_valuesAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_exprOperands; + ::llvm::SMLoc if_exprOperandsLoc; + (void)if_exprOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> nontemporal_varsOperands; + ::llvm::SMLoc nontemporal_varsOperandsLoc; + (void)nontemporal_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> nontemporal_varsTypes; + ::mlir::omp::ClauseOrderKindAttr order_valAttr; + ::mlir::IntegerAttr simdlenAttr; + ::mlir::IntegerAttr safelenAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> lowerBoundOperands; + ::llvm::SMLoc lowerBoundOperandsLoc; + (void)lowerBoundOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> upperBoundOperands; + ::llvm::SMLoc upperBoundOperandsLoc; + (void)upperBoundOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> stepOperands; + ::llvm::SMLoc stepOperandsLoc; + (void)stepOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> stepTypes; + ::mlir::UnitAttr inclusiveAttr; + bool alignedClause = false; + bool ifClause = false; + bool nontemporalClause = false; + bool orderClause = false; + bool simdlenClause = false; + bool safelenClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("aligned"))) { + + if (alignedClause) { + return parser.emitError(parser.getNameLoc()) + << "`aligned` clause can appear at most once in the expansion of the " + "oilist directive"; + } + alignedClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + aligned_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAlignedClause(parser, aligned_varsOperands, aligned_varsTypes, alignment_valuesAttr); + if (odsResult) return ::mlir::failure(); + if (alignment_valuesAttr) + result.getOrAddProperties().alignment_values = alignment_valuesAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("nontemporal"))) { + + if (nontemporalClause) { + return parser.emitError(parser.getNameLoc()) + << "`nontemporal` clause can appear at most once in the expansion of the " + "oilist directive"; + } + nontemporalClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + nontemporal_varsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(nontemporal_varsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(nontemporal_varsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("order"))) { + + if (orderClause) { + return parser.emitError(parser.getNameLoc()) + << "`order` clause can appear at most once in the expansion of the " + "oilist directive"; + } + orderClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseClauseAttr(parser, order_valAttr); + if (odsResult) return ::mlir::failure(); + if (order_valAttr) + result.getOrAddProperties().order_val = order_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("simdlen"))) { + + if (simdlenClause) { + return parser.emitError(parser.getNameLoc()) + << "`simdlen` clause can appear at most once in the expansion of the " + "oilist directive"; + } + simdlenClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + ::mlir::OptionalParseResult parseResultsimdlenAttr = + parser.parseOptionalAttribute(simdlenAttr, parser.getBuilder().getIntegerType(64)); + if (parseResultsimdlenAttr.has_value() && failed(*parseResultsimdlenAttr)) + return ::mlir::failure(); + if (parseResultsimdlenAttr.has_value() && succeeded(*parseResultsimdlenAttr)) + if (simdlenAttr) result.getOrAddProperties().simdlen = simdlenAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("safelen"))) { + + if (safelenClause) { + return parser.emitError(parser.getNameLoc()) + << "`safelen` clause can appear at most once in the expansion of the " + "oilist directive"; + } + safelenClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + ::mlir::OptionalParseResult parseResultsafelenAttr = + parser.parseOptionalAttribute(safelenAttr, parser.getBuilder().getIntegerType(64)); + if (parseResultsafelenAttr.has_value() && failed(*parseResultsafelenAttr)) + return ::mlir::failure(); + if (parseResultsafelenAttr.has_value() && succeeded(*parseResultsafelenAttr)) + if (safelenAttr) result.getOrAddProperties().safelen = safelenAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseKeyword("for")) + return ::mlir::failure(); + { + lowerBoundOperandsLoc = parser.getCurrentLocation(); + upperBoundOperandsLoc = parser.getCurrentLocation(); + stepOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseLoopControl(parser, *regionRegion, lowerBoundOperands, upperBoundOperands, stepOperands, stepTypes, inclusiveAttr); + if (odsResult) return ::mlir::failure(); + if (inclusiveAttr) + result.getOrAddProperties().inclusive = inclusiveAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(lowerBoundOperands.size()), static_cast(upperBoundOperands.size()), static_cast(stepOperands.size()), static_cast(aligned_varsOperands.size()), static_cast(if_exprOperands.size()), static_cast(nontemporal_varsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(lowerBoundOperands, stepTypes, lowerBoundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(upperBoundOperands, stepTypes, upperBoundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(stepOperands, stepTypes, stepOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(aligned_varsOperands, aligned_varsTypes, aligned_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(if_exprOperands, odsBuildableType0, if_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(nontemporal_varsOperands, nontemporal_varsTypes, nontemporal_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SimdLoopOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getAlignedVars().size() || getAlignmentValuesAttr()) { + _odsPrinter << ' ' << "aligned"; + _odsPrinter << "("; + printAlignedClause(_odsPrinter, *this, getAlignedVars(), getAlignedVars().getTypes(), getAlignmentValuesAttr()); + _odsPrinter << ")"; + } + if (false || getIfExpr()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExpr()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getNontemporalVars().size()) { + _odsPrinter << ' ' << "nontemporal"; + _odsPrinter << "("; + _odsPrinter << getNontemporalVars(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getNontemporalVars().getTypes(); + _odsPrinter << ")"; + } + if (false || getOrderValAttr()) { + _odsPrinter << ' ' << "order"; + _odsPrinter << "("; + printClauseAttr(_odsPrinter, *this, getOrderValAttr()); + _odsPrinter << ")"; + } + if (false || getSimdlenAttr()) { + _odsPrinter << ' ' << "simdlen"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getSimdlenAttr()); + _odsPrinter << ")"; + } + if (false || getSafelenAttr()) { + _odsPrinter << ' ' << "safelen"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getSafelenAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "for"; + _odsPrinter << ' '; + printLoopControl(_odsPrinter, *this, getRegion(), getLowerBound(), getUpperBound(), getStep(), getStep().getTypes(), getInclusiveAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("alignment_values"); + elidedAttrs.push_back("order_val"); + elidedAttrs.push_back("simdlen"); + elidedAttrs.push_back("safelen"); + elidedAttrs.push_back("inclusive"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getInclusiveAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("inclusive"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::SimdLoopOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::SingleOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SingleOpGenericAdaptorBase::SingleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.single", odsAttrs.getContext()); +} + +SingleOpGenericAdaptorBase::SingleOpGenericAdaptorBase(SingleOp op) : SingleOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SingleOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr SingleOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr SingleOpGenericAdaptorBase::getNowaitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool SingleOpGenericAdaptorBase::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Region &SingleOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange SingleOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +SingleOpAdaptor::SingleOpAdaptor(SingleOp op) : SingleOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SingleOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + + if (tblgen_nowait && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nowait)))) + return emitError(loc, "'omp.single' op ""attribute 'nowait' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair SingleOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range SingleOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range SingleOp::getAllocateVars() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range SingleOp::getAllocatorsVars() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange SingleOp::getAllocateVarsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange SingleOp::getAllocatorsVarsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair SingleOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SingleOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &SingleOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult SingleOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.nowait; + auto attr = dict.get("nowait"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nowait in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nowait` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute SingleOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.nowait; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nowait", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SingleOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.nowait.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional SingleOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "nowait") + return prop.nowait; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void SingleOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "nowait") { + prop.nowait = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void SingleOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.nowait) attrs.append("nowait", prop.nowait); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult SingleOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNowaitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "nowait", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SingleOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.nowait))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void SingleOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.nowait); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr SingleOp::getNowaitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); +} + +bool SingleOp::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void SingleOp::setNowaitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNowaitAttrName(), attr); +} + +void SingleOp::setNowait(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNowaitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNowaitAttrName()); +} + +::mlir::Attribute SingleOp::removeNowaitAttr() { + auto &attr = getProperties().nowait; + attr = {}; + return attr; +} + +void SingleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::UnitAttr nowait) { + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + (void)odsState.addRegion(); +} + +void SingleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::UnitAttr nowait) { + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SingleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/bool nowait) { + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); +} + +void SingleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/bool nowait) { + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SingleOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SingleOp::verifyInvariantsImpl() { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_nowait, "nowait"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SingleOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SingleOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocate_varsOperands; + ::llvm::SMLoc allocate_varsOperandsLoc; + (void)allocate_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocate_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocators_varsOperands; + ::llvm::SMLoc allocators_varsOperandsLoc; + (void)allocators_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocators_varsTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool allocateClause = false; + bool nowaitClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("allocate"))) { + + if (allocateClause) { + return parser.emitError(parser.getNameLoc()) + << "`allocate` clause can appear at most once in the expansion of the " + "oilist directive"; + } + allocateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + allocate_varsOperandsLoc = parser.getCurrentLocation(); + allocators_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAllocateAndAllocator(parser, allocate_varsOperands, allocate_varsTypes, allocators_varsOperands, allocators_varsTypes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("nowait"))) { + + if (nowaitClause) { + return parser.emitError(parser.getNameLoc()) + << "`nowait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + nowaitClause = true; + result.getOrAddProperties().nowait = parser.getBuilder().getUnitAttr(); } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(allocate_varsOperands.size()), static_cast(allocators_varsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + if (parser.resolveOperands(allocate_varsOperands, allocate_varsTypes, allocate_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocators_varsOperands, allocators_varsTypes, allocators_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SingleOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getAllocateVars().size() || getAllocatorsVars().size()) { + _odsPrinter << ' ' << "allocate"; + _odsPrinter << "("; + printAllocateAndAllocator(_odsPrinter, *this, getAllocateVars(), getAllocateVars().getTypes(), getAllocatorsVars(), getAllocatorsVars().getTypes()); + _odsPrinter << ")"; + } + if (false || getNowaitAttr()) { + _odsPrinter << ' ' << "nowait"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("nowait"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNowaitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nowait"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::SingleOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TargetOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TargetOpGenericAdaptorBase::TargetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.target", odsAttrs.getContext()); +} + +TargetOpGenericAdaptorBase::TargetOpGenericAdaptorBase(TargetOp op) : TargetOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TargetOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr TargetOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr TargetOpGenericAdaptorBase::getNowaitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool TargetOpGenericAdaptorBase::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Region &TargetOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange TargetOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +TargetOpAdaptor::TargetOpAdaptor(TargetOp op) : TargetOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TargetOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + + if (tblgen_nowait && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nowait)))) + return emitError(loc, "'omp.target' op ""attribute 'nowait' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair TargetOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range TargetOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> TargetOp::getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> TargetOp::getDevice() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> TargetOp::getThreadLimit() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range TargetOp::getMapOperands() { + return getODSOperands(3); +} + +::mlir::MutableOperandRange TargetOp::getIfExprMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TargetOp::getDeviceMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TargetOp::getThreadLimitMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TargetOp::getMapOperandsMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair TargetOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TargetOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &TargetOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult TargetOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.nowait; + auto attr = dict.get("nowait"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nowait in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nowait` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute TargetOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.nowait; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nowait", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TargetOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.nowait.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional TargetOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "nowait") + return prop.nowait; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void TargetOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "nowait") { + prop.nowait = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void TargetOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.nowait) attrs.append("nowait", prop.nowait); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult TargetOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNowaitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "nowait", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TargetOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.nowait))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TargetOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.nowait); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr TargetOp::getNowaitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); +} + +bool TargetOp::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void TargetOp::setNowaitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNowaitAttrName(), attr); +} + +void TargetOp::setNowait(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNowaitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNowaitAttrName()); +} + +::mlir::Attribute TargetOp::removeNowaitAttr() { + auto &attr = getProperties().nowait; + attr = {}; + return attr; +} + +void TargetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::Value thread_limit, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + if (thread_limit) + odsState.addOperands(thread_limit); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), (thread_limit ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + (void)odsState.addRegion(); +} + +void TargetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::Value thread_limit, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + if (thread_limit) + odsState.addOperands(thread_limit); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), (thread_limit ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TargetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::Value thread_limit, /*optional*/bool nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + if (thread_limit) + odsState.addOperands(thread_limit); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), (thread_limit ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); +} + +void TargetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::Value thread_limit, /*optional*/bool nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + if (thread_limit) + odsState.addOperands(thread_limit); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), (thread_limit ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TargetOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TargetOp::verifyInvariantsImpl() { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_nowait, "nowait"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TargetOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TargetOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_exprOperands; + ::llvm::SMLoc if_exprOperandsLoc; + (void)if_exprOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceOperands; + ::llvm::SMLoc deviceOperandsLoc; + (void)deviceOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> thread_limitOperands; + ::llvm::SMLoc thread_limitOperandsLoc; + (void)thread_limitOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> thread_limitTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> map_operandsOperands; + ::llvm::SMLoc map_operandsOperandsLoc; + (void)map_operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> map_operandsTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool ifClause = false; + bool deviceClause = false; + bool thread_limitClause = false; + bool nowaitClause = false; + bool map_entriesClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("device"))) { + + if (deviceClause) { + return parser.emitError(parser.getNameLoc()) + << "`device` clause can appear at most once in the expansion of the " + "oilist directive"; + } + deviceClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + deviceOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("thread_limit"))) { + + if (thread_limitClause) { + return parser.emitError(parser.getNameLoc()) + << "`thread_limit` clause can appear at most once in the expansion of the " + "oilist directive"; + } + thread_limitClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + thread_limitOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + thread_limitOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + thread_limitTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("nowait"))) { + + if (nowaitClause) { + return parser.emitError(parser.getNameLoc()) + << "`nowait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + nowaitClause = true; + result.getOrAddProperties().nowait = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("map_entries"))) { + + if (map_entriesClause) { + return parser.emitError(parser.getNameLoc()) + << "`map_entries` clause can appear at most once in the expansion of the " + "oilist directive"; + } + map_entriesClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + map_operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(map_operandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(map_operandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(if_exprOperands.size()), static_cast(deviceOperands.size()), static_cast(thread_limitOperands.size()), static_cast(map_operandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(if_exprOperands, odsBuildableType0, if_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(deviceOperands, deviceTypes, deviceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(thread_limitOperands, thread_limitTypes, thread_limitOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(map_operandsOperands, map_operandsTypes, map_operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TargetOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfExpr()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExpr()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getDevice()) { + _odsPrinter << ' ' << "device"; + _odsPrinter << "("; + if (::mlir::Value value = getDevice()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getDevice() ? ::llvm::ArrayRef<::mlir::Type>(getDevice().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getThreadLimit()) { + _odsPrinter << ' ' << "thread_limit"; + _odsPrinter << "("; + if (::mlir::Value value = getThreadLimit()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getThreadLimit() ? ::llvm::ArrayRef<::mlir::Type>(getThreadLimit().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getNowaitAttr()) { + _odsPrinter << ' ' << "nowait"; + } + if (false || getMapOperands().size()) { + _odsPrinter << ' ' << "map_entries"; + _odsPrinter << "("; + _odsPrinter << getMapOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getMapOperands().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("nowait"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNowaitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nowait"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::TargetOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::DataOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DataOpGenericAdaptorBase::DataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.target_data", odsAttrs.getContext()); +} + +DataOpGenericAdaptorBase::DataOpGenericAdaptorBase(DataOp op) : DataOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DataOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr DataOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &DataOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange DataOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +DataOpAdaptor::DataOpAdaptor(DataOp op) : DataOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DataOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DataOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range DataOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> DataOp::getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> DataOp::getDevice() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range DataOp::getUseDevicePtr() { + return getODSOperands(2); +} + +::mlir::Operation::operand_range DataOp::getUseDeviceAddr() { + return getODSOperands(3); +} + +::mlir::Operation::operand_range DataOp::getMapOperands() { + return getODSOperands(4); +} + +::mlir::MutableOperandRange DataOp::getIfExprMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataOp::getDeviceMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataOp::getUseDevicePtrMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataOp::getUseDeviceAddrMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange DataOp::getMapOperandsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair DataOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DataOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &DataOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult DataOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute DataOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code DataOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional DataOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void DataOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void DataOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult DataOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult DataOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void DataOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void DataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, ::mlir::ValueRange use_device_ptr, ::mlir::ValueRange use_device_addr, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(use_device_ptr); + odsState.addOperands(use_device_addr); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(use_device_ptr.size()), static_cast(use_device_addr.size()), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + (void)odsState.addRegion(); +} + +void DataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, ::mlir::ValueRange use_device_ptr, ::mlir::ValueRange use_device_addr, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(use_device_ptr); + odsState.addOperands(use_device_addr); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(use_device_ptr.size()), static_cast(use_device_addr.size()), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DataOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult DataOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult DataOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_exprOperands; + ::llvm::SMLoc if_exprOperandsLoc; + (void)if_exprOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> if_exprTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceOperands; + ::llvm::SMLoc deviceOperandsLoc; + (void)deviceOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> map_operandsOperands; + ::llvm::SMLoc map_operandsOperandsLoc; + (void)map_operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> map_operandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> use_device_ptrOperands; + ::llvm::SMLoc use_device_ptrOperandsLoc; + (void)use_device_ptrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> use_device_ptrTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> use_device_addrOperands; + ::llvm::SMLoc use_device_addrOperandsLoc; + (void)use_device_addrOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> use_device_addrTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool ifClause = false; + bool deviceClause = false; + bool map_entriesClause = false; + bool use_device_ptrClause = false; + bool use_device_addrClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("device"))) { + + if (deviceClause) { + return parser.emitError(parser.getNameLoc()) + << "`device` clause can appear at most once in the expansion of the " + "oilist directive"; + } + deviceClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + deviceOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("map_entries"))) { + + if (map_entriesClause) { + return parser.emitError(parser.getNameLoc()) + << "`map_entries` clause can appear at most once in the expansion of the " + "oilist directive"; + } + map_entriesClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + map_operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(map_operandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(map_operandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("use_device_ptr"))) { + + if (use_device_ptrClause) { + return parser.emitError(parser.getNameLoc()) + << "`use_device_ptr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + use_device_ptrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + use_device_ptrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(use_device_ptrOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(use_device_ptrTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("use_device_addr"))) { + + if (use_device_addrClause) { + return parser.emitError(parser.getNameLoc()) + << "`use_device_addr` clause can appear at most once in the expansion of the " + "oilist directive"; + } + use_device_addrClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + use_device_addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(use_device_addrOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(use_device_addrTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(if_exprOperands.size()), static_cast(deviceOperands.size()), static_cast(use_device_ptrOperands.size()), static_cast(use_device_addrOperands.size()), static_cast(map_operandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + if (parser.resolveOperands(if_exprOperands, if_exprTypes, if_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(deviceOperands, deviceTypes, deviceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(use_device_ptrOperands, use_device_ptrTypes, use_device_ptrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(use_device_addrOperands, use_device_addrTypes, use_device_addrOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(map_operandsOperands, map_operandsTypes, map_operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void DataOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfExpr()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExpr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getIfExpr() ? ::llvm::ArrayRef<::mlir::Type>(getIfExpr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getDevice()) { + _odsPrinter << ' ' << "device"; + _odsPrinter << "("; + if (::mlir::Value value = getDevice()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getDevice() ? ::llvm::ArrayRef<::mlir::Type>(getDevice().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getMapOperands().size()) { + _odsPrinter << ' ' << "map_entries"; + _odsPrinter << "("; + _odsPrinter << getMapOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getMapOperands().getTypes(); + _odsPrinter << ")"; + } + if (false || getUseDevicePtr().size()) { + _odsPrinter << ' ' << "use_device_ptr"; + _odsPrinter << "("; + _odsPrinter << getUseDevicePtr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getUseDevicePtr().getTypes(); + _odsPrinter << ")"; + } + if (false || getUseDeviceAddr().size()) { + _odsPrinter << ' ' << "use_device_addr"; + _odsPrinter << "("; + _odsPrinter << getUseDeviceAddr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getUseDeviceAddr().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::DataOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::EnterDataOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +EnterDataOpGenericAdaptorBase::EnterDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.target_enter_data", odsAttrs.getContext()); +} + +EnterDataOpGenericAdaptorBase::EnterDataOpGenericAdaptorBase(EnterDataOp op) : EnterDataOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair EnterDataOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr EnterDataOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr EnterDataOpGenericAdaptorBase::getNowaitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool EnterDataOpGenericAdaptorBase::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +EnterDataOpAdaptor::EnterDataOpAdaptor(EnterDataOp op) : EnterDataOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult EnterDataOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + + if (tblgen_nowait && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nowait)))) + return emitError(loc, "'omp.target_enter_data' op ""attribute 'nowait' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair EnterDataOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range EnterDataOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> EnterDataOp::getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> EnterDataOp::getDevice() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range EnterDataOp::getMapOperands() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange EnterDataOp::getIfExprMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange EnterDataOp::getDeviceMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange EnterDataOp::getMapOperandsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair EnterDataOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range EnterDataOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult EnterDataOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.nowait; + auto attr = dict.get("nowait"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nowait in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nowait` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute EnterDataOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.nowait; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nowait", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code EnterDataOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.nowait.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional EnterDataOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "nowait") + return prop.nowait; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void EnterDataOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "nowait") { + prop.nowait = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void EnterDataOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.nowait) attrs.append("nowait", prop.nowait); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult EnterDataOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNowaitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "nowait", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult EnterDataOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.nowait))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void EnterDataOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.nowait); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr EnterDataOp::getNowaitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); +} + +bool EnterDataOp::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void EnterDataOp::setNowaitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNowaitAttrName(), attr); +} + +void EnterDataOp::setNowait(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNowaitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNowaitAttrName()); +} + +::mlir::Attribute EnterDataOp::removeNowaitAttr() { + auto &attr = getProperties().nowait; + attr = {}; + return attr; +} + +void EnterDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } +} + +void EnterDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void EnterDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/bool nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } +} + +void EnterDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/bool nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void EnterDataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult EnterDataOp::verifyInvariantsImpl() { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_nowait, "nowait"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult EnterDataOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult EnterDataOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_exprOperands; + ::llvm::SMLoc if_exprOperandsLoc; + (void)if_exprOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> if_exprTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceOperands; + ::llvm::SMLoc deviceOperandsLoc; + (void)deviceOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> map_operandsOperands; + ::llvm::SMLoc map_operandsOperandsLoc; + (void)map_operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> map_operandsTypes; + bool ifClause = false; + bool deviceClause = false; + bool nowaitClause = false; + bool map_entriesClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("device"))) { + + if (deviceClause) { + return parser.emitError(parser.getNameLoc()) + << "`device` clause can appear at most once in the expansion of the " + "oilist directive"; + } + deviceClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + deviceOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("nowait"))) { + + if (nowaitClause) { + return parser.emitError(parser.getNameLoc()) + << "`nowait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + nowaitClause = true; + result.getOrAddProperties().nowait = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("map_entries"))) { + + if (map_entriesClause) { + return parser.emitError(parser.getNameLoc()) + << "`map_entries` clause can appear at most once in the expansion of the " + "oilist directive"; + } + map_entriesClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + map_operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(map_operandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(map_operandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(if_exprOperands.size()), static_cast(deviceOperands.size()), static_cast(map_operandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + if (parser.resolveOperands(if_exprOperands, if_exprTypes, if_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(deviceOperands, deviceTypes, deviceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(map_operandsOperands, map_operandsTypes, map_operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void EnterDataOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfExpr()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExpr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getIfExpr() ? ::llvm::ArrayRef<::mlir::Type>(getIfExpr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getDevice()) { + _odsPrinter << ' ' << "device"; + _odsPrinter << "("; + if (::mlir::Value value = getDevice()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getDevice() ? ::llvm::ArrayRef<::mlir::Type>(getDevice().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getNowaitAttr()) { + _odsPrinter << ' ' << "nowait"; + } + if (false || getMapOperands().size()) { + _odsPrinter << ' ' << "map_entries"; + _odsPrinter << "("; + _odsPrinter << getMapOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getMapOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("nowait"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNowaitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nowait"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::EnterDataOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ExitDataOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExitDataOpGenericAdaptorBase::ExitDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.target_exit_data", odsAttrs.getContext()); +} + +ExitDataOpGenericAdaptorBase::ExitDataOpGenericAdaptorBase(ExitDataOp op) : ExitDataOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExitDataOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ExitDataOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr ExitDataOpGenericAdaptorBase::getNowaitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool ExitDataOpGenericAdaptorBase::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +ExitDataOpAdaptor::ExitDataOpAdaptor(ExitDataOp op) : ExitDataOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExitDataOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + + if (tblgen_nowait && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nowait)))) + return emitError(loc, "'omp.target_exit_data' op ""attribute 'nowait' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair ExitDataOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ExitDataOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> ExitDataOp::getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> ExitDataOp::getDevice() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range ExitDataOp::getMapOperands() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange ExitDataOp::getIfExprMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ExitDataOp::getDeviceMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ExitDataOp::getMapOperandsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ExitDataOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExitDataOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult ExitDataOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.nowait; + auto attr = dict.get("nowait"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nowait in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nowait` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ExitDataOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.nowait; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nowait", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExitDataOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.nowait.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ExitDataOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "nowait") + return prop.nowait; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ExitDataOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "nowait") { + prop.nowait = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ExitDataOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.nowait) attrs.append("nowait", prop.nowait); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ExitDataOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNowaitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "nowait", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExitDataOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.nowait))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ExitDataOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.nowait); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr ExitDataOp::getNowaitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); +} + +bool ExitDataOp::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void ExitDataOp::setNowaitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNowaitAttrName(), attr); +} + +void ExitDataOp::setNowait(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNowaitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNowaitAttrName()); +} + +::mlir::Attribute ExitDataOp::removeNowaitAttr() { + auto &attr = getProperties().nowait; + attr = {}; + return attr; +} + +void ExitDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } +} + +void ExitDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExitDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/bool nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } +} + +void ExitDataOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/bool nowait, ::mlir::ValueRange map_operands) { + if (if_expr) + odsState.addOperands(if_expr); + if (device) + odsState.addOperands(device); + odsState.addOperands(map_operands); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (device ? 1 : 0), static_cast(map_operands.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExitDataOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ExitDataOp::verifyInvariantsImpl() { + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_nowait, "nowait"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExitDataOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ExitDataOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_exprOperands; + ::llvm::SMLoc if_exprOperandsLoc; + (void)if_exprOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> if_exprTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> deviceOperands; + ::llvm::SMLoc deviceOperandsLoc; + (void)deviceOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> deviceTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> map_operandsOperands; + ::llvm::SMLoc map_operandsOperandsLoc; + (void)map_operandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> map_operandsTypes; + bool ifClause = false; + bool deviceClause = false; + bool nowaitClause = false; + bool map_entriesClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("device"))) { + + if (deviceClause) { + return parser.emitError(parser.getNameLoc()) + << "`device` clause can appear at most once in the expansion of the " + "oilist directive"; + } + deviceClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + deviceOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + deviceTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("nowait"))) { + + if (nowaitClause) { + return parser.emitError(parser.getNameLoc()) + << "`nowait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + nowaitClause = true; + result.getOrAddProperties().nowait = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("map_entries"))) { + + if (map_entriesClause) { + return parser.emitError(parser.getNameLoc()) + << "`map_entries` clause can appear at most once in the expansion of the " + "oilist directive"; + } + map_entriesClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + map_operandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(map_operandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(map_operandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(if_exprOperands.size()), static_cast(deviceOperands.size()), static_cast(map_operandsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + if (parser.resolveOperands(if_exprOperands, if_exprTypes, if_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(deviceOperands, deviceTypes, deviceOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(map_operandsOperands, map_operandsTypes, map_operandsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExitDataOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfExpr()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExpr()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getIfExpr() ? ::llvm::ArrayRef<::mlir::Type>(getIfExpr().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getDevice()) { + _odsPrinter << ' ' << "device"; + _odsPrinter << "("; + if (::mlir::Value value = getDevice()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getDevice() ? ::llvm::ArrayRef<::mlir::Type>(getDevice().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getNowaitAttr()) { + _odsPrinter << ' ' << "nowait"; + } + if (false || getMapOperands().size()) { + _odsPrinter << ' ' << "map_entries"; + _odsPrinter << "("; + _odsPrinter << getMapOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getMapOperands().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("nowait"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNowaitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nowait"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ExitDataOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskGroupOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TaskGroupOpGenericAdaptorBase::TaskGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.taskgroup", odsAttrs.getContext()); +} + +TaskGroupOpGenericAdaptorBase::TaskGroupOpGenericAdaptorBase(TaskGroupOp op) : TaskGroupOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TaskGroupOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr TaskGroupOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr TaskGroupOpGenericAdaptorBase::getTaskReductionsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().task_reductions); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > TaskGroupOpGenericAdaptorBase::getTaskReductions() { + auto attr = getTaskReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::Region &TaskGroupOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange TaskGroupOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +TaskGroupOpAdaptor::TaskGroupOpAdaptor(TaskGroupOp op) : TaskGroupOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TaskGroupOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_task_reductions = getProperties().task_reductions; (void)tblgen_task_reductions; + + if (tblgen_task_reductions && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_task_reductions))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_task_reductions), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'omp.taskgroup' op ""attribute 'task_reductions' failed to satisfy constraint: symbol ref array attribute"); + return ::mlir::success(); +} + +std::pair TaskGroupOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range TaskGroupOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range TaskGroupOp::getTaskReductionVars() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range TaskGroupOp::getAllocateVars() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range TaskGroupOp::getAllocatorsVars() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange TaskGroupOp::getTaskReductionVarsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskGroupOp::getAllocateVarsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskGroupOp::getAllocatorsVarsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair TaskGroupOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TaskGroupOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &TaskGroupOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult TaskGroupOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.task_reductions; + auto attr = dict.get("task_reductions"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for task_reductions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `task_reductions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute TaskGroupOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.task_reductions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("task_reductions", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TaskGroupOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.task_reductions.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional TaskGroupOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "task_reductions") + return prop.task_reductions; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void TaskGroupOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "task_reductions") { + prop.task_reductions = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void TaskGroupOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.task_reductions) attrs.append("task_reductions", prop.task_reductions); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult TaskGroupOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getTaskReductionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(attr, "task_reductions", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TaskGroupOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.task_reductions))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TaskGroupOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.task_reductions); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::ArrayAttr TaskGroupOp::getTaskReductionsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().task_reductions); +} + +::std::optional< ::mlir::ArrayAttr > TaskGroupOp::getTaskReductions() { + auto attr = getTaskReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void TaskGroupOp::setTaskReductionsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTaskReductionsAttrName(), attr); +} + +::mlir::Attribute TaskGroupOp::removeTaskReductionsAttr() { + auto &attr = getProperties().task_reductions; + attr = {}; + return attr; +} + +void TaskGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange task_reduction_vars, /*optional*/::mlir::ArrayAttr task_reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars) { + odsState.addOperands(task_reduction_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(task_reduction_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (task_reductions) { + odsState.getOrAddProperties().task_reductions = task_reductions; + } + (void)odsState.addRegion(); +} + +void TaskGroupOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange task_reduction_vars, /*optional*/::mlir::ArrayAttr task_reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars) { + odsState.addOperands(task_reduction_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({static_cast(task_reduction_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (task_reductions) { + odsState.getOrAddProperties().task_reductions = task_reductions; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TaskGroupOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TaskGroupOp::verifyInvariantsImpl() { + auto tblgen_task_reductions = getProperties().task_reductions; (void)tblgen_task_reductions; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(*this, tblgen_task_reductions, "task_reductions"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TaskGroupOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TaskGroupOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> task_reduction_varsOperands; + ::llvm::SMLoc task_reduction_varsOperandsLoc; + (void)task_reduction_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> task_reduction_varsTypes; + ::mlir::ArrayAttr task_reductionsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocate_varsOperands; + ::llvm::SMLoc allocate_varsOperandsLoc; + (void)allocate_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocate_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocators_varsOperands; + ::llvm::SMLoc allocators_varsOperandsLoc; + (void)allocators_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocators_varsTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool task_reductionClause = false; + bool allocateClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("task_reduction"))) { + + if (task_reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`task_reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + task_reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + task_reduction_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseReductionVarList(parser, task_reduction_varsOperands, task_reduction_varsTypes, task_reductionsAttr); + if (odsResult) return ::mlir::failure(); + if (task_reductionsAttr) + result.getOrAddProperties().task_reductions = task_reductionsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("allocate"))) { + + if (allocateClause) { + return parser.emitError(parser.getNameLoc()) + << "`allocate` clause can appear at most once in the expansion of the " + "oilist directive"; + } + allocateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + allocate_varsOperandsLoc = parser.getCurrentLocation(); + allocators_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAllocateAndAllocator(parser, allocate_varsOperands, allocate_varsTypes, allocators_varsOperands, allocators_varsTypes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(task_reduction_varsOperands.size()), static_cast(allocate_varsOperands.size()), static_cast(allocators_varsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + if (parser.resolveOperands(task_reduction_varsOperands, task_reduction_varsTypes, task_reduction_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocate_varsOperands, allocate_varsTypes, allocate_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocators_varsOperands, allocators_varsTypes, allocators_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TaskGroupOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getTaskReductionVars().size() || getTaskReductionsAttr()) { + _odsPrinter << ' ' << "task_reduction"; + _odsPrinter << "("; + printReductionVarList(_odsPrinter, *this, getTaskReductionVars(), getTaskReductionVars().getTypes(), getTaskReductionsAttr()); + _odsPrinter << ")"; + } + if (false || getAllocateVars().size() || getAllocatorsVars().size()) { + _odsPrinter << ' ' << "allocate"; + _odsPrinter << "("; + printAllocateAndAllocator(_odsPrinter, *this, getAllocateVars(), getAllocateVars().getTypes(), getAllocatorsVars(), getAllocatorsVars().getTypes()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("task_reductions"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::TaskGroupOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskLoopOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TaskLoopOpGenericAdaptorBase::TaskLoopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.taskloop", odsAttrs.getContext()); +} + +TaskLoopOpGenericAdaptorBase::TaskLoopOpGenericAdaptorBase(TaskLoopOp op) : TaskLoopOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TaskLoopOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr TaskLoopOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr TaskLoopOpGenericAdaptorBase::getInclusiveAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inclusive); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool TaskLoopOpGenericAdaptorBase::getInclusive() { + auto attr = getInclusiveAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr TaskLoopOpGenericAdaptorBase::getUntiedAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().untied); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool TaskLoopOpGenericAdaptorBase::getUntied() { + auto attr = getUntiedAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr TaskLoopOpGenericAdaptorBase::getMergeableAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().mergeable); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool TaskLoopOpGenericAdaptorBase::getMergeable() { + auto attr = getMergeableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr TaskLoopOpGenericAdaptorBase::getInReductionsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().in_reductions); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > TaskLoopOpGenericAdaptorBase::getInReductions() { + auto attr = getInReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr TaskLoopOpGenericAdaptorBase::getReductionsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > TaskLoopOpGenericAdaptorBase::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::UnitAttr TaskLoopOpGenericAdaptorBase::getNogroupAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nogroup); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool TaskLoopOpGenericAdaptorBase::getNogroup() { + auto attr = getNogroupAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Region &TaskLoopOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange TaskLoopOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +TaskLoopOpAdaptor::TaskLoopOpAdaptor(TaskLoopOp op) : TaskLoopOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TaskLoopOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_in_reductions = getProperties().in_reductions; (void)tblgen_in_reductions; + auto tblgen_inclusive = getProperties().inclusive; (void)tblgen_inclusive; + auto tblgen_mergeable = getProperties().mergeable; (void)tblgen_mergeable; + auto tblgen_nogroup = getProperties().nogroup; (void)tblgen_nogroup; + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + auto tblgen_untied = getProperties().untied; (void)tblgen_untied; + + if (tblgen_inclusive && !((::llvm::isa<::mlir::UnitAttr>(tblgen_inclusive)))) + return emitError(loc, "'omp.taskloop' op ""attribute 'inclusive' failed to satisfy constraint: unit attribute"); + + if (tblgen_untied && !((::llvm::isa<::mlir::UnitAttr>(tblgen_untied)))) + return emitError(loc, "'omp.taskloop' op ""attribute 'untied' failed to satisfy constraint: unit attribute"); + + if (tblgen_mergeable && !((::llvm::isa<::mlir::UnitAttr>(tblgen_mergeable)))) + return emitError(loc, "'omp.taskloop' op ""attribute 'mergeable' failed to satisfy constraint: unit attribute"); + + if (tblgen_in_reductions && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_in_reductions))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_in_reductions), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'omp.taskloop' op ""attribute 'in_reductions' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_reductions && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reductions))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reductions), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'omp.taskloop' op ""attribute 'reductions' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_nogroup && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nogroup)))) + return emitError(loc, "'omp.taskloop' op ""attribute 'nogroup' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair TaskLoopOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range TaskLoopOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range TaskLoopOp::getLowerBound() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range TaskLoopOp::getUpperBound() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range TaskLoopOp::getStep() { + return getODSOperands(2); +} + +::mlir::TypedValue<::mlir::IntegerType> TaskLoopOp::getIfExpr() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> TaskLoopOp::getFinalExpr() { + auto operands = getODSOperands(4); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range TaskLoopOp::getInReductionVars() { + return getODSOperands(5); +} + +::mlir::Operation::operand_range TaskLoopOp::getReductionVars() { + return getODSOperands(6); +} + +::mlir::Value TaskLoopOp::getPriority() { + auto operands = getODSOperands(7); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range TaskLoopOp::getAllocateVars() { + return getODSOperands(8); +} + +::mlir::Operation::operand_range TaskLoopOp::getAllocatorsVars() { + return getODSOperands(9); +} + +::mlir::Value TaskLoopOp::getGrainSize() { + auto operands = getODSOperands(10); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Value TaskLoopOp::getNumTasks() { + auto operands = getODSOperands(11); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::MutableOperandRange TaskLoopOp::getLowerBoundMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getUpperBoundMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getStepMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getIfExprMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getFinalExprMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getInReductionVarsMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getReductionVarsMutable() { + auto range = getODSOperandIndexAndLength(6); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getPriorityMutable() { + auto range = getODSOperandIndexAndLength(7); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(7u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getAllocateVarsMutable() { + auto range = getODSOperandIndexAndLength(8); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(8u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getAllocatorsVarsMutable() { + auto range = getODSOperandIndexAndLength(9); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(9u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getGrainSizeMutable() { + auto range = getODSOperandIndexAndLength(10); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(10u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskLoopOp::getNumTasksMutable() { + auto range = getODSOperandIndexAndLength(11); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(11u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair TaskLoopOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TaskLoopOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &TaskLoopOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult TaskLoopOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.in_reductions; + auto attr = dict.get("in_reductions"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for in_reductions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `in_reductions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.inclusive; + auto attr = dict.get("inclusive"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for inclusive in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `inclusive` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.mergeable; + auto attr = dict.get("mergeable"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for mergeable in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `mergeable` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.nogroup; + auto attr = dict.get("nogroup"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nogroup in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nogroup` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.reductions; + auto attr = dict.get("reductions"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for reductions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.untied; + auto attr = dict.get("untied"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for untied in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `untied` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute TaskLoopOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.in_reductions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("in_reductions", + propStorage)); + } + + { + const auto &propStorage = prop.inclusive; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("inclusive", + propStorage)); + } + + { + const auto &propStorage = prop.mergeable; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("mergeable", + propStorage)); + } + + { + const auto &propStorage = prop.nogroup; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nogroup", + propStorage)); + } + + { + const auto &propStorage = prop.reductions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductions", + propStorage)); + } + + { + const auto &propStorage = prop.untied; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("untied", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TaskLoopOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.in_reductions.getAsOpaquePointer()), + llvm::hash_value(prop.inclusive.getAsOpaquePointer()), + llvm::hash_value(prop.mergeable.getAsOpaquePointer()), + llvm::hash_value(prop.nogroup.getAsOpaquePointer()), + llvm::hash_value(prop.reductions.getAsOpaquePointer()), + llvm::hash_value(prop.untied.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional TaskLoopOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "in_reductions") + return prop.in_reductions; + + if (name == "inclusive") + return prop.inclusive; + + if (name == "mergeable") + return prop.mergeable; + + if (name == "nogroup") + return prop.nogroup; + + if (name == "reductions") + return prop.reductions; + + if (name == "untied") + return prop.untied; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void TaskLoopOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "in_reductions") { + prop.in_reductions = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "inclusive") { + prop.inclusive = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "mergeable") { + prop.mergeable = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "nogroup") { + prop.nogroup = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "reductions") { + prop.reductions = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "untied") { + prop.untied = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void TaskLoopOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.in_reductions) attrs.append("in_reductions", prop.in_reductions); + + if (prop.inclusive) attrs.append("inclusive", prop.inclusive); + + if (prop.mergeable) attrs.append("mergeable", prop.mergeable); + + if (prop.nogroup) attrs.append("nogroup", prop.nogroup); + + if (prop.reductions) attrs.append("reductions", prop.reductions); + + if (prop.untied) attrs.append("untied", prop.untied); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult TaskLoopOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getInReductionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(attr, "in_reductions", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getInclusiveAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "inclusive", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMergeableAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "mergeable", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNogroupAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "nogroup", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReductionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(attr, "reductions", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUntiedAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "untied", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TaskLoopOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.in_reductions))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.inclusive))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.mergeable))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.nogroup))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.reductions))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.untied))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TaskLoopOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.in_reductions); + + writer.writeOptionalAttribute(prop.inclusive); + + writer.writeOptionalAttribute(prop.mergeable); + + writer.writeOptionalAttribute(prop.nogroup); + + writer.writeOptionalAttribute(prop.reductions); + + writer.writeOptionalAttribute(prop.untied); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr TaskLoopOp::getInclusiveAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inclusive); +} + +bool TaskLoopOp::getInclusive() { + auto attr = getInclusiveAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr TaskLoopOp::getUntiedAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().untied); +} + +bool TaskLoopOp::getUntied() { + auto attr = getUntiedAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr TaskLoopOp::getMergeableAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().mergeable); +} + +bool TaskLoopOp::getMergeable() { + auto attr = getMergeableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr TaskLoopOp::getInReductionsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().in_reductions); +} + +::std::optional< ::mlir::ArrayAttr > TaskLoopOp::getInReductions() { + auto attr = getInReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr TaskLoopOp::getReductionsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); +} + +::std::optional< ::mlir::ArrayAttr > TaskLoopOp::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::UnitAttr TaskLoopOp::getNogroupAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nogroup); +} + +bool TaskLoopOp::getNogroup() { + auto attr = getNogroupAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void TaskLoopOp::setInclusiveAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getInclusiveAttrName(), attr); +} + +void TaskLoopOp::setInclusive(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getInclusiveAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getInclusiveAttrName()); +} + +void TaskLoopOp::setUntiedAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getUntiedAttrName(), attr); +} + +void TaskLoopOp::setUntied(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getUntiedAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getUntiedAttrName()); +} + +void TaskLoopOp::setMergeableAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getMergeableAttrName(), attr); +} + +void TaskLoopOp::setMergeable(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getMergeableAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getMergeableAttrName()); +} + +void TaskLoopOp::setInReductionsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getInReductionsAttrName(), attr); +} + +void TaskLoopOp::setReductionsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReductionsAttrName(), attr); +} + +void TaskLoopOp::setNogroupAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNogroupAttrName(), attr); +} + +void TaskLoopOp::setNogroup(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNogroupAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNogroupAttrName()); +} + +::mlir::Attribute TaskLoopOp::removeInclusiveAttr() { + auto &attr = getProperties().inclusive; + attr = {}; + return attr; +} + +::mlir::Attribute TaskLoopOp::removeUntiedAttr() { + auto &attr = getProperties().untied; + attr = {}; + return attr; +} + +::mlir::Attribute TaskLoopOp::removeMergeableAttr() { + auto &attr = getProperties().mergeable; + attr = {}; + return attr; +} + +::mlir::Attribute TaskLoopOp::removeInReductionsAttr() { + auto &attr = getProperties().in_reductions; + attr = {}; + return attr; +} + +::mlir::Attribute TaskLoopOp::removeReductionsAttr() { + auto &attr = getProperties().reductions; + attr = {}; + return attr; +} + +::mlir::Attribute TaskLoopOp::removeNogroupAttr() { + auto &attr = getProperties().nogroup; + attr = {}; + return attr; +} + +void TaskLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, /*optional*/::mlir::UnitAttr inclusive, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/::mlir::UnitAttr untied, /*optional*/::mlir::UnitAttr mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::Value priority, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::Value grain_size, /*optional*/::mlir::Value num_tasks, /*optional*/::mlir::UnitAttr nogroup) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + if (if_expr) + odsState.addOperands(if_expr); + if (final_expr) + odsState.addOperands(final_expr); + odsState.addOperands(in_reduction_vars); + odsState.addOperands(reduction_vars); + if (priority) + odsState.addOperands(priority); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + if (grain_size) + odsState.addOperands(grain_size); + if (num_tasks) + odsState.addOperands(num_tasks); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), (if_expr ? 1 : 0), (final_expr ? 1 : 0), static_cast(in_reduction_vars.size()), static_cast(reduction_vars.size()), (priority ? 1 : 0), static_cast(allocate_vars.size()), static_cast(allocators_vars.size()), (grain_size ? 1 : 0), (num_tasks ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (inclusive) { + odsState.getOrAddProperties().inclusive = inclusive; + } + if (untied) { + odsState.getOrAddProperties().untied = untied; + } + if (mergeable) { + odsState.getOrAddProperties().mergeable = mergeable; + } + if (in_reductions) { + odsState.getOrAddProperties().in_reductions = in_reductions; + } + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (nogroup) { + odsState.getOrAddProperties().nogroup = nogroup; + } + (void)odsState.addRegion(); +} + +void TaskLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, /*optional*/::mlir::UnitAttr inclusive, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/::mlir::UnitAttr untied, /*optional*/::mlir::UnitAttr mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::Value priority, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::Value grain_size, /*optional*/::mlir::Value num_tasks, /*optional*/::mlir::UnitAttr nogroup) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + if (if_expr) + odsState.addOperands(if_expr); + if (final_expr) + odsState.addOperands(final_expr); + odsState.addOperands(in_reduction_vars); + odsState.addOperands(reduction_vars); + if (priority) + odsState.addOperands(priority); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + if (grain_size) + odsState.addOperands(grain_size); + if (num_tasks) + odsState.addOperands(num_tasks); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), (if_expr ? 1 : 0), (final_expr ? 1 : 0), static_cast(in_reduction_vars.size()), static_cast(reduction_vars.size()), (priority ? 1 : 0), static_cast(allocate_vars.size()), static_cast(allocators_vars.size()), (grain_size ? 1 : 0), (num_tasks ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (inclusive) { + odsState.getOrAddProperties().inclusive = inclusive; + } + if (untied) { + odsState.getOrAddProperties().untied = untied; + } + if (mergeable) { + odsState.getOrAddProperties().mergeable = mergeable; + } + if (in_reductions) { + odsState.getOrAddProperties().in_reductions = in_reductions; + } + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (nogroup) { + odsState.getOrAddProperties().nogroup = nogroup; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TaskLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, /*optional*/bool inclusive, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/bool untied, /*optional*/bool mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::Value priority, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::Value grain_size, /*optional*/::mlir::Value num_tasks, /*optional*/bool nogroup) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + if (if_expr) + odsState.addOperands(if_expr); + if (final_expr) + odsState.addOperands(final_expr); + odsState.addOperands(in_reduction_vars); + odsState.addOperands(reduction_vars); + if (priority) + odsState.addOperands(priority); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + if (grain_size) + odsState.addOperands(grain_size); + if (num_tasks) + odsState.addOperands(num_tasks); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), (if_expr ? 1 : 0), (final_expr ? 1 : 0), static_cast(in_reduction_vars.size()), static_cast(reduction_vars.size()), (priority ? 1 : 0), static_cast(allocate_vars.size()), static_cast(allocators_vars.size()), (grain_size ? 1 : 0), (num_tasks ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (inclusive) { + odsState.getOrAddProperties().inclusive = ((inclusive) ? odsBuilder.getUnitAttr() : nullptr); + } + if (untied) { + odsState.getOrAddProperties().untied = ((untied) ? odsBuilder.getUnitAttr() : nullptr); + } + if (mergeable) { + odsState.getOrAddProperties().mergeable = ((mergeable) ? odsBuilder.getUnitAttr() : nullptr); + } + if (in_reductions) { + odsState.getOrAddProperties().in_reductions = in_reductions; + } + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (nogroup) { + odsState.getOrAddProperties().nogroup = ((nogroup) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); +} + +void TaskLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, /*optional*/bool inclusive, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/bool untied, /*optional*/bool mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::Value priority, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::Value grain_size, /*optional*/::mlir::Value num_tasks, /*optional*/bool nogroup) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + if (if_expr) + odsState.addOperands(if_expr); + if (final_expr) + odsState.addOperands(final_expr); + odsState.addOperands(in_reduction_vars); + odsState.addOperands(reduction_vars); + if (priority) + odsState.addOperands(priority); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + if (grain_size) + odsState.addOperands(grain_size); + if (num_tasks) + odsState.addOperands(num_tasks); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), (if_expr ? 1 : 0), (final_expr ? 1 : 0), static_cast(in_reduction_vars.size()), static_cast(reduction_vars.size()), (priority ? 1 : 0), static_cast(allocate_vars.size()), static_cast(allocators_vars.size()), (grain_size ? 1 : 0), (num_tasks ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (inclusive) { + odsState.getOrAddProperties().inclusive = ((inclusive) ? odsBuilder.getUnitAttr() : nullptr); + } + if (untied) { + odsState.getOrAddProperties().untied = ((untied) ? odsBuilder.getUnitAttr() : nullptr); + } + if (mergeable) { + odsState.getOrAddProperties().mergeable = ((mergeable) ? odsBuilder.getUnitAttr() : nullptr); + } + if (in_reductions) { + odsState.getOrAddProperties().in_reductions = in_reductions; + } + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (nogroup) { + odsState.getOrAddProperties().nogroup = ((nogroup) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TaskLoopOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TaskLoopOp::verifyInvariantsImpl() { + auto tblgen_in_reductions = getProperties().in_reductions; (void)tblgen_in_reductions; + auto tblgen_inclusive = getProperties().inclusive; (void)tblgen_inclusive; + auto tblgen_mergeable = getProperties().mergeable; (void)tblgen_mergeable; + auto tblgen_nogroup = getProperties().nogroup; (void)tblgen_nogroup; + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + auto tblgen_untied = getProperties().untied; (void)tblgen_untied; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_inclusive, "inclusive"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_untied, "untied"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_mergeable, "mergeable"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(*this, tblgen_in_reductions, "in_reductions"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(*this, tblgen_reductions, "reductions"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_nogroup, "nogroup"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + if (valueGroup4.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup4.size(); + } + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup7 = getODSOperands(7); + + if (valueGroup7.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup7.size(); + } + + for (auto v : valueGroup7) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup8 = getODSOperands(8); + + for (auto v : valueGroup8) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup9 = getODSOperands(9); + + for (auto v : valueGroup9) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup10 = getODSOperands(10); + + if (valueGroup10.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup10.size(); + } + + for (auto v : valueGroup10) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup11 = getODSOperands(11); + + if (valueGroup11.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup11.size(); + } + + for (auto v : valueGroup11) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!(((this->getODSOperands(0).getType()) == (this->getODSOperands(1).getType()) && (this->getODSOperands(1).getType()) == (this->getODSOperands(2).getType()) && (this->getODSOperands(2).getType()) == (this->getODSOperands(0).getType())))) + return emitOpError("failed to verify that all of {lowerBound, upperBound, step} have same type"); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TaskLoopOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TaskLoopOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_exprOperands; + ::llvm::SMLoc if_exprOperandsLoc; + (void)if_exprOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> final_exprOperands; + ::llvm::SMLoc final_exprOperandsLoc; + (void)final_exprOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> in_reduction_varsOperands; + ::llvm::SMLoc in_reduction_varsOperandsLoc; + (void)in_reduction_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> in_reduction_varsTypes; + ::mlir::ArrayAttr in_reductionsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> reduction_varsOperands; + ::llvm::SMLoc reduction_varsOperandsLoc; + (void)reduction_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> reduction_varsTypes; + ::mlir::ArrayAttr reductionsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> priorityOperands; + ::llvm::SMLoc priorityOperandsLoc; + (void)priorityOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> priorityTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocate_varsOperands; + ::llvm::SMLoc allocate_varsOperandsLoc; + (void)allocate_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocate_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocators_varsOperands; + ::llvm::SMLoc allocators_varsOperandsLoc; + (void)allocators_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocators_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> grain_sizeOperands; + ::llvm::SMLoc grain_sizeOperandsLoc; + (void)grain_sizeOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> grain_sizeTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> num_tasksOperands; + ::llvm::SMLoc num_tasksOperandsLoc; + (void)num_tasksOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> num_tasksTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> lowerBoundOperands; + ::llvm::SMLoc lowerBoundOperandsLoc; + (void)lowerBoundOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> upperBoundOperands; + ::llvm::SMLoc upperBoundOperandsLoc; + (void)upperBoundOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> stepOperands; + ::llvm::SMLoc stepOperandsLoc; + (void)stepOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> stepTypes; + ::mlir::UnitAttr inclusiveAttr; + bool ifClause = false; + bool finalClause = false; + bool untiedClause = false; + bool mergeableClause = false; + bool in_reductionClause = false; + bool reductionClause = false; + bool priorityClause = false; + bool allocateClause = false; + bool grain_sizeClause = false; + bool num_tasksClause = false; + bool nogroupClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("final"))) { + + if (finalClause) { + return parser.emitError(parser.getNameLoc()) + << "`final` clause can appear at most once in the expansion of the " + "oilist directive"; + } + finalClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + final_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + final_exprOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("untied"))) { + + if (untiedClause) { + return parser.emitError(parser.getNameLoc()) + << "`untied` clause can appear at most once in the expansion of the " + "oilist directive"; + } + untiedClause = true; + result.getOrAddProperties().untied = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("mergeable"))) { + + if (mergeableClause) { + return parser.emitError(parser.getNameLoc()) + << "`mergeable` clause can appear at most once in the expansion of the " + "oilist directive"; + } + mergeableClause = true; + result.getOrAddProperties().mergeable = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("in_reduction"))) { + + if (in_reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`in_reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + in_reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + in_reduction_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseReductionVarList(parser, in_reduction_varsOperands, in_reduction_varsTypes, in_reductionsAttr); + if (odsResult) return ::mlir::failure(); + if (in_reductionsAttr) + result.getOrAddProperties().in_reductions = in_reductionsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("reduction"))) { + + if (reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + reduction_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseReductionVarList(parser, reduction_varsOperands, reduction_varsTypes, reductionsAttr); + if (odsResult) return ::mlir::failure(); + if (reductionsAttr) + result.getOrAddProperties().reductions = reductionsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("priority"))) { + + if (priorityClause) { + return parser.emitError(parser.getNameLoc()) + << "`priority` clause can appear at most once in the expansion of the " + "oilist directive"; + } + priorityClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + priorityOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + priorityOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + priorityTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("allocate"))) { + + if (allocateClause) { + return parser.emitError(parser.getNameLoc()) + << "`allocate` clause can appear at most once in the expansion of the " + "oilist directive"; + } + allocateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + allocate_varsOperandsLoc = parser.getCurrentLocation(); + allocators_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAllocateAndAllocator(parser, allocate_varsOperands, allocate_varsTypes, allocators_varsOperands, allocators_varsTypes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("grain_size"))) { + + if (grain_sizeClause) { + return parser.emitError(parser.getNameLoc()) + << "`grain_size` clause can appear at most once in the expansion of the " + "oilist directive"; + } + grain_sizeClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + grain_sizeOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + grain_sizeOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + grain_sizeTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("num_tasks"))) { + + if (num_tasksClause) { + return parser.emitError(parser.getNameLoc()) + << "`num_tasks` clause can appear at most once in the expansion of the " + "oilist directive"; + } + num_tasksClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + num_tasksOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + num_tasksOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + num_tasksTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("nogroup"))) { + + if (nogroupClause) { + return parser.emitError(parser.getNameLoc()) + << "`nogroup` clause can appear at most once in the expansion of the " + "oilist directive"; + } + nogroupClause = true; + result.getOrAddProperties().nogroup = parser.getBuilder().getUnitAttr(); } else { + break; + } +} + if (parser.parseKeyword("for")) + return ::mlir::failure(); + { + lowerBoundOperandsLoc = parser.getCurrentLocation(); + upperBoundOperandsLoc = parser.getCurrentLocation(); + stepOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseLoopControl(parser, *regionRegion, lowerBoundOperands, upperBoundOperands, stepOperands, stepTypes, inclusiveAttr); + if (odsResult) return ::mlir::failure(); + if (inclusiveAttr) + result.getOrAddProperties().inclusive = inclusiveAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(lowerBoundOperands.size()), static_cast(upperBoundOperands.size()), static_cast(stepOperands.size()), static_cast(if_exprOperands.size()), static_cast(final_exprOperands.size()), static_cast(in_reduction_varsOperands.size()), static_cast(reduction_varsOperands.size()), static_cast(priorityOperands.size()), static_cast(allocate_varsOperands.size()), static_cast(allocators_varsOperands.size()), static_cast(grain_sizeOperands.size()), static_cast(num_tasksOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(lowerBoundOperands, stepTypes, lowerBoundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(upperBoundOperands, stepTypes, upperBoundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(stepOperands, stepTypes, stepOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(if_exprOperands, odsBuildableType0, if_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(final_exprOperands, odsBuildableType0, final_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(in_reduction_varsOperands, in_reduction_varsTypes, in_reduction_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(reduction_varsOperands, reduction_varsTypes, reduction_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(priorityOperands, priorityTypes, priorityOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocate_varsOperands, allocate_varsTypes, allocate_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocators_varsOperands, allocators_varsTypes, allocators_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(grain_sizeOperands, grain_sizeTypes, grain_sizeOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(num_tasksOperands, num_tasksTypes, num_tasksOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TaskLoopOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfExpr()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExpr()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getFinalExpr()) { + _odsPrinter << ' ' << "final"; + _odsPrinter << "("; + if (::mlir::Value value = getFinalExpr()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getUntiedAttr()) { + _odsPrinter << ' ' << "untied"; + } + if (false || getMergeableAttr()) { + _odsPrinter << ' ' << "mergeable"; + } + if (false || getInReductionVars().size() || getInReductionsAttr()) { + _odsPrinter << ' ' << "in_reduction"; + _odsPrinter << "("; + printReductionVarList(_odsPrinter, *this, getInReductionVars(), getInReductionVars().getTypes(), getInReductionsAttr()); + _odsPrinter << ")"; + } + if (false || getReductionVars().size() || getReductionsAttr()) { + _odsPrinter << ' ' << "reduction"; + _odsPrinter << "("; + printReductionVarList(_odsPrinter, *this, getReductionVars(), getReductionVars().getTypes(), getReductionsAttr()); + _odsPrinter << ")"; + } + if (false || getPriority()) { + _odsPrinter << ' ' << "priority"; + _odsPrinter << "("; + if (::mlir::Value value = getPriority()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getPriority() ? ::llvm::ArrayRef<::mlir::Type>(getPriority().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getAllocateVars().size() || getAllocatorsVars().size()) { + _odsPrinter << ' ' << "allocate"; + _odsPrinter << "("; + printAllocateAndAllocator(_odsPrinter, *this, getAllocateVars(), getAllocateVars().getTypes(), getAllocatorsVars(), getAllocatorsVars().getTypes()); + _odsPrinter << ")"; + } + if (false || getGrainSize()) { + _odsPrinter << ' ' << "grain_size"; + _odsPrinter << "("; + if (::mlir::Value value = getGrainSize()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getGrainSize() ? ::llvm::ArrayRef<::mlir::Type>(getGrainSize().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getNumTasks()) { + _odsPrinter << ' ' << "num_tasks"; + _odsPrinter << "("; + if (::mlir::Value value = getNumTasks()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getNumTasks() ? ::llvm::ArrayRef<::mlir::Type>(getNumTasks().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getNogroupAttr()) { + _odsPrinter << ' ' << "nogroup"; + } + _odsPrinter << ' ' << "for"; + _odsPrinter << ' '; + printLoopControl(_odsPrinter, *this, getRegion(), getLowerBound(), getUpperBound(), getStep(), getStep().getTypes(), getInclusiveAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("untied"); + elidedAttrs.push_back("mergeable"); + elidedAttrs.push_back("in_reductions"); + elidedAttrs.push_back("reductions"); + elidedAttrs.push_back("nogroup"); + elidedAttrs.push_back("inclusive"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getInclusiveAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("inclusive"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getUntiedAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("untied"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getMergeableAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("mergeable"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNogroupAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nogroup"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::TaskLoopOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TaskOpGenericAdaptorBase::TaskOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.task", odsAttrs.getContext()); +} + +TaskOpGenericAdaptorBase::TaskOpGenericAdaptorBase(TaskOp op) : TaskOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TaskOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr TaskOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::UnitAttr TaskOpGenericAdaptorBase::getUntiedAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().untied); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool TaskOpGenericAdaptorBase::getUntied() { + auto attr = getUntiedAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr TaskOpGenericAdaptorBase::getMergeableAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().mergeable); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool TaskOpGenericAdaptorBase::getMergeable() { + auto attr = getMergeableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr TaskOpGenericAdaptorBase::getInReductionsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().in_reductions); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > TaskOpGenericAdaptorBase::getInReductions() { + auto attr = getInReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr TaskOpGenericAdaptorBase::getDependsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().depends); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > TaskOpGenericAdaptorBase::getDepends() { + auto attr = getDependsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::Region &TaskOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange TaskOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +TaskOpAdaptor::TaskOpAdaptor(TaskOp op) : TaskOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TaskOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_depends = getProperties().depends; (void)tblgen_depends; + auto tblgen_in_reductions = getProperties().in_reductions; (void)tblgen_in_reductions; + auto tblgen_mergeable = getProperties().mergeable; (void)tblgen_mergeable; + auto tblgen_untied = getProperties().untied; (void)tblgen_untied; + + if (tblgen_untied && !((::llvm::isa<::mlir::UnitAttr>(tblgen_untied)))) + return emitError(loc, "'omp.task' op ""attribute 'untied' failed to satisfy constraint: unit attribute"); + + if (tblgen_mergeable && !((::llvm::isa<::mlir::UnitAttr>(tblgen_mergeable)))) + return emitError(loc, "'omp.task' op ""attribute 'mergeable' failed to satisfy constraint: unit attribute"); + + if (tblgen_in_reductions && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_in_reductions))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_in_reductions), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'omp.task' op ""attribute 'in_reductions' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_depends && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_depends))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_depends), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::omp::ClauseTaskDependAttr>(attr))); })))) + return emitError(loc, "'omp.task' op ""attribute 'depends' failed to satisfy constraint: clause_task_depend array attr"); + return ::mlir::success(); +} + +std::pair TaskOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range TaskOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> TaskOp::getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> TaskOp::getFinalExpr() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range TaskOp::getInReductionVars() { + return getODSOperands(2); +} + +::mlir::TypedValue<::mlir::IntegerType> TaskOp::getPriority() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range TaskOp::getDependVars() { + return getODSOperands(4); +} + +::mlir::Operation::operand_range TaskOp::getAllocateVars() { + return getODSOperands(5); +} + +::mlir::Operation::operand_range TaskOp::getAllocatorsVars() { + return getODSOperands(6); +} + +::mlir::MutableOperandRange TaskOp::getIfExprMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskOp::getFinalExprMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskOp::getInReductionVarsMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskOp::getPriorityMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskOp::getDependVarsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskOp::getAllocateVarsMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TaskOp::getAllocatorsVarsMutable() { + auto range = getODSOperandIndexAndLength(6); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair TaskOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TaskOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &TaskOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult TaskOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.depends; + auto attr = dict.get("depends"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for depends in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `depends` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.in_reductions; + auto attr = dict.get("in_reductions"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for in_reductions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `in_reductions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.mergeable; + auto attr = dict.get("mergeable"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for mergeable in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `mergeable` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.untied; + auto attr = dict.get("untied"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for untied in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `untied` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute TaskOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.depends; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("depends", + propStorage)); + } + + { + const auto &propStorage = prop.in_reductions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("in_reductions", + propStorage)); + } + + { + const auto &propStorage = prop.mergeable; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("mergeable", + propStorage)); + } + + { + const auto &propStorage = prop.untied; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("untied", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TaskOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.depends.getAsOpaquePointer()), + llvm::hash_value(prop.in_reductions.getAsOpaquePointer()), + llvm::hash_value(prop.mergeable.getAsOpaquePointer()), + llvm::hash_value(prop.untied.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional TaskOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "depends") + return prop.depends; + + if (name == "in_reductions") + return prop.in_reductions; + + if (name == "mergeable") + return prop.mergeable; + + if (name == "untied") + return prop.untied; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void TaskOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "depends") { + prop.depends = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "in_reductions") { + prop.in_reductions = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "mergeable") { + prop.mergeable = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "untied") { + prop.untied = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void TaskOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.depends) attrs.append("depends", prop.depends); + + if (prop.in_reductions) attrs.append("in_reductions", prop.in_reductions); + + if (prop.mergeable) attrs.append("mergeable", prop.mergeable); + + if (prop.untied) attrs.append("untied", prop.untied); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult TaskOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getDependsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps17(attr, "depends", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getInReductionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(attr, "in_reductions", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getMergeableAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "mergeable", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getUntiedAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "untied", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TaskOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.depends))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.in_reductions))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.mergeable))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.untied))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TaskOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.depends); + + writer.writeOptionalAttribute(prop.in_reductions); + + writer.writeOptionalAttribute(prop.mergeable); + + writer.writeOptionalAttribute(prop.untied); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::UnitAttr TaskOp::getUntiedAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().untied); +} + +bool TaskOp::getUntied() { + auto attr = getUntiedAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr TaskOp::getMergeableAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().mergeable); +} + +bool TaskOp::getMergeable() { + auto attr = getMergeableAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::ArrayAttr TaskOp::getInReductionsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().in_reductions); +} + +::std::optional< ::mlir::ArrayAttr > TaskOp::getInReductions() { + auto attr = getInReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr TaskOp::getDependsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().depends); +} + +::std::optional< ::mlir::ArrayAttr > TaskOp::getDepends() { + auto attr = getDependsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void TaskOp::setUntiedAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getUntiedAttrName(), attr); +} + +void TaskOp::setUntied(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getUntiedAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getUntiedAttrName()); +} + +void TaskOp::setMergeableAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getMergeableAttrName(), attr); +} + +void TaskOp::setMergeable(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getMergeableAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getMergeableAttrName()); +} + +void TaskOp::setInReductionsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getInReductionsAttrName(), attr); +} + +void TaskOp::setDependsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getDependsAttrName(), attr); +} + +::mlir::Attribute TaskOp::removeUntiedAttr() { + auto &attr = getProperties().untied; + attr = {}; + return attr; +} + +::mlir::Attribute TaskOp::removeMergeableAttr() { + auto &attr = getProperties().mergeable; + attr = {}; + return attr; +} + +::mlir::Attribute TaskOp::removeInReductionsAttr() { + auto &attr = getProperties().in_reductions; + attr = {}; + return attr; +} + +::mlir::Attribute TaskOp::removeDependsAttr() { + auto &attr = getProperties().depends; + attr = {}; + return attr; +} + +void TaskOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/::mlir::UnitAttr untied, /*optional*/::mlir::UnitAttr mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, /*optional*/::mlir::Value priority, /*optional*/::mlir::ArrayAttr depends, ::mlir::ValueRange depend_vars, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars) { + if (if_expr) + odsState.addOperands(if_expr); + if (final_expr) + odsState.addOperands(final_expr); + odsState.addOperands(in_reduction_vars); + if (priority) + odsState.addOperands(priority); + odsState.addOperands(depend_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (final_expr ? 1 : 0), static_cast(in_reduction_vars.size()), (priority ? 1 : 0), static_cast(depend_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (untied) { + odsState.getOrAddProperties().untied = untied; + } + if (mergeable) { + odsState.getOrAddProperties().mergeable = mergeable; + } + if (in_reductions) { + odsState.getOrAddProperties().in_reductions = in_reductions; + } + if (depends) { + odsState.getOrAddProperties().depends = depends; + } + (void)odsState.addRegion(); +} + +void TaskOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/::mlir::UnitAttr untied, /*optional*/::mlir::UnitAttr mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, /*optional*/::mlir::Value priority, /*optional*/::mlir::ArrayAttr depends, ::mlir::ValueRange depend_vars, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars) { + if (if_expr) + odsState.addOperands(if_expr); + if (final_expr) + odsState.addOperands(final_expr); + odsState.addOperands(in_reduction_vars); + if (priority) + odsState.addOperands(priority); + odsState.addOperands(depend_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (final_expr ? 1 : 0), static_cast(in_reduction_vars.size()), (priority ? 1 : 0), static_cast(depend_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (untied) { + odsState.getOrAddProperties().untied = untied; + } + if (mergeable) { + odsState.getOrAddProperties().mergeable = mergeable; + } + if (in_reductions) { + odsState.getOrAddProperties().in_reductions = in_reductions; + } + if (depends) { + odsState.getOrAddProperties().depends = depends; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TaskOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/bool untied, /*optional*/bool mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, /*optional*/::mlir::Value priority, /*optional*/::mlir::ArrayAttr depends, ::mlir::ValueRange depend_vars, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars) { + if (if_expr) + odsState.addOperands(if_expr); + if (final_expr) + odsState.addOperands(final_expr); + odsState.addOperands(in_reduction_vars); + if (priority) + odsState.addOperands(priority); + odsState.addOperands(depend_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (final_expr ? 1 : 0), static_cast(in_reduction_vars.size()), (priority ? 1 : 0), static_cast(depend_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (untied) { + odsState.getOrAddProperties().untied = ((untied) ? odsBuilder.getUnitAttr() : nullptr); + } + if (mergeable) { + odsState.getOrAddProperties().mergeable = ((mergeable) ? odsBuilder.getUnitAttr() : nullptr); + } + if (in_reductions) { + odsState.getOrAddProperties().in_reductions = in_reductions; + } + if (depends) { + odsState.getOrAddProperties().depends = depends; + } + (void)odsState.addRegion(); +} + +void TaskOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/bool untied, /*optional*/bool mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, /*optional*/::mlir::Value priority, /*optional*/::mlir::ArrayAttr depends, ::mlir::ValueRange depend_vars, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars) { + if (if_expr) + odsState.addOperands(if_expr); + if (final_expr) + odsState.addOperands(final_expr); + odsState.addOperands(in_reduction_vars); + if (priority) + odsState.addOperands(priority); + odsState.addOperands(depend_vars); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + ::llvm::copy(::llvm::ArrayRef({(if_expr ? 1 : 0), (final_expr ? 1 : 0), static_cast(in_reduction_vars.size()), (priority ? 1 : 0), static_cast(depend_vars.size()), static_cast(allocate_vars.size()), static_cast(allocators_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (untied) { + odsState.getOrAddProperties().untied = ((untied) ? odsBuilder.getUnitAttr() : nullptr); + } + if (mergeable) { + odsState.getOrAddProperties().mergeable = ((mergeable) ? odsBuilder.getUnitAttr() : nullptr); + } + if (in_reductions) { + odsState.getOrAddProperties().in_reductions = in_reductions; + } + if (depends) { + odsState.getOrAddProperties().depends = depends; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TaskOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TaskOp::verifyInvariantsImpl() { + auto tblgen_depends = getProperties().depends; (void)tblgen_depends; + auto tblgen_in_reductions = getProperties().in_reductions; (void)tblgen_in_reductions; + auto tblgen_mergeable = getProperties().mergeable; (void)tblgen_mergeable; + auto tblgen_untied = getProperties().untied; (void)tblgen_untied; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_untied, "untied"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_mergeable, "mergeable"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(*this, tblgen_in_reductions, "in_reductions"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps17(*this, tblgen_depends, "depends"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TaskOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TaskOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_exprOperands; + ::llvm::SMLoc if_exprOperandsLoc; + (void)if_exprOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> final_exprOperands; + ::llvm::SMLoc final_exprOperandsLoc; + (void)final_exprOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> in_reduction_varsOperands; + ::llvm::SMLoc in_reduction_varsOperandsLoc; + (void)in_reduction_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> in_reduction_varsTypes; + ::mlir::ArrayAttr in_reductionsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> priorityOperands; + ::llvm::SMLoc priorityOperandsLoc; + (void)priorityOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocate_varsOperands; + ::llvm::SMLoc allocate_varsOperandsLoc; + (void)allocate_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocate_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocators_varsOperands; + ::llvm::SMLoc allocators_varsOperandsLoc; + (void)allocators_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocators_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> depend_varsOperands; + ::llvm::SMLoc depend_varsOperandsLoc; + (void)depend_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> depend_varsTypes; + ::mlir::ArrayAttr dependsAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool ifClause = false; + bool finalClause = false; + bool untiedClause = false; + bool mergeableClause = false; + bool in_reductionClause = false; + bool priorityClause = false; + bool allocateClause = false; + bool dependClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("final"))) { + + if (finalClause) { + return parser.emitError(parser.getNameLoc()) + << "`final` clause can appear at most once in the expansion of the " + "oilist directive"; + } + finalClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + final_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + final_exprOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("untied"))) { + + if (untiedClause) { + return parser.emitError(parser.getNameLoc()) + << "`untied` clause can appear at most once in the expansion of the " + "oilist directive"; + } + untiedClause = true; + result.getOrAddProperties().untied = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("mergeable"))) { + + if (mergeableClause) { + return parser.emitError(parser.getNameLoc()) + << "`mergeable` clause can appear at most once in the expansion of the " + "oilist directive"; + } + mergeableClause = true; + result.getOrAddProperties().mergeable = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("in_reduction"))) { + + if (in_reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`in_reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + in_reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + in_reduction_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseReductionVarList(parser, in_reduction_varsOperands, in_reduction_varsTypes, in_reductionsAttr); + if (odsResult) return ::mlir::failure(); + if (in_reductionsAttr) + result.getOrAddProperties().in_reductions = in_reductionsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("priority"))) { + + if (priorityClause) { + return parser.emitError(parser.getNameLoc()) + << "`priority` clause can appear at most once in the expansion of the " + "oilist directive"; + } + priorityClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + priorityOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + priorityOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("allocate"))) { + + if (allocateClause) { + return parser.emitError(parser.getNameLoc()) + << "`allocate` clause can appear at most once in the expansion of the " + "oilist directive"; + } + allocateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + allocate_varsOperandsLoc = parser.getCurrentLocation(); + allocators_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAllocateAndAllocator(parser, allocate_varsOperands, allocate_varsTypes, allocators_varsOperands, allocators_varsTypes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("depend"))) { + + if (dependClause) { + return parser.emitError(parser.getNameLoc()) + << "`depend` clause can appear at most once in the expansion of the " + "oilist directive"; + } + dependClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + depend_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseDependVarList(parser, depend_varsOperands, depend_varsTypes, dependsAttr); + if (odsResult) return ::mlir::failure(); + if (dependsAttr) + result.getOrAddProperties().depends = dependsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(if_exprOperands.size()), static_cast(final_exprOperands.size()), static_cast(in_reduction_varsOperands.size()), static_cast(priorityOperands.size()), static_cast(depend_varsOperands.size()), static_cast(allocate_varsOperands.size()), static_cast(allocators_varsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(if_exprOperands, odsBuildableType0, if_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(final_exprOperands, odsBuildableType0, final_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(in_reduction_varsOperands, in_reduction_varsTypes, in_reduction_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(priorityOperands, odsBuildableType1, priorityOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(depend_varsOperands, depend_varsTypes, depend_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocate_varsOperands, allocate_varsTypes, allocate_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocators_varsOperands, allocators_varsTypes, allocators_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TaskOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getIfExpr()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExpr()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getFinalExpr()) { + _odsPrinter << ' ' << "final"; + _odsPrinter << "("; + if (::mlir::Value value = getFinalExpr()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getUntiedAttr()) { + _odsPrinter << ' ' << "untied"; + } + if (false || getMergeableAttr()) { + _odsPrinter << ' ' << "mergeable"; + } + if (false || getInReductionVars().size() || getInReductionsAttr()) { + _odsPrinter << ' ' << "in_reduction"; + _odsPrinter << "("; + printReductionVarList(_odsPrinter, *this, getInReductionVars(), getInReductionVars().getTypes(), getInReductionsAttr()); + _odsPrinter << ")"; + } + if (false || getPriority()) { + _odsPrinter << ' ' << "priority"; + _odsPrinter << "("; + if (::mlir::Value value = getPriority()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getAllocateVars().size() || getAllocatorsVars().size()) { + _odsPrinter << ' ' << "allocate"; + _odsPrinter << "("; + printAllocateAndAllocator(_odsPrinter, *this, getAllocateVars(), getAllocateVars().getTypes(), getAllocatorsVars(), getAllocatorsVars().getTypes()); + _odsPrinter << ")"; + } + if (false || getDependVars().size() || getDependsAttr()) { + _odsPrinter << ' ' << "depend"; + _odsPrinter << "("; + printDependVarList(_odsPrinter, *this, getDependVars(), getDependVars().getTypes(), getDependsAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("untied"); + elidedAttrs.push_back("mergeable"); + elidedAttrs.push_back("in_reductions"); + elidedAttrs.push_back("depends"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getUntiedAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("untied"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getMergeableAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("mergeable"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::TaskOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskwaitOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TaskwaitOpGenericAdaptorBase::TaskwaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.taskwait", odsAttrs.getContext()); +} + +TaskwaitOpGenericAdaptorBase::TaskwaitOpGenericAdaptorBase(TaskwaitOp op) : TaskwaitOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TaskwaitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TaskwaitOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TaskwaitOpAdaptor::TaskwaitOpAdaptor(TaskwaitOp op) : TaskwaitOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TaskwaitOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TaskwaitOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TaskwaitOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair TaskwaitOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TaskwaitOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void TaskwaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void TaskwaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TaskwaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TaskwaitOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult TaskwaitOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TaskwaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TaskwaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::TaskwaitOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskyieldOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TaskyieldOpGenericAdaptorBase::TaskyieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.taskyield", odsAttrs.getContext()); +} + +TaskyieldOpGenericAdaptorBase::TaskyieldOpGenericAdaptorBase(TaskyieldOp op) : TaskyieldOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TaskyieldOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TaskyieldOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TaskyieldOpAdaptor::TaskyieldOpAdaptor(TaskyieldOp op) : TaskyieldOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TaskyieldOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TaskyieldOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TaskyieldOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair TaskyieldOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TaskyieldOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void TaskyieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void TaskyieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TaskyieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TaskyieldOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult TaskyieldOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TaskyieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TaskyieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::TaskyieldOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TeamsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TeamsOpGenericAdaptorBase::TeamsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.teams", odsAttrs.getContext()); +} + +TeamsOpGenericAdaptorBase::TeamsOpGenericAdaptorBase(TeamsOp op) : TeamsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TeamsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr TeamsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr TeamsOpGenericAdaptorBase::getReductionsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > TeamsOpGenericAdaptorBase::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::Region &TeamsOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange TeamsOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +TeamsOpAdaptor::TeamsOpAdaptor(TeamsOp op) : TeamsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TeamsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + + if (tblgen_reductions && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reductions))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reductions), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'omp.teams' op ""attribute 'reductions' failed to satisfy constraint: symbol ref array attribute"); + return ::mlir::success(); +} + +std::pair TeamsOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range TeamsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::IntegerType> TeamsOp::getNumTeamsLower() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> TeamsOp::getNumTeamsUpper() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> TeamsOp::getIfExpr() { + auto operands = getODSOperands(2); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::TypedValue<::mlir::IntegerType> TeamsOp::getThreadLimit() { + auto operands = getODSOperands(3); + return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); +} + +::mlir::Operation::operand_range TeamsOp::getAllocateVars() { + return getODSOperands(4); +} + +::mlir::Operation::operand_range TeamsOp::getAllocatorsVars() { + return getODSOperands(5); +} + +::mlir::Operation::operand_range TeamsOp::getReductionVars() { + return getODSOperands(6); +} + +::mlir::MutableOperandRange TeamsOp::getNumTeamsLowerMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TeamsOp::getNumTeamsUpperMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TeamsOp::getIfExprMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TeamsOp::getThreadLimitMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TeamsOp::getAllocateVarsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TeamsOp::getAllocatorsVarsMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange TeamsOp::getReductionVarsMutable() { + auto range = getODSOperandIndexAndLength(6); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair TeamsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TeamsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &TeamsOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult TeamsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.reductions; + auto attr = dict.get("reductions"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for reductions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute TeamsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.reductions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductions", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TeamsOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.reductions.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional TeamsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "reductions") + return prop.reductions; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void TeamsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "reductions") { + prop.reductions = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void TeamsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.reductions) attrs.append("reductions", prop.reductions); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult TeamsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getReductionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(attr, "reductions", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TeamsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.reductions))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TeamsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.reductions); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::ArrayAttr TeamsOp::getReductionsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); +} + +::std::optional< ::mlir::ArrayAttr > TeamsOp::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void TeamsOp::setReductionsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReductionsAttrName(), attr); +} + +::mlir::Attribute TeamsOp::removeReductionsAttr() { + auto &attr = getProperties().reductions; + attr = {}; + return attr; +} + +void TeamsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value num_teams_lower, /*optional*/::mlir::Value num_teams_upper, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value thread_limit, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions) { + if (num_teams_lower) + odsState.addOperands(num_teams_lower); + if (num_teams_upper) + odsState.addOperands(num_teams_upper); + if (if_expr) + odsState.addOperands(if_expr); + if (thread_limit) + odsState.addOperands(thread_limit); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + odsState.addOperands(reduction_vars); + ::llvm::copy(::llvm::ArrayRef({(num_teams_lower ? 1 : 0), (num_teams_upper ? 1 : 0), (if_expr ? 1 : 0), (thread_limit ? 1 : 0), static_cast(allocate_vars.size()), static_cast(allocators_vars.size()), static_cast(reduction_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + (void)odsState.addRegion(); +} + +void TeamsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value num_teams_lower, /*optional*/::mlir::Value num_teams_upper, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value thread_limit, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions) { + if (num_teams_lower) + odsState.addOperands(num_teams_lower); + if (num_teams_upper) + odsState.addOperands(num_teams_upper); + if (if_expr) + odsState.addOperands(if_expr); + if (thread_limit) + odsState.addOperands(thread_limit); + odsState.addOperands(allocate_vars); + odsState.addOperands(allocators_vars); + odsState.addOperands(reduction_vars); + ::llvm::copy(::llvm::ArrayRef({(num_teams_lower ? 1 : 0), (num_teams_upper ? 1 : 0), (if_expr ? 1 : 0), (thread_limit ? 1 : 0), static_cast(allocate_vars.size()), static_cast(allocators_vars.size()), static_cast(reduction_vars.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TeamsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TeamsOp::verifyInvariantsImpl() { + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(*this, tblgen_reductions, "reductions"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + if (valueGroup2.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup2.size(); + } + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + if (valueGroup3.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup3.size(); + } + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TeamsOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TeamsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> num_teams_lowerOperands; + ::llvm::SMLoc num_teams_lowerOperandsLoc; + (void)num_teams_lowerOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> num_teams_lowerTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> num_teams_upperOperands; + ::llvm::SMLoc num_teams_upperOperandsLoc; + (void)num_teams_upperOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> num_teams_upperTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> if_exprOperands; + ::llvm::SMLoc if_exprOperandsLoc; + (void)if_exprOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> thread_limitOperands; + ::llvm::SMLoc thread_limitOperandsLoc; + (void)thread_limitOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> thread_limitTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> reduction_varsOperands; + ::llvm::SMLoc reduction_varsOperandsLoc; + (void)reduction_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> reduction_varsTypes; + ::mlir::ArrayAttr reductionsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocate_varsOperands; + ::llvm::SMLoc allocate_varsOperandsLoc; + (void)allocate_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocate_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allocators_varsOperands; + ::llvm::SMLoc allocators_varsOperandsLoc; + (void)allocators_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> allocators_varsTypes; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + bool num_teamsClause = false; + bool ifClause = false; + bool thread_limitClause = false; + bool reductionClause = false; + bool allocateClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("num_teams"))) { + + if (num_teamsClause) { + return parser.emitError(parser.getNameLoc()) + << "`num_teams` clause can appear at most once in the expansion of the " + "oilist directive"; + } + num_teamsClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + num_teams_lowerOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + num_teams_lowerOperands.push_back(operand); + } + } + if (!num_teams_lowerOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + num_teams_lowerTypes.push_back(optionalType); + } + } + } + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + { + num_teams_upperOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + num_teams_upperOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + num_teams_upperTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("if"))) { + + if (ifClause) { + return parser.emitError(parser.getNameLoc()) + << "`if` clause can appear at most once in the expansion of the " + "oilist directive"; + } + ifClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + if_exprOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + if_exprOperands.push_back(operand); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("thread_limit"))) { + + if (thread_limitClause) { + return parser.emitError(parser.getNameLoc()) + << "`thread_limit` clause can appear at most once in the expansion of the " + "oilist directive"; + } + thread_limitClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + thread_limitOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + thread_limitOperands.push_back(operand); + } + } + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::Type optionalType; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalType(optionalType); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + thread_limitTypes.push_back(optionalType); + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("reduction"))) { + + if (reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + reduction_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseReductionVarList(parser, reduction_varsOperands, reduction_varsTypes, reductionsAttr); + if (odsResult) return ::mlir::failure(); + if (reductionsAttr) + result.getOrAddProperties().reductions = reductionsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("allocate"))) { + + if (allocateClause) { + return parser.emitError(parser.getNameLoc()) + << "`allocate` clause can appear at most once in the expansion of the " + "oilist directive"; + } + allocateClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + allocate_varsOperandsLoc = parser.getCurrentLocation(); + allocators_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseAllocateAndAllocator(parser, allocate_varsOperands, allocate_varsTypes, allocators_varsOperands, allocators_varsTypes); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + + if (parser.parseRegion(*regionRegion)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(num_teams_lowerOperands.size()), static_cast(num_teams_upperOperands.size()), static_cast(if_exprOperands.size()), static_cast(thread_limitOperands.size()), static_cast(allocate_varsOperands.size()), static_cast(allocators_varsOperands.size()), static_cast(reduction_varsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); + if (parser.resolveOperands(num_teams_lowerOperands, num_teams_lowerTypes, num_teams_lowerOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(num_teams_upperOperands, num_teams_upperTypes, num_teams_upperOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(if_exprOperands, odsBuildableType0, if_exprOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(thread_limitOperands, thread_limitTypes, thread_limitOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocate_varsOperands, allocate_varsTypes, allocate_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(allocators_varsOperands, allocators_varsTypes, allocators_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(reduction_varsOperands, reduction_varsTypes, reduction_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TeamsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getNumTeamsLower() || getNumTeamsUpper()) { + _odsPrinter << ' ' << "num_teams"; + _odsPrinter << "("; + if (getNumTeamsLower()) { + if (::mlir::Value value = getNumTeamsLower()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getNumTeamsLower() ? ::llvm::ArrayRef<::mlir::Type>(getNumTeamsLower().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + } + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + if (::mlir::Value value = getNumTeamsUpper()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getNumTeamsUpper() ? ::llvm::ArrayRef<::mlir::Type>(getNumTeamsUpper().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getIfExpr()) { + _odsPrinter << ' ' << "if"; + _odsPrinter << "("; + if (::mlir::Value value = getIfExpr()) + _odsPrinter << value; + _odsPrinter << ")"; + } + if (false || getThreadLimit()) { + _odsPrinter << ' ' << "thread_limit"; + _odsPrinter << "("; + if (::mlir::Value value = getThreadLimit()) + _odsPrinter << value; + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << (getThreadLimit() ? ::llvm::ArrayRef<::mlir::Type>(getThreadLimit().getType()) : ::llvm::ArrayRef<::mlir::Type>()); + _odsPrinter << ")"; + } + if (false || getReductionVars().size() || getReductionsAttr()) { + _odsPrinter << ' ' << "reduction"; + _odsPrinter << "("; + printReductionVarList(_odsPrinter, *this, getReductionVars(), getReductionVars().getTypes(), getReductionsAttr()); + _odsPrinter << ")"; + } + if (false || getAllocateVars().size() || getAllocatorsVars().size()) { + _odsPrinter << ' ' << "allocate"; + _odsPrinter << "("; + printAllocateAndAllocator(_odsPrinter, *this, getAllocateVars(), getAllocateVars().getTypes(), getAllocatorsVars(), getAllocatorsVars().getTypes()); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + _odsPrinter.printRegion(getRegion()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("reductions"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::TeamsOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TerminatorOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TerminatorOpGenericAdaptorBase::TerminatorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.terminator", odsAttrs.getContext()); +} + +TerminatorOpGenericAdaptorBase::TerminatorOpGenericAdaptorBase(TerminatorOp op) : TerminatorOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TerminatorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TerminatorOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +TerminatorOpAdaptor::TerminatorOpAdaptor(TerminatorOp op) : TerminatorOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TerminatorOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair TerminatorOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TerminatorOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair TerminatorOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TerminatorOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void TerminatorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void TerminatorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TerminatorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TerminatorOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult TerminatorOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult TerminatorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void TerminatorOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void TerminatorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::TerminatorOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ThreadprivateOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ThreadprivateOpGenericAdaptorBase::ThreadprivateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.threadprivate", odsAttrs.getContext()); +} + +ThreadprivateOpGenericAdaptorBase::ThreadprivateOpGenericAdaptorBase(ThreadprivateOp op) : ThreadprivateOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ThreadprivateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ThreadprivateOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ThreadprivateOpAdaptor::ThreadprivateOpAdaptor(ThreadprivateOp op) : ThreadprivateOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ThreadprivateOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ThreadprivateOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ThreadprivateOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> ThreadprivateOp::getSymAddr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ThreadprivateOp::getSymAddrMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ThreadprivateOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ThreadprivateOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::omp::PointerLikeType> ThreadprivateOp::getTlsAddr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::omp::PointerLikeType>>(*getODSResults(0).begin()); +} + +void ThreadprivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tls_addr, ::mlir::Value sym_addr) { + odsState.addOperands(sym_addr); + odsState.addTypes(tls_addr); +} + +void ThreadprivateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sym_addr) { + odsState.addOperands(sym_addr); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ThreadprivateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ThreadprivateOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that all of {sym_addr, tls_addr} have same type"); + return ::mlir::success(); +} + +::mlir::LogicalResult ThreadprivateOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ThreadprivateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand sym_addrRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sym_addrOperands(sym_addrRawOperands); ::llvm::SMLoc sym_addrOperandsLoc; + (void)sym_addrOperandsLoc; + ::mlir::Type sym_addrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> sym_addrTypes(sym_addrRawTypes); + ::mlir::Type tls_addrRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> tls_addrTypes(tls_addrRawTypes); + + sym_addrOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(sym_addrRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::omp::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + sym_addrRawTypes[0] = type; + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::omp::PointerLikeType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + tls_addrRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addTypes(tls_addrTypes); + if (parser.resolveOperands(sym_addrOperands, sym_addrTypes, sym_addrOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ThreadprivateOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getSymAddr(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getSymAddr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::omp::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + { + auto type = getTlsAddr().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::omp::PointerLikeType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ThreadprivateOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::WsLoopOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +WsLoopOpGenericAdaptorBase::WsLoopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.wsloop", odsAttrs.getContext()); +} + +WsLoopOpGenericAdaptorBase::WsLoopOpGenericAdaptorBase(WsLoopOp op) : WsLoopOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair WsLoopOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr WsLoopOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr WsLoopOpGenericAdaptorBase::getReductionsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > WsLoopOpGenericAdaptorBase::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::omp::ClauseScheduleKindAttr WsLoopOpGenericAdaptorBase::getScheduleValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ClauseScheduleKindAttr>(getProperties().schedule_val); + return attr; +} + +::std::optional<::mlir::omp::ClauseScheduleKind> WsLoopOpGenericAdaptorBase::getScheduleVal() { + auto attr = getScheduleValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseScheduleKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::omp::ScheduleModifierAttr WsLoopOpGenericAdaptorBase::getScheduleModifierAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ScheduleModifierAttr>(getProperties().schedule_modifier); + return attr; +} + +::std::optional<::mlir::omp::ScheduleModifier> WsLoopOpGenericAdaptorBase::getScheduleModifier() { + auto attr = getScheduleModifierAttr(); + return attr ? ::std::optional<::mlir::omp::ScheduleModifier>(attr.getValue()) : (::std::nullopt); +} + +::mlir::UnitAttr WsLoopOpGenericAdaptorBase::getSimdModifierAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().simd_modifier); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool WsLoopOpGenericAdaptorBase::getSimdModifier() { + auto attr = getSimdModifierAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr WsLoopOpGenericAdaptorBase::getNowaitAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool WsLoopOpGenericAdaptorBase::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::IntegerAttr WsLoopOpGenericAdaptorBase::getOrderedValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().ordered_val); + return attr; +} + +::std::optional WsLoopOpGenericAdaptorBase::getOrderedVal() { + auto attr = getOrderedValAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::omp::ClauseOrderKindAttr WsLoopOpGenericAdaptorBase::getOrderValAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::omp::ClauseOrderKindAttr>(getProperties().order_val); + return attr; +} + +::std::optional<::mlir::omp::ClauseOrderKind> WsLoopOpGenericAdaptorBase::getOrderVal() { + auto attr = getOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseOrderKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::UnitAttr WsLoopOpGenericAdaptorBase::getInclusiveAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inclusive); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool WsLoopOpGenericAdaptorBase::getInclusive() { + auto attr = getInclusiveAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::Region &WsLoopOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange WsLoopOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +WsLoopOpAdaptor::WsLoopOpAdaptor(WsLoopOp op) : WsLoopOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult WsLoopOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_inclusive = getProperties().inclusive; (void)tblgen_inclusive; + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + auto tblgen_order_val = getProperties().order_val; (void)tblgen_order_val; + auto tblgen_ordered_val = getProperties().ordered_val; (void)tblgen_ordered_val; + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + auto tblgen_schedule_modifier = getProperties().schedule_modifier; (void)tblgen_schedule_modifier; + auto tblgen_schedule_val = getProperties().schedule_val; (void)tblgen_schedule_val; + auto tblgen_simd_modifier = getProperties().simd_modifier; (void)tblgen_simd_modifier; + + if (tblgen_reductions && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_reductions))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_reductions), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::SymbolRefAttr>(attr))); })))) + return emitError(loc, "'omp.wsloop' op ""attribute 'reductions' failed to satisfy constraint: symbol ref array attribute"); + + if (tblgen_schedule_val && !((::llvm::isa<::mlir::omp::ClauseScheduleKindAttr>(tblgen_schedule_val)))) + return emitError(loc, "'omp.wsloop' op ""attribute 'schedule_val' failed to satisfy constraint: ScheduleKind Clause"); + + if (tblgen_schedule_modifier && !((::llvm::isa<::mlir::omp::ScheduleModifierAttr>(tblgen_schedule_modifier)))) + return emitError(loc, "'omp.wsloop' op ""attribute 'schedule_modifier' failed to satisfy constraint: OpenMP Schedule Modifier"); + + if (tblgen_simd_modifier && !((::llvm::isa<::mlir::UnitAttr>(tblgen_simd_modifier)))) + return emitError(loc, "'omp.wsloop' op ""attribute 'simd_modifier' failed to satisfy constraint: unit attribute"); + + if (tblgen_nowait && !((::llvm::isa<::mlir::UnitAttr>(tblgen_nowait)))) + return emitError(loc, "'omp.wsloop' op ""attribute 'nowait' failed to satisfy constraint: unit attribute"); + + if (tblgen_ordered_val && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_ordered_val))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_ordered_val).getType().isSignlessInteger(64)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_ordered_val).getInt() >= 0)))) + return emitError(loc, "'omp.wsloop' op ""attribute 'ordered_val' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"); + + if (tblgen_order_val && !((::llvm::isa<::mlir::omp::ClauseOrderKindAttr>(tblgen_order_val)))) + return emitError(loc, "'omp.wsloop' op ""attribute 'order_val' failed to satisfy constraint: OrderKind Clause"); + + if (tblgen_inclusive && !((::llvm::isa<::mlir::UnitAttr>(tblgen_inclusive)))) + return emitError(loc, "'omp.wsloop' op ""attribute 'inclusive' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair WsLoopOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range WsLoopOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range WsLoopOp::getLowerBound() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range WsLoopOp::getUpperBound() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range WsLoopOp::getStep() { + return getODSOperands(2); +} + +::mlir::Operation::operand_range WsLoopOp::getLinearVars() { + return getODSOperands(3); +} + +::mlir::Operation::operand_range WsLoopOp::getLinearStepVars() { + return getODSOperands(4); +} + +::mlir::Operation::operand_range WsLoopOp::getReductionVars() { + return getODSOperands(5); +} + +::mlir::Value WsLoopOp::getScheduleChunkVar() { + auto operands = getODSOperands(6); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::MutableOperandRange WsLoopOp::getLowerBoundMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange WsLoopOp::getUpperBoundMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange WsLoopOp::getStepMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange WsLoopOp::getLinearVarsMutable() { + auto range = getODSOperandIndexAndLength(3); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange WsLoopOp::getLinearStepVarsMutable() { + auto range = getODSOperandIndexAndLength(4); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange WsLoopOp::getReductionVarsMutable() { + auto range = getODSOperandIndexAndLength(5); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange WsLoopOp::getScheduleChunkVarMutable() { + auto range = getODSOperandIndexAndLength(6); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair WsLoopOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range WsLoopOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &WsLoopOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult WsLoopOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.inclusive; + auto attr = dict.get("inclusive"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for inclusive in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `inclusive` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.nowait; + auto attr = dict.get("nowait"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for nowait in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `nowait` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.order_val; + auto attr = dict.get("order_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for order_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `order_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.ordered_val; + auto attr = dict.get("ordered_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for ordered_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `ordered_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.reductions; + auto attr = dict.get("reductions"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for reductions in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `reductions` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.schedule_modifier; + auto attr = dict.get("schedule_modifier"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for schedule_modifier in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `schedule_modifier` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.schedule_val; + auto attr = dict.get("schedule_val"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for schedule_val in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `schedule_val` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.simd_modifier; + auto attr = dict.get("simd_modifier"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for simd_modifier in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `simd_modifier` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute WsLoopOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.inclusive; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("inclusive", + propStorage)); + } + + { + const auto &propStorage = prop.nowait; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("nowait", + propStorage)); + } + + { + const auto &propStorage = prop.order_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("order_val", + propStorage)); + } + + { + const auto &propStorage = prop.ordered_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("ordered_val", + propStorage)); + } + + { + const auto &propStorage = prop.reductions; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("reductions", + propStorage)); + } + + { + const auto &propStorage = prop.schedule_modifier; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("schedule_modifier", + propStorage)); + } + + { + const auto &propStorage = prop.schedule_val; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("schedule_val", + propStorage)); + } + + { + const auto &propStorage = prop.simd_modifier; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("simd_modifier", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code WsLoopOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.inclusive.getAsOpaquePointer()), + llvm::hash_value(prop.nowait.getAsOpaquePointer()), + llvm::hash_value(prop.order_val.getAsOpaquePointer()), + llvm::hash_value(prop.ordered_val.getAsOpaquePointer()), + llvm::hash_value(prop.reductions.getAsOpaquePointer()), + llvm::hash_value(prop.schedule_modifier.getAsOpaquePointer()), + llvm::hash_value(prop.schedule_val.getAsOpaquePointer()), + llvm::hash_value(prop.simd_modifier.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional WsLoopOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "inclusive") + return prop.inclusive; + + if (name == "nowait") + return prop.nowait; + + if (name == "order_val") + return prop.order_val; + + if (name == "ordered_val") + return prop.ordered_val; + + if (name == "reductions") + return prop.reductions; + + if (name == "schedule_modifier") + return prop.schedule_modifier; + + if (name == "schedule_val") + return prop.schedule_val; + + if (name == "simd_modifier") + return prop.simd_modifier; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void WsLoopOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "inclusive") { + prop.inclusive = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "nowait") { + prop.nowait = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "order_val") { + prop.order_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "ordered_val") { + prop.ordered_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "reductions") { + prop.reductions = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "schedule_modifier") { + prop.schedule_modifier = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "schedule_val") { + prop.schedule_val = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "simd_modifier") { + prop.simd_modifier = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void WsLoopOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.inclusive) attrs.append("inclusive", prop.inclusive); + + if (prop.nowait) attrs.append("nowait", prop.nowait); + + if (prop.order_val) attrs.append("order_val", prop.order_val); + + if (prop.ordered_val) attrs.append("ordered_val", prop.ordered_val); + + if (prop.reductions) attrs.append("reductions", prop.reductions); + + if (prop.schedule_modifier) attrs.append("schedule_modifier", prop.schedule_modifier); + + if (prop.schedule_val) attrs.append("schedule_val", prop.schedule_val); + + if (prop.simd_modifier) attrs.append("simd_modifier", prop.simd_modifier); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult WsLoopOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getInclusiveAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "inclusive", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNowaitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "nowait", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getOrderValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps15(attr, "order_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getOrderedValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps10(attr, "ordered_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getReductionsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(attr, "reductions", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getScheduleModifierAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps19(attr, "schedule_modifier", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getScheduleValAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps18(attr, "schedule_val", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSimdModifierAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(attr, "simd_modifier", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WsLoopOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.inclusive))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.nowait))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.order_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.ordered_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.reductions))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.schedule_modifier))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.schedule_val))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.simd_modifier))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void WsLoopOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.inclusive); + + writer.writeOptionalAttribute(prop.nowait); + + writer.writeOptionalAttribute(prop.order_val); + + writer.writeOptionalAttribute(prop.ordered_val); + + writer.writeOptionalAttribute(prop.reductions); + + writer.writeOptionalAttribute(prop.schedule_modifier); + + writer.writeOptionalAttribute(prop.schedule_val); + + writer.writeOptionalAttribute(prop.simd_modifier); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::ArrayAttr WsLoopOp::getReductionsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().reductions); +} + +::std::optional< ::mlir::ArrayAttr > WsLoopOp::getReductions() { + auto attr = getReductionsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::omp::ClauseScheduleKindAttr WsLoopOp::getScheduleValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseScheduleKindAttr>(getProperties().schedule_val); +} + +::std::optional<::mlir::omp::ClauseScheduleKind> WsLoopOp::getScheduleVal() { + auto attr = getScheduleValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseScheduleKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::omp::ScheduleModifierAttr WsLoopOp::getScheduleModifierAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ScheduleModifierAttr>(getProperties().schedule_modifier); +} + +::std::optional<::mlir::omp::ScheduleModifier> WsLoopOp::getScheduleModifier() { + auto attr = getScheduleModifierAttr(); + return attr ? ::std::optional<::mlir::omp::ScheduleModifier>(attr.getValue()) : (::std::nullopt); +} + +::mlir::UnitAttr WsLoopOp::getSimdModifierAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().simd_modifier); +} + +bool WsLoopOp::getSimdModifier() { + auto attr = getSimdModifierAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::UnitAttr WsLoopOp::getNowaitAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nowait); +} + +bool WsLoopOp::getNowait() { + auto attr = getNowaitAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +::mlir::IntegerAttr WsLoopOp::getOrderedValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().ordered_val); +} + +::std::optional WsLoopOp::getOrderedVal() { + auto attr = getOrderedValAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +::mlir::omp::ClauseOrderKindAttr WsLoopOp::getOrderValAttr() { + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseOrderKindAttr>(getProperties().order_val); +} + +::std::optional<::mlir::omp::ClauseOrderKind> WsLoopOp::getOrderVal() { + auto attr = getOrderValAttr(); + return attr ? ::std::optional<::mlir::omp::ClauseOrderKind>(attr.getValue()) : (::std::nullopt); +} + +::mlir::UnitAttr WsLoopOp::getInclusiveAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inclusive); +} + +bool WsLoopOp::getInclusive() { + auto attr = getInclusiveAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void WsLoopOp::setReductionsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getReductionsAttrName(), attr); +} + +void WsLoopOp::setScheduleValAttr(::mlir::omp::ClauseScheduleKindAttr attr) { + (*this)->setAttr(getScheduleValAttrName(), attr); +} + +void WsLoopOp::setScheduleVal(::std::optional<::mlir::omp::ClauseScheduleKind> attrValue) { + if (attrValue) + return (*this)->setAttr(getScheduleValAttrName(), ::mlir::omp::ClauseScheduleKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getScheduleValAttrName()); +} + +void WsLoopOp::setScheduleModifierAttr(::mlir::omp::ScheduleModifierAttr attr) { + (*this)->setAttr(getScheduleModifierAttrName(), attr); +} + +void WsLoopOp::setScheduleModifier(::std::optional<::mlir::omp::ScheduleModifier> attrValue) { + if (attrValue) + return (*this)->setAttr(getScheduleModifierAttrName(), ::mlir::omp::ScheduleModifierAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getScheduleModifierAttrName()); +} + +void WsLoopOp::setSimdModifierAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getSimdModifierAttrName(), attr); +} + +void WsLoopOp::setSimdModifier(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getSimdModifierAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getSimdModifierAttrName()); +} + +void WsLoopOp::setNowaitAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getNowaitAttrName(), attr); +} + +void WsLoopOp::setNowait(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getNowaitAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getNowaitAttrName()); +} + +void WsLoopOp::setOrderedValAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getOrderedValAttrName(), attr); +} + +void WsLoopOp::setOrderedVal(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getOrderedValAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(64), *attrValue)); + (*this)->removeAttr(getOrderedValAttrName()); +} + +void WsLoopOp::setOrderValAttr(::mlir::omp::ClauseOrderKindAttr attr) { + (*this)->setAttr(getOrderValAttrName(), attr); +} + +void WsLoopOp::setOrderVal(::std::optional<::mlir::omp::ClauseOrderKind> attrValue) { + if (attrValue) + return (*this)->setAttr(getOrderValAttrName(), ::mlir::omp::ClauseOrderKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), *attrValue)); + (*this)->removeAttr(getOrderValAttrName()); +} + +void WsLoopOp::setInclusiveAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getInclusiveAttrName(), attr); +} + +void WsLoopOp::setInclusive(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getInclusiveAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getInclusiveAttrName()); +} + +::mlir::Attribute WsLoopOp::removeReductionsAttr() { + auto &attr = getProperties().reductions; + attr = {}; + return attr; +} + +::mlir::Attribute WsLoopOp::removeScheduleValAttr() { + auto &attr = getProperties().schedule_val; + attr = {}; + return attr; +} + +::mlir::Attribute WsLoopOp::removeScheduleModifierAttr() { + auto &attr = getProperties().schedule_modifier; + attr = {}; + return attr; +} + +::mlir::Attribute WsLoopOp::removeSimdModifierAttr() { + auto &attr = getProperties().simd_modifier; + attr = {}; + return attr; +} + +::mlir::Attribute WsLoopOp::removeNowaitAttr() { + auto &attr = getProperties().nowait; + attr = {}; + return attr; +} + +::mlir::Attribute WsLoopOp::removeOrderedValAttr() { + auto &attr = getProperties().ordered_val; + attr = {}; + return attr; +} + +::mlir::Attribute WsLoopOp::removeOrderValAttr() { + auto &attr = getProperties().order_val; + attr = {}; + return attr; +} + +::mlir::Attribute WsLoopOp::removeInclusiveAttr() { + auto &attr = getProperties().inclusive; + attr = {}; + return attr; +} + +void WsLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange linear_vars, ::mlir::ValueRange linear_step_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseScheduleKindAttr schedule_val, /*optional*/::mlir::Value schedule_chunk_var, /*optional*/::mlir::omp::ScheduleModifierAttr schedule_modifier, /*optional*/::mlir::UnitAttr simd_modifier, /*optional*/::mlir::UnitAttr nowait, /*optional*/::mlir::IntegerAttr ordered_val, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::UnitAttr inclusive) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + odsState.addOperands(linear_vars); + odsState.addOperands(linear_step_vars); + odsState.addOperands(reduction_vars); + if (schedule_chunk_var) + odsState.addOperands(schedule_chunk_var); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), static_cast(linear_vars.size()), static_cast(linear_step_vars.size()), static_cast(reduction_vars.size()), (schedule_chunk_var ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (schedule_val) { + odsState.getOrAddProperties().schedule_val = schedule_val; + } + if (schedule_modifier) { + odsState.getOrAddProperties().schedule_modifier = schedule_modifier; + } + if (simd_modifier) { + odsState.getOrAddProperties().simd_modifier = simd_modifier; + } + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + if (ordered_val) { + odsState.getOrAddProperties().ordered_val = ordered_val; + } + if (order_val) { + odsState.getOrAddProperties().order_val = order_val; + } + if (inclusive) { + odsState.getOrAddProperties().inclusive = inclusive; + } + (void)odsState.addRegion(); +} + +void WsLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange linear_vars, ::mlir::ValueRange linear_step_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseScheduleKindAttr schedule_val, /*optional*/::mlir::Value schedule_chunk_var, /*optional*/::mlir::omp::ScheduleModifierAttr schedule_modifier, /*optional*/::mlir::UnitAttr simd_modifier, /*optional*/::mlir::UnitAttr nowait, /*optional*/::mlir::IntegerAttr ordered_val, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::UnitAttr inclusive) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + odsState.addOperands(linear_vars); + odsState.addOperands(linear_step_vars); + odsState.addOperands(reduction_vars); + if (schedule_chunk_var) + odsState.addOperands(schedule_chunk_var); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), static_cast(linear_vars.size()), static_cast(linear_step_vars.size()), static_cast(reduction_vars.size()), (schedule_chunk_var ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (schedule_val) { + odsState.getOrAddProperties().schedule_val = schedule_val; + } + if (schedule_modifier) { + odsState.getOrAddProperties().schedule_modifier = schedule_modifier; + } + if (simd_modifier) { + odsState.getOrAddProperties().simd_modifier = simd_modifier; + } + if (nowait) { + odsState.getOrAddProperties().nowait = nowait; + } + if (ordered_val) { + odsState.getOrAddProperties().ordered_val = ordered_val; + } + if (order_val) { + odsState.getOrAddProperties().order_val = order_val; + } + if (inclusive) { + odsState.getOrAddProperties().inclusive = inclusive; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WsLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange linear_vars, ::mlir::ValueRange linear_step_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseScheduleKindAttr schedule_val, /*optional*/::mlir::Value schedule_chunk_var, /*optional*/::mlir::omp::ScheduleModifierAttr schedule_modifier, /*optional*/bool simd_modifier, /*optional*/bool nowait, /*optional*/::mlir::IntegerAttr ordered_val, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/bool inclusive) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + odsState.addOperands(linear_vars); + odsState.addOperands(linear_step_vars); + odsState.addOperands(reduction_vars); + if (schedule_chunk_var) + odsState.addOperands(schedule_chunk_var); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), static_cast(linear_vars.size()), static_cast(linear_step_vars.size()), static_cast(reduction_vars.size()), (schedule_chunk_var ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (schedule_val) { + odsState.getOrAddProperties().schedule_val = schedule_val; + } + if (schedule_modifier) { + odsState.getOrAddProperties().schedule_modifier = schedule_modifier; + } + if (simd_modifier) { + odsState.getOrAddProperties().simd_modifier = ((simd_modifier) ? odsBuilder.getUnitAttr() : nullptr); + } + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + if (ordered_val) { + odsState.getOrAddProperties().ordered_val = ordered_val; + } + if (order_val) { + odsState.getOrAddProperties().order_val = order_val; + } + if (inclusive) { + odsState.getOrAddProperties().inclusive = ((inclusive) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); +} + +void WsLoopOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange linear_vars, ::mlir::ValueRange linear_step_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseScheduleKindAttr schedule_val, /*optional*/::mlir::Value schedule_chunk_var, /*optional*/::mlir::omp::ScheduleModifierAttr schedule_modifier, /*optional*/bool simd_modifier, /*optional*/bool nowait, /*optional*/::mlir::IntegerAttr ordered_val, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/bool inclusive) { + odsState.addOperands(lowerBound); + odsState.addOperands(upperBound); + odsState.addOperands(step); + odsState.addOperands(linear_vars); + odsState.addOperands(linear_step_vars); + odsState.addOperands(reduction_vars); + if (schedule_chunk_var) + odsState.addOperands(schedule_chunk_var); + ::llvm::copy(::llvm::ArrayRef({static_cast(lowerBound.size()), static_cast(upperBound.size()), static_cast(step.size()), static_cast(linear_vars.size()), static_cast(linear_step_vars.size()), static_cast(reduction_vars.size()), (schedule_chunk_var ? 1 : 0)}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (reductions) { + odsState.getOrAddProperties().reductions = reductions; + } + if (schedule_val) { + odsState.getOrAddProperties().schedule_val = schedule_val; + } + if (schedule_modifier) { + odsState.getOrAddProperties().schedule_modifier = schedule_modifier; + } + if (simd_modifier) { + odsState.getOrAddProperties().simd_modifier = ((simd_modifier) ? odsBuilder.getUnitAttr() : nullptr); + } + if (nowait) { + odsState.getOrAddProperties().nowait = ((nowait) ? odsBuilder.getUnitAttr() : nullptr); + } + if (ordered_val) { + odsState.getOrAddProperties().ordered_val = ordered_val; + } + if (order_val) { + odsState.getOrAddProperties().order_val = order_val; + } + if (inclusive) { + odsState.getOrAddProperties().inclusive = ((inclusive) ? odsBuilder.getUnitAttr() : nullptr); + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void WsLoopOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult WsLoopOp::verifyInvariantsImpl() { + auto tblgen_inclusive = getProperties().inclusive; (void)tblgen_inclusive; + auto tblgen_nowait = getProperties().nowait; (void)tblgen_nowait; + auto tblgen_order_val = getProperties().order_val; (void)tblgen_order_val; + auto tblgen_ordered_val = getProperties().ordered_val; (void)tblgen_ordered_val; + auto tblgen_reductions = getProperties().reductions; (void)tblgen_reductions; + auto tblgen_schedule_modifier = getProperties().schedule_modifier; (void)tblgen_schedule_modifier; + auto tblgen_schedule_val = getProperties().schedule_val; (void)tblgen_schedule_val; + auto tblgen_simd_modifier = getProperties().simd_modifier; (void)tblgen_simd_modifier; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps12(*this, tblgen_reductions, "reductions"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps18(*this, tblgen_schedule_val, "schedule_val"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps19(*this, tblgen_schedule_modifier, "schedule_modifier"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_simd_modifier, "simd_modifier"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_nowait, "nowait"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps10(*this, tblgen_ordered_val, "ordered_val"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps15(*this, tblgen_order_val, "order_val"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_OpenMPOps11(*this, tblgen_inclusive, "inclusive"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup3 = getODSOperands(3); + + for (auto v : valueGroup3) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup4 = getODSOperands(4); + + for (auto v : valueGroup4) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup5 = getODSOperands(5); + + for (auto v : valueGroup5) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup6 = getODSOperands(6); + + if (valueGroup6.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup6.size(); + } + + for (auto v : valueGroup6) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + if (!(((this->getODSOperands(0).getType()) == (this->getODSOperands(1).getType()) && (this->getODSOperands(1).getType()) == (this->getODSOperands(2).getType()) && (this->getODSOperands(2).getType()) == (this->getODSOperands(0).getType())))) + return emitOpError("failed to verify that all of {lowerBound, upperBound, step} have same type"); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_OpenMPOps1(*this, region, "region", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult WsLoopOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult WsLoopOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> linear_varsOperands; + ::llvm::SMLoc linear_varsOperandsLoc; + (void)linear_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> linear_varsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> linear_step_varsOperands; + ::llvm::SMLoc linear_step_varsOperandsLoc; + (void)linear_step_varsOperandsLoc; + ::mlir::omp::ClauseScheduleKindAttr schedule_valAttr; + ::mlir::omp::ScheduleModifierAttr schedule_modifierAttr; + ::mlir::UnitAttr simd_modifierAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> schedule_chunk_varOperands; + ::llvm::SMLoc schedule_chunk_varOperandsLoc; + (void)schedule_chunk_varOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> schedule_chunk_varTypes; + ::mlir::IntegerAttr ordered_valAttr; + ::mlir::omp::ClauseOrderKindAttr order_valAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> reduction_varsOperands; + ::llvm::SMLoc reduction_varsOperandsLoc; + (void)reduction_varsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> reduction_varsTypes; + ::mlir::ArrayAttr reductionsAttr; + std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>(); + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> lowerBoundOperands; + ::llvm::SMLoc lowerBoundOperandsLoc; + (void)lowerBoundOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> upperBoundOperands; + ::llvm::SMLoc upperBoundOperandsLoc; + (void)upperBoundOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> stepOperands; + ::llvm::SMLoc stepOperandsLoc; + (void)stepOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> stepTypes; + ::mlir::UnitAttr inclusiveAttr; + bool linearClause = false; + bool scheduleClause = false; + bool nowaitClause = false; + bool orderedClause = false; + bool orderClause = false; + bool reductionClause = false; + while(true) { +if (succeeded(parser.parseOptionalKeyword("linear"))) { + + if (linearClause) { + return parser.emitError(parser.getNameLoc()) + << "`linear` clause can appear at most once in the expansion of the " + "oilist directive"; + } + linearClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + linear_varsOperandsLoc = parser.getCurrentLocation(); + linear_step_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseLinearClause(parser, linear_varsOperands, linear_varsTypes, linear_step_varsOperands); + if (odsResult) return ::mlir::failure(); + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("schedule"))) { + + if (scheduleClause) { + return parser.emitError(parser.getNameLoc()) + << "`schedule` clause can appear at most once in the expansion of the " + "oilist directive"; + } + scheduleClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + schedule_chunk_varOperandsLoc = parser.getCurrentLocation(); + ::std::optional<::mlir::OpAsmParser::UnresolvedOperand> schedule_chunk_varOperand; + ::mlir::Type schedule_chunk_varType; + auto odsResult = parseScheduleClause(parser, schedule_valAttr, schedule_modifierAttr, simd_modifierAttr, schedule_chunk_varOperand, schedule_chunk_varType); + if (odsResult) return ::mlir::failure(); + if (schedule_valAttr) + result.getOrAddProperties().schedule_val = schedule_valAttr; + if (schedule_modifierAttr) + result.getOrAddProperties().schedule_modifier = schedule_modifierAttr; + if (simd_modifierAttr) + result.getOrAddProperties().simd_modifier = simd_modifierAttr; + if (schedule_chunk_varOperand.has_value()) + schedule_chunk_varOperands.push_back(*schedule_chunk_varOperand); + if (schedule_chunk_varType) + schedule_chunk_varTypes.push_back(schedule_chunk_varType); + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("nowait"))) { + + if (nowaitClause) { + return parser.emitError(parser.getNameLoc()) + << "`nowait` clause can appear at most once in the expansion of the " + "oilist directive"; + } + nowaitClause = true; + result.getOrAddProperties().nowait = parser.getBuilder().getUnitAttr(); } else if (succeeded(parser.parseOptionalKeyword("ordered"))) { + + if (orderedClause) { + return parser.emitError(parser.getNameLoc()) + << "`ordered` clause can appear at most once in the expansion of the " + "oilist directive"; + } + orderedClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + + ::mlir::OptionalParseResult parseResultordered_valAttr = + parser.parseOptionalAttribute(ordered_valAttr, parser.getBuilder().getIntegerType(64)); + if (parseResultordered_valAttr.has_value() && failed(*parseResultordered_valAttr)) + return ::mlir::failure(); + if (parseResultordered_valAttr.has_value() && succeeded(*parseResultordered_valAttr)) + if (ordered_valAttr) result.getOrAddProperties().ordered_val = ordered_valAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("order"))) { + + if (orderClause) { + return parser.emitError(parser.getNameLoc()) + << "`order` clause can appear at most once in the expansion of the " + "oilist directive"; + } + orderClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + auto odsResult = parseClauseAttr(parser, order_valAttr); + if (odsResult) return ::mlir::failure(); + if (order_valAttr) + result.getOrAddProperties().order_val = order_valAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else if (succeeded(parser.parseOptionalKeyword("reduction"))) { + + if (reductionClause) { + return parser.emitError(parser.getNameLoc()) + << "`reduction` clause can appear at most once in the expansion of the " + "oilist directive"; + } + reductionClause = true; + if (parser.parseLParen()) + return ::mlir::failure(); + { + reduction_varsOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseReductionVarList(parser, reduction_varsOperands, reduction_varsTypes, reductionsAttr); + if (odsResult) return ::mlir::failure(); + if (reductionsAttr) + result.getOrAddProperties().reductions = reductionsAttr; + } + if (parser.parseRParen()) + return ::mlir::failure(); + } else { + break; + } +} + if (parser.parseKeyword("for")) + return ::mlir::failure(); + { + lowerBoundOperandsLoc = parser.getCurrentLocation(); + upperBoundOperandsLoc = parser.getCurrentLocation(); + stepOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseLoopControl(parser, *regionRegion, lowerBoundOperands, upperBoundOperands, stepOperands, stepTypes, inclusiveAttr); + if (odsResult) return ::mlir::failure(); + if (inclusiveAttr) + result.getOrAddProperties().inclusive = inclusiveAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(regionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(lowerBoundOperands.size()), static_cast(upperBoundOperands.size()), static_cast(stepOperands.size()), static_cast(linear_varsOperands.size()), static_cast(linear_step_varsOperands.size()), static_cast(reduction_varsOperands.size()), static_cast(schedule_chunk_varOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32); + if (parser.resolveOperands(lowerBoundOperands, stepTypes, lowerBoundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(upperBoundOperands, stepTypes, upperBoundOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(stepOperands, stepTypes, stepOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(linear_varsOperands, linear_varsTypes, linear_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(linear_step_varsOperands, odsBuildableType0, linear_step_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(reduction_varsOperands, reduction_varsTypes, reduction_varsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(schedule_chunk_varOperands, schedule_chunk_varTypes, schedule_chunk_varOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void WsLoopOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << " "; + if (false || getLinearVars().size() || getLinearStepVars().size()) { + _odsPrinter << ' ' << "linear"; + _odsPrinter << "("; + printLinearClause(_odsPrinter, *this, getLinearVars(), getLinearVars().getTypes(), getLinearStepVars()); + _odsPrinter << ")"; + } + if (false || getScheduleValAttr() || getScheduleModifierAttr() || getSimdModifierAttr() || getScheduleChunkVar()) { + _odsPrinter << ' ' << "schedule"; + _odsPrinter << "("; + printScheduleClause(_odsPrinter, *this, getScheduleValAttr(), getScheduleModifierAttr(), getSimdModifierAttr(), getScheduleChunkVar(), (getScheduleChunkVar() ? getScheduleChunkVar().getType() : ::mlir::Type())); + _odsPrinter << ")"; + } + if (false || getNowaitAttr()) { + _odsPrinter << ' ' << "nowait"; + } + if (false || getOrderedValAttr()) { + _odsPrinter << ' ' << "ordered"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getOrderedValAttr()); + _odsPrinter << ")"; + } + if (false || getOrderValAttr()) { + _odsPrinter << ' ' << "order"; + _odsPrinter << "("; + printClauseAttr(_odsPrinter, *this, getOrderValAttr()); + _odsPrinter << ")"; + } + if (false || getReductionVars().size() || getReductionsAttr()) { + _odsPrinter << ' ' << "reduction"; + _odsPrinter << "("; + printReductionVarList(_odsPrinter, *this, getReductionVars(), getReductionVars().getTypes(), getReductionsAttr()); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << "for"; + _odsPrinter << ' '; + printLoopControl(_odsPrinter, *this, getRegion(), getLowerBound(), getUpperBound(), getStep(), getStep().getTypes(), getInclusiveAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("schedule_val"); + elidedAttrs.push_back("schedule_modifier"); + elidedAttrs.push_back("simd_modifier"); + elidedAttrs.push_back("nowait"); + elidedAttrs.push_back("ordered_val"); + elidedAttrs.push_back("order_val"); + elidedAttrs.push_back("reductions"); + elidedAttrs.push_back("inclusive"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getSimdModifierAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("simd_modifier"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getNowaitAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("nowait"); + } + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getInclusiveAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("inclusive"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::WsLoopOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::YieldOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("omp.yield", odsAttrs.getContext()); +} + +YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(YieldOp op) : YieldOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair YieldOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr YieldOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +YieldOpAdaptor::YieldOpAdaptor(YieldOp op) : YieldOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult YieldOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair YieldOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range YieldOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range YieldOp::getResults() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange YieldOp::getResultsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair YieldOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range YieldOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + build(odsBuilder, odsState, {}); +} + +void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange results) { + odsState.addOperands(results); +} + +void YieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult YieldOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_OpenMPOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult YieldOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult YieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> resultsOperands; + ::llvm::SMLoc resultsOperandsLoc; + (void)resultsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> resultsTypes; + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + resultsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(resultsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(resultsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.resolveOperands(resultsOperands, resultsTypes, resultsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void YieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (!getResults().empty()) { + _odsPrinter << "("; + _odsPrinter << getResults(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getResults().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void YieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +::mlir::MutableOperandRange YieldOp::getMutableSuccessorOperands( + ::mlir::RegionBranchPoint point) { + return ::mlir::MutableOperandRange(*this); +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..78f83acda0123002419f4ae40df74bc191b7e53b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.h.inc @@ -0,0 +1,7002 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenMPOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace omp { +class AtomicCaptureOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class AtomicReadOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class AtomicUpdateOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class AtomicWriteOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class BarrierOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class CancelOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class CancellationPointOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class CriticalDeclareOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class CriticalOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class DataBoundsOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class FlushOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class MapInfoOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class MasterOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class OrderedOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class OrderedRegionOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class ParallelOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class ReductionDeclareOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class ReductionOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class SectionOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class SectionsOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class SimdLoopOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class SingleOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class TargetOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class DataOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class EnterDataOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class ExitDataOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class TaskGroupOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class TaskLoopOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class TaskOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class TaskwaitOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class TaskyieldOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class TeamsOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class TerminatorOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class ThreadprivateOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class WsLoopOp; +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class YieldOp; +} // namespace omp +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::AtomicCaptureOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicCaptureOpGenericAdaptorBase { +public: + struct Properties { + using hint_valTy = ::mlir::IntegerAttr; + hint_valTy hint_val; + + auto getHintVal() { + auto &propStorage = this->hint_val; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setHintVal(const ::mlir::IntegerAttr &propValue) { + this->hint_val = propValue; + } + using memory_order_valTy = ::mlir::omp::ClauseMemoryOrderKindAttr; + memory_order_valTy memory_order_val; + + auto getMemoryOrderVal() { + auto &propStorage = this->memory_order_val; + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(propStorage); + } + void setMemoryOrderVal(const ::mlir::omp::ClauseMemoryOrderKindAttr &propValue) { + this->memory_order_val = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.hint_val == this->hint_val && + rhs.memory_order_val == this->memory_order_val && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AtomicCaptureOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicCaptureOpGenericAdaptorBase(AtomicCaptureOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); + ::mlir::omp::ClauseMemoryOrderKindAttr getMemoryOrderValAttr(); + ::std::optional<::mlir::omp::ClauseMemoryOrderKind> getMemoryOrderVal(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AtomicCaptureOpGenericAdaptor : public detail::AtomicCaptureOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicCaptureOpGenericAdaptorBase; +public: + AtomicCaptureOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicCaptureOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicCaptureOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AtomicCaptureOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicCaptureOpAdaptor : public AtomicCaptureOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicCaptureOpGenericAdaptor::AtomicCaptureOpGenericAdaptor; + AtomicCaptureOpAdaptor(AtomicCaptureOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicCaptureOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::accomp::AtomicCaptureOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicCaptureOpAdaptor; + template + using GenericAdaptor = AtomicCaptureOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("hint_val"), ::llvm::StringRef("memory_order_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getHintValAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getHintValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMemoryOrderValAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMemoryOrderValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.atomic.capture"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); + ::mlir::omp::ClauseMemoryOrderKindAttr getMemoryOrderValAttr(); + ::std::optional<::mlir::omp::ClauseMemoryOrderKind> getMemoryOrderVal(); + void setHintValAttr(::mlir::IntegerAttr attr); + void setHintVal(::std::optional attrValue); + void setMemoryOrderValAttr(::mlir::omp::ClauseMemoryOrderKindAttr attr); + void setMemoryOrderVal(::std::optional<::mlir::omp::ClauseMemoryOrderKind> attrValue); + ::mlir::Attribute removeHintValAttr(); + ::mlir::Attribute removeMemoryOrderValAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the `atomic.read` operation inside the region, if any. + /// Otherwise, it returns nullptr. + AtomicReadOp getAtomicReadOp(); + + /// Returns the `atomic.write` operation inside the region, if any. + /// Otherwise, it returns nullptr. + AtomicWriteOp getAtomicWriteOp(); + + /// Returns the `atomic.update` operation inside the region, if any. + /// Otherwise, it returns nullptr. + AtomicUpdateOp getAtomicUpdateOp(); +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::AtomicCaptureOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::AtomicReadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicReadOpGenericAdaptorBase { +public: + struct Properties { + using element_typeTy = ::mlir::TypeAttr; + element_typeTy element_type; + + auto getElementType() { + auto &propStorage = this->element_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setElementType(const ::mlir::TypeAttr &propValue) { + this->element_type = propValue; + } + using hint_valTy = ::mlir::IntegerAttr; + hint_valTy hint_val; + + auto getHintVal() { + auto &propStorage = this->hint_val; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setHintVal(const ::mlir::IntegerAttr &propValue) { + this->hint_val = propValue; + } + using memory_order_valTy = ::mlir::omp::ClauseMemoryOrderKindAttr; + memory_order_valTy memory_order_val; + + auto getMemoryOrderVal() { + auto &propStorage = this->memory_order_val; + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(propStorage); + } + void setMemoryOrderVal(const ::mlir::omp::ClauseMemoryOrderKindAttr &propValue) { + this->memory_order_val = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.element_type == this->element_type && + rhs.hint_val == this->hint_val && + rhs.memory_order_val == this->memory_order_val && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AtomicReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicReadOpGenericAdaptorBase(AtomicReadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getElementTypeAttr(); + ::mlir::Type getElementType(); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); + ::mlir::omp::ClauseMemoryOrderKindAttr getMemoryOrderValAttr(); + ::std::optional<::mlir::omp::ClauseMemoryOrderKind> getMemoryOrderVal(); +}; +} // namespace detail +template +class AtomicReadOpGenericAdaptor : public detail::AtomicReadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicReadOpGenericAdaptorBase; +public: + AtomicReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicReadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AtomicReadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getV() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicReadOpAdaptor : public AtomicReadOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicReadOpGenericAdaptor::AtomicReadOpGenericAdaptor; + AtomicReadOpAdaptor(AtomicReadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicReadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::accomp::AtomicReadOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicReadOpAdaptor; + template + using GenericAdaptor = AtomicReadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_type"), ::llvm::StringRef("hint_val"), ::llvm::StringRef("memory_order_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getHintValAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getHintValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMemoryOrderValAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMemoryOrderValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.atomic.read"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getX(); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getV(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getVMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypeAttr getElementTypeAttr(); + ::mlir::Type getElementType(); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); + ::mlir::omp::ClauseMemoryOrderKindAttr getMemoryOrderValAttr(); + ::std::optional<::mlir::omp::ClauseMemoryOrderKind> getMemoryOrderVal(); + void setElementTypeAttr(::mlir::TypeAttr attr); + void setElementType(::mlir::Type attrValue); + void setHintValAttr(::mlir::IntegerAttr attr); + void setHintVal(::std::optional attrValue); + void setMemoryOrderValAttr(::mlir::omp::ClauseMemoryOrderKindAttr attr); + void setMemoryOrderVal(::std::optional<::mlir::omp::ClauseMemoryOrderKind> attrValue); + ::mlir::Attribute removeHintValAttr(); + ::mlir::Attribute removeMemoryOrderValAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of variable operands. + unsigned getNumVariableOperands() { + assert(getX() && "expected 'x' operand"); + assert(getV() && "expected 'v' operand"); + return 2; + } + + /// The i-th variable operand passed. + Value getVariableOperand(unsigned i) { + assert(i < 2 && "invalid index position for an operand"); + return i == 0 ? getX() : getV(); + } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::AtomicReadOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::AtomicUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicUpdateOpGenericAdaptorBase { +public: + struct Properties { + using hint_valTy = ::mlir::IntegerAttr; + hint_valTy hint_val; + + auto getHintVal() { + auto &propStorage = this->hint_val; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setHintVal(const ::mlir::IntegerAttr &propValue) { + this->hint_val = propValue; + } + using memory_order_valTy = ::mlir::omp::ClauseMemoryOrderKindAttr; + memory_order_valTy memory_order_val; + + auto getMemoryOrderVal() { + auto &propStorage = this->memory_order_val; + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(propStorage); + } + void setMemoryOrderVal(const ::mlir::omp::ClauseMemoryOrderKindAttr &propValue) { + this->memory_order_val = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.hint_val == this->hint_val && + rhs.memory_order_val == this->memory_order_val && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AtomicUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicUpdateOpGenericAdaptorBase(AtomicUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); + ::mlir::omp::ClauseMemoryOrderKindAttr getMemoryOrderValAttr(); + ::std::optional<::mlir::omp::ClauseMemoryOrderKind> getMemoryOrderVal(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AtomicUpdateOpGenericAdaptor : public detail::AtomicUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicUpdateOpGenericAdaptorBase; +public: + AtomicUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AtomicUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicUpdateOpAdaptor : public AtomicUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicUpdateOpGenericAdaptor::AtomicUpdateOpGenericAdaptor; + AtomicUpdateOpAdaptor(AtomicUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::accomp::AtomicUpdateOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicUpdateOpAdaptor; + template + using GenericAdaptor = AtomicUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("hint_val"), ::llvm::StringRef("memory_order_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getHintValAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getHintValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMemoryOrderValAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMemoryOrderValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.atomic.update"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); + ::mlir::omp::ClauseMemoryOrderKindAttr getMemoryOrderValAttr(); + ::std::optional<::mlir::omp::ClauseMemoryOrderKind> getMemoryOrderVal(); + void setHintValAttr(::mlir::IntegerAttr attr); + void setHintVal(::std::optional attrValue); + void setMemoryOrderValAttr(::mlir::omp::ClauseMemoryOrderKindAttr attr); + void setMemoryOrderVal(::std::optional<::mlir::omp::ClauseMemoryOrderKind> attrValue); + ::mlir::Attribute removeHintValAttr(); + ::mlir::Attribute removeMemoryOrderValAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::LogicalResult canonicalize(AtomicUpdateOp op, ::mlir::PatternRewriter &rewriter); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of variable operands. + unsigned getNumVariableOperands() { + assert(getX() && "expected 'x' operand"); + return 1; + } + + /// The i-th variable operand passed. + Value getVariableOperand(unsigned i) { + assert(i == 0 && "invalid index position for an operand"); + return getX(); + } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::AtomicUpdateOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::AtomicWriteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtomicWriteOpGenericAdaptorBase { +public: + struct Properties { + using hint_valTy = ::mlir::IntegerAttr; + hint_valTy hint_val; + + auto getHintVal() { + auto &propStorage = this->hint_val; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setHintVal(const ::mlir::IntegerAttr &propValue) { + this->hint_val = propValue; + } + using memory_order_valTy = ::mlir::omp::ClauseMemoryOrderKindAttr; + memory_order_valTy memory_order_val; + + auto getMemoryOrderVal() { + auto &propStorage = this->memory_order_val; + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseMemoryOrderKindAttr>(propStorage); + } + void setMemoryOrderVal(const ::mlir::omp::ClauseMemoryOrderKindAttr &propValue) { + this->memory_order_val = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.hint_val == this->hint_val && + rhs.memory_order_val == this->memory_order_val && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AtomicWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AtomicWriteOpGenericAdaptorBase(AtomicWriteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); + ::mlir::omp::ClauseMemoryOrderKindAttr getMemoryOrderValAttr(); + ::std::optional<::mlir::omp::ClauseMemoryOrderKind> getMemoryOrderVal(); +}; +} // namespace detail +template +class AtomicWriteOpGenericAdaptor : public detail::AtomicWriteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtomicWriteOpGenericAdaptorBase; +public: + AtomicWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtomicWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtomicWriteOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AtomicWriteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getExpr() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtomicWriteOpAdaptor : public AtomicWriteOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtomicWriteOpGenericAdaptor::AtomicWriteOpGenericAdaptor; + AtomicWriteOpAdaptor(AtomicWriteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtomicWriteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::accomp::AtomicWriteOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtomicWriteOpAdaptor; + template + using GenericAdaptor = AtomicWriteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("hint_val"), ::llvm::StringRef("memory_order_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getHintValAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getHintValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMemoryOrderValAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMemoryOrderValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.atomic.write"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getX(); + ::mlir::Value getExpr(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getExprMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); + ::mlir::omp::ClauseMemoryOrderKindAttr getMemoryOrderValAttr(); + ::std::optional<::mlir::omp::ClauseMemoryOrderKind> getMemoryOrderVal(); + void setHintValAttr(::mlir::IntegerAttr attr); + void setHintVal(::std::optional attrValue); + void setMemoryOrderValAttr(::mlir::omp::ClauseMemoryOrderKindAttr attr); + void setMemoryOrderVal(::std::optional<::mlir::omp::ClauseMemoryOrderKind> attrValue); + ::mlir::Attribute removeHintValAttr(); + ::mlir::Attribute removeMemoryOrderValAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::IntegerAttr hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value expr, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value expr, /*optional*/uint64_t hint_val, /*optional*/::mlir::omp::ClauseMemoryOrderKindAttr memory_order_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of variable operands. + unsigned getNumVariableOperands() { + assert(getX() && "expected address operand"); + assert(getExpr() && "expected value operand"); + return 2; + } + + /// The i-th variable operand passed. + Value getVariableOperand(unsigned i) { + assert(i < 2 && "invalid index position for an operand"); + return i == 0 ? getX() : getExpr(); + } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::AtomicWriteOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::BarrierOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BarrierOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BarrierOpGenericAdaptorBase(BarrierOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BarrierOpGenericAdaptor : public detail::BarrierOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BarrierOpGenericAdaptorBase; +public: + BarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BarrierOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BarrierOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BarrierOpAdaptor : public BarrierOpGenericAdaptor<::mlir::ValueRange> { +public: + using BarrierOpGenericAdaptor::BarrierOpGenericAdaptor; + BarrierOpAdaptor(BarrierOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BarrierOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BarrierOpAdaptor; + template + using GenericAdaptor = BarrierOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.barrier"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::BarrierOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::CancelOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CancelOpGenericAdaptorBase { +public: + struct Properties { + using cancellation_construct_type_valTy = ::mlir::omp::ClauseCancellationConstructTypeAttr; + cancellation_construct_type_valTy cancellation_construct_type_val; + + auto getCancellationConstructTypeVal() { + auto &propStorage = this->cancellation_construct_type_val; + return ::llvm::cast<::mlir::omp::ClauseCancellationConstructTypeAttr>(propStorage); + } + void setCancellationConstructTypeVal(const ::mlir::omp::ClauseCancellationConstructTypeAttr &propValue) { + this->cancellation_construct_type_val = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.cancellation_construct_type_val == this->cancellation_construct_type_val && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CancelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CancelOpGenericAdaptorBase(CancelOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::omp::ClauseCancellationConstructTypeAttr getCancellationConstructTypeValAttr(); + ::mlir::omp::ClauseCancellationConstructType getCancellationConstructTypeVal(); +}; +} // namespace detail +template +class CancelOpGenericAdaptor : public detail::CancelOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CancelOpGenericAdaptorBase; +public: + CancelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CancelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CancelOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CancelOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CancelOpAdaptor : public CancelOpGenericAdaptor<::mlir::ValueRange> { +public: + using CancelOpGenericAdaptor::CancelOpGenericAdaptor; + CancelOpAdaptor(CancelOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CancelOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CancelOpAdaptor; + template + using GenericAdaptor = CancelOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cancellation_construct_type_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCancellationConstructTypeValAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCancellationConstructTypeValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.cancel"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfExpr(); + ::mlir::MutableOperandRange getIfExprMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::omp::ClauseCancellationConstructTypeAttr getCancellationConstructTypeValAttr(); + ::mlir::omp::ClauseCancellationConstructType getCancellationConstructTypeVal(); + void setCancellationConstructTypeValAttr(::mlir::omp::ClauseCancellationConstructTypeAttr attr); + void setCancellationConstructTypeVal(::mlir::omp::ClauseCancellationConstructType attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_val, /*optional*/::mlir::Value if_expr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_val, /*optional*/::mlir::Value if_expr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::omp::ClauseCancellationConstructType cancellation_construct_type_val, /*optional*/::mlir::Value if_expr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::omp::ClauseCancellationConstructType cancellation_construct_type_val, /*optional*/::mlir::Value if_expr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::CancelOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::CancellationPointOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CancellationPointOpGenericAdaptorBase { +public: + struct Properties { + using cancellation_construct_type_valTy = ::mlir::omp::ClauseCancellationConstructTypeAttr; + cancellation_construct_type_valTy cancellation_construct_type_val; + + auto getCancellationConstructTypeVal() { + auto &propStorage = this->cancellation_construct_type_val; + return ::llvm::cast<::mlir::omp::ClauseCancellationConstructTypeAttr>(propStorage); + } + void setCancellationConstructTypeVal(const ::mlir::omp::ClauseCancellationConstructTypeAttr &propValue) { + this->cancellation_construct_type_val = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.cancellation_construct_type_val == this->cancellation_construct_type_val && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CancellationPointOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CancellationPointOpGenericAdaptorBase(CancellationPointOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::omp::ClauseCancellationConstructTypeAttr getCancellationConstructTypeValAttr(); + ::mlir::omp::ClauseCancellationConstructType getCancellationConstructTypeVal(); +}; +} // namespace detail +template +class CancellationPointOpGenericAdaptor : public detail::CancellationPointOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CancellationPointOpGenericAdaptorBase; +public: + CancellationPointOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CancellationPointOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CancellationPointOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CancellationPointOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CancellationPointOpAdaptor : public CancellationPointOpGenericAdaptor<::mlir::ValueRange> { +public: + using CancellationPointOpGenericAdaptor::CancellationPointOpGenericAdaptor; + CancellationPointOpAdaptor(CancellationPointOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CancellationPointOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CancellationPointOpAdaptor; + template + using GenericAdaptor = CancellationPointOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cancellation_construct_type_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCancellationConstructTypeValAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCancellationConstructTypeValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.cancellationpoint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::omp::ClauseCancellationConstructTypeAttr getCancellationConstructTypeValAttr(); + ::mlir::omp::ClauseCancellationConstructType getCancellationConstructTypeVal(); + void setCancellationConstructTypeValAttr(::mlir::omp::ClauseCancellationConstructTypeAttr attr); + void setCancellationConstructTypeVal(::mlir::omp::ClauseCancellationConstructType attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::omp::ClauseCancellationConstructTypeAttr cancellation_construct_type_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::omp::ClauseCancellationConstructType cancellation_construct_type_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::omp::ClauseCancellationConstructType cancellation_construct_type_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::CancellationPointOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::CriticalDeclareOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CriticalDeclareOpGenericAdaptorBase { +public: + struct Properties { + using hint_valTy = ::mlir::IntegerAttr; + hint_valTy hint_val; + + auto getHintVal() { + auto &propStorage = this->hint_val; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setHintVal(const ::mlir::IntegerAttr &propValue) { + this->hint_val = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.hint_val == this->hint_val && + rhs.sym_name == this->sym_name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CriticalDeclareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CriticalDeclareOpGenericAdaptorBase(CriticalDeclareOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); +}; +} // namespace detail +template +class CriticalDeclareOpGenericAdaptor : public detail::CriticalDeclareOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CriticalDeclareOpGenericAdaptorBase; +public: + CriticalDeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CriticalDeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CriticalDeclareOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CriticalDeclareOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CriticalDeclareOpAdaptor : public CriticalDeclareOpGenericAdaptor<::mlir::ValueRange> { +public: + using CriticalDeclareOpGenericAdaptor::CriticalDeclareOpGenericAdaptor; + CriticalDeclareOpAdaptor(CriticalDeclareOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CriticalDeclareOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CriticalDeclareOpAdaptor; + template + using GenericAdaptor = CriticalDeclareOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("hint_val"), ::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getHintValAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getHintValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.critical.declare"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::IntegerAttr getHintValAttr(); + uint64_t getHintVal(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setHintValAttr(::mlir::IntegerAttr attr); + void setHintVal(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::IntegerAttr hint_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::IntegerAttr hint_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, uint64_t hint_val = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, uint64_t hint_val = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::CriticalDeclareOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::CriticalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CriticalOpGenericAdaptorBase { +public: + struct Properties { + using nameTy = ::mlir::FlatSymbolRefAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setName(const ::mlir::FlatSymbolRefAttr &propValue) { + this->name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.name == this->name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CriticalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CriticalOpGenericAdaptorBase(CriticalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class CriticalOpGenericAdaptor : public detail::CriticalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CriticalOpGenericAdaptorBase; +public: + CriticalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CriticalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CriticalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CriticalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CriticalOpAdaptor : public CriticalOpGenericAdaptor<::mlir::ValueRange> { +public: + using CriticalOpGenericAdaptor::CriticalOpGenericAdaptor; + CriticalOpAdaptor(CriticalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CriticalOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CriticalOpAdaptor; + template + using GenericAdaptor = CriticalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.critical"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::FlatSymbolRefAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setNameAttr(::mlir::FlatSymbolRefAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::FlatSymbolRefAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::FlatSymbolRefAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::CriticalOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::DataBoundsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DataBoundsOpGenericAdaptorBase { +public: + struct Properties { + using stride_in_bytesTy = ::mlir::BoolAttr; + stride_in_bytesTy stride_in_bytes; + + auto getStrideInBytes() { + auto &propStorage = this->stride_in_bytes; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setStrideInBytes(const ::mlir::BoolAttr &propValue) { + this->stride_in_bytes = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.stride_in_bytes == this->stride_in_bytes && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DataBoundsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DataBoundsOpGenericAdaptorBase(DataBoundsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getStrideInBytesAttr(); + bool getStrideInBytes(); +}; +} // namespace detail +template +class DataBoundsOpGenericAdaptor : public detail::DataBoundsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DataBoundsOpGenericAdaptorBase; +public: + DataBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DataBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DataBoundsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DataBoundsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLowerBound() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getUpperBound() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getExtent() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getStride() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getStartIdx() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DataBoundsOpAdaptor : public DataBoundsOpGenericAdaptor<::mlir::ValueRange> { +public: + using DataBoundsOpGenericAdaptor::DataBoundsOpGenericAdaptor; + DataBoundsOpAdaptor(DataBoundsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DataBoundsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DataBoundsOpAdaptor; + template + using GenericAdaptor = DataBoundsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("stride_in_bytes"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getStrideInBytesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getStrideInBytesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.bounds"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLowerBound(); + ::mlir::Value getUpperBound(); + ::mlir::Value getExtent(); + ::mlir::Value getStride(); + ::mlir::Value getStartIdx(); + ::mlir::MutableOperandRange getLowerBoundMutable(); + ::mlir::MutableOperandRange getUpperBoundMutable(); + ::mlir::MutableOperandRange getExtentMutable(); + ::mlir::MutableOperandRange getStrideMutable(); + ::mlir::MutableOperandRange getStartIdxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::omp::DataBoundsType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::BoolAttr getStrideInBytesAttr(); + bool getStrideInBytes(); + void setStrideInBytesAttr(::mlir::BoolAttr attr); + void setStrideInBytes(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lower_bound, /*optional*/::mlir::Value upper_bound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr stride_in_bytes, /*optional*/::mlir::Value start_idx); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lower_bound, /*optional*/::mlir::Value upper_bound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr stride_in_bytes, /*optional*/::mlir::Value start_idx); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lower_bound, /*optional*/::mlir::Value upper_bound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool stride_in_bytes, /*optional*/::mlir::Value start_idx); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lower_bound, /*optional*/::mlir::Value upper_bound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool stride_in_bytes, /*optional*/::mlir::Value start_idx); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of variable operands. + unsigned getNumVariableOperands() { + return getNumOperands(); + } + + /// The i-th variable operand passed. + Value getVariableOperand(unsigned i) { + return getOperands()[i]; + } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::DataBoundsOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::FlushOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FlushOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FlushOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FlushOpGenericAdaptorBase(FlushOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FlushOpGenericAdaptor : public detail::FlushOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FlushOpGenericAdaptorBase; +public: + FlushOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FlushOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FlushOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FlushOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getVarList() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FlushOpAdaptor : public FlushOpGenericAdaptor<::mlir::ValueRange> { +public: + using FlushOpGenericAdaptor::FlushOpGenericAdaptor; + FlushOpAdaptor(FlushOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FlushOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FlushOpAdaptor; + template + using GenericAdaptor = FlushOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.flush"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getVarList(); + ::mlir::MutableOperandRange getVarListMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange varList); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + /// The number of variable operands. + unsigned getNumVariableOperands() { + return getOperation()->getNumOperands(); + } + /// The i-th variable operand passed. + Value getVariableOperand(unsigned i) { + return getOperand(i); + } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::FlushOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::MapInfoOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MapInfoOpGenericAdaptorBase { +public: + struct Properties { + using implicitTy = ::mlir::BoolAttr; + implicitTy implicit; + + auto getImplicit() { + auto &propStorage = this->implicit; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setImplicit(const ::mlir::BoolAttr &propValue) { + this->implicit = propValue; + } + using map_capture_typeTy = ::mlir::omp::VariableCaptureKindAttr; + map_capture_typeTy map_capture_type; + + auto getMapCaptureType() { + auto &propStorage = this->map_capture_type; + return ::llvm::dyn_cast_or_null<::mlir::omp::VariableCaptureKindAttr>(propStorage); + } + void setMapCaptureType(const ::mlir::omp::VariableCaptureKindAttr &propValue) { + this->map_capture_type = propValue; + } + using map_typeTy = ::mlir::IntegerAttr; + map_typeTy map_type; + + auto getMapType() { + auto &propStorage = this->map_type; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setMapType(const ::mlir::IntegerAttr &propValue) { + this->map_type = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.implicit == this->implicit && + rhs.map_capture_type == this->map_capture_type && + rhs.map_type == this->map_type && + rhs.name == this->name && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + MapInfoOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + MapInfoOpGenericAdaptorBase(MapInfoOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMapTypeAttr(); + ::std::optional getMapType(); + ::mlir::omp::VariableCaptureKindAttr getMapCaptureTypeAttr(); + ::std::optional<::mlir::omp::VariableCaptureKind> getMapCaptureType(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); +}; +} // namespace detail +template +class MapInfoOpGenericAdaptor : public detail::MapInfoOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MapInfoOpGenericAdaptorBase; +public: + MapInfoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MapInfoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MapInfoOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + MapInfoOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVarPtr() { + return (*getODSOperands(0).begin()); + } + + ValueT getVarPtrPtr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getBounds() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MapInfoOpAdaptor : public MapInfoOpGenericAdaptor<::mlir::ValueRange> { +public: + using MapInfoOpGenericAdaptor::MapInfoOpGenericAdaptor; + MapInfoOpAdaptor(MapInfoOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MapInfoOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MapInfoOpAdaptor; + template + using GenericAdaptor = MapInfoOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("implicit"), ::llvm::StringRef("map_capture_type"), ::llvm::StringRef("map_type"), ::llvm::StringRef("name"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getImplicitAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMapCaptureTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMapCaptureTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMapTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMapTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.map_info"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getVarPtr(); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getVarPtrPtr(); + ::mlir::Operation::operand_range getBounds(); + ::mlir::OpOperand &getVarPtrMutable(); + ::mlir::MutableOperandRange getVarPtrPtrMutable(); + ::mlir::MutableOperandRange getBoundsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getOmpPtr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getMapTypeAttr(); + ::std::optional getMapType(); + ::mlir::omp::VariableCaptureKindAttr getMapCaptureTypeAttr(); + ::std::optional<::mlir::omp::VariableCaptureKind> getMapCaptureType(); + ::mlir::BoolAttr getImplicitAttr(); + bool getImplicit(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setMapTypeAttr(::mlir::IntegerAttr attr); + void setMapType(::std::optional attrValue); + void setMapCaptureTypeAttr(::mlir::omp::VariableCaptureKindAttr attr); + void setMapCaptureType(::std::optional<::mlir::omp::VariableCaptureKind> attrValue); + void setImplicitAttr(::mlir::BoolAttr attr); + void setImplicit(bool attrValue); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMapTypeAttr(); + ::mlir::Attribute removeMapCaptureTypeAttr(); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type omp_ptr, ::mlir::Value var_ptr, /*optional*/::mlir::Value var_ptr_ptr, ::mlir::ValueRange bounds, /*optional*/::mlir::IntegerAttr map_type, /*optional*/::mlir::omp::VariableCaptureKindAttr map_capture_type, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var_ptr, /*optional*/::mlir::Value var_ptr_ptr, ::mlir::ValueRange bounds, /*optional*/::mlir::IntegerAttr map_type, /*optional*/::mlir::omp::VariableCaptureKindAttr map_capture_type, ::mlir::BoolAttr implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type omp_ptr, ::mlir::Value var_ptr, /*optional*/::mlir::Value var_ptr_ptr, ::mlir::ValueRange bounds, /*optional*/::mlir::IntegerAttr map_type, /*optional*/::mlir::omp::VariableCaptureKindAttr map_capture_type, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var_ptr, /*optional*/::mlir::Value var_ptr_ptr, ::mlir::ValueRange bounds, /*optional*/::mlir::IntegerAttr map_type, /*optional*/::mlir::omp::VariableCaptureKindAttr map_capture_type, bool implicit, /*optional*/::mlir::StringAttr name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// The number of variable operands. + unsigned getNumVariableOperands() { + return getNumOperands(); + } + + /// The i-th variable operand passed. + Value getVariableOperand(unsigned i) { + return getOperands()[i]; + } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::MapInfoOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::MasterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MasterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MasterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MasterOpGenericAdaptorBase(MasterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MasterOpGenericAdaptor : public detail::MasterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MasterOpGenericAdaptorBase; +public: + MasterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MasterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MasterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MasterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MasterOpAdaptor : public MasterOpGenericAdaptor<::mlir::ValueRange> { +public: + using MasterOpGenericAdaptor::MasterOpGenericAdaptor; + MasterOpAdaptor(MasterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MasterOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = MasterOpAdaptor; + template + using GenericAdaptor = MasterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.master"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::MasterOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::OrderedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OrderedOpGenericAdaptorBase { +public: + struct Properties { + using depend_type_valTy = ::mlir::omp::ClauseDependAttr; + depend_type_valTy depend_type_val; + + auto getDependTypeVal() { + auto &propStorage = this->depend_type_val; + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseDependAttr>(propStorage); + } + void setDependTypeVal(const ::mlir::omp::ClauseDependAttr &propValue) { + this->depend_type_val = propValue; + } + using num_loops_valTy = ::mlir::IntegerAttr; + num_loops_valTy num_loops_val; + + auto getNumLoopsVal() { + auto &propStorage = this->num_loops_val; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setNumLoopsVal(const ::mlir::IntegerAttr &propValue) { + this->num_loops_val = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.depend_type_val == this->depend_type_val && + rhs.num_loops_val == this->num_loops_val && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + OrderedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + OrderedOpGenericAdaptorBase(OrderedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::omp::ClauseDependAttr getDependTypeValAttr(); + ::std::optional<::mlir::omp::ClauseDepend> getDependTypeVal(); + ::mlir::IntegerAttr getNumLoopsValAttr(); + ::std::optional getNumLoopsVal(); +}; +} // namespace detail +template +class OrderedOpGenericAdaptor : public detail::OrderedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OrderedOpGenericAdaptorBase; +public: + OrderedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OrderedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OrderedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + OrderedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDependVecVars() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OrderedOpAdaptor : public OrderedOpGenericAdaptor<::mlir::ValueRange> { +public: + using OrderedOpGenericAdaptor::OrderedOpGenericAdaptor; + OrderedOpAdaptor(OrderedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OrderedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OrderedOpAdaptor; + template + using GenericAdaptor = OrderedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("depend_type_val"), ::llvm::StringRef("num_loops_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDependTypeValAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDependTypeValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumLoopsValAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumLoopsValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.ordered"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDependVecVars(); + ::mlir::MutableOperandRange getDependVecVarsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::omp::ClauseDependAttr getDependTypeValAttr(); + ::std::optional<::mlir::omp::ClauseDepend> getDependTypeVal(); + ::mlir::IntegerAttr getNumLoopsValAttr(); + ::std::optional getNumLoopsVal(); + void setDependTypeValAttr(::mlir::omp::ClauseDependAttr attr); + void setDependTypeVal(::std::optional<::mlir::omp::ClauseDepend> attrValue); + void setNumLoopsValAttr(::mlir::IntegerAttr attr); + void setNumLoopsVal(::std::optional attrValue); + ::mlir::Attribute removeDependTypeValAttr(); + ::mlir::Attribute removeNumLoopsValAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::omp::ClauseDependAttr depend_type_val, /*optional*/::mlir::IntegerAttr num_loops_val, ::mlir::ValueRange depend_vec_vars); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::omp::ClauseDependAttr depend_type_val, /*optional*/::mlir::IntegerAttr num_loops_val, ::mlir::ValueRange depend_vec_vars); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::OrderedOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::OrderedRegionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OrderedRegionOpGenericAdaptorBase { +public: + struct Properties { + using simdTy = ::mlir::UnitAttr; + simdTy simd; + + auto getSimd() { + auto &propStorage = this->simd; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setSimd(const ::mlir::UnitAttr &propValue) { + this->simd = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.simd == this->simd && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + OrderedRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + OrderedRegionOpGenericAdaptorBase(OrderedRegionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getSimdAttr(); + bool getSimd(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class OrderedRegionOpGenericAdaptor : public detail::OrderedRegionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OrderedRegionOpGenericAdaptorBase; +public: + OrderedRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OrderedRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OrderedRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + OrderedRegionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OrderedRegionOpAdaptor : public OrderedRegionOpGenericAdaptor<::mlir::ValueRange> { +public: + using OrderedRegionOpGenericAdaptor::OrderedRegionOpGenericAdaptor; + OrderedRegionOpAdaptor(OrderedRegionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OrderedRegionOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OrderedRegionOpAdaptor; + template + using GenericAdaptor = OrderedRegionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("simd")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSimdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSimdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.ordered_region"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getSimdAttr(); + bool getSimd(); + void setSimdAttr(::mlir::UnitAttr attr); + void setSimd(bool attrValue); + ::mlir::Attribute removeSimdAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::UnitAttr simd); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr simd); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/bool simd = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/bool simd = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::OrderedRegionOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ParallelOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParallelOpGenericAdaptorBase { +public: + struct Properties { + using proc_bind_valTy = ::mlir::omp::ClauseProcBindKindAttr; + proc_bind_valTy proc_bind_val; + + auto getProcBindVal() { + auto &propStorage = this->proc_bind_val; + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseProcBindKindAttr>(propStorage); + } + void setProcBindVal(const ::mlir::omp::ClauseProcBindKindAttr &propValue) { + this->proc_bind_val = propValue; + } + using reductionsTy = ::mlir::ArrayAttr; + reductionsTy reductions; + + auto getReductions() { + auto &propStorage = this->reductions; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setReductions(const ::mlir::ArrayAttr &propValue) { + this->reductions = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.proc_bind_val == this->proc_bind_val && + rhs.reductions == this->reductions && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ParallelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ParallelOpGenericAdaptorBase(ParallelOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + ::mlir::omp::ClauseProcBindKindAttr getProcBindValAttr(); + ::std::optional<::mlir::omp::ClauseProcBindKind> getProcBindVal(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ParallelOpGenericAdaptor : public detail::ParallelOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParallelOpGenericAdaptorBase; +public: + ParallelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParallelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParallelOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ParallelOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfExprVar() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getNumThreadsVar() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getAllocateVars() { + return getODSOperands(2); + } + + RangeT getAllocatorsVars() { + return getODSOperands(3); + } + + RangeT getReductionVars() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParallelOpAdaptor : public ParallelOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParallelOpGenericAdaptor::ParallelOpGenericAdaptor; + ParallelOpAdaptor(ParallelOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParallelOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ParallelOpAdaptor; + template + using GenericAdaptor = ParallelOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("proc_bind_val"), ::llvm::StringRef("reductions"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getProcBindValAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getProcBindValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getReductionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getReductionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.parallel"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfExprVar(); + ::mlir::Value getNumThreadsVar(); + ::mlir::Operation::operand_range getAllocateVars(); + ::mlir::Operation::operand_range getAllocatorsVars(); + ::mlir::Operation::operand_range getReductionVars(); + ::mlir::MutableOperandRange getIfExprVarMutable(); + ::mlir::MutableOperandRange getNumThreadsVarMutable(); + ::mlir::MutableOperandRange getAllocateVarsMutable(); + ::mlir::MutableOperandRange getAllocatorsVarsMutable(); + ::mlir::MutableOperandRange getReductionVarsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + ::mlir::omp::ClauseProcBindKindAttr getProcBindValAttr(); + ::std::optional<::mlir::omp::ClauseProcBindKind> getProcBindVal(); + void setReductionsAttr(::mlir::ArrayAttr attr); + void setProcBindValAttr(::mlir::omp::ClauseProcBindKindAttr attr); + void setProcBindVal(::std::optional<::mlir::omp::ClauseProcBindKind> attrValue); + ::mlir::Attribute removeReductionsAttr(); + ::mlir::Attribute removeProcBindValAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr_var, /*optional*/::mlir::Value num_threads_var, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseProcBindKindAttr proc_bind_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr_var, /*optional*/::mlir::Value num_threads_var, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseProcBindKindAttr proc_bind_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the number of reduction variables. + unsigned getNumReductionVars() { return getReductionVars().size(); } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ParallelOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ReductionDeclareOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReductionDeclareOpGenericAdaptorBase { +public: + struct Properties { + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + using typeTy = ::mlir::TypeAttr; + typeTy type; + + auto getType() { + auto &propStorage = this->type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setType(const ::mlir::TypeAttr &propValue) { + this->type = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.sym_name == this->sym_name && + rhs.type == this->type && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReductionDeclareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReductionDeclareOpGenericAdaptorBase(ReductionDeclareOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + ::mlir::Region &getInitializerRegion(); + ::mlir::Region &getReductionRegion(); + ::mlir::Region &getAtomicReductionRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReductionDeclareOpGenericAdaptor : public detail::ReductionDeclareOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReductionDeclareOpGenericAdaptorBase; +public: + ReductionDeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReductionDeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReductionDeclareOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReductionDeclareOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReductionDeclareOpAdaptor : public ReductionDeclareOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReductionDeclareOpGenericAdaptor::ReductionDeclareOpGenericAdaptor; + ReductionDeclareOpAdaptor(ReductionDeclareOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReductionDeclareOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::SymbolOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReductionDeclareOpAdaptor; + template + using GenericAdaptor = ReductionDeclareOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name"), ::llvm::StringRef("type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.reduction.declare"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getInitializerRegion(); + ::mlir::Region &getReductionRegion(); + ::mlir::Region &getAtomicReductionRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setTypeAttr(::mlir::TypeAttr attr); + void setType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + PointerLikeType getAccumulatorType() { + if (getAtomicReductionRegion().empty()) + return {}; + + return cast(getAtomicReductionRegion().front().getArgument(0).getType()); + } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ReductionDeclareOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ReductionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReductionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReductionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReductionOpGenericAdaptorBase(ReductionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReductionOpGenericAdaptor : public detail::ReductionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReductionOpGenericAdaptorBase; +public: + ReductionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReductionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReductionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReductionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReductionOpAdaptor : public ReductionOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReductionOpGenericAdaptor::ReductionOpGenericAdaptor; + ReductionOpAdaptor(ReductionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReductionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReductionOpAdaptor; + template + using GenericAdaptor = ReductionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.reduction"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getAccumulator(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value accumulator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value accumulator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ReductionOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::SectionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SectionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SectionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SectionOpGenericAdaptorBase(SectionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SectionOpGenericAdaptor : public detail::SectionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SectionOpGenericAdaptorBase; +public: + SectionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SectionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SectionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SectionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SectionOpAdaptor : public SectionOpGenericAdaptor<::mlir::ValueRange> { +public: + using SectionOpGenericAdaptor::SectionOpGenericAdaptor; + SectionOpAdaptor(SectionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SectionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = SectionOpAdaptor; + template + using GenericAdaptor = SectionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.section"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::SectionOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::SectionsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SectionsOpGenericAdaptorBase { +public: + struct Properties { + using nowaitTy = ::mlir::UnitAttr; + nowaitTy nowait; + + auto getNowait() { + auto &propStorage = this->nowait; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNowait(const ::mlir::UnitAttr &propValue) { + this->nowait = propValue; + } + using reductionsTy = ::mlir::ArrayAttr; + reductionsTy reductions; + + auto getReductions() { + auto &propStorage = this->reductions; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setReductions(const ::mlir::ArrayAttr &propValue) { + this->reductions = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.nowait == this->nowait && + rhs.reductions == this->reductions && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SectionsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SectionsOpGenericAdaptorBase(SectionsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SectionsOpGenericAdaptor : public detail::SectionsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SectionsOpGenericAdaptorBase; +public: + SectionsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SectionsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SectionsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SectionsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getReductionVars() { + return getODSOperands(0); + } + + RangeT getAllocateVars() { + return getODSOperands(1); + } + + RangeT getAllocatorsVars() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SectionsOpAdaptor : public SectionsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SectionsOpGenericAdaptor::SectionsOpGenericAdaptor; + SectionsOpAdaptor(SectionsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SectionsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SectionsOpAdaptor; + template + using GenericAdaptor = SectionsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nowait"), ::llvm::StringRef("reductions"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNowaitAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNowaitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getReductionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getReductionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.sections"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getReductionVars(); + ::mlir::Operation::operand_range getAllocateVars(); + ::mlir::Operation::operand_range getAllocatorsVars(); + ::mlir::MutableOperandRange getReductionVarsMutable(); + ::mlir::MutableOperandRange getAllocateVarsMutable(); + ::mlir::MutableOperandRange getAllocatorsVarsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + void setReductionsAttr(::mlir::ArrayAttr attr); + void setNowaitAttr(::mlir::UnitAttr attr); + void setNowait(bool attrValue); + ::mlir::Attribute removeReductionsAttr(); + ::mlir::Attribute removeNowaitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::UnitAttr nowait); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::UnitAttr nowait); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/bool nowait = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/bool nowait = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult verifyRegions(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::SectionsOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::SimdLoopOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SimdLoopOpGenericAdaptorBase { +public: + struct Properties { + using alignment_valuesTy = ::mlir::ArrayAttr; + alignment_valuesTy alignment_values; + + auto getAlignmentValues() { + auto &propStorage = this->alignment_values; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setAlignmentValues(const ::mlir::ArrayAttr &propValue) { + this->alignment_values = propValue; + } + using inclusiveTy = ::mlir::UnitAttr; + inclusiveTy inclusive; + + auto getInclusive() { + auto &propStorage = this->inclusive; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setInclusive(const ::mlir::UnitAttr &propValue) { + this->inclusive = propValue; + } + using order_valTy = ::mlir::omp::ClauseOrderKindAttr; + order_valTy order_val; + + auto getOrderVal() { + auto &propStorage = this->order_val; + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseOrderKindAttr>(propStorage); + } + void setOrderVal(const ::mlir::omp::ClauseOrderKindAttr &propValue) { + this->order_val = propValue; + } + using safelenTy = ::mlir::IntegerAttr; + safelenTy safelen; + + auto getSafelen() { + auto &propStorage = this->safelen; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setSafelen(const ::mlir::IntegerAttr &propValue) { + this->safelen = propValue; + } + using simdlenTy = ::mlir::IntegerAttr; + simdlenTy simdlen; + + auto getSimdlen() { + auto &propStorage = this->simdlen; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setSimdlen(const ::mlir::IntegerAttr &propValue) { + this->simdlen = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.alignment_values == this->alignment_values && + rhs.inclusive == this->inclusive && + rhs.order_val == this->order_val && + rhs.safelen == this->safelen && + rhs.simdlen == this->simdlen && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SimdLoopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SimdLoopOpGenericAdaptorBase(SimdLoopOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAlignmentValuesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAlignmentValues(); + ::mlir::omp::ClauseOrderKindAttr getOrderValAttr(); + ::std::optional<::mlir::omp::ClauseOrderKind> getOrderVal(); + ::mlir::IntegerAttr getSimdlenAttr(); + ::std::optional getSimdlen(); + ::mlir::IntegerAttr getSafelenAttr(); + ::std::optional getSafelen(); + ::mlir::UnitAttr getInclusiveAttr(); + bool getInclusive(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SimdLoopOpGenericAdaptor : public detail::SimdLoopOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SimdLoopOpGenericAdaptorBase; +public: + SimdLoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SimdLoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SimdLoopOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SimdLoopOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getLowerBound() { + return getODSOperands(0); + } + + RangeT getUpperBound() { + return getODSOperands(1); + } + + RangeT getStep() { + return getODSOperands(2); + } + + RangeT getAlignedVars() { + return getODSOperands(3); + } + + ValueT getIfExpr() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getNontemporalVars() { + return getODSOperands(5); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SimdLoopOpAdaptor : public SimdLoopOpGenericAdaptor<::mlir::ValueRange> { +public: + using SimdLoopOpGenericAdaptor::SimdLoopOpGenericAdaptor; + SimdLoopOpAdaptor(SimdLoopOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SimdLoopOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SimdLoopOpAdaptor; + template + using GenericAdaptor = SimdLoopOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("alignment_values"), ::llvm::StringRef("inclusive"), ::llvm::StringRef("order_val"), ::llvm::StringRef("safelen"), ::llvm::StringRef("simdlen"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlignmentValuesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlignmentValuesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInclusiveAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInclusiveAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOrderValAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOrderValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSafelenAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSafelenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSimdlenAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSimdlenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.simdloop"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getLowerBound(); + ::mlir::Operation::operand_range getUpperBound(); + ::mlir::Operation::operand_range getStep(); + ::mlir::Operation::operand_range getAlignedVars(); + ::mlir::TypedValue<::mlir::IntegerType> getIfExpr(); + ::mlir::Operation::operand_range getNontemporalVars(); + ::mlir::MutableOperandRange getLowerBoundMutable(); + ::mlir::MutableOperandRange getUpperBoundMutable(); + ::mlir::MutableOperandRange getStepMutable(); + ::mlir::MutableOperandRange getAlignedVarsMutable(); + ::mlir::MutableOperandRange getIfExprMutable(); + ::mlir::MutableOperandRange getNontemporalVarsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getAlignmentValuesAttr(); + ::std::optional< ::mlir::ArrayAttr > getAlignmentValues(); + ::mlir::omp::ClauseOrderKindAttr getOrderValAttr(); + ::std::optional<::mlir::omp::ClauseOrderKind> getOrderVal(); + ::mlir::IntegerAttr getSimdlenAttr(); + ::std::optional getSimdlen(); + ::mlir::IntegerAttr getSafelenAttr(); + ::std::optional getSafelen(); + ::mlir::UnitAttr getInclusiveAttr(); + bool getInclusive(); + void setAlignmentValuesAttr(::mlir::ArrayAttr attr); + void setOrderValAttr(::mlir::omp::ClauseOrderKindAttr attr); + void setOrderVal(::std::optional<::mlir::omp::ClauseOrderKind> attrValue); + void setSimdlenAttr(::mlir::IntegerAttr attr); + void setSimdlen(::std::optional attrValue); + void setSafelenAttr(::mlir::IntegerAttr attr); + void setSafelen(::std::optional attrValue); + void setInclusiveAttr(::mlir::UnitAttr attr); + void setInclusive(bool attrValue); + ::mlir::Attribute removeAlignmentValuesAttr(); + ::mlir::Attribute removeOrderValAttr(); + ::mlir::Attribute removeSimdlenAttr(); + ::mlir::Attribute removeSafelenAttr(); + ::mlir::Attribute removeInclusiveAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange aligned_vars, /*optional*/::mlir::ArrayAttr alignment_values, /*optional*/::mlir::Value if_expr, ::mlir::ValueRange nontemporal_vars, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::IntegerAttr simdlen, /*optional*/::mlir::IntegerAttr safelen, /*optional*/::mlir::UnitAttr inclusive); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange aligned_vars, /*optional*/::mlir::ArrayAttr alignment_values, /*optional*/::mlir::Value if_expr, ::mlir::ValueRange nontemporal_vars, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::IntegerAttr simdlen, /*optional*/::mlir::IntegerAttr safelen, /*optional*/::mlir::UnitAttr inclusive); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange aligned_vars, /*optional*/::mlir::ArrayAttr alignment_values, /*optional*/::mlir::Value if_expr, ::mlir::ValueRange nontemporal_vars, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::IntegerAttr simdlen, /*optional*/::mlir::IntegerAttr safelen, /*optional*/bool inclusive = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange aligned_vars, /*optional*/::mlir::ArrayAttr alignment_values, /*optional*/::mlir::Value if_expr, ::mlir::ValueRange nontemporal_vars, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::IntegerAttr simdlen, /*optional*/::mlir::IntegerAttr safelen, /*optional*/bool inclusive = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the number of loops in the simd loop nest. + unsigned getNumLoops() { return getLowerBound().size(); } + +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::SimdLoopOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::SingleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SingleOpGenericAdaptorBase { +public: + struct Properties { + using nowaitTy = ::mlir::UnitAttr; + nowaitTy nowait; + + auto getNowait() { + auto &propStorage = this->nowait; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNowait(const ::mlir::UnitAttr &propValue) { + this->nowait = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.nowait == this->nowait && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SingleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SingleOpGenericAdaptorBase(SingleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SingleOpGenericAdaptor : public detail::SingleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SingleOpGenericAdaptorBase; +public: + SingleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SingleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SingleOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SingleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getAllocateVars() { + return getODSOperands(0); + } + + RangeT getAllocatorsVars() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SingleOpAdaptor : public SingleOpGenericAdaptor<::mlir::ValueRange> { +public: + using SingleOpGenericAdaptor::SingleOpGenericAdaptor; + SingleOpAdaptor(SingleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SingleOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SingleOpAdaptor; + template + using GenericAdaptor = SingleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nowait"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNowaitAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNowaitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.single"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getAllocateVars(); + ::mlir::Operation::operand_range getAllocatorsVars(); + ::mlir::MutableOperandRange getAllocateVarsMutable(); + ::mlir::MutableOperandRange getAllocatorsVarsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + void setNowaitAttr(::mlir::UnitAttr attr); + void setNowait(bool attrValue); + ::mlir::Attribute removeNowaitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::UnitAttr nowait); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::UnitAttr nowait); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/bool nowait = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/bool nowait = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::SingleOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TargetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TargetOpGenericAdaptorBase { +public: + struct Properties { + using nowaitTy = ::mlir::UnitAttr; + nowaitTy nowait; + + auto getNowait() { + auto &propStorage = this->nowait; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNowait(const ::mlir::UnitAttr &propValue) { + this->nowait = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.nowait == this->nowait && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TargetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TargetOpGenericAdaptorBase(TargetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class TargetOpGenericAdaptor : public detail::TargetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TargetOpGenericAdaptorBase; +public: + TargetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TargetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TargetOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TargetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDevice() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getThreadLimit() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getMapOperands() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TargetOpAdaptor : public TargetOpGenericAdaptor<::mlir::ValueRange> { +public: + using TargetOpGenericAdaptor::TargetOpGenericAdaptor; + TargetOpAdaptor(TargetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TargetOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TargetOpAdaptor; + template + using GenericAdaptor = TargetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nowait"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNowaitAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNowaitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.target"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfExpr(); + ::mlir::TypedValue<::mlir::IntegerType> getDevice(); + ::mlir::TypedValue<::mlir::IntegerType> getThreadLimit(); + ::mlir::Operation::operand_range getMapOperands(); + ::mlir::MutableOperandRange getIfExprMutable(); + ::mlir::MutableOperandRange getDeviceMutable(); + ::mlir::MutableOperandRange getThreadLimitMutable(); + ::mlir::MutableOperandRange getMapOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + void setNowaitAttr(::mlir::UnitAttr attr); + void setNowait(bool attrValue); + ::mlir::Attribute removeNowaitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::Value thread_limit, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::Value thread_limit, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::Value thread_limit, /*optional*/bool nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::Value thread_limit, /*optional*/bool nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::TargetOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::DataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DataOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + DataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + DataOpGenericAdaptorBase(DataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class DataOpGenericAdaptor : public detail::DataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DataOpGenericAdaptorBase; +public: + DataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + DataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDevice() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getUseDevicePtr() { + return getODSOperands(2); + } + + RangeT getUseDeviceAddr() { + return getODSOperands(3); + } + + RangeT getMapOperands() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DataOpAdaptor : public DataOpGenericAdaptor<::mlir::ValueRange> { +public: + using DataOpGenericAdaptor::DataOpGenericAdaptor; + DataOpAdaptor(DataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DataOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DataOpAdaptor; + template + using GenericAdaptor = DataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.target_data"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfExpr(); + ::mlir::TypedValue<::mlir::IntegerType> getDevice(); + ::mlir::Operation::operand_range getUseDevicePtr(); + ::mlir::Operation::operand_range getUseDeviceAddr(); + ::mlir::Operation::operand_range getMapOperands(); + ::mlir::MutableOperandRange getIfExprMutable(); + ::mlir::MutableOperandRange getDeviceMutable(); + ::mlir::MutableOperandRange getUseDevicePtrMutable(); + ::mlir::MutableOperandRange getUseDeviceAddrMutable(); + ::mlir::MutableOperandRange getMapOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, ::mlir::ValueRange use_device_ptr, ::mlir::ValueRange use_device_addr, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, ::mlir::ValueRange use_device_ptr, ::mlir::ValueRange use_device_addr, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::DataOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::EnterDataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnterDataOpGenericAdaptorBase { +public: + struct Properties { + using nowaitTy = ::mlir::UnitAttr; + nowaitTy nowait; + + auto getNowait() { + auto &propStorage = this->nowait; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNowait(const ::mlir::UnitAttr &propValue) { + this->nowait = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.nowait == this->nowait && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + EnterDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + EnterDataOpGenericAdaptorBase(EnterDataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); +}; +} // namespace detail +template +class EnterDataOpGenericAdaptor : public detail::EnterDataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnterDataOpGenericAdaptorBase; +public: + EnterDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnterDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnterDataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + EnterDataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDevice() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getMapOperands() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnterDataOpAdaptor : public EnterDataOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnterDataOpGenericAdaptor::EnterDataOpGenericAdaptor; + EnterDataOpAdaptor(EnterDataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnterDataOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = EnterDataOpAdaptor; + template + using GenericAdaptor = EnterDataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nowait"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNowaitAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNowaitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.target_enter_data"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfExpr(); + ::mlir::TypedValue<::mlir::IntegerType> getDevice(); + ::mlir::Operation::operand_range getMapOperands(); + ::mlir::MutableOperandRange getIfExprMutable(); + ::mlir::MutableOperandRange getDeviceMutable(); + ::mlir::MutableOperandRange getMapOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + void setNowaitAttr(::mlir::UnitAttr attr); + void setNowait(bool attrValue); + ::mlir::Attribute removeNowaitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/bool nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/bool nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::EnterDataOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ExitDataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExitDataOpGenericAdaptorBase { +public: + struct Properties { + using nowaitTy = ::mlir::UnitAttr; + nowaitTy nowait; + + auto getNowait() { + auto &propStorage = this->nowait; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNowait(const ::mlir::UnitAttr &propValue) { + this->nowait = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.nowait == this->nowait && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExitDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExitDataOpGenericAdaptorBase(ExitDataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); +}; +} // namespace detail +template +class ExitDataOpGenericAdaptor : public detail::ExitDataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExitDataOpGenericAdaptorBase; +public: + ExitDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExitDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExitDataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExitDataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDevice() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getMapOperands() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExitDataOpAdaptor : public ExitDataOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExitDataOpGenericAdaptor::ExitDataOpGenericAdaptor; + ExitDataOpAdaptor(ExitDataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExitDataOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ExitDataOpAdaptor; + template + using GenericAdaptor = ExitDataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nowait"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNowaitAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNowaitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.target_exit_data"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfExpr(); + ::mlir::TypedValue<::mlir::IntegerType> getDevice(); + ::mlir::Operation::operand_range getMapOperands(); + ::mlir::MutableOperandRange getIfExprMutable(); + ::mlir::MutableOperandRange getDeviceMutable(); + ::mlir::MutableOperandRange getMapOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + void setNowaitAttr(::mlir::UnitAttr attr); + void setNowait(bool attrValue); + ::mlir::Attribute removeNowaitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/::mlir::UnitAttr nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/bool nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value device, /*optional*/bool nowait, ::mlir::ValueRange map_operands); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ExitDataOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskGroupOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TaskGroupOpGenericAdaptorBase { +public: + struct Properties { + using task_reductionsTy = ::mlir::ArrayAttr; + task_reductionsTy task_reductions; + + auto getTaskReductions() { + auto &propStorage = this->task_reductions; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setTaskReductions(const ::mlir::ArrayAttr &propValue) { + this->task_reductions = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.task_reductions == this->task_reductions && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TaskGroupOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TaskGroupOpGenericAdaptorBase(TaskGroupOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getTaskReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getTaskReductions(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class TaskGroupOpGenericAdaptor : public detail::TaskGroupOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TaskGroupOpGenericAdaptorBase; +public: + TaskGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TaskGroupOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TaskGroupOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TaskGroupOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getTaskReductionVars() { + return getODSOperands(0); + } + + RangeT getAllocateVars() { + return getODSOperands(1); + } + + RangeT getAllocatorsVars() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TaskGroupOpAdaptor : public TaskGroupOpGenericAdaptor<::mlir::ValueRange> { +public: + using TaskGroupOpGenericAdaptor::TaskGroupOpGenericAdaptor; + TaskGroupOpAdaptor(TaskGroupOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TaskGroupOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TaskGroupOpAdaptor; + template + using GenericAdaptor = TaskGroupOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("task_reductions"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTaskReductionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTaskReductionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.taskgroup"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getTaskReductionVars(); + ::mlir::Operation::operand_range getAllocateVars(); + ::mlir::Operation::operand_range getAllocatorsVars(); + ::mlir::MutableOperandRange getTaskReductionVarsMutable(); + ::mlir::MutableOperandRange getAllocateVarsMutable(); + ::mlir::MutableOperandRange getAllocatorsVarsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getTaskReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getTaskReductions(); + void setTaskReductionsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeTaskReductionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange task_reduction_vars, /*optional*/::mlir::ArrayAttr task_reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange task_reduction_vars, /*optional*/::mlir::ArrayAttr task_reductions, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the reduction variables + operand_range getAllReductionVars() { return getTaskReductionVars(); } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::TaskGroupOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskLoopOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TaskLoopOpGenericAdaptorBase { +public: + struct Properties { + using in_reductionsTy = ::mlir::ArrayAttr; + in_reductionsTy in_reductions; + + auto getInReductions() { + auto &propStorage = this->in_reductions; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setInReductions(const ::mlir::ArrayAttr &propValue) { + this->in_reductions = propValue; + } + using inclusiveTy = ::mlir::UnitAttr; + inclusiveTy inclusive; + + auto getInclusive() { + auto &propStorage = this->inclusive; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setInclusive(const ::mlir::UnitAttr &propValue) { + this->inclusive = propValue; + } + using mergeableTy = ::mlir::UnitAttr; + mergeableTy mergeable; + + auto getMergeable() { + auto &propStorage = this->mergeable; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setMergeable(const ::mlir::UnitAttr &propValue) { + this->mergeable = propValue; + } + using nogroupTy = ::mlir::UnitAttr; + nogroupTy nogroup; + + auto getNogroup() { + auto &propStorage = this->nogroup; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNogroup(const ::mlir::UnitAttr &propValue) { + this->nogroup = propValue; + } + using reductionsTy = ::mlir::ArrayAttr; + reductionsTy reductions; + + auto getReductions() { + auto &propStorage = this->reductions; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setReductions(const ::mlir::ArrayAttr &propValue) { + this->reductions = propValue; + } + using untiedTy = ::mlir::UnitAttr; + untiedTy untied; + + auto getUntied() { + auto &propStorage = this->untied; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setUntied(const ::mlir::UnitAttr &propValue) { + this->untied = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.in_reductions == this->in_reductions && + rhs.inclusive == this->inclusive && + rhs.mergeable == this->mergeable && + rhs.nogroup == this->nogroup && + rhs.reductions == this->reductions && + rhs.untied == this->untied && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TaskLoopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TaskLoopOpGenericAdaptorBase(TaskLoopOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getInclusiveAttr(); + bool getInclusive(); + ::mlir::UnitAttr getUntiedAttr(); + bool getUntied(); + ::mlir::UnitAttr getMergeableAttr(); + bool getMergeable(); + ::mlir::ArrayAttr getInReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getInReductions(); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + ::mlir::UnitAttr getNogroupAttr(); + bool getNogroup(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class TaskLoopOpGenericAdaptor : public detail::TaskLoopOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TaskLoopOpGenericAdaptorBase; +public: + TaskLoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TaskLoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TaskLoopOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TaskLoopOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getLowerBound() { + return getODSOperands(0); + } + + RangeT getUpperBound() { + return getODSOperands(1); + } + + RangeT getStep() { + return getODSOperands(2); + } + + ValueT getIfExpr() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getFinalExpr() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getInReductionVars() { + return getODSOperands(5); + } + + RangeT getReductionVars() { + return getODSOperands(6); + } + + ValueT getPriority() { + auto operands = getODSOperands(7); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getAllocateVars() { + return getODSOperands(8); + } + + RangeT getAllocatorsVars() { + return getODSOperands(9); + } + + ValueT getGrainSize() { + auto operands = getODSOperands(10); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getNumTasks() { + auto operands = getODSOperands(11); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TaskLoopOpAdaptor : public TaskLoopOpGenericAdaptor<::mlir::ValueRange> { +public: + using TaskLoopOpGenericAdaptor::TaskLoopOpGenericAdaptor; + TaskLoopOpAdaptor(TaskLoopOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TaskLoopOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TaskLoopOpAdaptor; + template + using GenericAdaptor = TaskLoopOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("in_reductions"), ::llvm::StringRef("inclusive"), ::llvm::StringRef("mergeable"), ::llvm::StringRef("nogroup"), ::llvm::StringRef("reductions"), ::llvm::StringRef("untied"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getInReductionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getInReductionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInclusiveAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInclusiveAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMergeableAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMergeableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNogroupAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNogroupAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getReductionsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getReductionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUntiedAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUntiedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.taskloop"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getLowerBound(); + ::mlir::Operation::operand_range getUpperBound(); + ::mlir::Operation::operand_range getStep(); + ::mlir::TypedValue<::mlir::IntegerType> getIfExpr(); + ::mlir::TypedValue<::mlir::IntegerType> getFinalExpr(); + ::mlir::Operation::operand_range getInReductionVars(); + ::mlir::Operation::operand_range getReductionVars(); + ::mlir::Value getPriority(); + ::mlir::Operation::operand_range getAllocateVars(); + ::mlir::Operation::operand_range getAllocatorsVars(); + ::mlir::Value getGrainSize(); + ::mlir::Value getNumTasks(); + ::mlir::MutableOperandRange getLowerBoundMutable(); + ::mlir::MutableOperandRange getUpperBoundMutable(); + ::mlir::MutableOperandRange getStepMutable(); + ::mlir::MutableOperandRange getIfExprMutable(); + ::mlir::MutableOperandRange getFinalExprMutable(); + ::mlir::MutableOperandRange getInReductionVarsMutable(); + ::mlir::MutableOperandRange getReductionVarsMutable(); + ::mlir::MutableOperandRange getPriorityMutable(); + ::mlir::MutableOperandRange getAllocateVarsMutable(); + ::mlir::MutableOperandRange getAllocatorsVarsMutable(); + ::mlir::MutableOperandRange getGrainSizeMutable(); + ::mlir::MutableOperandRange getNumTasksMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getInclusiveAttr(); + bool getInclusive(); + ::mlir::UnitAttr getUntiedAttr(); + bool getUntied(); + ::mlir::UnitAttr getMergeableAttr(); + bool getMergeable(); + ::mlir::ArrayAttr getInReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getInReductions(); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + ::mlir::UnitAttr getNogroupAttr(); + bool getNogroup(); + void setInclusiveAttr(::mlir::UnitAttr attr); + void setInclusive(bool attrValue); + void setUntiedAttr(::mlir::UnitAttr attr); + void setUntied(bool attrValue); + void setMergeableAttr(::mlir::UnitAttr attr); + void setMergeable(bool attrValue); + void setInReductionsAttr(::mlir::ArrayAttr attr); + void setReductionsAttr(::mlir::ArrayAttr attr); + void setNogroupAttr(::mlir::UnitAttr attr); + void setNogroup(bool attrValue); + ::mlir::Attribute removeInclusiveAttr(); + ::mlir::Attribute removeUntiedAttr(); + ::mlir::Attribute removeMergeableAttr(); + ::mlir::Attribute removeInReductionsAttr(); + ::mlir::Attribute removeReductionsAttr(); + ::mlir::Attribute removeNogroupAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, /*optional*/::mlir::UnitAttr inclusive, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/::mlir::UnitAttr untied, /*optional*/::mlir::UnitAttr mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::Value priority, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::Value grain_size, /*optional*/::mlir::Value num_tasks, /*optional*/::mlir::UnitAttr nogroup); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, /*optional*/::mlir::UnitAttr inclusive, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/::mlir::UnitAttr untied, /*optional*/::mlir::UnitAttr mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::Value priority, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::Value grain_size, /*optional*/::mlir::Value num_tasks, /*optional*/::mlir::UnitAttr nogroup); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, /*optional*/bool inclusive, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/bool untied, /*optional*/bool mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::Value priority, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::Value grain_size, /*optional*/::mlir::Value num_tasks, /*optional*/bool nogroup = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, /*optional*/bool inclusive, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/bool untied, /*optional*/bool mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::Value priority, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, /*optional*/::mlir::Value grain_size, /*optional*/::mlir::Value num_tasks, /*optional*/bool nogroup = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the reduction variables + SmallVector getAllReductionVars(); + void getEffects(SmallVectorImpl &effects); +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::TaskLoopOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TaskOpGenericAdaptorBase { +public: + struct Properties { + using dependsTy = ::mlir::ArrayAttr; + dependsTy depends; + + auto getDepends() { + auto &propStorage = this->depends; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setDepends(const ::mlir::ArrayAttr &propValue) { + this->depends = propValue; + } + using in_reductionsTy = ::mlir::ArrayAttr; + in_reductionsTy in_reductions; + + auto getInReductions() { + auto &propStorage = this->in_reductions; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setInReductions(const ::mlir::ArrayAttr &propValue) { + this->in_reductions = propValue; + } + using mergeableTy = ::mlir::UnitAttr; + mergeableTy mergeable; + + auto getMergeable() { + auto &propStorage = this->mergeable; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setMergeable(const ::mlir::UnitAttr &propValue) { + this->mergeable = propValue; + } + using untiedTy = ::mlir::UnitAttr; + untiedTy untied; + + auto getUntied() { + auto &propStorage = this->untied; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setUntied(const ::mlir::UnitAttr &propValue) { + this->untied = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.depends == this->depends && + rhs.in_reductions == this->in_reductions && + rhs.mergeable == this->mergeable && + rhs.untied == this->untied && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TaskOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TaskOpGenericAdaptorBase(TaskOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::UnitAttr getUntiedAttr(); + bool getUntied(); + ::mlir::UnitAttr getMergeableAttr(); + bool getMergeable(); + ::mlir::ArrayAttr getInReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getInReductions(); + ::mlir::ArrayAttr getDependsAttr(); + ::std::optional< ::mlir::ArrayAttr > getDepends(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class TaskOpGenericAdaptor : public detail::TaskOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TaskOpGenericAdaptorBase; +public: + TaskOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TaskOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TaskOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TaskOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIfExpr() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getFinalExpr() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getInReductionVars() { + return getODSOperands(2); + } + + ValueT getPriority() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getDependVars() { + return getODSOperands(4); + } + + RangeT getAllocateVars() { + return getODSOperands(5); + } + + RangeT getAllocatorsVars() { + return getODSOperands(6); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TaskOpAdaptor : public TaskOpGenericAdaptor<::mlir::ValueRange> { +public: + using TaskOpGenericAdaptor::TaskOpGenericAdaptor; + TaskOpAdaptor(TaskOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TaskOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TaskOpAdaptor; + template + using GenericAdaptor = TaskOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("depends"), ::llvm::StringRef("in_reductions"), ::llvm::StringRef("mergeable"), ::llvm::StringRef("untied"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDependsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDependsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInReductionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInReductionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMergeableAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMergeableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUntiedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUntiedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.task"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getIfExpr(); + ::mlir::TypedValue<::mlir::IntegerType> getFinalExpr(); + ::mlir::Operation::operand_range getInReductionVars(); + ::mlir::TypedValue<::mlir::IntegerType> getPriority(); + ::mlir::Operation::operand_range getDependVars(); + ::mlir::Operation::operand_range getAllocateVars(); + ::mlir::Operation::operand_range getAllocatorsVars(); + ::mlir::MutableOperandRange getIfExprMutable(); + ::mlir::MutableOperandRange getFinalExprMutable(); + ::mlir::MutableOperandRange getInReductionVarsMutable(); + ::mlir::MutableOperandRange getPriorityMutable(); + ::mlir::MutableOperandRange getDependVarsMutable(); + ::mlir::MutableOperandRange getAllocateVarsMutable(); + ::mlir::MutableOperandRange getAllocatorsVarsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::UnitAttr getUntiedAttr(); + bool getUntied(); + ::mlir::UnitAttr getMergeableAttr(); + bool getMergeable(); + ::mlir::ArrayAttr getInReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getInReductions(); + ::mlir::ArrayAttr getDependsAttr(); + ::std::optional< ::mlir::ArrayAttr > getDepends(); + void setUntiedAttr(::mlir::UnitAttr attr); + void setUntied(bool attrValue); + void setMergeableAttr(::mlir::UnitAttr attr); + void setMergeable(bool attrValue); + void setInReductionsAttr(::mlir::ArrayAttr attr); + void setDependsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUntiedAttr(); + ::mlir::Attribute removeMergeableAttr(); + ::mlir::Attribute removeInReductionsAttr(); + ::mlir::Attribute removeDependsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/::mlir::UnitAttr untied, /*optional*/::mlir::UnitAttr mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, /*optional*/::mlir::Value priority, /*optional*/::mlir::ArrayAttr depends, ::mlir::ValueRange depend_vars, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/::mlir::UnitAttr untied, /*optional*/::mlir::UnitAttr mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, /*optional*/::mlir::Value priority, /*optional*/::mlir::ArrayAttr depends, ::mlir::ValueRange depend_vars, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/bool untied, /*optional*/bool mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, /*optional*/::mlir::Value priority, /*optional*/::mlir::ArrayAttr depends, ::mlir::ValueRange depend_vars, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value final_expr, /*optional*/bool untied, /*optional*/bool mergeable, ::mlir::ValueRange in_reduction_vars, /*optional*/::mlir::ArrayAttr in_reductions, /*optional*/::mlir::Value priority, /*optional*/::mlir::ArrayAttr depends, ::mlir::ValueRange depend_vars, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the reduction variables + SmallVector getReductionVars() { + return SmallVector(getInReductionVars().begin(), + getInReductionVars().end()); + } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::TaskOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskwaitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TaskwaitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TaskwaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TaskwaitOpGenericAdaptorBase(TaskwaitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TaskwaitOpGenericAdaptor : public detail::TaskwaitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TaskwaitOpGenericAdaptorBase; +public: + TaskwaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TaskwaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TaskwaitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TaskwaitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TaskwaitOpAdaptor : public TaskwaitOpGenericAdaptor<::mlir::ValueRange> { +public: + using TaskwaitOpGenericAdaptor::TaskwaitOpGenericAdaptor; + TaskwaitOpAdaptor(TaskwaitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TaskwaitOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TaskwaitOpAdaptor; + template + using GenericAdaptor = TaskwaitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.taskwait"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::TaskwaitOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TaskyieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TaskyieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TaskyieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TaskyieldOpGenericAdaptorBase(TaskyieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TaskyieldOpGenericAdaptor : public detail::TaskyieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TaskyieldOpGenericAdaptorBase; +public: + TaskyieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TaskyieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TaskyieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TaskyieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TaskyieldOpAdaptor : public TaskyieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using TaskyieldOpGenericAdaptor::TaskyieldOpGenericAdaptor; + TaskyieldOpAdaptor(TaskyieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TaskyieldOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TaskyieldOpAdaptor; + template + using GenericAdaptor = TaskyieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.taskyield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::TaskyieldOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TeamsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TeamsOpGenericAdaptorBase { +public: + struct Properties { + using reductionsTy = ::mlir::ArrayAttr; + reductionsTy reductions; + + auto getReductions() { + auto &propStorage = this->reductions; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setReductions(const ::mlir::ArrayAttr &propValue) { + this->reductions = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.reductions == this->reductions && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TeamsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TeamsOpGenericAdaptorBase(TeamsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class TeamsOpGenericAdaptor : public detail::TeamsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TeamsOpGenericAdaptorBase; +public: + TeamsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TeamsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TeamsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TeamsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getNumTeamsLower() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getNumTeamsUpper() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getIfExpr() { + auto operands = getODSOperands(2); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getThreadLimit() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getAllocateVars() { + return getODSOperands(4); + } + + RangeT getAllocatorsVars() { + return getODSOperands(5); + } + + RangeT getReductionVars() { + return getODSOperands(6); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TeamsOpAdaptor : public TeamsOpGenericAdaptor<::mlir::ValueRange> { +public: + using TeamsOpGenericAdaptor::TeamsOpGenericAdaptor; + TeamsOpAdaptor(TeamsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TeamsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TeamsOpAdaptor; + template + using GenericAdaptor = TeamsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("reductions"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getReductionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getReductionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.teams"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getNumTeamsLower(); + ::mlir::TypedValue<::mlir::IntegerType> getNumTeamsUpper(); + ::mlir::TypedValue<::mlir::IntegerType> getIfExpr(); + ::mlir::TypedValue<::mlir::IntegerType> getThreadLimit(); + ::mlir::Operation::operand_range getAllocateVars(); + ::mlir::Operation::operand_range getAllocatorsVars(); + ::mlir::Operation::operand_range getReductionVars(); + ::mlir::MutableOperandRange getNumTeamsLowerMutable(); + ::mlir::MutableOperandRange getNumTeamsUpperMutable(); + ::mlir::MutableOperandRange getIfExprMutable(); + ::mlir::MutableOperandRange getThreadLimitMutable(); + ::mlir::MutableOperandRange getAllocateVarsMutable(); + ::mlir::MutableOperandRange getAllocatorsVarsMutable(); + ::mlir::MutableOperandRange getReductionVarsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + void setReductionsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeReductionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value num_teams_lower, /*optional*/::mlir::Value num_teams_upper, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value thread_limit, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value num_teams_lower, /*optional*/::mlir::Value num_teams_upper, /*optional*/::mlir::Value if_expr, /*optional*/::mlir::Value thread_limit, ::mlir::ValueRange allocate_vars, ::mlir::ValueRange allocators_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::TeamsOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::TerminatorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TerminatorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TerminatorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TerminatorOpGenericAdaptorBase(TerminatorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TerminatorOpGenericAdaptor : public detail::TerminatorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TerminatorOpGenericAdaptorBase; +public: + TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TerminatorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TerminatorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TerminatorOpAdaptor : public TerminatorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TerminatorOpGenericAdaptor::TerminatorOpGenericAdaptor; + TerminatorOpAdaptor(TerminatorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TerminatorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TerminatorOpAdaptor; + template + using GenericAdaptor = TerminatorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.terminator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::TerminatorOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::ThreadprivateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ThreadprivateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ThreadprivateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ThreadprivateOpGenericAdaptorBase(ThreadprivateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ThreadprivateOpGenericAdaptor : public detail::ThreadprivateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ThreadprivateOpGenericAdaptorBase; +public: + ThreadprivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ThreadprivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ThreadprivateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ThreadprivateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSymAddr() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ThreadprivateOpAdaptor : public ThreadprivateOpGenericAdaptor<::mlir::ValueRange> { +public: + using ThreadprivateOpGenericAdaptor::ThreadprivateOpGenericAdaptor; + ThreadprivateOpAdaptor(ThreadprivateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ThreadprivateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ThreadprivateOpAdaptor; + template + using GenericAdaptor = ThreadprivateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.threadprivate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getSymAddr(); + ::mlir::OpOperand &getSymAddrMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::omp::PointerLikeType> getTlsAddr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tls_addr, ::mlir::Value sym_addr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sym_addr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + /// The number of variable operands. + unsigned getNumVariableOperands() { + assert(getSymAddr() && "expected one variable operand"); + return 1; + } + + /// The i-th variable operand passed. + Value getVariableOperand(unsigned i) { + assert(i == 0 && "invalid index position for an operand"); + return getSymAddr(); + } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ThreadprivateOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::WsLoopOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WsLoopOpGenericAdaptorBase { +public: + struct Properties { + using inclusiveTy = ::mlir::UnitAttr; + inclusiveTy inclusive; + + auto getInclusive() { + auto &propStorage = this->inclusive; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setInclusive(const ::mlir::UnitAttr &propValue) { + this->inclusive = propValue; + } + using nowaitTy = ::mlir::UnitAttr; + nowaitTy nowait; + + auto getNowait() { + auto &propStorage = this->nowait; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setNowait(const ::mlir::UnitAttr &propValue) { + this->nowait = propValue; + } + using order_valTy = ::mlir::omp::ClauseOrderKindAttr; + order_valTy order_val; + + auto getOrderVal() { + auto &propStorage = this->order_val; + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseOrderKindAttr>(propStorage); + } + void setOrderVal(const ::mlir::omp::ClauseOrderKindAttr &propValue) { + this->order_val = propValue; + } + using ordered_valTy = ::mlir::IntegerAttr; + ordered_valTy ordered_val; + + auto getOrderedVal() { + auto &propStorage = this->ordered_val; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setOrderedVal(const ::mlir::IntegerAttr &propValue) { + this->ordered_val = propValue; + } + using reductionsTy = ::mlir::ArrayAttr; + reductionsTy reductions; + + auto getReductions() { + auto &propStorage = this->reductions; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setReductions(const ::mlir::ArrayAttr &propValue) { + this->reductions = propValue; + } + using schedule_modifierTy = ::mlir::omp::ScheduleModifierAttr; + schedule_modifierTy schedule_modifier; + + auto getScheduleModifier() { + auto &propStorage = this->schedule_modifier; + return ::llvm::dyn_cast_or_null<::mlir::omp::ScheduleModifierAttr>(propStorage); + } + void setScheduleModifier(const ::mlir::omp::ScheduleModifierAttr &propValue) { + this->schedule_modifier = propValue; + } + using schedule_valTy = ::mlir::omp::ClauseScheduleKindAttr; + schedule_valTy schedule_val; + + auto getScheduleVal() { + auto &propStorage = this->schedule_val; + return ::llvm::dyn_cast_or_null<::mlir::omp::ClauseScheduleKindAttr>(propStorage); + } + void setScheduleVal(const ::mlir::omp::ClauseScheduleKindAttr &propValue) { + this->schedule_val = propValue; + } + using simd_modifierTy = ::mlir::UnitAttr; + simd_modifierTy simd_modifier; + + auto getSimdModifier() { + auto &propStorage = this->simd_modifier; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setSimdModifier(const ::mlir::UnitAttr &propValue) { + this->simd_modifier = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.inclusive == this->inclusive && + rhs.nowait == this->nowait && + rhs.order_val == this->order_val && + rhs.ordered_val == this->ordered_val && + rhs.reductions == this->reductions && + rhs.schedule_modifier == this->schedule_modifier && + rhs.schedule_val == this->schedule_val && + rhs.simd_modifier == this->simd_modifier && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + WsLoopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + WsLoopOpGenericAdaptorBase(WsLoopOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + ::mlir::omp::ClauseScheduleKindAttr getScheduleValAttr(); + ::std::optional<::mlir::omp::ClauseScheduleKind> getScheduleVal(); + ::mlir::omp::ScheduleModifierAttr getScheduleModifierAttr(); + ::std::optional<::mlir::omp::ScheduleModifier> getScheduleModifier(); + ::mlir::UnitAttr getSimdModifierAttr(); + bool getSimdModifier(); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + ::mlir::IntegerAttr getOrderedValAttr(); + ::std::optional getOrderedVal(); + ::mlir::omp::ClauseOrderKindAttr getOrderValAttr(); + ::std::optional<::mlir::omp::ClauseOrderKind> getOrderVal(); + ::mlir::UnitAttr getInclusiveAttr(); + bool getInclusive(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class WsLoopOpGenericAdaptor : public detail::WsLoopOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WsLoopOpGenericAdaptorBase; +public: + WsLoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WsLoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WsLoopOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + WsLoopOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getLowerBound() { + return getODSOperands(0); + } + + RangeT getUpperBound() { + return getODSOperands(1); + } + + RangeT getStep() { + return getODSOperands(2); + } + + RangeT getLinearVars() { + return getODSOperands(3); + } + + RangeT getLinearStepVars() { + return getODSOperands(4); + } + + RangeT getReductionVars() { + return getODSOperands(5); + } + + ValueT getScheduleChunkVar() { + auto operands = getODSOperands(6); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WsLoopOpAdaptor : public WsLoopOpGenericAdaptor<::mlir::ValueRange> { +public: + using WsLoopOpGenericAdaptor::WsLoopOpGenericAdaptor; + WsLoopOpAdaptor(WsLoopOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WsLoopOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = WsLoopOpAdaptor; + template + using GenericAdaptor = WsLoopOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("inclusive"), ::llvm::StringRef("nowait"), ::llvm::StringRef("order_val"), ::llvm::StringRef("ordered_val"), ::llvm::StringRef("reductions"), ::llvm::StringRef("schedule_modifier"), ::llvm::StringRef("schedule_val"), ::llvm::StringRef("simd_modifier"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getInclusiveAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getInclusiveAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNowaitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNowaitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOrderValAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOrderValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOrderedValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOrderedValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getReductionsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getReductionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getScheduleModifierAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getScheduleModifierAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getScheduleValAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getScheduleValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getSimdModifierAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getSimdModifierAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.wsloop"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getLowerBound(); + ::mlir::Operation::operand_range getUpperBound(); + ::mlir::Operation::operand_range getStep(); + ::mlir::Operation::operand_range getLinearVars(); + ::mlir::Operation::operand_range getLinearStepVars(); + ::mlir::Operation::operand_range getReductionVars(); + ::mlir::Value getScheduleChunkVar(); + ::mlir::MutableOperandRange getLowerBoundMutable(); + ::mlir::MutableOperandRange getUpperBoundMutable(); + ::mlir::MutableOperandRange getStepMutable(); + ::mlir::MutableOperandRange getLinearVarsMutable(); + ::mlir::MutableOperandRange getLinearStepVarsMutable(); + ::mlir::MutableOperandRange getReductionVarsMutable(); + ::mlir::MutableOperandRange getScheduleChunkVarMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getReductionsAttr(); + ::std::optional< ::mlir::ArrayAttr > getReductions(); + ::mlir::omp::ClauseScheduleKindAttr getScheduleValAttr(); + ::std::optional<::mlir::omp::ClauseScheduleKind> getScheduleVal(); + ::mlir::omp::ScheduleModifierAttr getScheduleModifierAttr(); + ::std::optional<::mlir::omp::ScheduleModifier> getScheduleModifier(); + ::mlir::UnitAttr getSimdModifierAttr(); + bool getSimdModifier(); + ::mlir::UnitAttr getNowaitAttr(); + bool getNowait(); + ::mlir::IntegerAttr getOrderedValAttr(); + ::std::optional getOrderedVal(); + ::mlir::omp::ClauseOrderKindAttr getOrderValAttr(); + ::std::optional<::mlir::omp::ClauseOrderKind> getOrderVal(); + ::mlir::UnitAttr getInclusiveAttr(); + bool getInclusive(); + void setReductionsAttr(::mlir::ArrayAttr attr); + void setScheduleValAttr(::mlir::omp::ClauseScheduleKindAttr attr); + void setScheduleVal(::std::optional<::mlir::omp::ClauseScheduleKind> attrValue); + void setScheduleModifierAttr(::mlir::omp::ScheduleModifierAttr attr); + void setScheduleModifier(::std::optional<::mlir::omp::ScheduleModifier> attrValue); + void setSimdModifierAttr(::mlir::UnitAttr attr); + void setSimdModifier(bool attrValue); + void setNowaitAttr(::mlir::UnitAttr attr); + void setNowait(bool attrValue); + void setOrderedValAttr(::mlir::IntegerAttr attr); + void setOrderedVal(::std::optional attrValue); + void setOrderValAttr(::mlir::omp::ClauseOrderKindAttr attr); + void setOrderVal(::std::optional<::mlir::omp::ClauseOrderKind> attrValue); + void setInclusiveAttr(::mlir::UnitAttr attr); + void setInclusive(bool attrValue); + ::mlir::Attribute removeReductionsAttr(); + ::mlir::Attribute removeScheduleValAttr(); + ::mlir::Attribute removeScheduleModifierAttr(); + ::mlir::Attribute removeSimdModifierAttr(); + ::mlir::Attribute removeNowaitAttr(); + ::mlir::Attribute removeOrderedValAttr(); + ::mlir::Attribute removeOrderValAttr(); + ::mlir::Attribute removeInclusiveAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange lowerBound, ValueRange upperBound, ValueRange step, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange linear_vars, ::mlir::ValueRange linear_step_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseScheduleKindAttr schedule_val, /*optional*/::mlir::Value schedule_chunk_var, /*optional*/::mlir::omp::ScheduleModifierAttr schedule_modifier, /*optional*/::mlir::UnitAttr simd_modifier, /*optional*/::mlir::UnitAttr nowait, /*optional*/::mlir::IntegerAttr ordered_val, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::UnitAttr inclusive); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange linear_vars, ::mlir::ValueRange linear_step_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseScheduleKindAttr schedule_val, /*optional*/::mlir::Value schedule_chunk_var, /*optional*/::mlir::omp::ScheduleModifierAttr schedule_modifier, /*optional*/::mlir::UnitAttr simd_modifier, /*optional*/::mlir::UnitAttr nowait, /*optional*/::mlir::IntegerAttr ordered_val, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/::mlir::UnitAttr inclusive); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange linear_vars, ::mlir::ValueRange linear_step_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseScheduleKindAttr schedule_val, /*optional*/::mlir::Value schedule_chunk_var, /*optional*/::mlir::omp::ScheduleModifierAttr schedule_modifier, /*optional*/bool simd_modifier, /*optional*/bool nowait, /*optional*/::mlir::IntegerAttr ordered_val, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/bool inclusive = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange lowerBound, ::mlir::ValueRange upperBound, ::mlir::ValueRange step, ::mlir::ValueRange linear_vars, ::mlir::ValueRange linear_step_vars, ::mlir::ValueRange reduction_vars, /*optional*/::mlir::ArrayAttr reductions, /*optional*/::mlir::omp::ClauseScheduleKindAttr schedule_val, /*optional*/::mlir::Value schedule_chunk_var, /*optional*/::mlir::omp::ScheduleModifierAttr schedule_modifier, /*optional*/bool simd_modifier, /*optional*/bool nowait, /*optional*/::mlir::IntegerAttr ordered_val, /*optional*/::mlir::omp::ClauseOrderKindAttr order_val, /*optional*/bool inclusive = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns the number of loops in the worksharing-loop nest. + unsigned getNumLoops() { return getLowerBound().size(); } + + /// Returns the number of reduction variables. + unsigned getNumReductionVars() { return getReductionVars().size(); } +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::WsLoopOp) + +namespace mlir { +namespace omp { + +//===----------------------------------------------------------------------===// +// ::mlir::omp::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getResults() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("omp.yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getResults(); + ::mlir::MutableOperandRange getResultsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange results); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..1eb94c079b8b42a12ecbf26b75a84d7f878a3e09 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.cpp.inc @@ -0,0 +1,1833 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_LIST +#undef GET_ATTRDEF_LIST + +::mlir::omp::ClauseCancellationConstructTypeAttr, +::mlir::omp::ClauseDependAttr, +::mlir::omp::ClauseRequiresAttr, +::mlir::omp::ClauseTaskDependAttr, +::mlir::omp::DeclareTargetAttr, +::mlir::omp::DeclareTargetCaptureClauseAttr, +::mlir::omp::DeclareTargetDeviceTypeAttr, +::mlir::omp::FlagsAttr, +::mlir::omp::ClauseGrainsizeTypeAttr, +::mlir::omp::ClauseMemoryOrderKindAttr, +::mlir::omp::ClauseNumTasksTypeAttr, +::mlir::omp::ClauseOrderKindAttr, +::mlir::omp::ClauseProcBindKindAttr, +::mlir::omp::ClauseScheduleKindAttr, +::mlir::omp::ScheduleModifierAttr, +::mlir::omp::TargetAttr, +::mlir::omp::VariableCaptureKindAttr, +::mlir::omp::VersionAttr + +#endif // GET_ATTRDEF_LIST + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + +static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::omp::ClauseCancellationConstructTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseCancellationConstructTypeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ClauseDependAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseDependAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ClauseRequiresAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseRequiresAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ClauseTaskDependAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseTaskDependAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::DeclareTargetAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::DeclareTargetAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::DeclareTargetCaptureClauseAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::DeclareTargetCaptureClauseAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::DeclareTargetDeviceTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::DeclareTargetDeviceTypeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::FlagsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::FlagsAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ClauseGrainsizeTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseGrainsizeTypeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ClauseMemoryOrderKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseMemoryOrderKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ClauseNumTasksTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseNumTasksTypeAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ClauseOrderKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseOrderKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ClauseProcBindKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseProcBindKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ClauseScheduleKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ClauseScheduleKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::ScheduleModifierAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::ScheduleModifierAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::TargetAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::TargetAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::VariableCaptureKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::VariableCaptureKindAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Case(::mlir::omp::VersionAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::VersionAttr::parse(parser, type); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::omp::ClauseCancellationConstructTypeAttr>([&](auto t) { + printer << ::mlir::omp::ClauseCancellationConstructTypeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ClauseDependAttr>([&](auto t) { + printer << ::mlir::omp::ClauseDependAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ClauseRequiresAttr>([&](auto t) { + printer << ::mlir::omp::ClauseRequiresAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ClauseTaskDependAttr>([&](auto t) { + printer << ::mlir::omp::ClauseTaskDependAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::DeclareTargetAttr>([&](auto t) { + printer << ::mlir::omp::DeclareTargetAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::DeclareTargetCaptureClauseAttr>([&](auto t) { + printer << ::mlir::omp::DeclareTargetCaptureClauseAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::DeclareTargetDeviceTypeAttr>([&](auto t) { + printer << ::mlir::omp::DeclareTargetDeviceTypeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::FlagsAttr>([&](auto t) { + printer << ::mlir::omp::FlagsAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ClauseGrainsizeTypeAttr>([&](auto t) { + printer << ::mlir::omp::ClauseGrainsizeTypeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ClauseMemoryOrderKindAttr>([&](auto t) { + printer << ::mlir::omp::ClauseMemoryOrderKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ClauseNumTasksTypeAttr>([&](auto t) { + printer << ::mlir::omp::ClauseNumTasksTypeAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ClauseOrderKindAttr>([&](auto t) { + printer << ::mlir::omp::ClauseOrderKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ClauseProcBindKindAttr>([&](auto t) { + printer << ::mlir::omp::ClauseProcBindKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ClauseScheduleKindAttr>([&](auto t) { + printer << ::mlir::omp::ClauseScheduleKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::ScheduleModifierAttr>([&](auto t) { + printer << ::mlir::omp::ScheduleModifierAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::TargetAttr>([&](auto t) { + printer << ::mlir::omp::TargetAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::VariableCaptureKindAttr>([&](auto t) { + printer << ::mlir::omp::VariableCaptureKindAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::omp::VersionAttr>([&](auto t) { + printer << ::mlir::omp::VersionAttr::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace omp { +namespace detail { +struct ClauseCancellationConstructTypeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseCancellationConstructType>; + ClauseCancellationConstructTypeAttrStorage(::mlir::omp::ClauseCancellationConstructType value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseCancellationConstructTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseCancellationConstructTypeAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseCancellationConstructType value; +}; +} // namespace detail +ClauseCancellationConstructTypeAttr ClauseCancellationConstructTypeAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseCancellationConstructType value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseCancellationConstructTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseCancellationConstructType> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseCancellationConstructType> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseCancellationConstructType(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseCancellationConstructType" << " to be one of: " << "parallel" << ", " << "loop" << ", " << "sections" << ", " << "taskgroup")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CancellationConstructTypeAttr parameter 'value' which is to be a `::mlir::omp::ClauseCancellationConstructType`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ClauseCancellationConstructTypeAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseCancellationConstructType((*_result_value))); +} + +void ClauseCancellationConstructTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyClauseCancellationConstructType(getValue()); +} + +::mlir::omp::ClauseCancellationConstructType ClauseCancellationConstructTypeAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseCancellationConstructTypeAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ClauseDependAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseDepend>; + ClauseDependAttrStorage(::mlir::omp::ClauseDepend value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseDependAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseDependAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseDepend value; +}; +} // namespace detail +ClauseDependAttr ClauseDependAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseDepend value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseDependAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseDepend> _result_value; + // Parse literal '(' + if (odsParser.parseLParen()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseDepend> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseDepend(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseDepend" << " to be one of: " << "dependsource" << ", " << "dependsink")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ClauseDependAttr parameter 'value' which is to be a `::mlir::omp::ClauseDepend`"); + return {}; + } + // Parse literal ')' + if (odsParser.parseRParen()) return {}; + assert(::mlir::succeeded(_result_value)); + return ClauseDependAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseDepend((*_result_value))); +} + +void ClauseDependAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "("; + odsPrinter << stringifyClauseDepend(getValue()); + odsPrinter << ")"; +} + +::mlir::omp::ClauseDepend ClauseDependAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseDependAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ClauseRequiresAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseRequires>; + ClauseRequiresAttrStorage(::mlir::omp::ClauseRequires value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseRequiresAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseRequiresAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseRequires value; +}; +} // namespace detail +ClauseRequiresAttr ClauseRequiresAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseRequires value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseRequiresAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseRequires> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseRequires> { + ::mlir::omp::ClauseRequires flags = {}; + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + do { + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseRequires(enumKeyword); + if (!maybeEnum) { + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseRequires" << " to be one of: " << "none" << ", " << "reverse_offload" << ", " << "unified_address" << ", " << "unified_shared_memory" << ", " << "dynamic_allocators")}; + } + flags = flags | *maybeEnum; + } while(::mlir::succeeded(odsParser.parseOptionalVerticalBar())); + return flags; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ClauseRequiresAttr parameter 'value' which is to be a `::mlir::omp::ClauseRequires`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ClauseRequiresAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseRequires((*_result_value))); +} + +void ClauseRequiresAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyClauseRequires(getValue()); +} + +::mlir::omp::ClauseRequires ClauseRequiresAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseRequiresAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ClauseTaskDependAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseTaskDepend>; + ClauseTaskDependAttrStorage(::mlir::omp::ClauseTaskDepend value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseTaskDependAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseTaskDependAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseTaskDepend value; +}; +} // namespace detail +ClauseTaskDependAttr ClauseTaskDependAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseTaskDepend value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseTaskDependAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseTaskDepend> _result_value; + // Parse literal '(' + if (odsParser.parseLParen()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseTaskDepend> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseTaskDepend(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseTaskDepend" << " to be one of: " << "taskdependin" << ", " << "taskdependout" << ", " << "taskdependinout")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ClauseTaskDependAttr parameter 'value' which is to be a `::mlir::omp::ClauseTaskDepend`"); + return {}; + } + // Parse literal ')' + if (odsParser.parseRParen()) return {}; + assert(::mlir::succeeded(_result_value)); + return ClauseTaskDependAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseTaskDepend((*_result_value))); +} + +void ClauseTaskDependAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "("; + odsPrinter << stringifyClauseTaskDepend(getValue()); + odsPrinter << ")"; +} + +::mlir::omp::ClauseTaskDepend ClauseTaskDependAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseTaskDependAttr) +namespace mlir { +namespace omp { +namespace detail { +struct DeclareTargetAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + DeclareTargetAttrStorage(DeclareTargetDeviceTypeAttr device_type, DeclareTargetCaptureClauseAttr capture_clause) : device_type(std::move(device_type)), capture_clause(std::move(capture_clause)) {} + + KeyTy getAsKey() const { + return KeyTy(device_type, capture_clause); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (device_type == std::get<0>(tblgenKey)) && (capture_clause == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static DeclareTargetAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto device_type = std::move(std::get<0>(tblgenKey)); + auto capture_clause = std::move(std::get<1>(tblgenKey)); + return new (allocator.allocate()) DeclareTargetAttrStorage(std::move(device_type), std::move(capture_clause)); + } + + DeclareTargetDeviceTypeAttr device_type; + DeclareTargetCaptureClauseAttr capture_clause; +}; +} // namespace detail +DeclareTargetAttr DeclareTargetAttr::get(::mlir::MLIRContext *context, DeclareTargetDeviceTypeAttr device_type, DeclareTargetCaptureClauseAttr capture_clause) { + return Base::get(context, std::move(device_type), std::move(capture_clause)); +} + +::mlir::Attribute DeclareTargetAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_device_type; + ::mlir::FailureOr _result_capture_clause; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_device_type = false; + bool _seen_capture_clause = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_device_type && _paramKey == "device_type") { + _seen_device_type = true; + + // Parse variable 'device_type' + _result_device_type = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_device_type)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareTargetAttr parameter 'device_type' which is to be a `DeclareTargetDeviceTypeAttr`"); + return {}; + } + } else if (!_seen_capture_clause && _paramKey == "capture_clause") { + _seen_capture_clause = true; + + // Parse variable 'capture_clause' + _result_capture_clause = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_capture_clause)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareTargetAttr parameter 'capture_clause' which is to be a `DeclareTargetCaptureClauseAttr`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return DeclareTargetAttr::get(odsParser.getContext(), + DeclareTargetDeviceTypeAttr((_result_device_type.value_or(DeclareTargetDeviceTypeAttr()))), + DeclareTargetCaptureClauseAttr((_result_capture_clause.value_or(DeclareTargetCaptureClauseAttr())))); +} + +void DeclareTargetAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getDeviceType() == DeclareTargetDeviceTypeAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "device_type = "; + if (!(getDeviceType() == DeclareTargetDeviceTypeAttr())) { + odsPrinter.printStrippedAttrOrType(getDeviceType()); + } + } + if (!(getCaptureClause() == DeclareTargetCaptureClauseAttr())) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "capture_clause = "; + if (!(getCaptureClause() == DeclareTargetCaptureClauseAttr())) { + odsPrinter.printStrippedAttrOrType(getCaptureClause()); + } + } + } + odsPrinter << ">"; +} + +DeclareTargetDeviceTypeAttr DeclareTargetAttr::getDeviceType() const { + return getImpl()->device_type; +} + +DeclareTargetCaptureClauseAttr DeclareTargetAttr::getCaptureClause() const { + return getImpl()->capture_clause; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::DeclareTargetAttr) +namespace mlir { +namespace omp { +namespace detail { +struct DeclareTargetCaptureClauseAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::DeclareTargetCaptureClause>; + DeclareTargetCaptureClauseAttrStorage(::mlir::omp::DeclareTargetCaptureClause value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static DeclareTargetCaptureClauseAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) DeclareTargetCaptureClauseAttrStorage(std::move(value)); + } + + ::mlir::omp::DeclareTargetCaptureClause value; +}; +} // namespace detail +DeclareTargetCaptureClauseAttr DeclareTargetCaptureClauseAttr::get(::mlir::MLIRContext *context, ::mlir::omp::DeclareTargetCaptureClause value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute DeclareTargetCaptureClauseAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::DeclareTargetCaptureClause> _result_value; + // Parse literal '(' + if (odsParser.parseLParen()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::DeclareTargetCaptureClause> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeDeclareTargetCaptureClause(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::DeclareTargetCaptureClause" << " to be one of: " << "to" << ", " << "link")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareTargetCaptureClauseAttr parameter 'value' which is to be a `::mlir::omp::DeclareTargetCaptureClause`"); + return {}; + } + // Parse literal ')' + if (odsParser.parseRParen()) return {}; + assert(::mlir::succeeded(_result_value)); + return DeclareTargetCaptureClauseAttr::get(odsParser.getContext(), + ::mlir::omp::DeclareTargetCaptureClause((*_result_value))); +} + +void DeclareTargetCaptureClauseAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "("; + odsPrinter << stringifyDeclareTargetCaptureClause(getValue()); + odsPrinter << ")"; +} + +::mlir::omp::DeclareTargetCaptureClause DeclareTargetCaptureClauseAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::DeclareTargetCaptureClauseAttr) +namespace mlir { +namespace omp { +namespace detail { +struct DeclareTargetDeviceTypeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::DeclareTargetDeviceType>; + DeclareTargetDeviceTypeAttrStorage(::mlir::omp::DeclareTargetDeviceType value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static DeclareTargetDeviceTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) DeclareTargetDeviceTypeAttrStorage(std::move(value)); + } + + ::mlir::omp::DeclareTargetDeviceType value; +}; +} // namespace detail +DeclareTargetDeviceTypeAttr DeclareTargetDeviceTypeAttr::get(::mlir::MLIRContext *context, ::mlir::omp::DeclareTargetDeviceType value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute DeclareTargetDeviceTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::DeclareTargetDeviceType> _result_value; + // Parse literal '(' + if (odsParser.parseLParen()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::DeclareTargetDeviceType> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeDeclareTargetDeviceType(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::DeclareTargetDeviceType" << " to be one of: " << "any" << ", " << "host" << ", " << "nohost")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareTargetDeviceTypeAttr parameter 'value' which is to be a `::mlir::omp::DeclareTargetDeviceType`"); + return {}; + } + // Parse literal ')' + if (odsParser.parseRParen()) return {}; + assert(::mlir::succeeded(_result_value)); + return DeclareTargetDeviceTypeAttr::get(odsParser.getContext(), + ::mlir::omp::DeclareTargetDeviceType((*_result_value))); +} + +void DeclareTargetDeviceTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "("; + odsPrinter << stringifyDeclareTargetDeviceType(getValue()); + odsPrinter << ")"; +} + +::mlir::omp::DeclareTargetDeviceType DeclareTargetDeviceTypeAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::DeclareTargetDeviceTypeAttr) +namespace mlir { +namespace omp { +namespace detail { +struct FlagsAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + FlagsAttrStorage(uint32_t debug_kind, bool assume_teams_oversubscription, bool assume_threads_oversubscription, bool assume_no_thread_state, bool assume_no_nested_parallelism, uint32_t openmp_device_version) : debug_kind(std::move(debug_kind)), assume_teams_oversubscription(std::move(assume_teams_oversubscription)), assume_threads_oversubscription(std::move(assume_threads_oversubscription)), assume_no_thread_state(std::move(assume_no_thread_state)), assume_no_nested_parallelism(std::move(assume_no_nested_parallelism)), openmp_device_version(std::move(openmp_device_version)) {} + + KeyTy getAsKey() const { + return KeyTy(debug_kind, assume_teams_oversubscription, assume_threads_oversubscription, assume_no_thread_state, assume_no_nested_parallelism, openmp_device_version); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (debug_kind == std::get<0>(tblgenKey)) && (assume_teams_oversubscription == std::get<1>(tblgenKey)) && (assume_threads_oversubscription == std::get<2>(tblgenKey)) && (assume_no_thread_state == std::get<3>(tblgenKey)) && (assume_no_nested_parallelism == std::get<4>(tblgenKey)) && (openmp_device_version == std::get<5>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey)); + } + + static FlagsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto debug_kind = std::move(std::get<0>(tblgenKey)); + auto assume_teams_oversubscription = std::move(std::get<1>(tblgenKey)); + auto assume_threads_oversubscription = std::move(std::get<2>(tblgenKey)); + auto assume_no_thread_state = std::move(std::get<3>(tblgenKey)); + auto assume_no_nested_parallelism = std::move(std::get<4>(tblgenKey)); + auto openmp_device_version = std::move(std::get<5>(tblgenKey)); + return new (allocator.allocate()) FlagsAttrStorage(std::move(debug_kind), std::move(assume_teams_oversubscription), std::move(assume_threads_oversubscription), std::move(assume_no_thread_state), std::move(assume_no_nested_parallelism), std::move(openmp_device_version)); + } + + uint32_t debug_kind; + bool assume_teams_oversubscription; + bool assume_threads_oversubscription; + bool assume_no_thread_state; + bool assume_no_nested_parallelism; + uint32_t openmp_device_version; +}; +} // namespace detail +FlagsAttr FlagsAttr::get(::mlir::MLIRContext *context, uint32_t debug_kind, bool assume_teams_oversubscription, bool assume_threads_oversubscription, bool assume_no_thread_state, bool assume_no_nested_parallelism, uint32_t openmp_device_version) { + return Base::get(context, std::move(debug_kind), std::move(assume_teams_oversubscription), std::move(assume_threads_oversubscription), std::move(assume_no_thread_state), std::move(assume_no_nested_parallelism), std::move(openmp_device_version)); +} + +::mlir::Attribute FlagsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_debug_kind; + ::mlir::FailureOr _result_assume_teams_oversubscription; + ::mlir::FailureOr _result_assume_threads_oversubscription; + ::mlir::FailureOr _result_assume_no_thread_state; + ::mlir::FailureOr _result_assume_no_nested_parallelism; + ::mlir::FailureOr _result_openmp_device_version; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_debug_kind = false; + bool _seen_assume_teams_oversubscription = false; + bool _seen_assume_threads_oversubscription = false; + bool _seen_assume_no_thread_state = false; + bool _seen_assume_no_nested_parallelism = false; + bool _seen_openmp_device_version = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_debug_kind && _paramKey == "debug_kind") { + _seen_debug_kind = true; + + // Parse variable 'debug_kind' + _result_debug_kind = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_debug_kind)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse FlagsAttr parameter 'debug_kind' which is to be a `uint32_t`"); + return {}; + } + } else if (!_seen_assume_teams_oversubscription && _paramKey == "assume_teams_oversubscription") { + _seen_assume_teams_oversubscription = true; + + // Parse variable 'assume_teams_oversubscription' + _result_assume_teams_oversubscription = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_assume_teams_oversubscription)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse FlagsAttr parameter 'assume_teams_oversubscription' which is to be a `bool`"); + return {}; + } + } else if (!_seen_assume_threads_oversubscription && _paramKey == "assume_threads_oversubscription") { + _seen_assume_threads_oversubscription = true; + + // Parse variable 'assume_threads_oversubscription' + _result_assume_threads_oversubscription = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_assume_threads_oversubscription)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse FlagsAttr parameter 'assume_threads_oversubscription' which is to be a `bool`"); + return {}; + } + } else if (!_seen_assume_no_thread_state && _paramKey == "assume_no_thread_state") { + _seen_assume_no_thread_state = true; + + // Parse variable 'assume_no_thread_state' + _result_assume_no_thread_state = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_assume_no_thread_state)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse FlagsAttr parameter 'assume_no_thread_state' which is to be a `bool`"); + return {}; + } + } else if (!_seen_assume_no_nested_parallelism && _paramKey == "assume_no_nested_parallelism") { + _seen_assume_no_nested_parallelism = true; + + // Parse variable 'assume_no_nested_parallelism' + _result_assume_no_nested_parallelism = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_assume_no_nested_parallelism)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse FlagsAttr parameter 'assume_no_nested_parallelism' which is to be a `bool`"); + return {}; + } + } else if (!_seen_openmp_device_version && _paramKey == "openmp_device_version") { + _seen_openmp_device_version = true; + + // Parse variable 'openmp_device_version' + _result_openmp_device_version = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_openmp_device_version)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse FlagsAttr parameter 'openmp_device_version' which is to be a `uint32_t`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + ::llvm::StringRef _paramKey; + if (!odsParser.parseOptionalKeyword(&_paramKey)) { + if (!_loop_body(_paramKey)) return {}; + while (!odsParser.parseOptionalComma()) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + } + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + return FlagsAttr::get(odsParser.getContext(), + uint32_t((_result_debug_kind.value_or(0))), + bool((_result_assume_teams_oversubscription.value_or(false))), + bool((_result_assume_threads_oversubscription.value_or(false))), + bool((_result_assume_no_thread_state.value_or(false))), + bool((_result_assume_no_nested_parallelism.value_or(false))), + uint32_t((_result_openmp_device_version.value_or(50)))); +} + +void FlagsAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!(getDebugKind() == 0)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "debug_kind = "; + if (!(getDebugKind() == 0)) { + odsPrinter.printStrippedAttrOrType(getDebugKind()); + } + } + if (!(getAssumeTeamsOversubscription() == false)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "assume_teams_oversubscription = "; + if (!(getAssumeTeamsOversubscription() == false)) { + odsPrinter.printStrippedAttrOrType(getAssumeTeamsOversubscription()); + } + } + if (!(getAssumeThreadsOversubscription() == false)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "assume_threads_oversubscription = "; + if (!(getAssumeThreadsOversubscription() == false)) { + odsPrinter.printStrippedAttrOrType(getAssumeThreadsOversubscription()); + } + } + if (!(getAssumeNoThreadState() == false)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "assume_no_thread_state = "; + if (!(getAssumeNoThreadState() == false)) { + odsPrinter.printStrippedAttrOrType(getAssumeNoThreadState()); + } + } + if (!(getAssumeNoNestedParallelism() == false)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "assume_no_nested_parallelism = "; + if (!(getAssumeNoNestedParallelism() == false)) { + odsPrinter.printStrippedAttrOrType(getAssumeNoNestedParallelism()); + } + } + if (!(getOpenmpDeviceVersion() == 50)) { + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "openmp_device_version = "; + if (!(getOpenmpDeviceVersion() == 50)) { + odsPrinter.printStrippedAttrOrType(getOpenmpDeviceVersion()); + } + } + } + odsPrinter << ">"; +} + +uint32_t FlagsAttr::getDebugKind() const { + return getImpl()->debug_kind; +} + +bool FlagsAttr::getAssumeTeamsOversubscription() const { + return getImpl()->assume_teams_oversubscription; +} + +bool FlagsAttr::getAssumeThreadsOversubscription() const { + return getImpl()->assume_threads_oversubscription; +} + +bool FlagsAttr::getAssumeNoThreadState() const { + return getImpl()->assume_no_thread_state; +} + +bool FlagsAttr::getAssumeNoNestedParallelism() const { + return getImpl()->assume_no_nested_parallelism; +} + +uint32_t FlagsAttr::getOpenmpDeviceVersion() const { + return getImpl()->openmp_device_version; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::FlagsAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ClauseGrainsizeTypeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseGrainsizeType>; + ClauseGrainsizeTypeAttrStorage(::mlir::omp::ClauseGrainsizeType value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseGrainsizeTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseGrainsizeTypeAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseGrainsizeType value; +}; +} // namespace detail +ClauseGrainsizeTypeAttr ClauseGrainsizeTypeAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseGrainsizeType value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseGrainsizeTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseGrainsizeType> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseGrainsizeType> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseGrainsizeType(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseGrainsizeType" << " to be one of: " << "strict")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse GrainsizeTypeAttr parameter 'value' which is to be a `::mlir::omp::ClauseGrainsizeType`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ClauseGrainsizeTypeAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseGrainsizeType((*_result_value))); +} + +void ClauseGrainsizeTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyClauseGrainsizeType(getValue()); +} + +::mlir::omp::ClauseGrainsizeType ClauseGrainsizeTypeAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseGrainsizeTypeAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ClauseMemoryOrderKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseMemoryOrderKind>; + ClauseMemoryOrderKindAttrStorage(::mlir::omp::ClauseMemoryOrderKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseMemoryOrderKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseMemoryOrderKindAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseMemoryOrderKind value; +}; +} // namespace detail +ClauseMemoryOrderKindAttr ClauseMemoryOrderKindAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseMemoryOrderKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseMemoryOrderKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseMemoryOrderKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseMemoryOrderKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseMemoryOrderKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseMemoryOrderKind" << " to be one of: " << "seq_cst" << ", " << "acq_rel" << ", " << "acquire" << ", " << "release" << ", " << "relaxed")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse MemoryOrderKindAttr parameter 'value' which is to be a `::mlir::omp::ClauseMemoryOrderKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ClauseMemoryOrderKindAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseMemoryOrderKind((*_result_value))); +} + +void ClauseMemoryOrderKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyClauseMemoryOrderKind(getValue()); +} + +::mlir::omp::ClauseMemoryOrderKind ClauseMemoryOrderKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseMemoryOrderKindAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ClauseNumTasksTypeAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseNumTasksType>; + ClauseNumTasksTypeAttrStorage(::mlir::omp::ClauseNumTasksType value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseNumTasksTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseNumTasksTypeAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseNumTasksType value; +}; +} // namespace detail +ClauseNumTasksTypeAttr ClauseNumTasksTypeAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseNumTasksType value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseNumTasksTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseNumTasksType> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseNumTasksType> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseNumTasksType(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseNumTasksType" << " to be one of: " << "strict")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse NumTasksTypeAttr parameter 'value' which is to be a `::mlir::omp::ClauseNumTasksType`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ClauseNumTasksTypeAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseNumTasksType((*_result_value))); +} + +void ClauseNumTasksTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyClauseNumTasksType(getValue()); +} + +::mlir::omp::ClauseNumTasksType ClauseNumTasksTypeAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseNumTasksTypeAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ClauseOrderKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseOrderKind>; + ClauseOrderKindAttrStorage(::mlir::omp::ClauseOrderKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseOrderKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseOrderKindAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseOrderKind value; +}; +} // namespace detail +ClauseOrderKindAttr ClauseOrderKindAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseOrderKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseOrderKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseOrderKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseOrderKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseOrderKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseOrderKind" << " to be one of: " << "concurrent")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OrderKindAttr parameter 'value' which is to be a `::mlir::omp::ClauseOrderKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ClauseOrderKindAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseOrderKind((*_result_value))); +} + +void ClauseOrderKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyClauseOrderKind(getValue()); +} + +::mlir::omp::ClauseOrderKind ClauseOrderKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseOrderKindAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ClauseProcBindKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseProcBindKind>; + ClauseProcBindKindAttrStorage(::mlir::omp::ClauseProcBindKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseProcBindKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseProcBindKindAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseProcBindKind value; +}; +} // namespace detail +ClauseProcBindKindAttr ClauseProcBindKindAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseProcBindKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseProcBindKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseProcBindKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseProcBindKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseProcBindKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseProcBindKind" << " to be one of: " << "primary" << ", " << "master" << ", " << "close" << ", " << "spread")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ProcBindKindAttr parameter 'value' which is to be a `::mlir::omp::ClauseProcBindKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ClauseProcBindKindAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseProcBindKind((*_result_value))); +} + +void ClauseProcBindKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyClauseProcBindKind(getValue()); +} + +::mlir::omp::ClauseProcBindKind ClauseProcBindKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseProcBindKindAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ClauseScheduleKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ClauseScheduleKind>; + ClauseScheduleKindAttrStorage(::mlir::omp::ClauseScheduleKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ClauseScheduleKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ClauseScheduleKindAttrStorage(std::move(value)); + } + + ::mlir::omp::ClauseScheduleKind value; +}; +} // namespace detail +ClauseScheduleKindAttr ClauseScheduleKindAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ClauseScheduleKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ClauseScheduleKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ClauseScheduleKind> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ClauseScheduleKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeClauseScheduleKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ClauseScheduleKind" << " to be one of: " << "static" << ", " << "dynamic" << ", " << "guided" << ", " << "auto" << ", " << "runtime")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ScheduleKindAttr parameter 'value' which is to be a `::mlir::omp::ClauseScheduleKind`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ClauseScheduleKindAttr::get(odsParser.getContext(), + ::mlir::omp::ClauseScheduleKind((*_result_value))); +} + +void ClauseScheduleKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyClauseScheduleKind(getValue()); +} + +::mlir::omp::ClauseScheduleKind ClauseScheduleKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseScheduleKindAttr) +namespace mlir { +namespace omp { +namespace detail { +struct ScheduleModifierAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::ScheduleModifier>; + ScheduleModifierAttrStorage(::mlir::omp::ScheduleModifier value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static ScheduleModifierAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) ScheduleModifierAttrStorage(std::move(value)); + } + + ::mlir::omp::ScheduleModifier value; +}; +} // namespace detail +ScheduleModifierAttr ScheduleModifierAttr::get(::mlir::MLIRContext *context, ::mlir::omp::ScheduleModifier value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute ScheduleModifierAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::ScheduleModifier> _result_value; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::ScheduleModifier> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeScheduleModifier(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::ScheduleModifier" << " to be one of: " << "none" << ", " << "monotonic" << ", " << "nonmonotonic" << ", " << "simd")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ScheduleModifierAttr parameter 'value' which is to be a `::mlir::omp::ScheduleModifier`"); + return {}; + } + assert(::mlir::succeeded(_result_value)); + return ScheduleModifierAttr::get(odsParser.getContext(), + ::mlir::omp::ScheduleModifier((*_result_value))); +} + +void ScheduleModifierAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << ' '; + odsPrinter << stringifyScheduleModifier(getValue()); +} + +::mlir::omp::ScheduleModifier ScheduleModifierAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::ScheduleModifierAttr) +namespace mlir { +namespace omp { +namespace detail { +struct TargetAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::llvm::StringRef, ::llvm::StringRef>; + TargetAttrStorage(::llvm::StringRef target_cpu, ::llvm::StringRef target_features) : target_cpu(std::move(target_cpu)), target_features(std::move(target_features)) {} + + KeyTy getAsKey() const { + return KeyTy(target_cpu, target_features); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (target_cpu == std::get<0>(tblgenKey)) && (target_features == std::get<1>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); + } + + static TargetAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto target_cpu = std::move(std::get<0>(tblgenKey)); + auto target_features = std::move(std::get<1>(tblgenKey)); + target_cpu = allocator.copyInto(target_cpu); + target_features = allocator.copyInto(target_features); + return new (allocator.allocate()) TargetAttrStorage(std::move(target_cpu), std::move(target_features)); + } + + ::llvm::StringRef target_cpu; + ::llvm::StringRef target_features; +}; +} // namespace detail +TargetAttr TargetAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef target_cpu, ::llvm::StringRef target_features) { + return Base::get(context, std::move(target_cpu), std::move(target_features)); +} + +::mlir::Attribute TargetAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_target_cpu; + ::mlir::FailureOr _result_target_features; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_target_cpu = false; + bool _seen_target_features = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_target_cpu && _paramKey == "target_cpu") { + _seen_target_cpu = true; + + // Parse variable 'target_cpu' + _result_target_cpu = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_target_cpu)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TargetAttr parameter 'target_cpu' which is to be a `::llvm::StringRef`"); + return {}; + } + } else if (!_seen_target_features && _paramKey == "target_features") { + _seen_target_features = true; + + // Parse variable 'target_features' + _result_target_features = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_target_features)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TargetAttr parameter 'target_features' which is to be a `::llvm::StringRef`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 2 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_target_cpu)); + assert(::mlir::succeeded(_result_target_features)); + return TargetAttr::get(odsParser.getContext(), + ::llvm::StringRef((*_result_target_cpu)), + ::llvm::StringRef((*_result_target_features))); +} + +void TargetAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "target_cpu = "; + odsPrinter.printString(getTargetCpu());; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "target_features = "; + odsPrinter.printString(getTargetFeatures());; + } + odsPrinter << ">"; +} + +::llvm::StringRef TargetAttr::getTargetCpu() const { + return getImpl()->target_cpu; +} + +::llvm::StringRef TargetAttr::getTargetFeatures() const { + return getImpl()->target_features; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::TargetAttr) +namespace mlir { +namespace omp { +namespace detail { +struct VariableCaptureKindAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple<::mlir::omp::VariableCaptureKind>; + VariableCaptureKindAttrStorage(::mlir::omp::VariableCaptureKind value) : value(std::move(value)) {} + + KeyTy getAsKey() const { + return KeyTy(value); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (value == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static VariableCaptureKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto value = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) VariableCaptureKindAttrStorage(std::move(value)); + } + + ::mlir::omp::VariableCaptureKind value; +}; +} // namespace detail +VariableCaptureKindAttr VariableCaptureKindAttr::get(::mlir::MLIRContext *context, ::mlir::omp::VariableCaptureKind value) { + return Base::get(context, std::move(value)); +} + +::mlir::Attribute VariableCaptureKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr<::mlir::omp::VariableCaptureKind> _result_value; + // Parse literal '(' + if (odsParser.parseLParen()) return {}; + + // Parse variable 'value' + _result_value = [&]() -> ::mlir::FailureOr<::mlir::omp::VariableCaptureKind> { + auto loc = odsParser.getCurrentLocation(); + ::llvm::StringRef enumKeyword; + if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) + return ::mlir::failure(); + auto maybeEnum = ::mlir::omp::symbolizeVariableCaptureKind(enumKeyword); + if (maybeEnum) + return *maybeEnum; + return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::omp::VariableCaptureKind" << " to be one of: " << "This" << ", " << "ByRef" << ", " << "ByCopy" << ", " << "VLAType")}; + }(); + if (::mlir::failed(_result_value)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse VariableCaptureKindAttr parameter 'value' which is to be a `::mlir::omp::VariableCaptureKind`"); + return {}; + } + // Parse literal ')' + if (odsParser.parseRParen()) return {}; + assert(::mlir::succeeded(_result_value)); + return VariableCaptureKindAttr::get(odsParser.getContext(), + ::mlir::omp::VariableCaptureKind((*_result_value))); +} + +void VariableCaptureKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "("; + odsPrinter << stringifyVariableCaptureKind(getValue()); + odsPrinter << ")"; +} + +::mlir::omp::VariableCaptureKind VariableCaptureKindAttr::getValue() const { + return getImpl()->value; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::VariableCaptureKindAttr) +namespace mlir { +namespace omp { +namespace detail { +struct VersionAttrStorage : public ::mlir::AttributeStorage { + using KeyTy = std::tuple; + VersionAttrStorage(uint32_t version) : version(std::move(version)) {} + + KeyTy getAsKey() const { + return KeyTy(version); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (version == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static VersionAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto version = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) VersionAttrStorage(std::move(version)); + } + + uint32_t version; +}; +} // namespace detail +VersionAttr VersionAttr::get(::mlir::MLIRContext *context, uint32_t version) { + return Base::get(context, std::move(version)); +} + +::mlir::Attribute VersionAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { + ::mlir::Builder odsBuilder(odsParser.getContext()); + ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); + (void) odsLoc; + ::mlir::FailureOr _result_version; + // Parse literal '<' + if (odsParser.parseLess()) return {}; + // Parse parameter struct + bool _seen_version = false; + { + const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { + // Parse literal '=' + if (odsParser.parseEqual()) return {}; + if (!_seen_version && _paramKey == "version") { + _seen_version = true; + + // Parse variable 'version' + _result_version = ::mlir::FieldParser::parse(odsParser); + if (::mlir::failed(_result_version)) { + odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse VersionAttr parameter 'version' which is to be a `uint32_t`"); + return {}; + } + } else { + odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; + return {}; + } + return true; + }; + for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { + ::llvm::StringRef _paramKey; + if (odsParser.parseKeyword(&_paramKey)) { + odsParser.emitError(odsParser.getCurrentLocation(), + "expected a parameter name in struct"); + return {}; + } + if (!_loop_body(_paramKey)) return {}; + if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) + return {}; + } + } + // Parse literal '>' + if (odsParser.parseGreater()) return {}; + assert(::mlir::succeeded(_result_version)); + return VersionAttr::get(odsParser.getContext(), + uint32_t((*_result_version))); +} + +void VersionAttr::print(::mlir::AsmPrinter &odsPrinter) const { + ::mlir::Builder odsBuilder(getContext()); + odsPrinter << "<"; + { + bool _firstPrinted = true; + if (!_firstPrinted) odsPrinter << ", "; + _firstPrinted = false; + odsPrinter << "version = "; + odsPrinter.printStrippedAttrOrType(getVersion()); + } + odsPrinter << ">"; +} + +uint32_t VersionAttr::getVersion() const { + return getImpl()->version; +} + +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::VersionAttr) +namespace mlir { +namespace omp { + +/// Parse an attribute registered to this dialect. +::mlir::Attribute OpenMPDialect::parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef attrTag; + { + ::mlir::Attribute attr; + auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); + if (parseResult.has_value()) + return attr; + } + + parser.emitError(typeLoc) << "unknown attribute `" + << attrTag << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print an attribute registered to this dialect. +void OpenMPDialect::printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) + return; + +} +} // namespace omp +} // namespace mlir + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..aadb07cba0938510f9796a8b8a43a482f09dfe7c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.h.inc @@ -0,0 +1,336 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace omp { +class ClauseCancellationConstructTypeAttr; +class ClauseDependAttr; +class ClauseRequiresAttr; +class ClauseTaskDependAttr; +class DeclareTargetAttr; +class DeclareTargetCaptureClauseAttr; +class DeclareTargetDeviceTypeAttr; +class FlagsAttr; +class ClauseGrainsizeTypeAttr; +class ClauseMemoryOrderKindAttr; +class ClauseNumTasksTypeAttr; +class ClauseOrderKindAttr; +class ClauseProcBindKindAttr; +class ClauseScheduleKindAttr; +class ScheduleModifierAttr; +class TargetAttr; +class VariableCaptureKindAttr; +class VersionAttr; +namespace detail { +struct ClauseCancellationConstructTypeAttrStorage; +} // namespace detail +class ClauseCancellationConstructTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseCancellationConstructTypeAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseCancellationConstructType value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"cancellationconstructtype"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseCancellationConstructType getValue() const; +}; +namespace detail { +struct ClauseDependAttrStorage; +} // namespace detail +class ClauseDependAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseDependAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseDepend value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"clause_depend"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseDepend getValue() const; +}; +namespace detail { +struct ClauseRequiresAttrStorage; +} // namespace detail +class ClauseRequiresAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseRequiresAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseRequires value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"clause_requires"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseRequires getValue() const; +}; +namespace detail { +struct ClauseTaskDependAttrStorage; +} // namespace detail +class ClauseTaskDependAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseTaskDependAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseTaskDepend value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"clause_task_depend"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseTaskDepend getValue() const; +}; +namespace detail { +struct DeclareTargetAttrStorage; +} // namespace detail +class DeclareTargetAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DeclareTargetAttr get(::mlir::MLIRContext *context, DeclareTargetDeviceTypeAttr device_type, DeclareTargetCaptureClauseAttr capture_clause); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"declaretarget"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + DeclareTargetDeviceTypeAttr getDeviceType() const; + DeclareTargetCaptureClauseAttr getCaptureClause() const; +}; +namespace detail { +struct DeclareTargetCaptureClauseAttrStorage; +} // namespace detail +class DeclareTargetCaptureClauseAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DeclareTargetCaptureClauseAttr get(::mlir::MLIRContext *context, ::mlir::omp::DeclareTargetCaptureClause value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"capture_clause"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::DeclareTargetCaptureClause getValue() const; +}; +namespace detail { +struct DeclareTargetDeviceTypeAttrStorage; +} // namespace detail +class DeclareTargetDeviceTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DeclareTargetDeviceTypeAttr get(::mlir::MLIRContext *context, ::mlir::omp::DeclareTargetDeviceType value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"device_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::DeclareTargetDeviceType getValue() const; +}; +namespace detail { +struct FlagsAttrStorage; +} // namespace detail +class FlagsAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static FlagsAttr get(::mlir::MLIRContext *context, uint32_t debug_kind, bool assume_teams_oversubscription, bool assume_threads_oversubscription, bool assume_no_thread_state, bool assume_no_nested_parallelism, uint32_t openmp_device_version); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"flags"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + uint32_t getDebugKind() const; + bool getAssumeTeamsOversubscription() const; + bool getAssumeThreadsOversubscription() const; + bool getAssumeNoThreadState() const; + bool getAssumeNoNestedParallelism() const; + uint32_t getOpenmpDeviceVersion() const; +}; +namespace detail { +struct ClauseGrainsizeTypeAttrStorage; +} // namespace detail +class ClauseGrainsizeTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseGrainsizeTypeAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseGrainsizeType value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"grainsizetype"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseGrainsizeType getValue() const; +}; +namespace detail { +struct ClauseMemoryOrderKindAttrStorage; +} // namespace detail +class ClauseMemoryOrderKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseMemoryOrderKindAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseMemoryOrderKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"memoryorderkind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseMemoryOrderKind getValue() const; +}; +namespace detail { +struct ClauseNumTasksTypeAttrStorage; +} // namespace detail +class ClauseNumTasksTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseNumTasksTypeAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseNumTasksType value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"numtaskstype"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseNumTasksType getValue() const; +}; +namespace detail { +struct ClauseOrderKindAttrStorage; +} // namespace detail +class ClauseOrderKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseOrderKindAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseOrderKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"orderkind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseOrderKind getValue() const; +}; +namespace detail { +struct ClauseProcBindKindAttrStorage; +} // namespace detail +class ClauseProcBindKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseProcBindKindAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseProcBindKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"procbindkind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseProcBindKind getValue() const; +}; +namespace detail { +struct ClauseScheduleKindAttrStorage; +} // namespace detail +class ClauseScheduleKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ClauseScheduleKindAttr get(::mlir::MLIRContext *context, ::mlir::omp::ClauseScheduleKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"schedulekind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ClauseScheduleKind getValue() const; +}; +namespace detail { +struct ScheduleModifierAttrStorage; +} // namespace detail +class ScheduleModifierAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ScheduleModifierAttr get(::mlir::MLIRContext *context, ::mlir::omp::ScheduleModifier value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"sched_mod"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::ScheduleModifier getValue() const; +}; +namespace detail { +struct TargetAttrStorage; +} // namespace detail +class TargetAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TargetAttr get(::mlir::MLIRContext *context, ::llvm::StringRef target_cpu, ::llvm::StringRef target_features); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"target"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::StringRef getTargetCpu() const; + ::llvm::StringRef getTargetFeatures() const; +}; +namespace detail { +struct VariableCaptureKindAttrStorage; +} // namespace detail +class VariableCaptureKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static VariableCaptureKindAttr get(::mlir::MLIRContext *context, ::mlir::omp::VariableCaptureKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"variable_capture_kind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::omp::VariableCaptureKind getValue() const; +}; +namespace detail { +struct VersionAttrStorage; +} // namespace detail +class VersionAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static VersionAttr get(::mlir::MLIRContext *context, uint32_t version); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"version"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + uint32_t getVersion() const; +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseCancellationConstructTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseDependAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseRequiresAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseTaskDependAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::DeclareTargetAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::DeclareTargetCaptureClauseAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::DeclareTargetDeviceTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::FlagsAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseGrainsizeTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseMemoryOrderKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseNumTasksTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseOrderKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseProcBindKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ClauseScheduleKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::ScheduleModifierAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::TargetAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::VariableCaptureKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::VersionAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..a3525998e21fb3e7dc75f9d7ee2eead02123a135 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenMPOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::OpenMPDialect) +namespace mlir { +namespace omp { + +OpenMPDialect::OpenMPDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect<::mlir::LLVM::LLVMDialect, ::mlir::func::FuncDialect>(); + + initialize(); +} + +OpenMPDialect::~OpenMPDialect() = default; + +} // namespace omp +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..59e657049e06e9cfab22337e3c0b413119bd9b8d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsDialect.h.inc @@ -0,0 +1,41 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenMPOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace omp { + +class OpenMPDialect : public ::mlir::Dialect { + explicit OpenMPDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~OpenMPDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("omp"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::OpenMPDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsEnums.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsEnums.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..8902fcc94476c9d81e5eac1e4b556d40c63ae3b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsEnums.cpp.inc @@ -0,0 +1,453 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenMPOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyClauseCancellationConstructType(ClauseCancellationConstructType val) { + switch (val) { + case ClauseCancellationConstructType::Parallel: return "parallel"; + case ClauseCancellationConstructType::Loop: return "loop"; + case ClauseCancellationConstructType::Sections: return "sections"; + case ClauseCancellationConstructType::Taskgroup: return "taskgroup"; + } + return ""; +} + +::std::optional symbolizeClauseCancellationConstructType(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("parallel", ClauseCancellationConstructType::Parallel) + .Case("loop", ClauseCancellationConstructType::Loop) + .Case("sections", ClauseCancellationConstructType::Sections) + .Case("taskgroup", ClauseCancellationConstructType::Taskgroup) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseCancellationConstructType(uint32_t value) { + switch (value) { + case 0: return ClauseCancellationConstructType::Parallel; + case 1: return ClauseCancellationConstructType::Loop; + case 2: return ClauseCancellationConstructType::Sections; + case 3: return ClauseCancellationConstructType::Taskgroup; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyClauseDepend(ClauseDepend val) { + switch (val) { + case ClauseDepend::dependsource: return "dependsource"; + case ClauseDepend::dependsink: return "dependsink"; + } + return ""; +} + +::std::optional symbolizeClauseDepend(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("dependsource", ClauseDepend::dependsource) + .Case("dependsink", ClauseDepend::dependsink) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseDepend(uint32_t value) { + switch (value) { + case 0: return ClauseDepend::dependsource; + case 1: return ClauseDepend::dependsink; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +std::string stringifyClauseRequires(ClauseRequires symbol) { + auto val = static_cast(symbol); + assert(15u == (15u | val) && "invalid bits set in bit enum"); + // Special case for all bits unset. + if (val == 0) return "none"; + + ::llvm::SmallVector<::llvm::StringRef, 2> strs; + + if (1u == (1u & val)) + strs.push_back("reverse_offload"); + + if (2u == (2u & val)) + strs.push_back("unified_address"); + + if (4u == (4u & val)) + strs.push_back("unified_shared_memory"); + + if (8u == (8u & val)) + strs.push_back("dynamic_allocators"); + return ::llvm::join(strs, "|"); +} + +::std::optional symbolizeClauseRequires(::llvm::StringRef str) { + // Special case for all bits unset. + if (str == "none") return ClauseRequires::none; + + ::llvm::SmallVector<::llvm::StringRef, 2> symbols; + str.split(symbols, "|"); + + uint32_t val = 0; + for (auto symbol : symbols) { + auto bit = llvm::StringSwitch<::std::optional>(symbol.trim()) + .Case("reverse_offload", 1) + .Case("unified_address", 2) + .Case("unified_shared_memory", 4) + .Case("dynamic_allocators", 8) + .Default(::std::nullopt); + if (bit) { val |= *bit; } else { return ::std::nullopt; } + } + return static_cast(val); +} + +::std::optional symbolizeClauseRequires(uint32_t value) { + // Special case for all bits unset. + if (value == 0) return ClauseRequires::none; + + if (value & ~static_cast(15u)) return std::nullopt; + return static_cast(value); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyClauseTaskDepend(ClauseTaskDepend val) { + switch (val) { + case ClauseTaskDepend::taskdependin: return "taskdependin"; + case ClauseTaskDepend::taskdependout: return "taskdependout"; + case ClauseTaskDepend::taskdependinout: return "taskdependinout"; + } + return ""; +} + +::std::optional symbolizeClauseTaskDepend(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("taskdependin", ClauseTaskDepend::taskdependin) + .Case("taskdependout", ClauseTaskDepend::taskdependout) + .Case("taskdependinout", ClauseTaskDepend::taskdependinout) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseTaskDepend(uint32_t value) { + switch (value) { + case 0: return ClauseTaskDepend::taskdependin; + case 1: return ClauseTaskDepend::taskdependout; + case 2: return ClauseTaskDepend::taskdependinout; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyDeclareTargetCaptureClause(DeclareTargetCaptureClause val) { + switch (val) { + case DeclareTargetCaptureClause::to: return "to"; + case DeclareTargetCaptureClause::link: return "link"; + } + return ""; +} + +::std::optional symbolizeDeclareTargetCaptureClause(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("to", DeclareTargetCaptureClause::to) + .Case("link", DeclareTargetCaptureClause::link) + .Default(::std::nullopt); +} +::std::optional symbolizeDeclareTargetCaptureClause(uint32_t value) { + switch (value) { + case 0: return DeclareTargetCaptureClause::to; + case 1: return DeclareTargetCaptureClause::link; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyDeclareTargetDeviceType(DeclareTargetDeviceType val) { + switch (val) { + case DeclareTargetDeviceType::any: return "any"; + case DeclareTargetDeviceType::host: return "host"; + case DeclareTargetDeviceType::nohost: return "nohost"; + } + return ""; +} + +::std::optional symbolizeDeclareTargetDeviceType(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("any", DeclareTargetDeviceType::any) + .Case("host", DeclareTargetDeviceType::host) + .Case("nohost", DeclareTargetDeviceType::nohost) + .Default(::std::nullopt); +} +::std::optional symbolizeDeclareTargetDeviceType(uint32_t value) { + switch (value) { + case 0: return DeclareTargetDeviceType::any; + case 1: return DeclareTargetDeviceType::host; + case 2: return DeclareTargetDeviceType::nohost; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyClauseGrainsizeType(ClauseGrainsizeType val) { + switch (val) { + case ClauseGrainsizeType::Strict: return "strict"; + } + return ""; +} + +::std::optional symbolizeClauseGrainsizeType(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("strict", ClauseGrainsizeType::Strict) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseGrainsizeType(uint32_t value) { + switch (value) { + case 0: return ClauseGrainsizeType::Strict; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyClauseMemoryOrderKind(ClauseMemoryOrderKind val) { + switch (val) { + case ClauseMemoryOrderKind::Seq_cst: return "seq_cst"; + case ClauseMemoryOrderKind::Acq_rel: return "acq_rel"; + case ClauseMemoryOrderKind::Acquire: return "acquire"; + case ClauseMemoryOrderKind::Release: return "release"; + case ClauseMemoryOrderKind::Relaxed: return "relaxed"; + } + return ""; +} + +::std::optional symbolizeClauseMemoryOrderKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("seq_cst", ClauseMemoryOrderKind::Seq_cst) + .Case("acq_rel", ClauseMemoryOrderKind::Acq_rel) + .Case("acquire", ClauseMemoryOrderKind::Acquire) + .Case("release", ClauseMemoryOrderKind::Release) + .Case("relaxed", ClauseMemoryOrderKind::Relaxed) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseMemoryOrderKind(uint32_t value) { + switch (value) { + case 0: return ClauseMemoryOrderKind::Seq_cst; + case 1: return ClauseMemoryOrderKind::Acq_rel; + case 2: return ClauseMemoryOrderKind::Acquire; + case 3: return ClauseMemoryOrderKind::Release; + case 4: return ClauseMemoryOrderKind::Relaxed; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyClauseNumTasksType(ClauseNumTasksType val) { + switch (val) { + case ClauseNumTasksType::Strict: return "strict"; + } + return ""; +} + +::std::optional symbolizeClauseNumTasksType(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("strict", ClauseNumTasksType::Strict) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseNumTasksType(uint32_t value) { + switch (value) { + case 0: return ClauseNumTasksType::Strict; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyClauseOrderKind(ClauseOrderKind val) { + switch (val) { + case ClauseOrderKind::Concurrent: return "concurrent"; + } + return ""; +} + +::std::optional symbolizeClauseOrderKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("concurrent", ClauseOrderKind::Concurrent) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseOrderKind(uint32_t value) { + switch (value) { + case 1: return ClauseOrderKind::Concurrent; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyClauseProcBindKind(ClauseProcBindKind val) { + switch (val) { + case ClauseProcBindKind::Primary: return "primary"; + case ClauseProcBindKind::Master: return "master"; + case ClauseProcBindKind::Close: return "close"; + case ClauseProcBindKind::Spread: return "spread"; + } + return ""; +} + +::std::optional symbolizeClauseProcBindKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("primary", ClauseProcBindKind::Primary) + .Case("master", ClauseProcBindKind::Master) + .Case("close", ClauseProcBindKind::Close) + .Case("spread", ClauseProcBindKind::Spread) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseProcBindKind(uint32_t value) { + switch (value) { + case 0: return ClauseProcBindKind::Primary; + case 1: return ClauseProcBindKind::Master; + case 2: return ClauseProcBindKind::Close; + case 3: return ClauseProcBindKind::Spread; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyClauseScheduleKind(ClauseScheduleKind val) { + switch (val) { + case ClauseScheduleKind::Static: return "static"; + case ClauseScheduleKind::Dynamic: return "dynamic"; + case ClauseScheduleKind::Guided: return "guided"; + case ClauseScheduleKind::Auto: return "auto"; + case ClauseScheduleKind::Runtime: return "runtime"; + } + return ""; +} + +::std::optional symbolizeClauseScheduleKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("static", ClauseScheduleKind::Static) + .Case("dynamic", ClauseScheduleKind::Dynamic) + .Case("guided", ClauseScheduleKind::Guided) + .Case("auto", ClauseScheduleKind::Auto) + .Case("runtime", ClauseScheduleKind::Runtime) + .Default(::std::nullopt); +} +::std::optional symbolizeClauseScheduleKind(uint32_t value) { + switch (value) { + case 0: return ClauseScheduleKind::Static; + case 1: return ClauseScheduleKind::Dynamic; + case 2: return ClauseScheduleKind::Guided; + case 3: return ClauseScheduleKind::Auto; + case 4: return ClauseScheduleKind::Runtime; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyScheduleModifier(ScheduleModifier val) { + switch (val) { + case ScheduleModifier::none: return "none"; + case ScheduleModifier::monotonic: return "monotonic"; + case ScheduleModifier::nonmonotonic: return "nonmonotonic"; + case ScheduleModifier::simd: return "simd"; + } + return ""; +} + +::std::optional symbolizeScheduleModifier(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("none", ScheduleModifier::none) + .Case("monotonic", ScheduleModifier::monotonic) + .Case("nonmonotonic", ScheduleModifier::nonmonotonic) + .Case("simd", ScheduleModifier::simd) + .Default(::std::nullopt); +} +::std::optional symbolizeScheduleModifier(uint32_t value) { + switch (value) { + case 0: return ScheduleModifier::none; + case 1: return ScheduleModifier::monotonic; + case 2: return ScheduleModifier::nonmonotonic; + case 3: return ScheduleModifier::simd; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + +namespace mlir { +namespace omp { +::llvm::StringRef stringifyVariableCaptureKind(VariableCaptureKind val) { + switch (val) { + case VariableCaptureKind::This: return "This"; + case VariableCaptureKind::ByRef: return "ByRef"; + case VariableCaptureKind::ByCopy: return "ByCopy"; + case VariableCaptureKind::VLAType: return "VLAType"; + } + return ""; +} + +::std::optional symbolizeVariableCaptureKind(::llvm::StringRef str) { + return ::llvm::StringSwitch<::std::optional>(str) + .Case("This", VariableCaptureKind::This) + .Case("ByRef", VariableCaptureKind::ByRef) + .Case("ByCopy", VariableCaptureKind::ByCopy) + .Case("VLAType", VariableCaptureKind::VLAType) + .Default(::std::nullopt); +} +::std::optional symbolizeVariableCaptureKind(uint32_t value) { + switch (value) { + case 0: return VariableCaptureKind::This; + case 1: return VariableCaptureKind::ByRef; + case 2: return VariableCaptureKind::ByCopy; + case 3: return VariableCaptureKind::VLAType; + default: return ::std::nullopt; + } +} + +} // namespace omp +} // namespace mlir + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsEnums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsEnums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..434ee125730c2cf6d892e413011daf8603a152ed --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsEnums.h.inc @@ -0,0 +1,1184 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: OpenMPOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace omp { +// CancellationConstructType Clause +enum class ClauseCancellationConstructType : uint32_t { + Parallel = 0, + Loop = 1, + Sections = 2, + Taskgroup = 3, +}; + +::std::optional symbolizeClauseCancellationConstructType(uint32_t); +::llvm::StringRef stringifyClauseCancellationConstructType(ClauseCancellationConstructType); +::std::optional symbolizeClauseCancellationConstructType(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseCancellationConstructType() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseCancellationConstructType enumValue) { + return stringifyClauseCancellationConstructType(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseCancellationConstructType(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseCancellationConstructType, ::mlir::omp::ClauseCancellationConstructType> { + template + static FailureOr<::mlir::omp::ClauseCancellationConstructType> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for CancellationConstructType Clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseCancellationConstructType> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseCancellationConstructType>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid CancellationConstructType Clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseCancellationConstructType value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseCancellationConstructType> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseCancellationConstructType getEmptyKey() { + return static_cast<::mlir::omp::ClauseCancellationConstructType>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseCancellationConstructType getTombstoneKey() { + return static_cast<::mlir::omp::ClauseCancellationConstructType>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseCancellationConstructType &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseCancellationConstructType &lhs, const ::mlir::omp::ClauseCancellationConstructType &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// depend clause +enum class ClauseDepend : uint32_t { + dependsource = 0, + dependsink = 1, +}; + +::std::optional symbolizeClauseDepend(uint32_t); +::llvm::StringRef stringifyClauseDepend(ClauseDepend); +::std::optional symbolizeClauseDepend(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseDepend() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseDepend enumValue) { + return stringifyClauseDepend(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseDepend(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseDepend, ::mlir::omp::ClauseDepend> { + template + static FailureOr<::mlir::omp::ClauseDepend> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for depend clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseDepend> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseDepend>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid depend clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseDepend value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseDepend> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseDepend getEmptyKey() { + return static_cast<::mlir::omp::ClauseDepend>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseDepend getTombstoneKey() { + return static_cast<::mlir::omp::ClauseDepend>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseDepend &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseDepend &lhs, const ::mlir::omp::ClauseDepend &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// requires clauses +enum class ClauseRequires : uint32_t { + none = 0, + reverse_offload = 1, + unified_address = 2, + unified_shared_memory = 4, + dynamic_allocators = 8, +}; + +::std::optional symbolizeClauseRequires(uint32_t); +std::string stringifyClauseRequires(ClauseRequires); +::std::optional symbolizeClauseRequires(::llvm::StringRef); + +inline constexpr ClauseRequires operator|(ClauseRequires a, ClauseRequires b) { + return static_cast(static_cast(a) | static_cast(b)); +} +inline constexpr ClauseRequires operator&(ClauseRequires a, ClauseRequires b) { + return static_cast(static_cast(a) & static_cast(b)); +} +inline constexpr ClauseRequires operator^(ClauseRequires a, ClauseRequires b) { + return static_cast(static_cast(a) ^ static_cast(b)); +} +inline constexpr ClauseRequires operator~(ClauseRequires bits) { + // Ensure only bits that can be present in the enum are set + return static_cast(~static_cast(bits) & static_cast(15u)); +} +inline constexpr bool bitEnumContainsAll(ClauseRequires bits, ClauseRequires bit) { + return (bits & bit) == bit; +} +inline constexpr bool bitEnumContainsAny(ClauseRequires bits, ClauseRequires bit) { + return (static_cast(bits) & static_cast(bit)) != 0; +} +inline constexpr ClauseRequires bitEnumClear(ClauseRequires bits, ClauseRequires bit) { + return bits & ~bit; +} +inline constexpr ClauseRequires bitEnumSet(ClauseRequires bits, ClauseRequires bit, /*optional*/bool value=true) { + return value ? (bits | bit) : bitEnumClear(bits, bit); +} + +inline std::string stringifyEnum(ClauseRequires enumValue) { + return stringifyClauseRequires(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseRequires(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseRequires, ::mlir::omp::ClauseRequires> { + template + static FailureOr<::mlir::omp::ClauseRequires> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for requires clauses"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseRequires> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseRequires>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid requires clauses specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseRequires value) { + auto valueStr = stringifyEnum(value); + auto underlyingValue = static_cast>(value); + if (underlyingValue && !llvm::has_single_bit(underlyingValue)) + return p << '"' << valueStr << '"'; + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseRequires> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseRequires getEmptyKey() { + return static_cast<::mlir::omp::ClauseRequires>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseRequires getTombstoneKey() { + return static_cast<::mlir::omp::ClauseRequires>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseRequires &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseRequires &lhs, const ::mlir::omp::ClauseRequires &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// task depend clause +enum class ClauseTaskDepend : uint32_t { + taskdependin = 0, + taskdependout = 1, + taskdependinout = 2, +}; + +::std::optional symbolizeClauseTaskDepend(uint32_t); +::llvm::StringRef stringifyClauseTaskDepend(ClauseTaskDepend); +::std::optional symbolizeClauseTaskDepend(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseTaskDepend() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseTaskDepend enumValue) { + return stringifyClauseTaskDepend(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseTaskDepend(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseTaskDepend, ::mlir::omp::ClauseTaskDepend> { + template + static FailureOr<::mlir::omp::ClauseTaskDepend> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for task depend clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseTaskDepend> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseTaskDepend>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid task depend clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseTaskDepend value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseTaskDepend> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseTaskDepend getEmptyKey() { + return static_cast<::mlir::omp::ClauseTaskDepend>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseTaskDepend getTombstoneKey() { + return static_cast<::mlir::omp::ClauseTaskDepend>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseTaskDepend &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseTaskDepend &lhs, const ::mlir::omp::ClauseTaskDepend &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// capture clause +enum class DeclareTargetCaptureClause : uint32_t { + to = 0, + link = 1, +}; + +::std::optional symbolizeDeclareTargetCaptureClause(uint32_t); +::llvm::StringRef stringifyDeclareTargetCaptureClause(DeclareTargetCaptureClause); +::std::optional symbolizeDeclareTargetCaptureClause(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForDeclareTargetCaptureClause() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(DeclareTargetCaptureClause enumValue) { + return stringifyDeclareTargetCaptureClause(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeDeclareTargetCaptureClause(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::DeclareTargetCaptureClause, ::mlir::omp::DeclareTargetCaptureClause> { + template + static FailureOr<::mlir::omp::DeclareTargetCaptureClause> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for capture clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::DeclareTargetCaptureClause> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::DeclareTargetCaptureClause>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid capture clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::DeclareTargetCaptureClause value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::DeclareTargetCaptureClause> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::DeclareTargetCaptureClause getEmptyKey() { + return static_cast<::mlir::omp::DeclareTargetCaptureClause>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::DeclareTargetCaptureClause getTombstoneKey() { + return static_cast<::mlir::omp::DeclareTargetCaptureClause>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::DeclareTargetCaptureClause &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::DeclareTargetCaptureClause &lhs, const ::mlir::omp::DeclareTargetCaptureClause &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// device_type clause +enum class DeclareTargetDeviceType : uint32_t { + any = 0, + host = 1, + nohost = 2, +}; + +::std::optional symbolizeDeclareTargetDeviceType(uint32_t); +::llvm::StringRef stringifyDeclareTargetDeviceType(DeclareTargetDeviceType); +::std::optional symbolizeDeclareTargetDeviceType(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForDeclareTargetDeviceType() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(DeclareTargetDeviceType enumValue) { + return stringifyDeclareTargetDeviceType(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeDeclareTargetDeviceType(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::DeclareTargetDeviceType, ::mlir::omp::DeclareTargetDeviceType> { + template + static FailureOr<::mlir::omp::DeclareTargetDeviceType> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for device_type clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::DeclareTargetDeviceType> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::DeclareTargetDeviceType>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid device_type clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::DeclareTargetDeviceType value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::DeclareTargetDeviceType> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::DeclareTargetDeviceType getEmptyKey() { + return static_cast<::mlir::omp::DeclareTargetDeviceType>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::DeclareTargetDeviceType getTombstoneKey() { + return static_cast<::mlir::omp::DeclareTargetDeviceType>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::DeclareTargetDeviceType &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::DeclareTargetDeviceType &lhs, const ::mlir::omp::DeclareTargetDeviceType &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// GrainsizeType Clause +enum class ClauseGrainsizeType : uint32_t { + Strict = 0, +}; + +::std::optional symbolizeClauseGrainsizeType(uint32_t); +::llvm::StringRef stringifyClauseGrainsizeType(ClauseGrainsizeType); +::std::optional symbolizeClauseGrainsizeType(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseGrainsizeType() { + return 0; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseGrainsizeType enumValue) { + return stringifyClauseGrainsizeType(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseGrainsizeType(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseGrainsizeType, ::mlir::omp::ClauseGrainsizeType> { + template + static FailureOr<::mlir::omp::ClauseGrainsizeType> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for GrainsizeType Clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseGrainsizeType> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseGrainsizeType>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid GrainsizeType Clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseGrainsizeType value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseGrainsizeType> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseGrainsizeType getEmptyKey() { + return static_cast<::mlir::omp::ClauseGrainsizeType>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseGrainsizeType getTombstoneKey() { + return static_cast<::mlir::omp::ClauseGrainsizeType>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseGrainsizeType &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseGrainsizeType &lhs, const ::mlir::omp::ClauseGrainsizeType &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// MemoryOrderKind Clause +enum class ClauseMemoryOrderKind : uint32_t { + Seq_cst = 0, + Acq_rel = 1, + Acquire = 2, + Release = 3, + Relaxed = 4, +}; + +::std::optional symbolizeClauseMemoryOrderKind(uint32_t); +::llvm::StringRef stringifyClauseMemoryOrderKind(ClauseMemoryOrderKind); +::std::optional symbolizeClauseMemoryOrderKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseMemoryOrderKind() { + return 4; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseMemoryOrderKind enumValue) { + return stringifyClauseMemoryOrderKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseMemoryOrderKind(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseMemoryOrderKind, ::mlir::omp::ClauseMemoryOrderKind> { + template + static FailureOr<::mlir::omp::ClauseMemoryOrderKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for MemoryOrderKind Clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseMemoryOrderKind> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseMemoryOrderKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid MemoryOrderKind Clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseMemoryOrderKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseMemoryOrderKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseMemoryOrderKind getEmptyKey() { + return static_cast<::mlir::omp::ClauseMemoryOrderKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseMemoryOrderKind getTombstoneKey() { + return static_cast<::mlir::omp::ClauseMemoryOrderKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseMemoryOrderKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseMemoryOrderKind &lhs, const ::mlir::omp::ClauseMemoryOrderKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// NumTasksType Clause +enum class ClauseNumTasksType : uint32_t { + Strict = 0, +}; + +::std::optional symbolizeClauseNumTasksType(uint32_t); +::llvm::StringRef stringifyClauseNumTasksType(ClauseNumTasksType); +::std::optional symbolizeClauseNumTasksType(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseNumTasksType() { + return 0; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseNumTasksType enumValue) { + return stringifyClauseNumTasksType(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseNumTasksType(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseNumTasksType, ::mlir::omp::ClauseNumTasksType> { + template + static FailureOr<::mlir::omp::ClauseNumTasksType> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for NumTasksType Clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseNumTasksType> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseNumTasksType>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid NumTasksType Clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseNumTasksType value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseNumTasksType> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseNumTasksType getEmptyKey() { + return static_cast<::mlir::omp::ClauseNumTasksType>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseNumTasksType getTombstoneKey() { + return static_cast<::mlir::omp::ClauseNumTasksType>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseNumTasksType &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseNumTasksType &lhs, const ::mlir::omp::ClauseNumTasksType &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// OrderKind Clause +enum class ClauseOrderKind : uint32_t { + Concurrent = 1, +}; + +::std::optional symbolizeClauseOrderKind(uint32_t); +::llvm::StringRef stringifyClauseOrderKind(ClauseOrderKind); +::std::optional symbolizeClauseOrderKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseOrderKind() { + return 1; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseOrderKind enumValue) { + return stringifyClauseOrderKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseOrderKind(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseOrderKind, ::mlir::omp::ClauseOrderKind> { + template + static FailureOr<::mlir::omp::ClauseOrderKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for OrderKind Clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseOrderKind> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseOrderKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid OrderKind Clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseOrderKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseOrderKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseOrderKind getEmptyKey() { + return static_cast<::mlir::omp::ClauseOrderKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseOrderKind getTombstoneKey() { + return static_cast<::mlir::omp::ClauseOrderKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseOrderKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseOrderKind &lhs, const ::mlir::omp::ClauseOrderKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// ProcBindKind Clause +enum class ClauseProcBindKind : uint32_t { + Primary = 0, + Master = 1, + Close = 2, + Spread = 3, +}; + +::std::optional symbolizeClauseProcBindKind(uint32_t); +::llvm::StringRef stringifyClauseProcBindKind(ClauseProcBindKind); +::std::optional symbolizeClauseProcBindKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseProcBindKind() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseProcBindKind enumValue) { + return stringifyClauseProcBindKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseProcBindKind(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseProcBindKind, ::mlir::omp::ClauseProcBindKind> { + template + static FailureOr<::mlir::omp::ClauseProcBindKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for ProcBindKind Clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseProcBindKind> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseProcBindKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid ProcBindKind Clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseProcBindKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseProcBindKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseProcBindKind getEmptyKey() { + return static_cast<::mlir::omp::ClauseProcBindKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseProcBindKind getTombstoneKey() { + return static_cast<::mlir::omp::ClauseProcBindKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseProcBindKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseProcBindKind &lhs, const ::mlir::omp::ClauseProcBindKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// ScheduleKind Clause +enum class ClauseScheduleKind : uint32_t { + Static = 0, + Dynamic = 1, + Guided = 2, + Auto = 3, + Runtime = 4, +}; + +::std::optional symbolizeClauseScheduleKind(uint32_t); +::llvm::StringRef stringifyClauseScheduleKind(ClauseScheduleKind); +::std::optional symbolizeClauseScheduleKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForClauseScheduleKind() { + return 4; +} + + +inline ::llvm::StringRef stringifyEnum(ClauseScheduleKind enumValue) { + return stringifyClauseScheduleKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeClauseScheduleKind(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ClauseScheduleKind, ::mlir::omp::ClauseScheduleKind> { + template + static FailureOr<::mlir::omp::ClauseScheduleKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for ScheduleKind Clause"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ClauseScheduleKind> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ClauseScheduleKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid ScheduleKind Clause specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ClauseScheduleKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ClauseScheduleKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ClauseScheduleKind getEmptyKey() { + return static_cast<::mlir::omp::ClauseScheduleKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ClauseScheduleKind getTombstoneKey() { + return static_cast<::mlir::omp::ClauseScheduleKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ClauseScheduleKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ClauseScheduleKind &lhs, const ::mlir::omp::ClauseScheduleKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// OpenMP Schedule Modifier +enum class ScheduleModifier : uint32_t { + none = 0, + monotonic = 1, + nonmonotonic = 2, + simd = 3, +}; + +::std::optional symbolizeScheduleModifier(uint32_t); +::llvm::StringRef stringifyScheduleModifier(ScheduleModifier); +::std::optional symbolizeScheduleModifier(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForScheduleModifier() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(ScheduleModifier enumValue) { + return stringifyScheduleModifier(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeScheduleModifier(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::ScheduleModifier, ::mlir::omp::ScheduleModifier> { + template + static FailureOr<::mlir::omp::ScheduleModifier> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for OpenMP Schedule Modifier"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::ScheduleModifier> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::ScheduleModifier>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid OpenMP Schedule Modifier specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::ScheduleModifier value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::ScheduleModifier> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::ScheduleModifier getEmptyKey() { + return static_cast<::mlir::omp::ScheduleModifier>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::ScheduleModifier getTombstoneKey() { + return static_cast<::mlir::omp::ScheduleModifier>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::ScheduleModifier &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::ScheduleModifier &lhs, const ::mlir::omp::ScheduleModifier &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace omp { +// variable capture kind +enum class VariableCaptureKind : uint32_t { + This = 0, + ByRef = 1, + ByCopy = 2, + VLAType = 3, +}; + +::std::optional symbolizeVariableCaptureKind(uint32_t); +::llvm::StringRef stringifyVariableCaptureKind(VariableCaptureKind); +::std::optional symbolizeVariableCaptureKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForVariableCaptureKind() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(VariableCaptureKind enumValue) { + return stringifyVariableCaptureKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeVariableCaptureKind(str); +} +} // namespace omp +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::omp::VariableCaptureKind, ::mlir::omp::VariableCaptureKind> { + template + static FailureOr<::mlir::omp::VariableCaptureKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for variable capture kind"); + + // Symbolize the keyword. + if (::std::optional<::mlir::omp::VariableCaptureKind> attr = ::mlir::omp::symbolizeEnum<::mlir::omp::VariableCaptureKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid variable capture kind specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::omp::VariableCaptureKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::omp::VariableCaptureKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::omp::VariableCaptureKind getEmptyKey() { + return static_cast<::mlir::omp::VariableCaptureKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::omp::VariableCaptureKind getTombstoneKey() { + return static_cast<::mlir::omp::VariableCaptureKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::omp::VariableCaptureKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::omp::VariableCaptureKind &lhs, const ::mlir::omp::VariableCaptureKind &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..dc24cd447eeaa126c7f664dcd71a70e261300042 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.cpp.inc @@ -0,0 +1,112 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Set the declare target attribute on the current operation with the +/// specified attribute arguments. +void mlir::omp::DeclareTargetInterface::setDeclareTarget(mlir::omp::DeclareTargetDeviceType deviceType, mlir::omp::DeclareTargetCaptureClause captureClause) { + return getImpl()->setDeclareTarget(getImpl(), getOperation(), deviceType, captureClause); + } +/// Checks if the declare target attribute has been applied and exists on the +/// current operation. Returns true if it exists on it, otherwise returns +/// false. +bool mlir::omp::DeclareTargetInterface::isDeclareTarget() { + return getImpl()->isDeclareTarget(getImpl(), getOperation()); + } +/// Returns the DeclareTargetDeviceType segment of the DeclareTarget attribute if it +/// exists on the current operation. Otherwise it returns null. +mlir::omp::DeclareTargetDeviceType mlir::omp::DeclareTargetInterface::getDeclareTargetDeviceType() { + return getImpl()->getDeclareTargetDeviceType(getImpl(), getOperation()); + } +/// Returns the DeclareTargetCaptureClause segment of the DeclareTarget attribute if it +/// exists on the current operation. Otherwise it returns null. +mlir::omp::DeclareTargetCaptureClause mlir::omp::DeclareTargetInterface::getDeclareTargetCaptureClause() { + return getImpl()->getDeclareTargetCaptureClause(getImpl(), getOperation()); + } +/// Set a StringAttr on an outlined target region function containing the +/// name of the parent function where the target region was outlined +/// from. The parent name is used to construct the kernel names for target +/// regions. +void mlir::omp::EarlyOutliningInterface::setParentName(std::string parentName) { + return getImpl()->setParentName(getImpl(), getOperation(), parentName); + } +/// Returns the parent function name from where the target op was outlined +/// from. If it doesn't exist it returns an empty string. +llvm::StringRef mlir::omp::EarlyOutliningInterface::getParentName() { + return getImpl()->getParentName(getImpl(), getOperation()); + } +/// Set the attribute on the current module with the specified boolean +/// argument. +void mlir::omp::OffloadModuleInterface::setIsTargetDevice(bool isTargetDevice) { + return getImpl()->setIsTargetDevice(getImpl(), getOperation(), isTargetDevice); + } +/// Get the attribute on the current module if it exists and +/// return its value, if it doesn't exist it returns false by default. +bool mlir::omp::OffloadModuleInterface::getIsTargetDevice() { + return getImpl()->getIsTargetDevice(getImpl(), getOperation()); + } +/// Set the attribute on the current module with the specified boolean +/// argument. +void mlir::omp::OffloadModuleInterface::setIsGPU(bool isGPU) { + return getImpl()->setIsGPU(getImpl(), getOperation(), isGPU); + } +/// Get the attribute on the current module if it exists and +/// return its value, if it doesn't exist it returns false by default. +bool mlir::omp::OffloadModuleInterface::getIsGPU() { + return getImpl()->getIsGPU(getImpl(), getOperation()); + } +/// Get the FlagsAttr attribute on the current module if it exists +/// and return the attribute, if it doesn't exit it returns a nullptr +mlir::omp::FlagsAttr mlir::omp::OffloadModuleInterface::getFlags() { + return getImpl()->getFlags(getImpl(), getOperation()); + } +/// Apply an omp.FlagsAttr to a module with the specified values +/// for the flags +void mlir::omp::OffloadModuleInterface::setFlags(uint32_t debugKind, bool assumeTeamsOversubscription, bool assumeThreadsOversubscription, bool assumeNoThreadState, bool assumeNoNestedParallelism, uint32_t openmpDeviceVersion) { + return getImpl()->setFlags(getImpl(), getOperation(), debugKind, assumeTeamsOversubscription, assumeThreadsOversubscription, assumeNoThreadState, assumeNoNestedParallelism, openmpDeviceVersion); + } +/// Get the Target attribute on the current module if it exists +/// and return the attribute, if it doesn't exist it returns a nullptr. +mlir::omp::TargetAttr mlir::omp::OffloadModuleInterface::getTarget() { + return getImpl()->getTarget(getImpl(), getOperation()); + } +/// Set the attribute target on the current module with the +/// specified string arguments - name of cpu and corresponding features. +void mlir::omp::OffloadModuleInterface::setTarget(llvm::StringRef targetCPU, llvm::StringRef targetFeatures) { + return getImpl()->setTarget(getImpl(), getOperation(), targetCPU, targetFeatures); + } +/// Set a StringAttr on the current module containing the host IR file path. This +/// file path is used in two-phase compilation during the device phase to generate +/// device side LLVM IR when lowering MLIR. +void mlir::omp::OffloadModuleInterface::setHostIRFilePath(std::string hostIRFilePath) { + return getImpl()->setHostIRFilePath(getImpl(), getOperation(), hostIRFilePath); + } +/// Find the host-ir file path StringAttr from the current module if it exists and +/// return its contained value, if it doesn't exist it returns an empty string. This +/// file path is used in two-phase compilation during the device phase to generate +/// device side LLVM IR when lowering MLIR. +llvm::StringRef mlir::omp::OffloadModuleInterface::getHostIRFilePath() { + return getImpl()->getHostIRFilePath(getImpl(), getOperation()); + } +/// Get the omp.requires attribute on the operator if it's present and +/// return its value. If it doesn't exist, return `ClauseRequires::none` by +/// default. +::mlir::omp::ClauseRequires mlir::omp::OffloadModuleInterface::getRequires() { + return getImpl()->getRequires(getImpl(), getOperation()); + } +/// Set the omp.requires attribute on the operator to the specified clauses. +void mlir::omp::OffloadModuleInterface::setRequires(::mlir::omp::ClauseRequires clauses) { + return getImpl()->setRequires(getImpl(), getOperation(), clauses); + } +/// Get alloca block +::mlir::Block*mlir::omp::OutlineableOpenMPOpInterface::getAllocaBlock() { + return getImpl()->getAllocaBlock(getImpl(), getOperation()); + } +/// Get reduction vars +::mlir::SmallVector<::mlir::Value> mlir::omp::ReductionClauseInterface::getAllReductionVars() { + return getImpl()->getAllReductionVars(getImpl(), getOperation()); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..4a693ac5275cad9874743bbe9c793fd1b4a708ea --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.h.inc @@ -0,0 +1,825 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace omp { +class OutlineableOpenMPOpInterface; +namespace detail { +struct OutlineableOpenMPOpInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::Block*(*getAllocaBlock)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::omp::OutlineableOpenMPOpInterface; + Model() : Concept{getAllocaBlock} {} + + static inline ::mlir::Block*getAllocaBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::omp::OutlineableOpenMPOpInterface; + FallbackModel() : Concept{getAllocaBlock} {} + + static inline ::mlir::Block*getAllocaBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + }; +};template +struct OutlineableOpenMPOpInterfaceTrait; + +} // namespace detail +class OutlineableOpenMPOpInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::OutlineableOpenMPOpInterfaceTrait {}; + /// Get alloca block + ::mlir::Block*getAllocaBlock(); +}; +namespace detail { + template + struct OutlineableOpenMPOpInterfaceTrait : public ::mlir::OpInterface::Trait { + }; +}// namespace detail +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class ReductionClauseInterface; +namespace detail { +struct ReductionClauseInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::SmallVector<::mlir::Value> (*getAllReductionVars)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::omp::ReductionClauseInterface; + Model() : Concept{getAllReductionVars} {} + + static inline ::mlir::SmallVector<::mlir::Value> getAllReductionVars(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::omp::ReductionClauseInterface; + FallbackModel() : Concept{getAllReductionVars} {} + + static inline ::mlir::SmallVector<::mlir::Value> getAllReductionVars(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + ::mlir::SmallVector<::mlir::Value> getAllReductionVars(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct ReductionClauseInterfaceTrait; + +} // namespace detail +class ReductionClauseInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::ReductionClauseInterfaceTrait {}; + /// Get reduction vars + ::mlir::SmallVector<::mlir::Value> getAllReductionVars(); +}; +namespace detail { + template + struct ReductionClauseInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Get reduction vars + ::mlir::SmallVector<::mlir::Value> getAllReductionVars() { + return (*static_cast(this)).getReductionVars(); + } + }; +}// namespace detail +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class DeclareTargetInterface; +namespace detail { +struct DeclareTargetInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + void (*setDeclareTarget)(const Concept *impl, ::mlir::Operation *, mlir::omp::DeclareTargetDeviceType, mlir::omp::DeclareTargetCaptureClause); + bool (*isDeclareTarget)(const Concept *impl, ::mlir::Operation *); + mlir::omp::DeclareTargetDeviceType (*getDeclareTargetDeviceType)(const Concept *impl, ::mlir::Operation *); + mlir::omp::DeclareTargetCaptureClause (*getDeclareTargetCaptureClause)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::omp::DeclareTargetInterface; + Model() : Concept{setDeclareTarget, isDeclareTarget, getDeclareTargetDeviceType, getDeclareTargetCaptureClause} {} + + static inline void setDeclareTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::omp::DeclareTargetDeviceType deviceType, mlir::omp::DeclareTargetCaptureClause captureClause); + static inline bool isDeclareTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline mlir::omp::DeclareTargetDeviceType getDeclareTargetDeviceType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline mlir::omp::DeclareTargetCaptureClause getDeclareTargetCaptureClause(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::omp::DeclareTargetInterface; + FallbackModel() : Concept{setDeclareTarget, isDeclareTarget, getDeclareTargetDeviceType, getDeclareTargetCaptureClause} {} + + static inline void setDeclareTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::omp::DeclareTargetDeviceType deviceType, mlir::omp::DeclareTargetCaptureClause captureClause); + static inline bool isDeclareTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline mlir::omp::DeclareTargetDeviceType getDeclareTargetDeviceType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline mlir::omp::DeclareTargetCaptureClause getDeclareTargetCaptureClause(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + void setDeclareTarget(::mlir::Operation *tablegen_opaque_val, mlir::omp::DeclareTargetDeviceType deviceType, mlir::omp::DeclareTargetCaptureClause captureClause) const; + bool isDeclareTarget(::mlir::Operation *tablegen_opaque_val) const; + mlir::omp::DeclareTargetDeviceType getDeclareTargetDeviceType(::mlir::Operation *tablegen_opaque_val) const; + mlir::omp::DeclareTargetCaptureClause getDeclareTargetCaptureClause(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct DeclareTargetInterfaceTrait; + +} // namespace detail +class DeclareTargetInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::DeclareTargetInterfaceTrait {}; + /// Set the declare target attribute on the current operation with the + /// specified attribute arguments. + void setDeclareTarget(mlir::omp::DeclareTargetDeviceType deviceType, mlir::omp::DeclareTargetCaptureClause captureClause); + /// Checks if the declare target attribute has been applied and exists on the + /// current operation. Returns true if it exists on it, otherwise returns + /// false. + bool isDeclareTarget(); + /// Returns the DeclareTargetDeviceType segment of the DeclareTarget attribute if it + /// exists on the current operation. Otherwise it returns null. + mlir::omp::DeclareTargetDeviceType getDeclareTargetDeviceType(); + /// Returns the DeclareTargetCaptureClause segment of the DeclareTarget attribute if it + /// exists on the current operation. Otherwise it returns null. + mlir::omp::DeclareTargetCaptureClause getDeclareTargetCaptureClause(); +}; +namespace detail { + template + struct DeclareTargetInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Set the declare target attribute on the current operation with the + /// specified attribute arguments. + void setDeclareTarget(mlir::omp::DeclareTargetDeviceType deviceType, mlir::omp::DeclareTargetCaptureClause captureClause) { + (*static_cast(this))->setAttr("omp.declare_target", + mlir::omp::DeclareTargetAttr::get( + (*static_cast(this))->getContext(), + mlir::omp::DeclareTargetDeviceTypeAttr::get( + (*static_cast(this))->getContext(), deviceType), + mlir::omp::DeclareTargetCaptureClauseAttr::get( + (*static_cast(this))->getContext(), captureClause))); + } + /// Checks if the declare target attribute has been applied and exists on the + /// current operation. Returns true if it exists on it, otherwise returns + /// false. + bool isDeclareTarget() { + return (*static_cast(this))->hasAttr("omp.declare_target"); + } + /// Returns the DeclareTargetDeviceType segment of the DeclareTarget attribute if it + /// exists on the current operation. Otherwise it returns null. + mlir::omp::DeclareTargetDeviceType getDeclareTargetDeviceType() { + if (mlir::Attribute dTar = (*static_cast(this))->getAttr("omp.declare_target")) + if (auto dAttr = llvm::dyn_cast_or_null(dTar)) + return dAttr.getDeviceType().getValue(); + return {}; + } + /// Returns the DeclareTargetCaptureClause segment of the DeclareTarget attribute if it + /// exists on the current operation. Otherwise it returns null. + mlir::omp::DeclareTargetCaptureClause getDeclareTargetCaptureClause() { + if (mlir::Attribute dTar = (*static_cast(this))->getAttr("omp.declare_target")) + if (auto dAttr = llvm::dyn_cast_or_null(dTar)) + return dAttr.getCaptureClause().getValue(); + return {}; + } + }; +}// namespace detail +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class OffloadModuleInterface; +namespace detail { +struct OffloadModuleInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + void (*setIsTargetDevice)(const Concept *impl, ::mlir::Operation *, bool); + bool (*getIsTargetDevice)(const Concept *impl, ::mlir::Operation *); + void (*setIsGPU)(const Concept *impl, ::mlir::Operation *, bool); + bool (*getIsGPU)(const Concept *impl, ::mlir::Operation *); + mlir::omp::FlagsAttr (*getFlags)(const Concept *impl, ::mlir::Operation *); + void (*setFlags)(const Concept *impl, ::mlir::Operation *, uint32_t, bool, bool, bool, bool, uint32_t); + mlir::omp::TargetAttr (*getTarget)(const Concept *impl, ::mlir::Operation *); + void (*setTarget)(const Concept *impl, ::mlir::Operation *, llvm::StringRef, llvm::StringRef); + void (*setHostIRFilePath)(const Concept *impl, ::mlir::Operation *, std::string); + llvm::StringRef (*getHostIRFilePath)(const Concept *impl, ::mlir::Operation *); + ::mlir::omp::ClauseRequires (*getRequires)(const Concept *impl, ::mlir::Operation *); + void (*setRequires)(const Concept *impl, ::mlir::Operation *, ::mlir::omp::ClauseRequires); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::omp::OffloadModuleInterface; + Model() : Concept{setIsTargetDevice, getIsTargetDevice, setIsGPU, getIsGPU, getFlags, setFlags, getTarget, setTarget, setHostIRFilePath, getHostIRFilePath, getRequires, setRequires} {} + + static inline void setIsTargetDevice(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, bool isTargetDevice); + static inline bool getIsTargetDevice(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setIsGPU(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, bool isGPU); + static inline bool getIsGPU(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline mlir::omp::FlagsAttr getFlags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setFlags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, uint32_t debugKind, bool assumeTeamsOversubscription, bool assumeThreadsOversubscription, bool assumeNoThreadState, bool assumeNoNestedParallelism, uint32_t openmpDeviceVersion); + static inline mlir::omp::TargetAttr getTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, llvm::StringRef targetCPU, llvm::StringRef targetFeatures); + static inline void setHostIRFilePath(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, std::string hostIRFilePath); + static inline llvm::StringRef getHostIRFilePath(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::omp::ClauseRequires getRequires(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setRequires(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::omp::ClauseRequires clauses); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::omp::OffloadModuleInterface; + FallbackModel() : Concept{setIsTargetDevice, getIsTargetDevice, setIsGPU, getIsGPU, getFlags, setFlags, getTarget, setTarget, setHostIRFilePath, getHostIRFilePath, getRequires, setRequires} {} + + static inline void setIsTargetDevice(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, bool isTargetDevice); + static inline bool getIsTargetDevice(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setIsGPU(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, bool isGPU); + static inline bool getIsGPU(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline mlir::omp::FlagsAttr getFlags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setFlags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, uint32_t debugKind, bool assumeTeamsOversubscription, bool assumeThreadsOversubscription, bool assumeNoThreadState, bool assumeNoNestedParallelism, uint32_t openmpDeviceVersion); + static inline mlir::omp::TargetAttr getTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, llvm::StringRef targetCPU, llvm::StringRef targetFeatures); + static inline void setHostIRFilePath(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, std::string hostIRFilePath); + static inline llvm::StringRef getHostIRFilePath(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline ::mlir::omp::ClauseRequires getRequires(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline void setRequires(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::omp::ClauseRequires clauses); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + void setIsTargetDevice(::mlir::Operation *tablegen_opaque_val, bool isTargetDevice) const; + bool getIsTargetDevice(::mlir::Operation *tablegen_opaque_val) const; + void setIsGPU(::mlir::Operation *tablegen_opaque_val, bool isGPU) const; + bool getIsGPU(::mlir::Operation *tablegen_opaque_val) const; + mlir::omp::FlagsAttr getFlags(::mlir::Operation *tablegen_opaque_val) const; + void setFlags(::mlir::Operation *tablegen_opaque_val, uint32_t debugKind, bool assumeTeamsOversubscription, bool assumeThreadsOversubscription, bool assumeNoThreadState, bool assumeNoNestedParallelism, uint32_t openmpDeviceVersion) const; + mlir::omp::TargetAttr getTarget(::mlir::Operation *tablegen_opaque_val) const; + void setTarget(::mlir::Operation *tablegen_opaque_val, llvm::StringRef targetCPU, llvm::StringRef targetFeatures) const; + void setHostIRFilePath(::mlir::Operation *tablegen_opaque_val, std::string hostIRFilePath) const; + llvm::StringRef getHostIRFilePath(::mlir::Operation *tablegen_opaque_val) const; + ::mlir::omp::ClauseRequires getRequires(::mlir::Operation *tablegen_opaque_val) const; + void setRequires(::mlir::Operation *tablegen_opaque_val, ::mlir::omp::ClauseRequires clauses) const; + }; +};template +struct OffloadModuleInterfaceTrait; + +} // namespace detail +class OffloadModuleInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::OffloadModuleInterfaceTrait {}; + /// Set the attribute on the current module with the specified boolean + /// argument. + void setIsTargetDevice(bool isTargetDevice); + /// Get the attribute on the current module if it exists and + /// return its value, if it doesn't exist it returns false by default. + bool getIsTargetDevice(); + /// Set the attribute on the current module with the specified boolean + /// argument. + void setIsGPU(bool isGPU); + /// Get the attribute on the current module if it exists and + /// return its value, if it doesn't exist it returns false by default. + bool getIsGPU(); + /// Get the FlagsAttr attribute on the current module if it exists + /// and return the attribute, if it doesn't exit it returns a nullptr + mlir::omp::FlagsAttr getFlags(); + /// Apply an omp.FlagsAttr to a module with the specified values + /// for the flags + void setFlags(uint32_t debugKind, bool assumeTeamsOversubscription, bool assumeThreadsOversubscription, bool assumeNoThreadState, bool assumeNoNestedParallelism, uint32_t openmpDeviceVersion); + /// Get the Target attribute on the current module if it exists + /// and return the attribute, if it doesn't exist it returns a nullptr. + mlir::omp::TargetAttr getTarget(); + /// Set the attribute target on the current module with the + /// specified string arguments - name of cpu and corresponding features. + void setTarget(llvm::StringRef targetCPU, llvm::StringRef targetFeatures); + /// Set a StringAttr on the current module containing the host IR file path. This + /// file path is used in two-phase compilation during the device phase to generate + /// device side LLVM IR when lowering MLIR. + void setHostIRFilePath(std::string hostIRFilePath); + /// Find the host-ir file path StringAttr from the current module if it exists and + /// return its contained value, if it doesn't exist it returns an empty string. This + /// file path is used in two-phase compilation during the device phase to generate + /// device side LLVM IR when lowering MLIR. + llvm::StringRef getHostIRFilePath(); + /// Get the omp.requires attribute on the operator if it's present and + /// return its value. If it doesn't exist, return `ClauseRequires::none` by + /// default. + ::mlir::omp::ClauseRequires getRequires(); + /// Set the omp.requires attribute on the operator to the specified clauses. + void setRequires(::mlir::omp::ClauseRequires clauses); +}; +namespace detail { + template + struct OffloadModuleInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Set the attribute on the current module with the specified boolean + /// argument. + void setIsTargetDevice(bool isTargetDevice) { + (*static_cast(this))->setAttr( + mlir::StringAttr::get((*static_cast(this))->getContext(), llvm::Twine{"omp.is_target_device"}), + mlir::BoolAttr::get((*static_cast(this))->getContext(), isTargetDevice)); + } + /// Get the attribute on the current module if it exists and + /// return its value, if it doesn't exist it returns false by default. + bool getIsTargetDevice() { + if (Attribute isTargetDevice = (*static_cast(this))->getAttr("omp.is_target_device")) + if (isTargetDevice.isa()) + return isTargetDevice.dyn_cast().getValue(); + return false; + } + /// Set the attribute on the current module with the specified boolean + /// argument. + void setIsGPU(bool isGPU) { + (*static_cast(this))->setAttr( + mlir::StringAttr::get((*static_cast(this))->getContext(), "omp.is_gpu"), + mlir::BoolAttr::get((*static_cast(this))->getContext(), isGPU)); + } + /// Get the attribute on the current module if it exists and + /// return its value, if it doesn't exist it returns false by default. + bool getIsGPU() { + if (Attribute isTargetCGAttr = (*static_cast(this))->getAttr("omp.is_gpu")) + if (auto isTargetCGVal = isTargetCGAttr.dyn_cast()) + return isTargetCGVal.getValue(); + return false; + } + /// Get the FlagsAttr attribute on the current module if it exists + /// and return the attribute, if it doesn't exit it returns a nullptr + mlir::omp::FlagsAttr getFlags() { + if (Attribute flags = (*static_cast(this))->getAttr("omp.flags")) + return ::llvm::dyn_cast_or_null(flags); + return nullptr; + } + /// Apply an omp.FlagsAttr to a module with the specified values + /// for the flags + void setFlags(uint32_t debugKind, bool assumeTeamsOversubscription, bool assumeThreadsOversubscription, bool assumeNoThreadState, bool assumeNoNestedParallelism, uint32_t openmpDeviceVersion) { + (*static_cast(this))->setAttr(("omp." + mlir::omp::FlagsAttr::getMnemonic()).str(), + mlir::omp::FlagsAttr::get((*static_cast(this))->getContext(), debugKind, + assumeTeamsOversubscription, assumeThreadsOversubscription, + assumeNoThreadState, assumeNoNestedParallelism, openmpDeviceVersion)); + } + /// Get the Target attribute on the current module if it exists + /// and return the attribute, if it doesn't exist it returns a nullptr. + mlir::omp::TargetAttr getTarget() { + if (Attribute flags = (*static_cast(this))->getAttr("omp.target")) + return ::llvm::dyn_cast_or_null(flags); + return nullptr; + } + /// Set the attribute target on the current module with the + /// specified string arguments - name of cpu and corresponding features. + void setTarget(llvm::StringRef targetCPU, llvm::StringRef targetFeatures) { + if (targetCPU.empty()) + return; + (*static_cast(this))->setAttr(("omp." + mlir::omp::TargetAttr::getMnemonic()).str(), + mlir::omp::TargetAttr::get((*static_cast(this))->getContext(), + targetCPU.str(), + targetFeatures.str())); + } + /// Set a StringAttr on the current module containing the host IR file path. This + /// file path is used in two-phase compilation during the device phase to generate + /// device side LLVM IR when lowering MLIR. + void setHostIRFilePath(std::string hostIRFilePath) { + (*static_cast(this))->setAttr( + mlir::StringAttr::get((*static_cast(this))->getContext(), llvm::Twine{"omp.host_ir_filepath"}), + mlir::StringAttr::get((*static_cast(this))->getContext(), hostIRFilePath)); + } + /// Find the host-ir file path StringAttr from the current module if it exists and + /// return its contained value, if it doesn't exist it returns an empty string. This + /// file path is used in two-phase compilation during the device phase to generate + /// device side LLVM IR when lowering MLIR. + llvm::StringRef getHostIRFilePath() { + if (Attribute filepath = (*static_cast(this))->getAttr("omp.host_ir_filepath")) + if (::llvm::isa(filepath)) + return ::llvm::dyn_cast(filepath).getValue(); + return {}; + } + /// Get the omp.requires attribute on the operator if it's present and + /// return its value. If it doesn't exist, return `ClauseRequires::none` by + /// default. + ::mlir::omp::ClauseRequires getRequires() { + if (Attribute requiresAttr = (*static_cast(this))->getAttr("omp.requires")) + if (auto requiresVal = requiresAttr.dyn_cast()) + return requiresVal.getValue(); + return mlir::omp::ClauseRequires::none; + } + /// Set the omp.requires attribute on the operator to the specified clauses. + void setRequires(::mlir::omp::ClauseRequires clauses) { + (*static_cast(this))->setAttr(mlir::StringAttr::get((*static_cast(this))->getContext(), "omp.requires"), + mlir::omp::ClauseRequiresAttr::get((*static_cast(this))->getContext(), clauses)); + } + }; +}// namespace detail +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +class EarlyOutliningInterface; +namespace detail { +struct EarlyOutliningInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + void (*setParentName)(const Concept *impl, ::mlir::Operation *, std::string); + llvm::StringRef (*getParentName)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::omp::EarlyOutliningInterface; + Model() : Concept{setParentName, getParentName} {} + + static inline void setParentName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, std::string parentName); + static inline llvm::StringRef getParentName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::omp::EarlyOutliningInterface; + FallbackModel() : Concept{setParentName, getParentName} {} + + static inline void setParentName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, std::string parentName); + static inline llvm::StringRef getParentName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + void setParentName(::mlir::Operation *tablegen_opaque_val, std::string parentName) const; + llvm::StringRef getParentName(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct EarlyOutliningInterfaceTrait; + +} // namespace detail +class EarlyOutliningInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::EarlyOutliningInterfaceTrait {}; + /// Set a StringAttr on an outlined target region function containing the + /// name of the parent function where the target region was outlined + /// from. The parent name is used to construct the kernel names for target + /// regions. + void setParentName(std::string parentName); + /// Returns the parent function name from where the target op was outlined + /// from. If it doesn't exist it returns an empty string. + llvm::StringRef getParentName(); +}; +namespace detail { + template + struct EarlyOutliningInterfaceTrait : public ::mlir::OpInterface::Trait { + /// Set a StringAttr on an outlined target region function containing the + /// name of the parent function where the target region was outlined + /// from. The parent name is used to construct the kernel names for target + /// regions. + void setParentName(std::string parentName) { + (*static_cast(this))->setAttr( + mlir::StringAttr::get((*static_cast(this))->getContext(), + llvm::Twine{"omp.outline_parent_name"}), + mlir::StringAttr::get((*static_cast(this))->getContext(), parentName)); + } + /// Returns the parent function name from where the target op was outlined + /// from. If it doesn't exist it returns an empty string. + llvm::StringRef getParentName() { + if (Attribute parentName = (*static_cast(this))->getAttr("omp.outline_parent_name")) + if (::llvm::isa(parentName)) + return ::llvm::dyn_cast(parentName).getValue(); + return {}; + } + }; +}// namespace detail +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +template +::mlir::Block*detail::OutlineableOpenMPOpInterfaceInterfaceTraits::Model::getAllocaBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return &(llvm::cast(tablegen_opaque_val)).getRegion().front(); +} +template +::mlir::Block*detail::OutlineableOpenMPOpInterfaceInterfaceTraits::FallbackModel::getAllocaBlock(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getAllocaBlock(tablegen_opaque_val); +} +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +template +::mlir::SmallVector<::mlir::Value> detail::ReductionClauseInterfaceInterfaceTraits::Model::getAllReductionVars(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getAllReductionVars(); +} +template +::mlir::SmallVector<::mlir::Value> detail::ReductionClauseInterfaceInterfaceTraits::FallbackModel::getAllReductionVars(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getAllReductionVars(tablegen_opaque_val); +} +template +::mlir::SmallVector<::mlir::Value> detail::ReductionClauseInterfaceInterfaceTraits::ExternalModel::getAllReductionVars(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val)).getReductionVars(); +} +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +template +void detail::DeclareTargetInterfaceInterfaceTraits::Model::setDeclareTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::omp::DeclareTargetDeviceType deviceType, mlir::omp::DeclareTargetCaptureClause captureClause) { + return (llvm::cast(tablegen_opaque_val)).setDeclareTarget(deviceType, captureClause); +} +template +bool detail::DeclareTargetInterfaceInterfaceTraits::Model::isDeclareTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).isDeclareTarget(); +} +template +mlir::omp::DeclareTargetDeviceType detail::DeclareTargetInterfaceInterfaceTraits::Model::getDeclareTargetDeviceType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getDeclareTargetDeviceType(); +} +template +mlir::omp::DeclareTargetCaptureClause detail::DeclareTargetInterfaceInterfaceTraits::Model::getDeclareTargetCaptureClause(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getDeclareTargetCaptureClause(); +} +template +void detail::DeclareTargetInterfaceInterfaceTraits::FallbackModel::setDeclareTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::omp::DeclareTargetDeviceType deviceType, mlir::omp::DeclareTargetCaptureClause captureClause) { + return static_cast(impl)->setDeclareTarget(tablegen_opaque_val, deviceType, captureClause); +} +template +bool detail::DeclareTargetInterfaceInterfaceTraits::FallbackModel::isDeclareTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->isDeclareTarget(tablegen_opaque_val); +} +template +mlir::omp::DeclareTargetDeviceType detail::DeclareTargetInterfaceInterfaceTraits::FallbackModel::getDeclareTargetDeviceType(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getDeclareTargetDeviceType(tablegen_opaque_val); +} +template +mlir::omp::DeclareTargetCaptureClause detail::DeclareTargetInterfaceInterfaceTraits::FallbackModel::getDeclareTargetCaptureClause(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getDeclareTargetCaptureClause(tablegen_opaque_val); +} +template +void detail::DeclareTargetInterfaceInterfaceTraits::ExternalModel::setDeclareTarget(::mlir::Operation *tablegen_opaque_val, mlir::omp::DeclareTargetDeviceType deviceType, mlir::omp::DeclareTargetCaptureClause captureClause) const { +(llvm::cast(tablegen_opaque_val))->setAttr("omp.declare_target", + mlir::omp::DeclareTargetAttr::get( + (llvm::cast(tablegen_opaque_val))->getContext(), + mlir::omp::DeclareTargetDeviceTypeAttr::get( + (llvm::cast(tablegen_opaque_val))->getContext(), deviceType), + mlir::omp::DeclareTargetCaptureClauseAttr::get( + (llvm::cast(tablegen_opaque_val))->getContext(), captureClause))); +} +template +bool detail::DeclareTargetInterfaceInterfaceTraits::ExternalModel::isDeclareTarget(::mlir::Operation *tablegen_opaque_val) const { +return (llvm::cast(tablegen_opaque_val))->hasAttr("omp.declare_target"); +} +template +mlir::omp::DeclareTargetDeviceType detail::DeclareTargetInterfaceInterfaceTraits::ExternalModel::getDeclareTargetDeviceType(::mlir::Operation *tablegen_opaque_val) const { +if (mlir::Attribute dTar = (llvm::cast(tablegen_opaque_val))->getAttr("omp.declare_target")) + if (auto dAttr = llvm::dyn_cast_or_null(dTar)) + return dAttr.getDeviceType().getValue(); + return {}; +} +template +mlir::omp::DeclareTargetCaptureClause detail::DeclareTargetInterfaceInterfaceTraits::ExternalModel::getDeclareTargetCaptureClause(::mlir::Operation *tablegen_opaque_val) const { +if (mlir::Attribute dTar = (llvm::cast(tablegen_opaque_val))->getAttr("omp.declare_target")) + if (auto dAttr = llvm::dyn_cast_or_null(dTar)) + return dAttr.getCaptureClause().getValue(); + return {}; +} +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +template +void detail::OffloadModuleInterfaceInterfaceTraits::Model::setIsTargetDevice(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, bool isTargetDevice) { + return (llvm::cast(tablegen_opaque_val)).setIsTargetDevice(isTargetDevice); +} +template +bool detail::OffloadModuleInterfaceInterfaceTraits::Model::getIsTargetDevice(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getIsTargetDevice(); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::Model::setIsGPU(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, bool isGPU) { + return (llvm::cast(tablegen_opaque_val)).setIsGPU(isGPU); +} +template +bool detail::OffloadModuleInterfaceInterfaceTraits::Model::getIsGPU(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getIsGPU(); +} +template +mlir::omp::FlagsAttr detail::OffloadModuleInterfaceInterfaceTraits::Model::getFlags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getFlags(); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::Model::setFlags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, uint32_t debugKind, bool assumeTeamsOversubscription, bool assumeThreadsOversubscription, bool assumeNoThreadState, bool assumeNoNestedParallelism, uint32_t openmpDeviceVersion) { + return (llvm::cast(tablegen_opaque_val)).setFlags(debugKind, assumeTeamsOversubscription, assumeThreadsOversubscription, assumeNoThreadState, assumeNoNestedParallelism, openmpDeviceVersion); +} +template +mlir::omp::TargetAttr detail::OffloadModuleInterfaceInterfaceTraits::Model::getTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getTarget(); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::Model::setTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, llvm::StringRef targetCPU, llvm::StringRef targetFeatures) { + return (llvm::cast(tablegen_opaque_val)).setTarget(targetCPU, targetFeatures); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::Model::setHostIRFilePath(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, std::string hostIRFilePath) { + return (llvm::cast(tablegen_opaque_val)).setHostIRFilePath(hostIRFilePath); +} +template +llvm::StringRef detail::OffloadModuleInterfaceInterfaceTraits::Model::getHostIRFilePath(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getHostIRFilePath(); +} +template +::mlir::omp::ClauseRequires detail::OffloadModuleInterfaceInterfaceTraits::Model::getRequires(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getRequires(); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::Model::setRequires(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::omp::ClauseRequires clauses) { + return (llvm::cast(tablegen_opaque_val)).setRequires(clauses); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::setIsTargetDevice(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, bool isTargetDevice) { + return static_cast(impl)->setIsTargetDevice(tablegen_opaque_val, isTargetDevice); +} +template +bool detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::getIsTargetDevice(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getIsTargetDevice(tablegen_opaque_val); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::setIsGPU(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, bool isGPU) { + return static_cast(impl)->setIsGPU(tablegen_opaque_val, isGPU); +} +template +bool detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::getIsGPU(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getIsGPU(tablegen_opaque_val); +} +template +mlir::omp::FlagsAttr detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::getFlags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getFlags(tablegen_opaque_val); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::setFlags(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, uint32_t debugKind, bool assumeTeamsOversubscription, bool assumeThreadsOversubscription, bool assumeNoThreadState, bool assumeNoNestedParallelism, uint32_t openmpDeviceVersion) { + return static_cast(impl)->setFlags(tablegen_opaque_val, debugKind, assumeTeamsOversubscription, assumeThreadsOversubscription, assumeNoThreadState, assumeNoNestedParallelism, openmpDeviceVersion); +} +template +mlir::omp::TargetAttr detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::getTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getTarget(tablegen_opaque_val); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::setTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, llvm::StringRef targetCPU, llvm::StringRef targetFeatures) { + return static_cast(impl)->setTarget(tablegen_opaque_val, targetCPU, targetFeatures); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::setHostIRFilePath(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, std::string hostIRFilePath) { + return static_cast(impl)->setHostIRFilePath(tablegen_opaque_val, hostIRFilePath); +} +template +llvm::StringRef detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::getHostIRFilePath(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getHostIRFilePath(tablegen_opaque_val); +} +template +::mlir::omp::ClauseRequires detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::getRequires(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getRequires(tablegen_opaque_val); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::FallbackModel::setRequires(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::omp::ClauseRequires clauses) { + return static_cast(impl)->setRequires(tablegen_opaque_val, clauses); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::setIsTargetDevice(::mlir::Operation *tablegen_opaque_val, bool isTargetDevice) const { +(llvm::cast(tablegen_opaque_val))->setAttr( + mlir::StringAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), llvm::Twine{"omp.is_target_device"}), + mlir::BoolAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), isTargetDevice)); +} +template +bool detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::getIsTargetDevice(::mlir::Operation *tablegen_opaque_val) const { +if (Attribute isTargetDevice = (llvm::cast(tablegen_opaque_val))->getAttr("omp.is_target_device")) + if (isTargetDevice.isa()) + return isTargetDevice.dyn_cast().getValue(); + return false; +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::setIsGPU(::mlir::Operation *tablegen_opaque_val, bool isGPU) const { +(llvm::cast(tablegen_opaque_val))->setAttr( + mlir::StringAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), "omp.is_gpu"), + mlir::BoolAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), isGPU)); +} +template +bool detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::getIsGPU(::mlir::Operation *tablegen_opaque_val) const { +if (Attribute isTargetCGAttr = (llvm::cast(tablegen_opaque_val))->getAttr("omp.is_gpu")) + if (auto isTargetCGVal = isTargetCGAttr.dyn_cast()) + return isTargetCGVal.getValue(); + return false; +} +template +mlir::omp::FlagsAttr detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::getFlags(::mlir::Operation *tablegen_opaque_val) const { +if (Attribute flags = (llvm::cast(tablegen_opaque_val))->getAttr("omp.flags")) + return ::llvm::dyn_cast_or_null(flags); + return nullptr; +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::setFlags(::mlir::Operation *tablegen_opaque_val, uint32_t debugKind, bool assumeTeamsOversubscription, bool assumeThreadsOversubscription, bool assumeNoThreadState, bool assumeNoNestedParallelism, uint32_t openmpDeviceVersion) const { +(llvm::cast(tablegen_opaque_val))->setAttr(("omp." + mlir::omp::FlagsAttr::getMnemonic()).str(), + mlir::omp::FlagsAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), debugKind, + assumeTeamsOversubscription, assumeThreadsOversubscription, + assumeNoThreadState, assumeNoNestedParallelism, openmpDeviceVersion)); +} +template +mlir::omp::TargetAttr detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::getTarget(::mlir::Operation *tablegen_opaque_val) const { +if (Attribute flags = (llvm::cast(tablegen_opaque_val))->getAttr("omp.target")) + return ::llvm::dyn_cast_or_null(flags); + return nullptr; +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::setTarget(::mlir::Operation *tablegen_opaque_val, llvm::StringRef targetCPU, llvm::StringRef targetFeatures) const { +if (targetCPU.empty()) + return; + (llvm::cast(tablegen_opaque_val))->setAttr(("omp." + mlir::omp::TargetAttr::getMnemonic()).str(), + mlir::omp::TargetAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), + targetCPU.str(), + targetFeatures.str())); +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::setHostIRFilePath(::mlir::Operation *tablegen_opaque_val, std::string hostIRFilePath) const { +(llvm::cast(tablegen_opaque_val))->setAttr( + mlir::StringAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), llvm::Twine{"omp.host_ir_filepath"}), + mlir::StringAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), hostIRFilePath)); +} +template +llvm::StringRef detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::getHostIRFilePath(::mlir::Operation *tablegen_opaque_val) const { +if (Attribute filepath = (llvm::cast(tablegen_opaque_val))->getAttr("omp.host_ir_filepath")) + if (::llvm::isa(filepath)) + return ::llvm::dyn_cast(filepath).getValue(); + return {}; +} +template +::mlir::omp::ClauseRequires detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::getRequires(::mlir::Operation *tablegen_opaque_val) const { +if (Attribute requiresAttr = (llvm::cast(tablegen_opaque_val))->getAttr("omp.requires")) + if (auto requiresVal = requiresAttr.dyn_cast()) + return requiresVal.getValue(); + return mlir::omp::ClauseRequires::none; +} +template +void detail::OffloadModuleInterfaceInterfaceTraits::ExternalModel::setRequires(::mlir::Operation *tablegen_opaque_val, ::mlir::omp::ClauseRequires clauses) const { +(llvm::cast(tablegen_opaque_val))->setAttr(mlir::StringAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), "omp.requires"), + mlir::omp::ClauseRequiresAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), clauses)); +} +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +template +void detail::EarlyOutliningInterfaceInterfaceTraits::Model::setParentName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, std::string parentName) { + return (llvm::cast(tablegen_opaque_val)).setParentName(parentName); +} +template +llvm::StringRef detail::EarlyOutliningInterfaceInterfaceTraits::Model::getParentName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getParentName(); +} +template +void detail::EarlyOutliningInterfaceInterfaceTraits::FallbackModel::setParentName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, std::string parentName) { + return static_cast(impl)->setParentName(tablegen_opaque_val, parentName); +} +template +llvm::StringRef detail::EarlyOutliningInterfaceInterfaceTraits::FallbackModel::getParentName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getParentName(tablegen_opaque_val); +} +template +void detail::EarlyOutliningInterfaceInterfaceTraits::ExternalModel::setParentName(::mlir::Operation *tablegen_opaque_val, std::string parentName) const { +(llvm::cast(tablegen_opaque_val))->setAttr( + mlir::StringAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), + llvm::Twine{"omp.outline_parent_name"}), + mlir::StringAttr::get((llvm::cast(tablegen_opaque_val))->getContext(), parentName)); +} +template +llvm::StringRef detail::EarlyOutliningInterfaceInterfaceTraits::ExternalModel::getParentName(::mlir::Operation *tablegen_opaque_val) const { +if (Attribute parentName = (llvm::cast(tablegen_opaque_val))->getAttr("omp.outline_parent_name")) + if (::llvm::isa(parentName)) + return ::llvm::dyn_cast(parentName).getValue(); + return {}; +} +} // namespace omp +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsTypes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsTypes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..98a81cfa8eb5072fd9c5d8448020e546a2944db0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsTypes.cpp.inc @@ -0,0 +1,71 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_LIST +#undef GET_TYPEDEF_LIST + +::mlir::omp::DataBoundsType + +#endif // GET_TYPEDEF_LIST + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + +static ::mlir::OptionalParseResult generatedTypeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::omp::DataBoundsType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::omp::DataBoundsType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedTypePrinter(::mlir::Type def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Type, ::mlir::LogicalResult>(def) .Case<::mlir::omp::DataBoundsType>([&](auto t) { + printer << ::mlir::omp::DataBoundsType::getMnemonic(); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace omp { +} // namespace omp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::omp::DataBoundsType) +namespace mlir { +namespace omp { + +/// Parse a type registered to this dialect. +::mlir::Type OpenMPDialect::parseType(::mlir::DialectAsmParser &parser) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef mnemonic; + ::mlir::Type genType; + auto parseResult = generatedTypeParser(parser, &mnemonic, genType); + if (parseResult.has_value()) + return genType; + + parser.emitError(typeLoc) << "unknown type `" + << mnemonic << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print a type registered to this dialect. +void OpenMPDialect::printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedTypePrinter(type, printer))) + return; + +} +} // namespace omp +} // namespace mlir + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsTypes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsTypes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..3831bcf1d832f756fa7b9e9aa61b7fd3c718cd84 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPOpsTypes.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace omp { +class DataBoundsType; +class DataBoundsType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"data_bounds_ty"}; + } + +}; +} // namespace omp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::omp::DataBoundsType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..7f1df33c86522cdac7d3a81e456cd4d14f9b6649 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.cpp.inc @@ -0,0 +1,12 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Returns the pointee type or null if the pointer has no pointee type +::mlir::Type mlir::omp::PointerLikeType::getElementType() const { + return getImpl()->getElementType(getImpl(), *this); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..8cfe12a35747c87a4cec810002b7cacab4110563 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.h.inc @@ -0,0 +1,69 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace omp { +class PointerLikeType; +namespace detail { +struct PointerLikeTypeInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + ::mlir::Type (*getElementType)(const Concept *impl, ::mlir::Type ); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::omp::PointerLikeType; + Model() : Concept{getElementType} {} + + static inline ::mlir::Type getElementType(const Concept *impl, ::mlir::Type tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::omp::PointerLikeType; + FallbackModel() : Concept{getElementType} {} + + static inline ::mlir::Type getElementType(const Concept *impl, ::mlir::Type tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteType; + }; +};template +struct PointerLikeTypeTrait; + +} // namespace detail +class PointerLikeType : public ::mlir::TypeInterface { +public: + using ::mlir::TypeInterface::TypeInterface; + template + struct Trait : public detail::PointerLikeTypeTrait {}; + /// Returns the pointee type or null if the pointer has no pointee type + ::mlir::Type getElementType() const; +}; +namespace detail { + template + struct PointerLikeTypeTrait : public ::mlir::TypeInterface::Trait { + }; +}// namespace detail +} // namespace omp +} // namespace mlir +namespace mlir { +namespace omp { +template +::mlir::Type detail::PointerLikeTypeInterfaceTraits::Model::getElementType(const Concept *impl, ::mlir::Type tablegen_opaque_val) { + return (::llvm::cast(tablegen_opaque_val)).getElementType(); +} +template +::mlir::Type detail::PointerLikeTypeInterfaceTraits::FallbackModel::getElementType(const Concept *impl, ::mlir::Type tablegen_opaque_val) { + return static_cast(impl)->getElementType(tablegen_opaque_val); +} +} // namespace omp +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDL.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDL.h new file mode 100644 index 0000000000000000000000000000000000000000..bbc52301360d7a83a32a8de8aa065ed081d38497 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDL.h @@ -0,0 +1,24 @@ +//===- PDL.h - Pattern Descriptor Language Dialect --------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the dialect for the Pattern Descriptor Language. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_PDL_IR_PDL_H_ +#define MLIR_DIALECT_PDL_IR_PDL_H_ + +#include "mlir/IR/Dialect.h" + +//===----------------------------------------------------------------------===// +// PDL Dialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/PDL/IR/PDLOpsDialect.h.inc" + +#endif // MLIR_DIALECT_PDL_IR_PDL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..7a5aa64b3b1b4d819310e6c33e45818bf1d2d541 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOps.cpp.inc @@ -0,0 +1,5001 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: PDLOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::pdl::ApplyNativeConstraintOp, +::mlir::pdl::ApplyNativeRewriteOp, +::mlir::pdl::AttributeOp, +::mlir::pdl::EraseOp, +::mlir::pdl::OperandOp, +::mlir::pdl::OperandsOp, +::mlir::pdl::OperationOp, +::mlir::pdl::PatternOp, +::mlir::pdl::RangeOp, +::mlir::pdl::ReplaceOp, +::mlir::pdl::ResultOp, +::mlir::pdl::ResultsOp, +::mlir::pdl::RewriteOp, +::mlir::pdl::TypeOp, +::mlir::pdl::TypesOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace pdl { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::PDLType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be pdl type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::TypeType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be PDL handle to an `mlir::Type`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::AttributeType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be PDL handle to an `mlir::Attribute`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::OperationType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be PDL handle to an `mlir::Operation *`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::ValueType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be PDL handle for an `mlir::Value`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::TypeType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be range of PDL handle to an `mlir::Type` values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::ValueType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be range of PDL handle for an `mlir::Value` values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::ValueType>(type))) || (((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::ValueType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType())))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be single element or range of PDL handle for an `mlir::Value`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::TypeType>(type))) || (((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::TypeType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType())))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be single element or range of PDL handle to an `mlir::Type`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLOps9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::RangeType>(type))) && (((::llvm::isa<::mlir::pdl::TypeType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType()))) || ((::llvm::isa<::mlir::pdl::ValueType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType())))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be range of PDL handle to an `mlir::Type` or PDL handle for an `mlir::Value` values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: bool attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((true))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(16)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative())))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 16-bit signless integer attribute whose value is non-negative"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any type attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: type array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_PDLOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItems(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with 1 blocks"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_PDLOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ApplyNativeConstraintOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ApplyNativeConstraintOpGenericAdaptorBase::ApplyNativeConstraintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.apply_native_constraint", odsAttrs.getContext()); +} + +ApplyNativeConstraintOpGenericAdaptorBase::ApplyNativeConstraintOpGenericAdaptorBase(ApplyNativeConstraintOp op) : ApplyNativeConstraintOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ApplyNativeConstraintOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ApplyNativeConstraintOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr ApplyNativeConstraintOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::llvm::StringRef ApplyNativeConstraintOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr ApplyNativeConstraintOpGenericAdaptorBase::getIsNegatedAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().isNegated); + return attr; +} + +bool ApplyNativeConstraintOpGenericAdaptorBase::getIsNegated() { + auto attr = getIsNegatedAttr(); + return attr.getValue(); +} + +} // namespace detail +ApplyNativeConstraintOpAdaptor::ApplyNativeConstraintOpAdaptor(ApplyNativeConstraintOp op) : ApplyNativeConstraintOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ApplyNativeConstraintOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_isNegated = getProperties().isNegated; (void)tblgen_isNegated; + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitError(loc, "'pdl.apply_native_constraint' op ""requires attribute 'name'"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'pdl.apply_native_constraint' op ""attribute 'name' failed to satisfy constraint: string attribute"); + + if (tblgen_isNegated && !((::llvm::isa<::mlir::BoolAttr>(tblgen_isNegated)))) + return emitError(loc, "'pdl.apply_native_constraint' op ""attribute 'isNegated' failed to satisfy constraint: bool attribute"); + return ::mlir::success(); +} + +std::pair ApplyNativeConstraintOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ApplyNativeConstraintOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ApplyNativeConstraintOp::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange ApplyNativeConstraintOp::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ApplyNativeConstraintOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ApplyNativeConstraintOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult ApplyNativeConstraintOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.isNegated; + auto attr = dict.get("isNegated"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for isNegated in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isNegated` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ApplyNativeConstraintOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.isNegated; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isNegated", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ApplyNativeConstraintOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.isNegated.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer())); +} + +std::optional ApplyNativeConstraintOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "isNegated") + return prop.isNegated; + + if (name == "name") + return prop.name; + return std::nullopt; +} + +void ApplyNativeConstraintOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "isNegated") { + prop.isNegated = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ApplyNativeConstraintOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.isNegated) attrs.append("isNegated", prop.isNegated); + + if (prop.name) attrs.append("name", prop.name); +} + +::mlir::LogicalResult ApplyNativeConstraintOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIsNegatedAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps1(attr, "isNegated", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ApplyNativeConstraintOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.isNegated))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ApplyNativeConstraintOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.isNegated); + writer.writeAttribute(prop.name); +} + +::mlir::StringAttr ApplyNativeConstraintOp::getNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().name); +} + +::llvm::StringRef ApplyNativeConstraintOp::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr ApplyNativeConstraintOp::getIsNegatedAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().isNegated); +} + +bool ApplyNativeConstraintOp::getIsNegated() { + auto attr = getIsNegatedAttr(); + return attr.getValue(); +} + +void ApplyNativeConstraintOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void ApplyNativeConstraintOp::setName(::llvm::StringRef attrValue) { + (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void ApplyNativeConstraintOp::setIsNegatedAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getIsNegatedAttrName(), attr); +} + +void ApplyNativeConstraintOp::setIsNegated(bool attrValue) { + (*this)->setAttr(getIsNegatedAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void ApplyNativeConstraintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr name, ::mlir::ValueRange args, ::mlir::BoolAttr isNegated) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = name; + if (isNegated) { + odsState.getOrAddProperties().isNegated = isNegated; + } +} + +void ApplyNativeConstraintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::ValueRange args, ::mlir::BoolAttr isNegated) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = name; + if (isNegated) { + odsState.getOrAddProperties().isNegated = isNegated; + } + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ApplyNativeConstraintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef name, ::mlir::ValueRange args, bool isNegated) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.getOrAddProperties().isNegated = odsBuilder.getBoolAttr(isNegated); +} + +void ApplyNativeConstraintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::ValueRange args, bool isNegated) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.getOrAddProperties().isNegated = odsBuilder.getBoolAttr(isNegated); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ApplyNativeConstraintOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ApplyNativeConstraintOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.isNegated) + properties.isNegated = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult ApplyNativeConstraintOp::verifyInvariantsImpl() { + auto tblgen_isNegated = getProperties().isNegated; (void)tblgen_isNegated; + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitOpError("requires attribute 'name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(*this, tblgen_name, "name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps1(*this, tblgen_isNegated, "isNegated"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ApplyNativeConstraintOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ApplyNativeConstraintOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr nameAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> argsTypes; + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(argsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ApplyNativeConstraintOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + _odsPrinter << "("; + _odsPrinter << getArgs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getArgs().getTypes(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("name"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getIsNegatedAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("isNegated"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::ApplyNativeConstraintOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ApplyNativeRewriteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ApplyNativeRewriteOpGenericAdaptorBase::ApplyNativeRewriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.apply_native_rewrite", odsAttrs.getContext()); +} + +ApplyNativeRewriteOpGenericAdaptorBase::ApplyNativeRewriteOpGenericAdaptorBase(ApplyNativeRewriteOp op) : ApplyNativeRewriteOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ApplyNativeRewriteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ApplyNativeRewriteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr ApplyNativeRewriteOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::llvm::StringRef ApplyNativeRewriteOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +} // namespace detail +ApplyNativeRewriteOpAdaptor::ApplyNativeRewriteOpAdaptor(ApplyNativeRewriteOp op) : ApplyNativeRewriteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ApplyNativeRewriteOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitError(loc, "'pdl.apply_native_rewrite' op ""requires attribute 'name'"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'pdl.apply_native_rewrite' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair ApplyNativeRewriteOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ApplyNativeRewriteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ApplyNativeRewriteOp::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange ApplyNativeRewriteOp::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ApplyNativeRewriteOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range ApplyNativeRewriteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range ApplyNativeRewriteOp::getResults() { + return getODSResults(0); +} + +::mlir::LogicalResult ApplyNativeRewriteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ApplyNativeRewriteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ApplyNativeRewriteOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.name.getAsOpaquePointer())); +} + +std::optional ApplyNativeRewriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "name") + return prop.name; + return std::nullopt; +} + +void ApplyNativeRewriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ApplyNativeRewriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.name) attrs.append("name", prop.name); +} + +::mlir::LogicalResult ApplyNativeRewriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ApplyNativeRewriteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ApplyNativeRewriteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.name); +} + +::mlir::StringAttr ApplyNativeRewriteOp::getNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().name); +} + +::llvm::StringRef ApplyNativeRewriteOp::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +void ApplyNativeRewriteOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void ApplyNativeRewriteOp::setName(::llvm::StringRef attrValue) { + (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void ApplyNativeRewriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::StringAttr name, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = name; + odsState.addTypes(results); +} + +void ApplyNativeRewriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::llvm::StringRef name, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.addTypes(results); +} + +void ApplyNativeRewriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ApplyNativeRewriteOp::verifyInvariantsImpl() { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitOpError("requires attribute 'name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ApplyNativeRewriteOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ApplyNativeRewriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr nameAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> argsTypes; + ::llvm::SmallVector<::mlir::Type, 1> resultsTypes; + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(argsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + if (::mlir::succeeded(parser.parseOptionalColon())) { + + if (parser.parseTypeList(resultsTypes)) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addTypes(resultsTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ApplyNativeRewriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + if (!getArgs().empty()) { + _odsPrinter << "("; + _odsPrinter << getArgs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getArgs().getTypes(); + _odsPrinter << ")"; + } + if (!getResults().empty()) { + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getResults().getTypes(); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("name"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::ApplyNativeRewriteOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::AttributeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AttributeOpGenericAdaptorBase::AttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.attribute", odsAttrs.getContext()); +} + +AttributeOpGenericAdaptorBase::AttributeOpGenericAdaptorBase(AttributeOp op) : AttributeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AttributeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr AttributeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Attribute AttributeOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().value); + return attr; +} + +::std::optional<::mlir::Attribute> AttributeOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +} // namespace detail +AttributeOpAdaptor::AttributeOpAdaptor(AttributeOp op) : AttributeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AttributeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + + if (tblgen_value && !((true))) + return emitError(loc, "'pdl.attribute' op ""attribute 'value' failed to satisfy constraint: any attribute"); + return ::mlir::success(); +} + +std::pair AttributeOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range AttributeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value AttributeOp::getValueType() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::MutableOperandRange AttributeOp::getValueTypeMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair AttributeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AttributeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::AttributeType> AttributeOp::getAttr() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::AttributeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult AttributeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute AttributeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code AttributeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional AttributeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void AttributeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void AttributeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult AttributeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps2(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult AttributeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AttributeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.value); +} + +::mlir::Attribute AttributeOp::getValueAttr() { + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().value); +} + +::std::optional<::mlir::Attribute> AttributeOp::getValue() { + auto attr = getValueAttr(); + return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt); +} + +void AttributeOp::setValueAttr(::mlir::Attribute attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +::mlir::Attribute AttributeOp::removeValueAttr() { + auto &attr = getProperties().value; + attr = {}; + return attr; +} + +void AttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value type) { + build(odsBuilder, odsState, odsBuilder.getType(), type, + Attribute()); + +} + +void AttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute attr) { + build(odsBuilder, odsState, odsBuilder.getType(), Value(), attr); + +} + +void AttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type attr, /*optional*/::mlir::Value valueType, /*optional*/::mlir::Attribute value) { + if (valueType) + odsState.addOperands(valueType); + if (value) { + odsState.getOrAddProperties().value = value; + } + odsState.addTypes(attr); +} + +void AttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value valueType, /*optional*/::mlir::Attribute value) { + if (valueType) + odsState.addOperands(valueType); + if (value) { + odsState.getOrAddProperties().value = value; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AttributeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AttributeOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps2(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult AttributeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult AttributeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> valueTypeOperands; + ::llvm::SMLoc valueTypeOperandsLoc; + (void)valueTypeOperandsLoc; + ::mlir::Attribute valueAttr; + if (::mlir::succeeded(parser.parseOptionalColon())) { + + { + valueTypeOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + valueTypeOperands.push_back(operand); + } + } + } + if (::mlir::succeeded(parser.parseOptionalEqual())) { + + if (parser.parseAttribute(valueAttr, ::mlir::Type{})) + return ::mlir::failure(); + if (valueAttr) result.getOrAddProperties().value = valueAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::AttributeType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::pdl::TypeType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(valueTypeOperands, odsBuildableType1, valueTypeOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AttributeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getValueType()) { + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + if (::mlir::Value value = getValueType()) + _odsPrinter << value; + } + if (getValueAttr()) { + _odsPrinter << ' ' << "="; + _odsPrinter << ' '; + _odsPrinter.printAttribute(getValueAttr()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::AttributeOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::EraseOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +EraseOpGenericAdaptorBase::EraseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.erase", odsAttrs.getContext()); +} + +EraseOpGenericAdaptorBase::EraseOpGenericAdaptorBase(EraseOp op) : EraseOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair EraseOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr EraseOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +EraseOpAdaptor::EraseOpAdaptor(EraseOp op) : EraseOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult EraseOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair EraseOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range EraseOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> EraseOp::getOpValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &EraseOp::getOpValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair EraseOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range EraseOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void EraseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value opValue) { + odsState.addOperands(opValue); +} + +void EraseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value opValue) { + odsState.addOperands(opValue); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void EraseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult EraseOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult EraseOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult EraseOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand opValueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> opValueOperands(opValueRawOperands); ::llvm::SMLoc opValueOperandsLoc; + (void)opValueOperandsLoc; + + opValueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(opValueRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(opValueOperands, odsBuildableType0, opValueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void EraseOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOpValue(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::EraseOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::OperandOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +OperandOpGenericAdaptorBase::OperandOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.operand", odsAttrs.getContext()); +} + +OperandOpGenericAdaptorBase::OperandOpGenericAdaptorBase(OperandOp op) : OperandOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair OperandOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr OperandOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +OperandOpAdaptor::OperandOpAdaptor(OperandOp op) : OperandOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult OperandOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair OperandOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range OperandOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value OperandOp::getValueType() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::MutableOperandRange OperandOp::getValueTypeMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair OperandOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range OperandOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::ValueType> OperandOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::ValueType>>(*getODSResults(0).begin()); +} + +void OperandOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + build(odsBuilder, odsState, odsBuilder.getType(), Value()); + +} + +void OperandOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, /*optional*/::mlir::Value valueType) { + if (valueType) + odsState.addOperands(valueType); + odsState.addTypes(value); +} + +void OperandOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value valueType) { + if (valueType) + odsState.addOperands(valueType); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void OperandOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult OperandOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult OperandOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult OperandOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> valueTypeOperands; + ::llvm::SMLoc valueTypeOperandsLoc; + (void)valueTypeOperandsLoc; + if (::mlir::succeeded(parser.parseOptionalColon())) { + + { + valueTypeOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + valueTypeOperands.push_back(operand); + } + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::ValueType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::pdl::TypeType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(valueTypeOperands, odsBuildableType1, valueTypeOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OperandOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getValueType()) { + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + if (::mlir::Value value = getValueType()) + _odsPrinter << value; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::OperandOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::OperandsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +OperandsOpGenericAdaptorBase::OperandsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.operands", odsAttrs.getContext()); +} + +OperandsOpGenericAdaptorBase::OperandsOpGenericAdaptorBase(OperandsOp op) : OperandsOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair OperandsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr OperandsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +OperandsOpAdaptor::OperandsOpAdaptor(OperandsOp op) : OperandsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult OperandsOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair OperandsOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range OperandsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> OperandsOp::getValueType() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::TypedValue<::mlir::pdl::RangeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*operands.begin()); +} + +::mlir::MutableOperandRange OperandsOp::getValueTypeMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair OperandsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range OperandsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> OperandsOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSResults(0).begin()); +} + +void OperandsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { + build(odsBuilder, odsState, RangeType::get(odsBuilder.getType()), + Value()); + +} + +void OperandsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, /*optional*/::mlir::Value valueType) { + if (valueType) + odsState.addOperands(valueType); + odsState.addTypes(value); +} + +void OperandsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value valueType) { + if (valueType) + odsState.addOperands(valueType); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void OperandsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult OperandsOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult OperandsOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult OperandsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> valueTypeOperands; + ::llvm::SMLoc valueTypeOperandsLoc; + (void)valueTypeOperandsLoc; + if (::mlir::succeeded(parser.parseOptionalColon())) { + + { + valueTypeOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + valueTypeOperands.push_back(operand); + } + } + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = ::mlir::pdl::RangeType::get(parser.getBuilder().getType<::mlir::pdl::ValueType>()); + ::mlir::Type odsBuildableType1 = ::mlir::pdl::RangeType::get(parser.getBuilder().getType<::mlir::pdl::TypeType>()); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(valueTypeOperands, odsBuildableType1, valueTypeOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OperandsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getValueType()) { + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + if (::mlir::Value value = getValueType()) + _odsPrinter << value; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::OperandsOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::OperationOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +OperationOpGenericAdaptorBase::OperationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.operation", odsAttrs.getContext()); +} + +OperationOpGenericAdaptorBase::OperationOpGenericAdaptorBase(OperationOp op) : OperationOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair OperationOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr OperationOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr OperationOpGenericAdaptorBase::getOpNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().opName); + return attr; +} + +::std::optional< ::llvm::StringRef > OperationOpGenericAdaptorBase::getOpName() { + auto attr = getOpNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr OperationOpGenericAdaptorBase::getAttributeValueNamesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().attributeValueNames); + return attr; +} + +::mlir::ArrayAttr OperationOpGenericAdaptorBase::getAttributeValueNames() { + auto attr = getAttributeValueNamesAttr(); + return attr; +} + +} // namespace detail +OperationOpAdaptor::OperationOpAdaptor(OperationOp op) : OperationOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult OperationOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_attributeValueNames = getProperties().attributeValueNames; (void)tblgen_attributeValueNames; + if (!tblgen_attributeValueNames) return emitError(loc, "'pdl.operation' op ""requires attribute 'attributeValueNames'"); + auto tblgen_opName = getProperties().opName; (void)tblgen_opName; + + if (tblgen_opName && !((::llvm::isa<::mlir::StringAttr>(tblgen_opName)))) + return emitError(loc, "'pdl.operation' op ""attribute 'opName' failed to satisfy constraint: string attribute"); + + if (tblgen_attributeValueNames && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_attributeValueNames))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_attributeValueNames), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); })))) + return emitError(loc, "'pdl.operation' op ""attribute 'attributeValueNames' failed to satisfy constraint: string array attribute"); + return ::mlir::success(); +} + +std::pair OperationOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range OperationOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range OperationOp::getOperandValues() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range OperationOp::getAttributeValues() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range OperationOp::getTypeValues() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange OperationOp::getOperandValuesMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange OperationOp::getAttributeValuesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange OperationOp::getTypeValuesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair OperationOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range OperationOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> OperationOp::getOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult OperationOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.attributeValueNames; + auto attr = dict.get("attributeValueNames"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for attributeValueNames in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `attributeValueNames` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.opName; + auto attr = dict.get("opName"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for opName in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `opName` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute OperationOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.attributeValueNames; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("attributeValueNames", + propStorage)); + } + + { + const auto &propStorage = prop.opName; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("opName", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code OperationOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.attributeValueNames.getAsOpaquePointer()), + llvm::hash_value(prop.opName.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional OperationOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "attributeValueNames") + return prop.attributeValueNames; + + if (name == "opName") + return prop.opName; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void OperationOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "attributeValueNames") { + prop.attributeValueNames = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "opName") { + prop.opName = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void OperationOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.attributeValueNames) attrs.append("attributeValueNames", prop.attributeValueNames); + + if (prop.opName) attrs.append("opName", prop.opName); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult OperationOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getAttributeValueNamesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps3(attr, "attributeValueNames", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getOpNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(attr, "opName", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult OperationOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.attributeValueNames))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.opName))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void OperationOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.attributeValueNames); + + writer.writeOptionalAttribute(prop.opName); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::StringAttr OperationOp::getOpNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().opName); +} + +::std::optional< ::llvm::StringRef > OperationOp::getOpName() { + auto attr = getOpNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr OperationOp::getAttributeValueNamesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().attributeValueNames); +} + +::mlir::ArrayAttr OperationOp::getAttributeValueNames() { + auto attr = getAttributeValueNamesAttr(); + return attr; +} + +void OperationOp::setOpNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getOpNameAttrName(), attr); +} + +void OperationOp::setOpName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getOpNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getOpNameAttrName()); +} + +void OperationOp::setAttributeValueNamesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getAttributeValueNamesAttrName(), attr); +} + +::mlir::Attribute OperationOp::removeOpNameAttr() { + auto &attr = getProperties().opName; + attr = {}; + return attr; +} + +void OperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, std::optional name, ValueRange operandValues, ArrayRef attrNames, ValueRange attrValues, ValueRange resultTypes) { + auto nameAttr = name ? odsBuilder.getStringAttr(*name) : StringAttr(); + build(odsBuilder, odsState, odsBuilder.getType(), nameAttr, + operandValues, attrValues, odsBuilder.getStrArrayAttr(attrNames), + resultTypes); + +} + +void OperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type op, /*optional*/::mlir::StringAttr opName, ::mlir::ValueRange operandValues, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames, ::mlir::ValueRange typeValues) { + odsState.addOperands(operandValues); + odsState.addOperands(attributeValues); + odsState.addOperands(typeValues); + ::llvm::copy(::llvm::ArrayRef({static_cast(operandValues.size()), static_cast(attributeValues.size()), static_cast(typeValues.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (opName) { + odsState.getOrAddProperties().opName = opName; + } + odsState.getOrAddProperties().attributeValueNames = attributeValueNames; + odsState.addTypes(op); +} + +void OperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr opName, ::mlir::ValueRange operandValues, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames, ::mlir::ValueRange typeValues) { + odsState.addOperands(operandValues); + odsState.addOperands(attributeValues); + odsState.addOperands(typeValues); + ::llvm::copy(::llvm::ArrayRef({static_cast(operandValues.size()), static_cast(attributeValues.size()), static_cast(typeValues.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (opName) { + odsState.getOrAddProperties().opName = opName; + } + odsState.getOrAddProperties().attributeValueNames = attributeValueNames; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void OperationOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult OperationOp::verifyInvariantsImpl() { + auto tblgen_attributeValueNames = getProperties().attributeValueNames; (void)tblgen_attributeValueNames; + if (!tblgen_attributeValueNames) return emitOpError("requires attribute 'attributeValueNames'"); + auto tblgen_opName = getProperties().opName; (void)tblgen_opName; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(*this, tblgen_opName, "opName"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps3(*this, tblgen_attributeValueNames, "attributeValueNames"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult OperationOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult OperationOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr opNameAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandValuesOperands; + ::llvm::SMLoc operandValuesOperandsLoc; + (void)operandValuesOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> operandValuesTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> attributeValuesOperands; + ::llvm::SMLoc attributeValuesOperandsLoc; + (void)attributeValuesOperandsLoc; + ::mlir::ArrayAttr attributeValueNamesAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> typeValuesOperands; + ::llvm::SMLoc typeValuesOperandsLoc; + (void)typeValuesOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> typeValuesTypes; + + ::mlir::OptionalParseResult parseResultopNameAttr = + parser.parseOptionalAttribute(opNameAttr, parser.getBuilder().getType<::mlir::NoneType>()); + if (parseResultopNameAttr.has_value() && failed(*parseResultopNameAttr)) + return ::mlir::failure(); + if (parseResultopNameAttr.has_value() && succeeded(*parseResultopNameAttr)) + if (opNameAttr) result.getOrAddProperties().opName = opNameAttr; + if (opNameAttr) { + } + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + operandValuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(operandValuesOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(operandValuesTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + attributeValuesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseOperationOpAttributes(parser, attributeValuesOperands, attributeValueNamesAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().attributeValueNames = attributeValueNamesAttr; + } + if (::mlir::succeeded(parser.parseOptionalArrow())) { + if (parser.parseLParen()) + return ::mlir::failure(); + + typeValuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(typeValuesOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(typeValuesTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(operandValuesOperands.size()), static_cast(attributeValuesOperands.size()), static_cast(typeValuesOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::pdl::AttributeType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(operandValuesOperands, operandValuesTypes, operandValuesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(attributeValuesOperands, odsBuildableType1, attributeValuesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(typeValuesOperands, typeValuesTypes, typeValuesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void OperationOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getOpNameAttr()) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getOpNameAttr()); + } + if (!getOperandValues().empty()) { + _odsPrinter << "("; + _odsPrinter << getOperandValues(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getOperandValues().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ' '; + printOperationOpAttributes(_odsPrinter, *this, getAttributeValues(), getAttributeValueNamesAttr()); + if (!getTypeValues().empty()) { + _odsPrinter << ' ' << "->"; + _odsPrinter << ' ' << "("; + _odsPrinter << getTypeValues(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getTypeValues().getTypes(); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("opName"); + elidedAttrs.push_back("attributeValueNames"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::OperationOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::PatternOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +PatternOpGenericAdaptorBase::PatternOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.pattern", odsAttrs.getContext()); +} + +PatternOpGenericAdaptorBase::PatternOpGenericAdaptorBase(PatternOp op) : PatternOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair PatternOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr PatternOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr PatternOpGenericAdaptorBase::getBenefitAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().benefit); + return attr; +} + +uint16_t PatternOpGenericAdaptorBase::getBenefit() { + auto attr = getBenefitAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::StringAttr PatternOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::std::optional< ::llvm::StringRef > PatternOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &PatternOpGenericAdaptorBase::getBodyRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange PatternOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +PatternOpAdaptor::PatternOpAdaptor(PatternOp op) : PatternOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult PatternOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_benefit = getProperties().benefit; (void)tblgen_benefit; + if (!tblgen_benefit) return emitError(loc, "'pdl.pattern' op ""requires attribute 'benefit'"); + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + + if (tblgen_benefit && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_benefit))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_benefit).getType().isSignlessInteger(16)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_benefit).getValue().isNegative())))) + return emitError(loc, "'pdl.pattern' op ""attribute 'benefit' failed to satisfy constraint: 16-bit signless integer attribute whose value is non-negative"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'pdl.pattern' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair PatternOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range PatternOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair PatternOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range PatternOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &PatternOp::getBodyRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult PatternOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.benefit; + auto attr = dict.get("benefit"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for benefit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `benefit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute PatternOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.benefit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("benefit", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code PatternOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.benefit.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer())); +} + +std::optional PatternOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "benefit") + return prop.benefit; + + if (name == "sym_name") + return prop.sym_name; + return std::nullopt; +} + +void PatternOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "benefit") { + prop.benefit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void PatternOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.benefit) attrs.append("benefit", prop.benefit); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); +} + +::mlir::LogicalResult PatternOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBenefitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps4(attr, "benefit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PatternOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.benefit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.sym_name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void PatternOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.benefit); + + writer.writeOptionalAttribute(prop.sym_name); +} + +::mlir::IntegerAttr PatternOp::getBenefitAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().benefit); +} + +uint16_t PatternOp::getBenefit() { + auto attr = getBenefitAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::StringAttr PatternOp::getSymNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().sym_name); +} + +::std::optional< ::llvm::StringRef > PatternOp::getSymName() { + auto attr = getSymNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void PatternOp::setBenefitAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getBenefitAttrName(), attr); +} + +void PatternOp::setBenefit(uint16_t attrValue) { + (*this)->setAttr(getBenefitAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(16), attrValue)); +} + +void PatternOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void PatternOp::setSymName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getSymNameAttrName()); +} + +::mlir::Attribute PatternOp::removeSymNameAttr() { + auto &attr = getProperties().sym_name; + attr = {}; + return attr; +} + +void PatternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr benefit, /*optional*/::mlir::StringAttr sym_name) { + odsState.getOrAddProperties().benefit = benefit; + if (sym_name) { + odsState.getOrAddProperties().sym_name = sym_name; + } + (void)odsState.addRegion(); +} + +void PatternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr benefit, /*optional*/::mlir::StringAttr sym_name) { + odsState.getOrAddProperties().benefit = benefit; + if (sym_name) { + odsState.getOrAddProperties().sym_name = sym_name; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PatternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint16_t benefit, /*optional*/::mlir::StringAttr sym_name) { + odsState.getOrAddProperties().benefit = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(16), benefit); + if (sym_name) { + odsState.getOrAddProperties().sym_name = sym_name; + } + (void)odsState.addRegion(); +} + +void PatternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint16_t benefit, /*optional*/::mlir::StringAttr sym_name) { + odsState.getOrAddProperties().benefit = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(16), benefit); + if (sym_name) { + odsState.getOrAddProperties().sym_name = sym_name; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void PatternOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult PatternOp::verifyInvariantsImpl() { + auto tblgen_benefit = getProperties().benefit; (void)tblgen_benefit; + if (!tblgen_benefit) return emitOpError("requires attribute 'benefit'"); + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps4(*this, tblgen_benefit, "benefit"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_PDLOps0(*this, region, "bodyRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult PatternOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult PatternOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr sym_nameAttr; + ::mlir::IntegerAttr benefitAttr; + std::unique_ptr<::mlir::Region> bodyRegionRegion = std::make_unique<::mlir::Region>(); + + // Parsing an optional symbol name doesn't fail, so no need to check the + // result. + (void)parser.parseOptionalSymbolName(sym_nameAttr); + if (sym_nameAttr) result.getOrAddProperties().sym_name = sym_nameAttr; + if (sym_nameAttr) { + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseKeyword("benefit")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(benefitAttr, parser.getBuilder().getIntegerType(16))) { + return ::mlir::failure(); + } + if (benefitAttr) result.getOrAddProperties().benefit = benefitAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + + if (parser.parseRegion(*bodyRegionRegion)) + return ::mlir::failure(); + + if (bodyRegionRegion->empty()) bodyRegionRegion->emplaceBlock(); + result.addRegion(std::move(bodyRegionRegion)); + return ::mlir::success(); +} + +void PatternOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getSymNameAttr()) { + _odsPrinter << ' '; + _odsPrinter.printSymbolName(getSymNameAttr().getValue()); + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "benefit"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getBenefitAttr()); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("sym_name"); + elidedAttrs.push_back("benefit"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' '; + _odsPrinter.printRegion(getBodyRegion()); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::PatternOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::RangeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RangeOpGenericAdaptorBase::RangeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.range", odsAttrs.getContext()); +} + +RangeOpGenericAdaptorBase::RangeOpGenericAdaptorBase(RangeOp op) : RangeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RangeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr RangeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +RangeOpAdaptor::RangeOpAdaptor(RangeOp op) : RangeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RangeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair RangeOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range RangeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range RangeOp::getArguments() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange RangeOp::getArgumentsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair RangeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RangeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> RangeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSResults(0).begin()); +} + +void RangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange arguments) { + odsState.addOperands(arguments); + odsState.addTypes(result); +} + +void RangeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RangeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult RangeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult RangeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argumentsOperands; + ::llvm::SMLoc argumentsOperandsLoc; + (void)argumentsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> argumentsTypes; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + argumentsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argumentsOperands)) + return ::mlir::failure(); + if (!argumentsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(argumentsTypes)) + return ::mlir::failure(); + } + { + auto odsResult = parseRangeType(parser, argumentsTypes, resultRawTypes[0]); + if (odsResult) return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addTypes(resultTypes); + if (parser.resolveOperands(argumentsOperands, argumentsTypes, argumentsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RangeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (!getArguments().empty()) { + _odsPrinter << ' '; + _odsPrinter << getArguments(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getArguments().getTypes(); + } + _odsPrinter << ' '; + printRangeType(_odsPrinter, *this, getArguments().getTypes(), getResult().getType()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void RangeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::RangeOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ReplaceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReplaceOpGenericAdaptorBase::ReplaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.replace", odsAttrs.getContext()); +} + +ReplaceOpGenericAdaptorBase::ReplaceOpGenericAdaptorBase(ReplaceOp op) : ReplaceOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReplaceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr ReplaceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ReplaceOpAdaptor::ReplaceOpAdaptor(ReplaceOp op) : ReplaceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReplaceOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ReplaceOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range ReplaceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> ReplaceOp::getOpValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::Value ReplaceOp::getReplOperation() { + auto operands = getODSOperands(1); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range ReplaceOp::getReplValues() { + return getODSOperands(2); +} + +::mlir::OpOperand &ReplaceOp::getOpValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange ReplaceOp::getReplOperationMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange ReplaceOp::getReplValuesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair ReplaceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReplaceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::LogicalResult ReplaceOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + ; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute ReplaceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ReplaceOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional ReplaceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void ReplaceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void ReplaceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult ReplaceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return ::mlir::success(); +} + +::mlir::LogicalResult ReplaceOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ReplaceOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +void ReplaceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value opValue, /*optional*/::mlir::Value replOperation, ::mlir::ValueRange replValues) { + odsState.addOperands(opValue); + if (replOperation) + odsState.addOperands(replOperation); + odsState.addOperands(replValues); + ::llvm::copy(::llvm::ArrayRef({1, (replOperation ? 1 : 0), static_cast(replValues.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); +} + +void ReplaceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value opValue, /*optional*/::mlir::Value replOperation, ::mlir::ValueRange replValues) { + odsState.addOperands(opValue); + if (replOperation) + odsState.addOperands(replOperation); + odsState.addOperands(replValues); + ::llvm::copy(::llvm::ArrayRef({1, (replOperation ? 1 : 0), static_cast(replValues.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReplaceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReplaceOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + if (valueGroup1.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup1.size(); + } + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps7(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReplaceOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ReplaceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand opValueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> opValueOperands(opValueRawOperands); ::llvm::SMLoc opValueOperandsLoc; + (void)opValueOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> replValuesOperands; + ::llvm::SMLoc replValuesOperandsLoc; + (void)replValuesOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> replValuesTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> replOperationOperands; + ::llvm::SMLoc replOperationOperandsLoc; + (void)replOperationOperandsLoc; + + opValueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(opValueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("with")) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + replValuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(replValuesOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(replValuesTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + + { + replOperationOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + replOperationOperands.push_back(operand); + } + } + if (!replOperationOperands.empty()) { + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({1, static_cast(replOperationOperands.size()), static_cast(replValuesOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(opValueOperands, odsBuildableType0, opValueOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(replOperationOperands, odsBuildableType0, replOperationOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(replValuesOperands, replValuesTypes, replValuesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReplaceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOpValue(); + _odsPrinter << ' ' << "with"; + if (!getReplValues().empty()) { + _odsPrinter << "("; + _odsPrinter << getReplValues(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getReplValues().getTypes(); + _odsPrinter << ")"; + } + if (getReplOperation()) { + _odsPrinter << ' '; + if (::mlir::Value value = getReplOperation()) + _odsPrinter << value; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::ReplaceOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ResultOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ResultOpGenericAdaptorBase::ResultOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.result", odsAttrs.getContext()); +} + +ResultOpGenericAdaptorBase::ResultOpGenericAdaptorBase(ResultOp op) : ResultOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ResultOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ResultOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr ResultOpGenericAdaptorBase::getIndexAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); + return attr; +} + +uint32_t ResultOpGenericAdaptorBase::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +ResultOpAdaptor::ResultOpAdaptor(ResultOp op) : ResultOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ResultOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitError(loc, "'pdl.result' op ""requires attribute 'index'"); + + if (tblgen_index && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32))))) + return emitError(loc, "'pdl.result' op ""attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair ResultOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ResultOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> ResultOp::getParent() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ResultOp::getParentMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ResultOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ResultOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::ValueType> ResultOp::getVal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::ValueType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ResultOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.index; + auto attr = dict.get("index"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for index in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `index` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ResultOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.index; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("index", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ResultOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.index.getAsOpaquePointer())); +} + +std::optional ResultOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "index") + return prop.index; + return std::nullopt; +} + +void ResultOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "index") { + prop.index = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ResultOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.index) attrs.append("index", prop.index); +} + +::mlir::LogicalResult ResultOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps5(attr, "index", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ResultOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.index))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ResultOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.index); +} + +::mlir::IntegerAttr ResultOp::getIndexAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); +} + +uint32_t ResultOp::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +void ResultOp::setIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexAttrName(), attr); +} + +void ResultOp::setIndex(uint32_t attrValue) { + (*this)->setAttr(getIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void ResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value parent, ::mlir::IntegerAttr index) { + odsState.addOperands(parent); + odsState.getOrAddProperties().index = index; + odsState.addTypes(val); +} + +void ResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parent, ::mlir::IntegerAttr index) { + odsState.addOperands(parent); + odsState.getOrAddProperties().index = index; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value parent, uint32_t index) { + odsState.addOperands(parent); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + odsState.addTypes(val); +} + +void ResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parent, uint32_t index) { + odsState.addOperands(parent); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ResultOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ResultOp::verifyInvariantsImpl() { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitOpError("requires attribute 'index'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps5(*this, tblgen_index, "index"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ResultOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ResultOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr indexAttr; + ::mlir::OpAsmParser::UnresolvedOperand parentRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> parentOperands(parentRawOperands); ::llvm::SMLoc parentOperandsLoc; + (void)parentOperandsLoc; + + if (parser.parseCustomAttributeWithFallback(indexAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (indexAttr) result.getOrAddProperties().index = indexAttr; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + parentOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(parentRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::ValueType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(parentOperands, odsBuildableType1, parentOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ResultOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getIndexAttr()); + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getParent(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("index"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ResultOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::ResultOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ResultsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ResultsOpGenericAdaptorBase::ResultsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.results", odsAttrs.getContext()); +} + +ResultsOpGenericAdaptorBase::ResultsOpGenericAdaptorBase(ResultsOp op) : ResultsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ResultsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ResultsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr ResultsOpGenericAdaptorBase::getIndexAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().index); + return attr; +} + +::std::optional ResultsOpGenericAdaptorBase::getIndex() { + auto attr = getIndexAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +ResultsOpAdaptor::ResultsOpAdaptor(ResultsOp op) : ResultsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ResultsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_index = getProperties().index; (void)tblgen_index; + + if (tblgen_index && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32))))) + return emitError(loc, "'pdl.results' op ""attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute"); + return ::mlir::success(); +} + +std::pair ResultsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ResultsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> ResultsOp::getParent() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ResultsOp::getParentMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ResultsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ResultsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> ResultsOp::getVal() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ResultsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.index; + auto attr = dict.get("index"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for index in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `index` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ResultsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.index; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("index", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ResultsOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.index.getAsOpaquePointer())); +} + +std::optional ResultsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "index") + return prop.index; + return std::nullopt; +} + +void ResultsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "index") { + prop.index = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ResultsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.index) attrs.append("index", prop.index); +} + +::mlir::LogicalResult ResultsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps5(attr, "index", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ResultsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.index))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ResultsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.index); +} + +::mlir::IntegerAttr ResultsOp::getIndexAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().index); +} + +::std::optional ResultsOp::getIndex() { + auto attr = getIndexAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void ResultsOp::setIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexAttrName(), attr); +} + +void ResultsOp::setIndex(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexAttrName()); +} + +::mlir::Attribute ResultsOp::removeIndexAttr() { + auto &attr = getProperties().index; + attr = {}; + return attr; +} + +void ResultsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value parent, /*optional*/::mlir::IntegerAttr index) { + odsState.addOperands(parent); + if (index) { + odsState.getOrAddProperties().index = index; + } + odsState.addTypes(val); +} + +void ResultsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parent, /*optional*/::mlir::IntegerAttr index) { + odsState.addOperands(parent); + if (index) { + odsState.getOrAddProperties().index = index; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ResultsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ResultsOp::verifyInvariantsImpl() { + auto tblgen_index = getProperties().index; (void)tblgen_index; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps5(*this, tblgen_index, "index"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ResultsOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult ResultsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr indexAttr; + ::mlir::OpAsmParser::UnresolvedOperand parentRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> parentOperands(parentRawOperands); ::llvm::SMLoc parentOperandsLoc; + (void)parentOperandsLoc; + ::mlir::Type valRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes); + + ::mlir::OptionalParseResult parseResultindexAttr = + parser.parseOptionalAttribute(indexAttr, parser.getBuilder().getIntegerType(32)); + if (parseResultindexAttr.has_value() && failed(*parseResultindexAttr)) + return ::mlir::failure(); + if (parseResultindexAttr.has_value() && succeeded(*parseResultindexAttr)) + if (indexAttr) result.getOrAddProperties().index = indexAttr; + if (indexAttr) { + } + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + parentOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(parentRawOperands[0])) + return ::mlir::failure(); + { + auto odsResult = parseResultsValueType(parser, indexAttr, valRawTypes[0]); + if (odsResult) return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + result.addTypes(valTypes); + if (parser.resolveOperands(parentOperands, odsBuildableType0, parentOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ResultsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getIndexAttr()) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getIndexAttr()); + } + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getParent(); + _odsPrinter << ' '; + printResultsValueType(_odsPrinter, *this, getIndexAttr(), getVal().getType()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("index"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ResultsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::ResultsOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::RewriteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RewriteOpGenericAdaptorBase::RewriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.rewrite", odsAttrs.getContext()); +} + +RewriteOpGenericAdaptorBase::RewriteOpGenericAdaptorBase(RewriteOp op) : RewriteOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RewriteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr RewriteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr RewriteOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::std::optional< ::llvm::StringRef > RewriteOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::Region &RewriteOpGenericAdaptorBase::getBodyRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange RewriteOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +RewriteOpAdaptor::RewriteOpAdaptor(RewriteOp op) : RewriteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RewriteOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_name = getProperties().name; (void)tblgen_name; + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'pdl.rewrite' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair RewriteOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range RewriteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value RewriteOp::getRoot() { + auto operands = getODSOperands(0); + return operands.empty() ? ::mlir::Value{} : ::llvm::cast<::mlir::Value>(*operands.begin()); +} + +::mlir::Operation::operand_range RewriteOp::getExternalArgs() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange RewriteOp::getRootMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange RewriteOp::getExternalArgsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair RewriteOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RewriteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &RewriteOp::getBodyRegion() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult RewriteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute RewriteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RewriteOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.name.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional RewriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "name") + return prop.name; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void RewriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void RewriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.name) attrs.append("name", prop.name); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult RewriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RewriteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.name))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RewriteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.name); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::StringAttr RewriteOp::getNameAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); +} + +::std::optional< ::llvm::StringRef > RewriteOp::getName() { + auto attr = getNameAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +void RewriteOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void RewriteOp::setName(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getNameAttrName()); +} + +::mlir::Attribute RewriteOp::removeNameAttr() { + auto &attr = getProperties().name; + attr = {}; + return attr; +} + +void RewriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value root, /*optional*/::mlir::StringAttr name, ::mlir::ValueRange externalArgs) { + if (root) + odsState.addOperands(root); + odsState.addOperands(externalArgs); + ::llvm::copy(::llvm::ArrayRef({(root ? 1 : 0), static_cast(externalArgs.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (name) { + odsState.getOrAddProperties().name = name; + } + (void)odsState.addRegion(); +} + +void RewriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value root, /*optional*/::mlir::StringAttr name, ::mlir::ValueRange externalArgs) { + if (root) + odsState.addOperands(root); + odsState.addOperands(externalArgs); + ::llvm::copy(::llvm::ArrayRef({(root ? 1 : 0), static_cast(externalArgs.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + if (name) { + odsState.getOrAddProperties().name = name; + } + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RewriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RewriteOp::verifyInvariantsImpl() { + auto tblgen_name = getProperties().name; (void)tblgen_name; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps0(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + if (valueGroup0.size() > 1) { + return emitOpError("operand group starting at #") << index + << " requires 0 or 1 element, but found " << valueGroup0.size(); + } + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_PDLOps1(*this, region, "bodyRegion", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RewriteOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RewriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> rootOperands; + ::llvm::SMLoc rootOperandsLoc; + (void)rootOperandsLoc; + ::mlir::StringAttr nameAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> externalArgsOperands; + ::llvm::SMLoc externalArgsOperandsLoc; + (void)externalArgsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> externalArgsTypes; + std::unique_ptr<::mlir::Region> bodyRegionRegion = std::make_unique<::mlir::Region>(); + + { + rootOperandsLoc = parser.getCurrentLocation(); + ::mlir::OpAsmParser::UnresolvedOperand operand; + ::mlir::OptionalParseResult parseResult = + parser.parseOptionalOperand(operand); + if (parseResult.has_value()) { + if (failed(*parseResult)) + return ::mlir::failure(); + rootOperands.push_back(operand); + } + } + if (!rootOperands.empty()) { + } + if (::mlir::succeeded(parser.parseOptionalKeyword("with"))) { + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + externalArgsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(externalArgsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(externalArgsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + } + + { + auto parseResult = parser.parseOptionalRegion(*bodyRegionRegion); + if (parseResult.has_value() && failed(*parseResult)) + return ::mlir::failure(); + } + if (!bodyRegionRegion->empty()) { + + if (bodyRegionRegion->empty()) bodyRegionRegion->emplaceBlock(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addRegion(std::move(bodyRegionRegion)); +::llvm::copy(::llvm::ArrayRef({static_cast(rootOperands.size()), static_cast(externalArgsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(rootOperands, odsBuildableType0, rootOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(externalArgsOperands, externalArgsTypes, externalArgsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RewriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getRoot()) { + _odsPrinter << ' '; + if (::mlir::Value value = getRoot()) + _odsPrinter << value; + } + if (getNameAttr()) { + _odsPrinter << ' ' << "with"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + if (!getExternalArgs().empty()) { + _odsPrinter << "("; + _odsPrinter << getExternalArgs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getExternalArgs().getTypes(); + _odsPrinter << ")"; + } + } + if (!getBodyRegion().empty()) { + _odsPrinter << ' '; + _odsPrinter.printRegion(getBodyRegion()); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("name"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::RewriteOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::TypeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TypeOpGenericAdaptorBase::TypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.type", odsAttrs.getContext()); +} + +TypeOpGenericAdaptorBase::TypeOpGenericAdaptorBase(TypeOp op) : TypeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TypeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TypeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypeAttr TypeOpGenericAdaptorBase::getConstantTypeAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().constantType); + return attr; +} + +::std::optional<::mlir::Type> TypeOpGenericAdaptorBase::getConstantType() { + auto attr = getConstantTypeAttr(); + return attr ? ::std::optional<::mlir::Type>(::llvm::cast<::mlir::Type>(attr.getValue())) : (::std::nullopt); +} + +} // namespace detail +TypeOpAdaptor::TypeOpAdaptor(TypeOp op) : TypeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TypeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_constantType = getProperties().constantType; (void)tblgen_constantType; + + if (tblgen_constantType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_constantType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_constantType).getValue()))) && ((true)))) + return emitError(loc, "'pdl.type' op ""attribute 'constantType' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair TypeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TypeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair TypeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TypeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::TypeType> TypeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::TypeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult TypeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.constantType; + auto attr = dict.get("constantType"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for constantType in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `constantType` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TypeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.constantType; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("constantType", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TypeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.constantType.getAsOpaquePointer())); +} + +std::optional TypeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "constantType") + return prop.constantType; + return std::nullopt; +} + +void TypeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "constantType") { + prop.constantType = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TypeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.constantType) attrs.append("constantType", prop.constantType); +} + +::mlir::LogicalResult TypeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getConstantTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps6(attr, "constantType", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TypeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.constantType))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TypeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.constantType); +} + +::mlir::TypeAttr TypeOp::getConstantTypeAttr() { + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(getProperties().constantType); +} + +::std::optional<::mlir::Type> TypeOp::getConstantType() { + auto attr = getConstantTypeAttr(); + return attr ? ::std::optional<::mlir::Type>(::llvm::cast<::mlir::Type>(attr.getValue())) : (::std::nullopt); +} + +void TypeOp::setConstantTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getConstantTypeAttrName(), attr); +} + +void TypeOp::setConstantType(::std::optional<::mlir::Type> attrValue) { + if (attrValue) + return (*this)->setAttr(getConstantTypeAttrName(), ::mlir::TypeAttr::get(*attrValue)); + (*this)->removeAttr(getConstantTypeAttrName()); +} + +::mlir::Attribute TypeOp::removeConstantTypeAttr() { + auto &attr = getProperties().constantType; + attr = {}; + return attr; +} + +void TypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::TypeAttr constantType) { + if (constantType) { + odsState.getOrAddProperties().constantType = constantType; + } + odsState.addTypes(result); +} + +void TypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr constantType) { + if (constantType) { + odsState.getOrAddProperties().constantType = constantType; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TypeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TypeOp::verifyInvariantsImpl() { + auto tblgen_constantType = getProperties().constantType; (void)tblgen_constantType; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps6(*this, tblgen_constantType, "constantType"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TypeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TypeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::TypeAttr constantTypeAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (::mlir::succeeded(parser.parseOptionalColon())) { + + if (parser.parseCustomAttributeWithFallback(constantTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (constantTypeAttr) result.getOrAddProperties().constantType = constantTypeAttr; + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::TypeType>(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void TypeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("constantType"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (getConstantTypeAttr()) { + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getConstantTypeAttr()); + } +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::TypeOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::TypesOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +TypesOpGenericAdaptorBase::TypesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl.types", odsAttrs.getContext()); +} + +TypesOpGenericAdaptorBase::TypesOpGenericAdaptorBase(TypesOp op) : TypesOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair TypesOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr TypesOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr TypesOpGenericAdaptorBase::getConstantTypesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().constantTypes); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > TypesOpGenericAdaptorBase::getConstantTypes() { + auto attr = getConstantTypesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +} // namespace detail +TypesOpAdaptor::TypesOpAdaptor(TypesOp op) : TypesOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult TypesOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_constantTypes = getProperties().constantTypes; (void)tblgen_constantTypes; + + if (tblgen_constantTypes && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_constantTypes))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_constantTypes), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))); })))) + return emitError(loc, "'pdl.types' op ""attribute 'constantTypes' failed to satisfy constraint: type array attribute"); + return ::mlir::success(); +} + +std::pair TypesOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range TypesOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair TypesOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range TypesOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> TypesOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult TypesOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.constantTypes; + auto attr = dict.get("constantTypes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for constantTypes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `constantTypes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute TypesOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.constantTypes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("constantTypes", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code TypesOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.constantTypes.getAsOpaquePointer())); +} + +std::optional TypesOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "constantTypes") + return prop.constantTypes; + return std::nullopt; +} + +void TypesOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "constantTypes") { + prop.constantTypes = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void TypesOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.constantTypes) attrs.append("constantTypes", prop.constantTypes); +} + +::mlir::LogicalResult TypesOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getConstantTypesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps7(attr, "constantTypes", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult TypesOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.constantTypes))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void TypesOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.constantTypes); +} + +::mlir::ArrayAttr TypesOp::getConstantTypesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().constantTypes); +} + +::std::optional< ::mlir::ArrayAttr > TypesOp::getConstantTypes() { + auto attr = getConstantTypesAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void TypesOp::setConstantTypesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getConstantTypesAttrName(), attr); +} + +::mlir::Attribute TypesOp::removeConstantTypesAttr() { + auto &attr = getProperties().constantTypes; + attr = {}; + return attr; +} + +void TypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::ArrayAttr constantTypes) { + if (constantTypes) { + odsState.getOrAddProperties().constantTypes = constantTypes; + } + odsState.addTypes(result); +} + +void TypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::ArrayAttr constantTypes) { + if (constantTypes) { + odsState.getOrAddProperties().constantTypes = constantTypes; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void TypesOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult TypesOp::verifyInvariantsImpl() { + auto tblgen_constantTypes = getProperties().constantTypes; (void)tblgen_constantTypes; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLOps7(*this, tblgen_constantTypes, "constantTypes"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult TypesOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult TypesOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::ArrayAttr constantTypesAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (::mlir::succeeded(parser.parseOptionalColon())) { + + if (parser.parseCustomAttributeWithFallback(constantTypesAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (constantTypesAttr) result.getOrAddProperties().constantTypes = constantTypesAttr; + } + ::mlir::Type odsBuildableType0 = ::mlir::pdl::RangeType::get(parser.getBuilder().getType<::mlir::pdl::TypeType>()); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void TypesOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("constantTypes"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + if (getConstantTypesAttr()) { + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getConstantTypesAttr()); + } +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::TypesOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOps.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOps.h new file mode 100644 index 0000000000000000000000000000000000000000..22935827519d38393f64608ef2f397b89b9c682f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOps.h @@ -0,0 +1,30 @@ +//===- PDLOps.h - Pattern Descriptor Language Operations --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the operations for the Pattern Descriptor Language dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_PDL_IR_PDLOPS_H_ +#define MLIR_DIALECT_PDL_IR_PDLOPS_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/PDL/IR/PDLTypes.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +//===----------------------------------------------------------------------===// +// PDL Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/PDL/IR/PDLOps.h.inc" + +#endif // MLIR_DIALECT_PDL_IR_PDLOPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..86d104c6019d2049fd6448a93518b5219ff53982 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOps.h.inc @@ -0,0 +1,2430 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: PDLOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace pdl { +class ApplyNativeConstraintOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class ApplyNativeRewriteOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class AttributeOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class EraseOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class OperandOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class OperandsOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class OperationOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class PatternOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class RangeOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class ReplaceOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class ResultOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class ResultsOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class RewriteOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class TypeOp; +} // namespace pdl +} // namespace mlir +namespace mlir { +namespace pdl { +class TypesOp; +} // namespace pdl +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ApplyNativeConstraintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ApplyNativeConstraintOpGenericAdaptorBase { +public: + struct Properties { + using isNegatedTy = ::mlir::BoolAttr; + isNegatedTy isNegated; + + auto getIsNegated() { + auto &propStorage = this->isNegated; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setIsNegated(const ::mlir::BoolAttr &propValue) { + this->isNegated = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.isNegated == this->isNegated && + rhs.name == this->name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ApplyNativeConstraintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ApplyNativeConstraintOpGenericAdaptorBase(ApplyNativeConstraintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + ::mlir::BoolAttr getIsNegatedAttr(); + bool getIsNegated(); +}; +} // namespace detail +template +class ApplyNativeConstraintOpGenericAdaptor : public detail::ApplyNativeConstraintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ApplyNativeConstraintOpGenericAdaptorBase; +public: + ApplyNativeConstraintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ApplyNativeConstraintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ApplyNativeConstraintOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ApplyNativeConstraintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ApplyNativeConstraintOpAdaptor : public ApplyNativeConstraintOpGenericAdaptor<::mlir::ValueRange> { +public: + using ApplyNativeConstraintOpGenericAdaptor::ApplyNativeConstraintOpGenericAdaptor; + ApplyNativeConstraintOpAdaptor(ApplyNativeConstraintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ApplyNativeConstraintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ApplyNativeConstraintOpAdaptor; + template + using GenericAdaptor = ApplyNativeConstraintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("isNegated"), ::llvm::StringRef("name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsNegatedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsNegatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.apply_native_constraint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + ::mlir::BoolAttr getIsNegatedAttr(); + bool getIsNegated(); + void setNameAttr(::mlir::StringAttr attr); + void setName(::llvm::StringRef attrValue); + void setIsNegatedAttr(::mlir::BoolAttr attr); + void setIsNegated(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr name, ::mlir::ValueRange args, ::mlir::BoolAttr isNegated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::ValueRange args, ::mlir::BoolAttr isNegated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef name, ::mlir::ValueRange args, bool isNegated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::ValueRange args, bool isNegated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::ApplyNativeConstraintOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ApplyNativeRewriteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ApplyNativeRewriteOpGenericAdaptorBase { +public: + struct Properties { + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.name == this->name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ApplyNativeRewriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ApplyNativeRewriteOpGenericAdaptorBase(ApplyNativeRewriteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); +}; +} // namespace detail +template +class ApplyNativeRewriteOpGenericAdaptor : public detail::ApplyNativeRewriteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ApplyNativeRewriteOpGenericAdaptorBase; +public: + ApplyNativeRewriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ApplyNativeRewriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ApplyNativeRewriteOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ApplyNativeRewriteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ApplyNativeRewriteOpAdaptor : public ApplyNativeRewriteOpGenericAdaptor<::mlir::ValueRange> { +public: + using ApplyNativeRewriteOpGenericAdaptor::ApplyNativeRewriteOpGenericAdaptor; + ApplyNativeRewriteOpAdaptor(ApplyNativeRewriteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ApplyNativeRewriteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ApplyNativeRewriteOpAdaptor; + template + using GenericAdaptor = ApplyNativeRewriteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.apply_native_rewrite"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + void setNameAttr(::mlir::StringAttr attr); + void setName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::StringAttr name, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::llvm::StringRef name, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::ApplyNativeRewriteOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::AttributeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AttributeOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::Attribute; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::dyn_cast_or_null<::mlir::Attribute>(propStorage); + } + void setValue(const ::mlir::Attribute &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + AttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + AttributeOpGenericAdaptorBase(AttributeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getValueAttr(); + ::std::optional<::mlir::Attribute> getValue(); +}; +} // namespace detail +template +class AttributeOpGenericAdaptor : public detail::AttributeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AttributeOpGenericAdaptorBase; +public: + AttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AttributeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + AttributeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValueType() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AttributeOpAdaptor : public AttributeOpGenericAdaptor<::mlir::ValueRange> { +public: + using AttributeOpGenericAdaptor::AttributeOpGenericAdaptor; + AttributeOpAdaptor(AttributeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AttributeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AttributeOpAdaptor; + template + using GenericAdaptor = AttributeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.attribute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValueType(); + ::mlir::MutableOperandRange getValueTypeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::AttributeType> getAttr(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::Attribute getValueAttr(); + ::std::optional<::mlir::Attribute> getValue(); + void setValueAttr(::mlir::Attribute attr); + ::mlir::Attribute removeValueAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value type = Value()); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type attr, /*optional*/::mlir::Value valueType, /*optional*/::mlir::Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value valueType, /*optional*/::mlir::Attribute value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::AttributeOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::EraseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EraseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EraseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EraseOpGenericAdaptorBase(EraseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EraseOpGenericAdaptor : public detail::EraseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EraseOpGenericAdaptorBase; +public: + EraseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EraseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EraseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EraseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOpValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EraseOpAdaptor : public EraseOpGenericAdaptor<::mlir::ValueRange> { +public: + using EraseOpGenericAdaptor::EraseOpGenericAdaptor; + EraseOpAdaptor(EraseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EraseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = EraseOpAdaptor; + template + using GenericAdaptor = EraseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.erase"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getOpValue(); + ::mlir::OpOperand &getOpValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value opValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value opValue); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::EraseOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::OperandOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OperandOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OperandOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OperandOpGenericAdaptorBase(OperandOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OperandOpGenericAdaptor : public detail::OperandOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OperandOpGenericAdaptorBase; +public: + OperandOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OperandOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OperandOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OperandOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValueType() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OperandOpAdaptor : public OperandOpGenericAdaptor<::mlir::ValueRange> { +public: + using OperandOpGenericAdaptor::OperandOpGenericAdaptor; + OperandOpAdaptor(OperandOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OperandOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = OperandOpAdaptor; + template + using GenericAdaptor = OperandOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.operand"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValueType(); + ::mlir::MutableOperandRange getValueTypeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::ValueType> getValue(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, /*optional*/::mlir::Value valueType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value valueType); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::OperandOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::OperandsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OperandsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OperandsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OperandsOpGenericAdaptorBase(OperandsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OperandsOpGenericAdaptor : public detail::OperandsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OperandsOpGenericAdaptorBase; +public: + OperandsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OperandsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OperandsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OperandsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValueType() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OperandsOpAdaptor : public OperandsOpGenericAdaptor<::mlir::ValueRange> { +public: + using OperandsOpGenericAdaptor::OperandsOpGenericAdaptor; + OperandsOpAdaptor(OperandsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OperandsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = OperandsOpAdaptor; + template + using GenericAdaptor = OperandsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.operands"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getValueType(); + ::mlir::MutableOperandRange getValueTypeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getValue(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, /*optional*/::mlir::Value valueType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value valueType); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::OperandsOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::OperationOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OperationOpGenericAdaptorBase { +public: + struct Properties { + using attributeValueNamesTy = ::mlir::ArrayAttr; + attributeValueNamesTy attributeValueNames; + + auto getAttributeValueNames() { + auto &propStorage = this->attributeValueNames; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setAttributeValueNames(const ::mlir::ArrayAttr &propValue) { + this->attributeValueNames = propValue; + } + using opNameTy = ::mlir::StringAttr; + opNameTy opName; + + auto getOpName() { + auto &propStorage = this->opName; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setOpName(const ::mlir::StringAttr &propValue) { + this->opName = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.attributeValueNames == this->attributeValueNames && + rhs.opName == this->opName && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + OperationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + OperationOpGenericAdaptorBase(OperationOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getOpNameAttr(); + ::std::optional< ::llvm::StringRef > getOpName(); + ::mlir::ArrayAttr getAttributeValueNamesAttr(); + ::mlir::ArrayAttr getAttributeValueNames(); +}; +} // namespace detail +template +class OperationOpGenericAdaptor : public detail::OperationOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OperationOpGenericAdaptorBase; +public: + OperationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OperationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OperationOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + OperationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperandValues() { + return getODSOperands(0); + } + + RangeT getAttributeValues() { + return getODSOperands(1); + } + + RangeT getTypeValues() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OperationOpAdaptor : public OperationOpGenericAdaptor<::mlir::ValueRange> { +public: + using OperationOpGenericAdaptor::OperationOpGenericAdaptor; + OperationOpAdaptor(OperationOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OperationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OperationOpAdaptor; + template + using GenericAdaptor = OperationOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("attributeValueNames"), ::llvm::StringRef("opName"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAttributeValueNamesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAttributeValueNamesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOpNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOpNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.operation"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperandValues(); + ::mlir::Operation::operand_range getAttributeValues(); + ::mlir::Operation::operand_range getTypeValues(); + ::mlir::MutableOperandRange getOperandValuesMutable(); + ::mlir::MutableOperandRange getAttributeValuesMutable(); + ::mlir::MutableOperandRange getTypeValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getOp(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getOpNameAttr(); + ::std::optional< ::llvm::StringRef > getOpName(); + ::mlir::ArrayAttr getAttributeValueNamesAttr(); + ::mlir::ArrayAttr getAttributeValueNames(); + void setOpNameAttr(::mlir::StringAttr attr); + void setOpName(::std::optional<::llvm::StringRef> attrValue); + void setAttributeValueNamesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOpNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, std::optional name = std::nullopt, ValueRange operandValues = std::nullopt, ArrayRef attrNames = std::nullopt, ValueRange attrValues = std::nullopt, ValueRange resultTypes = std::nullopt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type op, /*optional*/::mlir::StringAttr opName, ::mlir::ValueRange operandValues, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames, ::mlir::ValueRange typeValues); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr opName, ::mlir::ValueRange operandValues, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames, ::mlir::ValueRange typeValues); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Returns true if the operation type referenced supports result type + /// inference. + bool hasTypeInference(); + + /// Returns true if the operation type referenced might support result type + /// inference, i.e. it supports type reference or is currently not + /// registered in the context. Returns false if the root operation name + /// has not been set. + bool mightHaveTypeInference(); +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::OperationOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::PatternOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PatternOpGenericAdaptorBase { +public: + struct Properties { + using benefitTy = ::mlir::IntegerAttr; + benefitTy benefit; + + auto getBenefit() { + auto &propStorage = this->benefit; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setBenefit(const ::mlir::IntegerAttr &propValue) { + this->benefit = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.benefit == this->benefit && + rhs.sym_name == this->sym_name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + PatternOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + PatternOpGenericAdaptorBase(PatternOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBenefitAttr(); + uint16_t getBenefit(); + ::mlir::StringAttr getSymNameAttr(); + ::std::optional< ::llvm::StringRef > getSymName(); + ::mlir::Region &getBodyRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class PatternOpGenericAdaptor : public detail::PatternOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PatternOpGenericAdaptorBase; +public: + PatternOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PatternOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PatternOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + PatternOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PatternOpAdaptor : public PatternOpGenericAdaptor<::mlir::ValueRange> { +public: + using PatternOpGenericAdaptor::PatternOpGenericAdaptor; + PatternOpAdaptor(PatternOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PatternOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = PatternOpAdaptor; + template + using GenericAdaptor = PatternOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("benefit"), ::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBenefitAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBenefitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.pattern"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBodyRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getBenefitAttr(); + uint16_t getBenefit(); + ::mlir::StringAttr getSymNameAttr(); + ::std::optional< ::llvm::StringRef > getSymName(); + void setBenefitAttr(::mlir::IntegerAttr attr); + void setBenefit(uint16_t attrValue); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSymNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, std::optional benefit = 1, std::optional name = std::nullopt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr benefit, /*optional*/::mlir::StringAttr sym_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr benefit, /*optional*/::mlir::StringAttr sym_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint16_t benefit, /*optional*/::mlir::StringAttr sym_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint16_t benefit, /*optional*/::mlir::StringAttr sym_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static ::llvm::StringRef getDefaultDialect(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + //===------------------------------------------------------------------===// + // SymbolOpInterface Methods + //===------------------------------------------------------------------===// + + /// A PatternOp may optionally define a symbol. + bool isOptionalSymbol() { return true; } + + /// Returns the rewrite operation of this pattern. + RewriteOp getRewriter(); +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::PatternOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::RangeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RangeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RangeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RangeOpGenericAdaptorBase(RangeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RangeOpGenericAdaptor : public detail::RangeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RangeOpGenericAdaptorBase; +public: + RangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RangeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RangeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArguments() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RangeOpAdaptor : public RangeOpGenericAdaptor<::mlir::ValueRange> { +public: + using RangeOpGenericAdaptor::RangeOpGenericAdaptor; + RangeOpAdaptor(RangeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RangeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RangeOpAdaptor; + template + using GenericAdaptor = RangeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.range"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArguments(); + ::mlir::MutableOperandRange getArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange arguments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::RangeOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ReplaceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReplaceOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReplaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReplaceOpGenericAdaptorBase(ReplaceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReplaceOpGenericAdaptor : public detail::ReplaceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReplaceOpGenericAdaptorBase; +public: + ReplaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReplaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReplaceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReplaceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOpValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getReplOperation() { + auto operands = getODSOperands(1); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getReplValues() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReplaceOpAdaptor : public ReplaceOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReplaceOpGenericAdaptor::ReplaceOpGenericAdaptor; + ReplaceOpAdaptor(ReplaceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReplaceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReplaceOpAdaptor; + template + using GenericAdaptor = ReplaceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.replace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getOpValue(); + ::mlir::Value getReplOperation(); + ::mlir::Operation::operand_range getReplValues(); + ::mlir::OpOperand &getOpValueMutable(); + ::mlir::MutableOperandRange getReplOperationMutable(); + ::mlir::MutableOperandRange getReplValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value opValue, /*optional*/::mlir::Value replOperation, ::mlir::ValueRange replValues); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value opValue, /*optional*/::mlir::Value replOperation, ::mlir::ValueRange replValues); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::ReplaceOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ResultOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResultOpGenericAdaptorBase { +public: + struct Properties { + using indexTy = ::mlir::IntegerAttr; + indexTy index; + + auto getIndex() { + auto &propStorage = this->index; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIndex(const ::mlir::IntegerAttr &propValue) { + this->index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.index == this->index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ResultOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ResultOpGenericAdaptorBase(ResultOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); +}; +} // namespace detail +template +class ResultOpGenericAdaptor : public detail::ResultOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResultOpGenericAdaptorBase; +public: + ResultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResultOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ResultOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParent() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResultOpAdaptor : public ResultOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResultOpGenericAdaptor::ResultOpGenericAdaptor; + ResultOpAdaptor(ResultOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResultOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResultOpAdaptor; + template + using GenericAdaptor = ResultOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.result"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getParent(); + ::mlir::OpOperand &getParentMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::ValueType> getVal(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value parent, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parent, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value parent, uint32_t index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parent, uint32_t index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::ResultOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::ResultsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResultsOpGenericAdaptorBase { +public: + struct Properties { + using indexTy = ::mlir::IntegerAttr; + indexTy index; + + auto getIndex() { + auto &propStorage = this->index; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndex(const ::mlir::IntegerAttr &propValue) { + this->index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.index == this->index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ResultsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ResultsOpGenericAdaptorBase(ResultsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + ::std::optional getIndex(); +}; +} // namespace detail +template +class ResultsOpGenericAdaptor : public detail::ResultsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResultsOpGenericAdaptorBase; +public: + ResultsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResultsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResultsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ResultsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParent() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResultsOpAdaptor : public ResultsOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResultsOpGenericAdaptor::ResultsOpGenericAdaptor; + ResultsOpAdaptor(ResultsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResultsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResultsOpAdaptor; + template + using GenericAdaptor = ResultsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.results"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getParent(); + ::mlir::OpOperand &getParentMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getVal(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIndexAttr(); + ::std::optional getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(::std::optional attrValue); + ::mlir::Attribute removeIndexAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value parent, /*optional*/::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parent, /*optional*/::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::ResultsOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::RewriteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RewriteOpGenericAdaptorBase { +public: + struct Properties { + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.name == this->name && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RewriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RewriteOpGenericAdaptorBase(RewriteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + ::mlir::Region &getBodyRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class RewriteOpGenericAdaptor : public detail::RewriteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RewriteOpGenericAdaptorBase; +public: + RewriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RewriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RewriteOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RewriteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRoot() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getExternalArgs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RewriteOpAdaptor : public RewriteOpGenericAdaptor<::mlir::ValueRange> { +public: + using RewriteOpGenericAdaptor::RewriteOpGenericAdaptor; + RewriteOpAdaptor(RewriteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RewriteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::NoTerminator, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RewriteOpAdaptor; + template + using GenericAdaptor = RewriteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.rewrite"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getRoot(); + ::mlir::Operation::operand_range getExternalArgs(); + ::mlir::MutableOperandRange getRootMutable(); + ::mlir::MutableOperandRange getExternalArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBodyRegion(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getNameAttr(); + ::std::optional< ::llvm::StringRef > getName(); + void setNameAttr(::mlir::StringAttr attr); + void setName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value root, /*optional*/::mlir::StringAttr name, ::mlir::ValueRange externalArgs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value root, /*optional*/::mlir::StringAttr name, ::mlir::ValueRange externalArgs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static ::llvm::StringRef getDefaultDialect(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::RewriteOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::TypeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TypeOpGenericAdaptorBase { +public: + struct Properties { + using constantTypeTy = ::mlir::TypeAttr; + constantTypeTy constantType; + + auto getConstantType() { + auto &propStorage = this->constantType; + return ::llvm::dyn_cast_or_null<::mlir::TypeAttr>(propStorage); + } + void setConstantType(const ::mlir::TypeAttr &propValue) { + this->constantType = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.constantType == this->constantType && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TypeOpGenericAdaptorBase(TypeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getConstantTypeAttr(); + ::std::optional<::mlir::Type> getConstantType(); +}; +} // namespace detail +template +class TypeOpGenericAdaptor : public detail::TypeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TypeOpGenericAdaptorBase; +public: + TypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TypeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TypeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TypeOpAdaptor : public TypeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TypeOpGenericAdaptor::TypeOpGenericAdaptor; + TypeOpAdaptor(TypeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TypeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TypeOpAdaptor; + template + using GenericAdaptor = TypeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("constantType")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConstantTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConstantTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.type"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::TypeType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypeAttr getConstantTypeAttr(); + ::std::optional<::mlir::Type> getConstantType(); + void setConstantTypeAttr(::mlir::TypeAttr attr); + void setConstantType(::std::optional<::mlir::Type> attrValue); + ::mlir::Attribute removeConstantTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::TypeAttr constantType); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::TypeAttr constantType); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::TypeOp) + +namespace mlir { +namespace pdl { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl::TypesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TypesOpGenericAdaptorBase { +public: + struct Properties { + using constantTypesTy = ::mlir::ArrayAttr; + constantTypesTy constantTypes; + + auto getConstantTypes() { + auto &propStorage = this->constantTypes; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setConstantTypes(const ::mlir::ArrayAttr &propValue) { + this->constantTypes = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.constantTypes == this->constantTypes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TypesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TypesOpGenericAdaptorBase(TypesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getConstantTypesAttr(); + ::std::optional< ::mlir::ArrayAttr > getConstantTypes(); +}; +} // namespace detail +template +class TypesOpGenericAdaptor : public detail::TypesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TypesOpGenericAdaptorBase; +public: + TypesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TypesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TypesOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TypesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TypesOpAdaptor : public TypesOpGenericAdaptor<::mlir::ValueRange> { +public: + using TypesOpGenericAdaptor::TypesOpGenericAdaptor; + TypesOpAdaptor(TypesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TypesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TypesOpAdaptor; + template + using GenericAdaptor = TypesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("constantTypes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConstantTypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConstantTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl.types"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getConstantTypesAttr(); + ::std::optional< ::mlir::ArrayAttr > getConstantTypes(); + void setConstantTypesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeConstantTypesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::ArrayAttr constantTypes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::ArrayAttr constantTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::TypesOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..801a034a36c32a16910bb4cf70f5d98fae03a6d6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: PDLOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::PDLDialect) +namespace mlir { +namespace pdl { + +PDLDialect::PDLDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +PDLDialect::~PDLDialect() = default; + +} // namespace pdl +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..bb998211c7f783cf0af7343e38b543489d57a0aa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsDialect.h.inc @@ -0,0 +1,35 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: PDLOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace pdl { + +class PDLDialect : public ::mlir::Dialect { + explicit PDLDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~PDLDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("pdl"); + } + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; + + void registerTypes(); + }; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::PDLDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsTypes.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsTypes.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..6565d5fe6e5bdb22a34dc302a85cce3ab1bee094 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsTypes.cpp.inc @@ -0,0 +1,165 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_LIST +#undef GET_TYPEDEF_LIST + +::mlir::pdl::AttributeType, +::mlir::pdl::OperationType, +::mlir::pdl::RangeType, +::mlir::pdl::TypeType, +::mlir::pdl::ValueType + +#endif // GET_TYPEDEF_LIST + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + +static ::mlir::OptionalParseResult generatedTypeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type &value) { + return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) + .Case(::mlir::pdl::AttributeType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::pdl::AttributeType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::pdl::OperationType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::pdl::OperationType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::pdl::RangeType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::pdl::RangeType::parse(parser); + return ::mlir::success(!!value); + }) + .Case(::mlir::pdl::TypeType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::pdl::TypeType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Case(::mlir::pdl::ValueType::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { + value = ::mlir::pdl::ValueType::get(parser.getContext()); + return ::mlir::success(!!value); + }) + .Default([&](llvm::StringRef keyword, llvm::SMLoc) { + *mnemonic = keyword; + return std::nullopt; + }); +} + +static ::mlir::LogicalResult generatedTypePrinter(::mlir::Type def, ::mlir::AsmPrinter &printer) { + return ::llvm::TypeSwitch<::mlir::Type, ::mlir::LogicalResult>(def) .Case<::mlir::pdl::AttributeType>([&](auto t) { + printer << ::mlir::pdl::AttributeType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::pdl::OperationType>([&](auto t) { + printer << ::mlir::pdl::OperationType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::pdl::RangeType>([&](auto t) { + printer << ::mlir::pdl::RangeType::getMnemonic(); +t.print(printer); + return ::mlir::success(); + }) + .Case<::mlir::pdl::TypeType>([&](auto t) { + printer << ::mlir::pdl::TypeType::getMnemonic(); + return ::mlir::success(); + }) + .Case<::mlir::pdl::ValueType>([&](auto t) { + printer << ::mlir::pdl::ValueType::getMnemonic(); + return ::mlir::success(); + }) + .Default([](auto) { return ::mlir::failure(); }); +} + +namespace mlir { +namespace pdl { +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::AttributeType) +namespace mlir { +namespace pdl { +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::OperationType) +namespace mlir { +namespace pdl { +namespace detail { +struct RangeTypeStorage : public ::mlir::TypeStorage { + using KeyTy = std::tuple; + RangeTypeStorage(Type elementType) : elementType(std::move(elementType)) {} + + KeyTy getAsKey() const { + return KeyTy(elementType); + } + + bool operator==(const KeyTy &tblgenKey) const { + return (elementType == std::get<0>(tblgenKey)); + } + + static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { + return ::llvm::hash_combine(std::get<0>(tblgenKey)); + } + + static RangeTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey) { + auto elementType = std::move(std::get<0>(tblgenKey)); + return new (allocator.allocate()) RangeTypeStorage(std::move(elementType)); + } + + Type elementType; +}; +} // namespace detail +RangeType RangeType::get(Type elementType) { + return Base::get(elementType.getContext(), elementType); +} + +RangeType RangeType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType) { + return Base::getChecked(emitError, elementType.getContext(), elementType); +} + +Type RangeType::getElementType() const { + return getImpl()->elementType; +} + +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::RangeType) +namespace mlir { +namespace pdl { +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::TypeType) +namespace mlir { +namespace pdl { +} // namespace pdl +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl::ValueType) +namespace mlir { +namespace pdl { + +/// Parse a type registered to this dialect. +::mlir::Type PDLDialect::parseType(::mlir::DialectAsmParser &parser) const { + ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); + ::llvm::StringRef mnemonic; + ::mlir::Type genType; + auto parseResult = generatedTypeParser(parser, &mnemonic, genType); + if (parseResult.has_value()) + return genType; + + parser.emitError(typeLoc) << "unknown type `" + << mnemonic << "` in dialect `" << getNamespace() << "`"; + return {}; +} +/// Print a type registered to this dialect. +void PDLDialect::printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &printer) const { + if (::mlir::succeeded(generatedTypePrinter(type, printer))) + return; + +} +} // namespace pdl +} // namespace mlir + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsTypes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsTypes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..fe749b2242720fdc819d759532e73c4df8866236 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLOpsTypes.h.inc @@ -0,0 +1,83 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace pdl { +class AttributeType; +class OperationType; +class RangeType; +class TypeType; +class ValueType; +class AttributeType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"attribute"}; + } + +}; +class OperationType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"operation"}; + } + +}; +namespace detail { +struct RangeTypeStorage; +} // namespace detail +class RangeType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + using Base::getChecked; + static RangeType get(Type elementType); + static RangeType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType); + static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Type elementType); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"range"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + Type getElementType() const; +}; +class TypeType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"type"}; + } + +}; +class ValueType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"value"}; + } + +}; +} // namespace pdl +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::AttributeType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::OperationType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::RangeType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::TypeType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl::ValueType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLTypes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..a342dcc6233f506fb403fed0c4dbae15936b4f34 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDL/IR/PDLTypes.h @@ -0,0 +1,42 @@ +//===- PDLTypes.h - Pattern Descriptor Language Types -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the types for the Pattern Descriptor Language dialect. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_PDL_IR_PDLTYPES_H_ +#define MLIR_DIALECT_PDL_IR_PDLTYPES_H_ + +#include "mlir/IR/Types.h" + +//===----------------------------------------------------------------------===// +// PDL Dialect Types +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace pdl { +/// This class represents the base class of all PDL types. +class PDLType : public Type { +public: + using Type::Type; + + static bool classof(Type type); +}; + +/// If the given type is a range, return its element type, otherwise return +/// the type itself. +Type getRangeElementTypeOrSelf(Type type); + +} // namespace pdl +} // namespace mlir + +#define GET_TYPEDEF_CLASSES +#include "mlir/Dialect/PDL/IR/PDLOpsTypes.h.inc" + +#endif // MLIR_DIALECT_PDL_IR_PDLTYPES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterp.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterp.h new file mode 100644 index 0000000000000000000000000000000000000000..2ae67ac2e7e95f8dd43f91e18945db5443315610 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterp.h @@ -0,0 +1,38 @@ +//===- PDLInterp.h - PDL Interpreter dialect --------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares the interpreter dialect for the PDL pattern descriptor +// language. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_PDLINTERP_IR_PDLINTERP_H_ +#define MLIR_DIALECT_PDLINTERP_IR_PDLINTERP_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/Dialect/PDL/IR/PDL.h" +#include "mlir/Dialect/PDL/IR/PDLTypes.h" +#include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/FunctionInterfaces.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +//===----------------------------------------------------------------------===// +// PDLInterp Dialect +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.h.inc" + +//===----------------------------------------------------------------------===// +// PDLInterp Dialect Operations +//===----------------------------------------------------------------------===// + +#define GET_OP_CLASSES +#include "mlir/Dialect/PDLInterp/IR/PDLInterpOps.h.inc" + +#endif // MLIR_DIALECT_PDLINTERP_IR_PDLINTERP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..d3bfcd8f20a41094ad21cfd13109666ebd239543 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.cpp.inc @@ -0,0 +1,11859 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: PDLInterpOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::pdl_interp::ApplyConstraintOp, +::mlir::pdl_interp::ApplyRewriteOp, +::mlir::pdl_interp::AreEqualOp, +::mlir::pdl_interp::BranchOp, +::mlir::pdl_interp::CheckAttributeOp, +::mlir::pdl_interp::CheckOperandCountOp, +::mlir::pdl_interp::CheckOperationNameOp, +::mlir::pdl_interp::CheckResultCountOp, +::mlir::pdl_interp::CheckTypeOp, +::mlir::pdl_interp::CheckTypesOp, +::mlir::pdl_interp::ContinueOp, +::mlir::pdl_interp::CreateAttributeOp, +::mlir::pdl_interp::CreateOperationOp, +::mlir::pdl_interp::CreateRangeOp, +::mlir::pdl_interp::CreateTypeOp, +::mlir::pdl_interp::CreateTypesOp, +::mlir::pdl_interp::EraseOp, +::mlir::pdl_interp::ExtractOp, +::mlir::pdl_interp::FinalizeOp, +::mlir::pdl_interp::ForEachOp, +::mlir::pdl_interp::FuncOp, +::mlir::pdl_interp::GetAttributeOp, +::mlir::pdl_interp::GetAttributeTypeOp, +::mlir::pdl_interp::GetDefiningOpOp, +::mlir::pdl_interp::GetOperandOp, +::mlir::pdl_interp::GetOperandsOp, +::mlir::pdl_interp::GetResultOp, +::mlir::pdl_interp::GetResultsOp, +::mlir::pdl_interp::GetUsersOp, +::mlir::pdl_interp::GetValueTypeOp, +::mlir::pdl_interp::IsNotNullOp, +::mlir::pdl_interp::RecordMatchOp, +::mlir::pdl_interp::ReplaceOp, +::mlir::pdl_interp::SwitchAttributeOp, +::mlir::pdl_interp::SwitchOperandCountOp, +::mlir::pdl_interp::SwitchOperationNameOp, +::mlir::pdl_interp::SwitchResultCountOp, +::mlir::pdl_interp::SwitchTypeOp, +::mlir::pdl_interp::SwitchTypesOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace pdl_interp { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::PDLType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be pdl type, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::AttributeType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be PDL handle to an `mlir::Attribute`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps2( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::OperationType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be PDL handle to an `mlir::Operation *`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps3( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::TypeType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be PDL handle to an `mlir::Type`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps4( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::TypeType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be range of PDL handle to an `mlir::Type` values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps5( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::ValueType>(type))) || (((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::ValueType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType())))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be single element or range of PDL handle for an `mlir::Value`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps6( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::TypeType>(type))) || (((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::TypeType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType())))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be single element or range of PDL handle to an `mlir::Type`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps7( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::RangeType>(type))) && (((::llvm::isa<::mlir::pdl::TypeType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType()))) || ((::llvm::isa<::mlir::pdl::ValueType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType())))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be range of PDL handle to an `mlir::Type` or PDL handle for an `mlir::Value` values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps8( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::PDLType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be range of pdl type values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps9( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((::llvm::isa<::mlir::pdl::ValueType>(type)))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be PDL handle for an `mlir::Value`, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_PDLInterpOps10( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::OperationType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be range of PDL handle to an `mlir::Operation *` values, but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps0( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::StringAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps0( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps0(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps1( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: bool attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps1( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps1(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps2( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((true))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps2( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps2(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps3( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative())))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps3( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps3(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps4( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: unit attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps4( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps4(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps5( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: any type attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps5( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps5(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps6( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: type array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps6( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps6(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps7( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: string array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps7( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps7(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps8( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: type attribute of function type"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps8( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps8(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps9( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: Array of dictionary attributes"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps9( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps9(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps10( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: symbol reference attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps10( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps10(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps11( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(16)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative())))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 16-bit signless integer attribute whose value is non-negative"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps11( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps11(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps12( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !((::llvm::isa<::mlir::ArrayAttr>(attr)))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps12( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps12(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps13( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32))))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: 32-bit signless integer elements attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps13( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps13(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps14( + ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))); }))); })))) + return emitError() << "attribute '" << attrName + << "' failed to satisfy constraint: type-array array attribute"; + return ::mlir::success(); +} +static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_PDLInterpOps14( + ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) { + return __mlir_ods_local_attr_constraint_PDLInterpOps14(attr, attrName, [op]() { + return op->emitOpError(); + }); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_PDLInterpOps0( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((true))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: any region"; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_region_constraint_PDLInterpOps1( + ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName, + unsigned regionIndex) { + if (!((::llvm::hasNItemsOrMore(region, 1)))) { + return op->emitOpError("region #") << regionIndex + << (regionName.empty() ? " " : " ('" + regionName + "') ") + << "failed to verify constraint: region with at least 1 blocks"; + } + return ::mlir::success(); +} +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ApplyConstraintOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ApplyConstraintOpGenericAdaptorBase::ApplyConstraintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.apply_constraint", odsAttrs.getContext()); +} + +ApplyConstraintOpGenericAdaptorBase::ApplyConstraintOpGenericAdaptorBase(ApplyConstraintOp op) : ApplyConstraintOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ApplyConstraintOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ApplyConstraintOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr ApplyConstraintOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::llvm::StringRef ApplyConstraintOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr ApplyConstraintOpGenericAdaptorBase::getIsNegatedAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().isNegated); + return attr; +} + +bool ApplyConstraintOpGenericAdaptorBase::getIsNegated() { + auto attr = getIsNegatedAttr(); + return attr.getValue(); +} + +} // namespace detail +ApplyConstraintOpAdaptor::ApplyConstraintOpAdaptor(ApplyConstraintOp op) : ApplyConstraintOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ApplyConstraintOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_isNegated = getProperties().isNegated; (void)tblgen_isNegated; + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitError(loc, "'pdl_interp.apply_constraint' op ""requires attribute 'name'"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'pdl_interp.apply_constraint' op ""attribute 'name' failed to satisfy constraint: string attribute"); + + if (tblgen_isNegated && !((::llvm::isa<::mlir::BoolAttr>(tblgen_isNegated)))) + return emitError(loc, "'pdl_interp.apply_constraint' op ""attribute 'isNegated' failed to satisfy constraint: bool attribute"); + return ::mlir::success(); +} + +std::pair ApplyConstraintOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ApplyConstraintOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ApplyConstraintOp::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange ApplyConstraintOp::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ApplyConstraintOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ApplyConstraintOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *ApplyConstraintOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *ApplyConstraintOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult ApplyConstraintOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.isNegated; + auto attr = dict.get("isNegated"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for isNegated in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `isNegated` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ApplyConstraintOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.isNegated; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("isNegated", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ApplyConstraintOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.isNegated.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer())); +} + +std::optional ApplyConstraintOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "isNegated") + return prop.isNegated; + + if (name == "name") + return prop.name; + return std::nullopt; +} + +void ApplyConstraintOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "isNegated") { + prop.isNegated = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ApplyConstraintOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.isNegated) attrs.append("isNegated", prop.isNegated); + + if (prop.name) attrs.append("name", prop.name); +} + +::mlir::LogicalResult ApplyConstraintOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIsNegatedAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps1(attr, "isNegated", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ApplyConstraintOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.isNegated))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ApplyConstraintOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.isNegated); + writer.writeAttribute(prop.name); +} + +::mlir::StringAttr ApplyConstraintOp::getNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().name); +} + +::llvm::StringRef ApplyConstraintOp::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +::mlir::BoolAttr ApplyConstraintOp::getIsNegatedAttr() { + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().isNegated); +} + +bool ApplyConstraintOp::getIsNegated() { + auto attr = getIsNegatedAttr(); + return attr.getValue(); +} + +void ApplyConstraintOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void ApplyConstraintOp::setName(::llvm::StringRef attrValue) { + (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void ApplyConstraintOp::setIsNegatedAttr(::mlir::BoolAttr attr) { + (*this)->setAttr(getIsNegatedAttrName(), attr); +} + +void ApplyConstraintOp::setIsNegated(bool attrValue) { + (*this)->setAttr(getIsNegatedAttrName(), ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue)); +} + +void ApplyConstraintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr name, ::mlir::ValueRange args, ::mlir::BoolAttr isNegated, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = name; + if (isNegated) { + odsState.getOrAddProperties().isNegated = isNegated; + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void ApplyConstraintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::ValueRange args, ::mlir::BoolAttr isNegated, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = name; + if (isNegated) { + odsState.getOrAddProperties().isNegated = isNegated; + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ApplyConstraintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef name, ::mlir::ValueRange args, bool isNegated, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.getOrAddProperties().isNegated = odsBuilder.getBoolAttr(isNegated); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void ApplyConstraintOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::ValueRange args, bool isNegated, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.getOrAddProperties().isNegated = odsBuilder.getBoolAttr(isNegated); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ApplyConstraintOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +void ApplyConstraintOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) { + ::mlir::Builder odsBuilder(opName.getContext()); + if (!properties.isNegated) + properties.isNegated = odsBuilder.getBoolAttr(false); +} + +::mlir::LogicalResult ApplyConstraintOp::verifyInvariantsImpl() { + auto tblgen_isNegated = getProperties().isNegated; (void)tblgen_isNegated; + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitOpError("requires attribute 'name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(*this, tblgen_name, "name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps1(*this, tblgen_isNegated, "isNegated"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult ApplyConstraintOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ApplyConstraintOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr nameAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> argsTypes; + ::llvm::SmallVector<::mlir::Block *, 2> fullSuccessors; + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(argsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + } + } + } + result.addSuccessors(fullSuccessors); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ApplyConstraintOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + _odsPrinter << "("; + _odsPrinter << getArgs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getArgs().getTypes(); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("name"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getIsNegatedAttr(); + if(attr && (attr == odsBuilder.getBoolAttr(false))) + elidedAttrs.push_back("isNegated"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + ::llvm::interleaveComma(getOperation()->getSuccessors(), _odsPrinter); +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ApplyConstraintOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ApplyRewriteOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ApplyRewriteOpGenericAdaptorBase::ApplyRewriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.apply_rewrite", odsAttrs.getContext()); +} + +ApplyRewriteOpGenericAdaptorBase::ApplyRewriteOpGenericAdaptorBase(ApplyRewriteOp op) : ApplyRewriteOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ApplyRewriteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ApplyRewriteOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr ApplyRewriteOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::llvm::StringRef ApplyRewriteOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +} // namespace detail +ApplyRewriteOpAdaptor::ApplyRewriteOpAdaptor(ApplyRewriteOp op) : ApplyRewriteOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ApplyRewriteOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitError(loc, "'pdl_interp.apply_rewrite' op ""requires attribute 'name'"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'pdl_interp.apply_rewrite' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair ApplyRewriteOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ApplyRewriteOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range ApplyRewriteOp::getArgs() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange ApplyRewriteOp::getArgsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ApplyRewriteOp::getODSResultIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumResults() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::result_range ApplyRewriteOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::result_range ApplyRewriteOp::getResults() { + return getODSResults(0); +} + +::mlir::LogicalResult ApplyRewriteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ApplyRewriteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ApplyRewriteOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.name.getAsOpaquePointer())); +} + +std::optional ApplyRewriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "name") + return prop.name; + return std::nullopt; +} + +void ApplyRewriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ApplyRewriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.name) attrs.append("name", prop.name); +} + +::mlir::LogicalResult ApplyRewriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ApplyRewriteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ApplyRewriteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.name); +} + +::mlir::StringAttr ApplyRewriteOp::getNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().name); +} + +::llvm::StringRef ApplyRewriteOp::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +void ApplyRewriteOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void ApplyRewriteOp::setName(::llvm::StringRef attrValue) { + (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void ApplyRewriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::StringAttr name, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = name; + odsState.addTypes(results); +} + +void ApplyRewriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::llvm::StringRef name, ::mlir::ValueRange args) { + odsState.addOperands(args); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.addTypes(results); +} + +void ApplyRewriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ApplyRewriteOp::verifyInvariantsImpl() { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitOpError("requires attribute 'name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ApplyRewriteOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ApplyRewriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr nameAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argsOperands; + ::llvm::SMLoc argsOperandsLoc; + (void)argsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> argsTypes; + ::llvm::SmallVector<::mlir::Type, 1> resultsTypes; + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + argsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(argsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + if (::mlir::succeeded(parser.parseOptionalColon())) { + + if (parser.parseTypeList(resultsTypes)) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + result.addTypes(resultsTypes); + if (parser.resolveOperands(argsOperands, argsTypes, argsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ApplyRewriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + if (!getArgs().empty()) { + _odsPrinter << "("; + _odsPrinter << getArgs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getArgs().getTypes(); + _odsPrinter << ")"; + } + if (!getResults().empty()) { + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getResults().getTypes(); + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("name"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ApplyRewriteOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::AreEqualOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +AreEqualOpGenericAdaptorBase::AreEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.are_equal", odsAttrs.getContext()); +} + +AreEqualOpGenericAdaptorBase::AreEqualOpGenericAdaptorBase(AreEqualOp op) : AreEqualOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair AreEqualOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr AreEqualOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +AreEqualOpAdaptor::AreEqualOpAdaptor(AreEqualOp op) : AreEqualOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult AreEqualOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair AreEqualOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range AreEqualOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> AreEqualOp::getLhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSOperands(0).begin()); +} + +::mlir::TypedValue<::mlir::pdl::PDLType> AreEqualOp::getRhs() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSOperands(1).begin()); +} + +::mlir::OpOperand &AreEqualOp::getLhsMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::OpOperand &AreEqualOp::getRhsMutable() { + auto range = getODSOperandIndexAndLength(1); + return getOperation()->getOpOperand(range.first); +} + +std::pair AreEqualOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range AreEqualOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *AreEqualOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *AreEqualOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +void AreEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void AreEqualOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(lhs); + odsState.addOperands(rhs); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void AreEqualOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 2u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult AreEqualOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult AreEqualOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult AreEqualOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands; + ::mlir::Type lhsRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes); + ::llvm::SmallVector<::mlir::Block *, 2> fullSuccessors; + ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(allOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::pdl::PDLType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + lhsRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + } + } + } + result.addSuccessors(fullSuccessors); + if (parser.resolveOperands(allOperands, ::llvm::concat(::llvm::ArrayRef<::mlir::Type>(lhsTypes), ::llvm::ArrayRef<::mlir::Type>(lhsTypes[0])), allOperandLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void AreEqualOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getOperation()->getOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getLhs().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::pdl::PDLType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + ::llvm::interleaveComma(getOperation()->getSuccessors(), _odsPrinter); +} + +void AreEqualOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::AreEqualOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::BranchOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +BranchOpGenericAdaptorBase::BranchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.branch", odsAttrs.getContext()); +} + +BranchOpGenericAdaptorBase::BranchOpGenericAdaptorBase(BranchOp op) : BranchOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair BranchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr BranchOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +BranchOpAdaptor::BranchOpAdaptor(BranchOp op) : BranchOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult BranchOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair BranchOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range BranchOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair BranchOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range BranchOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *BranchOp::getDest() { + return (*this)->getSuccessor(0); +} + +void BranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Block *dest) { + odsState.addSuccessors(dest); +} + +void BranchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Block *dest) { + odsState.addSuccessors(dest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void BranchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult BranchOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult BranchOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult BranchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Block *destSuccessor = nullptr; + + if (parser.parseSuccessor(destSuccessor)) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addSuccessors(destSuccessor); + return ::mlir::success(); +} + +void BranchOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getDest(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void BranchOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::BranchOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckAttributeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CheckAttributeOpGenericAdaptorBase::CheckAttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.check_attribute", odsAttrs.getContext()); +} + +CheckAttributeOpGenericAdaptorBase::CheckAttributeOpGenericAdaptorBase(CheckAttributeOp op) : CheckAttributeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CheckAttributeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CheckAttributeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Attribute CheckAttributeOpGenericAdaptorBase::getConstantValueAttr() { + auto attr = ::llvm::cast<::mlir::Attribute>(getProperties().constantValue); + return attr; +} + +::mlir::Attribute CheckAttributeOpGenericAdaptorBase::getConstantValue() { + auto attr = getConstantValueAttr(); + return attr; +} + +} // namespace detail +CheckAttributeOpAdaptor::CheckAttributeOpAdaptor(CheckAttributeOp op) : CheckAttributeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CheckAttributeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_constantValue = getProperties().constantValue; (void)tblgen_constantValue; + if (!tblgen_constantValue) return emitError(loc, "'pdl_interp.check_attribute' op ""requires attribute 'constantValue'"); + + if (tblgen_constantValue && !((true))) + return emitError(loc, "'pdl_interp.check_attribute' op ""attribute 'constantValue' failed to satisfy constraint: any attribute"); + return ::mlir::success(); +} + +std::pair CheckAttributeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CheckAttributeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::AttributeType> CheckAttributeOp::getAttribute() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::AttributeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CheckAttributeOp::getAttributeMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CheckAttributeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CheckAttributeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *CheckAttributeOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *CheckAttributeOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult CheckAttributeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.constantValue; + auto attr = dict.get("constantValue"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for constantValue in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `constantValue` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CheckAttributeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.constantValue; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("constantValue", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CheckAttributeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.constantValue.getAsOpaquePointer())); +} + +std::optional CheckAttributeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "constantValue") + return prop.constantValue; + return std::nullopt; +} + +void CheckAttributeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "constantValue") { + prop.constantValue = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CheckAttributeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.constantValue) attrs.append("constantValue", prop.constantValue); +} + +::mlir::LogicalResult CheckAttributeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getConstantValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps2(attr, "constantValue", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckAttributeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.constantValue))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckAttributeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.constantValue); +} + +::mlir::Attribute CheckAttributeOp::getConstantValueAttr() { + return ::llvm::cast<::mlir::Attribute>(getProperties().constantValue); +} + +::mlir::Attribute CheckAttributeOp::getConstantValue() { + auto attr = getConstantValueAttr(); + return attr; +} + +void CheckAttributeOp::setConstantValueAttr(::mlir::Attribute attr) { + (*this)->setAttr(getConstantValueAttrName(), attr); +} + +void CheckAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value attribute, ::mlir::Attribute constantValue, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(attribute); + odsState.getOrAddProperties().constantValue = constantValue; + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value attribute, ::mlir::Attribute constantValue, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(attribute); + odsState.getOrAddProperties().constantValue = constantValue; + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckAttributeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CheckAttributeOp::verifyInvariantsImpl() { + auto tblgen_constantValue = getProperties().constantValue; (void)tblgen_constantValue; + if (!tblgen_constantValue) return emitOpError("requires attribute 'constantValue'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps2(*this, tblgen_constantValue, "constantValue"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckAttributeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CheckAttributeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand attributeRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> attributeOperands(attributeRawOperands); ::llvm::SMLoc attributeOperandsLoc; + (void)attributeOperandsLoc; + ::mlir::Attribute constantValueAttr; + ::llvm::SmallVector<::mlir::Block *, 2> fullSuccessors; + + attributeOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(attributeRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("is")) + return ::mlir::failure(); + + if (parser.parseAttribute(constantValueAttr, ::mlir::Type{})) + return ::mlir::failure(); + if (constantValueAttr) result.getOrAddProperties().constantValue = constantValueAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + } + } + } + result.addSuccessors(fullSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::AttributeType>(); + if (parser.resolveOperands(attributeOperands, odsBuildableType0, attributeOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckAttributeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAttribute(); + _odsPrinter << ' ' << "is"; + _odsPrinter << ' '; + _odsPrinter.printAttribute(getConstantValueAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("constantValue"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + ::llvm::interleaveComma(getOperation()->getSuccessors(), _odsPrinter); +} + +void CheckAttributeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckAttributeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckOperandCountOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CheckOperandCountOpGenericAdaptorBase::CheckOperandCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.check_operand_count", odsAttrs.getContext()); +} + +CheckOperandCountOpGenericAdaptorBase::CheckOperandCountOpGenericAdaptorBase(CheckOperandCountOp op) : CheckOperandCountOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CheckOperandCountOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CheckOperandCountOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr CheckOperandCountOpGenericAdaptorBase::getCountAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().count); + return attr; +} + +uint32_t CheckOperandCountOpGenericAdaptorBase::getCount() { + auto attr = getCountAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr CheckOperandCountOpGenericAdaptorBase::getCompareAtLeastAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().compareAtLeast); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool CheckOperandCountOpGenericAdaptorBase::getCompareAtLeast() { + auto attr = getCompareAtLeastAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +CheckOperandCountOpAdaptor::CheckOperandCountOpAdaptor(CheckOperandCountOp op) : CheckOperandCountOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CheckOperandCountOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_compareAtLeast = getProperties().compareAtLeast; (void)tblgen_compareAtLeast; + auto tblgen_count = getProperties().count; (void)tblgen_count; + if (!tblgen_count) return emitError(loc, "'pdl_interp.check_operand_count' op ""requires attribute 'count'"); + + if (tblgen_count && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_count))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_count).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_count).getValue().isNegative())))) + return emitError(loc, "'pdl_interp.check_operand_count' op ""attribute 'count' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"); + + if (tblgen_compareAtLeast && !((::llvm::isa<::mlir::UnitAttr>(tblgen_compareAtLeast)))) + return emitError(loc, "'pdl_interp.check_operand_count' op ""attribute 'compareAtLeast' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair CheckOperandCountOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CheckOperandCountOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> CheckOperandCountOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CheckOperandCountOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CheckOperandCountOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CheckOperandCountOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *CheckOperandCountOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *CheckOperandCountOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult CheckOperandCountOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.compareAtLeast; + auto attr = dict.get("compareAtLeast"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for compareAtLeast in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `compareAtLeast` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.count; + auto attr = dict.get("count"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for count in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `count` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CheckOperandCountOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.compareAtLeast; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("compareAtLeast", + propStorage)); + } + + { + const auto &propStorage = prop.count; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("count", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CheckOperandCountOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.compareAtLeast.getAsOpaquePointer()), + llvm::hash_value(prop.count.getAsOpaquePointer())); +} + +std::optional CheckOperandCountOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "compareAtLeast") + return prop.compareAtLeast; + + if (name == "count") + return prop.count; + return std::nullopt; +} + +void CheckOperandCountOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "compareAtLeast") { + prop.compareAtLeast = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "count") { + prop.count = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CheckOperandCountOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.compareAtLeast) attrs.append("compareAtLeast", prop.compareAtLeast); + + if (prop.count) attrs.append("count", prop.count); +} + +::mlir::LogicalResult CheckOperandCountOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCompareAtLeastAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps4(attr, "compareAtLeast", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCountAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(attr, "count", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckOperandCountOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.compareAtLeast))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.count))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckOperandCountOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.compareAtLeast); + writer.writeAttribute(prop.count); +} + +::mlir::IntegerAttr CheckOperandCountOp::getCountAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().count); +} + +uint32_t CheckOperandCountOp::getCount() { + auto attr = getCountAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr CheckOperandCountOp::getCompareAtLeastAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().compareAtLeast); +} + +bool CheckOperandCountOp::getCompareAtLeast() { + auto attr = getCompareAtLeastAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void CheckOperandCountOp::setCountAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getCountAttrName(), attr); +} + +void CheckOperandCountOp::setCount(uint32_t attrValue) { + (*this)->setAttr(getCountAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void CheckOperandCountOp::setCompareAtLeastAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getCompareAtLeastAttrName(), attr); +} + +void CheckOperandCountOp::setCompareAtLeast(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getCompareAtLeastAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getCompareAtLeastAttrName()); +} + +::mlir::Attribute CheckOperandCountOp::removeCompareAtLeastAttr() { + auto &attr = getProperties().compareAtLeast; + attr = {}; + return attr; +} + +void CheckOperandCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::IntegerAttr count, /*optional*/::mlir::UnitAttr compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().count = count; + if (compareAtLeast) { + odsState.getOrAddProperties().compareAtLeast = compareAtLeast; + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckOperandCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::IntegerAttr count, /*optional*/::mlir::UnitAttr compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().count = count; + if (compareAtLeast) { + odsState.getOrAddProperties().compareAtLeast = compareAtLeast; + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckOperandCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, uint32_t count, /*optional*/bool compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().count = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), count); + if (compareAtLeast) { + odsState.getOrAddProperties().compareAtLeast = ((compareAtLeast) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckOperandCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, uint32_t count, /*optional*/bool compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().count = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), count); + if (compareAtLeast) { + odsState.getOrAddProperties().compareAtLeast = ((compareAtLeast) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckOperandCountOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CheckOperandCountOp::verifyInvariantsImpl() { + auto tblgen_compareAtLeast = getProperties().compareAtLeast; (void)tblgen_compareAtLeast; + auto tblgen_count = getProperties().count; (void)tblgen_count; + if (!tblgen_count) return emitOpError("requires attribute 'count'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(*this, tblgen_count, "count"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps4(*this, tblgen_compareAtLeast, "compareAtLeast"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckOperandCountOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CheckOperandCountOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + ::mlir::IntegerAttr countAttr; + ::llvm::SmallVector<::mlir::Block *, 2> fullSuccessors; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("is")) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("at_least"))) { + result.getOrAddProperties().compareAtLeast = parser.getBuilder().getUnitAttr(); } + + if (parser.parseCustomAttributeWithFallback(countAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (countAttr) result.getOrAddProperties().count = countAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + } + } + } + result.addSuccessors(fullSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckOperandCountOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + _odsPrinter << ' ' << "is"; + if (getCompareAtLeastAttr()) { + _odsPrinter << ' ' << "at_least"; + } + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getCountAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("compareAtLeast"); + elidedAttrs.push_back("count"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getCompareAtLeastAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("compareAtLeast"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + ::llvm::interleaveComma(getOperation()->getSuccessors(), _odsPrinter); +} + +void CheckOperandCountOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckOperandCountOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckOperationNameOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CheckOperationNameOpGenericAdaptorBase::CheckOperationNameOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.check_operation_name", odsAttrs.getContext()); +} + +CheckOperationNameOpGenericAdaptorBase::CheckOperationNameOpGenericAdaptorBase(CheckOperationNameOp op) : CheckOperationNameOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CheckOperationNameOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CheckOperationNameOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr CheckOperationNameOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::llvm::StringRef CheckOperationNameOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +} // namespace detail +CheckOperationNameOpAdaptor::CheckOperationNameOpAdaptor(CheckOperationNameOp op) : CheckOperationNameOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CheckOperationNameOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitError(loc, "'pdl_interp.check_operation_name' op ""requires attribute 'name'"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'pdl_interp.check_operation_name' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair CheckOperationNameOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CheckOperationNameOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> CheckOperationNameOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CheckOperationNameOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CheckOperationNameOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CheckOperationNameOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *CheckOperationNameOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *CheckOperationNameOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult CheckOperationNameOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CheckOperationNameOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CheckOperationNameOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.name.getAsOpaquePointer())); +} + +std::optional CheckOperationNameOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "name") + return prop.name; + return std::nullopt; +} + +void CheckOperationNameOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CheckOperationNameOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.name) attrs.append("name", prop.name); +} + +::mlir::LogicalResult CheckOperationNameOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckOperationNameOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckOperationNameOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.name); +} + +::mlir::StringAttr CheckOperationNameOp::getNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().name); +} + +::llvm::StringRef CheckOperationNameOp::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +void CheckOperationNameOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void CheckOperationNameOp::setName(::llvm::StringRef attrValue) { + (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void CheckOperationNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::StringAttr name, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().name = name; + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckOperationNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::StringAttr name, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().name = name; + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckOperationNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::llvm::StringRef name, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckOperationNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::llvm::StringRef name, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckOperationNameOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CheckOperationNameOp::verifyInvariantsImpl() { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitOpError("requires attribute 'name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckOperationNameOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CheckOperationNameOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + ::mlir::StringAttr nameAttr; + ::llvm::SmallVector<::mlir::Block *, 2> fullSuccessors; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("is")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + } + } + } + result.addSuccessors(fullSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckOperationNameOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + _odsPrinter << ' ' << "is"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("name"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + ::llvm::interleaveComma(getOperation()->getSuccessors(), _odsPrinter); +} + +void CheckOperationNameOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckOperationNameOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckResultCountOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CheckResultCountOpGenericAdaptorBase::CheckResultCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.check_result_count", odsAttrs.getContext()); +} + +CheckResultCountOpGenericAdaptorBase::CheckResultCountOpGenericAdaptorBase(CheckResultCountOp op) : CheckResultCountOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CheckResultCountOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CheckResultCountOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr CheckResultCountOpGenericAdaptorBase::getCountAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().count); + return attr; +} + +uint32_t CheckResultCountOpGenericAdaptorBase::getCount() { + auto attr = getCountAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr CheckResultCountOpGenericAdaptorBase::getCompareAtLeastAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().compareAtLeast); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool CheckResultCountOpGenericAdaptorBase::getCompareAtLeast() { + auto attr = getCompareAtLeastAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +CheckResultCountOpAdaptor::CheckResultCountOpAdaptor(CheckResultCountOp op) : CheckResultCountOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CheckResultCountOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_compareAtLeast = getProperties().compareAtLeast; (void)tblgen_compareAtLeast; + auto tblgen_count = getProperties().count; (void)tblgen_count; + if (!tblgen_count) return emitError(loc, "'pdl_interp.check_result_count' op ""requires attribute 'count'"); + + if (tblgen_count && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_count))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_count).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_count).getValue().isNegative())))) + return emitError(loc, "'pdl_interp.check_result_count' op ""attribute 'count' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"); + + if (tblgen_compareAtLeast && !((::llvm::isa<::mlir::UnitAttr>(tblgen_compareAtLeast)))) + return emitError(loc, "'pdl_interp.check_result_count' op ""attribute 'compareAtLeast' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair CheckResultCountOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CheckResultCountOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> CheckResultCountOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CheckResultCountOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CheckResultCountOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CheckResultCountOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *CheckResultCountOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *CheckResultCountOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult CheckResultCountOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.compareAtLeast; + auto attr = dict.get("compareAtLeast"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for compareAtLeast in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `compareAtLeast` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.count; + auto attr = dict.get("count"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for count in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `count` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CheckResultCountOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.compareAtLeast; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("compareAtLeast", + propStorage)); + } + + { + const auto &propStorage = prop.count; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("count", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CheckResultCountOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.compareAtLeast.getAsOpaquePointer()), + llvm::hash_value(prop.count.getAsOpaquePointer())); +} + +std::optional CheckResultCountOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "compareAtLeast") + return prop.compareAtLeast; + + if (name == "count") + return prop.count; + return std::nullopt; +} + +void CheckResultCountOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "compareAtLeast") { + prop.compareAtLeast = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "count") { + prop.count = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CheckResultCountOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.compareAtLeast) attrs.append("compareAtLeast", prop.compareAtLeast); + + if (prop.count) attrs.append("count", prop.count); +} + +::mlir::LogicalResult CheckResultCountOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCompareAtLeastAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps4(attr, "compareAtLeast", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getCountAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(attr, "count", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckResultCountOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.compareAtLeast))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.count))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckResultCountOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.compareAtLeast); + writer.writeAttribute(prop.count); +} + +::mlir::IntegerAttr CheckResultCountOp::getCountAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().count); +} + +uint32_t CheckResultCountOp::getCount() { + auto attr = getCountAttr(); + return attr.getValue().getZExtValue(); +} + +::mlir::UnitAttr CheckResultCountOp::getCompareAtLeastAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().compareAtLeast); +} + +bool CheckResultCountOp::getCompareAtLeast() { + auto attr = getCompareAtLeastAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void CheckResultCountOp::setCountAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getCountAttrName(), attr); +} + +void CheckResultCountOp::setCount(uint32_t attrValue) { + (*this)->setAttr(getCountAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void CheckResultCountOp::setCompareAtLeastAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getCompareAtLeastAttrName(), attr); +} + +void CheckResultCountOp::setCompareAtLeast(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getCompareAtLeastAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getCompareAtLeastAttrName()); +} + +::mlir::Attribute CheckResultCountOp::removeCompareAtLeastAttr() { + auto &attr = getProperties().compareAtLeast; + attr = {}; + return attr; +} + +void CheckResultCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::IntegerAttr count, /*optional*/::mlir::UnitAttr compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().count = count; + if (compareAtLeast) { + odsState.getOrAddProperties().compareAtLeast = compareAtLeast; + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckResultCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::IntegerAttr count, /*optional*/::mlir::UnitAttr compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().count = count; + if (compareAtLeast) { + odsState.getOrAddProperties().compareAtLeast = compareAtLeast; + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckResultCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, uint32_t count, /*optional*/bool compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().count = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), count); + if (compareAtLeast) { + odsState.getOrAddProperties().compareAtLeast = ((compareAtLeast) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckResultCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, uint32_t count, /*optional*/bool compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().count = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), count); + if (compareAtLeast) { + odsState.getOrAddProperties().compareAtLeast = ((compareAtLeast) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckResultCountOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CheckResultCountOp::verifyInvariantsImpl() { + auto tblgen_compareAtLeast = getProperties().compareAtLeast; (void)tblgen_compareAtLeast; + auto tblgen_count = getProperties().count; (void)tblgen_count; + if (!tblgen_count) return emitOpError("requires attribute 'count'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(*this, tblgen_count, "count"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps4(*this, tblgen_compareAtLeast, "compareAtLeast"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckResultCountOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CheckResultCountOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + ::mlir::IntegerAttr countAttr; + ::llvm::SmallVector<::mlir::Block *, 2> fullSuccessors; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("is")) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("at_least"))) { + result.getOrAddProperties().compareAtLeast = parser.getBuilder().getUnitAttr(); } + + if (parser.parseCustomAttributeWithFallback(countAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (countAttr) result.getOrAddProperties().count = countAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + } + } + } + result.addSuccessors(fullSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckResultCountOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + _odsPrinter << ' ' << "is"; + if (getCompareAtLeastAttr()) { + _odsPrinter << ' ' << "at_least"; + } + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getCountAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("compareAtLeast"); + elidedAttrs.push_back("count"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getCompareAtLeastAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("compareAtLeast"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + ::llvm::interleaveComma(getOperation()->getSuccessors(), _odsPrinter); +} + +void CheckResultCountOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckResultCountOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckTypeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CheckTypeOpGenericAdaptorBase::CheckTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.check_type", odsAttrs.getContext()); +} + +CheckTypeOpGenericAdaptorBase::CheckTypeOpGenericAdaptorBase(CheckTypeOp op) : CheckTypeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CheckTypeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CheckTypeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypeAttr CheckTypeOpGenericAdaptorBase::getTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); + return attr; +} + +::mlir::Type CheckTypeOpGenericAdaptorBase::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +CheckTypeOpAdaptor::CheckTypeOpAdaptor(CheckTypeOp op) : CheckTypeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CheckTypeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitError(loc, "'pdl_interp.check_type' op ""requires attribute 'type'"); + + if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true)))) + return emitError(loc, "'pdl_interp.check_type' op ""attribute 'type' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair CheckTypeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CheckTypeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::TypeType> CheckTypeOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::TypeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CheckTypeOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CheckTypeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CheckTypeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *CheckTypeOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *CheckTypeOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult CheckTypeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.type; + auto attr = dict.get("type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CheckTypeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("type", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CheckTypeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.type.getAsOpaquePointer())); +} + +std::optional CheckTypeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "type") + return prop.type; + return std::nullopt; +} + +void CheckTypeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "type") { + prop.type = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CheckTypeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.type) attrs.append("type", prop.type); +} + +::mlir::LogicalResult CheckTypeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps5(attr, "type", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckTypeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.type))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckTypeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.type); +} + +::mlir::TypeAttr CheckTypeOp::getTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); +} + +::mlir::Type CheckTypeOp::getType() { + auto attr = getTypeAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void CheckTypeOp::setTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getTypeAttrName(), attr); +} + +void CheckTypeOp::setType(::mlir::Type attrValue) { + (*this)->setAttr(getTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void CheckTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::TypeAttr type, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(value); + odsState.getOrAddProperties().type = type; + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::TypeAttr type, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(value); + odsState.getOrAddProperties().type = type; + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Type type, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(value); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Type type, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(value); + odsState.getOrAddProperties().type = ::mlir::TypeAttr::get(type); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckTypeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CheckTypeOp::verifyInvariantsImpl() { + auto tblgen_type = getProperties().type; (void)tblgen_type; + if (!tblgen_type) return emitOpError("requires attribute 'type'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps5(*this, tblgen_type, "type"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckTypeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CheckTypeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::TypeAttr typeAttr; + ::llvm::SmallVector<::mlir::Block *, 2> fullSuccessors; + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("is")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (typeAttr) result.getOrAddProperties().type = typeAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + } + } + } + result.addSuccessors(fullSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::TypeType>(); + if (parser.resolveOperands(valueOperands, odsBuildableType0, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckTypeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << "is"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getTypeAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("type"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + ::llvm::interleaveComma(getOperation()->getSuccessors(), _odsPrinter); +} + +void CheckTypeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckTypesOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CheckTypesOpGenericAdaptorBase::CheckTypesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.check_types", odsAttrs.getContext()); +} + +CheckTypesOpGenericAdaptorBase::CheckTypesOpGenericAdaptorBase(CheckTypesOp op) : CheckTypesOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CheckTypesOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CheckTypesOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr CheckTypesOpGenericAdaptorBase::getTypesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().types); + return attr; +} + +::mlir::ArrayAttr CheckTypesOpGenericAdaptorBase::getTypes() { + auto attr = getTypesAttr(); + return attr; +} + +} // namespace detail +CheckTypesOpAdaptor::CheckTypesOpAdaptor(CheckTypesOp op) : CheckTypesOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CheckTypesOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_types = getProperties().types; (void)tblgen_types; + if (!tblgen_types) return emitError(loc, "'pdl_interp.check_types' op ""requires attribute 'types'"); + + if (tblgen_types && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_types))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_types), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))); })))) + return emitError(loc, "'pdl_interp.check_types' op ""attribute 'types' failed to satisfy constraint: type array attribute"); + return ::mlir::success(); +} + +std::pair CheckTypesOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CheckTypesOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> CheckTypesOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &CheckTypesOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair CheckTypesOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CheckTypesOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *CheckTypesOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *CheckTypesOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +::mlir::LogicalResult CheckTypesOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.types; + auto attr = dict.get("types"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for types in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `types` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CheckTypesOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.types; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("types", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CheckTypesOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.types.getAsOpaquePointer())); +} + +std::optional CheckTypesOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "types") + return prop.types; + return std::nullopt; +} + +void CheckTypesOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "types") { + prop.types = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CheckTypesOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.types) attrs.append("types", prop.types); +} + +::mlir::LogicalResult CheckTypesOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getTypesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps6(attr, "types", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckTypesOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.types))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckTypesOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.types); +} + +::mlir::ArrayAttr CheckTypesOp::getTypesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().types); +} + +::mlir::ArrayAttr CheckTypesOp::getTypes() { + auto attr = getTypesAttr(); + return attr; +} + +void CheckTypesOp::setTypesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getTypesAttrName(), attr); +} + +void CheckTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::ArrayAttr types, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(value); + odsState.getOrAddProperties().types = types; + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void CheckTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr types, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(value); + odsState.getOrAddProperties().types = types; + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CheckTypesOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CheckTypesOp::verifyInvariantsImpl() { + auto tblgen_types = getProperties().types; (void)tblgen_types; + if (!tblgen_types) return emitOpError("requires attribute 'types'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps6(*this, tblgen_types, "types"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult CheckTypesOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CheckTypesOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::ArrayAttr typesAttr; + ::llvm::SmallVector<::mlir::Block *, 2> fullSuccessors; + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("are")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(typesAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (typesAttr) result.getOrAddProperties().types = typesAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + } + } + } + result.addSuccessors(fullSuccessors); + ::mlir::Type odsBuildableType0 = ::mlir::pdl::RangeType::get(parser.getBuilder().getType<::mlir::pdl::TypeType>()); + if (parser.resolveOperands(valueOperands, odsBuildableType0, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CheckTypesOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << "are"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getTypesAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("types"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + ::llvm::interleaveComma(getOperation()->getSuccessors(), _odsPrinter); +} + +void CheckTypesOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckTypesOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ContinueOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ContinueOpGenericAdaptorBase::ContinueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.continue", odsAttrs.getContext()); +} + +ContinueOpGenericAdaptorBase::ContinueOpGenericAdaptorBase(ContinueOp op) : ContinueOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ContinueOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ContinueOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ContinueOpAdaptor::ContinueOpAdaptor(ContinueOp op) : ContinueOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ContinueOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ContinueOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ContinueOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair ContinueOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ContinueOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ContinueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void ContinueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ContinueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ContinueOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult ContinueOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ContinueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void ContinueOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ContinueOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ContinueOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateAttributeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateAttributeOpGenericAdaptorBase::CreateAttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.create_attribute", odsAttrs.getContext()); +} + +CreateAttributeOpGenericAdaptorBase::CreateAttributeOpGenericAdaptorBase(CreateAttributeOp op) : CreateAttributeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateAttributeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CreateAttributeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Attribute CreateAttributeOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::cast<::mlir::Attribute>(getProperties().value); + return attr; +} + +::mlir::Attribute CreateAttributeOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr; +} + +} // namespace detail +CreateAttributeOpAdaptor::CreateAttributeOpAdaptor(CreateAttributeOp op) : CreateAttributeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateAttributeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitError(loc, "'pdl_interp.create_attribute' op ""requires attribute 'value'"); + + if (tblgen_value && !((true))) + return emitError(loc, "'pdl_interp.create_attribute' op ""attribute 'value' failed to satisfy constraint: any attribute"); + return ::mlir::success(); +} + +std::pair CreateAttributeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CreateAttributeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CreateAttributeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CreateAttributeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::AttributeType> CreateAttributeOp::getAttribute() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::AttributeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CreateAttributeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CreateAttributeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CreateAttributeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional CreateAttributeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void CreateAttributeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CreateAttributeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult CreateAttributeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps2(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateAttributeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateAttributeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.value); +} + +::mlir::Attribute CreateAttributeOp::getValueAttr() { + return ::llvm::cast<::mlir::Attribute>(getProperties().value); +} + +::mlir::Attribute CreateAttributeOp::getValue() { + auto attr = getValueAttr(); + return attr; +} + +void CreateAttributeOp::setValueAttr(::mlir::Attribute attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void CreateAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute value) { + build(odsBuilder, odsState, odsBuilder.getType(), value); + +} + +void CreateAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type attribute, ::mlir::Attribute value) { + odsState.getOrAddProperties().value = value; + odsState.addTypes(attribute); +} + +void CreateAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) { + odsState.getOrAddProperties().value = value; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateAttributeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateAttributeOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitOpError("requires attribute 'value'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps2(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateAttributeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateAttributeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::Attribute valueAttr; + + if (parser.parseAttribute(valueAttr, ::mlir::Type{})) + return ::mlir::failure(); + if (valueAttr) result.getOrAddProperties().value = valueAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::AttributeType>(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void CreateAttributeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttribute(getValueAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs); +} + +void CreateAttributeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateAttributeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateOperationOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateOperationOpGenericAdaptorBase::CreateOperationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.create_operation", odsAttrs.getContext()); +} + +CreateOperationOpGenericAdaptorBase::CreateOperationOpGenericAdaptorBase(CreateOperationOp op) : CreateOperationOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateOperationOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr CreateOperationOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr CreateOperationOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::llvm::StringRef CreateOperationOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +::mlir::ArrayAttr CreateOperationOpGenericAdaptorBase::getInputAttributeNamesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().inputAttributeNames); + return attr; +} + +::mlir::ArrayAttr CreateOperationOpGenericAdaptorBase::getInputAttributeNames() { + auto attr = getInputAttributeNamesAttr(); + return attr; +} + +::mlir::UnitAttr CreateOperationOpGenericAdaptorBase::getInferredResultTypesAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inferredResultTypes); + if (!attr) + attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr); + return attr; +} + +bool CreateOperationOpGenericAdaptorBase::getInferredResultTypes() { + auto attr = getInferredResultTypesAttr(); + if (!attr) + return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +} // namespace detail +CreateOperationOpAdaptor::CreateOperationOpAdaptor(CreateOperationOp op) : CreateOperationOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateOperationOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_inferredResultTypes = getProperties().inferredResultTypes; (void)tblgen_inferredResultTypes; + auto tblgen_inputAttributeNames = getProperties().inputAttributeNames; (void)tblgen_inputAttributeNames; + if (!tblgen_inputAttributeNames) return emitError(loc, "'pdl_interp.create_operation' op ""requires attribute 'inputAttributeNames'"); + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitError(loc, "'pdl_interp.create_operation' op ""requires attribute 'name'"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'pdl_interp.create_operation' op ""attribute 'name' failed to satisfy constraint: string attribute"); + + if (tblgen_inputAttributeNames && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_inputAttributeNames))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_inputAttributeNames), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); })))) + return emitError(loc, "'pdl_interp.create_operation' op ""attribute 'inputAttributeNames' failed to satisfy constraint: string array attribute"); + + if (tblgen_inferredResultTypes && !((::llvm::isa<::mlir::UnitAttr>(tblgen_inferredResultTypes)))) + return emitError(loc, "'pdl_interp.create_operation' op ""attribute 'inferredResultTypes' failed to satisfy constraint: unit attribute"); + return ::mlir::success(); +} + +std::pair CreateOperationOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range CreateOperationOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CreateOperationOp::getInputOperands() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range CreateOperationOp::getInputAttributes() { + return getODSOperands(1); +} + +::mlir::Operation::operand_range CreateOperationOp::getInputResultTypes() { + return getODSOperands(2); +} + +::mlir::MutableOperandRange CreateOperationOp::getInputOperandsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CreateOperationOp::getInputAttributesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange CreateOperationOp::getInputResultTypesMutable() { + auto range = getODSOperandIndexAndLength(2); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair CreateOperationOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CreateOperationOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> CreateOperationOp::getResultOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CreateOperationOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.inferredResultTypes; + auto attr = dict.get("inferredResultTypes"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for inferredResultTypes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `inferredResultTypes` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.inputAttributeNames; + auto attr = dict.get("inputAttributeNames"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for inputAttributeNames in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `inputAttributeNames` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute CreateOperationOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.inferredResultTypes; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("inferredResultTypes", + propStorage)); + } + + { + const auto &propStorage = prop.inputAttributeNames; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("inputAttributeNames", + propStorage)); + } + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CreateOperationOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.inferredResultTypes.getAsOpaquePointer()), + llvm::hash_value(prop.inputAttributeNames.getAsOpaquePointer()), + llvm::hash_value(prop.name.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional CreateOperationOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "inferredResultTypes") + return prop.inferredResultTypes; + + if (name == "inputAttributeNames") + return prop.inputAttributeNames; + + if (name == "name") + return prop.name; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void CreateOperationOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "inferredResultTypes") { + prop.inferredResultTypes = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "inputAttributeNames") { + prop.inputAttributeNames = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void CreateOperationOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.inferredResultTypes) attrs.append("inferredResultTypes", prop.inferredResultTypes); + + if (prop.inputAttributeNames) attrs.append("inputAttributeNames", prop.inputAttributeNames); + + if (prop.name) attrs.append("name", prop.name); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult CreateOperationOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getInferredResultTypesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps4(attr, "inferredResultTypes", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getInputAttributeNamesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps7(attr, "inputAttributeNames", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateOperationOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.inferredResultTypes))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.inputAttributeNames))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.name))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void CreateOperationOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.inferredResultTypes); + writer.writeAttribute(prop.inputAttributeNames); + writer.writeAttribute(prop.name); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::StringAttr CreateOperationOp::getNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().name); +} + +::llvm::StringRef CreateOperationOp::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +::mlir::ArrayAttr CreateOperationOp::getInputAttributeNamesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().inputAttributeNames); +} + +::mlir::ArrayAttr CreateOperationOp::getInputAttributeNames() { + auto attr = getInputAttributeNamesAttr(); + return attr; +} + +::mlir::UnitAttr CreateOperationOp::getInferredResultTypesAttr() { + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().inferredResultTypes); +} + +bool CreateOperationOp::getInferredResultTypes() { + auto attr = getInferredResultTypesAttr(); + if (!attr) + return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr; + return attr != nullptr; +} + +void CreateOperationOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void CreateOperationOp::setName(::llvm::StringRef attrValue) { + (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void CreateOperationOp::setInputAttributeNamesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getInputAttributeNamesAttrName(), attr); +} + +void CreateOperationOp::setInferredResultTypesAttr(::mlir::UnitAttr attr) { + (*this)->setAttr(getInferredResultTypesAttrName(), attr); +} + +void CreateOperationOp::setInferredResultTypes(bool attrValue) { + if (attrValue) + return (*this)->setAttr(getInferredResultTypesAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr)); + (*this)->removeAttr(getInferredResultTypesAttrName()); +} + +::mlir::Attribute CreateOperationOp::removeInferredResultTypesAttr() { + auto &attr = getProperties().inferredResultTypes; + attr = {}; + return attr; +} + +void CreateOperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, ValueRange types, bool inferredResultTypes, ValueRange operands, ValueRange attributes, ArrayAttr attributeNames) { + build(odsBuilder, odsState, odsBuilder.getType(), name, + operands, attributes, attributeNames, types, inferredResultTypes); + +} + +void CreateOperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultOp, ::mlir::StringAttr name, ::mlir::ValueRange inputOperands, ::mlir::ValueRange inputAttributes, ::mlir::ArrayAttr inputAttributeNames, ::mlir::ValueRange inputResultTypes, /*optional*/::mlir::UnitAttr inferredResultTypes) { + odsState.addOperands(inputOperands); + odsState.addOperands(inputAttributes); + odsState.addOperands(inputResultTypes); + ::llvm::copy(::llvm::ArrayRef({static_cast(inputOperands.size()), static_cast(inputAttributes.size()), static_cast(inputResultTypes.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().name = name; + odsState.getOrAddProperties().inputAttributeNames = inputAttributeNames; + if (inferredResultTypes) { + odsState.getOrAddProperties().inferredResultTypes = inferredResultTypes; + } + odsState.addTypes(resultOp); +} + +void CreateOperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::ValueRange inputOperands, ::mlir::ValueRange inputAttributes, ::mlir::ArrayAttr inputAttributeNames, ::mlir::ValueRange inputResultTypes, /*optional*/::mlir::UnitAttr inferredResultTypes) { + odsState.addOperands(inputOperands); + odsState.addOperands(inputAttributes); + odsState.addOperands(inputResultTypes); + ::llvm::copy(::llvm::ArrayRef({static_cast(inputOperands.size()), static_cast(inputAttributes.size()), static_cast(inputResultTypes.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().name = name; + odsState.getOrAddProperties().inputAttributeNames = inputAttributeNames; + if (inferredResultTypes) { + odsState.getOrAddProperties().inferredResultTypes = inferredResultTypes; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateOperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultOp, ::llvm::StringRef name, ::mlir::ValueRange inputOperands, ::mlir::ValueRange inputAttributes, ::mlir::ArrayAttr inputAttributeNames, ::mlir::ValueRange inputResultTypes, /*optional*/bool inferredResultTypes) { + odsState.addOperands(inputOperands); + odsState.addOperands(inputAttributes); + odsState.addOperands(inputResultTypes); + ::llvm::copy(::llvm::ArrayRef({static_cast(inputOperands.size()), static_cast(inputAttributes.size()), static_cast(inputResultTypes.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.getOrAddProperties().inputAttributeNames = inputAttributeNames; + if (inferredResultTypes) { + odsState.getOrAddProperties().inferredResultTypes = ((inferredResultTypes) ? odsBuilder.getUnitAttr() : nullptr); + } + odsState.addTypes(resultOp); +} + +void CreateOperationOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::ValueRange inputOperands, ::mlir::ValueRange inputAttributes, ::mlir::ArrayAttr inputAttributeNames, ::mlir::ValueRange inputResultTypes, /*optional*/bool inferredResultTypes) { + odsState.addOperands(inputOperands); + odsState.addOperands(inputAttributes); + odsState.addOperands(inputResultTypes); + ::llvm::copy(::llvm::ArrayRef({static_cast(inputOperands.size()), static_cast(inputAttributes.size()), static_cast(inputResultTypes.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.getOrAddProperties().inputAttributeNames = inputAttributeNames; + if (inferredResultTypes) { + odsState.getOrAddProperties().inferredResultTypes = ((inferredResultTypes) ? odsBuilder.getUnitAttr() : nullptr); + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateOperationOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateOperationOp::verifyInvariantsImpl() { + auto tblgen_inferredResultTypes = getProperties().inferredResultTypes; (void)tblgen_inferredResultTypes; + auto tblgen_inputAttributeNames = getProperties().inputAttributeNames; (void)tblgen_inputAttributeNames; + if (!tblgen_inputAttributeNames) return emitOpError("requires attribute 'inputAttributeNames'"); + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitOpError("requires attribute 'name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(*this, tblgen_name, "name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps7(*this, tblgen_inputAttributeNames, "inputAttributeNames"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps4(*this, tblgen_inferredResultTypes, "inferredResultTypes"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup2 = getODSOperands(2); + + for (auto v : valueGroup2) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps6(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateOperationOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CreateOperationOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr nameAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> inputOperandsOperands; + ::llvm::SMLoc inputOperandsOperandsLoc; + (void)inputOperandsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> inputOperandsTypes; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> inputAttributesOperands; + ::llvm::SMLoc inputAttributesOperandsLoc; + (void)inputAttributesOperandsLoc; + ::mlir::ArrayAttr inputAttributeNamesAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> inputResultTypesOperands; + ::llvm::SMLoc inputResultTypesOperandsLoc; + (void)inputResultTypesOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> inputResultTypesTypes; + ::mlir::UnitAttr inferredResultTypesAttr; + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + inputOperandsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(inputOperandsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(inputOperandsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + inputAttributesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseCreateOperationOpAttributes(parser, inputAttributesOperands, inputAttributeNamesAttr); + if (odsResult) return ::mlir::failure(); + result.getOrAddProperties().inputAttributeNames = inputAttributeNamesAttr; + } + { + inputResultTypesOperandsLoc = parser.getCurrentLocation(); + auto odsResult = parseCreateOperationOpResults(parser, inputResultTypesOperands, inputResultTypesTypes, inferredResultTypesAttr); + if (odsResult) return ::mlir::failure(); + if (inferredResultTypesAttr) + result.getOrAddProperties().inferredResultTypes = inferredResultTypesAttr; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } +::llvm::copy(::llvm::ArrayRef({static_cast(inputOperandsOperands.size()), static_cast(inputAttributesOperands.size()), static_cast(inputResultTypesOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::pdl::AttributeType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(inputOperandsOperands, inputOperandsTypes, inputOperandsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(inputAttributesOperands, odsBuildableType1, inputAttributesOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(inputResultTypesOperands, inputResultTypesTypes, inputResultTypesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateOperationOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + if (!getInputOperands().empty()) { + _odsPrinter << "("; + _odsPrinter << getInputOperands(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getInputOperands().getTypes(); + _odsPrinter << ")"; + } + printCreateOperationOpAttributes(_odsPrinter, *this, getInputAttributes(), getInputAttributeNamesAttr()); + _odsPrinter << ' '; + printCreateOperationOpResults(_odsPrinter, *this, getInputResultTypes(), getInputResultTypes().getTypes(), getInferredResultTypesAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("name"); + elidedAttrs.push_back("inputAttributeNames"); + elidedAttrs.push_back("inferredResultTypes"); + { + ::mlir::Builder odsBuilder(getContext()); + ::mlir::Attribute attr = getInferredResultTypesAttr(); + if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr))) + elidedAttrs.push_back("inferredResultTypes"); + } + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateOperationOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateRangeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateRangeOpGenericAdaptorBase::CreateRangeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.create_range", odsAttrs.getContext()); +} + +CreateRangeOpGenericAdaptorBase::CreateRangeOpGenericAdaptorBase(CreateRangeOp op) : CreateRangeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateRangeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr CreateRangeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +CreateRangeOpAdaptor::CreateRangeOpAdaptor(CreateRangeOp op) : CreateRangeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateRangeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair CreateRangeOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 0) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range CreateRangeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range CreateRangeOp::getArguments() { + return getODSOperands(0); +} + +::mlir::MutableOperandRange CreateRangeOp::getArgumentsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair CreateRangeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CreateRangeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> CreateRangeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSResults(0).begin()); +} + +void CreateRangeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange arguments) { + odsState.addOperands(arguments); + odsState.addTypes(result); +} + +void CreateRangeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateRangeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps7(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateRangeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult CreateRangeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argumentsOperands; + ::llvm::SMLoc argumentsOperandsLoc; + (void)argumentsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> argumentsTypes; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + argumentsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(argumentsOperands)) + return ::mlir::failure(); + if (!argumentsOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(argumentsTypes)) + return ::mlir::failure(); + } + { + auto odsResult = parseRangeType(parser, argumentsTypes, resultRawTypes[0]); + if (odsResult) return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + result.addTypes(resultTypes); + if (parser.resolveOperands(argumentsOperands, argumentsTypes, argumentsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateRangeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (!getArguments().empty()) { + _odsPrinter << ' '; + _odsPrinter << getArguments(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getArguments().getTypes(); + } + _odsPrinter << ' '; + printRangeType(_odsPrinter, *this, getArguments().getTypes(), getResult().getType()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void CreateRangeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateRangeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateTypeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateTypeOpGenericAdaptorBase::CreateTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.create_type", odsAttrs.getContext()); +} + +CreateTypeOpGenericAdaptorBase::CreateTypeOpGenericAdaptorBase(CreateTypeOp op) : CreateTypeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateTypeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CreateTypeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::TypeAttr CreateTypeOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().value); + return attr; +} + +::mlir::Type CreateTypeOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +} // namespace detail +CreateTypeOpAdaptor::CreateTypeOpAdaptor(CreateTypeOp op) : CreateTypeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateTypeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitError(loc, "'pdl_interp.create_type' op ""requires attribute 'value'"); + + if (tblgen_value && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_value))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_value).getValue()))) && ((true)))) + return emitError(loc, "'pdl_interp.create_type' op ""attribute 'value' failed to satisfy constraint: any type attribute"); + return ::mlir::success(); +} + +std::pair CreateTypeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CreateTypeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CreateTypeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CreateTypeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::TypeType> CreateTypeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::TypeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CreateTypeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CreateTypeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CreateTypeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional CreateTypeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void CreateTypeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CreateTypeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult CreateTypeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps5(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateTypeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateTypeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.value); +} + +::mlir::TypeAttr CreateTypeOp::getValueAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().value); +} + +::mlir::Type CreateTypeOp::getValue() { + auto attr = getValueAttr(); + return ::llvm::cast<::mlir::Type>(attr.getValue()); +} + +void CreateTypeOp::setValueAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void CreateTypeOp::setValue(::mlir::Type attrValue) { + (*this)->setAttr(getValueAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void CreateTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeAttr type) { + build(odsBuilder, odsState, odsBuilder.getType(), type); + +} + +void CreateTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::TypeAttr value) { + odsState.getOrAddProperties().value = value; + odsState.addTypes(result); +} + +void CreateTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr value) { + odsState.getOrAddProperties().value = value; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Type value) { + odsState.getOrAddProperties().value = ::mlir::TypeAttr::get(value); + odsState.addTypes(result); +} + +void CreateTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type value) { + odsState.getOrAddProperties().value = ::mlir::TypeAttr::get(value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateTypeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateTypeOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitOpError("requires attribute 'value'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps5(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateTypeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateTypeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::TypeAttr valueAttr; + + if (parser.parseCustomAttributeWithFallback(valueAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (valueAttr) result.getOrAddProperties().value = valueAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::TypeType>(); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void CreateTypeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getValueAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void CreateTypeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateTypesOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +CreateTypesOpGenericAdaptorBase::CreateTypesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.create_types", odsAttrs.getContext()); +} + +CreateTypesOpGenericAdaptorBase::CreateTypesOpGenericAdaptorBase(CreateTypesOp op) : CreateTypesOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair CreateTypesOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr CreateTypesOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr CreateTypesOpGenericAdaptorBase::getValueAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().value); + return attr; +} + +::mlir::ArrayAttr CreateTypesOpGenericAdaptorBase::getValue() { + auto attr = getValueAttr(); + return attr; +} + +} // namespace detail +CreateTypesOpAdaptor::CreateTypesOpAdaptor(CreateTypesOp op) : CreateTypesOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult CreateTypesOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitError(loc, "'pdl_interp.create_types' op ""requires attribute 'value'"); + + if (tblgen_value && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_value))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_value), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))); })))) + return emitError(loc, "'pdl_interp.create_types' op ""attribute 'value' failed to satisfy constraint: type array attribute"); + return ::mlir::success(); +} + +std::pair CreateTypesOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range CreateTypesOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair CreateTypesOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range CreateTypesOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> CreateTypesOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult CreateTypesOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.value; + auto attr = dict.get("value"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for value in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `value` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute CreateTypesOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.value; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("value", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code CreateTypesOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.value.getAsOpaquePointer())); +} + +std::optional CreateTypesOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "value") + return prop.value; + return std::nullopt; +} + +void CreateTypesOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "value") { + prop.value = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void CreateTypesOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.value) attrs.append("value", prop.value); +} + +::mlir::LogicalResult CreateTypesOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getValueAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps6(attr, "value", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateTypesOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.value))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void CreateTypesOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.value); +} + +::mlir::ArrayAttr CreateTypesOp::getValueAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().value); +} + +::mlir::ArrayAttr CreateTypesOp::getValue() { + auto attr = getValueAttr(); + return attr; +} + +void CreateTypesOp::setValueAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getValueAttrName(), attr); +} + +void CreateTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayAttr type) { + build(odsBuilder, odsState, + pdl::RangeType::get(odsBuilder.getType()), type); + +} + +void CreateTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ArrayAttr value) { + odsState.getOrAddProperties().value = value; + odsState.addTypes(result); +} + +void CreateTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr value) { + odsState.getOrAddProperties().value = value; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void CreateTypesOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult CreateTypesOp::verifyInvariantsImpl() { + auto tblgen_value = getProperties().value; (void)tblgen_value; + if (!tblgen_value) return emitOpError("requires attribute 'value'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps6(*this, tblgen_value, "value"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps4(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult CreateTypesOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult CreateTypesOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::ArrayAttr valueAttr; + + if (parser.parseCustomAttributeWithFallback(valueAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (valueAttr) result.getOrAddProperties().value = valueAttr; + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = ::mlir::pdl::RangeType::get(parser.getBuilder().getType<::mlir::pdl::TypeType>()); + result.addTypes(odsBuildableType0); + return ::mlir::success(); +} + +void CreateTypesOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getValueAttr()); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("value"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void CreateTypesOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateTypesOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::EraseOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +EraseOpGenericAdaptorBase::EraseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.erase", odsAttrs.getContext()); +} + +EraseOpGenericAdaptorBase::EraseOpGenericAdaptorBase(EraseOp op) : EraseOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair EraseOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr EraseOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +EraseOpAdaptor::EraseOpAdaptor(EraseOp op) : EraseOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult EraseOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair EraseOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range EraseOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> EraseOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &EraseOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair EraseOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range EraseOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void EraseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp) { + odsState.addOperands(inputOp); +} + +void EraseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp) { + odsState.addOperands(inputOp); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void EraseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult EraseOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult EraseOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult EraseOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void EraseOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::EraseOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ExtractOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ExtractOpGenericAdaptorBase::ExtractOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.extract", odsAttrs.getContext()); +} + +ExtractOpGenericAdaptorBase::ExtractOpGenericAdaptorBase(ExtractOp op) : ExtractOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ExtractOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ExtractOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr ExtractOpGenericAdaptorBase::getIndexAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); + return attr; +} + +uint32_t ExtractOpGenericAdaptorBase::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +ExtractOpAdaptor::ExtractOpAdaptor(ExtractOp op) : ExtractOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ExtractOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitError(loc, "'pdl_interp.extract' op ""requires attribute 'index'"); + + if (tblgen_index && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getValue().isNegative())))) + return emitError(loc, "'pdl_interp.extract' op ""attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"); + return ::mlir::success(); +} + +std::pair ExtractOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ExtractOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> ExtractOp::getRange() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ExtractOp::getRangeMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ExtractOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ExtractOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> ExtractOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult ExtractOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.index; + auto attr = dict.get("index"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for index in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `index` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute ExtractOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.index; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("index", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code ExtractOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.index.getAsOpaquePointer())); +} + +std::optional ExtractOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "index") + return prop.index; + return std::nullopt; +} + +void ExtractOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "index") { + prop.index = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void ExtractOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.index) attrs.append("index", prop.index); +} + +::mlir::LogicalResult ExtractOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(attr, "index", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult ExtractOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.index))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtractOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.index); +} + +::mlir::IntegerAttr ExtractOp::getIndexAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); +} + +uint32_t ExtractOp::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +void ExtractOp::setIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexAttrName(), attr); +} + +void ExtractOp::setIndex(uint32_t attrValue) { + (*this)->setAttr(getIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void ExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value range, unsigned index) { + build(odsBuilder, odsState, + ::llvm::cast(range.getType()).getElementType(), + range, index); + +} + +void ExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value range, ::mlir::IntegerAttr index) { + odsState.addOperands(range); + odsState.getOrAddProperties().index = index; + odsState.addTypes(result); +} + +void ExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value range, ::mlir::IntegerAttr index) { + odsState.addOperands(range); + odsState.getOrAddProperties().index = index; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value range, uint32_t index) { + odsState.addOperands(range); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + odsState.addTypes(result); +} + +void ExtractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value range, uint32_t index) { + odsState.addOperands(range); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ExtractOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ExtractOp::verifyInvariantsImpl() { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitOpError("requires attribute 'index'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(*this, tblgen_index, "index"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(pdl::RangeType::get((*this->getODSResults(0).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that `range` is a PDL range whose element type matches type of `result`"); + return ::mlir::success(); +} + +::mlir::LogicalResult ExtractOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ExtractOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr indexAttr; + ::mlir::OpAsmParser::UnresolvedOperand rangeRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rangeOperands(rangeRawOperands); ::llvm::SMLoc rangeOperandsLoc; + (void)rangeOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + + if (parser.parseCustomAttributeWithFallback(indexAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (indexAttr) result.getOrAddProperties().index = indexAttr; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + rangeOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(rangeRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::pdl::PDLType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + for (::mlir::Type type : resultTypes) { + (void)type; + if (!((::llvm::isa<::mlir::pdl::PDLType>(type)))) { + return parser.emitError(parser.getNameLoc()) << "'result' must be pdl type, but got " << type; + } + } + result.addTypes(resultTypes); + if (parser.resolveOperands(rangeOperands, pdl::RangeType::get(resultTypes[0]), rangeOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ExtractOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getIndexAttr()); + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getRange(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::pdl::PDLType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("index"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void ExtractOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ExtractOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::FinalizeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FinalizeOpGenericAdaptorBase::FinalizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.finalize", odsAttrs.getContext()); +} + +FinalizeOpGenericAdaptorBase::FinalizeOpGenericAdaptorBase(FinalizeOp op) : FinalizeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FinalizeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FinalizeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +FinalizeOpAdaptor::FinalizeOpAdaptor(FinalizeOp op) : FinalizeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FinalizeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair FinalizeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FinalizeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair FinalizeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FinalizeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void FinalizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) { +} + +void FinalizeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) { + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void FinalizeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 0u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult FinalizeOp::verifyInvariantsImpl() { + return ::mlir::success(); +} + +::mlir::LogicalResult FinalizeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult FinalizeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void FinalizeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void FinalizeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::FinalizeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ForEachOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ForEachOpGenericAdaptorBase::ForEachOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.foreach", odsAttrs.getContext()); +} + +ForEachOpGenericAdaptorBase::ForEachOpGenericAdaptorBase(ForEachOp op) : ForEachOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ForEachOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr ForEachOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::Region &ForEachOpGenericAdaptorBase::getRegion() { + return *odsRegions[0]; +} + +::mlir::RegionRange ForEachOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +ForEachOpAdaptor::ForEachOpAdaptor(ForEachOp op) : ForEachOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ForEachOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ForEachOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range ForEachOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> ForEachOp::getValues() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &ForEachOp::getValuesMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair ForEachOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ForEachOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &ForEachOp::getRegion() { + return (*this)->getRegion(0); +} + +::mlir::Block *ForEachOp::getSuccessor() { + return (*this)->getSuccessor(0); +} + +void ForEachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value values, ::mlir::Block *successor) { + odsState.addOperands(values); + (void)odsState.addRegion(); + odsState.addSuccessors(successor); +} + +void ForEachOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Block *successor) { + odsState.addOperands(values); + (void)odsState.addRegion(); + odsState.addSuccessors(successor); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ForEachOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + for (unsigned i = 0; i != 1; ++i) + (void)odsState.addRegion(); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ForEachOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps8(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_PDLInterpOps0(*this, region, "region", index++))) + return ::mlir::failure(); + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult ForEachOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ForEachOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::FuncOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.func", odsAttrs.getContext()); +} + +FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(FuncOp op) : FuncOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair FuncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr FuncOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr FuncOpGenericAdaptorBase::getSymNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); + return attr; +} + +::llvm::StringRef FuncOpGenericAdaptorBase::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FuncOpGenericAdaptorBase::getFunctionTypeAttr() { + auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); + return attr; +} + +::mlir::FunctionType FuncOpGenericAdaptorBase::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::ArrayAttr FuncOpGenericAdaptorBase::getArgAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOpGenericAdaptorBase::getResAttrsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::Region &FuncOpGenericAdaptorBase::getBody() { + return *odsRegions[0]; +} + +::mlir::RegionRange FuncOpGenericAdaptorBase::getRegions() { + return odsRegions; +} + +} // namespace detail +FuncOpAdaptor::FuncOpAdaptor(FuncOp op) : FuncOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult FuncOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitError(loc, "'pdl_interp.func' op ""requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitError(loc, "'pdl_interp.func' op ""requires attribute 'sym_name'"); + + if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name)))) + return emitError(loc, "'pdl_interp.func' op ""attribute 'sym_name' failed to satisfy constraint: string attribute"); + + if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))))) + return emitError(loc, "'pdl_interp.func' op ""attribute 'function_type' failed to satisfy constraint: type attribute of function type"); + + if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'pdl_interp.func' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes"); + + if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); })))) + return emitError(loc, "'pdl_interp.func' op ""attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes"); + return ::mlir::success(); +} + +std::pair FuncOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range FuncOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +std::pair FuncOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range FuncOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Region &FuncOp::getBody() { + return (*this)->getRegion(0); +} + +::mlir::LogicalResult FuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.arg_attrs; + auto attr = dict.get("arg_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for arg_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.function_type; + auto attr = dict.get("function_type"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for function_type in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `function_type` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.res_attrs; + auto attr = dict.get("res_attrs"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for res_attrs in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.sym_name; + auto attr = dict.get("sym_name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for sym_name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `sym_name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute FuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.arg_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("arg_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.function_type; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("function_type", + propStorage)); + } + + { + const auto &propStorage = prop.res_attrs; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("res_attrs", + propStorage)); + } + + { + const auto &propStorage = prop.sym_name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("sym_name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code FuncOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.function_type.getAsOpaquePointer()), + llvm::hash_value(prop.res_attrs.getAsOpaquePointer()), + llvm::hash_value(prop.sym_name.getAsOpaquePointer())); +} + +std::optional FuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "arg_attrs") + return prop.arg_attrs; + + if (name == "function_type") + return prop.function_type; + + if (name == "res_attrs") + return prop.res_attrs; + + if (name == "sym_name") + return prop.sym_name; + return std::nullopt; +} + +void FuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "arg_attrs") { + prop.arg_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "function_type") { + prop.function_type = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "res_attrs") { + prop.res_attrs = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "sym_name") { + prop.sym_name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void FuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs); + + if (prop.function_type) attrs.append("function_type", prop.function_type); + + if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs); + + if (prop.sym_name) attrs.append("sym_name", prop.sym_name); +} + +::mlir::LogicalResult FuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps9(attr, "arg_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps8(attr, "function_type", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps9(attr, "res_attrs", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(attr, "sym_name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.function_type))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.sym_name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void FuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.arg_attrs); + writer.writeAttribute(prop.function_type); + + writer.writeOptionalAttribute(prop.res_attrs); + writer.writeAttribute(prop.sym_name); +} + +::mlir::StringAttr FuncOp::getSymNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); +} + +::llvm::StringRef FuncOp::getSymName() { + auto attr = getSymNameAttr(); + return attr.getValue(); +} + +::mlir::TypeAttr FuncOp::getFunctionTypeAttr() { + return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); +} + +::mlir::FunctionType FuncOp::getFunctionType() { + auto attr = getFunctionTypeAttr(); + return ::llvm::cast<::mlir::FunctionType>(attr.getValue()); +} + +::mlir::ArrayAttr FuncOp::getArgAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); +} + +::std::optional< ::mlir::ArrayAttr > FuncOp::getArgAttrs() { + auto attr = getArgAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::ArrayAttr FuncOp::getResAttrsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); +} + +::std::optional< ::mlir::ArrayAttr > FuncOp::getResAttrs() { + auto attr = getResAttrsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +void FuncOp::setSymNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getSymNameAttrName(), attr); +} + +void FuncOp::setSymName(::llvm::StringRef attrValue) { + (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void FuncOp::setFunctionTypeAttr(::mlir::TypeAttr attr) { + (*this)->setAttr(getFunctionTypeAttrName(), attr); +} + +void FuncOp::setFunctionType(::mlir::FunctionType attrValue) { + (*this)->setAttr(getFunctionTypeAttrName(), ::mlir::TypeAttr::get(attrValue)); +} + +void FuncOp::setArgAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getArgAttrsAttrName(), attr); +} + +void FuncOp::setResAttrsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getResAttrsAttrName(), attr); +} + +::mlir::Attribute FuncOp::removeArgAttrsAttr() { + auto &attr = getProperties().arg_attrs; + attr = {}; + return attr; +} + +::mlir::Attribute FuncOp::removeResAttrsAttr() { + auto &attr = getProperties().res_attrs; + attr = {}; + return attr; +} + +::mlir::LogicalResult FuncOp::verifyInvariantsImpl() { + auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs; + auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type; + if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'"); + auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs; + auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name; + if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(*this, tblgen_sym_name, "sym_name"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps8(*this, tblgen_function_type, "function_type"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps9(*this, tblgen_arg_attrs, "arg_attrs"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps9(*this, tblgen_res_attrs, "res_attrs"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + + for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0))) + if (::mlir::failed(__mlir_ods_local_region_constraint_PDLInterpOps1(*this, region, "body", index++))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult FuncOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::FuncOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetAttributeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetAttributeOpGenericAdaptorBase::GetAttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.get_attribute", odsAttrs.getContext()); +} + +GetAttributeOpGenericAdaptorBase::GetAttributeOpGenericAdaptorBase(GetAttributeOp op) : GetAttributeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetAttributeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetAttributeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::StringAttr GetAttributeOpGenericAdaptorBase::getNameAttr() { + auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().name); + return attr; +} + +::llvm::StringRef GetAttributeOpGenericAdaptorBase::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +} // namespace detail +GetAttributeOpAdaptor::GetAttributeOpAdaptor(GetAttributeOp op) : GetAttributeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetAttributeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitError(loc, "'pdl_interp.get_attribute' op ""requires attribute 'name'"); + + if (tblgen_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_name)))) + return emitError(loc, "'pdl_interp.get_attribute' op ""attribute 'name' failed to satisfy constraint: string attribute"); + return ::mlir::success(); +} + +std::pair GetAttributeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetAttributeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> GetAttributeOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GetAttributeOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetAttributeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetAttributeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::AttributeType> GetAttributeOp::getAttribute() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::AttributeType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GetAttributeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.name; + auto attr = dict.get("name"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for name in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `name` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GetAttributeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.name; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("name", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GetAttributeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.name.getAsOpaquePointer())); +} + +std::optional GetAttributeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "name") + return prop.name; + return std::nullopt; +} + +void GetAttributeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "name") { + prop.name = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GetAttributeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.name) attrs.append("name", prop.name); +} + +::mlir::LogicalResult GetAttributeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getNameAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(attr, "name", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetAttributeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.name))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetAttributeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.name); +} + +::mlir::StringAttr GetAttributeOp::getNameAttr() { + return ::llvm::cast<::mlir::StringAttr>(getProperties().name); +} + +::llvm::StringRef GetAttributeOp::getName() { + auto attr = getNameAttr(); + return attr.getValue(); +} + +void GetAttributeOp::setNameAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getNameAttrName(), attr); +} + +void GetAttributeOp::setName(::llvm::StringRef attrValue) { + (*this)->setAttr(getNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue)); +} + +void GetAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type attribute, ::mlir::Value inputOp, ::mlir::StringAttr name) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().name = name; + odsState.addTypes(attribute); +} + +void GetAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::StringAttr name) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().name = name; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type attribute, ::mlir::Value inputOp, ::llvm::StringRef name) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + odsState.addTypes(attribute); +} + +void GetAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::llvm::StringRef name) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().name = odsBuilder.getStringAttr(name); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetAttributeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetAttributeOp::verifyInvariantsImpl() { + auto tblgen_name = getProperties().name; (void)tblgen_name; + if (!tblgen_name) return emitOpError("requires attribute 'name'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(*this, tblgen_name, "name"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetAttributeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetAttributeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::StringAttr nameAttr; + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + + if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (nameAttr) result.getOrAddProperties().name = nameAttr; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::AttributeType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(inputOpOperands, odsBuildableType1, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetAttributeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getNameAttr()); + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("name"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetAttributeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetAttributeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetAttributeTypeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetAttributeTypeOpGenericAdaptorBase::GetAttributeTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.get_attribute_type", odsAttrs.getContext()); +} + +GetAttributeTypeOpGenericAdaptorBase::GetAttributeTypeOpGenericAdaptorBase(GetAttributeTypeOp op) : GetAttributeTypeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetAttributeTypeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetAttributeTypeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GetAttributeTypeOpAdaptor::GetAttributeTypeOpAdaptor(GetAttributeTypeOp op) : GetAttributeTypeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetAttributeTypeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GetAttributeTypeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetAttributeTypeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::AttributeType> GetAttributeTypeOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::AttributeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GetAttributeTypeOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetAttributeTypeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetAttributeTypeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::TypeType> GetAttributeTypeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::TypeType>>(*getODSResults(0).begin()); +} + +void GetAttributeTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value) { + build(odsBuilder, odsState, odsBuilder.getType(), value); + +} + +void GetAttributeTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value) { + odsState.addOperands(value); + odsState.addTypes(result); +} + +void GetAttributeTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) { + odsState.addOperands(value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetAttributeTypeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetAttributeTypeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps3(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetAttributeTypeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetAttributeTypeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::TypeType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::pdl::AttributeType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(valueOperands, odsBuildableType1, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetAttributeTypeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getValue(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetAttributeTypeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetAttributeTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetDefiningOpOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetDefiningOpOpGenericAdaptorBase::GetDefiningOpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.get_defining_op", odsAttrs.getContext()); +} + +GetDefiningOpOpGenericAdaptorBase::GetDefiningOpOpGenericAdaptorBase(GetDefiningOpOp op) : GetDefiningOpOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetDefiningOpOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetDefiningOpOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GetDefiningOpOpAdaptor::GetDefiningOpOpAdaptor(GetDefiningOpOp op) : GetDefiningOpOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetDefiningOpOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GetDefiningOpOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetDefiningOpOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> GetDefiningOpOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GetDefiningOpOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetDefiningOpOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetDefiningOpOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> GetDefiningOpOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSResults(0).begin()); +} + +void GetDefiningOpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type inputOp, ::mlir::Value value) { + odsState.addOperands(value); + odsState.addTypes(inputOp); +} + +void GetDefiningOpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) { + odsState.addOperands(value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetDefiningOpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetDefiningOpOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetDefiningOpOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetDefiningOpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::pdl::PDLType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetDefiningOpOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::pdl::PDLType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetDefiningOpOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetDefiningOpOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetOperandOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetOperandOpGenericAdaptorBase::GetOperandOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.get_operand", odsAttrs.getContext()); +} + +GetOperandOpGenericAdaptorBase::GetOperandOpGenericAdaptorBase(GetOperandOp op) : GetOperandOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetOperandOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetOperandOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr GetOperandOpGenericAdaptorBase::getIndexAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); + return attr; +} + +uint32_t GetOperandOpGenericAdaptorBase::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +GetOperandOpAdaptor::GetOperandOpAdaptor(GetOperandOp op) : GetOperandOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetOperandOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitError(loc, "'pdl_interp.get_operand' op ""requires attribute 'index'"); + + if (tblgen_index && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getValue().isNegative())))) + return emitError(loc, "'pdl_interp.get_operand' op ""attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"); + return ::mlir::success(); +} + +std::pair GetOperandOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetOperandOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> GetOperandOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GetOperandOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetOperandOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetOperandOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::ValueType> GetOperandOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::ValueType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GetOperandOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.index; + auto attr = dict.get("index"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for index in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `index` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GetOperandOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.index; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("index", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GetOperandOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.index.getAsOpaquePointer())); +} + +std::optional GetOperandOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "index") + return prop.index; + return std::nullopt; +} + +void GetOperandOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "index") { + prop.index = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GetOperandOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.index) attrs.append("index", prop.index); +} + +::mlir::LogicalResult GetOperandOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(attr, "index", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetOperandOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.index))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetOperandOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.index); +} + +::mlir::IntegerAttr GetOperandOp::getIndexAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); +} + +uint32_t GetOperandOp::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +void GetOperandOp::setIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexAttrName(), attr); +} + +void GetOperandOp::setIndex(uint32_t attrValue) { + (*this)->setAttr(getIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void GetOperandOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, ::mlir::IntegerAttr index) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().index = index; + odsState.addTypes(value); +} + +void GetOperandOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::IntegerAttr index) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().index = index; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetOperandOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, uint32_t index) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + odsState.addTypes(value); +} + +void GetOperandOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, uint32_t index) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetOperandOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetOperandOp::verifyInvariantsImpl() { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitOpError("requires attribute 'index'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(*this, tblgen_index, "index"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetOperandOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetOperandOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr indexAttr; + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + + if (parser.parseCustomAttributeWithFallback(indexAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (indexAttr) result.getOrAddProperties().index = indexAttr; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::ValueType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(inputOpOperands, odsBuildableType1, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetOperandOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getIndexAttr()); + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("index"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetOperandOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetOperandOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetOperandsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetOperandsOpGenericAdaptorBase::GetOperandsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.get_operands", odsAttrs.getContext()); +} + +GetOperandsOpGenericAdaptorBase::GetOperandsOpGenericAdaptorBase(GetOperandsOp op) : GetOperandsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetOperandsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetOperandsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr GetOperandsOpGenericAdaptorBase::getIndexAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().index); + return attr; +} + +::std::optional GetOperandsOpGenericAdaptorBase::getIndex() { + auto attr = getIndexAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +GetOperandsOpAdaptor::GetOperandsOpAdaptor(GetOperandsOp op) : GetOperandsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetOperandsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_index = getProperties().index; (void)tblgen_index; + + if (tblgen_index && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getValue().isNegative())))) + return emitError(loc, "'pdl_interp.get_operands' op ""attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"); + return ::mlir::success(); +} + +std::pair GetOperandsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetOperandsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> GetOperandsOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GetOperandsOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetOperandsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetOperandsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> GetOperandsOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GetOperandsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.index; + auto attr = dict.get("index"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for index in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `index` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GetOperandsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.index; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("index", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GetOperandsOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.index.getAsOpaquePointer())); +} + +std::optional GetOperandsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "index") + return prop.index; + return std::nullopt; +} + +void GetOperandsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "index") { + prop.index = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GetOperandsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.index) attrs.append("index", prop.index); +} + +::mlir::LogicalResult GetOperandsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(attr, "index", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetOperandsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.index))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetOperandsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.index); +} + +::mlir::IntegerAttr GetOperandsOp::getIndexAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().index); +} + +::std::optional GetOperandsOp::getIndex() { + auto attr = getIndexAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void GetOperandsOp::setIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexAttrName(), attr); +} + +void GetOperandsOp::setIndex(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexAttrName()); +} + +::mlir::Attribute GetOperandsOp::removeIndexAttr() { + auto &attr = getProperties().index; + attr = {}; + return attr; +} + +void GetOperandsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value inputOp, std::optional index) { + build(odsBuilder, odsState, resultType, inputOp, + index ? odsBuilder.getI32IntegerAttr(*index) : IntegerAttr()); + +} + +void GetOperandsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, /*optional*/::mlir::IntegerAttr index) { + odsState.addOperands(inputOp); + if (index) { + odsState.getOrAddProperties().index = index; + } + odsState.addTypes(value); +} + +void GetOperandsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, /*optional*/::mlir::IntegerAttr index) { + odsState.addOperands(inputOp); + if (index) { + odsState.getOrAddProperties().index = index; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetOperandsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetOperandsOp::verifyInvariantsImpl() { + auto tblgen_index = getProperties().index; (void)tblgen_index; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(*this, tblgen_index, "index"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetOperandsOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetOperandsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr indexAttr; + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + ::mlir::OptionalParseResult parseResultindexAttr = + parser.parseOptionalAttribute(indexAttr, parser.getBuilder().getIntegerType(32)); + if (parseResultindexAttr.has_value() && failed(*parseResultindexAttr)) + return ::mlir::failure(); + if (parseResultindexAttr.has_value() && succeeded(*parseResultindexAttr)) + if (indexAttr) result.getOrAddProperties().index = indexAttr; + if (indexAttr) { + } + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::pdl::PDLType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + result.addTypes(valueTypes); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetOperandsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getIndexAttr()) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getIndexAttr()); + } + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::pdl::PDLType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("index"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetOperandsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetOperandsOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetResultOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetResultOpGenericAdaptorBase::GetResultOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.get_result", odsAttrs.getContext()); +} + +GetResultOpGenericAdaptorBase::GetResultOpGenericAdaptorBase(GetResultOp op) : GetResultOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetResultOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetResultOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr GetResultOpGenericAdaptorBase::getIndexAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); + return attr; +} + +uint32_t GetResultOpGenericAdaptorBase::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +GetResultOpAdaptor::GetResultOpAdaptor(GetResultOp op) : GetResultOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetResultOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitError(loc, "'pdl_interp.get_result' op ""requires attribute 'index'"); + + if (tblgen_index && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getValue().isNegative())))) + return emitError(loc, "'pdl_interp.get_result' op ""attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"); + return ::mlir::success(); +} + +std::pair GetResultOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetResultOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> GetResultOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GetResultOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetResultOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetResultOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::ValueType> GetResultOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::ValueType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GetResultOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.index; + auto attr = dict.get("index"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for index in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `index` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GetResultOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.index; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("index", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GetResultOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.index.getAsOpaquePointer())); +} + +std::optional GetResultOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "index") + return prop.index; + return std::nullopt; +} + +void GetResultOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "index") { + prop.index = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GetResultOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.index) attrs.append("index", prop.index); +} + +::mlir::LogicalResult GetResultOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(attr, "index", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetResultOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.index))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetResultOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.index); +} + +::mlir::IntegerAttr GetResultOp::getIndexAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().index); +} + +uint32_t GetResultOp::getIndex() { + auto attr = getIndexAttr(); + return attr.getValue().getZExtValue(); +} + +void GetResultOp::setIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexAttrName(), attr); +} + +void GetResultOp::setIndex(uint32_t attrValue) { + (*this)->setAttr(getIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue)); +} + +void GetResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, ::mlir::IntegerAttr index) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().index = index; + odsState.addTypes(value); +} + +void GetResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::IntegerAttr index) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().index = index; + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, uint32_t index) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + odsState.addTypes(value); +} + +void GetResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, uint32_t index) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetResultOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetResultOp::verifyInvariantsImpl() { + auto tblgen_index = getProperties().index; (void)tblgen_index; + if (!tblgen_index) return emitOpError("requires attribute 'index'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(*this, tblgen_index, "index"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps9(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetResultOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetResultOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr indexAttr; + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + + if (parser.parseCustomAttributeWithFallback(indexAttr, parser.getBuilder().getIntegerType(32))) { + return ::mlir::failure(); + } + if (indexAttr) result.getOrAddProperties().index = indexAttr; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::ValueType>(); + ::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(inputOpOperands, odsBuildableType1, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetResultOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getIndexAttr()); + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("index"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetResultOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetResultOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetResultsOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetResultsOpGenericAdaptorBase::GetResultsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.get_results", odsAttrs.getContext()); +} + +GetResultsOpGenericAdaptorBase::GetResultsOpGenericAdaptorBase(GetResultsOp op) : GetResultsOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetResultsOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetResultsOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::IntegerAttr GetResultsOpGenericAdaptorBase::getIndexAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().index); + return attr; +} + +::std::optional GetResultsOpGenericAdaptorBase::getIndex() { + auto attr = getIndexAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +} // namespace detail +GetResultsOpAdaptor::GetResultsOpAdaptor(GetResultsOp op) : GetResultsOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetResultsOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_index = getProperties().index; (void)tblgen_index; + + if (tblgen_index && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getValue().isNegative())))) + return emitError(loc, "'pdl_interp.get_results' op ""attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative"); + return ::mlir::success(); +} + +std::pair GetResultsOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetResultsOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> GetResultsOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GetResultsOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetResultsOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetResultsOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> GetResultsOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSResults(0).begin()); +} + +::mlir::LogicalResult GetResultsOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.index; + auto attr = dict.get("index"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for index in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `index` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute GetResultsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.index; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("index", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code GetResultsOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.index.getAsOpaquePointer())); +} + +std::optional GetResultsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "index") + return prop.index; + return std::nullopt; +} + +void GetResultsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "index") { + prop.index = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void GetResultsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.index) attrs.append("index", prop.index); +} + +::mlir::LogicalResult GetResultsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getIndexAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(attr, "index", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetResultsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readOptionalAttribute(prop.index))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetResultsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + + writer.writeOptionalAttribute(prop.index); +} + +::mlir::IntegerAttr GetResultsOp::getIndexAttr() { + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().index); +} + +::std::optional GetResultsOp::getIndex() { + auto attr = getIndexAttr(); + return attr ? ::std::optional(attr.getValue().getZExtValue()) : (::std::nullopt); +} + +void GetResultsOp::setIndexAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getIndexAttrName(), attr); +} + +void GetResultsOp::setIndex(::std::optional attrValue) { + if (attrValue) + return (*this)->setAttr(getIndexAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue)); + (*this)->removeAttr(getIndexAttrName()); +} + +::mlir::Attribute GetResultsOp::removeIndexAttr() { + auto &attr = getProperties().index; + attr = {}; + return attr; +} + +void GetResultsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value inputOp, std::optional index) { + build(odsBuilder, odsState, resultType, inputOp, + index ? odsBuilder.getI32IntegerAttr(*index) : IntegerAttr()); + +} + +void GetResultsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value inputOp) { + build(odsBuilder, odsState, + pdl::RangeType::get(odsBuilder.getType()), inputOp, + IntegerAttr()); + +} + +void GetResultsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, /*optional*/::mlir::IntegerAttr index) { + odsState.addOperands(inputOp); + if (index) { + odsState.getOrAddProperties().index = index; + } + odsState.addTypes(value); +} + +void GetResultsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, /*optional*/::mlir::IntegerAttr index) { + odsState.addOperands(inputOp); + if (index) { + odsState.getOrAddProperties().index = index; + } + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetResultsOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetResultsOp::verifyInvariantsImpl() { + auto tblgen_index = getProperties().index; (void)tblgen_index; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps3(*this, tblgen_index, "index"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps5(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetResultsOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetResultsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::IntegerAttr indexAttr; + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + + ::mlir::OptionalParseResult parseResultindexAttr = + parser.parseOptionalAttribute(indexAttr, parser.getBuilder().getIntegerType(32)); + if (parseResultindexAttr.has_value() && failed(*parseResultindexAttr)) + return ::mlir::failure(); + if (parseResultindexAttr.has_value() && succeeded(*parseResultindexAttr)) + if (indexAttr) result.getOrAddProperties().index = indexAttr; + if (indexAttr) { + } + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::pdl::PDLType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + result.addTypes(valueTypes); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetResultsOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + if (getIndexAttr()) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getIndexAttr()); + } + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::pdl::PDLType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("index"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetResultsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetResultsOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetUsersOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetUsersOpGenericAdaptorBase::GetUsersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.get_users", odsAttrs.getContext()); +} + +GetUsersOpGenericAdaptorBase::GetUsersOpGenericAdaptorBase(GetUsersOp op) : GetUsersOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetUsersOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetUsersOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GetUsersOpAdaptor::GetUsersOpAdaptor(GetUsersOp op) : GetUsersOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetUsersOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GetUsersOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetUsersOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> GetUsersOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GetUsersOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetUsersOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetUsersOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> GetUsersOp::getOperations() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSResults(0).begin()); +} + +void GetUsersOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value) { + build(odsBuilder, odsState, + pdl::RangeType::get(odsBuilder.getType()), + value); + +} + +void GetUsersOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type operations, ::mlir::Value value) { + odsState.addOperands(value); + odsState.addTypes(operations); +} + +void GetUsersOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) { + odsState.addOperands(value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetUsersOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetUsersOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps10(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult GetUsersOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetUsersOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::pdl::PDLType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = ::mlir::pdl::RangeType::get(parser.getBuilder().getType<::mlir::pdl::OperationType>()); + result.addTypes(odsBuildableType0); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetUsersOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::pdl::PDLType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetUsersOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetUsersOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetValueTypeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +GetValueTypeOpGenericAdaptorBase::GetValueTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.get_value_type", odsAttrs.getContext()); +} + +GetValueTypeOpGenericAdaptorBase::GetValueTypeOpGenericAdaptorBase(GetValueTypeOp op) : GetValueTypeOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair GetValueTypeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr GetValueTypeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +GetValueTypeOpAdaptor::GetValueTypeOpAdaptor(GetValueTypeOp op) : GetValueTypeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult GetValueTypeOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair GetValueTypeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range GetValueTypeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> GetValueTypeOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &GetValueTypeOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair GetValueTypeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range GetValueTypeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> GetValueTypeOp::getResult() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSResults(0).begin()); +} + +void GetValueTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value) { + Type valType = value.getType(); + Type typeType = odsBuilder.getType(); + build(odsBuilder, odsState, + ::llvm::isa(valType) ? pdl::RangeType::get(typeType) + : typeType, + value); + +} + +void GetValueTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value) { + odsState.addOperands(value); + odsState.addTypes(result); +} + +void GetValueTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value) { + odsState.addOperands(value); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void GetValueTypeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult GetValueTypeOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps6(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + if (!((std::equal_to<>()(getGetValueTypeOpValueType((*this->getODSResults(0).begin()).getType()), (*this->getODSOperands(0).begin()).getType())))) + return emitOpError("failed to verify that `value` type matches arity of `result`"); + return ::mlir::success(); +} + +::mlir::LogicalResult GetValueTypeOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult GetValueTypeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type resultRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes); + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::pdl::PDLType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + resultRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + for (::mlir::Type type : resultTypes) { + (void)type; + if (!(((::llvm::isa<::mlir::pdl::TypeType>(type))) || (((::llvm::isa<::mlir::pdl::RangeType>(type))) && ((::llvm::isa<::mlir::pdl::TypeType>(::llvm::cast<::mlir::pdl::RangeType>(type).getElementType())))))) { + return parser.emitError(parser.getNameLoc()) << "'result' must be single element or range of PDL handle to an `mlir::Type`, but got " << type; + } + } + result.addTypes(resultTypes); + if (parser.resolveOperands(valueOperands, getGetValueTypeOpValueType(resultTypes[0]), valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void GetValueTypeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getResult().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::pdl::PDLType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +void GetValueTypeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetValueTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::IsNotNullOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +IsNotNullOpGenericAdaptorBase::IsNotNullOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.is_not_null", odsAttrs.getContext()); +} + +IsNotNullOpGenericAdaptorBase::IsNotNullOpGenericAdaptorBase(IsNotNullOp op) : IsNotNullOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair IsNotNullOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr IsNotNullOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +IsNotNullOpAdaptor::IsNotNullOpAdaptor(IsNotNullOp op) : IsNotNullOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult IsNotNullOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair IsNotNullOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range IsNotNullOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::PDLType> IsNotNullOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::PDLType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &IsNotNullOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair IsNotNullOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range IsNotNullOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *IsNotNullOp::getTrueDest() { + return (*this)->getSuccessor(0); +} + +::mlir::Block *IsNotNullOp::getFalseDest() { + return (*this)->getSuccessor(1); +} + +void IsNotNullOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(value); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); +} + +void IsNotNullOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Block *trueDest, ::mlir::Block *falseDest) { + odsState.addOperands(value); + odsState.addSuccessors(trueDest); + odsState.addSuccessors(falseDest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void IsNotNullOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult IsNotNullOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult IsNotNullOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult IsNotNullOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::Type valueRawTypes[1]; + ::llvm::ArrayRef<::mlir::Type> valueTypes(valueRawTypes); + ::llvm::SmallVector<::mlir::Block *, 2> fullSuccessors; + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + { + ::mlir::pdl::PDLType type; + if (parser.parseCustomTypeWithFallback(type)) + return ::mlir::failure(); + valueRawTypes[0] = type; + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + fullSuccessors.emplace_back(succ); + } + } + } + result.addSuccessors(fullSuccessors); + if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void IsNotNullOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + { + auto type = getValue().getType(); + if (auto validType = ::llvm::dyn_cast<::mlir::pdl::PDLType>(type)) + _odsPrinter.printStrippedAttrOrType(validType); + else + _odsPrinter << type; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + ::llvm::interleaveComma(getOperation()->getSuccessors(), _odsPrinter); +} + +void IsNotNullOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::IsNotNullOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::RecordMatchOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +RecordMatchOpGenericAdaptorBase::RecordMatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.record_match", odsAttrs.getContext()); +} + +RecordMatchOpGenericAdaptorBase::RecordMatchOpGenericAdaptorBase(RecordMatchOp op) : RecordMatchOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair RecordMatchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::DictionaryAttr RecordMatchOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::SymbolRefAttr RecordMatchOpGenericAdaptorBase::getRewriterAttr() { + auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().rewriter); + return attr; +} + +::mlir::SymbolRefAttr RecordMatchOpGenericAdaptorBase::getRewriter() { + auto attr = getRewriterAttr(); + return attr; +} + +::mlir::StringAttr RecordMatchOpGenericAdaptorBase::getRootKindAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().rootKind); + return attr; +} + +::std::optional< ::llvm::StringRef > RecordMatchOpGenericAdaptorBase::getRootKind() { + auto attr = getRootKindAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr RecordMatchOpGenericAdaptorBase::getGeneratedOpsAttr() { + auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().generatedOps); + return attr; +} + +::std::optional< ::mlir::ArrayAttr > RecordMatchOpGenericAdaptorBase::getGeneratedOps() { + auto attr = getGeneratedOpsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::IntegerAttr RecordMatchOpGenericAdaptorBase::getBenefitAttr() { + auto attr = ::llvm::cast<::mlir::IntegerAttr>(getProperties().benefit); + return attr; +} + +uint16_t RecordMatchOpGenericAdaptorBase::getBenefit() { + auto attr = getBenefitAttr(); + return attr.getValue().getZExtValue(); +} + +} // namespace detail +RecordMatchOpAdaptor::RecordMatchOpAdaptor(RecordMatchOp op) : RecordMatchOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult RecordMatchOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_benefit = getProperties().benefit; (void)tblgen_benefit; + if (!tblgen_benefit) return emitError(loc, "'pdl_interp.record_match' op ""requires attribute 'benefit'"); + auto tblgen_generatedOps = getProperties().generatedOps; (void)tblgen_generatedOps; + auto tblgen_rewriter = getProperties().rewriter; (void)tblgen_rewriter; + if (!tblgen_rewriter) return emitError(loc, "'pdl_interp.record_match' op ""requires attribute 'rewriter'"); + auto tblgen_rootKind = getProperties().rootKind; (void)tblgen_rootKind; + + if (tblgen_rewriter && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_rewriter)))) + return emitError(loc, "'pdl_interp.record_match' op ""attribute 'rewriter' failed to satisfy constraint: symbol reference attribute"); + + if (tblgen_rootKind && !((::llvm::isa<::mlir::StringAttr>(tblgen_rootKind)))) + return emitError(loc, "'pdl_interp.record_match' op ""attribute 'rootKind' failed to satisfy constraint: string attribute"); + + if (tblgen_generatedOps && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_generatedOps))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_generatedOps), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); })))) + return emitError(loc, "'pdl_interp.record_match' op ""attribute 'generatedOps' failed to satisfy constraint: string array attribute"); + + if (tblgen_benefit && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_benefit))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_benefit).getType().isSignlessInteger(16)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_benefit).getValue().isNegative())))) + return emitError(loc, "'pdl_interp.record_match' op ""attribute 'benefit' failed to satisfy constraint: 16-bit signless integer attribute whose value is non-negative"); + return ::mlir::success(); +} + +std::pair RecordMatchOp::getODSOperandIndexAndLength(unsigned index) { + ::llvm::ArrayRef sizeAttr = getProperties().operandSegmentSizes; + + unsigned start = 0; + for (unsigned i = 0; i < index; ++i) + start += sizeAttr[i]; + return {start, sizeAttr[index]}; +} + +::mlir::Operation::operand_range RecordMatchOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Operation::operand_range RecordMatchOp::getInputs() { + return getODSOperands(0); +} + +::mlir::Operation::operand_range RecordMatchOp::getMatchedOps() { + return getODSOperands(1); +} + +::mlir::MutableOperandRange RecordMatchOp::getInputsMutable() { + auto range = getODSOperandIndexAndLength(0); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +::mlir::MutableOperandRange RecordMatchOp::getMatchedOpsMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)})); + return mutableRange; +} + +std::pair RecordMatchOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range RecordMatchOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *RecordMatchOp::getDest() { + return (*this)->getSuccessor(0); +} + +::mlir::LogicalResult RecordMatchOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.benefit; + auto attr = dict.get("benefit"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for benefit in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `benefit` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.generatedOps; + auto attr = dict.get("generatedOps"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for generatedOps in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `generatedOps` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.rewriter; + auto attr = dict.get("rewriter"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for rewriter in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `rewriter` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + + { + auto &propStorage = prop.rootKind; + auto attr = dict.get("rootKind"); + if (attr || /*isRequired=*/false) { + if (!attr) { + emitError() << "expected key entry for rootKind in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `rootKind` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } +; + { + auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr, + ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + return convertFromAttribute(propStorage, propAttr, emitError);; + }; + auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");; + if (!attr) { + emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::Attribute RecordMatchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.benefit; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("benefit", + propStorage)); + } + + { + const auto &propStorage = prop.generatedOps; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("generatedOps", + propStorage)); + } + + { + const auto &propStorage = prop.rewriter; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("rewriter", + propStorage)); + } + + { + const auto &propStorage = prop.rootKind; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("rootKind", + propStorage)); + } + + { + const auto &propStorage = prop.operandSegmentSizes; + attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", + ::mlir::DenseI32ArrayAttr::get(ctx, propStorage))); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code RecordMatchOp::computePropertiesHash(const Properties &prop) { + auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code { + return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));; + }; + return llvm::hash_combine( + llvm::hash_value(prop.benefit.getAsOpaquePointer()), + llvm::hash_value(prop.generatedOps.getAsOpaquePointer()), + llvm::hash_value(prop.rewriter.getAsOpaquePointer()), + llvm::hash_value(prop.rootKind.getAsOpaquePointer()), + hash_operandSegmentSizes(prop.operandSegmentSizes)); +} + +std::optional RecordMatchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "benefit") + return prop.benefit; + + if (name == "generatedOps") + return prop.generatedOps; + + if (name == "rewriter") + return prop.rewriter; + + if (name == "rootKind") + return prop.rootKind; + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); + return std::nullopt; +} + +void RecordMatchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "benefit") { + prop.benefit = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "generatedOps") { + prop.generatedOps = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "rewriter") { + prop.rewriter = ::llvm::dyn_cast_or_null>(value); + return; + } + + if (name == "rootKind") { + prop.rootKind = ::llvm::dyn_cast_or_null>(value); + return; + } + if (name == "operand_segment_sizes" || name == "operandSegmentSizes") { + auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value); + if (!arrAttr) return; + if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t)) + return; + llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin()); + return; + } +} + +void RecordMatchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.benefit) attrs.append("benefit", prop.benefit); + + if (prop.generatedOps) attrs.append("generatedOps", prop.generatedOps); + + if (prop.rewriter) attrs.append("rewriter", prop.rewriter); + + if (prop.rootKind) attrs.append("rootKind", prop.rootKind); + attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes)); +} + +::mlir::LogicalResult RecordMatchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getBenefitAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps11(attr, "benefit", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getGeneratedOpsAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps7(attr, "generatedOps", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getRewriterAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps10(attr, "rewriter", emitError))) + return ::mlir::failure(); + } + + { + ::mlir::Attribute attr = attrs.get(getRootKindAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(attr, "rootKind", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult RecordMatchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.benefit))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.generatedOps))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readAttribute(prop.rewriter))) + return ::mlir::failure(); + + if (::mlir::failed(reader.readOptionalAttribute(prop.rootKind))) + return ::mlir::failure(); + + { + auto &propStorage = prop.operandSegmentSizes; + auto readProp = [&]() { + +if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) { + ::mlir::DenseI32ArrayAttr attr; + if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure(); + if (attr.size() > static_cast(sizeof(propStorage) / sizeof(int32_t))) { + reader.emitError("size mismatch for operand/result_segment_size"); + return ::mlir::failure(); + } + ::llvm::copy(::llvm::ArrayRef(attr), propStorage.begin()); +} else { + return reader.readSparseArray(::llvm::MutableArrayRef(propStorage)); +} +; + return ::mlir::success(); + }; + if (::mlir::failed(readProp())) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +void RecordMatchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.benefit); + + writer.writeOptionalAttribute(prop.generatedOps); + writer.writeAttribute(prop.rewriter); + + writer.writeOptionalAttribute(prop.rootKind); + + { + auto &propStorage = prop.operandSegmentSizes; + +if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) + writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(getContext(), propStorage)); +else + writer.writeSparseArray(::llvm::ArrayRef(propStorage)); +; + } +} + +::mlir::SymbolRefAttr RecordMatchOp::getRewriterAttr() { + return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().rewriter); +} + +::mlir::SymbolRefAttr RecordMatchOp::getRewriter() { + auto attr = getRewriterAttr(); + return attr; +} + +::mlir::StringAttr RecordMatchOp::getRootKindAttr() { + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().rootKind); +} + +::std::optional< ::llvm::StringRef > RecordMatchOp::getRootKind() { + auto attr = getRootKindAttr(); + return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt); +} + +::mlir::ArrayAttr RecordMatchOp::getGeneratedOpsAttr() { + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().generatedOps); +} + +::std::optional< ::mlir::ArrayAttr > RecordMatchOp::getGeneratedOps() { + auto attr = getGeneratedOpsAttr(); + return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt); +} + +::mlir::IntegerAttr RecordMatchOp::getBenefitAttr() { + return ::llvm::cast<::mlir::IntegerAttr>(getProperties().benefit); +} + +uint16_t RecordMatchOp::getBenefit() { + auto attr = getBenefitAttr(); + return attr.getValue().getZExtValue(); +} + +void RecordMatchOp::setRewriterAttr(::mlir::SymbolRefAttr attr) { + (*this)->setAttr(getRewriterAttrName(), attr); +} + +void RecordMatchOp::setRootKindAttr(::mlir::StringAttr attr) { + (*this)->setAttr(getRootKindAttrName(), attr); +} + +void RecordMatchOp::setRootKind(::std::optional<::llvm::StringRef> attrValue) { + if (attrValue) + return (*this)->setAttr(getRootKindAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue)); + (*this)->removeAttr(getRootKindAttrName()); +} + +void RecordMatchOp::setGeneratedOpsAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getGeneratedOpsAttrName(), attr); +} + +void RecordMatchOp::setBenefitAttr(::mlir::IntegerAttr attr) { + (*this)->setAttr(getBenefitAttrName(), attr); +} + +void RecordMatchOp::setBenefit(uint16_t attrValue) { + (*this)->setAttr(getBenefitAttrName(), ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(16), attrValue)); +} + +::mlir::Attribute RecordMatchOp::removeRootKindAttr() { + auto &attr = getProperties().rootKind; + attr = {}; + return attr; +} + +::mlir::Attribute RecordMatchOp::removeGeneratedOpsAttr() { + auto &attr = getProperties().generatedOps; + attr = {}; + return attr; +} + +void RecordMatchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange matchedOps, ::mlir::SymbolRefAttr rewriter, /*optional*/::mlir::StringAttr rootKind, /*optional*/::mlir::ArrayAttr generatedOps, ::mlir::IntegerAttr benefit, ::mlir::Block *dest) { + odsState.addOperands(inputs); + odsState.addOperands(matchedOps); + ::llvm::copy(::llvm::ArrayRef({static_cast(inputs.size()), static_cast(matchedOps.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().rewriter = rewriter; + if (rootKind) { + odsState.getOrAddProperties().rootKind = rootKind; + } + if (generatedOps) { + odsState.getOrAddProperties().generatedOps = generatedOps; + } + odsState.getOrAddProperties().benefit = benefit; + odsState.addSuccessors(dest); +} + +void RecordMatchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange matchedOps, ::mlir::SymbolRefAttr rewriter, /*optional*/::mlir::StringAttr rootKind, /*optional*/::mlir::ArrayAttr generatedOps, ::mlir::IntegerAttr benefit, ::mlir::Block *dest) { + odsState.addOperands(inputs); + odsState.addOperands(matchedOps); + ::llvm::copy(::llvm::ArrayRef({static_cast(inputs.size()), static_cast(matchedOps.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().rewriter = rewriter; + if (rootKind) { + odsState.getOrAddProperties().rootKind = rootKind; + } + if (generatedOps) { + odsState.getOrAddProperties().generatedOps = generatedOps; + } + odsState.getOrAddProperties().benefit = benefit; + odsState.addSuccessors(dest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RecordMatchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange matchedOps, ::mlir::SymbolRefAttr rewriter, /*optional*/::mlir::StringAttr rootKind, /*optional*/::mlir::ArrayAttr generatedOps, uint16_t benefit, ::mlir::Block *dest) { + odsState.addOperands(inputs); + odsState.addOperands(matchedOps); + ::llvm::copy(::llvm::ArrayRef({static_cast(inputs.size()), static_cast(matchedOps.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().rewriter = rewriter; + if (rootKind) { + odsState.getOrAddProperties().rootKind = rootKind; + } + if (generatedOps) { + odsState.getOrAddProperties().generatedOps = generatedOps; + } + odsState.getOrAddProperties().benefit = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(16), benefit); + odsState.addSuccessors(dest); +} + +void RecordMatchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange matchedOps, ::mlir::SymbolRefAttr rewriter, /*optional*/::mlir::StringAttr rootKind, /*optional*/::mlir::ArrayAttr generatedOps, uint16_t benefit, ::mlir::Block *dest) { + odsState.addOperands(inputs); + odsState.addOperands(matchedOps); + ::llvm::copy(::llvm::ArrayRef({static_cast(inputs.size()), static_cast(matchedOps.size())}), odsState.getOrAddProperties().operandSegmentSizes.begin()); + odsState.getOrAddProperties().rewriter = rewriter; + if (rootKind) { + odsState.getOrAddProperties().rootKind = rootKind; + } + if (generatedOps) { + odsState.getOrAddProperties().generatedOps = generatedOps; + } + odsState.getOrAddProperties().benefit = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(16), benefit); + odsState.addSuccessors(dest); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void RecordMatchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult RecordMatchOp::verifyInvariantsImpl() { + auto tblgen_benefit = getProperties().benefit; (void)tblgen_benefit; + if (!tblgen_benefit) return emitOpError("requires attribute 'benefit'"); + auto tblgen_generatedOps = getProperties().generatedOps; (void)tblgen_generatedOps; + auto tblgen_rewriter = getProperties().rewriter; (void)tblgen_rewriter; + if (!tblgen_rewriter) return emitOpError("requires attribute 'rewriter'"); + auto tblgen_rootKind = getProperties().rootKind; (void)tblgen_rootKind; + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps10(*this, tblgen_rewriter, "rewriter"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps0(*this, tblgen_rootKind, "rootKind"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps7(*this, tblgen_generatedOps, "generatedOps"))) + return ::mlir::failure(); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps11(*this, tblgen_benefit, "benefit"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult RecordMatchOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult RecordMatchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::SymbolRefAttr rewriterAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> inputsOperands; + ::llvm::SMLoc inputsOperandsLoc; + (void)inputsOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> inputsTypes; + ::mlir::IntegerAttr benefitAttr; + ::mlir::ArrayAttr generatedOpsAttr; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> matchedOpsOperands; + ::llvm::SMLoc matchedOpsOperandsLoc; + (void)matchedOpsOperandsLoc; + ::mlir::StringAttr rootKindAttr; + ::mlir::Block *destSuccessor = nullptr; + + if (parser.parseCustomAttributeWithFallback(rewriterAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (rewriterAttr) result.getOrAddProperties().rewriter = rewriterAttr; + if (::mlir::succeeded(parser.parseOptionalLParen())) { + + inputsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(inputsOperands)) + return ::mlir::failure(); + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(inputsTypes)) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + } + if (parser.parseColon()) + return ::mlir::failure(); + if (parser.parseKeyword("benefit")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(benefitAttr, parser.getBuilder().getIntegerType(16))) { + return ::mlir::failure(); + } + if (benefitAttr) result.getOrAddProperties().benefit = benefitAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalKeyword("generatedOps"))) { + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(generatedOpsAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (generatedOpsAttr) result.getOrAddProperties().generatedOps = generatedOpsAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + if (parser.parseComma()) + return ::mlir::failure(); + } + if (parser.parseKeyword("loc")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + if (parser.parseLSquare()) + return ::mlir::failure(); + + matchedOpsOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(matchedOpsOperands)) + return ::mlir::failure(); + if (parser.parseRSquare()) + return ::mlir::failure(); + if (parser.parseRParen()) + return ::mlir::failure(); + if (::mlir::succeeded(parser.parseOptionalComma())) { + if (parser.parseKeyword("root")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(rootKindAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (rootKindAttr) result.getOrAddProperties().rootKind = rootKindAttr; + if (parser.parseRParen()) + return ::mlir::failure(); + } + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseSuccessor(destSuccessor)) + return ::mlir::failure(); + result.addSuccessors(destSuccessor); +::llvm::copy(::llvm::ArrayRef({static_cast(inputsOperands.size()), static_cast(matchedOpsOperands.size())}), result.getOrAddProperties().operandSegmentSizes.begin()); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(inputsOperands, inputsTypes, inputsOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(matchedOpsOperands, odsBuildableType0, matchedOpsOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void RecordMatchOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getRewriterAttr()); + if (!getInputs().empty()) { + _odsPrinter << "("; + _odsPrinter << getInputs(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getInputs().getTypes(); + _odsPrinter << ")"; + } + _odsPrinter << ' ' << ":"; + _odsPrinter << ' ' << "benefit"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getBenefitAttr()); + _odsPrinter << ")"; + _odsPrinter << ","; + if (getGeneratedOpsAttr()) { + _odsPrinter << ' ' << "generatedOps"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getGeneratedOpsAttr()); + _odsPrinter << ")"; + _odsPrinter << ","; + } + _odsPrinter << ' ' << "loc"; + _odsPrinter << "("; + _odsPrinter << "["; + _odsPrinter << getMatchedOps(); + _odsPrinter << "]"; + _odsPrinter << ")"; + if (getRootKindAttr()) { + _odsPrinter << ","; + _odsPrinter << ' ' << "root"; + _odsPrinter << "("; + _odsPrinter.printAttributeWithoutType(getRootKindAttr()); + _odsPrinter << ")"; + } + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("operandSegmentSizes"); + elidedAttrs.push_back("rewriter"); + elidedAttrs.push_back("benefit"); + elidedAttrs.push_back("generatedOps"); + elidedAttrs.push_back("rootKind"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getDest(); +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::RecordMatchOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ReplaceOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +ReplaceOpGenericAdaptorBase::ReplaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.replace", odsAttrs.getContext()); +} + +ReplaceOpGenericAdaptorBase::ReplaceOpGenericAdaptorBase(ReplaceOp op) : ReplaceOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair ReplaceOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (odsOperandsSize - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::DictionaryAttr ReplaceOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +ReplaceOpAdaptor::ReplaceOpAdaptor(ReplaceOp op) : ReplaceOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult ReplaceOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair ReplaceOp::getODSOperandIndexAndLength(unsigned index) { + bool isVariadic[] = {false, true}; + int prevVariadicCount = 0; + for (unsigned i = 0; i < index; ++i) + if (isVariadic[i]) ++prevVariadicCount; + + // Calculate how many dynamic values a static variadic operand corresponds to. + // This assumes all static variadic operands have the same dynamic value count. + int variadicSize = (getOperation()->getNumOperands() - 1) / 1; + // `index` passed in as the parameter is the static index which counts each + // operand (variadic or not) as size 1. So here for each previous static variadic + // operand, we need to offset by (variadicSize - 1) to get where the dynamic + // value pack for this static operand starts. + int start = index + (variadicSize - 1) * prevVariadicCount; + int size = isVariadic[index] ? variadicSize : 1; + return {start, size}; +} + +::mlir::Operation::operand_range ReplaceOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> ReplaceOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::Operation::operand_range ReplaceOp::getReplValues() { + return getODSOperands(1); +} + +::mlir::OpOperand &ReplaceOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +::mlir::MutableOperandRange ReplaceOp::getReplValuesMutable() { + auto range = getODSOperandIndexAndLength(1); + auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second); + return mutableRange; +} + +std::pair ReplaceOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range ReplaceOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +void ReplaceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::ValueRange replValues) { + odsState.addOperands(inputOp); + odsState.addOperands(replValues); +} + +void ReplaceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::ValueRange replValues) { + odsState.addOperands(inputOp); + odsState.addOperands(replValues); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void ReplaceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() >= 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult ReplaceOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + auto valueGroup1 = getODSOperands(1); + + for (auto v : valueGroup1) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps5(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult ReplaceOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +::mlir::ParseResult ReplaceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> replValuesOperands; + ::llvm::SMLoc replValuesOperandsLoc; + (void)replValuesOperandsLoc; + ::llvm::SmallVector<::mlir::Type, 1> replValuesTypes; + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("with")) + return ::mlir::failure(); + if (parser.parseLParen()) + return ::mlir::failure(); + + replValuesOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperandList(replValuesOperands)) + return ::mlir::failure(); + if (!replValuesOperands.empty()) { + if (parser.parseColon()) + return ::mlir::failure(); + + if (parser.parseTypeList(replValuesTypes)) + return ::mlir::failure(); + } + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + } + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + if (parser.resolveOperands(replValuesOperands, replValuesTypes, replValuesOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void ReplaceOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + _odsPrinter << ' ' << "with"; + _odsPrinter << ' '; + _odsPrinter << "("; + if (!getReplValues().empty()) { + _odsPrinter << getReplValues(); + _odsPrinter << ' ' << ":"; + _odsPrinter << ' '; + _odsPrinter << getReplValues().getTypes(); + } + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ReplaceOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchAttributeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SwitchAttributeOpGenericAdaptorBase::SwitchAttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.switch_attribute", odsAttrs.getContext()); +} + +SwitchAttributeOpGenericAdaptorBase::SwitchAttributeOpGenericAdaptorBase(SwitchAttributeOp op) : SwitchAttributeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SwitchAttributeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SwitchAttributeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr SwitchAttributeOpGenericAdaptorBase::getCaseValuesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().caseValues); + return attr; +} + +::mlir::ArrayAttr SwitchAttributeOpGenericAdaptorBase::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +} // namespace detail +SwitchAttributeOpAdaptor::SwitchAttributeOpAdaptor(SwitchAttributeOp op) : SwitchAttributeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SwitchAttributeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitError(loc, "'pdl_interp.switch_attribute' op ""requires attribute 'caseValues'"); + + if (tblgen_caseValues && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_caseValues)))) + return emitError(loc, "'pdl_interp.switch_attribute' op ""attribute 'caseValues' failed to satisfy constraint: array attribute"); + return ::mlir::success(); +} + +std::pair SwitchAttributeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SwitchAttributeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::AttributeType> SwitchAttributeOp::getAttribute() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::AttributeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SwitchAttributeOp::getAttributeMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SwitchAttributeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SwitchAttributeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *SwitchAttributeOp::getDefaultDest() { + return (*this)->getSuccessor(0); +} + +::mlir::SuccessorRange SwitchAttributeOp::getCases() { + return {std::next((*this)->successor_begin(), 1), (*this)->successor_end()}; +} + +::mlir::LogicalResult SwitchAttributeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.caseValues; + auto attr = dict.get("caseValues"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for caseValues in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `caseValues` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SwitchAttributeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.caseValues; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("caseValues", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SwitchAttributeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.caseValues.getAsOpaquePointer())); +} + +std::optional SwitchAttributeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "caseValues") + return prop.caseValues; + return std::nullopt; +} + +void SwitchAttributeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "caseValues") { + prop.caseValues = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SwitchAttributeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.caseValues) attrs.append("caseValues", prop.caseValues); +} + +::mlir::LogicalResult SwitchAttributeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCaseValuesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps12(attr, "caseValues", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchAttributeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.caseValues))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchAttributeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.caseValues); +} + +::mlir::ArrayAttr SwitchAttributeOp::getCaseValuesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().caseValues); +} + +::mlir::ArrayAttr SwitchAttributeOp::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +void SwitchAttributeOp::setCaseValuesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getCaseValuesAttrName(), attr); +} + +void SwitchAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value attribute, ArrayRef caseValues, Block *defaultDest, BlockRange dests) { + build(odsBuilder, odsState, attribute, odsBuilder.getArrayAttr(caseValues), + defaultDest, dests); + +} + +void SwitchAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value attribute, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(attribute); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); +} + +void SwitchAttributeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value attribute, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(attribute); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SwitchAttributeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SwitchAttributeOp::verifyInvariantsImpl() { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitOpError("requires attribute 'caseValues'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps12(*this, tblgen_caseValues, "caseValues"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchAttributeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SwitchAttributeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand attributeRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> attributeOperands(attributeRawOperands); ::llvm::SMLoc attributeOperandsLoc; + (void)attributeOperandsLoc; + ::mlir::ArrayAttr caseValuesAttr; + ::llvm::SmallVector<::mlir::Block *, 2> casesSuccessors; + ::mlir::Block *defaultDestSuccessor = nullptr; + + attributeOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(attributeRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(caseValuesAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (caseValuesAttr) result.getOrAddProperties().caseValues = caseValuesAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + } + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseSuccessor(defaultDestSuccessor)) + return ::mlir::failure(); + result.addSuccessors(defaultDestSuccessor); + result.addSuccessors(casesSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::AttributeType>(); + if (parser.resolveOperands(attributeOperands, odsBuildableType0, attributeOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchAttributeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getAttribute(); + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getCaseValuesAttr()); + _odsPrinter << "("; + ::llvm::interleaveComma(getCases(), _odsPrinter); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("caseValues"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getDefaultDest(); +} + +void SwitchAttributeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchAttributeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchOperandCountOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SwitchOperandCountOpGenericAdaptorBase::SwitchOperandCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.switch_operand_count", odsAttrs.getContext()); +} + +SwitchOperandCountOpGenericAdaptorBase::SwitchOperandCountOpGenericAdaptorBase(SwitchOperandCountOp op) : SwitchOperandCountOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SwitchOperandCountOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SwitchOperandCountOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr SwitchOperandCountOpGenericAdaptorBase::getCaseValuesAttr() { + auto attr = ::llvm::cast<::mlir::DenseIntElementsAttr>(getProperties().caseValues); + return attr; +} + +::mlir::DenseIntElementsAttr SwitchOperandCountOpGenericAdaptorBase::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +} // namespace detail +SwitchOperandCountOpAdaptor::SwitchOperandCountOpAdaptor(SwitchOperandCountOp op) : SwitchOperandCountOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SwitchOperandCountOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitError(loc, "'pdl_interp.switch_operand_count' op ""requires attribute 'caseValues'"); + + if (tblgen_caseValues && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_caseValues))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_caseValues).getType().getElementType().isSignlessInteger(32))))) + return emitError(loc, "'pdl_interp.switch_operand_count' op ""attribute 'caseValues' failed to satisfy constraint: 32-bit signless integer elements attribute"); + return ::mlir::success(); +} + +std::pair SwitchOperandCountOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SwitchOperandCountOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> SwitchOperandCountOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SwitchOperandCountOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SwitchOperandCountOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SwitchOperandCountOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *SwitchOperandCountOp::getDefaultDest() { + return (*this)->getSuccessor(0); +} + +::mlir::SuccessorRange SwitchOperandCountOp::getCases() { + return {std::next((*this)->successor_begin(), 1), (*this)->successor_end()}; +} + +::mlir::LogicalResult SwitchOperandCountOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.caseValues; + auto attr = dict.get("caseValues"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for caseValues in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `caseValues` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SwitchOperandCountOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.caseValues; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("caseValues", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SwitchOperandCountOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.caseValues.getAsOpaquePointer())); +} + +std::optional SwitchOperandCountOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "caseValues") + return prop.caseValues; + return std::nullopt; +} + +void SwitchOperandCountOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "caseValues") { + prop.caseValues = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SwitchOperandCountOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.caseValues) attrs.append("caseValues", prop.caseValues); +} + +::mlir::LogicalResult SwitchOperandCountOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCaseValuesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps13(attr, "caseValues", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchOperandCountOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.caseValues))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchOperandCountOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.caseValues); +} + +::mlir::DenseIntElementsAttr SwitchOperandCountOp::getCaseValuesAttr() { + return ::llvm::cast<::mlir::DenseIntElementsAttr>(getProperties().caseValues); +} + +::mlir::DenseIntElementsAttr SwitchOperandCountOp::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +void SwitchOperandCountOp::setCaseValuesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getCaseValuesAttrName(), attr); +} + +void SwitchOperandCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value inputOp, ArrayRef counts, Block *defaultDest, BlockRange dests) { + build(odsBuilder, odsState, inputOp, odsBuilder.getI32VectorAttr(counts), + defaultDest, dests); + +} + +void SwitchOperandCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::DenseIntElementsAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); +} + +void SwitchOperandCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::DenseIntElementsAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SwitchOperandCountOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SwitchOperandCountOp::verifyInvariantsImpl() { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitOpError("requires attribute 'caseValues'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps13(*this, tblgen_caseValues, "caseValues"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchOperandCountOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SwitchOperandCountOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + ::mlir::DenseIntElementsAttr caseValuesAttr; + ::llvm::SmallVector<::mlir::Block *, 2> casesSuccessors; + ::mlir::Block *defaultDestSuccessor = nullptr; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(caseValuesAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (caseValuesAttr) result.getOrAddProperties().caseValues = caseValuesAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + } + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseSuccessor(defaultDestSuccessor)) + return ::mlir::failure(); + result.addSuccessors(defaultDestSuccessor); + result.addSuccessors(casesSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchOperandCountOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getCaseValuesAttr()); + _odsPrinter << "("; + ::llvm::interleaveComma(getCases(), _odsPrinter); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("caseValues"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getDefaultDest(); +} + +void SwitchOperandCountOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchOperandCountOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchOperationNameOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SwitchOperationNameOpGenericAdaptorBase::SwitchOperationNameOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.switch_operation_name", odsAttrs.getContext()); +} + +SwitchOperationNameOpGenericAdaptorBase::SwitchOperationNameOpGenericAdaptorBase(SwitchOperationNameOp op) : SwitchOperationNameOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SwitchOperationNameOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SwitchOperationNameOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr SwitchOperationNameOpGenericAdaptorBase::getCaseValuesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().caseValues); + return attr; +} + +::mlir::ArrayAttr SwitchOperationNameOpGenericAdaptorBase::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +} // namespace detail +SwitchOperationNameOpAdaptor::SwitchOperationNameOpAdaptor(SwitchOperationNameOp op) : SwitchOperationNameOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SwitchOperationNameOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitError(loc, "'pdl_interp.switch_operation_name' op ""requires attribute 'caseValues'"); + + if (tblgen_caseValues && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_caseValues))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_caseValues), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); })))) + return emitError(loc, "'pdl_interp.switch_operation_name' op ""attribute 'caseValues' failed to satisfy constraint: string array attribute"); + return ::mlir::success(); +} + +std::pair SwitchOperationNameOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SwitchOperationNameOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> SwitchOperationNameOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SwitchOperationNameOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SwitchOperationNameOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SwitchOperationNameOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *SwitchOperationNameOp::getDefaultDest() { + return (*this)->getSuccessor(0); +} + +::mlir::SuccessorRange SwitchOperationNameOp::getCases() { + return {std::next((*this)->successor_begin(), 1), (*this)->successor_end()}; +} + +::mlir::LogicalResult SwitchOperationNameOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.caseValues; + auto attr = dict.get("caseValues"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for caseValues in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `caseValues` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SwitchOperationNameOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.caseValues; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("caseValues", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SwitchOperationNameOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.caseValues.getAsOpaquePointer())); +} + +std::optional SwitchOperationNameOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "caseValues") + return prop.caseValues; + return std::nullopt; +} + +void SwitchOperationNameOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "caseValues") { + prop.caseValues = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SwitchOperationNameOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.caseValues) attrs.append("caseValues", prop.caseValues); +} + +::mlir::LogicalResult SwitchOperationNameOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCaseValuesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps7(attr, "caseValues", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchOperationNameOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.caseValues))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchOperationNameOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.caseValues); +} + +::mlir::ArrayAttr SwitchOperationNameOp::getCaseValuesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().caseValues); +} + +::mlir::ArrayAttr SwitchOperationNameOp::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +void SwitchOperationNameOp::setCaseValuesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getCaseValuesAttrName(), attr); +} + +void SwitchOperationNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value inputOp, ArrayRef names, Block *defaultDest, BlockRange dests) { + auto stringNames = llvm::to_vector<8>(llvm::map_range(names, + [](OperationName name) { return name.getStringRef(); })); + build(odsBuilder, odsState, inputOp, odsBuilder.getStrArrayAttr(stringNames), + defaultDest, dests); + +} + +void SwitchOperationNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); +} + +void SwitchOperationNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SwitchOperationNameOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SwitchOperationNameOp::verifyInvariantsImpl() { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitOpError("requires attribute 'caseValues'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps7(*this, tblgen_caseValues, "caseValues"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchOperationNameOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SwitchOperationNameOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + ::mlir::ArrayAttr caseValuesAttr; + ::llvm::SmallVector<::mlir::Block *, 2> casesSuccessors; + ::mlir::Block *defaultDestSuccessor = nullptr; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(caseValuesAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (caseValuesAttr) result.getOrAddProperties().caseValues = caseValuesAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + } + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseSuccessor(defaultDestSuccessor)) + return ::mlir::failure(); + result.addSuccessors(defaultDestSuccessor); + result.addSuccessors(casesSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchOperationNameOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getCaseValuesAttr()); + _odsPrinter << "("; + ::llvm::interleaveComma(getCases(), _odsPrinter); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("caseValues"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getDefaultDest(); +} + +void SwitchOperationNameOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchOperationNameOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchResultCountOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SwitchResultCountOpGenericAdaptorBase::SwitchResultCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.switch_result_count", odsAttrs.getContext()); +} + +SwitchResultCountOpGenericAdaptorBase::SwitchResultCountOpGenericAdaptorBase(SwitchResultCountOp op) : SwitchResultCountOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SwitchResultCountOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SwitchResultCountOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::DenseIntElementsAttr SwitchResultCountOpGenericAdaptorBase::getCaseValuesAttr() { + auto attr = ::llvm::cast<::mlir::DenseIntElementsAttr>(getProperties().caseValues); + return attr; +} + +::mlir::DenseIntElementsAttr SwitchResultCountOpGenericAdaptorBase::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +} // namespace detail +SwitchResultCountOpAdaptor::SwitchResultCountOpAdaptor(SwitchResultCountOp op) : SwitchResultCountOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SwitchResultCountOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitError(loc, "'pdl_interp.switch_result_count' op ""requires attribute 'caseValues'"); + + if (tblgen_caseValues && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_caseValues))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_caseValues).getType().getElementType().isSignlessInteger(32))))) + return emitError(loc, "'pdl_interp.switch_result_count' op ""attribute 'caseValues' failed to satisfy constraint: 32-bit signless integer elements attribute"); + return ::mlir::success(); +} + +std::pair SwitchResultCountOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SwitchResultCountOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::OperationType> SwitchResultCountOp::getInputOp() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::OperationType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SwitchResultCountOp::getInputOpMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SwitchResultCountOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SwitchResultCountOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *SwitchResultCountOp::getDefaultDest() { + return (*this)->getSuccessor(0); +} + +::mlir::SuccessorRange SwitchResultCountOp::getCases() { + return {std::next((*this)->successor_begin(), 1), (*this)->successor_end()}; +} + +::mlir::LogicalResult SwitchResultCountOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.caseValues; + auto attr = dict.get("caseValues"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for caseValues in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `caseValues` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SwitchResultCountOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.caseValues; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("caseValues", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SwitchResultCountOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.caseValues.getAsOpaquePointer())); +} + +std::optional SwitchResultCountOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "caseValues") + return prop.caseValues; + return std::nullopt; +} + +void SwitchResultCountOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "caseValues") { + prop.caseValues = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SwitchResultCountOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.caseValues) attrs.append("caseValues", prop.caseValues); +} + +::mlir::LogicalResult SwitchResultCountOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCaseValuesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps13(attr, "caseValues", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchResultCountOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.caseValues))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchResultCountOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.caseValues); +} + +::mlir::DenseIntElementsAttr SwitchResultCountOp::getCaseValuesAttr() { + return ::llvm::cast<::mlir::DenseIntElementsAttr>(getProperties().caseValues); +} + +::mlir::DenseIntElementsAttr SwitchResultCountOp::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +void SwitchResultCountOp::setCaseValuesAttr(::mlir::DenseIntElementsAttr attr) { + (*this)->setAttr(getCaseValuesAttrName(), attr); +} + +void SwitchResultCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value inputOp, ArrayRef counts, Block *defaultDest, BlockRange dests) { + build(odsBuilder, odsState, inputOp, odsBuilder.getI32VectorAttr(counts), + defaultDest, dests); + +} + +void SwitchResultCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::DenseIntElementsAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); +} + +void SwitchResultCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::DenseIntElementsAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(inputOp); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SwitchResultCountOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SwitchResultCountOp::verifyInvariantsImpl() { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitOpError("requires attribute 'caseValues'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps13(*this, tblgen_caseValues, "caseValues"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps2(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchResultCountOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SwitchResultCountOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand inputOpRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOpOperands(inputOpRawOperands); ::llvm::SMLoc inputOpOperandsLoc; + (void)inputOpOperandsLoc; + ::mlir::DenseIntElementsAttr caseValuesAttr; + ::llvm::SmallVector<::mlir::Block *, 2> casesSuccessors; + ::mlir::Block *defaultDestSuccessor = nullptr; + if (parser.parseKeyword("of")) + return ::mlir::failure(); + + inputOpOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(inputOpRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(caseValuesAttr, ::mlir::Type{})) { + return ::mlir::failure(); + } + if (caseValuesAttr) result.getOrAddProperties().caseValues = caseValuesAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + } + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseSuccessor(defaultDestSuccessor)) + return ::mlir::failure(); + result.addSuccessors(defaultDestSuccessor); + result.addSuccessors(casesSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::OperationType>(); + if (parser.resolveOperands(inputOpOperands, odsBuildableType0, inputOpOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchResultCountOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' ' << "of"; + _odsPrinter << ' '; + _odsPrinter << getInputOp(); + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; +_odsPrinter.printStrippedAttrOrType(getCaseValuesAttr()); + _odsPrinter << "("; + ::llvm::interleaveComma(getCases(), _odsPrinter); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("caseValues"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getDefaultDest(); +} + +void SwitchResultCountOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchResultCountOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchTypeOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SwitchTypeOpGenericAdaptorBase::SwitchTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.switch_type", odsAttrs.getContext()); +} + +SwitchTypeOpGenericAdaptorBase::SwitchTypeOpGenericAdaptorBase(SwitchTypeOp op) : SwitchTypeOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SwitchTypeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SwitchTypeOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr SwitchTypeOpGenericAdaptorBase::getCaseValuesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().caseValues); + return attr; +} + +::mlir::ArrayAttr SwitchTypeOpGenericAdaptorBase::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +} // namespace detail +SwitchTypeOpAdaptor::SwitchTypeOpAdaptor(SwitchTypeOp op) : SwitchTypeOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SwitchTypeOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitError(loc, "'pdl_interp.switch_type' op ""requires attribute 'caseValues'"); + + if (tblgen_caseValues && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_caseValues))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_caseValues), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))); })))) + return emitError(loc, "'pdl_interp.switch_type' op ""attribute 'caseValues' failed to satisfy constraint: type array attribute"); + return ::mlir::success(); +} + +std::pair SwitchTypeOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SwitchTypeOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::TypeType> SwitchTypeOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::TypeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SwitchTypeOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SwitchTypeOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SwitchTypeOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *SwitchTypeOp::getDefaultDest() { + return (*this)->getSuccessor(0); +} + +::mlir::SuccessorRange SwitchTypeOp::getCases() { + return {std::next((*this)->successor_begin(), 1), (*this)->successor_end()}; +} + +::mlir::LogicalResult SwitchTypeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.caseValues; + auto attr = dict.get("caseValues"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for caseValues in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `caseValues` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SwitchTypeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.caseValues; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("caseValues", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SwitchTypeOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.caseValues.getAsOpaquePointer())); +} + +std::optional SwitchTypeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "caseValues") + return prop.caseValues; + return std::nullopt; +} + +void SwitchTypeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "caseValues") { + prop.caseValues = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SwitchTypeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.caseValues) attrs.append("caseValues", prop.caseValues); +} + +::mlir::LogicalResult SwitchTypeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCaseValuesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps6(attr, "caseValues", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchTypeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.caseValues))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchTypeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.caseValues); +} + +::mlir::ArrayAttr SwitchTypeOp::getCaseValuesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().caseValues); +} + +::mlir::ArrayAttr SwitchTypeOp::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +void SwitchTypeOp::setCaseValuesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getCaseValuesAttrName(), attr); +} + +void SwitchTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value edge, ArrayRef types, Block *defaultDest, BlockRange dests) { + build(odsBuilder, odsState, edge, odsBuilder.getArrayAttr(types), + defaultDest, dests); + +} + +void SwitchTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(value); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); +} + +void SwitchTypeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(value); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SwitchTypeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SwitchTypeOp::verifyInvariantsImpl() { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitOpError("requires attribute 'caseValues'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps6(*this, tblgen_caseValues, "caseValues"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps3(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchTypeOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SwitchTypeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::ArrayAttr caseValuesAttr; + ::llvm::SmallVector<::mlir::Block *, 2> casesSuccessors; + ::mlir::Block *defaultDestSuccessor = nullptr; + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(caseValuesAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (caseValuesAttr) result.getOrAddProperties().caseValues = caseValuesAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + } + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseSuccessor(defaultDestSuccessor)) + return ::mlir::failure(); + result.addSuccessors(defaultDestSuccessor); + result.addSuccessors(casesSuccessors); + ::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::mlir::pdl::TypeType>(); + if (parser.resolveOperands(valueOperands, odsBuildableType0, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchTypeOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getCaseValuesAttr()); + _odsPrinter << "("; + ::llvm::interleaveComma(getCases(), _odsPrinter); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("caseValues"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getDefaultDest(); +} + +void SwitchTypeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchTypesOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +SwitchTypesOpGenericAdaptorBase::SwitchTypesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("pdl_interp.switch_types", odsAttrs.getContext()); +} + +SwitchTypesOpGenericAdaptorBase::SwitchTypesOpGenericAdaptorBase(SwitchTypesOp op) : SwitchTypesOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair SwitchTypesOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr SwitchTypesOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +::mlir::ArrayAttr SwitchTypesOpGenericAdaptorBase::getCaseValuesAttr() { + auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().caseValues); + return attr; +} + +::mlir::ArrayAttr SwitchTypesOpGenericAdaptorBase::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +} // namespace detail +SwitchTypesOpAdaptor::SwitchTypesOpAdaptor(SwitchTypesOp op) : SwitchTypesOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult SwitchTypesOpAdaptor::verify(::mlir::Location loc) { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitError(loc, "'pdl_interp.switch_types' op ""requires attribute 'caseValues'"); + + if (tblgen_caseValues && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_caseValues))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_caseValues), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && (((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))); }))); })))) + return emitError(loc, "'pdl_interp.switch_types' op ""attribute 'caseValues' failed to satisfy constraint: type-array array attribute"); + return ::mlir::success(); +} + +std::pair SwitchTypesOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range SwitchTypesOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::TypedValue<::mlir::pdl::RangeType> SwitchTypesOp::getValue() { + return ::llvm::cast<::mlir::TypedValue<::mlir::pdl::RangeType>>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &SwitchTypesOp::getValueMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair SwitchTypesOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range SwitchTypesOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Block *SwitchTypesOp::getDefaultDest() { + return (*this)->getSuccessor(0); +} + +::mlir::SuccessorRange SwitchTypesOp::getCases() { + return {std::next((*this)->successor_begin(), 1), (*this)->successor_end()}; +} + +::mlir::LogicalResult SwitchTypesOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr); + if (!dict) { + emitError() << "expected DictionaryAttr to set properties"; + return ::mlir::failure(); + } + + { + auto &propStorage = prop.caseValues; + auto attr = dict.get("caseValues"); + if (attr || /*isRequired=*/true) { + if (!attr) { + emitError() << "expected key entry for caseValues in DictionaryAttr to set " + "Properties."; + return ::mlir::failure(); + } + auto convertedAttr = ::llvm::dyn_cast>(attr); + if (convertedAttr) { + propStorage = convertedAttr; + } else { + emitError() << "Invalid attribute `caseValues` in property conversion: " << attr; + return ::mlir::failure(); + } + } + } + return ::mlir::success(); +} + +::mlir::Attribute SwitchTypesOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) { + ::mlir::SmallVector<::mlir::NamedAttribute> attrs; + ::mlir::Builder odsBuilder{ctx}; + + { + const auto &propStorage = prop.caseValues; + if (propStorage) + attrs.push_back(odsBuilder.getNamedAttr("caseValues", + propStorage)); + } + + if (!attrs.empty()) + return odsBuilder.getDictionaryAttr(attrs); + return {}; +} + +llvm::hash_code SwitchTypesOp::computePropertiesHash(const Properties &prop) { + return llvm::hash_combine( + llvm::hash_value(prop.caseValues.getAsOpaquePointer())); +} + +std::optional SwitchTypesOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) { + if (name == "caseValues") + return prop.caseValues; + return std::nullopt; +} + +void SwitchTypesOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) { + if (name == "caseValues") { + prop.caseValues = ::llvm::dyn_cast_or_null>(value); + return; + } +} + +void SwitchTypesOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) { + if (prop.caseValues) attrs.append("caseValues", prop.caseValues); +} + +::mlir::LogicalResult SwitchTypesOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) { + { + ::mlir::Attribute attr = attrs.get(getCaseValuesAttrName(opName)); + if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps14(attr, "caseValues", emitError))) + return ::mlir::failure(); + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchTypesOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) { + auto &prop = state.getOrAddProperties(); (void)prop; + if (::mlir::failed(reader.readAttribute(prop.caseValues))) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchTypesOp::writeProperties(::mlir::DialectBytecodeWriter &writer) { + auto &prop = getProperties(); (void)prop; + writer.writeAttribute(prop.caseValues); +} + +::mlir::ArrayAttr SwitchTypesOp::getCaseValuesAttr() { + return ::llvm::cast<::mlir::ArrayAttr>(getProperties().caseValues); +} + +::mlir::ArrayAttr SwitchTypesOp::getCaseValues() { + auto attr = getCaseValuesAttr(); + return attr; +} + +void SwitchTypesOp::setCaseValuesAttr(::mlir::ArrayAttr attr) { + (*this)->setAttr(getCaseValuesAttrName(), attr); +} + +void SwitchTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value edge, ArrayRef types, Block *defaultDest, BlockRange dests) { + build(odsBuilder, odsState, edge, odsBuilder.getArrayAttr(types), + defaultDest, dests); + +} + +void SwitchTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(value); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); +} + +void SwitchTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases) { + odsState.addOperands(value); + odsState.getOrAddProperties().caseValues = caseValues; + odsState.addSuccessors(defaultDest); + odsState.addSuccessors(cases); + assert(resultTypes.size() == 0u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void SwitchTypesOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 0u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult SwitchTypesOp::verifyInvariantsImpl() { + auto tblgen_caseValues = getProperties().caseValues; (void)tblgen_caseValues; + if (!tblgen_caseValues) return emitOpError("requires attribute 'caseValues'"); + + if (::mlir::failed(__mlir_ods_local_attr_constraint_PDLInterpOps14(*this, tblgen_caseValues, "caseValues"))) + return ::mlir::failure(); + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_PDLInterpOps4(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + } + return ::mlir::success(); +} + +::mlir::LogicalResult SwitchTypesOp::verifyInvariants() { + if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify())) + return ::mlir::success(); + return ::mlir::failure(); +} + +::mlir::ParseResult SwitchTypesOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) { + ::mlir::OpAsmParser::UnresolvedOperand valueRawOperands[1]; + ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(valueRawOperands); ::llvm::SMLoc valueOperandsLoc; + (void)valueOperandsLoc; + ::mlir::ArrayAttr caseValuesAttr; + ::llvm::SmallVector<::mlir::Block *, 2> casesSuccessors; + ::mlir::Block *defaultDestSuccessor = nullptr; + + valueOperandsLoc = parser.getCurrentLocation(); + if (parser.parseOperand(valueRawOperands[0])) + return ::mlir::failure(); + if (parser.parseKeyword("to")) + return ::mlir::failure(); + + if (parser.parseCustomAttributeWithFallback(caseValuesAttr, parser.getBuilder().getType<::mlir::NoneType>())) { + return ::mlir::failure(); + } + if (caseValuesAttr) result.getOrAddProperties().caseValues = caseValuesAttr; + if (parser.parseLParen()) + return ::mlir::failure(); + + { + ::mlir::Block *succ; + auto firstSucc = parser.parseOptionalSuccessor(succ); + if (firstSucc.has_value()) { + if (failed(*firstSucc)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + + // Parse any trailing successors. + while (succeeded(parser.parseOptionalComma())) { + if (parser.parseSuccessor(succ)) + return ::mlir::failure(); + casesSuccessors.emplace_back(succ); + } + } + } + if (parser.parseRParen()) + return ::mlir::failure(); + { + auto loc = parser.getCurrentLocation();(void)loc; + if (parser.parseOptionalAttrDict(result.attributes)) + return ::mlir::failure(); + if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() { + return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op "; + }))) + return ::mlir::failure(); + } + if (parser.parseArrow()) + return ::mlir::failure(); + + if (parser.parseSuccessor(defaultDestSuccessor)) + return ::mlir::failure(); + result.addSuccessors(defaultDestSuccessor); + result.addSuccessors(casesSuccessors); + ::mlir::Type odsBuildableType0 = ::mlir::pdl::RangeType::get(parser.getBuilder().getType<::mlir::pdl::TypeType>()); + if (parser.resolveOperands(valueOperands, odsBuildableType0, valueOperandsLoc, result.operands)) + return ::mlir::failure(); + return ::mlir::success(); +} + +void SwitchTypesOp::print(::mlir::OpAsmPrinter &_odsPrinter) { + _odsPrinter << ' '; + _odsPrinter << getValue(); + _odsPrinter << ' ' << "to"; + _odsPrinter << ' '; + _odsPrinter.printAttributeWithoutType(getCaseValuesAttr()); + _odsPrinter << "("; + ::llvm::interleaveComma(getCases(), _odsPrinter); + _odsPrinter << ")"; + ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("caseValues"); + _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs); + _odsPrinter << ' ' << "->"; + _odsPrinter << ' '; + _odsPrinter << getDefaultDest(); +} + +void SwitchTypesOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace pdl_interp +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchTypesOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ad61768f94cfd126f57cc84feccc861da5b261ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.h.inc @@ -0,0 +1,6072 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: PDLInterpOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace pdl_interp { +class ApplyConstraintOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class ApplyRewriteOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class AreEqualOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class BranchOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CheckAttributeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CheckOperandCountOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CheckOperationNameOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CheckResultCountOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CheckTypeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CheckTypesOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class ContinueOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CreateAttributeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CreateOperationOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CreateRangeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CreateTypeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class CreateTypesOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class EraseOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class ExtractOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class FinalizeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class ForEachOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class FuncOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class GetAttributeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class GetAttributeTypeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class GetDefiningOpOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class GetOperandOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class GetOperandsOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class GetResultOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class GetResultsOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class GetUsersOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class GetValueTypeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class IsNotNullOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class RecordMatchOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class ReplaceOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class SwitchAttributeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class SwitchOperandCountOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class SwitchOperationNameOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class SwitchResultCountOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class SwitchTypeOp; +} // namespace pdl_interp +} // namespace mlir +namespace mlir { +namespace pdl_interp { +class SwitchTypesOp; +} // namespace pdl_interp +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ApplyConstraintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ApplyConstraintOpGenericAdaptorBase { +public: + struct Properties { + using isNegatedTy = ::mlir::BoolAttr; + isNegatedTy isNegated; + + auto getIsNegated() { + auto &propStorage = this->isNegated; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setIsNegated(const ::mlir::BoolAttr &propValue) { + this->isNegated = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.isNegated == this->isNegated && + rhs.name == this->name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ApplyConstraintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ApplyConstraintOpGenericAdaptorBase(ApplyConstraintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + ::mlir::BoolAttr getIsNegatedAttr(); + bool getIsNegated(); +}; +} // namespace detail +template +class ApplyConstraintOpGenericAdaptor : public detail::ApplyConstraintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ApplyConstraintOpGenericAdaptorBase; +public: + ApplyConstraintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ApplyConstraintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ApplyConstraintOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ApplyConstraintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ApplyConstraintOpAdaptor : public ApplyConstraintOpGenericAdaptor<::mlir::ValueRange> { +public: + using ApplyConstraintOpGenericAdaptor::ApplyConstraintOpGenericAdaptor; + ApplyConstraintOpAdaptor(ApplyConstraintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ApplyConstraintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = ApplyConstraintOpAdaptor; + template + using GenericAdaptor = ApplyConstraintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("isNegated"), ::llvm::StringRef("name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsNegatedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsNegatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.apply_constraint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + ::mlir::BoolAttr getIsNegatedAttr(); + bool getIsNegated(); + void setNameAttr(::mlir::StringAttr attr); + void setName(::llvm::StringRef attrValue); + void setIsNegatedAttr(::mlir::BoolAttr attr); + void setIsNegated(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr name, ::mlir::ValueRange args, ::mlir::BoolAttr isNegated, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::ValueRange args, ::mlir::BoolAttr isNegated, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef name, ::mlir::ValueRange args, bool isNegated, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::ValueRange args, bool isNegated, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ApplyConstraintOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ApplyRewriteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ApplyRewriteOpGenericAdaptorBase { +public: + struct Properties { + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.name == this->name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ApplyRewriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ApplyRewriteOpGenericAdaptorBase(ApplyRewriteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); +}; +} // namespace detail +template +class ApplyRewriteOpGenericAdaptor : public detail::ApplyRewriteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ApplyRewriteOpGenericAdaptorBase; +public: + ApplyRewriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ApplyRewriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ApplyRewriteOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ApplyRewriteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ApplyRewriteOpAdaptor : public ApplyRewriteOpGenericAdaptor<::mlir::ValueRange> { +public: + using ApplyRewriteOpGenericAdaptor::ApplyRewriteOpGenericAdaptor; + ApplyRewriteOpAdaptor(ApplyRewriteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ApplyRewriteOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ApplyRewriteOpAdaptor; + template + using GenericAdaptor = ApplyRewriteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.apply_rewrite"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + void setNameAttr(::mlir::StringAttr attr); + void setName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::StringAttr name, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::llvm::StringRef name, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ApplyRewriteOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::AreEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AreEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AreEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AreEqualOpGenericAdaptorBase(AreEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AreEqualOpGenericAdaptor : public detail::AreEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AreEqualOpGenericAdaptorBase; +public: + AreEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AreEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AreEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AreEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AreEqualOpAdaptor : public AreEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using AreEqualOpGenericAdaptor::AreEqualOpGenericAdaptor; + AreEqualOpAdaptor(AreEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AreEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameTypeOperands> { +public: + using Op::Op; + using Op::print; + using Adaptor = AreEqualOpAdaptor; + template + using GenericAdaptor = AreEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.are_equal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getLhs(); + ::mlir::TypedValue<::mlir::pdl::PDLType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::AreEqualOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::BranchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BranchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BranchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BranchOpGenericAdaptorBase(BranchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BranchOpGenericAdaptor : public detail::BranchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BranchOpGenericAdaptorBase; +public: + BranchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BranchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BranchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BranchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BranchOpAdaptor : public BranchOpGenericAdaptor<::mlir::ValueRange> { +public: + using BranchOpGenericAdaptor::BranchOpGenericAdaptor; + BranchOpAdaptor(BranchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BranchOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BranchOpAdaptor; + template + using GenericAdaptor = BranchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.branch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDest(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::BranchOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckAttributeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CheckAttributeOpGenericAdaptorBase { +public: + struct Properties { + using constantValueTy = ::mlir::Attribute; + constantValueTy constantValue; + + auto getConstantValue() { + auto &propStorage = this->constantValue; + return ::llvm::cast<::mlir::Attribute>(propStorage); + } + void setConstantValue(const ::mlir::Attribute &propValue) { + this->constantValue = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.constantValue == this->constantValue && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CheckAttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CheckAttributeOpGenericAdaptorBase(CheckAttributeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getConstantValueAttr(); + ::mlir::Attribute getConstantValue(); +}; +} // namespace detail +template +class CheckAttributeOpGenericAdaptor : public detail::CheckAttributeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CheckAttributeOpGenericAdaptorBase; +public: + CheckAttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CheckAttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CheckAttributeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CheckAttributeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAttribute() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CheckAttributeOpAdaptor : public CheckAttributeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CheckAttributeOpGenericAdaptor::CheckAttributeOpGenericAdaptor; + CheckAttributeOpAdaptor(CheckAttributeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CheckAttributeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CheckAttributeOpAdaptor; + template + using GenericAdaptor = CheckAttributeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("constantValue")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConstantValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConstantValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.check_attribute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::AttributeType> getAttribute(); + ::mlir::OpOperand &getAttributeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::Attribute getConstantValueAttr(); + ::mlir::Attribute getConstantValue(); + void setConstantValueAttr(::mlir::Attribute attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value attribute, ::mlir::Attribute constantValue, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value attribute, ::mlir::Attribute constantValue, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckAttributeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckOperandCountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CheckOperandCountOpGenericAdaptorBase { +public: + struct Properties { + using compareAtLeastTy = ::mlir::UnitAttr; + compareAtLeastTy compareAtLeast; + + auto getCompareAtLeast() { + auto &propStorage = this->compareAtLeast; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setCompareAtLeast(const ::mlir::UnitAttr &propValue) { + this->compareAtLeast = propValue; + } + using countTy = ::mlir::IntegerAttr; + countTy count; + + auto getCount() { + auto &propStorage = this->count; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setCount(const ::mlir::IntegerAttr &propValue) { + this->count = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.compareAtLeast == this->compareAtLeast && + rhs.count == this->count && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CheckOperandCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CheckOperandCountOpGenericAdaptorBase(CheckOperandCountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getCountAttr(); + uint32_t getCount(); + ::mlir::UnitAttr getCompareAtLeastAttr(); + bool getCompareAtLeast(); +}; +} // namespace detail +template +class CheckOperandCountOpGenericAdaptor : public detail::CheckOperandCountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CheckOperandCountOpGenericAdaptorBase; +public: + CheckOperandCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CheckOperandCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CheckOperandCountOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CheckOperandCountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CheckOperandCountOpAdaptor : public CheckOperandCountOpGenericAdaptor<::mlir::ValueRange> { +public: + using CheckOperandCountOpGenericAdaptor::CheckOperandCountOpGenericAdaptor; + CheckOperandCountOpAdaptor(CheckOperandCountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CheckOperandCountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CheckOperandCountOpAdaptor; + template + using GenericAdaptor = CheckOperandCountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("compareAtLeast"), ::llvm::StringRef("count")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCompareAtLeastAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCompareAtLeastAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.check_operand_count"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getCountAttr(); + uint32_t getCount(); + ::mlir::UnitAttr getCompareAtLeastAttr(); + bool getCompareAtLeast(); + void setCountAttr(::mlir::IntegerAttr attr); + void setCount(uint32_t attrValue); + void setCompareAtLeastAttr(::mlir::UnitAttr attr); + void setCompareAtLeast(bool attrValue); + ::mlir::Attribute removeCompareAtLeastAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::IntegerAttr count, /*optional*/::mlir::UnitAttr compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::IntegerAttr count, /*optional*/::mlir::UnitAttr compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, uint32_t count, /*optional*/bool compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, uint32_t count, /*optional*/bool compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckOperandCountOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckOperationNameOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CheckOperationNameOpGenericAdaptorBase { +public: + struct Properties { + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.name == this->name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CheckOperationNameOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CheckOperationNameOpGenericAdaptorBase(CheckOperationNameOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); +}; +} // namespace detail +template +class CheckOperationNameOpGenericAdaptor : public detail::CheckOperationNameOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CheckOperationNameOpGenericAdaptorBase; +public: + CheckOperationNameOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CheckOperationNameOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CheckOperationNameOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CheckOperationNameOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CheckOperationNameOpAdaptor : public CheckOperationNameOpGenericAdaptor<::mlir::ValueRange> { +public: + using CheckOperationNameOpGenericAdaptor::CheckOperationNameOpGenericAdaptor; + CheckOperationNameOpAdaptor(CheckOperationNameOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CheckOperationNameOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CheckOperationNameOpAdaptor; + template + using GenericAdaptor = CheckOperationNameOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.check_operation_name"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + void setNameAttr(::mlir::StringAttr attr); + void setName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::StringAttr name, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::StringAttr name, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::llvm::StringRef name, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::llvm::StringRef name, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckOperationNameOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckResultCountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CheckResultCountOpGenericAdaptorBase { +public: + struct Properties { + using compareAtLeastTy = ::mlir::UnitAttr; + compareAtLeastTy compareAtLeast; + + auto getCompareAtLeast() { + auto &propStorage = this->compareAtLeast; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setCompareAtLeast(const ::mlir::UnitAttr &propValue) { + this->compareAtLeast = propValue; + } + using countTy = ::mlir::IntegerAttr; + countTy count; + + auto getCount() { + auto &propStorage = this->count; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setCount(const ::mlir::IntegerAttr &propValue) { + this->count = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.compareAtLeast == this->compareAtLeast && + rhs.count == this->count && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CheckResultCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CheckResultCountOpGenericAdaptorBase(CheckResultCountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getCountAttr(); + uint32_t getCount(); + ::mlir::UnitAttr getCompareAtLeastAttr(); + bool getCompareAtLeast(); +}; +} // namespace detail +template +class CheckResultCountOpGenericAdaptor : public detail::CheckResultCountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CheckResultCountOpGenericAdaptorBase; +public: + CheckResultCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CheckResultCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CheckResultCountOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CheckResultCountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CheckResultCountOpAdaptor : public CheckResultCountOpGenericAdaptor<::mlir::ValueRange> { +public: + using CheckResultCountOpGenericAdaptor::CheckResultCountOpGenericAdaptor; + CheckResultCountOpAdaptor(CheckResultCountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CheckResultCountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CheckResultCountOpAdaptor; + template + using GenericAdaptor = CheckResultCountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("compareAtLeast"), ::llvm::StringRef("count")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCompareAtLeastAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCompareAtLeastAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.check_result_count"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getCountAttr(); + uint32_t getCount(); + ::mlir::UnitAttr getCompareAtLeastAttr(); + bool getCompareAtLeast(); + void setCountAttr(::mlir::IntegerAttr attr); + void setCount(uint32_t attrValue); + void setCompareAtLeastAttr(::mlir::UnitAttr attr); + void setCompareAtLeast(bool attrValue); + ::mlir::Attribute removeCompareAtLeastAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::IntegerAttr count, /*optional*/::mlir::UnitAttr compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::IntegerAttr count, /*optional*/::mlir::UnitAttr compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, uint32_t count, /*optional*/bool compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, uint32_t count, /*optional*/bool compareAtLeast, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckResultCountOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckTypeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CheckTypeOpGenericAdaptorBase { +public: + struct Properties { + using typeTy = ::mlir::TypeAttr; + typeTy type; + + auto getType() { + auto &propStorage = this->type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setType(const ::mlir::TypeAttr &propValue) { + this->type = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.type == this->type && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CheckTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CheckTypeOpGenericAdaptorBase(CheckTypeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); +}; +} // namespace detail +template +class CheckTypeOpGenericAdaptor : public detail::CheckTypeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CheckTypeOpGenericAdaptorBase; +public: + CheckTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CheckTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CheckTypeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CheckTypeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CheckTypeOpAdaptor : public CheckTypeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CheckTypeOpGenericAdaptor::CheckTypeOpGenericAdaptor; + CheckTypeOpAdaptor(CheckTypeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CheckTypeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CheckTypeOpAdaptor; + template + using GenericAdaptor = CheckTypeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.check_type"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::TypeType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + void setTypeAttr(::mlir::TypeAttr attr); + void setType(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::TypeAttr type, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::TypeAttr type, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Type type, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Type type, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CheckTypesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CheckTypesOpGenericAdaptorBase { +public: + struct Properties { + using typesTy = ::mlir::ArrayAttr; + typesTy types; + + auto getTypes() { + auto &propStorage = this->types; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setTypes(const ::mlir::ArrayAttr &propValue) { + this->types = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.types == this->types && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CheckTypesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CheckTypesOpGenericAdaptorBase(CheckTypesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getTypesAttr(); + ::mlir::ArrayAttr getTypes(); +}; +} // namespace detail +template +class CheckTypesOpGenericAdaptor : public detail::CheckTypesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CheckTypesOpGenericAdaptorBase; +public: + CheckTypesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CheckTypesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CheckTypesOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CheckTypesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CheckTypesOpAdaptor : public CheckTypesOpGenericAdaptor<::mlir::ValueRange> { +public: + using CheckTypesOpGenericAdaptor::CheckTypesOpGenericAdaptor; + CheckTypesOpAdaptor(CheckTypesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CheckTypesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CheckTypesOpAdaptor; + template + using GenericAdaptor = CheckTypesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.check_types"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getTypesAttr(); + ::mlir::ArrayAttr getTypes(); + void setTypesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::ArrayAttr types, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr types, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CheckTypesOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ContinueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ContinueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ContinueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ContinueOpGenericAdaptorBase(ContinueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ContinueOpGenericAdaptor : public detail::ContinueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ContinueOpGenericAdaptorBase; +public: + ContinueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ContinueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ContinueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ContinueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ContinueOpAdaptor : public ContinueOpGenericAdaptor<::mlir::ValueRange> { +public: + using ContinueOpGenericAdaptor::ContinueOpGenericAdaptor; + ContinueOpAdaptor(ContinueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ContinueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = ContinueOpAdaptor; + template + using GenericAdaptor = ContinueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.continue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ContinueOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateAttributeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateAttributeOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::Attribute; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::cast<::mlir::Attribute>(propStorage); + } + void setValue(const ::mlir::Attribute &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CreateAttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateAttributeOpGenericAdaptorBase(CreateAttributeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getValueAttr(); + ::mlir::Attribute getValue(); +}; +} // namespace detail +template +class CreateAttributeOpGenericAdaptor : public detail::CreateAttributeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateAttributeOpGenericAdaptorBase; +public: + CreateAttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateAttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateAttributeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CreateAttributeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateAttributeOpAdaptor : public CreateAttributeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateAttributeOpGenericAdaptor::CreateAttributeOpGenericAdaptor; + CreateAttributeOpAdaptor(CreateAttributeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateAttributeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateAttributeOpAdaptor; + template + using GenericAdaptor = CreateAttributeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.create_attribute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::AttributeType> getAttribute(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::Attribute getValueAttr(); + ::mlir::Attribute getValue(); + void setValueAttr(::mlir::Attribute attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type attribute, ::mlir::Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateAttributeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateOperationOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateOperationOpGenericAdaptorBase { +public: + struct Properties { + using inferredResultTypesTy = ::mlir::UnitAttr; + inferredResultTypesTy inferredResultTypes; + + auto getInferredResultTypes() { + auto &propStorage = this->inferredResultTypes; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setInferredResultTypes(const ::mlir::UnitAttr &propValue) { + this->inferredResultTypes = propValue; + } + using inputAttributeNamesTy = ::mlir::ArrayAttr; + inputAttributeNamesTy inputAttributeNames; + + auto getInputAttributeNames() { + auto &propStorage = this->inputAttributeNames; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setInputAttributeNames(const ::mlir::ArrayAttr &propValue) { + this->inputAttributeNames = propValue; + } + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.inferredResultTypes == this->inferredResultTypes && + rhs.inputAttributeNames == this->inputAttributeNames && + rhs.name == this->name && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CreateOperationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateOperationOpGenericAdaptorBase(CreateOperationOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + ::mlir::ArrayAttr getInputAttributeNamesAttr(); + ::mlir::ArrayAttr getInputAttributeNames(); + ::mlir::UnitAttr getInferredResultTypesAttr(); + bool getInferredResultTypes(); +}; +} // namespace detail +template +class CreateOperationOpGenericAdaptor : public detail::CreateOperationOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateOperationOpGenericAdaptorBase; +public: + CreateOperationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateOperationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateOperationOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CreateOperationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputOperands() { + return getODSOperands(0); + } + + RangeT getInputAttributes() { + return getODSOperands(1); + } + + RangeT getInputResultTypes() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateOperationOpAdaptor : public CreateOperationOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateOperationOpGenericAdaptor::CreateOperationOpGenericAdaptor; + CreateOperationOpAdaptor(CreateOperationOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateOperationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateOperationOpAdaptor; + template + using GenericAdaptor = CreateOperationOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("inferredResultTypes"), ::llvm::StringRef("inputAttributeNames"), ::llvm::StringRef("name"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getInferredResultTypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getInferredResultTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInputAttributeNamesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInputAttributeNamesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.create_operation"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputOperands(); + ::mlir::Operation::operand_range getInputAttributes(); + ::mlir::Operation::operand_range getInputResultTypes(); + ::mlir::MutableOperandRange getInputOperandsMutable(); + ::mlir::MutableOperandRange getInputAttributesMutable(); + ::mlir::MutableOperandRange getInputResultTypesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getResultOp(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + ::mlir::ArrayAttr getInputAttributeNamesAttr(); + ::mlir::ArrayAttr getInputAttributeNames(); + ::mlir::UnitAttr getInferredResultTypesAttr(); + bool getInferredResultTypes(); + void setNameAttr(::mlir::StringAttr attr); + void setName(::llvm::StringRef attrValue); + void setInputAttributeNamesAttr(::mlir::ArrayAttr attr); + void setInferredResultTypesAttr(::mlir::UnitAttr attr); + void setInferredResultTypes(bool attrValue); + ::mlir::Attribute removeInferredResultTypesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, ValueRange types, bool inferredResultTypes, ValueRange operands, ValueRange attributes, ArrayAttr attributeNames); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultOp, ::mlir::StringAttr name, ::mlir::ValueRange inputOperands, ::mlir::ValueRange inputAttributes, ::mlir::ArrayAttr inputAttributeNames, ::mlir::ValueRange inputResultTypes, /*optional*/::mlir::UnitAttr inferredResultTypes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::ValueRange inputOperands, ::mlir::ValueRange inputAttributes, ::mlir::ArrayAttr inputAttributeNames, ::mlir::ValueRange inputResultTypes, /*optional*/::mlir::UnitAttr inferredResultTypes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultOp, ::llvm::StringRef name, ::mlir::ValueRange inputOperands, ::mlir::ValueRange inputAttributes, ::mlir::ArrayAttr inputAttributeNames, ::mlir::ValueRange inputResultTypes, /*optional*/bool inferredResultTypes = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::ValueRange inputOperands, ::mlir::ValueRange inputAttributes, ::mlir::ArrayAttr inputAttributeNames, ::mlir::ValueRange inputResultTypes, /*optional*/bool inferredResultTypes = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateOperationOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateRangeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateRangeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateRangeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateRangeOpGenericAdaptorBase(CreateRangeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateRangeOpGenericAdaptor : public detail::CreateRangeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateRangeOpGenericAdaptorBase; +public: + CreateRangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateRangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateRangeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateRangeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArguments() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateRangeOpAdaptor : public CreateRangeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateRangeOpGenericAdaptor::CreateRangeOpGenericAdaptor; + CreateRangeOpAdaptor(CreateRangeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateRangeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateRangeOpAdaptor; + template + using GenericAdaptor = CreateRangeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.create_range"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArguments(); + ::mlir::MutableOperandRange getArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange arguments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateRangeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateTypeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateTypeOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::TypeAttr; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setValue(const ::mlir::TypeAttr &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CreateTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateTypeOpGenericAdaptorBase(CreateTypeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getValueAttr(); + ::mlir::Type getValue(); +}; +} // namespace detail +template +class CreateTypeOpGenericAdaptor : public detail::CreateTypeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateTypeOpGenericAdaptorBase; +public: + CreateTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateTypeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CreateTypeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateTypeOpAdaptor : public CreateTypeOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateTypeOpGenericAdaptor::CreateTypeOpGenericAdaptor; + CreateTypeOpAdaptor(CreateTypeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateTypeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateTypeOpAdaptor; + template + using GenericAdaptor = CreateTypeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.create_type"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::TypeType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::TypeAttr getValueAttr(); + ::mlir::Type getValue(); + void setValueAttr(::mlir::TypeAttr attr); + void setValue(::mlir::Type attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeAttr type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::TypeAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypeAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Type value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Type value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::CreateTypesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateTypesOpGenericAdaptorBase { +public: + struct Properties { + using valueTy = ::mlir::ArrayAttr; + valueTy value; + + auto getValue() { + auto &propStorage = this->value; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setValue(const ::mlir::ArrayAttr &propValue) { + this->value = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.value == this->value && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CreateTypesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateTypesOpGenericAdaptorBase(CreateTypesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getValueAttr(); + ::mlir::ArrayAttr getValue(); +}; +} // namespace detail +template +class CreateTypesOpGenericAdaptor : public detail::CreateTypesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateTypesOpGenericAdaptorBase; +public: + CreateTypesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateTypesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateTypesOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CreateTypesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateTypesOpAdaptor : public CreateTypesOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateTypesOpGenericAdaptor::CreateTypesOpGenericAdaptor; + CreateTypesOpAdaptor(CreateTypesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateTypesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateTypesOpAdaptor; + template + using GenericAdaptor = CreateTypesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.create_types"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getValueAttr(); + ::mlir::ArrayAttr getValue(); + void setValueAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayAttr type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ArrayAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::CreateTypesOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::EraseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EraseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EraseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EraseOpGenericAdaptorBase(EraseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EraseOpGenericAdaptor : public detail::EraseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EraseOpGenericAdaptorBase; +public: + EraseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EraseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EraseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EraseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EraseOpAdaptor : public EraseOpGenericAdaptor<::mlir::ValueRange> { +public: + using EraseOpGenericAdaptor::EraseOpGenericAdaptor; + EraseOpAdaptor(EraseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EraseOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = EraseOpAdaptor; + template + using GenericAdaptor = EraseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.erase"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::EraseOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ExtractOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtractOpGenericAdaptorBase { +public: + struct Properties { + using indexTy = ::mlir::IntegerAttr; + indexTy index; + + auto getIndex() { + auto &propStorage = this->index; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIndex(const ::mlir::IntegerAttr &propValue) { + this->index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.index == this->index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExtractOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtractOpGenericAdaptorBase(ExtractOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); +}; +} // namespace detail +template +class ExtractOpGenericAdaptor : public detail::ExtractOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtractOpGenericAdaptorBase; +public: + ExtractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtractOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExtractOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRange() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtractOpAdaptor : public ExtractOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtractOpGenericAdaptor::ExtractOpGenericAdaptor; + ExtractOpAdaptor(ExtractOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtractOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtractOpAdaptor; + template + using GenericAdaptor = ExtractOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.extract"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getRange(); + ::mlir::OpOperand &getRangeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value range, unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value range, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value range, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value range, uint32_t index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value range, uint32_t index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ExtractOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::FinalizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FinalizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FinalizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FinalizeOpGenericAdaptorBase(FinalizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FinalizeOpGenericAdaptor : public detail::FinalizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FinalizeOpGenericAdaptorBase; +public: + FinalizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FinalizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FinalizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FinalizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FinalizeOpAdaptor : public FinalizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using FinalizeOpGenericAdaptor::FinalizeOpGenericAdaptor; + FinalizeOpAdaptor(FinalizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FinalizeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FinalizeOpAdaptor; + template + using GenericAdaptor = FinalizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.finalize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::FinalizeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ForEachOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ForEachOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ForEachOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ForEachOpGenericAdaptorBase(ForEachOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ForEachOpGenericAdaptor : public detail::ForEachOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ForEachOpGenericAdaptorBase; +public: + ForEachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ForEachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ForEachOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ForEachOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValues() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ForEachOpAdaptor : public ForEachOpGenericAdaptor<::mlir::ValueRange> { +public: + using ForEachOpGenericAdaptor::ForEachOpGenericAdaptor; + ForEachOpAdaptor(ForEachOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ForEachOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ForEachOpAdaptor; + template + using GenericAdaptor = ForEachOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.foreach"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getValues(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + ::mlir::Block *getSuccessor(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value range, Block *successor, bool initLoop); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value values, ::mlir::Block *successor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Block *successor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +public: + /// Returns the loop variable. + BlockArgument getLoopVariable() { return getRegion().getArgument(0); } +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ForEachOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::FuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FuncOpGenericAdaptorBase { +public: + struct Properties { + using arg_attrsTy = ::mlir::ArrayAttr; + arg_attrsTy arg_attrs; + + auto getArgAttrs() { + auto &propStorage = this->arg_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setArgAttrs(const ::mlir::ArrayAttr &propValue) { + this->arg_attrs = propValue; + } + using function_typeTy = ::mlir::TypeAttr; + function_typeTy function_type; + + auto getFunctionType() { + auto &propStorage = this->function_type; + return ::llvm::cast<::mlir::TypeAttr>(propStorage); + } + void setFunctionType(const ::mlir::TypeAttr &propValue) { + this->function_type = propValue; + } + using res_attrsTy = ::mlir::ArrayAttr; + res_attrsTy res_attrs; + + auto getResAttrs() { + auto &propStorage = this->res_attrs; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setResAttrs(const ::mlir::ArrayAttr &propValue) { + this->res_attrs = propValue; + } + using sym_nameTy = ::mlir::StringAttr; + sym_nameTy sym_name; + + auto getSymName() { + auto &propStorage = this->sym_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setSymName(const ::mlir::StringAttr &propValue) { + this->sym_name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.arg_attrs == this->arg_attrs && + rhs.function_type == this->function_type && + rhs.res_attrs == this->res_attrs && + rhs.sym_name == this->sym_name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + FuncOpGenericAdaptorBase(FuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FuncOpGenericAdaptor : public detail::FuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FuncOpGenericAdaptorBase; +public: + FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FuncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + FuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FuncOpAdaptor : public FuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using FuncOpGenericAdaptor::FuncOpGenericAdaptor; + FuncOpAdaptor(FuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FuncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FuncOpAdaptor; + template + using GenericAdaptor = FuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("function_type"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getArgAttrsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFunctionTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getResAttrsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setFunctionTypeAttr(::mlir::TypeAttr attr); + void setFunctionType(::mlir::FunctionType attrValue); + void setArgAttrsAttr(::mlir::ArrayAttr attr); + void setResAttrsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeArgAttrsAttr(); + ::mlir::Attribute removeResAttrsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, FunctionType type, ArrayRef attrs = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + //===------------------------------------------------------------------===// + // FunctionOpInterface Methods + //===------------------------------------------------------------------===// + + /// Returns the argument types of this function. + ArrayRef getArgumentTypes() { return getFunctionType().getInputs(); } + + /// Returns the result types of this function. + ArrayRef getResultTypes() { return getFunctionType().getResults(); } + + Region *getCallableRegion() { return &getBody(); } +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::FuncOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetAttributeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetAttributeOpGenericAdaptorBase { +public: + struct Properties { + using nameTy = ::mlir::StringAttr; + nameTy name; + + auto getName() { + auto &propStorage = this->name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setName(const ::mlir::StringAttr &propValue) { + this->name = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.name == this->name && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GetAttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GetAttributeOpGenericAdaptorBase(GetAttributeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); +}; +} // namespace detail +template +class GetAttributeOpGenericAdaptor : public detail::GetAttributeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetAttributeOpGenericAdaptorBase; +public: + GetAttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetAttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetAttributeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GetAttributeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetAttributeOpAdaptor : public GetAttributeOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetAttributeOpGenericAdaptor::GetAttributeOpGenericAdaptor; + GetAttributeOpAdaptor(GetAttributeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetAttributeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetAttributeOpAdaptor; + template + using GenericAdaptor = GetAttributeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.get_attribute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::AttributeType> getAttribute(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getNameAttr(); + ::llvm::StringRef getName(); + void setNameAttr(::mlir::StringAttr attr); + void setName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type attribute, ::mlir::Value inputOp, ::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::StringAttr name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type attribute, ::mlir::Value inputOp, ::llvm::StringRef name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::llvm::StringRef name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetAttributeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetAttributeTypeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetAttributeTypeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetAttributeTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetAttributeTypeOpGenericAdaptorBase(GetAttributeTypeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetAttributeTypeOpGenericAdaptor : public detail::GetAttributeTypeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetAttributeTypeOpGenericAdaptorBase; +public: + GetAttributeTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetAttributeTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetAttributeTypeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetAttributeTypeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetAttributeTypeOpAdaptor : public GetAttributeTypeOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetAttributeTypeOpGenericAdaptor::GetAttributeTypeOpGenericAdaptor; + GetAttributeTypeOpAdaptor(GetAttributeTypeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetAttributeTypeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetAttributeTypeOpAdaptor; + template + using GenericAdaptor = GetAttributeTypeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.get_attribute_type"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::AttributeType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::TypeType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetAttributeTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetDefiningOpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetDefiningOpOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetDefiningOpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetDefiningOpOpGenericAdaptorBase(GetDefiningOpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetDefiningOpOpGenericAdaptor : public detail::GetDefiningOpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetDefiningOpOpGenericAdaptorBase; +public: + GetDefiningOpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetDefiningOpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetDefiningOpOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetDefiningOpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetDefiningOpOpAdaptor : public GetDefiningOpOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetDefiningOpOpGenericAdaptor::GetDefiningOpOpGenericAdaptor; + GetDefiningOpOpAdaptor(GetDefiningOpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetDefiningOpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetDefiningOpOpAdaptor; + template + using GenericAdaptor = GetDefiningOpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.get_defining_op"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type inputOp, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetDefiningOpOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetOperandOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetOperandOpGenericAdaptorBase { +public: + struct Properties { + using indexTy = ::mlir::IntegerAttr; + indexTy index; + + auto getIndex() { + auto &propStorage = this->index; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIndex(const ::mlir::IntegerAttr &propValue) { + this->index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.index == this->index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GetOperandOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GetOperandOpGenericAdaptorBase(GetOperandOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); +}; +} // namespace detail +template +class GetOperandOpGenericAdaptor : public detail::GetOperandOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetOperandOpGenericAdaptorBase; +public: + GetOperandOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetOperandOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetOperandOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GetOperandOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetOperandOpAdaptor : public GetOperandOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetOperandOpGenericAdaptor::GetOperandOpGenericAdaptor; + GetOperandOpAdaptor(GetOperandOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetOperandOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetOperandOpAdaptor; + template + using GenericAdaptor = GetOperandOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.get_operand"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::ValueType> getValue(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, uint32_t index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, uint32_t index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetOperandOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetOperandsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetOperandsOpGenericAdaptorBase { +public: + struct Properties { + using indexTy = ::mlir::IntegerAttr; + indexTy index; + + auto getIndex() { + auto &propStorage = this->index; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndex(const ::mlir::IntegerAttr &propValue) { + this->index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.index == this->index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GetOperandsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GetOperandsOpGenericAdaptorBase(GetOperandsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + ::std::optional getIndex(); +}; +} // namespace detail +template +class GetOperandsOpGenericAdaptor : public detail::GetOperandsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetOperandsOpGenericAdaptorBase; +public: + GetOperandsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetOperandsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetOperandsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GetOperandsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetOperandsOpAdaptor : public GetOperandsOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetOperandsOpGenericAdaptor::GetOperandsOpGenericAdaptor; + GetOperandsOpAdaptor(GetOperandsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetOperandsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetOperandsOpAdaptor; + template + using GenericAdaptor = GetOperandsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.get_operands"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getValue(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIndexAttr(); + ::std::optional getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(::std::optional attrValue); + ::mlir::Attribute removeIndexAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value inputOp, std::optional index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, /*optional*/::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, /*optional*/::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetOperandsOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetResultOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetResultOpGenericAdaptorBase { +public: + struct Properties { + using indexTy = ::mlir::IntegerAttr; + indexTy index; + + auto getIndex() { + auto &propStorage = this->index; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIndex(const ::mlir::IntegerAttr &propValue) { + this->index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.index == this->index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GetResultOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GetResultOpGenericAdaptorBase(GetResultOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); +}; +} // namespace detail +template +class GetResultOpGenericAdaptor : public detail::GetResultOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetResultOpGenericAdaptorBase; +public: + GetResultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetResultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetResultOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GetResultOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetResultOpAdaptor : public GetResultOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetResultOpGenericAdaptor::GetResultOpGenericAdaptor; + GetResultOpAdaptor(GetResultOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetResultOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetResultOpAdaptor; + template + using GenericAdaptor = GetResultOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.get_result"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::ValueType> getValue(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, uint32_t index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, uint32_t index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetResultOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetResultsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetResultsOpGenericAdaptorBase { +public: + struct Properties { + using indexTy = ::mlir::IntegerAttr; + indexTy index; + + auto getIndex() { + auto &propStorage = this->index; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setIndex(const ::mlir::IntegerAttr &propValue) { + this->index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.index == this->index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + GetResultsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + GetResultsOpGenericAdaptorBase(GetResultsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + ::std::optional getIndex(); +}; +} // namespace detail +template +class GetResultsOpGenericAdaptor : public detail::GetResultsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetResultsOpGenericAdaptorBase; +public: + GetResultsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetResultsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetResultsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + GetResultsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetResultsOpAdaptor : public GetResultsOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetResultsOpGenericAdaptor::GetResultsOpGenericAdaptor; + GetResultsOpAdaptor(GetResultsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetResultsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetResultsOpAdaptor; + template + using GenericAdaptor = GetResultsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.get_results"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getValue(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIndexAttr(); + ::std::optional getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(::std::optional attrValue); + ::mlir::Attribute removeIndexAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type resultType, Value inputOp, std::optional index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value inputOp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value inputOp, /*optional*/::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, /*optional*/::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetResultsOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetUsersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetUsersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetUsersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetUsersOpGenericAdaptorBase(GetUsersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetUsersOpGenericAdaptor : public detail::GetUsersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetUsersOpGenericAdaptorBase; +public: + GetUsersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetUsersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetUsersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetUsersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetUsersOpAdaptor : public GetUsersOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetUsersOpGenericAdaptor::GetUsersOpGenericAdaptor; + GetUsersOpAdaptor(GetUsersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetUsersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetUsersOpAdaptor; + template + using GenericAdaptor = GetUsersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.get_users"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getOperations(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type operations, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetUsersOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::GetValueTypeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetValueTypeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetValueTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetValueTypeOpGenericAdaptorBase(GetValueTypeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetValueTypeOpGenericAdaptor : public detail::GetValueTypeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetValueTypeOpGenericAdaptorBase; +public: + GetValueTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetValueTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetValueTypeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetValueTypeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetValueTypeOpAdaptor : public GetValueTypeOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetValueTypeOpGenericAdaptor::GetValueTypeOpGenericAdaptor; + GetValueTypeOpAdaptor(GetValueTypeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetValueTypeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetValueTypeOpAdaptor; + template + using GenericAdaptor = GetValueTypeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.get_value_type"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::GetValueTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::IsNotNullOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsNotNullOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsNotNullOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsNotNullOpGenericAdaptorBase(IsNotNullOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsNotNullOpGenericAdaptor : public detail::IsNotNullOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsNotNullOpGenericAdaptorBase; +public: + IsNotNullOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsNotNullOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsNotNullOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsNotNullOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsNotNullOpAdaptor : public IsNotNullOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsNotNullOpGenericAdaptor::IsNotNullOpGenericAdaptor; + IsNotNullOpAdaptor(IsNotNullOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsNotNullOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsNotNullOpAdaptor; + template + using GenericAdaptor = IsNotNullOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.is_not_null"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::PDLType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getTrueDest(); + ::mlir::Block *getFalseDest(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Block *trueDest, ::mlir::Block *falseDest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::IsNotNullOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::RecordMatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RecordMatchOpGenericAdaptorBase { +public: + struct Properties { + using benefitTy = ::mlir::IntegerAttr; + benefitTy benefit; + + auto getBenefit() { + auto &propStorage = this->benefit; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setBenefit(const ::mlir::IntegerAttr &propValue) { + this->benefit = propValue; + } + using generatedOpsTy = ::mlir::ArrayAttr; + generatedOpsTy generatedOps; + + auto getGeneratedOps() { + auto &propStorage = this->generatedOps; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setGeneratedOps(const ::mlir::ArrayAttr &propValue) { + this->generatedOps = propValue; + } + using rewriterTy = ::mlir::SymbolRefAttr; + rewriterTy rewriter; + + auto getRewriter() { + auto &propStorage = this->rewriter; + return ::llvm::cast<::mlir::SymbolRefAttr>(propStorage); + } + void setRewriter(const ::mlir::SymbolRefAttr &propValue) { + this->rewriter = propValue; + } + using rootKindTy = ::mlir::StringAttr; + rootKindTy rootKind; + + auto getRootKind() { + auto &propStorage = this->rootKind; + return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); + } + void setRootKind(const ::mlir::StringAttr &propValue) { + this->rootKind = propValue; + } + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.benefit == this->benefit && + rhs.generatedOps == this->generatedOps && + rhs.rewriter == this->rewriter && + rhs.rootKind == this->rootKind && + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + RecordMatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + RecordMatchOpGenericAdaptorBase(RecordMatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getRewriterAttr(); + ::mlir::SymbolRefAttr getRewriter(); + ::mlir::StringAttr getRootKindAttr(); + ::std::optional< ::llvm::StringRef > getRootKind(); + ::mlir::ArrayAttr getGeneratedOpsAttr(); + ::std::optional< ::mlir::ArrayAttr > getGeneratedOps(); + ::mlir::IntegerAttr getBenefitAttr(); + uint16_t getBenefit(); +}; +} // namespace detail +template +class RecordMatchOpGenericAdaptor : public detail::RecordMatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RecordMatchOpGenericAdaptorBase; +public: + RecordMatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RecordMatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RecordMatchOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + RecordMatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getMatchedOps() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RecordMatchOpAdaptor : public RecordMatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using RecordMatchOpGenericAdaptor::RecordMatchOpGenericAdaptor; + RecordMatchOpAdaptor(RecordMatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RecordMatchOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RecordMatchOpAdaptor; + template + using GenericAdaptor = RecordMatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("benefit"), ::llvm::StringRef("generatedOps"), ::llvm::StringRef("rewriter"), ::llvm::StringRef("rootKind"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBenefitAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBenefitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getGeneratedOpsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getGeneratedOpsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRewriterAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRewriterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getRootKindAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getRootKindAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.record_match"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getMatchedOps(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getMatchedOpsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDest(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::SymbolRefAttr getRewriterAttr(); + ::mlir::SymbolRefAttr getRewriter(); + ::mlir::StringAttr getRootKindAttr(); + ::std::optional< ::llvm::StringRef > getRootKind(); + ::mlir::ArrayAttr getGeneratedOpsAttr(); + ::std::optional< ::mlir::ArrayAttr > getGeneratedOps(); + ::mlir::IntegerAttr getBenefitAttr(); + uint16_t getBenefit(); + void setRewriterAttr(::mlir::SymbolRefAttr attr); + void setRootKindAttr(::mlir::StringAttr attr); + void setRootKind(::std::optional<::llvm::StringRef> attrValue); + void setGeneratedOpsAttr(::mlir::ArrayAttr attr); + void setBenefitAttr(::mlir::IntegerAttr attr); + void setBenefit(uint16_t attrValue); + ::mlir::Attribute removeRootKindAttr(); + ::mlir::Attribute removeGeneratedOpsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange matchedOps, ::mlir::SymbolRefAttr rewriter, /*optional*/::mlir::StringAttr rootKind, /*optional*/::mlir::ArrayAttr generatedOps, ::mlir::IntegerAttr benefit, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange matchedOps, ::mlir::SymbolRefAttr rewriter, /*optional*/::mlir::StringAttr rootKind, /*optional*/::mlir::ArrayAttr generatedOps, ::mlir::IntegerAttr benefit, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange matchedOps, ::mlir::SymbolRefAttr rewriter, /*optional*/::mlir::StringAttr rootKind, /*optional*/::mlir::ArrayAttr generatedOps, uint16_t benefit, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange matchedOps, ::mlir::SymbolRefAttr rewriter, /*optional*/::mlir::StringAttr rootKind, /*optional*/::mlir::ArrayAttr generatedOps, uint16_t benefit, ::mlir::Block *dest); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::RecordMatchOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::ReplaceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReplaceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReplaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReplaceOpGenericAdaptorBase(ReplaceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReplaceOpGenericAdaptor : public detail::ReplaceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReplaceOpGenericAdaptorBase; +public: + ReplaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReplaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReplaceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReplaceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getReplValues() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReplaceOpAdaptor : public ReplaceOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReplaceOpGenericAdaptor::ReplaceOpGenericAdaptor; + ReplaceOpAdaptor(ReplaceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReplaceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReplaceOpAdaptor; + template + using GenericAdaptor = ReplaceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.replace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::Operation::operand_range getReplValues(); + ::mlir::OpOperand &getInputOpMutable(); + ::mlir::MutableOperandRange getReplValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::ValueRange replValues); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::ValueRange replValues); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::ReplaceOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchAttributeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchAttributeOpGenericAdaptorBase { +public: + struct Properties { + using caseValuesTy = ::mlir::ArrayAttr; + caseValuesTy caseValues; + + auto getCaseValues() { + auto &propStorage = this->caseValues; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setCaseValues(const ::mlir::ArrayAttr &propValue) { + this->caseValues = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.caseValues == this->caseValues && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SwitchAttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchAttributeOpGenericAdaptorBase(SwitchAttributeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getCaseValuesAttr(); + ::mlir::ArrayAttr getCaseValues(); +}; +} // namespace detail +template +class SwitchAttributeOpGenericAdaptor : public detail::SwitchAttributeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchAttributeOpGenericAdaptorBase; +public: + SwitchAttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchAttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchAttributeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SwitchAttributeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAttribute() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchAttributeOpAdaptor : public SwitchAttributeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchAttributeOpGenericAdaptor::SwitchAttributeOpGenericAdaptor; + SwitchAttributeOpAdaptor(SwitchAttributeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchAttributeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchAttributeOpAdaptor; + template + using GenericAdaptor = SwitchAttributeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("caseValues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCaseValuesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCaseValuesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.switch_attribute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::AttributeType> getAttribute(); + ::mlir::OpOperand &getAttributeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDefaultDest(); + ::mlir::SuccessorRange getCases(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getCaseValuesAttr(); + ::mlir::ArrayAttr getCaseValues(); + void setCaseValuesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value attribute, ArrayRef caseValues, Block *defaultDest, BlockRange dests); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value attribute, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value attribute, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchAttributeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchOperandCountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchOperandCountOpGenericAdaptorBase { +public: + struct Properties { + using caseValuesTy = ::mlir::DenseIntElementsAttr; + caseValuesTy caseValues; + + auto getCaseValues() { + auto &propStorage = this->caseValues; + return ::llvm::cast<::mlir::DenseIntElementsAttr>(propStorage); + } + void setCaseValues(const ::mlir::DenseIntElementsAttr &propValue) { + this->caseValues = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.caseValues == this->caseValues && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SwitchOperandCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchOperandCountOpGenericAdaptorBase(SwitchOperandCountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getCaseValuesAttr(); + ::mlir::DenseIntElementsAttr getCaseValues(); +}; +} // namespace detail +template +class SwitchOperandCountOpGenericAdaptor : public detail::SwitchOperandCountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchOperandCountOpGenericAdaptorBase; +public: + SwitchOperandCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchOperandCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchOperandCountOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SwitchOperandCountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchOperandCountOpAdaptor : public SwitchOperandCountOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchOperandCountOpGenericAdaptor::SwitchOperandCountOpGenericAdaptor; + SwitchOperandCountOpAdaptor(SwitchOperandCountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchOperandCountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchOperandCountOpAdaptor; + template + using GenericAdaptor = SwitchOperandCountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("caseValues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCaseValuesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCaseValuesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.switch_operand_count"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDefaultDest(); + ::mlir::SuccessorRange getCases(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getCaseValuesAttr(); + ::mlir::DenseIntElementsAttr getCaseValues(); + void setCaseValuesAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value inputOp, ArrayRef counts, Block *defaultDest, BlockRange dests); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::DenseIntElementsAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::DenseIntElementsAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchOperandCountOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchOperationNameOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchOperationNameOpGenericAdaptorBase { +public: + struct Properties { + using caseValuesTy = ::mlir::ArrayAttr; + caseValuesTy caseValues; + + auto getCaseValues() { + auto &propStorage = this->caseValues; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setCaseValues(const ::mlir::ArrayAttr &propValue) { + this->caseValues = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.caseValues == this->caseValues && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SwitchOperationNameOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchOperationNameOpGenericAdaptorBase(SwitchOperationNameOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getCaseValuesAttr(); + ::mlir::ArrayAttr getCaseValues(); +}; +} // namespace detail +template +class SwitchOperationNameOpGenericAdaptor : public detail::SwitchOperationNameOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchOperationNameOpGenericAdaptorBase; +public: + SwitchOperationNameOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchOperationNameOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchOperationNameOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SwitchOperationNameOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchOperationNameOpAdaptor : public SwitchOperationNameOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchOperationNameOpGenericAdaptor::SwitchOperationNameOpGenericAdaptor; + SwitchOperationNameOpAdaptor(SwitchOperationNameOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchOperationNameOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchOperationNameOpAdaptor; + template + using GenericAdaptor = SwitchOperationNameOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("caseValues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCaseValuesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCaseValuesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.switch_operation_name"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDefaultDest(); + ::mlir::SuccessorRange getCases(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getCaseValuesAttr(); + ::mlir::ArrayAttr getCaseValues(); + void setCaseValuesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value inputOp, ArrayRef names, Block *defaultDest, BlockRange dests); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchOperationNameOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchResultCountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchResultCountOpGenericAdaptorBase { +public: + struct Properties { + using caseValuesTy = ::mlir::DenseIntElementsAttr; + caseValuesTy caseValues; + + auto getCaseValues() { + auto &propStorage = this->caseValues; + return ::llvm::cast<::mlir::DenseIntElementsAttr>(propStorage); + } + void setCaseValues(const ::mlir::DenseIntElementsAttr &propValue) { + this->caseValues = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.caseValues == this->caseValues && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SwitchResultCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchResultCountOpGenericAdaptorBase(SwitchResultCountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getCaseValuesAttr(); + ::mlir::DenseIntElementsAttr getCaseValues(); +}; +} // namespace detail +template +class SwitchResultCountOpGenericAdaptor : public detail::SwitchResultCountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchResultCountOpGenericAdaptorBase; +public: + SwitchResultCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchResultCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchResultCountOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SwitchResultCountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputOp() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchResultCountOpAdaptor : public SwitchResultCountOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchResultCountOpGenericAdaptor::SwitchResultCountOpGenericAdaptor; + SwitchResultCountOpAdaptor(SwitchResultCountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchResultCountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchResultCountOpAdaptor; + template + using GenericAdaptor = SwitchResultCountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("caseValues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCaseValuesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCaseValuesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.switch_result_count"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::OperationType> getInputOp(); + ::mlir::OpOperand &getInputOpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDefaultDest(); + ::mlir::SuccessorRange getCases(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::DenseIntElementsAttr getCaseValuesAttr(); + ::mlir::DenseIntElementsAttr getCaseValues(); + void setCaseValuesAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value inputOp, ArrayRef counts, Block *defaultDest, BlockRange dests); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputOp, ::mlir::DenseIntElementsAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputOp, ::mlir::DenseIntElementsAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchResultCountOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchTypeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchTypeOpGenericAdaptorBase { +public: + struct Properties { + using caseValuesTy = ::mlir::ArrayAttr; + caseValuesTy caseValues; + + auto getCaseValues() { + auto &propStorage = this->caseValues; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setCaseValues(const ::mlir::ArrayAttr &propValue) { + this->caseValues = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.caseValues == this->caseValues && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SwitchTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchTypeOpGenericAdaptorBase(SwitchTypeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getCaseValuesAttr(); + ::mlir::ArrayAttr getCaseValues(); +}; +} // namespace detail +template +class SwitchTypeOpGenericAdaptor : public detail::SwitchTypeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchTypeOpGenericAdaptorBase; +public: + SwitchTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchTypeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SwitchTypeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchTypeOpAdaptor : public SwitchTypeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchTypeOpGenericAdaptor::SwitchTypeOpGenericAdaptor; + SwitchTypeOpAdaptor(SwitchTypeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchTypeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchTypeOpAdaptor; + template + using GenericAdaptor = SwitchTypeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("caseValues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCaseValuesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCaseValuesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.switch_type"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::TypeType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDefaultDest(); + ::mlir::SuccessorRange getCases(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getCaseValuesAttr(); + ::mlir::ArrayAttr getCaseValues(); + void setCaseValuesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value edge, ArrayRef types, Block *defaultDest, BlockRange dests); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + auto getCaseTypes() { return getCaseValues().getAsValueRange(); } +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchTypeOp) + +namespace mlir { +namespace pdl_interp { + +//===----------------------------------------------------------------------===// +// ::mlir::pdl_interp::SwitchTypesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchTypesOpGenericAdaptorBase { +public: + struct Properties { + using caseValuesTy = ::mlir::ArrayAttr; + caseValuesTy caseValues; + + auto getCaseValues() { + auto &propStorage = this->caseValues; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setCaseValues(const ::mlir::ArrayAttr &propValue) { + this->caseValues = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.caseValues == this->caseValues && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SwitchTypesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchTypesOpGenericAdaptorBase(SwitchTypesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getCaseValuesAttr(); + ::mlir::ArrayAttr getCaseValues(); +}; +} // namespace detail +template +class SwitchTypesOpGenericAdaptor : public detail::SwitchTypesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchTypesOpGenericAdaptorBase; +public: + SwitchTypesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchTypesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchTypesOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SwitchTypesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchTypesOpAdaptor : public SwitchTypesOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchTypesOpGenericAdaptor::SwitchTypesOpGenericAdaptor; + SwitchTypesOpAdaptor(SwitchTypesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchTypesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchTypesOpAdaptor; + template + using GenericAdaptor = SwitchTypesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("caseValues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCaseValuesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCaseValuesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("pdl_interp.switch_types"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::pdl::RangeType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Block *getDefaultDest(); + ::mlir::SuccessorRange getCases(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getCaseValuesAttr(); + ::mlir::ArrayAttr getCaseValues(); + void setCaseValuesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value edge, ArrayRef types, Block *defaultDest, BlockRange dests); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr caseValues, ::mlir::Block *defaultDest, ::mlir::BlockRange cases); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + auto getCaseTypes() { return getCaseValues().getAsRange(); } +}; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::SwitchTypesOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..4bb776cfa77336964b461f471c1d165026d411eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.cpp.inc @@ -0,0 +1,25 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: PDLInterpOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::PDLInterpDialect) +namespace mlir { +namespace pdl_interp { + +PDLInterpDialect::PDLInterpDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + getContext()->loadDialect(); + + initialize(); +} + +PDLInterpDialect::~PDLInterpDialect() = default; + +} // namespace pdl_interp +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..dcd38db9ece459fe5d77b924f5bfb5c9b5dfda4d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.h.inc @@ -0,0 +1,35 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: PDLInterpOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace pdl_interp { + +class PDLInterpDialect : public ::mlir::Dialect { + explicit PDLInterpDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~PDLInterpDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("pdl_interp"); + } + + /// Returns the name of the function containing the matcher code. This + /// function is called by the interpreter when matching an operation. + static StringRef getMatcherFunctionName() { return "matcher"; } + + /// Returns the name of the module containing the rewrite functions. These + /// functions are invoked by distinct patterns within the matcher function + /// to rewrite the IR after a successful match. + static StringRef getRewriterModuleName() { return "rewriters"; } + }; +} // namespace pdl_interp +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::pdl_interp::PDLInterpDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/FakeQuantSupport.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/FakeQuantSupport.h new file mode 100644 index 0000000000000000000000000000000000000000..367d468b2acf1a8ad68c35dbfa3360c28e546a6a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/FakeQuantSupport.h @@ -0,0 +1,67 @@ +//===- FakeQuantSupport.h - Support utilities for FakeQuant ops -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines support utilities for interoperating with FakeQuant* based +// QAT (Quantized Aware Training) computations, as implemented by TFLite. Note +// that FakeQuant* operators mix multiple concerns specific to how TFLite +// originally implemented quantization. As such, utilities here enforce +// opinions taken by that codebase (vs providing any amount of genericity). +// +// Specifically, it combines the following concerns, each of which would be +// independent variables in a more generic setup: +// - numBits and isSigned imply storage data type (uint8, int8, int16) +// - numBits < 8 is promoted to uint8 or int8 +// - "narrow_range" narrows the lower bound of the storage type's range by +// 1 +// - the specified min/max values are "nudged" so that the result has a zero +// that can be exactly expressed +// - min=max=0 implies scale=0 and zero_point=0 +// +// With the above assumptions applied, every conforming specified FakeQuant op +// can be represented by a UniformQuantizedType. This scheme is not expected to +// be generalized further in the future and should be considered to be a +// legacy set of rules. +// +// As canonically used in TensorFlow graphs, the presence of a FakeQuant node +// is a hint that the specific math represented here has been simulated at +// training time. As such, it is usually not advised to arbitrarily change +// quantization parameters derived from FakeQuant. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_QUANT_FAKEQUANTSUPPORT_H_ +#define MLIR_DIALECT_QUANT_FAKEQUANTSUPPORT_H_ + +#include "mlir/Dialect/Quant/QuantTypes.h" + +namespace mlir { +namespace quant { + +/// Converts per-layer FakeQuant attributes to the corresponding type. +/// In the event that the parameters cannot be converted, returns a nullptr +/// convertible Type and issues an appropriate error. +/// Note that there are multiple variants of a per-layer FakeQuant op, so +/// this function takes the attributes discretely vs taking a reference to the +/// originating op. +UniformQuantizedType fakeQuantAttrsToType(Location loc, unsigned numBits, + double rmin, double rmax, + bool narrowRange, Type expressedType, + bool isSigned = false); + +/// Converts per-channel FakeQuant attributes to the corresponding type. +/// In the event that the parameters cannot be converted, returns a nullptr +/// convertible Type and issues an appropriate error. +UniformQuantizedPerAxisType +fakeQuantAttrsToType(Location loc, unsigned numBits, int32_t quantizedDimension, + ArrayRef rmins, ArrayRef rmax, + bool narrowRange, Type expressedType, + bool isSigned = false); +} // namespace quant +} // namespace mlir + +#endif // MLIR_DIALECT_QUANT_FAKEQUANTSUPPORT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantDialectBytecode.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantDialectBytecode.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..42e014d4485eba9796f1f5092075676c7f574b85 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantDialectBytecode.cpp.inc @@ -0,0 +1,193 @@ +static Attribute readAttribute(MLIRContext* context, DialectBytecodeReader &reader) { + return reader.emitError() << "unknown attribute", Attribute(); +} + +static LogicalResult writeAttribute(Attribute attribute, + DialectBytecodeWriter &writer) { + return TypeSwitch(attribute) + .Default([&](Attribute) { return failure(); }); +} + +static AnyQuantizedType readAnyQuantizedType(MLIRContext* context, DialectBytecodeReader &reader) { + uint64_t flags; + Type storageType; + int64_t storageTypeMin, storageTypeMax; + if (succeeded(reader.readVarInt(flags)) && + succeeded(reader.readType(storageType)) && + succeeded(reader.readSignedVarInt(storageTypeMin)) && + succeeded(reader.readSignedVarInt(storageTypeMax))) { + return get(context, flags, storageType, nullptr, + storageTypeMin, storageTypeMax); + } + return AnyQuantizedType(); +} + +static AnyQuantizedType readAnyQuantizedTypeWithExpressedType(MLIRContext* context, DialectBytecodeReader &reader) { + uint64_t flags; + Type storageType, expressedType; + int64_t storageTypeMin, storageTypeMax; + if (succeeded(reader.readVarInt(flags)) && + succeeded(reader.readType(storageType)) && + succeeded(reader.readType(expressedType)) && + succeeded(reader.readSignedVarInt(storageTypeMin)) && + succeeded(reader.readSignedVarInt(storageTypeMax))) { + return get(context, flags, storageType, expressedType, storageTypeMin, storageTypeMax); + } + return AnyQuantizedType(); +} + +static void write(AnyQuantizedType type, DialectBytecodeWriter &writer) { + if (!type.getExpressedType()) { + writer.writeVarInt(/* AnyQuantizedType */ 1); + writer.writeVarInt(type.getFlags()); + writer.writeType(type.getStorageType()); + writer.writeSignedVarInt(type.getStorageTypeMin()); + writer.writeSignedVarInt(type.getStorageTypeMax()); + } + if (!!type.getExpressedType()) { + writer.writeVarInt(/* AnyQuantizedTypeWithExpressedType */ 2); + writer.writeVarInt(type.getFlags()); + writer.writeType(type.getStorageType()); + writer.writeType(type.getExpressedType()); + writer.writeSignedVarInt(type.getStorageTypeMin()); + writer.writeSignedVarInt(type.getStorageTypeMax()); + } +} + +static CalibratedQuantizedType readCalibratedQuantizedType(MLIRContext* context, DialectBytecodeReader &reader) { + Type expressedType; + double min, max; + if (succeeded(reader.readType(expressedType)) && + succeeded(readDoubleAPFloat(reader, min)) && + succeeded(readDoubleAPFloat(reader, max))) { + return get(context, expressedType, min, max); + } + return CalibratedQuantizedType(); +} + +static void write(CalibratedQuantizedType type, DialectBytecodeWriter &writer) { + writer.writeVarInt(/* CalibratedQuantizedType */ 3); + writer.writeType(type.getExpressedType()); + writer.writeAPFloatWithKnownSemantics(APFloat(type.getMin())); + writer.writeAPFloatWithKnownSemantics(APFloat(type.getMax())); +} + +static UniformQuantizedPerAxisType readUniformQuantizedPerAxisType(MLIRContext* context, DialectBytecodeReader &reader) { + uint64_t flags; + Type storageType, expressedType; + uint64_t quantizedDimension; + int64_t storageTypeMin, storageTypeMax; + SmallVector scales; + SmallVector zeroPoints; + auto readScales = [&]() -> FailureOr { + double temp; + if (succeeded(readDoubleAPFloat(reader, temp))) { + return temp; + } + return failure(); + }; + auto readZeroPoints = [&]() -> FailureOr { + int64_t temp; + if (succeeded(reader.readSignedVarInt(temp))) { + return temp; + } + return failure(); + }; + if (succeeded(reader.readVarInt(flags)) && + succeeded(reader.readType(storageType)) && + succeeded(reader.readType(expressedType)) && + succeeded(reader.readVarInt(quantizedDimension)) && + succeeded(reader.readSignedVarInt(storageTypeMin)) && + succeeded(reader.readSignedVarInt(storageTypeMax)) && + succeeded(reader.readList(scales, readScales)) && + succeeded(reader.readList(zeroPoints, readZeroPoints))) { + return get(context, flags, storageType, expressedType, scales, + zeroPoints, quantizedDimension, storageTypeMin, storageTypeMax); + } + return UniformQuantizedPerAxisType(); +} + +static void write(UniformQuantizedPerAxisType type, DialectBytecodeWriter &writer) { + writer.writeVarInt(/* UniformQuantizedPerAxisType */ 5); + writer.writeVarInt(type.getFlags()); + writer.writeType(type.getStorageType()); + writer.writeType(type.getExpressedType()); + writer.writeVarInt(type.getQuantizedDimension()); + writer.writeSignedVarInt(type.getStorageTypeMin()); + writer.writeSignedVarInt(type.getStorageTypeMax()); + writer.writeList(type.getScales(), [&](double type) { + writer.writeAPFloatWithKnownSemantics(APFloat(type)); + }); + writer.writeList(type.getZeroPoints(), [&](int64_t type) { + writer.writeSignedVarInt(type); + }); +} + +static UniformQuantizedType readUniformQuantizedType(MLIRContext* context, DialectBytecodeReader &reader) { + uint64_t flags; + Type storageType, expressedType; + double scale; + int64_t zeroPoint, storageTypeMin, storageTypeMax; + if (succeeded(reader.readVarInt(flags)) && + succeeded(reader.readType(storageType)) && + succeeded(reader.readType(expressedType)) && + succeeded(readDoubleAPFloat(reader, scale)) && + succeeded(reader.readSignedVarInt(zeroPoint)) && + succeeded(reader.readSignedVarInt(storageTypeMin)) && + succeeded(reader.readSignedVarInt(storageTypeMax))) { + return get(context, flags, storageType, expressedType, scale, zeroPoint, storageTypeMin, storageTypeMax); + } + return UniformQuantizedType(); +} + +static void write(UniformQuantizedType type, DialectBytecodeWriter &writer) { + writer.writeVarInt(/* UniformQuantizedType */ 4); + writer.writeVarInt(type.getFlags()); + writer.writeType(type.getStorageType()); + writer.writeType(type.getExpressedType()); + writer.writeAPFloatWithKnownSemantics(APFloat(type.getScale())); + writer.writeSignedVarInt(type.getZeroPoint()); + writer.writeSignedVarInt(type.getStorageTypeMin()); + writer.writeSignedVarInt(type.getStorageTypeMax()); +} + +static Type readType(MLIRContext* context, DialectBytecodeReader &reader) { + uint64_t kind; + if (failed(reader.readVarInt(kind))) + return Type(); + switch (kind) { + case 1: + return readAnyQuantizedType(context, reader); + case 2: + return readAnyQuantizedTypeWithExpressedType(context, reader); + case 3: + return readCalibratedQuantizedType(context, reader); + case 4: + return readUniformQuantizedType(context, reader); + case 5: + return readUniformQuantizedPerAxisType(context, reader); + default: + reader.emitError() << "unknown attribute code: " << kind; + return Type(); + } + return Type(); +} + +static LogicalResult writeType(Type type, + DialectBytecodeWriter &writer) { + return TypeSwitch(type) + .Case([&](AnyQuantizedType t) { + return write(t, writer), success(); + }) + .Case([&](CalibratedQuantizedType t) { + return write(t, writer), success(); + }) + .Case([&](UniformQuantizedPerAxisType t) { + return write(t, writer), success(); + }) + .Case([&](UniformQuantizedType t) { + return write(t, writer), success(); + }) + .Default([&](Type) { return failure(); }); +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOps.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOps.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..e5840b5d28632b8cb0e2b6424dfe600bd4e5a164 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOps.cpp.inc @@ -0,0 +1,394 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: QuantOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_OP_LIST +#undef GET_OP_LIST + +::mlir::quant::DequantizeCastOp, +::mlir::quant::QuantizeCastOp, +::mlir::quant::StorageCastOp +#endif // GET_OP_LIST + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace quant { + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_QuantOps0( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!((((::llvm::isa<::mlir::FloatType>(type))) || ((::llvm::isa(type)))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::FloatType>(elementType))) || ((::llvm::isa(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::FloatType>(elementType))) || ((::llvm::isa(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be primitive/tensor/vector of real valued primitive (float or quantized type), but got " << type; + } + return ::mlir::success(); +} + +static ::mlir::LogicalResult __mlir_ods_local_type_constraint_QuantOps1( + ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind, + unsigned valueIndex) { + if (!(((((::llvm::isa<::mlir::FloatType>(type))) || ((::llvm::isa(type)))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::FloatType>(elementType))) || ((::llvm::isa(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::FloatType>(elementType))) || ((::llvm::isa(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) || ((((type.isSignlessInteger())) || ((::llvm::isa(type)))) || (((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger())) || ((::llvm::isa(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger())) || ((::llvm::isa(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))))) { + return op->emitOpError(valueKind) << " #" << valueIndex + << " must be real valued or storage primitive or container type, but got " << type; + } + return ::mlir::success(); +} +} // namespace quant +} // namespace mlir +namespace mlir { +namespace quant { + +//===----------------------------------------------------------------------===// +// ::mlir::quant::DequantizeCastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +DequantizeCastOpGenericAdaptorBase::DequantizeCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("quant.dcast", odsAttrs.getContext()); +} + +DequantizeCastOpGenericAdaptorBase::DequantizeCastOpGenericAdaptorBase(DequantizeCastOp op) : DequantizeCastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair DequantizeCastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr DequantizeCastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +DequantizeCastOpAdaptor::DequantizeCastOpAdaptor(DequantizeCastOp op) : DequantizeCastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult DequantizeCastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair DequantizeCastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range DequantizeCastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DequantizeCastOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &DequantizeCastOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair DequantizeCastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range DequantizeCastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value DequantizeCastOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void DequantizeCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void DequantizeCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void DequantizeCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult DequantizeCastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_QuantOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_QuantOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult DequantizeCastOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void DequantizeCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace quant +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::quant::DequantizeCastOp) + +namespace mlir { +namespace quant { + +//===----------------------------------------------------------------------===// +// ::mlir::quant::QuantizeCastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +QuantizeCastOpGenericAdaptorBase::QuantizeCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("quant.qcast", odsAttrs.getContext()); +} + +QuantizeCastOpGenericAdaptorBase::QuantizeCastOpGenericAdaptorBase(QuantizeCastOp op) : QuantizeCastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair QuantizeCastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr QuantizeCastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +QuantizeCastOpAdaptor::QuantizeCastOpAdaptor(QuantizeCastOp op) : QuantizeCastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult QuantizeCastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair QuantizeCastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range QuantizeCastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value QuantizeCastOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &QuantizeCastOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair QuantizeCastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range QuantizeCastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value QuantizeCastOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void QuantizeCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void QuantizeCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void QuantizeCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult QuantizeCastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_QuantOps0(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_QuantOps0(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult QuantizeCastOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void QuantizeCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace quant +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::quant::QuantizeCastOp) + +namespace mlir { +namespace quant { + +//===----------------------------------------------------------------------===// +// ::mlir::quant::StorageCastOp definitions +//===----------------------------------------------------------------------===// + +namespace detail { +StorageCastOpGenericAdaptorBase::StorageCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs) + odsOpName.emplace("quant.scast", odsAttrs.getContext()); +} + +StorageCastOpGenericAdaptorBase::StorageCastOpGenericAdaptorBase(StorageCastOp op) : StorageCastOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {} + +std::pair StorageCastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { + return {index, 1}; +} + +::mlir::DictionaryAttr StorageCastOpGenericAdaptorBase::getAttributes() { + return odsAttrs; +} + +} // namespace detail +StorageCastOpAdaptor::StorageCastOpAdaptor(StorageCastOp op) : StorageCastOpGenericAdaptor(op->getOperands(), op) {} + +::mlir::LogicalResult StorageCastOpAdaptor::verify(::mlir::Location loc) { + return ::mlir::success(); +} + +std::pair StorageCastOp::getODSOperandIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::operand_range StorageCastOp::getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(getOperation()->operand_begin(), valueRange.first), + std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value StorageCastOp::getArg() { + return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin()); +} + +::mlir::OpOperand &StorageCastOp::getArgMutable() { + auto range = getODSOperandIndexAndLength(0); + return getOperation()->getOpOperand(range.first); +} + +std::pair StorageCastOp::getODSResultIndexAndLength(unsigned index) { + return {index, 1}; +} + +::mlir::Operation::result_range StorageCastOp::getODSResults(unsigned index) { + auto valueRange = getODSResultIndexAndLength(index); + return {std::next(getOperation()->result_begin(), valueRange.first), + std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; +} + +::mlir::Value StorageCastOp::getRes() { + return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin()); +} + +void StorageCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg) { + odsState.addOperands(arg); + odsState.addTypes(res); +} + +void StorageCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg) { + odsState.addOperands(arg); + assert(resultTypes.size() == 1u && "mismatched number of results"); + odsState.addTypes(resultTypes); +} + +void StorageCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) { + assert(operands.size() == 1u && "mismatched number of parameters"); + odsState.addOperands(operands); + odsState.addAttributes(attributes); + assert(resultTypes.size() == 1u && "mismatched number of return types"); + odsState.addTypes(resultTypes); +} + +::mlir::LogicalResult StorageCastOp::verifyInvariantsImpl() { + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSOperands(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_QuantOps1(*this, v.getType(), "operand", index++))) + return ::mlir::failure(); + } + } + { + unsigned index = 0; (void)index; + auto valueGroup0 = getODSResults(0); + + for (auto v : valueGroup0) { + if (::mlir::failed(__mlir_ods_local_type_constraint_QuantOps1(*this, v.getType(), "result", index++))) + return ::mlir::failure(); + } + } + return ::mlir::success(); +} + +::mlir::LogicalResult StorageCastOp::verifyInvariants() { + return verifyInvariantsImpl(); +} + +void StorageCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) { +} + +} // namespace quant +} // namespace mlir +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::quant::StorageCastOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOps.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOps.h new file mode 100644 index 0000000000000000000000000000000000000000..14fb3035ab0d38e91d281d0c49495619b58e20ac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOps.h @@ -0,0 +1,27 @@ +//===- QuantOps.h - Quantization Ops and Types ------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_QUANT_QUANTOPS_H_ +#define MLIR_DIALECT_QUANT_QUANTOPS_H_ + +#include "mlir/IR/Attributes.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/Types.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" +#include "llvm/Support/MathExtras.h" + +#include "mlir/Dialect/Quant/QuantOpsDialect.h.inc" + +#define GET_OP_CLASSES +#include "mlir/Dialect/Quant/QuantOps.h.inc" + +#endif // MLIR_DIALECT_QUANT_QUANTOPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..85d83169fc15449a7c96364b4233b074878d943f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOps.h.inc @@ -0,0 +1,334 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: QuantOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace quant { +class DequantizeCastOp; +} // namespace quant +} // namespace mlir +namespace mlir { +namespace quant { +class QuantizeCastOp; +} // namespace quant +} // namespace mlir +namespace mlir { +namespace quant { +class StorageCastOp; +} // namespace quant +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace quant { + +//===----------------------------------------------------------------------===// +// ::mlir::quant::DequantizeCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DequantizeCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DequantizeCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DequantizeCastOpGenericAdaptorBase(DequantizeCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DequantizeCastOpGenericAdaptor : public detail::DequantizeCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DequantizeCastOpGenericAdaptorBase; +public: + DequantizeCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DequantizeCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DequantizeCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DequantizeCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DequantizeCastOpAdaptor : public DequantizeCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using DequantizeCastOpGenericAdaptor::DequantizeCastOpGenericAdaptor; + DequantizeCastOpAdaptor(DequantizeCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DequantizeCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DequantizeCastOpAdaptor; + template + using GenericAdaptor = DequantizeCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quant.dcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace quant +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quant::DequantizeCastOp) + +namespace mlir { +namespace quant { + +//===----------------------------------------------------------------------===// +// ::mlir::quant::QuantizeCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeCastOpGenericAdaptorBase(QuantizeCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class QuantizeCastOpGenericAdaptor : public detail::QuantizeCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeCastOpGenericAdaptorBase; +public: + QuantizeCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeCastOpAdaptor : public QuantizeCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeCastOpGenericAdaptor::QuantizeCastOpGenericAdaptor; + QuantizeCastOpAdaptor(QuantizeCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeCastOpAdaptor; + template + using GenericAdaptor = QuantizeCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quant.qcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace quant +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quant::QuantizeCastOp) + +namespace mlir { +namespace quant { + +//===----------------------------------------------------------------------===// +// ::mlir::quant::StorageCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StorageCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StorageCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StorageCastOpGenericAdaptorBase(StorageCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StorageCastOpGenericAdaptor : public detail::StorageCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StorageCastOpGenericAdaptorBase; +public: + StorageCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StorageCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StorageCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StorageCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StorageCastOpAdaptor : public StorageCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using StorageCastOpGenericAdaptor::StorageCastOpGenericAdaptor; + StorageCastOpAdaptor(StorageCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StorageCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StorageCastOpAdaptor; + template + using GenericAdaptor = StorageCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quant.scast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getRes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace quant +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quant::StorageCastOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOpsDialect.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOpsDialect.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..9a24bdd4aac4ef20a2fbf0b6833dd1e8d93634f4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOpsDialect.cpp.inc @@ -0,0 +1,23 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: QuantOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::quant::QuantizationDialect) +namespace mlir { +namespace quant { + +QuantizationDialect::QuantizationDialect(::mlir::MLIRContext *context) + : ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get()) { + + initialize(); +} + +QuantizationDialect::~QuantizationDialect() = default; + +} // namespace quant +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..dd1bfbd3c2dacda7ced1921ea13490b29bcd5bc8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantOpsDialect.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: QuantOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace quant { + +class QuantizationDialect : public ::mlir::Dialect { + explicit QuantizationDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~QuantizationDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("quant"); + } + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; +}; +} // namespace quant +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quant::QuantizationDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantTypes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..2776b3e6e17ba50fb1d312a9621f1cdf10da264d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/QuantTypes.h @@ -0,0 +1,407 @@ +//===- QuantTypes.h - Quantization Ops and Types ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_QUANT_QUANTTYPES_H +#define MLIR_DIALECT_QUANT_QUANTTYPES_H + +#include "mlir/IR/Attributes.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/Types.h" +#include "llvm/Support/MathExtras.h" + +namespace mlir { +namespace quant { +namespace detail { + +struct QuantizedTypeStorage; +struct AnyQuantizedTypeStorage; +struct UniformQuantizedTypeStorage; +struct UniformQuantizedPerAxisTypeStorage; +struct CalibratedQuantizedTypeStorage; + +} // namespace detail + +/// Enumeration of bit-mapped flags related to quantized types. +namespace QuantizationFlags { +enum FlagValue { + // Indicates that the storage type should be interpreted as a signed + // integer. The default is to interpret it as an unsigned value. + Signed = 1, +}; +} // namespace QuantizationFlags + +/// Base class for all quantized types known to this dialect. +/// All quantized types have: +/// - storageType: The (narrower) numeric type that is being used to +/// approximate some expressed type. +/// - expressedType: The type that is being approximated. +/// +/// The base class provides generic support for manipulating the types based +/// on these fields. +class QuantizedType : public Type { +public: + using ImplType = detail::QuantizedTypeStorage; + using Type::Type; + + /// The maximum number of bits supported for storage types. + static constexpr unsigned MaxStorageBits = 32; + + static LogicalResult verify(function_ref emitError, + unsigned flags, Type storageType, + Type expressedType, int64_t storageTypeMin, + int64_t storageTypeMax); + + /// Support method to enable LLVM-style type casting. + static bool classof(Type type); + + /// Gets the minimum possible stored by a storageType. storageTypeMin must + /// be greater than or equal to this value. + static int64_t getDefaultMinimumForInteger(bool isSigned, + unsigned integralWidth) { + if (isSigned) { + return llvm::minIntN(integralWidth); + } + return 0; + } + + /// Gets the maximum possible stored by a storageType. storageTypeMax must + /// be less than or equal to this value. + static int64_t getDefaultMaximumForInteger(bool isSigned, + unsigned integralWidth) { + if (isSigned) { + return llvm::maxIntN(integralWidth); + } + return llvm::maxUIntN(integralWidth); + } + + /// Gets the original expressed type that this quantized type approximates. + /// Note that this presumes that the quantized type was always derived from + /// a floating point type, which in the broadest definition, is not true (i.e. + /// it could be some form of integral, fixed type or affine type in its own + /// right); however, at the high level, no examples of such usage are + /// presently known and the restriction serves some useful purposes (such as + /// always being able to reverse a transformation or measure error). In most + /// cases, this will be f32. + Type getExpressedType() const; + + /// Gets the flags associated with this type. Typically a more specific + /// accessor is appropriate. + unsigned getFlags() const; + + // Convenience helpers. + /// Whether the storage type should be interpreted as a signed quantity + /// (true) or an unsigned value (false). + bool isSigned() const { + return (getFlags() & QuantizationFlags::Signed) == + QuantizationFlags::Signed; + } + + /// Gets the underlying type used for to store values. Note that this may + /// be signed or unsigned. Use the isSigned() accessor to differentiate. + Type getStorageType() const; + + /// The minimum value that storageType can take. + int64_t getStorageTypeMin() const; + + /// The maximum value that storageType can take. + int64_t getStorageTypeMax() const; + + /// Gets the integral bit width that the underlying storage type can exactly + /// represent. For integral storage types, this will just be their width. + unsigned getStorageTypeIntegralWidth() const; + + /// Returns whether the candidateExpressedType is a match for this + /// QuantizedType. This will be true if the candidate type is either a + /// primitive type or a container type whose element type equals this + /// QuantizedType's expressed type. + /// Examples of compatible candidateExpressedType: + /// !quant.uniform =~ f32 + /// !quant.uniform =~ tensor<4xf32> + bool isCompatibleExpressedType(Type candidateExpressedType); + + /// Returns the element type as a QuantizedType or nullptr if it is not + /// a quantized type. If the type is primitive, returns that. If it is a + /// container (vector/tensor), return the element type. + /// Examples: + /// !quant.uniform -> !quant.uniform + /// tensor<4x!quant.uniform -> quant.uniform + static QuantizedType getQuantizedElementType(Type primitiveOrContainerType); + + /// Casts from a type based on the storageType to a corresponding type based + /// on this type (returns nullptr if the cast is not valid). + /// Examples: + /// i8 -> !quant.uniform + /// tensor<4xi8> -> tensor<4x!quant.uniform> + /// vector<4xi8> -> vector<4x!quant.uniform> + Type castFromStorageType(Type candidateType); + + /// Casts from a type based on a QuantizedType to a corresponding type based + /// on the storageType (returns nullptr if the cast is not valid). + /// This is the inverse of castFromStorageType(). + static Type castToStorageType(Type quantizedType); + + /// Casts from a type based on the expressedType to a corresponding type based + /// on this type (returns nullptr if the cast is not valid). + /// Examples: + /// f32 -> !quant.uniform + /// tensor<4xf32> -> tensor<4x!quant.uniform> + /// vector<4xf32> -> vector<4x!quant.uniform> + Type castFromExpressedType(Type candidateType); + + /// Casts from a type based on QuantizedType to a corresponding type based + /// on the expressedType (returns nullptr if the cast is not valid). + /// This is the inverse of castFromExpressedType. + static Type castToExpressedType(Type quantizedType); + + /// Casts from a type based on the expressedType to the equivalent type + /// based on storageType by way of this QuantizedType. Equivalent to: + /// QuantizedType::castToStorageType(castFromExpressedType(candidateType)) + /// (but with validity checks). + /// Example (for this = !quant.uniform): + /// tensor<4xf32> -> tensor<4xi8> + Type castExpressedToStorageType(Type candidateType); + +private: + /// Hide the following methods inherited from `Type`. It is almost certainly + /// a bug to call them from a `QuantizedType` object. Users should call + /// `getStorageType` or `getExpressedType` to get the underlying types + /// they want to inspect. + using Type::isBF16; + using Type::isF16; + using Type::isF32; + using Type::isF64; + using Type::isIndex; + using Type::isInteger; +}; + +/// A quantized type that maps storage to/from expressed types in an +/// unspecified way. +/// +/// Typical syntax: +/// quant.any +/// quant.any +/// quant.any> +/// +/// Note that for the any type, the expressed type is optional. +class AnyQuantizedType + : public Type::TypeBase { +public: + using Base::Base; + using Base::getChecked; + + /// Gets an instance of the type with all parameters specified but not + /// checked. + static AnyQuantizedType get(unsigned flags, Type storageType, + Type expressedType, int64_t storageTypeMin, + int64_t storageTypeMax); + + /// Gets an instance of the type with all specified parameters checked. + /// Returns a nullptr convertible type on failure. + static AnyQuantizedType + getChecked(function_ref emitError, unsigned flags, + Type storageType, Type expressedType, int64_t storageTypeMin, + int64_t storageTypeMax); + + /// Verifies construction invariants and issues errors/warnings. + static LogicalResult verify(function_ref emitError, + unsigned flags, Type storageType, + Type expressedType, int64_t storageTypeMin, + int64_t storageTypeMax); +}; + +/// Represents a family of uniform, quantized types. +/// +/// Each instance of this type expresses a mapping between real values (most +/// often expressed in floating point f32) and quantized values (either fixed +/// point or affine). +/// +/// The relationship is: +/// real_value = scale * (quantized_value - zero_point) +/// +/// It is used as part of high level graph transformations that have the goal +/// of re-expressing parts of a computation in terms of this common form for +/// more efficient execution at runtime. In addition, it is designed to be +/// expressive enough to facilitate lowering to precise types and operations +/// in target hardware. +/// +/// As a high-level type, focused on intermediate passes, this type holds +/// opinions consistent with high-level usage. If lowering math kernels below +/// the high level arithmetic ops (i.e. to LLVM IR or hardware specific +/// instruction sets), it is expected that the information expressed here +/// will be used to drive low level codegen and target specific type selection, +/// but this type will likely be erased in the process. +/// +/// Syntax synopsis: +/// Per-layer, all parameters expressed: +/// !quant +/// Per-layer, optional parameters omitted: +/// !quant +/// +/// StorageType: 'i'|'u' NumBits +/// ExpressedType: 'f16', 'f32', 'bf16', 'f64' +/// Scale: A legal double value +/// ZeroPoint: An integer value +class UniformQuantizedType + : public Type::TypeBase { +public: + using Base::Base; + using Base::getChecked; + + /// Gets an instance of the type with all parameters specified but not + /// checked. + static UniformQuantizedType get(unsigned flags, Type storageType, + Type expressedType, double scale, + int64_t zeroPoint, int64_t storageTypeMin, + int64_t storageTypeMax); + + /// Gets an instance of the type with all specified parameters checked. + /// Returns a nullptr convertible type on failure. + static UniformQuantizedType + getChecked(function_ref emitError, unsigned flags, + Type storageType, Type expressedType, double scale, + int64_t zeroPoint, int64_t storageTypeMin, int64_t storageTypeMax); + + /// Verifies construction invariants and issues errors/warnings. + static LogicalResult verify(function_ref emitError, + unsigned flags, Type storageType, + Type expressedType, double scale, + int64_t zeroPoint, int64_t storageTypeMin, + int64_t storageTypeMax); + + /// Gets the scale term. The scale designates the difference between the real + /// values corresponding to consecutive quantized values differing by 1. + double getScale() const; + + /// Gets the storage value corresponding to the real value 0 in the affine + /// equation. + int64_t getZeroPoint() const; + + // Fixed point values are real numbers divided by a scale. + // Currently, only signed storage types are treated as fixed point. + // A fixed point value can be obtained from an affine value by subtracting + // the zeroPoint. + // In the future, this may be explicit versus implied by type and zeroPoint. + bool isFixedPoint() const { return isSigned() && getZeroPoint() == 0; } +}; + +/// Represents per-axis (also known as per-channel quantization). +/// +/// Syntax synopsis: +/// Per-axis, all parameters expressed: +/// !quant +/// Per-axis, optional parameters omitted: +/// !quant +/// +/// StorageType: 'i'|'u' NumBits +/// ExpressedType: 'f16', 'f32', 'bf16', 'f64' +/// QuantizedDim: An integer value +/// QuantParams: (Scale ':' ZeroPoint)+ +/// Scale: A legal double value +/// ZeroPoint: An integer value +class UniformQuantizedPerAxisType + : public Type::TypeBase { +public: + using Base::Base; + using Base::getChecked; + + /// Gets an instance of the type with all parameters specified but not + /// checked. + static UniformQuantizedPerAxisType + get(unsigned flags, Type storageType, Type expressedType, + ArrayRef scales, ArrayRef zeroPoints, + int32_t quantizedDimension, int64_t storageTypeMin, + int64_t storageTypeMax); + + /// Gets an instance of the type with all specified parameters checked. + /// Returns a nullptr convertible type on failure. + static UniformQuantizedPerAxisType + getChecked(function_ref emitError, unsigned flags, + Type storageType, Type expressedType, ArrayRef scales, + ArrayRef zeroPoints, int32_t quantizedDimension, + int64_t storageTypeMin, int64_t storageTypeMax); + + /// Verifies construction invariants and issues errors/warnings. + static LogicalResult verify(function_ref emitError, + unsigned flags, Type storageType, + Type expressedType, ArrayRef scales, + ArrayRef zeroPoints, + int32_t quantizedDimension, + int64_t storageTypeMin, int64_t storageTypeMax); + + /// Gets the quantization scales. The scales designate the difference between + /// the real values corresponding to consecutive quantized values differing + /// by 1. The ith scale corresponds to the ith slice in the + /// quantized_dimension. + ArrayRef getScales() const; + + /// Gets the storage values corresponding to the real value 0 in the affine + /// equation. The ith zero point corresponds to the ith slice in the + /// quantized_dimension. + ArrayRef getZeroPoints() const; + + /// Specifies the dimension of the Tensor's shape that the scales and + /// zero_points correspond to. For example, a tensor t, with dims=[4, 3, 2, 1] + /// with quantization params: + /// scales=[1.0, 2.0, 3.0], zeroPoints=[1, 2, 3], quantizedDimension=1 + /// will be quantized across the second dimension of t. + /// t[:, 0, :, :] will have scale[0]=1.0, zero_point[0]=1 + /// t[:, 1, :, :] will have scale[1]=2.0, zero_point[0]=2 + /// t[:, 2, :, :] will have scale[2]=3.0, zero_point[0]=3 + int32_t getQuantizedDimension() const; + + /// Fixed point values are real numbers divided by a scale. + /// Currently, only signed storage types are treated as fixed point. + /// A fixed point value can be obtained from an affine value by subtracting + /// the zeroPoint. + /// In the future, this may be explicit versus implied by type and zeroPoint. + bool isFixedPoint() const { + if (!isSigned()) + return false; + return !llvm::is_contained(getZeroPoints(), 0); + } +}; + +/// A quantized type that infers its range from given min/max values. +/// +/// Typical syntax: +/// quant.calibrated> +class CalibratedQuantizedType + : public Type::TypeBase { +public: + using Base::Base; + using Base::getChecked; + + /// Gets an instance of the type with all parameters specified but not + /// checked. + static CalibratedQuantizedType get(Type expressedType, double min, + double max); + + /// Gets an instance of the type with all specified parameters checked. + /// Returns a nullptr convertible type on failure. + static CalibratedQuantizedType + getChecked(function_ref emitError, Type expressedType, + double min, double max); + + /// Verifies construction invariants and issues errors/warnings. + static LogicalResult verify(function_ref emitError, + Type expressedType, double min, double max); + double getMin() const; + double getMax() const; +}; + +} // namespace quant +} // namespace mlir + +#endif // MLIR_DIALECT_QUANT_QUANTTYPES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/UniformSupport.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/UniformSupport.h new file mode 100644 index 0000000000000000000000000000000000000000..4119aced4c07521d20e17372256cc6d5eff51a68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Quant/UniformSupport.h @@ -0,0 +1,221 @@ +//===- UniformSupport.h - Support utilities for uniform quant ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_QUANT_UNIFORMSUPPORT_H_ +#define MLIR_DIALECT_QUANT_UNIFORMSUPPORT_H_ + +#include + +#include "mlir/Dialect/Quant/QuantTypes.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Types.h" +#include "llvm/ADT/APFloat.h" +#include "llvm/ADT/APInt.h" +#include "llvm/ADT/APSInt.h" + +namespace mlir { +namespace quant { + +/// Performs type conversion from an arbitrary input type to a type +/// that is expressed by a QuantizedType. +/// +/// This handles cases where the inputType is a supported primitive type +/// (i.e. f32, bf16, etc) or a vector/tensor type based on a supported +/// elemental type. +/// +/// Since conversion often involves introspecting some attributes of the +/// input type in order to determine how to represent it, this is a two step +/// process. +struct ExpressedToQuantizedConverter { + /// Creates a converter for the given input type. + static ExpressedToQuantizedConverter forInputType(Type inputType); + + /// Converts the inputType to be based on the given elemental type, + /// returning the new type (or nullptr and emit an error on failure). + Type convert(QuantizedType elementalType) const; + + /// Whether the conversion is legal. + explicit operator bool() const { return (bool)expressedType; } + + /// The input type that is being converted from. + /// This may be an elemental or composite type. + const Type inputType; + + /// Supported, elemental expressed type (i.e. f32). + /// Will be nullptr if conversion is not supported. + const Type expressedType; +}; + +/// Reference implementation of converting between real numbers and values +/// represented by a UniformQuantizedType. +/// Note that this is not expected to be speedy and may be superseded eventually +/// by a more optimal implementation. +/// Also, the interface assumes that quantization is done per-layer and will +/// need to be wider for various per-channel schemes. As such, this is a +/// placeholder. +class UniformQuantizedValueConverter { +public: + explicit UniformQuantizedValueConverter(UniformQuantizedType uniformType) + : UniformQuantizedValueConverter( + uniformType.getScale(), + static_cast(uniformType.getZeroPoint()), + static_cast(uniformType.getStorageTypeMin()), + static_cast(uniformType.getStorageTypeMax()), + uniformType.getStorageTypeIntegralWidth(), uniformType.isSigned()) { + assert(isa(uniformType.getExpressedType())); + assert(uniformType.getStorageType().isSignlessInteger()); + } + + UniformQuantizedValueConverter(double scale, double zeroPoint, + double clampMin, double clampMax, + uint32_t storageBitWidth, bool isSigned) + : scale(scale), zeroPoint(zeroPoint), clampMin(clampMin), + clampMax(clampMax), scaleDouble(scale), zeroPointDouble(zeroPoint), + clampMinDouble(clampMin), clampMaxDouble(clampMax), + storageBitWidth(storageBitWidth), isSigned(isSigned), + roundMode(APFloat::rmNearestTiesToAway) {} + + UniformQuantizedValueConverter(double scale, double zeroPoint, + const APFloat &clampMin, + const APFloat &clampMax, + uint32_t storageBitWidth, bool isSigned) + : scale(scale), zeroPoint(zeroPoint), clampMin(clampMin), + clampMax(clampMax), scaleDouble(scale), zeroPointDouble(zeroPoint), + clampMinDouble(clampMin.convertToDouble()), + clampMaxDouble(clampMax.convertToDouble()), + storageBitWidth(storageBitWidth), isSigned(isSigned), + roundMode(APFloat::rmNearestTiesToAway) {} + + virtual APInt quantizeFloatToInt(APFloat expressedValue) const { + // This function is a performance critical code path in quantization + // since it runs for each single float parameter value. + + // Specialize f32->u8/i8 case to optimize performance. + if (&expressedValue.getSemantics() == &APFloat::IEEEsingle() && + storageBitWidth == 8 && + roundMode == llvm::APFloatBase::rmNearestTiesToAway) { + return quantizeF32ToInt8(expressedValue); + } + + bool lossy; + expressedValue.convert(scale.getSemantics(), roundMode, &lossy); + // fixedpoint = clamp(clampMin, clampMax, ( + // roundHalfToEven(expressed / scale) + zeroPoint)) + APFloat scaled = (expressedValue / scale); + scaled.roundToIntegral(roundMode); + scaled.add(zeroPoint, roundMode); + APFloat fixedpoint = llvm::minimum(scaled, clampMax); + fixedpoint = llvm::maximum(fixedpoint, clampMin); + + llvm::APSInt result(storageBitWidth, !isSigned); + fixedpoint.convertToInteger(result, roundMode, &lossy); + + return std::move(result); + } + + int64_t quantizeFloatToInt64(APFloat expressedValue) const { + APInt qValue = quantizeFloatToInt(std::move(expressedValue)); + return isSigned ? qValue.getSExtValue() : qValue.getZExtValue(); + } + + virtual ~UniformQuantizedValueConverter() = default; + +private: + // An optimized implementation to quantize f32 to i8/u8 with C++ native + // arithmetic. + virtual APInt quantizeF32ToInt8(APFloat expressedValue) const { + assert(&expressedValue.getSemantics() == &APFloat::IEEEsingle()); + assert(storageBitWidth == 8); + assert(roundMode == llvm::APFloatBase::rmNearestTiesToAway); + + const float realValue = expressedValue.convertToFloat(); + + const double scaled = realValue / scaleDouble + zeroPointDouble; + // Round to nearest integer with halfway cases rounded away from zero. + const double scaledRounded = std::round(scaled); + const double clamped = + std::min(std::max(scaledRounded, clampMinDouble), clampMaxDouble); + + uint64_t signlessResult; + if (isSigned) { + int64_t clampedInt = static_cast(clamped); + memcpy(&signlessResult, &clampedInt, sizeof(clampedInt)); + } else { + signlessResult = static_cast(clamped); + } + return APInt(storageBitWidth, signlessResult); + } + + // Keep both APFloat and double versions of the quantization parameters + // around since they will be used in generic and specialized arithmetic, + // respectively. + const APFloat scale; + const APFloat zeroPoint; + const APFloat clampMin; + const APFloat clampMax; + + const double scaleDouble; + const double zeroPointDouble; + const double clampMinDouble; + const double clampMaxDouble; + + const uint32_t storageBitWidth; + const bool isSigned; + const llvm::APFloat::roundingMode roundMode; +}; + +/// An utility class to quantize an attribute by the per-axis quantization +/// parameters. The size of the quantization dim in the converted elements +/// attribute should match the size of scales/zeroPoints vectors in the +/// quantization parameters. +class UniformQuantizedPerAxisValueConverter { +public: + explicit UniformQuantizedPerAxisValueConverter( + UniformQuantizedPerAxisType uniformType) + : scales(uniformType.getScales()), + zeroPoints(uniformType.getZeroPoints()), + clampMin(static_cast(uniformType.getStorageTypeMin())), + clampMax(static_cast(uniformType.getStorageTypeMax())), + storageBitWidth(uniformType.getStorageTypeIntegralWidth()), + isSigned(uniformType.isSigned()), + quantizationDim(uniformType.getQuantizedDimension()) { + assert(isa(uniformType.getExpressedType())); + assert(uniformType.getStorageType().isSignlessInteger()); + assert(scales.size() == zeroPoints.size()); + } + + /// Quantize an Attribute by the quantization parameters. Return nullptr if + /// the conversion fails or the input array isn't an ElementsAttr. + ElementsAttr convert(Attribute realValue); + +private: + /// Quantize an DenseFPElementsAttr by the quantization parameters. + DenseElementsAttr convert(DenseFPElementsAttr attr); + + /// Get a uniform converter for the index-th chunk along the quantizationDim. + /// All the elements in this chunk is quantized by the returned converter. + UniformQuantizedValueConverter getPerChunkConverter(int index) const { + UniformQuantizedValueConverter converter(scales[index], zeroPoints[index], + clampMin, clampMax, + storageBitWidth, isSigned); + return converter; + } + + const ArrayRef scales; + const ArrayRef zeroPoints; + const APFloat clampMin; + const APFloat clampMax; + const uint32_t storageBitWidth; + const bool isSigned; + int32_t quantizationDim; +}; + +} // namespace quant +} // namespace mlir + +#endif // MLIR_DIALECT_QUANT_UNIFORMSUPPORT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.cpp.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.cpp.inc new file mode 100644 index 0000000000000000000000000000000000000000..2d1b9155128f7f08a97280c126a75f89f42fb8b3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.cpp.inc @@ -0,0 +1,21 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Definitions *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +/// Return mapping as an integer from the attribute. +int64_t mlir::DeviceMappingAttrInterface::getMappingId() const { + return getImpl()->getMappingId(getImpl(), *this); + } +/// Return true if the attribute specifies a linear mapping +bool mlir::DeviceMappingAttrInterface::isLinearMapping() const { + return getImpl()->isLinearMapping(getImpl(), *this); + } +/// Return the [0..n) relative index of the attribute depending on its group. +/// This can be used to index into a contiguous array. +int64_t mlir::DeviceMappingAttrInterface::getRelativeIndex() const { + return getImpl()->getRelativeIndex(getImpl(), *this); + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..eebcbc720d080a4676c9c74df831af4250880cd9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.h.inc @@ -0,0 +1,92 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +class DeviceMappingAttrInterface; +namespace detail { +struct DeviceMappingAttrInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + int64_t (*getMappingId)(const Concept *impl, ::mlir::Attribute ); + bool (*isLinearMapping)(const Concept *impl, ::mlir::Attribute ); + int64_t (*getRelativeIndex)(const Concept *impl, ::mlir::Attribute ); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::DeviceMappingAttrInterface; + Model() : Concept{getMappingId, isLinearMapping, getRelativeIndex} {} + + static inline int64_t getMappingId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); + static inline bool isLinearMapping(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); + static inline int64_t getRelativeIndex(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::DeviceMappingAttrInterface; + FallbackModel() : Concept{getMappingId, isLinearMapping, getRelativeIndex} {} + + static inline int64_t getMappingId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); + static inline bool isLinearMapping(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); + static inline int64_t getRelativeIndex(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteAttr; + }; +};template +struct DeviceMappingAttrInterfaceTrait; + +} // namespace detail +class DeviceMappingAttrInterface : public ::mlir::AttributeInterface { +public: + using ::mlir::AttributeInterface::AttributeInterface; + template + struct Trait : public detail::DeviceMappingAttrInterfaceTrait {}; + /// Return mapping as an integer from the attribute. + int64_t getMappingId() const; + /// Return true if the attribute specifies a linear mapping + bool isLinearMapping() const; + /// Return the [0..n) relative index of the attribute depending on its group. + /// This can be used to index into a contiguous array. + int64_t getRelativeIndex() const; +}; +namespace detail { + template + struct DeviceMappingAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { + }; +}// namespace detail +} // namespace mlir +namespace mlir { +template +int64_t detail::DeviceMappingAttrInterfaceInterfaceTraits::Model::getMappingId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { + return (::llvm::cast(tablegen_opaque_val)).getMappingId(); +} +template +bool detail::DeviceMappingAttrInterfaceInterfaceTraits::Model::isLinearMapping(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { + return (::llvm::cast(tablegen_opaque_val)).isLinearMapping(); +} +template +int64_t detail::DeviceMappingAttrInterfaceInterfaceTraits::Model::getRelativeIndex(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { + return (::llvm::cast(tablegen_opaque_val)).getRelativeIndex(); +} +template +int64_t detail::DeviceMappingAttrInterfaceInterfaceTraits::FallbackModel::getMappingId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { + return static_cast(impl)->getMappingId(tablegen_opaque_val); +} +template +bool detail::DeviceMappingAttrInterfaceInterfaceTraits::FallbackModel::isLinearMapping(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { + return static_cast(impl)->isLinearMapping(tablegen_opaque_val); +} +template +int64_t detail::DeviceMappingAttrInterfaceInterfaceTraits::FallbackModel::getRelativeIndex(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { + return static_cast(impl)->getRelativeIndex(tablegen_opaque_val); +} +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Traits.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Traits.h new file mode 100644 index 0000000000000000000000000000000000000000..b8764bbac0d7de90639ec3528f977a7f0fa0d561 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/external/llvm-project/mlir/include/mlir/Dialect/Traits.h @@ -0,0 +1,99 @@ +//===- Traits.h - Common op traits shared by dialects -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file declares common op traits that are not core to MLIR but can be +// shared by multiple dialects. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_TRAITS_H +#define MLIR_DIALECT_TRAITS_H + +#include "mlir/IR/OpDefinition.h" + +namespace mlir { +namespace OpTrait { + +// These functions are out-of-line implementations of the methods in the +// corresponding trait classes. This avoids them being template +// instantiated/duplicated. +namespace impl { +LogicalResult verifyCompatibleOperandBroadcast(Operation *op); +} // namespace impl + +namespace util { +/// Returns true and sets `resultShape` to the broadcasted shape from the two +/// given shapes if they are broadcast compatible. Returns false and clears +/// `resultShape` otherwise. +/// +/// The rules for determining the result shape are: +/// +/// Zip together the dimensions in the two given shapes by prepending the shape +/// with less dimensions with 1s. For each dimension pair, deduces the result +/// dimension according to the following order: +/// - If there are unknown dimensions, follows the TensorFlow behavior: +/// - If either dimension is greater than 1, we assume that the program is +/// correct, and the other dimension will be broadcast to match it. +/// - If either dimension is 1, the other dimension is the result. +/// - Otherwise, the result dimension is unknown dimension. +/// - If one of the dimension is 1, the other dimension is the result. +/// - If two dimensions are the same, that's the result. +/// - Otherwise, incompatible shape. +bool getBroadcastedShape(ArrayRef shape1, ArrayRef shape2, + SmallVectorImpl &resultShape); + +/// Returns true if a broadcast between n shapes is guaranteed to be +/// successful and not result in an error. False does not guarantee that the +/// shapes are not broadcastable; it might guarantee that they are not +/// broadcastable or it might mean that this function does not have enough +/// information to know. +/// +/// Conceptually, this returns true if getBroadcastedShape would have returned +/// true and vice versa, with one exception. If a dimension is unknown in both +/// shapes, getBroadcastedShape would return true and have a result with unknown +/// dimension, while this function will return false because it's possible for +/// both shapes to have a dimension greater than 1 and different which would +/// fail to broadcast. +bool staticallyKnownBroadcastable(ArrayRef> shapes); +bool staticallyKnownBroadcastable(ArrayRef shape1, + ArrayRef shape2); + +/// Returns the result broadcast composition type from the two given types by +/// following NumPy broadcast semantics. Returned type may have dynamic shape if +/// either of the input types has dynamic shape. Returns null type if the two +/// given types are not broadcast-compatible. +/// +/// elementType, if specified, will be used as the element type of the +/// broadcasted result type. Otherwise it is required that the element type of +/// type1 and type2 is the same and this element type will be used as the +/// resultant element type. +Type getBroadcastedType(Type type1, Type type2, Type elementType = nullptr); + +} // namespace util + +/// Trait for ops that are known to have broadcast compatible operands and +/// result types. Specifically, starting from the most varying dimension, each +/// dimension pair of the operands' shapes should either be the same or one +/// of them is one. Also, the results's shapes should have the corresponding +/// dimension equal to the larger one, if known. Shapes are checked partially if +/// ranks or dimensions are not known. For example, an op with tensor +/// and tensor<2xf32> as operand types and tensor<5x3x2xi16> as the result +/// type has broadcast compatible operands ns result types. +template +class ResultsBroadcastableShape + : public TraitBase { +public: + static LogicalResult verifyTrait(Operation *op) { + return impl::verifyCompatibleOperandBroadcast(op); + } +}; + +} // namespace OpTrait +} // namespace mlir + +#endif // MLIR_DIALECT_TRAITS_H